From 5ed6620bad808381fce94f2cd67ee911b4d45bff Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 21 Mar 2007 19:19:04 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.dcu | Bin 0 -> 8556 bytes Game/Code/Classes/TextGL.pas | 345 +++++ Game/Code/Classes/UCatCovers.dcu | Bin 0 -> 4945 bytes Game/Code/Classes/UCatCovers.pas | 143 ++ Game/Code/Classes/UCovers.dcu | Bin 0 -> 6055 bytes Game/Code/Classes/UCovers.pas | 226 ++++ Game/Code/Classes/UDLLManager.dcu | Bin 0 -> 6021 bytes Game/Code/Classes/UDLLManager.pas | 216 +++ Game/Code/Classes/UDraw.dcu | Bin 0 -> 41304 bytes Game/Code/Classes/UDraw.pas | 1613 ++++++++++++++++++++++ Game/Code/Classes/UFiles.dcu | Bin 0 -> 4673 bytes Game/Code/Classes/UFiles.pas | 326 +++++ Game/Code/Classes/UGraphic.dcu | Bin 0 -> 18647 bytes Game/Code/Classes/UGraphic.pas | 405 ++++++ Game/Code/Classes/UGraphicClasses.dcu | Bin 0 -> 341 bytes Game/Code/Classes/UGraphicClasses.pas | 7 + Game/Code/Classes/UIni.dcu | Bin 0 -> 22355 bytes Game/Code/Classes/UIni.pas | 693 ++++++++++ Game/Code/Classes/UJoystick.dcu | Bin 0 -> 2268 bytes Game/Code/Classes/UJoystick.pas | 124 ++ Game/Code/Classes/ULCD.dcu | Bin 0 -> 5497 bytes Game/Code/Classes/ULCD.pas | 287 ++++ Game/Code/Classes/ULCD.~pas | 287 ++++ Game/Code/Classes/ULanguage.dcu | Bin 0 -> 6519 bytes Game/Code/Classes/ULanguage.pas | 222 ++++ Game/Code/Classes/ULight.dcu | Bin 0 -> 2389 bytes Game/Code/Classes/ULight.pas | 116 ++ Game/Code/Classes/ULog.dcu | Bin 0 -> 6217 bytes Game/Code/Classes/ULog.pas | 227 ++++ Game/Code/Classes/ULyrics.dcu | Bin 0 -> 9029 bytes Game/Code/Classes/ULyrics.pas | 383 ++++++ Game/Code/Classes/UMain.dcu | Bin 0 -> 11501 bytes Game/Code/Classes/UMain.pas | 673 ++++++++++ Game/Code/Classes/UMusic.dcu | Bin 0 -> 15179 bytes Game/Code/Classes/UMusic.pas | 783 +++++++++++ Game/Code/Classes/UParty.dcu | Bin 0 -> 4129 bytes Game/Code/Classes/UParty.pas | 204 +++ Game/Code/Classes/UPliki.dcu | Bin 0 -> 19679 bytes Game/Code/Classes/UPliki.pas | 830 ++++++++++++ Game/Code/Classes/URecord.dcu | Bin 0 -> 6913 bytes Game/Code/Classes/URecord.pas | 371 ++++++ Game/Code/Classes/UScores.dcu | Bin 0 -> 4811 bytes Game/Code/Classes/UScores.pas | 144 ++ Game/Code/Classes/USkins.dcu | Bin 0 -> 5747 bytes Game/Code/Classes/USkins.pas | 158 +++ Game/Code/Classes/USongs.dcu | Bin 0 -> 13980 bytes Game/Code/Classes/USongs.pas | 667 ++++++++++ Game/Code/Classes/UTexture.dcu | Bin 0 -> 19192 bytes Game/Code/Classes/UTexture.pas | 811 ++++++++++++ Game/Code/Classes/UThemes.dcu | Bin 0 -> 59165 bytes Game/Code/Classes/UThemes.pas | 1837 ++++++++++++++++++++++++++ Game/Code/Classes/UTime.dcu | Bin 0 -> 2083 bytes Game/Code/Classes/UTime.pas | 81 ++ Game/Code/Menu/UDisplay.dcu | Bin 0 -> 7030 bytes Game/Code/Menu/UDisplay.pas | 289 ++++ Game/Code/Menu/UDrawTexture.dcu | Bin 0 -> 3640 bytes Game/Code/Menu/UDrawTexture.pas | 101 ++ Game/Code/Menu/UMenu.dcu | Bin 0 -> 31672 bytes Game/Code/Menu/UMenu.pas | 1136 ++++++++++++++++ Game/Code/Menu/UMenuButton.dcu | Bin 0 -> 5472 bytes Game/Code/Menu/UMenuButton.pas | 238 ++++ Game/Code/Menu/UMenuInteract.dcu | Bin 0 -> 404 bytes Game/Code/Menu/UMenuInteract.pas | 14 + Game/Code/Menu/UMenuSelect.dcu | Bin 0 -> 3922 bytes Game/Code/Menu/UMenuSelect.pas | 198 +++ Game/Code/Menu/UMenuSelectSlide.dcu | Bin 0 -> 6108 bytes Game/Code/Menu/UMenuSelectSlide.pas | 335 +++++ Game/Code/Menu/UMenuStatic.dcu | Bin 0 -> 1594 bytes Game/Code/Menu/UMenuStatic.pas | 32 + Game/Code/Menu/UMenuText.dcu | Bin 0 -> 3155 bytes Game/Code/Menu/UMenuText.pas | 96 ++ Game/Code/SMpeg/USmpeg.alt.pas | 292 ++++ Game/Code/SMpeg/USmpeg.dcu | Bin 0 -> 6074 bytes Game/Code/SMpeg/USmpeg.pas | 299 +++++ Game/Code/Screens/UScreenEdit.dcu | Bin 0 -> 2915 bytes Game/Code/Screens/UScreenEdit.pas | 104 ++ Game/Code/Screens/UScreenEditConvert.dcu | Bin 0 -> 13604 bytes Game/Code/Screens/UScreenEditConvert.pas | 500 +++++++ Game/Code/Screens/UScreenEditHeader.dcu | Bin 0 -> 9398 bytes Game/Code/Screens/UScreenEditHeader.pas | 362 +++++ Game/Code/Screens/UScreenEditSub.dcu | Bin 0 -> 29283 bytes Game/Code/Screens/UScreenEditSub.pas | 1236 +++++++++++++++++ Game/Code/Screens/UScreenLevel.dcu | Bin 0 -> 3407 bytes Game/Code/Screens/UScreenLevel.pas | 101 ++ Game/Code/Screens/UScreenLoading.dcu | Bin 0 -> 2525 bytes Game/Code/Screens/UScreenLoading.pas | 48 + Game/Code/Screens/UScreenMain.dcu | Bin 0 -> 9661 bytes Game/Code/Screens/UScreenMain.pas | 384 ++++++ Game/Code/Screens/UScreenName.dcu | Bin 0 -> 4199 bytes Game/Code/Screens/UScreenName.pas | 114 ++ Game/Code/Screens/UScreenOpen.dcu | Bin 0 -> 4756 bytes Game/Code/Screens/UScreenOpen.pas | 151 +++ Game/Code/Screens/UScreenOptions.dcu | Bin 0 -> 4834 bytes Game/Code/Screens/UScreenOptions.pas | 221 ++++ Game/Code/Screens/UScreenOptionsGame.dcu | Bin 0 -> 4049 bytes Game/Code/Screens/UScreenOptionsGame.pas | 107 ++ Game/Code/Screens/UScreenOptionsGraphics.dcu | Bin 0 -> 3911 bytes Game/Code/Screens/UScreenOptionsGraphics.pas | 101 ++ Game/Code/Screens/UScreenOptionsLyrics.dcu | Bin 0 -> 3566 bytes Game/Code/Screens/UScreenOptionsLyrics.pas | 91 ++ Game/Code/Screens/UScreenOptionsRecord.dcu | Bin 0 -> 4885 bytes Game/Code/Screens/UScreenOptionsRecord.pas | 136 ++ Game/Code/Screens/UScreenOptionsSound.dcu | Bin 0 -> 3629 bytes Game/Code/Screens/UScreenOptionsSound.pas | 93 ++ Game/Code/Screens/UScreenOptionsThemes.dcu | Bin 0 -> 4188 bytes Game/Code/Screens/UScreenOptionsThemes.pas | 118 ++ Game/Code/Screens/UScreenPartyNewRound.dcu | Bin 0 -> 9085 bytes Game/Code/Screens/UScreenPartyNewRound.pas | 397 ++++++ Game/Code/Screens/UScreenPartyOptions.dcu | Bin 0 -> 5884 bytes Game/Code/Screens/UScreenPartyOptions.pas | 164 +++ Game/Code/Screens/UScreenPartyPlayer.dcu | Bin 0 -> 6068 bytes Game/Code/Screens/UScreenPartyPlayer.pas | 210 +++ Game/Code/Screens/UScreenPartyScore.dcu | Bin 0 -> 5605 bytes Game/Code/Screens/UScreenPartyScore.pas | 183 +++ Game/Code/Screens/UScreenPartyWin.dcu | Bin 0 -> 4642 bytes Game/Code/Screens/UScreenPartyWin.pas | 157 +++ Game/Code/Screens/UScreenScore.dcu | Bin 0 -> 10273 bytes Game/Code/Screens/UScreenScore.pas | 586 ++++++++ Game/Code/Screens/UScreenSing.dcu | Bin 0 -> 23327 bytes Game/Code/Screens/UScreenSing.pas | 1121 ++++++++++++++++ Game/Code/Screens/UScreenSingModi.dcu | Bin 0 -> 15109 bytes Game/Code/Screens/UScreenSingModi.pas | 1088 +++++++++++++++ Game/Code/Screens/UScreenSong.dcu | Bin 0 -> 29384 bytes Game/Code/Screens/UScreenSong.pas | 1690 +++++++++++++++++++++++ Game/Code/Screens/UScreenSongMenu.dcu | Bin 0 -> 7346 bytes Game/Code/Screens/UScreenSongMenu.pas | 355 +++++ Game/Code/Screens/UScreenTop5.dcu | Bin 0 -> 4531 bytes Game/Code/Screens/UScreenTop5.pas | 166 +++ Game/Code/Screens/UScreenWelcome.dcu | Bin 0 -> 3228 bytes Game/Code/Screens/UScreenWelcome.pas | 117 ++ Game/Code/UltraStar.RES | Bin 0 -> 1341060 bytes Game/Code/UltraStar.bdsproj | 168 +++ Game/Code/UltraStar.bdsproj.local | 2 + Game/Code/UltraStar.cfg | 41 + Game/Code/UltraStar.dof | 148 +++ Game/Code/UltraStar.dpr | 286 ++++ Game/Code/UltraStar.identcache2 | Bin 0 -> 3983 bytes Game/Code/UltraStar.rc | 15 + Game/Code/UltraStar.~dpr | 285 ++++ Game/Code/rccompillieren.bat | 1 + 140 files changed, 26256 insertions(+) create mode 100644 Game/Code/Classes/TextGL.dcu create mode 100644 Game/Code/Classes/TextGL.pas create mode 100644 Game/Code/Classes/UCatCovers.dcu create mode 100644 Game/Code/Classes/UCatCovers.pas create mode 100644 Game/Code/Classes/UCovers.dcu create mode 100644 Game/Code/Classes/UCovers.pas create mode 100644 Game/Code/Classes/UDLLManager.dcu create mode 100644 Game/Code/Classes/UDLLManager.pas create mode 100644 Game/Code/Classes/UDraw.dcu create mode 100644 Game/Code/Classes/UDraw.pas create mode 100644 Game/Code/Classes/UFiles.dcu create mode 100644 Game/Code/Classes/UFiles.pas create mode 100644 Game/Code/Classes/UGraphic.dcu create mode 100644 Game/Code/Classes/UGraphic.pas create mode 100644 Game/Code/Classes/UGraphicClasses.dcu create mode 100644 Game/Code/Classes/UGraphicClasses.pas create mode 100644 Game/Code/Classes/UIni.dcu create mode 100644 Game/Code/Classes/UIni.pas create mode 100644 Game/Code/Classes/UJoystick.dcu create mode 100644 Game/Code/Classes/UJoystick.pas create mode 100644 Game/Code/Classes/ULCD.dcu create mode 100644 Game/Code/Classes/ULCD.pas create mode 100644 Game/Code/Classes/ULCD.~pas create mode 100644 Game/Code/Classes/ULanguage.dcu create mode 100644 Game/Code/Classes/ULanguage.pas create mode 100644 Game/Code/Classes/ULight.dcu create mode 100644 Game/Code/Classes/ULight.pas create mode 100644 Game/Code/Classes/ULog.dcu create mode 100644 Game/Code/Classes/ULog.pas create mode 100644 Game/Code/Classes/ULyrics.dcu create mode 100644 Game/Code/Classes/ULyrics.pas create mode 100644 Game/Code/Classes/UMain.dcu create mode 100644 Game/Code/Classes/UMain.pas create mode 100644 Game/Code/Classes/UMusic.dcu create mode 100644 Game/Code/Classes/UMusic.pas create mode 100644 Game/Code/Classes/UParty.dcu create mode 100644 Game/Code/Classes/UParty.pas create mode 100644 Game/Code/Classes/UPliki.dcu create mode 100644 Game/Code/Classes/UPliki.pas create mode 100644 Game/Code/Classes/URecord.dcu create mode 100644 Game/Code/Classes/URecord.pas create mode 100644 Game/Code/Classes/UScores.dcu create mode 100644 Game/Code/Classes/UScores.pas create mode 100644 Game/Code/Classes/USkins.dcu create mode 100644 Game/Code/Classes/USkins.pas create mode 100644 Game/Code/Classes/USongs.dcu create mode 100644 Game/Code/Classes/USongs.pas create mode 100644 Game/Code/Classes/UTexture.dcu create mode 100644 Game/Code/Classes/UTexture.pas create mode 100644 Game/Code/Classes/UThemes.dcu create mode 100644 Game/Code/Classes/UThemes.pas create mode 100644 Game/Code/Classes/UTime.dcu create mode 100644 Game/Code/Classes/UTime.pas create mode 100644 Game/Code/Menu/UDisplay.dcu create mode 100644 Game/Code/Menu/UDisplay.pas create mode 100644 Game/Code/Menu/UDrawTexture.dcu create mode 100644 Game/Code/Menu/UDrawTexture.pas create mode 100644 Game/Code/Menu/UMenu.dcu create mode 100644 Game/Code/Menu/UMenu.pas create mode 100644 Game/Code/Menu/UMenuButton.dcu create mode 100644 Game/Code/Menu/UMenuButton.pas create mode 100644 Game/Code/Menu/UMenuInteract.dcu create mode 100644 Game/Code/Menu/UMenuInteract.pas create mode 100644 Game/Code/Menu/UMenuSelect.dcu create mode 100644 Game/Code/Menu/UMenuSelect.pas create mode 100644 Game/Code/Menu/UMenuSelectSlide.dcu create mode 100644 Game/Code/Menu/UMenuSelectSlide.pas create mode 100644 Game/Code/Menu/UMenuStatic.dcu create mode 100644 Game/Code/Menu/UMenuStatic.pas create mode 100644 Game/Code/Menu/UMenuText.dcu create mode 100644 Game/Code/Menu/UMenuText.pas create mode 100644 Game/Code/SMpeg/USmpeg.alt.pas create mode 100644 Game/Code/SMpeg/USmpeg.dcu create mode 100644 Game/Code/SMpeg/USmpeg.pas create mode 100644 Game/Code/Screens/UScreenEdit.dcu create mode 100644 Game/Code/Screens/UScreenEdit.pas create mode 100644 Game/Code/Screens/UScreenEditConvert.dcu create mode 100644 Game/Code/Screens/UScreenEditConvert.pas create mode 100644 Game/Code/Screens/UScreenEditHeader.dcu create mode 100644 Game/Code/Screens/UScreenEditHeader.pas create mode 100644 Game/Code/Screens/UScreenEditSub.dcu create mode 100644 Game/Code/Screens/UScreenEditSub.pas create mode 100644 Game/Code/Screens/UScreenLevel.dcu create mode 100644 Game/Code/Screens/UScreenLevel.pas create mode 100644 Game/Code/Screens/UScreenLoading.dcu create mode 100644 Game/Code/Screens/UScreenLoading.pas create mode 100644 Game/Code/Screens/UScreenMain.dcu create mode 100644 Game/Code/Screens/UScreenMain.pas create mode 100644 Game/Code/Screens/UScreenName.dcu create mode 100644 Game/Code/Screens/UScreenName.pas create mode 100644 Game/Code/Screens/UScreenOpen.dcu create mode 100644 Game/Code/Screens/UScreenOpen.pas create mode 100644 Game/Code/Screens/UScreenOptions.dcu create mode 100644 Game/Code/Screens/UScreenOptions.pas create mode 100644 Game/Code/Screens/UScreenOptionsGame.dcu create mode 100644 Game/Code/Screens/UScreenOptionsGame.pas create mode 100644 Game/Code/Screens/UScreenOptionsGraphics.dcu create mode 100644 Game/Code/Screens/UScreenOptionsGraphics.pas create mode 100644 Game/Code/Screens/UScreenOptionsLyrics.dcu create mode 100644 Game/Code/Screens/UScreenOptionsLyrics.pas create mode 100644 Game/Code/Screens/UScreenOptionsRecord.dcu create mode 100644 Game/Code/Screens/UScreenOptionsRecord.pas create mode 100644 Game/Code/Screens/UScreenOptionsSound.dcu create mode 100644 Game/Code/Screens/UScreenOptionsSound.pas create mode 100644 Game/Code/Screens/UScreenOptionsThemes.dcu create mode 100644 Game/Code/Screens/UScreenOptionsThemes.pas create mode 100644 Game/Code/Screens/UScreenPartyNewRound.dcu create mode 100644 Game/Code/Screens/UScreenPartyNewRound.pas create mode 100644 Game/Code/Screens/UScreenPartyOptions.dcu create mode 100644 Game/Code/Screens/UScreenPartyOptions.pas create mode 100644 Game/Code/Screens/UScreenPartyPlayer.dcu create mode 100644 Game/Code/Screens/UScreenPartyPlayer.pas create mode 100644 Game/Code/Screens/UScreenPartyScore.dcu create mode 100644 Game/Code/Screens/UScreenPartyScore.pas create mode 100644 Game/Code/Screens/UScreenPartyWin.dcu create mode 100644 Game/Code/Screens/UScreenPartyWin.pas create mode 100644 Game/Code/Screens/UScreenScore.dcu create mode 100644 Game/Code/Screens/UScreenScore.pas create mode 100644 Game/Code/Screens/UScreenSing.dcu create mode 100644 Game/Code/Screens/UScreenSing.pas create mode 100644 Game/Code/Screens/UScreenSingModi.dcu create mode 100644 Game/Code/Screens/UScreenSingModi.pas create mode 100644 Game/Code/Screens/UScreenSong.dcu create mode 100644 Game/Code/Screens/UScreenSong.pas create mode 100644 Game/Code/Screens/UScreenSongMenu.dcu create mode 100644 Game/Code/Screens/UScreenSongMenu.pas create mode 100644 Game/Code/Screens/UScreenTop5.dcu create mode 100644 Game/Code/Screens/UScreenTop5.pas create mode 100644 Game/Code/Screens/UScreenWelcome.dcu create mode 100644 Game/Code/Screens/UScreenWelcome.pas create mode 100644 Game/Code/UltraStar.RES create mode 100644 Game/Code/UltraStar.bdsproj create mode 100644 Game/Code/UltraStar.bdsproj.local create mode 100644 Game/Code/UltraStar.cfg create mode 100644 Game/Code/UltraStar.dof create mode 100644 Game/Code/UltraStar.dpr create mode 100644 Game/Code/UltraStar.identcache2 create mode 100644 Game/Code/UltraStar.rc create mode 100644 Game/Code/UltraStar.~dpr create mode 100644 Game/Code/rccompillieren.bat (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.dcu b/Game/Code/Classes/TextGL.dcu new file mode 100644 index 00000000..772d09c1 Binary files /dev/null and b/Game/Code/Classes/TextGL.dcu differ diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas new file mode 100644 index 00000000..cf09e48b --- /dev/null +++ b/Game/Code/Classes/TextGL.pas @@ -0,0 +1,345 @@ +unit TextGL; + +interface + +uses OpenGL12, SDL, UTexture, Classes, ULog; + +procedure BuildFont; // Build Our Bitmap Font +procedure KillFont; // Delete The Font +function glTextWidth(text: pchar): real; // Returns Text Width +procedure glPrintDone(text: pchar; Done: real; ColR, ColG, ColB: real); +procedure glPrintLetter(letter: char); +procedure glPrintLetterCut(letter: char; Start, Finish: real); +procedure glPrint(text: pchar); // Custom GL "Print" Routine +procedure glPrintCut(text: pchar); +procedure SetFontPos(X, Y: real); // Sets X And Y +procedure SetFontSize(Size: real); +procedure SetFontStyle(Style: integer); // sets active font style (normal, bold, etc) +procedure SetFontItalic(Enable: boolean); // sets italic type letter (works for all fonts) +procedure SetFontAspectW(Aspect: real); + +type + TTextGL = record + X: real; + Y: real; + Text: string; + Size: real; + ColR: real; + ColG: real; + ColB: real; + end; + + TFont = record + Tex: TTexture; + Width: array[0..255] of byte; + AspectW: real; + Centered: boolean; + Done: real; + Outline: real; + Italic: boolean; + end; + + +var + base: GLuint; // Base Display List For The Font Set + Fonts: array of TFont; + ActFont: integer; + PColR: real; // temps for glPrintDone + PColG: real; + PColB: real; + +implementation + +uses UMain, Windows, SysUtils, UGraphic; + +procedure BuildFont; // Build Our Bitmap Font +var + font: HFONT; // Windows Font ID + h_dc: hdc; + Rejestr: TResourceStream; + Pet: integer; +begin + ActFont := 0; + + SetLength(Fonts, 5); + Fonts[0].Tex := Texture.LoadTexture(true, 'Font', 'BMP', 'Font', 0); + Fonts[0].Tex.H := 30; + Fonts[0].AspectW := 0.9; + Fonts[0].Done := -1; + Fonts[0].Outline := 0; + + Fonts[1].Tex := Texture.LoadTexture(true, 'FontB', 'BMP', 'Font', 0); + Fonts[1].Tex.H := 30; + Fonts[1].AspectW := 1; + Fonts[1].Done := -1; + Fonts[1].Outline := 0; + + Fonts[2].Tex := Texture.LoadTexture(true, 'FontO', 'BMP', 'Font Outline', 0); + Fonts[2].Tex.H := 30; + Fonts[2].AspectW := 0.95; + Fonts[2].Done := -1; + Fonts[2].Outline := 5; + + Fonts[3].Tex := Texture.LoadTexture(true, 'FontO2', 'BMP', 'Font Outline 2', 0); + Fonts[3].Tex.H := 30; + Fonts[3].AspectW := 0.95; + Fonts[3].Done := -1; + Fonts[3].Outline := 4; + +{ Fonts[4].Tex := Texture.LoadTexture('FontO', 'BMP', 'Arrow', 0); // for score screen + Fonts[4].Tex.H := 30; + Fonts[4].AspectW := 0.95; + Fonts[4].Done := -1; + Fonts[4].Outline := 5;} + + + Rejestr := TResourceStream.Create(HInstance, 'Font', 'FNT'); + Rejestr.Read(Fonts[0].Width, 256); + Rejestr.Free; + + Rejestr := TResourceStream.Create(HInstance, 'FontB', 'FNT'); + Rejestr.Read(Fonts[1].Width, 256); + Rejestr.Free; + + Rejestr := TResourceStream.Create(HInstance, 'FontO', 'FNT'); + Rejestr.Read(Fonts[2].Width, 256); + Rejestr.Free; + + Rejestr := TResourceStream.Create(HInstance, 'FontO2', 'FNT'); + Rejestr.Read(Fonts[3].Width, 256); + Rejestr.Free; + +{ Rejestr := TResourceStream.Create(HInstance, 'FontO', 'FNT'); + Rejestr.Read(Fonts[4].Width, 256); + Rejestr.Free;} + + for Pet := 0 to 255 do + Fonts[1].Width[Pet] := Fonts[1].Width[Pet] div 2; + + for Pet := 0 to 255 do + Fonts[2].Width[Pet] := Fonts[2].Width[Pet] div 2 + 2; + + for Pet := 0 to 255 do + Fonts[3].Width[Pet] := Fonts[3].Width[Pet] + 1; + +{ for Pet := 0 to 255 do + Fonts[4].Width[Pet] := Fonts[4].Width[Pet] div 2 + 2;} + +end; + +procedure KillFont; // Delete The Font +begin +// glDeleteLists(base, 256); // Delete All 96 Characters +end; + +function glTextWidth(text: pchar): real; +var + Letter: char; +begin +// Log.LogStatus(Text, 'glTextWidth'); + Result := 0; + while (length(text) > 0) do begin + Letter := Text[0]; + text := pchar(Copy(text, 2, Length(text)-1)); + Result := Result + Fonts[ActFont].Width[Ord(Letter)] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + end; // while +end; + +procedure glPrintDone(text: pchar; Done: real; ColR, ColG, ColB: real); +begin + Fonts[ActFont].Done := Done; + PColR := ColR; + PColG := ColG; + PColB := ColB; + glPrintCut(text); + Fonts[ActFont].Done := -1; +end; + +procedure glPrintLetter(Letter: char); +var + TexX, TexY: real; + TexR, TexB: real; + FWidth: real; + PL, PT: real; + PR, PB: real; + XItal: real; // X shift for italic type letter +begin + with Fonts[ActFont].Tex do begin + FWidth := Fonts[ActFont].Width[Ord(Letter)]; + + W := FWidth * (H/30) * Fonts[ActFont].AspectW; +// H := 30; + + // set texture positions + TexX := (ord(Letter) mod 16) * 1/16 + 1/32 - FWidth/1024 - Fonts[ActFont].Outline/1024; + TexY := (ord(Letter) div 16) * 1/16 + 2/1024; // 2/1024 + TexR := (ord(Letter) mod 16) * 1/16 + 1/32 + FWidth/1024 + Fonts[ActFont].Outline/1024; + TexB := (1 + ord(Letter) div 16) * 1/16 - 2/1024; + + // set vector positions + PL := X - Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW /2; + PT := Y; + PR := PL + W + Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW; + PB := PT + H; + if Fonts[ActFont].Italic = false then + XItal := 0 + else + XItal := 12; + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, TexNum); + glBegin(GL_QUADS); + glTexCoord2f(TexX, TexY); glVertex2f(PL+XItal, PT); + glTexCoord2f(TexX, TexB); glVertex2f(PL, PB); + glTexCoord2f(TexR, TexB); glVertex2f(PR, PB); + glTexCoord2f(TexR, TexY); glVertex2f(PR+XItal, PT); + glEnd; + X := X + W; + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + end; // with +end; + +procedure glPrintLetterCut(letter: char; Start, Finish: real); +var + TexX, TexY: real; + TexR, TexB: real; + TexTemp: real; + FWidth: real; + PL, PT: real; + PR, PB: real; + OutTemp: real; + XItal: real; +begin + with Fonts[ActFont].Tex do begin + FWidth := Fonts[ActFont].Width[Ord(Letter)]; + + W := FWidth * (H/30) * Fonts[ActFont].AspectW; +// H := 30; + OutTemp := Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW; + + // set texture positions + TexX := (ord(Letter) mod 16) * 1/16 + 1/32 - FWidth/1024 - Fonts[ActFont].Outline/1024; + TexY := (ord(Letter) div 16) * 1/16 + 2/1024; // 2/1024 + TexR := (ord(Letter) mod 16) * 1/16 + 1/32 + FWidth/1024 + Fonts[ActFont].Outline/1024; + TexB := (1 + ord(Letter) div 16) * 1/16 - 2/1024; + + TexTemp := TexX + Start * (TexR - TexX); + TexR := TexX + Finish * (TexR - TexX); + TexX := TexTemp; + + // set vector positions + PL := X - OutTemp / 2 + OutTemp * Start; + PT := Y; + PR := PL + (W + OutTemp) * (Finish - Start); + PB := PT + H; + if Fonts[ActFont].Italic = false then + XItal := 0 + else + XItal := 12; + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, TexNum); + glBegin(GL_QUADS); + glTexCoord2f(TexX, TexY); glVertex2f(PL+XItal, PT); + glTexCoord2f(TexX, TexB); glVertex2f(PL, PB); + glTexCoord2f(TexR, TexB); glVertex2f(PR, PB); + glTexCoord2f(TexR, TexY); glVertex2f(PR+XItal, PT); // not tested with XItal + glEnd; + X := X + W * (Finish - Start); + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + end; // with + +end; + +procedure glPrint(text: pchar); // Custom GL "Print" Routine +var + Letter: char; +begin + if (Text = '') then // If There's No Text + Exit; // Do Nothing + + while (length(text) > 0) do begin + // cut + Letter := Text[0]; + Text := pchar(Copy(Text, 2, Length(Text)-1)); + + // print + glPrintLetter(Letter); + end; // while +end; + +procedure glPrintCut(text: pchar); +var + Letter: char; + PToDo: real; + PTotWidth: real; + PDoingNow: real; + S: string; +begin + if (Text = '') then // If There's No Text + Exit; // Do Nothing + + PTotWidth := glTextWidth(Text); + PToDo := Fonts[ActFont].Done; + + while (length(text) > 0) do begin + // cut + Letter := Text[0]; + Text := pchar(Copy(Text, 2, Length(Text)-1)); + + // analyze + S := Letter; + PDoingNow := glTextWidth(pchar(S)) / PTotWidth; + + // drawing + if (PToDo > 0) and (PDoingNow <= PToDo) then + glPrintLetter(Letter); + + if (PToDo > 0) and (PDoingNow > PToDo) then begin + glPrintLetterCut(Letter, 0, PToDo / PDoingNow); + glColor3f(PColR, PColG, PColB); + glPrintLetterCut(Letter, PToDo / PDoingNow, 1); + end; + + if (PToDo <= 0) then + glPrintLetter(Letter); + + PToDo := PToDo - PDoingNow; + + end; // while +end; + + +procedure SetFontPos(X, Y: real); +begin + Fonts[ActFont].Tex.X := X; + Fonts[ActFont].Tex.Y := Y; +end; + +procedure SetFontSize(Size: real); +begin + Fonts[ActFont].Tex.H := 30 * (Size/10); +end; + +procedure SetFontStyle(Style: integer); +begin + ActFont := Style; +end; + +procedure SetFontItalic(Enable: boolean); +begin + Fonts[ActFont].Italic := Enable; +end; + +procedure SetFontAspectW(Aspect: real); +begin + Fonts[ActFont].AspectW := Aspect; +end; + +end. diff --git a/Game/Code/Classes/UCatCovers.dcu b/Game/Code/Classes/UCatCovers.dcu new file mode 100644 index 00000000..2ff7a7d9 Binary files /dev/null and b/Game/Code/Classes/UCatCovers.dcu differ diff --git a/Game/Code/Classes/UCatCovers.pas b/Game/Code/Classes/UCatCovers.pas new file mode 100644 index 00000000..00a758c8 --- /dev/null +++ b/Game/Code/Classes/UCatCovers.pas @@ -0,0 +1,143 @@ +unit UCatCovers; +///////////////////////////////////////////////////////////////////////// +// UCatCovers by Whiteshark // +// Class for listing and managing the Category Covers // +///////////////////////////////////////////////////////////////////////// + +interface +uses UIni; + +type + TCatCovers = class + protected + cNames: array [low(ISorting)..high(ISorting)] of array of string; + cFiles: array [low(ISorting)..high(ISorting)] of array of string; + public + constructor Create; + procedure Load; //Load Cover aus Cover.ini and Cover Folder + procedure Add(Sorting: integer; Name, Filename: string); //Add a Cover + function CoverExists(Sorting: integer; Name: string): boolean; //Returns True when a cover with the given Name exists + function GetCover(Sorting: integer; Name: string): string; //Returns the Filename of a Cover + end; + +var +CatCovers: TCatCovers; + +implementation +uses IniFiles, SysUtils, Classes, UPliki, ULog; + +constructor TCatCovers.Create; +begin + Load; +end; + + //Load Cover aus Cover.ini and Cover Folder +procedure TCatCovers.Load; +var + Ini: TMemIniFile; + SR: TSearchRec; + List: TStringlist; + I, J: Integer; + Name, Filename, Temp: string; +begin +try + Ini := TMemIniFile.Create(CoversPath + 'covers.ini'); + List := TStringlist.Create; + + //Add every Cover in Covers Ini for Every Sorting option + for I := low(ISorting) to high(ISorting) do + begin + Ini.ReadSection(ISorting[I], List); + + for J := 0 to List.Count - 1 do + Add(I, List.Strings[J], CoversPath + Ini.ReadString(ISorting[I], List.Strings[J], 'NoCover.jpg')); + end; + +finally + Ini.Free; + List.Free; +end; + +try + //Add Covers from Folder + if (FindFirst (CoversPath + '*.jpg', faAnyFile, SR) = 0) then + repeat + //Add Cover if it doesn't exist for every Section + Name := SR.Name; + Filename := CoversPath + Name; + Delete (Name, length(Name) - 3, 4); + + for I := low(ISorting) to high(ISorting) do + begin + Temp := Name; + if ((I = sTitle) or (I = sTitle2)) and (Pos ('Title', Temp) <> 0) then + Delete (Temp, Pos ('Title', Temp), 5) + else if (I = sArtist) or (I = sArtist2) and (Pos ('Artist', Temp) <> 0) then + Delete (Temp, Pos ('Artist', Temp), 6); + + if not CoverExists(I, Temp) then + Add (I, Temp, Filename); + end; + until FindNext (SR) <> 0; + +finally + FindClose (SR); +end; + +end; + + //Add a Cover +procedure TCatCovers.Add(Sorting: integer; Name, Filename: string); +begin +if FileExists (Filename) then //If Exists -> Add +begin +SetLength (CNames[Sorting], Length(CNames[Sorting]) + 1); +SetLength (CFiles[Sorting], Length(CNames[Sorting]) + 1); + +CNames[Sorting][high(cNames[Sorting])] := Uppercase(Name); +CFiles[Sorting][high(cNames[Sorting])] := FileName; +end; +end; + + //Returns True when a cover with the given Name exists +function TCatCovers.CoverExists(Sorting: integer; Name: string): boolean; +var +I: Integer; +begin +Result := False; +Name := Uppercase(Name); //Case Insensitiv + +for I := low(cNames[Sorting]) to high(cNames[Sorting]) do +begin + if (cNames[Sorting][I] = Name) then //Found Name + begin + Result := true; + break; //Break For Loop + end; +end; +end; + + //Returns the Filename of a Cover +function TCatCovers.GetCover(Sorting: integer; Name: string): string; +var +I: Integer; +begin +Result := ''; +Name := Uppercase(Name); + +for I := low(cNames[Sorting]) to high(cNames[Sorting]) do +begin + if cNames[Sorting][I] = Name then + begin + Result := cFiles[Sorting][I]; + Break; + end; +end; + +//No Cover +if (Result = '') AND (FileExists(CoversPath + 'NoCover.jpg')) then + Result := CoversPath + 'NoCover.jpg'; + +end; + +end. diff --git a/Game/Code/Classes/UCovers.dcu b/Game/Code/Classes/UCovers.dcu new file mode 100644 index 00000000..ca99fc7c Binary files /dev/null and b/Game/Code/Classes/UCovers.dcu differ diff --git a/Game/Code/Classes/UCovers.pas b/Game/Code/Classes/UCovers.pas new file mode 100644 index 00000000..55329fd2 --- /dev/null +++ b/Game/Code/Classes/UCovers.pas @@ -0,0 +1,226 @@ +unit UCovers; + +interface +uses OpenGL12, Windows, Math, Classes, SysUtils, Graphics, UThemes, UTexture; + +type + TCover = record + Name: string; + W: word; + H: word; + Size: integer; + Position: integer; // position of picture in the cache file +// Data: array of byte; + end; + + TCovers = class + Cover: array of TCover; + W: word; + H: word; + Size: integer; + Data: array of byte; + WritetoFile: Boolean; + + constructor Create; + procedure Load; + procedure Save; + procedure AddCover(Name: string); + function CoverExists(Name: string): boolean; + function CoverNumber(Name: string): integer; + procedure PrepareData(Name: string); + end; + +var + Covers: TCovers; + +implementation +uses UPliki, ULog, DateUtils; + +constructor TCovers.Create; +begin + W := 128; + H := 128; + Size := W*H*3; + Load; + WritetoFile := True; +end; + +procedure TCovers.Load; +var + F: File; + C: integer; // cover number + W: word; + H: word; + Bits: byte; + NLen: word; + Name: string; +// Data: array of byte; +begin + if FileExists(GamePath + 'covers.cache') then begin + AssignFile(F, GamePath + 'covers.cache'); + Reset(F, 1); + + WritetoFile := not FileIsReadOnly(GamePath + 'covers.cache'); + + SetLength(Cover, 0); + + while not EOF(F) do begin + SetLength(Cover, Length(Cover)+1); + + BlockRead(F, W, 2); + Cover[High(Cover)].W := W; + + BlockRead(F, H, 2); + Cover[High(Cover)].H := H; + + BlockRead(F, Bits, 1); + + Cover[High(Cover)].Size := W * H * (Bits div 8); + + // test +// W := 128; +// H := 128; +// Bits := 24; +// Seek(F, FilePos(F) + 3); + + BlockRead(F, NLen, 2); + SetLength(Name, NLen); + + BlockRead(F, Name[1], NLen); + Cover[High(Cover)].Name := Name; + + Cover[High(Cover)].Position := FilePos(F); + Seek(F, FilePos(F) + W*H*(Bits div 8)); + +// SetLength(Cover[High(Cover)].Data, W*H*(Bits div 8)); +// BlockRead(F, Cover[High(Cover)].Data[0], W*H*(Bits div 8)); + + end; + + CloseFile(F); + end; // fileexists +end; + +procedure TCovers.Save; +var + F: File; + C: integer; // cover number + W: word; + H: word; + NLen: word; + Bits: byte; +begin +{ AssignFile(F, GamePath + 'covers.cache'); + Rewrite(F, 1); + + Bits := 24; + for C := 0 to High(Cover) do begin + W := Cover[C].W; + H := Cover[C].H; + + BlockWrite(F, W, 2); + BlockWrite(F, H, 2); + BlockWrite(F, Bits, 1); + + NLen := Length(Cover[C].Name); + BlockWrite(F, NLen, 2); + BlockWrite(F, Cover[C].Name[1], NLen); + BlockWrite(F, Cover[C].Data[0], W*H*(Bits div 8)); + end; + + CloseFile(F);} +end; + +procedure TCovers.AddCover(Name: string); +var + B: integer; + F: File; + C: integer; // cover number + NLen: word; + Bits: byte; +begin + if not CoverExists(Name) then begin + SetLength(Cover, Length(Cover)+1); + Cover[High(Cover)].Name := Name; + + Cover[High(Cover)].W := W; + Cover[High(Cover)].H := H; + Cover[High(Cover)].Size := Size; + + // do not copy data. write them directly to file +// SetLength(Cover[High(Cover)].Data, Size); +// for B := 0 to Size-1 do +// Cover[High(Cover)].Data[B] := CacheMipmap[B]; + + if WritetoFile then + begin + AssignFile(F, GamePath + 'covers.cache'); + if FileExists(GamePath + 'covers.cache') then begin + Reset(F, 1); + Seek(F, FileSize(F)); + end else + Rewrite(F, 1); + + Bits := 24; + + BlockWrite(F, W, 2); + BlockWrite(F, H, 2); + BlockWrite(F, Bits, 1); + + NLen := Length(Name); + BlockWrite(F, NLen, 2); + BlockWrite(F, Name[1], NLen); + + Cover[High(Cover)].Position := FilePos(F); + BlockWrite(F, CacheMipmap[0], W*H*(Bits div 8)); + + CloseFile(F); + end; + end + else + Cover[High(Cover)].Position := 0; +end; + +function TCovers.CoverExists(Name: string): boolean; +var + C: integer; // cover +begin + Result := false; + C := 0; + while (C <= High(Cover)) and (Result = false) do begin + if Cover[C].Name = Name then Result := true; + Inc(C); + end; +end; + +function TCovers.CoverNumber(Name: string): integer; +var + C: integer; +begin + Result := -1; + C := 0; + while (C <= High(Cover)) and (Result = -1) do begin + if Cover[C].Name = Name then Result := C; + Inc(C); + end; +end; + +procedure TCovers.PrepareData(Name: string); +var + F: File; + C: integer; +begin + if FileExists(GamePath + 'covers.cache') then begin + AssignFile(F, GamePath + 'covers.cache'); + Reset(F, 1); + + C := CoverNumber(Name); + SetLength(Data, Cover[C].Size); + if Length(Data) < 6 then beep; + Seek(F, Cover[C].Position); + BlockRead(F, Data[0], Cover[C].Size); + CloseFile(F); + end; +end; + +end. diff --git a/Game/Code/Classes/UDLLManager.dcu b/Game/Code/Classes/UDLLManager.dcu new file mode 100644 index 00000000..3ba97949 Binary files /dev/null and b/Game/Code/Classes/UDLLManager.dcu differ diff --git a/Game/Code/Classes/UDLLManager.pas b/Game/Code/Classes/UDLLManager.pas new file mode 100644 index 00000000..151f0617 --- /dev/null +++ b/Game/Code/Classes/UDLLManager.pas @@ -0,0 +1,216 @@ +unit UDLLManager; + +interface +uses ModiSDK, UPliki; + +type + TDLLMan = class + private + hLib: THandle; + P_Init: fModi_Init; + P_Draw: fModi_Draw; + P_Finish: fModi_Finish; + P_RData: pModi_RData; + public + Plugins: array of TPluginInfo; + PluginPaths: array of String; + Selected: ^TPluginInfo; + + constructor Create; + + procedure GetPluginList; + procedure ClearPluginInfo(No: Cardinal); + function LoadPluginInfo(Filename: String; No: Cardinal): boolean; + + function LoadPlugin(No: Cardinal): boolean; + procedure UnLoadPlugin; + + function PluginInit (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: fModi_PlaySound): boolean; + function PluginDraw (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; + function PluginFinish (var Playerinfo: TPlayerinfo): byte; + procedure PluginRData (handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD); + end; + +var + DLLMan: TDLLMan; + +const DLLPath = 'Plugins\'; + +implementation +uses Windows, ULog, SysUtils; + + +constructor TDLLMan.Create; +begin + SetLength(Plugins, 0); + SetLength(PluginPaths, Length(Plugins)); + GetPluginList; +end; + +procedure TDLLMan.GetPluginList; +var + SR: TSearchRec; +begin + + if FindFirst(DLLPath + '*.dll', faAnyFile , SR) = 0 then + begin + repeat + SetLength(Plugins, Length(Plugins)+1); + SetLength(PluginPaths, Length(Plugins)); + + if LoadPluginInfo(SR.Name, High(Plugins)) then //Loaded succesful + begin + PluginPaths[High(PluginPaths)] := SR.Name; + end + else //Error Loading + begin + SetLength(Plugins, Length(Plugins)-1); + SetLength(PluginPaths, Length(Plugins)); + end; + + until FindNext(SR) <> 0; + FindClose(SR); + end; +end; + +procedure TDLLMan.ClearPluginInfo(No: Cardinal); +begin + Plugins[No].Name := 'unknown'; + Plugins[No].NumPlayers := 0; + + Plugins[No].Creator := 'Nobody'; + Plugins[No].PluginDesc := 'NO_PLUGIN_DESC'; + + Plugins[No].LoadSong := True; + Plugins[No].ShowScore := True; + Plugins[No].ShowBars := False; + Plugins[No].ShowNotes := True; + Plugins[No].LoadVideo := True; + Plugins[No].LoadBack := True; + + Plugins[No].TeamModeOnly := False; + Plugins[No].GetSoundData := False; + Plugins[No].Dummy := False; + + + Plugins[No].BGShowFull := False; + Plugins[No].BGShowFull_O := True; + + Plugins[No].ShowRateBar:= False; + Plugins[No].ShowRateBar_O := True; + + Plugins[No].EnLineBonus := False; + Plugins[No].EnLineBonus_O := True; +end; + +function TDLLMan.LoadPluginInfo(Filename: String; No: Cardinal): boolean; +var + hLibg: THandle; + Info: pModi_PluginInfo; + I: Integer; +begin + Result := False; + //Clear Plugin Info + ClearPluginInfo(No); + + {//Workaround Plugins Loaded 2 Times + For I := low(PluginPaths) to high(PluginPaths) do + if (PluginPaths[I] = Filename) then + exit; } + + //Load Libary + hLibg := LoadLibrary(PChar(DLLPath + Filename)); + //If Loaded + if (hLibg <> 0) then + begin + //Load Info Procedure + @Info := GetProcAddress (hLibg, PChar('PluginInfo')); + + //If Loaded + if (@Info <> nil) then + begin + //Load PluginInfo + Info (Plugins[No]); + Result := True; + end + else + Log.LogError('Could not Load Plugin "' + Filename + '": Info Procedure not Found'); + + FreeLibrary (hLibg); + end + else + Log.LogError('Could not Load Plugin "' + Filename + '": Libary not Loaded'); +end; + +function TDLLMan.LoadPlugin(No: Cardinal): boolean; +begin + Result := False; + //Load Libary + hLib := LoadLibrary(PChar(DLLPath + PluginPaths[No])); + //If Loaded + if (hLib <> 0) then + begin + //Load Info Procedure + @P_Init := GetProcAddress (hLib, PChar('Init')); + @P_Draw := GetProcAddress (hLib, PChar('Draw')); + @P_Finish := GetProcAddress (hLib, PChar('Finish')); + + //If Loaded + if (@P_Init <> nil) And (@P_Draw <> nil) And (@P_Finish <> nil) then + begin + Selected := @Plugins[No]; + Result := True; + end + else + begin + Log.LogError('Could not Load Plugin "' + PluginPaths[No] + '": Procedures not Found'); + + end; + end + else + Log.LogError('Could not Load Plugin "' + PluginPaths[No] + '": Libary not Loaded'); +end; + +procedure TDLLMan.UnLoadPlugin; +begin +if (hLib <> 0) then + FreeLibrary (hLib); + +//Selected := nil; +@P_Init := nil; +@P_Draw := nil; +@P_Finish := nil; +@P_RData := nil; +end; + +function TDLLMan.PluginInit (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: fModi_PlaySound): boolean; +begin +if (@P_Init <> nil) then + Result := P_Init (TeamInfo, PlayerInfo, Sentences, LoadTex, Print, LoadSound, PlaySound) +else + Result := False +end; + +function TDLLMan.PluginDraw (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; +begin +if (@P_Draw <> nil) then + Result := P_Draw (PlayerInfo, CurSentence) +else + Result := False +end; + +function TDLLMan.PluginFinish (var Playerinfo: TPlayerinfo): byte; +begin +if (@P_Finish <> nil) then + Result := P_Finish (PlayerInfo) +else + Result := 0; +end; + +procedure TDLLMan.PluginRData (handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD); +begin +if (@P_RData <> nil) then + P_RData (handle, buffer, len, user); +end; + +end. diff --git a/Game/Code/Classes/UDraw.dcu b/Game/Code/Classes/UDraw.dcu new file mode 100644 index 00000000..a3fcecc9 Binary files /dev/null and b/Game/Code/Classes/UDraw.dcu differ diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas new file mode 100644 index 00000000..e9433790 --- /dev/null +++ b/Game/Code/Classes/UDraw.pas @@ -0,0 +1,1613 @@ +unit UDraw; + +interface +uses UThemes, ModiSDK; + +procedure SingDraw; +procedure SingModiDraw (PlayerInfo: TPlayerInfo); +procedure SingDrawBackground; +procedure SingDrawOscilloscope(X, Y, W, H: real; NrSound: integer); +procedure SingDrawNoteLines(Left, Top, Right: real; Space: integer); +procedure SingDrawBeatDelimeters(Left, Top, Right: real; NrCzesci: integer); +procedure SingDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); +procedure SingDrawPlayerCzesc(X, Y, W: real; NrGracza: integer; Space: integer); +procedure SingDrawPlayerBGCzesc(Left, Top, Right: real; NrCzesci, NrGracza: integer; Space: integer); +procedure SingDrawStar(X, Y, A: real); +procedure SingGoldenStar(X, Y, A: real); + +// The Singbar +procedure SingDrawSingbar(X, Y, W, H: real; Percent: integer); + +//Phrasen Bonus - Line Bonus +procedure SingDrawLineBonus( const X, Y: integer; Color: TRGB; Alpha: Single; Text: string); + +//Draw Editor NoteLines +procedure EditDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); + + +type + TRecR = record + Top: real; + Left: real; + Right: real; + Bottom: real; + + Width: real; + WMid: real; + Height: real; + HMid: real; + + Mid: real; + end; + +var + NotesW: real; + NotesH: real; + Starfr: integer; + StarfrG: integer; + + + + //SingBar Mod + TickOld: cardinal; + TickOld2:cardinal; + //end Singbar Mod + + + + +const + Przedz = 32; + +implementation + +uses Windows, OpenGL12, UGraphic, SysUtils, UMusic, URecord, ULog, UScreenSing, UScreenSingModi, ULyrics, UMain, TextGL, UTexture, UDrawTexture, UIni, Math, UDLLManager; + +procedure SingDrawBackground; +var + Rec: TRecR; + TexRec: TRecR; +begin + if ScreenSing.Tex_Background.TexNum >= 1 then begin + + glClearColor (1, 1, 1, 1); + + if (Ini.MovieSize = 0) 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) * ScreenSing.Tex_Background.TexH; + TexRec.Bottom := (Rec.Bottom / 600) * ScreenSing.Tex_Background.TexH; + TexRec.Left := 0; + TexRec.Right := ScreenSing.Tex_Background.TexW; + + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, ScreenSing.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) * ScreenSing.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) * ScreenSing.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, ScreenSing.Tex_Background.TexNum); + //glEnable(GL_BLEND); + glBegin(GL_QUADS); + + glTexCoord2f(0, 0); glVertex2f(0, 0); + glTexCoord2f(0, ScreenSing.Tex_Background.TexH); glVertex2f(0, 600); + glTexCoord2f( ScreenSing.Tex_Background.TexW, ScreenSing.Tex_Background.TexH); glVertex2f(800, 600); + glTexCoord2f( ScreenSing.Tex_Background.TexW, 0); glVertex2f(800, 0); + + glEnd; + glDisable(GL_TEXTURE_2D); + //glDisable(GL_BLEND); + end; + end; +end; + +procedure SingDrawOscilloscope(X, Y, W, H: real; NrSound: integer); +var + Pet: integer; +begin; +// Log.LogStatus('Oscilloscope', 'SingDraw'); + glColor3f(Skin_OscR, Skin_OscG, Skin_OscB); + if (ParamStr(1) = '-black') or (ParamStr(1) = '-fsblack') then + glColor3f(1, 1, 1); + + glBegin(GL_LINE_STRIP); + glVertex2f(X, -Sound[NrSound].BufferArray[1] / $10000 * H + Y + H/2); + for Pet := 2 to Sound[NrSound].n div 1 do begin + glVertex2f(X + (Pet-1) * W / (Sound[NrSound].n - 1), + -Sound[NrSound].BufferArray[Pet] / $10000 * H + Y + H/2); + end; + glEnd; +end; + +procedure SingDrawNoteLines(Left, Top, Right: real; Space: integer); +var + Pet: integer; +begin + glEnable(GL_BLEND); + glColor4f(Skin_P1_LinesR, Skin_P1_LinesG, Skin_P1_LinesB, 0.4); + glBegin(GL_LINES); + for Pet := 0 to 9 do begin + glVertex2f(Left, Top + Pet * Space); + glVertex2f(Right, Top + Pet * Space); + end; + glEnd; + glDisable(GL_BLEND); +end; + +procedure SingDrawBeatDelimeters(Left, Top, Right: real; NrCzesci: integer); +var + Pet: integer; + TempR: real; +begin + TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); + glEnable(GL_BLEND); + glBegin(GL_LINES); + for Pet := Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote to Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec do begin + if (Pet mod Czesci[NrCzesci].Resolution) = Czesci[NrCzesci].NotesGAP then + glColor4f(0, 0, 0, 1) + else + glColor4f(0, 0, 0, 0.3); + glVertex2f(Left + TempR * (Pet - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote), Top); + glVertex2f(Left + TempR * (Pet - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote), Top + 135); + end; + glEnd; + glDisable(GL_BLEND); +end; + +// draw blank Notebars +procedure SingDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); +var + Rec: TRecR; + Pet: integer; + TempR: real; + R,G,B: real; +begin + glColor3f(1, 1, 1); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); + with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin + for Pet := 0 to HighNut do begin + with Nuta[Pet] do begin + if not FreeStyle then begin + + // Golden Note Patch + case Wartosc of + 1: glColor4f(1, 1, 1, 0.85); + 2: glColor4f(1, 1, 0.3, 0.85); + end; // case + + + + // lewa czesc - left part + Rec.Left := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX; + Rec.Right := Rec.Left + NotesW; + Rec.Top := Top - (Ton-BaseNote)*Space/2 - NotesH; + Rec.Bottom := Rec.Top + 2 * NotesH; + glBindTexture(GL_TEXTURE_2D, Tex_Left[Color].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(7/8, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(7/8, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // srodkowa czesc - middle part + Rec.Left := Rec.Right; + Rec.Right := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - NotesW - 0.5 + 10*ScreenX; + + glBindTexture(GL_TEXTURE_2D, Tex_Mid[Color].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(1/32, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(1/32, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(31/32, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(31/32, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // prawa czesc - right part + Rec.Left := Rec.Right; + Rec.Right := Rec.Right + NotesW; + + glBindTexture(GL_TEXTURE_2D, Tex_Right[Color].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(1/8, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(1/8, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + + // Golden Star Patch + //case Wartosc of + // 2: SingGoldenStar(Rec.Left, Rec.Top, 1, StarfrG); + //end; // case + + + end; // if not FreeStyle + end; // with + end; // for + end; // with + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); +end; + + +// draw sung notes +procedure SingDrawPlayerCzesc(X, Y, W: real; NrGracza: integer; Space: integer); +var + TempR: real; + Rec: TRecR; + N: integer; + R: real; + G: real; + B: real; + A: real; + NotesH2: real; + begin +// Log.LogStatus('Player notes', 'SingDraw'); + +// if NrGracza = 0 then LoadColor(R, G, B, 'P1Light') +// else LoadColor(R, G, B, 'P2Light'); + +// R := 71/255; +// G := 175/255; +// B := 247/255; + + + glColor3f(1, 1, 1); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + if Player[NrGracza].IlNut > 0 then begin + TempR := W / (Czesci[0].Czesc[Czesci[0].Akt].Koniec - Czesci[0].Czesc[Czesci[0].Akt].StartNote); + for N := 0 to Player[NrGracza].HighNut do begin + with Player[NrGracza].Nuta[N] do begin + // lewa czesc + Rec.Left := X + (Start-Czesci[0].Czesc[Czesci[0].Akt].StartNote) * TempR + 0.5 + 10*ScreenX; + Rec.Right := Rec.Left + NotesW; + + + // Half size Notes Patch + if Hit then begin + NotesH2 := NotesH + end else begin + NotesH2 := int(NotesH * 0.65); + end; //if + + + + // if True then + Rec.Top := Y - (Ton-Czesci[0].Czesc[Czesci[0].Akt].BaseNote)*Space/2 - NotesH2; + Rec.Bottom := Rec.Top + 2 *NotesH2; + + glColor3f(1, 1, 1); + glBindTexture(GL_TEXTURE_2D, Tex_Left[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(1/8, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(1/8, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(7/8, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(7/8, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // srodkowa czesc + Rec.Left := Rec.Right; + Rec.Right := X + (Start+Dlugosc-Czesci[0].Czesc[Czesci[0].Akt].StartNote) * TempR - NotesW - 0.5 + 10*ScreenX; + // (nowe) + if (Start+Dlugosc-1 = Czas.AktBeatD) then + Rec.Right := Rec.Right - (1-Frac(Czas.MidBeatD)) * TempR; + + if Rec.Right <= Rec.Left then Rec.Right := Rec.Left; + + +// glColor3f(R, G, B); +// glBindTexture(GL_TEXTURE_2D, Tex_MidGray.TexNum); + glBindTexture(GL_TEXTURE_2D, Tex_Mid[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(1/8, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(1/8, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(7/8, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(7/8, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + glColor3f(1, 1, 1); + + // prawa czesc + Rec.Left := Rec.Right; + Rec.Right := Rec.Right + NotesW; + + glBindTexture(GL_TEXTURE_2D, Tex_Right[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(1/8, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(1/8, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + + + //Rec.Right := X + (Start+Dlugosc-Czesci[0].Czesc[Czesci[0].Akt].StartNote) * TempR - NotesW - 0.5 + 10*ScreenX; + //if (Start+Dlugosc-1 = Czas.AktBeatD) then + if Perfect AND (Ini.GMAFix <> 1) then begin +// A := sqrt((1+sin(Music.Position * 3))/2); + A := 1 - 2*(Czas.Teraz - GetTimeFromBeat(Start+Dlugosc)); + if not (Start+Dlugosc-1 = Czas.AktBeatD) then + + //Star animation counter + //inc(Starfr); + //Starfr := Starfr mod 128; + + + SingDrawStar(Rec.Left+2, Rec.Top+4, A); + end; + + // detekt +{ Rec.Left := Round((Detekt-Czesci.Czesc[Czesci.Akt].Start) * TempR) + 130; + glColor3f(1, 0.2, 0.2); + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + glBegin(GL_QUADS); + glVertex(Rec.Left, Rec.Top-5); + glVertex(Rec.Left, Rec.Bottom+5); + glVertex(Rec.Left+1, Rec.Bottom+5); + glVertex(Rec.Left+1, Rec.Top-5); + glEnd; + glColor3f(1, 1, 1); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D);} + + // detekt + FFT length +{ Rec.Right := (Detekt-Czesci.Czesc[Czesci.Akt].Start) * TempR + 130; + // TempR = dlugosc 1 kostki + // 60 * 4 / BPM = czas w sekundach na 1 kostke, np. 0,4s + // 4096 / 44100 = czas jednego sampla FFT, np. 0,1s + // ile to ma kostek? np. 0.25 + // (4096 / 44100) / (60 * 4 / BPM), np. 0,1s / 0,4s = 0.25 + // * TempR = dlugosc sampla FFT + Rec.Left := Rec.Right - (Sound.n / 44100) / (60 * 4 / Muzyka.BPM) * TempR; + + glColor3f(1, 0.2, 0.2); + glVertex(Rec.Left, Rec.Top-4); + glVertex(Rec.Left, Rec.Bottom+4); + glVertex(Rec.Right, Rec.Bottom+4); + glVertex(Rec.Right, Rec.Top-4);} + + end; // with + end; // for + end; // if +end; + +//draw Note glow +procedure SingDrawPlayerBGCzesc(Left, Top, Right: real; NrCzesci, NrGracza: integer; Space: integer); +var + Rec: TRecR; + Pet: integer; + TempR: real; + R,G,B: real; + X1, X2, X3, X4: real; + W, H: real; +begin + if (Player[NrGracza].ScoreTotalI >= 0) then begin + glColor4f(1, 1, 1, sqrt((1+sin(Music.Position * 3))/4)/ 2 + 0.5 ); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); + with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin + for Pet := 0 to HighNut do begin + with Nuta[Pet] do begin + if not FreeStyle then begin + // begin: 14, 20 + // easy: 6, 11 + W := NotesW * 2 + 2; + H := NotesH * 1.5 + 3.5; + + X2 := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX + 4; // wciecie + X1 := X2-W; + + X3 := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - 0.5 + 10*ScreenX - 4; // wciecie + X4 := X3+W; + + // left + Rec.Left := X1; + Rec.Right := X2; + Rec.Top := Top - (Ton-BaseNote)*Space/2 - H; + Rec.Bottom := Rec.Top + 2 * H; + + glBindTexture(GL_TEXTURE_2D, Tex_BG_Left[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(7/8, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(7/8, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + + // srodkowa czesc + Rec.Left := X2; + Rec.Right := X3; + + glBindTexture(GL_TEXTURE_2D, Tex_BG_Mid[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(1/32, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(1/32, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(31/32, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(31/32, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // prawa czesc + Rec.Left := X3; + Rec.Right := X4; + + glBindTexture(GL_TEXTURE_2D, Tex_BG_Right[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(1/8, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(1/8, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + end; // if not FreeStyle + end; // with + end; // for + end; // with + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + end; +end; + +procedure SingDrawStar(X, Y, A: real); +var + TempR: real; + W, H: real; + Starframe: real; + begin + W := 32; + H := 32; + + // Golden Star Patch +// case Z of +// 1: glColor4f(1, 1, 1, A); +// 2: glColor4f(1, 1, 0.3, A); +// end; // case + + glColor4f(1, 1, 1, A); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_Note_Star.TexNum); + + Starframe := 15 - ((GetTickCount div 33) mod 16); + + glBegin(GL_QUADS); + glTexCoord2f((1/16) * Starframe, 0); glVertex2f(X-W, Y-H); + glTexCoord2f((1/16) * Starframe + (1/16), 0); glVertex2f(X-W, Y+H); + glTexCoord2f((1/16) * Starframe + (1/16), 1); glVertex2f(X+W, Y+H); + glTexCoord2f((1/16) * Starframe, 1); glVertex2f(X+W, Y-H); + glEnd; +end; + + +procedure SingGoldenStar(X, Y, A: real); +var + TempR: real; + W, H: real; + StarfrG2: real; + begin + W := 16; + H := 16; + glColor4f(1, 1, 0.3, A); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_Note_Star.TexNum); + StarfrG2 := 15 - ((GetTickCount div 67) mod 16); + glBegin(GL_QUADS); + //x1 + glTexCoord2f((1/16) * StarfrG2, 0); glVertex2f(X-W, Y-H); + glTexCoord2f((1/16) * StarfrG2 + (1/16), 0); glVertex2f(X-W, Y+H); + glTexCoord2f((1/16) * StarfrG2 + (1/16), 1); glVertex2f(X+W, Y+H); + glTexCoord2f((1/16) * StarfrG2, 1); glVertex2f(X+W, Y-H); + glEnd; +end; + + +procedure SingDraw; +var + Pet: integer; + Pet2: integer; + TempR: real; + Rec: TRecR; + TexRec: TRecR; + NR: TRecR; + FS: real; + BarFrom: integer; + BarAlpha: real; + BarWspol: real; + TempCol: real; + Tekst: string; + LyricTemp: string; + PetCz: integer; + + + + //SingBar Mod + A: Integer; + E: Integer; + I: Integer; + //end Singbar Mod + + + +begin + // positions + if Ini.SingWindow = 0 then begin + NR.Left := 120; + end else begin + NR.Left := 20; + end; + NR.Right := 780; + + NR.Width := NR.Right - NR.Left; + NR.WMid := NR.Width / 2; + NR.Mid := NR.Left + NR.WMid; + + // background //BG Fullsize Mod + //SingDrawBackground; + + // time bar +// Log.LogStatus('Time Bar', 'SingDraw'); + glBegin(GL_QUADS); + glColor3f(0.9, 0.9, 0.9); + glVertex2f(140 + 10*ScreenX, 21); + glVertex2f(140 + 10*ScreenX, 29); + glVertex2f(330 + 10*ScreenX, 29); + glVertex2f(330 + 10*ScreenX, 21); + glColor3f(Skin_TimeR, Skin_TimeG, Skin_TimeB); + glVertex2f(140 + 10*ScreenX, 21); + glVertex2f(140 + 10*ScreenX, 29); + glVertex2f(140 + 10*ScreenX+(330-140)*(Czas.Teraz/Czas.Razem), 29); + glVertex2f(140 + 10*ScreenX+(330-140)*(Czas.Teraz/Czas.Razem), 21); + glEnd; + + // rysuje paski pod nutami + if PlayersPlay = 1 then + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); + if (PlayersPlay = 2) or (PlayersPlay = 4) then begin + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P1_NotesB - 105, Nr.Right + 10*ScreenX, 15); + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); + end; + + if (PlayersPlay = 3) or (PlayersPlay = 6) then begin + SingDrawNoteLines(Nr.Left + 10*ScreenX, 120, Nr.Right + 10*ScreenX, 12); + SingDrawNoteLines(Nr.Left + 10*ScreenX, 245, Nr.Right + 10*ScreenX, 12); + SingDrawNoteLines(Nr.Left + 10*ScreenX, 370, Nr.Right + 10*ScreenX, 12); + end; + + // rysuje tekst - new Lyric engine + ScreenSing.LyricMain.Draw; + ScreenSing.LyricSub.Draw; + + // rysuje pasek, podpowiadajacy poczatek spiwania w scenie + FS := 1.3; + BarFrom := Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start; + if BarFrom > 40 then BarFrom := 40; + if (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start > 8) and // dluga przerwa //16->12 for more help bars and then 12->8 for even more + (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat > 0) and // przed tekstem + (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat < 40) then begin // ale nie za wczesnie + BarWspol := (Czas.MidBeat - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - BarFrom)) / BarFrom; + Rec.Left := NR.Left + BarWspol * +// (NR.WMid - Czesci[0].Czesc[Czesci[0].Akt].LyricWidth / 2 * FS - 50); + (ScreenSing.LyricMain.ClientX - NR.Left - 50) + 10*ScreenX; + Rec.Right := Rec.Left + 50; + Rec.Top := Skin_LyricsT + 3; + Rec.Bottom := Rec.Top + 33;//SingScreen.LyricMain.Size * 3; + + // zapalanie + BarAlpha := (BarWspol*10) * 0.5; + if BarAlpha > 0.5 then BarAlpha := 0.5; + + // gaszenie + if BarWspol > 0.95 then BarAlpha := 0.5 * (1 - (BarWspol - 0.95) * 20); + //Change fuer Crazy Joker + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glColor4f(26/255, 165/255, 220/255, 0); + glVertex2f(Rec.Left, Rec.Top); + glVertex2f(Rec.Left, Rec.Bottom); + glColor4f(26/255, 165/255, 220/255, BarAlpha); + glVertex2f(Rec.Right, Rec.Bottom); + glVertex2f(Rec.Right, Rec.Top); + glEnd; + glDisable(GL_BLEND); + end; + + // oscilloscope + if Ini.Oscilloscope = 1 then begin + if PlayersPlay = 1 then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + + if PlayersPlay = 2 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + if ScreenAct = 2 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 2); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 3); + end; + end; + + if PlayersPlay = 3 then begin + SingDrawOscilloscope(75 + 10*ScreenX, 95, 100, 20, 0); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 0); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + if ScreenAct = 2 then begin + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 3); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 4); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 5); + end; + end; + + end + + //SingBar Mod + else if Ini.Oscilloscope = 2 then begin + A := GetTickCount div 33; + if A <> Tickold then begin + Tickold := A; + for E := 0 to (PlayersPlay - 1) do begin //Set new Pos + Alpha + I := Player[E].ScorePercentTarget - Player[E].ScorePercent; + if I > 0 then Inc(Player[E].ScorePercent) + else if I < 0 then Dec(Player[E].ScorePercent); + end; //for + end; //if + if PlayersPlay = 1 then begin + SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + end; + if PlayersPlay = 2 then begin + SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); + end; + if PlayersPlay = 3 then begin + SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); + SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); + end; + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); + end; + if ScreenAct = 2 then begin + SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); + SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[3].ScorePercent); + end; + end; + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); + SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); + end; + if ScreenAct = 2 then begin + SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[3].ScorePercent); + SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[4].ScorePercent); + SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[5].ScorePercent); + end; + end; + end; + //end Singbar Mod + + //PhrasenBonus - Line Bonus Mod + if Ini.LineBonus > 0 then begin + A := GetTickCount div 33; + if (A <> Tickold2) AND (Player[0].LineBonus_Visible) then begin + Tickold2 := A; + for E := 0 to (PlayersPlay - 1) do begin + //Change Alpha + Player[E].LineBonus_Alpha := Player[E].LineBonus_Alpha - 0.02; + + if Player[E].LineBonus_Alpha <= 0 then + Player[E].LineBonus_Visible := False + else + begin + //Change Position + if (Player[E].LineBonus_PosX < Player[E].LineBonus_TargetX) then + Inc(Player[E].LineBonus_PosX,1) + else if (Player[E].LineBonus_PosX > Player[E].LineBonus_TargetX) then + Dec(Player[E].LineBonus_PosX,1); + + if (Player[E].LineBonus_PosY < Player[E].LineBonus_TargetY) then + Inc(Player[E].LineBonus_PosY,1) + else if (Player[E].LineBonus_PosY > Player[E].LineBonus_TargetY) then + Dec(Player[E].LineBonus_PosY,1); + + end; + end; + end; //if + + if PlayersPlay = 1 then begin + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text); + end + else if PlayersPlay = 2 then begin + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text); + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text); + end + else if PlayersPlay = 3 then begin + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text); + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text); + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text); + end + else if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text); + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text); + end; + if ScreenAct = 2 then begin + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text); + SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text); + end; + end; + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text); + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text); + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text); + end; + if ScreenAct = 2 then begin + SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text); + SingDrawLineBonus( Player[4].LineBonus_PosX, Player[4].LineBonus_PosY, Player[4].LineBonus_Color, Player[4].LineBonus_Alpha, Player[4].LineBonus_Text); + SingDrawLineBonus( Player[5].LineBonus_PosX, Player[5].LineBonus_PosY, Player[5].LineBonus_Color, Player[5].LineBonus_Alpha, Player[5].LineBonus_Text); + end; + end; + end; + //PhrasenBonus - Line Bonus Mod End + + + // rysuje paski +// Log.LogStatus('Original notes', 'SingDraw'); + case Ini.Difficulty of + 0: + begin + NotesH := 11; // 9 + NotesW := 6; // 5 + end; + 1: + begin + NotesH := 8; // 7 + NotesW := 4; // 4 + end; + 2: + begin + NotesH := 5; + NotesW := 3; + end; + end; + + if PlayersPlay = 1 then begin + SingDrawPlayerBGCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 0, 15); + end; + + if (PlayersPlay = 2) then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); + + SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); + + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); + end; + + if PlayersPlay = 3 then begin + NotesW := NotesW * 0.8; + NotesH := NotesH * 0.8; + + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); + + SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); + SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 0, 12); + SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 0, 12); + + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); + end; + if ScreenAct = 2 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 2, 15); + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 3, 15); + end; + + SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); + + if ScreenAct = 1 then begin + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); + end; + if ScreenAct = 2 then begin + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 2, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 3, 15); + end; + end; + + if PlayersPlay = 6 then begin + NotesW := NotesW * 0.8; + NotesH := NotesH * 0.8; + + if ScreenAct = 1 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); + end; + if ScreenAct = 2 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 3, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 4, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 5, 12); + end; + + SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); + SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 0, 12); + SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 0, 12); + + if ScreenAct = 1 then begin + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); + end; + if ScreenAct = 2 then begin + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 3, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 4, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 5, 12); + end; + end; + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); +end; + +procedure SingModiDraw (PlayerInfo: TPlayerInfo); +var + Pet: integer; + Pet2: integer; + TempR: real; + Rec: TRecR; + TexRec: TRecR; + NR: TRecR; + FS: real; + BarFrom: integer; + BarAlpha: real; + BarWspol: real; + TempCol: real; + Tekst: string; + LyricTemp: string; + PetCz: integer; + + + + //SingBar Mod + A: Integer; + E: Integer; + I: Integer; + //end Singbar Mod + + + +begin + // positions + if Ini.SingWindow = 0 then begin + NR.Left := 120; + end else begin + NR.Left := 20; + end; + NR.Right := 780; + + NR.Width := NR.Right - NR.Left; + NR.WMid := NR.Width / 2; + NR.Mid := NR.Left + NR.WMid; + + // background //BG Fullsize Mod + //SingDrawBackground; + + // time bar +// Log.LogStatus('Time Bar', 'SingDraw'); + glBegin(GL_QUADS); + glColor3f(0.9, 0.9, 0.9); + glVertex2f(140 + 10*ScreenX, 21); + glVertex2f(140 + 10*ScreenX, 29); + glVertex2f(330 + 10*ScreenX, 29); + glVertex2f(330 + 10*ScreenX, 21); + glColor3f(Skin_TimeR, Skin_TimeG, Skin_TimeB); + glVertex2f(140 + 10*ScreenX, 21); + glVertex2f(140 + 10*ScreenX, 29); + glVertex2f(140 + 10*ScreenX+(330-140)*(Czas.Teraz/Czas.Razem), 29); + glVertex2f(140 + 10*ScreenX+(330-140)*(Czas.Teraz/Czas.Razem), 21); + glEnd; + + if DLLMan.Selected.ShowNotes then + begin + // rysuje paski pod nutami + if PlayersPlay = 1 then + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); + if (PlayersPlay = 2) or (PlayersPlay = 4) then begin + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P1_NotesB - 105, Nr.Right + 10*ScreenX, 15); + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); + end; + + if (PlayersPlay = 3) or (PlayersPlay = 6) then begin + SingDrawNoteLines(Nr.Left + 10*ScreenX, 120, Nr.Right + 10*ScreenX, 12); + SingDrawNoteLines(Nr.Left + 10*ScreenX, 245, Nr.Right + 10*ScreenX, 12); + SingDrawNoteLines(Nr.Left + 10*ScreenX, 370, Nr.Right + 10*ScreenX, 12); + end; + end; + + // rysuje tekst - new Lyric engine + ScreenSingModi.LyricMain.Draw; + ScreenSingModi.LyricSub.Draw; + + // rysuje pasek, podpowiadajacy poczatek spiwania w scenie + FS := 1.3; + BarFrom := Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start; + if BarFrom > 40 then BarFrom := 40; + if (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start > 8) and // dluga przerwa //16->12 for more help bars and then 12->8 for even more + (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat > 0) and // przed tekstem + (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat < 40) then begin // ale nie za wczesnie + BarWspol := (Czas.MidBeat - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - BarFrom)) / BarFrom; + Rec.Left := NR.Left + BarWspol * + // (NR.WMid - Czesci[0].Czesc[Czesci[0].Akt].LyricWidth / 2 * FS - 50); + (ScreenSingModi.LyricMain.ClientX - NR.Left - 50) + 10*ScreenX; + Rec.Right := Rec.Left + 50; + Rec.Top := Skin_LyricsT + 3; + Rec.Bottom := Rec.Top + 33;//SingScreen.LyricMain.Size * 3; + + // zapalanie + BarAlpha := (BarWspol*10) * 0.5; + if BarAlpha > 0.5 then BarAlpha := 0.5; + + // gaszenie + if BarWspol > 0.95 then BarAlpha := 0.5 * (1 - (BarWspol - 0.95) * 20); + //Change fuer Crazy Joker + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glColor4f(26/255, 165/255, 220/255, 0); + glVertex2f(Rec.Left, Rec.Top); + glVertex2f(Rec.Left, Rec.Bottom); + glColor4f(26/255, 165/255, 220/255, BarAlpha); + glVertex2f(Rec.Right, Rec.Bottom); + glVertex2f(Rec.Right, Rec.Top); + glEnd; + glDisable(GL_BLEND); + end; + + // oscilloscope + if (((Ini.Oscilloscope = 1) AND (DLLMan.Selected.ShowRateBar_O)) AND (NOT DLLMan.Selected.ShowRateBar)) then begin + if PlayersPlay = 1 then + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + + if PlayersPlay = 2 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + if ScreenAct = 2 then begin + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 2); + if PlayerInfo.Playerinfo[3].Enabled then + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 3); + end; + end; + + if PlayersPlay = 3 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawOscilloscope(75 + 10*ScreenX, 95, 100, 20, 0); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 0); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + if ScreenAct = 2 then begin + if PlayerInfo.Playerinfo[3].Enabled then + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 3); + if PlayerInfo.Playerinfo[4].Enabled then + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 4); + if PlayerInfo.Playerinfo[5].Enabled then + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 5); + end; + end; + + end + + //SingBar Mod + else if ((Ini.Oscilloscope = 2) AND (DLLMan.Selected.ShowRateBar_O)) OR (DLLMan.Selected.ShowRateBar) then begin + A := GetTickCount div 33; + if A <> Tickold then begin + Tickold := A; + for E := 0 to (PlayersPlay - 1) do begin //Set new Pos + Alpha + I := Player[E].ScorePercentTarget - Player[E].ScorePercent; + if I > 0 then Inc(Player[E].ScorePercent) + else if I < 0 then Dec(Player[E].ScorePercent); + end; //for + end; //if + if PlayersPlay = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + end; + if PlayersPlay = 2 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); + end; + if PlayersPlay = 3 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); + end; + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); + end; + if ScreenAct = 2 then begin + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); + if PlayerInfo.Playerinfo[3].Enabled then + SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[3].ScorePercent); + end; + end; + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); + end; + if ScreenAct = 2 then begin + if PlayerInfo.Playerinfo[3].Enabled then + SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[3].ScorePercent); + if PlayerInfo.Playerinfo[4].Enabled then + SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[4].ScorePercent); + if PlayerInfo.Playerinfo[5].Enabled then + SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[5].ScorePercent); + end; + end; + end; + //end Singbar Mod + + //PhrasenBonus - Line Bonus Mod + if ((Ini.LineBonus > 0) AND (DLLMan.Selected.EnLineBonus_O)) OR (DLLMan.Selected.EnLineBonus) then begin + A := GetTickCount div 33; + if (A <> Tickold2) AND (Player[0].LineBonus_Visible) then begin + Tickold2 := A; + for E := 0 to (PlayersPlay - 1) do begin + //Change Alpha + Player[E].LineBonus_Alpha := Player[E].LineBonus_Alpha - 0.02; + + if Player[E].LineBonus_Alpha <= 0 then + Player[E].LineBonus_Visible := False + else + begin + //Change Position + if (Player[E].LineBonus_PosX < Player[E].LineBonus_TargetX) then + Inc(Player[E].LineBonus_PosX,1) + else if (Player[E].LineBonus_PosX > Player[E].LineBonus_TargetX) then + Dec(Player[E].LineBonus_PosX,1); + + if (Player[E].LineBonus_PosY < Player[E].LineBonus_TargetY) then + Inc(Player[E].LineBonus_PosY,1) + else if (Player[E].LineBonus_PosY > Player[E].LineBonus_TargetY) then + Dec(Player[E].LineBonus_PosY,1); + + end; + end; + end; //if + + if PlayersPlay = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text); + end + else if PlayersPlay = 2 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text); + end + else if PlayersPlay = 3 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text); + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text); + end + else if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text); + end; + if ScreenAct = 2 then begin + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text); + if PlayerInfo.Playerinfo[3].Enabled then + SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text); + end; + end; + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text); + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text); + end; + if ScreenAct = 2 then begin + if PlayerInfo.Playerinfo[3].Enabled then + SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text); + if PlayerInfo.Playerinfo[4].Enabled then + SingDrawLineBonus( Player[4].LineBonus_PosX, Player[4].LineBonus_PosY, Player[4].LineBonus_Color, Player[4].LineBonus_Alpha, Player[4].LineBonus_Text); + if PlayerInfo.Playerinfo[5].Enabled then + SingDrawLineBonus( Player[5].LineBonus_PosX, Player[5].LineBonus_PosY, Player[5].LineBonus_Color, Player[5].LineBonus_Alpha, Player[5].LineBonus_Text); + end; + end; + end; + //PhrasenBonus - Line Bonus Mod End + + + // rysuje paski +// Log.LogStatus('Original notes', 'SingDraw'); + case Ini.Difficulty of + 0: + begin + NotesH := 11; // 9 + NotesW := 6; // 5 + end; + 1: + begin + NotesH := 8; // 7 + NotesW := 4; // 4 + end; + 2: + begin + NotesH := 5; + NotesW := 3; + end; + end; + + if (DLLMAn.Selected.ShowNotes And DLLMan.Selected.LoadSong) then + begin + if (PlayersPlay = 1) And PlayerInfo.Playerinfo[0].Enabled then begin + SingDrawPlayerBGCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 0, 15); + end; + + if (PlayersPlay = 2) then begin + if PlayerInfo.Playerinfo[0].Enabled then + begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); + end; + if PlayerInfo.Playerinfo[1].Enabled then + begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); + end; + + end; + + if PlayersPlay = 3 then begin + NotesW := NotesW * 0.8; + NotesH := NotesH * 0.8; + + if PlayerInfo.Playerinfo[0].Enabled then + begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); + SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); + end; + + if PlayerInfo.Playerinfo[1].Enabled then + begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); + SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); + end; + + if PlayerInfo.Playerinfo[2].Enabled then + begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); + SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); + end; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); + end; + if ScreenAct = 2 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 2, 15); + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 3, 15); + end; + + SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); + + if ScreenAct = 1 then begin + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); + end; + if ScreenAct = 2 then begin + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 2, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 3, 15); + end; + end; + + if PlayersPlay = 6 then begin + NotesW := NotesW * 0.8; + NotesH := NotesH * 0.8; + + if ScreenAct = 1 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); + end; + if ScreenAct = 2 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 3, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 4, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 5, 12); + end; + + SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); + SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 0, 12); + SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 0, 12); + + if ScreenAct = 1 then begin + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); + end; + if ScreenAct = 2 then begin + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 3, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 4, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 5, 12); + end; + end; + end; + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); +end; + + +//SingBar Mod +procedure SingDrawSingbar(X, Y, W, H: real; Percent: integer); +var + R: Real; + G: Real; + B: Real; + A: cardinal; + I: Integer; + +begin; + + //SingBar Background + glColor4f(1, 1, 1, 0.8); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Back.TexNum); + glBegin(GL_QUADS); + glTexCoord2f(1/16, 0); glVertex2f(X, Y); + glTexCoord2f(1/16, 1); glVertex2f(X, Y+H); + glTexCoord2f(1 - 1/16, 1); glVertex2f(X+W, Y+H); + glTexCoord2f(1 - 1/16, 0); glVertex2f(X+W, Y); + glEnd; + + //SingBar coloured Bar + Case Percent of + 0..22: begin + R := 1; + G := 0; + B := 0; + end; + 23..42: begin + R := 1; + G := ((Percent-23)/100)*5; + B := 0; + end; + 43..57: begin + R := 1; + G := 1; + B := 0; + end; + 58..77: begin + R := 1-(Percent - 58)/100*5; + G := 1; + B := 0; + end; + 78..99: begin + R := 0; + G := 1; + B := 0; + end; + End; //Case + + glColor4f(R, G, B, 1); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Bar.TexNum); + //Size= Player[PlayerNum].ScorePercent of W + glBegin(GL_QUADS); + glTexCoord2f(1/16, 0); glVertex2f(X, Y); + glTexCoord2f(1/16, 1); glVertex2f(X, Y+H); + glTexCoord2f(1 - 1/16, 1); glVertex2f(X+(W/100 * (Percent +1)), Y+H); + glTexCoord2f(1 - 1/16, 0); glVertex2f(X+(W/100 * (Percent +1)), Y); + glEnd; + + //SingBar Front + glColor4f(1, 1, 1, 0.6); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Front.TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(X, Y); + glTexCoord2f(0, 1); glVertex2f(X, Y+H); + glTexCoord2f(1, 1); glVertex2f(X+W, Y+H); + glTexCoord2f(1, 0); glVertex2f(X+W, Y); + glEnd; +end; +//end Singbar Mod + +//PhrasenBonus - Line Bonus Mod +procedure SingDrawLineBonus( const X, Y: integer; Color: TRGB; Alpha: Single; Text: string); +var +Length, X2: Real; //Length of Text +begin +if Alpha <> 0 then +begin + +//Set Font Propertys +SetFontStyle(2); //Font: Outlined1 +SetFontSize(6); +SetFontItalic(False); + +//Check Font Size +Length := glTextWidth ( PChar(Text)) + 3; //Little Space for a Better Look ^^ + +//Text +SetFontPos (X + 50 - (Length / 2), Y + 12); //Position + + //Draw Background + glColor4f(Color.R, Color.G, Color.B, Alpha); //Set Color + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + //Old Method with Variable Background + {//Draw Left Side + glBindTexture(GL_TEXTURE_2D, Tex_SingLineBonusL.TexNum); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(X, Y); + glTexCoord2f(0, 1); glVertex2f(X, Y + Tex_SingLineBonusL.H * Tex_SingLineBonusL.ScaleH); + glTexCoord2f(1, 1); glVertex2f(X + Tex_SingLineBonusL.W * Tex_SingLineBonusL.scaleW, Y + Tex_SingLineBonusL.H * Tex_SingLineBonusL.scaleH); + glTexCoord2f(1, 0); glVertex2f(X + Tex_SingLineBonusL.W * Tex_SingLineBonusL.scaleW, Y); + glEnd; + + //Set X of Next Tile + X2 := X + Tex_SingLineBonusL.W * Tex_SingLineBonusL.scaleW; + + //Draw Middle + glBindTexture(GL_TEXTURE_2D, Tex_SingLineBonusM.TexNum); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(X2, Y); + glTexCoord2f(0, 1); glVertex2f(X2, Y + Tex_SingLineBonusM.H * Tex_SingLineBonusM.ScaleH); + glTexCoord2f(1, 1); glVertex2f(X2 + Length, Y + Tex_SingLineBonusM.H * Tex_SingLineBonusM.scaleH); + glTexCoord2f(1, 0); glVertex2f(X2 + Length, Y); + glEnd; + + //Set X of Next Tile + X2 := X2 + Length; + + //Draw Rigth Side + glBindTexture(GL_TEXTURE_2D, Tex_SingLineBonusR.TexNum); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(X2, Y); + glTexCoord2f(0, 1); glVertex2f(X2, Y + Tex_SingLineBonusR.H * Tex_SingLineBonusR.ScaleH); + glTexCoord2f(1, 1); glVertex2f(X2 + Tex_SingLineBonusR.W * Tex_SingLineBonusR.scaleW, Y + Tex_SingLineBonusR.H * Tex_SingLineBonusR.scaleH); + glTexCoord2f(1, 0); glVertex2f(X2 + Tex_SingLineBonusR.W * Tex_SingLineBonusR.scaleW, Y); + glEnd;} + //New Method, Not Variable + glBindTexture(GL_TEXTURE_2D, Tex_SingLineBonusBack.TexNum); + + glBegin(GL_QUADS); + glTexCoord2f(1/32, 0); glVertex2f(X, Y); + glTexCoord2f(1/32, 1); glVertex2f(X, Y + 50); + glTexCoord2f(31/32, 1); glVertex2f(X + 100, Y + 50); + glTexCoord2f(31/32, 0); glVertex2f(X + 100, Y); + glEnd; + + glColor4f(1, 1, 1, Alpha); //Set Color + //Draw Text + glPrint (PChar(Text)); +end; +end; +//PhrasenBonus - Line Bonus Mod + +// Draw Note Bars for Editor +//There are 11 Resons for a new Procdedure: +// 1. It don't look good when you Draw the Golden Note Star Effect in the Editor +// 2. You can see the Freestyle Notes in the Editor SemiTransparent +// 3. Its easier and Faster then changing the old Procedure +procedure EditDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); +var + Rec: TRecR; + Pet: integer; + TempR: real; +begin + glColor3f(1, 1, 1); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); + with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin + for Pet := 0 to HighNut do begin + with Nuta[Pet] do begin + + // Golden Note Patch + case Wartosc of + 0: glColor4f(1, 1, 1, 0.35); + 1: glColor4f(1, 1, 1, 0.85); + 2: glColor4f(1, 1, 0.3, 0.85); + end; // case + + + + // lewa czesc - left part + Rec.Left := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX; + Rec.Right := Rec.Left + NotesW; + Rec.Top := Top - (Ton-BaseNote)*Space/2 - NotesH; + Rec.Bottom := Rec.Top + 2 * NotesH; + glBindTexture(GL_TEXTURE_2D, Tex_Left[Color].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(7/8, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(7/8, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // srodkowa czesc - middle part + Rec.Left := Rec.Right; + Rec.Right := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - NotesW - 0.5 + 10*ScreenX; + + glBindTexture(GL_TEXTURE_2D, Tex_Mid[Color].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(1/32, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(1/32, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(31/32, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(31/32, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // prawa czesc - right part + Rec.Left := Rec.Right; + Rec.Right := Rec.Right + NotesW; + + glBindTexture(GL_TEXTURE_2D, Tex_Right[Color].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(1/8, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(1/8, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + end; // with + end; // for + end; // with + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); +end; + +end. + diff --git a/Game/Code/Classes/UFiles.dcu b/Game/Code/Classes/UFiles.dcu new file mode 100644 index 00000000..9ed45d8f Binary files /dev/null and b/Game/Code/Classes/UFiles.dcu differ diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas new file mode 100644 index 00000000..61fdab03 --- /dev/null +++ b/Game/Code/Classes/UFiles.pas @@ -0,0 +1,326 @@ +unit UFiles; + +interface + +uses USongs, SysUtils, ULog, UMusic; + +//procedure InitializePaths; //Function sets All Absolute Paths eg. for Songs +function ReadTXTHeader(var Song: TSong): boolean; //Reads Standard TXT Header +function AnalyseFile(var Song: TSong): boolean; //Analyse Song File and Read Header +procedure ClearSong(var Song: TSong); //Clears Song Header values + +//procedure CzyscNuty; +//function WczytajCzesci(Name: string): boolean; +//function SaveSong(Song: TSong; Czesc: TCzesci; Name: string; Relative: boolean): boolean; +//function SaveSongDebug(Song: TSong; Czesc: TCzesci; Name: string; Relative: boolean): boolean; + +var + {//Absolute Paths + GamePath: string; + SoundPath: string; + SongPath: string; + LogPath: string; + ThemePath: string; + ScreenshotsPath: string; + CoversPath: string; + LanguagesPath: string; //} + + SongFile: TextFile; // all procedures in this unit operates on this file + FileLineNo: integer; //Line which is readed at Last, for error reporting + + {// variables available for all procedures + Base: array[0..1] of integer; + Rel: array[0..1] of integer;//} + Mult: integer = 1; + MultBPM: integer = 4; + +implementation +uses TextGL, UIni, UMain, UPliki; + + //Function sets All Absolute Paths eg. for Songs +{procedure InitializePaths; +begin + GamePath := ExtractFilePath(ParamStr(0)); + SoundPath := GamePath + 'Sounds\'; + SongPath := GamePath + 'Songs\'; + LogPath := GamePath; + ThemePath := GamePath + 'Themes\'; + ScreenshotsPath := GamePath + 'Screenshots\'; + CoversPath := GamePath + 'Covers\'; + LanguagesPath := GamePath + 'Languages\'; + + DecimalSeparator := ','; +end;} + + //Clears Song Header values +procedure ClearSong(var Song: TSong); +begin + //Main Information + Song.Title := ''; + Song.Artist := ''; + + //Sortings: + Song.Genre := 'Unknown'; + Song.Edition := 'Unknown'; + Song.Language := 'Unknown'; //Language Patch + + //Required Information + Song.Mp3 := ''; + Song.BPM := 0; + Song.GAP := 0; + Song.Start := 0; + Song.Finish := 0; + + //Additional Information + Song.Background := ''; + Song.Video := ''; + Song.VideoGAP := 0; + Song.NotesGAP := 0; + Song.Resolution := 4; + Song.Creator := ''; +end; + + //Reads Standard TXT Header +function ReadTXTHeader(var Song: TSong): boolean; +var +Line, Identifier, Value: String; +Temp: word; +Done: byte; +begin + Result := true; + + //Read first Line + ReadLn (SongFile, Line); + + if (Length(Line)<=0) then + begin + Log.LogError('File Starts with Empty Line: ' + Song.FileName); + Result := False; + Exit; + end; + + //Read Lines while Line starts with # + While (Line[1] = '#') do + begin + //Increase Line Number + Inc (FileLineNo); + Temp := Pos(':', Line); + + //Line has a Seperator-> Headerline + if (Temp <> 0) then + begin + //Read Identifier and Value + Identifier := Uppercase(Trim(Copy(Line, 2, Temp - 2))); //Uppercase is for Case Insensitive Checks + Value := Trim(Copy(Line, Temp + 1,Length(Line) - Temp)); + + //Check the Identifier (If Value is given) + if (Length(Value) <> 0) then + begin + + //----------- + //Required Attributes + //----------- + + //Title + if (Identifier = 'TITLE') then + begin + Song.Title := Value; + + //Add Title Flag to Done + Done := Done or 1; + end + + //Artist + else if (Identifier = 'ARTIST') then + begin + Song.Artist := Value; + + //Add Artist Flag to Done + Done := Done or 2; + end + + //MP3 File //Test if Exists + else if (Identifier = 'MP3') AND (FileExists(Song.Path + Value)) then + begin + Song.Mp3 := Value; + + //Add Mp3 Flag to Done + Done := Done or 4; + end + + //Beats per Minute + else if (Identifier = 'BPM') then + begin + // Replace . with , + if (Pos('.', Value) <> 0) then + Value[Pos('.', Value)] := ','; + + SetLength(Song.BPM, 1); + Song.BPM[0].StartBeat := 0; + + Song.BPM[0].BPM := StrtoFloatDef(Value, 0) * Mult * MultBPM; + + if Song.BPM[0].BPM <> 0 then + begin + //Add BPM Flag to Done + Done := Done or 8; + end; + end + + //--------- + //Additional Header Information + //--------- + + //Cover Picture + else if (Identifier = 'COVER') then + begin + Song.Cover := Value; + end + + //Background Picture + else if (Identifier = 'BACKGROUND') then + begin + Song.Background := Value; + end + + // Video File + else if (Identifier = 'VIDEO') then + begin + Song.Video := Value; + end + + // Video Gap + else if (Identifier = 'VIDEOGAP') then + begin + // Replace . with , + if (Pos('.', Value) <> 0) then + Value[Pos('.', Value)] := ','; + + Song.VideoGAP := StrtoFloatDef (Value, 0); + end + + //Genre Sorting + else if (Identifier = 'GENRE') then + begin + Song.Genre := Value; + end + + //Edition Sorting + else if (Identifier = 'EDITION') then + begin + Song.Edition := Value; + end + + //Creator Tag + else if (Identifier = 'CREATOR') then + begin + Song.Creator := Value; + end + + //Language Sorting + else if (Identifier = 'LANGUAGE') then + begin + Song.Language := Value; + end + + // Song Start + else if (Identifier = 'START') then + begin + // Replace . with , + if (Pos('.', Value) <> 0) then + Value[Pos('.', Value)] := ','; + + Song.Start := StrtoFloatDef(Value, 0); + end + + // Song Ending + else if (Identifier = 'END') then + begin + TryStrtoInt(Value, Song.Finish); + end + + // Resolution + else if (Identifier = 'RESOLUTION') then + begin + TryStrtoInt(Value, Song.Resolution); + end + + // Notes Gap + else if (Identifier = 'NOTESGAP') then + begin + TryStrtoInt(Value, Song.NotesGAP); + end + + // Relative Notes + else if (Identifier = 'RELATIVE') AND (uppercase(Value) = 'YES') then + begin + Song.Relative := True; + end; + + end; + end; + + if not EOf(SongFile) then + ReadLn (SongFile, Line) + else + begin + Result := False; + Log.LogError('File Incomplete or not Ultrastar TxT: ' + Song.FileName); + break; + end; + + //End on first empty Line + if (Length(Line) = 0) then + break; + end; + + //Check if all Required Values are given + if (Done <> 15) then + begin + Result := False; + if (Done and 8) = 0 then //No BMP Flag + Log.LogError('BMP Tag Missing: ' + Song.FileName) + else if (Done and 4) = 0 then //No MP3 Flag + Log.LogError('MP3 Tag/File Missing: ' + Song.FileName) + else if (Done and 2) = 0 then //No Artist Flag + Log.LogError('Artist Tag Missing: ' + Song.FileName) + else if (Done and 1) = 0 then //No Title Flag + Log.LogError('Title Tag Missing: ' + Song.FileName) + else //unknown Error + Log.LogError('File Incomplete or not Ultrastar TxT: ' + Song.FileName); + end; + +end; + + //Analyse Song File and Read Header +function AnalyseFile(var Song: TSong): boolean; +begin +Result := False; +{try } + //Reset LineNo + FileLineNo := 0; + + //Open File and set File Pointer to the beginning + AssignFile(SongFile, Song.Path + Song.FileName); + Reset(SongFile); + + //Clear old Song Header + ClearSong(Song); + + //Read Header + Result := ReadTxTHeader(Song); + + //And Close File + CloseFile(SongFile); +{except + CloseFile(SongFile); + + Result := False; + //Error Reporting + Log.LogError('An Error occured reading Line ' + inttostr(FileLineNo) + ' from SongHeader: ' + Song.FileName); +end;} +end; + + + +end. \ No newline at end of file diff --git a/Game/Code/Classes/UGraphic.dcu b/Game/Code/Classes/UGraphic.dcu new file mode 100644 index 00000000..c264b16b Binary files /dev/null and b/Game/Code/Classes/UGraphic.dcu differ diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas new file mode 100644 index 00000000..05a9fda7 --- /dev/null +++ b/Game/Code/Classes/UGraphic.pas @@ -0,0 +1,405 @@ +unit UGraphic; + +interface +uses + SDL, OpenGL12, UTexture, TextGL, ULog, SysUtils, ULyrics, UScreenLoading, + UScreenWelcome, UScreenMain, UScreenName, UScreenLevel, UScreenOptions, UScreenOptionsGame, + UScreenOptionsGraphics, UScreenOptionsSound, UScreenOptionsLyrics, UScreenOptionsThemes, UScreenOptionsRecord, + UScreenSong, UScreenSing, UScreenScore, UScreenTop5, UScreenEditSub, + UScreenEdit, UScreenEditConvert, UScreenEditHeader, UScreenOpen, UThemes, USkins, UScreenSongMenu, + {Party Screens} UScreenSingModi, UScreenPartyNewRound, UScreenPartyScore, UScreenPartyOptions, UScreenPartyWin, UScreenPartyPlayer; + +type + TRecR = record + Top: real; + Left: real; + Right: real; + Bottom: real; + end; + +var + Screen: PSDL_Surface; + + RenderW: integer; + RenderH: integer; + ScreenW: integer; + ScreenH: integer; + Screens: integer; + ScreenAct: integer; + ScreenX: integer; + + ScreenLoading: TScreenLoading; + ScreenWelcome: TScreenWelcome; + ScreenMain: TScreenMain; + ScreenName: TScreenName; + ScreenLevel: TScreenLevel; + ScreenSong: TScreenSong; + ScreenSing: TScreenSing; + ScreenScore: TScreenScore; + ScreenTop5: TScreenTop5; + ScreenOptions: TScreenOptions; + ScreenOptionsGame: TScreenOptionsGame; + ScreenOptionsGraphics: TScreenOptionsGraphics; + ScreenOptionsSound: TScreenOptionsSound; + ScreenOptionsLyrics: TScreenOptionsLyrics; + ScreenOptionsThemes: TScreenOptionsThemes; + ScreenOptionsRecord: TScreenOptionsRecord; + ScreenEditSub: TScreenEditSub; + ScreenEdit: TScreenEdit; + ScreenEditConvert: TScreenEditConvert; + ScreenEditHeader: TScreenEditHeader; + ScreenOpen: TScreenOpen; + + ScreenSongMenu: TScreenSongMenu; + + //Party Screens + ScreenSingModi: TScreenSingModi; + ScreenPartyNewRound: TScreenPartyNewRound; + ScreenPartyScore: TScreenPartyScore; + ScreenPartyWin: TScreenPartyWin; + ScreenPartyOptions: TScreenPartyOptions; + ScreenPartyPlayer: TScreenPartyPlayer; + + + Tex_Left: array[0..6] of TTexture; + Tex_Mid: array[0..6] of TTexture; + Tex_Right: array[0..6] of TTexture; + + Tex_BG_Left: array[1..6] of TTexture; + Tex_BG_Mid: array[1..6] of TTexture; + Tex_BG_Right: array[1..6] of TTexture; + + Tex_Note_Star: TTexture; + + Tex_Ball: TTexture; + FullScreen: boolean; + + + + //Sing Bar Mod + Tex_SingBar_Back: TTexture; + Tex_SingBar_Bar: TTexture; + Tex_SingBar_Front: TTexture; + //end Singbar Mod + + //PhrasenBonus - Line Bonus Mod + Tex_SingLineBonusBack: TTexture; + //End PhrasenBonus - Line Bonus Mod + +const + Skin_BGColorR = 1; + Skin_BGColorG = 1; + Skin_BGColorB = 1; + + Skin_SpectrumR = 0; + Skin_SpectrumG = 0; + Skin_SpectrumB = 0; + + Skin_Spectograph1R = 0.6; + Skin_Spectograph1G = 0.8; + Skin_Spectograph1B = 1; + + Skin_Spectograph2R = 0; + Skin_Spectograph2G = 0; + Skin_Spectograph2B = 0.2; + + Skin_SzczytR = 0.8; + Skin_SzczytG = 0; + Skin_SzczytB = 0; + + Skin_SzczytLimitR = 0; + Skin_SzczytLimitG = 0.8; + Skin_SzczytLimitB = 0; + + Skin_FontR = 0; + Skin_FontG = 0; + Skin_FontB = 0; + + Skin_FontHighlightR = 0.3; // 0.3 + Skin_FontHighlightG = 0.3; // 0.3 + Skin_FontHighlightB = 1; // 1 + + Skin_TimeR = 0.25; //0,0,0 + Skin_TimeG = 0.25; + Skin_TimeB = 0.25; + + Skin_OscR = 0; + Skin_OscG = 0; + Skin_OscB = 0; + + Skin_LyricsT = 500; // 510 / 400 + Skin_SpectrumT = 470; + Skin_SpectrumBot = 570; + Skin_SpectrumH = 100; + + Skin_P1_LinesR = 0.5; // 0.6 0.6 1 + Skin_P1_LinesG = 0.5; + Skin_P1_LinesB = 0.5; + + Skin_P2_LinesR = 0.5; // 1 0.6 0.6 + Skin_P2_LinesG = 0.5; + Skin_P2_LinesB = 0.5; + + Skin_P1_NotesB = 250; + Skin_P2_NotesB = 430; // 430 / 300 + + Skin_P1_ScoreT = 50; + Skin_P1_ScoreL = 20; + + Skin_P2_ScoreT = 50; + Skin_P2_ScoreL = 640; + +procedure Initialize3D (Title: string); +procedure Reinitialize3D; +procedure SwapBuffers; + +procedure LoadTextures; +procedure InitializeScreen; +procedure LoadScreens; + + +implementation +uses UMain, UIni, UDisplay; + +procedure LoadTextures; +var + P: integer; + R, G, B: real; + Col: integer; +begin + // zaladowanie tekstur + Log.LogStatus('Loading Textures', 'LoadTextures'); + Tex_Left[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'BMP', 'Transparent', 0); + Tex_Mid[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'BMP', 'Plain', 0); + Tex_Right[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'BMP', 'Transparent', 0); + + // P1-6 + for P := 1 to 6 do begin + LoadColor(R, G, B, 'P' + IntToStr(P) + 'Light'); + Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + Tex_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'BMP', 'Note Transparent', Col); + Tex_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'BMP', 'Note Plain', Col); + Tex_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'BMP', 'Note Transparent', Col); + + Tex_BG_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGLeft')), 'BMP', 'Alpha Black Colored', Col); + Tex_BG_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGMid')), 'BMP', 'Alpha Black Colored', Col); + Tex_BG_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGRight')), 'BMP', 'Alpha Black Colored', Col); + end; + + Tex_Note_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteStar')), 'JPG', 'Font Black', 0); + Tex_Ball := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'BMP', 'Transparent', $FF00FF); + + + + //SingBar Mod + Tex_SingBar_Back := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBack')), 'JPG', 'Plain', 0); + Tex_SingBar_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBar')), 'JPG', 'Plain', 0); + Tex_SingBar_Front := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarFront')), 'JPG', 'Font', 0); + //end Singbar Mod + + //PhrasenBonus - Line Bonus Mod + Tex_SingLineBonusBack := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LineBonusBack')), 'JPG', 'Font Black', 0); + {//Set Texture to Font High + Tex_SingLineBonusL.H := 32; Tex_SingLineBonusL.W := 8; + Tex_SingLineBonusM.H := 32; //Tex_SingLineBonusM.TexW := Tex_SingLineBonusM.TexW/2; + Tex_SingLineBonusR.H := 32; Tex_SingLineBonusR.W := 8; } + //PhrasenBonus - Line Bonus Mod End + + // tworzenie czcionek + Log.LogStatus('Building Fonts', 'LoadTextures'); + BuildFont; +end; + +procedure Initialize3D (Title: string); +begin + Log.LogStatus('LoadOpenGL', 'Initialize3D'); + Log.BenchmarkStart(2); + + LoadOpenGL; + +// SDL_WM_SetIcon(SDL_LoadBMP('..\Graphics\us.ico'),0); + + Log.LogStatus('SDL_Init', 'Initialize3D'); + if ( SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO)= -1 ) then begin + Log.LogError('SDL_Init Failed', 'Initialize3D'); + exit; + end; + + SDL_WM_SetCaption(PChar(Title), 'WM_DEFAULT'); + + InitializeScreen; + + Log.BenchmarkEnd(2); + Log.LogBenchmark('--> Setting Screen', 2); + + // ladowanie tekstur + Log.BenchmarkStart(2); + Texture := TTextureUnit.Create; + Texture.Limit := 1024*1024; + + LoadTextures; + Log.BenchmarkEnd(2); + Log.LogBenchmark('--> Loading Textures', 2); + + Log.BenchmarkStart(2); + Lyric := TLyric.Create; + Log.BenchmarkEnd(2); + Log.LogBenchmark('--> Loading Fonts', 2); + + Log.BenchmarkStart(2); + Display := TDisplay.Create; + SDL_EnableUnicode(1); + Log.BenchmarkEnd(2); Log.LogBenchmark('====> Creating Display', 2); + + Log.LogStatus('Loading Screens', 'Initialize3D'); + Log.BenchmarkStart(3); + + LoadScreens; + Display.ActualScreen^.FadeTo(@ScreenMain); + + Log.BenchmarkEnd(2); + Log.LogBenchmark('--> Loading Screens', 2); + + Log.LogStatus('Finish', 'Initialize3D'); +end; + +procedure SwapBuffers; +begin + SDL_GL_SwapBuffers; + glMatrixMode(GL_PROJECTION); + glLoadIdentity; + glOrtho(0, 800, 600, 0, -1, 100); + glMatrixMode(GL_MODELVIEW); +end; + +procedure Reinitialize3D; +begin +// InitializeScreen; +// LoadTextures; +// LoadScreens; +end; + +procedure InitializeScreen; +var + S: string; + I: integer; + W, H: integer; +begin + Screens := Ini.Screens + 1; + + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + + S := IResolution[Ini.Resolution]; + I := Pos('x', S); + W := StrToInt(Copy(S, 1, I-1)) * Screens; + H := StrToInt(Copy(S, I+1, 1000)); + + if ParamStr(1) = '-fsblack' then begin + W := 800; + H := 600; + end; + if ParamStr(1) = '-320x240' then begin + W := 320; + H := 240; + end; + + + Log.LogStatus('SDL_SetVideoMode', 'Initialize3D'); +// SDL_SetRefreshrate(85); +// SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); + if (Ini.FullScreen = 0) and (ParamStr(1) <> '-fsblack') then + screen := SDL_SetVideoMode(W, H, (Ini.Depth+1) * 16, SDL_OPENGL) + else begin + screen := SDL_SetVideoMode(W, H, (Ini.Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN); + SDL_ShowCursor(0); + end; + if (screen = nil) then begin + Log.LogError('SDL_SetVideoMode Failed', 'Initialize3D'); + exit; + end; + + // clear screen once window is being shown + glClearColor(1, 1, 1, 1); + glClear(GL_COLOR_BUFFER_BIT); + SwapBuffers; + + // zmienne + RenderW := 800; + RenderH := 600; + ScreenW := W; + ScreenH := H; +end; + +procedure LoadScreens; +begin + ScreenLoading := TScreenLoading.Create(''); + ScreenLoading.onShow; + Display.ActualScreen := @ScreenLoading; + ScreenLoading.Draw; + Display.Draw; + SwapBuffers; + + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Loading', 3); Log.BenchmarkStart(3); +{ ScreenWelcome := TScreenWelcome.Create; //'BG', 4, 3); + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Welcome', 3); Log.BenchmarkStart(3);} + ScreenMain := TScreenMain.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Main', 3); Log.BenchmarkStart(3); + ScreenName := TScreenName.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Name', 3); Log.BenchmarkStart(3); + ScreenLevel := TScreenLevel.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Level', 3); Log.BenchmarkStart(3); + ScreenSong := TScreenSong.Create; + 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); + ScreenSing := TScreenSing.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing', 3); Log.BenchmarkStart(3); + ScreenScore := TScreenScore.Create(''); + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Score', 3); Log.BenchmarkStart(3); + ScreenTop5 := TScreenTop5.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Top5', 3); Log.BenchmarkStart(3); + ScreenOptions := TScreenOptions.Create(''); + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options', 3); Log.BenchmarkStart(3); + ScreenOptionsGame := TScreenOptionsGame.Create(''); + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Game', 3); Log.BenchmarkStart(3); + ScreenOptionsGraphics := TScreenOptionsGraphics.Create(''); + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Graphics', 3); Log.BenchmarkStart(3); + ScreenOptionsSound := TScreenOptionsSound.Create(''); + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Sound', 3); Log.BenchmarkStart(3); + ScreenOptionsLyrics := TScreenOptionsLyrics.Create(''); + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Lyrics', 3); Log.BenchmarkStart(3); + ScreenOptionsThemes := TScreenOptionsThemes.Create(''); + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Themes', 3); Log.BenchmarkStart(3); + ScreenOptionsRecord := TScreenOptionsRecord.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Record', 3); Log.BenchmarkStart(3); + ScreenEditSub := TScreenEditSub.Create(''); + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Sub', 3); Log.BenchmarkStart(3); + ScreenEdit := TScreenEdit.Create(''); + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit', 3); Log.BenchmarkStart(3); + ScreenEditConvert := TScreenEditConvert.Create(''); + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen EditConvert', 3); Log.BenchmarkStart(3); +// ScreenEditHeader := TScreenEditHeader.Create(Skin.ScoreBG); +// Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Header', 3); Log.BenchmarkStart(3); + ScreenOpen := TScreenOpen.Create(''); + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Open', 3); Log.BenchmarkStart(3); + ScreenSingModi := TScreenSingModi.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongMenu', 3); Log.BenchmarkStart(3); + //ScreenSongMenu := TScreenSongMenu.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing with Modi support', 3); Log.BenchmarkStart(3); + ScreenPartyNewRound := TScreenPartyNewRound.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyNewRound', 3); Log.BenchmarkStart(3); + ScreenPartyScore := TScreenPartyScore.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyScore', 3); Log.BenchmarkStart(3); + ScreenPartyWin := TScreenPartyWin.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyWin', 3); Log.BenchmarkStart(3); + ScreenPartyOptions := TScreenPartyOptions.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyOptions', 3); Log.BenchmarkStart(3); + ScreenPartyPlayer := TScreenPartyPlayer.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyPlayer', 3); Log.BenchmarkStart(3); +end; + +end. diff --git a/Game/Code/Classes/UGraphicClasses.dcu b/Game/Code/Classes/UGraphicClasses.dcu new file mode 100644 index 00000000..58d003b0 Binary files /dev/null and b/Game/Code/Classes/UGraphicClasses.dcu differ diff --git a/Game/Code/Classes/UGraphicClasses.pas b/Game/Code/Classes/UGraphicClasses.pas new file mode 100644 index 00000000..abb59e4b --- /dev/null +++ b/Game/Code/Classes/UGraphicClasses.pas @@ -0,0 +1,7 @@ +unit UGraphicClasses; + +interface + +implementation + +end. diff --git a/Game/Code/Classes/UIni.dcu b/Game/Code/Classes/UIni.dcu new file mode 100644 index 00000000..e891d36c Binary files /dev/null and b/Game/Code/Classes/UIni.dcu differ diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas new file mode 100644 index 00000000..beadabb6 --- /dev/null +++ b/Game/Code/Classes/UIni.pas @@ -0,0 +1,693 @@ +unit UIni; + +interface +uses IniFiles, ULog, SysUtils; + +type + TIni = class + Name: array[0..5] of string; + + // Game + Players: integer; + Difficulty: integer; + Language: integer; + Tabs: integer; + Tabs_at_startup:integer; //Tabs at Startup fix + Sorting: integer; + Debug: integer; + + // Graphics + Screens: integer; + Resolution: integer; + Depth: integer; + FullScreen: integer; + TextureSize: integer; + SingWindow: integer; + Oscilloscope: integer; + Spectrum: integer; + Spectrograph: integer; + MovieSize: integer; + //LineBonus Mod + LineBonus: integer; + //GMA Fix + GMAFix: integer; + + + // Sound + MicBoost: integer; + ClickAssist: integer; + BeatClick: integer; + SavePlayback: integer; + Threshold: integer; + //TwoPlayerMode: integer; + + // Lyrics + LyricsFont: integer; + LyricsEffect: integer; + Solmization: integer; + + // Themes + Theme: integer; + SkinNo: integer; + Color: integer; + + // Record + Card: integer; // not saved in config.ini + + CardList: array of record + Name: string; + Input: integer; + ChannelL: integer; + ChannelR: integer; + end; + + // Controller + Joypad: integer; + + // Soundcards + SoundCard: array[0..7, 1..2] of integer; + + // Devices + LPT: integer; + + procedure Load; + procedure Save; + procedure SaveNames; + procedure SaveLevel; + end; + + +var + Ini: TIni; + IResolution: array of string; + ILanguage: array of string; + ITheme: array of string; + ISkin: array of string; + ICard: array of string; + IInput: array of string; + +const + IPlayers: array[0..4] of string = ('1', '2', '3', '4', '6'); + IDifficulty: array[0..2] of string = ('Easy', 'Medium', 'Hard'); + ITabs: array[0..1] of string = ('Off', 'On'); + + ISorting: array[0..7] of string = ('Edition', 'Genre', 'Language', 'Folder', 'Title', 'Artist', 'Title2', 'Artist2'); + sEdition = 0; + sGenre = 1; + sLanguage = 2; + sFolder = 3; + sTitle = 4; + sArtist = 5; + sTitle2 = 6; + sArtist2 = 7; + + IDebug: array[0..1] of string = ('Off', 'On'); + + IScreens: array[0..1] of string = ('1', '2'); + IFullScreen: array[0..1] of string = ('Off', 'On'); + IDepth: array[0..1] of string = ('16 bit', '32 bit'); + ITextureSize: array[0..2] of string = ('128', '256', '512'); + ISingWindow: array[0..1] of string = ('Small', 'Big'); + + //SingBar Mod + IOscilloscope: array[0..2] of string = ('Off', 'Osci', 'Bar'); + //IOscilloscope: array[0..1] of string = ('Off', 'On'); + + //Line Bonus MOd + ILineBonus: array[0..2] of string = ('Off', 'At Score', 'At Notes'); + //GMA Fix + IGMAFix: array[0..1] of string = ('Off', 'On'); + + ISpectrum: array[0..1] of string = ('Off', 'On'); + ISpectrograph: array[0..1] of string = ('Off', 'On'); + IMovieSize: array[0..1] of string = ('Half', 'Full'); + + IMicBoost: array[0..3] of string = ('Off', '+6dB', '+12dB', '+18dB'); + IClickAssist: array[0..1] of string = ('Off', 'On'); + IBeatClick: array[0..1] of string = ('Off', 'On'); + ISavePlayback: array[0..1] of string = ('Off', 'On'); + IThreshold: array[0..3] of string = ('5%', '10%', '15%', '20%'); + //ITwoPlayerMode: array[0..2] of string = ('Stereo', '2 Cards', 'Advanced'); + + ILyricsFont: array[0..2] of string = ('Plain', 'OLine1', 'OLine2'); + ILyricsEffect: array[0..3] of string = ('Simple', 'Zoom', 'Slide', 'Ball'); + ISolmization: array[0..3] of string = ('Off', 'Euro', 'Jap', 'American'); + + IColor: array[0..8] of string = ('Blue', 'Green', 'Pink', 'Red', 'Violet', 'Orange', 'Yellow', 'Brown', 'Black'); + + IJoypad: array[0..1] of string = ('Off', 'On'); + ILPT: array[0..2] of string = ('Off', 'LCD', 'Lights'); + + IChannel: array[0..6] of string = ('0', '1', '2', '3', '4', '5', '6'); + +implementation +uses UPliki, SDL, ULanguage, USkins, URecord; + +procedure TIni.Load; +var + IniFile: TMemIniFile; + ThemeIni: TMemIniFile; + Tekst: string; + Pet: integer; + B: boolean; + I, I2, I3: integer; + S: string; + Modes: PPSDL_Rect; + SR: TSearchRec; //Skin List Patch + +function GetFileName (S: String):String; + begin + //Result := copy (S,0,StrRScan (PChar(S),char('.'))+1); + Result := copy (S,0,Pos ('.ini',S)-1); + end; + +begin + GamePath := ExtractFilePath(ParamStr(0)); + IniFile := TMemIniFile.Create(GamePath + 'config.ini'); + + // Name + for I := 0 to 5 do + Ini.Name[I] := IniFile.ReadString('Name', 'P'+IntToStr(I+1), 'Player'+IntToStr(I+1)); + + // Players + Tekst := IniFile.ReadString('Game', 'Players', IPlayers[0]); + for Pet := 0 to High(IPlayers) do + if Tekst = IPlayers[Pet] then Ini.Players := Pet; + + // Difficulty + Tekst := IniFile.ReadString('Game', 'Difficulty', 'Easy'); + for Pet := 0 to High(IDifficulty) do + if Tekst = IDifficulty[Pet] then Ini.Difficulty := Pet; + + // Language + Tekst := IniFile.ReadString('Game', 'Language', 'English'); + for Pet := 0 to High(ILanguage) do + if Tekst = ILanguage[Pet] then Ini.Language := Pet; + +// Language.ChangeLanguage(ILanguage[Ini.Language]); + + // Tabs + Tekst := IniFile.ReadString('Game', 'Tabs', ITabs[0]); + for Pet := 0 to High(ITabs) do + if Tekst = ITabs[Pet] then Ini.Tabs := Pet; + + //Tabs at Startup fix + Ini.Tabs_at_startup := Ini.Tabs; + + // Sorting + Tekst := IniFile.ReadString('Game', 'Sorting', ISorting[0]); + for Pet := 0 to High(ISorting) do + if Tekst = ISorting[Pet] then Ini.Sorting := Pet; + + // Debug + Tekst := IniFile.ReadString('Game', 'Debug', IDebug[0]); + for Pet := 0 to High(IDebug) do + if Tekst = IDebug[Pet] then Ini.Debug := Pet; + + //if Ini.Debug = 1 then SongPath := 'E:\UltraStar 03\Songs\'; + + // Screens + Tekst := IniFile.ReadString('Graphics', 'Screens', IScreens[0]); + for Pet := 0 to High(IScreens) do + if Tekst = IScreens[Pet] then Ini.Screens := Pet; + + // Resolution + SetLength(IResolution, 0); + Modes := SDL_ListModes(nil, SDL_OPENGL or SDL_FULLSCREEN); // Check if there are any modes available + repeat +// Log.LogError(Format( ' %d x %d', [ modes^.w, modes^.h ] ) ); + SetLength(IResolution, Length(IResolution) + 1); + IResolution[High(IResolution)] := IntToStr(Modes^.w) + 'x' + IntToStr(Modes^.h); + Inc(Modes); + until Modes^ = nil; + + // reverse order + for I := 0 to (Length(IResolution) div 2) - 1 do begin + S := IResolution[I]; + IResolution[I] := IResolution[High(IResolution)-I]; + IResolution[High(IResolution)-I] := S; + end; + + Tekst := IniFile.ReadString('Graphics', 'Resolution', '800x600'); + for Pet := 0 to High(IResolution) do + if Tekst = IResolution[Pet] then Ini.Resolution := Pet; + + // FullScreen + Tekst := IniFile.ReadString('Graphics', 'FullScreen', 'On'); + for Pet := 0 to High(IFullScreen) do + if Tekst = IFullScreen[Pet] then Ini.FullScreen := Pet; + + // Resolution + Tekst := IniFile.ReadString('Graphics', 'Depth', '32 bit'); + for Pet := 0 to High(IDepth) do + if Tekst = IDepth[Pet] then Ini.Depth := Pet; + + // Texture Size + Tekst := IniFile.ReadString('Graphics', 'TextureSize', ITextureSize[1]); + for Pet := 0 to High(ITextureSize) do + if Tekst = ITextureSize[Pet] then Ini.TextureSize := Pet; + + // SingWindow + Tekst := IniFile.ReadString('Graphics', 'SingWindow', 'Big'); + for Pet := 0 to High(ISingWindow) do + if Tekst = ISingWindow[Pet] then Ini.SingWindow := Pet; + + // Oscilloscope + Tekst := IniFile.ReadString('Graphics', 'Oscilloscope', 'Off'); + for Pet := 0 to High(IOscilloscope) do + if Tekst = IOscilloscope[Pet] then Ini.Oscilloscope := Pet; + + // Line Bonus + Tekst := IniFile.ReadString('Graphics', 'LineBonus', 'At Score'); + for Pet := 0 to High(ILineBonus) do + if Tekst = ILineBonus[Pet] then Ini.LineBonus := Pet; + + //GMA Fix + Tekst := IniFile.ReadString('Graphics', 'GMAFix', 'Off'); + for Pet := 0 to High(IGMAFix) do + if Tekst = IGMAFix[Pet] then Ini.GMAFix := Pet; + + // Spectrum + Tekst := IniFile.ReadString('Graphics', 'Spectrum', 'Off'); + for Pet := 0 to High(ISpectrum) do + if Tekst = ISpectrum[Pet] then Ini.Spectrum := Pet; + + // Spectrograph + Tekst := IniFile.ReadString('Graphics', 'Spectrograph', 'Off'); + for Pet := 0 to High(ISpectrograph) do + if Tekst = ISpectrograph[Pet] then Ini.Spectrograph := Pet; + + // MovieSize + Tekst := IniFile.ReadString('Graphics', 'MovieSize', IMovieSize[0]); + for Pet := 0 to High(IMovieSize) do + if Tekst = IMovieSize[Pet] then Ini.MovieSize := Pet; + + // MicBoost + Tekst := IniFile.ReadString('Sound', 'MicBoost', 'Off'); + for Pet := 0 to High(IMicBoost) do + if Tekst = IMicBoost[Pet] then Ini.MicBoost := Pet; + + // ClickAssist + Tekst := IniFile.ReadString('Sound', 'ClickAssist', 'Off'); + for Pet := 0 to High(IClickAssist) do + if Tekst = IClickAssist[Pet] then Ini.ClickAssist := Pet; + + // BeatClick + Tekst := IniFile.ReadString('Sound', 'BeatClick', IBeatClick[0]); + for Pet := 0 to High(IBeatClick) do + if Tekst = IBeatClick[Pet] then Ini.BeatClick := Pet; + + // SavePlayback + Tekst := IniFile.ReadString('Sound', 'SavePlayback', ISavePlayback[0]); + for Pet := 0 to High(ISavePlayback) do + if Tekst = ISavePlayback[Pet] then Ini.SavePlayback := Pet; + + // Threshold + Tekst := IniFile.ReadString('Sound', 'Threshold', IThreshold[2]); + for Pet := 0 to High(IThreshold) do + if Tekst = IThreshold[Pet] then Ini.Threshold := Pet; + + {// Two Player Mode + for I := 0 to 7 do begin + Ini.SoundCard[I, 1] := 2*I + 1; + Ini.SoundCard[I, 2] := 2*I + 2; + end; + + Tekst := IniFile.ReadString('Sound', 'TwoPlayerMode', ITwoPlayerMode[0]); + for Pet := 0 to High(ITwoPlayerMode) do + if Tekst = ITwoPlayerMode[Pet] then Ini.TwoPlayerMode := Pet; + + if Ini.TwoPlayerMode = 1 then begin + Ini.SoundCard[0, 1] := 1; + Ini.SoundCard[0, 2] := 3; + Ini.SoundCard[1, 1] := 2; + end;} + + // Lyrics Font + Tekst := IniFile.ReadString('Lyrics', 'LyricsFont', ILyricsFont[1]); + for Pet := 0 to High(ILyricsFont) do + if Tekst = ILyricsFont[Pet] then Ini.LyricsFont := Pet; + + // Lyrics Effect + Tekst := IniFile.ReadString('Lyrics', 'LyricsEffect', ILyricsEffect[1]); + for Pet := 0 to High(ILyricsEffect) do + if Tekst = ILyricsEffect[Pet] then Ini.LyricsEffect := Pet; + + // Solmization + Tekst := IniFile.ReadString('Lyrics', 'Solmization', ISolmization[0]); + for Pet := 0 to High(ISolmization) do + if Tekst = ISolmization[Pet] then Ini.Solmization := Pet; + + // Theme + {SetLength(ITheme, 0); + if FileExists('Themes\Singstar.ini') then begin + SetLength(ITheme, Length(ITheme)+1); + ITheme[High(ITheme)] := 'Singstar'; + end; { + if FileExists('Themes\Karin.ini') then begin + SetLength(ITheme, Length(ITheme)+1); + ITheme[High(ITheme)] := 'Karin'; + end;} + + //Theme List Patch + SetLength(ITheme, 0); + FindFirst('Themes\*.ini',faAnyFile,SR); + Repeat + ThemeIni := TMemIniFile.Create(SR.Name); + Tekst := UpperCase(ThemeIni.ReadString('Theme','Name',GetFileName(SR.Name))); + ThemeIni.Free; + for Pet := low(Skin.Skin) to high(Skin.Skin) do + begin + if UpperCase(Skin.Skin[Pet].Theme) = Tekst then + begin + SetLength(ITheme, Length(ITheme)+1); + ITheme[High(ITheme)] := GetFileName(SR.Name); + break; + end; + end; + Until FindNext(SR) <> 0; + FindClose(SR); + //Theme List Patch End } + + //No Theme Found + if (Length(ITheme)=0) then + begin + Log.LogError('Could not find any valid Themes.'); + Halt; + end; + + + Tekst := IniFile.ReadString('Themes', 'Theme', ITheme[0]); + Ini.Theme := 0; + for Pet := 0 to High(ITheme) do + if Uppercase(Tekst) = Uppercase(ITheme[Pet]) then Ini.Theme := Pet; + + // Skin + Skin.onThemeChange; + Ini.SkinNo := 0; + + Tekst := IniFile.ReadString('Themes', 'Skin', ISkin[0]); + for Pet := 0 to High(ISkin) do + if Tekst = ISkin[Pet] then Ini.SkinNo := Pet; + + // Color + Tekst := IniFile.ReadString('Themes', 'Color', IColor[0]); + for Pet := 0 to High(IColor) do + if Tekst = IColor[Pet] then Ini.Color := Pet; + + // Record - load ini list + SetLength(CardList, 0); + I := 1; + while (IniFile.ValueExists('Record', 'DeviceName' + IntToStr(I)) = true) do begin + //Automatically Delete not Existing Sound Cards + S := IniFile.ReadString('Record', 'DeviceName' + IntToStr(I), ''); + //{ + B := False; + //Look for Soundcard + for I2 := 0 to High(Recording.SoundCard) do + begin + if (S = Trim(Recording.SoundCard[I2].Description)) then + begin + B := True; + Break; + end; + end; + + if B then + begin //} + I3 := Length(CardList); + SetLength(CardList, I3+1); + Ini.CardList[I3].Name := S; + Ini.CardList[I3].Input := IniFile.ReadInteger('Record', 'Input' + IntToStr(I), 0); + Ini.CardList[I3].ChannelL := IniFile.ReadInteger('Record', 'ChannelL' + IntToStr(I), 0); + Ini.CardList[I3].ChannelR := IniFile.ReadInteger('Record', 'ChannelR' + IntToStr(I), 0); + end; + Inc(I); + end; + + Log.LogError(InttoStr(Length(CardList)) + ' Cards Loaded'); + + // Record - append detected soundcards + for I := 0 to High(Recording.SoundCard) do + begin + B := False; + For I2 := 0 to High(CardList) do + begin //Search for Card in List + if (CardList[I2].Name = Trim(Recording.SoundCard[I].Description)) then + begin + B := True; + Break; + end; + end; + + //If not in List -> Add + If not B then + begin + I3 := Length(CardList); + SetLength(CardList, I3+1); + CardList[I3].Name := Trim(Recording.SoundCard[I].Description); + CardList[I3].Input := 0; + CardList[I3].ChannelL := 0; + CardList[I3].ChannelR := 0; + // default for new users + if (Length(CardList) = 1) then + CardList[I].ChannelL := 1; + end; + end; + + {for I := 0 to High(Recording.SoundCard) do begin + + B := false; + I2 := 0; + while ((B = false) and (I2 <= High(CardList))) do + if CardList[I2].Name = Recording.SoundCard[I].Description then B := true + else Inc(I2); + + // if the card wasn't detected in ini file, append it to the ini list + if B = false then begin + I3 := Length(CardList); + SetLength(CardList, I3+1); + CardList[I3].Name := Recording.SoundCard[I].Description; + CardList[I3].Input := 0; + CardList[I3].ChannelL := 0; + CardList[I3].ChannelR := 0; + if Length(CardList) = 1 then CardList[I].ChannelL := 1; // default for new users + //CardList[I].Input := 2; + end; + end; } + + Log.LogError(InttoStr(Length(CardList)) + ' Cards Detected'); + + // Joypad + Tekst := IniFile.ReadString('Controller', 'Joypad', IJoypad[0]); + for Pet := 0 to High(IJoypad) do + if Tekst = IJoypad[Pet] then Ini.Joypad := Pet; + + // SoundCard + for I := 0 to 7 do begin + Ini.SoundCard[I, 1] := IniFile.ReadInteger('SoundCards', 'SoundCard'+IntToStr(I+1)+'L', Ini.SoundCard[I, 1]); + Ini.SoundCard[I, 2] := IniFile.ReadInteger('SoundCards', 'SoundCard'+IntToStr(I+1)+'R', Ini.SoundCard[I, 2]); + end; + + // LCD + Tekst := IniFile.ReadString('Devices', 'LPT', ILPT[0]); + for Pet := 0 to High(ILPT) do + if Tekst = ILPT[Pet] then Ini.LPT := Pet; + + + // SongPath + SongPath := IncludeTrailingPathDelimiter(IniFile.ReadString('Path', 'Songs', SongPath)); + + + IniFile.Free; +end; + +procedure TIni.Save; +var + IniFile: TIniFile; + Tekst: string; + I: Integer; + S: String; +begin + if not (FileExists(GamePath + 'config.ini') and FileIsReadOnly(GamePath + 'config.ini')) then begin + IniFile := TIniFile.Create(GamePath + 'config.ini'); + + // Players + Tekst := IPlayers[Ini.Players]; + IniFile.WriteString('Game', 'Players', Tekst); + + // Difficulty + Tekst := IDifficulty[Ini.Difficulty]; + IniFile.WriteString('Game', 'Difficulty', Tekst); + + // Language + Tekst := ILanguage[Ini.Language]; + IniFile.WriteString('Game', 'Language', Tekst); + + // Tabs + Tekst := ITabs[Ini.Tabs]; + IniFile.WriteString('Game', 'Tabs', Tekst); + + // Sorting + Tekst := ISorting[Ini.Sorting]; + IniFile.WriteString('Game', 'Sorting', Tekst); + + // Debug + Tekst := IDebug[Ini.Debug]; + IniFile.WriteString('Game', 'Debug', Tekst); + + // Screens + Tekst := IScreens[Ini.Screens]; + IniFile.WriteString('Graphics', 'Screens', Tekst); + + // FullScreen + Tekst := IFullScreen[Ini.FullScreen]; + IniFile.WriteString('Graphics', 'FullScreen', Tekst); + + // Resolution + Tekst := IResolution[Ini.Resolution]; + IniFile.WriteString('Graphics', 'Resolution', Tekst); + + // Depth + Tekst := IDepth[Ini.Depth]; + IniFile.WriteString('Graphics', 'Depth', Tekst); + + // Resolution + Tekst := ITextureSize[Ini.TextureSize]; + IniFile.WriteString('Graphics', 'TextureSize', Tekst); + + // Sing Window + Tekst := ISingWindow[Ini.SingWindow]; + IniFile.WriteString('Graphics', 'SingWindow', Tekst); + + // Oscilloscope + Tekst := IOscilloscope[Ini.Oscilloscope]; + IniFile.WriteString('Graphics', 'Oscilloscope', Tekst); + + //Line Bonus + Tekst := ILineBonus[Ini.LineBonus]; + IniFile.WriteString('Graphics', 'LineBonus', Tekst); + + //GMA Fix + Tekst := IGMAFix[Ini.GMAFix]; + IniFile.WriteString('Graphics', 'GMAFix', Tekst); + + // Spectrum + Tekst := ISpectrum[Ini.Spectrum]; + IniFile.WriteString('Graphics', 'Spectrum', Tekst); + + // Spectrograph + Tekst := ISpectrograph[Ini.Spectrograph]; + IniFile.WriteString('Graphics', 'Spectrograph', Tekst); + + // Movie Size + Tekst := IMovieSize[Ini.MovieSize]; + IniFile.WriteString('Graphics', 'MovieSize', Tekst); + + // MicBoost + Tekst := IMicBoost[Ini.MicBoost]; + IniFile.WriteString('Sound', 'MicBoost', Tekst); + + // ClickAssist + Tekst := IClickAssist[Ini.ClickAssist]; + IniFile.WriteString('Sound', 'ClickAssist', Tekst); + + // BeatClick + Tekst := IBeatClick[Ini.BeatClick]; + IniFile.WriteString('Sound', 'BeatClick', Tekst); + + // Threshold + Tekst := IThreshold[Ini.Threshold]; + IniFile.WriteString('Sound', 'Threshold', Tekst); + + // SavePlayback + Tekst := ISavePlayback[Ini.SavePlayback]; + IniFile.WriteString('Sound', 'SavePlayback', Tekst); + + {// Two Player Mode + Tekst := ITwoPlayerMode[Ini.TwoPlayerMode]; + IniFile.WriteString('Sound', 'TwoPlayerMode', Tekst); } + + // Lyrics Font + Tekst := ILyricsFont[Ini.LyricsFont]; + IniFile.WriteString('Lyrics', 'LyricsFont', Tekst); + + // Lyrics Effect + Tekst := ILyricsEffect[Ini.LyricsEffect]; + IniFile.WriteString('Lyrics', 'LyricsEffect', Tekst); + + // Solmization + Tekst := ISolmization[Ini.Solmization]; + IniFile.WriteString('Lyrics', 'Solmization', Tekst); + + // Theme + Tekst := ITheme[Ini.Theme]; + IniFile.WriteString('Themes', 'Theme', Tekst); + + // Skin + Tekst := ISkin[Ini.SkinNo]; + IniFile.WriteString('Themes', 'Skin', Tekst); + + // Color + Tekst := IColor[Ini.Color]; + IniFile.WriteString('Themes', 'Color', Tekst); + + // Record + for I := 0 to High(CardList) do begin + S := IntToStr(I+1); + + Tekst := CardList[I].Name; + IniFile.WriteString('Record', 'DeviceName' + S, Tekst); + + Tekst := IntToStr(CardList[I].Input); + IniFile.WriteString('Record', 'Input' + S, Tekst); + + Tekst := IntToStr(CardList[I].ChannelL); + IniFile.WriteString('Record', 'ChannelL' + S, Tekst); + + Tekst := IntToStr(CardList[I].ChannelR); + IniFile.WriteString('Record', 'ChannelR' + S, Tekst); + end; + + Log.LogError(InttoStr(Length(CardList)) + ' Cards Saved'); + + // Joypad + Tekst := IJoypad[Ini.Joypad]; + IniFile.WriteString('Controller', 'Joypad', Tekst); + + IniFile.Free; + end; +end; + +procedure TIni.SaveNames; +var + IniFile: TIniFile; + I: integer; +begin + if not FileIsReadOnly(GamePath + 'config.ini') then begin + IniFile := TIniFile.Create(GamePath + 'config.ini'); + + //Name + for I := 1 to 6 do + IniFile.WriteString('Name', 'P' + IntToStr(I), Ini.Name[I-1]); + + IniFile.Free; + end; +end; + +procedure TIni.SaveLevel; +var + IniFile: TIniFile; + I: integer; +begin + if not FileIsReadOnly(GamePath + 'config.ini') then begin + IniFile := TIniFile.Create(GamePath + 'config.ini'); + + // Difficulty + IniFile.WriteString('Game', 'Difficulty', IDifficulty[Ini.Difficulty]); + + IniFile.Free; + end; +end; + +end. \ No newline at end of file diff --git a/Game/Code/Classes/UJoystick.dcu b/Game/Code/Classes/UJoystick.dcu new file mode 100644 index 00000000..62cde484 Binary files /dev/null and b/Game/Code/Classes/UJoystick.dcu differ diff --git a/Game/Code/Classes/UJoystick.pas b/Game/Code/Classes/UJoystick.pas new file mode 100644 index 00000000..a2a06307 --- /dev/null +++ b/Game/Code/Classes/UJoystick.pas @@ -0,0 +1,124 @@ +unit UJoystick; + +interface + +uses SDL; + +type + TJoyButton = record + State: integer; + Enabled: boolean; + Type_: byte; + Sym: cardinal; + end; + + TJoyUnit = record + Button: array[0..15] of TJoyButton; + end; + + TJoy = class + constructor Create; + procedure Update; + end; + +var + Joy: TJoy; + JoyUnit: TJoyUnit; + SDL_Joy: PSDL_Joystick; + JoyEvent: TSDL_Event; + +implementation + +uses SysUtils; + +constructor TJoy.Create; +var + B, N: integer; +begin + //Old Corvus5 Method + {// joystick support + SDL_JoystickEventState(SDL_IGNORE); + SDL_InitSubSystem(SDL_INIT_JOYSTICK); + if SDL_NumJoysticks <> 1 then beep; + + SDL_Joy := SDL_JoystickOpen(0); + if SDL_Joy = nil then beep; + + if SDL_JoystickNumButtons(SDL_Joy) <> 16 then beep; + +// SDL_JoystickEventState(SDL_ENABLE); + // Events don't work - thay hang the whole application with SDL_JoystickEventState(SDL_ENABLE) + + // clear states + for B := 0 to 15 do + JoyUnit.Button[B].State := 1; + + // mapping + JoyUnit.Button[1].Enabled := true; + JoyUnit.Button[1].Type_ := SDL_KEYDOWN; + JoyUnit.Button[1].Sym := SDLK_RETURN; + JoyUnit.Button[2].Enabled := true; + JoyUnit.Button[2].Type_ := SDL_KEYDOWN; + JoyUnit.Button[2].Sym := SDLK_ESCAPE; + + JoyUnit.Button[12].Enabled := true; + JoyUnit.Button[12].Type_ := SDL_KEYDOWN; + JoyUnit.Button[12].Sym := SDLK_LEFT; + JoyUnit.Button[13].Enabled := true; + JoyUnit.Button[13].Type_ := SDL_KEYDOWN; + JoyUnit.Button[13].Sym := SDLK_DOWN; + JoyUnit.Button[14].Enabled := true; + JoyUnit.Button[14].Type_ := SDL_KEYDOWN; + JoyUnit.Button[14].Sym := SDLK_RIGHT; + JoyUnit.Button[15].Enabled := true; + JoyUnit.Button[15].Type_ := SDL_KEYDOWN; + JoyUnit.Button[15].Sym := SDLK_UP; + } + //New Sarutas method + SDL_JoystickEventState(SDL_IGNORE); + SDL_InitSubSystem(SDL_INIT_JOYSTICK); + if SDL_NumJoysticks < 1 then beep; + + SDL_Joy := SDL_JoystickOpen(0); + if SDL_Joy = nil then beep; + + N := SDL_JoystickNumButtons(SDL_Joy); + if N < 6 then beep; + + for B := 0 to 5 do begin + JoyUnit.Button[B].Enabled := true; + JoyUnit.Button[B].State := 1; + JoyUnit.Button[B].Type_ := SDL_KEYDOWN; + end; + + JoyUnit.Button[0].Sym := SDLK_UP; + JoyUnit.Button[1].Sym := SDLK_RIGHT; + JoyUnit.Button[2].Sym := SDLK_DOWN; + JoyUnit.Button[3].Sym := SDLK_LEFT; + + JoyUnit.Button[4].Sym := SDLK_RETURN; + JoyUnit.Button[5].Sym := SDLK_ESCAPE; +end; + +procedure TJoy.Update; +var + B: integer; +begin + SDL_JoystickUpdate; + + for B := 0 to 15 do begin + if (JoyUnit.Button[B].Enabled) and (JoyUnit.Button[B].State <> SDL_JoystickGetButton(SDL_Joy, B)) and (JoyUnit.Button[B].State = 0) then begin + JoyEvent.type_ := JoyUnit.Button[B].Type_; + JoyEvent.key.keysym.sym := JoyUnit.Button[B].Sym; + SDL_PushEvent(@JoyEvent); + end; + end; + + + for B := 0 to 15 do begin + JoyUnit.Button[B].State := SDL_JoystickGetButton(SDL_Joy, B); + end; + +end; + +end. diff --git a/Game/Code/Classes/ULCD.dcu b/Game/Code/Classes/ULCD.dcu new file mode 100644 index 00000000..8098a187 Binary files /dev/null and b/Game/Code/Classes/ULCD.dcu differ diff --git a/Game/Code/Classes/ULCD.pas b/Game/Code/Classes/ULCD.pas new file mode 100644 index 00000000..a127c689 --- /dev/null +++ b/Game/Code/Classes/ULCD.pas @@ -0,0 +1,287 @@ +unit ULCD; + +interface + +type + TLCD = class + private + Enabled: boolean; + Text: array[1..6] of string; + StartPos: integer; + LineBR: integer; + Position: integer; + procedure WriteCommand(B: byte); + procedure WriteData(B: byte); + procedure WriteString(S: string); + public + HalfInterface: boolean; + constructor Create; + procedure Enable; + procedure Clear; + procedure WriteText(Line: integer; S: string); + procedure MoveCursor(Line, Pos: integer); + procedure ShowCursor; + procedure HideCursor; + + // for 2x16 + procedure AddTextBR(S: string); + procedure MoveCursorBR(Pos: integer); + procedure ScrollUpBR; + procedure AddTextArray(Line:integer; S: string); + end; + +var + LCD: TLCD; + +const + Data = $378; // domyœlny adres portu + Status = Data + 1; + Control = Data + 2; + +implementation + +uses + SysUtils, zlportio, UTime; + +procedure TLCD.WriteCommand(B: Byte); +// Wysylanie komend sterujacych +begin + if not HalfInterface then begin + zlioportwrite(Control, 0, $02); + zlioportwrite(Data, 0, B); + zlioportwrite(Control, 0, $03); + end else begin + zlioportwrite(Control, 0, $02); + zlioportwrite(Data, 0, B and $F0); + zlioportwrite(Control, 0, $03); + + TimeSleep(0.1); + + zlioportwrite(Control, 0, $02); + zlioportwrite(Data, 0, (B * 16) and $F0); + zlioportwrite(Control, 0, $03); + end; + + if (B=1) or (B=2) then + Sleep(2) + else + TimeSleep(0.1); +end; + +procedure TLCD.WriteData(B: Byte); +// Wysylanie danych +begin + if not HalfInterface then begin + zlioportwrite(Control, 0, $06); + zlioportwrite(Data, 0, B); + zlioportwrite(Control, 0, $07); + end else begin + zlioportwrite(Control, 0, $06); + zlioportwrite(Data, 0, B and $F0); + zlioportwrite(Control, 0, $07); + + TimeSleep(0.1); + + zlioportwrite(Control, 0, $06); + zlioportwrite(Data, 0, (B * 16) and $F0); + zlioportwrite(Control, 0, $07); + end; + + TimeSleep(0.1); + Inc(Position); +end; + +procedure TLCD.WriteString(S: string); +// Wysylanie slow +var + I: integer; +begin + for I := 1 to Length(S) do + WriteData(Ord(S[I])); +end; + +constructor TLCD.Create; +begin +// +end; + +procedure TLCD.Enable; +var + A: byte; + B: byte; +begin + Enabled := true; + if not HalfInterface then + WriteCommand($38) + else begin + WriteCommand($33); + WriteCommand($32); + WriteCommand($28); + end; + +// WriteCommand($06); +// WriteCommand($0C); +// sleep(10); +end; + +procedure TLCD.Clear; +begin + if Enabled then begin + WriteCommand(1); + WriteCommand(2); + Text[1] := ''; + Text[2] := ''; + Text[3] := ''; + Text[4] := ''; + Text[5] := ''; + Text[6] := ''; + StartPos := 1; + LineBR := 1; + end; +end; + +procedure TLCD.WriteText(Line: integer; S: string); +begin + if Enabled then begin + if Line <= 2 then begin + MoveCursor(Line, 1); + WriteString(S); + end; + + Text[Line] := ''; + AddTextArray(Line, S); + end; +end; + +procedure TLCD.MoveCursor(Line, Pos: integer); +var + I: integer; +begin + if Enabled then begin + Pos := Pos + (Line-1) * 40; + + if Position > Pos then begin + WriteCommand(2); + for I := 1 to Pos-1 do + WriteCommand(20); + end; + + if Position < Pos then + for I := 1 to Pos - Position do + WriteCommand(20); + + Position := Pos; + end; +end; + +procedure TLCD.ShowCursor; +begin + if Enabled then begin + WriteCommand(14); + end; +end; + +procedure TLCD.HideCursor; +begin + if Enabled then begin + WriteCommand(12); + end; +end; + +procedure TLCD.AddTextBR(S: string); +var + Word: string; + W: integer; + P: integer; + L: integer; +begin + if Enabled then begin + if LineBR <= 6 then begin + L := LineBR; + P := Pos(' ', S); + + if L <= 2 then + MoveCursor(L, 1); + + while (L <= 6) and (P > 0) do begin + Word := Copy(S, 1, P); + if (Length(Text[L]) + Length(Word)-1) > 16 then begin + L := L + 1; + if L <= 2 then + MoveCursor(L, 1); + end; + + if L <= 6 then begin + if L <= 2 then + WriteString(Word); + AddTextArray(L, Word); + end; + + Delete(S, 1, P); + P := Pos(' ', S) + end; + + LineBR := L + 1; + end; + end; +end; + +procedure TLCD.MoveCursorBR(Pos: integer); +var + I: integer; + L: integer; +begin + if Enabled then begin + Pos := Pos - (StartPos-1); + if Pos <= Length(Text[1]) then + MoveCursor(1, Pos); + + if Pos > Length(Text[1]) then begin + // bez zawijania +// Pos := Pos - Length(Text[1]); +// MoveCursor(2, Pos); + + // z zawijaniem + Pos := Pos - Length(Text[1]); + ScrollUpBR; + MoveCursor(1, Pos); + end; + end; +end; + +procedure TLCD.ScrollUpBR; +var + T: array[1..5] of string; + SP: integer; + LBR: integer; +begin + if Enabled then begin + T[1] := Text[2]; + T[2] := Text[3]; + T[3] := Text[4]; + T[4] := Text[5]; + T[5] := Text[6]; + SP := StartPos + Length(Text[1]); + LBR := LineBR; + + Clear; + + StartPos := SP; + WriteText(1, T[1]); + WriteText(2, T[2]); + WriteText(3, T[3]); + WriteText(4, T[4]); + WriteText(5, T[5]); + LineBR := LBR-1; + end; +end; + +procedure TLCD.AddTextArray(Line: integer; S: string); +begin + if Enabled then begin + Text[Line] := Text[Line] + S; + end; +end; + +end. + diff --git a/Game/Code/Classes/ULCD.~pas b/Game/Code/Classes/ULCD.~pas new file mode 100644 index 00000000..a127c689 --- /dev/null +++ b/Game/Code/Classes/ULCD.~pas @@ -0,0 +1,287 @@ +unit ULCD; + +interface + +type + TLCD = class + private + Enabled: boolean; + Text: array[1..6] of string; + StartPos: integer; + LineBR: integer; + Position: integer; + procedure WriteCommand(B: byte); + procedure WriteData(B: byte); + procedure WriteString(S: string); + public + HalfInterface: boolean; + constructor Create; + procedure Enable; + procedure Clear; + procedure WriteText(Line: integer; S: string); + procedure MoveCursor(Line, Pos: integer); + procedure ShowCursor; + procedure HideCursor; + + // for 2x16 + procedure AddTextBR(S: string); + procedure MoveCursorBR(Pos: integer); + procedure ScrollUpBR; + procedure AddTextArray(Line:integer; S: string); + end; + +var + LCD: TLCD; + +const + Data = $378; // domyœlny adres portu + Status = Data + 1; + Control = Data + 2; + +implementation + +uses + SysUtils, zlportio, UTime; + +procedure TLCD.WriteCommand(B: Byte); +// Wysylanie komend sterujacych +begin + if not HalfInterface then begin + zlioportwrite(Control, 0, $02); + zlioportwrite(Data, 0, B); + zlioportwrite(Control, 0, $03); + end else begin + zlioportwrite(Control, 0, $02); + zlioportwrite(Data, 0, B and $F0); + zlioportwrite(Control, 0, $03); + + TimeSleep(0.1); + + zlioportwrite(Control, 0, $02); + zlioportwrite(Data, 0, (B * 16) and $F0); + zlioportwrite(Control, 0, $03); + end; + + if (B=1) or (B=2) then + Sleep(2) + else + TimeSleep(0.1); +end; + +procedure TLCD.WriteData(B: Byte); +// Wysylanie danych +begin + if not HalfInterface then begin + zlioportwrite(Control, 0, $06); + zlioportwrite(Data, 0, B); + zlioportwrite(Control, 0, $07); + end else begin + zlioportwrite(Control, 0, $06); + zlioportwrite(Data, 0, B and $F0); + zlioportwrite(Control, 0, $07); + + TimeSleep(0.1); + + zlioportwrite(Control, 0, $06); + zlioportwrite(Data, 0, (B * 16) and $F0); + zlioportwrite(Control, 0, $07); + end; + + TimeSleep(0.1); + Inc(Position); +end; + +procedure TLCD.WriteString(S: string); +// Wysylanie slow +var + I: integer; +begin + for I := 1 to Length(S) do + WriteData(Ord(S[I])); +end; + +constructor TLCD.Create; +begin +// +end; + +procedure TLCD.Enable; +var + A: byte; + B: byte; +begin + Enabled := true; + if not HalfInterface then + WriteCommand($38) + else begin + WriteCommand($33); + WriteCommand($32); + WriteCommand($28); + end; + +// WriteCommand($06); +// WriteCommand($0C); +// sleep(10); +end; + +procedure TLCD.Clear; +begin + if Enabled then begin + WriteCommand(1); + WriteCommand(2); + Text[1] := ''; + Text[2] := ''; + Text[3] := ''; + Text[4] := ''; + Text[5] := ''; + Text[6] := ''; + StartPos := 1; + LineBR := 1; + end; +end; + +procedure TLCD.WriteText(Line: integer; S: string); +begin + if Enabled then begin + if Line <= 2 then begin + MoveCursor(Line, 1); + WriteString(S); + end; + + Text[Line] := ''; + AddTextArray(Line, S); + end; +end; + +procedure TLCD.MoveCursor(Line, Pos: integer); +var + I: integer; +begin + if Enabled then begin + Pos := Pos + (Line-1) * 40; + + if Position > Pos then begin + WriteCommand(2); + for I := 1 to Pos-1 do + WriteCommand(20); + end; + + if Position < Pos then + for I := 1 to Pos - Position do + WriteCommand(20); + + Position := Pos; + end; +end; + +procedure TLCD.ShowCursor; +begin + if Enabled then begin + WriteCommand(14); + end; +end; + +procedure TLCD.HideCursor; +begin + if Enabled then begin + WriteCommand(12); + end; +end; + +procedure TLCD.AddTextBR(S: string); +var + Word: string; + W: integer; + P: integer; + L: integer; +begin + if Enabled then begin + if LineBR <= 6 then begin + L := LineBR; + P := Pos(' ', S); + + if L <= 2 then + MoveCursor(L, 1); + + while (L <= 6) and (P > 0) do begin + Word := Copy(S, 1, P); + if (Length(Text[L]) + Length(Word)-1) > 16 then begin + L := L + 1; + if L <= 2 then + MoveCursor(L, 1); + end; + + if L <= 6 then begin + if L <= 2 then + WriteString(Word); + AddTextArray(L, Word); + end; + + Delete(S, 1, P); + P := Pos(' ', S) + end; + + LineBR := L + 1; + end; + end; +end; + +procedure TLCD.MoveCursorBR(Pos: integer); +var + I: integer; + L: integer; +begin + if Enabled then begin + Pos := Pos - (StartPos-1); + if Pos <= Length(Text[1]) then + MoveCursor(1, Pos); + + if Pos > Length(Text[1]) then begin + // bez zawijania +// Pos := Pos - Length(Text[1]); +// MoveCursor(2, Pos); + + // z zawijaniem + Pos := Pos - Length(Text[1]); + ScrollUpBR; + MoveCursor(1, Pos); + end; + end; +end; + +procedure TLCD.ScrollUpBR; +var + T: array[1..5] of string; + SP: integer; + LBR: integer; +begin + if Enabled then begin + T[1] := Text[2]; + T[2] := Text[3]; + T[3] := Text[4]; + T[4] := Text[5]; + T[5] := Text[6]; + SP := StartPos + Length(Text[1]); + LBR := LineBR; + + Clear; + + StartPos := SP; + WriteText(1, T[1]); + WriteText(2, T[2]); + WriteText(3, T[3]); + WriteText(4, T[4]); + WriteText(5, T[5]); + LineBR := LBR-1; + end; +end; + +procedure TLCD.AddTextArray(Line: integer; S: string); +begin + if Enabled then begin + Text[Line] := Text[Line] + S; + end; +end; + +end. + diff --git a/Game/Code/Classes/ULanguage.dcu b/Game/Code/Classes/ULanguage.dcu new file mode 100644 index 00000000..2d5c3596 Binary files /dev/null and b/Game/Code/Classes/ULanguage.dcu differ diff --git a/Game/Code/Classes/ULanguage.pas b/Game/Code/Classes/ULanguage.pas new file mode 100644 index 00000000..bc3793e3 --- /dev/null +++ b/Game/Code/Classes/ULanguage.pas @@ -0,0 +1,222 @@ +unit ULanguage; + +interface + +type + TLanguageEntry = record + ID: string; + Text: string; + end; + + TLanguageList = record + Name: string; + {FileName: string; } + end; + + TLanguage = class + private + Entry: array of TLanguageEntry; //Entrys of Chosen Language + SEntry: array of TLanguageEntry; //Entrys of Standard Language + CEntry: array of TLanguageEntry; //Constant Entrys e.g. Version + Implode_Glue1, Implode_Glue2: String; + public + List: array of TLanguageList; + + constructor Create; + procedure LoadList; + function Translate(Text: String): String; + procedure ChangeLanguage(Language: String); + procedure AddConst(ID, Text: String); + procedure ChangeConst(ID, Text: String); + function Implode(Pieces: Array of String): String; + end; + +var + Language: TLanguage; + +implementation + +uses UPliki, UIni, IniFiles, Classes, SysUtils, Windows, ULog; + +//---------- +//Create - Construct Class then LoadList + Standard Language + Set Standard Implode Glues +//---------- +constructor TLanguage.Create; +var + I, J: Integer; +begin + LoadList; + + //Set Implode Glues for Backward Compatibility + Implode_Glue1 := ', '; + Implode_Glue2 := ' and '; + + if (Length(List) = 0) then //No Language Files Loaded -> Abort Loading + Log.CriticalError('Could not load any Language Files'); + + //Standard Language (If a Language File is Incomplete) + //Then use English Language + for I := 0 to high(List) do //Search for English Language + begin + //English Language Found -> Load + if Uppercase(List[I].Name) = 'ENGLISH' then + begin + ChangeLanguage('English'); + + SetLength(SEntry, Length(Entry)); + for J := low(Entry) to high(Entry) do + SEntry[J] := Entry[J]; + + SetLength(Entry, 0); + end; + + if (I = high(List)) then + Log.LogError('English Languagefile missing! No standard Translation loaded'); + end; + //Standard Language END + +end; + +//---------- +//LoadList - Parse the Language Dir searching Translations +//---------- +procedure TLanguage.LoadList; +var + SR: TSearchRec; // for parsing directory +begin + SetLength(List, 0); + SetLength(ILanguage, 0); + + if FindFirst(LanguagesPath + '*.ini', 0, SR) = 0 then begin + repeat + SetLength(List, Length(List)+1); + SetLength(ILanguage, Length(ILanguage)+1); + SR.Name := ChangeFileExt(SR.Name, ''); + + List[High(List)].Name := SR.Name; + ILanguage[High(ILanguage)] := SR.Name; + + until FindNext(SR) <> 0; + SysUtils.FindClose(SR); + end; // if FindFirst +end; + +//---------- +//ChangeLanguage - Load the specified LanguageFile +//---------- +procedure TLanguage.ChangeLanguage(Language: String); +var + IniFile: TIniFile; + E: integer; // entry + S: TStringList; +begin + SetLength(Entry, 0); + IniFile := TIniFile.Create(LanguagesPath + Language + '.ini'); + S := TStringList.Create; + + IniFile.ReadSectionValues('Text', S); + SetLength(Entry, S.Count); + for E := 0 to high(Entry) do + begin + if S.Names[E] = 'IMPLODE_GLUE1' then + Implode_Glue1 := S.ValueFromIndex[E]+ ' ' + else if S.Names[E] = 'IMPLODE_GLUE2' then + Implode_Glue2 := ' ' + S.ValueFromIndex[E] + ' '; + + Entry[E].ID := S.Names[E]; + Entry[E].Text := S.ValueFromIndex[E]; + end; + + S.Free; + IniFile.Free; +end; + +//---------- +//Translate - Translate the Text +//---------- +Function TLanguage.Translate(Text: String): String; +var + E: integer; // entry +begin + Result := Text; + + //Const Mod + for E := 0 to high(CEntry) do + if Text = CEntry[E].ID then + begin + Result := CEntry[E].Text; + exit; + end; + //Const Mod End + + for E := 0 to high(Entry) do + if Text = Entry[E].ID then + begin + Result := Entry[E].Text; + exit; + end; + + //Standard Language (If a Language File is Incomplete) + //Then use Standard Language + if Text = Result then + begin + for E := low(SEntry) to high(SEntry) do + if Text = SEntry[E].ID then + begin + Result := SEntry[E].Text; + exit; + end; + end; + //Standard Language END +end; + +//---------- +//AddConst - Add a Constant ID that will be Translated but not Loaded from the LanguageFile +//---------- +procedure TLanguage.AddConst (ID, Text: String); +begin + SetLength (CEntry, Length(CEntry) + 1); + CEntry[high(CEntry)].ID := ID; + CEntry[high(CEntry)].Text := Text; +end; + +//---------- +//ChangeConst - Change a Constant Value by ID +//---------- +procedure TLanguage.ChangeConst(ID, Text: String); +var + I: Integer; +begin + for I := 0 to high(CEntry) do + begin + if CEntry[I].ID = ID then + begin + CEntry[I].Text := Text; + Break; + end; + end; +end; + +//---------- +//Implode - Connect an Array of Strings with ' and ' or ', ' to one String +//---------- +function TLanguage.Implode(Pieces: Array of String): String; +var + I: Integer; +begin + Result := ''; + //Go through Pieces + for I := low(Pieces) to high(Pieces) do + begin + //Add Value + Result := Result + Pieces[I]; + + //Add Glue + if (I < high(Pieces) - 1) then + Result := Result + Implode_Glue1 + else if (I < high(Pieces)) then + Result := Result + Implode_Glue2; + end; +end; + +end. diff --git a/Game/Code/Classes/ULight.dcu b/Game/Code/Classes/ULight.dcu new file mode 100644 index 00000000..10ba61bc Binary files /dev/null and b/Game/Code/Classes/ULight.dcu differ diff --git a/Game/Code/Classes/ULight.pas b/Game/Code/Classes/ULight.pas new file mode 100644 index 00000000..967d2ea1 --- /dev/null +++ b/Game/Code/Classes/ULight.pas @@ -0,0 +1,116 @@ +unit ULight; +interface + +type + TLight = class + private + Enabled: boolean; + Light: array[0..7] of boolean; + LightTime: array[0..7] of real; // time to stop, need to call update to change state + LastTime: real; + public + constructor Create; + procedure Enable; + procedure SetState(State: integer); + procedure AutoSetState; + procedure TurnOn; + procedure TurnOff; + procedure LightOne(Number: integer; Time: real); + procedure Refresh; + end; + +var + Light: TLight; + +const + Data = $378; // default port address + Status = Data + 1; + Control = Data + 2; + +implementation + +uses + SysUtils, zlportio, UTime; + +constructor TLight.Create; +begin + Enabled := false; +end; + +procedure TLight.Enable; +begin + Enabled := true; + LastTime := GetTime; +end; + +procedure TLight.SetState(State: integer); +begin + if Enabled then + PortWriteB($378, State); +end; + +procedure TLight.AutoSetState; +var + State: integer; +begin + if Enabled then begin + State := 0; + if Light[0] then State := State + 2; + if Light[1] then State := State + 1; + // etc + SetState(State); + end; +end; + +procedure TLight.TurnOn; +begin + if Enabled then + SetState(3); +end; + +procedure TLight.TurnOff; +begin + if Enabled then + SetState(0); +end; + +procedure TLight.LightOne(Number: integer; Time: real); +begin + if Enabled then begin + if Light[Number] = false then begin + Light[Number] := true; + AutoSetState; + end; + + LightTime[Number] := GetTime + Time/1000; // [s] + end; +end; + +procedure TLight.Refresh; +var + Time: real; + TimeSkip: real; + L: integer; +begin + if Enabled then begin + Time := GetTime; + TimeSkip := Time - LastTime; + for L := 0 to 7 do begin + if Light[L] = true then begin + if LightTime[L] > Time then begin + // jest jeszcze zapas - bez zmian + //LightTime[L] := LightTime[L] - TimeSkip; + end else begin + // czas minal + Light[L] := false; + end; + end; + end; + LastTime := Time; + AutoSetState; + end; +end; + +end. + + diff --git a/Game/Code/Classes/ULog.dcu b/Game/Code/Classes/ULog.dcu new file mode 100644 index 00000000..1794325d Binary files /dev/null and b/Game/Code/Classes/ULog.dcu differ diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas new file mode 100644 index 00000000..6bffa04e --- /dev/null +++ b/Game/Code/Classes/ULog.pas @@ -0,0 +1,227 @@ +unit ULog; + +interface + +uses Classes; + +type + TLog = class + BenchmarkTimeStart: array[0..7] of real; + BenchmarkTimeLength: array[0..7] of real;//TDateTime; + + FileBenchmark: TextFile; + FileBenchmarkO: boolean; // opened + FileAnalyze: TextFile; + FileAnalyzeO: boolean; // opened + FileError: TextFile; + FileErrorO: boolean; // opened + + Title: String; //Application Title + + // destuctor + destructor Free; + + // benchmark + procedure BenchmarkStart(Number: integer); + procedure BenchmarkEnd(Number: integer); + procedure LogBenchmark(Text: string; Number: integer); + + // analyze + procedure LogAnalyze(Text: string); + + // error + procedure LogError(Text: string); overload; + + //Critical Error (Halt + MessageBox) + procedure CriticalError(Text: string); + + // voice + procedure LogVoice(SoundNr: integer); + + // compability + procedure LogStatus(Log1, Log2: string); + procedure LogError(Log1, Log2: string); overload; + end; + +var + Log: TLog; + +implementation +uses UPliki, SysUtils, DateUtils, URecord, UTime, UIni, Windows; + +destructor TLog.Free; +begin + if FileBenchmarkO then CloseFile(FileBenchmark); +// if FileAnalyzeO then CloseFile(FileAnalyze); + if FileErrorO then CloseFile(FileError); +end; + +procedure TLog.BenchmarkStart(Number: integer); +begin + BenchmarkTimeStart[Number] := USTime.GetTime; //Time; +end; + +procedure TLog.BenchmarkEnd(Number: integer); +begin + BenchmarkTimeLength[Number] := USTime.GetTime {Time} - BenchmarkTimeStart[Number]; +end; + +procedure TLog.LogBenchmark(Text: string; Number: integer); +var + Minutes: integer; + Seconds: integer; + Miliseconds: integer; + + MinutesS: string; + SecondsS: string; + MilisecondsS: string; + + ValueText: string; +begin + if (ParamStr(1) = '-benchmark') then begin + if not FileBenchmarkO then begin + FileBenchmarkO := true; + AssignFile(FileBenchmark, LogPath + 'Benchmark.log'); + {$I-} + Rewrite(FileBenchmark); + if IOResult = 0 then FileBenchmarkO := true; + {$I+} + end; + + if FileBenchmarkO then begin + Miliseconds := Trunc(Frac(BenchmarkTimeLength[Number]) * 1000); + Seconds := Trunc(BenchmarkTimeLength[Number]) mod 60; + Minutes := Trunc((BenchmarkTimeLength[Number] - Seconds) / 60); +// ValueText := FloatToStr(BenchmarkTimeLength[Number]); + +{ ValueText := FloatToStr( + SecondOf(BenchmarkTimeLength[Number]) + MilliSecondOf(BenchmarkTimeLength[Number])/1000 + ); + if MinuteOf(BenchmarkTimeLength[Number]) >= 1 then + ValueText := IntToStr(MinuteOf(BenchmarkTimeLength[Number])) + ':' + ValueText; + WriteLn(FileBenchmark, Text + ': ' + ValueText + ' seconds');} + + if (Minutes = 0) and (Seconds = 0) then begin + MilisecondsS := IntToStr(Miliseconds); + ValueText := MilisecondsS + ' miliseconds'; + end; + + if (Minutes = 0) and (Seconds >= 1) then begin + MilisecondsS := IntToStr(Miliseconds); + while Length(MilisecondsS) < 3 do MilisecondsS := '0' + MilisecondsS; + + SecondsS := IntToStr(Seconds); + + ValueText := SecondsS + ',' + MilisecondsS + ' seconds'; + end; + + if Minutes >= 1 then begin + MilisecondsS := IntToStr(Miliseconds); + while Length(MilisecondsS) < 3 do MilisecondsS := '0' + MilisecondsS; + + SecondsS := IntToStr(Seconds); + while Length(SecondsS) < 2 do SecondsS := '0' + SecondsS; + + MinutesS := IntToStr(Minutes); + + ValueText := MinutesS + ':' + SecondsS + ',' + MilisecondsS + ' minutes'; + end; + + WriteLn(FileBenchmark, Text + ': ' + ValueText); + Flush(FileBenchmark); + end; + end; +end; + +procedure TLog.LogAnalyze(Text: string); +var + Seconds: integer; + Miliseconds: integer; + ValueText: string; +begin + if Ini.Debug = 1 then begin + + if not FileAnalyzeO then begin + AssignFile(FileAnalyze, LogPath + 'Analyze.log'); + {$I-} + Rewrite(FileAnalyze); + if IOResult = 0 then FileAnalyzeO := true; + {$I+} + end; + + if FileAnalyzeO then begin + WriteLn(FileAnalyze, Text); + Flush(FileAnalyze); // try to speed up + end; + + end; +end; + +procedure TLog.LogError(Text: string); +begin + if not FileErrorO then begin + FileErrorO := true; + AssignFile(FileError, LogPath + 'Error.log'); + {$I-} + Rewrite(FileError); + if IOResult = 0 then FileErrorO := true; + {$I+} + end; + + if FileErrorO then begin + WriteLn(FileError, Text); + Flush(FileError); + end; +end; + +procedure TLog.LogVoice(SoundNr: integer); +var + FileVoice: File; + FS: TFileStream; + FileName: string; + Num: integer; + BL: integer; +begin + for Num := 1 to 9999 do begin + FileName := IntToStr(Num); + while Length(FileName) < 4 do FileName := '0' + FileName; + FileName := LogPath + 'Voice' + FileName + '.raw'; + if not FileExists(FileName) then break + end; + + + FS := TFileStream.Create(FileName, fmCreate); + + for BL := 0 to High(Sound[SoundNr].BufferLong) do begin + Sound[SoundNr].BufferLong[BL].Seek(0, soBeginning); + FS.CopyFrom(Sound[SoundNr].BufferLong[BL], Sound[SoundNr].BufferLong[BL].Size); + end; + + FS.Free; +end; + +procedure TLog.LogStatus(Log1, Log2: string); +begin +//asd + LogError (Log2 + ': ' + Log1); +end; + +procedure TLog.LogError(Log1, Log2: string); +begin +//asd +end; + +procedure TLog.CriticalError(Text: string); +begin + //Write Error to Logfile: + LogError (Text); + + //Show Errormessage + Messagebox(0, PChar(Text), PChar(Title), MB_ICONERROR or MB_OK); + + //Exit Application + Halt; +end; + +end. + \ No newline at end of file diff --git a/Game/Code/Classes/ULyrics.dcu b/Game/Code/Classes/ULyrics.dcu new file mode 100644 index 00000000..3867c263 Binary files /dev/null and b/Game/Code/Classes/ULyrics.dcu differ diff --git a/Game/Code/Classes/ULyrics.pas b/Game/Code/Classes/ULyrics.pas new file mode 100644 index 00000000..c3b440bc --- /dev/null +++ b/Game/Code/Classes/ULyrics.pas @@ -0,0 +1,383 @@ +unit ULyrics; + +interface +uses SysUtils, OpenGL12, UMusic; + +type + TWord = record + X: real; + Y: real; + Size: real; + Width: real; + Text: string; + ColR: real; + ColG: real; + ColB: real; + Scale: real; + Done: real; + FontStyle: integer; + Italic: boolean; + Selected: boolean; + end; + + TLyric = class + private + AlignI: integer; + XR: real; + YR: real; + SizeR: real; + SelectedI: integer; + ScaleR: real; + StyleI: integer; // 0 - one selection, 1 - long selection, 2 - one selection with fade to normal text, 3 - long selection with fade with color from left + FontStyleI: integer; // font number + Word: array of TWord; + procedure SetX(Value: real); + procedure SetY(Value: real); + function GetClientX: real; + procedure SetAlign(Value: integer); + function GetSize: real; + procedure SetSize(Value: real); + procedure SetSelected(Value: integer); + procedure SetDone(Value: real); + procedure SetScale(Value: real); + procedure SetStyle(Value: integer); + procedure SetFStyle(Value: integer); + procedure Refresh; + procedure DrawNormal(W: integer); + procedure DrawPlain(W: integer); + procedure DrawScaled(W: integer); + procedure DrawSlide(W: integer); + public + ColR: real; + ColG: real; + ColB: real; + ColSR: real; + ColSG: real; + ColSB: real; + Italic: boolean; + Text: string; // LCD + + published + property X: real write SetX; + property Y: real write SetY; + property ClientX: real read GetClientX; + property Align: integer write SetAlign; + property Size: real read GetSize write SetSize; + property Selected: integer read SelectedI write SetSelected; + property Done: real write SetDone; + property Scale: real write SetScale; + property Style: integer write SetStyle; + property FontStyle: integer write SetFStyle; + procedure AddWord(Text: string); + procedure AddCzesc(NrCzesci: integer); + + function SelectedLetter: integer; // LCD + function SelectedLength: integer; // LCD + + procedure Clear; + procedure Draw; + + end; + +var + Lyric: TLyric; + +implementation +uses TextGL, UGraphic, UDrawTexture; + +procedure TLyric.SetX(Value: real); +begin + XR := Value; +end; + +procedure TLyric.SetY(Value: real); +begin + YR := Value; +end; + +function TLyric.GetClientX: real; +begin + Result := Word[0].X; +end; + +procedure TLyric.SetAlign(Value: integer); +begin + AlignI := Value; +// if AlignInt = 0 then beep; +end; + +function TLyric.GetSize: real; +begin + Result := SizeR; +end; + +procedure TLyric.SetSize(Value: real); +begin + SizeR := Value; +end; + +procedure TLyric.SetSelected(Value: integer); +var + W: integer; +begin + if (StyleI = 0) or (StyleI = 2) or (StyleI = 4) then begin + if (SelectedI > -1) and (SelectedI <= High(Word)) then begin + Word[SelectedI].Selected := false; + Word[SelectedI].ColR := ColR; + Word[SelectedI].ColG := ColG; + Word[SelectedI].ColB := ColB; + Word[SelectedI].Done := 0; + end; + + SelectedI := Value; + if (Value > -1) and (Value <= High(Word)) then begin + Word[Value].Selected := true; + Word[Value].ColR := ColSR; + Word[Value].ColG := ColSG; + Word[Value].ColB := ColSB; + Word[Value].Scale := ScaleR; + end; + end; + + if (StyleI = 1) or (StyleI = 3) then begin + if (SelectedI > -1) and (SelectedI <= High(Word)) then begin + for W := SelectedI to High(Word) do begin + Word[W].Selected := false; + Word[W].ColR := ColR; + Word[W].ColG := ColG; + Word[W].ColB := ColB; + Word[W].Done := 0; + end; + end; + + SelectedI := Value; + if (Value > -1) and (Value <= High(Word)) then begin + for W := 0 to Value do begin + Word[W].Selected := true; + Word[W].ColR := ColSR; + Word[W].ColG := ColSG; + Word[W].ColB := ColSB; + Word[W].Scale := ScaleR; + Word[W].Done := 1; + end; + end; + end; + + Refresh; +end; + +procedure TLyric.SetDone(Value: real); +var + W: integer; +begin + W := SelectedI; + if W > -1 then + Word[W].Done := Value; +end; + +procedure TLyric.SetScale(Value: real); +begin + ScaleR := Value; +end; + +procedure TLyric.SetStyle(Value: integer); +begin + StyleI := Value; +end; + +procedure TLyric.SetFStyle(Value: integer); +begin + FontStyleI := Value; +end; + +procedure TLyric.AddWord(Text: string); +var + WordNum: integer; +begin + WordNum := Length(Word); + SetLength(Word, WordNum + 1); + if WordNum = 0 then begin + Word[WordNum].X := XR; + end else begin + Word[WordNum].X := Word[WordNum - 1].X + Word[WordNum - 1].Width; + end; + + Word[WordNum].Y := YR; + Word[WordNum].Size := SizeR; + Word[WordNum].FontStyle := FontStyleI; // new + SetFontStyle(FontStyleI); + SetFontSize(SizeR); + Word[WordNum].Width := glTextWidth(pchar(Text)); + Word[WordNum].Text := Text; + Word[WordNum].ColR := ColR; + Word[WordNum].ColG := ColG; + Word[WordNum].ColB := ColB; + Word[WordNum].Scale := 1; + Word[WordNum].Done := 0; + Word[WordNum].Italic := Italic; + + Refresh; +end; + +procedure TLyric.AddCzesc(NrCzesci: integer); +var + N: integer; +begin + Clear; + for N := 0 to Czesci[0].Czesc[NrCzesci].HighNut do begin + Italic := Czesci[0].Czesc[NrCzesci].Nuta[N].FreeStyle; + AddWord(Czesci[0].Czesc[NrCzesci].Nuta[N].Tekst); + Text := Text + Czesci[0].Czesc[NrCzesci].Nuta[N].Tekst; + end; + Selected := -1; +end; + +procedure TLyric.Clear; +begin +{ ColR := Skin_FontR; + ColG := Skin_FontG; + ColB := Skin_FontB;} + SetLength(Word, 0); + Text := ''; + SelectedI := -1; +end; + +procedure TLyric.Refresh; +var + W: integer; + TotWidth: real; +begin + if AlignI = 1 then begin + TotWidth := 0; + for W := 0 to High(Word) do + TotWidth := TotWidth + Word[W].Width; + + Word[0].X := XR - TotWidth / 2; + for W := 1 to High(Word) do + Word[W].X := Word[W - 1].X + Word[W - 1].Width; + end; +end; + +procedure TLyric.Draw; +var + W: integer; +begin + case StyleI of + 0: + begin + for W := 0 to High(Word) do + DrawNormal(W); + end; + 1: + begin + for W := 0 to High(Word) do + DrawPlain(W); + end; + 2: // zoom + begin + for W := 0 to High(Word) do + if not Word[W].Selected then + DrawNormal(W); + + for W := 0 to High(Word) do + if Word[W].Selected then + DrawScaled(W); + end; + 3: // slide + begin + for W := 0 to High(Word) do begin + if not Word[W].Selected then + DrawNormal(W) + else + DrawSlide(W); + end; + end; + 4: // ball + begin + for W := 0 to High(Word) do + DrawNormal(W); + + for W := 0 to High(Word) do + if Word[W].Selected then begin + Tex_Ball.X := (Word[W].X - 10) + Word[W].Done * Word[W].Width; + Tex_Ball.Y := 480 - 10*sin(Word[W].Done * pi); + Tex_Ball.W := 20; + Tex_Ball.H := 20; + DrawTexture(Tex_Ball); + end; + end; + end; // case +end; + +procedure TLyric.DrawNormal(W: integer); +begin + SetFontStyle(Word[W].FontStyle); + SetFontPos(Word[W].X+ 10*ScreenX, Word[W].Y); + SetFontSize(Word[W].Size); + SetFontItalic(Word[W].Italic); + glColor3f(Word[W].ColR, Word[W].ColG, Word[W].ColB); + glPrint(pchar(Word[W].Text)); +end; + +procedure TLyric.DrawPlain(W: integer); +var + D: real; +begin + D := Word[W].Done; // przyrost + + SetFontStyle(Word[W].FontStyle); + SetFontPos(Word[W].X, Word[W].Y); + SetFontSize(Word[W].Size); + SetFontItalic(Word[W].Italic); + + if D = 0 then + glColor3f(ColR, ColG, ColB) + else + glColor3f(ColSR, ColSG, ColSB); + + glPrint(pchar(Word[W].Text)); +end; + +procedure TLyric.DrawScaled(W: integer); +var + D: real; +begin + // previous plus dynamic scaling effect + D := 1-Word[W].Done; // przyrost + SetFontStyle(Word[W].FontStyle); + SetFontPos(Word[W].X - D * Word[W].Width * (Word[W].Scale - 1) / 2 + (D+1)*10*ScreenX, Word[W].Y - D * 1.5 * Word[W].Size *(Word[W].Scale - 1)); + SetFontSize(Word[W].Size + D * (Word[W].Size * Word[W].Scale - Word[W].Size)); + SetFontItalic(Word[W].Italic); + glColor3f(Word[W].ColR, Word[W].ColG, Word[W].ColB); + glPrint(pchar(Word[W].Text)) +end; + +procedure TLyric.DrawSlide(W: integer); +var + D: real; +begin + D := Word[W].Done; // przyrost + SetFontStyle(Word[W].FontStyle); + SetFontPos(Word[W].X, Word[W].Y); + SetFontSize(Word[W].Size); + SetFontItalic(Word[W].Italic); + glColor3f(Word[W].ColR, Word[W].ColG, Word[W].ColB); + glPrintDone(pchar(Word[W].Text), D, ColR, ColG, ColB); +end; + +function TLyric.SelectedLetter; // LCD +var + W: integer; +begin + Result := 1; + + for W := 0 to SelectedI-1 do + Result := Result + Length(Word[W].Text); +end; + +function TLyric.SelectedLength: integer; // LCD +begin + Result := Length(Word[SelectedI].Text); +end; + +end. diff --git a/Game/Code/Classes/UMain.dcu b/Game/Code/Classes/UMain.dcu new file mode 100644 index 00000000..3a2edf09 Binary files /dev/null and b/Game/Code/Classes/UMain.dcu differ diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas new file mode 100644 index 00000000..3ef65e1d --- /dev/null +++ b/Game/Code/Classes/UMain.pas @@ -0,0 +1,673 @@ +unit UMain; + +interface +uses SDL, UGraphic, UMusic, URecord, UTime, SysUtils, UDisplay, UIni, ULog, ULyrics, UScreenSing, + OpenGL12, zlportio {you can disable it and all PortWriteB calls}, ULCD, ULight, UThemes; + +type + TPlayer = record + Name: string; + + Score: real; + ScoreLine: real; + ScoreGolden: real; + + ScoreI: integer; + ScoreLineI: integer; + ScoreGoldenI: integer; + ScoreTotalI: integer; + + + + //SingBar Mod + ScoreLast: Real;//Last Line Score + ScorePercent: integer;//Aktual Fillstate of the SingBar + ScorePercentTarget: integer;//Target Fillstate of the SingBar + //end Singbar Mod + + //PhrasenBonus - Line Bonus Mod + LineBonus_PosX: integer; + LineBonus_PosY: integer; + LineBonus_Alpha: Single; + LineBonus_Visible: boolean; + LineBonus_Text: string; + LineBonus_Color: TRGB; + + //Variable vor Positioning -> Set on ScreenShow, different when Playercount Changes + LineBonus_TargetX: integer; + LineBonus_TargetY: integer; + LineBonus_StartX: integer; + LineBonus_StartY: integer; + //PhrasenBonus - Line Bonus Mod End + + + + +// Meter: real; + + HighNut: integer; + IlNut: integer; + Nuta: array of record + Start: integer; + Dlugosc: integer; + Detekt: real; // dokladne miejsce, w ktorym wykryto ta nute + Ton: real; + Perfect: boolean; // true if the note matches the original one, lit the star + + + + // Half size Notes Patch + Hit: boolean; // true if the note Hits the Line + //end Half size Notes Patch + + + + end; + end; + + +var + OGL: Boolean; + Done: Boolean; + Event: TSDL_event; + FileName: string; + Restart: boolean; + + // gracz i jego nuty + Player: array of TPlayer; + PlayersPlay: integer; + + +procedure MainLoop; +procedure CheckEvents; +procedure Sing(Sender: TScreenSing); +procedure NewSentence(Sender: TScreenSing); +procedure NewBeat(Sender: TScreenSing); // executed when on then new beat +procedure NewBeatC(Sender: TScreenSing); // executed when on then new beat for click +procedure NewBeatD(Sender: TScreenSing); // executed when on then new beat for detection +//procedure NewHalf; // executed when in the half between beats +procedure NewNote(Sender: TScreenSing); // detect note +function GetMidBeat(Time: real): real; +function GetTimeFromBeat(Beat: integer): real; +procedure ClearScores(PlayerNum: integer); + +implementation +uses USongs, UJoystick, math; + +procedure MainLoop; +var + Delay: integer; +begin + SDL_EnableKeyRepeat(125, 125); + While not Done do + Begin + // joypad + if Ini.Joypad = 1 then + Joy.Update; + + // keyboard events + CheckEvents; + + // display + Display.Draw; + SwapBuffers; + + // light + Light.Refresh; + + // delay + CountMidTime; +// if 1000*TimeMid > 100 then beep; + Delay := Floor(1000 / 100 - 1000 * TimeMid); + if Delay >= 1 then + SDL_Delay(Delay); // dynamic, maximum is 100 fps + CountSkipTime; + + // reinitialization of graphics + if Restart then begin + Reinitialize3D; + Restart := false; + end; + + End; + UnloadOpenGL; +End; + +Procedure CheckEvents; +//var +// p: pointer; +Begin + if not Assigned(Display.NextScreen) then + While SDL_PollEvent( @event ) = 1 Do + Begin +// beep; + Case Event.type_ Of + SDL_QUITEV: done := true; +{ SDL_MOUSEBUTTONDOWN: + With Event.button Do + Begin + If State = SDL_BUTTON_LEFT Then + Begin + // + End; + End; // With} + SDL_KEYDOWN: + begin + if (Not Display.ActualScreen^.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True)) then +// if (Not Display.ActualScreen^.ParseInput(Event.key.keysym.scancode, True)) then + done := true; // exit game + end; +// SDL_JOYAXISMOTION: +// begin +// beep +// end; + SDL_JOYBUTTONDOWN: + begin + beep + end; + End; // Case Event.type_ + End; // While +End; // CheckEvents + +function GetTimeForBeats(BPM, Beats: real): real; +begin + Result := 60 / BPM * Beats; +end; + +function GetBeats(BPM, msTime: real): real; +begin + Result := BPM * msTime / 60; +end; + +procedure GetMidBeatSub(BPMNum: integer; var Time: real; var CurBeat: real); +var + NewTime: real; +begin + if High(AktSong.BPM) = BPMNum then begin + // last BPM + CurBeat := AktSong.BPM[BPMNum].StartBeat + GetBeats(AktSong.BPM[BPMNum].BPM, Time); + Time := 0; + end else begin + // not last BPM + // count how much time is it for start of the new BPM and store it in NewTime + NewTime := GetTimeForBeats(AktSong.BPM[BPMNum].BPM, AktSong.BPM[BPMNum+1].StartBeat - AktSong.BPM[BPMNum].StartBeat); + + // compare it to remaining time + if (Time - NewTime) > 0 then begin + // there is still remaining time + CurBeat := AktSong.BPM[BPMNum].StartBeat; + Time := Time - NewTime; + end else begin + // there is no remaining time + CurBeat := AktSong.BPM[BPMNum].StartBeat + GetBeats(AktSong.BPM[BPMNum].BPM, Time); + Time := 0; + end; // if + end; // if +end; + +function GetMidBeat(Time: real): real; +var + CurBeat: real; + CurBPM: integer; +// TopBeat: real; +// TempBeat: real; +// TempTime: real; +begin + Result := 0; + if Length(AktSong.BPM) = 1 then Result := Time * AktSong.BPM[0].BPM / 60; + + (* 2 BPMs *) +{ if Length(AktSong.BPM) > 1 then begin + (* new system *) + CurBeat := 0; + TopBeat := GetBeats(AktSong.BPM[0].BPM, Time); + if TopBeat > AktSong.BPM[1].StartBeat then begin + // analyze second BPM + Time := Time - GetTimeForBeats(AktSong.BPM[0].BPM, AktSong.BPM[1].StartBeat - CurBeat); + CurBeat := AktSong.BPM[1].StartBeat; + TopBeat := GetBeats(AktSong.BPM[1].BPM, Time); + Result := CurBeat + TopBeat; + + end else begin + (* pierwszy przedzial *) + Result := TopBeat; + end; + end; // if} + + (* more BPMs *) + if Length(AktSong.BPM) > 1 then begin + + CurBeat := 0; + CurBPM := 0; + while (Time > 0) do begin + GetMidBeatSub(CurBPM, Time, CurBeat); + Inc(CurBPM); + end; + + Result := CurBeat; + end; // if +end; + +function GetTimeFromBeat(Beat: integer): real; +var + CurBPM: integer; +begin + Result := 0; + if Length(AktSong.BPM) = 1 then Result := AktSong.GAP / 1000 + Beat * 60 / AktSong.BPM[0].BPM; + + (* more BPMs *) + if Length(AktSong.BPM) > 1 then begin + Result := AktSong.GAP / 1000; + CurBPM := 0; + while (CurBPM <= High(AktSong.BPM)) and (Beat > AktSong.BPM[CurBPM].StartBeat) do begin + if (CurBPM < High(AktSong.BPM)) and (Beat >= AktSong.BPM[CurBPM+1].StartBeat) then begin + // full range + Result := Result + (60 / AktSong.BPM[CurBPM].BPM) * (AktSong.BPM[CurBPM+1].StartBeat - AktSong.BPM[CurBPM].StartBeat); + end; + + if (CurBPM = High(AktSong.BPM)) or (Beat < AktSong.BPM[CurBPM+1].StartBeat) then begin + // in the middle + Result := Result + (60 / AktSong.BPM[CurBPM].BPM) * (Beat - AktSong.BPM[CurBPM].StartBeat); + end; + Inc(CurBPM); + end; + +{ while (Time > 0) do begin + GetMidBeatSub(CurBPM, Time, CurBeat); + Inc(CurBPM); + end;} + end; // if} +end; + +procedure Sing(Sender: TScreenSing); +var + Pet: integer; + PetGr: integer; + CP: integer; + Done: real; + N: integer; +begin + Czas.Teraz := Czas.Teraz + TimeSkip; + + Czas.OldBeat := Czas.AktBeat; + Czas.MidBeat := GetMidBeat(Czas.Teraz - (AktSong.Gap{ + 90 I've forgotten for what it is}) / 1000); // new system with variable BPM in function + Czas.AktBeat := Floor(Czas.MidBeat); + +// Czas.OldHalf := Czas.AktHalf; +// Czas.MidHalf := Czas.MidBeat + 0.5; +// Czas.AktHalf := Floor(Czas.MidHalf); + + Czas.OldBeatC := Czas.AktBeatC; + Czas.MidBeatC := GetMidBeat(Czas.Teraz - (AktSong.Gap) / 1000); + Czas.AktBeatC := Floor(Czas.MidBeatC); + + Czas.OldBeatD := Czas.AktBeatD; + Czas.MidBeatD := -0.5+GetMidBeat(Czas.Teraz - (AktSong.Gap + 120 + 20) / 1000); // MidBeat with addition GAP + Czas.AktBeatD := Floor(Czas.MidBeatD); + Czas.FracBeatD := Frac(Czas.MidBeatD); + + // sentences routines + for PetGr := 0 to 0 do begin;//High(Gracz) do begin + CP := PetGr; + // ustawianie starej czesci + Czas.OldCzesc := Czesci[CP].Akt; + + // wybieranie aktualnej czesci + for Pet := 0 to Czesci[CP].High do + if Czas.AktBeat >= Czesci[CP].Czesc[Pet].Start then Czesci[CP].Akt := Pet; + + // czysczenie nut gracza, gdy to jest nowa plansza + // (optymizacja raz na halfbeat jest zla) + if Czesci[CP].Akt <> Czas.OldCzesc then NewSentence(Sender); + + end; // for PetGr + + // wykonuje operacje raz na beat + if (Czas.AktBeat >= 0) and (Czas.OldBeat <> Czas.AktBeat) then + NewBeat(Sender); + + // make some operations on clicks + if {(Czas.AktBeatC >= 0) and }(Czas.OldBeatC <> Czas.AktBeatC) then + NewBeatC(Sender); + + // make some operations when detecting new voice pitch + if (Czas.AktBeatD >= 0) and (Czas.OldBeatD <> Czas.AktBeatD) then + NewBeatD(Sender); + + // wykonuje operacje w polowie beatu +// if (Czas.AktHalf >= 1) and (Czas.OldHalf <> Czas.AktHalf) then +// NewHalf; + + // plynnie przesuwa text + Done := 1; + for N := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start <= Czas.MidBeat) + and (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start + Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc >= Czas.MidBeat) then + Done := (Czas.MidBeat - Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start) / (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc); + + N := Czesci[0].Czesc[Czesci[0].Akt].HighNut; + + // wylacza ostatnia nute po przejsciu + if (Ini.LyricsEffect = 1) and (Done = 1) and + (Czas.MidBeat > Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start + Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc) + then Sender.LyricMain.Selected := -1; + + if Done > 1 then Done := 1; + Sender.LyricMain.Done := Done; + + // use Done with LCD +{ with ScreenSing do begin + if LyricMain.Selected >= 0 then begin + LCD.MoveCursor(1, LyricMain.SelectedLetter + Round((LyricMain.SelectedLength-1) * Done)); + LCD.ShowCursor; + end; + end;} + + +end; + +procedure NewSentence(Sender: TScreenSing); +var +G: Integer; +begin + // czyszczenie nut graczy + for G := 0 to High(Player) do begin + Player[G].IlNut := 0; + Player[G].HighNut := -1; + SetLength(Player[G].Nuta, 0); + end; + + // wstawianie tekstow + with Sender do begin + LyricMain.AddCzesc(Czesci[0].Akt); + if Czesci[0].Akt < Czesci[0].High then + LyricSub.AddCzesc(Czesci[0].Akt+1) + else + LyricSub.Clear; + end; + + Sender.UpdateLCD; +end; + +procedure NewBeat(Sender: TScreenSing); +var + Pet: integer; +// TempBeat: integer; +begin + // ustawia zaznaczenie tekstu +// SingScreen.LyricMain.Selected := -1; + for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeat) then begin + // operates on currently beated note + Sender.LyricMain.Selected := Pet; + +// LCD.MoveCursor(1, ScreenSing.LyricMain.SelectedLetter); +// LCD.ShowCursor; + + LCD.MoveCursorBR(Sender.LyricMain.SelectedLetter); + LCD.ShowCursor; + + end; +end; + +procedure NewBeatC; +var + Pet: integer; +// LPT_1: integer; +// LPT_2: integer; +begin +// LPT_1 := 1; +// LPT_2 := 1; + + // beat click + if (Ini.BeatClick = 1) and ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then + Music.PlayClick; + + // debug system on LPT + if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then begin + //LPT_1 := 0; +// Light.LightOne(0, 150); + + Light.LightOne(1, 200); // beat light + if ParamStr(1) = '-doublelights' then + Light.LightOne(0, 200); // beat light + + +{ if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod (Czesci[0].Resolution * 2) = 0) then + Light.LightOne(0, 150) + else + Light.LightOne(1, 150)} + end; + + for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeatC) then begin + // click assist + if Ini.ClickAssist = 1 then + Music.PlayClick; + + //LPT_2 := 0; + if ParamStr(1) <> '-doublelights' then + Light.LightOne(0, 150); //125 + + + // drum machine +(* TempBeat := Czas.AktBeat;// + 2; + if (TempBeat mod 8 = 0) then Music.PlayDrum; + if (TempBeat mod 8 = 4) then Music.PlayClap; +// if (TempBeat mod 4 = 2) then Music.PlayHihat; + if (TempBeat mod 4 <> 0) then Music.PlayHihat;*) + end; + + //PortWriteB($378, LPT_1 + LPT_2 * 2); // 0 zapala +end; + +procedure NewBeatD(Sender: TScreenSing); +begin + NewNote(Sender); +end; + +//procedure NewHalf; +//begin +// NewNote; +//end; + +procedure NewNote(Sender: TScreenSing); +var + CP: integer; // current player + S: integer; // sentence + SMin: integer; + SMax: integer; + SDet: integer; // temporary: sentence of detected note + Pet: integer; + Mozna: boolean; + Nowa: boolean; + Range: integer; + NoteHit:boolean; +begin +// Log.LogStatus('Beat ' + IntToStr(Czas.AktBeat) + ' HalfBeat ' + IntToStr(Czas.AktHalf), 'NewBeat'); +// beep; + + // analizuje dla obu graczy ten sam sygnal (Sound.OneSrcForBoth) + // albo juz lepiej nie + for CP := 0 to PlayersPlay-1 do begin + + // analyze buffer + Sound[CP].AnalizujBufor; + + // adds some noise +// Czas.Ton := Czas.Ton + Round(Random(3)) - 1; + + // 0.5.0: count min and max sentence range for checking (detection is delayed to the notes we see on the screen) + SMin := Czesci[0].Akt-1; + if SMin < 0 then SMin := 0; + SMax := Czesci[0].Akt; + + // check if we can add new note + Mozna := false; + for S := SMin to SMax do + for Pet := 0 to Czesci[0].Czesc[S].HighNut do + if ((Czesci[0].Czesc[S].Nuta[Pet].Start <= Czas.AktBeatD) + and (Czesci[0].Czesc[S].Nuta[Pet].Start + Czesci[0].Czesc[S].Nuta[Pet].Dlugosc - 1 >= Czas.AktBeatD)) + and (not Czesci[0].Czesc[S].Nuta[Pet].FreeStyle) // but don't allow when it's FreeStyle note + and (Czesci[0].Czesc[S].Nuta[Pet].Dlugosc > 0) // and make sure the note lenghts is at least 1 + then begin + SDet := S; + Mozna := true; + Break; + end; + + S := SDet; + + + + + +// Czas.SzczytJest := true; +// Czas.Ton := 27; + + // gdy moze, to dodaje nute + if (Sound[CP].SzczytJest) and (Mozna) then begin + // operowanie na ostatniej nucie + for Pet := 0 to Czesci[0].Czesc[S].HighNut do + if (Czesci[0].Czesc[S].Nuta[Pet].Start <= Czas.OldBeatD+1) + and (Czesci[0].Czesc[S].Nuta[Pet].Start + + Czesci[0].Czesc[S].Nuta[Pet].Dlugosc > Czas.OldBeatD+1) then begin + // to robi, tylko dla pary nut (oryginalnej i gracza) + + // przesuwanie tonu w odpowiednia game + while (Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton > 6) do + Sound[CP].Ton := Sound[CP].Ton - 12; + while (Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton < -6) do + Sound[CP].Ton := Sound[CP].Ton + 12; + + // Half size Notes Patch + NoteHit := false; + + //if Ini.Difficulty = 0 then Range := 2; + //if Ini.Difficulty = 1 then Range := 1; + //if Ini.Difficulty = 2 then Range := 0; + Range := 2 - Ini.Difficulty; + if abs(Czesci[0].Czesc[S].Nuta[Pet].Ton - Sound[CP].Ton) <= Range then begin + Sound[CP].Ton := Czesci[0].Czesc[S].Nuta[Pet].Ton; + + + // Half size Notes Patch + NoteHit := true; + + + if (Ini.LineBonus = 0) then + begin + // add points without LineBonus + case Czesci[0].Czesc[S].Nuta[Pet].Wartosc of + 1: Player[CP].Score := Player[CP].Score + 10000 / Czesci[0].Wartosc * + Czesci[0].Czesc[S].Nuta[Pet].Wartosc; + 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 10000 / Czesci[0].Wartosc * + Czesci[0].Czesc[S].Nuta[Pet].Wartosc; + end; + end + else + begin + // add points with Line Bonus + case Czesci[0].Czesc[S].Nuta[Pet].Wartosc of + 1: Player[CP].Score := Player[CP].Score + 9000 / Czesci[0].Wartosc * + Czesci[0].Czesc[S].Nuta[Pet].Wartosc; + 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 9000 / Czesci[0].Wartosc * + Czesci[0].Czesc[S].Nuta[Pet].Wartosc; + end; + end; + + Player[CP].ScoreI := Floor(Player[CP].Score / 10) * 10; + Player[CP].ScoreGoldenI := Floor(Player[CP].ScoreGolden / 10) * 10; + + Player[CP].ScoreTotalI := Player[CP].ScoreI + Player[CP].ScoreGoldenI + Player[CP].ScoreLineI; + end; + + end; // operowanie + + // sprawdzanie czy to nowa nuta, czy przedluzenie + if S = SMax then begin + Nowa := true; + // jezeli ostatnia ma ten sam ton + if (Player[CP].IlNut > 0 ) and (Player[CP].Nuta[Player[CP].HighNut].Ton = Sound[CP].Ton) + and (Player[CP].Nuta[Player[CP].HighNut].Start + Player[CP].Nuta[Player[CP].HighNut].Dlugosc = Czas.AktBeatD) + then Nowa := false; + // jezeli jest jakas nowa nuta na sprawdzanym beacie + for Pet := 0 to Czesci[0].Czesc[S].HighNut do + if (Czesci[0].Czesc[S].Nuta[Pet].Start = Czas.AktBeatD) then + Nowa := true; + + // dodawanie nowej nuty + if Nowa then begin + // nowa nuta + Player[CP].IlNut := Player[CP].IlNut + 1; + Player[CP].HighNut := Player[CP].HighNut + 1; + SetLength(Player[CP].Nuta, Player[CP].IlNut); + Player[CP].Nuta[Player[CP].HighNut].Start := Czas.AktBeatD; + Player[CP].Nuta[Player[CP].HighNut].Dlugosc := 1; + Player[CP].Nuta[Player[CP].HighNut].Ton := Sound[CP].Ton; // Ton || TonDokl + Player[CP].Nuta[Player[CP].HighNut].Detekt := Czas.MidBeat; + + + // Half Note Patch + Player[CP].Nuta[Player[CP].HighNut].Hit := NoteHit; + + + // Log.LogStatus('Nowa Nuta ' + IntToStr(Gracz.Nuta[Gracz.HighNut].Start), 'NewBeat'); + + end else begin + // przedluzenie nuty + Player[CP].Nuta[Player[CP].HighNut].Dlugosc := Player[CP].Nuta[Player[CP].HighNut].Dlugosc + 1; + end; + + + // check for perfect note and then lit the star (on Draw) + for Pet := 0 to Czesci[0].Czesc[S].HighNut do + if (Czesci[0].Czesc[S].Nuta[Pet].Start = Player[CP].Nuta[Player[CP].HighNut].Start) + and (Czesci[0].Czesc[S].Nuta[Pet].Dlugosc = Player[CP].Nuta[Player[CP].HighNut].Dlugosc) + and (Czesci[0].Czesc[S].Nuta[Pet].Ton = Player[CP].Nuta[Player[CP].HighNut].Ton) then begin + Player[CP].Nuta[Player[CP].HighNut].Perfect := true; + end; + + end;// else beep; // if S = SMax + + end; // if moze + end; // for CP +// Log.LogStatus('EndBeat', 'NewBeat'); + +//On Sentence End -> For LineBonus + SingBar +if (sDet >= low(Czesci[0].Czesc)) AND (sDet <= high(Czesci[0].Czesc)) then +if ((Czesci[0].Czesc[SDet].Nuta[Czesci[0].Czesc[SDet].HighNut].Start + Czesci[0].Czesc[SDet].Nuta[Czesci[0].Czesc[SDet].HighNut].Dlugosc - 1) = Czas.AktBeatD) then + Sender.onSentenceEnd(sDet); + +end; + +procedure ClearScores(PlayerNum: integer); +begin + Player[PlayerNum].Score := 0; + Player[PlayerNum].ScoreI := 0; + Player[PlayerNum].ScoreLine := 0; + Player[PlayerNum].ScoreLineI := 0; + Player[PlayerNum].ScoreGolden := 0; + Player[PlayerNum].ScoreGoldenI := 0; + Player[PlayerNum].ScoreTotalI := 0; + + + //SingBar Mod + Player[PlayerNum].ScoreLast := 0; + Player[PlayerNum].ScorePercent := 50;// Sets to 50% when song starts + Player[PlayerNum].ScorePercentTarget := 50;// Sets to 50% when song starts + //end SingBar Mod + + //PhrasenBonus - Line Bonus Mod + Player[PlayerNum].LineBonus_Visible := False; //Hide Line Bonus + Player[PlayerNum].LineBonus_Alpha := 0; + Player[PlayerNum].LineBonus_TargetX := 70 + PlayerNum*500; + Player[PlayerNum].LineBonus_TargetY := 30; + //PhrasenBonus - Line Bonus Mod End + + + +end; + +end. + diff --git a/Game/Code/Classes/UMusic.dcu b/Game/Code/Classes/UMusic.dcu new file mode 100644 index 00000000..f3116f8b Binary files /dev/null and b/Game/Code/Classes/UMusic.dcu differ diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas new file mode 100644 index 00000000..db1675c5 --- /dev/null +++ b/Game/Code/Classes/UMusic.pas @@ -0,0 +1,783 @@ +unit UMusic; + +interface + +uses Classes, MPlayer, Windows, Messages, SysUtils, Forms, ULog, USongs, Bass;//, DXSounds; + +procedure InitializeSound; + +type + TSoundCard = record + Name: string; + Source: array of string; + end; + + TFFTData = array [0..256] of Single; + + TCustomSoundEntry = record + Filename: String; + Handle: hStream; + end; + + + TMusic = class + private +// MediaPlayer: TMediaPlayer; // It will be replaced by another component; +{ MediaPlayerStart: TMediaPlayer; // or maybe not if done this way ;) + MediaPlayerBack: TMediaPlayer; + MediaPlayerSwoosh: TMediaPlayer; + MediaPlayerChange: TMediaPlayer; + MediaPlayerOption: TMediaPlayer; + MediaPlayerClick: TMediaPlayer; + MediaPlayerDrum: TMediaPlayer; + MediaPlayerHihat: TMediaPlayer; + MediaPlayerClap: TMediaPlayer; + MediaPlayerShuffle: TMediaPlayer;} + BassStart: hStream; // Wait, I've replaced this with BASS + BassBack: hStream; // It has almost all features we need + BassSwoosh: hStream; + BassChange: hStream; // Almost? It aleady has them all :) + BassOption: hStream; + BassClick: hStream; + BassDrum: hStream; + BassHihat: hStream; + BassClap: hStream; + BassShuffle: hStream; + + //Custom Sounds + CustomSounds: array of TCustomSoundEntry; + + + Loaded: boolean; + Loop: boolean; +// DXSound: TDXSound; +// Player: TcmxMp3; + public + Bass: hStream; + +// SoundCard: array of TSoundCard; + procedure InitializePlayback; + procedure InitializeRecord; + procedure SetVolume(Volume: integer); + procedure SetLoop(Enabled: boolean); + function Open(Name: string): boolean; // true if succeed + procedure Rewind; + procedure MoveTo(Time: real); + procedure Play; + procedure Pause; //Pause Mod + procedure Stop; + procedure Close; + function Finished: boolean; + function Length: real; + function Position: real; + procedure PlayStart; + procedure PlayBack; + procedure PlaySwoosh; + procedure PlayChange; + procedure PlayOption; + procedure PlayClick; + procedure PlayDrum; + procedure PlayHihat; + procedure PlayClap; + procedure PlayShuffle; + procedure StopShuffle; + procedure CaptureStart; + procedure CaptureStop; + procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); + procedure StopCard(Card: byte); + function LoadPlayerFromFile(var MediaPlayer: TMediaPlayer; Name: string): boolean; + function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; + + //Equalizer + function GetFFTData: TFFTData; + + //Custom Sounds + function LoadCustomSound(const Filename: String): Cardinal; + procedure PlayCustomSound(const Index: Cardinal); + +end; + +const + RecordSystem = 1; + +type + TMuzyka = record + Path: string; + Start: integer; // start of song in ms +// BPM: array of TBPM; +// Gap: real; + IlNut: integer; + DlugoscNut: integer; +// WartoscNut: integer; + end; + + TCzesci = record + Akt: integer; // aktualna czesc utworu do rysowania + High: integer; + Ilosc: integer; + Resolution: integer; + NotesGAP: integer; + Wartosc: integer; + Czesc: array of record + Start: integer; + StartNote: integer; + Lyric: string; + LyricWidth: real; + Koniec: integer; + BaseNote: integer; + HighNut: integer; + IlNut: integer; + TotalNotes: integer; + Nuta: array of record + Color: integer; + Start: integer; + Dlugosc: integer; + Ton: integer; + TonGamy: integer; + Tekst: string; + FreeStyle: boolean; + Wartosc: integer; // zwykla nuta x1, zlota nuta x2 + + + + + end; + end; + end; + + TCzas = record // wszystko, co dotyczy aktualnej klatki +// BajtowTotal: integer; +// BajtowTeraz: integer; +// BajtowNaSek: integer; + OldBeat: integer; // poprzednio wykryty beat w utworze + AktBeat: integer; // aktualny beat w utworze + MidBeat: real; // dokladny AktBeat + + // should not be used +// OldHalf: integer; // poprzednio wykryta polowka +// AktHalf: integer; // aktualna polowka w utworze +// MidHalf: real; // dokladny AktHalf + + // now we use this for super synchronization! + // only used when analyzing voice + OldBeatD: integer; // poprzednio wykryty beat w utworze + AktBeatD: integer; // aktualny beat w utworze + MidBeatD: real; // dokladny AktBeatD + FracBeatD: real; // fractional part of MidBeatD + + // we use this for audiable clicks + OldBeatC: integer; // poprzednio wykryty beat w utworze + AktBeatC: integer; // aktualny beat w utworze + MidBeatC: real; // dokladny AktBeatC + FracBeatC: real; // fractional part of MidBeatC + + + OldCzesc: integer; // poprzednio wyswietlana czesc + // akt jest w czesci.akt + + Teraz: real; // aktualny czas w utworze + Razem: real; // caly czas utworu +// TerazSek: integer; + end; + +var + Form: TForm; + Music: TMusic; + + // muzyka + Muzyka: TMuzyka; + + // czesci z nutami; + Czesci: array of TCzesci; + + // czas + Czas: TCzas; + + fHWND: Thandle; + +const + ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); + +implementation +uses UGraphic, URecord, UPliki, UIni, UMain, UThemes; + +procedure InitializeSound; +begin + Log.LogStatus('Initializing Playback', 'InitializeSound'); Music.InitializePlayback; + Log.LogStatus('Initializing Record', 'InitializeSound'); Music.InitializeRecord; +end; + +procedure TMusic.InitializePlayback; +var + Pet: integer; + S: integer; +begin + Log.BenchmarkStart(4); + Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); + Loaded := false; + Loop := false; + fHWND := AllocateHWND( nil); + + if not BASS_Init(1, 44100, 0, fHWND, nil) then begin + Application.MessageBox ('Could not initialize BASS', 'Error'); + Exit; + end; + + Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); + + // config playing buffer +// BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); +// BASS_SetConfig(BASS_CONFIG_BUFFER, 100); + +{ MediaPlayer := TMediaPlayer.Create( nil ); + MediaPlayer.ParentWindow := fHWND; + MediaPlayer.Wait := true;} + + Log.LogStatus('Loading Sounds', 'Music Initialize'); + +{ LoadPlayerFromFile(MediaPlayerStart, SoundPath + 'Common Start.mp3'); + LoadPlayerFromFile(MediaPlayerBack, SoundPath + 'Common Back.mp3'); + LoadPlayerFromFile(MediaPlayerSwoosh, SoundPath + 'menu swoosh.mp3'); + LoadPlayerFromFile(MediaPlayerChange, SoundPath + 'select music change music.mp3'); + LoadPlayerFromFile(MediaPlayerOption, SoundPath + 'option change col.mp3'); + LoadPlayerFromFile(MediaPlayerClick, SoundPath + 'rimshot022b.mp3'); + + LoadPlayerFromFile(MediaPlayerDrum, SoundPath + 'bassdrumhard076b.mp3'); + LoadPlayerFromFile(MediaPlayerHihat, SoundPath + 'hihatclosed068b.mp3'); + LoadPlayerFromFile(MediaPlayerClap, SoundPath + 'claps050b.mp3'); + + LoadPlayerFromFile(MediaPlayerShuffle, SoundPath + 'Shuffle.mp3');} + + Log.BenchmarkStart(4); + LoadSoundFromFile(BassStart, SoundPath + 'Common Start.mp3'); + LoadSoundFromFile(BassBack, SoundPath + 'Common Back.mp3'); + LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3'); + LoadSoundFromFile(BassChange, SoundPath + 'select music change music 50.mp3'); + LoadSoundFromFile(BassOption, SoundPath + 'option change col.mp3'); + LoadSoundFromFile(BassClick, SoundPath + 'rimshot022b.mp3'); + +// LoadSoundFromFile(BassDrum, SoundPath + 'bassdrumhard076b.mp3'); +// LoadSoundFromFile(BassHihat, SoundPath + 'hihatclosed068b.mp3'); +// LoadSoundFromFile(BassClap, SoundPath + 'claps050b.mp3'); + +// LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3'); + + Log.BenchmarkEnd(4); Log.LogBenchmark('--> Loading Sounds', 4); +end; + +procedure TMusic.InitializeRecord; +var + S: integer; + device: integer; + descr: string; + input: integer; + input2: integer; + flags: integer; + mic: array[0..15] of integer; + SC: integer; // soundcard + SCI: integer; // soundcard input +begin + if RecordSystem = 1 then begin + SetLength(Sound, 6 {max players});//Ini.Players+1); + for S := 0 to High(Sound) do begin //Ini.Players do begin + Sound[S] := TSound.Create; + Sound[S].Num := S; + Sound[S].BufferNew := TMemoryStream.Create; + SetLength(Sound[S].BufferLong, 1); + Sound[S].BufferLong[0] := TMemoryStream.Create; + Sound[S].n := 4*1024; + end; + + + // check for recording devices; + {device := 0; + descr := BASS_RecordGetDeviceDescription(device); + + SetLength(SoundCard, 0); + while (descr <> '') do begin + SC := High(SoundCard) + 1; + SetLength(SoundCard, SC+1); + + Log.LogAnalyze('Device #'+IntToStr(device)+': '+ descr); + SoundCard[SC].Description := Descr; + + // check for recording inputs + mic[device] := -1; // default to no change + input := 0; + BASS_RecordInit(device); + Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); + flags := BASS_RecordGetInput(input); + + SetLength(SoundCard[SC].Input, 0); + while (flags <> -1) do begin + SCI := High(SoundCard[SC].Input) + 1; + SetLength(SoundCard[SC].Input, SCI+1); + + Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); + SoundCard[SC].Input[SCI].Name := BASS_RecordGetInputName(Input); + + if (flags and BASS_INPUT_TYPE_MASK) = BASS_INPUT_TYPE_MIC then begin + mic[device] := input; // auto set microphone + end; + Inc(Input); + flags := BASS_RecordGetInput(input); + end; + + if mic[device] <> -1 then begin + Log.LogAnalyze('Found the mic at input ' + IntToStr(Mic[device])) + end else begin + Log.LogAnalyze('Mic not found'); + mic[device] := 0; // setting to the first one (for kxproject) + end; + SoundCard[SC].InputSeleceted := Mic[Device]; + + + BASS_RecordFree; + + inc(Device); + descr := BASS_RecordGetDeviceDescription(Device); + end; // while} + end; // if +end; + +procedure TMusic.SetVolume(Volume: integer); +begin + BASS_SetVolume(Volume); +end; + +procedure TMusic.SetLoop(Enabled: boolean); +begin + Loop := Enabled; +end; + +function TMusic.Open(Name: string): boolean; +begin + Loaded := false; + if FileExists(Name) then begin +{ MediaPlayer.FileName := Name; + MediaPlayer.Open;} + + Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); + Loaded := true; + end; + + Result := Loaded; + +// Player := TcmxMp3.Create(Name); +end; + +procedure TMusic.Rewind; +begin + if Loaded then begin +// MediaPlayer.Position := 0; + + end; +end; + +procedure TMusic.MoveTo(Time: real); +var + bytes: integer; +begin +// if Loaded then begin +// MediaPlayer.StartPos := Round(Time); + bytes := BASS_ChannelSeconds2Bytes(Bass, Time); + BASS_ChannelSetPosition(Bass, bytes); +// end; +end; + +procedure TMusic.Play; +begin + if Loaded then begin +// MediaPlayer.Play; + BASS_ChannelPlay(Bass, False); // for setting position before playing + end; +end; + +procedure TMusic.Pause; //Pause Mod +begin + if Loaded then begin + BASS_ChannelPause(Bass); // Pauses Song + end; +end; + +procedure TMusic.Stop; +begin + Bass_ChannelStop(Bass); +// Bass_StreamFree(Bass); +// if ModeStr[MediaPlayer.Mode] = 'Playing' then begin +// MediaPlayer.Stop; +// end; +end; + +procedure TMusic.Close; +begin + Bass_StreamFree(Bass); +// Player.Free; +// MediaPlayer.Close; +end; + +function TMusic.Length: real; +var + bytes: integer; +begin + Result := 60; + + bytes := BASS_StreamGetLength(Bass); + Result := BASS_ChannelBytes2Seconds(Bass, bytes); + +{ if Assigned(MediaPlayer) then begin + if Loaded then Result := MediaPlayer.Length / 1000; + end;} +// if Assigned(Player) then +// Result := Player.LengthInSeconds; +end; + +function TMusic.Position: real; +var + bytes: integer; +begin + Result := 0;//MediaPlayer.Position / 1000; + bytes := BASS_ChannelGetPosition(BASS); + Result := BASS_ChannelBytes2Seconds(BASS, bytes); +end; + +function TMusic.Finished: boolean; +begin + Result := false; +// if ModeStr[MediaPlayer.Mode] = 'Stopped' then Result := true; + if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then begin +// beep; + Result := true; + end; +end; + +{function myeffect( chan : integer; stream : Pointer; len : integer; udata : Pointer ): Pointer; cdecl; +var + dane: pwordarray; + pet: integer; + Prev: smallint; + PrevNew: smallint; +begin + dane := stream; + Prev := 0; + for pet := 0 to len div 2 -1 do begin + PrevNew := Dane[Pet]; + +// Dane[pet] := Round(PrevNew*1/8 + Prev*7/8); + + Prev := Dane[Pet]; + end; +end;} + +procedure TMusic.PlayStart; +{var + Music: PMix_Chunk;} +begin +{ Mix_OpenAudio(44100, 16, 1, 16*1024); + Music := Mix_LoadWAV('D:\Rozne\UltraStar\Old\Boys - Hej Sokoly 30s.wav'); + Mix_RegisterEffect(0, myeffect, nil, 0); + Mix_PlayChannel(0, Music, 0);} + +// MediaPlayerStart.Rewind; +// MediaPlayerStart.Play; + BASS_ChannelPlay(BassStart, True); +end; + +procedure TMusic.PlayBack; +begin +// MediaPlayerBack.Rewind; +// MediaPlayerBack.Play; +// if not + BASS_ChannelPlay(BassBack, True);// then +// Application.MessageBox ('Error playing stream!', 'Error'); +end; + +procedure TMusic.PlaySwoosh; +begin +// MediaPlayerSwoosh.Rewind; +// MediaPlayerSwoosh.Play; + BASS_ChannelPlay(BassSwoosh, True); +end; + +procedure TMusic.PlayChange; +begin +// MediaPlayerChange.Rewind; +// MediaPlayerChange.Play; + BASS_ChannelPlay(BassChange, True); +end; + +procedure TMusic.PlayOption; +begin +// MediaPlayerOption.Rewind; +// MediaPlayerOption.Play; + BASS_ChannelPlay(BassOption, True); +end; + +procedure TMusic.PlayClick; +begin +// MediaPlayerClick.Rewind; +// MediaPlayerClick.Play; + BASS_ChannelPlay(BassClick, True); +end; + +procedure TMusic.PlayDrum; +begin +// MediaPlayerDrum.Rewind; +// MediaPlayerDrum.Play; + BASS_ChannelPlay(BassDrum, True); +end; + +procedure TMusic.PlayHihat; +begin +// MediaPlayerHihat.Rewind; +// MediaPlayerHihat.Play; + BASS_ChannelPlay(BassHihat, True); +end; + +procedure TMusic.PlayClap; +begin +// MediaPlayerClap.Rewind; +// MediaPlayerClap.Play; + BASS_ChannelPlay(BassClap, True); +end; + +procedure TMusic.PlayShuffle; +begin +// MediaPlayerShuffle.Rewind; +// MediaPlayerShuffle.Play; + BASS_ChannelPlay(BassShuffle, True); +end; + +procedure TMusic.StopShuffle; +begin + BASS_ChannelStop(BassShuffle); +end; + +procedure TMusic.CaptureStart; +var + S: integer; + SC: integer; + P1: integer; + P2: integer; +begin + for S := 0 to High(Sound) do + Sound[S].BufferLong[0].Clear; + +{ case PlayersPlay of + 1: begin + CaptureCard(0, 0, 1, 0); + end; + 2: begin + if Ini.TwoPlayerMode = 0 then begin + CaptureCard(0, 0, 1, 2); + end else begin + CaptureCard(0, 0, 1, 0); + CaptureCard(1, 1, 2, 0); + end; + end; + 3: begin + CaptureCard(0, 0, 1, 2); + CaptureCard(1, 1, 3, 0); + end; + end; // case} + +// CaptureCard(0, 0, 0, 0); +// end; + + {for SC := 0 to High(SoundCard) do begin + P1 := Ini.SoundCard[SC, 1]; + P2 := Ini.SoundCard[SC, 2]; + if P1 > PlayersPlay then P1 := 0; + if P2 > PlayersPlay then P2 := 0; + CaptureCard(SC, P1, P2); + end; } + // 0.5.2: new + for SC := 0 to High(Ini.CardList) do begin + P1 := Ini.CardList[SC].ChannelL; + P2 := Ini.CardList[SC].ChannelR; + if P1 > PlayersPlay then P1 := 0; + if P2 > PlayersPlay then P2 := 0; + if (P1 > 0) or (P2 > 0) then + CaptureCard(SC, P1, P2); + end; +end; + +procedure TMusic.CaptureStop; +var + SC: integer; + P1: integer; + P2: integer; +begin +{ if RecordSystem = 1 then begin + case PlayersPlay of + 1: begin + StopCard(0); + end; + 2: begin + if Ini.TwoPlayerMode = 0 then begin + StopCard(0); + end else begin + StopCard(0); + StopCard(1); + end; + end; + 3: begin + StopCard(0); + StopCard(1); + end; + end; + end;} + + {for SC := 0 to High(SoundCard) do begin + StopCard(SC); + end; } + + // 0.5.2 + for SC := 0 to High(Ini.CardList) do begin + P1 := Ini.CardList[SC].ChannelL; + P2 := Ini.CardList[SC].ChannelR; + if P1 > PlayersPlay then P1 := 0; + if P2 > PlayersPlay then P2 := 0; + if (P1 > 0) or (P2 > 0) then StopCard(SC); + end; + +end; + +//procedure TMusic.CaptureCard(RecordI, SoundNum, PlayerLeft, PlayerRight: byte); +procedure TMusic.CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); +var + Error: integer; + ErrorMsg: string; +begin + if not BASS_RecordInit(RecordI) then begin + Error := BASS_ErrorGetCode; + + ErrorMsg := IntToStr(Error); + if Error = BASS_ERROR_DX then ErrorMsg := 'No DX5'; + if Error = BASS_ERROR_ALREADY then ErrorMsg := 'The device has already been initialized'; + if Error = BASS_ERROR_DEVICE then ErrorMsg := 'The device number specified is invalid'; + if Error = BASS_ERROR_DRIVER then ErrorMsg := 'There is no available device driver'; + + {Log.LogAnalyze('Error initializing record [' + IntToStr(RecordI) + ', ' + + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' + + ErrorMsg);} + Log.LogError('Error initializing record [' + IntToStr(RecordI) + ', ' + + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' + + ErrorMsg); + Log.LogError('Music -> CaptureCard: Error initializing record: ' + ErrorMsg); + + + end else begin + + //SoundCard[RecordI].BassRecordStream := BASS_RecordStart(44100, 2, MakeLong(0, 20) , @GetMicrophone, PlayerLeft + PlayerRight*256); + Recording.SoundCard[RecordI].BassRecordStream := BASS_RecordStart(44100, 2, MakeLong(0, 20) , @GetMicrophone, PlayerLeft + PlayerRight*256); + + {if SoundCard[RecordI].BassRecordStream = 0 then begin + Error := BASS_ErrorGetCode; + + ErrorMsg := IntToStr(Error); + if Error = BASS_ERROR_INIT then ErrorMsg := 'Not successfully called'; + if Error = BASS_ERROR_ALREADY then ErrorMsg := 'Recording is already in progress'; + if Error = BASS_ERROR_NOTAVAIL then ErrorMsg := 'The recording device is not available'; + if Error = BASS_ERROR_FORMAT then ErrorMsg := 'The specified format is not supported'; + if Error = BASS_ERROR_MEM then ErrorMsg := 'There is insufficent memory'; + if Error = BASS_ERROR_UNKNOWN then ErrorMsg := 'Unknown'; + + Log.LogError('Error creating record stream [' + IntToStr(RecordI) + ', ' + + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' + + ErrorMsg); + end; } + end; +end; + +procedure TMusic.StopCard(Card: byte); +begin + BASS_RecordSetDevice(Card); + BASS_RecordFree; +end; + +function TMusic.LoadPlayerFromFile(var MediaPlayer: TMediaPlayer; Name: string): boolean; +begin + Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadPlayerFromFile'); + if FileExists(Name) then begin + try + MediaPlayer := TMediaPlayer.Create( nil ); + except + Log.LogError('Failed to create MediaPlayer', 'LoadPlayerFromFile'); + end; + try + MediaPlayer.ParentWindow := fHWND; + MediaPlayer.Wait := true; + MediaPlayer.FileName := Name; + MediaPlayer.DeviceType := dtAutoSelect; + MediaPlayer.Display := nil; + except + Log.LogError('Failed setting MediaPlayer: ' + MediaPlayer.ErrorMessage, 'LoadPlayerFromFile'); + end; + try + MediaPlayer.Open; + except + Log.LogError('Failed to open using MediaPlayer', 'LoadPlayerFromFile'); + end; + end else begin + Log.LogError('Sound not found: "' + Name + '"', 'LoadPlayerFromFile'); + exit; + end; +end; + +function TMusic.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; +begin + if FileExists(Name) then begin + Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadPlayerFromFile'); + try + hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); + except + Log.LogError('Failed to open using BASS', 'LoadPlayerFromFile'); + end; + end else begin + Log.LogError('Sound not found: "' + Name + '"', 'LoadPlayerFromFile'); + exit; + end; +end; + +//Equalizer +function TMusic.GetFFTData: TFFTData; +var +Data: TFFTData; +begin + //Get Channel Data Mono and 256 Values + BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); + //Result := Data; +end; + +function TMusic.LoadCustomSound(const Filename: String): Cardinal; +var + S: hStream; + I: Integer; + F: String; +begin + //Search for Sound in already loaded Sounds + F := UpperCase(FileName); + For I := 0 to High(CustomSounds) do + begin + if (UpperCase(CustomSounds[I].Filename) = F) then + begin + Result := I; + Exit; + end; + end; + + if LoadSoundFromFile(S, Filename) then + Result := High(CustomSounds) + else + Result := 0; +end; + +procedure TMusic.PlayCustomSound(const Index: Cardinal); +begin +if Index <= High(CustomSounds) then + BASS_ChannelPlay(CustomSounds[Index].Handle, True); +end; + + +end. diff --git a/Game/Code/Classes/UParty.dcu b/Game/Code/Classes/UParty.dcu new file mode 100644 index 00000000..e3e1a901 Binary files /dev/null and b/Game/Code/Classes/UParty.dcu differ diff --git a/Game/Code/Classes/UParty.pas b/Game/Code/Classes/UParty.pas new file mode 100644 index 00000000..da89ca8a --- /dev/null +++ b/Game/Code/Classes/UParty.pas @@ -0,0 +1,204 @@ +unit UParty; + +interface + +uses ModiSDK; + +type + TRoundInfo = record + Plugin: Word; + Winner: Byte; + end; + + TParty_Session = class + private + function GetRandomPlayer(Team: Byte): Byte; + function IsWinner(Player, Winner: Byte): boolean; + procedure GenScores; + public + Teams: TTeamInfo; + Rounds: array of TRoundInfo; + CurRound: Byte; + + constructor Create; + + procedure StartNewParty; + procedure StartRound; + procedure EndRound; + function GetWinner: Byte; + function GetWinnerString(Round: Byte): String; + end; + +var + PartySession: TParty_Session; + +implementation + +uses UDLLManager, UGraphic, UMain, ULanguage, ULog; + +//---------- +//Constructor - Prepares the Class +//---------- +constructor TParty_Session.Create; +begin +// - Nothing in here atm +end; + +//---------- +//StartNewParty - Clears the Class and Prepares for new Party +//---------- +procedure TParty_Session.StartNewParty; +begin +//Set cur Round to Round 1 +CurRound := 255; + +PlayersPlay := Teams.NumTeams; +if isWinner(0,9) then + Log.LogError('Test'); +end; + +//---------- +//GetRandomPlayer - Gives back a Random Player to Play next Round +//---------- +function TParty_Session.GetRandomPlayer(Team: Byte): Byte; +var + I, J: Integer; + lowestTP: Byte; +begin + //Get lowest TP + lowestTP := high(Byte); + J := -1; + for I := 0 to Teams.Teaminfo[Team].NumPlayers do + begin + if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed < lowestTP) then + begin + lowestTP := Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed; + J := I; + end + else if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP) then + begin + J := -1; + end; + end; + + //If more than one Person has lowestTP then Select Random Player + if (J < 0) then + repeat + Result := Random(Teams.Teaminfo[Team].NumPlayers); + until (Teams.Teaminfo[Team].Playerinfo[Result].TimesPlayed = lowestTP) + else //Else Select the one wth lowest TP + Result:= J; +end; + +//---------- +//StartNextRound - Prepares ScreenSingModi for Next Round And Load Plugin +//---------- +procedure TParty_Session.StartRound; +var + I: Integer; +begin + if ((CurRound < high(Rounds)) OR (CurRound = high(CurRound))) then + begin + //Increase Current Round + Inc (CurRound); + + Rounds[CurRound].Winner := 0; + DllMan.LoadPlugin(Rounds[CurRound].Plugin); + + //Select Players + for I := 0 to Teams.NumTeams do + Teams.Teaminfo[I].CurPlayer := GetRandomPlayer(I); + + //Set ScreenSingModie Variables + ScreenSingModi.TeamInfo := Teams; + + //Set + end; +end; + +//---------- +//IsWinner - Returns True if the Players Bit is set in the Winner Byte +//---------- +function TParty_Session.IsWinner(Player, Winner: Byte): boolean; +var + Bit: Byte; +begin + Case Player of + 0: Bit := 1; + 1: Bit := 2; + 2: Bit := 4; + 3: Bit := 8; + 4: Bit := 16; + 5: Bit := 32; + end; + + Result := ((Winner AND Bit) = Bit); +end; + +//---------- +//GenScores - Inc Scores for Cur. Round +//---------- +procedure TParty_Session.GenScores; +var + I: Byte; +begin + for I := 0 to Teams.NumTeams do + begin + if isWinner(I, Rounds[CurRound].Winner) then + Inc(Teams.Teaminfo[I].Score); + end; +end; + +//---------- +//GetWinnerString - Get String with WinnerTeam Name, when there is more than one Winner than Connect with and or , +//---------- +function TParty_Session.GetWinnerString(Round: Byte): String; +var + Winners: Array of String; + I: Integer; +begin + if (Rounds[Round].Winner = 0) then + begin + Result := 'Nobody'; + exit; + end; + + SetLength(Winners, 0); + for I := 0 to Teams.NumTeams do + begin + if isWinner(I, Rounds[Round].Winner) then + begin + SetLength(Winners, Length(Winners) + 1); + Winners[high(Winners)] := Teams.TeamInfo[I].Name; + end; + end; + Result := Language.Implode(Winners); +end; + +//---------- +//EndRound - Get Winner from ScreenSingModi and Save Data to RoundArray +//---------- +procedure TParty_Session.EndRound; +var + I: Integer; +begin + //Copy Winner + Rounds[CurRound].Winner := ScreenSingModi.Winner; + //Set Scores + GenScores; + + //Increase TimesPlayed 4 all Players + For I := 0 to Teams.NumTeams do + Inc(Teams.Teaminfo[I].Playerinfo[Teams.Teaminfo[0].CurPlayer].TimesPlayed); + +end; + +//---------- +//Get Winner - Gives back the Number of the total Winner +//---------- +function TParty_Session.GetWinner: Byte; +begin + +end; + +end. diff --git a/Game/Code/Classes/UPliki.dcu b/Game/Code/Classes/UPliki.dcu new file mode 100644 index 00000000..1798b6f8 Binary files /dev/null and b/Game/Code/Classes/UPliki.dcu differ diff --git a/Game/Code/Classes/UPliki.pas b/Game/Code/Classes/UPliki.pas new file mode 100644 index 00000000..475a3752 --- /dev/null +++ b/Game/Code/Classes/UPliki.pas @@ -0,0 +1,830 @@ +unit UPliki; + +interface + +uses USongs, SysUtils, ULog, UMusic; + +procedure InitializePaths; +function ReadHeader(var Song: TSong): boolean; +function SkanujPlik(var Song: TSong): boolean; +procedure CzyscNuty; +function WczytajCzesci(Name: string): boolean; +function SaveSong(Song: TSong; Czesc: TCzesci; Name: string; Relative: boolean): boolean; +function SaveSongDebug(Song: TSong; Czesc: TCzesci; Name: string; Relative: boolean): boolean; + +var + GamePath: string; + SoundPath: string; + SongPath: string; + LogPath: string; + ThemePath: string; + ScreenshotsPath: string; + CoversPath: string; + LanguagesPath: string; + PluginPath: string; + + Plik: TextFile; // all procedures in this unit operates on this file + PlikC: char; + Lineno: integer; + + // variables available for all procedures + Base: array[0..1] of integer; + Rel: array[0..1] of integer; + Mult: integer; + MultBPM: integer; + +implementation +uses TextGL, UIni, UMain, math; + +procedure InitializePaths; +begin + GamePath := ExtractFilePath(ParamStr(0)); + SoundPath := GamePath + 'Sounds\'; + SongPath := GamePath + 'Songs\'; + LogPath := GamePath; + ThemePath := GamePath + 'Themes\'; + ScreenshotsPath := GamePath + 'Screenshots\'; + CoversPath := GamePath + 'Covers\'; + LanguagesPath := GamePath + 'Languages\'; + //Modi Loader + PluginPath := GamePath + 'Plugins\'; + + DecimalSeparator := ','; +end; + +function ReadHeader(var Song: TSong): boolean; +var + TempC: char; + Tekst: string; + Done: integer; +begin + // clear + Song.Title := ''; + Song.Artist := ''; + Song.Genre := 'Unknown'; + Song.Edition := 'Unknown'; + Song.Language := 'Unknown'; //Language Patch + Song.Mp3 := ''; + Song.BPM := 0; + Song.GAP := 0; + Song.Start := 0; + Song.Finish := 0; + Song.Background := ''; + Song.Video := ''; + Song.VideoGAP := 0; + Song.NotesGAP := 0; + Song.Resolution := 4; + + //Creator Patch + Song.Creator := ''; + + Done := 0; + + //Editor Error Reporting Hack + LineNo := 0; + try + + // read + Read(Plik, PlikC); + while (PlikC = '#') do begin + ReadLn(Plik, Tekst); + + //Editor Error Reporting Hack + Inc (LineNo); + + //Header Improvements Patch + + if UpperCase(Copy(Tekst, 1, 6)) = 'TITLE:' then begin + Delete(Tekst, 1, 6); + Song.Title := Trim(Tekst); + Tekst := ''; + Done := Done or 1; + end + + else if UpperCase(Copy(Tekst, 1, 7)) = 'ARTIST:' then begin + Delete(Tekst, 1, 7); + Song.Artist := Trim(Tekst); + Tekst := ''; + Done := Done or 2; + end + + else if UpperCase(Copy(Tekst, 1, 4)) = 'MP3:' then begin + Delete(Tekst, 1, 4); + Song.Mp3 := Trim(Tekst); + Tekst := ''; + Done := Done or 4; + end + + else if UpperCase(Copy(Tekst, 1, 8)) = 'CREATOR:' then begin // this goes for edit + Delete(Tekst, 1, 8); + Song.Creator := Trim(Tekst); + Tekst := ''; + end + + else if UpperCase(Copy(Tekst, 1, 6)) = 'GENRE:' then begin // this goes for edit + Delete(Tekst, 1, 6); + Song.Genre := Trim(Tekst); + Tekst := ''; + end + + else if UpperCase(Copy(Tekst, 1, 8)) = 'EDITION:' then begin // this goes for edit + Delete(Tekst, 1, 8); + Song.Edition := Trim(Tekst); + Tekst := ''; + end + + else if UpperCase(Copy(Tekst, 1, 9)) = 'LANGUAGE:' then begin // this goes for edit + Delete(Tekst, 1, 9); + Song.Language := Trim(Tekst); + Tekst := ''; + end + + else if UpperCase(Copy(Tekst, 1, 6)) = 'COVER:' then begin + Delete(Tekst, 1, 6); + Song.Cover := Trim(Tekst); + Tekst := ''; + end + + else if UpperCase(Copy(Tekst, 1, 11)) = 'BACKGROUND:' then begin + Delete(Tekst, 1, 11); + Song.Background := Trim(Tekst); + Tekst := ''; + end + + else if UpperCase(Copy(Tekst, 1, 6)) = 'VIDEO:' then begin + Delete(Tekst, 1, 6); + Song.Video := Trim(Tekst); + Tekst := ''; + end + + else if UpperCase(Copy(Tekst, 1, 9)) = 'VIDEOGAP:' then begin + Delete(Tekst, 1, 9); + + //Change . to , Mod by Whiteshark :P + if (Pos('.',Tekst) <> 0) then + begin + Tekst[Pos('.',Tekst)] := ','; + //Little Annonce for the User + Log.LogError('VideoGap Seperator wrong in SongHeader: ' + Song.FileName + ' [Corrected for this Session]'); + end; + + Song.VideoGAP := StrToFloat(Tekst); + Tekst := '' + end + + else if UpperCase(Copy(Tekst, 1, 9)) = 'NOTESGAP:' then begin + Delete(Tekst, 1, 9); + Song.NotesGAP := StrToInt(Tekst); + Tekst := '' + end + + else if UpperCase(Copy(Tekst, 1, 9)) = 'RELATIVE:' then begin + Delete(Tekst, 1, 9); + if LowerCase(Tekst) = 'yes' then Song.Relative := true; + end + + else if UpperCase(Copy(Tekst, 1, 6)) = 'START:' then begin + Delete(Tekst, 1, 6); + Song.Start := StrToFloat(Tekst); +// Muzyka.Start := StrToInt(Tekst); + end + + else if UpperCase(Copy(Tekst, 1, 4)) = 'END:' then begin + Delete(Tekst, 1, 4); + Song.Finish := StrToInt(Tekst); + end + + else if UpperCase(Copy(Tekst, 1, 11)) = 'RESOLUTION:' then begin + Delete(Tekst, 1, 11); + Song.Resolution := StrToInt(Tekst); + end + + else if UpperCase(Copy(Tekst, 1, 4)) = 'BPM:' then begin + Delete(Tekst, 1, 4); + +// Muzyka.BPMOld := StrToFloat(Tekst) * Mult * MultBPM; // old system + + (* new system with variable BPM *) +// Muzyka.BPMOld := 50; + + //Change . to , Mod by Whiteshark :P + if (Pos('.',Tekst) <> 0) then + begin + Tekst[Pos('.',Tekst)] := ','; + //Little Annonce for the User + Log.LogError('BPM Seperator wrong in SongHeader: ' + Song.FileName + ' [Corrected for this Session]'); + end; + + SetLength(Song.BPM, 1); + Song.BPM[0].StartBeat := 0; + Song.BPM[0].BPM := StrToFloat(Tekst) * Mult * MultBPM; + Tekst := ''; + Done := Done or 8; + end + + else if UpperCase(Copy(Tekst, 1, 4)) = 'GAP:' then begin + Delete(Tekst, 1, 4); + Song.GAP := StrToFloat(Tekst); + Tekst := ''; +// Muzyka.GAP := StrToFloat(Tekst); +// Done := Done or 16; + end; + + //Header Improvements Patch Ende + + Read(Plik, PlikC); + end; + + //Editor Error Reporting Hack + except //An Error happened<- bad english :P + Log.LogError('An Error occured reading Line ' + inttostr(LineNo) + ' from SongHeader: ' + Song.FileName); + Halt; + end; + //Editor Error Reporting Hack End + + if Song.Background = '' then begin + Song.Background := Songs.FindSongFile(Song.Path, '*[BG].jpg'); + end; + + if (Done and 15) = 15 then Result := true + else Result := false; +end; + +function SkanujPlik(var Song: TSong): boolean; +var + Done: integer; + Tekst: string; + C: integer; // category + P: integer; // position +begin +// try + AssignFile(Plik, Song.Path + Song.FileName); + Reset(Plik); + + Result := ReadHeader(Song); + +{ ReadLn(Plik, Tekst); + while (Copy(Tekst, 1, 1) = '#') do begin + if Copy(Tekst, 1, 10) = '#CATEGORY:' then begin + Delete(Tekst, 1, 10); + + Trim(Tekst); + while (Length(Tekst) > 0) do begin + C := Length(Song.Category); + SetLength(Song.Category, C+1); + + P := Pos(',', Tekst); + if P = 0 then P := Length(Tekst); + Song.Category[C] := Copy(Tekst, 1, P); + + Delete(Tekst, 1, P); + Trim(Tekst); + end; + + end;} + + +end; + +procedure CzyscNuty; +var + Pet: integer; +begin + SetLength(Czesci, Length(Player)); + SetLength(AktSong.BPM, 0); + for Pet := 0 to High(Player) do begin + SetLength(Czesci[Pet].Czesc, 1); + SetLength(Czesci[Pet].Czesc[0].Nuta, 0); + Czesci[Pet].Czesc[0].Lyric := ''; + Czesci[Pet].Czesc[0].LyricWidth := 0; + Player[pet].Score := 0; + Player[pet].IlNut := 0; + Player[pet].HighNut := -1; + end; +end; + +procedure DodajNute(NrCzesci: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string); +var + Space: boolean; +begin + case Ini.Solmization of + 1: // european + begin + case (NoteP mod 12) of + 0..1: LyricS := ' do '; + 2..3: LyricS := ' re '; + 4: LyricS := ' mi '; + 5..6: LyricS := ' fa '; + 7..8: LyricS := ' sol '; + 9..10: LyricS := ' la '; + 11: LyricS := ' si '; + end; + end; + 2: // japanese + begin + case (NoteP mod 12) of + 0..1: LyricS := ' do '; + 2..3: LyricS := ' re '; + 4: LyricS := ' mi '; + 5..6: LyricS := ' fa '; + 7..8: LyricS := ' so '; + 9..10: LyricS := ' la '; + 11: LyricS := ' shi '; + end; + end; + 3: // american + begin + case (NoteP mod 12) of + 0..1: LyricS := ' do '; + 2..3: LyricS := ' re '; + 4: LyricS := ' mi '; + 5..6: LyricS := ' fa '; + 7..8: LyricS := ' sol '; + 9..10: LyricS := ' la '; + 11: LyricS := ' ti '; + end; + end; + end; // case + +// Log.LogStatus('Czesc: ' + IntToStr(Czesci[NrCzesci].High), 'DodajNute'); +// Log.LogStatus('Dodano: [' + IntToStr(NrCzesci) + '] ' + IntToStr(StartP) + ' ' +// + IntToStr(DurationP) + ' '+ IntToStr(NoteP) + ' ' + LyricS, 'DodajNute'); + +{ Delete(LyricS, 1, 1); + Space := false; + if Copy(LyricS, Length(LyricS), 1) = ' ' then begin + Space := true; + Delete(LyricS, Length(LyricS), 1); + end; + if LyricS = 'a' then LyricS := chr($B1); + if LyricS = 'i' then LyricS := chr($B2); + if LyricS = 'u' then LyricS := chr($B3); + if LyricS = 'e' then LyricS := chr($B4); + if LyricS = 'o' then LyricS := chr($B5); + + if LyricS = 'ka' then LyricS := chr($B6); + if LyricS = 'ki' then LyricS := chr($B7); + if LyricS = 'ku' then LyricS := chr($B8); + if LyricS = 'ke' then LyricS := chr($B9); + if LyricS = 'ko' then LyricS := chr($BA); + + if LyricS = 'ga' then LyricS := chr($B6) + chr($DE); + if LyricS = 'gi' then LyricS := chr($B7) + chr($DE); + if LyricS = 'gu' then LyricS := chr($B8) + chr($DE); + if LyricS = 'ge' then LyricS := chr($B9) + chr($DE); + if LyricS = 'go' then LyricS := chr($BA) + chr($DE); + + if LyricS = 'sa' then LyricS := chr($BB); + if LyricS = 'shi' then LyricS := chr($BC); + if LyricS = 'su' then LyricS := chr($BD); + if LyricS = 'se' then LyricS := chr($BE); + if LyricS = 'so' then LyricS := chr($BF); + + if LyricS = 'za' then LyricS := chr($BB) + chr($DE); + if LyricS = 'ji' then LyricS := chr($BC) + chr($DE); + if LyricS = 'zu' then LyricS := chr($BD) + chr($DE); + if LyricS = 'ze' then LyricS := chr($BE) + chr($DE); + if LyricS = 'zo' then LyricS := chr($BF) + chr($DE); + + if LyricS = 'ta' then LyricS := chr($C0); + if LyricS = 'chi' then LyricS := chr($C1); + if LyricS = 'tsu' then LyricS := chr($C2); + if LyricS = 'te' then LyricS := chr($C3); + if LyricS = 'to' then LyricS := chr($C4); + + if LyricS = 'da' then LyricS := chr($C0) + chr($DE); +// if LyricS = 'ji' then LyricS := chr($C1) + chr($DE); +// if LyricS = 'zu' then LyricS := chr($C2) + chr($DE); + if LyricS = 'de' then LyricS := chr($C3) + chr($DE); + if LyricS = 'do' then LyricS := chr($C4) + chr($DE); + + if LyricS = 'na' then LyricS := chr($C5); + if LyricS = 'ni' then LyricS := chr($C6); + if LyricS = 'nu' then LyricS := chr($C7); + if LyricS = 'ne' then LyricS := chr($C8); + if LyricS = 'no' then LyricS := chr($C9); + + if LyricS = 'ha' then LyricS := chr($CA); + if LyricS = 'hi' then LyricS := chr($CB); + if LyricS = 'hu' then LyricS := chr($CC); + if LyricS = 'he' then LyricS := chr($CD); + if LyricS = 'ho' then LyricS := chr($CE); + + if LyricS = 'ba' then LyricS := chr($CA) + chr($DE); + if LyricS = 'bi' then LyricS := chr($CB) + chr($DE); + if LyricS = 'bu' then LyricS := chr($CC) + chr($DE); + if LyricS = 'be' then LyricS := chr($CD) + chr($DE); + if LyricS = 'bo' then LyricS := chr($CE) + chr($DE); + + if LyricS = 'pa' then LyricS := chr($CA) + chr($DF); + if LyricS = 'pi' then LyricS := chr($CB) + chr($DF); + if LyricS = 'pu' then LyricS := chr($CC) + chr($DF); + if LyricS = 'pe' then LyricS := chr($CD) + chr($DF); + if LyricS = 'po' then LyricS := chr($CE) + chr($DF); + + if LyricS = 'ma' then LyricS := chr($CF); + if LyricS = 'mi' then LyricS := chr($D0); + if LyricS = 'mu' then LyricS := chr($D1); + if LyricS = 'me' then LyricS := chr($D2); + if LyricS = 'mo' then LyricS := chr($D3); + + if LyricS = 'ya' then LyricS := chr($D4); + if LyricS = 'yu' then LyricS := chr($D5); + if LyricS = 'yo' then LyricS := chr($D6); + + if LyricS = 'ra' then LyricS := chr($D7); + if LyricS = 'ri' then LyricS := chr($D8); + if LyricS = 'ru' then LyricS := chr($D9); + if LyricS = 're' then LyricS := chr($DA); + if LyricS = 'ro' then LyricS := chr($DB); + + if LyricS = 'wa' then LyricS := chr($DC); + if LyricS = 'n' then LyricS := chr($DD); + + LyricS := ' ' + LyricS; + if Space then LyricS := LyricS + ' ';} + + + + with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].High] do begin + SetLength(Nuta, Length(Nuta) + 1); + IlNut := IlNut + 1; + HighNut := HighNut + 1; + Muzyka.IlNut := Muzyka.IlNut + 1; + + Nuta[HighNut].Start := StartP; + if IlNut = 1 then begin + StartNote := Nuta[HighNut].Start; + if Czesci[NrCzesci].Ilosc = 1 then + Start := -100; +// Start := Nuta[HighNut].Start; + end; + + Nuta[HighNut].Dlugosc := DurationP; + Muzyka.DlugoscNut := Muzyka.DlugoscNut + Nuta[HighNut].Dlugosc; + + // back to the normal system with normal, golden and now freestyle notes + case TypeP of + 'F': Nuta[HighNut].Wartosc := 0; + ':': Nuta[HighNut].Wartosc := 1; + '*': Nuta[HighNut].Wartosc := 2; + end; + Czesci[NrCzesci].Wartosc := Czesci[NrCzesci].Wartosc + Nuta[HighNut].Dlugosc * Nuta[HighNut].Wartosc; + + Nuta[HighNut].Ton := NoteP; + if Nuta[HighNut].Ton < Base[NrCzesci] then Base[NrCzesci] := Nuta[HighNut].Ton; + Nuta[HighNut].TonGamy := Nuta[HighNut].TonGamy mod 12; + + Nuta[HighNut].Tekst := Copy(LyricS, 2, 100); + Lyric := Lyric + Nuta[HighNut].Tekst; + + if TypeP = 'F' then + Nuta[HighNut].FreeStyle := true; + + Koniec := Nuta[HighNut].Start + Nuta[HighNut].Dlugosc; + end; // with +end; + +procedure NewSentence(NrCzesciP: integer; Param1, Param2: integer); +var +I: Integer; +begin +// Log.LogStatus('IlCzesci: ' + IntToStr(Czesci[NrCzesciP].Ilosc), 'NewSentece'); +// Log.LogStatus('Dane: ' + IntToStr(NrCzesciP) + ' ' + IntToStr(Param1) + ' ' + IntToStr(Param2) , 'NewSentece'); + + // stara czesc //Alter Satz //Update Old Part + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].BaseNote := Base[NrCzesciP]; + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].LyricWidth := glTextWidth(PChar(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Lyric)); + + //Total Notes Patch + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes := 0; + for I := low(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta) to high(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta) do + begin + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes := Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta[I].Dlugosc * Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta[I].Wartosc; + end; + //Log.LogError('Total Notes(' + inttostr(Czesci[NrCzesciP].High) +'): ' + inttostr(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes)); + //Total Notes Patch End + + + // nowa czesc //Neuer Satz //Update New Part + SetLength(Czesci[NrCzesciP].Czesc, Czesci[NrCzesciP].Ilosc + 1); + Czesci[NrCzesciP].High := Czesci[NrCzesciP].High + 1; + Czesci[NrCzesciP].Ilosc := Czesci[NrCzesciP].Ilosc + 1; + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].HighNut := -1; + + if not AktSong.Relative then + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Start := Param1; + + if AktSong.Relative then begin + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Start := Param1; + Rel[NrCzesciP] := Rel[NrCzesciP] + Param2; + end; + + Base[NrCzesciP] := 100; // high number +end; + +function WczytajCzesci(Name: string): boolean; +var + TempC: char; + Tekst: string; + CP: integer; // Current Player (0 or 1) + Pet: integer; + Both: boolean; + Param1: integer; + Param2: integer; + Param3: integer; + ParamS: string; + I: Integer; +begin + Result := false; + + if not FileExists(Name) then begin + Log.LogError('File not found: "' + Name + '"', 'WczytajCzesci'); + exit; + end; + + try + MultBPM := 4; // 4 - mnoznik dla czasu nut + Mult := 1; // 4 - dokladnosc pomiaru nut + Base[0] := 100; // high number +// Base[1] := 100; // high number + Czesci[0].Wartosc := 0; +// Czesci[1].Wartosc := 0; // here was the error in 0.3.2 + AktSong.Relative := false; + + Rel[0] := 0; +// Rel[1] := 0; + CP := 0; + Both := false; + if Length(Player) = 2 then Both := true; + + FileMode := fmOpenRead; + AssignFile(Plik, Name); + Reset(Plik); + + ReadHeader(AktSong); +(* if AktSong.Title = 'Hubba Hubba Zoot Zoot' then begin + Mult := 2; + AktSong.BPM[0].BPM := AktSong.BPM[0].BPM * 2; + end;*) + + SetLength(Czesci, 2); + for Pet := 0 to High(Czesci) do begin + SetLength(Czesci[Pet].Czesc, 1); + Czesci[Pet].High := 0; + Czesci[Pet].Ilosc := 1; + Czesci[Pet].Akt := 0; + Czesci[Pet].Resolution := AktSong.Resolution; + Czesci[Pet].NotesGAP := AktSong.NotesGAP; + Czesci[Pet].Czesc[0].IlNut := 0; + Czesci[Pet].Czesc[0].HighNut := -1; + end; + +// TempC := ':'; + TempC := PlikC; // read from backup variable, don't use default ':' value + + while (TempC <> 'E') do begin + Inc(LineNo); + if (TempC = ':') or (TempC = '*') or (TempC = 'F') then begin + // wczytuje nute + Read(Plik, Param1); + Read(Plik, Param2); + Read(Plik, Param3); + Read(Plik, ParamS); + + // dodaje nute + if not Both then + // P1 + DodajNute(0, TempC, (Param1+Rel[0]) * Mult, Param2 * Mult, Param3, ParamS) + else begin + // P1 + P2 + DodajNute(0, TempC, (Param1+Rel[0]) * Mult, Param2 * Mult, Param3, ParamS); + DodajNute(1, TempC, (Param1+Rel[1]) * Mult, Param2 * Mult, Param3, ParamS); + end; + end; // if + if TempC = '-' then begin + // reads sentence + Read(Plik, Param1); + if AktSong.Relative then Read(Plik, Param2); // read one more data for relative system + + // new sentence + if not Both then + // P1 + NewSentence(0, (Param1 + Rel[0]) * Mult, Param2) + else begin + // P1 + P2 + NewSentence(0, (Param1 + Rel[0]) * Mult, Param2); + NewSentence(1, (Param1 + Rel[1]) * Mult, Param2); + end; + + end; // if + + if TempC = 'B' then begin + SetLength(AktSong.BPM, Length(AktSong.BPM) + 1); + Read(Plik, AktSong.BPM[High(AktSong.BPM)].StartBeat); + AktSong.BPM[High(AktSong.BPM)].StartBeat := AktSong.BPM[High(AktSong.BPM)].StartBeat + Rel[0]; + + Read(Plik, Tekst); + AktSong.BPM[High(AktSong.BPM)].BPM := StrToFloat(Tekst); + AktSong.BPM[High(AktSong.BPM)].BPM := AktSong.BPM[High(AktSong.BPM)].BPM * Mult * MultBPM; + end; + + + if not Both then begin + Czesci[CP].Czesc[Czesci[CP].High].BaseNote := Base[CP]; + Czesci[CP].Czesc[Czesci[CP].High].LyricWidth := glTextWidth(PChar(Czesci[CP].Czesc[Czesci[CP].High].Lyric)); + //Total Notes Patch + Czesci[CP].Czesc[Czesci[CP].High].TotalNotes := 0; + for I := low(Czesci[CP].Czesc[Czesci[CP].High].Nuta) to high(Czesci[CP].Czesc[Czesci[CP].High].Nuta) do + begin + Czesci[CP].Czesc[Czesci[CP].High].TotalNotes := Czesci[CP].Czesc[Czesci[CP].High].TotalNotes + Czesci[CP].Czesc[Czesci[CP].High].Nuta[I].Dlugosc * Czesci[CP].Czesc[Czesci[CP].High].Nuta[I].Wartosc; + end; + //Total Notes Patch End + end else begin + for Pet := 0 to High(Czesci) do begin + Czesci[Pet].Czesc[Czesci[Pet].High].BaseNote := Base[Pet]; + Czesci[Pet].Czesc[Czesci[Pet].High].LyricWidth := glTextWidth(PChar(Czesci[Pet].Czesc[Czesci[Pet].High].Lyric)); + //Total Notes Patch + Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes := 0; + for I := low(Czesci[Pet].Czesc[Czesci[Pet].High].Nuta) to high(Czesci[Pet].Czesc[Czesci[Pet].High].Nuta) do + begin + Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes := Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes + Czesci[Pet].Czesc[Czesci[Pet].High].Nuta[I].Dlugosc * Czesci[Pet].Czesc[Czesci[Pet].High].Nuta[I].Wartosc; + end; + //Total Notes Patch End + end; + end; + + Read(Plik, TempC); + end; // while} + + CloseFile(Plik); + except + Log.LogError('Error Loading File: "' + Name + '" in Line ' + inttostr(LineNo)); + exit; + end; + + Result := true; +end; + +function SaveSong(Song: TSong; Czesc: TCzesci; Name: string; Relative: boolean): boolean; +var + C: integer; + N: integer; + S: string; + B: integer; + RelativeSubTime: integer; + NoteState: String; + +begin +// Relative := true; // override (idea - use shift+S to save with relative) + AssignFile(Plik, Name); + Rewrite(Plik); + + WriteLn(Plik, '#TITLE:' + Song.Title + ''); + WriteLn(Plik, '#ARTIST:' + Song.Artist); + + if Song.Creator <> '' then WriteLn(Plik, '#CREATOR:' + Song.Creator); + if Song.Edition <> 'Unknown' then WriteLn(Plik, '#EDITION:' + Song.Edition); + if Song.Genre <> 'Unknown' then WriteLn(Plik, '#GENRE:' + Song.Genre); + if Song.Language <> 'Unknown' then WriteLn(Plik, '#LANGUAGE:' + Song.Language); + if Song.Cover <> '' then WriteLn(Plik, '#COVER:' + Song.Cover); + + WriteLn(Plik, '#MP3:' + Song.Mp3); + + if Song.Background <> '' then WriteLn(Plik, '#BACKGROUND:' + Song.Background); + if Song.Video <> '' then WriteLn(Plik, '#VIDEO:' + Song.Video); + if Song.VideoGAP <> 0 then WriteLn(Plik, '#VIDEOGAP:' + FloatToStr(Song.VideoGAP)); + if Song.Resolution <> 4 then WriteLn(Plik, '#RESOLUTION:' + IntToStr(Song.Resolution)); + if Song.NotesGAP <> 0 then WriteLn(Plik, '#NOTESGAP:' + IntToStr(Song.NotesGAP)); + if Song.Start <> 0 then WriteLn(Plik, '#START:' + FloatToStr(Song.Start)); + if Song.Finish <> 0 then WriteLn(Plik, '#END:' + IntToStr(Song.Finish)); + if Relative then WriteLn(Plik, '#RELATIVE:yes'); + + WriteLn(Plik, '#BPM:' + FloatToStr(Song.BPM[0].BPM / 4)); + WriteLn(Plik, '#GAP:' + FloatToStr(Song.GAP)); + + RelativeSubTime := 0; + for B := 1 to High(AktSong.BPM) do + WriteLn(Plik, 'B ' + FloatToStr(AktSong.BPM[B].StartBeat) + ' ' + FloatToStr(AktSong.BPM[B].BPM/4)); + + for C := 0 to Czesc.High do begin + for N := 0 to Czesc.Czesc[C].HighNut do begin + with Czesc.Czesc[C].Nuta[N] do begin + + + //Golden + Freestyle Note Patch + case Czesc.Czesc[C].Nuta[N].Wartosc of + 0: NoteState := 'F '; + 1: NoteState := ': '; + 2: NoteState := '* '; + end; // case + S := NoteState + IntToStr(Start-RelativeSubTime) + ' ' + IntToStr(Dlugosc) + ' ' + IntToStr(Ton) + ' ' + Tekst; + + + WriteLn(Plik, S); + end; // with + end; // N + + if C < Czesc.High then begin // don't write end of last sentence + if not Relative then + S := '- ' + IntToStr(Czesc.Czesc[C+1].Start) + else begin + S := '- ' + IntToStr(Czesc.Czesc[C+1].Start - RelativeSubTime) + + ' ' + IntToStr(Czesc.Czesc[C+1].Start - RelativeSubTime); + RelativeSubTime := Czesc.Czesc[C+1].Start; + end; + WriteLn(Plik, S); + end; + + end; // C + + + WriteLn(Plik, 'E'); + CloseFile(Plik); +end; + +function SaveSongDebug(Song: TSong; Czesc: TCzesci; Name: string; Relative: boolean): boolean; +var + C: integer; + N: integer; + S: string; + STon: integer; + SLen: integer; + NTot: integer; + PlikB: TextFile; + LastTime: integer; +begin + AssignFile(Plik, Name); + Rewrite(Plik); + + AssignFile(PlikB, 'C:\song db.asm'); + Rewrite(PlikB); + + NTot := 0; + LastTime := 0; + + for C := 0 to Czesc.High do begin + WriteLn(Plik, '; ' + IntToStr(C)); + + for N := 0 to Czesc.Czesc[C].HighNut do begin + with Czesc.Czesc[C].Nuta[N] do begin + + // timespace + if LastTime < Start then begin + STon := 0; + SLen := Round((Start - LastTime) * 16320 / 255 / 12); + WriteLn(PlikB, ' .dw ' + IntToStr(STon + SLen*256) + ' ; timespace (0, ' + IntToStr(SLen) + ')'); + + end; + + + + // ton + STon := Round(98940/(2*261.62*Power(1.05946309436, Ton))); + S := ' ldi R18, ' + IntToStr(STon); + if STon > 255 then begin + beep; + S := '!!!!' + S; + end; + WriteLn(Plik, S); + + // length + //ldi R19, 43 + SLen := Round(Dlugosc * 16320 / STon / 12); + S := ' ldi R19, ' + IntToStr(SLen); + if SLen > 255 then begin + beep; + S := '!!!!' + S; + end; + WriteLn(Plik, S); + + // function + S := ' rcall playtone'; + WriteLn(Plik, S); + + // song dw + WriteLn(PlikB, ' .dw ' + IntToStr(STon + SLen*256)); + + + LastTime := Start + Dlugosc; + Inc(NTot); + + end; // with + end; // N + WriteLn(Plik, ''); + WriteLn(PlikB, ''); + end; // C + + WriteLn(Plik, '; nut ' + IntToStr(NTot)); + WriteLn(Plik, '; bajtów ' + IntToStr(8*NTot)); + + WriteLn(PlikB, ' .dw 0'); + WriteLn(PlikB, '; nut ' + IntToStr(NTot)); + WriteLn(PlikB, '; bajtów ' + IntToStr(2*NTot)); + + + CloseFile(Plik); + CloseFile(PlikB); +end; + +end. diff --git a/Game/Code/Classes/URecord.dcu b/Game/Code/Classes/URecord.dcu new file mode 100644 index 00000000..d28aa4b1 Binary files /dev/null and b/Game/Code/Classes/URecord.dcu differ diff --git a/Game/Code/Classes/URecord.pas b/Game/Code/Classes/URecord.pas new file mode 100644 index 00000000..2ec5439a --- /dev/null +++ b/Game/Code/Classes/URecord.pas @@ -0,0 +1,371 @@ +unit URecord; + +interface +uses Classes, Math, SysUtils, {DXSounds, Wave, }UMusic, UIni, BASS; + +type + TSound = class + BufferNew: TMemoryStream; // buffer for newest sample + BufferArray: array[1..4096] of smallint; // (Signal) newest 4096 samples + BufferLong: array of TMemoryStream; // full buffer + + Num: integer; + n: integer; // length of Signal to analyze +// Spectrum: array[1..8192] of single; // sound buffer from above as FFT +// Spektogram: array[0..100] of TSpekt; // FFT(t) + + // pitch detection + SzczytJest: boolean; // czy jest szczyt + Szczyt: integer; // pozycja szczytu na osi poziomej + TonDokl: real; // ton aktualnego szczytu + Ton: integer; // ton bez ulamka + TonGamy: integer; // ton w gamie. wartosci: 0-11 + Skala: real; // skala FFT + + // procedures + procedure ProcessNewBuffer; + procedure AnalizujBufor; // use to analyze sound from buffers to get new pitch + procedure AnalizujByAutocorrelation; // we call it to analyze sound by checking Autocorrelation + function AnalyzeAutocorrelationFreq(Freq: real): real; // use this to check one frequency by Autocorrelation + end; + + TSoundCardInput = record + Name: string; + end; + + TSoundCard = record + // here can be the soundcard information - whole database from which user will select recording source + Description: string; + Input: array of TSoundCardInput; + InputSeleceted: integer; + + // bass record + BassRecordStream: hStream; + end; + + TRecord = class + SoundCard: array of TSoundCard; + constructor Create; + end; + + smallintarray = array [0..maxInt shr 1-1] of smallInt; + psmallintarray = ^smallintarray; + + // procedures - bass record + function GetMicrophone(handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD): boolean; stdcall; + + +var + Sound: array of TSound; + SoundCard: array of TSoundCard; + Poz: integer; + Recording: TRecord; + +implementation +uses UMain, ULog; + +procedure TSound.ProcessNewBuffer; +var + S: integer; + L: integer; + A: integer; +begin + // process BufferArray + S := 0; + L := BufferNew.Size div 2; + if L > n then begin + S := L - n; + L := n; + end; + + // copy to array + for A := L+1 to n do + BufferArray[A-L] := BufferArray[A]; + + BufferNew.Seek(2*S, soBeginning); + BufferNew.ReadBuffer(BufferArray[1+n-L], 2*L); + + // process BufferLong + if Ini.SavePlayback = 1 then begin + BufferNew.Seek(0, soBeginning); + BufferLong[0].CopyFrom(BufferNew, BufferNew.Size); + end; +end; + +procedure TSound.AnalizujBufor; +begin + AnalizujByAutocorrelation; +end; + +procedure TSound.AnalizujByAutocorrelation; +var + T: integer; // tone + F: real; // freq + Wages: array[0..35] of real; // wages + MaxT: integer; // max tone + MaxW: real; // max wage + V: real; // volume + MaxV: real; // max volume + S: integer; // Signal + Threshold: real; // threshold +begin +// Log.LogAnalyze('[Analyze by Autocorrelation]'); + SzczytJest := false; + + // find maximum volume of first 1024 words of signal + MaxV := 0; + for S := 1 to 1024 do begin // 0.5.2: fix. was from 0 to 1023 +// Log.LogDebug('1'); +// Log.LogDebug(IntTostr(S)); + V := Abs(BufferArray[S]) / $10000; +// Log.LogDebug('2'); +// Log.LogDebug(IntTostr(S) + ': ' + FloatToStr(V) + ', MaxV='+floattostr(maxv)+', buf='+inttostr(length(BufferArray))); + if V > MaxV then MaxV := V; +// Log.LogDebug('3'); +// Log.LogDebug(IntTostr(S) + ': ' + FloatToStr(V) + ', MaxV='+floattostr(maxv)+', buf='+inttostr(length(BufferArray))); + end; + + + // prepare to analyze + MaxW := 0; + + // analyze all 12 halftones + for T := 0 to 35 do begin // to 11, then 23, now 35 (for Whitney and my high voice) + F := 130.81*Power(1.05946309436, T)/2; // let's analyze below 130.81 + Wages[T] := AnalyzeAutocorrelationFreq(F); + + if Wages[T] > MaxW then begin // this frequency has better wage + MaxW := Wages[T]; + MaxT := T; + end; + end; // for T + + Threshold := 0.1; + case Ini.Threshold of + 0: Threshold := 0.05; + 1: Threshold := 0.1; + 2: Threshold := 0.15; + 3: Threshold := 0.2; + end; + + //Log.LogDebug('Sound -> AnalyzeByAutocorrelation: MaxV='+floattostr(maxv)+', Threshold='+floattostr(threshold)); + if MaxV >= Threshold then begin // found acceptable volume // 0.1 + SzczytJest := true; + TonGamy := MaxT mod 12; + Ton := MaxT mod 12; + end; + +// Log.LogAnalyze('--> Weight: ') +// Log.LogAnalyze('--> Selected: ' + BoolToStr(SzczytJest, true) + +// ', TonGamy: ' + IntToStr(Ton) + +// ', MaxV: ' + FloatToStr(MaxV)); +// Log.LogAnalyze(''); + + +end; + +function TSound.AnalyzeAutocorrelationFreq(Freq: real): real; // result medium difference +var + Count: real; + Src: integer; + Dst: integer; + Move: integer; + Il: integer; // how many counts were done +begin + // we use Signal as source + Count := 0; + Il := 0; + Src := 1; + Move := Round(44100/Freq); + Dst := Src + Move; + + // ver 1 - sample 1 and compare n-times +{ while (Src <= Move) do begin // process by moving Src by one + while (Dst < n) do begin // process up to n (4KB) of Signal + Count := Count + Abs(Signal[Src] - Signal[Dst]) / $10000; + Inc(Dst, Move); + Inc(Il); + end; + + Inc(Src); + Dst := Src + Move; + end;} + + // ver 2 - compare in vertical + while (Dst < n) do begin // process up to n (4KB) of Signal + Count := Count + Abs(BufferArray[Src] - BufferArray[Dst]) / $10000; + Inc(Src); + Inc(Dst); + Inc(Il); + end; + + Result := 1 - Count / Il; +end; + +function GetMicrophone(handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD): boolean; stdcall; +var + L: integer; + S: integer; + PB: pbytearray; + PW: pwordarray; + SI: smallintarray; + PSI: psmallintarray; + I: integer; + Skip: integer; + P1: integer; + P2: integer; + Boost: byte; +begin +// Log.LogDebug('Record -> GetMicrophone: len='+inttstr(len)); + + // set boost + case Ini.MicBoost of + 0: Boost := 1; + 1: Boost := 2; + 2: Boost := 4; + 3: Boost := 8; + end; + + // boost buffer + L := Len div 2; // number of samples + PSI := Buffer; + for S := 0 to L-1 do begin + I := PSI^[S] * Boost; + if I > 32767 then I := 32767; // 0.5.0: limit + if I < -32768 then I := -32768; // 0.5.0: limit + PSI^[S] := I; + end; + + // decode user + P1 := (user and 255) - 1; + P2 := (user div 256) - 1; + +// Log.LogDebug('Record -> GetMicrophone: P1='+inttostr(p1)+', P2='+inttostr(p2)); + + // 2 players USB mic, left channel + if P1 >= 0 then begin + L := Len div 4; // number of samples + PB := Buffer; +// Log.LogDebug('Record -> GetMicrophone -> Sound[P1].BufferNew.Clear'); + Sound[P1].BufferNew.Clear; // 0.5.2: problem on exiting + for S := 1 to L do begin + Sound[P1].BufferNew.Write(PB[(S-1)*4], 2); + end; + Sound[P1].ProcessNewBuffer; + end; + + // 2 players USB mic, right channel +// if Ini.Debug = 0 then Skip := 2 +// else Skip := 0; + Skip := 2; + + if P2 >= 0 then begin + L := Len div 4; // number of samples + PB := Buffer; + Sound[P2].BufferNew.Clear; + for S := 1 to L do begin + Sound[P2].BufferNew.Write(PB[Skip + (S-1)*4], 2); + end; + Sound[P2].ProcessNewBuffer; + end; + +// Log.LogDebug('Record -> GetMicrophone -> Finish'); + + Result := true; +end; + +constructor TRecord.Create; +var + SC: integer; // soundcard + SCI: integer; // soundcard input + Descr: string; + InputName: string; + Flags: integer; + No: integer; + function isDuplicate(Desc: String): Boolean; + var + I: Integer; + begin + Result := False; + //Check for Soundcard with same Description + For I := 0 to SC-1 do + begin + if (SoundCard[I].Description = Desc) then + begin + Result := True; + Break; + end; + end; + end; + +// mic: array[0..15] of integer; +begin + // checks for recording devices and puts them into array; + SetLength(SoundCard, 0); + + SC := 0; + Descr := BASS_RecordGetDeviceDescription(SC); + + while (Descr <> '') do begin + + //If there is another SoundCard with the Same ID, Search an available Name + if (IsDuplicate(Descr)) then + begin + No:= 1; //Count of SoundCards with same Name + Repeat + Inc(No) + Until not IsDuplicate(Descr + ' (' + InttoStr(No) + ')'); + //Set Description + Descr := Descr + ' (' + InttoStr(No) + ')'; + end; + + SetLength(SoundCard, SC+1); +// Log.LogError('Device #' + IntToStr(SC+1) + ': ' + Descr); + SoundCard[SC].Description := Descr; + + // check for recording inputs +// mic[device] := -1; // default to no change + SCI := 0; + BASS_RecordInit(SC); + Flags := BASS_RecordGetInput(SCI); + InputName := BASS_RecordGetInputName(SCI); +// Log.LogError('Input #' + IntToStr(SCI) + ' (' + IntToStr(Flags) + '): ' + InputName); + + SetLength(SoundCard[SC].Input, 1); + SoundCard[SC].Input[SCI].Name := InputName; + + // process each input + while (Flags <> -1) do begin + if SCI >= 1 then begin + SetLength(SoundCard[SC].Input, SCI+1); + InputName := BASS_RecordGetInputName(SCI); + SoundCard[SC].Input[SCI].Name := InputName; +// Log.LogError('Input #' + IntToStr(SCI) + ' (' + IntToStr(Flags) + '): ' + InputName); + end; + +{ if (flags and BASS_INPUT_TYPE_MASK) = BASS_INPUT_TYPE_MIC then begin + mic[device] := input; // auto set microphone + end;} + + Inc(SCI); + Flags := BASS_RecordGetInput(SCI); + end; + +{ if mic[device] <> -1 then begin + Log.LogAnalyze('Found the mic at input ' + IntToStr(Mic[device])) + end else begin + Log.LogAnalyze('Mic not found'); + mic[device] := 0; // setting to the first one (for kxproject) + end; + SoundCard[SC].InputSeleceted := Mic[Device];} + + + BASS_RecordFree; + + Inc(SC); + Descr := BASS_RecordGetDeviceDescription(SC); + end; // while +end; +end. + + diff --git a/Game/Code/Classes/UScores.dcu b/Game/Code/Classes/UScores.dcu new file mode 100644 index 00000000..16454265 Binary files /dev/null and b/Game/Code/Classes/UScores.dcu differ diff --git a/Game/Code/Classes/UScores.pas b/Game/Code/Classes/UScores.pas new file mode 100644 index 00000000..f1243868 --- /dev/null +++ b/Game/Code/Classes/UScores.pas @@ -0,0 +1,144 @@ +unit UScores; + +interface + +uses USongs, SQLiteTable3; + +procedure InitScore(const Filename: string); +procedure ReadScore(var Song: TSong); +procedure WriteScore(var Song: TSong); +procedure AddScore(var Song: TSong; Level: integer; Name: string; Score: integer); + +var +ScoreDB: TSqliteDatabase; +sFilename: string; + +implementation + +uses IniFiles, SysUtils; + +procedure InitScore(const Filename: string); +//var + //TableData: TSqliteTable; +begin + //Open Database + ScoreDB := TSqliteDatabase.Create(Filename); + sFilename := Filename; + + try + //Look for Tables => When not exist Create them + if not ScoreDB.TableExists('US_Scores') then + ScoreDB.execsql('CREATE TABLE `US_Scores` (`SongID` INT( 11 ) NOT NULL , `Difficulty` INT( 1 ) NOT NULL , `Player` VARCHAR( 150 ) NOT NULL , `Score` INT( 5 ) NOT NULL );'); + + if not ScoreDB.TableExists('US_Songs') then + ScoreDB.execsql('CREATE TABLE `US_Songs` (`ID` INTEGER PRIMARY KEY, `Artist` VARCHAR( 255 ) NOT NULL , `Title` VARCHAR( 255 ) NOT NULL );'); + + finally + //ScoreDB.Free; + end; + +end; + +procedure ReadScore(var Song: TSong); +var + TableData: TSqliteTable; + Dif: Byte; +begin + //ScoreDB := TSqliteDatabase.Create(sFilename); + try + try + //Search Song in DB + TableData := ScoreDB.GetTable('SELECT `Difficulty`, `Player`, `Score` FROM `us_scores` WHERE `SongID` = (SELECT `ID` FROM `us_songs` WHERE `Artist` = "' + Song.Artist + '" AND `Title` = "' + Song.Title + '" LIMIT 1) ORDER BY `Score` DESC LIMIT 15'); + //Empty Old Scores + SetLength (Song.Score[0], 0); + SetLength (Song.Score[1], 0); + SetLength (Song.Score[2], 0); + + while not TableData.Eof do//Go through all Entrys + begin//Add one Entry to Array + Dif := StrtoInt(TableData.FieldAsString(TableData.FieldIndex['Difficulty'])); + if (Dif>=0) AND (Dif<=2) then + begin + SetLength(Song.Score[Dif], Length(Song.Score[Dif]) + 1); + + Song.Score[Dif, high(Song.Score[Dif])].Name := TableData.FieldAsString(TableData.FieldIndex['Player']); + Song.Score[Dif, high(Song.Score[Dif])].Score:= StrtoInt(TableData.FieldAsString(TableData.FieldIndex['Score'])); + end; + TableData.Next; + end; + + except //Im Fehlerfall + for Dif := 0 to 2 do + begin + SetLength(Song.Score[Dif], 1); + Song.Score[Dif, 1].Name := 'Error Reading ScoreDB'; + end; + end; + finally + //ScoreDb.Free; + end; +end; + +procedure AddScore(var Song: TSong; Level: integer; Name: string; Score: integer); +var +ID: Integer; +TableData: TSqliteTable; +begin + //ScoreDB := TSqliteDatabase.Create(sFilename); + try + + ID := ScoreDB.GetTableValue('SELECT `ID` FROM `US_Songs` WHERE `Artist` = "' + Song.Artist + '" AND `Title` = "' + Song.Title + '"'); + if ID = 0 then //Song doesn't exist -> Create + begin + ScoreDB.ExecSQL ('INSERT INTO `US_Songs` ( `ID` , `Artist` , `Title` ) VALUES (NULL , "' + Song.Artist + '", "' + Song.Title + '");'); + ID := ScoreDB.GetTableValue('SELECT `ID` FROM `US_Songs` WHERE `Artist` = "' + Song.Artist + '" AND `Title` = "' + Song.Title + '"'); + if ID = 0 then //Could not Create Table + exit; + end; + //Create new Entry + ScoreDB.ExecSQL('INSERT INTO `US_Scores` ( `SongID` , `Difficulty` , `Player` , `Score` ) VALUES ("' + InttoStr(ID) + '", "' + InttoStr(Level) + '", "' + Name + '", "' + InttoStr(Score) + '");'); + + //Delete Last Position when there are more than 5 Entrys + if ScoreDB.GetTableValue('SELECT COUNT(`SongID`) FROM `US_Scores` WHERE `SongID` = "' + InttoStr(ID) + '" AND `Difficulty` = "' + InttoStr(Level) +'"') > 5 then + begin + TableData := ScoreDB.GetTable('SELECT `Player`, `Score` FROM `US_Scores` WHERE SongID = "' + InttoStr(ID) + '" AND `Difficulty` = "' + InttoStr(Level) +'" ORDER BY `Score` ASC LIMIT 1'); + ScoreDB.ExecSQL('DELETE FROM `US_Scores` WHERE SongID = "' + InttoStr(ID) + '" AND `Difficulty` = "' + InttoStr(Level) +'" AND `Player` = "' + TableData.FieldAsString(TableData.FieldIndex['Player']) + '" AND `Score` = "' + TableData.FieldAsString(TableData.FieldIndex['Score']) + '"'); + end; + + finally + //ScoreDB.Free; + end; +end; + +//Not used with new SQLLite DB System +procedure WriteScore(var Song: TSong); +{var + F: TIniFile; + S: integer; + Lev: integer; + LevS: string; + FileName: string;} +begin + {FileName := Song.Path + ChangeFileExt(Song.FileName, '.sco'); + if (not FileExists(FileName)) or (FileExists(FileName) and DeleteFile(FileName)) then begin + // file has been deleted -> creating new file + F := TIniFile.Create(FileName); + + for Lev := 0 to 2 do begin + case Lev of + 0: LevS := 'Easy'; + 1: LevS := 'Normal'; + 2: LevS := 'Hard'; + end; + + for S := 0 to high(Song.Score[Lev]) do begin + F.WriteString(LevS + IntToStr(S+1), 'Name', Song.Score[Lev, S].Name); + F.WriteInteger(LevS + IntToStr(S+1), 'Score', Song.Score[Lev, S].Score); + + end; // for S + end; // for Lev + F.Free; + end; // if} +end; + +end. diff --git a/Game/Code/Classes/USkins.dcu b/Game/Code/Classes/USkins.dcu new file mode 100644 index 00000000..89ea67c0 Binary files /dev/null and b/Game/Code/Classes/USkins.dcu differ diff --git a/Game/Code/Classes/USkins.pas b/Game/Code/Classes/USkins.pas new file mode 100644 index 00000000..6cd4a1db --- /dev/null +++ b/Game/Code/Classes/USkins.pas @@ -0,0 +1,158 @@ +unit USkins; + +interface + +type + TSkinTexture = record + Name: string; + FileName: string; + end; + + TSkinEntry = record + Theme: string; + Name: string; + Path: string; + FileName: string; + Creator: string; // not used yet + end; + + TSkin = class + Skin: array of TSkinEntry; + SkinTexture: array of TSkinTexture; + SkinPath: string; + Color: integer; + constructor Create; + procedure LoadList; + procedure ParseDir(Dir: string); + procedure LoadHeader(FileName: string); + procedure LoadSkin(Name: string); + function GetTextureFileName(TextureName: string): string; + function GetSkinNumber(Name: string): integer; + procedure onThemeChange; + end; + +var + Skin: TSkin; + +implementation + +uses IniFiles, Classes, SysUtils, ULog, UIni; + +constructor TSkin.Create; +begin + LoadList; +// LoadSkin('Lisek'); +// SkinColor := Color; +end; + +procedure TSkin.LoadList; +var + SR: TSearchRec; + SR2: TSearchRec; + SLen: integer; +begin + if FindFirst('Skins\*', faDirectory, SR) = 0 then begin + repeat + if (SR.Name <> '.') and (SR.Name <> '..') then + ParseDir('Skins\' + SR.Name + '\'); + until FindNext(SR) <> 0; + end; // if + FindClose(SR); +end; + +procedure TSkin.ParseDir(Dir: string); +var + SR: TSearchRec; + SLen: integer; +begin + if FindFirst(Dir + '*.ini', faAnyFile, SR) = 0 then begin + repeat + if (SR.Name <> '.') and (SR.Name <> '..') then + LoadHeader(Dir + SR.Name); + //Log.LogError(SR.Name); + until FindNext(SR) <> 0; + end; +end; + +procedure TSkin.LoadHeader(FileName: string); +var + SkinIni: TMemIniFile; + S: integer; +begin + SkinIni := TMemIniFile.Create(FileName); + + S := Length(Skin); + SetLength(Skin, S+1); + Skin[S].Path := IncludeTrailingBackslash(ExtractFileDir(FileName)); + Skin[S].FileName := ExtractFileName(FileName); + Skin[S].Theme := SkinIni.ReadString('Skin', 'Theme', ''); + Skin[S].Name := SkinIni.ReadString('Skin', 'Name', ''); + Skin[S].Creator := SkinIni.ReadString('Skin', 'Creator', ''); + + SkinIni.Free; +end; + +procedure TSkin.LoadSkin(Name: string); +var + SkinIni: TMemIniFile; + SL: TStringList; + T: integer; + S: integer; +begin + S := GetSkinNumber(Name); + SkinPath := Skin[S].Path; + + SkinIni := TMemIniFile.Create(SkinPath + Skin[S].FileName); + + SL := TStringList.Create; + SkinIni.ReadSection('Textures', SL); + + SetLength(SkinTexture, SL.Count); + for T := 0 to SL.Count-1 do begin + SkinTexture[T].Name := SL.Strings[T]; + SkinTexture[T].FileName := SkinIni.ReadString('Textures', SL.Strings[T], ''); + end; + + SL.Free; + SkinIni.Free; +end; + +function TSkin.GetTextureFileName(TextureName: string): string; +var + T: integer; +begin + Result := ''; + for T := 0 to High(SkinTexture) do + if SkinTexture[T].Name = TextureName then Result := SkinPath + SkinTexture[T].FileName; + +{ Result := SkinPath + 'Bar.jpg'; + if TextureName = 'Ball' then Result := SkinPath + 'Ball.bmp'; + if Copy(TextureName, 1, 4) = 'Gray' then Result := SkinPath + 'Ball.bmp'; + if Copy(TextureName, 1, 6) = 'NoteBG' then Result := SkinPath + 'Ball.bmp';} +end; + +function TSkin.GetSkinNumber(Name: string): integer; +var + S: integer; +begin + Result := 0; // set default to the first available skin + for S := 0 to High(Skin) do + if Skin[S].Name = Name then Result := S; +end; + +procedure TSkin.onThemeChange; +var + S: integer; + Name: String; +begin + SetLength(ISkin, 0); + Name := Uppercase(ITheme[Ini.Theme]); + for S := 0 to High(Skin) do + if Name = Uppercase(Skin[S].Theme) then begin + SetLength(ISkin, Length(ISkin)+1); + ISkin[High(ISkin)] := Skin[S].Name; + end; + +end; + +end. diff --git a/Game/Code/Classes/USongs.dcu b/Game/Code/Classes/USongs.dcu new file mode 100644 index 00000000..e58c47d8 Binary files /dev/null and b/Game/Code/Classes/USongs.dcu differ diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas new file mode 100644 index 00000000..c2532a03 --- /dev/null +++ b/Game/Code/Classes/USongs.pas @@ -0,0 +1,667 @@ +unit USongs; + +interface +uses SysUtils, ULog, UTexture, UCatCovers; + +type + TBPM = record + BPM: real; + StartBeat: real; + end; + + TScore = record + Name: string; + Score: integer; + Length: string; + end; + + TSong = record + Path: string; + Folder: string; // for sorting by folder + FileName: string; + + // sorting methods + Category: array of string; // I think I won't need this + Genre: string; + Edition: string; + Language: string; // 0.5.0: new + + Title: string; + Artist: string; + + Text: string; + Creator: string; + + Cover: string; + CoverTex: TTexture; + Mp3: string; + Background: string; + Video: string; + VideoGAP: real; + VideoLoaded: boolean; // 0.5.0: true if the video has been loaded + NotesGAP: integer; + Start: real; // in seconds + Finish: integer; // in miliseconds + Relative: boolean; + Resolution: integer; + BPM: array of TBPM; + GAP: real; // in miliseconds + + Score: array[0..2] of array of TScore; + + // these are used when sorting is enabled + Visible: boolean; // false if hidden, true if visible + Main: boolean; // false for songs, true for category buttons + OrderNum: integer; // has a number of category for category buttons and songs + OrderTyp: integer; // type of sorting for this button (0=name) + CatNumber: integer; // Count of Songs in Category for Cats and Number of Song in Category for Songs + end; + + TSongs = class + Song: array of TSong; // array of songs + Selected: integer; // selected song index + procedure LoadSongList; // load all songs + procedure BrowseDir(Dir: string); // should return number of songs in the future + procedure Sort(Order: integer); + function FindSongFile(Dir, Mask: string): string; + end; + + TCatSongs = class + Song: array of TSong; // array of categories with songs + Selected: integer; // selected song index + Order: integer; // order type (0=title) + CatNumShow: integer; // Category Number being seen + CatCount: integer; //Number of Categorys + + procedure Refresh; // refreshes arrays by recreating them from Songs array +// procedure Sort(Order: integer); + procedure ShowCategory(Index: integer); // expands all songs in category + procedure HideCategory(Index: integer); // hides all songs in category + procedure ClickCategoryButton(Index: integer); // uses ShowCategory and HideCategory when needed + procedure ShowCategoryList; //Hides all Songs And Show the List of all Categorys + function FindNextVisible(SearchFrom:integer): integer; //Find Next visible Song + function VisibleSongs: integer; // returns number of visible songs (for tabs) + function VisibleIndex(Index: integer): integer; // returns visible song index (skips invisible) + end; + +var + Songs: TSongs; // all songs + CatSongs: TCatSongs; // categorized songs + AktSong: TSong; // one song *unknown use) + +implementation + +uses UPliki, UIni, UFiles; + +procedure TSongs.LoadSongList; +begin + Log.LogStatus('Initializing', 'LoadSongList'); + + // clear + Setlength(Song, 0); + + // browse directories + BrowseDir(SongPath); +// if Ini.Debug = 1 then BrowseDir('D:\Extract\Songs\'); +end; + +procedure TSongs.BrowseDir(Dir: string); +var + SR: TSearchRec; // for parsing Songs Directory + SLen: integer; +begin + if FindFirst(Dir + '*', faDirectory, SR) = 0 then begin + repeat + if (SR.Name <> '.') and (SR.Name <> '..') then + BrowseDir(Dir + Sr.Name + '\'); + until FindNext(SR) <> 0; + end; // if + FindClose(SR); + +// Log.LogStatus('Parsing directory: ' + Dir + SR.Name, 'LoadSongList'); + + if FindFirst(Dir + '*.txt', 0, SR) = 0 then begin +// Log.LogStatus('Parsing file: ' + Dir + SR.Name + '\' + SRD.Name, 'LoadSongList'); + repeat + SLen := Length(Song); + SetLength(Song, SLen + 1); + Song[SLen].Path := Dir; + Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); + Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos('\', Song[SLen].Folder)-1); + Song[SLen].FileName := SR.Name; + + if (AnalyseFile(Song[SLen]) = false) then SetLength(Song, SLen) + else begin + // scanning complete, file is good + // if there is no cover then try to find it + if Song[SLen].Cover = '' then Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); +// if Song[SLen].Background = '' then begin +// Song[SLen].Background := FindSongFile(Dir, '*[BG].jpg'); +// end; // no needed here} + + // fix by adding path. no, don't fix it. +// if Song[SLen].Cover <> '' then +// Song[SLen].Cover := Song[SLen].Path + Song[SLen].Cover; + end; + + until FindNext(SR) <> 0; + end; // if FindFirst + FindClose(SR); +end; + +procedure TSongs.Sort(Order: integer); +var + S: integer; + S2: integer; + TempSong: TSong; +begin + case Order of + sEdition: // by edition + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if Song[S].Edition < Song[S-1].Edition then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sGenre: // by genre + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if Song[S].Genre < Song[S-1].Genre then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sTitle: // by title + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if Song[S].Title < Song[S-1].Title then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + + end; + sArtist: // by artist + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if Song[S].Artist < Song[S-1].Artist then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sFolder: // by folder + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if Song[S].Folder < Song[S-1].Folder then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sTitle2: // by title2 + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if Song[S].Title < Song[S-1].Title then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + + end; + sArtist2: // by artist2 + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if Song[S].Artist < Song[S-1].Artist then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sLanguage: // by Language + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if Song[S].Language < Song[S-1].Language then begin + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + + end; // case +end; + +function TSongs.FindSongFile(Dir, Mask: string): string; +var + SR: TSearchRec; // for parsing song directory +begin + Result := ''; + if FindFirst(Dir + Mask, faDirectory, SR) = 0 then begin + Result := SR.Name; + end; // if + FindClose(SR); +end; + +procedure TCatSongs.Refresh; +var + S: integer; // temporary song index + CatLen: integer; // length of CatSongs.Song + Letter: char; // current letter for sorting using letter + SS: string; // current edition for sorting using edition, genre etc. + Order: integer; // number used for ordernum + Letter2: char; // + CatNumber:integer; // Number of Song in Category +begin + CatNumShow := -1; +// Songs.Sort(0); // by title + +case Ini.Sorting of + sEdition: begin + Songs.Sort(sArtist); + Songs.Sort(sEdition); + end; + sGenre: begin + Songs.Sort(sArtist); + Songs.Sort(sGenre); + end; + sLanguage: begin + Songs.Sort(sArtist); + Songs.Sort(sLanguage); + end; + sFolder: begin + Songs.Sort(sArtist); + Songs.Sort(sFolder); + end; + sTitle: Songs.Sort(sTitle); + sArtist: Songs.Sort(sArtist); + sTitle2: Songs.Sort(sTitle2); // by title2 + sArtist2: Songs.Sort(sArtist2); // by artist2 + + end; // case + + + Letter := ' '; + SS := ''; + Order := 0; + CatNumber := 0; + + //Songs leeren + SetLength (Song, 0); + + for S := Low(Songs.Song) to High(Songs.Song) do begin + if (Ini.Tabs = 1) then + if (Ini.Sorting = sEdition) and (SS <> Songs.Song[S].Edition) then begin + // add Category Button + Inc(Order); + SS := Songs.Song[S].Edition; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + SS + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + + + // 0.4.3 + // if SS = 'Singstar' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Part 2' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar German' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Spanish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Italian' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar French' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Party' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Party.jpg'; + // if SS = 'Singstar Popworld' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Popworld.jpg'; + // if SS = 'Singstar 80s' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; + // if SS = 'Singstar 80s Polish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; + // if SS = 'Singstar Rocks' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Rocks.jpg'; + // if SS = 'Singstar Anthems' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Anthems.jpg'; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';//} + + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sGenre) and (SS <> Songs.Song[S].Genre) then begin + // add Genre Button + Inc(Order); + SS := Songs.Song[S].Genre; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sLanguage) and (SS <> Songs.Song[S].Language) then begin + // add Language Button + Inc(Order); + SS := Songs.Song[S].Language; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sTitle) and (Length(Songs.Song[S].Title)>=1) and (Letter <> Songs.Song[S].Title[1]) then begin + // add a letter Category Button + Inc(Order); + Letter := Songs.Song[S].Title[1]; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + + {// cover-patch + if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sArtist) and (Length(Songs.Song[S].Artist)>=1) and (Letter <> Songs.Song[S].Artist[1]) then begin + // add a letter Category Button + Inc(Order); + Letter := Songs.Song[S].Artist[1]; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sFolder) and (SS <> Songs.Song[S].Folder) then begin + // 0.5.0: add folder tab + Inc(Order); + SS := Songs.Song[S].Folder; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sTitle2) AND (Length(Songs.Song[S].Title)>=1) then begin + if (ord(Songs.Song[S].Title[1]) > 47) and (ord(Songs.Song[S].Title[1]) < 58) then Letter2 := '#' else Letter2 := Songs.Song[S].Title[1]; + if (Letter <> Letter2) then begin + // add a letter Category Button + Inc(Order); + Letter := Letter2; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end; + end + + else if (Ini.Sorting = sArtist2) AND (Length(Songs.Song[S].Artist)>=1) then begin + if (ord(Songs.Song[S].Artist[1]) > 47) and (ord(Songs.Song[S].Artist[1]) < 58) then Letter2 := '#' else Letter2 := Songs.Song[S].Artist[1]; + if (Letter <> Letter2) then begin + // add a letter Category Button + Inc(Order); + Letter := Letter2; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end; + end; + + + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + + Inc (CatNumber); //Increase Number in Cat + + CatSongs.Song[CatLen] := Songs.Song[S]; + CatSongs.Song[CatLen].OrderNum := Order; // assigns category + CatSongs.Song[CatLen].CatNumber := CatNumber; + + if (Ini.Tabs = 0) then CatSongs.Song[CatLen].Visible := true + else if (Ini.Tabs = 1) then CatSongs.Song[CatLen].Visible := false; +// if (Ini.Tabs = 1) and (Order = 1) then CatSongs.Song[CatLen].Visible := true; // open first tab +//CatSongs.Song[CatLen].Visible := true; + + end; +//CatNumber Patch - Set CatNumber of Last Category +if (ini.Tabs_at_startup = 1) And (high(Song) >=1) then + Song[CatLen - CatNumber].CatNumber := CatNumber;//Set CatNumber of Categroy +//CatCount Patch +CatCount := Order; +end; + +procedure TCatSongs.ShowCategory(Index: integer); +var + S: integer; // song +begin + CatNumShow := Index; + for S := 0 to high(CatSongs.Song) do begin + if CatSongs.Song[S].OrderNum = Index then + CatSongs.Song[S].Visible := true + else + if not CatSongs.Song[S].Main then + CatSongs.Song[S].Visible := false; + end; +end; + +procedure TCatSongs.HideCategory(Index: integer); // hides all songs in category +var + S: integer; // song +begin + for S := 0 to high(CatSongs.Song) do begin + if not CatSongs.Song[S].Main then + CatSongs.Song[S].Visible := false // hides all at now + end; +end; + +procedure TCatSongs.ClickCategoryButton(Index: integer); +var + Num, S: integer; +begin + Num := CatSongs.Song[Index].OrderNum; + if Num <> CatNumShow then + begin + ShowCategory(Num); + //Hide Categorys when in Category Hack + for S := low(CatSongs.Song) to high(CatSongs.Song) do begin + if CatSongs.Song[S].Main then //Hide all Cats + CatSongs.Song[S].Visible := false + end; + //Hide Categorys when in Category Hack End + end + else begin + ShowCategoryList; + end; +end; + +//Hide Categorys when in Category Hack +procedure TCatSongs.ShowCategoryList; +var + Num, S: integer; +begin + //Hide All Songs Show All Cats + for S := 0 to high(CatSongs.Song) do begin + if CatSongs.Song[S].Main then + CatSongs.Song[S].Visible := true + else + CatSongs.Song[S].Visible := false + end; + CatSongs.Selected := CatNumShow; //Show last shown Category + CatNumShow := -1; +end; +//Hide Categorys when in Category Hack End + +//Wrong song selected when tabs on bug +function TCatSongs.FindNextVisible(SearchFrom:integer): integer;//Find next Visible Song +var + I: Integer; + begin + Result := -1; + I := SearchFrom + 1; + while not CatSongs.Song[I].Visible do + begin + Inc (I); + if (I>high(CatSongs.Song)) then + I := low(CatSongs.Song); + if (I = SearchFrom) then //Make One Round and no song found->quit + break; + end; + end; +//Wrong song selected when tabs on bug End + +function TCatSongs.VisibleSongs: integer; +var + S: integer; // song +begin + Result := 0; + for S := 0 to high(CatSongs.Song) do + if CatSongs.Song[S].Visible = true then Inc(Result); +end; + +function TCatSongs.VisibleIndex(Index: integer): integer; +var + S: integer; // song +begin + Result := 0; + for S := 0 to Index-1 do + if CatSongs.Song[S].Visible = true then Inc(Result); +end; + +end. diff --git a/Game/Code/Classes/UTexture.dcu b/Game/Code/Classes/UTexture.dcu new file mode 100644 index 00000000..ec06b7e4 Binary files /dev/null and b/Game/Code/Classes/UTexture.dcu differ diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas new file mode 100644 index 00000000..767d53ec --- /dev/null +++ b/Game/Code/Classes/UTexture.pas @@ -0,0 +1,811 @@ +unit UTexture; + +// Plain (alpha = 1) +// Transparent +// Transparent Range +// Font (white is drawn, black is transparent) +// Font Outline (Font with darker outline) +// Font Outline 2 (Font with darker outline) +// Font Black (black is drawn, white is transparent) +// Font Gray (gray is drawn, white is transparent) +// Arrow (for arrows, white is white, gray has color, black is transparent); + +interface +uses OpenGL12, Windows, Math, Classes, SysUtils, Graphics, JPEG, UThemes; + +procedure glGenTextures(n: GLsizei; var textures: GLuint); stdcall; external opengl32; +//procedure glBindTexture(target: GLenum; texture: GLuint); stdcall; external opengl32; +//function gluBuild2DMipmaps (target: GLenum; components, width, height: GLint; +// format, atype: GLenum; data: Pointer): Integer; stdcall; external glu32; +//procedure glCopyTexImage2D(target: GLenum; level: GLint; internalFormat: GLenum; x, y: GLint; width, height: GLsizei; border: GLint); stdcall; external opengl32; + + +type + TTexture = record + TexNum: integer; + X: real; + Y: real; + Z: real; // new + W: real; + H: real; + ScaleW: real; // for dynamic scalling while leaving width constant + ScaleH: real; // for dynamic scalling while leaving height constant + Rot: real; // 0 - 2*pi + Int: real; // intensity + ColR: real; + ColG: real; + ColB: real; + TexW: real; // used? + TexH: real; // used? + TexX1: real; + TexY1: real; + TexX2: real; + TexY2: real; + Alpha: real; + Name: string; // 0.5.0: experimental for handling cache images. maybe it's useful for dynamic skins + end; + + TTextureEntry = record + Name: string; + Typ: string; + + // we use normal TTexture, it's easier to implement and if needed - we copy ready data + Texture: TTexture; + TextureCache: TTexture; // 0.5.0 + end; + + TTextureDatabase = record + Texture: array of TTextureEntry; + end; + + TTextureUnit = class + Limit: integer; + CreateCacheMipmap: boolean; + +// function GetNumberFor + function GetTexture(Name, Typ: string): TTexture; overload; + function GetTexture(Name, Typ: string; FromCache: boolean): TTexture; overload; + function FindTexture(Name: string): integer; + function LoadTexture(FromRegistry: boolean; Nazwa, Format, Typ: PChar; Col: LongWord): TTexture; overload; + function LoadTexture(Nazwa, Format, Typ: PChar; Col: LongWord): TTexture; overload; + function LoadTexture(Nazwa: string): TTexture; overload; + function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; + procedure UnloadTexture(Name: string; FromCache: boolean); + end; + +var + Texture: TTextureUnit; + TextureDatabase: TTextureDatabase; + + + // for print screens +// PrintScreenTex: GLuint; +// PrintScreenData: array[0..480-1, 0..640-1] of longword; + PrintScreenData: array[0..1024*768-1] of longword; + +// Tekstur: Gluint; + ActTex: GLuint;//integer; + +{ Tekstura: array[1..32] of TTekstura; + Mipmapping: boolean = true;} + + TexOrygW: integer; + TexOrygH: integer; + TexNewW: integer; + TexNewH: integer; +{ RLE: array[1..128*128] of byte; + RLE2: array[1..128*128] of byte;} + + TexFitW: integer; + TexFitH: integer; // new for limit + + TextureD8: array[1..1024*1024] of byte; // 1MB + TextureD16: array[1..1024*1024, 1..2] of byte; // luminance/alpha tex (2MB) + TextureD24: array[1..1024*1024, 1..3] of byte; // normal 24-bit tex (3MB) + TextureD242: array[1..512*512, 1..3] of byte; // normal 24-bit tex (0,75MB) + TextureD32: array[1..1024*1024, 1..4] of byte; // transparent 32-bit tex (4MB) + // total 40MB at 2048*2048 + // total 10MB at 1024*1024 + +{ Paleta: array[0..255, 1..4] of byte; + Len: integer;} + Mipmapping: Boolean; + + CacheMipmap: array[0..256*256*3-1] of byte; // 3KB + + +implementation +uses ULog, DateUtils, UCovers; + +function TTextureUnit.GetTexture(Name, Typ: string): TTexture; +begin + Result := GetTexture(Name, Typ, true); +end; + +function TTextureUnit.GetTexture(Name, Typ: string; FromCache: boolean): TTexture; +var + T: integer; // texture + C: integer; // cover + Data: array of byte; +begin + // find texture entry + T := FindTexture(Name); + + if T = -1 then begin + // create texture entry + T := Length(TextureDatabase.Texture); + SetLength(TextureDatabase.Texture, T+1); + TextureDatabase.Texture[T].Name := Name; + TextureDatabase.Texture[T].Typ := Typ; + + // inform database that not textures has been loaded into memory + TextureDatabase.Texture[T].Texture.TexNum := -1; + TextureDatabase.Texture[T].TextureCache.TexNum := -1; + end; + + // use preloaded texture + if (not FromCache) or (FromCache and not Covers.CoverExists(Name)) then begin + // use full texture + if TextureDatabase.Texture[T].Texture.TexNum = -1 then begin + // load texture + TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', pchar(Typ), $0); + end; + + // use texture + Result := TextureDatabase.Texture[T].Texture; + + end; + + if FromCache and Covers.CoverExists(Name) then begin + // use cache texture + C := Covers.CoverNumber(Name); + + if TextureDatabase.Texture[T].TextureCache.TexNum = -1 then begin + // load texture + Covers.PrepareData(Name); +{ Covers.Data[0] := 0; + Covers.Data[1] := 0; + Covers.Data[2] := 0; + Covers.Data[3] := 255; + Covers.Data[4] := 255; + Covers.Data[5] := 255;} + TextureDatabase.Texture[T].TextureCache := CreateTexture(Covers.Data, Name, Covers.Cover[C].W, Covers.Cover[C].H, 24); + end; + + // use texture + Result := TextureDatabase.Texture[T].TextureCache; + end; +end; + +function TTextureUnit.FindTexture(Name: string): integer; +var + T: integer; // texture +begin + Result := -1; + for T := 0 to high(TextureDatabase.Texture) do + if TextureDatabase.Texture[T].Name = Name then + Result := T; +end; + +function TTextureUnit.LoadTexture(FromRegistry: boolean; Nazwa, Format, Typ: PChar; Col: LongWord): TTexture; +var + Res: TResourceStream; + TextureB: TBitmap; + TextureJ: TJPEGImage; + + Pet: integer; + Pet2: integer; + Pix: integer; + ColInt: real; + PPix: PByteArray; + TempA: integer; + Error: integer; + SkipX: integer; +begin + Log.BenchmarkStart(4); + Mipmapping := true; + + if FromRegistry then begin + try + Res := TResourceStream.Create(HInstance, Nazwa, Format); + except + beep; + Exit; + end; + end; + + if FromRegistry or ((not FromRegistry) and FileExists(Nazwa)) then begin + + TextureB := TBitmap.Create; + + if Format = 'JPG' then begin + TextureJ := TJPEGImage.Create; + if FromRegistry then TextureJ.LoadFromStream(Res) + else begin + if FileExists(Nazwa) then + TextureJ.LoadFromFile(Nazwa) + else + Exit; + end; + TextureB.Assign(TextureJ); + TextureJ.Free; + end; + if Format = 'BMP' then begin + if FromRegistry then TextureB.LoadFromStream(Res) + else TextureB.LoadFromFile(Nazwa); + end; + + if FromRegistry then Res.Free; + + if (TextureB.Width > 1024) or (TextureB.Height > 1024) then begin // will be fixed in 0.5.1 and dynamically extended to 8192x8192 depending on the driver + Log.LogError('Image ' + Nazwa + ' is too big (' + IntToStr(TextureB.Width) + 'x' + IntToStr(TextureB.Height) + ')'); + Result.TexNum := -1; + end else begin + + glGenTextures(1, ActTex); + glBindTexture(GL_TEXTURE_2D, ActTex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + + if Typ = 'Plain' then begin + // wymiary + TexOrygW := TextureB.Width; + TexOrygH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrygW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrygH)))); + + // kopiowanie + TextureB.PixelFormat := pf24bit; +{ if (TextureB.PixelFormat = pf8bit) then begin + for Pet := 0 to TexOrygH-1 do begin + for Pet2 := 0 to TexOrygW-1 do begin + Pix := TextureB.Canvas.Pixels[Pet2, Pet]; + TextureD24[Pet*TexNewW + Pet2+1, 1] := Pix; + TextureD24[Pet*TexNewW + Pet2+1, 2] := Pix div 256; + TextureD24[Pet*TexNewW + Pet2+1, 3] := Pix div (256*256); + end; + end; + end;} + if (TexOrygW <= Limit) and (TexOrygW <= Limit) then begin + if (TextureB.PixelFormat = pf24bit) then begin + for Pet := 0 to TexOrygH-1 do begin + PPix := TextureB.ScanLine[Pet]; + for Pet2 := 0 to TexOrygW-1 do begin + TextureD24[Pet*TexNewW + Pet2+1, 1] := PPix[Pet2*3+2]; + TextureD24[Pet*TexNewW + Pet2+1, 2] := PPix[Pet2*3+1]; + TextureD24[Pet*TexNewW + Pet2+1, 3] := PPix[Pet2*3]; + end; + end; + end; + end else begin + // limit + TexFitW := 4 * (TexOrygW div 4); // fix for bug in gluScaleImage + TexFitH := TexOrygH; + if (TextureB.PixelFormat = pf24bit) then begin + for Pet := 0 to TexOrygH-1 do begin + PPix := TextureB.ScanLine[Pet]; + for Pet2 := 0 to TexOrygW-1 do begin + TextureD24[Pet*TexFitW + Pet2+1, 1] := PPix[Pet2*3+2]; + TextureD24[Pet*TexFitW + Pet2+1, 2] := PPix[Pet2*3+1]; + TextureD24[Pet*TexFitW + Pet2+1, 3] := PPix[Pet2*3]; + end; + end; + end; + gluScaleImage(GL_RGB, TexFitW, TexFitH, GL_UNSIGNED_BYTE, @TextureD24, + Limit, Limit, GL_UNSIGNED_BYTE, @TextureD24); // takes some time + + TexNewW := Limit; + TexNewH := Limit; + TexOrygW := Limit; + TexOrygH := Limit; + end; + + // creating cache mipmap + if CreateCacheMipmap then begin + if (TexOrygW <> TexNewW) or (TexOrygH <> TexNewH) then begin + // texture only uses some of it's space. there's a need for resize to fit full size + // and get best quality + TexFitW := 4 * (TexOrygW div 4); // 0.5.0: fix for bug in gluScaleImage + SkipX := (TexOrygW div 2) mod 2; // 0.5.0: try to center image + + TexFitH := TexOrygH; + for Pet := 0 to TexOrygH-1 do begin + PPix := TextureB.ScanLine[Pet]; + for Pet2 := 0 to TexOrygW-1 do begin + TextureD242[Pet*TexFitW + Pet2+1, 1] := PPix[(Pet2+SkipX)*3+2]; + TextureD242[Pet*TexFitW + Pet2+1, 2] := PPix[(Pet2+SkipX)*3+1]; + TextureD242[Pet*TexFitW + Pet2+1, 3] := PPix[(Pet2+SkipX)*3]; + end; + end; + gluScaleImage(GL_RGB, TexFitW, TexFitH, GL_UNSIGNED_BYTE, @TextureD242, + Covers.W, Covers.H, GL_UNSIGNED_BYTE, @CacheMipmap[0]); // takes some time + + end else begin + // texture fits perfectly + gluScaleImage(GL_RGB, TexOrygW, TexOrygH, GL_UNSIGNED_BYTE, @TextureD24, + Covers.W, Covers.H, GL_UNSIGNED_BYTE, @CacheMipmap[0]); // takes some time + end; + end; + + glTexImage2D(GL_TEXTURE_2D, 0, 3, TexNewW, TexNewH, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TexNewW, TexNewH, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); + if Error > 0 then beep; + end + end; + + if Typ = 'Transparent' then begin + // wymiary + TexOrygW := TextureB.Width; + TexOrygH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrygW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrygH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // kopiowanie + for Pet := 0 to TexOrygH-1 do begin + for Pet2 := 0 to TexOrygW-1 do begin + Pix := TextureB.Canvas.Pixels[Pet2, Pet]; + if Pix = Col then begin + TextureD32[Pet*TexNewW + Pet2 + 1, 1] := 0; + TextureD32[Pet*TexNewW + Pet2 + 1, 2] := 0; + TextureD32[Pet*TexNewW + Pet2 + 1, 3] := 0; + TextureD32[Pet*TexNewW + Pet2 + 1, 4] := 0; + end else begin + TextureD32[Pet*TexNewW + Pet2+1, 1] := Pix; + TextureD32[Pet*TexNewW + Pet2+1, 2] := Pix div 256; + TextureD32[Pet*TexNewW + Pet2+1, 3] := Pix div (256*256); + TextureD32[Pet*TexNewW + Pet2+1, 4] := 255; + end; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); +{ if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + if Error > 0 then beep; + end;} + end; + + if Typ = 'Transparent Range' then begin + // wymiary + TexOrygW := TextureB.Width; + TexOrygH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrygW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrygH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // kopiowanie + for Pet := 0 to TexOrygH-1 do begin + for Pet2 := 0 to TexOrygW-1 do begin + Pix := TextureB.Canvas.Pixels[Pet2, Pet]; + TextureD32[Pet*TexNewW + Pet2+1, 1] := Pix; + TextureD32[Pet*TexNewW + Pet2+1, 2] := Pix div 256; + TextureD32[Pet*TexNewW + Pet2+1, 3] := Pix div (256*256); + TextureD32[Pet*TexNewW + Pet2+1, 4] := 256 - Pix div 256; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); +{ if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + if Error > 0 then beep; + end;} + end; + + if Typ = 'Font' then begin + TextureB.PixelFormat := pf24bit; + for Pet := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Pet]; + for Pet2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Pet2 * 3]; + TextureD16[Pet*TextureB.Width + Pet2 + 1, 1] := 255; + TextureD16[Pet*TextureB.Width + Pet2 + 1, 2] := Pix; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + if Error > 0 then beep; + end; + end; + + if Typ = 'Font Outline' then begin + TextureB.PixelFormat := pf24bit; + for Pet := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Pet]; + for Pet2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Pet2 * 3]; + + Col := Pix; + if Col < 127 then Col := 127; + + TempA := Pix; + if TempA >= 95 then TempA := 255; + if TempA >= 31 then TempA := 255; + if Pix < 95 then TempA := (Pix * 256) div 96; + + + TextureD16[Pet*TextureB.Width + Pet2 + 1, 1] := Col; + TextureD16[Pet*TextureB.Width + Pet2 + 1, 2] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + if Error > 0 then beep; + end; + end; + + if Typ = 'Font Outline 2' then begin + TextureB.PixelFormat := pf24bit; + for Pet := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Pet]; + for Pet2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Pet2 * 3]; + + Col := Pix; + if Col < 31 then Col := 31; + + TempA := Pix; + if TempA >= 31 then TempA := 255; + if Pix < 31 then TempA := Pix * (256 div 32); + + TextureD16[Pet*TextureB.Width + Pet2 + 1, 1] := Col; + TextureD16[Pet*TextureB.Width + Pet2 + 1, 2] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + if Error > 0 then beep; + end; + end; + + if Typ = 'Font Black' then begin + // normalnie 0,125s bez niczego 0,015s - 0,030s z pix 0,125s + // wymiary + TextureB.PixelFormat := pf24bit; + TexOrygW := TextureB.Width; + TexOrygH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrygW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrygH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // kopiowanie + for Pet := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Pet]; + for Pet2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Pet2*3]; + TextureD32[Pet*TextureB.Width + Pet2 + 1, 1] := 255; + TextureD32[Pet*TextureB.Width + Pet2 + 1, 2] := 255; + TextureD32[Pet*TextureB.Width + Pet2 + 1, 3] := 255; + TextureD32[Pet*TextureB.Width + Pet2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + if Typ = 'Alpha Black Colored' then begin + TextureB.PixelFormat := pf24bit; + TexOrygW := TextureB.Width; + TexOrygH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrygW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrygH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // kopiowanie + for Pet := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Pet]; + for Pet2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Pet2*3]; + TextureD32[Pet*TextureB.Width + Pet2 + 1, 1] := (Col div $10000) and $FF; + TextureD32[Pet*TextureB.Width + Pet2 + 1, 2] := (Col div $100) and $FF; + TextureD32[Pet*TextureB.Width + Pet2 + 1, 3] := Col and $FF; + TextureD32[Pet*TextureB.Width + Pet2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + if Typ = 'Font Gray' then begin + // wymiary + TexOrygW := TextureB.Width; + TexOrygH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrygW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrygH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // kopiowanie + for Pet := 0 to TextureB.Height-1 do begin + for Pet2 := 0 to TextureB.Width-1 do begin + Pix := TextureB.Canvas.Pixels[Pet2, Pet]; + TextureD32[Pet*TextureB.Width + Pet2 + 1, 1] := 127; + TextureD32[Pet*TextureB.Width + Pet2 + 1, 2] := 127; + TextureD32[Pet*TextureB.Width + Pet2 + 1, 3] := 127; + TextureD32[Pet*TextureB.Width + Pet2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); +{ if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + if Error > 0 then beep; + end;} + end; + + if Typ = 'Arrow' then begin + TextureB.PixelFormat := pf24bit; + for Pet := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Pet]; + for Pet2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Pet2 * 3]; + + // transparency + if Pix >= 127 then TempA := 255; + if Pix < 127 then TempA := Pix * 2; + + // ColInt = color intensity + if Pix < 127 then ColInt := 1; + if Pix >= 127 then ColInt := 2 - Pix / 128; + //0.75, 0.6, 0.25 + + TextureD32[Pet*TextureB.Width + Pet2 + 1, 1] := Round(ColInt * 0.75 * 255 + (1 - ColInt) * 255); + TextureD32[Pet*TextureB.Width + Pet2 + 1, 2] := Round(ColInt * 0.6 * 255 + (1 - ColInt) * 255); + TextureD32[Pet*TextureB.Width + Pet2 + 1, 3] := Round(ColInt * 0.25 * 255 + (1 - ColInt) * 255); + TextureD32[Pet*TextureB.Width + Pet2 + 1, 4] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + if Error > 0 then beep; + end; + end; + + if Typ = 'Note Plain' then begin + for Pet := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Pet]; + for Pet2 := 0 to TextureB.Width-1 do begin + + + + // Skin Patch + // 0-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White + case PPix[Pet2*3] of + 0..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Pet2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Pet2*3]) div $Bf) + (((Col and $FF) * PPix[Pet2*3]) div $Bf); + 192: Pix := Col; + 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Pet2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Pet2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Pet2*3] - $C0) * 4)) div $FF)); + 255: Pix := $FFFFFF; + end; +// 0.5.0. Original +// case PPix[Pet2*3] of +// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; +// 192: Pix := Col; +// 255: Pix := $FFFFFF; +// end; + + + + + + TextureD24[Pet*TextureB.Width + Pet2 + 1, 1] := Pix div $10000; + TextureD24[Pet*TextureB.Width + Pet2 + 1, 2] := (Pix div $100) and $FF; + TextureD24[Pet*TextureB.Width + Pet2 + 1, 3] := Pix and $FF; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureB.Width, TextureB.Height, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); + end; + + if Typ = 'Note Transparent' then begin + for Pet := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Pet]; + for Pet2 := 0 to TextureB.Width-1 do begin + TempA := 255; + + + + //Skin Patch + // 0= Transparent, 1-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White + case PPix[Pet2*3] of + 0: TempA := 0; + 1..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Pet2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Pet2*3]) div $Bf) + (((Col and $FF) * PPix[Pet2*3]) div $Bf); + 192: Pix := Col; + 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Pet2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Pet2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Pet2*3] - $C0) * 4)) div $FF)); + 255: Pix := $FFFFFF; + end; +// 0.5.0 Original +// case PPix[Pet2*3] of +// 0: TempA := 0; +// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; +// 192: Pix := Col; +// 255: Pix := $FFFFFF; +// end; + + + + + TextureD32[Pet*TextureB.Width + Pet2 + 1, 1] := Pix div $10000; + TextureD32[Pet*TextureB.Width + Pet2 + 1, 2] := (Pix div $100) and $FF; + TextureD32[Pet*TextureB.Width + Pet2 + 1, 3] := Pix and $FF; + TextureD32[Pet*TextureB.Width + Pet2 + 1, 4] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + + + + TextureB.Free; +// Inc(ActTex); +{ Tekst.Tekstura := ActTex; + Tekst.W := TexOrygW; + Tekst.H := TexOrygH; + Tekst.X2 := TexOrygW/TexNewW; + Tekst.Y2 := TexOrygH/TexNewH;} + Result.X := 0; + Result.Y := 0; + Result.W := 0; + Result.H := 0; + Result.ScaleW := 1; + Result.ScaleH := 1; + Result.Rot := 0; + Result.TexNum := ActTex; + Result.TexW := TexOrygW / TexNewW; + Result.TexH := TexOrygH / TexNewH; + + Result.Int := 1; + Result.ColR := 1; + Result.ColG := 1; + Result.ColB := 1; + Result.Alpha := 1; + + // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these + Result.TexX1 := 0; + Result.TexY1 := 0; + Result.TexX2 := 1; + Result.TexY2 := 1; + + // 0.5.0 + Result.Name := Nazwa; + + end; + + Log.BenchmarkEnd(4); + if Log.BenchmarkTimeLength[4] >= 1 then + Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Nazwa + '/' + Typ, 4); + + end; // logerror +end; + +{procedure ResizeTexture(s: pbytearray; d: pbytearray); +var + Pet: integer; + Pet2: integer; +begin + for Pet := 0 to TexNewH*4-1 do + for Pet2 := 0 to TexNewW-1 do + d[Pet*TexNewW + Pet2] := 0; + + for Pet := 0 to TexOrygH-1 do begin + for Pet2 := 0 to TexOrygW-1 do begin + d[(Pet*TexNewW + Pet2)*4] := Paleta[s[Pet*TexOrygW + Pet2], 1]; + d[(Pet*TexNewW + Pet2)*4+1] := Paleta[s[Pet*TexOrygW + Pet2], 2]; + d[(Pet*TexNewW + Pet2)*4+2] := Paleta[s[Pet*TexOrygW + Pet2], 3]; + d[(Pet*TexNewW + Pet2)*4+3] := Paleta[s[Pet*TexOrygW + Pet2], 4]; + end; + end; +end;} + +{procedure SetTexture(p: pointer); +begin + glGenTextures(1, Tekstur); + glBindTexture(GL_TEXTURE_2D, Tekstur); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, p); +end;} + +function TTextureUnit.LoadTexture(Nazwa, Format, Typ: PChar; Col: LongWord): TTexture; +begin + Result := LoadTexture(false, Nazwa, Format, Typ, Col); +// Result := LoadTexture(SkinReg, Nazwa, Format, Typ, Col); // default to SkinReg + +end; + +function TTextureUnit.LoadTexture(Nazwa: string): TTexture; +begin + Result := LoadTexture(false, pchar(Nazwa), 'JPG', 'Plain', 0); +end; + +function TTextureUnit.CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; +var + Pet: integer; + Pet2: integer; + Pix: integer; + ColInt: real; + PPix: PByteArray; + TempA: integer; + Error: integer; +begin + Mipmapping := false; + + glGenTextures(1, ActTex); // ActText = new texture number + glBindTexture(GL_TEXTURE_2D, ActTex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + + glTexImage2D(GL_TEXTURE_2D, 0, 3, W, H, 0, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, W, H, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); + if Error > 0 then beep; + end; + + +// Inc(ActTex); +{ Tekst.Tekstura := ActTex; + Tekst.W := TexOrygW; + Tekst.H := TexOrygH; + Tekst.X2 := TexOrygW/TexNewW; + Tekst.Y2 := TexOrygH/TexNewH;} + Result.X := 0; + Result.Y := 0; + Result.W := 0; + Result.H := 0; + Result.ScaleW := 1; + Result.ScaleH := 1; + Result.Rot := 0; + Result.TexNum := ActTex; + Result.TexW := 1; + Result.TexH := 1; + + Result.Int := 1; + Result.ColR := 1; + Result.ColG := 1; + Result.ColB := 1; + Result.Alpha := 1; + + // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these + Result.TexX1 := 0; + Result.TexY1 := 0; + Result.TexX2 := 1; + Result.TexY2 := 1; + + // 0.5.0 + Result.Name := Name; +end; + +procedure TTextureUnit.UnloadTexture(Name: string; FromCache: boolean); +var + T: integer; + TexNum: GLuint; +begin + T := FindTexture(Name); + + if not FromCache then begin + TexNum := TextureDatabase.Texture[T].Texture.TexNum; + if TexNum >= 0 then begin + glDeleteTextures(1, @TexNum); + TextureDatabase.Texture[T].Texture.TexNum := -1; +// Log.LogError('Unload texture no '+IntToStr(TexNum)); + end; + end else begin + TexNum := TextureDatabase.Texture[T].TextureCache.TexNum; + if TexNum >= 0 then begin + glDeleteTextures(1, @TexNum); + TextureDatabase.Texture[T].TextureCache.TexNum := -1; +// Log.LogError('Unload texture cache no '+IntToStr(TexNum)); + end; + end; +end; + +end. \ No newline at end of file diff --git a/Game/Code/Classes/UThemes.dcu b/Game/Code/Classes/UThemes.dcu new file mode 100644 index 00000000..eb5ec8d4 Binary files /dev/null and b/Game/Code/Classes/UThemes.dcu differ diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas new file mode 100644 index 00000000..29647db6 --- /dev/null +++ b/Game/Code/Classes/UThemes.pas @@ -0,0 +1,1837 @@ +unit UThemes; + +interface + +uses IniFiles, SysUtils, Classes; + +type + TRGB = record + R: single; + G: single; + B: single; + end; + + {TSkin = record + GrayLeft: string; + GrayMid: string; + GrayRight: string; + + NoteBGLeft: string; + NoteBGMid: string; + NoteBGRight: string; + + NoteStar: string; + + Ball: string; + + + + //SingBar Mod + SingBarBack: string; + SingBarBar: string; + SingBarFront: string; + //end Singbar Mod + + //PhrasenBonus - Line Bonus Mod + SingLineBonusBack: string; + //PhrasenBonus - Line Bonus Mod + + + + WelcomeBG: string; + + Background: string; + ScoreBG: string; + MainStart: string; + MainEditor: string; + MainOptions: string; + MainExit: string; + MainBar: string; + Cursor: string; + + SongFade: string; + SongCover: string; + SongSelection: string; + + SelectSong: string; + Button: string; + Bar: string; + P: string; + Arrow: string; + Arrow2: string; + ButtonF: string; + Star: string; + Line: string; + +// ThemePath: string; + SkinReg: boolean; + SkinName: string; + SkinPath: string; + SkinColor: integer; + end;} + + TThemeBackground = record + Tex: string; + end; + + TThemeStatic = record + X: integer; + Y: integer; + Z: real; + W: integer; + H: integer; + Color: string; + ColR: real; + ColG: real; + ColB: real; + Tex: string; + Typ: string; + TexX1: real; + TexY1: real; + TexX2: real; + TexY2: real; + end; + AThemeStatic = array of TThemeStatic; + + TThemeText = record + X: integer; + Y: integer; + Color: string; + ColR: real; + ColG: real; + ColB: real; + Font: integer; + Size: integer; + Align: integer; + Text: string; + end; + AThemeText = array of TThemeText; + + TThemeButton = record + Text: AThemeText; + X: integer; + Y: integer; + W: integer; + H: integer; + Color: string; + ColR: real; + ColG: real; + ColB: real; + Int: real; + DColor: string; + DColR: real; + DColG: real; + DColB: real; + DInt: real; + Tex: string; + Typ: string; + //Reflection Mod + Reflection: Boolean; + end; + + TThemeSelect = record + Tex: string; + TexSBG: string; + X: integer; + Y: integer; + W: integer; + H: integer; + Text: string; + ColR, ColG, ColB, Int: real; + DColR, DColG, DColB, DInt: real; + TColR, TColG, TColB, TInt: real; + TDColR, TDColG, TDColB, TDInt: real; + SBGColR, SBGColG, SBGColB, SBGInt: real; + SBGDColR, SBGDColG, SBGDColB, SBGDInt: real; + STColR, STColG, STColB, STInt: real; + STDColR, STDColG, STDColB, STDInt: real; + SkipX: integer; + end; + + TThemeSelectSlide = record + Tex: string; + TexSBG: string; + X: integer; + Y: integer; + W: integer; + H: integer; + Text: string; + ColR, ColG, ColB, Int: real; + DColR, DColG, DColB, DInt: real; + TColR, TColG, TColB, TInt: real; + TDColR, TDColG, TDColB, TDInt: real; + SBGColR, SBGColG, SBGColB, SBGInt: real; + SBGDColR, SBGDColG, SBGDColB, SBGDInt: real; + STColR, STColG, STColB, STInt: real; + STDColR, STDColG, STDColB, STDInt: real; + SkipX: integer; + end; + + TThemeBasic = class + Background: TThemeBackground; + Text: AThemeText; + Static: AThemeStatic; + end; + + TThemeLoading = class(TThemeBasic) + end; + + TThemeMain = class(TThemeBasic) + ButtonSolo: TThemeButton; +// ButtonMulti: TThemeButton; + ButtonEditor: TThemeButton; + ButtonOptions: TThemeButton; + ButtonExit: TThemeButton; + + TextDescription: TThemeText; + TextDescriptionLong: TThemeText; + Description: array[0..4] of string; + DescriptionLong: array[0..4] of string; + end; + + TThemeName = class(TThemeBasic) + ButtonPlayer: array[1..6] of TThemeButton; + end; + + TThemeLevel = class(TThemeBasic) + ButtonEasy: TThemeButton; + ButtonMedium: TThemeButton; + ButtonHard: TThemeButton; + end; + + TThemeSong = class(TThemeBasic) + TextArtist: TThemeText; + TextTitle: TThemeText; + TextNumber: TThemeText; + + //Show Cat in TopLeft Mod + TextCat: TThemeText; + StaticCat: TThemeStatic; + + //Cover Mod + Cover: record + Reflections: Boolean; + X: Integer; + Y: Integer; + Z: Integer; + W: Integer; + H: Integer; + Style: Integer; + end; + + //Equalizer Mod + Equalizer: record + Visible: Boolean; + Direction: Boolean; + Alpha: real; + X: Integer; + Y: Integer; + Z: Real; + W: Integer; + H: Integer; + Space: Integer; + Bands: Integer; + Length: Integer; + ColR, ColG, ColB: Real; + end; + + //Party Mode + StaticTeam1Joker1: TThemeStatic; + StaticTeam1Joker2: TThemeStatic; + StaticTeam1Joker3: TThemeStatic; + StaticTeam1Joker4: TThemeStatic; + StaticTeam1Joker5: TThemeStatic; + StaticTeam2Joker1: TThemeStatic; + StaticTeam2Joker2: TThemeStatic; + StaticTeam2Joker3: TThemeStatic; + StaticTeam2Joker4: TThemeStatic; + StaticTeam2Joker5: TThemeStatic; + StaticTeam3Joker1: TThemeStatic; + StaticTeam3Joker2: TThemeStatic; + StaticTeam3Joker3: TThemeStatic; + StaticTeam3Joker4: TThemeStatic; + StaticTeam3Joker5: TThemeStatic; + end; + + TThemeSing = class(TThemeBasic) + StaticP1: TThemeStatic; + StaticP1ScoreBG: TThemeStatic; //Static for ScoreBG + TextP1: TThemeText; + TextP1Score: TThemeText; + + + StaticP2R: TThemeStatic; + StaticP2RScoreBG: TThemeStatic; //Static for ScoreBG + TextP2R: TThemeText; + TextP2RScore: TThemeText; + + StaticP2M: TThemeStatic; + StaticP2MScoreBG: TThemeStatic; //Static for ScoreBG + TextP2M: TThemeText; + TextP2MScore: TThemeText; + + StaticP3R: TThemeStatic; + StaticP3RScoreBG: TThemeStatic; //Static for ScoreBG + TextP3R: TThemeText; + TextP3RScore: TThemeText; + end; + + TThemeScore = class(TThemeBasic) + TextArtist: TThemeText; + TextTitle: TThemeText; + + PlayerStatic: array[1..6] of AThemeStatic; + + TextName: array[1..6] of TThemeText; + TextScore: array[1..6] of TThemeText; + + TextNotes: array[1..6] of TThemeText; + TextNotesScore: array[1..6] of TThemeText; + TextLineBonus: array[1..6] of TThemeText; + TextLineBonusScore: array[1..6] of TThemeText; + TextGoldenNotes: array[1..6] of TThemeText; + TextGoldenNotesScore: array[1..6] of TThemeText; + TextTotal: array[1..6] of TThemeText; + TextTotalScore: array[1..6] of TThemeText; + + StaticBoxLightest: array[1..6] of TThemeStatic; + StaticBoxLight: array[1..6] of TThemeStatic; + StaticBoxDark: array[1..6] of TThemeStatic; + + StaticBackLevel: array[1..6] of TThemeStatic; + StaticBackLevelRound: array[1..6] of TThemeStatic; + StaticLevel: array[1..6] of TThemeStatic; + StaticLevelRound: array[1..6] of TThemeStatic; + +// Description: array[0..5] of string;} + end; + + TThemeTop5 = class(TThemeBasic) + TextLevel: TThemeText; + TextArtistTitle: TThemeText; + + StaticNumber: AThemeStatic; + TextNumber: AThemeText; + TextName: AThemeText; + TextScore: AThemeText; + end; + + TThemeOptions = class(TThemeBasic) + ButtonGame: TThemeButton; + ButtonGraphics: TThemeButton; + ButtonSound: TThemeButton; + ButtonLyrics: TThemeButton; + ButtonThemes: TThemeButton; + ButtonRecord: TThemeButton; + ButtonExit: TThemeButton; + + TextDescription: TThemeText; + Description: array[0..6] of string; + end; + + TThemeOptionsGame = class(TThemeBasic) + SelectPlayers: TThemeSelect; + SelectDifficulty: TThemeSelect; + SelectLanguage: TThemeSelectSlide; + SelectTabs: TThemeSelect; + SelectSorting: TThemeSelectSlide; + SelectDebug: TThemeSelect; + ButtonExit: TThemeButton; + end; + + TThemeOptionsGraphics = class(TThemeBasic) + SelectFullscreen: TThemeSelect; + SelectSlideResolution: TThemeSelectSlide; + SelectDepth: TThemeSelect; + SelectOscilloscope: TThemeSelect; + SelectLineBonus: TThemeSelect; + SelectMovieSize: TThemeSelect; + ButtonExit: TThemeButton; + end; + + TThemeOptionsSound = class(TThemeBasic) + SelectMicBoost: TThemeSelect; + SelectClickAssist: TThemeSelect; + SelectBeatClick: TThemeSelect; + SelectThreshold: TThemeSelect; + //SelectTwoPlayerMode: TThemeSelect; + ButtonExit: TThemeButton; + end; + + TThemeOptionsLyrics = class(TThemeBasic) + SelectLyricsFont: TThemeSelect; + SelectLyricsEffect: TThemeSelect; + SelectSolmization: TThemeSelect; + ButtonExit: TThemeButton; + end; + + TThemeOptionsThemes = class(TThemeBasic) + SelectTheme: TThemeSelectSlide; + SelectSkin: TThemeSelectSlide; + SelectColor: TThemeSelectSlide; + ButtonExit: TThemeButton; + end; + + TThemeOptionsRecord = class(TThemeBasic) + SelectSlideCard: TThemeSelectSlide; + SelectSlideInput: TThemeSelectSlide; + SelectSlideChannelL: TThemeSelectSlide; + SelectSlideChannelR: TThemeSelectSlide; + ButtonExit: TThemeButton; + end; + + //ScreenSong Menue + TThemeSongMenu = class(TThemeBasic) + Button1: TThemeButton; + Button2: TThemeButton; + Button3: TThemeButton; + Button4: TThemeButton; + + SelectSlide3: TThemeSelectSlide; + + TextMenu: TThemeText; + end; + + //Party Screens + TThemePartyNewRound = class(TThemeBasic) + TextRound1: TThemeText; + TextRound2: TThemeText; + TextRound3: TThemeText; + TextRound4: TThemeText; + TextRound5: TThemeText; + TextRound6: TThemeText; + TextRound7: TThemeText; + TextWinner1: TThemeText; + TextWinner2: TThemeText; + TextWinner3: TThemeText; + TextWinner4: TThemeText; + TextWinner5: TThemeText; + TextWinner6: TThemeText; + TextWinner7: TThemeText; + TextNextRound: TThemeText; + TextNextRoundNo: TThemeText; + TextNextPlayer1: TThemeText; + TextNextPlayer2: TThemeText; + TextNextPlayer3: TThemeText; + + StaticRound1: TThemeStatic; + StaticRound2: TThemeStatic; + StaticRound3: TThemeStatic; + StaticRound4: TThemeStatic; + StaticRound5: TThemeStatic; + StaticRound6: TThemeStatic; + StaticRound7: TThemeStatic; + + TextScoreTeam1: TThemeText; + TextScoreTeam2: TThemeText; + TextScoreTeam3: TThemeText; + TextNameTeam1: TThemeText; + TextNameTeam2: TThemeText; + TextNameTeam3: TThemeText; + StaticTeam1: TThemeStatic; + StaticTeam2: TThemeStatic; + StaticTeam3: TThemeStatic; + + ButtonNext: TThemeButton; + end; + + TThemePartyScore = class(TThemeBasic) + TextScoreTeam1: TThemeText; + TextScoreTeam2: TThemeText; + TextScoreTeam3: TThemeText; + TextNameTeam1: TThemeText; + TextNameTeam2: TThemeText; + TextNameTeam3: TThemeText; + StaticTeam1: TThemeStatic; + StaticTeam2: TThemeStatic; + StaticTeam3: TThemeStatic; + + TextWinner: TThemeText; + end; + + TThemePartyWin = class(TThemeBasic) + TextScoreTeam1: TThemeText; + TextScoreTeam2: TThemeText; + TextScoreTeam3: TThemeText; + TextNameTeam1: TThemeText; + TextNameTeam2: TThemeText; + TextNameTeam3: TThemeText; + StaticTeam1: TThemeStatic; + StaticTeam2: TThemeStatic; + StaticTeam3: TThemeStatic; + + TextWinner: TThemeText; + end; + + TThemePartyOptions = class(TThemeBasic) + SelectLevel: TThemeSelectSlide; + SelectPlayList: TThemeSelectSlide; + SelectPlayList2: TThemeSelectSlide; + SelectRounds: TThemeSelectSlide; + SelectTeams: TThemeSelectSlide; + SelectPlayers1: TThemeSelectSlide; + SelectPlayers2: TThemeSelectSlide; + SelectPlayers3: TThemeSelectSlide; + + {ButtonNext: TThemeButton; + ButtonPrev: TThemeButton;} + end; + + TThemePartyPlayer = class(TThemeBasic) + Team1Name: TThemeButton; + Player1Name: TThemeButton; + Player2Name: TThemeButton; + Player3Name: TThemeButton; + Player4Name: TThemeButton; + + Team2Name: TThemeButton; + Player5Name: TThemeButton; + Player6Name: TThemeButton; + Player7Name: TThemeButton; + Player8Name: TThemeButton; + + Team3Name: TThemeButton; + Player9Name: TThemeButton; + Player10Name: TThemeButton; + Player11Name: TThemeButton; + Player12Name: TThemeButton; + + {ButtonNext: TThemeButton; + ButtonPrev: TThemeButton;} + end; + + TTheme = class + {$IFDEF THEMESAVE} + ThemeIni: TIniFile; + {$ELSE} + ThemeIni: TMemIniFile; + {$ENDIF} + + Loading: TThemeLoading; + Main: TThemeMain; + Name: TThemeName; + Level: TThemeLevel; + Song: TThemeSong; + Sing: TThemeSing; + Score: TThemeScore; + Top5: TThemeTop5; + Options: TThemeOptions; + OptionsGame: TThemeOptionsGame; + OptionsGraphics: TThemeOptionsGraphics; + OptionsSound: TThemeOptionsSound; + OptionsLyrics: TThemeOptionsLyrics; + OptionsThemes: TThemeOptionsThemes; + OptionsRecord: TThemeOptionsRecord; + //Menu + SongMenu: TThemeSongMenu; + //Party Screens: + PartyNewRound: TThemePartyNewRound; + PartyScore: TThemePartyScore; + PartyWin: TThemePartyWin; + PartyOptions: TThemePartyOptions; + PartyPlayer: TThemePartyPlayer; + + constructor Create(FileName: string); overload; // Initialize theme system + constructor Create(FileName: string; Color: integer); overload; // Initialize theme system with color + function LoadTheme(FileName: string; sColor: integer): boolean; // Load some theme settings from file + + procedure LoadColors; + + procedure ThemeLoadBasic(Theme: TThemeBasic; Name: string); + procedure ThemeLoadBackground(var ThemeBackground: TThemeBackground; Name: string); + procedure ThemeLoadText(var ThemeText: TThemeText; Name: string); + procedure ThemeLoadTexts(var ThemeText: AThemeText; Name: string); + procedure ThemeLoadStatic(var ThemeStatic: TThemeStatic; Name: string); + procedure ThemeLoadStatics(var ThemeStatic: AThemeStatic; Name: string); + procedure ThemeLoadButton(var ThemeButton: TThemeButton; Name: string); + procedure ThemeLoadSelect(var ThemeSelect: TThemeSelect; Name: string); + procedure ThemeLoadSelectSlide(var ThemeSelectS: TThemeSelectSlide; Name: string); + + procedure ThemeSave(FileName: string); + procedure ThemeSaveBasic(Theme: TThemeBasic; Name: string); + procedure ThemeSaveBackground(ThemeBackground: TThemeBackground; Name: string); + procedure ThemeSaveStatic(ThemeStatic: TThemeStatic; Name: string); + procedure ThemeSaveStatics(ThemeStatic: AThemeStatic; Name: string); + procedure ThemeSaveText(ThemeText: TThemeText; Name: string); + procedure ThemeSaveTexts(ThemeText: AThemeText; Name: string); + procedure ThemeSaveButton(ThemeButton: TThemeButton; Name: string); + + end; + + TColor = record + Name: string; + RGB: TRGB; + end; + +function ColorExists(Name: string): integer; +procedure LoadColor(var R, G, B: real; ColorName: string); +function GetSystemColor(Color: integer): TRGB; +function ColorSqrt(RGB: TRGB): TRGB; + +var + //Skin: TSkin; + Theme: TTheme; + Color: array of TColor; + +implementation + +uses +{$IFDEF TRANSLATE} + ULanguage, +{$ENDIF} +USkins, UIni; + +constructor TTheme.Create(FileName: string); +begin + Create(FileName, 0); +end; + +constructor TTheme.Create(FileName: string; Color: integer); +begin + Loading := TThemeLoading.Create; + Main := TThemeMain.Create; + Name := TThemeName.Create; + Level := TThemeLevel.Create; + Song := TThemeSong.Create; + Sing := TThemeSing.Create; + Score := TThemeScore.Create; + Top5 := TThemeTop5.Create; + Options := TThemeOptions.Create; + OptionsGame := TThemeOptionsGame.Create; + OptionsGraphics := TThemeOptionsGraphics.Create; + OptionsSound := TThemeOptionsSound.Create; + OptionsLyrics := TThemeOptionsLyrics.Create; + OptionsThemes := TThemeOptionsThemes.Create; + OptionsRecord := TThemeOptionsRecord.Create; + + SongMenu := TThemeSongMenu.Create; + //Party Screens + PartyNewRound := TThemePartyNewRound.Create; + PartyWin := TThemePartyWin.Create; + PartyScore := TThemePartyScore.Create; + PartyOptions := TThemePartyOptions.Create; + PartyPlayer := TThemePartyPlayer.Create; + + LoadTheme(FileName, Color); + + + {Skin.GrayLeft := 'Left Gray.bmp'; + Skin.GrayMid := 'Mid Gray.bmp'; + Skin.GrayRight := 'Right Gray.bmp'; + + Skin.NoteBGLeft := 'Note BG Left.bmp'; + Skin.NoteBGMid := 'Note BG Mid.bmp'; + Skin.NoteBGRight := 'Note BG Right.bmp'; + + Skin.NoteStar := 'Note Star.jpg'; + + + + //SingBar Mod + Skin.SingBarBack := 'Sing Bar Back.jpg'; + Skin.SingBarBar := 'Sing Bar Bar.jpg'; + Skin.SingBarFront := 'Sing Bar Front.jpg'; + //end Singbar Mod + + //PhrasenBonus - Line Bonus Mod + Skin.SingLineBonusBack := 'Line Bonus PopUp.jpg'; + + + + +{ Skin.WelcomeBG := SkinPath + 'Welcome BG.jpg'; +// Skin.Background := SkinPath + 'Background.jpg'; + Skin.ScoreBG := SkinPath + 'Score BG.jpg'; +// Skin.GameStart := SkinPath + 'Game Start.jpg'; +// Skin.Editor := SkinPath + 'Editor.jpg'; +// Skin.Options := SkinPath + 'Options.jpg'; +// Skin.Exit := SkinPath + 'Exit.jpg'; + + Skin.MainStart := SkinPath + 'Main Solo.jpg'; + Skin.MainEditor := SkinPath + 'Main Multi.jpg'; + Skin.MainOptions := SkinPath + 'Main Options.jpg'; + Skin.MainExit := SkinPath + 'Main Exit.jpg'; + Skin.MainBar := SkinPath + 'Main Bar.jpg'; + Skin.Cursor := SkinPath + 'Main Cursor.jpg'; + + Skin.SongFade := SkinPath + 'Song Fade.jpg';}{ + Skin.SongCover := 'Song Cover.jpg'; + {Skin.SongSelection := SkinPath + 'Song Selection.jpg'; + + Skin.SelectSong := SkinPath + 'Select Song.jpg';}{ +// Skin.Button := SkinPath + 'MusicWheelItem song.jpg'; + Skin.Bar := 'Bar.jpg'; +{ Skin.P := SkinPath + 'P.jpg'; + Skin.Arrow := SkinPath + 'Arrow.jpg'; + Skin.Arrow2 := SkinPath + 'Arrow 2.jpg';}{ + Skin.ButtonF := 'Button.jpg'; + Skin.Ball := 'Ball3.bmp'; +{ Skin.Star := SkinPath + 'Star.bmp'; + Skin.Line := SkinPath + 'Line.jpg';} +end; + + +function TTheme.LoadTheme(FileName: string; sColor: integer): boolean; +var + I: integer; + Path: string; +begin + Result := false; + if FileExists(FileName) then begin + Result := true; + + {$IFDEF THEMESAVE} + ThemeIni := TIniFile.Create(FileName); + {$ELSE} + ThemeIni := TMemIniFile.Create(FileName); + {$ENDIF} + + if ThemeIni.ReadString('Theme', 'Name', '') <> '' then begin + + {Skin.SkinName := ThemeIni.ReadString('Theme', 'Name', 'Singstar'); + Skin.SkinPath := 'Skins\' + Skin.SkinName + '\'; + Skin.SkinReg := false; } + Skin.Color := sColor; + + Skin.LoadSkin(ISkin[Ini.SkinNo]); + + LoadColors; + +// ThemeIni.Free; +// ThemeIni := TIniFile.Create('Themes\Singstar\Main.ini'); + + // Loading + ThemeLoadBasic(Loading, 'Loading'); + + // Main + ThemeLoadBasic(Main, 'Main'); + + ThemeLoadText(Main.TextDescription, 'MainTextDescription'); + ThemeLoadText(Main.TextDescriptionLong, 'MainTextDescriptionLong'); + ThemeLoadButton(Main.ButtonSolo, 'MainButtonSolo'); + ThemeLoadButton(Main.ButtonEditor, 'MainButtonEditor'); + ThemeLoadButton(Main.ButtonOptions, 'MainButtonOptions'); + ThemeLoadButton(Main.ButtonExit, 'MainButtonExit'); + + //Score Text Translation Start + + {$IFDEF TRANSLATE} + Main.Description[0] := Language.Translate('SING_SING'); + Main.DescriptionLong[0] := Language.Translate('SING_SING_DESC'); + Main.Description[1] := Language.Translate('SING_EDITOR'); + Main.DescriptionLong[1] := Language.Translate('SING_EDITOR_DESC'); + Main.Description[2] := Language.Translate('SING_GAME_OPTIONS'); + Main.DescriptionLong[2] := Language.Translate('SING_GAME_OPTIONS_DESC'); + Main.Description[3] := Language.Translate('SING_EXIT'); + Main.DescriptionLong[3] := Language.Translate('SING_EXIT_DESC'); + {$ENDIF} + + //Score Text Translation End + + Main.TextDescription.Text := Main.Description[0]; + Main.TextDescriptionLong.Text := Main.DescriptionLong[0]; + + // Name + ThemeLoadBasic(Name, 'Name'); + + for I := 1 to 6 do + ThemeLoadButton(Name.ButtonPlayer[I], 'NameButtonPlayer'+IntToStr(I)); + + // Level + ThemeLoadBasic(Level, 'Level'); + + ThemeLoadButton(Level.ButtonEasy, 'LevelButtonEasy'); + ThemeLoadButton(Level.ButtonMedium, 'LevelButtonMedium'); + ThemeLoadButton(Level.ButtonHard, 'LevelButtonHard'); + + + // Song + ThemeLoadBasic(Song, 'Song'); + + ThemeLoadText(Song.TextArtist, 'SongTextArtist'); + ThemeLoadText(Song.TextTitle, 'SongTextTitle'); + ThemeLoadText(Song.TextNumber, 'SongTextNumber'); + + //Show Cat in TopLeft Mod + ThemeLoadStatic(Song.StaticCat, 'SongStaticCat'); + ThemeLoadText(Song.TextCat, 'SongTextCat'); + + //Load Cover Pos and Size from Theme Mod + Song.Cover.X := ThemeIni.ReadInteger('SongCover', 'X', 400); + Song.Cover.Y := ThemeIni.ReadInteger('SongCover', 'Y', 100); + Song.Cover.Z := ThemeIni.ReadInteger('SongCover', 'Z', 250); + Song.Cover.W := ThemeIni.ReadInteger('SongCover', 'W', 200); + Song.Cover.H := ThemeIni.ReadInteger('SongCover', 'H', 200); + Song.Cover.Style := ThemeIni.ReadInteger('SongCover', 'Style', 5); + Song.Cover.Reflections := (ThemeIni.ReadInteger('SongCover', 'Reflections', 0) = 1); + //Load Cover Pos and Size from Theme Mod End + + //Load Equalizer Pos and Size from Theme Mod + Song.Equalizer.Visible := (ThemeIni.ReadInteger('SongEqualizer', 'Visible', 0) = 1); + Song.Equalizer.Direction := (ThemeIni.ReadInteger('SongEqualizer', 'Direction', 0) = 1); + Song.Equalizer.Alpha := ThemeIni.ReadInteger('SongEqualizer', 'Alpha', 1); + Song.Equalizer.Space := ThemeIni.ReadInteger('SongEqualizer', 'Space', 1); + Song.Equalizer.X := ThemeIni.ReadInteger('SongEqualizer', 'X', 650); + Song.Equalizer.Y := ThemeIni.ReadInteger('SongEqualizer', 'Y', 430); + Song.Equalizer.Z := ThemeIni.ReadInteger('SongEqualizer', 'Z', 1); + Song.Equalizer.W := ThemeIni.ReadInteger('SongEqualizer', 'PieceW', 8); + Song.Equalizer.H := ThemeIni.ReadInteger('SongEqualizer', 'PieceH', 8); + Song.Equalizer.Bands := ThemeIni.ReadInteger('SongEqualizer', 'Bands', 5); + Song.Equalizer.Length := ThemeIni.ReadInteger('SongEqualizer', 'Length', 12); + + //Party Mode + ThemeLoadStatic(Song.StaticTeam1Joker1, 'SongStaticTeam1Joker1'); + ThemeLoadStatic(Song.StaticTeam1Joker2, 'SongStaticTeam1Joker2'); + ThemeLoadStatic(Song.StaticTeam1Joker3, 'SongStaticTeam1Joker3'); + ThemeLoadStatic(Song.StaticTeam1Joker4, 'SongStaticTeam1Joker4'); + ThemeLoadStatic(Song.StaticTeam1Joker5, 'SongStaticTeam1Joker5'); + + ThemeLoadStatic(Song.StaticTeam2Joker1, 'SongStaticTeam2Joker1'); + ThemeLoadStatic(Song.StaticTeam2Joker2, 'SongStaticTeam2Joker2'); + ThemeLoadStatic(Song.StaticTeam2Joker3, 'SongStaticTeam2Joker3'); + ThemeLoadStatic(Song.StaticTeam2Joker4, 'SongStaticTeam2Joker4'); + ThemeLoadStatic(Song.StaticTeam2Joker5, 'SongStaticTeam2Joker5'); + + ThemeLoadStatic(Song.StaticTeam3Joker1, 'SongStaticTeam3Joker1'); + ThemeLoadStatic(Song.StaticTeam3Joker2, 'SongStaticTeam3Joker2'); + ThemeLoadStatic(Song.StaticTeam3Joker3, 'SongStaticTeam3Joker3'); + ThemeLoadStatic(Song.StaticTeam3Joker4, 'SongStaticTeam3Joker4'); + ThemeLoadStatic(Song.StaticTeam3Joker5, 'SongStaticTeam3Joker5'); + + //Color + I := ColorExists(ThemeIni.ReadString('SongEqualizer', 'Color', 'Black')); + if I >= 0 then begin + Song.Equalizer.ColR := Color[I].RGB.R; + Song.Equalizer.ColG := Color[I].RGB.G; + Song.Equalizer.ColB := Color[I].RGB.B; + end; + //Load Equalizer Pos and Size from Theme Mod End + + // Sing + ThemeLoadBasic(Sing, 'Sing'); + + ThemeLoadStatic(Sing.StaticP1, 'SingP1Static'); + + + //ScoreBG Mod + ThemeLoadStatic(Sing.StaticP1ScoreBG, 'SingP1Static2');//ScoreBG + //end ScoreBG Mod + + + ThemeLoadText(Sing.TextP1, 'SingP1Text'); + ThemeLoadText(Sing.TextP1Score, 'SingP1TextScore'); + + ThemeLoadStatic(Sing.StaticP2R, 'SingP2RStatic'); + + + + //ScoreBG Mod + ThemeLoadStatic(Sing.StaticP2RScoreBG, 'SingP2RStatic2'); + //end ScoreBG Mod + + + + ThemeLoadText(Sing.TextP2R, 'SingP2RText'); + ThemeLoadText(Sing.TextP2RScore, 'SingP2RTextScore'); + + ThemeLoadStatic(Sing.StaticP2M, 'SingP2MStatic'); + + + //ScoreBG Mod + ThemeLoadStatic(Sing.StaticP2MScoreBG, 'SingP2MStatic2'); + //end ScoreBG Mod + + + + ThemeLoadText(Sing.TextP2M, 'SingP2MText'); + ThemeLoadText(Sing.TextP2MScore, 'SingP2MTextScore'); + + ThemeLoadStatic(Sing.StaticP3R, 'SingP3RStatic'); + + + //ScoreBG Mod + ThemeLoadStatic(Sing.StaticP3RScoreBG, 'SingP3RStatic2'); + //end ScoreBG Mod + + + + ThemeLoadText(Sing.TextP3R, 'SingP3RText'); + ThemeLoadText(Sing.TextP3RScore, 'SingP3RTextScore'); + + // Score + ThemeLoadBasic(Score, 'Score'); + + ThemeLoadText(Score.TextArtist, 'ScoreTextArtist'); + ThemeLoadText(Score.TextTitle, 'ScoreTextTitle'); + + for I := 1 to 6 do begin + ThemeLoadStatics(Score.PlayerStatic[I], 'ScorePlayer' + IntToStr(I) + 'Static'); + + ThemeLoadText(Score.TextName[I], 'ScoreTextName' + IntToStr(I)); + ThemeLoadText(Score.TextScore[I], 'ScoreTextScore' + IntToStr(I)); + ThemeLoadText(Score.TextNotes[I], 'ScoreTextNotes' + IntToStr(I)); + ThemeLoadText(Score.TextNotesScore[I], 'ScoreTextNotesScore' + IntToStr(I)); + ThemeLoadText(Score.TextLineBonus[I], 'ScoreTextLineBonus' + IntToStr(I)); + ThemeLoadText(Score.TextLineBonusScore[I], 'ScoreTextLineBonusScore' + IntToStr(I)); + ThemeLoadText(Score.TextGoldenNotes[I], 'ScoreTextGoldenNotes' + IntToStr(I)); + ThemeLoadText(Score.TextGoldenNotesScore[I], 'ScoreTextGoldenNotesScore' + IntToStr(I)); + ThemeLoadText(Score.TextTotal[I], 'ScoreTextTotal' + IntToStr(I)); + ThemeLoadText(Score.TextTotalScore[I], 'ScoreTextTotalScore' + IntToStr(I)); + + ThemeLoadStatic(Score.StaticBoxLightest[I], 'ScoreStaticBoxLightest' + IntToStr(I)); + ThemeLoadStatic(Score.StaticBoxLight[I], 'ScoreStaticBoxLight' + IntToStr(I)); + ThemeLoadStatic(Score.StaticBoxDark[I], 'ScoreStaticBoxDark' + IntToStr(I)); + + ThemeLoadStatic(Score.StaticBackLevel[I], 'ScoreStaticBackLevel' + IntToStr(I)); + ThemeLoadStatic(Score.StaticBackLevelRound[I], 'ScoreStaticBackLevelRound' + IntToStr(I)); + ThemeLoadStatic(Score.StaticLevel[I], 'ScoreStaticLevel' + IntToStr(I)); + ThemeLoadStatic(Score.StaticLevelRound[I], 'ScoreStaticLevelRound' + IntToStr(I)); + end; + + // Top5 + ThemeLoadBasic(Top5, 'Top5'); + + ThemeLoadText(Top5.TextLevel, 'Top5TextLevel'); + ThemeLoadText(Top5.TextArtistTitle, 'Top5TextArtistTitle'); + ThemeLoadStatics(Top5.StaticNumber, 'Top5StaticNumber'); + ThemeLoadTexts(Top5.TextNumber, 'Top5TextNumber'); + ThemeLoadTexts(Top5.TextName, 'Top5TextName'); + ThemeLoadTexts(Top5.TextScore, 'Top5TextScore'); + + // Options + ThemeLoadBasic(Options, 'Options'); + + ThemeLoadButton(Options.ButtonGame, 'OptionsButtonGame'); + ThemeLoadButton(Options.ButtonGraphics, 'OptionsButtonGraphics'); + ThemeLoadButton(Options.ButtonSound, 'OptionsButtonSound'); + ThemeLoadButton(Options.ButtonLyrics, 'OptionsButtonLyrics'); + ThemeLoadButton(Options.ButtonThemes, 'OptionsButtonThemes'); + ThemeLoadButton(Options.ButtonRecord, 'OptionsButtonRecord'); + ThemeLoadButton(Options.ButtonExit, 'OptionsButtonExit'); + + {$IFDEF TRANSLATE} + Options.Description[0] := Language.Translate('SING_OPTIONS_GAME'); + Options.Description[1] := Language.Translate('SING_OPTIONS_GRAPHICS'); + Options.Description[2] := Language.Translate('SING_OPTIONS_SOUND'); + Options.Description[3] := Language.Translate('SING_OPTIONS_LYRICS'); + Options.Description[4] := Language.Translate('SING_OPTIONS_THEMES'); + Options.Description[5] := Language.Translate('SING_OPTIONS_RECORD'); + Options.Description[6] := Language.Translate('SING_OPTIONS_EXIT'); + {$ENDIF} + + ThemeLoadText(Options.TextDescription, 'OptionsTextDescription'); + Options.TextDescription.Text := Options.Description[0]; + + // Options Game + ThemeLoadBasic(OptionsGame, 'OptionsGame'); + + ThemeLoadSelect(OptionsGame.SelectPlayers, 'OptionsGameSelectPlayers'); + ThemeLoadSelect(OptionsGame.SelectDifficulty, 'OptionsGameSelectDifficulty'); + ThemeLoadSelectSlide(OptionsGame.SelectLanguage, 'OptionsGameSelectSlideLanguage'); + ThemeLoadSelect(OptionsGame.SelectTabs, 'OptionsGameSelectTabs'); + ThemeLoadSelectSlide(OptionsGame.SelectSorting, 'OptionsGameSelectSlideSorting'); + ThemeLoadSelect(OptionsGame.SelectDebug, 'OptionsGameSelectDebug'); + ThemeLoadButton(OptionsGame.ButtonExit, 'OptionsGameButtonExit'); + + // Options Graphics + ThemeLoadBasic(OptionsGraphics, 'OptionsGraphics'); + + ThemeLoadSelect(OptionsGraphics.SelectFullscreen, 'OptionsGraphicsSelectFullscreen'); + ThemeLoadSelectSlide(OptionsGraphics.SelectSlideResolution, 'OptionsGraphicsSelectSlideResolution'); + ThemeLoadSelect(OptionsGraphics.SelectDepth, 'OptionsGraphicsSelectDepth'); + ThemeLoadSelect(OptionsGraphics.SelectOscilloscope, 'OptionsGraphicsSelectOscilloscope'); + ThemeLoadSelect(OptionsGraphics.SelectLineBonus, 'OptionsGraphicsSelectLineBonus'); + ThemeLoadSelect(OptionsGraphics.SelectMovieSize, 'OptionsGraphicsSelectMovieSize'); + ThemeLoadButton(OptionsGraphics.ButtonExit, 'OptionsGraphicsButtonExit'); + + // Options Sound + ThemeLoadBasic(OptionsSound, 'OptionsSound'); + + ThemeLoadSelect(OptionsSound.SelectMicBoost, 'OptionsSoundSelectMicBoost'); + ThemeLoadSelect(OptionsSound.SelectClickAssist, 'OptionsSoundSelectClickAssist'); + ThemeLoadSelect(OptionsSound.SelectBeatClick, 'OptionsSoundSelectBeatClick'); + ThemeLoadSelect(OptionsSound.SelectThreshold, 'OptionsSoundSelectThreshold'); + //ThemeLoadSelect(OptionsSound.SelectTwoPlayerMode, 'OptionsSoundSelectTwoPlayerMode'); + ThemeLoadButton(OptionsSound.ButtonExit, 'OptionsSoundButtonExit'); + + // Options Lyrics + ThemeLoadBasic(OptionsLyrics, 'OptionsLyrics'); + + ThemeLoadSelect(OptionsLyrics.SelectLyricsFont, 'OptionsLyricsSelectLyricsFont'); + ThemeLoadSelect(OptionsLyrics.SelectLyricsEffect, 'OptionsLyricsSelectLyricsEffect'); + ThemeLoadSelect(OptionsLyrics.SelectSolmization, 'OptionsLyricsSelectSolmization'); + ThemeLoadButton(OptionsLyrics.ButtonExit, 'OptionsLyricsButtonExit'); + + // Options Themes + ThemeLoadBasic(OptionsThemes, 'OptionsThemes'); + + ThemeLoadSelectSlide(OptionsThemes.SelectTheme, 'OptionsThemesSelectTheme'); + ThemeLoadSelectSlide(OptionsThemes.SelectSkin, 'OptionsThemesSelectSkin'); + ThemeLoadSelectSlide(OptionsThemes.SelectColor, 'OptionsThemesSelectColor'); + ThemeLoadButton(OptionsThemes.ButtonExit, 'OptionsThemesButtonExit'); + + // Options Record + ThemeLoadBasic(OptionsRecord, 'OptionsRecord'); + + ThemeLoadSelectSlide(OptionsRecord.SelectSlideCard, 'OptionsRecordSelectSlideCard'); + ThemeLoadSelectSlide(OptionsRecord.SelectSlideInput, 'OptionsRecordSelectSlideInput'); + ThemeLoadSelectSlide(OptionsRecord.SelectSlideChannelL, 'OptionsRecordSelectSlideChannelL'); + ThemeLoadSelectSlide(OptionsRecord.SelectSlideChannelR, 'OptionsRecordSelectSlideChannelR'); + ThemeLoadButton(OptionsRecord.ButtonExit, 'OptionsRecordButtonExit'); + + //Song Menu + ThemeLoadBasic (SongMenu, 'SongMenu'); + ThemeLoadButton(SongMenu.Button1, 'SongMenuButton1'); + ThemeLoadButton(SongMenu.Button2, 'SongMenuButton2'); + ThemeLoadButton(SongMenu.Button3, 'SongMenuButton3'); + ThemeLoadButton(SongMenu.Button4, 'SongMenuButton4'); + ThemeLoadSelectSlide(SongMenu.SelectSlide3, 'SongMenuSelectSlide3'); + + ThemeLoadText(SongMenu.TextMenu, 'SongMenuTextMenu'); + + //Party Screens: + //Party NewRound + ThemeLoadBasic(PartyNewRound, 'PartyNewRound'); + + ThemeLoadText (PartyNewRound.TextRound1, 'PartyNewRoundTextRound1'); + ThemeLoadText (PartyNewRound.TextRound2, 'PartyNewRoundTextRound2'); + ThemeLoadText (PartyNewRound.TextRound3, 'PartyNewRoundTextRound3'); + ThemeLoadText (PartyNewRound.TextRound4, 'PartyNewRoundTextRound4'); + ThemeLoadText (PartyNewRound.TextRound5, 'PartyNewRoundTextRound5'); + ThemeLoadText (PartyNewRound.TextRound6, 'PartyNewRoundTextRound6'); + ThemeLoadText (PartyNewRound.TextRound7, 'PartyNewRoundTextRound7'); + ThemeLoadText (PartyNewRound.TextWinner1, 'PartyNewRoundTextWinner1'); + ThemeLoadText (PartyNewRound.TextWinner2, 'PartyNewRoundTextWinner2'); + ThemeLoadText (PartyNewRound.TextWinner3, 'PartyNewRoundTextWinner3'); + ThemeLoadText (PartyNewRound.TextWinner4, 'PartyNewRoundTextWinner4'); + ThemeLoadText (PartyNewRound.TextWinner5, 'PartyNewRoundTextWinner5'); + ThemeLoadText (PartyNewRound.TextWinner6, 'PartyNewRoundTextWinner6'); + ThemeLoadText (PartyNewRound.TextWinner7, 'PartyNewRoundTextWinner7'); + ThemeLoadText (PartyNewRound.TextNextRound, 'PartyNewRoundTextNextRound'); + ThemeLoadText (PartyNewRound.TextNextRoundNo, 'PartyNewRoundTextNextRoundNo'); + ThemeLoadText (PartyNewRound.TextNextPlayer1, 'PartyNewRoundTextNextPlayer1'); + ThemeLoadText (PartyNewRound.TextNextPlayer2, 'PartyNewRoundTextNextPlayer2'); + ThemeLoadText (PartyNewRound.TextNextPlayer3, 'PartyNewRoundTextNextPlayer3'); + + ThemeLoadStatic (PartyNewRound.StaticRound1, 'PartyNewRoundStaticRound1'); + ThemeLoadStatic (PartyNewRound.StaticRound2, 'PartyNewRoundStaticRound2'); + ThemeLoadStatic (PartyNewRound.StaticRound3, 'PartyNewRoundStaticRound3'); + ThemeLoadStatic (PartyNewRound.StaticRound4, 'PartyNewRoundStaticRound4'); + ThemeLoadStatic (PartyNewRound.StaticRound5, 'PartyNewRoundStaticRound5'); + ThemeLoadStatic (PartyNewRound.StaticRound6, 'PartyNewRoundStaticRound6'); + ThemeLoadStatic (PartyNewRound.StaticRound7, 'PartyNewRoundStaticRound7'); + + ThemeLoadText (PartyNewRound.TextScoreTeam1, 'PartyNewRoundTextScoreTeam1'); + ThemeLoadText (PartyNewRound.TextScoreTeam2, 'PartyNewRoundTextScoreTeam2'); + ThemeLoadText (PartyNewRound.TextScoreTeam3, 'PartyNewRoundTextScoreTeam3'); + ThemeLoadText (PartyNewRound.TextNameTeam1, 'PartyNewRoundTextNameTeam1'); + ThemeLoadText (PartyNewRound.TextNameTeam2, 'PartyNewRoundTextNameTeam2'); + ThemeLoadText (PartyNewRound.TextNameTeam3, 'PartyNewRoundTextNameTeam3'); + + ThemeLoadStatic (PartyNewRound.StaticTeam1, 'PartyNewRoundStaticTeam1'); + ThemeLoadStatic (PartyNewRound.StaticTeam2, 'PartyNewRoundStaticTeam2'); + ThemeLoadStatic (PartyNewRound.StaticTeam3, 'PartyNewRoundStaticTeam3'); + + ThemeLoadButton (PartyNewRound.ButtonNext, 'PartyNewRoundButtonNext'); + + //Party Score + ThemeLoadBasic(PartyScore, 'PartyScore'); + + ThemeLoadText (PartyScore.TextScoreTeam1, 'PartyScoreTextScoreTeam1'); + ThemeLoadText (PartyScore.TextScoreTeam2, 'PartyScoreTextScoreTeam2'); + ThemeLoadText (PartyScore.TextScoreTeam3, 'PartyScoreTextScoreTeam3'); + ThemeLoadText (PartyScore.TextNameTeam1, 'PartyScoreTextNameTeam1'); + ThemeLoadText (PartyScore.TextNameTeam2, 'PartyScoreTextNameTeam2'); + ThemeLoadText (PartyScore.TextNameTeam3, 'PartyScoreTextNameTeam3'); + + ThemeLoadStatic (PartyScore.StaticTeam1, 'PartyScoreStaticTeam1'); + ThemeLoadStatic (PartyScore.StaticTeam2, 'PartyScoreStaticTeam2'); + ThemeLoadStatic (PartyScore.StaticTeam3, 'PartyScoreStaticTeam3'); + + ThemeLoadText (PartyScore.TextWinner, 'PartyScoreTextWinner'); + + //Party Win + ThemeLoadBasic(PartyWin, 'PartyWin'); + + ThemeLoadText (PartyWin.TextScoreTeam1, 'PartyWinTextScoreTeam1'); + ThemeLoadText (PartyWin.TextScoreTeam2, 'PartyWinTextScoreTeam2'); + ThemeLoadText (PartyWin.TextScoreTeam3, 'PartyWinTextScoreTeam3'); + ThemeLoadText (PartyWin.TextNameTeam1, 'PartyWinTextNameTeam1'); + ThemeLoadText (PartyWin.TextNameTeam2, 'PartyWinTextNameTeam2'); + ThemeLoadText (PartyWin.TextNameTeam3, 'PartyWinTextNameTeam3'); + + ThemeLoadStatic (PartyWin.StaticTeam1, 'PartyWinStaticTeam1'); + ThemeLoadStatic (PartyWin.StaticTeam2, 'PartyWinStaticTeam2'); + ThemeLoadStatic (PartyWin.StaticTeam3, 'PartyWinStaticTeam3'); + + ThemeLoadText (PartyWin.TextWinner, 'PartyWinTextWinner'); + + //Party Options + ThemeLoadBasic(PartyOptions, 'PartyOptions'); + ThemeLoadSelectSlide(PartyOptions.SelectLevel, 'PartyOptionsSelectLevel'); + ThemeLoadSelectSlide(PartyOptions.SelectPlayList, 'PartyOptionsSelectPlayList'); + ThemeLoadSelectSlide(PartyOptions.SelectPlayList2, 'PartyOptionsSelectPlayList2'); + ThemeLoadSelectSlide(PartyOptions.SelectRounds, 'PartyOptionsSelectRounds'); + ThemeLoadSelectSlide(PartyOptions.SelectTeams, 'PartyOptionsSelectTeams'); + ThemeLoadSelectSlide(PartyOptions.SelectPlayers1, 'PartyOptionsSelectPlayers1'); + ThemeLoadSelectSlide(PartyOptions.SelectPlayers2, 'PartyOptionsSelectPlayers2'); + ThemeLoadSelectSlide(PartyOptions.SelectPlayers3, 'PartyOptionsSelectPlayers3'); + + {ThemeLoadButton (ButtonNext, 'ButtonNext'); + ThemeLoadButton (ButtonPrev, 'ButtonPrev');} + + //Party Player + ThemeLoadBasic(PartyPlayer, 'PartyPlayer'); + ThemeLoadButton(PartyPlayer.Team1Name, 'PartyPlayerTeam1Name'); + ThemeLoadButton(PartyPlayer.Player1Name, 'PartyPlayerPlayer1Name'); + ThemeLoadButton(PartyPlayer.Player2Name, 'PartyPlayerPlayer2Name'); + ThemeLoadButton(PartyPlayer.Player3Name, 'PartyPlayerPlayer3Name'); + ThemeLoadButton(PartyPlayer.Player4Name, 'PartyPlayerPlayer4Name'); + + ThemeLoadButton(PartyPlayer.Team2Name, 'PartyPlayerTeam2Name'); + ThemeLoadButton(PartyPlayer.Player5Name, 'PartyPlayerPlayer5Name'); + ThemeLoadButton(PartyPlayer.Player6Name, 'PartyPlayerPlayer6Name'); + ThemeLoadButton(PartyPlayer.Player7Name, 'PartyPlayerPlayer7Name'); + ThemeLoadButton(PartyPlayer.Player8Name, 'PartyPlayerPlayer8Name'); + + ThemeLoadButton(PartyPlayer.Team3Name, 'PartyPlayerTeam3Name'); + ThemeLoadButton(PartyPlayer.Player9Name, 'PartyPlayerPlayer9Name'); + ThemeLoadButton(PartyPlayer.Player10Name, 'PartyPlayerPlayer10Name'); + ThemeLoadButton(PartyPlayer.Player11Name, 'PartyPlayerPlayer11Name'); + ThemeLoadButton(PartyPlayer.Player12Name, 'PartyPlayerPlayer12Name'); + + {ThemeLoadButton(ButtonNext, 'PartyPlayerButtonNext'); + ThemeLoadButton(ButtonPrev, 'PartyPlayerButtonPrev');} + end; + + ThemeIni.Free; + end; +end; + +procedure TTheme.ThemeLoadBasic(Theme: TThemeBasic; Name: string); +begin + ThemeLoadBackground(Theme.Background, Name); + ThemeLoadTexts(Theme.Text, Name + 'Text'); + ThemeLoadStatics(Theme.Static, Name + 'Static'); +end; + +procedure TTheme.ThemeLoadBackground(var ThemeBackground: TThemeBackground; Name: string); +begin + ThemeBackground.Tex := ThemeIni.ReadString(Name + 'Background', 'Tex', ''); +end; + +procedure TTheme.ThemeLoadText(var ThemeText: TThemeText; Name: string); +var + C: integer; +begin + DecimalSeparator := '.'; + ThemeText.X := ThemeIni.ReadInteger(Name, 'X', 0); + ThemeText.Y := ThemeIni.ReadInteger(Name, 'Y', 0); + + ThemeText.ColR := ThemeIni.ReadFloat(Name, 'ColR', 0); + ThemeText.ColG := ThemeIni.ReadFloat(Name, 'ColG', 0); + ThemeText.ColB := ThemeIni.ReadFloat(Name, 'ColB', 0); + + ThemeText.Font := ThemeIni.ReadInteger(Name, 'Font', 0); + ThemeText.Size := ThemeIni.ReadInteger(Name, 'Size', 0); + ThemeText.Align := ThemeIni.ReadInteger(Name, 'Align', 0); + + {$IFDEF TRANSLATE} + ThemeText.Text := Language.Translate(ThemeIni.ReadString(Name, 'Text', '')); + {$ELSE} + ThemeText.Text := ThemeIni.ReadString(Name, 'Text', ''); + {$ENDIF} + + ThemeText.Color := ThemeIni.ReadString(Name, 'Color', ''); + + C := ColorExists(ThemeText.Color); + if C >= 0 then begin + ThemeText.ColR := Color[C].RGB.R; + ThemeText.ColG := Color[C].RGB.G; + ThemeText.ColB := Color[C].RGB.B; + end; + + DecimalSeparator := ','; +end; + +procedure TTheme.ThemeLoadTexts(var ThemeText: AThemeText; Name: string); +var + T: integer; +begin + T := 1; + while ThemeIni.SectionExists(Name + IntToStr(T)) do begin + SetLength(ThemeText, T); + ThemeLoadText(ThemeText[T-1], Name + IntToStr(T)); + Inc(T); + end; +end; + +procedure TTheme.ThemeLoadStatic(var ThemeStatic: TThemeStatic; Name: string); +var + C: integer; +begin + DecimalSeparator := '.'; + + ThemeStatic.Tex := ThemeIni.ReadString(Name, 'Tex', ''); + + ThemeStatic.X := ThemeIni.ReadInteger(Name, 'X', 0); + ThemeStatic.Y := ThemeIni.ReadInteger(Name, 'Y', 0); + ThemeStatic.Z := ThemeIni.ReadFloat(Name, 'Z', 0); + ThemeStatic.W := ThemeIni.ReadInteger(Name, 'W', 0); + ThemeStatic.H := ThemeIni.ReadInteger(Name, 'H', 0); + + ThemeStatic.Typ := ThemeIni.ReadString(Name, 'Type', ''); + ThemeStatic.Color := ThemeIni.ReadString(Name, 'Color', ''); + + C := ColorExists(ThemeStatic.Color); + if C >= 0 then begin + ThemeStatic.ColR := Color[C].RGB.R; + ThemeStatic.ColG := Color[C].RGB.G; + ThemeStatic.ColB := Color[C].RGB.B; + end; + + ThemeStatic.TexX1 := ThemeIni.ReadFloat(Name, 'TexX1', 0); + ThemeStatic.TexY1 := ThemeIni.ReadFloat(Name, 'TexY1', 0); + ThemeStatic.TexX2 := ThemeIni.ReadFloat(Name, 'TexX2', 1); + ThemeStatic.TexY2 := ThemeIni.ReadFloat(Name, 'TexY2', 1); + + DecimalSeparator := ','; +end; + +procedure TTheme.ThemeLoadStatics(var ThemeStatic: AThemeStatic; Name: string); +var + S: integer; +begin + S := 1; + while ThemeIni.SectionExists(Name + IntToStr(S)) do begin + SetLength(ThemeStatic, S); + ThemeLoadStatic(ThemeStatic[S-1], Name + IntToStr(S)); + Inc(S); + end; +end; + +procedure TTheme.ThemeLoadButton(var ThemeButton: TThemeButton; Name: string); +var + C: integer; + TLen: integer; + T: integer; +begin + DecimalSeparator := '.'; + ThemeButton.Tex := ThemeIni.ReadString(Name, 'Tex', ''); + ThemeButton.X := ThemeIni.ReadInteger(Name, 'X', 0); + ThemeButton.Y := ThemeIni.ReadInteger(Name, 'Y', 0); + ThemeButton.W := ThemeIni.ReadInteger(Name, 'W', 0); + ThemeButton.H := ThemeIni.ReadInteger(Name, 'H', 0); + + ThemeButton.Typ := ThemeIni.ReadString(Name, 'Type', ''); + + //Reflection Mod + ThemeButton.Reflection := (ThemeIni.ReadInteger(Name, 'Reflection', 0) = 1); + + ThemeButton.ColR := ThemeIni.ReadFloat(Name, 'ColR', 1); + ThemeButton.ColG := ThemeIni.ReadFloat(Name, 'ColG', 1); + ThemeButton.ColB := ThemeIni.ReadFloat(Name, 'ColB', 1); + ThemeButton.Int := ThemeIni.ReadFloat(Name, 'Int', 1); + ThemeButton.DColR := ThemeIni.ReadFloat(Name, 'DColR', 1); + ThemeButton.DColG := ThemeIni.ReadFloat(Name, 'DColG', 1); + ThemeButton.DColB := ThemeIni.ReadFloat(Name, 'DColB', 1); + ThemeButton.DInt := ThemeIni.ReadFloat(Name, 'DInt', 1); + + ThemeButton.Color := ThemeIni.ReadString(Name, 'Color', ''); + C := ColorExists(ThemeButton.Color); + if C >= 0 then begin + ThemeButton.ColR := Color[C].RGB.R; + ThemeButton.ColG := Color[C].RGB.G; + ThemeButton.ColB := Color[C].RGB.B; + end; + + ThemeButton.DColor := ThemeIni.ReadString(Name, 'DColor', ''); + C := ColorExists(ThemeButton.DColor); + if C >= 0 then begin + ThemeButton.DColR := Color[C].RGB.R; + ThemeButton.DColG := Color[C].RGB.G; + ThemeButton.DColB := Color[C].RGB.B; + end; + + TLen := ThemeIni.ReadInteger(Name, 'Texts', 0); + SetLength(ThemeButton.Text, TLen); + for T := 1 to TLen do + ThemeLoadText(ThemeButton.Text[T-1], Name + 'Text' + IntToStr(T)); + + DecimalSeparator := ','; +end; + +procedure TTheme.ThemeLoadSelect(var ThemeSelect: TThemeSelect; Name: string); +var + C: integer; +begin + DecimalSeparator := '.'; + + {$IFDEF TRANSLATE} + ThemeSelect.Text := Language.Translate(ThemeIni.ReadString(Name, 'Text', '')); + {$ELSE} + ThemeSelect.Text := ThemeIni.ReadString(Name, 'Text', ''); + {$ENDIF} + + ThemeSelect.Tex := {Skin.SkinPath + }ThemeIni.ReadString(Name, 'Tex', ''); + ThemeSelect.TexSBG := {Skin.SkinPath + }ThemeIni.ReadString(Name, 'TexSBG', ''); + + ThemeSelect.X := ThemeIni.ReadInteger(Name, 'X', 0); + ThemeSelect.Y := ThemeIni.ReadInteger(Name, 'Y', 0); + ThemeSelect.W := ThemeIni.ReadInteger(Name, 'W', 0); + ThemeSelect.H := ThemeIni.ReadInteger(Name, 'H', 0); + ThemeSelect.SkipX := ThemeIni.ReadInteger(Name, 'SkipX', 0); + + + LoadColor(ThemeSelect.ColR, ThemeSelect.ColG, ThemeSelect.ColB, ThemeIni.ReadString(Name, 'Color', '')); + ThemeSelect.Int := ThemeIni.ReadFloat(Name, 'Int', 1); + LoadColor(ThemeSelect.DColR, ThemeSelect.DColG, ThemeSelect.DColB, ThemeIni.ReadString(Name, 'DColor', '')); + ThemeSelect.DInt := ThemeIni.ReadFloat(Name, 'DInt', 1); + + LoadColor(ThemeSelect.TColR, ThemeSelect.TColG, ThemeSelect.TColB, ThemeIni.ReadString(Name, 'TColor', '')); + ThemeSelect.TInt := ThemeIni.ReadFloat(Name, 'TInt', 1); + LoadColor(ThemeSelect.TDColR, ThemeSelect.TDColG, ThemeSelect.TDColB, ThemeIni.ReadString(Name, 'TDColor', '')); + ThemeSelect.TDInt := ThemeIni.ReadFloat(Name, 'TDInt', 1); + + LoadColor(ThemeSelect.SBGColR, ThemeSelect.SBGColG, ThemeSelect.SBGColB, ThemeIni.ReadString(Name, 'SBGColor', '')); + ThemeSelect.SBGInt := ThemeIni.ReadFloat(Name, 'SBGInt', 1); + LoadColor(ThemeSelect.SBGDColR, ThemeSelect.SBGDColG, ThemeSelect.SBGDColB, ThemeIni.ReadString(Name, 'SBGDColor', '')); + ThemeSelect.SBGDInt := ThemeIni.ReadFloat(Name, 'SBGDInt', 1); + + LoadColor(ThemeSelect.STColR, ThemeSelect.STColG, ThemeSelect.STColB, ThemeIni.ReadString(Name, 'STColor', '')); + ThemeSelect.STInt := ThemeIni.ReadFloat(Name, 'STInt', 1); + LoadColor(ThemeSelect.STDColR, ThemeSelect.STDColG, ThemeSelect.STDColB, ThemeIni.ReadString(Name, 'STDColor', '')); + ThemeSelect.STDInt := ThemeIni.ReadFloat(Name, 'STDInt', 1); + + + DecimalSeparator := ','; +end; + +procedure TTheme.ThemeLoadSelectSlide(var ThemeSelectS: TThemeSelectSlide; Name: string); +var + C: integer; +begin + DecimalSeparator := '.'; + + {$IFDEF TRANSLATE} + ThemeSelectS.Text := Language.Translate(ThemeIni.ReadString(Name, 'Text', '')); + {$ELSE} + ThemeSelectS.Text := ThemeIni.ReadString(Name, 'Text', ''); + {$ENDIF} + + ThemeSelectS.Tex := {Skin.SkinPath + }ThemeIni.ReadString(Name, 'Tex', ''); + ThemeSelectS.TexSBG := {Skin.SkinPath + }ThemeIni.ReadString(Name, 'TexSBG', ''); + + ThemeSelectS.X := ThemeIni.ReadInteger(Name, 'X', 0); + ThemeSelectS.Y := ThemeIni.ReadInteger(Name, 'Y', 0); + ThemeSelectS.W := ThemeIni.ReadInteger(Name, 'W', 0); + ThemeSelectS.H := ThemeIni.ReadInteger(Name, 'H', 0); + ThemeSelectS.SkipX := ThemeIni.ReadInteger(Name, 'SkipX', 0); + + + LoadColor(ThemeSelectS.ColR, ThemeSelectS.ColG, ThemeSelectS.ColB, ThemeIni.ReadString(Name, 'Color', '')); + ThemeSelectS.Int := ThemeIni.ReadFloat(Name, 'Int', 1); + LoadColor(ThemeSelectS.DColR, ThemeSelectS.DColG, ThemeSelectS.DColB, ThemeIni.ReadString(Name, 'DColor', '')); + ThemeSelectS.DInt := ThemeIni.ReadFloat(Name, 'DInt', 1); + + LoadColor(ThemeSelectS.TColR, ThemeSelectS.TColG, ThemeSelectS.TColB, ThemeIni.ReadString(Name, 'TColor', '')); + ThemeSelectS.TInt := ThemeIni.ReadFloat(Name, 'TInt', 1); + LoadColor(ThemeSelectS.TDColR, ThemeSelectS.TDColG, ThemeSelectS.TDColB, ThemeIni.ReadString(Name, 'TDColor', '')); + ThemeSelectS.TDInt := ThemeIni.ReadFloat(Name, 'TDInt', 1); + + LoadColor(ThemeSelectS.SBGColR, ThemeSelectS.SBGColG, ThemeSelectS.SBGColB, ThemeIni.ReadString(Name, 'SBGColor', '')); + ThemeSelectS.SBGInt := ThemeIni.ReadFloat(Name, 'SBGInt', 1); + LoadColor(ThemeSelectS.SBGDColR, ThemeSelectS.SBGDColG, ThemeSelectS.SBGDColB, ThemeIni.ReadString(Name, 'SBGDColor', '')); + ThemeSelectS.SBGDInt := ThemeIni.ReadFloat(Name, 'SBGDInt', 1); + + LoadColor(ThemeSelectS.STColR, ThemeSelectS.STColG, ThemeSelectS.STColB, ThemeIni.ReadString(Name, 'STColor', '')); + ThemeSelectS.STInt := ThemeIni.ReadFloat(Name, 'STInt', 1); + LoadColor(ThemeSelectS.STDColR, ThemeSelectS.STDColG, ThemeSelectS.STDColB, ThemeIni.ReadString(Name, 'STDColor', '')); + ThemeSelectS.STDInt := ThemeIni.ReadFloat(Name, 'STDInt', 1); + + + DecimalSeparator := ','; +end; + +procedure TTheme.LoadColors; +var + SL: TStringList; + C: integer; + S: string; + Col: integer; + RGB: TRGB; +begin + SL := TStringList.Create; + ThemeIni.ReadSection('Colors', SL); + + // normal colors + SetLength(Color, SL.Count); + for C := 0 to SL.Count-1 do begin + Color[C].Name := SL.Strings[C]; + + S := ThemeIni.ReadString('Colors', SL.Strings[C], ''); + + Color[C].RGB.R := StrToInt(Copy(S, 1, Pos(' ' , S)-1))/255; + Delete(S, 1, Pos(' ', S)); + + Color[C].RGB.G := StrToInt(Copy(S, 1, Pos(' ' , S)-1))/255; + Delete(S, 1, Pos(' ', S)); + + Color[C].RGB.B := StrToInt(S)/255; + end; + + // skin color + SetLength(Color, SL.Count + 3); + C := SL.Count; + Color[C].Name := 'ColorDark'; + Color[C].RGB := GetSystemColor(Skin.Color); //Ini.Color); + + C := C+1; + Color[C].Name := 'ColorLight'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + C := C+1; + Color[C].Name := 'ColorLightest'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + // players colors + SetLength(Color, Length(Color)+18); + + // P1 + C := C+1; + Color[C].Name := 'P1Dark'; + Color[C].RGB := GetSystemColor(0); // 0 - blue + + C := C+1; + Color[C].Name := 'P1Light'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + C := C+1; + Color[C].Name := 'P1Lightest'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + // P2 + C := C+1; + Color[C].Name := 'P2Dark'; + Color[C].RGB := GetSystemColor(3); // 3 - red + + C := C+1; + Color[C].Name := 'P2Light'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + C := C+1; + Color[C].Name := 'P2Lightest'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + // P3 + C := C+1; + Color[C].Name := 'P3Dark'; + Color[C].RGB := GetSystemColor(1); // 1 - green + + C := C+1; + Color[C].Name := 'P3Light'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + C := C+1; + Color[C].Name := 'P3Lightest'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + // P4 + C := C+1; + Color[C].Name := 'P4Dark'; + Color[C].RGB := GetSystemColor(4); // 4 - brown + + C := C+1; + Color[C].Name := 'P4Light'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + C := C+1; + Color[C].Name := 'P4Lightest'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + // P5 + C := C+1; + Color[C].Name := 'P5Dark'; + Color[C].RGB := GetSystemColor(5); // 5 - yellow + + C := C+1; + Color[C].Name := 'P5Light'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + C := C+1; + Color[C].Name := 'P5Lightest'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + // P6 + C := C+1; + Color[C].Name := 'P6Dark'; + Color[C].RGB := GetSystemColor(6); // 6 - violet + + C := C+1; + Color[C].Name := 'P6Light'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + C := C+1; + Color[C].Name := 'P6Lightest'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + + SL.Free; +end; + +function ColorExists(Name: string): integer; +var + C: integer; +begin + Result := -1; + for C := 0 to High(Color) do + if Color[C].Name = Name then Result := C; +end; + +procedure LoadColor(var R, G, B: real; ColorName: string); +var + C: integer; +begin + C := ColorExists(ColorName); + if C >= 0 then begin + R := Color[C].RGB.R; + G := Color[C].RGB.G; + B := Color[C].RGB.B; + end; +end; + +function GetSystemColor(Color: integer): TRGB; +begin + case Color of + 0: begin + // blue + Result.R := 71/255; + Result.G := 175/255; + Result.B := 247/255; + end; + 1: begin + // green + Result.R := 63/255; + Result.G := 191/255; + Result.B := 63/255; + end; + 2: begin + // pink + Result.R := 255/255; +{ Result.G := 63/255; + Result.B := 192/255;} + Result.G := 175/255; + Result.B := 247/255; + end; + 3: begin + // red + Result.R := 247/255; + Result.G := 71/255; + Result.B := 71/255; + end; + //'Violet', 'Orange', 'Yellow', 'Brown', 'Black' + //New Theme-Color Patch + 4: begin + // violet + Result.R := 230/255; + Result.G := 63/255; + Result.B := 230/255; + end; + 5: begin + // orange + Result.R := 255/255; + Result.G := 144/255; + Result.B := 0; + end; + 6: begin + // yellow + Result.R := 230/255; + Result.G := 230/255; + Result.B := 95/255; + end; + 7: begin + // brown + Result.R := 192/255; + Result.G := 127/255; + Result.B := 31/255; + end; + 8: begin + // black + Result.R := 0; + Result.G := 0; + Result.B := 0; + end; + //New Theme-Color Patch End + + end; + + // pink +// Col := clRed; +// Color[C].ColR := (32 + Col and $FF) / (255 + 32); +// Color[C].ColG := (32 + Col div 256 and $FF) / (255 + 32); +// Color[C].ColB := (32 + Col div (256*256) and $FF) / (255 + 32); + + // purple +// Color[C].ColR := 220/255; +// Color[C].ColG := 95/255; +// Color[C].ColB := 220/255;} + +end; + +function ColorSqrt(RGB: TRGB): TRGB; +begin + Result.R := sqrt(RGB.R); + Result.G := sqrt(RGB.G); + Result.B := sqrt(RGB.B); +end; + +procedure TTheme.ThemeSave(FileName: string); +var + I: integer; +begin + {$IFDEF THEMESAVE} + ThemeIni := TIniFile.Create(FileName); + {$ELSE} + ThemeIni := TMemIniFile.Create(FileName); + {$ENDIF} + + ThemeSaveBasic(Loading, 'Loading'); + + ThemeSaveBasic(Main, 'Main'); + ThemeSaveText(Main.TextDescription, 'MainTextDescription'); + ThemeSaveText(Main.TextDescriptionLong, 'MainTextDescriptionLong'); + ThemeSaveButton(Main.ButtonSolo, 'MainButtonSolo'); + ThemeSaveButton(Main.ButtonEditor, 'MainButtonEditor'); + ThemeSaveButton(Main.ButtonOptions, 'MainButtonOptions'); + ThemeSaveButton(Main.ButtonExit, 'MainButtonExit'); + + ThemeSaveBasic(Name, 'Name'); + for I := 1 to 6 do + ThemeSaveButton(Name.ButtonPlayer[I], 'NameButtonPlayer' + IntToStr(I)); + + ThemeSaveBasic(Level, 'Level'); + ThemeSaveButton(Level.ButtonEasy, 'LevelButtonEasy'); + ThemeSaveButton(Level.ButtonMedium, 'LevelButtonMedium'); + ThemeSaveButton(Level.ButtonHard, 'LevelButtonHard'); + + ThemeSaveBasic(Song, 'Song'); + ThemeSaveText(Song.TextArtist, 'SongTextArtist'); + ThemeSaveText(Song.TextTitle, 'SongTextTitle'); + ThemeSaveText(Song.TextNumber, 'SongTextNumber'); + + //Show CAt in Top Left Mod + ThemeSaveText(Song.TextCat, 'SongTextCat'); + ThemeSaveStatic(Song.StaticCat, 'SongStaticCat'); + + ThemeSaveBasic(Sing, 'Sing'); + ThemeSaveStatic(Sing.StaticP1, 'SingP1Static'); + + + + //ScoreBG Mod + ThemeSaveStatic(Sing.StaticP1ScoreBG, 'SingP1Static2'); + //end ScoreBG Mod + + + + ThemeSaveText(Sing.TextP1, 'SingP1Text'); + ThemeSaveText(Sing.TextP1Score, 'SingP1TextScore'); + + ThemeSaveStatic(Sing.StaticP2R, 'SingP2RStatic'); + + + + //ScoreBG Mod + ThemeSaveStatic(Sing.StaticP2RScoreBG, 'SingP2RStatic2'); + //end ScoreBG Mod + + + + ThemeSaveText(Sing.TextP2R, 'SingP2RText'); + ThemeSaveText(Sing.TextP2RScore, 'SingP2RTextScore'); + + ThemeSaveStatic(Sing.StaticP2M, 'SingP2MStatic'); + + + + //ScoreBG Mod + ThemeSaveStatic(Sing.StaticP2MScoreBG, 'SingP2MStatic2'); + //end ScoreBG Mod + + + + + ThemeSaveText(Sing.TextP2M, 'SingP2MText'); + ThemeSaveText(Sing.TextP2MScore, 'SingP2MTextScore'); + + ThemeSaveStatic(Sing.StaticP3R, 'SingP3RStatic'); + + + + //ScoreBG Mod + ThemeSaveStatic(Sing.StaticP3RScoreBG, 'SingP3RStatic2'); + //end ScoreBG Mod + + + + + ThemeSaveText(Sing.TextP3R, 'SingP3RText'); + ThemeSaveText(Sing.TextP3RScore, 'SingP3RTextScore'); + + ThemeSaveBasic(Score, 'Score'); + ThemeSaveText(Score.TextArtist, 'ScoreTextArtist'); + ThemeSaveText(Score.TextTitle, 'ScoreTextTitle'); + + for I := 1 to 6 do begin + ThemeSaveStatics(Score.PlayerStatic[I], 'ScorePlayer' + IntToStr(I) + 'Static'); + + ThemeSaveText(Score.TextName[I], 'ScoreTextName' + IntToStr(I)); + ThemeSaveText(Score.TextScore[I], 'ScoreTextScore' + IntToStr(I)); + ThemeSaveText(Score.TextNotes[I], 'ScoreTextNotes' + IntToStr(I)); + ThemeSaveText(Score.TextNotesScore[I], 'ScoreTextNotesScore' + IntToStr(I)); + ThemeSaveText(Score.TextLineBonus[I], 'ScoreTextLineBonus' + IntToStr(I)); + ThemeSaveText(Score.TextLineBonusScore[I], 'ScoreTextLineBonusScore' + IntToStr(I)); + ThemeSaveText(Score.TextGoldenNotes[I], 'ScoreTextGoldenNotes' + IntToStr(I)); + ThemeSaveText(Score.TextGoldenNotesScore[I], 'ScoreTextGoldenNotesScore' + IntToStr(I)); + ThemeSaveText(Score.TextTotal[I], 'ScoreTextTotal' + IntToStr(I)); + ThemeSaveText(Score.TextTotalScore[I], 'ScoreTextTotalScore' + IntToStr(I)); + + ThemeSaveStatic(Score.StaticBackLevel[I], 'ScoreStaticBackLevel' + IntToStr(I)); + ThemeSaveStatic(Score.StaticBackLevelRound[I], 'ScoreStaticBackLevelRound' + IntToStr(I)); + ThemeSaveStatic(Score.StaticLevel[I], 'ScoreStaticLevel' + IntToStr(I)); + ThemeSaveStatic(Score.StaticLevelRound[I], 'ScoreStaticLevelRound' + IntToStr(I)); + end; + + ThemeSaveBasic(Top5, 'Top5'); + ThemeSaveText(Top5.TextLevel, 'Top5TextLevel'); + ThemeSaveText(Top5.TextArtistTitle, 'Top5TextArtistTitle'); + ThemeSaveStatics(Top5.StaticNumber, 'Top5StaticNumber'); + ThemeSaveTexts(Top5.TextNumber, 'Top5TextNumber'); + ThemeSaveTexts(Top5.TextName, 'Top5TextName'); + ThemeSaveTexts(Top5.TextScore, 'Top5TextScore'); + + + ThemeIni.Free; +end; + +procedure TTheme.ThemeSaveBasic(Theme: TThemeBasic; Name: string); +begin + ThemeIni.WriteInteger(Name, 'Texts', Length(Theme.Text)); + + ThemeSaveBackground(Theme.Background, Name + 'Background'); + ThemeSaveStatics(Theme.Static, Name + 'Static'); + ThemeSaveTexts(Theme.Text, Name + 'Text'); +end; + +procedure TTheme.ThemeSaveBackground(ThemeBackground: TThemeBackground; Name: string); +begin + if ThemeBackground.Tex <> '' then + ThemeIni.WriteString(Name, 'Tex', ThemeBackground.Tex) + else begin + ThemeIni.EraseSection(Name); + end; +end; + +procedure TTheme.ThemeSaveStatic(ThemeStatic: TThemeStatic; Name: string); +begin + DecimalSeparator := '.'; + ThemeIni.WriteInteger(Name, 'X', ThemeStatic.X); + ThemeIni.WriteInteger(Name, 'Y', ThemeStatic.Y); + ThemeIni.WriteInteger(Name, 'W', ThemeStatic.W); + ThemeIni.WriteInteger(Name, 'H', ThemeStatic.H); + + ThemeIni.WriteString(Name, 'Tex', ThemeStatic.Tex); + ThemeIni.WriteString(Name, 'Type', ThemeStatic.Typ); + ThemeIni.WriteString(Name, 'Color', ThemeStatic.Color); + + ThemeIni.WriteFloat(Name, 'TexX1', ThemeStatic.TexX1); + ThemeIni.WriteFloat(Name, 'TexY1', ThemeStatic.TexY1); + ThemeIni.WriteFloat(Name, 'TexX2', ThemeStatic.TexX2); + ThemeIni.WriteFloat(Name, 'TexY2', ThemeStatic.TexY2); + + DecimalSeparator := ','; +end; + +procedure TTheme.ThemeSaveStatics(ThemeStatic: AThemeStatic; Name: string); +var + S: integer; +begin + for S := 0 to Length(ThemeStatic)-1 do + ThemeSaveStatic(ThemeStatic[S], Name + {'Static' +} IntToStr(S+1)); + + ThemeIni.EraseSection(Name + {'Static' + }IntToStr(S+1)); +end; + +procedure TTheme.ThemeSaveText(ThemeText: TThemeText; Name: string); +begin + DecimalSeparator := '.'; + ThemeIni.WriteInteger(Name, 'X', ThemeText.X); + ThemeIni.WriteInteger(Name, 'Y', ThemeText.Y); + + ThemeIni.WriteInteger(Name, 'Font', ThemeText.Font); + ThemeIni.WriteInteger(Name, 'Size', ThemeText.Size); + ThemeIni.WriteInteger(Name, 'Align', ThemeText.Align); + + ThemeIni.WriteString(Name, 'Text', ThemeText.Text); + ThemeIni.WriteString(Name, 'Color', ThemeText.Color); + + DecimalSeparator := ','; +end; + +procedure TTheme.ThemeSaveTexts(ThemeText: AThemeText; Name: string); +var + T: integer; +begin + for T := 0 to Length(ThemeText)-1 do + ThemeSaveText(ThemeText[T], Name + {'Text' + }IntToStr(T+1)); + + ThemeIni.EraseSection(Name + {'Text' + }IntToStr(T+1)); +end; + +procedure TTheme.ThemeSaveButton(ThemeButton: TThemeButton; Name: string); +var + T: integer; +begin + DecimalSeparator := '.'; + ThemeIni.WriteString(Name, 'Tex', ThemeButton.Tex); + ThemeIni.WriteInteger(Name, 'X', ThemeButton.X); + ThemeIni.WriteInteger(Name, 'Y', ThemeButton.Y); + ThemeIni.WriteInteger(Name, 'W', ThemeButton.W); + ThemeIni.WriteInteger(Name, 'H', ThemeButton.H); + + ThemeIni.WriteString(Name, 'Type', ThemeButton.Typ); + ThemeIni.WriteInteger(Name, 'Texts', Length(ThemeButton.Text)); + + ThemeIni.WriteString(Name, 'Color', ThemeButton.Color); + +{ ThemeButton.ColR := ThemeIni.ReadFloat(Name, 'ColR', 1); + ThemeButton.ColG := ThemeIni.ReadFloat(Name, 'ColG', 1); + ThemeButton.ColB := ThemeIni.ReadFloat(Name, 'ColB', 1); + ThemeButton.Int := ThemeIni.ReadFloat(Name, 'Int', 1); + ThemeButton.DColR := ThemeIni.ReadFloat(Name, 'DColR', 1); + ThemeButton.DColG := ThemeIni.ReadFloat(Name, 'DColG', 1); + ThemeButton.DColB := ThemeIni.ReadFloat(Name, 'DColB', 1); + ThemeButton.DInt := ThemeIni.ReadFloat(Name, 'DInt', 1);} + +{ C := ColorExists(ThemeIni.ReadString(Name, 'Color', '')); + if C >= 0 then begin + ThemeButton.ColR := Color[C].RGB.R; + ThemeButton.ColG := Color[C].RGB.G; + ThemeButton.ColB := Color[C].RGB.B; + end; + + C := ColorExists(ThemeIni.ReadString(Name, 'DColor', '')); + if C >= 0 then begin + ThemeButton.DColR := Color[C].RGB.R; + ThemeButton.DColG := Color[C].RGB.G; + ThemeButton.DColB := Color[C].RGB.B; + end;} + + for T := 0 to High(ThemeButton.Text) do + ThemeSaveText(ThemeButton.Text[T], Name + 'Text' + IntToStr(T+1)); + + DecimalSeparator := ','; +end; + + +end. diff --git a/Game/Code/Classes/UTime.dcu b/Game/Code/Classes/UTime.dcu new file mode 100644 index 00000000..f69b60f7 Binary files /dev/null and b/Game/Code/Classes/UTime.dcu differ diff --git a/Game/Code/Classes/UTime.pas b/Game/Code/Classes/UTime.pas new file mode 100644 index 00000000..29e972ae --- /dev/null +++ b/Game/Code/Classes/UTime.pas @@ -0,0 +1,81 @@ +unit UTime; + +interface + +type + TTime = class + constructor Create; + function GetTime: real; + end; + +procedure CountSkipTimeSet; +procedure CountSkipTime; +procedure CountMidTime; +procedure TimeSleep(ms: real); + +var + USTime: TTime; + + TimeFreq: int64; + TimeNew: int64; + TimeOld: int64; + TimeSkip: real; + TimeMid: real; + TimeMidTemp: int64; + +implementation + +uses Windows; + +constructor TTime.Create; +begin + CountSkipTimeSet; +end; + +procedure CountSkipTimeSet; +begin + QueryPerformanceFrequency(TimeFreq); + QueryPerformanceCounter(TimeNew); +end; + +procedure CountSkipTime; +begin + TimeOld := TimeNew; + QueryPerformanceCounter(TimeNew); + TimeSkip := (TimeNew-TimeOld)/TimeFreq; +end; + +procedure CountMidTime; +begin + QueryPerformanceCounter(TimeMidTemp); + TimeMid := (TimeMidTemp-TimeNew)/TimeFreq; +end; + +procedure TimeSleep(ms: real); +var + TimeStart: int64; + TimeHalf: int64; + Time: real; + Stop: boolean; +begin + QueryPerformanceCounter(TimeStart); + + Stop := false; + while (not Stop) do begin + QueryPerformanceCounter(TimeHalf); + Time := 1000 * (TimeHalf-TimeStart)/TimeFreq; + if Time > ms then Stop := true; + end; + +end; + +function TTime.GetTime: real; +var + TimeTemp: int64; +begin + QueryPerformanceCounter(TimeTemp); + Result := TimeTemp/TimeFreq; +end; + + +end. diff --git a/Game/Code/Menu/UDisplay.dcu b/Game/Code/Menu/UDisplay.dcu new file mode 100644 index 00000000..f4f89245 Binary files /dev/null and b/Game/Code/Menu/UDisplay.dcu differ diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas new file mode 100644 index 00000000..6d0443cc --- /dev/null +++ b/Game/Code/Menu/UDisplay.pas @@ -0,0 +1,289 @@ +unit UDisplay; + +interface + +uses Windows, SDL, UMenu, OpenGL12, SysUtils; + +type + TDisplay = class + ActualScreen: PMenu; + NextScreen: PMenu; + + h_DC: HDC; + h_RC: HGLRC; + +// FadeType: integer; + FadeTex: glUInt; + LastFade: real; + Fade: real; + function Draw: Boolean; + procedure PrintScreen; + constructor Create; + procedure ScreenShot; + end; + +var + Display: TDisplay; +// ActualScreen: PMenu; +// NextScreen: PMenu; + +implementation + +uses UGraphic, UTime, Graphics, Jpeg, UPliki, UTexture; + +constructor TDisplay.Create; +begin + inherited Create; +// FadeType := 0; + Fade := 0; +end; + +function TDisplay.Draw: Boolean; +var + S: integer; + Col: real; + Surface: PSDL_Surface; +begin + Result := True; + + Col := 1; + if (ParamStr(1) = '-black') or (ParamStr(1) = '-fsblack') then + Col := 0; + + glClearColor(Col, Col, Col , 1); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + for S := 1 to Screens do begin + ScreenAct := S; + +// if Screens = 1 then ScreenX := 0; +// if (Screens = 2) and (S = 1) then ScreenX := -1; +// if (Screens = 2) and (S = 2) then ScreenX := 1; + ScreenX := 0; + + + if S = 2 then TimeSkip := 0; // it's easier than rewriting code + glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); + + ActualScreen.SetAnimationProgress(1); + if not assigned (NextScreen) then Result := ActualScreen.Draw + else begin + LastFade := Fade; + Fade := Fade + TimeSkip * 6; // * 4 + + {//Create Fading texture + if Fade = 0 then + begin + Surface := SDL_GetVideoSurface; + glGenTextures(1, FadeTex); + + glBindTexture(GL_TEXTURE_2D, FadeTex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glPixelStorei(GL_UNPACK_ROW_LENGTH, Surface.pitch div Surface.format.BytesPerPixel); + glTexImage2D(GL_TEXTURE_2D, 0, 3, 800, 600, 0, GL_RGBA, GL_UNSIGNED_BYTE, Surface.pixels); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + end;} + + ActualScreen.ShowFinish := false; + + //Fade = 2 (Belnding) Mod + if (FadeTex > 0) then + begin + ActualScreen.SetAnimationProgress(Fade-1); + ActualScreen.Draw; + glBindTexture(GL_TEXTURE_2D, FadeTex); + glColor4f(Col, Col, Col, 1-Fade); // 0 + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0, 0); + glVertex2f(0, 600); + glVertex2f(800, 600); + glVertex2f(800, 0); + glEnd; + glDisable(GL_BLEND); + end + else + begin + case ActualScreen.Fade of + 0: begin + if Fade < 1 then begin + ActualScreen.SetAnimationProgress(1-Fade); + ActualScreen.Draw; + glColor4f(Col, Col, Col, Fade); // 0 + end else begin + ActualScreen.SetAnimationProgress(Fade-1); + ActualScreen.Draw; + glColor4f(Col, Col, Col, 1-Fade); // 0 + end; + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0, 0); + glVertex2f(0, 600); + glVertex2f(800, 600); + glVertex2f(800, 0); + glEnd; + glDisable(GL_BLEND); + end; + 2: begin + if Fade < 1 then begin + ActualScreen.SetAnimationProgress(1-Fade); + ActualScreen.Draw; + //glColor4f(Col, Col, Col, Fade); // 0 + glColor4f(1, 1, 1, 1); // 0 + //Fade := 1 + end; + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0, 0); + glVertex2f(0, 600); + glVertex2f(800, 600); + glVertex2f(800, 0); + glEnd; + glDisable(GL_BLEND); + end; + end; // case + end; + + if (LastFade < 1 ) and (Fade >= 1) then begin + if (ActualScreen.Fade = 2) then + begin + ScreenShot; + //Create Fading Texture + Surface := SDL_GetVideoSurface; + glGenTextures(1, FadeTex); + + glBindTexture(GL_TEXTURE_2D, FadeTex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glPixelStorei(GL_UNPACK_ROW_LENGTH, Surface.pitch div Surface.format.BytesPerPixel); + glTexImage2D(GL_TEXTURE_2D, 0, 3, 800, 600, 0, GL_RGBA, GL_UNSIGNED_BYTE, Surface.pixels); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + end; + + // pokazuje 2 ekran, ale nie kasuje informacji o NextScreen + ActualScreen.onHide; + ActualScreen := NextScreen; + ActualScreen.onShow; + end; + + if Fade >= 2 then begin + if (FadeTex > 0) then //Delete Fade Tex + begin + glDeleteTextures(1, @FadeTex); + FadeTex := 0; + end; + + // koniec fade'a + ActualScreen := NextScreen; + NextScreen := nil; + ActualScreen.onShowFinish; + ActualScreen.ShowFinish := true; + end; + end; // if + end; // for +// SwapBuffers(h_DC); +end; + +{function TDisplay.Fade(FadeIn : Boolean; Steps : UInt8): UInt8; +begin + Self.FadeIn := FadeIn; + FadeStep := (SizeOf(FadeStep) * $FF) div Steps; + ActualStep := $FF; + Result := $FF div FadeStep; +end;} + +procedure TDisplay.PrintScreen; +var + Bitmap: TBitmap; + Jpeg: TJpegImage; + X, Y: integer; + Num: integer; + FileName: string; +begin + for Num := 1 to 9999 do begin + FileName := IntToStr(Num); + while Length(FileName) < 4 do FileName := '0' + FileName; + FileName := ScreenshotsPath + 'screenshot' + FileName + '.jpg'; + if not FileExists(FileName) then break + end; + + glReadPixels(0, 0, ScreenW, ScreenH, GL_RGBA, GL_UNSIGNED_BYTE, @PrintScreenData[0]); + Bitmap := TBitmap.Create; + Bitmap.Width := ScreenW; + Bitmap.Height := ScreenH; + + for Y := 0 to ScreenH-1 do + for X := 0 to ScreenW-1 do + Bitmap.Canvas.Pixels[X, Y] := PrintScreenData[(ScreenH-1-Y) * ScreenW + X] and $00FFFFFF; + + Jpeg := TJpegImage.Create; + Jpeg.Assign(Bitmap); + Bitmap.Free; + Jpeg.CompressionQuality := 95;//90; + ForceDirectories(ScreenshotsPath); + Jpeg.SaveToFile(FileName); + Jpeg.Free; +end; + +procedure TDisplay.ScreenShot; + var F : file; + FileInfo: BITMAPINFOHEADER; + FileHeader : BITMAPFILEHEADER; + pPicData:Pointer; + FileName: String; + Num: Integer; +begin + //bilddatei Suchen + for Num := 1 to 9999 do begin + FileName := IntToStr(Num); + while Length(FileName) < 4 do FileName := '0' + FileName; + FileName := {ScreenshotsPath + }'screenshot' + FileName + '.BMP'; + if not FileExists(FileName) then break + end; + + //Speicher für die Speicherung der Header-Informationen vorbereiten + ZeroMemory(@FileHeader, SizeOf(BITMAPFILEHEADER)); + ZeroMemory(@FileInfo, SizeOf(BITMAPINFOHEADER)); + + //Initialisieren der Daten des Headers + FileHeader.bfType := 19778; //$4D42 = 'BM' + FileHeader.bfOffBits := SizeOf(BITMAPINFOHEADER)+SizeOf(BITMAPFILEHEADER); + + //Schreiben der Bitmap-Informationen + FileInfo.biSize := SizeOf(BITMAPINFOHEADER); + FileInfo.biWidth := ScreenH; + FileInfo.biHeight := ScreenW; + FileInfo.biPlanes := 1; + FileInfo.biBitCount := 32; + FileInfo.biSizeImage := FileInfo.biWidth*FileInfo.biHeight*(FileInfo.biBitCount div 8); + + //Größenangabe auch in den Header übernehmen + FileHeader.bfSize := FileHeader.bfOffBits + FileInfo.biSizeImage; + + //Speicher für die Bilddaten reservieren + GetMem(pPicData, FileInfo.biSizeImage); + try + //Bilddaten von OpenGL anfordern (siehe oben) + glReadPixels(0, 0, ScreenW, ScreenH, GL_BGRA, GL_UNSIGNED_BYTE, pPicData); + + //Und den ganzen Müll in die Datei schieben ;-) + //Moderne Leute nehmen dafür auch Streams ... + AssignFile(f, Filename); + Rewrite( f,1 ); + try + BlockWrite(F, FileHeader, SizeOf(BITMAPFILEHEADER)); + BlockWrite(F, FileInfo, SizeOf(BITMAPINFOHEADER)); + BlockWrite(F, pPicData^, FileInfo.biSizeImage ); + finally + CloseFile(f); + end; + finally + //Und den angeforderten Speicher wieder freigeben ... + FreeMem(pPicData, FileInfo.biSizeImage); + end; +end; + + +end. diff --git a/Game/Code/Menu/UDrawTexture.dcu b/Game/Code/Menu/UDrawTexture.dcu new file mode 100644 index 00000000..9e6402a9 Binary files /dev/null and b/Game/Code/Menu/UDrawTexture.dcu differ diff --git a/Game/Code/Menu/UDrawTexture.pas b/Game/Code/Menu/UDrawTexture.pas new file mode 100644 index 00000000..5a543f33 --- /dev/null +++ b/Game/Code/Menu/UDrawTexture.pas @@ -0,0 +1,101 @@ +unit UDrawTexture; + +interface +uses UTexture; + +procedure DrawLine(X1, Y1, X2, Y2, ColR, ColG, ColB: real); +procedure DrawQuad(X, Y, W, H, ColR, ColG, ColB: real); +procedure DrawTexture(Texture: TTexture); + +implementation +uses OpenGL12; + +procedure DrawLine(X1, Y1, X2, Y2, ColR, ColG, ColB: real); +begin + glColor3f(ColR, ColG, ColB); + glBegin(GL_LINES); + glVertex2f(x1, y1); + glVertex2f(x2, y2); + glEnd; +end; + +procedure DrawQuad(X, Y, W, H, ColR, ColG, ColB: real); +begin + glColor3f(ColR, ColG, ColB); + glBegin(GL_QUADS); + glVertex2f(x, y); + glVertex2f(x, y+h); + glVertex2f(x+w, y+h); + glVertex2f(x+w, y); + glEnd; +end; + +procedure DrawTexture(Texture: TTexture); +var + x1, x2, x3, x4: real; + y1, y2, y3, y4: real; + xt1, xt2, xt3, xt4: real; + yt1, yt2, yt3, yt4: real; +begin + with Texture do begin + // rysuje paski gracza + glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glDepthRange(0, 10); + glDepthFunc(GL_LEQUAL); +// glDepthFunc(GL_GEQUAL); + glEnable(GL_DEPTH_TEST); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); +// glBlendFunc(GL_SRC_COLOR, GL_ZERO); + glBindTexture(GL_TEXTURE_2D, TexNum); + + x1 := x; + x2 := x; + x3 := x+w*scaleW; + x4 := x+w*scaleW; + y1 := y; + y2 := y+h*scaleH; + y3 := y+h*scaleH; + y4 := y; + if Rot <> 0 then begin + xt1 := x1 - (x + w/2); + xt2 := x2 - (x + w/2); + xt3 := x3 - (x + w/2); + xt4 := x4 - (x + w/2); + yt1 := y1 - (y + h/2); + yt2 := y2 - (y + h/2); + yt3 := y3 - (y + h/2); + yt4 := y4 - (y + h/2); + + x1 := (x + w/2) + xt1 * cos(Rot) - yt1 * sin(Rot); + x2 := (x + w/2) + xt2 * cos(Rot) - yt2 * sin(Rot); + x3 := (x + w/2) + xt3 * cos(Rot) - yt3 * sin(Rot); + x4 := (x + w/2) + xt4 * cos(Rot) - yt4 * sin(Rot); + + y1 := (y + h/2) + yt1 * cos(Rot) + xt1 * sin(Rot); + y2 := (y + h/2) + yt2 * cos(Rot) + xt2 * sin(Rot); + y3 := (y + h/2) + yt3 * cos(Rot) + xt3 * sin(Rot); + y4 := (y + h/2) + yt4 * cos(Rot) + xt4 * sin(Rot); + + end; + +{ glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex3f(x1, y1, z); + glTexCoord2f(0, TexH); glVertex3f(x2, y2, z); + glTexCoord2f(TexW, TexH); glVertex3f(x3, y3, z); + glTexCoord2f(TexW, 0); glVertex3f(x4, y4, z); + glEnd;} + + glBegin(GL_QUADS); + glTexCoord2f(TexX1*TexW, TexY1*TexH); glVertex3f(x1, y1, z); + glTexCoord2f(TexX1*TexW, TexY2*TexH); glVertex3f(x2, y2, z); + glTexCoord2f(TexX2*TexW, TexY2*TexH); glVertex3f(x3, y3, z); + glTexCoord2f(TexX2*TexW, TexY1*TexH); glVertex3f(x4, y4, z); + glEnd; + end; + glDisable(GL_DEPTH_TEST); + glDisable(GL_TEXTURE_2D); +end; + +end. diff --git a/Game/Code/Menu/UMenu.dcu b/Game/Code/Menu/UMenu.dcu new file mode 100644 index 00000000..126834d8 Binary files /dev/null and b/Game/Code/Menu/UMenu.dcu differ diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas new file mode 100644 index 00000000..7c256b5c --- /dev/null +++ b/Game/Code/Menu/UMenu.pas @@ -0,0 +1,1136 @@ +unit UMenu; + +interface + +uses OpenGL12, SysUtils, UTexture, UMenuStatic, UMenuText, UMenuButton, UMenuSelect, UMenuSelectSlide, + UMenuInteract, UThemes; + +type +{ Int16 = SmallInt;} + + PMenu = ^TMenu; + TMenu = class + protected + Interactions: array of TInteract; + SelInteraction: integer; + Static: array of TStatic; + Button: array of TButton; + Selects: array of TSelect; + SelectsS: array of TSelectSlide; + BackImg: TTexture; + BackW: integer; + BackH: integer; + public + Text: array of TText; + mX: integer; // mouse X + mY: integer; // mouse Y + + Fade: integer; // fade type + ShowFinish: boolean; // true if there is no fade + + + destructor Destroy; override; + constructor Create; overload; virtual; + constructor Create(Back: string); overload; virtual; // Back is a JPG resource name for background + constructor Create(Back: string; W, H: integer); overload; virtual; // W and H are the number of overlaps + + // interaction + procedure AddInteraction(Typ, Num: integer); + procedure SetInteraction(Num: integer); + property Interaction: integer read SelInteraction write SetInteraction; + + // background + procedure AddBackground(Name: string); + + // static + function AddStatic(ThemeStatic: TThemeStatic): integer; overload; + function AddStatic(X, Y, W, H: real; Name: string): integer; overload; + function AddStatic(X, Y, W, H: real; Name, Format, Typ: string): integer; overload; + function AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; Name, Format, Typ: string): integer; overload; + function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string): integer; overload; + function AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; overload; + function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; overload; + function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; Name, Format, Typ: string; Color: integer): integer; overload; + + // text + function AddText(ThemeText: TThemeText): integer; overload; + function AddText(X, Y: real; Tekst: string): integer; overload; + function AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; Tekst: string): integer; overload; + function AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; Tekst: string): integer; overload; + + // button + function AddButton(ThemeButton: TThemeButton): integer; overload; + function AddButton(X, Y, W, H: real; Name: String): integer; overload; + function AddButton(X, Y, W, H: real; Name, Format, Typ: String; Reflection: Boolean): integer; overload; + function AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean): integer; overload; + procedure ClearButtons; + procedure AddButtonText(AddX, AddY: real; AddText: string); overload; + procedure AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; AddText: string); overload; + procedure AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; AddText: string); overload; + + // select + function AddSelect(ThemeSelect: TThemeSelect; var Data: integer; Values: array of string): integer; overload; + function AddSelect(X, Y, W, H, SkipX, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt, + TColR, TColG, TColB, TInt, TDColR, TDColG, TDColB, TDInt, + SBGColR, SBGColG, SBGColB, SBGInt, SBGDColR, SBGDColG, SBGDColB, SBGDInt, + STColR, STColG, STColB, STInt, STDColR, STDColG, STDColB, STDInt: real; + Name, Typ: String; SBGName, SBGTyp: String; + Caption: string; var Data: integer): integer; overload; + procedure AddSelectOption(AddX, AddY: real; AddText: string); overload; + procedure AddSelectOption(SelectNo: Cardinal; AddX, AddY: real; AddText: string); overload; + procedure UpdateSelectOptions(ThemeSelect: TThemeSelect; SelectNum: integer; Values: array of string; var Data: integer); + + // select slide + function AddSelectSlide(ThemeSelectS: TThemeSelectSlide; var Data: integer; Values: array of string): integer; overload; + function AddSelectSlide(X, Y, W, H, SkipX, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt, + TColR, TColG, TColB, TInt, TDColR, TDColG, TDColB, TDInt, + SBGColR, SBGColG, SBGColB, SBGInt, SBGDColR, SBGDColG, SBGDColB, SBGDInt, + STColR, STColG, STColB, STInt, STDColR, STDColG, STDColB, STDInt: real; + Name, Typ: String; SBGName, SBGTyp: String; + Caption: string; var Data: integer): integer; overload; + procedure AddSelectSlideOption(AddText: string); overload; + procedure AddSelectSlideOption(SelectNo: Cardinal; AddText: string); overload; + procedure UpdateSelectSlideOptions(ThemeSelectSlide: TThemeSelectSlide; SelectNum: integer; Values: array of string; var Data: integer); + + +// function AddWidget(X, Y : UInt16; WidgetSrc : PSDL_Surface): Int16; +// procedure ClearWidgets(MinNumber : Int16); + procedure FadeTo(Screen: PMenu); + + function DrawBG: boolean; virtual; + function DrawFG: boolean; virtual; + function Draw: boolean; virtual; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown : Boolean): Boolean; virtual; + function ParseMouse(Typ: integer; X: integer; Y: integer): Boolean; virtual; abstract; + function InRegion(X1, Y1, X2, Y2, X, Y: real): Boolean; + function InStaticRegion(StaticNr: integer; X, Y: integer): Boolean; + procedure onShow; virtual; + procedure onShowFinish; virtual; + procedure onHide; virtual; + + procedure SetAnimationProgress(Progress: real); virtual; + + + procedure InteractNext; virtual; + procedure InteractCustom(CustomSwitch: integer); virtual; + procedure InteractPrev; virtual; + procedure InteractInc; virtual; + procedure InteractDec; virtual; + + procedure AddBox(X, Y, W, H: real); + end; + +const + pmMove = 1; + pmClick = 2; + pmUnClick = 3; + + iButton = 0; // interaction type + iSelect = 1; + iText = 2; + iSelectS = 3; + +// fBlack = 0; // fade type +// fWhite = 1; + +implementation + +uses UMain, UDrawTexture, UGraphic, UDisplay, UCovers, USkins; + +destructor TMenu.Destroy; +begin + inherited; +end; + +constructor TMenu.Create; +begin + Fade := 0;//fWhite; + + SetLength(Static, 0); + SetLength(Button, 0); + + BackImg.TexNum := -1; +end; + +constructor TMenu.Create(Back: String); +begin + inherited Create; + + if Back <> '' then begin +// BackImg := Texture.LoadTexture(true, PChar(Back), 'JPG', 'Plain', 0); + BackImg := Texture.LoadTexture(PChar(Back), 'JPG', 'Plain', 0); // new theme system + BackImg.W := 800;//640; + BackImg.H := 600;//480; + BackW := 1; + BackH := 1; + end else + BackImg.TexNum := -1; +end; + +constructor TMenu.Create(Back: string; W, H: integer); +begin + Create(Back); + BackImg.W := BackImg.W / W; + BackImg.H := BackImg.H / H; + BackW := W; + BackH := H; +end; + +procedure TMenu.AddInteraction(Typ, Num: integer); +var + IntNum: integer; +begin + IntNum := Length(Interactions); + SetLength(Interactions, IntNum+1); + Interactions[IntNum].Typ := Typ; + Interactions[IntNum].Num := Num; + Interaction := 0; +end; + +procedure TMenu.SetInteraction(Num: integer); +var + OldNum, OldTyp: integer; + NewNum, NewTyp: integer; +begin + // set inactive + OldNum := Interactions[Interaction].Num; + OldTyp := Interactions[Interaction].Typ; + case OldTyp of + iButton: Button[OldNum].Selected := False; + iSelect: Selects[OldNum].Selected := False; + iText: Text[OldNum].Selected := False; + iSelectS: SelectsS[OldNum].Selected := False; + end; + + // set active + SelInteraction := Num; + NewNum := Interactions[Interaction].Num; + NewTyp := Interactions[Interaction].Typ; + case NewTyp of + iButton: Button[NewNum].Selected := True; + iSelect: Selects[NewNum].Selected := True; + iText: Text[NewNum].Selected := True; + iSelectS: SelectsS[NewNum].Selected := True; + end; +end; + +procedure TMenu.AddBackground(Name: string); +begin + if Name <> '' then begin +// BackImg := Texture.LoadTexture(false, PChar(Skin.SkinPath + FileName), 'JPG', 'Plain', 0); // new theme system + BackImg := Texture.GetTexture(Skin.GetTextureFileName(Name), 'Plain'); + BackImg.W := 800; + BackImg.H := 600; + BackW := 1; + BackH := 1; + end; +end; + +function TMenu.AddStatic(ThemeStatic: TThemeStatic): integer; +begin + Result := AddStatic(ThemeStatic.X, ThemeStatic.Y, ThemeStatic.W, ThemeStatic.H, ThemeStatic.Z, + ThemeStatic.ColR, ThemeStatic.ColG, ThemeStatic.ColB, + ThemeStatic.TexX1, ThemeStatic.TexY1, ThemeStatic.TexX2, ThemeStatic.TexY2, + {<0.5.1: Skin.SkinPath + ThemeStatic.Tex, 0.5.1:} Skin.GetTextureFileName(ThemeStatic.Tex), + 'JPG', ThemeStatic.Typ, $FFFFFF); + //'Font Black'); +end; + +function TMenu.AddStatic(X, Y, W, H: real; Name: string): integer; +begin + Result := AddStatic(X, Y, W, H, Name, 'JPG', 'Plain'); +end; + +function TMenu.AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; Name, Format, Typ: string): integer; +var + StatNum: integer; +begin + Result := AddStatic(X, Y, W, H, ColR, ColG, ColB, Name, Format, Typ, $FFFFFF); +end; + +function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string): integer; +var + StatNum: integer; +begin + Result := AddStatic(X, Y, W, H, Z, ColR, ColG, ColB, Name, Format, Typ, $FFFFFF); +end; + +function TMenu.AddStatic(X, Y, W, H: real; Name, Format, Typ: string): integer; +var + StatNum: integer; +begin + // adds static + StatNum := Length(Static); + SetLength(Static, StatNum + 1); +// Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), $FF00FF)); // $FFFFFF +// Static[StatNum] := TStatic.Create(Texture.LoadTexture(Skin.SkinReg, PChar(Name), PChar(Format), PChar(Typ), $FF00FF)); // new skin system + Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), $FF00FF)); // new skin + + // configures static + Static[StatNum].Texture.X := X; + Static[StatNum].Texture.Y := Y; + Static[StatNum].Texture.W := W; + Static[StatNum].Texture.H := H; + Static[StatNum].Visible := true; + Result := StatNum; +end; + +function TMenu.AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; +var + StatNum: integer; +begin + Result := AddStatic(X, Y, W, H, 0, ColR, ColG, ColB, Name, Format, Typ, Color); +end; + +function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; +begin + Result := AddStatic(X, Y, W, H, Z, ColR, ColG, ColB, 0, 0, 1, 1, Name, Format, Typ, Color); +// +end; + +function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; Name, Format, Typ: string; Color: integer): integer; +var + StatNum: integer; +begin + // adds static + StatNum := Length(Static); + SetLength(Static, StatNum + 1); +// Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), Color)); +// Static[StatNum] := TStatic.Create(Texture.LoadTexture(Skin.SkinReg, PChar(Name), PChar(Format), PChar(Typ), Color)); // new skin system +Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), Color)); // new skin +// Static[StatNum] := TStatic.Create(Texture.GetTexture(Name, Typ)); + + // configures static + Static[StatNum].Texture.X := X; + Static[StatNum].Texture.Y := Y; + Static[StatNum].Texture.W := W; + Static[StatNum].Texture.H := H; + Static[StatNum].Texture.Z := Z; + Static[StatNum].Texture.ColR := ColR; + Static[StatNum].Texture.ColG := ColG; + Static[StatNum].Texture.ColB := ColB; + Static[StatNum].Texture.TexX1 := TexX1; + Static[StatNum].Texture.TexY1 := TexY1; + Static[StatNum].Texture.TexX2 := TexX2; + Static[StatNum].Texture.TexY2 := TexY2; + Static[StatNum].Texture.Alpha := 1; + Static[StatNum].Visible := true; + Result := StatNum; +end; + +function TMenu.AddText(ThemeText: TThemeText): integer; +begin + Result := AddText(ThemeText.X, ThemeText.Y, ThemeText.Font, ThemeText.Size, + ThemeText.ColR, ThemeText.ColG, ThemeText.ColB, ThemeText.Align, ThemeText.Text); +end; + +function TMenu.AddText(X, Y: real; Tekst: string): integer; +var + TextNum: integer; +begin + // adds text + TextNum := Length(Text); + SetLength(Text, TextNum + 1); + Text[TextNum] := TText.Create(X, Y, Tekst); + Result := TextNum; +end; + +function TMenu.AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; Tekst: string): integer; +begin + Result := AddText(X, Y, Style, Size, ColR, ColG, ColB, 0, Tekst); +end; + +function TMenu.AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; Tekst: string): integer; +var + TextNum: integer; +begin + // adds text + TextNum := Length(Text); + SetLength(Text, TextNum + 1); + Text[TextNum] := TText.Create(X, Y, Style, Size, ColR, ColG, ColB, Align, Tekst); + Result := TextNum; +end; + + +// Method to add a button in our TMenu. It returns the assigned ButtonNumber +function TMenu.AddButton(ThemeButton: TThemeButton): integer; +var + BT: integer; + BTLen: integer; + temp: integer; +begin +{ Result := AddButton(ThemeButton.X, ThemeButton.Y, ThemeButton.W, ThemeButton.H, + ThemeButton.ColR, ThemeButton.ColG, ThemeButton.ColB, ThemeButton.Int, + ThemeButton.DColR, ThemeButton.DColG, ThemeButton.DColB, ThemeButton.DInt, + ThemeButton.Tex, 'JPG', 'Font Black');} + + Result := AddButton(ThemeButton.X, ThemeButton.Y, ThemeButton.W, ThemeButton.H, + ThemeButton.ColR, ThemeButton.ColG, ThemeButton.ColB, ThemeButton.Int, + ThemeButton.DColR, ThemeButton.DColG, ThemeButton.DColB, ThemeButton.DInt, + Skin.GetTextureFileName(ThemeButton.Tex), 'JPG', ThemeButton.Typ, ThemeButton.Reflection); + + + BTLen := Length(ThemeButton.Text); + for BT := 0 to BTLen-1 do begin + AddButtonText(ThemeButton.Text[BT].X, ThemeButton.Text[BT].Y, + ThemeButton.Text[BT].ColR, ThemeButton.Text[BT].ColG, ThemeButton.Text[BT].ColB, + ThemeButton.Text[BT].Font, ThemeButton.Text[BT].Size, ThemeButton.Text[BT].Align, + ThemeButton.Text[BT].Text); + end; +end; + +function TMenu.AddButton(X, Y, W, H: real; Name: String): integer; +begin + Result := AddButton(X, Y, W, H, Name, 'JPG', 'Plain', False); +end; + +function TMenu.AddButton(X, Y, W, H: real; Name, Format, Typ: String; Reflection: Boolean): integer; +begin + Result := AddButton(X, Y, W, H, 1, 1, 1, 1, 1, 1, 1, 0.5, Name, 'JPG', 'Plain', Reflection); +end; + +function TMenu.AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean): integer; +var + ButNum : integer; +begin + // adds button + ButNum := Length(Button); + SetLength(Button, ButNum + 1); +// Button[ButNum] := TButton.Create(Texture.GetTexture(Name, Typ)); + + // check here for cache +// Texture.GetTexture(Name, Typ, false); // preloads textures and creates cahce mipmap when needed +// if Covers.CoverExists(Name) then + Button[ButNum] := TButton.Create(Texture.GetTexture(Name, Typ, true)); // use cache texture +// else +// Button[ButNum] := TButton.Create(Texture.GetTexture(Name, Typ, false)); // don't use cache texture} + + // configures button + Button[ButNum].Texture.X := X; + Button[ButNum].Texture.Y := Y; + Button[ButNum].Texture.W := W; + Button[ButNum].Texture.H := H; + Button[ButNum].SelectColR := ColR; + Button[ButNum].SelectColG := ColG; + Button[ButNum].SelectColB := ColB; + Button[ButNum].SelectInt := Int; + Button[ButNum].DeselectColR := DColR; + Button[ButNum].DeselectColG := DColG; + Button[ButNum].DeselectColB := DColB; + Button[ButNum].DeselectInt := DInt; + Button[ButNum].Texture.TexX1 := 0; + Button[ButNum].Texture.TexY1 := 0; + Button[ButNum].Texture.TexX2 := 1; + Button[ButNum].Texture.TexY2 := 1; + Button[ButNum].SetSelect(false); + + Button[ButNum].Reflection := Reflection; + + // adds interaction + AddInteraction(iButton, ButNum); + Interaction := 0; +end; + +procedure TMenu.ClearButtons; +begin + Setlength(Button, 0); +end; + +// Method to draw our TMenu and all his child buttons +function TMenu.DrawBG: boolean; +var + PetX: integer; + PetY: integer; +begin +// glClearColor(1, 1, 1, 1); +// glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity; + glOrtho(0, RenderW, RenderH, 0, -1, 100); + glMatrixMode(GL_MODELVIEW); + + BackImg.ColR := 1; + BackImg.ColG := 1; + BackImg.ColB := 1; + BackImg.TexX1 := 0; + BackImg.TexY1 := 0; + BackImg.TexX2 := 1; + BackImg.TexY2 := 1; + if (BackImg.TexNum <> -1) then begin + // draw texture with overlapping + for PetY := 1 to BackH do + for PetX := 1 to BackW do begin + BackImg.X := (PetX-1)/BackW * 800; //640 + BackImg.Y := (PetY-1)/BackH * 600; //480 + DrawTexture(BackImg); + end; // for PetX + end; // if +end; + +function TMenu.DrawFG: boolean; +var + J: Integer; +begin + // We don't forget about newly implemented static for nice skin ... + for J := 0 to Length(Static) - 1 do + Static[J].Draw; + + // ... and slightly implemented menutext unit + for J := 0 to Length(Text) - 1 do + Text[J].Draw; + + // Second, we draw all of our buttons + for J := 0 to Length(Button) - 1 do + Button[J].Draw; + + // Third, we draw all of our selects + for J := 0 to Length(Selects) - 1 do + Selects[J].Draw(1); + + for J := 0 to Length(SelectsS) - 1 do + SelectsS[J].Draw; + + // Third, we draw all our widgets +// for J := 0 to Length(WidgetsSrc) - 1 do +// SDL_BlitSurface(WidgetsSrc[J], nil, ParentBackBuf, WidgetsRect[J]); + Result := True; +end; + +function TMenu.Draw: boolean; +begin + DrawBG; + DrawFG; + Result := True; +end; + +{function TMenu.GetNextScreen(): PMenu; +begin + Result := NextScreen; +end;} + +{function TMenu.AddWidget(X, Y : UInt16; WidgetSrc : PSDL_Surface): Int16; +var + WidgetNum : Int16; + +begin + If (Assigned(WidgetSrc)) Then + begin + WidgetNum := Length(WidgetsSrc); + + SetLength(WidgetsSrc, WidgetNum + 1); + SetLength(WidgetsRect, WidgetNum + 1); + + WidgetsSrc[WidgetNum] := WidgetSrc; + WidgetsRect[WidgetNum] := new(PSDL_Rect); + WidgetsRect[WidgetNum]^.x := X; + WidgetsRect[WidgetNum]^.y := Y; + WidgetsRect[WidgetNum]^.w := WidgetSrc^.w; + WidgetsRect[WidgetNum]^.h := WidgetSrc^.h; + + Result := WidgetNum; + end + else + Result := -1; +end;} + +{procedure TMenu.ClearWidgets(MinNumber : Int16); +var + J : Int16; +begin + For J := MinNumber to (Length(WidgetsSrc) - 1) do + begin + SDL_FreeSurface(WidgetsSrc[J]); + dispose(WidgetsRect[J]); + end; + + SetLength(WidgetsSrc, MinNumber); + SetLength(WidgetsRect, MinNumber); +end;} + +procedure TMenu.InteractNext; +var + Num: integer; + Typ: integer; + Again: boolean; +begin + Again := true; + + // change interaction as long as it's needed + while (Again = true) do begin + Num := (Interaction + 1) Mod Length(Interactions); + Interaction := Num; + Again := false; // reset, default to accept changing interaction + + + // checking newly interacted element + Num := Interactions[Interaction].Num; + Typ := Interactions[Interaction].Typ; + case Typ of + iButton: + begin + if Button[Num].Selectable = false then Again := True; + end; + end; // case + end; // while +end; + + +procedure TMenu.InteractPrev; +var + Num: integer; + Typ: integer; + Again: boolean; +begin + Again := true; + + // change interaction as long as it's needed + while (Again = true) do begin + Num := SelInteraction - 1; + if Num = -1 then Num := High(Interactions); + Interaction := Num; + Again := false; // reset, default to accept changing interaction + + // checking newly interacted element + Num := Interactions[Interaction].Num; + Typ := Interactions[Interaction].Typ; + case Typ of + iButton: + begin + if Button[Num].Selectable = false then Again := True; + end; + end; // case + end; // while + +end; + + +procedure TMenu.InteractCustom(CustomSwitch: integer); +var + Num: integer; + Typ: integer; + Again: boolean; +begin + if num<0 then begin + CustomSwitch:= CustomSwitch*(-1); + Again := true; + // change interaction as long as it's needed + while (Again = true) do begin + Num := SelInteraction - CustomSwitch; + if Num = -1 then Num := High(Interactions); + Interaction := Num; + Again := false; // reset, default to accept changing interaction + + // checking newly interacted element + Num := Interactions[Interaction].Num; + Typ := Interactions[Interaction].Typ; + case Typ of + iButton: + begin + if Button[Num].Selectable = false then Again := True; + end; + end; // case + end; // while + end + else if num>0 then begin + Again := true; + // change interaction as long as it's needed + while (Again = true) do begin + Num := (Interaction + CustomSwitch) Mod Length(Interactions); + Interaction := Num; + Again := false; // reset, default to accept changing interaction + + + // checking newly interacted element + Num := Interactions[Interaction].Num; + Typ := Interactions[Interaction].Typ; + case Typ of + iButton: + begin + if Button[Num].Selectable = false then Again := True; + end; + end; // case + end; // while + end +end; + + +procedure TMenu.FadeTo(Screen: PMenu); +begin + Display.Fade := 0; + Display.NextScreen := Screen; +end; + +procedure TMenu.AddButtonText(AddX, AddY: real; AddText: string); +begin + AddButtonText(AddX, AddY, 1, 1, 1, AddText); +end; + +procedure TMenu.AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; AddText: string); +var + Il: integer; +begin + with Button[High(Button)] do begin + Il := Length(Text); + SetLength(Text, Il+1); + Text[Il] := TText.Create(X + AddX, Y + AddY, AddText); + Text[Il].ColR := ColR; + Text[Il].ColG := ColG; + Text[Il].ColB := ColB; + Text[Il].Int := 1;//0.5; + end; +end; + +procedure TMenu.AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; AddText: string); +var + Il: integer; +begin + with Button[High(Button)] do begin + Il := Length(Text); + SetLength(Text, Il+1); + Text[Il] := TText.Create(X + AddX, Y + AddY, AddText); + Text[Il].ColR := ColR; + Text[Il].ColG := ColG; + Text[Il].ColB := ColB; + Text[Il].Int := 1;//0.5; + Text[Il].Style := Font; + Text[Il].Size := Size; + Text[Il].Align := Align; + end; +end; + +function TMenu.AddSelect(ThemeSelect: TThemeSelect; var Data: integer; Values: array of string): integer; +var + SO: integer; +begin + Result := AddSelect(ThemeSelect.X, ThemeSelect.Y, ThemeSelect.W, ThemeSelect.H, ThemeSelect.SkipX, + ThemeSelect.ColR, ThemeSelect.ColG, ThemeSelect.ColB, ThemeSelect.Int, + ThemeSelect.DColR, ThemeSelect.DColG, ThemeSelect.DColB, ThemeSelect.DInt, + ThemeSelect.TColR, ThemeSelect.TColG, ThemeSelect.TColB, ThemeSelect.TInt, + ThemeSelect.TDColR, ThemeSelect.TDColG, ThemeSelect.TDColB, ThemeSelect.TDInt, + ThemeSelect.SBGColR, ThemeSelect.SBGColG, ThemeSelect.SBGColB, ThemeSelect.SBGInt, + ThemeSelect.SBGDColR, ThemeSelect.SBGDColG, ThemeSelect.SBGDColB, ThemeSelect.SBGDInt, + ThemeSelect.STColR, ThemeSelect.STColG, ThemeSelect.STColB, ThemeSelect.STInt, + ThemeSelect.STDColR, ThemeSelect.STDColG, ThemeSelect.STDColB, ThemeSelect.STDInt, + Skin.GetTextureFileName(ThemeSelect.Tex), 'Font Black', + Skin.GetTextureFileName(ThemeSelect.TexSBG), 'Font Black', + ThemeSelect.Text, Data); + for SO := 0 to High(Values) do + AddSelectOption(ThemeSelect.X + ThemeSelect.W + ThemeSelect.SkipX + SO * 100 + 20, ThemeSelect.Y + 20, Values[SO]); +end; + +function TMenu.AddSelect(X, Y, W, H, SkipX, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt, + TColR, TColG, TColB, TInt, TDColR, TDColG, TDColB, TDInt, + SBGColR, SBGColG, SBGColB, SBGInt, SBGDColR, SBGDColG, SBGDColB, SBGDInt, + STColR, STColG, STColB, STInt, STDColR, STDColG, STDColB, STDInt: real; + Name, Typ: String; SBGName, SBGTyp: String; + Caption: string; var Data: integer): integer; +var + S: integer; +begin + S := Length(Selects); + SetLength(Selects, S + 1); + Selects[S] := TSelect.Create; + + Selects[S].Texture := Texture.GetTexture(Name, Typ); + Selects[S].X := X; + Selects[S].Y := Y; + Selects[S].W := W; + Selects[S].H := H; + Selects[S].ColR := ColR; + Selects[S].ColG := ColG; + Selects[S].ColB := ColB; + Selects[S].Int := Int; + Selects[S].DColR := DColR; + Selects[S].DColG := DColG; + Selects[S].DColB := DColB; + Selects[S].DInt := DInt; + + Selects[S].TextureSBG := Texture.GetTexture(SBGName, SBGTyp); + Selects[S].TextureSBG.X := X + W + SkipX; + Selects[S].TextureSBG.Y := Y; + Selects[S].TextureSBG.W := 450; + Selects[S].TextureSBG.H := H; + Selects[S].SBGColR := SBGColR; + Selects[S].SBGColG := SBGColG; + Selects[S].SBGColB := SBGColB; + Selects[S].SBGInt := SBGInt; + Selects[S].SBGDColR := SBGDColR; + Selects[S].SBGDColG := SBGDColG; + Selects[S].SBGDColB := SBGDColB; + Selects[S].SBGDInt := SBGDInt; + + Selects[S].Text.X := X + 20; + Selects[S].Text.Y := Y + 20; + Selects[S].Text.Text := Caption; + Selects[S].Text.Size := 10; + Selects[S].Text.Visible := true; + Selects[S].TColR := TColR; + Selects[S].TColG := TColG; + Selects[S].TColB := TColB; + Selects[S].TInt := TInt; + Selects[S].TDColR := TDColR; + Selects[S].TDColG := TDColG; + Selects[S].TDColB := TDColB; + Selects[S].TDInt := TDInt; + + Selects[S].STColR := STColR; + Selects[S].STColG := STColG; + Selects[S].STColB := STColB; + Selects[S].STInt := STInt; + Selects[S].STDColR := STDColR; + Selects[S].STDColG := STDColG; + Selects[S].STDColB := STDColB; + Selects[S].STDInt := STDInt; + + // new + Selects[S].Texture.TexX1 := 0; + Selects[S].Texture.TexY1 := 0; + Selects[S].Texture.TexX2 := 1; + Selects[S].Texture.TexY2 := 1; + Selects[S].TextureSBG.TexX1 := 0; + Selects[S].TextureSBG.TexY1 := 0; + Selects[S].TextureSBG.TexX2 := 1; + Selects[S].TextureSBG.TexY2 := 1; + + // Sets Data to copy the value of selectops to global value; + Selects[S].PData := @Data; + + // Sets default value of selectopt from Data; + Selects[S].SelectedOption := Data; + + // Disables default selection + Selects[S].SetSelect(false); + + // adds interaction + AddInteraction(iSelect, S); +end; + +procedure TMenu.AddSelectOption(AddX, AddY: real; AddText: string); +begin + AddSelectOption (High(Selects), AddX, AddY, AddText); +end; + +procedure TMenu.AddSelectOption(SelectNo: Cardinal; AddX, AddY: real; AddText: string); +var + SO: integer; +begin + SO := Length(Selects[SelectNo].TextOpt); + SetLength(Selects[SelectNo].TextOpt, SO + 1); + + Selects[SelectNo].TextOpt[SO] := TText.Create; + + Selects[SelectNo].TextOpt[SO].X := AddX; + Selects[SelectNo].TextOpt[SO].Y := AddY; + Selects[SelectNo].TextOpt[SO].Text := AddText; + Selects[SelectNo].TextOpt[SO].Size := 10; + Selects[SelectNo].TextOpt[SO].ColR := Selects[SelectNo].STDColR; + Selects[SelectNo].TextOpt[SO].ColG := Selects[SelectNo].STDColG; + Selects[SelectNo].TextOpt[SO].ColB := Selects[SelectNo].STDColB; + Selects[SelectNo].TextOpt[SO].Int := Selects[SelectNo].STDInt; + Selects[SelectNo].TextOpt[SO].Visible := true; + + if SO = Selects[SelectNo].PData^ then Selects[SelectNo].SelectedOption := SO; +end; + +procedure TMenu.UpdateSelectOptions(ThemeSelect: TThemeSelect; SelectNum: integer; Values: array of string; var Data: integer); +var + SO: integer; +begin + SetLength(Selects[SelectNum].TextOpt, 0); + for SO := 0 to High(Values) do + AddSelectOption(SelectNum, ThemeSelect.X + ThemeSelect.W + ThemeSelect.SkipX + SO * 100 + 20, ThemeSelect.Y + 20, Values[SO]); +end; + +function TMenu.AddSelectSlide(ThemeSelectS: TThemeSelectSlide; var Data: integer; Values: array of string): integer; +var + SO: integer; +begin + Result := AddSelectSlide(ThemeSelectS.X, ThemeSelectS.Y, ThemeSelectS.W, ThemeSelectS.H, ThemeSelectS.SkipX, + ThemeSelectS.ColR, ThemeSelectS.ColG, ThemeSelectS.ColB, ThemeSelectS.Int, + ThemeSelectS.DColR, ThemeSelectS.DColG, ThemeSelectS.DColB, ThemeSelectS.DInt, + ThemeSelectS.TColR, ThemeSelectS.TColG, ThemeSelectS.TColB, ThemeSelectS.TInt, + ThemeSelectS.TDColR, ThemeSelectS.TDColG, ThemeSelectS.TDColB, ThemeSelectS.TDInt, + ThemeSelectS.SBGColR, ThemeSelectS.SBGColG, ThemeSelectS.SBGColB, ThemeSelectS.SBGInt, + ThemeSelectS.SBGDColR, ThemeSelectS.SBGDColG, ThemeSelectS.SBGDColB, ThemeSelectS.SBGDInt, + ThemeSelectS.STColR, ThemeSelectS.STColG, ThemeSelectS.STColB, ThemeSelectS.STInt, + ThemeSelectS.STDColR, ThemeSelectS.STDColG, ThemeSelectS.STDColB, ThemeSelectS.STDInt, + Skin.GetTextureFileName(ThemeSelectS.Tex), 'Font Black', + Skin.GetTextureFileName(ThemeSelectS.TexSBG), 'Font Black', + ThemeSelectS.Text, Data); + for SO := 0 to High(Values) do + AddSelectSlideOption(Values[SO]); + + //Generate Lines + SelectsS[High(SelectsS)].GenLines; + + SelectsS[High(SelectsS)].SelectedOption := SelectsS[High(SelectsS)].SelectOptInt; // refresh +end; + +function TMenu.AddSelectSlide(X, Y, W, H, SkipX, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt, + TColR, TColG, TColB, TInt, TDColR, TDColG, TDColB, TDInt, + SBGColR, SBGColG, SBGColB, SBGInt, SBGDColR, SBGDColG, SBGDColB, SBGDInt, + STColR, STColG, STColB, STInt, STDColR, STDColG, STDColB, STDInt: real; + Name, Typ: String; SBGName, SBGTyp: String; + Caption: string; var Data: integer): integer; +var + S: integer; + I: integer; +begin + S := Length(SelectsS); + SetLength(SelectsS, S + 1); + SelectsS[S] := TSelectSlide.Create; + + SelectsS[S].Texture := Texture.GetTexture(Name, Typ); + SelectsS[S].X := X; + SelectsS[S].Y := Y; + SelectsS[S].W := W; + SelectsS[S].H := H; + SelectsS[S].ColR := ColR; + SelectsS[S].ColG := ColG; + SelectsS[S].ColB := ColB; + SelectsS[S].Int := Int; + SelectsS[S].DColR := DColR; + SelectsS[S].DColG := DColG; + SelectsS[S].DColB := DColB; + SelectsS[S].DInt := DInt; + + SelectsS[S].TextureSBG := Texture.GetTexture(SBGName, SBGTyp); + SelectsS[S].TextureSBG.X := X + W + SkipX; + SelectsS[S].TextureSBG.Y := Y; + SelectsS[S].TextureSBG.W := 450; + SelectsS[S].TextureSBG.H := H; + SelectsS[S].SBGColR := SBGColR; + SelectsS[S].SBGColG := SBGColG; + SelectsS[S].SBGColB := SBGColB; + SelectsS[S].SBGInt := SBGInt; + SelectsS[S].SBGDColR := SBGDColR; + SelectsS[S].SBGDColG := SBGDColG; + SelectsS[S].SBGDColB := SBGDColB; + SelectsS[S].SBGDInt := SBGDInt; + + SelectsS[S].Text.X := X + 20; + SelectsS[S].Text.Y := Y + 20; + SelectsS[S].Text.Text := Caption; + SelectsS[S].Text.Size := 10; + SelectsS[S].Text.Visible := true; + SelectsS[S].TColR := TColR; + SelectsS[S].TColG := TColG; + SelectsS[S].TColB := TColB; + SelectsS[S].TInt := TInt; + SelectsS[S].TDColR := TDColR; + SelectsS[S].TDColG := TDColG; + SelectsS[S].TDColB := TDColB; + SelectsS[S].TDInt := TDInt; + + SelectsS[S].STColR := STColR; + SelectsS[S].STColG := STColG; + SelectsS[S].STColB := STColB; + SelectsS[S].STInt := STInt; + SelectsS[S].STDColR := STDColR; + SelectsS[S].STDColG := STDColG; + SelectsS[S].STDColB := STDColB; + SelectsS[S].STDInt := STDInt; + + // new + SelectsS[S].Texture.TexX1 := 0; + SelectsS[S].Texture.TexY1 := 0; + SelectsS[S].Texture.TexX2 := 1; + SelectsS[S].Texture.TexY2 := 1; + SelectsS[S].TextureSBG.TexX1 := 0; + SelectsS[S].TextureSBG.TexY1 := 0; + SelectsS[S].TextureSBG.TexX2 := 1; + SelectsS[S].TextureSBG.TexY2 := 1; + + // Sets Data to copy the value of selectops to global value; + SelectsS[S].PData := @Data; + // Configures Select options + {//SelectsS[S].TextOpt[0].Text := IntToStr(I+1); + SelectsS[S].TextOpt[0].Size := 10; + SelectsS[S].TextOpt[0].Align := 1; + + SelectsS[S].TextOpt[0].ColR := SelectsS[S].STDColR; + SelectsS[S].TextOpt[0].ColG := SelectsS[S].STDColG; + SelectsS[S].TextOpt[0].ColB := SelectsS[S].STDColB; + SelectsS[S].TextOpt[0].Int := SelectsS[S].STDInt; + SelectsS[S].TextOpt[0].Visible := true; } + + // Sets default value of selectopt from Data; + SelectsS[S].SelectedOption := Data; + + // Disables default selection + SelectsS[S].SetSelect(false); + + {// Configures 3 select options + for I := 0 to 2 do begin + SelectsS[S].TextOpt[I].X := SelectsS[S].TextureSBG.X + 20 + (50 + 20) + (150 - 20) * I; + SelectsS[S].TextOpt[I].Y := SelectsS[S].TextureSBG.Y + 20; + SelectsS[S].TextOpt[I].Text := IntToStr(I+1); + SelectsS[S].TextOpt[I].Size := 10; + SelectsS[S].TextOpt[I].Align := 1; + + + SelectsS[S].TextOpt[I].ColR := SelectsS[S].STDColR; + SelectsS[S].TextOpt[I].ColG := SelectsS[S].STDColG; + SelectsS[S].TextOpt[I].ColB := SelectsS[S].STDColB; + SelectsS[S].TextOpt[I].Int := SelectsS[S].STDInt; + SelectsS[S].TextOpt[I].Visible := true; + end;} + + + // adds interaction + AddInteraction(iSelectS, S); + Result := S; +end; + +procedure TMenu.AddSelectSlideOption(AddText: string); +begin + AddSelectSlideOption(High(SelectsS), AddText); +end; + +procedure TMenu.AddSelectSlideOption(SelectNo: Cardinal; AddText: string); +var + SO: integer; +begin + SO := Length(SelectsS[SelectNo].TextOptT); + + SetLength(SelectsS[SelectNo].TextOptT, SO + 1); + SelectsS[SelectNo].TextOptT[SO] := AddText; + + //SelectsS[S].SelectedOption := SelectsS[S].SelectOptInt; // refresh + + //if SO = Selects[S].PData^ then Selects[S].SelectedOption := SO; +end; + +procedure TMenu.UpdateSelectSlideOptions(ThemeSelectSlide: TThemeSelectSlide; SelectNum: integer; Values: array of string; var Data: integer); +var + SO: integer; +begin + SetLength(SelectsS[SelectNum].TextOptT, 0); + for SO := 0 to High(Values) do + AddSelectSlideOption(SelectNum, Values[SO]); + + SelectsS[SelectNum].GenLines; + +// SelectsS[SelectNum].SelectedOption := SelectsS[SelectNum].SelectOptInt; // refresh +// SelectS[SelectNum].SetSelectOpt(Data); +// SelectS[SelectNum].SelectedOption := 0;//Data; + +// Log.LogError(IntToStr(High(SelectsS[SelectNum].TextOptT))); +// if 0 <= High(SelectsS[SelectNum].TextOptT) then + + SelectsS[SelectNum].PData := @Data; + SelectsS[SelectNum].SelectedOption := Data; +end; + +function TMenu.InRegion(X1, Y1, X2, Y2, X, Y: real): Boolean; +begin + Result := false; + X1 := X1 * RenderW/640; + X2 := X2 * RenderW/640; + Y1 := Y1 * RenderH/480; + Y2 := Y2 * RenderH/480; + if (X >= X1) and (X <= X2) and (Y >= Y1) and (Y <= Y2) then + Result := true; +end; + +function TMenu.InStaticRegion(StaticNr: integer; X, Y: integer): Boolean; +begin + Result := InRegion(Static[StaticNr].Texture.X, + Static[StaticNr].Texture.Y, + Static[StaticNr].Texture.X + Static[StaticNr].Texture.W - 1, + Static[StaticNr].Texture.Y + Static[StaticNr].Texture.H - 1, + X, Y); +end; + +procedure TMenu.InteractInc; +var + Num: integer; + Value: integer; +begin + case Interactions[Interaction].Typ of + iSelect: begin + Num := Interactions[Interaction].Num; + Value := Selects[Num].SelectedOption; + Value := (Value + 1) Mod (Length(Selects[Num].TextOpt)); + Selects[Num].SelectedOption := Value; + end; + iSelectS: begin + Num := Interactions[Interaction].Num; + Value := SelectsS[Num].SelectedOption; +// Value := (Value + 1) Mod (Length(SelectsS[Num].TextOptT)); + + // limit + Value := Value + 1; + if Value <= High(SelectsS[Num].TextOptT) then + SelectsS[Num].SelectedOption := Value; + end; + end; +end; + +procedure TMenu.InteractDec; +var + Num: integer; + Value: integer; +begin + case Interactions[Interaction].Typ of + iSelect: begin + Num := Interactions[Interaction].Num; + Value := Selects[Num].SelectedOption; + Value := Value - 1; + if Value = -1 then + Value := High(Selects[Num].TextOpt); + Selects[Num].SelectedOption := Value; + end; + iSelectS: begin + Num := Interactions[Interaction].Num; + Value := SelectsS[Num].SelectedOption; + Value := Value - 1; +// if Value = -1 then +// Value := High(SelectsS[Num].TextOptT); + + if Value >= 0 then + SelectsS[Num].SelectedOption := Value; + end; + end +end; + +procedure TMenu.AddBox(X, Y, W, H: real); +begin + AddStatic(X, Y, W, H, 0, 0, 0, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); + AddStatic(X+2, Y+2, W-4, H-4, 1, 1, 1, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); +end; + +procedure TMenu.onShow; +begin +// nothing +// beep; +end; + +procedure TMenu.onShowFinish; +begin +// nothing +// beep; +end; + +procedure TMenu.onHide; +begin +// nothing +// beep; +end; + +function TMenu.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin +// nothing +// Beep; + Result := true; +end; + +procedure TMenu.SetAnimationProgress(Progress: real); +begin +// nothing +//beep; +end; + +end. + diff --git a/Game/Code/Menu/UMenuButton.dcu b/Game/Code/Menu/UMenuButton.dcu new file mode 100644 index 00000000..b97d1670 Binary files /dev/null and b/Game/Code/Menu/UMenuButton.dcu differ diff --git a/Game/Code/Menu/UMenuButton.pas b/Game/Code/Menu/UMenuButton.pas new file mode 100644 index 00000000..e42a5488 --- /dev/null +++ b/Game/Code/Menu/UMenuButton.pas @@ -0,0 +1,238 @@ +unit UMenuButton; + +interface +uses TextGL, UTexture, OpenGL12, UMenuText; + +type + TButton = class + private + SelectBool: Boolean; + constructor Create(); overload; + public + Text: Array of TText; + Texture: TTexture; // Button Screen position and size + Texture2: TTexture; // second texture only used for fading full resolution covers +// Texture2Blend: real; // blending factor for second texture (0=invisible, 1=visible) + // now uses alpha + + DeselectType: integer; // not used yet + Visible: boolean; + //Reflection Mod + Reflection: boolean; + + Selectable: boolean; + + SelectColR: real; + SelectColG: real; + SelectColB: real; + SelectInt: real; + SelectTInt: real; + + DeselectColR: real; + DeselectColG: real; + DeselectColB: real; + DeselectInt: real; + DeselectTInt: real; + + procedure SetY(Value: real); + procedure SetSelect(Value: Boolean); + property X: real read Texture.x write Texture.x; + property Y: real read Texture.y write SetY; + property Z: real read Texture.z write Texture.z; + property W: real read Texture.w write Texture.w; + property H: real read Texture.h write Texture.h; + property Selected: Boolean read SelectBool write SetSelect; + + procedure Draw; + + constructor Create(Textura: TTexture); overload; + destructor Destroy; override; + end; + +implementation +uses UDrawTexture, SysUtils; + +procedure TButton.SetY(Value: real); +var + dY: real; + T: integer; // text +begin + dY := Value - Texture.y; + + Texture.y := Value; + + for T := 0 to High(Text) do + Text[T].Y := Text[T].Y + dY; + +end; + +procedure TButton.SetSelect(Value : Boolean); +var + T: integer; +begin + SelectBool := Value; + if (Value) then begin + Texture.ColR := SelectColR; + Texture.ColG := SelectColG; + Texture.ColB := SelectColB; + Texture.Int := SelectInt; + + Texture2.ColR := SelectColR; + Texture2.ColG := SelectColG; + Texture2.ColB := SelectColB; + Texture2.Int := SelectInt; + + for T := 0 to High(Text) do + Text[T].Int := SelectTInt; + end else begin + Texture.ColR := DeselectColR; + Texture.ColG := DeselectColG; + Texture.ColB := DeselectColB; + Texture.Int := DeselectInt; + + Texture2.ColR := DeselectColR; + Texture2.ColG := DeselectColG; + Texture2.ColB := DeselectColB; + Texture2.Int := DeselectInt; + + for T := 0 to High(Text) do + Text[T].Int := DeselectTInt; + end; +end; + +constructor TButton.Create(); +begin + inherited Create; + // We initialize all to 0, nil or false + Visible := true; + SelectBool := false; + DeselectType := 0; + Selectable := true; + //Reflection Mod + Reflection := true; + + // Default +// SelectInt := 1; +// DeselectInt := 0.5; + +{ SelectColR := 0.5; + SelectColG := 0.75; + SelectColB := 0; + SelectInt := 1; + SelectTInt := 1; + + DeselectColR := 1; + DeselectColG := 1; + DeselectColB := 1; + DeselectInt := 0.5; + DeselectTInt := 1;} + + SelectColR := 1; + SelectColG := 1; + SelectColB := 1; + SelectInt := 1; + SelectTInt := 1; + + DeselectColR := 1; + DeselectColG := 1; + DeselectColB := 1; + DeselectInt := 0.5; + DeselectTInt := 1; + + +end; + +// ***** Public methods ****** // + +procedure TButton.Draw; +var + T: integer; +begin + if Visible then begin + DrawTexture(Texture); + + if Texture2.Alpha > 0 then begin + Texture2.ScaleW := Texture.ScaleW; + Texture2.ScaleH := Texture.ScaleH; + + Texture2.X := Texture.X; + Texture2.Y := Texture.Y; + Texture2.W := Texture.W; + Texture2.H := Texture.H; + + Texture2.ColR := Texture.ColR; + Texture2.ColG := Texture.ColG; + Texture2.ColB := Texture.ColB; + Texture2.Int := Texture.Int; + + Texture2.Z := Texture.Z; + + DrawTexture(Texture2); + end; + + //Reflection Mod + if (Reflection) then // Draw Reflections + begin + with Texture do + begin + //Bind Tex and GL Attributes + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glDepthRange(0, 10); + glDepthFunc(GL_LEQUAL); + //glDepthFunc(GL_GEQUAL); + glEnable(GL_DEPTH_TEST); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + //glBlendFunc(GL_SRC_COLOR, GL_ZERO); + glBindTexture(GL_TEXTURE_2D, TexNum); + + //Draw + glBegin(GL_QUADS);//Top Left + glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); + glTexCoord2f(TexX1*TexW, TexY2*TexH); + glVertex3f(x, y+h*scaleH+ 15, z); + + //Bottom Left + glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); + glTexCoord2f(TexX1*TexW, {TexY1*TexH*}0.5); + glVertex3f(x, y+h*scaleH + h*scaleH/2 + 15, z); + + + //Bottom Right + glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); + glTexCoord2f(TexX2*TexW, {TexY1*TexH*}0.5); + glVertex3f(x+w*scaleW, y+h*scaleH + h*scaleH/2 + 15, z); + + //Top Right + glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); + glTexCoord2f(TexX2*TexW, TexY2*TexH); + glVertex3f(x+w*scaleW, y+h*scaleH + 15, z); + glEnd; + end; + end; + + for T := 0 to High(Text) do begin + Text[T].Draw; + end; + end; +end; + +// ***** ****** // + +destructor TButton.Destroy; +begin + inherited; +end; + +constructor TButton.Create(Textura: TTexture); +begin + Create(); + Texture := Textura; + Texture.ColR := 0; + Texture.ColG := 0.5; + Texture.ColB := 0; + Texture.Int := 1; +end; + + +end. diff --git a/Game/Code/Menu/UMenuInteract.dcu b/Game/Code/Menu/UMenuInteract.dcu new file mode 100644 index 00000000..785be771 Binary files /dev/null and b/Game/Code/Menu/UMenuInteract.dcu differ diff --git a/Game/Code/Menu/UMenuInteract.pas b/Game/Code/Menu/UMenuInteract.pas new file mode 100644 index 00000000..3f2960b8 --- /dev/null +++ b/Game/Code/Menu/UMenuInteract.pas @@ -0,0 +1,14 @@ +unit UMenuInteract; + +interface + +type + TInteract = record // for moving thru menu + Typ: integer; // 0 - button, 1 - select + Num: integer; // number of this item in proper list like buttons, selects + end; + +implementation + +end. + \ No newline at end of file diff --git a/Game/Code/Menu/UMenuSelect.dcu b/Game/Code/Menu/UMenuSelect.dcu new file mode 100644 index 00000000..9d483c33 Binary files /dev/null and b/Game/Code/Menu/UMenuSelect.dcu differ diff --git a/Game/Code/Menu/UMenuSelect.pas b/Game/Code/Menu/UMenuSelect.pas new file mode 100644 index 00000000..f7bb871f --- /dev/null +++ b/Game/Code/Menu/UMenuSelect.pas @@ -0,0 +1,198 @@ +unit UMenuSelect; + +interface +uses TextGL, UTexture, OpenGL12, UMenuText; + +type + PSelect = ^TSelect; + TSelect = class + private + SelectBool: boolean; + public + // objects + Text: TText; // Main Text + TextOpt: array of TText; // Options Text + Texture: TTexture; // Select Texture + TextureSBG: TTexture; // Background Selections Texture + TextureS: array of TTexture; // Selections Texture + SelectOptInt: integer; + PData: ^integer; + + // for selection and deselection + // main static + ColR: real; + ColG: real; + ColB: real; + Int: real; + DColR: real; + DColG: real; + DColB: real; + DInt: real; + + // main text + TColR: real; + TColG: real; + TColB: real; + TInt: real; + TDColR: real; + TDColG: real; + TDColB: real; + TDInt: real; + + // selection background static + SBGColR: real; + SBGColG: real; + SBGColB: real; + SBGInt: real; + SBGDColR: real; + SBGDColG: real; + SBGDColB: real; + SBGDInt: real; + + // selection statics + SColR: real; + SColG: real; + SColB: real; + SInt: real; + SDColR: real; + SDColG: real; + SDColB: real; + SDInt: real; + + // selection text + STColR: real; + STColG: real; + STColB: real; + STInt: real; + STDColR: real; + STDColG: real; + STDColB: real; + STDInt: real; + + // position and size + property X: real read Texture.x write Texture.x; + property Y: real read Texture.y write Texture.y; + property W: real read Texture.w write Texture.w; + property H: real read Texture.h write Texture.h; +// property X2: real read Texture2.x write Texture2.x; +// property Y2: real read Texture2.y write Texture2.y; +// property W2: real read Texture2.w write Texture2.w; +// property H2: real read Texture2.h write Texture2.h; + + // procedures + procedure SetSelect(Value: boolean); + property Selected: Boolean read SelectBool write SetSelect; + procedure SetSelectOpt(Value: integer); + property SelectedOption: integer read SelectOptInt write SetSelectOpt; + procedure Draw(ButtonAlpha: real); + constructor Create; + end; + +implementation +uses UDrawTexture; + +// ------------ Select +constructor TSelect.Create; +begin + inherited Create; + Text := TText.Create; +end; + +procedure TSelect.SetSelect(Value: boolean); +var + SO: integer; +begin // default 1, 0.4 + SelectBool := Value; + if Value then begin + Texture.ColR := ColR; + Texture.ColG := ColG; + Texture.ColB := ColB; + Texture.Int := Int; + + Text.ColR := TColR; + Text.ColG := TColG; + Text.ColB := TColB; + Text.Int := TInt; + + TextureSBG.ColR := SBGColR; + TextureSBG.ColG := SBGColG; + TextureSBG.ColB := SBGColB; + TextureSBG.Int := SBGInt; + +{ for SO := 0 to High(TextOpt) do begin + if SelectOptInt = SO then begin + TextOpt[SO].ColR := STColR; + TextOpt[SO].ColG := STColG; + TextOpt[SO].ColB := STColB; + TextOpt[SO].Int := STInt; + end else begin + TextOpt[SO].ColR := STDColR; + TextOpt[SO].ColG := STDColG; + TextOpt[SO].ColB := STDColB; + TextOpt[SO].Int := STDInt; + end; + end;} + + end else begin + Texture.ColR := DColR; + Texture.ColG := DColG; + Texture.ColB := DColB; + Texture.Int := DInt; + + Text.ColR := TDColR; + Text.ColG := TDColG; + Text.ColB := TDColB; + Text.Int := TDInt; + + TextureSBG.ColR := SBGDColR; + TextureSBG.ColG := SBGDColG; + TextureSBG.ColB := SBGDColB; + TextureSBG.Int := SBGDInt; + +{ for SO := 0 to High(TextOpt) do begin + TextOpt[SO].ColR := STDColR; + TextOpt[SO].ColG := STDColG; + TextOpt[SO].ColB := STDColB; + TextOpt[SO].Int := STDInt; + end;} + end; +end; + +procedure TSelect.SetSelectOpt(Value: integer); +var + SO: integer; +begin + SelectOptInt := Value; + PData^ := Value; +// SetSelect(true); // reset all colors + + for SO := 0 to High(TextOpt) do begin + if SelectOptInt = SO then begin + TextOpt[SO].ColR := STColR; + TextOpt[SO].ColG := STColG; + TextOpt[SO].ColB := STColB; + TextOpt[SO].Int := STInt; + end else begin + TextOpt[SO].ColR := STDColR; + TextOpt[SO].ColG := STDColG; + TextOpt[SO].ColB := STDColB; + TextOpt[SO].Int := STDInt; + end; + end; +end; + +procedure TSelect.Draw(ButtonAlpha: real); +var + SO: integer; +begin + DrawTexture(Texture); + DrawTexture(TextureSBG); + + Text.Draw; + + for SO := 0 to High(TextOpt) do begin + TextOpt[SO].Draw; + end; +end; + +end. diff --git a/Game/Code/Menu/UMenuSelectSlide.dcu b/Game/Code/Menu/UMenuSelectSlide.dcu new file mode 100644 index 00000000..1475c1ac Binary files /dev/null and b/Game/Code/Menu/UMenuSelectSlide.dcu differ diff --git a/Game/Code/Menu/UMenuSelectSlide.pas b/Game/Code/Menu/UMenuSelectSlide.pas new file mode 100644 index 00000000..7850cdf6 --- /dev/null +++ b/Game/Code/Menu/UMenuSelectSlide.pas @@ -0,0 +1,335 @@ +unit UMenuSelectSlide; + +interface +uses TextGL, UTexture, OpenGL12, UMenuText; + +type + PSelectSlide = ^TSelectSlide; + TSelectSlide = class + private + SelectBool: boolean; + public + // objects + Text: TText; // Main text describing option + TextOpt: array of TText; // 3 texts in the position of possible options + TextOptT: array of string; // array of names for possible options + + Texture: TTexture; // Select Texture + TextureSBG: TTexture; // Background Selections Texture +// TextureS: array of TTexture; // Selections Texture (not used) + +// TextureArrowL: TTexture; // Texture for left arrow (not used yet) +// TextureArrowR: TTexture; // Texture for right arrow (not used yet) + + SelectOptInt: integer; + PData: ^integer; + + //For automatically Setting LineCount + Lines: Byte; + + //Visibility + Visible: Boolean; + + // for selection and deselection + // main static + ColR: real; + ColG: real; + ColB: real; + Int: real; + DColR: real; + DColG: real; + DColB: real; + DInt: real; + + // main text + TColR: real; + TColG: real; + TColB: real; + TInt: real; + TDColR: real; + TDColG: real; + TDColB: real; + TDInt: real; + + // selection background static + SBGColR: real; + SBGColG: real; + SBGColB: real; + SBGInt: real; + SBGDColR: real; + SBGDColG: real; + SBGDColB: real; + SBGDInt: real; + + // selection text + STColR: real; + STColG: real; + STColB: real; + STInt: real; + STDColR: real; + STDColG: real; + STDColB: real; + STDInt: real; + + // position and size + property X: real read Texture.x write Texture.x; + property Y: real read Texture.y write Texture.y; + property W: real read Texture.w write Texture.w; + property H: real read Texture.h write Texture.h; +// property X2: real read Texture2.x write Texture2.x; +// property Y2: real read Texture2.y write Texture2.y; +// property W2: real read Texture2.w write Texture2.w; +// property H2: real read Texture2.h write Texture2.h; + + // procedures + procedure SetSelect(Value: boolean); + property Selected: Boolean read SelectBool write SetSelect; + procedure SetSelectOpt(Value: integer); + property SelectedOption: integer read SelectOptInt write SetSelectOpt; + procedure Draw; + constructor Create; + + //Automatically Generate Lines (Texts) + procedure genLines; + end; + +implementation +uses UDrawTexture, math, ULog, SysUtils; + +// ------------ Select +constructor TSelectSlide.Create; +begin + inherited Create; + Text := TText.Create; + SetLength(TextOpt, 1); + TextOpt[0] := TText.Create; + + Visible := True; + {SetLength(TextOpt, 3); + TextOpt[0] := TText.Create; + TextOpt[1] := TText.Create; + TextOpt[2] := TText.Create;} +end; + +procedure TSelectSlide.SetSelect(Value: boolean); +var + SO: integer; + I: integer; +begin + SelectBool := Value; + if Value then begin + Texture.ColR := ColR; + Texture.ColG := ColG; + Texture.ColB := ColB; + Texture.Int := Int; + + Text.ColR := TColR; + Text.ColG := TColG; + Text.ColB := TColB; + Text.Int := TInt; + + TextureSBG.ColR := SBGColR; + TextureSBG.ColG := SBGColG; + TextureSBG.ColB := SBGColB; + TextureSBG.Int := SBGInt; + +{ for I := 0 to High(TextOpt) do begin + TextOpt[I].ColR := STColR; + TextOpt[I].ColG := STColG; + TextOpt[I].ColB := STColB; + TextOpt[I].Int := STInt; + end;} + + end else begin + Texture.ColR := DColR; + Texture.ColG := DColG; + Texture.ColB := DColB; + Texture.Int := DInt; + + Text.ColR := TDColR; + Text.ColG := TDColG; + Text.ColB := TDColB; + Text.Int := TDInt; + + TextureSBG.ColR := SBGDColR; + TextureSBG.ColG := SBGDColG; + TextureSBG.ColB := SBGDColB; + TextureSBG.Int := SBGDInt; + +{ for I := 0 to High(TextOpt) do begin + TextOpt[I].ColR := STDColR; + TextOpt[I].ColG := STDColG; + TextOpt[I].ColB := STDColB; + TextOpt[I].Int := STDInt; + end;} + end; +end; + +procedure TSelectSlide.SetSelectOpt(Value: integer); +var + SO: integer; + Sel: integer; + HalfL: integer; + HalfR: integer; + +procedure DoSelection(Sel: Cardinal); + var I: Integer; + begin + for I := low(TextOpt) to high(TextOpt) do + begin + TextOpt[I].ColR := STDColR; + TextOpt[I].ColG := STDColG; + TextOpt[I].ColB := STDColB; + TextOpt[I].Int := STDInt; + end; + if (Sel <= high(TextOpt)) then + begin + TextOpt[Sel].ColR := STColR; + TextOpt[Sel].ColG := STColG; + TextOpt[Sel].ColB := STColB; + TextOpt[Sel].Int := STInt; + end; + end; +begin + SelectOptInt := Value; + PData^ := Value; +// SetSelect(true); // reset all colors + + if (Length(TextOpt)>0) AND (Length(TextOptT)>0) then + begin + + if (Value <= 0) then + begin //First Option Selected + Value := 0; + + for SO := low (TextOpt) to high(TextOpt) do + begin + TextOpt[SO].Text := TextOptT[SO]; + end; + + DoSelection(0); + end + else if (Value >= high(TextOptT)) then + begin //Last Option Selected + Value := high(TextOptT); + + for SO := high(TextOpt) downto low (TextOpt) do + begin + TextOpt[SO].Text := TextOptT[high(TextOptT)-(Lines-SO-1)]; + end; + DoSelection(Lines-1); + end + else + begin + HalfL := Ceil((Lines-1)/2); + HalfR := Lines-1-HalfL; + + if (Value <= HalfL) then + begin //Selected Option is near to the left side + {HalfL := Value; + HalfR := Lines-1-HalfL;} + //Change Texts + for SO := low (TextOpt) to high(TextOpt) do + begin + TextOpt[SO].Text := TextOptT[SO]; + end; + + DoSelection(Value); + end + else if (Value > High(TextOptT)-HalfR) then + begin //Selected is too near to the right border + HalfR := high(TextOptT) - Value; + HalfL := Lines-1-HalfR; + //Change Texts + for SO := high(TextOpt) downto low (TextOpt) do + begin + TextOpt[SO].Text := TextOptT[high(TextOptT)-(Lines-SO-1)]; + end; + + DoSelection (HalfL); + end + else + begin + //Change Texts + for SO := low (TextOpt) to high(TextOpt) do + begin + TextOpt[SO].Text := TextOptT[Value - HalfL + SO]; + end; + + DoSelection(HalfL); + end; + + end; + + end; + +end; + +procedure TSelectSlide.Draw; +var + SO: integer; +begin + if Visible then + begin + DrawTexture(Texture); + DrawTexture(TextureSBG); + + Text.Draw; + + for SO := low(TextOpt) to high(TextOpt) do + TextOpt[SO].Draw; + end; +end; + +procedure TSelectSlide.GenLines; +var +maxlength: Real; +I: Integer; +begin + SetFontStyle(TextOpt[0].Style); + SetFontSize(TextOpt[0].Size); + maxlength := 0; + + for I := low(TextOptT) to high (TextOptT) do + begin + if (glTextWidth(PChar(TextOptT[I])) > maxlength) then + maxlength := glTextWidth(PChar(TextOptT[I])); + end; + + Lines := floor((TextureSBG.W-40) / (maxlength+7)); + if (Lines > Length(TextOptT)) then + Lines := Length(TextOptT); + + if (Lines <= 0) then + Lines := 1; + + setLength (TextOpt, Lines); + + for I := low(TextOpt) to high(TextOpt) do + begin + + //TextOpt[I] := TextOpt[0]; + TextOpt[I] := TText.Create; + TextOpt[I].Size := 10; + //TextOpt[I].Align := 1; + TextOpt[I].Align := 0; + TextOpt[I].Visible := True; + + TextOpt[I].ColR := STDColR; + TextOpt[I].ColG := STDColG; + TextOpt[I].ColB := STDColB; + TextOpt[I].Int := STDInt; + + //Generate Positions + //TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * (I + 0.5); + TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * I; + TextOpt[I].Y := TextureSBG.Y + 20; + + //Better Look with 2 Options + if (Lines=2) then + TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W -40 - glTextWidth(PChar(TextOptT[1]))) * I; + end; + //TextOpt[I] := TextOpt[0]; +end; + +end. diff --git a/Game/Code/Menu/UMenuStatic.dcu b/Game/Code/Menu/UMenuStatic.dcu new file mode 100644 index 00000000..901fa2c7 Binary files /dev/null and b/Game/Code/Menu/UMenuStatic.dcu differ diff --git a/Game/Code/Menu/UMenuStatic.pas b/Game/Code/Menu/UMenuStatic.pas new file mode 100644 index 00000000..4b10e54c --- /dev/null +++ b/Game/Code/Menu/UMenuStatic.pas @@ -0,0 +1,32 @@ +unit UMenuStatic; + +interface +uses UTexture, OpenGL12; + +type + TStatic = class + public + Texture: TTexture; // Button Screen position and size + Visible: boolean; + procedure Draw; + constructor Create(Textura: TTexture); overload; + end; + +implementation +uses UDrawTexture; + +procedure TStatic.Draw; +var + Pet: integer; +begin + if Visible then + DrawTexture(Texture); +end; + +constructor TStatic.Create(Textura: TTexture); +begin + inherited Create; + Texture := Textura; +end; + +end. diff --git a/Game/Code/Menu/UMenuText.dcu b/Game/Code/Menu/UMenuText.dcu new file mode 100644 index 00000000..7cfe0316 Binary files /dev/null and b/Game/Code/Menu/UMenuText.dcu differ diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas new file mode 100644 index 00000000..5c435a18 --- /dev/null +++ b/Game/Code/Menu/UMenuText.pas @@ -0,0 +1,96 @@ +unit UMenuText; + +interface +uses TextGL, UTexture, OpenGL12, SysUtils; + +type + TText = class + private + SelectBool: boolean; + public + X: real; + Y: real; +// W: real; // if text is wider than W then it is streched (not yet implemented) +// H: real; + Size: real; + Text: string; + ColR: real; + ColG: real; + ColB: real; + Int: real; + Style: integer; + Visible: boolean; + Align: integer; // 0 = left, 1 = center, 2 = right + + procedure SetSelect(Value: Boolean); + property Selected: Boolean read SelectBool write SetSelect; + + procedure Draw; + constructor Create; overload; + constructor Create(X, Y: real; Tekst: string); overload; + constructor Create(ParX, ParY: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; ParTekst: string); overload; + end; + +implementation +uses UGraphic; + +procedure TText.SetSelect(Value: Boolean); +begin + SelectBool := Value; +end; + +procedure TText.Draw; +var + X2: real; + Text2: string; +begin + if Visible then begin + SetFontStyle(Style); + SetFontSize(Size); + glColor3f(ColR*Int, ColG*Int, ColB*Int); + if not SelectBool then + Text2 := Text + else + Text2 := Text + '|'; + + case Align of + 0: X2 := X; + 1: X2 := X - glTextWidth(pchar(Text2))/2; + 2: X2 := X - glTextWidth(pchar(Text2)); + end; + + SetFontPos(X2, Y); + glPrint(PChar(Text2)); + SetFontStyle(0); // reset to default + end; +end; + +constructor TText.Create; +begin + Create(0, 0, ''); +end; + +constructor TText.Create(X, Y: real; Tekst: string); +begin + Create(X, Y, 0, 10, 0, 0, 0, 0, Tekst); +end; + +constructor TText.Create(ParX, ParY: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; ParTekst: string); +begin + inherited Create; + X := ParX; + Y := ParY; + Style := ParStyle; + Size := ParSize; + Text := ParTekst; + ColR := ParColR; + ColG := ParColG; + ColB := ParColB; + Int := 1; + Align := ParAlign; + SelectBool := false; + Visible := true; +end; + + +end. diff --git a/Game/Code/SMpeg/USmpeg.alt.pas b/Game/Code/SMpeg/USmpeg.alt.pas new file mode 100644 index 00000000..94ad69c8 --- /dev/null +++ b/Game/Code/SMpeg/USmpeg.alt.pas @@ -0,0 +1,292 @@ +unit USmpeg; + +interface +uses SDL, smpeg, OpenGL12, SysUtils, UIni; + +procedure OpenSmpeg(FileName: string); +procedure SkipSmpeg(Time: single); +procedure PlaySmpeg; +procedure UpdateSmpeg; +procedure CloseSmpeg; +function glmovie_init(Width : GLuint; Height : TGLuint ) : TGLenum; +procedure glmpeg_update(surface: PSDL_Surface; x: Sint32; y: Sint32; w: Uint32; h: Uint32); cdecl; +procedure DrawSmpeg(frame: PGLubyte); +procedure glmovie_resize( width : GLuint; height : GLuint ); +procedure glmovie_quit; + +var + mpeg: PSMPEG; + mpeg_info: TSMPEG_Info; + surface: PSDL_Surface; + +type + { Some data is redundant at this stage. } + PGLMovieTexture = ^TGLMovieTexture; + TGLMovieTexture = record + id : TGLuint; (* OpenGL texture id. *) + poly_width : TGLuint; (* Quad width for tile. *) + poly_height : TGLuint; (* Quad height for tile. *) + movie_width : TGLuint; (* Width of movie inside tile. *) + movie_height : TGLuint; (* Height of movie inside tile. *) + skip_rows : TGLuint; (* Number of rows of movie to skip *) + skip_pixels : TGLuint; (* Number of columns of movie to skip *) + row : TGLuint; (* Row number of tile in scheme. *) + col : TGLuint; (* Column number of tile in scheme. *) + end; + +type + TGLuintArray = array of TGLuint; + PGLuintArray = ^TGLuintArray; + TGLMovieTextureArray = array of TGLMovieTexture; + PGLMovieTextureArray = ^TGLMovieTextureArray; + +var + (* Our evil maximum texture size. Boo 3Dfxnot *) + texture_size : TGLuint = 1024;//512; + texture_ids : TGLuint; + textures: TGLMovieTexture; + tiled_width : TGLuint = 0; + tiled_height : TGLuint = 0; + movie_width : TGLuint = 0; + movie_height : TGLuint = 0; + +implementation + +procedure OpenSmpeg(FileName: string); +begin + mpeg := SMPEG_new(PChar(FileName), @mpeg_info, 0); // audio + if ( mpeg = nil ) then begin + SDL_Quit; + Exit; + end; + +// SMPEG_setvolume(mpeg, 50); + SMPEG_enableaudio(mpeg, 0); + + (* Everything needs to be in RGB for GL, but needs to be 32-bit for SMPEG. *) + surface := SDL_AllocSurface( SDL_SWSURFACE, + mpeg_info.width, + mpeg_info.height, + 32, + $000000FF, + $0000FF00, + $00FF0000, + $FF000000 ); + + if ( surface = nil ) then begin + SDL_Quit; + Exit; + end; + + (* *Initialize* with mpeg size. *) + if (glmovie_init( mpeg_info.width, mpeg_info.height ) <> GL_NO_ERROR ) then begin + SDL_Quit; + Exit; + end; + + SMPEG_setdisplay(mpeg, surface, nil, @glmpeg_update); +end; + +procedure SkipSmpeg(Time: single); +begin + SMPEG_skip(mpeg, Time); +end; + +procedure PlaySmpeg; +begin + SMPEG_play(mpeg); +end; + +procedure UpdateSmpeg; +begin +// glmpeg_update(surface,0,0,0,0); + DrawSmpeg( PGLubyte( surface.pixels ) ); +end; + +procedure CloseSmpeg; +begin +// glmovie_quit; + SMPEG_delete(mpeg); +end; + +function glmovie_init( Width : GLuint; Height : TGLuint ) : TGLenum; +type + PGLubyteArray = ^TGLubyteArray; + TGLubyteArray = array of TGLubyte; +var + (* Initial black texels. *) + pixels : TGLubyteArray; + (* Absolute offsets from within tiled frame. *) + //offset_x: GLuint; + //offset_y: GLuint; + skip_rows : GLuint; + skip_pixels : GLuint; + i, j, current : GLuint; +begin + skip_rows := 0; + current := 0; + (* Save original movie dimensions. *) + movie_width := width; + movie_height := height; + + (* Get the power of 2 dimensions. *) + tiled_width := 1024{512}; + tiled_height := 1024{512}; + + texture_size := 1024{512}; + + (* Time for fun with data type = record *) + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glEnable(GL_TEXTURE_2D); + glEnable(GL_DITHER); + + glGenTextures(1, @texture_ids); + + current := 0; + (* Setup texture. *) + textures.id := texture_ids; + textures.poly_width := texture_size; + textures.poly_height := texture_size; + textures.movie_width := movie_width - 2; + textures.movie_height := movie_height - 2; + textures.row := i; + textures.col := j; + textures.skip_pixels := skip_pixels; + textures.skip_rows := skip_rows; + + SetLength( pixels, textures.poly_width * textures.poly_height * 4 ); + if ( pixels = nil ) then + begin + glDeleteTextures(1, @texture_ids); + result := GL_OUT_OF_MEMORY; + exit; + end; + //FillChar( pixels^, textures[ current ].poly_width * textures[ current ].poly_height * 4, 0 ); + + (* Do all of our useful binding. *) + glBindTexture(GL_TEXTURE_2D, texture_ids); +// glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + (* Specify our 256x256 black texture. *) + glTexImage2D( GL_TEXTURE_2D, + 0, + GL_RGB, + 1024{512},//textures.poly_width, + 1024{512},//textures.poly_height, + 0, + GL_RGBA, + GL_UNSIGNED_BYTE, + @pixels[0] ); + SetLength( pixels, 0 ); + + + (* Simple state setup at the end. *) + result := glGetError( ); +end; + +procedure glmpeg_update( surface : PSDL_Surface; x : Sint32; y : Sint32; w : Uint32; + h : Uint32 ); cdecl; +var + error : TGLenum; +begin + glClear( GL_COLOR_BUFFER_BIT ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity; + DrawSmpeg( PGLubyte( surface.pixels ) ); + error := glGetError( ); + if ( error <> GL_NO_ERROR ) then Exit; + SDL_GL_SwapBuffers; +end; + +procedure DrawSmpeg(frame: PGLubyte); +var + Shift: TGLdouble; + CropT: real; + CropB: real; + TexT: real; + TexB: real; + TexL: real; + TexR: real; + Wide: boolean; +begin + (* full screen mpeg *) +{ CropT := 0; + CropB := 600; + TexT := 0; + TexB := 1; + TexL := 0; + TexW := 1;} + + // set movie texture crop + Wide := false; + if (textures.movie_width = 720-2) and (textures.movie_height = 344-2) then begin + TexT := 0; + TexB := 342/1024; + Wide := true; + end; + if textures.movie_height = 304-2 then begin + TexT := 0; + TexB := 304/1024; + Wide := true; + end; + if textures.movie_height = 152-2 then begin + TexT := 0; + TexB := 152/1024; + Wide := true; + end; + + CropT := 110; // (110/800 = 13,75% max crop) + CropB := 490; // (110/800 = 13,75% max crop) + + if (textures.movie_height <> 304-2) and (textures.movie_height <> 152-2) and (textures.movie_height <> 344-2) then begin + TexT := 110 / 600 * (textures.movie_height / 1024{512}); + TexB := 490 / 600 * (textures.movie_height / 1024{512}); + + if Ini.MovieSize = 1 then begin + // full screen size + CropT := 0; + CropB := 600; + TexT := 0; + TexB := textures.movie_height / 1024{512}; + end; + end; + + TexL := {10}0/600 * (textures.movie_width / 1024{512}); + TexR := {590}600/600 * (textures.movie_width / 1024{512}); + + glEnable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + glColor3f(1, 1, 1); + glBindTexture( GL_TEXTURE_2D, texture_ids ); +// glPixelStorei( GL_UNPACK_ROW_LENGTH, movie_width ); + glPixelStorei( GL_UNPACK_SKIP_ROWS, 0); + glPixelStorei( GL_UNPACK_SKIP_PIXELS, 0); + glTexSubImage2D( GL_TEXTURE_2D, 0, 0, (* offset_x *) 0, (* offset_y *) textures.movie_width + 2, textures.movie_height + 2, GL_RGBA, GL_UNSIGNED_BYTE, frame ); + + // draw + glBegin( GL_QUADS ); + glTexCoord2f(TexL, TexT); glVertex2f(0, CropT); + glTexCoord2f(TexL, TexB); glVertex2f(0, CropB); + glTexCoord2f(TexR, TexB); glVertex2f(800, CropB); + glTexCoord2f(TexR, TexT); glVertex2f(800, CropT); + glEnd; + glDisable(GL_TEXTURE_2D); +end; + +procedure glmovie_resize( width : GLuint; height : GLuint ); +begin + glViewport(0, 0, width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity; + gluOrtho2D(0, 800, 600, 0); +end; + +procedure glmovie_quit; +begin + glDeleteTextures(1, @texture_ids); +end; + +end. diff --git a/Game/Code/SMpeg/USmpeg.dcu b/Game/Code/SMpeg/USmpeg.dcu new file mode 100644 index 00000000..d31948ea Binary files /dev/null and b/Game/Code/SMpeg/USmpeg.dcu differ diff --git a/Game/Code/SMpeg/USmpeg.pas b/Game/Code/SMpeg/USmpeg.pas new file mode 100644 index 00000000..c7f756db --- /dev/null +++ b/Game/Code/SMpeg/USmpeg.pas @@ -0,0 +1,299 @@ +unit USmpeg; + +interface +uses SDL, smpeg, OpenGL12, SysUtils, UIni; + +procedure OpenSmpeg(FileName: string); +procedure SkipSmpeg(Time: single); +procedure PlaySmpeg; +procedure PauseSmpeg; //PauseMod +procedure UpdateSmpeg; +procedure CloseSmpeg; +function glmovie_init(Width : GLuint; Height : TGLuint ) : TGLenum; +procedure glmpeg_update(surface: PSDL_Surface; x: Sint32; y: Sint32; w: Uint32; h: Uint32); cdecl; +procedure DrawSmpeg(frame: PGLubyte); +procedure glmovie_resize( width : GLuint; height : GLuint ); +procedure glmovie_quit; + +var + mpeg: PSMPEG; + mpeg_info: TSMPEG_Info; + surface: PSDL_Surface; + +type + { Some data is redundant at this stage. } + PGLMovieTexture = ^TGLMovieTexture; + TGLMovieTexture = record + id : TGLuint; (* OpenGL texture id. *) + poly_width : TGLuint; (* Quad width for tile. *) + poly_height : TGLuint; (* Quad height for tile. *) + movie_width : TGLuint; (* Width of movie inside tile. *) + movie_height : TGLuint; (* Height of movie inside tile. *) + skip_rows : TGLuint; (* Number of rows of movie to skip *) + skip_pixels : TGLuint; (* Number of columns of movie to skip *) + row : TGLuint; (* Row number of tile in scheme. *) + col : TGLuint; (* Column number of tile in scheme. *) + end; + +type + TGLuintArray = array of TGLuint; + PGLuintArray = ^TGLuintArray; + TGLMovieTextureArray = array of TGLMovieTexture; + PGLMovieTextureArray = ^TGLMovieTextureArray; + +var + (* Our evil maximum texture size. Boo 3Dfxnot *) + texture_size : TGLuint = 1024;//512; + texture_ids : TGLuint; + textures: TGLMovieTexture; + tiled_width : TGLuint = 0; + tiled_height : TGLuint = 0; + movie_width : TGLuint = 0; + movie_height : TGLuint = 0; + +implementation + +procedure OpenSmpeg(FileName: string); +begin + mpeg := SMPEG_new(PChar(FileName), @mpeg_info, 0); // audio + if ( mpeg = nil ) then begin + SDL_Quit; + Exit; + end; + +// SMPEG_setvolume(mpeg, 50); + SMPEG_enableaudio(mpeg, 0); + + (* Everything needs to be in RGB for GL, but needs to be 32-bit for SMPEG. *) + surface := SDL_AllocSurface( SDL_SWSURFACE, + mpeg_info.width, + mpeg_info.height, + 32, + $000000FF, + $0000FF00, + $00FF0000, + $FF000000 ); + + if ( surface = nil ) then begin + SDL_Quit; + Exit; + end; + + (* *Initialize* with mpeg size. *) + if (glmovie_init( mpeg_info.width, mpeg_info.height ) <> GL_NO_ERROR ) then begin + SDL_Quit; + Exit; + end; + + SMPEG_setdisplay(mpeg, surface, nil, @glmpeg_update); +end; + +procedure SkipSmpeg(Time: single); +begin + SMPEG_skip(mpeg, Time); +end; + +procedure PlaySmpeg; +begin + SMPEG_play(mpeg); +end; + +//Pause Mod +procedure PauseSmpeg; +begin + SMPEG_pause(mpeg); +end; + +procedure UpdateSmpeg; +begin +// glmpeg_update(surface,0,0,0,0); + DrawSmpeg( PGLubyte( surface.pixels ) ); +end; + +procedure CloseSmpeg; +begin +// glmovie_quit; + SMPEG_delete(mpeg); +end; + +function glmovie_init( Width : GLuint; Height : TGLuint ) : TGLenum; +type + PGLubyteArray = ^TGLubyteArray; + TGLubyteArray = array of TGLubyte; +var + (* Initial black texels. *) + pixels : TGLubyteArray; + (* Absolute offsets from within tiled frame. *) + //offset_x: GLuint; + //offset_y: GLuint; + skip_rows : GLuint; + skip_pixels : GLuint; + i, j, current : GLuint; +begin + skip_rows := 0; + current := 0; + (* Save original movie dimensions. *) + movie_width := width; + movie_height := height; + + (* Get the power of 2 dimensions. *) + tiled_width := 1024{512}; + tiled_height := 1024{512}; + + texture_size := 1024{512}; + + (* Time for fun with data type = record *) + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glEnable(GL_TEXTURE_2D); + glEnable(GL_DITHER); + + glGenTextures(1, @texture_ids); + + current := 0; + (* Setup texture. *) + textures.id := texture_ids; + textures.poly_width := texture_size; + textures.poly_height := texture_size; + textures.movie_width := movie_width - 2; + textures.movie_height := movie_height - 2; + textures.row := i; + textures.col := j; + textures.skip_pixels := skip_pixels; + textures.skip_rows := skip_rows; + + SetLength( pixels, textures.poly_width * textures.poly_height * 4 ); + if ( pixels = nil ) then + begin + glDeleteTextures(1, @texture_ids); + result := GL_OUT_OF_MEMORY; + exit; + end; + //FillChar( pixels^, textures[ current ].poly_width * textures[ current ].poly_height * 4, 0 ); + + (* Do all of our useful binding. *) + glBindTexture(GL_TEXTURE_2D, texture_ids); +// glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + (* Specify our 256x256 black texture. *) + glTexImage2D( GL_TEXTURE_2D, + 0, + GL_RGB, + 1024{512},//textures.poly_width, + 1024{512},//textures.poly_height, + 0, + GL_RGBA, + GL_UNSIGNED_BYTE, + @pixels[0] ); + SetLength( pixels, 0 ); + + + (* Simple state setup at the end. *) + result := glGetError( ); +end; + +procedure glmpeg_update( surface : PSDL_Surface; x : Sint32; y : Sint32; w : Uint32; + h : Uint32 ); cdecl; +var + error : TGLenum; +begin + glClear( GL_COLOR_BUFFER_BIT ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity; + DrawSmpeg( PGLubyte( surface.pixels ) ); + error := glGetError( ); + if ( error <> GL_NO_ERROR ) then Exit; + SDL_GL_SwapBuffers; +end; + +procedure DrawSmpeg(frame: PGLubyte); +var + Shift: TGLdouble; + CropT: real; + CropB: real; + TexT: real; + TexB: real; + TexL: real; + TexR: real; + Wide: boolean; +begin + (* full screen mpeg *) +{ CropT := 0; + CropB := 600; + TexT := 0; + TexB := 1; + TexL := 0; + TexW := 1;} + + // set movie texture crop + Wide := false; + if (textures.movie_width = 720-2) and (textures.movie_height = 344-2) then begin + TexT := 0; + TexB := 342/1024; + Wide := true; + end; + if textures.movie_height = 304-2 then begin + TexT := 0; + TexB := 304/1024; + Wide := true; + end; + if textures.movie_height = 152-2 then begin + TexT := 0; + TexB := 152/1024; + Wide := true; + end; + + CropT := 110; // (110/800 = 13,75% max crop) + CropB := 490; // (110/800 = 13,75% max crop) + + if (textures.movie_height <> 304-2) and (textures.movie_height <> 152-2) and (textures.movie_height <> 344-2) then begin + TexT := 110 / 600 * (textures.movie_height / 1024{512}); + TexB := 490 / 600 * (textures.movie_height / 1024{512}); + + if Ini.MovieSize = 1 then begin + // full screen size + CropT := 0; + CropB := 600; + TexT := 0; + TexB := textures.movie_height / 1024{512}; + end; + end; + + TexL := {10}0/600 * (textures.movie_width / 1024{512}); + TexR := {590}600/600 * (textures.movie_width / 1024{512}); + + glEnable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + glColor3f(1, 1, 1); + glBindTexture( GL_TEXTURE_2D, texture_ids ); +// glPixelStorei( GL_UNPACK_ROW_LENGTH, movie_width ); + glPixelStorei( GL_UNPACK_SKIP_ROWS, 0); + glPixelStorei( GL_UNPACK_SKIP_PIXELS, 0); + glTexSubImage2D( GL_TEXTURE_2D, 0, 0, (* offset_x *) 0, (* offset_y *) textures.movie_width + 2, textures.movie_height + 2, GL_RGBA, GL_UNSIGNED_BYTE, frame ); + + // draw + glBegin( GL_QUADS ); + glTexCoord2f(TexL, TexT); glVertex2f(0, CropT); + glTexCoord2f(TexL, TexB); glVertex2f(0, CropB); + glTexCoord2f(TexR, TexB); glVertex2f(800, CropB); + glTexCoord2f(TexR, TexT); glVertex2f(800, CropT); + glEnd; + glDisable(GL_TEXTURE_2D); +end; + +procedure glmovie_resize( width : GLuint; height : GLuint ); +begin + glViewport(0, 0, width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity; + gluOrtho2D(0, 800, 600, 0); +end; + +procedure glmovie_quit; +begin + glDeleteTextures(1, @texture_ids); +end; + +end. diff --git a/Game/Code/Screens/UScreenEdit.dcu b/Game/Code/Screens/UScreenEdit.dcu new file mode 100644 index 00000000..1b9c7bb9 Binary files /dev/null and b/Game/Code/Screens/UScreenEdit.dcu differ diff --git a/Game/Code/Screens/UScreenEdit.pas b/Game/Code/Screens/UScreenEdit.pas new file mode 100644 index 00000000..aa3301a7 --- /dev/null +++ b/Game/Code/Screens/UScreenEdit.pas @@ -0,0 +1,104 @@ +unit UScreenEdit; + +interface + +uses UMenu, SDL, UThemes; + +type + TScreenEdit = class(TMenu) + public +{ Tex_Background: TTexture; + FadeOut: boolean; + Path: string; + FileName: string;} + constructor Create(Back: String); override; + procedure onShow; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; +{ function Draw: boolean; override; + procedure Finish;} + end; + +implementation + +uses UGraphic, UMusic, USkins; + +function TScreenEdit.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_ESCAPE : + begin + Music.PlayBack; + FadeTo(@ScreenMain); +// Result := false; + end; + SDLK_RETURN: + begin + if Interaction = 0 then begin + Music.PlayStart; + FadeTo(@ScreenEditConvert); + end; +// if Interaction = 1 then begin +// Music.PlayStart; +// FadeTo(@ScreenEditHeader); +// end; + + if Interaction = 1 then begin + Music.PlayBack; + FadeTo(@ScreenMain); + end; + end; + + SDLK_DOWN: + begin + InteractNext; + end; + SDLK_UP: + begin + InteractPrev; + end; + end; + end; +end; + +constructor TScreenEdit.Create(Back: String); +begin + inherited Create(Back); + AddButton(400-200, 100 + 0*70, 400, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(10, 5, 0, 0, 0, 'Convert Midi to Txt'); +// Button[High(Button)].Text[0].Size := 11; + +// AddButton(400-200, 100 + 1*60, 400, 40, 'ButtonF'); +// AddButtonText(10, 5, 0, 0, 0, 'Edit Headers'); + +// AddButton(400-200, 100 + 2*60, 400, 40, 'ButtonF'); +// AddButtonText(10, 5, 0, 0, 0, 'Set GAP'); + + AddButton(400-200, 100 + 3*60, 400, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(10, 5, 0, 0, 0, 'Exit'); + +end; + +procedure TScreenEdit.onShow; +begin +// Interaction := 0; +end; + +(*function TScreenEdit.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + Pet: integer; + AktBeat: integer; +begin +end; + +procedure TScreenEdit.Finish; +begin +// +end;*) + +end. diff --git a/Game/Code/Screens/UScreenEditConvert.dcu b/Game/Code/Screens/UScreenEditConvert.dcu new file mode 100644 index 00000000..1839ad6b Binary files /dev/null and b/Game/Code/Screens/UScreenEditConvert.dcu differ diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas new file mode 100644 index 00000000..68742535 --- /dev/null +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -0,0 +1,500 @@ +unit UScreenEditConvert; + +interface + +uses UMenu, SDL, MidiFile, MidiOut, ULog, USongs, UMusic, UThemes; + +type + TNote = record + Event: integer; + EventType: integer; + Channel: integer; + Start: real; + Len: real; + Data1: integer; + Data2: integer; + Str: string; + end; + + TTrack = record + Note: array of TNote; + Name: string; + Hear: boolean; + Status: byte; // 0 - none, 1 - notes, 2 - lyrics, 3 - notes + lyrics + end; + + TNuta = record + Start: integer; + Len: integer; + Tone: integer; + Lyric: string; + NewSentence: boolean; + end; + + TArrayTrack = array of TTrack; + + TScreenEditConvert = class(TMenu) + public + ATrack: TArrayTrack; // actual track +// Track: TArrayTrack; + Channel: TArrayTrack; + ColR: array[0..100] of real; + ColG: array[0..100] of real; + ColB: array[0..100] of real; + Len: real; + Sel: integer; + Selected: boolean; +// FileName: string; + MidiFile: TMidiFile; + MidiTrack: TMidiTrack; + MidiEvent: pMidiEvent; + MidiOut: TMidiOutput; + Song: TSong; + Czesc: TCzesci; + BPM: real; + Ticks: real; + Nuta: array of TNuta; + procedure AddLyric(Start: integer; Tekst: string); + procedure Extract; + procedure MidiFile1MidiEvent(event: PMidiEvent); + function SelectedNumber: integer; + constructor Create(Back: String); override; + procedure onShow; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onHide; override; + end; + +implementation +uses UGraphic, SysUtils, UDrawTexture, TextGL, UPliki, UMain, UIni, OpenGL, USkins; + +function TScreenEditConvert.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var + T: integer; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE: + begin + MidiFile.StopPlaying; + Music.PlayBack; + FadeTo(@ScreenEdit); + end; + + SDLK_RETURN: + begin + if Interaction = 0 then begin + Music.PlayStart; + ScreenOpen.BackScreen := @ScreenEditConvert; + FadeTo(@ScreenOpen); + end; + + if Interaction = 1 then begin + Selected := false; + MidiFile.OnMidiEvent := MidiFile1MidiEvent; +// MidiFile.GoToTime(MidiFile.GetTrackLength div 2); + MidiFile.StartPlaying; + end; + + if Interaction = 2 then begin + Selected := true; + MidiFile.OnMidiEvent := nil; + {for T := 0 to High(ATrack) do begin + if ATrack[T].Hear then begin + MidiTrack := MidiFile.GetTrack(T); + MidiTrack.OnMidiEvent := MidiFile1MidiEvent; + end; + end; + MidiFile.StartPlaying;//} + end; + + if Interaction = 3 then begin + if SelectedNumber > 0 then begin + Extract; + SaveSong(Song, Czesc, ChangeFileExt(FileName, '.txt'), false); + end; + end; + + end; + + SDLK_SPACE: + begin +// ATrack[Sel].Hear := not ATrack[Sel].Hear; + ATrack[Sel].Status := (ATrack[Sel].Status + 1) mod 4; + +{ if Selected then begin + MidiTrack := MidiFile.GetTrack(Sel); + if Track[Sel].Hear then + MidiTrack.OnMidiEvent := MidiFile1MidiEvent + else + MidiTrack.OnMidiEvent := nil; + end;} + end; + + SDLK_RIGHT: + begin + InteractNext; + end; + + SDLK_LEFT: + begin + InteractPrev; + end; + + SDLK_DOWN: + begin + Inc(Sel); + if Sel > High(ATrack) then Sel := 0; + end; + SDLK_UP: + begin + Dec(Sel); + if Sel < 0 then Sel := High(ATrack); + end; + end; + end; +end; + +procedure TScreenEditConvert.AddLyric(Start: integer; Tekst: string); +var + N: integer; +begin + for N := 0 to High(Nuta) do begin + if Nuta[N].Start = Start then begin + // check for new sentece + if Copy(Tekst, 1, 1) = '\' then Delete(Tekst, 1, 1); + if Copy(Tekst, 1, 1) = '/' then begin + Delete(Tekst, 1, 1); + Nuta[N].NewSentence := true; + end; + + // overwrite lyric od append + if Nuta[N].Lyric = '-' then + Nuta[N].Lyric := Tekst + else + Nuta[N].Lyric := Nuta[N].Lyric + Tekst; + end; + end; +end; + +procedure TScreenEditConvert.Extract; +var + T: integer; + C: integer; + N: integer; + Nu: integer; + NutaTemp: TNuta; + Move: integer; +begin + // song info + Song.Title := ''; + Song.Artist := ''; + Song.Mp3 := ''; + Song.Resolution := 4; + SetLength(Song.BPM, 1); + Song.BPM[0].BPM := BPM*4; + + // extract notes + for T := 0 to High(ATrack) do begin +// if ATrack[T].Hear then begin + if ((ATrack[T].Status div 1) and 1) = 1 then begin + for N := 0 to High(ATrack[T].Note) do begin + if (ATrack[T].Note[N].EventType = 9) and (ATrack[T].Note[N].Data2 > 0) then begin + Nu := Length(Nuta); + SetLength(Nuta, Nu + 1); + Nuta[Nu].Start := Round(ATrack[T].Note[N].Start / Ticks); + Nuta[Nu].Len := Round(ATrack[T].Note[N].Len / Ticks); + Nuta[Nu].Tone := ATrack[T].Note[N].Data1 - 12*5; + Nuta[Nu].Lyric := '-'; + end; + end; + end; + end; + + // extract lyrics + for T := 0 to High(ATrack) do begin +// if ATrack[T].Hear then begin + if ((ATrack[T].Status div 2) and 1) = 1 then begin + for N := 0 to High(ATrack[T].Note) do begin + if (ATrack[T].Note[N].EventType = 15) then begin +// Log.LogStatus('<' + Track[T].Note[N].Str + '>', 'MIDI'); + AddLyric(Round(ATrack[T].Note[N].Start / Ticks), ATrack[T].Note[N].Str); + end; + end; + end; + end; + + // sort notes + for N := 0 to High(Nuta) do + for Nu := 0 to High(Nuta)-1 do + if Nuta[Nu].Start > Nuta[Nu+1].Start then begin + NutaTemp := Nuta[Nu]; + Nuta[Nu] := Nuta[Nu+1]; + Nuta[Nu+1] := NutaTemp; + end; + + // move to 0 at beginning + Move := Nuta[0].Start; + for N := 0 to High(Nuta) do + Nuta[N].Start := Nuta[N].Start - Move; + + // copy notes + SetLength(Czesc.Czesc, 1); + Czesc.Ilosc := 1; + Czesc.High := 0; + + C := 0; + N := 0; + Czesc.Czesc[C].IlNut := 0; + Czesc.Czesc[C].HighNut := -1; + + for Nu := 0 to High(Nuta) do begin + if Nuta[Nu].NewSentence then begin // nowa linijka + SetLength(Czesc.Czesc, Length(Czesc.Czesc)+1); + Czesc.Ilosc := Czesc.Ilosc + 1; + Czesc.High := Czesc.High + 1; + C := C + 1; + N := 0; + SetLength(Czesc.Czesc[C].Nuta, 0); + Czesc.Czesc[C].IlNut := 0; + Czesc.Czesc[C].HighNut := -1; + end; + + // tworzy miejsce na nowa nute + SetLength(Czesc.Czesc[C].Nuta, Length(Czesc.Czesc[C].Nuta)+1); + Czesc.Czesc[C].IlNut := Czesc.Czesc[C].IlNut + 1; + Czesc.Czesc[C].HighNut := Czesc.Czesc[C].HighNut + 1; + + // dopisuje + Czesc.Czesc[C].Nuta[N].Start := Nuta[Nu].Start; + Czesc.Czesc[C].Nuta[N].Dlugosc := Nuta[Nu].Len; + Czesc.Czesc[C].Nuta[N].Ton := Nuta[Nu].Tone; + Czesc.Czesc[C].Nuta[N].Tekst := Nuta[Nu].Lyric; + //All Notes are Freestyle when Converted Fix: + Czesc.Czesc[C].Nuta[N].Wartosc := 1; + Inc(N); + end; +end; + +function TScreenEditConvert.SelectedNumber: integer; +var + T: integer; // track +begin + Result := 0; + for T := 0 to High(ATrack) do +// if ATrack[T].Hear then Inc(Result); + if ((ATrack[T].Status div 1) and 1) = 1 then Inc(Result); +end; + +procedure TScreenEditConvert.MidiFile1MidiEvent(event: PMidiEvent); +begin +// Log.LogStatus(IntToStr(event.event), 'MIDI'); + MidiOut.PutShort(event.event, event.data1, event.data2); +end; + +constructor TScreenEditConvert.Create(Back: String); +var + P: integer; +begin + inherited Create(Back); + AddButton(40, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(15, 5, 0, 0, 0, 'Open'); +// Button[High(Button)].Text[0].Size := 11; + + AddButton(160, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(25, 5, 0, 0, 0, 'Play'); + + AddButton(280, 20, 200, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(25, 5, 0, 0, 0, 'Play Selected'); + + AddButton(500, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(20, 5, 0, 0, 0, 'Save'); + + +{ MidiOut := TMidiOutput.Create(nil); +// MidiOut.Close; +// MidiOut.DeviceID := 0; + if Ini.Debug = 1 then + MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table + Log.LogStatus(MidiOut.ProductName, 'MIDI'); + MidiOut.Open; +// MidiOut.SetVolume(100, 100); // temporary} + + FileName := GamePath + 'file.mid'; + MidiFile := TMidiFile.Create(nil); + + for P := 0 to 100 do begin + ColR[P] := Random(10)/10; + ColG[P] := Random(10)/10; + ColB[P] := Random(10)/10; + end; + +end; + +procedure TScreenEditConvert.onShow; +var + T: integer; // track + N: integer; // note + C: integer; // channel + CN: integer; // channel note +begin + MidiOut := TMidiOutput.Create(nil); + if Ini.Debug = 1 then + MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table + Log.LogStatus(MidiOut.ProductName, 'MIDI'); + MidiOut.Open; + + + if FileExists(FileName) then begin + MidiFile.Filename := FileName; + MidiFile.ReadFile; + + + Len := 0; + Sel := 0; + BPM := MidiFile.Bpm; + Ticks := MidiFile.TicksPerQuarter / 4; + +{ for T := 0 to MidiFile.NumberOfTracks-1 do begin + SetLength(Track, Length(Track)+1); + MidiTrack := MidiFile.GetTrack(T); + MidiTrack.OnMidiEvent := MidiFile1MidiEvent; + Track[T].Name := MidiTrack.getName; + + for N := 0 to MidiTrack.getEventCount-1 do begin + SetLength(Track[T].Note, Length(Track[T].Note)+1); + MidiEvent := MidiTrack.GetEvent(N); + Track[T].Note[N].Start := MidiEvent.time; + Track[T].Note[N].Len := MidiEvent.len; + Track[T].Note[N].Event := MidiEvent.event; + Track[T].Note[N].EventType := MidiEvent.event div 16; + Track[T].Note[N].Channel := MidiEvent.event and 15; + Track[T].Note[N].Data1 := MidiEvent.data1; + Track[T].Note[N].Data2 := MidiEvent.data2; + Track[T].Note[N].Str := MidiEvent.str; + + if Track[T].Note[N].Start + Track[T].Note[N].Len > Len then + Len := Track[T].Note[N].Start + Track[T].Note[N].Len; + end; + end;} + + + SetLength(Channel, 16); + for T := 0 to 15 do + Channel[T].Name := IntToStr(T+1); + + for T := 0 to MidiFile.NumberOfTracks-1 do begin + MidiTrack := MidiFile.GetTrack(T); + MidiTrack.OnMidiEvent := MidiFile1MidiEvent; + + for N := 0 to MidiTrack.getEventCount-1 do begin + MidiEvent := MidiTrack.GetEvent(N); + C := MidiEvent.event and 15; + + CN := Length(Channel[C].Note); + SetLength(Channel[C].Note, CN+1); + + Channel[C].Note[CN].Start := MidiEvent.time; + Channel[C].Note[CN].Len := MidiEvent.len; + Channel[C].Note[CN].Event := MidiEvent.event; + Channel[C].Note[CN].EventType := MidiEvent.event div 16; + Channel[C].Note[CN].Channel := MidiEvent.event and 15; + Channel[C].Note[CN].Data1 := MidiEvent.data1; + Channel[C].Note[CN].Data2 := MidiEvent.data2; + Channel[C].Note[CN].Str := MidiEvent.str; + + if Channel[C].Note[CN].Start + Channel[C].Note[CN].Len > Len then + Len := Channel[C].Note[CN].Start + Channel[C].Note[CN].Len; + end; + end; + ATrack := Channel; + + end; + + Interaction := 0; +end; + +function TScreenEditConvert.Draw: boolean; +var + Pet: integer; + Pet2: integer; + Bottom: real; + X: real; + Y: real; + H: real; + YSkip: real; +begin + // draw static menu + inherited Draw; + + Y := 100; + + H := Length(ATrack)*40; + if H > 480 then H := 480; + Bottom := Y + H; + + YSkip := H / Length(ATrack); + + // select + DrawQuad(10, Y+Sel*YSkip, 780, YSkip, 0.8, 0.8, 0.8); + + // selected - now me use Status System + for Pet := 0 to High(ATrack) do + if ATrack[Pet].Hear then + DrawQuad(10, Y+Pet*YSkip, 50, YSkip, 0.8, 0.3, 0.3); + glColor3f(0, 0, 0); + for Pet := 0 to High(ATrack) do begin + if ((ATrack[Pet].Status div 1) and 1) = 1 then begin + SetFontPos(25, Y + Pet*YSkip + 10); + SetFontSize(5); + glPrint('N'); + end; + if ((ATrack[Pet].Status div 2) and 1) = 1 then begin + SetFontPos(40, Y + Pet*YSkip + 10); + SetFontSize(5); + glPrint('L'); + end; + end; + + DrawLine(10, Y, 10, Bottom, 0, 0, 0); + DrawLine(60, Y, 60, Bottom, 0, 0, 0); + DrawLine(790, Y, 790, Bottom, 0, 0, 0); + + for Pet := 0 to Length(ATrack) do + DrawLine(10, Y+Pet*YSkip, 790, Y+Pet*YSkip, 0, 0, 0); + + for Pet := 0 to High(ATrack) do begin + SetFontPos(11, Y + 10 + Pet*YSkip); + SetFontSize(5); + glPrint(pchar(ATrack[Pet].Name)); + end; + + for Pet := 0 to High(ATrack) do + for Pet2 := 0 to High(ATrack[Pet].Note) do begin + if ATrack[Pet].Note[Pet2].EventType = 9 then + DrawQuad(60 + ATrack[Pet].Note[Pet2].Start/Len * 725, Y + (Pet+1)*YSkip - ATrack[Pet].Note[Pet2].Data1*35/127, 3, 3, ColR[Pet], ColG[Pet], ColB[Pet]); + if ATrack[Pet].Note[Pet2].EventType = 15 then + DrawLine(60 + ATrack[Pet].Note[Pet2].Start/Len * 725, Y + 0.75 * YSkip + Pet*YSkip, 60 + ATrack[Pet].Note[Pet2].Start/Len * 725, Y + YSkip + Pet*YSkip, ColR[Pet], ColG[Pet], ColB[Pet]); + end; + + // playing line + X := 60+MidiFile.GetCurrentTime/MidiFile.GetTrackLength*730; + DrawLine(X, Y, X, Bottom, 0.3, 0.3, 0.3); + + +end; + +procedure TScreenEditConvert.onHide; +begin + MidiOut.Close; + MidiOut.Free; +end; + +end. diff --git a/Game/Code/Screens/UScreenEditHeader.dcu b/Game/Code/Screens/UScreenEditHeader.dcu new file mode 100644 index 00000000..9508e841 Binary files /dev/null and b/Game/Code/Screens/UScreenEditHeader.dcu differ diff --git a/Game/Code/Screens/UScreenEditHeader.pas b/Game/Code/Screens/UScreenEditHeader.pas new file mode 100644 index 00000000..65f39e44 --- /dev/null +++ b/Game/Code/Screens/UScreenEditHeader.pas @@ -0,0 +1,362 @@ +unit UScreenEditHeader; + +interface + +uses UMenu, SDL, USongs, UThemes; + +type + TScreenEditHeader = class(TMenu) + public + AktSong: TSong; + TextTitle: integer; + TextArtist: integer; + TextMp3: integer; + TextBackground: integer; + TextVideo: integer; + TextVideoGAP: integer; + TextRelative: integer; + TextResolution: integer; + TextNotesGAP: integer; + TextStart: integer; + TextGAP: integer; + TextBPM: integer; + StaticTitle: integer; + StaticArtist: integer; + StaticMp3: integer; + StaticBackground: integer; + StaticVideo: integer; + StaticVideoGAP: integer; + StaticRelative: integer; + StaticResolution: integer; + StaticNotesGAP: integer; + StaticStart: integer; + StaticGAP: integer; + StaticBPM: integer; + Sel: array[0..11] of boolean; + procedure SetRoundButtons; + + constructor Create(Back: String); override; + procedure onShow; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; +{ function Draw: boolean; override; + procedure Finish;} + end; + +implementation + +uses UGraphic, UMusic, SysUtils, UPliki, USkins; + +function TScreenEditHeader.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var + T: integer; +begin + Result := true; + If (PressedDown) Then begin // Key Down + case PressedKey of + SDLK_ESCAPE : + begin +// Music.PlayBack; +// FadeTo(@MainScreen); + Result := false; + end; + + SDLK_RETURN: + begin + if Interaction = 1 then begin +// Save; + end; + end; + + SDLK_RIGHT: + begin + case Interaction of + 0..0: InteractNext; + 1: Interaction := 0; + end; + end; + + SDLK_LEFT: + begin + case Interaction of + 0: Interaction := 1; + 1..1: InteractPrev; + end; + end; + + SDLK_DOWN: + begin + case Interaction of + 0..1: Interaction := 2; + 2..12: InteractNext; + 13: Interaction := 0; + end; + end; + + SDLK_UP: + begin + case Interaction of + 0..1: Interaction := 13; + 2: Interaction := 0; + 3..13: InteractPrev; + end; + end; + + SDLK_BACKSPACE: + begin + T := Interaction - 2 + TextTitle; + if (Interaction >= 2) and (Interaction <= 13) and (Length(Text[T].Text) >= 1) then begin + Delete(Text[T].Text, Length(Text[T].Text), 1); + SetRoundButtons; + end; + end; + + end; + case ScanCode of + 32..255: + begin + if (Interaction >= 2) and (Interaction <= 13) then begin + Text[Interaction - 2 + TextTitle].Text := + Text[Interaction - 2 + TextTitle].Text + chr(ScanCode); + SetRoundButtons; + end; + end; + end; + end; +end; + +constructor TScreenEditHeader.Create(Back: String); +begin + inherited Create(Back); + + AddButton(40, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(15, 5, 'Open'); + + AddButton(160, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(20, 5, 'Save'); + + AddBox(80, 60, 640, 550); + + AddText(160, 110 + 0*30, 0, 10, 0, 0, 0, 'Title:'); + AddText(160, 110 + 1*30, 0, 10, 0, 0, 0, 'Artist:'); + AddText(160, 110 + 2*30, 0, 10, 0, 0, 0, 'MP3:'); + + AddText(160, 110 + 4*30, 0, 10, 0, 0, 0, 'Background:'); + AddText(160, 110 + 5*30, 0, 10, 0, 0, 0, 'Video:'); + AddText(160, 110 + 6*30, 0, 10, 0, 0, 0, 'VideoGAP:'); + + AddText(160, 110 + 8*30, 0, 10, 0, 0, 0, 'Relative:'); + AddText(160, 110 + 9*30, 0, 10, 0, 0, 0, 'Resolution:'); + AddText(160, 110 + 10*30, 0, 10, 0, 0, 0, 'NotesGAP:'); + + AddText(160, 110 + 12*30, 0, 10, 0, 0, 0, 'Start:'); + AddText(160, 110 + 13*30, 0, 10, 0, 0, 0, 'GAP:'); + AddText(160, 110 + 14*30, 0, 10, 0, 0, 0, 'BPM:'); + + TextTitle := AddText(340, 110 + 0*30, 0, 10, 0, 0, 0, ''); + TextArtist := AddText(340, 110 + 1*30, 0, 10, 0, 0, 0, ''); + TextMp3 := AddText(340, 110 + 2*30, 0, 10, 0, 0, 0, ''); + + TextBackground := AddText(340, 110 + 4*30, 0, 10, 0, 0, 0, ''); + TextVideo := AddText(340, 110 + 5*30, 0, 10, 0, 0, 0, ''); + TextVideoGAP := AddText(340, 110 + 6*30, 0, 10, 0, 0, 0, ''); + + TextRelative := AddText(340, 110 + 8*30, 0, 10, 0, 0, 0, ''); + TextResolution := AddText(340, 110 + 9*30, 0, 10, 0, 0, 0, ''); + TextNotesGAP := AddText(340, 110 + 10*30, 0, 10, 0, 0, 0, ''); + + TextStart := AddText(340, 110 + 12*30, 0, 10, 0, 0, 0, ''); + TextGAP := AddText(340, 110 + 13*30, 0, 10, 0, 0, 0, ''); + TextBPM := AddText(340, 110 + 14*30, 0, 10, 0, 0, 0, ''); + + StaticTitle := AddStatic(130, 115 + 0*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticArtist := AddStatic(130, 115 + 1*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticMp3 := AddStatic(130, 115 + 2*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticBackground := AddStatic(130, 115 + 4*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticVideo := AddStatic(130, 115 + 5*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticVideoGAP := AddStatic(130, 115 + 6*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticRelative := AddStatic(130, 115 + 8*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticResolution := AddStatic(130, 115 + 9*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticNotesGAP := AddStatic(130, 115 + 10*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticStart := AddStatic(130, 115 + 12*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticGAP := AddStatic(130, 115 + 13*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticBPM := AddStatic(130, 115 + 14*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + + AddInteraction(iText, TextTitle); + AddInteraction(iText, TextArtist); + AddInteraction(iText, TextMp3); + AddInteraction(iText, TextBackground); + AddInteraction(iText, TextVideo); + AddInteraction(iText, TextVideoGAP); + AddInteraction(iText, TextRelative); + AddInteraction(iText, TextResolution); + AddInteraction(iText, TextNotesGAP); + AddInteraction(iText, TextStart); + AddInteraction(iText, TextGAP); + AddInteraction(iText, TextBPM); +end; + +procedure TScreenEditHeader.onShow; +begin +{ if FileExists(FileName) then begin // load file + AktSong.FileName := FileName; + SkanujPlik(AktSong); + + SetLength(TrueBoolStrs, 1); + TrueBoolStrs[0] := 'yes'; + SetLength(FalseBoolStrs, 1); + FalseBoolStrs[0] := 'no'; + + Text[TextTitle].Text := AktSong.Title; + Text[TextArtist].Text := AktSong.Artist; + Text[TextMP3].Text := AktSong.Mp3; + Text[TextBackground].Text := AktSong.Background; + Text[TextVideo].Text := AktSong.Video; + Text[TextVideoGAP].Text := FloatToStr(AktSong.VideoGAP); + Text[TextRelative].Text := BoolToStr(AktSong.Relative, true); + Text[TextResolution].Text := IntToStr(AktSong.Resolution); + Text[TextNotesGAP].Text := IntToStr(AktSong.NotesGAP); + Text[TextStart].Text := FloatToStr(AktSong.Start); + Text[TextGAP].Text := FloatToStr(AktSong.GAP); + Text[TextBPM].Text := FloatToStr(AktSong.BPM[0].BPM); + SetRoundButtons; + end;} + + Interaction := 0; +end; + +(*function TScreenEdit.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + Pet: integer; + AktBeat: integer; +begin +{ glClearColor(1,1,1,1); + + // control music + if PlaySentence then begin + // stop the music + if (Music.Position > PlayStopTime) then begin + Music.Stop; + PlaySentence := false; + end; + + // click + if (Click) and (PlaySentence) then begin + AktBeat := Floor(AktSong.BPM[0].BPM * (Music.Position - AktSong.GAP / 1000) / 60); + Text[TextDebug].Text := IntToStr(AktBeat); + if AktBeat <> LastClick then begin + for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then begin + Music.PlayClick; + LastClick := AktBeat; + end; + end; + end; // click + end; // if PlaySentence + + Text[TextSentence].Text := IntToStr(Czesci[0].Akt + 1) + ' / ' + IntToStr(Czesci[0].Ilosc); + Text[TextNote].Text := IntToStr(AktNuta + 1) + ' / ' + IntToStr(Czesci[0].Czesc[Czesci[0].Akt].IlNut); + + // Song info + Text[TextBPM].Text := FloatToStr(AktSong.BPM[0].BPM / 4); + Text[TextGAP].Text := FloatToStr(AktSong.GAP); + + // Note info + Text[TextNStart].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start); + Text[TextNDlugosc].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); + Text[TextNTon].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton); + Text[TextNText].Text := Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst; + + // draw static menu + inherited Draw; + + // draw notes + SingDrawNoteLines(20, 300, 780, 15); + SingDrawBeatDelimeters(40, 300, 760, 0); + SingDrawCzesc(40, 405, 760, 0); + + // draw text + Lyric.Draw;} + +end;*) + +procedure TScreenEditHeader.SetRoundButtons; +begin + if Length(Text[TextTitle].Text) > 0 then Static[StaticTitle].Visible := true + else Static[StaticTitle].Visible := false; + + if Length(Text[TextArtist].Text) > 0 then Static[StaticArtist].Visible := true + else Static[StaticArtist].Visible := false; + + if Length(Text[TextMp3].Text) > 0 then Static[StaticMp3].Visible := true + else Static[StaticMp3].Visible := false; + + if Length(Text[TextBackground].Text) > 0 then Static[StaticBackground].Visible := true + else Static[StaticBackground].Visible := false; + + if Length(Text[TextVideo].Text) > 0 then Static[StaticVideo].Visible := true + else Static[StaticVideo].Visible := false; + + try + StrToFloat(Text[TextVideoGAP].Text); + if StrToFloat(Text[TextVideoGAP].Text)<> 0 then Static[StaticVideoGAP].Visible := true + else Static[StaticVideoGAP].Visible := false; + except + Static[StaticVideoGAP].Visible := false; + end; + + if LowerCase(Text[TextRelative].Text) = 'yes' then Static[StaticRelative].Visible := true + else Static[StaticRelative].Visible := false; + + try + StrToInt(Text[TextResolution].Text); + if (StrToInt(Text[TextResolution].Text) <> 0) and (StrToInt(Text[TextResolution].Text) >= 1) + then Static[StaticResolution].Visible := true + else Static[StaticResolution].Visible := false; + except + Static[StaticResolution].Visible := false; + end; + + try + StrToInt(Text[TextNotesGAP].Text); + Static[StaticNotesGAP].Visible := true; + except + Static[StaticNotesGAP].Visible := false; + end; + + // start + try + StrToFloat(Text[TextStart].Text); + if (StrToFloat(Text[TextStart].Text) > 0) then Static[StaticStart].Visible := true + else Static[StaticStart].Visible := false; + except + Static[StaticStart].Visible := false; + end; + + // GAP + try + StrToFloat(Text[TextGAP].Text); + Static[StaticGAP].Visible := true; + except + Static[StaticGAP].Visible := false; + end; + + // BPM + try + StrToFloat(Text[TextBPM].Text); + if (StrToFloat(Text[TextBPM].Text) > 0) then Static[StaticBPM].Visible := true + else Static[StaticBPM].Visible := false; + except + Static[StaticBPM].Visible := false; + end; + +end; + +(*procedure TScreenEdit.Finish; +begin +// +end;*) + +end. diff --git a/Game/Code/Screens/UScreenEditSub.dcu b/Game/Code/Screens/UScreenEditSub.dcu new file mode 100644 index 00000000..6b6b6e35 Binary files /dev/null and b/Game/Code/Screens/UScreenEditSub.dcu differ diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas new file mode 100644 index 00000000..7bdbac0d --- /dev/null +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -0,0 +1,1236 @@ +unit UScreenEditSub; + +interface + +uses UMenu, UMusic, SDL, SysUtils, UPliki, UTime, USongs, UIni, ULog, USmpeg, UTexture, UMenuText, + ULyrics, Math, OpenGL12, UThemes, MidiOut; + +type + TScreenEditSub = class(TMenu) + private + TextNote: integer; + TextSentence: integer; + TextTitle: integer; + TextArtist: integer; + TextMp3: integer; + TextBPM: integer; + TextGAP: integer; + TextDebug: integer; + TextNStart: integer; + TextNDlugosc: integer; + TextNTon: integer; + TextNText: integer; + AktNuta: integer; + PlaySentence: boolean; + PlaySentenceMidi: boolean; + PlayStopTime: real; + LastClick: integer; + Click: boolean; + CopySrc: integer; + + MidiOut: TMidiOutput; + MidiStart: real; + MidiStop: real; + MidiTime: real; + MidiPos: real; + MidiLastNote: integer; + + TextEditMode: boolean; + + procedure NewBeat; + procedure CzesciDivide; + procedure CzesciMultiply; + procedure LyricsCapitalize; + procedure LyricsCorrectSpaces; + procedure FixTimings; + procedure DivideSentence; + procedure JoinSentence; + procedure DivideNote; + procedure DeleteNote; + procedure TransposeNote(Transpose: integer); + procedure ChangeWholeTone(Tone: integer); + procedure MoveAllToEnd(Move: integer); + procedure MoveTextToRight; + procedure MarkSrc; + procedure PasteText; + procedure CopySentence(Src, Dst: integer); + procedure CopySentences(Src, Dst, Num: integer); + public + Tex_Background: TTexture; + FadeOut: boolean; + Path: string; + FileName: string; + constructor Create(Back: String); override; + procedure onShow; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function ParseInputEditText(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; + function Draw: boolean; override; + procedure onHide; override; + end; + +implementation +uses UGraphic, UDraw, UMain, USkins; + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenEditSub.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var + SDL_ModState: Word; + R: real; +begin + Result := true; + + if TextEditMode then begin + Result := ParseInputEditText(PressedKey, ScanCode, PressedDown); + end else begin + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT {+ KMOD_CAPS}); + + If (PressedDown) then begin // Key Down + case PressedKey of + SDLK_ESCAPE: + begin + FadeTo(@ScreenSong); + end; + + SDLK_Q: + begin + Result := false; + end; + + SDLK_BACKQUOTE: + begin + // Increase Note Length (same as Alt + Right) + Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); + if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then + Inc(Czesci[0].Czesc[Czesci[0].Akt].Koniec); + end; + + SDLK_EQUALS: + begin + // Increase BPM + if SDL_ModState = 0 then + AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 5) + 1) / 5; // (1/20) + if SDL_ModState = KMOD_LSHIFT then + AktSong.BPM[0].BPM := AktSong.BPM[0].BPM + 4; // (1/1) + if SDL_ModState = KMOD_LCTRL then + AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 25) + 1) / 25; // (1/100) + end; + + SDLK_MINUS: + begin + // Decrease BPM + if SDL_ModState = 0 then + AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 5) - 1) / 5; + if SDL_ModState = KMOD_LSHIFT then + AktSong.BPM[0].BPM := AktSong.BPM[0].BPM - 4; + if SDL_ModState = KMOD_LCTRL then + AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 25) - 1) / 25; + end; + + SDLK_0: + begin + // Increase GAP + if SDL_ModState = 0 then + AktSong.GAP := AktSong.GAP + 10; + if SDL_ModState = KMOD_LSHIFT then + AktSong.GAP := AktSong.GAP + 1000; + end; + + SDLK_9: + begin + // Decrease GAP + if SDL_ModState = 0 then + AktSong.GAP := AktSong.GAP - 10; + if SDL_ModState = KMOD_LSHIFT then + AktSong.GAP := AktSong.GAP - 1000; + end; + + SDLK_KP_PLUS: + begin + // Increase tone of all notes + if SDL_ModState = 0 then + ChangeWholeTone(1); + if SDL_ModState = KMOD_LSHIFT then + ChangeWholeTone(12); + end; + + SDLK_KP_MINUS: + begin + // Decrease tone of all notes + if SDL_ModState = 0 then + ChangeWholeTone(-1); + if SDL_ModState = KMOD_LSHIFT then + ChangeWholeTone(-12); + end; + + SDLK_SLASH: + begin + if SDL_ModState = 0 then begin + // Insert start of sentece + if AktNuta > 0 then + DivideSentence; + end; + + if SDL_ModState = KMOD_LSHIFT then begin + // Join next sentence with current + if Czesci[0].Akt < Czesci[0].High then + JoinSentence; + end; + + if SDL_ModState = KMOD_LCTRL then begin + // divide note + DivideNote; + end; + + end; + + SDLK_S: + begin + if SDL_ModState = 0 then + // Save Song + SaveSong(AktSong, Czesci[0], Path + FileName, false); + + if SDL_ModState = KMOD_LSHIFT then + // Save Song + SaveSong(AktSong, Czesci[0], Path + FileName, true); + + if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL + KMOD_LALT then + // Save Song + SaveSongDebug(AktSong, Czesci[0], 'C:\song.asm', false); + + end; + + SDLK_D: + begin + // Divide lengths by 2 + CzesciDivide; + end; + + SDLK_M: + begin + // Multiply lengths by 2 + CzesciMultiply; + end; + + SDLK_C: + begin + // Capitalize letter at the beginning of line + if SDL_ModState = 0 then + LyricsCapitalize; + + // Correct spaces + if SDL_ModState = KMOD_LSHIFT then + LyricsCorrectSpaces; + + // Copy sentence + if SDL_ModState = KMOD_LCTRL then + MarkSrc; + end; + + SDLK_V: + begin + // Paste text + if SDL_ModState = KMOD_LCTRL then begin + if Czesci[0].Czesc[Czesci[0].Akt].IlNut >= Czesci[0].Czesc[CopySrc].IlNut then + PasteText + else + beep; + end; + + if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then begin + CopySentence(CopySrc, Czesci[0].Akt); + end; + end; + + SDLK_4: + begin + if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then begin + CopySentence(CopySrc, Czesci[0].Akt); + CopySentence(CopySrc+1, Czesci[0].Akt+1); + CopySentence(CopySrc+2, Czesci[0].Akt+2); + CopySentence(CopySrc+3, Czesci[0].Akt+3); + end; + + if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT + KMOD_LALT then begin + CopySentences(CopySrc, Czesci[0].Akt, 4); + end; + end; + SDLK_5: + begin + if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then begin + CopySentence(CopySrc, Czesci[0].Akt); + CopySentence(CopySrc+1, Czesci[0].Akt+1); + CopySentence(CopySrc+2, Czesci[0].Akt+2); + CopySentence(CopySrc+3, Czesci[0].Akt+3); + CopySentence(CopySrc+4, Czesci[0].Akt+4); + end; + + if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT + KMOD_LALT then begin + CopySentences(CopySrc, Czesci[0].Akt, 5); + end; + end; + + SDLK_T: + begin + // Fixes timings between sentences + FixTimings; + end; + + SDLK_F4: + begin + // Enter Text Edit Mode + TextEditMode := true; + end; + + SDLK_P: + begin + if SDL_ModState = 0 then begin + // Play Sentence + Click := true; + Music.Stop; + R := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote); + if R <= Music.Length then begin + Music.MoveTo(R); + PlayStopTime := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec); + PlaySentence := true; + Music.Play; + LastClick := -100; + end; + end; + + if SDL_ModState = KMOD_LSHIFT then begin + PlaySentenceMidi := true; + + MidiTime := USTime.GetTime; + MidiStart := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote); + MidiStop := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec); + + LastClick := -100; + end; + if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL then begin + PlaySentenceMidi := true; + MidiTime := USTime.GetTime; + MidiStart := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote); + MidiStop := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec); + LastClick := -100; + + PlaySentence := true; + Click := true; + Music.Stop; + Music.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote)+0{-0.10}); + PlayStopTime := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec)+0; + Music.Play; + LastClick := -100; + end; + end; + + SDLK_SPACE: + begin + // Play Sentence + PlaySentenceMidi := false; // stop midi + PlaySentence := true; + Click := false; + Music.Stop; + Music.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start)); + PlayStopTime := (GetTimeFromBeat( + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start + + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc)); + Music.Play; + LastClick := -100; + end; + + SDLK_RETURN: + begin + end; + + SDLK_LCTRL: + begin + end; + + SDLK_DELETE: + begin + if SDL_ModState = KMOD_LCTRL then begin + // moves text to right in current sentence + DeleteNote; + end; + end; + + SDLK_PERIOD: + begin + // moves text to right in current sentence + MoveTextToRight; + end; + + SDLK_RIGHT: + begin + // right + if SDL_ModState = 0 then begin + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0; + Inc(AktNuta); + if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].IlNut then AktNuta := 0; + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; + Lyric.Selected := AktNuta; + end; + + // ctrl + right + if SDL_ModState = KMOD_LCTRL then begin + if Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc > 1 then begin + Dec(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); + Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start); + if AktNuta = 0 then begin + Inc(Czesci[0].Czesc[Czesci[0].Akt].Start); + Inc(Czesci[0].Czesc[Czesci[0].Akt].StartNote); + end; + end; + end; + + // shift + right + if SDL_ModState = KMOD_LSHIFT then begin + Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start); + if AktNuta = 0 then begin + Inc(Czesci[0].Czesc[Czesci[0].Akt].Start); + Inc(Czesci[0].Czesc[Czesci[0].Akt].StartNote); + end; + if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then + Inc(Czesci[0].Czesc[Czesci[0].Akt].Koniec); + end; + + // alt + right + if SDL_ModState = KMOD_LALT then begin + Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); + if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then + Inc(Czesci[0].Czesc[Czesci[0].Akt].Koniec); + end; + + // alt + ctrl + shift + right = move all from cursor to right + if SDL_ModState = KMOD_LALT + KMOD_LCTRL + KMOD_LSHIFT then begin + MoveAllToEnd(1); + end; + + end; + + SDLK_LEFT: + begin + // left + if SDL_ModState = 0 then begin + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0; + Dec(AktNuta); + if AktNuta = -1 then AktNuta := Czesci[0].Czesc[Czesci[0].Akt].HighNut; + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; + Lyric.Selected := AktNuta; + end; + + // ctrl + left + if SDL_ModState = KMOD_LCTRL then begin + Dec(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start); + Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); + if AktNuta = 0 then begin + Dec(Czesci[0].Czesc[Czesci[0].Akt].Start); + Dec(Czesci[0].Czesc[Czesci[0].Akt].StartNote); + end; + end; + + // shift + left + if SDL_ModState = KMOD_LSHIFT then begin + Dec(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start); + + // resizing sentences + if AktNuta = 0 then begin + Dec(Czesci[0].Czesc[Czesci[0].Akt].Start); + Dec(Czesci[0].Czesc[Czesci[0].Akt].StartNote); + end; + + if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then + Dec(Czesci[0].Czesc[Czesci[0].Akt].Koniec); + + end; + + // alt + left + if SDL_ModState = KMOD_LALT then begin + if Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc > 1 then begin + Dec(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); + if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then + Dec(Czesci[0].Czesc[Czesci[0].Akt].Koniec); + end; + end; + + // alt + ctrl + shift + right = move all from cursor to left + if SDL_ModState = KMOD_LALT + KMOD_LCTRL + KMOD_LSHIFT then begin + MoveAllToEnd(-1); + end; + + end; + + SDLK_DOWN: + begin + // skip to next sentence + if SDL_ModState = 0 then begin + MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127); + PlaySentenceMidi := false; + + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0; + Inc(Czesci[0].Akt); + AktNuta := 0; + if Czesci[0].Akt > Czesci[0].High then Czesci[0].Akt := 0; + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; + + Lyric.AddCzesc(Czesci[0].Akt); + Lyric.Selected := 0; + Music.Stop; + PlaySentence := false; + end; + + // decrease tone + if SDL_ModState = KMOD_LCTRL then begin + TransposeNote(-1); + end; + + end; + + SDLK_UP: + begin + // skip to previous sentence + if SDL_ModState = 0 then begin + MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127); + PlaySentenceMidi := false; + + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0; + Dec(Czesci[0].Akt); + AktNuta := 0; + if Czesci[0].Akt = -1 then Czesci[0].Akt := Czesci[0].High; + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; + + Lyric.AddCzesc(Czesci[0].Akt); + Lyric.Selected := 0; + Music.Stop; + PlaySentence := false; + end; + + // increase tone + if SDL_ModState = KMOD_LCTRL then begin + TransposeNote(1); + end; + end; + + // Golden Note Patch + SDLK_G: + begin + case Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc of + 0: Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 2; + 1: Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 2; + 2: Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 1; + end; // case + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Freestyle := False; + end; + + // Freestyle Note Patch + SDLK_F: + begin + case Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc of + 0: + begin; + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 1; + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Freestyle := False; + end; + 1,2: + begin; + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 0; + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Freestyle := True; + end; + end; // case + + end; + + + end; + end; + end; // if +end; + +function TScreenEditSub.ParseInputEditText(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var + SDL_ModState: Word; +begin + // used when in Text Edit Mode + Result := true; + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT {+ KMOD_CAPS}); + + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_ESCAPE: + begin + FadeTo(@ScreenSong); + end; + SDLK_F4, SDLK_RETURN: + begin + // Exit Text Edit Mode + TextEditMode := false; + end; + SDLK_0..SDLK_9, SDLK_A..SDLK_Z, SDLK_SPACE, SDLK_MINUS, SDLK_EXCLAIM, SDLK_COMMA, SDLK_SLASH, SDLK_ASTERISK, SDLK_QUESTION, SDLK_QUOTE, SDLK_QUOTEDBL: + begin + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst := + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst + chr(ScanCode); + end; + SDLK_BACKSPACE: + begin + Delete(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst, + Length(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst), 1); + end; + SDLK_RIGHT: + begin + // right + if SDL_ModState = 0 then begin + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0; + Inc(AktNuta); + if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].IlNut then AktNuta := 0; + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; + Lyric.Selected := AktNuta; + end; + end; + SDLK_LEFT: + begin + // left + if SDL_ModState = 0 then begin + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0; + Dec(AktNuta); + if AktNuta = -1 then AktNuta := Czesci[0].Czesc[Czesci[0].Akt].HighNut; + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; + Lyric.Selected := AktNuta; + end; + end; + end; + end; +end; + +procedure TScreenEditSub.NewBeat; +begin + // click +{ for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeat) then begin + // old} +// Music.PlayClick; +end; + +procedure TScreenEditSub.CzesciDivide; +var + C: integer; + N: integer; +begin + AktSong.BPM[0].BPM := AktSong.BPM[0].BPM / 2; + for C := 0 to Czesci[0].High do begin + Czesci[0].Czesc[C].Start := Czesci[0].Czesc[C].Start div 2; + Czesci[0].Czesc[C].StartNote := Czesci[0].Czesc[C].StartNote div 2; + Czesci[0].Czesc[C].Koniec := Czesci[0].Czesc[C].Koniec div 2; + for N := 0 to Czesci[0].Czesc[C].HighNut do begin + Czesci[0].Czesc[C].Nuta[N].Start := Czesci[0].Czesc[C].Nuta[N].Start div 2; + Czesci[0].Czesc[C].Nuta[N].Dlugosc := Round(Czesci[0].Czesc[C].Nuta[N].Dlugosc / 2); + end; // N + end; // C +end; + +procedure TScreenEditSub.CzesciMultiply; +var + C: integer; + N: integer; +begin + AktSong.BPM[0].BPM := AktSong.BPM[0].BPM * 2; + for C := 0 to Czesci[0].High do begin + Czesci[0].Czesc[C].Start := Czesci[0].Czesc[C].Start * 2; + Czesci[0].Czesc[C].StartNote := Czesci[0].Czesc[C].StartNote * 2; + Czesci[0].Czesc[C].Koniec := Czesci[0].Czesc[C].Koniec * 2; + for N := 0 to Czesci[0].Czesc[C].HighNut do begin + Czesci[0].Czesc[C].Nuta[N].Start := Czesci[0].Czesc[C].Nuta[N].Start * 2; + Czesci[0].Czesc[C].Nuta[N].Dlugosc := Czesci[0].Czesc[C].Nuta[N].Dlugosc * 2; + end; // N + end; // C +end; + +procedure TScreenEditSub.LyricsCapitalize; +var + C: integer; + N: integer; // temporary + S: string; +begin + // temporary +{ for C := 0 to Czesci[0].High do + for N := 0 to Czesci[0].Czesc[C].HighNut do + Czesci[0].Czesc[C].Nuta[N].Tekst := AnsiLowerCase(Czesci[0].Czesc[C].Nuta[N].Tekst);} + + for C := 0 to Czesci[0].High do begin + S := AnsiUpperCase(Copy(Czesci[0].Czesc[C].Nuta[0].Tekst, 1, 1)); + S := S + Copy(Czesci[0].Czesc[C].Nuta[0].Tekst, 2, Length(Czesci[0].Czesc[C].Nuta[0].Tekst)-1); + Czesci[0].Czesc[C].Nuta[0].Tekst := S; + end; // C +end; + +procedure TScreenEditSub.LyricsCorrectSpaces; +var + C: integer; + N: integer; +begin + for C := 0 to Czesci[0].High do begin + // correct starting spaces in the first word + while Copy(Czesci[0].Czesc[C].Nuta[0].Tekst, 1, 1) = ' ' do + Czesci[0].Czesc[C].Nuta[0].Tekst := Copy(Czesci[0].Czesc[C].Nuta[0].Tekst, 2, 100); + + // move spaces on the start to the end of the previous note + for N := 1 to Czesci[0].Czesc[C].HighNut do begin + while (Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, 1, 1) = ' ') do begin + Czesci[0].Czesc[C].Nuta[N].Tekst := Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, 2, 100); + Czesci[0].Czesc[C].Nuta[N-1].Tekst := Czesci[0].Czesc[C].Nuta[N-1].Tekst + ' '; + end; + end; // N + + // correct '-' to '- ' + for N := 0 to Czesci[0].Czesc[C].HighNut do begin + if Czesci[0].Czesc[C].Nuta[N].Tekst = '-' then + Czesci[0].Czesc[C].Nuta[N].Tekst := '- '; + end; // N + + // add space to the previous note when the current word is '- ' + for N := 1 to Czesci[0].Czesc[C].HighNut do begin + if Czesci[0].Czesc[C].Nuta[N].Tekst = '- ' then + Czesci[0].Czesc[C].Nuta[N-1].Tekst := Czesci[0].Czesc[C].Nuta[N-1].Tekst + ' '; + end; // N + + // correct too many spaces at the end of note + for N := 0 to Czesci[0].Czesc[C].HighNut do begin + while Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, Length(Czesci[0].Czesc[C].Nuta[N].Tekst)-1, 2) = ' ' do + Czesci[0].Czesc[C].Nuta[N].Tekst := Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, 1, Length(Czesci[0].Czesc[C].Nuta[N].Tekst)-1); + end; // N + + // and correct if there is no space at the end of sentence + N := Czesci[0].Czesc[C].HighNut; + if Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, Length(Czesci[0].Czesc[C].Nuta[N].Tekst), 1) <> ' ' then + Czesci[0].Czesc[C].Nuta[N].Tekst := Czesci[0].Czesc[C].Nuta[N].Tekst + ' '; + + end; // C +end; + +procedure TScreenEditSub.FixTimings; +var + C: integer; + S: integer; + Min: integer; + Max: integer; +begin + for C := 1 to Czesci[0].High do begin + with Czesci[0].Czesc[C-1] do begin + Min := Nuta[HighNut].Start + Nuta[HighNut].Dlugosc; + Max := Czesci[0].Czesc[C].StartNote; + case (Max - Min) of + 0: S := Max; + 1: S := Max; + 2: S := Max - 1; + 3..3: S := Max - 2; + 4..10000: S := Min + 2; // poczatek + 2 + end; // case + + Czesci[0].Czesc[C].Start := S; + end; // with + end; // for +end; + +procedure TScreenEditSub.DivideSentence; +var + C: integer; + CStart: integer; + CNew: integer; + CLen: integer; + N: integer; + NStart: integer; + NHigh: integer; + NNewL: integer; +begin + // increase sentence length by 1 + CLen := Length(Czesci[0].Czesc); + SetLength(Czesci[0].Czesc, CLen + 1); + Inc(Czesci[0].Ilosc); + Inc(Czesci[0].High); + + // move needed sentences to one forward. newly has the copy of divided sentence + CStart := Czesci[0].Akt; + for C := CLen-1 downto CStart do + Czesci[0].Czesc[C+1] := Czesci[0].Czesc[C]; + + // clear and set new sentence + CNew := CStart + 1; + NStart := AktNuta; + Czesci[0].Czesc[CNew].Start := Czesci[0].Czesc[CStart].Nuta[NStart].Start; + Czesci[0].Czesc[CNew].StartNote := Czesci[0].Czesc[CStart].Nuta[NStart].Start; + Czesci[0].Czesc[CNew].Lyric := ''; + Czesci[0].Czesc[CNew].LyricWidth := 0; + Czesci[0].Czesc[CNew].Koniec := 0; + Czesci[0].Czesc[CNew].BaseNote := 0; // 0.5.0: we modify it later in this procedure + Czesci[0].Czesc[CNew].IlNut := 0; + Czesci[0].Czesc[CNew].HighNut := -1; + SetLength(Czesci[0].Czesc[CNew].Nuta, 0); + + // move right notes to new sentences + NHigh := Czesci[0].Czesc[CStart].HighNut; + for N := NStart to NHigh do begin + NNewL := Czesci[0].Czesc[CNew].IlNut; + SetLength(Czesci[0].Czesc[CNew].Nuta, NNewL + 1); + Czesci[0].Czesc[CNew].Nuta[NNewL] := Czesci[0].Czesc[CStart].Nuta[N]; + + // increase sentence counters + Inc(Czesci[0].Czesc[CNew].IlNut); + Inc(Czesci[0].Czesc[CNew].HighNut); + Czesci[0].Czesc[CNew].Koniec := Czesci[0].Czesc[CNew].Nuta[NNewL].Start + + Czesci[0].Czesc[CNew].Nuta[NNewL].Dlugosc; + end; + + // clear old notes and set sentence counters + Czesci[0].Czesc[CStart].HighNut := NStart - 1; + Czesci[0].Czesc[CStart].IlNut := Czesci[0].Czesc[CStart].HighNut + 1; + Czesci[0].Czesc[CStart].Koniec := Czesci[0].Czesc[CStart].Nuta[NStart-1].Start + + Czesci[0].Czesc[CStart].Nuta[NStart-1].Dlugosc; + SetLength(Czesci[0].Czesc[CStart].Nuta, Czesci[0].Czesc[CStart].IlNut); + + // 0.5.0: modify BaseNote + Czesci[0].Czesc[CNew].BaseNote := 120; + for N := 0 to Czesci[0].Czesc[CNew].IlNut do + if Czesci[0].Czesc[CNew].Nuta[N].Ton < Czesci[0].Czesc[CNew].BaseNote then + Czesci[0].Czesc[CNew].BaseNote := Czesci[0].Czesc[CNew].Nuta[N].Ton; + + Czesci[0].Akt := Czesci[0].Akt + 1; + AktNuta := 0; + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; + Lyric.AddCzesc(Czesci[0].Akt); + +end; + +procedure TScreenEditSub.JoinSentence; +var + C: integer; + N: integer; + NStart: integer; + NDst: integer; +begin + C := Czesci[0].Akt; + + // set new sentence + NStart := Czesci[0].Czesc[C].IlNut; + Czesci[0].Czesc[C].IlNut := Czesci[0].Czesc[C].IlNut + Czesci[0].Czesc[C+1].IlNut; + Czesci[0].Czesc[C].HighNut := Czesci[0].Czesc[C].HighNut + Czesci[0].Czesc[C+1].IlNut; + SetLength(Czesci[0].Czesc[C].Nuta, Czesci[0].Czesc[C].IlNut); + + // move right notes to new sentences + for N := 0 to Czesci[0].Czesc[C+1].HighNut do begin + NDst := NStart + N; + Czesci[0].Czesc[C].Nuta[NDst] := Czesci[0].Czesc[C+1].Nuta[N]; + end; + + // increase sentence counters + NDst := Czesci[0].Czesc[C].HighNut; + Czesci[0].Czesc[C].Koniec := Czesci[0].Czesc[C].Nuta[NDst].Start + + Czesci[0].Czesc[C].Nuta[NDst].Dlugosc; + + // move needed sentences to one backward. + for C := Czesci[0].Akt + 1 to Czesci[0].High - 1 do + Czesci[0].Czesc[C] := Czesci[0].Czesc[C+1]; + + // increase sentence length by 1 + SetLength(Czesci[0].Czesc, Length(Czesci[0].Czesc) - 1); + Dec(Czesci[0].Ilosc); + Dec(Czesci[0].High); +end; + +procedure TScreenEditSub.DivideNote; +var + C: integer; + N: integer; + NLen: integer; +begin + C := Czesci[0].Akt; + + NLen := Czesci[0].Czesc[C].IlNut + 1; + SetLength(Czesci[0].Czesc[C].Nuta, NLen); + Inc(Czesci[0].Czesc[C].HighNut); + Inc(Czesci[0].Czesc[C].IlNut); + + // we copy all notes including selected one + for N := Czesci[0].Czesc[C].HighNut downto AktNuta+1 do begin + Czesci[0].Czesc[C].Nuta[N] := Czesci[0].Czesc[C].Nuta[N-1]; + end; + + // me slightly modify new note + Czesci[0].Czesc[C].Nuta[AktNuta].Dlugosc := 1; + Inc(Czesci[0].Czesc[C].Nuta[AktNuta+1].Start); + Dec(Czesci[0].Czesc[C].Nuta[AktNuta+1].Dlugosc); + Czesci[0].Czesc[C].Nuta[AktNuta+1].Tekst := '- '; + Czesci[0].Czesc[C].Nuta[AktNuta+1].Color := 0; +end; + +procedure TScreenEditSub.DeleteNote; +var + C: integer; + N: integer; + NLen: integer; +begin + C := Czesci[0].Akt; + + // we copy all notes from the next to the selected one + for N := AktNuta+1 to Czesci[0].Czesc[C].HighNut do begin + Czesci[0].Czesc[C].Nuta[N-1] := Czesci[0].Czesc[C].Nuta[N]; + end; + + NLen := Czesci[0].Czesc[C].IlNut - 1; + SetLength(Czesci[0].Czesc[C].Nuta, NLen); + Dec(Czesci[0].Czesc[C].HighNut); + Dec(Czesci[0].Czesc[C].IlNut); + + + // me slightly modify new note + if AktNuta > Czesci[0].Czesc[C].HighNut then Dec(AktNuta); + Czesci[0].Czesc[C].Nuta[AktNuta].Color := 1; +end; + +procedure TScreenEditSub.TransposeNote(Transpose: integer); +begin + Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton, Transpose); +end; + +procedure TScreenEditSub.ChangeWholeTone(Tone: integer); +var + C: integer; + N: integer; +begin + for C := 0 to Czesci[0].High do begin + Czesci[0].Czesc[C].BaseNote := Czesci[0].Czesc[C].BaseNote + Tone; + for N := 0 to Czesci[0].Czesc[C].HighNut do + Czesci[0].Czesc[C].Nuta[N].Ton := Czesci[0].Czesc[C].Nuta[N].Ton + Tone; + end; +end; + +procedure TScreenEditSub.MoveAllToEnd(Move: integer); +var + C: integer; + N: integer; + NStart: integer; +begin + for C := Czesci[0].Akt to Czesci[0].High do begin + NStart := 0; + if C = Czesci[0].Akt then NStart := AktNuta; + for N := NStart to Czesci[0].Czesc[C].HighNut do begin + Inc(Czesci[0].Czesc[C].Nuta[N].Start, Move); // move note start + + if N = 0 then begin // fix beginning + Inc(Czesci[0].Czesc[C].Start, Move); + Inc(Czesci[0].Czesc[C].StartNote, Move); + end; + + if N = Czesci[0].Czesc[C].HighNut then // fix ending + Inc(Czesci[0].Czesc[C].Koniec, Move); + + end; // for + end; // for +end; + +procedure TScreenEditSub.MoveTextToRight; +var + C: integer; + N: integer; + NHigh: integer; +begin +{ C := Czesci[0].Akt; + + for N := Czesci[0].Czesc[C].HighNut downto 1 do begin + Czesci[0].Czesc[C].Nuta[N].Tekst := Czesci[0].Czesc[C].Nuta[N-1].Tekst; + end; // for + + Czesci[0].Czesc[C].Nuta[0].Tekst := '- ';} + + C := Czesci[0].Akt; + NHigh := Czesci[0].Czesc[C].HighNut; + + // last word + Czesci[0].Czesc[C].Nuta[NHigh].Tekst := Czesci[0].Czesc[C].Nuta[NHigh-1].Tekst + Czesci[0].Czesc[C].Nuta[NHigh].Tekst; + + // other words + for N := NHigh - 1 downto AktNuta + 1 do begin + Czesci[0].Czesc[C].Nuta[N].Tekst := Czesci[0].Czesc[C].Nuta[N-1].Tekst; + end; // for + Czesci[0].Czesc[C].Nuta[AktNuta].Tekst := '- '; +end; + +procedure TScreenEditSub.MarkSrc; +begin + CopySrc := Czesci[0].Akt; +end; + +procedure TScreenEditSub.PasteText; +var + C: integer; + N: integer; +begin + C := Czesci[0].Akt; + + for N := 0 to Czesci[0].Czesc[CopySrc].HighNut do + Czesci[0].Czesc[C].Nuta[N].Tekst := Czesci[0].Czesc[CopySrc].Nuta[N].Tekst; +end; + +procedure TScreenEditSub.CopySentence(Src, Dst: integer); +var + N: integer; + Time1: integer; + Time2: integer; + TD: integer; +begin + Time1 := Czesci[0].Czesc[Src].Nuta[0].Start; + Time2 := Czesci[0].Czesc[Dst].Nuta[0].Start; + TD := Time2-Time1; + + SetLength(Czesci[0].Czesc[Dst].Nuta, Czesci[0].Czesc[Src].IlNut); + Czesci[0].Czesc[Dst].IlNut := Czesci[0].Czesc[Src].IlNut; + Czesci[0].Czesc[Dst].HighNut := Czesci[0].Czesc[Src].HighNut; + for N := 0 to Czesci[0].Czesc[Src].HighNut do begin + Czesci[0].Czesc[Dst].Nuta[N].Tekst := Czesci[0].Czesc[Src].Nuta[N].Tekst; + Czesci[0].Czesc[Dst].Nuta[N].Dlugosc := Czesci[0].Czesc[Src].Nuta[N].Dlugosc; + Czesci[0].Czesc[Dst].Nuta[N].Ton := Czesci[0].Czesc[Src].Nuta[N].Ton; + Czesci[0].Czesc[Dst].Nuta[N].Start := Czesci[0].Czesc[Src].Nuta[N].Start + TD; + end; + N := Czesci[0].Czesc[Src].HighNut; + Czesci[0].Czesc[Dst].Koniec := Czesci[0].Czesc[Dst].Nuta[N].Start + Czesci[0].Czesc[Dst].Nuta[N].Dlugosc; +end; + +procedure TScreenEditSub.CopySentences(Src, Dst, Num: integer); +var + C: integer; +begin + // create place for new sentences + SetLength(Czesci[0].Czesc, Czesci[0].Ilosc + Num - 1); + + // moves sentences next to the destination + for C := Czesci[0].High downto Dst + 1 do begin + Czesci[0].Czesc[C + Num - 1] := Czesci[0].Czesc[C]; + end; + + // prepares new sentences: sets sentence start and create first note + for C := 1 to Num-1 do begin + Czesci[0].Czesc[Dst + C].Start := Czesci[0].Czesc[Dst + C - 1].StartNote + + (Czesci[0].Czesc[Src + C].StartNote - Czesci[0].Czesc[Src + C - 1].StartNote); + SetLength(Czesci[0].Czesc[Dst + C].Nuta, 1); + Czesci[0].Czesc[Dst + C].IlNut := 1; + Czesci[0].Czesc[Dst + C].HighNut := 0; + Czesci[0].Czesc[Dst + C].Nuta[0].Start := Czesci[0].Czesc[Dst + C].Start; + Czesci[0].Czesc[Dst + C].Nuta[0].Dlugosc := 1; + Czesci[0].Czesc[Dst + C].StartNote := Czesci[0].Czesc[Dst + C].Start; + Czesci[0].Czesc[Dst + C].Koniec := Czesci[0].Czesc[Dst + C].Start + 1; + end; + + // increase counters + Czesci[0].Ilosc := Czesci[0].Ilosc + Num - 1; + Czesci[0].High := Czesci[0].High + Num - 1; + + for C := 0 to Num-1 do + CopySentence(Src + C, Dst + C); +end; + + +constructor TScreenEditSub.Create(Back: String); +begin + inherited Create(Back); + SetLength(Player, 1); + + // linijka + AddStatic(20, 10, 80, 30, 0, 0, 0, Skin.GetTextureFileName('ButtonF'), 'JPG', 'Font Black'); + AddText(40, 17, 1, 6, 1, 1, 1, 'Line'); + TextSentence := AddText(120, 14, 1, 8, 0, 0, 0, '0 / 0'); + + // nuta + AddStatic(220, 10, 80, 30, 0, 0, 0, Skin.GetTextureFileName('ButtonF'), 'JPG', 'Font Black'); + AddText(242, 17, 1, 6, 1, 1, 1, 'Note'); + TextNote := AddText(320, 14, 1, 8, 0, 0, 0, '0 / 0'); + + // file info + AddStatic(150, 50, 500, 150, 0, 0, 0, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); + AddStatic(151, 52, 498, 146, 1, 1, 1, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); + AddText(180, 65, 0, 8, 0, 0, 0, 'Title:'); + AddText(180, 90, 0, 8, 0, 0, 0, 'Artist:'); + AddText(180, 115, 0, 8, 0, 0, 0, 'Mp3:'); + AddText(180, 140, 0, 8, 0, 0, 0, 'BPM:'); + AddText(180, 165, 0, 8, 0, 0, 0, 'GAP:'); + + TextTitle := AddText(250, 65, 0, 8, 0, 0, 0, 'a'); + TextArtist := AddText(250, 90, 0, 8, 0, 0, 0, 'b'); + TextMp3 := AddText(250, 115, 0, 8, 0, 0, 0, 'c'); + TextBPM := AddText(250, 140, 0, 8, 0, 0, 0, 'd'); + TextGAP := AddText(250, 165, 0, 8, 0, 0, 0, 'e'); + +{ AddInteraction(2, TextTitle); + AddInteraction(2, TextArtist); + AddInteraction(2, TextMp3); + AddInteraction(2, TextBPM); + AddInteraction(2, TextGAP);} + + // note info + AddText(20, 190, 0, 8, 0, 0, 0, 'Start:'); + AddText(20, 215, 0, 8, 0, 0, 0, 'Duration:'); + AddText(20, 240, 0, 8, 0, 0, 0, 'Tone:'); + AddText(20, 265, 0, 8, 0, 0, 0, 'Text:'); + + TextNStart := AddText(120, 190, 0, 8, 0, 0, 0, 'a'); + TextNDlugosc := AddText(120, 215, 0, 8, 0, 0, 0, 'b'); + TextNTon := AddText(120, 240, 0, 8, 0, 0, 0, 'c'); + TextNText := AddText(120, 265, 0, 8, 0, 0, 0, 'd'); + + // debug + TextDebug := AddText(30, 550, 0, 8, 0, 0, 0, ''); + +end; + +procedure TScreenEditSub.onShow; +begin + Log.LogStatus('Initializing', 'TEditScreen.onShow'); + + MidiOut := TMidiOutput.Create(nil); + if Ini.Debug = 1 then + MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table + MidiOut.Open; + + + + CzyscNuty; + if WczytajCzesci(Path + FileName) = false then +// if WczytajCzesci(SongPath + 'Zapis.txt') = false then + Text[TextTitle].Text := 'Error loading file' + else begin + Text[TextTitle].Text := AktSong.Title; + Text[TextArtist].Text := AktSong.Artist; + Text[TextMp3].Text := AktSong.Mp3; + + Czesci[0].Akt := 0; + AktNuta := 0; + Czesci[0].Czesc[0].Nuta[0].Color := 1; + + Music.Open(Path + AktSong.Mp3); + + Lyric.Clear; + Lyric.X := 400; + Lyric.Y := 500; + Lyric.Align := 1; + Lyric.Size := 14; + Lyric.ColR := 0; + Lyric.ColG := 0; + Lyric.ColB := 0; + Lyric.ColSR := Skin_FontHighlightR; + Lyric.ColSG := Skin_FontHighlightG; + Lyric.ColSB := Skin_FontHighlightB; + Lyric.Style := 0; + Lyric.AddCzesc(0); + Lyric.Selected := 0; + + NotesH := 7; + NotesW := 4; + + end; + +// Interaction := 0; + TextEditMode := false; +end; + +function TScreenEditSub.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + Pet: integer; + AktBeat: integer; +begin + glClearColor(1,1,1,1); + + // midi music + if PlaySentenceMidi then begin + MidiPos := USTime.GetTime - MidiTime + MidiStart; + + // stop the music + if (MidiPos > MidiStop) then begin + MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127); + PlaySentenceMidi := false; + end; + + // click + AktBeat := Floor(GetMidBeat(MidiPos - AktSong.GAP / 1000)); + Text[TextDebug].Text := IntToStr(AktBeat); + + if AktBeat <> LastClick then begin + for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then begin + + LastClick := AktBeat; + if Pet > 0 then + MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet-1].Ton + 60, 127); + MidiOut.PutShort($91, Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Ton + 60, 127); + MidiLastNote := Pet; + + end; + end; + end; // if PlaySentenceMidi + + // mp3 music + if PlaySentence then begin + // stop the music + if (Music.Position > PlayStopTime) then begin + Music.Stop; + PlaySentence := false; + end; + + // click + if (Click) and (PlaySentence) then begin +// AktBeat := Floor(AktSong.BPM[0].BPM * (Music.Position - AktSong.GAP / 1000) / 60); + AktBeat := Floor(GetMidBeat(Music.Position - AktSong.GAP / 1000)); + Text[TextDebug].Text := IntToStr(AktBeat); + if AktBeat <> LastClick then begin + for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then begin + Music.PlayClick; + LastClick := AktBeat; + end; + end; + end; // click + end; // if PlaySentence + + + Text[TextSentence].Text := IntToStr(Czesci[0].Akt + 1) + ' / ' + IntToStr(Czesci[0].Ilosc); + Text[TextNote].Text := IntToStr(AktNuta + 1) + ' / ' + IntToStr(Czesci[0].Czesc[Czesci[0].Akt].IlNut); + + // Song info + Text[TextBPM].Text := FloatToStr(AktSong.BPM[0].BPM / 4); + Text[TextGAP].Text := FloatToStr(AktSong.GAP); + + // Note info + Text[TextNStart].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start); + Text[TextNDlugosc].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); + Text[TextNTon].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton); + Text[TextNText].Text := Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst; + + // Text Edit Mode + if TextEditMode then + Text[TextNText].Text := Text[TextNText].Text + '|'; + + // draw static menu + inherited Draw; + + // draw notes + SingDrawNoteLines(20, 300, 780, 15); + SingDrawBeatDelimeters(40, 300, 760, 0); + EditDrawCzesc(40, 405, 760, 0, 15); + + // draw text + Lyric.Draw; + +end; + +procedure TScreenEditSub.onHide; +begin + MidiOut.Close; + MidiOut.Free; +end; + +end. diff --git a/Game/Code/Screens/UScreenLevel.dcu b/Game/Code/Screens/UScreenLevel.dcu new file mode 100644 index 00000000..95cb3267 Binary files /dev/null and b/Game/Code/Screens/UScreenLevel.dcu differ diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas new file mode 100644 index 00000000..28aa40ea --- /dev/null +++ b/Game/Code/Screens/UScreenLevel.pas @@ -0,0 +1,101 @@ +unit UScreenLevel; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + +type + TScreenLevel = class(TMenu) + public + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + end; + +implementation + +uses UGraphic, UMain, UIni, UTexture; + +function TScreenLevel.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 + Music.PlayBack; + FadeTo(@ScreenName); + end; + + SDLK_RETURN: + begin + Ini.Difficulty := Interaction; + Ini.SaveLevel; + Music.PlayStart; + //Set Standard Mode + ScreenSong.Mode := 0; + FadeTo(@ScreenSong); + end; + + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN : + begin + end; + end; +end; + +constructor TScreenLevel.Create; +var + I: integer; +begin + inherited Create; + + AddBackground(Theme.Level.Background.Tex); + + AddButton(Theme.Level.ButtonEasy); + AddButton(Theme.Level.ButtonMedium); + AddButton(Theme.Level.ButtonHard); + + for I := 0 to High(Theme.Level.Static) do + AddStatic(Theme.Level.Static[I]); + + for I := 0 to High(Theme.Level.Text) do + AddText(Theme.Level.Text[I]); + + Interaction := 0; +end; + +procedure TScreenLevel.onShow; +begin + Interaction := Ini.Difficulty; + +// LCD.WriteText(1, ' Choose mode: '); +// UpdateLCD; +end; + +procedure TScreenLevel.SetAnimationProgress(Progress: real); +begin + Button[0].Texture.ScaleW := Progress; + Button[1].Texture.ScaleW := Progress; + Button[2].Texture.ScaleW := Progress; +end; + +end. diff --git a/Game/Code/Screens/UScreenLoading.dcu b/Game/Code/Screens/UScreenLoading.dcu new file mode 100644 index 00000000..e0eb1cfe Binary files /dev/null and b/Game/Code/Screens/UScreenLoading.dcu differ diff --git a/Game/Code/Screens/UScreenLoading.pas b/Game/Code/Screens/UScreenLoading.pas new file mode 100644 index 00000000..05b308ac --- /dev/null +++ b/Game/Code/Screens/UScreenLoading.pas @@ -0,0 +1,48 @@ +unit UScreenLoading; + +interface + +uses + UMenu, SDL, SysUtils, UThemes; + +type + TScreenLoading = class(TMenu) + public + Fadeout: boolean; + constructor Create(Back: String); override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + end; + +implementation + +uses UGraphic, UTime; + +function TScreenLoading.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; +end; + +constructor TScreenLoading.Create(Back: String); +var + I: integer; +begin + inherited Create(Back); + + AddBackground(Theme.Loading.Background.Tex); + + for I := 0 to High(Theme.Loading.Static) do + AddStatic(Theme.Loading.Static[I]); + + for I := 0 to High(Theme.Loading.Text) do + AddText(Theme.Loading.Text[I]); + + Fadeout := false; +end; + +procedure TScreenLoading.onShow; +begin +// nothing +end; + +end. diff --git a/Game/Code/Screens/UScreenMain.dcu b/Game/Code/Screens/UScreenMain.dcu new file mode 100644 index 00000000..22bb4883 Binary files /dev/null and b/Game/Code/Screens/UScreenMain.dcu differ diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas new file mode 100644 index 00000000..dcd7db26 --- /dev/null +++ b/Game/Code/Screens/UScreenMain.pas @@ -0,0 +1,384 @@ +unit UScreenMain; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes, ULCD, ULight; + +type + TScreenMain = class(TMenu) + public + TextDescription: integer; + TextDescriptionLong: integer; + + //Credits Mod + Credits_Visible: Boolean; + Credits_Y: Real; + Credits_Time: Cardinal; + Credits_Alpha: Cardinal; + procedure DrawCredits; + //Credits Mod End + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure InteractNext; override; + procedure InteractPrev; override; + procedure UpdateLCD; + procedure SetAnimationProgress(Progress: real); override; + function Draw: boolean; override; + end; + +const Credits_Text: Array[0..46] of PChar = ( + ':SPACE:', + 'Main Idea: Corvus 5', + 'Thank you very much for this great Game', + ':SPACE:', + 'The Ultrastar Deluxe Team:', + ':SPACE:', + 'commandi00:', + 'Beta Testing', + ':SPACE:', + 'Crazy Joker:', + 'Graphics', + ':SPACE:', + 'DennistheMenace:', + 'Beta Testing and great Support in "the Board"', + ':SPACE:', + 'Moq/Moguhguh:', + 'Programming', + ':SPACE:', + 'Mota:', + 'Programming, Idea of creating this Mod, Team Leading', + ':SPACE:', + 'Sawyer:', + 'Web Master, Programming', + ':SPACE:', + 'Whiteshark:', + 'Programming, Creating Release', + ':SPACE:', + ':SPACE:', + 'Thanks to', + ':SPACE:', + 'Blind Guard', + 'for supporting us and administrate this great Board', + ':SPACE:', + 'The whole Community from www.ultra-star.dl.am', + 'for supporting us, supporting the newbies', + 'and remembering us to continue work', + ':SPACE:', + 'You', + 'for using Ultrastar Deluxe', + ':SPACE:', + ':SPACE:', + 'Visit us at:', + 'http://www.UltraStar-Deluxe.de.vu', + 'http://www.USD.de.vu', + 'http://www.Ultra-Star.dl.am ("The Board" by Blind Guard)', + 'Please write Bug Reports and Feature Requests', + 'to help making this a better Game'); + + +implementation + +uses Windows, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl, ULanguage, UParty; + + +function TScreenMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var +I: Integer; +SDL_ModState: Word; +begin + Result := true; + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + + //Deactivate Credits when Key is pressed + if Credits_Visible then + begin + Credits_Visible := False; + exit; + end; + + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE : + begin + Result := False; + end; + + SDLK_C: + begin + if (SDL_ModState = KMOD_LALT) then + begin + Credits_Y := 600; + Credits_Alpha := 0; + Credits_Visible := True; + end; + end; + SDLK_M: + begin + if (SDL_ModState = KMOD_LALT) then + begin + //Create Teams: + PartySession.Teams.NumTeams := 3; + //Team 1 + PartySession.Teams.Teaminfo[0].Name := 'Team 1'; + PartySession.Teams.Teaminfo[0].Score:= 0; + PartySession.Teams.Teaminfo[0].Joker := 3; + PartySession.Teams.Teaminfo[0].CurPlayer := 0; + PartySession.Teams.Teaminfo[0].NumPlayers := 2; + PartySession.Teams.Teaminfo[0].Playerinfo[0].Name := 'Player 1'; + PartySession.Teams.Teaminfo[0].Playerinfo[0].TimesPlayed := 0; + PartySession.Teams.Teaminfo[0].Playerinfo[1].Name := 'Player 2'; + PartySession.Teams.Teaminfo[0].Playerinfo[1].TimesPlayed := 0; + + //Team 2 + PartySession.Teams.Teaminfo[1].Name := 'Team 2'; + PartySession.Teams.Teaminfo[1].Score:= 0; + PartySession.Teams.Teaminfo[1].Joker := 3; + PartySession.Teams.Teaminfo[1].CurPlayer := 0; + PartySession.Teams.Teaminfo[1].NumPlayers := 2; + PartySession.Teams.Teaminfo[1].Playerinfo[0].Name := 'Player 3'; + PartySession.Teams.Teaminfo[1].Playerinfo[0].TimesPlayed := 0; + PartySession.Teams.Teaminfo[1].Playerinfo[1].Name := 'Player 4'; + PartySession.Teams.Teaminfo[1].Playerinfo[1].TimesPlayed := 0; + + //Team 3 + PartySession.Teams.Teaminfo[2].Name := 'Team 3'; + PartySession.Teams.Teaminfo[2].Score:= 0; + PartySession.Teams.Teaminfo[2].Joker := 3; + PartySession.Teams.Teaminfo[2].CurPlayer := 0; + PartySession.Teams.Teaminfo[2].NumPlayers := 2; + PartySession.Teams.Teaminfo[2].Playerinfo[0].Name := 'Player 5'; + PartySession.Teams.Teaminfo[2].Playerinfo[0].TimesPlayed := 0; + PartySession.Teams.Teaminfo[2].Playerinfo[1].Name := 'Player 6'; + PartySession.Teams.Teaminfo[2].Playerinfo[1].TimesPlayed := 0; + + //Rounds: + SetLength (PartySession.Rounds, 3); + PartySession.Rounds[0].Plugin := 1; + PartySession.Rounds[0].Winner := 0; + PartySession.Rounds[1].Plugin := 0; + PartySession.Rounds[1].Winner := 0; + PartySession.Rounds[2].Plugin := 0; + PartySession.Rounds[2].Winner := 0; + + //Start Party + PartySession.StartNewParty; + //Change Screen + Music.PlayStart; + FadeTo(@ScreenPartyNewRound); + + end + else + begin + Music.PlayStart; + FadeTo(@ScreenPartyOptions); + end; + + end; + + SDLK_RETURN: + begin + if (Interaction = 0) and (Length(Songs.Song) >= 1) then begin + Music.PlayStart; + if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1; + if (Ini.Players = 4) then PlayersPlay := 6; + FadeTo(@ScreenName); + end; + if Interaction = 1 then begin + Music.PlayStart; + FadeTo(@ScreenEdit); + end; + if Interaction = 2 then begin + Music.PlayStart; + FadeTo(@ScreenOptions); +// SDL_SetVideoMode(800, 600, 32, SDL_OPENGL);// or SDL_FULLSCREEN); +// LoadTextures; + end; + if Interaction = 3 then begin + Result := false; + end; + end; + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN : + begin + end; + end; +end; + +constructor TScreenMain.Create; +var + I: integer; +begin + inherited Create; + +// AddButton(400-200, 320, 400, 60, Skin.GameStart); +// AddButton(400-200, 390, 400, 60, Skin.Editor); +// AddButton(400-200, 460, 400, 60, Skin.Options); +// AddButton(400-200, 530, 400, 60, Skin.Exit); + + AddBackground(Theme.Main.Background.Tex); + + AddButton(Theme.Main.ButtonSolo); + AddButton(Theme.Main.ButtonEditor); + AddButton(Theme.Main.ButtonOptions); + AddButton(Theme.Main.ButtonExit); + + for I := 0 to High(Theme.Main.Static) do + AddStatic(Theme.Main.Static[I]); + + for I := 0 to High(Theme.Main.Text) do + AddText(Theme.Main.Text[I]); + + TextDescription := AddText(Theme.Main.TextDescription); + TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong); + + Interaction := 0; +end; + +procedure TScreenMain.onShow; +begin + LCD.WriteText(1, ' Choose mode: '); + UpdateLCD; +end; + +procedure TScreenMain.InteractNext; +begin + inherited InteractNext; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; + UpdateLCD; + Light.LightOne(1, 200); +end; + +procedure TScreenMain.InteractPrev; +begin + inherited InteractPrev; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; + UpdateLCD; + Light.LightOne(0, 200); +end; + +procedure TScreenMain.UpdateLCD; +begin + case Interaction of + 0: LCD.WriteText(2, ' sing '); + 1: LCD.WriteText(2, ' editor '); + 2: LCD.WriteText(2, ' options '); + 3: LCD.WriteText(2, ' exit '); + end +end; + +procedure TScreenMain.SetAnimationProgress(Progress: real); +begin + Static[0].Texture.ScaleW := Progress; + Static[0].Texture.ScaleH := Progress; +end; + +function TScreenMain.Draw: boolean; +begin +Result := True; +if Credits_Visible then + DrawCredits +else + Result := inherited Draw; +end; + +procedure TScreenMain.DrawCredits; +var + T, I: Cardinal; + Y: Real; + Ver: PChar; +begin + T := GetTickCount div 33; + if T <> Credits_Time then + begin + Credits_Time := T; + //Change Position + Credits_Y := Credits_Y - 1; + //Change Alpha + Inc (Credits_Alpha, 3); + end; + + //Draw BackGround + DrawBG; + + + //Draw pulsing Credits Text + //Set Font + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (460, 570); + glColor4f(1, 0, 0, 0.2 + Abs((Credits_Alpha mod 150)/100 - 0.75)); + glPrint ('Credits! Press any Key to Continue'); + + //Set Font Size for Credits + SetFontSize(12); + //Draw Version + if (Credits_Y>-35) then + begin + Ver := PChar(Language.Translate('US_VERSION')); + glColor4f(1, 0.6, 0.08, 0.8); + SetFontPos (400 - glTextWidth(Ver)/2, Credits_Y); + glprint(Ver); + end; + + //Set Color + Start Pos + glColor4f(0.8, 0.8, 1, 0.8); + Y := Credits_Y + 50; + + //Search upper Position + For I := 0 to high(Credits_Text) do + begin + if (Credits_Text[I]=':SPACE:') then //Spacer + Y := Y + 55 + else + Y := Y + 30; + + if Y > -35 then + break; + end; + + //Draw Text + For T := I+1 to high(Credits_Text) do + begin + if (Credits_Text[T]=':SPACE:') then //Spacer + Y := Y + 55 + else + begin + SetFontPos (400 - glTextWidth(Credits_Text[T])/2, Y); + glprint(Credits_Text[T]); + Y := Y + 30; + end; + + if Y > 600 then + break; + end; + + //If lower Position is outside the Screen-> Show MainMenu + if (Y <= 0) then + Credits_Visible := False; +end; + +end. diff --git a/Game/Code/Screens/UScreenName.dcu b/Game/Code/Screens/UScreenName.dcu new file mode 100644 index 00000000..d14b4296 Binary files /dev/null and b/Game/Code/Screens/UScreenName.dcu differ diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas new file mode 100644 index 00000000..99f5d40a --- /dev/null +++ b/Game/Code/Screens/UScreenName.pas @@ -0,0 +1,114 @@ +unit UScreenName; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + +type + TScreenName = class(TMenu) + public + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + end; + +implementation + +uses UGraphic, UMain, UIni, UTexture; + +function TScreenName.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var + I: integer; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_0..SDLK_9, SDLK_A..SDLK_Z, SDLK_SPACE, SDLK_MINUS, SDLK_EXCLAIM, SDLK_COMMA, SDLK_SLASH, SDLK_ASTERISK, SDLK_QUESTION, SDLK_QUOTE, SDLK_QUOTEDBL: + begin + Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + chr(ScanCode); + end; + + SDLK_BACKSPACE: + begin + Delete(Button[Interaction].Text[0].Text, + Length(Button[Interaction].Text[0].Text), 1); + end; + + SDLK_ESCAPE : + begin + Ini.SaveNames; + Music.PlayBack; + FadeTo(@ScreenMain); + end; + + SDLK_RETURN: + begin + for I := 1 to 6 do + Ini.Name[I-1] := Button[I-1].Text[0].Text; + Ini.SaveNames; + Music.PlayStart; + FadeTo(@ScreenLevel); + end; + + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; + end; + end; +end; + +constructor TScreenName.Create; +var + I: integer; +begin + inherited Create; + + AddBackground(Theme.Name.Background.Tex); + + for I := 1 to 6 do + AddButton(Theme.Name.ButtonPlayer[I]); + + for I := 0 to High(Theme.Name.Static) do + AddStatic(Theme.Name.Static[I]); + + for I := 0 to High(Theme.Name.Text) do + AddText(Theme.Name.Text[I]); + + Interaction := 0; +end; + +procedure TScreenName.onShow; +var + I: integer; +begin + for I := 1 to 6 do + Button[I-1].Text[0].Text := Ini.Name[I-1]; + + for I := 1 to PlayersPlay do begin + Button[I-1].Visible := true; + Button[I-1].Selectable := true; + end; + + for I := PlayersPlay+1 to 6 do begin + Button[I-1].Visible := false; + Button[I-1].Selectable := false; + end; + +end; + +procedure TScreenName.SetAnimationProgress(Progress: real); +var + I: integer; +begin + for I := 1 to 6 do + Button[I-1].Texture.ScaleW := Progress; +end; + +end. diff --git a/Game/Code/Screens/UScreenOpen.dcu b/Game/Code/Screens/UScreenOpen.dcu new file mode 100644 index 00000000..c59986f9 Binary files /dev/null and b/Game/Code/Screens/UScreenOpen.dcu differ diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas new file mode 100644 index 00000000..723f299f --- /dev/null +++ b/Game/Code/Screens/UScreenOpen.pas @@ -0,0 +1,151 @@ +unit UScreenOpen; + +interface + +uses UMenu, UMusic, SDL, SysUtils, UPliki, UTime, USongs, UIni, ULog, USmpeg, UTexture, UMenuText, + ULyrics, Math, OpenGL12, UThemes; + +type + TScreenOpen = class(TMenu) + private + TextF: array[0..1] of integer; + TextN: integer; + public + Tex_Background: TTexture; + FadeOut: boolean; + Path: string; + BackScreen: pointer; + procedure AddBox(X, Y, W, H: real); + constructor Create(Back: String); override; + procedure onShow; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; +// function Draw: boolean; override; +// procedure Finish; + end; + +implementation +uses UGraphic, UDraw, UMain, USkins; + +function TScreenOpen.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + if (PressedDown) then begin // Key Down + case ScanCode of + ord('a')..ord('z'), ord('A')..ord('Z'), ord('0')..ord('9'), 32, ord('-'), ord('.'), ord(':'), ord('\'): + begin + if Interaction = 0 then begin + Text[TextN].Text := Text[TextN].Text + chr(ScanCode); + FileName := Text[TextN].Text; + end; + end; + end; + + case PressedKey of + 8: // del + begin + if Interaction = 0 then + if Length(Text[TextN].Text) >= 1 then begin + Delete(Text[TextN].Text, Length(Text[TextN].Text), 1); + FileName := Text[TextN].Text; + end; + end; + + SDLK_ESCAPE: + begin + result := false; + end; + + SDLK_RETURN: + begin + if Interaction = 2 then begin + Music.PlayBack; + FadeTo(BackScreen); + end; + end; + + SDLK_LEFT: + begin + InteractPrev; + end; + + SDLK_RIGHT: + begin + InteractNext; + end; + + SDLK_DOWN: + begin + end; + + SDLK_UP: + begin + end; + end; + end; +end; + +procedure TScreenOpen.AddBox(X, Y, W, H: real); +begin + AddStatic(X, Y, W, H, 0, 0, 0, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); + AddStatic(X+2, Y+2, W-4, H-4, 1, 1, 1, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); +end; + +constructor TScreenOpen.Create(Back: String); +begin + inherited Create(Back); + + // linijka +{ AddStatic(20, 10, 80, 30, 0, 0, 0, 'Bar', 'JPG', 'Font Black'); + AddText(35, 17, 1, 6, 1, 1, 1, 'Linijka'); + TextSentence := AddText(120, 14, 1, 8, 0, 0, 0, '0 / 0');} + + // file list +// AddBox(400, 100, 350, 450); + +// TextF[0] := AddText(430, 155, 0, 8, 0, 0, 0, 'a'); +// TextF[1] := AddText(430, 180, 0, 8, 0, 0, 0, 'a'); + + // file name + AddBox(20, 540, 500, 40); + TextN := AddText(50, 548, 0, 8, 0, 0, 0, FileName); + AddInteraction(iText, TextN); + + // buttons + {AddButton(540, 540, 100, 40, Skin.SkinPath + Skin.ButtonF); + AddButtonText(10, 5, 0, 0, 0, 'Cancel'); + + AddButton(670, 540, 100, 40, Skin.SkinPath + Skin.ButtonF); + AddButtonText(30, 5, 0, 0, 0, 'OK');} + // buttons + AddButton(540, 540, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(10, 5, 0, 0, 0, 'Cancel'); + + AddButton(670, 540, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(30, 5, 0, 0, 0, 'OK'); + + +end; + +procedure TScreenOpen.onShow; +begin + Interaction := 0; +end; + +(*function TScreenEditSub.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + Pet: integer; + AktBeat: integer; +begin + +end; + +procedure TScreenEditSub.Finish; +begin +// +end;*) + +end. + diff --git a/Game/Code/Screens/UScreenOptions.dcu b/Game/Code/Screens/UScreenOptions.dcu new file mode 100644 index 00000000..e5d17c3b Binary files /dev/null and b/Game/Code/Screens/UScreenOptions.dcu differ diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas new file mode 100644 index 00000000..76ff2adc --- /dev/null +++ b/Game/Code/Screens/UScreenOptions.pas @@ -0,0 +1,221 @@ +unit UScreenOptions; + +interface + +uses + UMenu, SDL, SysUtils, UDisplay, UMusic, UPliki, UIni, UThemes; + +type + TScreenOptions = class(TMenu) + public + TextDescription: integer; + constructor Create(Back: String); override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure InteractNext; override; + procedure InteractPrev; override; + procedure SetAnimationProgress(Progress: real); override; + end; + +implementation + +uses UGraphic; + +function TScreenOptions.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 + if SelInteraction = 0 then begin + Music.PlayStart; + FadeTo(@ScreenOptionsGame); + end; + + if SelInteraction = 1 then begin + Music.PlayStart; + FadeTo(@ScreenOptionsGraphics); + end; + + if SelInteraction = 2 then begin + Music.PlayStart; + FadeTo(@ScreenOptionsSound); + end; + + if SelInteraction = 3 then begin + Music.PlayStart; + FadeTo(@ScreenOptionsLyrics); + end; + + if SelInteraction = 4 then begin + Music.PlayStart; + FadeTo(@ScreenOptionsThemes); + end; + + if SelInteraction = 5 then begin + Music.PlayStart; + FadeTo(@ScreenOptionsRecord); + end; + + if SelInteraction = 6 then begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenMain); + end; + end; + SDLK_LEFT: + begin + {case SelInteraction of + 0: InteractCustom(+2); + 1: InteractCustom(-1); + 2: InteractCustom(-1); + 3: InteractCustom(+2); + 4: InteractCustom(-1); + 5: InteractCustom(-1); + end;} + InteractPrev; + end; + SDLK_RIGHT: + begin + {case SelInteraction of + 0: InteractCustom(+1); + 1: InteractCustom(+1); + 2: InteractCustom(-2); + 3: InteractCustom(+1); + 4: InteractCustom(+1); + 5: InteractCustom(-2); + end;} + InteractNext; + end; + SDLK_UP: + begin + InteractPrev; + {case SelInteraction of + 0: InteractCustom(+3); + 1: InteractCustom(+3); + 2: InteractCustom(+3); + 3: InteractCustom(-3); + 4: InteractCustom(-3); + 5: InteractCustom(-3); + end; } + end; + SDLK_DOWN: + begin + {case SelInteraction of + 0: InteractCustom(+3); + 1: InteractCustom(+3); + 2: InteractCustom(+3); + 3: InteractCustom(-3); + 4: InteractCustom(-3); + 5: InteractCustom(-3); + end; } + InteractNext; + end; + end; + end; +end; + +constructor TScreenOptions.Create(Back: String); +var + I: integer; +begin + inherited Create(Back); + + // Game +{ AddButton(225, 100 + 0*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); + AddButtonText(11, 10, 'Game');} + + // Graphics +{ AddButton(225, 100 + 1*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); + AddButtonText(11, 10, 'Graphics'); + + // Sound + AddButton(225, 100 + 2*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); + AddButtonText(11, 10, 'Sound'); + + // Lyrics + AddButton(225, 100 + 3*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); + AddButtonText(11, 10, 'Lyrics'); + + // Themes + AddButton(225, 100 + 4*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); + AddButtonText(11, 10, 'Themes'); + + // Exit + AddButton(225, 100 + 6*60, 350, 50, Skin.Exit);} + + AddBackground(Theme.Options.Background.Tex); + + AddButton(Theme.Options.ButtonGame); + AddButtonText(14, 20, Theme.Options.Description[0]); + + AddButton(Theme.Options.ButtonGraphics); + AddButtonText(14, 20, Theme.Options.Description[1]); + + AddButton(Theme.Options.ButtonSound); + AddButtonText(14, 20, Theme.Options.Description[2]); + + AddButton(Theme.Options.ButtonLyrics); + AddButtonText(14, 20, Theme.Options.Description[3]); + + AddButton(Theme.Options.ButtonThemes); + AddButtonText(14, 20, Theme.Options.Description[4]); + + AddButton(Theme.Options.ButtonRecord); + AddButtonText(14, 20, Theme.Options.Description[5]); + + AddButton(Theme.Options.ButtonExit); + AddButtonText(14, 20, Theme.Options.Description[6]); + + for I := 0 to High(Theme.Options.Static) do + AddStatic(Theme.Options.Static[I]); + + for I := 0 to High(Theme.Options.Text) do + AddText(Theme.Options.Text[I]); + + TextDescription := AddText(Theme.Options.TextDescription); + + Interaction := 0; +end; + +procedure TScreenOptions.onShow; +begin +// +end; + +procedure TScreenOptions.InteractNext; +begin + inherited InteractNext; + Text[TextDescription].Text := Theme.Options.Description[Interaction]; +end; + +procedure TScreenOptions.InteractPrev; +begin + inherited InteractPrev; + Text[TextDescription].Text := Theme.Options.Description[Interaction]; +end; + + +procedure TScreenOptions.SetAnimationProgress(Progress: real); +begin + Button[0].Texture.ScaleW := Progress; + Button[1].Texture.ScaleW := Progress; + Button[2].Texture.ScaleW := Progress; + Button[3].Texture.ScaleW := Progress; + Button[4].Texture.ScaleW := Progress; + Button[5].Texture.ScaleW := Progress; +end; + +end. diff --git a/Game/Code/Screens/UScreenOptionsGame.dcu b/Game/Code/Screens/UScreenOptionsGame.dcu new file mode 100644 index 00000000..3fd70913 Binary files /dev/null and b/Game/Code/Screens/UScreenOptionsGame.dcu differ diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas new file mode 100644 index 00000000..6f49bd19 --- /dev/null +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -0,0 +1,107 @@ +unit UScreenOptionsGame; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes, USongs; + +type + TScreenOptionsGame = class(TMenu) + public + old_Tabs, old_Sorting: integer; + constructor Create(Back: String); override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure RefreshSongs; + end; + +implementation + +uses UGraphic; + +function TScreenOptionsGame.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_ESCAPE : + begin + Music.PlayBack; + RefreshSongs; + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 6 then begin + Music.PlayBack; + RefreshSongs; + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + Music.PlayOption; + InteractInc; + end; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + Music.PlayOption; + InteractDec; + end; + end; + end; + end; +end; + +constructor TScreenOptionsGame.Create(Back: String); +var + I: integer; +begin + inherited Create(Back); + + AddBackground(Theme.OptionsGame.Background.Tex); + + for I := 0 to High(Theme.OptionsGame.Static) do + AddStatic(Theme.OptionsGame.Static[I]); + + for I := 0 to High(Theme.OptionsGame.Text) do + AddText(Theme.OptionsGame.Text[I]); + + //Refresh Songs Patch + old_Sorting := Ini.Sorting; + old_Tabs := Ini.Tabs; + + AddSelect(Theme.OptionsGame.SelectPlayers, Ini.Players, IPlayers); + AddSelect(Theme.OptionsGame.SelectDifficulty, Ini.Difficulty, IDifficulty); + AddSelectSlide(Theme.OptionsGame.SelectLanguage, Ini.Language, ILanguage); + AddSelect(Theme.OptionsGame.SelectTabs, Ini.Tabs, ITabs); + AddSelectSlide(Theme.OptionsGame.SelectSorting, Ini.Sorting, ISorting); + AddSelect(Theme.OptionsGame.SelectDebug, Ini.Debug, IDebug); + + + AddButton(Theme.OptionsGame.ButtonExit); + AddButtonText(14, 20, 'Exit'); + +end; + +//Refresh Songs Patch +procedure TScreenOptionsGame.RefreshSongs; +begin +if (ini.Sorting <> old_Sorting) or (ini.Tabs <> old_Tabs) then + ScreenSong.Refresh; +end; + +procedure TScreenOptionsGame.onShow; +begin +// Interaction := 0; +end; + +end. diff --git a/Game/Code/Screens/UScreenOptionsGraphics.dcu b/Game/Code/Screens/UScreenOptionsGraphics.dcu new file mode 100644 index 00000000..3eddc010 Binary files /dev/null and b/Game/Code/Screens/UScreenOptionsGraphics.dcu differ diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas new file mode 100644 index 00000000..1f30f9b5 --- /dev/null +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -0,0 +1,101 @@ +unit UScreenOptionsGraphics; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + +type + TScreenOptionsGraphics = class(TMenu) + public + constructor Create(Back: String); override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + end; + +implementation + +uses UGraphic, UMain; + +function TScreenOptionsGraphics.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(@ScreenOptions); + end; + SDLK_RETURN: + begin +{ if SelInteraction <= 1 then begin + Restart := true; + end;} + if SelInteraction = 6 then begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + Music.PlayOption; + InteractInc; + end; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + Music.PlayOption; + InteractDec; + end; + end; + end; + end; +end; + +constructor TScreenOptionsGraphics.Create(Back: String); +var + I: integer; +begin + inherited Create(Back); + + AddBackground(Theme.OptionsGraphics.Background.Tex); + + for I := 0 to High(Theme.OptionsGraphics.Static) do + AddStatic(Theme.OptionsGraphics.Static[I]); + + for I := 0 to High(Theme.OptionsGraphics.Text) do + AddText(Theme.OptionsGraphics.Text[I]); + + AddSelectSlide(Theme.OptionsGraphics.SelectSlideResolution, Ini.Resolution, IResolution); + AddSelect(Theme.OptionsGraphics.SelectFullscreen, Ini.Fullscreen, IFullscreen); + AddSelect(Theme.OptionsGraphics.SelectDepth, Ini.Depth, IDepth); + AddSelect(Theme.OptionsGraphics.SelectOscilloscope, Ini.Oscilloscope, IOscilloscope); + AddSelect(Theme.OptionsGraphics.SelectLineBonus, Ini.LineBonus, ILineBonus); + AddSelect(Theme.OptionsGraphics.SelectMovieSize, Ini.MovieSize, IMovieSize); + + + AddButton(Theme.OptionsGraphics.ButtonExit); + AddButtonText(14, 20, 'Exit'); + +end; + +procedure TScreenOptionsGraphics.onShow; +begin + Interaction := 0; +end; + +end. diff --git a/Game/Code/Screens/UScreenOptionsLyrics.dcu b/Game/Code/Screens/UScreenOptionsLyrics.dcu new file mode 100644 index 00000000..1fcfca9d Binary files /dev/null and b/Game/Code/Screens/UScreenOptionsLyrics.dcu differ diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas new file mode 100644 index 00000000..21a33998 --- /dev/null +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -0,0 +1,91 @@ +unit UScreenOptionsLyrics; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + +type + TScreenOptionsLyrics = class(TMenu) + public + constructor Create(Back: String); override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + end; + +implementation + +uses UGraphic; + +function TScreenOptionsLyrics.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_ESCAPE : + begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 3 then begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 2) then begin + Music.PlayOption; + InteractInc; + end; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 2) then begin + Music.PlayOption; + InteractDec; + end; + end; + end; + end; +end; + +constructor TScreenOptionsLyrics.Create(Back: String); +var + I: integer; +begin + inherited Create(Back); + + AddBackground(Theme.OptionsLyrics.Background.Tex); + + for I := 0 to High(Theme.OptionsLyrics.Static) do + AddStatic(Theme.OptionsLyrics.Static[I]); + + for I := 0 to High(Theme.OptionsLyrics.Text) do + AddText(Theme.OptionsLyrics.Text[I]); + + AddSelect(Theme.OptionsLyrics.SelectLyricsFont, Ini.LyricsFont, ILyricsFont); + AddSelect(Theme.OptionsLyrics.SelectLyricsEffect, Ini.LyricsEffect, ILyricsEffect); + AddSelect(Theme.OptionsLyrics.SelectSolmization, Ini.Solmization, ISolmization); + + + AddButton(Theme.OptionsLyrics.ButtonExit); + AddButtonText(14, 20, 'Exit'); + +end; + +procedure TScreenOptionsLyrics.onShow; +begin + Interaction := 0; +end; + +end. diff --git a/Game/Code/Screens/UScreenOptionsRecord.dcu b/Game/Code/Screens/UScreenOptionsRecord.dcu new file mode 100644 index 00000000..36a04d50 Binary files /dev/null and b/Game/Code/Screens/UScreenOptionsRecord.dcu differ diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas new file mode 100644 index 00000000..c27ec02a --- /dev/null +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -0,0 +1,136 @@ +unit UScreenOptionsRecord; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + +type + TScreenOptionsRecord = class(TMenu) + private + SelectSlideInput: integer; + SelectSlideChannelL: integer; + SelectSlideChannelR: integer; + public + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure UpdateCard; + end; + +implementation + +uses SysUtils, UGraphic, URecord, ULog; + +function TScreenOptionsRecord.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_ESCAPE, SDLK_BACKSPACE: + begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 4 then begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + Music.PlayOption; + InteractInc; + end; + if SelInteraction = 0 then UpdateCard; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + Music.PlayOption; + InteractDec; + end; + if SelInteraction = 0 then UpdateCard; + end; + end; + end; +end; + +constructor TScreenOptionsRecord.Create; +var + I: integer; + SC: integer; + SCI: integer; +begin + AddBackground(Theme.OptionsRecord.Background.Tex); + for I := 0 to High(Theme.OptionsRecord.Static) do + AddStatic(Theme.OptionsRecord.Static[I]); + + for I := 0 to High(Theme.OptionsRecord.Text) do + AddText(Theme.OptionsRecord.Text[I]); + +// SetLength(ICard, 0); +// ICard[0] := 'karta'; + +// SetLength(IInput, 0); +// IInput[0] := 'wejscie'; + +// if Length(Recording.SoundCard) > 0 then begin + SetLength(ICard, Length(Recording.SoundCard)); + for SC := 0 to High(Recording.SoundCard) do + ICard[SC] := Recording.SoundCard[SC].Description; +// end; + +// if Length(Recording.SoundCard[Ini.Card].Input) > 0 then begin + SetLength(IInput, Length(Recording.SoundCard[Ini.Card].Input)); + for SCI := 0 to High(Recording.SoundCard[Ini.Card].Input) do + IInput[SCI] := Recording.SoundCard[Ini.Card].Input[SCI].Name; +// end; + + + AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, Ini.Card, ICard); + SelectSlideInput := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, Ini.CardList[0].Input, IInput); + SelectSlideChannelL := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelL, Ini.CardList[0].ChannelL, IChannel); + SelectSlideChannelR := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelR, Ini.CardList[0].ChannelR, IChannel); + + AddButton(Theme.OptionsRecord.ButtonExit); + AddButtonText(14, 20, 'Exit'); + + Interaction := 0; +end; + +procedure TScreenOptionsRecord.onShow; +begin + Interaction := 0; +end; + +procedure TScreenOptionsRecord.UpdateCard; +var + SC: integer; + SCI: integer; +begin + SC := Ini.Card; +// if SC = 1 then beep; + + SetLength(IInput, Length(Recording.SoundCard[SC].Input)); + for SCI := 0 to High(Recording.SoundCard[SC].Input) do begin + IInput[SCI] := Recording.SoundCard[SC].Input[SCI].Name; +// Log.LogError(IInput[SCI]); + end; + + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideInput, SelectSlideInput, IInput, Ini.CardList[SC].Input); + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelL, SelectSlideChannelL, IChannel, Ini.CardList[SC].ChannelL); + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelR, SelectSlideChannelR, IChannel, Ini.CardList[SC].ChannelR); +end; + +end. \ No newline at end of file diff --git a/Game/Code/Screens/UScreenOptionsSound.dcu b/Game/Code/Screens/UScreenOptionsSound.dcu new file mode 100644 index 00000000..26c07fe1 Binary files /dev/null and b/Game/Code/Screens/UScreenOptionsSound.dcu differ diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas new file mode 100644 index 00000000..a99ae86d --- /dev/null +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -0,0 +1,93 @@ +unit UScreenOptionsSound; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + +type + TScreenOptionsSound = class(TMenu) + public + constructor Create(Back: String); override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + end; + +implementation + +uses UGraphic; + +function TScreenOptionsSound.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_ESCAPE : + begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 4 then begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + Music.PlayOption; + InteractInc; + end; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + Music.PlayOption; + InteractDec; + end; + end; + end; + end; +end; + +constructor TScreenOptionsSound.Create(Back: String); +var + I: integer; +begin + inherited Create(Back); + + AddBackground(Theme.OptionsSound.Background.Tex); + + for I := 0 to High(Theme.OptionsSound.Static) do + AddStatic(Theme.OptionsSound.Static[I]); + + for I := 0 to High(Theme.OptionsSound.Text) do + AddText(Theme.OptionsSound.Text[I]); + + AddSelect(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost); + AddSelect(Theme.OptionsSound.SelectClickAssist, Ini.ClickAssist, IClickAssist); + AddSelect(Theme.OptionsSound.SelectBeatClick, Ini.BeatClick, IBeatClick); + AddSelect(Theme.OptionsSound.SelectThreshold, Ini.Threshold, IThreshold); + //AddSelect(Theme.OptionsSound.SelectTwoPlayerMode, Ini.TwoPlayerMode, ITwoPlayerMode); + + AddButton(Theme.OptionsSound.ButtonExit); + AddButtonText(14, 20, 'Exit'); + + Interaction := 0; +end; + +procedure TScreenOptionsSound.onShow; +begin + Interaction := 0; +end; + +end. diff --git a/Game/Code/Screens/UScreenOptionsThemes.dcu b/Game/Code/Screens/UScreenOptionsThemes.dcu new file mode 100644 index 00000000..98bec8a2 Binary files /dev/null and b/Game/Code/Screens/UScreenOptionsThemes.dcu differ diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas new file mode 100644 index 00000000..b7d18fa5 --- /dev/null +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -0,0 +1,118 @@ +unit UScreenOptionsThemes; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + +type + TScreenOptionsThemes = class(TMenu) + public + SkinSelect: Integer; + constructor Create(Back: String); override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure InteractInc; override; + procedure InteractDec; override; + end; + +implementation + +uses UGraphic, USkins; + +function TScreenOptionsThemes.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_ESCAPE : + begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 3 then begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 2) then begin + Music.PlayOption; + InteractInc; + end; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 2) then begin + Music.PlayOption; + InteractDec; + end; + end; + end; + end; +end; + +procedure TScreenOptionsThemes.InteractInc; +begin + inherited InteractInc; + //Update Skins + if (SelInteraction = 0) then + begin + Skin.OnThemeChange; + UpdateSelectSlideOptions (Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); + end; +end; + +procedure TScreenOptionsThemes.InteractDec; +begin + inherited InteractDec; + //Update Skins + if (SelInteraction = 0) then + begin + Skin.OnThemeChange; + UpdateSelectSlideOptions (Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); + end; +end; + +constructor TScreenOptionsThemes.Create(Back: String); +var + I: integer; +begin + inherited Create(Back); + + AddBackground(Theme.OptionsThemes.Background.Tex); + + for I := 0 to High(Theme.OptionsThemes.Static) do + AddStatic(Theme.OptionsThemes.Static[I]); + + for I := 0 to High(Theme.OptionsThemes.Text) do + AddText(Theme.OptionsThemes.Text[I]); + + AddSelectSlide(Theme.OptionsThemes.SelectTheme, Ini.Theme, ITheme); + //SelectsS[High(SelectsS)].SetSelectOpt(Ini.Theme); + + SkinSelect := AddSelectSlide(Theme.OptionsThemes.SelectSkin, Ini.SkinNo, ISkin); + + //AddSelectSlideOption('SingStar'); + AddSelectSlide(Theme.OptionsThemes.SelectColor, Ini.Color, IColor); + + AddButton(Theme.OptionsThemes.ButtonExit); + AddButtonText(14, 20, 'Exit'); +end; + +procedure TScreenOptionsThemes.onShow; +begin + Interaction := 0; +end; + +end. diff --git a/Game/Code/Screens/UScreenPartyNewRound.dcu b/Game/Code/Screens/UScreenPartyNewRound.dcu new file mode 100644 index 00000000..24b6953e Binary files /dev/null and b/Game/Code/Screens/UScreenPartyNewRound.dcu differ diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas new file mode 100644 index 00000000..1e9be1f5 --- /dev/null +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -0,0 +1,397 @@ +unit UScreenPartyNewRound; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + +type + TScreenPartyNewRound = class(TMenu) + public + //Texts: + TextRound1: Cardinal; + TextRound2: Cardinal; + TextRound3: Cardinal; + TextRound4: Cardinal; + TextRound5: Cardinal; + TextRound6: Cardinal; + TextRound7: Cardinal; + + TextWinner1: Cardinal; + TextWinner2: Cardinal; + TextWinner3: Cardinal; + TextWinner4: Cardinal; + TextWinner5: Cardinal; + TextWinner6: Cardinal; + TextWinner7: Cardinal; + + TextNextRound: Cardinal; + TextNextRoundNo: Cardinal; + TextNextPlayer1: Cardinal; + TextNextPlayer2: Cardinal; + TextNextPlayer3: Cardinal; + //Statics + StaticRound1: Cardinal; + StaticRound2: Cardinal; + StaticRound3: Cardinal; + StaticRound4: Cardinal; + StaticRound5: Cardinal; + StaticRound6: Cardinal; + StaticRound7: Cardinal; + + //Scores + TextScoreTeam1: Cardinal; + TextScoreTeam2: Cardinal; + TextScoreTeam3: Cardinal; + TextNameTeam1: Cardinal; + TextNameTeam2: Cardinal; + TextNameTeam3: Cardinal; + + StaticTeam1: Cardinal; + StaticTeam2: Cardinal; + StaticTeam3: Cardinal; + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + end; + +implementation + +uses UGraphic, UMain, UIni, UTexture, UParty, UDLLManager, ULanguage, ULog; + +function TScreenPartyNewRound.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 + Music.PlayBack; + FadeTo(@ScreenMain); + end; + + SDLK_RETURN: + begin + Music.PlayStart; + if DLLMan.Selected.LoadSong then + begin + //Select PartyMode ScreenSong + ScreenSong.Mode := 1; + FadeTo(@ScreenSong); + end + else + begin + FadeTo(@ScreenSingModi); + end; + end; + + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN : + begin + end; + end; +end; + +constructor TScreenPartyNewRound.Create; +var + I: integer; +begin + inherited Create; + + AddBackground(Theme.PartyNewRound.Background.Tex); + Log.LogError(Theme.PartyNewRound.Background.Tex); + + TextRound1 := AddText (Theme.PartyNewRound.TextRound1); + TextRound2 := AddText (Theme.PartyNewRound.TextRound2); + TextRound3 := AddText (Theme.PartyNewRound.TextRound3); + TextRound4 := AddText (Theme.PartyNewRound.TextRound4); + TextRound5 := AddText (Theme.PartyNewRound.TextRound5); + TextRound6 := AddText (Theme.PartyNewRound.TextRound6); + TextRound7 := AddText (Theme.PartyNewRound.TextRound7); + + TextWinner1 := AddText (Theme.PartyNewRound.TextWinner1); + TextWinner2 := AddText (Theme.PartyNewRound.TextWinner2); + TextWinner3 := AddText (Theme.PartyNewRound.TextWinner3); + TextWinner4 := AddText (Theme.PartyNewRound.TextWinner4); + TextWinner5 := AddText (Theme.PartyNewRound.TextWinner5); + TextWinner6 := AddText (Theme.PartyNewRound.TextWinner6); + TextWinner7 := AddText (Theme.PartyNewRound.TextWinner7); + + TextNextRound := AddText (Theme.PartyNewRound.TextNextRound); + TextNextRoundNo := AddText (Theme.PartyNewRound.TextNextRoundNo); + TextNextPlayer1 := AddText (Theme.PartyNewRound.TextNextPlayer1); + TextNextPlayer2 := AddText (Theme.PartyNewRound.TextNextPlayer2); + TextNextPlayer3 := AddText (Theme.PartyNewRound.TextNextPlayer3); + + StaticRound1 := AddStatic (Theme.PartyNewRound.StaticRound1); + StaticRound2 := AddStatic (Theme.PartyNewRound.StaticRound2); + StaticRound3 := AddStatic (Theme.PartyNewRound.StaticRound3); + StaticRound4 := AddStatic (Theme.PartyNewRound.StaticRound4); + StaticRound5 := AddStatic (Theme.PartyNewRound.StaticRound5); + StaticRound6 := AddStatic (Theme.PartyNewRound.StaticRound6); + StaticRound7 := AddStatic (Theme.PartyNewRound.StaticRound7); + + //Scores + TextScoreTeam1 := AddText (Theme.PartyNewRound.TextScoreTeam1); + TextScoreTeam2 := AddText (Theme.PartyNewRound.TextScoreTeam2); + TextScoreTeam3 := AddText (Theme.PartyNewRound.TextScoreTeam3); + TextNameTeam1 := AddText (Theme.PartyNewRound.TextNameTeam1); + TextNameTeam2 := AddText (Theme.PartyNewRound.TextNameTeam2); + TextNameTeam3 := AddText (Theme.PartyNewRound.TextNameTeam3); + + StaticTeam1 := AddStatic (Theme.PartyNewRound.StaticTeam1); + StaticTeam2 := AddStatic (Theme.PartyNewRound.StaticTeam2); + StaticTeam3 := AddStatic (Theme.PartyNewRound.StaticTeam3); + + AddButton (Theme.PartyNewRound.ButtonNext); + + for I := 0 to High(Theme.PartyNewRound.Static) do + AddStatic(Theme.PartyNewRound.Static[I]); + + for I := 0 to High(Theme.PartyNewRound.Text) do + AddText(Theme.PartyNewRound.Text[I]); + + Interaction := 0; +end; + +procedure TScreenPartyNewRound.onShow; +var + I: Integer; +begin + //If not First Round, End Last Round + if (PartySession.CurRound <> 255) then + PartySession.EndRound; + + PartySession.StartRound; + Log.LogError(InttoStr(Length(DllMan.Plugins))); + + //Set Visibility of Round Infos + I := Length(PartySession.Rounds); + if (I >= 1) then + begin + Static[StaticRound1].Visible := True; + Text[TextRound1].Visible := True; + Text[TextWinner1].Visible := True; + + //Texts: + Text[TextRound1].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[0].Plugin].Name); + Text[TextWinner1].Text := PartySession.GetWinnerString(0); + end + else + begin + Static[StaticRound1].Visible := False; + Text[TextRound1].Visible := False; + Text[TextWinner1].Visible := False; + end; + + if (I >= 2) then + begin + Static[StaticRound2].Visible := True; + Text[TextRound2].Visible := True; + Text[TextWinner2].Visible := True; + + //Texts: + Text[TextRound2].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[1].Plugin].Name); + Text[TextWinner2].Text := PartySession.GetWinnerString(1); + end + else + begin + Static[StaticRound2].Visible := False; + Text[TextRound2].Visible := False; + Text[TextWinner2].Visible := False; + end; + + if (I >= 3) then + begin + Static[StaticRound3].Visible := True; + Text[TextRound3].Visible := True; + Text[TextWinner3].Visible := True; + + //Texts: + Text[TextRound3].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[2].Plugin].Name); + Text[TextWinner3].Text := PartySession.GetWinnerString(2); + end + else + begin + Static[StaticRound3].Visible := False; + Text[TextRound3].Visible := False; + Text[TextWinner3].Visible := False; + end; + + if (I >= 4) then + begin + Static[StaticRound4].Visible := True; + Text[TextRound4].Visible := True; + Text[TextWinner4].Visible := True; + + //Texts: + Text[TextRound4].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[3].Plugin].Name); + Text[TextWinner4].Text := PartySession.GetWinnerString(3); + end + else + begin + Static[StaticRound4].Visible := False; + Text[TextRound4].Visible := False; + Text[TextWinner4].Visible := False; + end; + + if (I >= 5) then + begin + Static[StaticRound5].Visible := True; + Text[TextRound5].Visible := True; + Text[TextWinner5].Visible := True; + + //Texts: + Text[TextRound5].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[4].Plugin].Name); + Text[TextWinner5].Text := PartySession.GetWinnerString(4); + end + else + begin + Static[StaticRound5].Visible := False; + Text[TextRound5].Visible := False; + Text[TextWinner5].Visible := False; + end; + + if (I >= 6) then + begin + Static[StaticRound6].Visible := True; + Text[TextRound6].Visible := True; + Text[TextWinner6].Visible := True; + + //Texts: + Text[TextRound6].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[5].Plugin].Name); + Text[TextWinner6].Text := PartySession.GetWinnerString(5); + end + else + begin + Static[StaticRound6].Visible := False; + Text[TextRound6].Visible := False; + Text[TextWinner6].Visible := False; + end; + + if (I >= 7) then + begin + Static[StaticRound7].Visible := True; + Text[TextRound7].Visible := True; + Text[TextWinner7].Visible := True; + + //Texts: + Text[TextRound7].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[6].Plugin].Name); + Text[TextWinner7].Text := PartySession.GetWinnerString(6); + end + else + begin + Static[StaticRound7].Visible := False; + Text[TextRound7].Visible := False; + Text[TextWinner7].Visible := False; + end; + + //Display Scores + if (PartySession.Teams.NumTeams >= 1) then + begin + Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[0].Score); + Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[0].Name); + + Text[TextScoreTeam1].Visible := True; + Text[TextNameTeam1].Visible := True; + Static[StaticTeam1].Visible := True; + end + else + begin + Text[TextScoreTeam1].Visible := False; + Text[TextNameTeam1].Visible := False; + Static[StaticTeam1].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 2) then + begin + Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[1].Score); + Text[TextNameTeam2].Text := String(PartySession.Teams.TeamInfo[1].Name); + + Text[TextScoreTeam2].Visible := True; + Text[TextNameTeam2].Visible := True; + Static[StaticTeam2].Visible := True; + end + else + begin + Text[TextScoreTeam2].Visible := False; + Text[TextNameTeam2].Visible := False; + Static[StaticTeam2].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 3) then + begin + Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[2].Score); + Text[TextNameTeam3].Text := String(PartySession.Teams.TeamInfo[2].Name); + + Text[TextScoreTeam3].Visible := True; + Text[TextNameTeam3].Visible := True; + Static[StaticTeam3].Visible := True; + end + else + begin + Text[TextScoreTeam3].Visible := False; + Text[TextNameTeam3].Visible := False; + Static[StaticTeam3].Visible := False; + end; + + //nextRound Texts + Text[TextNextRound].Text := Language.Translate(DllMan.Selected.PluginDesc); + Text[TextNextRoundNo].Text := InttoStr(PartySession.CurRound + 1); + if (PartySession.Teams.NumTeams >= 1) then + begin + Text[TextNextPlayer1].Text := PartySession.Teams.Teaminfo[0].Playerinfo[PartySession.Teams.Teaminfo[0].CurPlayer].Name; + Text[TextNextPlayer1].Visible := True; + end + else + Text[TextNextPlayer1].Visible := False; + + if (PartySession.Teams.NumTeams >= 2) then + begin + Text[TextNextPlayer2].Text := PartySession.Teams.Teaminfo[1].Playerinfo[PartySession.Teams.Teaminfo[1].CurPlayer].Name; + Text[TextNextPlayer2].Visible := True; + end + else + Text[TextNextPlayer2].Visible := False; + + if (PartySession.Teams.NumTeams >= 3) then + begin + Text[TextNextPlayer3].Text := PartySession.Teams.Teaminfo[2].Playerinfo[PartySession.Teams.Teaminfo[2].CurPlayer].Name; + Text[TextNextPlayer3].Visible := True; + end + else + Text[TextNextPlayer3].Visible := False; + + Log.LogError('Plugin Selected: ' + InttoStr(PartySession.Rounds[0].Plugin)); + + +// LCD.WriteText(1, ' Choose mode: '); +// UpdateLCD; +end; + +procedure TScreenPartyNewRound.SetAnimationProgress(Progress: real); +begin + {Button[0].Texture.ScaleW := Progress; + Button[1].Texture.ScaleW := Progress; + Button[2].Texture.ScaleW := Progress; } +end; + +end. diff --git a/Game/Code/Screens/UScreenPartyOptions.dcu b/Game/Code/Screens/UScreenPartyOptions.dcu new file mode 100644 index 00000000..8f0bbf3d Binary files /dev/null and b/Game/Code/Screens/UScreenPartyOptions.dcu differ diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas new file mode 100644 index 00000000..148289e8 --- /dev/null +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -0,0 +1,164 @@ +unit UScreenPartyOptions; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + +type + TScreenPartyOptions = class(TMenu) + public + SelectLevel: Cardinal; + SelectPlayList: Cardinal; + SelectPlayList2: Cardinal; + SelectRounds: Cardinal; + SelectTeams: Cardinal; + SelectPlayers1: Cardinal; + SelectPlayers2: Cardinal; + SelectPlayers3: Cardinal; + + PlayList: Integer; + PlayList2: Integer; + Rounds: Integer; + NumTeams: Integer; + NumPlayer1, NumPlayer2, NumPlayer3: Integer; + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + end; + +var + ILevel: array[0..2] of String; +const + ITeams: array[0..1] of String =('2', '3'); + IPlayers: array[0..3] of String =('1', '2', '3', '4'); + IRounds: array[0..5] of String = ('2', '3', '4', '5', '6', '7'); + +implementation + +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UDLLManager; + +function TScreenPartyOptions.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var I: Integer; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE : + begin + Music.PlayBack; + FadeTo(@ScreenMain); + end; + + SDLK_RETURN: + begin + + //Save Difficulty + Ini.Difficulty := SelectsS[SelectLevel].SelectedOption; + Ini.SaveLevel; + //Save PlayList + //(Todo) + //Save Num Teams: + PartySession.Teams.NumTeams := NumTeams + 2; + PartySession.Teams.Teaminfo[0].NumPlayers := NumPlayer1+1; + PartySession.Teams.Teaminfo[1].NumPlayers := NumPlayer2+1; + PartySession.Teams.Teaminfo[2].NumPlayers := NumPlayer3+1; + //Save Rounds + Random + SetLength (PartySession.Rounds, Rounds + 2); + For I := 0 to high (PartySession.Rounds) do + begin + PartySession.Rounds[I].Plugin := Random (Length(DLLMan.Plugins)); + PartySession.Rounds[I].Winner := 0; + end; + Music.PlayStart; + //Go to Player Screen + FadeTo(@ScreenPartyPlayer); + end; + + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; + SDLK_RIGHT: + begin + Music.PlayOption; + InteractInc; + end; + SDLK_LEFT: + begin + Music.PlayOption; + InteractDec; + end; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN : + begin + end; + end; +end; + +constructor TScreenPartyOptions.Create; +var + I: integer; +begin + inherited Create; + + //Fill ILevel + ILevel[0] := Language.Translate('SING_EASY'); + ILevel[1] := Language.Translate('SING_MEDIUM'); + ILevel[2] := Language.Translate('SING_HARD'); + + NumTeams := 0; + NumPlayer1 := 0; + NumPlayer2 := 0; + NumPlayer3 := 0; + Rounds := 5; + PlayList := 0; + PlayList2 := 0; + + AddBackground(Theme.PartyOptions.Background.Tex); + + SelectLevel := AddSelectSlide (Theme.PartyOptions.SelectLevel, Ini.Difficulty, ILevel); + SelectPlayList := AddSelectSlide (Theme.PartyOptions.SelectPlayList, PlayList, ITeams); + SelectPlayList2 := AddSelectSlide (Theme.PartyOptions.SelectPlayList2, PlayList2, ITeams); + SelectRounds := AddSelectSlide (Theme.PartyOptions.SelectRounds, Rounds, IRounds); + SelectTeams := AddSelectSlide (Theme.PartyOptions.SelectTeams, NumTeams, ITeams); + SelectPlayers1 := AddSelectSlide (Theme.PartyOptions.SelectPlayers1, NumPlayer1, IPlayers); + SelectPlayers2 := AddSelectSlide (Theme.PartyOptions.SelectPlayers2, NumPlayer2, IPlayers); + SelectPlayers3 := AddSelectSlide (Theme.PartyOptions.SelectPlayers3, NumPlayer3, IPlayers); + + for I := 0 to High(Theme.PartyOptions.Static) do + AddStatic(Theme.PartyOptions.Static[I]); + + for I := 0 to High(Theme.PartyOptions.Text) do + AddText(Theme.PartyOptions.Text[I]); + + Interaction := 0; +end; + +procedure TScreenPartyOptions.onShow; +begin + Randomize; + +// LCD.WriteText(1, ' Choose mode: '); +// UpdateLCD; +end; + +procedure TScreenPartyOptions.SetAnimationProgress(Progress: real); +begin + {for I := 0 to 6 do + SelectS[I].Texture.ScaleW := Progress;} +end; + +end. diff --git a/Game/Code/Screens/UScreenPartyPlayer.dcu b/Game/Code/Screens/UScreenPartyPlayer.dcu new file mode 100644 index 00000000..1afeac79 Binary files /dev/null and b/Game/Code/Screens/UScreenPartyPlayer.dcu differ diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas new file mode 100644 index 00000000..b954212a --- /dev/null +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -0,0 +1,210 @@ +unit UScreenPartyPlayer; + +Interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + +type + TScreenPartyPlayer = class(TMenu) + public + Team1Name: Cardinal; + Player1Name: Cardinal; + Player2Name: Cardinal; + Player3Name: Cardinal; + Player4Name: Cardinal; + + Team2Name: Cardinal; + Player5Name: Cardinal; + Player6Name: Cardinal; + Player7Name: Cardinal; + Player8Name: Cardinal; + + Team3Name: Cardinal; + Player9Name: Cardinal; + Player10Name: Cardinal; + Player11Name: Cardinal; + Player12Name: Cardinal; + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + end; + +implementation + +uses UGraphic, UMain, UIni, UTexture, UParty; + +function TScreenPartyPlayer.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var + I, J: integer; + procedure IntNext; + begin + repeat + InteractNext; + until Button[Interaction].Visible; + end; + procedure IntPrev; + begin + repeat + InteractPrev; + until Button[Interaction].Visible; + end; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_0..SDLK_9, SDLK_A..SDLK_Z, SDLK_SPACE, SDLK_MINUS, SDLK_EXCLAIM, SDLK_COMMA, SDLK_SLASH, SDLK_ASTERISK, SDLK_QUESTION, SDLK_QUOTE, SDLK_QUOTEDBL: + begin + Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + chr(ScanCode); + end; + + SDLK_BACKSPACE: + begin + Delete(Button[Interaction].Text[0].Text, + Length(Button[Interaction].Text[0].Text), 1); + end; + + SDLK_ESCAPE : + begin + Ini.SaveNames; + Music.PlayBack; + FadeTo(@ScreenPartyOptions); + end; + + SDLK_RETURN: + begin + + for I := 0 to PartySession.Teams.NumTeams-1 do + begin + PartySession.Teams.Teaminfo[I].Name := PChar(Button[I*5].Text[0].Text); + for J := 0 to PartySession.Teams.Teaminfo[I].NumPlayers-1 do + begin + PartySession.Teams.Teaminfo[I].Playerinfo[J].Name := PChar(Button[I*5 + J+1].Text[0].Text); + PartySession.Teams.Teaminfo[I].Playerinfo[J].TimesPlayed := 0; + end; + PartySession.Teams.Teaminfo[I].Joker := Round (Length(PartySession.Rounds) * 0.85); + end; + + + //Start Party + PartySession.StartNewParty; + + Music.PlayStart; + FadeTo(@ScreenPartyNewRound); + end; + + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN: IntNext; + SDLK_UP: IntPrev; + SDLK_RIGHT: IntNext; + SDLK_LEFT: IntPrev; + end; + end; +end; + +constructor TScreenPartyPlayer.Create; +var + I: integer; +begin + inherited Create; + + AddBackground(Theme.PartyPlayer.Background.Tex); + + Team1Name := AddButton(Theme.PartyPlayer.Team1Name); + AddButton(Theme.PartyPlayer.Player1Name); + AddButton(Theme.PartyPlayer.Player2Name); + AddButton(Theme.PartyPlayer.Player3Name); + AddButton(Theme.PartyPlayer.Player4Name); + + Team2Name := AddButton(Theme.PartyPlayer.Team2Name); + AddButton(Theme.PartyPlayer.Player5Name); + AddButton(Theme.PartyPlayer.Player6Name); + AddButton(Theme.PartyPlayer.Player7Name); + AddButton(Theme.PartyPlayer.Player8Name); + + Team3Name := AddButton(Theme.PartyPlayer.Team3Name); + AddButton(Theme.PartyPlayer.Player9Name); + AddButton(Theme.PartyPlayer.Player10Name); + AddButton(Theme.PartyPlayer.Player11Name); + AddButton(Theme.PartyPlayer.Player12Name); + + for I := 0 to High(Theme.PartyPlayer.Static) do + AddStatic(Theme.PartyPlayer.Static[I]); + + for I := 0 to High(Theme.PartyPlayer.Text) do + AddText(Theme.PartyPlayer.Text[I]); + + Interaction := 0; +end; + +procedure TScreenPartyPlayer.onShow; +var + I: integer; +begin + If (PartySession.Teams.NumTeams>=1) then + begin + Button[0].Visible := True; + Button[1].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=1); + Button[2].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=2); + Button[3].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=3); + Button[4].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=4); + end + else + begin + Button[0].Visible := False; + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := False; + Button[4].Visible := False; + end; + + If (PartySession.Teams.NumTeams>=2) then + begin + Button[5].Visible := True; + Button[6].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=1); + Button[7].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=2); + Button[8].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=3); + Button[9].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=4); + end + else + begin + Button[5].Visible := False; + Button[6].Visible := False; + Button[7].Visible := False; + Button[8].Visible := False; + Button[9].Visible := False; + end; + + If (PartySession.Teams.NumTeams>=3) then + begin + Button[10].Visible := True; + Button[11].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=1); + Button[12].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=2); + Button[13].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=3); + Button[14].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=4); + end + else + begin + Button[10].Visible := False; + Button[11].Visible := False; + Button[12].Visible := False; + Button[13].Visible := False; + Button[14].Visible := False; + end; + +end; + +procedure TScreenPartyPlayer.SetAnimationProgress(Progress: real); +var + I: integer; +begin + for I := 0 to high(Button) do + Button[I].Texture.ScaleW := Progress; +end; + +end. diff --git a/Game/Code/Screens/UScreenPartyScore.dcu b/Game/Code/Screens/UScreenPartyScore.dcu new file mode 100644 index 00000000..9dffe2e5 Binary files /dev/null and b/Game/Code/Screens/UScreenPartyScore.dcu differ diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas new file mode 100644 index 00000000..9cbeb5d5 --- /dev/null +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -0,0 +1,183 @@ +unit UScreenPartyScore; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, SysUtils, UThemes; + +type + TScreenPartyScore = class(TMenu) + public + TextScoreTeam1: Cardinal; + TextScoreTeam2: Cardinal; + TextScoreTeam3: Cardinal; + TextNameTeam1: Cardinal; + TextNameTeam2: Cardinal; + TextNameTeam3: Cardinal; + StaticTeam1: Cardinal; + StaticTeam2: Cardinal; + StaticTeam3: Cardinal; + TextWinner: Cardinal; + + MaxScore: Word; + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + end; + +implementation + +uses UGraphic, UMain, UParty, UScreenSingModi, ULanguage; + +function TScreenPartyScore.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 + Music.PlayStart; + if (PartySession.CurRound <= High(PartySession.Rounds)) then + FadeTo(@ScreenPartyNewRound) + else + begin + PartySession.EndRound; + FadeTo(@ScreenPartyWin); + end; + end; + + SDLK_RETURN: + begin + Music.PlayStart; + if (PartySession.CurRound <= High(PartySession.Rounds)) then + FadeTo(@ScreenPartyNewRound) + else + begin + PartySession.EndRound; + FadeTo(@ScreenPartyWin); + end; + end; + end; + end; +end; + +constructor TScreenPartyScore.Create; +var + I: integer; +begin + inherited Create; + + AddBackground(Theme.PartyScore.Background.Tex); + + TextScoreTeam1 := AddText (Theme.PartyScore.TextScoreTeam1); + TextScoreTeam2 := AddText (Theme.PartyScore.TextScoreTeam2); + TextScoreTeam3 := AddText (Theme.PartyScore.TextScoreTeam3); + TextNameTeam1 := AddText (Theme.PartyScore.TextNameTeam1); + TextNameTeam2 := AddText (Theme.PartyScore.TextNameTeam2); + TextNameTeam3 := AddText (Theme.PartyScore.TextNameTeam3); + + StaticTeam1 := AddStatic (Theme.PartyScore.StaticTeam1); + StaticTeam2 := AddStatic (Theme.PartyScore.StaticTeam2); + StaticTeam3 := AddStatic (Theme.PartyScore.StaticTeam3); + + TextWinner := AddText (Theme.PartyScore.TextWinner); + + for I := 0 to High(Theme.PartyScore.Static) do + AddStatic(Theme.PartyScore.Static[I]); + + for I := 0 to High(Theme.PartyScore.Text) do + AddText(Theme.PartyScore.Text[I]); +end; + +procedure TScreenPartyScore.onShow; +var + I: Integer; +begin + //Get Maxscore + MaxScore := 0; + for I := 0 to ScreenSingModi.PlayerInfo.NumPlayers - 1 do + begin + if (ScreenSingModi.PlayerInfo.Playerinfo[I].Score > MaxScore) then + MaxScore := ScreenSingModi.PlayerInfo.Playerinfo[I].Score; + end; + + //Set Static Length + Static[StaticTeam1].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[0].Percentage / 100; + Static[StaticTeam2].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100; + Static[StaticTeam3].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[2].Percentage / 100; + + //Set Winnertext + Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.GetWinnerString(PartySession.CurRound)]); + + if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then + begin + Text[TextScoreTeam1].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[0].Score); + Text[TextNameTeam1].Text := String(ScreenSingModi.TeamInfo.Teaminfo[0].Name); + + Text[TextScoreTeam1].Visible := True; + Text[TextNameTeam1].Visible := True; + Static[StaticTeam1].Visible := True; + end + else + begin + Text[TextScoreTeam1].Visible := False; + Text[TextNameTeam1].Visible := False; + Static[StaticTeam1].Visible := False; + end; + + if (ScreenSingModi.PlayerInfo.NumPlayers >= 2) then + begin + Text[TextScoreTeam2].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[1].Score); + Text[TextNameTeam2].Text := String(ScreenSingModi.TeamInfo.Teaminfo[1].Name); + + Text[TextScoreTeam2].Visible := True; + Text[TextNameTeam2].Visible := True; + Static[StaticTeam2].Visible := True; + end + else + begin + Text[TextScoreTeam2].Visible := False; + Text[TextNameTeam2].Visible := False; + Static[StaticTeam2].Visible := False; + end; + + if (ScreenSingModi.PlayerInfo.NumPlayers >= 3) then + begin + Text[TextScoreTeam3].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[2].Score); + Text[TextNameTeam3].Text := String(ScreenSingModi.TeamInfo.Teaminfo[2].Name); + + Text[TextScoreTeam3].Visible := True; + Text[TextNameTeam3].Visible := True; + Static[StaticTeam3].Visible := True; + end + else + begin + Text[TextScoreTeam3].Visible := False; + Text[TextNameTeam3].Visible := False; + Static[StaticTeam3].Visible := False; + end; + + +// LCD.WriteText(1, ' Choose mode: '); +// UpdateLCD; +end; + +procedure TScreenPartyScore.SetAnimationProgress(Progress: real); +begin + if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then + Static[StaticTeam1].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[0].Percentage / 100; + if (ScreenSingModi.PlayerInfo.NumPlayers >= 2) then + Static[StaticTeam2].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100; + if (ScreenSingModi.PlayerInfo.NumPlayers >= 3) then + Static[StaticTeam3].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[2].Percentage / 100; +end; + +end. diff --git a/Game/Code/Screens/UScreenPartyWin.dcu b/Game/Code/Screens/UScreenPartyWin.dcu new file mode 100644 index 00000000..d55c0809 Binary files /dev/null and b/Game/Code/Screens/UScreenPartyWin.dcu differ diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas new file mode 100644 index 00000000..ac5f38d9 --- /dev/null +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -0,0 +1,157 @@ +unit UScreenPartyWin; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, SysUtils, UThemes; + +type + TScreenPartyWin = class(TMenu) + public + TextScoreTeam1: Cardinal; + TextScoreTeam2: Cardinal; + TextScoreTeam3: Cardinal; + TextNameTeam1: Cardinal; + TextNameTeam2: Cardinal; + TextNameTeam3: Cardinal; + StaticTeam1: Cardinal; + StaticTeam2: Cardinal; + StaticTeam3: Cardinal; + TextWinner: Cardinal; + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + end; + +implementation + +uses UGraphic, UMain, UParty, UScreenSingModi, ULanguage; + +function TScreenPartyWin.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 + Music.PlayStart; + FadeTo(@ScreenMain); + end; + + SDLK_RETURN: + begin + Music.PlayStart; + FadeTo(@ScreenMain); + end; + end; + end; +end; + +constructor TScreenPartyWin.Create; +var + I: integer; +begin + inherited Create; + + AddBackground(Theme.PartyWin.Background.Tex); + + TextScoreTeam1 := AddText (Theme.PartyWin.TextScoreTeam1); + TextScoreTeam2 := AddText (Theme.PartyWin.TextScoreTeam2); + TextScoreTeam3 := AddText (Theme.PartyWin.TextScoreTeam3); + TextNameTeam1 := AddText (Theme.PartyWin.TextNameTeam1); + TextNameTeam2 := AddText (Theme.PartyWin.TextNameTeam2); + TextNameTeam3 := AddText (Theme.PartyWin.TextNameTeam3); + + StaticTeam1 := AddStatic (Theme.PartyWin.StaticTeam1); + StaticTeam2 := AddStatic (Theme.PartyWin.StaticTeam2); + StaticTeam3 := AddStatic (Theme.PartyWin.StaticTeam3); + + TextWinner := AddText (Theme.PartyWin.TextWinner); + + for I := 0 to High(Theme.PartyWin.Static) do + AddStatic(Theme.PartyWin.Static[I]); + + for I := 0 to High(Theme.PartyWin.Text) do + AddText(Theme.PartyWin.Text[I]); +end; + +procedure TScreenPartyWin.onShow; +var + I: Integer; +begin + + //Set Winnertext + Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.GetWinnerString(255)]); + + if (PartySession.Teams.NumTeams >= 1) then + begin + Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[0].Score); + Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[0].Name); + + Text[TextScoreTeam1].Visible := True; + Text[TextNameTeam1].Visible := True; + Static[StaticTeam1].Visible := True; + end + else + begin + Text[TextScoreTeam1].Visible := False; + Text[TextNameTeam1].Visible := False; + Static[StaticTeam1].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 2) then + begin + Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[1].Score); + Text[TextNameTeam2].Text := String(PartySession.Teams.TeamInfo[1].Name); + + Text[TextScoreTeam2].Visible := True; + Text[TextNameTeam2].Visible := True; + Static[StaticTeam2].Visible := True; + end + else + begin + Text[TextScoreTeam2].Visible := False; + Text[TextNameTeam2].Visible := False; + Static[StaticTeam2].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 3) then + begin + Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[2].Score); + Text[TextNameTeam3].Text := String(PartySession.Teams.TeamInfo[2].Name); + + Text[TextScoreTeam3].Visible := True; + Text[TextNameTeam3].Visible := True; + Static[StaticTeam3].Visible := True; + end + else + begin + Text[TextScoreTeam3].Visible := False; + Text[TextNameTeam3].Visible := False; + Static[StaticTeam3].Visible := False; + end; + + +// LCD.WriteText(1, ' Choose mode: '); +// UpdateLCD; +end; + +procedure TScreenPartyWin.SetAnimationProgress(Progress: real); +begin + {if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then + Static[StaticTeam1].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[0].Score / maxScore; + if (ScreenSingModi.PlayerInfo.NumPlayers >= 2) then + Static[StaticTeam2].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[1].Score / maxScore; + if (ScreenSingModi.PlayerInfo.NumPlayers >= 3) then + Static[StaticTeam3].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[2].Score / maxScore;} +end; + +end. diff --git a/Game/Code/Screens/UScreenScore.dcu b/Game/Code/Screens/UScreenScore.dcu new file mode 100644 index 00000000..eee72fd0 Binary files /dev/null and b/Game/Code/Screens/UScreenScore.dcu differ diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas new file mode 100644 index 00000000..2e509a6f --- /dev/null +++ b/Game/Code/Screens/UScreenScore.pas @@ -0,0 +1,586 @@ +unit UScreenScore; + +interface + +uses + UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes, ULCD, OpenGL; + +type + TScreenScore = class(TMenu) + public + TextArtist: integer; + TextTitle: integer; + + TextName: array[1..6] of integer; + TextScore: array[1..6] of integer; + + TextNotes: array[1..6] of integer; + TextNotesScore: array[1..6] of integer; + TextLineBonus: array[1..6] of integer; + TextLineBonusScore: array[1..6] of integer; + TextGoldenNotes: array[1..6] of integer; + TextGoldenNotesScore: array[1..6] of integer; + TextTotal: array[1..6] of integer; + TextTotalScore: array[1..6] of integer; + + PlayerStatic: array[1..6] of array of integer; + + StaticBoxLightest: array[1..6] of integer; + StaticBoxLight: array[1..6] of integer; + StaticBoxDark: array[1..6] of integer; + + StaticBackLevel: array[1..6] of integer; + StaticBackLevelRound: array[1..6] of integer; + StaticLevel: array[1..6] of integer; + StaticLevelRound: array[1..6] of integer; + + Animation: real; + Fadeout: boolean; + constructor Create(Back: String); override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + function Draw: boolean; override; + procedure FillPlayer(Item, P: integer); + end; + +implementation + +{$IFDEF TRANSLATE} +uses UGraphic, UScreenSong, UMenuStatic, UTime, UMain, UIni, ULanguage; +{$ELSE} +uses UGraphic, UScreenSong, UMenuStatic, UTime, UMain, UIni; +{$ENDIF} +function TScreenScore.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then begin + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE : + begin + if (not Fadeout) then begin +// Music.StopShuffle; + FadeTo(@ScreenTop5); + Fadeout := true; + end; + end; + SDLK_RETURN: + begin + if (not Fadeout) then begin +// Music.StopShuffle; + FadeTo(@ScreenTop5); + Fadeout := true; + end; + end; +{ SDLK_SYSREQ: + begin + beep; + end;} + SDLK_SYSREQ: + begin + Display.PrintScreen; + end; + end; + end; +end; + +constructor TScreenScore.Create(Back: String); +var + P: integer; + I: integer; +begin + inherited Create(Back); + + // background arrows sorted from farthest to nearest +{ AddStatic(-2000 + 400, 100, 360, 60, 1, 1, 1, Skin.Arrow2, 'JPG', 'Arrow'); + AddStatic(-2000 + -50, 200, 420, 70, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); + AddStatic(-2000 + 90, 30, 500, 90, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); + AddStatic(-2000 + -250, 100, 800, 150, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); + + Static[0].Texture.Rot := 100 * pi/180; + Static[1].Texture.Rot := 7 * pi/180; + Static[2].Texture.Rot := 35 * pi/180; + + + // main arrow with text + AddStatic(0, 340, 1000, 180, 1, 1, 1, Skin.Arrow2, 'JPG', 'Arrow'); +// AddText(450, 409, 4, 15, 1, 1, 1, 'Smile'); + AddText(450, 409, 4, 15, 1, 1, 1, 'Let''s see the results'); + Text[0].Y := 401; + + Static[4].Texture.Rot := -3 * pi/180; + + + // two mid arrows + AddStatic(-2000 + -250, 100, 800, 150, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); + AddStatic(-2000 + -250, 100, 800, 150, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); + + + // last arrow + AddStatic(-2000, 340, 1100, 180, 1, 1, 1, Skin.Arrow2, 'JPG', 'Arrow'); +// AddText(-2000, 407, 4, 17, 1, 1, 1, 'SHUFFLE !'); + AddText(-2000, 407, 4, 15, 1, 1, 1, 'SHUFFLE !'); + + Static[7].Texture.Rot := 184 * pi/180; + + // score text + AddText(-2000, 407, 4, 17, 1, 1, 1, '10010 points'); + AddText(-2000, 407, 4, 17, 1, 1, 1, 'Cheater'); + + Fadeout := false;} + + + // Singstar Theme + AddBackground(Theme.Score.Background.Tex); + + for I := 0 to High(Theme.Score.Static) do + AddStatic(Theme.Score.Static[I]); + + for I := 0 to High(Theme.Score.Text) do + AddText(Theme.Score.Text[I]); + + TextArtist := AddText(Theme.Score.TextArtist); + TextTitle := AddText(Theme.Score.TextTitle); + + for P := 1 to 6 do begin + TextName[P] := AddText(Theme.Score.TextName[P]); + TextScore[P] := AddText(Theme.Score.TextScore[P]); + + TextNotes[P] := AddText(Theme.Score.TextNotes[P]); + TextNotesScore[P] := AddText(Theme.Score.TextNotesScore[P]); + TextLineBonus[P] := AddText(Theme.Score.TextLineBonus[P]); + TextLineBonusScore[P] := AddText(Theme.Score.TextLineBonusScore[P]); + TextGoldenNotes[P] := AddText(Theme.Score.TextGoldenNotes[P]); + TextGoldenNotesScore[P] := AddText(Theme.Score.TextGoldenNotesScore[P]); + TextTotal[P] := AddText(Theme.Score.TextTotal[P]); + TextTotalScore[P] := AddText(Theme.Score.TextTotalScore[P]); + + SetLength(PlayerStatic[P], Length(Theme.Score.PlayerStatic[P])); + for I := 0 to High(Theme.Score.PlayerStatic[P]) do + PlayerStatic[P, I] := AddStatic(Theme.Score.PlayerStatic[P, I]); + + StaticBoxLightest[P] := AddStatic(Theme.Score.StaticBoxLightest[P]); + StaticBoxLight[P] := AddStatic(Theme.Score.StaticBoxLight[P]); + StaticBoxDark[P] := AddStatic(Theme.Score.StaticBoxDark[P]); + + StaticBackLevel[P] := AddStatic(Theme.Score.StaticBackLevel[P]); + StaticBackLevelRound[P] := AddStatic(Theme.Score.StaticBackLevelRound[P]); + StaticLevel[P] := AddStatic(Theme.Score.StaticLevel[P]); + StaticLevelRound[P] := AddStatic(Theme.Score.StaticLevelRound[P]); + end; +end; + +procedure TScreenScore.onShow; +var + P: integer; // player + PP: integer; // another player variable + S: string; + I: integer; + Lev: real; + Skip: integer; + V: array[1..6] of boolean; // visibility array + MaxH: real; // maximum height of score bar + Wsp: real; +begin +{ CountSkipTimeSet; + + Animation := 0; + Fadeout := false; + + Text[1].Text := AktSong.Artist + ' - ' + AktSong.Title; + Text[2].Text := ' ' + IntToStr((Round(Gracz[0].Punkty) div 10) * 10) + ' points'; + + Static[0].Texture.X := -2000; + Static[1].Texture.X := -2000; + Static[2].Texture.X := -2000; + Static[3].Texture.X := -2000; + Static[4].Texture.X := -2000; + Static[5].Texture.X := -2000; + Static[6].Texture.X := -2000; + Static[7].Texture.X := -2000; + + Text[0].X := -2000; + Text[1].X := -2000; + Text[2].X := -2000; + Text[3].X := -2000; + + + case (Round(Gracz[0].Punkty) div 10) * 10 of + 0..1000: Text[3].Text := ' Tone Deaf'; + 2010..4000: Text[3].Text := ' Amateur'; + 4010..6000: Text[3].Text := ' Rising Star'; + 6010..8000: Text[3].Text := ' Lead Singer'; + 8010..9000: Text[3].Text := ' Hit Artist'; + 9010..10000: Text[3].Text := ' Superstar'; + end; + + Music.PlayShuffle;} + + // Singstar + Fadeout := false; + + Text[TextArtist].Text := AktSong.Artist; + Text[TextTitle].Text := AktSong.Title; + + // set visibility + case PlayersPlay of + 1: begin + V[1] := true; + V[2] := false; + V[3] := false; + V[4] := false; + V[5] := false; + V[6] := false; + end; + 2, 4: begin + V[1] := false; + V[2] := true; + V[3] := true; + V[4] := false; + V[5] := false; + V[6] := false; + end; + 3, 6: begin + V[1] := false; + V[2] := false; + V[3] := false; + V[4] := true; + V[5] := true; + V[6] := true; + end; + end; + + for P := 1 to 6 do begin + Text[TextName[P]].Visible := V[P]; + Text[TextScore[P]].Visible := V[P]; + + Text[TextNotes[P]].Visible := V[P]; + Text[TextNotesScore[P]].Visible := V[P]; + Text[TextLineBonus[P]].Visible := V[P]; + Text[TextLineBonusScore[P]].Visible := V[P]; + Text[TextGoldenNotes[P]].Visible := V[P]; + Text[TextGoldenNotesScore[P]].Visible := V[P]; + Text[TextTotal[P]].Visible := V[P]; + Text[TextTotalScore[P]].Visible := V[P]; + + for I := 0 to high(PlayerStatic[P]) do + Static[PlayerStatic[P, I]].Visible := V[P]; + + Static[StaticBoxLightest[P]].Visible := V[P]; + Static[StaticBoxLight[P]].Visible := V[P]; + Static[StaticBoxDark[P]].Visible := V[P]; + + Static[StaticBackLevel[P]].Visible := V[P]; + Static[StaticBackLevelRound[P]].Visible := V[P]; + Static[StaticLevel[P]].Visible := V[P]; + Static[StaticLevelRound[P]].Visible := V[P]; + end; + + if PlayersPlay <= 3 then begin // only for 1 screen mode + for P := 0 to PlayersPlay-1 do begin + case PlayersPlay of + 1: PP := 1; + 2: PP := P + 2; + 3: PP := P + 4; + end; + //PP := 1; + + Text[TextName[PP]].Text := Ini.Name[P]; + + {$IFDEF TRANSLATE} + case (Player[P].ScoreTotalI) of + 0..2000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_TONE_DEAF'); + 2010..4000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_AMATEUR'); + 4010..6000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_RISING_STAR'); + 6010..8000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_LEAD_SINGER'); + 8010..9000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_HIT_ARTIST'); + 9010..9800: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_SUPERSTAR'); + 9810..10000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_ULTRASTAR'); + end; + {$ELSE} + case (Player[P].ScoreTotalI) of + 0..2000: Text[TextScore[PP]].Text := 'Tone Deaf'; + 2010..4000: Text[TextScore[PP]].Text := 'Amateur'; + 4010..6000: Text[TextScore[PP]].Text := 'Rising Star'; + 6010..8000: Text[TextScore[PP]].Text := 'Lead Singer'; + 8010..9000: Text[TextScore[PP]].Text := 'Hit Artist'; + 9010..9800: Text[TextScore[PP]].Text := 'Superstar'; + 9810..10000: Text[TextScore[PP]].Text := 'Ultrastar'; + end; + {$ENDIF} + + S := IntToStr(Player[P].ScoreI); + while (Length(S)<4) do S := '0' + S; + Text[TextNotesScore[PP]].Text := S; + + S := IntToStr(Player[P].ScoreLineI); + while (Length(S)<4) do S := '0' + S; + Text[TextLineBonusScore[PP]].Text := S; + + S := IntToStr(Player[P].ScoreGoldenI); + while (Length(S)<4) do S := '0' + S; + Text[TextGoldenNotesScore[PP]].Text := S; + + S := IntToStr(Player[P].ScoreTotalI); + while (Length(S)<5) do S := '0' + S; + Text[TextTotalScore[PP]].Text := S; + + // Level bar length +{ Lev := ((Round(Player[P].Punkty) div 10) * 10) / 10000; + Static[StaticLevel[PP]].Texture.H := Round(Static[StaticBackLevel[PP]].Texture.H * Lev); + Static[StaticLevel[PP]].Texture.Y := Static[StaticBackLevel[PP]].Texture.Y + Static[StaticBackLevel[PP]].Texture.H - Static[StaticLevel[PP]].Texture.H; + Static[StaticLevelRound[PP]].Texture.Y := Static[StaticLevel[PP]].Texture.Y - Static[StaticLevelRound[PP]].Texture.H;} + // doesn't align too much... (to fix) + // hint: play with wrapping textures + // resolution: setting TexY1 and TexY2 to 0.1 and 0.9 + + Lev := Player[P].ScoreTotalI / 10000; + MaxH := Static[StaticBackLevel[PP]].Texture.H + Static[StaticBackLevelRound[PP]].Texture.H / 2; + + // developer note (Polish): + // w sumie np. 120 pix + // ten static moze miec 100 pix + // wlacza sie od 20 pix i rosnie do 120 pix + // wiec wysokosc = wyznaczona ilosc - 20 + // nie moze byc mniejsze od 0 + // Lev * MaxH = total number of pixels to draw + Static[StaticLevel[PP]].Visible := true; + Static[StaticLevel[PP]].Texture.H := Lev * MaxH - Static[StaticBackLevelRound[PP]].Texture.H / 2; + if Static[StaticLevel[PP]].Texture.H < 0 then Static[StaticLevel[PP]].Visible := false; + + // Y doesn't change and depend on the back texture coordinate + Static[StaticLevel[PP]].Texture.Y := Static[StaticBackLevel[PP]].Texture.Y + Static[StaticBackLevel[PP]].Texture.H - Static[StaticLevel[PP]].Texture.H; + + // we modify LevelRound texture by changing it's Y. TexY1 and TexY2 change when the height to draw is lower than 20 + if Lev * MaxH < Static[StaticBackLevelRound[PP]].Texture.H / 2 then begin + // when it's lower than 20 => we move TexY1 and TexY2 higher to show only part of this texture + Static[StaticLevelRound[PP]].Texture.Y := Static[StaticBackLevel[PP]].Texture.Y + Static[StaticBackLevel[PP]].Texture.H - Static[StaticBackLevelRound[PP]].Texture.H; + // - 0.25 when points = 0 + // - 0 wnen there are more points + // if Lev * MaxH = Static[StaticBackLevelRound[PP]].Texture.H / 2) then we do not change it + // if Lev * MaxH = 0 then we substract 0.25 + // we substract (0.25 - 0.25 * (Lev * MaxH)/Static[StaticBackLevelRound[PP]].Texture.H / 2) + Wsp := Lev * MaxH / (Static[StaticBackLevelRound[PP]].Texture.H / 2); + Static[StaticLevelRound[PP]].Texture.TexY1 := Static[StaticBackLevelRound[PP]].Texture.TexY1 - 0.25 + 0.25 * Wsp; + Static[StaticLevelRound[PP]].Texture.TexY2 := Static[StaticBackLevelRound[PP]].Texture.TexY2 - 0.25 + 0.25 * Wsp; + end else begin + // when it's higher or equal 20 => full texture is being shown + Static[StaticLevelRound[PP]].Texture.TexY1 := Static[StaticBackLevelRound[PP]].Texture.TexY1; + Static[StaticLevelRound[PP]].Texture.TexY2 := Static[StaticBackLevelRound[PP]].Texture.TexY2; + Static[StaticLevelRound[PP]].Texture.Y := Static[StaticLevel[PP]].Texture.Y - Static[StaticBackLevelRound[PP]].Texture.H; + end; + + end; // for + end; // if + + LCD.HideCursor; + LCD.Clear; + LCD.WriteText(1, Ini.Name[0]); + LCD.WriteText(2, 'Score: ' + Text[TextTotalScore[1]].Text); + +end; + +function TScreenScore.Draw: boolean; +var +{ Min: real; + Max: real; + Wsp: real; + Wsp2: real; + Pet: integer;} + + Item: integer; + P: integer; + C: integer; +begin + // star animation +{ Animation := Animation + TimeSkip*1000; + + // move right + Min := 0; Max := 500; + if (Animation >= Min) and (Animation < Max) then begin + Wsp := (Animation - Min) / (Max - Min); + Wsp2 := 1 - Wsp; + + Static[0].Texture.X := 400 + Wsp2 * 50; // prawa mala + Static[0].Texture.Y := 150 - Wsp2 * 500; + Static[1].Texture.X := -50 - Wsp2 * 500; // lewa mala + Static[1].Texture.Y := 200 + Wsp2 * 50; + Static[2].Texture.X := 100 - Wsp2 * 200; // gorna w prawo + Static[2].Texture.Y := 80 - Wsp2 * 200; + Static[3].Texture.X := -280 - Wsp2 * 1000; // lewa wieksza gorna + Static[3].Texture.Y := 90; + + + Static[4].Texture.X := -1200 + Wsp * 1000; + Text[0].X := Static[4].Texture.X + 430; + end; + + // slowly move right + Min := 500; Max := 4100; + if (Animation >= Min) and (Animation < Max) then begin + Wsp := (Animation - Min) / (Max - Min); + + Static[0].Texture.X := 400 - Wsp * 10; // prawa mala + Static[0].Texture.Y := 150 + Wsp * 50; + Static[1].Texture.X := -50 + Wsp * 50; // lewa mala + Static[1].Texture.Y := 200; + Static[2].Texture.X := 100 + Wsp * 50; // gorna w prawo + Static[2].Texture.Y := 80 + Wsp * 30; + Static[3].Texture.X := -280 + Wsp * 200; // lewa wieksza gorna + Static[3].Texture.Y := 90; + + Static[4].Texture.X := -200 + Wsp * 150; // duza glowna + Text[0].X := Static[4].Texture.X + 430; + end; + + // fast move right + Min := 4100; Max := 4400; + if (Animation >= Min) and (Animation < Max) then begin + Wsp := (Animation - Min) / (Max - Min); + Wsp2 := 1 - Wsp; + + Static[0].Texture.X := 390 - Wsp * 200; // prawa mala + Static[0].Texture.Y := 200 + Wsp * 1000; + Static[1].Texture.X := 0 + Wsp * 1000; // lewa mala + Static[1].Texture.Y := 200; + Static[2].Texture.X := 150 + Wsp * 1000; // gorna w prawo + Static[2].Texture.Y := 110 + Wsp * 600; + Static[3].Texture.X := -80 + Wsp * 2000; // lewa wieksza gorna + Static[3].Texture.Y := 90; + + Static[4].Texture.X := -50 + Wsp * 2000; + Text[0].X := Static[4].Texture.X + 430; + + Static[7].Texture.X := 100 + Wsp2 * 3000; + Text[1].X := Static[7].Texture.X + 230; // 300 + Text[1].Y := Static[7].Texture.Y + 140; // 120 Sh + + Text[2].X := Static[7].Texture.X + 250; + Text[2].Y := Static[7].Texture.Y - 250; + Text[3].X := Static[7].Texture.X + 250; + Text[3].Y := Static[7].Texture.Y - 200; + end; + + // last arrow + Min := 4400; Max := 8000; + if (Animation >= Min) and (Animation < Max) then begin + Wsp := (Animation - Min) / (Max - Min); + + Static[7].Texture.X := 100 - Wsp * 100; + Text[1].X := Static[7].Texture.X + 230; // 300 + Text[1].Y := Static[7].Texture.Y + 140; // 120 + + Text[2].X := Static[7].Texture.X + 250; + Text[2].Y := Static[7].Texture.Y - 250; + Text[3].X := Static[7].Texture.X + 250; + Text[3].Y := Static[7].Texture.Y - 200; + end; + + // fade last arrow to left + Min := 8000; Max := 8300; + if (Animation >= Min) and (Animation < Max) then begin + Wsp := (Animation - Min) / (Max - Min); + + Static[7].Texture.X := 0 - Wsp * 3000; + Static[7].Texture.Y := 340 - Wsp * 50; + Text[1].X := Static[7].Texture.X + 230; // 300 Sh + Text[1].Y := Static[7].Texture.Y + 140; // 120 Sh + + Text[2].X := Static[7].Texture.X + 250; + Text[2].Y := Static[7].Texture.Y - 250; + Text[3].X := Static[7].Texture.X + 250; + Text[3].Y := Static[7].Texture.Y - 200; + end; + + Min := 8300; + if (Animation >= Min) and (not Fadeout) then begin + Music.StopShuffle; + FadeTo(@ScreenSong); + Fadeout := true; + end;} + + + // 0.5.0: try also use 4 players screen with nicks + if PlayersPlay = 4 then begin + for Item := 2 to 3 do begin + if ScreenAct = 1 then P := Item-2; + if ScreenAct = 2 then P := Item; + + FillPlayer(Item, P); + end; + end; + + + // Singstar - let it be...... with 6 statics + if PlayersPlay = 6 then begin + for Item := 4 to 6 do begin + if ScreenAct = 1 then P := Item-4; + if ScreenAct = 2 then P := Item-1; + + FillPlayer(Item, P); + +{ if ScreenAct = 1 then begin + LoadColor( + Static[StaticBoxLightest[Item]].Texture.ColR, + Static[StaticBoxLightest[Item]].Texture.ColG, + Static[StaticBoxLightest[Item]].Texture.ColB, + 'P1Dark'); + end; + + if ScreenAct = 2 then begin + LoadColor( + Static[StaticBoxLightest[Item]].Texture.ColR, + Static[StaticBoxLightest[Item]].Texture.ColG, + Static[StaticBoxLightest[Item]].Texture.ColB, + 'P4Dark'); + end;} + + end; + end; + + inherited Draw; +end; + +procedure TScreenScore.FillPlayer(Item, P: integer); +var + S: string; +begin + Text[TextName[Item]].Text := Ini.Name[P]; + + S := IntToStr((Round(Player[P].Score) div 10) * 10); + while (Length(S)<4) do S := '0' + S; + Text[TextNotesScore[Item]].Text := S; + + while (Length(S)<5) do S := '0' + S; + Text[TextTotalScore[Item]].Text := S; + + LoadColor( + Text[TextName[Item]].ColR, + Text[TextName[Item]].ColG, + Text[TextName[Item]].ColB, + 'P' + IntToStr(P+1) + 'Dark'); + + LoadColor( + Static[StaticBoxLightest[Item]].Texture.ColR, + Static[StaticBoxLightest[Item]].Texture.ColG, + Static[StaticBoxLightest[Item]].Texture.ColB, + 'P' + IntToStr(P+1) + 'Lightest'); + + LoadColor( + Static[StaticBoxLight[Item]].Texture.ColR, + Static[StaticBoxLight[Item]].Texture.ColG, + Static[StaticBoxLight[Item]].Texture.ColB, + 'P' + IntToStr(P+1) + 'Light'); + + LoadColor( + Static[StaticBoxDark[Item]].Texture.ColR, + Static[StaticBoxDark[Item]].Texture.ColG, + Static[StaticBoxDark[Item]].Texture.ColB, + 'P' + IntToStr(P+1) + 'Dark'); +end; + +end. diff --git a/Game/Code/Screens/UScreenSing.dcu b/Game/Code/Screens/UScreenSing.dcu new file mode 100644 index 00000000..0e227a17 Binary files /dev/null and b/Game/Code/Screens/UScreenSing.dcu differ diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas new file mode 100644 index 00000000..2a97482d --- /dev/null +++ b/Game/Code/Screens/UScreenSing.pas @@ -0,0 +1,1121 @@ +unit UScreenSing; + +interface + +uses UMenu, UMusic, SDL, SysUtils, UPliki, UTime, USongs, UIni, ULog, USmpeg, UTexture, ULyrics, + TextGL, OpenGL12, BASS, UThemes, ULCD; + +type + TScreenSing = class(TMenu) + protected + paused: boolean; //Pause Mod + PauseTime: Real; + NumEmptySentences: integer; + public + TextTime: integer; + + StaticP1: integer; + StaticP1ScoreBG: integer; + TextP1: integer; + TextP1Score: integer; + + StaticP2R: integer; + StaticP2RScoreBG: integer; + TextP2R: integer; + TextP2RScore: integer; + + StaticP2M: integer; + StaticP2MScoreBG: integer; + TextP2M: integer; + TextP2MScore: integer; + + StaticP3R: integer; + StaticP3RScoreBG: integer; + TextP3R: integer; + TextP3RScore: integer; + + Tex_Background: TTexture; + FadeOut: boolean; + LyricMain: TLyric; + LyricSub: TLyric; + + constructor Create; override; + procedure onShow; override; + procedure onShowFinish; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure Finish; virtual; + procedure UpdateLCD; + procedure Pause; //Pause Mod(Toggles Pause) + + //OnSentenceEnd for LineBonus + Singbar + procedure onSentenceEnd(S: Cardinal); + end; + +implementation +uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math; + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenSing.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_ESCAPE : + begin + //Record Sound Hack: + //Sound[0].BufferLong + + Finish; + Music.PlayBack; + FadeTo(@ScreenScore); + end; + + SDLK_Q: + begin + Finish; + Result := false; + end; + + SDLK_P://Pause Mod + begin + Pause; + end; + + SDLK_RETURN: + begin + end; + + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN : + begin + end; + SDLK_UP : + begin + end; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN : + begin + end; + end; +end; + +//Pause Mod +procedure TScreenSing.Pause; +begin + if not paused then //Pause einschalten + begin + PauseTime := Czas.Teraz; + Paused := true; + //stop Music + Music.Pause; + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then //Video + PauseSmpeg; //Video + end + else //Pause ausschalten + begin + Czas.Teraz := PauseTime; //Position of Notes + Music.MoveTo (PauseTime);//Position of Music + Music.Play; //Play Music + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then //Video + PlaySmpeg; + //SkipSmpeg(PauseTime); + Paused := false; + end; +end; +//Pause Mod End + +constructor TScreenSing.Create; +var + I: integer; + P: integer; +begin + inherited Create; + + AddBackground(Theme.Sing.Background.Tex); + + for I := 0 to High(Theme.Sing.Static) do + AddStatic(Theme.Sing.Static[I]); + + for I := 0 to High(Theme.Sing.Text) do + AddText(Theme.Sing.Text[I]); + + // time + TextTime := AddText(75, 14, 1, 8, 0.25, 0.25, 0.25, '00:00'); + + StaticP1 := AddStatic(Theme.Sing.StaticP1); + StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); + TextP1 := AddText(Theme.Sing.TextP1); + TextP1Score := AddText(Theme.Sing.TextP1Score); + + StaticP2R := AddStatic(Theme.Sing.StaticP2R); + StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); + TextP2R := AddText(Theme.Sing.TextP2R); + TextP2RScore := AddText(Theme.Sing.TextP2RScore); + + StaticP2M := AddStatic(Theme.Sing.StaticP2M); + StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG); + TextP2M := AddText(Theme.Sing.TextP2M); + TextP2MScore := AddText(Theme.Sing.TextP2MScore); + + StaticP3R := AddStatic(Theme.Sing.StaticP3R); + StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG); + TextP3R := AddText(Theme.Sing.TextP3R); + TextP3RScore := AddText(Theme.Sing.TextP3RScore); + + LyricMain := TLyric.Create; + LyricSub := TLyric.Create; +end; + +procedure TScreenSing.onShow; +var + P: integer; + V1: boolean; + V2R: boolean; + V2M: boolean; + V3R: boolean; + NR: TRecR; //Line Bonus Mod +begin + Log.LogStatus('Begin', 'onShow'); + FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented + + // prepare players + SetLength(Player, PlayersPlay); +// Player[0].ScoreTotalI := 0; + + + case PlayersPlay of + 1: begin + V1 := true; + V2R := false; + V2M := false; + V3R := false; + end; + 2: begin + V1 := true; + V2R := true; + V2M := false; + V3R := false; + end; + 3: begin + V1 := true; + V2R := false; + V2M := true; + V3R := true; + end; + 4: begin // double screen + V1 := true; + V2R := true; + V2M := false; + V3R := false; + end; + 6: begin // double screen + V1 := true; + V2R := false; + V2M := true; + V3R := true; + end; + + end; + + + + Static[StaticP2R].Visible := V2R; + Static[StaticP2RScoreBG].Visible := V2R; + Text[TextP2R].Visible := V2R; + Text[TextP2RScore].Visible := V2R; + + Static[StaticP2M].Visible := V2M; + Static[StaticP2MScoreBG].Visible := V2M; + Text[TextP2M].Visible := V2M; + Text[TextP2MScore].Visible := V2M; + + Static[StaticP3R].Visible := V3R; + Static[StaticP3RScoreBG].Visible := V3R; + Text[TextP3R].Visible := V3R; + Text[TextP3RScore].Visible := V3R; + + // load notes + CzyscNuty; +// Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); + AktSong := CatSongs.Song[CatSongs.Selected]; + + WczytajCzesci(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName); + AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; +// AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed + + // set movie + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin + OpenSmpeg(AktSong.Path + AktSong.Video); + SkipSmpeg(AktSong.VideoGAP + AktSong.Start); + AktSong.VideoLoaded := true; + end; + + // set background + if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then + Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background) + else + Tex_Background.TexNum := -1; + + + + // play music (I) + Music.CaptureStart; + Music.MoveTo(AktSong.Start); +// Music.Play; + + // prepare timer (I) +// CountSkipTimeSet; + Czas.Teraz := AktSong.Start; + Czas.Razem := Music.Length; + if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000; + Czas.OldBeat := -1; + for P := 0 to High(Player) do + ClearScores(P); + + // main text + LyricMain.Clear; + LyricMain.X := 400; + LyricMain.Y := Skin_LyricsT; + LyricMain.Scale := 1.4; //1.4 + LyricMain.Align := 1; + + // sub text + LyricSub.Clear; + LyricSub.X := 400; + LyricSub.Y := Skin_LyricsT + 42; //40 + LyricSub.Align := 1; + + // set custom options + case Ini.LyricsFont of + 0: + begin + LyricMain.FontStyle := 0; + LyricSub.FontStyle := 0; + LyricMain.Size := 14; // 13 + LyricSub.Size := 14; // 13 + LyricMain.ColR := Skin_FontR; + LyricMain.ColG := Skin_FontG; + LyricMain.ColB := Skin_FontB; //Change für Crazy Joker + {LyricMain.ColSR := Skin_FontHighlightR; + LyricMain.ColSG := Skin_FontHighlightG; + LyricMain.ColSB := Skin_FontHighlightB;1aa5dc} + LyricMain.ColSR := 26/255; + LyricMain.ColSG := 165/255; + LyricMain.ColSB := 220/255; + + LyricSub.ColR := 0.6; + LyricSub.ColG := 0.6; + LyricSub.ColB := 0.6; + end; + 1: + begin + LyricMain.FontStyle := 2; + LyricSub.FontStyle := 2; + LyricMain.Size := 14; + LyricSub.Size := 14; + LyricMain.ColR := 0.75; + LyricMain.ColG := 0.75; + LyricMain.ColB := 1; + LyricMain.ColSR := 0.5; + LyricMain.ColSG := 0.5; + LyricMain.ColSB := 1; + LyricSub.ColR := 0.8; + LyricSub.ColG := 0.8; + LyricSub.ColB := 0.8; + end; + 2: + begin + LyricMain.FontStyle := 3; + LyricSub.FontStyle := 3; + LyricMain.Size := 12; + LyricSub.Size := 12; + LyricMain.ColR := 0.75; + LyricMain.ColG := 0.75; + LyricMain.ColB := 1; + LyricMain.ColSR := 0.5; + LyricMain.ColSG := 0.5; + LyricMain.ColSB := 1; + LyricSub.ColR := 0.8; + LyricSub.ColG := 0.8; + LyricSub.ColB := 0.8; + end; + end; // case + + case Ini.LyricsEffect of + 0: LyricMain.Style := 1; // 0 - one selected, 1 - selected all to the current + 1: LyricMain.Style := 2; + 2: LyricMain.Style := 3; + 3: LyricMain.Style := 4; + end; // case + + // fill texts + LyricMain.AddCzesc(0); + LyricMain.Selected := -1; + LyricSub.AddCzesc(1); + LyricSub.Selected := -1; + + UpdateLCD; + + //Deactivate Pause + Paused := False; + + {Static[StaticP2R].Visible := V2R; + Static[StaticP2RScoreBG].Visible := V2R; + Text[TextP2R].Visible := V2R; + Text[TextP2RScore].Visible := V2R; + + Static[StaticP2M].Visible := V2M; + Static[StaticP2MScoreBG].Visible := V2M; + Text[TextP2M].Visible := V2M; + Text[TextP2MScore].Visible := V2M; + + Static[StaticP3R].Visible := V3R; + Static[StaticP3RScoreBG].Visible := V3R; + Text[TextP3R].Visible := V3R; + Text[TextP3RScore].Visible := V3R;} + + //Set Position of Line Bonus - PhrasenBonus + if (Ini.LineBonus = 1) then //Show Line Bonus at Scores + begin + Case PlayersPlay of + 1: begin + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + end; + + 2: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.X; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.X; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.X; + Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + end; + + 3: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + end; + + 4: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P4 + Player[3].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; + Player[3].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[3].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; + Player[3].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + end; + + 6: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + + //P4 + Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[3].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[3].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[3].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P5 + Player[4].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[4].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[4].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[4].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P6 + Player[5].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[5].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[5].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[5].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + end; + end; + end + else if (Ini.LineBonus = 2) then //Show Line Bonus at Notes + begin + //SingDrawNoteLines(Nr.Left + 10*ScreenX, 120, Nr.Right + 10*ScreenX, 12); + //SingDrawNoteLines(Nr.Left + 10*ScreenX, 245, Nr.Right + 10*ScreenX, 12); + //SingDrawNoteLines(Nr.Left + 10*ScreenX, 370, Nr.Right + 10*ScreenX, 12); + + // positions + if Ini.SingWindow = 0 then begin + NR.Left := 120; + end else begin + NR.Left := 20; + end; + NR.Right := 780; + + NR.Width := NR.Right - NR.Left; + NR.WMid := NR.Width / 2; + NR.Mid := NR.Left + NR.WMid; + + Case PlayersPlay of + 1: begin + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartY := Skin_P2_NotesB - 105; + end; + + 2: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + end; + + 3: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetY := 120 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartY := 120 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetY := 245 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartY := 245 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_TargetY := 370 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_StartY := 370 + 28; + end; + + 4: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P4 + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + end; + + 6: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetY := 120 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartY := 120 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetY := 245 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartY := 245 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_TargetY := 370 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_StartY := 370 + 28; + + //P4 + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_TargetY := 120 - 65 + 28; + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_StartY := 120 + 28; + + //P5 + Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[4].LineBonus_TargetY := 245 - 65 + 28; + Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[4].LineBonus_StartY := 245 + 28; + + //P6 + Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[5].LineBonus_TargetY := 370 - 65 + 28; + Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[5].LineBonus_StartY := 370 + 28; + end; + end; + end; + //Set Position of Line Bonus - PhrasenBonus End + //Set Num of Empty Sentences for Phrasen Bonus + NumEmptySentences := 0; + for P := low(Czesci[0].Czesc) to high(Czesci[0].Czesc) do + if Czesci[0].Czesc[P].TotalNotes = 0 then Inc(NumEmptySentences); + + Log.LogStatus('End', 'onShow'); +end; + +procedure TScreenSing.onShowFinish; +begin + // play movie (II) + if AktSong.VideoLoaded then PlaySmpeg; + + // play music (II) + Music.Play; + + // prepare timer (II) + CountSkipTimeSet; +end; + +function TScreenSing.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + Flash: real; + S: integer; + T: integer; +begin + + + + //ScoreBG Mod + // set player colors + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + Static[StaticP1].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + + + + LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, + Static[StaticP1ScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + Static[StaticP1].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P4Dark'); + + + + LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, + Static[StaticP1ScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); + + + + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + Static[StaticP1].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P3Dark'); + + + + LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, + Static[StaticP1ScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + Static[StaticP1].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P6Dark'); + + + + + LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, + Static[StaticP1ScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); + + + + + end; + end; + +//Original 0.5.0 +{ // set player colors + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + //LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + //Static[StaticP1].Texture.ColB, 'P1Dark'); +// LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + // Static[StaticP2R].Texture.ColB, 'P2Dark'); + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + Static[StaticP1].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P4Dark'); + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + Static[StaticP1].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P3Dark'); + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + Static[StaticP1].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P6Dark'); + end; + end; } + //end ScoreBG Mod + + + + // set player names (for 2 screens and only Singstar skin) + if ScreenAct = 1 then begin + Text[TextP1].Text := 'P1'; + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; + end; + + if ScreenAct = 2 then begin + case PlayersPlay of +{ 1: begin + Text[TextP1].Text := 'P2'; + end; + 2: begin + Text[TextP1].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 3: begin + Text[TextP1].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end;} + + 4: begin + Text[TextP1].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 6: begin + Text[TextP1].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end; + end; // case + end; // if + + // stereo + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; + + + + + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + + + + + + Text[TextP1].X := Text[TextP1].X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; + + + + Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + + + + + Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; + + for S := 1 to 1 do + Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X + 10*ScreenX; + + // update static menu with time ... + Min := Round(Czas.Teraz) div 60; + Sec := Round(Czas.Teraz) mod 60; + Text[TextTime].Text := ''; + if Min < 10 then Text[TextTime].Text := '0'; + Text[TextTime].Text := Text[TextTime].Text + IntToStr(Min) + ':'; + if Sec < 10 then Text[TextTime].Text := Text[TextTime].Text + '0'; + Text[TextTime].Text := Text[TextTime].Text + IntToStr(Sec); + + // .. and scores + if PlayersPlay = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + end; + + if PlayersPlay = 2 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + + if PlayersPlay = 3 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[4].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[5].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + end; + + + // beat flash +{ Flash := 1 - (Czas.MidBeat - Czas.AktBeat); + if (Czas.AktBeat + AktSong.NotesGAP) mod AktSong.Resolution = 0 then Flash := 1 + else Flash := 0; + if Czas.AktBeat < 0 then Flash := 0; + glClearColor(Flash, Flash, Flash, 1);} + + // beat sound +// if (Ini.BeatClick = 1) and (Flash = 1) and (Czas.AktBeat <> Czas.OldBeat) then Music.PlayClick; + + // draw static menu (BG) + DrawBG; + //Draw Background + SingDrawBackground; + // update and draw movie + if ShowFinish and AktSong.VideoLoaded then begin + UpdateSmpeg; // this only draws + end; + + // draw static menu (FG) + DrawFG; + + // check for music finish +// Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(AktSong.Finish)); + if ShowFinish then begin + if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + //Pause Mod: + if not Paused then + Sing(Self); // analyze song + end else begin +// Log.LogError('End'); + if not FadeOut then begin +// Log.LogError('End2'); + Finish; + FadeOut := true; + FadeTo(@ScreenScore); + end; + end; + end; + + // draw custom items + SingDraw; // always draw + + + // back stereo + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; + + + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; + + + + Text[TextP1].X := Text[TextP1].X - 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; + + + + Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; + + + + Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; + + for S := 1 to 1 do + Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X - 10*ScreenX; + +end; + +procedure TScreenSing.Finish; +begin + Music.CaptureStop; + Music.Stop; + + if Ini.SavePlayback = 1 then begin + Log.BenchmarkStart(0); + Log.LogVoice(0); + Log.LogVoice(1); + Log.LogVoice(2); + Log.BenchmarkEnd(0); + Log.LogBenchmark('Creating files', 0); + end; + + if AktSong.VideoLoaded then begin + CloseSmpeg; + AktSong.VideoLoaded := false; // to prevent drawing closed video + end; +end; + +procedure TScreenSing.UpdateLCD; +var + T: string; +begin + LCD.HideCursor; + LCD.Clear; + + T := LyricMain.Text; + if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; + LCD.AddTextBR(T); + + T := LyricSub.Text; + if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; + LCD.AddTextBR(T); +end; + +procedure TScreenSing.onSentenceEnd(S: Cardinal); +var +I: Integer; +A: Real; +B: integer; //Max Points for Notes +begin + +//Check for Empty Sentence +if (Czesci[0].Czesc[S].TotalNotes<=0) then + exit; + +//Set Max Note Points +if (Ini.LineBonus > 0) then + B := 9000 +else + B := 10000; + +for I := 0 to High(Player) do begin + A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2; + + //SingBar Mod + If ({(Ini.Oscilloscope = 2) and }(Czesci[0].Czesc[S].TotalNotes>0)) then + begin + Player[I].ScorePercentTarget := Player[I].ScorePercentTarget + floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 40 - 26); + if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0; + if Player[I].ScorePercentTarget > 99 then Player[I].ScorePercentTarget := 99; + + //end Singbar Mod + end; + + //PhrasenBonus - Line Bonus Mod + + If (Ini.LineBonus > 0) then + begin + + //Generate Steps 0 to 8 + A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); + if A >= 8 then + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_PERFECT') + else if (A = 6) or (A = 7) then + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_BETTER') + else if A = 5 then + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_GOOD') + else if (A = 3) or (A = 4) then + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_NORMAL') + else if A = 2 then + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_BAD') + else + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_WORST'); + + //PhrasenBonus give Points + Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8); + Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10; + //Update Total Score + Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; + + //Color + Player[I].LineBonus_Color.B := 0; + Player[I].LineBonus_Color.R := (8-A)/8; + Player[I].LineBonus_Color.G := A/10; + + Player[I].LineBonus_PosX := Player[I].LineBonus_StartX; + Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; + Player[I].LineBonus_Alpha := 0.92; + Player[I].LineBonus_Visible := True; + + + + end; + +//Refresh LastScore +Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; + +end; +//PhrasenBonus - Line Bonus Mod End// } + +end; + +end. diff --git a/Game/Code/Screens/UScreenSingModi.dcu b/Game/Code/Screens/UScreenSingModi.dcu new file mode 100644 index 00000000..4f806afe Binary files /dev/null and b/Game/Code/Screens/UScreenSingModi.dcu differ diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas new file mode 100644 index 00000000..88034f61 --- /dev/null +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -0,0 +1,1088 @@ +unit UScreenSingModi; + +interface + +uses UMenu, UMusic, SDL, SysUtils, UPliki, UTime, USongs, UIni, ULog, USmpeg, UTexture, ULyrics, + TextGL, OpenGL12, BASS, UThemes, ULCD, UScreenSing, ModiSDK; + +type + TScreenSingModi = class(TScreenSing) + protected + //paused: boolean; //Pause Mod + //PauseTime: Real; + //NumEmptySentences: integer; + public + //TextTime: integer; + + //StaticP1: integer; + //StaticP1ScoreBG: integer; + //TextP1: integer; + //TextP1Score: integer; + + //StaticP2R: integer; + //StaticP2RScoreBG: integer; + //TextP2R: integer; + //TextP2RScore: integer; + + //StaticP2M: integer; + //StaticP2MScoreBG: integer; + //TextP2M: integer; + //TextP2MScore: integer; + + //StaticP3R: integer; + //StaticP3RScoreBG: integer; + //TextP3R: integer; + //TextP3RScore: integer; + + //Tex_Background: TTexture; + //FadeOut: boolean; + //LyricMain: TLyric; + //LyricSub: TLyric; + Winner: Byte; //Who Wins + PlayerInfo: TPlayerInfo; + TeamInfo: TTeamInfo; + + constructor Create; override; + procedure onShow; override; + //procedure onShowFinish; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure Finish; override; + //procedure UpdateLCD; + //procedure Pause; //Pause Mod(Toggles Pause) + end; + +//Procedured for Plugin +function LoadTex (const Name, Typ: PChar): TsmallTexture; stdcall; +//function Translate (const Name: PChar): PChar; stdcall; +procedure Print (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text +function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound +procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound + +//Utilys +function ToSentences(Const Czeski: TCzesci): TSentences; + +implementation +uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math, UDLLManager, USkins; + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenSingModi.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_ESCAPE : + begin + Finish; + Music.PlayBack; + FadeTo(@ScreenPartyScore); + end; + + else + Result := inherited ParseInput(PressedKey, ScanCode, PressedDown); + end; + end; +end; + +constructor TScreenSingModi.Create; +begin + inherited Create; + +end; + +function ToSentences(Const Czeski: TCzesci): TSentences; +var + I, J: Integer; +begin + Result.Akt := Czeski.Akt; + Result.High := Czeski.High; + Result.Ilosc := Czeski.Ilosc; + Result.Resolution := Czeski.Resolution; + Result.NotesGAP := Czeski.NotesGAP; + Result.TotalLength := Czeski.Wartosc; + + SetLength(Result.Sentence, Length(Czeski.Czesc)); + for I := low(Result.Sentence) to high(Result.Sentence) do + begin + Result.Sentence[I].Start := Czeski.Czesc[I].Start; + Result.Sentence[I].StartNote := Czeski.Czesc[I].StartNote; + Result.Sentence[I].Lyric := Czeski.Czesc[I].Lyric; + Result.Sentence[I].LyricWidth := Czeski.Czesc[I].LyricWidth; + Result.Sentence[I].Koniec := Czeski.Czesc[I].Koniec; + Result.Sentence[I].BaseNote := Czeski.Czesc[I].BaseNote; + Result.Sentence[I].HighNote := Czeski.Czesc[I].HighNut; + Result.Sentence[I].IlNut := Czeski.Czesc[I].IlNut; + Result.Sentence[I].TotalNotes := Czeski.Czesc[I].TotalNotes; + + SetLength(Result.Sentence[I].Note, Length(Czeski.Czesc[I].Nuta)); + for J := low(Result.Sentence[I].Note) to high(Result.Sentence[I].Note) do + begin + Result.Sentence[I].Note[J].Color := Czeski.Czesc[I].Nuta[J].Color; + Result.Sentence[I].Note[J].Start := Czeski.Czesc[I].Nuta[J].Start; + Result.Sentence[I].Note[J].Length := Czeski.Czesc[I].Nuta[J].Dlugosc; + Result.Sentence[I].Note[J].Ton := Czeski.Czesc[I].Nuta[J].Ton; + Result.Sentence[I].Note[J].TonGamy := Czeski.Czesc[I].Nuta[J].TonGamy; + //Result.Sentence[I].Note[J].Text := Czeski.Czesc[I].Nuta[J].Tekst; + Result.Sentence[I].Note[J].FreeStyle := Czeski.Czesc[I].Nuta[J].FreeStyle; + Result.Sentence[I].Note[J].Typ := Czeski.Czesc[I].Nuta[J].Wartosc; + end; + end; +end; + +procedure TScreenSingModi.onShow; +{var + P: integer; + V1: boolean; + V2R: boolean; + V2M: boolean; + V3R: boolean; + NR: TRecR; //Line Bonus Mod } +var + I: Integer; +begin + + { Log.LogStatus('Begin', 'onShow'); + FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented + + // prepare players + SetLength(Player, PlayersPlay); +// Player[0].ScoreTotalI := 0; + + + case PlayersPlay of + 1: begin + V1 := true; + V2R := false; + V2M := false; + V3R := false; + end; + 2: begin + V1 := true; + V2R := true; + V2M := false; + V3R := false; + end; + 3: begin + V1 := true; + V2R := false; + V2M := true; + V3R := true; + end; + 4: begin // double screen + V1 := true; + V2R := true; + V2M := false; + V3R := false; + end; + 6: begin // double screen + V1 := true; + V2R := false; + V2M := true; + V3R := true; + end; + + end; + + + + Static[StaticP2R].Visible := V2R; + Static[StaticP2RScoreBG].Visible := V2R; + Text[TextP2R].Visible := V2R; + Text[TextP2RScore].Visible := V2R; + + Static[StaticP2M].Visible := V2M; + Static[StaticP2MScoreBG].Visible := V2M; + Text[TextP2M].Visible := V2M; + Text[TextP2MScore].Visible := V2M; + + Static[StaticP3R].Visible := V3R; + Static[StaticP3RScoreBG].Visible := V3R; + Text[TextP3R].Visible := V3R; + Text[TextP3RScore].Visible := V3R; + + + + // load notes + CzyscNuty; +// Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); + AktSong := CatSongs.Song[CatSongs.Selected]; + + WczytajCzesci(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName); + AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; +// AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer}{ + 20 {microphone}{ + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed + + // set movie + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin + OpenSmpeg(AktSong.Path + AktSong.Video); + SkipSmpeg(AktSong.VideoGAP + AktSong.Start); + AktSong.VideoLoaded := true; + end; + + // set background + if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then + Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background) + else + Tex_Background.TexNum := -1; + + // play music (I) + //Music.CaptureStart; + Music.MoveTo(AktSong.Start); +// Music.Play; + + // prepare timer (I) +// CountSkipTimeSet; + Czas.Teraz := AktSong.Start; + Czas.Razem := Music.Length; + if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000; + Czas.OldBeat := -1; + for P := 0 to High(Player) do + ClearScores(P); + + // main text + LyricMain.Clear; + LyricMain.X := 400; + LyricMain.Y := Skin_LyricsT; + LyricMain.Scale := 1.4; //1.4 + LyricMain.Align := 1; + + // sub text + LyricSub.Clear; + LyricSub.X := 400; + LyricSub.Y := Skin_LyricsT + 42; //40 + LyricSub.Align := 1; + + // set custom options + case Ini.LyricsFont of + 0: + begin + LyricMain.FontStyle := 0; + LyricSub.FontStyle := 0; + LyricMain.Size := 14; // 13 + LyricSub.Size := 14; // 13 + LyricMain.ColR := Skin_FontR; + LyricMain.ColG := Skin_FontG; + LyricMain.ColB := Skin_FontB; //Change für Crazy Joker + {LyricMain.ColSR := Skin_FontHighlightR; + LyricMain.ColSG := Skin_FontHighlightG; + LyricMain.ColSB := Skin_FontHighlightB;1aa5dc} { + LyricMain.ColSR := 26/255; + LyricMain.ColSG := 165/255; + LyricMain.ColSB := 220/255; + + LyricSub.ColR := 0.6; + LyricSub.ColG := 0.6; + LyricSub.ColB := 0.6; + end; + 1: + begin + LyricMain.FontStyle := 2; + LyricSub.FontStyle := 2; + LyricMain.Size := 14; + LyricSub.Size := 14; + LyricMain.ColR := 0.75; + LyricMain.ColG := 0.75; + LyricMain.ColB := 1; + LyricMain.ColSR := 0.5; + LyricMain.ColSG := 0.5; + LyricMain.ColSB := 1; + LyricSub.ColR := 0.8; + LyricSub.ColG := 0.8; + LyricSub.ColB := 0.8; + end; + 2: + begin + LyricMain.FontStyle := 3; + LyricSub.FontStyle := 3; + LyricMain.Size := 12; + LyricSub.Size := 12; + LyricMain.ColR := 0.75; + LyricMain.ColG := 0.75; + LyricMain.ColB := 1; + LyricMain.ColSR := 0.5; + LyricMain.ColSG := 0.5; + LyricMain.ColSB := 1; + LyricSub.ColR := 0.8; + LyricSub.ColG := 0.8; + LyricSub.ColB := 0.8; + end; + end; // case + + case Ini.LyricsEffect of + 0: LyricMain.Style := 1; // 0 - one selected, 1 - selected all to the current + 1: LyricMain.Style := 2; + 2: LyricMain.Style := 3; + 3: LyricMain.Style := 4; + end; // case + + // fill texts + LyricMain.AddCzesc(0); + LyricMain.Selected := -1; + LyricSub.AddCzesc(1); + LyricSub.Selected := -1; + + UpdateLCD; + + //Deactivate Pause + Paused := False; + + {Static[StaticP2R].Visible := V2R; + Static[StaticP2RScoreBG].Visible := V2R; + Text[TextP2R].Visible := V2R; + Text[TextP2RScore].Visible := V2R; + + Static[StaticP2M].Visible := V2M; + Static[StaticP2MScoreBG].Visible := V2M; + Text[TextP2M].Visible := V2M; + Text[TextP2MScore].Visible := V2M; + + Static[StaticP3R].Visible := V3R; + Static[StaticP3RScoreBG].Visible := V3R; + Text[TextP3R].Visible := V3R; + Text[TextP3RScore].Visible := V3R;} { + + //Set Position of Line Bonus - PhrasenBonus + if (Ini.LineBonus = 1) then //Show Line Bonus at Scores + begin + Case PlayersPlay of + 1: begin + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + end; + + 2: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.X; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.X; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.X; + Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + end; + + 3: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + end; + + 4: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P4 + Player[3].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; + Player[3].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[3].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; + Player[3].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + end; + + 6: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + + //P4 + Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[3].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[3].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[3].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P5 + Player[4].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[4].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[4].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[4].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P6 + Player[5].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[5].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[5].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[5].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + end; + end; + end + else if (Ini.LineBonus = 2) then //Show Line Bonus at Notes + begin + //SingDrawNoteLines(Nr.Left + 10*ScreenX, 120, Nr.Right + 10*ScreenX, 12); + //SingDrawNoteLines(Nr.Left + 10*ScreenX, 245, Nr.Right + 10*ScreenX, 12); + //SingDrawNoteLines(Nr.Left + 10*ScreenX, 370, Nr.Right + 10*ScreenX, 12); + + // positions + if Ini.SingWindow = 0 then begin + NR.Left := 120; + end else begin + NR.Left := 20; + end; + NR.Right := 780; + + NR.Width := NR.Right - NR.Left; + NR.WMid := NR.Width / 2; + NR.Mid := NR.Left + NR.WMid; + + Case PlayersPlay of + 1: begin + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartY := Skin_P2_NotesB - 105; + end; + + 2: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + end; + + 3: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetY := 120 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartY := 120 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetY := 245 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartY := 245 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_TargetY := 370 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_StartY := 370 + 28; + end; + + 4: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P4 + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + end; + + 6: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetY := 120 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartY := 120 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetY := 245 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartY := 245 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_TargetY := 370 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_StartY := 370 + 28; + + //P4 + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_TargetY := 120 - 65 + 28; + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_StartY := 120 + 28; + + //P5 + Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[4].LineBonus_TargetY := 245 - 65 + 28; + Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[4].LineBonus_StartY := 245 + 28; + + //P6 + Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[5].LineBonus_TargetY := 370 - 65 + 28; + Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[5].LineBonus_StartY := 370 + 28; + end; + end; + end; + //Set Position of Line Bonus - PhrasenBonus End + //Set Num of Empty Sentences for Phrasen Bonus + NumEmptySentences := 0; + for P := low(Czesci[0].Czesc) to high(Czesci[0].Czesc) do + if Czesci[0].Czesc[P].TotalNotes = 0 then Inc(NumEmptySentences); + + Log.LogStatus('End', 'onShow'); } + +PlayersPlay := TeamInfo.NumTeams; + +if DLLMan.Selected.LoadSong then //Start with Song +begin + inherited; +end +else //Start Without Song +begin + Music.CaptureStart; +end; + +//Set Playerinfo + PlayerInfo.NumPlayers := PlayersPlay; + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); + PlayerInfo.Playerinfo[I].Score:= 0; + PlayerInfo.Playerinfo[I].Bar := 50; + PlayerInfo.Playerinfo[I].Enabled := True; + end; + + for I := PlayerInfo.NumPlayers to high(PlayerInfo.Playerinfo) do + begin + PlayerInfo.Playerinfo[I].Score:= 0; + PlayerInfo.Playerinfo[I].Bar := 0; + PlayerInfo.Playerinfo[I].Enabled := False; + end; + + Case PlayersPlay of + 1: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; + end; + 2,4: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; + PlayerInfo.Playerinfo[2].PosX := Static[StaticP1ScoreBG].Texture.X; + PlayerInfo.Playerinfo[2].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; + PlayerInfo.Playerinfo[1].PosX := Static[StaticP2RScoreBG].Texture.X; + PlayerInfo.Playerinfo[1].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; + PlayerInfo.Playerinfo[3].PosX := Static[StaticP2RScoreBG].Texture.X; + PlayerInfo.Playerinfo[3].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; + end; + 3,6: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; + PlayerInfo.Playerinfo[3].PosX := Static[StaticP1ScoreBG].Texture.X; + PlayerInfo.Playerinfo[3].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; + PlayerInfo.Playerinfo[1].PosX := Static[StaticP2MScoreBG].Texture.X; + PlayerInfo.Playerinfo[1].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; + PlayerInfo.Playerinfo[4].PosX := Static[StaticP2MScoreBG].Texture.X; + PlayerInfo.Playerinfo[4].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; + PlayerInfo.Playerinfo[2].PosX := Static[StaticP3RScoreBG].Texture.X; + PlayerInfo.Playerinfo[2].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; + PlayerInfo.Playerinfo[5].PosX := Static[StaticP3RScoreBG].Texture.X; + PlayerInfo.Playerinfo[5].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; + end; + end; + + // play music (I) + //Music.CaptureStart; + //Music.MoveTo(AktSong.Start); + +//Init Plugin +if not DLLMan.PluginInit(TeamInfo, PlayerInfo, ToSentences(Czesci[0]), LoadTex, Print, LoadSound, PlaySound) then +begin +//Fehler +Log.LogError('Could not Init Plugin'); +Halt; +end; + +Winner := 0; +//Set Score Visibility + if PlayersPlay = 1 then begin + Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; + end; + + if (PlayersPlay = 2) OR (PlayersPlay = 4) then begin + Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP2RScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP2RScoreBG].Visible := DLLMan.Selected.ShowScore; + end; + + if (PlayersPlay = 3) OR (PlayersPlay = 6) then begin + Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP2MScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP2MScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP3RScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP3RScoreBG].Visible := DLLMan.Selected.ShowScore; + end; +end; + +function TScreenSingModi.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + S, I: integer; + T: integer; +begin +//Set Playerinfo + PlayerInfo.NumPlayers := PlayersPlay; + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + PlayerInfo.Playerinfo[I].Name := PChar(Player[I].Name); + if PlayerInfo.Playerinfo[I].Enabled then + begin + if (Player[I].ScoreTotalI<=10000) then + PlayerInfo.Playerinfo[I].Score:= Player[I].ScoreTotalI; + PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; + end; + end; + +//Show Score +if DLLMan.Selected.ShowScore then +begin + //ScoreBG Mod + // set player colors + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + Static[StaticP1].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + + + + LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, + Static[StaticP1ScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + Static[StaticP1].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P4Dark'); + + + + LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, + Static[StaticP1ScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); + + + + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + Static[StaticP1].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P3Dark'); + + + + LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, + Static[StaticP1ScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + Static[StaticP1].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P6Dark'); + + + + + LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, + Static[StaticP1ScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); + + + + + end; + end; + //end ScoreBG Mod + +// set player names (for 2 screens and only Singstar skin) + if ScreenAct = 1 then begin + Text[TextP1].Text := 'P1'; + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; + end; + + if ScreenAct = 2 then begin + case PlayersPlay of + 4: begin + Text[TextP1].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 6: begin + Text[TextP1].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end; + end; // case + end; // if + + + // stereo + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + + Text[TextP1].X := Text[TextP1].X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; + Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + + Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; + + // .. and scores + if PlayersPlay = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + end; + + if PlayersPlay = 2 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + + if PlayersPlay = 3 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[4].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[5].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + end; + +end; //ShowScore + + for S := 1 to 1 do + Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X + 10*ScreenX; + +if DLLMan.Selected.LoadSong then +begin + // update static menu with time ... + Min := Round(Czas.Teraz) div 60; + Sec := Round(Czas.Teraz) mod 60; + Text[TextTime].Text := ''; + if Min < 10 then Text[TextTime].Text := '0'; + Text[TextTime].Text := Text[TextTime].Text + IntToStr(Min) + ':'; + if Sec < 10 then Text[TextTime].Text := Text[TextTime].Text + '0'; + Text[TextTime].Text := Text[TextTime].Text + IntToStr(Sec); +end; + + // draw static menu (BG) + DrawBG; + + //Draw Background + if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) then + SingDrawBackground; + + // update and draw movie + if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin + UpdateSmpeg; // this only draws + end; + + // draw static menu (FG) + DrawFG; + + if ShowFinish then begin + if DllMan.Selected.LoadSong then + begin + if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + //Pause Mod: + if not Paused then + Sing(Self); // analyze song + end else begin + if not FadeOut then begin + Finish; + FadeOut := true; + FadeTo(@ScreenPartyScore); + end; + end; + end; + end; + + // draw custom items + SingModiDraw(PlayerInfo); // always draw + + //Update PlayerInfo + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + if PlayerInfo.Playerinfo[I].Enabled then + begin + PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; + PlayerInfo.Playerinfo[I].Score := Player[I].ScoreTotalI; + end; + end; + + if ((ShowFinish) AND (NOT Paused)) then + begin + if not DLLMan.PluginDraw(Playerinfo, Czesci[0].Akt) then + begin + if not FadeOut then begin + Finish; + FadeOut := true; + FadeTo(@ScreenPartyScore); + end; + end; + end; + + //Change PlayerInfo/Changeables + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + if (Player[I].ScoreTotalI <> PlayerInfo.Playerinfo[I].Score) then + begin + //Player[I].ScoreTotal := Player[I].ScoreTotal + (PlayerInfo.Playerinfo[I].Score - Player[I].ScoreTotalI); + Player[I].ScoreTotalI := PlayerInfo.Playerinfo[I].Score; + end; + if (PlayerInfo.Playerinfo[I].Bar <> Player[I].ScorePercent) then + Player[I].ScorePercentTarget := PlayerInfo.Playerinfo[I].Bar; + end; + + // back stereo + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; + + + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; + + + + Text[TextP1].X := Text[TextP1].X - 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; + + + + Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; + + + + Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; + + for S := 1 to 1 do + Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X - 10*ScreenX; + + +end; + +procedure TScreenSingModi.Finish; +begin +inherited Finish; + +Winner := DllMan.PluginFinish(PlayerInfo); + +//Log.LogError('Winner: ' + InttoStr(Winner)); + +//DLLMan.UnLoadPlugin; +end; + +function LoadTex (const Name, Typ: PChar): TsmallTexture; stdcall; +var + Texname, EXT: String; + Tex: TTexture; +begin + //Get texture Name + TexName := Skin.GetTextureFileName(String(Name)); + //Get File Typ + Ext := ExtractFileExt(TexName); + if (uppercase(Ext) = '.JPG') then + Ext := 'JPG' + else + Ext := 'BMP'; + + Tex := Texture.LoadTexture(PChar(TexName), PChar(Ext), Typ, 0); + + Result.TexNum := Tex.TexNum; + Result.W := Tex.W; + Result.H := Tex.H; + Result.ScaleW := Tex.ScaleW; + Result.ScaleH := Tex.ScaleH; +end; +{ +function Translate (const Name: PChar): PChar; stdcall; +begin + Result := PChar(Language.Translate(String(Name))); +end; } + +procedure Print (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text +begin + SetFontItalic ((Style and 128) = 128); + SetFontStyle(Style and 7); + SetFontSize(Size); + SetFontPos (X, Y); + glPrint (PChar(Language.Translate(String(Text)))); +end; + +function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound +begin + Result := Music.LoadCustomSound(String(Name)); +end; + +procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound +begin + Music.PlayCustomSound(Index); +end; + +end. diff --git a/Game/Code/Screens/UScreenSong.dcu b/Game/Code/Screens/UScreenSong.dcu new file mode 100644 index 00000000..abc9cc4f Binary files /dev/null and b/Game/Code/Screens/UScreenSong.dcu differ diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas new file mode 100644 index 00000000..0d7860a7 --- /dev/null +++ b/Game/Code/Screens/UScreenSong.pas @@ -0,0 +1,1690 @@ +unit UScreenSong; + +interface + +uses + UMenu, SDL, UMusic, UPliki, UTime, UDisplay, USongs, SysUtils, ULog, UThemes, UTexture, ULanguage, + ULCD, ULight, UIni; + +type + TScreenSong = class(TMenu) + public + TextArtist: integer; + TextTitle: integer; + TextNumber: integer; + + TextCat: integer; + StaticCat: integer; + + SongCurrent: real; + SongTarget: real; + + HighSpeed: boolean; + CoverFull: boolean; + CoverTime: real; + CoverX: integer; + CoverY: integer; + CoverW: integer; + is_jump: boolean; // Jump to Song Mod + is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title + + EqualizerBands: array of Byte; + EqualizerTime: Cardinal; + EqualizerTime2: Byte; + + //Party Mod + Mode: Byte; //0 = Standard, 1= Go to PartyMode after Selection + Change to Random Song at Show + //party Statics (Joker) + StaticTeam1Joker1: Cardinal; + StaticTeam1Joker2: Cardinal; + StaticTeam1Joker3: Cardinal; + StaticTeam1Joker4: Cardinal; + StaticTeam1Joker5: Cardinal; + + StaticTeam2Joker1: Cardinal; + StaticTeam2Joker2: Cardinal; + StaticTeam2Joker3: Cardinal; + StaticTeam2Joker4: Cardinal; + StaticTeam2Joker5: Cardinal; + + StaticTeam3Joker1: Cardinal; + StaticTeam3Joker2: Cardinal; + StaticTeam3Joker3: Cardinal; + StaticTeam3Joker4: Cardinal; + StaticTeam3Joker5: Cardinal; + + constructor Create; override; + procedure SetScroll; + procedure SetScroll1; + procedure SetScroll2; + procedure SetScroll3; + procedure SetScroll4; + procedure SetScroll5; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onShow; override; + procedure SelectNext; + procedure SelectPrev; + procedure UpdateLCD; + procedure SkipTo(Target: integer); + procedure FixSelected; //Show Wrong Song when Tabs on Fix + procedure FixSelected2; //Show Wrong Song when Tabs on Fix + procedure ShowCatTL(Cat: Integer);// Show Cat in Tob left + procedure HideCatTL;// Show Cat in Tob left + procedure Refresh; //Refresh Song Sorting + procedure DrawEqualizer; + //Party Mode + procedure SelectRandomSong; + procedure SetJoker; + + //procedures for Menu + procedure StartSong; + procedure OpenEditor; + procedure DoJoker(Team: Byte); + end; + +implementation +uses UGraphic, UMain, UCovers, math, OpenGL12, Windows, USkins, UDLLManager, UParty, UScreenSongMenu; + +// ***** Public methods ****** // + +//Show Wrong Song when Tabs on Fix +procedure TScreenSong.FixSelected; +var I, I2: Integer; + begin + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); + + if I = Interaction - 1 then + break; + end; + + SongCurrent := I2; + SongTarget := I2; + end; + +procedure TScreenSong.FixSelected2; +var I, I2: Integer; + begin + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); + + if I = Interaction - 1 then + break; + end; + + SongTarget := I2; + end; +//Show Wrong Song when Tabs on Fix End + + //Show Cat in Top Left Mod + procedure TScreenSong.ShowCatTL(Cat: Integer); + begin + //Change + Text[TextCat].Text := CatSongs.Song[Cat].Artist; + //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover); + //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); + + Static[StaticCat].Texture := Texture.GetTexture(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover, 'Plain', true); + //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false); + //Button[Cat]. + //Cover + + + //Show + Text[TextCat].Visible := true; + Static[StaticCat].Visible := True; + end; + procedure TScreenSong.HideCatTL; + begin + //Hide + Text[TextCat].Visible := false; + Static[StaticCat].Visible := false; + end; + //Show Cat in Top Left Mod End + + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenSong.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var + I: integer; + I2: integer; + HS: integer; + SDL_ModState: Word; + Letter: Char; +begin + Result := true; + + //Song Menu + if (ScreenSongMenu.Visible) then + begin + Result := ScreenSongMenu.ParseInput(PressedKey, ScanCode, PressedDown); + Exit; + end; + + If (PressedDown) Then + begin // Key Down + +// HS := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT); +{ if (not HighSpeed) and (HS > 0) then begin + HighSpeed := true; + SDL_EnableKeyRepeat(50, 50); + end; + if (HighSpeed) and (HS = 0) then begin + HighSpeed := false; + SDL_EnableKeyRepeat(125, 125); + end;} + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + + // Jump to Key Mod + if (SDL_ModState = KMOD_LALT) AND (Mode = 0) then //Jump to Key + begin + //get Letter + case PressedKey of + SDLK_A : Letter := 'A'; + SDLK_B : Letter := 'B'; + SDLK_C : Letter := 'C'; + SDLK_D : Letter := 'D'; + SDLK_E : Letter := 'E'; + SDLK_F : Letter := 'F'; + SDLK_G : Letter := 'G'; + SDLK_H : Letter := 'H'; + SDLK_I : Letter := 'I'; + SDLK_J : Letter := 'J'; + SDLK_K : Letter := 'K'; + SDLK_L : Letter := 'L'; + SDLK_M : Letter := 'M'; + SDLK_N : Letter := 'N'; + SDLK_O : Letter := 'O'; + SDLK_P : Letter := 'P'; + SDLK_Q : Letter := 'Q'; + SDLK_R : Letter := 'R'; + SDLK_S : Letter := 'S'; + SDLK_T : Letter := 'T'; + SDLK_U : Letter := 'U'; + SDLK_V : Letter := 'V'; + SDLK_W : Letter := 'W'; + SDLK_X : Letter := 'X'; + SDLK_Y : Letter := 'Y'; + SDLK_Z : Letter := 'Z'; + SDLK_1 : Letter := '1'; + SDLK_2 : Letter := '2'; + SDLK_3 : Letter := '3'; + SDLK_4 : Letter := '4'; + SDLK_5 : Letter := '5'; + SDLK_6 : Letter := '6'; + SDLK_7 : Letter := '7'; + SDLK_8 : Letter := '8'; + SDLK_9 : Letter := '9'; + SDLK_0 : Letter := '0'; + else exit; + end; + + {//Search Letter + for I := Interaction + 1 to high(CatSongs.Song) do + begin + if CatSongs.Song[I].Visible and (Letter = Uppercase(CatSongs.Song[I].Artist)[1]) then + break; //Found Song + if I = Interaction then //went through complete array but nothing Found + break; + if I = high(CatSongs.Song) then //At the end of the array->Go to beginning + for I2 := low(CatSongs.Song) to Interaction do + if CatSongs.Song[I].Visible and (Letter = Uppercase(CatSongs.Song[I].Artist)[1]) then + break; //Found Song + end; } + + for I := 0 to High(CatSongs.Song) do begin + if (CatSongs.Song[I].Visible) AND (UpperCase(CatSongs.Song[I].Artist[1]) = Letter) then + begin + //Select Song + Interaction := I; + SkipTo(Interaction); + break; + end; + end; + + //Don't do other Functions + exit; + end; + + if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then //Jump to Key + begin + //get Letter + case PressedKey of + SDLK_a..SDLK_z : Letter := Chr(Ord('a')+PressedKey-97); + SDLK_1 : Letter := '1'; + SDLK_2 : Letter := '2'; + SDLK_3 : Letter := '3'; + SDLK_4 : Letter := '4'; + SDLK_5 : Letter := '5'; + SDLK_6 : Letter := '6'; + SDLK_7 : Letter := '7'; + SDLK_8 : Letter := '8'; + SDLK_9 : Letter := '9'; + SDLK_0 : Letter := '0'; + else exit; + end; + + {//Search Letter + for I := Interaction + 1 to high(CatSongs.Song) do + begin + if CatSongs.Song[I].Visible and (Letter = Uppercase(CatSongs.Song[I].Artist)[1]) then + break; //Found Song + if I = Interaction then //went through complete array but nothing Found + break; + if I = high(CatSongs.Song) then //At the end of the array->Go to beginning + for I2 := low(CatSongs.Song) to Interaction do + if CatSongs.Song[I].Visible and (Letter = Uppercase(CatSongs.Song[I].Artist)[1]) then + break; //Found Song + end; } + + {for I := 0 to High(CatSongs.Song) do begin + if (CatSongs.Song[I].Visible) AND (UpperCase(CatSongs.Song[I].Artist[1]) = Letter) then} + + for I := Interaction + 1 to high(CatSongs.Song) + 1 do + begin + if (I > high(CatSongs.Song)) then + begin + for I2 := low(CatSongs.Song) to Interaction do + begin + if CatSongs.Song[I2].Visible and (Letter = lowercase(CatSongs.Song[I2].Artist[1])) then + begin + Interaction := I2; + break; //Found Song + end; + end; + break; + end + else if CatSongs.Song[I].Visible and (Letter = lowercase(CatSongs.Song[I].Artist[1])) then + begin + Interaction := I; + break; //Found Song + end; + end; + + + //Select Song + SkipTo(Interaction); + + //Don't do other Functions + exit; + end; + + + case PressedKey of + SDLK_ESCAPE : + begin + if (Mode = 0) then + begin + //On Escape goto Cat-List Hack + if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then + begin + //Find Category + I := Interaction; + while not catsongs.Song[I].Main do + begin + Dec (I); + if (I < low(catsongs.Song)) then + break; + end; + if (I<= 1) then + Interaction := high(catsongs.Song) + else + Interaction := I - 1; + + //Stop Music + Music.Stop; + + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + HideCatTL; + + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + //SelectPrev; + //CatSongs.Song[0].Visible := False; + end + else + begin + //On Escape goto Cat-List Hack End + Music.Stop; + Music.PlayBack; +// FadeTo(@ScreenLevel); + FadeTo(@ScreenMain); + +// Music.Open(Skin.SkinPath + 'Menu Music 3.mp3'); +// Music.Play; + end; + end; + end; + SDLK_RETURN: + begin + if Length(Songs.Song) > 0 then begin +// PortWriteB($378, 0); + if CatSongs.Song[Interaction].Main then begin // clicked on Category Button + + //Show Cat in Top Left Mod + ShowCatTL (Interaction); + + //I := CatSongs.VisibleIndex(Interaction); + CatSongs.ClickCategoryButton(Interaction); + {I2 := CatSongs.VisibleIndex(Interaction); + SongCurrent := SongCurrent - I + I2; + SongTarget := SongTarget - I + I2; } + +// if I<>I2 then beep; + // SetScroll4; + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + + //Play Music: + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + Music.Play; + end; + + end else begin // clicked on song + if (Mode = 0) then //Normal Mode -> Start Song + begin + StartSong; + + end + else if (Mode = 1) then //PartyMode -> Show Menu + begin + ScreenSongMenu.Visible := True; + ScreenSongMenu.MenuShow(SM_Party_Main); + end; + end; + end; + end; + + SDLK_M: //Show SongMenu + begin + if Length(Songs.Song) > 0 then begin + if not CatSongs.Song[Interaction].Main then begin // clicked on Song + ScreenSongMenu.Visible := True; + ScreenSongMenu.MenuShow(SM_Main); + end; + end; + end; + + SDLK_DOWN: + begin + if (Mode = 0) then + begin +{ if Length(Songs.Song) > 0 then begin + Music.PlayChange; + InteractNext; + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then Music.Play; + SetScroll; + end;} + + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then + begin + I := Interaction; + if I <= 0 then I := 1; + + while not catsongs.Song[I].Main do + begin + Inc (I); + if (I > high(catsongs.Song)) then + I := low(catsongs.Song); + end; + + Interaction := I; + + //Show Cat in Top Left Mod + ShowCatTL (Interaction); + + CatSongs.ClickCategoryButton(Interaction); + SelectNext; + FixSelected; + + //Play Music: + Music.PlayChange; + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + Music.Play; + end; + + end; + + // + //Cat Change Hack End} + end; + end; + SDLK_UP: + begin + if (Mode = 0) then + begin +{ if Length(Songs.Song) > 0 then begin + Music.PlayChange; + InteractPrev; + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then Music.Play; + SetScroll; + end;} + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then + begin + I := Interaction; + I2 := 0; + if I <= 0 then I := 1; + + while not catsongs.Song[I].Main or (I2 = 0) do + begin + if catsongs.Song[I].Main then + Inc(I2); + Dec (I); + if (I < low(catsongs.Song)) then + I := high(catsongs.Song); + end; + + Interaction := I; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + + //Play Music: + Music.PlayChange; + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + Music.Play; + end; + + end; + + // + //Cat Change Hack End} + end; + end; + + SDLK_RIGHT: + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + Music.PlayChange; + SelectNext; +// InteractNext; +// SongTarget := Interaction; + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + Music.Play; + end; + SetScroll4; + UpdateLCD; + Light.LightOne(1, 200); + end; + end; + + SDLK_LEFT: + begin + if (Length(Songs.Song) > 0)AND (Mode = 0) then begin + Music.PlayChange; + SelectPrev; + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + Music.Play; + end; + SetScroll4; + UpdateLCD; + Light.LightOne(0, 200); + end; + end; + + SDLK_E: + begin + OpenEditor; + end; + + SDLK_R: + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + + if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category + begin + I2 := 0; //Count Cats + for I:= low(CatSongs.Song) to high (CatSongs.Song) do + if CatSongs.Song[I].Main then Inc(I2); + + I2 := Random (I2)+1; //Zufall + + //Find Cat: + for I:= low(CatSongs.Song) to high (CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + Dec(I2); + if (I2<=0) then + begin + //Show Cat in Top Left Mod + ShowCatTL (I); + + Interaction := I; + + CatSongs.ShowCategoryList; + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + break; + end; + end; + + + end + else if (SDL_ModState = KMOD_LCTRL) AND (Ini.Tabs_at_startup = 1) then //random in All Categorys + begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; + + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + + //Choose Cat + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Fix: Not Existing Song selected: + if (I+1=I2) then Inc(I2); + + //Choose Song + SkipTo(I2-I); + + end + else //Random in one Category + begin + SkipTo(2+Random(CatSongs.VisibleSongs-1)); + end; + Music.PlayChange; + + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + Music.Play; + end; + SetScroll4; + UpdateLCD; + end; + end; + + SDLK_1: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[0].Joker); + SelectRandomSong; + SetJoker; + end; + end; + + SDLK_2: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[1].Joker); + SelectRandomSong; + SetJoker; + end; + end; + + SDLK_3: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[2].Joker); + SelectRandomSong; + SetJoker; + end; + end; + + SDLK_Q: + begin + Result := false; + end; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN : + begin + end; + end; +end; + +constructor TScreenSong.Create; +var + Pet: integer; + I: integer; +begin + inherited Create; + +// AddStatic(200, 10, 400, 90, Skin.SelectSong); +// AddStatic(200-10, 140-5, 400+20, 50+10, Skin.Selection, 'JPG', 'Font Gray'); + + AddBackground(Theme.Song.Background.Tex); + + for I := 0 to High(Theme.Song.Static) do + AddStatic(Theme.Song.Static[I]); + + for I := 0 to High(Theme.Song.Text) do + AddText(Theme.Song.Text[I]); + + TextArtist := AddText(Theme.Song.TextArtist); + TextTitle := AddText(Theme.Song.TextTitle); + TextNumber := AddText(Theme.Song.TextNumber); + + //Show Cat in Top Left mod + TextCat := AddText(Theme.Song.TextCat); + StaticCat := AddStatic(Theme.Song.StaticCat); + + //Party Mode + StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1); + StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2); + StaticTeam1Joker3 := AddStatic(Theme.Song.StaticTeam1Joker3); + StaticTeam1Joker4 := AddStatic(Theme.Song.StaticTeam1Joker4); + StaticTeam1Joker5 := AddStatic(Theme.Song.StaticTeam1Joker5); + + StaticTeam2Joker1 := AddStatic(Theme.Song.StaticTeam2Joker1); + StaticTeam2Joker2 := AddStatic(Theme.Song.StaticTeam2Joker2); + StaticTeam2Joker3 := AddStatic(Theme.Song.StaticTeam2Joker3); + StaticTeam2Joker4 := AddStatic(Theme.Song.StaticTeam2Joker4); + StaticTeam2Joker5 := AddStatic(Theme.Song.StaticTeam2Joker5); + + StaticTeam3Joker1 := AddStatic(Theme.Song.StaticTeam3Joker1); + StaticTeam3Joker2 := AddStatic(Theme.Song.StaticTeam3Joker2); + StaticTeam3Joker3 := AddStatic(Theme.Song.StaticTeam3Joker3); + StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); + StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); + + // Song List +// Songs.LoadSongList; // moved to the UltraStar unit + CatSongs.Refresh; + for Pet := 0 to High(CatSongs.Song) do begin // creating all buttons + // new + Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 + + if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' + + if CatSongs.Song[Pet].Cover = '' then + AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) + else begin + // cache texture if there is a need to this + if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then begin + Texture.CreateCacheMipmap := true; + Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap + Texture.CreateCacheMipmap := false; + + // puts this texture to the cache file + Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + + // unload full size texture + Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); + + // we should also add mipmap texture by calling createtexture and use mipmap cache as data source + end; + + // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) + AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + end; + Texture.Limit := 1024*1024; + + +// AddButtonText(11, 10, CatSongs.Song[Pet].Title); // new way + end; +// Covers.Save; + + { if Length(CatSongs.Song) > 0 then // setting to first song + Interaction := 0 + else begin // no song detected + AddButton(400-200, 140, 400, 50, Skin.Button, 'JPG', 'Transparent Range'); + AddButtonText(11, 10, 'No songs detected'); + end;} + + // Randomize Patch + Randomize; + //Equalizer + SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); + //ClearArray + For I := low(EqualizerBands) to high(EqualizerBands) do + EqualizerBands[I] := 3; +end; + +procedure TScreenSong.SetScroll; +begin +//Set Positions + Case Theme.Song.Cover.Style of + 3: SetScroll3; + 5: SetScroll5 + else SetScroll4; + end; +//Set Texts: + Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; + Text[TextTitle].Text := CatSongs.Song[Interaction].Title; + if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then + begin + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); + Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; + end + else if (Ini.Tabs_at_startup = 1) then + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) + else + Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); +end; + +procedure TScreenSong.SetScroll1; +var + B: integer; // button + BMin: integer; // button min + BMax: integer; // button max + Src: integer; +// Dst: integer; + Count: integer; // Dst is not used. Count is used. + Ready: boolean; + + VisCount: integer; // count of visible (or selectable) buttons + VisInt: integer; // visible position of interacted button + Typ: integer; // 0 when all songs fits the screen + Placed: integer; // number of placed visible buttons +begin +// Src := 0; +// Dst := -1; + Count := 1; + Typ := 0; + Ready := false; + Placed := 0; + + VisCount := 0; + for B := 0 to High(Button) do + if CatSongs.Song[B].Visible then Inc(VisCount); + + VisInt := 0; + for B := 0 to Interaction-1 do + if CatSongs.Song[B].Visible then Inc(VisInt); + + + if VisCount <= 6 then begin + Typ := 0; + end else begin + if VisInt <= 3 then begin + Typ := 1; + Count := 7; + Ready := true; + end; + + if (VisCount - VisInt) <= 3 then begin + Typ := 2; + Count := 7; + Ready := true; + end; + + if not Ready then begin + Typ := 3; + Src := Interaction; + end; + end; + + + + // hide all buttons + for B := 0 to High(Button) do begin + Button[B].Visible := false; + Button[B].Selectable := CatSongs.Song[B].Visible; + end; + +{ for B := Src to Dst do begin +// Button[B].Visible := true; + Button[B].Visible := CatSongs.Song[B].Visible; + Button[B].Selectable := Button[B].Visible; + Button[B].Y := 140 + (B-Src) * 60; + end;} + + + if Typ = 0 then begin + for B := 0 to High(Button) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (Placed) * 60; + Inc(Placed); + end; + end; + end; + + if Typ = 1 then begin + B := 0; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Inc(B); + end; + end; + + if Typ = 2 then begin + B := High(Button); + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (6-Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Dec(B); + end; + end; + + if Typ = 3 then begin + B := Src; + Count := 4; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (3+Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Inc(B); + end; + + B := Src-1; + Placed := 0; + Count := 3; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (2-Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Dec(B); + end; + + end; + + if Length(Button) > 0 then + Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture +end; + +procedure TScreenSong.SetScroll2; +var + B: integer; + Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu + Wsp2: real; +begin + // liniowe + for B := 0 to High(Button) do + Button[B].X := 300 + (B - Interaction) * 260; + + if Length(Button) >= 3 then begin + if Interaction = 0 then + Button[High(Button)].X := 300 - 260; + + if Interaction = High(Button) then + Button[0].X := 300 + 260; + end; + + // kolowe +{ for B := 0 to High(Button) do begin + Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. + Wsp2 := Wsp / Length(Button); + Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); +// Button[B].Y := 140 + 50 * ; + end;} +end; + +procedure TScreenSong.SetScroll3; // with slide +var + B: integer; + Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu + Wsp2: real; +begin + SongTarget := Interaction; + + // liniowe + for B := 0 to High(Button) do + begin + Button[B].X := 300 + (B - SongCurrent) * 260; + if (Button[B].X < -Button[B].W) OR (Button[B].X > 800) then + Button[B].Visible := False + else + Button[B].Visible := True; + end; + +{ if Length(Button) >= 3 then begin + if Interaction = 0 then + Button[High(Button)].X := 300 - 260; + + if Interaction = High(Button) then + Button[0].X := 300 + 260; + end;} + + // kolowe +{ for B := 0 to High(Button) do begin + Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. + Wsp2 := Wsp / Length(Button); + Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); +// Button[B].Y := 140 + 50 * ; + end;} +end; + +procedure TScreenSong.SetScroll4; // rotate +var + B: integer; + Wsp: real; + Z, Z2: real; + VS: integer; +begin + VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important + + // kolowe + for B := 0 to High(Button) do begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + +// Wsp := 2 * pi * (B - SongCurrent) / Length(Button); +// Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - 0) / CatSongs.VisibleSongs; + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2; + Z2 := (1 + 2*Z) / 3; + + Button[B].X := Theme.Song.Cover.X + (300 + 37 * VS {CatSongs.VisibleSongs} {Length(Button)} * sin(Wsp) - 400) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z; + + Button[B].H := Theme.Song.Cover.H * Z2; + Button[B].W := Button[B].H; + +// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; + Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.65; + end; + end; +end; + +{procedure TScreenSong.SetScroll4; // rotate +var + B: integer; + Wsp: real; + Z: real; + Z2, Z3: real; + VS: integer; + function modreal (const X, Y: real):real; + begin + Result := Frac(x / y) * y; + if Result < -3 then + Result := Result + Y + else if Result > 3 then + Result := Result - Y; + end; +begin + VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important + Z3 := 1; + if VS < 12 then + Z2 := VS + else + Z2 := 12; + + // kolowe + for B := 0 to High(Button) do begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + if ((ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)>-3) AND (ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)<3)) then + begin + if CatSongs.VisibleIndex(B)> SongCurrent then + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2 + else + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2; + + Z3 := 2; + Z := (1 + cos(Wsp)) / 2; + //Z2 := (1 + 2*Z) / 3; + //Z2 := (0.5 + Z/2); + //Z2 := sin(Wsp); + + //Z2 := Power (Z2,Z3); + + Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); + + //Button[B].X := Theme.Song.CoverX + ({Theme.Song.CoverX + Theme.Song.CoverW/2 + Theme.Song.CoverW*0.18 * VS {CatSongs.VisibleSongs {Length(Button) * sin(Wsp) {- Theme.Song.CoverX - Theme.Song.CoverW) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + if (sin(Wsp)<0) then + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W + else //*Theme.Song.CoverW*0.004*Z3 + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; + Button[B].Z := Z-0.00001; + +// Button[B].Y := {50 + 140 + 50 - 50 * Z2; + // Button[B].Y := (Theme.Song.CoverY + 40 + 50 - 50 * Z2); + Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); + Button[B].H := Button[B].W; + Button[B].Visible := True; + end + {else if (((CatSongs.VisibleIndex(B) - SongCurrent)>-3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) OR ((round (CatSongs.VisibleIndex(B) - SongCurrent) mod VS > -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) then + begin + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / 12 ;// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2 -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); + + if (sin(Wsp)<0) then + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W + else + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; + + Button[B].Z := Z; + + Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); + + Button[B].H := Button[B].W; + Button[B].Visible := True; + end + else Button[B].Visible := False; + end; + end; +end; } + +procedure TScreenSong.SetScroll5; // rotate +var + B: integer; + Angle: real; + Pos: Real; + VS: integer; + diff: real; + X: Real; + {function margin (const X, Y, VS: real):real; //Margin of to Buttons + begin + Result := Frac(x / y) * y; + if (X - VS) >= -3 then + Result := X - VS - Y + else if (X + 3) >= VS then + Result := X - VS + Y + else + Result := X - Y; + end; } +begin + VS := CatSongs.VisibleSongs; // cache Visible Songs + {Vars + Theme.Song.CoverW: Radius des Kreises + Theme.Song.CoverX: X Pos Linke Kante des gewählten Covers + Theme.Song.CoverX: Y Pos Obere Kante des gewählten Covers + Theme.Song.CoverH: Höhe der Cover + + (CatSongs.VisibleIndex(B) - SongCurrent)/VS = Abstand zum MIttleren Cover in % + } + + //Change Pos of all Buttons + for B := low(Button) to high(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visability + if Button[B].Visible then //Only Change Pos for Visible Buttons + begin + Pos := (CatSongs.VisibleIndex(B) - SongCurrent); + if (Pos < -VS) then + Pos := Pos + VS + else if (Pos > VS) then + Pos := Pos - VS; + + if (Abs(Pos) < 3) then {fixed Positions} + begin + Angle := Pi * (Pos / 5); + //Button[B].Visible := False; + + Button[B].H := Theme.Song.Cover.H * cos(Angle);//Power(Z2, 3); + + Button[B].Z := 0.95 - Abs(Pos) * 0.01; + + Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); + + Button[B].W := Button[B].H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2;; + + if (X < 0) then + Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Sin(Angle){ - Theme.Song.Cover.H/2} - Diff + else + Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Sin(Angle){ - Theme.Song.Cover.H/2}- Diff; + + Button[B].Visible := True; + end + else + begin {Behind the Front Covers} + //Button[B].Visible := False; + Pos := Frac(Pos / VS); + if Pos < 0 then + Pos := Pos + 1; + + Angle := Abs(2 * pi * ((Pos) / VS / 2)); + //Pos := Power(Pos*2 - 1, 3); + + Button[B].Z := (0.2 + Pos/2) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + //Pos := abs(Pos) mod 1; + + X := sin(Angle); + //Button[B].H := (0.2 + 0.4 * Abs(Pos)) * Theme.Song.Cover.H; //Cover High + Width + Button[B].H := 80; + Button[B].W := Button[B].H; + + Diff := (Theme.Song.Cover.H - Button[B].H)/2; + + //Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.W) * Sin(Angle) - diff + //Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Pos - Diff; + + if (X < 0) then + Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Sin(Angle) - Theme.Song.Cover.H/2 + Diff + else + Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Sin(Angle) - Theme.Song.Cover.H/2; + + end; + + Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field + + {X := sin(Angle); + + Button[B].H := (0.5 + Power(cos(Angle), 1.7))/1.5 * Theme.Song.Cover.H; //Cover High + Width + Button[B].W := Button[B].H; + + {if (X < 0) then + Diff := Theme.Song.Cover.H - Button[B].H + else + Diff := 0; + + if (((CatSongs.VisibleIndex(B) - SongCurrent)>= -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent) <= 3)) OR (((CatSongs.VisibleIndex(B) - SongCurrent)>= -3 + VS) AND ((CatSongs.VisibleIndex(B) - SongCurrent) <= 3 + VS)) OR (((CatSongs.VisibleIndex(B) - SongCurrent)>= -3 - VS) AND ((CatSongs.VisibleIndex(B) - SongCurrent) <= 3 - VS)) then + Button[B].X := Theme.Song.Cover.X + diff + margin(CatSongs.VisibleIndex(B), SongCurrent, VS)* 30 + else + Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X + diff;}{ + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + if X < 0 then + Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.W) * -Power(-X, 1/2) - diff + else + Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.W) * Power(X, 1/2) - diff;} + end; + end; +end; + +procedure TScreenSong.onShow; +begin + Music.Stop; + + if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; + if Ini.Players = 4 then PlayersPlay := 6; + + //Cat Mod etc + if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then + begin + CatSongs.ShowCategoryList; + SelectNext;SelectPrev; //Workaround <- must be fixed sometime + FixSelected; + //Show Cat in Top Left Mod + HideCatTL; + end; + + + if Length(CatSongs.Song) > 0 then begin + Music.SetLoop(false); + Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + Music.MoveTo(Music.Length / 4); + Music.Play; + SetScroll; + UpdateLCD; + end; + + //Party Mode + if (Mode = 1) then + begin + SelectRandomSong; + end; + + SetJoker; +end; + +function TScreenSong.Draw: boolean; +var + dx: real; + dt: real; +begin + dx := SongTarget-SongCurrent; + dt := TimeSkip*7; + if dt > 1 then dt := 1; + SongCurrent := SongCurrent + dx*dt; + +{ if SongCurrent > Catsongs.VisibleSongs then begin + SongCurrent := SongCurrent - Catsongs.VisibleSongs; + SongTarget := SongTarget - Catsongs.VisibleSongs; + end;} + +// Log.BenchmarkStart(5); + SetScroll; +// Log.BenchmarkEnd(5); +// Log.LogBenchmark('SetScroll4', 5); + + + // 0.5.0: cover fade + if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin + // load new texture + Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture.Alpha := 1; + Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture2.Alpha := 1; + end; + CoverTime := CoverTime + TimeSkip; + Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; + if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; + + inherited Draw; + + //Draw Equalizer + if Theme.Song.Equalizer.Visible then + DrawEqualizer; + + //Draw Song Menu + if (ScreenSongMenu.Visible) then + begin + ScreenSongMenu.Draw; + end; +end; + +procedure TScreenSong.SelectNext; +var + Skip: integer; + I: integer; +begin + CoverTime := 0; + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture + Button[Interaction].Texture2.Alpha := 0; + + //0.5.0: unload old full size texture + if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then + Texture.UnloadTexture(Button[Interaction].Texture.Name, false); + + Skip := 1; + + // this 1 could be changed by CatSongs.FindNextVisible + while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); + SongTarget := SongTarget + 1;//Skip; + + Interaction := (Interaction + Skip) mod Length(Interactions); + + // try to keep all at the beginning + if SongTarget > CatSongs.VisibleSongs-1 then begin + SongTarget := SongTarget - CatSongs.VisibleSongs; + SongCurrent := SongCurrent - CatSongs.VisibleSongs; + end; + + // Interaction -> Button, ktorego okladke przeczytamy +// Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture +end; + +procedure TScreenSong.SelectPrev; +var + Skip: integer; + I: integer; +begin + CoverTime := 0; + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture + Button[Interaction].Texture2.Alpha := 0; + + //0.5.0: unload old full size texture + if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then + Texture.UnloadTexture(Button[Interaction].Texture.Name, false); + + Skip := 1; + + while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); + SongTarget := SongTarget - 1;//Skip; + + Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); + + // try to keep all at the beginning + if SongTarget < 0 then begin + SongTarget := SongTarget + CatSongs.VisibleSongs; + SongCurrent := SongCurrent + CatSongs.VisibleSongs; + end; + +// Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture +end; + +procedure TScreenSong.UpdateLCD; +begin + LCD.HideCursor; + LCD.Clear; + LCD.WriteText(1, Text[TextArtist].Text); + LCD.WriteText(2, Text[TextTitle].Text); +end; + +procedure TScreenSong.SkipTo(Target: integer); // 0.5.0 +var + Skip: integer; + I: integer; +begin + CoverTime := 0; + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture + Button[Interaction].Texture2.Alpha := 0; + + if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then + Texture.UnloadTexture(Button[Interaction].Texture.Name, false); + + Interaction := 0; + SongTarget := 0; + + for I := 2 to Target do + SelectNext; + + FixSelected2; +end; + +procedure TScreenSong.DrawEqualizer; +var + Data: TFFTData; //Audio Data + I, J: Integer; + Res: byte; + A, B: Integer; + PosX, PosY: Integer; + Pos: Real; +begin +if (not Music.Finished) AND (Theme.Song.Equalizer.Length > 0) then +begin + + + A := GetTickCount div 44; + + if (A <> EqualizerTime) then + begin + EqualizerTime := A; + Data := Music.GetFFTData; + + B:=0; + Pos := 0; + Res := floor(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band + //Change Lengths + for I := 0 to 92 do + begin + A := floor(I/Res); + + if (A<>B) then //Band changed + begin + if (Pos <= Theme.Song.Equalizer.Length) then + begin + if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then + EqualizerBands[B] := EqualizerBands[B] - 1 + else + EqualizerBands[B] := floor(Pos); + end + else + EqualizerBands[B] := 1; + + B := A; + Pos := 0; + end; + + if I > 35 then + Data[i] := Data[i] * 8 + else if I > 11 then + Data[i] := Data[i] * 4.5 + else + Data[i] := Data[i] * 1.1; + + if (Data[i] >= 1) then + Data[i] := 0.9999999999999; + + if Data[i]*Theme.Song.Equalizer.Length > Pos then + Pos := Data[i]*Theme.Song.Equalizer.Length; + end; + + //Change Last Band + if (EqualizerBands[B] <= Theme.Song.Equalizer.Length) then + begin + if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then + EqualizerBands[B] := EqualizerBands[B] - 1 + else + EqualizerBands[B] := floor(Pos) + end + else + EqualizerBands[B] := 1; + end; + + //Draw every Channel + glColor4f(Theme.Song.Equalizer.ColR, Theme.Song.Equalizer.ColG, Theme.Song.Equalizer.ColB, Theme.Song.Equalizer.Alpha); //Set Color + glDisable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + + PosY := Theme.Song.Equalizer.Y; + PosX := Theme.Song.Equalizer.X; + + For I := 0 to Theme.Song.Equalizer.Bands do + begin + if Theme.Song.Equalizer.Direction then + PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length + else + PosX := Theme.Song.Equalizer.X; + //Draw for every visible quad + for J := 1 to EqualizerBands[I] do + begin + glBegin(GL_QUADS); + glVertex3f(PosX, PosY, Theme.Song.Equalizer.Z); + glVertex3f(PosX, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); + glVertex3f(PosX+Theme.Song.Equalizer.W, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); + glVertex3f(PosX+Theme.Song.Equalizer.W, PosY, Theme.Song.Equalizer.Z); + glEnd; + + if Theme.Song.Equalizer.Direction then //Vertically + PosY := PosY - Theme.Song.Equalizer.H - Theme.Song.Equalizer.Space + else //Horizontally + PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space; + end; + if Theme.Song.Equalizer.Direction then //Horizontally + PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space + else //Vertically + PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space; + end; +end; +end; + +Procedure TScreenSong.SelectRandomSong; +var + I, I2: Integer; +begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; + + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + + //Choose Cat + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Fix: Not Existing Song selected: + if (I+1=I2) then Inc(I2); + + //Choose Song + SkipTo(I2-I); + + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + Music.Play; + end; +end; + +procedure TScreenSong.SetJoker; +begin + //If Party Mode + if Mode = 1 then //Show Joker that are available + begin + if (PartySession.Teams.NumTeams >= 1) then + begin + Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1); + Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2); + Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3); + Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4); + Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5); + end + else + begin + Static[StaticTeam1Joker1].Visible := False; + Static[StaticTeam1Joker2].Visible := False; + Static[StaticTeam1Joker3].Visible := False; + Static[StaticTeam1Joker4].Visible := False; + Static[StaticTeam1Joker5].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 2) then + begin + Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1); + Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2); + Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3); + Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4); + Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5); + end + else + begin + Static[StaticTeam2Joker1].Visible := False; + Static[StaticTeam2Joker2].Visible := False; + Static[StaticTeam2Joker3].Visible := False; + Static[StaticTeam2Joker4].Visible := False; + Static[StaticTeam2Joker5].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 3) then + begin + Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1); + Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2); + Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3); + Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4); + Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5); + end + else + begin + Static[StaticTeam3Joker1].Visible := False; + Static[StaticTeam3Joker2].Visible := False; + Static[StaticTeam3Joker3].Visible := False; + Static[StaticTeam3Joker4].Visible := False; + Static[StaticTeam3Joker5].Visible := False; + end; + end + else + begin //Hide all + Static[StaticTeam1Joker1].Visible := False; + Static[StaticTeam1Joker2].Visible := False; + Static[StaticTeam1Joker3].Visible := False; + Static[StaticTeam1Joker4].Visible := False; + Static[StaticTeam1Joker5].Visible := False; + + Static[StaticTeam2Joker1].Visible := False; + Static[StaticTeam2Joker2].Visible := False; + Static[StaticTeam2Joker3].Visible := False; + Static[StaticTeam2Joker4].Visible := False; + Static[StaticTeam2Joker5].Visible := False; + + Static[StaticTeam3Joker1].Visible := False; + Static[StaticTeam3Joker2].Visible := False; + Static[StaticTeam3Joker3].Visible := False; + Static[StaticTeam3Joker4].Visible := False; + Static[StaticTeam3Joker5].Visible := False; + end; +end; + +//Procedures for Menu + +procedure TScreenSong.StartSong; +begin + CatSongs.Selected := Interaction; + Music.Stop; + //Party Mode + if (Mode = 1) then + begin + FadeTo(@ScreenSingModi); + end + else + begin + FadeTo(@ScreenSing); + end; +end; + +procedure TScreenSong.OpenEditor; +begin + if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin + Music.Stop; + Music.PlayStart; + ScreenEditSub.Path := CatSongs.Song[Interaction].Path; + ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName; + FadeTo(@ScreenEditSub); + end; +end; + +//Team No of Team (0-5) +procedure TScreenSong.DoJoker (Team: Byte); +begin + if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[Team].Joker); + SelectRandomSong; + SetJoker; + end; +end; + +procedure TScreenSong.Refresh; +begin { +CatSongs.Refresh; +CatSongs.ShowCategoryList; +Interaction := 0; +SelectNext; +FixSelected; } + +end; + +end. diff --git a/Game/Code/Screens/UScreenSongMenu.dcu b/Game/Code/Screens/UScreenSongMenu.dcu new file mode 100644 index 00000000..634a217a Binary files /dev/null and b/Game/Code/Screens/UScreenSongMenu.dcu differ diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas new file mode 100644 index 00000000..2a03a7c2 --- /dev/null +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -0,0 +1,355 @@ +unit UScreenSongMenu; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + +type + TScreenSongMenu = class(TMenu) + private + CurMenu: Byte; //Num of the cur. Shown Menu + public + Visible: Boolean; //Whether the Menu should be Drawn + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + function Draw: boolean; override; + procedure MenuShow(sMenu: Byte); + procedure HandleReturn; + end; + +const + SM_Main = 1; + SM_PlayList = 64 or 1; + SM_Party_Main = 128 or 1; + SM_Party_Joker = 128 or 2; + +var + ISelections: Array of String; + SelectValue: Integer; + + +implementation + +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty; + +function TScreenSongMenu.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; + function IsVisible: Boolean; + begin + Result := True; + if (Interactions[Interaction].Typ = 0) then + begin + Result := Button[Interactions[Interaction].Num].Visible; + end + else if (Interactions[Interaction].Typ = 1) then + begin + //Result := Selects[Interactions[Interaction].Num].Visible; + end + else if (Interactions[Interaction].Typ = 3) then + begin + Result := SelectsS[Interactions[Interaction].Num].Visible; + end; + end; + + Procedure SelectNext; + begin + repeat + InteractNext; + until IsVisible; + end; + + Procedure SelectPrev; + begin + repeat + InteractPrev; + until IsVisible; + end; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE : + begin + Music.PlayBack; + Visible := False; + end; + + SDLK_RETURN: + begin + HandleReturn; + end; + + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN: SelectNext; + SDLK_UP: SelectPrev; + + SDLK_RIGHT: + begin + if (Interaction=3) then + InteractInc; + end; + SDLK_LEFT: + begin + if (Interaction=3) then + InteractDec; + end; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN : + begin + end; + end; +end; + +constructor TScreenSongMenu.Create; +var + I: integer; +begin + inherited Create; + SetLength(ISelections, 1); + ISelections[0] := 'Dummy'; + + AddBackground(Theme.SongMenu.Background.Tex); + + AddButton(Theme.SongMenu.Button1); + if (Length(Button[0].Text) = 0) then + AddButtonText(14, 20, 'Button 1'); + + AddButton(Theme.SongMenu.Button2); + if (Length(Button[1].Text) = 0) then + AddButtonText(14, 20, 'Button 2'); + + AddButton(Theme.SongMenu.Button3); + if (Length(Button[2].Text) = 0) then + AddButtonText(14, 20, 'Button 3'); + + AddSelectSlide(Theme.SongMenu.SelectSlide3, SelectValue, ISelections); + + AddButton(Theme.SongMenu.Button4); + if (Length(Button[3].Text) = 0) then + AddButtonText(14, 20, 'Button 4'); + + AddText(Theme.SongMenu.TextMenu); + + for I := 0 to High(Theme.SongMenu.Static) do + AddStatic(Theme.SongMenu.Static[I]); + + for I := 0 to High(Theme.SongMenu.Text) do + AddText(Theme.SongMenu.Text[I]); + + Interaction := 0; +end; + +function TScreenSongMenu.Draw: boolean; +begin + inherited Draw; +end; + +procedure TScreenSongMenu.onShow; +begin + +end; + +procedure TScreenSongMenu.MenuShow(sMenu: Byte); +begin + Interaction := 0; //Reset Interaction + Case sMenu of + SM_Main: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_MAIN'); + + Button[0].Visible := True; + Button[1].Visible := True; + Button[2].Visible := True; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY'); + Button[1].Text[0].Text := Language.Translate('SONG_MENU_EDIT'); + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYMODI'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); + end; + + SM_PlayList: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST'); + + Button[0].Visible := True; + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD'); + Button[1].Text[0].Text := ''; + Button[2].Text[0].Text := ''; + Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); + end; + + SM_Party_Main: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_MAIN'); + + Button[0].Visible := True; + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY'); + Button[1].Text[0].Text := Language.Translate('SONG_MENU_JOKER'); + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYMODI'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_JOKER'); + end; + + SM_Party_Joker: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_JOKER'); + + Button[0].Visible := (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0); + Button[1].Visible := (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0); + Button[2].Visible := (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0); + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := String(PartySession.Teams.Teaminfo[0].Name); + Button[1].Text[0].Text := String(PartySession.Teams.Teaminfo[1].Name); + Button[2].Text[0].Text := String(PartySession.Teams.Teaminfo[2].Name); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); + end; + end; +end; + +procedure TScreenSongMenu.HandleReturn; +begin + Case CurMenu of + SM_Main: + begin + Visible := False; + Case Interaction of + 0: //Button 1 + begin + ScreenSong.StartSong; + end; + + 1: //Button 2 + begin + ScreenSong.OpenEditor; + end; + + 2: //Button 3 + begin + //Todo: Add SingleRound Modi Support + end; + + 3: //SelectSlide 3 + begin + //Dummy + end; + + 4: //Button 4 + begin + //Cancel... (Do Nothing) + end; + end; + end; + + SM_PlayList: + begin + Visible := False; + Case Interaction of + 0: //Button 1 + begin + // + end; + + 1: //Button 2 + begin + // + end; + + 2: //Button 3 + begin + //Todo + end; + + 3: //SelectSlide 3 + begin + //Dummy + end; + + 4: //Button 4 + begin + // + end; + end; + end; + + SM_Party_Main: + begin + Case Interaction of + 0: //Button 1 + begin + //Start Singing + ScreenSong.StartSong; + Visible := False; + end; + + 4: //Button 4 + begin + //Joker + MenuShow(SM_Party_Joker); + end; + end; + end; + + SM_Party_Joker: + begin + Visible := False; + Case Interaction of + 0: //Button 1 + begin + //Joker Team 1 + ScreenSong.DoJoker(0); + end; + + 1: //Button 2 + begin + //Joker Team 2 + ScreenSong.DoJoker(1); + end; + + 2: //Button 3 + begin + //Joker Team 3 + ScreenSong.DoJoker(2); + end; + + 4: //Button 4 + begin + //Cancel... (Fo back to old Menu) + MenuShow(SM_Party_Main); + end; + end; + end; + end; +end; + +end. + \ No newline at end of file diff --git a/Game/Code/Screens/UScreenTop5.dcu b/Game/Code/Screens/UScreenTop5.dcu new file mode 100644 index 00000000..c6db07d0 Binary files /dev/null and b/Game/Code/Screens/UScreenTop5.dcu differ diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas new file mode 100644 index 00000000..41f96281 --- /dev/null +++ b/Game/Code/Screens/UScreenTop5.pas @@ -0,0 +1,166 @@ +unit UScreenTop5; + +interface + +uses + UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes, ULCD; + +type + TScreenTop5 = class(TMenu) + public + TextLevel: integer; + TextArtistTitle: integer; + + StaticNumber: array[1..5] of integer; + TextNumber: array[1..5] of integer; + TextName: array[1..5] of integer; + TextScore: array[1..5] of integer; + + Fadeout: boolean; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + function Draw: boolean; override; + end; + +implementation + +uses UGraphic, UScores, UMain, UIni; + +function TScreenTop5.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then begin + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE, SDLK_RETURN: + begin + if (not Fadeout) then begin + FadeTo(@ScreenSong); + Fadeout := true; + end; + end; + SDLK_SYSREQ: + begin + Display.PrintScreen; + end; + end; + end; +end; + +constructor TScreenTop5.Create; +var + I: integer; +begin + inherited Create; + + AddBackground(Theme.Top5.Background.Tex); + + for I := 0 to High(Theme.Top5.Static) do + AddStatic(Theme.Top5.Static[I]); + + for I := 0 to High(Theme.Top5.Text) do + AddText(Theme.Top5.Text[I]); + + + TextLevel := AddText(Theme.Top5.TextLevel); + TextArtistTitle := AddText(Theme.Top5.TextArtistTitle); + + for I := 0 to 4 do + StaticNumber[I+1] := AddStatic(Theme.Top5.StaticNumber[I]); + + for I := 0 to 4 do + TextNumber[I+1] := AddText(Theme.Top5.TextNumber[I]); + for I := 0 to 4 do + TextName[I+1] := AddText(Theme.Top5.TextName[I]); + for I := 0 to 4 do + TextScore[I+1] := AddText(Theme.Top5.TextScore[I]); + +end; + +procedure TScreenTop5.onShow; +var + I: integer; + PMax: integer; +begin + Fadeout := false; + + //ReadScore(AktSong); + + PMax := Ini.Players; + if Ini.Players = 4 then Ini.Players := 5; + for I := 0 to PMax do + AddScore(AktSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalI)); + + //WriteScore(AktSong); + ReadScore(AktSong); + + Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; + + for I := 1 to Length(AktSong.Score[Ini.Difficulty]) do begin + Static[StaticNumber[I]].Visible := true; + Text[TextNumber[I]].Visible := true; + Text[TextName[I]].Visible := true; + Text[TextScore[I]].Visible := true; + + Text[TextName[I]].Text := AktSong.Score[Ini.Difficulty, I-1].Name; + Text[TextScore[I]].Text := IntToStr(AktSong.Score[Ini.Difficulty, I-1].Score); + end; + + for I := Length(AktSong.Score[Ini.Difficulty])+1 to 5 do begin + Static[StaticNumber[I]].Visible := false; + Text[TextNumber[I]].Visible := false; + Text[TextName[I]].Visible := false; + Text[TextScore[I]].Visible := false; + end; + + Text[TextLevel].Text := IDifficulty[Ini.Difficulty]; +end; + +function TScreenTop5.Draw: boolean; +//var +{ Min: real; + Max: real; + Wsp: real; + Wsp2: real; + Pet: integer;} + +{ Item: integer; + P: integer; + C: integer;} +begin + // Singstar - let it be...... with 6 statics +{ if PlayersPlay = 6 then begin + for Item := 4 to 6 do begin + if ScreenAct = 1 then P := Item-4; + if ScreenAct = 2 then P := Item-1; + + FillPlayer(Item, P); + +{ if ScreenAct = 1 then begin + LoadColor( + Static[StaticBoxLightest[Item]].Texture.ColR, + Static[StaticBoxLightest[Item]].Texture.ColG, + Static[StaticBoxLightest[Item]].Texture.ColB, + 'P1Dark'); + end; + + if ScreenAct = 2 then begin + LoadColor( + Static[StaticBoxLightest[Item]].Texture.ColR, + Static[StaticBoxLightest[Item]].Texture.ColG, + Static[StaticBoxLightest[Item]].Texture.ColB, + 'P4Dark'); + end;} + +{ end; + end;} + + inherited Draw; +end; + +end. diff --git a/Game/Code/Screens/UScreenWelcome.dcu b/Game/Code/Screens/UScreenWelcome.dcu new file mode 100644 index 00000000..196b04be Binary files /dev/null and b/Game/Code/Screens/UScreenWelcome.dcu differ diff --git a/Game/Code/Screens/UScreenWelcome.pas b/Game/Code/Screens/UScreenWelcome.pas new file mode 100644 index 00000000..de3b50f4 --- /dev/null +++ b/Game/Code/Screens/UScreenWelcome.pas @@ -0,0 +1,117 @@ +unit UScreenWelcome; + +interface + +uses + UMenu, SDL, SysUtils, UThemes; + +type + TScreenWelcome = class(TMenu) + public + Animation: real; + Fadeout: boolean; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onShow; override; + end; + +implementation + +uses UGraphic, UTime; + +function TScreenWelcome.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then begin + case PressedKey of + SDLK_ESCAPE : + begin + Result := False; + end; + SDLK_RETURN: + begin + FadeTo(@ScreenMain); + Fadeout := true; + end; + end; + end; +end; + +constructor TScreenWelcome.Create; +begin + inherited Create; +{ AddStatic(-10, -10, 0, 0, 1, 1, 1, Skin.Star, 'BMP', 'Transparent'); + AddStatic(-500, 440, 200, 5, 0, 0, 0, Skin.Line, 'JPG', 'Font Black'); + AddStatic(-500, 472, 200, 5, 0, 0, 0, Skin.Line, 'JPG', 'Font Black'); + AddStatic(-500, 504, 200, 5, 0, 0, 0, Skin.Line, 'JPG', 'Font Black'); + AddStatic(-500, 536, 200, 5, 0, 0, 0, Skin.Line, 'JPG', 'Font Black'); + AddStatic(-500, 568, 200, 5, 0, 0, 0, Skin.Line, 'JPG', 'Font Black'); + Animation := 0; + Fadeout := false;} +end; + +procedure TScreenWelcome.onShow; +begin + CountSkipTimeSet; +end; + +function TScreenWelcome.Draw: boolean; +var + Min: real; + Max: real; + Wsp: real; + Pet: integer; +begin + // star animation + Animation := Animation + TimeSkip*1000; + + // draw nothing + Min := 0; Max := 1000; + if (Animation >= Min) and (Animation < Max) then begin + end; + + // popup + Min := 1000; Max := 1120; + if (Animation >= Min) and (Animation < Max) then begin + Wsp := (Animation - Min) / (Max - Min); + Static[0].Texture.X := 600; + Static[0].Texture.Y := 600 - Wsp * 230; + Static[0].Texture.W := 200; + Static[0].Texture.H := Wsp * 230; + end; + + // bounce + Min := 1120; Max := 1200; + if (Animation >= Min) and (Animation < Max) then begin + Wsp := (Animation - Min) / (Max - Min); + Static[0].Texture.Y := 370 + Wsp * 50; + Static[0].Texture.H := 230 - Wsp * 50; + end; + + // run + Min := 1500; Max := 3500; + if (Animation >= Min) and (Animation < Max) then begin + Wsp := (Animation - Min) / (Max - Min); + + Static[0].Texture.X := 600 - Wsp * 1400; + Static[0].Texture.H := 180; + + + for Pet := 1 to 5 do begin + Static[Pet].Texture.X := 770 - Wsp * 1400; + Static[Pet].Texture.W := 150 + Wsp * 200; + Static[Pet].Texture.Alpha := Wsp * 0.5; + end; + end; + + Min := 3500; + if (Animation >= Min) and (not Fadeout) then begin + FadeTo(@ScreenMain); + Fadeout := true; + end; + + inherited Draw; +end; + +end. diff --git a/Game/Code/UltraStar.RES b/Game/Code/UltraStar.RES new file mode 100644 index 00000000..fcaa4576 Binary files /dev/null and b/Game/Code/UltraStar.RES differ diff --git a/Game/Code/UltraStar.bdsproj b/Game/Code/UltraStar.bdsproj new file mode 100644 index 00000000..e11acf91 --- /dev/null +++ b/Game/Code/UltraStar.bdsproj @@ -0,0 +1,168 @@ + + + + + + + + + + + + UltraStar.dpr + + + 7.0 + + + 8 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + True + False + WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; + + False + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + + + 0 + 0 + 1 + False + False + False + 16384 + 1048576 + 4194304 + + + + E:\Projekte\Ultrastar + + + + E:\Projekte\Ultrastar\Includes;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\smpeg\Pas;E:\Projekte\Ultrastar\Includes\midi + vcl;rtl;vclx;VclSmp;vclshlctrls;DelphiX_for6 + TRANSLATE + + False + + + -benchmark + + + False + + + + + + False + + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1045 + 1250 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + diff --git a/Game/Code/UltraStar.bdsproj.local b/Game/Code/UltraStar.bdsproj.local new file mode 100644 index 00000000..d576f039 --- /dev/null +++ b/Game/Code/UltraStar.bdsproj.local @@ -0,0 +1,2 @@ + + diff --git a/Game/Code/UltraStar.cfg b/Game/Code/UltraStar.cfg new file mode 100644 index 00000000..5ade3beb --- /dev/null +++ b/Game/Code/UltraStar.cfg @@ -0,0 +1,41 @@ +-$A8 +-$B- +-$C+ +-$D+ +-$E- +-$F- +-$G+ +-$H+ +-$I+ +-$J- +-$K- +-$L+ +-$M- +-$N+ +-$O+ +-$P+ +-$Q- +-$R- +-$S- +-$T- +-$U- +-$V+ +-$W- +-$X+ +-$YD +-$Z1 +-cg +-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; +-H+ +-W- +-M +-$M16384,1048576 +-K$00400000 +-E"E:\Projekte\Ultrastar\Bin" +-LE"e:\programme\borland\delphi7\Projects\Bpl" +-LN"e:\programme\borland\delphi7\Projects\Bpl" +-U"E:\Projekte\Ultrastar\Includes\DelphiX\Source;E:\Projekte\Ultrastar\Includes;E:\Projekte\Ultrastar\Includes\midi;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Sound\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Net\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Mixer\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Image\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_ttf\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDLSpriteEngine\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SFont\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\smpeg\Pas;E:\Projekte\Ultrastar\Includes\Zlportio;E:\Projekte\Ultrastar\Includes\SQLite" +-O"E:\Projekte\Ultrastar\Includes\DelphiX\Source;E:\Projekte\Ultrastar\Includes;E:\Projekte\Ultrastar\Includes\midi;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Sound\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Net\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Mixer\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Image\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_ttf\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDLSpriteEngine\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SFont\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\smpeg\Pas;E:\Projekte\Ultrastar\Includes\Zlportio;E:\Projekte\Ultrastar\Includes\SQLite" +-I"E:\Projekte\Ultrastar\Includes\DelphiX\Source;E:\Projekte\Ultrastar\Includes;E:\Projekte\Ultrastar\Includes\midi;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Sound\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Net\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Mixer\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Image\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_ttf\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDLSpriteEngine\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SFont\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\smpeg\Pas;E:\Projekte\Ultrastar\Includes\Zlportio;E:\Projekte\Ultrastar\Includes\SQLite" +-R"E:\Projekte\Ultrastar\Includes\DelphiX\Source;E:\Projekte\Ultrastar\Includes;E:\Projekte\Ultrastar\Includes\midi;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Sound\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Net\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Mixer\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Image\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_ttf\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDLSpriteEngine\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SFont\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\smpeg\Pas;E:\Projekte\Ultrastar\Includes\Zlportio;E:\Projekte\Ultrastar\Includes\SQLite" +-DTRANSLATE diff --git a/Game/Code/UltraStar.dof b/Game/Code/UltraStar.dof new file mode 100644 index 00000000..174b4358 --- /dev/null +++ b/Game/Code/UltraStar.dof @@ -0,0 +1,148 @@ +[FileVersion] +Version=7.0 +[Compiler] +A=8 +B=0 +C=1 +D=1 +E=0 +F=0 +G=1 +H=1 +I=1 +J=0 +K=0 +L=1 +M=0 +N=1 +O=1 +P=1 +Q=0 +R=0 +S=0 +T=0 +U=0 +V=1 +W=0 +X=1 +Y=1 +Z=1 +ShowHints=1 +ShowWarnings=0 +UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; +NamespacePrefix= +SymbolDeprecated=1 +SymbolLibrary=1 +SymbolPlatform=1 +UnitLibrary=1 +UnitPlatform=1 +UnitDeprecated=1 +HResultCompat=1 +HidingMember=1 +HiddenVirtual=1 +Garbage=1 +BoundsError=1 +ZeroNilCompat=1 +StringConstTruncated=1 +ForLoopVarVarPar=1 +TypedConstVarPar=1 +AsgToTypedConst=1 +CaseLabelRange=1 +ForVariable=1 +ConstructingAbstract=1 +ComparisonFalse=1 +ComparisonTrue=1 +ComparingSignedUnsigned=1 +CombiningSignedUnsigned=1 +UnsupportedConstruct=1 +FileOpen=1 +FileOpenUnitSrc=1 +BadGlobalSymbol=1 +DuplicateConstructorDestructor=1 +InvalidDirective=1 +PackageNoLink=1 +PackageThreadVar=1 +ImplicitImport=1 +HPPEMITIgnored=1 +NoRetVal=1 +UseBeforeDef=1 +ForLoopVarUndef=1 +UnitNameMismatch=1 +NoCFGFileFound=1 +MessageDirective=1 +ImplicitVariants=1 +UnicodeToLocale=1 +LocaleToUnicode=1 +ImagebaseMultiple=1 +SuspiciousTypecast=1 +PrivatePropAccessor=1 +UnsafeType=1 +UnsafeCode=1 +UnsafeCast=1 +[Linker] +MapFile=0 +OutputObjs=0 +ConsoleApp=1 +DebugInfo=0 +RemoteSymbols=0 +MinStackSize=16384 +MaxStackSize=1048576 +ImageBase=4194304 +ExeDescription=Karaoke Software with rating +[Directories] +OutputDir=E:\Projekte\Ultrastar\Bin +UnitOutputDir= +PackageDLLOutputDir= +PackageDCPOutputDir= +SearchPath=E:\Projekte\Ultrastar\Includes\DelphiX\Source;E:\Projekte\Ultrastar\Includes;E:\Projekte\Ultrastar\Includes\midi;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Sound\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Net\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Mixer\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Image\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_ttf\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDLSpriteEngine\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SFont\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\smpeg\Pas;E:\Projekte\Ultrastar\Includes\Zlportio;E:\Projekte\Ultrastar\Includes\SQLite +Packages=vcl;rtl;vclx;VclSmp;vclshlctrls;DelphiX_for6 +Conditionals=TRANSLATE +DebugSourceDirs= +UsePackages=0 +[Parameters] +RunParams=-benchmark +HostApplication= +Launcher= +UseLauncher=0 +DebugCWD= +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1045 +CodePage=1250 +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= +[HistoryLists\hlConditionals] +Count=2 +Item0=TRANSLATE +Item1=OGL +[HistoryLists\hlUnitAliases] +Count=1 +Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; +[HistoryLists\hlSearchPath] +Count=2 +Item0=E:\Projekte\Ultrastar\Includes\DelphiX\Source;E:\Projekte\Ultrastar\Includes;E:\Projekte\Ultrastar\Includes\midi;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Sound\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Net\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Mixer\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Image\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_ttf\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDLSpriteEngine\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SFont\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\smpeg\Pas;E:\Projekte\Ultrastar\Includes\Zlportio;E:\Projekte\Ultrastar\Includes\SQLite +Item1=E:\Projekte\Ultrastar\Includes\DelphiX\Source;E:\Projekte\Ultrastar\Includes;E:\Projekte\Ultrastar\Includes\midi;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Sound\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Net\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Mixer\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Image\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_ttf\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDLSpriteEngine\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SFont\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\smpeg\Pas +[HistoryLists\hlOutputDirectorry] +Count=3 +Item0=E:\Projekte\Ultrastar\Bin +Item1=E:\Projekte\Ultrastar +Item2=C:\UltraStar\Bin diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr new file mode 100644 index 00000000..5c598eda --- /dev/null +++ b/Game/Code/UltraStar.dpr @@ -0,0 +1,286 @@ + program UltraStar; + +{$DEFINE TRANSLATE} +//DEFINE THEMESAVE} + +{$R 'UltraStar.res' 'UltraStar.rc'} + +uses + {//Earlyer in Code Dir.. Now in SearchDir + DDKint in '..\ZLPortIO\ddkint.pas', + ZLPortIO in '..\ZLPortIO\zlportio.pas', + SQLiteTable3 in '..\SQLite\SQLiteTable3.pas', + SQLite3 in '..\SQLite\SQLite3.pas',} + Windows, + SDL, + SysUtils, + + //Menu Objects + UDisplay in 'Menu\UDisplay.pas', + UMenu in 'Menu\UMenu.pas', + UMenuStatic in 'Menu\UMenuStatic.pas', + UMenuText in 'Menu\UMenuText.pas', + UMenuButton in 'Menu\UMenuButton.pas', + UMenuInteract in 'Menu\UMenuInteract.pas', + UMenuSelect in 'Menu\UMenuSelect.pas', + UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', + UDrawTexture in 'Menu\UDrawTexture.pas', + + //Classes + UGraphic in 'Classes\UGraphic.pas', + UTexture in 'Classes\UTexture.pas', + UMusic in 'Classes\UMusic.pas', + UPliki in 'Classes\UPliki.pas', + UMain in 'Classes\UMain.pas', + UDraw in 'Classes\UDraw.pas', + URecord in 'Classes\URecord.pas', + UTime in 'Classes\UTime.pas', + TextGL in 'Classes\TextGL.pas', + USongs in 'Classes\USongs.pas', + UIni in 'Classes\UIni.pas', + USmpeg in 'SMpeg\USmpeg.pas', + ULyrics in 'Classes\ULyrics.pas', + USkins in 'Classes\USkins.pas', + UThemes in 'Classes\UThemes.pas', + ULog in 'Classes\ULog.pas', + UJoystick in 'Classes\UJoystick.pas', + ULCD in 'Classes\ULCD.pas', + ULight in 'Classes\ULight.pas', + UScores in 'Classes\UScores.pas', + ULanguage in 'Classes\ULanguage.pas', + UCovers in 'Classes\UCovers.pas', + UCatCovers in 'Classes\UCatCovers.pas', + UFiles in 'Classes\UFiles.pas', + UGraphicClasses in 'Classes\UGraphicClasses.pas', + UDLLManager in 'Classes\UDLLManager.pas', + UParty in 'Classes\UParty.pas', + + //Screens + UScreenLoading in 'Screens\UScreenLoading.pas', + UScreenWelcome in 'Screens\UScreenWelcome.pas', + UScreenMain in 'Screens\UScreenMain.pas', + UScreenName in 'Screens\UScreenName.pas', + UScreenLevel in 'Screens\UScreenLevel.pas', + UScreenSong in 'Screens\UScreenSong.pas', + UScreenSing in 'Screens\UScreenSing.pas', + UScreenScore in 'Screens\UScreenScore.pas', + UScreenOptions in 'Screens\UScreenOptions.pas', + UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', + UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', + UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', + UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', + UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', + UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', + UScreenEditSub in 'Screens\UScreenEditSub.pas', + UScreenEdit in 'Screens\UScreenEdit.pas', + UScreenEditConvert in 'Screens\UScreenEditConvert.pas', + UScreenEditHeader in 'Screens\UScreenEditHeader.pas', + UScreenOpen in 'Screens\UScreenOpen.pas', + UScreenTop5 in 'Screens\UScreenTop5.pas', + UScreenSongMenu in 'Screens\UScreenSongMenu.pas', + //PartyMode + UScreenSingModi in 'Screens\UScreenSingModi.pas', + UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', + UScreenPartyScore in 'Screens\UScreenPartyScore.pas', + UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', + UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', + UScreenPartyWin in 'Screens\UScreenPartyWin.pas', + + //Modi SDK + ModiSDK in '..\..\Modis\SDK\ModiSDK.pas'; + +const + Version = 'UltraStar Deluxe V 0.90 Beta'; + +var + WndTitle: string; + hWnd: THandle; + I: Integer; + +begin + WndTitle := Version; + + //Start more than One Time Prevention + hWnd:= FindWindow(nil, PChar(WndTitle)); + //Programm already started + if (hWnd <> 0) then + begin + I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Contìnue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); + if (I = IDYes) then + begin + I := 1; + repeat + Inc(I); + hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); + until (hWnd = 0); + + WndTitle := WndTitle + ' Instance ' + InttoStr(I); + end + else + Exit; + end; + + + + USTime := TTime.Create; + + // Log + Benchmark + Log := TLog.Create; + Log.Title := WndTitle; + Log.BenchmarkStart(0); +// Log.LogError(IntToStr(DayOfTheYear(Date))); + + // Language + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Paths', 'Initialization'); InitializePaths; + Log.LogStatus('Load Language', 'Initialization'); Language := TLanguage.Create; + //Add Const Values: + Language.AddConst('US_VERSION', Version); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Language', 1); + + // SDL + Log.BenchmarkStart(1); + Log.LogStatus('Initialize SDL', 'Initialization'); + SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing SDL', 1); + + // Skin + Log.BenchmarkStart(1); + Log.LogStatus('Loading Skin List', 'Initialization'); Skin := TSkin.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Skin List', 1); + + //Log.LogBenchmark(inttostr(Skin.), 1); + + // Sound Card List + Log.BenchmarkStart(1); + Log.LogStatus('Loading Soundcard list', 'Initialization'); + Recording := TRecord.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Soundcard list', 1); + + // Ini + Paths + Log.BenchmarkStart(1); + Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; + Ini.Load; + Language.ChangeLanguage(ILanguage[Ini.Language]); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Ini', 1); + + // LCD + Log.BenchmarkStart(1); + Log.LogStatus('Load LCD', 'Initialization'); LCD := TLCD.Create; + if Ini.LPT = 1 then begin +// LCD.HalfInterface := true; + LCD.Enable; + LCD.Clear; + LCD.WriteText(1, ' UltraStar '); + LCD.WriteText(2, ' Loading... '); + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading LCD', 1); + + // Light + Log.BenchmarkStart(1); + Log.LogStatus('Load Light', 'Initialization'); Light := TLight.Create; + if Ini.LPT = 2 then begin + Light.Enable; +// Light.LightOne(0, 1000); + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Light', 1); + + // Theme + Log.BenchmarkStart(1); + Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Themes', 1); + + // Covers Cache + Log.BenchmarkStart(1); + Log.LogStatus('Creating Covers Cache', 'Initialization'); Covers := TCovers.Create; + Log.LogBenchmark('Loading Covers Cache Array', 1); + Log.BenchmarkStart(1); + + // Category Covers + Log.BenchmarkStart(1); + Log.LogStatus('Creating Category Covers Array', 'Initialization'); + CatCovers:= TCatCovers.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Category Covers Array', 1); + + // Songs + //Log.BenchmarkStart(1); + Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; + Songs.LoadSongList; + Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Songs', 1); + + // PluginManager + Log.BenchmarkStart(1); + Log.LogStatus('PluginManager', 'Initialization'); + DLLMan := TDLLMan.Create; //Load PluginList + + Log.LogError(inttostr(Length(DLLMan.Plugins)) + ' Plugins Loaded'); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PluginManager', 1); + + // Party Mode Manager + Log.BenchmarkStart(1); + Log.LogStatus('PartySession Manager', 'Initialization'); + PartySession := TParty_Session.Create; //Load PartySession + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PartySession Manager', 1); + + // Graphics + Log.BenchmarkStart(1); + Log.LogStatus('Initialize 3D', 'Initialization'); Initialize3D(WndTitle); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing 3D', 1); + + // Sound + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Sound', 'Initialization'); + Log.LogStatus('Creating Music', 'InitializeSound'); Music := TMusic.Create; + InitializeSound; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Sound', 1); + + // Score Saving System + Log.BenchmarkStart(1); + Log.LogStatus('Score DB System', 'Initialization'); + InitScore('Scores.db'); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Score DB System', 1); + + // Joypad + if Ini.Joypad = 1 then begin + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Joystick', 'Initialization'); Joy := TJoy.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Joystick', 1); + end; + + Log.BenchmarkEnd(0); + Log.LogBenchmark('Loading Time', 0); + + +// Music.SetLoop(true); +// Music.SetVolume(50); +// Music.Open(SkinPath + 'Menu Music 3.mp3'); +// Music.Play; + Log.LogStatus('Main Loop', 'Initialization'); MainLoop; + +// sleep(3000); + + // finish + if Ini.LPT = 1 then LCD.Clear; + if Ini.LPT = 2 then Light.TurnOff; + + Log.Free; +end. \ No newline at end of file diff --git a/Game/Code/UltraStar.identcache2 b/Game/Code/UltraStar.identcache2 new file mode 100644 index 00000000..a437aa7e Binary files /dev/null and b/Game/Code/UltraStar.identcache2 differ diff --git a/Game/Code/UltraStar.rc b/Game/Code/UltraStar.rc new file mode 100644 index 00000000..22ee2142 --- /dev/null +++ b/Game/Code/UltraStar.rc @@ -0,0 +1,15 @@ +Button JPG "..\Graphics\MusicWheelItem song.jpg" + +Font BMP "..\Fonts\Normal\Font Normal 16.bmp" +Font FNT "..\Fonts\Normal\Font Normal.dat" + +FontB BMP "..\Fonts\Bold\Font 1024 Bold 16.bmp" +FontB FNT "..\Fonts\Bold\Font 1024 Bold.dat" + +FontO BMP "..\Fonts\Outline 1\Outline 36 (1024) 16c.bmp" +FontO FNT "..\Fonts\Outline 1\Outline 36 (1024).dat" + +FontO2 BMP "..\Fonts\Outline 2\5 - Outline Dark Edited 16c.bmp" +FontO2 FNT "..\Fonts\Outline 2\Outline.dat" + +MAINICON ICON "..\Graphics\us.ico" diff --git a/Game/Code/UltraStar.~dpr b/Game/Code/UltraStar.~dpr new file mode 100644 index 00000000..a27201e9 --- /dev/null +++ b/Game/Code/UltraStar.~dpr @@ -0,0 +1,285 @@ + program UltraStar; + +{$DEFINE TRANSLATE} +//DEFINE THEMESAVE} + +{$R 'UltraStar.res' 'UltraStar.rc'} + +uses + {//Earlyer in Code Dir.. Now in SearchDir + DDKint in '..\ZLPortIO\ddkint.pas', + ZLPortIO in '..\ZLPortIO\zlportio.pas', + SQLiteTable3 in '..\SQLite\SQLiteTable3.pas', + SQLite3 in '..\SQLite\SQLite3.pas',} + Windows, + SDL, + + //Menu Objects + UDisplay in 'Menu\UDisplay.pas', + UMenu in 'Menu\UMenu.pas', + UMenuStatic in 'Menu\UMenuStatic.pas', + UMenuText in 'Menu\UMenuText.pas', + UMenuButton in 'Menu\UMenuButton.pas', + UMenuInteract in 'Menu\UMenuInteract.pas', + UMenuSelect in 'Menu\UMenuSelect.pas', + UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', + UDrawTexture in 'Menu\UDrawTexture.pas', + + //Classes + UGraphic in 'Classes\UGraphic.pas', + UTexture in 'Classes\UTexture.pas', + UMusic in 'Classes\UMusic.pas', + UPliki in 'Classes\UPliki.pas', + UMain in 'Classes\UMain.pas', + UDraw in 'Classes\UDraw.pas', + URecord in 'Classes\URecord.pas', + UTime in 'Classes\UTime.pas', + TextGL in 'Classes\TextGL.pas', + USongs in 'Classes\USongs.pas', + UIni in 'Classes\UIni.pas', + USmpeg in 'SMpeg\USmpeg.pas', + ULyrics in 'Classes\ULyrics.pas', + USkins in 'Classes\USkins.pas', + UThemes in 'Classes\UThemes.pas', + ULog in 'Classes\ULog.pas', + UJoystick in 'Classes\UJoystick.pas', + ULCD in 'Classes\ULCD.pas', + ULight in 'Classes\ULight.pas', + UScores in 'Classes\UScores.pas', + ULanguage in 'Classes\ULanguage.pas', + UCovers in 'Classes\UCovers.pas', + UCatCovers in 'Classes\UCatCovers.pas', + UFiles in 'Classes\UFiles.pas', + UGraphicClasses in 'Classes\UGraphicClasses.pas', + UDLLManager in 'Classes\UDLLManager.pas', + UParty in 'Classes\UParty.pas', + + //Screens + UScreenLoading in 'Screens\UScreenLoading.pas', + UScreenWelcome in 'Screens\UScreenWelcome.pas', + UScreenMain in 'Screens\UScreenMain.pas', + UScreenName in 'Screens\UScreenName.pas', + UScreenLevel in 'Screens\UScreenLevel.pas', + UScreenSong in 'Screens\UScreenSong.pas', + UScreenSing in 'Screens\UScreenSing.pas', + UScreenScore in 'Screens\UScreenScore.pas', + UScreenOptions in 'Screens\UScreenOptions.pas', + UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', + UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', + UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', + UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', + UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', + UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', + UScreenEditSub in 'Screens\UScreenEditSub.pas', + UScreenEdit in 'Screens\UScreenEdit.pas', + UScreenEditConvert in 'Screens\UScreenEditConvert.pas', + UScreenEditHeader in 'Screens\UScreenEditHeader.pas', + UScreenOpen in 'Screens\UScreenOpen.pas', + UScreenTop5 in 'Screens\UScreenTop5.pas', + UScreenSongMenu in 'Screens\UScreenSongMenu.pas', + //PartyMode + UScreenSingModi in 'Screens\UScreenSingModi.pas', + UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', + UScreenPartyScore in 'Screens\UScreenPartyScore.pas', + UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', + UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', + UScreenPartyWin in 'Screens\UScreenPartyWin.pas', + + //Modi SDK + ModiSDK in '..\..\Modis\SDK\ModiSDK.pas'; + +const + Version = 'UltraStar Deluxe V 0.90 Beta'; + +var + WndTitle: string; + hWnd: THandle; + I: Integer; + +begin + WndTitle := Version; + + //Start more than One Time Prevention + hWnd:= FindWindow(nil, PChar(WndTitle)); + //Programm already started + if (hWnd <> 0) then + begin + I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Contìnue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); + if (I = IDYes) then + begin + I := 1; + repeat + Inc(I); + hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); + until (hWnd = 0); + + WndTitle := WndTitle + ' Instance ' + InttoStr(I); + end + else + Exit; + end; + + + + USTime := TTime.Create; + + // Log + Benchmark + Log := TLog.Create; + Log.Title := WndTitle; + Log.BenchmarkStart(0); +// Log.LogError(IntToStr(DayOfTheYear(Date))); + + // Language + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Paths', 'Initialization'); InitializePaths; + Log.LogStatus('Load Language', 'Initialization'); Language := TLanguage.Create; + //Add Const Values: + Language.AddConst('US_VERSION', Version); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Language', 1); + + // SDL + Log.BenchmarkStart(1); + Log.LogStatus('Initialize SDL', 'Initialization'); + SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing SDL', 1); + + // Skin + Log.BenchmarkStart(1); + Log.LogStatus('Loading Skin List', 'Initialization'); Skin := TSkin.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Skin List', 1); + + //Log.LogBenchmark(inttostr(Skin.), 1); + + // Sound Card List + Log.BenchmarkStart(1); + Log.LogStatus('Loading Soundcard list', 'Initialization'); + Recording := TRecord.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Soundcard list', 1); + + // Ini + Paths + Log.BenchmarkStart(1); + Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; + Ini.Load; + Language.ChangeLanguage(ILanguage[Ini.Language]); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Ini', 1); + + // LCD + Log.BenchmarkStart(1); + Log.LogStatus('Load LCD', 'Initialization'); LCD := TLCD.Create; + if Ini.LPT = 1 then begin +// LCD.HalfInterface := true; + LCD.Enable; + LCD.Clear; + LCD.WriteText(1, ' UltraStar '); + LCD.WriteText(2, ' Loading... '); + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading LCD', 1); + + // Light + Log.BenchmarkStart(1); + Log.LogStatus('Load Light', 'Initialization'); Light := TLight.Create; + if Ini.LPT = 2 then begin + Light.Enable; +// Light.LightOne(0, 1000); + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Light', 1); + + // Theme + Log.BenchmarkStart(1); + Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Themes', 1); + + // Covers Cache + Log.BenchmarkStart(1); + Log.LogStatus('Creating Covers Cache', 'Initialization'); Covers := TCovers.Create; + Log.LogBenchmark('Loading Covers Cache Array', 1); + Log.BenchmarkStart(1); + + // Category Covers + Log.BenchmarkStart(1); + Log.LogStatus('Creating Category Covers Array', 'Initialization'); + CatCovers:= TCatCovers.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Category Covers Array', 1); + + // Songs + //Log.BenchmarkStart(1); + Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; + Songs.LoadSongList; + Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Songs', 1); + + // PluginManager + Log.BenchmarkStart(1); + Log.LogStatus('PluginManager', 'Initialization'); + DLLMan := TDLLMan.Create; //Load PluginList + + Log.LogError(inttostr(Length(DLLMan.Plugins)) + ' Plugins Loaded'); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PluginManager', 1); + + // Party Mode Manager + Log.BenchmarkStart(1); + Log.LogStatus('PartySession Manager', 'Initialization'); + PartySession := TParty_Session.Create; //Load PartySession + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PartySession Manager', 1); + + // Graphics + Log.BenchmarkStart(1); + Log.LogStatus('Initialize 3D', 'Initialization'); Initialize3D(WndTitle); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing 3D', 1); + + // Sound + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Sound', 'Initialization'); + Log.LogStatus('Creating Music', 'InitializeSound'); Music := TMusic.Create; + InitializeSound; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Sound', 1); + + // Score Saving System + Log.BenchmarkStart(1); + Log.LogStatus('Score DB System', 'Initialization'); + InitScore('Scores.db'); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Score DB System', 1); + + // Joypad + if Ini.Joypad = 1 then begin + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Joystick', 'Initialization'); Joy := TJoy.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Joystick', 1); + end; + + Log.BenchmarkEnd(0); + Log.LogBenchmark('Loading Time', 0); + + +// Music.SetLoop(true); +// Music.SetVolume(50); +// Music.Open(SkinPath + 'Menu Music 3.mp3'); +// Music.Play; + Log.LogStatus('Main Loop', 'Initialization'); MainLoop; + +// sleep(3000); + + // finish + if Ini.LPT = 1 then LCD.Clear; + if Ini.LPT = 2 then Light.TurnOff; + + Log.Free; +end. \ No newline at end of file diff --git a/Game/Code/rccompillieren.bat b/Game/Code/rccompillieren.bat new file mode 100644 index 00000000..4e2f2584 --- /dev/null +++ b/Game/Code/rccompillieren.bat @@ -0,0 +1 @@ +BRC32 -r UltraStar.RC \ No newline at end of file -- cgit v1.2.3 From 1bc44c27d036ff57c6d01e3a813fce519c34d27f Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 21 Mar 2007 19:32:47 +0000 Subject: =?UTF-8?q?Datei=20/=20Ordner=20gel=C3=B6scht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@3 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.RES | Bin 1341060 -> 0 bytes Game/Code/UltraStar.bdsproj | 168 ---------------------- Game/Code/UltraStar.bdsproj.local | 2 - Game/Code/UltraStar.cfg | 41 ------ Game/Code/UltraStar.dof | 148 -------------------- Game/Code/UltraStar.identcache2 | Bin 3983 -> 0 bytes Game/Code/UltraStar.~dpr | 285 -------------------------------------- 7 files changed, 644 deletions(-) delete mode 100644 Game/Code/UltraStar.RES delete mode 100644 Game/Code/UltraStar.bdsproj delete mode 100644 Game/Code/UltraStar.bdsproj.local delete mode 100644 Game/Code/UltraStar.cfg delete mode 100644 Game/Code/UltraStar.dof delete mode 100644 Game/Code/UltraStar.identcache2 delete mode 100644 Game/Code/UltraStar.~dpr (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.RES b/Game/Code/UltraStar.RES deleted file mode 100644 index fcaa4576..00000000 Binary files a/Game/Code/UltraStar.RES and /dev/null differ diff --git a/Game/Code/UltraStar.bdsproj b/Game/Code/UltraStar.bdsproj deleted file mode 100644 index e11acf91..00000000 --- a/Game/Code/UltraStar.bdsproj +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - - - - - - UltraStar.dpr - - - 7.0 - - - 8 - 0 - 1 - 1 - 0 - 0 - 1 - 1 - 1 - 0 - 0 - 1 - 0 - 1 - 1 - 1 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 1 - 1 - 1 - True - False - WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; - - False - - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - True - - - 0 - 0 - 1 - False - False - False - 16384 - 1048576 - 4194304 - - - - E:\Projekte\Ultrastar - - - - E:\Projekte\Ultrastar\Includes;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\smpeg\Pas;E:\Projekte\Ultrastar\Includes\midi - vcl;rtl;vclx;VclSmp;vclshlctrls;DelphiX_for6 - TRANSLATE - - False - - - -benchmark - - - False - - - - - - False - - - False - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1045 - 1250 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - diff --git a/Game/Code/UltraStar.bdsproj.local b/Game/Code/UltraStar.bdsproj.local deleted file mode 100644 index d576f039..00000000 --- a/Game/Code/UltraStar.bdsproj.local +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/Game/Code/UltraStar.cfg b/Game/Code/UltraStar.cfg deleted file mode 100644 index 5ade3beb..00000000 --- a/Game/Code/UltraStar.cfg +++ /dev/null @@ -1,41 +0,0 @@ --$A8 --$B- --$C+ --$D+ --$E- --$F- --$G+ --$H+ --$I+ --$J- --$K- --$L+ --$M- --$N+ --$O+ --$P+ --$Q- --$R- --$S- --$T- --$U- --$V+ --$W- --$X+ --$YD --$Z1 --cg --AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; --H+ --W- --M --$M16384,1048576 --K$00400000 --E"E:\Projekte\Ultrastar\Bin" --LE"e:\programme\borland\delphi7\Projects\Bpl" --LN"e:\programme\borland\delphi7\Projects\Bpl" --U"E:\Projekte\Ultrastar\Includes\DelphiX\Source;E:\Projekte\Ultrastar\Includes;E:\Projekte\Ultrastar\Includes\midi;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Sound\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Net\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Mixer\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Image\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_ttf\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDLSpriteEngine\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SFont\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\smpeg\Pas;E:\Projekte\Ultrastar\Includes\Zlportio;E:\Projekte\Ultrastar\Includes\SQLite" --O"E:\Projekte\Ultrastar\Includes\DelphiX\Source;E:\Projekte\Ultrastar\Includes;E:\Projekte\Ultrastar\Includes\midi;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Sound\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Net\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Mixer\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Image\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_ttf\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDLSpriteEngine\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SFont\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\smpeg\Pas;E:\Projekte\Ultrastar\Includes\Zlportio;E:\Projekte\Ultrastar\Includes\SQLite" --I"E:\Projekte\Ultrastar\Includes\DelphiX\Source;E:\Projekte\Ultrastar\Includes;E:\Projekte\Ultrastar\Includes\midi;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Sound\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Net\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Mixer\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Image\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_ttf\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDLSpriteEngine\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SFont\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\smpeg\Pas;E:\Projekte\Ultrastar\Includes\Zlportio;E:\Projekte\Ultrastar\Includes\SQLite" --R"E:\Projekte\Ultrastar\Includes\DelphiX\Source;E:\Projekte\Ultrastar\Includes;E:\Projekte\Ultrastar\Includes\midi;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Sound\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Net\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Mixer\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Image\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_ttf\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDLSpriteEngine\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SFont\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\smpeg\Pas;E:\Projekte\Ultrastar\Includes\Zlportio;E:\Projekte\Ultrastar\Includes\SQLite" --DTRANSLATE diff --git a/Game/Code/UltraStar.dof b/Game/Code/UltraStar.dof deleted file mode 100644 index 174b4358..00000000 --- a/Game/Code/UltraStar.dof +++ /dev/null @@ -1,148 +0,0 @@ -[FileVersion] -Version=7.0 -[Compiler] -A=8 -B=0 -C=1 -D=1 -E=0 -F=0 -G=1 -H=1 -I=1 -J=0 -K=0 -L=1 -M=0 -N=1 -O=1 -P=1 -Q=0 -R=0 -S=0 -T=0 -U=0 -V=1 -W=0 -X=1 -Y=1 -Z=1 -ShowHints=1 -ShowWarnings=0 -UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; -NamespacePrefix= -SymbolDeprecated=1 -SymbolLibrary=1 -SymbolPlatform=1 -UnitLibrary=1 -UnitPlatform=1 -UnitDeprecated=1 -HResultCompat=1 -HidingMember=1 -HiddenVirtual=1 -Garbage=1 -BoundsError=1 -ZeroNilCompat=1 -StringConstTruncated=1 -ForLoopVarVarPar=1 -TypedConstVarPar=1 -AsgToTypedConst=1 -CaseLabelRange=1 -ForVariable=1 -ConstructingAbstract=1 -ComparisonFalse=1 -ComparisonTrue=1 -ComparingSignedUnsigned=1 -CombiningSignedUnsigned=1 -UnsupportedConstruct=1 -FileOpen=1 -FileOpenUnitSrc=1 -BadGlobalSymbol=1 -DuplicateConstructorDestructor=1 -InvalidDirective=1 -PackageNoLink=1 -PackageThreadVar=1 -ImplicitImport=1 -HPPEMITIgnored=1 -NoRetVal=1 -UseBeforeDef=1 -ForLoopVarUndef=1 -UnitNameMismatch=1 -NoCFGFileFound=1 -MessageDirective=1 -ImplicitVariants=1 -UnicodeToLocale=1 -LocaleToUnicode=1 -ImagebaseMultiple=1 -SuspiciousTypecast=1 -PrivatePropAccessor=1 -UnsafeType=1 -UnsafeCode=1 -UnsafeCast=1 -[Linker] -MapFile=0 -OutputObjs=0 -ConsoleApp=1 -DebugInfo=0 -RemoteSymbols=0 -MinStackSize=16384 -MaxStackSize=1048576 -ImageBase=4194304 -ExeDescription=Karaoke Software with rating -[Directories] -OutputDir=E:\Projekte\Ultrastar\Bin -UnitOutputDir= -PackageDLLOutputDir= -PackageDCPOutputDir= -SearchPath=E:\Projekte\Ultrastar\Includes\DelphiX\Source;E:\Projekte\Ultrastar\Includes;E:\Projekte\Ultrastar\Includes\midi;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Sound\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Net\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Mixer\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Image\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_ttf\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDLSpriteEngine\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SFont\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\smpeg\Pas;E:\Projekte\Ultrastar\Includes\Zlportio;E:\Projekte\Ultrastar\Includes\SQLite -Packages=vcl;rtl;vclx;VclSmp;vclshlctrls;DelphiX_for6 -Conditionals=TRANSLATE -DebugSourceDirs= -UsePackages=0 -[Parameters] -RunParams=-benchmark -HostApplication= -Launcher= -UseLauncher=0 -DebugCWD= -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1045 -CodePage=1250 -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= -[HistoryLists\hlConditionals] -Count=2 -Item0=TRANSLATE -Item1=OGL -[HistoryLists\hlUnitAliases] -Count=1 -Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; -[HistoryLists\hlSearchPath] -Count=2 -Item0=E:\Projekte\Ultrastar\Includes\DelphiX\Source;E:\Projekte\Ultrastar\Includes;E:\Projekte\Ultrastar\Includes\midi;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Sound\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Net\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Mixer\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Image\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_ttf\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDLSpriteEngine\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SFont\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\smpeg\Pas;E:\Projekte\Ultrastar\Includes\Zlportio;E:\Projekte\Ultrastar\Includes\SQLite -Item1=E:\Projekte\Ultrastar\Includes\DelphiX\Source;E:\Projekte\Ultrastar\Includes;E:\Projekte\Ultrastar\Includes\midi;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Sound\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Net\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Mixer\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_Image\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDL_ttf\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SDLSpriteEngine\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\SFont\Pas;E:\Projekte\Ultrastar\Includes\JEDI-SDL\smpeg\Pas -[HistoryLists\hlOutputDirectorry] -Count=3 -Item0=E:\Projekte\Ultrastar\Bin -Item1=E:\Projekte\Ultrastar -Item2=C:\UltraStar\Bin diff --git a/Game/Code/UltraStar.identcache2 b/Game/Code/UltraStar.identcache2 deleted file mode 100644 index a437aa7e..00000000 Binary files a/Game/Code/UltraStar.identcache2 and /dev/null differ diff --git a/Game/Code/UltraStar.~dpr b/Game/Code/UltraStar.~dpr deleted file mode 100644 index a27201e9..00000000 --- a/Game/Code/UltraStar.~dpr +++ /dev/null @@ -1,285 +0,0 @@ - program UltraStar; - -{$DEFINE TRANSLATE} -//DEFINE THEMESAVE} - -{$R 'UltraStar.res' 'UltraStar.rc'} - -uses - {//Earlyer in Code Dir.. Now in SearchDir - DDKint in '..\ZLPortIO\ddkint.pas', - ZLPortIO in '..\ZLPortIO\zlportio.pas', - SQLiteTable3 in '..\SQLite\SQLiteTable3.pas', - SQLite3 in '..\SQLite\SQLite3.pas',} - Windows, - SDL, - - //Menu Objects - UDisplay in 'Menu\UDisplay.pas', - UMenu in 'Menu\UMenu.pas', - UMenuStatic in 'Menu\UMenuStatic.pas', - UMenuText in 'Menu\UMenuText.pas', - UMenuButton in 'Menu\UMenuButton.pas', - UMenuInteract in 'Menu\UMenuInteract.pas', - UMenuSelect in 'Menu\UMenuSelect.pas', - UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', - UDrawTexture in 'Menu\UDrawTexture.pas', - - //Classes - UGraphic in 'Classes\UGraphic.pas', - UTexture in 'Classes\UTexture.pas', - UMusic in 'Classes\UMusic.pas', - UPliki in 'Classes\UPliki.pas', - UMain in 'Classes\UMain.pas', - UDraw in 'Classes\UDraw.pas', - URecord in 'Classes\URecord.pas', - UTime in 'Classes\UTime.pas', - TextGL in 'Classes\TextGL.pas', - USongs in 'Classes\USongs.pas', - UIni in 'Classes\UIni.pas', - USmpeg in 'SMpeg\USmpeg.pas', - ULyrics in 'Classes\ULyrics.pas', - USkins in 'Classes\USkins.pas', - UThemes in 'Classes\UThemes.pas', - ULog in 'Classes\ULog.pas', - UJoystick in 'Classes\UJoystick.pas', - ULCD in 'Classes\ULCD.pas', - ULight in 'Classes\ULight.pas', - UScores in 'Classes\UScores.pas', - ULanguage in 'Classes\ULanguage.pas', - UCovers in 'Classes\UCovers.pas', - UCatCovers in 'Classes\UCatCovers.pas', - UFiles in 'Classes\UFiles.pas', - UGraphicClasses in 'Classes\UGraphicClasses.pas', - UDLLManager in 'Classes\UDLLManager.pas', - UParty in 'Classes\UParty.pas', - - //Screens - UScreenLoading in 'Screens\UScreenLoading.pas', - UScreenWelcome in 'Screens\UScreenWelcome.pas', - UScreenMain in 'Screens\UScreenMain.pas', - UScreenName in 'Screens\UScreenName.pas', - UScreenLevel in 'Screens\UScreenLevel.pas', - UScreenSong in 'Screens\UScreenSong.pas', - UScreenSing in 'Screens\UScreenSing.pas', - UScreenScore in 'Screens\UScreenScore.pas', - UScreenOptions in 'Screens\UScreenOptions.pas', - UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', - UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', - UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', - UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', - UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', - UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', - UScreenEditSub in 'Screens\UScreenEditSub.pas', - UScreenEdit in 'Screens\UScreenEdit.pas', - UScreenEditConvert in 'Screens\UScreenEditConvert.pas', - UScreenEditHeader in 'Screens\UScreenEditHeader.pas', - UScreenOpen in 'Screens\UScreenOpen.pas', - UScreenTop5 in 'Screens\UScreenTop5.pas', - UScreenSongMenu in 'Screens\UScreenSongMenu.pas', - //PartyMode - UScreenSingModi in 'Screens\UScreenSingModi.pas', - UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', - UScreenPartyScore in 'Screens\UScreenPartyScore.pas', - UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', - UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', - UScreenPartyWin in 'Screens\UScreenPartyWin.pas', - - //Modi SDK - ModiSDK in '..\..\Modis\SDK\ModiSDK.pas'; - -const - Version = 'UltraStar Deluxe V 0.90 Beta'; - -var - WndTitle: string; - hWnd: THandle; - I: Integer; - -begin - WndTitle := Version; - - //Start more than One Time Prevention - hWnd:= FindWindow(nil, PChar(WndTitle)); - //Programm already started - if (hWnd <> 0) then - begin - I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Contìnue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); - if (I = IDYes) then - begin - I := 1; - repeat - Inc(I); - hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); - until (hWnd = 0); - - WndTitle := WndTitle + ' Instance ' + InttoStr(I); - end - else - Exit; - end; - - - - USTime := TTime.Create; - - // Log + Benchmark - Log := TLog.Create; - Log.Title := WndTitle; - Log.BenchmarkStart(0); -// Log.LogError(IntToStr(DayOfTheYear(Date))); - - // Language - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Paths', 'Initialization'); InitializePaths; - Log.LogStatus('Load Language', 'Initialization'); Language := TLanguage.Create; - //Add Const Values: - Language.AddConst('US_VERSION', Version); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Language', 1); - - // SDL - Log.BenchmarkStart(1); - Log.LogStatus('Initialize SDL', 'Initialization'); - SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing SDL', 1); - - // Skin - Log.BenchmarkStart(1); - Log.LogStatus('Loading Skin List', 'Initialization'); Skin := TSkin.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Skin List', 1); - - //Log.LogBenchmark(inttostr(Skin.), 1); - - // Sound Card List - Log.BenchmarkStart(1); - Log.LogStatus('Loading Soundcard list', 'Initialization'); - Recording := TRecord.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Soundcard list', 1); - - // Ini + Paths - Log.BenchmarkStart(1); - Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; - Ini.Load; - Language.ChangeLanguage(ILanguage[Ini.Language]); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Ini', 1); - - // LCD - Log.BenchmarkStart(1); - Log.LogStatus('Load LCD', 'Initialization'); LCD := TLCD.Create; - if Ini.LPT = 1 then begin -// LCD.HalfInterface := true; - LCD.Enable; - LCD.Clear; - LCD.WriteText(1, ' UltraStar '); - LCD.WriteText(2, ' Loading... '); - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading LCD', 1); - - // Light - Log.BenchmarkStart(1); - Log.LogStatus('Load Light', 'Initialization'); Light := TLight.Create; - if Ini.LPT = 2 then begin - Light.Enable; -// Light.LightOne(0, 1000); - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Light', 1); - - // Theme - Log.BenchmarkStart(1); - Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Themes', 1); - - // Covers Cache - Log.BenchmarkStart(1); - Log.LogStatus('Creating Covers Cache', 'Initialization'); Covers := TCovers.Create; - Log.LogBenchmark('Loading Covers Cache Array', 1); - Log.BenchmarkStart(1); - - // Category Covers - Log.BenchmarkStart(1); - Log.LogStatus('Creating Category Covers Array', 'Initialization'); - CatCovers:= TCatCovers.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Category Covers Array', 1); - - // Songs - //Log.BenchmarkStart(1); - Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; - Songs.LoadSongList; - Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Songs', 1); - - // PluginManager - Log.BenchmarkStart(1); - Log.LogStatus('PluginManager', 'Initialization'); - DLLMan := TDLLMan.Create; //Load PluginList - - Log.LogError(inttostr(Length(DLLMan.Plugins)) + ' Plugins Loaded'); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PluginManager', 1); - - // Party Mode Manager - Log.BenchmarkStart(1); - Log.LogStatus('PartySession Manager', 'Initialization'); - PartySession := TParty_Session.Create; //Load PartySession - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PartySession Manager', 1); - - // Graphics - Log.BenchmarkStart(1); - Log.LogStatus('Initialize 3D', 'Initialization'); Initialize3D(WndTitle); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing 3D', 1); - - // Sound - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Sound', 'Initialization'); - Log.LogStatus('Creating Music', 'InitializeSound'); Music := TMusic.Create; - InitializeSound; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Sound', 1); - - // Score Saving System - Log.BenchmarkStart(1); - Log.LogStatus('Score DB System', 'Initialization'); - InitScore('Scores.db'); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Score DB System', 1); - - // Joypad - if Ini.Joypad = 1 then begin - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Joystick', 'Initialization'); Joy := TJoy.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Joystick', 1); - end; - - Log.BenchmarkEnd(0); - Log.LogBenchmark('Loading Time', 0); - - -// Music.SetLoop(true); -// Music.SetVolume(50); -// Music.Open(SkinPath + 'Menu Music 3.mp3'); -// Music.Play; - Log.LogStatus('Main Loop', 'Initialization'); MainLoop; - -// sleep(3000); - - // finish - if Ini.LPT = 1 then LCD.Clear; - if Ini.LPT = 2 then Light.TurnOff; - - Log.Free; -end. \ No newline at end of file -- cgit v1.2.3 From 947647a5b38bf5b389e1f8b1f06308f564748fb8 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 21 Mar 2007 19:34:36 +0000 Subject: =?UTF-8?q?Datei=20/=20Ordner=20gel=C3=B6scht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@4 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.dcu | Bin 8556 -> 0 bytes Game/Code/Classes/UCatCovers.dcu | Bin 4945 -> 0 bytes Game/Code/Classes/UCovers.dcu | Bin 6055 -> 0 bytes Game/Code/Classes/UDLLManager.dcu | Bin 6021 -> 0 bytes Game/Code/Classes/UDraw.dcu | Bin 41304 -> 0 bytes Game/Code/Classes/UFiles.dcu | Bin 4673 -> 0 bytes Game/Code/Classes/UGraphic.dcu | Bin 18647 -> 0 bytes Game/Code/Classes/UGraphicClasses.dcu | Bin 341 -> 0 bytes Game/Code/Classes/UIni.dcu | Bin 22355 -> 0 bytes Game/Code/Classes/UJoystick.dcu | Bin 2268 -> 0 bytes Game/Code/Classes/ULCD.dcu | Bin 5497 -> 0 bytes Game/Code/Classes/ULCD.~pas | 287 ---------------------------------- Game/Code/Classes/ULanguage.dcu | Bin 6519 -> 0 bytes Game/Code/Classes/ULight.dcu | Bin 2389 -> 0 bytes Game/Code/Classes/ULog.dcu | Bin 6217 -> 0 bytes Game/Code/Classes/ULyrics.dcu | Bin 9029 -> 0 bytes Game/Code/Classes/UMain.dcu | Bin 11501 -> 0 bytes Game/Code/Classes/UMusic.dcu | Bin 15179 -> 0 bytes Game/Code/Classes/UParty.dcu | Bin 4129 -> 0 bytes Game/Code/Classes/UPliki.dcu | Bin 19679 -> 0 bytes Game/Code/Classes/URecord.dcu | Bin 6913 -> 0 bytes Game/Code/Classes/UScores.dcu | Bin 4811 -> 0 bytes Game/Code/Classes/USkins.dcu | Bin 5747 -> 0 bytes Game/Code/Classes/USongs.dcu | Bin 13980 -> 0 bytes Game/Code/Classes/UTexture.dcu | Bin 19192 -> 0 bytes Game/Code/Classes/UThemes.dcu | Bin 59165 -> 0 bytes Game/Code/Classes/UTime.dcu | Bin 2083 -> 0 bytes 27 files changed, 287 deletions(-) delete mode 100644 Game/Code/Classes/TextGL.dcu delete mode 100644 Game/Code/Classes/UCatCovers.dcu delete mode 100644 Game/Code/Classes/UCovers.dcu delete mode 100644 Game/Code/Classes/UDLLManager.dcu delete mode 100644 Game/Code/Classes/UDraw.dcu delete mode 100644 Game/Code/Classes/UFiles.dcu delete mode 100644 Game/Code/Classes/UGraphic.dcu delete mode 100644 Game/Code/Classes/UGraphicClasses.dcu delete mode 100644 Game/Code/Classes/UIni.dcu delete mode 100644 Game/Code/Classes/UJoystick.dcu delete mode 100644 Game/Code/Classes/ULCD.dcu delete mode 100644 Game/Code/Classes/ULCD.~pas delete mode 100644 Game/Code/Classes/ULanguage.dcu delete mode 100644 Game/Code/Classes/ULight.dcu delete mode 100644 Game/Code/Classes/ULog.dcu delete mode 100644 Game/Code/Classes/ULyrics.dcu delete mode 100644 Game/Code/Classes/UMain.dcu delete mode 100644 Game/Code/Classes/UMusic.dcu delete mode 100644 Game/Code/Classes/UParty.dcu delete mode 100644 Game/Code/Classes/UPliki.dcu delete mode 100644 Game/Code/Classes/URecord.dcu delete mode 100644 Game/Code/Classes/UScores.dcu delete mode 100644 Game/Code/Classes/USkins.dcu delete mode 100644 Game/Code/Classes/USongs.dcu delete mode 100644 Game/Code/Classes/UTexture.dcu delete mode 100644 Game/Code/Classes/UThemes.dcu delete mode 100644 Game/Code/Classes/UTime.dcu (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.dcu b/Game/Code/Classes/TextGL.dcu deleted file mode 100644 index 772d09c1..00000000 Binary files a/Game/Code/Classes/TextGL.dcu and /dev/null differ diff --git a/Game/Code/Classes/UCatCovers.dcu b/Game/Code/Classes/UCatCovers.dcu deleted file mode 100644 index 2ff7a7d9..00000000 Binary files a/Game/Code/Classes/UCatCovers.dcu and /dev/null differ diff --git a/Game/Code/Classes/UCovers.dcu b/Game/Code/Classes/UCovers.dcu deleted file mode 100644 index ca99fc7c..00000000 Binary files a/Game/Code/Classes/UCovers.dcu and /dev/null differ diff --git a/Game/Code/Classes/UDLLManager.dcu b/Game/Code/Classes/UDLLManager.dcu deleted file mode 100644 index 3ba97949..00000000 Binary files a/Game/Code/Classes/UDLLManager.dcu and /dev/null differ diff --git a/Game/Code/Classes/UDraw.dcu b/Game/Code/Classes/UDraw.dcu deleted file mode 100644 index a3fcecc9..00000000 Binary files a/Game/Code/Classes/UDraw.dcu and /dev/null differ diff --git a/Game/Code/Classes/UFiles.dcu b/Game/Code/Classes/UFiles.dcu deleted file mode 100644 index 9ed45d8f..00000000 Binary files a/Game/Code/Classes/UFiles.dcu and /dev/null differ diff --git a/Game/Code/Classes/UGraphic.dcu b/Game/Code/Classes/UGraphic.dcu deleted file mode 100644 index c264b16b..00000000 Binary files a/Game/Code/Classes/UGraphic.dcu and /dev/null differ diff --git a/Game/Code/Classes/UGraphicClasses.dcu b/Game/Code/Classes/UGraphicClasses.dcu deleted file mode 100644 index 58d003b0..00000000 Binary files a/Game/Code/Classes/UGraphicClasses.dcu and /dev/null differ diff --git a/Game/Code/Classes/UIni.dcu b/Game/Code/Classes/UIni.dcu deleted file mode 100644 index e891d36c..00000000 Binary files a/Game/Code/Classes/UIni.dcu and /dev/null differ diff --git a/Game/Code/Classes/UJoystick.dcu b/Game/Code/Classes/UJoystick.dcu deleted file mode 100644 index 62cde484..00000000 Binary files a/Game/Code/Classes/UJoystick.dcu and /dev/null differ diff --git a/Game/Code/Classes/ULCD.dcu b/Game/Code/Classes/ULCD.dcu deleted file mode 100644 index 8098a187..00000000 Binary files a/Game/Code/Classes/ULCD.dcu and /dev/null differ diff --git a/Game/Code/Classes/ULCD.~pas b/Game/Code/Classes/ULCD.~pas deleted file mode 100644 index a127c689..00000000 --- a/Game/Code/Classes/ULCD.~pas +++ /dev/null @@ -1,287 +0,0 @@ -unit ULCD; - -interface - -type - TLCD = class - private - Enabled: boolean; - Text: array[1..6] of string; - StartPos: integer; - LineBR: integer; - Position: integer; - procedure WriteCommand(B: byte); - procedure WriteData(B: byte); - procedure WriteString(S: string); - public - HalfInterface: boolean; - constructor Create; - procedure Enable; - procedure Clear; - procedure WriteText(Line: integer; S: string); - procedure MoveCursor(Line, Pos: integer); - procedure ShowCursor; - procedure HideCursor; - - // for 2x16 - procedure AddTextBR(S: string); - procedure MoveCursorBR(Pos: integer); - procedure ScrollUpBR; - procedure AddTextArray(Line:integer; S: string); - end; - -var - LCD: TLCD; - -const - Data = $378; // domyœlny adres portu - Status = Data + 1; - Control = Data + 2; - -implementation - -uses - SysUtils, zlportio, UTime; - -procedure TLCD.WriteCommand(B: Byte); -// Wysylanie komend sterujacych -begin - if not HalfInterface then begin - zlioportwrite(Control, 0, $02); - zlioportwrite(Data, 0, B); - zlioportwrite(Control, 0, $03); - end else begin - zlioportwrite(Control, 0, $02); - zlioportwrite(Data, 0, B and $F0); - zlioportwrite(Control, 0, $03); - - TimeSleep(0.1); - - zlioportwrite(Control, 0, $02); - zlioportwrite(Data, 0, (B * 16) and $F0); - zlioportwrite(Control, 0, $03); - end; - - if (B=1) or (B=2) then - Sleep(2) - else - TimeSleep(0.1); -end; - -procedure TLCD.WriteData(B: Byte); -// Wysylanie danych -begin - if not HalfInterface then begin - zlioportwrite(Control, 0, $06); - zlioportwrite(Data, 0, B); - zlioportwrite(Control, 0, $07); - end else begin - zlioportwrite(Control, 0, $06); - zlioportwrite(Data, 0, B and $F0); - zlioportwrite(Control, 0, $07); - - TimeSleep(0.1); - - zlioportwrite(Control, 0, $06); - zlioportwrite(Data, 0, (B * 16) and $F0); - zlioportwrite(Control, 0, $07); - end; - - TimeSleep(0.1); - Inc(Position); -end; - -procedure TLCD.WriteString(S: string); -// Wysylanie slow -var - I: integer; -begin - for I := 1 to Length(S) do - WriteData(Ord(S[I])); -end; - -constructor TLCD.Create; -begin -// -end; - -procedure TLCD.Enable; -var - A: byte; - B: byte; -begin - Enabled := true; - if not HalfInterface then - WriteCommand($38) - else begin - WriteCommand($33); - WriteCommand($32); - WriteCommand($28); - end; - -// WriteCommand($06); -// WriteCommand($0C); -// sleep(10); -end; - -procedure TLCD.Clear; -begin - if Enabled then begin - WriteCommand(1); - WriteCommand(2); - Text[1] := ''; - Text[2] := ''; - Text[3] := ''; - Text[4] := ''; - Text[5] := ''; - Text[6] := ''; - StartPos := 1; - LineBR := 1; - end; -end; - -procedure TLCD.WriteText(Line: integer; S: string); -begin - if Enabled then begin - if Line <= 2 then begin - MoveCursor(Line, 1); - WriteString(S); - end; - - Text[Line] := ''; - AddTextArray(Line, S); - end; -end; - -procedure TLCD.MoveCursor(Line, Pos: integer); -var - I: integer; -begin - if Enabled then begin - Pos := Pos + (Line-1) * 40; - - if Position > Pos then begin - WriteCommand(2); - for I := 1 to Pos-1 do - WriteCommand(20); - end; - - if Position < Pos then - for I := 1 to Pos - Position do - WriteCommand(20); - - Position := Pos; - end; -end; - -procedure TLCD.ShowCursor; -begin - if Enabled then begin - WriteCommand(14); - end; -end; - -procedure TLCD.HideCursor; -begin - if Enabled then begin - WriteCommand(12); - end; -end; - -procedure TLCD.AddTextBR(S: string); -var - Word: string; - W: integer; - P: integer; - L: integer; -begin - if Enabled then begin - if LineBR <= 6 then begin - L := LineBR; - P := Pos(' ', S); - - if L <= 2 then - MoveCursor(L, 1); - - while (L <= 6) and (P > 0) do begin - Word := Copy(S, 1, P); - if (Length(Text[L]) + Length(Word)-1) > 16 then begin - L := L + 1; - if L <= 2 then - MoveCursor(L, 1); - end; - - if L <= 6 then begin - if L <= 2 then - WriteString(Word); - AddTextArray(L, Word); - end; - - Delete(S, 1, P); - P := Pos(' ', S) - end; - - LineBR := L + 1; - end; - end; -end; - -procedure TLCD.MoveCursorBR(Pos: integer); -var - I: integer; - L: integer; -begin - if Enabled then begin - Pos := Pos - (StartPos-1); - if Pos <= Length(Text[1]) then - MoveCursor(1, Pos); - - if Pos > Length(Text[1]) then begin - // bez zawijania -// Pos := Pos - Length(Text[1]); -// MoveCursor(2, Pos); - - // z zawijaniem - Pos := Pos - Length(Text[1]); - ScrollUpBR; - MoveCursor(1, Pos); - end; - end; -end; - -procedure TLCD.ScrollUpBR; -var - T: array[1..5] of string; - SP: integer; - LBR: integer; -begin - if Enabled then begin - T[1] := Text[2]; - T[2] := Text[3]; - T[3] := Text[4]; - T[4] := Text[5]; - T[5] := Text[6]; - SP := StartPos + Length(Text[1]); - LBR := LineBR; - - Clear; - - StartPos := SP; - WriteText(1, T[1]); - WriteText(2, T[2]); - WriteText(3, T[3]); - WriteText(4, T[4]); - WriteText(5, T[5]); - LineBR := LBR-1; - end; -end; - -procedure TLCD.AddTextArray(Line: integer; S: string); -begin - if Enabled then begin - Text[Line] := Text[Line] + S; - end; -end; - -end. - diff --git a/Game/Code/Classes/ULanguage.dcu b/Game/Code/Classes/ULanguage.dcu deleted file mode 100644 index 2d5c3596..00000000 Binary files a/Game/Code/Classes/ULanguage.dcu and /dev/null differ diff --git a/Game/Code/Classes/ULight.dcu b/Game/Code/Classes/ULight.dcu deleted file mode 100644 index 10ba61bc..00000000 Binary files a/Game/Code/Classes/ULight.dcu and /dev/null differ diff --git a/Game/Code/Classes/ULog.dcu b/Game/Code/Classes/ULog.dcu deleted file mode 100644 index 1794325d..00000000 Binary files a/Game/Code/Classes/ULog.dcu and /dev/null differ diff --git a/Game/Code/Classes/ULyrics.dcu b/Game/Code/Classes/ULyrics.dcu deleted file mode 100644 index 3867c263..00000000 Binary files a/Game/Code/Classes/ULyrics.dcu and /dev/null differ diff --git a/Game/Code/Classes/UMain.dcu b/Game/Code/Classes/UMain.dcu deleted file mode 100644 index 3a2edf09..00000000 Binary files a/Game/Code/Classes/UMain.dcu and /dev/null differ diff --git a/Game/Code/Classes/UMusic.dcu b/Game/Code/Classes/UMusic.dcu deleted file mode 100644 index f3116f8b..00000000 Binary files a/Game/Code/Classes/UMusic.dcu and /dev/null differ diff --git a/Game/Code/Classes/UParty.dcu b/Game/Code/Classes/UParty.dcu deleted file mode 100644 index e3e1a901..00000000 Binary files a/Game/Code/Classes/UParty.dcu and /dev/null differ diff --git a/Game/Code/Classes/UPliki.dcu b/Game/Code/Classes/UPliki.dcu deleted file mode 100644 index 1798b6f8..00000000 Binary files a/Game/Code/Classes/UPliki.dcu and /dev/null differ diff --git a/Game/Code/Classes/URecord.dcu b/Game/Code/Classes/URecord.dcu deleted file mode 100644 index d28aa4b1..00000000 Binary files a/Game/Code/Classes/URecord.dcu and /dev/null differ diff --git a/Game/Code/Classes/UScores.dcu b/Game/Code/Classes/UScores.dcu deleted file mode 100644 index 16454265..00000000 Binary files a/Game/Code/Classes/UScores.dcu and /dev/null differ diff --git a/Game/Code/Classes/USkins.dcu b/Game/Code/Classes/USkins.dcu deleted file mode 100644 index 89ea67c0..00000000 Binary files a/Game/Code/Classes/USkins.dcu and /dev/null differ diff --git a/Game/Code/Classes/USongs.dcu b/Game/Code/Classes/USongs.dcu deleted file mode 100644 index e58c47d8..00000000 Binary files a/Game/Code/Classes/USongs.dcu and /dev/null differ diff --git a/Game/Code/Classes/UTexture.dcu b/Game/Code/Classes/UTexture.dcu deleted file mode 100644 index ec06b7e4..00000000 Binary files a/Game/Code/Classes/UTexture.dcu and /dev/null differ diff --git a/Game/Code/Classes/UThemes.dcu b/Game/Code/Classes/UThemes.dcu deleted file mode 100644 index eb5ec8d4..00000000 Binary files a/Game/Code/Classes/UThemes.dcu and /dev/null differ diff --git a/Game/Code/Classes/UTime.dcu b/Game/Code/Classes/UTime.dcu deleted file mode 100644 index f69b60f7..00000000 Binary files a/Game/Code/Classes/UTime.dcu and /dev/null differ -- cgit v1.2.3 From 3f7e97009ad3a96dce1a51e98dc2b99aa8a78ef3 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 21 Mar 2007 19:35:46 +0000 Subject: =?UTF-8?q?Datei=20/=20Ordner=20gel=C3=B6scht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@5 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UDisplay.dcu | Bin 7030 -> 0 bytes Game/Code/Menu/UDrawTexture.dcu | Bin 3640 -> 0 bytes Game/Code/Menu/UMenu.dcu | Bin 31672 -> 0 bytes Game/Code/Menu/UMenuButton.dcu | Bin 5472 -> 0 bytes Game/Code/Menu/UMenuInteract.dcu | Bin 404 -> 0 bytes Game/Code/Menu/UMenuSelect.dcu | Bin 3922 -> 0 bytes Game/Code/Menu/UMenuSelectSlide.dcu | Bin 6108 -> 0 bytes Game/Code/Menu/UMenuStatic.dcu | Bin 1594 -> 0 bytes Game/Code/Menu/UMenuText.dcu | Bin 3155 -> 0 bytes 9 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 Game/Code/Menu/UDisplay.dcu delete mode 100644 Game/Code/Menu/UDrawTexture.dcu delete mode 100644 Game/Code/Menu/UMenu.dcu delete mode 100644 Game/Code/Menu/UMenuButton.dcu delete mode 100644 Game/Code/Menu/UMenuInteract.dcu delete mode 100644 Game/Code/Menu/UMenuSelect.dcu delete mode 100644 Game/Code/Menu/UMenuSelectSlide.dcu delete mode 100644 Game/Code/Menu/UMenuStatic.dcu delete mode 100644 Game/Code/Menu/UMenuText.dcu (limited to 'Game/Code') diff --git a/Game/Code/Menu/UDisplay.dcu b/Game/Code/Menu/UDisplay.dcu deleted file mode 100644 index f4f89245..00000000 Binary files a/Game/Code/Menu/UDisplay.dcu and /dev/null differ diff --git a/Game/Code/Menu/UDrawTexture.dcu b/Game/Code/Menu/UDrawTexture.dcu deleted file mode 100644 index 9e6402a9..00000000 Binary files a/Game/Code/Menu/UDrawTexture.dcu and /dev/null differ diff --git a/Game/Code/Menu/UMenu.dcu b/Game/Code/Menu/UMenu.dcu deleted file mode 100644 index 126834d8..00000000 Binary files a/Game/Code/Menu/UMenu.dcu and /dev/null differ diff --git a/Game/Code/Menu/UMenuButton.dcu b/Game/Code/Menu/UMenuButton.dcu deleted file mode 100644 index b97d1670..00000000 Binary files a/Game/Code/Menu/UMenuButton.dcu and /dev/null differ diff --git a/Game/Code/Menu/UMenuInteract.dcu b/Game/Code/Menu/UMenuInteract.dcu deleted file mode 100644 index 785be771..00000000 Binary files a/Game/Code/Menu/UMenuInteract.dcu and /dev/null differ diff --git a/Game/Code/Menu/UMenuSelect.dcu b/Game/Code/Menu/UMenuSelect.dcu deleted file mode 100644 index 9d483c33..00000000 Binary files a/Game/Code/Menu/UMenuSelect.dcu and /dev/null differ diff --git a/Game/Code/Menu/UMenuSelectSlide.dcu b/Game/Code/Menu/UMenuSelectSlide.dcu deleted file mode 100644 index 1475c1ac..00000000 Binary files a/Game/Code/Menu/UMenuSelectSlide.dcu and /dev/null differ diff --git a/Game/Code/Menu/UMenuStatic.dcu b/Game/Code/Menu/UMenuStatic.dcu deleted file mode 100644 index 901fa2c7..00000000 Binary files a/Game/Code/Menu/UMenuStatic.dcu and /dev/null differ diff --git a/Game/Code/Menu/UMenuText.dcu b/Game/Code/Menu/UMenuText.dcu deleted file mode 100644 index 7cfe0316..00000000 Binary files a/Game/Code/Menu/UMenuText.dcu and /dev/null differ -- cgit v1.2.3 From 00822815d626025153389a461db64b83932e6f22 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 21 Mar 2007 19:37:25 +0000 Subject: =?UTF-8?q?Datei=20/=20Ordner=20gel=C3=B6scht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@6 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEdit.dcu | Bin 2915 -> 0 bytes Game/Code/Screens/UScreenEditConvert.dcu | Bin 13604 -> 0 bytes Game/Code/Screens/UScreenEditHeader.dcu | Bin 9398 -> 0 bytes Game/Code/Screens/UScreenEditSub.dcu | Bin 29283 -> 0 bytes Game/Code/Screens/UScreenLevel.dcu | Bin 3407 -> 0 bytes Game/Code/Screens/UScreenLoading.dcu | Bin 2525 -> 0 bytes Game/Code/Screens/UScreenMain.dcu | Bin 9661 -> 0 bytes Game/Code/Screens/UScreenName.dcu | Bin 4199 -> 0 bytes Game/Code/Screens/UScreenOpen.dcu | Bin 4756 -> 0 bytes Game/Code/Screens/UScreenOptions.dcu | Bin 4834 -> 0 bytes Game/Code/Screens/UScreenOptionsGame.dcu | Bin 4049 -> 0 bytes Game/Code/Screens/UScreenOptionsGraphics.dcu | Bin 3911 -> 0 bytes Game/Code/Screens/UScreenOptionsLyrics.dcu | Bin 3566 -> 0 bytes Game/Code/Screens/UScreenOptionsRecord.dcu | Bin 4885 -> 0 bytes Game/Code/Screens/UScreenOptionsSound.dcu | Bin 3629 -> 0 bytes Game/Code/Screens/UScreenOptionsThemes.dcu | Bin 4188 -> 0 bytes Game/Code/Screens/UScreenPartyNewRound.dcu | Bin 9085 -> 0 bytes Game/Code/Screens/UScreenPartyOptions.dcu | Bin 5884 -> 0 bytes Game/Code/Screens/UScreenPartyPlayer.dcu | Bin 6068 -> 0 bytes Game/Code/Screens/UScreenPartyScore.dcu | Bin 5605 -> 0 bytes Game/Code/Screens/UScreenPartyWin.dcu | Bin 4642 -> 0 bytes Game/Code/Screens/UScreenScore.dcu | Bin 10273 -> 0 bytes Game/Code/Screens/UScreenSing.dcu | Bin 23327 -> 0 bytes Game/Code/Screens/UScreenSingModi.dcu | Bin 15109 -> 0 bytes Game/Code/Screens/UScreenSong.dcu | Bin 29384 -> 0 bytes Game/Code/Screens/UScreenSongMenu.dcu | Bin 7346 -> 0 bytes Game/Code/Screens/UScreenTop5.dcu | Bin 4531 -> 0 bytes Game/Code/Screens/UScreenWelcome.dcu | Bin 3228 -> 0 bytes 28 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 Game/Code/Screens/UScreenEdit.dcu delete mode 100644 Game/Code/Screens/UScreenEditConvert.dcu delete mode 100644 Game/Code/Screens/UScreenEditHeader.dcu delete mode 100644 Game/Code/Screens/UScreenEditSub.dcu delete mode 100644 Game/Code/Screens/UScreenLevel.dcu delete mode 100644 Game/Code/Screens/UScreenLoading.dcu delete mode 100644 Game/Code/Screens/UScreenMain.dcu delete mode 100644 Game/Code/Screens/UScreenName.dcu delete mode 100644 Game/Code/Screens/UScreenOpen.dcu delete mode 100644 Game/Code/Screens/UScreenOptions.dcu delete mode 100644 Game/Code/Screens/UScreenOptionsGame.dcu delete mode 100644 Game/Code/Screens/UScreenOptionsGraphics.dcu delete mode 100644 Game/Code/Screens/UScreenOptionsLyrics.dcu delete mode 100644 Game/Code/Screens/UScreenOptionsRecord.dcu delete mode 100644 Game/Code/Screens/UScreenOptionsSound.dcu delete mode 100644 Game/Code/Screens/UScreenOptionsThemes.dcu delete mode 100644 Game/Code/Screens/UScreenPartyNewRound.dcu delete mode 100644 Game/Code/Screens/UScreenPartyOptions.dcu delete mode 100644 Game/Code/Screens/UScreenPartyPlayer.dcu delete mode 100644 Game/Code/Screens/UScreenPartyScore.dcu delete mode 100644 Game/Code/Screens/UScreenPartyWin.dcu delete mode 100644 Game/Code/Screens/UScreenScore.dcu delete mode 100644 Game/Code/Screens/UScreenSing.dcu delete mode 100644 Game/Code/Screens/UScreenSingModi.dcu delete mode 100644 Game/Code/Screens/UScreenSong.dcu delete mode 100644 Game/Code/Screens/UScreenSongMenu.dcu delete mode 100644 Game/Code/Screens/UScreenTop5.dcu delete mode 100644 Game/Code/Screens/UScreenWelcome.dcu (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenEdit.dcu b/Game/Code/Screens/UScreenEdit.dcu deleted file mode 100644 index 1b9c7bb9..00000000 Binary files a/Game/Code/Screens/UScreenEdit.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenEditConvert.dcu b/Game/Code/Screens/UScreenEditConvert.dcu deleted file mode 100644 index 1839ad6b..00000000 Binary files a/Game/Code/Screens/UScreenEditConvert.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenEditHeader.dcu b/Game/Code/Screens/UScreenEditHeader.dcu deleted file mode 100644 index 9508e841..00000000 Binary files a/Game/Code/Screens/UScreenEditHeader.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenEditSub.dcu b/Game/Code/Screens/UScreenEditSub.dcu deleted file mode 100644 index 6b6b6e35..00000000 Binary files a/Game/Code/Screens/UScreenEditSub.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenLevel.dcu b/Game/Code/Screens/UScreenLevel.dcu deleted file mode 100644 index 95cb3267..00000000 Binary files a/Game/Code/Screens/UScreenLevel.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenLoading.dcu b/Game/Code/Screens/UScreenLoading.dcu deleted file mode 100644 index e0eb1cfe..00000000 Binary files a/Game/Code/Screens/UScreenLoading.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenMain.dcu b/Game/Code/Screens/UScreenMain.dcu deleted file mode 100644 index 22bb4883..00000000 Binary files a/Game/Code/Screens/UScreenMain.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenName.dcu b/Game/Code/Screens/UScreenName.dcu deleted file mode 100644 index d14b4296..00000000 Binary files a/Game/Code/Screens/UScreenName.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenOpen.dcu b/Game/Code/Screens/UScreenOpen.dcu deleted file mode 100644 index c59986f9..00000000 Binary files a/Game/Code/Screens/UScreenOpen.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenOptions.dcu b/Game/Code/Screens/UScreenOptions.dcu deleted file mode 100644 index e5d17c3b..00000000 Binary files a/Game/Code/Screens/UScreenOptions.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenOptionsGame.dcu b/Game/Code/Screens/UScreenOptionsGame.dcu deleted file mode 100644 index 3fd70913..00000000 Binary files a/Game/Code/Screens/UScreenOptionsGame.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenOptionsGraphics.dcu b/Game/Code/Screens/UScreenOptionsGraphics.dcu deleted file mode 100644 index 3eddc010..00000000 Binary files a/Game/Code/Screens/UScreenOptionsGraphics.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenOptionsLyrics.dcu b/Game/Code/Screens/UScreenOptionsLyrics.dcu deleted file mode 100644 index 1fcfca9d..00000000 Binary files a/Game/Code/Screens/UScreenOptionsLyrics.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenOptionsRecord.dcu b/Game/Code/Screens/UScreenOptionsRecord.dcu deleted file mode 100644 index 36a04d50..00000000 Binary files a/Game/Code/Screens/UScreenOptionsRecord.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenOptionsSound.dcu b/Game/Code/Screens/UScreenOptionsSound.dcu deleted file mode 100644 index 26c07fe1..00000000 Binary files a/Game/Code/Screens/UScreenOptionsSound.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenOptionsThemes.dcu b/Game/Code/Screens/UScreenOptionsThemes.dcu deleted file mode 100644 index 98bec8a2..00000000 Binary files a/Game/Code/Screens/UScreenOptionsThemes.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenPartyNewRound.dcu b/Game/Code/Screens/UScreenPartyNewRound.dcu deleted file mode 100644 index 24b6953e..00000000 Binary files a/Game/Code/Screens/UScreenPartyNewRound.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenPartyOptions.dcu b/Game/Code/Screens/UScreenPartyOptions.dcu deleted file mode 100644 index 8f0bbf3d..00000000 Binary files a/Game/Code/Screens/UScreenPartyOptions.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenPartyPlayer.dcu b/Game/Code/Screens/UScreenPartyPlayer.dcu deleted file mode 100644 index 1afeac79..00000000 Binary files a/Game/Code/Screens/UScreenPartyPlayer.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenPartyScore.dcu b/Game/Code/Screens/UScreenPartyScore.dcu deleted file mode 100644 index 9dffe2e5..00000000 Binary files a/Game/Code/Screens/UScreenPartyScore.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenPartyWin.dcu b/Game/Code/Screens/UScreenPartyWin.dcu deleted file mode 100644 index d55c0809..00000000 Binary files a/Game/Code/Screens/UScreenPartyWin.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenScore.dcu b/Game/Code/Screens/UScreenScore.dcu deleted file mode 100644 index eee72fd0..00000000 Binary files a/Game/Code/Screens/UScreenScore.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenSing.dcu b/Game/Code/Screens/UScreenSing.dcu deleted file mode 100644 index 0e227a17..00000000 Binary files a/Game/Code/Screens/UScreenSing.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenSingModi.dcu b/Game/Code/Screens/UScreenSingModi.dcu deleted file mode 100644 index 4f806afe..00000000 Binary files a/Game/Code/Screens/UScreenSingModi.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenSong.dcu b/Game/Code/Screens/UScreenSong.dcu deleted file mode 100644 index abc9cc4f..00000000 Binary files a/Game/Code/Screens/UScreenSong.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenSongMenu.dcu b/Game/Code/Screens/UScreenSongMenu.dcu deleted file mode 100644 index 634a217a..00000000 Binary files a/Game/Code/Screens/UScreenSongMenu.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenTop5.dcu b/Game/Code/Screens/UScreenTop5.dcu deleted file mode 100644 index c6db07d0..00000000 Binary files a/Game/Code/Screens/UScreenTop5.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenWelcome.dcu b/Game/Code/Screens/UScreenWelcome.dcu deleted file mode 100644 index 196b04be..00000000 Binary files a/Game/Code/Screens/UScreenWelcome.dcu and /dev/null differ -- cgit v1.2.3 From 9f20992cc2b46df36f98dce1088527c65c059746 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 21 Mar 2007 19:38:39 +0000 Subject: =?UTF-8?q?Datei=20/=20Ordner=20gel=C3=B6scht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@7 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/SMpeg/USmpeg.alt.pas | 292 ----------------------------------------- Game/Code/SMpeg/USmpeg.dcu | Bin 6074 -> 0 bytes 2 files changed, 292 deletions(-) delete mode 100644 Game/Code/SMpeg/USmpeg.alt.pas delete mode 100644 Game/Code/SMpeg/USmpeg.dcu (limited to 'Game/Code') diff --git a/Game/Code/SMpeg/USmpeg.alt.pas b/Game/Code/SMpeg/USmpeg.alt.pas deleted file mode 100644 index 94ad69c8..00000000 --- a/Game/Code/SMpeg/USmpeg.alt.pas +++ /dev/null @@ -1,292 +0,0 @@ -unit USmpeg; - -interface -uses SDL, smpeg, OpenGL12, SysUtils, UIni; - -procedure OpenSmpeg(FileName: string); -procedure SkipSmpeg(Time: single); -procedure PlaySmpeg; -procedure UpdateSmpeg; -procedure CloseSmpeg; -function glmovie_init(Width : GLuint; Height : TGLuint ) : TGLenum; -procedure glmpeg_update(surface: PSDL_Surface; x: Sint32; y: Sint32; w: Uint32; h: Uint32); cdecl; -procedure DrawSmpeg(frame: PGLubyte); -procedure glmovie_resize( width : GLuint; height : GLuint ); -procedure glmovie_quit; - -var - mpeg: PSMPEG; - mpeg_info: TSMPEG_Info; - surface: PSDL_Surface; - -type - { Some data is redundant at this stage. } - PGLMovieTexture = ^TGLMovieTexture; - TGLMovieTexture = record - id : TGLuint; (* OpenGL texture id. *) - poly_width : TGLuint; (* Quad width for tile. *) - poly_height : TGLuint; (* Quad height for tile. *) - movie_width : TGLuint; (* Width of movie inside tile. *) - movie_height : TGLuint; (* Height of movie inside tile. *) - skip_rows : TGLuint; (* Number of rows of movie to skip *) - skip_pixels : TGLuint; (* Number of columns of movie to skip *) - row : TGLuint; (* Row number of tile in scheme. *) - col : TGLuint; (* Column number of tile in scheme. *) - end; - -type - TGLuintArray = array of TGLuint; - PGLuintArray = ^TGLuintArray; - TGLMovieTextureArray = array of TGLMovieTexture; - PGLMovieTextureArray = ^TGLMovieTextureArray; - -var - (* Our evil maximum texture size. Boo 3Dfxnot *) - texture_size : TGLuint = 1024;//512; - texture_ids : TGLuint; - textures: TGLMovieTexture; - tiled_width : TGLuint = 0; - tiled_height : TGLuint = 0; - movie_width : TGLuint = 0; - movie_height : TGLuint = 0; - -implementation - -procedure OpenSmpeg(FileName: string); -begin - mpeg := SMPEG_new(PChar(FileName), @mpeg_info, 0); // audio - if ( mpeg = nil ) then begin - SDL_Quit; - Exit; - end; - -// SMPEG_setvolume(mpeg, 50); - SMPEG_enableaudio(mpeg, 0); - - (* Everything needs to be in RGB for GL, but needs to be 32-bit for SMPEG. *) - surface := SDL_AllocSurface( SDL_SWSURFACE, - mpeg_info.width, - mpeg_info.height, - 32, - $000000FF, - $0000FF00, - $00FF0000, - $FF000000 ); - - if ( surface = nil ) then begin - SDL_Quit; - Exit; - end; - - (* *Initialize* with mpeg size. *) - if (glmovie_init( mpeg_info.width, mpeg_info.height ) <> GL_NO_ERROR ) then begin - SDL_Quit; - Exit; - end; - - SMPEG_setdisplay(mpeg, surface, nil, @glmpeg_update); -end; - -procedure SkipSmpeg(Time: single); -begin - SMPEG_skip(mpeg, Time); -end; - -procedure PlaySmpeg; -begin - SMPEG_play(mpeg); -end; - -procedure UpdateSmpeg; -begin -// glmpeg_update(surface,0,0,0,0); - DrawSmpeg( PGLubyte( surface.pixels ) ); -end; - -procedure CloseSmpeg; -begin -// glmovie_quit; - SMPEG_delete(mpeg); -end; - -function glmovie_init( Width : GLuint; Height : TGLuint ) : TGLenum; -type - PGLubyteArray = ^TGLubyteArray; - TGLubyteArray = array of TGLubyte; -var - (* Initial black texels. *) - pixels : TGLubyteArray; - (* Absolute offsets from within tiled frame. *) - //offset_x: GLuint; - //offset_y: GLuint; - skip_rows : GLuint; - skip_pixels : GLuint; - i, j, current : GLuint; -begin - skip_rows := 0; - current := 0; - (* Save original movie dimensions. *) - movie_width := width; - movie_height := height; - - (* Get the power of 2 dimensions. *) - tiled_width := 1024{512}; - tiled_height := 1024{512}; - - texture_size := 1024{512}; - - (* Time for fun with data type = record *) - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glEnable(GL_TEXTURE_2D); - glEnable(GL_DITHER); - - glGenTextures(1, @texture_ids); - - current := 0; - (* Setup texture. *) - textures.id := texture_ids; - textures.poly_width := texture_size; - textures.poly_height := texture_size; - textures.movie_width := movie_width - 2; - textures.movie_height := movie_height - 2; - textures.row := i; - textures.col := j; - textures.skip_pixels := skip_pixels; - textures.skip_rows := skip_rows; - - SetLength( pixels, textures.poly_width * textures.poly_height * 4 ); - if ( pixels = nil ) then - begin - glDeleteTextures(1, @texture_ids); - result := GL_OUT_OF_MEMORY; - exit; - end; - //FillChar( pixels^, textures[ current ].poly_width * textures[ current ].poly_height * 4, 0 ); - - (* Do all of our useful binding. *) - glBindTexture(GL_TEXTURE_2D, texture_ids); -// glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - (* Specify our 256x256 black texture. *) - glTexImage2D( GL_TEXTURE_2D, - 0, - GL_RGB, - 1024{512},//textures.poly_width, - 1024{512},//textures.poly_height, - 0, - GL_RGBA, - GL_UNSIGNED_BYTE, - @pixels[0] ); - SetLength( pixels, 0 ); - - - (* Simple state setup at the end. *) - result := glGetError( ); -end; - -procedure glmpeg_update( surface : PSDL_Surface; x : Sint32; y : Sint32; w : Uint32; - h : Uint32 ); cdecl; -var - error : TGLenum; -begin - glClear( GL_COLOR_BUFFER_BIT ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity; - DrawSmpeg( PGLubyte( surface.pixels ) ); - error := glGetError( ); - if ( error <> GL_NO_ERROR ) then Exit; - SDL_GL_SwapBuffers; -end; - -procedure DrawSmpeg(frame: PGLubyte); -var - Shift: TGLdouble; - CropT: real; - CropB: real; - TexT: real; - TexB: real; - TexL: real; - TexR: real; - Wide: boolean; -begin - (* full screen mpeg *) -{ CropT := 0; - CropB := 600; - TexT := 0; - TexB := 1; - TexL := 0; - TexW := 1;} - - // set movie texture crop - Wide := false; - if (textures.movie_width = 720-2) and (textures.movie_height = 344-2) then begin - TexT := 0; - TexB := 342/1024; - Wide := true; - end; - if textures.movie_height = 304-2 then begin - TexT := 0; - TexB := 304/1024; - Wide := true; - end; - if textures.movie_height = 152-2 then begin - TexT := 0; - TexB := 152/1024; - Wide := true; - end; - - CropT := 110; // (110/800 = 13,75% max crop) - CropB := 490; // (110/800 = 13,75% max crop) - - if (textures.movie_height <> 304-2) and (textures.movie_height <> 152-2) and (textures.movie_height <> 344-2) then begin - TexT := 110 / 600 * (textures.movie_height / 1024{512}); - TexB := 490 / 600 * (textures.movie_height / 1024{512}); - - if Ini.MovieSize = 1 then begin - // full screen size - CropT := 0; - CropB := 600; - TexT := 0; - TexB := textures.movie_height / 1024{512}; - end; - end; - - TexL := {10}0/600 * (textures.movie_width / 1024{512}); - TexR := {590}600/600 * (textures.movie_width / 1024{512}); - - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glColor3f(1, 1, 1); - glBindTexture( GL_TEXTURE_2D, texture_ids ); -// glPixelStorei( GL_UNPACK_ROW_LENGTH, movie_width ); - glPixelStorei( GL_UNPACK_SKIP_ROWS, 0); - glPixelStorei( GL_UNPACK_SKIP_PIXELS, 0); - glTexSubImage2D( GL_TEXTURE_2D, 0, 0, (* offset_x *) 0, (* offset_y *) textures.movie_width + 2, textures.movie_height + 2, GL_RGBA, GL_UNSIGNED_BYTE, frame ); - - // draw - glBegin( GL_QUADS ); - glTexCoord2f(TexL, TexT); glVertex2f(0, CropT); - glTexCoord2f(TexL, TexB); glVertex2f(0, CropB); - glTexCoord2f(TexR, TexB); glVertex2f(800, CropB); - glTexCoord2f(TexR, TexT); glVertex2f(800, CropT); - glEnd; - glDisable(GL_TEXTURE_2D); -end; - -procedure glmovie_resize( width : GLuint; height : GLuint ); -begin - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity; - gluOrtho2D(0, 800, 600, 0); -end; - -procedure glmovie_quit; -begin - glDeleteTextures(1, @texture_ids); -end; - -end. diff --git a/Game/Code/SMpeg/USmpeg.dcu b/Game/Code/SMpeg/USmpeg.dcu deleted file mode 100644 index d31948ea..00000000 Binary files a/Game/Code/SMpeg/USmpeg.dcu and /dev/null differ -- cgit v1.2.3 From a48be5b4dd13db5cbc2cce4932508e61ff354340 Mon Sep 17 00:00:00 2001 From: mogguh Date: Wed, 21 Mar 2007 21:35:49 +0000 Subject: Golden notes are implemented from now on. So "golden notes" twinkle, and perfect sung notes twinkle too. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@12 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 22 +-- Game/Code/Classes/UGraphicClasses.pas | 266 ++++++++++++++++++++++++++++++++++ Game/Code/Screens/UScreenSing.pas | 8 +- Game/Code/UltraStar.dpr | 7 + 4 files changed, 293 insertions(+), 10 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index e9433790..4e4691ad 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -1,7 +1,7 @@ unit UDraw; interface -uses UThemes, ModiSDK; +uses UThemes, ModiSDK, UGraphicClasses; procedure SingDraw; procedure SingModiDraw (PlayerInfo: TPlayerInfo); @@ -200,6 +200,8 @@ var Pet: integer; TempR: real; R,G,B: real; + + GoldenStarPos : real; begin glColor3f(1, 1, 1); glEnable(GL_TEXTURE_2D); @@ -214,11 +216,9 @@ begin // Golden Note Patch case Wartosc of 1: glColor4f(1, 1, 1, 0.85); - 2: glColor4f(1, 1, 0.3, 0.85); + 2: glColor4f(1, 1, 1, 0.85); // no stars, paint yellow -> glColor4f(1, 1, 0.3, 0.85); end; // case - - // lewa czesc - left part Rec.Left := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX; Rec.Right := Rec.Left + NotesW; @@ -232,6 +232,11 @@ begin glTexCoord2f(7/8, 0); glVertex2f(Rec.Right, Rec.Top); glEnd; + //We keep the postion of the top left corner b4 it's overwritten + GoldenStarPos := Rec.Left; + //done + + // srodkowa czesc - middle part Rec.Left := Rec.Right; Rec.Right := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - NotesW - 0.5 + 10*ScreenX; @@ -256,12 +261,11 @@ begin glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); glEnd; - // Golden Star Patch - //case Wartosc of - // 2: SingGoldenStar(Rec.Left, Rec.Top, 1, StarfrG); - //end; // case - + if Wartosc = 2 then + begin + GoldenRec.SaveGoldenStarsRec(GoldenStarPos, Rec.Top, Rec.Right, Rec.Bottom); + end; end; // if not FreeStyle end; // with diff --git a/Game/Code/Classes/UGraphicClasses.pas b/Game/Code/Classes/UGraphicClasses.pas index abb59e4b..d66bd142 100644 --- a/Game/Code/Classes/UGraphicClasses.pas +++ b/Game/Code/Classes/UGraphicClasses.pas @@ -2,6 +2,272 @@ unit UGraphicClasses; interface +type + TParticle = Class + X, Y : Real; //Position + Frame : Byte; //act. Frame + Tex : Cardinal; //Tex num from Textur Manager + Live : Byte; //How many Cycles before Kill + RecIndex : Integer; //To which rectangle belongs this particle + + Constructor Create(cX,cY: Real; cTex: Cardinal; cLive: Byte; cFrame : integer; RecArrayIndex : Integer); + procedure Draw; + end; + + RectanglePositions = Record + xTop, yTop, xBottom, yBottom : Real; + TotalStarCount : Integer; + CurrentStarCount : Integer; + end; + + PerfectNotePositions = Record + xPos, yPos : Real; + end; + + TEffectManager = Class + Particle : array of TParticle; + LastTime : Cardinal; + RecArray : Array of RectanglePositions; + PerfNoteArray : Array of PerfectNotePositions; + + constructor Create; + procedure Draw; + function Spawn(X, Y: Real; Tex: Cardinal; Live: Byte; StartFrame : Integer; RecArrayIndex : Integer): Cardinal; + procedure SpawnRec(); + procedure Kill(index: Cardinal); + procedure KillAll(); + procedure SaveGoldenStarsRec(Xtop, Ytop, Xbottom, Ybottom: Real); + procedure SpawnNotePerfect(xPos,yPos : real); + procedure SavePerfectNotePos(Xtop, Ytop: Real); + end; + +var GoldenRec : TEffectManager; + implementation +uses sysutils, Windows,OpenGl12, UThemes, USkins, UGraphic, UDrawTexture, UTexture, math, dialogs; + +//TParticle +Constructor TParticle.Create(cX,cY: Real; cTex: Cardinal; cLive: Byte; cFrame : integer; RecArrayIndex : Integer); +begin + X := cX; + Y := cY; + Tex := cTex; + Live := cLive; + Frame:= cFrame; + RecIndex := RecArrayIndex; +end; + + +procedure TParticle.Draw; +var + W, H: real; + Alpha : real; +begin + W := 20; + H := 20; + + Alpha := (-cos((Frame+1)*2*pi/16)+1); //Fade Eyecandy + + glColor4f(0.99, 1, 0.6, Alpha); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_Note_Star.TexNum); + + begin + glBegin(GL_QUADS); + glTexCoord2f((1/16) * Frame, 0); glVertex2f(X-W, Y-H); + glTexCoord2f((1/16) * Frame + (1/16), 0); glVertex2f(X-W, Y+H); + glTexCoord2f((1/16) * Frame + (1/16), 1); glVertex2f(X+W, Y+H); + glTexCoord2f((1/16) * Frame, 1); glVertex2f(X+W, Y-H); + glEnd; + end; + glcolor4f(1,1,1,1); +end; + + + +constructor TEffectManager.Create; +begin + LastTime := GetTickCount; +end; + + +procedure TEffectManager.Draw; +var + I: Integer; + CurrentTime: Cardinal; +const + DelayBetweenFrames : Integer = 100; +begin + + CurrentTime := GetTickCount; + //Manage particle life + if (CurrentTime > (LastTime + DelayBetweenFrames)) then + begin + LastTime := CurrentTime; + for I := 0 to high(Particle) do + begin + Particle[I].Frame := (Particle[I].Frame + 1 ) mod 16; + //Live = 0 => Live forever + if (Particle[I].Live > 0) then + begin + Dec(Particle[I].Live); + end; + end; + end; + I := 0; + //Kill dead particles + while (I <= High(Particle)) do + begin + if (Particle[I].Live <= 0) then + begin + kill(I); + end + else + begin + inc(I); + end; + end; + + //Draw + for I := 0 to high(Particle) do + begin + Particle[I].Draw; + end; +end; + + +function TEffectManager.Spawn(X, Y: Real; Tex: Cardinal; Live: Byte; StartFrame : Integer; RecArrayIndex : Integer): Cardinal; +begin + Result := Length(Particle); + SetLength(Particle, (Result + 1)); + Particle[Result] := TParticle.Create(X, Y, Tex, Live, StartFrame, RecArrayIndex); +end; + + +procedure TEffectManager.SpawnRec(); +Var + Xkatze, Ykatze : Real; + RandomFrame : Integer; + P : Integer; // P as seen on TV as Positionman +begin +//Spawn a random amount of stars within the given coordinates +//RandomRange(0,14) <- this one starts at a random frame, 16 is our last frame - would be senseless to start a particle with 16, cause it would be dead at the next frame +for P:= 0 to high(RecArray) do + begin + while (RecArray[P].TotalStarCount > RecArray[P].CurrentStarCount) do + begin + Xkatze := RandomRange(Ceil(RecArray[P].xTop), Ceil(RecArray[P].xBottom)); + Ykatze := RandomRange(Ceil(RecArray[P].yTop), Ceil(RecArray[P].yBottom)); + RandomFrame := RandomRange(0,14); + Spawn(Xkatze, Ykatze, Tex_Note_Star.TexNum, 16 - RandomFrame, RandomFrame, P); + inc(RecArray[P].CurrentStarCount); + end; + end; + draw; +end; + + +procedure TEffectManager.SpawnNotePerfect(xPos,yPos : real); +Var + Xkatze, Ykatze : Real; + RandomFrame : Integer; + P : Integer; // P as seen on TV as Positionman +begin +//Spawn a random amount of stars within the given coordinates +//RandomRange(0,14) <- this one starts at a random frame, 16 is our last frame - would be senseless to start a particle with 16, cause it would be dead at the next frame +for P:= 0 to 2 do + begin + Xkatze := RandomRange(ceil(xPos) - 5 , ceil(xPos) + 10); + Ykatze := RandomRange(ceil(yPos) - 5 , ceil(yPos) + 10); + RandomFrame := RandomRange(0,14); + Spawn(Xkatze, Ykatze, Tex_Note_Star.TexNum, 16 - RandomFrame, RandomFrame, -1); + end; + draw; +end; + + +procedure TEffectManager.Kill(Index: Cardinal); +var + LastParticleIndex : Cardinal; +begin +// We put the last element of the array on the place where our element_to_delete resides and then we shorten the array - cool, hu? :P + +LastParticleIndex := high(Particle); +if not(LastParticleIndex = -1) then + begin + Try + Finally + if not(Particle[Index].RecIndex = -1) then + dec(RecArray[Particle[Index].RecIndex].CurrentStarCount); + Particle[Index].Destroy; + Particle[Index] := Particle[LastParticleIndex]; + SetLength(Particle, LastParticleIndex); + end; + end; +end; + +procedure TEffectManager.KillAll(); +begin +//It's the kill all kennies rotuine + while Length(Particle) > 0 do + Kill(0); + SetLength(RecArray,0); + SetLength(PerfNoteArray,0); +end; + +procedure TEffectManager.SaveGoldenStarsRec(Xtop, Ytop, Xbottom, Ybottom: Real); +var + P : Integer; // P like used in Positions + NewIndex : Integer; +begin + For P := 0 to high(RecArray) do // Do we already have that "new" position? + begin + if ((ceil(RecArray[P].xTop) = ceil(Xtop)) and (ceil(RecArray[P].yTop) = ceil(Ytop))) then + exit; // it's already in the array, so we don't have to create a new one + end; + +// we got a new position, add the new positions to our array + NewIndex := Length(RecArray); + SetLength(RecArray, NewIndex + 1); + RecArray[NewIndex].xTop := Xtop; + RecArray[NewIndex].yTop := Ytop; + RecArray[NewIndex].xBottom := Xbottom; + RecArray[NewIndex].yBottom := Ybottom; + RecArray[NewIndex].TotalStarCount := ceil(Xbottom - Xtop) div 12 + 3; + RecArray[NewIndex].CurrentStarCount := 0; +end; + +procedure TEffectManager.SavePerfectNotePos(Xtop, Ytop: Real); +var + P : Integer; // P like used in Positions + NewIndex : Integer; + + RandomFrame : Integer; + Xkatze, Ykatze : Integer; +begin + For P := 0 to high(PerfNoteArray) do // Do we already have that "new" position? + begin + if ((ceil(PerfNoteArray[P].xPos) = ceil(Xtop)) and (ceil(PerfNoteArray[P].yPos) = ceil(Ytop))) then + exit; // it's already in the array, so we don't have to create a new one + end; + +// we got a new position, add the new positions to our array + NewIndex := Length(PerfNoteArray); + SetLength(PerfNoteArray, NewIndex + 1); + PerfNoteArray[NewIndex].xPos := Xtop; + PerfNoteArray[NewIndex].yPos := Ytop; + + for P:= 0 to 2 do + begin + Xkatze := RandomRange(ceil(Xtop) - 5 , ceil(Xtop) + 10); + Ykatze := RandomRange(ceil(Ytop) - 5 , ceil(Ytop) + 10); + RandomFrame := RandomRange(0,14); + Spawn(Xkatze, Ykatze, Tex_Note_Star.TexNum, 16 - RandomFrame, RandomFrame, -1); + end; + +end; end. + diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 2a97482d..3dd1119a 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -3,7 +3,7 @@ unit UScreenSing; interface uses UMenu, UMusic, SDL, SysUtils, UPliki, UTime, USongs, UIni, ULog, USmpeg, UTexture, ULyrics, - TextGL, OpenGL12, BASS, UThemes, ULCD; + TextGL, OpenGL12, BASS, UThemes, ULCD, UGraphicClasses; type TScreenSing = class(TMenu) @@ -973,6 +973,9 @@ begin // draw custom items SingDraw; // always draw +//GoldenNoteStarsTwinkle Mod + GoldenRec.SpawnRec; +//GoldenNoteStarsTwinkle Mod // back stereo Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; @@ -1116,6 +1119,9 @@ Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; end; //PhrasenBonus - Line Bonus Mod End// } +//GoldenStarsTwinkle Mod + GoldenRec.KillAll; +//GoldenStarsTwinkle Mod End end; end. diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 5c598eda..b0d49610 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -258,6 +258,13 @@ begin Log.BenchmarkEnd(1); Log.LogBenchmark('Loading Score DB System', 1); + //GoldenStarsTwinkleMod + Log.BenchmarkStart(1); + Log.LogStatus('GoldenStars', 'Initialization'); + GoldenRec := TEffectManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading GoldenStars', 1); + // Joypad if Ini.Joypad = 1 then begin Log.BenchmarkStart(1); -- cgit v1.2.3 From c33620b856f5106ba95638106c5a55ff88e5290c Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 22 Mar 2007 19:59:00 +0000 Subject: Fixed Bug: No BG in Party Mode and little Code clean up git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@16 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 1 + Game/Code/Classes/UIni.pas | 4 +- Game/Code/Classes/ULanguage.pas | 18 +++++---- Game/Code/Classes/UThemes.pas | 9 +++-- Game/Code/Screens/UScreenSingModi.pas | 41 ++++++++++--------- Game/Code/UltraStar.dpr | 76 +++++++++++++++++++---------------- 6 files changed, 83 insertions(+), 66 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 4e4691ad..31291788 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -71,6 +71,7 @@ begin if ScreenSing.Tex_Background.TexNum >= 1 then begin glClearColor (1, 1, 1, 1); + glColor4f (1, 1, 1, 1); if (Ini.MovieSize = 0) then //HalfSize BG begin diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index beadabb6..a17ba52d 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -483,11 +483,11 @@ begin for Pet := 0 to High(IJoypad) do if Tekst = IJoypad[Pet] then Ini.Joypad := Pet; - // SoundCard + {// SoundCard for I := 0 to 7 do begin Ini.SoundCard[I, 1] := IniFile.ReadInteger('SoundCards', 'SoundCard'+IntToStr(I+1)+'L', Ini.SoundCard[I, 1]); Ini.SoundCard[I, 2] := IniFile.ReadInteger('SoundCards', 'SoundCard'+IntToStr(I+1)+'R', Ini.SoundCard[I, 2]); - end; + end; } // LCD Tekst := IniFile.ReadString('Devices', 'LPT', ILPT[0]); diff --git a/Game/Code/Classes/ULanguage.pas b/Game/Code/Classes/ULanguage.pas index bc3793e3..afdac87c 100644 --- a/Game/Code/Classes/ULanguage.pas +++ b/Game/Code/Classes/ULanguage.pas @@ -14,7 +14,7 @@ type end; TLanguage = class - private + public Entry: array of TLanguageEntry; //Entrys of Chosen Language SEntry: array of TLanguageEntry; //Entrys of Standard Language CEntry: array of TLanguageEntry; //Constant Entrys e.g. Version @@ -68,6 +68,8 @@ begin SEntry[J] := Entry[J]; SetLength(Entry, 0); + + Break; end; if (I = high(List)) then @@ -139,6 +141,9 @@ var E: integer; // entry begin Result := Text; + Text := Uppercase(Result); + + Log.LogError('Text: "' + Text + '" L: ' + InttoStr(Length(Entry))); //Const Mod for E := 0 to high(CEntry) do @@ -158,14 +163,11 @@ begin //Standard Language (If a Language File is Incomplete) //Then use Standard Language - if Text = Result then + for E := low(SEntry) to high(SEntry) do + if Text = SEntry[E].ID then begin - for E := low(SEntry) to high(SEntry) do - if Text = SEntry[E].ID then - begin - Result := SEntry[E].Text; - exit; - end; + Result := SEntry[E].Text; + Break; end; //Standard Language END end; diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 29647db6..c4b83d8b 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -2,7 +2,11 @@ unit UThemes; interface -uses IniFiles, SysUtils, Classes; +uses +{$IFDEF TRANSLATE} + ULanguage, +{$ENDIF} +IniFiles, SysUtils, Classes; type TRGB = record @@ -576,9 +580,6 @@ var implementation uses -{$IFDEF TRANSLATE} - ULanguage, -{$ENDIF} USkins, UIni; constructor TTheme.Create(FileName: string); diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 88034f61..ec47dc60 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -585,16 +585,16 @@ begin Log.LogStatus('End', 'onShow'); } -PlayersPlay := TeamInfo.NumTeams; + PlayersPlay := TeamInfo.NumTeams; -if DLLMan.Selected.LoadSong then //Start with Song -begin - inherited; -end -else //Start Without Song -begin - Music.CaptureStart; -end; + if DLLMan.Selected.LoadSong then //Start with Song + begin + inherited; + end + else //Start Without Song + begin + Music.CaptureStart; + end; //Set Playerinfo PlayerInfo.NumPlayers := PlayersPlay; @@ -648,16 +648,21 @@ end; //Music.CaptureStart; //Music.MoveTo(AktSong.Start); -//Init Plugin -if not DLLMan.PluginInit(TeamInfo, PlayerInfo, ToSentences(Czesci[0]), LoadTex, Print, LoadSound, PlaySound) then -begin -//Fehler -Log.LogError('Could not Init Plugin'); -Halt; -end; + //Init Plugin + if not DLLMan.PluginInit(TeamInfo, PlayerInfo, ToSentences(Czesci[0]), LoadTex, Print, LoadSound, PlaySound) then + begin + //Fehler + Log.LogError('Could not Init Plugin'); + Halt; + end; + + // Set Background (Little Workaround, maybe change sometime) + if (DLLMan.Selected.LoadBack) AND (DLLMan.Selected.LoadSong) then + ScreenSing.Tex_Background := Tex_Background; + + Winner := 0; -Winner := 0; -//Set Score Visibility + //Set Score Visibility if PlayersPlay = 1 then begin Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index b0d49610..1bc19dcf 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -6,16 +6,9 @@ {$R 'UltraStar.res' 'UltraStar.rc'} uses - {//Earlyer in Code Dir.. Now in SearchDir - DDKint in '..\ZLPortIO\ddkint.pas', - ZLPortIO in '..\ZLPortIO\zlportio.pas', - SQLiteTable3 in '..\SQLite\SQLiteTable3.pas', - SQLite3 in '..\SQLite\SQLite3.pas',} - Windows, - SDL, - SysUtils, - - //Menu Objects + //------------------------------ + //Includes - Menu System + //------------------------------ UDisplay in 'Menu\UDisplay.pas', UMenu in 'Menu\UMenu.pas', UMenuStatic in 'Menu\UMenuStatic.pas', @@ -26,11 +19,14 @@ uses UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', UDrawTexture in 'Menu\UDrawTexture.pas', - //Classes + //------------------------------ + //Includes - Classes + //------------------------------ UGraphic in 'Classes\UGraphic.pas', UTexture in 'Classes\UTexture.pas', UMusic in 'Classes\UMusic.pas', UPliki in 'Classes\UPliki.pas', + ULanguage in 'Classes\ULanguage.pas', UMain in 'Classes\UMain.pas', UDraw in 'Classes\UDraw.pas', URecord in 'Classes\URecord.pas', @@ -47,7 +43,6 @@ uses ULCD in 'Classes\ULCD.pas', ULight in 'Classes\ULight.pas', UScores in 'Classes\UScores.pas', - ULanguage in 'Classes\ULanguage.pas', UCovers in 'Classes\UCovers.pas', UCatCovers in 'Classes\UCatCovers.pas', UFiles in 'Classes\UFiles.pas', @@ -55,7 +50,9 @@ uses UDLLManager in 'Classes\UDLLManager.pas', UParty in 'Classes\UParty.pas', - //Screens + //------------------------------ + //Includes - Screens + //------------------------------ UScreenLoading in 'Screens\UScreenLoading.pas', UScreenWelcome in 'Screens\UScreenWelcome.pas', UScreenMain in 'Screens\UScreenMain.pas', @@ -78,7 +75,10 @@ uses UScreenOpen in 'Screens\UScreenOpen.pas', UScreenTop5 in 'Screens\UScreenTop5.pas', UScreenSongMenu in 'Screens\UScreenSongMenu.pas', - //PartyMode + + //------------------------------ + //Includes - Screens PartyMode + //------------------------------ UScreenSingModi in 'Screens\UScreenSingModi.pas', UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', UScreenPartyScore in 'Screens\UScreenPartyScore.pas', @@ -86,8 +86,17 @@ uses UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', UScreenPartyWin in 'Screens\UScreenPartyWin.pas', - //Modi SDK - ModiSDK in '..\..\Modis\SDK\ModiSDK.pas'; + //------------------------------ + //Includes - Modi SDK + //------------------------------ + ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', + + //------------------------------ + //Includes - Delphi + //------------------------------ + Windows, + SDL, + SysUtils; const Version = 'UltraStar Deluxe V 0.90 Beta'; @@ -100,7 +109,9 @@ var begin WndTitle := Version; + //------------------------------ //Start more than One Time Prevention + //------------------------------ hWnd:= FindWindow(nil, PChar(WndTitle)); //Programm already started if (hWnd <> 0) then @@ -120,15 +131,15 @@ begin Exit; end; - - + //------------------------------ + //StartUp - Create Classes and Load Files + //------------------------------ USTime := TTime.Create; // Log + Benchmark Log := TLog.Create; Log.Title := WndTitle; Log.BenchmarkStart(0); -// Log.LogError(IntToStr(DayOfTheYear(Date))); // Language Log.BenchmarkStart(1); @@ -152,8 +163,6 @@ begin Log.BenchmarkEnd(1); Log.LogBenchmark('Loading Skin List', 1); - //Log.LogBenchmark(inttostr(Skin.), 1); - // Sound Card List Log.BenchmarkStart(1); Log.LogStatus('Loading Soundcard list', 'Initialization'); @@ -187,7 +196,6 @@ begin Log.LogStatus('Load Light', 'Initialization'); Light := TLight.Create; if Ini.LPT = 2 then begin Light.Enable; -// Light.LightOne(0, 1000); end; Log.BenchmarkEnd(1); Log.LogBenchmark('Loading Light', 1); @@ -223,9 +231,6 @@ begin Log.BenchmarkStart(1); Log.LogStatus('PluginManager', 'Initialization'); DLLMan := TDLLMan.Create; //Load PluginList - - Log.LogError(inttostr(Length(DLLMan.Plugins)) + ' Plugins Loaded'); - Log.BenchmarkEnd(1); Log.LogBenchmark('Loading PluginManager', 1); @@ -260,10 +265,10 @@ begin //GoldenStarsTwinkleMod Log.BenchmarkStart(1); - Log.LogStatus('GoldenStars', 'Initialization'); + Log.LogStatus('Effect Manager', 'Initialization'); GoldenRec := TEffectManager.Create; Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading GoldenStars', 1); + Log.LogBenchmark('Loading Particel System', 1); // Joypad if Ini.Joypad = 1 then begin @@ -277,15 +282,18 @@ begin Log.LogBenchmark('Loading Time', 0); -// Music.SetLoop(true); -// Music.SetVolume(50); -// Music.Open(SkinPath + 'Menu Music 3.mp3'); -// Music.Play; + //------------------------------ + //Start- Mainloop + //------------------------------ + //Music.SetLoop(true); + //Music.SetVolume(50); + //Music.Open(SkinPath + 'Menu Music 3.mp3'); + //Music.Play; Log.LogStatus('Main Loop', 'Initialization'); MainLoop; -// sleep(3000); - - // finish + //------------------------------ + //Finish Application + //------------------------------ if Ini.LPT = 1 then LCD.Clear; if Ini.LPT = 2 then Light.TurnOff; -- cgit v1.2.3 From 07174bc088f8b14203a1417e7ffe0cc8a8be5e73 Mon Sep 17 00:00:00 2001 From: mogguh Date: Thu, 22 Mar 2007 22:10:33 +0000 Subject: Added new texture for perfect sung note (formerly NoteStar), now named NotePerfectStar (view skin: W&C.ini). NoteStar is now used for golden notes. There's also a difference in drawing both, PerfectNoteStar is bigger, and drawn in white - whereas GoldenNotes are smaller and yellow. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@17 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 15 +++++++----- Game/Code/Classes/UGraphic.pas | 3 +++ Game/Code/Classes/UGraphicClasses.pas | 43 +++++++++++++++++++++++------------ 3 files changed, 40 insertions(+), 21 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 31291788..2e742172 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -12,9 +12,10 @@ procedure SingDrawBeatDelimeters(Left, Top, Right: real; NrCzesci: integer); procedure SingDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); procedure SingDrawPlayerCzesc(X, Y, W: real; NrGracza: integer; Space: integer); procedure SingDrawPlayerBGCzesc(Left, Top, Right: real; NrCzesci, NrGracza: integer; Space: integer); +{ for no use since we have UGraphicClasses procedure SingDrawStar(X, Y, A: real); procedure SingGoldenStar(X, Y, A: real); - +} // The Singbar procedure SingDrawSingbar(X, Y, W, H: real; Percent: integer); @@ -381,8 +382,8 @@ var //inc(Starfr); //Starfr := Starfr mod 128; - - SingDrawStar(Rec.Left+2, Rec.Top+4, A); + GoldenRec.SavePerfectNotePos(Rec.Left, Rec.Top); + { SingDrawStar(Rec.Left+2, Rec.Top+4, A);} end; // detekt @@ -500,6 +501,7 @@ begin end; end; +{not used anymore tough we have UGraphicClasses procedure SingDrawStar(X, Y, A: real); var TempR: real; @@ -509,7 +511,7 @@ var W := 32; H := 32; - // Golden Star Patch +// Golden Star Patch // case Z of // 1: glColor4f(1, 1, 1, A); // 2: glColor4f(1, 1, 0.3, A); @@ -530,8 +532,9 @@ var glTexCoord2f((1/16) * Starframe, 1); glVertex2f(X+W, Y-H); glEnd; end; +} - +{not used anymore tough we have UGraphicClasses procedure SingGoldenStar(X, Y, A: real); var TempR: real; @@ -554,7 +557,7 @@ var glTexCoord2f((1/16) * StarfrG2, 1); glVertex2f(X+W, Y-H); glEnd; end; - +} procedure SingDraw; var diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 05a9fda7..8238eace 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -70,6 +70,8 @@ var Tex_BG_Right: array[1..6] of TTexture; Tex_Note_Star: TTexture; + Tex_Note_Perfect_Star: TTexture; + Tex_Ball: TTexture; FullScreen: boolean; @@ -186,6 +188,7 @@ begin Tex_BG_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGRight')), 'BMP', 'Alpha Black Colored', Col); end; + Tex_Note_Perfect_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePerfectStar')), 'JPG', 'Font Black', 0); Tex_Note_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteStar')), 'JPG', 'Font Black', 0); Tex_Ball := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'BMP', 'Transparent', $FF00FF); diff --git a/Game/Code/Classes/UGraphicClasses.pas b/Game/Code/Classes/UGraphicClasses.pas index d66bd142..6c131b50 100644 --- a/Game/Code/Classes/UGraphicClasses.pas +++ b/Game/Code/Classes/UGraphicClasses.pas @@ -8,9 +8,10 @@ type Frame : Byte; //act. Frame Tex : Cardinal; //Tex num from Textur Manager Live : Byte; //How many Cycles before Kill - RecIndex : Integer; //To which rectangle belongs this particle + RecIndex : Integer; //To which rectangle this particle belongs + StarType : Integer; // 1: GoldenNote | 2: PerfectNote - Constructor Create(cX,cY: Real; cTex: Cardinal; cLive: Byte; cFrame : integer; RecArrayIndex : Integer); + Constructor Create(cX,cY: Real; cTex: Cardinal; cLive: Byte; cFrame : integer; cRecArrayIndex : Integer; cStarType : Integer); procedure Draw; end; @@ -32,7 +33,7 @@ type constructor Create; procedure Draw; - function Spawn(X, Y: Real; Tex: Cardinal; Live: Byte; StartFrame : Integer; RecArrayIndex : Integer): Cardinal; + function Spawn(X, Y: Real; Tex: Cardinal; Live: Byte; StartFrame : Integer; RecArrayIndex : Integer; StarType : Integer): Cardinal; procedure SpawnRec(); procedure Kill(index: Cardinal); procedure KillAll(); @@ -47,14 +48,15 @@ implementation uses sysutils, Windows,OpenGl12, UThemes, USkins, UGraphic, UDrawTexture, UTexture, math, dialogs; //TParticle -Constructor TParticle.Create(cX,cY: Real; cTex: Cardinal; cLive: Byte; cFrame : integer; RecArrayIndex : Integer); +Constructor TParticle.Create(cX,cY: Real; cTex: Cardinal; cLive: Byte; cFrame : integer; cRecArrayIndex : Integer; cStarType : Integer); begin X := cX; Y := cY; Tex := cTex; Live := cLive; Frame:= cFrame; - RecIndex := RecArrayIndex; + RecIndex := cRecArrayIndex; + StarType := cStarType; end; @@ -63,16 +65,27 @@ var W, H: real; Alpha : real; begin - W := 20; - H := 20; - Alpha := (-cos((Frame+1)*2*pi/16)+1); //Fade Eyecandy - glColor4f(0.99, 1, 0.6, Alpha); + Case StarType of + 1: + begin + W := 20; + H := 20; + glColor4f(0.99, 1, 0.6, Alpha); + end; + 2: + begin + W := 30; + H := 30; + glColor4f(1, 1, 0.95, Alpha); + end; + end; + glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, Tex_Note_Star.TexNum); + glBindTexture(GL_TEXTURE_2D, Tex); begin glBegin(GL_QUADS); @@ -139,11 +152,11 @@ begin end; -function TEffectManager.Spawn(X, Y: Real; Tex: Cardinal; Live: Byte; StartFrame : Integer; RecArrayIndex : Integer): Cardinal; +function TEffectManager.Spawn(X, Y: Real; Tex: Cardinal; Live: Byte; StartFrame : Integer; RecArrayIndex : Integer; StarType : Integer): Cardinal; begin Result := Length(Particle); SetLength(Particle, (Result + 1)); - Particle[Result] := TParticle.Create(X, Y, Tex, Live, StartFrame, RecArrayIndex); + Particle[Result] := TParticle.Create(X, Y, Tex, Live, StartFrame, RecArrayIndex, StarType); end; @@ -162,7 +175,7 @@ for P:= 0 to high(RecArray) do Xkatze := RandomRange(Ceil(RecArray[P].xTop), Ceil(RecArray[P].xBottom)); Ykatze := RandomRange(Ceil(RecArray[P].yTop), Ceil(RecArray[P].yBottom)); RandomFrame := RandomRange(0,14); - Spawn(Xkatze, Ykatze, Tex_Note_Star.TexNum, 16 - RandomFrame, RandomFrame, P); + Spawn(Xkatze, Ykatze, Tex_Note_Star.TexNum, 16 - RandomFrame, RandomFrame, P, 1); inc(RecArray[P].CurrentStarCount); end; end; @@ -183,7 +196,7 @@ for P:= 0 to 2 do Xkatze := RandomRange(ceil(xPos) - 5 , ceil(xPos) + 10); Ykatze := RandomRange(ceil(yPos) - 5 , ceil(yPos) + 10); RandomFrame := RandomRange(0,14); - Spawn(Xkatze, Ykatze, Tex_Note_Star.TexNum, 16 - RandomFrame, RandomFrame, -1); + Spawn(Xkatze, Ykatze, Tex_Note_Star.TexNum, 16 - RandomFrame, RandomFrame, -1, 2); end; draw; end; @@ -265,7 +278,7 @@ begin Xkatze := RandomRange(ceil(Xtop) - 5 , ceil(Xtop) + 10); Ykatze := RandomRange(ceil(Ytop) - 5 , ceil(Ytop) + 10); RandomFrame := RandomRange(0,14); - Spawn(Xkatze, Ykatze, Tex_Note_Star.TexNum, 16 - RandomFrame, RandomFrame, -1); + Spawn(Xkatze, Ykatze, Tex_Note_Perfect_Star.TexNum, 16 - RandomFrame, RandomFrame, -1, 2); end; end; -- cgit v1.2.3 From 47c091672034720666ca036e181dcff494ba04ee Mon Sep 17 00:00:00 2001 From: mogguh Date: Fri, 23 Mar 2007 13:54:37 +0000 Subject: Some tidying in UGraphicClasses.pas (actually deleting an unused procedure) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@19 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphicClasses.pas | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphicClasses.pas b/Game/Code/Classes/UGraphicClasses.pas index 6c131b50..d5eb44ab 100644 --- a/Game/Code/Classes/UGraphicClasses.pas +++ b/Game/Code/Classes/UGraphicClasses.pas @@ -38,7 +38,6 @@ type procedure Kill(index: Cardinal); procedure KillAll(); procedure SaveGoldenStarsRec(Xtop, Ytop, Xbottom, Ybottom: Real); - procedure SpawnNotePerfect(xPos,yPos : real); procedure SavePerfectNotePos(Xtop, Ytop: Real); end; @@ -183,25 +182,6 @@ for P:= 0 to high(RecArray) do end; -procedure TEffectManager.SpawnNotePerfect(xPos,yPos : real); -Var - Xkatze, Ykatze : Real; - RandomFrame : Integer; - P : Integer; // P as seen on TV as Positionman -begin -//Spawn a random amount of stars within the given coordinates -//RandomRange(0,14) <- this one starts at a random frame, 16 is our last frame - would be senseless to start a particle with 16, cause it would be dead at the next frame -for P:= 0 to 2 do - begin - Xkatze := RandomRange(ceil(xPos) - 5 , ceil(xPos) + 10); - Ykatze := RandomRange(ceil(yPos) - 5 , ceil(yPos) + 10); - RandomFrame := RandomRange(0,14); - Spawn(Xkatze, Ykatze, Tex_Note_Star.TexNum, 16 - RandomFrame, RandomFrame, -1, 2); - end; - draw; -end; - - procedure TEffectManager.Kill(Index: Cardinal); var LastParticleIndex : Cardinal; -- cgit v1.2.3 From 95dc3d90b3eb11080fdcd5edae37cbd35c4ffb57 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 23 Mar 2007 17:40:06 +0000 Subject: Some Changes on Database System and Header Reader Fixed Bug: Scores with 0 are added to DB Made a Class instead of many Functions Fixed a Bug in UFiles, not reading Gap from Header correctly git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@20 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDataBase.pas | 163 ++++++++++++++++++++++++++++++++++++++ Game/Code/Classes/UFiles.pas | 10 +++ Game/Code/Classes/UScores.pas | 144 --------------------------------- Game/Code/Screens/UScreenTop5.pas | 8 +- Game/Code/UltraStar.dpr | 9 ++- 5 files changed, 182 insertions(+), 152 deletions(-) create mode 100644 Game/Code/Classes/UDataBase.pas delete mode 100644 Game/Code/Classes/UScores.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDataBase.pas b/Game/Code/Classes/UDataBase.pas new file mode 100644 index 00000000..1ebc18db --- /dev/null +++ b/Game/Code/Classes/UDataBase.pas @@ -0,0 +1,163 @@ +unit UDataBase; + +interface + +uses USongs, SQLiteTable3; + +//-------------------- +//DataBaseSystem - Class including all DB Methods +//-------------------- +type + TDataBaseSystem = class + private + ScoreDB: TSqliteDatabase; + sFilename: string; + public + + + Destructor Free; + + Procedure Init(const Filename: string); + procedure ReadScore(var Song: TSong); + procedure AddScore(var Song: TSong; Level: integer; Name: string; Score: integer); + procedure WriteScore(var Song: TSong); + end; + +var + DataBase: TDataBaseSystem; + +implementation + +uses IniFiles, SysUtils; + +//-------------------- +//Create - Opens Database and Create Tables if not Exist +//-------------------- + +Procedure TDataBaseSystem.Init(const Filename: string); +begin + //Open Database + ScoreDB := TSqliteDatabase.Create(Filename); + sFilename := Filename; + + try + //Look for Tables => When not exist Create them + if not ScoreDB.TableExists('US_Scores') then + ScoreDB.execsql('CREATE TABLE `US_Scores` (`SongID` INT( 11 ) NOT NULL , `Difficulty` INT( 1 ) NOT NULL , `Player` VARCHAR( 150 ) NOT NULL , `Score` INT( 5 ) NOT NULL );'); + + if not ScoreDB.TableExists('US_Songs') then + ScoreDB.execsql('CREATE TABLE `US_Songs` (`ID` INTEGER PRIMARY KEY, `Artist` VARCHAR( 255 ) NOT NULL , `Title` VARCHAR( 255 ) NOT NULL , `TimesPlayed` int(5) NOT NULL );'); + //Not possible because of String Limitation to 255 Chars //Need to rewrite Wrapper + {if not ScoreDB.TableExists('US_SongCache') then + ScoreDB.ExecSQL('CREATE TABLE `US_SongCache` (`Path` VARCHAR( 255 ) NOT NULL , `Filename` VARCHAR( 255 ) NOT NULL , `Title` VARCHAR( 255 ) NOT NULL , `Artist` VARCHAR( 255 ) NOT NULL , `Folder` VARCHAR( 255 ) NOT NULL , `Genre` VARCHAR( 255 ) NOT NULL , `Edition` VARCHAR( 255 ) NOT NULL , `Language` VARCHAR( 255 ) NOT NULL , `Creator` VARCHAR( 255 ) NOT NULL , `Cover` VARCHAR( 255 ) NOT NULL , `Background` VARCHAR( 255 ) NOT NULL , `Video` VARCHAR( 255 ) NOT NULL , `VideoGap` FLOAT NOT NULL , `Gap` FLOAT NOT NULL , `Start` FLOAT NOT NULL , `Finish` INT( 11 ) NOT NULL , `BPM` INT( 5 ) NOT NULL , `Relative` BOOLEAN NOT NULL , `NotesGap` INT( 11 ) NOT NULL);');} + + + finally + //ScoreDB.Free; + end; + +end; + +//-------------------- +//Free - Frees Database +//-------------------- +Destructor TDataBaseSystem.Free; +begin + ScoreDB.Free; +end; + +//-------------------- +//ReadScore - Read Scores into SongArray +//-------------------- +procedure TDataBaseSystem.ReadScore(var Song: TSong); +var + TableData: TSqliteTable; + Dif: Byte; +begin + //ScoreDB := TSqliteDatabase.Create(sFilename); + try + try + //Search Song in DB + TableData := ScoreDB.GetTable('SELECT `Difficulty`, `Player`, `Score` FROM `us_scores` WHERE `SongID` = (SELECT `ID` FROM `us_songs` WHERE `Artist` = "' + Song.Artist + '" AND `Title` = "' + Song.Title + '" LIMIT 1) ORDER BY `Score` DESC LIMIT 15'); + //Empty Old Scores + SetLength (Song.Score[0], 0); + SetLength (Song.Score[1], 0); + SetLength (Song.Score[2], 0); + + while not TableData.Eof do//Go through all Entrys + begin//Add one Entry to Array + Dif := StrtoInt(TableData.FieldAsString(TableData.FieldIndex['Difficulty'])); + if (Dif>=0) AND (Dif<=2) then + begin + SetLength(Song.Score[Dif], Length(Song.Score[Dif]) + 1); + + Song.Score[Dif, high(Song.Score[Dif])].Name := TableData.FieldAsString(TableData.FieldIndex['Player']); + Song.Score[Dif, high(Song.Score[Dif])].Score:= StrtoInt(TableData.FieldAsString(TableData.FieldIndex['Score'])); + end; + TableData.Next; + end; + + except //Im Fehlerfall + for Dif := 0 to 2 do + begin + SetLength(Song.Score[Dif], 1); + Song.Score[Dif, 1].Name := 'Error Reading ScoreDB'; + end; + end; + finally + //ScoreDb.Free; + end; +end; + +//-------------------- +//AddScore - Add one new Score to DB +//-------------------- +procedure TDataBaseSystem.AddScore(var Song: TSong; Level: integer; Name: string; Score: integer); +var +ID: Integer; +TableData: TSqliteTable; +begin + //ScoreDB := TSqliteDatabase.Create(sFilename); + try + //Prevent 0 Scores from being added + if (Score > 0) then + begin + + ID := ScoreDB.GetTableValue('SELECT `ID` FROM `US_Songs` WHERE `Artist` = "' + Song.Artist + '" AND `Title` = "' + Song.Title + '"'); + if ID = 0 then //Song doesn't exist -> Create + begin + ScoreDB.ExecSQL ('INSERT INTO `US_Songs` ( `ID` , `Artist` , `Title` , `TimesPlayed` ) VALUES (NULL , "' + Song.Artist + '", "' + Song.Title + '", "0");'); + ID := ScoreDB.GetTableValue('SELECT `ID` FROM `US_Songs` WHERE `Artist` = "' + Song.Artist + '" AND `Title` = "' + Song.Title + '"'); + if ID = 0 then //Could not Create Table + exit; + end; + //Create new Entry + ScoreDB.ExecSQL('INSERT INTO `US_Scores` ( `SongID` , `Difficulty` , `Player` , `Score` ) VALUES ("' + InttoStr(ID) + '", "' + InttoStr(Level) + '", "' + Name + '", "' + InttoStr(Score) + '");'); + + //Delete Last Position when there are more than 5 Entrys + if ScoreDB.GetTableValue('SELECT COUNT(`SongID`) FROM `US_Scores` WHERE `SongID` = "' + InttoStr(ID) + '" AND `Difficulty` = "' + InttoStr(Level) +'"') > 5 then + begin + TableData := ScoreDB.GetTable('SELECT `Player`, `Score` FROM `US_Scores` WHERE SongID = "' + InttoStr(ID) + '" AND `Difficulty` = "' + InttoStr(Level) +'" ORDER BY `Score` ASC LIMIT 1'); + ScoreDB.ExecSQL('DELETE FROM `US_Scores` WHERE SongID = "' + InttoStr(ID) + '" AND `Difficulty` = "' + InttoStr(Level) +'" AND `Player` = "' + TableData.FieldAsString(TableData.FieldIndex['Player']) + '" AND `Score` = "' + TableData.FieldAsString(TableData.FieldIndex['Score']) + '"'); + end; + + end; + finally + //ScoreDB.Free; + end; +end; + +//-------------------- +//WriteScore - Not needed with new System; But used for Increment Played Count +//-------------------- +procedure TDataBaseSystem.WriteScore(var Song: TSong); +begin + try + //Increase TimesPlayed + ScoreDB.ExecSQL ('UPDATE `us_songs` SET `TimesPlayed` = `TimesPlayed` + "1" WHERE `Title` = "' + Song.Title + '" AND `Artist` = "' + Song.Artist + '";'); + except + + end; +end; + +end. diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index 61fdab03..fed9b7f1 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -171,6 +171,16 @@ begin //Additional Header Information //--------- + // Video Gap + else if (Identifier = 'GAP') then + begin + // Replace . with , + if (Pos('.', Value) <> 0) then + Value[Pos('.', Value)] := ','; + + Song.GAP := StrtoFloatDef (Value, 0); + end + //Cover Picture else if (Identifier = 'COVER') then begin diff --git a/Game/Code/Classes/UScores.pas b/Game/Code/Classes/UScores.pas deleted file mode 100644 index f1243868..00000000 --- a/Game/Code/Classes/UScores.pas +++ /dev/null @@ -1,144 +0,0 @@ -unit UScores; - -interface - -uses USongs, SQLiteTable3; - -procedure InitScore(const Filename: string); -procedure ReadScore(var Song: TSong); -procedure WriteScore(var Song: TSong); -procedure AddScore(var Song: TSong; Level: integer; Name: string; Score: integer); - -var -ScoreDB: TSqliteDatabase; -sFilename: string; - -implementation - -uses IniFiles, SysUtils; - -procedure InitScore(const Filename: string); -//var - //TableData: TSqliteTable; -begin - //Open Database - ScoreDB := TSqliteDatabase.Create(Filename); - sFilename := Filename; - - try - //Look for Tables => When not exist Create them - if not ScoreDB.TableExists('US_Scores') then - ScoreDB.execsql('CREATE TABLE `US_Scores` (`SongID` INT( 11 ) NOT NULL , `Difficulty` INT( 1 ) NOT NULL , `Player` VARCHAR( 150 ) NOT NULL , `Score` INT( 5 ) NOT NULL );'); - - if not ScoreDB.TableExists('US_Songs') then - ScoreDB.execsql('CREATE TABLE `US_Songs` (`ID` INTEGER PRIMARY KEY, `Artist` VARCHAR( 255 ) NOT NULL , `Title` VARCHAR( 255 ) NOT NULL );'); - - finally - //ScoreDB.Free; - end; - -end; - -procedure ReadScore(var Song: TSong); -var - TableData: TSqliteTable; - Dif: Byte; -begin - //ScoreDB := TSqliteDatabase.Create(sFilename); - try - try - //Search Song in DB - TableData := ScoreDB.GetTable('SELECT `Difficulty`, `Player`, `Score` FROM `us_scores` WHERE `SongID` = (SELECT `ID` FROM `us_songs` WHERE `Artist` = "' + Song.Artist + '" AND `Title` = "' + Song.Title + '" LIMIT 1) ORDER BY `Score` DESC LIMIT 15'); - //Empty Old Scores - SetLength (Song.Score[0], 0); - SetLength (Song.Score[1], 0); - SetLength (Song.Score[2], 0); - - while not TableData.Eof do//Go through all Entrys - begin//Add one Entry to Array - Dif := StrtoInt(TableData.FieldAsString(TableData.FieldIndex['Difficulty'])); - if (Dif>=0) AND (Dif<=2) then - begin - SetLength(Song.Score[Dif], Length(Song.Score[Dif]) + 1); - - Song.Score[Dif, high(Song.Score[Dif])].Name := TableData.FieldAsString(TableData.FieldIndex['Player']); - Song.Score[Dif, high(Song.Score[Dif])].Score:= StrtoInt(TableData.FieldAsString(TableData.FieldIndex['Score'])); - end; - TableData.Next; - end; - - except //Im Fehlerfall - for Dif := 0 to 2 do - begin - SetLength(Song.Score[Dif], 1); - Song.Score[Dif, 1].Name := 'Error Reading ScoreDB'; - end; - end; - finally - //ScoreDb.Free; - end; -end; - -procedure AddScore(var Song: TSong; Level: integer; Name: string; Score: integer); -var -ID: Integer; -TableData: TSqliteTable; -begin - //ScoreDB := TSqliteDatabase.Create(sFilename); - try - - ID := ScoreDB.GetTableValue('SELECT `ID` FROM `US_Songs` WHERE `Artist` = "' + Song.Artist + '" AND `Title` = "' + Song.Title + '"'); - if ID = 0 then //Song doesn't exist -> Create - begin - ScoreDB.ExecSQL ('INSERT INTO `US_Songs` ( `ID` , `Artist` , `Title` ) VALUES (NULL , "' + Song.Artist + '", "' + Song.Title + '");'); - ID := ScoreDB.GetTableValue('SELECT `ID` FROM `US_Songs` WHERE `Artist` = "' + Song.Artist + '" AND `Title` = "' + Song.Title + '"'); - if ID = 0 then //Could not Create Table - exit; - end; - //Create new Entry - ScoreDB.ExecSQL('INSERT INTO `US_Scores` ( `SongID` , `Difficulty` , `Player` , `Score` ) VALUES ("' + InttoStr(ID) + '", "' + InttoStr(Level) + '", "' + Name + '", "' + InttoStr(Score) + '");'); - - //Delete Last Position when there are more than 5 Entrys - if ScoreDB.GetTableValue('SELECT COUNT(`SongID`) FROM `US_Scores` WHERE `SongID` = "' + InttoStr(ID) + '" AND `Difficulty` = "' + InttoStr(Level) +'"') > 5 then - begin - TableData := ScoreDB.GetTable('SELECT `Player`, `Score` FROM `US_Scores` WHERE SongID = "' + InttoStr(ID) + '" AND `Difficulty` = "' + InttoStr(Level) +'" ORDER BY `Score` ASC LIMIT 1'); - ScoreDB.ExecSQL('DELETE FROM `US_Scores` WHERE SongID = "' + InttoStr(ID) + '" AND `Difficulty` = "' + InttoStr(Level) +'" AND `Player` = "' + TableData.FieldAsString(TableData.FieldIndex['Player']) + '" AND `Score` = "' + TableData.FieldAsString(TableData.FieldIndex['Score']) + '"'); - end; - - finally - //ScoreDB.Free; - end; -end; - -//Not used with new SQLLite DB System -procedure WriteScore(var Song: TSong); -{var - F: TIniFile; - S: integer; - Lev: integer; - LevS: string; - FileName: string;} -begin - {FileName := Song.Path + ChangeFileExt(Song.FileName, '.sco'); - if (not FileExists(FileName)) or (FileExists(FileName) and DeleteFile(FileName)) then begin - // file has been deleted -> creating new file - F := TIniFile.Create(FileName); - - for Lev := 0 to 2 do begin - case Lev of - 0: LevS := 'Easy'; - 1: LevS := 'Normal'; - 2: LevS := 'Hard'; - end; - - for S := 0 to high(Song.Score[Lev]) do begin - F.WriteString(LevS + IntToStr(S+1), 'Name', Song.Score[Lev, S].Name); - F.WriteInteger(LevS + IntToStr(S+1), 'Score', Song.Score[Lev, S].Score); - - end; // for S - end; // for Lev - F.Free; - end; // if} -end; - -end. diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas index 41f96281..94f3de1e 100644 --- a/Game/Code/Screens/UScreenTop5.pas +++ b/Game/Code/Screens/UScreenTop5.pas @@ -25,7 +25,7 @@ type implementation -uses UGraphic, UScores, UMain, UIni; +uses UGraphic, UDataBase, UMain, UIni; function TScreenTop5.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -94,10 +94,10 @@ begin PMax := Ini.Players; if Ini.Players = 4 then Ini.Players := 5; for I := 0 to PMax do - AddScore(AktSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalI)); + DataBase.AddScore(AktSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalI)); - //WriteScore(AktSong); - ReadScore(AktSong); + DataBase.WriteScore(AktSong); + DataBase.ReadScore(AktSong); Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 1bc19dcf..408405f8 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -42,7 +42,7 @@ uses UJoystick in 'Classes\UJoystick.pas', ULCD in 'Classes\ULCD.pas', ULight in 'Classes\ULight.pas', - UScores in 'Classes\UScores.pas', + UDataBase in 'Classes\UDataBase.pas', UCovers in 'Classes\UCovers.pas', UCatCovers in 'Classes\UCatCovers.pas', UFiles in 'Classes\UFiles.pas', @@ -258,10 +258,11 @@ begin // Score Saving System Log.BenchmarkStart(1); - Log.LogStatus('Score DB System', 'Initialization'); - InitScore('Scores.db'); + Log.LogStatus('DataBase System', 'Initialization'); + DataBase := TDataBaseSystem.Create; + DataBase.Init ('Ultrastar.db'); Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Score DB System', 1); + Log.LogBenchmark('Loading DataBase System', 1); //GoldenStarsTwinkleMod Log.BenchmarkStart(1); -- cgit v1.2.3 From 7c809200754d707f440ec45686692db405da8ae1 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 24 Mar 2007 12:23:00 +0000 Subject: Fixed Bug: Not translating Texts reading Theme.Ini Compiler doesn't define CompilerConst Translate correctly. Fixed by Commenting IFDEF Operations out git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@21 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 26 +++++++++++++------------- Game/Code/Screens/UScreenScore.pas | 10 +++++----- Game/Code/UltraStar.dpr | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index c4b83d8b..7dbac5a9 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -3,9 +3,6 @@ unit UThemes; interface uses -{$IFDEF TRANSLATE} - ULanguage, -{$ENDIF} IniFiles, SysUtils, Classes; type @@ -580,6 +577,9 @@ var implementation uses +{{$IFDEF TRANSLATE} + ULanguage, +{{$ENDIF} USkins, UIni; constructor TTheme.Create(FileName: string); @@ -716,7 +716,7 @@ begin //Score Text Translation Start - {$IFDEF TRANSLATE} + {{$IFDEF TRANSLATE} Main.Description[0] := Language.Translate('SING_SING'); Main.DescriptionLong[0] := Language.Translate('SING_SING_DESC'); Main.Description[1] := Language.Translate('SING_EDITOR'); @@ -725,7 +725,7 @@ begin Main.DescriptionLong[2] := Language.Translate('SING_GAME_OPTIONS_DESC'); Main.Description[3] := Language.Translate('SING_EXIT'); Main.DescriptionLong[3] := Language.Translate('SING_EXIT_DESC'); - {$ENDIF} + {{$ENDIF} //Score Text Translation End @@ -910,7 +910,7 @@ begin ThemeLoadButton(Options.ButtonRecord, 'OptionsButtonRecord'); ThemeLoadButton(Options.ButtonExit, 'OptionsButtonExit'); - {$IFDEF TRANSLATE} + {{$IFDEF TRANSLATE} Options.Description[0] := Language.Translate('SING_OPTIONS_GAME'); Options.Description[1] := Language.Translate('SING_OPTIONS_GRAPHICS'); Options.Description[2] := Language.Translate('SING_OPTIONS_SOUND'); @@ -918,7 +918,7 @@ begin Options.Description[4] := Language.Translate('SING_OPTIONS_THEMES'); Options.Description[5] := Language.Translate('SING_OPTIONS_RECORD'); Options.Description[6] := Language.Translate('SING_OPTIONS_EXIT'); - {$ENDIF} + {{$ENDIF} ThemeLoadText(Options.TextDescription, 'OptionsTextDescription'); Options.TextDescription.Text := Options.Description[0]; @@ -1137,9 +1137,9 @@ begin ThemeText.Size := ThemeIni.ReadInteger(Name, 'Size', 0); ThemeText.Align := ThemeIni.ReadInteger(Name, 'Align', 0); - {$IFDEF TRANSLATE} + {{$IFDEF TRANSLATE} ThemeText.Text := Language.Translate(ThemeIni.ReadString(Name, 'Text', '')); - {$ELSE} + {{$ELSE}{ ThemeText.Text := ThemeIni.ReadString(Name, 'Text', ''); {$ENDIF} @@ -1268,9 +1268,9 @@ var begin DecimalSeparator := '.'; - {$IFDEF TRANSLATE} + {{$IFDEF TRANSLATE} ThemeSelect.Text := Language.Translate(ThemeIni.ReadString(Name, 'Text', '')); - {$ELSE} + {{$ELSE}{ ThemeSelect.Text := ThemeIni.ReadString(Name, 'Text', ''); {$ENDIF} @@ -1314,9 +1314,9 @@ var begin DecimalSeparator := '.'; - {$IFDEF TRANSLATE} + {{$IFDEF TRANSLATE} ThemeSelectS.Text := Language.Translate(ThemeIni.ReadString(Name, 'Text', '')); - {$ELSE} + {{$ELSE}{ ThemeSelectS.Text := ThemeIni.ReadString(Name, 'Text', ''); {$ENDIF} diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 2e509a6f..eb92a3d2 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -45,11 +45,11 @@ type implementation -{$IFDEF TRANSLATE} +{{$IFDEF TRANSLATE} uses UGraphic, UScreenSong, UMenuStatic, UTime, UMain, UIni, ULanguage; -{$ELSE} +{{$ELSE}{ uses UGraphic, UScreenSong, UMenuStatic, UTime, UMain, UIni; -{$ENDIF} +{{$ENDIF} function TScreenScore.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin Result := true; @@ -291,7 +291,7 @@ begin Text[TextName[PP]].Text := Ini.Name[P]; - {$IFDEF TRANSLATE} + {{$IFDEF TRANSLATE} case (Player[P].ScoreTotalI) of 0..2000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_TONE_DEAF'); 2010..4000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_AMATEUR'); @@ -301,7 +301,7 @@ begin 9010..9800: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_SUPERSTAR'); 9810..10000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_ULTRASTAR'); end; - {$ELSE} + {{$ELSE}{ case (Player[P].ScoreTotalI) of 0..2000: Text[TextScore[PP]].Text := 'Tone Deaf'; 2010..4000: Text[TextScore[PP]].Text := 'Amateur'; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 408405f8..9b73883a 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -1,4 +1,4 @@ - program UltraStar; +program UltraStar; {$DEFINE TRANSLATE} //DEFINE THEMESAVE} -- cgit v1.2.3 From 5ce375d1b7493e41a3ac14b979932d6cf7d73285 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 24 Mar 2007 13:37:12 +0000 Subject: Copyed PNG Texture Support from UltraStar 0.5.3 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@23 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 767d53ec..b50ab6bf 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -11,7 +11,7 @@ unit UTexture; // Arrow (for arrows, white is white, gray has color, black is transparent); interface -uses OpenGL12, Windows, Math, Classes, SysUtils, Graphics, JPEG, UThemes; +uses OpenGL12, Windows, Math, Classes, SysUtils, Graphics, JPEG, UThemes, PNGImage; procedure glGenTextures(n: GLsizei; var textures: GLuint); stdcall; external opengl32; //procedure glBindTexture(target: GLenum; texture: GLuint); stdcall; external opengl32; @@ -192,6 +192,7 @@ var Res: TResourceStream; TextureB: TBitmap; TextureJ: TJPEGImage; + TexturePNG: TPNGObject; Pet: integer; Pet2: integer; @@ -215,10 +216,14 @@ begin end; if FromRegistry or ((not FromRegistry) and FileExists(Nazwa)) then begin - TextureB := TBitmap.Create; - if Format = 'JPG' then begin + if Format = 'BMP' then begin + if FromRegistry then TextureB.LoadFromStream(Res) + else TextureB.LoadFromFile(Nazwa); + end + + else if Format = 'JPG' then begin TextureJ := TJPEGImage.Create; if FromRegistry then TextureJ.LoadFromStream(Res) else begin @@ -229,10 +234,19 @@ begin end; TextureB.Assign(TextureJ); TextureJ.Free; - end; - if Format = 'BMP' then begin - if FromRegistry then TextureB.LoadFromStream(Res) - else TextureB.LoadFromFile(Nazwa); + end + + else if Format = 'PNG' then begin + TexturePNG := TPNGObject.Create; + if FromRegistry then TexturePNG.LoadFromStream(Res) + else begin + if FileExists(Nazwa) then + TexturePNG.LoadFromFile(Nazwa) + else + Exit; + end; + TextureB.Assign(TexturePNG); + TexturePNG.Free; end; if FromRegistry then Res.Free; -- cgit v1.2.3 From 467e742c7c03c78f0de5053cfe012cf6a9299960 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 24 Mar 2007 14:01:23 +0000 Subject: Changed Fonts from BMP to PNG git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@24 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.pas | 8 ++++---- Game/Code/UltraStar.rc | 12 +++++------- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index cf09e48b..0f4ae82e 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -62,25 +62,25 @@ begin ActFont := 0; SetLength(Fonts, 5); - Fonts[0].Tex := Texture.LoadTexture(true, 'Font', 'BMP', 'Font', 0); + Fonts[0].Tex := Texture.LoadTexture(true, 'Font', 'PNG', 'Font', 0); Fonts[0].Tex.H := 30; Fonts[0].AspectW := 0.9; Fonts[0].Done := -1; Fonts[0].Outline := 0; - Fonts[1].Tex := Texture.LoadTexture(true, 'FontB', 'BMP', 'Font', 0); + Fonts[1].Tex := Texture.LoadTexture(true, 'FontB', 'PNG', 'Font', 0); Fonts[1].Tex.H := 30; Fonts[1].AspectW := 1; Fonts[1].Done := -1; Fonts[1].Outline := 0; - Fonts[2].Tex := Texture.LoadTexture(true, 'FontO', 'BMP', 'Font Outline', 0); + Fonts[2].Tex := Texture.LoadTexture(true, 'FontO', 'PNG', 'Font Outline', 0); Fonts[2].Tex.H := 30; Fonts[2].AspectW := 0.95; Fonts[2].Done := -1; Fonts[2].Outline := 5; - Fonts[3].Tex := Texture.LoadTexture(true, 'FontO2', 'BMP', 'Font Outline 2', 0); + Fonts[3].Tex := Texture.LoadTexture(true, 'FontO2', 'PNG', 'Font Outline 2', 0); Fonts[3].Tex.H := 30; Fonts[3].AspectW := 0.95; Fonts[3].Done := -1; diff --git a/Game/Code/UltraStar.rc b/Game/Code/UltraStar.rc index 22ee2142..0ae2b756 100644 --- a/Game/Code/UltraStar.rc +++ b/Game/Code/UltraStar.rc @@ -1,15 +1,13 @@ -Button JPG "..\Graphics\MusicWheelItem song.jpg" - -Font BMP "..\Fonts\Normal\Font Normal 16.bmp" +Font PNG "..\Fonts\Normal\Font Normal 16.PNG" Font FNT "..\Fonts\Normal\Font Normal.dat" -FontB BMP "..\Fonts\Bold\Font 1024 Bold 16.bmp" +FontB PNG "..\Fonts\Bold\Font 1024 Bold 16.PNG" FontB FNT "..\Fonts\Bold\Font 1024 Bold.dat" -FontO BMP "..\Fonts\Outline 1\Outline 36 (1024) 16c.bmp" +FontO PNG "..\Fonts\Outline 1\Outline 36 (1024) 16c.PNG" FontO FNT "..\Fonts\Outline 1\Outline 36 (1024).dat" -FontO2 BMP "..\Fonts\Outline 2\5 - Outline Dark Edited 16c.bmp" +FontO2 PNG "..\Fonts\Outline 2\5 - Outline Dark Edited 16c.PNG" FontO2 FNT "..\Fonts\Outline 2\Outline.dat" -MAINICON ICON "..\Graphics\us.ico" +MAINICON ICON "..\Graphics\us.ico" \ No newline at end of file -- cgit v1.2.3 From b7ae6bb3c682473abc6c642ce4f15a4ffa9d630d Mon Sep 17 00:00:00 2001 From: mogguh Date: Sat, 24 Mar 2007 20:20:47 +0000 Subject: Bugfix: UScreenSing.pas fixed a minor bug that would've caused redrawing of golden stars in a different song git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@30 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 3dd1119a..f6ec6224 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -636,6 +636,10 @@ begin // prepare timer (II) CountSkipTimeSet; + +//GoldenStarsTwinkle Mod + GoldenRec.KillAll; +//GoldenStarsTwinkle Mod End end; function TScreenSing.Draw: boolean; -- cgit v1.2.3 From baa7e70626941c6c64e5370bdad3b89340c63ffb Mon Sep 17 00:00:00 2001 From: mogguh Date: Sat, 24 Mar 2007 21:56:14 +0000 Subject: New fonts git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@31 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.rc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.rc b/Game/Code/UltraStar.rc index 0ae2b756..9b095726 100644 --- a/Game/Code/UltraStar.rc +++ b/Game/Code/UltraStar.rc @@ -1,8 +1,8 @@ -Font PNG "..\Fonts\Normal\Font Normal 16.PNG" -Font FNT "..\Fonts\Normal\Font Normal.dat" +Font PNG "..\Fonts\Normal\eurostar_regular.png" +Font FNT "..\Fonts\Normal\eurostar_regular.dat" -FontB PNG "..\Fonts\Bold\Font 1024 Bold 16.PNG" -FontB FNT "..\Fonts\Bold\Font 1024 Bold.dat" +FontB PNG "..\Fonts\Bold\eurostar_regular_bold.png" +FontB FNT "..\Fonts\Bold\eurostar_regular_bold.dat" FontO PNG "..\Fonts\Outline 1\Outline 36 (1024) 16c.PNG" FontO FNT "..\Fonts\Outline 1\Outline 36 (1024).dat" -- cgit v1.2.3 From 60521ca33e23a91f2ea8aecf506b9aa5e6bda54a Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 25 Mar 2007 10:41:53 +0000 Subject: 2 Bugs in Cover Positions fixed: Style4 (Classic): Positions now Readed from Theme, No Overlapping Style5 (Deluxe): correct Positions of Covers in the Front No Cut from Last to First Todo: Correct Positions of Covers in the back(Now Invisible) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@32 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 6 +-- Game/Code/Screens/UScreenSong.pas | 82 ++++++++++++--------------------------- 2 files changed, 28 insertions(+), 60 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 7dbac5a9..1d632073 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -759,11 +759,11 @@ begin //Load Cover Pos and Size from Theme Mod Song.Cover.X := ThemeIni.ReadInteger('SongCover', 'X', 400); - Song.Cover.Y := ThemeIni.ReadInteger('SongCover', 'Y', 100); + Song.Cover.Y := ThemeIni.ReadInteger('SongCover', 'Y', 140); Song.Cover.Z := ThemeIni.ReadInteger('SongCover', 'Z', 250); - Song.Cover.W := ThemeIni.ReadInteger('SongCover', 'W', 200); + Song.Cover.W := ThemeIni.ReadInteger('SongCover', 'W', 300); Song.Cover.H := ThemeIni.ReadInteger('SongCover', 'H', 200); - Song.Cover.Style := ThemeIni.ReadInteger('SongCover', 'Style', 5); + Song.Cover.Style := ThemeIni.ReadInteger('SongCover', 'Style', 4); Song.Cover.Reflections := (ThemeIni.ReadInteger('SongCover', 'Reflections', 0) = 1); //Load Cover Pos and Size from Theme Mod End diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 0d7860a7..cd412ceb 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1021,21 +1021,19 @@ begin Button[B].Visible := CatSongs.Song[B].Visible; // nowe if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed -// Wsp := 2 * pi * (B - SongCurrent) / Length(Button); -// Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - 0) / CatSongs.VisibleSongs; Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - Z := (1 + cos(Wsp)) / 2; + Z := (1 + cos(Wsp)) / 2 - 0.02; Z2 := (1 + 2*Z) / 3; - Button[B].X := Theme.Song.Cover.X + (300 + 37 * VS {CatSongs.VisibleSongs} {Length(Button)} * sin(Wsp) - 400) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.W + 0.185 * Theme.Song.Cover.H * VS * sin(Wsp) - Theme.Song.Cover.X) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs Button[B].Z := Z; - Button[B].H := Theme.Song.Cover.H * Z2; - Button[B].W := Button[B].H; + Button[B].W := Theme.Song.Cover.H * Z2; // Button[B].Y := {50 +} 140 + 50 - 50 * Z2; - Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.65; + Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; + Button[B].H := Button[B].W; end; end; end; @@ -1158,17 +1156,17 @@ begin if Button[B].Visible then //Only Change Pos for Visible Buttons begin Pos := (CatSongs.VisibleIndex(B) - SongCurrent); - if (Pos < -VS) then + if (Pos < -VS/2) then Pos := Pos + VS - else if (Pos > VS) then + else if (Pos > VS/2) then Pos := Pos - VS; - if (Abs(Pos) < 3) then {fixed Positions} + if (Abs(Pos) < 2.5) then {fixed Positions} begin Angle := Pi * (Pos / 5); //Button[B].Visible := False; - Button[B].H := Theme.Song.Cover.H * cos(Angle);//Power(Z2, 3); + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle));//Power(Z2, 3); Button[B].Z := 0.95 - Abs(Pos) * 0.01; @@ -1178,67 +1176,37 @@ begin Diff := (Button[B].H - Theme.Song.Cover.H)/2;; - if (X < 0) then - Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Sin(Angle){ - Theme.Song.Cover.H/2} - Diff - else - Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Sin(Angle){ - Theme.Song.Cover.H/2}- Diff; + Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Sin(Angle) - Diff; - Button[B].Visible := True; end else begin {Behind the Front Covers} - //Button[B].Visible := False; - Pos := Frac(Pos / VS); - if Pos < 0 then - Pos := Pos + 1; - - Angle := Abs(2 * pi * ((Pos) / VS / 2)); - //Pos := Power(Pos*2 - 1, 3); + Button[B].Visible := False; - Button[B].Z := (0.2 + Pos/2) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + if Pos < 0 then + Pos := (Pos - VS/2) /VS + else + Pos := (Pos + VS/2) /VS; - //Pos := abs(Pos) mod 1; + Angle := 2 * pi * Pos; - X := sin(Angle); - //Button[B].H := (0.2 + 0.4 * Abs(Pos)) * Theme.Song.Cover.H; //Cover High + Width - Button[B].H := 80; - Button[B].W := Button[B].H; + Button[B].Z := (0.5 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - Diff := (Theme.Song.Cover.H - Button[B].H)/2; + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle));//Power(Z2, 3); - //Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.W) * Sin(Angle) - diff - //Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Pos - Diff; + Button[B].W := Button[B].H; - if (X < 0) then - Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Sin(Angle) - Theme.Song.Cover.H/2 + Diff - else - Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Sin(Angle) - Theme.Song.Cover.H/2; - - end; + Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); - Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field + Diff := (Button[B].H - Theme.Song.Cover.H)/2;; - {X := sin(Angle); + Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.W + Theme.Song.Cover.H*VS*0.185)* Sin(Angle) - Diff - Button[B].H := (0.5 + Power(cos(Angle), 1.7))/1.5 * Theme.Song.Cover.H; //Cover High + Width - Button[B].W := Button[B].H; - - {if (X < 0) then - Diff := Theme.Song.Cover.H - Button[B].H - else - Diff := 0; - - if (((CatSongs.VisibleIndex(B) - SongCurrent)>= -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent) <= 3)) OR (((CatSongs.VisibleIndex(B) - SongCurrent)>= -3 + VS) AND ((CatSongs.VisibleIndex(B) - SongCurrent) <= 3 + VS)) OR (((CatSongs.VisibleIndex(B) - SongCurrent)>= -3 - VS) AND ((CatSongs.VisibleIndex(B) - SongCurrent) <= 3 - VS)) then - Button[B].X := Theme.Song.Cover.X + diff + margin(CatSongs.VisibleIndex(B), SongCurrent, VS)* 30 - else - Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X + diff;}{ + end; - Diff := (Button[B].H - Theme.Song.Cover.H)/2; + //Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field + Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); - if X < 0 then - Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.W) * -Power(-X, 1/2) - diff - else - Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.W) * Power(X, 1/2) - diff;} end; end; end; -- cgit v1.2.3 From 2bcebe90daa1865f1bc335d1f2fc2ca31637bc59 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 25 Mar 2007 11:24:07 +0000 Subject: Some Code Cleanup git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@33 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 1d632073..e9aa2141 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -780,6 +780,15 @@ begin Song.Equalizer.Bands := ThemeIni.ReadInteger('SongEqualizer', 'Bands', 5); Song.Equalizer.Length := ThemeIni.ReadInteger('SongEqualizer', 'Length', 12); + //Color + I := ColorExists(ThemeIni.ReadString('SongEqualizer', 'Color', 'Black')); + if I >= 0 then begin + Song.Equalizer.ColR := Color[I].RGB.R; + Song.Equalizer.ColG := Color[I].RGB.G; + Song.Equalizer.ColB := Color[I].RGB.B; + end; + //Load Equalizer Pos and Size from Theme Mod End + //Party Mode ThemeLoadStatic(Song.StaticTeam1Joker1, 'SongStaticTeam1Joker1'); ThemeLoadStatic(Song.StaticTeam1Joker2, 'SongStaticTeam1Joker2'); @@ -799,15 +808,6 @@ begin ThemeLoadStatic(Song.StaticTeam3Joker4, 'SongStaticTeam3Joker4'); ThemeLoadStatic(Song.StaticTeam3Joker5, 'SongStaticTeam3Joker5'); - //Color - I := ColorExists(ThemeIni.ReadString('SongEqualizer', 'Color', 'Black')); - if I >= 0 then begin - Song.Equalizer.ColR := Color[I].RGB.R; - Song.Equalizer.ColG := Color[I].RGB.G; - Song.Equalizer.ColB := Color[I].RGB.B; - end; - //Load Equalizer Pos and Size from Theme Mod End - // Sing ThemeLoadBasic(Sing, 'Sing'); -- cgit v1.2.3 From ccb5946db9ae26b5b40a171110e4a5fc595cb0bf Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 25 Mar 2007 15:20:46 +0000 Subject: Changed Music.SetVolume from Global Wave Volume to Application-Only BassConfig git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@35 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMusic.pas | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index db1675c5..f7f0e20d 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -342,7 +342,12 @@ end; procedure TMusic.SetVolume(Volume: integer); begin - BASS_SetVolume(Volume); + //Old Sets Wave Volume + //BASS_SetVolume(Volume); + //New: Sets Volume only for this Application + BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); end; procedure TMusic.SetLoop(Enabled: boolean); -- cgit v1.2.3 From e558c05847fc836ceecbfe9de67af36b84f2b367 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 25 Mar 2007 15:23:10 +0000 Subject: ScreenEditSub: Automatically set down music playback-volume to hear the Midi Sounds better. Also Show Note Names in Editor (e.g. c, d'', F#) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@36 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditSub.pas | 41 ++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 7bdbac0d..52cd0b26 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -55,6 +55,8 @@ type procedure PasteText; procedure CopySentence(Src, Dst: integer); procedure CopySentences(Src, Dst, Num: integer); + //Note Name Mod + function GetNoteName(Note: Integer): String; public Tex_Background: TTexture; FadeOut: boolean; @@ -1110,7 +1112,9 @@ begin Czesci[0].Czesc[0].Nuta[0].Color := 1; Music.Open(Path + AktSong.Mp3); - + //Set Down Music Volume for Better hearability of Midi Sounds + Music.SetVolume(40); + Lyric.Clear; Lyric.X := 400; Lyric.Y := 500; @@ -1207,7 +1211,7 @@ begin // Note info Text[TextNStart].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start); Text[TextNDlugosc].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); - Text[TextNTon].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton); + Text[TextNTon].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton) + ' ( ' + GetNoteName(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton) + ' )'; Text[TextNText].Text := Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst; // Text Edit Mode @@ -1231,6 +1235,39 @@ procedure TScreenEditSub.onHide; begin MidiOut.Close; MidiOut.Free; + Music.SetVolume(100); +end; + +function TScreenEditSub.GetNoteName(Note: Integer): String; +var N1, N2: Integer; +begin + N1 := Note mod 12; + N2 := Note div 12; + + case N1 of + 0: Result := 'c'; + 1: Result := 'c#'; + 2: Result := 'd'; + 3: Result := 'd#'; + 4: Result := 'e'; + 5: Result := 'f'; + 6: Result := 'f#'; + 7: Result := 'g'; + 8: Result := 'g#'; + 9: Result := 'a'; + 10: Result := 'b'; + 11: Result := 'h'; + end; + + case N2 of + 0: Result := UpperCase(Result); //Normal Uppercase Note, 1: Normal lowercase Note + 2: Result := Result + ''''; //One Striped + 3: Result := Result + ''''''; //Two Striped + 4: Result := Result + ''''''''; //etc. + 5: Result := Result + ''''''''''; + 6: Result := Result + ''''''''''''; + 7: Result := Result + ''''''''''''''; + end; end; end. -- cgit v1.2.3 From 158ee45acaa045b91e7614d756a353de00414f1f Mon Sep 17 00:00:00 2001 From: mogguh Date: Tue, 27 Mar 2007 01:55:29 +0000 Subject: Skin: Changed minor things that where too annoying (major crap) Icon: Added the first version of a new icon, hope it suits more than the last one Theme: Fixed problem with showing a button instead of a cd git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@38 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.RES | Bin 0 -> 192780 bytes Game/Code/UltraStar.rc | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 Game/Code/UltraStar.RES (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.RES b/Game/Code/UltraStar.RES new file mode 100644 index 00000000..bf1f3d01 Binary files /dev/null and b/Game/Code/UltraStar.RES differ diff --git a/Game/Code/UltraStar.rc b/Game/Code/UltraStar.rc index 9b095726..68d68e4b 100644 --- a/Game/Code/UltraStar.rc +++ b/Game/Code/UltraStar.rc @@ -10,4 +10,5 @@ FontO FNT "..\Fonts\Outline 1\Outline 36 (1024).dat" FontO2 PNG "..\Fonts\Outline 2\5 - Outline Dark Edited 16c.PNG" FontO2 FNT "..\Fonts\Outline 2\Outline.dat" -MAINICON ICON "..\Graphics\us.ico" \ No newline at end of file +MAINICON ICON "..\Graphics\ustar-icon_v01.ico" +//MAINICON ICON "..\Graphics\us.ico" \ No newline at end of file -- cgit v1.2.3 From 3ba33f8e920a9e9a3114f159e2b6fda4273a6efb Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 28 Mar 2007 13:08:41 +0000 Subject: Added Jumpto Ability to SongScreen (Press J) Fixed: Golden Notes are not shown in PartyMode git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@39 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphic.pas | 9 +- Game/Code/Classes/USongs.pas | 77 ++++++- Game/Code/Classes/UThemes.pas | 16 +- Game/Code/Screens/UScreenSing.pas | 9 +- Game/Code/Screens/UScreenSingModi.pas | 6 +- Game/Code/Screens/UScreenSong.pas | 371 ++++++++++++++-------------------- Game/Code/Screens/UScreenSongMenu.pas | 1 + Game/Code/UltraStar.dpr | 1 + 8 files changed, 248 insertions(+), 242 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 8238eace..d9831143 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -6,7 +6,7 @@ uses UScreenWelcome, UScreenMain, UScreenName, UScreenLevel, UScreenOptions, UScreenOptionsGame, UScreenOptionsGraphics, UScreenOptionsSound, UScreenOptionsLyrics, UScreenOptionsThemes, UScreenOptionsRecord, UScreenSong, UScreenSing, UScreenScore, UScreenTop5, UScreenEditSub, - UScreenEdit, UScreenEditConvert, UScreenEditHeader, UScreenOpen, UThemes, USkins, UScreenSongMenu, + UScreenEdit, UScreenEditConvert, UScreenEditHeader, UScreenOpen, UThemes, USkins, UScreenSongMenu, UScreenSongJumpto, {Party Screens} UScreenSingModi, UScreenPartyNewRound, UScreenPartyScore, UScreenPartyOptions, UScreenPartyWin, UScreenPartyPlayer; type @@ -51,6 +51,7 @@ var ScreenOpen: TScreenOpen; ScreenSongMenu: TScreenSongMenu; + ScreenSongJumpto: TScreenSongJumpto; //Party Screens ScreenSingModi: TScreenSingModi; @@ -390,9 +391,11 @@ begin ScreenOpen := TScreenOpen.Create(''); Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Open', 3); Log.BenchmarkStart(3); ScreenSingModi := TScreenSingModi.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongMenu', 3); Log.BenchmarkStart(3); - //ScreenSongMenu := TScreenSongMenu.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing with Modi support', 3); Log.BenchmarkStart(3); + ScreenSongMenu := TScreenSongMenu.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongMenu', 3); Log.BenchmarkStart(3); + ScreenSongJumpto := TScreenSongJumpto.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongJumpto', 3); Log.BenchmarkStart(3); ScreenPartyNewRound := TScreenPartyNewRound.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyNewRound', 3); Log.BenchmarkStart(3); ScreenPartyScore := TScreenPartyScore.Create; diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index c2532a03..5b75879d 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -82,6 +82,8 @@ type function FindNextVisible(SearchFrom:integer): integer; //Find Next visible Song function VisibleSongs: integer; // returns number of visible songs (for tabs) function VisibleIndex(Index: integer): integer; // returns visible song index (skips invisible) + + function SetFilter(FilterStr: String; const fType: Byte): Cardinal; end; var @@ -91,7 +93,7 @@ var implementation -uses UPliki, UIni, UFiles; +uses UPliki, UIni, UFiles, StrUtils; procedure TSongs.LoadSongList; begin @@ -572,12 +574,12 @@ var S: integer; // song begin CatNumShow := Index; - for S := 0 to high(CatSongs.Song) do begin - if CatSongs.Song[S].OrderNum = Index then + for S := 0 to high(CatSongs.Song) do + begin + if (CatSongs.Song[S].OrderNum = Index) AND (Not CatSongs.Song[S].Main) then CatSongs.Song[S].Visible := true else - if not CatSongs.Song[S].Main then - CatSongs.Song[S].Visible := false; + CatSongs.Song[S].Visible := false; end; end; @@ -599,12 +601,6 @@ begin if Num <> CatNumShow then begin ShowCategory(Num); - //Hide Categorys when in Category Hack - for S := low(CatSongs.Song) to high(CatSongs.Song) do begin - if CatSongs.Song[S].Main then //Hide all Cats - CatSongs.Song[S].Visible := false - end; - //Hide Categorys when in Category Hack End end else begin ShowCategoryList; @@ -664,4 +660,63 @@ begin if CatSongs.Song[S].Visible = true then Inc(Result); end; +function TCatSongs.SetFilter(FilterStr: String; const fType: Byte): Cardinal; +var + I, J: Integer; + cString: String; + SearchStr: Array of String; +begin + {fType: 0: All + 1: Title + 2: Artist} + if FilterStr<>'' then begin + Result := 0; + //Create Search Array + SetLength(SearchStr, 1); + I := Pos (' ', FilterStr); + While (I <> 0) do + begin + SetLength (SearchStr, Length(SearchStr) + 1); + cString := Copy(FilterStr, 1, I-1); + if (cString <> ' ') AND (cString <> '') then + SearchStr[High(SearchStr)-1] := cString; + Delete (FilterStr, 1, I); + + I := Pos (' ', FilterStr); + end; + //Copy last Word + if (FilterStr <> ' ') AND (FilterStr <> '') then + SearchStr[High(SearchStr)] := FilterStr; + + for I:=0 to High(Song) do begin + if not Song[i].Main then + begin + case fType of + 0: cString := Song[I].Artist + ' ' + Song[i].Title + ' ' + Song[i].Folder; + 1: cString := Song[I].Title; + 2: cString := Song[I].Artist; + end; + Song[i].Visible:=True; + //Look for every Searched Word + For J := 0 to High(SearchStr) do + begin + Song[i].Visible := Song[i].Visible AND AnsiContainsText(cString, SearchStr[J]) + end; + if Song[i].Visible then + Inc(Result); + end + else + Song[i].Visible:=False; + end; + CatNumShow := -2; + end + else begin + for i:=0 to High(Song) do begin + Song[i].Visible:=(Ini.Tabs=1)=Song[i].Main; + CatNumShow := -1; + end; + Result := 0; + end; +end; + end. diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index e9aa2141..e31e94d2 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -393,6 +393,12 @@ type TextMenu: TThemeText; end; + TThemeSongJumpTo = class(TThemeBasic) + ButtonSearchText: TThemeButton; + SelectSlideType: TThemeSelectSlide; + TextFound: TThemeText; + end; + //Party Screens TThemePartyNewRound = class(TThemeBasic) TextRound1: TThemeText; @@ -525,6 +531,7 @@ type OptionsRecord: TThemeOptionsRecord; //Menu SongMenu: TThemeSongMenu; + SongJumpto: TThemeSongJumpTo; //Party Screens: PartyNewRound: TThemePartyNewRound; PartyScore: TThemePartyScore; @@ -606,6 +613,7 @@ begin OptionsRecord := TThemeOptionsRecord.Create; SongMenu := TThemeSongMenu.Create; + SongJumpto := TThemeSongJumpto.Create; //Party Screens PartyNewRound := TThemePartyNewRound.Create; PartyWin := TThemePartyWin.Create; @@ -980,7 +988,7 @@ begin ThemeLoadSelectSlide(OptionsRecord.SelectSlideChannelR, 'OptionsRecordSelectSlideChannelR'); ThemeLoadButton(OptionsRecord.ButtonExit, 'OptionsRecordButtonExit'); - //Song Menu + //Song Menu ThemeLoadBasic (SongMenu, 'SongMenu'); ThemeLoadButton(SongMenu.Button1, 'SongMenuButton1'); ThemeLoadButton(SongMenu.Button2, 'SongMenuButton2'); @@ -990,6 +998,12 @@ begin ThemeLoadText(SongMenu.TextMenu, 'SongMenuTextMenu'); + //Song Jumpto + ThemeLoadBasic (SongJumpto, 'SongJumpto'); + ThemeLoadButton(SongJumpto.ButtonSearchText, 'SongJumptoButtonSearchText'); + ThemeLoadSelectSlide(SongJumpto.SelectSlideType, 'SongJumptoSelectSlideType'); + ThemeLoadText(SongJumpto.TextFound, 'SongJumptoTextFound'); + //Party Screens: //Party NewRound ThemeLoadBasic(PartyNewRound, 'PartyNewRound'); diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index f6ec6224..7b96e273 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -636,10 +636,6 @@ begin // prepare timer (II) CountSkipTimeSet; - -//GoldenStarsTwinkle Mod - GoldenRec.KillAll; -//GoldenStarsTwinkle Mod End end; function TScreenSing.Draw: boolean; @@ -1016,6 +1012,11 @@ begin Music.CaptureStop; Music.Stop; + //Kill all Stars not Killed yet + //GoldenStarsTwinkle Mod + GoldenRec.KillAll; + //GoldenStarsTwinkle Mod End + if Ini.SavePlayback = 1 then begin Log.BenchmarkStart(0); Log.LogVoice(0); diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index ec47dc60..bf342e7a 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -63,7 +63,7 @@ procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sou function ToSentences(Const Czeski: TCzesci): TSentences; implementation -uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math, UDLLManager, USkins; +uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math, UDLLManager, USkins, UGraphicClasses; // Method for input parsing. If False is returned, GetNextWindow // should be checked to know the next window to load; @@ -967,6 +967,10 @@ end; // draw custom items SingModiDraw(PlayerInfo); // always draw + //GoldenNoteStarsTwinkle Mod + GoldenRec.SpawnRec; + //GoldenNoteStarsTwinkle Mod + //Update PlayerInfo for I := 0 to PlayerInfo.NumPlayers-1 do begin diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index cd412ceb..69ec8639 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -69,7 +69,8 @@ type procedure SkipTo(Target: integer); procedure FixSelected; //Show Wrong Song when Tabs on Fix procedure FixSelected2; //Show Wrong Song when Tabs on Fix - procedure ShowCatTL(Cat: Integer);// Show Cat in Tob left + procedure ShowCatTL(Cat: Integer);// Show Cat in Top left + procedure ShowCatTLCustom(Caption: String);// Show Custom Text in Top left procedure HideCatTL;// Show Cat in Tob left procedure Refresh; //Refresh Song Sorting procedure DrawEqualizer; @@ -81,6 +82,9 @@ type procedure StartSong; procedure OpenEditor; procedure DoJoker(Team: Byte); + + //Extensions + procedure DrawExtensions; end; implementation @@ -92,37 +96,50 @@ uses UGraphic, UMain, UCovers, math, OpenGL12, Windows, USkins, UDLLManager, UPa procedure TScreenSong.FixSelected; var I, I2: Integer; begin - I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do + if CatSongs.VisibleSongs > 0 then begin - if CatSongs.Song[I].Visible then - inc(I2); + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); - if I = Interaction - 1 then - break; - end; + if I = Interaction - 1 then + break; + end; - SongCurrent := I2; - SongTarget := I2; + SongCurrent := I2; + SongTarget := I2; + end; end; procedure TScreenSong.FixSelected2; var I, I2: Integer; begin - I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do + if CatSongs.VisibleSongs > 0 then begin - if CatSongs.Song[I].Visible then - inc(I2); + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); - if I = Interaction - 1 then - break; - end; + if I = Interaction - 1 then + break; + end; - SongTarget := I2; + SongTarget := I2; + end; end; //Show Wrong Song when Tabs on Fix End + procedure TScreenSong.ShowCatTLCustom(Caption: String);// Show Custom Text in Top left + begin + Text[TextCat].Text := Caption; + Text[TextCat].Visible := true; + Static[StaticCat].Visible := False; + end; + //Show Cat in Top Left Mod procedure TScreenSong.ShowCatTL(Cat: Integer); begin @@ -162,164 +179,24 @@ var begin Result := true; - //Song Menu + //Song Screen Extensions (Jumpto + Menu) if (ScreenSongMenu.Visible) then begin Result := ScreenSongMenu.ParseInput(PressedKey, ScanCode, PressedDown); Exit; + end + else if (ScreenSongJumpto.Visible) then + begin + Result := ScreenSongJumpto.ParseInput(PressedKey, ScanCode, PressedDown); + Exit; end; If (PressedDown) Then begin // Key Down -// HS := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT); -{ if (not HighSpeed) and (HS > 0) then begin - HighSpeed := true; - SDL_EnableKeyRepeat(50, 50); - end; - if (HighSpeed) and (HS = 0) then begin - HighSpeed := false; - SDL_EnableKeyRepeat(125, 125); - end;} - - SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); - // Jump to Key Mod - if (SDL_ModState = KMOD_LALT) AND (Mode = 0) then //Jump to Key - begin - //get Letter - case PressedKey of - SDLK_A : Letter := 'A'; - SDLK_B : Letter := 'B'; - SDLK_C : Letter := 'C'; - SDLK_D : Letter := 'D'; - SDLK_E : Letter := 'E'; - SDLK_F : Letter := 'F'; - SDLK_G : Letter := 'G'; - SDLK_H : Letter := 'H'; - SDLK_I : Letter := 'I'; - SDLK_J : Letter := 'J'; - SDLK_K : Letter := 'K'; - SDLK_L : Letter := 'L'; - SDLK_M : Letter := 'M'; - SDLK_N : Letter := 'N'; - SDLK_O : Letter := 'O'; - SDLK_P : Letter := 'P'; - SDLK_Q : Letter := 'Q'; - SDLK_R : Letter := 'R'; - SDLK_S : Letter := 'S'; - SDLK_T : Letter := 'T'; - SDLK_U : Letter := 'U'; - SDLK_V : Letter := 'V'; - SDLK_W : Letter := 'W'; - SDLK_X : Letter := 'X'; - SDLK_Y : Letter := 'Y'; - SDLK_Z : Letter := 'Z'; - SDLK_1 : Letter := '1'; - SDLK_2 : Letter := '2'; - SDLK_3 : Letter := '3'; - SDLK_4 : Letter := '4'; - SDLK_5 : Letter := '5'; - SDLK_6 : Letter := '6'; - SDLK_7 : Letter := '7'; - SDLK_8 : Letter := '8'; - SDLK_9 : Letter := '9'; - SDLK_0 : Letter := '0'; - else exit; - end; - - {//Search Letter - for I := Interaction + 1 to high(CatSongs.Song) do - begin - if CatSongs.Song[I].Visible and (Letter = Uppercase(CatSongs.Song[I].Artist)[1]) then - break; //Found Song - if I = Interaction then //went through complete array but nothing Found - break; - if I = high(CatSongs.Song) then //At the end of the array->Go to beginning - for I2 := low(CatSongs.Song) to Interaction do - if CatSongs.Song[I].Visible and (Letter = Uppercase(CatSongs.Song[I].Artist)[1]) then - break; //Found Song - end; } - - for I := 0 to High(CatSongs.Song) do begin - if (CatSongs.Song[I].Visible) AND (UpperCase(CatSongs.Song[I].Artist[1]) = Letter) then - begin - //Select Song - Interaction := I; - SkipTo(Interaction); - break; - end; - end; - - //Don't do other Functions - exit; - end; - - if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then //Jump to Key - begin - //get Letter - case PressedKey of - SDLK_a..SDLK_z : Letter := Chr(Ord('a')+PressedKey-97); - SDLK_1 : Letter := '1'; - SDLK_2 : Letter := '2'; - SDLK_3 : Letter := '3'; - SDLK_4 : Letter := '4'; - SDLK_5 : Letter := '5'; - SDLK_6 : Letter := '6'; - SDLK_7 : Letter := '7'; - SDLK_8 : Letter := '8'; - SDLK_9 : Letter := '9'; - SDLK_0 : Letter := '0'; - else exit; - end; - - {//Search Letter - for I := Interaction + 1 to high(CatSongs.Song) do - begin - if CatSongs.Song[I].Visible and (Letter = Uppercase(CatSongs.Song[I].Artist)[1]) then - break; //Found Song - if I = Interaction then //went through complete array but nothing Found - break; - if I = high(CatSongs.Song) then //At the end of the array->Go to beginning - for I2 := low(CatSongs.Song) to Interaction do - if CatSongs.Song[I].Visible and (Letter = Uppercase(CatSongs.Song[I].Artist)[1]) then - break; //Found Song - end; } - - {for I := 0 to High(CatSongs.Song) do begin - if (CatSongs.Song[I].Visible) AND (UpperCase(CatSongs.Song[I].Artist[1]) = Letter) then} - - for I := Interaction + 1 to high(CatSongs.Song) + 1 do - begin - if (I > high(CatSongs.Song)) then - begin - for I2 := low(CatSongs.Song) to Interaction do - begin - if CatSongs.Song[I2].Visible and (Letter = lowercase(CatSongs.Song[I2].Artist[1])) then - begin - Interaction := I2; - break; //Found Song - end; - end; - break; - end - else if CatSongs.Song[I].Visible and (Letter = lowercase(CatSongs.Song[I].Artist[1])) then - begin - Interaction := I; - break; //Found Song - end; - end; - - - //Select Song - SkipTo(Interaction); - - //Don't do other Functions - exit; - end; - - case PressedKey of SDLK_ESCAPE : begin @@ -406,7 +283,6 @@ begin end else if (Mode = 1) then //PartyMode -> Show Menu begin - ScreenSongMenu.Visible := True; ScreenSongMenu.MenuShow(SM_Party_Main); end; end; @@ -417,12 +293,19 @@ begin begin if Length(Songs.Song) > 0 then begin if not CatSongs.Song[Interaction].Main then begin // clicked on Song - ScreenSongMenu.Visible := True; ScreenSongMenu.MenuShow(SM_Main); end; end; end; + SDLK_J: //Show SongMenu + begin + if Length(Songs.Song) > 0 then + begin + ScreenSongJumpto.Visible := True; + end; + end; + SDLK_DOWN: begin if (Mode = 0) then @@ -788,25 +671,47 @@ begin end; procedure TScreenSong.SetScroll; +var + VS, B: Integer; begin -//Set Positions - Case Theme.Song.Cover.Style of - 3: SetScroll3; - 5: SetScroll5 - else SetScroll4; - end; -//Set Texts: - Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; - Text[TextTitle].Text := CatSongs.Song[Interaction].Title; - if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then + VS := CatSongs.VisibleSongs; + if VS > 0 then begin - Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); - Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; + //Set Positions + Case Theme.Song.Cover.Style of + 3: SetScroll3; + 5:begin + if VS > 5 then + SetScroll5 + else + SetScroll4; + end; + else SetScroll4; + end; + //Set Texts: + Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; + Text[TextTitle].Text := CatSongs.Song[Interaction].Title; + if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then + begin + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); + Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; + end + else if (CatSongs.CatNumShow = -2) then + Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) + else if (Ini.Tabs_at_startup = 1) then + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) + else + Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); end - else if (Ini.Tabs_at_startup = 1) then - Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) else - Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); + begin + Text[TextNumber].Text := '0/0'; + Text[TextArtist].Text := ''; + Text[TextTitle].Text := ''; + for B := 0 to High(Button) do + Button[B].Visible := False; + + end; end; procedure TScreenSong.SetScroll1; @@ -1023,7 +928,7 @@ begin Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - Z := (1 + cos(Wsp)) / 2 - 0.02; + Z := (1 + cos(Wsp)) / 2 - 0.2; Z2 := (1 + 2*Z) / 3; Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.W + 0.185 * Theme.Song.Cover.H * VS * sin(Wsp) - Theme.Song.Cover.X) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs @@ -1247,6 +1152,19 @@ begin SetJoker; end; +procedure TScreenSong.DrawExtensions; +begin + //Draw Song Menu + if (ScreenSongMenu.Visible) then + begin + ScreenSongMenu.Draw; + end + else if (ScreenSongJumpto.Visible) then + begin + ScreenSongJumpto.Draw; + end +end; + function TScreenSong.Draw: boolean; var dx: real; @@ -1286,71 +1204,80 @@ begin if Theme.Song.Equalizer.Visible then DrawEqualizer; - //Draw Song Menu - if (ScreenSongMenu.Visible) then - begin - ScreenSongMenu.Draw; - end; + DrawExtensions; end; procedure TScreenSong.SelectNext; var Skip: integer; I: integer; + VS: Integer; begin - CoverTime := 0; - Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture - Button[Interaction].Texture2.Alpha := 0; + VS := CatSongs.VisibleSongs; - //0.5.0: unload old full size texture - if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then - Texture.UnloadTexture(Button[Interaction].Texture.Name, false); + if VS > 0 then + begin + CoverTime := 0; + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture + Button[Interaction].Texture2.Alpha := 0; - Skip := 1; + //0.5.0: unload old full size texture + if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then + Texture.UnloadTexture(Button[Interaction].Texture.Name, false); - // this 1 could be changed by CatSongs.FindNextVisible - while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); - SongTarget := SongTarget + 1;//Skip; + Skip := 1; - Interaction := (Interaction + Skip) mod Length(Interactions); + // this 1 could be changed by CatSongs.FindNextVisible + while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); - // try to keep all at the beginning - if SongTarget > CatSongs.VisibleSongs-1 then begin - SongTarget := SongTarget - CatSongs.VisibleSongs; - SongCurrent := SongCurrent - CatSongs.VisibleSongs; - end; + SongTarget := SongTarget + 1;//Skip; - // Interaction -> Button, ktorego okladke przeczytamy -// Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture + Interaction := (Interaction + Skip) mod Length(Interactions); + + // try to keep all at the beginning + if SongTarget > VS-1 then begin + SongTarget := SongTarget - VS; + SongCurrent := SongCurrent - VS; + end; + + end; + // Interaction -> Button, ktorego okladke przeczytamy + // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture end; procedure TScreenSong.SelectPrev; var Skip: integer; I: integer; + VS: Integer; begin - CoverTime := 0; - Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture - Button[Interaction].Texture2.Alpha := 0; + VS := CatSongs.VisibleSongs; - //0.5.0: unload old full size texture - if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then - Texture.UnloadTexture(Button[Interaction].Texture.Name, false); + if VS > 0 then + begin + CoverTime := 0; + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture + Button[Interaction].Texture2.Alpha := 0; - Skip := 1; + //0.5.0: unload old full size texture + if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then + Texture.UnloadTexture(Button[Interaction].Texture.Name, false); - while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); - SongTarget := SongTarget - 1;//Skip; + Skip := 1; - Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); + while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); + SongTarget := SongTarget - 1;//Skip; - // try to keep all at the beginning - if SongTarget < 0 then begin - SongTarget := SongTarget + CatSongs.VisibleSongs; - SongCurrent := SongCurrent + CatSongs.VisibleSongs; - end; + Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); -// Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture + // try to keep all at the beginning + if SongTarget < 0 then begin + SongTarget := SongTarget + CatSongs.VisibleSongs; + SongCurrent := SongCurrent + CatSongs.VisibleSongs; + end; + + // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture + end; end; procedure TScreenSong.UpdateLCD; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 2a03a7c2..a5ae2083 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -165,6 +165,7 @@ end; procedure TScreenSongMenu.MenuShow(sMenu: Byte); begin Interaction := 0; //Reset Interaction + Visible := True; //Set Visible Case sMenu of SM_Main: begin diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 9b73883a..65a01257 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -75,6 +75,7 @@ uses UScreenOpen in 'Screens\UScreenOpen.pas', UScreenTop5 in 'Screens\UScreenTop5.pas', UScreenSongMenu in 'Screens\UScreenSongMenu.pas', + UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', //------------------------------ //Includes - Screens PartyMode -- cgit v1.2.3 From 5e798a4d262532bf5f06f06678961bafacf86aac Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 28 Mar 2007 13:11:12 +0000 Subject: =?UTF-8?q?Datei=20/=20Ordner=20gel=C3=B6scht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@40 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.RES | Bin 192780 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 Game/Code/UltraStar.RES (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.RES b/Game/Code/UltraStar.RES deleted file mode 100644 index bf1f3d01..00000000 Binary files a/Game/Code/UltraStar.RES and /dev/null differ -- cgit v1.2.3 From 2bc1fdaec54eca194f6873589334cf0b649536d4 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 28 Mar 2007 19:01:01 +0000 Subject: Add Jumpto Screen to ThemeAdded Jumpto Ability to SongScreen (Press J) Fixed: Golden Notes are not shown in PartyMode git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@44 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSongJumpto.pas | 194 ++++++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 Game/Code/Screens/UScreenSongJumpto.pas (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas new file mode 100644 index 00000000..449141c3 --- /dev/null +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -0,0 +1,194 @@ +unit UScreenSongJumpto; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + +type + TScreenSongJumpto = class(TMenu) + private + Songsfound: String; + NoSongsfound: String; + CatText: String; + public + Visible: Boolean; //Whether the Menu should be Drawn + VisSongs: Integer; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + function Draw: boolean; override; + + procedure SetTextFound(const Count: Cardinal); + end; + +var + IType: Array [0..2] of String; + SelectType: Integer; + + +implementation + +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, USongs, UScreenSong; + +function TScreenSongJumpto.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; + function IsVisible: Boolean; + begin + Result := True; + if (Interactions[Interaction].Typ = 0) then + begin + Result := Button[Interactions[Interaction].Num].Visible; + end + else if (Interactions[Interaction].Typ = 1) then + begin + //Result := Selects[Interactions[Interaction].Num].Visible; + end + else if (Interactions[Interaction].Typ = 3) then + begin + Result := SelectsS[Interactions[Interaction].Num].Visible; + end; + end; + + Procedure SelectNext; + begin + repeat + InteractNext; + until IsVisible; + end; + + Procedure SelectPrev; + begin + repeat + InteractPrev; + until IsVisible; + end; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_0..SDLK_9, SDLK_A..SDLK_Z, SDLK_SPACE, SDLK_MINUS, SDLK_EXCLAIM, SDLK_COMMA, SDLK_SLASH, SDLK_ASTERISK, SDLK_QUESTION, SDLK_QUOTE, SDLK_QUOTEDBL: + begin + if Interaction = 0 then + begin + Button[0].Text[0].Text := Button[0].Text[0].Text + chr(ScanCode); + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + end; + end; + + SDLK_BACKSPACE: + begin + if Interaction = 0 then + begin + Delete(Button[0].Text[0].Text, + Length(Button[0].Text[0].Text), 1); + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + end; + end; + + SDLK_ESCAPE : + begin + Music.PlayBack; + Visible := False; + if VisSongs = 0 then + CatSongs.SetFilter('', 0); + end; + + SDLK_RETURN: + begin + Visible := False; + Music.PlayBack; + if VisSongs = 0 then + CatSongs.SetFilter('', 0); + end; + + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN: SelectNext; + SDLK_UP: SelectPrev; + + SDLK_RIGHT: + begin + if (Interaction=1) then + InteractInc; + end; + SDLK_LEFT: + begin + if (Interaction=1) then + InteractDec; + end; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN : + begin + end; + end; +end; + +constructor TScreenSongJumpto.Create; +var + I: integer; +begin + inherited Create; + //Translate Texts //TODO: Port to UTheme (Linebonus and PartyScreens, too + IType[0] := Language.Translate('SONG_JUMPTO_TYPE1'); + IType[1] := Language.Translate('SONG_JUMPTO_TYPE2'); + IType[2] := Language.Translate('SONG_JUMPTO_TYPE3'); + SongsFound := Language.Translate('SONG_JUMPTO_SONGSFOUND'); + NoSongsFound := Language.Translate('SONG_JUMPTO_NOSONGSFOUND'); + CatText := Language.Translate('SONG_JUMPTO_CATTEXT'); + + AddBackground(Theme.SongJumpto.Background.Tex); + + AddButton(Theme.SongJumpto.ButtonSearchText); + if (Length(Button[0].Text) = 0) then + AddButtonText(14, 20, ''); + + SelectType := 0; + AddSelectSlide(Theme.SongJumpto.SelectSlideType, SelectType, IType); + + AddText(Theme.SongJumpto.TextFound); + + for I := 0 to High(Theme.SongJumpto.Static) do + AddStatic(Theme.SongJumpto.Static[I]); + + for I := 0 to High(Theme.SongJumpto.Text) do + AddText(Theme.SongJumpto.Text[I]); + + Interaction := 0; +end; + +procedure TScreenSongJumpto.onShow; +begin + Interaction := 0; + SetTextFound(0); +end; + +function TScreenSongJumpto.Draw: boolean; +begin + Result := inherited Draw; +end; + +procedure TScreenSongJumpto.SetTextFound(const Count: Cardinal); +begin + if (Count = 0) then + Text[0].Text := NoSongsFound + else + Text[0].Text := Format(SongsFound, [Count]); + + //Set CatTopLeftText + ScreenSong.ShowCatTLCustom(Format(CatText, [Button[0].Text[0].Text])); + + //visSongs setzen + VisSongs := Count; + + //Fix SongSelection + ScreenSong.Interaction := 0; + ScreenSong.SelectNext; + ScreenSong.FixSelected; +end; + +end. -- cgit v1.2.3 From 8d591b8344e0cb87e1a987961b3790fa26d323a6 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 29 Mar 2007 12:40:11 +0000 Subject: Fixed Some Bugs in JumpTo Screen: Now plays correct music Space Bug is gone Added onSentenceChange Procedure to ScreenSing git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@48 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMain.pas | 3 + Game/Code/Classes/USongs.pas | 1 + Game/Code/Screens/UScreenSing.pas | 116 +++++++++++++++++--------------- Game/Code/Screens/UScreenSong.pas | 58 +++++++--------- Game/Code/Screens/UScreenSongJumpto.pas | 41 ++++++++++- 5 files changed, 127 insertions(+), 92 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 3ef65e1d..f92b9457 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -387,6 +387,9 @@ begin end; Sender.UpdateLCD; + + //On Sentence Change... + Sender.onSentenceChange(Czesci[0].Akt); end; procedure NewBeat(Sender: TScreenSing); diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 5b75879d..cc3c8b95 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -669,6 +669,7 @@ begin {fType: 0: All 1: Title 2: Artist} + FilterStr := Trim(FilterStr); if FilterStr<>'' then begin Result := 0; //Create Search Array diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 7b96e273..201b97fa 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -50,6 +50,8 @@ type //OnSentenceEnd for LineBonus + Singbar procedure onSentenceEnd(S: Cardinal); + //OnSentenceChange (for Golden Notes) + procedure onSentenceChange(S: Cardinal); end; implementation @@ -1055,73 +1057,73 @@ A: Real; B: integer; //Max Points for Notes begin -//Check for Empty Sentence -if (Czesci[0].Czesc[S].TotalNotes<=0) then - exit; + //Check for Empty Sentence + if (Czesci[0].Czesc[S].TotalNotes<=0) then + exit; -//Set Max Note Points -if (Ini.LineBonus > 0) then - B := 9000 -else - B := 10000; + //Set Max Note Points + if (Ini.LineBonus > 0) then + B := 9000 + else + B := 10000; -for I := 0 to High(Player) do begin - A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2; + for I := 0 to High(Player) do begin + A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2; - //SingBar Mod - If ({(Ini.Oscilloscope = 2) and }(Czesci[0].Czesc[S].TotalNotes>0)) then - begin - Player[I].ScorePercentTarget := Player[I].ScorePercentTarget + floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 40 - 26); - if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0; - if Player[I].ScorePercentTarget > 99 then Player[I].ScorePercentTarget := 99; + //SingBar Mod + If ({(Ini.Oscilloscope = 2) and }(Czesci[0].Czesc[S].TotalNotes>0)) then + begin + Player[I].ScorePercentTarget := Player[I].ScorePercentTarget + floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 40 - 26); + if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0; + if Player[I].ScorePercentTarget > 99 then Player[I].ScorePercentTarget := 99; //end Singbar Mod - end; + end; //PhrasenBonus - Line Bonus Mod - If (Ini.LineBonus > 0) then - begin - - //Generate Steps 0 to 8 - A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); - if A >= 8 then - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_PERFECT') - else if (A = 6) or (A = 7) then - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_BETTER') - else if A = 5 then - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_GOOD') - else if (A = 3) or (A = 4) then - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_NORMAL') - else if A = 2 then - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_BAD') - else - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_WORST'); - - //PhrasenBonus give Points - Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8); - Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10; - //Update Total Score - Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; - - //Color - Player[I].LineBonus_Color.B := 0; - Player[I].LineBonus_Color.R := (8-A)/8; - Player[I].LineBonus_Color.G := A/10; - - Player[I].LineBonus_PosX := Player[I].LineBonus_StartX; - Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; - Player[I].LineBonus_Alpha := 0.92; - Player[I].LineBonus_Visible := True; + If (Ini.LineBonus > 0) then + begin + + //Generate Steps 0 to 8 + A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); + if A >= 8 then + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_PERFECT') + else if (A = 6) or (A = 7) then + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_BETTER') + else if A = 5 then + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_GOOD') + else if (A = 3) or (A = 4) then + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_NORMAL') + else if A = 2 then + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_BAD') + else + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_WORST'); + + //PhrasenBonus give Points + Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8); + Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10; + //Update Total Score + Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; + + //Color + Player[I].LineBonus_Color.B := 0; + Player[I].LineBonus_Color.R := (8-A)/8; + Player[I].LineBonus_Color.G := A/10; + + Player[I].LineBonus_PosX := Player[I].LineBonus_StartX; + Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; + Player[I].LineBonus_Alpha := 0.92; + Player[I].LineBonus_Visible := True; - end; + end; -//Refresh LastScore -Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; + //Refresh LastScore + Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; -end; + end; //PhrasenBonus - Line Bonus Mod End// } //GoldenStarsTwinkle Mod @@ -1129,4 +1131,10 @@ end; //GoldenStarsTwinkle Mod End end; +//Called on Sentence Change S= New Current Sentence +procedure TScreenSing.onSentenceChange(S: Cardinal); +begin + //Dummy +end; + end. diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 69ec8639..9202717d 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -74,6 +74,7 @@ type procedure HideCatTL;// Show Cat in Tob left procedure Refresh; //Refresh Song Sorting procedure DrawEqualizer; + procedure ChangeMusic; //Party Mode procedure SelectRandomSong; procedure SetJoker; @@ -269,11 +270,7 @@ begin FixSelected; //Play Music: - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); - Music.Play; - end; + ChangeMusic; end else begin // clicked on song if (Mode = 0) then //Normal Mode -> Start Song @@ -342,11 +339,7 @@ begin //Play Music: Music.PlayChange; - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); - Music.Play; - end; + ChangeMusic; end; @@ -392,11 +385,7 @@ begin //Play Music: Music.PlayChange; - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); - Music.Play; - end; + ChangeMusic; end; @@ -412,11 +401,7 @@ begin SelectNext; // InteractNext; // SongTarget := Interaction; - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); - Music.Play; - end; + ChangeMusic; SetScroll4; UpdateLCD; Light.LightOne(1, 200); @@ -428,11 +413,7 @@ begin if (Length(Songs.Song) > 0)AND (Mode = 0) then begin Music.PlayChange; SelectPrev; - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); - Music.Play; - end; + ChangeMusic; SetScroll4; UpdateLCD; Light.LightOne(0, 200); @@ -514,11 +495,7 @@ begin end; Music.PlayChange; - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); - Music.Play; - end; + ChangeMusic; SetScroll4; UpdateLCD; end; @@ -1288,6 +1265,21 @@ begin LCD.WriteText(2, Text[TextTitle].Text); end; +//Procedure Change current played Preview +procedure TScreenSong.ChangeMusic; +begin + if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then + begin + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + Music.Play; + end; + end + else + Music.Stop; +end; + procedure TScreenSong.SkipTo(Target: integer); // 0.5.0 var Skip: integer; @@ -1447,11 +1439,7 @@ begin //Choose Song SkipTo(I2-I); - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); - Music.Play; - end; + ChangeMusic; end; procedure TScreenSong.SetJoker; diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 449141c3..2bf0cb5b 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -11,10 +11,20 @@ type Songsfound: String; NoSongsfound: String; CatText: String; + + //For ChangeMusic + LastPlayed: Integer; + VisibleBool: Boolean; public - Visible: Boolean; //Whether the Menu should be Drawn VisSongs: Integer; + constructor Create; override; + + //Visible //Whether the Menu should be Drawn + //Whether the Menu should be Drawn + procedure SetVisible(Value: Boolean); + property Visible: Boolean read VisibleBool write SetVisible; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; function Draw: boolean; override; @@ -159,12 +169,29 @@ begin AddText(Theme.SongJumpto.Text[I]); Interaction := 0; + LastPlayed := 0; +end; + +procedure TScreenSongJumpto.SetVisible(Value: Boolean); +begin +//If change from unvisible to Visible then OnShow + if (VisibleBool = False) AND (Value = True) then + OnShow; + + VisibleBool := Value; end; procedure TScreenSongJumpto.onShow; begin - Interaction := 0; - SetTextFound(0); + //Reset Screen if no Old Search is Displayed + if (CatSongs.CatNumShow <> -2) then + begin + Interaction := 0; + SelectType := 0; + + Button[0].Text[0].Text := ''; + Text[0].Text := NoSongsFound; + end; end; function TScreenSongJumpto.Draw: boolean; @@ -189,6 +216,14 @@ begin ScreenSong.Interaction := 0; ScreenSong.SelectNext; ScreenSong.FixSelected; + + //Play Correct Music + if (ScreenSong.Interaction <> LastPlayed) then + begin + LastPlayed := ScreenSong.Interaction; + + ScreenSong.ChangeMusic; + end; end; end. -- cgit v1.2.3 From e0e16a3b1d28cf51fecf669d42465cf2a65728f3 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 29 Mar 2007 16:54:52 +0000 Subject: Added SBGW to TSelectSlide: Defining the Width of the Selections BG Added W to TText + Pagebreaks. If Width is given the Text breaks at the given width. Breaks are not generated perfect yet, needs some tuning. Changed all affected Screens to fit the new TText Component git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@49 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 7 ++ Game/Code/Menu/UMenu.pas | 20 +++-- Game/Code/Menu/UMenuSelectSlide.pas | 7 +- Game/Code/Menu/UMenuText.pas | 141 +++++++++++++++++++++++++++---- Game/Code/Screens/UScreenEditHeader.pas | 2 +- Game/Code/Screens/UScreenName.pas | 3 +- Game/Code/Screens/UScreenOpen.pas | 6 +- Game/Code/Screens/UScreenPartyPlayer.pas | 3 +- Game/Code/Screens/UScreenSing.pas | 12 +-- Game/Code/Screens/UScreenSongJumpto.pas | 9 +- 10 files changed, 167 insertions(+), 43 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index e31e94d2..a62c5aed 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -97,6 +97,7 @@ type TThemeText = record X: integer; Y: integer; + W: integer; Color: string; ColR: real; ColG: real; @@ -156,6 +157,10 @@ type Y: integer; W: integer; H: integer; + + //SBGW Mod + SBGW: integer; + Text: string; ColR, ColG, ColB, Int: real; DColR, DColG, DColB, DInt: real; @@ -1142,6 +1147,7 @@ begin DecimalSeparator := '.'; ThemeText.X := ThemeIni.ReadInteger(Name, 'X', 0); ThemeText.Y := ThemeIni.ReadInteger(Name, 'Y', 0); + ThemeText.W := ThemeIni.ReadInteger(Name, 'W', 0); ThemeText.ColR := ThemeIni.ReadFloat(Name, 'ColR', 0); ThemeText.ColG := ThemeIni.ReadFloat(Name, 'ColG', 0); @@ -1343,6 +1349,7 @@ begin ThemeSelectS.H := ThemeIni.ReadInteger(Name, 'H', 0); ThemeSelectS.SkipX := ThemeIni.ReadInteger(Name, 'SkipX', 0); + ThemeSelectS.SBGW := ThemeIni.ReadInteger(Name, 'SBGW', 450); LoadColor(ThemeSelectS.ColR, ThemeSelectS.ColG, ThemeSelectS.ColB, ThemeIni.ReadString(Name, 'Color', '')); ThemeSelectS.Int := ThemeIni.ReadFloat(Name, 'Int', 1); diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 7c256b5c..bf823b16 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -56,7 +56,7 @@ type function AddText(ThemeText: TThemeText): integer; overload; function AddText(X, Y: real; Tekst: string): integer; overload; function AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; Tekst: string): integer; overload; - function AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; Tekst: string): integer; overload; + function AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; Tekst: string): integer; overload; // button function AddButton(ThemeButton: TThemeButton): integer; overload; @@ -82,7 +82,7 @@ type // select slide function AddSelectSlide(ThemeSelectS: TThemeSelectSlide; var Data: integer; Values: array of string): integer; overload; - function AddSelectSlide(X, Y, W, H, SkipX, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt, + function AddSelectSlide(X, Y, W, H, SkipX, SBGW, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt, TColR, TColG, TColB, TInt, TDColR, TDColG, TDColB, TDInt, SBGColR, SBGColG, SBGColB, SBGInt, SBGDColR, SBGDColG, SBGDColB, SBGDInt, STColR, STColG, STColB, STInt, STDColR, STDColG, STDColB, STDInt: real; @@ -320,7 +320,7 @@ end; function TMenu.AddText(ThemeText: TThemeText): integer; begin - Result := AddText(ThemeText.X, ThemeText.Y, ThemeText.Font, ThemeText.Size, + Result := AddText(ThemeText.X, ThemeText.Y, ThemeText.W, ThemeText.Font, ThemeText.Size, ThemeText.ColR, ThemeText.ColG, ThemeText.ColB, ThemeText.Align, ThemeText.Text); end; @@ -337,17 +337,17 @@ end; function TMenu.AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; Tekst: string): integer; begin - Result := AddText(X, Y, Style, Size, ColR, ColG, ColB, 0, Tekst); + Result := AddText(X, Y, 0, Style, Size, ColR, ColG, ColB, 0, Tekst); end; -function TMenu.AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; Tekst: string): integer; +function TMenu.AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; Tekst: string): integer; var TextNum: integer; begin // adds text TextNum := Length(Text); SetLength(Text, TextNum + 1); - Text[TextNum] := TText.Create(X, Y, Style, Size, ColR, ColG, ColB, Align, Tekst); + Text[TextNum] := TText.Create(X, Y, W, Style, Size, ColR, ColG, ColB, Align, Tekst); Result := TextNum; end; @@ -846,7 +846,7 @@ function TMenu.AddSelectSlide(ThemeSelectS: TThemeSelectSlide; var Data: integer var SO: integer; begin - Result := AddSelectSlide(ThemeSelectS.X, ThemeSelectS.Y, ThemeSelectS.W, ThemeSelectS.H, ThemeSelectS.SkipX, + Result := AddSelectSlide(ThemeSelectS.X, ThemeSelectS.Y, ThemeSelectS.W, ThemeSelectS.H, ThemeSelectS.SkipX, ThemeSelectS.SBGW, ThemeSelectS.ColR, ThemeSelectS.ColG, ThemeSelectS.ColB, ThemeSelectS.Int, ThemeSelectS.DColR, ThemeSelectS.DColG, ThemeSelectS.DColB, ThemeSelectS.DInt, ThemeSelectS.TColR, ThemeSelectS.TColG, ThemeSelectS.TColB, ThemeSelectS.TInt, @@ -867,7 +867,7 @@ begin SelectsS[High(SelectsS)].SelectedOption := SelectsS[High(SelectsS)].SelectOptInt; // refresh end; -function TMenu.AddSelectSlide(X, Y, W, H, SkipX, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt, +function TMenu.AddSelectSlide(X, Y, W, H, SkipX, SBGW, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt, TColR, TColG, TColB, TInt, TDColR, TDColG, TDColB, TDInt, SBGColR, SBGColG, SBGColB, SBGInt, SBGDColR, SBGDColG, SBGDColB, SBGDInt, STColR, STColG, STColB, STInt, STDColR, STDColG, STDColB, STDInt: real; @@ -886,6 +886,7 @@ begin SelectsS[S].Y := Y; SelectsS[S].W := W; SelectsS[S].H := H; + SelectsS[S].ColR := ColR; SelectsS[S].ColG := ColG; SelectsS[S].ColB := ColB; @@ -898,7 +899,8 @@ begin SelectsS[S].TextureSBG := Texture.GetTexture(SBGName, SBGTyp); SelectsS[S].TextureSBG.X := X + W + SkipX; SelectsS[S].TextureSBG.Y := Y; - SelectsS[S].TextureSBG.W := 450; + //SelectsS[S].TextureSBG.W := 450; + SelectsS[S].SBGW := SBGW; SelectsS[S].TextureSBG.H := H; SelectsS[S].SBGColR := SBGColR; SelectsS[S].SBGColG := SBGColG; diff --git a/Game/Code/Menu/UMenuSelectSlide.pas b/Game/Code/Menu/UMenuSelectSlide.pas index 7850cdf6..9885acc0 100644 --- a/Game/Code/Menu/UMenuSelectSlide.pas +++ b/Game/Code/Menu/UMenuSelectSlide.pas @@ -81,6 +81,8 @@ type // property W2: real read Texture2.w write Texture2.w; // property H2: real read Texture2.h write Texture2.h; + property SBGW: real read TextureSBG.w write TextureSBG.w; + // procedures procedure SetSelect(Value: boolean); property Selected: Boolean read SelectBool write SetSelect; @@ -104,6 +106,9 @@ begin SetLength(TextOpt, 1); TextOpt[0] := TText.Create; + //Set Standard Width for Selections Background + SBGW := 450; + Visible := True; {SetLength(TextOpt, 3); TextOpt[0] := TText.Create; @@ -326,7 +331,7 @@ begin TextOpt[I].Y := TextureSBG.Y + 20; //Better Look with 2 Options - if (Lines=2) then + if (Lines=2) AND (Length(TextOptT)= 2) then TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W -40 - glTextWidth(PChar(TextOptT[1]))) * I; end; //TextOpt[I] := TextOpt[0]; diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas index 5c435a18..4a5356d8 100644 --- a/Game/Code/Menu/UMenuText.pas +++ b/Game/Code/Menu/UMenuText.pas @@ -7,13 +7,14 @@ type TText = class private SelectBool: boolean; + TextString: String; + TextTiles: Array of String; public X: real; Y: real; -// W: real; // if text is wider than W then it is streched (not yet implemented) + W: real; // if text is wider than W then it is breaked // H: real; Size: real; - Text: string; ColR: real; ColG: real; ColB: real; @@ -25,43 +26,146 @@ type procedure SetSelect(Value: Boolean); property Selected: Boolean read SelectBool write SetSelect; + procedure SetText(Value: String); + property Text: String read TextString write SetText; + + procedure DeleteLastL; //Procedure to Delete Last Letter + procedure Draw; constructor Create; overload; constructor Create(X, Y: real; Tekst: string); overload; - constructor Create(ParX, ParY: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; ParTekst: string); overload; + constructor Create(ParX, ParY, ParW: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; ParTekst: string); overload; end; implementation -uses UGraphic; +uses UGraphic, StrUtils; procedure TText.SetSelect(Value: Boolean); begin SelectBool := Value; end; +procedure TText.SetText(Value: String); +var + I: Integer; + L: Integer; + LastPos: Integer; + LastBreak: Integer; +begin + TextString := Value; + + if (W > 0) then + begin + //Set Font Propertys + SetFontStyle(Style); + SetFontSize(Size); + + //Create New TextTiles Array + SetLength (TextTiles, 0); + L := 0; + + LastPos := 1; + LastBreak := 0; + I := Pos (' ', Value); + While (I <> 0) do + begin + if (glTextWidth(PChar(Copy (Value,LastBreak + 1,I))) > W) AND (LastPos <> 1) then + begin + //new Break + SetLength (TextTiles, L+1); + TextTiles[L] := Copy (Value, LastBreak + 1, LastPos - LastBreak); + + Inc(L); + LastBreak := LastPos; + end; + + LastPos := I; + I := PosEx (' ', Value, I+1); + end; + + //Last Break + if (glTextWidth(PChar(Copy (Value,LastBreak + 1,Length(Value) - LastBreak))) > W) AND (LastPos <> 1) then + begin + //new Break + SetLength (TextTiles, L+1); + TextTiles[L] := Copy (Value, LastBreak + 1, LastPos - LastBreak); + + Inc(L); + LastBreak := LastPos; + end; + + //last Part + SetLength (TextTiles, L+1); + TextTiles[L] := Copy (Value, LastBreak + 1, Length(Value) - LastBreak); + + end; +end; + +Procedure TText.DeleteLastL; +var + S: String; + L: Integer; +begin + S := TextString; + L := Length(S); + if (L > 0) then + SetLength(S, L-1); + + SetText(S); +end; + procedure TText.Draw; var - X2: real; + X2, Y2: real; Text2: string; + I: Integer; begin if Visible then begin SetFontStyle(Style); SetFontSize(Size); + SetFontItalic(False); glColor3f(ColR*Int, ColG*Int, ColB*Int); - if not SelectBool then - Text2 := Text + if (W <= 0) then //No Width set Draw as one Long String + begin + if not SelectBool then + Text2 := Text + else + Text2 := Text + '|'; + + case Align of + 0: X2 := X; + 1: X2 := X - glTextWidth(pchar(Text2))/2; + 2: X2 := X - glTextWidth(pchar(Text2)); + end; + + SetFontPos(X2, Y); + glPrint(PChar(Text2)); + SetFontStyle(0); // reset to default + end else - Text2 := Text + '|'; + begin //Draw Text as Many Strings + Y2 := Y; + for I := 0 to high(TextTiles) do + begin + if (not SelectBool) OR (I <> high(TextTiles)) then + Text2 := TextTiles[I] + else + Text2 := TextTiles[I] + '|'; - case Align of - 0: X2 := X; - 1: X2 := X - glTextWidth(pchar(Text2))/2; - 2: X2 := X - glTextWidth(pchar(Text2)); - end; + case Align of + 0: X2 := X; + 1: X2 := X - glTextWidth(pchar(Text2))/2; + 2: X2 := X - glTextWidth(pchar(Text2)); + end; - SetFontPos(X2, Y); - glPrint(PChar(Text2)); - SetFontStyle(0); // reset to default + SetFontPos(X2, Y2); + glPrint(PChar(Text2)); + + Y2 := Y2 + Size * 1.7; + end; + SetFontStyle(0); // reset to default + + end; end; end; @@ -72,14 +176,15 @@ end; constructor TText.Create(X, Y: real; Tekst: string); begin - Create(X, Y, 0, 10, 0, 0, 0, 0, Tekst); + Create(X, Y, 0, 0, 10, 0, 0, 0, 0, Tekst); end; -constructor TText.Create(ParX, ParY: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; ParTekst: string); +constructor TText.Create(ParX, ParY, ParW: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; ParTekst: string); begin inherited Create; X := ParX; Y := ParY; + W := ParW; Style := ParStyle; Size := ParSize; Text := ParTekst; diff --git a/Game/Code/Screens/UScreenEditHeader.pas b/Game/Code/Screens/UScreenEditHeader.pas index 65f39e44..a601555a 100644 --- a/Game/Code/Screens/UScreenEditHeader.pas +++ b/Game/Code/Screens/UScreenEditHeader.pas @@ -105,7 +105,7 @@ begin begin T := Interaction - 2 + TextTitle; if (Interaction >= 2) and (Interaction <= 13) and (Length(Text[T].Text) >= 1) then begin - Delete(Text[T].Text, Length(Text[T].Text), 1); + Text[T].DeleteLastL; SetRoundButtons; end; end; diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index 99f5d40a..82519e87 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -33,8 +33,7 @@ begin SDLK_BACKSPACE: begin - Delete(Button[Interaction].Text[0].Text, - Length(Button[Interaction].Text[0].Text), 1); + Button[Interaction].Text[0].DeleteLastL; end; SDLK_ESCAPE : diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index 723f299f..264f57a9 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -43,9 +43,9 @@ begin case PressedKey of 8: // del begin - if Interaction = 0 then - if Length(Text[TextN].Text) >= 1 then begin - Delete(Text[TextN].Text, Length(Text[TextN].Text), 1); + if Interaction = 0 then + begin + Text[TextN].DeleteLastL; FileName := Text[TextN].Text; end; end; diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index b954212a..4fc43013 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -63,8 +63,7 @@ begin SDLK_BACKSPACE: begin - Delete(Button[Interaction].Text[0].Text, - Length(Button[Interaction].Text[0].Text), 1); + Button[Interaction].Text[0].DeleteLastL; end; SDLK_ESCAPE : diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 201b97fa..ee4bedc8 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -369,6 +369,11 @@ begin //Deactivate Pause Paused := False; + //Kill all Stars not Killed yet + //GoldenStarsTwinkle Mod + GoldenRec.KillAll; + //GoldenStarsTwinkle Mod End + {Static[StaticP2R].Visible := V2R; Static[StaticP2RScoreBG].Visible := V2R; Text[TextP2R].Visible := V2R; @@ -1014,11 +1019,6 @@ begin Music.CaptureStop; Music.Stop; - //Kill all Stars not Killed yet - //GoldenStarsTwinkle Mod - GoldenRec.KillAll; - //GoldenStarsTwinkle Mod End - if Ini.SavePlayback = 1 then begin Log.BenchmarkStart(0); Log.LogVoice(0); @@ -1032,6 +1032,8 @@ begin CloseSmpeg; AktSong.VideoLoaded := false; // to prevent drawing closed video end; + + SetFontItalic (False); end; procedure TScreenSing.UpdateLCD; diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 2bf0cb5b..0ba61450 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -90,8 +90,7 @@ begin begin if Interaction = 0 then begin - Delete(Button[0].Text[0].Text, - Length(Button[0].Text[0].Text), 1); + Button[0].Text[0].DeleteLastL; SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); end; end; @@ -121,12 +120,18 @@ begin SDLK_RIGHT: begin if (Interaction=1) then + begin InteractInc; + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + end; end; SDLK_LEFT: begin if (Interaction=1) then + begin InteractDec; + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + end; end; end; end -- cgit v1.2.3 From 563375e18e4aeba0152a9761f1f84d66aaeb27d2 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 30 Mar 2007 12:19:08 +0000 Subject: Finished Code for Plugin Sound PlayBack Removed Debug Message from ULanguage git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@50 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/ULanguage.pas | 4 +--- Game/Code/Classes/UMusic.pas | 11 +++++++++-- Game/Code/Screens/UScreenSong.pas | 26 +++++++++++++++++++++++++- 3 files changed, 35 insertions(+), 6 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/ULanguage.pas b/Game/Code/Classes/ULanguage.pas index afdac87c..b911b90a 100644 --- a/Game/Code/Classes/ULanguage.pas +++ b/Game/Code/Classes/ULanguage.pas @@ -52,7 +52,7 @@ begin Implode_Glue2 := ' and '; if (Length(List) = 0) then //No Language Files Loaded -> Abort Loading - Log.CriticalError('Could not load any Language Files'); + Log.CriticalError('Could not load any Language File'); //Standard Language (If a Language File is Incomplete) //Then use English Language @@ -143,8 +143,6 @@ begin Result := Text; Text := Uppercase(Result); - Log.LogError('Text: "' + Text + '" L: ' + InttoStr(Length(Entry))); - //Const Mod for E := 0 to high(CEntry) do if Text = CEntry[E].ID then diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index f7f0e20d..0e4e4ddd 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -731,11 +731,18 @@ begin end; function TMusic.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; +var + L: Integer; begin if FileExists(Name) then begin Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadPlayerFromFile'); try hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); + //Add CustomSound + L := High(CustomSounds) + 1; + SetLength (CustomSounds, L + 1); + CustomSounds[L].Filename := Name; + CustomSounds[L].Handle := hStream; except Log.LogError('Failed to open using BASS', 'LoadPlayerFromFile'); end; @@ -762,7 +769,7 @@ var F: String; begin //Search for Sound in already loaded Sounds - F := UpperCase(FileName); + F := UpperCase(SoundPath + FileName); For I := 0 to High(CustomSounds) do begin if (UpperCase(CustomSounds[I].Filename) = F) then @@ -772,7 +779,7 @@ begin end; end; - if LoadSoundFromFile(S, Filename) then + if LoadSoundFromFile(S, SoundPath + Filename) then Result := High(CustomSounds) else Result := 0; diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 9202717d..694ecc39 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -149,7 +149,7 @@ var I, I2: Integer; //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover); //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); - Static[StaticCat].Texture := Texture.GetTexture(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover, 'Plain', true); + Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false); //Button[Cat]. //Cover @@ -198,6 +198,30 @@ begin SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + {//Jump To + if (SDL_ModState = KMOD_LALT) AND (PressedKey > SDLK_A) AND (PressedKey < SDLK_Z) then + begin + Letter := UpCase(Chr(ScanCode)); + Log.LogError(Letter); + I2 := Length(CatSongs.Song); + For I := 1 to high(CatSongs.Song) do + begin + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + + Music.PlayChange; + + ChangeMusic; + SetScroll4; + UpdateLCD; + //Break and Exit + Exit; + end; + end; + Exit; + end; } + case PressedKey of SDLK_ESCAPE : begin -- cgit v1.2.3 From 162c1ce5d4c68fc6784fd4a8f0b975b857505574 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 30 Mar 2007 19:17:23 +0000 Subject: Fixed a Bug that causes a wrong Category-Title is displayed in SongScreen after a Search without a result. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@55 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSongJumpto.pas | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 0ba61450..c2107507 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -114,8 +114,17 @@ begin // Up and Down could be done at the same time, // but I don't want to declare variables inside // functions like this one, called so many times - SDLK_DOWN: SelectNext; - SDLK_UP: SelectPrev; + SDLK_DOWN: + begin + SelectNext; + Button[0].Text[0].Selected := (Interaction = 0); + end; + + SDLK_UP: + begin + SelectPrev; + Button[0].Text[0].Selected := (Interaction = 0); + end; SDLK_RIGHT: begin @@ -191,12 +200,15 @@ begin //Reset Screen if no Old Search is Displayed if (CatSongs.CatNumShow <> -2) then begin - Interaction := 0; SelectType := 0; Button[0].Text[0].Text := ''; Text[0].Text := NoSongsFound; end; + + //Select Input + Interaction := 0; + Button[0].Text[0].Selected := True; end; function TScreenSongJumpto.Draw: boolean; @@ -207,14 +219,20 @@ end; procedure TScreenSongJumpto.SetTextFound(const Count: Cardinal); begin if (Count = 0) then - Text[0].Text := NoSongsFound + begin + Text[0].Text := NoSongsFound; + ScreenSong.HideCatTL; + end else + begin Text[0].Text := Format(SongsFound, [Count]); - //Set CatTopLeftText - ScreenSong.ShowCatTLCustom(Format(CatText, [Button[0].Text[0].Text])); + //Set CatTopLeftText + ScreenSong.ShowCatTLCustom(Format(CatText, [Button[0].Text[0].Text])); + end; + - //visSongs setzen + //Set visSongs VisSongs := Count; //Fix SongSelection -- cgit v1.2.3 From eb7df4c30c7e119ad56eb3ba8506ff3e3afce4a4 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 30 Mar 2007 19:18:27 +0000 Subject: Added Cursor Blink to TText git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@56 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UMenuText.pas | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas index 4a5356d8..4b8ea391 100644 --- a/Game/Code/Menu/UMenuText.pas +++ b/Game/Code/Menu/UMenuText.pas @@ -9,6 +9,9 @@ type SelectBool: boolean; TextString: String; TextTiles: Array of String; + + STicks: Cardinal; + SelectBlink: Boolean; public X: real; Y: real; @@ -38,11 +41,15 @@ type end; implementation -uses UGraphic, StrUtils; +uses UGraphic, StrUtils, Windows; procedure TText.SetSelect(Value: Boolean); begin SelectBool := Value; + + //Set Cursor Visible + SelectBlink := True; + STicks := GettickCount div 550; end; procedure TText.SetText(Value: String); @@ -99,6 +106,10 @@ begin TextTiles[L] := Copy (Value, LastBreak + 1, Length(Value) - LastBreak); end; + + //Set Cursor Visible + SelectBlink := True; + STicks := GettickCount div 550; end; Procedure TText.DeleteLastL; @@ -125,9 +136,21 @@ begin SetFontSize(Size); SetFontItalic(False); glColor3f(ColR*Int, ColG*Int, ColB*Int); + + //If Selected Set Blink... + if SelectBool then + begin + I := Gettickcount div 550; + if I <> STicks then + begin //Change Visability + STicks := I; + SelectBlink := Not SelectBlink; + end; + end; + if (W <= 0) then //No Width set Draw as one Long String begin - if not SelectBool then + if not (SelectBool AND SelectBlink) then Text2 := Text else Text2 := Text + '|'; @@ -147,7 +170,7 @@ begin Y2 := Y; for I := 0 to high(TextTiles) do begin - if (not SelectBool) OR (I <> high(TextTiles)) then + if (not (SelectBool AND SelectBlink)) OR (I <> high(TextTiles)) then Text2 := TextTiles[I] else Text2 := TextTiles[I] + '|'; -- cgit v1.2.3 From 42717e4611f758f137d86fd99e69bf9791d3a727 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 5 Apr 2007 12:50:05 +0000 Subject: Fixed: Not loading Button Texts from Ini Fixed: Exit Text in Option Screens not translated git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@57 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenOptions.pas | 21 ++++++++++++++------- Game/Code/Screens/UScreenOptionsGame.pas | 3 ++- Game/Code/Screens/UScreenOptionsGraphics.pas | 3 ++- Game/Code/Screens/UScreenOptionsLyrics.pas | 3 ++- Game/Code/Screens/UScreenOptionsRecord.pas | 3 ++- Game/Code/Screens/UScreenOptionsSound.pas | 3 ++- Game/Code/Screens/UScreenOptionsThemes.pas | 5 ++--- 7 files changed, 26 insertions(+), 15 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas index 76ff2adc..f24b29c1 100644 --- a/Game/Code/Screens/UScreenOptions.pas +++ b/Game/Code/Screens/UScreenOptions.pas @@ -159,25 +159,32 @@ begin AddBackground(Theme.Options.Background.Tex); AddButton(Theme.Options.ButtonGame); - AddButtonText(14, 20, Theme.Options.Description[0]); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[0]); AddButton(Theme.Options.ButtonGraphics); - AddButtonText(14, 20, Theme.Options.Description[1]); + if (Length(Button[1].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[1]); AddButton(Theme.Options.ButtonSound); - AddButtonText(14, 20, Theme.Options.Description[2]); + if (Length(Button[2].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[2]); AddButton(Theme.Options.ButtonLyrics); - AddButtonText(14, 20, Theme.Options.Description[3]); + if (Length(Button[3].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[3]); AddButton(Theme.Options.ButtonThemes); - AddButtonText(14, 20, Theme.Options.Description[4]); + if (Length(Button[4].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[4]); AddButton(Theme.Options.ButtonRecord); - AddButtonText(14, 20, Theme.Options.Description[5]); + if (Length(Button[5].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[5]); AddButton(Theme.Options.ButtonExit); - AddButtonText(14, 20, Theme.Options.Description[6]); + if (Length(Button[6].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[6]); for I := 0 to High(Theme.Options.Static) do AddStatic(Theme.Options.Static[I]); diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index 6f49bd19..cc6e850b 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -88,7 +88,8 @@ begin AddButton(Theme.OptionsGame.ButtonExit); - AddButtonText(14, 20, 'Exit'); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[6]); end; diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index 1f30f9b5..62648e0c 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -89,7 +89,8 @@ begin AddButton(Theme.OptionsGraphics.ButtonExit); - AddButtonText(14, 20, 'Exit'); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[6]); end; diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas index 21a33998..0ce5c970 100644 --- a/Game/Code/Screens/UScreenOptionsLyrics.pas +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -79,7 +79,8 @@ begin AddButton(Theme.OptionsLyrics.ButtonExit); - AddButtonText(14, 20, 'Exit'); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[6]); end; diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index c27ec02a..b4075ba8 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -104,7 +104,8 @@ begin SelectSlideChannelR := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelR, Ini.CardList[0].ChannelR, IChannel); AddButton(Theme.OptionsRecord.ButtonExit); - AddButtonText(14, 20, 'Exit'); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[6]); Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index a99ae86d..ad6db766 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -80,7 +80,8 @@ begin //AddSelect(Theme.OptionsSound.SelectTwoPlayerMode, Ini.TwoPlayerMode, ITwoPlayerMode); AddButton(Theme.OptionsSound.ButtonExit); - AddButtonText(14, 20, 'Exit'); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[6]); Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index b7d18fa5..eb5ed33e 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -99,15 +99,14 @@ begin AddText(Theme.OptionsThemes.Text[I]); AddSelectSlide(Theme.OptionsThemes.SelectTheme, Ini.Theme, ITheme); - //SelectsS[High(SelectsS)].SetSelectOpt(Ini.Theme); SkinSelect := AddSelectSlide(Theme.OptionsThemes.SelectSkin, Ini.SkinNo, ISkin); - //AddSelectSlideOption('SingStar'); AddSelectSlide(Theme.OptionsThemes.SelectColor, Ini.Color, IColor); AddButton(Theme.OptionsThemes.ButtonExit); - AddButtonText(14, 20, 'Exit'); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[6]); end; procedure TScreenOptionsThemes.onShow; -- cgit v1.2.3 From 5c46c303e25f84e49e36918bafc8d7eca09a507b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 5 Apr 2007 13:43:20 +0000 Subject: Fixed: Button.Z Attribut not loaded from Theme Fixed: AddButton procedure don't set Result git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@58 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 50 ++++++++++++++++++++++++++++++++++----- Game/Code/Menu/UMenu.pas | 54 +++++++++++++++++++++---------------------- 2 files changed, 71 insertions(+), 33 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index a62c5aed..d2fb5b11 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -113,6 +113,7 @@ type Text: AThemeText; X: integer; Y: integer; + Z: Real; W: integer; H: integer; Color: string; @@ -280,6 +281,9 @@ type StaticP3RScoreBG: TThemeStatic; //Static for ScoreBG TextP3R: TThemeText; TextP3RScore: TThemeText; + + //Linebonus Translations + LineBonusText: Array [0..8] of String; end; TThemeScore = class(TThemeBasic) @@ -402,6 +406,12 @@ type ButtonSearchText: TThemeButton; SelectSlideType: TThemeSelectSlide; TextFound: TThemeText; + + //Translated Texts + Songsfound: String; + NoSongsfound: String; + CatText: String; + IType: array [0..2] of String; end; //Party Screens @@ -512,6 +522,11 @@ type ButtonPrev: TThemeButton;} end; + //Playlist Translations + TThemePlaylist = record + CatText: string; + end; + TTheme = class {$IFDEF THEMESAVE} ThemeIni: TIniFile; @@ -541,8 +556,10 @@ type PartyNewRound: TThemePartyNewRound; PartyScore: TThemePartyScore; PartyWin: TThemePartyWin; - PartyOptions: TThemePartyOptions; - PartyPlayer: TThemePartyPlayer; + PartyOptions: TThemePartyOptions; + PartyPlayer: TThemePartyPlayer; + + Playlist: TThemePlaylist; constructor Create(FileName: string); overload; // Initialize theme system constructor Create(FileName: string; Color: integer); overload; // Initialize theme system with color @@ -871,6 +888,16 @@ begin ThemeLoadText(Sing.TextP3R, 'SingP3RText'); ThemeLoadText(Sing.TextP3RScore, 'SingP3RTextScore'); + //Line Bonus Texts + Sing.LineBonusText[0] := Language.Translate('LINEBONUS_WORST'); + Sing.LineBonusText[1] := Sing.LineBonusText[0]; + Sing.LineBonusText[2] := Language.Translate('LINEBONUS_BAD'); + Sing.LineBonusText[3] := Language.Translate('LINEBONUS_NORMAL'); + Sing.LineBonusText[4] := Sing.LineBonusText[3]; + Sing.LineBonusText[5] := Language.Translate('LINEBONUS_GOOD'); + Sing.LineBonusText[6] := Language.Translate('LINEBONUS_BETTER'); + Sing.LineBonusText[7] := Sing.LineBonusText[6]; + Sing.LineBonusText[8] := Language.Translate('LINEBONUS_PERFECT'); // Score ThemeLoadBasic(Score, 'Score'); @@ -1008,6 +1035,13 @@ begin ThemeLoadButton(SongJumpto.ButtonSearchText, 'SongJumptoButtonSearchText'); ThemeLoadSelectSlide(SongJumpto.SelectSlideType, 'SongJumptoSelectSlideType'); ThemeLoadText(SongJumpto.TextFound, 'SongJumptoTextFound'); + //Translations + SongJumpto.IType[0] := Language.Translate('SONG_JUMPTO_TYPE1'); + SongJumpto.IType[1] := Language.Translate('SONG_JUMPTO_TYPE2'); + SongJumpto.IType[2] := Language.Translate('SONG_JUMPTO_TYPE3'); + SongJumpto.SongsFound := Language.Translate('SONG_JUMPTO_SONGSFOUND'); + SongJumpto.NoSongsFound := Language.Translate('SONG_JUMPTO_NOSONGSFOUND'); + SongJumpto.CatText := Language.Translate('SONG_JUMPTO_CATTEXT'); //Party Screens: //Party NewRound @@ -1122,6 +1156,9 @@ begin {ThemeLoadButton(ButtonNext, 'PartyPlayerButtonNext'); ThemeLoadButton(ButtonPrev, 'PartyPlayerButtonPrev');} + + //Playlist Translations + Playlist.CatText := Language.Translate('PLAYLIST_CATTEXT') end; ThemeIni.Free; @@ -1239,10 +1276,11 @@ var begin DecimalSeparator := '.'; ThemeButton.Tex := ThemeIni.ReadString(Name, 'Tex', ''); - ThemeButton.X := ThemeIni.ReadInteger(Name, 'X', 0); - ThemeButton.Y := ThemeIni.ReadInteger(Name, 'Y', 0); - ThemeButton.W := ThemeIni.ReadInteger(Name, 'W', 0); - ThemeButton.H := ThemeIni.ReadInteger(Name, 'H', 0); + ThemeButton.X := ThemeIni.ReadInteger (Name, 'X', 0); + ThemeButton.Y := ThemeIni.ReadInteger (Name, 'Y', 0); + ThemeButton.Z := ThemeIni.ReadFloat (Name, 'Z', 0); + ThemeButton.W := ThemeIni.ReadInteger (Name, 'W', 0); + ThemeButton.H := ThemeIni.ReadInteger (Name, 'H', 0); ThemeButton.Typ := ThemeIni.ReadString(Name, 'Type', ''); diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index bf823b16..45a25cb7 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -369,6 +369,8 @@ begin ThemeButton.DColR, ThemeButton.DColG, ThemeButton.DColB, ThemeButton.DInt, Skin.GetTextureFileName(ThemeButton.Tex), 'JPG', ThemeButton.Typ, ThemeButton.Reflection); + Button[Result].Z := ThemeButton.Z; + BTLen := Length(ThemeButton.Text); for BT := 0 to BTLen-1 do begin @@ -390,44 +392,42 @@ begin end; function TMenu.AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean): integer; -var - ButNum : integer; begin // adds button - ButNum := Length(Button); - SetLength(Button, ButNum + 1); -// Button[ButNum] := TButton.Create(Texture.GetTexture(Name, Typ)); + Result := Length(Button); + SetLength(Button, Result + 1); +// Button[Result] := TButton.Create(Texture.GetTexture(Name, Typ)); // check here for cache // Texture.GetTexture(Name, Typ, false); // preloads textures and creates cahce mipmap when needed // if Covers.CoverExists(Name) then - Button[ButNum] := TButton.Create(Texture.GetTexture(Name, Typ, true)); // use cache texture + Button[Result] := TButton.Create(Texture.GetTexture(Name, Typ, true)); // use cache texture // else -// Button[ButNum] := TButton.Create(Texture.GetTexture(Name, Typ, false)); // don't use cache texture} +// Button[Result] := TButton.Create(Texture.GetTexture(Name, Typ, false)); // don't use cache texture} // configures button - Button[ButNum].Texture.X := X; - Button[ButNum].Texture.Y := Y; - Button[ButNum].Texture.W := W; - Button[ButNum].Texture.H := H; - Button[ButNum].SelectColR := ColR; - Button[ButNum].SelectColG := ColG; - Button[ButNum].SelectColB := ColB; - Button[ButNum].SelectInt := Int; - Button[ButNum].DeselectColR := DColR; - Button[ButNum].DeselectColG := DColG; - Button[ButNum].DeselectColB := DColB; - Button[ButNum].DeselectInt := DInt; - Button[ButNum].Texture.TexX1 := 0; - Button[ButNum].Texture.TexY1 := 0; - Button[ButNum].Texture.TexX2 := 1; - Button[ButNum].Texture.TexY2 := 1; - Button[ButNum].SetSelect(false); - - Button[ButNum].Reflection := Reflection; + Button[Result].Texture.X := X; + Button[Result].Texture.Y := Y; + Button[Result].Texture.W := W; + Button[Result].Texture.H := H; + Button[Result].SelectColR := ColR; + Button[Result].SelectColG := ColG; + Button[Result].SelectColB := ColB; + Button[Result].SelectInt := Int; + Button[Result].DeselectColR := DColR; + Button[Result].DeselectColG := DColG; + Button[Result].DeselectColB := DColB; + Button[Result].DeselectInt := DInt; + Button[Result].Texture.TexX1 := 0; + Button[Result].Texture.TexY1 := 0; + Button[Result].Texture.TexX2 := 1; + Button[Result].Texture.TexY2 := 1; + Button[Result].SetSelect(false); + + Button[Result].Reflection := Reflection; // adds interaction - AddInteraction(iButton, ButNum); + AddInteraction(iButton, Result); Interaction := 0; end; -- cgit v1.2.3 From e2cd03822f28a4866f98fb0893a73b02bd60ce03 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 5 Apr 2007 14:37:58 +0000 Subject: Added Playlist Support Working correct with Standard Mode Only for now Now working on Playlist Support for Party Mode git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@59 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPliki.pas | 3 + Game/Code/Screens/UScreenSong.pas | 32 ++++- Game/Code/Screens/UScreenSongJumpto.pas | 21 +-- Game/Code/Screens/UScreenSongMenu.pas | 242 +++++++++++++++++++++++++++++--- Game/Code/UltraStar.dpr | 33 ++--- 5 files changed, 270 insertions(+), 61 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPliki.pas b/Game/Code/Classes/UPliki.pas index 475a3752..f7692990 100644 --- a/Game/Code/Classes/UPliki.pas +++ b/Game/Code/Classes/UPliki.pas @@ -22,6 +22,7 @@ var CoversPath: string; LanguagesPath: string; PluginPath: string; + PlayListPath: string; Plik: TextFile; // all procedures in this unit operates on this file PlikC: char; @@ -49,6 +50,8 @@ begin //Modi Loader PluginPath := GamePath + 'Plugins\'; + PlaylistPath := GamePath + 'Playlists\'; + DecimalSeparator := ','; end; diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 694ecc39..6a1df197 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -314,12 +314,26 @@ begin begin if Length(Songs.Song) > 0 then begin if not CatSongs.Song[Interaction].Main then begin // clicked on Song - ScreenSongMenu.MenuShow(SM_Main); + if CatSongs.CatNumShow = -3 then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end + else + begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); end; end; end; - SDLK_J: //Show SongMenu + SDLK_P: //Show Playlist Menu + begin + if Length(Songs.Song) > 0 then begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); + end; + end; + + SDLK_J: //Show Jumpto Menu begin if Length(Songs.Song) > 0 then begin @@ -699,6 +713,8 @@ begin end else if (CatSongs.CatNumShow = -2) then Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) + else if (CatSongs.CatNumShow = -3) then + Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) else if (Ini.Tabs_at_startup = 1) then Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) else @@ -1144,8 +1160,18 @@ begin UpdateLCD; end; + //Playlist Mode + if (Mode = 0) then + begin + //If Playlist Shown -> Select Next automatically + if (CatSongs.CatNumShow = -3) then + begin + SelectNext; + ChangeMusic; + end; + end //Party Mode - if (Mode = 1) then + else if (Mode = 1) then begin SelectRandomSong; end; diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index c2107507..123146c7 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -8,10 +8,6 @@ uses type TScreenSongJumpto = class(TMenu) private - Songsfound: String; - NoSongsfound: String; - CatText: String; - //For ChangeMusic LastPlayed: Integer; VisibleBool: Boolean; @@ -157,13 +153,6 @@ var I: integer; begin inherited Create; - //Translate Texts //TODO: Port to UTheme (Linebonus and PartyScreens, too - IType[0] := Language.Translate('SONG_JUMPTO_TYPE1'); - IType[1] := Language.Translate('SONG_JUMPTO_TYPE2'); - IType[2] := Language.Translate('SONG_JUMPTO_TYPE3'); - SongsFound := Language.Translate('SONG_JUMPTO_SONGSFOUND'); - NoSongsFound := Language.Translate('SONG_JUMPTO_NOSONGSFOUND'); - CatText := Language.Translate('SONG_JUMPTO_CATTEXT'); AddBackground(Theme.SongJumpto.Background.Tex); @@ -172,7 +161,7 @@ begin AddButtonText(14, 20, ''); SelectType := 0; - AddSelectSlide(Theme.SongJumpto.SelectSlideType, SelectType, IType); + AddSelectSlide(Theme.SongJumpto.SelectSlideType, SelectType, Theme.SongJumpto.IType); AddText(Theme.SongJumpto.TextFound); @@ -203,7 +192,7 @@ begin SelectType := 0; Button[0].Text[0].Text := ''; - Text[0].Text := NoSongsFound; + Text[0].Text := Theme.SongJumpto.NoSongsFound; end; //Select Input @@ -220,15 +209,15 @@ procedure TScreenSongJumpto.SetTextFound(const Count: Cardinal); begin if (Count = 0) then begin - Text[0].Text := NoSongsFound; + Text[0].Text := Theme.SongJumpto.NoSongsFound; ScreenSong.HideCatTL; end else begin - Text[0].Text := Format(SongsFound, [Count]); + Text[0].Text := Format(Theme.SongJumpto.SongsFound, [Count]); //Set CatTopLeftText - ScreenSong.ShowCatTLCustom(Format(CatText, [Button[0].Text[0].Text])); + ScreenSong.ShowCatTLCustom(Format(Theme.SongJumpto.CatText, [Button[0].Text[0].Text])); end; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index a5ae2083..849716c4 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -22,7 +22,16 @@ type const SM_Main = 1; + SM_PlayList = 64 or 1; + SM_Playlist_Add = 64 or 2; + SM_Playlist_New = 64 or 3; + + SM_Playlist_Del = 64 or 5; + + SM_Playlist_Load = 64 or 8 or 1; + + SM_Party_Main = 128 or 1; SM_Party_Joker = 128 or 2; @@ -33,7 +42,7 @@ var implementation -uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty; +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist; function TScreenSongMenu.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; function IsVisible: Boolean; @@ -70,6 +79,23 @@ begin Result := true; If (PressedDown) Then begin // Key Down + if (CurMenu = SM_Playlist_New) AND (Interaction=0) then + begin + case PressedKey of + SDLK_0..SDLK_9, SDLK_A..SDLK_Z, SDLK_SPACE, SDLK_MINUS, SDLK_EXCLAIM, SDLK_COMMA, SDLK_SLASH, SDLK_ASTERISK, SDLK_QUESTION, SDLK_QUOTE, SDLK_QUOTEDBL: + begin + Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + chr(ScanCode); + exit; + end; + + SDLK_BACKSPACE: + begin + Button[Interaction].Text[0].DeleteLastL; + exit; + end; + end; + end; + case PressedKey of SDLK_Q: begin @@ -87,9 +113,6 @@ begin HandleReturn; end; - // Up and Down could be done at the same time, - // but I don't want to declare variables inside - // functions like this one, called so many times SDLK_DOWN: SelectNext; SDLK_UP: SelectPrev; @@ -179,9 +202,9 @@ begin SelectsS[0].Visible := False; Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY'); - Button[1].Text[0].Text := Language.Translate('SONG_MENU_EDIT'); - Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYMODI'); - Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); + Button[1].Text[0].Text := Language.Translate('SONG_MENU_CHANGEPLAYERS'); + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_EDIT'); end; SM_PlayList: @@ -189,18 +212,111 @@ begin CurMenu := sMenu; Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST'); + Button[0].Visible := True; + Button[1].Visible := True; + Button[2].Visible := True; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY'); + Button[1].Text[0].Text := Language.Translate('SONG_MENU_CHANGEPLAYERS'); + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_DEL'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_EDIT'); + end; + + SM_Playlist_Add: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_ADD'); + + Button[0].Visible := True; + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := True; + SelectsS[0].Visible := True; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD_NEW'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD_EXISTING'); + + SetLength(ISelections, Length(PlaylistMan.Playlists)); + PlaylistMan.GetNames(ISelections); + + if (Length(ISelections)>=1) then + begin + UpdateSelectSlideOptions(Theme.SongMenu.SelectSlide3, 0, ISelections, SelectValue); + end + else + begin + Button[3].Visible := False; + SelectsS[0].Visible := False; + Button[2].Visible := True; + Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING'); + end; + end; + + SM_Playlist_New: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_NEW'); + + Button[0].Visible := True; + Button[1].Visible := False; + Button[2].Visible := True; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NEW_UNNAMED'); + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NEW_CREATE'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); + end; + + SM_PlayList_Del: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_Del'); + Button[0].Visible := True; Button[1].Visible := False; Button[2].Visible := False; Button[3].Visible := True; SelectsS[0].Visible := False; - Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD'); - Button[1].Text[0].Text := ''; - Button[2].Text[0].Text := ''; + Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES'); Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); end; + SM_Playlist_Load: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_LOAD'); + + Button[0].Visible := False; + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := True; + SelectsS[0].Visible := True; + + Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_LOAD'); + + SetLength(ISelections, Length(PlaylistMan.Playlists)); + PlaylistMan.GetNames(ISelections); + + if (Length(ISelections)>=1) then + begin + UpdateSelectSlideOptions(Theme.SongMenu.SelectSlide3, 0, ISelections, SelectValue); + Interaction := 4; + end + else + begin + Button[3].Visible := False; + SelectsS[0].Visible := False; + Button[2].Visible := True; + Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING'); + Interaction := 3; + end; + end; + + SM_Party_Main: begin CurMenu := sMenu; @@ -242,21 +358,24 @@ begin Case CurMenu of SM_Main: begin - Visible := False; Case Interaction of 0: //Button 1 begin ScreenSong.StartSong; + Visible := False; end; 1: //Button 2 begin - ScreenSong.OpenEditor; + //Select New Players then Sing: + + Visible := False; end; 2: //Button 3 begin - //Todo: Add SingleRound Modi Support + //Show add to Playlist Menu + MenuShow(SM_Playlist_Add); end; 3: //SelectSlide 3 @@ -266,7 +385,8 @@ begin 4: //Button 4 begin - //Cancel... (Do Nothing) + ScreenSong.OpenEditor; + Visible := False; end; end; end; @@ -277,17 +397,21 @@ begin Case Interaction of 0: //Button 1 begin - // + ScreenSong.StartSong; + Visible := False; end; 1: //Button 2 begin - // + //Select New Players then Sing: + + Visible := False; end; 2: //Button 3 begin - //Todo + //Show add to Playlist Menu + MenuShow(SM_Playlist_Del); end; 3: //SelectSlide 3 @@ -297,7 +421,89 @@ begin 4: //Button 4 begin - // + ScreenSong.OpenEditor; + Visible := False; + end; + end; + end; + + SM_Playlist_Add: + begin + Case Interaction of + 0: //Button 1 + begin + MenuShow(SM_Playlist_New); + end; + + 3: //SelectSlide 3 + begin + //Dummy + end; + + 4: //Button 4 + begin + PlaylistMan.AddItem(ScreenSong.Interaction, SelectValue); + Visible := False; + end; + end; + end; + + SM_Playlist_New: + begin + Case Interaction of + 0: //Button 1 + begin + //Nothing, Button for Entering Name + end; + + 2: //Button 3 + begin + //Create Playlist and Add Song + PlaylistMan.AddItem( + ScreenSong.Interaction, + PlaylistMan.AddPlaylist(Button[0].Text[0].Text)); + Visible := False; + end; + + 3: //SelectSlide 3 + begin + //Cancel -> Go back to Add screen + MenuShow(SM_Playlist_Add); + end; + + 4: //Button 4 + begin + Visible := False; + end; + end; + end; + + SM_PlayList_Del: + begin + Visible := False; + Case Interaction of + 0: //Button 1 + begin + //Delete + PlayListMan.DelItem(PlayListMan.GetIndexbySongID(ScreenSong.Interaction)); + Visible := False; + end; + + 4: //Button 4 + begin + MenuShow(SM_Playlist); + end; + end; + end; + + SM_Playlist_Load: + begin + Case Interaction of + 4: //Button 4 + begin + //Load Playlist + PlaylistMan.SetPlayList(SelectValue); + Visible := False; end; end; end; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 65a01257..66638832 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -6,9 +6,6 @@ program UltraStar; {$R 'UltraStar.res' 'UltraStar.rc'} uses - //------------------------------ - //Includes - Menu System - //------------------------------ UDisplay in 'Menu\UDisplay.pas', UMenu in 'Menu\UMenu.pas', UMenuStatic in 'Menu\UMenuStatic.pas', @@ -18,10 +15,6 @@ uses UMenuSelect in 'Menu\UMenuSelect.pas', UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', UDrawTexture in 'Menu\UDrawTexture.pas', - - //------------------------------ - //Includes - Classes - //------------------------------ UGraphic in 'Classes\UGraphic.pas', UTexture in 'Classes\UTexture.pas', UMusic in 'Classes\UMusic.pas', @@ -49,10 +42,6 @@ uses UGraphicClasses in 'Classes\UGraphicClasses.pas', UDLLManager in 'Classes\UDLLManager.pas', UParty in 'Classes\UParty.pas', - - //------------------------------ - //Includes - Screens - //------------------------------ UScreenLoading in 'Screens\UScreenLoading.pas', UScreenWelcome in 'Screens\UScreenWelcome.pas', UScreenMain in 'Screens\UScreenMain.pas', @@ -76,28 +65,17 @@ uses UScreenTop5 in 'Screens\UScreenTop5.pas', UScreenSongMenu in 'Screens\UScreenSongMenu.pas', UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', - - //------------------------------ - //Includes - Screens PartyMode - //------------------------------ UScreenSingModi in 'Screens\UScreenSingModi.pas', UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', UScreenPartyScore in 'Screens\UScreenPartyScore.pas', UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', UScreenPartyWin in 'Screens\UScreenPartyWin.pas', - - //------------------------------ - //Includes - Modi SDK - //------------------------------ ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', - - //------------------------------ - //Includes - Delphi - //------------------------------ Windows, SDL, - SysUtils; + SysUtils, + UPlaylist in 'Classes\UPlaylist.pas'; const Version = 'UltraStar Deluxe V 0.90 Beta'; @@ -265,6 +243,13 @@ begin Log.BenchmarkEnd(1); Log.LogBenchmark('Loading DataBase System', 1); + //Playlist Manager + Log.BenchmarkStart(1); + Log.LogStatus('Playlist Manager', 'Initialization'); + PlaylistMan := TPlaylistManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Playlist Manager', 1); + //GoldenStarsTwinkleMod Log.BenchmarkStart(1); Log.LogStatus('Effect Manager', 'Initialization'); -- cgit v1.2.3 From 966955d94331c4cf78e16215bf2c30268be035ed Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 5 Apr 2007 14:49:46 +0000 Subject: Fixed a spelling mistake in ScreenSongMenu Translation Texts Fixed Set wrong Interaction in Playlist Load Menu git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@60 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSongMenu.pas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 849716c4..0b4a9d91 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -273,7 +273,7 @@ begin SM_PlayList_Del: begin CurMenu := sMenu; - Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_Del'); + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_DEL'); Button[0].Visible := True; Button[1].Visible := False; @@ -304,7 +304,7 @@ begin if (Length(ISelections)>=1) then begin UpdateSelectSlideOptions(Theme.SongMenu.SelectSlide3, 0, ISelections, SelectValue); - Interaction := 4; + Interaction := 3; end else begin @@ -312,7 +312,7 @@ begin SelectsS[0].Visible := False; Button[2].Visible := True; Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING'); - Interaction := 3; + Interaction := 2; end; end; -- cgit v1.2.3 From 34c7a7472078bd6f1d5551dedc9efd2ccccbc7c8 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 5 Apr 2007 14:52:11 +0000 Subject: Added Playlist Support git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@61 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlaylist.pas | 398 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 398 insertions(+) create mode 100644 Game/Code/Classes/UPlaylist.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlaylist.pas b/Game/Code/Classes/UPlaylist.pas new file mode 100644 index 00000000..585f9271 --- /dev/null +++ b/Game/Code/Classes/UPlaylist.pas @@ -0,0 +1,398 @@ +unit UPlaylist; + +interface + +type + TPlaylistItem = record + Artist: String; + Title: String; + SongID: Integer; + end; + + APlaylistItem = array of TPlaylistItem; + + TPlaylist = record + Name: String; + Filename: String; + Items: APlaylistItem; + end; + + APlaylist = array of TPlaylist; + + //---------- + //TPlaylistManager - Class for Managing Playlists (Loading, Displaying, Saving) + //---------- + TPlaylistManager = class + private + + public + Mode: Byte; //Current Playlist Mode for SongScreen + CurPlayList: Cardinal; + CurItem: Cardinal; + + Playlists: APlaylist; + + constructor Create; + Procedure LoadPlayLists; + Function LoadPlayList(Index: Cardinal; Filename: String): Boolean; + Procedure SavePlayList(Index: Cardinal); + + Procedure SetPlayList(Index: Cardinal); + + Function AddPlaylist(Name: String): Cardinal; + + Procedure AddItem(const SongID: Cardinal; const iPlaylist: Integer = -1); + Procedure DelItem(const iItem: Cardinal; const iPlaylist: Integer = -1); + + Procedure GetNames(var PLNames: array of String); + Function GetIndexbySongID(const SongID: Cardinal; const iPlaylist: Integer = -1): Integer; + end; + + {Modes: + 0: Standard Mode + 1: PlayList Mode + 2: Category Mode} + + var + PlayListMan: TPlaylistManager; + + +implementation +uses USongs, ULog, UPliki, UGraphic, UThemes, SysUtils; + +//---------- +//Create - Construct Class - Dummy for now +//---------- +constructor TPlayListManager.Create; +begin + LoadPlayLists; +end; + +//---------- +//LoadPlayLists - Load list of Playlists from PlayList Folder +//---------- +Procedure TPlayListManager.LoadPlayLists; +var + SR: TSearchRec; + Len: Integer; +begin + SetLength(Playlists, 0); + + if FindFirst(PlayListPath + '*.upl', 0, SR) = 0 then + begin + repeat + Len := Length(Playlists); + SetLength(Playlists, Len +1); + + if not LoadPlayList (Len, Sr.Name) then + SetLength(Playlists, Len); + + until FindNext(SR) <> 0; + FindClose(SR); + end; +end; + +//---------- +//LoadPlayList - Load a Playlist in the Array +//---------- +Function TPlayListManager.LoadPlayList(Index: Cardinal; Filename: String): Boolean; + var + F: TextFile; + Line: String; + PosDelimiter: Integer; + SongID: Integer; + Len: Integer; + + Function FindSong(Artist, Title: String): Integer; + var I: Integer; + begin + Result := -1; + + For I := low(CatSongs.Song) to high(CatSongs.Song) do + begin + if (CatSongs.Song[I].Title = Title) AND (CatSongs.Song[I].Artist = Artist) then + begin + Result := I; + Break; + end; + end; + end; +begin + if not FileExists(PlayListPath + Filename) then + begin + Log.LogError('Could not load Playlist: ' + Filename); + Result := False; + Exit; + end; + Result := True; + + //Load File + AssignFile(F, PlayListPath + FileName); + Reset(F); + + //Set Filename + PlayLists[Index].Filename := Filename; + PlayLists[Index].Name := ''; + + //Read Until End of File + While not Eof(F) do + begin + //Read Curent Line + Readln(F, Line); + + if (Length(Line) > 0) then + begin + PosDelimiter := Pos(':', Line); + if (PosDelimiter <> 0) then + begin + //Comment or Name String + if (Line[1] = '#') then + begin + //Found Name Value + if (Uppercase(Trim(copy(Line, 2, PosDelimiter - 2))) = 'NAME') then + PlayLists[Index].Name := Trim(copy(Line, PosDelimiter + 1,Length(Line) - PosDelimiter)) + + end + //Song Entry + else + begin + SongID := FindSong(Trim(copy(Line, 1, PosDelimiter - 1)), Trim(copy(Line, PosDelimiter + 1, Length(Line) - PosDelimiter))); + if (SongID <> -1) then + begin + Len := Length(PlayLists[Index].Items); + SetLength(PlayLists[Index].Items, Len + 1); + + PlayLists[Index].Items[Len].SongID := SongID; + + PlayLists[Index].Items[Len].Artist := Trim(copy(Line, 1, PosDelimiter - 1)); + PlayLists[Index].Items[Len].Title := Trim(copy(Line, PosDelimiter + 1, Length(Line) - PosDelimiter)); + end + else Log.LogError('Could not find Song in Playlist: ' + PlayLists[Index].Filename + ', ' + Line); + end; + end; + end; + end; + + //If no special name is given, use Filename + if PlayLists[Index].Name = '' then + begin + PlayLists[Index].Name := ChangeFileExt(FileName, ''); + end; + + //Finish (Close File) + CloseFile(F); +end; + +//---------- +//SavePlayList - Saves the specified Playlist +//---------- +Procedure TPlayListManager.SavePlayList(Index: Cardinal); +var + F: TextFile; + I: Integer; +begin + if (Not FileExists(PlaylistPath + Playlists[Index].Filename)) OR (Not FileisReadOnly(PlaylistPath + Playlists[Index].Filename)) then + begin + + //open File for Rewriting + AssignFile(F, PlaylistPath + Playlists[Index].Filename); + try + Rewrite(F); + + //Write Version (not nessecary but helpful) + WriteLn(F, '######################################'); + WriteLn(F, '#Ultrastar Deluxe Playlist Format v1.0'); + WriteLn(F, '#Playlist "' + Playlists[Index].Name + '" with ' + InttoStr(Length(Playlists[Index].Items)) + ' Songs.'); + WriteLn(F, '######################################'); + + //Write Name Information + WriteLn(F, '#Name: ' + Playlists[Index].Name); + + //Write Song Information + WriteLn(F, '#Songs:'); + + For I := 0 to high(Playlists[Index].Items) do + begin + WriteLn(F, Playlists[Index].Items[I].Artist + ' : ' + Playlists[Index].Items[I].Title); + end; + + finally + CloseFile(F); + end; + end; +end; + +//---------- +//SetPlayList - Display a Playlist in CatSongs +//---------- +Procedure TPlayListManager.SetPlayList(Index: Cardinal); +var + I: Integer; +begin + If (Index > High(PlayLists)) then + exit; + + //Hide all Songs + For I := 0 to high(CatSongs.Song) do + CatSongs.Song[I].Visible := False; + + //Show Songs in PL + For I := 0 to high(PlayLists[Index].Items) do + begin + CatSongs.Song[PlayLists[Index].Items[I].SongID].Visible := True; + end; + + //Set CatSongsMode + Playlist Mode + CatSongs.CatNumShow := -3; + Mode := 1; + + //Show Cat in Topleft: + ScreenSong.ShowCatTLCustom(Format(Theme.Playlist.CatText,[Playlists[Index].Name])); + + //Fix SongSelection + ScreenSong.Interaction := 0; + ScreenSong.SelectNext; + ScreenSong.FixSelected; + + //Play correct Music + ScreenSong.ChangeMusic; +end; + +//---------- +//AddPlaylist - Adds a Playlist and Returns the Index +//---------- +Function TPlayListManager.AddPlaylist(Name: String): Cardinal; +var I: Integer; +begin + Result := Length(Playlists); + SetLength(Playlists, Result + 1); + + Playlists[Result].Name := Name; + + I := 1; + + if (not FileExists(PlaylistPath + Name + '.upl')) then + Playlists[Result].Filename := Name + '.upl' + else + begin + repeat + Inc(I); + until not FileExists(PlaylistPath + Name + InttoStr(I) + '.upl'); + Playlists[Result].Filename := Name + InttoStr(I) + '.upl'; + end; + + //Save new Playlist + SavePlayList(Result); +end; + +//---------- +//AddItem - Adds an Item to a specific Playlist +//---------- +Procedure TPlayListManager.AddItem(const SongID: Cardinal; const iPlaylist: Integer); +var + P: Cardinal; + Len: Cardinal; +begin + if iPlaylist = -1 then + P := CurPlaylist + else if (iPlaylist >= 0) AND (iPlaylist <= high(Playlists)) then + P := iPlaylist + else + exit; + + if (SongID <= High(CatSongs.Song)) AND (NOT CatSongs.Song[SongID].Main) then + begin + Len := Length(Playlists[P].Items); + SetLength(Playlists[P].Items, Len + 1); + + Playlists[P].Items[Len].SongID := SongID; + Playlists[P].Items[Len].Title := CatSongs.Song[SongID].Title; + Playlists[P].Items[Len].Artist := CatSongs.Song[SongID].Artist; + + //Save Changes + SavePlayList(P); + + //Correct Display when Editing current Playlist + if (CatSongs.CatNumShow = -3) and (P = CurPlaylist) then + SetPlaylist(P); + end; +end; + +//---------- +//DelItem - Deletes an Item from a specific Playlist +//---------- +Procedure TPlayListManager.DelItem(const iItem: Cardinal; const iPlaylist: Integer); +var + I: Integer; + P: Cardinal; +begin + if iPlaylist = -1 then + P := CurPlaylist + else if (iPlaylist >= 0) AND (iPlaylist <= high(Playlists)) then + P := iPlaylist + else + exit; + + if (iItem <= high(Playlists[P].Items)) then + begin + //Move all entrys behind deleted one to Front + For I := iItem to High(Playlists[P].Items) - 1 do + Playlists[P].Items[I] := Playlists[P].Items[I + 1]; + + //Delete Last Entry + SetLength(PlayLists[P].Items, Length(PlayLists[P].Items) - 1); + + //Save Changes + SavePlayList(P); + end; + + //Correct Display when Editing current Playlist + if (CatSongs.CatNumShow = -3) and (P = CurPlaylist) then + SetPlaylist(P); +end; + +//---------- +//GetNames - Writes Playlist Names in a Array +//---------- +Procedure TPlayListManager.GetNames(var PLNames: array of String); +var + I: Integer; + Len: Integer; +begin + Len := High(Playlists); + + if (Length(PLNames) <> Len + 1) then + exit; + + For I := 0 to Len do + PLNames[I] := Playlists[I].Name; +end; + +//---------- +//GetIndexbySongID - Returns Index in the specified Playlist of the given Song +//---------- +Function TPlayListManager.GetIndexbySongID(const SongID: Cardinal; const iPlaylist: Integer): Integer; +var + P: Integer; + I: Integer; +begin + if iPlaylist = -1 then + P := CurPlaylist + else if (iPlaylist >= 0) AND (iPlaylist <= high(Playlists)) then + P := iPlaylist + else + exit; + + Result := -1; + + For I := 0 to high(Playlists[P].Items) do + begin + if (Playlists[P].Items[I].SongID = SongID) then + begin + Result := I; + Break; + end; + end; +end; + +end. -- cgit v1.2.3 From 9d01c8801db29d6ff3d64ef81b84321549d84688 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 5 Apr 2007 21:09:52 +0000 Subject: Added Advanced Screen and Options in TIni Options working now only for Effect Perfect and Effect Golden. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@65 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 26 +- Game/Code/Classes/UGraphic.pas | 42 ++- Game/Code/Classes/UIni.pas | 160 +++++----- Game/Code/Classes/UThemes.pas | 442 ++++++++++++++------------- Game/Code/Screens/UScreenEditSub.pas | 4 +- Game/Code/Screens/UScreenOptions.pas | 11 +- Game/Code/Screens/UScreenOptionsAdvanced.pas | 95 ++++++ Game/Code/Screens/UScreenOptionsGraphics.pas | 1 - Game/Code/Screens/UScreenSing.pas | 14 +- Game/Code/Screens/UScreenSongMenu.pas | 4 +- Game/Code/UltraStar.dpr | 29 +- 11 files changed, 499 insertions(+), 329 deletions(-) create mode 100644 Game/Code/Screens/UScreenOptionsAdvanced.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 2e742172..e0e8e941 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -215,11 +215,17 @@ begin with Nuta[Pet] do begin if not FreeStyle then begin - // Golden Note Patch - case Wartosc of - 1: glColor4f(1, 1, 1, 0.85); - 2: glColor4f(1, 1, 1, 0.85); // no stars, paint yellow -> glColor4f(1, 1, 0.3, 0.85); - end; // case + + if Ini.EffectGolden = 0 then + // If Golden note Effect of then Change not Color + begin + case Wartosc of + 1: glColor4f(1, 1, 1, 0.85); + 2: glColor4f(1, 1, 0.3, 0.85); // no stars, paint yellow -> glColor4f(1, 1, 0.3, 0.85); + end; // case + end //Else all Notes same Color + else + glColor4f(1, 1, 1, 0.85); // lewa czesc - left part Rec.Left := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX; @@ -264,10 +270,10 @@ begin glEnd; // Golden Star Patch - if Wartosc = 2 then - begin - GoldenRec.SaveGoldenStarsRec(GoldenStarPos, Rec.Top, Rec.Right, Rec.Bottom); - end; + if (Wartosc = 2) AND (Ini.EffectGolden=1) then + begin + GoldenRec.SaveGoldenStarsRec(GoldenStarPos, Rec.Top, Rec.Right, Rec.Bottom); + end; end; // if not FreeStyle end; // with @@ -373,7 +379,7 @@ var //Rec.Right := X + (Start+Dlugosc-Czesci[0].Czesc[Czesci[0].Akt].StartNote) * TempR - NotesW - 0.5 + 10*ScreenX; //if (Start+Dlugosc-1 = Czas.AktBeatD) then - if Perfect AND (Ini.GMAFix <> 1) then begin + if Perfect and (Ini.EffectPerfect=1) then begin // A := sqrt((1+sin(Music.Position * 3))/2); A := 1 - 2*(Czas.Teraz - GetTimeFromBeat(Start+Dlugosc)); if not (Start+Dlugosc-1 = Czas.AktBeatD) then diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index d9831143..73bb1706 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -4,7 +4,7 @@ interface uses SDL, OpenGL12, UTexture, TextGL, ULog, SysUtils, ULyrics, UScreenLoading, UScreenWelcome, UScreenMain, UScreenName, UScreenLevel, UScreenOptions, UScreenOptionsGame, - UScreenOptionsGraphics, UScreenOptionsSound, UScreenOptionsLyrics, UScreenOptionsThemes, UScreenOptionsRecord, + UScreenOptionsGraphics, UScreenOptionsSound, UScreenOptionsLyrics, UScreenOptionsThemes, UScreenOptionsRecord, UScreenOptionsAdvanced, UScreenSong, UScreenSing, UScreenScore, UScreenTop5, UScreenEditSub, UScreenEdit, UScreenEditConvert, UScreenEditHeader, UScreenOpen, UThemes, USkins, UScreenSongMenu, UScreenSongJumpto, {Party Screens} UScreenSingModi, UScreenPartyNewRound, UScreenPartyScore, UScreenPartyOptions, UScreenPartyWin, UScreenPartyPlayer; @@ -44,6 +44,7 @@ var ScreenOptionsLyrics: TScreenOptionsLyrics; ScreenOptionsThemes: TScreenOptionsThemes; ScreenOptionsRecord: TScreenOptionsRecord; + ScreenOptionsAdvanced: TScreenOptionsAdvanced; ScreenEditSub: TScreenEditSub; ScreenEdit: TScreenEdit; ScreenEditConvert: TScreenEditConvert; @@ -162,7 +163,7 @@ procedure LoadScreens; implementation -uses UMain, UIni, UDisplay; +uses UMain, UIni, UDisplay, Graphics, Classes, Windows; procedure LoadTextures; var @@ -215,13 +216,36 @@ begin end; procedure Initialize3D (Title: string); +var + Icon: TIcon; + Res: TResourceStream; + ISurface: PSDL_Surface; begin Log.LogStatus('LoadOpenGL', 'Initialize3D'); Log.BenchmarkStart(2); LoadOpenGL; -// SDL_WM_SetIcon(SDL_LoadBMP('..\Graphics\us.ico'),0); + {//Load Icon + Res := TResourceStream.CreateFromID(HInstance, 3, RT_ICON); + Icon := TIcon.Create; + Icon.LoadFromStream(Res); + Res.Free; + + //Create icon Surface + SDL_CreateRGBSurface ( + SDL_SWSURFACE, + Icon.Width, + Icon.Height, + 32, + 128 or 64, + 32 or 16, + 8 or 4, + 2 or 1); + SDL_BlitSurface( //} + + + SDL_WM_SetIcon(SDL_LoadBMP('us.ico'), 0); //} Log.LogStatus('SDL_Init', 'Initialize3D'); if ( SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO)= -1 ) then begin @@ -370,16 +394,18 @@ begin Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options', 3); Log.BenchmarkStart(3); ScreenOptionsGame := TScreenOptionsGame.Create(''); Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Game', 3); Log.BenchmarkStart(3); - ScreenOptionsGraphics := TScreenOptionsGraphics.Create(''); + ScreenOptionsGraphics := TScreenOptionsGraphics.Create(''); Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Graphics', 3); Log.BenchmarkStart(3); - ScreenOptionsSound := TScreenOptionsSound.Create(''); + ScreenOptionsSound := TScreenOptionsSound.Create(''); Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Sound', 3); Log.BenchmarkStart(3); - ScreenOptionsLyrics := TScreenOptionsLyrics.Create(''); + ScreenOptionsLyrics := TScreenOptionsLyrics.Create(''); Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Lyrics', 3); Log.BenchmarkStart(3); - ScreenOptionsThemes := TScreenOptionsThemes.Create(''); + ScreenOptionsThemes := TScreenOptionsThemes.Create(''); Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Themes', 3); Log.BenchmarkStart(3); - ScreenOptionsRecord := TScreenOptionsRecord.Create; + ScreenOptionsRecord := TScreenOptionsRecord.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Record', 3); Log.BenchmarkStart(3); + ScreenOptionsAdvanced := TScreenOptionsAdvanced.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Advanced', 3); Log.BenchmarkStart(3); ScreenEditSub := TScreenEditSub.Create(''); Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Sub', 3); Log.BenchmarkStart(3); ScreenEdit := TScreenEdit.Create(''); diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index a17ba52d..7ab8de99 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -27,11 +27,6 @@ type Spectrum: integer; Spectrograph: integer; MovieSize: integer; - //LineBonus Mod - LineBonus: integer; - //GMA Fix - GMAFix: integer; - // Sound MicBoost: integer; @@ -61,6 +56,14 @@ type ChannelR: integer; end; + // Advanced + LoadAnimation: integer; + EffectPerfect: integer; + EffectGolden: integer; + AskbeforeDel: integer; + OnSongClick: integer; + LineBonus: integer; + // Controller Joypad: integer; @@ -113,11 +116,6 @@ const IOscilloscope: array[0..2] of string = ('Off', 'Osci', 'Bar'); //IOscilloscope: array[0..1] of string = ('Off', 'On'); - //Line Bonus MOd - ILineBonus: array[0..2] of string = ('Off', 'At Score', 'At Notes'); - //GMA Fix - IGMAFix: array[0..1] of string = ('Off', 'On'); - ISpectrum: array[0..1] of string = ('Off', 'On'); ISpectrograph: array[0..1] of string = ('Off', 'On'); IMovieSize: array[0..1] of string = ('Half', 'Full'); @@ -135,6 +133,14 @@ const IColor: array[0..8] of string = ('Blue', 'Green', 'Pink', 'Red', 'Violet', 'Orange', 'Yellow', 'Brown', 'Black'); + // Advanced + ILoadAnimation: array[0..1] of string = ('Off', 'On'); + IEffectPerfect: array[0..1] of string = ('Off', 'On'); + IEffectGolden: array[0..1] of string = ('Off', 'On'); + IAskbeforeDel: array[0..1] of string = ('Off', 'On'); + IOnSongClick: array[0..2] of string = ('Sing', 'Select Players', 'Open Menu'); + ILineBonus: array[0..2] of string = ('Off', 'At Score', 'At Notes'); + IJoypad: array[0..1] of string = ('Off', 'On'); ILPT: array[0..2] of string = ('Off', 'LCD', 'Lights'); @@ -257,16 +263,6 @@ begin for Pet := 0 to High(IOscilloscope) do if Tekst = IOscilloscope[Pet] then Ini.Oscilloscope := Pet; - // Line Bonus - Tekst := IniFile.ReadString('Graphics', 'LineBonus', 'At Score'); - for Pet := 0 to High(ILineBonus) do - if Tekst = ILineBonus[Pet] then Ini.LineBonus := Pet; - - //GMA Fix - Tekst := IniFile.ReadString('Graphics', 'GMAFix', 'Off'); - for Pet := 0 to High(IGMAFix) do - if Tekst = IGMAFix[Pet] then Ini.GMAFix := Pet; - // Spectrum Tekst := IniFile.ReadString('Graphics', 'Spectrum', 'Off'); for Pet := 0 to High(ISpectrum) do @@ -307,22 +303,6 @@ begin for Pet := 0 to High(IThreshold) do if Tekst = IThreshold[Pet] then Ini.Threshold := Pet; - {// Two Player Mode - for I := 0 to 7 do begin - Ini.SoundCard[I, 1] := 2*I + 1; - Ini.SoundCard[I, 2] := 2*I + 2; - end; - - Tekst := IniFile.ReadString('Sound', 'TwoPlayerMode', ITwoPlayerMode[0]); - for Pet := 0 to High(ITwoPlayerMode) do - if Tekst = ITwoPlayerMode[Pet] then Ini.TwoPlayerMode := Pet; - - if Ini.TwoPlayerMode = 1 then begin - Ini.SoundCard[0, 1] := 1; - Ini.SoundCard[0, 2] := 3; - Ini.SoundCard[1, 1] := 2; - end;} - // Lyrics Font Tekst := IniFile.ReadString('Lyrics', 'LyricsFont', ILyricsFont[1]); for Pet := 0 to High(ILyricsFont) do @@ -339,15 +319,6 @@ begin if Tekst = ISolmization[Pet] then Ini.Solmization := Pet; // Theme - {SetLength(ITheme, 0); - if FileExists('Themes\Singstar.ini') then begin - SetLength(ITheme, Length(ITheme)+1); - ITheme[High(ITheme)] := 'Singstar'; - end; { - if FileExists('Themes\Karin.ini') then begin - SetLength(ITheme, Length(ITheme)+1); - ITheme[High(ITheme)] := 'Karin'; - end;} //Theme List Patch SetLength(ITheme, 0); @@ -372,8 +343,7 @@ begin //No Theme Found if (Length(ITheme)=0) then begin - Log.LogError('Could not find any valid Themes.'); - Halt; + Log.CriticalError('Could not find any valid Themes.'); end; @@ -425,8 +395,6 @@ begin Inc(I); end; - Log.LogError(InttoStr(Length(CardList)) + ' Cards Loaded'); - // Record - append detected soundcards for I := 0 to High(Recording.SoundCard) do begin @@ -455,40 +423,45 @@ begin end; end; - {for I := 0 to High(Recording.SoundCard) do begin + //Advanced Settings - B := false; - I2 := 0; - while ((B = false) and (I2 <= High(CardList))) do - if CardList[I2].Name = Recording.SoundCard[I].Description then B := true - else Inc(I2); + // LoadAnimation + Tekst := IniFile.ReadString('Advanced', 'LoadAnimation', 'On'); + for Pet := 0 to High(ILoadAnimation) do + if Tekst = ILoadAnimation[Pet] then Ini.LoadAnimation := Pet; + + // EffectPerfect + Tekst := IniFile.ReadString('Advanced', 'EffectPerfect', 'On'); + for Pet := 0 to High(IEffectPerfect) do + if Tekst = IEffectPerfect[Pet] then Ini.EffectPerfect := Pet; + + // EffectGolden + Tekst := IniFile.ReadString('Advanced', 'EffectGolden', 'On'); + for Pet := 0 to High(IEffectGolden) do + if Tekst = IEffectGolden[Pet] then Ini.EffectGolden := Pet; + + // AskbeforeDel + Tekst := IniFile.ReadString('Advanced', 'AskbeforeDel', 'On'); + for Pet := 0 to High(IAskbeforeDel) do + if Tekst = IAskbeforeDel[Pet] then Ini.AskbeforeDel := Pet; + + // OnSongClick + Tekst := IniFile.ReadString('Advanced', 'OnSongClick', 'Sing'); + for Pet := 0 to High(IOnSongClick) do + if Tekst = IOnSongClick[Pet] then Ini.OnSongClick := Pet; + + // Linebonus + Tekst := IniFile.ReadString('Advanced', 'LineBonus', 'At Score'); + for Pet := 0 to High(ILineBonus) do + if Tekst = ILineBonus[Pet] then Ini.LineBonus := Pet; - // if the card wasn't detected in ini file, append it to the ini list - if B = false then begin - I3 := Length(CardList); - SetLength(CardList, I3+1); - CardList[I3].Name := Recording.SoundCard[I].Description; - CardList[I3].Input := 0; - CardList[I3].ChannelL := 0; - CardList[I3].ChannelR := 0; - if Length(CardList) = 1 then CardList[I].ChannelL := 1; // default for new users - //CardList[I].Input := 2; - end; - end; } - Log.LogError(InttoStr(Length(CardList)) + ' Cards Detected'); // Joypad Tekst := IniFile.ReadString('Controller', 'Joypad', IJoypad[0]); for Pet := 0 to High(IJoypad) do if Tekst = IJoypad[Pet] then Ini.Joypad := Pet; - {// SoundCard - for I := 0 to 7 do begin - Ini.SoundCard[I, 1] := IniFile.ReadInteger('SoundCards', 'SoundCard'+IntToStr(I+1)+'L', Ini.SoundCard[I, 1]); - Ini.SoundCard[I, 2] := IniFile.ReadInteger('SoundCards', 'SoundCard'+IntToStr(I+1)+'R', Ini.SoundCard[I, 2]); - end; } - // LCD Tekst := IniFile.ReadString('Devices', 'LPT', ILPT[0]); for Pet := 0 to High(ILPT) do @@ -564,14 +537,6 @@ begin Tekst := IOscilloscope[Ini.Oscilloscope]; IniFile.WriteString('Graphics', 'Oscilloscope', Tekst); - //Line Bonus - Tekst := ILineBonus[Ini.LineBonus]; - IniFile.WriteString('Graphics', 'LineBonus', Tekst); - - //GMA Fix - Tekst := IGMAFix[Ini.GMAFix]; - IniFile.WriteString('Graphics', 'GMAFix', Tekst); - // Spectrum Tekst := ISpectrum[Ini.Spectrum]; IniFile.WriteString('Graphics', 'Spectrum', Tekst); @@ -604,10 +569,6 @@ begin Tekst := ISavePlayback[Ini.SavePlayback]; IniFile.WriteString('Sound', 'SavePlayback', Tekst); - {// Two Player Mode - Tekst := ITwoPlayerMode[Ini.TwoPlayerMode]; - IniFile.WriteString('Sound', 'TwoPlayerMode', Tekst); } - // Lyrics Font Tekst := ILyricsFont[Ini.LyricsFont]; IniFile.WriteString('Lyrics', 'LyricsFont', Tekst); @@ -651,6 +612,33 @@ begin Log.LogError(InttoStr(Length(CardList)) + ' Cards Saved'); + //Advanced Settings + + //LoadAnimation + Tekst := ILoadAnimation[Ini.LoadAnimation]; + IniFile.WriteString('Advanced', 'LoadAnimation', Tekst); + + //EffectPerfect + Tekst := IEffectPerfect[Ini.EffectPerfect]; + IniFile.WriteString('Advanced', 'EffectPerfect', Tekst); + + //EffectGolden + Tekst := IEffectGolden[Ini.EffectGolden]; + IniFile.WriteString('Advanced', 'EffectGolden', Tekst); + + //AskbeforeDel + Tekst := IAskbeforeDel[Ini.AskbeforeDel]; + IniFile.WriteString('Advanced', 'AskbeforeDel', Tekst); + + //OnSongClick + Tekst := IOnSongClick[Ini.OnSongClick]; + IniFile.WriteString('Advanced', 'OnSongClick', Tekst); + + //Line Bonus + Tekst := ILineBonus[Ini.LineBonus]; + IniFile.WriteString('Advanced', 'LineBonus', Tekst); + + // Joypad Tekst := IJoypad[Ini.Joypad]; IniFile.WriteString('Controller', 'Joypad', Tekst); diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index d2fb5b11..17983a60 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -333,10 +333,11 @@ type ButtonLyrics: TThemeButton; ButtonThemes: TThemeButton; ButtonRecord: TThemeButton; + ButtonAdvanced: TThemeButton; ButtonExit: TThemeButton; TextDescription: TThemeText; - Description: array[0..6] of string; + Description: array[0..7] of string; end; TThemeOptionsGame = class(TThemeBasic) @@ -390,6 +391,16 @@ type ButtonExit: TThemeButton; end; + TThemeOptionsAdvanced = class(TThemeBasic) + SelectLoadAnimation: TThemeSelect; + SelectEffectPerfect: TThemeSelect; + SelectEffectGolden: TThemeSelect; + SelectLineBonus: TThemeSelect; + SelectAskbeforeDel: TThemeSelect; + SelectOnSongClick: TThemeSelectSlide; + ButtonExit: TThemeButton; + end; + //ScreenSong Menue TThemeSongMenu = class(TThemeBasic) Button1: TThemeButton; @@ -549,7 +560,8 @@ type OptionsLyrics: TThemeOptionsLyrics; OptionsThemes: TThemeOptionsThemes; OptionsRecord: TThemeOptionsRecord; - //Menu + OptionsAdvanced: TThemeOptionsAdvanced; + //ScreenSong extensions SongMenu: TThemeSongMenu; SongJumpto: TThemeSongJumpTo; //Party Screens: @@ -633,6 +645,7 @@ begin OptionsLyrics := TThemeOptionsLyrics.Create; OptionsThemes := TThemeOptionsThemes.Create; OptionsRecord := TThemeOptionsRecord.Create; + OptionsAdvanced := TThemeOptionsAdvanced.Create; SongMenu := TThemeSongMenu.Create; SongJumpto := TThemeSongJumpto.Create; @@ -939,72 +952,74 @@ begin ThemeLoadTexts(Top5.TextName, 'Top5TextName'); ThemeLoadTexts(Top5.TextScore, 'Top5TextScore'); - // Options - ThemeLoadBasic(Options, 'Options'); - - ThemeLoadButton(Options.ButtonGame, 'OptionsButtonGame'); - ThemeLoadButton(Options.ButtonGraphics, 'OptionsButtonGraphics'); - ThemeLoadButton(Options.ButtonSound, 'OptionsButtonSound'); - ThemeLoadButton(Options.ButtonLyrics, 'OptionsButtonLyrics'); - ThemeLoadButton(Options.ButtonThemes, 'OptionsButtonThemes'); - ThemeLoadButton(Options.ButtonRecord, 'OptionsButtonRecord'); - ThemeLoadButton(Options.ButtonExit, 'OptionsButtonExit'); - - {{$IFDEF TRANSLATE} - Options.Description[0] := Language.Translate('SING_OPTIONS_GAME'); - Options.Description[1] := Language.Translate('SING_OPTIONS_GRAPHICS'); - Options.Description[2] := Language.Translate('SING_OPTIONS_SOUND'); - Options.Description[3] := Language.Translate('SING_OPTIONS_LYRICS'); - Options.Description[4] := Language.Translate('SING_OPTIONS_THEMES'); - Options.Description[5] := Language.Translate('SING_OPTIONS_RECORD'); - Options.Description[6] := Language.Translate('SING_OPTIONS_EXIT'); - {{$ENDIF} - - ThemeLoadText(Options.TextDescription, 'OptionsTextDescription'); - Options.TextDescription.Text := Options.Description[0]; - - // Options Game - ThemeLoadBasic(OptionsGame, 'OptionsGame'); - - ThemeLoadSelect(OptionsGame.SelectPlayers, 'OptionsGameSelectPlayers'); - ThemeLoadSelect(OptionsGame.SelectDifficulty, 'OptionsGameSelectDifficulty'); - ThemeLoadSelectSlide(OptionsGame.SelectLanguage, 'OptionsGameSelectSlideLanguage'); - ThemeLoadSelect(OptionsGame.SelectTabs, 'OptionsGameSelectTabs'); - ThemeLoadSelectSlide(OptionsGame.SelectSorting, 'OptionsGameSelectSlideSorting'); - ThemeLoadSelect(OptionsGame.SelectDebug, 'OptionsGameSelectDebug'); - ThemeLoadButton(OptionsGame.ButtonExit, 'OptionsGameButtonExit'); - - // Options Graphics - ThemeLoadBasic(OptionsGraphics, 'OptionsGraphics'); - - ThemeLoadSelect(OptionsGraphics.SelectFullscreen, 'OptionsGraphicsSelectFullscreen'); - ThemeLoadSelectSlide(OptionsGraphics.SelectSlideResolution, 'OptionsGraphicsSelectSlideResolution'); - ThemeLoadSelect(OptionsGraphics.SelectDepth, 'OptionsGraphicsSelectDepth'); - ThemeLoadSelect(OptionsGraphics.SelectOscilloscope, 'OptionsGraphicsSelectOscilloscope'); - ThemeLoadSelect(OptionsGraphics.SelectLineBonus, 'OptionsGraphicsSelectLineBonus'); - ThemeLoadSelect(OptionsGraphics.SelectMovieSize, 'OptionsGraphicsSelectMovieSize'); - ThemeLoadButton(OptionsGraphics.ButtonExit, 'OptionsGraphicsButtonExit'); - - // Options Sound - ThemeLoadBasic(OptionsSound, 'OptionsSound'); - - ThemeLoadSelect(OptionsSound.SelectMicBoost, 'OptionsSoundSelectMicBoost'); - ThemeLoadSelect(OptionsSound.SelectClickAssist, 'OptionsSoundSelectClickAssist'); - ThemeLoadSelect(OptionsSound.SelectBeatClick, 'OptionsSoundSelectBeatClick'); - ThemeLoadSelect(OptionsSound.SelectThreshold, 'OptionsSoundSelectThreshold'); - //ThemeLoadSelect(OptionsSound.SelectTwoPlayerMode, 'OptionsSoundSelectTwoPlayerMode'); - ThemeLoadButton(OptionsSound.ButtonExit, 'OptionsSoundButtonExit'); - - // Options Lyrics - ThemeLoadBasic(OptionsLyrics, 'OptionsLyrics'); - - ThemeLoadSelect(OptionsLyrics.SelectLyricsFont, 'OptionsLyricsSelectLyricsFont'); - ThemeLoadSelect(OptionsLyrics.SelectLyricsEffect, 'OptionsLyricsSelectLyricsEffect'); - ThemeLoadSelect(OptionsLyrics.SelectSolmization, 'OptionsLyricsSelectSolmization'); - ThemeLoadButton(OptionsLyrics.ButtonExit, 'OptionsLyricsButtonExit'); - - // Options Themes - ThemeLoadBasic(OptionsThemes, 'OptionsThemes'); + // Options + ThemeLoadBasic(Options, 'Options'); + + ThemeLoadButton(Options.ButtonGame, 'OptionsButtonGame'); + ThemeLoadButton(Options.ButtonGraphics, 'OptionsButtonGraphics'); + ThemeLoadButton(Options.ButtonSound, 'OptionsButtonSound'); + ThemeLoadButton(Options.ButtonLyrics, 'OptionsButtonLyrics'); + ThemeLoadButton(Options.ButtonThemes, 'OptionsButtonThemes'); + ThemeLoadButton(Options.ButtonRecord, 'OptionsButtonRecord'); + ThemeLoadButton(Options.ButtonAdvanced, 'OptionsButtonAdvanced'); + ThemeLoadButton(Options.ButtonExit, 'OptionsButtonExit'); + + {{$IFDEF TRANSLATE} + Options.Description[0] := Language.Translate('SING_OPTIONS_GAME'); + Options.Description[1] := Language.Translate('SING_OPTIONS_GRAPHICS'); + Options.Description[2] := Language.Translate('SING_OPTIONS_SOUND'); + Options.Description[3] := Language.Translate('SING_OPTIONS_LYRICS'); + Options.Description[4] := Language.Translate('SING_OPTIONS_THEMES'); + Options.Description[5] := Language.Translate('SING_OPTIONS_RECORD'); + Options.Description[6] := Language.Translate('SING_OPTIONS_ADVANCED'); + Options.Description[7] := Language.Translate('SING_OPTIONS_EXIT'); + {{$ENDIF} + + ThemeLoadText(Options.TextDescription, 'OptionsTextDescription'); + Options.TextDescription.Text := Options.Description[0]; + + // Options Game + ThemeLoadBasic(OptionsGame, 'OptionsGame'); + + ThemeLoadSelect(OptionsGame.SelectPlayers, 'OptionsGameSelectPlayers'); + ThemeLoadSelect(OptionsGame.SelectDifficulty, 'OptionsGameSelectDifficulty'); + ThemeLoadSelectSlide(OptionsGame.SelectLanguage, 'OptionsGameSelectSlideLanguage'); + ThemeLoadSelect(OptionsGame.SelectTabs, 'OptionsGameSelectTabs'); + ThemeLoadSelectSlide(OptionsGame.SelectSorting, 'OptionsGameSelectSlideSorting'); + ThemeLoadSelect(OptionsGame.SelectDebug, 'OptionsGameSelectDebug'); + ThemeLoadButton(OptionsGame.ButtonExit, 'OptionsGameButtonExit'); + + // Options Graphics + ThemeLoadBasic(OptionsGraphics, 'OptionsGraphics'); + + ThemeLoadSelect(OptionsGraphics.SelectFullscreen, 'OptionsGraphicsSelectFullscreen'); + ThemeLoadSelectSlide(OptionsGraphics.SelectSlideResolution, 'OptionsGraphicsSelectSlideResolution'); + ThemeLoadSelect(OptionsGraphics.SelectDepth, 'OptionsGraphicsSelectDepth'); + ThemeLoadSelect(OptionsGraphics.SelectOscilloscope, 'OptionsGraphicsSelectOscilloscope'); + ThemeLoadSelect(OptionsGraphics.SelectLineBonus, 'OptionsGraphicsSelectLineBonus'); + ThemeLoadSelect(OptionsGraphics.SelectMovieSize, 'OptionsGraphicsSelectMovieSize'); + ThemeLoadButton(OptionsGraphics.ButtonExit, 'OptionsGraphicsButtonExit'); + + // Options Sound + ThemeLoadBasic(OptionsSound, 'OptionsSound'); + + ThemeLoadSelect(OptionsSound.SelectMicBoost, 'OptionsSoundSelectMicBoost'); + ThemeLoadSelect(OptionsSound.SelectClickAssist, 'OptionsSoundSelectClickAssist'); + ThemeLoadSelect(OptionsSound.SelectBeatClick, 'OptionsSoundSelectBeatClick'); + ThemeLoadSelect(OptionsSound.SelectThreshold, 'OptionsSoundSelectThreshold'); + //ThemeLoadSelect(OptionsSound.SelectTwoPlayerMode, 'OptionsSoundSelectTwoPlayerMode'); + ThemeLoadButton(OptionsSound.ButtonExit, 'OptionsSoundButtonExit'); + + // Options Lyrics + ThemeLoadBasic(OptionsLyrics, 'OptionsLyrics'); + + ThemeLoadSelect(OptionsLyrics.SelectLyricsFont, 'OptionsLyricsSelectLyricsFont'); + ThemeLoadSelect(OptionsLyrics.SelectLyricsEffect, 'OptionsLyricsSelectLyricsEffect'); + ThemeLoadSelect(OptionsLyrics.SelectSolmization, 'OptionsLyricsSelectSolmization'); + ThemeLoadButton(OptionsLyrics.ButtonExit, 'OptionsLyricsButtonExit'); + + // Options Themes + ThemeLoadBasic(OptionsThemes, 'OptionsThemes'); ThemeLoadSelectSlide(OptionsThemes.SelectTheme, 'OptionsThemesSelectTheme'); ThemeLoadSelectSlide(OptionsThemes.SelectSkin, 'OptionsThemesSelectSkin'); @@ -1020,147 +1035,158 @@ begin ThemeLoadSelectSlide(OptionsRecord.SelectSlideChannelR, 'OptionsRecordSelectSlideChannelR'); ThemeLoadButton(OptionsRecord.ButtonExit, 'OptionsRecordButtonExit'); - //Song Menu - ThemeLoadBasic (SongMenu, 'SongMenu'); - ThemeLoadButton(SongMenu.Button1, 'SongMenuButton1'); - ThemeLoadButton(SongMenu.Button2, 'SongMenuButton2'); - ThemeLoadButton(SongMenu.Button3, 'SongMenuButton3'); - ThemeLoadButton(SongMenu.Button4, 'SongMenuButton4'); - ThemeLoadSelectSlide(SongMenu.SelectSlide3, 'SongMenuSelectSlide3'); - - ThemeLoadText(SongMenu.TextMenu, 'SongMenuTextMenu'); - - //Song Jumpto - ThemeLoadBasic (SongJumpto, 'SongJumpto'); - ThemeLoadButton(SongJumpto.ButtonSearchText, 'SongJumptoButtonSearchText'); - ThemeLoadSelectSlide(SongJumpto.SelectSlideType, 'SongJumptoSelectSlideType'); - ThemeLoadText(SongJumpto.TextFound, 'SongJumptoTextFound'); - //Translations - SongJumpto.IType[0] := Language.Translate('SONG_JUMPTO_TYPE1'); - SongJumpto.IType[1] := Language.Translate('SONG_JUMPTO_TYPE2'); - SongJumpto.IType[2] := Language.Translate('SONG_JUMPTO_TYPE3'); - SongJumpto.SongsFound := Language.Translate('SONG_JUMPTO_SONGSFOUND'); - SongJumpto.NoSongsFound := Language.Translate('SONG_JUMPTO_NOSONGSFOUND'); - SongJumpto.CatText := Language.Translate('SONG_JUMPTO_CATTEXT'); + //Options Advanced + ThemeLoadBasic(OptionsAdvanced, 'OptionsAdvanced'); + + ThemeLoadSelect (OptionsAdvanced.SelectLoadAnimation, 'OptionsAdvancedSelectLoadAnimation'); + ThemeLoadSelect (OptionsAdvanced.SelectEffectPerfect, 'OptionsAdvancedSelectEffectPerfect'); + ThemeLoadSelect (OptionsAdvanced.SelectEffectGolden, 'OptionsAdvancedSelectEffectGolden'); + ThemeLoadSelect (OptionsAdvanced.SelectLineBonus, 'OptionsAdvancedSelectLineBonus'); + ThemeLoadSelectSlide (OptionsAdvanced.SelectOnSongClick, 'OptionsAdvancedSelectSlideOnSongClick'); + ThemeLoadSelect (OptionsAdvanced.SelectAskbeforeDel, 'OptionsAdvancedSelectAskbeforeDel'); + ThemeLoadButton (OptionsAdvanced.ButtonExit, 'OptionsAdvancedButtonExit'); + + //Song Menu + ThemeLoadBasic (SongMenu, 'SongMenu'); + ThemeLoadButton(SongMenu.Button1, 'SongMenuButton1'); + ThemeLoadButton(SongMenu.Button2, 'SongMenuButton2'); + ThemeLoadButton(SongMenu.Button3, 'SongMenuButton3'); + ThemeLoadButton(SongMenu.Button4, 'SongMenuButton4'); + ThemeLoadSelectSlide(SongMenu.SelectSlide3, 'SongMenuSelectSlide3'); + + ThemeLoadText(SongMenu.TextMenu, 'SongMenuTextMenu'); + + //Song Jumpto + ThemeLoadBasic (SongJumpto, 'SongJumpto'); + ThemeLoadButton(SongJumpto.ButtonSearchText, 'SongJumptoButtonSearchText'); + ThemeLoadSelectSlide(SongJumpto.SelectSlideType, 'SongJumptoSelectSlideType'); + ThemeLoadText(SongJumpto.TextFound, 'SongJumptoTextFound'); + //Translations + SongJumpto.IType[0] := Language.Translate('SONG_JUMPTO_TYPE1'); + SongJumpto.IType[1] := Language.Translate('SONG_JUMPTO_TYPE2'); + SongJumpto.IType[2] := Language.Translate('SONG_JUMPTO_TYPE3'); + SongJumpto.SongsFound := Language.Translate('SONG_JUMPTO_SONGSFOUND'); + SongJumpto.NoSongsFound := Language.Translate('SONG_JUMPTO_NOSONGSFOUND'); + SongJumpto.CatText := Language.Translate('SONG_JUMPTO_CATTEXT'); + + //Party Screens: + //Party NewRound + ThemeLoadBasic(PartyNewRound, 'PartyNewRound'); + + ThemeLoadText (PartyNewRound.TextRound1, 'PartyNewRoundTextRound1'); + ThemeLoadText (PartyNewRound.TextRound2, 'PartyNewRoundTextRound2'); + ThemeLoadText (PartyNewRound.TextRound3, 'PartyNewRoundTextRound3'); + ThemeLoadText (PartyNewRound.TextRound4, 'PartyNewRoundTextRound4'); + ThemeLoadText (PartyNewRound.TextRound5, 'PartyNewRoundTextRound5'); + ThemeLoadText (PartyNewRound.TextRound6, 'PartyNewRoundTextRound6'); + ThemeLoadText (PartyNewRound.TextRound7, 'PartyNewRoundTextRound7'); + ThemeLoadText (PartyNewRound.TextWinner1, 'PartyNewRoundTextWinner1'); + ThemeLoadText (PartyNewRound.TextWinner2, 'PartyNewRoundTextWinner2'); + ThemeLoadText (PartyNewRound.TextWinner3, 'PartyNewRoundTextWinner3'); + ThemeLoadText (PartyNewRound.TextWinner4, 'PartyNewRoundTextWinner4'); + ThemeLoadText (PartyNewRound.TextWinner5, 'PartyNewRoundTextWinner5'); + ThemeLoadText (PartyNewRound.TextWinner6, 'PartyNewRoundTextWinner6'); + ThemeLoadText (PartyNewRound.TextWinner7, 'PartyNewRoundTextWinner7'); + ThemeLoadText (PartyNewRound.TextNextRound, 'PartyNewRoundTextNextRound'); + ThemeLoadText (PartyNewRound.TextNextRoundNo, 'PartyNewRoundTextNextRoundNo'); + ThemeLoadText (PartyNewRound.TextNextPlayer1, 'PartyNewRoundTextNextPlayer1'); + ThemeLoadText (PartyNewRound.TextNextPlayer2, 'PartyNewRoundTextNextPlayer2'); + ThemeLoadText (PartyNewRound.TextNextPlayer3, 'PartyNewRoundTextNextPlayer3'); + + ThemeLoadStatic (PartyNewRound.StaticRound1, 'PartyNewRoundStaticRound1'); + ThemeLoadStatic (PartyNewRound.StaticRound2, 'PartyNewRoundStaticRound2'); + ThemeLoadStatic (PartyNewRound.StaticRound3, 'PartyNewRoundStaticRound3'); + ThemeLoadStatic (PartyNewRound.StaticRound4, 'PartyNewRoundStaticRound4'); + ThemeLoadStatic (PartyNewRound.StaticRound5, 'PartyNewRoundStaticRound5'); + ThemeLoadStatic (PartyNewRound.StaticRound6, 'PartyNewRoundStaticRound6'); + ThemeLoadStatic (PartyNewRound.StaticRound7, 'PartyNewRoundStaticRound7'); + + ThemeLoadText (PartyNewRound.TextScoreTeam1, 'PartyNewRoundTextScoreTeam1'); + ThemeLoadText (PartyNewRound.TextScoreTeam2, 'PartyNewRoundTextScoreTeam2'); + ThemeLoadText (PartyNewRound.TextScoreTeam3, 'PartyNewRoundTextScoreTeam3'); + ThemeLoadText (PartyNewRound.TextNameTeam1, 'PartyNewRoundTextNameTeam1'); + ThemeLoadText (PartyNewRound.TextNameTeam2, 'PartyNewRoundTextNameTeam2'); + ThemeLoadText (PartyNewRound.TextNameTeam3, 'PartyNewRoundTextNameTeam3'); + + ThemeLoadStatic (PartyNewRound.StaticTeam1, 'PartyNewRoundStaticTeam1'); + ThemeLoadStatic (PartyNewRound.StaticTeam2, 'PartyNewRoundStaticTeam2'); + ThemeLoadStatic (PartyNewRound.StaticTeam3, 'PartyNewRoundStaticTeam3'); + + ThemeLoadButton (PartyNewRound.ButtonNext, 'PartyNewRoundButtonNext'); + + //Party Score + ThemeLoadBasic(PartyScore, 'PartyScore'); + + ThemeLoadText (PartyScore.TextScoreTeam1, 'PartyScoreTextScoreTeam1'); + ThemeLoadText (PartyScore.TextScoreTeam2, 'PartyScoreTextScoreTeam2'); + ThemeLoadText (PartyScore.TextScoreTeam3, 'PartyScoreTextScoreTeam3'); + ThemeLoadText (PartyScore.TextNameTeam1, 'PartyScoreTextNameTeam1'); + ThemeLoadText (PartyScore.TextNameTeam2, 'PartyScoreTextNameTeam2'); + ThemeLoadText (PartyScore.TextNameTeam3, 'PartyScoreTextNameTeam3'); + + ThemeLoadStatic (PartyScore.StaticTeam1, 'PartyScoreStaticTeam1'); + ThemeLoadStatic (PartyScore.StaticTeam2, 'PartyScoreStaticTeam2'); + ThemeLoadStatic (PartyScore.StaticTeam3, 'PartyScoreStaticTeam3'); + + ThemeLoadText (PartyScore.TextWinner, 'PartyScoreTextWinner'); + + //Party Win + ThemeLoadBasic(PartyWin, 'PartyWin'); + + ThemeLoadText (PartyWin.TextScoreTeam1, 'PartyWinTextScoreTeam1'); + ThemeLoadText (PartyWin.TextScoreTeam2, 'PartyWinTextScoreTeam2'); + ThemeLoadText (PartyWin.TextScoreTeam3, 'PartyWinTextScoreTeam3'); + ThemeLoadText (PartyWin.TextNameTeam1, 'PartyWinTextNameTeam1'); + ThemeLoadText (PartyWin.TextNameTeam2, 'PartyWinTextNameTeam2'); + ThemeLoadText (PartyWin.TextNameTeam3, 'PartyWinTextNameTeam3'); + + ThemeLoadStatic (PartyWin.StaticTeam1, 'PartyWinStaticTeam1'); + ThemeLoadStatic (PartyWin.StaticTeam2, 'PartyWinStaticTeam2'); + ThemeLoadStatic (PartyWin.StaticTeam3, 'PartyWinStaticTeam3'); + + ThemeLoadText (PartyWin.TextWinner, 'PartyWinTextWinner'); + + //Party Options + ThemeLoadBasic(PartyOptions, 'PartyOptions'); + ThemeLoadSelectSlide(PartyOptions.SelectLevel, 'PartyOptionsSelectLevel'); + ThemeLoadSelectSlide(PartyOptions.SelectPlayList, 'PartyOptionsSelectPlayList'); + ThemeLoadSelectSlide(PartyOptions.SelectPlayList2, 'PartyOptionsSelectPlayList2'); + ThemeLoadSelectSlide(PartyOptions.SelectRounds, 'PartyOptionsSelectRounds'); + ThemeLoadSelectSlide(PartyOptions.SelectTeams, 'PartyOptionsSelectTeams'); + ThemeLoadSelectSlide(PartyOptions.SelectPlayers1, 'PartyOptionsSelectPlayers1'); + ThemeLoadSelectSlide(PartyOptions.SelectPlayers2, 'PartyOptionsSelectPlayers2'); + ThemeLoadSelectSlide(PartyOptions.SelectPlayers3, 'PartyOptionsSelectPlayers3'); + + {ThemeLoadButton (ButtonNext, 'ButtonNext'); + ThemeLoadButton (ButtonPrev, 'ButtonPrev');} + + //Party Player + ThemeLoadBasic(PartyPlayer, 'PartyPlayer'); + ThemeLoadButton(PartyPlayer.Team1Name, 'PartyPlayerTeam1Name'); + ThemeLoadButton(PartyPlayer.Player1Name, 'PartyPlayerPlayer1Name'); + ThemeLoadButton(PartyPlayer.Player2Name, 'PartyPlayerPlayer2Name'); + ThemeLoadButton(PartyPlayer.Player3Name, 'PartyPlayerPlayer3Name'); + ThemeLoadButton(PartyPlayer.Player4Name, 'PartyPlayerPlayer4Name'); + + ThemeLoadButton(PartyPlayer.Team2Name, 'PartyPlayerTeam2Name'); + ThemeLoadButton(PartyPlayer.Player5Name, 'PartyPlayerPlayer5Name'); + ThemeLoadButton(PartyPlayer.Player6Name, 'PartyPlayerPlayer6Name'); + ThemeLoadButton(PartyPlayer.Player7Name, 'PartyPlayerPlayer7Name'); + ThemeLoadButton(PartyPlayer.Player8Name, 'PartyPlayerPlayer8Name'); + + ThemeLoadButton(PartyPlayer.Team3Name, 'PartyPlayerTeam3Name'); + ThemeLoadButton(PartyPlayer.Player9Name, 'PartyPlayerPlayer9Name'); + ThemeLoadButton(PartyPlayer.Player10Name, 'PartyPlayerPlayer10Name'); + ThemeLoadButton(PartyPlayer.Player11Name, 'PartyPlayerPlayer11Name'); + ThemeLoadButton(PartyPlayer.Player12Name, 'PartyPlayerPlayer12Name'); + + {ThemeLoadButton(ButtonNext, 'PartyPlayerButtonNext'); + ThemeLoadButton(ButtonPrev, 'PartyPlayerButtonPrev');} + + //Playlist Translations + Playlist.CatText := Language.Translate('PLAYLIST_CATTEXT') + end; - //Party Screens: - //Party NewRound - ThemeLoadBasic(PartyNewRound, 'PartyNewRound'); - - ThemeLoadText (PartyNewRound.TextRound1, 'PartyNewRoundTextRound1'); - ThemeLoadText (PartyNewRound.TextRound2, 'PartyNewRoundTextRound2'); - ThemeLoadText (PartyNewRound.TextRound3, 'PartyNewRoundTextRound3'); - ThemeLoadText (PartyNewRound.TextRound4, 'PartyNewRoundTextRound4'); - ThemeLoadText (PartyNewRound.TextRound5, 'PartyNewRoundTextRound5'); - ThemeLoadText (PartyNewRound.TextRound6, 'PartyNewRoundTextRound6'); - ThemeLoadText (PartyNewRound.TextRound7, 'PartyNewRoundTextRound7'); - ThemeLoadText (PartyNewRound.TextWinner1, 'PartyNewRoundTextWinner1'); - ThemeLoadText (PartyNewRound.TextWinner2, 'PartyNewRoundTextWinner2'); - ThemeLoadText (PartyNewRound.TextWinner3, 'PartyNewRoundTextWinner3'); - ThemeLoadText (PartyNewRound.TextWinner4, 'PartyNewRoundTextWinner4'); - ThemeLoadText (PartyNewRound.TextWinner5, 'PartyNewRoundTextWinner5'); - ThemeLoadText (PartyNewRound.TextWinner6, 'PartyNewRoundTextWinner6'); - ThemeLoadText (PartyNewRound.TextWinner7, 'PartyNewRoundTextWinner7'); - ThemeLoadText (PartyNewRound.TextNextRound, 'PartyNewRoundTextNextRound'); - ThemeLoadText (PartyNewRound.TextNextRoundNo, 'PartyNewRoundTextNextRoundNo'); - ThemeLoadText (PartyNewRound.TextNextPlayer1, 'PartyNewRoundTextNextPlayer1'); - ThemeLoadText (PartyNewRound.TextNextPlayer2, 'PartyNewRoundTextNextPlayer2'); - ThemeLoadText (PartyNewRound.TextNextPlayer3, 'PartyNewRoundTextNextPlayer3'); - - ThemeLoadStatic (PartyNewRound.StaticRound1, 'PartyNewRoundStaticRound1'); - ThemeLoadStatic (PartyNewRound.StaticRound2, 'PartyNewRoundStaticRound2'); - ThemeLoadStatic (PartyNewRound.StaticRound3, 'PartyNewRoundStaticRound3'); - ThemeLoadStatic (PartyNewRound.StaticRound4, 'PartyNewRoundStaticRound4'); - ThemeLoadStatic (PartyNewRound.StaticRound5, 'PartyNewRoundStaticRound5'); - ThemeLoadStatic (PartyNewRound.StaticRound6, 'PartyNewRoundStaticRound6'); - ThemeLoadStatic (PartyNewRound.StaticRound7, 'PartyNewRoundStaticRound7'); - - ThemeLoadText (PartyNewRound.TextScoreTeam1, 'PartyNewRoundTextScoreTeam1'); - ThemeLoadText (PartyNewRound.TextScoreTeam2, 'PartyNewRoundTextScoreTeam2'); - ThemeLoadText (PartyNewRound.TextScoreTeam3, 'PartyNewRoundTextScoreTeam3'); - ThemeLoadText (PartyNewRound.TextNameTeam1, 'PartyNewRoundTextNameTeam1'); - ThemeLoadText (PartyNewRound.TextNameTeam2, 'PartyNewRoundTextNameTeam2'); - ThemeLoadText (PartyNewRound.TextNameTeam3, 'PartyNewRoundTextNameTeam3'); - - ThemeLoadStatic (PartyNewRound.StaticTeam1, 'PartyNewRoundStaticTeam1'); - ThemeLoadStatic (PartyNewRound.StaticTeam2, 'PartyNewRoundStaticTeam2'); - ThemeLoadStatic (PartyNewRound.StaticTeam3, 'PartyNewRoundStaticTeam3'); - - ThemeLoadButton (PartyNewRound.ButtonNext, 'PartyNewRoundButtonNext'); - - //Party Score - ThemeLoadBasic(PartyScore, 'PartyScore'); - - ThemeLoadText (PartyScore.TextScoreTeam1, 'PartyScoreTextScoreTeam1'); - ThemeLoadText (PartyScore.TextScoreTeam2, 'PartyScoreTextScoreTeam2'); - ThemeLoadText (PartyScore.TextScoreTeam3, 'PartyScoreTextScoreTeam3'); - ThemeLoadText (PartyScore.TextNameTeam1, 'PartyScoreTextNameTeam1'); - ThemeLoadText (PartyScore.TextNameTeam2, 'PartyScoreTextNameTeam2'); - ThemeLoadText (PartyScore.TextNameTeam3, 'PartyScoreTextNameTeam3'); - - ThemeLoadStatic (PartyScore.StaticTeam1, 'PartyScoreStaticTeam1'); - ThemeLoadStatic (PartyScore.StaticTeam2, 'PartyScoreStaticTeam2'); - ThemeLoadStatic (PartyScore.StaticTeam3, 'PartyScoreStaticTeam3'); - - ThemeLoadText (PartyScore.TextWinner, 'PartyScoreTextWinner'); - - //Party Win - ThemeLoadBasic(PartyWin, 'PartyWin'); - - ThemeLoadText (PartyWin.TextScoreTeam1, 'PartyWinTextScoreTeam1'); - ThemeLoadText (PartyWin.TextScoreTeam2, 'PartyWinTextScoreTeam2'); - ThemeLoadText (PartyWin.TextScoreTeam3, 'PartyWinTextScoreTeam3'); - ThemeLoadText (PartyWin.TextNameTeam1, 'PartyWinTextNameTeam1'); - ThemeLoadText (PartyWin.TextNameTeam2, 'PartyWinTextNameTeam2'); - ThemeLoadText (PartyWin.TextNameTeam3, 'PartyWinTextNameTeam3'); - - ThemeLoadStatic (PartyWin.StaticTeam1, 'PartyWinStaticTeam1'); - ThemeLoadStatic (PartyWin.StaticTeam2, 'PartyWinStaticTeam2'); - ThemeLoadStatic (PartyWin.StaticTeam3, 'PartyWinStaticTeam3'); - - ThemeLoadText (PartyWin.TextWinner, 'PartyWinTextWinner'); - - //Party Options - ThemeLoadBasic(PartyOptions, 'PartyOptions'); - ThemeLoadSelectSlide(PartyOptions.SelectLevel, 'PartyOptionsSelectLevel'); - ThemeLoadSelectSlide(PartyOptions.SelectPlayList, 'PartyOptionsSelectPlayList'); - ThemeLoadSelectSlide(PartyOptions.SelectPlayList2, 'PartyOptionsSelectPlayList2'); - ThemeLoadSelectSlide(PartyOptions.SelectRounds, 'PartyOptionsSelectRounds'); - ThemeLoadSelectSlide(PartyOptions.SelectTeams, 'PartyOptionsSelectTeams'); - ThemeLoadSelectSlide(PartyOptions.SelectPlayers1, 'PartyOptionsSelectPlayers1'); - ThemeLoadSelectSlide(PartyOptions.SelectPlayers2, 'PartyOptionsSelectPlayers2'); - ThemeLoadSelectSlide(PartyOptions.SelectPlayers3, 'PartyOptionsSelectPlayers3'); - - {ThemeLoadButton (ButtonNext, 'ButtonNext'); - ThemeLoadButton (ButtonPrev, 'ButtonPrev');} - - //Party Player - ThemeLoadBasic(PartyPlayer, 'PartyPlayer'); - ThemeLoadButton(PartyPlayer.Team1Name, 'PartyPlayerTeam1Name'); - ThemeLoadButton(PartyPlayer.Player1Name, 'PartyPlayerPlayer1Name'); - ThemeLoadButton(PartyPlayer.Player2Name, 'PartyPlayerPlayer2Name'); - ThemeLoadButton(PartyPlayer.Player3Name, 'PartyPlayerPlayer3Name'); - ThemeLoadButton(PartyPlayer.Player4Name, 'PartyPlayerPlayer4Name'); - - ThemeLoadButton(PartyPlayer.Team2Name, 'PartyPlayerTeam2Name'); - ThemeLoadButton(PartyPlayer.Player5Name, 'PartyPlayerPlayer5Name'); - ThemeLoadButton(PartyPlayer.Player6Name, 'PartyPlayerPlayer6Name'); - ThemeLoadButton(PartyPlayer.Player7Name, 'PartyPlayerPlayer7Name'); - ThemeLoadButton(PartyPlayer.Player8Name, 'PartyPlayerPlayer8Name'); - - ThemeLoadButton(PartyPlayer.Team3Name, 'PartyPlayerTeam3Name'); - ThemeLoadButton(PartyPlayer.Player9Name, 'PartyPlayerPlayer9Name'); - ThemeLoadButton(PartyPlayer.Player10Name, 'PartyPlayerPlayer10Name'); - ThemeLoadButton(PartyPlayer.Player11Name, 'PartyPlayerPlayer11Name'); - ThemeLoadButton(PartyPlayer.Player12Name, 'PartyPlayerPlayer12Name'); - - {ThemeLoadButton(ButtonNext, 'PartyPlayerButtonNext'); - ThemeLoadButton(ButtonPrev, 'PartyPlayerButtonPrev');} - - //Playlist Translations - Playlist.CatText := Language.Translate('PLAYLIST_CATTEXT') - end; - ThemeIni.Free; end; end; diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 52cd0b26..6094edd1 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -1096,6 +1096,8 @@ begin MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table MidiOut.Open; + //MidiOut.SetVolume(65535, 65535); + CzyscNuty; @@ -1113,7 +1115,7 @@ begin Music.Open(Path + AktSong.Mp3); //Set Down Music Volume for Better hearability of Midi Sounds - Music.SetVolume(40); + //Music.SetVolume(40); Lyric.Clear; Lyric.X := 400; diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas index f24b29c1..2a8d0d9a 100644 --- a/Game/Code/Screens/UScreenOptions.pas +++ b/Game/Code/Screens/UScreenOptions.pas @@ -70,6 +70,11 @@ begin end; if SelInteraction = 6 then begin + Music.PlayStart; + FadeTo(@ScreenOptionsAdvanced); + end; + + if SelInteraction = 7 then begin Ini.Save; Music.PlayBack; FadeTo(@ScreenMain); @@ -182,10 +187,14 @@ begin if (Length(Button[5].Text)=0) then AddButtonText(14, 20, Theme.Options.Description[5]); - AddButton(Theme.Options.ButtonExit); + AddButton(Theme.Options.ButtonAdvanced); if (Length(Button[6].Text)=0) then AddButtonText(14, 20, Theme.Options.Description[6]); + AddButton(Theme.Options.ButtonExit); + if (Length(Button[7].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[7]); + for I := 0 to High(Theme.Options.Static) do AddStatic(Theme.Options.Static[I]); diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas new file mode 100644 index 00000000..bfbd54a7 --- /dev/null +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -0,0 +1,95 @@ +unit UScreenOptionsAdvanced; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + +type + TScreenOptionsAdvanced = class(TMenu) + public + constructor Create(Back: String); override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + end; + +implementation + +uses UGraphic; + +function TScreenOptionsAdvanced.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_ESCAPE : + begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 6 then begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + Music.PlayOption; + InteractInc; + end; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + Music.PlayOption; + InteractDec; + end; + end; + end; + end; +end; + +constructor TScreenOptionsAdvanced.Create(Back: String); +var + I: integer; +begin + inherited Create(Back); + + AddBackground(Theme.OptionsAdvanced.Background.Tex); + + for I := 0 to High(Theme.OptionsAdvanced.Static) do + AddStatic(Theme.OptionsAdvanced.Static[I]); + + for I := 0 to High(Theme.OptionsAdvanced.Text) do + AddText(Theme.OptionsAdvanced.Text[I]); + + AddSelect(Theme.OptionsAdvanced.SelectLoadAnimation, Ini.LoadAnimation, ILoadAnimation); + AddSelect(Theme.OptionsAdvanced.SelectEffectPerfect, Ini.EffectPerfect, IEffectPerfect); + AddSelect(Theme.OptionsAdvanced.SelectEffectGolden, Ini.EffectGolden, IEffectGolden); + AddSelect(Theme.OptionsAdvanced.SelectLineBonus, Ini.LineBonus, ILineBonus); + AddSelectSlide(Theme.OptionsAdvanced.SelectOnSongClick, Ini.OnSongClick, IOnSongClick); + AddSelect(Theme.OptionsAdvanced.SelectAskbeforeDel, Ini.AskbeforeDel, IAskbeforeDel); + + AddButton(Theme.OptionsAdvanced.ButtonExit); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[6]); + + Interaction := 0; +end; + +procedure TScreenOptionsAdvanced.onShow; +begin + Interaction := 0; +end; + +end. diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index 62648e0c..d39a10c8 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -84,7 +84,6 @@ begin AddSelect(Theme.OptionsGraphics.SelectFullscreen, Ini.Fullscreen, IFullscreen); AddSelect(Theme.OptionsGraphics.SelectDepth, Ini.Depth, IDepth); AddSelect(Theme.OptionsGraphics.SelectOscilloscope, Ini.Oscilloscope, IOscilloscope); - AddSelect(Theme.OptionsGraphics.SelectLineBonus, Ini.LineBonus, ILineBonus); AddSelect(Theme.OptionsGraphics.SelectMovieSize, Ini.MovieSize, IMovieSize); diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index ee4bedc8..d684dc3c 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1089,18 +1089,12 @@ begin //Generate Steps 0 to 8 A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); + + //Generate Text if A >= 8 then - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_PERFECT') - else if (A = 6) or (A = 7) then - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_BETTER') - else if A = 5 then - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_GOOD') - else if (A = 3) or (A = 4) then - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_NORMAL') - else if A = 2 then - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_BAD') + Player[I].LineBonus_Text := Theme.Sing.LineBonusText[8] else - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_WORST'); + Player[I].LineBonus_Text := Theme.Sing.LineBonusText[Floor(A)]; //PhrasenBonus give Points Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8); diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 0b4a9d91..3ccba228 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -250,7 +250,7 @@ begin Button[3].Visible := False; SelectsS[0].Visible := False; Button[2].Visible := True; - Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING'); + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING'); end; end; @@ -311,7 +311,7 @@ begin Button[3].Visible := False; SelectsS[0].Visible := False; Button[2].Visible := True; - Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING'); + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING'); Interaction := 2; end; end; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 66638832..f36f9a26 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -6,6 +6,9 @@ program UltraStar; {$R 'UltraStar.res' 'UltraStar.rc'} uses + //------------------------------ + //Includes - Menu System + //------------------------------ UDisplay in 'Menu\UDisplay.pas', UMenu in 'Menu\UMenu.pas', UMenuStatic in 'Menu\UMenuStatic.pas', @@ -15,6 +18,10 @@ uses UMenuSelect in 'Menu\UMenuSelect.pas', UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', UDrawTexture in 'Menu\UDrawTexture.pas', + + //------------------------------ + //Includes - Classes + //------------------------------ UGraphic in 'Classes\UGraphic.pas', UTexture in 'Classes\UTexture.pas', UMusic in 'Classes\UMusic.pas', @@ -42,6 +49,11 @@ uses UGraphicClasses in 'Classes\UGraphicClasses.pas', UDLLManager in 'Classes\UDLLManager.pas', UParty in 'Classes\UParty.pas', + UPlaylist in 'Classes\UPlaylist.pas', + + //------------------------------ + //Includes - Screens + //------------------------------ UScreenLoading in 'Screens\UScreenLoading.pas', UScreenWelcome in 'Screens\UScreenWelcome.pas', UScreenMain in 'Screens\UScreenMain.pas', @@ -57,6 +69,7 @@ uses UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', + UScreenOptionsAdvanced in 'Screens\UScreenOptionsAdvanced.pas', UScreenEditSub in 'Screens\UScreenEditSub.pas', UScreenEdit in 'Screens\UScreenEdit.pas', UScreenEditConvert in 'Screens\UScreenEditConvert.pas', @@ -65,17 +78,29 @@ uses UScreenTop5 in 'Screens\UScreenTop5.pas', UScreenSongMenu in 'Screens\UScreenSongMenu.pas', UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', + + //------------------------------ + //Includes - Screens PartyMode + //------------------------------ UScreenSingModi in 'Screens\UScreenSingModi.pas', UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', UScreenPartyScore in 'Screens\UScreenPartyScore.pas', UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', UScreenPartyWin in 'Screens\UScreenPartyWin.pas', + + //------------------------------ + //Includes - Modi SDK + //------------------------------ ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', + + //------------------------------ + //Includes - Delphi + //------------------------------ Windows, SDL, - SysUtils, - UPlaylist in 'Classes\UPlaylist.pas'; + SysUtils; + const Version = 'UltraStar Deluxe V 0.90 Beta'; -- cgit v1.2.3 From 4f7bf28056fefdcd000499c583a47738ce7d9b07 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 6 Apr 2007 10:32:24 +0000 Subject: Fixed a Bug in Optionsscreen after adding OptionsAdvanced Screen Added Jump to Title HotKey (Alt + A..Z) Added Playlist Support to Party Mode, Category Only Mode is still buggy. Fixed: Team3 Players are now Hidden when only 2 Teams are Selected git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@67 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlaylist.pas | 6 +- Game/Code/Screens/UScreenOptionsAdvanced.pas | 2 +- Game/Code/Screens/UScreenOptionsGame.pas | 2 +- Game/Code/Screens/UScreenOptionsGraphics.pas | 2 +- Game/Code/Screens/UScreenOptionsLyrics.pas | 2 +- Game/Code/Screens/UScreenOptionsRecord.pas | 2 +- Game/Code/Screens/UScreenOptionsSound.pas | 2 +- Game/Code/Screens/UScreenOptionsThemes.pas | 2 +- Game/Code/Screens/UScreenPartyOptions.pas | 137 +++++++++++++++++++++++++-- Game/Code/Screens/UScreenSong.pas | 89 +++++++++++------ 10 files changed, 201 insertions(+), 45 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlaylist.pas b/Game/Code/Classes/UPlaylist.pas index 585f9271..a6207c4f 100644 --- a/Game/Code/Classes/UPlaylist.pas +++ b/Game/Code/Classes/UPlaylist.pas @@ -50,8 +50,8 @@ type {Modes: 0: Standard Mode - 1: PlayList Mode - 2: Category Mode} + 1: Category Mode + 2: PlayList Mode} var PlayListMan: TPlaylistManager; @@ -244,7 +244,7 @@ begin //Set CatSongsMode + Playlist Mode CatSongs.CatNumShow := -3; - Mode := 1; + Mode := 2; //Show Cat in Topleft: ScreenSong.ShowCatTLCustom(Format(Theme.Playlist.CatText,[Playlists[Index].Name])); diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index bfbd54a7..7904a284 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -82,7 +82,7 @@ begin AddButton(Theme.OptionsAdvanced.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[6]); + AddButtonText(14, 20, Theme.Options.Description[7]); Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index cc6e850b..63bbec36 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -89,7 +89,7 @@ begin AddButton(Theme.OptionsGame.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[6]); + AddButtonText(14, 20, Theme.Options.Description[7]); end; diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index d39a10c8..4befb092 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -89,7 +89,7 @@ begin AddButton(Theme.OptionsGraphics.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[6]); + AddButtonText(14, 20, Theme.Options.Description[7]); end; diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas index 0ce5c970..35cb2415 100644 --- a/Game/Code/Screens/UScreenOptionsLyrics.pas +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -80,7 +80,7 @@ begin AddButton(Theme.OptionsLyrics.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[6]); + AddButtonText(14, 20, Theme.Options.Description[7]); end; diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index b4075ba8..e6989d43 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -105,7 +105,7 @@ begin AddButton(Theme.OptionsRecord.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[6]); + AddButtonText(14, 20, Theme.Options.Description[7]); Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index ad6db766..aea6cdbc 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -81,7 +81,7 @@ begin AddButton(Theme.OptionsSound.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[6]); + AddButtonText(14, 20, Theme.Options.Description[7]); Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index eb5ed33e..151913be 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -106,7 +106,7 @@ begin AddButton(Theme.OptionsThemes.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[6]); + AddButtonText(14, 20, Theme.Options.Description[7]); end; procedure TScreenOptionsThemes.onShow; diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 148289e8..042e944f 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -27,10 +27,13 @@ type function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure SetAnimationProgress(Progress: real); override; + procedure SetPlaylist2; end; var ILevel: array[0..2] of String; + IPlaylist: array[0..2] of String; + IPlaylist2: array of String; const ITeams: array[0..1] of String =('2', '3'); IPlayers: array[0..3] of String =('1', '2', '3', '4'); @@ -38,10 +41,42 @@ const implementation -uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UDLLManager; +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UDLLManager, UPlaylist, USongs; function TScreenPartyOptions.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -var I: Integer; + var + I, J: Integer; + + function IsVisible: Boolean; + begin + Result := True; + if (Interactions[Interaction].Typ = 0) then + begin + Result := Button[Interactions[Interaction].Num].Visible; + end + else if (Interactions[Interaction].Typ = 1) then + begin + //Result := Selects[Interactions[Interaction].Num].Visible; + end + else if (Interactions[Interaction].Typ = 3) then + begin + Result := SelectsS[Interactions[Interaction].Num].Visible; + end; + end; + + Procedure SelectNext; + begin + repeat + InteractNext; + until IsVisible; + end; + + Procedure SelectPrev; + begin + repeat + InteractPrev; + until IsVisible; + end; begin Result := true; If (PressedDown) Then @@ -71,6 +106,26 @@ begin PartySession.Teams.Teaminfo[0].NumPlayers := NumPlayer1+1; PartySession.Teams.Teaminfo[1].NumPlayers := NumPlayer2+1; PartySession.Teams.Teaminfo[2].NumPlayers := NumPlayer3+1; + //Save Playlist + PlaylistMan.Mode := Playlist; + //If Category Selected Search Category ID + if Playlist = 1 then + begin + J := -1; + For I := 0 to high(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + Inc(J); + + if J = Playlist2 then + begin + PlaylistMan.CurPlayList := I; + Break; + end; + end; + end + else + PlaylistMan.CurPlayList := Playlist2; //Save Rounds + Random SetLength (PartySession.Rounds, Rounds + 2); For I := 0 to high (PartySession.Rounds) do @@ -86,17 +141,43 @@ begin // Up and Down could be done at the same time, // but I don't want to declare variables inside // functions like this one, called so many times - SDLK_DOWN: InteractNext; - SDLK_UP: InteractPrev; + SDLK_DOWN: SelectNext; + SDLK_UP: SelectPrev; SDLK_RIGHT: begin Music.PlayOption; InteractInc; + + //Change Playlist2 if Playlist is Changed + If (Interaction = 1) then + begin + SetPlaylist2; + end //Change Team3 Players visibility + Else If (Interaction = 4) then + begin + Case NumTeams of + 0: SelectsS[7].Visible := False; + 1: SelectsS[7].Visible := True; + end; + end; end; SDLK_LEFT: begin Music.PlayOption; InteractDec; + + //Change Playlist2 if Playlist is Changed + If (Interaction = 1) then + begin + SetPlaylist2; + end //Change Team3 Players visibility + Else If (Interaction = 4) then + begin + Case NumTeams of + 0: SelectsS[7].Visible := False; + 1: SelectsS[7].Visible := True; + end; + end; end; end; end @@ -119,6 +200,15 @@ begin ILevel[1] := Language.Translate('SING_MEDIUM'); ILevel[2] := Language.Translate('SING_HARD'); + //Fill IPlaylist + IPlaylist[0] := Language.Translate('PARTY_PLAYLIST_ALL'); + IPlaylist[1] := Language.Translate('PARTY_PLAYLIST_CATEGORY'); + IPlaylist[2] := Language.Translate('PARTY_PLAYLIST_PLAYLIST'); + + //Fill IPlaylist2 + SetLength(IPlaylist2, 1); + IPlaylist2[0] := '---'; + NumTeams := 0; NumPlayer1 := 0; NumPlayer2 := 0; @@ -130,8 +220,8 @@ begin AddBackground(Theme.PartyOptions.Background.Tex); SelectLevel := AddSelectSlide (Theme.PartyOptions.SelectLevel, Ini.Difficulty, ILevel); - SelectPlayList := AddSelectSlide (Theme.PartyOptions.SelectPlayList, PlayList, ITeams); - SelectPlayList2 := AddSelectSlide (Theme.PartyOptions.SelectPlayList2, PlayList2, ITeams); + SelectPlayList := AddSelectSlide (Theme.PartyOptions.SelectPlayList, PlayList, IPlaylist); + SelectPlayList2 := AddSelectSlide (Theme.PartyOptions.SelectPlayList2, PlayList2, IPlaylist2); SelectRounds := AddSelectSlide (Theme.PartyOptions.SelectRounds, Rounds, IRounds); SelectTeams := AddSelectSlide (Theme.PartyOptions.SelectTeams, NumTeams, ITeams); SelectPlayers1 := AddSelectSlide (Theme.PartyOptions.SelectPlayers1, NumPlayer1, IPlayers); @@ -145,6 +235,41 @@ begin AddText(Theme.PartyOptions.Text[I]); Interaction := 0; + + //Hide Team3 Players + SelectsS[7].Visible := False; +end; + +procedure TScreenPartyOptions.SetPlaylist2; +var I: Integer; +begin + Case Playlist of + 0: + begin + SetLength(IPlaylist2, 1); + IPlaylist2[0] := '---'; + end; + 1: + begin + SetLength(IPlaylist2, 0); + For I := 0 to high(CatSongs.Song) do + begin + If (CatSongs.Song[I].Main) then + begin + SetLength(IPlaylist2, Length(IPlaylist2) + 1); + IPlaylist2[high(IPlaylist2)] := CatSongs.Song[I].Artist; + end; + end; + end; + 2: + begin + SetLength(IPlaylist2, Length(PlaylistMan.Playlists)); + PlaylistMan.GetNames(IPlaylist2); + end; + end; + + Playlist2 := 0; + UpdateSelectSlideOptions(Theme.PartyOptions.SelectPlayList2, 2, IPlaylist2, Playlist2); end; procedure TScreenPartyOptions.onShow; diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 6a1df197..2af37dd5 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -89,7 +89,7 @@ type end; implementation -uses UGraphic, UMain, UCovers, math, OpenGL12, Windows, USkins, UDLLManager, UParty, UScreenSongMenu; +uses UGraphic, UMain, UCovers, math, OpenGL12, Windows, USkins, UDLLManager, UParty, UPlaylist, UScreenSongMenu; // ***** Public methods ****** // @@ -198,8 +198,8 @@ begin SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); - {//Jump To - if (SDL_ModState = KMOD_LALT) AND (PressedKey > SDLK_A) AND (PressedKey < SDLK_Z) then + //Jump To + if (SDL_ModState = KMOD_LALT) AND (Mode = 0) AND (PressedKey > SDLK_A) AND (PressedKey < SDLK_Z) then begin Letter := UpCase(Chr(ScanCode)); Log.LogError(Letter); @@ -208,7 +208,7 @@ begin begin if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + SkipTo(2 + CatSongs.VisibleIndex((I + Interaction) mod I2)); Music.PlayChange; @@ -220,7 +220,7 @@ begin end; end; Exit; - end; } + end; case PressedKey of SDLK_ESCAPE : @@ -312,7 +312,7 @@ begin SDLK_M: //Show SongMenu begin - if Length(Songs.Song) > 0 then begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin if not CatSongs.Song[Interaction].Main then begin // clicked on Song if CatSongs.CatNumShow = -3 then ScreenSongMenu.MenuShow(SM_Playlist) @@ -328,14 +328,14 @@ begin SDLK_P: //Show Playlist Menu begin - if Length(Songs.Song) > 0 then begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin ScreenSongMenu.MenuShow(SM_Playlist_Load); end; end; SDLK_J: //Show Jumpto Menu begin - if Length(Songs.Song) > 0 then + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin ScreenSongJumpto.Visible := True; end; @@ -1462,34 +1462,65 @@ Procedure TScreenSong.SelectRandomSong; var I, I2: Integer; begin - repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; + Case PlaylistMan.Mode of + 0: //All Songs Just Select Random Song + begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; - //Search Cat - for I := I2 downto low(CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - break; - end; - //In I ist jetzt die Kategorie in I2 der Song + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song - //Choose Cat - CatSongs.ShowCategoryList; + //Choose Cat + CatSongs.ShowCategoryList; - //Show Cat in Top Left Mod - ShowCatTL (I); + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Fix: Not Existing Song selected: + if (I+1=I2) then Inc(I2); + + //Choose Song + SkipTo(I2-I); + end; + 1: //One Category Select Category and Select Random Song + begin + CatSongs.HideCategory(-1); + CatSongs.ShowCategory(PlaylistMan.CurPlayList); + ShowCatTL(PlaylistMan.CurPlayList); - CatSongs.ClickCategoryButton(I); - SelectNext; + SelectNext; + FixSelected; - //Fix: Not Existing Song selected: - if (I+1=I2) then Inc(I2); + SkipTo(2+Random(CatSongs.VisibleSongs-1)); + Music.PlayChange; + ChangeMusic; + SetScroll4; + UpdateLCD; + end; + 2: //Playlist: Select Playlist and Select Random Song + begin + PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); - //Choose Song - SkipTo(I2-I); + SkipTo(2+Random(CatSongs.VisibleSongs-1)); + Music.PlayChange; + ChangeMusic; + SetScroll4; + UpdateLCD; + FixSelected; + end; + end; - ChangeMusic; + ChangeMusic; end; procedure TScreenSong.SetJoker; -- cgit v1.2.3 From ce1d554d8084e549beb20f01c8315b44adff5f3a Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 6 Apr 2007 10:50:31 +0000 Subject: Changed Osci/Bar Standard Value to Bar So the Rating bar is Visible at first Startup git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@68 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UIni.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index 7ab8de99..d5589ea3 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -259,7 +259,7 @@ begin if Tekst = ISingWindow[Pet] then Ini.SingWindow := Pet; // Oscilloscope - Tekst := IniFile.ReadString('Graphics', 'Oscilloscope', 'Off'); + Tekst := IniFile.ReadString('Graphics', 'Oscilloscope', 'Bar'); for Pet := 0 to High(IOscilloscope) do if Tekst = IOscilloscope[Pet] then Ini.Oscilloscope := Pet; -- cgit v1.2.3 From 455c6240e52f751dd7eab10620cecb9fc1711429 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 6 Apr 2007 12:33:21 +0000 Subject: Added Coolie Hat Support to UJoystick Added Axis Support to UJoystick Remapped Buttons git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@69 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UJoystick.pas | 169 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 159 insertions(+), 10 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UJoystick.pas b/Game/Code/Classes/UJoystick.pas index a2a06307..b0c7b8cc 100644 --- a/Game/Code/Classes/UJoystick.pas +++ b/Game/Code/Classes/UJoystick.pas @@ -12,8 +12,17 @@ type Sym: cardinal; end; + TJoyHatState = record + State: Boolean; + LastTick: Cardinal; + Enabled: boolean; + Type_: byte; + Sym: cardinal; + end; + TJoyUnit = record Button: array[0..15] of TJoyButton; + HatState: Array[0..3] of TJoyHatState; end; TJoy = class @@ -29,7 +38,7 @@ var implementation -uses SysUtils; +uses SysUtils, Windows, ULog; constructor TJoy.Create; var @@ -77,13 +86,21 @@ begin //New Sarutas method SDL_JoystickEventState(SDL_IGNORE); SDL_InitSubSystem(SDL_INIT_JOYSTICK); - if SDL_NumJoysticks < 1 then beep; + if SDL_NumJoysticks < 1 then + begin + Log.LogError('No Joystick found'); + exit; + end; - SDL_Joy := SDL_JoystickOpen(0); - if SDL_Joy = nil then beep; + SDL_Joy := SDL_JoystickOpen(0); + if SDL_Joy = nil then + begin + Log.LogError('Could not Init Joystick'); + exit; + end; N := SDL_JoystickNumButtons(SDL_Joy); - if N < 6 then beep; + //if N < 6 then beep; for B := 0 to 5 do begin JoyUnit.Button[B].Enabled := true; @@ -91,21 +108,37 @@ begin JoyUnit.Button[B].Type_ := SDL_KEYDOWN; end; - JoyUnit.Button[0].Sym := SDLK_UP; - JoyUnit.Button[1].Sym := SDLK_RIGHT; - JoyUnit.Button[2].Sym := SDLK_DOWN; - JoyUnit.Button[3].Sym := SDLK_LEFT; + JoyUnit.Button[0].Sym := SDLK_Return; + JoyUnit.Button[1].Sym := SDLK_Escape; + JoyUnit.Button[2].Sym := SDLK_M; + JoyUnit.Button[3].Sym := SDLK_R; JoyUnit.Button[4].Sym := SDLK_RETURN; JoyUnit.Button[5].Sym := SDLK_ESCAPE; + + //Set HatState + for B := 0 to 3 do begin + JoyUnit.HatState[B].Enabled := true; + JoyUnit.HatState[B].State := False; + JoyUnit.HatState[B].Type_ := SDL_KEYDOWN; + end; + + JoyUnit.HatState[0].Sym := SDLK_UP; + JoyUnit.HatState[1].Sym := SDLK_RIGHT; + JoyUnit.HatState[2].Sym := SDLK_DOWN; + JoyUnit.HatState[3].Sym := SDLK_LEFT; end; procedure TJoy.Update; var - B: integer; + B: integer; + State: UInt8; + Tick: Cardinal; + Axes: Smallint; begin SDL_JoystickUpdate; + //Manage Buttons for B := 0 to 15 do begin if (JoyUnit.Button[B].Enabled) and (JoyUnit.Button[B].State <> SDL_JoystickGetButton(SDL_Joy, B)) and (JoyUnit.Button[B].State = 0) then begin JoyEvent.type_ := JoyUnit.Button[B].Type_; @@ -119,6 +152,122 @@ begin JoyUnit.Button[B].State := SDL_JoystickGetButton(SDL_Joy, B); end; + //Get Tick + Tick := Gettickcount; + + //Get CoolieHat + if (SDL_JoystickNumHats(SDL_Joy)>=1) then + State := SDL_JoystickGetHat(SDL_Joy, 0) + else + State := 0; + + //Get Axis + if (SDL_JoystickNumAxes(SDL_Joy)>=2) then + begin + //Down - Up (X- Axis) + Axes := SDL_JoystickGetAxis(SDL_Joy, 1); + If Axes >= 15000 then + State := State or SDL_HAT_Down + Else If Axes <= -15000 then + State := State or SDL_HAT_UP; + + //Left - Right (Y- Axis) + Axes := SDL_JoystickGetAxis(SDL_Joy, 0); + If Axes >= 15000 then + State := State or SDL_HAT_Right + Else If Axes <= -15000 then + State := State or SDL_HAT_Left; + end; + + //Manage Hat and joystick Events + if (SDL_JoystickNumHats(SDL_Joy)>=1) OR (SDL_JoystickNumAxes(SDL_Joy)>=2) then + begin + + //Up Button + If (JoyUnit.HatState[0].Enabled) and ((SDL_HAT_UP AND State) = SDL_HAT_UP) then + begin //IF Button is newly Pressed or if he is Pressed longer than 500 msecs + if (JoyUnit.HatState[0].State = False) OR (JoyUnit.HatState[0].Lasttick < Tick) then + begin + //Set Tick and State + if JoyUnit.HatState[0].State then + JoyUnit.HatState[0].Lasttick := Tick + 200 + else + JoyUnit.HatState[0].Lasttick := Tick + 500; + + JoyUnit.HatState[0].State := True; + + JoyEvent.type_ := JoyUnit.HatState[0].Type_; + JoyEvent.key.keysym.sym := JoyUnit.HatState[0].Sym; + SDL_PushEvent(@JoyEvent); + end; + end + else + JoyUnit.HatState[0].State := False; + + //Right Button + If (JoyUnit.HatState[1].Enabled) and ((SDL_HAT_RIGHT AND State) = SDL_HAT_RIGHT) then + begin //IF Button is newly Pressed or if he is Pressed longer than 500 msecs + if (JoyUnit.HatState[1].State = False) OR (JoyUnit.HatState[1].Lasttick < Tick) then + begin + //Set Tick and State + if JoyUnit.HatState[1].State then + JoyUnit.HatState[1].Lasttick := Tick + 200 + else + JoyUnit.HatState[1].Lasttick := Tick + 500; + + JoyUnit.HatState[1].State := True; + + JoyEvent.type_ := JoyUnit.HatState[1].Type_; + JoyEvent.key.keysym.sym := JoyUnit.HatState[1].Sym; + SDL_PushEvent(@JoyEvent); + end; + end + else + JoyUnit.HatState[1].State := False; + + //Down button + If (JoyUnit.HatState[2].Enabled) and ((SDL_HAT_DOWN AND State) = SDL_HAT_DOWN) then + begin //IF Button is newly Pressed or if he is Pressed longer than 230 msecs + if (JoyUnit.HatState[2].State = False) OR (JoyUnit.HatState[2].Lasttick < Tick) then + begin + //Set Tick and State + if JoyUnit.HatState[2].State then + JoyUnit.HatState[2].Lasttick := Tick + 200 + else + JoyUnit.HatState[2].Lasttick := Tick + 500; + + JoyUnit.HatState[2].State := True; + + JoyEvent.type_ := JoyUnit.HatState[2].Type_; + JoyEvent.key.keysym.sym := JoyUnit.HatState[2].Sym; + SDL_PushEvent(@JoyEvent); + end; + end + else + JoyUnit.HatState[2].State := False; + + //Left Button + If (JoyUnit.HatState[3].Enabled) and ((SDL_HAT_LEFT AND State) = SDL_HAT_LEFT) then + begin //IF Button is newly Pressed or if he is Pressed longer than 230 msecs + if (JoyUnit.HatState[3].State = False) OR (JoyUnit.HatState[3].Lasttick < Tick) then + begin + //Set Tick and State + if JoyUnit.HatState[3].State then + JoyUnit.HatState[3].Lasttick := Tick + 200 + else + JoyUnit.HatState[3].Lasttick := Tick + 500; + + JoyUnit.HatState[3].State := True; + + JoyEvent.type_ := JoyUnit.HatState[3].Type_; + JoyEvent.key.keysym.sym := JoyUnit.HatState[3].Sym; + SDL_PushEvent(@JoyEvent); + end; + end + else + JoyUnit.HatState[3].State := False; + end; + end; end. -- cgit v1.2.3 From dd97441dc46eb52b124edf4e0a2ba6a650867e8e Mon Sep 17 00:00:00 2001 From: mogguh Date: Fri, 6 Apr 2007 17:41:55 +0000 Subject: Feature: Golden notes twinkle now when hit (Bug: if singing is stopped while note was hit (i.e. singer not singing loud enough), then twinkle will not be killed) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@70 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 5 +++++ Game/Code/Classes/UGraphic.pas | 2 +- Game/Code/Classes/UGraphicClasses.pas | 41 ++++++++++++++++++++++++++++++++--- 3 files changed, 44 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index e0e8e941..7447b6bf 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -425,6 +425,11 @@ var end; // with end; // for +// eigentlich brauchen wir hier einen vergleich, um festzustellen, ob wir mit +// singen schon weiter wären, als bei Rec.Right, _auch, wenn nicht gesungen wird_ + with Player[NrGracza].Nuta[N] do + if not (Start+Dlugosc-1 = Czas.AktBeatD) then + GoldenRec.GoldenNoteTwinkle(Rec.Top,Rec.Bottom,Rec.Right); end; // if end; diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 73bb1706..9f3e6667 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -191,7 +191,7 @@ begin end; Tex_Note_Perfect_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePerfectStar')), 'JPG', 'Font Black', 0); - Tex_Note_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteStar')), 'JPG', 'Font Black', 0); + Tex_Note_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteStar')) , 'JPG', 'Alpha Black Colored', $FFFFFF); Tex_Ball := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'BMP', 'Transparent', $FF00FF); diff --git a/Game/Code/Classes/UGraphicClasses.pas b/Game/Code/Classes/UGraphicClasses.pas index d5eb44ab..66264334 100644 --- a/Game/Code/Classes/UGraphicClasses.pas +++ b/Game/Code/Classes/UGraphicClasses.pas @@ -30,6 +30,7 @@ type LastTime : Cardinal; RecArray : Array of RectanglePositions; PerfNoteArray : Array of PerfectNotePositions; + DelayAfterKillall : Integer; constructor Create; procedure Draw; @@ -39,6 +40,7 @@ type procedure KillAll(); procedure SaveGoldenStarsRec(Xtop, Ytop, Xbottom, Ybottom: Real); procedure SavePerfectNotePos(Xtop, Ytop: Real); + procedure GoldenNoteTwinkle(Top,Bottom,Right: Real); end; var GoldenRec : TEffectManager; @@ -64,27 +66,36 @@ var W, H: real; Alpha : real; begin - Alpha := (-cos((Frame+1)*2*pi/16)+1); //Fade Eyecandy + //Fade Eyecandy Case StarType of 1: begin + Alpha := (-cos((Frame+1)*2*pi/16)+1); W := 20; H := 20; glColor4f(0.99, 1, 0.6, Alpha); end; 2: begin + Alpha := (-cos((Frame+1)*2*pi/16)+1); W := 30; H := 30; glColor4f(1, 1, 0.95, Alpha); end; + 3: + begin + Alpha := (Live/3); + W := 15; + H := 15; + glColor4f(1, 1, 0.9, Alpha); + end; end; + glBindTexture(GL_TEXTURE_2D, Tex); glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, Tex); + glEnable(GL_BLEND); begin glBegin(GL_QUADS); @@ -211,6 +222,30 @@ begin SetLength(PerfNoteArray,0); end; +procedure TeffectManager.GoldenNoteTwinkle(Top,Bottom,Right: Real); +//Twinkle stars while golden note hit +var + C, P, XKatze, YKatze: Integer; +begin + DelayAfterKillall:=10; // To be used later, for the screen change issue + For P := 0 to high(RecArray) do // Are we inside a GoldenNoteRectangle? + begin + if ((RecArray[P].xBottom >= Right) and + (RecArray[P].xTop <= Right) and + (RecArray[P].yTop <= (Top+Bottom)/2) and + (RecArray[P].yBottom >= (Top+Bottom)/2)) then + begin + for C := 1 to 8 do + begin + Ykatze := RandomRange(ceil(Top) , ceil(Bottom)); + XKatze := RandomRange(-7,3); + Spawn(Ceil(Right)+XKatze, YKatze, Tex_Note_Star.TexNum, 3, 0, -1, 3); + end; + exit; // found a GoldenRec, did spawning stuff... done + end; + end; +end; + procedure TEffectManager.SaveGoldenStarsRec(Xtop, Ytop, Xbottom, Ybottom: Real); var P : Integer; // P like used in Positions -- cgit v1.2.3 From 4ce8b89fdaf829546449c0d1acab14df80c49d95 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 7 Apr 2007 12:58:11 +0000 Subject: Fixed some Bugs in Effect Engine: Perfect Note Stars was drawn 2 Times Golden Note Extra twinkling stops and is redrawn until next Sentece or Note at the End of the Golden Note. Redrawing of Golden Note Twinkles at the next Sentence git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@71 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 11 ++-- Game/Code/Classes/UGraphicClasses.pas | 99 ++++++++++++++++++++++++----------- Game/Code/Screens/UScreenSing.pas | 8 ++- 3 files changed, 77 insertions(+), 41 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 7447b6bf..952bad07 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -425,11 +425,12 @@ var end; // with end; // for -// eigentlich brauchen wir hier einen vergleich, um festzustellen, ob wir mit -// singen schon weiter wären, als bei Rec.Right, _auch, wenn nicht gesungen wird_ - with Player[NrGracza].Nuta[N] do - if not (Start+Dlugosc-1 = Czas.AktBeatD) then - GoldenRec.GoldenNoteTwinkle(Rec.Top,Rec.Bottom,Rec.Right); + // eigentlich brauchen wir hier einen vergleich, um festzustellen, ob wir mit + // singen schon weiter wären, als bei Rec.Right, _auch, wenn nicht gesungen wird_ + + // passing on NrGracza... hope this is really something like the player-number, not only + // some kind of weird index into a colour-table + GoldenRec.GoldenNoteTwinkle(Rec.Top,Rec.Bottom,Rec.Right, NrGracza); end; // if end; diff --git a/Game/Code/Classes/UGraphicClasses.pas b/Game/Code/Classes/UGraphicClasses.pas index 66264334..34a964b2 100644 --- a/Game/Code/Classes/UGraphicClasses.pas +++ b/Game/Code/Classes/UGraphicClasses.pas @@ -29,8 +29,9 @@ type Particle : array of TParticle; LastTime : Cardinal; RecArray : Array of RectanglePositions; + TwinkleArray : Array[0..5] of PerfectNotePositions; // store position of last twinkle for every player PerfNoteArray : Array of PerfectNotePositions; - DelayAfterKillall : Integer; + KillallTime : Cardinal; // Timestamp set when Killall is called constructor Create; procedure Draw; @@ -40,7 +41,7 @@ type procedure KillAll(); procedure SaveGoldenStarsRec(Xtop, Ytop, Xbottom, Ybottom: Real); procedure SavePerfectNotePos(Xtop, Ytop: Real); - procedure GoldenNoteTwinkle(Top,Bottom,Right: Real); + procedure GoldenNoteTwinkle(Top,Bottom,Right: Real; Player: Integer); end; var GoldenRec : TEffectManager; @@ -48,6 +49,10 @@ var GoldenRec : TEffectManager; implementation uses sysutils, Windows,OpenGl12, UThemes, USkins, UGraphic, UDrawTexture, UTexture, math, dialogs; +const + KillallDelay: Integer = 100; + + //TParticle Constructor TParticle.Create(cX,cY: Real; cTex: Cardinal; cLive: Byte; cFrame : integer; cRecArrayIndex : Integer; cStarType : Integer); begin @@ -111,8 +116,15 @@ end; constructor TEffectManager.Create; +var c: Cardinal; begin LastTime := GetTickCount; + KillallTime := LastTime; + for c:=0 to 5 do + begin + TwinkleArray[c].xPos := 0; + TwinkleArray[c].yPos := 0; + end; end; @@ -214,27 +226,41 @@ if not(LastParticleIndex = -1) then end; procedure TEffectManager.KillAll(); +var c: Cardinal; begin //It's the kill all kennies rotuine while Length(Particle) > 0 do Kill(0); SetLength(RecArray,0); SetLength(PerfNoteArray,0); + for c:=0 to 5 do + begin + TwinkleArray[c].xPos:=0; + TwinkleArray[c].yPos:=0; + end; end; -procedure TeffectManager.GoldenNoteTwinkle(Top,Bottom,Right: Real); +procedure TeffectManager.GoldenNoteTwinkle(Top,Bottom,Right: Real; Player: Integer); //Twinkle stars while golden note hit +// this is called from UDraw.pas, SingDrawPlayerCzesc var C, P, XKatze, YKatze: Integer; + CurrentTime: Cardinal; begin - DelayAfterKillall:=10; // To be used later, for the screen change issue - For P := 0 to high(RecArray) do // Are we inside a GoldenNoteRectangle? - begin - if ((RecArray[P].xBottom >= Right) and - (RecArray[P].xTop <= Right) and - (RecArray[P].yTop <= (Top+Bottom)/2) and - (RecArray[P].yBottom >= (Top+Bottom)/2)) then + CurrentTime := GetTickCount; + //delay after Killall + if (CurrentTime > (KillallTime + KillallDelay)) then + // make sure we spawn only one time at one position + if (TwinkleArray[Player].xPos < Right) then + For P := 0 to high(RecArray) do // Are we inside a GoldenNoteRectangle? + begin + if ((RecArray[P].xBottom >= Right) and + (RecArray[P].xTop <= Right) and + (RecArray[P].yTop <= (Top+Bottom)/2) and + (RecArray[P].yBottom >= (Top+Bottom)/2)) then begin + TwinkleArray[Player].xPos:=Right; + for C := 1 to 8 do begin Ykatze := RandomRange(ceil(Top) , ceil(Bottom)); @@ -243,21 +269,26 @@ begin end; exit; // found a GoldenRec, did spawning stuff... done end; - end; + end; end; procedure TEffectManager.SaveGoldenStarsRec(Xtop, Ytop, Xbottom, Ybottom: Real); var P : Integer; // P like used in Positions NewIndex : Integer; + CurrentTime: Cardinal; begin - For P := 0 to high(RecArray) do // Do we already have that "new" position? - begin - if ((ceil(RecArray[P].xTop) = ceil(Xtop)) and (ceil(RecArray[P].yTop) = ceil(Ytop))) then - exit; // it's already in the array, so we don't have to create a new one - end; + CurrentTime := GetTickCount; + //delay after Killall + if (CurrentTime > (KillallTime + KillallDelay)) then + begin + For P := 0 to high(RecArray) do // Do we already have that "new" position? + begin + if ((ceil(RecArray[P].xTop) = ceil(Xtop)) and (ceil(RecArray[P].yTop) = ceil(Ytop))) then + exit; // it's already in the array, so we don't have to create a new one + end; -// we got a new position, add the new positions to our array + // we got a new position, add the new positions to our array NewIndex := Length(RecArray); SetLength(RecArray, NewIndex + 1); RecArray[NewIndex].xTop := Xtop; @@ -266,6 +297,7 @@ begin RecArray[NewIndex].yBottom := Ybottom; RecArray[NewIndex].TotalStarCount := ceil(Xbottom - Xtop) div 12 + 3; RecArray[NewIndex].CurrentStarCount := 0; + end; end; procedure TEffectManager.SavePerfectNotePos(Xtop, Ytop: Real); @@ -275,27 +307,32 @@ var RandomFrame : Integer; Xkatze, Ykatze : Integer; + CurrentTime: Cardinal; begin - For P := 0 to high(PerfNoteArray) do // Do we already have that "new" position? - begin - if ((ceil(PerfNoteArray[P].xPos) = ceil(Xtop)) and (ceil(PerfNoteArray[P].yPos) = ceil(Ytop))) then - exit; // it's already in the array, so we don't have to create a new one - end; + CurrentTime := GetTickCount; + //delay after Killall + if (CurrentTime > (KillallTime + KillallDelay)) then + begin + For P := 0 to high(PerfNoteArray) do // Do we already have that "new" position? + begin + if ((ceil(PerfNoteArray[P].xPos) = ceil(Xtop)) and (ceil(PerfNoteArray[P].yPos) = ceil(Ytop))) then + exit; // it's already in the array, so we don't have to create a new one + end; -// we got a new position, add the new positions to our array + // we got a new position, add the new positions to our array NewIndex := Length(PerfNoteArray); SetLength(PerfNoteArray, NewIndex + 1); PerfNoteArray[NewIndex].xPos := Xtop; PerfNoteArray[NewIndex].yPos := Ytop; - for P:= 0 to 2 do - begin - Xkatze := RandomRange(ceil(Xtop) - 5 , ceil(Xtop) + 10); - Ykatze := RandomRange(ceil(Ytop) - 5 , ceil(Ytop) + 10); - RandomFrame := RandomRange(0,14); - Spawn(Xkatze, Ykatze, Tex_Note_Perfect_Star.TexNum, 16 - RandomFrame, RandomFrame, -1, 2); - end; - + for P:= 0 to 2 do + begin + Xkatze := RandomRange(ceil(Xtop) - 5 , ceil(Xtop) + 10); + Ykatze := RandomRange(ceil(Ytop) - 5 , ceil(Ytop) + 10); + RandomFrame := RandomRange(0,14); + Spawn(Xkatze, Ykatze, Tex_Note_Perfect_Star.TexNum, 16 - RandomFrame, RandomFrame, -1, 2); + end; + end; end; end. diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index d684dc3c..ae5b239c 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1121,16 +1121,14 @@ begin end; //PhrasenBonus - Line Bonus Mod End// } - -//GoldenStarsTwinkle Mod - GoldenRec.KillAll; -//GoldenStarsTwinkle Mod End end; //Called on Sentence Change S= New Current Sentence procedure TScreenSing.onSentenceChange(S: Cardinal); begin - //Dummy + //GoldenStarsTwinkle Mod + GoldenRec.KillAll; + //GoldenStarsTwinkle Mod End end; end. -- cgit v1.2.3 From e9a8dafe97dfc4570e08bd8a1054e7f6e91ff8a1 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 8 Apr 2007 21:50:36 +0000 Subject: Fixed a Bug Fading in to Options Screen Fixed Exit in Grafic Screen don't work git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@74 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenOptions.pas | 2 ++ Game/Code/Screens/UScreenOptionsGraphics.pas | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas index 2a8d0d9a..0fffedac 100644 --- a/Game/Code/Screens/UScreenOptions.pas +++ b/Game/Code/Screens/UScreenOptions.pas @@ -232,6 +232,8 @@ begin Button[3].Texture.ScaleW := Progress; Button[4].Texture.ScaleW := Progress; Button[5].Texture.ScaleW := Progress; + Button[6].Texture.ScaleW := Progress; + Button[7].Texture.ScaleW := Progress; end; end. diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index 4befb092..6152c9c0 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -38,7 +38,7 @@ begin { if SelInteraction <= 1 then begin Restart := true; end;} - if SelInteraction = 6 then begin + if SelInteraction = 5 then begin Ini.Save; Music.PlayBack; FadeTo(@ScreenOptions); @@ -50,14 +50,14 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + if (SelInteraction >= 0) and (SelInteraction <= 4) then begin Music.PlayOption; InteractInc; end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + if (SelInteraction >= 0) and (SelInteraction <= 4) then begin Music.PlayOption; InteractDec; end; -- cgit v1.2.3 From d28350b7fe6e1c827e9994d28f7f95cae4ac2db6 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 10 Apr 2007 10:15:14 +0000 Subject: Corrected Coverpositions in Style 4 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@75 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 2af37dd5..e873d287 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -945,11 +945,12 @@ begin Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - Z := (1 + cos(Wsp)) / 2 - 0.2; + Z := (1 + cos(Wsp)) / 2; Z2 := (1 + 2*Z) / 3; - Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.W + 0.185 * Theme.Song.Cover.H * VS * sin(Wsp) - Theme.Song.Cover.X) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - Button[B].Z := Z; + + Button[B].X := Theme.Song.Cover.X + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z / 2 + 0.3; Button[B].W := Theme.Song.Cover.H * Z2; @@ -1050,16 +1051,6 @@ var VS: integer; diff: real; X: Real; - {function margin (const X, Y, VS: real):real; //Margin of to Buttons - begin - Result := Frac(x / y) * y; - if (X - VS) >= -3 then - Result := X - VS - Y - else if (X + 3) >= VS then - Result := X - VS + Y - else - Result := X - Y; - end; } begin VS := CatSongs.VisibleSongs; // cache Visible Songs {Vars @@ -1096,9 +1087,12 @@ begin Button[B].W := Button[B].H; - Diff := (Button[B].H - Theme.Song.Cover.H)/2;; + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + + X := Sin(Angle); - Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Sin(Angle) - Diff; + Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Diff; end else -- cgit v1.2.3 From da9dc16fd9983e4af6790900c7c007cfe603709b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 10 Apr 2007 15:10:26 +0000 Subject: Beautified Credits Screen Edited Texts to Fit Screen Width git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@76 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenMain.pas | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index dcd7db26..ccd81ee9 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -45,11 +45,11 @@ const Credits_Text: Array[0..46] of PChar = ( 'DennistheMenace:', 'Beta Testing and great Support in "the Board"', ':SPACE:', - 'Moq/Moguhguh:', + 'Mog:', 'Programming', ':SPACE:', 'Mota:', - 'Programming, Idea of creating this Mod, Team Leading', + 'Programming, Idea of creating this Mod', ':SPACE:', 'Sawyer:', 'Web Master, Programming', @@ -72,9 +72,9 @@ const Credits_Text: Array[0..46] of PChar = ( ':SPACE:', ':SPACE:', 'Visit us at:', - 'http://www.UltraStar-Deluxe.de.vu', - 'http://www.USD.de.vu', - 'http://www.Ultra-Star.dl.am ("The Board" by Blind Guard)', + 'http://www.ultrastardx.dl.am', + 'http://sourceforge.net/projects/ultrastardx/', + 'http://www.Ultra-Star.dl.am', 'Please write Bug Reports and Feature Requests', 'to help making this a better Game'); @@ -329,7 +329,7 @@ begin SetFontStyle (2); SetFontItalic(False); SetFontSize(9); - SetFontPos (460, 570); + SetFontPos (10, 5); glColor4f(1, 0, 0, 0.2 + Abs((Credits_Alpha mod 150)/100 - 0.75)); glPrint ('Credits! Press any Key to Continue'); @@ -339,7 +339,12 @@ begin if (Credits_Y>-35) then begin Ver := PChar(Language.Translate('US_VERSION')); - glColor4f(1, 0.6, 0.08, 0.8); + //Set Color + if Credits_Y > 500 then + glColor4f(1, 0.6, 0.08, (600 - Credits_Y)/100 - 0.2) + else + glColor4f(1, 0.6, 0.08, 0.8); + SetFontPos (400 - glTextWidth(Ver)/2, Credits_Y); glprint(Ver); end; @@ -367,6 +372,12 @@ begin Y := Y + 55 else begin + //Set Color + if Y > 500 then + glColor4f(0.8, 0.8, 1, (600 - Y)/100 - 0.2) + else + glColor4f(0.8, 0.8, 1, 0.8); + SetFontPos (400 - glTextWidth(Credits_Text[T])/2, Y); glprint(Credits_Text[T]); Y := Y + 30; @@ -376,7 +387,7 @@ begin break; end; - //If lower Position is outside the Screen-> Show MainMenu + //If lowest Position is outside the Screen-> Show MainMenu if (Y <= 0) then Credits_Visible := False; end; -- cgit v1.2.3 From 44956e119562be2defd82eba8b10e7069ead5b76 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 10 Apr 2007 15:12:07 +0000 Subject: Edited Mogs Text: Now hes a Graphics Guy ^^ git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@77 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenLoading.pas | 8 +++++++- Game/Code/Screens/UScreenMain.pas | 2 +- Game/Code/Screens/UScreenSing.pas | 3 +++ Game/Code/Screens/UScreenWelcome.pas | 16 ++++++++-------- 4 files changed, 19 insertions(+), 10 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenLoading.pas b/Game/Code/Screens/UScreenLoading.pas index 05b308ac..5cc938bb 100644 --- a/Game/Code/Screens/UScreenLoading.pas +++ b/Game/Code/Screens/UScreenLoading.pas @@ -3,7 +3,7 @@ unit UScreenLoading; interface uses - UMenu, SDL, SysUtils, UThemes; + UMenu, SDL, SysUtils, UThemes, OpenGL12; type TScreenLoading = class(TMenu) @@ -11,6 +11,7 @@ type Fadeout: boolean; constructor Create(Back: String); override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function GetBGTexNum: GLUInt; procedure onShow; override; end; @@ -45,4 +46,9 @@ begin // nothing end; +function TScreenLoading.GetBGTexNum: GLUInt; +begin + Result := Self.BackImg.TexNum; +end; + end. diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index ccd81ee9..43034912 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -46,7 +46,7 @@ const Credits_Text: Array[0..46] of PChar = ( 'Beta Testing and great Support in "the Board"', ':SPACE:', 'Mog:', - 'Programming', + 'Programming, Graphics', ':SPACE:', 'Mota:', 'Programming, Idea of creating this Mod', diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index ae5b239c..c6191cec 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1119,6 +1119,8 @@ begin //Refresh LastScore Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; + + end; //PhrasenBonus - Line Bonus Mod End// } end; @@ -1129,6 +1131,7 @@ begin //GoldenStarsTwinkle Mod GoldenRec.KillAll; //GoldenStarsTwinkle Mod End + end; end. diff --git a/Game/Code/Screens/UScreenWelcome.pas b/Game/Code/Screens/UScreenWelcome.pas index de3b50f4..79fcc2c4 100644 --- a/Game/Code/Screens/UScreenWelcome.pas +++ b/Game/Code/Screens/UScreenWelcome.pas @@ -18,7 +18,7 @@ type implementation -uses UGraphic, UTime; +uses UGraphic, UTime, USkins; function TScreenWelcome.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -41,14 +41,14 @@ end; constructor TScreenWelcome.Create; begin inherited Create; -{ AddStatic(-10, -10, 0, 0, 1, 1, 1, Skin.Star, 'BMP', 'Transparent'); - AddStatic(-500, 440, 200, 5, 0, 0, 0, Skin.Line, 'JPG', 'Font Black'); - AddStatic(-500, 472, 200, 5, 0, 0, 0, Skin.Line, 'JPG', 'Font Black'); - AddStatic(-500, 504, 200, 5, 0, 0, 0, Skin.Line, 'JPG', 'Font Black'); - AddStatic(-500, 536, 200, 5, 0, 0, 0, Skin.Line, 'JPG', 'Font Black'); - AddStatic(-500, 568, 200, 5, 0, 0, 0, Skin.Line, 'JPG', 'Font Black'); + AddStatic(-10, -10, 0, 0, 1, 1, 1, Skin.GetTextureFileName('ButtonAlt') , 'JPG', 'Transparent'); + AddStatic(-500, 440, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), 'JPG', 'Font Black'); + AddStatic(-500, 472, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), 'JPG', 'Font Black'); + AddStatic(-500, 504, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), 'JPG', 'Font Black'); + AddStatic(-500, 536, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), 'JPG', 'Font Black'); + AddStatic(-500, 568, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), 'JPG', 'Font Black'); Animation := 0; - Fadeout := false;} + Fadeout := false; end; procedure TScreenWelcome.onShow; -- cgit v1.2.3 From 80e691699f2b236e4af80f8c1178cde07b458da3 Mon Sep 17 00:00:00 2001 From: mogguh Date: Wed, 11 Apr 2007 14:10:41 +0000 Subject: Feature: ScoreScreen now has the ability to show extra texts (UThemes.pas, UScreenScore.pas) Feature: Hit golden note effect, is now even more astonishing (UGraphicClasses.pas) Feature: It's now possible to turn of GoldenNoteTwinkle (UDraw.pas) BugFix: OptionsAdvanced is now opened correctly, instead of producing a bug (UGraphic.pas) BugFix: Modified some language entries to fit option screen (optionen instead of einstellungen) (German.ini) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@78 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 2 + Game/Code/Classes/UGraphic.pas | 2 +- Game/Code/Classes/UGraphicClasses.pas | 362 +++++++++++++++++++++------------- Game/Code/Classes/UThemes.pas | 5 + Game/Code/Screens/UScreenScore.pas | 19 +- 5 files changed, 251 insertions(+), 139 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 952bad07..e2c01b4b 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -430,6 +430,8 @@ var // passing on NrGracza... hope this is really something like the player-number, not only // some kind of weird index into a colour-table + + if (Ini.EffectGolden=1) then GoldenRec.GoldenNoteTwinkle(Rec.Top,Rec.Bottom,Rec.Right, NrGracza); end; // if end; diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 9f3e6667..c3ce0f00 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -404,7 +404,7 @@ begin Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Themes', 3); Log.BenchmarkStart(3); ScreenOptionsRecord := TScreenOptionsRecord.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Record', 3); Log.BenchmarkStart(3); - ScreenOptionsAdvanced := TScreenOptionsAdvanced.Create; + ScreenOptionsAdvanced := TScreenOptionsAdvanced.Create(''); Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Advanced', 3); Log.BenchmarkStart(3); ScreenEditSub := TScreenEditSub.Create(''); Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Sub', 3); Log.BenchmarkStart(3); diff --git a/Game/Code/Classes/UGraphicClasses.pas b/Game/Code/Classes/UGraphicClasses.pas index 34a964b2..5fa22575 100644 --- a/Game/Code/Classes/UGraphicClasses.pas +++ b/Game/Code/Classes/UGraphicClasses.pas @@ -1,18 +1,30 @@ unit UGraphicClasses; interface - +const DelayBetweenFrames : Cardinal = 100; type + + TParticleType=(GoldenNote, PerfectNote, NoteHitTwinkle, PerfectLineTwinkle); + + TColour3f = Record + r, g, b: Real; + end; + TParticle = Class X, Y : Real; //Position + W, H : Cardinal; //dimensions of particle + Col : TColour3f; // Colour of particle Frame : Byte; //act. Frame Tex : Cardinal; //Tex num from Textur Manager Live : Byte; //How many Cycles before Kill - RecIndex : Integer; //To which rectangle this particle belongs - StarType : Integer; // 1: GoldenNote | 2: PerfectNote + RecIndex : Integer; //To which rectangle this particle belongs (only GoldenNote) + StarType : TParticleType; // GoldenNote | PerfectNote | NoteHitTwinkle | PerfectLineTwinkle + Alpha : Real; // used for fading... + mX, mY : Real; // movement-vector for PerfectLineTwinkle - Constructor Create(cX,cY: Real; cTex: Cardinal; cLive: Byte; cFrame : integer; cRecArrayIndex : Integer; cStarType : Integer); + Constructor Create(cX,cY: Real; cLive: Byte; cFrame : integer; cRecArrayIndex : Integer; cStarType : TParticleType; Player: Cardinal); procedure Draw; + procedure LiveOn; end; RectanglePositions = Record @@ -29,13 +41,19 @@ type Particle : array of TParticle; LastTime : Cardinal; RecArray : Array of RectanglePositions; - TwinkleArray : Array[0..5] of PerfectNotePositions; // store position of last twinkle for every player + TwinkleArray : Array[0..5] of Real; // store x-position of last twinkle for every player PerfNoteArray : Array of PerfectNotePositions; - KillallTime : Cardinal; // Timestamp set when Killall is called constructor Create; + destructor Destroy; override; procedure Draw; - function Spawn(X, Y: Real; Tex: Cardinal; Live: Byte; StartFrame : Integer; RecArrayIndex : Integer; StarType : Integer): Cardinal; + function Spawn(X, Y: Real; + Live: Byte; + StartFrame: Integer; + RecArrayIndex: Integer; // this is only used with GoldenNotes + StarType: TParticleType; + Player: Cardinal // for PerfectLineTwinkle + ): Cardinal; procedure SpawnRec(); procedure Kill(index: Cardinal); procedure KillAll(); @@ -49,53 +67,109 @@ var GoldenRec : TEffectManager; implementation uses sysutils, Windows,OpenGl12, UThemes, USkins, UGraphic, UDrawTexture, UTexture, math, dialogs; -const - KillallDelay: Integer = 100; - - //TParticle -Constructor TParticle.Create(cX,cY: Real; cTex: Cardinal; cLive: Byte; cFrame : integer; cRecArrayIndex : Integer; cStarType : Integer); +Constructor TParticle.Create(cX,cY: Real; cLive: Byte; cFrame : integer; cRecArrayIndex : Integer; cStarType : TParticleType; Player: Cardinal); begin + inherited Create; X := cX; Y := cY; - Tex := cTex; Live := cLive; Frame:= cFrame; RecIndex := cRecArrayIndex; StarType := cStarType; -end; - - -procedure TParticle.Draw; -var - W, H: real; - Alpha : real; -begin - //Fade Eyecandy - - Case StarType of - 1: + Alpha := (-cos((Frame+1)*2*pi/16)+1); // neat fade-in-and-out + case cStarType of + GoldenNote: begin - Alpha := (-cos((Frame+1)*2*pi/16)+1); + Tex := Tex_Note_Star.TexNum; W := 20; H := 20; - glColor4f(0.99, 1, 0.6, Alpha); + Col.r := 0.99; + Col.g := 1; + Col.b := 0.6; end; - 2: + PerfectNote: begin - Alpha := (-cos((Frame+1)*2*pi/16)+1); + Tex := Tex_Note_Perfect_Star.TexNum; W := 30; H := 30; - glColor4f(1, 1, 0.95, Alpha); + Col.r := 1; + Col.g := 1; + Col.b := 0.95; end; - 3: + NoteHitTwinkle: begin - Alpha := (Live/3); + Tex := Tex_Note_Star.TexNum; + Alpha := (Live/10); // linear fade-out W := 15; H := 15; - glColor4f(1, 1, 0.9, Alpha); + Col.r := 1; + Col.g := 1; + Col.b := RandomRange(10*Live,100)/80; //0.9; + end; + PerfectLineTwinkle: + begin + Tex := Tex_Note_Star.TexNum; + W := RandomRange(10,30); + H := W; + // hier muss entsprechend des players farbe gesetzt werden (sollten wir dann auch übergeben bekommen) + // case Player of + // ... + Col.r := 1; + Col.g := 0.5; + Col.b := 0.5; + mX := RandomRange(-5,5); + mY := RandomRange(-5,5); + end; + else // just some random default values + begin + Tex := Tex_Note_Star.TexNum; + Alpha := 1; + W := 20; + H := 20; + Col.r := 1; + Col.g := 1; + Col.b := 1; end; end; +end; + +procedure TParticle.LiveOn; +begin + //Live = 0 => Live forever ?? die werden doch aber im Manager bei Draw getötet, wenns 0 is + if (Live > 0) then + Dec(Live); + + // animate frames + Frame := ( Frame + 1 ) mod 16; + + // make our particles do funny stuff (besides being animated) + case StarType of + GoldenNote: + begin + Alpha := (-cos((Frame+1)*2*pi/16)+1); // neat fade-in-and-out + end; + PerfectNote: + begin + Alpha := (-cos((Frame+1)*2*pi/16)+1); // neat fade-in-and-out + end; + NoteHitTwinkle: + begin + Alpha := (Live/10); // linear fade-out + end; + PerfectLineTwinkle: + begin + Alpha := (-cos((Frame+1)*2*pi/16)+1); // neat fade-in-and-out + // move around + X := X + mX; + Y := Y + mY; + end; + end; +end; + +procedure TParticle.Draw; +begin + glColor4f(Col.r, Col.g, Col.b, Alpha); glBindTexture(GL_TEXTURE_2D, Tex); glEnable(GL_TEXTURE_2D); @@ -112,44 +186,43 @@ begin end; glcolor4f(1,1,1,1); end; +// end of TParticle - +// TEffectManager constructor TEffectManager.Create; var c: Cardinal; begin + inherited; LastTime := GetTickCount; - KillallTime := LastTime; for c:=0 to 5 do begin - TwinkleArray[c].xPos := 0; - TwinkleArray[c].yPos := 0; + TwinkleArray[c] := 0; end; end; +destructor TEffectManager.Destroy; +begin + Killall; + inherited; +end; + procedure TEffectManager.Draw; var I: Integer; CurrentTime: Cardinal; -const - DelayBetweenFrames : Integer = 100; +//const +// DelayBetweenFrames : Cardinal = 100; begin CurrentTime := GetTickCount; //Manage particle life - if (CurrentTime > (LastTime + DelayBetweenFrames)) then + if (CurrentTime - LastTime) > DelayBetweenFrames then begin LastTime := CurrentTime; - for I := 0 to high(Particle) do - begin - Particle[I].Frame := (Particle[I].Frame + 1 ) mod 16; - //Live = 0 => Live forever - if (Particle[I].Live > 0) then - begin - Dec(Particle[I].Live); - end; - end; + for I := 0 to high(Particle) do + Particle[I].LiveOn; end; I := 0; @@ -173,15 +246,15 @@ begin end; end; - -function TEffectManager.Spawn(X, Y: Real; Tex: Cardinal; Live: Byte; StartFrame : Integer; RecArrayIndex : Integer; StarType : Integer): Cardinal; +// this method creates just one particle +function TEffectManager.Spawn(X, Y: Real; Live: Byte; StartFrame : Integer; RecArrayIndex : Integer; StarType : TParticleType; Player: Cardinal): Cardinal; begin Result := Length(Particle); SetLength(Particle, (Result + 1)); - Particle[Result] := TParticle.Create(X, Y, Tex, Live, StartFrame, RecArrayIndex, StarType); + Particle[Result] := TParticle.Create(X, Y, Live, StartFrame, RecArrayIndex, StarType, Player); end; - +// manage Sparkling of GoldenNote Bars procedure TEffectManager.SpawnRec(); Var Xkatze, Ykatze : Real; @@ -197,46 +270,46 @@ for P:= 0 to high(RecArray) do Xkatze := RandomRange(Ceil(RecArray[P].xTop), Ceil(RecArray[P].xBottom)); Ykatze := RandomRange(Ceil(RecArray[P].yTop), Ceil(RecArray[P].yBottom)); RandomFrame := RandomRange(0,14); - Spawn(Xkatze, Ykatze, Tex_Note_Star.TexNum, 16 - RandomFrame, RandomFrame, P, 1); + // Spawn a GoldenNote Particle + Spawn(Xkatze, Ykatze, 16 - RandomFrame, RandomFrame, P, GoldenNote, 0); inc(RecArray[P].CurrentStarCount); end; end; draw; end; - +// kill one particle (with given index in our particle array) procedure TEffectManager.Kill(Index: Cardinal); var - LastParticleIndex : Cardinal; + LastParticleIndex : Integer; begin -// We put the last element of the array on the place where our element_to_delete resides and then we shorten the array - cool, hu? :P - -LastParticleIndex := high(Particle); -if not(LastParticleIndex = -1) then +// delete particle indexed by Index, +// overwrite it's place in our particle-array with the particle stored at the last array index, +// shorten array + LastParticleIndex := high(Particle); + if not(LastParticleIndex = -1) then // is there still a particle to delete? begin - Try - Finally - if not(Particle[Index].RecIndex = -1) then - dec(RecArray[Particle[Index].RecIndex].CurrentStarCount); - Particle[Index].Destroy; - Particle[Index] := Particle[LastParticleIndex]; - SetLength(Particle, LastParticleIndex); - end; - end; + if not(Particle[Index].RecIndex = -1) then // if it is a GoldenNote particle... + dec(RecArray[Particle[Index].RecIndex].CurrentStarCount); // take care of its associated GoldenRec + // now get rid of that particle + Particle[Index].Destroy; + Particle[Index] := Particle[LastParticleIndex]; + SetLength(Particle, LastParticleIndex); + end; end; +// clean up all particles and management structures procedure TEffectManager.KillAll(); var c: Cardinal; begin //It's the kill all kennies rotuine - while Length(Particle) > 0 do + while Length(Particle) > 0 do // kill all existing particles Kill(0); - SetLength(RecArray,0); - SetLength(PerfNoteArray,0); + SetLength(RecArray,0); // remove GoldenRec positions + SetLength(PerfNoteArray,0); // remove PerfectNote positions for c:=0 to 5 do begin - TwinkleArray[c].xPos:=0; - TwinkleArray[c].yPos:=0; + TwinkleArray[c] := 0; // reset GoldenNoteHit memory end; end; @@ -244,95 +317,110 @@ procedure TeffectManager.GoldenNoteTwinkle(Top,Bottom,Right: Real; Player: Integ //Twinkle stars while golden note hit // this is called from UDraw.pas, SingDrawPlayerCzesc var - C, P, XKatze, YKatze: Integer; - CurrentTime: Cardinal; + C, P, XKatze, YKatze, LKatze: Integer; + H: Real; begin - CurrentTime := GetTickCount; - //delay after Killall - if (CurrentTime > (KillallTime + KillallDelay)) then - // make sure we spawn only one time at one position - if (TwinkleArray[Player].xPos < Right) then - For P := 0 to high(RecArray) do // Are we inside a GoldenNoteRectangle? + // make sure we spawn only one time at one position + if (TwinkleArray[Player] < Right) then + For P := 0 to high(RecArray) do // Are we inside a GoldenNoteRectangle? + begin + H := (Top+Bottom)/2; // helper... + with RecArray[P] do + if ((xBottom >= Right) and (xTop <= Right) and + (yTop <= H) and (yBottom >= H)) then begin - if ((RecArray[P].xBottom >= Right) and - (RecArray[P].xTop <= Right) and - (RecArray[P].yTop <= (Top+Bottom)/2) and - (RecArray[P].yBottom >= (Top+Bottom)/2)) then + TwinkleArray[Player] := Right; // remember twinkle position for this player + for C := 1 to 20 do begin - TwinkleArray[Player].xPos:=Right; - - for C := 1 to 8 do - begin - Ykatze := RandomRange(ceil(Top) , ceil(Bottom)); - XKatze := RandomRange(-7,3); - Spawn(Ceil(Right)+XKatze, YKatze, Tex_Note_Star.TexNum, 3, 0, -1, 3); - end; - exit; // found a GoldenRec, did spawning stuff... done + Ykatze := RandomRange(ceil(Top) , ceil(Bottom)); + XKatze := RandomRange(-7,3); + LKatze := RandomRange(4,10); + Spawn(Ceil(Right)+XKatze, YKatze, LKatze, 0, -1, NoteHitTwinkle, 0); end; + for C := 1 to 5 do + begin + Ykatze := RandomRange(ceil(Top)-6 , ceil(Top)); + XKatze := RandomRange(-5,1); + LKatze := RandomRange(2,3); + Spawn(Ceil(Right)+XKatze, YKatze, LKatze, 0, -1, NoteHitTwinkle, 0); + end; + for C := 1 to 5 do + begin + Ykatze := RandomRange(ceil(Bottom), ceil(Bottom)+6); + XKatze := RandomRange(-5,1); + LKatze := RandomRange(2,3); + Spawn(Ceil(Right)+XKatze, YKatze, LKatze, 0, -1, NoteHitTwinkle, 0); + end; + for C := 1 to 3 do + begin + Ykatze := RandomRange(ceil(Top)-10 , ceil(Top)-6); + XKatze := RandomRange(-5,1); + LKatze := RandomRange(1,2); + Spawn(Ceil(Right)+XKatze, YKatze, LKatze, 0, -1, NoteHitTwinkle, 0); + end; + for C := 1 to 3 do + begin + Ykatze := RandomRange(ceil(Bottom)+6 , ceil(Bottom)+10); + XKatze := RandomRange(-5,1); + LKatze := RandomRange(1,2); + Spawn(Ceil(Right)+XKatze, YKatze, LKatze, 0, -1, NoteHitTwinkle, 0); + end; + + exit; // found a matching GoldenRec, did spawning stuff... done end; + end; end; procedure TEffectManager.SaveGoldenStarsRec(Xtop, Ytop, Xbottom, Ybottom: Real); var P : Integer; // P like used in Positions NewIndex : Integer; - CurrentTime: Cardinal; begin - CurrentTime := GetTickCount; - //delay after Killall - if (CurrentTime > (KillallTime + KillallDelay)) then - begin - For P := 0 to high(RecArray) do // Do we already have that "new" position? - begin - if ((ceil(RecArray[P].xTop) = ceil(Xtop)) and (ceil(RecArray[P].yTop) = ceil(Ytop))) then - exit; // it's already in the array, so we don't have to create a new one - end; + For P := 0 to high(RecArray) do // Do we already have that "new" position? + begin + if ((ceil(RecArray[P].xTop) = ceil(Xtop)) and (ceil(RecArray[P].yTop) = ceil(Ytop))) then + exit; // it's already in the array, so we don't have to create a new one + end; // we got a new position, add the new positions to our array - NewIndex := Length(RecArray); - SetLength(RecArray, NewIndex + 1); - RecArray[NewIndex].xTop := Xtop; - RecArray[NewIndex].yTop := Ytop; - RecArray[NewIndex].xBottom := Xbottom; - RecArray[NewIndex].yBottom := Ybottom; - RecArray[NewIndex].TotalStarCount := ceil(Xbottom - Xtop) div 12 + 3; - RecArray[NewIndex].CurrentStarCount := 0; - end; + NewIndex := Length(RecArray); + SetLength(RecArray, NewIndex + 1); + RecArray[NewIndex].xTop := Xtop; + RecArray[NewIndex].yTop := Ytop; + RecArray[NewIndex].xBottom := Xbottom; + RecArray[NewIndex].yBottom := Ybottom; + RecArray[NewIndex].TotalStarCount := ceil(Xbottom - Xtop) div 12 + 3; + RecArray[NewIndex].CurrentStarCount := 0; end; procedure TEffectManager.SavePerfectNotePos(Xtop, Ytop: Real); var P : Integer; // P like used in Positions NewIndex : Integer; - RandomFrame : Integer; Xkatze, Ykatze : Integer; - CurrentTime: Cardinal; begin - CurrentTime := GetTickCount; - //delay after Killall - if (CurrentTime > (KillallTime + KillallDelay)) then - begin - For P := 0 to high(PerfNoteArray) do // Do we already have that "new" position? - begin - if ((ceil(PerfNoteArray[P].xPos) = ceil(Xtop)) and (ceil(PerfNoteArray[P].yPos) = ceil(Ytop))) then - exit; // it's already in the array, so we don't have to create a new one - end; + For P := 0 to high(PerfNoteArray) do // Do we already have that "new" position? + begin + with PerfNoteArray[P] do + if ((ceil(xPos) = ceil(Xtop)) and (ceil(yPos) = ceil(Ytop))) then + exit; // it's already in the array, so we don't have to create a new one + end; //for // we got a new position, add the new positions to our array - NewIndex := Length(PerfNoteArray); - SetLength(PerfNoteArray, NewIndex + 1); - PerfNoteArray[NewIndex].xPos := Xtop; - PerfNoteArray[NewIndex].yPos := Ytop; + NewIndex := Length(PerfNoteArray); + SetLength(PerfNoteArray, NewIndex + 1); + PerfNoteArray[NewIndex].xPos := Xtop; + PerfNoteArray[NewIndex].yPos := Ytop; - for P:= 0 to 2 do - begin - Xkatze := RandomRange(ceil(Xtop) - 5 , ceil(Xtop) + 10); - Ykatze := RandomRange(ceil(Ytop) - 5 , ceil(Ytop) + 10); - RandomFrame := RandomRange(0,14); - Spawn(Xkatze, Ykatze, Tex_Note_Perfect_Star.TexNum, 16 - RandomFrame, RandomFrame, -1, 2); - end; - end; + for P:= 0 to 2 do + begin + Xkatze := RandomRange(ceil(Xtop) - 5 , ceil(Xtop) + 10); + Ykatze := RandomRange(ceil(Ytop) - 5 , ceil(Ytop) + 10); + RandomFrame := RandomRange(0,14); + Spawn(Xkatze, Ykatze, 16 - RandomFrame, RandomFrame, -1, PerfectNote, 0); + end; //for end; + end. diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 17983a60..d7adb61a 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -290,7 +290,10 @@ type TextArtist: TThemeText; TextTitle: TThemeText; + TextArtistTitle: TThemeText; + PlayerStatic: array[1..6] of AThemeStatic; + PlayerTexts: array[1..6] of AThemeText; TextName: array[1..6] of TThemeText; TextScore: array[1..6] of TThemeText; @@ -917,9 +920,11 @@ begin ThemeLoadText(Score.TextArtist, 'ScoreTextArtist'); ThemeLoadText(Score.TextTitle, 'ScoreTextTitle'); + ThemeLoadText(Score.TextArtistTitle, 'ScoreTextArtistTitle'); for I := 1 to 6 do begin ThemeLoadStatics(Score.PlayerStatic[I], 'ScorePlayer' + IntToStr(I) + 'Static'); + ThemeLoadTexts(Score.PlayerTexts[I], 'ScorePlayer' + IntToStr(I) + 'Text'); ThemeLoadText(Score.TextName[I], 'ScoreTextName' + IntToStr(I)); ThemeLoadText(Score.TextScore[I], 'ScoreTextScore' + IntToStr(I)); diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index eb92a3d2..9184b3f5 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -11,6 +11,8 @@ type TextArtist: integer; TextTitle: integer; + TextArtistTitle : integer; + TextName: array[1..6] of integer; TextScore: array[1..6] of integer; @@ -24,6 +26,8 @@ type TextTotalScore: array[1..6] of integer; PlayerStatic: array[1..6] of array of integer; + PlayerTexts : array[1..6] of array of integer; + StaticBoxLightest: array[1..6] of integer; StaticBoxLight: array[1..6] of integer; @@ -91,7 +95,7 @@ end; constructor TScreenScore.Create(Back: String); var P: integer; - I: integer; + I, C: integer; begin inherited Create(Back); @@ -146,6 +150,8 @@ begin TextArtist := AddText(Theme.Score.TextArtist); TextTitle := AddText(Theme.Score.TextTitle); + TextArtistTitle := AddText(Theme.Score.TextArtistTitle); + for P := 1 to 6 do begin TextName[P] := AddText(Theme.Score.TextName[P]); TextScore[P] := AddText(Theme.Score.TextScore[P]); @@ -160,9 +166,16 @@ begin TextTotalScore[P] := AddText(Theme.Score.TextTotalScore[P]); SetLength(PlayerStatic[P], Length(Theme.Score.PlayerStatic[P])); + for I := 0 to High(Theme.Score.PlayerStatic[P]) do PlayerStatic[P, I] := AddStatic(Theme.Score.PlayerStatic[P, I]); + + //added by mog + for C := 0 to High(Theme.Score.PlayerTexts[P]) do + PlayerTexts[P, C] := AddText(Theme.Score.PlayerTexts[P, C]); + // more skinable now + StaticBoxLightest[P] := AddStatic(Theme.Score.StaticBoxLightest[P]); StaticBoxLight[P] := AddStatic(Theme.Score.StaticBoxLight[P]); StaticBoxDark[P] := AddStatic(Theme.Score.StaticBoxDark[P]); @@ -225,6 +238,7 @@ begin Text[TextArtist].Text := AktSong.Artist; Text[TextTitle].Text := AktSong.Title; + Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; // set visibility case PlayersPlay of @@ -270,6 +284,9 @@ begin for I := 0 to high(PlayerStatic[P]) do Static[PlayerStatic[P, I]].Visible := V[P]; + for I := 0 to high(PlayerTexts[P]) do + Static[PlayerTexts[P, I]].Visible := V[P]; + Static[StaticBoxLightest[P]].Visible := V[P]; Static[StaticBoxLight[P]].Visible := V[P]; Static[StaticBoxDark[P]].Visible := V[P]; -- cgit v1.2.3 From d74fd107869347fef713d187dcd925257bfdadfe Mon Sep 17 00:00:00 2001 From: mogguh Date: Wed, 11 Apr 2007 17:57:18 +0000 Subject: Bugfix: Score screen is now able to handle texts depended on the player count (UScreenScore.pas) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@79 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenScore.pas | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 9184b3f5..2c018b96 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -167,6 +167,8 @@ begin SetLength(PlayerStatic[P], Length(Theme.Score.PlayerStatic[P])); + SetLength(PlayerTexts[P], Length(Theme.Score.PlayerTexts[P])); + for I := 0 to High(Theme.Score.PlayerStatic[P]) do PlayerStatic[P, I] := AddStatic(Theme.Score.PlayerStatic[P, I]); @@ -285,7 +287,7 @@ begin Static[PlayerStatic[P, I]].Visible := V[P]; for I := 0 to high(PlayerTexts[P]) do - Static[PlayerTexts[P, I]].Visible := V[P]; + Text[PlayerTexts[P, I]].Visible := V[P]; Static[StaticBoxLightest[P]].Visible := V[P]; Static[StaticBoxLight[P]].Visible := V[P]; -- cgit v1.2.3 From 943d001a21095f936fdcfc58f11cdbd6d30578a5 Mon Sep 17 00:00:00 2001 From: b1indy Date: Wed, 11 Apr 2007 20:22:01 +0000 Subject: first implementation of perfect line twinkle effect - works correctly for up to 3 players, restructured parts of particle code git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@80 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphicClasses.pas | 196 ++++++++++++++++++++++++++++------ Game/Code/Classes/UMain.pas | 4 +- Game/Code/Screens/UScreenSing.pas | 13 ++- 3 files changed, 177 insertions(+), 36 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphicClasses.pas b/Game/Code/Classes/UGraphicClasses.pas index 5fa22575..6f2aa0e4 100644 --- a/Game/Code/Classes/UGraphicClasses.pas +++ b/Game/Code/Classes/UGraphicClasses.pas @@ -1,3 +1,4 @@ +// notes: unit UGraphicClasses; interface @@ -13,7 +14,8 @@ type TParticle = Class X, Y : Real; //Position W, H : Cardinal; //dimensions of particle - Col : TColour3f; // Colour of particle + Col : array of TColour3f; // Colour(s) of particle + Scale : array of Real; // Scaling factors of particle layers Frame : Byte; //act. Frame Tex : Cardinal; //Tex num from Textur Manager Live : Byte; //How many Cycles before Kill @@ -21,8 +23,10 @@ type StarType : TParticleType; // GoldenNote | PerfectNote | NoteHitTwinkle | PerfectLineTwinkle Alpha : Real; // used for fading... mX, mY : Real; // movement-vector for PerfectLineTwinkle + SurviveSentenceChange : Boolean; Constructor Create(cX,cY: Real; cLive: Byte; cFrame : integer; cRecArrayIndex : Integer; cStarType : TParticleType; Player: Cardinal); + Destructor Destroy(); procedure Draw; procedure LiveOn; end; @@ -57,20 +61,23 @@ type procedure SpawnRec(); procedure Kill(index: Cardinal); procedure KillAll(); + procedure SentenceChange(); procedure SaveGoldenStarsRec(Xtop, Ytop, Xbottom, Ybottom: Real); procedure SavePerfectNotePos(Xtop, Ytop: Real); procedure GoldenNoteTwinkle(Top,Bottom,Right: Real; Player: Integer); + procedure SpawnPerfectLineTwinkle(); end; var GoldenRec : TEffectManager; implementation -uses sysutils, Windows,OpenGl12, UThemes, USkins, UGraphic, UDrawTexture, UTexture, math, dialogs; +uses sysutils, Windows,OpenGl12, UIni, UMain, UThemes, USkins, UGraphic, UDrawTexture, UTexture, math, dialogs; //TParticle Constructor TParticle.Create(cX,cY: Real; cLive: Byte; cFrame : integer; cRecArrayIndex : Integer; cStarType : TParticleType; Player: Cardinal); begin inherited Create; + // in this constructor we set all initial values for our particle X := cX; Y := cY; Live := cLive; @@ -78,24 +85,45 @@ begin RecIndex := cRecArrayIndex; StarType := cStarType; Alpha := (-cos((Frame+1)*2*pi/16)+1); // neat fade-in-and-out + SetLength(Scale,1); + Scale[0]:=1; + SurviveSentenceChange:=False; case cStarType of GoldenNote: begin Tex := Tex_Note_Star.TexNum; W := 20; H := 20; - Col.r := 0.99; - Col.g := 1; - Col.b := 0.6; + SetLength(Scale,4); + Scale[1]:=0.8; + Scale[2]:=0.4; + Scale[3]:=0.3; + SetLength(Col,4); + Col[0].r := 1; + Col[0].g := 0.7; + Col[0].b := 0.1; + + Col[1].r := 1; + Col[1].g := 1; + Col[1].b := 0.4; + + Col[2].r := 1; + Col[2].g := 1; + Col[2].b := 1; + + Col[3].r := 1; + Col[3].g := 1; + Col[3].b := 1; end; PerfectNote: begin Tex := Tex_Note_Perfect_Star.TexNum; W := 30; H := 30; - Col.r := 1; - Col.g := 1; - Col.b := 0.95; + SetLength(Col,1); + Col[0].r := 1; + Col[0].g := 1; + Col[0].b := 0.95; end; NoteHitTwinkle: begin @@ -103,21 +131,33 @@ begin Alpha := (Live/10); // linear fade-out W := 15; H := 15; - Col.r := 1; - Col.g := 1; - Col.b := RandomRange(10*Live,100)/80; //0.9; + Setlength(Col,1); + Col[0].r := 1; + Col[0].g := 1; + Col[0].b := RandomRange(10*Live,100)/80; //0.9; end; PerfectLineTwinkle: begin Tex := Tex_Note_Star.TexNum; W := RandomRange(10,30); H := W; - // hier muss entsprechend des players farbe gesetzt werden (sollten wir dann auch übergeben bekommen) - // case Player of - // ... - Col.r := 1; - Col.g := 0.5; - Col.b := 0.5; + SurviveSentenceChange:=True; + // assign colours according to player given + SetLength(Scale,2); + Scale[1]:=0.3; + SetLength(Col,2); + case Player of + 0: LoadColor(Col[0].r,Col[0].g,Col[0].b,'P1Light'); + 1: LoadColor(Col[0].r,Col[0].g,Col[0].b,'P2Light'); + 2: LoadColor(Col[0].r,Col[0].g,Col[0].b,'P3Light'); + 3: LoadColor(Col[0].r,Col[0].g,Col[0].b,'P4Light'); + 4: LoadColor(Col[0].r,Col[0].g,Col[0].b,'P5Light'); + 5: LoadColor(Col[0].r,Col[0].g,Col[0].b,'P6Light'); + else LoadColor(Col[0].r,Col[0].g,Col[0].b,'P1Light'); + end; + Col[1].r:=Col[0].r+0.5; + Col[1].g:=Col[0].g+0.5; + Col[1].b:=Col[0].b+0.5; mX := RandomRange(-5,5); mY := RandomRange(-5,5); end; @@ -127,13 +167,21 @@ begin Alpha := 1; W := 20; H := 20; - Col.r := 1; - Col.g := 1; - Col.b := 1; + SetLength(Col,1); + Col[0].r := 1; + Col[0].g := 1; + Col[0].b := 1; end; end; end; +Destructor TParticle.Destroy(); +begin + SetLength(Scale,0); + SetLength(Col,0); + inherited; +end; + procedure TParticle.LiveOn; begin //Live = 0 => Live forever ?? die werden doch aber im Manager bei Draw getötet, wenns 0 is @@ -144,6 +192,7 @@ begin Frame := ( Frame + 1 ) mod 16; // make our particles do funny stuff (besides being animated) + // changes of any particle-values throughout its life are done here case StarType of GoldenNote: begin @@ -168,21 +217,26 @@ begin end; procedure TParticle.Draw; +var L: Cardinal; begin - glColor4f(Col.r, Col.g, Col.b, Alpha); + // this draws (multiple) texture(s) of our particle + for L:=0 to High(Col) do + begin + glColor4f(Col[L].r, Col[L].g, Col[L].b, Alpha); - glBindTexture(GL_TEXTURE_2D, Tex); - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); + glBindTexture(GL_TEXTURE_2D, Tex); + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); - begin - glBegin(GL_QUADS); - glTexCoord2f((1/16) * Frame, 0); glVertex2f(X-W, Y-H); - glTexCoord2f((1/16) * Frame + (1/16), 0); glVertex2f(X-W, Y+H); - glTexCoord2f((1/16) * Frame + (1/16), 1); glVertex2f(X+W, Y+H); - glTexCoord2f((1/16) * Frame, 1); glVertex2f(X+W, Y-H); - glEnd; + begin + glBegin(GL_QUADS); + glTexCoord2f((1/16) * Frame, 0); glVertex2f(X-W*Scale[L], Y-H*Scale[L]); + glTexCoord2f((1/16) * Frame + (1/16), 0); glVertex2f(X-W*Scale[L], Y+H*Scale[L]); + glTexCoord2f((1/16) * Frame + (1/16), 1); glVertex2f(X+W*Scale[L], Y+H*Scale[L]); + glTexCoord2f((1/16) * Frame, 1); glVertex2f(X+W*Scale[L], Y-H*Scale[L]); + glEnd; + end; end; glcolor4f(1,1,1,1); end; @@ -313,6 +367,25 @@ begin end; end; +procedure TEffectManager.SentenceChange(); +var c: Cardinal; +begin + c:=0; + while c <= High(Particle) do + begin + if Particle[c].SurviveSentenceChange then + inc(c) + else + Kill(c); + end; + SetLength(RecArray,0); // remove GoldenRec positions + SetLength(PerfNoteArray,0); // remove PerfectNote positions + for c:=0 to 5 do + begin + TwinkleArray[c] := 0; // reset GoldenNoteHit memory + end; +end; + procedure TeffectManager.GoldenNoteTwinkle(Top,Bottom,Right: Real; Player: Integer); //Twinkle stars while golden note hit // this is called from UDraw.pas, SingDrawPlayerCzesc @@ -420,6 +493,65 @@ begin RandomFrame := RandomRange(0,14); Spawn(Xkatze, Ykatze, 16 - RandomFrame, RandomFrame, -1, PerfectNote, 0); end; //for + +end; + +procedure TEffectManager.SpawnPerfectLineTwinkle(); +var + P,I,Life: Cardinal; + Left, Right, Top, Bottom: Cardinal; +begin +// calculation of coordinates done with hardcoded values like in UDraw.pas +// might need to be adjusted if drawing of SingScreen is modified +// coordinates may still be a bit weird and need adjustment + if Ini.SingWindow = 0 then begin + Left := 130; + end else begin + Left := 30; + end; + Right := 770; + // spawn effect for every player with a perfect line + for P:=0 to PlayersPlay-1 do + if Player[P].LastSentencePerfect then + begin + // calculate area where notes of this player are drawn + case PlayersPlay of + 1: begin + Bottom:=Skin_P2_NotesB-10; + Top:=Bottom-105; + end; + 2,4: case P of + 0,2: begin + Bottom:=Skin_P1_NotesB-10; + Top:=Bottom-105; + end; + else begin + Bottom:=Skin_P2_NotesB-10; + Top:=Bottom-105; + end; + end; + 3,6: case P of + 0,3: begin + Top:=130; + Bottom:=Top+85; + end; + 1,4: begin + Top:=255; + Bottom:=Top+85; + end; + 2,5: begin + Top:=380; + Bottom:=Top+85; + end; + end; + end; + // spawn Sparkling Stars inside calculated coordinates + for I:= 0 to 80 do + begin + Life:=RandomRange(8,16); + Spawn(RandomRange(Left,Right), RandomRange(Top,Bottom), Life, 16-Life, -1, PerfectLineTwinkle, P); + end; + end; end; end. diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index f92b9457..3b6be56e 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -40,7 +40,9 @@ type LineBonus_StartY: integer; //PhrasenBonus - Line Bonus Mod End - + //PerfectLineTwinkle Mod (effect) + LastSentencePerfect: Boolean; + //PerfectLineTwinkle Mod end // Meter: real; diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index c6191cec..e3b7c7ad 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -371,7 +371,7 @@ begin //Kill all Stars not Killed yet //GoldenStarsTwinkle Mod - GoldenRec.KillAll; + GoldenRec.SentenceChange; //GoldenStarsTwinkle Mod End {Static[StaticP2R].Visible := V2R; @@ -1119,17 +1119,24 @@ begin //Refresh LastScore Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; - + //PerfectLineTwinkle Mod (effect) Pt.1 + if A >= 8 then Player[I].LastSentencePerfect := True + else Player[I].LastSentencePerfect := False; + //PerfectLineTwinkle Mod end end; //PhrasenBonus - Line Bonus Mod End// } + + //PerfectLineTwinkle Mod (effect) Pt.2 + GoldenRec.SpawnPerfectLineTwinkle; + //PerfectLineTwinkle Mod end end; //Called on Sentence Change S= New Current Sentence procedure TScreenSing.onSentenceChange(S: Cardinal); begin //GoldenStarsTwinkle Mod - GoldenRec.KillAll; + GoldenRec.SentenceChange; //GoldenStarsTwinkle Mod End end; -- cgit v1.2.3 From c3e4fa819306ebe07686ce448283cd9a18c262a9 Mon Sep 17 00:00:00 2001 From: b1indy Date: Thu, 12 Apr 2007 11:00:12 +0000 Subject: fixed bug in particle system that caused effects to be drawn on both screens when playing in dual screen mode, fixed position and particle counts of some effects, changed look of particles git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@81 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphicClasses.pas | 180 ++++++++++++++++++++-------------- 1 file changed, 107 insertions(+), 73 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphicClasses.pas b/Game/Code/Classes/UGraphicClasses.pas index 6f2aa0e4..acc26e96 100644 --- a/Game/Code/Classes/UGraphicClasses.pas +++ b/Game/Code/Classes/UGraphicClasses.pas @@ -2,7 +2,7 @@ unit UGraphicClasses; interface -const DelayBetweenFrames : Cardinal = 100; +const DelayBetweenFrames : Cardinal = 60; type TParticleType=(GoldenNote, PerfectNote, NoteHitTwinkle, PerfectLineTwinkle); @@ -13,6 +13,7 @@ type TParticle = Class X, Y : Real; //Position + Screen : Integer; W, H : Cardinal; //dimensions of particle Col : array of TColour3f; // Colour(s) of particle Scale : array of Real; // Scaling factors of particle layers @@ -23,9 +24,10 @@ type StarType : TParticleType; // GoldenNote | PerfectNote | NoteHitTwinkle | PerfectLineTwinkle Alpha : Real; // used for fading... mX, mY : Real; // movement-vector for PerfectLineTwinkle + SizeMod : Real; // experimental size modifier SurviveSentenceChange : Boolean; - Constructor Create(cX,cY: Real; cLive: Byte; cFrame : integer; cRecArrayIndex : Integer; cStarType : TParticleType; Player: Cardinal); + Constructor Create(cX,cY: Real; cScreen: Integer; cLive: Byte; cFrame : integer; cRecArrayIndex : Integer; cStarType : TParticleType; Player: Cardinal); Destructor Destroy(); procedure Draw; procedure LiveOn; @@ -35,10 +37,12 @@ type xTop, yTop, xBottom, yBottom : Real; TotalStarCount : Integer; CurrentStarCount : Integer; + Screen : Integer; end; PerfectNotePositions = Record xPos, yPos : Real; + Screen : Integer; end; TEffectManager = Class @@ -52,6 +56,7 @@ type destructor Destroy; override; procedure Draw; function Spawn(X, Y: Real; + Screen: Integer; Live: Byte; StartFrame: Integer; RecArrayIndex: Integer; // this is only used with GoldenNotes @@ -74,20 +79,22 @@ implementation uses sysutils, Windows,OpenGl12, UIni, UMain, UThemes, USkins, UGraphic, UDrawTexture, UTexture, math, dialogs; //TParticle -Constructor TParticle.Create(cX,cY: Real; cLive: Byte; cFrame : integer; cRecArrayIndex : Integer; cStarType : TParticleType; Player: Cardinal); +Constructor TParticle.Create(cX,cY: Real; cScreen: Integer; cLive: Byte; cFrame : integer; cRecArrayIndex : Integer; cStarType : TParticleType; Player: Cardinal); begin inherited Create; // in this constructor we set all initial values for our particle X := cX; Y := cY; + Screen := cScreen; Live := cLive; Frame:= cFrame; RecIndex := cRecArrayIndex; StarType := cStarType; Alpha := (-cos((Frame+1)*2*pi/16)+1); // neat fade-in-and-out SetLength(Scale,1); - Scale[0]:=1; - SurviveSentenceChange:=False; + Scale[0] := 1; + SurviveSentenceChange := False; + SizeMod := 1; case cStarType of GoldenNote: begin @@ -128,24 +135,26 @@ begin NoteHitTwinkle: begin Tex := Tex_Note_Star.TexNum; - Alpha := (Live/10); // linear fade-out + Alpha := (Live/16); // linear fade-out W := 15; H := 15; Setlength(Col,1); Col[0].r := 1; Col[0].g := 1; - Col[0].b := RandomRange(10*Live,100)/80; //0.9; + Col[0].b := RandomRange(10*Live,100)/90; //0.9; end; PerfectLineTwinkle: begin Tex := Tex_Note_Star.TexNum; - W := RandomRange(10,30); + W := RandomRange(10,20); H := W; + SizeMod := (-cos((Frame+1)*5*2*pi/16)*0.5+1.1); SurviveSentenceChange:=True; // assign colours according to player given - SetLength(Scale,2); + SetLength(Scale,3); Scale[1]:=0.3; - SetLength(Col,2); + Scale[2]:=0.2; + SetLength(Col,3); case Player of 0: LoadColor(Col[0].r,Col[0].g,Col[0].b,'P1Light'); 1: LoadColor(Col[0].r,Col[0].g,Col[0].b,'P2Light'); @@ -155,9 +164,12 @@ begin 5: LoadColor(Col[0].r,Col[0].g,Col[0].b,'P6Light'); else LoadColor(Col[0].r,Col[0].g,Col[0].b,'P1Light'); end; - Col[1].r:=Col[0].r+0.5; - Col[1].g:=Col[0].g+0.5; - Col[1].b:=Col[0].b+0.5; + Col[1].r := 1; + Col[1].g := 1; + Col[1].b := 0.4; + Col[2].r:=Col[0].r+0.5; + Col[2].g:=Col[0].g+0.5; + Col[2].b:=Col[0].b+0.5; mX := RandomRange(-5,5); mY := RandomRange(-5,5); end; @@ -209,6 +221,7 @@ begin PerfectLineTwinkle: begin Alpha := (-cos((Frame+1)*2*pi/16)+1); // neat fade-in-and-out + SizeMod := (-cos((Frame+1)*5*2*pi/16)*0.5+1.1); // move around X := X + mX; Y := Y + mY; @@ -219,25 +232,26 @@ end; procedure TParticle.Draw; var L: Cardinal; begin - // this draws (multiple) texture(s) of our particle - for L:=0 to High(Col) do - begin - glColor4f(Col[L].r, Col[L].g, Col[L].b, Alpha); + if ScreenAct = Screen then + // this draws (multiple) texture(s) of our particle + for L:=0 to High(Col) do + begin + glColor4f(Col[L].r, Col[L].g, Col[L].b, Alpha); - glBindTexture(GL_TEXTURE_2D, Tex); - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); + glBindTexture(GL_TEXTURE_2D, Tex); + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); - begin - glBegin(GL_QUADS); - glTexCoord2f((1/16) * Frame, 0); glVertex2f(X-W*Scale[L], Y-H*Scale[L]); - glTexCoord2f((1/16) * Frame + (1/16), 0); glVertex2f(X-W*Scale[L], Y+H*Scale[L]); - glTexCoord2f((1/16) * Frame + (1/16), 1); glVertex2f(X+W*Scale[L], Y+H*Scale[L]); - glTexCoord2f((1/16) * Frame, 1); glVertex2f(X+W*Scale[L], Y-H*Scale[L]); - glEnd; + begin + glBegin(GL_QUADS); + glTexCoord2f((1/16) * Frame, 0); glVertex2f(X-W*Scale[L]*SizeMod, Y-H*Scale[L]*SizeMod); + glTexCoord2f((1/16) * Frame + (1/16), 0); glVertex2f(X-W*Scale[L]*SizeMod, Y+H*Scale[L]*SizeMod); + glTexCoord2f((1/16) * Frame + (1/16), 1); glVertex2f(X+W*Scale[L]*SizeMod, Y+H*Scale[L]*SizeMod); + glTexCoord2f((1/16) * Frame, 1); glVertex2f(X+W*Scale[L]*SizeMod, Y-H*Scale[L]*SizeMod); + glEnd; + end; end; - end; glcolor4f(1,1,1,1); end; // end of TParticle @@ -301,11 +315,11 @@ begin end; // this method creates just one particle -function TEffectManager.Spawn(X, Y: Real; Live: Byte; StartFrame : Integer; RecArrayIndex : Integer; StarType : TParticleType; Player: Cardinal): Cardinal; +function TEffectManager.Spawn(X, Y: Real; Screen: Integer; Live: Byte; StartFrame : Integer; RecArrayIndex : Integer; StarType : TParticleType; Player: Cardinal): Cardinal; begin Result := Length(Particle); SetLength(Particle, (Result + 1)); - Particle[Result] := TParticle.Create(X, Y, Live, StartFrame, RecArrayIndex, StarType, Player); + Particle[Result] := TParticle.Create(X, Y, Screen, Live, StartFrame, RecArrayIndex, StarType, Player); end; // manage Sparkling of GoldenNote Bars @@ -325,7 +339,7 @@ for P:= 0 to high(RecArray) do Ykatze := RandomRange(Ceil(RecArray[P].yTop), Ceil(RecArray[P].yBottom)); RandomFrame := RandomRange(0,14); // Spawn a GoldenNote Particle - Spawn(Xkatze, Ykatze, 16 - RandomFrame, RandomFrame, P, GoldenNote, 0); + Spawn(Xkatze, Ykatze, RecArray[P].Screen, 16 - RandomFrame, RandomFrame, P, GoldenNote, 0); inc(RecArray[P].CurrentStarCount); end; end; @@ -400,43 +414,44 @@ begin H := (Top+Bottom)/2; // helper... with RecArray[P] do if ((xBottom >= Right) and (xTop <= Right) and - (yTop <= H) and (yBottom >= H)) then + (yTop <= H) and (yBottom >= H)) + and (Screen = ScreenAct) then begin TwinkleArray[Player] := Right; // remember twinkle position for this player - for C := 1 to 20 do + for C := 1 to 10 do begin Ykatze := RandomRange(ceil(Top) , ceil(Bottom)); XKatze := RandomRange(-7,3); - LKatze := RandomRange(4,10); - Spawn(Ceil(Right)+XKatze, YKatze, LKatze, 0, -1, NoteHitTwinkle, 0); + LKatze := RandomRange(7,13); + Spawn(Ceil(Right)+XKatze, YKatze, ScreenAct, LKatze, 0, -1, NoteHitTwinkle, 0); end; - for C := 1 to 5 do + for C := 1 to 3 do begin Ykatze := RandomRange(ceil(Top)-6 , ceil(Top)); XKatze := RandomRange(-5,1); - LKatze := RandomRange(2,3); - Spawn(Ceil(Right)+XKatze, YKatze, LKatze, 0, -1, NoteHitTwinkle, 0); + LKatze := RandomRange(4,7); + Spawn(Ceil(Right)+XKatze, YKatze, ScreenAct, LKatze, 0, -1, NoteHitTwinkle, 0); end; - for C := 1 to 5 do + for C := 1 to 3 do begin Ykatze := RandomRange(ceil(Bottom), ceil(Bottom)+6); XKatze := RandomRange(-5,1); - LKatze := RandomRange(2,3); - Spawn(Ceil(Right)+XKatze, YKatze, LKatze, 0, -1, NoteHitTwinkle, 0); + LKatze := RandomRange(4,7); + Spawn(Ceil(Right)+XKatze, YKatze, ScreenAct, LKatze, 0, -1, NoteHitTwinkle, 0); end; for C := 1 to 3 do begin Ykatze := RandomRange(ceil(Top)-10 , ceil(Top)-6); XKatze := RandomRange(-5,1); - LKatze := RandomRange(1,2); - Spawn(Ceil(Right)+XKatze, YKatze, LKatze, 0, -1, NoteHitTwinkle, 0); + LKatze := RandomRange(1,4); + Spawn(Ceil(Right)+XKatze, YKatze, ScreenAct, LKatze, 0, -1, NoteHitTwinkle, 0); end; for C := 1 to 3 do begin Ykatze := RandomRange(ceil(Bottom)+6 , ceil(Bottom)+10); XKatze := RandomRange(-5,1); - LKatze := RandomRange(1,2); - Spawn(Ceil(Right)+XKatze, YKatze, LKatze, 0, -1, NoteHitTwinkle, 0); + LKatze := RandomRange(1,4); + Spawn(Ceil(Right)+XKatze, YKatze, ScreenAct, LKatze, 0, -1, NoteHitTwinkle, 0); end; exit; // found a matching GoldenRec, did spawning stuff... done @@ -451,7 +466,9 @@ var begin For P := 0 to high(RecArray) do // Do we already have that "new" position? begin - if ((ceil(RecArray[P].xTop) = ceil(Xtop)) and (ceil(RecArray[P].yTop) = ceil(Ytop))) then + if (ceil(RecArray[P].xTop) = ceil(Xtop)) and + (ceil(RecArray[P].yTop) = ceil(Ytop)) and + (ScreenAct = RecArray[p].Screen) then exit; // it's already in the array, so we don't have to create a new one end; @@ -464,6 +481,7 @@ begin RecArray[NewIndex].yBottom := Ybottom; RecArray[NewIndex].TotalStarCount := ceil(Xbottom - Xtop) div 12 + 3; RecArray[NewIndex].CurrentStarCount := 0; + RecArray[NewIndex].Screen := ScreenAct; end; procedure TEffectManager.SavePerfectNotePos(Xtop, Ytop: Real); @@ -476,7 +494,8 @@ begin For P := 0 to high(PerfNoteArray) do // Do we already have that "new" position? begin with PerfNoteArray[P] do - if ((ceil(xPos) = ceil(Xtop)) and (ceil(yPos) = ceil(Ytop))) then + if (ceil(xPos) = ceil(Xtop)) and (ceil(yPos) = ceil(Ytop)) and + (Screen = ScreenAct) then exit; // it's already in the array, so we don't have to create a new one end; //for @@ -485,13 +504,14 @@ begin SetLength(PerfNoteArray, NewIndex + 1); PerfNoteArray[NewIndex].xPos := Xtop; PerfNoteArray[NewIndex].yPos := Ytop; + PerfNoteArray[NewIndex].Screen := ScreenAct; for P:= 0 to 2 do begin Xkatze := RandomRange(ceil(Xtop) - 5 , ceil(Xtop) + 10); Ykatze := RandomRange(ceil(Ytop) - 5 , ceil(Ytop) + 10); RandomFrame := RandomRange(0,14); - Spawn(Xkatze, Ykatze, 16 - RandomFrame, RandomFrame, -1, PerfectNote, 0); + Spawn(Xkatze, Ykatze, ScreenAct, 16 - RandomFrame, RandomFrame, -1, PerfectNote, 0); end; //for end; @@ -500,6 +520,7 @@ procedure TEffectManager.SpawnPerfectLineTwinkle(); var P,I,Life: Cardinal; Left, Right, Top, Bottom: Cardinal; + cScreen: Integer; begin // calculation of coordinates done with hardcoded values like in UDraw.pas // might need to be adjusted if drawing of SingScreen is modified @@ -517,39 +538,52 @@ begin // calculate area where notes of this player are drawn case PlayersPlay of 1: begin - Bottom:=Skin_P2_NotesB-10; + Bottom:=Skin_P2_NotesB; Top:=Bottom-105; + cScreen:=1; end; - 2,4: case P of - 0,2: begin - Bottom:=Skin_P1_NotesB-10; - Top:=Bottom-105; - end; - else begin - Bottom:=Skin_P2_NotesB-10; - Top:=Bottom-105; - end; + 2,4: begin + case P of + 0,2: begin + Bottom:=Skin_P1_NotesB; + Top:=Bottom-105; + end; + else begin + Bottom:=Skin_P2_NotesB; + Top:=Bottom-105; + end; + end; + case P of + 0,1: cScreen:=1; + else cScreen:=2; + end; end; - 3,6: case P of - 0,3: begin - Top:=130; - Bottom:=Top+85; - end; - 1,4: begin - Top:=255; - Bottom:=Top+85; - end; - 2,5: begin - Top:=380; - Bottom:=Top+85; - end; + 3,6: begin + case P of + 0,3: begin + Top:=130; + Bottom:=Top+85; + end; + 1,4: begin + Top:=255; + Bottom:=Top+85; + end; + 2,5: begin + Top:=380; + Bottom:=Top+85; + end; + end; + case P of + 0,1,2: cScreen:=1; + else cScreen:=2; + end; end; end; // spawn Sparkling Stars inside calculated coordinates for I:= 0 to 80 do begin Life:=RandomRange(8,16); - Spawn(RandomRange(Left,Right), RandomRange(Top,Bottom), Life, 16-Life, -1, PerfectLineTwinkle, P); + Spawn(RandomRange(Left,Right), RandomRange(Top,Bottom), cScreen, Life, 16-Life, -1, PerfectLineTwinkle, P); end; end; end; -- cgit v1.2.3 From e6917faa19aebfa6d089b24c65e4c7fe4bd6b503 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 13 Apr 2007 11:25:13 +0000 Subject: Added Reflection to ThemeStatic Added Attribut ReflectionSpacing git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@83 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 15 +++++++++++++- Game/Code/Menu/UMenu.pas | 24 +++++++++++++-------- Game/Code/Menu/UMenuButton.pas | 9 ++++---- Game/Code/Menu/UMenuStatic.pas | 47 ++++++++++++++++++++++++++++++++++++++++++ Game/Code/UltraStar.dpr | 2 +- 5 files changed, 82 insertions(+), 15 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index d7adb61a..51b454ca 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -91,6 +91,9 @@ type TexY1: real; TexX2: real; TexY2: real; + //Reflection Mod + Reflection: boolean; + Reflectionspacing: Real; end; AThemeStatic = array of TThemeStatic; @@ -129,7 +132,8 @@ type Tex: string; Typ: string; //Reflection Mod - Reflection: Boolean; + Reflection: boolean; + Reflectionspacing: Real; end; TThemeSelect = record @@ -181,6 +185,8 @@ type end; TThemeLoading = class(TThemeBasic) + StaticAnimation: TThemeStatic; + TextLoading: TThemeText; end; TThemeMain = class(TThemeBasic) @@ -749,6 +755,8 @@ begin // Loading ThemeLoadBasic(Loading, 'Loading'); + ThemeLoadText(Loading.TextLoading, 'LoadingTextLoading'); + ThemeLoadStatic(Loading.StaticAnimation, 'LoadingStaticAnimation'); // Main ThemeLoadBasic(Main, 'Main'); @@ -1284,6 +1292,10 @@ begin ThemeStatic.TexX2 := ThemeIni.ReadFloat(Name, 'TexX2', 1); ThemeStatic.TexY2 := ThemeIni.ReadFloat(Name, 'TexY2', 1); + //Reflection Mod + ThemeStatic.Reflection := (ThemeIni.ReadInteger(Name, 'Reflection', 0) = 1); + ThemeStatic.ReflectionSpacing := ThemeIni.ReadFloat(Name, 'ReflectionSpacing', 15); + DecimalSeparator := ','; end; @@ -1317,6 +1329,7 @@ begin //Reflection Mod ThemeButton.Reflection := (ThemeIni.ReadInteger(Name, 'Reflection', 0) = 1); + ThemeButton.ReflectionSpacing := ThemeIni.ReadFloat(Name, 'ReflectionSpacing', 15); ThemeButton.ColR := ThemeIni.ReadFloat(Name, 'ColR', 1); ThemeButton.ColG := ThemeIni.ReadFloat(Name, 'ColG', 1); diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 45a25cb7..7908d980 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -13,7 +13,6 @@ type protected Interactions: array of TInteract; SelInteraction: integer; - Static: array of TStatic; Button: array of TButton; Selects: array of TSelect; SelectsS: array of TSelectSlide; @@ -22,6 +21,7 @@ type BackH: integer; public Text: array of TText; + Static: array of TStatic; mX: integer; // mouse X mY: integer; // mouse Y @@ -50,7 +50,7 @@ type function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string): integer; overload; function AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; overload; function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; overload; - function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; Name, Format, Typ: string; Color: integer): integer; overload; + function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; Name, Format, Typ: string; Color: integer; Reflection: Boolean; ReflectionSpacing: Real): integer; overload; // text function AddText(ThemeText: TThemeText): integer; overload; @@ -62,7 +62,7 @@ type function AddButton(ThemeButton: TThemeButton): integer; overload; function AddButton(X, Y, W, H: real; Name: String): integer; overload; function AddButton(X, Y, W, H: real; Name, Format, Typ: String; Reflection: Boolean): integer; overload; - function AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean): integer; overload; + function AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean; ReflectionSpacing: Real): integer; overload; procedure ClearButtons; procedure AddButtonText(AddX, AddY: real; AddText: string); overload; procedure AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; AddText: string); overload; @@ -232,7 +232,7 @@ begin ThemeStatic.ColR, ThemeStatic.ColG, ThemeStatic.ColB, ThemeStatic.TexX1, ThemeStatic.TexY1, ThemeStatic.TexX2, ThemeStatic.TexY2, {<0.5.1: Skin.SkinPath + ThemeStatic.Tex, 0.5.1:} Skin.GetTextureFileName(ThemeStatic.Tex), - 'JPG', ThemeStatic.Typ, $FFFFFF); + 'JPG', ThemeStatic.Typ, $FFFFFF, ThemeStatic.Reflection, ThemeStatic.Reflectionspacing); //'Font Black'); end; @@ -284,11 +284,11 @@ end; function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; begin - Result := AddStatic(X, Y, W, H, Z, ColR, ColG, ColB, 0, 0, 1, 1, Name, Format, Typ, Color); + Result := AddStatic(X, Y, W, H, Z, ColR, ColG, ColB, 0, 0, 1, 1, Name, Format, Typ, Color, False, 0); // end; -function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; Name, Format, Typ: string; Color: integer): integer; +function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; Name, Format, Typ: string; Color: integer; Reflection: Boolean; ReflectionSpacing: Real): integer; var StatNum: integer; begin @@ -315,6 +315,11 @@ Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format) Static[StatNum].Texture.TexY2 := TexY2; Static[StatNum].Texture.Alpha := 1; Static[StatNum].Visible := true; + + //ReflectionMod + Static[StatNum].Reflection := Reflection; + Static[StatNum].ReflectionSpacing := ReflectionSpacing; + Result := StatNum; end; @@ -367,7 +372,7 @@ begin Result := AddButton(ThemeButton.X, ThemeButton.Y, ThemeButton.W, ThemeButton.H, ThemeButton.ColR, ThemeButton.ColG, ThemeButton.ColB, ThemeButton.Int, ThemeButton.DColR, ThemeButton.DColG, ThemeButton.DColB, ThemeButton.DInt, - Skin.GetTextureFileName(ThemeButton.Tex), 'JPG', ThemeButton.Typ, ThemeButton.Reflection); + Skin.GetTextureFileName(ThemeButton.Tex), 'JPG', ThemeButton.Typ, ThemeButton.Reflection, ThemeButton.Reflectionspacing); Button[Result].Z := ThemeButton.Z; @@ -388,10 +393,10 @@ end; function TMenu.AddButton(X, Y, W, H: real; Name, Format, Typ: String; Reflection: Boolean): integer; begin - Result := AddButton(X, Y, W, H, 1, 1, 1, 1, 1, 1, 1, 0.5, Name, 'JPG', 'Plain', Reflection); + Result := AddButton(X, Y, W, H, 1, 1, 1, 1, 1, 1, 1, 0.5, Name, 'JPG', 'Plain', Reflection, 15); end; -function TMenu.AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean): integer; +function TMenu.AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean; ReflectionSpacing: Real): integer; begin // adds button Result := Length(Button); @@ -425,6 +430,7 @@ begin Button[Result].SetSelect(false); Button[Result].Reflection := Reflection; + Button[Result].Reflectionspacing := ReflectionSpacing; // adds interaction AddInteraction(iButton, Result); diff --git a/Game/Code/Menu/UMenuButton.pas b/Game/Code/Menu/UMenuButton.pas index e42a5488..f4f8e1a8 100644 --- a/Game/Code/Menu/UMenuButton.pas +++ b/Game/Code/Menu/UMenuButton.pas @@ -19,6 +19,7 @@ type Visible: boolean; //Reflection Mod Reflection: boolean; + Reflectionspacing: Real; Selectable: boolean; @@ -190,23 +191,23 @@ begin glBegin(GL_QUADS);//Top Left glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); glTexCoord2f(TexX1*TexW, TexY2*TexH); - glVertex3f(x, y+h*scaleH+ 15, z); + glVertex3f(x, y+h*scaleH+ Reflectionspacing, z); //Bottom Left glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); glTexCoord2f(TexX1*TexW, {TexY1*TexH*}0.5); - glVertex3f(x, y+h*scaleH + h*scaleH/2 + 15, z); + glVertex3f(x, y+h*scaleH + h*scaleH/2 + Reflectionspacing, z); //Bottom Right glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); glTexCoord2f(TexX2*TexW, {TexY1*TexH*}0.5); - glVertex3f(x+w*scaleW, y+h*scaleH + h*scaleH/2 + 15, z); + glVertex3f(x+w*scaleW, y+h*scaleH + h*scaleH/2 + Reflectionspacing, z); //Top Right glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); glTexCoord2f(TexX2*TexW, TexY2*TexH); - glVertex3f(x+w*scaleW, y+h*scaleH + 15, z); + glVertex3f(x+w*scaleW, y+h*scaleH + Reflectionspacing, z); glEnd; end; end; diff --git a/Game/Code/Menu/UMenuStatic.pas b/Game/Code/Menu/UMenuStatic.pas index 4b10e54c..c19e6abc 100644 --- a/Game/Code/Menu/UMenuStatic.pas +++ b/Game/Code/Menu/UMenuStatic.pas @@ -8,6 +8,11 @@ type public Texture: TTexture; // Button Screen position and size Visible: boolean; + + //Reflection Mod + Reflection: boolean; + Reflectionspacing: Real; + procedure Draw; constructor Create(Textura: TTexture); overload; end; @@ -21,6 +26,48 @@ var begin if Visible then DrawTexture(Texture); + + //Reflection Mod + if (Reflection) then // Draw Reflections + begin + with Texture do + begin + //Bind Tex and GL Attributes + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glDepthRange(0, 10); + glDepthFunc(GL_LEQUAL); + //glDepthFunc(GL_GEQUAL); + glEnable(GL_DEPTH_TEST); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + //glBlendFunc(GL_SRC_COLOR, GL_ZERO); + glBindTexture(GL_TEXTURE_2D, TexNum); + + //Draw + glBegin(GL_QUADS);//Top Left + glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); + glTexCoord2f(TexX1*TexW, TexY2*TexH); + glVertex3f(x, y+h*scaleH+ Reflectionspacing, z); + + //Bottom Left + glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); + glTexCoord2f(TexX1*TexW, {TexY1*TexH*}0.5); + glVertex3f(x, y+h*scaleH + h*scaleH/2 + Reflectionspacing, z); + + + //Bottom Right + glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); + glTexCoord2f(TexX2*TexW, {TexY1*TexH*}0.5); + glVertex3f(x+w*scaleW, y+h*scaleH + h*scaleH/2 + Reflectionspacing, z); + + //Top Right + glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); + glTexCoord2f(TexX2*TexW, TexY2*TexH); + glVertex3f(x+w*scaleW, y+h*scaleH + Reflectionspacing, z); + glEnd; + end; + end; + end; constructor TStatic.Create(Textura: TTexture); diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index f36f9a26..fc1fa8a2 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -103,7 +103,7 @@ uses const - Version = 'UltraStar Deluxe V 0.90 Beta'; + Version = 'UltraStar Deluxe V 0.95 Beta'; var WndTitle: string; -- cgit v1.2.3 From b8722c611ffaabde301f3134c1c8d76e64e3b02f Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 13 Apr 2007 12:10:49 +0000 Subject: Fixed Bug in Reflection Code that Causes wrong Depth Test when drawing Text git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@84 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UMenuButton.pas | 8 ++++++-- Game/Code/Menu/UMenuStatic.pas | 15 ++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UMenuButton.pas b/Game/Code/Menu/UMenuButton.pas index f4f8e1a8..3a871c5f 100644 --- a/Game/Code/Menu/UMenuButton.pas +++ b/Game/Code/Menu/UMenuButton.pas @@ -179,12 +179,12 @@ begin //Bind Tex and GL Attributes glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); + glDepthRange(0, 10); glDepthFunc(GL_LEQUAL); - //glDepthFunc(GL_GEQUAL); glEnable(GL_DEPTH_TEST); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - //glBlendFunc(GL_SRC_COLOR, GL_ZERO); glBindTexture(GL_TEXTURE_2D, TexNum); //Draw @@ -209,6 +209,10 @@ begin glTexCoord2f(TexX2*TexW, TexY2*TexH); glVertex3f(x+w*scaleW, y+h*scaleH + Reflectionspacing, z); glEnd; + + glDisable(GL_TEXTURE_2D); + glDisable(GL_DEPTH_TEST); + glDisable(GL_BLEND); end; end; diff --git a/Game/Code/Menu/UMenuStatic.pas b/Game/Code/Menu/UMenuStatic.pas index c19e6abc..2a5e1e93 100644 --- a/Game/Code/Menu/UMenuStatic.pas +++ b/Game/Code/Menu/UMenuStatic.pas @@ -25,6 +25,7 @@ var Pet: integer; begin if Visible then + begin DrawTexture(Texture); //Reflection Mod @@ -35,12 +36,12 @@ begin //Bind Tex and GL Attributes glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); + glDepthRange(0, 10); glDepthFunc(GL_LEQUAL); - //glDepthFunc(GL_GEQUAL); glEnable(GL_DEPTH_TEST); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - //glBlendFunc(GL_SRC_COLOR, GL_ZERO); glBindTexture(GL_TEXTURE_2D, TexNum); //Draw @@ -51,13 +52,13 @@ begin //Bottom Left glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); - glTexCoord2f(TexX1*TexW, {TexY1*TexH*}0.5); + glTexCoord2f(TexX1*TexW, 0.5); glVertex3f(x, y+h*scaleH + h*scaleH/2 + Reflectionspacing, z); //Bottom Right glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); - glTexCoord2f(TexX2*TexW, {TexY1*TexH*}0.5); + glTexCoord2f(TexX2*TexW, 0.5); glVertex3f(x+w*scaleW, y+h*scaleH + h*scaleH/2 + Reflectionspacing, z); //Top Right @@ -65,9 +66,13 @@ begin glTexCoord2f(TexX2*TexW, TexY2*TexH); glVertex3f(x+w*scaleW, y+h*scaleH + Reflectionspacing, z); glEnd; + + glDisable(GL_TEXTURE_2D); + glDisable(GL_DEPTH_TEST); + glDisable(GL_BLEND); end; end; - + end; end; constructor TStatic.Create(Textura: TTexture); -- cgit v1.2.3 From 0d4f50f6a2ba32a0176d768646208dbec3136084 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 13 Apr 2007 16:28:45 +0000 Subject: Fixed some Bugs in Skipto and Random Methods Now the last Song of a Category could be the Result of Randomize when there is an odd number of Songs. Also a little bit better Random Results git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@85 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index e873d287..7ea5d268 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -66,7 +66,7 @@ type procedure SelectNext; procedure SelectPrev; procedure UpdateLCD; - procedure SkipTo(Target: integer); + procedure SkipTo(Target: Cardinal); procedure FixSelected; //Show Wrong Song when Tabs on Fix procedure FixSelected2; //Show Wrong Song when Tabs on Fix procedure ShowCatTL(Cat: Integer);// Show Cat in Top left @@ -208,7 +208,7 @@ begin begin if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then begin - SkipTo(2 + CatSongs.VisibleIndex((I + Interaction) mod I2)); + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); Music.PlayChange; @@ -521,7 +521,7 @@ begin SelectNext; //Fix: Not Existing Song selected: - if (I+1=I2) then Inc(I2); + //if (I+1=I2) then Inc(I2); //Choose Song SkipTo(I2-I); @@ -529,7 +529,7 @@ begin end else //Random in one Category begin - SkipTo(2+Random(CatSongs.VisibleSongs-1)); + SkipTo(Random(CatSongs.VisibleSongs)); end; Music.PlayChange; @@ -1324,7 +1324,7 @@ begin Music.Stop; end; -procedure TScreenSong.SkipTo(Target: integer); // 0.5.0 +procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0 var Skip: integer; I: integer; @@ -1339,7 +1339,7 @@ begin Interaction := 0; SongTarget := 0; - for I := 2 to Target do + for I := 1 to Target+1 do SelectNext; FixSelected2; @@ -1481,7 +1481,7 @@ begin SelectNext; //Fix: Not Existing Song selected: - if (I+1=I2) then Inc(I2); + //if (I+1=I2) then Inc(I2); //Choose Song SkipTo(I2-I); @@ -1495,7 +1495,7 @@ begin SelectNext; FixSelected; - SkipTo(2+Random(CatSongs.VisibleSongs-1)); + SkipTo(Random(CatSongs.VisibleSongs)); Music.PlayChange; ChangeMusic; SetScroll4; @@ -1505,7 +1505,7 @@ begin begin PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); - SkipTo(2+Random(CatSongs.VisibleSongs-1)); + SkipTo(Random(CatSongs.VisibleSongs)); Music.PlayChange; ChangeMusic; SetScroll4; -- cgit v1.2.3 From b1e40ba133782a3d36ec78d4cf9c0245b88448d1 Mon Sep 17 00:00:00 2001 From: b1indy Date: Fri, 13 Apr 2007 22:17:48 +0000 Subject: implemented fading between screens (needs to be tested), minor tweaking of perfect-line effect position, added myself to credits ;) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@86 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphicClasses.pas | 6 +- Game/Code/Menu/UDisplay.pas | 209 ++++++++++++++-------------------- Game/Code/Screens/UScreenMain.pas | 5 +- 3 files changed, 93 insertions(+), 127 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphicClasses.pas b/Game/Code/Classes/UGraphicClasses.pas index acc26e96..e1cd8aff 100644 --- a/Game/Code/Classes/UGraphicClasses.pas +++ b/Game/Code/Classes/UGraphicClasses.pas @@ -538,18 +538,18 @@ begin // calculate area where notes of this player are drawn case PlayersPlay of 1: begin - Bottom:=Skin_P2_NotesB; + Bottom:=Skin_P2_NotesB+10; Top:=Bottom-105; cScreen:=1; end; 2,4: begin case P of 0,2: begin - Bottom:=Skin_P1_NotesB; + Bottom:=Skin_P1_NotesB+10; Top:=Bottom-105; end; else begin - Bottom:=Skin_P2_NotesB; + Bottom:=Skin_P2_NotesB+10; Top:=Bottom-105; end; end; diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index 6d0443cc..d7439dc9 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -2,7 +2,7 @@ unit UDisplay; interface -uses Windows, SDL, UMenu, OpenGL12, SysUtils; +uses Windows, SDL, UMenu, OpenGL12, SysUtils, dialogs; type TDisplay = class @@ -12,13 +12,19 @@ type h_DC: HDC; h_RC: HGLRC; -// FadeType: integer; - FadeTex: glUInt; - LastFade: real; - Fade: real; + Fade: Real; + // fade-mod + myfade: integer; + pTexData : Pointer; + pTex : glUInt; + // end + function Draw: Boolean; procedure PrintScreen; constructor Create; + // fade mod + destructor Destroy; + // end procedure ScreenShot; end; @@ -34,23 +40,42 @@ uses UGraphic, UTime, Graphics, Jpeg, UPliki, UTexture; constructor TDisplay.Create; begin inherited Create; -// FadeType := 0; - Fade := 0; + // fade mod + myfade:=0; + // generate texture for fading between screens + GetMem(pTexData, 1024*1024*4); + glGenTextures(1, pTex); + glBindTexture(GL_TEXTURE_2D, pTex); + + glTexImage2D(GL_TEXTURE_2D, 0, 3, 1024, 1024, 0, GL_RGBA, GL_UNSIGNED_BYTE, pTexData); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + FreeMem(pTexData); + // end +end; + +// fade mod +destructor TDisplay.Destroy; +begin + glDeleteTextures(1,@pTex); + inherited Destroy; end; +// end function TDisplay.Draw: Boolean; var S: integer; - Col: real; - Surface: PSDL_Surface; + // fade mod + myfade2:integer; + // end begin Result := True; - Col := 1; +{ Col := 1; if (ParamStr(1) = '-black') or (ParamStr(1) = '-fsblack') then - Col := 0; + Col := 0;} - glClearColor(Col, Col, Col , 1); + glClearColor(0, 0, 0 , 0); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); for S := 1 to Screens do begin @@ -62,125 +87,63 @@ begin ScreenX := 0; - if S = 2 then TimeSkip := 0; // it's easier than rewriting code + if S = 2 then TimeSkip := 0 else; // it's easier than rewriting code glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); - ActualScreen.SetAnimationProgress(1); - if not assigned (NextScreen) then Result := ActualScreen.Draw +// ActualScreen.SetAnimationProgress(1); + if not assigned (NextScreen) then begin + Result := ActualScreen.Draw; + // fade mod + myfade:=0; + // end + end else begin - LastFade := Fade; - Fade := Fade + TimeSkip * 6; // * 4 - - {//Create Fading texture - if Fade = 0 then - begin - Surface := SDL_GetVideoSurface; - glGenTextures(1, FadeTex); - - glBindTexture(GL_TEXTURE_2D, FadeTex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glPixelStorei(GL_UNPACK_ROW_LENGTH, Surface.pitch div Surface.format.BytesPerPixel); - glTexImage2D(GL_TEXTURE_2D, 0, 3, 800, 600, 0, GL_RGBA, GL_UNSIGNED_BYTE, Surface.pixels); - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - end;} - - ActualScreen.ShowFinish := false; - - //Fade = 2 (Belnding) Mod - if (FadeTex > 0) then + // fade mod + //Create Fading texture if we're just starting + if myfade = 0 then begin - ActualScreen.SetAnimationProgress(Fade-1); ActualScreen.Draw; - glBindTexture(GL_TEXTURE_2D, FadeTex); - glColor4f(Col, Col, Col, 1-Fade); // 0 - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glVertex2f(0, 0); - glVertex2f(0, 600); - glVertex2f(800, 600); - glVertex2f(800, 0); - glEnd; - glDisable(GL_BLEND); - end - else - begin - case ActualScreen.Fade of - 0: begin - if Fade < 1 then begin - ActualScreen.SetAnimationProgress(1-Fade); - ActualScreen.Draw; - glColor4f(Col, Col, Col, Fade); // 0 - end else begin - ActualScreen.SetAnimationProgress(Fade-1); - ActualScreen.Draw; - glColor4f(Col, Col, Col, 1-Fade); // 0 - end; - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glVertex2f(0, 0); - glVertex2f(0, 600); - glVertex2f(800, 600); - glVertex2f(800, 0); - glEnd; - glDisable(GL_BLEND); - end; - 2: begin - if Fade < 1 then begin - ActualScreen.SetAnimationProgress(1-Fade); - ActualScreen.Draw; - //glColor4f(Col, Col, Col, Fade); // 0 - glColor4f(1, 1, 1, 1); // 0 - //Fade := 1 - end; - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glVertex2f(0, 0); - glVertex2f(0, 600); - glVertex2f(800, 600); - glVertex2f(800, 0); - glEnd; - glDisable(GL_BLEND); - end; - end; // case + glBindTexture(GL_TEXTURE_2D, pTex); + glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 1024, 1024, 0); + NextScreen.onShow; end; - if (LastFade < 1 ) and (Fade >= 1) then begin - if (ActualScreen.Fade = 2) then - begin - ScreenShot; - //Create Fading Texture - Surface := SDL_GetVideoSurface; - glGenTextures(1, FadeTex); - - glBindTexture(GL_TEXTURE_2D, FadeTex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - glPixelStorei(GL_UNPACK_ROW_LENGTH, Surface.pitch div Surface.format.BytesPerPixel); - glTexImage2D(GL_TEXTURE_2D, 0, 3, 800, 600, 0, GL_RGBA, GL_UNSIGNED_BYTE, Surface.pixels); - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - end; - - // pokazuje 2 ekran, ale nie kasuje informacji o NextScreen - ActualScreen.onHide; - ActualScreen := NextScreen; - ActualScreen.onShow; - end; - - if Fade >= 2 then begin - if (FadeTex > 0) then //Delete Fade Tex - begin - glDeleteTextures(1, @FadeTex); - FadeTex := 0; - end; - - // koniec fade'a - ActualScreen := NextScreen; +// LastFade := Fade; // whatever +// Fade := Fade -0.999; // start fading out + myfade:=myfade+1; + +// ActualScreen.ShowFinish := false; // no purpose? + +// ActualScreen.SetAnimationProgress(Fade-1); // nop? + + NextScreen.Draw; // draw next screen + + // and draw old screen over it... slowly fading out + myfade2:=myfade*myfade; + glBindTexture(GL_TEXTURE_2D, pTex); + glColor4f(1, 1, 1, (1000-myfade2)/1000); // strange calculation - alpha gets negative... but looks good this way + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glTexCoord2f(0,0);glVertex2f(0-myfade2, 600+myfade2); + glTexCoord2f(0,ScreenH/1024);glVertex2f(0-myfade2, 0-myfade2); + glTexCoord2f(ScreenW/1024,ScreenH/1024);glVertex2f(800+myfade2, 0-myfade2); + glTexCoord2f(ScreenW/1024,0);glVertex2f(800+myfade2, 600+myfade2); + glEnd; + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + end; + + if myfade > 50 then begin // fade out complete... + myfade:=0; + ActualScreen.onHide; // nop... whatever + ActualScreen.ShowFinish:=False; + ActualScreen:=NextScreen; NextScreen := nil; - ActualScreen.onShowFinish; - ActualScreen.ShowFinish := true; - end; + ActualScreen.onShowFinish; // one more nop... + ActualScreen.ShowFinish := true; // who wrote this crap? + // end of fade mod end; // if end; // for // SwapBuffers(h_DC); diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 43034912..70916437 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -29,7 +29,7 @@ type function Draw: boolean; override; end; -const Credits_Text: Array[0..46] of PChar = ( +const Credits_Text: Array[0..49] of PChar = ( ':SPACE:', 'Main Idea: Corvus 5', 'Thank you very much for this great Game', @@ -48,6 +48,9 @@ const Credits_Text: Array[0..46] of PChar = ( 'Mog:', 'Programming, Graphics', ':SPACE:', + 'blindy:', + 'VFX Programming', + ':SPACE:', 'Mota:', 'Programming, Idea of creating this Mod', ':SPACE:', -- cgit v1.2.3 From 12eb3f055c7c75dbfeb168d5c38f87a901a6ab89 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 14 Apr 2007 10:03:18 +0000 Subject: Fixed a bug that causes Perfect Line twinkles to spawn at each Line when LineBonus is deactivated. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@87 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index e3b7c7ad..e4fd7add 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1084,12 +1084,12 @@ begin //PhrasenBonus - Line Bonus Mod + //Generate Steps 0 to 8 + A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); + If (Ini.LineBonus > 0) then begin - //Generate Steps 0 to 8 - A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); - //Generate Text if A >= 8 then Player[I].LineBonus_Text := Theme.Sing.LineBonusText[8] @@ -1111,21 +1111,21 @@ begin Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; Player[I].LineBonus_Alpha := 0.92; Player[I].LineBonus_Visible := True; + end; + //PhrasenBonus - Line Bonus Mod End// } - - + //PerfectLineTwinkle Mod (effect) Pt.1 + If (Ini.EffectPerfect>=1) then + begin + if A >= 8 then Player[I].LastSentencePerfect := True + else Player[I].LastSentencePerfect := False; end; + //PerfectLineTwinkle Mod end //Refresh LastScore Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; - //PerfectLineTwinkle Mod (effect) Pt.1 - if A >= 8 then Player[I].LastSentencePerfect := True - else Player[I].LastSentencePerfect := False; - //PerfectLineTwinkle Mod end - end; -//PhrasenBonus - Line Bonus Mod End// } //PerfectLineTwinkle Mod (effect) Pt.2 GoldenRec.SpawnPerfectLineTwinkle; @@ -1138,7 +1138,6 @@ begin //GoldenStarsTwinkle Mod GoldenRec.SentenceChange; //GoldenStarsTwinkle Mod End - end; end. -- cgit v1.2.3 From b627232ec93e4cb32790ddf30e3d27e7a2775cbb Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 14 Apr 2007 14:30:37 +0000 Subject: added some error checking to screen-fade-effect, restored proper order of credits git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@88 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UDisplay.pas | 114 ++++++++++++++++++++++++-------------- Game/Code/Screens/UScreenMain.pas | 6 +- 2 files changed, 76 insertions(+), 44 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index d7439dc9..876fb6b6 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -14,7 +14,9 @@ type Fade: Real; // fade-mod - myfade: integer; + doFade: Boolean; + myFade: integer; + lastTime: Cardinal; pTexData : Pointer; pTex : glUInt; // end @@ -42,22 +44,36 @@ begin inherited Create; // fade mod myfade:=0; + doFade:=True; // generate texture for fading between screens GetMem(pTexData, 1024*1024*4); - glGenTextures(1, pTex); - glBindTexture(GL_TEXTURE_2D, pTex); - - glTexImage2D(GL_TEXTURE_2D, 0, 3, 1024, 1024, 0, GL_RGBA, GL_UNSIGNED_BYTE, pTexData); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - FreeMem(pTexData); + if pTexData <> NIL then + begin + glGenTextures(1, pTex); + if glGetError <> GL_NO_ERROR then doFade := False; + glBindTexture(GL_TEXTURE_2D, pTex); + if glGetError <> GL_NO_ERROR then doFade := False; + glTexImage2D(GL_TEXTURE_2D, 0, 3, 1024, 1024, 0, GL_RGBA, GL_UNSIGNED_BYTE, pTexData); + if glGetError <> GL_NO_ERROR then doFade := False; + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + if glGetError <> GL_NO_ERROR then doFade := False; + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + if glGetError <> GL_NO_ERROR then doFade := False; + FreeMem(pTexData); + end + else + begin + doFade:=False; + end; + if not doFade then showmessage('Fehler beim Initialisieren der Fading-Textur... Fading deaktiviert'); // end end; // fade mod destructor TDisplay.Destroy; begin - glDeleteTextures(1,@pTex); + if doFade then + glDeleteTextures(1,@pTex); inherited Destroy; end; // end @@ -66,7 +82,8 @@ function TDisplay.Draw: Boolean; var S: integer; // fade mod - myfade2:integer; + myFade2:integer; + currentTime: Cardinal; // end begin Result := True; @@ -97,53 +114,68 @@ begin myfade:=0; // end end - else begin - // fade mod - //Create Fading texture if we're just starting - if myfade = 0 then + else + begin + if doFade then begin - ActualScreen.Draw; - glBindTexture(GL_TEXTURE_2D, pTex); - glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 1024, 1024, 0); - NextScreen.onShow; - end; - + // fade mod + //Create Fading texture if we're just starting + if myfade = 0 then + begin + ActualScreen.Draw; + glBindTexture(GL_TEXTURE_2D, pTex); + glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 1024, 1024, 0); + if glGetError <> GL_NO_ERROR then + begin + doFade := False; + showmessage('Fehler beim Kopieren der Fade-Textur... Fading deaktiviert'); + end; + NextScreen.onShow; + lastTime:=GetTickCount; + myfade:=myfade+1; + end; + currentTime:=GetTickCount; + if currentTime > lastTime+30 then + begin + myfade:=myfade+4; + lastTime:=currentTime; + end; // LastFade := Fade; // whatever // Fade := Fade -0.999; // start fading out - myfade:=myfade+1; + // ActualScreen.ShowFinish := false; // no purpose? // ActualScreen.SetAnimationProgress(Fade-1); // nop? - NextScreen.Draw; // draw next screen + NextScreen.Draw; // draw next screen // and draw old screen over it... slowly fading out - myfade2:=myfade*myfade; - glBindTexture(GL_TEXTURE_2D, pTex); - glColor4f(1, 1, 1, (1000-myfade2)/1000); // strange calculation - alpha gets negative... but looks good this way - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glTexCoord2f(0,0);glVertex2f(0-myfade2, 600+myfade2); - glTexCoord2f(0,ScreenH/1024);glVertex2f(0-myfade2, 0-myfade2); - glTexCoord2f(ScreenW/1024,ScreenH/1024);glVertex2f(800+myfade2, 0-myfade2); - glTexCoord2f(ScreenW/1024,0);glVertex2f(800+myfade2, 600+myfade2); - glEnd; - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - end; - - if myfade > 50 then begin // fade out complete... - myfade:=0; + myfade2:=myfade*myfade; + glBindTexture(GL_TEXTURE_2D, pTex); + glColor4f(1, 1, 1, (1000-myfade2)/1000); // strange calculation - alpha gets negative... but looks good this way + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glTexCoord2f(0,0);glVertex2f(0-myfade2, 600+myfade2); + glTexCoord2f(0,ScreenH/1024);glVertex2f(0-myfade2, 0-myfade2); + glTexCoord2f(ScreenW/1024,ScreenH/1024);glVertex2f(800+myfade2, 0-myfade2); + glTexCoord2f(ScreenW/1024,0);glVertex2f(800+myfade2, 600+myfade2); + glEnd; + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + end; + if (myfade > 40) or (not doFade) then begin // fade out complete... + myFade:=0; ActualScreen.onHide; // nop... whatever ActualScreen.ShowFinish:=False; ActualScreen:=NextScreen; NextScreen := nil; ActualScreen.onShowFinish; // one more nop... ActualScreen.ShowFinish := true; // who wrote this crap? - // end of fade mod + // end of fade mod + end; end; // if end; // for // SwapBuffers(h_DC); diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 70916437..5849341c 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -36,6 +36,9 @@ const Credits_Text: Array[0..49] of PChar = ( ':SPACE:', 'The Ultrastar Deluxe Team:', ':SPACE:', + 'blindy:', + 'VFX Programming', + ':SPACE:', 'commandi00:', 'Beta Testing', ':SPACE:', @@ -48,9 +51,6 @@ const Credits_Text: Array[0..49] of PChar = ( 'Mog:', 'Programming, Graphics', ':SPACE:', - 'blindy:', - 'VFX Programming', - ':SPACE:', 'Mota:', 'Programming, Idea of creating this Mod', ':SPACE:', -- cgit v1.2.3 From 1fcd567446dce6e5e02d802e26cf38a538092cf3 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 14 Apr 2007 16:54:30 +0000 Subject: Did Some Code Cleanup Fixed some Bugs in Party Mode Added a Better Round Plugin Selection git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@89 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UParty.pas | 120 ++++++++++++++++++++++++++---- Game/Code/Screens/UScreenMain.pas | 61 +-------------- Game/Code/Screens/UScreenPartyOptions.pas | 23 ++---- Game/Code/Screens/UScreenPartyPlayer.pas | 4 - 4 files changed, 114 insertions(+), 94 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UParty.pas b/Game/Code/Classes/UParty.pas index da89ca8a..f5834dd8 100644 --- a/Game/Code/Classes/UParty.pas +++ b/Game/Code/Classes/UParty.pas @@ -22,7 +22,7 @@ type constructor Create; - procedure StartNewParty; + procedure StartNewParty(NumRounds: Byte); procedure StartRound; procedure EndRound; function GetWinner: Byte; @@ -47,14 +47,98 @@ end; //---------- //StartNewParty - Clears the Class and Prepares for new Party //---------- -procedure TParty_Session.StartNewParty; +procedure TParty_Session.StartNewParty(NumRounds: Byte); +var + Plugins: Array of record + ID: Byte; + TimesPlayed: Byte; + end; + TeamMode: Boolean; + Len: Integer; + I: Integer; + + function GetRandomPlugin: Byte; + var + LowestTP: Byte; + NumPwithLTP: Word; + I: Integer; + R: Word; + begin + LowestTP := high(Byte); + NumPwithLTP := 0; + + //Search for Plugins not often played yet + For I := 0 to high(Plugins) do + begin + if (Plugins[I].TimesPlayed < lowestTP) then + begin + lowestTP := Plugins[I].TimesPlayed; + NumPwithLTP := 1; + end + else if (Plugins[I].TimesPlayed = lowestTP) then + begin + Inc(NumPwithLTP); + end; + end; + + //Create Random No + R := Random(NumPwithLTP); + + //Search for Random Plugin + For I := 0 to high(Plugins) do + begin + if Plugins[I].TimesPlayed = lowestTP then + begin + //Plugin Found + if (R = 0) then + begin + Result := Plugins[I].ID; + Inc(Plugins[I].TimesPlayed); + Break; + end; + + Dec(R); + end; + end; + end; begin -//Set cur Round to Round 1 -CurRound := 255; + //Set cur Round to Round 1 + CurRound := 255; + + PlayersPlay := Teams.NumTeams; -PlayersPlay := Teams.NumTeams; -if isWinner(0,9) then - Log.LogError('Test'); + TeamMode := True; + For I := 0 to Teams.NumTeams-1 do + if Teams.Teaminfo[I].NumPlayers < 2 then + begin + TeamMode := False; + Break; + end; + + //Fill Plugin Array + SetLength(Plugins, 0); + For I := 0 to high(DLLMan.Plugins) do + begin + if TeamMode or (Not DLLMan.Plugins[I].TeamModeOnly) then + begin //Add only Plugins Playable with cur. PlayerConfiguration + Len := Length(Plugins); + SetLength(Plugins, Len + 1); + Plugins[Len].ID := I; + Plugins[Len].TimesPlayed := 0; + end; + end; + + //Set Rounds + If (Length(Plugins) >= 1) then + begin + SetLength (Rounds, NumRounds); + For I := 0 to NumRounds-1 do + begin + PartySession.Rounds[I].Plugin := GetRandomPlugin; + PartySession.Rounds[I].Winner := 255; + end; + end + else SetLength (Rounds, 0); end; //---------- @@ -65,10 +149,10 @@ var I, J: Integer; lowestTP: Byte; begin - //Get lowest TP + //Get lowest TimesPlayed lowestTP := high(Byte); J := -1; - for I := 0 to Teams.Teaminfo[Team].NumPlayers do + for I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do begin if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed < lowestTP) then begin @@ -86,7 +170,7 @@ begin repeat Result := Random(Teams.Teaminfo[Team].NumPlayers); until (Teams.Teaminfo[Team].Playerinfo[Result].TimesPlayed = lowestTP) - else //Else Select the one wth lowest TP + else //Else Select the one with lowest TP Result:= J; end; @@ -106,7 +190,7 @@ begin DllMan.LoadPlugin(Rounds[CurRound].Plugin); //Select Players - for I := 0 to Teams.NumTeams do + for I := 0 to Teams.NumTeams-1 do Teams.Teaminfo[I].CurPlayer := GetRandomPlayer(I); //Set ScreenSingModie Variables @@ -142,7 +226,7 @@ procedure TParty_Session.GenScores; var I: Byte; begin - for I := 0 to Teams.NumTeams do + for I := 0 to Teams.NumTeams-1 do begin if isWinner(I, Rounds[CurRound].Winner) then Inc(Teams.Teaminfo[I].Score); @@ -159,12 +243,18 @@ var begin if (Rounds[Round].Winner = 0) then begin - Result := 'Nobody'; + Result := Language.Translate('PARTY_NOBODY'); + exit; + end; + + if (Rounds[Round].Winner = 255) then + begin + Result := Language.Translate('PARTY_NOTPLAYEDYET'); exit; end; SetLength(Winners, 0); - for I := 0 to Teams.NumTeams do + for I := 0 to Teams.NumTeams-1 do begin if isWinner(I, Rounds[Round].Winner) then begin @@ -188,7 +278,7 @@ begin GenScores; //Increase TimesPlayed 4 all Players - For I := 0 to Teams.NumTeams do + For I := 0 to Teams.NumTeams-1 do Inc(Teams.Teaminfo[I].Playerinfo[Teams.Teaminfo[0].CurPlayer].TimesPlayed); end; diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 5849341c..976c0e07 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -128,65 +128,8 @@ begin end; SDLK_M: begin - if (SDL_ModState = KMOD_LALT) then - begin - //Create Teams: - PartySession.Teams.NumTeams := 3; - //Team 1 - PartySession.Teams.Teaminfo[0].Name := 'Team 1'; - PartySession.Teams.Teaminfo[0].Score:= 0; - PartySession.Teams.Teaminfo[0].Joker := 3; - PartySession.Teams.Teaminfo[0].CurPlayer := 0; - PartySession.Teams.Teaminfo[0].NumPlayers := 2; - PartySession.Teams.Teaminfo[0].Playerinfo[0].Name := 'Player 1'; - PartySession.Teams.Teaminfo[0].Playerinfo[0].TimesPlayed := 0; - PartySession.Teams.Teaminfo[0].Playerinfo[1].Name := 'Player 2'; - PartySession.Teams.Teaminfo[0].Playerinfo[1].TimesPlayed := 0; - - //Team 2 - PartySession.Teams.Teaminfo[1].Name := 'Team 2'; - PartySession.Teams.Teaminfo[1].Score:= 0; - PartySession.Teams.Teaminfo[1].Joker := 3; - PartySession.Teams.Teaminfo[1].CurPlayer := 0; - PartySession.Teams.Teaminfo[1].NumPlayers := 2; - PartySession.Teams.Teaminfo[1].Playerinfo[0].Name := 'Player 3'; - PartySession.Teams.Teaminfo[1].Playerinfo[0].TimesPlayed := 0; - PartySession.Teams.Teaminfo[1].Playerinfo[1].Name := 'Player 4'; - PartySession.Teams.Teaminfo[1].Playerinfo[1].TimesPlayed := 0; - - //Team 3 - PartySession.Teams.Teaminfo[2].Name := 'Team 3'; - PartySession.Teams.Teaminfo[2].Score:= 0; - PartySession.Teams.Teaminfo[2].Joker := 3; - PartySession.Teams.Teaminfo[2].CurPlayer := 0; - PartySession.Teams.Teaminfo[2].NumPlayers := 2; - PartySession.Teams.Teaminfo[2].Playerinfo[0].Name := 'Player 5'; - PartySession.Teams.Teaminfo[2].Playerinfo[0].TimesPlayed := 0; - PartySession.Teams.Teaminfo[2].Playerinfo[1].Name := 'Player 6'; - PartySession.Teams.Teaminfo[2].Playerinfo[1].TimesPlayed := 0; - - //Rounds: - SetLength (PartySession.Rounds, 3); - PartySession.Rounds[0].Plugin := 1; - PartySession.Rounds[0].Winner := 0; - PartySession.Rounds[1].Plugin := 0; - PartySession.Rounds[1].Winner := 0; - PartySession.Rounds[2].Plugin := 0; - PartySession.Rounds[2].Winner := 0; - - //Start Party - PartySession.StartNewParty; - //Change Screen - Music.PlayStart; - FadeTo(@ScreenPartyNewRound); - - end - else - begin - Music.PlayStart; - FadeTo(@ScreenPartyOptions); - end; - + Music.PlayStart; + FadeTo(@ScreenPartyOptions); end; SDLK_RETURN: diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 042e944f..1fd4da8f 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -95,7 +95,6 @@ begin SDLK_RETURN: begin - //Save Difficulty Ini.Difficulty := SelectsS[SelectLevel].SelectedOption; Ini.SaveLevel; @@ -106,6 +105,7 @@ begin PartySession.Teams.Teaminfo[0].NumPlayers := NumPlayer1+1; PartySession.Teams.Teaminfo[1].NumPlayers := NumPlayer2+1; PartySession.Teams.Teaminfo[2].NumPlayers := NumPlayer3+1; + //Save Playlist PlaylistMan.Mode := Playlist; //If Category Selected Search Category ID @@ -126,13 +126,10 @@ begin end else PlaylistMan.CurPlayList := Playlist2; - //Save Rounds + Random - SetLength (PartySession.Rounds, Rounds + 2); - For I := 0 to high (PartySession.Rounds) do - begin - PartySession.Rounds[I].Plugin := Random (Length(DLLMan.Plugins)); - PartySession.Rounds[I].Winner := 0; - end; + + //Start Party + PartySession.StartNewParty(Rounds + 2); + Music.PlayStart; //Go to Player Screen FadeTo(@ScreenPartyPlayer); @@ -155,10 +152,7 @@ begin end //Change Team3 Players visibility Else If (Interaction = 4) then begin - Case NumTeams of - 0: SelectsS[7].Visible := False; - 1: SelectsS[7].Visible := True; - end; + SelectsS[7].Visible := (NumTeams = 1); end; end; SDLK_LEFT: @@ -173,10 +167,7 @@ begin end //Change Team3 Players visibility Else If (Interaction = 4) then begin - Case NumTeams of - 0: SelectsS[7].Visible := False; - 1: SelectsS[7].Visible := True; - end; + SelectsS[7].Visible := (NumTeams = 1); end; end; end; diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index 4fc43013..498514fb 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -87,10 +87,6 @@ begin PartySession.Teams.Teaminfo[I].Joker := Round (Length(PartySession.Rounds) * 0.85); end; - - //Start Party - PartySession.StartNewParty; - Music.PlayStart; FadeTo(@ScreenPartyNewRound); end; -- cgit v1.2.3 From b271750f0ba7b1174d26f8164bc8f9f46766c5e3 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 15 Apr 2007 10:05:09 +0000 Subject: Added Prevention of starting PartyMode without Plugins Loaded or with less then 2 Players git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@92 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenMain.pas | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 976c0e07..90a6310d 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -84,7 +84,7 @@ const Credits_Text: Array[0..49] of PChar = ( implementation -uses Windows, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl, ULanguage, UParty; +uses Windows, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl, ULanguage, UParty, UDLLManager; function TScreenMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; @@ -128,8 +128,11 @@ begin end; SDLK_M: begin - Music.PlayStart; - FadeTo(@ScreenPartyOptions); + if (Ini.Players >= 2) AND (Length(DLLMan.Plugins)>=1) then + begin + Music.PlayStart; + FadeTo(@ScreenPartyOptions); + end; end; SDLK_RETURN: @@ -147,8 +150,6 @@ begin if Interaction = 2 then begin Music.PlayStart; FadeTo(@ScreenOptions); -// SDL_SetVideoMode(800, 600, 32, SDL_OPENGL);// or SDL_FULLSCREEN); -// LoadTextures; end; if Interaction = 3 then begin Result := false; -- cgit v1.2.3 From fae5839e8025f020638b4cd0583a9a992c5a7a1e Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 15 Apr 2007 11:05:10 +0000 Subject: Fixed some Bugs in Party Mode Fixed Support CategoryOnly Playlist Support git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@93 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UParty.pas | 13 ++++++++++--- Game/Code/Screens/UScreenMain.pas | 2 +- Game/Code/Screens/UScreenPartyNewRound.pas | 4 ---- Game/Code/Screens/UScreenPartyPlayer.pas | 2 +- Game/Code/Screens/UScreenPartyScore.pas | 8 ++++---- Game/Code/Screens/UScreenSong.pas | 4 ++-- 6 files changed, 18 insertions(+), 15 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UParty.pas b/Game/Code/Classes/UParty.pas index f5834dd8..e5252f82 100644 --- a/Game/Code/Classes/UParty.pas +++ b/Game/Code/Classes/UParty.pas @@ -107,13 +107,16 @@ begin PlayersPlay := Teams.NumTeams; + //Get Teammode and Set Joker TeamMode := True; For I := 0 to Teams.NumTeams-1 do + begin if Teams.Teaminfo[I].NumPlayers < 2 then begin TeamMode := False; - Break; end; + Teams.Teaminfo[I].Joker := Round(NumRounds*0.7); + end; //Fill Plugin Array SetLength(Plugins, 0); @@ -186,7 +189,7 @@ begin //Increase Current Round Inc (CurRound); - Rounds[CurRound].Winner := 0; + Rounds[CurRound].Winner := 255; DllMan.LoadPlugin(Rounds[CurRound].Plugin); //Select Players @@ -241,9 +244,13 @@ var Winners: Array of String; I: Integer; begin + Result := Language.Translate('PARTY_NOBODY'); + + if (Round > High(Rounds)) then + exit; + if (Rounds[Round].Winner = 0) then begin - Result := Language.Translate('PARTY_NOBODY'); exit; end; diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 90a6310d..dd7f21c5 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -128,7 +128,7 @@ begin end; SDLK_M: begin - if (Ini.Players >= 2) AND (Length(DLLMan.Plugins)>=1) then + if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then begin Music.PlayStart; FadeTo(@ScreenPartyOptions); diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 1e9be1f5..c8c0febc 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -176,10 +176,6 @@ procedure TScreenPartyNewRound.onShow; var I: Integer; begin - //If not First Round, End Last Round - if (PartySession.CurRound <> 255) then - PartySession.EndRound; - PartySession.StartRound; Log.LogError(InttoStr(Length(DllMan.Plugins))); diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index 498514fb..02f87710 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -76,6 +76,7 @@ begin SDLK_RETURN: begin + //Save PlayerNames for I := 0 to PartySession.Teams.NumTeams-1 do begin PartySession.Teams.Teaminfo[I].Name := PChar(Button[I*5].Text[0].Text); @@ -84,7 +85,6 @@ begin PartySession.Teams.Teaminfo[I].Playerinfo[J].Name := PChar(Button[I*5 + J+1].Text[0].Text); PartySession.Teams.Teaminfo[I].Playerinfo[J].TimesPlayed := 0; end; - PartySession.Teams.Teaminfo[I].Joker := Round (Length(PartySession.Rounds) * 0.85); end; Music.PlayStart; diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index 9cbeb5d5..142ec947 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -57,13 +57,10 @@ begin SDLK_RETURN: begin Music.PlayStart; - if (PartySession.CurRound <= High(PartySession.Rounds)) then + if (PartySession.CurRound < High(PartySession.Rounds)) then FadeTo(@ScreenPartyNewRound) else - begin - PartySession.EndRound; FadeTo(@ScreenPartyWin); - end; end; end; end; @@ -114,6 +111,9 @@ begin Static[StaticTeam2].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100; Static[StaticTeam3].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[2].Percentage / 100; + //End Last Round + PartySession.EndRound; + //Set Winnertext Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.GetWinnerString(PartySession.CurRound)]); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 7ea5d268..7c8447ee 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1488,8 +1488,8 @@ begin end; 1: //One Category Select Category and Select Random Song begin - CatSongs.HideCategory(-1); - CatSongs.ShowCategory(PlaylistMan.CurPlayList); + CatSongs.ShowCategoryList; + CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); ShowCatTL(PlaylistMan.CurPlayList); SelectNext; -- cgit v1.2.3 From 23c69ff32e06a2570641e352ad17f2816ae748f2 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sun, 15 Apr 2007 13:45:17 +0000 Subject: re-inserted some code to set clear-color to white per default or to black via commandline switch (affects whole classic theme and singscreen in deluxe theme) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@95 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UDisplay.pas | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index 876fb6b6..b6489c70 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -46,14 +46,14 @@ begin myfade:=0; doFade:=True; // generate texture for fading between screens - GetMem(pTexData, 1024*1024*4); + GetMem(pTexData, 1024*1024*3); if pTexData <> NIL then begin glGenTextures(1, pTex); if glGetError <> GL_NO_ERROR then doFade := False; glBindTexture(GL_TEXTURE_2D, pTex); if glGetError <> GL_NO_ERROR then doFade := False; - glTexImage2D(GL_TEXTURE_2D, 0, 3, 1024, 1024, 0, GL_RGBA, GL_UNSIGNED_BYTE, pTexData); + glTexImage2D(GL_TEXTURE_2D, 0, 3, 1024, 1024, 0, GL_RGB, GL_UNSIGNED_BYTE, pTexData); if glGetError <> GL_NO_ERROR then doFade := False; glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); if glGetError <> GL_NO_ERROR then doFade := False; @@ -81,6 +81,7 @@ end; function TDisplay.Draw: Boolean; var S: integer; + Col: Real; // fade mod myFade2:integer; currentTime: Cardinal; @@ -88,11 +89,11 @@ var begin Result := True; -{ Col := 1; + Col := 1; if (ParamStr(1) = '-black') or (ParamStr(1) = '-fsblack') then - Col := 0;} + Col := 0; - glClearColor(0, 0, 0 , 0); + glClearColor(Col, Col, Col , 0); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); for S := 1 to Screens do begin @@ -124,7 +125,7 @@ begin begin ActualScreen.Draw; glBindTexture(GL_TEXTURE_2D, pTex); - glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 1024, 1024, 0); + glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 1024, 1024, 0); if glGetError <> GL_NO_ERROR then begin doFade := False; -- cgit v1.2.3 From e8b20046dd4c181ea9b45fb3908daef41746cff2 Mon Sep 17 00:00:00 2001 From: b1indy Date: Mon, 16 Apr 2007 22:10:47 +0000 Subject: Fixed bug in TSkin.onThemeChange that caused a crash git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@100 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/USkins.pas | 1 + 1 file changed, 1 insertion(+) (limited to 'Game/Code') diff --git a/Game/Code/Classes/USkins.pas b/Game/Code/Classes/USkins.pas index 6cd4a1db..67b0ae93 100644 --- a/Game/Code/Classes/USkins.pas +++ b/Game/Code/Classes/USkins.pas @@ -145,6 +145,7 @@ var S: integer; Name: String; begin + Ini.SkinNo:=0; SetLength(ISkin, 0); Name := Uppercase(ITheme[Ini.Theme]); for S := 0 to High(Skin) do -- cgit v1.2.3 From e8f259a1a37ce5cf10a79dc53e184d6af4e7b7d6 Mon Sep 17 00:00:00 2001 From: b1indy Date: Tue, 17 Apr 2007 00:48:03 +0000 Subject: Changed aadvanced options to switch on/off sing-effects and screen-fading Changed Languages (english, german) and Theme (deluxe) to reflect these changes implemented checks for config values to make these things work as expected git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@101 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 11 ++++---- Game/Code/Classes/UIni.pas | 36 ++++++++++++------------- Game/Code/Classes/UThemes.pas | 8 +++--- Game/Code/Menu/UDisplay.pas | 40 +++++++++++++++++++--------- Game/Code/Screens/UScreenOptionsAdvanced.pas | 4 +-- Game/Code/Screens/UScreenSing.pas | 5 ++-- 6 files changed, 59 insertions(+), 45 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index e2c01b4b..7eaddac4 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -48,7 +48,7 @@ var StarfrG: integer; - + //SingBar Mod TickOld: cardinal; TickOld2:cardinal; @@ -216,7 +216,7 @@ begin if not FreeStyle then begin - if Ini.EffectGolden = 0 then + if Ini.EffectSing = 0 then // If Golden note Effect of then Change not Color begin case Wartosc of @@ -270,7 +270,7 @@ begin glEnd; // Golden Star Patch - if (Wartosc = 2) AND (Ini.EffectGolden=1) then + if (Wartosc = 2) AND (Ini.EffectSing=1) then begin GoldenRec.SaveGoldenStarsRec(GoldenStarPos, Rec.Top, Rec.Right, Rec.Bottom); end; @@ -379,7 +379,7 @@ var //Rec.Right := X + (Start+Dlugosc-Czesci[0].Czesc[Czesci[0].Akt].StartNote) * TempR - NotesW - 0.5 + 10*ScreenX; //if (Start+Dlugosc-1 = Czas.AktBeatD) then - if Perfect and (Ini.EffectPerfect=1) then begin + if Perfect and (Ini.EffectSing=1) then begin // A := sqrt((1+sin(Music.Position * 3))/2); A := 1 - 2*(Czas.Teraz - GetTimeFromBeat(Start+Dlugosc)); if not (Start+Dlugosc-1 = Czas.AktBeatD) then @@ -387,7 +387,6 @@ var //Star animation counter //inc(Starfr); //Starfr := Starfr mod 128; - GoldenRec.SavePerfectNotePos(Rec.Left, Rec.Top); { SingDrawStar(Rec.Left+2, Rec.Top+4, A);} end; @@ -431,7 +430,7 @@ var // passing on NrGracza... hope this is really something like the player-number, not only // some kind of weird index into a colour-table - if (Ini.EffectGolden=1) then + if (Ini.EffectSing=1) then GoldenRec.GoldenNoteTwinkle(Rec.Top,Rec.Bottom,Rec.Right, NrGracza); end; // if end; diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index d5589ea3..cafbc912 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -58,8 +58,8 @@ type // Advanced LoadAnimation: integer; - EffectPerfect: integer; - EffectGolden: integer; + EffectSing: integer; + ScreenFade: integer; AskbeforeDel: integer; OnSongClick: integer; LineBonus: integer; @@ -135,8 +135,8 @@ const // Advanced ILoadAnimation: array[0..1] of string = ('Off', 'On'); - IEffectPerfect: array[0..1] of string = ('Off', 'On'); - IEffectGolden: array[0..1] of string = ('Off', 'On'); + IEffectSing: array[0..1] of string = ('Off', 'On'); + IScreenFade: array [0..1] of String =('Off', 'On'); IAskbeforeDel: array[0..1] of string = ('Off', 'On'); IOnSongClick: array[0..2] of string = ('Sing', 'Select Players', 'Open Menu'); ILineBonus: array[0..2] of string = ('Off', 'At Score', 'At Notes'); @@ -430,15 +430,15 @@ begin for Pet := 0 to High(ILoadAnimation) do if Tekst = ILoadAnimation[Pet] then Ini.LoadAnimation := Pet; - // EffectPerfect - Tekst := IniFile.ReadString('Advanced', 'EffectPerfect', 'On'); - for Pet := 0 to High(IEffectPerfect) do - if Tekst = IEffectPerfect[Pet] then Ini.EffectPerfect := Pet; + // ScreenFade + Tekst := IniFile.ReadString('Advanced', 'ScreenFade', 'On'); + for Pet := 0 to High(IScreenFade) do + if Tekst = IScreenFade[Pet] then Ini.ScreenFade := Pet; - // EffectGolden - Tekst := IniFile.ReadString('Advanced', 'EffectGolden', 'On'); - for Pet := 0 to High(IEffectGolden) do - if Tekst = IEffectGolden[Pet] then Ini.EffectGolden := Pet; + // EffectSing + Tekst := IniFile.ReadString('Advanced', 'EffectSing', 'On'); + for Pet := 0 to High(IEffectSing) do + if Tekst = IEffectSing[Pet] then Ini.EffectSing := Pet; // AskbeforeDel Tekst := IniFile.ReadString('Advanced', 'AskbeforeDel', 'On'); @@ -618,13 +618,13 @@ begin Tekst := ILoadAnimation[Ini.LoadAnimation]; IniFile.WriteString('Advanced', 'LoadAnimation', Tekst); - //EffectPerfect - Tekst := IEffectPerfect[Ini.EffectPerfect]; - IniFile.WriteString('Advanced', 'EffectPerfect', Tekst); + //EffectSing + Tekst := IEffectSing[Ini.EffectSing]; + IniFile.WriteString('Advanced', 'EffectSing', Tekst); - //EffectGolden - Tekst := IEffectGolden[Ini.EffectGolden]; - IniFile.WriteString('Advanced', 'EffectGolden', Tekst); + //ScreenFade + Tekst := IScreenFade[Ini.ScreenFade]; + IniFile.WriteString('Advanced', 'ScreenFade', Tekst); //AskbeforeDel Tekst := IAskbeforeDel[Ini.AskbeforeDel]; diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 51b454ca..6837d17f 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -402,8 +402,8 @@ type TThemeOptionsAdvanced = class(TThemeBasic) SelectLoadAnimation: TThemeSelect; - SelectEffectPerfect: TThemeSelect; - SelectEffectGolden: TThemeSelect; + SelectEffectSing: TThemeSelect; + SelectScreenFade: TThemeSelect; SelectLineBonus: TThemeSelect; SelectAskbeforeDel: TThemeSelect; SelectOnSongClick: TThemeSelectSlide; @@ -1052,8 +1052,8 @@ begin ThemeLoadBasic(OptionsAdvanced, 'OptionsAdvanced'); ThemeLoadSelect (OptionsAdvanced.SelectLoadAnimation, 'OptionsAdvancedSelectLoadAnimation'); - ThemeLoadSelect (OptionsAdvanced.SelectEffectPerfect, 'OptionsAdvancedSelectEffectPerfect'); - ThemeLoadSelect (OptionsAdvanced.SelectEffectGolden, 'OptionsAdvancedSelectEffectGolden'); + ThemeLoadSelect (OptionsAdvanced.SelectScreenFade, 'OptionsAdvancedSelectScreenFade'); + ThemeLoadSelect (OptionsAdvanced.SelectEffectSing, 'OptionsAdvancedSelectEffectSing'); ThemeLoadSelect (OptionsAdvanced.SelectLineBonus, 'OptionsAdvancedSelectLineBonus'); ThemeLoadSelectSlide (OptionsAdvanced.SelectOnSongClick, 'OptionsAdvancedSelectSlideOnSongClick'); ThemeLoadSelect (OptionsAdvanced.SelectAskbeforeDel, 'OptionsAdvancedSelectAskbeforeDel'); diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index b6489c70..3f6e70da 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -15,6 +15,7 @@ type Fade: Real; // fade-mod doFade: Boolean; + canFade: Boolean; myFade: integer; lastTime: Cardinal; pTexData : Pointer; @@ -37,42 +38,51 @@ var implementation -uses UGraphic, UTime, Graphics, Jpeg, UPliki, UTexture; +uses UGraphic, UTime, Graphics, Jpeg, UPliki, UTexture, UIni; constructor TDisplay.Create; begin inherited Create; // fade mod myfade:=0; - doFade:=True; + + if Ini.ScreenFade=1 then + doFade:=True + else + doFade:=False; + + canFade:=True; // generate texture for fading between screens GetMem(pTexData, 1024*1024*3); if pTexData <> NIL then begin glGenTextures(1, pTex); - if glGetError <> GL_NO_ERROR then doFade := False; + if glGetError <> GL_NO_ERROR then canFade := False; glBindTexture(GL_TEXTURE_2D, pTex); - if glGetError <> GL_NO_ERROR then doFade := False; + if glGetError <> GL_NO_ERROR then canFade := False; glTexImage2D(GL_TEXTURE_2D, 0, 3, 1024, 1024, 0, GL_RGB, GL_UNSIGNED_BYTE, pTexData); - if glGetError <> GL_NO_ERROR then doFade := False; + if glGetError <> GL_NO_ERROR then canFade := False; glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - if glGetError <> GL_NO_ERROR then doFade := False; + if glGetError <> GL_NO_ERROR then canFade := False; glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - if glGetError <> GL_NO_ERROR then doFade := False; + if glGetError <> GL_NO_ERROR then canFade := False; FreeMem(pTexData); end else begin - doFade:=False; + canFade:=False; end; - if not doFade then showmessage('Fehler beim Initialisieren der Fading-Textur... Fading deaktiviert'); + if not canFade then begin + showmessage('Fehler beim Initialisieren der Fading-Textur... Fading deaktiviert'); + doFade:=False; + end // end end; // fade mod destructor TDisplay.Destroy; begin - if doFade then + if canFade then glDeleteTextures(1,@pTex); inherited Destroy; end; @@ -113,11 +123,15 @@ begin Result := ActualScreen.Draw; // fade mod myfade:=0; + if (Ini.ScreenFade=1) and canFade then + doFade:=True + else if Ini.ScreenFade=0 then + doFade:=False; // end end else begin - if doFade then + if doFade and canFade then begin // fade mod //Create Fading texture if we're just starting @@ -128,7 +142,7 @@ begin glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 1024, 1024, 0); if glGetError <> GL_NO_ERROR then begin - doFade := False; + canFade := False; showmessage('Fehler beim Kopieren der Fade-Textur... Fading deaktiviert'); end; NextScreen.onShow; @@ -167,7 +181,7 @@ begin glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); end; - if (myfade > 40) or (not doFade) then begin // fade out complete... + if (myfade > 40) or (not doFade) or (not canFade) then begin // fade out complete... myFade:=0; ActualScreen.onHide; // nop... whatever ActualScreen.ShowFinish:=False; diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index 7904a284..ed3bc164 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -74,8 +74,8 @@ begin AddText(Theme.OptionsAdvanced.Text[I]); AddSelect(Theme.OptionsAdvanced.SelectLoadAnimation, Ini.LoadAnimation, ILoadAnimation); - AddSelect(Theme.OptionsAdvanced.SelectEffectPerfect, Ini.EffectPerfect, IEffectPerfect); - AddSelect(Theme.OptionsAdvanced.SelectEffectGolden, Ini.EffectGolden, IEffectGolden); + AddSelect(Theme.OptionsAdvanced.SelectScreenFade, Ini.ScreenFade, IScreenFade); + AddSelect(Theme.OptionsAdvanced.SelectEffectSing, Ini.EffectSing, IEffectSing); AddSelect(Theme.OptionsAdvanced.SelectLineBonus, Ini.LineBonus, ILineBonus); AddSelectSlide(Theme.OptionsAdvanced.SelectOnSongClick, Ini.OnSongClick, IOnSongClick); AddSelect(Theme.OptionsAdvanced.SelectAskbeforeDel, Ini.AskbeforeDel, IAskbeforeDel); diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index e4fd7add..29ea5c8b 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1115,7 +1115,7 @@ begin //PhrasenBonus - Line Bonus Mod End// } //PerfectLineTwinkle Mod (effect) Pt.1 - If (Ini.EffectPerfect>=1) then + If (Ini.EffectSing=1) then begin if A >= 8 then Player[I].LastSentencePerfect := True else Player[I].LastSentencePerfect := False; @@ -1128,7 +1128,8 @@ begin end; //PerfectLineTwinkle Mod (effect) Pt.2 - GoldenRec.SpawnPerfectLineTwinkle; + if Ini.EffectSing=1 then + GoldenRec.SpawnPerfectLineTwinkle; //PerfectLineTwinkle Mod end end; -- cgit v1.2.3 From a2539871abfbd2c50ef763350cc56fa5ef45f2d4 Mon Sep 17 00:00:00 2001 From: mota23 Date: Tue, 17 Apr 2007 13:33:35 +0000 Subject: Well, heres my first commit since R11. Some minor skin changes, new skin.ini-entry LyricHelpBar git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@102 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 27 ++++++++++++++++++++------- Game/Code/Classes/UGraphic.pas | 7 ++++--- 2 files changed, 24 insertions(+), 10 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 7eaddac4..410fbb2e 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -663,24 +663,37 @@ begin Rec.Top := Skin_LyricsT + 3; Rec.Bottom := Rec.Top + 33;//SingScreen.LyricMain.Size * 3; - // zapalanie +{ // zapalanie BarAlpha := (BarWspol*10) * 0.5; if BarAlpha > 0.5 then BarAlpha := 0.5; // gaszenie - if BarWspol > 0.95 then BarAlpha := 0.5 * (1 - (BarWspol - 0.95) * 20); + if BarWspol > 0.95 then BarAlpha := 0.5 * (1 - (BarWspol - 0.95) * 20);} + //Change fuer Crazy Joker - glEnable(GL_BLEND); - glBegin(GL_QUADS); + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_Lyric_Help_Bar.TexNum); + glBegin(GL_QUADS); + glColor4f(1, 1, 1, 0); + glTexCoord2f(1/16, 1/16); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(1/16, 15/16); glVertex2f(Rec.Left, Rec.Bottom); + glColor4f(1, 1, 1, 0.5); + glTexCoord2f(15/16, 15/16); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(15/16, 1/16); glVertex2f(Rec.Right, Rec.Top); + glEnd; + glDisable(GL_BLEND); +{ glBegin(GL_QUADS); glColor4f(26/255, 165/255, 220/255, 0); glVertex2f(Rec.Left, Rec.Top); glVertex2f(Rec.Left, Rec.Bottom); glColor4f(26/255, 165/255, 220/255, BarAlpha); glVertex2f(Rec.Right, Rec.Bottom); glVertex2f(Rec.Right, Rec.Top); - glEnd; - glDisable(GL_BLEND); - end; + glEnd;} + end; // oscilloscope if Ini.Oscilloscope = 1 then begin diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index c3ce0f00..b909e49f 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -76,6 +76,7 @@ var Tex_Ball: TTexture; + Tex_Lyric_Help_Bar: TTexture; FullScreen: boolean; @@ -191,9 +192,9 @@ begin end; Tex_Note_Perfect_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePerfectStar')), 'JPG', 'Font Black', 0); - Tex_Note_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteStar')) , 'JPG', 'Alpha Black Colored', $FFFFFF); - Tex_Ball := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'BMP', 'Transparent', $FF00FF); - + Tex_Note_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteStar')) , 'JPG', 'Alpha Black Colored', $FFFFFF); + Tex_Ball := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'BMP', 'Transparent', $FF00FF); + Tex_Lyric_Help_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricHelpBar')), 'BMP', 'Transparent', $FF00FF); //SingBar Mod -- cgit v1.2.3 From 033bd987a8d704aa7eb62e1cdd572694d3cd728d Mon Sep 17 00:00:00 2001 From: mogguh Date: Tue, 17 Apr 2007 16:09:34 +0000 Subject: Bugfix: Fixed minor problem that caused artefacts to be drawn - 'transparent' now works with #ffffff and #fefefe (UTexture.pas) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@104 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index b50ab6bf..4a8fa786 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -361,7 +361,7 @@ begin for Pet := 0 to TexOrygH-1 do begin for Pet2 := 0 to TexOrygW-1 do begin Pix := TextureB.Canvas.Pixels[Pet2, Pet]; - if Pix = Col then begin + if ((Pix = $fefefe) or (Pix = Col)) then begin //Small fix, that caused artefacts to be drawn (#fe == dec254) TextureD32[Pet*TexNewW + Pet2 + 1, 1] := 0; TextureD32[Pet*TexNewW + Pet2 + 1, 2] := 0; TextureD32[Pet*TexNewW + Pet2 + 1, 3] := 0; -- cgit v1.2.3 From 662b5574b22282511b3095c9888f0977b14eabdd Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 17 Apr 2007 17:34:39 +0000 Subject: Commited UTheme.pas to prevent Conflicts git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@107 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 54 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 6837d17f..a5fb1459 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -542,6 +542,27 @@ type ButtonPrev: TThemeButton;} end; + //Stats Screens + TThemeStatMain = class(TThemeBasic) + ButtonScores: TThemeButton; + ButtonSingers: TThemeButton; + ButtonSongs: TThemeButton; + ButtonBands: TThemeButton; + + TextOverview: TThemeText; + end; + + TThemeStatDetail = class(TThemeBasic) + ButtonNext: TThemeButton; + ButtonPrev: TThemeButton; + ButtonReverse: TThemeButton; + ButtonExit: TThemeButton; + + Description: array[0..3] of string; + TextDescription: TThemeText; + TextList: AThemeText; + end; + //Playlist Translations TThemePlaylist = record CatText: string; @@ -580,6 +601,10 @@ type PartyOptions: TThemePartyOptions; PartyPlayer: TThemePartyPlayer; + //Stats Screens: + StatMain: TThemeStatMain; + StatDetail: TThemeStatDetail; + Playlist: TThemePlaylist; constructor Create(FileName: string); overload; // Initialize theme system @@ -665,6 +690,10 @@ begin PartyOptions := TThemePartyOptions.Create; PartyPlayer := TThemePartyPlayer.Create; + //Stats Screens: + StatMain := TThemeStatMain.Create; + StatDetail := TThemeStatDetail.Create; + LoadTheme(FileName, Color); @@ -1196,6 +1225,31 @@ begin {ThemeLoadButton(ButtonNext, 'PartyPlayerButtonNext'); ThemeLoadButton(ButtonPrev, 'PartyPlayerButtonPrev');} + ThemeLoadBasic(StatMain, 'StatMain'); + + ThemeLoadButton(StatMain.ButtonScores, 'StatMainButtonScores'); + ThemeLoadButton(StatMain.ButtonSingers, 'StatMainButtonSingers'); + ThemeLoadButton(StatMain.ButtonSongs, 'StatMainButtonSongs'); + ThemeLoadButton(StatMain.ButtonBands, 'StatMainButtonBands'); + + ThemeLoadText (StatMain.TextOverview, 'StatMainTextOverview'); + + + ThemeLoadBasic(StatDetail, 'StatDetail'); + + ThemeLoadButton(StatDetail.ButtonNext, 'StatDetailButtonNext'); + ThemeLoadButton(StatDetail.ButtonPrev, 'StatDetailButtonPrev'); + ThemeLoadButton(StatDetail.ButtonReverse, 'StatDetailButtonReverse'); + ThemeLoadButton(StatDetail.ButtonExit, 'StatDetailButtonExit'); + + ThemeLoadText (StatDetail.TextDescription, 'StatDetailTextDescription'); + ThemeLoadTexts(StatDetail.TextList, 'StatDetailTextList'); + + StatDetail.Description[0] := Language.Translate('STAT_DESC_SCORES'); + StatDetail.Description[1] := Language.Translate('STAT_DESC_SINGERS'); + StatDetail.Description[2] := Language.Translate('STAT_DESC_SONGS'); + StatDetail.Description[3] := Language.Translate('STAT_DESC_BANDS'); + //Playlist Translations Playlist.CatText := Language.Translate('PLAYLIST_CATTEXT') end; -- cgit v1.2.3 From 6d072496a4347995bc168ab978b878c375508ecd Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 17 Apr 2007 17:39:51 +0000 Subject: Added Exit Button to Stats Screen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@108 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index a5fb1459..5a271ef6 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -547,7 +547,8 @@ type ButtonScores: TThemeButton; ButtonSingers: TThemeButton; ButtonSongs: TThemeButton; - ButtonBands: TThemeButton; + ButtonBands: TThemeButton; + ButtonExit: TThemeButton; TextOverview: TThemeText; end; @@ -1231,6 +1232,7 @@ begin ThemeLoadButton(StatMain.ButtonSingers, 'StatMainButtonSingers'); ThemeLoadButton(StatMain.ButtonSongs, 'StatMainButtonSongs'); ThemeLoadButton(StatMain.ButtonBands, 'StatMainButtonBands'); + ThemeLoadButton(StatMain.ButtonExit, 'StatMainButtonExit'); ThemeLoadText (StatMain.TextOverview, 'StatMainTextOverview'); -- cgit v1.2.3 From 7cbb58f6fe6cd8d81e21d6e0b1ebdc2fd872b773 Mon Sep 17 00:00:00 2001 From: mogguh Date: Tue, 17 Apr 2007 20:01:16 +0000 Subject: Feature: Added the possibility to skin the sing screen, it's now possible to set player 1 stuff related to player modi (1, 2 or 3 player mode) (affected UThemes.pas, UScreenSing.pas, UScreenSingModi.pas) Theme/Skin: Used the new sing screen possibility, looks way more ps3 now :P git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@109 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 118 +++++++---------- Game/Code/Screens/UScreenSing.pas | 238 ++++++++++++++++++++-------------- Game/Code/Screens/UScreenSingModi.pas | 95 +++++++------- 3 files changed, 233 insertions(+), 218 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 5a271ef6..5aca1401 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -272,6 +272,18 @@ type TextP1: TThemeText; TextP1Score: TThemeText; + //added for ps3 skin + //game in 2/4 player modi + StaticP1TwoP: TThemeStatic; + StaticP1TwoPScoreBG: TThemeStatic; //Static for ScoreBG + TextP1TwoP: TThemeText; + TextP1TwoPScore: TThemeText; + //game in 3/6 player modi + StaticP1ThreeP: TThemeStatic; + StaticP1ThreePScoreBG: TThemeStatic; //Static for ScoreBG + TextP1ThreeP: TThemeText; + TextP1ThreePScore: TThemeText; + //eoa StaticP2R: TThemeStatic; StaticP2RScoreBG: TThemeStatic; //Static for ScoreBG @@ -896,52 +908,37 @@ begin ThemeLoadBasic(Sing, 'Sing'); ThemeLoadStatic(Sing.StaticP1, 'SingP1Static'); - - - //ScoreBG Mod - ThemeLoadStatic(Sing.StaticP1ScoreBG, 'SingP1Static2');//ScoreBG - //end ScoreBG Mod - - ThemeLoadText(Sing.TextP1, 'SingP1Text'); + ThemeLoadStatic(Sing.StaticP1ScoreBG, 'SingP1Static2'); ThemeLoadText(Sing.TextP1Score, 'SingP1TextScore'); - + //Added for ps3 skin + //This one is shown in 2/4P mode + ThemeLoadStatic(Sing.StaticP1TwoP, 'SingP1TwoPStatic'); + ThemeLoadText(Sing.TextP1TwoP, 'SingP1TwoPText'); + ThemeLoadStatic(Sing.StaticP1TwoPScoreBG, 'SingP1TwoPStatic2'); + ThemeLoadText(Sing.TextP1TwoPScore, 'SingP1TwoPTextScore'); + + //This one is shown in 3/6P mode + ThemeLoadStatic(Sing.StaticP1ThreeP, 'SingP1ThreePStatic'); + ThemeLoadText(Sing.TextP1ThreeP, 'SingP1ThreePText'); + ThemeLoadStatic(Sing.StaticP1ThreePScoreBG, 'SingP1ThreePStatic2'); + ThemeLoadText(Sing.TextP1ThreePScore, 'SingP1ThreePTextScore'); + //eoa ThemeLoadStatic(Sing.StaticP2R, 'SingP2RStatic'); - - - - //ScoreBG Mod - ThemeLoadStatic(Sing.StaticP2RScoreBG, 'SingP2RStatic2'); - //end ScoreBG Mod - - - ThemeLoadText(Sing.TextP2R, 'SingP2RText'); + ThemeLoadStatic(Sing.StaticP2RScoreBG, 'SingP2RStatic2'); ThemeLoadText(Sing.TextP2RScore, 'SingP2RTextScore'); ThemeLoadStatic(Sing.StaticP2M, 'SingP2MStatic'); - - - //ScoreBG Mod - ThemeLoadStatic(Sing.StaticP2MScoreBG, 'SingP2MStatic2'); - //end ScoreBG Mod - - - ThemeLoadText(Sing.TextP2M, 'SingP2MText'); + ThemeLoadStatic(Sing.StaticP2MScoreBG, 'SingP2MStatic2'); ThemeLoadText(Sing.TextP2MScore, 'SingP2MTextScore'); ThemeLoadStatic(Sing.StaticP3R, 'SingP3RStatic'); - - - //ScoreBG Mod - ThemeLoadStatic(Sing.StaticP3RScoreBG, 'SingP3RStatic2'); - //end ScoreBG Mod - - - ThemeLoadText(Sing.TextP3R, 'SingP3RText'); + ThemeLoadStatic(Sing.StaticP3RScoreBG, 'SingP3RStatic2'); ThemeLoadText(Sing.TextP3RScore, 'SingP3RTextScore'); + //Line Bonus Texts Sing.LineBonusText[0] := Language.Translate('LINEBONUS_WORST'); Sing.LineBonusText[1] := Sing.LineBonusText[0]; @@ -1784,58 +1781,39 @@ begin ThemeSaveStatic(Song.StaticCat, 'SongStaticCat'); ThemeSaveBasic(Sing, 'Sing'); - ThemeSaveStatic(Sing.StaticP1, 'SingP1Static'); - - - - //ScoreBG Mod - ThemeSaveStatic(Sing.StaticP1ScoreBG, 'SingP1Static2'); - //end ScoreBG Mod - - + ThemeSaveStatic(Sing.StaticP1, 'SingP1Static'); ThemeSaveText(Sing.TextP1, 'SingP1Text'); + ThemeSaveStatic(Sing.StaticP1ScoreBG, 'SingP1Static2'); ThemeSaveText(Sing.TextP1Score, 'SingP1TextScore'); - ThemeSaveStatic(Sing.StaticP2R, 'SingP2RStatic'); - - - - //ScoreBG Mod - ThemeSaveStatic(Sing.StaticP2RScoreBG, 'SingP2RStatic2'); - //end ScoreBG Mod - + //Added for ps3 skin + //This one is shown in 2/4P mode + ThemeSaveStatic(Sing.StaticP1TwoP, 'SingP1TwoPStatic'); + ThemeSaveText(Sing.TextP1TwoP, 'SingP1TwoPText'); + ThemeSaveStatic(Sing.StaticP1TwoPScoreBG, 'SingP1TwoPStatic2'); + ThemeSaveText(Sing.TextP1TwoPScore, 'SingP1TwoPTextScore'); + //This one is shown in 3/6P mode + ThemeSaveStatic(Sing.StaticP1ThreeP, 'SingP1ThreePStatic'); + ThemeSaveText(Sing.TextP1ThreeP, 'SingP1ThreePText'); + ThemeSaveStatic(Sing.StaticP1ThreePScoreBG, 'SingP1ThreePStatic2'); + ThemeSaveText(Sing.TextP1ThreePScore, 'SingP1ThreePTextScore'); + //eoa + ThemeSaveStatic(Sing.StaticP2R, 'SingP2RStatic'); ThemeSaveText(Sing.TextP2R, 'SingP2RText'); + ThemeSaveStatic(Sing.StaticP2RScoreBG, 'SingP2RStatic2'); ThemeSaveText(Sing.TextP2RScore, 'SingP2RTextScore'); ThemeSaveStatic(Sing.StaticP2M, 'SingP2MStatic'); - - - - //ScoreBG Mod - ThemeSaveStatic(Sing.StaticP2MScoreBG, 'SingP2MStatic2'); - //end ScoreBG Mod - - - - ThemeSaveText(Sing.TextP2M, 'SingP2MText'); + ThemeSaveStatic(Sing.StaticP2MScoreBG, 'SingP2MStatic2'); ThemeSaveText(Sing.TextP2MScore, 'SingP2MTextScore'); ThemeSaveStatic(Sing.StaticP3R, 'SingP3RStatic'); - - - - //ScoreBG Mod - ThemeSaveStatic(Sing.StaticP3RScoreBG, 'SingP3RStatic2'); - //end ScoreBG Mod - - - - ThemeSaveText(Sing.TextP3R, 'SingP3RText'); + ThemeSaveStatic(Sing.StaticP3RScoreBG, 'SingP3RStatic2'); ThemeSaveText(Sing.TextP3RScore, 'SingP3RTextScore'); ThemeSaveBasic(Score, 'Score'); diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 29ea5c8b..650cfdff 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -19,6 +19,19 @@ type TextP1: integer; TextP1Score: integer; + //Added for ps3 skin + //shown when game is in 2/4 player modus + StaticP1TwoP: integer; + StaticP1TwoPScoreBG: integer; + TextP1TwoP: integer; + TextP1TwoPScore: integer; + //shown when game is in 3/6 player modus + StaticP1ThreeP: integer; + StaticP1ThreePScoreBG: integer; + TextP1ThreeP: integer; + TextP1ThreePScore: integer; + //eoa + StaticP2R: integer; StaticP2RScoreBG: integer; TextP2R: integer; @@ -157,6 +170,20 @@ begin TextP1 := AddText(Theme.Sing.TextP1); TextP1Score := AddText(Theme.Sing.TextP1Score); + //Added for ps3 skin + //This one is shown in 2/4P mode + StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); + StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG); + TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); + TextP1TwoPScore := AddText(Theme.Sing.TextP1TwoPScore); + + //This one is shown in 3/6P mode + StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); + StaticP1ThreePScoreBG := AddStatic(Theme.Sing.StaticP1ThreePScoreBG); + TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); + TextP1ThreePScore := AddText(Theme.Sing.TextP1ThreePScore); + //eoa + StaticP2R := AddStatic(Theme.Sing.StaticP2R); StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); TextP2R := AddText(Theme.Sing.TextP2R); @@ -178,11 +205,13 @@ end; procedure TScreenSing.onShow; var - P: integer; - V1: boolean; - V2R: boolean; - V2M: boolean; - V3R: boolean; + P: integer; + V1: boolean; + V1TwoP: boolean; //added for ps3 skin + V1ThreeP: boolean; //added for ps3 skin + V2R: boolean; + V2M: boolean; + V3R: boolean; NR: TRecR; //Line Bonus Mod begin Log.LogStatus('Begin', 'onShow'); @@ -195,39 +224,65 @@ begin case PlayersPlay of 1: begin - V1 := true; - V2R := false; - V2M := false; - V3R := false; + V1 := true; + V1TwoP := false; //added for ps3 skin + V1ThreeP := false; //added for ps3 skin + V2R := false; + V2M := false; + V3R := false; end; 2: begin - V1 := true; - V2R := true; - V2M := false; - V3R := false; + V1 := false; + V1TwoP := true; //added for ps3 skin + V1ThreeP := false; //added for ps3 skin + V2R := true; + V2M := false; + V3R := false; end; 3: begin - V1 := true; - V2R := false; - V2M := true; - V3R := true; + V1 := false; + V1TwoP := false; //added for ps3 skin + V1ThreeP := true; //added for ps3 skin + V2R := false; + V2M := true; + V3R := true; end; 4: begin // double screen - V1 := true; - V2R := true; - V2M := false; - V3R := false; + V1 := false; + V1TwoP := true; //added for ps3 skin + V1ThreeP := false; //added for ps3 skin + V2R := true; + V2M := false; + V3R := false; end; 6: begin // double screen - V1 := true; - V2R := false; - V2M := true; - V3R := true; + V1 := false; + V1TwoP := false; //added for ps3 skin + V1ThreeP := true; //added for ps3 skin + V2R := false; + V2M := true; + V3R := true; end; end; - + //Added for ps3 skin + //This one is shown in 1P mode + Static[StaticP1].Visible := V1; + Static[StaticP1ScoreBG].Visible := V1; + Text[TextP1].Visible := V1; + Text[TextP1Score].Visible := V1; + //This one is shown in 2/4P mode + Static[StaticP1TwoP].Visible := V1TwoP; + Static[StaticP1TwoPScoreBG].Visible := V1TwoP; + Text[TextP1TwoP].Visible := V1TwoP; + Text[TextP1TwoPScore].Visible := V1TwoP; + //This one is shown in 3/6P mode + Static[StaticP1ThreeP].Visible := V1ThreeP; + Static[StaticP1ThreePScoreBG].Visible := V1ThreeP; + Text[TextP1ThreeP].Visible := V1ThreeP; + Text[TextP1ThreePScore].Visible := V1ThreeP; + //eoa Static[StaticP2R].Visible := V2R; Static[StaticP2RScoreBG].Visible := V2R; @@ -402,10 +457,10 @@ begin 2: begin //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.X; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.X; + Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; //P2 Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.X; @@ -416,10 +471,10 @@ begin 3: begin //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; //P2 Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; @@ -436,10 +491,10 @@ begin 4: begin //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; //P2 Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; @@ -448,10 +503,10 @@ begin Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + Player[2].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; //P4 Player[3].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; @@ -462,10 +517,10 @@ begin 6: begin //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; //P2 Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; @@ -480,10 +535,10 @@ begin Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; //P4 - Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[3].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[3].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[3].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[3].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[3].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[3].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; //P5 Player[4].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; @@ -661,15 +716,15 @@ begin // set player colors if PlayersPlay = 4 then begin if ScreenAct = 1 then begin - LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - Static[StaticP1].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, - Static[StaticP1ScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); @@ -677,15 +732,15 @@ begin end; if ScreenAct = 2 then begin - LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - Static[StaticP1].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, - Static[StaticP1ScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); @@ -696,8 +751,8 @@ begin if PlayersPlay = 6 then begin if ScreenAct = 1 then begin - LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - Static[StaticP1].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P2Dark'); LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, @@ -705,8 +760,8 @@ begin - LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, - Static[StaticP1ScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, @@ -716,8 +771,8 @@ begin end; if ScreenAct = 2 then begin - LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - Static[StaticP1].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P5Dark'); LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, @@ -726,8 +781,8 @@ begin - LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, - Static[StaticP1ScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, @@ -781,6 +836,8 @@ begin // set player names (for 2 screens and only Singstar skin) if ScreenAct = 1 then begin Text[TextP1].Text := 'P1'; + Text[TextP1TwoP].Text := 'P1'; //added for ps3 skin + Text[TextP1ThreeP].Text := 'P1'; //added for ps3 skin Text[TextP2R].Text := 'P2'; Text[TextP2M].Text := 'P2'; Text[TextP3R].Text := 'P3'; @@ -802,11 +859,11 @@ begin end;} 4: begin - Text[TextP1].Text := 'P3'; + Text[TextP1TwoP].Text := 'P3'; Text[TextP2R].Text := 'P4'; end; 6: begin - Text[TextP1].Text := 'P4'; + Text[TextP1ThreeP].Text := 'P4'; Text[TextP2M].Text := 'P5'; Text[TextP3R].Text := 'P6'; end; @@ -814,31 +871,21 @@ begin end; // if // stereo - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; - - - +// weird stuff, maybe this is for "dual screen?", but where is player three then? + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; - - - - Text[TextP1].X := Text[TextP1].X + 10*ScreenX; Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; - - - - Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; - - + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; + Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; +// end of weird stuff for S := 1 to 1 do Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; @@ -865,7 +912,7 @@ begin if PlayersPlay = 2 then begin Tekst := IntToStr(Player[0].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1TwoPScore].Text := Tekst; Tekst := IntToStr(Player[1].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -875,7 +922,7 @@ begin if PlayersPlay = 3 then begin Tekst := IntToStr(Player[0].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1ThreePScore].Text := Tekst; Tekst := IntToStr(Player[1].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -890,7 +937,7 @@ begin if ScreenAct = 1 then begin Tekst := IntToStr(Player[0].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1TwoPScore].Text := Tekst; Tekst := IntToStr(Player[1].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -899,7 +946,7 @@ begin if ScreenAct = 2 then begin Tekst := IntToStr(Player[2].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1TwoPScore].Text := Tekst; Tekst := IntToStr(Player[3].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -911,7 +958,7 @@ begin if ScreenAct = 1 then begin Tekst := IntToStr(Player[0].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1ThreePScore].Text := Tekst; Tekst := IntToStr(Player[1].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -924,7 +971,7 @@ begin if ScreenAct = 2 then begin Tekst := IntToStr(Player[3].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1ThreePScore].Text := Tekst; Tekst := IntToStr(Player[4].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -985,26 +1032,21 @@ begin //GoldenNoteStarsTwinkle Mod // back stereo - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; - +// weird stuff, maybe this is for "dual screen?", but where is player three then? + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; - - Text[TextP1].X := Text[TextP1].X - 10*ScreenX; Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; - - + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; - - Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; +//weird end for S := 1 to 1 do Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index bf342e7a..86613152 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -619,20 +619,20 @@ begin PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; end; 2,4: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; - PlayerInfo.Playerinfo[2].PosX := Static[StaticP1ScoreBG].Texture.X; - PlayerInfo.Playerinfo[2].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1TwoPScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; + PlayerInfo.Playerinfo[2].PosX := Static[StaticP1TwoPScoreBG].Texture.X; + PlayerInfo.Playerinfo[2].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; PlayerInfo.Playerinfo[1].PosX := Static[StaticP2RScoreBG].Texture.X; PlayerInfo.Playerinfo[1].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; PlayerInfo.Playerinfo[3].PosX := Static[StaticP2RScoreBG].Texture.X; PlayerInfo.Playerinfo[3].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; end; 3,6: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; - PlayerInfo.Playerinfo[3].PosX := Static[StaticP1ScoreBG].Texture.X; - PlayerInfo.Playerinfo[3].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ThreePScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; + PlayerInfo.Playerinfo[3].PosX := Static[StaticP1ThreePScoreBG].Texture.X; + PlayerInfo.Playerinfo[3].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; PlayerInfo.Playerinfo[1].PosX := Static[StaticP2MScoreBG].Texture.X; PlayerInfo.Playerinfo[1].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; PlayerInfo.Playerinfo[4].PosX := Static[StaticP2MScoreBG].Texture.X; @@ -669,16 +669,16 @@ begin end; if (PlayersPlay = 2) OR (PlayersPlay = 4) then begin - Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; - Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; + Text[TextP1TwoPScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1TwoPScoreBG].Visible := DLLMan.Selected.ShowScore; Text[TextP2RScore].Visible := DLLMan.Selected.ShowScore; Static[StaticP2RScoreBG].Visible := DLLMan.Selected.ShowScore; end; if (PlayersPlay = 3) OR (PlayersPlay = 6) then begin - Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; - Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; + Text[TextP1ThreePScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1ThreePScoreBG].Visible := DLLMan.Selected.ShowScore; Text[TextP2MScore].Visible := DLLMan.Selected.ShowScore; Static[StaticP2MScoreBG].Visible := DLLMan.Selected.ShowScore; @@ -716,15 +716,15 @@ begin // set player colors if PlayersPlay = 4 then begin if ScreenAct = 1 then begin - LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - Static[StaticP1].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, - Static[StaticP1ScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); @@ -732,15 +732,15 @@ begin end; if ScreenAct = 2 then begin - LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - Static[StaticP1].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, - Static[StaticP1ScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); @@ -751,8 +751,8 @@ begin if PlayersPlay = 6 then begin if ScreenAct = 1 then begin - LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - Static[StaticP1].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P2Dark'); LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, @@ -760,8 +760,8 @@ begin - LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, - Static[StaticP1ScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, @@ -771,8 +771,8 @@ begin end; if ScreenAct = 2 then begin - LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - Static[StaticP1].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P5Dark'); LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, @@ -781,8 +781,8 @@ begin - LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, - Static[StaticP1ScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, @@ -797,20 +797,22 @@ begin // set player names (for 2 screens and only Singstar skin) if ScreenAct = 1 then begin - Text[TextP1].Text := 'P1'; - Text[TextP2R].Text := 'P2'; - Text[TextP2M].Text := 'P2'; - Text[TextP3R].Text := 'P3'; + Text[TextP1].Text := 'P1'; + Text[TextP1TwoP].Text := 'P1'; // added for ps3 skin + Text[TextP1ThreeP].Text := 'P1'; // added for ps3 skin + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; end; if ScreenAct = 2 then begin case PlayersPlay of 4: begin - Text[TextP1].Text := 'P3'; + Text[TextP1TwoP].Text := 'P3'; Text[TextP2R].Text := 'P4'; end; 6: begin - Text[TextP1].Text := 'P4'; + Text[TextP1ThreeP].Text := 'P4'; Text[TextP2M].Text := 'P5'; Text[TextP3R].Text := 'P6'; end; @@ -818,7 +820,7 @@ begin end; // if - // stereo + // stereo <- and where iss P2M? or P3? Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; @@ -841,7 +843,7 @@ begin if PlayersPlay = 2 then begin Tekst := IntToStr(Player[0].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1TwoPScore].Text := Tekst; Tekst := IntToStr(Player[1].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -851,7 +853,7 @@ begin if PlayersPlay = 3 then begin Tekst := IntToStr(Player[0].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1ThreePScore].Text := Tekst; Tekst := IntToStr(Player[1].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -866,7 +868,7 @@ begin if ScreenAct = 1 then begin Tekst := IntToStr(Player[0].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1TwoPScore].Text := Tekst; Tekst := IntToStr(Player[1].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -875,7 +877,7 @@ begin if ScreenAct = 2 then begin Tekst := IntToStr(Player[2].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1TwoPScore].Text := Tekst; Tekst := IntToStr(Player[3].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -887,7 +889,7 @@ begin if ScreenAct = 1 then begin Tekst := IntToStr(Player[0].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1ThreePScore].Text := Tekst; Tekst := IntToStr(Player[1].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -900,7 +902,7 @@ begin if ScreenAct = 2 then begin Tekst := IntToStr(Player[3].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1ThreePScore].Text := Tekst; Tekst := IntToStr(Player[4].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -1007,26 +1009,19 @@ end; // back stereo Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; - - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; - - Text[TextP1].X := Text[TextP1].X - 10*ScreenX; Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; - - + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; - - Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; + for S := 1 to 1 do Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; -- cgit v1.2.3 From 1c5357580b64fb3573728803e11b769cecb5f45a Mon Sep 17 00:00:00 2001 From: mogguh Date: Tue, 17 Apr 2007 21:19:31 +0000 Subject: Bugfix: Scores where not shown correctly when in 4 or 6 player mode (UScreenScore.pas), some more effort should be needed to draw the score bars in this mode correctly (but not now) Theme/Skin: Playerboxes in score screen are now draw in player color (just affected the 4 and 6 player mode) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@110 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenScore.pas | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 2c018b96..72c42cb8 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -574,8 +574,23 @@ begin while (Length(S)<4) do S := '0' + S; Text[TextNotesScore[Item]].Text := S; - while (Length(S)<5) do S := '0' + S; - Text[TextTotalScore[Item]].Text := S; +// while (Length(S)<5) do S := '0' + S; +// Text[TextTotalScore[Item]].Text := S; + +//fixed: line bonus and golden notes don't show up, +// another bug: total score was shown without added golden-, linebonus + S := IntToStr(Player[P].ScoreTotalI); + while (Length(S)<5) do S := '0' + S; + Text[TextTotalScore[Item]].Text := S; + + S := IntToStr(Player[P].ScoreLineI); + while (Length(S)<4) do S := '0' + S; + Text[TextLineBonusScore[Item]].Text := S; + + S := IntToStr(Player[P].ScoreGoldenI); + while (Length(S)<4) do S := '0' + S; + Text[TextGoldenNotesScore[Item]].Text := S; +//end of fix LoadColor( Text[TextName[Item]].ColR, -- cgit v1.2.3 From 6b6edf009b8708de5a3918cad39708b07f1886d9 Mon Sep 17 00:00:00 2001 From: b1indy Date: Tue, 17 Apr 2007 23:48:00 +0000 Subject: fixed a bug that caused song selection screen to be drawn incorrectly and singscreen crash when screen fading was disabled git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@111 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UDisplay.pas | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index 3f6e70da..fc18025f 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -2,7 +2,7 @@ unit UDisplay; interface -uses Windows, SDL, UMenu, OpenGL12, SysUtils, dialogs; +uses Windows, SDL, UMenu, OpenGL12, SysUtils, dialogs, Math; type TDisplay = class @@ -43,6 +43,7 @@ uses UGraphic, UTime, Graphics, Jpeg, UPliki, UTexture, UIni; constructor TDisplay.Create; begin inherited Create; + // fade mod myfade:=0; @@ -163,6 +164,8 @@ begin // ActualScreen.SetAnimationProgress(Fade-1); // nop? + glClearColor(Col, Col, Col , 0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); NextScreen.Draw; // draw next screen // and draw old screen over it... slowly fading out @@ -180,7 +183,10 @@ begin glEnd; glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); - end; + end + else NextScreen.OnShow; + + if (myfade > 40) or (not doFade) or (not canFade) then begin // fade out complete... myFade:=0; ActualScreen.onHide; // nop... whatever -- cgit v1.2.3 From e7650e739e84b47ce6384767e39115adb5d3211a Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 19 Apr 2007 15:30:51 +0000 Subject: Fixed a Bug in PageBreak generation for Text Added support for /n Tag in Texts git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@117 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UMenuText.pas | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas index 4b8ea391..55f84bf8 100644 --- a/Game/Code/Menu/UMenuText.pas +++ b/Game/Code/Menu/UMenuText.pas @@ -61,6 +61,7 @@ var begin TextString := Value; + //Create Page Breaks if width is given if (W > 0) then begin //Set Font Propertys @@ -76,7 +77,7 @@ begin I := Pos (' ', Value); While (I <> 0) do begin - if (glTextWidth(PChar(Copy (Value,LastBreak + 1,I))) > W) AND (LastPos <> 1) then + if (glTextWidth(PChar(Copy (Value,LastBreak + 1,I - LastBreak))) > W) AND (LastPos <> 1) then begin //new Break SetLength (TextTiles, L+1); @@ -105,6 +106,39 @@ begin SetLength (TextTiles, L+1); TextTiles[L] := Copy (Value, LastBreak + 1, Length(Value) - LastBreak); + end + else + begin + SetLength (TextTiles, 1); + TextTiles[0] := Value; + end; + + I := 0; + // /n Hack + While (I <= High(TextTiles)) do + begin + LastPos := Pos ('/n', TextTiles[I]); + if (LastPos = 0) then //No /n Tags -> Search in next Tile + Inc(I) + else //Found /n Tag -> Create a Break + begin + //Add a new Tile and move all Tiles behind actual Tile to the right + L := Length(TextTiles); + SetLength(TextTiles, L+1); + For L := L-1 downto I + 1 do + begin + TextTiles[L+1] := TextTiles[L]; + end; + + //Write Text to new Tile + TextTiles[I+1] := Trim(Copy(TextTiles[I], LastPos + 2, Length(TextTiles[I]) - LastPos - 1)); + //Delete Text that now is in new Tile from cur. Tile + Delete(TextTiles[I], LastPos, Length(TextTiles[I]) - LastPos + 1); + TextTiles[I] := Trim (TextTiles[I]); + + //Goto next Tile because cur. Tile can not have another /n Tag + Inc(I) + end; end; //Set Cursor Visible @@ -148,7 +182,7 @@ begin end; end; - if (W <= 0) then //No Width set Draw as one Long String + if (False) then //No Width set Draw as one Long String begin if not (SelectBool AND SelectBlink) then Text2 := Text -- cgit v1.2.3 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/Classes/UDataBase.pas | 131 +++++++++++++++ Game/Code/Classes/UGraphic.pas | 36 +++-- Game/Code/Classes/UThemes.pas | 33 +++- Game/Code/Menu/UMenuText.pas | 6 +- Game/Code/Screens/UScreenMain.pas | 6 + Game/Code/Screens/UScreenPartyOptions.pas | 9 +- Game/Code/Screens/UScreenStatDetail.pas | 254 ++++++++++++++++++++++++++++++ Game/Code/Screens/UScreenStatMain.pas | 229 +++++++++++++++++++++++++++ Game/Code/UltraStar.dpr | 4 +- 9 files changed, 680 insertions(+), 28 deletions(-) create mode 100644 Game/Code/Screens/UScreenStatDetail.pas create mode 100644 Game/Code/Screens/UScreenStatMain.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDataBase.pas b/Game/Code/Classes/UDataBase.pas index 1ebc18db..0e5a4a3f 100644 --- a/Game/Code/Classes/UDataBase.pas +++ b/Game/Code/Classes/UDataBase.pas @@ -8,6 +8,26 @@ uses USongs, SQLiteTable3; //DataBaseSystem - Class including all DB Methods //-------------------- type + TStatResult = record + Case Typ: Byte of + 0: (Singer: ShortString; + Score: Word; + Difficulty: Byte; + SongArtist: ShortString; + SongTitle: ShortString); + + 1: (Player: ShortString; + AverageScore: Word); + + 2: (Artist: ShortString; + Title: ShortString; + TimesSung: Word); + + 3: (ArtistName: ShortString; + TimesSungtot: Word); + end; + AStatResult = Array of TStatResult; + TDataBaseSystem = class private ScoreDB: TSqliteDatabase; @@ -15,12 +35,17 @@ type public + property Filename: String read sFilename; + Destructor Free; Procedure Init(const Filename: string); procedure ReadScore(var Song: TSong); procedure AddScore(var Song: TSong; Level: integer; Name: string; Score: integer); procedure WriteScore(var Song: TSong); + + Function GetStats(var Stats: AStatResult; const Typ, Count: Byte; const Page: Cardinal; const Reversed: Boolean): Boolean; + Function GetTotalEntrys(const Typ: Byte): Cardinal; end; var @@ -160,4 +185,110 @@ begin end; end; +//-------------------- +//GetStats - Write some Stats to Array, Returns True if Chossen Page has Entrys +//Case Typ of +//0 - Best Scores +//1 - Best Singers +//2 - Most sung Songs +//3 - Most popular Band +//-------------------- +Function TDataBaseSystem.GetStats(var Stats: AStatResult; const Typ, Count: Byte; const Page: Cardinal; const Reversed: Boolean): Boolean; +var + Query: String; + TableData: TSqliteTable; +begin + Result := False; + + if (Length(Stats) < Count) then + Exit; + + {Todo: + Add Prevention that only Players with more than 5 Scores are Selected at Typ 2} + + //Create Query + Case Typ of + 0: Query := 'SELECT `Player` , `Difficulty` , `Score` , `Artist` , `Title` FROM `US_Scores` INNER JOIN `US_Songs` ON (`SongID` = `ID`) ORDER BY `Score`'; + 1: Query := 'SELECT `Player` , (Sum(`Score`) / COUNT(`Score`)) FROM `US_Scores` GROUP BY `Player` ORDER BY (Sum(`Score`) / COUNT(`Score`))'; + 2: Query := 'SELECT `Artist` , `Title` , `TimesPlayed` FROM `US_Songs` ORDER BY `TimesPlayed`'; + 3: Query := 'SELECT `Artist` , Sum(`TimesPlayed`) FROM `US_Songs` GROUP BY `Artist` ORDER BY Sum(`TimesPlayed`)'; + end; + + //Add Order Direction + If Reversed then + Query := Query + ' ASC' + else + Query := Query + ' DESC'; + + //Add Limit + Query := Query + ' LIMIT ' + InttoStr(Count * Page) + ', ' + InttoStr(Count) + ';'; + + //Execute Query + //try + TableData := ScoreDB.GetTable(Query); + {except + exit; + end;} + + //if Result empty -> Exit + if (TableData.RowCount < 1) then + exit; + + //Copy Result to Stats Array + while not TableData.Eof do + begin + Stats[TableData.Row].Typ := Typ; + + Case Typ of + 0:begin + Stats[TableData.Row].Singer := TableData.Fields[0]; + + Stats[TableData.Row].Difficulty := StrtoIntDef(TableData.Fields[1], 0); + + Stats[TableData.Row].Score := StrtoIntDef(TableData.Fields[2], 0){TableData.FieldAsInteger(2)}; + Stats[TableData.Row].SongArtist := TableData.Fields[3]; + Stats[TableData.Row].SongTitle := TableData.Fields[4]; + end; + + 1:begin + Stats[TableData.Row].Player := TableData.Fields[0]; + Stats[TableData.Row].AverageScore := TableData.FieldAsInteger(1); + end; + + 2:begin + Stats[TableData.Row].Artist := TableData.Fields[0]; + Stats[TableData.Row].Title := TableData.Fields[1]; + Stats[TableData.Row].TimesSung := StrtoIntDef(TableData.Fields[2], 0); + end; + + 3:begin + Stats[TableData.Row].ArtistName := TableData.Fields[0]; + Stats[TableData.Row].TimesSungtot := StrtoIntDef(TableData.Fields[1], 0); + end; + + end; + + TableData.Next; + end; + + Result := True; +end; + +//-------------------- +//GetTotalEntrys - Get Total Num of entrys for a Stats Query +//-------------------- +Function TDataBaseSystem.GetTotalEntrys(const Typ: Byte): Cardinal; +var Query: String; +begin + //Create Query + Case Typ of + 0: Query := 'SELECT COUNT(`SongID`) FROM `US_Scores`;'; + 1: Query := 'SELECT COUNT(DISTINCT `Player`) FROM `US_Scores`;'; + 2: Query := 'SELECT COUNT(`ID`) FROM `US_Songs`;'; + 3: Query := 'SELECT COUNT(DISTINCT `Artist`) FROM `US_Songs`;'; + end; + + Result := ScoreDB.GetTableValue(Query); +end; + end. diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index b909e49f..342efe3c 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -7,7 +7,8 @@ uses UScreenOptionsGraphics, UScreenOptionsSound, UScreenOptionsLyrics, UScreenOptionsThemes, UScreenOptionsRecord, UScreenOptionsAdvanced, UScreenSong, UScreenSing, UScreenScore, UScreenTop5, UScreenEditSub, UScreenEdit, UScreenEditConvert, UScreenEditHeader, UScreenOpen, UThemes, USkins, UScreenSongMenu, UScreenSongJumpto, - {Party Screens} UScreenSingModi, UScreenPartyNewRound, UScreenPartyScore, UScreenPartyOptions, UScreenPartyWin, UScreenPartyPlayer; + {Party Screens} UScreenSingModi, UScreenPartyNewRound, UScreenPartyScore, UScreenPartyOptions, UScreenPartyWin, UScreenPartyPlayer, + {Stats Screens} UScreenStatMain, UScreenStatDetail; type TRecR = record @@ -62,6 +63,10 @@ var ScreenPartyOptions: TScreenPartyOptions; ScreenPartyPlayer: TScreenPartyPlayer; + //StatsScreens + ScreenStatMain: TScreenStatMain; + ScreenStatDetail: TScreenStatDetail; + Tex_Left: array[0..6] of TTexture; Tex_Mid: array[0..6] of TTexture; @@ -221,20 +226,27 @@ var Icon: TIcon; Res: TResourceStream; ISurface: PSDL_Surface; + Pixel: PByteArray; begin Log.LogStatus('LoadOpenGL', 'Initialize3D'); Log.BenchmarkStart(2); LoadOpenGL; - {//Load Icon + Log.LogStatus('SDL_Init', 'Initialize3D'); + if ( SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO)= -1 ) then begin + Log.LogError('SDL_Init Failed', 'Initialize3D'); + exit; + end; + + { //Load Icon Res := TResourceStream.CreateFromID(HInstance, 3, RT_ICON); Icon := TIcon.Create; Icon.LoadFromStream(Res); Res.Free; - + Icon. //Create icon Surface - SDL_CreateRGBSurface ( + SDL_CreateRGBSurfaceFrom ( SDL_SWSURFACE, Icon.Width, Icon.Height, @@ -243,18 +255,12 @@ begin 32 or 16, 8 or 4, 2 or 1); - SDL_BlitSurface( //} - + //SDL_BlitSurface( - SDL_WM_SetIcon(SDL_LoadBMP('us.ico'), 0); //} - Log.LogStatus('SDL_Init', 'Initialize3D'); - if ( SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO)= -1 ) then begin - Log.LogError('SDL_Init Failed', 'Initialize3D'); - exit; - end; + SDL_WM_SetIcon(SDL_LoadBMP('DEFAULT_WINDOW_ICON'), 0); //} - SDL_WM_SetCaption(PChar(Title), 'WM_DEFAULT'); + SDL_WM_SetCaption(PChar(Title), nil); InitializeScreen; @@ -433,6 +439,10 @@ begin Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyOptions', 3); Log.BenchmarkStart(3); ScreenPartyPlayer := TScreenPartyPlayer.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyPlayer', 3); Log.BenchmarkStart(3); + ScreenStatMain := TScreenStatMain.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Main', 3); Log.BenchmarkStart(3); + ScreenStatDetail := TScreenStatDetail.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Detail', 3); Log.BenchmarkStart(3); end; end. diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 5aca1401..4f4ab2b9 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -570,10 +570,15 @@ type ButtonPrev: TThemeButton; ButtonReverse: TThemeButton; ButtonExit: TThemeButton; - - Description: array[0..3] of string; + TextDescription: TThemeText; + TextPage: TThemeText; TextList: AThemeText; + + Description: array[0..3] of string; + DescriptionR: array[0..3] of string; + FormatStr: array[0..3] of string; + PageStr: String; end; //Playlist Translations @@ -620,6 +625,8 @@ type Playlist: TThemePlaylist; + ILevel: array[0..2] of String; + constructor Create(FileName: string); overload; // Initialize theme system constructor Create(FileName: string; Color: integer); overload; // Initialize theme system with color function LoadTheme(FileName: string; sColor: integer): boolean; // Load some theme settings from file @@ -1242,15 +1249,35 @@ begin ThemeLoadButton(StatDetail.ButtonExit, 'StatDetailButtonExit'); ThemeLoadText (StatDetail.TextDescription, 'StatDetailTextDescription'); + ThemeLoadText (StatDetail.TextPage, 'StatDetailTextPage'); ThemeLoadTexts(StatDetail.TextList, 'StatDetailTextList'); + //Translate Texts StatDetail.Description[0] := Language.Translate('STAT_DESC_SCORES'); StatDetail.Description[1] := Language.Translate('STAT_DESC_SINGERS'); StatDetail.Description[2] := Language.Translate('STAT_DESC_SONGS'); StatDetail.Description[3] := Language.Translate('STAT_DESC_BANDS'); + StatDetail.DescriptionR[0] := Language.Translate('STAT_DESC_SCORES_REVERSED'); + StatDetail.DescriptionR[1] := Language.Translate('STAT_DESC_SINGERS_REVERSED'); + StatDetail.DescriptionR[2] := Language.Translate('STAT_DESC_SONGS_REVERSED'); + StatDetail.DescriptionR[3] := Language.Translate('STAT_DESC_BANDS_REVERSED'); + + StatDetail.FormatStr[0] := Language.Translate('STAT_FORMAT_SCORES'); + StatDetail.FormatStr[1] := Language.Translate('STAT_FORMAT_SINGERS'); + StatDetail.FormatStr[2] := Language.Translate('STAT_FORMAT_SONGS'); + StatDetail.FormatStr[3] := Language.Translate('STAT_FORMAT_BANDS'); + + StatDetail.PageStr := Language.Translate('STAT_PAGE'); + //Playlist Translations - Playlist.CatText := Language.Translate('PLAYLIST_CATTEXT') + Playlist.CatText := Language.Translate('PLAYLIST_CATTEXT'); + + //Level Translations + //Fill ILevel + ILevel[0] := Language.Translate('SING_EASY'); + ILevel[1] := Language.Translate('SING_MEDIUM'); + ILevel[2] := Language.Translate('SING_HARD'); end; ThemeIni.Free; diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas index 55f84bf8..65034f1d 100644 --- a/Game/Code/Menu/UMenuText.pas +++ b/Game/Code/Menu/UMenuText.pas @@ -114,13 +114,13 @@ begin end; I := 0; - // /n Hack + // \n Hack While (I <= High(TextTiles)) do begin - LastPos := Pos ('/n', TextTiles[I]); + LastPos := Pos ('\n', TextTiles[I]); if (LastPos = 0) then //No /n Tags -> Search in next Tile Inc(I) - else //Found /n Tag -> Create a Break + else //Found \n Tag -> Create a Break begin //Add a new Tile and move all Tiles behind actual Tile to the right L := Length(TextTiles); diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index dd7f21c5..8d2d13b6 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -135,6 +135,12 @@ begin end; end; + SDLK_S: + begin + Music.PlayStart; + FadeTo(@ScreenStatMain); + end; + SDLK_RETURN: begin if (Interaction = 0) and (Length(Songs.Song) >= 1) then begin diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 1fd4da8f..fd7b5107 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -31,7 +31,6 @@ type end; var - ILevel: array[0..2] of String; IPlaylist: array[0..2] of String; IPlaylist2: array of String; const @@ -185,12 +184,6 @@ var I: integer; begin inherited Create; - - //Fill ILevel - ILevel[0] := Language.Translate('SING_EASY'); - ILevel[1] := Language.Translate('SING_MEDIUM'); - ILevel[2] := Language.Translate('SING_HARD'); - //Fill IPlaylist IPlaylist[0] := Language.Translate('PARTY_PLAYLIST_ALL'); IPlaylist[1] := Language.Translate('PARTY_PLAYLIST_CATEGORY'); @@ -210,7 +203,7 @@ begin AddBackground(Theme.PartyOptions.Background.Tex); - SelectLevel := AddSelectSlide (Theme.PartyOptions.SelectLevel, Ini.Difficulty, ILevel); + SelectLevel := AddSelectSlide (Theme.PartyOptions.SelectLevel, Ini.Difficulty, Theme.ILevel); SelectPlayList := AddSelectSlide (Theme.PartyOptions.SelectPlayList, PlayList, IPlaylist); SelectPlayList2 := AddSelectSlide (Theme.PartyOptions.SelectPlayList2, PlayList2, IPlaylist2); SelectRounds := AddSelectSlide (Theme.PartyOptions.SelectRounds, Rounds, IRounds); diff --git a/Game/Code/Screens/UScreenStatDetail.pas b/Game/Code/Screens/UScreenStatDetail.pas new file mode 100644 index 00000000..dc4a0f1f --- /dev/null +++ b/Game/Code/Screens/UScreenStatDetail.pas @@ -0,0 +1,254 @@ +unit UScreenStatDetail; + +interface + +uses + UMenu, SDL, SysUtils, UDisplay, UMusic, UIni, UThemes; + +type + TScreenStatDetail = class(TMenu) + public + Typ: Byte; + Page: CardinaL; + Count: Byte; + Reversed: Boolean; + + TotEntrys: Cardinal; + TotPages: Cardinal; + + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + + procedure SetTitle; + Procedure SetPage(NewPage: Cardinal); + end; + +implementation + +{Stat Screens: + 0 - Best Scores + 1 - Best Singers + 2 - Most sung Songs + 3 - Most popular Band +} + +uses UGraphic, UDataBase, ULanguage, math, ULog; + +function TScreenStatDetail.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 + Music.PlayBack; + FadeTo(@ScreenStatMain); + end; + SDLK_RETURN: + begin + if Interaction = 0 then begin + //Next Page + SetPage(Page+1); + end; + + if Interaction = 1 then begin + //Previous Page + if (Page > 0) then + SetPage(Page-1); + end; + + if Interaction = 2 then begin + //Reverse Order + Reversed := not Reversed; + SetPage(Page); + end; + + if Interaction = 3 then begin + Music.PlayBack; + FadeTo(@ScreenStatMain); + 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 TScreenStatDetail.Create; +var + I: integer; +begin + inherited Create; + + AddBackground(Theme.StatDetail.Background.Tex); + + AddButton(Theme.StatDetail.ButtonNext); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Language.Translate('STAT_NEXT')); + + AddButton(Theme.StatDetail.ButtonPrev); + if (Length(Button[1].Text)=0) then + AddButtonText(14, 20, Language.Translate('STAT_PREV')); + + AddButton(Theme.StatDetail.ButtonReverse); + if (Length(Button[2].Text)=0) then + AddButtonText(14, 20, Language.Translate('STAT_REVERSE')); + + AddButton(Theme.StatDetail.ButtonExit); + if (Length(Button[3].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[7]); + + for I := 0 to High(Theme.StatDetail.TextList) do + AddText(Theme.StatDetail.TextList[I]); + + Count := Length(Theme.StatDetail.TextList); + + AddText(Theme.StatDetail.TextDescription); + AddText(Theme.StatDetail.TextPage); + + for I := 0 to High(Theme.StatDetail.Static) do + AddStatic(Theme.StatDetail.Static[I]); + + for I := 0 to High(Theme.StatDetail.Text) do + AddText(Theme.StatDetail.Text[I]); + + + + Interaction := 0; + Typ := 0; +end; + +procedure TScreenStatDetail.onShow; +begin + //Set Tot Entrys and PAges + TotEntrys := DataBase.GetTotalEntrys(Typ); + TotPages := Ceil(TotEntrys / Count); + //Show correct Title + SetTitle; + //Show First Page + Reversed := False; + SetPage(0); +end; + +procedure TScreenStatDetail.SetTitle; +begin + //Set Title + Case Reversed of + True: Text[Count].Text := Theme.StatDetail.DescriptionR[Typ]; + False: Text[Count].Text := Theme.StatDetail.Description[Typ]; + end; +end; + +Procedure TScreenStatDetail.SetPage(NewPage: Cardinal); +var + Result: AStatResult; + I: Integer; + FormatStr: String; + PerPage: Byte; +begin + SetLength(Result, Count); + if (Database.GetStats(Result, Typ, Count, NewPage, Reversed)) then + begin + Page := NewPage; + + FormatStr := Theme.StatDetail.FormatStr[Typ]; + + //refresh Texts + For I := 0 to Count-1 do + begin + try + case Typ of + 0:begin //Best Scores + //Set Texts + if (Result[I].Score>0) then + Text[I].Text := Format(FormatStr, [Result[I].Singer, + Result[I].Score, + Theme.ILevel[Result[I].Difficulty], + Result[I].SongArtist, + Result[I].SongTitle]) + else + Text[I].Text := ''; + end; + + 1:begin //Best Singers + //Set Texts + if (Result[I].AverageScore>0) then + Text[I].Text := Format(FormatStr, [Result[I].Player, + Result[I].AverageScore]) + else + Text[I].Text := ''; + end; + + 2:begin //Popular Songs + //Set Texts + if (Result[I].Artist<>'') then + Text[I].Text := Format(FormatStr, [Result[I].Artist, + Result[I].Title, + Result[I].TimesSung]) + else + Text[I].Text := ''; + end; + + 3:begin //Popular Bands + //Set Texts + if (Result[I].ArtistName<>'') then + Text[I].Text := Format(FormatStr, [Result[I].ArtistName, + Result[I].TimesSungtot]) + else + Text[I].Text := ''; + end; + end; + except + on E: EConvertError do + Log.LogError('Error Parsing FormatString in UScreenStatDetail: ' + E.Message); + end; + end; + + if (Page + 1 = TotPages) AND (TotEntrys Mod Count <> 0) then + PerPage := (TotEntrys Mod Count) + else + PerPage := Count; + + Text[Count+1].Text := Format(Theme.StatDetail.PageStr, [Page + 1, + TotPages, + PerPage, + TotEntrys]); + + //Show correct Title + SetTitle; + + end; + +end; + + +procedure TScreenStatDetail.SetAnimationProgress(Progress: real); +var I: Integer; +begin + For I := 0 to high(Button) do + Button[I].Texture.ScaleW := Progress; +end; + +end. 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 diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index fc1fa8a2..d5418e04 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -78,6 +78,8 @@ uses UScreenTop5 in 'Screens\UScreenTop5.pas', UScreenSongMenu in 'Screens\UScreenSongMenu.pas', UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', + UScreenStatMain in 'Screens\UScreenStatMain.pas', + UScreenStatDetail in 'Screens\UScreenStatDetail.pas', //------------------------------ //Includes - Screens PartyMode @@ -103,7 +105,7 @@ uses const - Version = 'UltraStar Deluxe V 0.95 Beta'; + Version = 'UltraStar Deluxe V 0.96 Beta'; var WndTitle: string; -- cgit v1.2.3 From 34988301a511ca8552a954c231fafde007cb94a1 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 20 Apr 2007 15:29:48 +0000 Subject: Some Memory tweaking (13 MB Less Ram using at 800 Songs) Some Loading Time tweaking (From 8 Secs to 6 Secs on my Computer) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@123 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/USongs.pas | 26 +++++++++++++++++++--- Game/Code/Menu/UMenu.pas | 35 ++++++++++++++++++++++++++++-- Game/Code/Screens/UScreenOptionsRecord.pas | 2 ++ Game/Code/Screens/UScreenSong.pas | 3 +++ 4 files changed, 61 insertions(+), 5 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index cc3c8b95..4240d135 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -58,6 +58,9 @@ type end; TSongs = class + private + BrowsePos: Cardinal; //Actual Pos in Song Array + public Song: array of TSong; // array of songs Selected: integer; // selected song index procedure LoadSongList; // load all songs @@ -100,10 +103,14 @@ begin Log.LogStatus('Initializing', 'LoadSongList'); // clear - Setlength(Song, 0); + Setlength(Song, 50); + BrowsePos := 0; // browse directories BrowseDir(SongPath); + + //Set Correct SongArray Length + SetLength(Song, BrowsePos + 1); // if Ini.Debug = 1 then BrowseDir('D:\Extract\Songs\'); end; @@ -125,14 +132,19 @@ begin if FindFirst(Dir + '*.txt', 0, SR) = 0 then begin // Log.LogStatus('Parsing file: ' + Dir + SR.Name + '\' + SRD.Name, 'LoadSongList'); repeat + //New Mod for better Memory Management + + SLen := BrowsePos; + {//Old SLen := Length(Song); - SetLength(Song, SLen + 1); + SetLength(Song, SLen + 1);//} + Song[SLen].Path := Dir; Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos('\', Song[SLen].Folder)-1); Song[SLen].FileName := SR.Name; - if (AnalyseFile(Song[SLen]) = false) then SetLength(Song, SLen) + if (AnalyseFile(Song[SLen]) = false) then Dec(BrowsePos) else begin // scanning complete, file is good // if there is no cover then try to find it @@ -146,6 +158,14 @@ begin // Song[SLen].Cover := Song[SLen].Path + Song[SLen].Cover; end; + //Change Length Only every 50 Entrys + Inc(BrowsePos); + + if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then + begin + SetLength(Song, Length(Song) + 50); + end; + until FindNext(SR) <> 0; end; // if FindFirst FindClose(SR); diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 7908d980..1c4418c1 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -11,6 +11,8 @@ type PMenu = ^TMenu; TMenu = class protected + ButtonPos: Integer; + Interactions: array of TInteract; SelInteraction: integer; Button: array of TButton; @@ -59,6 +61,7 @@ type function AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; Tekst: string): integer; overload; // button + Procedure SetButtonLength(Length: Cardinal); //Function that Set Length of Button Array in one Step instead of register new Memory for every Button function AddButton(ThemeButton: TThemeButton): integer; overload; function AddButton(X, Y, W, H: real; Name: String): integer; overload; function AddButton(X, Y, W, H: real; Name, Format, Typ: String; Reflection: Boolean): integer; overload; @@ -150,6 +153,9 @@ begin SetLength(Button, 0); BackImg.TexNum := -1; + + //Set ButtonPos to Autoset Length + ButtonPos := -1; end; constructor TMenu.Create(Back: String); @@ -165,6 +171,9 @@ begin BackH := 1; end else BackImg.TexNum := -1; + + //Set ButtonPos to Autoset Length + ButtonPos := -1; end; constructor TMenu.Create(Back: string; W, H: integer); @@ -356,6 +365,19 @@ begin Result := TextNum; end; +//Function that Set Length of Button Array in one Step instead of register new Memory for every Button +Procedure TMenu.SetButtonLength(Length: Cardinal); +begin + if (ButtonPos = -1) AND (Length > 0) then + begin + //Set Length of Button + SetLength(Button, Length); + + //Set ButtonPos to start with 0 + ButtonPos := 0; + end; +end; + // Method to add a button in our TMenu. It returns the assigned ButtonNumber function TMenu.AddButton(ThemeButton: TThemeButton): integer; @@ -399,8 +421,17 @@ end; function TMenu.AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean; ReflectionSpacing: Real): integer; begin // adds button - Result := Length(Button); - SetLength(Button, Result + 1); + //SetLength is used to reduce Memory usement + if (ButtonPos <> -1) then + begin + Result := ButtonPos; + Inc(ButtonPos) + end + else //Old Method -> Reserve new Memory for every Button + begin + Result := Length(Button); + SetLength(Button, Result + 1); + end; // Button[Result] := TButton.Create(Texture.GetTexture(Name, Typ)); // check here for cache diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index e6989d43..1d09d0b8 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -72,6 +72,8 @@ var SC: integer; SCI: integer; begin + inherited Create; + AddBackground(Theme.OptionsRecord.Background.Tex); for I := 0 to High(Theme.OptionsRecord.Static) do AddStatic(Theme.OptionsRecord.Static[I]); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 7c8447ee..79a5abb1 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -634,6 +634,9 @@ begin // Song List // Songs.LoadSongList; // moved to the UltraStar unit CatSongs.Refresh; + + //Set Length of Button Array one Time Instead of one time for every Song + SetButtonLength(Length(CatSongs.Song)); for Pet := 0 to High(CatSongs.Song) do begin // creating all buttons // new Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 -- cgit v1.2.3 From e68a4499226b3b9a129e55c94cebee5910c0ff02 Mon Sep 17 00:00:00 2001 From: mota23 Date: Fri, 20 Apr 2007 17:19:05 +0000 Subject: Changed LinePopup Colors from Red->Green to Red->Yellow->Green git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@124 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 650cfdff..e7572ab9 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1145,9 +1145,36 @@ begin Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; //Color - Player[I].LineBonus_Color.B := 0; - Player[I].LineBonus_Color.R := (8-A)/8; - Player[I].LineBonus_Color.G := A/10; + Case Floor(A) of + 0: begin + Player[I].LineBonus_Color.R := 1; + Player[I].LineBonus_Color.G := 0; + Player[I].LineBonus_Color.B := 0; + end; + 1..3: begin + Player[I].LineBonus_Color.R := 1; + Player[I].LineBonus_Color.G := (A * 0.25); + Player[I].LineBonus_Color.B := 0; + end; + 4: begin + Player[I].LineBonus_Color.R := 1; + Player[I].LineBonus_Color.G := 1; + Player[I].LineBonus_Color.B := 0; + end; + 5..7: begin + Player[I].LineBonus_Color.R := 1-((a-4)*0.25); + Player[I].LineBonus_Color.G := 1; + Player[I].LineBonus_Color.B := 0; + end; + 8: begin + Player[I].LineBonus_Color.R := 0; + Player[I].LineBonus_Color.G := 1; + Player[I].LineBonus_Color.B := 0; + end; + End; //Case + //Player[I].LineBonus_Color.B := 0; + //Player[I].LineBonus_Color.R := (8-A)/8; + //Player[I].LineBonus_Color.G := A/10; Player[I].LineBonus_PosX := Player[I].LineBonus_StartX; Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; -- cgit v1.2.3 From 3c106109e17a62c0d6c3620fc290a90410cae84c Mon Sep 17 00:00:00 2001 From: mota23 Date: Fri, 20 Apr 2007 20:36:21 +0000 Subject: Made the Line-Popup pop up. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@125 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 193 +++++++++++++++++--------------------- Game/Code/Classes/UMain.pas | 5 +- Game/Code/Screens/UScreenSing.pas | 1 + 3 files changed, 88 insertions(+), 111 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 410fbb2e..bd6b5db6 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -20,7 +20,7 @@ procedure SingGoldenStar(X, Y, A: real); procedure SingDrawSingbar(X, Y, W, H: real; Percent: integer); //Phrasen Bonus - Line Bonus -procedure SingDrawLineBonus( const X, Y: integer; Color: TRGB; Alpha: Single; Text: string); +procedure SingDrawLineBonus( const X, Y: Single; Color: TRGB; Alpha: Single; Text: string; Age: Integer); //Draw Editor NoteLines procedure EditDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); @@ -662,7 +662,6 @@ begin Rec.Right := Rec.Left + 50; Rec.Top := Skin_LyricsT + 3; Rec.Bottom := Rec.Top + 33;//SingScreen.LyricMain.Size * 3; - { // zapalanie BarAlpha := (BarWspol*10) * 0.5; if BarAlpha > 0.5 then BarAlpha := 0.5; @@ -685,14 +684,7 @@ begin glTexCoord2f(15/16, 1/16); glVertex2f(Rec.Right, Rec.Top); glEnd; glDisable(GL_BLEND); -{ glBegin(GL_QUADS); - glColor4f(26/255, 165/255, 220/255, 0); - glVertex2f(Rec.Left, Rec.Top); - glVertex2f(Rec.Left, Rec.Bottom); - glColor4f(26/255, 165/255, 220/255, BarAlpha); - glVertex2f(Rec.Right, Rec.Bottom); - glVertex2f(Rec.Right, Rec.Top); - glEnd;} + end; // oscilloscope @@ -793,58 +785,61 @@ begin for E := 0 to (PlayersPlay - 1) do begin //Change Alpha Player[E].LineBonus_Alpha := Player[E].LineBonus_Alpha - 0.02; - if Player[E].LineBonus_Alpha <= 0 then - Player[E].LineBonus_Visible := False + begin + Player[E].LineBonus_Age := 0; + Player[E].LineBonus_Visible := False + end else begin + inc(Player[E].LineBonus_Age, 1); //Change Position if (Player[E].LineBonus_PosX < Player[E].LineBonus_TargetX) then - Inc(Player[E].LineBonus_PosX,1) + Player[E].LineBonus_PosX := Player[E].LineBonus_PosX + (2 - Player[E].LineBonus_Alpha * 1.5) else if (Player[E].LineBonus_PosX > Player[E].LineBonus_TargetX) then - Dec(Player[E].LineBonus_PosX,1); + Player[E].LineBonus_PosX := Player[E].LineBonus_PosX - (2 - Player[E].LineBonus_Alpha * 1.5); if (Player[E].LineBonus_PosY < Player[E].LineBonus_TargetY) then - Inc(Player[E].LineBonus_PosY,1) + Player[E].LineBonus_PosY := Player[E].LineBonus_PosY + (2 - Player[E].LineBonus_Alpha * 1.5) else if (Player[E].LineBonus_PosY > Player[E].LineBonus_TargetY) then - Dec(Player[E].LineBonus_PosY,1); + Player[E].LineBonus_PosY := Player[E].LineBonus_PosY - (2 - Player[E].LineBonus_Alpha * 1.5); end; end; end; //if if PlayersPlay = 1 then begin - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text); + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); end else if PlayersPlay = 2 then begin - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text); - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text); + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); end else if PlayersPlay = 3 then begin - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text); - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text); - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text); + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); end else if PlayersPlay = 4 then begin if ScreenAct = 1 then begin - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text); - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text); + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); end; if ScreenAct = 2 then begin - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text); - SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text); + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); + SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); end; end; if PlayersPlay = 6 then begin if ScreenAct = 1 then begin - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text); - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text); - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text); + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); end; if ScreenAct = 2 then begin - SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text); - SingDrawLineBonus( Player[4].LineBonus_PosX, Player[4].LineBonus_PosY, Player[4].LineBonus_Color, Player[4].LineBonus_Alpha, Player[4].LineBonus_Text); - SingDrawLineBonus( Player[5].LineBonus_PosX, Player[5].LineBonus_PosY, Player[5].LineBonus_Color, Player[5].LineBonus_Alpha, Player[5].LineBonus_Text); + SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); + SingDrawLineBonus( Player[4].LineBonus_PosX, Player[4].LineBonus_PosY, Player[4].LineBonus_Color, Player[4].LineBonus_Alpha, Player[4].LineBonus_Text, Player[4].LineBonus_Age); + SingDrawLineBonus( Player[5].LineBonus_PosX, Player[5].LineBonus_PosY, Player[5].LineBonus_Color, Player[5].LineBonus_Alpha, Player[5].LineBonus_Text, Player[5].LineBonus_Age); end; end; end; @@ -1056,24 +1051,28 @@ begin Rec.Right := Rec.Left + 50; Rec.Top := Skin_LyricsT + 3; Rec.Bottom := Rec.Top + 33;//SingScreen.LyricMain.Size * 3; +{ // zapalanie + BarAlpha := (BarWspol*10) * 0.5; + if BarAlpha > 0.5 then BarAlpha := 0.5; - // zapalanie - BarAlpha := (BarWspol*10) * 0.5; - if BarAlpha > 0.5 then BarAlpha := 0.5; + // gaszenie + if BarWspol > 0.95 then BarAlpha := 0.5 * (1 - (BarWspol - 0.95) * 20);} - // gaszenie - if BarWspol > 0.95 then BarAlpha := 0.5 * (1 - (BarWspol - 0.95) * 20); - //Change fuer Crazy Joker - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glColor4f(26/255, 165/255, 220/255, 0); - glVertex2f(Rec.Left, Rec.Top); - glVertex2f(Rec.Left, Rec.Bottom); - glColor4f(26/255, 165/255, 220/255, BarAlpha); - glVertex2f(Rec.Right, Rec.Bottom); - glVertex2f(Rec.Right, Rec.Top); - glEnd; - glDisable(GL_BLEND); + //Change fuer Crazy Joker + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_Lyric_Help_Bar.TexNum); + glBegin(GL_QUADS); + glColor4f(1, 1, 1, 0); + glTexCoord2f(1/16, 1/16); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(1/16, 15/16); glVertex2f(Rec.Left, Rec.Bottom); + glColor4f(1, 1, 1, 0.5); + glTexCoord2f(15/16, 15/16); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(15/16, 1/16); glVertex2f(Rec.Right, Rec.Top); + glEnd; + glDisable(GL_BLEND); end; // oscilloscope @@ -1207,20 +1206,27 @@ begin //Change Alpha Player[E].LineBonus_Alpha := Player[E].LineBonus_Alpha - 0.02; + if Player[E].LineBonus_Alpha <= 0 then + begin + Player[E].LineBonus_Age := 0; Player[E].LineBonus_Visible := False + + end else begin + inc(Player[E].LineBonus_Age, 1); + //Change Position if (Player[E].LineBonus_PosX < Player[E].LineBonus_TargetX) then - Inc(Player[E].LineBonus_PosX,1) + Player[E].LineBonus_PosX := Player[E].LineBonus_PosX + (2 - Player[E].LineBonus_Alpha * 1.5) else if (Player[E].LineBonus_PosX > Player[E].LineBonus_TargetX) then - Dec(Player[E].LineBonus_PosX,1); + Player[E].LineBonus_PosX := Player[E].LineBonus_PosX - (2 - Player[E].LineBonus_Alpha * 1.5); if (Player[E].LineBonus_PosY < Player[E].LineBonus_TargetY) then - Inc(Player[E].LineBonus_PosY,1) + Player[E].LineBonus_PosY := Player[E].LineBonus_PosY + (2 - Player[E].LineBonus_Alpha * 1.5) else if (Player[E].LineBonus_PosY > Player[E].LineBonus_TargetY) then - Dec(Player[E].LineBonus_PosY,1); + Player[E].LineBonus_PosY := Player[E].LineBonus_PosY - (2 - Player[E].LineBonus_Alpha * 1.5); end; end; @@ -1228,52 +1234,52 @@ begin if PlayersPlay = 1 then begin if PlayerInfo.Playerinfo[0].Enabled then - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text); + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); end else if PlayersPlay = 2 then begin if PlayerInfo.Playerinfo[0].Enabled then - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text); + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); if PlayerInfo.Playerinfo[1].Enabled then - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text); + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); end else if PlayersPlay = 3 then begin if PlayerInfo.Playerinfo[0].Enabled then - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text); + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); if PlayerInfo.Playerinfo[1].Enabled then - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text); + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); if PlayerInfo.Playerinfo[2].Enabled then - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text); + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); end else if PlayersPlay = 4 then begin if ScreenAct = 1 then begin if PlayerInfo.Playerinfo[0].Enabled then - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text); + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); if PlayerInfo.Playerinfo[1].Enabled then - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text); + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); end; if ScreenAct = 2 then begin if PlayerInfo.Playerinfo[2].Enabled then - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text); + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); if PlayerInfo.Playerinfo[3].Enabled then - SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text); + SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); end; end; if PlayersPlay = 6 then begin if ScreenAct = 1 then begin if PlayerInfo.Playerinfo[0].Enabled then - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text); + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); if PlayerInfo.Playerinfo[1].Enabled then - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text); + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); if PlayerInfo.Playerinfo[2].Enabled then - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text); + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); end; if ScreenAct = 2 then begin if PlayerInfo.Playerinfo[3].Enabled then - SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text); + SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); if PlayerInfo.Playerinfo[4].Enabled then - SingDrawLineBonus( Player[4].LineBonus_PosX, Player[4].LineBonus_PosY, Player[4].LineBonus_Color, Player[4].LineBonus_Alpha, Player[4].LineBonus_Text); + SingDrawLineBonus( Player[4].LineBonus_PosX, Player[4].LineBonus_PosY, Player[4].LineBonus_Color, Player[4].LineBonus_Alpha, Player[4].LineBonus_Text, Player[4].LineBonus_Age); if PlayerInfo.Playerinfo[5].Enabled then - SingDrawLineBonus( Player[5].LineBonus_PosX, Player[5].LineBonus_PosY, Player[5].LineBonus_Color, Player[5].LineBonus_Alpha, Player[5].LineBonus_Text); + SingDrawLineBonus( Player[5].LineBonus_PosX, Player[5].LineBonus_PosY, Player[5].LineBonus_Color, Player[5].LineBonus_Alpha, Player[5].LineBonus_Text, Player[5].LineBonus_Age); end; end; end; @@ -1492,16 +1498,17 @@ end; //end Singbar Mod //PhrasenBonus - Line Bonus Mod -procedure SingDrawLineBonus( const X, Y: integer; Color: TRGB; Alpha: Single; Text: string); +procedure SingDrawLineBonus( const X, Y: Single; Color: TRGB; Alpha: Single; Text: string; Age: Integer); var Length, X2: Real; //Length of Text +Size: Integer; //Size of Popup begin if Alpha <> 0 then begin //Set Font Propertys SetFontStyle(2); //Font: Outlined1 -SetFontSize(6); +if Age < 5 then SetFontSize(Age + 1) else SetFontSize(6); SetFontItalic(False); //Check Font Size @@ -1510,56 +1517,24 @@ Length := glTextWidth ( PChar(Text)) + 3; //Little Space for a Better Look ^^ //Text SetFontPos (X + 50 - (Length / 2), Y + 12); //Position + +if Age < 5 then Size := Age * 10 else Size := 50; + //Draw Background glColor4f(Color.R, Color.G, Color.B, Alpha); //Set Color glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - //Old Method with Variable Background - {//Draw Left Side - glBindTexture(GL_TEXTURE_2D, Tex_SingLineBonusL.TexNum); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(X, Y); - glTexCoord2f(0, 1); glVertex2f(X, Y + Tex_SingLineBonusL.H * Tex_SingLineBonusL.ScaleH); - glTexCoord2f(1, 1); glVertex2f(X + Tex_SingLineBonusL.W * Tex_SingLineBonusL.scaleW, Y + Tex_SingLineBonusL.H * Tex_SingLineBonusL.scaleH); - glTexCoord2f(1, 0); glVertex2f(X + Tex_SingLineBonusL.W * Tex_SingLineBonusL.scaleW, Y); - glEnd; - //Set X of Next Tile - X2 := X + Tex_SingLineBonusL.W * Tex_SingLineBonusL.scaleW; - - //Draw Middle - glBindTexture(GL_TEXTURE_2D, Tex_SingLineBonusM.TexNum); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(X2, Y); - glTexCoord2f(0, 1); glVertex2f(X2, Y + Tex_SingLineBonusM.H * Tex_SingLineBonusM.ScaleH); - glTexCoord2f(1, 1); glVertex2f(X2 + Length, Y + Tex_SingLineBonusM.H * Tex_SingLineBonusM.scaleH); - glTexCoord2f(1, 0); glVertex2f(X2 + Length, Y); - glEnd; - - //Set X of Next Tile - X2 := X2 + Length; - - //Draw Rigth Side - glBindTexture(GL_TEXTURE_2D, Tex_SingLineBonusR.TexNum); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(X2, Y); - glTexCoord2f(0, 1); glVertex2f(X2, Y + Tex_SingLineBonusR.H * Tex_SingLineBonusR.ScaleH); - glTexCoord2f(1, 1); glVertex2f(X2 + Tex_SingLineBonusR.W * Tex_SingLineBonusR.scaleW, Y + Tex_SingLineBonusR.H * Tex_SingLineBonusR.scaleH); - glTexCoord2f(1, 0); glVertex2f(X2 + Tex_SingLineBonusR.W * Tex_SingLineBonusR.scaleW, Y); - glEnd;} //New Method, Not Variable glBindTexture(GL_TEXTURE_2D, Tex_SingLineBonusBack.TexNum); glBegin(GL_QUADS); - glTexCoord2f(1/32, 0); glVertex2f(X, Y); - glTexCoord2f(1/32, 1); glVertex2f(X, Y + 50); - glTexCoord2f(31/32, 1); glVertex2f(X + 100, Y + 50); - glTexCoord2f(31/32, 0); glVertex2f(X + 100, Y); + glTexCoord2f(1/32, 0); glVertex2f(X + 50 - Size, Y + 25 - (Size/2)); + glTexCoord2f(1/32, 1); glVertex2f(X + 50 - Size, Y + 25 + (Size/2)); + glTexCoord2f(31/32, 1); glVertex2f(X + 50 + Size, Y + 25 + (Size/2)); + glTexCoord2f(31/32, 0); glVertex2f(X + 50 + Size, Y + 25 - (Size/2)); glEnd; glColor4f(1, 1, 1, Alpha); //Set Color diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 3b6be56e..c9002a36 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -26,12 +26,13 @@ type //end Singbar Mod //PhrasenBonus - Line Bonus Mod - LineBonus_PosX: integer; - LineBonus_PosY: integer; + LineBonus_PosX: Single; + LineBonus_PosY: Single; LineBonus_Alpha: Single; LineBonus_Visible: boolean; LineBonus_Text: string; LineBonus_Color: TRGB; + LineBonus_Age: Integer; //Variable vor Positioning -> Set on ScreenShow, different when Playercount Changes LineBonus_TargetX: integer; diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index e7572ab9..6cd444a2 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1180,6 +1180,7 @@ begin Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; Player[I].LineBonus_Alpha := 0.92; Player[I].LineBonus_Visible := True; + Player[I].LineBonus_Age := 1; end; //PhrasenBonus - Line Bonus Mod End// } -- cgit v1.2.3 From e7e9d945a53b293516c4a248abb042872759ba1d Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 21 Apr 2007 17:42:22 +0000 Subject: Fixed some Bugs in Party Mode Fixed TeamScores are not Reseted Added SBGW to MenuSelectSlide3 to Fit the Menu a little bit More. Need much Work to be Perfect git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@126 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UParty.pas | 43 +++++++++++++++++++++++++++--- Game/Code/Screens/UScreenPartyNewRound.pas | 1 - 2 files changed, 40 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UParty.pas b/Game/Code/Classes/UParty.pas index e5252f82..946aca77 100644 --- a/Game/Code/Classes/UParty.pas +++ b/Game/Code/Classes/UParty.pas @@ -116,6 +116,7 @@ begin TeamMode := False; end; Teams.Teaminfo[I].Joker := Round(NumRounds*0.7); + Teams.Teaminfo[I].Score := 0; end; //Fill Plugin Array @@ -149,10 +150,46 @@ end; //---------- function TParty_Session.GetRandomPlayer(Team: Byte): Byte; var - I, J: Integer; + I, R: Integer; lowestTP: Byte; + NumPwithLTP: Byte; begin - //Get lowest TimesPlayed + LowestTP := high(Byte); + NumPwithLTP := 0; + + //Search for Players that have not often played yet + For I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do + begin + if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed < lowestTP) then + begin + lowestTP := Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed; + NumPwithLTP := 1; + end + else if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP) then + begin + Inc(NumPwithLTP); + end; + end; + + //Create Random No + R := Random(NumPwithLTP); + + //Search for Random Player + For I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do + begin + if Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP then + begin + //Player Found + if (R = 0) then + begin + Result := I; + Break; + end; + + Dec(R); + end; + end; + {//Get lowest TimesPlayed lowestTP := high(Byte); J := -1; for I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do @@ -174,7 +211,7 @@ begin Result := Random(Teams.Teaminfo[Team].NumPlayers); until (Teams.Teaminfo[Team].Playerinfo[Result].TimesPlayed = lowestTP) else //Else Select the one with lowest TP - Result:= J; + Result:= J;} end; //---------- diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index c8c0febc..b268e04f 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -177,7 +177,6 @@ var I: Integer; begin PartySession.StartRound; - Log.LogError(InttoStr(Length(DllMan.Plugins))); //Set Visibility of Round Infos I := Length(PartySession.Rounds); -- cgit v1.2.3 From a32c1026810fb137ce6bcb72a7ee654fc8931504 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 23 Apr 2007 12:47:08 +0000 Subject: Fixed: SongSorting is CaseSensitive Inspired by official Ultrastar SVN git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@127 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/USongs.pas | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 4240d135..0a319370 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -182,7 +182,7 @@ begin begin for S2 := 0 to Length(Song)-1 do for S := 1 to Length(Song)-1 do - if Song[S].Edition < Song[S-1].Edition then begin + if CompareText(Song[S].Edition, Song[S-1].Edition) < 0 then begin // zamiana miejscami TempSong := Song[S-1]; Song[S-1] := Song[S]; @@ -193,7 +193,7 @@ begin begin for S2 := 0 to Length(Song)-1 do for S := 1 to Length(Song)-1 do - if Song[S].Genre < Song[S-1].Genre then begin + if CompareText(Song[S].Genre, Song[S-1].Genre) < 0 then begin // zamiana miejscami TempSong := Song[S-1]; Song[S-1] := Song[S]; @@ -204,7 +204,7 @@ begin begin for S2 := 0 to Length(Song)-1 do for S := 1 to Length(Song)-1 do - if Song[S].Title < Song[S-1].Title then begin + if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin // zamiana miejscami TempSong := Song[S-1]; Song[S-1] := Song[S]; @@ -216,7 +216,7 @@ begin begin for S2 := 0 to Length(Song)-1 do for S := 1 to Length(Song)-1 do - if Song[S].Artist < Song[S-1].Artist then begin + if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin // zamiana miejscami TempSong := Song[S-1]; Song[S-1] := Song[S]; @@ -227,7 +227,7 @@ begin begin for S2 := 0 to Length(Song)-1 do for S := 1 to Length(Song)-1 do - if Song[S].Folder < Song[S-1].Folder then begin + if CompareText(Song[S].Folder, Song[S-1].Folder) < 0 then begin // zamiana miejscami TempSong := Song[S-1]; Song[S-1] := Song[S]; @@ -238,7 +238,7 @@ begin begin for S2 := 0 to Length(Song)-1 do for S := 1 to Length(Song)-1 do - if Song[S].Title < Song[S-1].Title then begin + if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin // zamiana miejscami TempSong := Song[S-1]; Song[S-1] := Song[S]; @@ -250,7 +250,7 @@ begin begin for S2 := 0 to Length(Song)-1 do for S := 1 to Length(Song)-1 do - if Song[S].Artist < Song[S-1].Artist then begin + if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin // zamiana miejscami TempSong := Song[S-1]; Song[S-1] := Song[S]; @@ -261,7 +261,7 @@ begin begin for S2 := 0 to Length(Song)-1 do for S := 1 to Length(Song)-1 do - if Song[S].Language < Song[S-1].Language then begin + if CompareText(Song[S].Language, Song[S-1].Language) < 0 then begin TempSong := Song[S-1]; Song[S-1] := Song[S]; Song[S] := TempSong; @@ -330,7 +330,7 @@ case Ini.Sorting of for S := Low(Songs.Song) to High(Songs.Song) do begin if (Ini.Tabs = 1) then - if (Ini.Sorting = sEdition) and (SS <> Songs.Song[S].Edition) then begin + if (Ini.Sorting = sEdition) and (CompareText(SS, Songs.Song[S].Edition) <> 0) then begin // add Category Button Inc(Order); SS := Songs.Song[S].Edition; @@ -373,7 +373,7 @@ case Ini.Sorting of CatSongs.Song[CatLen].Visible := true; end - else if (Ini.Sorting = sGenre) and (SS <> Songs.Song[S].Genre) then begin + else if (Ini.Sorting = sGenre) and (CompareText(SS, Songs.Song[S].Genre) <> 0) then begin // add Genre Button Inc(Order); SS := Songs.Song[S].Genre; @@ -399,7 +399,7 @@ case Ini.Sorting of CatSongs.Song[CatLen].Visible := true; end - else if (Ini.Sorting = sLanguage) and (SS <> Songs.Song[S].Language) then begin + else if (Ini.Sorting = sLanguage) and (CompareText(SS, Songs.Song[S].Language) <> 0) then begin // add Language Button Inc(Order); SS := Songs.Song[S].Language; @@ -425,10 +425,10 @@ case Ini.Sorting of CatSongs.Song[CatLen].Visible := true; end - else if (Ini.Sorting = sTitle) and (Length(Songs.Song[S].Title)>=1) and (Letter <> Songs.Song[S].Title[1]) then begin + else if (Ini.Sorting = sTitle) and (Length(Songs.Song[S].Title)>=1) and (Letter <> UpCase(Songs.Song[S].Title[1])) then begin // add a letter Category Button Inc(Order); - Letter := Songs.Song[S].Title[1]; + Letter := UpCase(Songs.Song[S].Title[1]); CatLen := Length(CatSongs.Song); SetLength(CatSongs.Song, CatLen+1); CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; @@ -453,10 +453,10 @@ case Ini.Sorting of CatSongs.Song[CatLen].Visible := true; end - else if (Ini.Sorting = sArtist) and (Length(Songs.Song[S].Artist)>=1) and (Letter <> Songs.Song[S].Artist[1]) then begin + else if (Ini.Sorting = sArtist) and (Length(Songs.Song[S].Artist)>=1) and (Letter <> UpCase(Songs.Song[S].Artist[1])) then begin // add a letter Category Button Inc(Order); - Letter := Songs.Song[S].Artist[1]; + Letter := UpCase(Songs.Song[S].Artist[1]); CatLen := Length(CatSongs.Song); SetLength(CatSongs.Song, CatLen+1); CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; @@ -480,7 +480,7 @@ case Ini.Sorting of CatSongs.Song[CatLen].Visible := true; end - else if (Ini.Sorting = sFolder) and (SS <> Songs.Song[S].Folder) then begin + else if (Ini.Sorting = sFolder) and (CompareText(SS, Songs.Song[S].Folder) <> 0) then begin // 0.5.0: add folder tab Inc(Order); SS := Songs.Song[S].Folder; @@ -507,7 +507,7 @@ case Ini.Sorting of end else if (Ini.Sorting = sTitle2) AND (Length(Songs.Song[S].Title)>=1) then begin - if (ord(Songs.Song[S].Title[1]) > 47) and (ord(Songs.Song[S].Title[1]) < 58) then Letter2 := '#' else Letter2 := Songs.Song[S].Title[1]; + if (ord(Songs.Song[S].Title[1]) > 47) and (ord(Songs.Song[S].Title[1]) < 58) then Letter2 := '#' else Letter2 := UpCase(Songs.Song[S].Title[1]); if (Letter <> Letter2) then begin // add a letter Category Button Inc(Order); @@ -537,7 +537,7 @@ case Ini.Sorting of end else if (Ini.Sorting = sArtist2) AND (Length(Songs.Song[S].Artist)>=1) then begin - if (ord(Songs.Song[S].Artist[1]) > 47) and (ord(Songs.Song[S].Artist[1]) < 58) then Letter2 := '#' else Letter2 := Songs.Song[S].Artist[1]; + if (ord(Songs.Song[S].Artist[1]) > 47) and (ord(Songs.Song[S].Artist[1]) < 58) then Letter2 := '#' else Letter2 := UpCase(Songs.Song[S].Artist[1]); if (Letter <> Letter2) then begin // add a letter Category Button Inc(Order); -- cgit v1.2.3 From b49192ef9d03915744a65009e25f06fafd72bd30 Mon Sep 17 00:00:00 2001 From: mogguh Date: Mon, 23 Apr 2007 21:38:08 +0000 Subject: Feature: SingBar is now moveable via theme/skin (affects UDraw.pas, UThemes.pas, UScreenSing.pas) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@128 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 100 +++++++++++++++++++++++++------------- Game/Code/Classes/UThemes.pas | 27 ++++++++++ Game/Code/Screens/UScreenSing.pas | 18 +++++++ 3 files changed, 112 insertions(+), 33 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index bd6b5db6..d18830ba 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -730,6 +730,7 @@ begin end //SingBar Mod + //modded again to make it moveable: it's working, so why try harder else if Ini.Oscilloscope = 2 then begin A := GetTickCount div 33; if A <> Tickold then begin @@ -741,37 +742,53 @@ begin end; //for end; //if if PlayersPlay = 1 then begin - SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP1SingBar.x, Theme.Sing.StaticP1SingBar.y, Theme.Sing.StaticP1SingBar.w, Theme.Sing.StaticP1SingBar.h , Player[0].ScorePercent); end; if PlayersPlay = 2 then begin - SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); - SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); + //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + //SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); end; if PlayersPlay = 3 then begin - SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); - SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); - SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); + //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + //SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); + //SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); end; if PlayersPlay = 4 then begin if ScreenAct = 1 then begin - SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); - SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); + //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + //SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); end; if ScreenAct = 2 then begin - SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); - SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[3].ScorePercent); + //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); + //SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[3].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[2].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[3].ScorePercent); end; end; if PlayersPlay = 6 then begin if ScreenAct = 1 then begin - SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); - SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); - SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); - end; + //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + //SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); + //SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); + end; if ScreenAct = 2 then begin - SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[3].ScorePercent); - SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[4].ScorePercent); - SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[5].ScorePercent); + //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[3].ScorePercent); + //SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[4].ScorePercent); + //SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[5].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[3].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[4].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[5].ScorePercent); end; end; end; @@ -1134,6 +1151,7 @@ begin end //SingBar Mod + // was fürn sinn hattn der quark hier? else if ((Ini.Oscilloscope = 2) AND (DLLMan.Selected.ShowRateBar_O)) OR (DLLMan.Selected.ShowRateBar) then begin A := GetTickCount div 33; if A <> Tickold then begin @@ -1146,52 +1164,68 @@ begin end; //if if PlayersPlay = 1 then begin if PlayerInfo.Playerinfo[0].Enabled then - SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP1SingBar.x, Theme.Sing.StaticP1SingBar.y, Theme.Sing.StaticP1SingBar.w, Theme.Sing.StaticP1SingBar.h , Player[0].ScorePercent); end; if PlayersPlay = 2 then begin if PlayerInfo.Playerinfo[0].Enabled then - SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); if PlayerInfo.Playerinfo[1].Enabled then - SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); + //SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); end; if PlayersPlay = 3 then begin if PlayerInfo.Playerinfo[0].Enabled then - SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); if PlayerInfo.Playerinfo[1].Enabled then - SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); + //SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); if PlayerInfo.Playerinfo[2].Enabled then - SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); + //SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); end; if PlayersPlay = 4 then begin if ScreenAct = 1 then begin if PlayerInfo.Playerinfo[0].Enabled then - SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); if PlayerInfo.Playerinfo[1].Enabled then - SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); + //SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); end; if ScreenAct = 2 then begin if PlayerInfo.Playerinfo[2].Enabled then - SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); + //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[2].ScorePercent); if PlayerInfo.Playerinfo[3].Enabled then - SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[3].ScorePercent); + //SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[3].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[3].ScorePercent); end; end; if PlayersPlay = 6 then begin if ScreenAct = 1 then begin if PlayerInfo.Playerinfo[0].Enabled then - SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); if PlayerInfo.Playerinfo[1].Enabled then - SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); + //SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); if PlayerInfo.Playerinfo[2].Enabled then - SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); + //SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); end; if ScreenAct = 2 then begin if PlayerInfo.Playerinfo[3].Enabled then - SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[3].ScorePercent); + //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[3].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[3].ScorePercent); if PlayerInfo.Playerinfo[4].Enabled then - SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[4].ScorePercent); + //SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[4].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[4].ScorePercent); if PlayerInfo.Playerinfo[5].Enabled then - SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[5].ScorePercent); + //SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[5].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[5].ScorePercent); end; end; end; diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 4f4ab2b9..33cf4258 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -272,6 +272,15 @@ type TextP1: TThemeText; TextP1Score: TThemeText; + //moveable singbar mod + StaticP1SingBar: TThemeStatic; + StaticP1ThreePSingBar: TThemeStatic; + StaticP1TwoPSingBar: TThemeStatic; + StaticP2RSingBar: TThemeStatic; + StaticP2MSingBar: TThemeStatic; + StaticP3SingBar: TThemeStatic; + //eoa moveable singbar + //added for ps3 skin //game in 2/4 player modi StaticP1TwoP: TThemeStatic; @@ -914,6 +923,15 @@ begin // Sing ThemeLoadBasic(Sing, 'Sing'); + //moveable singbar mod + ThemeLoadStatic(Sing.StaticP1SingBar, 'SingP1SingBar'); + ThemeLoadStatic(Sing.StaticP1TwoPSingBar, 'SingP1TwoPSingBar'); + ThemeLoadStatic(Sing.StaticP1ThreePSingBar, 'SingP1ThreePSingBar'); + ThemeLoadStatic(Sing.StaticP2RSingBar, 'SingP2RSingBar'); + ThemeLoadStatic(Sing.StaticP2MSingBar, 'SingP2MSingBar'); + ThemeLoadStatic(Sing.StaticP3SingBar, 'SingP3SingBar'); + //eoa moveable singbar + ThemeLoadStatic(Sing.StaticP1, 'SingP1Static'); ThemeLoadText(Sing.TextP1, 'SingP1Text'); ThemeLoadStatic(Sing.StaticP1ScoreBG, 'SingP1Static2'); @@ -1814,6 +1832,15 @@ begin ThemeSaveStatic(Sing.StaticP1ScoreBG, 'SingP1Static2'); ThemeSaveText(Sing.TextP1Score, 'SingP1TextScore'); + //moveable singbar mod + ThemeSaveStatic(Sing.StaticP1SingBar, 'SingP1SingBar'); + ThemeSaveStatic(Sing.StaticP1TwoPSingBar, 'SingP1TwoPSingBar'); + ThemeSaveStatic(Sing.StaticP1ThreePSingBar, 'SingP1ThreePSingBar'); + ThemeSaveStatic(Sing.StaticP2RSingBar, 'SingP2RSingBar'); + ThemeSaveStatic(Sing.StaticP2MSingBar, 'SingP2MSingBar'); + ThemeSaveStatic(Sing.StaticP3SingBar, 'SingP3SingBar'); + //eoa moveable singbar + //Added for ps3 skin //This one is shown in 2/4P mode ThemeSaveStatic(Sing.StaticP1TwoP, 'SingP1TwoPStatic'); diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 6cd444a2..01195db2 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -19,6 +19,15 @@ type TextP1: integer; TextP1Score: integer; + //moveable singbar mod + StaticP1SingBar: integer; + StaticP1ThreePSingBar: integer; + StaticP1TwoPSingBar: integer; + StaticP2RSingBar: integer; + StaticP2MSingBar: integer; + StaticP3SingBar: integer; + //eoa moveable singbar + //Added for ps3 skin //shown when game is in 2/4 player modus StaticP1TwoP: integer; @@ -170,6 +179,15 @@ begin TextP1 := AddText(Theme.Sing.TextP1); TextP1Score := AddText(Theme.Sing.TextP1Score); + //moveable singbar mod + StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar); + StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar); + StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); + StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); + StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar); + StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar); + //eoa moveable singbar + //Added for ps3 skin //This one is shown in 2/4P mode StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); -- cgit v1.2.3 From e4c8e7918cde3b197a1c26e496bd9c345b7a0fa3 Mon Sep 17 00:00:00 2001 From: b1indy Date: Tue, 24 Apr 2007 11:38:52 +0000 Subject: ScreenFading now works in dual screen mode (it should not work with resolutions higher than 1024x768 because of limited texture size, someone with a big screen should check this) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@129 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UDisplay.pas | 51 ++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 24 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index fc18025f..ad383782 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -2,7 +2,7 @@ unit UDisplay; interface -uses Windows, SDL, UMenu, OpenGL12, SysUtils, dialogs, Math; +uses Windows, SDL, UMenu, OpenGL12, SysUtils, dialogs; type TDisplay = class @@ -19,7 +19,7 @@ type myFade: integer; lastTime: Cardinal; pTexData : Pointer; - pTex : glUInt; + pTex : array[1..2] of glUInt; // end function Draw: Boolean; @@ -41,6 +41,7 @@ implementation uses UGraphic, UTime, Graphics, Jpeg, UPliki, UTexture, UIni; constructor TDisplay.Create; +var i: integer; begin inherited Create; @@ -56,10 +57,11 @@ begin // generate texture for fading between screens GetMem(pTexData, 1024*1024*3); if pTexData <> NIL then + for i:= 1 to 2 do begin - glGenTextures(1, pTex); + glGenTextures(1, pTex[i]); if glGetError <> GL_NO_ERROR then canFade := False; - glBindTexture(GL_TEXTURE_2D, pTex); + glBindTexture(GL_TEXTURE_2D, pTex[i]); if glGetError <> GL_NO_ERROR then canFade := False; glTexImage2D(GL_TEXTURE_2D, 0, 3, 1024, 1024, 0, GL_RGB, GL_UNSIGNED_BYTE, pTexData); if glGetError <> GL_NO_ERROR then canFade := False; @@ -67,12 +69,12 @@ begin if glGetError <> GL_NO_ERROR then canFade := False; glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); if glGetError <> GL_NO_ERROR then canFade := False; - FreeMem(pTexData); end else begin canFade:=False; end; + FreeMem(pTexData); if not canFade then begin showmessage('Fehler beim Initialisieren der Fading-Textur... Fading deaktiviert'); doFade:=False; @@ -94,7 +96,7 @@ var S: integer; Col: Real; // fade mod - myFade2:integer; + myFade2: Real; currentTime: Cardinal; // end begin @@ -116,7 +118,6 @@ begin ScreenX := 0; - if S = 2 then TimeSkip := 0 else; // it's easier than rewriting code glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); // ActualScreen.SetAnimationProgress(1); @@ -139,8 +140,8 @@ begin if myfade = 0 then begin ActualScreen.Draw; - glBindTexture(GL_TEXTURE_2D, pTex); - glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 1024, 1024, 0); + glBindTexture(GL_TEXTURE_2D, pTex[S]); + glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, (S-1)*ScreenW div Screens, 0, 1024, 1024, 0); if glGetError <> GL_NO_ERROR then begin canFade := False; @@ -148,14 +149,18 @@ begin end; NextScreen.onShow; lastTime:=GetTickCount; - myfade:=myfade+1; - end; + if (S=2) or (Screens = 1) then + myfade:=myfade+1; + end; // end texture creation in first fading step + + //do some time-based fading currentTime:=GetTickCount; - if currentTime > lastTime+30 then + if (currentTime > lastTime+30) and (S=1) then begin myfade:=myfade+4; lastTime:=currentTime; end; + // LastFade := Fade; // whatever // Fade := Fade -0.999; // start fading out @@ -164,22 +169,20 @@ begin // ActualScreen.SetAnimationProgress(Fade-1); // nop? - glClearColor(Col, Col, Col , 0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); NextScreen.Draw; // draw next screen // and draw old screen over it... slowly fading out - myfade2:=myfade*myfade; - glBindTexture(GL_TEXTURE_2D, pTex); - glColor4f(1, 1, 1, (1000-myfade2)/1000); // strange calculation - alpha gets negative... but looks good this way + myfade2:=(myfade*myfade)/10000; + glBindTexture(GL_TEXTURE_2D, pTex[S]); + glColor4f(1, 1, 1, (1000-myfade*myfade)/1000); // strange calculation - alpha gets negative... but looks good this way glEnable(GL_TEXTURE_2D); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glBegin(GL_QUADS); - glTexCoord2f(0,0);glVertex2f(0-myfade2, 600+myfade2); - glTexCoord2f(0,ScreenH/1024);glVertex2f(0-myfade2, 0-myfade2); - glTexCoord2f(ScreenW/1024,ScreenH/1024);glVertex2f(800+myfade2, 0-myfade2); - glTexCoord2f(ScreenW/1024,0);glVertex2f(800+myfade2, 600+myfade2); + glTexCoord2f(0+myfade2,0+myfade2);glVertex2f(0, 600); + glTexCoord2f(0+myfade2,ScreenH/1024-myfade2);glVertex2f(0, 0); + glTexCoord2f((ScreenW div Screens)/1024-myfade2,ScreenH/1024-myfade2);glVertex2f(800, 0); + glTexCoord2f((ScreenW div Screens)/1024-myfade2,0+myfade2);glVertex2f(800, 600); glEnd; glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); @@ -189,12 +192,12 @@ begin if (myfade > 40) or (not doFade) or (not canFade) then begin // fade out complete... myFade:=0; - ActualScreen.onHide; // nop... whatever + ActualScreen.onHide; ActualScreen.ShowFinish:=False; ActualScreen:=NextScreen; NextScreen := nil; - ActualScreen.onShowFinish; // one more nop... - ActualScreen.ShowFinish := true; // who wrote this crap? + ActualScreen.onShowFinish; + ActualScreen.ShowFinish := true; // end of fade mod end; end; // if -- cgit v1.2.3 From 8c3c4d3107df8a6fa9cddbc7360cd7fa36b39c95 Mon Sep 17 00:00:00 2001 From: b1indy Date: Tue, 24 Apr 2007 11:48:19 +0000 Subject: re-inserted a line that is essential for proper timing in dual screen mode git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@130 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UDisplay.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index ad383782..6144f3bd 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -117,7 +117,7 @@ begin // if (Screens = 2) and (S = 2) then ScreenX := 1; ScreenX := 0; - + if S = 2 then TimeSkip := 0 else; glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); // ActualScreen.SetAnimationProgress(1); -- cgit v1.2.3 From e79530fd2165c92a9291076b05dfb0e0236fc222 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 24 Apr 2007 12:59:54 +0000 Subject: Added ability to Select Players before Song Make Option OnSongClick Work git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@131 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenMain.pas | 19 +++++++++++++++++++ Game/Code/Screens/UScreenName.pas | 9 ++++++++- Game/Code/Screens/UScreenSong.pas | 23 +++++++++++++++++++++-- Game/Code/Screens/UScreenSongMenu.pas | 2 +- 4 files changed, 49 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 8d2d13b6..051cd101 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -147,6 +147,8 @@ begin Music.PlayStart; if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1; if (Ini.Players = 4) then PlayersPlay := 6; + + ScreenName.Goto_SingScreen := False; FadeTo(@ScreenName); end; if Interaction = 1 then begin @@ -206,6 +208,23 @@ begin TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong); Interaction := 0; + + //Some Testing for Button Fade + Button[0].SelectH := Button[0].H * 3; + Button[0].Fade := True; + Button[0].FadeText := True; + Button[0].DeSelectReflectionspacing := 280; + + Button[1].SelectH := Button[0].H * 3; + Button[1].Fade := True; + + Button[2].SelectH := Button[0].H * 3; + Button[2].Fade := True; + Button[2].FadeText := True; + + Button[3].SelectH := Button[0].H * 3; + Button[3].Fade := True; + Button[3].FadeText := True; end; procedure TScreenMain.onShow; diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index 82519e87..e8bc2dd8 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -8,6 +8,7 @@ uses type TScreenName = class(TMenu) public + Goto_SingScreen: Boolean; //If True then next Screen in SingScreen constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; @@ -49,7 +50,13 @@ begin Ini.Name[I-1] := Button[I-1].Text[0].Text; Ini.SaveNames; Music.PlayStart; - FadeTo(@ScreenLevel); + + if GoTo_SingScreen then + FadeTo(@ScreenSing) + else + FadeTo(@ScreenLevel); + + GoTo_SingScreen := False; end; // Up and Down could be done at the same time, diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 79a5abb1..5814efbf 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -83,6 +83,7 @@ type procedure StartSong; procedure OpenEditor; procedure DoJoker(Team: Byte); + procedure SelectPlayers; //Extensions procedure DrawExtensions; @@ -299,8 +300,17 @@ begin end else begin // clicked on song if (Mode = 0) then //Normal Mode -> Start Song begin - StartSong; - + //Do the Action that is specified in Ini + case Ini.OnSongClick of + 0: StartSong; + 1: SelectPlayers; + 2:begin + If (CatSongs.CatNumShow = -3) then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end; + end; end else if (Mode = 1) then //PartyMode -> Show Menu begin @@ -1615,6 +1625,15 @@ begin end; end; +procedure TScreenSong.SelectPlayers; +begin + CatSongs.Selected := Interaction; + Music.Stop; + + ScreenName.Goto_SingScreen := True; + FadeTo(@ScreenName); +end; + procedure TScreenSong.OpenEditor; begin if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 3ccba228..699e0b92 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -368,7 +368,7 @@ begin 1: //Button 2 begin //Select New Players then Sing: - + ScreenSong.SelectPlayers; Visible := False; end; -- cgit v1.2.3 From 569213582ca4147e6df5309f65d8a442da394a25 Mon Sep 17 00:00:00 2001 From: b1indy Date: Tue, 24 Apr 2007 13:02:06 +0000 Subject: changed size of texture for screen fading effect to fixed size of 512x512, need comments git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@132 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UDisplay.pas | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index 6144f3bd..ddbc0d1f 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -55,7 +55,7 @@ begin canFade:=True; // generate texture for fading between screens - GetMem(pTexData, 1024*1024*3); + GetMem(pTexData, 512*512*3); if pTexData <> NIL then for i:= 1 to 2 do begin @@ -63,7 +63,7 @@ begin if glGetError <> GL_NO_ERROR then canFade := False; glBindTexture(GL_TEXTURE_2D, pTex[i]); if glGetError <> GL_NO_ERROR then canFade := False; - glTexImage2D(GL_TEXTURE_2D, 0, 3, 1024, 1024, 0, GL_RGB, GL_UNSIGNED_BYTE, pTexData); + glTexImage2D(GL_TEXTURE_2D, 0, 3, 512, 512, 0, GL_RGB, GL_UNSIGNED_BYTE, pTexData); if glGetError <> GL_NO_ERROR then canFade := False; glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); if glGetError <> GL_NO_ERROR then canFade := False; @@ -117,7 +117,7 @@ begin // if (Screens = 2) and (S = 2) then ScreenX := 1; ScreenX := 0; - if S = 2 then TimeSkip := 0 else; + if S = 2 then TimeSkip := 0 else; glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); // ActualScreen.SetAnimationProgress(1); @@ -139,9 +139,11 @@ begin //Create Fading texture if we're just starting if myfade = 0 then begin + glViewPort((S-1) * 512, 0, 512, 512); ActualScreen.Draw; glBindTexture(GL_TEXTURE_2D, pTex[S]); - glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, (S-1)*ScreenW div Screens, 0, 1024, 1024, 0); + glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, (S-1)*512, 0, 512, 512, 0); + glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); if glGetError <> GL_NO_ERROR then begin canFade := False; @@ -180,9 +182,9 @@ begin glEnable(GL_BLEND); glBegin(GL_QUADS); glTexCoord2f(0+myfade2,0+myfade2);glVertex2f(0, 600); - glTexCoord2f(0+myfade2,ScreenH/1024-myfade2);glVertex2f(0, 0); - glTexCoord2f((ScreenW div Screens)/1024-myfade2,ScreenH/1024-myfade2);glVertex2f(800, 0); - glTexCoord2f((ScreenW div Screens)/1024-myfade2,0+myfade2);glVertex2f(800, 600); + glTexCoord2f(0+myfade2,1-myfade2);glVertex2f(0, 0); + glTexCoord2f(1-myfade2,1-myfade2);glVertex2f(800, 0); + glTexCoord2f(1-myfade2,0+myfade2);glVertex2f(800, 600); glEnd; glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); -- cgit v1.2.3 From 4ca6b721c705fb98e3dd7f952403e600ddee9238 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 24 Apr 2007 13:09:36 +0000 Subject: Fixed: Select a not Visible Button in Joker Menu, if the first Team has no Joker git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@133 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSongMenu.pas | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 699e0b92..d4ad8016 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -329,8 +329,8 @@ begin SelectsS[0].Visible := False; Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY'); - Button[1].Text[0].Text := Language.Translate('SONG_MENU_JOKER'); - Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYMODI'); + //Button[1].Text[0].Text := Language.Translate('SONG_MENU_JOKER'); + //Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYMODI'); Button[3].Text[0].Text := Language.Translate('SONG_MENU_JOKER'); end; @@ -349,6 +349,21 @@ begin Button[1].Text[0].Text := String(PartySession.Teams.Teaminfo[1].Name); Button[2].Text[0].Text := String(PartySession.Teams.Teaminfo[2].Name); Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); + + //Set right Interaction + if (not Button[0].Visible) then + begin + if (not Button[1].Visible) then + begin + if (not Button[2].Visible) then + begin + Interaction := 4; + end + else Interaction := 2; + end + else Interaction := 1; + end; + end; end; end; -- cgit v1.2.3 From 6c530e99b8a5314bb1e988a00680ba4332ac4abc Mon Sep 17 00:00:00 2001 From: b1indy Date: Tue, 24 Apr 2007 13:23:53 +0000 Subject: UTexture.pas: texture-wrap-mode changed to GL_CLAMP_TO_EDGE - solves some problems where edges of textures were drawn incorrectly UDisplay.pas: simplified generation of fade texture (a little) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@134 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 8 ++++---- Game/Code/Menu/UDisplay.pas | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 4a8fa786..0eae68a2 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -259,8 +259,8 @@ begin glGenTextures(1, ActTex); glBindTexture(GL_TEXTURE_2D, ActTex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); if Typ = 'Plain' then begin // wymiary @@ -755,8 +755,8 @@ begin glGenTextures(1, ActTex); // ActText = new texture number glBindTexture(GL_TEXTURE_2D, ActTex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexImage2D(GL_TEXTURE_2D, 0, 3, W, H, 0, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); if Mipmapping then begin diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index ddbc0d1f..9d13d2a6 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -139,10 +139,10 @@ begin //Create Fading texture if we're just starting if myfade = 0 then begin - glViewPort((S-1) * 512, 0, 512, 512); + glViewPort(0, 0, 512, 512); ActualScreen.Draw; glBindTexture(GL_TEXTURE_2D, pTex[S]); - glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, (S-1)*512, 0, 512, 512, 0); + glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 512, 512, 0); glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); if glGetError <> GL_NO_ERROR then begin -- cgit v1.2.3 From d5cbbd6e1fa5934a79f9bdd63dca5778d5d177e0 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 24 Apr 2007 15:30:25 +0000 Subject: Fixed a Bug in PartyMode that causes that Players are not chossen fair git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@136 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UParty.pas | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UParty.pas b/Game/Code/Classes/UParty.pas index 946aca77..b07ad5ad 100644 --- a/Game/Code/Classes/UParty.pas +++ b/Game/Code/Classes/UParty.pas @@ -55,7 +55,7 @@ var end; TeamMode: Boolean; Len: Integer; - I: Integer; + I, J: Integer; function GetRandomPlugin: Byte; var @@ -107,7 +107,7 @@ begin PlayersPlay := Teams.NumTeams; - //Get Teammode and Set Joker + //Get Teammode and Set Joker, also set TimesPlayed TeamMode := True; For I := 0 to Teams.NumTeams-1 do begin @@ -115,6 +115,11 @@ begin begin TeamMode := False; end; + //Set Player Attributes + For J := 0 to Teams.TeamInfo[I].NumPlayers-1 do + begin + Teams.TeamInfo[I].Playerinfo[J].TimesPlayed := 0; + end; Teams.Teaminfo[I].Joker := Round(NumRounds*0.7); Teams.Teaminfo[I].Score := 0; end; @@ -156,6 +161,7 @@ var begin LowestTP := high(Byte); NumPwithLTP := 0; + Result := 0; //Search for Players that have not often played yet For I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do @@ -323,7 +329,7 @@ begin //Increase TimesPlayed 4 all Players For I := 0 to Teams.NumTeams-1 do - Inc(Teams.Teaminfo[I].Playerinfo[Teams.Teaminfo[0].CurPlayer].TimesPlayed); + Inc(Teams.Teaminfo[I].Playerinfo[Teams.Teaminfo[I].CurPlayer].TimesPlayed); end; -- cgit v1.2.3 From 019b5bf1730eab1c5b69a0cf1f805b3aa8566b6b Mon Sep 17 00:00:00 2001 From: b1indy Date: Tue, 24 Apr 2007 19:57:28 +0000 Subject: just to test something git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@137 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UDisplay.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index 9d13d2a6..19266414 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -143,12 +143,12 @@ begin ActualScreen.Draw; glBindTexture(GL_TEXTURE_2D, pTex[S]); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 512, 512, 0); - glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); if glGetError <> GL_NO_ERROR then begin canFade := False; showmessage('Fehler beim Kopieren der Fade-Textur... Fading deaktiviert'); end; + glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); NextScreen.onShow; lastTime:=GetTickCount; if (S=2) or (Screens = 1) then -- cgit v1.2.3 From b595cf066cea127e3f890e880e67535d51ccbcf8 Mon Sep 17 00:00:00 2001 From: mota23 Date: Wed, 25 Apr 2007 18:42:25 +0000 Subject: Removed workarounds in UDraw.pas and Deluxe.ini. Altered Graphics to reflect the changes. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@138 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 136 ++++++++++++++++++++++---------------------- 1 file changed, 68 insertions(+), 68 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index d18830ba..f5722175 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -234,10 +234,10 @@ begin Rec.Bottom := Rec.Top + 2 * NotesH; glBindTexture(GL_TEXTURE_2D, Tex_Left[Color].TexNum); glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(7/8, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(7/8, 0); glVertex2f(Rec.Right, Rec.Top); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); glEnd; //We keep the postion of the top left corner b4 it's overwritten @@ -251,10 +251,10 @@ begin glBindTexture(GL_TEXTURE_2D, Tex_Mid[Color].TexNum); glBegin(GL_QUADS); - glTexCoord2f(1/32, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(1/32, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(31/32, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(31/32, 0); glVertex2f(Rec.Right, Rec.Top); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); glEnd; // prawa czesc - right part @@ -263,10 +263,10 @@ begin glBindTexture(GL_TEXTURE_2D, Tex_Right[Color].TexNum); glBegin(GL_QUADS); - glTexCoord2f(1/8, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(1/8, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); glEnd; // Golden Star Patch @@ -336,10 +336,10 @@ var glColor3f(1, 1, 1); glBindTexture(GL_TEXTURE_2D, Tex_Left[NrGracza+1].TexNum); glBegin(GL_QUADS); - glTexCoord2f(1/8, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(1/8, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(7/8, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(7/8, 0); glVertex2f(Rec.Right, Rec.Top); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); glEnd; // srodkowa czesc @@ -356,10 +356,10 @@ var // glBindTexture(GL_TEXTURE_2D, Tex_MidGray.TexNum); glBindTexture(GL_TEXTURE_2D, Tex_Mid[NrGracza+1].TexNum); glBegin(GL_QUADS); - glTexCoord2f(1/8, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(1/8, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(7/8, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(7/8, 0); glVertex2f(Rec.Right, Rec.Top); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); glEnd; glColor3f(1, 1, 1); @@ -369,10 +369,10 @@ var glBindTexture(GL_TEXTURE_2D, Tex_Right[NrGracza+1].TexNum); glBegin(GL_QUADS); - glTexCoord2f(1/8, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(1/8, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); glEnd; @@ -474,10 +474,10 @@ begin glBindTexture(GL_TEXTURE_2D, Tex_BG_Left[NrGracza+1].TexNum); glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(7/8, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(7/8, 0); glVertex2f(Rec.Right, Rec.Top); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); glEnd; @@ -487,10 +487,10 @@ begin glBindTexture(GL_TEXTURE_2D, Tex_BG_Mid[NrGracza+1].TexNum); glBegin(GL_QUADS); - glTexCoord2f(1/32, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(1/32, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(31/32, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(31/32, 0); glVertex2f(Rec.Right, Rec.Top); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); glEnd; // prawa czesc @@ -499,10 +499,10 @@ begin glBindTexture(GL_TEXTURE_2D, Tex_BG_Right[NrGracza+1].TexNum); glBegin(GL_QUADS); - glTexCoord2f(1/8, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(1/8, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); glEnd; end; // if not FreeStyle end; // with @@ -677,11 +677,11 @@ begin glBindTexture(GL_TEXTURE_2D, Tex_Lyric_Help_Bar.TexNum); glBegin(GL_QUADS); glColor4f(1, 1, 1, 0); - glTexCoord2f(1/16, 1/16); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(1/16, 15/16); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); glColor4f(1, 1, 1, 0.5); - glTexCoord2f(15/16, 15/16); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(15/16, 1/16); glVertex2f(Rec.Right, Rec.Top); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); glEnd; glDisable(GL_BLEND); @@ -1083,11 +1083,11 @@ begin glBindTexture(GL_TEXTURE_2D, Tex_Lyric_Help_Bar.TexNum); glBegin(GL_QUADS); glColor4f(1, 1, 1, 0); - glTexCoord2f(1/16, 1/16); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(1/16, 15/16); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); glColor4f(1, 1, 1, 0.5); - glTexCoord2f(15/16, 15/16); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(15/16, 1/16); glVertex2f(Rec.Right, Rec.Top); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); glEnd; glDisable(GL_BLEND); end; @@ -1468,10 +1468,10 @@ begin; glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Back.TexNum); glBegin(GL_QUADS); - glTexCoord2f(1/16, 0); glVertex2f(X, Y); - glTexCoord2f(1/16, 1); glVertex2f(X, Y+H); - glTexCoord2f(1 - 1/16, 1); glVertex2f(X+W, Y+H); - glTexCoord2f(1 - 1/16, 0); glVertex2f(X+W, Y); + glTexCoord2f(0, 0); glVertex2f(X, Y); + glTexCoord2f(0, 1); glVertex2f(X, Y+H); + glTexCoord2f(1, 1); glVertex2f(X+W, Y+H); + glTexCoord2f(1, 0); glVertex2f(X+W, Y); glEnd; //SingBar coloured Bar @@ -1510,10 +1510,10 @@ begin; glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Bar.TexNum); //Size= Player[PlayerNum].ScorePercent of W glBegin(GL_QUADS); - glTexCoord2f(1/16, 0); glVertex2f(X, Y); - glTexCoord2f(1/16, 1); glVertex2f(X, Y+H); - glTexCoord2f(1 - 1/16, 1); glVertex2f(X+(W/100 * (Percent +1)), Y+H); - glTexCoord2f(1 - 1/16, 0); glVertex2f(X+(W/100 * (Percent +1)), Y); + glTexCoord2f(0, 0); glVertex2f(X, Y); + glTexCoord2f(0, 1); glVertex2f(X, Y+H); + glTexCoord2f(1, 1); glVertex2f(X+(W/100 * (Percent +1)), Y+H); + glTexCoord2f(1, 0); glVertex2f(X+(W/100 * (Percent +1)), Y); glEnd; //SingBar Front @@ -1565,10 +1565,10 @@ if Age < 5 then Size := Age * 10 else Size := 50; glBindTexture(GL_TEXTURE_2D, Tex_SingLineBonusBack.TexNum); glBegin(GL_QUADS); - glTexCoord2f(1/32, 0); glVertex2f(X + 50 - Size, Y + 25 - (Size/2)); - glTexCoord2f(1/32, 1); glVertex2f(X + 50 - Size, Y + 25 + (Size/2)); - glTexCoord2f(31/32, 1); glVertex2f(X + 50 + Size, Y + 25 + (Size/2)); - glTexCoord2f(31/32, 0); glVertex2f(X + 50 + Size, Y + 25 - (Size/2)); + glTexCoord2f(0, 0); glVertex2f(X + 50 - Size, Y + 25 - (Size/2)); + glTexCoord2f(0, 1); glVertex2f(X + 50 - Size, Y + 25 + (Size/2)); + glTexCoord2f(1, 1); glVertex2f(X + 50 + Size, Y + 25 + (Size/2)); + glTexCoord2f(1, 0); glVertex2f(X + 50 + Size, Y + 25 - (Size/2)); glEnd; glColor4f(1, 1, 1, Alpha); //Set Color @@ -1614,10 +1614,10 @@ begin Rec.Bottom := Rec.Top + 2 * NotesH; glBindTexture(GL_TEXTURE_2D, Tex_Left[Color].TexNum); glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(7/8, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(7/8, 0); glVertex2f(Rec.Right, Rec.Top); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); glEnd; // srodkowa czesc - middle part @@ -1626,10 +1626,10 @@ begin glBindTexture(GL_TEXTURE_2D, Tex_Mid[Color].TexNum); glBegin(GL_QUADS); - glTexCoord2f(1/32, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(1/32, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(31/32, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(31/32, 0); glVertex2f(Rec.Right, Rec.Top); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); glEnd; // prawa czesc - right part @@ -1638,10 +1638,10 @@ begin glBindTexture(GL_TEXTURE_2D, Tex_Right[Color].TexNum); glBegin(GL_QUADS); - glTexCoord2f(1/8, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(1/8, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); glEnd; end; // with -- cgit v1.2.3 From 85dd8313961a9a7c519a3f4466c46f3027a67411 Mon Sep 17 00:00:00 2001 From: mota23 Date: Wed, 25 Apr 2007 19:36:07 +0000 Subject: Fixed positions for popups git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@139 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 64 +++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 01195db2..cca398a1 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -592,107 +592,107 @@ begin Case PlayersPlay of 1: begin - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[0].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[0].LineBonus_StartY := Skin_P2_NotesB - 105; end; 2: begin //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; end; 3: begin //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[0].LineBonus_TargetY := 120 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[0].LineBonus_StartY := 120 + 28; //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[1].LineBonus_TargetY := 245 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[1].LineBonus_StartY := 245 + 28; //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[2].LineBonus_TargetY := 370 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[2].LineBonus_StartY := 370 + 28; end; 4: begin //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[2].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[2].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; //P4 - Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[3].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[3].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; end; 6: begin //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[0].LineBonus_TargetY := 120 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[0].LineBonus_StartY := 120 + 28; //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[1].LineBonus_TargetY := 245 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[1].LineBonus_StartY := 245 + 28; //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[2].LineBonus_TargetY := 370 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[2].LineBonus_StartY := 370 + 28; //P4 - Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[3].LineBonus_TargetY := 120 - 65 + 28; - Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[3].LineBonus_StartY := 120 + 28; //P5 - Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[4].LineBonus_TargetY := 245 - 65 + 28; - Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[4].LineBonus_StartY := 245 + 28; //P6 - Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[5].LineBonus_TargetY := 370 - 65 + 28; - Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[5].LineBonus_StartY := 370 + 28; end; end; -- cgit v1.2.3 From e3ec6fbc344c9af26b80932d3a29fb4bf1f6c9a2 Mon Sep 17 00:00:00 2001 From: mogguh Date: Thu, 26 Apr 2007 00:11:39 +0000 Subject: Feature: Credits screen is now a screen for itself (UGraphic.pas, UScreenMain.pas, UScreenCredits.pas) Feature: Credits screen now has a tune in the background, thanks weezl <3 !! (place the mp3 into your "Sounds" path) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@141 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphic.pas | 11 +- Game/Code/Screens/UScreenCredits.pas | 223 +++++++++++++++++++++++++++++++++++ Game/Code/Screens/UScreenMain.pas | 184 +++-------------------------- Game/Code/UltraStar.dpr | 25 +--- 4 files changed, 247 insertions(+), 196 deletions(-) create mode 100644 Game/Code/Screens/UScreenCredits.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 342efe3c..df7cd411 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -8,7 +8,8 @@ uses UScreenSong, UScreenSing, UScreenScore, UScreenTop5, UScreenEditSub, UScreenEdit, UScreenEditConvert, UScreenEditHeader, UScreenOpen, UThemes, USkins, UScreenSongMenu, UScreenSongJumpto, {Party Screens} UScreenSingModi, UScreenPartyNewRound, UScreenPartyScore, UScreenPartyOptions, UScreenPartyWin, UScreenPartyPlayer, - {Stats Screens} UScreenStatMain, UScreenStatDetail; + {Stats Screens} UScreenStatMain, UScreenStatDetail, + {CreditsScreen} UScreenCredits; type TRecR = record @@ -67,7 +68,10 @@ var ScreenStatMain: TScreenStatMain; ScreenStatDetail: TScreenStatDetail; + //CreditsScreen + ScreenCredits: TScreenCredits; + //Notes Tex_Left: array[0..6] of TTexture; Tex_Mid: array[0..6] of TTexture; Tex_Right: array[0..6] of TTexture; @@ -443,6 +447,9 @@ begin Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Main', 3); Log.BenchmarkStart(3); ScreenStatDetail := TScreenStatDetail.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Detail', 3); Log.BenchmarkStart(3); -end; + ScreenCredits := TScreenCredits.Create(''); + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Credits', 3); Log.BenchmarkStart(3); + + end; end. diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas new file mode 100644 index 00000000..2e5f4abc --- /dev/null +++ b/Game/Code/Screens/UScreenCredits.pas @@ -0,0 +1,223 @@ +unit UScreenCredits; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes, ULCD, ULight; + +type + TScreenCredits = class(TMenu) + public + + Credits_Y: Real; + Credits_Time: Cardinal; + Credits_Alpha: Cardinal; + + Fadeout: boolean; + constructor Create(Back: String); override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure DrawCredits; + end; + + const Credits_Text: Array[0..52] of PChar = ( + ':SPACE:', + 'Main Idea: Corvus 5', + 'Thank you very much for this great Game', + ':SPACE:', + 'The Ultrastar Deluxe Team:', + ':SPACE:', + 'blindy:', + 'VFX Programming', + ':SPACE:', + 'commandi00:', + 'Beta Testing', + ':SPACE:', + 'Crazy Joker:', + 'Graphics', + ':SPACE:', + 'DennistheMenace:', + 'Beta Testing and great Support in "the Board"', + ':SPACE:', + 'Mog:', + 'Programming, Graphics', + ':SPACE:', + 'Mota:', + 'Programming, Idea of creating this Mod', + ':SPACE:', + 'Sawyer:', + 'Web Master, Programming', + ':SPACE:', + 'Whiteshark:', + 'Programming, Creating Release', + ':SPACE:', + ':SPACE:', + 'Thanks to', + ':SPACE:', + 'Blind Guard', + 'for supporting us and administrate this great Board', + ':SPACE:', + 'Weezl', + 'for the credits screen music', + ':SPACE:', + 'The whole Community from www.ultra-star.dl.am', + 'for supporting us, supporting the newbies', + 'and remembering us to continue work', + ':SPACE:', + 'You', + 'for using Ultrastar Deluxe', + ':SPACE:', + ':SPACE:', + 'Visit us at:', + 'http://www.ultrastardx.dl.am', + 'http://sourceforge.net/projects/ultrastardx/', + 'http://www.Ultra-Star.dl.am', + 'Please write Bug Reports and Feature Requests', + 'to help making this a better Game'); + + +implementation + +uses Dialogs,Windows, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl, ULanguage; + +function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_ESCAPE : + begin + FadeTo(@ScreenMain); + Music.PlayBack; + end; + end;//esac + end; //fi +end; + +constructor TScreenCredits.Create(Back: String); +var + I: integer; +begin + inherited Create(Back); + + AddBackground(Theme.Loading.Background.Tex); + +// for I := 0 to High(Theme.Loading.Static) do +// AddStatic(Theme.Loading.Static[I]); + +// for I := 0 to High(Theme.Loading.Text) do +// AddText(Theme.Loading.Text[I]); + + Fadeout := false; +end; + +function TScreenCredits.Draw: boolean; +begin + DrawCredits; +end; + +procedure TScreenCredits.onShow; +begin + Credits_Y := 600; + Credits_Alpha := 0; + //Music.SetLoop(true); Loop looped ned, so ne scheisse + Music.Open(soundpath + 'wome_-_echoes.mp3'); //danke kleinster liebster weeeetüüüüü!! + Music.Play; +end; + +procedure TScreenCredits.onHide; +begin + Music.Stop; +end; + +procedure TScreenCredits.DrawCredits; +var + T,I: Cardinal; + Y: Real; + Ver: PChar; +begin + T := GetTickCount div 33; + if T <> Credits_Time then + begin + Credits_Time := T; + //Change Position + Credits_Y := Credits_Y - 1; + //Change Alpha + Inc (Credits_Alpha, 3); + end; + //If lowest Position is outside the Screen-> Show MainMenu + if (Y <= 0) then + Y := 600; + //Draw BackGround + DrawBG; + + + //Draw pulsing Credits Text + //Set Font + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (10, 5); + glColor4f(1, 0, 0, 0.2 + Abs((Credits_Alpha mod 150)/100 - 0.75)); + glPrint ('You may press ESC now'); + + //Set Font Size for Credits + SetFontSize(12); + //Draw Version + if (Credits_Y>-35) then + begin + Ver := PChar(Language.Translate('US_VERSION')); + //Set Color + if Credits_Y > 500 then + glColor4f(1, 0.6, 0.08, (600 - Credits_Y)/100 - 0.2) + else + glColor4f(1, 0.6, 0.08, 0.8); + + SetFontPos (400 - glTextWidth(Ver)/2, Credits_Y); + glprint(Ver); + end; + + //Set Color + Start Pos + glColor4f(0.8, 0.8, 1, 0.8); + Y := Credits_Y + 50; + + //Search upper Position + For I := 0 to high(Credits_Text) do + begin + if (Credits_Text[I]=':SPACE:') then //Spacer + Y := Y + 55 + else + Y := Y + 30; + + if Y > -35 then + break; + end; + + //Draw Text + For T := I+1 to high(Credits_Text) do + begin + if (Credits_Text[T]=':SPACE:') then //Spacer + Y := Y + 55 + else + begin + //Set Color + if Y > 500 then + glColor4f(0.8, 0.8, 1, (600 - Y)/100 - 0.2) + else + glColor4f(0.8, 0.8, 1, 0.8); + + SetFontPos (400 - glTextWidth(Credits_Text[T])/2, Y); + glprint(Credits_Text[T]); + Y := Y + 30; + end; + + if Y > 600 then + break; + end; + +end; + +end. diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 051cd101..28c255d1 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -11,14 +11,6 @@ type TextDescription: integer; TextDescriptionLong: integer; - //Credits Mod - Credits_Visible: Boolean; - Credits_Y: Real; - Credits_Time: Cardinal; - Credits_Alpha: Cardinal; - procedure DrawCredits; - //Credits Mod End - constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; @@ -26,65 +18,12 @@ type procedure InteractPrev; override; procedure UpdateLCD; procedure SetAnimationProgress(Progress: real); override; - function Draw: boolean; override; + //function Draw: boolean; override; end; -const Credits_Text: Array[0..49] of PChar = ( - ':SPACE:', - 'Main Idea: Corvus 5', - 'Thank you very much for this great Game', - ':SPACE:', - 'The Ultrastar Deluxe Team:', - ':SPACE:', - 'blindy:', - 'VFX Programming', - ':SPACE:', - 'commandi00:', - 'Beta Testing', - ':SPACE:', - 'Crazy Joker:', - 'Graphics', - ':SPACE:', - 'DennistheMenace:', - 'Beta Testing and great Support in "the Board"', - ':SPACE:', - 'Mog:', - 'Programming, Graphics', - ':SPACE:', - 'Mota:', - 'Programming, Idea of creating this Mod', - ':SPACE:', - 'Sawyer:', - 'Web Master, Programming', - ':SPACE:', - 'Whiteshark:', - 'Programming, Creating Release', - ':SPACE:', - ':SPACE:', - 'Thanks to', - ':SPACE:', - 'Blind Guard', - 'for supporting us and administrate this great Board', - ':SPACE:', - 'The whole Community from www.ultra-star.dl.am', - 'for supporting us, supporting the newbies', - 'and remembering us to continue work', - ':SPACE:', - 'You', - 'for using Ultrastar Deluxe', - ':SPACE:', - ':SPACE:', - 'Visit us at:', - 'http://www.ultrastardx.dl.am', - 'http://sourceforge.net/projects/ultrastardx/', - 'http://www.Ultra-Star.dl.am', - 'Please write Bug Reports and Feature Requests', - 'to help making this a better Game'); - - implementation -uses Windows, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl, ULanguage, UParty, UDLLManager; +uses Windows, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl, ULanguage, UParty, UDLLManager, UScreenCredits; function TScreenMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; @@ -98,11 +37,11 @@ begin + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); //Deactivate Credits when Key is pressed - if Credits_Visible then - begin - Credits_Visible := False; - exit; - end; +// if Credits_Visible then +// begin +// Credits_Visible := False; +// exit; +// end; If (PressedDown) Then begin // Key Down @@ -121,9 +60,11 @@ begin begin if (SDL_ModState = KMOD_LALT) then begin - Credits_Y := 600; - Credits_Alpha := 0; - Credits_Visible := True; + //Credits_Y := 600; + //Credits_Alpha := 0; + //Credits_Visible := True; + Music.PlayStart; + FadeTo(@ScreenCredits); end; end; SDLK_M: @@ -210,7 +151,7 @@ begin Interaction := 0; //Some Testing for Button Fade - Button[0].SelectH := Button[0].H * 3; +{ Button[0].SelectH := Button[0].H * 3; Button[0].Fade := True; Button[0].FadeText := True; Button[0].DeSelectReflectionspacing := 280; @@ -225,6 +166,7 @@ begin Button[3].SelectH := Button[0].H * 3; Button[3].Fade := True; Button[3].FadeText := True; +} end; procedure TScreenMain.onShow; @@ -266,102 +208,4 @@ begin Static[0].Texture.ScaleW := Progress; Static[0].Texture.ScaleH := Progress; end; - -function TScreenMain.Draw: boolean; -begin -Result := True; -if Credits_Visible then - DrawCredits -else - Result := inherited Draw; -end; - -procedure TScreenMain.DrawCredits; -var - T, I: Cardinal; - Y: Real; - Ver: PChar; -begin - T := GetTickCount div 33; - if T <> Credits_Time then - begin - Credits_Time := T; - //Change Position - Credits_Y := Credits_Y - 1; - //Change Alpha - Inc (Credits_Alpha, 3); - end; - - //Draw BackGround - DrawBG; - - - //Draw pulsing Credits Text - //Set Font - SetFontStyle (2); - SetFontItalic(False); - SetFontSize(9); - SetFontPos (10, 5); - glColor4f(1, 0, 0, 0.2 + Abs((Credits_Alpha mod 150)/100 - 0.75)); - glPrint ('Credits! Press any Key to Continue'); - - //Set Font Size for Credits - SetFontSize(12); - //Draw Version - if (Credits_Y>-35) then - begin - Ver := PChar(Language.Translate('US_VERSION')); - //Set Color - if Credits_Y > 500 then - glColor4f(1, 0.6, 0.08, (600 - Credits_Y)/100 - 0.2) - else - glColor4f(1, 0.6, 0.08, 0.8); - - SetFontPos (400 - glTextWidth(Ver)/2, Credits_Y); - glprint(Ver); - end; - - //Set Color + Start Pos - glColor4f(0.8, 0.8, 1, 0.8); - Y := Credits_Y + 50; - - //Search upper Position - For I := 0 to high(Credits_Text) do - begin - if (Credits_Text[I]=':SPACE:') then //Spacer - Y := Y + 55 - else - Y := Y + 30; - - if Y > -35 then - break; - end; - - //Draw Text - For T := I+1 to high(Credits_Text) do - begin - if (Credits_Text[T]=':SPACE:') then //Spacer - Y := Y + 55 - else - begin - //Set Color - if Y > 500 then - glColor4f(0.8, 0.8, 1, (600 - Y)/100 - 0.2) - else - glColor4f(0.8, 0.8, 1, 0.8); - - SetFontPos (400 - glTextWidth(Credits_Text[T])/2, Y); - glprint(Credits_Text[T]); - Y := Y + 30; - end; - - if Y > 600 then - break; - end; - - //If lowest Position is outside the Screen-> Show MainMenu - if (Y <= 0) then - Credits_Visible := False; -end; - end. diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index d5418e04..0db37635 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -6,9 +6,6 @@ program UltraStar; {$R 'UltraStar.res' 'UltraStar.rc'} uses - //------------------------------ - //Includes - Menu System - //------------------------------ UDisplay in 'Menu\UDisplay.pas', UMenu in 'Menu\UMenu.pas', UMenuStatic in 'Menu\UMenuStatic.pas', @@ -18,10 +15,6 @@ uses UMenuSelect in 'Menu\UMenuSelect.pas', UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', UDrawTexture in 'Menu\UDrawTexture.pas', - - //------------------------------ - //Includes - Classes - //------------------------------ UGraphic in 'Classes\UGraphic.pas', UTexture in 'Classes\UTexture.pas', UMusic in 'Classes\UMusic.pas', @@ -50,10 +43,6 @@ uses UDLLManager in 'Classes\UDLLManager.pas', UParty in 'Classes\UParty.pas', UPlaylist in 'Classes\UPlaylist.pas', - - //------------------------------ - //Includes - Screens - //------------------------------ UScreenLoading in 'Screens\UScreenLoading.pas', UScreenWelcome in 'Screens\UScreenWelcome.pas', UScreenMain in 'Screens\UScreenMain.pas', @@ -80,30 +69,18 @@ uses UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', UScreenStatMain in 'Screens\UScreenStatMain.pas', UScreenStatDetail in 'Screens\UScreenStatDetail.pas', - - //------------------------------ - //Includes - Screens PartyMode - //------------------------------ UScreenSingModi in 'Screens\UScreenSingModi.pas', UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', UScreenPartyScore in 'Screens\UScreenPartyScore.pas', UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', UScreenPartyWin in 'Screens\UScreenPartyWin.pas', - - //------------------------------ - //Includes - Modi SDK - //------------------------------ ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', - - //------------------------------ - //Includes - Delphi - //------------------------------ + UScreenCredits in 'Screens\UScreenCredits.pas', Windows, SDL, SysUtils; - const Version = 'UltraStar Deluxe V 0.96 Beta'; -- cgit v1.2.3 From b2518890d0dd62eeb96ee8b4b5f2d86e61ca75e7 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 26 Apr 2007 19:42:55 +0000 Subject: Added PS3 like ButtonFade ability Some new ThemeButton Attributes: DeSelectReflectionSpacing: ReflectionSpacing when Button is not Selected Fade: Enable Stepings in Fading FadeText: Fade Texts with Button SelectW, SelectH: Width and Height when Button is Selected FadeTex: Texture used when Button Fades to not stretch the Texture. Not nessecary. FadeTexPos: Position of FadeTex git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@143 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 24 ++++ Game/Code/Menu/UMenu.pas | 26 ++-- Game/Code/Menu/UMenuButton.pas | 266 ++++++++++++++++++++++++++++++++++++-- Game/Code/Screens/UScreenMain.pas | 20 +-- 4 files changed, 295 insertions(+), 41 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 33cf4258..90bab7c1 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -134,6 +134,14 @@ type //Reflection Mod Reflection: boolean; Reflectionspacing: Real; + //Fade Mod + SelectH: integer; + SelectW: integer; + Fade: boolean; + FadeText: boolean; + DeSelectReflectionspacing : Real; + FadeTex: string; + FadeTexPos: integer; end; TThemeSelect = record @@ -1454,6 +1462,22 @@ begin ThemeButton.DColB := Color[C].RGB.B; end; + //Fade Mod + ThemeButton.SelectH := ThemeIni.ReadInteger (Name, 'SelectH', ThemeButton.H); + ThemeButton.SelectW := ThemeIni.ReadInteger (Name, 'SelectW', ThemeButton.W); + + ThemeButton.DeSelectReflectionspacing := ThemeIni.ReadFloat(Name, 'DeSelectReflectionSpacing', ThemeButton.Reflectionspacing); + + ThemeButton.Fade := (ThemeIni.ReadInteger(Name, 'Fade', 0) = 1); + ThemeButton.FadeText := (ThemeIni.ReadInteger(Name, 'FadeText', 0) = 1); + + + ThemeButton.FadeTex := ThemeIni.ReadString(Name, 'FadeTex', ''); + ThemeButton.FadeTexPos:= ThemeIni.ReadInteger(Name, 'FadeTexPos', 0); + if (ThemeButton.FadeTexPos > 4) Or (ThemeButton.FadeTexPos < 0) then + ThemeButton.FadeTexPos := 0; + + //Read ButtonTexts TLen := ThemeIni.ReadInteger(Name, 'Texts', 0); SetLength(ThemeButton.Text, TLen); for T := 1 to TLen do diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 1c4418c1..28ba17e7 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -65,7 +65,7 @@ type function AddButton(ThemeButton: TThemeButton): integer; overload; function AddButton(X, Y, W, H: real; Name: String): integer; overload; function AddButton(X, Y, W, H: real; Name, Format, Typ: String; Reflection: Boolean): integer; overload; - function AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean; ReflectionSpacing: Real): integer; overload; + function AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean; ReflectionSpacing, DeSelectReflectionSpacing: Real): integer; overload; procedure ClearButtons; procedure AddButtonText(AddX, AddY: real; AddText: string); overload; procedure AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; AddText: string); overload; @@ -394,10 +394,19 @@ begin Result := AddButton(ThemeButton.X, ThemeButton.Y, ThemeButton.W, ThemeButton.H, ThemeButton.ColR, ThemeButton.ColG, ThemeButton.ColB, ThemeButton.Int, ThemeButton.DColR, ThemeButton.DColG, ThemeButton.DColB, ThemeButton.DInt, - Skin.GetTextureFileName(ThemeButton.Tex), 'JPG', ThemeButton.Typ, ThemeButton.Reflection, ThemeButton.Reflectionspacing); + Skin.GetTextureFileName(ThemeButton.Tex), 'JPG', ThemeButton.Typ, ThemeButton.Reflection, ThemeButton.Reflectionspacing, ThemeButton.DeSelectReflectionspacing); Button[Result].Z := ThemeButton.Z; + //Some Things from ButtonFading + Button[Result].SelectH := ThemeButton.SelectH; + Button[Result].SelectW := ThemeButton.SelectW; + + Button[Result].Fade := ThemeButton.Fade; + Button[Result].FadeText := ThemeButton.FadeText; + Button[Result].FadeTex := Texture.GetTexture(Skin.GetTextureFileName(ThemeButton.FadeTex), ThemeButton.Typ, true); + Button[Result].FadeTexPos := ThemeButton.FadeTexPos; + BTLen := Length(ThemeButton.Text); for BT := 0 to BTLen-1 do begin @@ -415,10 +424,10 @@ end; function TMenu.AddButton(X, Y, W, H: real; Name, Format, Typ: String; Reflection: Boolean): integer; begin - Result := AddButton(X, Y, W, H, 1, 1, 1, 1, 1, 1, 1, 0.5, Name, 'JPG', 'Plain', Reflection, 15); + Result := AddButton(X, Y, W, H, 1, 1, 1, 1, 1, 1, 1, 0.5, Name, 'JPG', 'Plain', Reflection, 15, 15); end; -function TMenu.AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean; ReflectionSpacing: Real): integer; +function TMenu.AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean; ReflectionSpacing, DeSelectReflectionSpacing: Real): integer; begin // adds button //SetLength is used to reduce Memory usement @@ -442,10 +451,10 @@ begin // Button[Result] := TButton.Create(Texture.GetTexture(Name, Typ, false)); // don't use cache texture} // configures button - Button[Result].Texture.X := X; - Button[Result].Texture.Y := Y; - Button[Result].Texture.W := W; - Button[Result].Texture.H := H; + Button[Result].X := X; + Button[Result].Y := Y; + Button[Result].W := W; + Button[Result].H := H; Button[Result].SelectColR := ColR; Button[Result].SelectColG := ColG; Button[Result].SelectColB := ColB; @@ -462,6 +471,7 @@ begin Button[Result].Reflection := Reflection; Button[Result].Reflectionspacing := ReflectionSpacing; + Button[Result].DeSelectReflectionspacing := DeSelectReflectionSpacing; // adds interaction AddInteraction(iButton, Result); diff --git a/Game/Code/Menu/UMenuButton.pas b/Game/Code/Menu/UMenuButton.pas index 3a871c5f..34d45083 100644 --- a/Game/Code/Menu/UMenuButton.pas +++ b/Game/Code/Menu/UMenuButton.pas @@ -7,11 +7,23 @@ type TButton = class private SelectBool: Boolean; + + FadeProgress: Real; + FadeLastTick: Cardinal; + + DeSelectW: Real; + DeSelectH: Real; + PosX: Real; + PosY: Real; + constructor Create(); overload; public Text: Array of TText; Texture: TTexture; // Button Screen position and size Texture2: TTexture; // second texture only used for fading full resolution covers + + FadeTex: TTexture; //Texture for beautiful fading + FadeTexPos: byte; //Pos of the FadeTexture (0: Top, 1: Left, 2: Bottom, 3: Right) // Texture2Blend: real; // blending factor for second texture (0=invisible, 1=visible) // now uses alpha @@ -20,7 +32,12 @@ type //Reflection Mod Reflection: boolean; Reflectionspacing: Real; - + DeSelectReflectionspacing: Real; + + //Fade Mod + Fade: Boolean; + FadeText: Boolean; + Selectable: boolean; SelectColR: real; @@ -28,6 +45,9 @@ type SelectColB: real; SelectInt: real; SelectTInt: real; + //Fade Mod + SelectW: real; + SelectH: real; DeselectColR: real; DeselectColG: real; @@ -36,12 +56,16 @@ type DeselectTInt: real; procedure SetY(Value: real); + procedure SetX(Value: real); + procedure SetW(Value: real); + procedure SetH(Value: real); + procedure SetSelect(Value: Boolean); - property X: real read Texture.x write Texture.x; - property Y: real read Texture.y write SetY; + property X: real read PosX write SetX; + property Y: real read PosY write SetY; property Z: real read Texture.z write Texture.z; - property W: real read Texture.w write Texture.w; - property H: real read Texture.h write Texture.h; + property W: real read DeSelectW write SetW; + property H: real read DeSelectH write SetH; property Selected: Boolean read SelectBool write SetSelect; procedure Draw; @@ -51,24 +75,76 @@ type end; implementation -uses UDrawTexture, SysUtils; +uses UDrawTexture, SysUtils, windows; + +procedure TButton.SetX(Value: real); +var + dx: real; + T: integer; // text +begin + {dY := Value - Texture.y; + + Texture.X := Value; + + for T := 0 to High(Text) do + Text[T].X := Text[T].X + dY;} + + PosX := Value; + if (FadeTex.TexNum = -1) then + Texture.X := Value; + +end; procedure TButton.SetY(Value: real); var dY: real; T: integer; // text begin - dY := Value - Texture.y; + {dY := Value - PosY; - Texture.y := Value; for T := 0 to High(Text) do - Text[T].Y := Text[T].Y + dY; + Text[T].Y := Text[T].Y + dY;} + + PosY := Value; + if (FadeTex.TexNum = -1) then + Texture.y := Value; +end; + +procedure TButton.SetW(Value: real); +begin + if SelectW = DeSelectW then + SelectW := Value; + + DeSelectW := Value; + + if Not Fade then + begin + if SelectBool then + Texture.W := SelectW + else + Texture.W := DeSelectW; + end; +end; +procedure TButton.SetH(Value: real); +begin + if SelectH = DeSelectH then + SelectH := Value; + + DeSelectH := Value; + + if Not Fade then + begin + if SelectBool then + Texture.H := SelectH + else + Texture.H := DeSelectH; + end; end; procedure TButton.SetSelect(Value : Boolean); -var +var T: integer; begin SelectBool := Value; @@ -85,6 +161,18 @@ begin for T := 0 to High(Text) do Text[T].Int := SelectTInt; + + //Fade Mod + if Fade then + begin + if (FadeProgress <= 0) then + FadeProgress := 0.125; + end + else + begin + Texture.W := SelectW; + Texture.H := SelectH; + end; end else begin Texture.ColR := DeselectColR; Texture.ColG := DeselectColG; @@ -98,6 +186,18 @@ begin for T := 0 to High(Text) do Text[T].Int := DeselectTInt; + + //Fade Mod + if Fade then + begin + if (FadeProgress >= 1) then + FadeProgress := 0.875; + end + else + begin + Texture.W := DeSelectW; + Texture.H := DeSelectH; + end; end; end; @@ -140,7 +240,16 @@ begin DeselectInt := 0.5; DeselectTInt := 1; + FadeTex.TexNum := -1; + FadeProgress := 0; + Fade := False; + FadeText := False; + SelectW := DeSelectW; + SelectH := DeSelectH; + + PosX := 0; + PosY := 0; end; // ***** Public methods ****** // @@ -148,10 +257,130 @@ end; procedure TButton.Draw; var T: integer; + Tick: Cardinal; + Spacing: Real; begin if Visible then begin + //Fade Mod + if Fade then + begin + if (FadeProgress < 1) and (FadeProgress > 0) then + begin + Tick := GetTickCount div 16; + if (Tick <> FadeLastTick) then + begin + FadeLastTick := Tick; + if SelectBool then + FadeProgress := FadeProgress + 0.125 + else + FadeProgress := FadeProgress - 0.125; + + if (FadeText) then + begin + For T := 0 to high(Text) do + begin + Text[T].MoveX := (SelectW - DeSelectW) * FadeProgress; + Text[T].MoveY := (SelectH - DeSelectH) * FadeProgress; + end; + end; + end; + end; + //Method without Fade Texture + if (FadeTex.TexNum = -1) then + begin + Texture.W := DeSelectW + (SelectW - DeSelectW) * FadeProgress; + Texture.H := DeSelectH + (SelectH - DeSelectH) * FadeProgress; + end + else //method with Fade Texture + begin + Texture.W := DeSelectW; + Texture.H := DeSelectH; + + FadeTex.ColR := Texture.ColR; + FadeTex.ColG := Texture.ColG; + FadeTex.ColB := Texture.ColB; + FadeTex.Int := Texture.Int; + + FadeTex.Z := Texture.Z; + + FadeTex.Alpha := Texture.Alpha; + FadeTex.TexX1 := 0; + FadeTex.TexX2 := 1; + FadeTex.TexY1 := 0; + FadeTex.TexY2 := 1; + + Case FadeTexPos of + 0: //FadeTex on Top + begin + //Standard Texture + Texture.X := PosX; + Texture.Y := PosY + (SelectH - DeSelectH) * FadeProgress; + //Fade Tex + FadeTex.X := PosX; + FadeTex.Y := PosY; + FadeTex.W := Texture.W; + FadeTex.H := (SelectH - DeSelectH) * FadeProgress; + FadeTex.ScaleW := Texture.ScaleW; + //Some Hack that Fixes a little Space between both Textures + FadeTex.TexY2 := 0.9; + end; + 1: //FadeTex on Left + begin + //Standard Texture + Texture.X := PosX + (SelectW - DeSelectW) * FadeProgress; + Texture.Y := PosY; + //Fade Tex + FadeTex.X := PosX; + FadeTex.Y := PosY; + FadeTex.H := Texture.H; + FadeTex.W := (SelectW - DeSelectW) * FadeProgress; + FadeTex.ScaleH := Texture.ScaleH; + //Some Hack that Fixes a little Space between both Textures + FadeTex.TexX2 := 0.9; + end; + 2: //FadeTex on Bottom + begin + //Standard Texture + Texture.X := PosX; + Texture.Y := PosY; + //Fade Tex + FadeTex.X := PosX; + FadeTex.Y := PosY + (SelectH - DeSelectH) * FadeProgress;; + FadeTex.W := Texture.W; + FadeTex.H := (SelectH - DeSelectH) * FadeProgress; + FadeTex.ScaleW := Texture.ScaleW; + //Some Hack that Fixes a little Space between both Textures + FadeTex.TexY1 := 0.1; + end; + 3: //FadeTex on Right + begin + //Standard Texture + Texture.X := PosX; + Texture.Y := PosY; + //Fade Tex + FadeTex.X := PosX + (SelectW - DeSelectW) * FadeProgress; + FadeTex.Y := PosY; + FadeTex.H := Texture.H; + FadeTex.W := (SelectW - DeSelectW) * FadeProgress; + FadeTex.ScaleH := Texture.ScaleH; + //Some Hack that Fixes a little Space between both Textures + FadeTex.TexX1 := 0.1; + end; + end; + end; + end + else if (FadeText) then + begin + Text[T].MoveX := (SelectW - DeSelectW); + Text[T].MoveY := (SelectH - DeSelectH); + end; + DrawTexture(Texture); + //Draw FadeTex + if (FadeTex.TexNum <> -1) then + DrawTexture(FadeTex); + if Texture2.Alpha > 0 then begin Texture2.ScaleW := Texture.ScaleW; Texture2.ScaleH := Texture.ScaleH; @@ -174,6 +403,15 @@ begin //Reflection Mod if (Reflection) then // Draw Reflections begin + if (FadeProgress <> 0) AND (FadeProgress <> 1) then + begin + Spacing := DeSelectReflectionspacing - (DeSelectReflectionspacing - Reflectionspacing) * FadeProgress; + end + else if SelectBool then + Spacing := Reflectionspacing + else + Spacing := DeSelectReflectionspacing; + with Texture do begin //Bind Tex and GL Attributes @@ -191,23 +429,23 @@ begin glBegin(GL_QUADS);//Top Left glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); glTexCoord2f(TexX1*TexW, TexY2*TexH); - glVertex3f(x, y+h*scaleH+ Reflectionspacing, z); + glVertex3f(x, y+h*scaleH+ Spacing, z); //Bottom Left glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); glTexCoord2f(TexX1*TexW, {TexY1*TexH*}0.5); - glVertex3f(x, y+h*scaleH + h*scaleH/2 + Reflectionspacing, z); + glVertex3f(x, y+h*scaleH + h*scaleH/2 + Spacing, z); //Bottom Right glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); glTexCoord2f(TexX2*TexW, {TexY1*TexH*}0.5); - glVertex3f(x+w*scaleW, y+h*scaleH + h*scaleH/2 + Reflectionspacing, z); + glVertex3f(x+w*scaleW, y+h*scaleH + h*scaleH/2 + Spacing, z); //Top Right glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); glTexCoord2f(TexX2*TexW, TexY2*TexH); - glVertex3f(x+w*scaleW, y+h*scaleH + Reflectionspacing, z); + glVertex3f(x+w*scaleW, y+h*scaleH + Spacing, z); glEnd; glDisable(GL_TEXTURE_2D); diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 28c255d1..4c822640 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -23,7 +23,7 @@ type implementation -uses Windows, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl, ULanguage, UParty, UDLLManager, UScreenCredits; +uses Windows, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl, ULanguage, UParty, UDLLManager, UScreenCredits, USkins; function TScreenMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; @@ -149,24 +149,6 @@ begin TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong); Interaction := 0; - - //Some Testing for Button Fade -{ Button[0].SelectH := Button[0].H * 3; - Button[0].Fade := True; - Button[0].FadeText := True; - Button[0].DeSelectReflectionspacing := 280; - - Button[1].SelectH := Button[0].H * 3; - Button[1].Fade := True; - - Button[2].SelectH := Button[0].H * 3; - Button[2].Fade := True; - Button[2].FadeText := True; - - Button[3].SelectH := Button[0].H * 3; - Button[3].Fade := True; - Button[3].FadeText := True; -} end; procedure TScreenMain.onShow; -- cgit v1.2.3 From 3d1f2a49bbffd8568916a41a131213198f408bef Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 27 Apr 2007 20:02:41 +0000 Subject: PageBreak Code Rewritten Now there is more structur in Code Also some Bugs are fixed that appears when \n Tags and Textwidth is used in one Text. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@145 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UMenuText.pas | 283 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 233 insertions(+), 50 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas index 65034f1d..adf58840 100644 --- a/Game/Code/Menu/UMenuText.pas +++ b/Game/Code/Menu/UMenuText.pas @@ -15,6 +15,8 @@ type public X: real; Y: real; + MoveX: real; //Some Modifier for X - Position that don't Affect the Real Y + MoveY: real; //Some Modifier for Y - Position that don't Affect the Real Y W: real; // if text is wider than W then it is breaked // H: real; Size: real; @@ -54,66 +56,139 @@ end; procedure TText.SetText(Value: String); var - I: Integer; - L: Integer; - LastPos: Integer; - LastBreak: Integer; + NextPos: Cardinal; //NextPos of a Space etc. + LastPos: Cardinal; //LastPos " + LastBreak: Cardinal; //Last Break + isBreak: Boolean; //True if the Break is not Caused because the Text is out of the area + FirstWord: Word; //Is First Word after Break? + Len: Word; //Length of the Tiles Array + Function Smallest(const A, B: Cardinal):Cardinal; + begin + if (A < B) then + Result := A + else + Result := B; + end; + + Function GetNextPos: Boolean; + var + T1, T2, T3: Cardinal; + begin + LastPos := NextPos; + + //Next Space (If Width is given) + if (W > 0) then + T1 := PosEx(' ', Value, LastPos + 1) + else T1 := Length(Value); + + {//Next - + T2 := PosEx('-', Value, LastPos + 1);} + + //Next Break + T3 := PosEx('\n', Value, LastPos + 1); + + if T1 = 0 then + T1 := Length(Value); + {if T2 = 0 then + T2 := Length(Value); } + if T3 = 0 then + T3 := Length(Value); + + //Get Nearest Pos + NextPos := Smallest(T1, T3{Smallest(T2, T3)}); + + if (LastPos = Length(Value)) then + NextPos := 0; + + isBreak := (NextPos = T3) AND (NextPos <> Length(Value)); + Result := (NextPos <> 0); + end; + procedure AddBreak(const From, bTo: Cardinal); + begin + if (isBreak) OR (bTo - From > 1) then + begin + Inc(Len); + SetLength (TextTiles, Len); + TextTiles[Len-1] := Trim(Copy(Value, From, bTo - From)); + + if isBreak then + LastBreak := bTo + 2 + else + LastBreak := bTo + 1; + FirstWord := 0; + end; + end; begin + //Set TExtstring TextString := Value; - //Create Page Breaks if width is given + //Create Tiles + //Reset Text Array + SetLength (TextTiles, 0); + Len := 0; + + //Reset Counter Vars + LastPos := 1; + NextPos := 1; + LastBreak := 1; + FirstWord := 1; + if (W > 0) then begin //Set Font Propertys SetFontStyle(Style); SetFontSize(Size); + end; - //Create New TextTiles Array - SetLength (TextTiles, 0); - L := 0; - LastPos := 1; - LastBreak := 0; - I := Pos (' ', Value); - While (I <> 0) do - begin - if (glTextWidth(PChar(Copy (Value,LastBreak + 1,I - LastBreak))) > W) AND (LastPos <> 1) then + //go Through Text + While (GetNextPos) do + begin + //Break in Text + if isBreak then begin - //new Break - SetLength (TextTiles, L+1); - TextTiles[L] := Copy (Value, LastBreak + 1, LastPos - LastBreak); - - Inc(L); - LastBreak := LastPos; - end; - - LastPos := I; - I := PosEx (' ', Value, I+1); - end; + //Look for Break before the Break + if (glTextWidth(PChar(Copy(Value, LastBreak, NextPos - LastBreak + 1))) > W) AND (NextPos-LastPos > 1) then + begin + //Not the First word after Break, so we don't have to break within a word + if (FirstWord > 1) then + begin + //Add Break before actual Position, because there the Text fits the Area + AddBreak(LastBreak, LastPos); + end + else //First Word after Break Break within the Word + begin + //ToDo + //AddBreak(LastBreak, LastBreak + 155); + end; + end; - //Last Break - if (glTextWidth(PChar(Copy (Value,LastBreak + 1,Length(Value) - LastBreak))) > W) AND (LastPos <> 1) then + //Add Break from Text + AddBreak(LastBreak, NextPos); + end + //Text comes out of the Text Area -> CreateBreak + else if (glTextWidth(PChar(Copy(Value, LastBreak, NextPos - LastBreak + 1))) > W) then begin - //new Break - SetLength (TextTiles, L+1); - TextTiles[L] := Copy (Value, LastBreak + 1, LastPos - LastBreak); - - Inc(L); - LastBreak := LastPos; + //Not the First word after Break, so we don't have to break within a word + if (FirstWord > 1) then + begin + //Add Break before actual Position, because there the Text fits the Area + AddBreak(LastBreak, LastPos); + end + else //First Word after Break -> Break within the Word + begin + //ToDo + //AddBreak(LastBreak, LastBreak + 155); + end; end; - - //last Part - SetLength (TextTiles, L+1); - TextTiles[L] := Copy (Value, LastBreak + 1, Length(Value) - LastBreak); - - end - else - begin - SetLength (TextTiles, 1); - TextTiles[0] := Value; + //end; + Inc(FirstWord) end; + //Add Ending + AddBreak(LastBreak, Length(Value)+1); + - I := 0; + {I := 0; // \n Hack While (I <= High(TextTiles)) do begin @@ -135,12 +210,120 @@ begin //Delete Text that now is in new Tile from cur. Tile Delete(TextTiles[I], LastPos, Length(TextTiles[I]) - LastPos + 1); TextTiles[I] := Trim (TextTiles[I]); - + //Goto next Tile because cur. Tile can not have another /n Tag - Inc(I) + Inc(I) end; end; + //Create Page Breaks if width is given and the Text overlapps the width + if (W > 0) then + begin + //Set Font Propertys + SetFontStyle(Style); + SetFontSize(Size); + + {//Create New TextTiles Array + SetLength (TextTiles, 0);}{ + I := 0; + + //Go Through all Tiles + While (I <= High(TextTiles)) do + begin + LastPos := 0; + CurPos := Pos (' ', TextTiles[I]); + + //Go through all Spaces + While (CurPos <> 0) do + begin + //Text is too long for given Width and not the First Word(That means that the Given Word don't Fit the given Width + if (glTextWidth(PChar(Copy (TextTiles[I],1,CurPos-1))) > W) AND (LastPos <> 1) then + begin + //Add a new Tile and move all Tiles behind actual Tile to the right + L := Length(TextTiles); + SetLength(TextTiles, L+1); + For L := L-1 downto I + 1 do + begin + TextTiles[L+1] := TextTiles[L]; + end; + + //Write Text to new Tile + TextTiles[I+1] := Trim(Copy(TextTiles[I], LastPos + 1, Length(TextTiles[I]) - LastPos)); + //Delete Text that now is in new Tile from cur. Tile + Delete(TextTiles[I], LastPos, Length(TextTiles[I]) - LastPos + 1); + TextTiles[I] := Trim (TextTiles[I]); + + //Goto next Tile because cur. Tile can not have another Space + Inc(I) + end; + //Set LastPos and Cur Pos + LastPos := CurPos; + CurPos := PosEx (' ', TextTiles[I], LastPos+1); + end; + + //Look for PageBreak in Last Part of the Tile + CurPos := Length(TextTiles[I]); + if (glTextWidth(PChar(Copy (TextTiles[I],1,CurPos))) > W) AND (LastPos <> 1) then + begin + //Add a new Tile and move all Tiles behind actual Tile to the right + L := Length(TextTiles); + SetLength(TextTiles, L+1); + For L := L-1 downto I + 1 do + begin + TextTiles[L+1] := TextTiles[L]; + end; + + //Write Text to new Tile + TextTiles[I+1] := Trim(Copy(TextTiles[I], LastPos + 1, CurPos - LastPos)); + //Delete Text from cur. Tile that now is in new Tile + Delete(TextTiles[I], LastPos, CurPos - LastPos + 1); + TextTiles[I] := Trim (TextTiles[I]); + //Goto next Tile because cur. Tile can not have another Space + Inc(I) + end; + + //Inc I if Current Tile has no more Spaces + Inc(I) + end; + + I := high(TextTiles); + + {LastPos := 1; + LastBreak := 0; + I := Pos (' ', Value); + While (I <> 0) do + begin + if (glTextWidth(PChar(Copy (Value,LastBreak + 1,I - LastBreak))) > W) AND (LastPos <> 1) then + begin + //new Break + SetLength (TextTiles, L+1); + TextTiles[L] := Copy (Value, LastBreak + 1, LastPos - LastBreak); + + Inc(L); + LastBreak := LastPos; + end; + + LastPos := I; + I := PosEx (' ', Value, I+1); + end; + + //Last Break + if (glTextWidth(PChar(Copy (Value,LastBreak + 1,Length(Value) - LastBreak))) > W) AND (LastPos <> 1) then + begin + //new Break + SetLength (TextTiles, L+1); + TextTiles[L] := Copy (Value, LastBreak + 1, LastPos - LastBreak); + + Inc(L); + LastBreak := LastPos; + end; + + //last Part + SetLength (TextTiles, L+1); + TextTiles[L] := Copy (Value, LastBreak + 1, Length(Value) - LastBreak); + + end; } + //Set Cursor Visible SelectBlink := True; STicks := GettickCount div 550; @@ -201,7 +384,7 @@ begin end else begin //Draw Text as Many Strings - Y2 := Y; + Y2 := Y + MoveY; for I := 0 to high(TextTiles) do begin if (not (SelectBool AND SelectBlink)) OR (I <> high(TextTiles)) then @@ -210,9 +393,9 @@ begin Text2 := TextTiles[I] + '|'; case Align of - 0: X2 := X; - 1: X2 := X - glTextWidth(pchar(Text2))/2; - 2: X2 := X - glTextWidth(pchar(Text2)); + 0: X2 := X + MoveX; + 1: X2 := X + MoveX - glTextWidth(pchar(Text2))/2; + 2: X2 := X + MoveX - glTextWidth(pchar(Text2)); end; SetFontPos(X2, Y2); -- cgit v1.2.3 From 5c8ba0055244ca316dc9957fec02d6f151df0d2e Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 27 Apr 2007 20:04:56 +0000 Subject: Some Code Cleanup in UMenuText git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@146 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UMenuText.pas | 145 ++----------------------------------------- 1 file changed, 5 insertions(+), 140 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas index adf58840..0ebaede2 100644 --- a/Game/Code/Menu/UMenuText.pas +++ b/Game/Code/Menu/UMenuText.pas @@ -187,143 +187,6 @@ begin //Add Ending AddBreak(LastBreak, Length(Value)+1); - - {I := 0; - // \n Hack - While (I <= High(TextTiles)) do - begin - LastPos := Pos ('\n', TextTiles[I]); - if (LastPos = 0) then //No /n Tags -> Search in next Tile - Inc(I) - else //Found \n Tag -> Create a Break - begin - //Add a new Tile and move all Tiles behind actual Tile to the right - L := Length(TextTiles); - SetLength(TextTiles, L+1); - For L := L-1 downto I + 1 do - begin - TextTiles[L+1] := TextTiles[L]; - end; - - //Write Text to new Tile - TextTiles[I+1] := Trim(Copy(TextTiles[I], LastPos + 2, Length(TextTiles[I]) - LastPos - 1)); - //Delete Text that now is in new Tile from cur. Tile - Delete(TextTiles[I], LastPos, Length(TextTiles[I]) - LastPos + 1); - TextTiles[I] := Trim (TextTiles[I]); - - //Goto next Tile because cur. Tile can not have another /n Tag - Inc(I) - end; - end; - - //Create Page Breaks if width is given and the Text overlapps the width - if (W > 0) then - begin - //Set Font Propertys - SetFontStyle(Style); - SetFontSize(Size); - - {//Create New TextTiles Array - SetLength (TextTiles, 0);}{ - I := 0; - - //Go Through all Tiles - While (I <= High(TextTiles)) do - begin - LastPos := 0; - CurPos := Pos (' ', TextTiles[I]); - - //Go through all Spaces - While (CurPos <> 0) do - begin - //Text is too long for given Width and not the First Word(That means that the Given Word don't Fit the given Width - if (glTextWidth(PChar(Copy (TextTiles[I],1,CurPos-1))) > W) AND (LastPos <> 1) then - begin - //Add a new Tile and move all Tiles behind actual Tile to the right - L := Length(TextTiles); - SetLength(TextTiles, L+1); - For L := L-1 downto I + 1 do - begin - TextTiles[L+1] := TextTiles[L]; - end; - - //Write Text to new Tile - TextTiles[I+1] := Trim(Copy(TextTiles[I], LastPos + 1, Length(TextTiles[I]) - LastPos)); - //Delete Text that now is in new Tile from cur. Tile - Delete(TextTiles[I], LastPos, Length(TextTiles[I]) - LastPos + 1); - TextTiles[I] := Trim (TextTiles[I]); - - //Goto next Tile because cur. Tile can not have another Space - Inc(I) - end; - //Set LastPos and Cur Pos - LastPos := CurPos; - CurPos := PosEx (' ', TextTiles[I], LastPos+1); - end; - - //Look for PageBreak in Last Part of the Tile - CurPos := Length(TextTiles[I]); - if (glTextWidth(PChar(Copy (TextTiles[I],1,CurPos))) > W) AND (LastPos <> 1) then - begin - //Add a new Tile and move all Tiles behind actual Tile to the right - L := Length(TextTiles); - SetLength(TextTiles, L+1); - For L := L-1 downto I + 1 do - begin - TextTiles[L+1] := TextTiles[L]; - end; - - //Write Text to new Tile - TextTiles[I+1] := Trim(Copy(TextTiles[I], LastPos + 1, CurPos - LastPos)); - //Delete Text from cur. Tile that now is in new Tile - Delete(TextTiles[I], LastPos, CurPos - LastPos + 1); - TextTiles[I] := Trim (TextTiles[I]); - //Goto next Tile because cur. Tile can not have another Space - Inc(I) - end; - - //Inc I if Current Tile has no more Spaces - Inc(I) - end; - - I := high(TextTiles); - - {LastPos := 1; - LastBreak := 0; - I := Pos (' ', Value); - While (I <> 0) do - begin - if (glTextWidth(PChar(Copy (Value,LastBreak + 1,I - LastBreak))) > W) AND (LastPos <> 1) then - begin - //new Break - SetLength (TextTiles, L+1); - TextTiles[L] := Copy (Value, LastBreak + 1, LastPos - LastBreak); - - Inc(L); - LastBreak := LastPos; - end; - - LastPos := I; - I := PosEx (' ', Value, I+1); - end; - - //Last Break - if (glTextWidth(PChar(Copy (Value,LastBreak + 1,Length(Value) - LastBreak))) > W) AND (LastPos <> 1) then - begin - //new Break - SetLength (TextTiles, L+1); - TextTiles[L] := Copy (Value, LastBreak + 1, LastPos - LastBreak); - - Inc(L); - LastBreak := LastPos; - end; - - //last Part - SetLength (TextTiles, L+1); - TextTiles[L] := Copy (Value, LastBreak + 1, Length(Value) - LastBreak); - - end; } - //Set Cursor Visible SelectBlink := True; STicks := GettickCount div 550; @@ -365,7 +228,7 @@ begin end; end; - if (False) then //No Width set Draw as one Long String + {if (False) then //No Width set Draw as one Long String begin if not (SelectBool AND SelectBlink) then Text2 := Text @@ -383,7 +246,9 @@ begin SetFontStyle(0); // reset to default end else - begin //Draw Text as Many Strings + begin} + //Now Use allways: + //Draw Text as Many Strings Y2 := Y + MoveY; for I := 0 to high(TextTiles) do begin @@ -405,7 +270,7 @@ begin end; SetFontStyle(0); // reset to default - end; + //end; end; end; -- cgit v1.2.3 From ef87bafc41e7321c8559a23005c79de88b625741 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 28 Apr 2007 09:25:53 +0000 Subject: SongScreen: Changed Alt+Letter now Jump to Artist Added Alt+Shift+Letter: Jump to Title git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@147 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 48 +++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 12 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 5814efbf..16ac46ab 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -199,25 +199,49 @@ begin SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); - //Jump To - if (SDL_ModState = KMOD_LALT) AND (Mode = 0) AND (PressedKey > SDLK_A) AND (PressedKey < SDLK_Z) then + //Jump to Artist/Titel + if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey > SDLK_A) AND (PressedKey < SDLK_Z) then begin Letter := UpCase(Chr(ScanCode)); - Log.LogError(Letter); I2 := Length(CatSongs.Song); - For I := 1 to high(CatSongs.Song) do + + //Jump To Titel + if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then + For I := 1 to high(CatSongs.Song) do begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - Music.PlayChange; + Music.PlayChange; - ChangeMusic; - SetScroll4; - UpdateLCD; - //Break and Exit - Exit; + ChangeMusic; + SetScroll4; + UpdateLCD; + //Break and Exit + Exit; + end; + end; + end + //Jump to Artist + else if (SDL_ModState = KMOD_LALT) then + begin + For I := 1 to high(CatSongs.Song) do + begin + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Artist[1]) = Letter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + + Music.PlayChange; + + ChangeMusic; + SetScroll4; + UpdateLCD; + + //Break and Exit + Exit; + end; end; end; Exit; -- cgit v1.2.3 From 23e4d293dc19ce496da33b3929c9b71952148e86 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 28 Apr 2007 15:25:11 +0000 Subject: Fixed a Bug in UMenuText that causes that Text with only one Char is not displayed git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@148 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UMenuText.pas | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas index 0ebaede2..abf3784c 100644 --- a/Game/Code/Menu/UMenuText.pas +++ b/Game/Code/Menu/UMenuText.pas @@ -105,7 +105,7 @@ var end; procedure AddBreak(const From, bTo: Cardinal); begin - if (isBreak) OR (bTo - From > 1) then + if (isBreak) OR (bTo - From >= 1) then begin Inc(Len); SetLength (TextTiles, Len); @@ -122,6 +122,18 @@ begin //Set TExtstring TextString := Value; + //Set Cursor Visible + SelectBlink := True; + STicks := GettickCount div 550; + + //Exit if there is no Need to Create Tiles + If (W <= 0) and (Pos('\n', Value) = 0) then + begin + SetLength (TextTiles, 1); + TextTiles[0] := Value; + Exit; + end; + //Create Tiles //Reset Text Array SetLength (TextTiles, 0); @@ -133,6 +145,7 @@ begin LastBreak := 1; FirstWord := 1; + if (W > 0) then begin //Set Font Propertys @@ -140,7 +153,6 @@ begin SetFontSize(Size); end; - //go Through Text While (GetNextPos) do begin @@ -186,10 +198,6 @@ begin end; //Add Ending AddBreak(LastBreak, Length(Value)+1); - - //Set Cursor Visible - SelectBlink := True; - STicks := GettickCount div 550; end; Procedure TText.DeleteLastL; -- 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/Classes/UGraphic.pas | 28 +-- Game/Code/Classes/UThemes.pas | 123 ++++++++-- Game/Code/Menu/UMenu.pas | 348 ++++++++++++++++++++++----- Game/Code/Menu/UMenuButton.pas | 17 +- Game/Code/Menu/UMenuButtonCollection.pas | 59 +++++ Game/Code/Menu/UMenuInteract.pas | 2 +- Game/Code/Menu/UMenuText.pas | 2 + Game/Code/Screens/UScreenCredits.pas | 6 +- Game/Code/Screens/UScreenEdit.pas | 6 +- Game/Code/Screens/UScreenEditConvert.pas | 6 +- Game/Code/Screens/UScreenEditHeader.pas | 6 +- Game/Code/Screens/UScreenEditSub.pas | 6 +- Game/Code/Screens/UScreenLevel.pas | 8 +- Game/Code/Screens/UScreenLoading.pas | 16 +- Game/Code/Screens/UScreenMain.pas | 79 ++++-- Game/Code/Screens/UScreenName.pas | 9 +- Game/Code/Screens/UScreenOpen.pas | 6 +- Game/Code/Screens/UScreenOptions.pas | 91 +------ Game/Code/Screens/UScreenOptionsAdvanced.pas | 14 +- Game/Code/Screens/UScreenOptionsGame.pas | 14 +- Game/Code/Screens/UScreenOptionsGraphics.pas | 14 +- Game/Code/Screens/UScreenOptionsLyrics.pas | 14 +- Game/Code/Screens/UScreenOptionsRecord.pas | 14 +- Game/Code/Screens/UScreenOptionsSound.pas | 15 +- Game/Code/Screens/UScreenOptionsThemes.pas | 14 +- Game/Code/Screens/UScreenPartyNewRound.pas | 13 +- Game/Code/Screens/UScreenPartyOptions.pas | 45 +--- Game/Code/Screens/UScreenPartyPlayer.pas | 8 +- Game/Code/Screens/UScreenPartyScore.pas | 8 +- Game/Code/Screens/UScreenPartyWin.pas | 8 +- Game/Code/Screens/UScreenScore.pas | 54 +---- Game/Code/Screens/UScreenSing.pas | 8 +- Game/Code/Screens/UScreenSong.pas | 8 +- Game/Code/Screens/UScreenSongJumpto.pas | 11 +- Game/Code/Screens/UScreenSongMenu.pas | 48 +--- Game/Code/Screens/UScreenStatDetail.pas | 26 +- Game/Code/Screens/UScreenStatMain.pas | 13 +- Game/Code/Screens/UScreenTop5.pas | 8 +- Game/Code/UltraStar.dpr | 26 +- 39 files changed, 668 insertions(+), 533 deletions(-) create mode 100644 Game/Code/Menu/UMenuButtonCollection.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index df7cd411..39eea53d 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -375,7 +375,7 @@ end; procedure LoadScreens; begin - ScreenLoading := TScreenLoading.Create(''); + ScreenLoading := TScreenLoading.Create; ScreenLoading.onShow; Display.ActualScreen := @ScreenLoading; ScreenLoading.Draw; @@ -397,35 +397,35 @@ begin Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Song Menu', 3); Log.BenchmarkStart(3); ScreenSing := TScreenSing.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing', 3); Log.BenchmarkStart(3); - ScreenScore := TScreenScore.Create(''); + ScreenScore := TScreenScore.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Score', 3); Log.BenchmarkStart(3); ScreenTop5 := TScreenTop5.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Top5', 3); Log.BenchmarkStart(3); - ScreenOptions := TScreenOptions.Create(''); + ScreenOptions := TScreenOptions.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options', 3); Log.BenchmarkStart(3); - ScreenOptionsGame := TScreenOptionsGame.Create(''); + ScreenOptionsGame := TScreenOptionsGame.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Game', 3); Log.BenchmarkStart(3); - ScreenOptionsGraphics := TScreenOptionsGraphics.Create(''); + ScreenOptionsGraphics := TScreenOptionsGraphics.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Graphics', 3); Log.BenchmarkStart(3); - ScreenOptionsSound := TScreenOptionsSound.Create(''); + ScreenOptionsSound := TScreenOptionsSound.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Sound', 3); Log.BenchmarkStart(3); - ScreenOptionsLyrics := TScreenOptionsLyrics.Create(''); + ScreenOptionsLyrics := TScreenOptionsLyrics.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Lyrics', 3); Log.BenchmarkStart(3); - ScreenOptionsThemes := TScreenOptionsThemes.Create(''); + ScreenOptionsThemes := TScreenOptionsThemes.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Themes', 3); Log.BenchmarkStart(3); ScreenOptionsRecord := TScreenOptionsRecord.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Record', 3); Log.BenchmarkStart(3); - ScreenOptionsAdvanced := TScreenOptionsAdvanced.Create(''); + ScreenOptionsAdvanced := TScreenOptionsAdvanced.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Advanced', 3); Log.BenchmarkStart(3); - ScreenEditSub := TScreenEditSub.Create(''); + ScreenEditSub := TScreenEditSub.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Sub', 3); Log.BenchmarkStart(3); - ScreenEdit := TScreenEdit.Create(''); + ScreenEdit := TScreenEdit.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit', 3); Log.BenchmarkStart(3); - ScreenEditConvert := TScreenEditConvert.Create(''); + ScreenEditConvert := TScreenEditConvert.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen EditConvert', 3); Log.BenchmarkStart(3); // ScreenEditHeader := TScreenEditHeader.Create(Skin.ScoreBG); // Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Header', 3); Log.BenchmarkStart(3); - ScreenOpen := TScreenOpen.Create(''); + ScreenOpen := TScreenOpen.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Open', 3); Log.BenchmarkStart(3); ScreenSingModi := TScreenSingModi.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing with Modi support', 3); Log.BenchmarkStart(3); @@ -447,7 +447,7 @@ begin Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Main', 3); Log.BenchmarkStart(3); ScreenStatDetail := TScreenStatDetail.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Detail', 3); Log.BenchmarkStart(3); - ScreenCredits := TScreenCredits.Create(''); + ScreenCredits := TScreenCredits.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Credits', 3); Log.BenchmarkStart(3); end; diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 90bab7c1..31081f23 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -142,8 +142,21 @@ type DeSelectReflectionspacing : Real; FadeTex: string; FadeTexPos: integer; + + //Button Collection Mod + Parent: Byte; //Number of the Button Collection this Button is assigned to. IF 0: No Assignement + end; + + //Button Collection Mod + TThemeButtonCollection = record + Style: TThemeButton; + ChildCount: Byte; //No of assigned Childs + FirstChild: Byte; //No of Child on whose Interaction Position the Button should be end; + AThemeButtonCollection = array of TThemeButtonCollection; + PAThemeButtonCollection = ^AThemeButtonCollection; + TThemeSelect = record Tex: string; TexSBG: string; @@ -186,10 +199,14 @@ type SkipX: integer; end; + PThemeBasic = ^TThemeBasic; TThemeBasic = class Background: TThemeBackground; Text: AThemeText; Static: AThemeStatic; + + //Button Collection Mod + ButtonCollection: AThemeButtonCollection; end; TThemeLoading = class(TThemeBasic) @@ -199,15 +216,16 @@ type TThemeMain = class(TThemeBasic) ButtonSolo: TThemeButton; -// ButtonMulti: TThemeButton; + ButtonMulti: TThemeButton; + ButtonStat: TThemeButton; ButtonEditor: TThemeButton; ButtonOptions: TThemeButton; ButtonExit: TThemeButton; TextDescription: TThemeText; TextDescriptionLong: TThemeText; - Description: array[0..4] of string; - DescriptionLong: array[0..4] of string; + Description: array[0..5] of string; + DescriptionLong: array[0..5] of string; end; TThemeName = class(TThemeBasic) @@ -604,12 +622,16 @@ type end; TTheme = class + private {$IFDEF THEMESAVE} ThemeIni: TIniFile; {$ELSE} ThemeIni: TMemIniFile; {$ENDIF} + LastThemeBasic: TThemeBasic; + public + Loading: TThemeLoading; Main: TThemeMain; Name: TThemeName; @@ -656,7 +678,9 @@ type procedure ThemeLoadTexts(var ThemeText: AThemeText; Name: string); procedure ThemeLoadStatic(var ThemeStatic: TThemeStatic; Name: string); procedure ThemeLoadStatics(var ThemeStatic: AThemeStatic; Name: string); - procedure ThemeLoadButton(var ThemeButton: TThemeButton; Name: string); + procedure ThemeLoadButton(var ThemeButton: TThemeButton; Name: string; const Collections: PAThemeButtonCollection = nil); + procedure ThemeLoadButtonCollection(var Collection: TThemeButtonCollection; Name: string); + procedure ThemeLoadButtonCollections(var Collections: AThemeButtonCollection; Name: string); procedure ThemeLoadSelect(var ThemeSelect: TThemeSelect; Name: string); procedure ThemeLoadSelectSlide(var ThemeSelectS: TThemeSelectSlide; Name: string); @@ -692,7 +716,7 @@ uses {{$IFDEF TRANSLATE} ULanguage, {{$ENDIF} -USkins, UIni; +USkins, UIni, Dialogs; constructor TTheme.Create(FileName: string); begin @@ -830,24 +854,30 @@ begin ThemeLoadText(Main.TextDescription, 'MainTextDescription'); ThemeLoadText(Main.TextDescriptionLong, 'MainTextDescriptionLong'); ThemeLoadButton(Main.ButtonSolo, 'MainButtonSolo'); + ThemeLoadButton(Main.ButtonMulti, 'MainButtonMulti'); + ThemeLoadButton(Main.ButtonStat, 'MainButtonStats'); ThemeLoadButton(Main.ButtonEditor, 'MainButtonEditor'); ThemeLoadButton(Main.ButtonOptions, 'MainButtonOptions'); ThemeLoadButton(Main.ButtonExit, 'MainButtonExit'); - //Score Text Translation Start + //Main Desc Text Translation Start {{$IFDEF TRANSLATE} Main.Description[0] := Language.Translate('SING_SING'); Main.DescriptionLong[0] := Language.Translate('SING_SING_DESC'); - Main.Description[1] := Language.Translate('SING_EDITOR'); - Main.DescriptionLong[1] := Language.Translate('SING_EDITOR_DESC'); - Main.Description[2] := Language.Translate('SING_GAME_OPTIONS'); - Main.DescriptionLong[2] := Language.Translate('SING_GAME_OPTIONS_DESC'); - Main.Description[3] := Language.Translate('SING_EXIT'); - Main.DescriptionLong[3] := Language.Translate('SING_EXIT_DESC'); + Main.Description[1] := Language.Translate('SING_MULTI'); + Main.DescriptionLong[1] := Language.Translate('SING_MULTI_DESC'); + Main.Description[2] := Language.Translate('SING_STATS'); + Main.DescriptionLong[2] := Language.Translate('SING_STATS_DESC'); + Main.Description[3] := Language.Translate('SING_EDITOR'); + Main.DescriptionLong[3] := Language.Translate('SING_EDITOR_DESC'); + Main.Description[4] := Language.Translate('SING_GAME_OPTIONS'); + Main.DescriptionLong[4] := Language.Translate('SING_GAME_OPTIONS_DESC'); + Main.Description[5] := Language.Translate('SING_EXIT'); + Main.DescriptionLong[5] := Language.Translate('SING_EXIT_DESC'); {{$ENDIF} - //Score Text Translation End + //Main Desc Text Translation End Main.TextDescription.Text := Main.Description[0]; Main.TextDescriptionLong.Text := Main.DescriptionLong[0]; @@ -931,14 +961,14 @@ begin // Sing ThemeLoadBasic(Sing, 'Sing'); - //moveable singbar mod - ThemeLoadStatic(Sing.StaticP1SingBar, 'SingP1SingBar'); - ThemeLoadStatic(Sing.StaticP1TwoPSingBar, 'SingP1TwoPSingBar'); - ThemeLoadStatic(Sing.StaticP1ThreePSingBar, 'SingP1ThreePSingBar'); - ThemeLoadStatic(Sing.StaticP2RSingBar, 'SingP2RSingBar'); - ThemeLoadStatic(Sing.StaticP2MSingBar, 'SingP2MSingBar'); - ThemeLoadStatic(Sing.StaticP3SingBar, 'SingP3SingBar'); - //eoa moveable singbar + //moveable singbar mod + ThemeLoadStatic(Sing.StaticP1SingBar, 'SingP1SingBar'); + ThemeLoadStatic(Sing.StaticP1TwoPSingBar, 'SingP1TwoPSingBar'); + ThemeLoadStatic(Sing.StaticP1ThreePSingBar, 'SingP1ThreePSingBar'); + ThemeLoadStatic(Sing.StaticP2RSingBar, 'SingP2RSingBar'); + ThemeLoadStatic(Sing.StaticP2MSingBar, 'SingP2MSingBar'); + ThemeLoadStatic(Sing.StaticP3SingBar, 'SingP3SingBar'); + //eoa moveable singbar ThemeLoadStatic(Sing.StaticP1, 'SingP1Static'); ThemeLoadText(Sing.TextP1, 'SingP1Text'); @@ -1315,6 +1345,9 @@ begin ThemeLoadBackground(Theme.Background, Name); ThemeLoadTexts(Theme.Text, Name + 'Text'); ThemeLoadStatics(Theme.Static, Name + 'Static'); + ThemeLoadButtonCollections(Theme.ButtonCollection, Name + 'ButtonCollection'); + + LastThemeBasic := Theme; end; procedure TTheme.ThemeLoadBackground(var ThemeBackground: TThemeBackground; Name: string); @@ -1417,11 +1450,40 @@ begin end; end; -procedure TTheme.ThemeLoadButton(var ThemeButton: TThemeButton; Name: string); +//Button Collection Mod +procedure TTheme.ThemeLoadButtonCollection(var Collection: TThemeButtonCollection; Name: string); +var T: Integer; +begin + //Load Collection Style + ThemeLoadButton(Collection.Style, Name); + + //Load Other Attributes + T := ThemeIni.ReadInteger (Name, 'FirstChild', 0); + if (T > 0) And (T < 256) then + Collection.FirstChild := T + else + Collection.FirstChild := 0; +end; + +procedure TTheme.ThemeLoadButtonCollections(var Collections: AThemeButtonCollection; Name: string); +var + I: integer; +begin + I := 1; + while ThemeIni.SectionExists(Name + IntToStr(I)) do begin + SetLength(Collections, I); + ThemeLoadButtonCollection(Collections[I-1], Name + IntToStr(I)); + Inc(I); + end; +end; +//End Button Collection Mod + +procedure TTheme.ThemeLoadButton(var ThemeButton: TThemeButton; Name: string; const Collections: PAThemeButtonCollection); var C: integer; TLen: integer; T: integer; + Collections2: PAThemeButtonCollection; begin DecimalSeparator := '.'; ThemeButton.Tex := ThemeIni.ReadString(Name, 'Tex', ''); @@ -1477,6 +1539,23 @@ begin if (ThemeButton.FadeTexPos > 4) Or (ThemeButton.FadeTexPos < 0) then ThemeButton.FadeTexPos := 0; + //Button Collection Mod + T := ThemeIni.ReadInteger(Name, 'Parent', 0); + + //Set Collections to Last Basic Collections if no valid Value + if (Collections = nil) then + Collections2 := @LastThemeBasic.ButtonCollection + else + Collections2 := Collections; + //Test for valid Value + if (Collections2 <> nil) AND (T > 0) AND (T <= Length(Collections2^)) then + begin + Inc(Collections2^[T-1].ChildCount); + ThemeButton.Parent := T; + end + else + ThemeButton.Parent := 0; + //Read ButtonTexts TLen := ThemeIni.ReadInteger(Name, 'Texts', 0); SetLength(ThemeButton.Text, TLen); diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 28ba17e7..fc217dba 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -3,7 +3,7 @@ unit UMenu; interface uses OpenGL12, SysUtils, UTexture, UMenuStatic, UMenuText, UMenuButton, UMenuSelect, UMenuSelectSlide, - UMenuInteract, UThemes; + UMenuInteract, UThemes, UMenuButtonCollection; type { Int16 = SmallInt;} @@ -18,12 +18,13 @@ type Button: array of TButton; Selects: array of TSelect; SelectsS: array of TSelectSlide; + ButtonCollection: Array of TButtonCollection; BackImg: TTexture; BackW: integer; BackH: integer; public Text: array of TText; - Static: array of TStatic; + Static: array of TStatic; mX: integer; // mouse X mY: integer; // mouse Y @@ -33,14 +34,20 @@ type destructor Destroy; override; constructor Create; overload; virtual; - constructor Create(Back: string); overload; virtual; // Back is a JPG resource name for background - constructor Create(Back: string; W, H: integer); overload; virtual; // W and H are the number of overlaps + //constructor Create(Back: string); overload; virtual; // Back is a JPG resource name for background + //constructor Create(Back: string; W, H: integer); overload; virtual; // W and H are the number of overlaps // interaction procedure AddInteraction(Typ, Num: integer); procedure SetInteraction(Num: integer); property Interaction: integer read SelInteraction write SetInteraction; + //Procedure Load BG, Texts, Statics and Button Collections from ThemeBasic + procedure LoadFromTheme(const ThemeBasic: TThemeBasic); + + procedure PrepareButtonCollections(const Collections: AThemeButtonCollection); + procedure AddButtonCollection(const ThemeCollection: TThemeButtonCollection; Const Num: Byte); + // background procedure AddBackground(Name: string); @@ -70,6 +77,7 @@ type procedure AddButtonText(AddX, AddY: real; AddText: string); overload; procedure AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; AddText: string); overload; procedure AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; AddText: string); overload; + procedure AddButtonText(CustomButton: TButton; AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; AddText: string); overload; // select function AddSelect(ThemeSelect: TThemeSelect; var Data: integer; Values: array of string): integer; overload; @@ -113,7 +121,8 @@ type procedure SetAnimationProgress(Progress: real); virtual; - + function IsSelectable(Int: Cardinal): Boolean; + procedure InteractNext; virtual; procedure InteractCustom(CustomSwitch: integer); virtual; procedure InteractPrev; virtual; @@ -132,13 +141,14 @@ const iSelect = 1; iText = 2; iSelectS = 3; + iBCollectionChild = 5; // fBlack = 0; // fade type // fWhite = 1; implementation -uses UMain, UDrawTexture, UGraphic, UDisplay, UCovers, USkins; +uses UMain, UDrawTexture, UGraphic, UDisplay, UCovers, USkins, Dialogs; destructor TMenu.Destroy; begin @@ -157,7 +167,7 @@ begin //Set ButtonPos to Autoset Length ButtonPos := -1; end; - +{ constructor TMenu.Create(Back: String); begin inherited Create; @@ -183,7 +193,7 @@ begin BackImg.H := BackImg.H / H; BackW := W; BackH := H; -end; +end; } procedure TMenu.AddInteraction(Typ, Num: integer); var @@ -204,25 +214,67 @@ begin // set inactive OldNum := Interactions[Interaction].Num; OldTyp := Interactions[Interaction].Typ; + + NewNum := Interactions[Num].Num; + NewTyp := Interactions[Num].Typ; + case OldTyp of iButton: Button[OldNum].Selected := False; iSelect: Selects[OldNum].Selected := False; iText: Text[OldNum].Selected := False; iSelectS: SelectsS[OldNum].Selected := False; + //Button Collection Mod + iBCollectionChild: + begin + Button[OldNum].Selected := False; + + //Deselect Collection if Next Button is Not from Collection + if (NewTyp <> iButton) Or (Button[NewNum].Parent <> Button[OldNum].Parent) then + ButtonCollection[Button[OldNum].Parent-1].Selected := False; + end; end; // set active SelInteraction := Num; - NewNum := Interactions[Interaction].Num; - NewTyp := Interactions[Interaction].Typ; case NewTyp of iButton: Button[NewNum].Selected := True; iSelect: Selects[NewNum].Selected := True; iText: Text[NewNum].Selected := True; iSelectS: SelectsS[NewNum].Selected := True; + + //Button Collection Mod + iBCollectionChild: + begin + Button[NewNum].Selected := True; + ButtonCollection[Button[NewNum].Parent-1].Selected := True; + end; end; end; +//---------------------- +//LoadFromTheme - Load BG, Texts, Statics and +//Button Collections from ThemeBasic +//---------------------- +procedure TMenu.LoadFromTheme(const ThemeBasic: TThemeBasic); +var + I: Integer; +begin + //Add Button Collections (Set Button CollectionsLength) + //Button Collections are Created when the first ChildButton is Created + PrepareButtonCollections(ThemeBasic.ButtonCollection); + + + //Add Background + AddBackground(ThemeBasic.Background.Tex); + + //Add Statics and Texts + for I := 0 to High(ThemeBasic.Static) do + AddStatic(ThemeBasic.Static[I]); + + for I := 0 to High(ThemeBasic.Text) do + AddText(ThemeBasic.Text[I]); +end; + procedure TMenu.AddBackground(Name: string); begin if Name <> '' then begin @@ -235,6 +287,84 @@ begin end; end; +//---------------------- +//PrepareButtonCollections: +//Add Button Collections (Set Button CollectionsLength) +//---------------------- +procedure TMenu.PrepareButtonCollections(const Collections: AThemeButtonCollection); +var + I: Integer; +begin + SetLength(ButtonCollection, Length(Collections)); + For I := 0 to High(ButtonCollection) do + AddButtonCollection(Collections[I], I); +end; + +//---------------------- +//AddButtonCollection: +//Create a Button Collection; +//---------------------- +procedure TMenu.AddButtonCollection(const ThemeCollection: TThemeButtonCollection; Const Num: Byte); +var + BT, BTLen: Integer; +begin + if (Num > High(ButtonCollection)) then + exit; + + ButtonCollection[Num] := TButtonCollection.Create(Texture.GetTexture(Skin.GetTextureFileName(ThemeCollection.Style.Tex), ThemeCollection.Style.Typ, true)); // use cache texture + + //Set Parent menu + ButtonCollection[Num].ScreenButton := @Self.Button; + + //Set Attributes + ButtonCollection[Num].FirstChild := ThemeCollection.FirstChild; + ButtonCollection[Num].CountChilds := ThemeCollection.ChildCount; + ButtonCollection[Num].Parent := Num + 1; + + //Set Style + ButtonCollection[Num].X := ThemeCollection.Style.X; + ButtonCollection[Num].Y := ThemeCollection.Style.Y; + ButtonCollection[Num].W := ThemeCollection.Style.W; + ButtonCollection[Num].H := ThemeCollection.Style.H; + ButtonCollection[Num].SelectColR := ThemeCollection.Style.ColR; + ButtonCollection[Num].SelectColG := ThemeCollection.Style.ColG; + ButtonCollection[Num].SelectColB := ThemeCollection.Style.ColB; + ButtonCollection[Num].SelectInt := ThemeCollection.Style.Int; + ButtonCollection[Num].DeselectColR := ThemeCollection.Style.DColR; + ButtonCollection[Num].DeselectColG := ThemeCollection.Style.DColG; + ButtonCollection[Num].DeselectColB := ThemeCollection.Style.DColB; + ButtonCollection[Num].DeselectInt := ThemeCollection.Style.DInt; + ButtonCollection[Num].Texture.TexX1 := 0; + ButtonCollection[Num].Texture.TexY1 := 0; + ButtonCollection[Num].Texture.TexX2 := 1; + ButtonCollection[Num].Texture.TexY2 := 1; + ButtonCollection[Num].SetSelect(false); + + ButtonCollection[Num].Reflection := ThemeCollection.Style.Reflection; + ButtonCollection[Num].Reflectionspacing := ThemeCollection.Style.ReflectionSpacing; + ButtonCollection[Num].DeSelectReflectionspacing := ThemeCollection.Style.DeSelectReflectionSpacing; + + ButtonCollection[Num].Z := ThemeCollection.Style.Z; + + //Some Things from ButtonFading + ButtonCollection[Num].SelectH := ThemeCollection.Style.SelectH; + ButtonCollection[Num].SelectW := ThemeCollection.Style.SelectW; + + ButtonCollection[Num].Fade := ThemeCollection.Style.Fade; + ButtonCollection[Num].FadeText := ThemeCollection.Style.FadeText; + ButtonCollection[Num].FadeTex := Texture.GetTexture(Skin.GetTextureFileName(ThemeCollection.Style.FadeTex), ThemeCollection.Style.Typ, true); + ButtonCollection[Num].FadeTexPos := ThemeCollection.Style.FadeTexPos; + + + BTLen := Length(ThemeCollection.Style.Text); + for BT := 0 to BTLen-1 do begin + AddButtonText(ButtonCollection[Num], ThemeCollection.Style.Text[BT].X, ThemeCollection.Style.Text[BT].Y, + ThemeCollection.Style.Text[BT].ColR, ThemeCollection.Style.Text[BT].ColG, ThemeCollection.Style.Text[BT].ColB, + ThemeCollection.Style.Text[BT].Font, ThemeCollection.Style.Text[BT].Size, ThemeCollection.Style.Text[BT].Align, + ThemeCollection.Style.Text[BT].Text); + end; +end; + function TMenu.AddStatic(ThemeStatic: TThemeStatic): integer; begin Result := AddStatic(ThemeStatic.X, ThemeStatic.Y, ThemeStatic.W, ThemeStatic.H, ThemeStatic.Z, @@ -415,6 +545,20 @@ begin ThemeButton.Text[BT].Font, ThemeButton.Text[BT].Size, ThemeButton.Text[BT].Align, ThemeButton.Text[BT].Text); end; + + //BAutton Collection Mod + if (ThemeButton.Parent <> 0) then + begin + //If Collection Exists then Change Interaction to Child Button + if (@ButtonCollection[ThemeButton.Parent-1] <> nil) then + begin + Interactions[High(Interactions)].Typ := iBCollectionChild; + Button[Result].Visible := False; + Button[Result].Parent := ThemeButton.Parent; + if (ButtonCollection[ThemeButton.Parent-1].Fade) then + Button[Result].Texture.Alpha := 0; + end; + end; end; function TMenu.AddButton(X, Y, W, H: real; Name: String): integer; @@ -473,6 +617,10 @@ begin Button[Result].Reflectionspacing := ReflectionSpacing; Button[Result].DeSelectReflectionspacing := DeSelectReflectionSpacing; + //Button Collection Mod + Button[Result].Parent := 0; + + // adds interaction AddInteraction(iButton, Result); Interaction := 0; @@ -527,6 +675,10 @@ begin for J := 0 to Length(Text) - 1 do Text[J].Draw; + // Draw all ButtonCollections + For J := 0 to High(ButtonCollection) do + ButtonCollection[J].Draw; + // Second, we draw all of our buttons for J := 0 to Length(Button) - 1 do Button[J].Draw; @@ -595,60 +747,68 @@ begin SetLength(WidgetsRect, MinNumber); end;} +function TMenu.IsSelectable(Int: Cardinal): Boolean; +begin + Result := True; + Case Interactions[Int].Typ of + //Button + iButton: Result := Button[Interactions[Int].Num].Visible and Button[Interactions[Int].Num].Selectable; + //Select + iSelect: Result := True; + //Select Slide + iSelectS: Result := SelectsS[Interactions[Int].Num].Visible; + + //ButtonCollection Child + iBCollectionChild: + Result := (ButtonCollection[Button[Interactions[Int].Num].Parent - 1].FirstChild - 1 = Int) AND ((Interactions[Interaction].Typ <> iBCollectionChild) OR (Button[Interactions[Interaction].Num].Parent <> Button[Interactions[Int].Num].Parent)); + end; +end; + procedure TMenu.InteractNext; var - Num: integer; - Typ: integer; - Again: boolean; + Int: Integer; begin - Again := true; + Int := Interaction; // change interaction as long as it's needed - while (Again = true) do begin - Num := (Interaction + 1) Mod Length(Interactions); - Interaction := Num; - Again := false; // reset, default to accept changing interaction - - - // checking newly interacted element - Num := Interactions[Interaction].Num; - Typ := Interactions[Interaction].Typ; - case Typ of - iButton: - begin - if Button[Num].Selectable = false then Again := True; - end; - end; // case - end; // while + repeat + Int := (Int + 1) Mod Length(Interactions); + + //If no Interaction is Selectable Simply Select Next + if (Int = Interaction) then + begin + Int := (Int + 1) Mod Length(Interactions); + Break; + end; + Until IsSelectable(Int); + + //Set Interaction + Interaction := Int; end; procedure TMenu.InteractPrev; var - Num: integer; - Typ: integer; - Again: boolean; + Int: Integer; begin - Again := true; + Int := Interaction; // change interaction as long as it's needed - while (Again = true) do begin - Num := SelInteraction - 1; - if Num = -1 then Num := High(Interactions); - Interaction := Num; - Again := false; // reset, default to accept changing interaction - - // checking newly interacted element - Num := Interactions[Interaction].Num; - Typ := Interactions[Interaction].Typ; - case Typ of - iButton: - begin - if Button[Num].Selectable = false then Again := True; - end; - end; // case - end; // while - + repeat + Int := Int - 1; + if Int = -1 then Int := High(Interactions); + + //If no Interaction is Selectable Simply Select Next + if (Int = Interaction) then + begin + Int := SelInteraction - 1; + if Int = -1 then Int := High(Interactions); + Break; + end; + Until IsSelectable(Int); + + //Set Interaction + Interaction := Int end; @@ -658,7 +818,9 @@ var Typ: integer; Again: boolean; begin - if num<0 then begin + //Code Commented atm, because it needs to be Rewritten + //it doesn't work with Button Collections + {then begin CustomSwitch:= CustomSwitch*(-1); Again := true; // change interaction as long as it's needed @@ -698,7 +860,7 @@ begin end; end; // case end; // while - end + end } end; @@ -746,6 +908,24 @@ begin end; end; +procedure TMenu.AddButtonText(CustomButton: TButton; AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; AddText: string); +var + Il: integer; +begin + with CustomButton do begin + Il := Length(Text); + SetLength(Text, Il+1); + Text[Il] := TText.Create(X + AddX, Y + AddY, AddText); + Text[Il].ColR := ColR; + Text[Il].ColG := ColG; + Text[Il].ColB := ColB; + Text[Il].Int := 1;//0.5; + Text[Il].Style := Font; + Text[Il].Size := Size; + Text[Il].Align := Align; + end; +end; + function TMenu.AddSelect(ThemeSelect: TThemeSelect; var Data: integer; Values: array of string): integer; var SO: integer; @@ -1114,6 +1294,28 @@ begin if Value <= High(SelectsS[Num].TextOptT) then SelectsS[Num].SelectedOption := Value; end; + //Button Collection Mod + iBCollectionChild: + begin + + //Select Next Button in Collection + For Num := 1 to High(Button) do + begin + Value := (Interaction + Num) Mod Length(Button); + if Value = 0 then + begin + InteractNext; + Break; + end; + if (Button[Value].Parent = Button[Interaction].Parent) then + begin + Interaction := Value; + Break; + end; + end; + end; + //interact Next if there is Nothing to Change + else InteractNext; end; end; @@ -1141,7 +1343,45 @@ begin if Value >= 0 then SelectsS[Num].SelectedOption := Value; end; - end + //Button Collection Mod + iBCollectionChild: + begin + //Select Prev Button in Collection + For Num := High(Button) downto 1 do + begin + Value := (Interaction + Num) Mod Length(Button); + if Value = High(Button) then + begin + InteractPrev; + Break; + end; + if (Button[Value].Parent = Button[Interaction].Parent) then + begin + Interaction := Value; + Break; + end; + end; + end; + //interact Prev if there is Nothing to Change + else + begin + InteractPrev; + //If ButtonCollection with more than 1 Entry then Select Last Entry + if (ButtonCollection[Button[Interactions[Interaction].Num].Parent-1].CountChilds > 1) then + begin + //Select Last Child + For Num := High(Button) downto 1 do + begin + Value := (Interaction + Num) Mod Length(Button); + if (Button[Value].Parent = Button[Interaction].Parent) then + begin + Interaction := Value; + Break; + end; + end; + end; + end; + end; end; procedure TMenu.AddBox(X, Y, W, H: real); diff --git a/Game/Code/Menu/UMenuButton.pas b/Game/Code/Menu/UMenuButton.pas index 34d45083..fde808e2 100644 --- a/Game/Code/Menu/UMenuButton.pas +++ b/Game/Code/Menu/UMenuButton.pas @@ -4,8 +4,9 @@ interface uses TextGL, UTexture, OpenGL12, UMenuText; type + CButton = class of TButton; TButton = class - private + protected SelectBool: Boolean; FadeProgress: Real; @@ -14,9 +15,10 @@ type DeSelectW: Real; DeSelectH: Real; PosX: Real; - PosY: Real; - + PosY: Real; + constructor Create(); overload; + public Text: Array of TText; Texture: TTexture; // Button Screen position and size @@ -40,6 +42,9 @@ type Selectable: boolean; + //No of the Parent Collection, 0 if in no Collection + Parent: Byte; + SelectColR: real; SelectColG: real; SelectColB: real; @@ -60,7 +65,7 @@ type procedure SetW(Value: real); procedure SetH(Value: real); - procedure SetSelect(Value: Boolean); + procedure SetSelect(Value: Boolean); virtual; property X: real read PosX write SetX; property Y: real read PosY write SetY; property Z: real read Texture.z write Texture.z; @@ -68,7 +73,7 @@ type property H: real read DeSelectH write SetH; property Selected: Boolean read SelectBool write SetSelect; - procedure Draw; + procedure Draw; virtual; constructor Create(Textura: TTexture); overload; destructor Destroy; override; @@ -250,6 +255,8 @@ begin PosX := 0; PosY := 0; + + Parent := 0; end; // ***** Public methods ****** // diff --git a/Game/Code/Menu/UMenuButtonCollection.pas b/Game/Code/Menu/UMenuButtonCollection.pas new file mode 100644 index 00000000..66ac70fc --- /dev/null +++ b/Game/Code/Menu/UMenuButtonCollection.pas @@ -0,0 +1,59 @@ +unit UMenuButtonCollection; + +interface +uses UMenuButton; + +type + //---------------- + //TButtonCollection + //No Extra Attributes or Functions ATM + //---------------- + AButton = Array of TButton; + PAButton = ^AButton; + TButtonCollection = class(TButton) + //num of the First Button, that can be Selected + FirstChild: Byte; + CountChilds: Byte; + + ScreenButton: PAButton; + + procedure SetSelect(Value : Boolean); override; + procedure Draw; override; + end; + +implementation + +procedure TButtonCollection.SetSelect(Value : Boolean); +var I: Integer; +begin + inherited; + + //Set Visible for Every Button that is a Child of this ButtonCollection + if (Not Fade) then + For I := 0 to High(ScreenButton^) do + if (ScreenButton^[I].Parent = Parent) then + ScreenButton^[I].Visible := Value; +end; + +procedure TButtonCollection.Draw; +var I: Integer; +begin + inherited; + //If fading is activated, Fade Child Buttons + if (Fade) then + begin + For I := 0 to High(ScreenButton^) do + if (ScreenButton^[I].Parent = Parent) then + begin + if (FadeProgress < 0.5) then + ScreenButton^[I].Visible := SelectBool + else + ScreenButton^[I].Texture.Alpha := (FadeProgress-0.666)*3; + //ScreenButton^[I].Text[0]. + end; + end; +end; + + + +end. diff --git a/Game/Code/Menu/UMenuInteract.pas b/Game/Code/Menu/UMenuInteract.pas index 3f2960b8..43249e3e 100644 --- a/Game/Code/Menu/UMenuInteract.pas +++ b/Game/Code/Menu/UMenuInteract.pas @@ -4,7 +4,7 @@ interface type TInteract = record // for moving thru menu - Typ: integer; // 0 - button, 1 - select + Typ: integer; // 0 - button, 1 - select, 2 - Text, 3 - Select SLide, 5 - ButtonCollection Child Num: integer; // number of this item in proper list like buttons, selects end; diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas index abf3784c..4cb48cad 100644 --- a/Game/Code/Menu/UMenuText.pas +++ b/Game/Code/Menu/UMenuText.pas @@ -162,6 +162,7 @@ begin //Look for Break before the Break if (glTextWidth(PChar(Copy(Value, LastBreak, NextPos - LastBreak + 1))) > W) AND (NextPos-LastPos > 1) then begin + isBreak := False; //Not the First word after Break, so we don't have to break within a word if (FirstWord > 1) then begin @@ -175,6 +176,7 @@ begin end; end; + isBreak := True; //Add Break from Text AddBreak(LastBreak, NextPos); end diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 2e5f4abc..0411c7b6 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -14,7 +14,7 @@ type Credits_Alpha: Cardinal; Fadeout: boolean; - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; function Draw: boolean; override; procedure onShow; override; @@ -97,11 +97,11 @@ begin end; //fi end; -constructor TScreenCredits.Create(Back: String); +constructor TScreenCredits.Create; var I: integer; begin - inherited Create(Back); + inherited Create; AddBackground(Theme.Loading.Background.Tex); diff --git a/Game/Code/Screens/UScreenEdit.pas b/Game/Code/Screens/UScreenEdit.pas index aa3301a7..00df0418 100644 --- a/Game/Code/Screens/UScreenEdit.pas +++ b/Game/Code/Screens/UScreenEdit.pas @@ -11,7 +11,7 @@ type FadeOut: boolean; Path: string; FileName: string;} - constructor Create(Back: String); override; + constructor Create; override; procedure onShow; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; { function Draw: boolean; override; @@ -63,9 +63,9 @@ begin end; end; -constructor TScreenEdit.Create(Back: String); +constructor TScreenEdit.Create; begin - inherited Create(Back); + inherited Create; AddButton(400-200, 100 + 0*70, 400, 40, Skin.GetTextureFileName('ButtonF')); AddButtonText(10, 5, 0, 0, 0, 'Convert Midi to Txt'); // Button[High(Button)].Text[0].Size := 11; diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index 68742535..62a50b3e 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -58,7 +58,7 @@ type procedure Extract; procedure MidiFile1MidiEvent(event: PMidiEvent); function SelectedNumber: integer; - constructor Create(Back: String); override; + constructor Create; override; procedure onShow; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; function Draw: boolean; override; @@ -299,11 +299,11 @@ begin MidiOut.PutShort(event.event, event.data1, event.data2); end; -constructor TScreenEditConvert.Create(Back: String); +constructor TScreenEditConvert.Create; var P: integer; begin - inherited Create(Back); + inherited Create; AddButton(40, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); AddButtonText(15, 5, 0, 0, 0, 'Open'); // Button[High(Button)].Text[0].Size := 11; diff --git a/Game/Code/Screens/UScreenEditHeader.pas b/Game/Code/Screens/UScreenEditHeader.pas index a601555a..dbdd186c 100644 --- a/Game/Code/Screens/UScreenEditHeader.pas +++ b/Game/Code/Screens/UScreenEditHeader.pas @@ -35,7 +35,7 @@ type Sel: array[0..11] of boolean; procedure SetRoundButtons; - constructor Create(Back: String); override; + constructor Create; override; procedure onShow; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; { function Draw: boolean; override; @@ -124,9 +124,9 @@ begin end; end; -constructor TScreenEditHeader.Create(Back: String); +constructor TScreenEditHeader.Create; begin - inherited Create(Back); + inherited Create; AddButton(40, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); AddButtonText(15, 5, 'Open'); diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 6094edd1..a665ba1c 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -62,7 +62,7 @@ type FadeOut: boolean; Path: string; FileName: string; - constructor Create(Back: String); override; + constructor Create; override; procedure onShow; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; function ParseInputEditText(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; @@ -1035,9 +1035,9 @@ begin end; -constructor TScreenEditSub.Create(Back: String); +constructor TScreenEditSub.Create; begin - inherited Create(Back); + inherited Create; SetLength(Player, 1); // linijka diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas index 28aa40ea..80d42773 100644 --- a/Game/Code/Screens/UScreenLevel.pas +++ b/Game/Code/Screens/UScreenLevel.pas @@ -68,18 +68,12 @@ var begin inherited Create; - AddBackground(Theme.Level.Background.Tex); + LoadFromTheme(Theme.Level); AddButton(Theme.Level.ButtonEasy); AddButton(Theme.Level.ButtonMedium); AddButton(Theme.Level.ButtonHard); - for I := 0 to High(Theme.Level.Static) do - AddStatic(Theme.Level.Static[I]); - - for I := 0 to High(Theme.Level.Text) do - AddText(Theme.Level.Text[I]); - Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenLoading.pas b/Game/Code/Screens/UScreenLoading.pas index 5cc938bb..438b606e 100644 --- a/Game/Code/Screens/UScreenLoading.pas +++ b/Game/Code/Screens/UScreenLoading.pas @@ -9,7 +9,7 @@ type TScreenLoading = class(TMenu) public Fadeout: boolean; - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; function GetBGTexNum: GLUInt; procedure onShow; override; @@ -24,19 +24,11 @@ begin Result := true; end; -constructor TScreenLoading.Create(Back: String); -var - I: integer; +constructor TScreenLoading.Create; begin - inherited Create(Back); + inherited Create; - AddBackground(Theme.Loading.Background.Tex); - - for I := 0 to High(Theme.Loading.Static) do - AddStatic(Theme.Loading.Static[I]); - - for I := 0 to High(Theme.Loading.Text) do - AddText(Theme.Loading.Text[I]); + LoadFromTheme(Theme.Loading); Fadeout := false; end; diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 4c822640..49bd98ee 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -16,6 +16,8 @@ type procedure onShow; override; procedure InteractNext; override; procedure InteractPrev; override; + procedure InteractInc; override; + procedure InteractDec; override; procedure UpdateLCD; procedure SetAnimationProgress(Progress: real); override; //function Draw: boolean; override; @@ -84,6 +86,7 @@ begin SDLK_RETURN: begin + //Solo if (Interaction = 0) and (Length(Songs.Song) >= 1) then begin Music.PlayStart; if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1; @@ -92,23 +95,44 @@ begin ScreenName.Goto_SingScreen := False; FadeTo(@ScreenName); end; + + //Multi if Interaction = 1 then begin + if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then + begin + Music.PlayStart; + FadeTo(@ScreenPartyOptions); + end; + end; + + //Stats + if Interaction = 2 then begin + Music.PlayStart; + FadeTo(@ScreenStatMain); + end; + + //Editor + if Interaction = 3 then begin Music.PlayStart; FadeTo(@ScreenEdit); end; - if Interaction = 2 then begin + + //Options + if Interaction = 4 then begin Music.PlayStart; FadeTo(@ScreenOptions); end; - if Interaction = 3 then begin + + //Exit + if Interaction = 5 then begin Result := false; end; end; // Up and Down could be done at the same time, // but I don't want to declare variables inside // functions like this one, called so many times - SDLK_DOWN: InteractNext; - SDLK_UP: InteractPrev; + SDLK_DOWN: InteractInc; + SDLK_UP: InteractDec; SDLK_RIGHT: InteractNext; SDLK_LEFT: InteractPrev; end; @@ -127,27 +151,28 @@ var begin inherited Create; -// AddButton(400-200, 320, 400, 60, Skin.GameStart); -// AddButton(400-200, 390, 400, 60, Skin.Editor); -// AddButton(400-200, 460, 400, 60, Skin.Options); -// AddButton(400-200, 530, 400, 60, Skin.Exit); + //---------------- + //Attention ^^: + //New Creation Order needed because of LoadFromTheme + //and Button Collections. + //At First Custom Texts and Statics + //Then LoadFromTheme + //after LoadFromTheme the Buttons and Selects + //---------------- + + + TextDescription := AddText(Theme.Main.TextDescription); + TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong); - AddBackground(Theme.Main.Background.Tex); + LoadFromTheme(Theme.Main); AddButton(Theme.Main.ButtonSolo); + AddButton(Theme.Main.ButtonMulti); + AddButton(Theme.Main.ButtonStat); AddButton(Theme.Main.ButtonEditor); AddButton(Theme.Main.ButtonOptions); AddButton(Theme.Main.ButtonExit); - for I := 0 to High(Theme.Main.Static) do - AddStatic(Theme.Main.Static[I]); - - for I := 0 to High(Theme.Main.Text) do - AddText(Theme.Main.Text[I]); - - TextDescription := AddText(Theme.Main.TextDescription); - TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong); - Interaction := 0; end; @@ -175,6 +200,24 @@ begin Light.LightOne(0, 200); end; +procedure TScreenMain.InteractDec; +begin + inherited InteractDec; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; + UpdateLCD; + Light.LightOne(0, 200); +end; + +procedure TScreenMain.InteractInc; +begin + inherited InteractInc; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; + UpdateLCD; + Light.LightOne(1, 200); +end; + procedure TScreenMain.UpdateLCD; begin case Interaction of diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index e8bc2dd8..9819b994 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -76,17 +76,12 @@ var begin inherited Create; - AddBackground(Theme.Name.Background.Tex); + LoadFromTheme(Theme.Name); + for I := 1 to 6 do AddButton(Theme.Name.ButtonPlayer[I]); - for I := 0 to High(Theme.Name.Static) do - AddStatic(Theme.Name.Static[I]); - - for I := 0 to High(Theme.Name.Text) do - AddText(Theme.Name.Text[I]); - Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index 264f57a9..4f0c32c5 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -16,7 +16,7 @@ type Path: string; BackScreen: pointer; procedure AddBox(X, Y, W, H: real); - constructor Create(Back: String); override; + constructor Create; override; procedure onShow; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; // function Draw: boolean; override; @@ -90,9 +90,9 @@ begin AddStatic(X+2, Y+2, W-4, H-4, 1, 1, 1, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); end; -constructor TScreenOpen.Create(Back: String); +constructor TScreenOpen.Create; begin - inherited Create(Back); + inherited Create; // linijka { AddStatic(20, 10, 80, 30, 0, 0, 0, 'Bar', 'JPG', 'Font Black'); diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas index 0fffedac..f0229d8c 100644 --- a/Game/Code/Screens/UScreenOptions.pas +++ b/Game/Code/Screens/UScreenOptions.pas @@ -9,7 +9,7 @@ type TScreenOptions = class(TMenu) public TextDescription: integer; - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure InteractNext; override; @@ -80,88 +80,23 @@ begin FadeTo(@ScreenMain); end; end; - SDLK_LEFT: - begin - {case SelInteraction of - 0: InteractCustom(+2); - 1: InteractCustom(-1); - 2: InteractCustom(-1); - 3: InteractCustom(+2); - 4: InteractCustom(-1); - 5: InteractCustom(-1); - end;} - InteractPrev; - end; - SDLK_RIGHT: - begin - {case SelInteraction of - 0: InteractCustom(+1); - 1: InteractCustom(+1); - 2: InteractCustom(-2); - 3: InteractCustom(+1); - 4: InteractCustom(+1); - 5: InteractCustom(-2); - end;} - InteractNext; - end; - SDLK_UP: - begin - InteractPrev; - {case SelInteraction of - 0: InteractCustom(+3); - 1: InteractCustom(+3); - 2: InteractCustom(+3); - 3: InteractCustom(-3); - 4: InteractCustom(-3); - 5: InteractCustom(-3); - end; } - end; - SDLK_DOWN: - begin - {case SelInteraction of - 0: InteractCustom(+3); - 1: InteractCustom(+3); - 2: InteractCustom(+3); - 3: InteractCustom(-3); - 4: InteractCustom(-3); - 5: InteractCustom(-3); - end; } - InteractNext; - end; + SDLK_DOWN: InteractInc; + SDLK_UP: InteractDec; + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; end; end; end; -constructor TScreenOptions.Create(Back: String); +constructor TScreenOptions.Create; var I: integer; begin - inherited Create(Back); + inherited Create; - // Game -{ AddButton(225, 100 + 0*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); - AddButtonText(11, 10, 'Game');} - - // Graphics -{ AddButton(225, 100 + 1*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); - AddButtonText(11, 10, 'Graphics'); - - // Sound - AddButton(225, 100 + 2*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); - AddButtonText(11, 10, 'Sound'); - - // Lyrics - AddButton(225, 100 + 3*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); - AddButtonText(11, 10, 'Lyrics'); - - // Themes - AddButton(225, 100 + 4*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); - AddButtonText(11, 10, 'Themes'); - - // Exit - AddButton(225, 100 + 6*60, 350, 50, Skin.Exit);} + TextDescription := AddText(Theme.Options.TextDescription); - AddBackground(Theme.Options.Background.Tex); + LoadFromTheme(Theme.Options); AddButton(Theme.Options.ButtonGame); if (Length(Button[0].Text)=0) then @@ -195,14 +130,6 @@ begin if (Length(Button[7].Text)=0) then AddButtonText(14, 20, Theme.Options.Description[7]); - for I := 0 to High(Theme.Options.Static) do - AddStatic(Theme.Options.Static[I]); - - for I := 0 to High(Theme.Options.Text) do - AddText(Theme.Options.Text[I]); - - TextDescription := AddText(Theme.Options.TextDescription); - Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index ed3bc164..256b02db 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -8,7 +8,7 @@ uses type TScreenOptionsAdvanced = class(TMenu) public - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; end; @@ -59,19 +59,13 @@ begin end; end; -constructor TScreenOptionsAdvanced.Create(Back: String); +constructor TScreenOptionsAdvanced.Create; var I: integer; begin - inherited Create(Back); + inherited Create; - AddBackground(Theme.OptionsAdvanced.Background.Tex); - - for I := 0 to High(Theme.OptionsAdvanced.Static) do - AddStatic(Theme.OptionsAdvanced.Static[I]); - - for I := 0 to High(Theme.OptionsAdvanced.Text) do - AddText(Theme.OptionsAdvanced.Text[I]); + LoadFromTheme(Theme.OptionsAdvanced); AddSelect(Theme.OptionsAdvanced.SelectLoadAnimation, Ini.LoadAnimation, ILoadAnimation); AddSelect(Theme.OptionsAdvanced.SelectScreenFade, Ini.ScreenFade, IScreenFade); diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index 63bbec36..88bb34e3 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -9,7 +9,7 @@ type TScreenOptionsGame = class(TMenu) public old_Tabs, old_Sorting: integer; - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure RefreshSongs; @@ -61,19 +61,13 @@ begin end; end; -constructor TScreenOptionsGame.Create(Back: String); +constructor TScreenOptionsGame.Create; var I: integer; begin - inherited Create(Back); + inherited Create; - AddBackground(Theme.OptionsGame.Background.Tex); - - for I := 0 to High(Theme.OptionsGame.Static) do - AddStatic(Theme.OptionsGame.Static[I]); - - for I := 0 to High(Theme.OptionsGame.Text) do - AddText(Theme.OptionsGame.Text[I]); + LoadFromTheme(Theme.OptionsGame); //Refresh Songs Patch old_Sorting := Ini.Sorting; diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index 6152c9c0..b36bb7d3 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -8,7 +8,7 @@ uses type TScreenOptionsGraphics = class(TMenu) public - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; end; @@ -66,19 +66,13 @@ begin end; end; -constructor TScreenOptionsGraphics.Create(Back: String); +constructor TScreenOptionsGraphics.Create; var I: integer; begin - inherited Create(Back); + inherited Create; - AddBackground(Theme.OptionsGraphics.Background.Tex); - - for I := 0 to High(Theme.OptionsGraphics.Static) do - AddStatic(Theme.OptionsGraphics.Static[I]); - - for I := 0 to High(Theme.OptionsGraphics.Text) do - AddText(Theme.OptionsGraphics.Text[I]); + LoadFromTheme(Theme.OptionsGraphics); AddSelectSlide(Theme.OptionsGraphics.SelectSlideResolution, Ini.Resolution, IResolution); AddSelect(Theme.OptionsGraphics.SelectFullscreen, Ini.Fullscreen, IFullscreen); diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas index 35cb2415..ff03b2ba 100644 --- a/Game/Code/Screens/UScreenOptionsLyrics.pas +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -8,7 +8,7 @@ uses type TScreenOptionsLyrics = class(TMenu) public - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; end; @@ -59,19 +59,13 @@ begin end; end; -constructor TScreenOptionsLyrics.Create(Back: String); +constructor TScreenOptionsLyrics.Create; var I: integer; begin - inherited Create(Back); + inherited Create; - AddBackground(Theme.OptionsLyrics.Background.Tex); - - for I := 0 to High(Theme.OptionsLyrics.Static) do - AddStatic(Theme.OptionsLyrics.Static[I]); - - for I := 0 to High(Theme.OptionsLyrics.Text) do - AddText(Theme.OptionsLyrics.Text[I]); + LoadFromTheme(Theme.OptionsLyrics); AddSelect(Theme.OptionsLyrics.SelectLyricsFont, Ini.LyricsFont, ILyricsFont); AddSelect(Theme.OptionsLyrics.SelectLyricsEffect, Ini.LyricsEffect, ILyricsEffect); diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index 1d09d0b8..af7d2cd6 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -74,20 +74,8 @@ var begin inherited Create; - AddBackground(Theme.OptionsRecord.Background.Tex); - for I := 0 to High(Theme.OptionsRecord.Static) do - AddStatic(Theme.OptionsRecord.Static[I]); + LoadFromTheme(Theme.OptionsRecord); - for I := 0 to High(Theme.OptionsRecord.Text) do - AddText(Theme.OptionsRecord.Text[I]); - -// SetLength(ICard, 0); -// ICard[0] := 'karta'; - -// SetLength(IInput, 0); -// IInput[0] := 'wejscie'; - -// if Length(Recording.SoundCard) > 0 then begin SetLength(ICard, Length(Recording.SoundCard)); for SC := 0 to High(Recording.SoundCard) do ICard[SC] := Recording.SoundCard[SC].Description; diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index aea6cdbc..ee53ef02 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -8,7 +8,7 @@ uses type TScreenOptionsSound = class(TMenu) public - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; end; @@ -59,25 +59,18 @@ begin end; end; -constructor TScreenOptionsSound.Create(Back: String); +constructor TScreenOptionsSound.Create; var I: integer; begin - inherited Create(Back); + inherited Create; - AddBackground(Theme.OptionsSound.Background.Tex); - - for I := 0 to High(Theme.OptionsSound.Static) do - AddStatic(Theme.OptionsSound.Static[I]); - - for I := 0 to High(Theme.OptionsSound.Text) do - AddText(Theme.OptionsSound.Text[I]); + LoadFromTheme(Theme.OptionsSound); AddSelect(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost); AddSelect(Theme.OptionsSound.SelectClickAssist, Ini.ClickAssist, IClickAssist); AddSelect(Theme.OptionsSound.SelectBeatClick, Ini.BeatClick, IBeatClick); AddSelect(Theme.OptionsSound.SelectThreshold, Ini.Threshold, IThreshold); - //AddSelect(Theme.OptionsSound.SelectTwoPlayerMode, Ini.TwoPlayerMode, ITwoPlayerMode); AddButton(Theme.OptionsSound.ButtonExit); if (Length(Button[0].Text)=0) then diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index 151913be..c0bf2e15 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -9,7 +9,7 @@ type TScreenOptionsThemes = class(TMenu) public SkinSelect: Integer; - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure InteractInc; override; @@ -84,19 +84,13 @@ begin end; end; -constructor TScreenOptionsThemes.Create(Back: String); +constructor TScreenOptionsThemes.Create; var I: integer; begin - inherited Create(Back); + inherited Create; - AddBackground(Theme.OptionsThemes.Background.Tex); - - for I := 0 to High(Theme.OptionsThemes.Static) do - AddStatic(Theme.OptionsThemes.Static[I]); - - for I := 0 to High(Theme.OptionsThemes.Text) do - AddText(Theme.OptionsThemes.Text[I]); + LoadFromTheme(Theme.OptionsThemes); AddSelectSlide(Theme.OptionsThemes.SelectTheme, Ini.Theme, ITheme); diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index b268e04f..cf643310 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -116,9 +116,6 @@ var begin inherited Create; - AddBackground(Theme.PartyNewRound.Background.Tex); - Log.LogError(Theme.PartyNewRound.Background.Tex); - TextRound1 := AddText (Theme.PartyNewRound.TextRound1); TextRound2 := AddText (Theme.PartyNewRound.TextRound2); TextRound3 := AddText (Theme.PartyNewRound.TextRound3); @@ -161,15 +158,7 @@ begin StaticTeam2 := AddStatic (Theme.PartyNewRound.StaticTeam2); StaticTeam3 := AddStatic (Theme.PartyNewRound.StaticTeam3); - AddButton (Theme.PartyNewRound.ButtonNext); - - for I := 0 to High(Theme.PartyNewRound.Static) do - AddStatic(Theme.PartyNewRound.Static[I]); - - for I := 0 to High(Theme.PartyNewRound.Text) do - AddText(Theme.PartyNewRound.Text[I]); - - Interaction := 0; + LoadFromTheme(Theme.PartyNewRound); end; procedure TScreenPartyNewRound.onShow; diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index fd7b5107..f0df9871 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -45,37 +45,6 @@ uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UDLLManager, UPlaylist, function TScreenPartyOptions.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; var I, J: Integer; - - function IsVisible: Boolean; - begin - Result := True; - if (Interactions[Interaction].Typ = 0) then - begin - Result := Button[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 1) then - begin - //Result := Selects[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 3) then - begin - Result := SelectsS[Interactions[Interaction].Num].Visible; - end; - end; - - Procedure SelectNext; - begin - repeat - InteractNext; - until IsVisible; - end; - - Procedure SelectPrev; - begin - repeat - InteractPrev; - until IsVisible; - end; begin Result := true; If (PressedDown) Then @@ -137,8 +106,8 @@ begin // Up and Down could be done at the same time, // but I don't want to declare variables inside // functions like this one, called so many times - SDLK_DOWN: SelectNext; - SDLK_UP: SelectPrev; + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; SDLK_RIGHT: begin Music.PlayOption; @@ -193,6 +162,7 @@ begin SetLength(IPlaylist2, 1); IPlaylist2[0] := '---'; + //Clear all Selects NumTeams := 0; NumPlayer1 := 0; NumPlayer2 := 0; @@ -201,7 +171,8 @@ begin PlayList := 0; PlayList2 := 0; - AddBackground(Theme.PartyOptions.Background.Tex); + //Load Screen From Theme + LoadFromTheme(Theme.PartyOptions); SelectLevel := AddSelectSlide (Theme.PartyOptions.SelectLevel, Ini.Difficulty, Theme.ILevel); SelectPlayList := AddSelectSlide (Theme.PartyOptions.SelectPlayList, PlayList, IPlaylist); @@ -212,12 +183,6 @@ begin SelectPlayers2 := AddSelectSlide (Theme.PartyOptions.SelectPlayers2, NumPlayer2, IPlayers); SelectPlayers3 := AddSelectSlide (Theme.PartyOptions.SelectPlayers3, NumPlayer3, IPlayers); - for I := 0 to High(Theme.PartyOptions.Static) do - AddStatic(Theme.PartyOptions.Static[I]); - - for I := 0 to High(Theme.PartyOptions.Text) do - AddText(Theme.PartyOptions.Text[I]); - Interaction := 0; //Hide Team3 Players diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index 02f87710..d6e13d65 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -108,7 +108,7 @@ var begin inherited Create; - AddBackground(Theme.PartyPlayer.Background.Tex); + LoadFromTheme(Theme.PartyPlayer); Team1Name := AddButton(Theme.PartyPlayer.Team1Name); AddButton(Theme.PartyPlayer.Player1Name); @@ -128,12 +128,6 @@ begin AddButton(Theme.PartyPlayer.Player11Name); AddButton(Theme.PartyPlayer.Player12Name); - for I := 0 to High(Theme.PartyPlayer.Static) do - AddStatic(Theme.PartyPlayer.Static[I]); - - for I := 0 to High(Theme.PartyPlayer.Text) do - AddText(Theme.PartyPlayer.Text[I]); - Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index 142ec947..805525a1 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -72,8 +72,6 @@ var begin inherited Create; - AddBackground(Theme.PartyScore.Background.Tex); - TextScoreTeam1 := AddText (Theme.PartyScore.TextScoreTeam1); TextScoreTeam2 := AddText (Theme.PartyScore.TextScoreTeam2); TextScoreTeam3 := AddText (Theme.PartyScore.TextScoreTeam3); @@ -87,11 +85,7 @@ begin TextWinner := AddText (Theme.PartyScore.TextWinner); - for I := 0 to High(Theme.PartyScore.Static) do - AddStatic(Theme.PartyScore.Static[I]); - - for I := 0 to High(Theme.PartyScore.Text) do - AddText(Theme.PartyScore.Text[I]); + LoadFromTheme(Theme.PartyScore); end; procedure TScreenPartyScore.onShow; diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas index ac5f38d9..ff65e82f 100644 --- a/Game/Code/Screens/UScreenPartyWin.pas +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -61,8 +61,6 @@ var begin inherited Create; - AddBackground(Theme.PartyWin.Background.Tex); - TextScoreTeam1 := AddText (Theme.PartyWin.TextScoreTeam1); TextScoreTeam2 := AddText (Theme.PartyWin.TextScoreTeam2); TextScoreTeam3 := AddText (Theme.PartyWin.TextScoreTeam3); @@ -76,11 +74,7 @@ begin TextWinner := AddText (Theme.PartyWin.TextWinner); - for I := 0 to High(Theme.PartyWin.Static) do - AddStatic(Theme.PartyWin.Static[I]); - - for I := 0 to High(Theme.PartyWin.Text) do - AddText(Theme.PartyWin.Text[I]); + LoadFromTheme(Theme.PartyWin); end; procedure TScreenPartyWin.onShow; diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 72c42cb8..af1ccb59 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -40,7 +40,7 @@ type Animation: real; Fadeout: boolean; - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; function Draw: boolean; override; @@ -92,60 +92,14 @@ begin end; end; -constructor TScreenScore.Create(Back: String); +constructor TScreenScore.Create; var P: integer; I, C: integer; begin - inherited Create(Back); + inherited Create; - // background arrows sorted from farthest to nearest -{ AddStatic(-2000 + 400, 100, 360, 60, 1, 1, 1, Skin.Arrow2, 'JPG', 'Arrow'); - AddStatic(-2000 + -50, 200, 420, 70, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); - AddStatic(-2000 + 90, 30, 500, 90, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); - AddStatic(-2000 + -250, 100, 800, 150, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); - - Static[0].Texture.Rot := 100 * pi/180; - Static[1].Texture.Rot := 7 * pi/180; - Static[2].Texture.Rot := 35 * pi/180; - - - // main arrow with text - AddStatic(0, 340, 1000, 180, 1, 1, 1, Skin.Arrow2, 'JPG', 'Arrow'); -// AddText(450, 409, 4, 15, 1, 1, 1, 'Smile'); - AddText(450, 409, 4, 15, 1, 1, 1, 'Let''s see the results'); - Text[0].Y := 401; - - Static[4].Texture.Rot := -3 * pi/180; - - - // two mid arrows - AddStatic(-2000 + -250, 100, 800, 150, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); - AddStatic(-2000 + -250, 100, 800, 150, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); - - - // last arrow - AddStatic(-2000, 340, 1100, 180, 1, 1, 1, Skin.Arrow2, 'JPG', 'Arrow'); -// AddText(-2000, 407, 4, 17, 1, 1, 1, 'SHUFFLE !'); - AddText(-2000, 407, 4, 15, 1, 1, 1, 'SHUFFLE !'); - - Static[7].Texture.Rot := 184 * pi/180; - - // score text - AddText(-2000, 407, 4, 17, 1, 1, 1, '10010 points'); - AddText(-2000, 407, 4, 17, 1, 1, 1, 'Cheater'); - - Fadeout := false;} - - - // Singstar Theme - AddBackground(Theme.Score.Background.Tex); - - for I := 0 to High(Theme.Score.Static) do - AddStatic(Theme.Score.Static[I]); - - for I := 0 to High(Theme.Score.Text) do - AddText(Theme.Score.Text[I]); + LoadFromTheme(Theme.Score); TextArtist := AddText(Theme.Score.TextArtist); TextTitle := AddText(Theme.Score.TextTitle); diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index cca398a1..93c3ac48 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -163,13 +163,7 @@ var begin inherited Create; - AddBackground(Theme.Sing.Background.Tex); - - for I := 0 to High(Theme.Sing.Static) do - AddStatic(Theme.Sing.Static[I]); - - for I := 0 to High(Theme.Sing.Text) do - AddText(Theme.Sing.Text[I]); + LoadFromTheme(Theme.Sing); // time TextTime := AddText(75, 14, 1, 8, 0.25, 0.25, 0.25, '00:00'); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 16ac46ab..5c383168 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -630,13 +630,7 @@ begin // AddStatic(200, 10, 400, 90, Skin.SelectSong); // AddStatic(200-10, 140-5, 400+20, 50+10, Skin.Selection, 'JPG', 'Font Gray'); - AddBackground(Theme.Song.Background.Tex); - - for I := 0 to High(Theme.Song.Static) do - AddStatic(Theme.Song.Static[I]); - - for I := 0 to High(Theme.Song.Text) do - AddText(Theme.Song.Text[I]); + LoadFromTheme(Theme.Song); TextArtist := AddText(Theme.Song.TextArtist); TextTitle := AddText(Theme.Song.TextTitle); diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 123146c7..b90c558b 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -154,7 +154,9 @@ var begin inherited Create; - AddBackground(Theme.SongJumpto.Background.Tex); + AddText(Theme.SongJumpto.TextFound); + + LoadFromTheme(Theme.SongJumpto); AddButton(Theme.SongJumpto.ButtonSearchText); if (Length(Button[0].Text) = 0) then @@ -163,13 +165,6 @@ begin SelectType := 0; AddSelectSlide(Theme.SongJumpto.SelectSlideType, SelectType, Theme.SongJumpto.IType); - AddText(Theme.SongJumpto.TextFound); - - for I := 0 to High(Theme.SongJumpto.Static) do - AddStatic(Theme.SongJumpto.Static[I]); - - for I := 0 to High(Theme.SongJumpto.Text) do - AddText(Theme.SongJumpto.Text[I]); Interaction := 0; LastPlayed := 0; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index d4ad8016..fd875527 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -45,36 +45,6 @@ implementation uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist; function TScreenSongMenu.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; - function IsVisible: Boolean; - begin - Result := True; - if (Interactions[Interaction].Typ = 0) then - begin - Result := Button[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 1) then - begin - //Result := Selects[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 3) then - begin - Result := SelectsS[Interactions[Interaction].Num].Visible; - end; - end; - - Procedure SelectNext; - begin - repeat - InteractNext; - until IsVisible; - end; - - Procedure SelectPrev; - begin - repeat - InteractPrev; - until IsVisible; - end; begin Result := true; If (PressedDown) Then @@ -113,8 +83,8 @@ begin HandleReturn; end; - SDLK_DOWN: SelectNext; - SDLK_UP: SelectPrev; + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; SDLK_RIGHT: begin @@ -141,10 +111,15 @@ var I: integer; begin inherited Create; + + //Create Dummy SelectSlide Entrys SetLength(ISelections, 1); ISelections[0] := 'Dummy'; - AddBackground(Theme.SongMenu.Background.Tex); + + AddText(Theme.SongMenu.TextMenu); + + LoadFromTheme(Theme.SongMenu); AddButton(Theme.SongMenu.Button1); if (Length(Button[0].Text) = 0) then @@ -164,13 +139,6 @@ begin if (Length(Button[3].Text) = 0) then AddButtonText(14, 20, 'Button 4'); - AddText(Theme.SongMenu.TextMenu); - - for I := 0 to High(Theme.SongMenu.Static) do - AddStatic(Theme.SongMenu.Static[I]); - - for I := 0 to High(Theme.SongMenu.Text) do - AddText(Theme.SongMenu.Text[I]); Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenStatDetail.pas b/Game/Code/Screens/UScreenStatDetail.pas index dc4a0f1f..1461a9da 100644 --- a/Game/Code/Screens/UScreenStatDetail.pas +++ b/Game/Code/Screens/UScreenStatDetail.pas @@ -102,7 +102,15 @@ var begin inherited Create; - AddBackground(Theme.StatDetail.Background.Tex); + for I := 0 to High(Theme.StatDetail.TextList) do + AddText(Theme.StatDetail.TextList[I]); + + Count := Length(Theme.StatDetail.TextList); + + AddText(Theme.StatDetail.TextDescription); + AddText(Theme.StatDetail.TextPage); + + LoadFromTheme(Theme.StatDetail); AddButton(Theme.StatDetail.ButtonNext); if (Length(Button[0].Text)=0) then @@ -120,22 +128,6 @@ begin if (Length(Button[3].Text)=0) then AddButtonText(14, 20, Theme.Options.Description[7]); - for I := 0 to High(Theme.StatDetail.TextList) do - AddText(Theme.StatDetail.TextList[I]); - - Count := Length(Theme.StatDetail.TextList); - - AddText(Theme.StatDetail.TextDescription); - AddText(Theme.StatDetail.TextPage); - - for I := 0 to High(Theme.StatDetail.Static) do - AddStatic(Theme.StatDetail.Static[I]); - - for I := 0 to High(Theme.StatDetail.Text) do - AddText(Theme.StatDetail.Text[I]); - - - Interaction := 0; Typ := 0; end; 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 diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas index 94f3de1e..4d542bf0 100644 --- a/Game/Code/Screens/UScreenTop5.pas +++ b/Game/Code/Screens/UScreenTop5.pas @@ -58,13 +58,7 @@ var begin inherited Create; - AddBackground(Theme.Top5.Background.Tex); - - for I := 0 to High(Theme.Top5.Static) do - AddStatic(Theme.Top5.Static[I]); - - for I := 0 to High(Theme.Top5.Text) do - AddText(Theme.Top5.Text[I]); + LoadFromTheme(Theme.Top5); TextLevel := AddText(Theme.Top5.TextLevel); diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 0db37635..b7466d84 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -6,6 +6,9 @@ program UltraStar; {$R 'UltraStar.res' 'UltraStar.rc'} uses + //------------------------------ + //Includes - Menu System + //------------------------------ UDisplay in 'Menu\UDisplay.pas', UMenu in 'Menu\UMenu.pas', UMenuStatic in 'Menu\UMenuStatic.pas', @@ -15,6 +18,11 @@ uses UMenuSelect in 'Menu\UMenuSelect.pas', UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', UDrawTexture in 'Menu\UDrawTexture.pas', + UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', + + //------------------------------ + //Includes - Classes + //------------------------------ UGraphic in 'Classes\UGraphic.pas', UTexture in 'Classes\UTexture.pas', UMusic in 'Classes\UMusic.pas', @@ -43,6 +51,10 @@ uses UDLLManager in 'Classes\UDLLManager.pas', UParty in 'Classes\UParty.pas', UPlaylist in 'Classes\UPlaylist.pas', + + //------------------------------ + //Includes - Screens + //------------------------------ UScreenLoading in 'Screens\UScreenLoading.pas', UScreenWelcome in 'Screens\UScreenWelcome.pas', UScreenMain in 'Screens\UScreenMain.pas', @@ -69,14 +81,26 @@ uses UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', UScreenStatMain in 'Screens\UScreenStatMain.pas', UScreenStatDetail in 'Screens\UScreenStatDetail.pas', + UScreenCredits in 'Screens\UScreenCredits.pas', + + //------------------------------ + //Includes - Screens PartyMode + //------------------------------ UScreenSingModi in 'Screens\UScreenSingModi.pas', UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', UScreenPartyScore in 'Screens\UScreenPartyScore.pas', UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', UScreenPartyWin in 'Screens\UScreenPartyWin.pas', + + //------------------------------ + //Includes - Modi SDK + //------------------------------ ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', - UScreenCredits in 'Screens\UScreenCredits.pas', + + //------------------------------ + //Includes - Delphi + //------------------------------ Windows, SDL, SysUtils; -- cgit v1.2.3 From cc06446d0a651113083478fda94dfaa9a25d1d7e Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 29 Apr 2007 18:29:42 +0000 Subject: Commented some Debuging Outputs in ULog Fixed a Bug in ButtonCollection that causes a Crash when UpButton is Pressed at the Last Button Added ShortCut E in MainMenu for Editor git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@150 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/ULog.pas | 10 +++++----- Game/Code/Menu/UMenu.pas | 2 +- Game/Code/Screens/UScreenMain.pas | 6 ++++++ 3 files changed, 12 insertions(+), 6 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index 6bffa04e..0b492cb3 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -139,7 +139,7 @@ var Miliseconds: integer; ValueText: string; begin - if Ini.Debug = 1 then begin + //if Ini.Debug = 1 then begin if not FileAnalyzeO then begin AssignFile(FileAnalyze, LogPath + 'Analyze.log'); @@ -154,7 +154,7 @@ begin Flush(FileAnalyze); // try to speed up end; - end; + //end; end; procedure TLog.LogError(Text: string); @@ -202,8 +202,9 @@ end; procedure TLog.LogStatus(Log1, Log2: string); begin -//asd - LogError (Log2 + ': ' + Log1); + //Just for Debugging + //Comment for Release + //LogAnalyze (Log2 + ': ' + Log1); end; procedure TLog.LogError(Log1, Log2: string); @@ -224,4 +225,3 @@ begin end; end. - \ No newline at end of file diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index fc217dba..c30b5c5c 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -1367,7 +1367,7 @@ begin begin InteractPrev; //If ButtonCollection with more than 1 Entry then Select Last Entry - if (ButtonCollection[Button[Interactions[Interaction].Num].Parent-1].CountChilds > 1) then + if (Button[Interactions[Interaction].Num].Parent <> 0) AND (ButtonCollection[Button[Interactions[Interaction].Num].Parent-1].CountChilds > 1) then begin //Select Last Child For Num := High(Button) downto 1 do diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 49bd98ee..78c98218 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -84,6 +84,12 @@ begin FadeTo(@ScreenStatMain); end; + SDLK_E: + begin + Music.PlayStart; + FadeTo(@ScreenEdit); + end; + SDLK_RETURN: begin //Solo -- cgit v1.2.3 From 37f734e1943563ca121791eabb9bff067a591e3d Mon Sep 17 00:00:00 2001 From: mota23 Date: Mon, 30 Apr 2007 09:24:50 +0000 Subject: Added new Static to ScreenPartyNewRound. Some Themework in Party-Mode. Still needs work. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@151 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 6 ++++++ Game/Code/Screens/UScreenPartyNewRound.pas | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 31081f23..414da72f 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -520,6 +520,9 @@ type StaticTeam1: TThemeStatic; StaticTeam2: TThemeStatic; StaticTeam3: TThemeStatic; + StaticNextPlayer1: TThemeStatic; + StaticNextPlayer2: TThemeStatic; + StaticNextPlayer3: TThemeStatic; ButtonNext: TThemeButton; end; @@ -1214,6 +1217,9 @@ begin ThemeLoadStatic (PartyNewRound.StaticTeam1, 'PartyNewRoundStaticTeam1'); ThemeLoadStatic (PartyNewRound.StaticTeam2, 'PartyNewRoundStaticTeam2'); ThemeLoadStatic (PartyNewRound.StaticTeam3, 'PartyNewRoundStaticTeam3'); + ThemeLoadStatic (PartyNewRound.StaticNextPlayer1, 'PartyNewRoundStaticNextPlayer1'); + ThemeLoadStatic (PartyNewRound.StaticNextPlayer2, 'PartyNewRoundStaticNextPlayer2'); + ThemeLoadStatic (PartyNewRound.StaticNextPlayer3, 'PartyNewRoundStaticNextPlayer3'); ThemeLoadButton (PartyNewRound.ButtonNext, 'PartyNewRoundButtonNext'); diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index cf643310..8c1b8369 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -30,6 +30,7 @@ type TextNextPlayer1: Cardinal; TextNextPlayer2: Cardinal; TextNextPlayer3: Cardinal; + //Statics StaticRound1: Cardinal; StaticRound2: Cardinal; @@ -50,6 +51,12 @@ type StaticTeam1: Cardinal; StaticTeam2: Cardinal; StaticTeam3: Cardinal; + StaticNextPlayer1: Cardinal; + StaticNextPlayer2: Cardinal; + StaticNextPlayer3: Cardinal; + + + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; @@ -157,6 +164,9 @@ begin StaticTeam1 := AddStatic (Theme.PartyNewRound.StaticTeam1); StaticTeam2 := AddStatic (Theme.PartyNewRound.StaticTeam2); StaticTeam3 := AddStatic (Theme.PartyNewRound.StaticTeam3); + StaticNextPlayer1 := AddStatic (Theme.PartyNewRound.StaticNextPlayer1); + StaticNextPlayer2 := AddStatic (Theme.PartyNewRound.StaticNextPlayer2); + StaticNextPlayer3 := AddStatic (Theme.PartyNewRound.StaticNextPlayer3); LoadFromTheme(Theme.PartyNewRound); end; @@ -297,12 +307,14 @@ begin Text[TextScoreTeam1].Visible := True; Text[TextNameTeam1].Visible := True; Static[StaticTeam1].Visible := True; + Static[StaticNextPlayer1].Visible := True; end else begin Text[TextScoreTeam1].Visible := False; Text[TextNameTeam1].Visible := False; Static[StaticTeam1].Visible := False; + Static[StaticNextPlayer1].Visible := False; end; if (PartySession.Teams.NumTeams >= 2) then @@ -313,12 +325,14 @@ begin Text[TextScoreTeam2].Visible := True; Text[TextNameTeam2].Visible := True; Static[StaticTeam2].Visible := True; + Static[StaticNextPlayer2].Visible := True; end else begin Text[TextScoreTeam2].Visible := False; Text[TextNameTeam2].Visible := False; Static[StaticTeam2].Visible := False; + Static[StaticNextPlayer2].Visible := False; end; if (PartySession.Teams.NumTeams >= 3) then @@ -329,12 +343,14 @@ begin Text[TextScoreTeam3].Visible := True; Text[TextNameTeam3].Visible := True; Static[StaticTeam3].Visible := True; + Static[StaticNextPlayer3].Visible := True; end else begin Text[TextScoreTeam3].Visible := False; Text[TextNameTeam3].Visible := False; Static[StaticTeam3].Visible := False; + Static[StaticNextPlayer3].Visible := False; end; //nextRound Texts -- cgit v1.2.3 From 5737662e749229ef0631e3731858a5bf013c78eb Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 30 Apr 2007 12:30:35 +0000 Subject: Added ability to make buttons invisible(and also unselectable) in Theme. Visible = 0 Useful for f.e. the Exit Button from MainScreen Fixed a bug in PartyNewRoundScreen that causes a crash when an Arrow Button is pressed git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@152 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 5 +++++ Game/Code/Menu/UMenu.pas | 5 ++++- Game/Code/Screens/UScreenPartyNewRound.pas | 8 -------- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 414da72f..47c1abf1 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -131,6 +131,9 @@ type DInt: real; Tex: string; Typ: string; + + Visible: Boolean; + //Reflection Mod Reflection: boolean; Reflectionspacing: Real; @@ -1530,6 +1533,8 @@ begin ThemeButton.DColB := Color[C].RGB.B; end; + ThemeButton.Visible := (ThemeIni.ReadInteger(Name, 'Visible', 1) = 1); + //Fade Mod ThemeButton.SelectH := ThemeIni.ReadInteger (Name, 'SelectH', ThemeButton.H); ThemeButton.SelectW := ThemeIni.ReadInteger (Name, 'SelectW', ThemeButton.W); diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index c30b5c5c..4ad8270a 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -528,6 +528,9 @@ begin Button[Result].Z := ThemeButton.Z; + //Button Visibility + Button[Result].Visible := ThemeButton.Visible; + //Some Things from ButtonFading Button[Result].SelectH := ThemeButton.SelectH; Button[Result].SelectW := ThemeButton.SelectW; @@ -574,7 +577,7 @@ end; function TMenu.AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean; ReflectionSpacing, DeSelectReflectionSpacing: Real): integer; begin // adds button - //SetLength is used to reduce Memory usement + //SetLength is used once to reduce Memory usement if (ButtonPos <> -1) then begin Result := ButtonPos; diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 8c1b8369..09391438 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -99,14 +99,6 @@ begin FadeTo(@ScreenSingModi); end; end; - - // Up and Down could be done at the same time, - // but I don't want to declare variables inside - // functions like this one, called so many times - SDLK_DOWN: InteractNext; - SDLK_UP: InteractPrev; - SDLK_RIGHT: InteractNext; - SDLK_LEFT: InteractPrev; end; end else // Key Up -- cgit v1.2.3 From ac508bab2e69d6ed7987c23f383ed503a310785c Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 30 Apr 2007 15:50:23 +0000 Subject: Added new Object to PartyNewRound Screen TextTeam[1..3]Players: Text shows the Players of the Team git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@153 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 12 ++++++---- Game/Code/Screens/UScreenPartyNewRound.pas | 36 ++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 6 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 47c1abf1..6004502e 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -520,14 +520,16 @@ type TextNameTeam1: TThemeText; TextNameTeam2: TThemeText; TextNameTeam3: TThemeText; + TextTeam1Players: TThemeText; + TextTeam2Players: TThemeText; + TextTeam3Players: TThemeText; + StaticTeam1: TThemeStatic; StaticTeam2: TThemeStatic; StaticTeam3: TThemeStatic; StaticNextPlayer1: TThemeStatic; StaticNextPlayer2: TThemeStatic; StaticNextPlayer3: TThemeStatic; - - ButtonNext: TThemeButton; end; TThemePartyScore = class(TThemeBasic) @@ -1217,6 +1219,10 @@ begin ThemeLoadText (PartyNewRound.TextNameTeam2, 'PartyNewRoundTextNameTeam2'); ThemeLoadText (PartyNewRound.TextNameTeam3, 'PartyNewRoundTextNameTeam3'); + ThemeLoadText (PartyNewRound.TextTeam1Players, 'PartyNewRoundTextTeam1Players'); + ThemeLoadText (PartyNewRound.TextTeam2Players, 'PartyNewRoundTextTeam2Players'); + ThemeLoadText (PartyNewRound.TextTeam3Players, 'PartyNewRoundTextTeam3Players'); + ThemeLoadStatic (PartyNewRound.StaticTeam1, 'PartyNewRoundStaticTeam1'); ThemeLoadStatic (PartyNewRound.StaticTeam2, 'PartyNewRoundStaticTeam2'); ThemeLoadStatic (PartyNewRound.StaticTeam3, 'PartyNewRoundStaticTeam3'); @@ -1224,8 +1230,6 @@ begin ThemeLoadStatic (PartyNewRound.StaticNextPlayer2, 'PartyNewRoundStaticNextPlayer2'); ThemeLoadStatic (PartyNewRound.StaticNextPlayer3, 'PartyNewRoundStaticNextPlayer3'); - ThemeLoadButton (PartyNewRound.ButtonNext, 'PartyNewRoundButtonNext'); - //Party Score ThemeLoadBasic(PartyScore, 'PartyScore'); diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 09391438..22f76218 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -48,6 +48,10 @@ type TextNameTeam2: Cardinal; TextNameTeam3: Cardinal; + TextTeam1Players: Cardinal; + TextTeam2Players: Cardinal; + TextTeam3Players: Cardinal; + StaticTeam1: Cardinal; StaticTeam2: Cardinal; StaticTeam3: Cardinal; @@ -153,6 +157,11 @@ begin TextNameTeam2 := AddText (Theme.PartyNewRound.TextNameTeam2); TextNameTeam3 := AddText (Theme.PartyNewRound.TextNameTeam3); + //Players + TextTeam1Players := AddText (Theme.PartyNewRound.TextTeam1Players); + TextTeam2Players := AddText (Theme.PartyNewRound.TextTeam2Players); + TextTeam3Players := AddText (Theme.PartyNewRound.TextTeam3Players); + StaticTeam1 := AddStatic (Theme.PartyNewRound.StaticTeam1); StaticTeam2 := AddStatic (Theme.PartyNewRound.StaticTeam2); StaticTeam3 := AddStatic (Theme.PartyNewRound.StaticTeam3); @@ -166,6 +175,22 @@ end; procedure TScreenPartyNewRound.onShow; var I: Integer; + function GetTeamPlayers(const Num: Byte): String; + var + Players: Array of String; + J: Byte; + begin + if (Num-1 >= PartySession.Teams.NumTeams) then + exit; + + //Create Players Array + SetLength(Players, PartySession.Teams.TeamInfo[Num-1].NumPlayers); + For J := 0 to PartySession.Teams.TeamInfo[Num-1].NumPlayers-1 do + Players[J] := String(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name); + + //Implode and Return + Result := Language.Implode(Players); + end; begin PartySession.StartRound; @@ -295,9 +320,11 @@ begin begin Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[0].Score); Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[0].Name); + Text[TextTeam1Players].Text := GetTeamPlayers(1); Text[TextScoreTeam1].Visible := True; Text[TextNameTeam1].Visible := True; + Text[TextTeam1Players].Visible := True; Static[StaticTeam1].Visible := True; Static[StaticNextPlayer1].Visible := True; end @@ -305,6 +332,7 @@ begin begin Text[TextScoreTeam1].Visible := False; Text[TextNameTeam1].Visible := False; + Text[TextTeam1Players].Visible := False; Static[StaticTeam1].Visible := False; Static[StaticNextPlayer1].Visible := False; end; @@ -313,9 +341,11 @@ begin begin Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[1].Score); Text[TextNameTeam2].Text := String(PartySession.Teams.TeamInfo[1].Name); + Text[TextTeam2Players].Text := GetTeamPlayers(2); Text[TextScoreTeam2].Visible := True; Text[TextNameTeam2].Visible := True; + Text[TextTeam2Players].Visible := True; Static[StaticTeam2].Visible := True; Static[StaticNextPlayer2].Visible := True; end @@ -323,6 +353,7 @@ begin begin Text[TextScoreTeam2].Visible := False; Text[TextNameTeam2].Visible := False; + Text[TextTeam2Players].Visible := False; Static[StaticTeam2].Visible := False; Static[StaticNextPlayer2].Visible := False; end; @@ -331,9 +362,11 @@ begin begin Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[2].Score); Text[TextNameTeam3].Text := String(PartySession.Teams.TeamInfo[2].Name); + Text[TextTeam3Players].Text := GetTeamPlayers(3); Text[TextScoreTeam3].Visible := True; Text[TextNameTeam3].Visible := True; + Text[TextTeam3Players].Visible := True; Static[StaticTeam3].Visible := True; Static[StaticNextPlayer3].Visible := True; end @@ -341,6 +374,7 @@ begin begin Text[TextScoreTeam3].Visible := False; Text[TextNameTeam3].Visible := False; + Text[TextTeam3Players].Visible := False; Static[StaticTeam3].Visible := False; Static[StaticNextPlayer3].Visible := False; end; @@ -372,8 +406,6 @@ begin else Text[TextNextPlayer3].Visible := False; - Log.LogError('Plugin Selected: ' + InttoStr(PartySession.Rounds[0].Plugin)); - // LCD.WriteText(1, ' Choose mode: '); // UpdateLCD; -- cgit v1.2.3 From dfa0f5a144b8bf018b29d801f7d8a7c54ae6d108 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 2 May 2007 17:44:23 +0000 Subject: 2 Bugs Fixed: Select Last Song instead First Song when showing Song Screen for the first Time Go to MainScreen instead of Song Screen when pressing Esc in the Name Screen after Selecting Select Players from Menu git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@154 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlaylist.pas | 1 + Game/Code/Screens/UScreenName.pas | 5 ++++- Game/Code/Screens/UScreenSong.pas | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlaylist.pas b/Game/Code/Classes/UPlaylist.pas index a6207c4f..15e17047 100644 --- a/Game/Code/Classes/UPlaylist.pas +++ b/Game/Code/Classes/UPlaylist.pas @@ -217,6 +217,7 @@ begin end; finally + log.LogError('Could not write Playlistfile "' + Playlists[Index].Name + '"'); CloseFile(F); end; end; diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index 9819b994..9db7947c 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -41,7 +41,10 @@ begin begin Ini.SaveNames; Music.PlayBack; - FadeTo(@ScreenMain); + if GoTo_SingScreen then + FadeTo(@ScreenSong) + else + FadeTo(@ScreenMain); end; SDLK_RETURN: diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 5c383168..1f3c7c8f 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1169,7 +1169,7 @@ begin if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then begin CatSongs.ShowCategoryList; - SelectNext;SelectPrev; //Workaround <- must be fixed sometime + SelectNext; //Workaround <- must be fixed sometime FixSelected; //Show Cat in Top Left Mod HideCatTL; -- cgit v1.2.3 From 79c50bf9f8b6ae2046deaa401005944e2ce4d17b Mon Sep 17 00:00:00 2001 From: b1indy Date: Wed, 2 May 2007 19:37:02 +0000 Subject: popup-screen will be included soon git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@155 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenPopup.pas | 165 +++++++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 Game/Code/Screens/UScreenPopup.pas (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas new file mode 100644 index 00000000..41279197 --- /dev/null +++ b/Game/Code/Screens/UScreenPopup.pas @@ -0,0 +1,165 @@ +unit UScreenPopup; + +interface + +uses + UMenu, SDL, UMusic, UPliki, SysUtils, UThemes, dialogs, Messages; + +type + TScreenPopup = class(TMenu) + private + CurMenu: Byte; //Num of the cur. Shown Menu + public + Visible: Boolean; //Whether the Menu should be Drawn + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure ShowPopup(sPopup: Byte); + function Draw: boolean; override; + end; + +const + PU_Error = 1; + + +var + ISelections: Array of String; + SelectValue: Integer; + + +implementation + +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist; + +function TScreenPopup.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; + function IsVisible: Boolean; + begin + Result := True; + if (Interactions[Interaction].Typ = 0) then + begin + Result := Button[Interactions[Interaction].Num].Visible; + end + else if (Interactions[Interaction].Typ = 1) then + begin + //Result := Selects[Interactions[Interaction].Num].Visible; + end + else if (Interactions[Interaction].Typ = 3) then + begin + Result := SelectsS[Interactions[Interaction].Num].Visible; + end; + end; + + Procedure SelectNext; + begin + repeat + InteractNext; + until IsVisible; + end; + + Procedure SelectPrev; + begin + repeat + InteractPrev; + until IsVisible; + end; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE : + begin + Result := false; + end; + + SDLK_RETURN: + begin + Visible:=False; + Result := false; + end; + + SDLK_DOWN: SelectNext; + SDLK_UP: SelectPrev; + + SDLK_RIGHT: SelectNext; + SDLK_LEFT: SelectPrev; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN : + begin + end; + end; +end; + +constructor TScreenPopup.Create; +var + I: integer; +begin + inherited Create; + SetLength(ISelections, 1); + ISelections[0] := 'Dummy'; + + AddBackground(Theme.CheckPopup.Background.Tex); + + AddButton(Theme.CheckPopup.Button1); + if (Length(Button[0].Text) = 0) then + AddButtonText(14, 20, 'Button 1'); + + AddButton(Theme.CheckPopup.Button2); + if (Length(Button[1].Text) = 0) then + AddButtonText(14, 20, 'Button 2'); + + AddText(Theme.CheckPopup.TextCheck); + + for I := 0 to High(Theme.CheckPopup.Static) do + AddStatic(Theme.CheckPopup.Static[I]); + + for I := 0 to High(Theme.CheckPopup.Text) do + AddText(Theme.CheckPopup.Text[I]); + + Interaction := 0; +end; + +function TScreenPopup.Draw: boolean; +begin + inherited Draw; +end; + +procedure TScreenPopup.onShow; +begin + +end; + +procedure TScreenPopup.ShowPopup(sPopup: Byte); +begin + Interaction := 0; //Reset Interaction + Visible := True; //Set Visible + Case sPopup of + PU_Error: + begin + Text[0].Text := 'Wirklich beenden?';{Language.Translate('SONG_MENU_NAME_MAIN');} + + Button[0].Visible := True; + Button[1].Visible := True; +// Button[2].Visible := True; +// Button[3].Visible := True; +// SelectsS[0].Visible := False; + + Button[0].Text[0].Text := 'JA'; + Button[1].Text[0].Text := 'NEIN'; +// Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD'); +// Button[3].Text[0].Text := Language.Translate('SONG_MENU_EDIT'); + end; + end; +end; + +end. \ No newline at end of file -- cgit v1.2.3 From 5bf0ebf274fef28811ab952338bd261bd1dd0fa8 Mon Sep 17 00:00:00 2001 From: b1indy Date: Thu, 3 May 2007 00:19:52 +0000 Subject: added "popups" to ask for confirmation when leaving party mode or game or to display messages (like minor errors) still ugly, needs some theme work git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@157 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphic.pas | 11 +- Game/Code/Classes/UMain.pas | 9 +- Game/Code/Classes/UThemes.pas | 28 ++++ Game/Code/Menu/UDisplay.pas | 40 +++++- Game/Code/Menu/UMenu.pas | 19 ++- Game/Code/Screens/UScreenMain.pas | 10 +- Game/Code/Screens/UScreenPartyNewRound.pas | 2 +- Game/Code/Screens/UScreenPopup.pas | 204 ++++++++++++++++++++++++----- Game/Code/UltraStar.dpr | 3 +- 9 files changed, 276 insertions(+), 50 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 39eea53d..8b17a73d 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -9,7 +9,8 @@ uses UScreenEdit, UScreenEditConvert, UScreenEditHeader, UScreenOpen, UThemes, USkins, UScreenSongMenu, UScreenSongJumpto, {Party Screens} UScreenSingModi, UScreenPartyNewRound, UScreenPartyScore, UScreenPartyOptions, UScreenPartyWin, UScreenPartyPlayer, {Stats Screens} UScreenStatMain, UScreenStatDetail, - {CreditsScreen} UScreenCredits; + {CreditsScreen} UScreenCredits, + {Popup for errors, etc.} UScreenPopup; type TRecR = record @@ -71,6 +72,10 @@ var //CreditsScreen ScreenCredits: TScreenCredits; + //popup mod + ScreenPopupCheck: TScreenPopupCheck; + ScreenPopupError: TScreenPopupError; + //Notes Tex_Left: array[0..6] of TTexture; Tex_Mid: array[0..6] of TTexture; @@ -433,6 +438,10 @@ begin Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongMenu', 3); Log.BenchmarkStart(3); ScreenSongJumpto := TScreenSongJumpto.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongJumpto', 3); Log.BenchmarkStart(3); + ScreenPopupCheck := TScreenPopupCheck.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Popup (Check)', 3); Log.BenchmarkStart(3); + ScreenPopupError := TScreenPopupError.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Popup (Error)', 3); Log.BenchmarkStart(3); ScreenPartyNewRound := TScreenPartyNewRound.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyNewRound', 3); Log.BenchmarkStart(3); ScreenPartyScore := TScreenPartyScore.Create; diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index c9002a36..69eca419 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -2,7 +2,7 @@ unit UMain; interface uses SDL, UGraphic, UMusic, URecord, UTime, SysUtils, UDisplay, UIni, ULog, ULyrics, UScreenSing, - OpenGL12, zlportio {you can disable it and all PortWriteB calls}, ULCD, ULight, UThemes; + OpenGL12, zlportio {you can disable it and all PortWriteB calls}, ULCD, ULight, UThemes{, UScreenPopup}; type TPlayer = record @@ -112,7 +112,7 @@ begin CheckEvents; // display - Display.Draw; + done:=not Display.Draw; SwapBuffers; // light @@ -156,6 +156,11 @@ Begin End; // With} SDL_KEYDOWN: begin + // popup hack... if there is a visible popup then let it handle input instead of underlying screen + // shoud be done in a way to be sure the topmost popup has preference (maybe error, then check) + if ScreenPopupError <> NIL then if ScreenPopupError.Visible then ScreenPopupError.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) else + if ScreenPopupCheck <> NIL then if ScreenPopupCheck.Visible then ScreenPopupCheck.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) else + // end of popup hack if (Not Display.ActualScreen^.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True)) then // if (Not Display.ActualScreen^.ParseInput(Event.key.keysym.scancode, True)) then done := true; // exit game diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 6004502e..ee88ca9c 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -460,6 +460,19 @@ type ButtonExit: TThemeButton; end; + //Error- and Check-Popup + TThemeError = class(TThemeBasic) + Button1: TThemeButton; + TextError: TThemeText; + end; + + TThemeCheck = class(TThemeBasic) + Button1: TThemeButton; + Button2: TThemeButton; + TextCheck: TThemeText; + end; + + //ScreenSong Menue TThemeSongMenu = class(TThemeBasic) Button1: TThemeButton; @@ -656,6 +669,9 @@ type OptionsThemes: TThemeOptionsThemes; OptionsRecord: TThemeOptionsRecord; OptionsAdvanced: TThemeOptionsAdvanced; + //error and check popup + ErrorPopup: TThemeError; + CheckPopup: TThemeCheck; //ScreenSong extensions SongMenu: TThemeSongMenu; SongJumpto: TThemeSongJumpTo; @@ -750,6 +766,9 @@ begin OptionsRecord := TThemeOptionsRecord.Create; OptionsAdvanced := TThemeOptionsAdvanced.Create; + ErrorPopup := TThemeError.Create; + CheckPopup := TThemeCheck.Create; + SongMenu := TThemeSongMenu.Create; SongJumpto := TThemeSongJumpto.Create; //Party Screens @@ -1157,6 +1176,15 @@ begin ThemeLoadSelect (OptionsAdvanced.SelectAskbeforeDel, 'OptionsAdvancedSelectAskbeforeDel'); ThemeLoadButton (OptionsAdvanced.ButtonExit, 'OptionsAdvancedButtonExit'); + //error and check popup + ThemeLoadBasic (ErrorPopup, 'ErrorPopup'); + ThemeLoadButton(ErrorPopup.Button1, 'ErrorPopupButton1'); + ThemeLoadText (ErrorPopup.TextError,'ErrorPopupText'); + ThemeLoadBasic (CheckPopup, 'CheckPopup'); + ThemeLoadButton(CheckPopup.Button1, 'CheckPopupButton1'); + ThemeLoadButton(CheckPopup.Button2, 'CheckPopupButton2'); + ThemeLoadText(CheckPopup.TextCheck , 'CheckPopupText'); + //Song Menu ThemeLoadBasic (SongMenu, 'SongMenu'); ThemeLoadButton(SongMenu.Button1, 'SongMenuButton1'); diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index 19266414..428cc6c7 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -2,12 +2,15 @@ unit UDisplay; interface -uses Windows, SDL, UMenu, OpenGL12, SysUtils, dialogs; +uses Windows, SDL, UMenu, OpenGL12, SysUtils; type TDisplay = class ActualScreen: PMenu; NextScreen: PMenu; + //popup hack + NextScreenWithCheck: Pmenu; + CheckOK: Boolean; h_DC: HDC; h_RC: HGLRC; @@ -45,6 +48,11 @@ var i: integer; begin inherited Create; + //popup hack + CheckOK:=False; + NextScreen:=NIL; + NextScreenWithCheck:=NIL; + // fade mod myfade:=0; @@ -75,10 +83,6 @@ begin canFade:=False; end; FreeMem(pTexData); - if not canFade then begin - showmessage('Fehler beim Initialisieren der Fading-Textur... Fading deaktiviert'); - doFade:=False; - end // end end; @@ -120,9 +124,26 @@ begin if S = 2 then TimeSkip := 0 else; glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); + //popup hack + // check was successful... move on + if CheckOK then + if assigned (NextScreenWithCheck)then + begin + NextScreen:=NextScreenWithCheck; + NextScreenWithCheck := NIL; + CheckOk:=False; + end + else + Result:=False; + //end popup hack + // ActualScreen.SetAnimationProgress(1); if not assigned (NextScreen) then begin - Result := ActualScreen.Draw; + ActualScreen.Draw; + //popup mod + if ScreenPopupError <> NIL then if ScreenPopupError.Visible then ScreenPopupError.Draw else + if ScreenPopupCheck <> NIL then if ScreenPopupCheck.Visible then ScreenPopupCheck.Draw; + //popup end // fade mod myfade:=0; if (Ini.ScreenFade=1) and canFade then @@ -133,6 +154,11 @@ begin end else begin + // check if we had an initialization error (canfade=false, dofade=true) + if doFade and not canFade then begin + doFade:=False; //disable fading + ScreenPopupError.ShowPopup(['Error initializing','fade texture','','fading','disabled']); //show error message + end; if doFade and canFade then begin // fade mod @@ -146,7 +172,7 @@ begin if glGetError <> GL_NO_ERROR then begin canFade := False; - showmessage('Fehler beim Kopieren der Fade-Textur... Fading deaktiviert'); + ScreenPopupError.ShowPopup(['Error copying','fade texture','','fading','disabled']); //show error message end; glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); NextScreen.onShow; diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 4ad8270a..c9d3c726 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -12,7 +12,7 @@ type TMenu = class protected ButtonPos: Integer; - + Interactions: array of TInteract; SelInteraction: integer; Button: array of TButton; @@ -29,7 +29,7 @@ type mY: integer; // mouse Y Fade: integer; // fade type - ShowFinish: boolean; // true if there is no fade + ShowFinish: boolean; // true if there is no fade destructor Destroy; override; @@ -47,7 +47,7 @@ type procedure PrepareButtonCollections(const Collections: AThemeButtonCollection); procedure AddButtonCollection(const ThemeCollection: TThemeButtonCollection; Const Num: Byte); - + // background procedure AddBackground(Name: string); @@ -68,7 +68,7 @@ type function AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; Tekst: string): integer; overload; // button - Procedure SetButtonLength(Length: Cardinal); //Function that Set Length of Button Array in one Step instead of register new Memory for every Button + Procedure SetButtonLength(Length: Cardinal); //Function that Set Length of Button Array in one Step instead of register new Memory for every Button function AddButton(ThemeButton: TThemeButton): integer; overload; function AddButton(X, Y, W, H: real; Name: String): integer; overload; function AddButton(X, Y, W, H: real; Name, Format, Typ: String; Reflection: Boolean): integer; overload; @@ -107,6 +107,8 @@ type // function AddWidget(X, Y : UInt16; WidgetSrc : PSDL_Surface): Int16; // procedure ClearWidgets(MinNumber : Int16); procedure FadeTo(Screen: PMenu); + //popup hack + procedure CheckFadeTo(Screen: PMenu; msg: String); function DrawBG: boolean; virtual; function DrawFG: boolean; virtual; @@ -873,6 +875,15 @@ begin Display.NextScreen := Screen; end; +//popup hack +procedure TMenu.CheckFadeTo(Screen: PMenu; msg: String); +begin + Display.Fade := 0; + Display.NextScreenWithCheck := Screen; + Display.CheckOK:=False; + ScreenPopupCheck.ShowPopup(msg); +end; + procedure TMenu.AddButtonText(AddX, AddY: real; AddText: string); begin AddButtonText(AddX, AddY, 1, 1, 1, AddText); diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 78c98218..f339fa04 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -55,7 +55,9 @@ begin SDLK_ESCAPE : begin - Result := False; + //popup hack + CheckFadeTo(NIL,'MSG_QUIT_USDX'); +// Result := False; end; SDLK_C: @@ -116,7 +118,7 @@ begin Music.PlayStart; FadeTo(@ScreenStatMain); end; - + //Editor if Interaction = 3 then begin Music.PlayStart; @@ -131,7 +133,9 @@ begin //Exit if Interaction = 5 then begin - Result := false; + //popup hack + CheckFadeTo(NIL,'MSG_QUIT_USDX'); +// Result := false; end; end; // Up and Down could be done at the same time, diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 22f76218..894e96d2 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -86,7 +86,7 @@ begin SDLK_ESCAPE : begin Music.PlayBack; - FadeTo(@ScreenMain); + CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); end; SDLK_RETURN: diff --git a/Game/Code/Screens/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas index 41279197..25f647a2 100644 --- a/Game/Code/Screens/UScreenPopup.pas +++ b/Game/Code/Screens/UScreenPopup.pas @@ -3,10 +3,10 @@ unit UScreenPopup; interface uses - UMenu, SDL, UMusic, UPliki, SysUtils, UThemes, dialogs, Messages; + UMenu, SDL, UMusic, UPliki, SysUtils, UThemes; type - TScreenPopup = class(TMenu) + TScreenPopupCheck = class(TMenu) private CurMenu: Byte; //Num of the cur. Shown Menu public @@ -15,24 +15,35 @@ type constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; - procedure ShowPopup(sPopup: Byte); + procedure ShowPopup(msg: String); function Draw: boolean; override; end; -const - PU_Error = 1; +type + TScreenPopupError = class(TMenu) + private + CurMenu: Byte; //Num of the cur. Shown Menu + public + Visible: Boolean; //Whether the Menu should be Drawn + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure ShowPopup(msg: array of String); + function Draw: boolean; override; + end; var - ISelections: Array of String; +// ISelections: Array of String; SelectValue: Integer; implementation -uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist; +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist, UDisplay; -function TScreenPopup.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +function TScreenPopupCheck.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; function IsVisible: Boolean; begin Result := True; @@ -81,6 +92,15 @@ begin SDLK_RETURN: begin + case Interaction of + 0: begin + Display.CheckOK:=True; + end; + 1: begin + Display.CheckOK:=False; + Display.NextScreenWithCheck:=NIL; + end; + end; Visible:=False; Result := false; end; @@ -100,13 +120,11 @@ begin end; end; -constructor TScreenPopup.Create; +constructor TScreenPopupCheck.Create; var I: integer; begin inherited Create; - SetLength(ISelections, 1); - ISelections[0] := 'Dummy'; AddBackground(Theme.CheckPopup.Background.Tex); @@ -129,37 +147,161 @@ begin Interaction := 0; end; -function TScreenPopup.Draw: boolean; +function TScreenPopupCheck.Draw: boolean; begin inherited Draw; end; -procedure TScreenPopup.onShow; +procedure TScreenPopupCheck.onShow; begin end; -procedure TScreenPopup.ShowPopup(sPopup: Byte); +procedure TScreenPopupCheck.ShowPopup(msg: String); begin Interaction := 0; //Reset Interaction Visible := True; //Set Visible - Case sPopup of - PU_Error: - begin - Text[0].Text := 'Wirklich beenden?';{Language.Translate('SONG_MENU_NAME_MAIN');} - - Button[0].Visible := True; - Button[1].Visible := True; -// Button[2].Visible := True; -// Button[3].Visible := True; -// SelectsS[0].Visible := False; - - Button[0].Text[0].Text := 'JA'; - Button[1].Text[0].Text := 'NEIN'; -// Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD'); -// Button[3].Text[0].Text := Language.Translate('SONG_MENU_EDIT'); - end; + + Text[0].Text := Language.Translate(msg); + + Button[0].Visible := True; + Button[1].Visible := True; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES'); + Button[1].Text[0].Text := Language.Translate('SONG_MENU_NO'); +end; + +// error popup + +function TScreenPopupError.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; + function IsVisible: Boolean; + begin + Result := True; + if (Interactions[Interaction].Typ = 0) then + begin + Result := Button[Interactions[Interaction].Num].Visible; + end + else if (Interactions[Interaction].Typ = 1) then + begin + //Result := Selects[Interactions[Interaction].Num].Visible; + end + else if (Interactions[Interaction].Typ = 3) then + begin + Result := SelectsS[Interactions[Interaction].Num].Visible; + end; + end; + + Procedure SelectNext; + begin + repeat + InteractNext; + until IsVisible; + end; + + Procedure SelectPrev; + begin + repeat + InteractPrev; + until IsVisible; end; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE : + begin + Result := false; + end; + + SDLK_RETURN: + begin + Visible:=False; + Result := false; + end; + + SDLK_DOWN: SelectNext; + SDLK_UP: SelectPrev; + + SDLK_RIGHT: SelectNext; + SDLK_LEFT: SelectPrev; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN : + begin + end; + end; +end; + +constructor TScreenPopupError.Create; +var + I: integer; +begin + inherited Create; + + AddBackground(Theme.CheckPopup.Background.Tex); + + AddButton(Theme.ErrorPopup.Button1); + if (Length(Button[0].Text) = 0) then + AddButtonText(14, 20, 'Button 1'); + + AddText(Theme.ErrorPopup.TextError); + + for I := 0 to High(Theme.ErrorPopup.Static) do + AddStatic(Theme.ErrorPopup.Static[I]); + + for I := 0 to High(Theme.ErrorPopup.Text) do + AddText(Theme.ErrorPopup.Text[I]); + + Interaction := 0; +end; + +function TScreenPopupError.Draw: boolean; +begin + inherited Draw; +end; + +procedure TScreenPopupError.onShow; +begin + +end; + +procedure TScreenPopupError.onHide; +var i: integer; +begin + for i:=0 to high(Text) do + Text[i].Text:=''; +end; + +procedure TScreenPopupError.ShowPopup(msg: array of String); +var i: integer; +begin + Interaction := 0; //Reset Interaction + Visible := True; //Set Visible + + //dirty hack... Text[0] is invisible for some strange reason + for i:=1 to high(Text) do + if i-1 <= high(msg) then + begin + Text[i].Visible:=True; + Text[i].Text := msg[i-1]; + end + else + begin + Text[i].Visible:=False; + end; + + Button[0].Visible := True; + + Button[0].Text[0].Text := 'OK'; end; -end. \ No newline at end of file +end. diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index b7466d84..5f19c1d4 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -82,6 +82,7 @@ uses UScreenStatMain in 'Screens\UScreenStatMain.pas', UScreenStatDetail in 'Screens\UScreenStatDetail.pas', UScreenCredits in 'Screens\UScreenCredits.pas', + UScreenPopup in 'Screens\UScreenPopup.pas', //------------------------------ //Includes - Screens PartyMode @@ -313,4 +314,4 @@ begin if Ini.LPT = 2 then Light.TurnOff; Log.Free; -end. \ No newline at end of file +end. -- cgit v1.2.3 From 7ddd1afb9bec5dca80a272a50ea02f6c3cfbc2b7 Mon Sep 17 00:00:00 2001 From: mota23 Date: Thu, 3 May 2007 01:15:41 +0000 Subject: Esc in Popup escapes the Popup. Higher usability. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@159 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenPopup.pas | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas index 25f647a2..a6e8ccca 100644 --- a/Game/Code/Screens/UScreenPopup.pas +++ b/Game/Code/Screens/UScreenPopup.pas @@ -87,6 +87,9 @@ begin SDLK_ESCAPE : begin + Display.CheckOK:=False; + Display.NextScreenWithCheck:=NIL; + Visible:=False; Result := false; end; -- cgit v1.2.3 From c7db744c1dcbafb38f25a5cb005219faf16134b8 Mon Sep 17 00:00:00 2001 From: b1indy Date: Thu, 3 May 2007 15:34:36 +0000 Subject: minor changes to PopUp code and to related parts of themes git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@160 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UDisplay.pas | 6 +++--- Game/Code/Screens/UScreenPopup.pas | 14 ++++++-------- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index 428cc6c7..e6c0c4f0 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -157,7 +157,7 @@ begin // check if we had an initialization error (canfade=false, dofade=true) if doFade and not canFade then begin doFade:=False; //disable fading - ScreenPopupError.ShowPopup(['Error initializing','fade texture','','fading','disabled']); //show error message + ScreenPopupError.ShowPopup('Error initializing\nfade texture\n\nfading\ndisabled'); //show error message end; if doFade and canFade then begin @@ -169,10 +169,10 @@ begin ActualScreen.Draw; glBindTexture(GL_TEXTURE_2D, pTex[S]); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 512, 512, 0); - if glGetError <> GL_NO_ERROR then + if glGetError = GL_NO_ERROR then begin canFade := False; - ScreenPopupError.ShowPopup(['Error copying','fade texture','','fading','disabled']); //show error message + ScreenPopupError.ShowPopup('Error copying\nfade texture\nfading\ndisabled'); //show error message end; glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); NextScreen.onShow; diff --git a/Game/Code/Screens/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas index a6e8ccca..019632ff 100644 --- a/Game/Code/Screens/UScreenPopup.pas +++ b/Game/Code/Screens/UScreenPopup.pas @@ -7,8 +7,6 @@ uses type TScreenPopupCheck = class(TMenu) - private - CurMenu: Byte; //Num of the cur. Shown Menu public Visible: Boolean; //Whether the Menu should be Drawn @@ -30,7 +28,7 @@ type function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure onHide; override; - procedure ShowPopup(msg: array of String); + procedure ShowPopup(msg: String); function Draw: boolean; override; end; @@ -220,6 +218,7 @@ begin SDLK_ESCAPE : begin + Visible:=False; Result := false; end; @@ -280,17 +279,15 @@ end; procedure TScreenPopupError.onHide; var i: integer; begin - for i:=0 to high(Text) do - Text[i].Text:=''; end; -procedure TScreenPopupError.ShowPopup(msg: array of String); +procedure TScreenPopupError.ShowPopup(msg: String); var i: integer; begin Interaction := 0; //Reset Interaction Visible := True; //Set Visible - //dirty hack... Text[0] is invisible for some strange reason +{ //dirty hack... Text[0] is invisible for some strange reason for i:=1 to high(Text) do if i-1 <= high(msg) then begin @@ -300,7 +297,8 @@ begin else begin Text[i].Visible:=False; - end; + end;} + Text[0].Text:=msg; Button[0].Visible := True; -- cgit v1.2.3 From 0ef472e08a64e5f9b8c33d6b0206a559a56c71ba Mon Sep 17 00:00:00 2001 From: b1indy Date: Thu, 3 May 2007 16:14:05 +0000 Subject: screen fades to black at game end, when fading is enabled git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@161 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UDisplay.pas | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index e6c0c4f0..ae7f901d 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -8,6 +8,9 @@ type TDisplay = class ActualScreen: PMenu; NextScreen: PMenu; + + //fade-to-black-hack + BlackScreen: Boolean; //popup hack NextScreenWithCheck: Pmenu; CheckOK: Boolean; @@ -36,8 +39,6 @@ type var Display: TDisplay; -// ActualScreen: PMenu; -// NextScreen: PMenu; implementation @@ -52,6 +53,7 @@ begin CheckOK:=False; NextScreen:=NIL; NextScreenWithCheck:=NIL; + BlackScreen:=False; // fade mod myfade:=0; @@ -134,11 +136,11 @@ begin CheckOk:=False; end else - Result:=False; + BlackScreen:=True; // end of game - fade to black before exit //end popup hack // ActualScreen.SetAnimationProgress(1); - if not assigned (NextScreen) then begin + if (not assigned (NextScreen)) and (not BlackScreen) then begin ActualScreen.Draw; //popup mod if ScreenPopupError <> NIL then if ScreenPopupError.Visible then ScreenPopupError.Draw else @@ -169,13 +171,15 @@ begin ActualScreen.Draw; glBindTexture(GL_TEXTURE_2D, pTex[S]); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 512, 512, 0); - if glGetError = GL_NO_ERROR then + if glGetError <> GL_NO_ERROR then begin canFade := False; ScreenPopupError.ShowPopup('Error copying\nfade texture\nfading\ndisabled'); //show error message end; glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); - NextScreen.onShow; + // blackscreen-hack + if not BlackScreen then + NextScreen.onShow; lastTime:=GetTickCount; if (S=2) or (Screens = 1) then myfade:=myfade+1; @@ -197,7 +201,13 @@ begin // ActualScreen.SetAnimationProgress(Fade-1); // nop? - NextScreen.Draw; // draw next screen + // blackscreen-hack + if not BlackScreen then + NextScreen.Draw // draw next screen + else begin + glClearColor(0, 0, 0 , 0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end; // and draw old screen over it... slowly fading out myfade2:=(myfade*myfade)/10000; @@ -215,7 +225,11 @@ begin glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); end - else NextScreen.OnShow; + else + // blackscreen hack + if not BlackScreen then + NextScreen.OnShow; + if (myfade > 40) or (not doFade) or (not canFade) then begin // fade out complete... @@ -224,8 +238,13 @@ begin ActualScreen.ShowFinish:=False; ActualScreen:=NextScreen; NextScreen := nil; - ActualScreen.onShowFinish; - ActualScreen.ShowFinish := true; + if not blackscreen then + begin + ActualScreen.onShowFinish; + ActualScreen.ShowFinish := true; + end + else + Result:=False; // end of fade mod end; end; // if -- cgit v1.2.3 From f38292d6da93cf20c075e4ed74c377819af88091 Mon Sep 17 00:00:00 2001 From: b1indy Date: Thu, 3 May 2007 20:05:07 +0000 Subject: more explanatory error message in case copying the fade texture fails git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@162 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UDisplay.pas | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index ae7f901d..d1d3038d 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -104,6 +104,8 @@ var // fade mod myFade2: Real; currentTime: Cardinal; + glError: glEnum; + glErrorStr: String; // end begin Result := True; @@ -171,10 +173,20 @@ begin ActualScreen.Draw; glBindTexture(GL_TEXTURE_2D, pTex[S]); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 512, 512, 0); - if glGetError <> GL_NO_ERROR then + glError:=glGetError; + if glError <> GL_NO_ERROR then begin canFade := False; - ScreenPopupError.ShowPopup('Error copying\nfade texture\nfading\ndisabled'); //show error message + case glError of + GL_INVALID_ENUM: glErrorStr:='INVALID_ENUM'; + GL_INVALID_VALUE: glErrorStr:='INVALID_VALUE'; + GL_INVALID_OPERATION: glErrorStr:='INVALID_OPERATION'; + GL_STACK_OVERFLOW: glErrorStr:='STACK_OVERFLOW'; + GL_STACK_UNDERFLOW: glErrorStr:='STACK_UNDERFLOW'; + GL_OUT_OF_MEMORY: glErrorStr:='OUT_OF_MEMORY'; + else glErrorStr:='unknown error'; + end; + ScreenPopupError.ShowPopup('Error copying\nfade texture\n('+glErrorStr+')\nfading\ndisabled'); //show error message end; glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); // blackscreen-hack -- cgit v1.2.3 From 3114977b5509c775c93d5ba3d5220a1ff9d363a7 Mon Sep 17 00:00:00 2001 From: b1indy Date: Thu, 3 May 2007 20:12:20 +0000 Subject: slight changes to positions of song covers (in SetScroll5) ReflectionSpacing now varies with the size of the cover -- the further back a cover, the smaller it is... as should be the reflection spacing git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@163 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 1f3c7c8f..e0714c2d 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1104,24 +1104,26 @@ begin Pos := Pos + VS else if (Pos > VS/2) then Pos := Pos - VS; - + if (Abs(Pos) < 2.5) then {fixed Positions} begin Angle := Pi * (Pos / 5); //Button[B].Visible := False; - Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle));//Power(Z2, 3); + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); + + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; Button[B].Z := 0.95 - Abs(Pos) * 0.01; - Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); + Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.7); Button[B].W := Button[B].H; Diff := (Button[B].H - Theme.Song.Cover.H)/2; - X := Sin(Angle); + X := Sin(Angle*1.3)*0.9; Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Diff; -- cgit v1.2.3 From 0f327cf133373168d94538686b57c22ba364f2a8 Mon Sep 17 00:00:00 2001 From: mogguh Date: Thu, 3 May 2007 21:09:24 +0000 Subject: Feature: It's now possible to move/skin the time progress thing (no fix positions anymore) (affected: UDraw.pas, UGraphic.pas, UThemes.pas, UScreenSing.pas, UScreenSingModi.pas) Theme/Skin: Added the time stuff beneath the lyrics (as "the others" did too) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@164 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 65 +++++++++++++++++++++-------------- Game/Code/Classes/UGraphic.pas | 6 +++- Game/Code/Classes/UThemes.pas | 18 +++++++++- Game/Code/Screens/UScreenSing.pas | 24 +++++++++---- Game/Code/Screens/UScreenSingModi.pas | 10 +++--- 5 files changed, 83 insertions(+), 40 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index f5722175..41225c0d 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -12,6 +12,11 @@ procedure SingDrawBeatDelimeters(Left, Top, Right: real; NrCzesci: integer); procedure SingDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); procedure SingDrawPlayerCzesc(X, Y, W: real; NrGracza: integer; Space: integer); procedure SingDrawPlayerBGCzesc(Left, Top, Right: real; NrCzesci, NrGracza: integer; Space: integer); + +// TimeBar mod +procedure SingDrawTimeBar(); +// eoa TimeBar mod + { for no use since we have UGraphicClasses procedure SingDrawStar(X, Y, A: real); procedure SingGoldenStar(X, Y, A: real); @@ -615,20 +620,9 @@ begin // background //BG Fullsize Mod //SingDrawBackground; - // time bar -// Log.LogStatus('Time Bar', 'SingDraw'); - glBegin(GL_QUADS); - glColor3f(0.9, 0.9, 0.9); - glVertex2f(140 + 10*ScreenX, 21); - glVertex2f(140 + 10*ScreenX, 29); - glVertex2f(330 + 10*ScreenX, 29); - glVertex2f(330 + 10*ScreenX, 21); - glColor3f(Skin_TimeR, Skin_TimeG, Skin_TimeB); - glVertex2f(140 + 10*ScreenX, 21); - glVertex2f(140 + 10*ScreenX, 29); - glVertex2f(140 + 10*ScreenX+(330-140)*(Czas.Teraz/Czas.Razem), 29); - glVertex2f(140 + 10*ScreenX+(330-140)*(Czas.Teraz/Czas.Razem), 21); - glEnd; + //TimeBar mod + SingDrawTimeBar(); + //eoa TimeBar mod // rysuje paski pod nutami if PlayersPlay = 1 then @@ -1020,18 +1014,7 @@ begin // time bar // Log.LogStatus('Time Bar', 'SingDraw'); - glBegin(GL_QUADS); - glColor3f(0.9, 0.9, 0.9); - glVertex2f(140 + 10*ScreenX, 21); - glVertex2f(140 + 10*ScreenX, 29); - glVertex2f(330 + 10*ScreenX, 29); - glVertex2f(330 + 10*ScreenX, 21); - glColor3f(Skin_TimeR, Skin_TimeG, Skin_TimeB); - glVertex2f(140 + 10*ScreenX, 21); - glVertex2f(140 + 10*ScreenX, 29); - glVertex2f(140 + 10*ScreenX+(330-140)*(Czas.Teraz/Czas.Razem), 29); - glVertex2f(140 + 10*ScreenX+(330-140)*(Czas.Teraz/Czas.Razem), 21); - glEnd; + SingDrawTimeBar(); if DLLMan.Selected.ShowNotes then begin @@ -1652,5 +1635,35 @@ begin glDisable(GL_TEXTURE_2D); end; +procedure SingDrawTimeBar(); +var x,y: real; + width, height: real; +begin + x := Theme.Sing.StaticTimeProgress.x; + y := Theme.Sing.StaticTimeProgress.y; + width:= Theme.Sing.StaticTimeProgress.w; + height:= Theme.Sing.StaticTimeProgress.h; + + glColor4f(Theme.Sing.StaticTimeProgress.ColR, + Theme.Sing.StaticTimeProgress.ColG, + Theme.Sing.StaticTimeProgress.ColB, 1); //Set Color + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + + glBindTexture(GL_TEXTURE_2D, Tex_TimeProgress.TexNum); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(x,y); + glTexCoord2f(0, 1); glVertex2f(x+width*(Czas.Teraz/Czas.Razem), y); + glTexCoord2f(1, 1); glVertex2f(x+width*(Czas.Teraz/Czas.Razem), y+height); + glTexCoord2f(1, 0); glVertex2f(x, y+height); + glEnd; + + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + glcolor4f(1,1,1,1); +end; + end. diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 8b17a73d..7fd159f7 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -93,7 +93,7 @@ var Tex_Lyric_Help_Bar: TTexture; FullScreen: boolean; - + Tex_TimeProgress: TTexture; //Sing Bar Mod Tex_SingBar_Back: TTexture; @@ -211,6 +211,10 @@ begin Tex_Lyric_Help_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricHelpBar')), 'BMP', 'Transparent', $FF00FF); + //TimeBar mod + Tex_TimeProgress := Texture.LoadTexture(pchar(Skin.GetTextureFileName('TimeBar'))); + //eoa TimeBar mod + //SingBar Mod Tex_SingBar_Back := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBack')), 'JPG', 'Plain', 0); Tex_SingBar_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBar')), 'JPG', 'Plain', 0); diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index ee88ca9c..7f4763c3 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -296,9 +296,15 @@ type end; TThemeSing = class(TThemeBasic) + + //TimeBar mod + StaticTimeProgress: TThemeStatic; + TextTimeText : TThemeText; + //eoa TimeBar mod + StaticP1: TThemeStatic; - StaticP1ScoreBG: TThemeStatic; //Static for ScoreBG TextP1: TThemeText; + StaticP1ScoreBG: TThemeStatic; //Static for ScoreBG TextP1Score: TThemeText; //moveable singbar mod @@ -988,6 +994,11 @@ begin // Sing ThemeLoadBasic(Sing, 'Sing'); + //TimeBar mod + ThemeLoadStatic(Sing.StaticTimeProgress, 'SingTimeProgress'); + ThemeLoadText(Sing.TextTimeText, 'SingTimeText'); + //eoa TimeBar mod + //moveable singbar mod ThemeLoadStatic(Sing.StaticP1SingBar, 'SingP1SingBar'); ThemeLoadStatic(Sing.StaticP1TwoPSingBar, 'SingP1TwoPSingBar'); @@ -1973,6 +1984,11 @@ begin ThemeSaveBasic(Sing, 'Sing'); + //TimeBar mod + ThemeSaveStatic(Sing.StaticTimeProgress, 'SingTimeProgress'); + ThemeSaveText(Sing.TextTimeText, 'SingTimeText'); + //eoa TimeBar mod + ThemeSaveStatic(Sing.StaticP1, 'SingP1Static'); ThemeSaveText(Sing.TextP1, 'SingP1Text'); ThemeSaveStatic(Sing.StaticP1ScoreBG, 'SingP1Static2'); diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 93c3ac48..3e66b197 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -12,7 +12,12 @@ type PauseTime: Real; NumEmptySentences: integer; public - TextTime: integer; + //TextTime: integer; + + //TimeBar mod + StaticTimeProgress: integer; + TextTimeText: integer; + //eoa TimeBar mod StaticP1: integer; StaticP1ScoreBG: integer; @@ -166,7 +171,12 @@ begin LoadFromTheme(Theme.Sing); // time - TextTime := AddText(75, 14, 1, 8, 0.25, 0.25, 0.25, '00:00'); + //TextTime := AddText(75, 14, 1, 8, 0.25, 0.25, 0.25, '00:00'); + + //TimeBar mod + StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); + TextTimeText := AddText(Theme.Sing.TextTimeText); + //eoa TimeBar mod StaticP1 := AddStatic(Theme.Sing.StaticP1); StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); @@ -908,11 +918,11 @@ begin // update static menu with time ... Min := Round(Czas.Teraz) div 60; Sec := Round(Czas.Teraz) mod 60; - Text[TextTime].Text := ''; - if Min < 10 then Text[TextTime].Text := '0'; - Text[TextTime].Text := Text[TextTime].Text + IntToStr(Min) + ':'; - if Sec < 10 then Text[TextTime].Text := Text[TextTime].Text + '0'; - Text[TextTime].Text := Text[TextTime].Text + IntToStr(Sec); + 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); // .. and scores if PlayersPlay = 1 then begin diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 86613152..484d7d56 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -927,11 +927,11 @@ begin // update static menu with time ... Min := Round(Czas.Teraz) div 60; Sec := Round(Czas.Teraz) mod 60; - Text[TextTime].Text := ''; - if Min < 10 then Text[TextTime].Text := '0'; - Text[TextTime].Text := Text[TextTime].Text + IntToStr(Min) + ':'; - if Sec < 10 then Text[TextTime].Text := Text[TextTime].Text + '0'; - Text[TextTime].Text := Text[TextTime].Text + IntToStr(Sec); + 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); end; // draw static menu (BG) -- cgit v1.2.3 From a1624a62face0dc4edb0908ba09b6bcd2f43d065 Mon Sep 17 00:00:00 2001 From: b1indy Date: Thu, 3 May 2007 22:45:08 +0000 Subject: re-enabled covers behind the 5 front-covers in songselection fiddled with position-calculations until it looked not too bad git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@166 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index e0714c2d..738eb01e 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1116,7 +1116,7 @@ begin Button[B].Z := 0.95 - Abs(Pos) * 0.01; - Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.7); + Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); Button[B].W := Button[B].H; @@ -1130,31 +1130,34 @@ begin end else begin {Behind the Front Covers} - Button[B].Visible := False; +// Button[B].Visible := False; +// if VS/2-abs(Pos)>VS*0.4 then Button[B].Visible := False; if Pos < 0 then Pos := (Pos - VS/2) /VS else Pos := (Pos + VS/2) /VS; - Angle := 2 * pi * Pos; + Angle := 2 * pi * Pos*1.2; - Button[B].Z := (0.5 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle));//Power(Z2, 3); + Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); Button[B].W := Button[B].H; - Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); + Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; - Diff := (Button[B].H - Theme.Song.Cover.H)/2;; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.W + Theme.Song.Cover.H*VS*0.185)* Sin(Angle) - Diff + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2 + (Theme.Song.Cover.H)*sin(Angle/2)*1.52; end; //Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field - Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); +// Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); end; end; -- cgit v1.2.3 From 4c6e44e0c1fced2b2d2edf8640fe0652b94f2811 Mon Sep 17 00:00:00 2001 From: b1indy Date: Thu, 3 May 2007 23:42:02 +0000 Subject: reflections of buttoncollection nur fade out more realisticly (need your opinion on that) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@167 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UMenuButton.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UMenuButton.pas b/Game/Code/Menu/UMenuButton.pas index fde808e2..87ebbb89 100644 --- a/Game/Code/Menu/UMenuButton.pas +++ b/Game/Code/Menu/UMenuButton.pas @@ -434,7 +434,7 @@ begin //Draw glBegin(GL_QUADS);//Top Left - glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); + glColor4f(ColR * Int, ColG * Int, ColB * Int, (Alpha-0.3)*FadeProgress*FadeProgress*FadeProgress); glTexCoord2f(TexX1*TexW, TexY2*TexH); glVertex3f(x, y+h*scaleH+ Spacing, z); @@ -450,7 +450,7 @@ begin glVertex3f(x+w*scaleW, y+h*scaleH + h*scaleH/2 + Spacing, z); //Top Right - glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); + glColor4f(ColR * Int, ColG * Int, ColB * Int, (Alpha-0.3)*FadeProgress*FadeProgress*FadeProgress); glTexCoord2f(TexX2*TexW, TexY2*TexH); glVertex3f(x+w*scaleW, y+h*scaleH + Spacing, z); glEnd; -- cgit v1.2.3 From 73347d4f77edb7e79709b7af9f23e0faa2b38f8b Mon Sep 17 00:00:00 2001 From: b1indy Date: Fri, 4 May 2007 00:12:38 +0000 Subject: reflections were gone after my last hack in UMenuButton... should be back now git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@168 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 738eb01e..b32571c8 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1112,7 +1112,7 @@ begin Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; Button[B].Z := 0.95 - Abs(Pos) * 0.01; @@ -1148,7 +1148,7 @@ begin Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; Diff := (Button[B].H - Theme.Song.Cover.H)/2; -- cgit v1.2.3 From 188929aca69791bc755db6562582acfcf10df2e5 Mon Sep 17 00:00:00 2001 From: b1indy Date: Fri, 4 May 2007 16:21:40 +0000 Subject: well... changed Button Reflections back to old behavior git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@173 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UMenuButton.pas | 4 ++-- Game/Code/Screens/UScreenSong.pas | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UMenuButton.pas b/Game/Code/Menu/UMenuButton.pas index 87ebbb89..fde808e2 100644 --- a/Game/Code/Menu/UMenuButton.pas +++ b/Game/Code/Menu/UMenuButton.pas @@ -434,7 +434,7 @@ begin //Draw glBegin(GL_QUADS);//Top Left - glColor4f(ColR * Int, ColG * Int, ColB * Int, (Alpha-0.3)*FadeProgress*FadeProgress*FadeProgress); + glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); glTexCoord2f(TexX1*TexW, TexY2*TexH); glVertex3f(x, y+h*scaleH+ Spacing, z); @@ -450,7 +450,7 @@ begin glVertex3f(x+w*scaleW, y+h*scaleH + h*scaleH/2 + Spacing, z); //Top Right - glColor4f(ColR * Int, ColG * Int, ColB * Int, (Alpha-0.3)*FadeProgress*FadeProgress*FadeProgress); + glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); glTexCoord2f(TexX2*TexW, TexY2*TexH); glVertex3f(x+w*scaleW, y+h*scaleH + Spacing, z); glEnd; diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index b32571c8..e4ab8854 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1112,7 +1112,8 @@ begin Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); - Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; +// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; Button[B].Z := 0.95 - Abs(Pos) * 0.01; @@ -1148,7 +1149,8 @@ begin Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; - Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; +// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; Diff := (Button[B].H - Theme.Song.Cover.H)/2; -- cgit v1.2.3 From 042a5e57be1ada25cbbc6e7f5f34c0c0ea5e9de2 Mon Sep 17 00:00:00 2001 From: mota23 Date: Mon, 7 May 2007 19:17:25 +0000 Subject: Some Themework done. Added new Statics to ScreenPartyScore. [PartyScoreStaticTeam(n)BG and Deco] To do: 1 Screen in Party-Mode, SingScreen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@177 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 12 ++++++++++++ Game/Code/Screens/UScreenPartyScore.pas | 29 +++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 7f4763c3..ea2328f9 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -559,8 +559,14 @@ type TextNameTeam2: TThemeText; TextNameTeam3: TThemeText; StaticTeam1: TThemeStatic; + StaticTeam1BG: TThemeStatic; + StaticTeam1Deco: TThemeStatic; StaticTeam2: TThemeStatic; + StaticTeam2BG: TThemeStatic; + StaticTeam2Deco: TThemeStatic; StaticTeam3: TThemeStatic; + StaticTeam3BG: TThemeStatic; + StaticTeam3Deco: TThemeStatic; TextWinner: TThemeText; end; @@ -1280,8 +1286,14 @@ begin ThemeLoadText (PartyScore.TextNameTeam3, 'PartyScoreTextNameTeam3'); ThemeLoadStatic (PartyScore.StaticTeam1, 'PartyScoreStaticTeam1'); + ThemeLoadStatic (PartyScore.StaticTeam1BG, 'PartyScoreStaticTeam1BG'); + ThemeLoadStatic (PartyScore.StaticTeam1Deco, 'PartyScoreStaticTeam1Deco'); ThemeLoadStatic (PartyScore.StaticTeam2, 'PartyScoreStaticTeam2'); + ThemeLoadStatic (PartyScore.StaticTeam2BG, 'PartyScoreStaticTeam2BG'); + ThemeLoadStatic (PartyScore.StaticTeam2Deco, 'PartyScoreStaticTeam2Deco'); ThemeLoadStatic (PartyScore.StaticTeam3, 'PartyScoreStaticTeam3'); + ThemeLoadStatic (PartyScore.StaticTeam3BG, 'PartyScoreStaticTeam3BG'); + ThemeLoadStatic (PartyScore.StaticTeam3Deco, 'PartyScoreStaticTeam3Deco'); ThemeLoadText (PartyScore.TextWinner, 'PartyScoreTextWinner'); diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index 805525a1..4afaee09 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -15,8 +15,14 @@ type TextNameTeam2: Cardinal; TextNameTeam3: Cardinal; StaticTeam1: Cardinal; + StaticTeam1BG: Cardinal; + StaticTeam1Deco: Cardinal; StaticTeam2: Cardinal; + StaticTeam2BG: Cardinal; + StaticTeam2Deco: Cardinal; StaticTeam3: Cardinal; + StaticTeam3BG: Cardinal; + StaticTeam3Deco: Cardinal; TextWinner: Cardinal; MaxScore: Word; @@ -80,8 +86,14 @@ begin TextNameTeam3 := AddText (Theme.PartyScore.TextNameTeam3); StaticTeam1 := AddStatic (Theme.PartyScore.StaticTeam1); + StaticTeam1BG := AddStatic (Theme.PartyScore.StaticTeam1BG); + StaticTeam1Deco := AddStatic (Theme.PartyScore.StaticTeam1Deco); StaticTeam2 := AddStatic (Theme.PartyScore.StaticTeam2); + StaticTeam2BG := AddStatic (Theme.PartyScore.StaticTeam2BG); + StaticTeam2Deco := AddStatic (Theme.PartyScore.StaticTeam2Deco); StaticTeam3 := AddStatic (Theme.PartyScore.StaticTeam3); + StaticTeam3BG := AddStatic (Theme.PartyScore.StaticTeam3BG); + StaticTeam3Deco := AddStatic (Theme.PartyScore.StaticTeam3Deco); TextWinner := AddText (Theme.PartyScore.TextWinner); @@ -105,6 +117,11 @@ begin Static[StaticTeam2].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100; Static[StaticTeam3].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[2].Percentage / 100; + //fix: prevents static from drawn out of bounds. + if Static[StaticTeam1].Texture.ScaleW > 99 then Static[StaticTeam1].Texture.ScaleW := 99; + if Static[StaticTeam2].Texture.ScaleW > 99 then Static[StaticTeam2].Texture.ScaleW := 99; + if Static[StaticTeam3].Texture.ScaleW > 99 then Static[StaticTeam3].Texture.ScaleW := 99; + //End Last Round PartySession.EndRound; @@ -119,12 +136,16 @@ begin Text[TextScoreTeam1].Visible := True; Text[TextNameTeam1].Visible := True; Static[StaticTeam1].Visible := True; + Static[StaticTeam1BG].Visible := True; + Static[StaticTeam1Deco].Visible := True; end else begin Text[TextScoreTeam1].Visible := False; Text[TextNameTeam1].Visible := False; Static[StaticTeam1].Visible := False; + Static[StaticTeam1BG].Visible := False; + Static[StaticTeam1Deco].Visible := False; end; if (ScreenSingModi.PlayerInfo.NumPlayers >= 2) then @@ -135,12 +156,16 @@ begin Text[TextScoreTeam2].Visible := True; Text[TextNameTeam2].Visible := True; Static[StaticTeam2].Visible := True; + Static[StaticTeam2BG].Visible := True; + Static[StaticTeam2Deco].Visible := True; end else begin Text[TextScoreTeam2].Visible := False; Text[TextNameTeam2].Visible := False; Static[StaticTeam2].Visible := False; + Static[StaticTeam2BG].Visible := False; + Static[StaticTeam2Deco].Visible := False; end; if (ScreenSingModi.PlayerInfo.NumPlayers >= 3) then @@ -151,12 +176,16 @@ begin Text[TextScoreTeam3].Visible := True; Text[TextNameTeam3].Visible := True; Static[StaticTeam3].Visible := True; + Static[StaticTeam3BG].Visible := True; + Static[StaticTeam3Deco].Visible := True; end else begin Text[TextScoreTeam3].Visible := False; Text[TextNameTeam3].Visible := False; Static[StaticTeam3].Visible := False; + Static[StaticTeam3BG].Visible := False; + Static[StaticTeam3Deco].Visible := False; end; -- cgit v1.2.3 From b61e647b67ac0d449d764b89b117a3ac8b603403 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 8 May 2007 19:00:47 +0000 Subject: Readded Q Shortcut (Exit Application) on all Screens Clean up Popup Code a little bit git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@180 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMain.pas | 35 ++++++++-- Game/Code/Screens/UScreenEdit.pas | 4 ++ Game/Code/Screens/UScreenEditHeader.pas | 4 ++ Game/Code/Screens/UScreenLevel.pas | 8 +-- Game/Code/Screens/UScreenMain.pas | 8 +-- Game/Code/Screens/UScreenOpen.pas | 4 ++ Game/Code/Screens/UScreenOptionsAdvanced.pas | 4 ++ Game/Code/Screens/UScreenOptionsGame.pas | 4 ++ Game/Code/Screens/UScreenOptionsLyrics.pas | 4 ++ Game/Code/Screens/UScreenOptionsRecord.pas | 4 ++ Game/Code/Screens/UScreenOptionsSound.pas | 4 ++ Game/Code/Screens/UScreenOptionsThemes.pas | 4 ++ Game/Code/Screens/UScreenPartyNewRound.pas | 8 +-- Game/Code/Screens/UScreenPartyOptions.pas | 8 +-- Game/Code/Screens/UScreenPopup.pas | 101 +++++---------------------- Game/Code/Screens/UScreenSing.pas | 25 ++++--- Game/Code/Screens/UScreenSong.pas | 17 ++--- Game/Code/Screens/UScreenSongJumpto.pas | 8 +-- Game/Code/Screens/UScreenSongMenu.pas | 8 +-- 19 files changed, 108 insertions(+), 154 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 69eca419..29ca5fcb 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -112,7 +112,7 @@ begin CheckEvents; // display - done:=not Display.Draw; + done := not Display.Draw; SwapBuffers; // light @@ -158,12 +158,35 @@ Begin begin // popup hack... if there is a visible popup then let it handle input instead of underlying screen // shoud be done in a way to be sure the topmost popup has preference (maybe error, then check) - if ScreenPopupError <> NIL then if ScreenPopupError.Visible then ScreenPopupError.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) else - if ScreenPopupCheck <> NIL then if ScreenPopupCheck.Visible then ScreenPopupCheck.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) else + if (ScreenPopupError <> NIL) and (ScreenPopupError.Visible) then + done := not ScreenPopupError.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) + else if (ScreenPopupCheck <> NIL) AND (ScreenPopupCheck.Visible) then + done := not ScreenPopupCheck.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) + // end of popup hack - if (Not Display.ActualScreen^.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True)) then -// if (Not Display.ActualScreen^.ParseInput(Event.key.keysym.scancode, True)) then - done := true; // exit game + + else + begin + // check for Screen want to Exit + done := Not Display.ActualScreen^.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True); + + //If Screen wants to Exit + if done then + begin + //If Question Option is enabled then Show Exit Popup + if (Ini.AskbeforeDel = 1) then + begin + Display.ActualScreen^.CheckFadeTo(NIL,'MSG_QUIT_USDX'); + end + else //When asking for exit is disabled then simply exit + begin + Display.Fade := 0; + Display.NextScreenWithCheck := nil; + Display.CheckOK := True; + end; + end; + + end; // if (Not Display.ActualScreen^.ParseInput(Event.key.keysym.scancode, True)) then end; // SDL_JOYAXISMOTION: // begin diff --git a/Game/Code/Screens/UScreenEdit.pas b/Game/Code/Screens/UScreenEdit.pas index 00df0418..ac2964cd 100644 --- a/Game/Code/Screens/UScreenEdit.pas +++ b/Game/Code/Screens/UScreenEdit.pas @@ -28,6 +28,10 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin Music.PlayBack; diff --git a/Game/Code/Screens/UScreenEditHeader.pas b/Game/Code/Screens/UScreenEditHeader.pas index dbdd186c..f3e21fd0 100644 --- a/Game/Code/Screens/UScreenEditHeader.pas +++ b/Game/Code/Screens/UScreenEditHeader.pas @@ -53,6 +53,10 @@ begin Result := true; If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin // Music.PlayBack; diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas index 80d42773..a1d8fa33 100644 --- a/Game/Code/Screens/UScreenLevel.pas +++ b/Game/Code/Screens/UScreenLevel.pas @@ -53,13 +53,7 @@ begin SDLK_RIGHT: InteractNext; SDLK_LEFT: InteractPrev; end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; - end; + end; end; constructor TScreenLevel.Create; diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index f339fa04..6fd458d7 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -55,9 +55,7 @@ begin SDLK_ESCAPE : begin - //popup hack - CheckFadeTo(NIL,'MSG_QUIT_USDX'); -// Result := False; + Result := False; end; SDLK_C: @@ -133,9 +131,7 @@ begin //Exit if Interaction = 5 then begin - //popup hack - CheckFadeTo(NIL,'MSG_QUIT_USDX'); -// Result := false; + Result := false; end; end; // Up and Down could be done at the same time, diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index 4f0c32c5..3a78b3e2 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -41,6 +41,10 @@ begin end; case PressedKey of + SDLK_Q: + begin + Result := false; + end; 8: // del begin if Interaction = 0 then diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index 256b02db..3e3f2da7 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -23,6 +23,10 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin Ini.Save; diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index 88bb34e3..540931af 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -25,6 +25,10 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin Music.PlayBack; diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas index ff03b2ba..f60c9765 100644 --- a/Game/Code/Screens/UScreenOptionsLyrics.pas +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -23,6 +23,10 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin Ini.Save; diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index af7d2cd6..c474bd7f 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -28,6 +28,10 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE, SDLK_BACKSPACE: begin Ini.Save; diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index ee53ef02..d4ab27d2 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -23,6 +23,10 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin Ini.Save; diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index c0bf2e15..580f9c4d 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -26,6 +26,10 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin Ini.Save; diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 894e96d2..c914ee4b 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -104,13 +104,7 @@ begin end; end; end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; - end; + end; end; constructor TScreenPartyNewRound.Create; diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index f0df9871..7f3b1209 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -139,13 +139,7 @@ begin end; end; end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; - end; + end; end; constructor TScreenPartyOptions.Create; diff --git a/Game/Code/Screens/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas index 019632ff..9b71eb9a 100644 --- a/Game/Code/Screens/UScreenPopup.pas +++ b/Game/Code/Screens/UScreenPopup.pas @@ -42,36 +42,6 @@ implementation uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist, UDisplay; function TScreenPopupCheck.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; - function IsVisible: Boolean; - begin - Result := True; - if (Interactions[Interaction].Typ = 0) then - begin - Result := Button[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 1) then - begin - //Result := Selects[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 3) then - begin - Result := SelectsS[Interactions[Interaction].Num].Visible; - end; - end; - - Procedure SelectNext; - begin - repeat - InteractNext; - until IsVisible; - end; - - Procedure SelectPrev; - begin - repeat - InteractPrev; - until IsVisible; - end; begin Result := true; If (PressedDown) Then @@ -95,6 +65,15 @@ begin begin case Interaction of 0: begin + //Hack to Finish Singscreen correct on Exit with Q Shortcut + if (Display.NextScreenWithCheck = NIL) then + begin + if (Display.ActualScreen = @ScreenSing) then + ScreenSing.Finish + else if (Display.ActualScreen = @ScreenSingModi) then + ScreenSingModi.Finish; + end; + Display.CheckOK:=True; end; 1: begin @@ -106,19 +85,13 @@ begin Result := false; end; - SDLK_DOWN: SelectNext; - SDLK_UP: SelectPrev; + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; - SDLK_RIGHT: SelectNext; - SDLK_LEFT: SelectPrev; - end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; end; + end; end; constructor TScreenPopupCheck.Create; @@ -175,36 +148,6 @@ end; // error popup function TScreenPopupError.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; - function IsVisible: Boolean; - begin - Result := True; - if (Interactions[Interaction].Typ = 0) then - begin - Result := Button[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 1) then - begin - //Result := Selects[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 3) then - begin - Result := SelectsS[Interactions[Interaction].Num].Visible; - end; - end; - - Procedure SelectNext; - begin - repeat - InteractNext; - until IsVisible; - end; - - Procedure SelectPrev; - begin - repeat - InteractPrev; - until IsVisible; - end; begin Result := true; If (PressedDown) Then @@ -228,19 +171,13 @@ begin Result := false; end; - SDLK_DOWN: SelectNext; - SDLK_UP: SelectPrev; + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; - SDLK_RIGHT: SelectNext; - SDLK_LEFT: SelectPrev; - end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; end; + end; end; constructor TScreenPopupError.Create; diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 3e66b197..6985672f 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -92,6 +92,17 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + //When not ask before Exit then Finish now + if (Ini.AskbeforeDel <> 1) then + Finish + //else just Pause and let the Popup make the Work + else if not paused then + Pause; + + Result := false; + end; SDLK_ESCAPE : begin //Record Sound Hack: @@ -102,12 +113,6 @@ begin FadeTo(@ScreenScore); end; - SDLK_Q: - begin - Finish; - Result := false; - end; - SDLK_P://Pause Mod begin Pause; @@ -127,13 +132,7 @@ begin begin end; end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; - end; + end; end; //Pause Mod diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index e4ab8854..139d6984 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -248,6 +248,10 @@ begin end; case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin if (Mode = 0) then @@ -605,19 +609,8 @@ begin SetJoker; end; end; - - SDLK_Q: - begin - Result := false; - end; - end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; end; + end; end; constructor TScreenSong.Create; diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index b90c558b..44c12f51 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -139,13 +139,7 @@ begin end; end; end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; - end; + end; end; constructor TScreenSongJumpto.Create; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index fd875527..73b38a05 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -97,13 +97,7 @@ begin InteractDec; end; end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; - end; + end; end; constructor TScreenSongMenu.Create; -- cgit v1.2.3 From 5270a02d1dea4f660349f0414d63c3b969def187 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 8 May 2007 19:23:02 +0000 Subject: Added Ability to Leave Song Screen in Party Mode with Popup. Show Menu directly in Songscreen in PartyMode git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@181 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 139d6984..296b6d2f 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -63,6 +63,7 @@ type function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; function Draw: boolean; override; procedure onShow; override; + procedure onHide; override; procedure SelectNext; procedure SelectPrev; procedure UpdateLCD; @@ -298,6 +299,12 @@ begin // Music.Open(Skin.SkinPath + 'Menu Music 3.mp3'); // Music.Play; end; + end + //When in party Mode then Ask before Close + else if (Mode = 1) then + begin + Music.PlayBack; + CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); end; end; SDLK_RETURN: @@ -1198,12 +1205,21 @@ begin //Party Mode else if (Mode = 1) then begin + SelectRandomSong; + //Show Mennu direct in PartyMode + ScreenSongMenu.MenuShow(SM_Party_Main); end; SetJoker; end; +procedure TScreenSong.onHide; +begin + //When hide then Stop Music (For Party Mode Popup on Exit) + Music.Stop; +end; + procedure TScreenSong.DrawExtensions; begin //Draw Song Menu @@ -1631,7 +1647,7 @@ end; procedure TScreenSong.StartSong; begin CatSongs.Selected := Interaction; - Music.Stop; + //Music.Stop; //Party Mode if (Mode = 1) then begin -- cgit v1.2.3 From e452e8c6d60af8e8a8eb957f1ef59d461f48c99a Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 8 May 2007 19:55:34 +0000 Subject: Fixed the "one Song too much" Bug Added 2 Error Messages: When Opening Sing or Party: No Songs Loaded When Opening Party: No Plugins loaded Added Messages to Language File git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@182 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/USongs.pas | 2 +- Game/Code/Screens/UScreenMain.pas | 35 ++++++++++++++++++++++++----------- 2 files changed, 25 insertions(+), 12 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 0a319370..4b49127c 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -110,7 +110,7 @@ begin BrowseDir(SongPath); //Set Correct SongArray Length - SetLength(Song, BrowsePos + 1); + SetLength(Song, BrowsePos); // if Ini.Debug = 1 then BrowseDir('D:\Extract\Songs\'); end; diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 6fd458d7..47a79496 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -93,22 +93,35 @@ begin SDLK_RETURN: begin //Solo - if (Interaction = 0) and (Length(Songs.Song) >= 1) then begin - Music.PlayStart; - if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1; - if (Ini.Players = 4) then PlayersPlay := 6; - - ScreenName.Goto_SingScreen := False; - FadeTo(@ScreenName); + if (Interaction = 0) then + begin + if (Length(Songs.Song) >= 1) then + begin + Music.PlayStart; + if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1; + if (Ini.Players = 4) then PlayersPlay := 6; + + ScreenName.Goto_SingScreen := False; + FadeTo(@ScreenName); + end + else //show error message + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); end; //Multi if Interaction = 1 then begin - if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then + if (Length(Songs.Song) >= 1) then begin - Music.PlayStart; - FadeTo(@ScreenPartyOptions); - end; + if (Length(DLLMan.Plugins)>=1) then + begin + Music.PlayStart; + FadeTo(@ScreenPartyOptions); + end + else //show error message, No Plugins Loaded + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS')); + end + else //show error message, No Songs Loaded + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); end; //Stats -- cgit v1.2.3 From e0b0396acf6101acf2608d9fe4b36fa735196b2a Mon Sep 17 00:00:00 2001 From: mota23 Date: Wed, 9 May 2007 03:26:41 +0000 Subject: Some Themework done. Added new Statics to PartyWin. [PartyWinStaticTeam(n)BG and Deco] Fix: bug in PartyScore (esc skipped to PartyNewRound where PartyWin should come) Disabled Esc in PartyWin. To do: Sing-Screen, Stats git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@183 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 12 ++++++++++++ Game/Code/Screens/UScreenPartyScore.pas | 2 +- Game/Code/Screens/UScreenPartyWin.pas | 30 +++++++++++++++++++++++++++--- 3 files changed, 40 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index ea2328f9..e8f8eb10 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -579,8 +579,14 @@ type TextNameTeam2: TThemeText; TextNameTeam3: TThemeText; StaticTeam1: TThemeStatic; + StaticTeam1BG: TThemeStatic; + StaticTeam1Deco: TThemeStatic; StaticTeam2: TThemeStatic; + StaticTeam2BG: TThemeStatic; + StaticTeam2Deco: TThemeStatic; StaticTeam3: TThemeStatic; + StaticTeam3BG: TThemeStatic; + StaticTeam3Deco: TThemeStatic; TextWinner: TThemeText; end; @@ -1308,8 +1314,14 @@ begin ThemeLoadText (PartyWin.TextNameTeam3, 'PartyWinTextNameTeam3'); ThemeLoadStatic (PartyWin.StaticTeam1, 'PartyWinStaticTeam1'); + ThemeLoadStatic (PartyWin.StaticTeam1BG, 'PartyWinStaticTeam1BG'); + ThemeLoadStatic (PartyWin.StaticTeam1Deco, 'PartyWinStaticTeam1Deco'); ThemeLoadStatic (PartyWin.StaticTeam2, 'PartyWinStaticTeam2'); + ThemeLoadStatic (PartyWin.StaticTeam2BG, 'PartyWinStaticTeam2BG'); + ThemeLoadStatic (PartyWin.StaticTeam2Deco, 'PartyWinStaticTeam2Deco'); ThemeLoadStatic (PartyWin.StaticTeam3, 'PartyWinStaticTeam3'); + ThemeLoadStatic (PartyWin.StaticTeam3BG, 'PartyWinStaticTeam3BG'); + ThemeLoadStatic (PartyWin.StaticTeam3Deco, 'PartyWinStaticTeam3Deco'); ThemeLoadText (PartyWin.TextWinner, 'PartyWinTextWinner'); diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index 4afaee09..324656c0 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -51,7 +51,7 @@ begin SDLK_ESCAPE : begin Music.PlayStart; - if (PartySession.CurRound <= High(PartySession.Rounds)) then + if (PartySession.CurRound < High(PartySession.Rounds)) then FadeTo(@ScreenPartyNewRound) else begin diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas index ff65e82f..a6486f67 100644 --- a/Game/Code/Screens/UScreenPartyWin.pas +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -15,10 +15,16 @@ type TextNameTeam2: Cardinal; TextNameTeam3: Cardinal; StaticTeam1: Cardinal; + StaticTeam1BG: Cardinal; + StaticTeam1Deco: Cardinal; StaticTeam2: Cardinal; + StaticTeam2BG: Cardinal; + StaticTeam2Deco: Cardinal; StaticTeam3: Cardinal; + StaticTeam3BG: Cardinal; + StaticTeam3Deco: Cardinal; TextWinner: Cardinal; - + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; @@ -40,11 +46,11 @@ begin Result := false; end; - SDLK_ESCAPE : + {SDLK_ESCAPE : begin Music.PlayStart; FadeTo(@ScreenMain); - end; + end;} SDLK_RETURN: begin @@ -69,8 +75,14 @@ begin TextNameTeam3 := AddText (Theme.PartyWin.TextNameTeam3); StaticTeam1 := AddStatic (Theme.PartyWin.StaticTeam1); + StaticTeam1BG := AddStatic (Theme.PartyWin.StaticTeam1BG); + StaticTeam1Deco := AddStatic (Theme.PartyWin.StaticTeam1Deco); StaticTeam2 := AddStatic (Theme.PartyWin.StaticTeam2); + StaticTeam2BG := AddStatic (Theme.PartyWin.StaticTeam2BG); + StaticTeam2Deco := AddStatic (Theme.PartyWin.StaticTeam2Deco); StaticTeam3 := AddStatic (Theme.PartyWin.StaticTeam3); + StaticTeam3BG := AddStatic (Theme.PartyWin.StaticTeam3BG); + StaticTeam3Deco := AddStatic (Theme.PartyWin.StaticTeam3Deco); TextWinner := AddText (Theme.PartyWin.TextWinner); @@ -93,12 +105,16 @@ begin Text[TextScoreTeam1].Visible := True; Text[TextNameTeam1].Visible := True; Static[StaticTeam1].Visible := True; + Static[StaticTeam1BG].Visible := True; + Static[StaticTeam1Deco].Visible := True; end else begin Text[TextScoreTeam1].Visible := False; Text[TextNameTeam1].Visible := False; Static[StaticTeam1].Visible := False; + Static[StaticTeam1BG].Visible := False; + Static[StaticTeam1Deco].Visible := False; end; if (PartySession.Teams.NumTeams >= 2) then @@ -109,12 +125,16 @@ begin Text[TextScoreTeam2].Visible := True; Text[TextNameTeam2].Visible := True; Static[StaticTeam2].Visible := True; + Static[StaticTeam2BG].Visible := True; + Static[StaticTeam2Deco].Visible := True; end else begin Text[TextScoreTeam2].Visible := False; Text[TextNameTeam2].Visible := False; Static[StaticTeam2].Visible := False; + Static[StaticTeam2BG].Visible := False; + Static[StaticTeam2Deco].Visible := False; end; if (PartySession.Teams.NumTeams >= 3) then @@ -125,12 +145,16 @@ begin Text[TextScoreTeam3].Visible := True; Text[TextNameTeam3].Visible := True; Static[StaticTeam3].Visible := True; + Static[StaticTeam3BG].Visible := True; + Static[StaticTeam3Deco].Visible := True; end else begin Text[TextScoreTeam3].Visible := False; Text[TextNameTeam3].Visible := False; Static[StaticTeam3].Visible := False; + Static[StaticTeam3BG].Visible := False; + Static[StaticTeam3Deco].Visible := False; end; -- cgit v1.2.3 From 48e9a9faea54c6fa5b2b98e242444ae4c0183a7a Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 9 May 2007 16:45:46 +0000 Subject: Fix: Readded ability to close the Window Fix: Crash when SongScreen is opened in PartyMode when Tabs = On. Caused by SelectRandomSong procedure Upd: M in SongScreen works now in PartyMode, too git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@184 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMain.pas | 6 ++- Game/Code/Screens/UScreenSong.pas | 85 ++++++++++++++++++++------------------- 2 files changed, 49 insertions(+), 42 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 29ca5fcb..47860198 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -145,7 +145,11 @@ Begin Begin // beep; Case Event.type_ Of - SDL_QUITEV: done := true; + SDL_QUITEV: begin + Display.Fade := 0; + Display.NextScreenWithCheck := nil; + Display.CheckOK := True; + end; { SDL_MOUSEBUTTONDOWN: With Event.button Do Begin diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 296b6d2f..3f733210 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -357,17 +357,20 @@ begin SDLK_M: //Show SongMenu begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin - if not CatSongs.Song[Interaction].Main then begin // clicked on Song - if CatSongs.CatNumShow = -3 then - ScreenSongMenu.MenuShow(SM_Playlist) + if (Length(Songs.Song) > 0) then begin + if (Mode = 0) then begin + if not CatSongs.Song[Interaction].Main then begin // clicked on Song + if CatSongs.CatNumShow = -3 then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end else - ScreenSongMenu.MenuShow(SM_Main); - end - else - begin - ScreenSongMenu.MenuShow(SM_Playlist_Load); - end; + begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); + end; + end //Party Mode -> Show Party Menu + else ScreenSongMenu.MenuShow(SM_Party_Main); end; end; @@ -1506,32 +1509,37 @@ begin Case PlaylistMan.Mode of 0: //All Songs Just Select Random Song begin - repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; - - //Search Cat - for I := I2 downto low(CatSongs.Song) do + //When Tabs are activated then use Tab Method + if (Ini.Tabs_at_startup = 1) then begin - if CatSongs.Song[I].Main then - break; - end; - //In I ist jetzt die Kategorie in I2 der Song + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; - //Choose Cat - CatSongs.ShowCategoryList; + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + //I is the CatNum, I2 is the No of the Song within this Cat - //Show Cat in Top Left Mod - ShowCatTL (I); + //Choose Cat + CatSongs.ShowCategoryList; - CatSongs.ClickCategoryButton(I); - SelectNext; + //Show Cat in Top Left Mod + ShowCatTL (I); - //Fix: Not Existing Song selected: - //if (I+1=I2) then Inc(I2); + CatSongs.ClickCategoryButton(I); + SelectNext; - //Choose Song - SkipTo(I2-I); + //Choose Song + SkipTo(I2-I); + end + //When Tabs are deactivated use easy Method + else + SkipTo(Random(CatSongs.VisibleSongs)); end; 1: //One Category Select Category and Select Random Song begin @@ -1540,28 +1548,23 @@ begin ShowCatTL(PlaylistMan.CurPlayList); SelectNext; - FixSelected; + FixSelected2; SkipTo(Random(CatSongs.VisibleSongs)); - Music.PlayChange; - ChangeMusic; - SetScroll4; - UpdateLCD; end; 2: //Playlist: Select Playlist and Select Random Song begin PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); SkipTo(Random(CatSongs.VisibleSongs)); - Music.PlayChange; - ChangeMusic; - SetScroll4; - UpdateLCD; - FixSelected; + FixSelected2; end; end; - ChangeMusic; + Music.PlayChange; + ChangeMusic; + SetScroll; + UpdateLCD; end; procedure TScreenSong.SetJoker; -- cgit v1.2.3 From 00a4cc524dc2d60c95970def337155b7b57fb4ce Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 9 May 2007 17:44:12 +0000 Subject: Fixed a bug in UScreenSong that causes a little gap between lyrics and Singing in UScreenSing git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@185 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 3f733210..114c52a3 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1220,7 +1220,8 @@ end; procedure TScreenSong.onHide; begin //When hide then Stop Music (For Party Mode Popup on Exit) - Music.Stop; + if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) then + Music.Stop; end; procedure TScreenSong.DrawExtensions; @@ -1650,7 +1651,7 @@ end; procedure TScreenSong.StartSong; begin CatSongs.Selected := Interaction; - //Music.Stop; + Music.Stop; //Party Mode if (Mode = 1) then begin -- cgit v1.2.3 From dcb6e5d386735b3ced44d7c6d6280343a16ca7db Mon Sep 17 00:00:00 2001 From: mota23 Date: Thu, 10 May 2007 00:57:17 +0000 Subject: Some Themework in Stats and SingScreen. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@187 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphic.pas | 2 +- Game/Code/Screens/UScreenSing.pas | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 7fd159f7..205fa9fd 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -146,7 +146,7 @@ const Skin_OscG = 0; Skin_OscB = 0; - Skin_LyricsT = 500; // 510 / 400 + Skin_LyricsT = 494; // 500 / 510 / 400 Skin_SpectrumT = 470; Skin_SpectrumBot = 570; Skin_SpectrumH = 100; diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 6985672f..b49e0add 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -368,7 +368,7 @@ begin // sub text LyricSub.Clear; LyricSub.X := 400; - LyricSub.Y := Skin_LyricsT + 42; //40 + LyricSub.Y := Skin_LyricsT + 35; //42 //40 LyricSub.Align := 1; // set custom options @@ -385,13 +385,13 @@ begin {LyricMain.ColSR := Skin_FontHighlightR; LyricMain.ColSG := Skin_FontHighlightG; LyricMain.ColSB := Skin_FontHighlightB;1aa5dc} - LyricMain.ColSR := 26/255; - LyricMain.ColSG := 165/255; - LyricMain.ColSB := 220/255; + LyricMain.ColSR := 96/255; //26 + LyricMain.ColSG := 192/255; //165 + LyricMain.ColSB := 96/255; //220 - LyricSub.ColR := 0.6; - LyricSub.ColG := 0.6; - LyricSub.ColB := 0.6; + LyricSub.ColR := 0.4; //0.6 + LyricSub.ColG := 0.4; //0.6 + LyricSub.ColB := 0.4; //0.6 end; 1: begin -- cgit v1.2.3 From 4036ca0937c05444b23018a19d69d1aef90495db Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 12 May 2007 09:17:15 +0000 Subject: Party Win Screen now works the way it should. The Statics are sorted by Score git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@190 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UParty.pas | 36 ++++++++++++++++++++++++++++++++--- Game/Code/Screens/UScreenPartyWin.pas | 23 ++++++++++++---------- 2 files changed, 46 insertions(+), 13 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UParty.pas b/Game/Code/Classes/UParty.pas index b07ad5ad..7bf3dd1b 100644 --- a/Game/Code/Classes/UParty.pas +++ b/Game/Code/Classes/UParty.pas @@ -10,6 +10,13 @@ type Winner: Byte; end; + TeamOrderEntry = record + Teamnum: Byte; + Score: Byte; + end; + + TeamOrderArray = Array[0..5] of Byte; + TParty_Session = class private function GetRandomPlayer(Team: Byte): Byte; @@ -25,7 +32,7 @@ type procedure StartNewParty(NumRounds: Byte); procedure StartRound; procedure EndRound; - function GetWinner: Byte; + function GetTeamOrder: TeamOrderArray; function GetWinnerString(Round: Byte): String; end; @@ -334,11 +341,34 @@ begin end; //---------- -//Get Winner - Gives back the Number of the total Winner +//GetTeamOrder - Gives back the Placing of eacb Team [First Position of Array is Teamnum of first placed Team, ...] //---------- -function TParty_Session.GetWinner: Byte; +function TParty_Session.GetTeamOrder: TeamOrderArray; +var + I, J: Integer; + ATeams: array [0..5] of TeamOrderEntry; + TempTeam: TeamOrderEntry; begin + //Fill Team Array + For I := 0 to Teams.NumTeams-1 do + begin + ATeams[I].Teamnum := I; + ATeams[I].Score := Teams.Teaminfo[I].Score; + end; + //Sort Teams + for J := 0 to Teams.NumTeams-1 do + for I := 1 to Teams.NumTeams-1 do + if ATeams[I].Score > ATeams[I-1].Score then + begin + TempTeam := ATeams[I-1]; + ATeams[I-1] := ATeams[I]; + ATeams[I] := TempTeam; + end; + + //Copy to Result + For I := 0 to Teams.NumTeams-1 do + Result[I] := ATeams[I].TeamNum; end; end. diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas index a6486f67..1c4549a4 100644 --- a/Game/Code/Screens/UScreenPartyWin.pas +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -46,11 +46,11 @@ begin Result := false; end; - {SDLK_ESCAPE : + SDLK_ESCAPE : begin Music.PlayStart; FadeTo(@ScreenMain); - end;} + end; SDLK_RETURN: begin @@ -92,15 +92,18 @@ end; procedure TScreenPartyWin.onShow; var I: Integer; + Placing: TeamOrderArray; begin - + //Get Team Placing + Placing := PartySession.GetTeamOrder; + //Set Winnertext - Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.GetWinnerString(255)]); + Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.Teams.Teaminfo[Placing[0]].Name]); if (PartySession.Teams.NumTeams >= 1) then begin - Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[0].Score); - Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[0].Name); + Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[0]].Score); + Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[Placing[0]].Name); Text[TextScoreTeam1].Visible := True; Text[TextNameTeam1].Visible := True; @@ -119,8 +122,8 @@ begin if (PartySession.Teams.NumTeams >= 2) then begin - Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[1].Score); - Text[TextNameTeam2].Text := String(PartySession.Teams.TeamInfo[1].Name); + Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[1]].Score); + Text[TextNameTeam2].Text := String(PartySession.Teams.TeamInfo[Placing[1]].Name); Text[TextScoreTeam2].Visible := True; Text[TextNameTeam2].Visible := True; @@ -139,8 +142,8 @@ begin if (PartySession.Teams.NumTeams >= 3) then begin - Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[2].Score); - Text[TextNameTeam3].Text := String(PartySession.Teams.TeamInfo[2].Name); + Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[2]].Score); + Text[TextNameTeam3].Text := String(PartySession.Teams.TeamInfo[Placing[2]].Name); Text[TextScoreTeam3].Visible := True; Text[TextNameTeam3].Visible := True; -- cgit v1.2.3 From 3d11b9a0a30438bb61df88a91dc7318cdf45a4a8 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 12 May 2007 09:20:21 +0000 Subject: Changed Standard Position for Covers and Equalizer, so that, if no Cover Positions are specified in Team, it looks like the Covers in X-Mas Mod git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@191 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index e8f8eb10..b92ef4fb 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -953,9 +953,8 @@ begin ThemeLoadText(Song.TextCat, 'SongTextCat'); //Load Cover Pos and Size from Theme Mod - Song.Cover.X := ThemeIni.ReadInteger('SongCover', 'X', 400); + Song.Cover.X := ThemeIni.ReadInteger('SongCover', 'X', 300); Song.Cover.Y := ThemeIni.ReadInteger('SongCover', 'Y', 140); - Song.Cover.Z := ThemeIni.ReadInteger('SongCover', 'Z', 250); Song.Cover.W := ThemeIni.ReadInteger('SongCover', 'W', 300); Song.Cover.H := ThemeIni.ReadInteger('SongCover', 'H', 200); Song.Cover.Style := ThemeIni.ReadInteger('SongCover', 'Style', 4); @@ -967,8 +966,8 @@ begin Song.Equalizer.Direction := (ThemeIni.ReadInteger('SongEqualizer', 'Direction', 0) = 1); Song.Equalizer.Alpha := ThemeIni.ReadInteger('SongEqualizer', 'Alpha', 1); Song.Equalizer.Space := ThemeIni.ReadInteger('SongEqualizer', 'Space', 1); - Song.Equalizer.X := ThemeIni.ReadInteger('SongEqualizer', 'X', 650); - Song.Equalizer.Y := ThemeIni.ReadInteger('SongEqualizer', 'Y', 430); + Song.Equalizer.X := ThemeIni.ReadInteger('SongEqualizer', 'X', 0); + Song.Equalizer.Y := ThemeIni.ReadInteger('SongEqualizer', 'Y', 0); Song.Equalizer.Z := ThemeIni.ReadInteger('SongEqualizer', 'Z', 1); Song.Equalizer.W := ThemeIni.ReadInteger('SongEqualizer', 'PieceW', 8); Song.Equalizer.H := ThemeIni.ReadInteger('SongEqualizer', 'PieceH', 8); -- cgit v1.2.3 From 78ddfd6d20e419716dfa5085e01b059d40dd61ed Mon Sep 17 00:00:00 2001 From: b1indy Date: Tue, 15 May 2007 17:49:27 +0000 Subject: fixed angle calculation of covers in the background git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@193 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 114c52a3..9fcb7ee8 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1142,7 +1142,7 @@ begin else Pos := (Pos + VS/2) /VS; - Angle := 2 * pi * Pos*1.2; + Angle := pi * Pos*2; Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers -- cgit v1.2.3 From 66f4c5511f1cc61b68e75d874ea6a1dc88f9e75a Mon Sep 17 00:00:00 2001 From: mota23 Date: Tue, 15 May 2007 18:04:42 +0000 Subject: Added: Keys 1.2.3 to use Joker in Popup-Party-Menu Added: 2 sets of Statics for Song-Screen. (need work, just startet) Some Fixes in Deluxe Theme. (missing texts, fixed positions etc.) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@194 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 10 ++++++++++ Game/Code/Screens/UScreenSong.pas | 26 ++++++++++++++++++++++++-- Game/Code/Screens/UScreenSongMenu.pas | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index b92ef4fb..d3358440 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -293,6 +293,13 @@ type StaticTeam3Joker3: TThemeStatic; StaticTeam3Joker4: TThemeStatic; StaticTeam3Joker5: TThemeStatic; + + + + StaticKeys1 : TThemeStatic; + TextKeys1 : TThemeText; + + end; TThemeSing = class(TThemeBasic) @@ -1002,6 +1009,9 @@ begin ThemeLoadStatic(Song.StaticTeam3Joker4, 'SongStaticTeam3Joker4'); ThemeLoadStatic(Song.StaticTeam3Joker5, 'SongStaticTeam3Joker5'); + ThemeLoadStatic(Song.StaticKeys1, 'SongStaticKeys1'); + ThemeLoadText(Song.TextKeys1, 'SongStaticKeys1Text'); + // Sing ThemeLoadBasic(Sing, 'Sing'); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 9fcb7ee8..2ce6b6df 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -52,7 +52,9 @@ type StaticTeam3Joker3: Cardinal; StaticTeam3Joker4: Cardinal; StaticTeam3Joker5: Cardinal; - + StaticKeys1: Cardinal; + TextKeys1: integer; + constructor Create; override; procedure SetScroll; procedure SetScroll1; @@ -79,7 +81,7 @@ type //Party Mode procedure SelectRandomSong; procedure SetJoker; - + procedure SetStatics; //procedures for Menu procedure StartSong; procedure OpenEditor; @@ -662,6 +664,10 @@ begin StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); + StaticKeys1 := AddStatic(Theme.Song.StaticKeys1); + + TextKeys1 := AddText(Theme.Song.TextKeys1); + // Song List // Songs.LoadSongList; // moved to the UltraStar unit CatSongs.Refresh; @@ -1215,6 +1221,7 @@ begin end; SetJoker; + SetStatics; end; procedure TScreenSong.onHide; @@ -1646,6 +1653,21 @@ begin end; end; +procedure TScreenSong.SetStatics; +begin + //If Party Mode + if Mode = 1 then //Use Statics for Party-Song-Selection + begin + Static[StaticKeys1].Visible := false; + Text[TextKeys1].Visible := false; + end + else //Use regular Statics for Song-Selection + begin //Hide all + Static[StaticKeys1].Visible := true; + Text[TextKeys1].Visible := true; + end; +end; + //Procedures for Menu procedure TScreenSong.StartSong; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 73b38a05..537536bb 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -96,6 +96,39 @@ begin if (Interaction=3) then InteractDec; end; + + SDLK_1: + begin //Jocker + //Joker spielen + case CurMenu of + SM_Party_Main: + begin + ScreenSong.DoJoker(0) + end; + end; + end; + SDLK_2: + begin //Jocker + //Joker spielen + case CurMenu of + SM_Party_Main: + begin + ScreenSong.DoJoker(1) + end; + end; + end; + SDLK_3: + begin //Jocker + //Joker spielen + case CurMenu of + SM_Party_Main: + begin + ScreenSong.DoJoker(2) + end; + end; + end; + + end; end; end; -- cgit v1.2.3 From 9b29c5321e423fbe6ba29f32bdcf8f2c83828e92 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 16 May 2007 18:18:37 +0000 Subject: Fixed text position of SelectSlide when High is not 70 Added ability to change Z and Textsize from SelectSlide Use new abilitys to finish SongMenu Screen in Deluxe Theme git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@196 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 8 ++++++++ Game/Code/Menu/UMenu.pas | 7 ++++++- Game/Code/Menu/UMenuSelectSlide.pas | 4 ++-- 3 files changed, 16 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index d3358440..b9183740 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -186,6 +186,9 @@ type Y: integer; W: integer; H: integer; + Z: real; + + TextSize: integer; //SBGW Mod SBGW: integer; @@ -1717,6 +1720,11 @@ begin ThemeSelectS.Y := ThemeIni.ReadInteger(Name, 'Y', 0); ThemeSelectS.W := ThemeIni.ReadInteger(Name, 'W', 0); ThemeSelectS.H := ThemeIni.ReadInteger(Name, 'H', 0); + + ThemeSelectS.Z := ThemeIni.ReadFloat(Name, 'Z', 0); + + ThemeSelectS.TextSize := ThemeIni.ReadInteger(Name, 'TextSize', 10); + ThemeSelectS.SkipX := ThemeIni.ReadInteger(Name, 'SkipX', 0); ThemeSelectS.SBGW := ThemeIni.ReadInteger(Name, 'SBGW', 450); diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index c9d3c726..d7c919ee 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -1102,6 +1102,11 @@ begin for SO := 0 to High(Values) do AddSelectSlideOption(Values[SO]); + SelectsS[High(SelectsS)].Text.Size := ThemeSelectS.TextSize; + + SelectsS[High(SelectsS)].Texture.Z := ThemeSelectS.Z; + SelectsS[High(SelectsS)].TextureSBG.Z := ThemeSelectS.Z; + //Generate Lines SelectsS[High(SelectsS)].GenLines; @@ -1153,7 +1158,7 @@ begin SelectsS[S].SBGDInt := SBGDInt; SelectsS[S].Text.X := X + 20; - SelectsS[S].Text.Y := Y + 20; + SelectsS[S].Text.Y := Y + (SelectsS[S].TextureSBG.H / 2) - 15; SelectsS[S].Text.Text := Caption; SelectsS[S].Text.Size := 10; SelectsS[S].Text.Visible := true; diff --git a/Game/Code/Menu/UMenuSelectSlide.pas b/Game/Code/Menu/UMenuSelectSlide.pas index 9885acc0..0149ea2b 100644 --- a/Game/Code/Menu/UMenuSelectSlide.pas +++ b/Game/Code/Menu/UMenuSelectSlide.pas @@ -315,7 +315,7 @@ begin //TextOpt[I] := TextOpt[0]; TextOpt[I] := TText.Create; - TextOpt[I].Size := 10; + TextOpt[I].Size := Text.Size; //TextOpt[I].Align := 1; TextOpt[I].Align := 0; TextOpt[I].Visible := True; @@ -328,7 +328,7 @@ begin //Generate Positions //TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * (I + 0.5); TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * I; - TextOpt[I].Y := TextureSBG.Y + 20; + TextOpt[I].Y := TextureSBG.Y + (TextureSBG.H / 2) - 1.5 * Text.Size{20}; //Better Look with 2 Options if (Lines=2) AND (Length(TextOptT)= 2) then -- cgit v1.2.3 From 4a731514163a14bd3a9222d99707880b56772663 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 16 May 2007 19:19:35 +0000 Subject: all SongFile Loading and Saving procedures moved to UFiles. Added Some Tolerance in Song File Loading and Song Header Loading. Fix: Programm doesn't Crash anymore when a coruppted Song is loaded for Singing or Editing. Now Jump back to SongScreen and show an Error Message. Also Party Mode is not Interupted, a new Song will be selected automatically. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@197 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCatCovers.pas | 2 +- Game/Code/Classes/UCovers.pas | 2 +- Game/Code/Classes/UDLLManager.pas | 2 +- Game/Code/Classes/UFiles.pas | 494 +++++++++++++++++++++++++-- Game/Code/Classes/UIni.pas | 2 +- Game/Code/Classes/ULanguage.pas | 2 +- Game/Code/Classes/ULog.pas | 2 +- Game/Code/Classes/UMusic.pas | 2 +- Game/Code/Classes/UPlaylist.pas | 2 +- Game/Code/Classes/USongs.pas | 2 +- Game/Code/Menu/UDisplay.pas | 6 +- Game/Code/Screens/UScreenCredits.pas | 2 +- Game/Code/Screens/UScreenEditConvert.pas | 2 +- Game/Code/Screens/UScreenEditHeader.pas | 2 +- Game/Code/Screens/UScreenEditSub.pas | 79 +++-- Game/Code/Screens/UScreenLevel.pas | 2 +- Game/Code/Screens/UScreenMain.pas | 2 +- Game/Code/Screens/UScreenName.pas | 2 +- Game/Code/Screens/UScreenOpen.pas | 2 +- Game/Code/Screens/UScreenOptions.pas | 2 +- Game/Code/Screens/UScreenOptionsAdvanced.pas | 2 +- Game/Code/Screens/UScreenOptionsGame.pas | 2 +- Game/Code/Screens/UScreenOptionsGraphics.pas | 2 +- Game/Code/Screens/UScreenOptionsLyrics.pas | 2 +- Game/Code/Screens/UScreenOptionsRecord.pas | 2 +- Game/Code/Screens/UScreenOptionsSound.pas | 2 +- Game/Code/Screens/UScreenOptionsThemes.pas | 2 +- Game/Code/Screens/UScreenPartyNewRound.pas | 2 +- Game/Code/Screens/UScreenPartyOptions.pas | 2 +- Game/Code/Screens/UScreenPartyPlayer.pas | 2 +- Game/Code/Screens/UScreenPopup.pas | 2 +- Game/Code/Screens/UScreenSing.pas | 26 +- Game/Code/Screens/UScreenSingModi.pas | 2 +- Game/Code/Screens/UScreenSong.pas | 4 +- Game/Code/Screens/UScreenSongJumpto.pas | 2 +- Game/Code/Screens/UScreenSongMenu.pas | 2 +- Game/Code/UltraStar.dpr | 4 +- 37 files changed, 577 insertions(+), 98 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UCatCovers.pas b/Game/Code/Classes/UCatCovers.pas index 00a758c8..34742902 100644 --- a/Game/Code/Classes/UCatCovers.pas +++ b/Game/Code/Classes/UCatCovers.pas @@ -24,7 +24,7 @@ var CatCovers: TCatCovers; implementation -uses IniFiles, SysUtils, Classes, UPliki, ULog; +uses IniFiles, SysUtils, Classes, UFiles, ULog; constructor TCatCovers.Create; begin diff --git a/Game/Code/Classes/UCovers.pas b/Game/Code/Classes/UCovers.pas index 55329fd2..5b0a06d4 100644 --- a/Game/Code/Classes/UCovers.pas +++ b/Game/Code/Classes/UCovers.pas @@ -34,7 +34,7 @@ var Covers: TCovers; implementation -uses UPliki, ULog, DateUtils; +uses UFiles, ULog, DateUtils; constructor TCovers.Create; begin diff --git a/Game/Code/Classes/UDLLManager.pas b/Game/Code/Classes/UDLLManager.pas index 151f0617..59c75d5b 100644 --- a/Game/Code/Classes/UDLLManager.pas +++ b/Game/Code/Classes/UDLLManager.pas @@ -1,7 +1,7 @@ unit UDLLManager; interface -uses ModiSDK, UPliki; +uses ModiSDK, UFiles; type TDLLMan = class diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index fed9b7f1..912a476d 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -4,43 +4,54 @@ interface uses USongs, SysUtils, ULog, UMusic; -//procedure InitializePaths; //Function sets All Absolute Paths eg. for Songs +procedure InitializePaths; //Function sets All Absolute Paths eg. for Songs function ReadTXTHeader(var Song: TSong): boolean; //Reads Standard TXT Header function AnalyseFile(var Song: TSong): boolean; //Analyse Song File and Read Header procedure ClearSong(var Song: TSong); //Clears Song Header values -//procedure CzyscNuty; -//function WczytajCzesci(Name: string): boolean; -//function SaveSong(Song: TSong; Czesc: TCzesci; Name: string; Relative: boolean): boolean; -//function SaveSongDebug(Song: TSong; Czesc: TCzesci; Name: string; Relative: boolean): boolean; +//Methodes Loading and Saving Songfiles +procedure ResetSingTemp; +procedure ParseNote(NrCzesci: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string); +procedure NewSentence(NrCzesciP: integer; Param1, Param2: integer); +function LoadSong(Name: string): boolean; +function SaveSong(Song: TSong; Czesc: TCzesci; Name: string; Relative: boolean): boolean; + + var - {//Absolute Paths - GamePath: string; - SoundPath: string; - SongPath: string; - LogPath: string; - ThemePath: string; + //Absolute Paths + GamePath: string; + SoundPath: string; + SongPath: string; + LogPath: string; + ThemePath: string; ScreenshotsPath: string; CoversPath: string; - LanguagesPath: string; //} + LanguagesPath: string; + PluginPath: string; + PlayListPath: string; SongFile: TextFile; // all procedures in this unit operates on this file FileLineNo: integer; //Line which is readed at Last, for error reporting - {// variables available for all procedures + // variables available for all procedures Base: array[0..1] of integer; - Rel: array[0..1] of integer;//} + Rel: array[0..1] of integer; Mult: integer = 1; MultBPM: integer = 4; implementation -uses TextGL, UIni, UMain, UPliki; +uses TextGL, UIni, UMain; - //Function sets All Absolute Paths eg. for Songs -{procedure InitializePaths; +//-------------------- +// Function sets all Absolute Paths e.g. Song Path and makes sure the Directorys exist +//-------------------- +procedure InitializePaths; +var + Writeable: Boolean; begin GamePath := ExtractFilePath(ParamStr(0)); + SoundPath := GamePath + 'Sounds\'; SongPath := GamePath + 'Songs\'; LogPath := GamePath; @@ -48,11 +59,43 @@ begin ScreenshotsPath := GamePath + 'Screenshots\'; CoversPath := GamePath + 'Covers\'; LanguagesPath := GamePath + 'Languages\'; + PluginPath := GamePath + 'Plugins\'; + PlaylistPath := GamePath + 'Playlists\'; + + //After Setting Paths, make sure that Paths exist + If not DirectoryExists(SoundPath) then + Writeable := ForceDirectories(SoundPath); + + If Writeable And (not DirectoryExists(SongPath)) then + Writeable := ForceDirectories(SongPath); + + If Writeable And (not DirectoryExists(ThemePath)) then + Writeable := ForceDirectories(ThemePath); + + If Writeable And (not DirectoryExists(ScreenshotsPath)) then + Writeable := ForceDirectories(ScreenshotsPath); + + If Writeable And (not DirectoryExists(CoversPath)) then + Writeable := ForceDirectories(CoversPath); + + If Writeable And (not DirectoryExists(LanguagesPath)) then + Writeable := ForceDirectories(LanguagesPath); + + If Writeable And (not DirectoryExists(PluginPath)) then + Writeable := ForceDirectories(PluginPath); + + If Writeable And (not DirectoryExists(PlaylistPath)) then + Writeable := ForceDirectories(PlaylistPath); + + if not Writeable then + Log.LogError('Error: Dir is Readonly'); DecimalSeparator := ','; -end;} +end; - //Clears Song Header values +//-------------------- +// Clears Song Header values +//-------------------- procedure ClearSong(var Song: TSong); begin //Main Information @@ -80,7 +123,9 @@ begin Song.Creator := ''; end; - //Reads Standard TXT Header +//-------------------- +// Reads Standard TXT Header +//-------------------- function ReadTXTHeader(var Song: TSong): boolean; var Line, Identifier, Value: String; @@ -100,7 +145,7 @@ begin end; //Read Lines while Line starts with # - While (Line[1] = '#') do + While (Length(Line) = 0) OR (Line[1] = '#') do begin //Increase Line Number Inc (FileLineNo); @@ -279,9 +324,9 @@ begin break; end; - //End on first empty Line + {//End on first empty Line if (Length(Line) = 0) then - break; + break;} end; //Check if all Required Values are given @@ -302,7 +347,9 @@ begin end; - //Analyse Song File and Read Header +//-------------------- +// Analyse Song File and Read Header +//-------------------- function AnalyseFile(var Song: TSong): boolean; begin Result := False; @@ -331,6 +378,405 @@ Result := False; end;} end; +//-------------------- +// Resets the temporary Sentence Arrays for each Player and some other Variables +//-------------------- +procedure ResetSingTemp; +var + Pet: integer; +begin + SetLength(Czesci, Length(Player)); + SetLength(AktSong.BPM, 0); + for Pet := 0 to High(Player) do begin + SetLength(Czesci[Pet].Czesc, 1); + SetLength(Czesci[Pet].Czesc[0].Nuta, 0); + Czesci[Pet].Czesc[0].Lyric := ''; + Czesci[Pet].Czesc[0].LyricWidth := 0; + Player[pet].Score := 0; + Player[pet].IlNut := 0; + Player[pet].HighNut := -1; + end; + //Reset Path and Filename Values to Prevent Errors in Editor + AktSong.Path := ''; + AktSong.FileName := ''; +end; + +//-------------------- +// Parses Note Infos and save them to Array +//-------------------- +procedure ParseNote(NrCzesci: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string); +var + Space: boolean; +begin + case Ini.Solmization of + 1: // european + begin + case (NoteP mod 12) of + 0..1: LyricS := ' do '; + 2..3: LyricS := ' re '; + 4: LyricS := ' mi '; + 5..6: LyricS := ' fa '; + 7..8: LyricS := ' sol '; + 9..10: LyricS := ' la '; + 11: LyricS := ' si '; + end; + end; + 2: // japanese + begin + case (NoteP mod 12) of + 0..1: LyricS := ' do '; + 2..3: LyricS := ' re '; + 4: LyricS := ' mi '; + 5..6: LyricS := ' fa '; + 7..8: LyricS := ' so '; + 9..10: LyricS := ' la '; + 11: LyricS := ' shi '; + end; + end; + 3: // american + begin + case (NoteP mod 12) of + 0..1: LyricS := ' do '; + 2..3: LyricS := ' re '; + 4: LyricS := ' mi '; + 5..6: LyricS := ' fa '; + 7..8: LyricS := ' sol '; + 9..10: LyricS := ' la '; + 11: LyricS := ' ti '; + end; + end; + end; // case + + with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].High] do begin + SetLength(Nuta, Length(Nuta) + 1); + IlNut := IlNut + 1; + HighNut := HighNut + 1; + Muzyka.IlNut := Muzyka.IlNut + 1; + + Nuta[HighNut].Start := StartP; + if IlNut = 1 then begin + StartNote := Nuta[HighNut].Start; + if Czesci[NrCzesci].Ilosc = 1 then + Start := -100; +// Start := Nuta[HighNut].Start; + end; + + Nuta[HighNut].Dlugosc := DurationP; + Muzyka.DlugoscNut := Muzyka.DlugoscNut + Nuta[HighNut].Dlugosc; + + // back to the normal system with normal, golden and now freestyle notes + case TypeP of + 'F': Nuta[HighNut].Wartosc := 0; + ':': Nuta[HighNut].Wartosc := 1; + '*': Nuta[HighNut].Wartosc := 2; + end; + + Czesci[NrCzesci].Wartosc := Czesci[NrCzesci].Wartosc + Nuta[HighNut].Dlugosc * Nuta[HighNut].Wartosc; + + Nuta[HighNut].Ton := NoteP; + if Nuta[HighNut].Ton < Base[NrCzesci] then Base[NrCzesci] := Nuta[HighNut].Ton; + Nuta[HighNut].TonGamy := Nuta[HighNut].TonGamy mod 12; + + Nuta[HighNut].Tekst := Copy(LyricS, 2, 100); + Lyric := Lyric + Nuta[HighNut].Tekst; + + if TypeP = 'F' then + Nuta[HighNut].FreeStyle := true; + + Koniec := Nuta[HighNut].Start + Nuta[HighNut].Dlugosc; + end; // with +end; + +//-------------------- +// Called when a new Sentence is found in the TXT File +//-------------------- +procedure NewSentence(NrCzesciP: integer; Param1, Param2: integer); +var +I: Integer; +begin + + // stara czesc //Alter Satz //Update Old Part + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].BaseNote := Base[NrCzesciP]; + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].LyricWidth := glTextWidth(PChar(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Lyric)); + + //Total Notes Patch + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes := 0; + for I := low(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta) to high(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta) do + begin + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes := Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta[I].Dlugosc * Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta[I].Wartosc; + end; + //Total Notes Patch End + + + // nowa czesc //Neuer Satz //Update New Part + SetLength(Czesci[NrCzesciP].Czesc, Czesci[NrCzesciP].Ilosc + 1); + Czesci[NrCzesciP].High := Czesci[NrCzesciP].High + 1; + Czesci[NrCzesciP].Ilosc := Czesci[NrCzesciP].Ilosc + 1; + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].HighNut := -1; + + if not AktSong.Relative then + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Start := Param1; + + if AktSong.Relative then begin + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Start := Param1; + Rel[NrCzesciP] := Rel[NrCzesciP] + Param2; + end; + + Base[NrCzesciP] := 100; // high number +end; +//-------------------- +// Load a Song +//-------------------- +function LoadSong(Name: string): boolean; +var + TempC: char; + Tekst: string; + CP: integer; // Current Player (0 or 1) + Pet: integer; + Both: boolean; + Param1: integer; + Param2: integer; + Param3: integer; + ParamS: string; + I: Integer; +begin + Result := false; + + if not FileExists(Name) then begin + Log.LogError('File not found: "' + Name + '"', 'WczytajCzesci'); + exit; + end; + + try + MultBPM := 4; // 4 - mnoznik dla czasu nut + Mult := 1; // 4 - dokladnosc pomiaru nut + Base[0] := 100; // high number +// Base[1] := 100; // high number + Czesci[0].Wartosc := 0; +// Czesci[1].Wartosc := 0; // here was the error in 0.3.2 + AktSong.Relative := false; + + Rel[0] := 0; +// Rel[1] := 0; + CP := 0; + Both := false; + if Length(Player) = 2 then Both := true; + + FileMode := fmOpenRead; + AssignFile(SongFile, Name); + Reset(SongFile); + + //Clear old Song Header + ClearSong(AktSong); + + if (AktSong.Path = '') then + AktSong.Path := ExtractFilePath(Name); + + if (AktSong.FileName = '') then + AktSong.Filename := ExtractFileName(Name); + //Read Header + Result := ReadTxTHeader(AktSong); + if not Result then + begin + Log.LogError('Error Loading SongHeader, abort Song Loading'); + Exit; + end; + + Result := False; + + Reset(SongFile); + FileLineNo := 0; + //Search for Note Begining + repeat + ReadLn(SongFile, Tekst); + Inc(FileLineNo); + + if (EoF(SongFile)) then + begin //Song File Corrupted - No Notes + Log.LogError('Could not load txt File, no Notes found: ' + Name); + Result := False; + Exit; + end; + Read(SongFile, TempC); + until ((TempC = ':') or (TempC = 'F') or (TempC = '*')); + + SetLength(Czesci, 2); + for Pet := 0 to High(Czesci) do begin + SetLength(Czesci[Pet].Czesc, 1); + Czesci[Pet].High := 0; + Czesci[Pet].Ilosc := 1; + Czesci[Pet].Akt := 0; + Czesci[Pet].Resolution := AktSong.Resolution; + Czesci[Pet].NotesGAP := AktSong.NotesGAP; + Czesci[Pet].Czesc[0].IlNut := 0; + Czesci[Pet].Czesc[0].HighNut := -1; + end; + +// TempC := ':'; +// TempC := Tekst[1]; // read from backup variable, don't use default ':' value + + while (TempC <> 'E') AND (not EOF(SongFile)) do begin + Inc(FileLineNo); + if (TempC = ':') or (TempC = '*') or (TempC = 'F') then begin + // wczytuje nute + Read(SongFile, Param1); + Read(SongFile, Param2); + Read(SongFile, Param3); + Read(SongFile, ParamS); + + // dodaje nute + if not Both then + // P1 + ParseNote(0, TempC, (Param1+Rel[0]) * Mult, Param2 * Mult, Param3, ParamS) + else begin + // P1 + P2 + ParseNote(0, TempC, (Param1+Rel[0]) * Mult, Param2 * Mult, Param3, ParamS); + ParseNote(1, TempC, (Param1+Rel[1]) * Mult, Param2 * Mult, Param3, ParamS); + end; + end; // if + if TempC = '-' then begin + // reads sentence + Read(SongFile, Param1); + if AktSong.Relative then Read(SongFile, Param2); // read one more data for relative system + + // new sentence + if not Both then + // P1 + NewSentence(0, (Param1 + Rel[0]) * Mult, Param2) + else begin + // P1 + P2 + NewSentence(0, (Param1 + Rel[0]) * Mult, Param2); + NewSentence(1, (Param1 + Rel[1]) * Mult, Param2); + end; + + end; // if + + if TempC = 'B' then begin + SetLength(AktSong.BPM, Length(AktSong.BPM) + 1); + Read(SongFile, AktSong.BPM[High(AktSong.BPM)].StartBeat); + AktSong.BPM[High(AktSong.BPM)].StartBeat := AktSong.BPM[High(AktSong.BPM)].StartBeat + Rel[0]; + + Read(SongFile, Tekst); + AktSong.BPM[High(AktSong.BPM)].BPM := StrToFloat(Tekst); + AktSong.BPM[High(AktSong.BPM)].BPM := AktSong.BPM[High(AktSong.BPM)].BPM * Mult * MultBPM; + end; + + + if not Both then begin + Czesci[CP].Czesc[Czesci[CP].High].BaseNote := Base[CP]; + Czesci[CP].Czesc[Czesci[CP].High].LyricWidth := glTextWidth(PChar(Czesci[CP].Czesc[Czesci[CP].High].Lyric)); + //Total Notes Patch + Czesci[CP].Czesc[Czesci[CP].High].TotalNotes := 0; + for I := low(Czesci[CP].Czesc[Czesci[CP].High].Nuta) to high(Czesci[CP].Czesc[Czesci[CP].High].Nuta) do + begin + Czesci[CP].Czesc[Czesci[CP].High].TotalNotes := Czesci[CP].Czesc[Czesci[CP].High].TotalNotes + Czesci[CP].Czesc[Czesci[CP].High].Nuta[I].Dlugosc * Czesci[CP].Czesc[Czesci[CP].High].Nuta[I].Wartosc; + end; + //Total Notes Patch End + end else begin + for Pet := 0 to High(Czesci) do begin + Czesci[Pet].Czesc[Czesci[Pet].High].BaseNote := Base[Pet]; + Czesci[Pet].Czesc[Czesci[Pet].High].LyricWidth := glTextWidth(PChar(Czesci[Pet].Czesc[Czesci[Pet].High].Lyric)); + //Total Notes Patch + Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes := 0; + for I := low(Czesci[Pet].Czesc[Czesci[Pet].High].Nuta) to high(Czesci[Pet].Czesc[Czesci[Pet].High].Nuta) do + begin + Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes := Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes + Czesci[Pet].Czesc[Czesci[Pet].High].Nuta[I].Dlugosc * Czesci[Pet].Czesc[Czesci[Pet].High].Nuta[I].Wartosc; + end; + //Total Notes Patch End + end; + end; + + Read(SongFile, TempC); + end; // while} + + CloseFile(SongFile); + except + Log.LogError('Error Loading File: "' + Name + '" in Line ' + inttostr(FileLineNo)); + exit; + end; + + Result := true; +end; + +//-------------------- +// Saves a Song +//-------------------- +function SaveSong(Song: TSong; Czesc: TCzesci; Name: string; Relative: boolean): boolean; +var + C: integer; + N: integer; + S: string; + B: integer; + RelativeSubTime: integer; + NoteState: String; + +begin +// Relative := true; // override (idea - use shift+S to save with relative) + AssignFile(SongFile, Name); + Rewrite(SongFile); + + WriteLn(SongFile, '#TITLE:' + Song.Title + ''); + WriteLn(SongFile, '#ARTIST:' + Song.Artist); + + if Song.Creator <> '' then WriteLn(SongFile, '#CREATOR:' + Song.Creator); + if Song.Edition <> 'Unknown' then WriteLn(SongFile, '#EDITION:' + Song.Edition); + if Song.Genre <> 'Unknown' then WriteLn(SongFile, '#GENRE:' + Song.Genre); + if Song.Language <> 'Unknown' then WriteLn(SongFile, '#LANGUAGE:' + Song.Language); + if Song.Cover <> '' then WriteLn(SongFile, '#COVER:' + Song.Cover); + + WriteLn(SongFile, '#MP3:' + Song.Mp3); + + if Song.Background <> '' then WriteLn(SongFile, '#BACKGROUND:' + Song.Background); + if Song.Video <> '' then WriteLn(SongFile, '#VIDEO:' + Song.Video); + if Song.VideoGAP <> 0 then WriteLn(SongFile, '#VIDEOGAP:' + FloatToStr(Song.VideoGAP)); + if Song.Resolution <> 4 then WriteLn(SongFile, '#RESOLUTION:' + IntToStr(Song.Resolution)); + if Song.NotesGAP <> 0 then WriteLn(SongFile, '#NOTESGAP:' + IntToStr(Song.NotesGAP)); + if Song.Start <> 0 then WriteLn(SongFile, '#START:' + FloatToStr(Song.Start)); + if Song.Finish <> 0 then WriteLn(SongFile, '#END:' + IntToStr(Song.Finish)); + if Relative then WriteLn(SongFile, '#RELATIVE:yes'); + + WriteLn(SongFile, '#BPM:' + FloatToStr(Song.BPM[0].BPM / 4)); + WriteLn(SongFile, '#GAP:' + FloatToStr(Song.GAP)); + + RelativeSubTime := 0; + for B := 1 to High(AktSong.BPM) do + WriteLn(SongFile, 'B ' + FloatToStr(AktSong.BPM[B].StartBeat) + ' ' + FloatToStr(AktSong.BPM[B].BPM/4)); + + for C := 0 to Czesc.High do begin + for N := 0 to Czesc.Czesc[C].HighNut do begin + with Czesc.Czesc[C].Nuta[N] do begin + + + //Golden + Freestyle Note Patch + case Czesc.Czesc[C].Nuta[N].Wartosc of + 0: NoteState := 'F '; + 1: NoteState := ': '; + 2: NoteState := '* '; + end; // case + S := NoteState + IntToStr(Start-RelativeSubTime) + ' ' + IntToStr(Dlugosc) + ' ' + IntToStr(Ton) + ' ' + Tekst; + + + WriteLn(SongFile, S); + end; // with + end; // N + + if C < Czesc.High then begin // don't write end of last sentence + if not Relative then + S := '- ' + IntToStr(Czesc.Czesc[C+1].Start) + else begin + S := '- ' + IntToStr(Czesc.Czesc[C+1].Start - RelativeSubTime) + + ' ' + IntToStr(Czesc.Czesc[C+1].Start - RelativeSubTime); + RelativeSubTime := Czesc.Czesc[C+1].Start; + end; + WriteLn(SongFile, S); + end; + + end; // C + + + WriteLn(SongFile, 'E'); + CloseFile(SongFile); +end; end. \ No newline at end of file diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index cafbc912..f12e3832 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -147,7 +147,7 @@ const IChannel: array[0..6] of string = ('0', '1', '2', '3', '4', '5', '6'); implementation -uses UPliki, SDL, ULanguage, USkins, URecord; +uses UFiles, SDL, ULanguage, USkins, URecord; procedure TIni.Load; var diff --git a/Game/Code/Classes/ULanguage.pas b/Game/Code/Classes/ULanguage.pas index b911b90a..4649c089 100644 --- a/Game/Code/Classes/ULanguage.pas +++ b/Game/Code/Classes/ULanguage.pas @@ -36,7 +36,7 @@ var implementation -uses UPliki, UIni, IniFiles, Classes, SysUtils, Windows, ULog; +uses UFiles, UIni, IniFiles, Classes, SysUtils, Windows, ULog; //---------- //Create - Construct Class then LoadList + Standard Language + Set Standard Implode Glues diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index 0b492cb3..59e25954 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -47,7 +47,7 @@ var Log: TLog; implementation -uses UPliki, SysUtils, DateUtils, URecord, UTime, UIni, Windows; +uses UFiles, SysUtils, DateUtils, URecord, UTime, UIni, Windows; destructor TLog.Free; begin diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index 0e4e4ddd..6e997c11 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -199,7 +199,7 @@ const ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); implementation -uses UGraphic, URecord, UPliki, UIni, UMain, UThemes; +uses UGraphic, URecord, UFiles, UIni, UMain, UThemes; procedure InitializeSound; begin diff --git a/Game/Code/Classes/UPlaylist.pas b/Game/Code/Classes/UPlaylist.pas index 15e17047..67460ed7 100644 --- a/Game/Code/Classes/UPlaylist.pas +++ b/Game/Code/Classes/UPlaylist.pas @@ -58,7 +58,7 @@ type implementation -uses USongs, ULog, UPliki, UGraphic, UThemes, SysUtils; +uses USongs, ULog, UFiles, UGraphic, UThemes, SysUtils; //---------- //Create - Construct Class - Dummy for now diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 4b49127c..edf5b6df 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -96,7 +96,7 @@ var implementation -uses UPliki, UIni, UFiles, StrUtils; +uses UFiles, UIni, StrUtils; procedure TSongs.LoadSongList; begin diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index d1d3038d..abaedfa8 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -42,7 +42,7 @@ var implementation -uses UGraphic, UTime, Graphics, Jpeg, UPliki, UTexture, UIni; +uses UGraphic, UTime, Graphics, Jpeg, UFiles, UTexture, UIni; constructor TDisplay.Create; var i: integer; @@ -137,8 +137,8 @@ begin NextScreenWithCheck := NIL; CheckOk:=False; end - else - BlackScreen:=True; // end of game - fade to black before exit + else + BlackScreen:=True; // end of game - fade to black before exit //end popup hack // ActualScreen.SetAnimationProgress(1); diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 0411c7b6..98cdc417 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -3,7 +3,7 @@ unit UScreenCredits; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes, ULCD, ULight; + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes, ULCD, ULight; type TScreenCredits = class(TMenu) diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index 62a50b3e..92e8544c 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -66,7 +66,7 @@ type end; implementation -uses UGraphic, SysUtils, UDrawTexture, TextGL, UPliki, UMain, UIni, OpenGL, USkins; +uses UGraphic, SysUtils, UDrawTexture, TextGL, UFiles, UMain, UIni, OpenGL, USkins; function TScreenEditConvert.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; var diff --git a/Game/Code/Screens/UScreenEditHeader.pas b/Game/Code/Screens/UScreenEditHeader.pas index f3e21fd0..35d7840f 100644 --- a/Game/Code/Screens/UScreenEditHeader.pas +++ b/Game/Code/Screens/UScreenEditHeader.pas @@ -44,7 +44,7 @@ type implementation -uses UGraphic, UMusic, SysUtils, UPliki, USkins; +uses UGraphic, UMusic, SysUtils, UFiles, USkins; function TScreenEditHeader.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; var diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index a665ba1c..a0adef2c 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -2,12 +2,15 @@ unit UScreenEditSub; interface -uses UMenu, UMusic, SDL, SysUtils, UPliki, UTime, USongs, UIni, ULog, USmpeg, UTexture, UMenuText, +uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, UMenuText, ULyrics, Math, OpenGL12, UThemes, MidiOut; type TScreenEditSub = class(TMenu) private + //Variable is True if no SOng is loaded + Error: Boolean; + TextNote: integer; TextSentence: integer; TextTitle: integer; @@ -71,7 +74,7 @@ type end; implementation -uses UGraphic, UDraw, UMain, USkins; +uses UGraphic, UDraw, UMain, USkins, ULanguage; // Method for input parsing. If False is returned, GetNextWindow // should be checked to know the next window to load; @@ -190,17 +193,15 @@ begin SDLK_S: begin - if SDL_ModState = 0 then - // Save Song - SaveSong(AktSong, Czesci[0], Path + FileName, false); - + // Save Song if SDL_ModState = KMOD_LSHIFT then - // Save Song - SaveSong(AktSong, Czesci[0], Path + FileName, true); + SaveSong(AktSong, Czesci[0], Path + FileName, true) + else + SaveSong(AktSong, Czesci[0], Path + FileName, false); - if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL + KMOD_LALT then + {if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL + KMOD_LALT then // Save Song - SaveSongDebug(AktSong, Czesci[0], 'C:\song.asm', false); + SaveSongDebug(AktSong, Czesci[0], 'C:\song.asm', false);} end; @@ -1091,20 +1092,26 @@ procedure TScreenEditSub.onShow; begin Log.LogStatus('Initializing', 'TEditScreen.onShow'); - MidiOut := TMidiOutput.Create(nil); - if Ini.Debug = 1 then - MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table - MidiOut.Open; - - //MidiOut.SetVolume(65535, 65535); - - + try + ResetSingTemp; + Error := not LoadSong(Path + FileName); + except + Error := True; + end; - CzyscNuty; - if WczytajCzesci(Path + FileName) = false then -// if WczytajCzesci(SongPath + 'Zapis.txt') = false then - Text[TextTitle].Text := 'Error loading file' + if Error then + begin + //Error Loading Song -> Go back to Song Screen and Show some Error Message + FadeTo(@ScreenSong); + ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); + Exit; + end else begin + MidiOut := TMidiOutput.Create(nil); + if Ini.Debug = 1 then + MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table + MidiOut.Open; + Text[TextTitle].Text := AktSong.Title; Text[TextArtist].Text := AktSong.Artist; Text[TextMp3].Text := AktSong.Mp3; @@ -1201,7 +1208,7 @@ begin end; end; // click end; // if PlaySentence - + Text[TextSentence].Text := IntToStr(Czesci[0].Akt + 1) + ' / ' + IntToStr(Czesci[0].Ilosc); Text[TextNote].Text := IntToStr(AktNuta + 1) + ' / ' + IntToStr(Czesci[0].Czesc[Czesci[0].Akt].IlNut); @@ -1210,23 +1217,31 @@ begin Text[TextBPM].Text := FloatToStr(AktSong.BPM[0].BPM / 4); Text[TextGAP].Text := FloatToStr(AktSong.GAP); - // Note info - Text[TextNStart].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start); - Text[TextNDlugosc].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); - Text[TextNTon].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton) + ' ( ' + GetNoteName(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton) + ' )'; - Text[TextNText].Text := Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst; + //Error reading Variables when no Song is loaded + if not Error then + begin + // Note info + Text[TextNStart].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start); + Text[TextNDlugosc].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); + Text[TextNTon].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton) + ' ( ' + GetNoteName(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton) + ' )'; + Text[TextNText].Text := Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst; + end; // Text Edit Mode if TextEditMode then - Text[TextNText].Text := Text[TextNText].Text + '|'; + Text[TextNText].Text := Text[TextNText].Text + '|'; // draw static menu inherited Draw; // draw notes SingDrawNoteLines(20, 300, 780, 15); - SingDrawBeatDelimeters(40, 300, 760, 0); - EditDrawCzesc(40, 405, 760, 0, 15); + //Error Drawing when no Song is loaded + if not Error then + begin + SingDrawBeatDelimeters(40, 300, 760, 0); + EditDrawCzesc(40, 405, 760, 0, 15); + end; // draw text Lyric.Draw; @@ -1237,7 +1252,7 @@ procedure TScreenEditSub.onHide; begin MidiOut.Close; MidiOut.Free; - Music.SetVolume(100); + //Music.SetVolume(100); end; function TScreenEditSub.GetNoteName(Note: Integer): String; diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas index a1d8fa33..fc343042 100644 --- a/Game/Code/Screens/UScreenLevel.pas +++ b/Game/Code/Screens/UScreenLevel.pas @@ -3,7 +3,7 @@ unit UScreenLevel; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; type TScreenLevel = class(TMenu) diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 47a79496..085f253d 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -3,7 +3,7 @@ unit UScreenMain; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes, ULCD, ULight; + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes, ULCD, ULight; type TScreenMain = class(TMenu) diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index 9db7947c..e2a80687 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -3,7 +3,7 @@ unit UScreenName; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; type TScreenName = class(TMenu) diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index 3a78b3e2..f5e121f9 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -2,7 +2,7 @@ unit UScreenOpen; interface -uses UMenu, UMusic, SDL, SysUtils, UPliki, UTime, USongs, UIni, ULog, USmpeg, UTexture, UMenuText, +uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, UMenuText, ULyrics, Math, OpenGL12, UThemes; type diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas index f0229d8c..02d42568 100644 --- a/Game/Code/Screens/UScreenOptions.pas +++ b/Game/Code/Screens/UScreenOptions.pas @@ -3,7 +3,7 @@ unit UScreenOptions; interface uses - UMenu, SDL, SysUtils, UDisplay, UMusic, UPliki, UIni, UThemes; + UMenu, SDL, SysUtils, UDisplay, UMusic, UFiles, UIni, UThemes; type TScreenOptions = class(TMenu) diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index 3e3f2da7..a28945c1 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -3,7 +3,7 @@ unit UScreenOptionsAdvanced; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; type TScreenOptionsAdvanced = class(TMenu) diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index 540931af..8712decc 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -3,7 +3,7 @@ unit UScreenOptionsGame; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes, USongs; + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes, USongs; type TScreenOptionsGame = class(TMenu) diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index b36bb7d3..c0641fc2 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -3,7 +3,7 @@ unit UScreenOptionsGraphics; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; type TScreenOptionsGraphics = class(TMenu) diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas index f60c9765..f4044933 100644 --- a/Game/Code/Screens/UScreenOptionsLyrics.pas +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -3,7 +3,7 @@ unit UScreenOptionsLyrics; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; type TScreenOptionsLyrics = class(TMenu) diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index c474bd7f..b005492a 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -3,7 +3,7 @@ unit UScreenOptionsRecord; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; type TScreenOptionsRecord = class(TMenu) diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index d4ab27d2..c99f1ef6 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -3,7 +3,7 @@ unit UScreenOptionsSound; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; type TScreenOptionsSound = class(TMenu) diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index 580f9c4d..b73693c1 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -3,7 +3,7 @@ unit UScreenOptionsThemes; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; type TScreenOptionsThemes = class(TMenu) diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index c914ee4b..f084ee10 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -3,7 +3,7 @@ unit UScreenPartyNewRound; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; type TScreenPartyNewRound = class(TMenu) diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 7f3b1209..aa8681d0 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -3,7 +3,7 @@ unit UScreenPartyOptions; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; type TScreenPartyOptions = class(TMenu) diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index d6e13d65..f6bcb0b7 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -3,7 +3,7 @@ unit UScreenPartyPlayer; Interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; type TScreenPartyPlayer = class(TMenu) diff --git a/Game/Code/Screens/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas index 9b71eb9a..2a789e42 100644 --- a/Game/Code/Screens/UScreenPopup.pas +++ b/Game/Code/Screens/UScreenPopup.pas @@ -3,7 +3,7 @@ unit UScreenPopup; interface uses - UMenu, SDL, UMusic, UPliki, SysUtils, UThemes; + UMenu, SDL, UMusic, UFiles, SysUtils, UThemes; type TScreenPopupCheck = class(TMenu) diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index b49e0add..cdce5984 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -2,7 +2,7 @@ unit UScreenSing; interface -uses UMenu, UMusic, SDL, SysUtils, UPliki, UTime, USongs, UIni, ULog, USmpeg, UTexture, ULyrics, +uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, ULyrics, TextGL, OpenGL12, BASS, UThemes, ULCD, UGraphicClasses; type @@ -321,11 +321,29 @@ begin Text[TextP3RScore].Visible := V3R; // load notes - CzyscNuty; + ResetSingTemp; // Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); AktSong := CatSongs.Song[CatSongs.Selected]; - - WczytajCzesci(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName); + try + if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName) then + begin + //Error Loading Song -> Go back to Song Screen and Show some Error Message + FadeTo(@ScreenSong); + //Select New Song in Party Mode + if ScreenSong.Mode = 1 then + ScreenSong.SelectRandomSong; + ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); + Exit; + end; + except + //Error Loading Song -> Go back to Song Screen and Show some Error Message + FadeTo(@ScreenSong); + //Select New Song in Party Mode + if ScreenSong.Mode = 1 then + ScreenSong.SelectRandomSong; + ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); + Exit; + end; AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; // AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 484d7d56..93ede980 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -2,7 +2,7 @@ unit UScreenSingModi; interface -uses UMenu, UMusic, SDL, SysUtils, UPliki, UTime, USongs, UIni, ULog, USmpeg, UTexture, ULyrics, +uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, ULyrics, TextGL, OpenGL12, BASS, UThemes, ULCD, UScreenSing, ModiSDK; type diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 2ce6b6df..33a6752d 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -3,7 +3,7 @@ unit UScreenSong; interface uses - UMenu, SDL, UMusic, UPliki, UTime, UDisplay, USongs, SysUtils, ULog, UThemes, UTexture, ULanguage, + UMenu, SDL, UMusic, UFiles, UTime, UDisplay, USongs, SysUtils, ULog, UThemes, UTexture, ULanguage, ULCD, ULight, UIni; type @@ -1227,7 +1227,7 @@ end; procedure TScreenSong.onHide; begin //When hide then Stop Music (For Party Mode Popup on Exit) - if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) then + if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then Music.Stop; end; diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 44c12f51..79e851ab 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -3,7 +3,7 @@ unit UScreenSongJumpto; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; type TScreenSongJumpto = class(TMenu) diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 537536bb..2469240f 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -3,7 +3,7 @@ unit UScreenSongMenu; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; type TScreenSongMenu = class(TMenu) diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 5f19c1d4..b9687292 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -26,7 +26,7 @@ uses UGraphic in 'Classes\UGraphic.pas', UTexture in 'Classes\UTexture.pas', UMusic in 'Classes\UMusic.pas', - UPliki in 'Classes\UPliki.pas', + //UPliki in 'Classes\UPliki.pas', ULanguage in 'Classes\ULanguage.pas', UMain in 'Classes\UMain.pas', UDraw in 'Classes\UDraw.pas', @@ -107,7 +107,7 @@ uses SysUtils; const - Version = 'UltraStar Deluxe V 0.96 Beta'; + Version = 'UltraStar Deluxe V 0.98 Beta'; var WndTitle: string; -- cgit v1.2.3 From 955e54f098cf8c282fdf72f3bca5f87c1db79df6 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 16 May 2007 20:59:37 +0000 Subject: Fixed a Bug in SongScreen that causes Playlist and Search is unclosable when Tabs=Off git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@201 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 33a6752d..48c6597a 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -292,14 +292,31 @@ begin end else begin - //On Escape goto Cat-List Hack End - Music.Stop; - Music.PlayBack; -// FadeTo(@ScreenLevel); - FadeTo(@ScreenMain); + //On Escape goto Cat-List Hack End + //Tabs off and in Search or Playlist -> Go back to Song view + if (CatSongs.CatNumShow < -1) then + begin + //Atm: Set Empty Filter + CatSongs.SetFilter('', 0); + + //Show Cat in Top Left Mod + HideCatTL; + Interaction := 0; + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + + ChangeMusic; + end + else + begin + Music.Stop; + Music.PlayBack; + + FadeTo(@ScreenMain); + end; -// Music.Open(Skin.SkinPath + 'Menu Music 3.mp3'); -// Music.Play; end; end //When in party Mode then Ask before Close -- cgit v1.2.3 From fb785ffee0bc3e1db1022a2c8286f5b9f8944b37 Mon Sep 17 00:00:00 2001 From: mota23 Date: Thu, 17 May 2007 01:10:39 +0000 Subject: Added: New Options/Advanced item "auto party-menu": Switches automatic popup-menu in party-mode on/off. "on" is better usability for joypad, "off" for keyboard. Changed: Keys in Party Song Selection, "m" is popup-menu and "enter" direkt to singscreen. Added: new Statics and Texts to UScreenSong, 2 sets, one for "normal" the other for party-mode. Added: dismissed sound for party-mode. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@202 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UIni.pas | 9 ++ Game/Code/Classes/UThemes.pas | 71 ++++++++++- Game/Code/Screens/UScreenOptionsAdvanced.pas | 7 +- Game/Code/Screens/UScreenSong.pas | 178 +++++++++++++++++++++++++-- 4 files changed, 252 insertions(+), 13 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index f12e3832..ca7afe9a 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -63,6 +63,7 @@ type AskbeforeDel: integer; OnSongClick: integer; LineBonus: integer; + PartyPopup: integer; // Controller Joypad: integer; @@ -140,6 +141,7 @@ const IAskbeforeDel: array[0..1] of string = ('Off', 'On'); IOnSongClick: array[0..2] of string = ('Sing', 'Select Players', 'Open Menu'); ILineBonus: array[0..2] of string = ('Off', 'At Score', 'At Notes'); + IPartyPopup: array[0..1] of string = ('Off', 'On'); IJoypad: array[0..1] of string = ('Off', 'On'); ILPT: array[0..2] of string = ('Off', 'LCD', 'Lights'); @@ -455,6 +457,10 @@ begin for Pet := 0 to High(ILineBonus) do if Tekst = ILineBonus[Pet] then Ini.LineBonus := Pet; + // PartyPopup + Tekst := IniFile.ReadString('Advanced', 'PartyPopup', 'On'); + for Pet := 0 to High(IPartyPopup) do + if Tekst = IPartyPopup[Pet] then Ini.PartyPopup := Pet; // Joypad @@ -638,6 +644,9 @@ begin Tekst := ILineBonus[Ini.LineBonus]; IniFile.WriteString('Advanced', 'LineBonus', Tekst); + //Party Popup + Tekst := IPartyPopup[Ini.PartyPopup]; + IniFile.WriteString('Advanced', 'PartyPopup', Tekst); // Joypad Tekst := IJoypad[Ini.Joypad]; diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index b9183740..24ac0eaa 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -297,10 +297,38 @@ type StaticTeam3Joker4: TThemeStatic; StaticTeam3Joker5: TThemeStatic; - - StaticKeys1 : TThemeStatic; TextKeys1 : TThemeText; + StaticKeys1Party : TThemeStatic; + TextKeys1Party : TThemeText; + StaticKeys2 : TThemeStatic; + TextKeys2 : TThemeText; + StaticKeys2Party : TThemeStatic; + TextKeys2Party : TThemeText; + StaticKeys3 : TThemeStatic; + TextKeys3 : TThemeText; + StaticKeys3Party : TThemeStatic; + TextKeys3Party : TThemeText; + StaticKeys4 : TThemeStatic; + TextKeys4 : TThemeText; + StaticKeys4Party : TThemeStatic; + TextKeys4Party : TThemeText; + StaticKeys5 : TThemeStatic; + TextKeys5 : TThemeText; + StaticKeys5Party : TThemeStatic; + TextKeys5Party : TThemeText; + StaticKeys6 : TThemeStatic; + TextKeys6 : TThemeText; + StaticKeys6Party : TThemeStatic; + TextKeys6Party : TThemeText; + StaticKeys7 : TThemeStatic; + TextKeys7 : TThemeText; + StaticKeys7Party : TThemeStatic; + TextKeys7Party : TThemeText; + StaticKeys8 : TThemeStatic; + TextKeys8 : TThemeText; + StaticKeys8Party : TThemeStatic; + TextKeys8Party : TThemeText; end; @@ -473,6 +501,7 @@ type SelectLineBonus: TThemeSelect; SelectAskbeforeDel: TThemeSelect; SelectOnSongClick: TThemeSelectSlide; + SelectPartyPopup: TThemeSelect; ButtonExit: TThemeButton; end; @@ -1014,6 +1043,43 @@ begin ThemeLoadStatic(Song.StaticKeys1, 'SongStaticKeys1'); ThemeLoadText(Song.TextKeys1, 'SongStaticKeys1Text'); + ThemeLoadStatic(Song.StaticKeys1Party, 'SongStaticKeys1Party'); + ThemeLoadText(Song.TextKeys1Party, 'SongStaticKeys1TextParty'); + + ThemeLoadStatic(Song.StaticKeys2, 'SongStaticKeys2'); + ThemeLoadText(Song.TextKeys2, 'SongStaticKeys2Text'); + ThemeLoadStatic(Song.StaticKeys2Party, 'SongStaticKeys2Party'); + ThemeLoadText(Song.TextKeys2Party, 'SongStaticKeys2TextParty'); + + ThemeLoadStatic(Song.StaticKeys3, 'SongStaticKeys3'); + ThemeLoadText(Song.TextKeys3, 'SongStaticKeys3Text'); + ThemeLoadStatic(Song.StaticKeys3Party, 'SongStaticKeys3Party'); + ThemeLoadText(Song.TextKeys3Party, 'SongStaticKeys3TextParty'); + + ThemeLoadStatic(Song.StaticKeys4, 'SongStaticKeys4'); + ThemeLoadText(Song.TextKeys4, 'SongStaticKeys4Text'); + ThemeLoadStatic(Song.StaticKeys4Party, 'SongStaticKeys4Party'); + ThemeLoadText(Song.TextKeys4Party, 'SongStaticKeys4TextParty'); + + ThemeLoadStatic(Song.StaticKeys5, 'SongStaticKeys5'); + ThemeLoadText(Song.TextKeys5, 'SongStaticKeys5Text'); + ThemeLoadStatic(Song.StaticKeys5Party, 'SongStaticKeys5Party'); + ThemeLoadText(Song.TextKeys5Party, 'SongStaticKeys5TextParty'); + + ThemeLoadStatic(Song.StaticKeys6, 'SongStaticKeys6'); + ThemeLoadText(Song.TextKeys6, 'SongStaticKeys6Text'); + ThemeLoadStatic(Song.StaticKeys6Party, 'SongStaticKeys6Party'); + ThemeLoadText(Song.TextKeys6Party, 'SongStaticKeys6TextParty'); + + ThemeLoadStatic(Song.StaticKeys7, 'SongStaticKeys7'); + ThemeLoadText(Song.TextKeys7, 'SongStaticKeys7Text'); + ThemeLoadStatic(Song.StaticKeys7Party, 'SongStaticKeys7Party'); + ThemeLoadText(Song.TextKeys7Party, 'SongStaticKeys7TextParty'); + + ThemeLoadStatic(Song.StaticKeys8, 'SongStaticKeys8'); + ThemeLoadText(Song.TextKeys8, 'SongStaticKeys8Text'); + ThemeLoadStatic(Song.StaticKeys8Party, 'SongStaticKeys8Party'); + ThemeLoadText(Song.TextKeys8Party, 'SongStaticKeys8TextParty'); // Sing ThemeLoadBasic(Sing, 'Sing'); @@ -1209,6 +1275,7 @@ begin ThemeLoadSelect (OptionsAdvanced.SelectLineBonus, 'OptionsAdvancedSelectLineBonus'); ThemeLoadSelectSlide (OptionsAdvanced.SelectOnSongClick, 'OptionsAdvancedSelectSlideOnSongClick'); ThemeLoadSelect (OptionsAdvanced.SelectAskbeforeDel, 'OptionsAdvancedSelectAskbeforeDel'); + ThemeLoadSelect (OptionsAdvanced.SelectPartyPopup, 'OptionsAdvancedSelectPartyPopup'); ThemeLoadButton (OptionsAdvanced.ButtonExit, 'OptionsAdvancedButtonExit'); //error and check popup diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index a28945c1..4c3356d0 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -35,7 +35,7 @@ begin end; SDLK_RETURN: begin - if SelInteraction = 6 then begin + if SelInteraction = 7 then begin Ini.Save; Music.PlayBack; FadeTo(@ScreenOptions); @@ -47,14 +47,14 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + if (SelInteraction >= 0) and (SelInteraction <= 6) then begin Music.PlayOption; InteractInc; end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + if (SelInteraction >= 0) and (SelInteraction <= 6) then begin Music.PlayOption; InteractDec; end; @@ -77,6 +77,7 @@ begin AddSelect(Theme.OptionsAdvanced.SelectLineBonus, Ini.LineBonus, ILineBonus); AddSelectSlide(Theme.OptionsAdvanced.SelectOnSongClick, Ini.OnSongClick, IOnSongClick); AddSelect(Theme.OptionsAdvanced.SelectAskbeforeDel, Ini.AskbeforeDel, IAskbeforeDel); + AddSelect(Theme.OptionsAdvanced.SelectPartyPopup, Ini.PartyPopup, IPartyPopup); AddButton(Theme.OptionsAdvanced.ButtonExit); if (Length(Button[0].Text)=0) then diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 48c6597a..26fcba2e 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -52,8 +52,46 @@ type StaticTeam3Joker3: Cardinal; StaticTeam3Joker4: Cardinal; StaticTeam3Joker5: Cardinal; + StaticKeys1: Cardinal; TextKeys1: integer; + StaticKeys1Party: Cardinal; + TextKeys1Party: integer; + + StaticKeys2: Cardinal; + TextKeys2: integer; + StaticKeys2Party: Cardinal; + TextKeys2Party: integer; + + StaticKeys3: Cardinal; + TextKeys3: integer; + StaticKeys3Party: Cardinal; + TextKeys3Party: integer; + + StaticKeys4: Cardinal; + TextKeys4: integer; + StaticKeys4Party: Cardinal; + TextKeys4Party: integer; + + StaticKeys5: Cardinal; + TextKeys5: integer; + StaticKeys5Party: Cardinal; + TextKeys5Party: integer; + + StaticKeys6: Cardinal; + TextKeys6: integer; + StaticKeys6Party: Cardinal; + TextKeys6Party: integer; + + StaticKeys7: Cardinal; + TextKeys7: integer; + StaticKeys7Party: Cardinal; + TextKeys7Party: integer; + + StaticKeys8: Cardinal; + TextKeys8: integer; + StaticKeys8Party: Cardinal; + TextKeys8Party: integer; constructor Create; override; procedure SetScroll; @@ -163,6 +201,7 @@ var I, I2: Integer; Text[TextCat].Visible := true; Static[StaticCat].Visible := True; end; + procedure TScreenSong.HideCatTL; begin //Hide @@ -368,7 +407,9 @@ begin end else if (Mode = 1) then //PartyMode -> Show Menu begin - ScreenSongMenu.MenuShow(SM_Party_Main); + //Is this Right? + ScreenSong.StartSong; + //ScreenSongMenu.MenuShow(SM_Party_Main); end; end; end; @@ -682,8 +723,44 @@ begin StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); StaticKeys1 := AddStatic(Theme.Song.StaticKeys1); - TextKeys1 := AddText(Theme.Song.TextKeys1); + StaticKeys1Party := AddStatic(Theme.Song.StaticKeys1Party); + TextKeys1Party := AddText(Theme.Song.TextKeys1Party); + + StaticKeys2 := AddStatic(Theme.Song.StaticKeys2); + TextKeys2 := AddText(Theme.Song.TextKeys2); + StaticKeys2Party := AddStatic(Theme.Song.StaticKeys2Party); + TextKeys2Party := AddText(Theme.Song.TextKeys2Party); + + StaticKeys3 := AddStatic(Theme.Song.StaticKeys3); + TextKeys3 := AddText(Theme.Song.TextKeys3); + StaticKeys3Party := AddStatic(Theme.Song.StaticKeys3Party); + TextKeys3Party := AddText(Theme.Song.TextKeys3Party); + + StaticKeys4 := AddStatic(Theme.Song.StaticKeys4); + TextKeys4 := AddText(Theme.Song.TextKeys4); + StaticKeys4Party := AddStatic(Theme.Song.StaticKeys4Party); + TextKeys4Party := AddText(Theme.Song.TextKeys4Party); + + StaticKeys5 := AddStatic(Theme.Song.StaticKeys5); + TextKeys5 := AddText(Theme.Song.TextKeys5); + StaticKeys5Party := AddStatic(Theme.Song.StaticKeys5Party); + TextKeys5Party := AddText(Theme.Song.TextKeys5Party); + + StaticKeys6 := AddStatic(Theme.Song.StaticKeys6); + TextKeys6 := AddText(Theme.Song.TextKeys6); + StaticKeys6Party := AddStatic(Theme.Song.StaticKeys6Party); + TextKeys6Party := AddText(Theme.Song.TextKeys6Party); + + StaticKeys7 := AddStatic(Theme.Song.StaticKeys7); + TextKeys7 := AddText(Theme.Song.TextKeys7); + StaticKeys7Party := AddStatic(Theme.Song.StaticKeys7Party); + TextKeys7Party := AddText(Theme.Song.TextKeys7Party); + + StaticKeys8 := AddStatic(Theme.Song.StaticKeys8); + TextKeys8 := AddText(Theme.Song.TextKeys8); + StaticKeys8Party := AddStatic(Theme.Song.StaticKeys8Party); + TextKeys8Party := AddText(Theme.Song.TextKeys8Party); // Song List // Songs.LoadSongList; // moved to the UltraStar unit @@ -1234,7 +1311,13 @@ begin SelectRandomSong; //Show Mennu direct in PartyMode - ScreenSongMenu.MenuShow(SM_Party_Main); + //But only if selected in Options + if (Ini.PartyPopup = 1) then + begin + ScreenSongMenu.MenuShow(SM_Party_Main); + end; + + end; SetJoker; @@ -1675,13 +1758,92 @@ begin //If Party Mode if Mode = 1 then //Use Statics for Party-Song-Selection begin - Static[StaticKeys1].Visible := false; - Text[TextKeys1].Visible := false; + Static[StaticKeys1].Visible := False; + Text[TextKeys1].Visible := False; + Static[StaticKeys1Party].Visible := True; + Text[TextKeys1Party].Visible := True; + + Static[StaticKeys2].Visible := False; + Text[TextKeys2].Visible := False; + Static[StaticKeys2Party].Visible := True; + Text[TextKeys2Party].Visible := True; + + Static[StaticKeys3].Visible := False; + Text[TextKeys3].Visible := False; + Static[StaticKeys3Party].Visible := True; + Text[TextKeys3Party].Visible := True; + + Static[StaticKeys4].Visible := False; + Text[TextKeys4].Visible := False; + Static[StaticKeys4Party].Visible := True; + Text[TextKeys4Party].Visible := True; + + Static[StaticKeys5].Visible := False; + Text[TextKeys5].Visible := False; + Static[StaticKeys5Party].Visible := True; + Text[TextKeys5Party].Visible := True; + + Static[StaticKeys6].Visible := False; + Text[TextKeys6].Visible := False; + Static[StaticKeys6Party].Visible := True; + Text[TextKeys6Party].Visible := True; + + Static[StaticKeys7].Visible := False; + Text[TextKeys7].Visible := False; + Static[StaticKeys7Party].Visible := True; + Text[TextKeys7Party].Visible := True; + + Static[StaticKeys8].Visible := False; + Text[TextKeys8].Visible := False; + Static[StaticKeys8Party].Visible := True; + Text[TextKeys8Party].Visible := True; end else //Use regular Statics for Song-Selection - begin //Hide all - Static[StaticKeys1].Visible := true; - Text[TextKeys1].Visible := true; + begin + Static[StaticKeys1].Visible := True; + Text[TextKeys1].Visible := True; + Static[StaticKeys1Party].Visible := False; + Text[TextKeys1Party].Visible := False; + + Static[StaticKeys2].Visible := True; + Text[TextKeys2].Visible := True; + Static[StaticKeys2Party].Visible := False; + Text[TextKeys2Party].Visible := False; + + Static[StaticKeys2].Visible := True; + Text[TextKeys2].Visible := True; + Static[StaticKeys2Party].Visible := False; + Text[TextKeys2Party].Visible := False; + + Static[StaticKeys3].Visible := True; + Text[TextKeys3].Visible := True; + Static[StaticKeys3Party].Visible := False; + Text[TextKeys3Party].Visible := False; + + Static[StaticKeys4].Visible := True; + Text[TextKeys4].Visible := True; + Static[StaticKeys4Party].Visible := False; + Text[TextKeys4Party].Visible := False; + + Static[StaticKeys5].Visible := True; + Text[TextKeys5].Visible := True; + Static[StaticKeys5Party].Visible := False; + Text[TextKeys5Party].Visible := False; + + Static[StaticKeys6].Visible := True; + Text[TextKeys6].Visible := True; + Static[StaticKeys6Party].Visible := False; + Text[TextKeys6Party].Visible := False; + + Static[StaticKeys7].Visible := True; + Text[TextKeys7].Visible := True; + Static[StaticKeys7Party].Visible := False; + Text[TextKeys7Party].Visible := False; + + Static[StaticKeys8].Visible := True; + Text[TextKeys8].Visible := True; + Static[StaticKeys8Party].Visible := False; + Text[TextKeys8Party].Visible := False; end; end; -- cgit v1.2.3 From c07c700247d4c70f79d2f7fb9c5b368196d1cf53 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 17 May 2007 09:47:02 +0000 Subject: Added functionality to Cancel Button in ScreenOpen Pressing ESC in ScreenOpen now causes last Screen to be displayed git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@205 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenOpen.pas | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index f5e121f9..af984a21 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -35,7 +35,6 @@ begin begin if Interaction = 0 then begin Text[TextN].Text := Text[TextN].Text + chr(ScanCode); - FileName := Text[TextN].Text; end; end; end; @@ -50,18 +49,29 @@ begin if Interaction = 0 then begin Text[TextN].DeleteLastL; - FileName := Text[TextN].Text; end; end; SDLK_ESCAPE: begin - result := false; + //Empty Filename and go to last Screen + FileName := ''; + Music.PlayBack; + FadeTo(BackScreen); end; SDLK_RETURN: begin - if Interaction = 2 then begin + if (Interaction = 2) then begin + //Update Filename and go to last Screen + FileName := Text[TextN].Text; + Music.PlayBack; + FadeTo(BackScreen); + end + else if (Interaction = 1) then + begin + //Empty Filename and go to last Screen + FileName := ''; Music.PlayBack; FadeTo(BackScreen); end; -- cgit v1.2.3 From f11d9806f4623dc4dbf14e521624109b7a69b86b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 17 May 2007 10:33:27 +0000 Subject: Deleted Motas Methods to display variable Statics and Texts in Party Mode. Added a new, more extendable and easier in Code Method for displaying Statics in Party Mode or in Normal Mode only Enter in Songscreen in Party Mode Opens now SongMenu again when PartyPopup=1 Changed Theme to Fit these changes git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@206 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 89 +++------------ Game/Code/Screens/UScreenSong.pas | 222 +++++++++----------------------------- 2 files changed, 62 insertions(+), 249 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 24ac0eaa..0fe207e9 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -280,6 +280,13 @@ type ColR, ColG, ColB: Real; end; + //Party and Non Party specific Statics and Texts + StaticParty: AThemeStatic; + TextParty: AThemeText; + + StaticNonParty: AThemeStatic; + TextNonParty: AThemeText; + //Party Mode StaticTeam1Joker1: TThemeStatic; StaticTeam1Joker2: TThemeStatic; @@ -296,41 +303,6 @@ type StaticTeam3Joker3: TThemeStatic; StaticTeam3Joker4: TThemeStatic; StaticTeam3Joker5: TThemeStatic; - - StaticKeys1 : TThemeStatic; - TextKeys1 : TThemeText; - StaticKeys1Party : TThemeStatic; - TextKeys1Party : TThemeText; - StaticKeys2 : TThemeStatic; - TextKeys2 : TThemeText; - StaticKeys2Party : TThemeStatic; - TextKeys2Party : TThemeText; - StaticKeys3 : TThemeStatic; - TextKeys3 : TThemeText; - StaticKeys3Party : TThemeStatic; - TextKeys3Party : TThemeText; - StaticKeys4 : TThemeStatic; - TextKeys4 : TThemeText; - StaticKeys4Party : TThemeStatic; - TextKeys4Party : TThemeText; - StaticKeys5 : TThemeStatic; - TextKeys5 : TThemeText; - StaticKeys5Party : TThemeStatic; - TextKeys5Party : TThemeText; - StaticKeys6 : TThemeStatic; - TextKeys6 : TThemeText; - StaticKeys6Party : TThemeStatic; - TextKeys6Party : TThemeText; - StaticKeys7 : TThemeStatic; - TextKeys7 : TThemeText; - StaticKeys7Party : TThemeStatic; - TextKeys7Party : TThemeText; - StaticKeys8 : TThemeStatic; - TextKeys8 : TThemeText; - StaticKeys8Party : TThemeStatic; - TextKeys8Party : TThemeText; - - end; TThemeSing = class(TThemeBasic) @@ -1022,6 +994,13 @@ begin end; //Load Equalizer Pos and Size from Theme Mod End + //Party and Non Party specific Statics and Texts + ThemeLoadStatics (Song.StaticParty, 'SongStaticParty'); + ThemeLoadTexts (Song.TextParty, 'SongTextParty'); + + ThemeLoadStatics (Song.StaticNonParty, 'SongStaticNonParty'); + ThemeLoadTexts (Song.TextNonParty, 'SongTextNonParty'); + //Party Mode ThemeLoadStatic(Song.StaticTeam1Joker1, 'SongStaticTeam1Joker1'); ThemeLoadStatic(Song.StaticTeam1Joker2, 'SongStaticTeam1Joker2'); @@ -1041,46 +1020,6 @@ begin ThemeLoadStatic(Song.StaticTeam3Joker4, 'SongStaticTeam3Joker4'); ThemeLoadStatic(Song.StaticTeam3Joker5, 'SongStaticTeam3Joker5'); - ThemeLoadStatic(Song.StaticKeys1, 'SongStaticKeys1'); - ThemeLoadText(Song.TextKeys1, 'SongStaticKeys1Text'); - ThemeLoadStatic(Song.StaticKeys1Party, 'SongStaticKeys1Party'); - ThemeLoadText(Song.TextKeys1Party, 'SongStaticKeys1TextParty'); - - ThemeLoadStatic(Song.StaticKeys2, 'SongStaticKeys2'); - ThemeLoadText(Song.TextKeys2, 'SongStaticKeys2Text'); - ThemeLoadStatic(Song.StaticKeys2Party, 'SongStaticKeys2Party'); - ThemeLoadText(Song.TextKeys2Party, 'SongStaticKeys2TextParty'); - - ThemeLoadStatic(Song.StaticKeys3, 'SongStaticKeys3'); - ThemeLoadText(Song.TextKeys3, 'SongStaticKeys3Text'); - ThemeLoadStatic(Song.StaticKeys3Party, 'SongStaticKeys3Party'); - ThemeLoadText(Song.TextKeys3Party, 'SongStaticKeys3TextParty'); - - ThemeLoadStatic(Song.StaticKeys4, 'SongStaticKeys4'); - ThemeLoadText(Song.TextKeys4, 'SongStaticKeys4Text'); - ThemeLoadStatic(Song.StaticKeys4Party, 'SongStaticKeys4Party'); - ThemeLoadText(Song.TextKeys4Party, 'SongStaticKeys4TextParty'); - - ThemeLoadStatic(Song.StaticKeys5, 'SongStaticKeys5'); - ThemeLoadText(Song.TextKeys5, 'SongStaticKeys5Text'); - ThemeLoadStatic(Song.StaticKeys5Party, 'SongStaticKeys5Party'); - ThemeLoadText(Song.TextKeys5Party, 'SongStaticKeys5TextParty'); - - ThemeLoadStatic(Song.StaticKeys6, 'SongStaticKeys6'); - ThemeLoadText(Song.TextKeys6, 'SongStaticKeys6Text'); - ThemeLoadStatic(Song.StaticKeys6Party, 'SongStaticKeys6Party'); - ThemeLoadText(Song.TextKeys6Party, 'SongStaticKeys6TextParty'); - - ThemeLoadStatic(Song.StaticKeys7, 'SongStaticKeys7'); - ThemeLoadText(Song.TextKeys7, 'SongStaticKeys7Text'); - ThemeLoadStatic(Song.StaticKeys7Party, 'SongStaticKeys7Party'); - ThemeLoadText(Song.TextKeys7Party, 'SongStaticKeys7TextParty'); - - ThemeLoadStatic(Song.StaticKeys8, 'SongStaticKeys8'); - ThemeLoadText(Song.TextKeys8, 'SongStaticKeys8Text'); - ThemeLoadStatic(Song.StaticKeys8Party, 'SongStaticKeys8Party'); - ThemeLoadText(Song.TextKeys8Party, 'SongStaticKeys8TextParty'); - // Sing ThemeLoadBasic(Sing, 'Sing'); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 26fcba2e..95550a32 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -53,45 +53,10 @@ type StaticTeam3Joker4: Cardinal; StaticTeam3Joker5: Cardinal; - StaticKeys1: Cardinal; - TextKeys1: integer; - StaticKeys1Party: Cardinal; - TextKeys1Party: integer; - - StaticKeys2: Cardinal; - TextKeys2: integer; - StaticKeys2Party: Cardinal; - TextKeys2Party: integer; - - StaticKeys3: Cardinal; - TextKeys3: integer; - StaticKeys3Party: Cardinal; - TextKeys3Party: integer; - - StaticKeys4: Cardinal; - TextKeys4: integer; - StaticKeys4Party: Cardinal; - TextKeys4Party: integer; - - StaticKeys5: Cardinal; - TextKeys5: integer; - StaticKeys5Party: Cardinal; - TextKeys5Party: integer; - - StaticKeys6: Cardinal; - TextKeys6: integer; - StaticKeys6Party: Cardinal; - TextKeys6Party: integer; - - StaticKeys7: Cardinal; - TextKeys7: integer; - StaticKeys7Party: Cardinal; - TextKeys7Party: integer; - - StaticKeys8: Cardinal; - TextKeys8: integer; - StaticKeys8Party: Cardinal; - TextKeys8Party: integer; + StaticParty: Array of Cardinal; + TextParty: Array of Cardinal; + StaticNonParty: Array of Cardinal; + TextNonParty: Array of Cardinal; constructor Create; override; procedure SetScroll; @@ -407,9 +372,11 @@ begin end else if (Mode = 1) then //PartyMode -> Show Menu begin - //Is this Right? - ScreenSong.StartSong; - //ScreenSongMenu.MenuShow(SM_Party_Main); + //Is this Right? + if (Ini.PartyPopup = 1) then + ScreenSongMenu.MenuShow(SM_Party_Main) + else + ScreenSong.StartSong; end; end; end; @@ -722,45 +689,22 @@ begin StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); - StaticKeys1 := AddStatic(Theme.Song.StaticKeys1); - TextKeys1 := AddText(Theme.Song.TextKeys1); - StaticKeys1Party := AddStatic(Theme.Song.StaticKeys1Party); - TextKeys1Party := AddText(Theme.Song.TextKeys1Party); - - StaticKeys2 := AddStatic(Theme.Song.StaticKeys2); - TextKeys2 := AddText(Theme.Song.TextKeys2); - StaticKeys2Party := AddStatic(Theme.Song.StaticKeys2Party); - TextKeys2Party := AddText(Theme.Song.TextKeys2Party); - - StaticKeys3 := AddStatic(Theme.Song.StaticKeys3); - TextKeys3 := AddText(Theme.Song.TextKeys3); - StaticKeys3Party := AddStatic(Theme.Song.StaticKeys3Party); - TextKeys3Party := AddText(Theme.Song.TextKeys3Party); - - StaticKeys4 := AddStatic(Theme.Song.StaticKeys4); - TextKeys4 := AddText(Theme.Song.TextKeys4); - StaticKeys4Party := AddStatic(Theme.Song.StaticKeys4Party); - TextKeys4Party := AddText(Theme.Song.TextKeys4Party); - - StaticKeys5 := AddStatic(Theme.Song.StaticKeys5); - TextKeys5 := AddText(Theme.Song.TextKeys5); - StaticKeys5Party := AddStatic(Theme.Song.StaticKeys5Party); - TextKeys5Party := AddText(Theme.Song.TextKeys5Party); - - StaticKeys6 := AddStatic(Theme.Song.StaticKeys6); - TextKeys6 := AddText(Theme.Song.TextKeys6); - StaticKeys6Party := AddStatic(Theme.Song.StaticKeys6Party); - TextKeys6Party := AddText(Theme.Song.TextKeys6Party); - - StaticKeys7 := AddStatic(Theme.Song.StaticKeys7); - TextKeys7 := AddText(Theme.Song.TextKeys7); - StaticKeys7Party := AddStatic(Theme.Song.StaticKeys7Party); - TextKeys7Party := AddText(Theme.Song.TextKeys7Party); - - StaticKeys8 := AddStatic(Theme.Song.StaticKeys8); - TextKeys8 := AddText(Theme.Song.TextKeys8); - StaticKeys8Party := AddStatic(Theme.Song.StaticKeys8Party); - TextKeys8Party := AddText(Theme.Song.TextKeys8Party); + //Load Party or NonParty specific Statics and Texts + SetLength(StaticParty, Length(Theme.Song.StaticParty)); + for I := 0 to High(Theme.Song.StaticParty) do + StaticParty[I] := AddStatic(Theme.Song.StaticParty[I]); + + SetLength(TextParty, Length(Theme.Song.TextParty)); + for I := 0 to High(Theme.Song.TextParty) do + TextParty[I] := AddText(Theme.Song.TextParty[I]); + + SetLength(StaticNonParty, Length(Theme.Song.StaticNonParty)); + for I := 0 to High(Theme.Song.StaticNonParty) do + StaticNonParty[I] := AddStatic(Theme.Song.StaticNonParty[I]); + + SetLength(TextNonParty, Length(Theme.Song.TextNonParty)); + for I := 0 to High(Theme.Song.TextNonParty) do + TextNonParty[I] := AddText(Theme.Song.TextNonParty[I]); // Song List // Songs.LoadSongList; // moved to the UltraStar unit @@ -1310,12 +1254,12 @@ begin begin SelectRandomSong; - //Show Mennu direct in PartyMode + //Show Menu directly in PartyMode //But only if selected in Options if (Ini.PartyPopup = 1) then - begin + begin ScreenSongMenu.MenuShow(SM_Party_Main); - end; + end; end; @@ -1754,97 +1698,27 @@ begin end; procedure TScreenSong.SetStatics; +var + I: Integer; + Visible: Boolean; begin - //If Party Mode - if Mode = 1 then //Use Statics for Party-Song-Selection - begin - Static[StaticKeys1].Visible := False; - Text[TextKeys1].Visible := False; - Static[StaticKeys1Party].Visible := True; - Text[TextKeys1Party].Visible := True; - - Static[StaticKeys2].Visible := False; - Text[TextKeys2].Visible := False; - Static[StaticKeys2Party].Visible := True; - Text[TextKeys2Party].Visible := True; - - Static[StaticKeys3].Visible := False; - Text[TextKeys3].Visible := False; - Static[StaticKeys3Party].Visible := True; - Text[TextKeys3Party].Visible := True; - - Static[StaticKeys4].Visible := False; - Text[TextKeys4].Visible := False; - Static[StaticKeys4Party].Visible := True; - Text[TextKeys4Party].Visible := True; - - Static[StaticKeys5].Visible := False; - Text[TextKeys5].Visible := False; - Static[StaticKeys5Party].Visible := True; - Text[TextKeys5Party].Visible := True; - - Static[StaticKeys6].Visible := False; - Text[TextKeys6].Visible := False; - Static[StaticKeys6Party].Visible := True; - Text[TextKeys6Party].Visible := True; - - Static[StaticKeys7].Visible := False; - Text[TextKeys7].Visible := False; - Static[StaticKeys7Party].Visible := True; - Text[TextKeys7Party].Visible := True; - - Static[StaticKeys8].Visible := False; - Text[TextKeys8].Visible := False; - Static[StaticKeys8Party].Visible := True; - Text[TextKeys8Party].Visible := True; - end - else //Use regular Statics for Song-Selection - begin - Static[StaticKeys1].Visible := True; - Text[TextKeys1].Visible := True; - Static[StaticKeys1Party].Visible := False; - Text[TextKeys1Party].Visible := False; - - Static[StaticKeys2].Visible := True; - Text[TextKeys2].Visible := True; - Static[StaticKeys2Party].Visible := False; - Text[TextKeys2Party].Visible := False; - - Static[StaticKeys2].Visible := True; - Text[TextKeys2].Visible := True; - Static[StaticKeys2Party].Visible := False; - Text[TextKeys2Party].Visible := False; - - Static[StaticKeys3].Visible := True; - Text[TextKeys3].Visible := True; - Static[StaticKeys3Party].Visible := False; - Text[TextKeys3Party].Visible := False; - - Static[StaticKeys4].Visible := True; - Text[TextKeys4].Visible := True; - Static[StaticKeys4Party].Visible := False; - Text[TextKeys4Party].Visible := False; - - Static[StaticKeys5].Visible := True; - Text[TextKeys5].Visible := True; - Static[StaticKeys5Party].Visible := False; - Text[TextKeys5Party].Visible := False; - - Static[StaticKeys6].Visible := True; - Text[TextKeys6].Visible := True; - Static[StaticKeys6Party].Visible := False; - Text[TextKeys6Party].Visible := False; - - Static[StaticKeys7].Visible := True; - Text[TextKeys7].Visible := True; - Static[StaticKeys7Party].Visible := False; - Text[TextKeys7Party].Visible := False; - - Static[StaticKeys8].Visible := True; - Text[TextKeys8].Visible := True; - Static[StaticKeys8Party].Visible := False; - Text[TextKeys8Party].Visible := False; - end; + //Set Visibility of Party Statics and Text + Visible := (Mode = 1); + + For I := 0 to high(StaticParty) do + Static[StaticParty[I]].Visible := Visible; + + For I := 0 to high(TextParty) do + Text[TextParty[I]].Visible := Visible; + + //Set Visibility of Non Party Statics and Text + Visible := not Visible; + + For I := 0 to high(StaticNonParty) do + Static[StaticNonParty[I]].Visible := Visible; + + For I := 0 to high(TextNonParty) do + Text[TextNonParty[I]].Visible := Visible; end; //Procedures for Menu -- cgit v1.2.3 From 718855f7191c9d4963da9977ee49d155e376691b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 17 May 2007 10:42:45 +0000 Subject: Now when no Cat, Search or Playlist is shown, the Text specified in Theme for TextCat is shown git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@207 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 95550a32..31d05dce 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -170,8 +170,11 @@ var I, I2: Integer; procedure TScreenSong.HideCatTL; begin //Hide - Text[TextCat].Visible := false; + //Text[TextCat].Visible := false; Static[StaticCat].Visible := false; + //New -> Show Text specified in Theme + Text[TextCat].Visible := True; + Text[TextCat].Text := Theme.Song.TextCat.Text; end; //Show Cat in Top Left Mod End -- cgit v1.2.3 From b00fb13d63e4b82a1de662bf3a37814bfd58dc8b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 17 May 2007 11:04:54 +0000 Subject: Added ability to use German Umlaute Jump To Song Screen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@208 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSongJumpto.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 79e851ab..60410d91 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -35,7 +35,7 @@ var implementation -uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, USongs, UScreenSong; +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, USongs, UScreenSong, ULog; function TScreenSongJumpto.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; function IsVisible: Boolean; @@ -73,7 +73,7 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of - SDLK_0..SDLK_9, SDLK_A..SDLK_Z, SDLK_SPACE, SDLK_MINUS, SDLK_EXCLAIM, SDLK_COMMA, SDLK_SLASH, SDLK_ASTERISK, SDLK_QUESTION, SDLK_QUOTE, SDLK_QUOTEDBL: + SDLK_0..SDLK_9, SDLK_A..SDLK_Z, SDLK_SPACE, SDLK_MINUS, SDLK_EXCLAIM, SDLK_COMMA, SDLK_SLASH, SDLK_ASTERISK, SDLK_QUESTION, SDLK_QUOTE, SDLK_QUOTEDBL, SDLK_LEFTBRACKET, SDLK_SEMICOLON: begin if Interaction = 0 then begin -- cgit v1.2.3 From d2f6ecd73457de4ca12603b57e6c5d2e135e5d2d Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 17 May 2007 11:21:36 +0000 Subject: Fixed a Bug in UScreenSongJumpto that causes a wrong Song is Displayed in Song Selection when Tabs=0 and Search is opened, Search Type is changed and Search is closed. Fixed Position of SelectSlideType in Jump to Song Screen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@209 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSongJumpto.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 60410d91..42aedf3c 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -214,7 +214,7 @@ begin VisSongs := Count; //Fix SongSelection - ScreenSong.Interaction := 0; + ScreenSong.Interaction := high(CatSongs.Song); ScreenSong.SelectNext; ScreenSong.FixSelected; -- cgit v1.2.3 From 04189268afb620a6a0d09a675f771c0df9f1264f Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 17 May 2007 11:33:40 +0000 Subject: Fixed a Bug in Jump to Letter: A and Z now Works correctly Fixed a Bug in Skipto funktion that causes a wrong Song is Selected when Tabs=0. This was the Reason for some Bugs in Jump to and Random Functions. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@210 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 31d05dce..6f3bbc63 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -210,7 +210,7 @@ begin + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); //Jump to Artist/Titel - if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey > SDLK_A) AND (PressedKey < SDLK_Z) then + if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then begin Letter := UpCase(Chr(ScanCode)); I2 := Length(CatSongs.Song); @@ -1441,7 +1441,7 @@ begin if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then Texture.UnloadTexture(Button[Interaction].Texture.Name, false); - Interaction := 0; + Interaction := High(CatSongs.Song); SongTarget := 0; for I := 1 to Target+1 do -- cgit v1.2.3 From d52cb874cd39eac4a4aff100c22bf3280eea4275 Mon Sep 17 00:00:00 2001 From: mota23 Date: Thu, 17 May 2007 14:04:07 +0000 Subject: added: Video Icon. Shows if Video is present in Song-Selection. Needs to be fixed. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@212 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 12 +++++++++++- Game/Code/Screens/UScreenSong.pas | 11 +++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 0fe207e9..471e46bf 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -249,7 +249,10 @@ type TextTitle: TThemeText; TextNumber: TThemeText; - //Show Cat in TopLeft Mod + //Video Icon Mod + VideoIcon: TThemeStatic; + + //Show Cat in TopLeft Mod TextCat: TThemeText; StaticCat: TThemeStatic; @@ -280,6 +283,7 @@ type ColR, ColG, ColB: Real; end; + //Party and Non Party specific Statics and Texts StaticParty: AThemeStatic; TextParty: AThemeText; @@ -303,6 +307,8 @@ type StaticTeam3Joker3: TThemeStatic; StaticTeam3Joker4: TThemeStatic; StaticTeam3Joker5: TThemeStatic; + + end; TThemeSing = class(TThemeBasic) @@ -959,6 +965,9 @@ begin ThemeLoadText(Song.TextTitle, 'SongTextTitle'); ThemeLoadText(Song.TextNumber, 'SongTextNumber'); + //Video Icon Mod + ThemeLoadStatic(Song.VideoIcon, 'SongVideoIcon'); + //Show Cat in TopLeft Mod ThemeLoadStatic(Song.StaticCat, 'SongStaticCat'); ThemeLoadText(Song.TextCat, 'SongTextCat'); @@ -1020,6 +1029,7 @@ begin ThemeLoadStatic(Song.StaticTeam3Joker4, 'SongStaticTeam3Joker4'); ThemeLoadStatic(Song.StaticTeam3Joker5, 'SongStaticTeam3Joker5'); + // Sing ThemeLoadBasic(Sing, 'Sing'); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 6f3bbc63..4fe679f7 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -13,6 +13,9 @@ type TextTitle: integer; TextNumber: integer; + //Video Icon Mod + VideoIcon: Cardinal; + TextCat: integer; StaticCat: integer; @@ -58,6 +61,7 @@ type StaticNonParty: Array of Cardinal; TextNonParty: Array of Cardinal; + constructor Create; override; procedure SetScroll; procedure SetScroll1; @@ -1326,6 +1330,13 @@ begin inherited Draw; + //Draw Video Icon if Video is present + if CatSongs.Song[Interaction].Video <> '' then + Static[VideoIcon].Visible := True + else + Static[VideoIcon].Visible := False; + + //Draw Equalizer if Theme.Song.Equalizer.Visible then DrawEqualizer; -- cgit v1.2.3 From 8c035bb950519a86c90f64aab7c58aa98089569c Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 17 May 2007 14:15:50 +0000 Subject: Some Code Cleanup in UScreenSong Fixed VideoIcon Display git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@213 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 4fe679f7..82dad1ed 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -664,9 +664,6 @@ var begin inherited Create; -// AddStatic(200, 10, 400, 90, Skin.SelectSong); -// AddStatic(200-10, 140-5, 400+20, 50+10, Skin.Selection, 'JPG', 'Font Gray'); - LoadFromTheme(Theme.Song); TextArtist := AddText(Theme.Song.TextArtist); @@ -677,6 +674,9 @@ begin TextCat := AddText(Theme.Song.TextCat); StaticCat := AddStatic(Theme.Song.StaticCat); + //Show Video Icon Mod + VideoIcon := AddStatic(Theme.Song.VideoIcon); + //Party Mode StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1); StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2); @@ -748,21 +748,12 @@ begin AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); end; Texture.Limit := 1024*1024; - - -// AddButtonText(11, 10, CatSongs.Song[Pet].Title); // new way end; -// Covers.Save; - { if Length(CatSongs.Song) > 0 then // setting to first song - Interaction := 0 - else begin // no song detected - AddButton(400-200, 140, 400, 50, Skin.Button, 'JPG', 'Transparent Range'); - AddButtonText(11, 10, 'No songs detected'); - end;} + // Randomize Patch - Randomize; + Randomize; //Equalizer SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); //ClearArray @@ -788,6 +779,9 @@ begin end; else SetScroll4; end; + //Set Visibility of Video Icon + Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> ''); + //Set Texts: Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; Text[TextTitle].Text := CatSongs.Song[Interaction].Title; @@ -1330,12 +1324,6 @@ begin inherited Draw; - //Draw Video Icon if Video is present - if CatSongs.Song[Interaction].Video <> '' then - Static[VideoIcon].Visible := True - else - Static[VideoIcon].Visible := False; - //Draw Equalizer if Theme.Song.Equalizer.Visible 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/Classes/UFiles.pas | 2 +- Game/Code/Screens/UScreenStatMain.pas | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index 912a476d..aa336233 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -239,7 +239,7 @@ begin end // Video File - else if (Identifier = 'VIDEO') then + else if (Identifier = 'VIDEO') AND (FileExists(Song.Path + Value)) then begin Song.Video := Value; end 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 56ce1cf3c09f0ebad019bb1f158d335e41f3d2d6 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 18 May 2007 10:54:33 +0000 Subject: Removed Debug Message from UIni, showing the saved SoundCard Entrys git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@218 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UIni.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index ca7afe9a..f3ea84ac 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -616,7 +616,7 @@ begin IniFile.WriteString('Record', 'ChannelR' + S, Tekst); end; - Log.LogError(InttoStr(Length(CardList)) + ' Cards Saved'); + //Log.LogError(InttoStr(Length(CardList)) + ' Cards Saved'); //Advanced Settings -- cgit v1.2.3 From 4f7f9544e5dbf992599865243aee4c6e2a5b5f8e Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 18 May 2007 10:55:28 +0000 Subject: Added ability to take a Screenshot with the Print Key from every Screen in the Game git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@219 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMain.pas | 7 +++++-- Game/Code/Menu/UDisplay.pas | 7 +++---- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 47860198..3bf7d197 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -160,13 +160,16 @@ Begin End; // With} SDL_KEYDOWN: begin + //ScreenShot hack. If Print is pressed-> Make screenshot and Save to Screenshots Path + if (Event.key.keysym.sym = SDLK_SYSREQ) then + Display.ScreenShot + // popup hack... if there is a visible popup then let it handle input instead of underlying screen // shoud be done in a way to be sure the topmost popup has preference (maybe error, then check) - if (ScreenPopupError <> NIL) and (ScreenPopupError.Visible) then + else if (ScreenPopupError <> NIL) and (ScreenPopupError.Visible) then done := not ScreenPopupError.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) else if (ScreenPopupCheck <> NIL) AND (ScreenPopupCheck.Visible) then done := not ScreenPopupCheck.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) - // end of popup hack else diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index abaedfa8..f95a73e3 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -300,7 +300,6 @@ begin Jpeg.Assign(Bitmap); Bitmap.Free; Jpeg.CompressionQuality := 95;//90; - ForceDirectories(ScreenshotsPath); Jpeg.SaveToFile(FileName); Jpeg.Free; end; @@ -317,7 +316,7 @@ begin for Num := 1 to 9999 do begin FileName := IntToStr(Num); while Length(FileName) < 4 do FileName := '0' + FileName; - FileName := {ScreenshotsPath + }'screenshot' + FileName + '.BMP'; + FileName := ScreenshotsPath + FileName + '.BMP'; if not FileExists(FileName) then break end; @@ -331,8 +330,8 @@ begin //Schreiben der Bitmap-Informationen FileInfo.biSize := SizeOf(BITMAPINFOHEADER); - FileInfo.biWidth := ScreenH; - FileInfo.biHeight := ScreenW; + FileInfo.biWidth := ScreenW; + FileInfo.biHeight := ScreenH; FileInfo.biPlanes := 1; FileInfo.biBitCount := 32; FileInfo.biSizeImage := FileInfo.biWidth*FileInfo.biHeight*(FileInfo.biBitCount div 8); -- cgit v1.2.3 From 7bf5487faf2b099ced0b2126c2cca164be80acf1 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 18 May 2007 10:57:17 +0000 Subject: Some changes mode on ModiSDK and Depending Files(Plugin Loader, Party SingScreen and Plugins) Changes make the Pluginsystem more extendable with backwards compatibility in further Versions. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@220 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDLLManager.pas | 22 ++++++++++++++++------ Game/Code/Screens/UScreenSingModi.pas | 2 -- 2 files changed, 16 insertions(+), 8 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDLLManager.pas b/Game/Code/Classes/UDLLManager.pas index 59c75d5b..4b8838b9 100644 --- a/Game/Code/Classes/UDLLManager.pas +++ b/Game/Code/Classes/UDLLManager.pas @@ -25,7 +25,7 @@ type function LoadPlugin(No: Cardinal): boolean; procedure UnLoadPlugin; - function PluginInit (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: fModi_PlaySound): boolean; + function PluginInit (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: pModi_PlaySound): boolean; function PluginDraw (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; function PluginFinish (var Playerinfo: TPlayerinfo): byte; procedure PluginRData (handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD); @@ -75,6 +75,9 @@ end; procedure TDLLMan.ClearPluginInfo(No: Cardinal); begin + //Set to Party Modi Plugin + Plugins[No].Typ := 8; + Plugins[No].Name := 'unknown'; Plugins[No].NumPlayers := 0; @@ -183,12 +186,19 @@ if (hLib <> 0) then @P_RData := nil; end; -function TDLLMan.PluginInit (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: fModi_PlaySound): boolean; +function TDLLMan.PluginInit (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: pModi_PlaySound): boolean; +var + Methods: TMethodRec; begin -if (@P_Init <> nil) then - Result := P_Init (TeamInfo, PlayerInfo, Sentences, LoadTex, Print, LoadSound, PlaySound) -else - Result := False + Methods.LoadTex := LoadTex; + Methods.Print := Print; + Methods.LoadSound := LoadSound; + Methods.PlaySound := PlaySound; + + if (@P_Init <> nil) then + Result := P_Init (TeamInfo, PlayerInfo, Sentences, Methods) + else + Result := False end; function TDLLMan.PluginDraw (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 93ede980..0b9ab893 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -1061,8 +1061,6 @@ begin Result.TexNum := Tex.TexNum; Result.W := Tex.W; Result.H := Tex.H; - Result.ScaleW := Tex.ScaleW; - Result.ScaleH := Tex.ScaleH; end; { function Translate (const Name: PChar): PChar; stdcall; -- cgit v1.2.3 From ab2634e9b83cb44ad7d5a8b54a397b8c22a78778 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 18 May 2007 18:06:54 +0000 Subject: Fixed a Bug in Jump to Menu that causes a Wrong Song is Played, when the first Song is in the Results and Tabs=off. LastPlayed Variable was not set correctly. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@221 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSongJumpto.pas | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 42aedf3c..cfb897a8 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -187,6 +187,8 @@ begin //Select Input Interaction := 0; Button[0].Text[0].Selected := True; + + LastPlayed := ScreenSong.Interaction; end; function TScreenSongJumpto.Draw: boolean; -- cgit v1.2.3 From f0e4ad452891aec64c777c4bf806fc6f989ee327 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 18 May 2007 19:31:55 +0000 Subject: Some Code Cleanup and Minor Bugfixes in UScreenSongJumpto git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@222 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSongJumpto.pas | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index cfb897a8..2ea94cdc 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -84,27 +84,23 @@ begin SDLK_BACKSPACE: begin - if Interaction = 0 then + if (Interaction = 0) AND (Length(Button[0].Text[0].Text) > 0) then begin Button[0].Text[0].DeleteLastL; SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); end; end; - SDLK_ESCAPE : - begin - Music.PlayBack; - Visible := False; - if VisSongs = 0 then - CatSongs.SetFilter('', 0); - end; - - SDLK_RETURN: + SDLK_RETURN, SDLK_ESCAPE: begin Visible := False; Music.PlayBack; - if VisSongs = 0 then + if (VisSongs = 0) AND (Length(Button[0].Text[0].Text) > 0) then + begin + Button[0].Text[0].Text := ''; CatSongs.SetFilter('', 0); + SetTextFound(0); + end; end; // Up and Down could be done at the same time, @@ -127,7 +123,8 @@ begin if (Interaction=1) then begin InteractInc; - SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + if (Length(Button[0].Text[0].Text) > 0) then + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); end; end; SDLK_LEFT: @@ -135,7 +132,8 @@ begin if (Interaction=1) then begin InteractDec; - SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + if (Length(Button[0].Text[0].Text) > 0) then + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); end; end; end; @@ -178,7 +176,7 @@ begin //Reset Screen if no Old Search is Displayed if (CatSongs.CatNumShow <> -2) then begin - SelectType := 0; + SelectsS[0].SetSelectOpt(0); Button[0].Text[0].Text := ''; Text[0].Text := Theme.SongJumpto.NoSongsFound; @@ -201,7 +199,10 @@ begin if (Count = 0) then begin Text[0].Text := Theme.SongJumpto.NoSongsFound; - ScreenSong.HideCatTL; + if (Length(Button[0].Text[0].Text) = 0) then + ScreenSong.HideCatTL + else + ScreenSong.ShowCatTLCustom(Format(Theme.SongJumpto.CatText, [Button[0].Text[0].Text])); end else begin -- cgit v1.2.3 From e651ba08275a787932d6463773a4823f1b0ca30c Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 20 May 2007 09:33:23 +0000 Subject: Fixed a bug in uSMPEG, that causes much memory is not not freeed, after playing a Video File. (Texture and Surface are created new every Time) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@223 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/SMpeg/USmpeg.pas | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/SMpeg/USmpeg.pas b/Game/Code/SMpeg/USmpeg.pas index c7f756db..85f3f988 100644 --- a/Game/Code/SMpeg/USmpeg.pas +++ b/Game/Code/SMpeg/USmpeg.pas @@ -112,8 +112,9 @@ end; procedure CloseSmpeg; begin -// glmovie_quit; SMPEG_delete(mpeg); + //Fixing the Memory Lag in earlyer Versions (X-Mas Mod, all Official Versions) + glmovie_quit; end; function glmovie_init( Width : GLuint; Height : TGLuint ) : TGLenum; @@ -294,6 +295,7 @@ end; procedure glmovie_quit; begin glDeleteTextures(1, @texture_ids); + SDL_FreeSurface(surface); end; end. -- cgit v1.2.3 From 2a172c386d2c69a5a4157d8a6c0d4e64875b7011 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 20 May 2007 09:37:38 +0000 Subject: Fixed a Bug in UScreenSong. Everytime the Category List is shown, the next Song was selected. (Tabs=On) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@224 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 82dad1ed..12929629 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -218,7 +218,7 @@ begin begin Letter := UpCase(Chr(ScanCode)); I2 := Length(CatSongs.Song); - + //Jump To Titel if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then begin @@ -252,7 +252,7 @@ begin ChangeMusic; SetScroll4; UpdateLCD; - + //Break and Exit Exit; end; @@ -664,7 +664,7 @@ var begin inherited Create; - LoadFromTheme(Theme.Song); + LoadFromTheme(Theme.Song); TextArtist := AddText(Theme.Song.TextArtist); TextTitle := AddText(Theme.Song.TextTitle); @@ -759,6 +759,9 @@ begin //ClearArray For I := low(EqualizerBands) to high(EqualizerBands) do EqualizerBands[I] := 3; + + if (Length(CatSongs.Song) > 0) then + Interaction := 0; end; procedure TScreenSong.SetScroll; @@ -1222,13 +1225,12 @@ begin //Cat Mod etc if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then - begin + begin CatSongs.ShowCategoryList; - SelectNext; //Workaround <- must be fixed sometime FixSelected; //Show Cat in Top Left Mod - HideCatTL; - end; + HideCatTL; + end; if Length(CatSongs.Song) > 0 then begin @@ -1782,4 +1784,4 @@ FixSelected; } end; -end. +end. \ No newline at end of file -- cgit v1.2.3 From 8d45ef9b08de96a0037ac9e245a84b7730228736 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 20 May 2007 09:40:48 +0000 Subject: An effort to make a workaround for the many Crashes when a Video File ist corrupted. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@225 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index cdce5984..3899a4ed 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -730,7 +730,23 @@ end; procedure TScreenSing.onShowFinish; begin // play movie (II) - if AktSong.VideoLoaded then PlaySmpeg; + + if AktSong.VideoLoaded then + begin + try + PlaySmpeg; + except + //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video + AktSong.VideoLoaded := False; + Log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); + Log.LogError('Corrupted File: ' + AktSong.Video); + try + CloseSmpeg; + except + + end; + end; + end; // play music (II) Music.Play; @@ -1039,7 +1055,19 @@ begin SingDrawBackground; // update and draw movie if ShowFinish and AktSong.VideoLoaded then begin - UpdateSmpeg; // this only draws + try + UpdateSmpeg; // this only draws + except + //If an Error occurs drawing: prevent Video from being Drawn again and Close Video + AktSong.VideoLoaded := False; + log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); + Log.LogError('Corrupted File: ' + AktSong.Video); + try + CloseSmpeg; + except + + end; + end; end; // draw static menu (FG) -- cgit v1.2.3 From 0df43e29d3d12f93fd4ace638cfb60b65dd32262 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 23 May 2007 17:00:52 +0000 Subject: Fixed a Bug that can cause the application crashes, when Song Data is missing. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@226 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UFiles.pas | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index aa336233..ee1935cd 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -239,9 +239,12 @@ begin end // Video File - else if (Identifier = 'VIDEO') AND (FileExists(Song.Path + Value)) then + else if (Identifier = 'VIDEO') then begin - Song.Video := Value; + if (FileExists(Song.Path + Value)) then + Song.Video := Value + else + Log.LogError('Can''t find Video File in Song: ' + Song.Path + Song.FileName); end // Video Gap @@ -579,6 +582,7 @@ begin Result := ReadTxTHeader(AktSong); if not Result then begin + CloseFile(SongFile); Log.LogError('Error Loading SongHeader, abort Song Loading'); Exit; end; @@ -594,6 +598,7 @@ begin if (EoF(SongFile)) then begin //Song File Corrupted - No Notes + CloseFile(SongFile); Log.LogError('Could not load txt File, no Notes found: ' + Name); Result := False; Exit; @@ -617,7 +622,6 @@ begin // TempC := Tekst[1]; // read from backup variable, don't use default ':' value while (TempC <> 'E') AND (not EOF(SongFile)) do begin - Inc(FileLineNo); if (TempC = ':') or (TempC = '*') or (TempC = 'F') then begin // wczytuje nute Read(SongFile, Param1); @@ -688,10 +692,17 @@ begin end; Read(SongFile, TempC); + Inc(FileLineNo); end; // while} CloseFile(SongFile); except + try + CloseFile(SongFile); + except + + end; + Log.LogError('Error Loading File: "' + Name + '" in Line ' + inttostr(FileLineNo)); exit; end; -- cgit v1.2.3 From 10391b4d011dc60f1585643398b772bed3bb4beb Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 26 May 2007 15:30:36 +0000 Subject: Added Workaround and Error Reporting for Errors during Cover loading. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@229 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 75 ++++++++++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 21 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 12929629..db5eb2b2 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -661,6 +661,7 @@ constructor TScreenSong.Create; var Pet: integer; I: integer; +Label CreateSongButtons; begin inherited Create; @@ -719,37 +720,69 @@ begin //Set Length of Button Array one Time Instead of one time for every Song SetButtonLength(Length(CatSongs.Song)); - for Pet := 0 to High(CatSongs.Song) do begin // creating all buttons - // new - Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 - if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then - CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' + I := 0; + CreateSongButtons: - if CatSongs.Song[Pet].Cover = '' then - AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) - else begin - // cache texture if there is a need to this - if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then begin - Texture.CreateCacheMipmap := true; - Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap - Texture.CreateCacheMipmap := false; + try + for Pet := I to High(CatSongs.Song) do begin // creating all buttons + // new + Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 - // puts this texture to the cache file - Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' - // unload full size texture - Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); + if CatSongs.Song[Pet].Cover = '' then + AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) + else begin + // cache texture if there is a need to this + if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then begin + Texture.CreateCacheMipmap := true; + Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap + Texture.CreateCacheMipmap := false; - // we should also add mipmap texture by calling createtexture and use mipmap cache as data source + // puts this texture to the cache file + Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + + // unload full size texture + Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); + + // we should also add mipmap texture by calling createtexture and use mipmap cache as data source + end; + + // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) + AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); end; + Texture.Limit := 1024*1024; + I := -1; + end; + except + //When Error is reported the First time for this Song + if (I <> Pet) then + begin + //Some Error reporting: + Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); - // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) - AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + //Change Cover to NoCover and Continue Loading + CatSongs.Song[Pet].Cover := ''; + I := Pet; + end + else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song + begin + Log.LogError('NoCover Cover is damaged!'); + try + AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); + except + Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); + Halt; + end; + I := Pet + 1; end; - Texture.Limit := 1024*1024; end; + if (I <> -1) then + GoTo CreateSongButtons; + // Randomize Patch -- cgit v1.2.3 From c7e2eee2adb177669622a9ee99072ad2b746efe5 Mon Sep 17 00:00:00 2001 From: mota23 Date: Sat, 26 May 2007 15:48:55 +0000 Subject: Changed active lyrics color back to blue. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@230 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 3899a4ed..ed79bb2f 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -403,9 +403,9 @@ begin {LyricMain.ColSR := Skin_FontHighlightR; LyricMain.ColSG := Skin_FontHighlightG; LyricMain.ColSB := Skin_FontHighlightB;1aa5dc} - LyricMain.ColSR := 96/255; //26 - LyricMain.ColSG := 192/255; //165 - LyricMain.ColSB := 96/255; //220 + LyricMain.ColSR := 5/255; //26 + LyricMain.ColSG := 163/255; //165 + LyricMain.ColSB := 210/255; //220 LyricSub.ColR := 0.4; //0.6 LyricSub.ColG := 0.4; //0.6 -- cgit v1.2.3 From 79bed9be3f06a0ce6026755fbe49bd7437bdf12e Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 27 May 2007 09:26:00 +0000 Subject: Added workaround for corrupted background Images git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@231 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index ed79bb2f..2ba7522f 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -8,9 +8,9 @@ uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UT type TScreenSing = class(TMenu) protected - paused: boolean; //Pause Mod - PauseTime: Real; - NumEmptySentences: integer; + paused: boolean; //Pause Mod + PauseTime: Real; + NumEmptySentences: integer; public //TextTime: integer; @@ -356,7 +356,12 @@ begin // set background if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then - Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background) + try + Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background); + except + log.LogError('Background could not be loaded: ' + AktSong.Path + AktSong.Background); + Tex_Background.TexNum := -1; + end else Tex_Background.TexNum := -1; -- cgit v1.2.3 From 7ee656d31524f4820b362a31fc6bc1fe0988c0dc Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 28 May 2007 18:58:08 +0000 Subject: Changed Text Spacing for a better look SelectLoadingAnimation in ScreenAdvanced hidden, because it is useless atm Changed Theme to fit the new Textspacing Fixed some Language entrys git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@232 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UMenuText.pas | 5 ++++- Game/Code/Screens/UScreenOptionsAdvanced.pas | 15 +++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas index 4cb48cad..5b035f51 100644 --- a/Game/Code/Menu/UMenuText.pas +++ b/Game/Code/Menu/UMenuText.pas @@ -276,7 +276,10 @@ begin SetFontPos(X2, Y2); glPrint(PChar(Text2)); - Y2 := Y2 + Size * 1.7; + {if Size >= 10 then + Y2 := Y2 + Size * 2.8 + else} + Y2 := Y2 + Size * 2.15; end; SetFontStyle(0); // reset to default diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index 4c3356d0..9cac8c5e 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -35,7 +35,9 @@ begin end; SDLK_RETURN: begin - if SelInteraction = 7 then begin + //SelectLoadAnimation Hidden because it is useless atm + //if SelInteraction = 7 then begin + if SelInteraction = 6 then begin Ini.Save; Music.PlayBack; FadeTo(@ScreenOptions); @@ -47,14 +49,18 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 6) then begin + //SelectLoadAnimation Hidden because it is useless atm + //if (SelInteraction >= 0) and (SelInteraction <= 6) then begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin Music.PlayOption; InteractInc; end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 6) then begin + //SelectLoadAnimation Hidden because it is useless atm + //if (SelInteraction >= 0) and (SelInteraction <= 6) then begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin Music.PlayOption; InteractDec; end; @@ -71,7 +77,8 @@ begin LoadFromTheme(Theme.OptionsAdvanced); - AddSelect(Theme.OptionsAdvanced.SelectLoadAnimation, Ini.LoadAnimation, ILoadAnimation); + //SelectLoadAnimation Hidden because it is useless atm + //AddSelect(Theme.OptionsAdvanced.SelectLoadAnimation, Ini.LoadAnimation, ILoadAnimation); AddSelect(Theme.OptionsAdvanced.SelectScreenFade, Ini.ScreenFade, IScreenFade); AddSelect(Theme.OptionsAdvanced.SelectEffectSing, Ini.EffectSing, IEffectSing); AddSelect(Theme.OptionsAdvanced.SelectLineBonus, Ini.LineBonus, ILineBonus); -- cgit v1.2.3 From 0a558c269217ea1eff20805e8fab8ce3ef0a2910 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 28 May 2007 19:29:24 +0000 Subject: Fixed a bug in Coverloading, that could end up in an endless loop. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@233 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 106 +++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 52 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index db5eb2b2..45c7c2de 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -718,72 +718,74 @@ begin // Songs.LoadSongList; // moved to the UltraStar unit CatSongs.Refresh; - //Set Length of Button Array one Time Instead of one time for every Song - SetButtonLength(Length(CatSongs.Song)); + if (length(CatSongs.Song) > 0) then + begin + //Set Length of Button Array one Time Instead of one time for every Song + SetButtonLength(Length(CatSongs.Song)); - I := 0; - CreateSongButtons: + I := 0; + CreateSongButtons: - try - for Pet := I to High(CatSongs.Song) do begin // creating all buttons - // new - Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 + try + for Pet := I to High(CatSongs.Song) do begin // creating all buttons + // new + Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 - if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then - CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' + if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' - if CatSongs.Song[Pet].Cover = '' then - AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) - else begin - // cache texture if there is a need to this - if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then begin - Texture.CreateCacheMipmap := true; - Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap - Texture.CreateCacheMipmap := false; + if CatSongs.Song[Pet].Cover = '' then + AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) + else begin + // cache texture if there is a need to this + if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then begin + Texture.CreateCacheMipmap := true; + Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap + Texture.CreateCacheMipmap := false; - // puts this texture to the cache file - Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + // puts this texture to the cache file + Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); - // unload full size texture - Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); + // unload full size texture + Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); - // we should also add mipmap texture by calling createtexture and use mipmap cache as data source - end; + // we should also add mipmap texture by calling createtexture and use mipmap cache as data source + end; - // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) - AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) + AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + end; + Texture.Limit := 1024*1024; + I := -1; end; - Texture.Limit := 1024*1024; - I := -1; - end; - except - //When Error is reported the First time for this Song - if (I <> Pet) then - begin - //Some Error reporting: - Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); + except + //When Error is reported the First time for this Song + if (I <> Pet) then + begin + //Some Error reporting: + Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); - //Change Cover to NoCover and Continue Loading - CatSongs.Song[Pet].Cover := ''; - I := Pet; - end - else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song - begin - Log.LogError('NoCover Cover is damaged!'); - try - AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); - except - Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); - Halt; + //Change Cover to NoCover and Continue Loading + CatSongs.Song[Pet].Cover := ''; + I := Pet; + end + else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song + begin + Log.LogError('NoCover Cover is damaged!'); + try + AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); + except + Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); + Halt; + end; + I := Pet + 1; end; - I := Pet + 1; end; - end; - - if (I <> -1) then - GoTo CreateSongButtons; + if (I <> -1) then + GoTo CreateSongButtons; + end; // Randomize Patch Randomize; -- cgit v1.2.3 From 3789f80943f7a237ecbcadeee5803a1fa4a982a2 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 28 May 2007 19:57:46 +0000 Subject: Fixed some Pronounciation in Error Messages git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@235 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UFiles.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index ee1935cd..5214a9b3 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -336,8 +336,8 @@ begin if (Done <> 15) then begin Result := False; - if (Done and 8) = 0 then //No BMP Flag - Log.LogError('BMP Tag Missing: ' + Song.FileName) + if (Done and 8) = 0 then //No BPM Flag + Log.LogError('BPM Tag Missing: ' + Song.FileName) else if (Done and 4) = 0 then //No MP3 Flag Log.LogError('MP3 Tag/File Missing: ' + Song.FileName) else if (Done and 2) = 0 then //No Artist Flag -- cgit v1.2.3 From 0bb302b56187c6435ae78bee7901765dbf72e89d Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 28 May 2007 19:58:06 +0000 Subject: New spacing for Font type 1 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@236 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UMenuText.pas | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas index 5b035f51..69ece02f 100644 --- a/Game/Code/Menu/UMenuText.pas +++ b/Game/Code/Menu/UMenuText.pas @@ -279,6 +279,9 @@ begin {if Size >= 10 then Y2 := Y2 + Size * 2.8 else} + if (Style = 1) then + Y2 := Y2 + Size * 2.8 + else Y2 := Y2 + Size * 2.15; end; SetFontStyle(0); // reset to default -- cgit v1.2.3 From 2648bf52507205e7b00898cf2f5b6a3eb40e2229 Mon Sep 17 00:00:00 2001 From: mota23 Date: Tue, 29 May 2007 16:57:11 +0000 Subject: Added: Support for Player Name Templates. Set Names in config.ini ([NameTemplate], Name1..12=text and recall in Name-Screens with F1..F12. Fix: All 12 player- and 3 teamnames are now saved in config.ini git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@237 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UIni.pas | 22 +++++++++-- Game/Code/Screens/UScreenName.pas | 51 +++++++++++++++++++++++++ Game/Code/Screens/UScreenPartyPlayer.pas | 65 ++++++++++++++++++++++++++++++++ 3 files changed, 135 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index f3ea84ac..c92a7a50 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -5,7 +5,11 @@ uses IniFiles, ULog, SysUtils; type TIni = class - Name: array[0..5] of string; + Name: array[0..11] of string; + + // Templates for Names Mod + NameTeam: array[0..2] of string; + NameTemplate: array[0..11] of string; // Game Players: integer; @@ -174,9 +178,16 @@ begin IniFile := TMemIniFile.Create(GamePath + 'config.ini'); // Name - for I := 0 to 5 do + for I := 0 to 11 do Ini.Name[I] := IniFile.ReadString('Name', 'P'+IntToStr(I+1), 'Player'+IntToStr(I+1)); + + // Templates for Names Mod + for I := 0 to 2 do + Ini.NameTeam[I] := IniFile.ReadString('NameTeam', 'T'+IntToStr(I+1), 'Team'+IntToStr(I+1)); + for I := 0 to 11 do + Ini.NameTemplate[I] := IniFile.ReadString('NameTemplate', 'Name'+IntToStr(I+1), 'Template'+IntToStr(I+1)); + // Players Tekst := IniFile.ReadString('Game', 'Players', IPlayers[0]); for Pet := 0 to High(IPlayers) do @@ -665,8 +676,13 @@ begin IniFile := TIniFile.Create(GamePath + 'config.ini'); //Name - for I := 1 to 6 do + // Templates for Names Mod + for I := 1 to 12 do IniFile.WriteString('Name', 'P' + IntToStr(I), Ini.Name[I-1]); + for I := 1 to 3 do + IniFile.WriteString('NameTeam', 'T' + IntToStr(I), Ini.NameTeam[I-1]); + for I := 1 to 12 do + IniFile.WriteString('NameTemplate', 'Name' + IntToStr(I), Ini.NameTemplate[I-1]); IniFile.Free; end; diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index e2a80687..1b90c570 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -32,6 +32,57 @@ begin Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + chr(ScanCode); end; + // Templates for Names Mod + SDLK_F1: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[0]; + end; + SDLK_F2: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[1]; + end; + SDLK_F3: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[2]; + end; + SDLK_F4: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[3]; + end; + SDLK_F5: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[4]; + end; + SDLK_F6: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[5]; + end; + SDLK_F7: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[6]; + end; + SDLK_F8: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[7]; + end; + SDLK_F9: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[8]; + end; + SDLK_F10: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[9]; + end; + SDLK_F11: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[10]; + end; + SDLK_F12: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[11]; + end; + + SDLK_BACKSPACE: begin Button[Interaction].Text[0].DeleteLastL; diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index f6bcb0b7..e8607470 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -61,6 +61,56 @@ begin Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + chr(ScanCode); end; + // Templates for Names Mod + SDLK_F1: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[0]; + end; + SDLK_F2: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[1]; + end; + SDLK_F3: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[2]; + end; + SDLK_F4: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[3]; + end; + SDLK_F5: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[4]; + end; + SDLK_F6: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[5]; + end; + SDLK_F7: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[6]; + end; + SDLK_F8: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[7]; + end; + SDLK_F9: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[8]; + end; + SDLK_F10: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[9]; + end; + SDLK_F11: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[10]; + end; + SDLK_F12: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[11]; + end; + SDLK_BACKSPACE: begin Button[Interaction].Text[0].DeleteLastL; @@ -135,6 +185,21 @@ procedure TScreenPartyPlayer.onShow; var I: integer; begin + // Templates for Names Mod + for I := 1 to 4 do + Button[I].Text[0].Text := Ini.Name[I-1]; + + for I := 6 to 9 do + Button[I].Text[0].Text := Ini.Name[I-2]; + + for I := 11 to 14 do + Button[I].Text[0].Text := Ini.Name[I-3]; + + Button[0].Text[0].Text := Ini.NameTeam[0]; + Button[5].Text[0].Text := Ini.NameTeam[1]; + Button[10].Text[0].Text := Ini.NameTeam[2]; + // Templates for Names Mod end + If (PartySession.Teams.NumTeams>=1) then begin Button[0].Visible := True; -- cgit v1.2.3 From dc72a49b4c680fe6698b831a203a9b00e476d562 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 1 Jun 2007 17:23:59 +0000 Subject: Fixed a Memory Bug in UMenuSelectSlide that causes memory that is not in use anymore is not freeed when the Attributes of a SelectSlide are Updated git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@240 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UMenuSelectSlide.pas | 43 +++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UMenuSelectSlide.pas b/Game/Code/Menu/UMenuSelectSlide.pas index 0149ea2b..f18b45cd 100644 --- a/Game/Code/Menu/UMenuSelectSlide.pas +++ b/Game/Code/Menu/UMenuSelectSlide.pas @@ -308,33 +308,34 @@ begin if (Lines <= 0) then Lines := 1; + //Free old Space used by Texts + For I := low(TextOpt) to high(TextOpt) do + TextOpt[I].Free; + setLength (TextOpt, Lines); for I := low(TextOpt) to high(TextOpt) do begin + TextOpt[I] := TText.Create; + TextOpt[I].Size := Text.Size; + //TextOpt[I].Align := 1; + TextOpt[I].Align := 0; + TextOpt[I].Visible := True; - //TextOpt[I] := TextOpt[0]; - TextOpt[I] := TText.Create; - TextOpt[I].Size := Text.Size; - //TextOpt[I].Align := 1; - TextOpt[I].Align := 0; - TextOpt[I].Visible := True; - - TextOpt[I].ColR := STDColR; - TextOpt[I].ColG := STDColG; - TextOpt[I].ColB := STDColB; - TextOpt[I].Int := STDInt; - - //Generate Positions - //TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * (I + 0.5); - TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * I; - TextOpt[I].Y := TextureSBG.Y + (TextureSBG.H / 2) - 1.5 * Text.Size{20}; - - //Better Look with 2 Options - if (Lines=2) AND (Length(TextOptT)= 2) then - TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W -40 - glTextWidth(PChar(TextOptT[1]))) * I; + TextOpt[I].ColR := STDColR; + TextOpt[I].ColG := STDColG; + TextOpt[I].ColB := STDColB; + TextOpt[I].Int := STDInt; + + //Generate Positions + //TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * (I + 0.5); + TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * I; + TextOpt[I].Y := TextureSBG.Y + (TextureSBG.H / 2) - 1.5 * Text.Size{20}; + + //Better Look with 2 Options + if (Lines=2) AND (Length(TextOptT)= 2) then + TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W -40 - glTextWidth(PChar(TextOptT[1]))) * I; end; - //TextOpt[I] := TextOpt[0]; end; end. -- cgit v1.2.3 From 842794d7b93443626089c00083118b532105c5ac Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 1 Jun 2007 17:40:09 +0000 Subject: Fixed standard Cover position. Buttons that have no expression in Theme are now hidden. The Screens are still available through Hotkeys, but they have supposably also no expression in Theme. => Better compatibility with old Screens git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@241 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 471e46bf..ef5d1136 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -974,7 +974,7 @@ begin //Load Cover Pos and Size from Theme Mod Song.Cover.X := ThemeIni.ReadInteger('SongCover', 'X', 300); - Song.Cover.Y := ThemeIni.ReadInteger('SongCover', 'Y', 140); + Song.Cover.Y := ThemeIni.ReadInteger('SongCover', 'Y', 190); Song.Cover.W := ThemeIni.ReadInteger('SongCover', 'W', 300); Song.Cover.H := ThemeIni.ReadInteger('SongCover', 'H', 200); Song.Cover.Style := ThemeIni.ReadInteger('SongCover', 'Style', 4); @@ -1589,6 +1589,11 @@ var T: integer; Collections2: PAThemeButtonCollection; begin + if not ThemeIni.SectionExists(Name) then + begin + ThemeButton.Visible := False; + exit; + end; DecimalSeparator := '.'; ThemeButton.Tex := ThemeIni.ReadString(Name, 'Tex', ''); ThemeButton.X := ThemeIni.ReadInteger (Name, 'X', 0); -- cgit v1.2.3 From 514ece97aaeb8eaa8bf56e224826bc5e6169ce8b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 3 Jun 2007 19:00:14 +0000 Subject: Some Code Cleanup in UScreenSong Add Procedure DeletePlaylist to TPlaylistManager Add automatic Playlist Deleting if last Song is deleted Fixed some Cover displaying Bugs when JumptoMenu is left git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@242 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlaylist.pas | 84 ++++++++++++++++++++++++++------- Game/Code/Screens/UScreenSong.pas | 37 +++++++-------- Game/Code/Screens/UScreenSongJumpto.pas | 1 + Game/Code/Screens/UScreenSongMenu.pas | 2 +- 4 files changed, 87 insertions(+), 37 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlaylist.pas b/Game/Code/Classes/UPlaylist.pas index 67460ed7..55cf90ff 100644 --- a/Game/Code/Classes/UPlaylist.pas +++ b/Game/Code/Classes/UPlaylist.pas @@ -40,6 +40,7 @@ type Procedure SetPlayList(Index: Cardinal); Function AddPlaylist(Name: String): Cardinal; + Procedure DelPlaylist(const Index: Cardinal); Procedure AddItem(const SongID: Cardinal; const iPlaylist: Integer = -1); Procedure DelItem(const iItem: Cardinal; const iPlaylist: Integer = -1); @@ -197,27 +198,29 @@ begin //open File for Rewriting AssignFile(F, PlaylistPath + Playlists[Index].Filename); try - Rewrite(F); + try + Rewrite(F); - //Write Version (not nessecary but helpful) - WriteLn(F, '######################################'); - WriteLn(F, '#Ultrastar Deluxe Playlist Format v1.0'); - WriteLn(F, '#Playlist "' + Playlists[Index].Name + '" with ' + InttoStr(Length(Playlists[Index].Items)) + ' Songs.'); - WriteLn(F, '######################################'); + //Write Version (not nessecary but helpful) + WriteLn(F, '######################################'); + WriteLn(F, '#Ultrastar Deluxe Playlist Format v1.0'); + WriteLn(F, '#Playlist "' + Playlists[Index].Name + '" with ' + InttoStr(Length(Playlists[Index].Items)) + ' Songs.'); + WriteLn(F, '######################################'); - //Write Name Information - WriteLn(F, '#Name: ' + Playlists[Index].Name); + //Write Name Information + WriteLn(F, '#Name: ' + Playlists[Index].Name); - //Write Song Information - WriteLn(F, '#Songs:'); + //Write Song Information + WriteLn(F, '#Songs:'); - For I := 0 to high(Playlists[Index].Items) do - begin - WriteLn(F, Playlists[Index].Items[I].Artist + ' : ' + Playlists[Index].Items[I].Title); + For I := 0 to high(Playlists[Index].Items) do + begin + WriteLn(F, Playlists[Index].Items[I].Artist + ' : ' + Playlists[Index].Items[I].Title); + end; + except + log.LogError('Could not write Playlistfile "' + Playlists[Index].Name + '"'); end; - finally - log.LogError('Could not write Playlistfile "' + Playlists[Index].Name + '"'); CloseFile(F); end; end; @@ -247,6 +250,9 @@ begin CatSongs.CatNumShow := -3; Mode := 2; + //Set CurPlaylist + CurPlaylist := Index; + //Show Cat in Topleft: ScreenSong.ShowCatTLCustom(Format(Theme.Playlist.CatText,[Playlists[Index].Name])); @@ -286,6 +292,47 @@ begin SavePlayList(Result); end; +//---------- +//DelPlaylist - Deletes a Playlist +//---------- +Procedure TPlayListManager.DelPlaylist(const Index: Cardinal); +var + I: Integer; + Filename: String; +begin + If Index > High(Playlists) then + Exit; + + Filename := PlaylistPath + Playlists[Index].Filename; + + //If not FileExists or File is not Writeable then exit + If (Not FileExists(Filename)) OR (FileisReadOnly(Filename)) then + Exit; + + + //Delete Playlist from FileSystem + if Not DeleteFile(Filename) then + Exit; + + //Delete Playlist from Array + //move all PLs to the Hole + For I := Index to High(Playlists)-1 do + PlayLists[I] := PlayLists[I+1]; + + //Delete last Playlist + SetLength (Playlists, High(Playlists)); + + //If Playlist is Displayed atm + //-> Display Songs + if (CatSongs.CatNumShow = -3) and (Index = CurPlaylist) then + begin + ScreenSong.UnLoadDetailedCover; + CatSongs.SetFilter('', 0); + ScreenSong.Interaction := 0; + ScreenSong.FixSelected; + end; +end; + //---------- //AddItem - Adds an Item to a specific Playlist //---------- @@ -347,8 +394,13 @@ begin SavePlayList(P); end; + //Delete Playlist if Last Song is deleted + if (Length(PlayLists[P].Items) = 0) then + begin + DelPlaylist(P); + end //Correct Display when Editing current Playlist - if (CatSongs.CatNumShow = -3) and (P = CurPlaylist) then + else if (CatSongs.CatNumShow = -3) and (P = CurPlaylist) then SetPlaylist(P); end; diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 45c7c2de..3924968f 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -95,6 +95,8 @@ type procedure DoJoker(Team: Byte); procedure SelectPlayers; + procedure UnLoadDetailedCover; + //Extensions procedure DrawExtensions; end; @@ -1379,13 +1381,7 @@ begin if VS > 0 then begin - CoverTime := 0; - Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture - Button[Interaction].Texture2.Alpha := 0; - - //0.5.0: unload old full size texture - if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then - Texture.UnloadTexture(Button[Interaction].Texture.Name, false); + UnLoadDetailedCover; Skip := 1; @@ -1417,13 +1413,7 @@ begin if VS > 0 then begin - CoverTime := 0; - Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture - Button[Interaction].Texture2.Alpha := 0; - - //0.5.0: unload old full size texture - if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then - Texture.UnloadTexture(Button[Interaction].Texture.Name, false); + UnLoadDetailedCover; Skip := 1; @@ -1470,12 +1460,7 @@ var Skip: integer; I: integer; begin - CoverTime := 0; - Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture - Button[Interaction].Texture2.Alpha := 0; - - if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then - Texture.UnloadTexture(Button[Interaction].Texture.Name, false); + UnLoadDetailedCover; Interaction := High(CatSongs.Song); SongTarget := 0; @@ -1809,6 +1794,18 @@ begin end; end; +//Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song +procedure TScreenSong.UnLoadDetailedCover; +begin + CoverTime := 0; + + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture + Button[Interaction].Texture2.Alpha := 0; + + if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then + Texture.UnloadTexture(Button[Interaction].Texture.Name, false); +end; + procedure TScreenSong.Refresh; begin { CatSongs.Refresh; diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 2ea94cdc..560868a5 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -97,6 +97,7 @@ begin Music.PlayBack; if (VisSongs = 0) AND (Length(Button[0].Text[0].Text) > 0) then begin + ScreenSong.UnLoadDetailedCover; Button[0].Text[0].Text := ''; CatSongs.SetFilter('', 0); SetTextFound(0); diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 2469240f..3814334c 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -414,7 +414,7 @@ begin 1: //Button 2 begin //Select New Players then Sing: - + ScreenSong.SelectPlayers; Visible := False; end; -- cgit v1.2.3 From 49ada15c935658c5d90416e26acfb360f1e7c047 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 3 Jun 2007 19:45:43 +0000 Subject: Added SongPreview Fading Song Preview Max Volume is now 70 % Need Testing because of timing git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@243 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMusic.pas | 13 +++++++++++++ Game/Code/Screens/UScreenSong.pas | 14 ++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index 6e997c11..52bae3c9 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -59,6 +59,7 @@ type procedure InitializePlayback; procedure InitializeRecord; procedure SetVolume(Volume: integer); + procedure SetMusicVolume(Volume: Byte); procedure SetLoop(Enabled: boolean); function Open(Name: string): boolean; // true if succeed procedure Rewind; @@ -350,6 +351,16 @@ begin BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); end; +procedure TMusic.SetMusicVolume(Volume: Byte); +begin + //Max Volume Prevention + if Volume > 100 then + Volume := 100; + + //Set Volume + BASS_ChannelSetAttributes (Bass, -1, Integer(Volume), -101); +end; + procedure TMusic.SetLoop(Enabled: boolean); begin Loop := Enabled; @@ -364,6 +375,8 @@ begin Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); Loaded := true; + //Set Max Volume + SetMusicVolume (100); end; Result := Loaded; diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 3924968f..ae02b2f4 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1275,6 +1275,8 @@ begin Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); Music.MoveTo(Music.Length / 4); Music.Play; + //Music Fade (Start not with max Volume) + Music.SetMusicVolume(70); SetScroll; UpdateLCD; end; @@ -1349,18 +1351,25 @@ begin // Log.LogBenchmark('SetScroll4', 5); - // 0.5.0: cover fade + // 0.5.0: cover fade and Song Fade if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin // load new texture Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); Button[Interaction].Texture.Alpha := 1; Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); Button[Interaction].Texture2.Alpha := 1; + + //Play Song + Music.SetMusicVolume(20); + Music.Play; end; CoverTime := CoverTime + TimeSkip; Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; + if (CoverTime > 1) and (CoverTime <= 3.5) then + Music.SetMusicVolume(Round((CoverTime-1)* 20)); + inherited Draw; @@ -1448,7 +1457,8 @@ begin Music.Close; if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin Music.MoveTo(Music.Length / 4); - Music.Play; + //Song Fading: Not Play Directly + //Music.Play; end; end else -- cgit v1.2.3 From d08356e3b64d8738ff9672229c1bbe963b58337c Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 6 Jun 2007 20:24:29 +0000 Subject: Fixed some Bugs in Song Fading Added Ini Values to change the Fading and the Preview Volume git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@245 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UIni.pas | 26 +++++++++- Game/Code/Classes/UMusic.pas | 6 +-- Game/Code/Screens/UScreenSong.pas | 103 ++++++++++++++++++++++++++------------ 3 files changed, 97 insertions(+), 38 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index c92a7a50..528966b3 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -38,7 +38,10 @@ type BeatClick: integer; SavePlayback: integer; Threshold: integer; - //TwoPlayerMode: integer; + + //Song Preview + PreviewVolume: integer; + PreviewFading: integer; // Lyrics LyricsFont: integer; @@ -130,7 +133,10 @@ const IBeatClick: array[0..1] of string = ('Off', 'On'); ISavePlayback: array[0..1] of string = ('Off', 'On'); IThreshold: array[0..3] of string = ('5%', '10%', '15%', '20%'); - //ITwoPlayerMode: array[0..2] of string = ('Stereo', '2 Cards', 'Advanced'); + //Song Preview + IPreviewVolume: array[0..10] of string = ('Off', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%'); + IPreviewFading: array[0..5] of string = ('Off', '1 Sec', '2 Secs', '3 Secs', '4 Secs', '5 Secs'); + ILyricsFont: array[0..2] of string = ('Plain', 'OLine1', 'OLine2'); ILyricsEffect: array[0..3] of string = ('Simple', 'Zoom', 'Slide', 'Ball'); @@ -316,6 +322,15 @@ begin for Pet := 0 to High(IThreshold) do if Tekst = IThreshold[Pet] then Ini.Threshold := Pet; + //Song Preview + Tekst := IniFile.ReadString('Sound', 'PreviewVolume', IPreviewVolume[7]); + for Pet := 0 to High(IPreviewVolume) do + if Tekst = IPreviewVolume[Pet] then Ini.PreviewVolume := Pet; + + Tekst := IniFile.ReadString('Sound', 'PreviewFading', IPreviewFading[1]); + for Pet := 0 to High(IPreviewFading) do + if Tekst = IPreviewFading[Pet] then Ini.PreviewFading := Pet; + // Lyrics Font Tekst := IniFile.ReadString('Lyrics', 'LyricsFont', ILyricsFont[1]); for Pet := 0 to High(ILyricsFont) do @@ -582,6 +597,13 @@ begin Tekst := IThreshold[Ini.Threshold]; IniFile.WriteString('Sound', 'Threshold', Tekst); + // Song Preview + Tekst := IPreviewVolume[Ini.PreviewVolume]; + IniFile.WriteString('Sound', 'PreviewVolume', Tekst); + + Tekst := IPreviewFading[Ini.PreviewFading]; + IniFile.WriteString('Sound', 'PreviewFading', Tekst); + // SavePlayback Tekst := ISavePlayback[Ini.SavePlayback]; IniFile.WriteString('Sound', 'SavePlayback', Tekst); diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index 52bae3c9..3fcd2a21 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -59,7 +59,7 @@ type procedure InitializePlayback; procedure InitializeRecord; procedure SetVolume(Volume: integer); - procedure SetMusicVolume(Volume: Byte); + procedure SetMusicVolume(Volume: integer); procedure SetLoop(Enabled: boolean); function Open(Name: string): boolean; // true if succeed procedure Rewind; @@ -351,14 +351,14 @@ begin BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); end; -procedure TMusic.SetMusicVolume(Volume: Byte); +procedure TMusic.SetMusicVolume(Volume: Integer); begin //Max Volume Prevention if Volume > 100 then Volume := 100; //Set Volume - BASS_ChannelSetAttributes (Bass, -1, Integer(Volume), -101); + BASS_ChannelSetAttributes (Bass, -1, Volume, -101); end; procedure TMusic.SetLoop(Enabled: boolean); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index ae02b2f4..ee05c11c 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1271,12 +1271,21 @@ begin if Length(CatSongs.Song) > 0 then begin - Music.SetLoop(false); - Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); - Music.MoveTo(Music.Length / 4); - Music.Play; - //Music Fade (Start not with max Volume) - Music.SetMusicVolume(70); + //Load Music only when Song Preview is activated + if (Ini.PreviewVolume <> 0) then + begin + Music.SetLoop(false); + Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + Music.MoveTo(Music.Length / 4); + Music.Play; + + //Set Preview Volume + Music.SetMusicVolume (Ini.PreviewVolume * 10); + {//if Music Fade is activated, Set Volume to 0 % + if (Ini.PreviewFading <> 0) then + Music.SetMusicVolume(0);} + end; + SetScroll; UpdateLCD; end; @@ -1312,6 +1321,10 @@ end; procedure TScreenSong.onHide; begin + //When Music Fading is activated, Turn Music to 100 % + If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then + Music.SetMusicVolume(100); + //When hide then Stop Music (For Party Mode Popup on Exit) if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then Music.Stop; @@ -1350,25 +1363,42 @@ begin // Log.BenchmarkEnd(5); // Log.LogBenchmark('SetScroll4', 5); + //Fading Functions, Only if Covertime is under 5 Seconds + If (CoverTime < 5) then + begin + // 0.5.0: cover fade + if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin + // load new texture + Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture.Alpha := 1; + Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture2.Alpha := 1; + end; - // 0.5.0: cover fade and Song Fade - if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin - // load new texture - Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); - Button[Interaction].Texture.Alpha := 1; - Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); - Button[Interaction].Texture2.Alpha := 1; + //Song Fade + if (CatSongs.VisibleSongs > 0) AND (Ini.PreviewVolume <> 0) AND (Not CatSongs.Song[Interaction].Main) AND (Ini.PreviewFading <> 0) then + begin + //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling + if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then + Music.Play; - //Play Song - Music.SetMusicVolume(20); - Music.Play; - end; - CoverTime := CoverTime + TimeSkip; - Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; - if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; + //Update Song Volume + if (CoverTime < Ini.PreviewFading) then + Music.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) + else + Music.SetMusicVolume(Ini.PreviewVolume * 10); + + end; - if (CoverTime > 1) and (CoverTime <= 3.5) then - Music.SetMusicVolume(Round((CoverTime-1)* 20)); + + //Update Fading Time + CoverTime := CoverTime + TimeSkip; + + //Update Fading Texture + Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; + if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; + + end; inherited Draw; @@ -1452,17 +1482,24 @@ end; //Procedure Change current played Preview procedure TScreenSong.ChangeMusic; begin - if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then - begin - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); - //Song Fading: Not Play Directly - //Music.Play; - end; - end - else - Music.Stop; + //When Music Preview is avtivated -> then Change Music + if (Ini.PreviewVolume <> 0) then + begin + if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then + begin + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal + if (Ini.PreviewVolume <> 0) then + Music.SetMusicVolume(0) + else + Music.Play; + end; + end + else + Music.Stop; + end; end; procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0 -- cgit v1.2.3 From 7518565b2c77b915e8fe4f693f8de161d7506859 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 6 Jun 2007 20:26:59 +0000 Subject: Made new Player BG and Score Objects in ScreenSing backwards compatible git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@246 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index ef5d1136..8a6a7b9b 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -1053,16 +1053,38 @@ begin ThemeLoadText(Sing.TextP1Score, 'SingP1TextScore'); //Added for ps3 skin //This one is shown in 2/4P mode - ThemeLoadStatic(Sing.StaticP1TwoP, 'SingP1TwoPStatic'); - ThemeLoadText(Sing.TextP1TwoP, 'SingP1TwoPText'); - ThemeLoadStatic(Sing.StaticP1TwoPScoreBG, 'SingP1TwoPStatic2'); - ThemeLoadText(Sing.TextP1TwoPScore, 'SingP1TwoPTextScore'); + //if it exists, otherwise the one Player equivaltents are used + if (ThemeIni.SectionExists('SingP1TwoPTextScore')) then + begin + ThemeLoadStatic(Sing.StaticP1TwoP, 'SingP1TwoPStatic'); + ThemeLoadText(Sing.TextP1TwoP, 'SingP1TwoPText'); + ThemeLoadStatic(Sing.StaticP1TwoPScoreBG, 'SingP1TwoPStatic2'); + ThemeLoadText(Sing.TextP1TwoPScore, 'SingP1TwoPTextScore'); + end + else + begin + Sing.StaticP1TwoP := Sing.StaticP1; + Sing.TextP1TwoP := Sing.TextP1; + Sing.StaticP1TwoPScoreBG := Sing.StaticP1ScoreBG; + Sing.TextP1TwoPScore := Sing.TextP1Score; + end; //This one is shown in 3/6P mode - ThemeLoadStatic(Sing.StaticP1ThreeP, 'SingP1ThreePStatic'); - ThemeLoadText(Sing.TextP1ThreeP, 'SingP1ThreePText'); - ThemeLoadStatic(Sing.StaticP1ThreePScoreBG, 'SingP1ThreePStatic2'); - ThemeLoadText(Sing.TextP1ThreePScore, 'SingP1ThreePTextScore'); + //if it exists, otherwise the one Player equivaltents are used + if (ThemeIni.SectionExists('SingP1TwoPTextScore')) then + begin + ThemeLoadStatic(Sing.StaticP1ThreeP, 'SingP1ThreePStatic'); + ThemeLoadText(Sing.TextP1ThreeP, 'SingP1ThreePText'); + ThemeLoadStatic(Sing.StaticP1ThreePScoreBG, 'SingP1ThreePStatic2'); + ThemeLoadText(Sing.TextP1ThreePScore, 'SingP1ThreePTextScore'); + end + else + begin + Sing.StaticP1ThreeP := Sing.StaticP1; + Sing.TextP1ThreeP := Sing.TextP1; + Sing.StaticP1ThreePScoreBG := Sing.StaticP1ScoreBG; + Sing.TextP1ThreePScore := Sing.TextP1Score; + end; //eoa ThemeLoadStatic(Sing.StaticP2R, 'SingP2RStatic'); ThemeLoadText(Sing.TextP2R, 'SingP2RText'); -- cgit v1.2.3 From 18579e1d865dc0fbd9c179fc5d45b1fff2b9033b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 7 Jun 2007 07:42:38 +0000 Subject: Fixed 2 Bugs in Song Preview Fading git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@247 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index ee05c11c..1a5b41b8 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1325,6 +1325,10 @@ begin If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then Music.SetMusicVolume(100); + //If Preview is deactivated: Load MUsicfile now + If (Ini.PreviewVolume = 0) then + Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + //When hide then Stop Music (For Party Mode Popup on Exit) if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then Music.Stop; @@ -1491,10 +1495,10 @@ begin if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin Music.MoveTo(Music.Length / 4); //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal - if (Ini.PreviewVolume <> 0) then - Music.SetMusicVolume(0) + if (Ini.PreviewFading = 0) then + Music.Play else - Music.Play; + Music.SetMusicVolume(0); end; end else -- cgit v1.2.3 From 4131257e42ceb88fa4fb2849b5c40011e8b5635d Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 8 Jun 2007 16:23:40 +0000 Subject: Added ability to delete a Playlist within the Menu Language Files updated git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@248 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlaylist.pas | 2 ++ Game/Code/Screens/UScreenSongMenu.pas | 55 ++++++++++++++++++++++++++++++----- 2 files changed, 50 insertions(+), 7 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlaylist.pas b/Game/Code/Classes/UPlaylist.pas index 55cf90ff..e3f68239 100644 --- a/Game/Code/Classes/UPlaylist.pas +++ b/Game/Code/Classes/UPlaylist.pas @@ -327,9 +327,11 @@ begin if (CatSongs.CatNumShow = -3) and (Index = CurPlaylist) then begin ScreenSong.UnLoadDetailedCover; + ScreenSong.HideCatTL; CatSongs.SetFilter('', 0); ScreenSong.Interaction := 0; ScreenSong.FixSelected; + ScreenSong.ChangeMusic; end; end; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 3814334c..06b8f183 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -27,9 +27,10 @@ const SM_Playlist_Add = 64 or 2; SM_Playlist_New = 64 or 3; - SM_Playlist_Del = 64 or 5; + SM_Playlist_DelItem = 64 or 5; SM_Playlist_Load = 64 or 8 or 1; + SM_Playlist_Del = 64 or 8 or 5; SM_Party_Main = 128 or 1; @@ -42,7 +43,7 @@ var implementation -uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist; +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist, USongs; function TScreenSongMenu.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -265,10 +266,10 @@ begin Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); end; - SM_PlayList_Del: + SM_Playlist_DelItem: begin CurMenu := sMenu; - Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_DEL'); + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_DELITEM'); Button[0].Visible := True; Button[1].Visible := False; @@ -285,12 +286,15 @@ begin CurMenu := sMenu; Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_LOAD'); - Button[0].Visible := False; + //Show Delete Curent Playlist Button when Playlist is opened + Button[0].Visible := (CatSongs.CatNumShow = -3); + Button[1].Visible := False; Button[2].Visible := False; Button[3].Visible := True; SelectsS[0].Visible := True; + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_DELCURRENT'); Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_LOAD'); SetLength(ISelections, Length(PlaylistMan.Playlists)); @@ -311,6 +315,21 @@ begin end; end; + SM_Playlist_Del: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_DEL'); + + Button[0].Visible := True; + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); + end; + SM_Party_Main: begin @@ -421,7 +440,7 @@ begin 2: //Button 3 begin //Show add to Playlist Menu - MenuShow(SM_Playlist_Del); + MenuShow(SM_Playlist_DelItem); end; 3: //SelectSlide 3 @@ -488,7 +507,7 @@ begin end; end; - SM_PlayList_Del: + SM_Playlist_DelItem: begin Visible := False; Case Interaction of @@ -509,6 +528,10 @@ begin SM_Playlist_Load: begin Case Interaction of + 0: //Button 1 (Delete Playlist) + begin + MenuShow(SM_Playlist_Del); + end; 4: //Button 4 begin //Load Playlist @@ -518,6 +541,24 @@ begin end; end; + SM_Playlist_Del: + begin + Visible := False; + Case Interaction of + 0: //Button 1 + begin + //Delete + PlayListMan.DelPlaylist(PlaylistMan.CurPlayList); + Visible := False; + end; + + 4: //Button 4 + begin + MenuShow(SM_Playlist_Load); + end; + end; + end; + SM_Party_Main: begin Case Interaction of -- cgit v1.2.3 From 56980dfdb5a44e03608689d3cd479d5c1c4a6dc4 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 8 Jun 2007 18:29:33 +0000 Subject: Party Win Screen now changes the colors of the TeamBgs automaticly when Color = TeamColor Changed Deluxe Team to fit the Changes git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@249 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenPartyWin.pas | 77 +++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas index 1c4549a4..76d0420f 100644 --- a/Game/Code/Screens/UScreenPartyWin.pas +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -93,6 +93,14 @@ procedure TScreenPartyWin.onShow; var I: Integer; Placing: TeamOrderArray; + Function GetTeamColor(Team: Byte): Cardinal; + var + NameString: String; + begin + NameString := 'P' + InttoStr(Team+1) + 'Dark'; + + Result := ColorExists(NameString); + end; begin //Get Team Placing Placing := PartySession.GetTeamOrder; @@ -110,6 +118,29 @@ begin Static[StaticTeam1].Visible := True; Static[StaticTeam1BG].Visible := True; Static[StaticTeam1Deco].Visible := True; + + //Set Static Color to Team Color + If (Theme.PartyWin.StaticTeam1BG.Color = 'TeamColor') then + begin + I := GetTeamColor(Placing[0]); + if (I <> -1) then + begin + Static[StaticTeam1BG].Texture.ColR := Color[I].RGB.R; + Static[StaticTeam1BG].Texture.ColG := Color[I].RGB.G; + Static[StaticTeam1BG].Texture.ColB := Color[I].RGB.B; + end; + end; + + If (Theme.PartyWin.StaticTeam1.Color = 'TeamColor') then + begin + I := GetTeamColor(Placing[0]); + if (I <> -1) then + begin + Static[StaticTeam1].Texture.ColR := Color[I].RGB.R; + Static[StaticTeam1].Texture.ColG := Color[I].RGB.G; + Static[StaticTeam1].Texture.ColB := Color[I].RGB.B; + end; + end; end else begin @@ -130,6 +161,29 @@ begin Static[StaticTeam2].Visible := True; Static[StaticTeam2BG].Visible := True; Static[StaticTeam2Deco].Visible := True; + + //Set Static Color to Team Color + If (Theme.PartyWin.StaticTeam2BG.Color = 'TeamColor') then + begin + I := GetTeamColor(Placing[1]); + if (I <> -1) then + begin + Static[StaticTeam2BG].Texture.ColR := Color[I].RGB.R; + Static[StaticTeam2BG].Texture.ColG := Color[I].RGB.G; + Static[StaticTeam2BG].Texture.ColB := Color[I].RGB.B; + end; + end; + + If (Theme.PartyWin.StaticTeam2.Color = 'TeamColor') then + begin + I := GetTeamColor(Placing[1]); + if (I <> -1) then + begin + Static[StaticTeam2].Texture.ColR := Color[I].RGB.R; + Static[StaticTeam2].Texture.ColG := Color[I].RGB.G; + Static[StaticTeam2].Texture.ColB := Color[I].RGB.B; + end; + end; end else begin @@ -150,6 +204,29 @@ begin Static[StaticTeam3].Visible := True; Static[StaticTeam3BG].Visible := True; Static[StaticTeam3Deco].Visible := True; + + //Set Static Color to Team Color + If (Theme.PartyWin.StaticTeam3BG.Color = 'TeamColor') then + begin + I := GetTeamColor(Placing[2]); + if (I <> -1) then + begin + Static[StaticTeam3BG].Texture.ColR := Color[I].RGB.R; + Static[StaticTeam3BG].Texture.ColG := Color[I].RGB.G; + Static[StaticTeam3BG].Texture.ColB := Color[I].RGB.B; + end; + end; + + If (Theme.PartyWin.StaticTeam3.Color = 'TeamColor') then + begin + I := GetTeamColor(Placing[2]); + if (I <> -1) then + begin + Static[StaticTeam3].Texture.ColR := Color[I].RGB.R; + Static[StaticTeam3].Texture.ColG := Color[I].RGB.G; + Static[StaticTeam3].Texture.ColB := Color[I].RGB.B; + end; + end; end else begin -- cgit v1.2.3 From 6130b0841429920015301a661e5133cfd1ed3cb3 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 8 Jun 2007 18:43:34 +0000 Subject: Fixed: Up and Down now don't leave Playlist and Search Mode anymore git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@250 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 127 +++++++++++++++++--------------------- 1 file changed, 58 insertions(+), 69 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 1a5b41b8..2ce06d7a 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -381,7 +381,6 @@ begin end else if (Mode = 1) then //PartyMode -> Show Menu begin - //Is this Right? if (Ini.PartyPopup = 1) then ScreenSongMenu.MenuShow(SM_Party_Main) else @@ -427,93 +426,83 @@ begin SDLK_DOWN: begin - if (Mode = 0) then - begin -{ if Length(Songs.Song) > 0 then begin - Music.PlayChange; - InteractNext; - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then Music.Play; - SetScroll; - end;} - - //Cat Change Hack - if Ini.Tabs_at_startup = 1 then + if (Mode = 0) then + begin + //Only Change Cat when not in Playlist or Search Mode + if (CatSongs.CatNumShow > -2) then begin - I := Interaction; - if I <= 0 then I := 1; - - while not catsongs.Song[I].Main do + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then begin - Inc (I); - if (I > high(catsongs.Song)) then - I := low(catsongs.Song); - end; + I := Interaction; + if I <= 0 then I := 1; - Interaction := I; + while not catsongs.Song[I].Main do + begin + Inc (I); + if (I > high(catsongs.Song)) then + I := low(catsongs.Song); + end; - //Show Cat in Top Left Mod - ShowCatTL (Interaction); + Interaction := I; - CatSongs.ClickCategoryButton(Interaction); - SelectNext; - FixSelected; + //Show Cat in Top Left Mod + ShowCatTL (Interaction); - //Play Music: - Music.PlayChange; - ChangeMusic; + CatSongs.ClickCategoryButton(Interaction); + SelectNext; + FixSelected; - end; + //Play Music: + Music.PlayChange; + ChangeMusic; - // - //Cat Change Hack End} - end; + end; + + // + //Cat Change Hack End} + end; + end; end; SDLK_UP: begin - if (Mode = 0) then - begin -{ if Length(Songs.Song) > 0 then begin - Music.PlayChange; - InteractPrev; - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then Music.Play; - SetScroll; - end;} - //Cat Change Hack - if Ini.Tabs_at_startup = 1 then + if (Mode = 0) then + begin + //Only Change Cat when not in Playlist or Search Mode + if (CatSongs.CatNumShow > -2) then begin - I := Interaction; - I2 := 0; - if I <= 0 then I := 1; - - while not catsongs.Song[I].Main or (I2 = 0) do + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then begin - if catsongs.Song[I].Main then - Inc(I2); - Dec (I); - if (I < low(catsongs.Song)) then - I := high(catsongs.Song); - end; + I := Interaction; + I2 := 0; + if I <= 0 then I := 1; - Interaction := I; + while not catsongs.Song[I].Main or (I2 = 0) do + begin + if catsongs.Song[I].Main then + Inc(I2); + Dec (I); + if (I < low(catsongs.Song)) then + I := high(catsongs.Song); + end; - //Show Cat in Top Left Mod - ShowCatTL (I); + Interaction := I; - CatSongs.ClickCategoryButton(I); - SelectNext; - FixSelected; + //Show Cat in Top Left Mod + ShowCatTL (I); - //Play Music: - Music.PlayChange; - ChangeMusic; + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + //Play Music: + Music.PlayChange; + ChangeMusic; + end; end; - - // - //Cat Change Hack End} - end; + //Cat Change Hack End} + end; end; SDLK_RIGHT: -- cgit v1.2.3 From 141878175d76d013be3ec8fb9fd0a58dc9b0d3eb Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 9 Jun 2007 10:10:25 +0000 Subject: Added Preview Volume and Fading to Sound Options Changed Themes to Fit these changes Updated Language Files Some fixes in SelectSlide git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@251 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 9 +++++++-- Game/Code/Menu/UMenuSelectSlide.pas | 10 +++++++--- Game/Code/Screens/UScreenOptionsSound.pas | 11 ++++++++--- 3 files changed, 22 insertions(+), 8 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 8a6a7b9b..78875dec 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -446,7 +446,9 @@ type SelectClickAssist: TThemeSelect; SelectBeatClick: TThemeSelect; SelectThreshold: TThemeSelect; - //SelectTwoPlayerMode: TThemeSelect; + //Song Preview + SelectSlidePreviewVolume: TThemeSelectSlide; + SelectSlidePreviewFading: TThemeSelectSlide; ButtonExit: TThemeButton; end; @@ -1209,7 +1211,10 @@ begin ThemeLoadSelect(OptionsSound.SelectClickAssist, 'OptionsSoundSelectClickAssist'); ThemeLoadSelect(OptionsSound.SelectBeatClick, 'OptionsSoundSelectBeatClick'); ThemeLoadSelect(OptionsSound.SelectThreshold, 'OptionsSoundSelectThreshold'); - //ThemeLoadSelect(OptionsSound.SelectTwoPlayerMode, 'OptionsSoundSelectTwoPlayerMode'); + //Song Preview + ThemeLoadSelectSlide(OptionsSound.SelectSlidePreviewVolume, 'OptionsSoundSelectSlidePreviewVolume'); + ThemeLoadSelectSlide(OptionsSound.SelectSlidePreviewFading, 'OptionsSoundSelectSlidePreviewFading'); + ThemeLoadButton(OptionsSound.ButtonExit, 'OptionsSoundButtonExit'); // Options Lyrics diff --git a/Game/Code/Menu/UMenuSelectSlide.pas b/Game/Code/Menu/UMenuSelectSlide.pas index f18b45cd..c1ccad6d 100644 --- a/Game/Code/Menu/UMenuSelectSlide.pas +++ b/Game/Code/Menu/UMenuSelectSlide.pas @@ -291,8 +291,8 @@ var maxlength: Real; I: Integer; begin - SetFontStyle(TextOpt[0].Style); - SetFontSize(TextOpt[0].Size); + SetFontStyle(0{Text.Style}); + SetFontSize(Text.Size); maxlength := 0; for I := low(TextOptT) to high (TextOptT) do @@ -329,7 +329,11 @@ begin //Generate Positions //TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * (I + 0.5); - TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * I; + if (I <> High(TextOpt)) OR (High(TextOpt) = 0) OR (Length(TextOptT) = Lines) then + TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * I + else + TextOpt[I].X := TextureSBG.X + TextureSBG.W - maxlength; + TextOpt[I].Y := TextureSBG.Y + (TextureSBG.H / 2) - 1.5 * Text.Size{20}; //Better Look with 2 Options diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index c99f1ef6..fb04ab64 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -35,7 +35,7 @@ begin end; SDLK_RETURN: begin - if SelInteraction = 4 then begin + if SelInteraction = 6 then begin Ini.Save; Music.PlayBack; FadeTo(@ScreenOptions); @@ -47,14 +47,14 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin Music.PlayOption; InteractInc; end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin Music.PlayOption; InteractDec; end; @@ -76,6 +76,11 @@ begin AddSelect(Theme.OptionsSound.SelectBeatClick, Ini.BeatClick, IBeatClick); AddSelect(Theme.OptionsSound.SelectThreshold, Ini.Threshold, IThreshold); + //Song Preview + AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewVolume, Ini.PreviewVolume, IPreviewVolume); + AddSelectSlide + (Theme.OptionsSound.SelectSlidePreviewFading, Ini.PreviewFading, IPreviewFading); + AddButton(Theme.OptionsSound.ButtonExit); if (Length(Button[0].Text)=0) then AddButtonText(14, 20, Theme.Options.Description[7]); -- cgit v1.2.3 From 155910dbe253d5c1bf8e2287c27f0d9dffefa383 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 10 Jun 2007 09:12:53 +0000 Subject: Added a workaround for EInvalidPointer Exception when a not existing Equalizer- Color is specified in Theme git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@254 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 78875dec..079ceb00 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -1002,6 +1002,11 @@ begin Song.Equalizer.ColR := Color[I].RGB.R; Song.Equalizer.ColG := Color[I].RGB.G; Song.Equalizer.ColB := Color[I].RGB.B; + end + else begin + Song.Equalizer.ColR := 0; + Song.Equalizer.ColG := 0; + Song.Equalizer.ColB := 0; end; //Load Equalizer Pos and Size from Theme Mod End -- cgit v1.2.3 From 81b634fd2e0b9a70c43e12d17d2ca25cce1a7335 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 10 Jun 2007 10:38:34 +0000 Subject: Changed LineBonus Translations to 0.5.3 compatible Texts git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@255 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 079ceb00..dbb637e4 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -1109,15 +1109,15 @@ begin ThemeLoadText(Sing.TextP3RScore, 'SingP3RTextScore'); //Line Bonus Texts - Sing.LineBonusText[0] := Language.Translate('LINEBONUS_WORST'); + Sing.LineBonusText[0] := Language.Translate('POPUP_AWFUL'); Sing.LineBonusText[1] := Sing.LineBonusText[0]; - Sing.LineBonusText[2] := Language.Translate('LINEBONUS_BAD'); - Sing.LineBonusText[3] := Language.Translate('LINEBONUS_NORMAL'); - Sing.LineBonusText[4] := Sing.LineBonusText[3]; - Sing.LineBonusText[5] := Language.Translate('LINEBONUS_GOOD'); - Sing.LineBonusText[6] := Language.Translate('LINEBONUS_BETTER'); - Sing.LineBonusText[7] := Sing.LineBonusText[6]; - Sing.LineBonusText[8] := Language.Translate('LINEBONUS_PERFECT'); + Sing.LineBonusText[2] := Language.Translate('POPUP_POOR'); + Sing.LineBonusText[3] := Language.Translate('POPUP_BAD'); + Sing.LineBonusText[4] := Language.Translate('POPUP_NOTBAD'); + Sing.LineBonusText[5] := Language.Translate('POPUP_GOOD'); + Sing.LineBonusText[6] := Language.Translate('POPUP_GREAT'); + Sing.LineBonusText[7] := Language.Translate('POPUP_AWESOME'); + Sing.LineBonusText[8] := Language.Translate('POPUP_PERFECT'); // Score ThemeLoadBasic(Score, 'Score'); -- cgit v1.2.3 From 02a59ca2d7f440a441ddf2e2b733ff5497714611 Mon Sep 17 00:00:00 2001 From: mota23 Date: Sun, 10 Jun 2007 13:15:04 +0000 Subject: Completed Player-names. F1..F12 gets Template-Name from Ini. Alt-F1..F12 writes Template-Name to Ini. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@256 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenName.pas | 137 +++++++++++++++++++++++-------- Game/Code/Screens/UScreenPartyPlayer.pas | 137 +++++++++++++++++++++++-------- 2 files changed, 202 insertions(+), 72 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index 1b90c570..0d98e944 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -22,10 +22,15 @@ uses UGraphic, UMain, UIni, UTexture; function TScreenName.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; var I: integer; +SDL_ModState: Word; begin Result := true; If (PressedDown) Then begin // Key Down + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + case PressedKey of SDLK_0..SDLK_9, SDLK_A..SDLK_Z, SDLK_SPACE, SDLK_MINUS, SDLK_EXCLAIM, SDLK_COMMA, SDLK_SLASH, SDLK_ASTERISK, SDLK_QUESTION, SDLK_QUOTE, SDLK_QUOTEDBL: begin @@ -34,53 +39,113 @@ begin // Templates for Names Mod SDLK_F1: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[0]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[0] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[0]; + end; SDLK_F2: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[1]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[1] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[1]; + end; SDLK_F3: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[2]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[2] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[2]; + end; SDLK_F4: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[3]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[3] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[3]; + end; SDLK_F5: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[4]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[4] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[4]; + end; SDLK_F6: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[5]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[5] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[5]; + end; SDLK_F7: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[6]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[6] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[6]; + end; SDLK_F8: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[7]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[7] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[7]; + end; SDLK_F9: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[8]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[8] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[8]; + end; SDLK_F10: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[9]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[9] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[9]; + end; SDLK_F11: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[10]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[10] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[10]; + end; SDLK_F12: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[11]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[11] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[11]; + end; SDLK_BACKSPACE: diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index e8607470..d6859775 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -39,6 +39,7 @@ uses UGraphic, UMain, UIni, UTexture, UParty; function TScreenPartyPlayer.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; var I, J: integer; + SDL_ModState: Word; procedure IntNext; begin repeat @@ -54,6 +55,10 @@ var begin Result := true; If (PressedDown) Then + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + begin // Key Down case PressedKey of SDLK_0..SDLK_9, SDLK_A..SDLK_Z, SDLK_SPACE, SDLK_MINUS, SDLK_EXCLAIM, SDLK_COMMA, SDLK_SLASH, SDLK_ASTERISK, SDLK_QUESTION, SDLK_QUOTE, SDLK_QUOTEDBL: @@ -63,53 +68,113 @@ begin // Templates for Names Mod SDLK_F1: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[0]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[0] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[0]; + end; SDLK_F2: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[1]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[1] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[1]; + end; SDLK_F3: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[2]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[2] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[2]; + end; SDLK_F4: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[3]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[3] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[3]; + end; SDLK_F5: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[4]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[4] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[4]; + end; SDLK_F6: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[5]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[5] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[5]; + end; SDLK_F7: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[6]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[6] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[6]; + end; SDLK_F8: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[7]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[7] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[7]; + end; SDLK_F9: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[8]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[8] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[8]; + end; SDLK_F10: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[9]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[9] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[9]; + end; SDLK_F11: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[10]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[10] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[10]; + end; SDLK_F12: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[11]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[11] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[11]; + end; SDLK_BACKSPACE: begin -- cgit v1.2.3 From 03c2049c1685ca6ec0046e422d65de1e996fc209 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 10 Jun 2007 14:40:20 +0000 Subject: Fixed a Bug in ScreenSong Equalizer that causes an Invalid Pointer Exception when US is closed. Changed Themes to fit the changes git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@258 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 2ce06d7a..87aa122e 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1533,9 +1533,10 @@ begin B:=0; Pos := 0; - Res := floor(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band + Res := ceil(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band + //Change Lengths - for I := 0 to 92 do + for I := 0 to (Res * Theme.Song.Equalizer.Bands - 1) do begin A := floor(I/Res); @@ -1589,7 +1590,7 @@ begin PosY := Theme.Song.Equalizer.Y; PosX := Theme.Song.Equalizer.X; - For I := 0 to Theme.Song.Equalizer.Bands do + For I := 0 to Theme.Song.Equalizer.Bands-1 do begin if Theme.Song.Equalizer.Direction then PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length -- cgit v1.2.3 From 5d60d0893e283cd287ffc588774cbf8d995e19f3 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 12 Jun 2007 16:55:47 +0000 Subject: Fixed a Bug in Database System thx to Pr3D@ToR git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@260 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDataBase.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDataBase.pas b/Game/Code/Classes/UDataBase.pas index 0e5a4a3f..b8b41bc1 100644 --- a/Game/Code/Classes/UDataBase.pas +++ b/Game/Code/Classes/UDataBase.pas @@ -209,7 +209,7 @@ begin //Create Query Case Typ of 0: Query := 'SELECT `Player` , `Difficulty` , `Score` , `Artist` , `Title` FROM `US_Scores` INNER JOIN `US_Songs` ON (`SongID` = `ID`) ORDER BY `Score`'; - 1: Query := 'SELECT `Player` , (Sum(`Score`) / COUNT(`Score`)) FROM `US_Scores` GROUP BY `Player` ORDER BY (Sum(`Score`) / COUNT(`Score`))'; + 1: Query := 'SELECT `Player` , ROUND (Sum(`Score`) / COUNT(`Score`)) FROM `US_Scores` GROUP BY `Player` ORDER BY (Sum(`Score`) / COUNT(`Score`))'; 2: Query := 'SELECT `Artist` , `Title` , `TimesPlayed` FROM `US_Songs` ORDER BY `TimesPlayed`'; 3: Query := 'SELECT `Artist` , Sum(`TimesPlayed`) FROM `US_Songs` GROUP BY `Artist` ORDER BY Sum(`TimesPlayed`)'; end; @@ -252,7 +252,7 @@ begin 1:begin Stats[TableData.Row].Player := TableData.Fields[0]; - Stats[TableData.Row].AverageScore := TableData.FieldAsInteger(1); + Stats[TableData.Row].AverageScore := StrtoIntDef(TableData.Fields[1], 0); end; 2:begin -- cgit v1.2.3 From 3ecabca816142dcc2b7044aa637285514a4f9b2d Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 14 Jun 2007 12:52:43 +0000 Subject: No Up/Down needed anymore in Jump to Menu Type can be changed now by pressing Left/Right while Button is Selected git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@261 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSongJumpto.pas | 60 ++++++++------------------------- 1 file changed, 14 insertions(+), 46 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 560868a5..7103257d 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -38,36 +38,6 @@ implementation uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, USongs, UScreenSong, ULog; function TScreenSongJumpto.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; - function IsVisible: Boolean; - begin - Result := True; - if (Interactions[Interaction].Typ = 0) then - begin - Result := Button[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 1) then - begin - //Result := Selects[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 3) then - begin - Result := SelectsS[Interactions[Interaction].Num].Visible; - end; - end; - - Procedure SelectNext; - begin - repeat - InteractNext; - until IsVisible; - end; - - Procedure SelectPrev; - begin - repeat - InteractPrev; - until IsVisible; - end; begin Result := true; If (PressedDown) Then @@ -109,33 +79,31 @@ begin // functions like this one, called so many times SDLK_DOWN: begin - SelectNext; - Button[0].Text[0].Selected := (Interaction = 0); + {SelectNext; + Button[0].Text[0].Selected := (Interaction = 0);} end; SDLK_UP: begin - SelectPrev; - Button[0].Text[0].Selected := (Interaction = 0); + {SelectPrev; + Button[0].Text[0].Selected := (Interaction = 0); } end; SDLK_RIGHT: begin - if (Interaction=1) then - begin - InteractInc; - if (Length(Button[0].Text[0].Text) > 0) then - SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); - end; + Interaction := 1; + InteractInc; + if (Length(Button[0].Text[0].Text) > 0) then + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + Interaction := 0; end; SDLK_LEFT: begin - if (Interaction=1) then - begin - InteractDec; - if (Length(Button[0].Text[0].Text) > 0) then - SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); - end; + Interaction := 1; + InteractDec; + if (Length(Button[0].Text[0].Text) > 0) then + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + Interaction := 0; end; end; end; -- cgit v1.2.3 From 5f45fd926da919d8057dfcca4101dc305bd230df Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 14 Jun 2007 13:08:54 +0000 Subject: Added Text Fading to ButtonCollection git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@262 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UMenu.pas | 4 ++++ Game/Code/Menu/UMenuButtonCollection.pas | 15 ++++++++++++--- Game/Code/Menu/UMenuText.pas | 4 +++- 3 files changed, 19 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index d7c919ee..309e199a 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -559,6 +559,10 @@ begin begin Interactions[High(Interactions)].Typ := iBCollectionChild; Button[Result].Visible := False; + + for BT := 0 to BTLen-1 do + Button[Result].Text[BT].Alpha := 0; + Button[Result].Parent := ThemeButton.Parent; if (ButtonCollection[ThemeButton.Parent-1].Fade) then Button[Result].Texture.Alpha := 0; diff --git a/Game/Code/Menu/UMenuButtonCollection.pas b/Game/Code/Menu/UMenuButtonCollection.pas index 66ac70fc..5c9045a7 100644 --- a/Game/Code/Menu/UMenuButtonCollection.pas +++ b/Game/Code/Menu/UMenuButtonCollection.pas @@ -36,7 +36,7 @@ begin end; procedure TButtonCollection.Draw; -var I: Integer; +var I, J: Integer; begin inherited; //If fading is activated, Fade Child Buttons @@ -46,10 +46,19 @@ begin if (ScreenButton^[I].Parent = Parent) then begin if (FadeProgress < 0.5) then - ScreenButton^[I].Visible := SelectBool + begin + ScreenButton^[I].Visible := SelectBool; + + For J := 0 to High(ScreenButton^[I].Text) do + ScreenButton^[I].Text[J].Visible := SelectBool; + end else + begin ScreenButton^[I].Texture.Alpha := (FadeProgress-0.666)*3; - //ScreenButton^[I].Text[0]. + + For J := 0 to High(ScreenButton^[I].Text) do + ScreenButton^[I].Text[J].Alpha := (FadeProgress-0.666)*3; + end; end; end; end; diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas index 69ece02f..4713962e 100644 --- a/Game/Code/Menu/UMenuText.pas +++ b/Game/Code/Menu/UMenuText.pas @@ -23,6 +23,7 @@ type ColR: real; ColG: real; ColB: real; + Alpha: real; Int: real; Style: integer; Visible: boolean; @@ -225,7 +226,7 @@ begin SetFontStyle(Style); SetFontSize(Size); SetFontItalic(False); - glColor3f(ColR*Int, ColG*Int, ColB*Int); + glColor4f(ColR*Int, ColG*Int, ColB*Int, Alpha); //If Selected Set Blink... if SelectBool then @@ -303,6 +304,7 @@ end; constructor TText.Create(ParX, ParY, ParW: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; ParTekst: string); begin inherited Create; + Alpha := 1; X := ParX; Y := ParY; W := ParW; -- cgit v1.2.3 From 077d1c500e6a90870dfa979303cd5003feffc359 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 20 Jun 2007 18:14:10 +0000 Subject: Enabled Deco Texurechanging depending on TeamPlaylings in PartyScore Screen Changed Theme to fit the Changes git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@266 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 32 ++++++++++++ Game/Code/Screens/UScreenPartyScore.pas | 87 ++++++++++++++++++++++++++++++++- 2 files changed, 117 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index dbb637e4..b55a84dc 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -587,6 +587,23 @@ type StaticTeam3BG: TThemeStatic; StaticTeam3Deco: TThemeStatic; + DecoTextures: record + ChangeTextures: Boolean; + + FirstTexture: String; + FirstTyp: String; + FirstColor: String; + + SecondTexture: String; + SecondTyp: String; + SecondColor: String; + + ThirdTexture: String; + ThirdTyp: String; + ThirdColor: String; + end; + + TextWinner: TThemeText; end; @@ -1361,6 +1378,21 @@ begin ThemeLoadStatic (PartyScore.StaticTeam3BG, 'PartyScoreStaticTeam3BG'); ThemeLoadStatic (PartyScore.StaticTeam3Deco, 'PartyScoreStaticTeam3Deco'); + //Load Party Score DecoTextures Object + PartyScore.DecoTextures.ChangeTextures := (ThemeIni.ReadInteger('PartyScoreDecoTextures', 'ChangeTextures', 0) = 1); + + PartyScore.DecoTextures.FirstTexture := ThemeIni.ReadString('PartyScoreDecoTextures', 'FirstTexture', ''); + PartyScore.DecoTextures.FirstTyp := ThemeIni.ReadString('PartyScoreDecoTextures', 'FirstTyp', 'Note Black'); + PartyScore.DecoTextures.FirstColor := ThemeIni.ReadString('PartyScoreDecoTextures', 'FirstColor', 'Black'); + + PartyScore.DecoTextures.SecondTexture := ThemeIni.ReadString('PartyScoreDecoTextures', 'SecondTexture', ''); + PartyScore.DecoTextures.SecondTyp := ThemeIni.ReadString('PartyScoreDecoTextures', 'SecondTyp', 'Note Black'); + PartyScore.DecoTextures.SecondColor := ThemeIni.ReadString('PartyScoreDecoTextures', 'SecondColor', 'Black'); + + PartyScore.DecoTextures.ThirdTexture := ThemeIni.ReadString('PartyScoreDecoTextures', 'ThirdTexture', ''); + PartyScore.DecoTextures.ThirdTyp := ThemeIni.ReadString('PartyScoreDecoTextures', 'ThirdTyp', 'Note Black'); + PartyScore.DecoTextures.ThirdColor := ThemeIni.ReadString('PartyScoreDecoTextures', 'ThirdColor', 'Black'); + ThemeLoadText (PartyScore.TextWinner, 'PartyScoreTextWinner'); //Party Win diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index 324656c0..5c632356 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -25,6 +25,11 @@ type StaticTeam3Deco: Cardinal; TextWinner: Cardinal; + DecoTex: Array[0..5] of Integer; + DecoColor: Array[0..5] of Record + R, G, B: Real; + end; + MaxScore: Word; constructor Create; override; @@ -35,7 +40,7 @@ type implementation -uses UGraphic, UMain, UParty, UScreenSingModi, ULanguage; +uses UGraphic, UMain, UParty, UScreenSingModi, ULanguage, UTexture, USkins; function TScreenPartyScore.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -75,6 +80,9 @@ end; constructor TScreenPartyScore.Create; var I: integer; + Tex: TTexture; + R, G, B: Real; + Color: Integer; begin inherited Create; @@ -97,12 +105,50 @@ begin TextWinner := AddText (Theme.PartyScore.TextWinner); + //Load Deco Textures + if Theme.PartyScore.DecoTextures.ChangeTextures then + begin + //Get Color + LoadColor(R, G, B, Theme.PartyScore.DecoTextures.FirstColor); + Color := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + DecoColor[0].R := R; + DecoColor[0].G := G; + DecoColor[0].B := B; + + //Load Texture + Tex := Texture.LoadTexture(pchar(Skin.GetTextureFileName(Theme.PartyScore.DecoTextures.FirstTexture)), 'JPG', PChar(Theme.PartyScore.DecoTextures.FirstTyp), Color); + DecoTex[0] := Tex.TexNum; + + //Get Second Color + LoadColor(R, G, B, Theme.PartyScore.DecoTextures.SecondColor); + Color := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + DecoColor[1].R := R; + DecoColor[1].G := G; + DecoColor[1].B := B; + + //Load Second Texture + Tex := Texture.LoadTexture(pchar(Skin.GetTextureFileName(Theme.PartyScore.DecoTextures.SecondTexture)), 'JPG', PChar(Theme.PartyScore.DecoTextures.SecondTyp), Color); + DecoTex[1] := Tex.TexNum; + + //Get Third Color + LoadColor(R, G, B, Theme.PartyScore.DecoTextures.ThirdColor); + Color := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + DecoColor[2].R := R; + DecoColor[2].G := G; + DecoColor[2].B := B; + + //Load Third Texture + Tex := Texture.LoadTexture(pchar(Skin.GetTextureFileName(Theme.PartyScore.DecoTextures.ThirdTexture)), 'JPG', PChar(Theme.PartyScore.DecoTextures.ThirdTyp), Color); + DecoTex[2] := Tex.TexNum; + end; + LoadFromTheme(Theme.PartyScore); end; procedure TScreenPartyScore.onShow; var - I: Integer; + I, J: Integer; + Placings: Array [0..5] of Byte; begin //Get Maxscore MaxScore := 0; @@ -112,6 +158,16 @@ begin MaxScore := ScreenSingModi.PlayerInfo.Playerinfo[I].Score; end; + //Get Placings + for I := 0 to ScreenSingModi.PlayerInfo.NumPlayers - 1 do + begin + Placings[I] := 0; + for J := 0 to ScreenSingModi.PlayerInfo.NumPlayers - 1 do + If (ScreenSingModi.PlayerInfo.Playerinfo[J].Score > ScreenSingModi.PlayerInfo.Playerinfo[I].Score) then + Inc(Placings[I]); + end; + + //Set Static Length Static[StaticTeam1].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[0].Percentage / 100; Static[StaticTeam2].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100; @@ -133,6 +189,15 @@ begin Text[TextScoreTeam1].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[0].Score); Text[TextNameTeam1].Text := String(ScreenSingModi.TeamInfo.Teaminfo[0].Name); + //Set Deco Texture + if Theme.PartyScore.DecoTextures.ChangeTextures then + begin + Static[StaticTeam1Deco].Texture.TexNum := DecoTex[Placings[0]]; + Static[StaticTeam1Deco].Texture.ColR := DecoColor[Placings[0]].R; + Static[StaticTeam1Deco].Texture.ColG := DecoColor[Placings[0]].G; + Static[StaticTeam1Deco].Texture.ColB := DecoColor[Placings[0]].B; + end; + Text[TextScoreTeam1].Visible := True; Text[TextNameTeam1].Visible := True; Static[StaticTeam1].Visible := True; @@ -153,6 +218,15 @@ begin Text[TextScoreTeam2].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[1].Score); Text[TextNameTeam2].Text := String(ScreenSingModi.TeamInfo.Teaminfo[1].Name); + //Set Deco Texture + if Theme.PartyScore.DecoTextures.ChangeTextures then + begin + Static[StaticTeam2Deco].Texture.TexNum := DecoTex[Placings[1]]; + Static[StaticTeam2Deco].Texture.ColR := DecoColor[Placings[1]].R; + Static[StaticTeam2Deco].Texture.ColG := DecoColor[Placings[1]].G; + Static[StaticTeam2Deco].Texture.ColB := DecoColor[Placings[1]].B; + end; + Text[TextScoreTeam2].Visible := True; Text[TextNameTeam2].Visible := True; Static[StaticTeam2].Visible := True; @@ -173,6 +247,15 @@ begin Text[TextScoreTeam3].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[2].Score); Text[TextNameTeam3].Text := String(ScreenSingModi.TeamInfo.Teaminfo[2].Name); + //Set Deco Texture + if Theme.PartyScore.DecoTextures.ChangeTextures then + begin + Static[StaticTeam3Deco].Texture.TexNum := DecoTex[Placings[2]]; + Static[StaticTeam3Deco].Texture.ColR := DecoColor[Placings[2]].R; + Static[StaticTeam3Deco].Texture.ColG := DecoColor[Placings[2]].G; + Static[StaticTeam3Deco].Texture.ColB := DecoColor[Placings[2]].B; + end; + Text[TextScoreTeam3].Visible := True; Text[TextNameTeam3].Visible := True; Static[StaticTeam3].Visible := True; -- cgit v1.2.3 From e0c4de18cabd3f1f27376afe389cdd4470ee198d Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 25 Jun 2007 12:24:53 +0000 Subject: Fixed wrong sentence timings (T in Editor) when last note of a sentence and first note of the next sentence overlap. Fixed 2 Bugs in Midi Converter: Notes were added more than once to txt when the save Button is pressed multiple times Notes are added more than once when open is pressed multiple time Added sentence start calculating to Midi Converter git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@267 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditConvert.pas | 30 ++++++++++++++++++++++++++++++ Game/Code/Screens/UScreenEditSub.pas | 8 ++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index 92e8544c..f1e3ba32 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -54,8 +54,10 @@ type BPM: real; Ticks: real; Nuta: array of TNuta; + procedure AddLyric(Start: integer; Tekst: string); procedure Extract; + procedure MidiFile1MidiEvent(event: PMidiEvent); function SelectedNumber: integer; constructor Create; override; @@ -192,6 +194,7 @@ var Nu: integer; NutaTemp: TNuta; Move: integer; + Max, Min: integer; begin // song info Song.Title := ''; @@ -201,6 +204,8 @@ begin SetLength(Song.BPM, 1); Song.BPM[0].BPM := BPM*4; + SetLength(Nuta, 0); + // extract notes for T := 0 to High(ATrack) do begin // if ATrack[T].Hear then begin @@ -265,6 +270,27 @@ begin SetLength(Czesc.Czesc[C].Nuta, 0); Czesc.Czesc[C].IlNut := 0; Czesc.Czesc[C].HighNut := -1; + + //Calculate Start of the Last Sentence + if (C > 0) and (Nu > 0) then + begin + Max := Nuta[Nu].Start; + Min := Nuta[Nu-1].Start + Nuta[Nu-1].Len; + + case (Max - Min) of + 0: Czesc.Czesc[C].Start := Max; + 1: Czesc.Czesc[C].Start := Max; + 2: Czesc.Czesc[C].Start := Max - 1; + 3: Czesc.Czesc[C].Start := Max - 2; + else + if ((Max - Min) > 4) then + Czesc.Czesc[C].Start := Min + 2 + else + Czesc.Czesc[C].Start := Max; + + end; // case + + end; end; // tworzy miejsce na nowa nute @@ -388,7 +414,11 @@ begin SetLength(Channel, 16); for T := 0 to 15 do + begin Channel[T].Name := IntToStr(T+1); + SetLength(Channel[T].Note, 0); + Channel[T].Status := 0; + end; for T := 0 to MidiFile.NumberOfTracks-1 do begin MidiTrack := MidiFile.GetTrack(T); diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index a0adef2c..8a5eaab8 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -730,8 +730,12 @@ begin 0: S := Max; 1: S := Max; 2: S := Max - 1; - 3..3: S := Max - 2; - 4..10000: S := Min + 2; // poczatek + 2 + 3: S := Max - 2; + else + if ((Max - Min) > 4) then + S := Min + 2 + else + S := Max; end; // case Czesci[0].Czesc[C].Start := S; -- cgit v1.2.3 From 26173c50974c12b7ca6c9302efe6bd32c555df30 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 25 Jun 2007 12:27:58 +0000 Subject: Added ability to display Videos only in full size and Backgrounds in half size. Fullsize is now the standard value for Moviesize git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@268 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 2 +- Game/Code/Classes/UIni.pas | 25 ++++++++++++++++++++----- Game/Code/SMpeg/USmpeg.pas | 2 +- 3 files changed, 22 insertions(+), 7 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 41225c0d..2575758f 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -79,7 +79,7 @@ begin glClearColor (1, 1, 1, 1); glColor4f (1, 1, 1, 1); - if (Ini.MovieSize = 0) then //HalfSize BG + if (Ini.MovieSize <= 1) then //HalfSize BG begin (* half screen + gradient *) Rec.Top := 110; // 80 diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index 528966b3..ceb3c240 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -126,7 +126,7 @@ const ISpectrum: array[0..1] of string = ('Off', 'On'); ISpectrograph: array[0..1] of string = ('Off', 'On'); - IMovieSize: array[0..1] of string = ('Half', 'Full'); + IMovieSize: array[0..2] of string = ('Half', 'Full [Vid]', 'Full [BG+Vid]'); IMicBoost: array[0..3] of string = ('Off', '+6dB', '+12dB', '+18dB'); IClickAssist: array[0..1] of string = ('Off', 'On'); @@ -173,10 +173,10 @@ var Modes: PPSDL_Rect; SR: TSearchRec; //Skin List Patch -function GetFileName (S: String):String; + function GetFileName (S: String):String; begin //Result := copy (S,0,StrRScan (PChar(S),char('.'))+1); - Result := copy (S,0,Pos ('.ini',S)-1); + Result := copy (S,0,Pos ('.ini',S)-1); end; begin @@ -293,7 +293,7 @@ begin if Tekst = ISpectrograph[Pet] then Ini.Spectrograph := Pet; // MovieSize - Tekst := IniFile.ReadString('Graphics', 'MovieSize', IMovieSize[0]); + Tekst := IniFile.ReadString('Graphics', 'MovieSize', IMovieSize[2]); for Pet := 0 to High(IMovieSize) do if Tekst = IMovieSize[Pet] then Ini.MovieSize := Pet; @@ -349,12 +349,25 @@ begin // Theme //Theme List Patch + + //I2 Saves the no of the Deluxe (Standard-) Theme + I2 := 0; + //I counts is the cur. Theme no + I := 0; + SetLength(ITheme, 0); FindFirst('Themes\*.ini',faAnyFile,SR); Repeat + //Read Themename from Theme ThemeIni := TMemIniFile.Create(SR.Name); Tekst := UpperCase(ThemeIni.ReadString('Theme','Name',GetFileName(SR.Name))); ThemeIni.Free; + + //if Deluxe Theme then save Themeno to I2 + if (Tekst = 'DELUXE') then + I2 := I; + + //Search for Skins for this Theme for Pet := low(Skin.Skin) to high(Skin.Skin) do begin if UpperCase(Skin.Skin[Pet].Theme) = Tekst then @@ -364,6 +377,8 @@ begin break; end; end; + + Inc(I); Until FindNext(SR) <> 0; FindClose(SR); //Theme List Patch End } @@ -375,7 +390,7 @@ begin end; - Tekst := IniFile.ReadString('Themes', 'Theme', ITheme[0]); + Tekst := IniFile.ReadString('Themes', 'Theme', ITheme[I2]); Ini.Theme := 0; for Pet := 0 to High(ITheme) do if Uppercase(Tekst) = Uppercase(ITheme[Pet]) then Ini.Theme := Pet; diff --git a/Game/Code/SMpeg/USmpeg.pas b/Game/Code/SMpeg/USmpeg.pas index 85f3f988..317b04bb 100644 --- a/Game/Code/SMpeg/USmpeg.pas +++ b/Game/Code/SMpeg/USmpeg.pas @@ -253,7 +253,7 @@ begin TexT := 110 / 600 * (textures.movie_height / 1024{512}); TexB := 490 / 600 * (textures.movie_height / 1024{512}); - if Ini.MovieSize = 1 then begin + if Ini.MovieSize >= 1 then begin // full screen size CropT := 0; CropB := 600; -- cgit v1.2.3 From 139918027ecdd4a1b149722eea7b578579b993f1 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 25 Jun 2007 16:44:07 +0000 Subject: Fixed a Bug in Editor. When a Song with Cover was edited and after a song without was loaded and saved, the cover from the first song was written to the second song git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@269 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UFiles.pas | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index 5214a9b3..e6982a1a 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -116,6 +116,7 @@ begin //Additional Information Song.Background := ''; + Song.Cover := ''; Song.Video := ''; Song.VideoGAP := 0; Song.NotesGAP := 0; @@ -734,10 +735,10 @@ begin if Song.Edition <> 'Unknown' then WriteLn(SongFile, '#EDITION:' + Song.Edition); if Song.Genre <> 'Unknown' then WriteLn(SongFile, '#GENRE:' + Song.Genre); if Song.Language <> 'Unknown' then WriteLn(SongFile, '#LANGUAGE:' + Song.Language); - if Song.Cover <> '' then WriteLn(SongFile, '#COVER:' + Song.Cover); WriteLn(SongFile, '#MP3:' + Song.Mp3); + if Song.Cover <> '' then WriteLn(SongFile, '#COVER:' + Song.Cover); if Song.Background <> '' then WriteLn(SongFile, '#BACKGROUND:' + Song.Background); if Song.Video <> '' then WriteLn(SongFile, '#VIDEO:' + Song.Video); if Song.VideoGAP <> 0 then WriteLn(SongFile, '#VIDEOGAP:' + FloatToStr(Song.VideoGAP)); -- cgit v1.2.3 From 1d20a6ed1de519a7167c3b53fee7f2484f2f22b1 Mon Sep 17 00:00:00 2001 From: b1indy Date: Tue, 26 Jun 2007 14:11:20 +0000 Subject: Added support for transparency in PNG images - if a PNG with transparency is loaded as 'Transparent' texture type, then the alpha-channel is set according to the transparency information in the file git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@270 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 0eae68a2..da603ec9 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -193,6 +193,10 @@ var TextureB: TBitmap; TextureJ: TJPEGImage; TexturePNG: TPNGObject; + TextureAlpha: array of byte; + AlphaPtr: PByte; + TransparentColor: TColor; + PixelColor: TColor; Pet: integer; Pet2: integer; @@ -246,6 +250,27 @@ begin Exit; end; TextureB.Assign(TexturePNG); + // transparent png hack start (part 1 of 2) + if (Typ = 'Transparent') and (TexturePNG.TransparencyMode = ptmPartial) then + begin + setlength(TextureAlpha, TextureB.Width*TextureB.Height); + if (TexturePNG.Header.ColorType = COLOR_GRAYSCALEALPHA) or + (TexturePNG.Header.ColorType = COLOR_RGBALPHA) then + begin + // i would have preferred english variables here but i use Pet because i'm lazy + for Pet := 0 to TextureB.Height - 1 do + begin + AlphaPtr := PByte(TexturePNG.AlphaScanline[Pet]); + for Pet2 := 0 to TextureB.Width - 1 do + begin + TextureAlpha[Pet*TextureB.Width+Pet2]:= AlphaPtr^; + Inc(AlphaPtr); + end; + end; + end; + end else + setlength(TextureAlpha,0); // just no special transparency for unimplemented transparency types (ptmBit) + // transparent png hack end TexturePNG.Free; end; @@ -357,11 +382,13 @@ begin TexNewH := Round(Power(2, Ceil(Log2(TexOrygH)))); TextureB.Width := TexNewW; TextureB.Height := TexNewH; + // kopiowanie for Pet := 0 to TexOrygH-1 do begin for Pet2 := 0 to TexOrygW-1 do begin Pix := TextureB.Canvas.Pixels[Pet2, Pet]; - if ((Pix = $fefefe) or (Pix = Col)) then begin //Small fix, that caused artefacts to be drawn (#fe == dec254) + // ,- part of transparent png hack + if ((Pix = $fefefe) or (Pix = Col)) and (length(TextureAlpha)=0) then begin //Small fix, that caused artefacts to be drawn (#fe == dec254) TextureD32[Pet*TexNewW + Pet2 + 1, 1] := 0; TextureD32[Pet*TexNewW + Pet2 + 1, 2] := 0; TextureD32[Pet*TexNewW + Pet2 + 1, 3] := 0; @@ -370,7 +397,12 @@ begin TextureD32[Pet*TexNewW + Pet2+1, 1] := Pix; TextureD32[Pet*TexNewW + Pet2+1, 2] := Pix div 256; TextureD32[Pet*TexNewW + Pet2+1, 3] := Pix div (256*256); - TextureD32[Pet*TexNewW + Pet2+1, 4] := 255; + // transparent png hack start (part 2 of 2) + if (Format = 'PNG') and (length(TextureAlpha) <> 0) then begin + TextureD32[Pet*TexNewW+Pet2+1,4]:=TextureAlpha[Pet*TexOrygW+Pet2]; + end else + // transparent png hack end + TextureD32[Pet*TexNewW + Pet2+1, 4] := 255; end; end; end; -- cgit v1.2.3 From 7050f9d54fc4603a952c12efbab2e3331413865f Mon Sep 17 00:00:00 2001 From: b1indy Date: Tue, 3 Jul 2007 08:37:09 +0000 Subject: some tweaking of transparency handling for PNGs to make it look more as expected git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@272 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index da603ec9..275f0748 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -206,6 +206,7 @@ var TempA: integer; Error: integer; SkipX: integer; + myAlpha: Real; begin Log.BenchmarkStart(4); Mipmapping := true; @@ -399,7 +400,16 @@ begin TextureD32[Pet*TexNewW + Pet2+1, 3] := Pix div (256*256); // transparent png hack start (part 2 of 2) if (Format = 'PNG') and (length(TextureAlpha) <> 0) then begin - TextureD32[Pet*TexNewW+Pet2+1,4]:=TextureAlpha[Pet*TexOrygW+Pet2]; + myAlpha:=TextureAlpha[Pet*TexOrygW+Pet2]; + + // the following calculations tweak transparency so that it really looks transparent + myAlpha:=myAlpha-75; + if myAlpha < 0 then myAlpha:=0; + myAlpha:=myAlpha/180; + myAlpha:=myAlpha*myAlpha*myAlpha; + myAlpha:=myAlpha*255; + + TextureD32[Pet*TexNewW+Pet2+1,4]:=floor(myAlpha); end else // transparent png hack end TextureD32[Pet*TexNewW + Pet2+1, 4] := 255; -- cgit v1.2.3 From dce08a8771098ac1a56dd4548202454ab268e951 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 3 Jul 2007 14:56:15 +0000 Subject: Fixed a bug in EditorSub that causes a crash when the last note of a sentence was deleted. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@273 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditSub.pas | 53 ++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 12 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 8a5eaab8..9e84462d 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -882,20 +882,49 @@ var begin C := Czesci[0].Akt; - // we copy all notes from the next to the selected one - for N := AktNuta+1 to Czesci[0].Czesc[C].HighNut do begin - Czesci[0].Czesc[C].Nuta[N-1] := Czesci[0].Czesc[C].Nuta[N]; - end; - - NLen := Czesci[0].Czesc[C].IlNut - 1; - SetLength(Czesci[0].Czesc[C].Nuta, NLen); - Dec(Czesci[0].Czesc[C].HighNut); - Dec(Czesci[0].Czesc[C].IlNut); + //Do Not delete Last Note + if (Czesci[0].High > 0) OR (Czesci[0].Czesc[C].HighNut > 0) then + begin + // we copy all notes from the next to the selected one + for N := AktNuta+1 to Czesci[0].Czesc[C].HighNut do begin + Czesci[0].Czesc[C].Nuta[N-1] := Czesci[0].Czesc[C].Nuta[N]; + end; - // me slightly modify new note - if AktNuta > Czesci[0].Czesc[C].HighNut then Dec(AktNuta); - Czesci[0].Czesc[C].Nuta[AktNuta].Color := 1; + NLen := Czesci[0].Czesc[C].IlNut - 1; + + if (NLen > 0) then + begin + SetLength(Czesci[0].Czesc[C].Nuta, NLen); + Dec(Czesci[0].Czesc[C].HighNut); + Dec(Czesci[0].Czesc[C].IlNut); + + + // me slightly modify new note + if AktNuta > Czesci[0].Czesc[C].HighNut then Dec(AktNuta); + Czesci[0].Czesc[C].Nuta[AktNuta].Color := 1; + end + //Last Note of current Sentence Deleted - > Delete Sentence + else + begin + //Move all Sentences after the current to the Left + for N := C+1 to Czesci[0].High do + Czesci[0].Czesc[N-1] := Czesci[0].Czesc[N]; + + //Delete Last Sentence + SetLength(Czesci[0].Czesc, Czesci[0].High); + Czesci[0].High := High(Czesci[0].Czesc); + Czesci[0].Ilosc := Length(Czesci[0].Czesc); + + AktNuta := 0; + if (C > 0) then + Czesci[0].Akt := C - 1 + else + Czesci[0].Akt := 0; + + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; + end; + end; end; procedure TScreenEditSub.TransposeNote(Transpose: integer); -- cgit v1.2.3 From dd3cc6f8e84f03f626a88741474412d36e4d18ac Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 8 Jul 2007 12:00:15 +0000 Subject: Improved Error Logging and Benchmark: Write US Version, date and time to files. Added better Commandline Parameter Interpreter: More than one parameter can be used at the same time Many new, useful farameters: e.g. No error logging, Resolution change, FullScreen, DualScreen Mode, other Config File, other Score File and SongPath git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@274 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 4 +- Game/Code/Classes/UGraphic.pas | 31 +++-- Game/Code/Classes/UIni.pas | 289 ++++++++++++++++++++++------------------- Game/Code/Classes/ULog.pas | 68 +++++----- Game/Code/Classes/UMain.pas | 4 +- Game/Code/Menu/UDisplay.pas | 4 +- Game/Code/UltraStar.dpr | 24 +++- 7 files changed, 237 insertions(+), 187 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 2575758f..077f5121 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -153,8 +153,8 @@ var begin; // Log.LogStatus('Oscilloscope', 'SingDraw'); glColor3f(Skin_OscR, Skin_OscG, Skin_OscB); - if (ParamStr(1) = '-black') or (ParamStr(1) = '-fsblack') then - glColor3f(1, 1, 1); + {if (ParamStr(1) = '-black') or (ParamStr(1) = '-fsblack') then + glColor3f(1, 1, 1); } glBegin(GL_LINE_STRIP); glVertex2f(X, -Sound[NrSound].BufferArray[1] / $10000 * H + Y + H/2); diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 205fa9fd..cf1a0c5a 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -178,7 +178,7 @@ procedure LoadScreens; implementation -uses UMain, UIni, UDisplay, Graphics, Classes, Windows; +uses UMain, UIni, UDisplay, UCommandLine, Graphics, Classes, Windows; procedure LoadTextures; var @@ -332,8 +332,12 @@ var S: string; I: integer; W, H: integer; + Depth: Integer; begin - Screens := Ini.Screens + 1; + if (Params.Screens <> -1) then + Screens := Params.Screens + 1 + else + Screens := Ini.Screens + 1; SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); @@ -341,28 +345,39 @@ begin SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - S := IResolution[Ini.Resolution]; + // If there is a resolution in Parameters, use it, else use the Ini value + I := Params.Resolution; + if (I <> -1) then + S := IResolution[I] + else + S := IResolution[Ini.Resolution]; + I := Pos('x', S); W := StrToInt(Copy(S, 1, I-1)) * Screens; H := StrToInt(Copy(S, I+1, 1000)); - if ParamStr(1) = '-fsblack' then begin + {if ParamStr(1) = '-fsblack' then begin W := 800; H := 600; end; if ParamStr(1) = '-320x240' then begin W := 320; H := 240; - end; + end; } + + If (Params.Depth <> -1) then + Depth := Params.Depth + else + Depth := Ini.Depth; Log.LogStatus('SDL_SetVideoMode', 'Initialize3D'); // SDL_SetRefreshrate(85); // SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); - if (Ini.FullScreen = 0) and (ParamStr(1) <> '-fsblack') then - screen := SDL_SetVideoMode(W, H, (Ini.Depth+1) * 16, SDL_OPENGL) + if (Ini.FullScreen = 0) and (Not Params.FullScreen) then + screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL) else begin - screen := SDL_SetVideoMode(W, H, (Ini.Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN); + screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN); SDL_ShowCursor(0); end; if (screen = nil) then begin diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index ceb3c240..846c0deb 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -11,6 +11,9 @@ type NameTeam: array[0..2] of string; NameTemplate: array[0..11] of string; + //Filename of the opened iniFile + Filename: string; + // Game Players: integer; Difficulty: integer; @@ -159,7 +162,7 @@ const IChannel: array[0..6] of string = ('0', '1', '2', '3', '4', '5', '6'); implementation -uses UFiles, SDL, ULanguage, USkins, URecord; +uses UFiles, SDL, ULanguage, USkins, URecord, UCommandLine; procedure TIni.Load; var @@ -181,7 +184,16 @@ var begin GamePath := ExtractFilePath(ParamStr(0)); - IniFile := TMemIniFile.Create(GamePath + 'config.ini'); + + if (Params.ConfigFile <> '') then + try + IniFile := TMemIniFile.Create(Params.ConfigFile); + except + IniFile := TMemIniFile.Create(GamePath + 'config.ini'); + end + else + IniFile := TMemIniFile.Create(GamePath + 'config.ini'); + // Name for I := 0 to 11 do @@ -516,9 +528,12 @@ begin // SongPath - SongPath := IncludeTrailingPathDelimiter(IniFile.ReadString('Path', 'Songs', SongPath)); - + if (Params.SongPath <> '') then + SongPath := IncludeTrailingPathDelimiter(Params.SongPath) + else + SongPath := IncludeTrailingPathDelimiter(IniFile.ReadString('Path', 'Songs', SongPath)); + Filename := IniFile.FileName; IniFile.Free; end; @@ -529,176 +544,178 @@ var I: Integer; S: String; begin - if not (FileExists(GamePath + 'config.ini') and FileIsReadOnly(GamePath + 'config.ini')) then begin - IniFile := TIniFile.Create(GamePath + 'config.ini'); + //if not (FileExists(GamePath + 'config.ini') and FileIsReadOnly(GamePath + 'config.ini')) then begin + if not (FileExists(Filename) and FileIsReadOnly(Filename)) then begin - // Players - Tekst := IPlayers[Ini.Players]; - IniFile.WriteString('Game', 'Players', Tekst); + IniFile := TIniFile.Create(Filename); - // Difficulty - Tekst := IDifficulty[Ini.Difficulty]; - IniFile.WriteString('Game', 'Difficulty', Tekst); + // Players + Tekst := IPlayers[Ini.Players]; + IniFile.WriteString('Game', 'Players', Tekst); - // Language - Tekst := ILanguage[Ini.Language]; - IniFile.WriteString('Game', 'Language', Tekst); + // Difficulty + Tekst := IDifficulty[Ini.Difficulty]; + IniFile.WriteString('Game', 'Difficulty', Tekst); - // Tabs - Tekst := ITabs[Ini.Tabs]; - IniFile.WriteString('Game', 'Tabs', Tekst); + // Language + Tekst := ILanguage[Ini.Language]; + IniFile.WriteString('Game', 'Language', Tekst); - // Sorting - Tekst := ISorting[Ini.Sorting]; - IniFile.WriteString('Game', 'Sorting', Tekst); + // Tabs + Tekst := ITabs[Ini.Tabs]; + IniFile.WriteString('Game', 'Tabs', Tekst); - // Debug - Tekst := IDebug[Ini.Debug]; - IniFile.WriteString('Game', 'Debug', Tekst); + // Sorting + Tekst := ISorting[Ini.Sorting]; + IniFile.WriteString('Game', 'Sorting', Tekst); - // Screens - Tekst := IScreens[Ini.Screens]; - IniFile.WriteString('Graphics', 'Screens', Tekst); + // Debug + Tekst := IDebug[Ini.Debug]; + IniFile.WriteString('Game', 'Debug', Tekst); - // FullScreen - Tekst := IFullScreen[Ini.FullScreen]; - IniFile.WriteString('Graphics', 'FullScreen', Tekst); + // Screens + Tekst := IScreens[Ini.Screens]; + IniFile.WriteString('Graphics', 'Screens', Tekst); - // Resolution - Tekst := IResolution[Ini.Resolution]; - IniFile.WriteString('Graphics', 'Resolution', Tekst); + // FullScreen + Tekst := IFullScreen[Ini.FullScreen]; + IniFile.WriteString('Graphics', 'FullScreen', Tekst); - // Depth - Tekst := IDepth[Ini.Depth]; - IniFile.WriteString('Graphics', 'Depth', Tekst); + // Resolution + Tekst := IResolution[Ini.Resolution]; + IniFile.WriteString('Graphics', 'Resolution', Tekst); - // Resolution - Tekst := ITextureSize[Ini.TextureSize]; - IniFile.WriteString('Graphics', 'TextureSize', Tekst); + // Depth + Tekst := IDepth[Ini.Depth]; + IniFile.WriteString('Graphics', 'Depth', Tekst); - // Sing Window - Tekst := ISingWindow[Ini.SingWindow]; - IniFile.WriteString('Graphics', 'SingWindow', Tekst); + // Resolution + Tekst := ITextureSize[Ini.TextureSize]; + IniFile.WriteString('Graphics', 'TextureSize', Tekst); - // Oscilloscope - Tekst := IOscilloscope[Ini.Oscilloscope]; - IniFile.WriteString('Graphics', 'Oscilloscope', Tekst); + // Sing Window + Tekst := ISingWindow[Ini.SingWindow]; + IniFile.WriteString('Graphics', 'SingWindow', Tekst); - // Spectrum - Tekst := ISpectrum[Ini.Spectrum]; - IniFile.WriteString('Graphics', 'Spectrum', Tekst); + // Oscilloscope + Tekst := IOscilloscope[Ini.Oscilloscope]; + IniFile.WriteString('Graphics', 'Oscilloscope', Tekst); - // Spectrograph - Tekst := ISpectrograph[Ini.Spectrograph]; - IniFile.WriteString('Graphics', 'Spectrograph', Tekst); + // Spectrum + Tekst := ISpectrum[Ini.Spectrum]; + IniFile.WriteString('Graphics', 'Spectrum', Tekst); - // Movie Size - Tekst := IMovieSize[Ini.MovieSize]; - IniFile.WriteString('Graphics', 'MovieSize', Tekst); + // Spectrograph + Tekst := ISpectrograph[Ini.Spectrograph]; + IniFile.WriteString('Graphics', 'Spectrograph', Tekst); - // MicBoost - Tekst := IMicBoost[Ini.MicBoost]; - IniFile.WriteString('Sound', 'MicBoost', Tekst); + // Movie Size + Tekst := IMovieSize[Ini.MovieSize]; + IniFile.WriteString('Graphics', 'MovieSize', Tekst); - // ClickAssist - Tekst := IClickAssist[Ini.ClickAssist]; - IniFile.WriteString('Sound', 'ClickAssist', Tekst); + // MicBoost + Tekst := IMicBoost[Ini.MicBoost]; + IniFile.WriteString('Sound', 'MicBoost', Tekst); - // BeatClick - Tekst := IBeatClick[Ini.BeatClick]; - IniFile.WriteString('Sound', 'BeatClick', Tekst); + // ClickAssist + Tekst := IClickAssist[Ini.ClickAssist]; + IniFile.WriteString('Sound', 'ClickAssist', Tekst); - // Threshold - Tekst := IThreshold[Ini.Threshold]; - IniFile.WriteString('Sound', 'Threshold', Tekst); + // BeatClick + Tekst := IBeatClick[Ini.BeatClick]; + IniFile.WriteString('Sound', 'BeatClick', Tekst); - // Song Preview - Tekst := IPreviewVolume[Ini.PreviewVolume]; - IniFile.WriteString('Sound', 'PreviewVolume', Tekst); + // Threshold + Tekst := IThreshold[Ini.Threshold]; + IniFile.WriteString('Sound', 'Threshold', Tekst); - Tekst := IPreviewFading[Ini.PreviewFading]; - IniFile.WriteString('Sound', 'PreviewFading', Tekst); + // Song Preview + Tekst := IPreviewVolume[Ini.PreviewVolume]; + IniFile.WriteString('Sound', 'PreviewVolume', Tekst); - // SavePlayback - Tekst := ISavePlayback[Ini.SavePlayback]; - IniFile.WriteString('Sound', 'SavePlayback', Tekst); + Tekst := IPreviewFading[Ini.PreviewFading]; + IniFile.WriteString('Sound', 'PreviewFading', Tekst); - // Lyrics Font - Tekst := ILyricsFont[Ini.LyricsFont]; - IniFile.WriteString('Lyrics', 'LyricsFont', Tekst); + // SavePlayback + Tekst := ISavePlayback[Ini.SavePlayback]; + IniFile.WriteString('Sound', 'SavePlayback', Tekst); - // Lyrics Effect - Tekst := ILyricsEffect[Ini.LyricsEffect]; - IniFile.WriteString('Lyrics', 'LyricsEffect', Tekst); + // Lyrics Font + Tekst := ILyricsFont[Ini.LyricsFont]; + IniFile.WriteString('Lyrics', 'LyricsFont', Tekst); - // Solmization - Tekst := ISolmization[Ini.Solmization]; - IniFile.WriteString('Lyrics', 'Solmization', Tekst); + // Lyrics Effect + Tekst := ILyricsEffect[Ini.LyricsEffect]; + IniFile.WriteString('Lyrics', 'LyricsEffect', Tekst); - // Theme - Tekst := ITheme[Ini.Theme]; - IniFile.WriteString('Themes', 'Theme', Tekst); + // Solmization + Tekst := ISolmization[Ini.Solmization]; + IniFile.WriteString('Lyrics', 'Solmization', Tekst); - // Skin - Tekst := ISkin[Ini.SkinNo]; - IniFile.WriteString('Themes', 'Skin', Tekst); + // Theme + Tekst := ITheme[Ini.Theme]; + IniFile.WriteString('Themes', 'Theme', Tekst); - // Color - Tekst := IColor[Ini.Color]; - IniFile.WriteString('Themes', 'Color', Tekst); + // Skin + Tekst := ISkin[Ini.SkinNo]; + IniFile.WriteString('Themes', 'Skin', Tekst); - // Record - for I := 0 to High(CardList) do begin - S := IntToStr(I+1); + // Color + Tekst := IColor[Ini.Color]; + IniFile.WriteString('Themes', 'Color', Tekst); - Tekst := CardList[I].Name; - IniFile.WriteString('Record', 'DeviceName' + S, Tekst); + // Record + for I := 0 to High(CardList) do begin + S := IntToStr(I+1); - Tekst := IntToStr(CardList[I].Input); - IniFile.WriteString('Record', 'Input' + S, Tekst); + Tekst := CardList[I].Name; + IniFile.WriteString('Record', 'DeviceName' + S, Tekst); - Tekst := IntToStr(CardList[I].ChannelL); - IniFile.WriteString('Record', 'ChannelL' + S, Tekst); + Tekst := IntToStr(CardList[I].Input); + IniFile.WriteString('Record', 'Input' + S, Tekst); - Tekst := IntToStr(CardList[I].ChannelR); - IniFile.WriteString('Record', 'ChannelR' + S, Tekst); - end; + Tekst := IntToStr(CardList[I].ChannelL); + IniFile.WriteString('Record', 'ChannelL' + S, Tekst); - //Log.LogError(InttoStr(Length(CardList)) + ' Cards Saved'); + Tekst := IntToStr(CardList[I].ChannelR); + IniFile.WriteString('Record', 'ChannelR' + S, Tekst); + end; - //Advanced Settings + //Log.LogError(InttoStr(Length(CardList)) + ' Cards Saved'); - //LoadAnimation - Tekst := ILoadAnimation[Ini.LoadAnimation]; - IniFile.WriteString('Advanced', 'LoadAnimation', Tekst); + //Advanced Settings - //EffectSing - Tekst := IEffectSing[Ini.EffectSing]; - IniFile.WriteString('Advanced', 'EffectSing', Tekst); + //LoadAnimation + Tekst := ILoadAnimation[Ini.LoadAnimation]; + IniFile.WriteString('Advanced', 'LoadAnimation', Tekst); - //ScreenFade - Tekst := IScreenFade[Ini.ScreenFade]; - IniFile.WriteString('Advanced', 'ScreenFade', Tekst); + //EffectSing + Tekst := IEffectSing[Ini.EffectSing]; + IniFile.WriteString('Advanced', 'EffectSing', Tekst); - //AskbeforeDel - Tekst := IAskbeforeDel[Ini.AskbeforeDel]; - IniFile.WriteString('Advanced', 'AskbeforeDel', Tekst); + //ScreenFade + Tekst := IScreenFade[Ini.ScreenFade]; + IniFile.WriteString('Advanced', 'ScreenFade', Tekst); - //OnSongClick - Tekst := IOnSongClick[Ini.OnSongClick]; - IniFile.WriteString('Advanced', 'OnSongClick', Tekst); + //AskbeforeDel + Tekst := IAskbeforeDel[Ini.AskbeforeDel]; + IniFile.WriteString('Advanced', 'AskbeforeDel', Tekst); - //Line Bonus - Tekst := ILineBonus[Ini.LineBonus]; - IniFile.WriteString('Advanced', 'LineBonus', Tekst); + //OnSongClick + Tekst := IOnSongClick[Ini.OnSongClick]; + IniFile.WriteString('Advanced', 'OnSongClick', Tekst); - //Party Popup - Tekst := IPartyPopup[Ini.PartyPopup]; - IniFile.WriteString('Advanced', 'PartyPopup', Tekst); + //Line Bonus + Tekst := ILineBonus[Ini.LineBonus]; + IniFile.WriteString('Advanced', 'LineBonus', Tekst); - // Joypad - Tekst := IJoypad[Ini.Joypad]; - IniFile.WriteString('Controller', 'Joypad', Tekst); + //Party Popup + Tekst := IPartyPopup[Ini.PartyPopup]; + IniFile.WriteString('Advanced', 'PartyPopup', Tekst); + + // Joypad + Tekst := IJoypad[Ini.Joypad]; + IniFile.WriteString('Controller', 'Joypad', Tekst); IniFile.Free; end; @@ -709,8 +726,10 @@ var IniFile: TIniFile; I: integer; begin - if not FileIsReadOnly(GamePath + 'config.ini') then begin - IniFile := TIniFile.Create(GamePath + 'config.ini'); + //if not FileIsReadOnly(GamePath + 'config.ini') then begin + //IniFile := TIniFile.Create(GamePath + 'config.ini'); + if not FileIsReadOnly(Filename) then begin + IniFile := TIniFile.Create(Filename); //Name // Templates for Names Mod @@ -730,8 +749,10 @@ var IniFile: TIniFile; I: integer; begin - if not FileIsReadOnly(GamePath + 'config.ini') then begin - IniFile := TIniFile.Create(GamePath + 'config.ini'); + //if not FileIsReadOnly(GamePath + 'config.ini') then begin + //IniFile := TIniFile.Create(GamePath + 'config.ini'); + if not FileIsReadOnly(Filename) then begin + IniFile := TIniFile.Create(Filename); // Difficulty IniFile.WriteString('Game', 'Difficulty', IDifficulty[Ini.Difficulty]); diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index 59e25954..9d20d2f1 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -11,13 +11,14 @@ type FileBenchmark: TextFile; FileBenchmarkO: boolean; // opened - FileAnalyze: TextFile; - FileAnalyzeO: boolean; // opened FileError: TextFile; FileErrorO: boolean; // opened Title: String; //Application Title + //Should Log Files be written + Enabled: Boolean; + // destuctor destructor Free; @@ -26,9 +27,6 @@ type procedure BenchmarkEnd(Number: integer); procedure LogBenchmark(Text: string; Number: integer); - // analyze - procedure LogAnalyze(Text: string); - // error procedure LogError(Text: string); overload; @@ -47,7 +45,7 @@ var Log: TLog; implementation -uses UFiles, SysUtils, DateUtils, URecord, UTime, UIni, Windows; +uses UFiles, SysUtils, DateUtils, URecord, UTime, UIni, Windows, UCommandLine; destructor TLog.Free; begin @@ -78,7 +76,7 @@ var ValueText: string; begin - if (ParamStr(1) = '-benchmark') then begin + if Enabled AND (Params.Benchmark) then begin if not FileBenchmarkO then begin FileBenchmarkO := true; AssignFile(FileBenchmark, LogPath + 'Benchmark.log'); @@ -86,6 +84,16 @@ begin Rewrite(FileBenchmark); if IOResult = 0 then FileBenchmarkO := true; {$I+} + + //If File is opened write Date to Benchmark File + If (FileBenchmarkO) then + begin + WriteLn(FileBenchmark, Title + ' Benchmark File'); + WriteLn(FileBenchmark, 'Date: ' + DatetoStr(Now) + ' Time: ' + TimetoStr(Now)); + WriteLn(FileBenchmark, '-------------------'); + + Flush(FileBenchmark); + end; end; if FileBenchmarkO then begin @@ -133,44 +141,34 @@ begin end; end; -procedure TLog.LogAnalyze(Text: string); -var - Seconds: integer; - Miliseconds: integer; - ValueText: string; -begin - //if Ini.Debug = 1 then begin - - if not FileAnalyzeO then begin - AssignFile(FileAnalyze, LogPath + 'Analyze.log'); - {$I-} - Rewrite(FileAnalyze); - if IOResult = 0 then FileAnalyzeO := true; - {$I+} - end; - - if FileAnalyzeO then begin - WriteLn(FileAnalyze, Text); - Flush(FileAnalyze); // try to speed up - end; - - //end; -end; - procedure TLog.LogError(Text: string); begin - if not FileErrorO then begin + if Enabled AND (not FileErrorO) then begin FileErrorO := true; AssignFile(FileError, LogPath + 'Error.log'); {$I-} Rewrite(FileError); if IOResult = 0 then FileErrorO := true; {$I+} + + //If File is opened write Date to Error File + If (FileErrorO) then + begin + WriteLn(FileError, Title + ' Error Log'); + WriteLn(FileError, 'Date: ' + DatetoStr(Now) + ' Time: ' + TimetoStr(Now)); + WriteLn(FileError, '-------------------'); + + Flush(FileError); + end; end; if FileErrorO then begin - WriteLn(FileError, Text); - Flush(FileError); + try + WriteLn(FileError, Text); + Flush(FileError); + except + FileErrorO := false; + end; end; end; @@ -225,3 +223,5 @@ begin end; end. + + diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 3bf7d197..b47047a5 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -95,7 +95,7 @@ function GetTimeFromBeat(Beat: integer): real; procedure ClearScores(PlayerNum: integer); implementation -uses USongs, UJoystick, math; +uses USongs, UJoystick, math, UCommandLine; procedure MainLoop; var @@ -105,7 +105,7 @@ begin While not Done do Begin // joypad - if Ini.Joypad = 1 then + if (Ini.Joypad = 1) OR (Params.Joypad) then Joy.Update; // keyboard events diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index f95a73e3..223a7615 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -111,8 +111,8 @@ begin Result := True; Col := 1; - if (ParamStr(1) = '-black') or (ParamStr(1) = '-fsblack') then - Col := 0; + {if (ParamStr(1) = '-black') or (ParamStr(1) = '-fsblack') then + Col := 0; } glClearColor(Col, Col, Col , 0); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index b9687292..44899166 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -1,7 +1,6 @@ program UltraStar; {$DEFINE TRANSLATE} -//DEFINE THEMESAVE} {$R 'UltraStar.res' 'UltraStar.rc'} @@ -26,7 +25,6 @@ uses UGraphic in 'Classes\UGraphic.pas', UTexture in 'Classes\UTexture.pas', UMusic in 'Classes\UMusic.pas', - //UPliki in 'Classes\UPliki.pas', ULanguage in 'Classes\ULanguage.pas', UMain in 'Classes\UMain.pas', UDraw in 'Classes\UDraw.pas', @@ -51,6 +49,7 @@ uses UDLLManager in 'Classes\UDLLManager.pas', UParty in 'Classes\UParty.pas', UPlaylist in 'Classes\UPlaylist.pas', + UCommandLine in 'Classes\UCommandLine.pas', //------------------------------ //Includes - Screens @@ -144,9 +143,13 @@ begin //------------------------------ USTime := TTime.Create; + // Commandline Parameter Parser + Params := TCMDParams.Create; + // Log + Benchmark Log := TLog.Create; Log.Title := WndTitle; + Log.Enabled := Not Params.NoLog; Log.BenchmarkStart(0); // Language @@ -182,7 +185,13 @@ begin Log.BenchmarkStart(1); Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; Ini.Load; - Language.ChangeLanguage(ILanguage[Ini.Language]); + + //Load Languagefile + if (Params.Language <> -1) then + Language.ChangeLanguage(ILanguage[Params.Language]) + else + Language.ChangeLanguage(ILanguage[Ini.Language]); + Log.BenchmarkEnd(1); Log.LogBenchmark('Loading Ini', 1); @@ -268,7 +277,12 @@ begin Log.BenchmarkStart(1); Log.LogStatus('DataBase System', 'Initialization'); DataBase := TDataBaseSystem.Create; - DataBase.Init ('Ultrastar.db'); + + if (Params.ScoreFile = '') then + DataBase.Init ('Ultrastar.db') + else + DataBase.Init (Params.ScoreFile); + Log.BenchmarkEnd(1); Log.LogBenchmark('Loading DataBase System', 1); @@ -287,7 +301,7 @@ begin Log.LogBenchmark('Loading Particel System', 1); // Joypad - if Ini.Joypad = 1 then begin + if (Ini.Joypad = 1) OR (Params.Joypad) then begin Log.BenchmarkStart(1); Log.LogStatus('Initialize Joystick', 'Initialization'); Joy := TJoy.Create; Log.BenchmarkEnd(1); -- cgit v1.2.3 From 002bda99cfc259407bd924619302671bc5cd193a Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 8 Jul 2007 12:08:51 +0000 Subject: Fixed a bug in UDisplay that causes the game to crash on exit in Dualscreen Mode. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@275 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UDisplay.pas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index 223a7615..92693a41 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -244,7 +244,7 @@ begin - if (myfade > 40) or (not doFade) or (not canFade) then begin // fade out complete... + if ((myfade > 40) or (not doFade) or (not canFade)) And (S = 1) then begin // fade out complete... myFade:=0; ActualScreen.onHide; ActualScreen.ShowFinish:=False; @@ -256,7 +256,10 @@ begin ActualScreen.ShowFinish := true; end else + begin Result:=False; + Break; + end; // end of fade mod end; end; // if -- cgit v1.2.3 From a91908d71f4ea3b21f30f40a9e7dab09760ec1c2 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sun, 8 Jul 2007 13:11:20 +0000 Subject: added another effect (sparkling stars that fall down) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@277 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphicClasses.pas | 67 +++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphicClasses.pas b/Game/Code/Classes/UGraphicClasses.pas index e1cd8aff..5f0b0b4e 100644 --- a/Game/Code/Classes/UGraphicClasses.pas +++ b/Game/Code/Classes/UGraphicClasses.pas @@ -2,10 +2,11 @@ unit UGraphicClasses; interface +uses UTexture; const DelayBetweenFrames : Cardinal = 60; type - TParticleType=(GoldenNote, PerfectNote, NoteHitTwinkle, PerfectLineTwinkle); + TParticleType=(GoldenNote, PerfectNote, NoteHitTwinkle, PerfectLineTwinkle, ColoredStar, Flare); TColour3f = Record r, g, b: Real; @@ -52,6 +53,8 @@ type TwinkleArray : Array[0..5] of Real; // store x-position of last twinkle for every player PerfNoteArray : Array of PerfectNotePositions; + FlareTex: TTexture; + constructor Create; destructor Destroy; override; procedure Draw; @@ -76,7 +79,7 @@ type var GoldenRec : TEffectManager; implementation -uses sysutils, Windows,OpenGl12, UIni, UMain, UThemes, USkins, UGraphic, UDrawTexture, UTexture, math, dialogs; +uses sysutils, Windows,OpenGl12, UIni, UMain, UThemes, USkins, UGraphic, UDrawTexture, math, dialogs; //TParticle Constructor TParticle.Create(cX,cY: Real; cScreen: Integer; cLive: Byte; cFrame : integer; cRecArrayIndex : Integer; cStarType : TParticleType; Player: Cardinal); @@ -173,6 +176,52 @@ begin mX := RandomRange(-5,5); mY := RandomRange(-5,5); end; + ColoredStar: + begin + Tex := Tex_Note_Star.TexNum; + W := RandomRange(10,20); + H := W; + SizeMod := (-cos((Frame+1)*5*2*pi/16)*0.5+1.1); + SurviveSentenceChange:=True; + // assign colours according to player given + SetLength(Scale,1); + SetLength(Col,1); + Col[0].b := (Player and $ff)/255; + Col[0].g := ((Player shr 8) and $ff)/255; + Col[0].r := ((Player shr 16) and $ff)/255; + mX := 0; + mY := 0; + end; + Flare: + begin + Tex := Tex_Note_Star.TexNum; + W := 7; + H := 7; + SizeMod := (-cos((Frame+1)*5*2*pi/16)*0.5+1.1); + mX := RandomRange(-5,5); + mY := RandomRange(-5,5); + SetLength(Scale,4); + Scale[1]:=0.8; + Scale[2]:=0.4; + Scale[3]:=0.3; + SetLength(Col,4); + Col[0].r := 1; + Col[0].g := 0.7; + Col[0].b := 0.1; + + Col[1].r := 1; + Col[1].g := 1; + Col[1].b := 0.4; + + Col[2].r := 1; + Col[2].g := 1; + Col[2].b := 1; + + Col[3].r := 1; + Col[3].g := 1; + Col[3].b := 1; + + end; else // just some random default values begin Tex := Tex_Note_Star.TexNum; @@ -226,6 +275,20 @@ begin X := X + mX; Y := Y + mY; end; + ColoredStar: + begin + Alpha := (-cos((Frame+1)*2*pi/16)+1); // neat fade-in-and-out + end; + Flare: + begin + Alpha := (-cos((Frame+1)/16*1.7*pi+0.3*pi)+1); // neat fade-in-and-out + SizeMod := (-cos((Frame+1)*5*2*pi/16)*0.5+1.1); + // move around + X := X + mX; + Y := Y + mY; + mY:=mY+1.5; +// mX:=mX/2; + end; end; end; -- cgit v1.2.3 From 7bfc5ef4301caf4d3841c7741af5c8409fe0b175 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 8 Jul 2007 13:20:16 +0000 Subject: Add Debug OSD with FPS and RSpeed Will be extended in further Releases with some error messages git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@278 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UDisplay.pas | 73 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index 92693a41..70e678fb 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -28,6 +28,14 @@ type pTex : array[1..2] of glUInt; // end + //FPS Counter + FPSCounter: Cardinal; + LastFPS: Cardinal; + NextFPSSwap:Cardinal; + + //For Debug OSD + OSD_LastError: String; + function Draw: Boolean; procedure PrintScreen; constructor Create; @@ -35,6 +43,8 @@ type destructor Destroy; // end procedure ScreenShot; + + procedure DrawDebugInformation; end; var @@ -42,7 +52,7 @@ var implementation -uses UGraphic, UTime, Graphics, Jpeg, UFiles, UTexture, UIni; +uses UGraphic, UTime, Graphics, Jpeg, UFiles, UTexture, UIni, TextGL, UCommandLine; constructor TDisplay.Create; var i: integer; @@ -86,6 +96,9 @@ begin end; FreeMem(pTexData); // end + + //Set LastError for OSD to No Error + OSD_LastError := 'No Errors'; end; // fade mod @@ -243,7 +256,6 @@ begin NextScreen.OnShow; - if ((myfade > 40) or (not doFade) or (not canFade)) And (S = 1) then begin // fade out complete... myFade:=0; ActualScreen.onHide; @@ -263,6 +275,11 @@ begin // end of fade mod end; end; // if + + //Draw OSD only on first Screen if Debug Mode is enabled + if ((Ini.Debug = 1) OR (Params.Debug)) AND (S=1) then + DrawDebugInformation; + end; // for // SwapBuffers(h_DC); end; @@ -365,5 +382,57 @@ begin end; end; +//------------ +// DrawDebugInformation - Procedure draw FPS and some other Informations on Screen +//------------ +procedure TDisplay.DrawDebugInformation; +var Ticks: Cardinal; +begin + //Some White Background for information + glEnable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + glColor4f(1, 1, 1, 0.5); + glBegin(GL_QUADS); + glVertex2f(690, 44); + glVertex2f(690, 0); + glVertex2f(800, 0); + glVertex2f(800, 44); + glEnd; + glDisable(GL_BLEND); + + //Set Font Specs + SetFontStyle(0); + SetFontSize(7); + SetFontItalic(False); + glColor4f(0, 0, 0, 1); + + //Calculate FPS + Ticks := GetTickCount; + if (Ticks >= NextFPSSwap) then + begin + LastFPS := FPSCounter * 4; + FPSCounter := 0; + NextFPSSwap := Ticks + 250; + end; + + Inc(FPSCounter); + + //Draw Text + + //FPS + SetFontPos(695, 0); + glPrint (PChar('FPS: ' + InttoStr(LastFPS))); + + //RSpeed + SetFontPos(695, 13); + glPrint (PChar('RSpeed: ' + InttoStr(Round(1000 * TimeMid)))); + + //LastError + SetFontPos(695, 26); + glColor4f(1, 0, 0, 1); + glPrint (PChar(OSD_LastError)); + + glColor4f(1, 1, 1, 1); +end; end. -- cgit v1.2.3 From f98839dba7e48a36cb6a2bdcbef547c7ef31aada Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 8 Jul 2007 14:06:50 +0000 Subject: Changed Outline Font Filenames Changed Outline2 Font to official Ultrastars Outline1 Font for better Song backward compatibility git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@280 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.rc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.rc b/Game/Code/UltraStar.rc index 68d68e4b..2160cfb8 100644 --- a/Game/Code/UltraStar.rc +++ b/Game/Code/UltraStar.rc @@ -4,11 +4,11 @@ Font FNT "..\Fonts\Normal\eurostar_regular.dat" FontB PNG "..\Fonts\Bold\eurostar_regular_bold.png" FontB FNT "..\Fonts\Bold\eurostar_regular_bold.dat" -FontO PNG "..\Fonts\Outline 1\Outline 36 (1024) 16c.PNG" -FontO FNT "..\Fonts\Outline 1\Outline 36 (1024).dat" +FontO PNG "..\Fonts\Outline 1\Outline 1.PNG" +FontO FNT "..\Fonts\Outline 1\Outline 1.dat" -FontO2 PNG "..\Fonts\Outline 2\5 - Outline Dark Edited 16c.PNG" -FontO2 FNT "..\Fonts\Outline 2\Outline.dat" +FontO2 PNG "..\Fonts\Outline 2\Outline 2.PNG" +FontO2 FNT "..\Fonts\Outline 2\Outline 2.dat" MAINICON ICON "..\Graphics\ustar-icon_v01.ico" //MAINICON ICON "..\Graphics\us.ico" \ No newline at end of file -- cgit v1.2.3 From f6a236acf6289b452e651107c9ca8cf9c6e82e41 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 8 Jul 2007 14:09:29 +0000 Subject: Changed to Version 1.00 RC1 Only changes that have to be done from now on are changes in the Theme Files. I hope Mota will be able to do it soon git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@281 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.dpr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 44899166..a49d43c2 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -106,7 +106,7 @@ uses SysUtils; const - Version = 'UltraStar Deluxe V 0.98 Beta'; + Version = 'UltraStar Deluxe V 1.00 RC1'; var WndTitle: string; -- cgit v1.2.3 From e8ff96a8c44e152a2cb7b71579249c15a10f4168 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 9 Jul 2007 14:00:16 +0000 Subject: Added missing UCommandLine.pas git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@282 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCommandLine.pas | 280 +++++++++++++++++++++++++++++++++++++ 1 file changed, 280 insertions(+) create mode 100644 Game/Code/Classes/UCommandLine.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UCommandLine.pas b/Game/Code/Classes/UCommandLine.pas new file mode 100644 index 00000000..03229721 --- /dev/null +++ b/Game/Code/Classes/UCommandLine.pas @@ -0,0 +1,280 @@ +unit UCommandLine; + +interface + +type + //----------- + // TCMDParams - Class Reaads Infos from ParamStr and set some easy Interface Variables + //----------- + TCMDParams = class + private + sLanguage: String; + sResolution: String; + public + //Some Boolean Variables Set when Reading Infos + Debug: Boolean; + Benchmark: Boolean; + NoLog: Boolean; + FullScreen: Boolean; + Joypad: Boolean; + + //Some Value Variables Set when Reading Infos {-1: Not Set, others: Value} + Depth: Integer; + Screens: Integer; + + //Some Strings Set when Reading Infos {Length=0 Not Set} + SongPath: String; + ConfigFile: String; + ScoreFile: String; + + //Pseudo Integer Values + Function GetLanguage: Integer; + Property Language: Integer read GetLanguage; + + Function GetResolution: Integer; + Property Resolution: Integer read GetResolution; + + //Some Procedures for Reading Infos + Constructor Create; + + Procedure ResetVariables; + Procedure ReadParamInfo; + end; + +var + Params: TCMDParams; + +implementation +uses SysUtils, UIni; + +//------------- +// Constructor - Create class, Reset Variables and Read Infos +//------------- +Constructor TCMDParams.Create; +begin + ResetVariables; + ReadParamInfo; +end; + +//------------- +// ResetVariables - Reset Class Variables +//------------- +Procedure TCMDParams.ResetVariables; +begin + Debug := False; + Benchmark := False; + NoLog := False; + FullScreen := False; + Joypad := False; + + //Some Value Variables Set when Reading Infos {-1: Not Set, others: Value} + sResolution := ''; + sLanguage := ''; + Depth := -1; + Screens := -1; + + //Some Strings Set when Reading Infos {Length=0 Not Set} + SongPath := ''; + ConfigFile := ''; + ScoreFile := ''; +end; + +//------------- +// ReadParamInfo - Read Infos from Parameters +//------------- +Procedure TCMDParams.ReadParamInfo; +var + I: Integer; + PCount: Integer; + Command: String; +begin + PCount := ParamCount; + //Log.LogError('ParamCount: ' + Inttostr(PCount)); + + //Check all Parameters + For I := 1 to PCount do + begin + Command := Paramstr(I); + //Log.LogError('Start parsing Command: ' + Command); + //Is String Parameter ? + if (Length(Command) > 1) AND (Command[1] = '-') then + begin + //Remove - from Command + Command := Lowercase(Trim(Copy(Command, 2, Length(Command) - 1))); + //Log.LogError('Command prepared: ' + Command); + + //Check Command + + // Boolean Triggers: + if (Command = 'debug') then + Debug := True + else if (Command = 'benchmark') then + Benchmark := True + else if (Command = 'nolog') then + NoLog := True + else if (Command = 'fullscreen') then + Fullscreen := True + else if (Command = 'joypad') then + Joypad := True + + //Integer Variables + else if (Command = 'depth') then + begin + //Check if there is another Parameter to get the Value from + if (PCount > I) then + begin + Command := ParamStr(I + 1); + + //Check for valid Value + If (Command = '16') then + Depth := 0 + Else If (Command = '32') then + Depth := 1; + end; + end + + else if (Command = 'screens') then + begin + //Check if there is another Parameter to get the Value from + if (PCount > I) then + begin + Command := ParamStr(I + 1); + + //Check for valid Value + If (Command = '1') then + Screens := 0 + Else If (Command = '2') then + Screens := 1; + end; + end + + //Pseudo Integer Values + else if (Command = 'language') then + begin + //Check if there is another Parameter to get the Value from + if (PCount > I) then + begin + //Write Value to String + sLanguage := Lowercase(ParamStr(I + 1)); + end; + end + + else if (Command = 'resolution') then + begin + //Check if there is another Parameter to get the Value from + if (PCount > I) then + begin + //Write Value to String + sResolution := Lowercase(ParamStr(I + 1)); + end; + end + + //String Values + else if (Command = 'songpath') then + begin + //Check if there is another Parameter to get the Value from + if (PCount > I) then + begin + //Write Value to String + SongPath := ParamStr(I + 1); + end; + end + + else if (Command = 'configfile') then + begin + //Check if there is another Parameter to get the Value from + if (PCount > I) then + begin + //Write Value to String + ConfigFile := ParamStr(I + 1); + + //is this a relative PAth -> then add Gamepath + if Not ((Length(ConfigFile) > 2) AND (ConfigFile[2] = ':')) then + ConfigFile := ExtractFilePath(ParamStr(0)) + Configfile; + end; + end + + else if (Command = 'scorefile') then + begin + //Check if there is another Parameter to get the Value from + if (PCount > I) then + begin + //Write Value to String + ScoreFile := ParamStr(I + 1); + end; + end; + + end; + + end; + +{ Log.LogError('Values: '); + + if Debug then + Log.LogError('Debug'); + + if Benchmark then + Log.LogError('Benchmark'); + + if NoLog then + Log.LogError('NoLog'); + + if Fullscreen then + Log.LogError('FullScreen'); + + if JoyStick then + Log.LogError('Joystick'); + + + Log.LogError('Screens: ' + Inttostr(Screens)); + Log.LogError('Depth: ' + Inttostr(Depth)); + + Log.LogError('Resolution: ' + Inttostr(Resolution)); + Log.LogError('Resolution: ' + Inttostr(Language)); + + Log.LogError('sResolution: ' + sResolution); + Log.LogError('sLanguage: ' + sLanguage); + + Log.LogError('ConfigFile: ' + ConfigFile); + Log.LogError('SongPath: ' + SongPath); + Log.LogError('ScoreFile: ' + ScoreFile); } + +end; + +//------------- +// GetLanguage - Get Language ID from saved String Information +//------------- +Function TCMDParams.GetLanguage: Integer; +var + I: integer; +begin + Result := -1; + + //Search for Language + For I := 0 to high(ILanguage) do + if (LowerCase(ILanguage[I]) = sLanguage) then + begin + Result := I; + Break; + end; +end; + +//------------- +// GetResolution - Get Resolution ID from saved String Information +//------------- +Function TCMDParams.GetResolution: Integer; +var + I: integer; +begin + Result := -1; + + //Search for Resolution + For I := 0 to high(IResolution) do + if (LowerCase(IResolution[I]) = sResolution) then + begin + Result := I; + Break; + end; +end; + +end. \ No newline at end of file -- 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') 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 a65e818d0a8ecac47b7710e8546897e271d0ca44 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 15 Jul 2007 17:21:12 +0000 Subject: Fixed a bug in Note Name convertation git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@297 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditSub.pas | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 9e84462d..9ca45f55 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -1291,8 +1291,18 @@ end; function TScreenEditSub.GetNoteName(Note: Integer): String; var N1, N2: Integer; begin - N1 := Note mod 12; - N2 := Note div 12; + if (Note > 0) then + begin + N1 := Note mod 12; + N2 := Note div 12; + end + else + begin + N1 := (Note + (-Trunc(Note/12)+1)*12) mod 12; + N2 := -1; + end; + + case N1 of 0: Result := 'c'; -- cgit v1.2.3 From abf2c5300a9ffca0159199237da2f442aa3a57aa Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 15 Jul 2007 18:13:59 +0000 Subject: Fixed a bug in Party playlist selection when no playlist or category is available git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@298 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenPartyOptions.pas | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index aa8681d0..49cc8c53 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -63,11 +63,15 @@ begin SDLK_RETURN: begin + //Don'T start when Playlist is Selected and there are no Playlists + If (Playlist = 2) and (Length(PlaylistMan.Playlists) = 0) then + Exit; + //Save Difficulty Ini.Difficulty := SelectsS[SelectLevel].SelectedOption; Ini.SaveLevel; - //Save PlayList - //(Todo) + + //Save Num Teams: PartySession.Teams.NumTeams := NumTeams + 2; PartySession.Teams.Teaminfo[0].NumPlayers := NumPlayer1+1; @@ -76,6 +80,7 @@ begin //Save Playlist PlaylistMan.Mode := Playlist; + PlaylistMan.CurPlayList := High(Cardinal); //If Category Selected Search Category ID if Playlist = 1 then begin @@ -91,6 +96,10 @@ begin Break; end; end; + + //No Categorys or Invalid Entry + If PlaylistMan.CurPlayList = High(Cardinal) then + Exit; end else PlaylistMan.CurPlayList := Playlist2; @@ -203,11 +212,25 @@ begin IPlaylist2[high(IPlaylist2)] := CatSongs.Song[I].Artist; end; end; + + If (Length(IPlaylist2) = 0) then + begin + SetLength(IPlaylist2, 1); + IPlaylist2[0] := 'No Categories found'; + end; end; 2: begin - SetLength(IPlaylist2, Length(PlaylistMan.Playlists)); - PlaylistMan.GetNames(IPlaylist2); + if (Length(PlaylistMan.Playlists) > 0) then + begin + SetLength(IPlaylist2, Length(PlaylistMan.Playlists)); + PlaylistMan.GetNames(IPlaylist2); + end + else + begin + SetLength(IPlaylist2, 1); + IPlaylist2[0] := 'No Playlists found'; + end; end; end; -- cgit v1.2.3 From 2722fcd0ddec2fa8f7cd9af74efd54870cc94e8d Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 18 Jul 2007 20:18:27 +0000 Subject: Little hack in SongScreen that fixes problems with blending. Drawing order changed only for SongScreen: Buttons -> Statics -> Texts git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@301 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 87aa122e..3221f21e 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1340,6 +1340,7 @@ function TScreenSong.Draw: boolean; var dx: real; dt: real; + I: Integer; begin dx := SongTarget-SongCurrent; dt := TimeSkip*7; @@ -1393,7 +1394,26 @@ begin end; - inherited Draw; + //inherited Draw; + //heres a little Hack, that causes the Statics + //are Drawn after the Buttons because of some Blending Problems. + //This should cause no Problems because all Buttons on this screen + //Has Z Position. + //Draw BG + DrawBG; + + //Instead of Draw FG Procedure: + //We draw Buttons for our own + for I := 0 to Length(Button) - 1 do + Button[I].Draw; + + // Statics + for I := 0 to Length(Static) - 1 do + Static[I].Draw; + + // and texts + for I := 0 to Length(Text) - 1 do + Text[I].Draw; //Draw Equalizer -- cgit v1.2.3 From 0ea8eaa9fcf83bb7c014109eba6a8c4e25fd1a9f Mon Sep 17 00:00:00 2001 From: b1indy Date: Fri, 20 Jul 2007 21:26:39 +0000 Subject: UGraphicClasses.pas: minor modification to Flare effect UMusic.pas: modified Music.Play to play from start if Loop is set (dunno if this conflicts with something else, don't hope so) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@303 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphicClasses.pas | 2 +- Game/Code/Classes/UMusic.pas | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphicClasses.pas b/Game/Code/Classes/UGraphicClasses.pas index 5f0b0b4e..032830b9 100644 --- a/Game/Code/Classes/UGraphicClasses.pas +++ b/Game/Code/Classes/UGraphicClasses.pas @@ -286,7 +286,7 @@ begin // move around X := X + mX; Y := Y + mY; - mY:=mY+1.5; + mY:=mY+1.8; // mX:=mX/2; end; end; diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index 3fcd2a21..4e647ed3 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -407,6 +407,7 @@ procedure TMusic.Play; begin if Loaded then begin // MediaPlayer.Play; + if Loop then BASS_ChannelPlay(Bass, True); // start from beginning... actually bass itself does not loop, nor does this TMusic Class BASS_ChannelPlay(Bass, False); // for setting position before playing end; end; -- cgit v1.2.3 From c8b047eb951236d1253c1b23fd828615de99b3b9 Mon Sep 17 00:00:00 2001 From: b1indy Date: Fri, 20 Jul 2007 21:34:27 +0000 Subject: added resources for the credits screen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@306 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.rc | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.rc b/Game/Code/UltraStar.rc index 2160cfb8..cf954deb 100644 --- a/Game/Code/UltraStar.rc +++ b/Game/Code/UltraStar.rc @@ -11,4 +11,28 @@ FontO2 PNG "..\Fonts\Outline 2\Outline 2.PNG" FontO2 FNT "..\Fonts\Outline 2\Outline 2.dat" MAINICON ICON "..\Graphics\ustar-icon_v01.ico" -//MAINICON ICON "..\Graphics\us.ico" \ No newline at end of file +//MAINICON ICON "..\Graphics\us.ico" + +CRDTS_BG PNG "..\Graphics\credits_v5_bg.png" +CRDTS_OVL PNG "..\Graphics\credits_v5_overlay.png" +CRDTS_blindguard PNG "..\Graphics\names_blindguard.png" +CRDTS_blindy PNG "..\Graphics\names_blindy.png" +CRDTS_canni PNG "..\Graphics\names_canni.png" +CRDTS_commandio PNG "..\Graphics\names_commandio.png" +CRDTS_lazyjoker PNG "..\Graphics\names_lazyjoker.png" +CRDTS_mog PNG "..\Graphics\names_mog.png" +CRDTS_mota PNG "..\Graphics\names_mota.png" +CRDTS_skillmaster PNG "..\Graphics\names_skillmaster.png" +CRDTS_whiteshark PNG "..\Graphics\names_whiteshark.png" +INTRO_L01 PNG "..\Graphics\intro-l-01.png" +INTRO_L02 PNG "..\Graphics\intro-l-02.png" +INTRO_L03 PNG "..\Graphics\intro-l-03.png" +INTRO_L04 PNG "..\Graphics\intro-l-04.png" +INTRO_L05 PNG "..\Graphics\intro-l-05.png" +INTRO_L06 PNG "..\Graphics\intro-l-06.png" +INTRO_L07 PNG "..\Graphics\intro-l-07.png" +INTRO_L08 PNG "..\Graphics\intro-l-08.png" +INTRO_L09 PNG "..\Graphics\intro-l-09.png" +OUTRO_BG PNG "..\Graphics\outro-bg.png" +OUTRO_ESC PNG "..\Graphics\outro-esc.png" +OUTRO_EXD PNG "..\Graphics\outro-exit-dark.png" \ No newline at end of file -- cgit v1.2.3 From 9ea1096f3ee6102ad83982ebaedbc954c5d19b69 Mon Sep 17 00:00:00 2001 From: b1indy Date: Fri, 20 Jul 2007 21:46:24 +0000 Subject: beta version of new credits screen (still some tweaking to do) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@308 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 1140 ++++++++++++++++++++++++++++++---- 1 file changed, 1008 insertions(+), 132 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 98cdc417..43a9a3ca 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -3,15 +3,57 @@ unit UScreenCredits; interface uses - UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes, ULCD, ULight; + UMenu, SDL, UDisplay, UTexture, OpenGL12, UMusic, UFiles, SysUtils, UThemes, ULCD, ULight, UGraphicClasses; type + TCreditsStages=(InitialDelay,Intro,MainPart,Outro); + TScreenCredits = class(TMenu) public - Credits_Y: Real; + Credits_X: Real; Credits_Time: Cardinal; Credits_Alpha: Cardinal; + CTime: Cardinal; + CTime_hold: array of Cardinal; + ESC_Alpha: Integer; + + credits_entry_tex: TTexture; + credits_entry_dx_tex: TTexture; + credits_bg_tex: TTexture; + credits_bg_ovl: TTexture; +// credits_bg_logo: TTexture; + credits_bg_scrollbox_left: TTexture; + credits_blindguard: TTexture; + credits_blindy: TTexture; + credits_canni: TTexture; + credits_commandio: TTexture; + credits_lazyjoker: TTexture; + credits_mog: TTexture; + credits_mota: TTexture; + credits_skillmaster: TTexture; + credits_whiteshark: TTexture; + intro_layer01: TTexture; + intro_layer02: TTexture; + intro_layer03: TTexture; + intro_layer04: TTexture; + intro_layer05: TTexture; + intro_layer06: TTexture; + intro_layer07: TTexture; + intro_layer08: TTexture; + intro_layer09: TTexture; + outro_bg: TTexture; + outro_esc: TTexture; + outro_exd: TTexture; + + deluxe_slidein: cardinal; + + CurrentScrollText: String; + NextScrollUpdate: Real; + EndofLastScrollingPart: Cardinal; + CurrentScrollStart, CurrentScrollEnd: Integer; + + CRDTS_Stage: TCreditsStages; Fadeout: boolean; constructor Create; override; @@ -20,67 +62,60 @@ type procedure onShow; override; procedure onHide; override; procedure DrawCredits; + procedure Draw_FunkyText; end; - const Credits_Text: Array[0..52] of PChar = ( - ':SPACE:', - 'Main Idea: Corvus 5', - 'Thank you very much for this great Game', - ':SPACE:', - 'The Ultrastar Deluxe Team:', - ':SPACE:', - 'blindy:', - 'VFX Programming', - ':SPACE:', - 'commandi00:', - 'Beta Testing', - ':SPACE:', - 'Crazy Joker:', - 'Graphics', - ':SPACE:', - 'DennistheMenace:', - 'Beta Testing and great Support in "the Board"', - ':SPACE:', - 'Mog:', - 'Programming, Graphics', - ':SPACE:', - 'Mota:', - 'Programming, Idea of creating this Mod', - ':SPACE:', - 'Sawyer:', - 'Web Master, Programming', - ':SPACE:', - 'Whiteshark:', - 'Programming, Creating Release', - ':SPACE:', - ':SPACE:', - 'Thanks to', - ':SPACE:', - 'Blind Guard', - 'for supporting us and administrate this great Board', - ':SPACE:', - 'Weezl', - 'for the credits screen music', - ':SPACE:', - 'The whole Community from www.ultra-star.dl.am', - 'for supporting us, supporting the newbies', - 'and remembering us to continue work', - ':SPACE:', - 'You', - 'for using Ultrastar Deluxe', - ':SPACE:', - ':SPACE:', - 'Visit us at:', - 'http://www.ultrastardx.dl.am', - 'http://sourceforge.net/projects/ultrastardx/', - 'http://www.Ultra-Star.dl.am', - 'Please write Bug Reports and Feature Requests', - 'to help making this a better Game'); +const + Funky_Text: AnsiString = +{ 'Hey doodz, we made it! You had to wait very long cause we wanted it to be perfect. So here it is, the most perfect UltraStar you`ll ever get. We have this awesome stars, we have this awesome party mode with plugins, we have the best skins and yes we´re '+ + 'the best :P Whiteshark tried his best to fix all the bugs, and he has done an awesome job! Mota and Mog fired up their Photoshops to create this stunning skins, Blindy has brought you this massive stars and Canni did the documentation. BlindGuard hosts '+ + 'the forum, and oh my gosh he spends a lot of time fucking with all the wankers asking for mp3s. We also want to thank the people in the forum for their massive support and their patience xD Blindy and Mog also want to thank www.demoscene.tv for '+ + 'inspiration (yay Kewlerz suck, but we suck more) - also big shout outs to Einsiedler for brewing our favourite beer and dnbradio.com for the music. Big greetings from Mog to Antje too, I love you baby :X'; +} + 'So here we are, grandma deluxe has arrived. It´s Mog on the keyboard, but I speak for all of us teamers :P Took us '+ + 'longer than expected to come up with this, but hey you know good things take their time ;) As we tried to put in as '+ + 'many features as we have seen on the board (and our`s aswell), like the neat eyecandy (stars h00ray), the party mode, '+ + 'new awesome skins, fucking bugfixes (poor Whiteshark) and a hell lot of other stuff. I´m also proud to announce that '+ + 'we´re the only UltraStar with all this stuff, nice hu? ;) Maybe it´s about time to explain why it took so long, I just '+ + 'strip the part with lazy joker (has he done _anything_?) and all the other people who joined #ultra-star.dl.am on '+ + 'QuakeNet just to beg for a beta or wanted to "help" (hey I´m from a big newspaper). Actually there was a lot of code '+ + 'that had to be written up from scratch (party mode anyone?), and some of the stuff was pretty new to us (OpenGL h00ray). '+ + 'And it reallly didn´t help when people on the board didn´t stop arguing about the release date (I don´t say wankers), so '+ + 'next time some real help would be apprechiated - send us beer if you´re unskilled xD It´s almost sunset outside, time '+ + 'for the thanks then. We want to thank sourceforge for the hosting, BlindGuard for the board support (bet he has some '+ + 'grey hairs now), Wome for the tune you hear right now (thanks mate :X), Corvus5 for the work on UltraStar, our friends '+ + 'on the board (ultra-star.dl.am the place to be!), Einsiedler for the beer, the demoscene and weed for some inspiration...'; + + Timings: array[0..21] of Cardinal=( + 20, // 0 Delay vor Start + + 149, // 1 Ende erster Intro Zoom + 155, // 2 Start 2. Action im Intro + 170, // 3 Ende Separation im Intro + 271, // 4 Anfang Zoomout im Intro + 0, // 5 unused + 261, // 6 Start fade-to-white im Intro + + 271, // 7 Start Main Part + 280, // 8 Start On-Beat-Sternchen Main Part + 396, // 9 Start BlindGuard + 666, // 10 Start blindy + 936, // 11 Start Canni + 1206, // 12 Start Commandio + 1476, // 13 Start LazyJoker + 1746, // 14 Start Mog + 2016, // 15 Start Mota + 2286, // 16 Start SkillMaster + 2556, // 17 Start WhiteShark + 2826, // 18 Ende Whiteshark + 3096, // 19 Start FadeOut Mainscreen + 3366, // 20 Ende Credits Tune + 60); // 21 start flare im intro implementation -uses Dialogs,Windows, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl, ULanguage; +uses Dialogs,Windows, UGraphic, UMain, UIni, USongs, Textgl, opengl, ULanguage, Math; function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -93,25 +128,47 @@ begin FadeTo(@ScreenMain); Music.PlayBack; end; + SDLK_SPACE: + begin + setlength(CTime_hold,length(CTime_hold)+1); + CTime_hold[high(CTime_hold)]:=CTime; + end; + end;//esac end; //fi end; constructor TScreenCredits.Create; -var - I: integer; begin inherited Create; + credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0); + credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0); - AddBackground(Theme.Loading.Background.Tex); + credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', 'PNG', 'Font Black', 0); + credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0); + credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0); + credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', 'PNG', 'Font Black', 0); + credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', 'PNG', 'Font Black', 0); + credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', 'Font Black', 0); + credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', 'PNG', 'Font Black', 0); + credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', 'PNG', 'Font Black', 0); + credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', 'PNG', 'Font Black', 0); -// for I := 0 to High(Theme.Loading.Static) do -// AddStatic(Theme.Loading.Static[I]); + intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', 'PNG', 'Transparent', 0); + intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', 'PNG', 'Transparent', 0); + intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', 'PNG', 'Transparent', 0); + intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', 'PNG', 'Transparent', 0); + intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', 'PNG', 'Transparent', 0); + intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', 'PNG', 'Transparent', 0); + intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', 'PNG', 'Transparent', 0); + intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', 'PNG', 'Transparent', 0); + intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', 'PNG', 'Transparent', 0); -// for I := 0 to High(Theme.Loading.Text) do -// AddText(Theme.Loading.Text[I]); + outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0); + outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0); + outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Plain', 0); - Fadeout := false; + CRDTS_Stage:=InitialDelay; end; function TScreenCredits.Draw: boolean; @@ -121,11 +178,15 @@ end; procedure TScreenCredits.onShow; begin - Credits_Y := 600; + CRDTS_Stage:=InitialDelay; + Credits_X := 580; + deluxe_slidein := 0; Credits_Alpha := 0; //Music.SetLoop(true); Loop looped ned, so ne scheisse - Music.Open(soundpath + 'wome_-_echoes.mp3'); //danke kleinster liebster weeeetüüüüü!! - Music.Play; + Music.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! +// Music.Play; + CTime:=0; + setlength(CTime_hold,0); end; procedure TScreenCredits.onHide; @@ -133,91 +194,906 @@ begin Music.Stop; end; +Procedure TScreenCredits.Draw_FunkyText; +var + S,I, Len: Integer; + X,Y,A: Real; + visibleText: PChar; +begin + SetFontSize(10); + //Init ScrollingText + if (CTime = Timings[7]) then + begin + //Set Position of Text + Credits_X := 600; + CurrentScrollStart:=1; + CurrentScrollEnd:=1; + end; + + if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then + begin + X:=0; + visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); + for S := 0 to length(visibleText)-1 do begin + Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); + SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); + if (Credits_X+X < 15) then A:=0; + if (Credits_X+X >=15) then A:=Credits_X+X-15; + if Credits_X+X > 32 then A:=17; + glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17); + glPrintLetter(visibleText[S]); + X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + end; + if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin + Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + inc(CurrentScrollStart); + end; + visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); + if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin + inc(CurrentScrollEnd); + end; + end; + // timing hack + X:=5; + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + glColor4f(1, 1, 1, 1); + for S:=0 to high(CTime_hold) do begin + visibleText:=pchar(inttostr(CTime_hold[S])); + SetFontPos (500, X); + glPrint (Addr(visibleText[0])); + X:=X+20; + end; +end; + +procedure Start3D; +begin + glMatrixMode(GL_PROJECTION); + glPushMatrix; + glLoadIdentity; + glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity; +end; +procedure End3D; +begin + glMatrixMode(GL_PROJECTION); + glPopMatrix; + glMatrixMode(GL_MODELVIEW); +end; + procedure TScreenCredits.DrawCredits; var T,I: Cardinal; - Y: Real; + X: Real; Ver: PChar; + RuntimeStr: AnsiString; + Data: TFFTData; + j,k,l:cardinal; + f,g,h: Real; + STime:cardinal; + Delay:cardinal; + + myPixel: longword; + myColor: Cardinal; + myScale: Real; + myAngle: Real; +const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24), + (154,31),(156,58),(168,32),(203,36), + (258,34),(251,50),(274,93),(294,84), + (232,54),(278,62),(319,34),(336,92), + (347,23),(374,32),(377,58),(361,83), + (385,91),(405,91),(429,35),(423,51), + (450,32),(485,34),(444,91),(486,93)); + begin +//dis does teh muiwk y0r +Data := Music.GetFFTData; + + + T := GetTickCount div 33; if T <> Credits_Time then begin Credits_Time := T; - //Change Position - Credits_Y := Credits_Y - 1; - //Change Alpha - Inc (Credits_Alpha, 3); - end; - //If lowest Position is outside the Screen-> Show MainMenu - if (Y <= 0) then - Y := 600; - //Draw BackGround - DrawBG; - - - //Draw pulsing Credits Text - //Set Font - SetFontStyle (2); - SetFontItalic(False); - SetFontSize(9); - SetFontPos (10, 5); - glColor4f(1, 0, 0, 0.2 + Abs((Credits_Alpha mod 150)/100 - 0.75)); - glPrint ('You may press ESC now'); - - //Set Font Size for Credits - SetFontSize(12); - //Draw Version - if (Credits_Y>-35) then - begin - Ver := PChar(Language.Translate('US_VERSION')); - //Set Color - if Credits_Y > 500 then - glColor4f(1, 0.6, 0.08, (600 - Credits_Y)/100 - 0.2) - else - glColor4f(1, 0.6, 0.08, 0.8); + inc(CTime); + Credits_X := Credits_X-2; + if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then + begin +// CTime:=Timings[20]; +// CRDTS_Stage:=Outro; - SetFontPos (400 - glTextWidth(Ver)/2, Credits_Y); - glprint(Ver); + CRDTS_Stage:=Intro; + CTime:=0; + Music.Play; + + end; + if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then + begin + CRDTS_Stage:=MainPart; + end; + if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then + begin + CRDTS_Stage:=Outro; + end; end; - //Set Color + Start Pos - glColor4f(0.8, 0.8, 1, 0.8); - Y := Credits_Y + 50; + //draw background + if CRDTS_Stage=InitialDelay then + begin + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end + else + if CRDTS_Stage=Intro then + begin + Start3D; + glPushMatrix; - //Search upper Position - For I := 0 to high(Credits_Text) do - begin - if (Credits_Text[I]=':SPACE:') then //Spacer - Y := Y + 55 - else - Y := Y + 30; + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - if Y > -35 then - break; - end; + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); - //Draw Text - For T := I+1 to high(Credits_Text) do - begin - if (Credits_Text[T]=':SPACE:') then //Spacer - Y := Y + 55 - else + if CTime < Timings[1] then begin + myScale:= 0.5+0.5*(Timings[1]-CTime)/(Timings[1]); // slowly move layers together + myAngle:=cos((CTime)*pi/((Timings[1])*2)); // and make logo face towards camera + end else begin // this is the part when the logo stands still + myScale:=0.5; + myAngle:=0; + end; + if CTime > Timings[2] then begin + myScale:= 0.5+0.5*(CTime-Timings[2])/(Timings[3]-Timings[2]); // get some space between layers + myAngle:=0; + end; +// if CTime > Timings[3] then myScale:=1; // keep the space between layers + glTranslatef(0,0,-5+0.5*myScale); + if CTime > Timings[3] then myScale:=1; // keep the space between layers + if CTime > Timings[3] then begin // make logo rotate left and grow +// myScale:=(CTime-Timings[4])/(Timings[7]-Timings[4]); + glRotatef(20*sqr(CTime-Timings[3])/sqr((Timings[7]-Timings[3])/2),0,0,1); + glScalef(1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1); + end; + if CTime < Timings[2] then + glRotatef(30*myAngle,0.5*myScale+myScale,1+myScale,0); +// glScalef(0.5,0.5,0.5); + glScalef(4/3,-1,1); + glColor4f(1, 1, 1, 1); + + glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.4 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.4 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.4 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.4 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.22 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.22 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.22 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.22 * myScale); + glEnd; + gldisable(gl_texture_2d); + glDisable(GL_BLEND); + + glPopMatrix; + End3D; + + // do some sparkling effects + if (CTime < Timings[1]) and (CTime > Timings[21]) then + begin + for k:=1 to 3 do begin + l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5); + j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301); + GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0); + end; + end; + + // fade to white at end + if Ctime > Timings[6] then + begin + glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + + end; + if (CRDTS_Stage=MainPart) then + // main credits screen background, scroller, logo and girl + begin + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // draw scroller + Draw_FunkyText; + +//######################################################################### +// draw credits names + +// BlindGuard (von links oben reindrehen, nach rechts unten rausdrehen) + STime:=Timings[9]-10; + Delay:=Timings[10]-Timings[9]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + k:=CTime-STime; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(0,329,0); + if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end; + gltranslatef(223,0,0); + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + gltranslatef(223,0,0); + glrotatef((CTime-(STime+Delay-10))*-9,0,0,1); + gltranslatef(-223,0,0); + end; + glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Blindy (zoom von 0 auf volle grösse und drehung, zoom auf doppelte grösse und nach rechts oben schieben) + STime:=Timings[10]-10; + Delay:=Timings[11]-Timings[10]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + k:=CTime-STime; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+20) and (CTime<=STime+22) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+20 then begin + j:=CTime-Stime; + glscalef(j*j/400,j*j/400,j*j/400); + glrotatef(j*18.0,0,0,1); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(f*3,-f,0); + glscalef(1+j/10,1+j/10,1+j/10); + glrotatef(j*9.0,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Canni (von links reinschieben, nach rechts oben rausschieben) + STime:=Timings[11]-10; + Delay:=Timings[12]-Timings[11]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + k:=CTime-STime; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(((CTime-STime)*21.0)-210,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=(CTime-(STime+Delay-10))*21; + gltranslatef(j,-j/2,0); + end; + glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Commandio (von unten reinklappen, nach rechts oben rausklappen) + STime:=Timings[12]-10; + Delay:=Timings[13]-Timings[12]; + if CTime > STime then begin - //Set Color - if Y > 500 then - glColor4f(0.8, 0.8, 1, (600 - Y)/100 - 0.2) + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + k:=CTime-STime; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=258.0-25.8*(CTime-STime) else - glColor4f(0.8, 0.8, 1, 0.8); + f:=0; - SetFontPos (400 - glTextWidth(Credits_Text[T])/2, Y); - glprint(Credits_Text[T]); - Y := Y + 30; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end else + g:=0; + glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163+g-f*1.5, -129+f*1.5-g/2); + glTexCoord2f(0,1);glVertex2f(-163+g*1.5, 129-(g*1.5*258/326)); + glTexCoord2f(1,1); glVertex2f(163+g, 129+g/4); + glTexCoord2f(1,0);glVertex2f(163+f*1.5+g/4, -129+f*1.5-g/4); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; end; - if Y > 600 then - break; - end; +// lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing) + STime:=Timings[13]-35; + Delay:=Timings[14]-Timings[13]+5; + if CTime > STime then + begin + k:=0; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20; + ESC_Alpha:=10; + f:=CTime-STime; + if CTime <=STime+40 then j:=CTime-STime else j:=40; + if (CTime >=STime+Delay-40) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j*j/1600); + + glPushMatrix; + gltranslatef(180+(f-70),329,0); + glBindTexture(GL_TEXTURE_2D, credits_lazyjoker.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Mog (von links reinklappen, nach rechts unten rausklappen) + STime:=Timings[14]-10; + Delay:=Timings[15]-Timings[14]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + k:=CTime-STime; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) + else + f:=0; + + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end else + g:=0; + glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163+g*1.5, -129+g*1.5); + glTexCoord2f(0,1);glVertex2f(-163+g*1.2, 129+g); + glTexCoord2f(1,1); glVertex2f(163-f+g/2, 129+f*1.5+g/4); + glTexCoord2f(1,0);glVertex2f(163-f+g*1.5, -129-f*1.5); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Mota (von rechts oben reindrehen, nach links unten rausschieben und verkleinern und dabei drehen) + STime:=Timings[15]-10; + Delay:=Timings[16]-Timings[15]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + k:=CTime-STime; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(223,0,0); + glrotatef((10-(CTime-STime))*9,0,0,1); + gltranslatef(-223,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(-f*2,-f,0); + glscalef(1-j/10,1-j/10,1-j/10); + glrotatef(-j*9.0,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Skillmaster (von rechts unten reinschieben, nach rechts oben rausdrehen) + STime:=Timings[16]-10; + Delay:=Timings[17]-Timings[16]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + k:=CTime-STime; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + j:=STime+10-CTime; + f:=j*10.0; + gltranslatef(+f*2,+f/2,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(0,-223,0); + glrotatef(j*-9,0,0,1); + gltranslatef(0,223,0); + glrotatef(j*9,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// WhiteShark (von links unten reinklappen, nach rechts oben rausklappen) + STime:=Timings[17]-10; + Delay:=Timings[18]-Timings[17]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + k:=CTime-STime; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) + else + f:=0; + + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end else + g:=0; + glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2); + glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4); + glTexCoord2f(1,1); glVertex2f(163-f*1.2+g/4, 129+f/2-g/4); + glTexCoord2f(1,0);glVertex2f(163-f*1.5+g/4, -129+f*1.5+g/4); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + + +// #################################################################### +// do some twinkle stuff (kinda on beat) + if (CTime>Timings[8]) and (CTime < Timings[19]) then begin + k:=0; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then begin + l:=RandomRange(6,16); + j:=RandomRange(0,27); + GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); + end; + end; + +//################################################# +// draw the rest of the main screen (girl and logo + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(800-393, 0); + glTexCoord2f(0,600/1024);glVertex2f(800-393, 600); + glTexCoord2f(393/512,600/1024); glVertex2f(800, 600); + glTexCoord2f(393/512,0);glVertex2f(800, 0); + glEnd; +{ glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,112/128);glVertex2f(0, 112); + glTexCoord2f(497/512,112/128); glVertex2f(497, 112); + glTexCoord2f(497/512,0);glVertex2f(497, 0); + glEnd; +} + gldisable(gl_texture_2d); + glDisable(GL_BLEND); + + // fade out at end of main part + if Ctime > Timings[19] then + begin + glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + end + else + if (CRDTS_Stage=Outro) then + begin + if CTime=Timings[20] then begin + CTime:=0; + Music.Stop; + Music.Open(soundpath + 'credits-outro-tune.mp3'); + Music.Play; + Music.SetLoop(True); + end; + if CTime > 231 then begin + Music.Play; + Ctime:=0; + end; + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + // do something useful + // outro background + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); + glEnd; + + //outro overlays + glColor4f(1, 1, 1, (1+sin(CTime/15))/3+1/3); + glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,223/256);glVertex2f(0, 223); + glTexCoord2f(487/512,223/256); glVertex2f(487, 223); + glTexCoord2f(487/512,0);glVertex2f(487, 0); + glEnd; + + ESC_Alpha:=20; + if (RandomRange(0,20) > 18) and (ESC_Alpha=20) then + ESC_Alpha:=0 + else inc(ESC_Alpha); + if ESC_Alpha > 20 then ESC_Alpha:=20; + glColor4f(1, 1, 1, ESC_Alpha/20); + glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(800-310, 600-247); + glTexCoord2f(0,247/256);glVertex2f(800-310, 600); + glTexCoord2f(310/512,247/256); glVertex2f(800, 600); + glTexCoord2f(310/512,0);glVertex2f(800, 600-247); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // outro scrollers? + // ... + end; + +{ // draw credits runtime counter + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (5, 5); + glColor4f(1, 1, 1, 1); +// RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10); + RuntimeStr:='CTime: '+inttostr(CTime); + glPrint (Addr(RuntimeStr[1])); +} + // make the stars shine + GoldenRec.Draw; + //timing hack +// Draw_FunkyText; end; end. -- cgit v1.2.3 From 8f170f0cad67b6bd94e04fe517ba3fe0dfe1099d Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 21 Jul 2007 00:09:19 +0000 Subject: notes can now have tiled texture (32x32 pixels) http://imageshock.eu/img/tilednotes_PoC.jpg http://imageshock.eu/img/tilednotes_PoC2.jpg git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@311 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 077f5121..df729bd4 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -255,11 +255,13 @@ begin Rec.Right := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - NotesW - 0.5 + 10*ScreenX; glBindTexture(GL_TEXTURE_2D, Tex_Mid[Color].TexNum); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glTexCoord2f((Rec.Right-Rec.Left)/32, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f((Rec.Right-Rec.Left)/32, 0); glVertex2f(Rec.Right, Rec.Top); glEnd; // prawa czesc - right part @@ -363,8 +365,8 @@ var glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glTexCoord2f((Rec.Right-Rec.Left)/32, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f((Rec.Right-Rec.Left)/32, 0); glVertex2f(Rec.Right, Rec.Top); glEnd; glColor3f(1, 1, 1); -- cgit v1.2.3 From 4d300a0b6d5b074fcea0a1cf9b04f180782aa1c1 Mon Sep 17 00:00:00 2001 From: mogguh Date: Sat, 21 Jul 2007 16:30:37 +0000 Subject: Timeprogressbar in singscreen has the new tile capability (8x8 px) Fixed a minor texture bug too New kinkier dx skin parts will arrive in the svn soon too git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@312 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index df729bd4..d9582aee 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -1646,20 +1646,22 @@ begin width:= Theme.Sing.StaticTimeProgress.w; height:= Theme.Sing.StaticTimeProgress.h; - glColor4f(Theme.Sing.StaticTimeProgress.ColR, - Theme.Sing.StaticTimeProgress.ColG, - Theme.Sing.StaticTimeProgress.ColB, 1); //Set Color + // glColor4f(Theme.Sing.StaticTimeProgress.ColR, + // Theme.Sing.StaticTimeProgress.ColG, + // Theme.Sing.StaticTimeProgress.ColB, 1); //Set Color glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBindTexture(GL_TEXTURE_2D, Tex_TimeProgress.TexNum); - +// glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); + // glBindTexture(GL_TEXTURE_2D, Tex_Lyric_Help_Bar.TexNum); + glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex2f(x,y); - glTexCoord2f(0, 1); glVertex2f(x+width*(Czas.Teraz/Czas.Razem), y); + glTexCoord2f(1, 0); glVertex2f(x+width*(Czas.Teraz/Czas.Razem), y); glTexCoord2f(1, 1); glVertex2f(x+width*(Czas.Teraz/Czas.Razem), y+height); - glTexCoord2f(1, 0); glVertex2f(x, y+height); + glTexCoord2f(0, 1); glVertex2f(x, y+height); glEnd; glDisable(GL_TEXTURE_2D); -- cgit v1.2.3 From 3c45a26796c089e79bce700729d019251adeeff3 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 21 Jul 2007 20:40:18 +0000 Subject: texture tiling for notes now stretches the middle part just as much as needed to seamlessly attach both ends git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@313 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index d9582aee..bf85888d 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -260,8 +260,8 @@ begin glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f((Rec.Right-Rec.Left)/32, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f((Rec.Right-Rec.Left)/32, 0); glVertex2f(Rec.Right, Rec.Top); + glTexCoord2f(round((Rec.Right-Rec.Left)/32), 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(round((Rec.Right-Rec.Left)/32), 0); glVertex2f(Rec.Right, Rec.Top); glEnd; // prawa czesc - right part @@ -362,11 +362,13 @@ var // glColor3f(R, G, B); // glBindTexture(GL_TEXTURE_2D, Tex_MidGray.TexNum); glBindTexture(GL_TEXTURE_2D, Tex_Mid[NrGracza+1].TexNum); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f((Rec.Right-Rec.Left)/32, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f((Rec.Right-Rec.Left)/32, 0); glVertex2f(Rec.Right, Rec.Top); + glTexCoord2f(round((Rec.Right-Rec.Left)/32), 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(round((Rec.Right-Rec.Left)/32), 0); glVertex2f(Rec.Right, Rec.Top); glEnd; glColor3f(1, 1, 1); -- cgit v1.2.3 From 4ddd757d3ee4fa079d8601e03dec0522940070cf Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 21 Jul 2007 20:48:07 +0000 Subject: Modified LoadTexture so that it ignores the Format parameter (for texture files, if supplied) but detects the file format by looking at the file's extension. Now any supported filetype can be used to skin USDX (not only JPG or BMP, which was hardcoded default everywhere) The remains of this former misguided policy are still in many places of the code and have to be removed over time. Also tried to remove most of the non-english comments and variable names git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@314 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 461 +++++++++++++++++++---------------------- 1 file changed, 215 insertions(+), 246 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 275f0748..43a8737e 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -14,11 +14,6 @@ interface uses OpenGL12, Windows, Math, Classes, SysUtils, Graphics, JPEG, UThemes, PNGImage; procedure glGenTextures(n: GLsizei; var textures: GLuint); stdcall; external opengl32; -//procedure glBindTexture(target: GLenum; texture: GLuint); stdcall; external opengl32; -//function gluBuild2DMipmaps (target: GLenum; components, width, height: GLint; -// format, atype: GLenum; data: Pointer): Integer; stdcall; external glu32; -//procedure glCopyTexImage2D(target: GLenum; level: GLint; internalFormat: GLenum; x, y: GLint; width, height: GLsizei; border: GLint); stdcall; external opengl32; - type TTexture = record @@ -66,9 +61,9 @@ type function GetTexture(Name, Typ: string): TTexture; overload; function GetTexture(Name, Typ: string; FromCache: boolean): TTexture; overload; function FindTexture(Name: string): integer; - function LoadTexture(FromRegistry: boolean; Nazwa, Format, Typ: PChar; Col: LongWord): TTexture; overload; - function LoadTexture(Nazwa, Format, Typ: PChar; Col: LongWord): TTexture; overload; - function LoadTexture(Nazwa: string): TTexture; overload; + function LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; + function LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; + function LoadTexture(Identifier: string): TTexture; overload; function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; procedure UnloadTexture(Name: string; FromCache: boolean); end; @@ -77,24 +72,14 @@ var Texture: TTextureUnit; TextureDatabase: TTextureDatabase; - - // for print screens -// PrintScreenTex: GLuint; -// PrintScreenData: array[0..480-1, 0..640-1] of longword; PrintScreenData: array[0..1024*768-1] of longword; -// Tekstur: Gluint; ActTex: GLuint;//integer; -{ Tekstura: array[1..32] of TTekstura; - Mipmapping: boolean = true;} - - TexOrygW: integer; - TexOrygH: integer; + TexOrigW: integer; + TexOrigH: integer; TexNewW: integer; TexNewH: integer; -{ RLE: array[1..128*128] of byte; - RLE2: array[1..128*128] of byte;} TexFitW: integer; TexFitH: integer; // new for limit @@ -107,15 +92,13 @@ var // total 40MB at 2048*2048 // total 10MB at 1024*1024 -{ Paleta: array[0..255, 1..4] of byte; - Len: integer;} Mipmapping: Boolean; CacheMipmap: array[0..256*256*3-1] of byte; // 3KB implementation -uses ULog, DateUtils, UCovers; +uses ULog, DateUtils, UCovers, StrUtils; function TTextureUnit.GetTexture(Name, Typ: string): TTexture; begin @@ -138,7 +121,7 @@ begin TextureDatabase.Texture[T].Name := Name; TextureDatabase.Texture[T].Typ := Typ; - // inform database that not textures has been loaded into memory + // inform database that no textures have been loaded into memory TextureDatabase.Texture[T].Texture.TexNum := -1; TextureDatabase.Texture[T].TextureCache.TexNum := -1; end; @@ -163,12 +146,6 @@ begin if TextureDatabase.Texture[T].TextureCache.TexNum = -1 then begin // load texture Covers.PrepareData(Name); -{ Covers.Data[0] := 0; - Covers.Data[1] := 0; - Covers.Data[2] := 0; - Covers.Data[3] := 255; - Covers.Data[4] := 255; - Covers.Data[5] := 255;} TextureDatabase.Texture[T].TextureCache := CreateTexture(Covers.Data, Name, Covers.Cover[C].W, Covers.Cover[C].H, 24); end; @@ -187,7 +164,7 @@ begin Result := T; end; -function TTextureUnit.LoadTexture(FromRegistry: boolean; Nazwa, Format, Typ: PChar; Col: LongWord): TTexture; +function TTextureUnit.LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; var Res: TResourceStream; TextureB: TBitmap; @@ -198,8 +175,8 @@ var TransparentColor: TColor; PixelColor: TColor; - Pet: integer; - Pet2: integer; + Position: integer; + Position2: integer; Pix: integer; ColInt: real; PPix: PByteArray; @@ -213,27 +190,35 @@ begin if FromRegistry then begin try - Res := TResourceStream.Create(HInstance, Nazwa, Format); + Res := TResourceStream.Create(HInstance, Identifier, Format); except beep; Exit; end; end; - if FromRegistry or ((not FromRegistry) and FileExists(Nazwa)) then begin + // filetype "detection" + if (not FromRegistry) and (FileExists(Identifier)) then begin + Format:=''; + Format := PAnsichar(UpperCase(RightStr(ExtractFileExt(Identifier),3))); + end; +// else Format:='JPG'; +// if not ((Format='BMP')or(Format='JPG')or(Format='PNG')) then Format:='JPG'; + + if FromRegistry or ((not FromRegistry) and FileExists(Identifier)) then begin TextureB := TBitmap.Create; if Format = 'BMP' then begin if FromRegistry then TextureB.LoadFromStream(Res) - else TextureB.LoadFromFile(Nazwa); + else TextureB.LoadFromFile(Identifier); end else if Format = 'JPG' then begin TextureJ := TJPEGImage.Create; if FromRegistry then TextureJ.LoadFromStream(Res) else begin - if FileExists(Nazwa) then - TextureJ.LoadFromFile(Nazwa) + if FileExists(Identifier) then + TextureJ.LoadFromFile(Identifier) else Exit; end; @@ -245,8 +230,8 @@ begin TexturePNG := TPNGObject.Create; if FromRegistry then TexturePNG.LoadFromStream(Res) else begin - if FileExists(Nazwa) then - TexturePNG.LoadFromFile(Nazwa) + if FileExists(Identifier) then + TexturePNG.LoadFromFile(Identifier) else Exit; end; @@ -258,13 +243,13 @@ begin if (TexturePNG.Header.ColorType = COLOR_GRAYSCALEALPHA) or (TexturePNG.Header.ColorType = COLOR_RGBALPHA) then begin - // i would have preferred english variables here but i use Pet because i'm lazy - for Pet := 0 to TextureB.Height - 1 do + // i would have preferred english variables here but i use Position because i'm lazy + for Position := 0 to TextureB.Height - 1 do begin - AlphaPtr := PByte(TexturePNG.AlphaScanline[Pet]); - for Pet2 := 0 to TextureB.Width - 1 do + AlphaPtr := PByte(TexturePNG.AlphaScanline[Position]); + for Position2 := 0 to TextureB.Width - 1 do begin - TextureAlpha[Pet*TextureB.Width+Pet2]:= AlphaPtr^; + TextureAlpha[Position*TextureB.Width+Position2]:= AlphaPtr^; Inc(AlphaPtr); end; end; @@ -278,7 +263,7 @@ begin if FromRegistry then Res.Free; if (TextureB.Width > 1024) or (TextureB.Height > 1024) then begin // will be fixed in 0.5.1 and dynamically extended to 8192x8192 depending on the driver - Log.LogError('Image ' + Nazwa + ' is too big (' + IntToStr(TextureB.Width) + 'x' + IntToStr(TextureB.Height) + ')'); + Log.LogError('Image ' + Identifier + ' is too big (' + IntToStr(TextureB.Width) + 'x' + IntToStr(TextureB.Height) + ')'); Result.TexNum := -1; end else begin @@ -289,46 +274,46 @@ begin glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); if Typ = 'Plain' then begin - // wymiary - TexOrygW := TextureB.Width; - TexOrygH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrygW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrygH)))); + // dimensions + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - // kopiowanie + // copy and process pixeldata TextureB.PixelFormat := pf24bit; { if (TextureB.PixelFormat = pf8bit) then begin - for Pet := 0 to TexOrygH-1 do begin - for Pet2 := 0 to TexOrygW-1 do begin - Pix := TextureB.Canvas.Pixels[Pet2, Pet]; - TextureD24[Pet*TexNewW + Pet2+1, 1] := Pix; - TextureD24[Pet*TexNewW + Pet2+1, 2] := Pix div 256; - TextureD24[Pet*TexNewW + Pet2+1, 3] := Pix div (256*256); + for Position := 0 to TexOrigH-1 do begin + for Position2 := 0 to TexOrigW-1 do begin + Pix := TextureB.Canvas.Pixels[Position2, Position]; + TextureD24[Position*TexNewW + Position2+1, 1] := Pix; + TextureD24[Position*TexNewW + Position2+1, 2] := Pix div 256; + TextureD24[Position*TexNewW + Position2+1, 3] := Pix div (256*256); end; end; end;} - if (TexOrygW <= Limit) and (TexOrygW <= Limit) then begin + if (TexOrigW <= Limit) and (TexOrigW <= Limit) then begin if (TextureB.PixelFormat = pf24bit) then begin - for Pet := 0 to TexOrygH-1 do begin - PPix := TextureB.ScanLine[Pet]; - for Pet2 := 0 to TexOrygW-1 do begin - TextureD24[Pet*TexNewW + Pet2+1, 1] := PPix[Pet2*3+2]; - TextureD24[Pet*TexNewW + Pet2+1, 2] := PPix[Pet2*3+1]; - TextureD24[Pet*TexNewW + Pet2+1, 3] := PPix[Pet2*3]; + for Position := 0 to TexOrigH-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TexOrigW-1 do begin + TextureD24[Position*TexNewW + Position2+1, 1] := PPix[Position2*3+2]; + TextureD24[Position*TexNewW + Position2+1, 2] := PPix[Position2*3+1]; + TextureD24[Position*TexNewW + Position2+1, 3] := PPix[Position2*3]; end; end; end; end else begin // limit - TexFitW := 4 * (TexOrygW div 4); // fix for bug in gluScaleImage - TexFitH := TexOrygH; + TexFitW := 4 * (TexOrigW div 4); // fix for bug in gluScaleImage + TexFitH := TexOrigH; if (TextureB.PixelFormat = pf24bit) then begin - for Pet := 0 to TexOrygH-1 do begin - PPix := TextureB.ScanLine[Pet]; - for Pet2 := 0 to TexOrygW-1 do begin - TextureD24[Pet*TexFitW + Pet2+1, 1] := PPix[Pet2*3+2]; - TextureD24[Pet*TexFitW + Pet2+1, 2] := PPix[Pet2*3+1]; - TextureD24[Pet*TexFitW + Pet2+1, 3] := PPix[Pet2*3]; + for Position := 0 to TexOrigH-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TexOrigW-1 do begin + TextureD24[Position*TexFitW + Position2+1, 1] := PPix[Position2*3+2]; + TextureD24[Position*TexFitW + Position2+1, 2] := PPix[Position2*3+1]; + TextureD24[Position*TexFitW + Position2+1, 3] := PPix[Position2*3]; end; end; end; @@ -337,25 +322,25 @@ begin TexNewW := Limit; TexNewH := Limit; - TexOrygW := Limit; - TexOrygH := Limit; + TexOrigW := Limit; + TexOrigH := Limit; end; // creating cache mipmap if CreateCacheMipmap then begin - if (TexOrygW <> TexNewW) or (TexOrygH <> TexNewH) then begin + if (TexOrigW <> TexNewW) or (TexOrigH <> TexNewH) then begin // texture only uses some of it's space. there's a need for resize to fit full size // and get best quality - TexFitW := 4 * (TexOrygW div 4); // 0.5.0: fix for bug in gluScaleImage - SkipX := (TexOrygW div 2) mod 2; // 0.5.0: try to center image - - TexFitH := TexOrygH; - for Pet := 0 to TexOrygH-1 do begin - PPix := TextureB.ScanLine[Pet]; - for Pet2 := 0 to TexOrygW-1 do begin - TextureD242[Pet*TexFitW + Pet2+1, 1] := PPix[(Pet2+SkipX)*3+2]; - TextureD242[Pet*TexFitW + Pet2+1, 2] := PPix[(Pet2+SkipX)*3+1]; - TextureD242[Pet*TexFitW + Pet2+1, 3] := PPix[(Pet2+SkipX)*3]; + TexFitW := 4 * (TexOrigW div 4); // 0.5.0: fix for bug in gluScaleImage + SkipX := (TexOrigW div 2) mod 2; // 0.5.0: try to center image + + TexFitH := TexOrigH; + for Position := 0 to TexOrigH-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TexOrigW-1 do begin + TextureD242[Position*TexFitW + Position2+1, 1] := PPix[(Position2+SkipX)*3+2]; + TextureD242[Position*TexFitW + Position2+1, 2] := PPix[(Position2+SkipX)*3+1]; + TextureD242[Position*TexFitW + Position2+1, 3] := PPix[(Position2+SkipX)*3]; end; end; gluScaleImage(GL_RGB, TexFitW, TexFitH, GL_UNSIGNED_BYTE, @TextureD242, @@ -363,7 +348,7 @@ begin end else begin // texture fits perfectly - gluScaleImage(GL_RGB, TexOrygW, TexOrygH, GL_UNSIGNED_BYTE, @TextureD24, + gluScaleImage(GL_RGB, TexOrigW, TexOrigH, GL_UNSIGNED_BYTE, @TextureD24, Covers.W, Covers.H, GL_UNSIGNED_BYTE, @CacheMipmap[0]); // takes some time end; end; @@ -376,31 +361,31 @@ begin end; if Typ = 'Transparent' then begin - // wymiary - TexOrygW := TextureB.Width; - TexOrygH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrygW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrygH)))); + // dimensions + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); TextureB.Width := TexNewW; TextureB.Height := TexNewH; - // kopiowanie - for Pet := 0 to TexOrygH-1 do begin - for Pet2 := 0 to TexOrygW-1 do begin - Pix := TextureB.Canvas.Pixels[Pet2, Pet]; + // copy and process pixeldata + for Position := 0 to TexOrigH-1 do begin + for Position2 := 0 to TexOrigW-1 do begin + Pix := TextureB.Canvas.Pixels[Position2, Position]; // ,- part of transparent png hack if ((Pix = $fefefe) or (Pix = Col)) and (length(TextureAlpha)=0) then begin //Small fix, that caused artefacts to be drawn (#fe == dec254) - TextureD32[Pet*TexNewW + Pet2 + 1, 1] := 0; - TextureD32[Pet*TexNewW + Pet2 + 1, 2] := 0; - TextureD32[Pet*TexNewW + Pet2 + 1, 3] := 0; - TextureD32[Pet*TexNewW + Pet2 + 1, 4] := 0; + TextureD32[Position*TexNewW + Position2 + 1, 1] := 0; + TextureD32[Position*TexNewW + Position2 + 1, 2] := 0; + TextureD32[Position*TexNewW + Position2 + 1, 3] := 0; + TextureD32[Position*TexNewW + Position2 + 1, 4] := 0; end else begin - TextureD32[Pet*TexNewW + Pet2+1, 1] := Pix; - TextureD32[Pet*TexNewW + Pet2+1, 2] := Pix div 256; - TextureD32[Pet*TexNewW + Pet2+1, 3] := Pix div (256*256); + TextureD32[Position*TexNewW + Position2+1, 1] := Pix; + TextureD32[Position*TexNewW + Position2+1, 2] := Pix div 256; + TextureD32[Position*TexNewW + Position2+1, 3] := Pix div (256*256); // transparent png hack start (part 2 of 2) if (Format = 'PNG') and (length(TextureAlpha) <> 0) then begin - myAlpha:=TextureAlpha[Pet*TexOrygW+Pet2]; + myAlpha:=TextureAlpha[Position*TexOrigW+Position2]; // the following calculations tweak transparency so that it really looks transparent myAlpha:=myAlpha-75; @@ -409,10 +394,10 @@ begin myAlpha:=myAlpha*myAlpha*myAlpha; myAlpha:=myAlpha*255; - TextureD32[Pet*TexNewW+Pet2+1,4]:=floor(myAlpha); + TextureD32[Position*TexNewW+Position2+1,4]:=floor(myAlpha); end else // transparent png hack end - TextureD32[Pet*TexNewW + Pet2+1, 4] := 255; + TextureD32[Position*TexNewW + Position2+1, 4] := 255; end; end; end; @@ -424,21 +409,21 @@ begin end; if Typ = 'Transparent Range' then begin - // wymiary - TexOrygW := TextureB.Width; - TexOrygH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrygW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrygH)))); + // dimensions + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); TextureB.Width := TexNewW; TextureB.Height := TexNewH; - // kopiowanie - for Pet := 0 to TexOrygH-1 do begin - for Pet2 := 0 to TexOrygW-1 do begin - Pix := TextureB.Canvas.Pixels[Pet2, Pet]; - TextureD32[Pet*TexNewW + Pet2+1, 1] := Pix; - TextureD32[Pet*TexNewW + Pet2+1, 2] := Pix div 256; - TextureD32[Pet*TexNewW + Pet2+1, 3] := Pix div (256*256); - TextureD32[Pet*TexNewW + Pet2+1, 4] := 256 - Pix div 256; + // copy and process pixeldata + for Position := 0 to TexOrigH-1 do begin + for Position2 := 0 to TexOrigW-1 do begin + Pix := TextureB.Canvas.Pixels[Position2, Position]; + TextureD32[Position*TexNewW + Position2+1, 1] := Pix; + TextureD32[Position*TexNewW + Position2+1, 2] := Pix div 256; + TextureD32[Position*TexNewW + Position2+1, 3] := Pix div (256*256); + TextureD32[Position*TexNewW + Position2+1, 4] := 256 - Pix div 256; end; end; glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); @@ -450,12 +435,12 @@ begin if Typ = 'Font' then begin TextureB.PixelFormat := pf24bit; - for Pet := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Pet]; - for Pet2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Pet2 * 3]; - TextureD16[Pet*TextureB.Width + Pet2 + 1, 1] := 255; - TextureD16[Pet*TextureB.Width + Pet2 + 1, 2] := Pix; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := 255; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := Pix; end; end; glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); @@ -469,10 +454,10 @@ begin if Typ = 'Font Outline' then begin TextureB.PixelFormat := pf24bit; - for Pet := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Pet]; - for Pet2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Pet2 * 3]; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; Col := Pix; if Col < 127 then Col := 127; @@ -483,8 +468,8 @@ begin if Pix < 95 then TempA := (Pix * 256) div 96; - TextureD16[Pet*TextureB.Width + Pet2 + 1, 1] := Col; - TextureD16[Pet*TextureB.Width + Pet2 + 1, 2] := TempA; + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; end; end; glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); @@ -498,10 +483,10 @@ begin if Typ = 'Font Outline 2' then begin TextureB.PixelFormat := pf24bit; - for Pet := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Pet]; - for Pet2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Pet2 * 3]; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; Col := Pix; if Col < 31 then Col := 31; @@ -510,8 +495,8 @@ begin if TempA >= 31 then TempA := 255; if Pix < 31 then TempA := Pix * (256 div 32); - TextureD16[Pet*TextureB.Width + Pet2 + 1, 1] := Col; - TextureD16[Pet*TextureB.Width + Pet2 + 1, 2] := TempA; + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; end; end; glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); @@ -524,24 +509,24 @@ begin end; if Typ = 'Font Black' then begin - // normalnie 0,125s bez niczego 0,015s - 0,030s z pix 0,125s - // wymiary + // normalnie 0,125s bez niczego 0,015s - 0,030s z pix 0,125s <-- ??? + // dimensions TextureB.PixelFormat := pf24bit; - TexOrygW := TextureB.Width; - TexOrygH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrygW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrygH)))); + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); TextureB.Width := TexNewW; TextureB.Height := TexNewH; - // kopiowanie - for Pet := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Pet]; - for Pet2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Pet2*3]; - TextureD32[Pet*TextureB.Width + Pet2 + 1, 1] := 255; - TextureD32[Pet*TextureB.Width + Pet2 + 1, 2] := 255; - TextureD32[Pet*TextureB.Width + Pet2 + 1, 3] := 255; - TextureD32[Pet*TextureB.Width + Pet2 + 1, 4] := 255 - (Pix mod 256); + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2*3]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); end; end; glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); @@ -549,42 +534,42 @@ begin if Typ = 'Alpha Black Colored' then begin TextureB.PixelFormat := pf24bit; - TexOrygW := TextureB.Width; - TexOrygH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrygW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrygH)))); + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); TextureB.Width := TexNewW; TextureB.Height := TexNewH; - // kopiowanie - for Pet := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Pet]; - for Pet2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Pet2*3]; - TextureD32[Pet*TextureB.Width + Pet2 + 1, 1] := (Col div $10000) and $FF; - TextureD32[Pet*TextureB.Width + Pet2 + 1, 2] := (Col div $100) and $FF; - TextureD32[Pet*TextureB.Width + Pet2 + 1, 3] := Col and $FF; - TextureD32[Pet*TextureB.Width + Pet2 + 1, 4] := 255 - (Pix mod 256); + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2*3]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := (Col div $10000) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Col div $100) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Col and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); end; end; glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); end; if Typ = 'Font Gray' then begin - // wymiary - TexOrygW := TextureB.Width; - TexOrygH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrygW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrygH)))); + // dimensions + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); TextureB.Width := TexNewW; TextureB.Height := TexNewH; - // kopiowanie - for Pet := 0 to TextureB.Height-1 do begin - for Pet2 := 0 to TextureB.Width-1 do begin - Pix := TextureB.Canvas.Pixels[Pet2, Pet]; - TextureD32[Pet*TextureB.Width + Pet2 + 1, 1] := 127; - TextureD32[Pet*TextureB.Width + Pet2 + 1, 2] := 127; - TextureD32[Pet*TextureB.Width + Pet2 + 1, 3] := 127; - TextureD32[Pet*TextureB.Width + Pet2 + 1, 4] := 255 - (Pix mod 256); + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + for Position2 := 0 to TextureB.Width-1 do begin + Pix := TextureB.Canvas.Pixels[Position2, Position]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); end; end; glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); @@ -596,10 +581,10 @@ begin if Typ = 'Arrow' then begin TextureB.PixelFormat := pf24bit; - for Pet := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Pet]; - for Pet2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Pet2 * 3]; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; // transparency if Pix >= 127 then TempA := 255; @@ -610,10 +595,10 @@ begin if Pix >= 127 then ColInt := 2 - Pix / 128; //0.75, 0.6, 0.25 - TextureD32[Pet*TextureB.Width + Pet2 + 1, 1] := Round(ColInt * 0.75 * 255 + (1 - ColInt) * 255); - TextureD32[Pet*TextureB.Width + Pet2 + 1, 2] := Round(ColInt * 0.6 * 255 + (1 - ColInt) * 255); - TextureD32[Pet*TextureB.Width + Pet2 + 1, 3] := Round(ColInt * 0.25 * 255 + (1 - ColInt) * 255); - TextureD32[Pet*TextureB.Width + Pet2 + 1, 4] := TempA; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Round(ColInt * 0.75 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := Round(ColInt * 0.6 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Round(ColInt * 0.25 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; end; end; glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); @@ -626,22 +611,22 @@ begin end; if Typ = 'Note Plain' then begin - for Pet := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Pet]; - for Pet2 := 0 to TextureB.Width-1 do begin + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin // Skin Patch // 0-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White - case PPix[Pet2*3] of - 0..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Pet2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Pet2*3]) div $Bf) + (((Col and $FF) * PPix[Pet2*3]) div $Bf); + case PPix[Position2*3] of + 0..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); 192: Pix := Col; - 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Pet2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Pet2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Pet2*3] - $C0) * 4)) div $FF)); + 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); 255: Pix := $FFFFFF; end; // 0.5.0. Original -// case PPix[Pet2*3] of +// case PPix[Position2*3] of // 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; // 192: Pix := Col; // 255: Pix := $FFFFFF; @@ -651,33 +636,33 @@ begin - TextureD24[Pet*TextureB.Width + Pet2 + 1, 1] := Pix div $10000; - TextureD24[Pet*TextureB.Width + Pet2 + 1, 2] := (Pix div $100) and $FF; - TextureD24[Pet*TextureB.Width + Pet2 + 1, 3] := Pix and $FF; + TextureD24[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; + TextureD24[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; + TextureD24[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; end; end; glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureB.Width, TextureB.Height, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); end; if Typ = 'Note Transparent' then begin - for Pet := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Pet]; - for Pet2 := 0 to TextureB.Width-1 do begin + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin TempA := 255; //Skin Patch // 0= Transparent, 1-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White - case PPix[Pet2*3] of + case PPix[Position2*3] of 0: TempA := 0; - 1..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Pet2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Pet2*3]) div $Bf) + (((Col and $FF) * PPix[Pet2*3]) div $Bf); + 1..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); 192: Pix := Col; - 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Pet2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Pet2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Pet2*3] - $C0) * 4)) div $FF)); + 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); 255: Pix := $FFFFFF; end; // 0.5.0 Original -// case PPix[Pet2*3] of +// case PPix[Position2*3] of // 0: TempA := 0; // 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; // 192: Pix := Col; @@ -687,25 +672,16 @@ begin - TextureD32[Pet*TextureB.Width + Pet2 + 1, 1] := Pix div $10000; - TextureD32[Pet*TextureB.Width + Pet2 + 1, 2] := (Pix div $100) and $FF; - TextureD32[Pet*TextureB.Width + Pet2 + 1, 3] := Pix and $FF; - TextureD32[Pet*TextureB.Width + Pet2 + 1, 4] := TempA; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; end; end; glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); end; - - - TextureB.Free; -// Inc(ActTex); -{ Tekst.Tekstura := ActTex; - Tekst.W := TexOrygW; - Tekst.H := TexOrygH; - Tekst.X2 := TexOrygW/TexNewW; - Tekst.Y2 := TexOrygH/TexNewH;} Result.X := 0; Result.Y := 0; Result.W := 0; @@ -714,8 +690,8 @@ begin Result.ScaleH := 1; Result.Rot := 0; Result.TexNum := ActTex; - Result.TexW := TexOrygW / TexNewW; - Result.TexH := TexOrygH / TexNewH; + Result.TexW := TexOrigW / TexNewW; + Result.TexH := TexOrigH / TexNewH; Result.Int := 1; Result.ColR := 1; @@ -730,32 +706,32 @@ begin Result.TexY2 := 1; // 0.5.0 - Result.Name := Nazwa; + Result.Name := Identifier; end; Log.BenchmarkEnd(4); if Log.BenchmarkTimeLength[4] >= 1 then - Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Nazwa + '/' + Typ, 4); + Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4); end; // logerror end; {procedure ResizeTexture(s: pbytearray; d: pbytearray); var - Pet: integer; - Pet2: integer; + Position: integer; + Position2: integer; begin - for Pet := 0 to TexNewH*4-1 do - for Pet2 := 0 to TexNewW-1 do - d[Pet*TexNewW + Pet2] := 0; - - for Pet := 0 to TexOrygH-1 do begin - for Pet2 := 0 to TexOrygW-1 do begin - d[(Pet*TexNewW + Pet2)*4] := Paleta[s[Pet*TexOrygW + Pet2], 1]; - d[(Pet*TexNewW + Pet2)*4+1] := Paleta[s[Pet*TexOrygW + Pet2], 2]; - d[(Pet*TexNewW + Pet2)*4+2] := Paleta[s[Pet*TexOrygW + Pet2], 3]; - d[(Pet*TexNewW + Pet2)*4+3] := Paleta[s[Pet*TexOrygW + Pet2], 4]; + for Position := 0 to TexNewH*4-1 do + for Position2 := 0 to TexNewW-1 do + d[Position*TexNewW + Position2] := 0; + + for Position := 0 to TexOrigH-1 do begin + for Position2 := 0 to TexOrigW-1 do begin + d[(Position*TexNewW + Position2)*4] := Paleta[s[Position*TexOrigW + Position2], 1]; + d[(Position*TexNewW + Position2)*4+1] := Paleta[s[Position*TexOrigW + Position2], 2]; + d[(Position*TexNewW + Position2)*4+2] := Paleta[s[Position*TexOrigW + Position2], 3]; + d[(Position*TexNewW + Position2)*4+3] := Paleta[s[Position*TexOrigW + Position2], 4]; end; end; end;} @@ -770,22 +746,22 @@ begin glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, p); end;} -function TTextureUnit.LoadTexture(Nazwa, Format, Typ: PChar; Col: LongWord): TTexture; +function TTextureUnit.LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; begin - Result := LoadTexture(false, Nazwa, Format, Typ, Col); -// Result := LoadTexture(SkinReg, Nazwa, Format, Typ, Col); // default to SkinReg + Result := LoadTexture(false, Identifier, Format, Typ, Col); +// Result := LoadTexture(SkinReg, Identifier, Format, Typ, Col); // default to SkinReg end; -function TTextureUnit.LoadTexture(Nazwa: string): TTexture; +function TTextureUnit.LoadTexture(Identifier: string): TTexture; begin - Result := LoadTexture(false, pchar(Nazwa), 'JPG', 'Plain', 0); + Result := LoadTexture(false, pchar(Identifier), 'JPG', 'Plain', 0); end; function TTextureUnit.CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; var - Pet: integer; - Pet2: integer; + Position: integer; + Position2: integer; Pix: integer; ColInt: real; PPix: PByteArray; @@ -806,13 +782,6 @@ begin if Error > 0 then beep; end; - -// Inc(ActTex); -{ Tekst.Tekstura := ActTex; - Tekst.W := TexOrygW; - Tekst.H := TexOrygH; - Tekst.X2 := TexOrygW/TexNewW; - Tekst.Y2 := TexOrygH/TexNewH;} Result.X := 0; Result.Y := 0; Result.W := 0; -- cgit v1.2.3 From e82d6d67a61bc5437074e9fe20a35d2c3945e6ab Mon Sep 17 00:00:00 2001 From: mogguh Date: Sat, 21 Jul 2007 21:43:39 +0000 Subject: Fixed df typo in skins which caused a major feature not show up There was an error while uploading UDraw.pas last time, fixed now Still working on eyecandy for dx skin, some snippets are in the svn now git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@315 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index bf85888d..8945e591 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -1648,21 +1648,19 @@ begin width:= Theme.Sing.StaticTimeProgress.w; height:= Theme.Sing.StaticTimeProgress.h; - // glColor4f(Theme.Sing.StaticTimeProgress.ColR, - // Theme.Sing.StaticTimeProgress.ColG, - // Theme.Sing.StaticTimeProgress.ColB, 1); //Set Color + glColor4f(Theme.Sing.StaticTimeProgress.ColR, + Theme.Sing.StaticTimeProgress.ColG, + Theme.Sing.StaticTimeProgress.ColB, 1); //Set Color glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBindTexture(GL_TEXTURE_2D, Tex_TimeProgress.TexNum); -// glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); - // glBindTexture(GL_TEXTURE_2D, Tex_Lyric_Help_Bar.TexNum); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex2f(x,y); - glTexCoord2f(1, 0); glVertex2f(x+width*(Czas.Teraz/Czas.Razem), y); - glTexCoord2f(1, 1); glVertex2f(x+width*(Czas.Teraz/Czas.Razem), y+height); + glTexCoord2f((width*(Czas.Teraz/Czas.Razem))/8, 0); glVertex2f(x+width*(Czas.Teraz/Czas.Razem), y); + glTexCoord2f((width*(Czas.Teraz/Czas.Razem))/8, 1); glVertex2f(x+width*(Czas.Teraz/Czas.Razem), y+height); glTexCoord2f(0, 1); glVertex2f(x, y+height); glEnd; -- cgit v1.2.3 From b9f7f03201214e97feebb101e3e2c0fd257353fc Mon Sep 17 00:00:00 2001 From: b1indy Date: Sun, 22 Jul 2007 14:07:29 +0000 Subject: fixed a minor bug in the reflection code that caused some reflections to be incorrectly drawn git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@316 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UMenuStatic.pas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UMenuStatic.pas b/Game/Code/Menu/UMenuStatic.pas index 2a5e1e93..41d5046f 100644 --- a/Game/Code/Menu/UMenuStatic.pas +++ b/Game/Code/Menu/UMenuStatic.pas @@ -52,13 +52,13 @@ begin //Bottom Left glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); - glTexCoord2f(TexX1*TexW, 0.5); + glTexCoord2f(TexX1*TexW, 0.5*TexH); glVertex3f(x, y+h*scaleH + h*scaleH/2 + Reflectionspacing, z); //Bottom Right glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); - glTexCoord2f(TexX2*TexW, 0.5); + glTexCoord2f(TexX2*TexW, 0.5*TexH); glVertex3f(x+w*scaleW, y+h*scaleH + h*scaleH/2 + Reflectionspacing, z); //Top Right @@ -68,7 +68,7 @@ begin glEnd; glDisable(GL_TEXTURE_2D); - glDisable(GL_DEPTH_TEST); + glDisable(GL_DEPTH_TEST); glDisable(GL_BLEND); end; end; -- cgit v1.2.3 From 210eeef171f0842a52e1a27008b4a7be41c50ee8 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sun, 22 Jul 2007 14:40:26 +0000 Subject: again some fixes in reflection code for buttons and statics git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@318 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UMenuButton.pas | 6 +++--- Game/Code/Menu/UMenuStatic.pas | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UMenuButton.pas b/Game/Code/Menu/UMenuButton.pas index fde808e2..919a18c9 100644 --- a/Game/Code/Menu/UMenuButton.pas +++ b/Game/Code/Menu/UMenuButton.pas @@ -418,7 +418,7 @@ begin Spacing := Reflectionspacing else Spacing := DeSelectReflectionspacing; - + with Texture do begin //Bind Tex and GL Attributes @@ -440,13 +440,13 @@ begin //Bottom Left glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); - glTexCoord2f(TexX1*TexW, {TexY1*TexH*}0.5); + glTexCoord2f(TexX1*TexW, TexY1+TexH*0.5); glVertex3f(x, y+h*scaleH + h*scaleH/2 + Spacing, z); //Bottom Right glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); - glTexCoord2f(TexX2*TexW, {TexY1*TexH*}0.5); + glTexCoord2f(TexX2*TexW, TexY1+TexH*0.5); glVertex3f(x+w*scaleW, y+h*scaleH + h*scaleH/2 + Spacing, z); //Top Right diff --git a/Game/Code/Menu/UMenuStatic.pas b/Game/Code/Menu/UMenuStatic.pas index 41d5046f..5f19fbf3 100644 --- a/Game/Code/Menu/UMenuStatic.pas +++ b/Game/Code/Menu/UMenuStatic.pas @@ -52,13 +52,13 @@ begin //Bottom Left glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); - glTexCoord2f(TexX1*TexW, 0.5*TexH); + glTexCoord2f(TexX1*TexW, 0.5*TexH+TexY1); glVertex3f(x, y+h*scaleH + h*scaleH/2 + Reflectionspacing, z); //Bottom Right glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); - glTexCoord2f(TexX2*TexW, 0.5*TexH); + glTexCoord2f(TexX2*TexW, 0.5*TexH+TexY1); glVertex3f(x+w*scaleW, y+h*scaleH + h*scaleH/2 + Reflectionspacing, z); //Top Right -- cgit v1.2.3 From a5955bf26ecfe0ec20c70aff6522d1f8bd2e677d Mon Sep 17 00:00:00 2001 From: b1indy Date: Sun, 22 Jul 2007 18:30:33 +0000 Subject: changed loading of transparent PNGs, should be slower now, might break with some PNG types but gives nice correct transparency for 24bit transparent PNGs git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@320 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 43a8737e..84604367 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -184,6 +184,8 @@ var Error: integer; SkipX: integer; myAlpha: Real; + myRGBABitmap: array of byte; + RGBPtr: PByte; begin Log.BenchmarkStart(4); Mipmapping := true; @@ -240,6 +242,7 @@ begin if (Typ = 'Transparent') and (TexturePNG.TransparencyMode = ptmPartial) then begin setlength(TextureAlpha, TextureB.Width*TextureB.Height); + setlength(MyRGBABitmap,TextureB.Width*TextureB.Height*4); if (TexturePNG.Header.ColorType = COLOR_GRAYSCALEALPHA) or (TexturePNG.Header.ColorType = COLOR_RGBALPHA) then begin @@ -247,9 +250,18 @@ begin for Position := 0 to TextureB.Height - 1 do begin AlphaPtr := PByte(TexturePNG.AlphaScanline[Position]); + RGBPtr:=PByte(TexturePNG.Scanline[Position]); for Position2 := 0 to TextureB.Width - 1 do begin TextureAlpha[Position*TextureB.Width+Position2]:= AlphaPtr^; + MyRGBABitmap[(Position*TextureB.Width+Position2)*4]:= RGBPtr^; + Inc(RGBPtr); + MyRGBABitmap[(Position*TextureB.Width+Position2)*4+1]:= RGBPtr^; + Inc(RGBPtr); + MyRGBABitmap[(Position*TextureB.Width+Position2)*4+2]:= RGBPtr^; + Inc(RGBPtr); + MyRGBABitmap[(Position*TextureB.Width+Position2)*4+3]:= AlphaPtr^; +// Inc(RGBPtr); Inc(AlphaPtr); end; end; @@ -379,28 +391,22 @@ begin TextureD32[Position*TexNewW + Position2 + 1, 2] := 0; TextureD32[Position*TexNewW + Position2 + 1, 3] := 0; TextureD32[Position*TexNewW + Position2 + 1, 4] := 0; + end else if (Format = 'PNG') and (length(TextureAlpha) <> 0) then begin + myAlpha:=TextureAlpha[Position*TexOrigW+Position2]; + TextureD32[Position*TexNewW + Position2+1, 1] := MyRGBABitmap[(Position*TexOrigW+Position2)*4+2]; + TextureD32[Position*TexNewW + Position2+1, 2] := MyRGBABitmap[(Position*TexOrigW+Position2)*4+1]; + TextureD32[Position*TexNewW + Position2+1, 3] := MyRGBABitmap[(Position*TexOrigW+Position2)*4]; + TextureD32[Position*TexNewW+Position2+1,4]:=MyRGBABitmap[(Position*TexOrigW+Position2)*4+3]; end else begin - TextureD32[Position*TexNewW + Position2+1, 1] := Pix; - TextureD32[Position*TexNewW + Position2+1, 2] := Pix div 256; - TextureD32[Position*TexNewW + Position2+1, 3] := Pix div (256*256); - // transparent png hack start (part 2 of 2) - if (Format = 'PNG') and (length(TextureAlpha) <> 0) then begin - myAlpha:=TextureAlpha[Position*TexOrigW+Position2]; - - // the following calculations tweak transparency so that it really looks transparent - myAlpha:=myAlpha-75; - if myAlpha < 0 then myAlpha:=0; - myAlpha:=myAlpha/180; - myAlpha:=myAlpha*myAlpha*myAlpha; - myAlpha:=myAlpha*255; - - TextureD32[Position*TexNewW+Position2+1,4]:=floor(myAlpha); - end else - // transparent png hack end - TextureD32[Position*TexNewW + Position2+1, 4] := 255; + TextureD32[Position*TexNewW + Position2+1, 1] := (Pix and $ff); + TextureD32[Position*TexNewW + Position2+1, 2] := ((Pix shr 8) and $ff); + TextureD32[Position*TexNewW + Position2+1, 3] := ((Pix shr 16) and $ff); + TextureD32[Position*TexNewW + Position2+1, 4] := 255; end; end; end; + setlength(TextureAlpha,0); + setlength(MyRGBABitmap,0); glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); { if Mipmapping then begin Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); -- cgit v1.2.3 From 5e7e58283dc7ba368bed77fe3d914cdb234198bb Mon Sep 17 00:00:00 2001 From: mogguh Date: Mon, 23 Jul 2007 11:39:24 +0000 Subject: Final work on credits (done :P - fuckings to the cia readers) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@322 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 43a9a3ca..fd80f1f5 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -67,24 +67,11 @@ type const Funky_Text: AnsiString = -{ 'Hey doodz, we made it! You had to wait very long cause we wanted it to be perfect. So here it is, the most perfect UltraStar you`ll ever get. We have this awesome stars, we have this awesome party mode with plugins, we have the best skins and yes we´re '+ - 'the best :P Whiteshark tried his best to fix all the bugs, and he has done an awesome job! Mota and Mog fired up their Photoshops to create this stunning skins, Blindy has brought you this massive stars and Canni did the documentation. BlindGuard hosts '+ - 'the forum, and oh my gosh he spends a lot of time fucking with all the wankers asking for mp3s. We also want to thank the people in the forum for their massive support and their patience xD Blindy and Mog also want to thank www.demoscene.tv for '+ - 'inspiration (yay Kewlerz suck, but we suck more) - also big shout outs to Einsiedler for brewing our favourite beer and dnbradio.com for the music. Big greetings from Mog to Antje too, I love you baby :X'; -} - 'So here we are, grandma deluxe has arrived. It´s Mog on the keyboard, but I speak for all of us teamers :P Took us '+ - 'longer than expected to come up with this, but hey you know good things take their time ;) As we tried to put in as '+ - 'many features as we have seen on the board (and our`s aswell), like the neat eyecandy (stars h00ray), the party mode, '+ - 'new awesome skins, fucking bugfixes (poor Whiteshark) and a hell lot of other stuff. I´m also proud to announce that '+ - 'we´re the only UltraStar with all this stuff, nice hu? ;) Maybe it´s about time to explain why it took so long, I just '+ - 'strip the part with lazy joker (has he done _anything_?) and all the other people who joined #ultra-star.dl.am on '+ - 'QuakeNet just to beg for a beta or wanted to "help" (hey I´m from a big newspaper). Actually there was a lot of code '+ - 'that had to be written up from scratch (party mode anyone?), and some of the stuff was pretty new to us (OpenGL h00ray). '+ - 'And it reallly didn´t help when people on the board didn´t stop arguing about the release date (I don´t say wankers), so '+ - 'next time some real help would be apprechiated - send us beer if you´re unskilled xD It´s almost sunset outside, time '+ - 'for the thanks then. We want to thank sourceforge for the hosting, BlindGuard for the board support (bet he has some '+ - 'grey hairs now), Wome for the tune you hear right now (thanks mate :X), Corvus5 for the work on UltraStar, our friends '+ - 'on the board (ultra-star.dl.am the place to be!), Einsiedler for the beer, the demoscene and weed for some inspiration...'; + 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+ + 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+ + 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to '+ + 'Demoscene.tv, scene.org, KakiArts, Sourceforge,..'; + Timings: array[0..21] of Cardinal=( 20, // 0 Delay vor Start @@ -972,7 +959,7 @@ Data := Music.GetFFTData; k:=0; for j:=0 to 40 do if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then begin + if Data[k]>0.2 then begin l:=RandomRange(6,16); j:=RandomRange(0,27); GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); @@ -1025,6 +1012,7 @@ Data := Music.GetFFTData; Music.Stop; Music.Open(soundpath + 'credits-outro-tune.mp3'); Music.Play; + Music.SetVolume(20); Music.SetLoop(True); end; if CTime > 231 then begin -- cgit v1.2.3 From f38fd7c6391b47f8d4693b13c83565f791f7300c Mon Sep 17 00:00:00 2001 From: mogguh Date: Mon, 23 Jul 2007 12:23:29 +0000 Subject: Really final work on credits (done! - stop reading cia, get rl) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@323 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index fd80f1f5..b69c17aa 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -69,8 +69,8 @@ const Funky_Text: AnsiString = 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+ 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+ - 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to '+ - 'Demoscene.tv, scene.org, KakiArts, Sourceforge,..'; + 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+ + 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..'; Timings: array[0..21] of Cardinal=( -- cgit v1.2.3 From 2381fe1d1dcdde5e4a3adcdf55796c2d723b8cf7 Mon Sep 17 00:00:00 2001 From: b1indy Date: Wed, 25 Jul 2007 12:45:29 +0000 Subject: fixed some minor glitches in the credits screen (transparent texture was not totally transparent, which could be seen with now working transparency in trunk) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@330 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index b69c17aa..a0ef01af 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -15,7 +15,7 @@ type Credits_Time: Cardinal; Credits_Alpha: Cardinal; CTime: Cardinal; - CTime_hold: array of Cardinal; + CTime_hold: Cardinal; ESC_Alpha: Integer; credits_entry_tex: TTexture; @@ -55,6 +55,8 @@ type CRDTS_Stage: TCreditsStages; + myTex: glUint; + Fadeout: boolean; constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; @@ -115,12 +117,12 @@ begin FadeTo(@ScreenMain); Music.PlayBack; end; - SDLK_SPACE: +{ SDLK_SPACE: begin setlength(CTime_hold,length(CTime_hold)+1); CTime_hold[high(CTime_hold)]:=CTime; end; - +} end;//esac end; //fi end; @@ -153,7 +155,7 @@ begin outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0); outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0); - outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Plain', 0); + outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Transparent', 0); CRDTS_Stage:=InitialDelay; end; @@ -173,7 +175,7 @@ begin Music.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! // Music.Play; CTime:=0; - setlength(CTime_hold,0); +// setlength(CTime_hold,0); end; procedure TScreenCredits.onHide; @@ -220,7 +222,7 @@ begin inc(CurrentScrollEnd); end; end; - // timing hack +{ // timing hack X:=5; SetFontStyle (2); SetFontItalic(False); @@ -231,7 +233,7 @@ begin SetFontPos (500, X); glPrint (Addr(visibleText[0])); X:=X+20; - end; + end;} end; procedure Start3D; @@ -266,6 +268,8 @@ var myColor: Cardinal; myScale: Real; myAngle: Real; + + const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24), (154,31),(156,58),(168,32),(203,36), (258,34),(251,50),(274,93),(294,84), @@ -285,6 +289,7 @@ Data := Music.GetFFTData; begin Credits_Time := T; inc(CTime); + inc(CTime_hold); Credits_X := Credits_X-2; if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then begin @@ -1008,16 +1013,16 @@ Data := Music.GetFFTData; if (CRDTS_Stage=Outro) then begin if CTime=Timings[20] then begin - CTime:=0; + CTime_hold:=0; Music.Stop; Music.Open(soundpath + 'credits-outro-tune.mp3'); Music.Play; Music.SetVolume(20); Music.SetLoop(True); end; - if CTime > 231 then begin + if CTime_hold > 231 then begin Music.Play; - Ctime:=0; + Ctime_hold:=0; end; glClearColor(0,0,0,0); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); @@ -1079,9 +1084,6 @@ Data := Music.GetFFTData; } // make the stars shine GoldenRec.Draw; - - //timing hack -// Draw_FunkyText; end; end. -- cgit v1.2.3 From b7f377e62a7e941d7898c187a63dd6ed99b0798f Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 28 Jul 2007 13:29:32 +0000 Subject: experimental ffmpeg videodecoding support, frameskipping doesn't work quite right yet git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@332 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/SMpeg/Uffmpeg.pas | 265 ++++++++++++++++++++++++++++++++++++++ Game/Code/Screens/UScreenSing.pas | 35 +++-- Game/Code/UltraStar.dpr | 28 +--- 3 files changed, 292 insertions(+), 36 deletions(-) create mode 100644 Game/Code/SMpeg/Uffmpeg.pas (limited to 'Game/Code') diff --git a/Game/Code/SMpeg/Uffmpeg.pas b/Game/Code/SMpeg/Uffmpeg.pas new file mode 100644 index 00000000..3d21f33c --- /dev/null +++ b/Game/Code/SMpeg/Uffmpeg.pas @@ -0,0 +1,265 @@ +unit Uffmpeg; + +interface +uses SDL, UGraphicClasses, textgl, avcodec, avformat, avutil, math, OpenGL12, SysUtils, UIni, dialogs; + +procedure Init; +procedure FFmpegOpenFile(FileName: pAnsiChar); +procedure FFmpegClose; +procedure FFmpegGetFrame(Time: Extended); +procedure FFmpegDrawGL; +procedure FFmpegTogglePause; +procedure FFmpegSkip(Time: Single); + +var + VideoOpened, VideoPaused: Boolean; + VideoFormatContext: PAVFormatContext; + VideoStreamIndex: Integer; + VideoCodecContext: PAVCodecContext; + VideoCodec: PAVCodec; + AVFrame: PAVFrame; + AVFrameRGB: PAVFrame; + myBuffer: pByte; + VideoTex: glUint; + TexX, TexY, dataX, dataY: Cardinal; + TexData: array of Byte; + ScaledVideoWidth, ScaledVideoHeight: Real; + VideoAspect: Real; + VideoTextureU, VideoTextureV: Real; + VideoTimeBase, VideoTime, LastFrameTime, TimeDifference: Extended; + VideoSkipTime: Single; + +implementation + +const DebugDisplay=True; + +procedure Init; +begin + av_register_all; + VideoOpened:=False; + VideoPaused:=False; + glGenTextures(1, PglUint(&VideoTex)); + SetLength(TexData,0); +end; + +procedure FFmpegOpenFile(FileName: pAnsiChar); +var errnum, i, x,y: Integer; +begin + VideoOpened:=False; + VideoPaused:=False; + VideoTimeBase:=0; + VideoTime:=0; + LastFrameTime:=0; + TimeDifference:=0; + errnum:=av_open_input_file(VideoFormatContext, FileName, Nil, 0, Nil); + if(errnum <> 0) + then begin + case errnum of + AVERROR_UNKNOWN: showmessage('failed to open file '+Filename+#13#10+'AVERROR_UNKNOWN'); + AVERROR_IO: showmessage('failed to open file '+Filename+#13#10+'AVERROR_IO'); + AVERROR_NUMEXPECTED: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NUMEXPECTED'); + AVERROR_INVALIDDATA: showmessage('failed to open file '+Filename+#13#10+'AVERROR_INVALIDDATA'); + AVERROR_NOMEM: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NOMEM'); + AVERROR_NOFMT: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NOFMT'); + AVERROR_NOTSUPP: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NOTSUPP'); + else showmessage('failed to open file '+Filename+#13#10+'Error number: '+inttostr(Errnum)); + end; + Exit; + end + else begin + VideoStreamIndex:=-1; + if(av_find_stream_info(VideoFormatContext)>=0) then + begin + for i:=0 to VideoFormatContext^.nb_streams-1 do + if(VideoFormatContext^.streams[i]^.codec^.codec_type=CODEC_TYPE_VIDEO) then begin + VideoStreamIndex:=i; + end else + end; + if(VideoStreamIndex >= 0) then + begin + VideoCodecContext:=VideoFormatContext^.streams[VideoStreamIndex]^.codec; + VideoCodec:=avcodec_find_decoder(VideoCodecContext^.codec_id); + end else showmessage('found no video stream'); + if(VideoCodec<>Nil) then + begin + errnum:=avcodec_open(VideoCodecContext, VideoCodec); + end else showmessage('no matching codec found'); + if(errnum >=0) then + begin + showmessage('Found a matching Codec:'+#13#10#13#10+ + 'Width='+inttostr(VideoCodecContext^.width)+ + ', Height='+inttostr(VideoCodecContext^.height)+#13#10+ + 'Aspect: '+inttostr(VideoCodecContext^.sample_aspect_ratio.num)+'/'+inttostr(VideoCodecContext^.sample_aspect_ratio.den)+#13#10+ + 'Framerate: '+inttostr(VideoCodecContext^.time_base.num)+'/'+inttostr(VideoCodecContext^.time_base.den)); + // allocate space for decoded frame and rgb frame + AVFrame:=avcodec_alloc_frame; + AVFrameRGB:=avcodec_alloc_frame; + end; + myBuffer:=Nil; + if(AVFrame <> Nil) and (AVFrameRGB <> Nil) then + begin + myBuffer:=av_malloc(avpicture_get_size(PIX_FMT_RGB24, VideoCodecContext^.width, + VideoCodecContext^.height)); + end; + if myBuffer <> Nil then errnum:=avpicture_fill(PAVPicture(AVFrameRGB), myBuffer, PIX_FMT_RGB24, + VideoCodecContext^.width, VideoCodecContext^.height) + else showmessage('failed to allocate video buffer'); + if errnum >=0 then + begin + VideoOpened:=True; + + TexX := VideoCodecContext^.width; + TexY := VideoCodecContext^.height; + dataX := Round(Power(2, Ceil(Log2(TexX)))); + dataY := Round(Power(2, Ceil(Log2(TexY)))); + SetLength(TexData,dataX*dataY*3); + // calculate some information for video display + VideoAspect:=VideoCodecContext^.sample_aspect_ratio.num/VideoCodecContext^.sample_aspect_ratio.den; + if (VideoAspect = 0) then + VideoAspect:=VideoCodecContext^.width/VideoCodecContext^.height + else + VideoAspect:=VideoAspect*VideoCodecContext^.width/VideoCodecContext^.height; + if VideoAspect >= 4/3 then + begin + ScaledVideoWidth:=800.0; + ScaledVideoHeight:=800.0/VideoAspect; + end else + begin + ScaledVideoHeight:=600.0; + ScaledVideoWidth:=600.0*VideoAspect; + end; + VideoTimeBase:=VideoCodecContext^.time_base.num/VideoCodecContext^.time_base.den; + if (VideoAspect*VideoCodecContext^.width*VideoCodecContext^.height)>200000 then + showmessage('you are trying to play a rather large video'+#13#10+ + 'be prepared to experience some timing problems'); + end; + end; +end; + +procedure FFmpegClose; +begin + if VideoOpened then begin + av_free(myBuffer); + av_free(AVFrameRGB); + av_free(AVFrame); + avcodec_close(VideoCodecContext); + av_close_input_file(VideoFormatContext); + SetLength(TexData,0); + VideoOpened:=False; + end; +end; + +procedure FFmpegTogglePause; +begin + if VideoPaused then VideoPaused:=False + else VideoPaused:=True; +end; + +procedure FFmpegSkip(Time: Single); +begin + VideoSkiptime:=Time; +end; + +procedure FFmpegGetFrame(Time: Extended); +var + FrameFinished: Integer; + AVPacket: TAVPacket; + errnum, x, y: Integer; + FrameDataPtr: PByteArray; + linesize: integer; + myTime: Extended; +begin + if not VideoOpened then Exit; + if VideoPaused then Exit; + myTime:=Time+VideoSkipTime; + TimeDifference:=myTime-VideoTime; +{ showmessage('Time: '+inttostr(floor(Time*1000))+#13#10+ + 'VideoTime: '+inttostr(floor(VideoTime*1000))+#13#10+ + 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ + 'TimeDiff: '+inttostr(floor(TimeDifference*1000))); +} + if (VideoTime <> 0) and (TimeDifference <= VideoTimeBase) then begin + if DebugDisplay then GoldenRec.Spawn(200,15,1,16,0,-1,ColoredStar,$00ff00); +{ showmessage('not getting new frame'+#13#10+ + 'Time: '+inttostr(floor(Time*1000))+#13#10+ + 'VideoTime: '+inttostr(floor(VideoTime*1000))+#13#10+ + 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ + 'TimeDiff: '+inttostr(floor(TimeDifference*1000))); +} + Exit;// we don't need a new frame now + end; + VideoTime:=VideoTime+VideoTimeBase; + TimeDifference:=myTime-VideoTime; + if TimeDifference >= 3*VideoTimeBase then begin // skip frames + if DebugDisplay then GoldenRec.Spawn(200,35,1,16,0,-1,ColoredStar,$ff0000); +// showmessage('skipping frames'+#13#10+ +// 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ +// 'TimeDiff: '+inttostr(floor(TimeDifference*1000))+#13#10+ +// 'Time2Skip: '+inttostr(floor((Time-LastFrameTime)*1000))); +// av_seek_frame(VideoFormatContext,VideoStreamIndex,Floor(Time*VideoTimeBase),0); + av_seek_frame(VideoFormatContext,-1,Floor((myTime)*1100000),0); + VideoTime:=floor(myTime/VideoTimeBase)*VideoTimeBase; + end; + + FrameFinished:=0; + // read packets until we have a finished frame (or there are no more packets) + while (FrameFinished=0) and (av_read_frame(VideoFormatContext, @AVPacket)>=0) do + begin + // if we got a packet from the video stream, then decode it + if (AVPacket.stream_index=VideoStreamIndex) then + errnum:=avcodec_decode_video(VideoCodecContext, AVFrame, @frameFinished, + AVPacket.data, AVPacket.size); + // release internal packet structure created by av_read_frame + av_free_packet(PAVPacket(@AVPacket)); + end; + // if we did not get an new frame, there's nothing more to do + if Framefinished=0 then Exit; + // otherwise we convert the pixeldata from YUV to RGB + errnum:=img_convert(PAVPicture(AVFrameRGB), PIX_FMT_RGB24, + PAVPicture(AVFrame), VideoCodecContext^.pix_fmt, + VideoCodecContext^.width, VideoCodecContext^.height); + if errnum >=0 then begin + // copy RGB pixeldata to our TextureBuffer + // (line by line) + FrameDataPtr:=AVFrameRGB^.data[0]; + linesize:=AVFrameRGB^.linesize[0]; + for y:=0 to TexY-1 do begin + System.Move(FrameDataPtr[y*linesize],TexData[3*y*dataX],linesize); + end; + + // generate opengl texture out of whatever we got + glBindTexture(GL_TEXTURE_2D, VideoTex); + glTexImage2D(GL_TEXTURE_2D, 0, 3, dataX, dataY, 0, GL_RGB, GL_UNSIGNED_BYTE, TexData); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + end; +end; + +procedure FFmpegDrawGL; +begin + if not VideoOpened then Exit; + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, VideoTex); + glbegin(gl_quads); + glTexCoord2f( 0, 0); glVertex2f(400-ScaledVideoWidth/2, 300-ScaledVideoHeight/2); + glTexCoord2f( 0, TexY/dataY); glVertex2f(400-ScaledVideoWidth/2, 300+ScaledVideoHeight/2); + glTexCoord2f(TexX/dataX, TexY/dataY); glVertex2f(400+ScaledVideoWidth/2, 300+ScaledVideoHeight/2); + glTexCoord2f(TexX/dataX, 0); glVertex2f(400+ScaledVideoWidth/2, 300-ScaledVideoHeight/2); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + if DebugDisplay then begin + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (5, 0); + glPrint('delaying frame'); + SetFontPos (5, 20); + glPrint('dropping frame'); + end; +end; + +end. diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 2ba7522f..4bf405f6 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -3,7 +3,7 @@ unit UScreenSing; interface uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, ULyrics, - TextGL, OpenGL12, BASS, UThemes, ULCD, UGraphicClasses; + TextGL, OpenGL12, BASS, UThemes, ULCD, UGraphicClasses, Uffmpeg; type TScreenSing = class(TMenu) @@ -145,7 +145,7 @@ begin //stop Music Music.Pause; if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then //Video - PauseSmpeg; //Video + FFmpegTogglePause;//PauseSmpeg; //Video end else //Pause ausschalten begin @@ -153,7 +153,7 @@ begin Music.MoveTo (PauseTime);//Position of Music Music.Play; //Play Music if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then //Video - PlaySmpeg; + FFmpegTogglePause;//PlaySmpeg; //SkipSmpeg(PauseTime); Paused := false; end; @@ -222,6 +222,7 @@ begin LyricMain := TLyric.Create; LyricSub := TLyric.Create; + Uffmpeg.Init; end; procedure TScreenSing.onShow; @@ -349,8 +350,11 @@ begin // set movie if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin - OpenSmpeg(AktSong.Path + AktSong.Video); - SkipSmpeg(AktSong.VideoGAP + AktSong.Start); +{ OpenSmpeg(AktSong.Path + AktSong.Video); + SkipSmpeg(AktSong.VideoGAP + AktSong.Start);} + // todo: VideoGap and Start time verwursten + FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); + FFmpegSkip(AktSong.VideoGAP + AktSong.Start); AktSong.VideoLoaded := true; end; @@ -739,14 +743,17 @@ begin if AktSong.VideoLoaded then begin try - PlaySmpeg; + FFmpegGetFrame(Czas.Teraz); + FFmpegDrawGL; +// PlaySmpeg; except //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video AktSong.VideoLoaded := False; Log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); Log.LogError('Corrupted File: ' + AktSong.Video); try - CloseSmpeg; +// CloseSmpeg; + FFmpegClose; except end; @@ -1061,14 +1068,19 @@ begin // update and draw movie if ShowFinish and AktSong.VideoLoaded then begin try - UpdateSmpeg; // this only draws +// UpdateSmpeg; // this only draws + // todo: find a way to determine, when a new frame is needed + // toto: same for the need to skip frames + FFmpegGetFrame(Czas.Teraz); + FFmpegDrawGL; except //If an Error occurs drawing: prevent Video from being Drawn again and Close Video AktSong.VideoLoaded := False; log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); Log.LogError('Corrupted File: ' + AktSong.Video); try - CloseSmpeg; +// CloseSmpeg; + FFmpegClose; except end; @@ -1095,7 +1107,7 @@ begin end; end; end; - + // draw custom items SingDraw; // always draw @@ -1143,7 +1155,8 @@ begin end; if AktSong.VideoLoaded then begin - CloseSmpeg; +// CloseSmpeg; + FFmpegClose; AktSong.VideoLoaded := false; // to prevent drawing closed video end; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index a49d43c2..e523e98e 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -5,9 +5,6 @@ program UltraStar; {$R 'UltraStar.res' 'UltraStar.rc'} uses - //------------------------------ - //Includes - Menu System - //------------------------------ UDisplay in 'Menu\UDisplay.pas', UMenu in 'Menu\UMenu.pas', UMenuStatic in 'Menu\UMenuStatic.pas', @@ -18,10 +15,6 @@ uses UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', UDrawTexture in 'Menu\UDrawTexture.pas', UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', - - //------------------------------ - //Includes - Classes - //------------------------------ UGraphic in 'Classes\UGraphic.pas', UTexture in 'Classes\UTexture.pas', UMusic in 'Classes\UMusic.pas', @@ -49,11 +42,7 @@ uses UDLLManager in 'Classes\UDLLManager.pas', UParty in 'Classes\UParty.pas', UPlaylist in 'Classes\UPlaylist.pas', - UCommandLine in 'Classes\UCommandLine.pas', - - //------------------------------ - //Includes - Screens - //------------------------------ + UCommandLine in 'Classes\UCommandLine.pas', UScreenLoading in 'Screens\UScreenLoading.pas', UScreenWelcome in 'Screens\UScreenWelcome.pas', UScreenMain in 'Screens\UScreenMain.pas', @@ -82,28 +71,17 @@ uses UScreenStatDetail in 'Screens\UScreenStatDetail.pas', UScreenCredits in 'Screens\UScreenCredits.pas', UScreenPopup in 'Screens\UScreenPopup.pas', - - //------------------------------ - //Includes - Screens PartyMode - //------------------------------ UScreenSingModi in 'Screens\UScreenSingModi.pas', UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', UScreenPartyScore in 'Screens\UScreenPartyScore.pas', UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', UScreenPartyWin in 'Screens\UScreenPartyWin.pas', - - //------------------------------ - //Includes - Modi SDK - //------------------------------ ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', - - //------------------------------ - //Includes - Delphi - //------------------------------ Windows, SDL, - SysUtils; + SysUtils, + Uffmpeg in 'SMpeg\Uffmpeg.pas'; const Version = 'UltraStar Deluxe V 1.00 RC1'; -- cgit v1.2.3 From 8fdda6d85ec57fafe7e32d945c846976b531ea41 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 28 Jul 2007 15:17:15 +0000 Subject: fixed a typo git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@334 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/SMpeg/Uffmpeg.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/SMpeg/Uffmpeg.pas b/Game/Code/SMpeg/Uffmpeg.pas index 3d21f33c..d6e8cc81 100644 --- a/Game/Code/SMpeg/Uffmpeg.pas +++ b/Game/Code/SMpeg/Uffmpeg.pas @@ -38,7 +38,7 @@ begin av_register_all; VideoOpened:=False; VideoPaused:=False; - glGenTextures(1, PglUint(&VideoTex)); + glGenTextures(1, PglUint(@VideoTex)); SetLength(TexData,0); end; -- cgit v1.2.3 From 7c7e9d3ce5bb706ae0edd0e6802fed873aab1bb0 Mon Sep 17 00:00:00 2001 From: b1indy Date: Wed, 22 Aug 2007 08:27:02 +0000 Subject: black background for videos debug display off credit to the ffmpeg&SDL tutorial git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@350 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/SMpeg/Uffmpeg.pas | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/SMpeg/Uffmpeg.pas b/Game/Code/SMpeg/Uffmpeg.pas index d6e8cc81..2b8f1f44 100644 --- a/Game/Code/SMpeg/Uffmpeg.pas +++ b/Game/Code/SMpeg/Uffmpeg.pas @@ -1,3 +1,10 @@ +{############################################################################ +# FFmpeg support for UltraStar deluxe # +# # +# Created by b1indy # +# based on 'An ffmpeg and SDL Tutorial' (http://www.dranger.com/ffmpeg/) # +#############################################################################} + unit Uffmpeg; interface @@ -31,7 +38,7 @@ var implementation -const DebugDisplay=True; +const DebugDisplay=False; procedure Init; begin @@ -86,8 +93,9 @@ begin end else showmessage('no matching codec found'); if(errnum >=0) then begin - showmessage('Found a matching Codec:'+#13#10#13#10+ - 'Width='+inttostr(VideoCodecContext^.width)+ + if DebugDisplay then + showmessage('Found a matching Codec:'+#13#10#13#10+ + 'Width='+inttostr(VideoCodecContext^.width)+ ', Height='+inttostr(VideoCodecContext^.height)+#13#10+ 'Aspect: '+inttostr(VideoCodecContext^.sample_aspect_ratio.num)+'/'+inttostr(VideoCodecContext^.sample_aspect_ratio.den)+#13#10+ 'Framerate: '+inttostr(VideoCodecContext^.time_base.num)+'/'+inttostr(VideoCodecContext^.time_base.den)); @@ -129,7 +137,7 @@ begin ScaledVideoWidth:=600.0*VideoAspect; end; VideoTimeBase:=VideoCodecContext^.time_base.num/VideoCodecContext^.time_base.den; - if (VideoAspect*VideoCodecContext^.width*VideoCodecContext^.height)>200000 then + if (DebugDisplay) and ((VideoAspect*VideoCodecContext^.width*VideoCodecContext^.height)>200000) then showmessage('you are trying to play a rather large video'+#13#10+ 'be prepared to experience some timing problems'); end; @@ -238,6 +246,8 @@ end; procedure FFmpegDrawGL; begin if not VideoOpened then Exit; + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT and GL_DEPTH_BUFFER_BIT); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glColor4f(1, 1, 1, 1); -- cgit v1.2.3 From 1492c2f949ded1bfc34623676d132cb07fb5ba1f Mon Sep 17 00:00:00 2001 From: b1indy Date: Wed, 22 Aug 2007 08:53:14 +0000 Subject: now the background is black git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@351 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/SMpeg/Uffmpeg.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/SMpeg/Uffmpeg.pas b/Game/Code/SMpeg/Uffmpeg.pas index 2b8f1f44..753d3dd9 100644 --- a/Game/Code/SMpeg/Uffmpeg.pas +++ b/Game/Code/SMpeg/Uffmpeg.pas @@ -247,7 +247,7 @@ procedure FFmpegDrawGL; begin if not VideoOpened then Exit; glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT and GL_DEPTH_BUFFER_BIT); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glColor4f(1, 1, 1, 1); -- cgit v1.2.3 From bcc359df110e8fbd6737aba1e3365f880d1413e4 Mon Sep 17 00:00:00 2001 From: b1indy Date: Wed, 22 Aug 2007 13:40:42 +0000 Subject: limit number of displayed background covers to no more than 21 - need comments on this git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@352 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 3221f21e..9d3111cb 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -4,7 +4,7 @@ interface uses UMenu, SDL, UMusic, UFiles, UTime, UDisplay, USongs, SysUtils, ULog, UThemes, UTexture, ULanguage, - ULCD, ULight, UIni; + ULCD, ULight, UIni, TextGL; type TScreenSong = class(TMenu) @@ -1185,7 +1185,7 @@ begin if (Abs(Pos) < 2.5) then {fixed Positions} begin Angle := Pi * (Pos / 5); - //Button[B].Visible := False; +// Button[B].Visible := False; Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); @@ -1208,13 +1208,16 @@ begin end else begin {Behind the Front Covers} -// Button[B].Visible := False; -// if VS/2-abs(Pos)>VS*0.4 then Button[B].Visible := False; + + // limit-bg-covers hack + if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; + if VS > 25 then VS:=25; + // end of limit-bg-covers hack if Pos < 0 then - Pos := (Pos - VS/2) /VS + Pos := (Pos - VS/2)/VS else - Pos := (Pos + VS/2) /VS; + Pos := (Pos + VS/2)/VS; Angle := pi * Pos*2; @@ -1381,7 +1384,7 @@ begin Music.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) else Music.SetMusicVolume(Ini.PreviewVolume * 10); - + end; @@ -1421,6 +1424,16 @@ begin DrawEqualizer; DrawExtensions; + + + glColor4f(1, 1, 1, 1); + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (5, 0); + glPrint(pAnsiChar(inttostr(floor(CatSongs.VisibleSongs)))); + + end; procedure TScreenSong.SelectNext; -- cgit v1.2.3 From 1c21e36f56107091ca675559c440688fd95b384f Mon Sep 17 00:00:00 2001 From: b1indy Date: Wed, 22 Aug 2007 14:58:19 +0000 Subject: fixed a bug in drawing of background covers (when style=5 (usdx theme default)) added a new style for the song covers ("slotmachine" like, style=6) - still needs adjustments git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@353 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 123 ++++++++++++++++++++++++++++++++++---- 1 file changed, 111 insertions(+), 12 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 9d3111cb..e346d59e 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -4,7 +4,7 @@ interface uses UMenu, SDL, UMusic, UFiles, UTime, UDisplay, USongs, SysUtils, ULog, UThemes, UTexture, ULanguage, - ULCD, ULight, UIni, TextGL; + ULCD, ULight, UIni; type TScreenSong = class(TMenu) @@ -69,6 +69,7 @@ type procedure SetScroll3; procedure SetScroll4; procedure SetScroll5; + procedure SetScroll6; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; function Draw: boolean; override; procedure onShow; override; @@ -806,6 +807,7 @@ begin else SetScroll4; end; + 6: SetScroll6; else SetScroll4; end; //Set Visibility of Video Icon @@ -1173,7 +1175,7 @@ begin //Change Pos of all Buttons for B := low(Button) to high(Button) do begin - Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visability + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility if Button[B].Visible then //Only Change Pos for Visible Buttons begin Pos := (CatSongs.VisibleIndex(B) - SongCurrent); @@ -1234,7 +1236,7 @@ begin Diff := (Button[B].H - Theme.Song.Cover.H)/2; - Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2 + (Theme.Song.Cover.H)*sin(Angle/2)*1.52; + Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*((Theme.Song.Cover.H)*sin(Angle/2)*1.52); end; @@ -1245,6 +1247,112 @@ begin end; end; +procedure TScreenSong.SetScroll6; // rotate (slotmachine style) +var + B: integer; + Angle: real; + Pos: Real; + VS: integer; + diff: real; + X: Real; + Wsp: real; + Z, Z2: real; +begin + VS := CatSongs.VisibleSongs; // cache Visible Songs + if VS <=5 then begin + // kolowe + for B := 0 to High(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2; + Z2 := (1 + 2*Z) / 3; + + + Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z / 2 + 0.3; + + Button[B].W := Theme.Song.Cover.H * Z2; + +// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; + Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; + Button[B].H := Button[B].W; + end; + end; + end + else begin + + //Change Pos of all Buttons + for B := low(Button) to high(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility + if Button[B].Visible then //Only Change Pos for Visible Buttons + begin + Pos := (CatSongs.VisibleIndex(B) - SongCurrent); + if (Pos < -VS/2) then + Pos := Pos + VS + else if (Pos > VS/2) then + Pos := Pos - VS; + + if (Abs(Pos) < 2.5) then {fixed Positions} + begin + Angle := Pi * (Pos / 5); +// Button[B].Visible := False; + + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); + + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Z := 0.95 - Abs(Pos) * 0.01; + + Button[B].X := (Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); + + Button[B].W := Button[B].H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + + X := Sin(Angle*1.3)*0.9; + + Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff; + end + else + begin {Behind the Front Covers} + + // limit-bg-covers hack + if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; + if VS > 25 then VS:=25; + // end of limit-bg-covers hack + + if Pos < 0 then + Pos := (Pos - VS/2)/VS + else + Pos := (Pos + VS/2)/VS; + + Angle := pi * Pos*2; + + Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); + + Button[B].W := Button[B].H; + + Button[B].X := Theme.Song.Cover.X - (Button[B].H - Theme.Song.Cover.H)*0.5; + + + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Y := Theme.Song.Cover.Y+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*(Theme.Song.Cover.H*sin(Angle/2)*1.52); + end; + end; + end; + end; +end; + + procedure TScreenSong.onShow; begin Music.Stop; @@ -1425,15 +1533,6 @@ begin DrawExtensions; - - glColor4f(1, 1, 1, 1); - SetFontStyle (2); - SetFontItalic(False); - SetFontSize(9); - SetFontPos (5, 0); - glPrint(pAnsiChar(inttostr(floor(CatSongs.VisibleSongs)))); - - end; procedure TScreenSong.SelectNext; -- cgit v1.2.3 From 789d722dace2725d78479da4edb268440a52959c Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 1 Sep 2007 10:58:56 +0000 Subject: fixed bug that caused display of wrong covers git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@355 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index e346d59e..e75ed1ab 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1159,6 +1159,7 @@ var Angle: real; Pos: Real; VS: integer; + VS_hack: integer; // visible songs for the diff: real; X: Real; begin @@ -1213,13 +1214,13 @@ begin // limit-bg-covers hack if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; - if VS > 25 then VS:=25; + if VS > 25 then VS_hack:=25 else VS_hack:=VS; // end of limit-bg-covers hack if Pos < 0 then - Pos := (Pos - VS/2)/VS + Pos := (Pos - VS_hack/2)/VS_hack else - Pos := (Pos + VS/2)/VS; + Pos := (Pos + VS_hack/2)/VS_hack; Angle := pi * Pos*2; -- cgit v1.2.3 From e5ddd8163c2fa0efefb07e08ba7d0cf392944d16 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 1 Sep 2007 12:45:08 +0000 Subject: finally really fixed the covers (i hope) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@356 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index e75ed1ab..cddf864e 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1159,9 +1159,9 @@ var Angle: real; Pos: Real; VS: integer; - VS_hack: integer; // visible songs for the diff: real; X: Real; + helper: real; begin VS := CatSongs.VisibleSongs; // cache Visible Songs {Vars @@ -1213,16 +1213,22 @@ begin begin {Behind the Front Covers} // limit-bg-covers hack - if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; - if VS > 25 then VS_hack:=25 else VS_hack:=VS; + if (abs(abs(Pos)-VS/2)>10) then Button[B].Visible:=False; // end of limit-bg-covers hack if Pos < 0 then - Pos := (Pos - VS_hack/2)/VS_hack + Pos := (Pos - VS/2)/VS else - Pos := (Pos + VS_hack/2)/VS_hack; + Pos := (Pos + VS/2)/VS; Angle := pi * Pos*2; + if VS > 24 then + begin + if Angle < 0 then helper:=-1 else helper:=1; + Angle:=2*pi-abs(Angle); + Angle:=Angle*(VS/24); + Angle:=(2*pi-Angle)*helper; + end; Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers -- cgit v1.2.3 From 29bfe93f952496c81d1ca02b8d6291275a4be308 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 1 Sep 2007 13:31:04 +0000 Subject: got divx videos running by modifying the reported timebase (or framerate) to something reasonable i consider it a hack, but don't know where else to get the right framerate / video timebase git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@357 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/SMpeg/Uffmpeg.pas | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/SMpeg/Uffmpeg.pas b/Game/Code/SMpeg/Uffmpeg.pas index 753d3dd9..e72c4ed5 100644 --- a/Game/Code/SMpeg/Uffmpeg.pas +++ b/Game/Code/SMpeg/Uffmpeg.pas @@ -5,6 +5,9 @@ # based on 'An ffmpeg and SDL Tutorial' (http://www.dranger.com/ffmpeg/) # #############################################################################} +{$define DebugDisplay} + + unit Uffmpeg; interface @@ -38,8 +41,6 @@ var implementation -const DebugDisplay=False; - procedure Init; begin av_register_all; @@ -93,12 +94,13 @@ begin end else showmessage('no matching codec found'); if(errnum >=0) then begin - if DebugDisplay then +{$ifdef DebugDisplay} showmessage('Found a matching Codec:'+#13#10#13#10+ 'Width='+inttostr(VideoCodecContext^.width)+ ', Height='+inttostr(VideoCodecContext^.height)+#13#10+ 'Aspect: '+inttostr(VideoCodecContext^.sample_aspect_ratio.num)+'/'+inttostr(VideoCodecContext^.sample_aspect_ratio.den)+#13#10+ 'Framerate: '+inttostr(VideoCodecContext^.time_base.num)+'/'+inttostr(VideoCodecContext^.time_base.den)); +{$endif} // allocate space for decoded frame and rgb frame AVFrame:=avcodec_alloc_frame; AVFrameRGB:=avcodec_alloc_frame; @@ -137,9 +139,15 @@ begin ScaledVideoWidth:=600.0*VideoAspect; end; VideoTimeBase:=VideoCodecContext^.time_base.num/VideoCodecContext^.time_base.den; - if (DebugDisplay) and ((VideoAspect*VideoCodecContext^.width*VideoCodecContext^.height)>200000) then + // hack to get reasonable timebase for divx + showmessage('framerate: '+inttostr(floor(1/videotimebase))+'fps'); + while VideoTimeBase < 0.02 do VideoTimeBase:=VideoTimeBase*10; +{$ifdef DebugDisplay} + showmessage('calculated framerate: '+inttostr(floor(1/videotimebase))+'fps'); + if ((VideoAspect*VideoCodecContext^.width*VideoCodecContext^.height)>200000) then showmessage('you are trying to play a rather large video'+#13#10+ 'be prepared to experience some timing problems'); +{$endif} end; end; end; @@ -187,7 +195,10 @@ begin 'TimeDiff: '+inttostr(floor(TimeDifference*1000))); } if (VideoTime <> 0) and (TimeDifference <= VideoTimeBase) then begin - if DebugDisplay then GoldenRec.Spawn(200,15,1,16,0,-1,ColoredStar,$00ff00); +{$ifdef DebugDisplay} + // frame delay debug display + GoldenRec.Spawn(200,15,1,16,0,-1,ColoredStar,$00ff00); +{$endif} { showmessage('not getting new frame'+#13#10+ 'Time: '+inttostr(floor(Time*1000))+#13#10+ 'VideoTime: '+inttostr(floor(VideoTime*1000))+#13#10+ @@ -199,7 +210,10 @@ begin VideoTime:=VideoTime+VideoTimeBase; TimeDifference:=myTime-VideoTime; if TimeDifference >= 3*VideoTimeBase then begin // skip frames - if DebugDisplay then GoldenRec.Spawn(200,35,1,16,0,-1,ColoredStar,$ff0000); +{$ifdef DebugDisplay} + //frame drop debug display + GoldenRec.Spawn(200,55,1,16,0,-1,ColoredStar,$ff0000); +{$endif} // showmessage('skipping frames'+#13#10+ // 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ // 'TimeDiff: '+inttostr(floor(TimeDifference*1000))+#13#10+ @@ -223,9 +237,10 @@ begin // if we did not get an new frame, there's nothing more to do if Framefinished=0 then Exit; // otherwise we convert the pixeldata from YUV to RGB - errnum:=img_convert(PAVPicture(AVFrameRGB), PIX_FMT_RGB24, +{ errnum:=img_convert(PAVPicture(AVFrameRGB), PIX_FMT_RGB24, PAVPicture(AVFrame), VideoCodecContext^.pix_fmt, VideoCodecContext^.width, VideoCodecContext^.height); +}errnum:=1; if errnum >=0 then begin // copy RGB pixeldata to our TextureBuffer // (line by line) @@ -240,6 +255,11 @@ begin glTexImage2D(GL_TEXTURE_2D, 0, 3, dataX, dataY, 0, GL_RGB, GL_UNSIGNED_BYTE, TexData); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); +{$ifdef DebugDisplay} + //frame decode debug display + GoldenRec.Spawn(200,35,1,16,0,-1,ColoredStar,$ffff00); +{$endif} + end; end; @@ -261,15 +281,17 @@ begin glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); - if DebugDisplay then begin +{$ifdef DebugDisplay} SetFontStyle (2); SetFontItalic(False); SetFontSize(9); SetFontPos (5, 0); glPrint('delaying frame'); SetFontPos (5, 20); + glPrint('fetching frame'); + SetFontPos (5, 40); glPrint('dropping frame'); - end; +{$endif} end; end. -- cgit v1.2.3 From 840abe2817971ba4d69f0e36c26bde4f32a42998 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 1 Sep 2007 13:40:58 +0000 Subject: re-commit, now with debugging things disabled git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@358 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/SMpeg/Uffmpeg.pas | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/SMpeg/Uffmpeg.pas b/Game/Code/SMpeg/Uffmpeg.pas index e72c4ed5..f10f40d3 100644 --- a/Game/Code/SMpeg/Uffmpeg.pas +++ b/Game/Code/SMpeg/Uffmpeg.pas @@ -5,7 +5,7 @@ # based on 'An ffmpeg and SDL Tutorial' (http://www.dranger.com/ffmpeg/) # #############################################################################} -{$define DebugDisplay} +//{$define DebugDisplay} unit Uffmpeg; @@ -140,7 +140,9 @@ begin end; VideoTimeBase:=VideoCodecContext^.time_base.num/VideoCodecContext^.time_base.den; // hack to get reasonable timebase for divx +{$ifdef DebugDisplay} showmessage('framerate: '+inttostr(floor(1/videotimebase))+'fps'); +{$endif} while VideoTimeBase < 0.02 do VideoTimeBase:=VideoTimeBase*10; {$ifdef DebugDisplay} showmessage('calculated framerate: '+inttostr(floor(1/videotimebase))+'fps'); @@ -237,10 +239,10 @@ begin // if we did not get an new frame, there's nothing more to do if Framefinished=0 then Exit; // otherwise we convert the pixeldata from YUV to RGB -{ errnum:=img_convert(PAVPicture(AVFrameRGB), PIX_FMT_RGB24, + errnum:=img_convert(PAVPicture(AVFrameRGB), PIX_FMT_RGB24, PAVPicture(AVFrame), VideoCodecContext^.pix_fmt, VideoCodecContext^.width, VideoCodecContext^.height); -}errnum:=1; +//errnum:=1; if errnum >=0 then begin // copy RGB pixeldata to our TextureBuffer // (line by line) -- cgit v1.2.3 From af7100ef908a4ee1474a607ed255c707959222f1 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 1 Sep 2007 17:42:46 +0000 Subject: ffmpeg support now with dualscreen mode git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@359 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/SMpeg/Uffmpeg.pas | 19 +++++++++++-------- Game/Code/Screens/UScreenSing.pas | 4 ++-- 2 files changed, 13 insertions(+), 10 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/SMpeg/Uffmpeg.pas b/Game/Code/SMpeg/Uffmpeg.pas index f10f40d3..25e3f5aa 100644 --- a/Game/Code/SMpeg/Uffmpeg.pas +++ b/Game/Code/SMpeg/Uffmpeg.pas @@ -5,7 +5,8 @@ # based on 'An ffmpeg and SDL Tutorial' (http://www.dranger.com/ffmpeg/) # #############################################################################} -//{$define DebugDisplay} +//{$define DebugDisplay} // uncomment if u want to see the debug stuff +//{$define DebugFrames} unit Uffmpeg; @@ -17,7 +18,7 @@ procedure Init; procedure FFmpegOpenFile(FileName: pAnsiChar); procedure FFmpegClose; procedure FFmpegGetFrame(Time: Extended); -procedure FFmpegDrawGL; +procedure FFmpegDrawGL(Screen: integer); procedure FFmpegTogglePause; procedure FFmpegSkip(Time: Single); @@ -197,7 +198,7 @@ begin 'TimeDiff: '+inttostr(floor(TimeDifference*1000))); } if (VideoTime <> 0) and (TimeDifference <= VideoTimeBase) then begin -{$ifdef DebugDisplay} +{$ifdef DebugFrames} // frame delay debug display GoldenRec.Spawn(200,15,1,16,0,-1,ColoredStar,$00ff00); {$endif} @@ -212,7 +213,7 @@ begin VideoTime:=VideoTime+VideoTimeBase; TimeDifference:=myTime-VideoTime; if TimeDifference >= 3*VideoTimeBase then begin // skip frames -{$ifdef DebugDisplay} +{$ifdef DebugFrames} //frame drop debug display GoldenRec.Spawn(200,55,1,16,0,-1,ColoredStar,$ff0000); {$endif} @@ -257,7 +258,7 @@ begin glTexImage2D(GL_TEXTURE_2D, 0, 3, dataX, dataY, 0, GL_RGB, GL_UNSIGNED_BYTE, TexData); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); -{$ifdef DebugDisplay} +{$ifdef DebugFrames} //frame decode debug display GoldenRec.Spawn(200,35,1,16,0,-1,ColoredStar,$ffff00); {$endif} @@ -265,11 +266,13 @@ begin end; end; -procedure FFmpegDrawGL; +procedure FFmpegDrawGL(Screen: integer); begin if not VideoOpened then Exit; - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + if Screen=1 then begin + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end; glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glColor4f(1, 1, 1, 1); diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 4bf405f6..6ce19c17 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -744,7 +744,7 @@ begin begin try FFmpegGetFrame(Czas.Teraz); - FFmpegDrawGL; + FFmpegDrawGL(ScreenAct); // PlaySmpeg; except //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video @@ -1072,7 +1072,7 @@ begin // todo: find a way to determine, when a new frame is needed // toto: same for the need to skip frames FFmpegGetFrame(Czas.Teraz); - FFmpegDrawGL; + FFmpegDrawGL(ScreenAct); except //If an Error occurs drawing: prevent Video from being Drawn again and Close Video AktSong.VideoLoaded := False; -- cgit v1.2.3 From 656663336715dfb109f0f10ea8b0957cf92975a0 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 1 Sep 2007 20:45:26 +0000 Subject: more/better error checking during codec initialization; tested some videos today. this thing played: mpeg 1/2, divx, xvid, quicktime (sorenson v3), wmv (9) and flv git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@360 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/SMpeg/Uffmpeg.pas | 67 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 58 insertions(+), 9 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/SMpeg/Uffmpeg.pas b/Game/Code/SMpeg/Uffmpeg.pas index 25e3f5aa..d0d9a5c5 100644 --- a/Game/Code/SMpeg/Uffmpeg.pas +++ b/Game/Code/SMpeg/Uffmpeg.pas @@ -7,6 +7,7 @@ //{$define DebugDisplay} // uncomment if u want to see the debug stuff //{$define DebugFrames} +{$define Info} unit Uffmpeg; @@ -88,11 +89,20 @@ begin begin VideoCodecContext:=VideoFormatContext^.streams[VideoStreamIndex]^.codec; VideoCodec:=avcodec_find_decoder(VideoCodecContext^.codec_id); - end else showmessage('found no video stream'); + end else begin + showmessage('found no video stream'); + av_close_input_file(VideoFormatContext); + Exit; + end; if(VideoCodec<>Nil) then begin errnum:=avcodec_open(VideoCodecContext, VideoCodec); - end else showmessage('no matching codec found'); + end else begin + showmessage('no matching codec found'); + avcodec_close(VideoCodecContext); + av_close_input_file(VideoFormatContext); + Exit; + end; if(errnum >=0) then begin {$ifdef DebugDisplay} @@ -114,7 +124,14 @@ begin end; if myBuffer <> Nil then errnum:=avpicture_fill(PAVPicture(AVFrameRGB), myBuffer, PIX_FMT_RGB24, VideoCodecContext^.width, VideoCodecContext^.height) - else showmessage('failed to allocate video buffer'); + else begin + showmessage('failed to allocate video buffer'); + av_free(AVFrameRGB); + av_free(AVFrame); + avcodec_close(VideoCodecContext); + av_close_input_file(VideoFormatContext); + Exit; + end; if errnum >=0 then begin VideoOpened:=True; @@ -144,9 +161,14 @@ begin {$ifdef DebugDisplay} showmessage('framerate: '+inttostr(floor(1/videotimebase))+'fps'); {$endif} - while VideoTimeBase < 0.02 do VideoTimeBase:=VideoTimeBase*10; + if VideoTimeBase < 0.02 then // 0.02 <-> 50 fps + begin + VideoTimeBase:=VideoCodecContext^.time_base.den/VideoCodecContext^.time_base.num; + while VideoTimeBase > 50 do VideoTimeBase:=VideoTimeBase/10; + VideoTimeBase:=1/VideoTimeBase; + end; {$ifdef DebugDisplay} - showmessage('calculated framerate: '+inttostr(floor(1/videotimebase))+'fps'); + showmessage('corrected framerate: '+inttostr(floor(1/videotimebase))+'fps'); if ((VideoAspect*VideoCodecContext^.width*VideoCodecContext^.height)>200000) then showmessage('you are trying to play a rather large video'+#13#10+ 'be prepared to experience some timing problems'); @@ -238,7 +260,10 @@ begin av_free_packet(PAVPacket(@AVPacket)); end; // if we did not get an new frame, there's nothing more to do - if Framefinished=0 then Exit; + if Framefinished=0 then begin + GoldenRec.Spawn(220,15,1,16,0,-1,ColoredStar,$0000ff); + Exit; + end; // otherwise we convert the pixeldata from YUV to RGB errnum:=img_convert(PAVPicture(AVFrameRGB), PIX_FMT_RGB24, PAVPicture(AVFrame), VideoCodecContext^.pix_fmt, @@ -268,11 +293,14 @@ end; procedure FFmpegDrawGL(Screen: integer); begin - if not VideoOpened then Exit; + // have a nice black background to draw on (even if there were errors opening the vid) if Screen=1 then begin glClearColor(0,0,0,0); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); end; + // exit if there's nothing to draw + if not VideoOpened then Exit; + glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glColor4f(1, 1, 1, 1); @@ -286,8 +314,29 @@ begin glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); -{$ifdef DebugDisplay} - SetFontStyle (2); +{$ifdef Info} + if VideoSkipTime+VideoTime+VideoTimeBase < 0 then begin + glColor4f(0.7, 1, 0.3, 1); + SetFontStyle (1); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (300, 0); + glPrint('Delay due to negative VideoGap'); + glColor4f(1, 1, 1, 1); + end; +{$endif} + +{$ifdef DebugFrames} + glColor4f(0, 0, 0, 0.2); + glbegin(gl_quads); + glVertex2f(0, 0); + glVertex2f(0, 70); + glVertex2f(250, 70); + glVertex2f(250, 0); + glEnd; + + glColor4f(1,1,1,1); + SetFontStyle (1); SetFontItalic(False); SetFontSize(9); SetFontPos (5, 0); -- cgit v1.2.3 From bf62fe40a0986e0791eb462ef5adebf079e744e6 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 2 Sep 2007 14:31:51 +0000 Subject: Some Cleanup in URecord Some Cleanup in UMusic Some Cleanup in ProjectFile Upgrade from Bass 2.1 to Bass 2.3 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@361 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMusic.pas | 2 +- Game/Code/Classes/URecord.pas | 43 ++++++++++++++++++------------------------- Game/Code/UltraStar.dpr | 37 ++++++++++++++++++++++++++++++++----- 3 files changed, 51 insertions(+), 31 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index 4e647ed3..979ba4e5 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -441,7 +441,7 @@ var begin Result := 60; - bytes := BASS_StreamGetLength(Bass); + bytes := BASS_ChannelGetLength(Bass); Result := BASS_ChannelBytes2Seconds(Bass, bytes); { if Assigned(MediaPlayer) then begin diff --git a/Game/Code/Classes/URecord.pas b/Game/Code/Classes/URecord.pas index 2ec5439a..6ce83c0a 100644 --- a/Game/Code/Classes/URecord.pas +++ b/Game/Code/Classes/URecord.pas @@ -37,7 +37,8 @@ type // here can be the soundcard information - whole database from which user will select recording source Description: string; Input: array of TSoundCardInput; - InputSeleceted: integer; + InputSelected: integer; + MicInput: Integer; // bass record BassRecordStream: hStream; @@ -117,7 +118,7 @@ begin for S := 1 to 1024 do begin // 0.5.2: fix. was from 0 to 1023 // Log.LogDebug('1'); // Log.LogDebug(IntTostr(S)); - V := Abs(BufferArray[S]) / $10000; + V := Abs(BufferArray[S]) / $10000; // Log.LogDebug('2'); // Log.LogDebug(IntTostr(S) + ': ' + FloatToStr(V) + ', MaxV='+floattostr(maxv)+', buf='+inttostr(length(BufferArray))); if V > MaxV then MaxV := V; @@ -279,7 +280,7 @@ var SC: integer; // soundcard SCI: integer; // soundcard input Descr: string; - InputName: string; + InputName: PChar; Flags: integer; No: integer; function isDuplicate(Desc: String): Boolean; @@ -298,7 +299,6 @@ var end; end; -// mic: array[0..15] of integer; begin // checks for recording devices and puts them into array; SetLength(SoundCard, 0); @@ -320,45 +320,37 @@ begin end; SetLength(SoundCard, SC+1); -// Log.LogError('Device #' + IntToStr(SC+1) + ': ' + Descr); + SoundCard[SC].Description := Descr; - // check for recording inputs -// mic[device] := -1; // default to no change + //Get Recording Inputs SCI := 0; BASS_RecordInit(SC); - Flags := BASS_RecordGetInput(SCI); + InputName := BASS_RecordGetInputName(SCI); -// Log.LogError('Input #' + IntToStr(SCI) + ' (' + IntToStr(Flags) + '): ' + InputName); SetLength(SoundCard[SC].Input, 1); SoundCard[SC].Input[SCI].Name := InputName; // process each input - while (Flags <> -1) do begin - if SCI >= 1 then begin + while (InputName <> nil) do begin + Flags := BASS_RecordGetInput(SCI); + if (SCI >= 1) {AND (Flags AND BASS_INPUT_OFF = 0)} then begin + SetLength(SoundCard[SC].Input, SCI+1); - InputName := BASS_RecordGetInputName(SCI); + SoundCard[SC].Input[SCI].Name := InputName; -// Log.LogError('Input #' + IntToStr(SCI) + ' (' + IntToStr(Flags) + '): ' + InputName); end; -{ if (flags and BASS_INPUT_TYPE_MASK) = BASS_INPUT_TYPE_MIC then begin - mic[device] := input; // auto set microphone - end;} + //Set Mic Index + if ((Flags and BASS_INPUT_TYPE_MIC) = 1) then + SoundCard[SC].MicInput := SCI; + Inc(SCI); - Flags := BASS_RecordGetInput(SCI); + InputName := BASS_RecordGetInputName(SCI); end; -{ if mic[device] <> -1 then begin - Log.LogAnalyze('Found the mic at input ' + IntToStr(Mic[device])) - end else begin - Log.LogAnalyze('Mic not found'); - mic[device] := 0; // setting to the first one (for kxproject) - end; - SoundCard[SC].InputSeleceted := Mic[Device];} - BASS_RecordFree; @@ -369,3 +361,4 @@ end; end. + diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index e523e98e..08f41cba 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -5,6 +5,9 @@ program UltraStar; {$R 'UltraStar.res' 'UltraStar.rc'} uses + //------------------------------ + //Includes - Menu System + //------------------------------ UDisplay in 'Menu\UDisplay.pas', UMenu in 'Menu\UMenu.pas', UMenuStatic in 'Menu\UMenuStatic.pas', @@ -15,6 +18,10 @@ uses UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', UDrawTexture in 'Menu\UDrawTexture.pas', UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', + + //------------------------------ + //Includes - Classes + //------------------------------ UGraphic in 'Classes\UGraphic.pas', UTexture in 'Classes\UTexture.pas', UMusic in 'Classes\UMusic.pas', @@ -26,7 +33,6 @@ uses TextGL in 'Classes\TextGL.pas', USongs in 'Classes\USongs.pas', UIni in 'Classes\UIni.pas', - USmpeg in 'SMpeg\USmpeg.pas', ULyrics in 'Classes\ULyrics.pas', USkins in 'Classes\USkins.pas', UThemes in 'Classes\UThemes.pas', @@ -42,7 +48,17 @@ uses UDLLManager in 'Classes\UDLLManager.pas', UParty in 'Classes\UParty.pas', UPlaylist in 'Classes\UPlaylist.pas', - UCommandLine in 'Classes\UCommandLine.pas', + UCommandLine in 'Classes\UCommandLine.pas', + + //------------------------------ + //Includes - Video Support + //------------------------------ + Uffmpeg in 'SMpeg\Uffmpeg.pas', + USmpeg in 'SMpeg\USmpeg.pas', + + //------------------------------ + //Includes - Screens + //------------------------------ UScreenLoading in 'Screens\UScreenLoading.pas', UScreenWelcome in 'Screens\UScreenWelcome.pas', UScreenMain in 'Screens\UScreenMain.pas', @@ -71,20 +87,31 @@ uses UScreenStatDetail in 'Screens\UScreenStatDetail.pas', UScreenCredits in 'Screens\UScreenCredits.pas', UScreenPopup in 'Screens\UScreenPopup.pas', + + //------------------------------ + //Includes - Screens PartyMode + //------------------------------ UScreenSingModi in 'Screens\UScreenSingModi.pas', UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', UScreenPartyScore in 'Screens\UScreenPartyScore.pas', UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', UScreenPartyWin in 'Screens\UScreenPartyWin.pas', + + //------------------------------ + //Includes - Modi SDK + //------------------------------ ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', + + //------------------------------ + //Includes - Delphi + //------------------------------ Windows, SDL, - SysUtils, - Uffmpeg in 'SMpeg\Uffmpeg.pas'; + SysUtils; const - Version = 'UltraStar Deluxe V 1.00 RC1'; + Version = 'UltraStar Deluxe V 1.10 Alpha Build'; var WndTitle: string; -- cgit v1.2.3 From 3df211329573da9450b2388875ec952dcaa98eea Mon Sep 17 00:00:00 2001 From: mogguh Date: Sun, 2 Sep 2007 18:53:35 +0000 Subject: VFX: Some pre work for an upcoming (yet unfinished) feature git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@362 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 65 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 84604367..161b5512 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -11,7 +11,7 @@ unit UTexture; // Arrow (for arrows, white is white, gray has color, black is transparent); interface -uses OpenGL12, Windows, Math, Classes, SysUtils, Graphics, JPEG, UThemes, PNGImage; +uses OpenGL12, Windows, Math, Classes, SysUtils, Graphics, JPEG, UThemes, PNGImage, GraphUtil, dialogs; procedure glGenTextures(n: GLsizei; var textures: GLuint); stdcall; external opengl32; @@ -66,6 +66,7 @@ type function LoadTexture(Identifier: string): TTexture; overload; function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; procedure UnloadTexture(Name: string; FromCache: boolean); + procedure Colorize(var R,G,B : Byte; Color: Cardinal); // Real colorize instead of: "150 grey is now blue, k?" end; var @@ -239,7 +240,7 @@ begin end; TextureB.Assign(TexturePNG); // transparent png hack start (part 1 of 2) - if (Typ = 'Transparent') and (TexturePNG.TransparencyMode = ptmPartial) then + if ((Typ = 'Transparent') or (Typ = 'Colorized')) and (TexturePNG.TransparencyMode = ptmPartial) then begin setlength(TextureAlpha, TextureB.Width*TextureB.Height); setlength(MyRGBABitmap,TextureB.Width*TextureB.Height*4); @@ -414,6 +415,49 @@ begin end;} end; +// The new awesomeness of colorized pngs starts here +// We're the first who had this feature, so give credit when you copy+paste :P + if Typ = 'Colorized' then begin + // dimensions + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + + // copy and process pixeldata + for Position := 0 to TexOrigH-1 do begin + for Position2 := 0 to TexOrigW-1 do begin + Pix := TextureB.Canvas.Pixels[Position2, Position]; + if (Format = 'PNG') and (length(MyRGBABitmap) <> 0) then begin + myAlpha:=TextureAlpha[Position*TexOrigW+Position2]; + TextureD32[Position*TexNewW + Position2+1, 1] := MyRGBABitmap[(Position*TexOrigW+Position2)*4+2]; // R + TextureD32[Position*TexNewW + Position2+1, 2] := MyRGBABitmap[(Position*TexOrigW+Position2)*4+1]; // G + TextureD32[Position*TexNewW + Position2+1, 3] := MyRGBABitmap[(Position*TexOrigW+Position2)*4]; // B + TextureD32[Position*TexNewW+Position2+1,4] := MyRGBABitmap[(Position*TexOrigW+Position2)*4+3]; // Alpha + end else begin + TextureD32[Position*TexNewW + Position2+1, 1] := (Pix and $ff); + TextureD32[Position*TexNewW + Position2+1, 2] := ((Pix shr 8) and $ff); + TextureD32[Position*TexNewW + Position2+1, 3] := ((Pix shr 16) and $ff); + TextureD32[Position*TexNewW + Position2+1, 4] := 255; + end; + end; + end; + + //now the colorize stuff + for Position := 0 to TexOrigH-1 do begin + for Position2 := 0 to TexOrigW-1 do begin + colorize(TextureD32[Position*TexNewW + Position2+1, 1],TextureD32[Position*TexNewW + Position2+1, 2],TextureD32[Position*TexNewW + Position2+1, 3], $fe198e); //pinkie :P + end; + end; + + setlength(TextureAlpha,0); + setlength(MyRGBABitmap,0); + glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; +// eoa COLORIZE + if Typ = 'Transparent Range' then begin // dimensions TexOrigW := TextureB.Width; @@ -759,6 +803,23 @@ begin end; + +// Funkyness of colorizing is done in this small box, remember to give credits when you copy from us +Procedure TTextureUnit.Colorize(var R,G,B : Byte; Color : Cardinal); +var + TexHue, TexLum, TexSat, ClrHue, ClrLum, ClrSat : Word; + ColorizedColors: Cardinal; +begin //red //green //blue + Color:=((Color and $ff) shl 16) or (Color and $ff00) or ((Color and $ff0000) shr 16); + ColorRGBToHLS(Color, ClrHue, ClrLum, ClrSat); + ColorRGBToHLS((((b shl 8) or g) shl 8 or r),TexHue, TexLum, TexSat); + ColorizedColors := ColorHLSToRGB(ClrHue, TexLum, TexSat); + R := ColorizedColors and $FF; + G := (ColorizedColors and $FF00) shr 8; + B := (ColorizedColors and $FF0000) shr 16; +end; +//eoa COLORIZE + function TTextureUnit.LoadTexture(Identifier: string): TTexture; begin Result := LoadTexture(false, pchar(Identifier), 'JPG', 'Plain', 0); -- cgit v1.2.3 From 69c42b2bde3146a61d4b1e8e1cbedfd7163b1c60 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sun, 2 Sep 2007 21:06:08 +0000 Subject: finished stuff for colorized transparent textures with statics (credits to mog, who started it) still to do: same thing with buttons and maybe everything else ;) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@363 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 6 +++++- Game/Code/Menu/UMenu.pas | 25 ++++++++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 161b5512..3314f494 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -38,6 +38,10 @@ type TexY2: real; Alpha: real; Name: string; // 0.5.0: experimental for handling cache images. maybe it's useful for dynamic skins + // colorize hack + Colorized: Boolean; +// Colors: array of Cardinal; +// Texnums: array of Integer; end; TTextureEntry = record @@ -448,7 +452,7 @@ begin //now the colorize stuff for Position := 0 to TexOrigH-1 do begin for Position2 := 0 to TexOrigW-1 do begin - colorize(TextureD32[Position*TexNewW + Position2+1, 1],TextureD32[Position*TexNewW + Position2+1, 2],TextureD32[Position*TexNewW + Position2+1, 3], $fe198e); //pinkie :P + colorize(TextureD32[Position*TexNewW + Position2+1, 1],TextureD32[Position*TexNewW + Position2+1, 2],TextureD32[Position*TexNewW + Position2+1, 3], Col); //pinkie :P end; end; diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 309e199a..24af3e1d 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -3,7 +3,7 @@ unit UMenu; interface uses OpenGL12, SysUtils, UTexture, UMenuStatic, UMenuText, UMenuButton, UMenuSelect, UMenuSelectSlide, - UMenuInteract, UThemes, UMenuButtonCollection; + UMenuInteract, UThemes, UMenuButtonCollection, Math; type { Int16 = SmallInt;} @@ -432,13 +432,26 @@ end; function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; Name, Format, Typ: string; Color: integer; Reflection: Boolean; ReflectionSpacing: Real): integer; var StatNum: integer; + TempR, TempG, TempB: Cardinal; + TempCol: Cardinal; begin // adds static StatNum := Length(Static); SetLength(Static, StatNum + 1); // Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), Color)); // Static[StatNum] := TStatic.Create(Texture.LoadTexture(Skin.SkinReg, PChar(Name), PChar(Format), PChar(Typ), Color)); // new skin system -Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), Color)); // new skin + +// colorize hack +if Typ='Colorized' then +begin + TempR:=floor(255*ColR); + TempG:=floor(255*ColG); + TempB:=floor(255*ColB); + // give encoded color to loadtexture + Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR shl 8) or TempG) shl 8)or TempB))); +end +else + Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), Color)); // new skin // Static[StatNum] := TStatic.Create(Texture.GetTexture(Name, Typ)); // configures static @@ -447,9 +460,11 @@ Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format) Static[StatNum].Texture.W := W; Static[StatNum].Texture.H := H; Static[StatNum].Texture.Z := Z; - Static[StatNum].Texture.ColR := ColR; - Static[StatNum].Texture.ColG := ColG; - Static[StatNum].Texture.ColB := ColB; + if Typ <> 'Colorized' then begin + Static[StatNum].Texture.ColR := ColR; + Static[StatNum].Texture.ColG := ColG; + Static[StatNum].Texture.ColB := ColB; + end; Static[StatNum].Texture.TexX1 := TexX1; Static[StatNum].Texture.TexY1 := TexY1; Static[StatNum].Texture.TexX2 := TexX2; -- cgit v1.2.3 From d5ebad3a661194459da1b134978ed353e46c9b72 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sun, 2 Sep 2007 23:45:33 +0000 Subject: now buttons can also have transparent colorized textures POC-Pic: http://imageshock.eu/img/colorizedbuttons-ao81.jpg git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@365 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 4 -- Game/Code/Menu/UMenu.pas | 83 +++++++++++++++++++++++++++++++-------- Game/Code/Menu/UMenuButton.pas | 88 +++++++++++++++++++++++++++++++++++++++--- 3 files changed, 149 insertions(+), 26 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 3314f494..ab21d44c 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -38,10 +38,6 @@ type TexY2: real; Alpha: real; Name: string; // 0.5.0: experimental for handling cache images. maybe it's useful for dynamic skins - // colorize hack - Colorized: Boolean; -// Colors: array of Cardinal; -// Texnums: array of Integer; end; TTextureEntry = record diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 24af3e1d..0fb1614f 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -309,10 +309,28 @@ end; procedure TMenu.AddButtonCollection(const ThemeCollection: TThemeButtonCollection; Const Num: Byte); var BT, BTLen: Integer; + TempR, TempG, TempB, TempR2, TempG2, TempB2: Cardinal; + begin if (Num > High(ButtonCollection)) then exit; +// colorize hack +if ThemeCollection.Style.Typ='Colorized' then +begin + TempR:=floor(255*ThemeCollection.Style.ColR); + TempG:=floor(255*ThemeCollection.Style.ColG); + TempB:=floor(255*ThemeCollection.Style.ColB); + TempR2:=floor(255*ThemeCollection.Style.DColR); + TempG2:=floor(255*ThemeCollection.Style.DColG); + TempB2:=floor(255*ThemeCollection.Style.DColB); + // give encoded color to loadtexture + ButtonCollection[Num] := TButtonCollection.Create(Texture.LoadTexture(PChar(Skin.GetTextureFileName(ThemeCollection.Style.Tex)), 'JPG', 'Colorized', ((((TempR shl 8) or TempG) shl 8)or TempB)), + Texture.LoadTexture(PChar(Skin.GetTextureFileName(ThemeCollection.Style.Tex)), 'JPG', 'Colorized', ((((TempR2 shl 8) or TempG2) shl 8)or TempB2))); + +// Button[Result] := TButton.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR2 shl 8) or TempG2) shl 8)or TempB2))); // use cache texture +end +else ButtonCollection[Num] := TButtonCollection.Create(Texture.GetTexture(Skin.GetTextureFileName(ThemeCollection.Style.Tex), ThemeCollection.Style.Typ, true)); // use cache texture //Set Parent menu @@ -328,13 +346,15 @@ begin ButtonCollection[Num].Y := ThemeCollection.Style.Y; ButtonCollection[Num].W := ThemeCollection.Style.W; ButtonCollection[Num].H := ThemeCollection.Style.H; - ButtonCollection[Num].SelectColR := ThemeCollection.Style.ColR; - ButtonCollection[Num].SelectColG := ThemeCollection.Style.ColG; - ButtonCollection[Num].SelectColB := ThemeCollection.Style.ColB; + if ThemeCollection.Style.Typ <> 'Colorized' then begin + ButtonCollection[Num].SelectColR := ThemeCollection.Style.ColR; + ButtonCollection[Num].SelectColG := ThemeCollection.Style.ColG; + ButtonCollection[Num].SelectColB := ThemeCollection.Style.ColB; + ButtonCollection[Num].DeselectColR := ThemeCollection.Style.DColR; + ButtonCollection[Num].DeselectColG := ThemeCollection.Style.DColG; + ButtonCollection[Num].DeselectColB := ThemeCollection.Style.DColB; + end; ButtonCollection[Num].SelectInt := ThemeCollection.Style.Int; - ButtonCollection[Num].DeselectColR := ThemeCollection.Style.DColR; - ButtonCollection[Num].DeselectColG := ThemeCollection.Style.DColG; - ButtonCollection[Num].DeselectColB := ThemeCollection.Style.DColB; ButtonCollection[Num].DeselectInt := ThemeCollection.Style.DInt; ButtonCollection[Num].Texture.TexX1 := 0; ButtonCollection[Num].Texture.TexY1 := 0; @@ -354,13 +374,16 @@ begin ButtonCollection[Num].Fade := ThemeCollection.Style.Fade; ButtonCollection[Num].FadeText := ThemeCollection.Style.FadeText; - ButtonCollection[Num].FadeTex := Texture.GetTexture(Skin.GetTextureFileName(ThemeCollection.Style.FadeTex), ThemeCollection.Style.Typ, true); + if ThemeCollection.Style.Typ='Colorized' then + ButtonCollection[Num].FadeTex := Texture.LoadTexture(PChar(Skin.GetTextureFileName(ThemeCollection.Style.FadeTex)), 'JPG', 'Colorized', ((((TempR shl 8) or TempG) shl 8)or TempB)) + else + ButtonCollection[Num].FadeTex := Texture.GetTexture(Skin.GetTextureFileName(ThemeCollection.Style.FadeTex), ThemeCollection.Style.Typ, true); ButtonCollection[Num].FadeTexPos := ThemeCollection.Style.FadeTexPos; BTLen := Length(ThemeCollection.Style.Text); for BT := 0 to BTLen-1 do begin - AddButtonText(ButtonCollection[Num], ThemeCollection.Style.Text[BT].X, ThemeCollection.Style.Text[BT].Y, + AddButtonText(ButtonCollection[Num], ThemeCollection.Style.Text[BT].X, ThemeCollection.Style.Text[BT].Y, ThemeCollection.Style.Text[BT].ColR, ThemeCollection.Style.Text[BT].ColG, ThemeCollection.Style.Text[BT].ColB, ThemeCollection.Style.Text[BT].Font, ThemeCollection.Style.Text[BT].Size, ThemeCollection.Style.Text[BT].Align, ThemeCollection.Style.Text[BT].Text); @@ -532,6 +555,7 @@ var BT: integer; BTLen: integer; temp: integer; + TempR, TempG, TempB, TempR2, TempG2, TempB2: Cardinal; begin { Result := AddButton(ThemeButton.X, ThemeButton.Y, ThemeButton.W, ThemeButton.H, ThemeButton.ColR, ThemeButton.ColG, ThemeButton.ColB, ThemeButton.Int, @@ -554,7 +578,14 @@ begin Button[Result].Fade := ThemeButton.Fade; Button[Result].FadeText := ThemeButton.FadeText; - Button[Result].FadeTex := Texture.GetTexture(Skin.GetTextureFileName(ThemeButton.FadeTex), ThemeButton.Typ, true); + if ThemeButton.Typ='Colorized' then begin + TempR:=floor(255*ThemeButton.ColR); + TempG:=floor(255*ThemeButton.ColG); + TempB:=floor(255*ThemeButton.ColB); + Button[Result].FadeTex := Texture.LoadTexture(PChar(Skin.GetTextureFileName(ThemeButton.FadeTex)), 'JPG', 'Colorized', ((((TempR shl 8) or TempG) shl 8)or TempB)); + end + else + Button[Result].FadeTex := Texture.GetTexture(Skin.GetTextureFileName(ThemeButton.FadeTex), ThemeButton.Typ, true); Button[Result].FadeTexPos := ThemeButton.FadeTexPos; @@ -596,6 +627,7 @@ begin end; function TMenu.AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean; ReflectionSpacing, DeSelectReflectionSpacing: Real): integer; +var TempR, TempG, TempB, TempR2, TempG2, TempB2: Cardinal; begin // adds button //SetLength is used once to reduce Memory usement @@ -604,7 +636,7 @@ begin Result := ButtonPos; Inc(ButtonPos) end - else //Old Method -> Reserve new Memory for every Button + else //Old Method -> Reserve new Memory for every Button begin Result := Length(Button); SetLength(Button, Result + 1); @@ -614,6 +646,23 @@ begin // check here for cache // Texture.GetTexture(Name, Typ, false); // preloads textures and creates cahce mipmap when needed // if Covers.CoverExists(Name) then +// colorize hack +if Typ='Colorized' then +begin + TempR:=floor(255*ColR); + TempG:=floor(255*ColG); + TempB:=floor(255*ColB); + TempR2:=floor(255*DColR); + TempG2:=floor(255*DColG); + TempB2:=floor(255*DColB); + // give encoded color to loadtexture + Button[Result] := TButton.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR shl 8) or TempG) shl 8)or TempB)), + Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR2 shl 8) or TempG2) shl 8)or TempB2))); + +// Button[Result] := TButton.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR2 shl 8) or TempG2) shl 8)or TempB2))); // use cache texture +end +else + Button[Result] := TButton.Create(Texture.GetTexture(Name, Typ, true)); // use cache texture // else // Button[Result] := TButton.Create(Texture.GetTexture(Name, Typ, false)); // don't use cache texture} @@ -623,13 +672,15 @@ begin Button[Result].Y := Y; Button[Result].W := W; Button[Result].H := H; - Button[Result].SelectColR := ColR; - Button[Result].SelectColG := ColG; - Button[Result].SelectColB := ColB; + if Typ <> 'Colorized' then begin + Button[Result].SelectColR := ColR; + Button[Result].SelectColG := ColG; + Button[Result].SelectColB := ColB; + Button[Result].DeselectColR := DColR; + Button[Result].DeselectColG := DColG; + Button[Result].DeselectColB := DColB; + end; Button[Result].SelectInt := Int; - Button[Result].DeselectColR := DColR; - Button[Result].DeselectColG := DColG; - Button[Result].DeselectColB := DColB; Button[Result].DeselectInt := DInt; Button[Result].Texture.TexX1 := 0; Button[Result].Texture.TexY1 := 0; diff --git a/Game/Code/Menu/UMenuButton.pas b/Game/Code/Menu/UMenuButton.pas index 919a18c9..51c746fe 100644 --- a/Game/Code/Menu/UMenuButton.pas +++ b/Game/Code/Menu/UMenuButton.pas @@ -11,18 +11,21 @@ type FadeProgress: Real; FadeLastTick: Cardinal; - + DeSelectW: Real; DeSelectH: Real; PosX: Real; PosY: Real; constructor Create(); overload; - + public Text: Array of TText; Texture: TTexture; // Button Screen position and size Texture2: TTexture; // second texture only used for fading full resolution covers + //colorized hack + Colorized: Boolean; + DeSelectTexture: TTexture; // texture for colorized hack FadeTex: TTexture; //Texture for beautiful fading FadeTexPos: byte; //Pos of the FadeTexture (0: Top, 1: Left, 2: Bottom, 3: Right) @@ -76,6 +79,7 @@ type procedure Draw; virtual; constructor Create(Textura: TTexture); overload; + constructor Create(Textura, DSTexture: TTexture); overload; destructor Destroy; override; end; @@ -110,7 +114,7 @@ begin for T := 0 to High(Text) do Text[T].Y := Text[T].Y + dY;} - + PosY := Value; if (FadeTex.TexNum = -1) then Texture.y := Value; @@ -149,7 +153,7 @@ begin end; procedure TButton.SetSelect(Value : Boolean); -var +var T: integer; begin SelectBool := Value; @@ -217,6 +221,9 @@ begin //Reflection Mod Reflection := true; + //colorized hack + Colorized:=False; + // Default // SelectInt := 1; // DeselectInt := 0.5; @@ -297,11 +304,15 @@ begin begin Texture.W := DeSelectW + (SelectW - DeSelectW) * FadeProgress; Texture.H := DeSelectH + (SelectH - DeSelectH) * FadeProgress; + DeselectTexture.W := Texture.W; + DeselectTexture.H := Texture.H; end else //method with Fade Texture begin Texture.W := DeSelectW; Texture.H := DeSelectH; + DeselectTexture.W := Texture.W; + DeselectTexture.H := Texture.H; FadeTex.ColR := Texture.ColR; FadeTex.ColG := Texture.ColG; @@ -322,6 +333,8 @@ begin //Standard Texture Texture.X := PosX; Texture.Y := PosY + (SelectH - DeSelectH) * FadeProgress; + DeselectTexture.X := Texture.X; + DeselectTexture.Y := Texture.Y; //Fade Tex FadeTex.X := PosX; FadeTex.Y := PosY; @@ -336,6 +349,8 @@ begin //Standard Texture Texture.X := PosX + (SelectW - DeSelectW) * FadeProgress; Texture.Y := PosY; + DeselectTexture.X := Texture.X; + DeselectTexture.Y := Texture.Y; //Fade Tex FadeTex.X := PosX; FadeTex.Y := PosY; @@ -350,6 +365,8 @@ begin //Standard Texture Texture.X := PosX; Texture.Y := PosY; + DeselectTexture.X := Texture.X; + DeselectTexture.Y := Texture.Y; //Fade Tex FadeTex.X := PosX; FadeTex.Y := PosY + (SelectH - DeSelectH) * FadeProgress;; @@ -364,6 +381,8 @@ begin //Standard Texture Texture.X := PosX; Texture.Y := PosY; + DeselectTexture.X := Texture.X; + DeselectTexture.Y := Texture.Y; //Fade Tex FadeTex.X := PosX + (SelectW - DeSelectW) * FadeProgress; FadeTex.Y := PosY; @@ -382,7 +401,10 @@ begin Text[T].MoveY := (SelectH - DeSelectH); end; - DrawTexture(Texture); + if SelectBool or not Colorized then + DrawTexture(Texture) + else + DrawTexture(DeselectTexture); //Draw FadeTex if (FadeTex.TexNum <> -1) then @@ -419,6 +441,7 @@ begin else Spacing := DeSelectReflectionspacing; + if SelectBool or not Colorized then with Texture do begin //Bind Tex and GL Attributes @@ -456,7 +479,47 @@ begin glEnd; glDisable(GL_TEXTURE_2D); - glDisable(GL_DEPTH_TEST); + glDisable(GL_DEPTH_TEST); + glDisable(GL_BLEND); + end else + with DeselectTexture do + begin + //Bind Tex and GL Attributes + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + + glDepthRange(0, 10); + glDepthFunc(GL_LEQUAL); + glEnable(GL_DEPTH_TEST); + + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, TexNum); + + //Draw + glBegin(GL_QUADS);//Top Left + glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); + glTexCoord2f(TexX1*TexW, TexY2*TexH); + glVertex3f(x, y+h*scaleH+ Spacing, z); + + //Bottom Left + glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); + glTexCoord2f(TexX1*TexW, TexY1+TexH*0.5); + glVertex3f(x, y+h*scaleH + h*scaleH/2 + Spacing, z); + + + //Bottom Right + glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); + glTexCoord2f(TexX2*TexW, TexY1+TexH*0.5); + glVertex3f(x+w*scaleW, y+h*scaleH + h*scaleH/2 + Spacing, z); + + //Top Right + glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); + glTexCoord2f(TexX2*TexW, TexY2*TexH); + glVertex3f(x+w*scaleW, y+h*scaleH + Spacing, z); + glEnd; + + glDisable(GL_TEXTURE_2D); + glDisable(GL_DEPTH_TEST); glDisable(GL_BLEND); end; end; @@ -478,11 +541,24 @@ constructor TButton.Create(Textura: TTexture); begin Create(); Texture := Textura; + DeselectTexture:=Textura; Texture.ColR := 0; Texture.ColG := 0.5; Texture.ColB := 0; Texture.Int := 1; + Colorized:=False; end; +constructor TButton.Create(Textura, DSTexture: TTexture); +begin + Create(); + Texture := Textura; + DeselectTexture := DSTexture; + Texture.ColR := 1; + Texture.ColG := 1; + Texture.ColB := 1; + Texture.Int := 1; + Colorized:=True; +end; end. -- cgit v1.2.3 From f043468a9c9f13099efe30e86d1b0befca8fc6c2 Mon Sep 17 00:00:00 2001 From: b1indy Date: Mon, 3 Sep 2007 00:11:25 +0000 Subject: some small improvement with fading buttons git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@366 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UMenuButton.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UMenuButton.pas b/Game/Code/Menu/UMenuButton.pas index 51c746fe..cb343cf8 100644 --- a/Game/Code/Menu/UMenuButton.pas +++ b/Game/Code/Menu/UMenuButton.pas @@ -401,7 +401,7 @@ begin Text[T].MoveY := (SelectH - DeSelectH); end; - if SelectBool or not Colorized then + if SelectBool or (FadeProgress > 0) or not Colorized then DrawTexture(Texture) else DrawTexture(DeselectTexture); -- cgit v1.2.3 From fee5e834a23f11ea42365b9c5f7336b9c5c58bc0 Mon Sep 17 00:00:00 2001 From: b1indy Date: Mon, 3 Sep 2007 16:10:20 +0000 Subject: modified frameskip method git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@367 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/SMpeg/Uffmpeg.pas | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/SMpeg/Uffmpeg.pas b/Game/Code/SMpeg/Uffmpeg.pas index d0d9a5c5..6e08ca95 100644 --- a/Game/Code/SMpeg/Uffmpeg.pas +++ b/Game/Code/SMpeg/Uffmpeg.pas @@ -6,7 +6,7 @@ #############################################################################} //{$define DebugDisplay} // uncomment if u want to see the debug stuff -//{$define DebugFrames} +{$define DebugFrames} {$define Info} @@ -199,6 +199,10 @@ end; procedure FFmpegSkip(Time: Single); begin VideoSkiptime:=Time; + if VideoSkipTime > 0 then begin + av_seek_frame(VideoFormatContext,-1,Floor((VideoSkipTime)*1500000),0); + VideoTime:=VideoSkipTime; + end; end; procedure FFmpegGetFrame(Time: Extended); @@ -209,11 +213,16 @@ var FrameDataPtr: PByteArray; linesize: integer; myTime: Extended; + DropFrame: Boolean; + droppedFrames: Integer; +const + FRAMEDROPCOUNT=3; begin if not VideoOpened then Exit; if VideoPaused then Exit; myTime:=Time+VideoSkipTime; TimeDifference:=myTime-VideoTime; + DropFrame:=False; { showmessage('Time: '+inttostr(floor(Time*1000))+#13#10+ 'VideoTime: '+inttostr(floor(VideoTime*1000))+#13#10+ 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ @@ -234,7 +243,7 @@ begin end; VideoTime:=VideoTime+VideoTimeBase; TimeDifference:=myTime-VideoTime; - if TimeDifference >= 3*VideoTimeBase then begin // skip frames + if TimeDifference >= (FRAMEDROPCOUNT-1)*VideoTimeBase then begin // skip frames {$ifdef DebugFrames} //frame drop debug display GoldenRec.Spawn(200,55,1,16,0,-1,ColoredStar,$ff0000); @@ -244,10 +253,13 @@ begin // 'TimeDiff: '+inttostr(floor(TimeDifference*1000))+#13#10+ // 'Time2Skip: '+inttostr(floor((Time-LastFrameTime)*1000))); // av_seek_frame(VideoFormatContext,VideoStreamIndex,Floor(Time*VideoTimeBase),0); - av_seek_frame(VideoFormatContext,-1,Floor((myTime)*1100000),0); - VideoTime:=floor(myTime/VideoTimeBase)*VideoTimeBase; +{ av_seek_frame(VideoFormatContext,-1,Floor((myTime+VideoTimeBase)*1500000),0); + VideoTime:=floor(myTime/VideoTimeBase)*VideoTimeBase;} + VideoTime:=VideoTime+FRAMEDROPCOUNT*VideoTimeBase; + DropFrame:=True; end; + av_init_packet(@AVPacket); FrameFinished:=0; // read packets until we have a finished frame (or there are no more packets) while (FrameFinished=0) and (av_read_frame(VideoFormatContext, @AVPacket)>=0) do @@ -255,10 +267,25 @@ begin // if we got a packet from the video stream, then decode it if (AVPacket.stream_index=VideoStreamIndex) then errnum:=avcodec_decode_video(VideoCodecContext, AVFrame, @frameFinished, - AVPacket.data, AVPacket.size); + AVPacket.data, AVPacket.size); // release internal packet structure created by av_read_frame - av_free_packet(PAVPacket(@AVPacket)); + av_free_packet(PAVPacket(@AVPacket)); end; + if DropFrame then + for droppedFrames:=1 to FRAMEDROPCOUNT do begin + FrameFinished:=0; + // read packets until we have a finished frame (or there are no more packets) + while (FrameFinished=0) and (av_read_frame(VideoFormatContext, @AVPacket)>=0) do + begin + // if we got a packet from the video stream, then decode it + if (AVPacket.stream_index=VideoStreamIndex) then + errnum:=avcodec_decode_video(VideoCodecContext, AVFrame, @frameFinished, + AVPacket.data, AVPacket.size); + // release internal packet structure created by av_read_frame + av_free_packet(PAVPacket(@AVPacket)); + end; + end; + // if we did not get an new frame, there's nothing more to do if Framefinished=0 then begin GoldenRec.Spawn(220,15,1,16,0,-1,ColoredStar,$0000ff); -- cgit v1.2.3 From 30343a531999b5e50673ee1731f1c54cbc008dfd Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 5 Sep 2007 12:02:06 +0000 Subject: added 3rd party dependencies ( except Jedi-SDL ) modified DPR to statically include all files needed (using relative paths) this means 3rd party components should not need installation in the IDE, or adding to search paths. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@368 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.dpr | 31 + Game/Code/lib/SQLite/SQLite3.dcu | Bin 0 -> 8243 bytes Game/Code/lib/SQLite/SQLite3.pas | 189 +++ Game/Code/lib/SQLite/SQLiteSpy.db3 | Bin 0 -> 154624 bytes Game/Code/lib/SQLite/SQLiteSpy.exe | Bin 0 -> 1657856 bytes Game/Code/lib/SQLite/SQLiteTable3.dcu | Bin 0 -> 19499 bytes Game/Code/lib/SQLite/SQLiteTable3.pas | 761 ++++++++++ Game/Code/lib/SQLite/SQLiteTable3.~pas | 761 ++++++++++ Game/Code/lib/SQLite/example/Sunset.jpg | Bin 0 -> 71189 bytes Game/Code/lib/SQLite/example/TestSqlite.dpr | 15 + Game/Code/lib/SQLite/example/TestSqlite.exe | Bin 0 -> 504832 bytes Game/Code/lib/SQLite/example/TestSqlite.res | Bin 0 -> 876 bytes Game/Code/lib/SQLite/example/uTestSqlite.dfm | 110 ++ Game/Code/lib/SQLite/example/uTestSqlite.pas | 233 +++ Game/Code/lib/SQLite/readme.txt | 82 ++ Game/Code/lib/SQLite/sqlite3.dll | Bin 0 -> 388126 bytes Game/Code/lib/SQLite/test.db | Bin 0 -> 73728 bytes Game/Code/lib/bass/bass.chm | Bin 0 -> 200682 bytes Game/Code/lib/bass/bass.dll | Bin 0 -> 93240 bytes Game/Code/lib/bass/bass.txt | 1546 ++++++++++++++++++++ Game/Code/lib/bass/delphi/bass.bpg | 64 + Game/Code/lib/bass/delphi/bass.dcu | Bin 0 -> 28085 bytes Game/Code/lib/bass/delphi/bass.pas | 968 +++++++++++++ Game/Code/lib/ffmpeg/MATHEMATICS.pas | 58 + Game/Code/lib/ffmpeg/acm_unit.pas | 197 +++ Game/Code/lib/ffmpeg/avcodec.dcu | Bin 0 -> 37652 bytes Game/Code/lib/ffmpeg/avcodec.pas | 1968 ++++++++++++++++++++++++++ Game/Code/lib/ffmpeg/avformat.dcu | Bin 0 -> 14389 bytes Game/Code/lib/ffmpeg/avformat.pas | 620 ++++++++ Game/Code/lib/ffmpeg/avio.dcu | Bin 0 -> 7189 bytes Game/Code/lib/ffmpeg/avio.pas | 241 ++++ Game/Code/lib/ffmpeg/avutil.dcu | Bin 0 -> 2515 bytes Game/Code/lib/ffmpeg/avutil.pas | 133 ++ Game/Code/lib/ffmpeg/mmreg.pas | 1446 +++++++++++++++++++ Game/Code/lib/ffmpeg/opt.dcu | Bin 0 -> 2442 bytes Game/Code/lib/ffmpeg/opt.pas | 101 ++ Game/Code/lib/ffmpeg/rational.dcu | Bin 0 -> 1395 bytes Game/Code/lib/ffmpeg/rational.pas | 88 ++ Game/Code/lib/midi/CIRCBUF.PAS | 192 +++ Game/Code/lib/midi/Circbuf.dcu | Bin 0 -> 2316 bytes Game/Code/lib/midi/DELPHMCB.PAS | 140 ++ Game/Code/lib/midi/Delphmcb.dcu | Bin 0 -> 1593 bytes Game/Code/lib/midi/MIDIDEFS.PAS | 47 + Game/Code/lib/midi/MIDIIN.DCR | Bin 0 -> 476 bytes Game/Code/lib/midi/MIDIOUT.DCR | Bin 0 -> 476 bytes Game/Code/lib/midi/MIDITYPE.PAS | 79 ++ Game/Code/lib/midi/MidiCons.dcu | Bin 0 -> 1153 bytes Game/Code/lib/midi/MidiDefs.dcu | Bin 0 -> 1039 bytes Game/Code/lib/midi/MidiFile.dcu | Bin 0 -> 19657 bytes Game/Code/lib/midi/MidiFile.pas | 947 +++++++++++++ Game/Code/lib/midi/MidiOut.dcu | Bin 0 -> 11602 bytes Game/Code/lib/midi/MidiScope.pas | 193 +++ Game/Code/lib/midi/MidiType.dcu | Bin 0 -> 2772 bytes Game/Code/lib/midi/Midicons.pas | 42 + Game/Code/lib/midi/Midiin.pas | 710 ++++++++++ Game/Code/lib/midi/Midiout.pas | 600 ++++++++ Game/Code/lib/midi/demo/MidiTest.dfm | Bin 0 -> 1872 bytes Game/Code/lib/midi/demo/MidiTest.pas | 249 ++++ Game/Code/lib/midi/demo/Project1.dpr | 13 + Game/Code/lib/midi/demo/Project1.res | Bin 0 -> 876 bytes Game/Code/lib/midi/midiComp.cfg | 35 + Game/Code/lib/midi/midiComp.dpk | 45 + Game/Code/lib/midi/midiComp.res | Bin 0 -> 876 bytes Game/Code/lib/midi/midifile.dcr | Bin 0 -> 472 bytes Game/Code/lib/midi/midiin.dcu | Bin 0 -> 13057 bytes Game/Code/lib/midi/midiscope.dcr | Bin 0 -> 476 bytes Game/Code/lib/midi/readme.txt | 60 + Game/Code/lib/requirements.txt | 17 + Game/Code/lib/zlportio/Example/README.TXT | 27 + Game/Code/lib/zlportio/Example/install.txt | 6 + Game/Code/lib/zlportio/Example/mainform.dfm | Bin 0 -> 2935 bytes Game/Code/lib/zlportio/Example/mainform.pas | 205 +++ Game/Code/lib/zlportio/Example/portio.dof | 85 ++ Game/Code/lib/zlportio/Example/portio.dpr | 14 + Game/Code/lib/zlportio/Example/portio.res | Bin 0 -> 876 bytes Game/Code/lib/zlportio/Example/zlportio.sys | Bin 0 -> 3664 bytes Game/Code/lib/zlportio/README.TXT | 27 + Game/Code/lib/zlportio/Sys/zlportio.sys | Bin 0 -> 4016 bytes Game/Code/lib/zlportio/ddkint.dcu | Bin 0 -> 5331 bytes Game/Code/lib/zlportio/ddkint.pas | 251 ++++ Game/Code/lib/zlportio/install.txt | 8 + Game/Code/lib/zlportio/zlportio.dcu | Bin 0 -> 4299 bytes Game/Code/lib/zlportio/zlportio.pas | 283 ++++ 83 files changed, 13887 insertions(+) create mode 100644 Game/Code/lib/SQLite/SQLite3.dcu create mode 100644 Game/Code/lib/SQLite/SQLite3.pas create mode 100644 Game/Code/lib/SQLite/SQLiteSpy.db3 create mode 100644 Game/Code/lib/SQLite/SQLiteSpy.exe create mode 100644 Game/Code/lib/SQLite/SQLiteTable3.dcu create mode 100644 Game/Code/lib/SQLite/SQLiteTable3.pas create mode 100644 Game/Code/lib/SQLite/SQLiteTable3.~pas create mode 100644 Game/Code/lib/SQLite/example/Sunset.jpg create mode 100644 Game/Code/lib/SQLite/example/TestSqlite.dpr create mode 100644 Game/Code/lib/SQLite/example/TestSqlite.exe create mode 100644 Game/Code/lib/SQLite/example/TestSqlite.res create mode 100644 Game/Code/lib/SQLite/example/uTestSqlite.dfm create mode 100644 Game/Code/lib/SQLite/example/uTestSqlite.pas create mode 100644 Game/Code/lib/SQLite/readme.txt create mode 100644 Game/Code/lib/SQLite/sqlite3.dll create mode 100644 Game/Code/lib/SQLite/test.db create mode 100644 Game/Code/lib/bass/bass.chm create mode 100644 Game/Code/lib/bass/bass.dll create mode 100644 Game/Code/lib/bass/bass.txt create mode 100644 Game/Code/lib/bass/delphi/bass.bpg create mode 100644 Game/Code/lib/bass/delphi/bass.dcu create mode 100644 Game/Code/lib/bass/delphi/bass.pas create mode 100644 Game/Code/lib/ffmpeg/MATHEMATICS.pas create mode 100644 Game/Code/lib/ffmpeg/acm_unit.pas create mode 100644 Game/Code/lib/ffmpeg/avcodec.dcu create mode 100644 Game/Code/lib/ffmpeg/avcodec.pas create mode 100644 Game/Code/lib/ffmpeg/avformat.dcu create mode 100644 Game/Code/lib/ffmpeg/avformat.pas create mode 100644 Game/Code/lib/ffmpeg/avio.dcu create mode 100644 Game/Code/lib/ffmpeg/avio.pas create mode 100644 Game/Code/lib/ffmpeg/avutil.dcu create mode 100644 Game/Code/lib/ffmpeg/avutil.pas create mode 100644 Game/Code/lib/ffmpeg/mmreg.pas create mode 100644 Game/Code/lib/ffmpeg/opt.dcu create mode 100644 Game/Code/lib/ffmpeg/opt.pas create mode 100644 Game/Code/lib/ffmpeg/rational.dcu create mode 100644 Game/Code/lib/ffmpeg/rational.pas create mode 100644 Game/Code/lib/midi/CIRCBUF.PAS create mode 100644 Game/Code/lib/midi/Circbuf.dcu create mode 100644 Game/Code/lib/midi/DELPHMCB.PAS create mode 100644 Game/Code/lib/midi/Delphmcb.dcu create mode 100644 Game/Code/lib/midi/MIDIDEFS.PAS create mode 100644 Game/Code/lib/midi/MIDIIN.DCR create mode 100644 Game/Code/lib/midi/MIDIOUT.DCR create mode 100644 Game/Code/lib/midi/MIDITYPE.PAS create mode 100644 Game/Code/lib/midi/MidiCons.dcu create mode 100644 Game/Code/lib/midi/MidiDefs.dcu create mode 100644 Game/Code/lib/midi/MidiFile.dcu create mode 100644 Game/Code/lib/midi/MidiFile.pas create mode 100644 Game/Code/lib/midi/MidiOut.dcu create mode 100644 Game/Code/lib/midi/MidiScope.pas create mode 100644 Game/Code/lib/midi/MidiType.dcu create mode 100644 Game/Code/lib/midi/Midicons.pas create mode 100644 Game/Code/lib/midi/Midiin.pas create mode 100644 Game/Code/lib/midi/Midiout.pas create mode 100644 Game/Code/lib/midi/demo/MidiTest.dfm create mode 100644 Game/Code/lib/midi/demo/MidiTest.pas create mode 100644 Game/Code/lib/midi/demo/Project1.dpr create mode 100644 Game/Code/lib/midi/demo/Project1.res create mode 100644 Game/Code/lib/midi/midiComp.cfg create mode 100644 Game/Code/lib/midi/midiComp.dpk create mode 100644 Game/Code/lib/midi/midiComp.res create mode 100644 Game/Code/lib/midi/midifile.dcr create mode 100644 Game/Code/lib/midi/midiin.dcu create mode 100644 Game/Code/lib/midi/midiscope.dcr create mode 100644 Game/Code/lib/midi/readme.txt create mode 100644 Game/Code/lib/requirements.txt create mode 100644 Game/Code/lib/zlportio/Example/README.TXT create mode 100644 Game/Code/lib/zlportio/Example/install.txt create mode 100644 Game/Code/lib/zlportio/Example/mainform.dfm create mode 100644 Game/Code/lib/zlportio/Example/mainform.pas create mode 100644 Game/Code/lib/zlportio/Example/portio.dof create mode 100644 Game/Code/lib/zlportio/Example/portio.dpr create mode 100644 Game/Code/lib/zlportio/Example/portio.res create mode 100644 Game/Code/lib/zlportio/Example/zlportio.sys create mode 100644 Game/Code/lib/zlportio/README.TXT create mode 100644 Game/Code/lib/zlportio/Sys/zlportio.sys create mode 100644 Game/Code/lib/zlportio/ddkint.dcu create mode 100644 Game/Code/lib/zlportio/ddkint.pas create mode 100644 Game/Code/lib/zlportio/install.txt create mode 100644 Game/Code/lib/zlportio/zlportio.dcu create mode 100644 Game/Code/lib/zlportio/zlportio.pas (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 08f41cba..30c03e7e 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -5,6 +5,37 @@ program UltraStar; {$R 'UltraStar.res' 'UltraStar.rc'} uses + //------------------------------ + //Includes - 3rd Party Libraries + //------------------------------ + OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas', + smpeg in 'lib\JEDI-SDLv1.0\smpeg\Pas\smpeg.pas', + + bass in 'lib\bass\delphi\bass.pas', + + midiout in 'lib\midi\midiout.pas', + midiin in 'lib\midi\midiin.pas', + Circbuf in 'lib\midi\CIRCBUF.PAS', + MidiType in 'lib\midi\MidiType.PAS', + MidiDefs in 'lib\midi\MidiDefs.PAS', + MidiCons in 'lib\midi\MidiCons.PAS', + MidiFile in 'lib\midi\MidiFile.PAS', + Delphmcb in 'lib\midi\Delphmcb.PAS', + + zlportio in 'lib\zlportio\zlportio.pas', + ddkint in 'lib\zlportio\ddkint.pas', + + avcodec in 'lib\ffmpeg\avcodec.pas', + avformat in 'lib\ffmpeg\avformat.pas', + avutil in 'lib\ffmpeg\avutil.pas', + rational in 'lib\ffmpeg\rational.pas', + opt in 'lib\ffmpeg\opt.pas', + avio in 'lib\ffmpeg\avio.pas', + + SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', + SQLite3 in 'lib\SQLite\SQLite3.pas', + + //------------------------------ //Includes - Menu System //------------------------------ diff --git a/Game/Code/lib/SQLite/SQLite3.dcu b/Game/Code/lib/SQLite/SQLite3.dcu new file mode 100644 index 00000000..4ff1c1c7 Binary files /dev/null and b/Game/Code/lib/SQLite/SQLite3.dcu differ diff --git a/Game/Code/lib/SQLite/SQLite3.pas b/Game/Code/lib/SQLite/SQLite3.pas new file mode 100644 index 00000000..b7f9d375 --- /dev/null +++ b/Game/Code/lib/SQLite/SQLite3.pas @@ -0,0 +1,189 @@ +unit SQLite3; + +{ + Simplified interface for SQLite. + Updated for Sqlite 3 by Tim Anderson (tim@itwriting.com) + Note: NOT COMPLETE for version 3, just minimal functionality + Adapted from file created by Pablo Pissanetzky (pablo@myhtpc.net) + which was based on SQLite.pas by Ben Hochstrasser (bhoc@surfeu.ch) +} + +interface + +const + + SQLiteDLL = 'sqlite3.dll'; + +// Return values for sqlite3_exec() and sqlite3_step() + + SQLITE_OK = 0; // Successful result + SQLITE_ERROR = 1; // SQL error or missing database + SQLITE_INTERNAL = 2; // An internal logic error in SQLite + SQLITE_PERM = 3; // Access permission denied + SQLITE_ABORT = 4; // Callback routine requested an abort + SQLITE_BUSY = 5; // The database file is locked + SQLITE_LOCKED = 6; // A table in the database is locked + SQLITE_NOMEM = 7; // A malloc() failed + SQLITE_READONLY = 8; // Attempt to write a readonly database + SQLITE_INTERRUPT = 9; // Operation terminated by sqlite3_interrupt() + SQLITE_IOERR = 10; // Some kind of disk I/O error occurred + SQLITE_CORRUPT = 11; // The database disk image is malformed + SQLITE_NOTFOUND = 12; // (Internal Only) Table or record not found + SQLITE_FULL = 13; // Insertion failed because database is full + SQLITE_CANTOPEN = 14; // Unable to open the database file + SQLITE_PROTOCOL = 15; // Database lock protocol error + SQLITE_EMPTY = 16; // Database is empty + SQLITE_SCHEMA = 17; // The database schema changed + SQLITE_TOOBIG = 18; // Too much data for one row of a table + SQLITE_CONSTRAINT = 19; // Abort due to contraint violation + SQLITE_MISMATCH = 20; // Data type mismatch + SQLITE_MISUSE = 21; // Library used incorrectly + SQLITE_NOLFS = 22; // Uses OS features not supported on host + SQLITE_AUTH = 23; // Authorization denied + SQLITE_FORMAT = 24; // Auxiliary database format error + SQLITE_RANGE = 25; // 2nd parameter to sqlite3_bind out of range + SQLITE_NOTADB = 26; // File opened that is not a database file + SQLITE_ROW = 100; // sqlite3_step() has another row ready + SQLITE_DONE = 101; // sqlite3_step() has finished executing + + SQLITE_INTEGER = 1; + SQLITE_FLOAT = 2; + SQLITE_TEXT = 3; + SQLITE_BLOB = 4; + SQLITE_NULL = 5; + +type + TSQLiteDB = Pointer; + TSQLiteResult = ^PChar; + TSQLiteStmt = Pointer; + +function SQLite3_Open(dbname: PChar; var db: TSqliteDB): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_open'; +function SQLite3_Close(db: TSQLiteDB): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_close'; +function SQLite3_Exec(db: TSQLiteDB; SQLStatement: PChar; CallbackPtr: Pointer; Sender: TObject; var ErrMsg: PChar): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_exec'; +function SQLite3_Version(): PChar; cdecl; external 'sqlite3.dll' name 'sqlite3_libversion'; +function SQLite3_ErrMsg(db: TSQLiteDB): PChar; cdecl; external 'sqlite3.dll' name 'sqlite3_errmsg'; +function SQLite3_ErrCode(db: TSQLiteDB): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_errcode'; +procedure SQlite3_Free(P: PChar); cdecl; external 'sqlite3.dll' name 'sqlite3_free'; +function SQLite3_GetTable(db: TSQLiteDB; SQLStatement: PChar; var ResultPtr: TSQLiteResult; var RowCount: Cardinal; var ColCount: Cardinal; var ErrMsg: PChar): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_get_table'; +procedure SQLite3_FreeTable(Table: TSQLiteResult); cdecl; external 'sqlite3.dll' name 'sqlite3_free_table'; +function SQLite3_Complete(P: PChar): boolean; cdecl; external 'sqlite3.dll' name 'sqlite3_complete'; +function SQLite3_LastInsertRowID(db: TSQLiteDB): int64; cdecl; external 'sqlite3.dll' name 'sqlite3_last_insert_rowid'; +procedure SQLite3_Interrupt(db: TSQLiteDB); cdecl; external 'sqlite3.dll' name 'sqlite3_interrupt'; +procedure SQLite3_BusyHandler(db: TSQLiteDB; CallbackPtr: Pointer; Sender: TObject); cdecl; external 'sqlite3.dll' name 'sqlite3_busy_handler'; +procedure SQLite3_BusyTimeout(db: TSQLiteDB; TimeOut: integer); cdecl; external 'sqlite3.dll' name 'sqlite3_busy_timeout'; +function SQLite3_Changes(db: TSQLiteDB): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_changes'; +function SQLite3_TotalChanges(db: TSQLiteDB): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_total_changes'; +function SQLite3_Prepare(db: TSQLiteDB; SQLStatement: PChar; nBytes: integer; var hStmt: TSqliteStmt; var pzTail: PChar): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_prepare'; +function SQLite3_ColumnCount(hStmt: TSqliteStmt): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_column_count'; +function Sqlite3_ColumnName(hStmt: TSqliteStmt; ColNum: integer): pchar; cdecl; external 'sqlite3.dll' name 'sqlite3_column_name'; +function Sqlite3_ColumnDeclType(hStmt: TSqliteStmt; ColNum: integer): pchar; cdecl; external 'sqlite3.dll' name 'sqlite3_column_decltype'; +function Sqlite3_Step(hStmt: TSqliteStmt): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_step'; +function SQLite3_DataCount(hStmt: TSqliteStmt): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_data_count'; + +function Sqlite3_ColumnBlob(hStmt: TSqliteStmt; ColNum: integer): pointer; cdecl; external 'sqlite3.dll' name 'sqlite3_column_blob'; +function Sqlite3_ColumnBytes(hStmt: TSqliteStmt; ColNum: integer): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_column_bytes'; +function Sqlite3_ColumnDouble(hStmt: TSqliteStmt; ColNum: integer): double; cdecl; external 'sqlite3.dll' name 'sqlite3_column_double'; +function Sqlite3_ColumnInt(hStmt: TSqliteStmt; ColNum: integer): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_column_int'; +function Sqlite3_ColumnText(hStmt: TSqliteStmt; ColNum: integer): pchar; cdecl; external 'sqlite3.dll' name 'sqlite3_column_text'; +function Sqlite3_ColumnType(hStmt: TSqliteStmt; ColNum: integer): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_column_type'; +function Sqlite3_ColumnInt64(hStmt: TSqliteStmt; ColNum: integer): Int64; cdecl; external 'sqlite3.dll' name 'sqlite3_column_int64'; +function SQLite3_Finalize(hStmt: TSqliteStmt): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_finalize'; +function SQLite3_Reset(hStmt: TSqliteStmt): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_reset'; + +// +// In the SQL strings input to sqlite3_prepare() and sqlite3_prepare16(), +// one or more literals can be replace by a wildcard "?" or ":N:" where +// N is an integer. These value of these wildcard literals can be set +// using the routines listed below. +// +// In every case, the first parameter is a pointer to the sqlite3_stmt +// structure returned from sqlite3_prepare(). The second parameter is the +// index of the wildcard. The first "?" has an index of 1. ":N:" wildcards +// use the index N. +// + // The fifth parameter to sqlite3_bind_blob(), sqlite3_bind_text(), and + //sqlite3_bind_text16() is a destructor used to dispose of the BLOB or +//text after SQLite has finished with it. If the fifth argument is the +// special value SQLITE_STATIC, then the library assumes that the information +// is in static, unmanaged space and does not need to be freed. If the +// fifth argument has the value SQLITE_TRANSIENT, then SQLite makes its +// own private copy of the data. +// +// The sqlite3_bind_* routine must be called before sqlite3_step() after +// an sqlite3_prepare() or sqlite3_reset(). Unbound wildcards are interpreted +// as NULL. +// + +function SQLite3_BindBlob(hStmt: TSqliteStmt; ParamNum: integer; + ptrData: pointer; numBytes: integer; ptrDestructor: pointer): integer; +cdecl; external 'sqlite3.dll' name 'sqlite3_bind_blob'; + +function SQLiteFieldType(SQLiteFieldTypeCode: Integer): AnsiString; +function SQLiteErrorStr(SQLiteErrorCode: Integer): AnsiString; + +implementation + +uses + SysUtils; + +function SQLiteFieldType(SQLiteFieldTypeCode: Integer): AnsiString; +begin + case SQLiteFieldTypeCode of + SQLITE_INTEGER: Result := 'Integer'; + SQLITE_FLOAT: Result := 'Float'; + SQLITE_TEXT: Result := 'Text'; + SQLITE_BLOB: Result := 'Blob'; + SQLITE_NULL: Result := 'Null'; + else + Result := 'Unknown SQLite Field Type Code "' + IntToStr(SQLiteFieldTypeCode) + '"'; + end; +end; + +function SQLiteErrorStr(SQLiteErrorCode: Integer): AnsiString; +begin + case SQLiteErrorCode of + SQLITE_OK: Result := 'Successful result'; + SQLITE_ERROR: Result := 'SQL error or missing database'; + SQLITE_INTERNAL: Result := 'An internal logic error in SQLite'; + SQLITE_PERM: Result := 'Access permission denied'; + SQLITE_ABORT: Result := 'Callback routine requested an abort'; + SQLITE_BUSY: Result := 'The database file is locked'; + SQLITE_LOCKED: Result := 'A table in the database is locked'; + SQLITE_NOMEM: Result := 'A malloc() failed'; + SQLITE_READONLY: Result := 'Attempt to write a readonly database'; + SQLITE_INTERRUPT: Result := 'Operation terminated by sqlite3_interrupt()'; + SQLITE_IOERR: Result := 'Some kind of disk I/O error occurred'; + SQLITE_CORRUPT: Result := 'The database disk image is malformed'; + SQLITE_NOTFOUND: Result := '(Internal Only) Table or record not found'; + SQLITE_FULL: Result := 'Insertion failed because database is full'; + SQLITE_CANTOPEN: Result := 'Unable to open the database file'; + SQLITE_PROTOCOL: Result := 'Database lock protocol error'; + SQLITE_EMPTY: Result := 'Database is empty'; + SQLITE_SCHEMA: Result := 'The database schema changed'; + SQLITE_TOOBIG: Result := 'Too much data for one row of a table'; + SQLITE_CONSTRAINT: Result := 'Abort due to contraint violation'; + SQLITE_MISMATCH: Result := 'Data type mismatch'; + SQLITE_MISUSE: Result := 'Library used incorrectly'; + SQLITE_NOLFS: Result := 'Uses OS features not supported on host'; + SQLITE_AUTH: Result := 'Authorization denied'; + SQLITE_FORMAT: Result := 'Auxiliary database format error'; + SQLITE_RANGE: Result := '2nd parameter to sqlite3_bind out of range'; + SQLITE_NOTADB: Result := 'File opened that is not a database file'; + SQLITE_ROW: Result := 'sqlite3_step() has another row ready'; + SQLITE_DONE: Result := 'sqlite3_step() has finished executing'; + else + Result := 'Unknown SQLite Error Code "' + IntToStr(SQLiteErrorCode) + '"'; + end; +end; + +function ColValueToStr(Value: PChar): AnsiString; +begin + if (Value = nil) then + Result := 'NULL' + else + Result := Value; +end; + + +end. + diff --git a/Game/Code/lib/SQLite/SQLiteSpy.db3 b/Game/Code/lib/SQLite/SQLiteSpy.db3 new file mode 100644 index 00000000..39ec37b5 Binary files /dev/null and b/Game/Code/lib/SQLite/SQLiteSpy.db3 differ diff --git a/Game/Code/lib/SQLite/SQLiteSpy.exe b/Game/Code/lib/SQLite/SQLiteSpy.exe new file mode 100644 index 00000000..04cf3c80 Binary files /dev/null and b/Game/Code/lib/SQLite/SQLiteSpy.exe differ diff --git a/Game/Code/lib/SQLite/SQLiteTable3.dcu b/Game/Code/lib/SQLite/SQLiteTable3.dcu new file mode 100644 index 00000000..59ec7037 Binary files /dev/null and b/Game/Code/lib/SQLite/SQLiteTable3.dcu differ diff --git a/Game/Code/lib/SQLite/SQLiteTable3.pas b/Game/Code/lib/SQLite/SQLiteTable3.pas new file mode 100644 index 00000000..19346915 --- /dev/null +++ b/Game/Code/lib/SQLite/SQLiteTable3.pas @@ -0,0 +1,761 @@ +unit SQLiteTable3; + +{ + Simple classes for using SQLite's exec and get_table. + + TSQLiteDatabase wraps the calls to open and close an SQLite database. + It also wraps SQLite_exec for queries that do not return a result set + + TSQLiteTable wraps sqlite_get_table. + It allows accessing fields by name as well as index and can step through a + result set with the Next procedure. + + Adapted by Tim Anderson (tim@itwriting.com) + Originally created by Pablo Pissanetzky (pablo@myhtpc.net) + Modified and enhanced by Lukas Gebauer +} + +interface + +uses + Windows, SQLite3, Classes, SysUtils; + +const + + dtInt = 1; + dtNumeric = 2; + dtStr = 3; + dtBlob = 4; + dtNull = 5; + +type + + ESQLiteException = class(Exception) + end; + + TSQLiteTable = class; + + TSQLiteDatabase = class + private + fDB: TSQLiteDB; + fInTrans: boolean; + procedure RaiseError(s: string; SQL: string); + public + constructor Create(const FileName: string); + destructor Destroy; override; + function GetTable(const SQL: string): TSQLiteTable; + procedure ExecSQL(const SQL: string); + function GetTableValue(const SQL: string): int64; + function GetTableString(const SQL: string): string; + procedure UpdateBlob(const SQL: string; BlobData: TStream); + procedure BeginTransaction; + procedure Commit; + procedure Rollback; + function TableExists(TableName: string): boolean; + function GetLastInsertRowID: int64; + procedure SetTimeout(Value: integer); + function version: string; + published + property isTransactionOpen: boolean read fInTrans; + end; + + TSQLiteTable = class + private + fResults: TList; + fRowCount: cardinal; + fColCount: cardinal; + fCols: TStringList; + fColTypes: TList; + fRow: cardinal; + function GetFields(I: cardinal): string; + function GetEOF: boolean; + function GetBOF: boolean; + function GetColumns(I: integer): string; + function GetFieldByName(FieldName: string): string; + function GetFieldIndex(FieldName: string): integer; + function GetCount: integer; + function GetCountResult: integer; + public + constructor Create(DB: TSQLiteDatabase; const SQL: string); + destructor Destroy; override; + function FieldAsInteger(I: cardinal): int64; + function FieldAsBlob(I: cardinal): TMemoryStream; + function FieldAsBlobText(I: cardinal): string; + function FieldIsNull(I: cardinal): boolean; + function FieldAsString(I: cardinal): string; + function FieldAsDouble(I: cardinal): double; + function Next: boolean; + function Previous: boolean; + property EOF: boolean read GetEOF; + property BOF: boolean read GetBOF; + property Fields[I: cardinal]: string read GetFields; + property FieldByName[FieldName: string]: string read GetFieldByName; + property FieldIndex[FieldName: string]: integer read GetFieldIndex; + property Columns[I: integer]: string read GetColumns; + property ColCount: cardinal read fColCount; + property RowCount: cardinal read fRowCount; + property Row: cardinal read fRow; + function MoveFirst: boolean; + function MoveLast: boolean; + property Count: integer read GetCount; + // The property CountResult is used when you execute count(*) queries. + // It returns 0 if the result set is empty or the value of the + // first field as an integer. + property CountResult: integer read GetCountResult; + end; + +procedure DisposePointer(ptr: pointer); cdecl; + + +implementation + +procedure DisposePointer(ptr: pointer); cdecl; +begin + if assigned(ptr) then + freemem(ptr); +end; + +//------------------------------------------------------------------------------ +// TSQLiteDatabase +//------------------------------------------------------------------------------ + +constructor TSQLiteDatabase.Create(const FileName: string); +var + Msg: pchar; + iResult: integer; +begin + inherited Create; + + self.fInTrans := False; + + Msg := nil; + try + iResult := SQLite3_Open(PChar(FileName), Fdb); + + if iResult <> SQLITE_OK then + if Assigned(Fdb) then + begin + Msg := Sqlite3_ErrMsg(Fdb); + raise ESqliteException.CreateFmt('Failed to open database "%s" : %s', + [FileName, Msg]); + end + else + raise ESqliteException.CreateFmt('Failed to open database "%s" : unknown error', + [FileName]); + + //set a few configs + self.ExecSQL('PRAGMA SYNCHRONOUS=NORMAL;'); +// self.ExecSQL('PRAGMA full_column_names = 1;'); + self.ExecSQL('PRAGMA temp_store = MEMORY;'); + + finally + if Assigned(Msg) then + SQLite3_Free(Msg); + end; + +end; + + +//.............................................................................. + +destructor TSQLiteDatabase.Destroy; +begin + + if self.fInTrans then + self.ExecSQL('ROLLBACK;'); //assume rollback + + if Assigned(fDB) then + SQLite3_Close(fDB); + + inherited; +end; + +function TSQLiteDatabase.GetLastInsertRowID: int64; +begin + Result := Sqlite3_LastInsertRowID(self.fDB); +end; + +//.............................................................................. + +procedure TSQLiteDatabase.RaiseError(s: string; SQL: string); +//look up last error and raise an exception with an appropriate message +var + Msg: PChar; +begin + + Msg := nil; + + if sqlite3_errcode(self.fDB) <> SQLITE_OK then + Msg := sqlite3_errmsg(self.fDB); + + if Msg <> nil then + raise ESqliteException.CreateFmt(s + ' "%s" : %s', [SQL, Msg]) + else + raise ESqliteException.CreateFmt(s, [SQL, 'No message']); + +end; + +procedure TSQLiteDatabase.ExecSQL(const SQL: string); +var + Stmt: TSQLiteStmt; + NextSQLStatement: Pchar; + iStepResult: integer; +begin + try + + if Sqlite3_Prepare(self.fDB, PChar(SQL), -1, Stmt, NextSQLStatement) <> + SQLITE_OK then + RaiseError('Error executing SQL', SQL); + + if (Stmt = nil) then + RaiseError('Could not prepare SQL statement', SQL); + + iStepResult := Sqlite3_step(Stmt); + + if (iStepResult <> SQLITE_DONE) then + RaiseError('Error executing SQL statement', SQL); + + finally + + if Assigned(Stmt) then + Sqlite3_Finalize(stmt); + + end; +end; + +procedure TSQLiteDatabase.UpdateBlob(const SQL: string; BlobData: TStream); +var + iSize: integer; + ptr: pointer; + Stmt: TSQLiteStmt; + Msg: Pchar; + NextSQLStatement: Pchar; + iStepResult: integer; + iBindResult: integer; +begin + //expects SQL of the form 'UPDATE MYTABLE SET MYFIELD = ? WHERE MYKEY = 1' + + if pos('?', SQL) = 0 then + RaiseError('SQL must include a ? parameter', SQL); + + Msg := nil; + try + + if Sqlite3_Prepare(self.fDB, PChar(SQL), -1, Stmt, NextSQLStatement) <> + SQLITE_OK then + RaiseError('Could not prepare SQL statement', SQL); + + if (Stmt = nil) then + RaiseError('Could not prepare SQL statement', SQL); + + //now bind the blob data + iSize := BlobData.size; + + GetMem(ptr, iSize); + + if (ptr = nil) then + raise ESqliteException.CreateFmt('Error getting memory to save blob', + [SQL, 'Error']); + + BlobData.position := 0; + BlobData.Read(ptr^, iSize); + + iBindResult := SQLite3_BindBlob(stmt, 1, ptr, iSize, @DisposePointer); + + if iBindResult <> SQLITE_OK then + RaiseError('Error binding blob to database', SQL); + + iStepResult := Sqlite3_step(Stmt); + + if (iStepResult <> SQLITE_DONE) then + RaiseError('Error executing SQL statement', SQL); + + finally + + if Assigned(Stmt) then + Sqlite3_Finalize(stmt); + + if Assigned(Msg) then + SQLite3_Free(Msg); + end; + +end; + +//.............................................................................. + +function TSQLiteDatabase.GetTable(const SQL: string): TSQLiteTable; +begin + Result := TSQLiteTable.Create(Self, SQL); +end; + +function TSQLiteDatabase.GetTableValue(const SQL: string): int64; +var + Table: TSQLiteTable; +begin + Table := self.GetTable(SQL); + try + Result := Table.FieldAsInteger(0); + finally + Table.Free; + end; +end; + +function TSQLiteDatabase.GetTableString(const SQL: string): string; +var + Table: TSQLiteTable; +begin + Table := self.GetTable(SQL); + try + Result := Table.FieldAsString(0); + finally + Table.Free; + end; +end; + + +procedure TSQLiteDatabase.BeginTransaction; +begin + if not self.fInTrans then + begin + self.ExecSQL('BEGIN TRANSACTION;'); + self.fInTrans := True; + end + else + raise ESqliteException.Create('Transaction already open'); +end; + +procedure TSQLiteDatabase.Commit; +begin + self.ExecSQL('COMMIT;'); + self.fInTrans := False; +end; + +procedure TSQLiteDatabase.Rollback; +begin + self.ExecSQL('ROLLBACK;'); + self.fInTrans := False; +end; + +function TSQLiteDatabase.TableExists(TableName: string): boolean; +var + sql: string; + ds: TSqliteTable; +begin + //returns true if table exists in the database + sql := 'select [sql] from sqlite_master where [type] = ''table'' and lower(name) = ''' + + lowercase(TableName) + ''' '; + ds := self.GetTable(sql); + try + Result := (ds.Count > 0); + finally + ds.Free; + end; +end; + +procedure TSQLiteDatabase.SetTimeout(Value: integer); +begin + SQLite3_BusyTimeout(self.fDB, Value); +end; + +function TSQLiteDatabase.version: string; +begin + Result := SQLite3_Version; +end; + + +//------------------------------------------------------------------------------ +// TSQLiteTable +//------------------------------------------------------------------------------ + +constructor TSQLiteTable.Create(DB: TSQLiteDatabase; const SQL: string); +var + Stmt: TSQLiteStmt; + NextSQLStatement: Pchar; + iStepResult: integer; + ptr: pointer; + iNumBytes: integer; + thisBlobValue: TMemoryStream; + thisStringValue: pstring; + thisDoubleValue: pDouble; + thisIntValue: pInt64; + thisColType: pInteger; + i: integer; + DeclaredColType: Pchar; + ActualColType: integer; + ptrValue: Pchar; +begin + try + self.fRowCount := 0; + self.fColCount := 0; + //if there are several SQL statements in SQL, NextSQLStatment points to the + //beginning of the next one. Prepare only prepares the first SQL statement. + if Sqlite3_Prepare(DB.fDB, PChar(SQL), -1, Stmt, NextSQLStatement) <> SQLITE_OK then + DB.RaiseError('Error executing SQL', SQL); + if (Stmt = nil) then + DB.RaiseError('Could not prepare SQL statement', SQL); + iStepResult := Sqlite3_step(Stmt); + while (iStepResult <> SQLITE_DONE) do + begin + case iStepResult of + SQLITE_ROW: + begin + Inc(fRowCount); + if (fRowCount = 1) then + begin + //get data types + fCols := TStringList.Create; + fColTypes := TList.Create; + fColCount := SQLite3_ColumnCount(stmt); + for i := 0 to Pred(fColCount) do + fCols.Add(AnsiUpperCase(Sqlite3_ColumnName(stmt, i))); + for i := 0 to Pred(fColCount) do + begin + new(thisColType); + DeclaredColType := Sqlite3_ColumnDeclType(stmt, i); + if DeclaredColType = nil then + thisColType^ := Sqlite3_ColumnType(stmt, i) //use the actual column type instead + //seems to be needed for last_insert_rowid + else + if (DeclaredColType = 'INTEGER') or (DeclaredColType = 'BOOLEAN') then + thisColType^ := dtInt + else + if (DeclaredColType = 'NUMERIC') or + (DeclaredColType = 'FLOAT') or + (DeclaredColType = 'DOUBLE') or + (DeclaredColType = 'REAL') then + thisColType^ := dtNumeric + else + if DeclaredColType = 'BLOB' then + thisColType^ := dtBlob + else + thisColType^ := dtStr; + fColTypes.Add(thiscoltype); + end; + fResults := TList.Create; + end; + + //get column values + for i := 0 to Pred(ColCount) do + begin + ActualColType := Sqlite3_ColumnType(stmt, i); + if (ActualColType = SQLITE_NULL) then + fResults.Add(nil) + else + if pInteger(fColTypes[i])^ = dtInt then + begin + new(thisintvalue); + thisintvalue^ := Sqlite3_ColumnInt64(stmt, i); + fResults.Add(thisintvalue); + end + else + if pInteger(fColTypes[i])^ = dtNumeric then + begin + new(thisdoublevalue); + thisdoublevalue^ := Sqlite3_ColumnDouble(stmt, i); + fResults.Add(thisdoublevalue); + end + else + if pInteger(fColTypes[i])^ = dtBlob then + begin + iNumBytes := Sqlite3_ColumnBytes(stmt, i); + if iNumBytes = 0 then + thisblobvalue := nil + else + begin + thisblobvalue := TMemoryStream.Create; + thisblobvalue.position := 0; + ptr := Sqlite3_ColumnBlob(stmt, i); + thisblobvalue.writebuffer(ptr^, iNumBytes); + end; + fResults.Add(thisblobvalue); + end + else + begin + new(thisstringvalue); + ptrValue := Sqlite3_ColumnText(stmt, i); + setstring(thisstringvalue^, ptrvalue, strlen(ptrvalue)); + fResults.Add(thisstringvalue); + end; + end; + end; + SQLITE_BUSY: + raise ESqliteException.CreateFmt('Could not prepare SQL statement', + [SQL, 'SQLite is Busy']); + else + DB.RaiseError('Could not retrieve data', SQL); + end; + iStepResult := Sqlite3_step(Stmt); + end; + fRow := 0; + finally + if Assigned(Stmt) then + Sqlite3_Finalize(stmt); + end; +end; + +//.............................................................................. + +destructor TSQLiteTable.Destroy; +var + i: cardinal; + iColNo: integer; +begin + if Assigned(fResults) then + begin + for i := 0 to fResults.Count - 1 do + begin + //check for blob type + iColNo := (i mod fColCount); + case pInteger(self.fColTypes[iColNo])^ of + dtBlob: + TMemoryStream(fResults[i]).Free; + dtStr: + if fResults[i] <> nil then + begin + setstring(string(fResults[i]^), nil, 0); + dispose(fResults[i]); + end; + else + dispose(fResults[i]); + end; + end; + fResults.Free; + end; + if Assigned(fCols) then + fCols.Free; + if Assigned(fColTypes) then + for i := 0 to fColTypes.Count - 1 do + dispose(fColTypes[i]); + fColTypes.Free; + inherited; +end; + +//.............................................................................. + +function TSQLiteTable.GetColumns(I: integer): string; +begin + Result := fCols[I]; +end; + +//.............................................................................. + +function TSQLiteTable.GetCountResult: integer; +begin + if not EOF then + Result := StrToInt(Fields[0]) + else + Result := 0; +end; + +function TSQLiteTable.GetCount: integer; +begin + Result := FRowCount; +end; + +//.............................................................................. + +function TSQLiteTable.GetEOF: boolean; +begin + Result := fRow >= fRowCount; +end; + +function TSQLiteTable.GetBOF: boolean; +begin + Result := fRow <= 0; +end; + +//.............................................................................. + +function TSQLiteTable.GetFieldByName(FieldName: string): string; +begin + Result := GetFields(self.GetFieldIndex(FieldName)); +end; + +function TSQLiteTable.GetFieldIndex(FieldName: string): integer; +begin + + if (fCols = nil) then + begin + raise ESqliteException.Create('Field ' + fieldname + ' Not found. Empty dataset'); + exit; + end; + + if (fCols.count = 0) then + begin + raise ESqliteException.Create('Field ' + fieldname + ' Not found. Empty dataset'); + exit; + end; + + Result := fCols.IndexOf(AnsiUpperCase(FieldName)); + + if (result < 0) then + begin raise ESqliteException.Create('Field not found in dataset: ' + fieldname) end; + +end; + +//.............................................................................. + +function TSQLiteTable.GetFields(I: cardinal): string; +var + thisvalue: pstring; + thistype: integer; +begin + Result := ''; + if EOF then + raise ESqliteException.Create('Table is at End of File'); + //integer types are not stored in the resultset + //as strings, so they should be retrieved using the type-specific + //methods + thistype := pInteger(self.fColTypes[I])^; + + case thistype of + dtStr: + begin + thisvalue := self.fResults[(self.frow * self.fColCount) + I]; + if (thisvalue <> nil) then + Result := thisvalue^ + else + Result := ''; + end; + dtInt: + Result := IntToStr(self.FieldAsInteger(I)); + dtNumeric: + Result := FloatToStr(self.FieldAsDouble(I)); + dtBlob: + Result := self.FieldAsBlobText(I); + else + Result := ''; + end; +end; + +function TSqliteTable.FieldAsBlob(I: cardinal): TMemoryStream; +begin + if EOF then + raise ESqliteException.Create('Table is at End of File'); + if (self.fResults[(self.frow * self.fColCount) + I] = nil) then + Result := nil + else + if pInteger(self.fColTypes[I])^ = dtBlob then + Result := TMemoryStream(self.fResults[(self.frow * self.fColCount) + I]) + else + raise ESqliteException.Create('Not a Blob field'); +end; + +function TSqliteTable.FieldAsBlobText(I: cardinal): string; +var + MemStream: TMemoryStream; + Buffer: PChar; +begin + Result := ''; + MemStream := self.FieldAsBlob(I); + if MemStream <> nil then + if MemStream.Size > 0 then + begin + MemStream.position := 0; + Buffer := stralloc(MemStream.Size + 1); + MemStream.readbuffer(Buffer[0], MemStream.Size); + (Buffer + MemStream.Size)^ := chr(0); + SetString(Result, Buffer, MemStream.size); + strdispose(Buffer); + end; +end; + + +function TSqliteTable.FieldAsInteger(I: cardinal): int64; +begin + if EOF then + //raise ESqliteException.Create('Table is at End of File'); + Result := 0 + else if (self.fResults[(self.frow * self.fColCount) + I] = nil) then + Result := 0 + else + if pInteger(self.fColTypes[I])^ = dtInt then + Result := pInt64(self.fResults[(self.frow * self.fColCount) + I])^ + else + if pInteger(self.fColTypes[I])^ = dtNumeric then + Result := trunc(strtofloat(pString(self.fResults[(self.frow * self.fColCount) + I])^)) + else + raise ESqliteException.Create('Not an integer or numeric field'); +end; + +function TSqliteTable.FieldAsDouble(I: cardinal): double; +begin + if EOF then + raise ESqliteException.Create('Table is at End of File'); + if (self.fResults[(self.frow * self.fColCount) + I] = nil) then + Result := 0 + else + if pInteger(self.fColTypes[I])^ = dtInt then + Result := pInt64(self.fResults[(self.frow * self.fColCount) + I])^ + else + if pInteger(self.fColTypes[I])^ = dtNumeric then + Result := pDouble(self.fResults[(self.frow * self.fColCount) + I])^ + else + raise ESqliteException.Create('Not an integer or numeric field'); +end; + +function TSqliteTable.FieldAsString(I: cardinal): string; +begin + if EOF then + raise ESqliteException.Create('Table is at End of File'); + if (self.fResults[(self.frow * self.fColCount) + I] = nil) then + Result := '' + else + Result := self.GetFields(I); +end; + +function TSqliteTable.FieldIsNull(I: cardinal): boolean; +var + thisvalue: pointer; +begin + if EOF then + raise ESqliteException.Create('Table is at End of File'); + thisvalue := self.fResults[(self.frow * self.fColCount) + I]; + Result := (thisvalue = nil); +end; + +//.............................................................................. + +function TSQLiteTable.Next: boolean; +begin + Result := False; + if not EOF then + begin + Inc(fRow); + Result := True; + end; +end; + +function TSQLiteTable.Previous: boolean; +begin + Result := False; + if not BOF then + begin + Dec(fRow); + Result := True; + end; +end; + +function TSQLiteTable.MoveFirst: boolean; +begin + Result := False; + if self.fRowCount > 0 then + begin + fRow := 0; + Result := True; + end; +end; + +function TSQLiteTable.MoveLast: boolean; +begin + Result := False; + if self.fRowCount > 0 then + begin + fRow := fRowCount - 1; + Result := True; + end; +end; + + +end. + diff --git a/Game/Code/lib/SQLite/SQLiteTable3.~pas b/Game/Code/lib/SQLite/SQLiteTable3.~pas new file mode 100644 index 00000000..01be1e5b --- /dev/null +++ b/Game/Code/lib/SQLite/SQLiteTable3.~pas @@ -0,0 +1,761 @@ +unit SQLiteTable3; + +{ + Simple classes for using SQLite's exec and get_table. + + TSQLiteDatabase wraps the calls to open and close an SQLite database. + It also wraps SQLite_exec for queries that do not return a result set + + TSQLiteTable wraps sqlite_get_table. + It allows accessing fields by name as well as index and can step through a + result set with the Next procedure. + + Adapted by Tim Anderson (tim@itwriting.com) + Originally created by Pablo Pissanetzky (pablo@myhtpc.net) + Modified and enhanced by Lukas Gebauer +} + +interface + +uses + Windows, SQLite3, Classes, SysUtils; + +const + + dtInt = 1; + dtNumeric = 2; + dtStr = 3; + dtBlob = 4; + dtNull = 5; + +type + + ESQLiteException = class(Exception) + end; + + TSQLiteTable = class; + + TSQLiteDatabase = class + private + fDB: TSQLiteDB; + fInTrans: boolean; + procedure RaiseError(s: string; SQL: string); + public + constructor Create(const FileName: string); + destructor Destroy; override; + function GetTable(const SQL: string): TSQLiteTable; + procedure ExecSQL(const SQL: string); + function GetTableValue(const SQL: string): int64; + function GetTableString(const SQL: string): string; + procedure UpdateBlob(const SQL: string; BlobData: TStream); + procedure BeginTransaction; + procedure Commit; + procedure Rollback; + function TableExists(TableName: string): boolean; + function GetLastInsertRowID: int64; + procedure SetTimeout(Value: integer); + function version: string; + published + property isTransactionOpen: boolean read fInTrans; + end; + + TSQLiteTable = class + private + fResults: TList; + fRowCount: cardinal; + fColCount: cardinal; + fCols: TStringList; + fColTypes: TList; + fRow: cardinal; + function GetFields(I: cardinal): string; + function GetEOF: boolean; + function GetBOF: boolean; + function GetColumns(I: integer): string; + function GetFieldByName(FieldName: string): string; + function GetFieldIndex(FieldName: string): integer; + function GetCount: integer; + function GetCountResult: integer; + public + constructor Create(DB: TSQLiteDatabase; const SQL: string); + destructor Destroy; override; + function FieldAsInteger(I: cardinal): int64; + function FieldAsBlob(I: cardinal): TMemoryStream; + function FieldAsBlobText(I: cardinal): string; + function FieldIsNull(I: cardinal): boolean; + function FieldAsString(I: cardinal): string; + function FieldAsDouble(I: cardinal): double; + function Next: boolean; + function Previous: boolean; + property EOF: boolean read GetEOF; + property BOF: boolean read GetBOF; + property Fields[I: cardinal]: string read GetFields; + property FieldByName[FieldName: string]: string read GetFieldByName; + property FieldIndex[FieldName: string]: integer read GetFieldIndex; + property Columns[I: integer]: string read GetColumns; + property ColCount: cardinal read fColCount; + property RowCount: cardinal read fRowCount; + property Row: cardinal read fRow; + function MoveFirst: boolean; + function MoveLast: boolean; + property Count: integer read GetCount; + // The property CountResult is used when you execute count(*) queries. + // It returns 0 if the result set is empty or the value of the + // first field as an integer. + property CountResult: integer read GetCountResult; + end; + +procedure DisposePointer(ptr: pointer); cdecl; + + +implementation + +procedure DisposePointer(ptr: pointer); cdecl; +begin + if assigned(ptr) then + freemem(ptr); +end; + +//------------------------------------------------------------------------------ +// TSQLiteDatabase +//------------------------------------------------------------------------------ + +constructor TSQLiteDatabase.Create(const FileName: string); +var + Msg: pchar; + iResult: integer; +begin + inherited Create; + + self.fInTrans := False; + + Msg := nil; + try + iResult := SQLite3_Open(PChar(FileName), Fdb); + + if iResult <> SQLITE_OK then + if Assigned(Fdb) then + begin + Msg := Sqlite3_ErrMsg(Fdb); + raise ESqliteException.CreateFmt('Failed to open database "%s" : %s', + [FileName, Msg]); + end + else + raise ESqliteException.CreateFmt('Failed to open database "%s" : unknown error', + [FileName]); + + //set a few configs + self.ExecSQL('PRAGMA SYNCHRONOUS=NORMAL;'); +// self.ExecSQL('PRAGMA full_column_names = 1;'); + self.ExecSQL('PRAGMA temp_store = MEMORY;'); + + finally + if Assigned(Msg) then + SQLite3_Free(Msg); + end; + +end; + + +//.............................................................................. + +destructor TSQLiteDatabase.Destroy; +begin + + if self.fInTrans then + self.ExecSQL('ROLLBACK;'); //assume rollback + + if Assigned(fDB) then + SQLite3_Close(fDB); + + inherited; +end; + +function TSQLiteDatabase.GetLastInsertRowID: int64; +begin + Result := Sqlite3_LastInsertRowID(self.fDB); +end; + +//.............................................................................. + +procedure TSQLiteDatabase.RaiseError(s: string; SQL: string); +//look up last error and raise an exception with an appropriate message +var + Msg: PChar; +begin + + Msg := nil; + + if sqlite3_errcode(self.fDB) <> SQLITE_OK then + Msg := sqlite3_errmsg(self.fDB); + + if Msg <> nil then + raise ESqliteException.CreateFmt(s + ' "%s" : %s', [SQL, Msg]) + else + raise ESqliteException.CreateFmt(s, [SQL, 'No message']); + +end; + +procedure TSQLiteDatabase.ExecSQL(const SQL: string); +var + Stmt: TSQLiteStmt; + NextSQLStatement: Pchar; + iStepResult: integer; +begin + try + + if Sqlite3_Prepare(self.fDB, PChar(SQL), -1, Stmt, NextSQLStatement) <> + SQLITE_OK then + RaiseError('Error executing SQL', SQL); + + if (Stmt = nil) then + RaiseError('Could not prepare SQL statement', SQL); + + iStepResult := Sqlite3_step(Stmt); + + if (iStepResult <> SQLITE_DONE) then + RaiseError('Error executing SQL statement', SQL); + + finally + + if Assigned(Stmt) then + Sqlite3_Finalize(stmt); + + end; +end; + +procedure TSQLiteDatabase.UpdateBlob(const SQL: string; BlobData: TStream); +var + iSize: integer; + ptr: pointer; + Stmt: TSQLiteStmt; + Msg: Pchar; + NextSQLStatement: Pchar; + iStepResult: integer; + iBindResult: integer; +begin + //expects SQL of the form 'UPDATE MYTABLE SET MYFIELD = ? WHERE MYKEY = 1' + + if pos('?', SQL) = 0 then + RaiseError('SQL must include a ? parameter', SQL); + + Msg := nil; + try + + if Sqlite3_Prepare(self.fDB, PChar(SQL), -1, Stmt, NextSQLStatement) <> + SQLITE_OK then + RaiseError('Could not prepare SQL statement', SQL); + + if (Stmt = nil) then + RaiseError('Could not prepare SQL statement', SQL); + + //now bind the blob data + iSize := BlobData.size; + + GetMem(ptr, iSize); + + if (ptr = nil) then + raise ESqliteException.CreateFmt('Error getting memory to save blob', + [SQL, 'Error']); + + BlobData.position := 0; + BlobData.Read(ptr^, iSize); + + iBindResult := SQLite3_BindBlob(stmt, 1, ptr, iSize, @DisposePointer); + + if iBindResult <> SQLITE_OK then + RaiseError('Error binding blob to database', SQL); + + iStepResult := Sqlite3_step(Stmt); + + if (iStepResult <> SQLITE_DONE) then + RaiseError('Error executing SQL statement', SQL); + + finally + + if Assigned(Stmt) then + Sqlite3_Finalize(stmt); + + if Assigned(Msg) then + SQLite3_Free(Msg); + end; + +end; + +//.............................................................................. + +function TSQLiteDatabase.GetTable(const SQL: string): TSQLiteTable; +begin + Result := TSQLiteTable.Create(Self, SQL); +end; + +function TSQLiteDatabase.GetTableValue(const SQL: string): int64; +var + Table: TSQLiteTable; +begin + Table := self.GetTable(SQL); + try + Result := Table.FieldAsInteger(0); + finally + Table.Free; + end; +end; + +function TSQLiteDatabase.GetTableString(const SQL: string): string; +var + Table: TSQLiteTable; +begin + Table := self.GetTable(SQL); + try + Result := Table.FieldAsString(0); + finally + Table.Free; + end; +end; + + +procedure TSQLiteDatabase.BeginTransaction; +begin + if not self.fInTrans then + begin + self.ExecSQL('BEGIN TRANSACTION;'); + self.fInTrans := True; + end + else + raise ESqliteException.Create('Transaction already open'); +end; + +procedure TSQLiteDatabase.Commit; +begin + self.ExecSQL('COMMIT;'); + self.fInTrans := False; +end; + +procedure TSQLiteDatabase.Rollback; +begin + self.ExecSQL('ROLLBACK;'); + self.fInTrans := False; +end; + +function TSQLiteDatabase.TableExists(TableName: string): boolean; +var + sql: string; + ds: TSqliteTable; +begin + //returns true if table exists in the database + sql := 'select [sql] from sqlite_master where [type] = ''table'' and lower(name) = ''' + + lowercase(TableName) + ''' '; + ds := self.GetTable(sql); + try + Result := (ds.Count > 0); + finally + ds.Free; + end; +end; + +procedure TSQLiteDatabase.SetTimeout(Value: integer); +begin + SQLite3_BusyTimeout(self.fDB, Value); +end; + +function TSQLiteDatabase.version: string; +begin + Result := SQLite3_Version; +end; + + +//------------------------------------------------------------------------------ +// TSQLiteTable +//------------------------------------------------------------------------------ + +constructor TSQLiteTable.Create(DB: TSQLiteDatabase; const SQL: string); +var + Stmt: TSQLiteStmt; + NextSQLStatement: Pchar; + iStepResult: integer; + ptr: pointer; + iNumBytes: integer; + thisBlobValue: TMemoryStream; + thisStringValue: pstring; + thisDoubleValue: pDouble; + thisIntValue: pInt64; + thisColType: pInteger; + i: integer; + DeclaredColType: Pchar; + ActualColType: integer; + ptrValue: Pchar; +begin + try + self.fRowCount := 0; + self.fColCount := 0; + //if there are several SQL statements in SQL, NextSQLStatment points to the + //beginning of the next one. Prepare only prepares the first SQL statement. + if Sqlite3_Prepare(DB.fDB, PChar(SQL), -1, Stmt, NextSQLStatement) <> SQLITE_OK then + DB.RaiseError('Error executing SQL', SQL); + if (Stmt = nil) then + DB.RaiseError('Could not prepare SQL statement', SQL); + iStepResult := Sqlite3_step(Stmt); + while (iStepResult <> SQLITE_DONE) do + begin + case iStepResult of + SQLITE_ROW: + begin + Inc(fRowCount); + if (fRowCount = 1) then + begin + //get data types + fCols := TStringList.Create; + fColTypes := TList.Create; + fColCount := SQLite3_ColumnCount(stmt); + for i := 0 to Pred(fColCount) do + fCols.Add(AnsiUpperCase(Sqlite3_ColumnName(stmt, i))); + for i := 0 to Pred(fColCount) do + begin + new(thisColType); + DeclaredColType := Sqlite3_ColumnDeclType(stmt, i); + if DeclaredColType = nil then + thisColType^ := Sqlite3_ColumnType(stmt, i) //use the actual column type instead + //seems to be needed for last_insert_rowid + else + if (DeclaredColType = 'INTEGER') or (DeclaredColType = 'BOOLEAN') then + thisColType^ := dtInt + else + if (DeclaredColType = 'NUMERIC') or + (DeclaredColType = 'FLOAT') or + (DeclaredColType = 'DOUBLE') or + (DeclaredColType = 'REAL') then + thisColType^ := dtNumeric + else + if DeclaredColType = 'BLOB' then + thisColType^ := dtBlob + else + thisColType^ := dtStr; + fColTypes.Add(thiscoltype); + end; + fResults := TList.Create; + end; + + //get column values + for i := 0 to Pred(ColCount) do + begin + ActualColType := Sqlite3_ColumnType(stmt, i); + if (ActualColType = SQLITE_NULL) then + fResults.Add(nil) + else + if pInteger(fColTypes[i])^ = dtInt then + begin + new(thisintvalue); + thisintvalue^ := Sqlite3_ColumnInt64(stmt, i); + fResults.Add(thisintvalue); + end + else + if pInteger(fColTypes[i])^ = dtNumeric then + begin + new(thisdoublevalue); + thisdoublevalue^ := Sqlite3_ColumnDouble(stmt, i); + fResults.Add(thisdoublevalue); + end + else + if pInteger(fColTypes[i])^ = dtBlob then + begin + iNumBytes := Sqlite3_ColumnBytes(stmt, i); + if iNumBytes = 0 then + thisblobvalue := nil + else + begin + thisblobvalue := TMemoryStream.Create; + thisblobvalue.position := 0; + ptr := Sqlite3_ColumnBlob(stmt, i); + thisblobvalue.writebuffer(ptr^, iNumBytes); + end; + fResults.Add(thisblobvalue); + end + else + begin + new(thisstringvalue); + ptrValue := Sqlite3_ColumnText(stmt, i); + setstring(thisstringvalue^, ptrvalue, strlen(ptrvalue)); + fResults.Add(thisstringvalue); + end; + end; + end; + SQLITE_BUSY: + raise ESqliteException.CreateFmt('Could not prepare SQL statement', + [SQL, 'SQLite is Busy']); + else + DB.RaiseError('Could not retrieve data', SQL); + end; + iStepResult := Sqlite3_step(Stmt); + end; + fRow := 0; + finally + if Assigned(Stmt) then + Sqlite3_Finalize(stmt); + end; +end; + +//.............................................................................. + +destructor TSQLiteTable.Destroy; +var + i: cardinal; + iColNo: integer; +begin + if Assigned(fResults) then + begin + for i := 0 to fResults.Count - 1 do + begin + //check for blob type + iColNo := (i mod fColCount); + case pInteger(self.fColTypes[iColNo])^ of + dtBlob: + TMemoryStream(fResults[i]).Free; + dtStr: + if fResults[i] <> nil then + begin + setstring(string(fResults[i]^), nil, 0); + dispose(fResults[i]); + end; + else + dispose(fResults[i]); + end; + end; + fResults.Free; + end; + if Assigned(fCols) then + fCols.Free; + if Assigned(fColTypes) then + for i := 0 to fColTypes.Count - 1 do + dispose(fColTypes[i]); + fColTypes.Free; + inherited; +end; + +//.............................................................................. + +function TSQLiteTable.GetColumns(I: integer): string; +begin + Result := fCols[I]; +end; + +//.............................................................................. + +function TSQLiteTable.GetCountResult: integer; +begin + if not EOF then + Result := StrToInt(Fields[0]) + else + Result := 0; +end; + +function TSQLiteTable.GetCount: integer; +begin + Result := FRowCount; +end; + +//.............................................................................. + +function TSQLiteTable.GetEOF: boolean; +begin + Result := fRow >= fRowCount; +end; + +function TSQLiteTable.GetBOF: boolean; +begin + Result := fRow <= 0; +end; + +//.............................................................................. + +function TSQLiteTable.GetFieldByName(FieldName: string): string; +begin + Result := GetFields(self.GetFieldIndex(FieldName)); +end; + +function TSQLiteTable.GetFieldIndex(FieldName: string): integer; +begin + + if (fCols = nil) then + begin + raise ESqliteException.Create('Field ' + fieldname + ' Not found. Empty dataset'); + exit; + end; + + if (fCols.count = 0) then + begin + raise ESqliteException.Create('Field ' + fieldname + ' Not found. Empty dataset'); + exit; + end; + + Result := fCols.IndexOf(AnsiUpperCase(FieldName)); + + if (result < 0) then + begin raise ESqliteException.Create('Field not found in dataset: ' + fieldname) end; + +end; + +//.............................................................................. + +function TSQLiteTable.GetFields(I: cardinal): string; +var + thisvalue: pstring; + thistype: integer; +begin + Result := ''; + if EOF then + raise ESqliteException.Create('Table is at End of File'); + //integer types are not stored in the resultset + //as strings, so they should be retrieved using the type-specific + //methods + thistype := pInteger(self.fColTypes[I])^; + + case thistype of + dtStr: + begin + thisvalue := self.fResults[(self.frow * self.fColCount) + I]; + if (thisvalue <> nil) then + Result := thisvalue^ + else + Result := ''; + end; + dtInt: + Result := IntToStr(self.FieldAsInteger(I)); + dtNumeric: + Result := FloatToStr(self.FieldAsDouble(I)); + dtBlob: + Result := self.FieldAsBlobText(I); + else + Result := ''; + end; +end; + +function TSqliteTable.FieldAsBlob(I: cardinal): TMemoryStream; +begin + if EOF then + raise ESqliteException.Create('Table is at End of File'); + if (self.fResults[(self.frow * self.fColCount) + I] = nil) then + Result := nil + else + if pInteger(self.fColTypes[I])^ = dtBlob then + Result := TMemoryStream(self.fResults[(self.frow * self.fColCount) + I]) + else + raise ESqliteException.Create('Not a Blob field'); +end; + +function TSqliteTable.FieldAsBlobText(I: cardinal): string; +var + MemStream: TMemoryStream; + Buffer: PChar; +begin + Result := ''; + MemStream := self.FieldAsBlob(I); + if MemStream <> nil then + if MemStream.Size > 0 then + begin + MemStream.position := 0; + Buffer := stralloc(MemStream.Size + 1); + MemStream.readbuffer(Buffer[0], MemStream.Size); + (Buffer + MemStream.Size)^ := chr(0); + SetString(Result, Buffer, MemStream.size); + strdispose(Buffer); + end; +end; + + +function TSqliteTable.FieldAsInteger(I: cardinal): int64; +begin + if EOF then + //raise ESqliteException.Create('Table is at End of File'); + Result := 0; + else if (self.fResults[(self.frow * self.fColCount) + I] = nil) then + Result := 0 + else + if pInteger(self.fColTypes[I])^ = dtInt then + Result := pInt64(self.fResults[(self.frow * self.fColCount) + I])^ + else + if pInteger(self.fColTypes[I])^ = dtNumeric then + Result := trunc(strtofloat(pString(self.fResults[(self.frow * self.fColCount) + I])^)) + else + raise ESqliteException.Create('Not an integer or numeric field'); +end; + +function TSqliteTable.FieldAsDouble(I: cardinal): double; +begin + if EOF then + raise ESqliteException.Create('Table is at End of File'); + if (self.fResults[(self.frow * self.fColCount) + I] = nil) then + Result := 0 + else + if pInteger(self.fColTypes[I])^ = dtInt then + Result := pInt64(self.fResults[(self.frow * self.fColCount) + I])^ + else + if pInteger(self.fColTypes[I])^ = dtNumeric then + Result := pDouble(self.fResults[(self.frow * self.fColCount) + I])^ + else + raise ESqliteException.Create('Not an integer or numeric field'); +end; + +function TSqliteTable.FieldAsString(I: cardinal): string; +begin + if EOF then + raise ESqliteException.Create('Table is at End of File'); + if (self.fResults[(self.frow * self.fColCount) + I] = nil) then + Result := '' + else + Result := self.GetFields(I); +end; + +function TSqliteTable.FieldIsNull(I: cardinal): boolean; +var + thisvalue: pointer; +begin + if EOF then + raise ESqliteException.Create('Table is at End of File'); + thisvalue := self.fResults[(self.frow * self.fColCount) + I]; + Result := (thisvalue = nil); +end; + +//.............................................................................. + +function TSQLiteTable.Next: boolean; +begin + Result := False; + if not EOF then + begin + Inc(fRow); + Result := True; + end; +end; + +function TSQLiteTable.Previous: boolean; +begin + Result := False; + if not BOF then + begin + Dec(fRow); + Result := True; + end; +end; + +function TSQLiteTable.MoveFirst: boolean; +begin + Result := False; + if self.fRowCount > 0 then + begin + fRow := 0; + Result := True; + end; +end; + +function TSQLiteTable.MoveLast: boolean; +begin + Result := False; + if self.fRowCount > 0 then + begin + fRow := fRowCount - 1; + Result := True; + end; +end; + + +end. + diff --git a/Game/Code/lib/SQLite/example/Sunset.jpg b/Game/Code/lib/SQLite/example/Sunset.jpg new file mode 100644 index 00000000..860f6eec Binary files /dev/null and b/Game/Code/lib/SQLite/example/Sunset.jpg differ diff --git a/Game/Code/lib/SQLite/example/TestSqlite.dpr b/Game/Code/lib/SQLite/example/TestSqlite.dpr new file mode 100644 index 00000000..82f2a468 --- /dev/null +++ b/Game/Code/lib/SQLite/example/TestSqlite.dpr @@ -0,0 +1,15 @@ +program TestSqlite; + +uses + Forms, + uTestSqlite in 'uTestSqlite.pas' {Form1}, + SQLiteTable3 in 'SQLiteTable3.pas', + SQLite3 in 'SQLite3.pas'; + +{$R *.res} + +begin + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. diff --git a/Game/Code/lib/SQLite/example/TestSqlite.exe b/Game/Code/lib/SQLite/example/TestSqlite.exe new file mode 100644 index 00000000..12f77a3d Binary files /dev/null and b/Game/Code/lib/SQLite/example/TestSqlite.exe differ diff --git a/Game/Code/lib/SQLite/example/TestSqlite.res b/Game/Code/lib/SQLite/example/TestSqlite.res new file mode 100644 index 00000000..4bdd5e2e Binary files /dev/null and b/Game/Code/lib/SQLite/example/TestSqlite.res differ diff --git a/Game/Code/lib/SQLite/example/uTestSqlite.dfm b/Game/Code/lib/SQLite/example/uTestSqlite.dfm new file mode 100644 index 00000000..b77ec2c7 --- /dev/null +++ b/Game/Code/lib/SQLite/example/uTestSqlite.dfm @@ -0,0 +1,110 @@ +object Form1: TForm1 + Left = 242 + Top = 242 + Width = 541 + Height = 308 + Caption = 'Test SQLite 3' + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = False + PixelsPerInch = 96 + TextHeight = 13 + object Label1: TLabel + Left = 24 + Top = 104 + Width = 28 + Height = 13 + Caption = 'Notes' + end + object Label2: TLabel + Left = 24 + Top = 44 + Width = 28 + Height = 13 + Caption = 'Name' + end + object Label3: TLabel + Left = 24 + Top = 72 + Width = 40 + Height = 13 + Caption = 'Number:' + end + object Label4: TLabel + Left = 24 + Top = 12 + Width = 11 + Height = 13 + Caption = 'ID' + end + object Image1: TImage + Left = 272 + Top = 12 + Width = 241 + Height = 165 + Proportional = True + Stretch = True + end + object btnTest: TButton + Left = 24 + Top = 224 + Width = 161 + Height = 37 + Caption = 'Test SQLite 3' + TabOrder = 0 + OnClick = btnTestClick + end + object memNotes: TMemo + Left = 24 + Top = 124 + Width = 185 + Height = 89 + Lines.Strings = ( + '') + ScrollBars = ssVertical + TabOrder = 1 + end + object ebName: TEdit + Left = 72 + Top = 40 + Width = 173 + Height = 21 + TabOrder = 2 + end + object ebNumber: TEdit + Left = 72 + Top = 68 + Width = 173 + Height = 21 + TabOrder = 3 + end + object ebID: TEdit + Left = 72 + Top = 12 + Width = 173 + Height = 21 + TabOrder = 4 + end + object btnLoadImage: TButton + Left = 192 + Top = 224 + Width = 157 + Height = 37 + Caption = 'Load image' + TabOrder = 5 + OnClick = btnLoadImageClick + end + object btnDisplayImage: TButton + Left = 360 + Top = 224 + Width = 157 + Height = 37 + Caption = 'Display image' + TabOrder = 6 + OnClick = btnDisplayImageClick + end +end diff --git a/Game/Code/lib/SQLite/example/uTestSqlite.pas b/Game/Code/lib/SQLite/example/uTestSqlite.pas new file mode 100644 index 00000000..6691fece --- /dev/null +++ b/Game/Code/lib/SQLite/example/uTestSqlite.pas @@ -0,0 +1,233 @@ +unit uTestSqlite; + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, + Dialogs, StdCtrls,SQLiteTable3, ExtCtrls, jpeg; + +type + TForm1 = class(TForm) + btnTest: TButton; + memNotes: TMemo; + Label1: TLabel; + Label2: TLabel; + ebName: TEdit; + Label3: TLabel; + ebNumber: TEdit; + Label4: TLabel; + ebID: TEdit; + Image1: TImage; + btnLoadImage: TButton; + btnDisplayImage: TButton; + procedure btnTestClick(Sender: TObject); + procedure btnLoadImageClick(Sender: TObject); + procedure btnDisplayImageClick(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + end; + +var + Form1: TForm1; + +implementation + +{$R *.dfm} + +procedure TForm1.btnTestClick(Sender: TObject); +var +slDBpath: string; +sldb: TSQLiteDatabase; +sltb: TSQLIteTable; +sSQL: String; +Notes: String; + +begin + +slDBPath := ExtractFilepath(application.exename) ++ 'test.db'; + +sldb := TSQLiteDatabase.Create(slDBPath); +try + +if sldb.TableExists('testTable') then begin +sSQL := 'DROP TABLE testtable'; +sldb.execsql(sSQL); +end; + +sSQL := 'CREATE TABLE testtable ([ID] INTEGER PRIMARY KEY,[OtherID] INTEGER NULL,'; +sSQL := sSQL + '[Name] VARCHAR (255),[Number] FLOAT, [notes] BLOB, [picture] BLOB COLLATE NOCASE);'; + +sldb.execsql(sSQL); + +sldb.execsql('CREATE INDEX TestTableName ON [testtable]([Name]);'); + +//begin a transaction +sldb.BeginTransaction; + +sSQL := 'INSERT INTO testtable(Name,OtherID,Number,Notes) VALUES ("Some Name",4,587.6594,"Here are some notes");'; +//do the insert +sldb.ExecSQL(sSQL); + +sSQL := 'INSERT INTO testtable(Name,OtherID,Number,Notes) VALUES ("Another Name",12,4758.3265,"More notes");'; +//do the insert +sldb.ExecSQL(sSQL); + +//end the transaction +sldb.Commit; + +//query the data +sltb := slDb.GetTable('SELECT * FROM testtable'); +try + +if sltb.Count > 0 then +begin +//display first row + +ebName.Text := sltb.FieldAsString(sltb.FieldIndex['Name']); +ebID.Text := inttostr(sltb.FieldAsInteger(sltb.FieldIndex['ID'])); +ebNumber.Text := floattostr( sltb.FieldAsDouble(sltb.FieldIndex['Number'])); +Notes := sltb.FieldAsBlobText(sltb.FieldIndex['Notes']); +memNotes.Text := notes; + +end; + +finally +sltb.Free; +end; + +finally +sldb.Free; + +end; + +end; + +procedure TForm1.btnLoadImageClick(Sender: TObject); +var +slDBpath: string; +sldb: TSQLiteDatabase; +sltb: TSQLIteTable; +iID: integer; +fs: TFileStream; + +begin + +slDBPath := ExtractFilepath(application.exename) ++ 'test.db'; + +if not FileExists(slDBPath) then begin +MessageDLg('Test.db does not exist. Click Test Sqlite 3 to create it.',mtInformation,[mbOK],0); +exit; +end; + +sldb := TSQLiteDatabase.Create(slDBPath); +try + +//get an ID +//query the data +sltb := slDb.GetTable('SELECT ID FROM testtable'); +try + +if sltb.Count = 0 then begin +MessageDLg('There are no rows in the database. Click Test Sqlite 3 to insert a row.',mtInformation,[mbOK],0); +exit; +end; + +iID := sltb.FieldAsInteger(sltb.FieldIndex['ID']); + +finally +sltb.Free; +end; + +//load an image +fs := TFileStream.Create(ExtractFileDir(application.ExeName) + '\sunset.jpg',fmOpenRead); +try + +//insert the image into the db +sldb.UpdateBlob('UPDATE testtable set picture = ? WHERE ID = ' + inttostr(iID),fs); + +finally +fs.Free; +end; + +finally +sldb.Free; + +end; + +end; + +procedure TForm1.btnDisplayImageClick(Sender: TObject); +var +slDBpath: string; +sldb: TSQLiteDatabase; +sltb: TSQLIteTable; +iID: integer; +ms: TMemoryStream; +pic: TJPegImage; + +begin + +slDBPath := ExtractFilepath(application.exename) ++ 'test.db'; + +if not FileExists(slDBPath) then begin +MessageDLg('Test.db does not exist. Click Test Sqlite 3 to create it, then Load image to load an image.',mtInformation,[mbOK],0); +exit; +end; + +sldb := TSQLiteDatabase.Create(slDBPath); +try + +//get an ID +//query the data +sltb := slDb.GetTable('SELECT ID FROM testtable'); +try + +if not sltb.Count = 0 then begin +MessageDLg('No rows in the test database. Click Test Sqlite 3 to insert a row, then Load image to load an image.',mtInformation,[mbOK],0); +exit; +end; + +iID := sltb.FieldAsInteger(sltb.FieldIndex['ID']); + +finally +sltb.Free; +end; + +sltb := sldb.GetTable('SELECT picture FROM testtable where ID = ' + inttostr(iID)); +try + +ms := sltb.FieldAsBlob(sltb.FieldIndex['picture']); +//note that the memory stream is freed when the TSqliteTable is destroyed. + +if (ms = nil) then begin +MessageDLg('No image in the test database. Click Load image to load an image.',mtInformation,[mbOK],0); +exit; +end; + +ms.Position := 0; + +pic := TJPEGImage.Create; +pic.LoadFromStream(ms); + +self.Image1.Picture.Graphic := pic; + +pic.Free; + +finally +sltb.Free; +end; + +finally +sldb.Free; + +end; + + +end; + +end. diff --git a/Game/Code/lib/SQLite/readme.txt b/Game/Code/lib/SQLite/readme.txt new file mode 100644 index 00000000..80e5b3a1 --- /dev/null +++ b/Game/Code/lib/SQLite/readme.txt @@ -0,0 +1,82 @@ +14 Aug 2005 + +The following changes were made by Lukas Gebauer (geby@volny.cz). In addition, some changes from a previous D5-compatible version were merged, and the supplied sqlite3.dll is updated to version 3.2.2 + +Notes from Lukas: + +- added support for delphi 4+ + +- datatype constants matches SQlite datatypes contants. (otherwise in some situations you got bad column datatype!) + +- removed dependency on strutils + +- code is reformated to better look (official borland formationg +rules) + +- added some pragma's after database is open (temp is in memory) + +- TSQLiteDatabase.GetTableValue(const SQL: string): int64 for easy call of SQL commands what returning one number only. (like select +count(*)...) + +- TSQLiteDatabase.GetTableString(const SQL: string): String for easy call of SQL commands what returning one string only. (like PRAGMA +integrity_check) + +- TSQLiteDatabase.SetTimeout(Value: integer); you can set timeout for accessing to some table. Good for database sharing! + +- TSQLiteDatabase.version: string; returns SQLITE version string + +- removed bool fieldtype (it is not natural SQLite3 type) + +- fild type detection by Sqite3_columnType knows REAL too. + +- integer filedtype is based on Int64 + +- GetFields can get data from any supported fieldtype + +- changed some integers to cardinal for avoid signed and unsigned mismatch + +- TSqliteTable.FieldAsInteger(I: cardinal): int64; returns int64 + + +3 May 2005 Fixed bug where strupper called on column type before checking for nil + +2 May 2005 Add extra check for nil in TSqliteTable.Destroy, thanks to Tim Maddrell + +22 Apr 2005 Revise TSqliteTable.Destroy to fix memory leak with dtStr type (thanks to +Jose Brito) + +21 Apr 2005 Quick revision to fix case sensitivity in detecting column type, +and remove PRAGMA full_column_names = 1 which is deprecated. Warning: may break code. Fix your SQL code so that all column names in a result set are unique. + +21 Feb 2005 Sqlite DLL now 3.1.3 + +19 Feb 2005 Revised for Sqlite 3.1.2 + +21 Dec 2004 First public release + +The following notice appears in the Sqlite source code: + +* +** 2001 September 15 +** +** +** The author disclaims copyright to this source code. In place of + +** a legal notice, here is a blessing: + +** + May you do good and not evil. + +** May you find forgiveness for yourself and forgive others. + +** May you share freely, never taking more than you give. + + +For more information about SQLite, see http://www.sqlite.org + +For more information about this simple wrapper, see http://www.itwriting.com/sqlitesimple.php + + + + + diff --git a/Game/Code/lib/SQLite/sqlite3.dll b/Game/Code/lib/SQLite/sqlite3.dll new file mode 100644 index 00000000..7111873f Binary files /dev/null and b/Game/Code/lib/SQLite/sqlite3.dll differ diff --git a/Game/Code/lib/SQLite/test.db b/Game/Code/lib/SQLite/test.db new file mode 100644 index 00000000..c7fc4356 Binary files /dev/null and b/Game/Code/lib/SQLite/test.db differ diff --git a/Game/Code/lib/bass/bass.chm b/Game/Code/lib/bass/bass.chm new file mode 100644 index 00000000..1e8c5076 Binary files /dev/null and b/Game/Code/lib/bass/bass.chm differ diff --git a/Game/Code/lib/bass/bass.dll b/Game/Code/lib/bass/bass.dll new file mode 100644 index 00000000..964d8996 Binary files /dev/null and b/Game/Code/lib/bass/bass.dll differ diff --git a/Game/Code/lib/bass/bass.txt b/Game/Code/lib/bass/bass.txt new file mode 100644 index 00000000..c60b6594 --- /dev/null +++ b/Game/Code/lib/bass/bass.txt @@ -0,0 +1,1546 @@ +BASS 2.3 - Copyright (c) 1999-2007 Ian Luck. All rights reserved. + +Files that you should have found in the BASS "package" +====================================================== +Win32 version +------------- +BASS.TXT This file +BASS.DLL The BASS module +BASS.CHM BASS documentation +MP3-FREE + BASS.DLL BASS module using the Windows MP3 decoder +C\ C/C++ API and samples... + BASS.H BASS C/C++ header file + BASS.LIB BASS import library + BASS.DSW Visual C++ workspace for examples + MAKEFILE Makefile for all examples + MAKEFILE.IN Makefile helper macros + 3DTEST\ 3D/EAX example + 3DTEST.C + 3DTEST.RC + 3DTEST.DSP + MAKEFILE + BASSTEST\ Simple playback example + BASSTEST.C + BASSTEST.RC + BASSTEST.H + BASSTEST.DSP + MAKEFILE + CONTEST\ Console example + CONTEST.C + CONTEST.DSP + MAKEFILE + CUSTLOOP\ Custom looping example + CUSTLOOP.C + CUSTLOOP.DSP + MAKEFILE + DSPTEST\ DSP example + DSPTEST.C + DSPTEST.RC + DSPTEST.DSP + MAKEFILE + FXTEST\ DX8 effect example + FXTEST.C + FXTEST.RC + FXTEST.DSP + MAKEFILE + LIVEFX\ Full-duplex example + LIVEFX.C + LIVEFX.RC + LIVEFX.DSP + MAKEFILE + LIVESPEC\ "Live" version of spectrum analyser example + LIVESPEC.C + LIVESPEC.DSP + MAKEFILE + LOADNGET\ LoadLibrary/GetProcAddress example + LOADNGET.C + LOADNGET.RC + LOADNGET.DSP + MAKEFILE + MULTI\ Multiple device example + MULTI.C + MULTI.RC + MULTI.DSP + MAKEFILE + NETRADIO\ Internet streaming example + NETRADIO.C + NETRADIO.RC + NETRADIO.DSP + MAKEFILE + PLUGINS\ Plugins example + PLUGINS.C + PLUGINS.RC + PLUGINS.DSP + MAKEFILE + RECTEST\ Recording example + RECTEST.C + RECTEST.RC + RECTEST.DSP + MAKEFILE + SPEAKERS\ Multi-speaker example + SPEAKERS.C + SPEAKERS.RC + SPEAKERS.DSP + MAKEFILE + SPECTRUM\ Spectrum analyser example + SPECTRUM.C + SPECTRUM.DSP + MAKEFILE + SYNTH\ Synth example + SYNTH.C + SYNTH.DSP + MAKEFILE + WRITEWAV\ WAVE writer example + WRITEWAV.C + WRITEWAV.DSP + MAKEFILE + BIN\ Precompiled examples + 3DTEST.EXE + BASSTEST.EXE + CONTEST.EXE + CUSTLOOP.EXE + DSPTEST.EXE + FXTEST.EXE + LIVEFX.EXE + LIVESPEC.EXE + LOADNGET.EXE + MULTI.EXE + NETRADIO.EXE + RECTEST.EXE + SPEAKERS.EXE + SPECTRUM.EXE + SYNTH.EXE + WRITEWAV.EXE +VB\ Visual Basic API and samples... + BASS.BAS BASS Visual Basic module file + 3DTEST\ 3D/EAX example + PRJ3DTEST.VBP + PRJ3DTEST.FRM + PRJDEVICE.FRM + BASSTEST\ Simple playback example + PRJBASSTEST.VBP + FRMBASSTEST.FRM + CUSTLOOP\ Custom looping example + PRJCUSTLOOP.VBP + FRMCUSTLOOP.FRM + MODCUSTLOOP.BAS + DSPTEST\ DSP example + PRJDSPTEST.VBP + FRMDSPTEST.FRM + MODDSPTEST.BAS + FXTEST\ DX8 effect example + PRJFXTEST.VBP + FRMFXTEST.FRM + LIVEFX\ Full-duplex example + PRJLIVEFX.VBP + FRMLIVEFX.FRM + MODLIVEFX.BAS + LIVESPEC\ "Live" version of spectrum analyser example + PRJLIVESPEC.VBP + FRMLIVESPEC.FRM + MODLIVESPEC.BAS + MULTI\ Multiple device example + PRJMULTI.VBP + PRJMULTI.FRM + PRJDEVICE.FRM + NETRADIO\ Internet streaming example + PRJNETRADIO.VBP + FRMNETRADIO.FRM + MODNETRADIO.BAS + CLSFILEIO.CLS + PLUGINS\ Plugins example + PRJPLUGINS.VBP + FRMPLUGINS.FRM + RECTEST\ Recording example + PRJRECTEST.VBP + FRMRECTEST.FRM + MODRECTEST.BAS + SPEAKERS\ Multi-speaker example + PRJSPEAKERS.VBP + FRMSPEAKERS.FRM + SPECTRUM\ Spectrum analyser example + PRJSPECTRUM.VBP + FRMSPECTRUM.FRM + MODSPECTRUM.BAS + SYNTH\ Synth example + PRJSYNTH.VBP + FRMSYNTH.FRM + MODSYNTH.BAS + WRITEWAV\ WAVE writer example + PRJWRITEWAVE.VBP + PRJWRITEWAVE.FRM + MEMORY\ Playing from memory example by Jobnik + PRJMEMORY.VBP + FRMMEMORY.FRM + SYNCTEST.BAS + CBASS_TIME.CLS +DELPHI\ Delphi API and samples... + BASS.PAS BASS Delphi unit + 3DTEST\ 3D/EAX example + D3TEST.DPR + DTMAIN.PAS + DTMAIN.DFM + DTSELECT.PAS + DTSELECT.DFM + BASSTEST\ Simple playback example + BASSTEST.DPR + BTMAIN.PAS + BTMAIN.DFM + CONTEST\ Console example + CONTEST.DPR + CUSTLOOP\ Custom looping example + CUSTLOOP.DPR + UNIT1.PAS + UNIT1.DFM + DSPTEST\ DSP example + DSPTEST.DPR + DTMAIN.PAS + DTMAIN.DFM + FXTEST\ DX8 effect example + FXTEST.DPR + TEST.PAS + TEST.DFM + LIVEFX\ Full-duplex example + LIVEFX.DPR + UNIT1.PAS + UNIT1.DFM + MULTI\ Multiple device example + MULTI.DPR + UNIT1.PAS + UNIT1.DFM + UNIT2.PAS + UNIT2.DFM + NETRADIO\ Internet streaming example + NETRADIO.DPR + UNIT1.PAS + UNIT1.DFM + PLUGINS\ Plugins example + PLUGINS.DPR + UNIT1.PAS + UNIT1.DFM + RECORDTEST\ Recording example + RECORDTEST.DPR + UNIT1.PAS + UNIT1.DFM + SAMPLEVIS\ Visualisation example + SAMPLEVIS.DPR + MAIN.PAS + MAIN.DFM + SPECTRUM_VIS.PAS + CIRCLE_VIS.PAS + OSC_VIS.PAS + COMMONTYPES.PAS + SPEAKERS\ Multi-speaker example + SPEAKERS.DPR + UNIT1.PAS + UNIT1.DFM + STREAMTEST\ User stream example + STREAMTEST.DPR + STMAIN.PAS + STMAIN.DFM + WRITEWAV\ WAVE writer example + WRITEWAV.DPR + UNITMAIN.PAS + UNITMAIN.DFM + DYNAMIC\ Dynamic-loading Delphi API + DYNAMIC_BASS.PAS Dynamic-loading Delphi unit +MASM\ MASM API and samples... + BASS.INC BASS MASM include file + PLAYER\ Example MOD player + PLAYER.EXE + PLAYER.ASM + RSRC.RC + TOOLBAR.BMP + COMPILE.BAT + +NOTE: To run the sample EXEs, first you'll have to copy BASS.DLL into the + same directory as the EXEs. + +NOTE: To avoid unnecessary bloatage, the BASS DLLs are not digitally signed. + Signed versions are available on request (email: bass@un4seen.com). + +MacOSX version +-------------- +BASS.TXT This file +LIBBASS.DYLIB The BASS module +BASS.CHM BASS documentation +CHMOX.APP CHM file viewer +BASS.H BASS C/C++ header file +MAKEFILE Makefile for all examples +MAKEFILE.IN Makefile helper macros +MP3-FREE + LIBBASS.DYLIB BASS module using the OSX MP3 decoder +3DTEST\ 3D example + 3DTEST.C + MAKEFILE + 3DTEST.NIB +BASSTEST\ Simple playback example + BASSTEST.C + MAKEFILE + BASSTEST.NIB +CONTEST\ Console example + CONTEST.C + MAKEFILE +CUSTLOOP\ Custom looping example + CUSTLOOP.C + MAKEFILE +DSPTEST\ DSP example + DSPTEST.C + DSPTEST.RC + MAKEFILE + DSPTEST.NIB +LIVESPEC\ "Live" version of spectrum analyser example + LIVESPEC.C + MAKEFILE +MULTI\ Multiple device example + MULTI.C + MAKEFILE + MULTI.NIB +NETRADIO\ Internet streaming example + NETRADIO.C + MAKEFILE + NETRADIO.NIB +PLUGINS\ Plugins example + PLUGINS.C + MAKEFILE + PLUGINS.NIB +RECTEST\ Recording example + RECTEST.C + MAKEFILE + RECTEST.NIB +SPEAKERS\ Multi-speaker example + SPEAKERS.C + MAKEFILE + SPEAKERS.NIB +SPECTRUM\ Spectrum analyser example + SPECTRUM.C + MAKEFILE +WRITEWAV\ WAVE writer example + WRITEWAV.C + MAKEFILE + + +What's the point? +================= +BASS is an audio library for use in Windows and MacOSX software. Its +purpose is to provide the most powerful and efficient (yet easy to use), +sample, stream, MOD music, and recording functions. All in a tiny DLL, +under 100KB in size. + +See the documentation for descriptions of all the BASS functions. You +should also look at the included example program source-codes for some +examples of how to use BASS in your own programs. + + +Requirements +============ +Win32 version +------------- +BASS requires DirectX 3 or above for output. BASS does not require that a +soundcard with DirectSound/DirectSound3D hardware accelerated drivers is +installed, but it does improve performance if there is one. BASS also takes +advantage of MMX, which improves the performance of the MOD music playback. + +MacOSX version +-------------- +OSX 10.3 or above is recommended. BASS uses CoreAudio for output, so there +are no special library/driver requirements. BASS supports both PowerPC and +Intel Macs. + + +Main Features +============= +* Samples +- supports WAV/AIFF/MP3/MP2/MP1/OGG and custom generated samples + +* Sample streams +- stream any sample data in 8/16/32 bit + +* File streams +- MP3/MP2/MP1/OGG/WAV/AIFF file streaming + +* Internet file streaming +- stream MP3/MP2/MP1/OGG/WAV/AIFF files from the internet (inc. Shout/Icecast) + +* User file streaming +- stream MP3/MP2/MP1/OGG/WAV/AIFF files from anywhere using any delivery method + +* Multi-channel streaming +- support for more than plain stereo, including multi-channel OGG/WAV/AIFF files + +* MOD music +- uses the same engine as XMPlay = best accuracy, speed and quality + +* MO3 music +- MP3/OGG compressed MOD music + +* Add-on system +- support for more formats is available via add-ons (aka plugins) + +* Multiple outputs +- simultaneously use multiple soundcards, and move channels between them + +* Recording +- flexible recording system, with support for multiple devices + +* Decode without playback +- streams and musics can be outputted in any way you want + +* Speaker assignment +- assign streams and musics to specific speakers + +* High precision synchronization +- synchronize events in your software to the music + +* DirectX 8 effects +- chorus/compressor/distortion/echo/flanger/gargle/parameq/reverb + +* User defined DSP functions +- custom effects may be applied to musics and streams + +* 32 bit floating-point decoding and processing +- floating-point stream/music decoding, DSP, FX, and recording + +* 3D sound +- play samples/streams/musics in any 3D position, with EAX support + +* Expandable +- underlying DirectSound object interfaces are accessible + +* Small +- BASS is under 100KB (on Windows), so won't bloat your distribution + + +Using BASS +========== +There is no guarantee that all future BASS versions will be compatible +with all previous versions, so your program should use BASS_GetVersion +to check the version that is loaded. This also means that you should +put the BASS module in the same directory as your executable (not just +somewhere in the path), to avoid the possibility of a wrong version being +loaded. + +If you are updating your software from a previous BASS version, then +you should check the "History" section (below), to see if any of the +functions that you are using have been affected by a change. + +Win32 version +------------- +C/C++, Visual Basic, Delphi and MASM APIs are provided, to use BASS with +another language you'll first have to convert the header file. Or, as a +last resort, you could use LoadLibrary and GetProcAddress. + +One benefit of the LoadLibrary method is that it allows you to look for +the correct BASS version, because you can load and unload BASS.DLL at +any time. This also allows those who'd prefer not to have a separate +DLL to store it with the program (eg. in a resource), write it to disk, +load it, use it, free it and delete it. + +The downside is that you have to manually import each function that you +use, with the GetProcAddress function. But it has been made a lot simpler +to import BASS this way by the use of the BASSDEF #define. Here's a small +example: + +#define BASSDEF(f) (WINAPI *f) // define the functions as pointers +#include "bass.h" +... +HINSTANCE bass=LoadLibrary("BASS.DLL"); // load BASS +BASS_Init=GetProcAddress(bass,"BASS_Init"); // get BASS_Init +BASS_Init(-1,44100,0,hWnd,NULL); // call BASS_Init + +See the LOADNGET.C file for a more complete example. + +To use BASS with Borland C++ Builder, you'll first have to create a +Borland C++ Builder import library for it. This is done by using the +IMPLIB tool that comes with Borland C++ Builder. Simply execute this: + + IMPLIB BASSBCB.LIB BASS.DLL + +... and then use BASSBCB.LIB in your projects to import BASS. + +To use BASS with LCC-Win32, you'll first have to create a compatible +import library for it. This is done by using the PEDUMP and BUILDLIB +tools that come with LCC-Win32. Run these 2 commands: + + PEDUMP /EXP BASS.LIB > BASSLCC.EXP + BUILDLIB BASSLCC.EXP BASSLCC.LIB + +... and then use BASSLCC.LIB in your projects to import BASS. + +For the BASS functions that return strings (char*), VB users should use +the VBStrFromAnsiPtr function to convert the returned pointer into a VB +string. + +MacOSX version +-------------- +A separate "LIB" file is not required for OSX. Using XCode, you can simply +add the DYLIB file to the project. Or using a makefile, you can build your +programs like this, for example: + + gcc yoursource -L. -lbass -o yourprog + +The LIBBASS.DYLIB file must be put in the same directory as the executable +(it can't just be somewhere in the path). See the example makefiles. + +LIBBASS.DYLIB is a universal binary, with support for both PowerPC and +Intel Macs. If you want PowerPC-only or Intel-only versions, the included +makefile can create them for you, by typing "make ppc" or "make i386". It +will also process any BASS add-ons placed in the same directory. + + +Latest Version +============== +The latest version of BASS can always be found at the BASS website: + + www.un4seen.com + + +Copyright, disclaimer, and all that other jazz +============================================== +The BASS library is free for non-commercial use. If you are a non- +commercial entity (eg. an individual) and are not charging for your +product, and the product has no other commercial purpose, then you +can use BASS in it for free. If you wish to use BASS in commercial +products, then please also see the next section. + +TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, BASS IS PROVIDED +"AS IS", WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY +AND/OR FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS SHALL NOT BE HELD +LIABLE FOR ANY DAMAGE THAT MAY RESULT FROM THE USE OF BASS. BASICALLY, +YOU USE BASS ENTIRELY AT YOUR OWN RISK. + +Usage of BASS indicates that you agree to the above conditions. + +All trademarks and other registered names contained in the BASS +package are the property of their respective owners. + + +BASS in commercial products? +============================ +BASS is available for use in your commercial products. The licence +types available are as follows: + +SHAREWARE: Allows the usage of BASS in an unlimited number of your +shareware products, which must sell for no more than 40 Euros each. +If you're an individual making and selling your own software (and +its price is within the limit), this is the licence for you. + +SINGLE COMMERCIAL: Allows the usage of BASS in a single commercial +product. + +UNLIMITED COMMERCIAL: Allows the usage of BASS in an unlimited number +of your commercial products. This licence is on a per site basis. So +if your company has two sites that use BASS, then two licences are +required. + +Please note the products must be end-user products, eg. not components +used by other products. + +These licences only cover your own software. not the publishing of +other's software. If you publish other's software, its developers (or +the software itself) will need to be licensed to use BASS. + +These licences are on a per-platform basis, with reductions available +when licensing for both platforms. In all cases there are no royalties +to pay, and you can use future BASS updates without further cost. One +licence covers one person or entity and is not transferable. + +These licences do not allow reselling/sublicensing of BASS. For example, +if a product is a development system, the users of said product are not +licensed to use BASS in their productions - they will need their own +licences. + +If the standard licences do not meet your requirements, or if you have +any questions, please get in touch (email: bass@un4seen.com). + +Visit the BASS website for the latest pricing: + + www.un4seen.com + + +MP3 +=== +MP3 technology is patented, and Thomson license the use of their and +Fraunhofer's patents. The inclusion of an MP3 decoder (eg. BASS) in a +commercial product requires an MP3 patent licence. Contact Thomson for +details: + + www.mp3licensing.com + +Alternatively, the "MP3-FREE" BASS version doesn't include its own MP3 +decoder but instead makes use of the operating system's already licensed +decoder. + +NOTE: When using the OS's MP3 decoder, BASS still does the file handling + so all the usual features are still supported, including streaming, + tag reading, pre-scanning, gapless playback, etc... + + +History +======= +These are the major (and not so major) changes at each version stage. +There are of course bug fixes and other little improvements made along +the way too! To make upgrading simpler, all functions affected by a +change to the BASS interface are listed. + +2.3.0.3 - 30/7/2007 +------------------- +* FX state resetting + BASS_FXReset +* PLS/M3U playlist URL processing + BASS_CONFIG_NET_PLAYLIST + NETRADIO example updated +* Internet stream connection status retrieval + BASS_FILEPOS_CONNECTED (BASS_StreamGetFilePosition mode) +* Lyrics3v2 tags + BASS_TAG_LYRICS3 (BASS_ChannelGetTags type) +* IT virtual channel configuration + BASS_CONFIG_MUSIC_VIRTUAL +* Accurate speaker detection on Vista + BASS_INFO (speakers member) +* Device output/input rate retrieval on Vista + BASS_INFO (freq member) + BASS_RECORDINFO (freq member) +* Syncing upon position changes + BASS_SYNC_SETPOS (BASS_ChannelSetSync type) +* Improved stall handling + BASS_SYNC_STALL +* Invalid decoding channel flags produce an error instead of being ignored + BASS_StreamCreate/File/User/Url + BASS_MusicLoad + +2.3.0.2 - 22/1/2007 +------------------- +* Retrieval of a sample's existing channel handles + BASS_SampleGetChannels +* 8192 sample FFT + BASS_DATA_FFT8192 (BASS_ChannelGetData flag) +* Adjustable recording buffer + BASS_CONFIG_REC_BUFFER (BASS_SetConfig option) +* Stopping decoding channels before the end + BASS_ChannelStop +* Sample channels created paused to prevent overriding before playback + BASS_SampleGetChannel +* Separate "MP3-FREE" version using Windows/OSX MP3 decoder + BASS_CONFIG_MP3_CODEC *removed* + +2.3.0.1 - 12/6/2006 +------------------- +* Ability to move a channel to another device + BASS_ChannelSetDevice + MULTI example updated +* Support for ID3v2.4 tags at end of file + BASS_TAG_ID3V2 (BASS_ChannelGetTags type) + +2.3 - 21/5/2006 +--------------- +* MOD message/instrument/sample text retrieval, merged with stream tag retrieval function + BASS_ChannelGetTags + BASS_TAG_MUSIC_NAME/MESSAGE/INST/SAMPLE (BASS_ChannelGetTags types) + BASS_MusicGetName *removed* + BASS_StreamGetTags *removed* +* Plugin information retrieval + BASS_PluginGetInfo + BASS_PLUGININFO/FORM structures + BASS_CHANNELINFO (plugin member) + PLUGINS example updated +* RIFF/WAVE "INFO" tag retrieval + BASS_TAG_RIFF_INFO (BASS_StreamGetTags type) +* More specific WAVE format information + BASS_CTYPE_STREAM_WAV_PCM/FLOAT (channel types) + BASS_CTYPE_STREAM_WAV (channel type flag) +* Proxy server configuration + BASS_CONFIG_NET_PROXY (BASS_SetConfig option) + BASS_CONFIG_NET_NOPROXY *removed* + NETRADIO example updated +* Passive FTP mode + BASS_CONFIG_NET_PASSIVE (BASS_SetConfig option) +* Agent changes take immediate effect + BASS_CONFIG_NET_AGENT (BASS_SetConfig option) +* Minimum time gap between creating new sample channels + BASS_SAMPLE (mingap member) + BASS_SampleGetChannel +* Support for Unicode plugin filenames + BASS_PluginLoad +* Device output/input rate retrieval (MacOSX only) + BASS_INFO (freq member) + BASS_RECORDINFO (freq member) +* Extended version info (minor revision) + BASS_GetVersion +* Unsupported codec error code + BASS_ERROR_CODEC +* Optional use of the Windows MP3 codec + BASS_CONFIG_MP3_CODEC (BASS_SetConfig option) +* 3D support for MacOSX + BASS_Set3DFactors + BASS_Get3DFactors + BASS_Set3DPosition + BASS_Get3DPosition + BASS_Apply3D + BASS_ChannelSet3DAttributes + BASS_ChannelGet3DAttributes + BASS_ChannelSet3DPosition + BASS_ChannelGet3DPosition + 3DTEST example added (Win32 example also updated) +* VB version of SYNTH example added + +2.2 - 2/10/2005 +--------------- +* Add-on plugin system + BASS_PluginLoad + BASS_PluginFree + BASS_StreamCreateFile/User/Url + BASS_SampleLoad + PLUGINS example added +* MOD position & syncing in bytes + BASS_ChannelSetPosition + BASS_ChannelGetPosition + BASS_MusicGetOrderPosition added for orders position + BASS_SYNC_MUSICPOS added for orders syncing + MAKEMUSICPOS macro/define + CUSTLOOP example updated +* Stream/MOD "length" functions combined (also works with samples), new MOD orders length function + BASS_ChannelGetLength + BASS_MusicGetOrders + BASS_StreamGetLength *removed* + BASS_MusicGetLength *removed* +* Support for AIFF files + BASS_StreamCreateFile/User/Url + BASS_SampleLoad +* Support for 24 and 32-bit (integer) WAV files + BASS_StreamCreateFile/User/Url + BASS_SampleLoad +* WAV files are no longer converted to the "device" resolution + BASS_StreamCreateFile/User/Url +* Recording master control + BASS_RecordGetInput + BASS_RecordSetInput +* Adjustable prebuffering + BASS_ChannelPreBuf +* Floating-point data retrieval + BASS_DATA_FLOAT (BASS_ChannelGetData flag) +* Support for floating-point samples + BASS_SampleLoad + BASS_SampleCreate +* Multi-channel samples + BASS_SampleLoad/Create + BASS_SAMPLE (chans member) +* Sample lengths given in bytes + BASS_SampleCreate + BASS_SAMPLE (length member) +* MOD music 8-bit resolution option + BASS_MusicLoad +* OGG vendor tag retrieval + BASS_TAG_VENDOR (BASS_StreamGetTags type) +* Configurable "User-Agent" header for internet streams + BASS_CONFIG_NET_AGENT (BASS_SetConfig option) +* Shoutcast metadata is now requested automatically + BASS_STREAM_META flag *removed* +* Download callbacks receive all data from start of file/stream (including any non-audio data) + DOWNLOADPROC +* Length when streaming in blocks is unavailable (BASS_ERROR_NOTAVAIL, not just 0) + BASS_ChannelGetLength +* Support for growing custom file streams + BASS_FILE_LEN (STREAMFILEPROC action) +* Query file action removed + BASS_FILE_QUERY *removed* +* Recording channel syncing + BASS_ChannelSetSync +* Info structure "size" members removed + BASS_INFO structure + BASS_RECORDINFO structure +* Little bit of flag reshuffling + BASS_MP3_SETPOS renamed to BASS_STREAM_PRESCAN + BASS_MUSIC_CALCLEN value changed and renamed to BASS_MUSIC_PRESCAN + BASS_MUSIC_POSRESET value changed +* Add-on API enhancements +* MacOSX port introduced + +2.1 - 28/11/2004 +---------------- +* Improved "mixtime" sync system, allowing custom looping + SYNCPROC + CUSTLOOP example added +* FX can now be in the DSP chain, so can be prioritized and applied in floating-point + BASS_ChannelSetFX + BASS_CONFIG_FLOATDSP (BASS_SetConfig option) +* Ability to set channel flags (eg. looping) independent of playback + BASS_ChannelSetFlags + SPEAKERS example updated +* Stream/MOD "play" and channel "resume" functions combined + BASS_ChannelPlay + BASS_StreamPlay *removed* + BASS_MusicPlay *removed* + BASS_MusicPlayEx *removed* + BASS_ChannelResume *removed* +* Stream/MOD prebuffering functions combined + BASS_ChannelPreBuf + BASS_StreamPreBuf *removed* + BASS_MusicPreBuf *removed* +* MOD attribute functions combined, with added BPM/speed/globalvolume options + BASS_MusicSetAttribute + BASS_MusicGetAttribute + BASS_MUSIC_ATTRIB_AMPLIFY + BASS_MUSIC_ATTRIB_PANSEP + BASS_MUSIC_ATTRIB_PSCALER + BASS_MUSIC_ATTRIB_BPM + BASS_MUSIC_ATTRIB_SPEED + BASS_MUSIC_ATTRIB_VOL_GLOBAL + BASS_MUSIC_ATTRIB_VOL_CHAN + BASS_MUSIC_ATTRIB_VOL_INST + BASS_MusicSetAmplify *removed* + BASS_MusicSetPanSep *removed* + BASS_MusicSetPositionScaler *removed* + BASS_MusicSetVolume *removed* + BASS_MusicGetVolume *removed* +* Flag to reset bpm/etc as well as notes when seeking in MOD musics + BASS_MUSIC_POSRESETEX (BASS_MusicLoad & BASS_ChannelSetFlags flag) +* More flexible and concise sample channel creation system + BASS_SampleGetChannel + BASS_SamplePlay *removed* + BASS_SamplePlayEx *removed* + BASS_SamplePlay3D *removed* + BASS_SamplePlay3DEx *removed* +* Support for up to 30 speakers + BASS_SPEAKER_N macro/define +* More precise level measurement + BASS_ChannelGetLevel +* Level can now be retrieved from decoding channels + BASS_ChannelGetLevel +* Retrieval of a sample/channel's original sample resolution + BASS_SAMPLE (origres member) + BASS_CHANNELINFO (origres member) +* Support for streaming WAV files in "blocks" + BASS_StreamCreateURL + BASS_StreamCreateFileUser +* Status info (HTTP/ICY tags) available during connection to server + BASS_STREAM_STATUS (BASS_StreamCreateURL flag) + DOWNLOADPROC + NETRADIO example updated (Delphi version also added) +* Adjustable internet stream prebuffering + BASS_CONFIG_NET_PREBUF (BASS_SetConfig option) +* Option to bypass proxy server + BASS_CONFIG_NET_NOPROXY (BASS_SetConfig option) +* Option whether to allow channels to be played after BASS_Pause + BASS_CONFIG_PAUSE_NOPLAY (BASS_SetConfig option) +* Recording channel count now a separate parameter + BASS_RecordStart (chans parameter) +* Synchronizer for when a channel is freed + BASS_SYNC_FREE (BASS_ChannelSetSync type) +* Data start file position retrieval + BASS_FILEPOS_START (BASS_StreamGetFilePosition mode) +* Performance improvements + MP2 decoding ~20% faster + MP3/MP1 decoding & FFT processing all up to 10% faster + OGG decoding ~3% faster +* C/C++ examples reorganised, with makefiles & VC++ projects +* Add-on API enhancements +* More DLL shrinkage :) + +2.0 - 31/10/2003 +---------------- +* Multiple output device support + BASS_Init (device number changes) + BASS_SetDevice + BASS_GetDevice + BASS_ChannelGetDevice + MULTI example updated (VB version also added) +* Multiple recording device support + BASS_RecordSetDevice + BASS_RecordGetDevice + BASS_RecordStart + BASS_ChannelGetDevice + HRECORD handle + RECORDPROC (handle parameter) +* Recording with DSP/FX + BASS_ChannelSetDSP + BASS_ChannelSetFX +* Recording position retrieval + BASS_ChannelGetPosition +* Start recording paused + BASS_RECORD_PAUSE (BASS_RecordStart flag) +* Multi-channel streams, inc. support for multichannel OGG & WAV files + BASS_StreamCreate + BASS_StreamCreateFile/User/Url +* FFT for individual channels, inc. multi-channel streams + BASS_DATA_FFT_INDIVIDUAL (BASS_ChannelGetData flag) + BASS_DATA_FFT512S/1024S/2048S/4096S *removed* +* DSP prioritizing + BASS_ChannelSetDSP + DSPTEST example updated +* Seeking in internet streamed files + BASS_ChannelSetPosition +* Enhanced custom file stream systems + BASS_StreamCreateFileUser + BASS_FILE_SEEK (STREAMFILEPROC action) + BASS_STREAM_FILEPROC flag *removed* +* Enhanced custom stream system with automatic stalling/resuming + STREAMPROC + BASS_STREAMPROC_END (STREAMPROC flag) +* Synchronizer for stalled/resumed playback + BASS_SYNC_STALL (BASS_ChannelSetSync type) +* Synchronizer for completed download + BASS_SYNC_DOWNLOAD (BASS_ChannelSetSync type) +* End sync support for custom streams + BASS_SYNC_END (BASS_ChannelSetSync type) +* Synchronizer support for decoding channels + BASS_ChannelSetSync +* Unified configuration function + BASS_SetConfig + BASS_GetConfig + BASS_SetBufferLength *removed* + BASS_SetNetConfig *removed* + BASS_SetGlobalVolumes *removed* + BASS_GetGlobalVolumes *removed* + BASS_SetLogCurves *removed* + BASS_Set3DAlgorithm *removed* + BASS_DEVICE_FLOATDSP flag *removed* +* Internet stream saving to disk replaced by more flexible callback + BASS_StreamCreateURL + DOWNLOADPROC + VB NETRADIO example updated +* Buffer length retrieval when "streaming in blocks" + BASS_FILEPOS_END (BASS_StreamGetFilePosition mode) +* Individual sample rate setting for MOD musics + BASS_MusicLoad +* Channel type and default sample rate retrieval + BASS_ChannelGetInfo (replaces BASS_ChannelGetFlags) + BASS_CHANNELINFO +* MOD music flag retrieval + BASS_CHANNELINFO (flags member) +* Adjustable instrument volumes in MOD musics + BASS_MusicSetVolume (replaces BASS_MusicSetChannelVol) + BASS_MusicGetVolume (replaces BASS_MusicGetChannelVol) +* Automatically free a MOD music when it stops or ends + BASS_MUSIC_AUTOFREE (BASS_MusicLoad flag) +* Class GUID added to initialization parameters + BASS_Init + BASS_SetCLSID *removed* +* Update period adjustable at any time + BASS_CONFIG_UPDATEPERIOD (BASS_SetConfig option) + BASS_DEVICE_NOTHREAD flag *removed* +* Customizable maximum volume setting + BASS_CONFIG_MAXVOL (BASS_SetConfig option) + BASS_DEVICE_VOL1000 flag *removed* +* Device volume is now always left as it is during init/freeing + BASS_DEVICE_LEAVEVOL flag *removed* +* Device driver name retrieval + BASS_INFO (driver member) + BASS_RECORDINFO (driver member) +* Error codes are local to the current thread + BASS_ErrorGetCode +* Performance improvements + MP2 decoding 15-20% faster + MP3 decoding ~5% faster +* Built-in CD functions removed (replaced in BASSCD) + BASS_CDDoor *removed* + BASS_CDFree *removed* + BASS_CDGetID *removed* + BASS_CDGetTrackLength *removed* + BASS_CDGetTracks *removed* + BASS_CDInDrive *removed* + BASS_CDInit *removed* + BASS_CDPlay *removed* +* Force channels to use software mixing + BASS_SAMPLE_SOFTWARE (BASS_StreamCreate/File/User/URL & BASS_MusicLoad flag) +* Support for high-pass filter and forward/reverse (S9E/F) IT/MPT effects +* BASS_MUSIC flags rearranged to mirror BASS_SAMPLE/STREAM counterparts +* Output automatically started during initialization +* BASS_ChannelGetData once again accepts any "length" param +* All function comments have been removed from the API headers to avoid + outdated/incorrect information - the BASS.CHM documentation should be used. +* TMT Pascal API removed from main distribution - now available on the website +* A few more 'K' knocked off the DLL size :) + +1.8a - 18/6/2003 +---------------- +* Tweaks 'n' fixes, including... + Fixed seeking bug on 32-bit OGG streams + Fixed seeking on a decoding channel after it has reached the end + Low FPU precision (eg. when using Direct3D) issue addressed + Improved speakers (BASS_INFO) detection + BASS_ChannelSeconds2Bytes return value is rounded down to nearest sample + BASS_ChannelGetData "length" param must equal a whole number of samples + Slide syncs are triggered by "-2" volume slides on "autofree" streams +* Support for UNICODE filenames + BASS_UNICODE (BASS_SampleLoad/BASS_StreamCreateFile/BASS_MusicLoad flag) +* 4096 sample FFT + BASS_DATA_FFT4096/S (BASS_ChannelGetData flags) +* Another 'K' knocked off the DLL size + +1.8 - 9/3/2003 +-------------- +* 32-bit floating-point channels + BASS_SAMPLE_FLOAT (BASS_StreamCreate/URL/File flag) + BASS_MUSIC_FLOAT (BASS_MusicLoad flag) + BASS_SAMPLE_FLOAT (BASS_RecordStart flag) + BASS_DEVICE_FLOATDSP (BASS_Init flag) + DSPTEST example updated +* Support for 32-bit floating-point (type 3) WAV files + BASS_StreamCreateFile/URL + BASS_SampleLoad +* Channel speaker assignment + BASS_SPEAKER_FRONT (BASS_MusicLoad/BASS_StreamCreate/File/URL flag) + BASS_SPEAKER_REAR " + BASS_SPEAKER_CENLFE " + BASS_SPEAKER_REAR2 " + BASS_SPEAKER_FRONTLEFT " + BASS_SPEAKER_FRONTRIGHT " + BASS_SPEAKER_REARLEFT " + BASS_SPEAKER_REARRIGHT " + BASS_SPEAKER_CENTER " + BASS_SPEAKER_LFE " + BASS_SPEAKER_REAR2LEFT " + BASS_SPEAKER_REAR2RIGHT " + BASS_INFO (speakers member) + BASS_DEVICE_SPEAKERS (BASS_Init flag) + 4SPEAKER example replaced by SPEAKERS example +* Recording input type retrieval + BASS_INPUT_TYPE_xxx (BASS_RecordGetInput) + RECTEST example updated +* Non-interpolated MOD mixing + BASS_MUSIC_NONINTER (BASS_MusicLoad/PlayEx flag) +* Performance improvements + FFT up to 100% faster! + MP3(MPEG2/2.5) decoding up to 60% faster + MMX mixers 5-10% faster + MP3(MPEG1)/MP2/MP1/OGG decoding all ~5% faster +* Optional disabling of FFT windowing + BASS_DATA_FFT_NOWINDOW (BASS_ChannelGetData flag) +* BASS_ERROR_FILEFORM - error code to distinguish between file and sample format + BASS_MusicLoad + BASS_SampleLoad + BASS_StreamCreate/File/URL +* BASS_StreamGetFilePosition mode flags added + BASS_FILEPOS_DECODE/DOWNLOAD/END +* DirectX 9 detection + BASS_INFO (dsver member) +* Initialization flags retrieval + BASS_INFO (initflags member) +* Half-rate MP3 playback option removed + BASS_MP3_HALFRATE flag *removed* +* New internal "plugin" system - BASSWMA is further integrated as a result +* Improved documentation - integrated with BASSWMA, search option added +* VB version of DSPTEST example added +* Delphi RECORDTEST example added +* Guess what... reduced DLL size again :) + +1.7 - 27/10/2002 +---------------- +* New alternative DX8 (DMO) effects implementation + BASS_StreamCreate/File/URL + BASS_MusicLoad + BASS_ChannelSetFX + SYNTH example updated +* User file streaming + BASS_STREAM_FILEPROC (BASS_StreamCreate flag) + STREAMFILEPROC +* DSP & FX support for decoding channels + BASS_ChannelSetDSP + BASS_ChannelSetFX +* Support for DX8 (DMO) effects in IT/XM/MO3 files + BASS_MusicLoad +* Support for chained OGG streaming (and syncing) + BASS_StreamCreateURL + BASS_SYNC_META (BASS_ChannelSetSync type) +* Attribute (volume/frequency/pan) sliding + BASS_ChannelSlideAttributes + BASS_ChannelIsSliding + BASS_SYNC_SLIDE (BASS_ChannelSetSync type) +* Recording without a callback function + BASS_RecordStart + LIVEFX example added +* Query a channel's buffered data + BASS_DATA_AVAILABLE (BASS_ChannelGetData flag) +* Discard data from the recording buffer + BASS_ChannelGetData +* Adjustable internet stream config (timeout/buffer lengths) + BASS_SetNetConfig +* Recommended minimum buffer length + BASS_INFO (minbuf member) +* MOD music flags adjustment without changing playback position + BASS_MusicPlayEx + PLAYER (MASM) example updated +* More functions are now useable in MOD music "mixtime" syncs + SYNCPROC + BASS_ChannelSetPosition + BASS_MusicPlayEx + BASS_MusicSetAmplify + BASS_MusicSetPanSep +* Maximum buffer length increased to 5 seconds + BASS_SetBufferLength +* Support for extended filter range in IT files + BASS_MusicLoad +* Speedier MOD music file verification + BASS_MusicLoad +* Delphi 3DTEST example fixed +* Magically reduced DLL size again :) + +1.6a - 25/8/2002 +---------------- +* OGG support updated to 1.0 +* Stereo FFT + BASS_DATA_FFT512S/1024S/2048S (BASS_ChannelGetData flags) +* Support for "Invert Loop" (EFx) MOD effect +* Reduced DLL size +* New Delphi examples + WRITEWAV - WAVE writer example + SAMPLEVIS - Visualisation example + +1.6 - 13/6/2002 +--------------- +* 64-bit stream lengths and positions + BASS_StreamGetLength + BASS_ChannelBytes2Seconds + BASS_ChannelSeconds2Bytes + BASS_ChannelGetPosition + BASS_ChannelSetPosition + BASS_ChannelSetSync +* Recording input selection + BASS_RECORDINFO (inputs & singlein members) + BASS_RecordGetInputName + BASS_RecordGetInput + BASS_RecordSetInput +* Adjustable recording update period + BASS_RecordStart +* Load OGG files as samples + BASS_SampleLoad +* CD drive door opening & closing + BASS_CDDoor +* CDDB2 ID retrieval + BASS_CDID_CDDB2 (BASS_CDGetID flag) +* Streaming beyond initial file length + BASS_StreamCreateFile +* Recording position bytes<->seconds translation + BASS_ChannelBytes2Seconds + BASS_ChannelSeconds2Bytes +* Improved multi-threaded support (play from any thread) + BASS_MusicPlay/Ex + BASS_SamplePlay/3D/Ex + BASS_StreamPlay + BASS_DEVICE_NOSYNC flag *removed* +* Paused channel status + BASS_ACTIVE_PAUSED (BASS_ChannelIsActive) +* Integrated WMA stream freeing + BASS_StreamFree + BASS_Free +* Pin-point accurate OGG seeking without BASS_MP3_SETPOS flag +* Win2k DS buffer bug fix + +1.5a - 14/4/2002 +---------------- +* NT4 fix (also enables "nosound" device without DX installed) + BASS_ERROR_DX error code +* MOD music loading without the samples + BASS_MUSIC_NOSAMPLE (BASS_MusicLoad flag) +* Custom decoding channels + BASS_STREAM_DECODE (BASS_StreamCreate flag) +* 5 second HTTP connection timeout + BASS_ERROR_TIMEOUT (BASS_StreamCreateURL error code) + +1.5 - 31/3/2002 +--------------- +* Improved performance + MMX mixers lot faster (over 50% faster in some cases!) + OGG decoding 15-20% faster + MP3 decoding 5-10% faster +* Recording + BASS_RecordGetDeviceDescription + BASS_RecordInit + BASS_RecordFree + BASS_RecordGetInfo + BASS_RecordStart +* OGG support built-in (OGG/VORBIS DLLs not required) + BASS_DEVICE_OGG flag *removed* +* MOD music seeking in seconds + BASS_MusicPlayEx + BASS_ChannelSetPosition +* Shoutcast metadata retrieval + BASS_STREAM_META (BASS_StreamCreateURL flag) + BASS_TAG_META (BASS_StreamGetTags type) + BASS_SYNC_META (BASS_ChannelSetSync type) +* 1000 volume levels + BASS_DEVICE_VOL1000 (BASS_Init/CDInit flag) +* CDDB ID retrieval + BASS_CDID_CDDB (BASS_CDGetID flag) +* Leave the CD volume as it is during init/closing + BASS_DEVICE_LEAVEVOL (BASS_CDInit flag) +* FFT enabled on decoding channels + BASS_ChannelGetData +* Left level duplicated on right for mono channels + BASS_ChannelGetLevel +* Improved MPEG length estimation without BASS_MP3_SETPOS flag + BASS_StreamGetLength +* Support for Modplug/ADPCM compressed files + BASS_MusicLoad +* Device description function parameter change + BASS_GetDeviceDescription +* MASM API + +1.4 - 30/1/2002 +--------------- +* Channel decoding without playback + BASS_MUSIC_DECODE (BASS_MusicLoad flag) + BASS_STREAM_DECODE (BASS_StreamCreateFile/URL flag) + BASS_ChannelGetData +* Windows message sync callbacks + BASS_SYNC_MESSAGE (BASS_ChannelSetSync flag) +* Adjustable channel volumes in MOD musics + BASS_MusicSetChannelVol + BASS_MusicGetChannelVol +* Customizable DirectSound initialization object + BASS_SetCLSID +* Retrieve HMUSIC/HSTREAM/HCHANNEL IDirectSoundBuffer interfaces + BASS_GetDSoundObject +* A3D functions removed (use BASS_SetCLSID/BASS_GetDSoundObject to access A3D) + BASS_DEVICE_A3D (BASS_Init flag) + BASS_SetA3DResManager + BASS_GetA3DResManager + BASS_SetA3DHFAbsorbtion + BASS_GetA3DHFAbsorbtion +* Callback functions now work in VB6 + DSPPROC + STREAMPROC + SYNCPROC +* Improved PCM WAVE streaming performance + BASS_StreamCreateFile + BASS_StreamCreateURL +* OGG modules updated to RC3 +* Stereo sample support in MO3 format +* MO3 encoder now distributed separately from BASS + +1.3 - 17/11/2001 +---------------- +* Manual buffer updating + BASS_DEVICE_NOTHREAD (BASS_Init flag) + BASS_Update +* Adjustable buffer update period (allows small buffer sizes) + BASS_Init +* Output device latency retrieval + BASS_INFO (latency member) +* MPEG/OGG seeking without BASS_MP3_SETPOS flag + BASS_ChannelSetPosition +* Internet file streaming from offsets + BASS_StreamCreateURL +* File stream tag/comment retrieval (ID3/ID3v2/OGG/HTTP/ICY tags) + BASS_StreamGetTags +* Byte<->time position translation + BASS_ChannelBytes2Seconds + BASS_ChannelSeconds2Bytes +* UMX (Unreal/Tournament music package) format support + BASS_MusicLoad +* S3M/IT sync fx changed to S2x (S0x conflicted with S00) + BASS_SYNC_MUSICFX +* Stereo sample support in IT/XM/S3M formats +* MO3: OGG compression supported + +1.2 - 25/9/2001 +--------------- +* OGG (Ogg Vorbis) stream support + BASS_DEVICE_OGG (BASS_Init flag) + BASS_StreamCreateFile + BASS_StreamCreateURL +* Channel linking (start/stop/pause/resume channels together) + BASS_ChannelSetLink + BASS_ChannelRemoveLink +* MOD music playback length calculation + BASS_MUSIC_CALCLEN (BASS_MusicLoad flag) + BASS_MusicGetLength +* Pre-buffering + BASS_MusicPreBuf + BASS_StreamPreBuf +* Samples with single simultaneous playbacks have same HSAMPLE/HCHANNEL handle + BASS_SamplePlay/Ex +* Stopping a custom stream flushes its buffer contents + BASS_ChannelStop + +1.1a - 31/8/2001 +---------------- +* NT4 bug fixed +* XM Wxx effect syncing + BASS_SYNC_MUSICFX +* MP3/2/1 rewinding without BASS_MP3_SETPOS + BASS_ChannelSetPosition + +1.1 - 11/8/2001 +--------------- +* DX8 (DMO) effects + BASS_SAMPLE_FX (BASS_StreamCreate/File/URL flag) + BASS_MUSIC_FX (BASS_MusicLoad flag) + BASS_ChannelSetFX + BASS_ChannelRemoveFX + BASS_FXSetParameters + BASS_FXGetParameters + BASS_FXCHORUS structure + BASS_FXCOMPRESSOR structure + BASS_FXDISTORTION structure + BASS_FXECHO structure + BASS_FXFLANGER structure + BASS_FXGARGLE structure + BASS_FXI3DL2REVERB structure + BASS_FXPARAMEQ structure + BASS_FXREVERB structure +* Internet file streaming in blocks (inc. Shoutcast/Icecast stream support) + BASS_STREAM_BLOCK (BASS_StreamCreateURL flag) +* 512/1024/2048 sample FFT + BASS_DATA_FFT512/1024/2048 (BASS_ChannelGetData flags) +* CD identification + BASS_CDGetID +* Improved DX version detection + BASS_INFO (dsver member) + +1.0 - 20/6/2001 +--------------- +* Load MP3/MP2/MP1 files as samples + BASS_SampleLoad +* Internet file streaming from FTP servers + BASS_StreamCreateURL +* Save a local copy of internet file streams + BASS_StreamCreateURL +* Sample accurate file stream seeking + BASS_ChannelSetPosition + BASS_StreamGetBlockLength *removed* +* Stream position synchronizer + BASS_SYNC_POS +* Increased synchronizer precision +* Improved MPEG file detection and error detection +* Stop MOD musics on a backwards jump effect + BASS_MUSIC_STOPBACK (BASS_MusicLoad/PlayEx flag) +* Leave the volume as it is during closing (as well as initialization) + BASS_DEVICE_LEAVEVOL (BASS_Init flag) +* Optional automatic use of foreground window handle during initialization + BASS_Init +* Reduced DLL size +* VB API fixes + +0.9 - 18/4/2001 +--------------- +* Internet file streaming + BASS_StreamCreateURL +* MP1 & MP2 (MPEG layer 1 & 2) support + BASS_StreamCreateFile/URL +* MPEG 2.5 support (12000/11025/8000hz sample rates) + BASS_StreamCreateFile/URL +* Decoding/download/end file stream position retrieval + BASS_StreamGetFilePosition +* XMPlay surround sound for MOD musics + BASS_MUSIC_SURROUND (BASS_MusicLoad/PlayEx flag) + BASS_MUSIC_SURROUND2 (BASS_MusicLoad/PlayEx flag) +* Restrict the download rate of internet file streams + BASS_STREAM_RESTRATE (BASS_StreamCreateURL flag) +* Check if an internet file stream is stalled + BASS_ChannelIsActive +* Automatically free a stream when it stops or ends + BASS_STREAM_AUTOFREE (BASS_StreamCreate/File/URL flag) +* Leave the volume as it is during initialization + BASS_DEVICE_LEAVEVOL (BASS_Init flag) +* Number of CD tracks retrieval + BASS_CDGetTracks +* CD track length retrieval + BASS_CDGetTrackLength +* Exact stream length set after whole file is streamed + BASS_StreamGetLength +* TMT Pascal API and samples +* Dynamic-loading Delphi API + +0.8a - 28/2/2000 +---------------- +* Updated Delphi API and samples + +0.8 - 24/1/2000 +--------------- +* Improved MP3 performance on P2/K6 and above CPUs - fast! +* User DSP functions on streams and MOD musics + BASS_ChannelSetDSP + BASS_ChannelRemoveDSP +* DX7 voice allocation & management + BASS_SAMPLE_VAM (BASS_SampleLoad/Create flag) + BASS_VAM_xxx flags + BASS_SAMPLE (vam & priority members) +* DX7 software 3D algorithm selection + BASS_Set3DAlgorithm +* DirectSound interface retrieval + BASS_GetDSoundObject +* Log/linear volume & panning curves + BASS_SetLogCurves +* User data passed to callback functions + STREAMPROC - BASS_StreamCreate + SYNCPROC - BASS_ChannelSetSync +* New synchronizer + BASS_SYNC_MUSICFX +* New synchronizer flag + BASS_SYNC_MIXTIME +* Disable synchronizers option - saves a little CPU time + BASS_DEVICE_NOSYNC (BASS_Init flag) +* Hi-res floating-point CPU usage monitoring + BASS_GetCPU +* Wait for playback to start when playing a CD + BASS_CDPlay +* DirectSound (dsound.dll) version retrieval + BASS_INFO (dsver member) +* Removed volume sliding functions (they were fairly pointless) + BASS_SlideVolume + BASS_IsSliding +* MO3: read/write encoder settings +* MO3: remove inst/samp/message texts now optional +* MO3: LAME encoder settings + +0.7 - 3/10/1999 +--------------- +* MO3 (MP3 compressed MODs) +* A3D functions + BASS_DEVICE_A3D (BASS_Init flag) + BASS_INFO (a3d member) + BASS_SetA3DResManager + BASS_GetA3DResManager + BASS_SetA3DHFAbsorbtion + BASS_GetA3DHFAbsorbtion +* Music/stream immediate sample data retrieval + BASS_ChannelGetData +* File stream (WAV/MP3) length retrieval + BASS_StreamGetLength + BASS_StreamGetBlockLength +* File stream seeking + BASS_ChannelSetPosition +* Mono MP3 option (lower CPU usage) + BASS_StreamCreateFile +* Music length retrieval + BASS_MusicGetLength +* Music name retrieval + BASS_MusicGetName +* Stop notes when moving MOD music position + BASS_MUSIC_POSRESET (BASS_MusicLoad/BASS_MusicPlayEx flag) +* BASS_ERROR_FREQ - invalid sample rate error code + BASS_SampleCreate + BASS_SamplePlayEx + BASS_SamplePlay3DEx + BASS_StreamCreate + BASS_ChannelSetAttributes +* Delphi and VB APIs + +0.6a - 26/7/1999 +---------------- +* Half rate MP3 option (lower CPU usage) + BASS_MP3_HALFRATE +* Loading/streaming from file offsets + BASS_MusicLoad + BASS_SampleLoad + BASS_StreamCreateFile +* Global music/sample/stream volume levels + BASS_SetGlobalVolumes + BASS_GetGlobalVolumes +* Other new function + BASS_SampleStop +* New synchronizer + BASS_SYNC_END +* New sample overrider + BASS_SAMPLE_OVER_DIST +* LoadLibrary/GetProcAddress instructions and example + +0.5 - 4/7/1999 +-------------- +* Documentation! +* File streaming (MP3 and WAV) + BASS_StreamCreateFile +* Custom generated samples + BASS_SampleCreate + BASS_SampleCreateDone +* Other new function + BASS_MusicSetPositionScaler +* Renamed function + BASS_ChannelClearSync -> BASS_ChannelRemoveSync +* Alterations made to + BASS_ChannelGetPosition + BASS_SampleLoad + BASS_StreamPlay + +0.4 - 30/3/1999 +--------------- +* Compressed WAV samples support (using audio CODECs) +* Updated CD volume handling - now works with SB Live +* More linear channel volume/pan scales (were slightly off before) +* "no sound" device option +* 3D sound functions + BASS_Set3DFactors + BASS_Get3DFactors + BASS_Set3DPosition + BASS_Get3DPosition + BASS_Apply3D + BASS_SamplePlay3D + BASS_SamplePlay3DEx + BASS_ChannelSet3DAttributes + BASS_ChannelGet3DAttributes + BASS_ChannelSet3DPosition + BASS_ChannelGet3DPosition +* EAX functions + BASS_SetEAXParameters + BASS_GetEAXParameters + BASS_ChannelSetEAXMix + BASS_ChannelGetEAXMix +* Other new functions + BASS_GetDeviceDescription + BASS_SetBufferLen + BASS_ChannelGetFlags + BASS_ChannelPause + BASS_ChannelResume + BASS_ChannelSetPosition +* Replaced function + BASS_CDResume -> BASS_ChannelResume +* Alterations made to + BASS_Init + BASS_CDInit + BASS_SampleLoad + BASS_StreamPlay + BASS_INFO structure + BASS_SAMPLE structure + BASS_DEVICE_xxx flags + BASS_SAMPLE_xxx flags + +0.3 - 8/3/1999 +-------------- +* Synchronization functions + BASS_ChannelSetSync + BASS_ChannelClearSync +* Other new functions + BASS_GetVersion + BASS_ChannelGetPosition + BASS_ChannelGetLevel + BASS_ChannelGetAttributes + BASS_ChannelSetAttributes +* Replaced functions + BASS_MusicStop -> BASS_ChannelStop + BASS_MusicSetVolume -> BASS_ChannelSetAttributes + BASS_CDStop -> BASS_ChannelStop + BASS_CDSetVolume -> BASS_ChannelSetAttributes + BASS_CDGetVolume -> BASS_ChannelGetAttributes + BASS_ChannelUpdate -> BASS_ChannelSetAttributes +* Alterations made to + BASS_MusicPlayEx + BASS_StreamPlay + BASS_INFO structure + +0.2 - 28/2/1999 +--------------- +* First public release + + +Credits - API/Sample Contributors +================================= +Visual Basic - Adam Hoult, Hendrik Knaepen, Arthur Aminov, + Peter Hebels +Delphi - Titus Miloi, Rogier Timmermans, Alessandro Cappellozza, + Jesse Naranjo, Chris Troesken +MASM - Octavian Chis + +CHMOX is (c)2004 Stéphane Boisson, http://chmox.sourceforge.net/ + + +Bug reports, Suggestions, Comments, Enquiries, etc... +===================================================== +If you have any of the aforementioned please see the BASS forum (at +the website). If you can't find an answer there, you can email: + + bass@un4seen.com + diff --git a/Game/Code/lib/bass/delphi/bass.bpg b/Game/Code/lib/bass/delphi/bass.bpg new file mode 100644 index 00000000..55c2e004 --- /dev/null +++ b/Game/Code/lib/bass/delphi/bass.bpg @@ -0,0 +1,64 @@ +#------------------------------------------------------------------------------ +VERSION = BWS.01 +#------------------------------------------------------------------------------ +!ifndef ROOT +ROOT = $(MAKEDIR)\.. +!endif +#------------------------------------------------------------------------------ +MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$** +DCC = $(ROOT)\bin\dcc32.exe $** +BRCC = $(ROOT)\bin\brcc32.exe $** +#------------------------------------------------------------------------------ +PROJECTS = D3Test.exe BassTest.exe ConTest.exe custloop.exe DspTest.exe \ + FXtest.exe livefx.exe Multi.exe netradio.exe plugins.exe RecordTest.exe \ + samplevis.exe Speakers.exe StreamTest.exe writewav.exe +#------------------------------------------------------------------------------ +default: $(PROJECTS) +#------------------------------------------------------------------------------ + +D3Test.exe: 3dTest\D3Test.dpr + $(DCC) + +BassTest.exe: BassTest\BassTest.dpr + $(DCC) + +ConTest.exe: ConTest\ConTest.dpr + $(DCC) + +custloop.exe: custloop\custloop.dpr + $(DCC) + +DspTest.exe: DspTest\DspTest.dpr + $(DCC) + +FXtest.exe: fxtest\FXtest.dpr + $(DCC) + +livefx.exe: livefx\livefx.dpr + $(DCC) + +Multi.exe: multi\Multi.dpr + $(DCC) + +netradio.exe: netradio\netradio.dpr + $(DCC) + +plugins.exe: plugins\plugins.dpr + $(DCC) + +RecordTest.exe: RecordTest\RecordTest.dpr + $(DCC) + +samplevis.exe: SampleVis\samplevis.dpr + $(DCC) + +Speakers.exe: Speakers\Speakers.dpr + $(DCC) + +StreamTest.exe: StreamTest\StreamTest.dpr + $(DCC) + +writewav.exe: writewav\writewav.dpr + $(DCC) + + diff --git a/Game/Code/lib/bass/delphi/bass.dcu b/Game/Code/lib/bass/delphi/bass.dcu new file mode 100644 index 00000000..d9f949e9 Binary files /dev/null and b/Game/Code/lib/bass/delphi/bass.dcu differ diff --git a/Game/Code/lib/bass/delphi/bass.pas b/Game/Code/lib/bass/delphi/bass.pas new file mode 100644 index 00000000..ba661699 --- /dev/null +++ b/Game/Code/lib/bass/delphi/bass.pas @@ -0,0 +1,968 @@ +{ + BASS 2.3 Audio Library, (c) 1999-2007 Ian Luck. + Please report bugs/suggestions/etc... to bass@un4seen.com + + See the BASS.CHM file for more complete documentation + + + How to install + ---------------- + Copy BASS.PAS to the \LIB subdirectory of your Delphi path or your project dir +} +unit Bass; + +interface + +uses + Windows; + +const + BASSVERSION = $203; // API version + + // Use these to test for error from functions that return a DWORD or QWORD + DW_ERROR = Cardinal(-1); // -1 (DWORD) + QW_ERROR = Int64(-1); // -1 (QWORD) + + // Error codes returned by BASS_GetErrorCode() + BASS_OK = 0; // all is OK + BASS_ERROR_MEM = 1; // memory error + BASS_ERROR_FILEOPEN = 2; // can't open the file + BASS_ERROR_DRIVER = 3; // can't find a free sound driver + BASS_ERROR_BUFLOST = 4; // the sample buffer was lost - please report this! + BASS_ERROR_HANDLE = 5; // invalid handle + BASS_ERROR_FORMAT = 6; // unsupported sample format + BASS_ERROR_POSITION = 7; // invalid playback position + BASS_ERROR_INIT = 8; // BASS_Init has not been successfully called + BASS_ERROR_START = 9; // BASS_Start has not been successfully called + BASS_ERROR_ALREADY = 14; // already initialized/paused/whatever + BASS_ERROR_NOPAUSE = 16; // not paused + BASS_ERROR_NOCHAN = 18; // can't get a free channel + BASS_ERROR_ILLTYPE = 19; // an illegal type was specified + BASS_ERROR_ILLPARAM = 20; // an illegal parameter was specified + BASS_ERROR_NO3D = 21; // no 3D support + BASS_ERROR_NOEAX = 22; // no EAX support + BASS_ERROR_DEVICE = 23; // illegal device number + BASS_ERROR_NOPLAY = 24; // not playing + BASS_ERROR_FREQ = 25; // illegal sample rate + BASS_ERROR_NOTFILE = 27; // the stream is not a file stream + BASS_ERROR_NOHW = 29; // no hardware voices available + BASS_ERROR_EMPTY = 31; // the MOD music has no sequence data + BASS_ERROR_NONET = 32; // no internet connection could be opened + BASS_ERROR_CREATE = 33; // couldn't create the file + BASS_ERROR_NOFX = 34; // effects are not enabled + BASS_ERROR_PLAYING = 35; // the channel is playing + BASS_ERROR_NOTAVAIL = 37; // requested data is not available + BASS_ERROR_DECODE = 38; // the channel is a "decoding channel" + BASS_ERROR_DX = 39; // a sufficient DirectX version is not installed + BASS_ERROR_TIMEOUT = 40; // connection timedout + BASS_ERROR_FILEFORM = 41; // unsupported file format + BASS_ERROR_SPEAKER = 42; // unavailable speaker + BASS_ERROR_VERSION = 43; // invalid BASS version (used by add-ons) + BASS_ERROR_CODEC = 44; // codec is not available/supported + BASS_ERROR_UNKNOWN = -1; // some other mystery error + + // Initialization flags + BASS_DEVICE_8BITS = 1; // use 8 bit resolution, else 16 bit + BASS_DEVICE_MONO = 2; // use mono, else stereo + BASS_DEVICE_3D = 4; // enable 3D functionality + { + If the BASS_DEVICE_3D flag is not specified when + initilizing BASS, then the 3D flags (BASS_SAMPLE_3D + and BASS_MUSIC_3D) are ignored when loading/creating + a sample/stream/music. + } + BASS_DEVICE_LATENCY = 256; // calculate device latency (BASS_INFO struct) + BASS_DEVICE_SPEAKERS = 2048; // force enabling of speaker assignment + BASS_DEVICE_NOSPEAKER = 4096; // ignore speaker arrangement + + // DirectSound interfaces (for use with BASS_GetDSoundObject) + BASS_OBJECT_DS = 1; // IDirectSound + BASS_OBJECT_DS3DL = 2; // IDirectSound3DListener + + // BASS_INFO flags (from DSOUND.H) + DSCAPS_CONTINUOUSRATE = $00000010; + { supports all sample rates between min/maxrate } + DSCAPS_EMULDRIVER = $00000020; + { device does NOT have hardware DirectSound support } + DSCAPS_CERTIFIED = $00000040; + { device driver has been certified by Microsoft } + { + The following flags tell what type of samples are + supported by HARDWARE mixing, all these formats are + supported by SOFTWARE mixing + } + DSCAPS_SECONDARYMONO = $00000100; // mono + DSCAPS_SECONDARYSTEREO = $00000200; // stereo + DSCAPS_SECONDARY8BIT = $00000400; // 8 bit + DSCAPS_SECONDARY16BIT = $00000800; // 16 bit + + // BASS_RECORDINFO flags (from DSOUND.H) + DSCCAPS_EMULDRIVER = DSCAPS_EMULDRIVER; + { device does NOT have hardware DirectSound recording support } + DSCCAPS_CERTIFIED = DSCAPS_CERTIFIED; + { device driver has been certified by Microsoft } + + // defines for formats field of BASS_RECORDINFO (from MMSYSTEM.H) + WAVE_FORMAT_1M08 = $00000001; // 11.025 kHz, Mono, 8-bit + WAVE_FORMAT_1S08 = $00000002; // 11.025 kHz, Stereo, 8-bit + WAVE_FORMAT_1M16 = $00000004; // 11.025 kHz, Mono, 16-bit + WAVE_FORMAT_1S16 = $00000008; // 11.025 kHz, Stereo, 16-bit + WAVE_FORMAT_2M08 = $00000010; // 22.05 kHz, Mono, 8-bit + WAVE_FORMAT_2S08 = $00000020; // 22.05 kHz, Stereo, 8-bit + WAVE_FORMAT_2M16 = $00000040; // 22.05 kHz, Mono, 16-bit + WAVE_FORMAT_2S16 = $00000080; // 22.05 kHz, Stereo, 16-bit + WAVE_FORMAT_4M08 = $00000100; // 44.1 kHz, Mono, 8-bit + WAVE_FORMAT_4S08 = $00000200; // 44.1 kHz, Stereo, 8-bit + WAVE_FORMAT_4M16 = $00000400; // 44.1 kHz, Mono, 16-bit + WAVE_FORMAT_4S16 = $00000800; // 44.1 kHz, Stereo, 16-bit + + // Sample info flags + BASS_SAMPLE_8BITS = 1; // 8 bit + BASS_SAMPLE_FLOAT = 256; // 32-bit floating-point + BASS_SAMPLE_MONO = 2; // mono, else stereo + BASS_SAMPLE_LOOP = 4; // looped + BASS_SAMPLE_3D = 8; // 3D functionality enabled + BASS_SAMPLE_SOFTWARE = 16; // it's NOT using hardware mixing + BASS_SAMPLE_MUTEMAX = 32; // muted at max distance (3D only) + BASS_SAMPLE_VAM = 64; // uses the DX7 voice allocation & management + BASS_SAMPLE_FX = 128; // old implementation of DX8 effects are enabled + BASS_SAMPLE_OVER_VOL = $10000; // override lowest volume + BASS_SAMPLE_OVER_POS = $20000; // override longest playing + BASS_SAMPLE_OVER_DIST = $30000; // override furthest from listener (3D only) + + BASS_STREAM_PRESCAN = $20000; // enable pin-point seeking (MP3/MP2/MP1) + BASS_MP3_SETPOS = BASS_STREAM_PRESCAN; + BASS_STREAM_AUTOFREE = $40000; // automatically free the stream when it stop/ends + BASS_STREAM_RESTRATE = $80000; // restrict the download rate of internet file streams + BASS_STREAM_BLOCK = $100000;// download/play internet file stream in small blocks + BASS_STREAM_DECODE = $200000;// don't play the stream, only decode (BASS_ChannelGetData) + BASS_STREAM_STATUS = $800000;// give server status info (HTTP/ICY tags) in DOWNLOADPROC + + BASS_MUSIC_FLOAT = BASS_SAMPLE_FLOAT; // 32-bit floating-point + BASS_MUSIC_MONO = BASS_SAMPLE_MONO; // force mono mixing (less CPU usage) + BASS_MUSIC_LOOP = BASS_SAMPLE_LOOP; // loop music + BASS_MUSIC_3D = BASS_SAMPLE_3D; // enable 3D functionality + BASS_MUSIC_FX = BASS_SAMPLE_FX; // enable old implementation of DX8 effects + BASS_MUSIC_AUTOFREE = BASS_STREAM_AUTOFREE; // automatically free the music when it stop/ends + BASS_MUSIC_DECODE = BASS_STREAM_DECODE; // don't play the music, only decode (BASS_ChannelGetData) + BASS_MUSIC_PRESCAN = BASS_STREAM_PRESCAN; // calculate playback length + BASS_MUSIC_CALCLEN = BASS_MUSIC_PRESCAN; + BASS_MUSIC_RAMP = $200; // normal ramping + BASS_MUSIC_RAMPS = $400; // sensitive ramping + BASS_MUSIC_SURROUND = $800; // surround sound + BASS_MUSIC_SURROUND2 = $1000; // surround sound (mode 2) + BASS_MUSIC_FT2MOD = $2000; // play .MOD as FastTracker 2 does + BASS_MUSIC_PT1MOD = $4000; // play .MOD as ProTracker 1 does + BASS_MUSIC_NONINTER = $10000; // non-interpolated mixing + BASS_MUSIC_POSRESET = $8000; // stop all notes when moving position + BASS_MUSIC_POSRESETEX = $400000; // stop all notes and reset bmp/etc when moving position + BASS_MUSIC_STOPBACK = $80000; // stop the music on a backwards jump effect + BASS_MUSIC_NOSAMPLE = $100000; // don't load the samples + + // Speaker assignment flags + BASS_SPEAKER_FRONT = $1000000; // front speakers + BASS_SPEAKER_REAR = $2000000; // rear/side speakers + BASS_SPEAKER_CENLFE = $3000000; // center & LFE speakers (5.1) + BASS_SPEAKER_REAR2 = $4000000; // rear center speakers (7.1) + BASS_SPEAKER_LEFT = $10000000; // modifier: left + BASS_SPEAKER_RIGHT = $20000000; // modifier: right + BASS_SPEAKER_FRONTLEFT = BASS_SPEAKER_FRONT or BASS_SPEAKER_LEFT; + BASS_SPEAKER_FRONTRIGHT = BASS_SPEAKER_FRONT or BASS_SPEAKER_RIGHT; + BASS_SPEAKER_REARLEFT = BASS_SPEAKER_REAR or BASS_SPEAKER_LEFT; + BASS_SPEAKER_REARRIGHT = BASS_SPEAKER_REAR or BASS_SPEAKER_RIGHT; + BASS_SPEAKER_CENTER = BASS_SPEAKER_CENLFE or BASS_SPEAKER_LEFT; + BASS_SPEAKER_LFE = BASS_SPEAKER_CENLFE or BASS_SPEAKER_RIGHT; + BASS_SPEAKER_REAR2LEFT = BASS_SPEAKER_REAR2 or BASS_SPEAKER_LEFT; + BASS_SPEAKER_REAR2RIGHT = BASS_SPEAKER_REAR2 or BASS_SPEAKER_RIGHT; + + BASS_UNICODE = $80000000; + + BASS_RECORD_PAUSE = $8000; // start recording paused + + // DX7 voice allocation flags + BASS_VAM_HARDWARE = 1; + { + Play the sample in hardware. If no hardware voices are available then + the "play" call will fail + } + BASS_VAM_SOFTWARE = 2; + { + Play the sample in software (ie. non-accelerated). No other VAM flags + may be used together with this flag. + } + + // DX7 voice management flags + { + These flags enable hardware resource stealing... if the hardware has no + available voices, a currently playing buffer will be stopped to make room + for the new buffer. NOTE: only samples loaded/created with the + BASS_SAMPLE_VAM flag are considered for termination by the DX7 voice + management. + } + BASS_VAM_TERM_TIME = 4; + { + If there are no free hardware voices, the buffer to be terminated will be + the one with the least time left to play. + } + BASS_VAM_TERM_DIST = 8; + { + If there are no free hardware voices, the buffer to be terminated will be + one that was loaded/created with the BASS_SAMPLE_MUTEMAX flag and is + beyond + it's max distance. If there are no buffers that match this criteria, then + the "play" call will fail. + } + BASS_VAM_TERM_PRIO = 16; + { + If there are no free hardware voices, the buffer to be terminated will be + the one with the lowest priority. + } + + // BASS_CHANNELINFO types + BASS_CTYPE_SAMPLE = 1; + BASS_CTYPE_RECORD = 2; + BASS_CTYPE_STREAM = $10000; + BASS_CTYPE_STREAM_OGG = $10002; + BASS_CTYPE_STREAM_MP1 = $10003; + BASS_CTYPE_STREAM_MP2 = $10004; + BASS_CTYPE_STREAM_MP3 = $10005; + BASS_CTYPE_STREAM_AIFF = $10006; + BASS_CTYPE_STREAM_WAV = $40000; // WAVE flag, LOWORD=codec + BASS_CTYPE_STREAM_WAV_PCM = $50001; + BASS_CTYPE_STREAM_WAV_FLOAT = $50003; + BASS_CTYPE_MUSIC_MOD = $20000; + BASS_CTYPE_MUSIC_MTM = $20001; + BASS_CTYPE_MUSIC_S3M = $20002; + BASS_CTYPE_MUSIC_XM = $20003; + BASS_CTYPE_MUSIC_IT = $20004; + BASS_CTYPE_MUSIC_MO3 = $00100; // MO3 flag + + // 3D channel modes + BASS_3DMODE_NORMAL = 0; + { normal 3D processing } + BASS_3DMODE_RELATIVE = 1; + { + The channel's 3D position (position/velocity/ + orientation) are relative to the listener. When the + listener's position/velocity/orientation is changed + with BASS_Set3DPosition, the channel's position + relative to the listener does not change. + } + BASS_3DMODE_OFF = 2; + { + Turn off 3D processing on the channel, the sound will + be played in the center. + } + + // EAX environments, use with BASS_SetEAXParameters + EAX_ENVIRONMENT_GENERIC = 0; + EAX_ENVIRONMENT_PADDEDCELL = 1; + EAX_ENVIRONMENT_ROOM = 2; + EAX_ENVIRONMENT_BATHROOM = 3; + EAX_ENVIRONMENT_LIVINGROOM = 4; + EAX_ENVIRONMENT_STONEROOM = 5; + EAX_ENVIRONMENT_AUDITORIUM = 6; + EAX_ENVIRONMENT_CONCERTHALL = 7; + EAX_ENVIRONMENT_CAVE = 8; + EAX_ENVIRONMENT_ARENA = 9; + EAX_ENVIRONMENT_HANGAR = 10; + EAX_ENVIRONMENT_CARPETEDHALLWAY = 11; + EAX_ENVIRONMENT_HALLWAY = 12; + EAX_ENVIRONMENT_STONECORRIDOR = 13; + EAX_ENVIRONMENT_ALLEY = 14; + EAX_ENVIRONMENT_FOREST = 15; + EAX_ENVIRONMENT_CITY = 16; + EAX_ENVIRONMENT_MOUNTAINS = 17; + EAX_ENVIRONMENT_QUARRY = 18; + EAX_ENVIRONMENT_PLAIN = 19; + EAX_ENVIRONMENT_PARKINGLOT = 20; + EAX_ENVIRONMENT_SEWERPIPE = 21; + EAX_ENVIRONMENT_UNDERWATER = 22; + EAX_ENVIRONMENT_DRUGGED = 23; + EAX_ENVIRONMENT_DIZZY = 24; + EAX_ENVIRONMENT_PSYCHOTIC = 25; + // total number of environments + EAX_ENVIRONMENT_COUNT = 26; + + // software 3D mixing algorithm modes (used with BASS_Set3DAlgorithm) + BASS_3DALG_DEFAULT = 0; + { + default algorithm (currently translates to BASS_3DALG_OFF) + } + BASS_3DALG_OFF = 1; + { + Uses normal left and right panning. The vertical axis is ignored except + for scaling of volume due to distance. Doppler shift and volume scaling + are still applied, but the 3D filtering is not performed. This is the + most CPU efficient software implementation, but provides no virtual 3D + audio effect. Head Related Transfer Function processing will not be done. + Since only normal stereo panning is used, a channel using this algorithm + may be accelerated by a 2D hardware voice if no free 3D hardware voices + are available. + } + BASS_3DALG_FULL = 2; + { + This algorithm gives the highest quality 3D audio effect, but uses more + CPU. Requires Windows 98 2nd Edition or Windows 2000 that uses WDM + drivers, if this mode is not available then BASS_3DALG_OFF will be used + instead. + } + BASS_3DALG_LIGHT = 3; + { + This algorithm gives a good 3D audio effect, and uses less CPU than the + FULL mode. Requires Windows 98 2nd Edition or Windows 2000 that uses WDM + drivers, if this mode is not available then BASS_3DALG_OFF will be used + instead. + } + + { + Sync types (with BASS_ChannelSetSync() "param" and + SYNCPROC "data" definitions) & flags. + } + BASS_SYNC_POS = 0; + { + Sync when a channel reaches a position. + param: position in bytes + data : not used + } + BASS_SYNC_END = 2; + { + Sync when a channel reaches the end. + param: not used + data : not used + } + BASS_SYNC_META = 4; + { + Sync when metadata is received in a stream. + param: not used + data : pointer to the metadata + } + BASS_SYNC_SLIDE = 5; + { + Sync when an attribute slide is completed. + param: not used + data : the type of slide completed (one of the BASS_SLIDE_xxx values) + } + BASS_SYNC_STALL = 6; + { + Sync when playback has stalled. + param: not used + data : 0=stalled, 1=resumed + } + BASS_SYNC_DOWNLOAD = 7; + { + Sync when downloading of an internet (or "buffered" user file) stream has ended. + param: not used + data : not used + } + BASS_SYNC_FREE = 8; + { + Sync when a channel is freed. + param: not used + data : not used + } + BASS_SYNC_SETPOS = 11; + { + Sync when a channel's position is set. + param: not used + data : 0 = playback buffer not flushed, 1 = playback buffer flushed + } + BASS_SYNC_MUSICPOS = 10; + { + Sync when a MOD music reaches an order:row position. + param: LOWORD=order (0=first, -1=all) HIWORD=row (0=first, -1=all) + data : LOWORD=order HIWORD=row + } + BASS_SYNC_MUSICINST = 1; + { + Sync when an instrument (sample for the non-instrument based formats) + is played in a MOD music (not including retrigs). + param: LOWORD=instrument (1=first) HIWORD=note (0=c0...119=b9, -1=all) + data : LOWORD=note HIWORD=volume (0-64) + } + BASS_SYNC_MUSICFX = 3; + { + Sync when the "sync" effect (XM/MTM/MOD: E8x/Wxx, IT/S3M: S2x) is used. + param: 0:data=pos, 1:data="x" value + data : param=0: LOWORD=order HIWORD=row, param=1: "x" value + } + BASS_SYNC_MESSAGE = $20000000; + { FLAG: post a Windows message (instead of callback) + When using a window message "callback", the message to post is given in the "proc" + parameter of BASS_ChannelSetSync, and is posted to the window specified in the BASS_Init + call. The message parameters are: WPARAM = data, LPARAM = user. + } + BASS_SYNC_MIXTIME = $40000000; + { FLAG: sync at mixtime, else at playtime } + BASS_SYNC_ONETIME = $80000000; + { FLAG: sync only once, else continuously } + + // BASS_ChannelIsActive return values + BASS_ACTIVE_STOPPED = 0; + BASS_ACTIVE_PLAYING = 1; + BASS_ACTIVE_STALLED = 2; + BASS_ACTIVE_PAUSED = 3; + + // BASS_ChannelIsSliding return flags + BASS_SLIDE_FREQ = 1; + BASS_SLIDE_VOL = 2; + BASS_SLIDE_PAN = 4; + + // BASS_ChannelGetData flags + BASS_DATA_AVAILABLE = 0; // query how much data is buffered + BASS_DATA_FLOAT = $40000000; // flag: return floating-point sample data + BASS_DATA_FFT512 = $80000000; // 512 sample FFT + BASS_DATA_FFT1024 = $80000001; // 1024 FFT + BASS_DATA_FFT2048 = $80000002; // 2048 FFT + BASS_DATA_FFT4096 = $80000003; // 4096 FFT + BASS_DATA_FFT8192 = $80000004; // 8192 FFT + BASS_DATA_FFT_INDIVIDUAL = $10; // FFT flag: FFT for each channel, else all combined + BASS_DATA_FFT_NOWINDOW = $20; // FFT flag: no Hanning window + + // BASS_ChannelGetTags types : what's returned + BASS_TAG_ID3 = 0; // ID3v1 tags : 128 byte block + BASS_TAG_ID3V2 = 1; // ID3v2 tags : variable length block + BASS_TAG_OGG = 2; // OGG comments : array of null-terminated strings + BASS_TAG_HTTP = 3; // HTTP headers : array of null-terminated strings + BASS_TAG_ICY = 4; // ICY headers : array of null-terminated strings + BASS_TAG_META = 5; // ICY metadata : null-terminated string + BASS_TAG_VENDOR = 9; // OGG encoder : null-terminated string + BASS_TAG_LYRICS3 = 10; // Lyric3v2 tag : ASCII string + BASS_TAG_RIFF_INFO = $100; // RIFF/WAVE tags : array of null-terminated ANSI strings + BASS_TAG_MUSIC_NAME = $10000; // MOD music name : ANSI string + BASS_TAG_MUSIC_MESSAGE = $10001; // MOD message : ANSI string + BASS_TAG_MUSIC_INST = $10100; // + instrument #, MOD instrument name : ANSI string + BASS_TAG_MUSIC_SAMPLE = $10300; // + sample #, MOD sample name : ANSI string + + BASS_FX_CHORUS = 0; // GUID_DSFX_STANDARD_CHORUS + BASS_FX_COMPRESSOR = 1; // GUID_DSFX_STANDARD_COMPRESSOR + BASS_FX_DISTORTION = 2; // GUID_DSFX_STANDARD_DISTORTION + BASS_FX_ECHO = 3; // GUID_DSFX_STANDARD_ECHO + BASS_FX_FLANGER = 4; // GUID_DSFX_STANDARD_FLANGER + BASS_FX_GARGLE = 5; // GUID_DSFX_STANDARD_GARGLE + BASS_FX_I3DL2REVERB = 6; // GUID_DSFX_STANDARD_I3DL2REVERB + BASS_FX_PARAMEQ = 7; // GUID_DSFX_STANDARD_PARAMEQ + BASS_FX_REVERB = 8; // GUID_DSFX_WAVES_REVERB + + BASS_FX_PHASE_NEG_180 = 0; + BASS_FX_PHASE_NEG_90 = 1; + BASS_FX_PHASE_ZERO = 2; + BASS_FX_PHASE_90 = 3; + BASS_FX_PHASE_180 = 4; + + // BASS_RecordSetInput flags + BASS_INPUT_OFF = $10000; + BASS_INPUT_ON = $20000; + BASS_INPUT_LEVEL = $40000; + + BASS_INPUT_TYPE_MASK = $ff000000; + BASS_INPUT_TYPE_UNDEF = $00000000; + BASS_INPUT_TYPE_DIGITAL = $01000000; + BASS_INPUT_TYPE_LINE = $02000000; + BASS_INPUT_TYPE_MIC = $03000000; + BASS_INPUT_TYPE_SYNTH = $04000000; + BASS_INPUT_TYPE_CD = $05000000; + BASS_INPUT_TYPE_PHONE = $06000000; + BASS_INPUT_TYPE_SPEAKER = $07000000; + BASS_INPUT_TYPE_WAVE = $08000000; + BASS_INPUT_TYPE_AUX = $09000000; + BASS_INPUT_TYPE_ANALOG = $0a000000; + + // BASS_SetNetConfig flags + BASS_NET_TIMEOUT = 0; + BASS_NET_BUFFER = 1; + + // BASS_StreamGetFilePosition modes + BASS_FILEPOS_CURRENT = 0; + BASS_FILEPOS_DECODE = BASS_FILEPOS_CURRENT; + BASS_FILEPOS_DOWNLOAD = 1; + BASS_FILEPOS_END = 2; + BASS_FILEPOS_START = 3; + BASS_FILEPOS_CONNECTED = 4; + + // STREAMFILEPROC actions + BASS_FILE_CLOSE = 0; + BASS_FILE_READ = 1; + BASS_FILE_LEN = 3; + BASS_FILE_SEEK = 4; + + BASS_STREAMPROC_END = $80000000; // end of user stream flag + + // BASS_MusicSet/GetAttribute options + BASS_MUSIC_ATTRIB_AMPLIFY = 0; + BASS_MUSIC_ATTRIB_PANSEP = 1; + BASS_MUSIC_ATTRIB_PSCALER = 2; + BASS_MUSIC_ATTRIB_BPM = 3; + BASS_MUSIC_ATTRIB_SPEED = 4; + BASS_MUSIC_ATTRIB_VOL_GLOBAL = 5; + BASS_MUSIC_ATTRIB_VOL_CHAN = $100; // + channel # + BASS_MUSIC_ATTRIB_VOL_INST = $200; // + instrument # + + // BASS_Set/GetConfig options + BASS_CONFIG_BUFFER = 0; + BASS_CONFIG_UPDATEPERIOD = 1; + BASS_CONFIG_MAXVOL = 3; + BASS_CONFIG_GVOL_SAMPLE = 4; + BASS_CONFIG_GVOL_STREAM = 5; + BASS_CONFIG_GVOL_MUSIC = 6; + BASS_CONFIG_CURVE_VOL = 7; + BASS_CONFIG_CURVE_PAN = 8; + BASS_CONFIG_FLOATDSP = 9; + BASS_CONFIG_3DALGORITHM = 10; + BASS_CONFIG_NET_TIMEOUT = 11; + BASS_CONFIG_NET_BUFFER = 12; + BASS_CONFIG_PAUSE_NOPLAY = 13; + BASS_CONFIG_NET_PREBUF = 15; + BASS_CONFIG_NET_AGENT = 16; + BASS_CONFIG_NET_PROXY = 17; + BASS_CONFIG_NET_PASSIVE = 18; + BASS_CONFIG_REC_BUFFER = 19; + BASS_CONFIG_NET_PLAYLIST = 21; + BASS_CONFIG_MUSIC_VIRTUAL = 22; + +type + DWORD = cardinal; + BOOL = LongBool; + FLOAT = Single; + QWORD = int64; // 64-bit (replace "int64" with "comp" if using Delphi 3) + + HMUSIC = DWORD; // MOD music handle + HSAMPLE = DWORD; // sample handle + HCHANNEL = DWORD; // playing sample's channel handle + HSTREAM = DWORD; // sample stream handle + HRECORD = DWORD; // recording handle + HSYNC = DWORD; // synchronizer handle + HDSP = DWORD; // DSP handle + HFX = DWORD; // DX8 effect handle + HPLUGIN = DWORD; // Plugin handle + + BASS_INFO = record + flags: DWORD; // device capabilities (DSCAPS_xxx flags) + hwsize: DWORD; // size of total device hardware memory + hwfree: DWORD; // size of free device hardware memory + freesam: DWORD; // number of free sample slots in the hardware + free3d: DWORD; // number of free 3D sample slots in the hardware + minrate: DWORD; // min sample rate supported by the hardware + maxrate: DWORD; // max sample rate supported by the hardware + eax: BOOL; // device supports EAX? (always FALSE if BASS_DEVICE_3D was not used) + minbuf: DWORD; // recommended minimum buffer length in ms (requires BASS_DEVICE_LATENCY) + dsver: DWORD; // DirectSound version + latency: DWORD; // delay (in ms) before start of playback (requires BASS_DEVICE_LATENCY) + initflags: DWORD; // "flags" parameter of BASS_Init call + speakers: DWORD; // number of speakers available + driver: PChar; // driver + freq: DWORD; // current output rate (OSX only) + end; + + BASS_RECORDINFO = record + flags: DWORD; // device capabilities (DSCCAPS_xxx flags) + formats: DWORD; // supported standard formats (WAVE_FORMAT_xxx flags) + inputs: DWORD; // number of inputs + singlein: BOOL; // only 1 input can be set at a time + driver: PChar; // driver + freq: DWORD; // current input rate (OSX only) + end; + + BASS_CHANNELINFO = record + freq: DWORD; // default playback rate + chans: DWORD; // channels + flags: DWORD; // BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags + ctype: DWORD; // type of channel + origres: DWORD; // original resolution + plugin: HPLUGIN; // plugin + end; + + BASS_PLUGINFORM = record + ctype: DWORD; // channel type + name: PChar; // format description + exts: PChar; // file extension filter (*.ext1;*.ext2;etc...) + end; + PBASS_PLUGINFORMS = ^TBASS_PLUGINFORMS; + TBASS_PLUGINFORMS = array[0..maxInt div sizeOf(BASS_PLUGINFORM) - 1] of BASS_PLUGINFORM; + + BASS_PLUGININFO = record + version: DWORD; // version (same form as BASS_GetVersion) + formatc: DWORD; // number of formats + formats: PBASS_PLUGINFORMS; // the array of formats + end; + PBASS_PLUGININFO = ^BASS_PLUGININFO; + + // Sample info structure + BASS_SAMPLE = record + freq: DWORD; // default playback rate + volume: DWORD; // default volume (0-100) + pan: Integer; // default pan (-100=left, 0=middle, 100=right) + flags: DWORD; // BASS_SAMPLE_xxx flags + length: DWORD; // length (in samples, not bytes) + max: DWORD; // maximum simultaneous playbacks + origres: DWORD; // original resolution + chans: DWORD; // number of channels + mingap: DWORD; // minimum gap (ms) between creating channels + { + The following are the sample's default 3D attributes + (if the sample is 3D, BASS_SAMPLE_3D is in flags) + see BASS_ChannelSet3DAttributes + } + mode3d: DWORD; // BASS_3DMODE_xxx mode + mindist: FLOAT; // minimum distance + maxdist: FLOAT; // maximum distance + iangle: DWORD; // angle of inside projection cone + oangle: DWORD; // angle of outside projection cone + outvol: DWORD; // delta-volume outside the projection cone + { + The following are the defaults used if the sample uses the DirectX 7 + voice allocation/management features. + } + vam: DWORD; // voice allocation/management flags (BASS_VAM_xxx) + priority: DWORD; // priority (0=lowest, $ffffffff=highest) + end; + + // 3D vector (for 3D positions/velocities/orientations) + BASS_3DVECTOR = record + x: FLOAT; // +=right, -=left + y: FLOAT; // +=up, -=down + z: FLOAT; // +=front, -=behind + end; + + BASS_FXCHORUS = record + fWetDryMix: FLOAT; + fDepth: FLOAT; + fFeedback: FLOAT; + fFrequency: FLOAT; + lWaveform: DWORD; // 0=triangle, 1=sine + fDelay: FLOAT; + lPhase: DWORD; // BASS_FX_PHASE_xxx + end; + + BASS_FXCOMPRESSOR = record + fGain: FLOAT; + fAttack: FLOAT; + fRelease: FLOAT; + fThreshold: FLOAT; + fRatio: FLOAT; + fPredelay: FLOAT; + end; + + BASS_FXDISTORTION = record + fGain: FLOAT; + fEdge: FLOAT; + fPostEQCenterFrequency: FLOAT; + fPostEQBandwidth: FLOAT; + fPreLowpassCutoff: FLOAT; + end; + + BASS_FXECHO = record + fWetDryMix: FLOAT; + fFeedback: FLOAT; + fLeftDelay: FLOAT; + fRightDelay: FLOAT; + lPanDelay: BOOL; + end; + + BASS_FXFLANGER = record + fWetDryMix: FLOAT; + fDepth: FLOAT; + fFeedback: FLOAT; + fFrequency: FLOAT; + lWaveform: DWORD; // 0=triangle, 1=sine + fDelay: FLOAT; + lPhase: DWORD; // BASS_FX_PHASE_xxx + end; + + BASS_FXGARGLE = record + dwRateHz: DWORD; // Rate of modulation in hz + dwWaveShape: DWORD; // 0=triangle, 1=square + end; + + BASS_FXI3DL2REVERB = record + lRoom: Longint; // [-10000, 0] default: -1000 mB + lRoomHF: Longint; // [-10000, 0] default: 0 mB + flRoomRolloffFactor: FLOAT; // [0.0, 10.0] default: 0.0 + flDecayTime: FLOAT; // [0.1, 20.0] default: 1.49s + flDecayHFRatio: FLOAT; // [0.1, 2.0] default: 0.83 + lReflections: Longint; // [-10000, 1000] default: -2602 mB + flReflectionsDelay: FLOAT; // [0.0, 0.3] default: 0.007 s + lReverb: Longint; // [-10000, 2000] default: 200 mB + flReverbDelay: FLOAT; // [0.0, 0.1] default: 0.011 s + flDiffusion: FLOAT; // [0.0, 100.0] default: 100.0 % + flDensity: FLOAT; // [0.0, 100.0] default: 100.0 % + flHFReference: FLOAT; // [20.0, 20000.0] default: 5000.0 Hz + end; + + BASS_FXPARAMEQ = record + fCenter: FLOAT; + fBandwidth: FLOAT; + fGain: FLOAT; + end; + + BASS_FXREVERB = record + fInGain: FLOAT; // [-96.0,0.0] default: 0.0 dB + fReverbMix: FLOAT; // [-96.0,0.0] default: 0.0 db + fReverbTime: FLOAT; // [0.001,3000.0] default: 1000.0 ms + fHighFreqRTRatio: FLOAT; // [0.001,0.999] default: 0.001 + end; + + // callback function types + STREAMPROC = function(handle: HSTREAM; buffer: Pointer; length: DWORD; user: DWORD): DWORD; stdcall; + { + User stream callback function. NOTE: A stream function should obviously be as + quick as possible, other streams (and MOD musics) can't be mixed until + it's finished. + handle : The stream that needs writing + buffer : Buffer to write the samples in + length : Number of bytes to write + user : The 'user' parameter value given when calling BASS_StreamCreate + RETURN : Number of bytes written. Set the BASS_STREAMPROC_END flag to end + the stream. + } + + STREAMFILEPROC = function(action, param1, param2, user: DWORD): DWORD; stdcall; + { + User file stream callback function. + action : The action to perform, one of BASS_FILE_xxx values. + param1 : Depends on "action" + param2 : Depends on "action" + user : The 'user' parameter value given when calling BASS_StreamCreate + RETURN : Depends on "action" + } + + DOWNLOADPROC = procedure(buffer: Pointer; length: DWORD; user: DWORD); stdcall; + { + Internet stream download callback function. + buffer : Buffer containing the downloaded data... NULL=end of download + length : Number of bytes in the buffer + user : The 'user' parameter value given when calling BASS_StreamCreateURL + } + + SYNCPROC = procedure(handle: HSYNC; channel, data: DWORD; user: DWORD); stdcall; + { + Sync callback function. NOTE: a sync callback function should be very + quick as other syncs cannot be processed until it has finished. If the + sync is a "mixtime" sync, then other streams and MOD musics can not be + mixed until it's finished either. + handle : The sync that has occured + channel: Channel that the sync occured in + data : Additional data associated with the sync's occurance + user : The 'user' parameter given when calling BASS_ChannelSetSync + } + + DSPPROC = procedure(handle: HDSP; channel: DWORD; buffer: Pointer; length: DWORD; user: DWORD); stdcall; + { + DSP callback function. NOTE: A DSP function should obviously be as quick + as possible... other DSP functions, streams and MOD musics can not be + processed until it's finished. + handle : The DSP handle + channel: Channel that the DSP is being applied to + buffer : Buffer to apply the DSP to + length : Number of bytes in the buffer + user : The 'user' parameter given when calling BASS_ChannelSetDSP + } + + RECORDPROC = function(handle: HRECORD; buffer: Pointer; length: DWORD; user: DWORD): BOOL; stdcall; + { + Recording callback function. + handle : The recording handle + buffer : Buffer containing the recorded sample data + length : Number of bytes + user : The 'user' parameter value given when calling BASS_RecordStart + RETURN : TRUE = continue recording, FALSE = stop + } + + +// Functions +const + bassdll = 'bass.dll'; + +function BASS_SetConfig(option, value: DWORD): DWORD; stdcall; external bassdll; +function BASS_GetConfig(option: DWORD): DWORD; stdcall; external bassdll; +function BASS_GetVersion: DWORD; stdcall; external bassdll; +function BASS_GetDeviceDescription(device: DWORD): PChar; stdcall; external bassdll; +function BASS_ErrorGetCode: Integer; stdcall; external bassdll; +function BASS_Init(device: Integer; freq, flags: DWORD; win: HWND; clsid: PGUID): BOOL; stdcall; external bassdll; +function BASS_SetDevice(device: DWORD): BOOL; stdcall; external bassdll; +function BASS_GetDevice: DWORD; stdcall; external bassdll; +function BASS_Free: BOOL; stdcall; external bassdll; +function BASS_GetDSoundObject(obj: DWORD): Pointer; stdcall; external bassdll; +function BASS_GetInfo(var info: BASS_INFO): BOOL; stdcall; external bassdll; +function BASS_Update: BOOL; stdcall; external bassdll; +function BASS_GetCPU: FLOAT; stdcall; external bassdll; +function BASS_Start: BOOL; stdcall; external bassdll; +function BASS_Stop: BOOL; stdcall; external bassdll; +function BASS_Pause: BOOL; stdcall; external bassdll; +function BASS_SetVolume(volume: DWORD): BOOL; stdcall; external bassdll; +function BASS_GetVolume: Integer; stdcall; external bassdll; + +function BASS_PluginLoad(filename: PChar; flags: DWORD): HPLUGIN; stdcall; external bassdll; +function BASS_PluginFree(handle: HPLUGIN): BOOL; stdcall; external bassdll; +function BASS_PluginGetInfo(handle: HPLUGIN): PBASS_PLUGININFO; stdcall; external bassdll; + +function BASS_Set3DFactors(distf, rollf, doppf: FLOAT): BOOL; stdcall; external bassdll; +function BASS_Get3DFactors(var distf, rollf, doppf: FLOAT): BOOL; stdcall; external bassdll; +function BASS_Set3DPosition(var pos, vel, front, top: BASS_3DVECTOR): BOOL; stdcall; external bassdll; +function BASS_Get3DPosition(var pos, vel, front, top: BASS_3DVECTOR): BOOL; stdcall; external bassdll; +procedure BASS_Apply3D; stdcall; external bassdll; +function BASS_SetEAXParameters(env: Integer; vol, decay, damp: FLOAT): BOOL; stdcall; external bassdll; +function BASS_GetEAXParameters(var env: DWORD; var vol, decay, damp: FLOAT): BOOL; stdcall; external bassdll; + +function BASS_MusicLoad(mem: BOOL; f: Pointer; offset, length, flags, freq: DWORD): HMUSIC; stdcall; external bassdll; +function BASS_MusicFree(handle: HMUSIC): BOOL; stdcall; external bassdll; +function BASS_MusicSetAttribute(handle: HMUSIC; attrib,value: DWORD): DWORD; stdcall; external bassdll; +function BASS_MusicGetAttribute(handle: HMUSIC; attrib: DWORD): DWORD; stdcall; external bassdll; +function BASS_MusicGetOrders(handle: HMUSIC): DWORD; stdcall; external bassdll; +function BASS_MusicGetOrderPosition(handle: HMUSIC): DWORD; stdcall; external bassdll; + +function BASS_SampleLoad(mem: BOOL; f: Pointer; offset, length, max, flags: DWORD): HSAMPLE; stdcall; external bassdll; +function BASS_SampleCreate(length, freq, chans, max, flags: DWORD): Pointer; stdcall; external bassdll; +function BASS_SampleCreateDone: HSAMPLE; stdcall; external bassdll; +function BASS_SampleFree(handle: HSAMPLE): BOOL; stdcall; external bassdll; +function BASS_SampleGetInfo(handle: HSAMPLE; var info: BASS_SAMPLE): BOOL; stdcall; external bassdll; +function BASS_SampleSetInfo(handle: HSAMPLE; var info: BASS_SAMPLE): BOOL; stdcall; external bassdll; +function BASS_SampleGetChannel(handle: HSAMPLE; onlynew: BOOL): HCHANNEL; stdcall; external bassdll; +function BASS_SampleGetChannels(handle: HSAMPLE; channels: Pointer): DWORD; stdcall; external bassdll; +function BASS_SampleStop(handle: HSAMPLE): BOOL; stdcall; external bassdll; + +function BASS_StreamCreate(freq, chans, flags: DWORD; proc: Pointer; user: DWORD): HSTREAM; stdcall; external bassdll; +function BASS_StreamCreateFile(mem: BOOL; f: Pointer; offset, length, flags: DWORD): HSTREAM; stdcall; external bassdll; +function BASS_StreamCreateURL(url: PChar; offset: DWORD; flags: DWORD; proc: DOWNLOADPROC; user: DWORD):HSTREAM; stdcall; external bassdll; +function BASS_StreamCreateFileUser(buffered: BOOL; flags: DWORD; proc: STREAMFILEPROC; user: DWORD): HSTREAM; stdcall; external bassdll; +function BASS_StreamFree(handle: HSTREAM): BOOL; stdcall; external bassdll; +function BASS_StreamGetFilePosition(handle:HSTREAM; mode:DWORD) : DWORD;stdcall;external bassdll; + +function BASS_RecordGetDeviceDescription(devnum: DWORD):PChar;stdcall;external bassdll; +function BASS_RecordInit(device: Integer):BOOL;stdcall;external bassdll; +function BASS_RecordSetDevice(device: DWORD): BOOL; stdcall; external bassdll; +function BASS_RecordGetDevice: DWORD; stdcall; external bassdll; +function BASS_RecordFree:BOOL;stdcall;external bassdll; +function BASS_RecordGetInfo(var info:BASS_RECORDINFO):BOOL;stdcall;external bassdll; +function BASS_RecordGetInputName(input:Integer):PChar;stdcall;external bassdll; +function BASS_RecordSetInput(input:Integer; setting:DWORD):BOOL;stdcall;external bassdll; +function BASS_RecordGetInput(input:Integer):DWORD;stdcall;external bassdll; +function BASS_RecordStart(freq,chans,flags:DWORD; proc:RECORDPROC; user:DWORD):HRECORD;stdcall;external bassdll; + +function BASS_ChannelBytes2Seconds(handle: DWORD; pos: QWORD): FLOAT; stdcall;external bassdll; +function BASS_ChannelSeconds2Bytes(handle: DWORD; pos: FLOAT): QWORD; stdcall;external bassdll; +function BASS_ChannelGetDevice(handle: DWORD): DWORD; stdcall; external bassdll; +function BASS_ChannelSetDevice(handle, device: DWORD): BOOL; stdcall; external bassdll; +function BASS_ChannelIsActive(handle: DWORD): DWORD; stdcall;external bassdll; +function BASS_ChannelGetInfo(handle: DWORD; var info:BASS_CHANNELINFO):BOOL;stdcall;external bassdll; +function BASS_ChannelGetTags(handle: HSTREAM; tags : DWORD): PChar; stdcall; external bassdll; +function BASS_ChannelSetFlags(handle, flags: DWORD): BOOL; stdcall; external bassdll; +function BASS_ChannelPreBuf(handle, length: DWORD): BOOL; stdcall; external bassdll; +function BASS_ChannelPlay(handle: DWORD; restart: BOOL): BOOL; stdcall; external bassdll; +function BASS_ChannelStop(handle: DWORD): BOOL; stdcall; external bassdll; +function BASS_ChannelPause(handle: DWORD): BOOL; stdcall; external bassdll; +function BASS_ChannelSetAttributes(handle: DWORD; freq, volume, pan: Integer): BOOL; stdcall; external bassdll; +function BASS_ChannelGetAttributes(handle: DWORD; var freq, volume: DWORD; var pan: Integer): BOOL; stdcall; external bassdll; +function BASS_ChannelSlideAttributes(handle: DWORD; freq, volume, pan: Integer; time: DWORD): BOOL; stdcall; external bassdll; +function BASS_ChannelIsSliding(handle: DWORD): DWORD; stdcall;external bassdll; +function BASS_ChannelSet3DAttributes(handle: DWORD; mode: Integer; min, max: FLOAT; iangle, oangle, outvol: Integer): BOOL; stdcall; external bassdll; +function BASS_ChannelGet3DAttributes(handle: DWORD; var mode: DWORD; var min, max: FLOAT; var iangle, oangle, outvol: DWORD): BOOL; stdcall; external bassdll; +function BASS_ChannelSet3DPosition(handle: DWORD; var pos, orient, vel: BASS_3DVECTOR): BOOL; stdcall; external bassdll; +function BASS_ChannelGet3DPosition(handle: DWORD; var pos, orient, vel: BASS_3DVECTOR): BOOL; stdcall; external bassdll; +function BASS_ChannelGetLength(handle: DWORD): QWORD; stdcall; external bassdll; +function BASS_ChannelSetPosition(handle: DWORD; pos: QWORD): BOOL; stdcall; external bassdll; +function BASS_ChannelGetPosition(handle: DWORD): QWORD; stdcall; external bassdll; +function BASS_ChannelGetLevel(handle: DWORD): DWORD; stdcall; external bassdll; +function BASS_ChannelGetData(handle: DWORD; buffer: Pointer; length: DWORD): DWORD; stdcall; external bassdll; +function BASS_ChannelSetSync(handle: DWORD; stype: DWORD; param: QWORD; proc: SYNCPROC; user: DWORD): HSYNC; stdcall; external bassdll; +function BASS_ChannelRemoveSync(handle: DWORD; sync: HSYNC): BOOL; stdcall; external bassdll; +function BASS_ChannelSetDSP(handle: DWORD; proc: DSPPROC; user: DWORD; priority: Integer): HDSP; stdcall; external bassdll; +function BASS_ChannelRemoveDSP(handle: DWORD; dsp: HDSP): BOOL; stdcall; external bassdll; +function BASS_ChannelSetEAXMix(handle: DWORD; mix: FLOAT): BOOL; stdcall; external bassdll; +function BASS_ChannelGetEAXMix(handle: DWORD; var mix: FLOAT): BOOL; stdcall; external bassdll; +function BASS_ChannelSetLink(handle, chan: DWORD): BOOL; stdcall; external bassdll; +function BASS_ChannelRemoveLink(handle, chan: DWORD): BOOL; stdcall; external bassdll; +function BASS_ChannelSetFX(handle, etype: DWORD; priority: Integer): HFX; stdcall; external bassdll; +function BASS_ChannelRemoveFX(handle: DWORD; fx: HFX): BOOL; stdcall; external bassdll; + +function BASS_FXSetParameters(handle: HFX; par: Pointer): BOOL; stdcall; external bassdll; +function BASS_FXGetParameters(handle: HFX; par: Pointer): BOOL; stdcall; external bassdll; +function BASS_FXReset(handle: HFX): BOOL; stdcall; external bassdll; + + +function BASS_SPEAKER_N(n: DWORD): DWORD; +function MAKEMUSICPOS(order,row: DWORD): DWORD; +function BASS_SetEAXPreset(env: Integer): BOOL; +{ + This function is defined in the implementation part of this unit. + It is not part of BASS.DLL but an extra function which makes it easier + to set the predefined EAX environments. + env : a EAX_ENVIRONMENT_xxx constant +} + + +implementation + +function BASS_SPEAKER_N(n: DWORD): DWORD; +begin + Result := n shl 24; +end; + +function MAKEMUSICPOS(order,row: DWORD): DWORD; +begin + Result := $80000000 or DWORD(MAKELONG(order,row)); +end; + +function BASS_SetEAXPreset(env: Integer): BOOL; +begin + case (env) of + EAX_ENVIRONMENT_GENERIC: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_GENERIC, 0.5, 1.493, 0.5); + EAX_ENVIRONMENT_PADDEDCELL: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_PADDEDCELL, 0.25, 0.1, 0); + EAX_ENVIRONMENT_ROOM: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_ROOM, 0.417, 0.4, 0.666); + EAX_ENVIRONMENT_BATHROOM: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_BATHROOM, 0.653, 1.499, 0.166); + EAX_ENVIRONMENT_LIVINGROOM: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_LIVINGROOM, 0.208, 0.478, 0); + EAX_ENVIRONMENT_STONEROOM: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_STONEROOM, 0.5, 2.309, 0.888); + EAX_ENVIRONMENT_AUDITORIUM: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_AUDITORIUM, 0.403, 4.279, 0.5); + EAX_ENVIRONMENT_CONCERTHALL: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_CONCERTHALL, 0.5, 3.961, 0.5); + EAX_ENVIRONMENT_CAVE: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_CAVE, 0.5, 2.886, 1.304); + EAX_ENVIRONMENT_ARENA: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_ARENA, 0.361, 7.284, 0.332); + EAX_ENVIRONMENT_HANGAR: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_HANGAR, 0.5, 10.0, 0.3); + EAX_ENVIRONMENT_CARPETEDHALLWAY: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_CARPETEDHALLWAY, 0.153, 0.259, 2.0); + EAX_ENVIRONMENT_HALLWAY: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_HALLWAY, 0.361, 1.493, 0); + EAX_ENVIRONMENT_STONECORRIDOR: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_STONECORRIDOR, 0.444, 2.697, 0.638); + EAX_ENVIRONMENT_ALLEY: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_ALLEY, 0.25, 1.752, 0.776); + EAX_ENVIRONMENT_FOREST: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_FOREST, 0.111, 3.145, 0.472); + EAX_ENVIRONMENT_CITY: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_CITY, 0.111, 2.767, 0.224); + EAX_ENVIRONMENT_MOUNTAINS: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_MOUNTAINS, 0.194, 7.841, 0.472); + EAX_ENVIRONMENT_QUARRY: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_QUARRY, 1, 1.499, 0.5); + EAX_ENVIRONMENT_PLAIN: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_PLAIN, 0.097, 2.767, 0.224); + EAX_ENVIRONMENT_PARKINGLOT: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_PARKINGLOT, 0.208, 1.652, 1.5); + EAX_ENVIRONMENT_SEWERPIPE: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_SEWERPIPE, 0.652, 2.886, 0.25); + EAX_ENVIRONMENT_UNDERWATER: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_UNDERWATER, 1, 1.499, 0); + EAX_ENVIRONMENT_DRUGGED: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_DRUGGED, 0.875, 8.392, 1.388); + EAX_ENVIRONMENT_DIZZY: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_DIZZY, 0.139, 17.234, 0.666); + EAX_ENVIRONMENT_PSYCHOTIC: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_PSYCHOTIC, 0.486, 7.563, 0.806); + else + Result := FALSE; + end; +end; + +end. +// END OF FILE ///////////////////////////////////////////////////////////////// + diff --git a/Game/Code/lib/ffmpeg/MATHEMATICS.pas b/Game/Code/lib/ffmpeg/MATHEMATICS.pas new file mode 100644 index 00000000..9570d343 --- /dev/null +++ b/Game/Code/lib/ffmpeg/MATHEMATICS.pas @@ -0,0 +1,58 @@ +unit MATHEMATICS; + +interface + +(* + * copyright (c) 2005 Michael Niedermayer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +uses + windows, rational; + +const + av__util = 'avutil-49.dll'; + +type + TAVRounding = ( + AV_ROUND_ZERO = 0, ///< round toward zero + AV_ROUND_INF = 1, ///< round away from zero + AV_ROUND_DOWN = 2, ///< round toward -infinity + AV_ROUND_UP = 3, ///< round toward +infinity + AV_ROUND_NEAR_INF = 5, ///< round to nearest and halfway cases away from zero + AV_ROUND_FUCKING = $FFFFFF + ); + +(** * rescale a 64bit integer with rounding to nearest. + * a simple a*b/c isn't possible as it can overflow *) +function av_rescale (a, b, c: int64): int64; + cdecl; external av__util; + +(** + * rescale a 64bit integer with specified rounding. + * a simple a*b/c isn't possible as it can overflow *) +function av_rescale_rnd (a, b, c: int64; enum: TAVRounding): int64; + cdecl; external av__util; + +(** + * rescale a 64bit integer by 2 rational numbers. *) +function av_rescale_q (a: int64; bq, cq: TAVRational): int64; + cdecl; external av__util; + +implementation + +end. + \ No newline at end of file diff --git a/Game/Code/lib/ffmpeg/acm_unit.pas b/Game/Code/lib/ffmpeg/acm_unit.pas new file mode 100644 index 00000000..307fb479 --- /dev/null +++ b/Game/Code/lib/ffmpeg/acm_unit.pas @@ -0,0 +1,197 @@ +unit acm_unit; + +interface + +uses + windows, mmsystem; + (* + ****************************************************************************** + * èíòåðôåéñ ê MS Audio Compression Manager + ****************************************************************************** + *) +type + PWaveFilter = ^TWaveFilter; + // Defined in mmreg.h + WAVEFILTER = packed record + cbStruct: DWORD; // Size of the filter in bytes + dwFilterTag: DWORD; // filter type + fdwFilter: DWORD; // Flags for the filter (Universal Dfns) + dwReserved: array [0..4] of DWORD; // Reserved for system use + end; + TWaveFilter = WAVEFILTER; + + HACMDRIVERID__ = record + Unused: Integer; + end; + {$EXTERNALSYM HACMDRIVERID__} + HACMDRIVERID = ^HACMDRIVERID__; + {$EXTERNALSYM HACMDRIVERID} + PHACMDRIVERID = ^HACMDRIVERID; + {$EXTERNALSYM PHACMDRIVERID} + LPHACMDRIVERID = ^HACMDRIVERID; + {$EXTERNALSYM LPHACMDRIVERID} + + HACMDRIVER__ = record + Unused: Integer; + end; + + {$EXTERNALSYM HACMDRIVER__} + HACMDRIVER = ^HACMDRIVER__; + {$EXTERNALSYM HACMDRIVER} + PHACMDRIVER = ^HACMDRIVER; + {$EXTERNALSYM PHACMDRIVER} + LPHACMDRIVER = ^HACMDRIVER; + {$EXTERNALSYM LPHACMDRIVER} + + HACMSTREAM__ = record + Unused: Integer; + end; + + {$EXTERNALSYM HACMSTREAM__} + HACMSTREAM = ^HACMSTREAM__; + {$EXTERNALSYM HACMSTREAM} + PHACMSTREAM = ^HACMSTREAM; + {$EXTERNALSYM PHACMSTREAM} + LPHACMSTREAM = ^HACMSTREAM; + {$EXTERNALSYM LPHACMSTREAM} + + PAcmStreamHeader = ^TAcmStreamHeader; + ACMSTREAMHEADER = packed record + cbStruct: DWORD; + fdwStatus: DWORD; + dwUser: DWORD; + pbSrc: PBYTE; + cbSrcLength: DWORD; + cbSrcLengthUsed: DWORD; + dwSrcUser: DWORD; + pbDst: PBYTE; + cbDstLength: DWORD; + cbDstLengthUsed: DWORD; + dwDstUser: DWORD; + dwReservedDriver: array [0..10 - 1] of DWORD; + end; + {$EXTERNALSYM tACMSTREAMHEADER} + TAcmStreamHeader = ACMSTREAMHEADER; + +const + ACMSTREAMHEADER_STATUSF_DONE = $00010000; + {$EXTERNALSYM ACMSTREAMHEADER_STATUSF_DONE} + ACMSTREAMHEADER_STATUSF_PREPARED = $00020000; + {$EXTERNALSYM ACMSTREAMHEADER_STATUSF_PREPARED} + ACMSTREAMHEADER_STATUSF_INQUEUE = $00100000; + {$EXTERNALSYM ACMSTREAMHEADER_STATUSF_INQUEUE} + +function acmStreamOpen(var phas: HACMSTREAM; had: HACMDRIVER; var pwfxSrc: TWAVEFORMATEX; + var pwfxDst: TWAVEFORMATEX; pwfltr: PWAVEFILTER; dwCallback: DWORD; dwInstance: DWORD; + fdwOpen: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmStreamOpen} + +const + ACM_STREAMOPENF_QUERY = $00000001; + {$EXTERNALSYM ACM_STREAMOPENF_QUERY} + ACM_STREAMOPENF_ASYNC = $00000002; + {$EXTERNALSYM ACM_STREAMOPENF_ASYNC} + ACM_STREAMOPENF_NONREALTIME = $00000004; + {$EXTERNALSYM ACM_STREAMOPENF_NONREALTIME} + +function acmStreamSize(has: HACMSTREAM; cbInput: DWORD; var pdwOutputBytes: DWORD; + fdwSize: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmStreamSize} + +const + ACM_STREAMSIZEF_SOURCE = $00000000; + {$EXTERNALSYM ACM_STREAMSIZEF_SOURCE} + ACM_STREAMSIZEF_DESTINATION = $00000001; + {$EXTERNALSYM ACM_STREAMSIZEF_DESTINATION} + ACM_STREAMSIZEF_QUERYMASK = $0000000F; + {$EXTERNALSYM ACM_STREAMSIZEF_QUERYMASK} + +function acmStreamConvert(has: HACMSTREAM; var pash: TAcmStreamHeader; + fdwConvert: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmStreamConvert} + +const + ACM_STREAMCONVERTF_BLOCKALIGN = $00000004; + {$EXTERNALSYM ACM_STREAMCONVERTF_BLOCKALIGN} + ACM_STREAMCONVERTF_START = $00000010; + {$EXTERNALSYM ACM_STREAMCONVERTF_START} + ACM_STREAMCONVERTF_END = $00000020; + {$EXTERNALSYM ACM_STREAMCONVERTF_END} + +function acmStreamPrepareHeader(has: HACMSTREAM; var pash: TAcmStreamHeader; + fdwPrepare: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmStreamPrepareHeader} + +function acmStreamUnprepareHeader(has: HACMSTREAM; var pash: TAcmStreamHeader; + fdwUnprepare: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmStreamUnprepareHeader} + +function acmStreamClose(has: HACMSTREAM; fdwClose: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmStreamClose} + (* + ****************************************************************************** + * èíòåðôåéñ ê MS Audio Compression Manager + ****************************************************************************** + *) + +implementation + +const + msacm32 = 'msacm32.dll'; + +(*function acmGetVersion; external msacm32 name 'acmGetVersion'; +function acmMetrics; external msacm32 name 'acmMetrics'; +function acmDriverEnum; external msacm32 name 'acmDriverEnum'; +function acmDriverID; external msacm32 name 'acmDriverID'; +function acmDriverAddA; external msacm32 name 'acmDriverAddA'; +function acmDriverAddW; external msacm32 name 'acmDriverAddW'; +function acmDriverAdd; external msacm32 name 'acmDriverAddA'; +function acmDriverRemove; external msacm32 name 'acmDriverRemove'; +function acmDriverOpen; external msacm32 name 'acmDriverOpen'; +function acmDriverClose; external msacm32 name 'acmDriverClose'; +function acmDriverMessage; external msacm32 name 'acmDriverMessage'; +function acmDriverPriority; external msacm32 name 'acmDriverPriority'; +function acmDriverDetailsA; external msacm32 name 'acmDriverDetailsA'; +function acmDriverDetailsW; external msacm32 name 'acmDriverDetailsW'; +function acmDriverDetails; external msacm32 name 'acmDriverDetailsA'; +function acmFormatTagDetailsA; external msacm32 name 'acmFormatTagDetailsA'; +function acmFormatTagDetailsW; external msacm32 name 'acmFormatTagDetailsW'; +function acmFormatTagDetails; external msacm32 name 'acmFormatTagDetailsA'; +function acmFormatDetailsA; external msacm32 name 'acmFormatDetailsA'; +function acmFormatDetailsW; external msacm32 name 'acmFormatDetailsW'; +function acmFormatDetails; external msacm32 name 'acmFormatDetailsA'; +function acmFormatChooseA; external msacm32 name 'acmFormatChooseA'; +function acmFormatChooseW; external msacm32 name 'acmFormatChooseW'; +function acmFormatChoose; external msacm32 name 'acmFormatChooseA'; +function acmFormatEnumA; external msacm32 name 'acmFormatEnumA'; +function acmFormatEnumW; external msacm32 name 'acmFormatEnumW'; +function acmFormatEnum; external msacm32 name 'acmFormatEnumA'; +function acmFormatTagEnumA; external msacm32 name 'acmFormatTagEnumA'; +function acmFormatTagEnumW; external msacm32 name 'acmFormatTagEnumW'; +function acmFormatTagEnum; external msacm32 name 'acmFormatTagEnumA'; +function acmFormatSuggest; external msacm32 name 'acmFormatSuggest'; +function acmFilterTagDetailsA; external msacm32 name 'acmFilterTagDetailsA'; +function acmFilterTagDetailsW; external msacm32 name 'acmFilterTagDetailsW'; +function acmFilterTagDetails; external msacm32 name 'acmFilterTagDetailsA'; +function acmFilterTagEnumA; external msacm32 name 'acmFilterTagEnumA'; +function acmFilterTagEnumW; external msacm32 name 'acmFilterTagEnumW'; +function acmFilterTagEnum; external msacm32 name 'acmFilterTagEnumA'; +function acmFilterDetailsA; external msacm32 name 'acmFilterDetailsA'; +function acmFilterDetailsW; external msacm32 name 'acmFilterDetailsW'; +function acmFilterDetails; external msacm32 name 'acmFilterDetailsA'; +function acmFilterEnumA; external msacm32 name 'acmFilterEnumA'; +function acmFilterEnumW; external msacm32 name 'acmFilterEnumW'; +function acmFilterEnum; external msacm32 name 'acmFilterEnumA'; +function acmFilterChooseA; external msacm32 name 'acmFilterChooseA'; +function acmFilterChooseW; external msacm32 name 'acmFilterChooseW'; +function acmFilterChoose; external msacm32 name 'acmFilterChooseA'; *) +function acmStreamOpen; external msacm32 name 'acmStreamOpen'; +function acmStreamClose; external msacm32 name 'acmStreamClose'; +function acmStreamSize; external msacm32 name 'acmStreamSize'; +//function acmStreamReset; external msacm32 name 'acmStreamReset'; +//function acmStreamMessage; external msacm32 name 'acmStreamMessage'; +function acmStreamConvert; external msacm32 name 'acmStreamConvert'; +function acmStreamPrepareHeader; external msacm32 name 'acmStreamPrepareHeader'; +function acmStreamUnprepareHeader; external msacm32 name 'acmStreamUnprepareHeader'; + +end. diff --git a/Game/Code/lib/ffmpeg/avcodec.dcu b/Game/Code/lib/ffmpeg/avcodec.dcu new file mode 100644 index 00000000..a682a490 Binary files /dev/null and b/Game/Code/lib/ffmpeg/avcodec.dcu differ diff --git a/Game/Code/lib/ffmpeg/avcodec.pas b/Game/Code/lib/ffmpeg/avcodec.pas new file mode 100644 index 00000000..978b5fb6 --- /dev/null +++ b/Game/Code/lib/ffmpeg/avcodec.pas @@ -0,0 +1,1968 @@ + (* + * copyright (c) 2001 Fabrice Bellard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *) +unit avcodec; + +interface + +uses + windows, avutil, rational, opt; + +const + av__format = 'avformat-50.dll'; + + LIBAVUTIL_VERSION_INT = ((51 shl 16) + (16 shl 8) + 0); + LIBAVUTIL_VERSION = '51.16.0'; + LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; + + AV_NOPTS_VALUE: int64 = $8000000000000000; + AV_TIME_BASE = 1000000; + +type + TCodecID = ( + CODEC_ID_NONE, CODEC_ID_MPEG1VIDEO, + CODEC_ID_MPEG2VIDEO, //* prefered ID for MPEG Video 1 or 2 decoding */ + CODEC_ID_MPEG2VIDEO_XVMC, CODEC_ID_H261, CODEC_ID_H263, CODEC_ID_RV10, + CODEC_ID_RV20, CODEC_ID_MJPEG, CODEC_ID_MJPEGB, CODEC_ID_LJPEG, + CODEC_ID_SP5X, CODEC_ID_JPEGLS, CODEC_ID_MPEG4, CODEC_ID_RAWVIDEO, + CODEC_ID_MSMPEG4V1, CODEC_ID_MSMPEG4V2, CODEC_ID_MSMPEG4V3, + CODEC_ID_WMV1, CODEC_ID_WMV2, CODEC_ID_H263P, + CODEC_ID_H263I, CODEC_ID_FLV1, CODEC_ID_SVQ1, CODEC_ID_SVQ3, + CODEC_ID_DVVIDEO, CODEC_ID_HUFFYUV, CODEC_ID_CYUV, CODEC_ID_H264, + CODEC_ID_INDEO3, CODEC_ID_VP3, CODEC_ID_THEORA, CODEC_ID_ASV1, + CODEC_ID_ASV2, CODEC_ID_FFV1, CODEC_ID_4XM, CODEC_ID_VCR1, + CODEC_ID_CLJR, CODEC_ID_MDEC, CODEC_ID_ROQ, CODEC_ID_INTERPLAY_VIDEO, + CODEC_ID_XAN_WC3, CODEC_ID_XAN_WC4, CODEC_ID_RPZA, CODEC_ID_CINEPAK, + CODEC_ID_WS_VQA, CODEC_ID_MSRLE, CODEC_ID_MSVIDEO1, CODEC_ID_IDCIN, + CODEC_ID_8BPS, CODEC_ID_SMC, CODEC_ID_FLIC, CODEC_ID_TRUEMOTION1, + CODEC_ID_VMDVIDEO, CODEC_ID_MSZH, CODEC_ID_ZLIB, CODEC_ID_QTRLE, + CODEC_ID_SNOW, CODEC_ID_TSCC, CODEC_ID_ULTI, CODEC_ID_QDRAW, + CODEC_ID_VIXL, CODEC_ID_QPEG, CODEC_ID_XVID, CODEC_ID_PNG, + CODEC_ID_PPM, CODEC_ID_PBM, CODEC_ID_PGM, CODEC_ID_PGMYUV, + CODEC_ID_PAM, CODEC_ID_FFVHUFF, CODEC_ID_RV30, CODEC_ID_RV40, + CODEC_ID_VC1, CODEC_ID_WMV3, CODEC_ID_LOCO, CODEC_ID_WNV1, + CODEC_ID_AASC, CODEC_ID_INDEO2, CODEC_ID_FRAPS, CODEC_ID_TRUEMOTION2, + CODEC_ID_BMP, CODEC_ID_CSCD, CODEC_ID_MMVIDEO, CODEC_ID_ZMBV, + CODEC_ID_AVS, CODEC_ID_SMACKVIDEO, CODEC_ID_NUV, CODEC_ID_KMVC, + CODEC_ID_FLASHSV, CODEC_ID_CAVS, CODEC_ID_JPEG2000, CODEC_ID_VMNC, + CODEC_ID_VP5, CODEC_ID_VP6, CODEC_ID_VP6F, + + //* various pcm "codecs" */ + CODEC_ID_PCM_S16LE= $10000, CODEC_ID_PCM_S16BE, CODEC_ID_PCM_U16LE, + CODEC_ID_PCM_U16BE, CODEC_ID_PCM_S8, CODEC_ID_PCM_U8, CODEC_ID_PCM_MULAW, + CODEC_ID_PCM_ALAW, CODEC_ID_PCM_S32LE, CODEC_ID_PCM_S32BE, CODEC_ID_PCM_U32LE, + CODEC_ID_PCM_U32BE, CODEC_ID_PCM_S24LE, CODEC_ID_PCM_S24BE, CODEC_ID_PCM_U24LE, + CODEC_ID_PCM_U24BE, CODEC_ID_PCM_S24DAUD, + //* various adpcm codecs */ + CODEC_ID_ADPCM_IMA_QT= $11000, CODEC_ID_ADPCM_IMA_WAV, CODEC_ID_ADPCM_IMA_DK3, + CODEC_ID_ADPCM_IMA_DK4, CODEC_ID_ADPCM_IMA_WS, CODEC_ID_ADPCM_IMA_SMJPEG, + CODEC_ID_ADPCM_MS, CODEC_ID_ADPCM_4XM, CODEC_ID_ADPCM_XA, CODEC_ID_ADPCM_ADX, + CODEC_ID_ADPCM_EA, CODEC_ID_ADPCM_G726, CODEC_ID_ADPCM_CT, CODEC_ID_ADPCM_SWF, + CODEC_ID_ADPCM_YAMAHA, CODEC_ID_ADPCM_SBPRO_4, CODEC_ID_ADPCM_SBPRO_3, + CODEC_ID_ADPCM_SBPRO_2, + //* AMR */ + CODEC_ID_AMR_NB= $12000, CODEC_ID_AMR_WB, + //* RealAudio codecs*/ + CODEC_ID_RA_144= $13000, CODEC_ID_RA_288, + //* various DPCM codecs */ + CODEC_ID_ROQ_DPCM= $14000, CODEC_ID_INTERPLAY_DPCM, CODEC_ID_XAN_DPCM, + CODEC_ID_SOL_DPCM, CODEC_ID_MP2= $15000, + CODEC_ID_MP3, //* prefered ID for MPEG Audio layer 1, 2 or3 decoding */ + CODEC_ID_AAC, CODEC_ID_MPEG4AAC, CODEC_ID_AC3, CODEC_ID_DTS, CODEC_ID_VORBIS, + CODEC_ID_DVAUDIO, CODEC_ID_WMAV1, CODEC_ID_WMAV2, CODEC_ID_MACE3, + CODEC_ID_MACE6, CODEC_ID_VMDAUDIO, CODEC_ID_SONIC, CODEC_ID_SONIC_LS, + CODEC_ID_FLAC, CODEC_ID_MP3ADU, CODEC_ID_MP3ON4, CODEC_ID_SHORTEN, + CODEC_ID_ALAC, CODEC_ID_WESTWOOD_SND1, CODEC_ID_GSM, CODEC_ID_QDM2, + CODEC_ID_COOK, CODEC_ID_TRUESPEECH, CODEC_ID_TTA, CODEC_ID_SMACKAUDIO, + CODEC_ID_QCELP, CODEC_ID_WAVPACK, + //* subtitle codecs */ + CODEC_ID_DVD_SUBTITLE= $17000, CODEC_ID_DVB_SUBTITLE, + + CODEC_ID_MPEG2TS= $20000 //* _FAKE_ codec to indicate a raw MPEG2 transport + // stream (only used by libavformat) */ + ); + +//* CODEC_ID_MP3LAME is absolete */ +const + CODEC_ID_MP3LAME = CODEC_ID_MP3; + + AVPALETTE_SIZE = 1024; + AVPALETTE_COUNT = 256; + +type + TCodecType = ( + CODEC_TYPE_UNKNOWN = -1, + CODEC_TYPE_VIDEO, + CODEC_TYPE_AUDIO, + CODEC_TYPE_DATA, + CODEC_TYPE_SUBTITLE + ); + +//* currently unused, may be used if 24/32 bits samples ever supported */ +//* all in native endian */ + TSampleFormat = ( + SAMPLE_FMT_NONE = -1, + SAMPLE_FMT_U8, ///< unsigned 8 bits + SAMPLE_FMT_S16, ///< signed 16 bits + SAMPLE_FMT_S24, ///< signed 24 bits + SAMPLE_FMT_S32, ///< signed 32 bits + SAMPLE_FMT_FLT ///< float + ); + +const +//* in bytes */ + AVCODEC_MAX_AUDIO_FRAME_SIZE = 192000; // 1 second of 48khz 32bit audio + +(** + * Required number of additionally allocated bytes at the end of the input bitstream for decoding. + * this is mainly needed because some optimized bitstream readers read + * 32 or 64 bit at once and could read over the end
+ * Note, if the first 23 bits of the additional bytes are not 0 then damaged + * MPEG bitstreams could cause overread and segfault + *) + FF_INPUT_BUFFER_PADDING_SIZE = 8; + +(** + * minimum encoding buffer size. + * used to avoid some checks during header writing + *) + FF_MIN_BUFFER_SIZE = 16384; + +type +//* motion estimation type, EPZS by default */ + TMotion_Est_ID = ( + ME_ZERO = 1, + ME_FULL, + ME_LOG, + ME_PHODS, + ME_EPZS, + ME_X1, + ME_HEX, + ME_UMH, + ME_ITER + ); + + TAVDiscard = ( +//we leave some space between them for extensions (drop some keyframes for intra only or drop just some bidir frames) + AVDISCARD_NONE = -16, ///< discard nothing + AVDISCARD_DEFAULT= 0, ///< discard useless packets like 0 size packets in avi + AVDISCARD_NONREF = 8, ///< discard all non reference + AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames + AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes + AVDISCARD_ALL = 48, ///< discard all + AVDISCARD_FUCK = $FFFFFF + ); + + PRcOverride = ^TRcOverride; + TRcOverride = record {16} + start_frame: integer; + end_frame: integer; + qscale: integer; // if this is 0 then quality_factor will be used instead + quality_factor: single; + end; + +const + FF_MAX_B_FRAMES = 16; + +(* encoding support + these flags can be passed in AVCodecContext.flags before initing + Note: not everything is supported yet. +*) + + CODEC_FLAG_QSCALE = $0002; ///< use fixed qscale + CODEC_FLAG_4MV = $0004; ///< 4 MV per MB allowed / Advanced prediction for H263 + CODEC_FLAG_QPEL = $0010; ///< use qpel MC + CODEC_FLAG_GMC = $0020; ///< use GMC + CODEC_FLAG_MV0 = $0040; ///< always try a MB with MV=<0,0> + CODEC_FLAG_PART = $0080; ///< use data partitioning +//* parent program gurantees that the input for b-frame containing streams is not written to +// for at least s->max_b_frames+1 frames, if this is not set than the input will be copied */ + CODEC_FLAG_INPUT_PRESERVED = $0100; + CODEC_FLAG_PASS1 = $0200; ///< use internal 2pass ratecontrol in first pass mode + CODEC_FLAG_PASS2 = $0400; ///< use internal 2pass ratecontrol in second pass mode + CODEC_FLAG_EXTERN_HUFF = $1000; ///< use external huffman table (for mjpeg) + CODEC_FLAG_GRAY = $2000; ///< only decode/encode grayscale + CODEC_FLAG_EMU_EDGE = $4000; ///< don't draw edges + CODEC_FLAG_PSNR = $8000; ///< error[?] variables will be set during encoding + CODEC_FLAG_TRUNCATED = $00010000; //** input bitstream might be truncated at a random location instead + // of only at frame boundaries */ + CODEC_FLAG_NORMALIZE_AQP = $00020000; ///< normalize adaptive quantization + CODEC_FLAG_INTERLACED_DCT = $00040000; ///< use interlaced dct + CODEC_FLAG_LOW_DELAY = $00080000; ///< force low delay + CODEC_FLAG_ALT_SCAN = $00100000; ///< use alternate scan + CODEC_FLAG_TRELLIS_QUANT = $00200000; ///< use trellis quantization + CODEC_FLAG_GLOBAL_HEADER = $00400000; ///< place global headers in extradata instead of every keyframe + CODEC_FLAG_BITEXACT = $00800000; ///< use only bitexact stuff (except (i)dct) +//* Fx : Flag for h263+ extra options */ + CODEC_FLAG_H263P_AIC = $01000000; ///< H263 Advanced intra coding / MPEG4 AC prediction (remove this) + CODEC_FLAG_AC_PRED = $01000000; ///< H263 Advanced intra coding / MPEG4 AC prediction + CODEC_FLAG_H263P_UMV = $02000000; ///< Unlimited motion vector + CODEC_FLAG_CBP_RD = $04000000; ///< use rate distortion optimization for cbp + CODEC_FLAG_QP_RD = $08000000; ///< use rate distortion optimization for qp selectioon + CODEC_FLAG_H263P_AIV = $00000008; ///< H263 Alternative inter vlc + CODEC_FLAG_OBMC = $00000001; ///< OBMC + CODEC_FLAG_LOOP_FILTER = $00000800; ///< loop filter + CODEC_FLAG_H263P_SLICE_STRUCT = $10000000; + CODEC_FLAG_INTERLACED_ME = $20000000; ///< interlaced motion estimation + CODEC_FLAG_SVCD_SCAN_OFFSET = $40000000; ///< will reserve space for SVCD scan offset user data + CODEC_FLAG_CLOSED_GOP = $80000000; + CODEC_FLAG2_FAST = $00000001; ///< allow non spec compliant speedup tricks + CODEC_FLAG2_STRICT_GOP = $00000002; ///< strictly enforce GOP size + CODEC_FLAG2_NO_OUTPUT = $00000004; ///< skip bitstream encoding + CODEC_FLAG2_LOCAL_HEADER = $00000008; ///< place global headers at every keyframe instead of in extradata + CODEC_FLAG2_BPYRAMID = $00000010; ///< H.264 allow b-frames to be used as references + CODEC_FLAG2_WPRED = $00000020; ///< H.264 weighted biprediction for b-frames + CODEC_FLAG2_MIXED_REFS = $00000040; ///< H.264 multiple references per partition + CODEC_FLAG2_8X8DCT = $00000080; ///< H.264 high profile 8x8 transform + CODEC_FLAG2_FASTPSKIP = $00000100; ///< H.264 fast pskip + CODEC_FLAG2_AUD = $00000200; ///< H.264 access unit delimiters + CODEC_FLAG2_BRDO = $00000400; ///< b-frame rate-distortion optimization + CODEC_FLAG2_INTRA_VLC = $00000800; ///< use MPEG-2 intra VLC table + CODEC_FLAG2_MEMC_ONLY = $00001000; ///< only do ME/MC (I frames -> ref, P frame -> ME+MC) + +(* Unsupported options : + * Syntax Arithmetic coding (SAC) + * Reference Picture Selection + * Independant Segment Decoding */ +/* /Fx */ +/* codec capabilities *) + +const + CODEC_CAP_DRAW_HORIZ_BAND = $001; ///< decoder can use draw_horiz_band callback +(** + * Codec uses get_buffer() for allocating buffers. + * direct rendering method 1 *) + CODEC_CAP_DR1 = $002; +(* if 'parse_only' field is true, then avcodec_parse_frame() can be used *) + CODEC_CAP_PARSE_ONLY = $004; + CODEC_CAP_TRUNCATED = $008; +//* codec can export data for HW decoding (XvMC) */ + CODEC_CAP_HWACCEL = $010; + +(** + * codec has a non zero delay and needs to be feeded with NULL at the end to get the delayed data. + * if this is not set, the codec is guranteed to never be feeded with NULL data *) + CODEC_CAP_DELAY = $0020; +(** + * Codec can be fed a final frame with a smaller size. + * This can be used to prevent truncation of the last audio samples. *) + CODEC_CAP_SMALL_LAST_FRAME = $0040; + +//the following defines may change, don't expect compatibility if you use them + MB_TYPE_INTRA4x4 = $001; + MB_TYPE_INTRA16x16 = $002; //FIXME h264 specific + MB_TYPE_INTRA_PCM = $004; //FIXME h264 specific + MB_TYPE_16x16 = $008; + MB_TYPE_16x8 = $010; + MB_TYPE_8x16 = $020; + MB_TYPE_8x8 = $040; + MB_TYPE_INTERLACED = $080; + MB_TYPE_DIRECT2 = $100; //FIXME + MB_TYPE_ACPRED = $200; + MB_TYPE_GMC = $400; + MB_TYPE_SKIP = $800; + MB_TYPE_P0L0 = $1000; + MB_TYPE_P1L0 = $2000; + MB_TYPE_P0L1 = $4000; + MB_TYPE_P1L1 = $8000; + MB_TYPE_L0 = (MB_TYPE_P0L0 or MB_TYPE_P1L0); + MB_TYPE_L1 = (MB_TYPE_P0L1 or MB_TYPE_P1L1); + MB_TYPE_L0L1 = (MB_TYPE_L0 or MB_TYPE_L1); + MB_TYPE_QUANT = $0010000; + MB_TYPE_CBP = $0020000; +//Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...) + +type +(** + * Pan Scan area. + * this specifies the area which should be displayed. Note there may be multiple such areas for one frame *) + PAVPanScan = ^TAVPanScan; + TAVPanScan = record {24} + (*** id. + * - encoding: set by user. + * - decoding: set by lavc *) + id: integer; + + (*** width and height in 1/16 pel + * - encoding: set by user. + * - decoding: set by lavc *) + width: integer; + height: integer; + + (*** position of the top left corner in 1/16 pel for up to 3 fields/frames. + * - encoding: set by user. + * - decoding: set by lavc *) + position: array [0..2] of array [0..1] of smallint; + end; + +const + FF_QSCALE_TYPE_MPEG1 = 0; + FF_QSCALE_TYPE_MPEG2 = 1; + + FF_BUFFER_TYPE_INTERNAL = 1; + FF_BUFFER_TYPE_USER = 2; ///< Direct rendering buffers (image is (de)allocated by user) + FF_BUFFER_TYPE_SHARED = 4; ///< buffer from somewhere else, don't dealloc image (data/base), all other tables are not shared + FF_BUFFER_TYPE_COPY = 8; ///< just a (modified) copy of some other buffer, don't dealloc anything + + + FF_I_TYPE = 1; // Intra + FF_P_TYPE = 2; // Predicted + FF_B_TYPE = 3; // Bi-dir predicted + FF_S_TYPE = 4; // S(GMC)-VOP MPEG4 + FF_SI_TYPE = 5; + FF_SP_TYPE = 6; + + FF_BUFFER_HINTS_VALID = $01; // Buffer hints value is meaningful (if 0 ignore) + FF_BUFFER_HINTS_READABLE = $02; // Codec will read from buffer + FF_BUFFER_HINTS_PRESERVE = $04; // User must not alter buffer content + FF_BUFFER_HINTS_REUSABLE = $08; // Codec will reuse the buffer (update) + +type + (*** Audio Video Frame. *) + PAVFrame = ^TAVFrame; + TAVFrame = record {200} + (*** pointer to the picture planes. + * this might be different from the first allocated byte *) + data: array [0..3] of pointer; + linesize: array [0..3] of integer; + (*** pointer to the first allocated byte of the picture. can be used in get_buffer/release_buffer + * this isn't used by lavc unless the default get/release_buffer() is used*) + base: array [0..3] of pchar; + (*** 1 -> keyframe, 0-> not *) + key_frame: integer; + (*** picture type of the frame, see ?_TYPE below.*) + pict_type: integer; + (*** presentation timestamp in time_base units (time when frame should be shown to user) + * if AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed*) + pts: int64; + (*** picture number in bitstream order.*) + coded_picture_number: integer; + (*** picture number in display order.*) + display_picture_number: integer; + (*** quality (between 1 (good) and FF_LAMBDA_MAX (bad)) *) + quality: integer; + (*** buffer age (1->was last buffer and dint change, 2->..., ...).*) + age: integer; + (*** is this picture used as reference*) + reference: integer; + (*** QP table*) + qscale_table: pchar; + (*** QP store stride*) + qstride: integer; + (*** mbskip_table[mb]>=1 if MB didnt change*) + mbskip_table: pchar; + (** + * Motion vector table. + * @code + * example: + * int mv_sample_log2= 4 - motion_subsample_log2; + * int mb_width= (width+15)>>4; + * int mv_stride= (mb_width << mv_sample_log2) + 1; + * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y]; + * @endcode + * - encoding: set by user + * - decoding: set by lavc *) + motion_val: array [0..1] of pointer; + (*** Macroblock type table + * mb_type_base + mb_width + 2 *) + mb_type: PCardinal; + (*** log2 of the size of the block which a single vector in motion_val represents: + * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)*) + motion_subsample_log2: byte; + (*** for some private data of the user*) + opaque: pointer; + (*** error*) + error: array [0..3] of int64; + (*** type of the buffer (to keep track of who has to dealloc data[*]) + * Note: user allocated (direct rendering) & internal buffers can not coexist currently*) + _type: integer; + (*** when decoding, this signal how much the picture must be delayed. + * extra_delay = repeat_pict / (2*fps)*) + repeat_pict: integer; + qscale_type: Integer; + (*** The content of the picture is interlaced.*) + interlaced_frame: Integer; + (*** if the content is interlaced, is top field displayed first.*) + top_field_first: integer; + (*** Pan scan.*) + pan_scan: PAVPanScan; + (*** tell user application that palette has changed from previous frame.*) + palette_has_changed: integer; + (*** Codec suggestion on buffer type if != 0 + * - decoding: set by lavc (before get_buffer() call))*) + buffer_hints: integer; + (*** DCT coeffitients*) + dct_coeff: PSmallInt; + (*** Motion referece frame index*) + ref_index: array [0..1] of pchar; + end; + +const + DEFAULT_FRAME_RATE_BASE = 1001000; + + FF_BUG_AUTODETECT = 1; ///< autodetection + FF_BUG_OLD_MSMPEG4 = 2; + FF_BUG_XVID_ILACE = 4; + FF_BUG_UMP4 = 8; + FF_BUG_NO_PADDING = 16; + FF_BUG_AMV = 32; + FF_BUG_AC_VLC = 0; ///< will be removed, libavcodec can now handle these non compliant files by default + FF_BUG_QPEL_CHROMA = 64; + FF_BUG_STD_QPEL = 128; + FF_BUG_QPEL_CHROMA2 = 256; + FF_BUG_DIRECT_BLOCKSIZE = 512; + FF_BUG_EDGE = 1024; + FF_BUG_HPEL_CHROMA = 2048; + FF_BUG_DC_CLIP = 4096; + FF_BUG_MS = 8192; ///< workaround various bugs in microsofts broken decoders + + FF_COMPLIANCE_VERY_STRICT = 2; ///< strictly conform to a older more strict version of the spec or reference software + FF_COMPLIANCE_STRICT = 1; ///< strictly conform to all the things in the spec no matter what consequences + FF_COMPLIANCE_NORMAL = 0; + FF_COMPLIANCE_INOFFICIAL = -1; ///< allow inofficial extensions + FF_COMPLIANCE_EXPERIMENTAL = -2; ///< allow non standarized experimental things + + FF_ER_CAREFUL = 1; + FF_ER_COMPLIANT = 2; + FF_ER_AGGRESSIVE = 3; + FF_ER_VERY_AGGRESSIVE = 4; + + FF_DCT_AUTO = 0; + FF_DCT_FASTINT = 1; + FF_DCT_INT = 2; + FF_DCT_MMX = 3; + FF_DCT_MLIB = 4; + FF_DCT_ALTIVEC = 5; + FF_DCT_FAAN = 6; + + FF_IDCT_AUTO = 0; + FF_IDCT_INT = 1; + FF_IDCT_SIMPLE = 2; + FF_IDCT_SIMPLEMMX = 3; + FF_IDCT_LIBMPEG2MMX = 4; + FF_IDCT_PS2 = 5; + FF_IDCT_MLIB = 6; + FF_IDCT_ARM = 7; + FF_IDCT_ALTIVEC = 8; + FF_IDCT_SH4 = 9; + FF_IDCT_SIMPLEARM = 10; + FF_IDCT_H264 = 11; + FF_IDCT_VP3 = 12; + FF_IDCT_IPP = 13; + FF_IDCT_XVIDMMX = 14; + + FF_EC_GUESS_MVS = 1; + FF_EC_DEBLOCK = 2; + + FF_MM_FORCE = $80000000; (* force usage of selected flags (OR) *) + (* lower 16 bits - CPU features *) + + FF_MM_MMX = $0001; (* standard MMX *) + FF_MM_3DNOW = $0004; (* AMD 3DNOW *) + FF_MM_MMXEXT = $0002; (* SSE integer functions or AMD MMX ext *) + FF_MM_SSE = $0008; (* SSE functions *) + FF_MM_SSE2 = $0010; (* PIV SSE2 functions *) + FF_MM_3DNOWEXT = $0020; (* AMD 3DNowExt *) + FF_MM_IWMMXT = $0100; (* XScale IWMMXT *) + + FF_PRED_LEFT = 0; + FF_PRED_PLANE = 1; + FF_PRED_MEDIAN = 2; + + FF_DEBUG_PICT_INFO = 1; + FF_DEBUG_RC = 2; + FF_DEBUG_BITSTREAM = 4; + FF_DEBUG_MB_TYPE = 8; + FF_DEBUG_QP = 16; + FF_DEBUG_MV = 32; + FF_DEBUG_DCT_COEFF = $00000040; + FF_DEBUG_SKIP = $00000080; + FF_DEBUG_STARTCODE = $00000100; + FF_DEBUG_PTS = $00000200; + FF_DEBUG_ER = $00000400; + FF_DEBUG_MMCO = $00000800; + FF_DEBUG_BUGS = $00001000; + FF_DEBUG_VIS_QP = $00002000; + FF_DEBUG_VIS_MB_TYPE = $00004000; + + FF_DEBUG_VIS_MV_P_FOR = $00000001; //visualize forward predicted MVs of P frames + FF_DEBUG_VIS_MV_B_FOR = $00000002; //visualize forward predicted MVs of B frames + FF_DEBUG_VIS_MV_B_BACK = $00000004; //visualize backward predicted MVs of B frames + + FF_CMP_SAD = 0; + FF_CMP_SSE = 1; + FF_CMP_SATD = 2; + FF_CMP_DCT = 3; + FF_CMP_PSNR = 4; + FF_CMP_BIT = 5; + FF_CMP_RD = 6; + FF_CMP_ZERO = 7; + FF_CMP_VSAD = 8; + FF_CMP_VSSE = 9; + FF_CMP_NSSE = 10; + FF_CMP_W53 = 11; + FF_CMP_W97 = 12; + FF_CMP_DCTMAX = 13; + FF_CMP_CHROMA = 256; + + FF_DTG_AFD_SAME = 8; + FF_DTG_AFD_4_3 = 9; + FF_DTG_AFD_16_9 = 10; + FF_DTG_AFD_14_9 = 11; + FF_DTG_AFD_4_3_SP_14_9 = 13; + FF_DTG_AFD_16_9_SP_14_9 = 14; + FF_DTG_AFD_SP_4_3 = 15; + + FF_DEFAULT_QUANT_BIAS = 999999; + + FF_LAMBDA_SHIFT = 7; + FF_LAMBDA_SCALE = (1 shl FF_LAMBDA_SHIFT); + FF_QP2LAMBDA = 118; ///< factor to convert from H.263 QP to lambda + FF_LAMBDA_MAX = (256 * 128 - 1); + + FF_QUALITY_SCALE = FF_LAMBDA_SCALE; //FIXME maybe remove + + FF_CODER_TYPE_VLC = 0; + FF_CODER_TYPE_AC = 1; + + SLICE_FLAG_CODED_ORDER = $0001; ///< draw_horiz_band() is called in coded order instead of display + SLICE_FLAG_ALLOW_FIELD = $0002; ///< allow draw_horiz_band() with field slices (MPEG2 field pics) + SLICE_FLAG_ALLOW_PLANE = $0004; ///< allow draw_horiz_band() with 1 component at a time (SVQ1) + + FF_MB_DECISION_SIMPLE = 0; ///< uses mb_cmp + FF_MB_DECISION_BITS = 1; ///< chooses the one which needs the fewest bits + FF_MB_DECISION_RD = 2; ///< rate distoration + + FF_AA_AUTO = 0; + FF_AA_FASTINT = 1; //not implemented yet + FF_AA_INT = 2; + FF_AA_FLOAT = 3; + + FF_PROFILE_UNKNOWN = -99; + + FF_LEVEL_UNKNOWN = -99; + + X264_PART_I4X4 = $001; (* Analyse i4x4 *) + X264_PART_I8X8 = $002; (* Analyse i8x8 (requires 8x8 transform) *) + X264_PART_P8X8 = $010; (* Analyse p16x8, p8x16 and p8x8 *) + X264_PART_P4X4 = $020; (* Analyse p8x4, p4x8, p4x4 *) + X264_PART_B8X8 = $100; (* Analyse b16x8, b8x16 and b8x8 *) + +type + PAVCLASS = ^TAVCLASS; + PAVCodecContext = ^TAVCodecContext; + PAVCodec = ^TAVCodec; + PAVPaletteControl = ^TAVPaletteControl; + + TAVCLASS = record {12} + class_name: pchar; + (* actually passing a pointer to an AVCodecContext + or AVFormatContext, which begin with an AVClass. + Needed because av_log is in libavcodec and has no visibility + of AVIn/OutputFormat *) + item_name: function (): pchar; cdecl; + option: PAVOption; + end; + + TAVCodecContext = record {720} + (*** Info on struct for av_log + * - set by avcodec_alloc_context *) + av_class: PAVClass; + (*** the average bitrate. + * - encoding: set by user. unused for constant quantizer encoding + * - decoding: set by lavc. 0 or some bitrate if this info is available in the stream *) + bit_rate: integer; + (*** number of bits the bitstream is allowed to diverge from the reference. + * the reference can be CBR (for CBR pass1) or VBR (for pass2) + * - encoding: set by user. unused for constant quantizer encoding + * - decoding: unused *) + bit_rate_tolerance: integer; + (*** CODEC_FLAG_*. + * - encoding: set by user. + * - decoding: set by user. *) + flags: integer; + (*** some codecs needs additionnal format info. It is stored here + * - encoding: set by user. + * - decoding: set by lavc. (FIXME is this ok?) *) + sub_id: integer; + + (** + * motion estimation algorithm used for video coding. + * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex), + * 8 (umh), 9 (iter) [7, 8 are x264 specific, 9 is snow specific] + * - encoding: MUST be set by user. + * - decoding: unused *) + me_method: integer; + + (** + * some codecs need / can use extra-data like huffman tables. + * mjpeg: huffman tables + * rv10: additional flags + * mpeg4: global headers (they can be in the bitstream or here) + * the allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger + * then extradata_size to avoid prolems if its read with the bitstream reader + * the bytewise contents of extradata must not depend on the architecture or cpu endianness + * - encoding: set/allocated/freed by lavc. + * - decoding: set/allocated/freed by user. + *) + extradata: pointer; + extradata_size: integer; + + (** + * this is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. for fixed-fps content, + * timebase should be 1/framerate and timestamp increments should be + * identically 1. + * - encoding: MUST be set by user + * - decoding: set by lavc. *) + time_base: TAVRational; + + (* video only *) + (*** picture width / height. + * - encoding: MUST be set by user. + * - decoding: set by lavc. + * Note, for compatibility its possible to set this instead of + * coded_width/height before decoding *) + width, height: integer; + (*** the number of pictures in a group of pitures, or 0 for intra_only. + * - encoding: set by user. + * - decoding: unused *) + gop_size: integer; + (*** pixel format, see PIX_FMT_xxx. + * - encoding: set by user. + * - decoding: set by lavc. *) + pix_fmt: TAVPixelFormat; + (*** Frame rate emulation. If not zero lower layer (i.e. format handler) + * has to read frames at native frame rate. + * - encoding: set by user. + * - decoding: unused. *) + rate_emu: integer; + (*** if non NULL, 'draw_horiz_band' is called by the libavcodec + * decoder to draw an horizontal band. It improve cache usage. Not + * all codecs can do that. You must check the codec capabilities + * before + * - encoding: unused + * - decoding: set by user. + * @param height the height of the slice + * @param y the y position of the slice + * @param type 1->top field, 2->bottom field, 3->frame + * @param offset offset into the AVFrame.data from which the slice should be read *) + draw_horiz_band: procedure (s: PAVCodecContext; + const src: PAVFrame; offset: PInteger; + y: integer; _type: integer; height: integer); cdecl; + + (* audio only *) + sample_rate: integer; ///< samples per sec + channels: integer; + (*** audio sample format. + * - encoding: set by user. + * - decoding: set by lavc. *) + sample_fmt: TSampleFormat; ///< sample format, currenly unused + + (* the following data should not be initialized *) + (*** samples per packet. initialized when calling 'init' *) + frame_size: integer; + frame_number: integer; ///< audio or video frame number + real_pict_num: integer; ///< returns the real picture number of previous encoded frame + + (*** number of frames the decoded output will be delayed relative to + * the encoded input. + * - encoding: set by lavc. + * - decoding: unused *) + delay: integer; + + (* - encoding parameters *) + qcompress: single; ///< amount of qscale change between easy & hard scenes (0.0-1.0) + qblur: single; ///< amount of qscale smoothing over time (0.0-1.0) + + (*** minimum quantizer. + * - encoding: set by user. + * - decoding: unused *) + qmin: integer; + + (*** maximum quantizer. + * - encoding: set by user. + * - decoding: unused *) + qmax: integer; + + (*** maximum quantizer difference etween frames. + * - encoding: set by user. + * - decoding: unused *) + max_qdiff: integer; + + (*** maximum number of b frames between non b frames. + * note: the output will be delayed by max_b_frames+1 relative to the input + * - encoding: set by user. + * - decoding: unused *) + max_b_frames: integer; + + (*** qscale factor between ip and b frames. + * - encoding: set by user. + * - decoding: unused *) + b_quant_factor: single; + + (** obsolete FIXME remove *) + rc_strategy: integer; + b_frame_strategy: integer; + + (*** hurry up amount. + * deprecated in favor of skip_idct and skip_frame + * - encoding: unused + * - decoding: set by user. 1-> skip b frames, 2-> skip idct/dequant too, 5-> skip everything except header *) + hurry_up: integer; + + codec: PAVCodec; + + priv_data: pointer; + + (* unused, FIXME remove*) + rtp_mode: integer; + + rtp_payload_size: integer; (* The size of the RTP payload: the coder will *) + (* do it's best to deliver a chunk with size *) + (* below rtp_payload_size, the chunk will start *) + (* with a start code on some codecs like H.263 *) + (* This doesn't take account of any particular *) + (* headers inside the transmited RTP payload *) + + + (* The RTP callback: This function is called *) + (* every time the encoder has a packet to send *) + (* Depends on the encoder if the data starts *) + (* with a Start Code (it should) H.263 does. *) + (* mb_nb contains the number of macroblocks *) + (* encoded in the RTP payload *) + rtp_callback: procedure (avctx: PAVCodecContext; data: pointer; + size: integer; mb_nb: integer); cdecl; + + (* statistics, used for 2-pass encoding *) + mv_bits: integer; + header_bits: integer; + i_tex_bits: integer; + p_tex_bits: integer; + i_count: integer; + p_count: integer; + skip_count: integer; + misc_bits: integer; + + (*** number of bits used for the previously encoded frame. + * - encoding: set by lavc + * - decoding: unused *) + frame_bits: integer; + + (*** private data of the user, can be used to carry app specific stuff. + * - encoding: set by user + * - decoding: set by user *) + opaque: pointer; + + codec_name: array [0..31] of char; + codec_type: TCodecType; (* see CODEC_TYPE_xxx *) + codec_id: TCodecID; (* see CODEC_ID_xxx *) + + (*** fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). + * this is used to workaround some encoder bugs + * - encoding: set by user, if not then the default based on codec_id will be used + * - decoding: set by user, will be converted to upper case by lavc during init *) +// codec_tag: cardinal; // ìîæíî array [0..3] of char - òîãäà âèäíî FOURCC + codec_tag: array [0..3] of char; + + (*** workaround bugs in encoders which sometimes cannot be detected automatically. + * - encoding: set by user + * - decoding: set by user *) + workaround_bugs: integer; + + (*** luma single coeff elimination threshold. + * - encoding: set by user + * - decoding: unused *) + luma_elim_threshold: integer; + + (*** chroma single coeff elimination threshold. + * - encoding: set by user + * - decoding: unused *) + chroma_elim_threshold: integer; + + (*** strictly follow the std (MPEG4, ...). + * - encoding: set by user + * - decoding: unused *) + strict_std_compliance: integer; + + (*** qscale offset between ip and b frames. + * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset) + * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset) + * - encoding: set by user. + * - decoding: unused *) + b_quant_offset: single; + + (*** error resilience higher values will detect more errors but may missdetect + * some more or less valid parts as errors. + * - encoding: unused + * - decoding: set by user *) + error_resilience: integer; + + (*** called at the beginning of each frame to get a buffer for it. + * if pic.reference is set then the frame will be read later by lavc + * avcodec_align_dimensions() should be used to find the required width and + * height, as they normally need to be rounded up to the next multiple of 16 + * - encoding: unused + * - decoding: set by lavc, user can override *) + get_buffer: function (c: PAVCodecContext; pic: PAVFrame): integer; cdecl; + + (*** called to release buffers which where allocated with get_buffer. + * a released buffer can be reused in get_buffer() + * pic.data[*] must be set to NULL + * - encoding: unused + * - decoding: set by lavc, user can override *) + release_buffer: procedure (c: PAVCodecContext; pic: PAVFrame); cdecl; + + (*** if 1 the stream has a 1 frame delay during decoding. + * - encoding: set by lavc + * - decoding: set by lavc *) + has_b_frames: integer; + + (*** number of bytes per packet if constant and known or 0 + * used by some WAV based audio codecs *) + block_align: integer; + + parse_only: integer; (* - decoding only: if true, only parsing is done + (function avcodec_parse_frame()). The frame + data is returned. Only MPEG codecs support this now. *) + + (*** 0-> h263 quant 1-> mpeg quant. + * - encoding: set by user. + * - decoding: unused *) + mpeg_quant: integer; + + (*** pass1 encoding statistics output buffer. + * - encoding: set by lavc + * - decoding: unused *) + stats_out: pchar; + + (*** pass2 encoding statistics input buffer. + * concatenated stuff from stats_out of pass1 should be placed here + * - encoding: allocated/set/freed by user + * - decoding: unused *) + stats_in: pchar; + + (*** ratecontrol qmin qmax limiting method. + * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax + * - encoding: set by user. + * - decoding: unused *) + rc_qsquish: single; + + rc_qmod_amp: single; + rc_qmod_freq: integer; + + (*** ratecontrol override, see RcOverride. + * - encoding: allocated/set/freed by user. + * - decoding: unused *) + rc_override: PRcOverride; + rc_override_count: integer; + + (*** rate control equation. + * - encoding: set by user + * - decoding: unused *) + rc_eq: pchar; + + (*** maximum bitrate. + * - encoding: set by user. + * - decoding: unused *) + rc_max_rate: integer; + + (*** minimum bitrate. + * - encoding: set by user. + * - decoding: unused *) + rc_min_rate: integer; + + (*** decoder bitstream buffer size. + * - encoding: set by user. + * - decoding: unused *) + rc_buffer_size: integer; + rc_buffer_aggressivity: single; + + (*** qscale factor between p and i frames. + * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset) + * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset) + * - encoding: set by user. + * - decoding: unused *) + i_quant_factor: single; + + (*** qscale offset between p and i frames. + * - encoding: set by user. + * - decoding: unused *) + i_quant_offset: single; + + (*** initial complexity for pass1 ratecontrol. + * - encoding: set by user. + * - decoding: unused *) + rc_initial_cplx: single; + + (*** dct algorithm, see FF_DCT_* below. + * - encoding: set by user + * - decoding: unused *) + dct_algo: integer; + + (*** luminance masking (0-> disabled). + * - encoding: set by user + * - decoding: unused *) + lumi_masking: single; + + (*** temporary complexity masking (0-> disabled). + * - encoding: set by user + * - decoding: unused *) + temporal_cplx_masking: single; + + (*** spatial complexity masking (0-> disabled). + * - encoding: set by user + * - decoding: unused *) + spatial_cplx_masking: single; + + (** * p block masking (0-> disabled). + * - encoding: set by user + * - decoding: unused *) + p_masking: single; + + (*** darkness masking (0-> disabled). + * - encoding: set by user + * - decoding: unused *) + dark_masking: single; + + (* for binary compatibility *) + unused: integer; + + (*** idct algorithm, see FF_IDCT_* below. + * - encoding: set by user + * - decoding: set by user *) + idct_algo: integer; + + (*** slice count. + * - encoding: set by lavc + * - decoding: set by user (or 0) *) + slice_count: integer; + + (*** slice offsets in the frame in bytes. + * - encoding: set/allocated by lavc + * - decoding: set/allocated by user (or NULL) *) + slice_offset: PInteger; + + (*** error concealment flags. + * - encoding: unused + * - decoding: set by user *) + error_concealment: integer; + + (*** dsp_mask could be add used to disable unwanted CPU features + * CPU features (i.e. MMX, SSE. ...) + * + * with FORCE flag you may instead enable given CPU features + * (Dangerous: usable in case of misdetection, improper usage however will + * result into program crash) *) + dsp_mask: cardinal; + + (*** bits per sample/pixel from the demuxer (needed for huffyuv). + * - encoding: set by lavc + * - decoding: set by user *) + bits_per_sample: integer; + + (*** prediction method (needed for huffyuv). + * - encoding: set by user + * - decoding: unused *) + prediction_method: integer; + + (*** sample aspect ratio (0 if unknown). + * numerator and denominator must be relative prime and smaller then 256 for some video standards + * - encoding: set by user. + * - decoding: set by lavc. *) + sample_aspect_ratio: TAVRational; + + (*** the picture in the bitstream. + * - encoding: set by lavc + * - decoding: set by lavc *) + coded_frame: PAVFrame; + + (*** debug. + * - encoding: set by user. + * - decoding: set by user. *) + debug: integer; + + (*** debug. + * - encoding: set by user. + * - decoding: set by user. *) + debug_mv: integer; + + (** error. + * - encoding: set by lavc if flags&CODEC_FLAG_PSNR + * - decoding: unused *) + error: array [0..3] of int64; + + (*** minimum MB quantizer. + * - encoding: unused + * - decoding: unused *) + mb_qmin: integer; + + (*** maximum MB quantizer. + * - encoding: unused + * - decoding: unused *) + mb_qmax: integer; + + (*** motion estimation compare function. + * - encoding: set by user. + * - decoding: unused *) + me_cmp: integer; + + (*** subpixel motion estimation compare function. + * - encoding: set by user. + * - decoding: unused *) + me_sub_cmp: integer; + (*** macroblock compare function (not supported yet). + * - encoding: set by user. + * - decoding: unused *) + mb_cmp: integer; + (*** interlaced dct compare function + * - encoding: set by user. + * - decoding: unused *) + ildct_cmp: integer; + (*** ME diamond size & shape. + * - encoding: set by user. + * - decoding: unused *) + dia_size: integer; + + (*** amount of previous MV predictors (2a+1 x 2a+1 square). + * - encoding: set by user. + * - decoding: unused *) + last_predictor_count: integer; + + (*** pre pass for motion estimation. + * - encoding: set by user. + * - decoding: unused *) + pre_me: integer; + + (*** motion estimation pre pass compare function. + * - encoding: set by user. + * - decoding: unused *) + me_pre_cmp: integer; + + (*** ME pre pass diamond size & shape. + * - encoding: set by user. + * - decoding: unused *) + pre_dia_size: integer; + + (*** subpel ME quality. + * - encoding: set by user. + * - decoding: unused *) + me_subpel_quality: integer; + + (*** callback to negotiate the pixelFormat. + * @param fmt is the list of formats which are supported by the codec, + * its terminated by -1 as 0 is a valid format, the formats are ordered by quality + * the first is allways the native one + * @return the choosen format + * - encoding: unused + * - decoding: set by user, if not set then the native format will always be choosen + *) + get_format: function (s: PAVCodecContext; const fmt: PAVPixelFormat): TAVPixelFormat; cdecl; + + (*** DTG active format information (additionnal aspect ratio + * information only used in DVB MPEG2 transport streams). 0 if + * not set. + * - encoding: unused. + * - decoding: set by decoder *) + dtg_active_format: integer; + + (*** Maximum motion estimation search range in subpel units. + * if 0 then no limit + * - encoding: set by user. + * - decoding: unused. *) + me_range: integer; + + (*** intra quantizer bias. + * - encoding: set by user. + * - decoding: unused *) + intra_quant_bias: integer; + + (*** inter quantizer bias. + * - encoding: set by user. + * - decoding: unused *) + inter_quant_bias: integer; + + (*** color table ID. + * - encoding: unused. + * - decoding: which clrtable should be used for 8bit RGB images + * table have to be stored somewhere FIXME *) + color_table_id: integer; + + (*** internal_buffer count. + * Don't touch, used by lavc default_get_buffer() *) + internal_buffer_count: integer; + + (*** internal_buffers. + * Don't touch, used by lavc default_get_buffer() *) + internal_buffer: pointer; + + (*** global quality for codecs which cannot change it per frame. + * this should be proportional to MPEG1/2/4 qscale. + * - encoding: set by user. + * - decoding: unused *) + global_quality: integer; + + (*** coder type + * - encoding: set by user. + * - decoding: unused *) + coder_type: integer; + + (*** context model + * - encoding: set by user. + * - decoding: unused *) + context_model: integer; + + (*** slice flags + * - encoding: unused + * - decoding: set by user. *) + slice_flags: integer; + + (*** XVideo Motion Acceleration + * - encoding: forbidden + * - decoding: set by decoder *) + xvmc_acceleration: integer; + + (*** macroblock decision mode + * - encoding: set by user. + * - decoding: unused *) + mb_decision: integer; + + (*** custom intra quantization matrix + * - encoding: set by user, can be NULL + * - decoding: set by lavc *) + intra_matrix: Pword; + + (*** custom inter quantization matrix + * - encoding: set by user, can be NULL + * - decoding: set by lavc *) + inter_matrix: Pword; + + (*** fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). + * this is used to workaround some encoder bugs + * - encoding: unused + * - decoding: set by user, will be converted to upper case by lavc during init *) + stream_codec_tag: array [0..3] of char; //cardinal; + + (*** scene change detection threshold. + * 0 is default, larger means fewer detected scene changes + * - encoding: set by user. + * - decoding: unused *) + scenechange_threshold: integer; + + (*** minimum lagrange multipler + * - encoding: set by user. + * - decoding: unused *) + lmin: integer; + + (*** maximum lagrange multipler + * - encoding: set by user. + * - decoding: unused *) + lmax: integer; + + (*** Palette control structure + * - encoding: ??? (no palette-enabled encoder yet) + * - decoding: set by user. *) + palctrl: PAVPaletteControl; + + (*** noise reduction strength + * - encoding: set by user. + * - decoding: unused *) + noise_reduction: integer; + + (*** called at the beginning of a frame to get cr buffer for it. + * buffer type (size, hints) must be the same. lavc won't check it. + * lavc will pass previous buffer in pic, function should return + * same buffer or new buffer with old frame "painted" into it. + * if pic.data[0] == NULL must behave like get_buffer(). + * - encoding: unused + * - decoding: set by lavc, user can override *) + reget_buffer: function (c: PAVCodecContext; pic: PAVFrame): integer; cdecl; + + (*** number of bits which should be loaded into the rc buffer before decoding starts + * - encoding: set by user. + * - decoding: unused *) + rc_initial_buffer_occupancy: integer; + inter_threshold: integer; + + (*** CODEC_FLAG2_*. + * - encoding: set by user. + * - decoding: set by user. *) + flags2: integer; + + (*** simulates errors in the bitstream to test error concealment. + * - encoding: set by user. + * - decoding: unused. *) + error_rate: integer; + + (*** MP3 antialias algorithm, see FF_AA_* below. + * - encoding: unused + * - decoding: set by user *) + antialias_algo: integer; + + (*** Quantizer noise shaping. + * - encoding: set by user + * - decoding: unused *) + quantizer_noise_shaping: integer; + + (*** Thread count. + * is used to decide how many independant tasks should be passed to execute() + * - encoding: set by user + * - decoding: set by user *) + thread_count: integer; + + (*** the codec may call this to execute several independant things. it will return only after + * finishing all tasks, the user may replace this with some multithreaded implementation, the + * default implementation will execute the parts serially + * @param count the number of things to execute + * - encoding: set by lavc, user can override + * - decoding: set by lavc, user can override *) + execute: function (c: PAVCodecContext; func: pointer; arg: PPointer; ret: PInteger; count: integer): integer; cdecl; + + (*** Thread opaque. + * can be used by execute() to store some per AVCodecContext stuff. + * - encoding: set by execute() + * - decoding: set by execute() *) + thread_opaque: pointer; + + (*** Motion estimation threshold. under which no motion estimation is + * performed, but instead the user specified motion vectors are used + * - encoding: set by user + * - decoding: unused *) + me_threshold: integer; + + (*** Macroblock threshold. under which the user specified macroblock types will be used + * - encoding: set by user + * - decoding: unused *) + mb_threshold: integer; + + (*** precision of the intra dc coefficient - 8. + * - encoding: set by user + * - decoding: unused *) + intra_dc_precision: integer; + + (*** noise vs. sse weight for the nsse comparsion function. + * - encoding: set by user + * - decoding: unused *) + nsse_weight: integer; + + (*** number of macroblock rows at the top which are skipped. + * - encoding: unused + * - decoding: set by user *) + skip_top: integer; + + (*** number of macroblock rows at the bottom which are skipped. + * - encoding: unused + * - decoding: set by user *) + skip_bottom: integer; + + (*** profile + * - encoding: set by user + * - decoding: set by lavc *) + profile: integer; + + (*** level + * - encoding: set by user + * - decoding: set by lavc *) + level: integer; + + (*** low resolution decoding. 1-> 1/2 size, 2->1/4 size + * - encoding: unused + * - decoding: set by user *) + lowres: integer; + + (*** bitsream width / height. may be different from width/height if lowres + * or other things are used + * - encoding: unused + * - decoding: set by user before init if known, codec should override / dynamically change if needed *) + coded_width, coded_height: integer; + + (*** frame skip threshold + * - encoding: set by user + * - decoding: unused *) + frame_skip_threshold: integer; + + (*** frame skip factor + * - encoding: set by user + * - decoding: unused *) + frame_skip_factor: integer; + + (*** frame skip exponent + * - encoding: set by user + * - decoding: unused *) + frame_skip_exp: integer; + + (*** frame skip comparission function + * - encoding: set by user. + * - decoding: unused *) + frame_skip_cmp: integer; + + (*** border processing masking. raises the quantizer for mbs on the borders + * of the picture. + * - encoding: set by user + * - decoding: unused *) + border_masking: single; + + (*** minimum MB lagrange multipler. + * - encoding: set by user. + * - decoding: unused *) + mb_lmin: integer; + + (*** maximum MB lagrange multipler. + * - encoding: set by user. + * - decoding: unused *) + mb_lmax: integer; + + (*** + * - encoding: set by user. + * - decoding: unused *) + me_penalty_compensation: integer; + + (*** + * - encoding: unused + * - decoding: set by user. *) + skip_loop_filter: TAVDiscard; + + (** * + * - encoding: unused + * - decoding: set by user. *) + skip_idct: TAVDiscard; + + (** * + * - encoding: unused + * - decoding: set by user. *) + skip_frame: TAVDiscard; + + (** * + * - encoding: set by user. + * - decoding: unused *) + bidir_refine: integer; + + (** * + * - encoding: set by user. + * - decoding: unused *) + brd_scale: integer; + + (** + * constant rate factor - quality-based VBR - values ~correspond to qps + * - encoding: set by user. + * - decoding: unused *) + crf: integer; + + (** + * constant quantization parameter rate control method + * - encoding: set by user. + * - decoding: unused *) + cqp: integer; + + (** + * minimum gop size + * - encoding: set by user. + * - decoding: unused *) + keyint_min: integer; + + (** + * number of reference frames + * - encoding: set by user. + * - decoding: unused *) + refs: integer; + + (** + * chroma qp offset from luma + * - encoding: set by user. + * - decoding: unused *) + chromaoffset: integer; + + (** + * influences how often b-frames are used + * - encoding: set by user. + * - decoding: unused *) + bframebias: integer; + + (** + * trellis RD quantization + * - encoding: set by user. + * - decoding: unused *) + trellis: integer; + + (** + * reduce fluctuations in qp (before curve compression) + * - encoding: set by user. + * - decoding: unused *) + complexityblur: single; + + (** + * in-loop deblocking filter alphac0 parameter + * alpha is in the range -6...6 + * - encoding: set by user. + * - decoding: unused *) + deblockalpha: integer; + + (** + * in-loop deblocking filter beta parameter + * beta is in the range -6...6 + * - encoding: set by user. + * - decoding: unused *) + deblockbeta: integer; + + (** + * macroblock subpartition sizes to consider - p8x8, p4x4, b8x8, i8x8, i4x4 + * - encoding: set by user. + * - decoding: unused *) + partitions: integer; + + (** + * direct mv prediction mode - 0 (none), 1 (spatial), 2 (temporal) + * - encoding: set by user. + * - decoding: unused *) + directpred: integer; + + (** + * audio cutoff bandwidth (0 means "automatic") . Currently used only by FAAC + * - encoding: set by user. + * - decoding: unused *) + cutoff: integer; + + (** + * multiplied by qscale for each frame and added to scene_change_score + * - encoding: set by user. + * - decoding: unused *) + scenechange_factor: integer; + + (** * + * note: value depends upon the compare functin used for fullpel ME + * - encoding: set by user. + * - decoding: unused *) + mv0_threshold: integer; + + (** + * adjusts sensitivity of b_frame_strategy 1 + * - encoding: set by user. + * - decoding: unused *) + b_sensitivity: integer; + + (** + * - encoding: set by user. + * - decoding: unused *) + compression_level: integer; + + (** + * sets whether to use LPC mode - used by FLAC encoder + * - encoding: set by user. + * - decoding: unused. *) + use_lpc: integer; + + (** + * LPC coefficient precision - used by FLAC encoder + * - encoding: set by user. + * - decoding: unused. *) + lpc_coeff_precision: integer; + + (** + * - encoding: set by user. + * - decoding: unused. *) + min_prediction_order: integer; + + (** + * - encoding: set by user. + * - decoding: unused. *) + max_prediction_order: integer; + + (** + * search method for selecting prediction order + * - encoding: set by user. + * - decoding: unused. *) + prediction_order_method: integer; + + (** + * - encoding: set by user. + * - decoding: unused. *) + min_partition_order: integer; + + (** + * - encoding: set by user. + * - decoding: unused. *) + max_partition_order: integer; + end; + +(** + * AVCodec. + *) + TAVCodec = record + name: pchar; + _type: TCodecType; + id: TCodecID; + priv_data_size: integer; + init: function (avctx: pAVCodecContext): integer; cdecl; + encode: function (avctx: PAVCodecContext; buf: pchar; buf_size: integer; data: pointer): integer; cdecl; + close: function (avctx: PAVCodecContext): integer; cdecl; + decode: function (avctx: PAVCodecContext; outdata: pointer; outdata_size: PInteger; + buf: pchar; buf_size: integer): integer; cdecl; + capabilities: integer; +// todo: check this -> +// void *dummy; // FIXME remove next time we break binary compatibility + next: PAVCodec; + flush: procedure (avctx: PAVCodecContext); cdecl; + supported_framerates: PAVRational; ///array of supported framerates, or NULL if any, array is terminated by {0,0} + pix_fmts: PAVPixelFormat; ///array of supported pixel formats, or NULL if unknown, array is terminanted by -1 + end; + +(** + * four components are given, that's all. + * the last component is alpha + *) + PAVPicture = ^TAVPicture; + TAVPicture = record + data: array [0..3] of pchar; + linesize: array [0..3] of integer; ///< number of bytes per line + end; + +(** + * AVPaletteControl + * This structure defines a method for communicating palette changes + * between and demuxer and a decoder. + * this is totally broken, palette changes should be sent as AVPackets + *) + TAVPaletteControl = record + (* demuxer sets this to 1 to indicate the palette has changed; + * decoder resets to 0 *) + palette_changed: integer; + + (* 4-byte ARGB palette entries, stored in native byte order; note that + * the individual palette components should be on a 8-bit scale; if + * the palette data comes from a IBM VGA native format, the component + * data is probably 6 bits in size and needs to be scaled *) + palette: array [0..AVPALETTE_COUNT - 1] of cardinal; + end; + + PAVSubtitleRect = ^TAVSubtitleRect; + TAVSubtitleRect = record + x: word; + y: word; + w: word; + h: word; + nb_colors: word; + linesize: integer; + rgba_palette: PCardinal; + bitmap: pchar; + end; + + PAVSubtitle = ^TAVSubtitle; + TAVSubtitle = record {20} + format: word; (* 0 = graphics *) + start_display_time: cardinal; (* relative to packet pts, in ms *) + end_display_time: cardinal; (* relative to packet pts, in ms *) + num_rects: cardinal; + rects: PAVSubtitleRect; + end; + + +(* resample.c *) + + PReSampleContext = pointer; + PAVResampleContext = pointer; + PImgReSampleContext = pointer; + +function audio_resample_init (output_channels: integer; input_channels: integer; + output_rate: integer; input_rate: integer): PReSampleContext; + cdecl; external av__codec; + +function audio_resample (s: PReSampleContext; output: PWord; input: PWord; nb_samples: integer): integer; + cdecl; external av__codec; + +procedure audio_resample_close (s: PReSampleContext); + cdecl; external av__codec; + + +function av_resample_init (out_rate: integer; in_rate: integer; filter_length: integer; + log2_phase_count: integer; linear: integer; cutoff: double): PAVResampleContext; + cdecl; external av__codec; + +function av_resample (c: PAVResampleContext; dst: PWord; src: PWord; consumed: PInteger; + src_size: integer; dst_size: integer; update_ctx: integer): integer; + cdecl; external av__codec; + +procedure av_resample_compensate (c: PAVResampleContext; sample_delta: integer; + compensation_distance: integer); + cdecl; external av__codec; + +procedure av_resample_close (c: PAVResampleContext); + cdecl; external av__codec; + + +(* YUV420 format is assumed ! *) + + function img_resample_init (output_width: integer; output_height: integer; + input_width: integer; input_height: integer): PImgReSampleContext; + cdecl; external av__codec; + + function img_resample_full_init (owidth: integer; oheight: integer; + iwidth: integer; iheight: integer; + topBand: integer; bottomBand: integer; + leftBand: integer; rightBand: integer; + padtop: integer; padbottom: integer; + padleft: integer; padright: integer): PImgReSampleContext; + cdecl; external av__codec; + + procedure img_resample (s: PImgReSampleContext; output: PAVPicture; const input: PAVPicture); + cdecl; external av__codec; + + procedure img_resample_close (s: PImgReSampleContext); + cdecl; external av__codec; + +(** + * Allocate memory for a picture. Call avpicture_free to free it. + * + * @param picture the picture to be filled in. + * @param pix_fmt the format of the picture. + * @param width the width of the picture. + * @param height the height of the picture. + * @return 0 if successful, -1 if not. + *) + function avpicture_alloc (picture: PAVPicture; pix_fmt: TAVPixelFormat; + width: integer; height: integer): integer; + cdecl; external av__codec; + + +(* Free a picture previously allocated by avpicture_alloc. *) + procedure avpicture_free (picture: PAVPicture); + cdecl; external av__codec; + + function avpicture_fill (picture: PAVPicture; ptr: pointer; + pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; + cdecl; external av__codec; + + function avpicture_layout (const src: PAVPicture; pix_fmt: TAVPixelFormat; + width: integer; height: integer; + dest: pchar; dest_size: integer): integer; + cdecl; external av__codec; + + function avpicture_get_size (pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; + cdecl; external av__codec; + + procedure avcodec_get_chroma_sub_sample (pix_fmt: TAVPixelFormat; h_shift: Pinteger; v_shift: pinteger); + cdecl; external av__codec; + + function avcodec_get_pix_fmt_name(pix_fmt: TAVPixelFormat): pchar; + cdecl; external av__codec; + + procedure avcodec_set_dimensions(s: PAVCodecContext; width: integer; height: integer); + cdecl; external av__codec; + + function avcodec_get_pix_fmt(const name: pchar): TAVPixelFormat; + cdecl; external av__codec; + + function avcodec_pix_fmt_to_codec_tag(p: TAVPixelFormat): cardinal; + cdecl; external av__codec; + + function avcodec_get_pix_fmt_loss (dst_pix_fmt: TAVPixelFormat; src_pix_fmt: TAVPixelFormat; + has_alpha: integer): integer; + cdecl; external av__codec; + + function avcodec_find_best_pix_fmt (pix_fmt_mask: integer; src_pix_fmt: TAVPixelFormat; + has_alpha: integer; loss_ptr: pinteger): integer; + cdecl; external av__codec; + + function img_get_alpha_info (const src: PAVPicture; + pix_fmt: TAVPixelFormat; + width: integer; height: integer): integer; + cdecl; external av__codec; + + +(* convert among pixel formats *) + function img_convert (dst: PAVPicture; dst_pix_fmt: TAVPixelFormat; + const src: PAVPicture; pix_fmt: TAVPixelFormat; + width: integer; height: integer): integer; + cdecl; external av__codec; + +(* deinterlace a picture *) + function avpicture_deinterlace (dst: PAVPicture; const src: PAVPicture; + pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; + cdecl; external av__codec; + +(* returns LIBAVCODEC_VERSION_INT constant *) + function avcodec_version (): cardinal; + cdecl; external av__codec; + +(* returns LIBAVCODEC_BUILD constant *) + function avcodec_build (): cardinal; + cdecl; external av__codec; + + procedure avcodec_init (); + cdecl; external av__codec; + + procedure register_avcodec (format: PAVCodec); + cdecl; external av__codec; + + function avcodec_find_encoder (id: TCodecID): PAVCodec; + cdecl; external av__codec; + function avcodec_find_encoder_by_name (name: pchar): PAVCodec; + cdecl; external av__codec; + function avcodec_find_decoder(id: TCodecID): PAVCodec; + cdecl; external av__codec; + function avcodec_find_decoder_by_name (name: pchar): PAVCodec; + cdecl; external av__codec; + procedure avcodec_string(buf: pchar; buf_size: integer; enc: PAVCodecContext; encode: integer); + cdecl; external av__codec; + + procedure avcodec_get_context_defaults (s: PAVCodecContext); + cdecl; external av__codec; + function avcodec_alloc_context (): PAVCodecContext; + cdecl; external av__codec; + procedure avcodec_get_frame_defaults (pic: PAVFrame); + cdecl; external av__codec; + function avcodec_alloc_frame (): PAVFrame; + cdecl; external av__codec; + + function avcodec_default_get_buffer (s: PAVCodecContext; pic: PAVFrame): integer; + cdecl; external av__codec; + procedure avcodec_default_release_buffer (s: PAVCodecContext; pic: PAVFrame); + cdecl; external av__codec; + function avcodec_default_reget_buffer (s: PAVCodecContext; pic: PAVFrame): integer; + cdecl; external av__codec; + procedure avcodec_align_dimensions(s: PAVCodecContext; width: Pinteger; height: PInteger); + cdecl; external av__codec; + function avcodec_check_dimensions (av_log_ctx: pointer; w: cardinal; h: cardinal): integer; + cdecl; external av__codec; + function avcodec_default_get_format(s: PAVCodecContext; const fmt: PAVPixelFormat): TAVPixelFormat; + cdecl; external av__codec; + + function avcodec_thread_init (s: PAVCodecContext; thread_count: integer): integer; + cdecl; external av__codec; + procedure avcodec_thread_free (s: PAVCodecContext); + cdecl; external av__codec; + function avcodec_thread_execute (s: PAVCodecContext; func: pointer; arg: PPointer; ret: Pinteger; count: integer): integer; + cdecl; external av__codec; + function avcodec_default_execute (s: PAVCodecContext; func: pointer; arg: PPointer; ret: Pinteger; count: integer): integer; + cdecl; external av__codec; + + +//FIXME func typedef + +(** + * opens / inits the AVCodecContext. + * not thread save! + *) + function avcodec_open (avctx: PAVCodecContext; codec: PAVCodec): integer; + cdecl; external av__codec; + + +(** + * Decode an audio frame. + * + * @param avctx the codec context. + * @param samples output buffer, 16 byte aligned + * @param frame_size_ptr the output buffer size in bytes, zero if no frame could be compressed + * @param buf input buffer, 16 byte aligned + * @param buf_size the input buffer size + * @return 0 if successful, -1 if not. + *) + + function avcodec_decode_audio (avctx: PAVCodecContext; samples: Pword; + frame_size_ptr: pinteger; + buf: pchar; buf_size: integer): integer; + cdecl; external av__codec; +(* decode a frame. + * @param buf bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE larger then the actual read bytes + * because some optimized bitstream readers read 32 or 64 bit at once and could read over the end + * @param buf_size the size of the buffer in bytes + * @param got_picture_ptr zero if no frame could be decompressed, Otherwise, it is non zero + * @return -1 if error, otherwise return the number of + * bytes used. *) + function avcodec_decode_video (avctx: PAVCodecContext; picture: PAVFrame; + got_picture_ptr: pinteger; + buf: PByte; buf_size: integer): integer; + cdecl; external av__codec; + + function avcodec_decode_subtitle (avctx: PAVCodecContext; sub: PAVSubtitle; + got_sub_ptr: pinteger; + const buf: pchar; buf_size: integer): integer; + cdecl; external av__codec; + function avcodec_parse_frame (avctx: PAVCodecContext; pdata: PPointer; + data_size_ptr: pinteger; + buf: pchar; buf_size: integer): integer; + cdecl; external av__codec; + + function avcodec_encode_audio (avctx: PAVCodecContext; buf: PByte; + buf_size: integer; const samples: Pword): integer; + cdecl; external av__codec; + + (* avcodec_encode_video: -1 if error *) + function avcodec_encode_video (avctx: PAVCodecContext; buf: pointer; + buf_size: integer; pict: PAVFrame): integer; + cdecl; external av__codec; + function avcodec_encode_subtitle (avctx: PAVCodecContext; buf: pchar; + buf_size: integer; const sub: PAVSubtitle): integer; + cdecl; external av__codec; + function avcodec_close (avctx: PAVCodecContext): integer; + cdecl; external av__codec; + + procedure avcodec_register_all (); + cdecl; external av__codec; + + procedure avcodec_flush_buffers (avctx: PAVCodecContext); + cdecl; external av__codec; + procedure avcodec_default_free_buffers (s: PAVCodecContext); + cdecl; external av__codec; + +(* misc usefull functions *) + +(** + * returns a single letter to describe the picture type + *) + function av_get_pict_type_char (pict_type: integer): char; + cdecl; external av__codec; + + +(** + * returns codec bits per sample + *) +function av_get_bits_per_sample (codec_id: TCodecID): integer; + cdecl; external av__codec; + +const + AV_PARSER_PTS_NB = 4; + PARSER_FLAG_COMPLETE_FRAMES = $0001; + +type + PAVCodecParserContext = ^TAVCodecParserContext; + PAVCodecParser = ^TAVCodecParser; + + TAVCodecParserContext = record + priv_data: pointer; + parser: PAVCodecParser; + frame_offset: int64; (* offset of the current frame *) + cur_offset: int64; (* current offset (incremented by each av_parser_parse()) *) + last_frame_offset: int64; (* offset of the last frame *) + (* video info *) + pict_type: integer; (* XXX: put it back in AVCodecContext *) + repeat_pict: integer; (* XXX: put it back in AVCodecContext *) + pts: int64; (* pts of the current frame *) + dts: int64; (* dts of the current frame *) + + (* private data *) + last_pts: int64; + last_dts: int64; + fetch_timestamp: integer; + + cur_frame_start_index: integer; + cur_frame_offset: array [0..AV_PARSER_PTS_NB - 1] of int64; + cur_frame_pts: array [0..AV_PARSER_PTS_NB - 1] of int64; + cur_frame_dts: array [0..AV_PARSER_PTS_NB - 1] of int64; + + flags: integer; + end; + + TAVCodecParser = record + codec_ids: array [0..4] of integer; (* several codec IDs are permitted *) + priv_data_size: integer; + parser_init: function (s: PAVCodecParserContext): integer; cdecl; + parser_parse: function (s: PAVCodecParserContext; avctx: PAVCodecContext; + poutbuf: PPointer; poutbuf_size: PInteger; + const buf: pchar; buf_size: integer): integer; cdecl; + parser_close: procedure (s: PAVCodecParserContext); cdecl; + split: function (avctx: PAVCodecContext; const buf: pchar; + buf_size: integer): integer; cdecl; + next: PAVCodecParser; + end; + + procedure av_register_codec_parser (parser: PAVCodecParser); cdecl; + cdecl; external av__codec; + + function av_parser_init (codec_id: integer): PAVCodecParserContext; + cdecl; external av__codec; + + function av_parser_parse (s: PAVCodecParserContext; + avctx: PAVCodecContext; + poutbuf: PPointer; poutbuf_size: pinteger; + const buf: pchar; buf_size: integer; + pts: int64; dts: int64): integer; + cdecl; external av__codec; + function av_parser_change (s: PAVCodecParserContext; + avctx: PAVCodecContext; + poutbuf: PPointer; poutbuf_size: PInteger; + const buf: pchar; buf_size: integer; keyframe: integer): integer; + cdecl; external av__codec; + procedure av_parser_close (s: PAVCodecParserContext); + cdecl; external av__codec; + +type + PAVBitStreamFilterContext = ^TAVBitStreamFilterContext; + PAVBitStreamFilter = ^TAVBitStreamFilter; + + TAVBitStreamFilterContext = record + priv_data: pointer; + filter: PAVBitStreamFilter; + parser: PAVCodecParserContext; + next: PAVBitStreamFilterContext; + end; + + TAVBitStreamFilter = record + name: pchar; + priv_data_size: integer; + filter: function (bsfc: PAVBitStreamFilterContext; + avctx: PAVCodecContext; args: pchar; + poutbuf: PPointer; poutbuf_size: PInteger; + buf: PByte; buf_size: integer; keyframe: integer): integer; cdecl; + next: PAVBitStreamFilter; + end; + +procedure av_register_bitstream_filter (bsf: PAVBitStreamFilter); + cdecl; external av__codec; + +function av_bitstream_filter_init (name: pchar): PAVBitStreamFilterContext; + cdecl; external av__codec; + +function av_bitstream_filter_filter (bsfc: PAVBitStreamFilterContext; + avctx: PAVCodecContext; args: pchar; + poutbuf: PPointer; poutbuf_size: PInteger; + buf: PByte; buf_size: integer; keyframe: integer): integer; + cdecl; external av__codec; +procedure av_bitstream_filter_close (bsf: PAVBitStreamFilterContext); + cdecl; external av__codec; + + +(* memory *) + procedure av_fast_realloc (ptr: pointer; size: PCardinal; min_size: Cardinal); + cdecl; external av__codec; +(* for static data only *) +(* call av_free_static to release all staticaly allocated tables *) + procedure av_free_static (); + cdecl; external av__codec; + + procedure av_mallocz_static(size: cardinal); + cdecl; external av__codec; + + procedure av_realloc_static(ptr: pointer; size: Cardinal); + cdecl; external av__codec; + + procedure img_copy (dst: PAVPicture; const src: PAVPicture; + pix_fmt: TAVPixelFormat; width: integer; height: integer); + cdecl; external av__codec; + + function img_crop (dst: PAVPicture; const src: PAVPicture; + pix_fmt: TAVPixelFormat; top_band, left_band: integer): integer; + cdecl; external av__codec; + + function img_pad (dst: PAVPicture; const src: PAVPicture; height, width: integer; + pix_fmt: TAVPixelFormat; padtop, padbottom, padleft, padright: integer; + color: PInteger): integer; + cdecl; external av__codec; + +implementation + +end. diff --git a/Game/Code/lib/ffmpeg/avformat.dcu b/Game/Code/lib/ffmpeg/avformat.dcu new file mode 100644 index 00000000..e86630d0 Binary files /dev/null and b/Game/Code/lib/ffmpeg/avformat.dcu differ diff --git a/Game/Code/lib/ffmpeg/avformat.pas b/Game/Code/lib/ffmpeg/avformat.pas new file mode 100644 index 00000000..0aa98905 --- /dev/null +++ b/Game/Code/lib/ffmpeg/avformat.pas @@ -0,0 +1,620 @@ + (* + * copyright (c) 2001 Fabrice Bellard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) +unit avformat; + +interface + +uses + windows, avcodec, avio, rational, avutil; + +const + av__format = 'avformat-50.dll'; + + LIBAVUTIL_VERSION_INT = ((49 shl 16) + (0 shl 8) + 1); + LIBAVUTIL_VERSION = '49.0.1'; + LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; + + MAXINT64 = $7fffffffffffffff; + MININT64 = $8000000000000000; + + PKT_FLAG_KEY = $0001; + + (* AVImageFormat.flags field constants *) + AVIMAGE_INTERLEAVED = $0001; (* image format support interleaved output *) + MAX_STREAMS = 20; +type + int = integer; + + PAVPacket = ^TAVPacket; + PAVImageFormat = ^TAVImageFormat; + PAVFormatContext = ^TAVFormatContext; + PAVFormatParameters = ^TAVFormatParameters; + PAVOutputFormat = ^TAVOutputFormat; + PAVProbeData = ^TAVProbeData; + PAVInputFormat = ^TAVInputFormat; + PAVIndexEntry = ^TAVIndexEntry; + PAVStream = ^TAVStream; + PAVPacketList = ^TAVPacketList; + PAVImageInfo = ^TAVImageInfo; + + TAVPacket = record {56} + pts: int64; ///< presentation time stamp in time_base units + dts: int64; ///< decompression time stamp in time_base units + data: PByte; + size: integer; + stream_index: integer; + flags: integer; + duration: integer; ///< presentation duration in time_base units (0 if not available) + destruct: procedure (p: PAVPacket); + priv: pointer; + pos: int64; ///< byte position in stream, -1 if unknown + end; + +(*************************************************) +(* fractional numbers for exact pts handling *) + +(* the exact value of the fractional number is: 'val + num / den'. num + is assumed to be such as 0 <= num < den *) + PAVFrac = ^TAVFrac; + TAVFrac = record + val, num, den: int64; + end; + +(*************************************************) +(* input/output formats *) + +(* this structure contains the data a format has to probe a file *) + TAVProbeData = record {12} + filename: pchar; + buf: pchar; + buf_size: integer; + end; + + TAVFormatParameters = record {56} + time_base: TAVRational; (* 8 bytes *) + sample_rate: integer; + channels: integer; + width: integer; + height: integer; + pix_fmt: TAVPixelFormat; + image_format: PAVImageFormat; (* 4 bytes *) + channel: integer; (* used to select dv channel *) + device: pchar; (* video, audio or DV device *) + standard: pchar; (* tv standard, NTSC, PAL, SECAM *) +// int mpeg2ts_raw:1; (* force raw MPEG2 transport stream output, if possible *) +// int mpeg2ts_compute_pcr:1; (* compute exact PCR for each transport +// stream packet (only meaningful if +// mpeg2ts_raw is TRUE *) +// int initial_pause:1; (* do not begin to play the stream +// immediately (RTSP only) *) + dummy: byte; + video_codec_id: TCodecID; + audio_codec_id: TCodecID; + end; + + TAVOutputFormat = record {56} + name: pchar; + long_name: pchar; + mime_type: pchar; + extensions: pchar; (* comma separated extensions *) + (* size of private data so that it can be allocated in the wrapper *) + priv_data_size: integer; + (* output support *) + audio_codec: TCodecID; (* default audio codec *) + video_codec: TCodecID; (* default video codec *) + write_header: function (c: PAVFormatContext): integer; cdecl; + write_packet: function (c: PAVFormatContext; pkt: PAVPacket): integer; cdecl; + write_trailer: function (c: PAVFormatContext): integer; cdecl; + (* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER *) + flags: integer; + (* currently only used to set pixel format if not YUV420P *) + set_parameters: function (c: PAVFormatContext; f: PAVFormatParameters): integer; cdecl; + interleave_packet: function (s: PAVFormatContext; _out: PAVPacket; _in: PAVPacket; flush: integer): integer; cdecl; + (* private fields *) + next: PAVOutputFormat; + end; + + TAVInputFormat = record {60} + name: pchar; + long_name: pchar; + (* size of private data so that it can be allocated in the wrapper *) + priv_data_size: integer; + (* tell if a given file has a chance of being parsing by this format *) + read_probe: function (p: PAVProbeData): integer; cdecl; + (* read the format header and initialize the AVFormatContext + structure. Return 0 if OK. 'ap' if non NULL contains + additionnal paramters. Only used in raw format right + now. 'av_new_stream' should be called to create new streams. *) + read_header: function (c: PAVFormatContext; ap: PAVFormatParameters): integer; cdecl; + (* read one packet and put it in 'pkt'. pts and flags are also + set. 'av_new_stream' can be called only if the flag + AVFMTCTX_NOHEADER is used. *) + read_packet: function (c: PAVFormatContext; pkt: PAVPacket): integer; cdecl; + (* close the stream. The AVFormatContext and AVStreams are not + freed by this function *) + read_close: function (c: PAVFormatContext): integer; cdecl; + (*** seek to a given timestamp relative to the frames in + * stream component stream_index + * @param stream_index must not be -1 + * @param flags selects which direction should be preferred if no exact + * match is available *) + read_seek: function (c: PAVFormatContext; stream_index: integer; + timestamp: int64; flags: integer): integer; cdecl; + (*** gets the next timestamp in AV_TIME_BASE units. *) + read_timestamp: function (s: PAVFormatContext; stream_index: integer; + pos: pint64; pos_limit: int64): integer; cdecl; + (* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER *) + flags: integer; + (* if extensions are defined, then no probe is done. You should + usually not use extension format guessing because it is not + reliable enough *) + extensions: pchar; + (* general purpose read only value that the format can use *) + value: integer; + + (* start/resume playing - only meaningful if using a network based format (RTSP) *) + read_play: function (c: PAVFormatContext): integer; cdecl; + + (* pause playing - only meaningful if using a network based format (RTSP) *) + read_pause: function (c: PAVFormatContext): integer; cdecl; + + (* private fields *) + next: PAVInputFormat; + end; + + TAVIndexEntry = record {24} + pos: int64; + timestamp: int64; +(* the following 2 flags indicate that the next/prev keyframe is known, and scaning for it isnt needed *) + flags: integer; + min_distance: integer; (* min distance between this and the previous keyframe, used to avoid unneeded searching *) + end; + + TAVStream = record {168} + index: integer; (* stream index in AVFormatContext *) + id: integer; (* format specific stream id *) + codec: PAVCodecContext; (* codec context *) + (*** real base frame rate of the stream. + * for example if the timebase is 1/90000 and all frames have either + * approximately 3600 or 1800 timer ticks then r_frame_rate will be 50/1 *) + r_frame_rate: TAVRational; + priv_data: pointer; + (* internal data used in av_find_stream_info() *) + codec_info_duration: int64; + codec_info_nb_frames: integer; + (* encoding: PTS generation when outputing stream *) + pts: TAVFrac; + + (*** this is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. for fixed-fps content, + * timebase should be 1/framerate and timestamp increments should be + * identically 1. *) + time_base: TAVRational; + pts_wrap_bits: integer; (* number of bits in pts (used for wrapping control) *) + (* ffmpeg.c private use *) + stream_copy: integer; (* if TRUE, just copy stream *) + discard: TAVDiscard; ///< selects which packets can be discarded at will and dont need to be demuxed + //FIXME move stuff to a flags field? + (* quality, as it has been removed from AVCodecContext and put in AVVideoFrame + * MN:dunno if thats the right place, for it *) + quality: single; + (* decoding: position of the first frame of the component, in AV_TIME_BASE fractional seconds. *) + start_time: int64; + (* decoding: duration of the stream, in AV_TIME_BASE fractional seconds. *) + duration: int64; + + language: array [0..3] of char; (* ISO 639 3-letter language code (empty string if undefined) *) + + (* av_read_frame() support *) + need_parsing: integer; ///< 1->full parsing needed, 2->only parse headers dont repack + parser: PAVCodecParserContext; + + cur_dts: int64; + last_IP_duration: integer; + last_IP_pts: int64; + (* av_seek_frame() support *) + index_entries: PAVIndexEntry; (* only used if the format does not support seeking natively *) + nb_index_entries: integer; + index_entries_allocated_size: integer; + + nb_frames: int64; ///< number of frames in this stream if known or 0 + pts_buffer: array [0..4] of int64; + end; + +(* format I/O context *) + TAVFormatContext = record {3960} + av_class: PAVClass; (* set by av_alloc_format_context *) + (* can only be iformat or oformat, not both at the same time *) + iformat: PAVInputFormat; + oformat: PAVOutputFormat; + priv_data: pointer; + pb: TByteIOContext; + nb_streams: integer; + streams: array [0..MAX_STREAMS - 1] of PAVStream; + filename: array [0..1023] of char; (* input or output filename *) + (* stream info *) + timestamp: int64; + title: array [0..511] of char; + author: array [0..511] of char; + copyright: array [0..511] of char; + comment: array [0..511] of char; + album: array [0..511] of char; + year: integer; (* ID3 year, 0 if none *) + track: integer; (* track number, 0 if none *) + genre: array [0..31] of char; (* ID3 genre *) + + ctx_flags: integer; (* format specific flags, see AVFMTCTX_xx *) + (* private data for pts handling (do not modify directly) *) + (* This buffer is only needed when packets were already buffered but + not decoded, for example to get the codec parameters in mpeg + streams *) + packet_buffer: PAVPacketList; + + (* decoding: position of the first frame of the component, in + AV_TIME_BASE fractional seconds. NEVER set this value directly: + it is deduced from the AVStream values. *) + start_time: int64; + (* decoding: duration of the stream, in AV_TIME_BASE fractional + seconds. NEVER set this value directly: it is deduced from the + AVStream values. *) + duration: int64; + (* decoding: total file size. 0 if unknown *) + file_size: int64; + (* decoding: total stream bitrate in bit/s, 0 if not + available. Never set it directly if the file_size and the + duration are known as ffmpeg can compute it automatically. *) + bit_rate: integer; + + (* av_read_frame() support *) + cur_st: PAVStream; + cur_ptr: pchar; + cur_len: integer; + cur_pkt: TAVPacket; + + (* av_seek_frame() support *) + data_offset: int64; (* offset of the first packet *) + index_built: integer; + + mux_rate: integer; + packet_size: integer; + preload: integer; + max_delay: integer; + + (* number of times to loop output in formats that support it *) + loop_output: integer; + + flags: integer; + loop_input: integer; + (* decoding: size of data to probe; encoding unused *) + probesize: cardinal; + end; + + TAVPacketList = record {64} + pkt: TAVPacket; + next: PAVPacketList; + end; + +(* still image support *) + PAVInputImageContext = pointer; // attribute_deprecated; +// PAVInputImageContext = pointer; //AVInputImageContext attribute_deprecated; + +(* still image support *) + TAVImageInfo = record {48} + pix_fmt: TAVPixelFormat; (* requested pixel format *) + width: integer; (* requested width *) + height: integer; (* requested height *) + interleaved: integer; (* image is interleaved (e.g. interleaved GIF) *) + pict: TAVPicture; (* returned allocated image *) + end; + + TAVImageFormat = record {32} + name: pchar; + extensions: pchar; + (* tell if a given file has a chance of being parsing by this format *) + img_probe: function (d: PAVProbeData): integer; cdecl; + (* read a whole image. 'alloc_cb' is called when the image size is + known so that the caller can allocate the image. If 'allo_cb' + returns non zero, then the parsing is aborted. Return '0' if + OK. *) + img_read: function (b: PByteIOContext; alloc_cb: pointer; ptr: pointer): integer; cdecl; + (* write the image *) + supported_pixel_formats: integer; (* mask of supported formats for output *) + img_write: function (b: PByteIOContext; i: PAVImageInfo): integer; cdecl; + flags: integer; + next: PAVImageFormat; + end; + +procedure av_destruct_packet_nofree (pkt: PAVPacket); + cdecl; external av__format; +procedure av_destruct_packet (pkt: PAVPacket); + cdecl; external av__format; + +(* initialize optional fields of a packet *) +procedure av_init_packet (pkt: PAVPacket); + +function av_new_packet(pkt: PAVPacket; size: integer): integer; + cdecl; external av__format; + +function av_get_packet (s: PByteIOContext; pkt: PAVPacket; size: integer): integer; + cdecl; external av__format; + +function av_dup_packet (pkt: PAVPacket): integer; + cdecl; external av__format; + +(** * Free a packet + * + * @param pkt packet to free *) +procedure av_free_packet (pkt: PAVPacket); + +procedure av_register_image_format (img_fmt: PAVImageFormat); + cdecl; external av__format; + +function av_probe_image_format (pd: PAVProbeData): PAVImageFormat; + cdecl; external av__format; + +function guess_image_format (filename: pchar): PAVImageFormat; + cdecl; external av__format; + +function av_guess_image2_codec(filename: pchar): TCodecID; + cdecl; external av__format; + +function av_read_image (pb: PByteIOContext; filename: pchar; + fmt: PAVImageFormat; + alloc_cb: pointer; opaque: pointer): integer; + cdecl; external av__format; + +function av_write_image(pb: PByteIOContext; fmt: PAVImageFormat; img: PAVImageInfo): integer; + cdecl; external av__format; + +(* XXX: use automatic init with either ELF sections or C file parser *) +(* modules *) + +//#include "rtp.h" + +//#include "rtsp.h" + +(* utils.c *) + procedure av_register_input_format (format: PAVInputFormat); + cdecl; external av__format; + + procedure av_register_output_format (format: PAVOutputFormat); + cdecl; external av__format; + + function guess_stream_format (short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; + cdecl; external av__format; + + function guess_format(short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; + cdecl; external av__format; + + function av_guess_codec(fmt: PAVOutputFormat; short_name: pchar; + filename: pchar; mime_type: pchar; _type: TCodecType): TCodecID; + cdecl; external av__format; + + procedure av_hex_dump (f: HFILE; buf: pchar; size: integer); + cdecl; external av__format; + procedure av_pkt_dump(f: HFILE; pkt: pAVPacket; dump_payload: integer); + cdecl; external av__format; + + procedure av_register_all (); + cdecl; external av__format; + + +(* media file input *) + function av_find_input_format (short_name: pchar): PAVInputFormat; + cdecl; external av__format; + function av_probe_input_format (pd: PAVProbeData; is_opened: integer): PAVInputFormat; + cdecl; external av__format; + function av_open_input_stream (ic_ptr: PAVFormatContext; + pb: PByteIOContext; filename: pchar; + fmt: PAVInputFormat; ap: PAVFormatParameters): integer; + cdecl; external av__format; +(*** Open a media file as input. The codec are not opened. Only the file + * header (if present) is read. + * + * @param ic_ptr the opened media file handle is put here + * @param filename filename to open. + * @param fmt if non NULL, force the file format to use + * @param buf_size optional buffer size (zero if default is OK) + * @param ap additionnal parameters needed when opening the file (NULL if default) + * @return 0 if OK. AVERROR_xxx otherwise. *) + + function av_open_input_file (var ic_ptr: PAVFormatContext; filename: pchar; + fmt: PAVInputFormat; buf_size: integer; + ap: PAVFormatParameters): integer; + cdecl; external av__format; + + (* no av_open for output, so applications will need this: *) + function av_alloc_format_context (): PAVFormatContext; + cdecl; external av__format; + +const + AVERROR_UNKNOWN =(-1); (* unknown error *) + AVERROR_IO =(-2); (* i/o error *) + AVERROR_NUMEXPECTED =(-3); (* number syntax expected in filename *) + AVERROR_INVALIDDATA =(-4); (* invalid data found *) + AVERROR_NOMEM =(-5); (* not enough memory *) + AVERROR_NOFMT =(-6); (* unknown format *) + AVERROR_NOTSUPP =(-7); (* operation not supported *) + +(*** Read the beginning of a media file to get stream information. This + * is useful for file formats with no headers such as MPEG. This + * function also compute the real frame rate in case of mpeg2 repeat + * frame mode. + * + * @param ic media file handle + * @return >=0 if OK. AVERROR_xxx if error. + * @todo let user decide somehow what information is needed so we dont waste time geting stuff the user doesnt need *) + + function av_find_stream_info (ic: PAVFormatContext): integer; + cdecl; external av__format; + function av_read_packet (s: PAVFormatContext; pkt: PAVPacket): integer; + cdecl; external av__format; +(*** Return the next frame of a stream. + * + * The returned packet is valid + * until the next av_read_frame() or until av_close_input_file() and + * must be freed with av_free_packet. For video, the packet contains + * exactly one frame. For audio, it contains an integer number of + * frames if each frame has a known fixed size (e.g. PCM or ADPCM + * data). If the audio frames have a variable size (e.g. MPEG audio), + * then it contains one frame. + * + * pkt->pts, pkt->dts and pkt->duration are always set to correct + * values in AV_TIME_BASE unit (and guessed if the format cannot + * provided them). pkt->pts can be AV_NOPTS_VALUE if the video format + * has B frames, so it is better to rely on pkt->dts if you do not + * decompress the payload. + * + * @return 0 if OK, < 0 if error or end of file. *) + + function av_read_frame (s: PAVFormatContext; pkt: PAVPacket): integer; + cdecl; external av__format; + function av_seek_frame (s: PAVFormatContext; stream_index: integer; timestamp: int64; flags: integer): integer; + cdecl; external av__format; + function av_read_play (s: PAVFormatContext): integer; + cdecl; external av__format; + function av_read_pause (s: PAVFormatContext): integer; + cdecl; external av__format; + procedure av_close_input_file (s: PAVFormatContext); + cdecl; external av__format; + function av_new_stream (s: PAVFormatContext; id: integer): PAVStream; + cdecl; external av__format; + procedure av_set_pts_info (s: PAVStream; pts_wrap_bits: integer; + pts_num: integer; pts_den: integer); + cdecl; external av__format; + +const + AVSEEK_FLAG_BACKWARD =1; ///< seek backward + AVSEEK_FLAG_BYTE =2; ///< seeking based on position in bytes + AVSEEK_FLAG_ANY =4; ///< seek to any frame, even non keyframes + + function av_find_default_stream_index (s: PAVFormatContext): integer; + cdecl; external av__format; + function av_index_search_timestamp (st: PAVStream; timestamp: int64; flags: integer): integer; + cdecl; external av__format; + function av_add_index_entry (st: PAVStream; pos: int64; timestamp: int64; + distance: integer; flags: integer): integer; + cdecl; external av__format; + function av_seek_frame_binary (s: PAVFormatContext; stream_index: integer; + target_ts: int64; flags: integer): integer; + cdecl; external av__format; + + procedure av_update_cur_dts (s: PAVFormatContext; ref_st: PAVStream; + timestamp: int64); + cdecl; external av__format; + +(* media file output *) + function av_set_parameters (s: PAVFormatContext; ap: PAVFormatParameters): integer; + cdecl; external av__format; + + function av_write_header (s: PAVFormatContext): integer; + cdecl; external av__format; + + function av_write_frame(s: PAVFormatContext; pkt: PAVPacket): integer; + cdecl; external av__format; + + function av_interleaved_write_frame (s: PAVFormatContext; pkt: PAVPacket): integer; + cdecl; external av__format; + + function av_interleave_packet_per_dts(s: PAVFormatContext; _out: PAVPacket; + pkt: PAVPacket; flush: integer): integer; + cdecl; external av__format; + function av_write_trailer(s: pAVFormatContext): integer; + cdecl; external av__format; + + procedure dump_format(ic: PAVFormatContext; index: integer; url: pchar; + is_output: integer); + cdecl; external av__format; + + function parse_image_size(width_ptr: PInteger; height_ptr: PInteger; str: pchar): integer; + cdecl; external av__format; + function parse_frame_rate (frame_rate: PInteger; frame_rate_base: PInteger; arg: pchar): integer; + cdecl; external av__format; + function parse_date(datestr: pchar; duration: integer): int64; + cdecl; external av__format; + function av_gettime (): int64; + cdecl; external av__format; + +(* ffm specific for ffserver *) +const + FFM_PACKET_SIZE = 4096; + + function ffm_read_write_index (fd: integer): int64; + cdecl; external av__format; + + procedure ffm_write_write_index(fd: integer; pos: int64); + cdecl; external av__format; + + procedure ffm_set_write_index (s: PAVFormatContext; pos: int64; file_size: int64); + cdecl; external av__format; + + function find_info_tag (arg: pchar; arg_size: integer; tag1: pchar; info: pchar): integer; + cdecl; external av__format; + + function get_frame_filename(buf: pchar; buf_size: integer; + path: pchar; number: integer): integer; + cdecl; external av__format; + function filename_number_test (filename: pchar): integer; + cdecl; external av__format; + + +(* grab specific *) + function video_grab_init (): integer; + cdecl; external av__format; + function audio_init (): integer; + cdecl; external av__format; + +(* DV1394 *) + function dv1394_init (): integer; + cdecl; external av__format; + function dc1394_init (): integer; + cdecl; external av__format; + + function strstart(str: pchar; val: pchar; ptr: PPointer): integer; + cdecl; external av__format; + function stristart(str: pchar; val: pchar; ptr: PPointer): integer; + cdecl; external av__format; + procedure pstrcpy(buf: pchar; buf_size: integer; str: pchar); + cdecl; external av__format; + function pstrcat(buf: pchar; buf_size: integer; s: pchar): pchar; + cdecl; external av__format; + + procedure __dynarray_add (tab_ptr: PPointer; nb_ptr: PInteger; elem: cardinal); + cdecl; external av__format; + + +implementation + +procedure av_init_packet (pkt: PAVPacket); +begin + pkt.pts := AV_NOPTS_VALUE; + pkt.dts := AV_NOPTS_VALUE; + pkt.pos := -1; + pkt.duration := 0; + pkt.flags := 0; + pkt.stream_index := 0; + pkt.destruct := @av_destruct_packet_nofree; +end; + +procedure av_free_packet (pkt: PAVPacket); +begin + if (pkt <> nil) and (@pkt^.destruct <> nil) then + pkt^.destruct (pkt); +end; + +end. diff --git a/Game/Code/lib/ffmpeg/avio.dcu b/Game/Code/lib/ffmpeg/avio.dcu new file mode 100644 index 00000000..646b76d2 Binary files /dev/null and b/Game/Code/lib/ffmpeg/avio.dcu differ diff --git a/Game/Code/lib/ffmpeg/avio.pas b/Game/Code/lib/ffmpeg/avio.pas new file mode 100644 index 00000000..20275ab7 --- /dev/null +++ b/Game/Code/lib/ffmpeg/avio.pas @@ -0,0 +1,241 @@ + (* + * unbuffered io for ffmpeg system + * copyright (c) 2001 Fabrice Bellard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) +unit avio; + +interface + +uses + windows; + +const + av__format = 'avformat-50.dll'; + + URL_RDONLY = 0; + URL_WRONLY = 1; + URL_RDWR = 2; + +(* output byte stream handling *) + +type + offset_t = int64; + int = integer; + +(* unbuffered I/O *) + PURLProtocol = ^TURLProtocol; + PURLContext = ^TURLContext; + TURLContext = record + prot: PURLProtocol; + flags: int; + is_streamed: int; //* true if streamed (no seek possible), default = false */ + max_packet_size: int; //* if non zero, the stream is packetized with this max packet size */ + priv_data: pointer; + filename: array [0..0] of char; (* specified filename *) + end; + + PURLPollEntry = ^TURLPollEntry; + TURLPollEntry = record + handle: PURLContext; + events: integer; + revents: integer; + end; + + TURLProtocol = record + name: pchar; + url_open: function (h: PURLContext; const filename: pchar; flags: integer): integer; cdecl; + url_read: function (h: PURLContext; buf: pchar; size: integer): integer; cdecl; + url_write: function (h: PURLContext; buf: pchar; size: integer): integer; cdecl; + url_seek: function (h: PURLContext; pos: int64; whence: integer): int64; cdecl; + url_close: function (h: PURLContext): integer; cdecl; + next: PURLProtocol; + end; + + PByteIOContext = ^TByteIOContext; + TByteIOContext = record + buffer: pchar; + buffer_size: integer; + buf_ptr: pchar; + buf_end: pchar; + opaque: pointer; + read_packet: function (opaque: pointer; buf: pchar; buf_size: integer): integer; cdecl; + write_packet: function (opaque: pointer; buf: pchar; buf_size: integer): integer; cdecl; + seek: function (opaque: pointer; offset: int64; whence: integer): int64; cdecl; + pos: int64; (* position in the file of the current buffer *) + must_flush: integer; (* true if the next seek should flush *) + eof_reached: integer; (* true if eof reached *) + write_flag: integer; (* true if open for writing *) + is_streamed: integer; + max_packet_size: integer; + checksum: longword; + checksum_ptr: pchar; + update_checksum: function (checksum: cardinal; const buf: pchar; size: cardinal): LongWord; cdecl; + error: integer; ///< contains the error code or 0 if no error happened + end; + + function url_open(h: PPointer; const filename: pchar; flags: integer): integer; + cdecl; external av__format; + function url_read (h: PURLContext; buf: pchar; size: integer): integer; + cdecl; external av__format; + function url_write (h: PURLContext; buf: pchar; size: integer): integer; + cdecl; external av__format; + function url_seek (h: PURLContext; pos: int64; whence: integer): int64; + cdecl; external av__format; + function url_close (h: PURLContext): integer; + cdecl; external av__format; + function url_exist(const filename: pchar): integer; + cdecl; external av__format; + function url_filesize (h: PURLContext): int64; + cdecl; external av__format; + function url_get_max_packet_size(h: PURLContext): integer; + cdecl; external av__format; + procedure url_get_filename(h: PURLContext; buf: pchar; buf_size: integer); + cdecl; external av__format; + +(* the callback is called in blocking functions to test regulary if + asynchronous interruption is needed. -EINTR is returned in this + case by the interrupted function. 'NULL' means no interrupt + callback is given. *) + procedure url_set_interrupt_cb (interrupt_cb: pinteger); + cdecl; external av__format; + +(* not implemented *) +//int url_poll(URLPollEntry *poll_table, int n, int timeout); + + function register_protocol (protocol: PURLProtocol): integer; + cdecl; external av__format; + + function init_put_byte(s: PByteIOContext; + buffer: pchar; + buffer_size: integer; write_flag: integer; + opaque: pointer; + read_packet: pointer; //int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + write_packet: pointer; //int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + seek: pointer //offset_t (*seek)(void *opaque, offset_t offset, int whence) + ): integer; + cdecl; external av__format; + procedure put_byte(s: PByteIOContext; b: integer); + cdecl; external av__format; + procedure put_buffer (s: PByteIOContext; const buf: pchar; size: integer); + cdecl; external av__format; + procedure put_le64(s: PByteIOContext; val: int64); + cdecl; external av__format; + procedure put_be64(s: PByteIOContext; val: int64); + cdecl; external av__format; + procedure put_le32(s: PByteIOContext; val: cardinal); + cdecl; external av__format; + procedure put_be32(s: PByteIOContext; val: cardinal); + cdecl; external av__format; + procedure put_be24(s: PByteIOContext; val: cardinal); + cdecl; external av__format; + procedure put_le16(s: PByteIOContext; val: cardinal); + cdecl; external av__format; + procedure put_be16(s: PByteIOContext; val: cardinal); + cdecl; external av__format; + procedure put_tag(s: PByteIOContext; const tag: pchar); + cdecl; external av__format; + + procedure put_strz(s: PByteIOContext; const buf: pchar); + cdecl; external av__format; + + function url_fseek(s: PByteIOContext; offset: int64; whence: integer): int64; + cdecl; external av__format; + procedure url_fskip(s: PByteIOContext; offset: int64); + cdecl; external av__format; + function url_ftell(s: PByteIOContext): int64; + cdecl; external av__format; + function url_fsize(s: PByteIOContext): int64; + cdecl; external av__format; + function url_feof(s: PByteIOContext): integer; + cdecl; external av__format; + function url_ferror(s: PByteIOContext): integer; + cdecl; external av__format; + + procedure put_flush_packet (s: PByteIOContext); + cdecl; external av__format; + function get_buffer(s: PByteIOContext; buf: pchar; size: integer): integer; + cdecl; external av__format; + function get_partial_buffer(s: PByteIOContext; buf: pchar; size: integer): integer; + cdecl; external av__format; + function get_byte(s: PByteIOContext): integer; + cdecl; external av__format; + function get_le32(s: PByteIOContext): cardinal; + cdecl; external av__format; + function get_le64(s: PByteIOContext): int64; + cdecl; external av__format; + function get_le16(s: PByteIOContext): cardinal; + cdecl; external av__format; + + function get_strz(s: PByteIOContext; buf: pchar; maxlen: integer): pchar; + cdecl; external av__format; + function get_be16(s: PByteIOContext): cardinal; + cdecl; external av__format; + function get_be24(s: PByteIOContext): cardinal; + cdecl; external av__format; + function get_be32(s: PByteIOContext): cardinal; + cdecl; external av__format; + function get_be64(s: PByteIOContext): int64; + cdecl; external av__format; + + function url_is_streamed(s: PByteIOContext): integer; + + function url_fdopen (s: PByteIOContext; h: PURLContext): integer; + cdecl; external av__format; + function url_setbufsize (s: PByteIOContext; buf_size: integer): integer; + cdecl; external av__format; + function url_fopen(s: PByteIOContext; const filename: pchar; flags: integer): integer; + cdecl; external av__format; + function url_fclose(s: PByteIOContext): integer; + cdecl; external av__format; + + function url_fileno(s: PByteIOContext): PURLContext; + cdecl; external av__format; + function url_fget_max_packet_size (s: PByteIOContext): integer; + cdecl; external av__format; + function url_open_buf(s: PByteIOContext; buf: pchar; buf_size: integer; flags: integer): integer; + cdecl; external av__format; + function url_close_buf(s: PByteIOContext): integer; + cdecl; external av__format; + + function url_open_dyn_buf(s: PByteIOContext): integer; + cdecl; external av__format; + function url_open_dyn_packet_buf(s: PByteIOContext; max_packet_size: integer): integer; + cdecl; external av__format; + function url_close_dyn_buf(s: PByteIOContext; pbuffer:PPointer): integer; + cdecl; external av__format; + + function get_checksum(s: PByteIOContext): cardinal; + cdecl; external av__format; + + procedure init_checksum (s: PByteIOContext; update_checksum: pointer; checksum: cardinal); + cdecl; external av__format; + + function udp_set_remote_url(h: PURLContext; const uri: pchar): integer; + cdecl; external av__format; + function udp_get_local_port(h: PURLContext): integer; + cdecl; external av__format; + function udp_get_file_handle(h: PURLContext): integer; + cdecl; external av__format; + +implementation + +function url_is_streamed(s: PByteIOContext): integer; +begin + Result := s^.is_streamed; +end; + +end. diff --git a/Game/Code/lib/ffmpeg/avutil.dcu b/Game/Code/lib/ffmpeg/avutil.dcu new file mode 100644 index 00000000..c4f0fe95 Binary files /dev/null and b/Game/Code/lib/ffmpeg/avutil.dcu differ diff --git a/Game/Code/lib/ffmpeg/avutil.pas b/Game/Code/lib/ffmpeg/avutil.pas new file mode 100644 index 00000000..d947a3f0 --- /dev/null +++ b/Game/Code/lib/ffmpeg/avutil.pas @@ -0,0 +1,133 @@ + (* + * copyright (c) 2006 Michael Niedermayer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +unit avutil; + +interface + + +const + av__util = 'avutil-49.dll'; + + LIBAVUTIL_VERSION_INT = ((49 shl 16) + (0 shl 8) + 1); + LIBAVUTIL_VERSION = '49.0.1'; + LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; + +type +(** + * Pixel format. Notes: + * + * PIX_FMT_RGB32 is handled in an endian-specific manner. A RGBA + * color is put together as: + * (A << 24) | (R << 16) | (G << 8) | B + * This is stored as BGRA on little endian CPU architectures and ARGB on + * big endian CPUs. + * + * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized + * image data is stored in AVFrame.data[0]. The palette is transported in + * AVFrame.data[1] and, is 1024 bytes long (256 4-byte entries) and is + * formatted the same as in PIX_FMT_RGB32 described above (i.e., it is + * also endian-specific). Note also that the individual RGB palette + * components stored in AVFrame.data[1] should be in the range 0..255. + * This is important as many custom PAL8 video codecs that were designed + * to run on the IBM VGA graphics adapter use 6-bit palette components. + *) + + PAVPixelFormat = ^TAVPixelFormat; + TAVPixelFormat = ( + PIX_FMT_NONE= -1, + PIX_FMT_YUV420P, ///< Planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) + PIX_FMT_YUYV422, ///< Packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr + PIX_FMT_RGB24, ///< Packed RGB 8:8:8, 24bpp, RGBRGB... + PIX_FMT_BGR24, ///< Packed RGB 8:8:8, 24bpp, BGRBGR... + PIX_FMT_YUV422P, ///< Planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + PIX_FMT_YUV444P, ///< Planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) + PIX_FMT_RGB32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in cpu endianness + PIX_FMT_YUV410P, ///< Planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) + PIX_FMT_YUV411P, ///< Planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) + PIX_FMT_RGB565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in cpu endianness + PIX_FMT_RGB555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in cpu endianness most significant bit to 1 + PIX_FMT_GRAY8, ///< Y , 8bpp + PIX_FMT_MONOWHITE, ///< Y , 1bpp, 1 is white + PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black + PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette + PIX_FMT_YUVJ420P, ///< Planar YUV 4:2:0, 12bpp, full scale (jpeg) + PIX_FMT_YUVJ422P, ///< Planar YUV 4:2:2, 16bpp, full scale (jpeg) + PIX_FMT_YUVJ444P, ///< Planar YUV 4:4:4, 24bpp, full scale (jpeg) + PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h) + PIX_FMT_XVMC_MPEG2_IDCT, + PIX_FMT_UYVY422, ///< Packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 + PIX_FMT_UYYVYY411, ///< Packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 + PIX_FMT_BGR32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in cpu endianness + PIX_FMT_BGR565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in cpu endianness + PIX_FMT_BGR555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in cpu endianness most significant bit to 1 + PIX_FMT_BGR8, ///< Packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) + PIX_FMT_BGR4, ///< Packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb) + PIX_FMT_BGR4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) + PIX_FMT_RGB8, ///< Packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) + PIX_FMT_RGB4, ///< Packed RGB 1:2:1, 4bpp, (msb)2R 3G 3B(lsb) + PIX_FMT_RGB4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)2R 3G 3B(lsb) + PIX_FMT_NV12, ///< Planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV + PIX_FMT_NV21, ///< as above, but U and V bytes are swapped + + PIX_FMT_RGB32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in cpu endianness + PIX_FMT_BGR32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in cpu endianness + + PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions + PIX_FMT_FACKED = $FFFFF + ); + +const +{$ifdef WORDS_BIGENDIAN} + PIX_FMT_RGBA = PIX_FMT_RGB32_1; + PIX_FMT_BGRA = PIX_FMT_BGR32_1; + PIX_FMT_ARGB = PIX_FMT_RGB32; + PIX_FMT_ABGR = PIX_FMT_BGR32; +{$else} + PIX_FMT_RGBA = PIX_FMT_BGR32; + PIX_FMT_BGRA = PIX_FMT_RGB32; + PIX_FMT_ARGB = PIX_FMT_BGR32_1; + PIX_FMT_ABGR = PIX_FMT_RGB32_1; +{$endif} + + PIX_FMT_UYVY411 = PIX_FMT_UYYVYY411; + PIX_FMT_RGBA32 = PIX_FMT_RGB32; + PIX_FMT_YUV422 = PIX_FMT_YUYV422; + +(* memory *) +function av_malloc (size: cardinal): pointer; + cdecl; external av__util; + +function av_realloc (ptr: pointer; size: cardinal): pointer; + cdecl; external av__util; + +procedure av_free (ptr: pointer); + cdecl; external av__util; + +function av_mallocz (size: cardinal): pointer; + cdecl; external av__util; + +function av_strdup(const s: pchar): pchar; + cdecl; external av__util; + +procedure av_freep (ptr: pointer); + cdecl; external av__util; + +implementation + +end. diff --git a/Game/Code/lib/ffmpeg/mmreg.pas b/Game/Code/lib/ffmpeg/mmreg.pas new file mode 100644 index 00000000..05e24eb0 --- /dev/null +++ b/Game/Code/lib/ffmpeg/mmreg.pas @@ -0,0 +1,1446 @@ +unit mmreg; + +interface + +uses + windows, mmsystem; + +(*++ + +Copyright 1991-1998 Microsoft Corporation + +Module Name: + + mmreg.h + +Abstract: + + Multimedia Registration + +Revision History: + + Translated to .pas - Zinetz Victor, Dec. 2005 + mail@zinetz.info + +--*) + +// Define the following to skip definitions +// +// NOMMIDS Multimedia IDs are not defined +// NONEWWAVE No new waveform types are defined except WAVEFORMATEX +// NONEWRIFF No new RIFF forms are defined +// NOJPEGDIB No JPEG DIB definitions +// NONEWIC No new Image Compressor types are defined +// NOBITMAP No extended bitmap info header definition + +(* manufacturer IDs *) +const + MM_MICROSOFT = 1; //* Microsoft Corporation */ + MM_CREATIVE = 2; //* Creative Labs, Inc */ + MM_MEDIAVISION = 3; (* Media Vision, Inc. *) + MM_FUJITSU = 4; (* Fujitsu Corp. *) + MM_ARTISOFT = 20; (* Artisoft, Inc. *) + MM_TURTLE_BEACH = 21; (* Turtle Beach, Inc. *) + MM_IBM = 22; (* IBM Corporation *) + MM_VOCALTEC = 23; (* Vocaltec LTD. *) + MM_ROLAND = 24; (* Roland *) + MM_DSP_SOLUTIONS = 25; (* DSP Solutions, Inc. *) + MM_NEC = 26; (* NEC *) + MM_ATI = 27; (* ATI *) + MM_WANGLABS = 28; (* Wang Laboratories, Inc *) + MM_TANDY = 29; (* Tandy Corporation *) + MM_VOYETRA = 30; (* Voyetra *) + MM_ANTEX = 31; (* Antex Electronics Corporation *) + MM_ICL_PS = 32; (* ICL Personal Systems *) + MM_INTEL = 33; (* Intel Corporation *) + MM_GRAVIS = 34; (* Advanced Gravis *) + MM_VAL = 35; (* Video Associates Labs, Inc. *) + MM_INTERACTIVE = 36; (* InterActive Inc *) + MM_YAMAHA = 37; (* Yamaha Corporation of America *) + MM_EVEREX = 38; (* Everex Systems, Inc *) + MM_ECHO = 39; (* Echo Speech Corporation *) + MM_SIERRA = 40; (* Sierra Semiconductor Corp *) + MM_CAT = 41; (* Computer Aided Technologies *) + MM_APPS = 42; (* APPS Software International *) + MM_DSP_GROUP = 43; (* DSP Group, Inc *) + MM_MELABS = 44; (* microEngineering Labs *) + MM_COMPUTER_FRIENDS = 45; (* Computer Friends, Inc. *) + MM_ESS = 46; (* ESS Technology *) + MM_AUDIOFILE = 47; (* Audio, Inc. *) + MM_MOTOROLA = 48; (* Motorola, Inc. *) + MM_CANOPUS = 49; (* Canopus, co., Ltd. *) + MM_EPSON = 50; (* Seiko Epson Corporation *) + MM_TRUEVISION = 51; (* Truevision *) + MM_AZTECH = 52; (* Aztech Labs, Inc. *) + MM_VIDEOLOGIC = 53; (* Videologic *) + MM_SCALACS = 54; (* SCALACS *) + MM_KORG = 55; (* Korg Inc. *) + MM_APT = 56; (* Audio Processing Technology *) + MM_ICS = 57; (* Integrated Circuit Systems, Inc. *) + MM_ITERATEDSYS = 58; (* Iterated Systems, Inc. *) + MM_METHEUS = 59; (* Metheus *) + MM_LOGITECH = 60; (* Logitech, Inc. *) + MM_WINNOV = 61; (* Winnov, Inc. *) + MM_NCR = 62; (* NCR Corporation *) + MM_EXAN = 63; (* EXAN *) + MM_AST = 64; (* AST Research Inc. *) + MM_WILLOWPOND = 65; (* Willow Pond Corporation *) + MM_SONICFOUNDRY = 66; (* Sonic Foundry *) + MM_VITEC = 67; (* Vitec Multimedia *) + MM_MOSCOM = 68; (* MOSCOM Corporation *) + MM_SILICONSOFT = 69; (* Silicon Soft, Inc. *) + MM_SUPERMAC = 73; (* Supermac *) + MM_AUDIOPT = 74; (* Audio Processing Technology *) + MM_SPEECHCOMP = 76; (* Speech Compression *) + MM_AHEAD = 77; (* Ahead, Inc. *) + MM_DOLBY = 78; (* Dolby Laboratories *) + MM_OKI = 79; (* OKI *) + MM_AURAVISION = 80; (* AuraVision Corporation *) + MM_OLIVETTI = 81; (* Ing C. Olivetti & C., S.p.A. *) + MM_IOMAGIC = 82; (* I/O Magic Corporation *) + MM_MATSUSHITA = 83; (* Matsushita Electric Industrial Co., LTD. *) + MM_CONTROLRES = 84; (* Control Resources Limited *) + MM_XEBEC = 85; (* Xebec Multimedia Solutions Limited *) + MM_NEWMEDIA = 86; (* New Media Corporation *) + MM_NMS = 87; (* Natural MicroSystems *) + MM_LYRRUS = 88; (* Lyrrus Inc. *) + MM_COMPUSIC = 89; (* Compusic *) + MM_OPTI = 90; (* OPTi Computers Inc. *) + MM_ADLACC = 91; (* Adlib Accessories Inc. *) + MM_COMPAQ = 92; (* Compaq Computer Corp. *) + MM_DIALOGIC = 93; (* Dialogic Corporation *) + MM_INSOFT = 94; (* InSoft, Inc. *) + MM_MPTUS = 95; (* M.P. Technologies, Inc. *) + MM_WEITEK = 96; (* Weitek *) + MM_LERNOUT_AND_HAUSPIE = 97; (* Lernout & Hauspie *) + MM_QCIAR = 98; (* Quanta Computer Inc. *) + MM_APPLE = 99; (* Apple Computer, Inc. *) + MM_DIGITAL = 100; (* Digital Equipment Corporation *) + MM_MOTU = 101; (* Mark of the Unicorn *) + MM_WORKBIT = 102; (* Workbit Corporation *) + MM_OSITECH = 103; (* Ositech Communications Inc. *) + MM_MIRO = 104; (* miro Computer Products AG *) + MM_CIRRUSLOGIC = 105; (* Cirrus Logic *) + MM_ISOLUTION = 106; (* ISOLUTION B.V. *) + MM_HORIZONS = 107; (* Horizons Technology, Inc *) + MM_CONCEPTS = 108; (* Computer Concepts Ltd *) + MM_VTG = 109; (* Voice Technologies Group, Inc. *) + MM_RADIUS = 110; (* Radius *) + MM_ROCKWELL = 111; (* Rockwell International *) + MM_XYz = 112; (* Co. XYZ for testing *) + MM_OPCODE = 113; (* Opcode Systems *) + MM_VOXWARE = 114; (* Voxware Inc *) + MM_NORTHERN_TELECOM = 115; (* Northern Telecom Limited *) + MM_APICOM = 116; (* APICOM *) + MM_GRANDE = 117; (* Grande Software *) + MM_ADDX = 118; (* ADDX *) + MM_WILDCAT = 119; (* Wildcat Canyon Software *) + MM_RHETOREX = 120; (* Rhetorex Inc *) + MM_BROOKTREE = 121; (* Brooktree Corporation *) + MM_ENSONIQ = 125; (* ENSONIQ Corporation *) + MM_FAST = 126; (* ///FAST Multimedia AG *) + MM_NVIDIA = 127; (* NVidia Corporation *) + MM_OKSORI = 128; (* OKSORI Co., Ltd. *) + MM_DIACOUSTICS = 129; (* DiAcoustics, Inc. *) + MM_GULBRANSEN = 130; (* Gulbransen, Inc. *) + MM_KAY_ELEMETRICS = 131; (* Kay Elemetrics, Inc. *) + MM_CRYSTAL = 132; (* Crystal Semiconductor Corporation *) + MM_SPLASH_STUDIOS = 133; (* Splash Studios *) + MM_QUARTERDECK = 134; (* Quarterdeck Corporation *) + MM_TDK = 135; (* TDK Corporation *) + MM_DIGITAL_AUDIO_LABS = 136; (* Digital Audio Labs, Inc. *) + MM_SEERSYS = 137; (* Seer Systems, Inc. *) + MM_PICTURETEL = 138; (* PictureTel Corporation *) + MM_ATT_MICROELECTRONICS = 139; (* AT&T Microelectronics *) + MM_OSPREY = 140; (* Osprey Technologies, Inc. *) + MM_MEDIATRIX = 141; (* Mediatrix Peripherals *) + MM_SOUNDESIGNS = 142; (* SounDesignS M.C.S. Ltd. *) + MM_ALDIGITAL = 143; (* A.L. Digital Ltd. *) + MM_SPECTRUM_SIGNAL_PROCESSING= 144; (* Spectrum Signal Processing, Inc. *) + MM_ECS = 145; (* Electronic Courseware Systems, Inc. *) + MM_AMD = 146; (* AMD *) + MM_COREDYNAMICS = 147; (* Core Dynamics *) + MM_CANAM = 148; (* CANAM Computers *) + MM_SOFTSOUND = 149; (* Softsound, Ltd. *) + MM_NORRIS = 150; (* Norris Communications, Inc. *) + MM_DDD = 151; (* Danka Data Devices *) + MM_EUPHONICS = 152; (* EuPhonics *) + MM_PRECEPT = 153; (* Precept Software, Inc. *) + MM_CRYSTAL_NET = 154; (* Crystal Net Corporation *) + MM_CHROMATIC = 155; (* Chromatic Research, Inc *) + MM_VOICEINFO = 156; (* Voice Information Systems, Inc *) + MM_VIENNASYS = 157; (* Vienna Systems *) + MM_CONNECTIX = 158; (* Connectix Corporation *) + MM_GADGETLABS = 159; (* Gadget Labs LLC *) + MM_FRONTIER = 160; (* Frontier Design Group LLC *) + MM_VIONA = 161; (* Viona Development GmbH *) + MM_CASIO = 162; (* Casio Computer Co., LTD *) + MM_DIAMONDMM = 163; (* Diamond Multimedia *) + MM_S3 = 164; (* S3 *) + MM_FRAUNHOFER_IIS = 172; (* Fraunhofer *) + +(* MM_MICROSOFT product IDs *) + + MM_MIDI_MAPPER = 1; (* Midi Mapper *) + MM_WAVE_MAPPER = 2; (* Wave Mapper *) + MM_SNDBLST_MIDIOUT = 3; (* Sound Blaster MIDI output port *) + MM_SNDBLST_MIDIIN = 4; (* Sound Blaster MIDI input port *) + MM_SNDBLST_SYNTH = 5; (* Sound Blaster internal synth *) + MM_SNDBLST_WAVEOUT = 6; (* Sound Blaster waveform output *) + MM_SNDBLST_WAVEIN = 7; (* Sound Blaster waveform input *) + MM_ADLIB = 9; (* Ad Lib Compatible synth *) + MM_MPU401_MIDIOUT = 10; (* MPU 401 compatible MIDI output port *) + MM_MPU401_MIDIIN = 11; (* MPU 401 compatible MIDI input port *) + MM_PC_JOYSTICK = 12; (* Joystick adapter *) + + MM_PCSPEAKER_WAVEOUT = 13; (* PC speaker waveform output *) + MM_MSFT_WSS_WAVEIN = 14; (* MS Audio Board waveform input *) + MM_MSFT_WSS_WAVEOUT = 15; (* MS Audio Board waveform output *) + MM_MSFT_WSS_FMSYNTH_STEREO = 16; (* MS Audio Board Stereo FM synth *) + MM_MSFT_WSS_MIXER = 17; (* MS Audio Board Mixer Driver *) + MM_MSFT_WSS_OEM_WAVEIN = 18; (* MS OEM Audio Board waveform input *) + MM_MSFT_WSS_OEM_WAVEOUT = 19; (* MS OEM Audio Board waveform output *) + MM_MSFT_WSS_OEM_FMSYNTH_STEREO = 20; (* MS OEM Audio Board Stereo FM Synth *) + MM_MSFT_WSS_AUX = 21; (* MS Audio Board Aux. Port *) + MM_MSFT_WSS_OEM_AUX = 22; (* MS OEM Audio Aux Port *) + MM_MSFT_GENERIC_WAVEIN = 23; (* MS Vanilla driver waveform input *) + MM_MSFT_GENERIC_WAVEOUT = 24; (* MS Vanilla driver wavefrom output *) + MM_MSFT_GENERIC_MIDIIN = 25; (* MS Vanilla driver MIDI in *) + MM_MSFT_GENERIC_MIDIOUT = 26; (* MS Vanilla driver MIDI external out *) + MM_MSFT_GENERIC_MIDISYNTH = 27; (* MS Vanilla driver MIDI synthesizer *) + MM_MSFT_GENERIC_AUX_LINE = 28; (* MS Vanilla driver aux (line in) *) + MM_MSFT_GENERIC_AUX_MIC = 29; (* MS Vanilla driver aux (mic) *) + MM_MSFT_GENERIC_AUX_CD = 30; (* MS Vanilla driver aux (CD) *) + MM_MSFT_WSS_OEM_MIXER = 31; (* MS OEM Audio Board Mixer Driver *) + MM_MSFT_MSACM = 32; (* MS Audio Compression Manager *) + MM_MSFT_ACM_MSADPCM = 33; (* MS ADPCM Codec *) + MM_MSFT_ACM_IMAADPCM = 34; (* IMA ADPCM Codec *) + MM_MSFT_ACM_MSFILTER = 35; (* MS Filter *) + MM_MSFT_ACM_GSM610 = 36; (* GSM 610 codec *) + MM_MSFT_ACM_G711 = 37; (* G.711 codec *) + MM_MSFT_ACM_PCM = 38; (* PCM converter *) + + // Microsoft Windows Sound System drivers + + MM_WSS_SB16_WAVEIN = 39; (* Sound Blaster 16 waveform input *) + MM_WSS_SB16_WAVEOUT = 40; (* Sound Blaster 16 waveform output *) + MM_WSS_SB16_MIDIIN = 41; (* Sound Blaster 16 midi-in *) + MM_WSS_SB16_MIDIOUT = 42; (* Sound Blaster 16 midi out *) + MM_WSS_SB16_SYNTH = 43; (* Sound Blaster 16 FM Synthesis *) + MM_WSS_SB16_AUX_LINE = 44; (* Sound Blaster 16 aux (line in) *) + MM_WSS_SB16_AUX_CD = 45; (* Sound Blaster 16 aux (CD) *) + MM_WSS_SB16_MIXER = 46; (* Sound Blaster 16 mixer device *) + MM_WSS_SBPRO_WAVEIN = 47; (* Sound Blaster Pro waveform input *) + MM_WSS_SBPRO_WAVEOUT = 48; (* Sound Blaster Pro waveform output *) + MM_WSS_SBPRO_MIDIIN = 49; (* Sound Blaster Pro midi in *) + MM_WSS_SBPRO_MIDIOUT = 50; (* Sound Blaster Pro midi out *) + MM_WSS_SBPRO_SYNTH = 51; (* Sound Blaster Pro FM synthesis *) + MM_WSS_SBPRO_AUX_LINE = 52; (* Sound Blaster Pro aux (line in ) *) + MM_WSS_SBPRO_AUX_CD = 53; (* Sound Blaster Pro aux (CD) *) + MM_WSS_SBPRO_MIXER = 54; (* Sound Blaster Pro mixer *) + + MM_MSFT_WSS_NT_WAVEIN = 55; (* WSS NT wave in *) + MM_MSFT_WSS_NT_WAVEOUT = 56; (* WSS NT wave out *) + MM_MSFT_WSS_NT_FMSYNTH_STEREO = 57; (* WSS NT FM synth *) + MM_MSFT_WSS_NT_MIXER = 58; (* WSS NT mixer *) + MM_MSFT_WSS_NT_AUX = 59; (* WSS NT aux *) + + MM_MSFT_SB16_WAVEIN = 60; (* Sound Blaster 16 waveform input *) + MM_MSFT_SB16_WAVEOUT = 61; (* Sound Blaster 16 waveform output *) + MM_MSFT_SB16_MIDIIN = 62; (* Sound Blaster 16 midi-in *) + MM_MSFT_SB16_MIDIOUT = 63; (* Sound Blaster 16 midi out *) + MM_MSFT_SB16_SYNTH = 64; (* Sound Blaster 16 FM Synthesis *) + MM_MSFT_SB16_AUX_LINE = 65; (* Sound Blaster 16 aux (line in) *) + MM_MSFT_SB16_AUX_CD = 66; (* Sound Blaster 16 aux (CD) *) + MM_MSFT_SB16_MIXER = 67; (* Sound Blaster 16 mixer device *) + MM_MSFT_SBPRO_WAVEIN = 68; (* Sound Blaster Pro waveform input *) + MM_MSFT_SBPRO_WAVEOUT = 69; (* Sound Blaster Pro waveform output *) + MM_MSFT_SBPRO_MIDIIN = 70; (* Sound Blaster Pro midi in *) + MM_MSFT_SBPRO_MIDIOUT = 71; (* Sound Blaster Pro midi out *) + MM_MSFT_SBPRO_SYNTH = 72; (* Sound Blaster Pro FM synthesis *) + MM_MSFT_SBPRO_AUX_LINE = 73; (* Sound Blaster Pro aux (line in ) *) + MM_MSFT_SBPRO_AUX_CD = 74; (* Sound Blaster Pro aux (CD) *) + MM_MSFT_SBPRO_MIXER = 75; (* Sound Blaster Pro mixer *) + + MM_MSFT_MSOPL_SYNTH = 76; (* Yamaha OPL2/OPL3 compatible FM synthesis *) + + MM_MSFT_VMDMS_LINE_WAVEIN = 80; (* Voice Modem Serial Line Wave Input *) + MM_MSFT_VMDMS_LINE_WAVEOUT = 81; (* Voice Modem Serial Line Wave Output *) + MM_MSFT_VMDMS_HANDSET_WAVEIN = 82; (* Voice Modem Serial Handset Wave Input *) + MM_MSFT_VMDMS_HANDSET_WAVEOUT = 83; (* Voice Modem Serial Handset Wave Output *) + MM_MSFT_VMDMW_LINE_WAVEIN = 84; (* Voice Modem Wrapper Line Wave Input *) + MM_MSFT_VMDMW_LINE_WAVEOUT = 85; (* Voice Modem Wrapper Line Wave Output *) + MM_MSFT_VMDMW_HANDSET_WAVEIN = 86; (* Voice Modem Wrapper Handset Wave Input *) + MM_MSFT_VMDMW_HANDSET_WAVEOUT = 87; (* Voice Modem Wrapper Handset Wave Output *) + MM_MSFT_VMDMW_MIXER = 88; (* Voice Modem Wrapper Mixer *) + MM_MSFT_VMDM_GAME_WAVEOUT = 89; (* Voice Modem Game Compatible Wave Device *) + MM_MSFT_VMDM_GAME_WAVEIN = 90; (* Voice Modem Game Compatible Wave Device *) + + MM_MSFT_ACM_MSNAUDIO = 91; (* *) + MM_MSFT_ACM_MSG723 = 92; (* *) + + MM_MSFT_WDMAUDIO_WAVEOUT = 100; (* Generic id for WDM Audio drivers *) + MM_MSFT_WDMAUDIO_WAVEIN = 101; (* Generic id for WDM Audio drivers *) + MM_MSFT_WDMAUDIO_MIDIOUT = 102; (* Generic id for WDM Audio drivers *) + MM_MSFT_WDMAUDIO_MIDIIN = 103; (* Generic id for WDM Audio drivers *) + MM_MSFT_WDMAUDIO_MIXER = 104; (* Generic id for WDM Audio drivers *) + + +(* MM_CREATIVE product IDs *) + MM_CREATIVE_SB15_WAVEIN = 1; (* SB (r) 1.5 waveform input *) + MM_CREATIVE_SB20_WAVEIN = 2; + MM_CREATIVE_SBPRO_WAVEIN = 3; + MM_CREATIVE_SBP16_WAVEIN = 4; + MM_CREATIVE_PHNBLST_WAVEIN = 5; + MM_CREATIVE_SB15_WAVEOUT = 101; + MM_CREATIVE_SB20_WAVEOUT = 102; + MM_CREATIVE_SBPRO_WAVEOUT = 103; + MM_CREATIVE_SBP16_WAVEOUT = 104; + MM_CREATIVE_PHNBLST_WAVEOUT = 105; + MM_CREATIVE_MIDIOUT = 201; (* SB (r) *) + MM_CREATIVE_MIDIIN = 202; (* SB (r) *) + MM_CREATIVE_FMSYNTH_MONO = 301; (* SB (r) *) + MM_CREATIVE_FMSYNTH_STEREO = 302; (* SB Pro (r) stereo synthesizer *) + MM_CREATIVE_MIDI_AWE32 = 303; + MM_CREATIVE_AUX_CD = 401; (* SB Pro (r) aux (CD) *) + MM_CREATIVE_AUX_LINE = 402; (* SB Pro (r) aux (Line in ) *) + MM_CREATIVE_AUX_MIC = 403; (* SB Pro (r) aux (mic) *) + MM_CREATIVE_AUX_MASTER = 404; + MM_CREATIVE_AUX_PCSPK = 405; + MM_CREATIVE_AUX_WAVE = 406; + MM_CREATIVE_AUX_MIDI = 407; + MM_CREATIVE_SBPRO_MIXER = 408; + MM_CREATIVE_SB16_MIXER = 409; + +(* MM_MEDIAVISION product IDs *) + +// Pro Audio Spectrum + MM_MEDIAVISION_PROAUDIO = $10; + MM_PROAUD_MIDIOUT = (MM_MEDIAVISION_PROAUDIO+1); + MM_PROAUD_MIDIIN = (MM_MEDIAVISION_PROAUDIO+2); + MM_PROAUD_SYNTH = (MM_MEDIAVISION_PROAUDIO+3); + MM_PROAUD_WAVEOUT = (MM_MEDIAVISION_PROAUDIO+4); + MM_PROAUD_WAVEIN = (MM_MEDIAVISION_PROAUDIO+5); + MM_PROAUD_MIXER = (MM_MEDIAVISION_PROAUDIO+6); + MM_PROAUD_AUX = (MM_MEDIAVISION_PROAUDIO+7); + +// Thunder Board + MM_MEDIAVISION_THUNDER = $20; + MM_THUNDER_SYNTH = (MM_MEDIAVISION_THUNDER+3); + MM_THUNDER_WAVEOUT = (MM_MEDIAVISION_THUNDER+4); + MM_THUNDER_WAVEIN = (MM_MEDIAVISION_THUNDER+5); + MM_THUNDER_AUX = (MM_MEDIAVISION_THUNDER+7); + +// Audio Port + MM_MEDIAVISION_TPORT = $40; + MM_TPORT_WAVEOUT = (MM_MEDIAVISION_TPORT+1); + MM_TPORT_WAVEIN = (MM_MEDIAVISION_TPORT+2); + MM_TPORT_SYNTH = (MM_MEDIAVISION_TPORT+3); + +// Pro Audio Spectrum Plus + MM_MEDIAVISION_PROAUDIO_PLUS = $50; + MM_PROAUD_PLUS_MIDIOUT = (MM_MEDIAVISION_PROAUDIO_PLUS+1); + MM_PROAUD_PLUS_MIDIIN = (MM_MEDIAVISION_PROAUDIO_PLUS+2); + MM_PROAUD_PLUS_SYNTH = (MM_MEDIAVISION_PROAUDIO_PLUS+3); + MM_PROAUD_PLUS_WAVEOUT = (MM_MEDIAVISION_PROAUDIO_PLUS+4); + MM_PROAUD_PLUS_WAVEIN = (MM_MEDIAVISION_PROAUDIO_PLUS+5); + MM_PROAUD_PLUS_MIXER = (MM_MEDIAVISION_PROAUDIO_PLUS+6); + MM_PROAUD_PLUS_AUX = (MM_MEDIAVISION_PROAUDIO_PLUS+7); + +// Pro Audio Spectrum 16 + MM_MEDIAVISION_PROAUDIO_16 = $60; + MM_PROAUD_16_MIDIOUT = (MM_MEDIAVISION_PROAUDIO_16+1); + MM_PROAUD_16_MIDIIN = (MM_MEDIAVISION_PROAUDIO_16+2); + MM_PROAUD_16_SYNTH = (MM_MEDIAVISION_PROAUDIO_16+3); + MM_PROAUD_16_WAVEOUT = (MM_MEDIAVISION_PROAUDIO_16+4); + MM_PROAUD_16_WAVEIN = (MM_MEDIAVISION_PROAUDIO_16+5); + MM_PROAUD_16_MIXER = (MM_MEDIAVISION_PROAUDIO_16+6); + MM_PROAUD_16_AUX = (MM_MEDIAVISION_PROAUDIO_16+7); + +// Pro Audio Studio 16 + MM_MEDIAVISION_PROSTUDIO_16 = $60; + MM_STUDIO_16_MIDIOUT = (MM_MEDIAVISION_PROSTUDIO_16+1); + MM_STUDIO_16_MIDIIN = (MM_MEDIAVISION_PROSTUDIO_16+2); + MM_STUDIO_16_SYNTH = (MM_MEDIAVISION_PROSTUDIO_16+3); + MM_STUDIO_16_WAVEOUT = (MM_MEDIAVISION_PROSTUDIO_16+4); + MM_STUDIO_16_WAVEIN = (MM_MEDIAVISION_PROSTUDIO_16+5); + MM_STUDIO_16_MIXER = (MM_MEDIAVISION_PROSTUDIO_16+6); + MM_STUDIO_16_AUX = (MM_MEDIAVISION_PROSTUDIO_16+7); + +// CDPC + MM_MEDIAVISION_CDPC = $70; + MM_CDPC_MIDIOUT = (MM_MEDIAVISION_CDPC+1); + MM_CDPC_MIDIIN = (MM_MEDIAVISION_CDPC+2); + MM_CDPC_SYNTH = (MM_MEDIAVISION_CDPC+3); + MM_CDPC_WAVEOUT = (MM_MEDIAVISION_CDPC+4); + MM_CDPC_WAVEIN = (MM_MEDIAVISION_CDPC+5); + MM_CDPC_MIXER = (MM_MEDIAVISION_CDPC+6); + MM_CDPC_AUX = (MM_MEDIAVISION_CDPC+7); + +// Opus MV 1208 Chipsent + MM_MEDIAVISION_OPUS1208 = $80; + MM_OPUS401_MIDIOUT = (MM_MEDIAVISION_OPUS1208+1); + MM_OPUS401_MIDIIN = (MM_MEDIAVISION_OPUS1208+2); + MM_OPUS1208_SYNTH = (MM_MEDIAVISION_OPUS1208+3); + MM_OPUS1208_WAVEOUT = (MM_MEDIAVISION_OPUS1208+4); + MM_OPUS1208_WAVEIN = (MM_MEDIAVISION_OPUS1208+5); + MM_OPUS1208_MIXER = (MM_MEDIAVISION_OPUS1208+6); + MM_OPUS1208_AUX = (MM_MEDIAVISION_OPUS1208+7); + +// Opus MV 1216 chipset + MM_MEDIAVISION_OPUS1216 = $90; + MM_OPUS1216_MIDIOUT = (MM_MEDIAVISION_OPUS1216+1); + MM_OPUS1216_MIDIIN = (MM_MEDIAVISION_OPUS1216+2); + MM_OPUS1216_SYNTH = (MM_MEDIAVISION_OPUS1216+3); + MM_OPUS1216_WAVEOUT = (MM_MEDIAVISION_OPUS1216+4); + MM_OPUS1216_WAVEIN = (MM_MEDIAVISION_OPUS1216+5); + MM_OPUS1216_MIXER = (MM_MEDIAVISION_OPUS1216+6); + MM_OPUS1216_AUX = (MM_MEDIAVISION_OPUS1216+7); + +(* MM_ARTISOFT product IDs *) + MM_ARTISOFT_SBWAVEIN = 1; (* Artisoft sounding Board waveform input *) + MM_ARTISOFT_SBWAVEOUT = 2; (* Artisoft sounding Board waveform output *) + +(* MM_IBM product IDs *) + MM_MMOTION_WAVEAUX = 1; (* IBM M-Motion Auxiliary Device *) + MM_MMOTION_WAVEOUT = 2; (* IBM M-Motion Waveform output *) + MM_MMOTION_WAVEIN = 3; (* IBM M-Motion Waveform Input *) + MM_IBM_PCMCIA_WAVEIN = 11; (* IBM waveform input *) + MM_IBM_PCMCIA_WAVEOUT = 12; (* IBM Waveform output *) + MM_IBM_PCMCIA_SYNTH = 13; (* IBM Midi Synthesis *) + MM_IBM_PCMCIA_MIDIIN = 14; (* IBM external MIDI in *) + MM_IBM_PCMCIA_MIDIOUT = 15; (* IBM external MIDI out *) + MM_IBM_PCMCIA_AUX = 16; (* IBM auxiliary control *) + MM_IBM_THINKPAD200 = 17; + MM_IBM_MWAVE_WAVEIN = 18; + MM_IBM_MWAVE_WAVEOUT = 19; + MM_IBM_MWAVE_MIXER = 20; + MM_IBM_MWAVE_MIDIIN = 21; + MM_IBM_MWAVE_MIDIOUT = 22; + MM_IBM_MWAVE_AUX = 23; + MM_IBM_WC_MIDIOUT = 30; + MM_IBM_WC_WAVEOUT = 31; + MM_IBM_WC_MIXEROUT = 33; + +(* MM_VOCALTEC product IDs *) + MM_VOCALTEC_WAVEOUT = 1; + MM_VOCALTEC_WAVEIN = 2; + +(* MM_ROLAND product IDs *) + MM_ROLAND_RAP10_MIDIOUT = 10; (* MM_ROLAND_RAP10 *) + MM_ROLAND_RAP10_MIDIIN = 11; (* MM_ROLAND_RAP10 *) + MM_ROLAND_RAP10_SYNTH = 12; (* MM_ROLAND_RAP10 *) + MM_ROLAND_RAP10_WAVEOUT = 13; (* MM_ROLAND_RAP10 *) + MM_ROLAND_RAP10_WAVEIN = 14; (* MM_ROLAND_RAP10 *) + MM_ROLAND_MPU401_MIDIOUT = 15; + MM_ROLAND_MPU401_MIDIIN = 16; + MM_ROLAND_SMPU_MIDIOUTA = 17; + MM_ROLAND_SMPU_MIDIOUTB = 18; + MM_ROLAND_SMPU_MIDIINA = 19; + MM_ROLAND_SMPU_MIDIINB = 20; + MM_ROLAND_SC7_MIDIOUT = 21; + MM_ROLAND_SC7_MIDIIN = 22; + MM_ROLAND_SERIAL_MIDIOUT = 23; + MM_ROLAND_SERIAL_MIDIIN = 24; + MM_ROLAND_SCP_MIDIOUT = 38; + MM_ROLAND_SCP_MIDIIN = 39; + MM_ROLAND_SCP_WAVEOUT = 40; + MM_ROLAND_SCP_WAVEIN = 41; + MM_ROLAND_SCP_MIXER = 42; + MM_ROLAND_SCP_AUX = 48; + +(* MM_DSP_SOLUTIONS product IDs *) + MM_DSP_SOLUTIONS_WAVEOUT = 1; + MM_DSP_SOLUTIONS_WAVEIN = 2; + MM_DSP_SOLUTIONS_SYNTH = 3; + MM_DSP_SOLUTIONS_AUX = 4; + +(* MM_WANGLABS product IDs *) + MM_WANGLABS_WAVEIN1 = 1; (* Input audio wave on CPU board models: Exec 4010, 4030, 3450; PC 251/25c, pc 461/25s , pc 461/33c *) + MM_WANGLABS_WAVEOUT1 = 2; + +(* MM_TANDY product IDs *) + MM_TANDY_VISWAVEIN = 1; + MM_TANDY_VISWAVEOUT = 2; + MM_TANDY_VISBIOSSYNTH = 3; + MM_TANDY_SENS_MMAWAVEIN = 4; + MM_TANDY_SENS_MMAWAVEOUT = 5; + MM_TANDY_SENS_MMAMIDIIN = 6; + MM_TANDY_SENS_MMAMIDIOUT = 7; + MM_TANDY_SENS_VISWAVEOUT = 8; + MM_TANDY_PSSJWAVEIN = 9; + MM_TANDY_PSSJWAVEOUT = 10; + +(* product IDs *) + MM_INTELOPD_WAVEIN = 1; (* HID2 WaveAudio Driver *) + MM_INTELOPD_WAVEOUT = 101; (* HID2 *) + MM_INTELOPD_AUX = 401; (* HID2 for mixing *) + MM_INTEL_NSPMODEMLINE = 501; + +(* MM_INTERACTIVE product IDs *) + MM_INTERACTIVE_WAVEIN = $45; + MM_INTERACTIVE_WAVEOUT = $45; + +(* MM_YAMAHA product IDs *) + MM_YAMAHA_GSS_SYNTH = $01; + MM_YAMAHA_GSS_WAVEOUT = $02; + MM_YAMAHA_GSS_WAVEIN = $03; + MM_YAMAHA_GSS_MIDIOUT = $04; + MM_YAMAHA_GSS_MIDIIN = $05; + MM_YAMAHA_GSS_AUX = $06; + MM_YAMAHA_SERIAL_MIDIOUT = $07; + MM_YAMAHA_SERIAL_MIDIIN = $08; + MM_YAMAHA_OPL3SA_WAVEOUT = $10; + MM_YAMAHA_OPL3SA_WAVEIN = $11; + MM_YAMAHA_OPL3SA_FMSYNTH = $12; + MM_YAMAHA_OPL3SA_YSYNTH = $13; + MM_YAMAHA_OPL3SA_MIDIOUT = $14; + MM_YAMAHA_OPL3SA_MIDIIN = $15; + MM_YAMAHA_OPL3SA_MIXER = $17; + MM_YAMAHA_OPL3SA_JOYSTICK = $18; + +(* MM_EVEREX product IDs *) + MM_EVEREX_CARRIER = $01; + +(* MM_ECHO product IDs *) + MM_ECHO_SYNTH = $01; + MM_ECHO_WAVEOUT = $02; + MM_ECHO_WAVEIN = $03; + MM_ECHO_MIDIOUT = $04; + MM_ECHO_MIDIIN = $05; + MM_ECHO_AUX = $06; + +(* MM_SIERRA product IDs *) + MM_SIERRA_ARIA_MIDIOUT = $14; + MM_SIERRA_ARIA_MIDIIN = $15; + MM_SIERRA_ARIA_SYNTH = $16; + MM_SIERRA_ARIA_WAVEOUT = $17; + MM_SIERRA_ARIA_WAVEIN = $18; + MM_SIERRA_ARIA_AUX = $19; + MM_SIERRA_ARIA_AUX2 = $20; + MM_SIERRA_QUARTET_WAVEIN = $50; + MM_SIERRA_QUARTET_WAVEOUT = $51; + MM_SIERRA_QUARTET_MIDIIN = $52; + MM_SIERRA_QUARTET_MIDIOUT = $53; + MM_SIERRA_QUARTET_SYNTH = $54; + MM_SIERRA_QUARTET_AUX_CD = $55; + MM_SIERRA_QUARTET_AUX_LINE = $56; + MM_SIERRA_QUARTET_AUX_MODEM = $57; + MM_SIERRA_QUARTET_MIXER = $58; + +(* MM_CAT product IDs *) + MM_CAT_WAVEOUT = 1; + +(* MM_DSP_GROUP product IDs *) + MM_DSP_GROUP_TRUESPEECH = $01; + +(* MM_MELABS product IDs *) + MM_MELABS_MIDI2GO = $01; + +(* MM_ESS product IDs *) + MM_ESS_AMWAVEOUT = $01; + MM_ESS_AMWAVEIN = $02; + MM_ESS_AMAUX = $03; + MM_ESS_AMSYNTH = $04; + MM_ESS_AMMIDIOUT = $05; + MM_ESS_AMMIDIIN = $06; + MM_ESS_MIXER = $07; + MM_ESS_AUX_CD = $08; + MM_ESS_MPU401_MIDIOUT = $09; + MM_ESS_MPU401_MIDIIN = $0A; + MM_ESS_ES488_WAVEOUT = $10; + MM_ESS_ES488_WAVEIN = $11; + MM_ESS_ES488_MIXER = $12; + MM_ESS_ES688_WAVEOUT = $13; + MM_ESS_ES688_WAVEIN = $14; + MM_ESS_ES688_MIXER = $15; + MM_ESS_ES1488_WAVEOUT = $16; + MM_ESS_ES1488_WAVEIN = $17; + MM_ESS_ES1488_MIXER = $18; + MM_ESS_ES1688_WAVEOUT = $19; + MM_ESS_ES1688_WAVEIN = $1A; + MM_ESS_ES1688_MIXER = $1B; + MM_ESS_ES1788_WAVEOUT = $1C; + MM_ESS_ES1788_WAVEIN = $1D; + MM_ESS_ES1788_MIXER = $1E; + MM_ESS_ES1888_WAVEOUT = $1F; + MM_ESS_ES1888_WAVEIN = $20; + MM_ESS_ES1888_MIXER = $21; + MM_ESS_ES1868_WAVEOUT = $22; + MM_ESS_ES1868_WAVEIN = $23; + MM_ESS_ES1868_MIXER = $24; + MM_ESS_ES1878_WAVEOUT = $25; + MM_ESS_ES1878_WAVEIN = $26; + MM_ESS_ES1878_MIXER = $27; + +(* product IDs *) + MM_EPS_FMSND = 1; + +(* MM_TRUEVISION product IDs *) + MM_TRUEVISION_WAVEIN1 = 1; + MM_TRUEVISION_WAVEOUT1 = 2; + +(* MM_AZTECH product IDs *) + MM_AZTECH_MIDIOUT = 3; + MM_AZTECH_MIDIIN = 4; + MM_AZTECH_WAVEIN = 17; + MM_AZTECH_WAVEOUT = 18; + MM_AZTECH_FMSYNTH = 20; + MM_AZTECH_MIXER = 21; + MM_AZTECH_PRO16_WAVEIN = 33; + MM_AZTECH_PRO16_WAVEOUT = 34; + MM_AZTECH_PRO16_FMSYNTH = 38; + MM_AZTECH_DSP16_WAVEIN = 65; + MM_AZTECH_DSP16_WAVEOUT = 66; + MM_AZTECH_DSP16_FMSYNTH = 68; + MM_AZTECH_DSP16_WAVESYNTH = 70; + MM_AZTECH_NOVA16_WAVEIN = 71; + MM_AZTECH_NOVA16_WAVEOUT = 72; + MM_AZTECH_NOVA16_MIXER = 73; + MM_AZTECH_WASH16_WAVEIN = 74; + MM_AZTECH_WASH16_WAVEOUT = 75; + MM_AZTECH_WASH16_MIXER = 76; + MM_AZTECH_AUX_CD = 401; + MM_AZTECH_AUX_LINE = 402; + MM_AZTECH_AUX_MIC = 403; + MM_AZTECH_AUX = 404; + +(* MM_VIDEOLOGIC product IDs *) + MM_VIDEOLOGIC_MSWAVEIN = 1; + MM_VIDEOLOGIC_MSWAVEOUT = 2; + +(* MM_KORG product IDs *) + MM_KORG_PCIF_MIDIOUT = 1; + MM_KORG_PCIF_MIDIIN = 2; + +(* MM_APT product IDs *) + MM_APT_ACE100CD = 1; + +(* MM_ICS product IDs *) + MM_ICS_WAVEDECK_WAVEOUT = 1; (* MS WSS compatible card and driver *) + MM_ICS_WAVEDECK_WAVEIN = 2; + MM_ICS_WAVEDECK_MIXER = 3; + MM_ICS_WAVEDECK_AUX = 4; + MM_ICS_WAVEDECK_SYNTH = 5; + MM_ICS_WAVEDEC_SB_WAVEOUT = 6; + MM_ICS_WAVEDEC_SB_WAVEIN = 7; + MM_ICS_WAVEDEC_SB_FM_MIDIOUT = 8; + MM_ICS_WAVEDEC_SB_MPU401_MIDIOUT = 9; + MM_ICS_WAVEDEC_SB_MPU401_MIDIIN = 10; + MM_ICS_WAVEDEC_SB_MIXER = 11; + MM_ICS_WAVEDEC_SB_AUX = 12; + MM_ICS_2115_LITE_MIDIOUT = 13; + MM_ICS_2120_LITE_MIDIOUT = 14; + +(* MM_ITERATEDSYS product IDs *) + MM_ITERATEDSYS_FUFCODEC = 1; + +(* MM_METHEUS product IDs *) + MM_METHEUS_ZIPPER = 1; + +(* MM_WINNOV product IDs *) + MM_WINNOV_CAVIAR_WAVEIN = 1; + MM_WINNOV_CAVIAR_WAVEOUT = 2; + MM_WINNOV_CAVIAR_VIDC = 3; + MM_WINNOV_CAVIAR_CHAMPAGNE = 4; (* Fourcc is CHAM *) + MM_WINNOV_CAVIAR_YUV8 = 5; (* Fourcc is YUV8 *) + +(* MM_NCR product IDs *) + MM_NCR_BA_WAVEIN = 1; + MM_NCR_BA_WAVEOUT = 2; + MM_NCR_BA_SYNTH = 3; + MM_NCR_BA_AUX = 4; + MM_NCR_BA_MIXER = 5; + +(* MM_VITEC product IDs *) + MM_VITEC_VMAKER = 1; + MM_VITEC_VMPRO = 2; + +(* MM_MOSCOM product IDs *) + MM_MOSCOM_VPC2400_IN = 1; (* Four Port Voice Processing / Voice Recognition Board *) + MM_MOSCOM_VPC2400_OUT = 2; (* VPC2400 *) + +(* MM_SILICONSOFT product IDs *) + MM_SILICONSOFT_SC1_WAVEIN = 1; (* Waveform in , high sample rate *) + MM_SILICONSOFT_SC1_WAVEOUT = 2; (* Waveform out , high sample rate *) + MM_SILICONSOFT_SC2_WAVEIN = 3; (* Waveform in 2 channels, high sample rate *) + MM_SILICONSOFT_SC2_WAVEOUT = 4; (* Waveform out 2 channels, high sample rate *) + MM_SILICONSOFT_SOUNDJR2_WAVEOUT = 5; (* Waveform out, self powered, efficient *) + MM_SILICONSOFT_SOUNDJR2PR_WAVEIN = 6; (* Waveform in, self powered, efficient *) + MM_SILICONSOFT_SOUNDJR2PR_WAVEOUT = 7; (* Waveform out 2 channels, self powered, efficient *) + MM_SILICONSOFT_SOUNDJR3_WAVEOUT = 8; (* Waveform in 2 channels, self powered, efficient *) + +(* MM_OLIVETTI product IDs *) + MM_OLIVETTI_WAVEIN = 1; + MM_OLIVETTI_WAVEOUT = 2; + MM_OLIVETTI_MIXER = 3; + MM_OLIVETTI_AUX = 4; + MM_OLIVETTI_MIDIIN = 5; + MM_OLIVETTI_MIDIOUT = 6; + MM_OLIVETTI_SYNTH = 7; + MM_OLIVETTI_JOYSTICK = 8; + MM_OLIVETTI_ACM_GSM = 9; + MM_OLIVETTI_ACM_ADPCM = 10; + MM_OLIVETTI_ACM_CELP = 11; + MM_OLIVETTI_ACM_SBC = 12; + MM_OLIVETTI_ACM_OPR = 13; + +(* MM_IOMAGIC product IDs *) + +(* The I/O Magic Tempo is a PCMCIA Type 2 audio card featuring wave audio + record and playback, FM synthesizer, and MIDI output. The I/O Magic + Tempo WaveOut device supports mono and stereo PCM playback at rates + of 7350, 11025, 22050, and 44100 samples *) + + MM_IOMAGIC_TEMPO_WAVEOUT = 1; + MM_IOMAGIC_TEMPO_WAVEIN = 2; + MM_IOMAGIC_TEMPO_SYNTH = 3; + MM_IOMAGIC_TEMPO_MIDIOUT = 4; + MM_IOMAGIC_TEMPO_MXDOUT = 5; + MM_IOMAGIC_TEMPO_AUXOUT = 6; + +(* MM_MATSUSHITA product IDs *) + MM_MATSUSHITA_WAVEIN = 1; + MM_MATSUSHITA_WAVEOUT = 2; + MM_MATSUSHITA_FMSYNTH_STEREO = 3; + MM_MATSUSHITA_MIXER = 4; + MM_MATSUSHITA_AUX = 5; + +(* MM_NEWMEDIA product IDs *) + MM_NEWMEDIA_WAVJAMMER = 1; (* WSS Compatible sound card. *) + +(* MM_LYRRUS product IDs *) + +(* Bridge is a MIDI driver that allows the the Lyrrus G-VOX hardware to + communicate with Windows base transcription and sequencer applications. + The driver also provides a mechanism for the user to configure the system + to their personal playing style. *) + + MM_LYRRUS_BRIDGE_GUITAR = 1; + +(* MM_OPTI product IDs *) + MM_OPTI_M16_FMSYNTH_STEREO = $0001; + MM_OPTI_M16_MIDIIN = $0002; + MM_OPTI_M16_MIDIOUT = $0003; + MM_OPTI_M16_WAVEIN = $0004; + MM_OPTI_M16_WAVEOUT = $0005; + MM_OPTI_M16_MIXER = $0006; + MM_OPTI_M16_AUX = $0007; + MM_OPTI_P16_FMSYNTH_STEREO = $0010; + MM_OPTI_P16_MIDIIN = $0011; + MM_OPTI_P16_MIDIOUT = $0012; + MM_OPTI_P16_WAVEIN = $0013; + MM_OPTI_P16_WAVEOUT = $0014; + MM_OPTI_P16_MIXER = $0015; + MM_OPTI_P16_AUX = $0016; + MM_OPTI_M32_WAVEIN = $0020; + MM_OPTI_M32_WAVEOUT = $0021; + MM_OPTI_M32_MIDIIN = $0022; + MM_OPTI_M32_MIDIOUT = $0023; + MM_OPTI_M32_SYNTH_STEREO = $0024; + MM_OPTI_M32_MIXER = $0025; + MM_OPTI_M32_AUX = $0026; + +(* Product IDs for MM_ADDX - ADDX *) + MM_ADDX_PCTV_DIGITALMIX = 1; (* MM_ADDX_PCTV_DIGITALMIX *) + MM_ADDX_PCTV_WAVEIN = 2; (* MM_ADDX_PCTV_WAVEIN *) + MM_ADDX_PCTV_WAVEOUT = 3; (* MM_ADDX_PCTV_WAVEOUT *) + MM_ADDX_PCTV_MIXER = 4; (* MM_ADDX_PCTV_MIXER *) + MM_ADDX_PCTV_AUX_CD = 5; (* MM_ADDX_PCTV_AUX_CD *) + MM_ADDX_PCTV_AUX_LINE = 6; (* MM_ADDX_PCTV_AUX_LINE *) + +(* Product IDs for MM_AHEAD - Ahead, Inc. *) + MM_AHEAD_MULTISOUND = 1; + MM_AHEAD_SOUNDBLASTER = 2; + MM_AHEAD_PROAUDIO = 3; + MM_AHEAD_GENERIC = 4; + +(* Product IDs for MM_AMD - AMD *) + MM_AMD_INTERWAVE_WAVEIN = 1; + MM_AMD_INTERWAVE_WAVEOUT = 2; + MM_AMD_INTERWAVE_SYNTH = 3; + MM_AMD_INTERWAVE_MIXER1 = 4; + MM_AMD_INTERWAVE_MIXER2 = 5; + MM_AMD_INTERWAVE_JOYSTICK = 6; + MM_AMD_INTERWAVE_EX_CD = 7; + MM_AMD_INTERWAVE_MIDIIN = 8; + MM_AMD_INTERWAVE_MIDIOUT = 9; + MM_AMD_INTERWAVE_AUX1 = 10; + MM_AMD_INTERWAVE_AUX2 = 11; + MM_AMD_INTERWAVE_AUX_MIC = 12; + MM_AMD_INTERWAVE_AUX_CD = 13; + MM_AMD_INTERWAVE_MONO_IN = 14; + MM_AMD_INTERWAVE_MONO_OUT = 15; + MM_AMD_INTERWAVE_EX_TELEPHONY = 16; + MM_AMD_INTERWAVE_WAVEOUT_BASE = 17; + MM_AMD_INTERWAVE_WAVEOUT_TREBLE = 18; + MM_AMD_INTERWAVE_STEREO_ENHANCED = 19; + +(* Product IDs for MM_AST - AST Research Inc. *) + MM_AST_MODEMWAVE_WAVEIN = 13; + MM_AST_MODEMWAVE_WAVEOUT = 14; + +(* Product IDs for MM_BROOKTREE - Brooktree Corporation *) + MM_BTV_WAVEIN = 1; (* Brooktree PCM Wave Audio In *) + MM_BTV_WAVEOUT = 2; (* Brooktree PCM Wave Audio Out *) + MM_BTV_MIDIIN = 3; (* Brooktree MIDI In *) + MM_BTV_MIDIOUT = 4; (* Brooktree MIDI out *) + MM_BTV_MIDISYNTH = 5; (* Brooktree MIDI FM synth *) + MM_BTV_AUX_LINE = 6; (* Brooktree Line Input *) + MM_BTV_AUX_MIC = 7; (* Brooktree Microphone Input *) + MM_BTV_AUX_CD = 8; (* Brooktree CD Input *) + MM_BTV_DIGITALIN = 9; (* Brooktree PCM Wave in with subcode information *) + MM_BTV_DIGITALOUT = 10; (* Brooktree PCM Wave out with subcode information *) + MM_BTV_MIDIWAVESTREAM = 11; (* Brooktree WaveStream *) + MM_BTV_MIXER = 12; (* Brooktree WSS Mixer driver *) + +(* Product IDs for MM_CANAM - CANAM Computers *) + MM_CANAM_CBXWAVEOUT = 1; + MM_CANAM_CBXWAVEIN = 2; + +(* Product IDs for MM_CASIO - Casio Computer Co., LTD *) + MM_CASIO_WP150_MIDIOUT = 1; (* wp150 *) + MM_CASIO_WP150_MIDIIN = 2; + +(* Product IDs for MM_COMPAQ - Compaq Computer Corp. *) + MM_COMPAQ_BB_WAVEIN = 1; + MM_COMPAQ_BB_WAVEOUT = 2; + MM_COMPAQ_BB_WAVEAUX = 3; + +(* Product IDs for MM_COREDYNAMICS - Core Dynamics *) + MM_COREDYNAMICS_DYNAMIXHR = 1; (* DynaMax Hi-Rez *) + MM_COREDYNAMICS_DYNASONIX_SYNTH = 2; (* DynaSonix *) + MM_COREDYNAMICS_DYNASONIX_MIDI_IN = 3; + MM_COREDYNAMICS_DYNASONIX_MIDI_OUT= 4; + MM_COREDYNAMICS_DYNASONIX_WAVE_IN = 5; + MM_COREDYNAMICS_DYNASONIX_WAVE_OUT= 6; + MM_COREDYNAMICS_DYNASONIX_AUDIO_IN= 7; + MM_COREDYNAMICS_DYNASONIX_AUDIO_OUT = 8; + MM_COREDYNAMICS_DYNAGRAFX_VGA = 9; (* DynaGrfx *) + MM_COREDYNAMICS_DYNAGRAFX_WAVE_IN = 10; + MM_COREDYNAMICS_DYNAGRAFX_WAVE_OUT= 11; + +(* Product IDs for MM_CRYSTAL - Crystal Semiconductor Corporation *) + MM_CRYSTAL_CS4232_WAVEIN = 1; + MM_CRYSTAL_CS4232_WAVEOUT = 2; + MM_CRYSTAL_CS4232_WAVEMIXER = 3; + MM_CRYSTAL_CS4232_WAVEAUX_AUX1 = 4; + MM_CRYSTAL_CS4232_WAVEAUX_AUX2 = 5; + MM_CRYSTAL_CS4232_WAVEAUX_LINE = 6; + MM_CRYSTAL_CS4232_WAVEAUX_MONO = 7; + MM_CRYSTAL_CS4232_WAVEAUX_MASTER = 8; + MM_CRYSTAL_CS4232_MIDIIN = 9; + MM_CRYSTAL_CS4232_MIDIOUT = 10; + MM_CRYSTAL_CS4232_INPUTGAIN_AUX1 = 13; + MM_CRYSTAL_CS4232_INPUTGAIN_LOOP = 14; + +(* Product IDs for MM_DDD - Danka Data Devices *) + MM_DDD_MIDILINK_MIDIIN = 1; + MM_DDD_MIDILINK_MIDIOUT = 2; + +(* Product IDs for MM_DIACOUSTICS - DiAcoustics, Inc. *) + MM_DIACOUSTICS_DRUM_ACTION = 1; (* Drum Action *) + +(* Product IDs for MM_DIAMONDMM - Diamond Multimedia *) + MM_DIMD_PLATFORM = 0; (* Freedom Audio *) + MM_DIMD_DIRSOUND = 1; + MM_DIMD_VIRTMPU = 2; + MM_DIMD_VIRTSB = 3; + MM_DIMD_VIRTJOY = 4; + MM_DIMD_WAVEIN = 5; + MM_DIMD_WAVEOUT = 6; + MM_DIMD_MIDIIN = 7; + MM_DIMD_MIDIOUT = 8; + MM_DIMD_AUX_LINE = 9; + MM_DIMD_MIXER = 10; + +(* Product IDs for MM_DIGITAL_AUDIO_LABS - Digital Audio Labs, Inc. *) + MM_DIGITAL_AUDIO_LABS_V8 = $10; + MM_DIGITAL_AUDIO_LABS_CPRO = $11; + +(* Product IDs for MM_DIGITAL - Digital Equipment Corporation *) + MM_DIGITAL_AV320_WAVEIN = 1; (* Digital Audio Video Compression Board *) + MM_DIGITAL_AV320_WAVEOUT = 2; (* Digital Audio Video Compression Board *) + +(* Product IDs for MM_ECS - Electronic Courseware Systems, Inc. *) + MM_ECS_AADF_MIDI_IN = 10; + MM_ECS_AADF_MIDI_OUT = 11; + MM_ECS_AADF_WAVE2MIDI_IN = 12; + +(* Product IDs for MM_ENSONIQ - ENSONIQ Corporation *) + MM_ENSONIQ_SOUNDSCAPE = $10; (* ENSONIQ Soundscape *) + MM_SOUNDSCAPE_WAVEOUT = MM_ENSONIQ_SOUNDSCAPE+1; + MM_SOUNDSCAPE_WAVEOUT_AUX = MM_ENSONIQ_SOUNDSCAPE+2; + MM_SOUNDSCAPE_WAVEIN = MM_ENSONIQ_SOUNDSCAPE+3; + MM_SOUNDSCAPE_MIDIOUT = MM_ENSONIQ_SOUNDSCAPE+4; + MM_SOUNDSCAPE_MIDIIN = MM_ENSONIQ_SOUNDSCAPE+5; + MM_SOUNDSCAPE_SYNTH = MM_ENSONIQ_SOUNDSCAPE+6; + MM_SOUNDSCAPE_MIXER = MM_ENSONIQ_SOUNDSCAPE+7; + MM_SOUNDSCAPE_AUX = MM_ENSONIQ_SOUNDSCAPE+8; + +(* Product IDs for MM_FRONTIER - Frontier Design Group LLC *) + MM_FRONTIER_WAVECENTER_MIDIIN = 1; (* WaveCenter *) + MM_FRONTIER_WAVECENTER_MIDIOUT = 2; + MM_FRONTIER_WAVECENTER_WAVEIN = 3; + MM_FRONTIER_WAVECENTER_WAVEOUT = 4; + +(* Product IDs for MM_GADGETLABS - Gadget Labs LLC *) + MM_GADGETLABS_WAVE44_WAVEIN = 1; + MM_GADGETLABS_WAVE44_WAVEOUT = 2; + MM_GADGETLABS_WAVE42_WAVEIN = 3; + MM_GADGETLABS_WAVE42_WAVEOUT = 4; + MM_GADGETLABS_WAVE4_MIDIIN = 5; + MM_GADGETLABS_WAVE4_MIDIOUT = 6; + +(* Product IDs for MM_KAY_ELEMETRICS - Kay Elemetrics, Inc. *) + MM_KAY_ELEMETRICS_CSL = $4300; + MM_KAY_ELEMETRICS_CSL_DAT = $4308; + MM_KAY_ELEMETRICS_CSL_4CHANNEL = $4309; + +(* Product IDs for MM_LERNOUT_AND_HAUSPIE - Lernout & Hauspie *) + MM_LERNOUT_ANDHAUSPIE_LHCODECACM = 1; + +(* Product IDs for MM_MPTUS - M.P. Technologies, Inc. *) + MM_MPTUS_SPWAVEOUT = 1; (* Sound Pallette *) + +(* Product IDs for MM_MOTU - Mark of the Unicorn *) + MM_MOTU_MTP_MIDIOUT_ALL = 100; + MM_MOTU_MTP_MIDIIN_1 = 101; + MM_MOTU_MTP_MIDIOUT_1 = 101; + MM_MOTU_MTP_MIDIIN_2 = 102; + MM_MOTU_MTP_MIDIOUT_2 = 102; + MM_MOTU_MTP_MIDIIN_3 = 103; + MM_MOTU_MTP_MIDIOUT_3 = 103; + MM_MOTU_MTP_MIDIIN_4 = 104; + MM_MOTU_MTP_MIDIOUT_4 = 104; + MM_MOTU_MTP_MIDIIN_5 = 105; + MM_MOTU_MTP_MIDIOUT_5 = 105; + MM_MOTU_MTP_MIDIIN_6 = 106; + MM_MOTU_MTP_MIDIOUT_6 = 106; + MM_MOTU_MTP_MIDIIN_7 = 107; + MM_MOTU_MTP_MIDIOUT_7 = 107; + MM_MOTU_MTP_MIDIIN_8 = 108; + MM_MOTU_MTP_MIDIOUT_8 = 108; + + MM_MOTU_MTPII_MIDIOUT_ALL = 200; + MM_MOTU_MTPII_MIDIIN_SYNC = 200; + MM_MOTU_MTPII_MIDIIN_1 = 201; + MM_MOTU_MTPII_MIDIOUT_1 = 201; + MM_MOTU_MTPII_MIDIIN_2 = 202; + MM_MOTU_MTPII_MIDIOUT_2 = 202; + MM_MOTU_MTPII_MIDIIN_3 = 203; + MM_MOTU_MTPII_MIDIOUT_3 = 203; + MM_MOTU_MTPII_MIDIIN_4 = 204; + MM_MOTU_MTPII_MIDIOUT_4 = 204; + MM_MOTU_MTPII_MIDIIN_5 = 205; + MM_MOTU_MTPII_MIDIOUT_5 = 205; + MM_MOTU_MTPII_MIDIIN_6 = 206; + MM_MOTU_MTPII_MIDIOUT_6 = 206; + MM_MOTU_MTPII_MIDIIN_7 = 207; + MM_MOTU_MTPII_MIDIOUT_7 = 207; + MM_MOTU_MTPII_MIDIIN_8 = 208; + MM_MOTU_MTPII_MIDIOUT_8 = 208; + MM_MOTU_MTPII_NET_MIDIIN_1 = 209; + MM_MOTU_MTPII_NET_MIDIOUT_1 = 209; + MM_MOTU_MTPII_NET_MIDIIN_2 = 210; + MM_MOTU_MTPII_NET_MIDIOUT_2 = 210; + MM_MOTU_MTPII_NET_MIDIIN_3 = 211; + MM_MOTU_MTPII_NET_MIDIOUT_3 = 211; + MM_MOTU_MTPII_NET_MIDIIN_4 = 212; + MM_MOTU_MTPII_NET_MIDIOUT_4 = 212; + MM_MOTU_MTPII_NET_MIDIIN_5 = 213; + MM_MOTU_MTPII_NET_MIDIOUT_5 = 213; + MM_MOTU_MTPII_NET_MIDIIN_6 = 214; + MM_MOTU_MTPII_NET_MIDIOUT_6 = 214; + MM_MOTU_MTPII_NET_MIDIIN_7 = 215; + MM_MOTU_MTPII_NET_MIDIOUT_7 = 215; + MM_MOTU_MTPII_NET_MIDIIN_8 = 216; + MM_MOTU_MTPII_NET_MIDIOUT_8 = 216; + + MM_MOTU_MXP_MIDIIN_MIDIOUT_ALL = 300; + MM_MOTU_MXP_MIDIIN_SYNC = 300; + MM_MOTU_MXP_MIDIIN_MIDIIN_1 = 301; + MM_MOTU_MXP_MIDIIN_MIDIOUT_1 = 301; + MM_MOTU_MXP_MIDIIN_MIDIIN_2 = 302; + MM_MOTU_MXP_MIDIIN_MIDIOUT_2 = 302; + MM_MOTU_MXP_MIDIIN_MIDIIN_3 = 303; + MM_MOTU_MXP_MIDIIN_MIDIOUT_3 = 303; + MM_MOTU_MXP_MIDIIN_MIDIIN_4 = 304; + MM_MOTU_MXP_MIDIIN_MIDIOUT_4 = 304; + MM_MOTU_MXP_MIDIIN_MIDIIN_5 = 305; + MM_MOTU_MXP_MIDIIN_MIDIOUT_5 = 305; + MM_MOTU_MXP_MIDIIN_MIDIIN_6 = 306; + MM_MOTU_MXP_MIDIIN_MIDIOUT_6 = 306; + + MM_MOTU_MXPMPU_MIDIOUT_ALL = 400; + MM_MOTU_MXPMPU_MIDIIN_SYNC = 400; + MM_MOTU_MXPMPU_MIDIIN_1 = 401; + MM_MOTU_MXPMPU_MIDIOUT_1 = 401; + MM_MOTU_MXPMPU_MIDIIN_2 = 402; + MM_MOTU_MXPMPU_MIDIOUT_2 = 402; + MM_MOTU_MXPMPU_MIDIIN_3 = 403; + MM_MOTU_MXPMPU_MIDIOUT_3 = 403; + MM_MOTU_MXPMPU_MIDIIN_4 = 404; + MM_MOTU_MXPMPU_MIDIOUT_4 = 404; + MM_MOTU_MXPMPU_MIDIIN_5 = 405; + MM_MOTU_MXPMPU_MIDIOUT_5 = 405; + MM_MOTU_MXPMPU_MIDIIN_6 = 406; + MM_MOTU_MXPMPU_MIDIOUT_6 = 406; + + MM_MOTU_MXN_MIDIOUT_ALL = 500; + MM_MOTU_MXN_MIDIIN_SYNC = 500; + MM_MOTU_MXN_MIDIIN_1 = 501; + MM_MOTU_MXN_MIDIOUT_1 = 501; + MM_MOTU_MXN_MIDIIN_2 = 502; + MM_MOTU_MXN_MIDIOUT_2 = 502; + MM_MOTU_MXN_MIDIIN_3 = 503; + MM_MOTU_MXN_MIDIOUT_3 = 503; + MM_MOTU_MXN_MIDIIN_4 = 504; + MM_MOTU_MXN_MIDIOUT_4 = 504; + + MM_MOTU_FLYER_MIDI_IN_SYNC = 600; + MM_MOTU_FLYER_MIDI_IN_A = 601; + MM_MOTU_FLYER_MIDI_OUT_A = 601; + MM_MOTU_FLYER_MIDI_IN_B = 602; + MM_MOTU_FLYER_MIDI_OUT_B = 602; + + MM_MOTU_PKX_MIDI_IN_SYNC = 700; + MM_MOTU_PKX_MIDI_IN_A = 701; + MM_MOTU_PKX_MIDI_OUT_A = 701; + MM_MOTU_PKX_MIDI_IN_B = 702; + MM_MOTU_PKX_MIDI_OUT_B = 702; + + MM_MOTU_DTX_MIDI_IN_SYNC = 800; + MM_MOTU_DTX_MIDI_IN_A = 801; + MM_MOTU_DTX_MIDI_OUT_A = 801; + MM_MOTU_DTX_MIDI_IN_B = 802; + MM_MOTU_DTX_MIDI_OUT_B = 802; + + MM_MOTU_MTPAV_MIDIOUT_ALL = 900; + MM_MOTU_MTPAV_MIDIIN_SYNC = 900; + MM_MOTU_MTPAV_MIDIIN_1 = 901; + MM_MOTU_MTPAV_MIDIOUT_1 = 901; + MM_MOTU_MTPAV_MIDIIN_2 = 902; + MM_MOTU_MTPAV_MIDIOUT_2 = 902; + MM_MOTU_MTPAV_MIDIIN_3 = 903; + MM_MOTU_MTPAV_MIDIOUT_3 = 903; + MM_MOTU_MTPAV_MIDIIN_4 = 904; + MM_MOTU_MTPAV_MIDIOUT_4 = 904; + MM_MOTU_MTPAV_MIDIIN_5 = 905; + MM_MOTU_MTPAV_MIDIOUT_5 = 905; + MM_MOTU_MTPAV_MIDIIN_6 = 906; + MM_MOTU_MTPAV_MIDIOUT_6 = 906; + MM_MOTU_MTPAV_MIDIIN_7 = 907; + MM_MOTU_MTPAV_MIDIOUT_7 = 907; + MM_MOTU_MTPAV_MIDIIN_8 = 908; + MM_MOTU_MTPAV_MIDIOUT_8 = 908; + MM_MOTU_MTPAV_NET_MIDIIN_1 = 909; + MM_MOTU_MTPAV_NET_MIDIOUT_1 = 909; + MM_MOTU_MTPAV_NET_MIDIIN_2 = 910; + MM_MOTU_MTPAV_NET_MIDIOUT_2 = 910; + MM_MOTU_MTPAV_NET_MIDIIN_3 = 911; + MM_MOTU_MTPAV_NET_MIDIOUT_3 = 911; + MM_MOTU_MTPAV_NET_MIDIIN_4 = 912; + MM_MOTU_MTPAV_NET_MIDIOUT_4 = 912; + MM_MOTU_MTPAV_NET_MIDIIN_5 = 913; + MM_MOTU_MTPAV_NET_MIDIOUT_5 = 913; + MM_MOTU_MTPAV_NET_MIDIIN_6 = 914; + MM_MOTU_MTPAV_NET_MIDIOUT_6 = 914; + MM_MOTU_MTPAV_NET_MIDIIN_7 = 915; + MM_MOTU_MTPAV_NET_MIDIOUT_7 = 915; + MM_MOTU_MTPAV_NET_MIDIIN_8 = 916; + MM_MOTU_MTPAV_NET_MIDIOUT_8 = 916; + MM_MOTU_MTPAV_MIDIIN_ADAT = 917; + MM_MOTU_MTPAV_MIDIOUT_ADAT = 917; + + +(* Product IDs for MM_MIRO - miro Computer Products AG *) + MM_MIRO_MOVIEPRO = 1; (* miroMOVIE pro *) + MM_MIRO_VIDEOD1 = 2; (* miroVIDEO D1 *) + MM_MIRO_VIDEODC1TV = 3; (* miroVIDEO DC1 tv *) + MM_MIRO_VIDEOTD = 4; (* miroVIDEO 10/20 TD *) + MM_MIRO_DC30_WAVEOUT = 5; + MM_MIRO_DC30_WAVEIN = 6; + MM_MIRO_DC30_MIX = 7; + +(* Product IDs for MM_NEC - NEC *) + MM_NEC_73_86_SYNTH = 5; + MM_NEC_73_86_WAVEOUT = 6; + MM_NEC_73_86_WAVEIN = 7; + MM_NEC_26_SYNTH = 9; + MM_NEC_MPU401_MIDIOUT = 10; + MM_NEC_MPU401_MIDIIN = 11; + MM_NEC_JOYSTICK = 12; + +(* Product IDs for MM_NORRIS - Norris Communications, Inc. *) + MM_NORRIS_VOICELINK = 1; + +(* Product IDs for MM_NORTHERN_TELECOM - Northern Telecom Limited *) + MM_NORTEL_MPXAC_WAVEIN = 1; (* MPX Audio Card Wave Input Device *) + MM_NORTEL_MPXAC_WAVEOUT = 2; (* MPX Audio Card Wave Output Device *) + +(* Product IDs for MM_NVIDIA - NVidia Corporation *) + MM_NVIDIA_WAVEOUT = 1; + MM_NVIDIA_WAVEIN = 2; + MM_NVIDIA_MIDIOUT = 3; + MM_NVIDIA_MIDIIN = 4; + MM_NVIDIA_GAMEPORT = 5; + MM_NVIDIA_MIXER = 6; + MM_NVIDIA_AUX = 7; + +(* Product IDs for MM_OKSORI - OKSORI Co., Ltd. *) + MM_OKSORI_BASE = 0; (* Oksori Base *) + MM_OKSORI_OSR8_WAVEOUT = MM_OKSORI_BASE+1; (* Oksori 8bit Wave out *) + MM_OKSORI_OSR8_WAVEIN = MM_OKSORI_BASE+2; (* Oksori 8bit Wave in *) + MM_OKSORI_OSR16_WAVEOUT = MM_OKSORI_BASE+3; (* Oksori 16 bit Wave out *) + MM_OKSORI_OSR16_WAVEIN = MM_OKSORI_BASE+4; (* Oksori 16 bit Wave in *) + MM_OKSORI_FM_OPL4 = MM_OKSORI_BASE+5; (* Oksori FM Synth Yamaha OPL4 *) + MM_OKSORI_MIX_MASTER = MM_OKSORI_BASE+6; (* Oksori DSP Mixer - Master Volume *) + MM_OKSORI_MIX_WAVE = MM_OKSORI_BASE+7; (* Oksori DSP Mixer - Wave Volume *) + MM_OKSORI_MIX_FM = MM_OKSORI_BASE+8; (* Oksori DSP Mixer - FM Volume *) + MM_OKSORI_MIX_LINE = MM_OKSORI_BASE+9; (* Oksori DSP Mixer - Line Volume *) + MM_OKSORI_MIX_CD = MM_OKSORI_BASE+10; (* Oksori DSP Mixer - CD Volume *) + MM_OKSORI_MIX_MIC = MM_OKSORI_BASE+11; (* Oksori DSP Mixer - MIC Volume *) + MM_OKSORI_MIX_ECHO = MM_OKSORI_BASE+12; (* Oksori DSP Mixer - Echo Volume *) + MM_OKSORI_MIX_AUX1 = MM_OKSORI_BASE+13; (* Oksori AD1848 - AUX1 Volume *) + MM_OKSORI_MIX_LINE1 = MM_OKSORI_BASE+14; (* Oksori AD1848 - LINE1 Volume *) + MM_OKSORI_EXT_MIC1 = MM_OKSORI_BASE+15; (* Oksori External - One Mic Connect *) + MM_OKSORI_EXT_MIC2 = MM_OKSORI_BASE+16; (* Oksori External - Two Mic Connect *) + MM_OKSORI_MIDIOUT = MM_OKSORI_BASE+17; (* Oksori MIDI Out Device *) + MM_OKSORI_MIDIIN = MM_OKSORI_BASE+18; (* Oksori MIDI In Device *) + MM_OKSORI_MPEG_CDVISION = MM_OKSORI_BASE+19; (* Oksori CD-Vision MPEG Decoder *) + +(* Product IDs for MM_OSITECH - Ositech Communications Inc. *) + MM_OSITECH_TRUMPCARD = 1; (* Trumpcard *) + +(* Product IDs for MM_OSPREY - Osprey Technologies, Inc. *) + MM_OSPREY_1000WAVEIN = 1; + MM_OSPREY_1000WAVEOUT = 2; + +(* Product IDs for MM_QUARTERDECK - Quarterdeck Corporation *) + MM_QUARTERDECK_LHWAVEIN = 0; (* Quarterdeck L&H Codec Wave In *) + MM_QUARTERDECK_LHWAVEOUT = 1; (* Quarterdeck L&H Codec Wave Out *) + +(* Product IDs for MM_RHETOREX - Rhetorex Inc *) + MM_RHETOREX_WAVEIN = 1; + MM_RHETOREX_WAVEOUT = 2; + +(* Product IDs for MM_ROCKWELL - Rockwell International *) + MM_VOICEMIXER = 1; + ROCKWELL_WA1_WAVEIN = 100; + ROCKWELL_WA1_WAVEOUT = 101; + ROCKWELL_WA1_SYNTH = 102; + ROCKWELL_WA1_MIXER = 103; + ROCKWELL_WA1_MPU401_IN = 104; + ROCKWELL_WA1_MPU401_OUT = 105; + ROCKWELL_WA2_WAVEIN = 200; + ROCKWELL_WA2_WAVEOUT = 201; + ROCKWELL_WA2_SYNTH = 202; + ROCKWELL_WA2_MIXER = 203; + ROCKWELL_WA2_MPU401_IN = 204; + ROCKWELL_WA2_MPU401_OUT = 205; + +(* Product IDs for MM_S3 - S3 *) + MM_S3_WAVEOUT = $1; + MM_S3_WAVEIN = $2; + MM_S3_MIDIOUT = $3; + MM_S3_MIDIIN = $4; + MM_S3_FMSYNTH = $5; + MM_S3_MIXER = $6; + MM_S3_AUX = $7; + +(* Product IDs for MM_SEERSYS - Seer Systems, Inc. *) + MM_SEERSYS_SEERSYNTH = 1; + MM_SEERSYS_SEERWAVE = 2; + MM_SEERSYS_SEERMIX = 3; + +(* Product IDs for MM_SOFTSOUND - Softsound, Ltd. *) + MM_SOFTSOUND_CODEC = 1; + +(* Product IDs for MM_SOUNDESIGNS - SounDesignS M.C.S. Ltd. *) + MM_SOUNDESIGNS_WAVEIN = 1; + MM_SOUNDESIGNS_WAVEOUT = 2; + +(* Product IDs for MM_SPECTRUM_SIGNAL_PROCESSING - Spectrum Signal Processing, Inc. *) + MM_SSP_SNDFESWAVEIN = 1; (* Sound Festa Wave In Device *) + MM_SSP_SNDFESWAVEOUT = 2; (* Sound Festa Wave Out Device *) + MM_SSP_SNDFESMIDIIN = 3; (* Sound Festa MIDI In Device *) + MM_SSP_SNDFESMIDIOUT = 4; (* Sound Festa MIDI Out Device *) + MM_SSP_SNDFESSYNTH = 5; (* Sound Festa MIDI Synth Device *) + MM_SSP_SNDFESMIX = 6; (* Sound Festa Mixer Device *) + MM_SSP_SNDFESAUX = 7; (* Sound Festa Auxilliary Device *) + +(* Product IDs for MM_TDK - TDK Corporation *) + MM_TDK_MW_MIDI_SYNTH = 1; + MM_TDK_MW_MIDI_IN = 2; + MM_TDK_MW_MIDI_OUT = 3; + MM_TDK_MW_WAVE_IN = 4; + MM_TDK_MW_WAVE_OUT = 5; + MM_TDK_MW_AUX = 6; + MM_TDK_MW_MIXER = 10; + MM_TDK_MW_AUX_MASTER = 100; + MM_TDK_MW_AUX_BASS = 101; + MM_TDK_MW_AUX_TREBLE = 102; + MM_TDK_MW_AUX_MIDI_VOL = 103; + MM_TDK_MW_AUX_WAVE_VOL = 104; + MM_TDK_MW_AUX_WAVE_RVB = 105; + MM_TDK_MW_AUX_WAVE_CHR = 106; + MM_TDK_MW_AUX_VOL = 107; + MM_TDK_MW_AUX_RVB = 108; + MM_TDK_MW_AUX_CHR = 109; + +(* Product IDs for MM_TURTLE_BEACH - Turtle Beach, Inc. *) + MM_TBS_TROPEZ_WAVEIN = 37; + MM_TBS_TROPEZ_WAVEOUT = 38; + MM_TBS_TROPEZ_AUX1 = 39; + MM_TBS_TROPEZ_AUX2 = 40; + MM_TBS_TROPEZ_LINE = 41; + +(* Product IDs for MM_VIENNASYS - Vienna Systems *) + MM_VIENNASYS_TSP_WAVE_DRIVER = 1; + +(* Product IDs for MM_VIONA - Viona Development GmbH *) + MM_VIONA_QVINPCI_MIXER = 1; (* Q-Motion PCI II/Bravado 2000 *) + MM_VIONA_QVINPCI_WAVEIN = 2; + MM_VIONAQVINPCI_WAVEOUT = 3; + MM_VIONA_BUSTER_MIXER = 4; (* Buster *) + MM_VIONA_CINEMASTER_MIXER = 5; (* Cinemaster *) + MM_VIONA_CONCERTO_MIXER = 6; (* Concerto *) + +(* Product IDs for MM_WILDCAT - Wildcat Canyon Software *) + MM_WILDCAT_AUTOSCOREMIDIIN = 1; (* Autoscore *) + +(* Product IDs for MM_WILLOWPOND - Willow Pond Corporation *) + MM_WILLOWPOND_FMSYNTH_STEREO = 20; + MM_WILLOWPOND_SNDPORT_WAVEIN = 100; + MM_WILLOWPOND_SNDPORT_WAVEOUT = 101; + MM_WILLOWPOND_SNDPORT_MIXER = 102; + MM_WILLOWPOND_SNDPORT_AUX = 103; + MM_WILLOWPOND_PH_WAVEIN = 104; + MM_WILLOWPOND_PH_WAVEOUT = 105; + MM_WILLOWPOND_PH_MIXER = 106; + MM_WILLOWPOND_PH_AUX = 107; + +(* Product IDs for MM_WORKBIT - Workbit Corporation *) + MM_WORKBIT_MIXER = 1; (* Harmony Mixer *) + MM_WORKBIT_WAVEOUT = 2; (* Harmony Mixer *) + MM_WORKBIT_WAVEIN = 3; (* Harmony Mixer *) + MM_WORKBIT_MIDIIN = 4; (* Harmony Mixer *) + MM_WORKBIT_MIDIOUT = 5; (* Harmony Mixer *) + MM_WORKBIT_FMSYNTH = 6; (* Harmony Mixer *) + MM_WORKBIT_AUX = 7; (* Harmony Mixer *) + MM_WORKBIT_JOYSTICK = 8; + +(* Product IDs for MM_FRAUNHOFER_IIS - Fraunhofer *) + MM_FHGIIS_MPEGLAYER3 = 10; + +{(*)///////////////////////////////////////////////////////////////////////// *) + +(* INFO LIST CHUNKS (from the Multimedia Programmer's Reference + plus new ones) *) + RIFFINFO_IARL = mmioFOURCC ('I', 'A', 'R', 'L'); (*Archival location *) +#define RIFFINFO_IART mmioFOURCC ('I', 'A', 'R', 'T') (*Artist *) +#define RIFFINFO_ICMS mmioFOURCC ('I', 'C', 'M', 'S') (*Commissioned *) +#define RIFFINFO_ICMT mmioFOURCC ('I', 'C', 'M', 'T') (*Comments *) +#define RIFFINFO_ICOP mmioFOURCC ('I', 'C', 'O', 'P') (*Copyright *) +#define RIFFINFO_ICRD mmioFOURCC ('I', 'C', 'R', 'D') (*Creation date of subject *) +#define RIFFINFO_ICRP mmioFOURCC ('I', 'C', 'R', 'P') (*Cropped *) +#define RIFFINFO_IDIM mmioFOURCC ('I', 'D', 'I', 'M') (*Dimensions *) +#define RIFFINFO_IDPI mmioFOURCC ('I', 'D', 'P', 'I') (*Dots per inch *) +#define RIFFINFO_IENG mmioFOURCC ('I', 'E', 'N', 'G') (*Engineer *) +#define RIFFINFO_IGNR mmioFOURCC ('I', 'G', 'N', 'R') (*Genre *) +#define RIFFINFO_IKEY mmioFOURCC ('I', 'K', 'E', 'Y') (*Keywords *) +#define RIFFINFO_ILGT mmioFOURCC ('I', 'L', 'G', 'T') (*Lightness settings *) +#define RIFFINFO_IMED mmioFOURCC ('I', 'M', 'E', 'D') (*Medium *) +#define RIFFINFO_INAM mmioFOURCC ('I', 'N', 'A', 'M') (*Name of subject *) +#define RIFFINFO_IPLT mmioFOURCC ('I', 'P', 'L', 'T') (*Palette Settings. No. of colors requested. *) +#define RIFFINFO_IPRD mmioFOURCC ('I', 'P', 'R', 'D') (*Product *) +#define RIFFINFO_ISBJ mmioFOURCC ('I', 'S', 'B', 'J') (*Subject description *) +#define RIFFINFO_ISFT mmioFOURCC ('I', 'S', 'F', 'T') (*Software. Name of package used to create file. *) +#define RIFFINFO_ISHP mmioFOURCC ('I', 'S', 'H', 'P') (*Sharpness. *) +#define RIFFINFO_ISRC mmioFOURCC ('I', 'S', 'R', 'C') (*Source. *) +#define RIFFINFO_ISRF mmioFOURCC ('I', 'S', 'R', 'F') (*Source Form. ie slide, paper *) +#define RIFFINFO_ITCH mmioFOURCC ('I', 'T', 'C', 'H') (*Technician who digitized the subject. *) + +(* New INFO Chunks as of August 30, 1993: *) +#define RIFFINFO_ISMP mmioFOURCC ('I', 'S', 'M', 'P') (*SMPTE time code *) +(* ISMP: SMPTE time code of digitization start point expressed as a NULL terminated + text string "HH:MM:SS:FF". If performing MCI capture in AVICAP, this + chunk will be automatically set based on the MCI start time. +*) +#define RIFFINFO_IDIT mmioFOURCC ('I', 'D', 'I', 'T') (*Digitization Time *) +(* IDIT: "Digitization Time" Specifies the time and date that the digitization commenced. + The digitization time is contained in an ASCII string which + contains exactly 26 characters and is in the format + "Wed Jan 02 02:03:55 1990\n\0". + The ctime(), asctime(), functions can be used to create strings + in this format. This chunk is automatically added to the capture + file based on the current system time at the moment capture is initiated. +*) + +(*Template line for new additions*) +(*#define RIFFINFO_I mmioFOURCC ('I', '', '', '') *) } + + +(* WAVE form wFormatTag IDs *) + WAVE_FORMAT_UNKNOWN =$0000; (* Microsoft Corporation *) + WAVE_FORMAT_ADPCM =$0002; (* Microsoft Corporation *) + WAVE_FORMAT_IEEE_FLOAT =$0003; (* Microsoft Corporation *) + (* IEEE754: range (+1, -1] *) + (* 32-bit/64-bit format as defined by *) + (* MSVC++ float/double type *) + WAVE_FORMAT_IBM_CVSD =$0005; (* IBM Corporation *) + WAVE_FORMAT_ALAW =$0006; (* Microsoft Corporation *) + WAVE_FORMAT_MULAW =$0007; (* Microsoft Corporation *) + WAVE_FORMAT_OKI_ADPCM =$0010; (* OKI *) + WAVE_FORMAT_DVI_ADPCM =$0011; (* Intel Corporation *) + WAVE_FORMAT_IMA_ADPCM =(WAVE_FORMAT_DVI_ADPCM); (* Intel Corporation *) + WAVE_FORMAT_MEDIASPACE_ADPCM =$0012; (* Videologic *) + WAVE_FORMAT_SIERRA_ADPCM =$0013; (* Sierra Semiconductor Corp *) + WAVE_FORMAT_G723_ADPCM =$0014; (* Antex Electronics Corporation *) + WAVE_FORMAT_DIGISTD =$0015; (* DSP Solutions, Inc. *) + WAVE_FORMAT_DIGIFIX =$0016; (* DSP Solutions, Inc. *) + WAVE_FORMAT_DIALOGIC_OKI_ADPCM =$0017; (* Dialogic Corporation *) + WAVE_FORMAT_MEDIAVISION_ADPCM =$0018; (* Media Vision, Inc. *) + WAVE_FORMAT_YAMAHA_ADPCM =$0020; (* Yamaha Corporation of America *) + WAVE_FORMAT_SONARC =$0021; (* Speech Compression *) + WAVE_FORMAT_DSPGROUP_TRUESPEECH =$0022; (* DSP Group, Inc *) + WAVE_FORMAT_ECHOSC1 =$0023; (* Echo Speech Corporation *) + WAVE_FORMAT_AUDIOFILE_AF36 =$0024; (* *) + WAVE_FORMAT_APTX =$0025; (* Audio Processing Technology *) + WAVE_FORMAT_AUDIOFILE_AF10 =$0026; (* *) + WAVE_FORMAT_DOLBY_AC2 =$0030; (* Dolby Laboratories *) + WAVE_FORMAT_GSM610 =$0031; (* Microsoft Corporation *) + WAVE_FORMAT_MSNAUDIO =$0032; (* Microsoft Corporation *) + WAVE_FORMAT_ANTEX_ADPCME =$0033; (* Antex Electronics Corporation *) + WAVE_FORMAT_CONTROL_RES_VQLPC =$0034; (* Control Resources Limited *) + WAVE_FORMAT_DIGIREAL =$0035; (* DSP Solutions, Inc. *) + WAVE_FORMAT_DIGIADPCM =$0036; (* DSP Solutions, Inc. *) + WAVE_FORMAT_CONTROL_RES_CR10 =$0037; (* Control Resources Limited *) + WAVE_FORMAT_NMS_VBXADPCM =$0038; (* Natural MicroSystems *) + WAVE_FORMAT_CS_IMAADPCM =$0039; (* Crystal Semiconductor IMA ADPCM *) + WAVE_FORMAT_ECHOSC3 =$003A; (* Echo Speech Corporation *) + WAVE_FORMAT_ROCKWELL_ADPCM =$003B; (* Rockwell International *) + WAVE_FORMAT_ROCKWELL_DIGITALK =$003C; (* Rockwell International *) + WAVE_FORMAT_XEBEC =$003D; (* Xebec Multimedia Solutions Limited *) + WAVE_FORMAT_G721_ADPCM =$0040; (* Antex Electronics Corporation *) + WAVE_FORMAT_G728_CELP =$0041; (* Antex Electronics Corporation *) + WAVE_FORMAT_MPEG =$0050; (* Microsoft Corporation *) + WAVE_FORMAT_MPEGLAYER3 =$0055; (* ISO/MPEG Layer3 Format Tag *) + WAVE_FORMAT_CIRRUS =$0060; (* Cirrus Logic *) + WAVE_FORMAT_ESPCM =$0061; (* ESS Technology *) + WAVE_FORMAT_VOXWARE =$0062; (* Voxware Inc *) + WAVEFORMAT_CANOPUS_ATRAC =$0063; (* Canopus, co., Ltd. *) + WAVE_FORMAT_G726_ADPCM =$0064; (* APICOM *) + WAVE_FORMAT_G722_ADPCM =$0065; (* APICOM *) + WAVE_FORMAT_DSAT =$0066; (* Microsoft Corporation *) + WAVE_FORMAT_DSAT_DISPLAY =$0067; (* Microsoft Corporation *) + WAVE_FORMAT_SOFTSOUND =$0080; (* Softsound, Ltd. *) + WAVE_FORMAT_RHETOREX_ADPCM =$0100; (* Rhetorex Inc *) + WAVE_FORMAT_CREATIVE_ADPCM =$0200; (* Creative Labs, Inc *) + WAVE_FORMAT_CREATIVE_FASTSPEECH8 =$0202; (* Creative Labs, Inc *) + WAVE_FORMAT_CREATIVE_FASTSPEECH10 =$0203; (* Creative Labs, Inc *) + WAVE_FORMAT_QUARTERDECK =$0220; (* Quarterdeck Corporation *) + WAVE_FORMAT_FM_TOWNS_SND =$0300; (* Fujitsu Corp. *) + WAVE_FORMAT_BTV_DIGITAL =$0400; (* Brooktree Corporation *) + WAVE_FORMAT_OLIGSM =$1000; (* Ing C. Olivetti & C., S.p.A. *) + WAVE_FORMAT_OLIADPCM =$1001; (* Ing C. Olivetti & C., S.p.A. *) + WAVE_FORMAT_OLICELP =$1002; (* Ing C. Olivetti & C., S.p.A. *) + WAVE_FORMAT_OLISBC =$1003; (* Ing C. Olivetti & C., S.p.A. *) + WAVE_FORMAT_OLIOPR =$1004; (* Ing C. Olivetti & C., S.p.A. *) + WAVE_FORMAT_LH_CODEC =$1100; (* Lernout & Hauspie *) + WAVE_FORMAT_NORRIS =$1400; (* Norris Communications, Inc. *) + +// +// the WAVE_FORMAT_DEVELOPMENT format tag can be used during the +// development phase of a new wave format. Before shipping, you MUST +// acquire an official format tag from Microsoft. +// + WAVE_FORMAT_DEVELOPMENT = ($FFFF); + + + ACM_MPEG_LAYER1 =($0001); + ACM_MPEG_LAYER2 =($0002); + ACM_MPEG_LAYER3 =($0004); + ACM_MPEG_STEREO =($0001); + ACM_MPEG_JOINTSTEREO =($0002); + ACM_MPEG_DUALCHANNEL =($0004); + ACM_MPEG_SINGLECHANNEL =($0008); + ACM_MPEG_PRIVATEBIT =($0001); + ACM_MPEG_COPYRIGHT =($0002); + ACM_MPEG_ORIGINALHOME =($0004); + ACM_MPEG_PROTECTIONBIT =($0008); + ACM_MPEG_ID_MPEG1 =($0010); + +// +// MPEG Layer3 WAVEFORMATEX structure +// for WAVE_FORMAT_MPEGLAYER3 ($0055) +// + MPEGLAYER3_WFX_EXTRA_BYTES = 12; + + MPEGLAYER3_ID_UNKNOWN = 0; + MPEGLAYER3_ID_MPEG = 1; + MPEGLAYER3_ID_CONSTANTFRAMESIZE = 2; + + MPEGLAYER3_FLAG_PADDING_ISO = $00000000; + MPEGLAYER3_FLAG_PADDING_ON = $00000001; + MPEGLAYER3_FLAG_PADDING_OFF = $00000002; + + WAVE_FILTER_UNKNOWN = $0000; + WAVE_FILTER_DEVELOPMENT =($FFFF); + + WAVE_FILTER_VOLUME = $0001; + WAVE_FILTER_ECHO = $0002; + + BI_BITFIELDS = 3; + + QUERYDIBSUPPORT = 3073; + QDI_SETDIBITS = $0001; + QDI_GETDIBITS = $0002; + QDI_DIBTOSCREEN = $0004; + QDI_STRETCHDIB = $0008; + + JPEG_PROCESS_BASELINE = 0; (* Baseline DCT *) + + +(* +// +// Microsoft MPEG audio WAV definition +// + MPEG-1 audio wave format (audio layer only). (0x0050) *) +type + PMPEG1WAVEFORMAT = ^MPEG1WAVEFORMAT; + mpeg1waveformat_tag = record + wfx: tWAVEFORMATEX; + fwHeadLayer: word; + dwHeadBitrate: dword; + fwHeadMode: word; + fwHeadModeExt: word; + wHeadEmphasis: word; + fwHeadFlags: word; + dwPTSLow: dword; + dwPTSHigh: dword; + end; + MPEG1WAVEFORMAT = mpeg1waveformat_tag; + +(* +// MPEG Layer3 WAVEFORMATEX structure +// for WAVE_FORMAT_MPEGLAYER3 (0x0055) +// +#define MPEGLAYER3_WFX_EXTRA_BYTES 12 + +// WAVE_FORMAT_MPEGLAYER3 format sructure *) + PMPEGLAYER3WAVEFORMAT = ^MPEGLAYER3WAVEFORMAT; + mpeglayer3waveformat_tag = record + wfx: tWAVEFORMATEX; + wID: word; + fdwFlags: dword; + nBlockSize: word; + nFramesPerBlock: word; + nCodecDelay: word; + end; + MPEGLAYER3WAVEFORMAT = mpeglayer3waveformat_tag; + +implementation + +end. diff --git a/Game/Code/lib/ffmpeg/opt.dcu b/Game/Code/lib/ffmpeg/opt.dcu new file mode 100644 index 00000000..c23af7e4 Binary files /dev/null and b/Game/Code/lib/ffmpeg/opt.dcu differ diff --git a/Game/Code/lib/ffmpeg/opt.pas b/Game/Code/lib/ffmpeg/opt.pas new file mode 100644 index 00000000..f78ef201 --- /dev/null +++ b/Game/Code/lib/ffmpeg/opt.pas @@ -0,0 +1,101 @@ +(* + * AVOptions + * copyright (c) 2005 Michael Niedermayer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*) +unit opt; + +interface + +uses + windows, rational; + +type + TAVOptionType = ( + FF_OPT_TYPE_FLAGS, + FF_OPT_TYPE_INT, + FF_OPT_TYPE_INT64, + FF_OPT_TYPE_DOUBLE, + FF_OPT_TYPE_FLOAT, + FF_OPT_TYPE_STRING, + FF_OPT_TYPE_RATIONAL, + FF_OPT_TYPE_CONST = 128 + ); + +const + av__codec = 'avcodec-51.dll'; + + AV_OPT_FLAG_ENCODING_PARAM = 1; ///< a generic parameter which can be set by the user for muxing or encoding + AV_OPT_FLAG_DECODING_PARAM = 2; ///< a generic parameter which can be set by the user for demuxing or decoding + AV_OPT_FLAG_METADATA = 4; ///< some data extracted or inserted into the file like title, comment, ... + AV_OPT_FLAG_AUDIO_PARAM = 8; + AV_OPT_FLAG_VIDEO_PARAM = 16; + AV_OPT_FLAG_SUBTITLE_PARAM = 32; + +type + PAVOption = ^TAVOption; + TAVOption = record + name: pchar; + help: pchar; + offset: integer; ///< offset to context structure where the parsed value should be stored + _type: TAVOptionType; + + default_val: double; + min: double; + max: double; + + flags: integer; +//FIXME think about enc-audio, ... style flags + _unit: pchar; + end; + + +function av_set_string (obj: pointer; name: pchar; val: pchar): PAVOption; + cdecl; external av__codec; + +function av_set_double (obj: pointer; name: pchar; n: double): PAVOption; + cdecl; external av__codec; + +function av_set_q (obj: pointer; name: pchar; n: TAVRational): PAVOption; + cdecl; external av__codec; + +function av_set_int (obj: pointer; name: pchar; n: int64): PAVOption; + cdecl; external av__codec; + +function av_get_double (obj: pointer; name: pchar; o_out: PPointer): double; + cdecl; external av__codec; + +function av_get_q (obj: pointer; name: pchar; o_out: PPointer): TAVRational; + cdecl; external av__codec; + +function av_get_int (obj: pointer; name: pchar; o_out: PPointer): int64; + cdecl; external av__codec; + +function av_get_string (obj: pointer; name: pchar; o_out: PPOinter; buf: pchar; buf_len: integer): pchar; + cdecl; external av__codec; + +function av_next_option (obj: pointer; last: PAVOption): PAVOption; + cdecl; external av__codec; + +function av_opt_show (obj: pointer; av_log_obj: pointer): integer; + cdecl; external av__codec; + +procedure av_opt_set_defaults (s: pointer); + cdecl; external av__codec; + +implementation + +end. diff --git a/Game/Code/lib/ffmpeg/rational.dcu b/Game/Code/lib/ffmpeg/rational.dcu new file mode 100644 index 00000000..51265ca0 Binary files /dev/null and b/Game/Code/lib/ffmpeg/rational.dcu differ diff --git a/Game/Code/lib/ffmpeg/rational.pas b/Game/Code/lib/ffmpeg/rational.pas new file mode 100644 index 00000000..a996e1df --- /dev/null +++ b/Game/Code/lib/ffmpeg/rational.pas @@ -0,0 +1,88 @@ +(* + * Rational numbers + * Copyright (c) 2003 Michael Niedermayer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) +unit rational; + +interface + +uses + windows; + +const + av__util = 'avutil-49.dll'; + +type + +(* + * Rational number num/den. *) + PAVRational = ^TAVRational; + TAVRational = record + num: integer; ///< numerator + den: integer; ///< denominator + end; + +(** + * returns 0 if a==b, 1 if a>b and -1 if a, + released to the public domain. } + + +{ A First-In First-Out circular buffer. + Port of circbuf.c from Microsoft's Windows MIDI monitor example. + I did do a version of this as an object (see Rev 1.1) but it was getting too + complicated and I couldn't see any real benefits to it so I dumped it + for an ordinary memory buffer with pointers. + + This unit is a bit C-like, everything is done with pointers and extensive + use is made of the undocumented feature of the Inc() function that + increments pointers by the size of the object pointed to. + All of this could probably be done using Pascal array notation with + range-checking turned off, but I'm not sure it's worth it. +} + +Unit Circbuf; + +interface + +Uses Wintypes, WinProcs, MMSystem; + +type + {$IFNDEF WIN32} + { API types not defined in Delphi 1 } + DWORD = Longint; + HGLOBAL = THandle; + UINT = Word; + TFNTimeCallBack = procedure(uTimerID, uMessage: UINT; dwUser, dw1, dw2: DWORD); + {$ENDIF} + + { MIDI input event } + TMidiBufferItem = record + timestamp: DWORD; { Timestamp in milliseconds after midiInStart } + data: DWORD; { MIDI message received } + sysex: PMidiHdr; { Pointer to sysex MIDIHDR, nil if not sysex } + end; + PMidiBufferItem = ^TMidiBufferItem; + + { MIDI input buffer } + TCircularBuffer = record + RecordHandle: HGLOBAL; { Windows memory handle for this record } + BufferHandle: HGLOBAL; { Windows memory handle for the buffer } + pStart: PMidiBufferItem; { ptr to start of buffer } + pEnd: PMidiBufferItem; { ptr to end of buffer } + pNextPut: PMidiBufferItem; { next location to fill } + pNextGet: PMidiBufferItem; { next location to empty } + Error: Word; { error code from MMSYSTEM functions } + Capacity: Word; { buffer size (in TMidiBufferItems) } + EventCount: Word; { Number of events in buffer } + end; + + PCircularBuffer = ^TCircularBuffer; + +function GlobalSharedLockedAlloc( Capacity: Word; var hMem: HGLOBAL ): Pointer; +procedure GlobalSharedLockedFree( hMem: HGLOBAL; ptr: Pointer ); + +function CircbufAlloc( Capacity: Word ): PCircularBuffer; +procedure CircbufFree( PBuffer: PCircularBuffer ); +function CircbufRemoveEvent( PBuffer: PCircularBuffer ): Boolean; +function CircbufReadEvent( PBuffer: PCircularBuffer; PEvent: PMidiBufferItem ): Boolean; +{ Note: The PutEvent function is in the DLL } + +implementation + +{ Allocates in global shared memory, returns pointer and handle } +function GlobalSharedLockedAlloc( Capacity: Word; var hMem: HGLOBAL ): Pointer; +var + ptr: Pointer; +begin + { Allocate the buffer memory } + hMem := GlobalAlloc(GMEM_SHARE Or GMEM_MOVEABLE Or GMEM_ZEROINIT, Capacity ); + + if (hMem = 0) then + ptr := Nil + else + begin + ptr := GlobalLock(hMem); + if (ptr = Nil) then + GlobalFree(hMem); + end; + +{$IFNDEF WIN32} + if (ptr <> Nil) then + GlobalPageLock(HIWORD(DWORD(ptr))); +{$ENDIF} + GlobalSharedLockedAlloc := Ptr; +end; + +procedure GlobalSharedLockedFree( hMem: HGLOBAL; ptr: Pointer ); +begin +{$IFNDEF WIN32} + if (ptr <> Nil) then + GlobalPageUnlock(HIWORD(DWORD(ptr))); +{$ENDIF} + if (hMem <> 0) then + begin + GlobalUnlock(hMem); + GlobalFree(hMem); + end; +end; + +function CircbufAlloc( Capacity: Word ): PCircularBuffer; +var + NewCircularBuffer: PCircularBuffer; + NewMIDIBuffer: PMidiBufferItem; + hMem: HGLOBAL; +begin + { TODO: Validate circbuf size, <64K } + NewCircularBuffer := + GlobalSharedLockedAlloc( Sizeof(TCircularBuffer), hMem ); + if (NewCircularBuffer <> Nil) then + begin + NewCircularBuffer^.RecordHandle := hMem; + NewMIDIBuffer := + GlobalSharedLockedAlloc( Capacity * Sizeof(TMidiBufferItem), hMem ); + if (NewMIDIBuffer = Nil) then + begin + { TODO: Exception here? } + GlobalSharedLockedFree( NewCircularBuffer^.RecordHandle, + NewCircularBuffer ); + NewCircularBuffer := Nil; + end + else + begin + NewCircularBuffer^.pStart := NewMidiBuffer; + { Point to item at end of buffer } + NewCircularBuffer^.pEnd := NewMidiBuffer; + Inc(NewCircularBuffer^.pEnd, Capacity); + { Start off the get and put pointers in the same position. These + will get out of sync as the interrupts start rolling in } + NewCircularBuffer^.pNextPut := NewMidiBuffer; + NewCircularBuffer^.pNextGet := NewMidiBuffer; + NewCircularBuffer^.Error := 0; + NewCircularBuffer^.Capacity := Capacity; + NewCircularBuffer^.EventCount := 0; + end; + end; + CircbufAlloc := NewCircularBuffer; +end; + +procedure CircbufFree( pBuffer: PCircularBuffer ); +begin + if (pBuffer <> Nil) then + begin + GlobalSharedLockedFree(pBuffer^.BufferHandle, pBuffer^.pStart); + GlobalSharedLockedFree(pBuffer^.RecordHandle, pBuffer); + end; +end; + +{ Reads first event in queue without removing it. + Returns true if successful, False if no events in queue } +function CircbufReadEvent( PBuffer: PCircularBuffer; PEvent: PMidiBufferItem ): Boolean; +var + PCurrentEvent: PMidiBufferItem; +begin + if (PBuffer^.EventCount <= 0) then + CircbufReadEvent := False + else + begin + PCurrentEvent := PBuffer^.PNextget; + + { Copy the object from the "tail" of the buffer to the caller's object } + PEvent^.Timestamp := PCurrentEvent^.Timestamp; + PEvent^.Data := PCurrentEvent^.Data; + PEvent^.Sysex := PCurrentEvent^.Sysex; + CircbufReadEvent := True; + end; +end; + +{ Remove current event from the queue } +function CircbufRemoveEvent(PBuffer: PCircularBuffer): Boolean; +begin + if (PBuffer^.EventCount > 0) then + begin + Dec( Pbuffer^.EventCount); + + { Advance the buffer pointer, with wrap } + Inc( Pbuffer^.PNextGet ); + If (PBuffer^.PNextGet = PBuffer^.PEnd) then + PBuffer^.PNextGet := PBuffer^.PStart; + + CircbufRemoveEvent := True; + end + else + CircbufRemoveEvent := False; +end; + +end. diff --git a/Game/Code/lib/midi/Circbuf.dcu b/Game/Code/lib/midi/Circbuf.dcu new file mode 100644 index 00000000..53f20d61 Binary files /dev/null and b/Game/Code/lib/midi/Circbuf.dcu differ diff --git a/Game/Code/lib/midi/DELPHMCB.PAS b/Game/Code/lib/midi/DELPHMCB.PAS new file mode 100644 index 00000000..23ce0e1a --- /dev/null +++ b/Game/Code/lib/midi/DELPHMCB.PAS @@ -0,0 +1,140 @@ +{ $Header: /MidiComp/DELPHMCB.PAS 2 10/06/97 7:33 Davec $ } + +{MIDI callback for Delphi, was DLL for Delphi 1} + +unit Delphmcb; + +{ These segment options required for the MIDI callback functions } +{$C PRELOAD FIXED PERMANENT} + +interface + +uses WinProcs, WinTypes, MMsystem, Circbuf, MidiDefs, MidiCons; + +{$IFDEF WIN32} +procedure midiHandler( + hMidiIn: HMidiIn; + wMsg: UINT; + dwInstance: DWORD; + dwParam1: DWORD; + dwParam2: DWORD); stdcall export; +function CircbufPutEvent(PBuffer: PCircularBuffer; PTheEvent: PMidiBufferItem): Boolean; stdcall; export; +{$ELSE} +procedure midiHandler( + hMidiIn: HMidiIn; + wMsg: Word; + dwInstance: DWORD; + dwParam1: DWORD; + dwParam2: DWORD); export; +function CircbufPutEvent(PBuffer: PCircularBuffer; PTheEvent: PMidiBufferItem): Boolean; export; +{$ENDIF} + +implementation + +{ Add an event to the circular input buffer. } +function CircbufPutEvent(PBuffer: PCircularBuffer; PTheEvent: PMidiBufferItem): Boolean; +begin + If (PBuffer^.EventCount < PBuffer^.Capacity) Then + begin + Inc(Pbuffer^.EventCount); + + { Todo: better way of copying this record } + with PBuffer^.PNextput^ do + begin + Timestamp := PTheEvent^.Timestamp; + Data := PTheEvent^.Data; + Sysex := PTheEvent^.Sysex; + end; + + { Move to next put location, with wrap } + Inc(Pbuffer^.PNextPut); + If (PBuffer^.PNextPut = PBuffer^.PEnd) then + PBuffer^.PNextPut := PBuffer^.PStart; + + CircbufPutEvent := True; + end + else + CircbufPutEvent := False; +end; + +{ This is the callback function specified when the MIDI device was opened + by midiInOpen. It's called at interrupt time when MIDI input is seen + by the MIDI device driver(s). See the docs for midiInOpen for restrictions + on the Windows functions that can be called in this interrupt. } +procedure midiHandler( + hMidiIn: HMidiIn; + wMsg: UINT; + dwInstance: DWORD; + dwParam1: DWORD; + dwParam2: DWORD); + +var + thisEvent: TMidiBufferItem; + thisCtlInfo: PMidiCtlInfo; + thisBuffer: PCircularBuffer; + +Begin + case wMsg of + + mim_Open: {nothing}; + + mim_Error: {TODO: handle (message to trigger exception?) }; + + mim_Data, mim_Longdata, mim_Longerror: + { Note: mim_Longerror included because there's a bug in the Maui + input driver that sends MIM_LONGERROR for subsequent buffers when + the input buffer is smaller than the sysex block being received } + + begin + { TODO: Make filtered messages customisable, I'm sure someone wants to + do something with MTC! } + if (dwParam1 <> MIDI_ACTIVESENSING) and + (dwParam1 <> MIDI_TIMINGCLOCK) then + begin + + { The device driver passes us the instance data pointer we + specified for midiInOpen. Use this to get the buffer address + and window handle for the MIDI control } + thisCtlInfo := PMidiCtlInfo(dwInstance); + thisBuffer := thisCtlInfo^.PBuffer; + + { Screen out short messages if we've been asked to } + if ((wMsg <> mim_Data) or (thisCtlInfo^.SysexOnly = False)) + and (thisCtlInfo <> Nil) and (thisBuffer <> Nil) then + begin + with thisEvent do + begin + timestamp := dwParam2; + if (wMsg = mim_Longdata) or + (wMsg = mim_Longerror) then + begin + data := 0; + sysex := PMidiHdr(dwParam1); + end + else + begin + data := dwParam1; + sysex := Nil; + end; + end; + if CircbufPutEvent( thisBuffer, @thisEvent ) then + { Send a message to the control to say input's arrived } + PostMessage(thisCtlInfo^.hWindow, mim_Data, 0, 0) + else + { Buffer overflow } + PostMessage(thisCtlInfo^.hWindow, mim_Overflow, 0, 0); + end; + end; + end; + + mom_Done: { Sysex output complete, dwParam1 is pointer to MIDIHDR } + begin + { Notify the control that its sysex output is finished. + The control should call midiOutUnprepareHeader before freeing the buffer } + PostMessage(PMidiCtlInfo(dwInstance)^.hWindow, mom_Done, 0, dwParam1); + end; + + end; { Case } +end; + +end. diff --git a/Game/Code/lib/midi/Delphmcb.dcu b/Game/Code/lib/midi/Delphmcb.dcu new file mode 100644 index 00000000..becf0c2f Binary files /dev/null and b/Game/Code/lib/midi/Delphmcb.dcu differ diff --git a/Game/Code/lib/midi/MIDIDEFS.PAS b/Game/Code/lib/midi/MIDIDEFS.PAS new file mode 100644 index 00000000..4024c547 --- /dev/null +++ b/Game/Code/lib/midi/MIDIDEFS.PAS @@ -0,0 +1,47 @@ +{ $Header: /MidiComp/MIDIDEFS.PAS 2 10/06/97 7:33 Davec $ } + +{ Written by David Churcher , + released to the public domain. } + + +{ Common definitions used by DELPHMID.DPR and the MIDI components. + This must be a separate unit to prevent large chunks of the VCL being + linked into the DLL. } +unit Mididefs; + +interface + +uses WinProcs, WinTypes, MMsystem, Circbuf; + +type + + {-------------------------------------------------------------------} + { This is the information about the control that must be accessed by + the MIDI input callback function in the DLL at interrupt time } + PMidiCtlInfo = ^TMidiCtlInfo; + TMidiCtlInfo = record + hMem: THandle; { Memory handle for this record } + PBuffer: PCircularBuffer; { Pointer to the MIDI input data buffer } + hWindow: HWnd; { Control's window handle } + SysexOnly: Boolean; { Only process System Exclusive input } + end; + + { Information for the output timer callback function, also required at + interrupt time. } + PMidiOutTimerInfo = ^TMidiOutTimerInfo; + TMidiOutTimerInfo = record + hMem: THandle; { Memory handle for this record } + PBuffer: PCircularBuffer; { Pointer to MIDI output data buffer } + hWindow: HWnd; { Control's window handle } + TimeToNextEvent: DWORD; { Delay to next event after timer set } + MIDIHandle: HMidiOut; { MIDI handle to send output to + (copy of component's FMidiHandle property) } + PeriodMin: Word; { Multimedia timer minimum period supported } + PeriodMax: Word; { Multimedia timer maximum period supported } + TimerId: Word; { Multimedia timer ID of current event } + end; + +implementation + + +end. diff --git a/Game/Code/lib/midi/MIDIIN.DCR b/Game/Code/lib/midi/MIDIIN.DCR new file mode 100644 index 00000000..5d802695 Binary files /dev/null and b/Game/Code/lib/midi/MIDIIN.DCR differ diff --git a/Game/Code/lib/midi/MIDIOUT.DCR b/Game/Code/lib/midi/MIDIOUT.DCR new file mode 100644 index 00000000..d111c9be Binary files /dev/null and b/Game/Code/lib/midi/MIDIOUT.DCR differ diff --git a/Game/Code/lib/midi/MIDITYPE.PAS b/Game/Code/lib/midi/MIDITYPE.PAS new file mode 100644 index 00000000..0aa9cec3 --- /dev/null +++ b/Game/Code/lib/midi/MIDITYPE.PAS @@ -0,0 +1,79 @@ +{ $Header: /MidiComp/MIDITYPE.PAS 2 10/06/97 7:33 Davec $ } + +{ Written by David Churcher , + released to the public domain. } + + +unit Miditype; + +interface + +uses Classes, Wintypes, Messages, MMSystem, MidiDefs, Circbuf; + +type + {-------------------------------------------------------------------} + { A MIDI input/output event } + TMyMidiEvent = class(TPersistent) + public + MidiMessage: Byte; { MIDI message status byte } + Data1: Byte; { MIDI message data 1 byte } + Data2: Byte; { MIDI message data 2 byte } + Time: DWORD; { Time in ms since midiInOpen } + SysexLength: Word; { Length of sysex data (0 if none) } + Sysex: PChar; { Pointer to sysex data buffer } + destructor Destroy; override; { Frees sysex data buffer if nec. } + end; + PMyMidiEvent = ^TMyMidiEvent; + + {-------------------------------------------------------------------} + { Encapsulates the MIDIHDR with its memory handle and sysex buffer } + PMyMidiHdr = ^TMyMidiHdr; + TMyMidiHdr = class(TObject) + public + hdrHandle: THandle; + hdrPointer: PMIDIHDR; + sysexHandle: THandle; + sysexPointer: Pointer; + constructor Create(BufferSize: Word); + destructor Destroy; override; + end; + +implementation + +{-------------------------------------------------------------------} +{ Free any sysex buffer associated with the event } +destructor TMyMidiEvent.Destroy; +begin + if (Sysex <> Nil) then + Freemem(Sysex, SysexLength); + + inherited Destroy; +end; + +{-------------------------------------------------------------------} +{ Allocate memory for the sysex header and buffer } +constructor TMyMidiHdr.Create(BufferSize:Word); +begin + inherited Create; + + if BufferSize > 0 then + begin + hdrPointer := GlobalSharedLockedAlloc(sizeof(TMIDIHDR), hdrHandle); + sysexPointer := GlobalSharedLockedAlloc(BufferSize, sysexHandle); + + hdrPointer^.lpData := sysexPointer; + hdrPointer^.dwBufferLength := BufferSize; + end; +end; + +{-------------------------------------------------------------------} +destructor TMyMidiHdr.Destroy; +begin + GlobalSharedLockedFree( hdrHandle, hdrPointer ); + GlobalSharedLockedFree( sysexHandle, sysexPointer ); + inherited Destroy; +end; + + + +end. diff --git a/Game/Code/lib/midi/MidiCons.dcu b/Game/Code/lib/midi/MidiCons.dcu new file mode 100644 index 00000000..fdb38cfb Binary files /dev/null and b/Game/Code/lib/midi/MidiCons.dcu differ diff --git a/Game/Code/lib/midi/MidiDefs.dcu b/Game/Code/lib/midi/MidiDefs.dcu new file mode 100644 index 00000000..df0e8915 Binary files /dev/null and b/Game/Code/lib/midi/MidiDefs.dcu differ diff --git a/Game/Code/lib/midi/MidiFile.dcu b/Game/Code/lib/midi/MidiFile.dcu new file mode 100644 index 00000000..39038e82 Binary files /dev/null and b/Game/Code/lib/midi/MidiFile.dcu differ diff --git a/Game/Code/lib/midi/MidiFile.pas b/Game/Code/lib/midi/MidiFile.pas new file mode 100644 index 00000000..5c15481e --- /dev/null +++ b/Game/Code/lib/midi/MidiFile.pas @@ -0,0 +1,947 @@ +{ + Load a midifile and get access to tracks and events + I did build this component to convert midifiles to wave files + or play the files on a software synthesizer which I'm currenly + building. + + version 1.0 first release + + version 1.1 + added some function + function KeyToStr(key : integer) : string; + function MyTimeToStr(val : integer) : string; + Bpm can be set to change speed + + version 1.2 + added some functions + function GetTrackLength:integer; + function Ready: boolean; + + version 1.3 + update by Chulwoong, + He knows how to use the MM timer, the timing is much better now, thank you + + for comments/bugs + F.Bouwmans + fbouwmans@spiditel.nl + + if you think this component is nice and you use it, sent me a short email. + I've seen that other of my components have been downloaded a lot, but I've + got no clue wether they are actually used. + Don't worry because you are free to use these components + + Timing has improved, however because the messages are handled by the normal + windows message loop (of the main window) it is still influenced by actions + done on the window (minimize/maximize ..). + Use of a second thread with higher priority which only handles the + timer message should increase performance. If somebody knows such a component + which is freeware please let me know. + + interface description: + + procedure ReadFile: + actually read the file which is set in Filename + + function GetTrack(index: integer) : TMidiTrack; + + property Filename + set/read filename of midifile + + property NumberOfTracks + read number of tracks in current file + + property TicksPerQuarter: integer + ticks per quarter, tells how to interpret the time value in midi events + + property FileFormat: TFileFormat + tells the format of the current midifile + + property Bpm:integer + tells Beats per minut + + property OnMidiEvent:TOnMidiEvent + called while playing for each midi event + + procedure StartPlaying; + start playing the current loaded midifile from the beginning + + procedure StopPlaying; + stop playing the current midifile + + procedure PlayToTime(time : integer); + if playing yourself then events from last time to this time are produced + + + function KeyToStr(key : integer) : string; + give note string on key value: e.g. C4 + + function MyTimeToStr(val : integer) : string; + give time string from msec time + + function GetTrackLength:integer; + gives the track lenght in msec (assuming the bpm at the start oof the file) + + function Ready: boolean; + now you can check wether the playback is finished + +} + +unit MidiFile; + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + stdctrls, ExtCtrls, WinProcs; +type + TChunkType = (illegal, header, track); + TFileFormat = (single, multi_synch, multi_asynch); + PByte = ^byte; + + TMidiEvent = record + event: byte; + data1: byte; + data2: byte; + str: string; + dticks: integer; + time: integer; + mtime: integer; + len: integer; + end; + PMidiEvent = ^TMidiEvent; + + TOnMidiEvent = procedure(event: PMidiEvent) of object; + TEvent = procedure of object; + + TMidiTrack = class(TObject) + protected + events: TList; + name: string; + instrument: string; + currentTime: integer; + currentPos: integer; + ready: boolean; + trackLenght: integer; + procedure checkReady; + public + OnMidiEvent: TOnMidiEvent; + OnTrackReady: TEvent; + constructor Create; + destructor Destroy; override; + + procedure Rewind(pos: integer); + procedure PlayUntil(pos: integer); + procedure GoUntil(pos: integer); + + procedure putEvent(event: PMidiEvent); + function getEvent(index: integer): PMidiEvent; + function getName: string; + function getInstrument: string; + function getEventCount: integer; + function getCurrentTime: integer; + function getTrackLength: integer; + function isReady:boolean; + end; + + TMidiFile = class(TComponent) + private + { Private declarations } + procedure MidiTimer(sender : TObject); + procedure WndProc(var Msg : TMessage); + protected + { Protected declarations } + midiFile: file of byte; + chunkType: TChunkType; + chunkLength: integer; + chunkData: PByte; + chunkIndex: PByte; + chunkEnd: PByte; + FPriority: DWORD; + + // midi file attributes + FFileFormat: TFileFormat; + numberTracks: integer; + deltaTicks: integer; + FBpm: integer; + FBeatsPerMeasure: integer; + FusPerTick: double; + FFilename: string; + + Tracks: TList; + currentTrack: TMidiTrack; + FOnMidiEvent: TOnMidiEvent; + FOnUpdateEvent: TNotifyEvent; + + // playing attributes + playing: boolean; + PlayStartTime: integer; + currentTime: integer; // Current playtime in msec + currentPos: Double; // Current Position in ticks + + procedure OnTrackReady; + procedure setFilename(val: string); + procedure ReadChunkHeader; + procedure ReadChunkContent; + procedure ReadChunk; + procedure ProcessHeaderChunk; + procedure ProcessTrackChunk; + function ReadVarLength: integer; + function ReadString(l: integer): string; + procedure SetOnMidiEvent(handler: TOnMidiEvent); + procedure SetBpm(val: integer); + public + { Public declarations } + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + + procedure ReadFile; + function GetTrack(index: integer): TMidiTrack; + + procedure StartPlaying; + procedure StopPlaying; + procedure ContinuePlaying; + + procedure PlayToTime(time: integer); + procedure GoToTime(time: integer); + function GetCurrentTime: integer; + function GetFusPerTick : Double; + function GetTrackLength:integer; + function Ready: boolean; + published + { Published declarations } + property Filename: string read FFilename write setFilename; + property NumberOfTracks: integer read numberTracks; + property TicksPerQuarter: integer read deltaTicks; + property FileFormat: TFileFormat read FFileFormat; + property Bpm: integer read FBpm write SetBpm; + property OnMidiEvent: TOnMidiEvent read FOnMidiEvent write SetOnMidiEvent; + property OnUpdateEvent: TNotifyEvent read FOnUpdateEvent write FOnUpdateEvent; + end; + +function KeyToStr(key: integer): string; +function MyTimeToStr(val: integer): string; +procedure Register; + +implementation + +uses mmsystem; + +type TTimerProc=procedure(uTimerID,uMsg: Integer; dwUser,dwParam1,dwParam2:DWORD);stdcall; + +const TIMER_RESOLUTION=10; +const WM_MULTIMEDIA_TIMER=WM_USER+127; + +var MIDIFileHandle : HWND; + TimerProc : TTimerProc; + MIDITimerID : Integer; + TimerPeriod : Integer; + +procedure TimerCallBackProc(uTimerID,uMsg: Integer; dwUser,dwParam1,dwParam2:DWORD);stdcall; +begin + PostMessage(HWND(dwUser),WM_MULTIMEDIA_TIMER,0,0); +end; + +procedure SetMIDITimer; + var TimeCaps : TTimeCaps ; +begin + timeGetDevCaps(@TimeCaps,SizeOf(TimeCaps)); + if TIMER_RESOLUTION < TimeCaps.wPeriodMin then + TimerPeriod:=TimeCaps.wPeriodMin + else if TIMER_RESOLUTION > TimeCaps.wPeriodMax then + TimerPeriod:=TimeCaps.wPeriodMax + else + TimerPeriod:=TIMER_RESOLUTION; + + timeBeginPeriod(TimerPeriod); + MIDITimerID:=timeSetEvent(TimerPeriod,TimerPeriod,@TimerProc, + DWORD(MIDIFileHandle),TIME_PERIODIC); + if MIDITimerID=0 then + timeEndPeriod(TimerPeriod); +end; + +procedure KillMIDITimer; +begin + timeKillEvent(MIDITimerID); + timeEndPeriod(TimerPeriod); +end; + +constructor TMidiTrack.Create; +begin + inherited Create; + events := TList.Create; + currentTime := 0; + currentPos := 0; +end; + +destructor TMidiTrack.Destroy; +var + i: integer; +begin + for i := 0 to events.count - 1 do + Dispose(PMidiEvent(events.items[i])); + events.Free; + inherited Destroy; +end; + +procedure TMidiTRack.putEvent(event: PMidiEvent); +var + command: integer; + i: integer; + pevent: PMidiEvent; +begin + if (event.event = $FF) then + begin + if (event.data1 = 3) then + name := event.str; + if (event.data1 = 4) then + instrument := event.str; + end; + currentTime := currentTime + event.dticks; + event.time := currentTime; // for the moment just add dticks + event.len := 0; + events.add(TObject(event)); + command := event.event and $F0; + + if ((command = $80) // note off + or ((command = $90) and (event.data2 = 0))) //note on with speed 0 + then + begin + // this is a note off, try to find the accompanion note on + command := event.event or $90; + i := events.count - 2; + while i >= 0 do + begin + pevent := PMidiEvent(events[i]); + if (pevent.event = command) and + (pevent.data1 = event.data1) + then + begin + pevent.len := currentTIme - pevent.time; + i := 0; + event.len := -1; + end; + dec(i); + end; + end; +end; + +function TMidiTrack.getName: string; +begin + result := name; +end; + +function TMidiTrack.getInstrument: string; +begin + result := instrument; +end; + +function TMiditrack.getEventCount: integer; +begin + result := events.count; +end; + +function TMiditrack.getEvent(index: integer): PMidiEvent; +begin + if ((index < events.count) and (index >= 0)) then + result := events[index] + else + result := nil; +end; + +function TMiditrack.getCurrentTime: integer; +begin + result := currentTime; +end; + +procedure TMiditrack.Rewind(pos: integer); +begin + if currentPos = events.count then + dec(currentPos); + while ((currentPos > 0) and + (PMidiEvent(events[currentPos]).time > pos)) + do + begin + dec(currentPos); + end; + checkReady; +end; + +procedure TMiditrack.PlayUntil(pos: integer); +begin + if assigned(OnMidiEvent) then + begin + while ((currentPos < events.count) and + (PMidiEvent(events[currentPos]).time < pos)) do + begin + OnMidiEvent(PMidiEvent(events[currentPos])); + inc(currentPos); + end; + end; + checkReady; +end; + +procedure TMidiTrack.GoUntil(pos: integer); +begin + while ((currentPos < events.count) and + (PMidiEvent(events[currentPos]).time < pos)) do + begin + inc(currentPos); + end; + checkReady; +end; + +procedure TMidiTrack.checkReady; +begin + if currentPos >= events.count then + begin + ready := true; + if assigned(OnTrackReady) then + OnTrackReady; + end + else + ready := false; +end; + +function TMidiTrack.getTrackLength: integer; +begin + result := PMidiEvent(events[events.count-1]).time +end; + +function TMidiTrack.isReady: boolean; +begin + result := ready; +end; + +constructor TMidifile.Create(AOwner: TComponent); +begin + inherited Create(AOWner); + MIDIFileHandle:=AllocateHWnd(WndProc); + chunkData := nil; + chunkType := illegal; + Tracks := TList.Create; + TimerProc:=TimerCallBackProc; + FPriority:=GetPriorityClass(MIDIFileHandle); +end; + +destructor TMidifile.Destroy; +var + i: integer; +begin + if not (chunkData = nil) then FreeMem(chunkData); + for i := 0 to Tracks.Count - 1 do + TMidiTrack(Tracks.Items[i]).Free; + Tracks.Free; + SetPriorityClass(MIDIFileHandle,FPriority); + + if MIDITimerID<>0 then KillMIDITimer; + + DeallocateHWnd(MIDIFileHandle); + + inherited Destroy; +end; + +function TMidiFile.GetTrack(index: integer): TMidiTrack; +begin + result := Tracks.Items[index]; +end; + +procedure TMidifile.setFilename(val: string); +begin + FFilename := val; +// ReadFile; +end; + +procedure TMidifile.SetOnMidiEvent(handler: TOnMidiEvent); +var + i: integer; +begin +// if not (FOnMidiEvent = handler) then +// begin + FOnMidiEvent := handler; + for i := 0 to tracks.count - 1 do + TMidiTrack(tracks.items[i]).OnMidiEvent := handler; +// end; +end; + +procedure TMidifile.MidiTimer(Sender: TObject); +begin + if playing then + begin + PlayToTime(GetTickCount - PlayStartTime); + if assigned(FOnUpdateEvent) then FOnUpdateEvent(self); + end; +end; + +procedure TMidifile.StartPlaying; +var + i: integer; +begin + for i := 0 to tracks.count - 1 do + TMidiTrack(tracks[i]).Rewind(0); + playStartTime := getTickCount; + playing := true; + + SetPriorityClass(MIDIFileHandle,REALTIME_PRIORITY_CLASS); + + SetMIDITimer; + currentPos := 0.0; + currentTime := 0; +end; + +procedure TMidifile.ContinuePlaying; +begin + PlayStartTime := GetTickCount - currentTime; + playing := true; + + SetPriorityClass(MIDIFileHandle,REALTIME_PRIORITY_CLASS); + + SetMIDITimer; +end; + +procedure TMidifile.StopPlaying; +begin + playing := false; + KillMIDITimer; + SetPriorityClass(MIDIFileHandle,FPriority); +end; + +function TMidiFile.GetCurrentTime: integer; +begin + Result := currentTime; +end; + +procedure TMidifile.PlayToTime(time: integer); +var + i: integer; + track: TMidiTrack; + pos: integer; + deltaTime: integer; +begin + // calculate the pos in the file. + // pos is actually tick + // Current FusPerTick is uses to determine the actual pos + + deltaTime := time - currentTime; + currentPos := currentPos + (deltaTime * 1000) / FusPerTick; + pos := round(currentPos); + + for i := 0 to tracks.count - 1 do + begin + TMidiTrack(tracks.items[i]).PlayUntil(pos); + end; + currentTime := time; +end; + +procedure TMidifile.GoToTime(time: integer); +var + i: integer; + track: TMidiTrack; + pos: integer; +begin + // this function should be changed because FusPerTick might not be constant + pos := round((time * 1000) / FusPerTick); + for i := 0 to tracks.count - 1 do + begin + TMidiTrack(tracks.items[i]).Rewind(0); + TMidiTrack(tracks.items[i]).GoUntil(pos); + end; +end; + +procedure TMidifile.SetBpm(val: integer); +var + us_per_quarter: integer; +begin + if not (val = FBpm) then + begin + us_per_quarter := 60000000 div val; + + FBpm := 60000000 div us_per_quarter; + FusPerTick := us_per_quarter / deltaTicks; + end; +end; + +procedure TMidifile.ReadChunkHeader; +var + theByte: array[0..7] of byte; +begin + BlockRead(midiFile, theByte, 8); + if (theByte[0] = $4D) and (theByte[1] = $54) then + begin + if (theByte[2] = $68) and (theByte[3] = $64) then + chunkType := header + else if (theByte[2] = $72) and (theByte[3] = $6B) then + chunkType := track + else + chunkType := illegal; + end + else + begin + chunkType := illegal; + end; + chunkLength := theByte[7] + theByte[6] * $100 + theByte[5] * $10000 + theByte[4] * $1000000; +end; + +procedure TMidifile.ReadChunkContent; +begin + if not (chunkData = nil) then + FreeMem(chunkData); + GetMem(chunkData, chunkLength + 10); + BlockRead(midiFile, chunkData^, chunkLength); + chunkIndex := chunkData; + chunkEnd := PByte(integer(chunkIndex) + integer(chunkLength) - 1); +end; + +procedure TMidifile.ReadChunk; +begin + ReadChunkHeader; + ReadChunkContent; + case chunkType of + header: + ProcessHeaderChunk; + track: + ProcessTrackCHunk; + end; +end; + +procedure TMidifile.ProcessHeaderChunk; +begin + chunkIndex := chunkData; + inc(chunkIndex); + if chunkType = header then + begin + case chunkIndex^ of + 0: FfileFormat := single; + 1: FfileFormat := multi_synch; + 2: FfileFormat := multi_asynch; + end; + inc(chunkIndex); + numberTracks := chunkIndex^ * $100; + inc(chunkIndex); + numberTracks := numberTracks + chunkIndex^; + inc(chunkIndex); + deltaTicks := chunkIndex^ * $100; + inc(chunkIndex); + deltaTicks := deltaTicks + chunkIndex^; + end; +end; + +procedure TMidifile.ProcessTrackChunk; +var + dTime: integer; + event: integer; + len: integer; + str: string; + midiEvent: PMidiEvent; + i: integer; + us_per_quarter: integer; +begin + chunkIndex := chunkData; +// inc(chunkIndex); + event := 0; + if chunkType = track then + begin + currentTrack := TMidiTrack.Create; + currentTrack.OnMidiEvent := FOnMidiEvent; + Tracks.add(currentTrack); + while integer(chunkIndex) < integer(chunkEnd) do + begin + // each event starts with var length delta time + dTime := ReadVarLength; + if chunkIndex^ >= $80 then + begin + event := chunkIndex^; + inc(chunkIndex); + end; + // else it is a running status event (just the same event as before) + + if event = $FF then + begin +{ case chunkIndex^ of + $00: // sequence number, not implemented jet + begin + inc(chunkIndex); // $02 + inc(chunkIndex); + end; + $01 .. $0f: // text events FF ty len text + begin + New(midiEvent); + midiEvent.event := $FF; + midiEvent.data1 := chunkIndex^; // type is stored in data1 + midiEvent.dticks := dtime; + + inc(chunkIndex); + len := ReadVarLength; + midiEvent.str := ReadString(len); + + currentTrack.putEvent(midiEvent); + end; + $20: // Midi channel prefix FF 20 01 cc + begin + inc(chunkIndex); // $01 + inc(chunkIndex); // channel + inc(chunkIndex); + end; + $2F: // End of track FF 2F 00 + begin + inc(chunkIndex); // $00 + inc(chunkIndex); + end; + $51: // Set Tempo FF 51 03 tttttt + begin + inc(chunkIndex); // $03 + inc(chunkIndex); // tt + inc(chunkIndex); // tt + inc(chunkIndex); // tt + inc(chunkIndex); + end; + $54: // SMPTE offset FF 54 05 hr mn se fr ff + begin + inc(chunkIndex); // $05 + inc(chunkIndex); // hr + inc(chunkIndex); // mn + inc(chunkIndex); // se + inc(chunkIndex); // fr + inc(chunkIndex); // ff + inc(chunkIndex); + end; + $58: // Time signature FF 58 04 nn dd cc bb + begin + inc(chunkIndex); // $04 + inc(chunkIndex); // nn + inc(chunkIndex); // dd + inc(chunkIndex); // cc + inc(chunkIndex); // bb + inc(chunkIndex); + end; + $59: // Key signature FF 59 02 df mi + begin + inc(chunkIndex); // $02 + inc(chunkIndex); // df + inc(chunkIndex); // mi + inc(chunkIndex); + end; + $7F: // Sequence specific Meta-event + begin + inc(chunkIndex); + len := ReadVarLength; + str := ReadString(len); + end; + else // unknown meta event + } + begin + New(midiEvent); + midiEvent.event := $FF; + midiEvent.data1 := chunkIndex^; // type is stored in data1 + midiEvent.dticks := dtime; + + inc(chunkIndex); + len := ReadVarLength; + midiEvent.str := ReadString(len); + currentTrack.putEvent(midiEvent); + + case midiEvent.data1 of + $51: + begin + us_per_quarter := + (integer(byte(midiEvent.str[1])) shl 16 + + integer(byte(midiEvent.str[2])) shl 8 + + integer(byte(midiEvent.str[3]))); + FBpm := 60000000 div us_per_quarter; + FusPerTick := us_per_quarter / deltaTicks; + end; + end; + end; +// end; + end + else + begin + // these are all midi events + New(midiEvent); + midiEvent.event := event; + midiEvent.dticks := dtime; +// inc(chunkIndex); + case event of + $80..$8F, // note off + $90..$9F, // note on + $A0..$AF, // key aftertouch + $B0..$BF, // control change + $E0..$EF: // pitch wheel change + begin + midiEvent.data1 := chunkIndex^; inc(chunkIndex); + midiEvent.data2 := chunkIndex^; inc(chunkIndex); + end; + $C0..$CF, // program change + $D0..$DF: // channel aftertouch + begin + midiEvent.data1 := chunkIndex^; inc(chunkIndex); + end; + else + // error + end; + currentTrack.putEvent(midiEvent); + end; + end; + end; +end; + + +function TMidifile.ReadVarLength: integer; +var + i: integer; + b: byte; +begin + b := 128; + i := 0; + while b > 127 do + begin + i := i shl 7; + b := chunkIndex^; + i := i + b and $7F; + inc(chunkIndex); + end; + result := i; +end; + +function TMidifile.ReadString(l: integer): string; +var + s: PChar; + i: integer; +begin + GetMem(s, l + 1); ; + s[l] := chr(0); + for i := 0 to l - 1 do + begin + s[i] := Chr(chunkIndex^); + inc(chunkIndex); + end; + result := string(s); +end; + +procedure TMidifile.ReadFile; +var + i: integer; +begin + for i := 0 to Tracks.Count - 1 do + TMidiTrack(Tracks.Items[i]).Free; + Tracks.Clear; + chunkType := illegal; + + AssignFile(midiFile, FFilename); + FileMode := 0; + Reset(midiFile); + while not eof(midiFile) do + ReadChunk; + CloseFile(midiFile); + numberTracks := Tracks.Count; +end; + +function KeyToStr(key: integer): string; +var + n: integer; + str: string; +begin + n := key mod 12; + case n of + 0: str := 'C'; + 1: str := 'C#'; + 2: str := 'D'; + 3: str := 'D#'; + 4: str := 'E'; + 5: str := 'F'; + 6: str := 'F#'; + 7: str := 'G'; + 8: str := 'G#'; + 9: str := 'A'; + 10: str := 'A#'; + 11: str := 'B'; + end; + Result := str + IntToStr(key div 12); +end; + +function IntToLenStr(val: integer; len: integer): string; +var + str: string; +begin + str := IntToStr(val); + while Length(str) < len do + str := '0' + str; + Result := str; +end; + +function MyTimeToStr(val: integer): string; + var + hour: integer; + min: integer; + sec: integer; + msec: integer; +begin + msec := val mod 1000; + sec := val div 1000; + min := sec div 60; + sec := sec mod 60; + hour := min div 60; + min := min mod 60; + Result := IntToStr(hour) + ':' + IntToLenStr(min, 2) + ':' + IntToLenStr(sec, 2) + '.' + IntToLenStr(msec, 3); +end; + +function TMidiFIle.GetFusPerTick : Double; +begin + Result := FusPerTick; +end; + +function TMidiFIle.GetTrackLength:integer; +var i,length : integer; + time : extended; +begin + length := 0; + for i := 0 to Tracks.Count - 1 do + if TMidiTrack(Tracks.Items[i]).getTrackLength > length then + length := TMidiTrack(Tracks.Items[i]).getTrackLength; + time := length * FusPerTick; + time := time / 1000.0; + result := round(time); +end; + +function TMidiFIle.Ready: boolean; +var i : integer; +begin + result := true; + for i := 0 to Tracks.Count - 1 do + if not TMidiTrack(Tracks.Items[i]).isready then + result := false; +end; + +procedure TMidiFile.OnTrackReady; +begin + if ready then + if assigned(FOnUpdateEvent) then FOnUpdateEvent(self); +end; + +procedure TMidiFile.WndProc(var Msg : TMessage); +begin + with MSG do + begin + case Msg of + WM_MULTIMEDIA_TIMER: + begin + try + MidiTimer(self); + except + Application.HandleException(Self); + end; + end; + else + begin + Result := DefWindowProc(MIDIFileHandle, Msg, wParam, lParam); + end; + end; + end; +end; + +procedure Register; +begin + RegisterComponents('Synth', [TMidiFile]); +end; + +end. + diff --git a/Game/Code/lib/midi/MidiOut.dcu b/Game/Code/lib/midi/MidiOut.dcu new file mode 100644 index 00000000..fd1f8c4f Binary files /dev/null and b/Game/Code/lib/midi/MidiOut.dcu differ diff --git a/Game/Code/lib/midi/MidiScope.pas b/Game/Code/lib/midi/MidiScope.pas new file mode 100644 index 00000000..0caa430f --- /dev/null +++ b/Game/Code/lib/midi/MidiScope.pas @@ -0,0 +1,193 @@ +{ + Shows a large black area where midi note/controller events are shown + just to monitor midi activity (for the MidiPlayer) + + version 1.0 first release + + for comments/bugs + F.Bouwmans + fbouwmans@spiditel.nl + + if you think this component is nice and you use it, sent me a short email. + I've seen that other of my components have been downloaded a lot, but I've + got no clue wether they are actually used. + Don't worry because you are free to use these components +} + +unit MidiScope; + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs; + +type + TMidiScope = class(TGraphicControl) + private + { Private declarations } + protected + { Protected declarations } + notes : array[0..15,0..127] of integer; + controllers : array[0..15,0..17] of integer; + aftertouch : array[0..15,0..127] of integer; + + selectedChannel : integer; + + procedure PaintSlide(ch,pos,val: integer); + + procedure NoteOn(channel, note, speed : integer); + procedure Controller(channel,number,value : integer); + procedure AfterTch(channel, note, value : integer); + + public + { Public declarations } + constructor Create(AOwner: TComponent); override; + procedure MidiEvent(event,data1,data2 : integer); + procedure Paint; override; + published + { Published declarations } + end; + + +procedure Register; + +const + BarHeight = 16; + BarHeightInc = BarHeight+2; + BarWidth = 3; + BarWidthInc = BarWidth+1; + HeightDiv = 128 div BarHeight; + +implementation + +uses Midicons; + +procedure Register; +begin + RegisterComponents('Synth', [TMidiScope]); +end; + +constructor TMidiScope.Create(AOwner: TComponent); +var + i,j : integer; +begin + inherited Create(AOwner); + Height := BarHeightinc * 16 + 4; + Width := 147*BarWidthInc + 4 + 20; // for channel number + for i := 0 to 15 do + begin + for j := 0 to 127 do + begin + notes[i,j] := 0; + aftertouch[i,j] := 0; + end; + end; + for i := 0 to 17 do + begin + for j := 0 to 15 do + controllers[i,j] := 0; + end; +end; + +procedure TMidiScope.PaintSlide(ch,pos,val: integer); +var x,y:integer; +begin + Canvas.Brush.Color := clBlack; + Canvas.Pen.color := clBlack; + x := pos * BarWidthInc + 2; + y := 2 + ch * BarHeightInc; + Canvas.Rectangle(x, y, x+BarWidthInc, y+BarHeightInc); + Canvas.Brush.Color := clGreen; + Canvas.Pen.Color := clGreen; + Canvas.Rectangle(x, y + (BarHeight - (val div HeightDiv )), x + BarWidth, y + BarHeight) +end; + +procedure TMidiScope.Paint; +var i,j : integer; +x : integer; +begin + Canvas.Brush.color := clBlack; + Canvas.Rectangle(0,0,Width,Height); + Canvas.Pen.Color := clGreen; + x := 128*BarWidthInc+2; + Canvas.MoveTo(x,0); + Canvas.LineTo(x,Height); + x := 148*BarWIdthInc+2; + canvas.Font.Color := clGreen; + for i := 0 to 15 do + Canvas.TextOut(x,((i+1)*BarHeightInc) - Canvas.font.size-3,IntToStr(i+1)); + canvas.Pen.color := clBlack; + begin + for j := 0 to 127 do + begin + PaintSlide(i,j,notes[i,j]); + end; + for j := 0 to 17 do + begin + PaintSlide(i,j+129,controllers[i,j]); + end; + end; +end; +procedure TMidiScope.NoteOn(channel, note, speed : integer); +begin + notes[channel,note] := speed; + PaintSlide(channel,note,notes[channel,note]); +end; +procedure TMidiScope.AfterTch(channel, note, value : integer); +begin + aftertouch[channel,note] := value; +end; + +procedure TMidiScope.Controller(channel,number,value : integer); +var i : integer; +begin + if number < 18 then + begin + controllers[channel,number] := value; + PaintSlide(channel,number+129,value); + end + else if number >= $7B then + begin + // all notes of for channel + for i := 0 to 127 do + begin + if notes[channel,i] > 0 then + begin + notes[channel,i] := 0; + PaintSlide(channel,i,0); + end; + end; + end; +end; + +procedure TMidiScope.MidiEvent(event,data1,data2 : integer); +begin + case (event AND $F0) of + MIDI_NOTEON : + begin + NoteOn((event AND $F),data1,data2); + end; + MIDI_NOTEOFF: + begin + NoteOn((event AND $F),data1,0); + end; + MIDI_CONTROLCHANGE : + begin + Controller((event AND $F),data1,data2); + end; + MIDI_CHANAFTERTOUCH: + begin + Controller((Event AND $F),16,Data1); + end; + MIDI_PITCHBEND: + begin + begin + Controller((Event AND $F),17,data2); + end; + end; + MIDI_KEYAFTERTOUCH: + begin + end; + end; +end; +end. diff --git a/Game/Code/lib/midi/MidiType.dcu b/Game/Code/lib/midi/MidiType.dcu new file mode 100644 index 00000000..2002ca1a Binary files /dev/null and b/Game/Code/lib/midi/MidiType.dcu differ diff --git a/Game/Code/lib/midi/Midicons.pas b/Game/Code/lib/midi/Midicons.pas new file mode 100644 index 00000000..41dda9e1 --- /dev/null +++ b/Game/Code/lib/midi/Midicons.pas @@ -0,0 +1,42 @@ +{ $Header: /MidiComp/MIDICONS.PAS 2 10/06/97 7:33 Davec $ } + +{ Written by David Churcher , + released to the public domain. } + + +{ MIDI Constants } +unit Midicons; + +interface + +uses Messages; + +const + MIDI_ALLNOTESOFF = $7B; + MIDI_NOTEON = $90; + MIDI_NOTEOFF = $80; + MIDI_KEYAFTERTOUCH = $a0; + MIDI_CONTROLCHANGE = $b0; + MIDI_PROGRAMCHANGE = $c0; + MIDI_CHANAFTERTOUCH = $d0; + MIDI_PITCHBEND = $e0; + MIDI_SYSTEMMESSAGE = $f0; + MIDI_BEGINSYSEX = $f0; + MIDI_MTCQUARTERFRAME = $f1; + MIDI_SONGPOSPTR = $f2; + MIDI_SONGSELECT = $f3; + MIDI_ENDSYSEX = $F7; + MIDI_TIMINGCLOCK = $F8; + MIDI_START = $FA; + MIDI_CONTINUE = $FB; + MIDI_STOP = $FC; + MIDI_ACTIVESENSING = $FE; + MIDI_SYSTEMRESET = $FF; + + MIM_OVERFLOW = WM_USER; { Input buffer overflow } + MOM_PLAYBACK_DONE = WM_USER+1; { Timed playback complete } + + +implementation + +end. diff --git a/Game/Code/lib/midi/Midiin.pas b/Game/Code/lib/midi/Midiin.pas new file mode 100644 index 00000000..2f2e76c0 --- /dev/null +++ b/Game/Code/lib/midi/Midiin.pas @@ -0,0 +1,710 @@ +{ $Header: /MidiComp/Midiin.pas 2 10/06/97 7:33 Davec $ } + +{ Written by David Churcher , + released to the public domain. } + +unit MidiIn; + +{ + Properties: + DeviceID: Windows numeric device ID for the MIDI input device. + Between 0 and NumDevs-1. + Read-only while device is open, exception when changed while open + + MIDIHandle: The input handle to the MIDI device. + 0 when device is not open + Read-only, runtime-only + + MessageCount: Number of input messages waiting in input buffer + + Capacity: Number of messages input buffer can hold + Defaults to 1024 + Limited to (64K/event size) + Read-only when device is open (exception when changed while open) + + SysexBufferSize: Size in bytes of each sysex buffer + Defaults to 10K + Minimum 0K (no buffers), Maximum 64K-1 + + SysexBufferCount: Number of sysex buffers + Defaults to 16 + Minimum 0 (no buffers), Maximum (avail mem/SysexBufferSize) + Check where these buffers are allocated? + + SysexOnly: True to ignore all non-sysex input events. May be changed while + device is open. Handy for patch editors where you have lots of short MIDI + events on the wire which you are always going to ignore anyway. + + DriverVersion: Version number of MIDI device driver. High-order byte is + major version, low-order byte is minor version. + + ProductName: Name of product (e.g. 'MPU 401 In') + + MID and PID: Manufacturer ID and Product ID, see + "Manufacturer and Product IDs" in MMSYSTEM.HLP for list of possible values. + + Methods: + GetMidiEvent: Read Midi event at the head of the FIFO input buffer. + Returns a TMyMidiEvent object containing MIDI message data, timestamp, + and sysex data if applicable. + This method automatically removes the event from the input buffer. + It makes a copy of the received sysex buffer and puts the buffer back + on the input device. + The TMyMidiEvent object must be freed by calling MyMidiEvent.Free. + + Open: Opens device. Note no input will appear until you call the Start + method. + + Close: Closes device. Any pending system exclusive output will be cancelled. + + Start: Starts receiving MIDI input. + + Stop: Stops receiving MIDI input. + + Events: + OnMidiInput: Called when MIDI input data arrives. Use the GetMidiEvent to + get the MIDI input data. + + OnOverflow: Called if the MIDI input buffer overflows. The caller must + clear the buffer before any more MIDI input can be received. + + Notes: + Buffering: Uses a circular buffer, separate pointers for next location + to fill and next location to empty because a MIDI input interrupt may + be adding data to the buffer while the buffer is being read. Buffer + pointers wrap around from end to start of buffer automatically. If + buffer overflows then the OnBufferOverflow event is triggered and no + further input will be received until the buffer is emptied by calls + to GetMidiEvent. + + Sysex buffers: There are (SysexBufferCount) buffers on the input device. + When sysex events arrive these buffers are removed from the input device and + added to the circular buffer by the interrupt handler in the DLL. When the sysex events + are removed from the circular buffer by the GetMidiEvent method the buffers are + put back on the input. If all the buffers are used up there will be no + more sysex input until at least one sysex event is removed from the input buffer. + In other words if you're expecting lots of sysex input you need to set the + SysexBufferCount property high enough so that you won't run out of + input buffers before you get a chance to read them with GetMidiEvent. + + If the synth sends a block of sysex that's longer than SysexBufferSize it + will be received as separate events. + TODO: Component derived from this one that handles >64K sysex blocks cleanly + and can stream them to disk. + + Midi Time Code (MTC) and Active Sensing: The DLL is currently hardcoded + to filter these short events out, so that we don't spend all our time + processing them. + TODO: implement a filter property to select the events that will be filtered + out. +} + +interface + +uses + Classes, SysUtils, WinTypes, Messages, WinProcs, MMSystem, MidiDefs, MidiType, + MidiCons, Circbuf, Delphmcb; + +type + MidiInputState = (misOpen, misClosed, misCreating, misDestroying); + EMidiInputError = class(Exception); + + {-------------------------------------------------------------------} + TMidiInput = class(TComponent) + private + Handle: THandle; { Window handle used for callback notification } + FDeviceID: Word; { MIDI device ID } + FMIDIHandle: HMIDIIn; { Handle to input device } + FState: MidiInputState; { Current device state } + + FError: Word; + FSysexOnly: Boolean; + + { Stuff from MIDIINCAPS } + FDriverVersion: Version; + FProductName: string; + FMID: Word; { Manufacturer ID } + FPID: Word; { Product ID } + + { Queue } + FCapacity: Word; { Buffer capacity } + PBuffer: PCircularBuffer; { Low-level MIDI input buffer created by Open method } + FNumdevs: Word; { Number of input devices on system } + + { Events } + FOnMIDIInput: TNotifyEvent; { MIDI Input arrived } + FOnOverflow: TNotifyEvent; { Input buffer overflow } + { TODO: Some sort of error handling event for MIM_ERROR } + + { Sysex } + FSysexBufferSize: Word; + FSysexBufferCount: Word; + MidiHdrs: Tlist; + + PCtlInfo: PMidiCtlInfo; { Pointer to control info for DLL } + + protected + procedure Prepareheaders; + procedure UnprepareHeaders; + procedure AddBuffers; + procedure SetDeviceID(DeviceID: Word); + procedure SetProductName(NewProductName: string); + function GetEventCount: Word; + procedure SetSysexBufferSize(BufferSize: Word); + procedure SetSysexBufferCount(BufferCount: Word); + procedure SetSysexOnly(bSysexOnly: Boolean); + function MidiInErrorString(WError: Word): string; + + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + + property MIDIHandle: HMIDIIn read FMIDIHandle; + + property DriverVersion: Version read FDriverVersion; + property MID: Word read FMID; { Manufacturer ID } + property PID: Word read FPID; { Product ID } + + property Numdevs: Word read FNumdevs; + + property MessageCount: Word read GetEventCount; + { TODO: property to select which incoming messages get filtered out } + + procedure Open; + procedure Close; + procedure Start; + procedure Stop; + { Get first message in input queue } + function GetMidiEvent: TMyMidiEvent; + procedure MidiInput(var Message: TMessage); + + { Some functions to decode and classify incoming messages would be good } + + published + + { TODO: Property editor with dropdown list of product names } + property ProductName: string read FProductName write SetProductName; + + property DeviceID: Word read FDeviceID write SetDeviceID default 0; + property Capacity: Word read FCapacity write FCapacity default 1024; + property Error: Word read FError; + property SysexBufferSize: Word + read FSysexBufferSize + write SetSysexBufferSize + default 10000; + property SysexBufferCount: Word + read FSysexBufferCount + write SetSysexBufferCount + default 16; + property SysexOnly: Boolean + read FSysexOnly + write SetSysexOnly + default False; + + { Events } + property OnMidiInput: TNotifyEvent read FOnMidiInput write FOnMidiInput; + property OnOverflow: TNotifyEvent read FOnOverflow write FOnOverflow; + + end; + +procedure Register; + +{====================================================================} +implementation + +uses Graphics, Controls, Forms, Dialogs; + +(* Not used in Delphi 3 +{ This is the callback procedure in the external DLL. + It's used when midiInOpen is called by the Open method. + There are special requirements and restrictions for this callback + procedure (see midiInOpen in MMSYSTEM.HLP) so it's impractical to + make it an object method } +{$IFDEF WIN32} +function midiHandler( + hMidiIn: HMidiIn; + wMsg: UINT; + dwInstance: DWORD; + dwParam1: DWORD; + dwParam2: DWORD): Boolean; stdcall; external 'DELMID32.DLL'; +{$ELSE} +procedure midiHandler( + hMidiIn: HMidiIn; + wMsg: Word; + dwInstance: DWORD; + dwParam1: DWORD; + dwParam2: DWORD); far; external 'DELPHMID'; +{$ENDIF} +*) +{-------------------------------------------------------------------} + +constructor TMidiInput.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FState := misCreating; + + FSysexOnly := False; + FNumDevs := midiInGetNumDevs; + MidiHdrs := nil; + + { Set defaults } + if (FNumDevs > 0) then + SetDeviceID(0); + FCapacity := 1024; + FSysexBufferSize := 4096; + FSysexBufferCount := 16; + + { Create the window for callback notification } + if not (csDesigning in ComponentState) then + begin + Handle := AllocateHwnd(MidiInput); + end; + + FState := misClosed; + +end; + +{-------------------------------------------------------------------} +{ Close the device if it's open } + +destructor TMidiInput.Destroy; +begin + if (FMidiHandle <> 0) then + begin + Close; + FMidiHandle := 0; + end; + + if (PCtlInfo <> nil) then + GlobalSharedLockedFree(PCtlinfo^.hMem, PCtlInfo); + + DeallocateHwnd(Handle); + inherited Destroy; +end; + +{-------------------------------------------------------------------} +{ Convert the numeric return code from an MMSYSTEM function to a string + using midiInGetErrorText. TODO: These errors aren't very helpful + (e.g. "an invalid parameter was passed to a system function") so + sort out some proper error strings. } + +function TMidiInput.MidiInErrorString(WError: Word): string; +var + errorDesc: PChar; +begin + errorDesc := nil; + try + errorDesc := StrAlloc(MAXERRORLENGTH); + if midiInGetErrorText(WError, errorDesc, MAXERRORLENGTH) = 0 then + result := StrPas(errorDesc) + else + result := 'Specified error number is out of range'; + finally + if errorDesc <> nil then StrDispose(errorDesc); + end; +end; + +{-------------------------------------------------------------------} +{ Set the sysex buffer size, fail if device is already open } + +procedure TMidiInput.SetSysexBufferSize(BufferSize: Word); +begin + if FState = misOpen then + raise EMidiInputError.Create('Change to SysexBufferSize while device was open') + else + { TODO: Validate the sysex buffer size. Is this necessary for WIN32? } + FSysexBufferSize := BufferSize; +end; + +{-------------------------------------------------------------------} +{ Set the sysex buffer count, fail if device is already open } + +procedure TMidiInput.SetSysexBuffercount(Buffercount: Word); +begin + if FState = misOpen then + raise EMidiInputError.Create('Change to SysexBuffercount while device was open') + else + { TODO: Validate the sysex buffer count } + FSysexBuffercount := Buffercount; +end; + +{-------------------------------------------------------------------} +{ Set the Sysex Only flag to eliminate unwanted short MIDI input messages } + +procedure TMidiInput.SetSysexOnly(bSysexOnly: Boolean); +begin + FSysexOnly := bSysexOnly; + { Update the interrupt handler's copy of this property } + if PCtlInfo <> nil then + PCtlInfo^.SysexOnly := bSysexOnly; +end; + +{-------------------------------------------------------------------} +{ Set the Device ID to select a new MIDI input device + Note: If no MIDI devices are installed, throws an 'Invalid Device ID' exception } + +procedure TMidiInput.SetDeviceID(DeviceID: Word); +var + MidiInCaps: TMidiInCaps; +begin + if FState = misOpen then + raise EMidiInputError.Create('Change to DeviceID while device was open') + else + if (DeviceID >= midiInGetNumDevs) then + raise EMidiInputError.Create('Invalid device ID') + else + begin + FDeviceID := DeviceID; + + { Set the name and other MIDIINCAPS properties to match the ID } + FError := + midiInGetDevCaps(DeviceID, @MidiInCaps, sizeof(TMidiInCaps)); + if Ferror <> MMSYSERR_NOERROR then + raise EMidiInputError.Create(MidiInErrorString(FError)); + + FProductName := StrPas(MidiInCaps.szPname); + FDriverVersion := MidiInCaps.vDriverVersion; + FMID := MidiInCaps.wMID; + FPID := MidiInCaps.wPID; + + end; +end; + +{-------------------------------------------------------------------} +{ Set the product name and put the matching input device number in FDeviceID. + This is handy if you want to save a configured input/output device + by device name instead of device number, because device numbers may + change if users add or remove MIDI devices. + Exception if input device with matching name not found, + or if input device is open } + +procedure TMidiInput.SetProductName(NewProductName: string); +var + MidiInCaps: TMidiInCaps; + testDeviceID: Word; + testProductName: string; +begin + if FState = misOpen then + raise EMidiInputError.Create('Change to ProductName while device was open') + else + { Don't set the name if the component is reading properties because + the saved Productname will be from the machine the application was compiled + on, which may not be the same for the corresponding DeviceID on the user's + machine. The FProductname property will still be set by SetDeviceID } + if not (csLoading in ComponentState) then + begin + begin + for testDeviceID := 0 to (midiInGetNumDevs - 1) do + begin + FError := + midiInGetDevCaps(testDeviceID, @MidiInCaps, sizeof(TMidiInCaps)); + if Ferror <> MMSYSERR_NOERROR then + raise EMidiInputError.Create(MidiInErrorString(FError)); + testProductName := StrPas(MidiInCaps.szPname); + if testProductName = NewProductName then + begin + FProductName := NewProductName; + Break; + end; + end; + if FProductName <> NewProductName then + raise EMidiInputError.Create('MIDI Input Device ' + + NewProductName + ' not installed ') + else + SetDeviceID(testDeviceID); + end; + end; +end; + + +{-------------------------------------------------------------------} +{ Get the sysex buffers ready } + +procedure TMidiInput.PrepareHeaders; +var + ctr: Word; + MyMidiHdr: TMyMidiHdr; +begin + if (FSysexBufferCount > 0) and (FSysexBufferSize > 0) + and (FMidiHandle <> 0) then + begin + Midihdrs := TList.Create; + for ctr := 1 to FSysexBufferCount do + begin + { Initialize the header and allocate buffer memory } + MyMidiHdr := TMyMidiHdr.Create(FSysexBufferSize); + + { Store the address of the MyMidiHdr object in the contained MIDIHDR + structure so we can get back to the object when a pointer to the + MIDIHDR is received. + E.g. see TMidiOutput.Output method } + MyMidiHdr.hdrPointer^.dwUser := DWORD(MyMidiHdr); + + { Get MMSYSTEM's blessing for this header } + FError := midiInPrepareHeader(FMidiHandle, MyMidiHdr.hdrPointer, + sizeof(TMIDIHDR)); + if Ferror <> MMSYSERR_NOERROR then + raise EMidiInputError.Create(MidiInErrorString(FError)); + + { Save it in our list } + MidiHdrs.Add(MyMidiHdr); + end; + end; + +end; + +{-------------------------------------------------------------------} +{ Clean up from PrepareHeaders } + +procedure TMidiInput.UnprepareHeaders; +var + ctr: Word; +begin + if (MidiHdrs <> nil) then { will be Nil if 0 sysex buffers } + begin + for ctr := 0 to MidiHdrs.Count - 1 do + begin + FError := midiInUnprepareHeader(FMidiHandle, + TMyMidiHdr(MidiHdrs.Items[ctr]).hdrPointer, + sizeof(TMIDIHDR)); + if Ferror <> MMSYSERR_NOERROR then + raise EMidiInputError.Create(MidiInErrorString(FError)); + TMyMidiHdr(MidiHdrs.Items[ctr]).Free; + end; + MidiHdrs.Free; + MidiHdrs := nil; + end; +end; + +{-------------------------------------------------------------------} +{ Add sysex buffers, if required, to input device } + +procedure TMidiInput.AddBuffers; +var + ctr: Word; +begin + if MidiHdrs <> nil then { will be Nil if 0 sysex buffers } + begin + if MidiHdrs.Count > 0 then + begin + for ctr := 0 to MidiHdrs.Count - 1 do + begin + FError := midiInAddBuffer(FMidiHandle, + TMyMidiHdr(MidiHdrs.Items[ctr]).hdrPointer, + sizeof(TMIDIHDR)); + if FError <> MMSYSERR_NOERROR then + raise EMidiInputError.Create(MidiInErrorString(FError)); + end; + end; + end; +end; + +{-------------------------------------------------------------------} + +procedure TMidiInput.Open; +var + hMem: THandle; +begin + try + { Create the buffer for the MIDI input messages } + if (PBuffer = nil) then + PBuffer := CircBufAlloc(FCapacity); + + { Create the control info for the DLL } + if (PCtlInfo = nil) then + begin + PCtlInfo := GlobalSharedLockedAlloc(Sizeof(TMidiCtlInfo), hMem); + PctlInfo^.hMem := hMem; + end; + PctlInfo^.pBuffer := PBuffer; + Pctlinfo^.hWindow := Handle; { Control's window handle } + PCtlInfo^.SysexOnly := FSysexOnly; + FError := midiInOpen(@FMidiHandle, FDeviceId, + DWORD(@midiHandler), + DWORD(PCtlInfo), + CALLBACK_FUNCTION); + + if (FError <> MMSYSERR_NOERROR) then + { TODO: use CreateFmtHelp to add MIDI device name/ID to message } + raise EMidiInputError.Create(MidiInErrorString(FError)); + + { Get sysex buffers ready } + PrepareHeaders; + + { Add them to the input } + AddBuffers; + + FState := misOpen; + + except + if PBuffer <> nil then + begin + CircBufFree(PBuffer); + PBuffer := nil; + end; + + if PCtlInfo <> nil then + begin + GlobalSharedLockedFree(PCtlInfo^.hMem, PCtlInfo); + PCtlInfo := nil; + end; + + end; + +end; + +{-------------------------------------------------------------------} + +function TMidiInput.GetMidiEvent: TMyMidiEvent; +var + thisItem: TMidiBufferItem; +begin + if (FState = misOpen) and + CircBufReadEvent(PBuffer, @thisItem) then + begin + Result := TMyMidiEvent.Create; + with thisItem do + begin + Result.Time := Timestamp; + if (Sysex = nil) then + begin + { Short message } + Result.MidiMessage := LoByte(LoWord(Data)); + Result.Data1 := HiByte(LoWord(Data)); + Result.Data2 := LoByte(HiWord(Data)); + Result.Sysex := nil; + Result.SysexLength := 0; + end + else + { Long Sysex message } + begin + Result.MidiMessage := MIDI_BEGINSYSEX; + Result.Data1 := 0; + Result.Data2 := 0; + Result.SysexLength := Sysex^.dwBytesRecorded; + if Sysex^.dwBytesRecorded <> 0 then + begin + { Put a copy of the sysex buffer in the object } + GetMem(Result.Sysex, Sysex^.dwBytesRecorded); + StrMove(Result.Sysex, Sysex^.lpData, Sysex^.dwBytesRecorded); + end; + + { Put the header back on the input buffer } + FError := midiInPrepareHeader(FMidiHandle, Sysex, + sizeof(TMIDIHDR)); + if Ferror = 0 then + FError := midiInAddBuffer(FMidiHandle, + Sysex, sizeof(TMIDIHDR)); + if Ferror <> MMSYSERR_NOERROR then + raise EMidiInputError.Create(MidiInErrorString(FError)); + end; + end; + CircbufRemoveEvent(PBuffer); + end + else + { Device isn't open, return a nil event } + Result := nil; +end; + +{-------------------------------------------------------------------} + +function TMidiInput.GetEventCount: Word; +begin + if FState = misOpen then + Result := PBuffer^.EventCount + else + Result := 0; +end; + +{-------------------------------------------------------------------} + +procedure TMidiInput.Close; +begin + if FState = misOpen then + begin + FState := misClosed; + + { MidiInReset cancels any pending output. + Note that midiInReset causes an MIM_LONGDATA callback for each sysex + buffer on the input, so the callback function and Midi input buffer + should still be viable at this stage. + All the resulting MIM_LONGDATA callbacks will be completed by the time + MidiInReset returns, though. } + FError := MidiInReset(FMidiHandle); + if Ferror <> MMSYSERR_NOERROR then + raise EMidiInputError.Create(MidiInErrorString(FError)); + + { Remove sysex buffers from input device and free them } + UnPrepareHeaders; + + { Close the device (finally!) } + FError := MidiInClose(FMidiHandle); + if Ferror <> MMSYSERR_NOERROR then + raise EMidiInputError.Create(MidiInErrorString(FError)); + + FMidiHandle := 0; + + if (PBuffer <> nil) then + begin + CircBufFree(PBuffer); + PBuffer := nil; + end; + end; +end; + +{-------------------------------------------------------------------} + +procedure TMidiInput.Start; +begin + if FState = misOpen then + begin + FError := MidiInStart(FMidiHandle); + if Ferror <> MMSYSERR_NOERROR then + raise EMidiInputError.Create(MidiInErrorString(FError)); + end; +end; + +{-------------------------------------------------------------------} + +procedure TMidiInput.Stop; +begin + if FState = misOpen then + begin + FError := MidiInStop(FMidiHandle); + if Ferror <> MMSYSERR_NOERROR then + raise EMidiInputError.Create(MidiInErrorString(FError)); + end; +end; + +{-------------------------------------------------------------------} + +procedure TMidiInput.MidiInput(var Message: TMessage); +{ Triggered by incoming message from DLL. + Note DLL has already put the message in the queue } +begin + case Message.Msg of + mim_data: + { Trigger the user's MIDI input event, if they've specified one and + we're not in the process of closing the device. The check for + GetEventCount > 0 prevents unnecessary event calls where the user has + already cleared all the events from the input buffer using a GetMidiEvent + loop in the OnMidiInput event handler } + if Assigned(FOnMIDIInput) and (FState = misOpen) + and (GetEventCount > 0) then + FOnMIDIInput(Self); + + mim_Overflow: { input circular buffer overflow } + if Assigned(FOnOverflow) and (FState = misOpen) then + FOnOverflow(Self); + end; +end; + +{-------------------------------------------------------------------} + +procedure Register; +begin + RegisterComponents('Synth', [TMIDIInput]); +end; + +end. + diff --git a/Game/Code/lib/midi/Midiout.pas b/Game/Code/lib/midi/Midiout.pas new file mode 100644 index 00000000..91b75073 --- /dev/null +++ b/Game/Code/lib/midi/Midiout.pas @@ -0,0 +1,600 @@ +{ $Header: /MidiComp/MidiOut.pas 2 10/06/97 7:33 Davec $ } + +{ Written by David Churcher , + released to the public domain. } + +{ Thanks very much to Fred Kohler for the Technology code. } + +unit MidiOut; + +{ + MIDI Output component. + + Properties: + DeviceID: Windows numeric device ID for the MIDI output device. + Between 0 and (midioutGetNumDevs-1), or MIDI_MAPPER (-1). + Special value MIDI_MAPPER specifies output to the Windows MIDI mapper + Read-only while device is open, exception if changed while open + + MIDIHandle: The output handle to the MIDI device. + 0 when device is not open + Read-only, runtime-only + + ProductName: Name of the output device product that corresponds to the + DeviceID property (e.g. 'MPU 401 out'). + You can write to this while the device is closed to select a particular + output device by name (the DeviceID property will change to match). + Exception if this property is changed while the device is open. + + Numdevs: Number of MIDI output devices installed on the system. This + is the value returned by midiOutGetNumDevs. It's included for + completeness. + + Technology: Type of technology used by the MIDI device. You can set this + property to one of the values listed for OutportTech (below) and the component + will find an appropriate MIDI device. For example: + MidiOutput.Technology := opt_FMSynth; + will set MidiInput.DeviceID to the MIDI device ID of the FM synth, if one + is installed. If no such device is available an exception is raised, + see MidiOutput.SetTechnology. + + See the MIDIOUTCAPS entry in MMSYSTEM.HLP for descriptions of the + following properties: + DriverVersion + Voices + Notes + ChannelMask + Support + + Error: The error code for the last MMSYSTEM error. See the MMSYSERR_ + entries in MMSYSTEM.INT for possible values. + + Methods: + Open: Open MIDI device specified by DeviceID property for output + + Close: Close device + + PutMidiEvent(Event:TMyMidiEvent): Output a note or sysex message to the + device. This method takes a TMyMidiEvent object and transmits it. + Notes: + 1. If the object contains a sysex event the OnMidiOutput event will + be triggered when the sysex transmission is complete. + 2. You can queue up multiple blocks of system exclusive data for + transmission by chucking them at this method; they will be + transmitted as quickly as the device can manage. + 3. This method will not free the TMyMidiEvent object, the caller + must do that. Any sysex data in the TMyMidiEvent is copied before + transmission so you can free the TMyMidiEvent immediately after + calling PutMidiEvent, even if output has not yet finished. + + PutShort(MidiMessage: Byte; Data1: Byte; Data2: Byte): Output a short + MIDI message. Handy when you can't be bothered to build a TMyMidiEvent. + If the message you're sending doesn't use Data1 or Data2, set them to 0. + + PutLong(TheSysex: Pointer; msgLength: Word): Output sysex data. + SysexPointer: Pointer to sysex data to send + msgLength: Length of sysex data. + This is handy when you don't have a TMyMidiEvent. + + SetVolume(Left: Word, Right: Word): Set the volume of the + left and right channels on the output device (only on internal devices?). + 0xFFFF is maximum volume. If the device doesn't support separate + left/right volume control, the value of the Left parameter will be used. + Check the Support property to see whether the device supports volume + control. See also other notes on volume control under midiOutSetVolume() + in MMSYSTEM.HLP. + + Events: + OnMidiOutput: Procedure called when output of a system exclusive block + is completed. + + Notes: + I haven't implemented any methods for midiOutCachePatches and + midiOutCacheDrumpatches, mainly 'cause I don't have any way of testing + them. Does anyone really use these? +} + +interface + +uses + SysUtils, WinTypes, WinProcs, Messages, Classes, Controls, Forms, + MMSystem, Circbuf, MidiType, MidiDefs, Delphmcb; + +type + midioutputState = (mosOpen, mosClosed); + EmidioutputError = class(Exception); + + { These are the equivalent of constants prefixed with mod_ + as defined in MMSystem. See SetTechnology } + OutPortTech = ( + opt_None, { none } + opt_MidiPort, { output port } + opt_Synth, { generic internal synth } + opt_SQSynth, { square wave internal synth } + opt_FMSynth, { FM internal synth } + opt_Mapper); { MIDI mapper } + TechNameMap = array[OutPortTech] of string[18]; + + +const + TechName: TechNameMap = ( + 'None', 'MIDI Port', 'Generic Synth', 'Square Wave Synth', + 'FM Synth', 'MIDI Mapper'); + +{-------------------------------------------------------------------} +type + TMidiOutput = class(TComponent) + protected + Handle: THandle; { Window handle used for callback notification } + FDeviceID: Integer; { MIDI device ID } + FMIDIHandle: Hmidiout; { Handle to output device } + FState: midioutputState; { Current device state } + PCtlInfo: PMidiCtlInfo; { Pointer to control info for DLL } + + PBuffer: PCircularBuffer; { Output queue for PutTimedEvent, set by Open } + + FError: Word; { Last MMSYSTEM error } + + { Stuff from midioutCAPS } + FDriverVersion: Version; { Driver version from midioutGetDevCaps } + FProductName: string; { product name } + FTechnology: OutPortTech; { Type of MIDI output device } + FVoices: Word; { Number of voices (internal synth) } + FNotes: Word; { Number of notes (internal synth) } + FChannelMask: Word; { Bit set for each MIDI channels that the + device responds to (internal synth) } + FSupport: DWORD; { Technology supported (volume control, + patch caching etc. } + FNumdevs: Word; { Number of MIDI output devices on system } + + + FOnMIDIOutput: TNotifyEvent; { Sysex output finished } + + procedure MidiOutput(var Message: TMessage); + procedure SetDeviceID(DeviceID: Integer); + procedure SetProductName(NewProductName: string); + procedure SetTechnology(NewTechnology: OutPortTech); + function midioutErrorString(WError: Word): string; + + public + { Properties } + property MIDIHandle: Hmidiout read FMIDIHandle; + property DriverVersion: Version { Driver version from midioutGetDevCaps } + read FDriverVersion; + property Technology: OutPortTech { Type of MIDI output device } + read FTechnology + write SetTechnology + default opt_Synth; + property Voices: Word { Number of voices (internal synth) } + read FVoices; + property Notes: Word { Number of notes (internal synth) } + read FNotes; + property ChannelMask: Word { Bit set for each MIDI channels that the } + read FChannelMask; { device responds to (internal synth) } + property Support: DWORD { Technology supported (volume control, } + read FSupport; { patch caching etc. } + property Error: Word read FError; + property Numdevs: Word read FNumdevs; + + { Methods } + function Open: Boolean; virtual; + function Close: Boolean; virtual; + procedure PutMidiEvent(theEvent: TMyMidiEvent); virtual; + procedure PutShort(MidiMessage: Byte; Data1: Byte; Data2: Byte); virtual; + procedure PutLong(TheSysex: Pointer; msgLength: Word); virtual; + procedure SetVolume(Left: Word; Right: Word); + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + + { Some functions to decode and classify incoming messages would be nice } + + published + { TODO: Property editor with dropdown list of product names } + property ProductName: string read FProductName write SetProductName; + + property DeviceID: Integer read FDeviceID write SetDeviceID default 0; + { TODO: midiOutGetVolume? Or two properties for Left and Right volume? + Is it worth it?? + midiOutMessage?? Does anyone use this? } + + { Events } + property Onmidioutput: TNotifyEvent + read FOnmidioutput + write FOnmidioutput; + end; + +procedure Register; + +{-------------------------------------------------------------------} +implementation + +(* Not used in Delphi 3 + +{ This is the callback procedure in the external DLL. + It's used when midioutOpen is called by the Open method. + There are special requirements and restrictions for this callback + procedure (see midioutOpen in MMSYSTEM.HLP) so it's impractical to + make it an object method } +{$IFDEF WIN32} +function midiHandler( + hMidiIn: HMidiIn; + wMsg: UINT; + dwInstance: DWORD; + dwParam1: DWORD; + dwParam2: DWORD): Boolean; stdcall; external 'DELMID32.DLL'; +{$ELSE} +function midiHandler( + hMidiIn: HMidiIn; + wMsg: Word; + dwInstance: DWORD; + dwParam1: DWORD; + dwParam2: DWORD): Boolean; far; external 'DELPHMID.DLL'; +{$ENDIF} +*) + +{-------------------------------------------------------------------} + +constructor Tmidioutput.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FState := mosClosed; + FNumdevs := midiOutGetNumDevs; + + { Create the window for callback notification } + if not (csDesigning in ComponentState) then + begin + Handle := AllocateHwnd(MidiOutput); + end; + +end; + +{-------------------------------------------------------------------} + +destructor Tmidioutput.Destroy; +begin + if FState = mosOpen then + Close; + if (PCtlInfo <> nil) then + GlobalSharedLockedFree(PCtlinfo^.hMem, PCtlInfo); + DeallocateHwnd(Handle); + inherited Destroy; +end; + +{-------------------------------------------------------------------} +{ Convert the numeric return code from an MMSYSTEM function to a string + using midioutGetErrorText. TODO: These errors aren't very helpful + (e.g. "an invalid parameter was passed to a system function") so + some proper error strings would be nice. } + + +function Tmidioutput.midioutErrorString(WError: Word): string; +var + errorDesc: PChar; +begin + errorDesc := nil; + try + errorDesc := StrAlloc(MAXERRORLENGTH); + if midioutGetErrorText(WError, errorDesc, MAXERRORLENGTH) = 0 then + result := StrPas(errorDesc) + else + result := 'Specified error number is out of range'; + finally + if errorDesc <> nil then StrDispose(errorDesc); + end; +end; + +{-------------------------------------------------------------------} +{ Set the output device ID and change the other properties to match } + +procedure Tmidioutput.SetDeviceID(DeviceID: Integer); +var + midioutCaps: TmidioutCaps; +begin + if FState = mosOpen then + raise EmidioutputError.Create('Change to DeviceID while device was open') + else + if (DeviceID >= midioutGetNumDevs) and (DeviceID <> MIDI_MAPPER) then + raise EmidioutputError.Create('Invalid device ID') + else + begin + FDeviceID := DeviceID; + + { Set the name and other midioutCAPS properties to match the ID } + FError := + midioutGetDevCaps(DeviceID, @midioutCaps, sizeof(TmidioutCaps)); + if Ferror > 0 then + raise EmidioutputError.Create(midioutErrorString(FError)); + + with midiOutCaps do + begin + FProductName := StrPas(szPname); + FDriverVersion := vDriverVersion; + FTechnology := OutPortTech(wTechnology); + FVoices := wVoices; + FNotes := wNotes; + FChannelMask := wChannelMask; + FSupport := dwSupport; + end; + + end; +end; + +{-------------------------------------------------------------------} +{ Set the product name property and put the matching output device number + in FDeviceID. + This is handy if you want to save a configured output/output device + by device name instead of device number, because device numbers may + change if users install or remove MIDI devices. + Exception if output device with matching name not found, + or if output device is open } + +procedure Tmidioutput.SetProductName(NewProductName: string); +var + midioutCaps: TmidioutCaps; + testDeviceID: Integer; + testProductName: string; +begin + if FState = mosOpen then + raise EmidioutputError.Create('Change to ProductName while device was open') + else + { Don't set the name if the component is reading properties because + the saved Productname will be from the machine the application was compiled + on, which may not be the same for the corresponding DeviceID on the user's + machine. The FProductname property will still be set by SetDeviceID } + if not (csLoading in ComponentState) then + begin + { Loop uses -1 to test for MIDI_MAPPER as well } + for testDeviceID := -1 to (midioutGetNumDevs - 1) do + begin + FError := + midioutGetDevCaps(testDeviceID, @midioutCaps, sizeof(TmidioutCaps)); + if Ferror > 0 then + raise EmidioutputError.Create(midioutErrorString(FError)); + testProductName := StrPas(midioutCaps.szPname); + if testProductName = NewProductName then + begin + FProductName := NewProductName; + Break; + end; + end; + if FProductName <> NewProductName then + raise EmidioutputError.Create('MIDI output Device ' + + NewProductName + ' not installed') + else + SetDeviceID(testDeviceID); + end; +end; + +{-------------------------------------------------------------------} +{ Set the output technology property and put the matching output device + number in FDeviceID. + This is handy, for example, if you want to be able to switch between a + sound card and a MIDI port } + +procedure TMidiOutput.SetTechnology(NewTechnology: OutPortTech); +var + midiOutCaps: TMidiOutCaps; + testDeviceID: Integer; + testTechnology: OutPortTech; +begin + if FState = mosOpen then + raise EMidiOutputError.Create( + 'Change to Product Technology while device was open') + else + begin + { Loop uses -1 to test for MIDI_MAPPER as well } + for testDeviceID := -1 to (midiOutGetNumDevs - 1) do + begin + FError := + midiOutGetDevCaps(testDeviceID, + @midiOutCaps, sizeof(TMidiOutCaps)); + if Ferror > 0 then + raise EMidiOutputError.Create(MidiOutErrorString(FError)); + testTechnology := OutPortTech(midiOutCaps.wTechnology); + if testTechnology = NewTechnology then + begin + FTechnology := NewTechnology; + Break; + end; + end; + if FTechnology <> NewTechnology then + raise EMidiOutputError.Create('MIDI output technology ' + + TechName[NewTechnology] + ' not installed') + else + SetDeviceID(testDeviceID); + end; +end; + +{-------------------------------------------------------------------} + +function Tmidioutput.Open: Boolean; +var + hMem: THandle; +begin + Result := False; + try + { Create the control info for the DLL } + if (PCtlInfo = nil) then + begin + PCtlInfo := GlobalSharedLockedAlloc(Sizeof(TMidiCtlInfo), hMem); + PctlInfo^.hMem := hMem; + end; + + Pctlinfo^.hWindow := Handle; { Control's window handle } + + FError := midioutOpen(@FMidiHandle, FDeviceId, + DWORD(@midiHandler), + DWORD(PCtlInfo), + CALLBACK_FUNCTION); +{ FError := midioutOpen(@FMidiHandle, FDeviceId, + Handle, + DWORD(PCtlInfo), + CALLBACK_WINDOW); } + if (FError <> 0) then + { TODO: use CreateFmtHelp to add MIDI device name/ID to message } + raise EmidioutputError.Create(midioutErrorString(FError)) + else + begin + Result := True; + FState := mosOpen; + end; + + except + if PCtlInfo <> nil then + begin + GlobalSharedLockedFree(PCtlInfo^.hMem, PCtlInfo); + PCtlInfo := nil; + end; + end; + +end; + +{-------------------------------------------------------------------} + +procedure TMidiOutput.PutShort(MidiMessage: Byte; Data1: Byte; Data2: Byte); +var + thisMsg: DWORD; +begin + thisMsg := DWORD(MidiMessage) or + (DWORD(Data1) shl 8) or + (DWORD(Data2) shl 16); + + FError := midiOutShortMsg(FMidiHandle, thisMsg); + if Ferror > 0 then + raise EmidioutputError.Create(midioutErrorString(FError)); +end; + +{-------------------------------------------------------------------} + +procedure TMidiOutput.PutLong(TheSysex: Pointer; msgLength: Word); +{ Notes: This works asynchronously; you send your sysex output by +calling this function, which returns immediately. When the MIDI device +driver has finished sending the data the MidiOutPut function in this +component is called, which will in turn call the OnMidiOutput method +if the component user has defined one. } +{ TODO: Combine common functions with PutTimedLong into subroutine } + +var + MyMidiHdr: TMyMidiHdr; +begin + { Initialize the header and allocate buffer memory } + MyMidiHdr := TMyMidiHdr.Create(msgLength); + + { Copy the data over to the MidiHdr buffer + We can't just use the caller's PChar because the buffer memory + has to be global, shareable, and locked. } + StrMove(MyMidiHdr.SysexPointer, TheSysex, msgLength); + + { Store the MyMidiHdr address in the header so we can find it again quickly + (see the MidiOutput proc) } + MyMidiHdr.hdrPointer^.dwUser := DWORD(MyMidiHdr); + + { Get MMSYSTEM's blessing for this header } + FError := midiOutPrepareHeader(FMidiHandle, MyMidiHdr.hdrPointer, + sizeof(TMIDIHDR)); + if Ferror > 0 then + raise EMidiOutputError.Create(MidiOutErrorString(FError)); + + { Send it } + FError := midiOutLongMsg(FMidiHandle, MyMidiHdr.hdrPointer, + sizeof(TMIDIHDR)); + if Ferror > 0 then + raise EMidiOutputError.Create(MidiOutErrorString(FError)); + +end; + +{-------------------------------------------------------------------} + +procedure Tmidioutput.PutMidiEvent(theEvent: TMyMidiEvent); +begin + if FState <> mosOpen then + raise EMidiOutputError.Create('MIDI Output device not open'); + + with theEvent do + begin + if Sysex = nil then + begin + PutShort(MidiMessage, Data1, Data2) + end + else + PutLong(Sysex, SysexLength); + end; +end; + +{-------------------------------------------------------------------} + +function Tmidioutput.Close: Boolean; +begin + Result := False; + if FState = mosOpen then + begin + + { Note this sends a lot of fast control change messages which some synths can't handle. + TODO: Make this optional. } +{ FError := midioutReset(FMidiHandle); + if Ferror <> 0 then + raise EMidiOutputError.Create(MidiOutErrorString(FError)); } + + FError := midioutClose(FMidiHandle); + if Ferror <> 0 then + raise EMidiOutputError.Create(MidiOutErrorString(FError)) + else + Result := True; + end; + + FMidiHandle := 0; + FState := mosClosed; + +end; + +{-------------------------------------------------------------------} + +procedure TMidiOutput.SetVolume(Left: Word; Right: Word); +var + dwVolume: DWORD; +begin + dwVolume := (DWORD(Left) shl 16) or Right; + FError := midiOutSetVolume(DeviceID, dwVolume); + if Ferror <> 0 then + raise EMidiOutputError.Create(MidiOutErrorString(FError)); +end; + +{-------------------------------------------------------------------} + +procedure Tmidioutput.midioutput(var Message: TMessage); +{ Triggered when sysex output from PutLong is complete } +var + MyMidiHdr: TMyMidiHdr; + thisHdr: PMidiHdr; +begin + if Message.Msg = Mom_Done then + begin + { Find the MIDIHDR we used for the output. Message.lParam is its address } + thisHdr := PMidiHdr(Message.lParam); + + { Remove it from the output device } + midiOutUnprepareHeader(FMidiHandle, thisHdr, sizeof(TMIDIHDR)); + + { Get the address of the MyMidiHdr object containing this MIDIHDR structure. + We stored this address in the PutLong procedure } + MyMidiHdr := TMyMidiHdr(thisHdr^.dwUser); + + { Header and copy of sysex data no longer required since output is complete } + MyMidiHdr.Free; + + { Call the user's event handler if any } + if Assigned(FOnmidioutput) then + FOnmidioutput(Self); + end; + { TODO: Case for MOM_PLAYBACK_DONE } +end; + +{-------------------------------------------------------------------} + +procedure Register; +begin + RegisterComponents('Synth', [Tmidioutput]); +end; + +end. + diff --git a/Game/Code/lib/midi/demo/MidiTest.dfm b/Game/Code/lib/midi/demo/MidiTest.dfm new file mode 100644 index 00000000..0d0ae182 Binary files /dev/null and b/Game/Code/lib/midi/demo/MidiTest.dfm differ diff --git a/Game/Code/lib/midi/demo/MidiTest.pas b/Game/Code/lib/midi/demo/MidiTest.pas new file mode 100644 index 00000000..0cf3e302 --- /dev/null +++ b/Game/Code/lib/midi/demo/MidiTest.pas @@ -0,0 +1,249 @@ +// Test application for TMidiFile + +unit MidiTest; + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + StdCtrls, MidiFile, ExtCtrls, MidiOut, MidiType, MidiScope, Grids; +type + TMidiPlayer = class(TForm) + OpenDialog1: TOpenDialog; + Button1: TButton; + Button3: TButton; + Button4: TButton; + MidiOutput1: TMidiOutput; + cmbInput: TComboBox; + MidiFile1: TMidiFile; + MidiScope1: TMidiScope; + Label3: TLabel; + edtBpm: TEdit; + Memo2: TMemo; + edtTime: TEdit; + Button2: TButton; + TrackGrid: TStringGrid; + TracksGrid: TStringGrid; + edtLength: TEdit; + procedure Button1Click(Sender: TObject); + procedure MidiFile1MidiEvent(event: PMidiEvent); + procedure Button3Click(Sender: TObject); + procedure Button4Click(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure cmbInputChange(Sender: TObject); + procedure MidiFile1UpdateEvent(Sender: TObject); + procedure Button2Click(Sender: TObject); + procedure edtBpmKeyPress(Sender: TObject; var Key: Char); + procedure TracksGridSelectCell(Sender: TObject; Col, Row: Integer; + var CanSelect: Boolean); + procedure FormShow(Sender: TObject); + private + { Private declarations } + MidiOpened : boolean; + procedure SentAllNotesOff; + + procedure MidiOpen; + procedure MidiClose; + + public + { Public declarations } + end; + +var + MidiPlayer: TMidiPlayer; + +implementation + +{$R *.DFM} + +procedure TMidiPlayer.Button1Click(Sender: TObject); +var + i,j: integer; + track : TMidiTrack; + event : PMidiEvent; +begin + if opendialog1.execute then + begin + midifile1.filename := opendialog1.filename; + midifile1.readfile; +// label1.caption := IntToStr(midifile1.NumberOfTracks); + edtBpm.text := IntToStr(midifile1.Bpm); +// TracksGrid.cells.clear; + for i := 0 to midifile1.NumberOfTracks-1 do + begin + track := midifile1.getTrack(i); + TracksGrid.cells[0,i] := 'Tr: '+ track.getName + ' '+ track.getInstrument ; + end; + edtLength.Text := MyTimeToStr(MidiFile1.GetTrackLength); + end; +end; + +procedure TMidiPlayer.MidiFile1MidiEvent(event: PMidiEvent); +var mEvent : TMyMidiEvent; +begin + mEvent := TMyMidiEvent.Create; + if not (event.event = $FF) then + begin + mEvent.MidiMessage := event.event; + mEvent.data1 := event.data1; + mEvent.data2 := event.data2; + midioutput1.PutMidiEvent(mEvent); + end + else + begin + if (event.data1 >= 1) and (event.data1 < 15) then + begin + memo2.Lines.add(IntToStr(event.data1) + ' '+ event.str); + end + end; + midiScope1.MidiEvent(event.event,event.data1,event.data2); + mEvent.Destroy; +end; + +procedure TMidiPlayer.SentAllNotesOff; +var mEvent : TMyMidiEvent; +channel : integer; +begin + mEvent := TMyMidiEvent.Create; + for channel:= 0 to 15 do + begin + mEvent.MidiMessage := $B0 + channel; + mEvent.data1 := $78; + mEvent.data2 := 0; + if MidiOpened then + midioutput1.PutMidiEvent(mEvent); + midiScope1.MidiEvent(mEvent.MidiMessage,mEvent.data1,mEvent.data2); + end; + mEvent.Destroy; +end; + +procedure TMidiPlayer.Button3Click(Sender: TObject); +begin + midifile1.StartPlaying; +end; + +procedure TMidiPlayer.Button4Click(Sender: TObject); +begin + midifile1.StopPlaying; + SentAllNotesOff; +end; + +procedure TMidiPlayer.MidiOpen; +begin + if not (cmbInput.Text = '') then + begin + MidiOutput1.ProductName := cmbInput.Text; + MidiOutput1.OPEN; + MidiOpened := true; + end; +end; + +procedure TMidiPlayer.MidiClose; +begin + if MidiOpened then + begin + MidiOutput1.Close; + MidiOpened := false; + end; +end; + + +procedure TMidiPlayer.FormCreate(Sender: TObject); +var thisDevice : integer; +begin + for thisDevice := 0 to MidiOutput1.NumDevs - 1 do + begin + MidiOutput1.DeviceID := thisDevice; + cmbInput.Items.Add(MidiOutput1.ProductName); + end; + cmbInput.ItemIndex := 0; + MidiOpened := false; + MidiOpen; +end; + +procedure TMidiPlayer.cmbInputChange(Sender: TObject); +begin + MidiClose; + MidiOPen; +end; + +procedure TMidiPlayer.MidiFile1UpdateEvent(Sender: TObject); +begin + edtTime.Text := MyTimeToStr(MidiFile1.GetCurrentTime); + edtTime.update; + if MidiFile1.ready then + begin + midifile1.StopPlaying; + SentAllNotesOff; + end; +end; + +procedure TMidiPlayer.Button2Click(Sender: TObject); +begin + MidiFile1.ContinuePlaying; +end; + +procedure TMidiPlayer.edtBpmKeyPress(Sender: TObject; var Key: Char); +begin + if Key = char(13) then + begin + MidiFile1.Bpm := StrToInt(edtBpm.Text); + edtBpm.text := IntToStr(midifile1.Bpm); + abort; + end; + +end; + +procedure TMidiPlayer.TracksGridSelectCell(Sender: TObject; Col, + Row: Integer; var CanSelect: Boolean); +var + MidiTrack : TMidiTrack; + i : integer; + j : integer; + event : PMidiEvent; +begin + CanSelect := false; + if Row < MidiFile1.NumberOfTracks then + begin + CanSelect := true; + MidiTrack := MidiFile1.GetTrack(Row); + TrackGrid.RowCount := 2; + TrackGrid.RowCount := MidiTrack.getEventCount; + j := 1; + for i := 0 to MidiTrack.GetEventCount-1 do + begin + event := MidiTrack.getEvent(i); + if not (event.len = -1) then + begin // do not print when + TrackGrid.cells[0,j] := IntToStr(i); + TrackGrid.cells[1,j] := MyTimeToStr(event.time); + TrackGrid.cells[2,j] := IntToHex(event.event,2); + if not (event.event = $FF) then + begin + TrackGrid.cells[3,j] := IntToStr(event.len); + TrackGrid.cells[4,j] := KeyToStr(event.data1); + TrackGrid.cells[5,j] := IntToStr(event.data2); + end + else + begin + TrackGrid.cells[3,j] := IntToStr(event.data1); + TrackGrid.cells[4,j] := ''; + TrackGrid.cells[5,j] := event.str; + end; + inc(j); + end; + end; + TrackGrid.RowCount := j; + end; +end; + +procedure TMidiPlayer.FormShow(Sender: TObject); +begin + TrackGrid.ColWidths[0] := 30; + TrackGrid.ColWidths[2] := 30; + TrackGrid.ColWidths[3] := 30; + TrackGrid.ColWidths[4] := 30; + TrackGrid.ColWidths[5] := 100; +end; + +end. diff --git a/Game/Code/lib/midi/demo/Project1.dpr b/Game/Code/lib/midi/demo/Project1.dpr new file mode 100644 index 00000000..4237e983 --- /dev/null +++ b/Game/Code/lib/midi/demo/Project1.dpr @@ -0,0 +1,13 @@ +program Project1; + +uses + Forms, + MidiTest in 'MidiTest.pas' {MidiPlayer}; + +{$R *.RES} + +begin + Application.Initialize; + Application.CreateForm(TMidiPlayer, MidiPlayer); + Application.Run; +end. diff --git a/Game/Code/lib/midi/demo/Project1.res b/Game/Code/lib/midi/demo/Project1.res new file mode 100644 index 00000000..2b020d69 Binary files /dev/null and b/Game/Code/lib/midi/demo/Project1.res differ diff --git a/Game/Code/lib/midi/midiComp.cfg b/Game/Code/lib/midi/midiComp.cfg new file mode 100644 index 00000000..2ee4ea3a --- /dev/null +++ b/Game/Code/lib/midi/midiComp.cfg @@ -0,0 +1,35 @@ +-$A+ +-$B- +-$C+ +-$D+ +-$E- +-$F- +-$G+ +-$H+ +-$I+ +-$J+ +-$K- +-$L+ +-$M- +-$N+ +-$O+ +-$P+ +-$Q- +-$R- +-$S- +-$T- +-$U- +-$V+ +-$W- +-$X+ +-$Y- +-$Z1 +-cg +-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; +-H+ +-W+ +-M +-$M16384,1048576 +-K$00400000 +-LE"d:\program files\borland\delphi5\Projects\Bpl" +-LN"d:\program files\borland\delphi5\Projects\Bpl" diff --git a/Game/Code/lib/midi/midiComp.dpk b/Game/Code/lib/midi/midiComp.dpk new file mode 100644 index 00000000..7c403eae --- /dev/null +++ b/Game/Code/lib/midi/midiComp.dpk @@ -0,0 +1,45 @@ +package midiComp; + +{$R *.RES} +{$R 'MidiFile.dcr'} +{$R 'Midiin.dcr'} +{$R 'Midiout.dcr'} +{$R 'MidiScope.dcr'} +{$ALIGN ON} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO OFF} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'Midi related components'} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + vcl50; + +contains + Miditype in 'Miditype.pas', + Mididefs in 'Mididefs.pas', + MidiFile in 'MidiFile.pas', + Midiin in 'Midiin.pas', + Midiout in 'Midiout.pas', + MidiScope in 'MidiScope.pas', + Midicons in 'Midicons.pas'; + +end. diff --git a/Game/Code/lib/midi/midiComp.res b/Game/Code/lib/midi/midiComp.res new file mode 100644 index 00000000..91fb756e Binary files /dev/null and b/Game/Code/lib/midi/midiComp.res differ diff --git a/Game/Code/lib/midi/midifile.dcr b/Game/Code/lib/midi/midifile.dcr new file mode 100644 index 00000000..2dd05cf4 Binary files /dev/null and b/Game/Code/lib/midi/midifile.dcr differ diff --git a/Game/Code/lib/midi/midiin.dcu b/Game/Code/lib/midi/midiin.dcu new file mode 100644 index 00000000..cb5d0bfb Binary files /dev/null and b/Game/Code/lib/midi/midiin.dcu differ diff --git a/Game/Code/lib/midi/midiscope.dcr b/Game/Code/lib/midi/midiscope.dcr new file mode 100644 index 00000000..441fb7f1 Binary files /dev/null and b/Game/Code/lib/midi/midiscope.dcr differ diff --git a/Game/Code/lib/midi/readme.txt b/Game/Code/lib/midi/readme.txt new file mode 100644 index 00000000..5e4207f6 --- /dev/null +++ b/Game/Code/lib/midi/readme.txt @@ -0,0 +1,60 @@ + +Midi components + TMidiFile, TMidiScope + TMidiIn and TMidiOut of david Churcher are included because they are used in + the demo application + +Freeware. + +100% source code, demo application. + +Included Components/Classes + +TMidiFile, read a midifile and have the contents available in memory + list of Tracks, track is list of events + + +TMidiScope, show all activity on a midi device + +TMidiIn and TMidiOut of David Churcher are included because they are used +in the demo application + +Midiplayer is a demo application which plays a midifile on a midi output + it is build fairly simple with the included components. The timer is used + to time the midievents. The timing is therefor as good as the windows timer. + + + The header of midifile,midiscope contains help information on the properties/functions + The example Midiplayer gives a good idea how to use the components + +Installation + open midiComp.dpk with file/open + compile and install the package + make sure that the directory where the files are located is in the library path + (tools/environment options/library) + +to run the demo + open project1.dpr in the demo directory and press run. + + + +history +1.0 18-1-1999 first release + +1.1 5-3-1999 update + added some functions for display purposes + improved demo to include event viewer + bpm can be changed + +1.2 24-2-2000 update + added some functions to see the length of a song and ready function to know when playback is ready + +for comments/bugs in these components: + +Frans Bouwmans +fbouwmans@spiditel.nl + +I'm busy building a software music synthesizer, which will be available in source +to the public. If you are interrested in helping me with certain soundmodules +(effects, filters, sound generators) just sent me an email. + diff --git a/Game/Code/lib/requirements.txt b/Game/Code/lib/requirements.txt new file mode 100644 index 00000000..bcf2fb82 --- /dev/null +++ b/Game/Code/lib/requirements.txt @@ -0,0 +1,17 @@ +Jedi-sdl + http://sourceforge.net/projects/jedi-sdl + + + + +BASS.pas + http://www.un4seen.com/download.php?bass23 + +zlportio + http://www.specosoft.com/en/download.html + +ffmpeg + http://www.iversenit.dk/dev/ffmpeg-headers/ + +SQLLite Wrapper + http://www.itwriting.com/sqlitesimple.php \ No newline at end of file diff --git a/Game/Code/lib/zlportio/Example/README.TXT b/Game/Code/lib/zlportio/Example/README.TXT new file mode 100644 index 00000000..dd71c689 --- /dev/null +++ b/Game/Code/lib/zlportio/Example/README.TXT @@ -0,0 +1,27 @@ + +PortIO example +Copyright (C) 2001 Zloba Alexander +http://www.specosoft.com +Description +----------- + This example show how tow to get direct access port input and output under + all versions of Microsoft Windows using ZlPortio library, + +Terms of Use +------------ + +This software is provided "as is", without any guarantee made +as to its suitability or fitness for any particular use. It may +contain bugs, so use of this tool is at your own risk. We take +no responsilbity for any damage that may unintentionally be caused +through its use. + +Reporting Problems +------------------ + +If you encounter problems, please visit http://www.specosoft.com +and download the latest version to see if the issue has been resolved. +If not, please send a bug report to: + + zal@specosoft.com + diff --git a/Game/Code/lib/zlportio/Example/install.txt b/Game/Code/lib/zlportio/Example/install.txt new file mode 100644 index 00000000..8d4f45a6 --- /dev/null +++ b/Game/Code/lib/zlportio/Example/install.txt @@ -0,0 +1,6 @@ + +Installation: + +Copy files: zlportio.pas, ddkint.pas to your project directory +or common unit directory. + diff --git a/Game/Code/lib/zlportio/Example/mainform.dfm b/Game/Code/lib/zlportio/Example/mainform.dfm new file mode 100644 index 00000000..42608286 Binary files /dev/null and b/Game/Code/lib/zlportio/Example/mainform.dfm differ diff --git a/Game/Code/lib/zlportio/Example/mainform.pas b/Game/Code/lib/zlportio/Example/mainform.pas new file mode 100644 index 00000000..295958c2 --- /dev/null +++ b/Game/Code/lib/zlportio/Example/mainform.pas @@ -0,0 +1,205 @@ +{$A-,H+} +unit mainform; + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + StdCtrls,zlportio, ComCtrls, shellapi,rdtsc; + +type + TMain = class(TForm) + lb1: TLabel; + ePort: TEdit; + lb2: TLabel; + eData: TEdit; + eRData: TEdit; + btnExit: TButton; + lb3: TLabel; + coDataType: TComboBox; + Lb4: TLabel; + gb1: TGroupBox; + sbBar: TStatusBar; + lb5: TLabel; + btnWrite: TButton; + btnRead: TButton; + cbDirect: TCheckBox; + llbWWW: TLabel; + procedure btnExitClick(Sender: TObject); + procedure ePortKeyUp(Sender: TObject; var Key: Word; + Shift: TShiftState); + procedure ePortKeyPress(Sender: TObject; var Key: Char); + procedure FormCreate(Sender: TObject); + procedure coDataTypeChange(Sender: TObject); + procedure ePortKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); + procedure btnWriteClick(Sender: TObject); + procedure eDataKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); + procedure btnReadClick(Sender: TObject); + procedure cbDirectClick(Sender: TObject); + procedure llbWWWClick(Sender: TObject); + private + { Private declarations } + public + { Public declarations } + procedure setrdata(const Data:dword); + function str2int(const value:string;const HEX:boolean):integer; + end; + +var + Main: TMain; +implementation + +{$R *.DFM} +{$R-} + +function TMain.str2int(const value:string;const HEX:boolean):integer; +begin + if HEX then + result := strtoint('$' + value) + else + result := strtoint(value); +end; + + +procedure TMain.btnExitClick(Sender: TObject); +begin + close; +end; + +procedure TMain.ePortKeyUp(Sender: TObject; var Key: Word; + Shift: TShiftState); +begin +try + Case key of + 38: begin + key := 0; + end; + 40: begin + key := 0; + end + end; +except +end; +end; + +procedure TMain.ePortKeyPress(Sender: TObject; var Key: Char); +begin + // filter on hex + if pos(key,#13#8'0123456789abcdefABCDEF')=0 then + key := #0; +end; + +procedure TMain.FormCreate(Sender: TObject); +begin + coDataType.itemindex :=0; + coDataType.Tag := 2; + if ZLIOStarted then + sbBar.SimpleText := 'Driver successfully started !' + else + sbBar.SimpleText := 'Couldnt start driver. Something wrong !'; +end; + +procedure TMain.coDataTypeChange(Sender: TObject); +var s:string; +begin + coDataType.Tag := 2 shl (coDataType.itemindex); + erdata.MaxLength := coDataType.Tag; + edata.MaxLength := coDataType.Tag; + s := edata.Text; + delete(s,1,length(s)-coDataType.Tag); + edata.text := s; +end; + +procedure TMain.ePortKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); +var Port,data:dword; +begin +try + try + Port := str2int(ePort.Text,true); + except + Port := 0; + end; + Case key of + 13: begin + zlioportwrite(port,coDataType.itemindex,str2int(eData.Text, true)); + end; + 38: begin + inc(Port); + ePort.Text := inttohex(Port,3); + key := 0; + end; + 40: begin + if port > 0 then + dec(Port); + ePort.Text := inttohex(Port,3); + key := 0; + end + end; + setthreadpriority(GetCurrentThread,THREAD_PRIORITY_TIME_CRITICAL); + data := zlioportread(Port,coDataType.itemindex); + setrdata(data); +except +end; + +end; + +procedure TMain.setrdata(const Data:dword); +begin + erData.Text := inttohex(Data,coDataType.Tag); +end; + +procedure TMain.btnWriteClick(Sender: TObject); +var i:word; +begin + i := 13; + ePortKeyDown( self,i,[]) +end; + + + +procedure TMain.eDataKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); +var data:dword; +begin + try + Data := str2int(eData.Text,true); + except Data := 0; end; + Case key of + 13: begin + ePortKeyDown( self,key,[]) + end; + 38: begin + inc(Data); + eData.Text := inttohex(Data,coDataType.Tag); + key := 0; + end; + 40: begin + dec(Data); + eData.Text := inttohex(Data,coDataType.Tag); + key := 0; + end + end; + +end; + +procedure TMain.btnReadClick(Sender: TObject); +var k:word; +begin + k := 0; + ePortKeyDown(self, k,[]); +end; + +procedure TMain.cbDirectClick(Sender: TObject); +begin +zliosetiopm(cbDirect.Checked); +end; + +procedure TMain.llbWWWClick(Sender: TObject); +begin + shellexecute( 0,'open','http://www.specosoft.com/update/portio_15.htm',nil,nil,SW_SHOW); +end; + +end. diff --git a/Game/Code/lib/zlportio/Example/portio.dof b/Game/Code/lib/zlportio/Example/portio.dof new file mode 100644 index 00000000..3f5c0f5c --- /dev/null +++ b/Game/Code/lib/zlportio/Example/portio.dof @@ -0,0 +1,85 @@ +[Compiler] +A=0 +B=0 +C=0 +D=1 +E=0 +F=0 +G=1 +H=1 +I=0 +J=1 +K=0 +L=1 +M=0 +N=1 +O=1 +P=1 +Q=0 +R=0 +S=0 +T=0 +U=0 +V=1 +W=0 +X=1 +Y=2 +Z=1 +ShowHints=1 +ShowWarnings=1 +UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; +[Linker] +MapFile=0 +OutputObjs=9 +ConsoleApp=1 +DebugInfo=0 +RemoteSymbols=0 +MinStackSize=16384 +MaxStackSize=1048576 +ImageBase=4194304 +ExeDescription= +[Directories] +OutputDir= +UnitOutputDir= +PackageDLLOutputDir= +PackageDCPOutputDir= +SearchPath= +Packages=Vcl50;Vclx50;VclSmp50;dclocx50;Vcldb50;dclaxserver50;zal +Conditionals= +DebugSourceDirs= +UsePackages=0 +[Parameters] +RunParams= +HostApplication= +[Language] +ActiveLang= +ProjectLang=$00000419 +RootDir= +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1049 +CodePage=1251 +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= +[HistoryLists\hlUnitAliases] +Count=1 +Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; diff --git a/Game/Code/lib/zlportio/Example/portio.dpr b/Game/Code/lib/zlportio/Example/portio.dpr new file mode 100644 index 00000000..5d86ae5d --- /dev/null +++ b/Game/Code/lib/zlportio/Example/portio.dpr @@ -0,0 +1,14 @@ +{$A-,H+} +program portio; + +uses + Forms, + mainform in 'mainform.pas' {Main}; + +{$R *.RES} + +begin + Application.Initialize; + Application.CreateForm(TMain, Main); + Application.Run; +end. diff --git a/Game/Code/lib/zlportio/Example/portio.res b/Game/Code/lib/zlportio/Example/portio.res new file mode 100644 index 00000000..08ba56e9 Binary files /dev/null and b/Game/Code/lib/zlportio/Example/portio.res differ diff --git a/Game/Code/lib/zlportio/Example/zlportio.sys b/Game/Code/lib/zlportio/Example/zlportio.sys new file mode 100644 index 00000000..19e42319 Binary files /dev/null and b/Game/Code/lib/zlportio/Example/zlportio.sys differ diff --git a/Game/Code/lib/zlportio/README.TXT b/Game/Code/lib/zlportio/README.TXT new file mode 100644 index 00000000..137f5c07 --- /dev/null +++ b/Game/Code/lib/zlportio/README.TXT @@ -0,0 +1,27 @@ + +ZLPortIO +Copyright (C) 2001 Zloba Alexander +http://www.specosoft.com +Description +----------- + This unit allow your application direct access port input and output under + all versions of Microsoft Windows, + +Terms of Use +------------ + +This software is provided "as is", without any guarantee made +as to its suitability or fitness for any particular use. It may +contain bugs, so use of this tool is at your own risk. We take +no responsilbity for any damage that may unintentionally be caused +through its use. + +Reporting Problems +------------------ + +If you encounter problems, please visit http://www.specosoft.com +and download the latest version to see if the issue has been resolved. +If not, please send a bug report to: + + zal@specosoft.com + diff --git a/Game/Code/lib/zlportio/Sys/zlportio.sys b/Game/Code/lib/zlportio/Sys/zlportio.sys new file mode 100644 index 00000000..a897a020 Binary files /dev/null and b/Game/Code/lib/zlportio/Sys/zlportio.sys differ diff --git a/Game/Code/lib/zlportio/ddkint.dcu b/Game/Code/lib/zlportio/ddkint.dcu new file mode 100644 index 00000000..b2ff8d0c Binary files /dev/null and b/Game/Code/lib/zlportio/ddkint.dcu differ diff --git a/Game/Code/lib/zlportio/ddkint.pas b/Game/Code/lib/zlportio/ddkint.pas new file mode 100644 index 00000000..d5b36be4 --- /dev/null +++ b/Game/Code/lib/zlportio/ddkint.pas @@ -0,0 +1,251 @@ +{ -----------------------------------------------------------------------------} +{ Copyright 2000-2001, Zloba Alexander. All Rights Reserved. } +{ This unit can be freely used and distributed in commercial and private } +{ environments, provided this notice is not modified in any way. } +{ -----------------------------------------------------------------------------} +{ Feel free to contact me if you have any questions, comments or suggestions at} +{ zal@specosoft.com (Zloba Alexander) } +{ You can always find the latest version of this unit at: } +{ http://www.specosoft.com } + +{ -----------------------------------------------------------------------------} +{ Date last modified: 08/10/2001 } +{ -----------------------------------------------------------------------------} +{ Description: } +{ This unit include service function to work with NT drivers and some } +{ constant from ntddk.h } +{------------------------------------------------------------------------------} +{ Revision History: } +{ 1.00: + First public release } +{ 1.10: + added compiler directives for correct compilation } +{ 1.20: + optimized code } +{ 1.30: + added constant for compatibility with delphi 3.0 } +{------------------------------------------------------------------------------} + +{$A-,H-} +unit ddkint; + +interface +uses windows,winsvc; + +function CTL_CODE(const DeviceType,Func,Method,Access:Cardinal):cardinal; + +const + FILE_DEVICE_BEEP = $00000001; + FILE_DEVICE_CD_ROM = $00000002; + FILE_DEVICE_CD_ROM_FILE_SYSTEM = $00000003; + FILE_DEVICE_CONTROLLER = $00000004; + FILE_DEVICE_DATALINK = $00000005; + FILE_DEVICE_DFS = $00000006; + FILE_DEVICE_DISK = $00000007; + FILE_DEVICE_DISK_FILE_SYSTEM = $00000008; + FILE_DEVICE_FILE_SYSTEM = $00000009; + FILE_DEVICE_INPORT_PORT = $0000000a; + FILE_DEVICE_KEYBOARD = $0000000b; + FILE_DEVICE_MAILSLOT = $0000000c; + FILE_DEVICE_MIDI_IN = $0000000d; + FILE_DEVICE_MIDI_OUT = $0000000e; + FILE_DEVICE_MOUSE = $0000000f; + FILE_DEVICE_MULTI_UNC_PROVIDER = $00000010; + FILE_DEVICE_NAMED_PIPE = $00000011; + FILE_DEVICE_NETWORK = $00000012; + FILE_DEVICE_NETWORK_BROWSER = $00000013; + FILE_DEVICE_NETWORK_FILE_SYSTEM= $00000014; + FILE_DEVICE_NULL = $00000015; + FILE_DEVICE_PARALLEL_PORT = $00000016; + FILE_DEVICE_PHYSICAL_NETCARD = $00000017; + FILE_DEVICE_PRINTER = $00000018; + FILE_DEVICE_SCANNER = $00000019; + FILE_DEVICE_SERIAL_MOUSE_PORT = $0000001a; + FILE_DEVICE_SERIAL_PORT = $0000001b; + FILE_DEVICE_SCREEN = $0000001c; + FILE_DEVICE_SOUND = $0000001d; + FILE_DEVICE_STREAMS = $0000001e; + FILE_DEVICE_TAPE = $0000001f; + FILE_DEVICE_TAPE_FILE_SYSTEM = $00000020; + FILE_DEVICE_TRANSPORT = $00000021; + FILE_DEVICE_UNKNOWN = $00000022; + FILE_DEVICE_VIDEO = $00000023; + FILE_DEVICE_VIRTUAL_DISK = $00000024; + FILE_DEVICE_WAVE_IN = $00000025; + FILE_DEVICE_WAVE_OUT = $00000026; + FILE_DEVICE_8042_PORT = $00000027; + FILE_DEVICE_NETWORK_REDIRECTOR = $00000028; + FILE_DEVICE_BATTERY = $00000029; + FILE_DEVICE_BUS_EXTENDER = $0000002a; + FILE_DEVICE_MODEM = $0000002b; + FILE_DEVICE_VDM = $0000002c; + FILE_DEVICE_MASS_STORAGE = $0000002d; + FILE_DEVICE_SMB = $0000002e; + FILE_DEVICE_KS = $0000002f; + FILE_DEVICE_CHANGER = $00000030; + FILE_DEVICE_SMARTCARD = $00000031; + FILE_DEVICE_ACPI = $00000032; + FILE_DEVICE_DVD = $00000033; + FILE_DEVICE_FULLSCREEN_VIDEO = $00000034; + FILE_DEVICE_DFS_FILE_SYSTEM = $00000035; + FILE_DEVICE_DFS_VOLUME = $00000036; + FILE_DEVICE_SERENUM = $00000037; + FILE_DEVICE_TERMSRV = $00000038; + FILE_DEVICE_KSEC = $00000039; + + FILE_DEVICE_KRNLDRVR = $80ff; + + METHOD_BUFFERED = 0; + METHOD_IN_DIRECT = 1; + METHOD_OUT_DIRECT = 2; + METHOD_NEITHER = 3; + + FILE_ANY_ACCESS = 0; + FILE_SPECIAL_ACCESS = (FILE_ANY_ACCESS); + FILE_READ_ACCESS = ( $0001 ); // file & pipe + FILE_WRITE_ACCESS = ( $0002 ); // file & pipe + + {$IFDEF VER100 or VER110} + // for compatibilty with delphi 3.0 +const + SERVICE_KERNEL_DRIVER = $00000001; + SERVICE_DEMAND_START = $00000003; + SERVICE_ERROR_NORMAL = $00000001; + +{$ENDIF} + +function driverstart(const name:pchar):integer; +function driverstop(const name:pchar):integer; + +// for this function must have Administrators or Power users rigths +function driverinstall(const path,name:pchar):integer; +function driverremove(const name:pchar):integer; + + +// exlpanation function +function messagestring(const error:integer):string; + +implementation + +function CTL_CODE(const DeviceType,Func,Method,Access:Cardinal):cardinal; +begin + Result := DeviceType shl 16 or Access shl 14 or Func shl 2 or Method; +end; + + +function driverinstall(const path,name:pchar):integer; +var hService: SC_HANDLE; + hSCMan : SC_HANDLE; +begin + + Result := 0; + + hSCMan := OpenSCManager(nil, nil, SC_MANAGER_ALL_ACCESS); + if hSCMan = 0 then begin + result := getlasterror; + exit; + end; + + hService := CreateService(hSCMan, name,name, + SERVICE_ALL_ACCESS, SERVICE_KERNEL_DRIVER, SERVICE_DEMAND_START, + SERVICE_ERROR_NORMAL, path, + nil, nil, nil, nil, nil); + + if (hService = 0) then begin + result := getlasterror; + CloseServiceHandle(hSCMan); + exit; + end + else + CloseServiceHandle(hService); + CloseServiceHandle(hSCMan); +end; + +function driverstart(const name:pchar):integer; +var + hService: SC_HANDLE; + hSCMan : SC_HANDLE; + args:pchar; +begin + + hSCMan := OpenSCManager(nil, nil, SC_MANAGER_CONNECT); + if hSCMan = 0 then begin + result := getlasterror; + exit; + end; + + // get a handle to the service + hService := OpenService(hSCMan, name, SERVICE_START); + if hService <> 0 then Begin + // start the driver + args := nil; + Result := 0; + if integer(StartService(hService, 0, args ))=0 then + result := getlasterror; + CloseServiceHandle(hService); + end + else + result := getlasterror; + CloseServiceHandle(hSCMan); +end; + +function driverstop(const name:pchar):integer; +Var + serviceStatus: TServiceStatus; + hService: SC_HANDLE; + hSCMan : SC_HANDLE; +begin + + hSCMan := OpenSCManager(nil, nil, SC_MANAGER_CONNECT); + if hSCMan = 0 then begin + result := getlasterror; + exit; + end; + + // get a handle to the service + hService := OpenService(hSCMan, Name, SERVICE_STOP); + if hService <> 0 then Begin + // start the driver + Result := 0; + if integer(ControlService(hService, SERVICE_CONTROL_STOP, serviceStatus))=0 then + result := getlasterror; + CloseServiceHandle(hService); + end + else + result := getlasterror; + CloseServiceHandle(hSCMan); +end; + +function driverremove(const name:pchar):integer; +Var + hService: SC_HANDLE; + hSCMan : SC_HANDLE; +begin + + hSCMan := OpenSCManager(nil, nil, SC_MANAGER_ALL_ACCESS); + if hSCMan = 0 then begin + result := getlasterror; + exit; + end; + + // get a handle to the service + hService := OpenService(hSCMan, Name, SERVICE_ALL_ACCESS); + if hService <> 0 then Begin + // remove driver description from the registry + Result := 0; + if integer(DeleteService(hService)) = 0 then + result := getlasterror; + CloseServiceHandle(hService); + end + else + result := getlasterror; + CloseServiceHandle(hSCMan); +end; + +function messagestring(const error:integer):string; +var p:pchar; +begin + GetMem(p, 200); + FillChar(p^, 200, 0); + formatmessage(FORMAT_MESSAGE_FROM_SYSTEM,nil,error,0,p,199,nil); + Result := p; + freemem(p,200); +end; + +end. diff --git a/Game/Code/lib/zlportio/install.txt b/Game/Code/lib/zlportio/install.txt new file mode 100644 index 00000000..7a92b29d --- /dev/null +++ b/Game/Code/lib/zlportio/install.txt @@ -0,0 +1,8 @@ + +Installation: + +Copy files: zlportio.pas, ddkint.pas to your project directory +or common unit directory. + +Copy file zlportio.sys to your project directory. +It should be in the one directory with you application. diff --git a/Game/Code/lib/zlportio/zlportio.dcu b/Game/Code/lib/zlportio/zlportio.dcu new file mode 100644 index 00000000..41419802 Binary files /dev/null and b/Game/Code/lib/zlportio/zlportio.dcu differ diff --git a/Game/Code/lib/zlportio/zlportio.pas b/Game/Code/lib/zlportio/zlportio.pas new file mode 100644 index 00000000..5a87be88 --- /dev/null +++ b/Game/Code/lib/zlportio/zlportio.pas @@ -0,0 +1,283 @@ +{ -----------------------------------------------------------------------------} +{ Copyright 2000-2001, Zloba Alexander. All Rights Reserved. } +{ This unit can be freely used and distributed in commercial and private } +{ environments, provided this notice is not modified in any way. } +{ -----------------------------------------------------------------------------} +{ Feel free to contact me if you have any questions, comments or suggestions at} +{ zal@specosoft.com (Zloba Alexander) } +{ You can always find the latest version of this unit at: } +{ http://www.specosoft.com } + +{ -----------------------------------------------------------------------------} +{ Date last modified: 08/10/2001 } +{ -----------------------------------------------------------------------------} +{ ZLPortIO driver interface unit v1.20 } +{ -----------------------------------------------------------------------------} +{ Description: } +{ This unit allow your application direct access port input and output under } +{ all versions of Microsoft Windows® } +{ Depends: } +{ zlportio.sys ddkint.pas } +{ You must distribute zlportio.sys with your application } +{ Procedures and functions: } +{ procedure zlioportread( const Port,DataType:dword ):dword; } +{ procedure zlioportwrite( const Port,DataType,Data:dword ); } +{ } +{ function portreadb( const Port:dword ):byte; } +{ function portreadw( const Port:dword ):word; } +{ function portreadl( const Port:dword ):dword; } +{ } +{ procedure portwriteb( const Port:Dword;const Data:byte ); } +{ procedure portwritew( const Port:dword;const Data:word ); } +{ procedure portwritel( const Port,Data:dword ); } +{ } +{ Examples: } +{ // get data bits from LPT port } +{ databits := portreadb( $378 ) } +{ // set data bits from LPT port } +{ portwriteb( $378, databits ) } +{ // The second parameter determine the databus length for operation } +{ -----------------------------------------------------------------------------} +{ Revision History: } +{ 1.00: + First public release } +{ 1.10: + Added new functions (portreadX,portwriteX) for convenience of usage } +{ 1.20: + Added new function (zliosetiopm) for enabling direct access to ports} +{ 1.30: + added compiler directives for correct compilation } +{ 1.40: + added opportunity to run multiply instances client to driver } +{ 1.50: - fixed bug with work under win98 } +{------------------------------------------------------------------------------} + +{$A-,H-} +unit zlportio; + +interface + +uses windows,sysutils,ddkint; + +Const + ZLIO_BYTE = 0; + ZLIO_WORD = 1; + ZLIO_DWORD = 2; + +var + +// if TRUE then driver was started +// in other case something wrong +// We start driver in initialization section of unit. + + ZlIOStarted:boolean = false; + +// if TRUE then we can use asm IN,OUT under NT/2000 +// see zliosetiopm for more details + ZlIODirect:boolean = false; + +// handle to opened driver + + HZLIO:THandle; + + +function portreadb( const Port:dword ):byte; +function portreadw( const Port:dword ):word; +function portreadl( const Port:dword ):dword; + +procedure portwriteb( const Port:Dword;const Data:byte ); +procedure portwritew( const Port:dword;const Data:word ); +procedure portwritel( const Port,Data:dword ); + + +procedure zlioportwrite( const Port,DataType,Data:dword ); +function zlioportread( const Port,DataType:dword ):dword; + +// if you need the best perfomance for your IO operations +// call zliosetiopm(TRUE). This allow your application +// to use asm command IN,OUT directly in your code. + +procedure zliosetiopm( const Direct:boolean ); + +// internal + +function zliostart:boolean; +procedure zliostop; + + +implementation + +const + ZLIODriverName='zlportio'; + +var + IOCTL_ZLUNI_PORT_READ:cardinal; + IOCTL_ZLUNI_PORT_WRITE:cardinal; + IOCTL_ZLUNI_IOPM_ON:cardinal; + IOCTL_ZLUNI_IOPM_OFF:cardinal; + +type +TzlIOData = record + Port,DataType,Data:dword; +end; + + +procedure zlioportwrite( const Port,DataType,Data:dword ); +var resdata:TZLIOData; + cBR:cardinal; +begin + if (not ZLIODirect) then begin + resdata.Port := Port; + resdata.Data := Data; + resdata.DataType := DataType; + if ZLIOStarted then + DeviceIoControl(HZLIO,IOCTL_ZLUNI_PORT_WRITE,@resdata,sizeof(resdata),nil,0,cBR,nil ); + end + else begin + Case DataType of + ZLIO_BYTE : asm mov edx,Port;mov eax,data;out dx,al; end; + ZLIO_WORD : asm mov edx,Port;mov eax,data;out dx,ax; end; + ZLIO_DWORD: asm mov edx,Port;mov eax,data;out dx,eax; end; + end; + end; +end; + +function zlioportread(const Port,DataType:dword):dword; +var resdata:TZLIOData; + cBR:cardinal;i:dword; +begin + if (not ZLIODirect) then begin + resdata.Port := Port; + resdata.DataType := DataType; + if ZLIOStarted then + DeviceIoControl(HZLIO,IOCTL_ZLUNI_PORT_READ,@resdata,sizeof(resdata),@i,sizeof(dword),cBR,nil ); + end + else begin + Case DataType of + ZLIO_BYTE : asm mov edx,Port;xor eax,eax;in al,dx;mov i,eax; end; + ZLIO_WORD : asm mov edx,Port;xor eax,eax;in ax,dx;mov i,eax; end; + ZLIO_DWORD: asm mov edx,Port;xor eax,eax;in eax,dx;mov i,eax end; + end; + end; + result := i; +end; + +function portreadb( const Port:dword ):byte; +begin + Result := zlioportread(Port,ZLIO_BYTE); +end; + +function portreadw( const Port:dword ):word; +begin + Result := zlioportread(Port,ZLIO_WORD); +end; + +function portreadl( const Port:dword ):dword; +begin + Result := zlioportread(Port,ZLIO_DWORD); +end; + +procedure portwriteb( const Port:Dword;const Data:byte ); +begin + zlioportwrite(Port,ZLIO_BYTE,Data); +end; + +procedure portwritew( const Port:dword;const Data:word ); +begin + zlioportwrite(Port,ZLIO_WORD,Data); +end; + +procedure portwritel( const Port,Data:dword ); +begin + zlioportwrite(Port,ZLIO_DWORD,Data); +end; + +procedure zliosetiopm( const Direct:boolean ); +var cBR:cardinal; +begin + if Win32Platform=VER_PLATFORM_WIN32_NT then + if ZLIOStarted then begin + if Direct then + DeviceIoControl(HZLIO,IOCTL_ZLUNI_IOPM_ON,nil,0,nil,0,cBR,nil ) + else + DeviceIoControl(HZLIO,IOCTL_ZLUNI_IOPM_OFF,nil,0,nil,0,cBR,nil ); + ZLIODirect := Direct; + end +end; + + + + +function zliostart; +var dir:shortstring; +begin + if Win32Platform<>VER_PLATFORM_WIN32_NT then begin + result := true; + exit; + end; +// Result := false; + zliostop; + dir := ExtractFileDir(ParamStr(0))+'\'+ZLIODriverName+'.sys'#0; + driverinstall(pchar(@dir[1]),ZLIODriverName+#0); + Result := driverstart(ZLIODriverName) = 0; +end; + +procedure zliostop; +begin + if Win32Platform<>VER_PLATFORM_WIN32_NT then + exit; + driverstop(ZLIODriverName); + driverremove(ZLIODriverName); +end; + +function zlioopen( var Handle:thandle):boolean; +var cERR:integer; + s:string; +begin + if Win32Platform<>VER_PLATFORM_WIN32_NT then begin + result := true; + exit; + end; + Result := false; + Handle := THandle(-1); + Handle := createFile('\\.\ZLPORTIO', + GENERIC_READ or GENERIC_WRITE, + 0, + nil, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + 0 ); + cERR := getlasterror; + s := messagestring( cerr); + if (cERR = ERROR_ALREADY_EXISTS)or(cERR = ERROR_SUCCESS) then Result := True; +end; + +procedure zlioclose( const Handle:thandle); +begin + if (Win32Platform=VER_PLATFORM_WIN32_NT) then + closehandle(Handle); +end; + + +initialization + +IOCTL_ZLUNI_PORT_READ := CTL_CODE(FILE_DEVICE_KRNLDRVR, 1, METHOD_BUFFERED, FILE_ANY_ACCESS); +IOCTL_ZLUNI_PORT_WRITE := CTL_CODE(FILE_DEVICE_KRNLDRVR, 2, METHOD_BUFFERED, FILE_ANY_ACCESS); +IOCTL_ZLUNI_IOPM_ON := CTL_CODE(FILE_DEVICE_KRNLDRVR, 3, METHOD_BUFFERED, FILE_ANY_ACCESS); +IOCTL_ZLUNI_IOPM_OFF := CTL_CODE(FILE_DEVICE_KRNLDRVR, 4, METHOD_BUFFERED, FILE_ANY_ACCESS); + + if Win32Platform<>VER_PLATFORM_WIN32_NT then begin + zliostarted := true; + zliodirect := true; + end + else begin + if not zlioopen(HZLIO) then begin + if zliostart then + ZLIOStarted := zlioopen(HZLIO) or (Win32Platform<>VER_PLATFORM_WIN32_NT); + end + else + ZLIOStarted := true; + end; +finalization + +if ZLIOStarted then + zliostop; + + + +end. -- cgit v1.2.3 From 5f4bffbda4942287ddef7ee02fae736901ede1dc Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 5 Sep 2007 12:04:30 +0000 Subject: fixed placeholder for jedi-sdl git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@369 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/JEDI-SDLv1.0/placeholder.txt | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Game/Code/lib/JEDI-SDLv1.0/placeholder.txt (limited to 'Game/Code') diff --git a/Game/Code/lib/JEDI-SDLv1.0/placeholder.txt b/Game/Code/lib/JEDI-SDLv1.0/placeholder.txt new file mode 100644 index 00000000..8a577497 --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/placeholder.txt @@ -0,0 +1,4 @@ +grab Jedi-sdl from : + http://sourceforge.net/projects/jedi-sdl + +and extract in this directory !! \ No newline at end of file -- 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/UScreenCredits.pas | 4 +++- Game/Code/Screens/UScreenEdit.pas | 4 +++- Game/Code/Screens/UScreenEditConvert.pas | 4 +++- Game/Code/Screens/UScreenEditHeader.pas | 1 + Game/Code/Screens/UScreenEditSub.pas | 8 ++++++-- Game/Code/Screens/UScreenLevel.pas | 3 ++- Game/Code/Screens/UScreenMain.pas | 3 ++- Game/Code/Screens/UScreenOpen.pas | 3 ++- Game/Code/Screens/UScreenOptions.pas | 4 +++- Game/Code/Screens/UScreenOptionsAdvanced.pas | 4 +++- Game/Code/Screens/UScreenOptionsGame.pas | 4 +++- Game/Code/Screens/UScreenOptionsGraphics.pas | 4 +++- Game/Code/Screens/UScreenOptionsLyrics.pas | 4 +++- Game/Code/Screens/UScreenOptionsRecord.pas | 3 ++- Game/Code/Screens/UScreenOptionsSound.pas | 4 +++- Game/Code/Screens/UScreenOptionsThemes.pas | 4 +++- Game/Code/Screens/UScreenPartyNewRound.pas | 4 +++- Game/Code/Screens/UScreenPartyOptions.pas | 4 +++- Game/Code/Screens/UScreenPartyPlayer.pas | 2 +- Game/Code/Screens/UScreenPartyScore.pas | 4 +++- Game/Code/Screens/UScreenPartyWin.pas | 4 +++- Game/Code/Screens/UScreenPopup.pas | 6 ++++-- Game/Code/Screens/UScreenScore.pas | 4 +++- Game/Code/Screens/UScreenSing.pas | 4 +++- Game/Code/Screens/UScreenSingModi.pas | 4 +++- Game/Code/Screens/UScreenSong.pas | 4 +++- Game/Code/Screens/UScreenSongJumpto.pas | 3 ++- Game/Code/Screens/UScreenSongMenu.pas | 4 +++- Game/Code/Screens/UScreenStatDetail.pas | 4 +++- Game/Code/Screens/UScreenStatMain.pas | 4 +++- Game/Code/Screens/UScreenTop5.pas | 5 ++++- Game/Code/Screens/UScreenWelcome.pas | 3 ++- 32 files changed, 91 insertions(+), 33 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index a0ef01af..deaa042e 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -112,7 +112,9 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin FadeTo(@ScreenMain); Music.PlayBack; diff --git a/Game/Code/Screens/UScreenEdit.pas b/Game/Code/Screens/UScreenEdit.pas index ac2964cd..93c2a5b4 100644 --- a/Game/Code/Screens/UScreenEdit.pas +++ b/Game/Code/Screens/UScreenEdit.pas @@ -32,7 +32,9 @@ begin begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Music.PlayBack; FadeTo(@ScreenMain); diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index f1e3ba32..791f8e50 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -83,7 +83,9 @@ begin Result := false; end; - SDLK_ESCAPE: + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin MidiFile.StopPlaying; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenEditHeader.pas b/Game/Code/Screens/UScreenEditHeader.pas index 35d7840f..a7105b0e 100644 --- a/Game/Code/Screens/UScreenEditHeader.pas +++ b/Game/Code/Screens/UScreenEditHeader.pas @@ -57,6 +57,7 @@ begin begin Result := false; end; + SDLK_ESCAPE : begin // Music.PlayBack; diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 9ca45f55..1d5cc66d 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -94,7 +94,9 @@ begin If (PressedDown) then begin // Key Down case PressedKey of - SDLK_ESCAPE: + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin FadeTo(@ScreenSong); end; @@ -565,7 +567,9 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of - SDLK_ESCAPE: + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin FadeTo(@ScreenSong); end; diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas index fc343042..34fc87af 100644 --- a/Game/Code/Screens/UScreenLevel.pas +++ b/Game/Code/Screens/UScreenLevel.pas @@ -29,7 +29,8 @@ begin Result := false; end; - SDLK_ESCAPE : + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Music.PlayBack; FadeTo(@ScreenName); diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 085f253d..3d591a5c 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -53,7 +53,8 @@ begin Result := false; end; - SDLK_ESCAPE : + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Result := False; end; diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index af984a21..68667d87 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -52,7 +52,8 @@ begin end; end; - SDLK_ESCAPE: + + SDLK_ESCAPE : begin //Empty Filename and go to last Screen FileName := ''; diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas index 02d42568..a1f64659 100644 --- a/Game/Code/Screens/UScreenOptions.pas +++ b/Game/Code/Screens/UScreenOptions.pas @@ -31,7 +31,9 @@ begin begin Result := false; end; - SDLK_ESCAPE: + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Ini.Save; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index 9cac8c5e..63c3aa7a 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -27,7 +27,9 @@ begin begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Ini.Save; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index 8712decc..0f69f326 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -29,7 +29,9 @@ begin begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Music.PlayBack; RefreshSongs; diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index c0641fc2..d4be6974 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -27,7 +27,9 @@ begin begin Result := false; end; - SDLK_ESCAPE: + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Ini.Save; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas index f4044933..5cadc5b9 100644 --- a/Game/Code/Screens/UScreenOptionsLyrics.pas +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -27,7 +27,9 @@ begin begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Ini.Save; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index b005492a..2ff989fa 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -32,7 +32,8 @@ begin begin Result := false; end; - SDLK_ESCAPE, SDLK_BACKSPACE: + SDLK_ESCAPE, + SDLK_BACKSPACE: begin Ini.Save; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index fb04ab64..3c3e28e4 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -27,7 +27,9 @@ begin begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Ini.Save; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index b73693c1..5b5f8877 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -30,7 +30,9 @@ begin begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Ini.Save; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index f084ee10..938aacfb 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -83,7 +83,9 @@ begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Music.PlayBack; CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 49cc8c53..493f3939 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -55,7 +55,9 @@ begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Music.PlayBack; FadeTo(@ScreenMain); diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index d6859775..e6830ee6 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -181,7 +181,7 @@ begin Button[Interaction].Text[0].DeleteLastL; end; - SDLK_ESCAPE : + SDLK_ESCAPE: begin Ini.SaveNames; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index 5c632356..6333896c 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -53,7 +53,9 @@ begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Music.PlayStart; if (PartySession.CurRound < High(PartySession.Rounds)) then diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas index 76d0420f..fecca3d1 100644 --- a/Game/Code/Screens/UScreenPartyWin.pas +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -46,7 +46,9 @@ begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Music.PlayStart; FadeTo(@ScreenMain); diff --git a/Game/Code/Screens/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas index 2a789e42..f583eb90 100644 --- a/Game/Code/Screens/UScreenPopup.pas +++ b/Game/Code/Screens/UScreenPopup.pas @@ -53,7 +53,8 @@ begin Result := false; end; - SDLK_ESCAPE : + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Display.CheckOK:=False; Display.NextScreenWithCheck:=NIL; @@ -159,7 +160,8 @@ begin Result := false; end; - SDLK_ESCAPE : + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Visible:=False; Result := false; diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index af1ccb59..2fdccf8e 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -64,7 +64,9 @@ begin Result := false; end; - SDLK_ESCAPE : + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin if (not Fadeout) then begin // Music.StopShuffle; diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 6ce19c17..8291a430 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -103,7 +103,9 @@ begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin //Record Sound Hack: //Sound[0].BufferLong diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 0b9ab893..e046e193 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -73,7 +73,9 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Finish; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index cddf864e..38266797 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -269,7 +269,9 @@ begin begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin if (Mode = 0) then begin diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 7103257d..48d23468 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -61,7 +61,8 @@ begin end; end; - SDLK_RETURN, SDLK_ESCAPE: + SDLK_RETURN, + SDLK_ESCAPE: begin Visible := False; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 06b8f183..9fe70522 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -73,7 +73,9 @@ begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Music.PlayBack; Visible := False; diff --git a/Game/Code/Screens/UScreenStatDetail.pas b/Game/Code/Screens/UScreenStatDetail.pas index 1461a9da..9dc6c525 100644 --- a/Game/Code/Screens/UScreenStatDetail.pas +++ b/Game/Code/Screens/UScreenStatDetail.pas @@ -47,7 +47,9 @@ begin begin Result := false; end; - SDLK_ESCAPE: + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Music.PlayBack; FadeTo(@ScreenStatMain); 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; diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas index 4d542bf0..0f758db6 100644 --- a/Game/Code/Screens/UScreenTop5.pas +++ b/Game/Code/Screens/UScreenTop5.pas @@ -37,7 +37,10 @@ begin Result := false; end; - SDLK_ESCAPE, SDLK_RETURN: + + SDLK_ESCAPE, + SDLK_BACKSPACE : + SDLK_RETURN: begin if (not Fadeout) then begin FadeTo(@ScreenSong); diff --git a/Game/Code/Screens/UScreenWelcome.pas b/Game/Code/Screens/UScreenWelcome.pas index 79fcc2c4..35e159f8 100644 --- a/Game/Code/Screens/UScreenWelcome.pas +++ b/Game/Code/Screens/UScreenWelcome.pas @@ -25,7 +25,8 @@ begin Result := true; If (PressedDown) Then begin case PressedKey of - SDLK_ESCAPE : + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Result := False; end; -- cgit v1.2.3 From 36559e7ea5ae827668ab97ebb032f3fbe0103f21 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 5 Sep 2007 12:40:45 +0000 Subject: added developer changelog for functional changes that the users should be informed of. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@371 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/developer_changelog.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Game/Code/developer_changelog.txt (limited to 'Game/Code') diff --git a/Game/Code/developer_changelog.txt b/Game/Code/developer_changelog.txt new file mode 100644 index 00000000..803aac07 --- /dev/null +++ b/Game/Code/developer_changelog.txt @@ -0,0 +1,10 @@ +Basic functionalty change log... +------------------------------------------------------------------------------------ +developers, please update this document with functional changes +( that have an effect on the user ) +so the packager can easily see whats been changed when doing a release changelog. +------------------------------------------------------------------------------------ + + +2007-Sep-05 JayBinks Ultrastar-DX now has basic navigation compatibility with Windows Media Center Remote controls ( and possibly others ). + ( Requires SDL.dll version 1.2 at shipping ) \ No newline at end of file -- cgit v1.2.3 From d63f6913483a56b2e9ee288a6eb90c957274fa1f Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 5 Sep 2007 14:29:02 +0000 Subject: Some Cleanup in SVN unneeded files deleted git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@372 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/SQLite/SQLite3.dcu | Bin 8243 -> 0 bytes Game/Code/lib/SQLite/SQLiteSpy.db3 | Bin 154624 -> 0 bytes Game/Code/lib/SQLite/SQLiteSpy.exe | Bin 1657856 -> 0 bytes Game/Code/lib/SQLite/SQLiteTable3.dcu | Bin 19499 -> 0 bytes Game/Code/lib/SQLite/SQLiteTable3.~pas | 761 --------------------------------- Game/Code/lib/SQLite/sqlite3.dll | Bin 388126 -> 0 bytes Game/Code/lib/SQLite/test.db | Bin 73728 -> 0 bytes Game/Code/lib/bass/delphi/bass.dcu | Bin 28085 -> 0 bytes Game/Code/lib/ffmpeg/avcodec.dcu | Bin 37652 -> 0 bytes Game/Code/lib/ffmpeg/avformat.dcu | Bin 14389 -> 0 bytes Game/Code/lib/ffmpeg/avio.dcu | Bin 7189 -> 0 bytes Game/Code/lib/ffmpeg/avutil.dcu | Bin 2515 -> 0 bytes Game/Code/lib/ffmpeg/opt.dcu | Bin 2442 -> 0 bytes Game/Code/lib/ffmpeg/rational.dcu | Bin 1395 -> 0 bytes Game/Code/lib/midi/Circbuf.dcu | Bin 2316 -> 0 bytes Game/Code/lib/midi/Delphmcb.dcu | Bin 1593 -> 0 bytes Game/Code/lib/midi/MIDIIN.DCR | Bin 476 -> 0 bytes Game/Code/lib/midi/MIDIOUT.DCR | Bin 476 -> 0 bytes Game/Code/lib/midi/MidiCons.dcu | Bin 1153 -> 0 bytes Game/Code/lib/midi/MidiDefs.dcu | Bin 1039 -> 0 bytes Game/Code/lib/midi/MidiFile.dcu | Bin 19657 -> 0 bytes Game/Code/lib/midi/MidiOut.dcu | Bin 11602 -> 0 bytes Game/Code/lib/midi/MidiType.dcu | Bin 2772 -> 0 bytes Game/Code/lib/midi/midifile.dcr | Bin 472 -> 0 bytes Game/Code/lib/midi/midiin.dcu | Bin 13057 -> 0 bytes Game/Code/lib/midi/midiscope.dcr | Bin 476 -> 0 bytes Game/Code/lib/zlportio/ddkint.dcu | Bin 5331 -> 0 bytes Game/Code/lib/zlportio/zlportio.dcu | Bin 4299 -> 0 bytes 28 files changed, 761 deletions(-) delete mode 100644 Game/Code/lib/SQLite/SQLite3.dcu delete mode 100644 Game/Code/lib/SQLite/SQLiteSpy.db3 delete mode 100644 Game/Code/lib/SQLite/SQLiteSpy.exe delete mode 100644 Game/Code/lib/SQLite/SQLiteTable3.dcu delete mode 100644 Game/Code/lib/SQLite/SQLiteTable3.~pas delete mode 100644 Game/Code/lib/SQLite/sqlite3.dll delete mode 100644 Game/Code/lib/SQLite/test.db delete mode 100644 Game/Code/lib/bass/delphi/bass.dcu delete mode 100644 Game/Code/lib/ffmpeg/avcodec.dcu delete mode 100644 Game/Code/lib/ffmpeg/avformat.dcu delete mode 100644 Game/Code/lib/ffmpeg/avio.dcu delete mode 100644 Game/Code/lib/ffmpeg/avutil.dcu delete mode 100644 Game/Code/lib/ffmpeg/opt.dcu delete mode 100644 Game/Code/lib/ffmpeg/rational.dcu delete mode 100644 Game/Code/lib/midi/Circbuf.dcu delete mode 100644 Game/Code/lib/midi/Delphmcb.dcu delete mode 100644 Game/Code/lib/midi/MIDIIN.DCR delete mode 100644 Game/Code/lib/midi/MIDIOUT.DCR delete mode 100644 Game/Code/lib/midi/MidiCons.dcu delete mode 100644 Game/Code/lib/midi/MidiDefs.dcu delete mode 100644 Game/Code/lib/midi/MidiFile.dcu delete mode 100644 Game/Code/lib/midi/MidiOut.dcu delete mode 100644 Game/Code/lib/midi/MidiType.dcu delete mode 100644 Game/Code/lib/midi/midifile.dcr delete mode 100644 Game/Code/lib/midi/midiin.dcu delete mode 100644 Game/Code/lib/midi/midiscope.dcr delete mode 100644 Game/Code/lib/zlportio/ddkint.dcu delete mode 100644 Game/Code/lib/zlportio/zlportio.dcu (limited to 'Game/Code') diff --git a/Game/Code/lib/SQLite/SQLite3.dcu b/Game/Code/lib/SQLite/SQLite3.dcu deleted file mode 100644 index 4ff1c1c7..00000000 Binary files a/Game/Code/lib/SQLite/SQLite3.dcu and /dev/null differ diff --git a/Game/Code/lib/SQLite/SQLiteSpy.db3 b/Game/Code/lib/SQLite/SQLiteSpy.db3 deleted file mode 100644 index 39ec37b5..00000000 Binary files a/Game/Code/lib/SQLite/SQLiteSpy.db3 and /dev/null differ diff --git a/Game/Code/lib/SQLite/SQLiteSpy.exe b/Game/Code/lib/SQLite/SQLiteSpy.exe deleted file mode 100644 index 04cf3c80..00000000 Binary files a/Game/Code/lib/SQLite/SQLiteSpy.exe and /dev/null differ diff --git a/Game/Code/lib/SQLite/SQLiteTable3.dcu b/Game/Code/lib/SQLite/SQLiteTable3.dcu deleted file mode 100644 index 59ec7037..00000000 Binary files a/Game/Code/lib/SQLite/SQLiteTable3.dcu and /dev/null differ diff --git a/Game/Code/lib/SQLite/SQLiteTable3.~pas b/Game/Code/lib/SQLite/SQLiteTable3.~pas deleted file mode 100644 index 01be1e5b..00000000 --- a/Game/Code/lib/SQLite/SQLiteTable3.~pas +++ /dev/null @@ -1,761 +0,0 @@ -unit SQLiteTable3; - -{ - Simple classes for using SQLite's exec and get_table. - - TSQLiteDatabase wraps the calls to open and close an SQLite database. - It also wraps SQLite_exec for queries that do not return a result set - - TSQLiteTable wraps sqlite_get_table. - It allows accessing fields by name as well as index and can step through a - result set with the Next procedure. - - Adapted by Tim Anderson (tim@itwriting.com) - Originally created by Pablo Pissanetzky (pablo@myhtpc.net) - Modified and enhanced by Lukas Gebauer -} - -interface - -uses - Windows, SQLite3, Classes, SysUtils; - -const - - dtInt = 1; - dtNumeric = 2; - dtStr = 3; - dtBlob = 4; - dtNull = 5; - -type - - ESQLiteException = class(Exception) - end; - - TSQLiteTable = class; - - TSQLiteDatabase = class - private - fDB: TSQLiteDB; - fInTrans: boolean; - procedure RaiseError(s: string; SQL: string); - public - constructor Create(const FileName: string); - destructor Destroy; override; - function GetTable(const SQL: string): TSQLiteTable; - procedure ExecSQL(const SQL: string); - function GetTableValue(const SQL: string): int64; - function GetTableString(const SQL: string): string; - procedure UpdateBlob(const SQL: string; BlobData: TStream); - procedure BeginTransaction; - procedure Commit; - procedure Rollback; - function TableExists(TableName: string): boolean; - function GetLastInsertRowID: int64; - procedure SetTimeout(Value: integer); - function version: string; - published - property isTransactionOpen: boolean read fInTrans; - end; - - TSQLiteTable = class - private - fResults: TList; - fRowCount: cardinal; - fColCount: cardinal; - fCols: TStringList; - fColTypes: TList; - fRow: cardinal; - function GetFields(I: cardinal): string; - function GetEOF: boolean; - function GetBOF: boolean; - function GetColumns(I: integer): string; - function GetFieldByName(FieldName: string): string; - function GetFieldIndex(FieldName: string): integer; - function GetCount: integer; - function GetCountResult: integer; - public - constructor Create(DB: TSQLiteDatabase; const SQL: string); - destructor Destroy; override; - function FieldAsInteger(I: cardinal): int64; - function FieldAsBlob(I: cardinal): TMemoryStream; - function FieldAsBlobText(I: cardinal): string; - function FieldIsNull(I: cardinal): boolean; - function FieldAsString(I: cardinal): string; - function FieldAsDouble(I: cardinal): double; - function Next: boolean; - function Previous: boolean; - property EOF: boolean read GetEOF; - property BOF: boolean read GetBOF; - property Fields[I: cardinal]: string read GetFields; - property FieldByName[FieldName: string]: string read GetFieldByName; - property FieldIndex[FieldName: string]: integer read GetFieldIndex; - property Columns[I: integer]: string read GetColumns; - property ColCount: cardinal read fColCount; - property RowCount: cardinal read fRowCount; - property Row: cardinal read fRow; - function MoveFirst: boolean; - function MoveLast: boolean; - property Count: integer read GetCount; - // The property CountResult is used when you execute count(*) queries. - // It returns 0 if the result set is empty or the value of the - // first field as an integer. - property CountResult: integer read GetCountResult; - end; - -procedure DisposePointer(ptr: pointer); cdecl; - - -implementation - -procedure DisposePointer(ptr: pointer); cdecl; -begin - if assigned(ptr) then - freemem(ptr); -end; - -//------------------------------------------------------------------------------ -// TSQLiteDatabase -//------------------------------------------------------------------------------ - -constructor TSQLiteDatabase.Create(const FileName: string); -var - Msg: pchar; - iResult: integer; -begin - inherited Create; - - self.fInTrans := False; - - Msg := nil; - try - iResult := SQLite3_Open(PChar(FileName), Fdb); - - if iResult <> SQLITE_OK then - if Assigned(Fdb) then - begin - Msg := Sqlite3_ErrMsg(Fdb); - raise ESqliteException.CreateFmt('Failed to open database "%s" : %s', - [FileName, Msg]); - end - else - raise ESqliteException.CreateFmt('Failed to open database "%s" : unknown error', - [FileName]); - - //set a few configs - self.ExecSQL('PRAGMA SYNCHRONOUS=NORMAL;'); -// self.ExecSQL('PRAGMA full_column_names = 1;'); - self.ExecSQL('PRAGMA temp_store = MEMORY;'); - - finally - if Assigned(Msg) then - SQLite3_Free(Msg); - end; - -end; - - -//.............................................................................. - -destructor TSQLiteDatabase.Destroy; -begin - - if self.fInTrans then - self.ExecSQL('ROLLBACK;'); //assume rollback - - if Assigned(fDB) then - SQLite3_Close(fDB); - - inherited; -end; - -function TSQLiteDatabase.GetLastInsertRowID: int64; -begin - Result := Sqlite3_LastInsertRowID(self.fDB); -end; - -//.............................................................................. - -procedure TSQLiteDatabase.RaiseError(s: string; SQL: string); -//look up last error and raise an exception with an appropriate message -var - Msg: PChar; -begin - - Msg := nil; - - if sqlite3_errcode(self.fDB) <> SQLITE_OK then - Msg := sqlite3_errmsg(self.fDB); - - if Msg <> nil then - raise ESqliteException.CreateFmt(s + ' "%s" : %s', [SQL, Msg]) - else - raise ESqliteException.CreateFmt(s, [SQL, 'No message']); - -end; - -procedure TSQLiteDatabase.ExecSQL(const SQL: string); -var - Stmt: TSQLiteStmt; - NextSQLStatement: Pchar; - iStepResult: integer; -begin - try - - if Sqlite3_Prepare(self.fDB, PChar(SQL), -1, Stmt, NextSQLStatement) <> - SQLITE_OK then - RaiseError('Error executing SQL', SQL); - - if (Stmt = nil) then - RaiseError('Could not prepare SQL statement', SQL); - - iStepResult := Sqlite3_step(Stmt); - - if (iStepResult <> SQLITE_DONE) then - RaiseError('Error executing SQL statement', SQL); - - finally - - if Assigned(Stmt) then - Sqlite3_Finalize(stmt); - - end; -end; - -procedure TSQLiteDatabase.UpdateBlob(const SQL: string; BlobData: TStream); -var - iSize: integer; - ptr: pointer; - Stmt: TSQLiteStmt; - Msg: Pchar; - NextSQLStatement: Pchar; - iStepResult: integer; - iBindResult: integer; -begin - //expects SQL of the form 'UPDATE MYTABLE SET MYFIELD = ? WHERE MYKEY = 1' - - if pos('?', SQL) = 0 then - RaiseError('SQL must include a ? parameter', SQL); - - Msg := nil; - try - - if Sqlite3_Prepare(self.fDB, PChar(SQL), -1, Stmt, NextSQLStatement) <> - SQLITE_OK then - RaiseError('Could not prepare SQL statement', SQL); - - if (Stmt = nil) then - RaiseError('Could not prepare SQL statement', SQL); - - //now bind the blob data - iSize := BlobData.size; - - GetMem(ptr, iSize); - - if (ptr = nil) then - raise ESqliteException.CreateFmt('Error getting memory to save blob', - [SQL, 'Error']); - - BlobData.position := 0; - BlobData.Read(ptr^, iSize); - - iBindResult := SQLite3_BindBlob(stmt, 1, ptr, iSize, @DisposePointer); - - if iBindResult <> SQLITE_OK then - RaiseError('Error binding blob to database', SQL); - - iStepResult := Sqlite3_step(Stmt); - - if (iStepResult <> SQLITE_DONE) then - RaiseError('Error executing SQL statement', SQL); - - finally - - if Assigned(Stmt) then - Sqlite3_Finalize(stmt); - - if Assigned(Msg) then - SQLite3_Free(Msg); - end; - -end; - -//.............................................................................. - -function TSQLiteDatabase.GetTable(const SQL: string): TSQLiteTable; -begin - Result := TSQLiteTable.Create(Self, SQL); -end; - -function TSQLiteDatabase.GetTableValue(const SQL: string): int64; -var - Table: TSQLiteTable; -begin - Table := self.GetTable(SQL); - try - Result := Table.FieldAsInteger(0); - finally - Table.Free; - end; -end; - -function TSQLiteDatabase.GetTableString(const SQL: string): string; -var - Table: TSQLiteTable; -begin - Table := self.GetTable(SQL); - try - Result := Table.FieldAsString(0); - finally - Table.Free; - end; -end; - - -procedure TSQLiteDatabase.BeginTransaction; -begin - if not self.fInTrans then - begin - self.ExecSQL('BEGIN TRANSACTION;'); - self.fInTrans := True; - end - else - raise ESqliteException.Create('Transaction already open'); -end; - -procedure TSQLiteDatabase.Commit; -begin - self.ExecSQL('COMMIT;'); - self.fInTrans := False; -end; - -procedure TSQLiteDatabase.Rollback; -begin - self.ExecSQL('ROLLBACK;'); - self.fInTrans := False; -end; - -function TSQLiteDatabase.TableExists(TableName: string): boolean; -var - sql: string; - ds: TSqliteTable; -begin - //returns true if table exists in the database - sql := 'select [sql] from sqlite_master where [type] = ''table'' and lower(name) = ''' + - lowercase(TableName) + ''' '; - ds := self.GetTable(sql); - try - Result := (ds.Count > 0); - finally - ds.Free; - end; -end; - -procedure TSQLiteDatabase.SetTimeout(Value: integer); -begin - SQLite3_BusyTimeout(self.fDB, Value); -end; - -function TSQLiteDatabase.version: string; -begin - Result := SQLite3_Version; -end; - - -//------------------------------------------------------------------------------ -// TSQLiteTable -//------------------------------------------------------------------------------ - -constructor TSQLiteTable.Create(DB: TSQLiteDatabase; const SQL: string); -var - Stmt: TSQLiteStmt; - NextSQLStatement: Pchar; - iStepResult: integer; - ptr: pointer; - iNumBytes: integer; - thisBlobValue: TMemoryStream; - thisStringValue: pstring; - thisDoubleValue: pDouble; - thisIntValue: pInt64; - thisColType: pInteger; - i: integer; - DeclaredColType: Pchar; - ActualColType: integer; - ptrValue: Pchar; -begin - try - self.fRowCount := 0; - self.fColCount := 0; - //if there are several SQL statements in SQL, NextSQLStatment points to the - //beginning of the next one. Prepare only prepares the first SQL statement. - if Sqlite3_Prepare(DB.fDB, PChar(SQL), -1, Stmt, NextSQLStatement) <> SQLITE_OK then - DB.RaiseError('Error executing SQL', SQL); - if (Stmt = nil) then - DB.RaiseError('Could not prepare SQL statement', SQL); - iStepResult := Sqlite3_step(Stmt); - while (iStepResult <> SQLITE_DONE) do - begin - case iStepResult of - SQLITE_ROW: - begin - Inc(fRowCount); - if (fRowCount = 1) then - begin - //get data types - fCols := TStringList.Create; - fColTypes := TList.Create; - fColCount := SQLite3_ColumnCount(stmt); - for i := 0 to Pred(fColCount) do - fCols.Add(AnsiUpperCase(Sqlite3_ColumnName(stmt, i))); - for i := 0 to Pred(fColCount) do - begin - new(thisColType); - DeclaredColType := Sqlite3_ColumnDeclType(stmt, i); - if DeclaredColType = nil then - thisColType^ := Sqlite3_ColumnType(stmt, i) //use the actual column type instead - //seems to be needed for last_insert_rowid - else - if (DeclaredColType = 'INTEGER') or (DeclaredColType = 'BOOLEAN') then - thisColType^ := dtInt - else - if (DeclaredColType = 'NUMERIC') or - (DeclaredColType = 'FLOAT') or - (DeclaredColType = 'DOUBLE') or - (DeclaredColType = 'REAL') then - thisColType^ := dtNumeric - else - if DeclaredColType = 'BLOB' then - thisColType^ := dtBlob - else - thisColType^ := dtStr; - fColTypes.Add(thiscoltype); - end; - fResults := TList.Create; - end; - - //get column values - for i := 0 to Pred(ColCount) do - begin - ActualColType := Sqlite3_ColumnType(stmt, i); - if (ActualColType = SQLITE_NULL) then - fResults.Add(nil) - else - if pInteger(fColTypes[i])^ = dtInt then - begin - new(thisintvalue); - thisintvalue^ := Sqlite3_ColumnInt64(stmt, i); - fResults.Add(thisintvalue); - end - else - if pInteger(fColTypes[i])^ = dtNumeric then - begin - new(thisdoublevalue); - thisdoublevalue^ := Sqlite3_ColumnDouble(stmt, i); - fResults.Add(thisdoublevalue); - end - else - if pInteger(fColTypes[i])^ = dtBlob then - begin - iNumBytes := Sqlite3_ColumnBytes(stmt, i); - if iNumBytes = 0 then - thisblobvalue := nil - else - begin - thisblobvalue := TMemoryStream.Create; - thisblobvalue.position := 0; - ptr := Sqlite3_ColumnBlob(stmt, i); - thisblobvalue.writebuffer(ptr^, iNumBytes); - end; - fResults.Add(thisblobvalue); - end - else - begin - new(thisstringvalue); - ptrValue := Sqlite3_ColumnText(stmt, i); - setstring(thisstringvalue^, ptrvalue, strlen(ptrvalue)); - fResults.Add(thisstringvalue); - end; - end; - end; - SQLITE_BUSY: - raise ESqliteException.CreateFmt('Could not prepare SQL statement', - [SQL, 'SQLite is Busy']); - else - DB.RaiseError('Could not retrieve data', SQL); - end; - iStepResult := Sqlite3_step(Stmt); - end; - fRow := 0; - finally - if Assigned(Stmt) then - Sqlite3_Finalize(stmt); - end; -end; - -//.............................................................................. - -destructor TSQLiteTable.Destroy; -var - i: cardinal; - iColNo: integer; -begin - if Assigned(fResults) then - begin - for i := 0 to fResults.Count - 1 do - begin - //check for blob type - iColNo := (i mod fColCount); - case pInteger(self.fColTypes[iColNo])^ of - dtBlob: - TMemoryStream(fResults[i]).Free; - dtStr: - if fResults[i] <> nil then - begin - setstring(string(fResults[i]^), nil, 0); - dispose(fResults[i]); - end; - else - dispose(fResults[i]); - end; - end; - fResults.Free; - end; - if Assigned(fCols) then - fCols.Free; - if Assigned(fColTypes) then - for i := 0 to fColTypes.Count - 1 do - dispose(fColTypes[i]); - fColTypes.Free; - inherited; -end; - -//.............................................................................. - -function TSQLiteTable.GetColumns(I: integer): string; -begin - Result := fCols[I]; -end; - -//.............................................................................. - -function TSQLiteTable.GetCountResult: integer; -begin - if not EOF then - Result := StrToInt(Fields[0]) - else - Result := 0; -end; - -function TSQLiteTable.GetCount: integer; -begin - Result := FRowCount; -end; - -//.............................................................................. - -function TSQLiteTable.GetEOF: boolean; -begin - Result := fRow >= fRowCount; -end; - -function TSQLiteTable.GetBOF: boolean; -begin - Result := fRow <= 0; -end; - -//.............................................................................. - -function TSQLiteTable.GetFieldByName(FieldName: string): string; -begin - Result := GetFields(self.GetFieldIndex(FieldName)); -end; - -function TSQLiteTable.GetFieldIndex(FieldName: string): integer; -begin - - if (fCols = nil) then - begin - raise ESqliteException.Create('Field ' + fieldname + ' Not found. Empty dataset'); - exit; - end; - - if (fCols.count = 0) then - begin - raise ESqliteException.Create('Field ' + fieldname + ' Not found. Empty dataset'); - exit; - end; - - Result := fCols.IndexOf(AnsiUpperCase(FieldName)); - - if (result < 0) then - begin raise ESqliteException.Create('Field not found in dataset: ' + fieldname) end; - -end; - -//.............................................................................. - -function TSQLiteTable.GetFields(I: cardinal): string; -var - thisvalue: pstring; - thistype: integer; -begin - Result := ''; - if EOF then - raise ESqliteException.Create('Table is at End of File'); - //integer types are not stored in the resultset - //as strings, so they should be retrieved using the type-specific - //methods - thistype := pInteger(self.fColTypes[I])^; - - case thistype of - dtStr: - begin - thisvalue := self.fResults[(self.frow * self.fColCount) + I]; - if (thisvalue <> nil) then - Result := thisvalue^ - else - Result := ''; - end; - dtInt: - Result := IntToStr(self.FieldAsInteger(I)); - dtNumeric: - Result := FloatToStr(self.FieldAsDouble(I)); - dtBlob: - Result := self.FieldAsBlobText(I); - else - Result := ''; - end; -end; - -function TSqliteTable.FieldAsBlob(I: cardinal): TMemoryStream; -begin - if EOF then - raise ESqliteException.Create('Table is at End of File'); - if (self.fResults[(self.frow * self.fColCount) + I] = nil) then - Result := nil - else - if pInteger(self.fColTypes[I])^ = dtBlob then - Result := TMemoryStream(self.fResults[(self.frow * self.fColCount) + I]) - else - raise ESqliteException.Create('Not a Blob field'); -end; - -function TSqliteTable.FieldAsBlobText(I: cardinal): string; -var - MemStream: TMemoryStream; - Buffer: PChar; -begin - Result := ''; - MemStream := self.FieldAsBlob(I); - if MemStream <> nil then - if MemStream.Size > 0 then - begin - MemStream.position := 0; - Buffer := stralloc(MemStream.Size + 1); - MemStream.readbuffer(Buffer[0], MemStream.Size); - (Buffer + MemStream.Size)^ := chr(0); - SetString(Result, Buffer, MemStream.size); - strdispose(Buffer); - end; -end; - - -function TSqliteTable.FieldAsInteger(I: cardinal): int64; -begin - if EOF then - //raise ESqliteException.Create('Table is at End of File'); - Result := 0; - else if (self.fResults[(self.frow * self.fColCount) + I] = nil) then - Result := 0 - else - if pInteger(self.fColTypes[I])^ = dtInt then - Result := pInt64(self.fResults[(self.frow * self.fColCount) + I])^ - else - if pInteger(self.fColTypes[I])^ = dtNumeric then - Result := trunc(strtofloat(pString(self.fResults[(self.frow * self.fColCount) + I])^)) - else - raise ESqliteException.Create('Not an integer or numeric field'); -end; - -function TSqliteTable.FieldAsDouble(I: cardinal): double; -begin - if EOF then - raise ESqliteException.Create('Table is at End of File'); - if (self.fResults[(self.frow * self.fColCount) + I] = nil) then - Result := 0 - else - if pInteger(self.fColTypes[I])^ = dtInt then - Result := pInt64(self.fResults[(self.frow * self.fColCount) + I])^ - else - if pInteger(self.fColTypes[I])^ = dtNumeric then - Result := pDouble(self.fResults[(self.frow * self.fColCount) + I])^ - else - raise ESqliteException.Create('Not an integer or numeric field'); -end; - -function TSqliteTable.FieldAsString(I: cardinal): string; -begin - if EOF then - raise ESqliteException.Create('Table is at End of File'); - if (self.fResults[(self.frow * self.fColCount) + I] = nil) then - Result := '' - else - Result := self.GetFields(I); -end; - -function TSqliteTable.FieldIsNull(I: cardinal): boolean; -var - thisvalue: pointer; -begin - if EOF then - raise ESqliteException.Create('Table is at End of File'); - thisvalue := self.fResults[(self.frow * self.fColCount) + I]; - Result := (thisvalue = nil); -end; - -//.............................................................................. - -function TSQLiteTable.Next: boolean; -begin - Result := False; - if not EOF then - begin - Inc(fRow); - Result := True; - end; -end; - -function TSQLiteTable.Previous: boolean; -begin - Result := False; - if not BOF then - begin - Dec(fRow); - Result := True; - end; -end; - -function TSQLiteTable.MoveFirst: boolean; -begin - Result := False; - if self.fRowCount > 0 then - begin - fRow := 0; - Result := True; - end; -end; - -function TSQLiteTable.MoveLast: boolean; -begin - Result := False; - if self.fRowCount > 0 then - begin - fRow := fRowCount - 1; - Result := True; - end; -end; - - -end. - diff --git a/Game/Code/lib/SQLite/sqlite3.dll b/Game/Code/lib/SQLite/sqlite3.dll deleted file mode 100644 index 7111873f..00000000 Binary files a/Game/Code/lib/SQLite/sqlite3.dll and /dev/null differ diff --git a/Game/Code/lib/SQLite/test.db b/Game/Code/lib/SQLite/test.db deleted file mode 100644 index c7fc4356..00000000 Binary files a/Game/Code/lib/SQLite/test.db and /dev/null differ diff --git a/Game/Code/lib/bass/delphi/bass.dcu b/Game/Code/lib/bass/delphi/bass.dcu deleted file mode 100644 index d9f949e9..00000000 Binary files a/Game/Code/lib/bass/delphi/bass.dcu and /dev/null differ diff --git a/Game/Code/lib/ffmpeg/avcodec.dcu b/Game/Code/lib/ffmpeg/avcodec.dcu deleted file mode 100644 index a682a490..00000000 Binary files a/Game/Code/lib/ffmpeg/avcodec.dcu and /dev/null differ diff --git a/Game/Code/lib/ffmpeg/avformat.dcu b/Game/Code/lib/ffmpeg/avformat.dcu deleted file mode 100644 index e86630d0..00000000 Binary files a/Game/Code/lib/ffmpeg/avformat.dcu and /dev/null differ diff --git a/Game/Code/lib/ffmpeg/avio.dcu b/Game/Code/lib/ffmpeg/avio.dcu deleted file mode 100644 index 646b76d2..00000000 Binary files a/Game/Code/lib/ffmpeg/avio.dcu and /dev/null differ diff --git a/Game/Code/lib/ffmpeg/avutil.dcu b/Game/Code/lib/ffmpeg/avutil.dcu deleted file mode 100644 index c4f0fe95..00000000 Binary files a/Game/Code/lib/ffmpeg/avutil.dcu and /dev/null differ diff --git a/Game/Code/lib/ffmpeg/opt.dcu b/Game/Code/lib/ffmpeg/opt.dcu deleted file mode 100644 index c23af7e4..00000000 Binary files a/Game/Code/lib/ffmpeg/opt.dcu and /dev/null differ diff --git a/Game/Code/lib/ffmpeg/rational.dcu b/Game/Code/lib/ffmpeg/rational.dcu deleted file mode 100644 index 51265ca0..00000000 Binary files a/Game/Code/lib/ffmpeg/rational.dcu and /dev/null differ diff --git a/Game/Code/lib/midi/Circbuf.dcu b/Game/Code/lib/midi/Circbuf.dcu deleted file mode 100644 index 53f20d61..00000000 Binary files a/Game/Code/lib/midi/Circbuf.dcu and /dev/null differ diff --git a/Game/Code/lib/midi/Delphmcb.dcu b/Game/Code/lib/midi/Delphmcb.dcu deleted file mode 100644 index becf0c2f..00000000 Binary files a/Game/Code/lib/midi/Delphmcb.dcu and /dev/null differ diff --git a/Game/Code/lib/midi/MIDIIN.DCR b/Game/Code/lib/midi/MIDIIN.DCR deleted file mode 100644 index 5d802695..00000000 Binary files a/Game/Code/lib/midi/MIDIIN.DCR and /dev/null differ diff --git a/Game/Code/lib/midi/MIDIOUT.DCR b/Game/Code/lib/midi/MIDIOUT.DCR deleted file mode 100644 index d111c9be..00000000 Binary files a/Game/Code/lib/midi/MIDIOUT.DCR and /dev/null differ diff --git a/Game/Code/lib/midi/MidiCons.dcu b/Game/Code/lib/midi/MidiCons.dcu deleted file mode 100644 index fdb38cfb..00000000 Binary files a/Game/Code/lib/midi/MidiCons.dcu and /dev/null differ diff --git a/Game/Code/lib/midi/MidiDefs.dcu b/Game/Code/lib/midi/MidiDefs.dcu deleted file mode 100644 index df0e8915..00000000 Binary files a/Game/Code/lib/midi/MidiDefs.dcu and /dev/null differ diff --git a/Game/Code/lib/midi/MidiFile.dcu b/Game/Code/lib/midi/MidiFile.dcu deleted file mode 100644 index 39038e82..00000000 Binary files a/Game/Code/lib/midi/MidiFile.dcu and /dev/null differ diff --git a/Game/Code/lib/midi/MidiOut.dcu b/Game/Code/lib/midi/MidiOut.dcu deleted file mode 100644 index fd1f8c4f..00000000 Binary files a/Game/Code/lib/midi/MidiOut.dcu and /dev/null differ diff --git a/Game/Code/lib/midi/MidiType.dcu b/Game/Code/lib/midi/MidiType.dcu deleted file mode 100644 index 2002ca1a..00000000 Binary files a/Game/Code/lib/midi/MidiType.dcu and /dev/null differ diff --git a/Game/Code/lib/midi/midifile.dcr b/Game/Code/lib/midi/midifile.dcr deleted file mode 100644 index 2dd05cf4..00000000 Binary files a/Game/Code/lib/midi/midifile.dcr and /dev/null differ diff --git a/Game/Code/lib/midi/midiin.dcu b/Game/Code/lib/midi/midiin.dcu deleted file mode 100644 index cb5d0bfb..00000000 Binary files a/Game/Code/lib/midi/midiin.dcu and /dev/null differ diff --git a/Game/Code/lib/midi/midiscope.dcr b/Game/Code/lib/midi/midiscope.dcr deleted file mode 100644 index 441fb7f1..00000000 Binary files a/Game/Code/lib/midi/midiscope.dcr and /dev/null differ diff --git a/Game/Code/lib/zlportio/ddkint.dcu b/Game/Code/lib/zlportio/ddkint.dcu deleted file mode 100644 index b2ff8d0c..00000000 Binary files a/Game/Code/lib/zlportio/ddkint.dcu and /dev/null differ diff --git a/Game/Code/lib/zlportio/zlportio.dcu b/Game/Code/lib/zlportio/zlportio.dcu deleted file mode 100644 index 41419802..00000000 Binary files a/Game/Code/lib/zlportio/zlportio.dcu and /dev/null differ -- cgit v1.2.3 From addda3536d0d82714e826994b3a10c6b468c3252 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 5 Sep 2007 14:45:42 +0000 Subject: Fixed two Bugs in KeyDown Handling that causes that the code could not be compiled. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@373 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditSub.pas | 3 +-- Game/Code/Screens/UScreenTop5.pas | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 1d5cc66d..948ff2cc 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -568,8 +568,7 @@ begin begin // Key Down case PressedKey of - SDLK_ESCAPE, - SDLK_BACKSPACE : + SDLK_ESCAPE: begin FadeTo(@ScreenSong); end; diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas index 0f758db6..f9de4114 100644 --- a/Game/Code/Screens/UScreenTop5.pas +++ b/Game/Code/Screens/UScreenTop5.pas @@ -39,7 +39,7 @@ begin SDLK_ESCAPE, - SDLK_BACKSPACE : + SDLK_BACKSPACE, SDLK_RETURN: begin if (not Fadeout) then begin -- cgit v1.2.3 From 247cbdca4eb8af228fa1753f1185e85077b5befa Mon Sep 17 00:00:00 2001 From: b1indy Date: Fri, 7 Sep 2007 21:09:02 +0000 Subject: UScreenSing.pas, UScreenSingModi.pas: removed Uffmpeg and USmpeg, added UVideo UGraphic.pas: prepared for possible loading animation UGraphicClasses.pas, ULCD.pas, ULight.pas, UMain.pas, USkins.pas, UDisplay.pas, UMenuButton.pas, UMenuSelect.pas, UMenuSelectSlide.pas, UMenuStatic.pas, UScreenCredits.pas, UScreenEditSub.pas, UScreenOpen.pas, UScreenPopup.pas: some fixes to get rid of some compiler infos/warnings git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@374 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphic.pas | 60 +++++- Game/Code/Classes/UGraphicClasses.pas | 2 +- Game/Code/Classes/ULCD.pas | 10 +- Game/Code/Classes/ULight.pas | 4 +- Game/Code/Classes/UMain.pas | 1 + Game/Code/Classes/USkins.pas | 6 +- Game/Code/Classes/UVideo.pas | 378 ++++++++++++++++++++++++++++++++++ Game/Code/Menu/UDisplay.pas | 2 +- Game/Code/Menu/UMenuButton.pas | 9 +- Game/Code/Menu/UMenuSelect.pas | 4 +- Game/Code/Menu/UMenuSelectSlide.pas | 6 +- Game/Code/Menu/UMenuStatic.pas | 2 - Game/Code/SMpeg/USmpeg.pas | 301 --------------------------- Game/Code/SMpeg/Uffmpeg.pas | 378 ---------------------------------- Game/Code/Screens/UScreenCredits.pas | 26 +-- Game/Code/Screens/UScreenEditSub.pas | 2 +- Game/Code/Screens/UScreenOpen.pas | 2 +- Game/Code/Screens/UScreenPopup.pas | 10 +- Game/Code/Screens/UScreenSing.pas | 4 +- Game/Code/Screens/UScreenSingModi.pas | 7 +- Game/Code/UltraStar.dpr | 5 +- 21 files changed, 483 insertions(+), 736 deletions(-) create mode 100644 Game/Code/Classes/UVideo.pas delete mode 100644 Game/Code/SMpeg/USmpeg.pas delete mode 100644 Game/Code/SMpeg/Uffmpeg.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index cf1a0c5a..068ed715 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -23,6 +23,9 @@ type var Screen: PSDL_Surface; + LoadingThread: PSDL_Thread; + Mutex: PSDL_Mutex; + RenderW: integer; RenderH: integer; ScreenW: integer; @@ -174,8 +177,11 @@ procedure SwapBuffers; procedure LoadTextures; procedure InitializeScreen; +procedure LoadLoadingScreen; procedure LoadScreens; +function LoadingThreadFunction: integer; + implementation uses UMain, UIni, UDisplay, UCommandLine, Graphics, Classes, Windows; @@ -240,6 +246,7 @@ var Res: TResourceStream; ISurface: PSDL_Surface; Pixel: PByteArray; + I: Integer; begin Log.LogStatus('LoadOpenGL', 'Initialize3D'); Log.BenchmarkStart(2); @@ -302,7 +309,42 @@ begin Log.LogStatus('Loading Screens', 'Initialize3D'); Log.BenchmarkStart(3); + LoadLoadingScreen; + // now that we have something to display while loading, + // start thread that loads the rest of ultrastar +// Mutex := SDL_CreateMutex; +// SDL_UnLockMutex(Mutex); + + // funktioniert so noch nicht, da der ladethread unverändert auf opengl zugreifen will + // siehe dazu kommentar unten + //LoadingThread := SDL_CreateThread(@LoadingThread, nil); + + // das hier würde dann im ladethread ausgeführt LoadScreens; + + + // TODO!!!!!!1 + // hier käme jetzt eine schleife, die + // * den ladescreen malt (ab und zu) + // * den "fortschritt" des ladescreens steuert + // * zwischendrin schaut, ob der ladethread texturen geladen hat (mutex prüfen) und + // * die texturen in die opengl lädt, sowie + // * dem ladethread signalisiert, dass der speicher für die textur + // zum laden der nächsten textur weiterverwendet werden kann (über weiteren mutex) + // * über einen 3. mutex so lange läuft, bis der ladethread signalisiert, + // dass er alles geladen hat fertig ist + // + // dafür muss loadtexture so umgeschrieben werden, dass es, statt selbst irgendwelche + // opengl funktionen aufzurufen, entsprechend mutexe verändert + // der hauptthread muss auch irgendwoher erfahren, was an opengl funktionen auszuführen ist, + // mit welchen parametern (texturtyp, entspr. texturobjekt, textur-zwischenspeicher-adresse, ... + + + //wait for loading thread to finish + // funktioniert so auch noch nicht + //SDL_WaitThread(LoadingThread, I); +// SDL_DestroyMutex(Mutex); + Display.ActualScreen^.FadeTo(@ScreenMain); Log.BenchmarkEnd(2); @@ -397,7 +439,7 @@ begin ScreenH := H; end; -procedure LoadScreens; +procedure LoadLoadingScreen; begin ScreenLoading := TScreenLoading.Create; ScreenLoading.onShow; @@ -405,7 +447,17 @@ begin ScreenLoading.Draw; Display.Draw; SwapBuffers; +end; +procedure LoadScreens; +begin +{ ScreenLoading := TScreenLoading.Create; + ScreenLoading.onShow; + Display.ActualScreen := @ScreenLoading; + ScreenLoading.Draw; + Display.Draw; + SwapBuffers; +} Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Loading', 3); Log.BenchmarkStart(3); { ScreenWelcome := TScreenWelcome.Create; //'BG', 4, 3); Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Welcome', 3); Log.BenchmarkStart(3);} @@ -480,4 +532,10 @@ begin end; +function LoadingThreadFunction: integer; +begin + LoadScreens; + Result:= 1; +end; + end. diff --git a/Game/Code/Classes/UGraphicClasses.pas b/Game/Code/Classes/UGraphicClasses.pas index 032830b9..83d192d6 100644 --- a/Game/Code/Classes/UGraphicClasses.pas +++ b/Game/Code/Classes/UGraphicClasses.pas @@ -29,7 +29,7 @@ type SurviveSentenceChange : Boolean; Constructor Create(cX,cY: Real; cScreen: Integer; cLive: Byte; cFrame : integer; cRecArrayIndex : Integer; cStarType : TParticleType; Player: Cardinal); - Destructor Destroy(); + Destructor Destroy(); override; procedure Draw; procedure LiveOn; end; diff --git a/Game/Code/Classes/ULCD.pas b/Game/Code/Classes/ULCD.pas index a127c689..a3cdac73 100644 --- a/Game/Code/Classes/ULCD.pas +++ b/Game/Code/Classes/ULCD.pas @@ -106,9 +106,9 @@ begin end; procedure TLCD.Enable; -var +{var A: byte; - B: byte; + B: byte;} begin Enabled := true; if not HalfInterface then @@ -191,7 +191,7 @@ end; procedure TLCD.AddTextBR(S: string); var Word: string; - W: integer; +// W: integer; P: integer; L: integer; begin @@ -227,9 +227,9 @@ begin end; procedure TLCD.MoveCursorBR(Pos: integer); -var +{var I: integer; - L: integer; + L: integer;} begin if Enabled then begin Pos := Pos - (StartPos-1); diff --git a/Game/Code/Classes/ULight.pas b/Game/Code/Classes/ULight.pas index 967d2ea1..1fc4aba8 100644 --- a/Game/Code/Classes/ULight.pas +++ b/Game/Code/Classes/ULight.pas @@ -89,12 +89,12 @@ end; procedure TLight.Refresh; var Time: real; - TimeSkip: real; +// TimeSkip: real; L: integer; begin if Enabled then begin Time := GetTime; - TimeSkip := Time - LastTime; +// TimeSkip := Time - LastTime; for L := 0 to 7 do begin if Light[L] = true then begin if LightTime[L] > Time then begin diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index b47047a5..3a1c9dd4 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -545,6 +545,7 @@ begin // check if we can add new note Mozna := false; + SDet:=SMin; for S := SMin to SMax do for Pet := 0 to Czesci[0].Czesc[S].HighNut do if ((Czesci[0].Czesc[S].Nuta[Pet].Start <= Czas.AktBeatD) diff --git a/Game/Code/Classes/USkins.pas b/Game/Code/Classes/USkins.pas index 67b0ae93..3bcd9357 100644 --- a/Game/Code/Classes/USkins.pas +++ b/Game/Code/Classes/USkins.pas @@ -48,8 +48,8 @@ end; procedure TSkin.LoadList; var SR: TSearchRec; - SR2: TSearchRec; - SLen: integer; +// SR2: TSearchRec; +// SLen: integer; begin if FindFirst('Skins\*', faDirectory, SR) = 0 then begin repeat @@ -63,7 +63,7 @@ end; procedure TSkin.ParseDir(Dir: string); var SR: TSearchRec; - SLen: integer; +// SLen: integer; begin if FindFirst(Dir + '*.ini', faAnyFile, SR) = 0 then begin repeat diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas new file mode 100644 index 00000000..8e2fc446 --- /dev/null +++ b/Game/Code/Classes/UVideo.pas @@ -0,0 +1,378 @@ +{############################################################################ +# FFmpeg support for UltraStar deluxe # +# # +# Created by b1indy # +# based on 'An ffmpeg and SDL Tutorial' (http://www.dranger.com/ffmpeg/) # +#############################################################################} + +//{$define DebugDisplay} // uncomment if u want to see the debug stuff +{$define DebugFrames} +{$define Info} + + +unit UVideo; + +interface +uses SDL, UGraphicClasses, textgl, avcodec, avformat, avutil, math, OpenGL12, SysUtils, UIni, dialogs; + +procedure Init; +procedure FFmpegOpenFile(FileName: pAnsiChar); +procedure FFmpegClose; +procedure FFmpegGetFrame(Time: Extended); +procedure FFmpegDrawGL(Screen: integer); +procedure FFmpegTogglePause; +procedure FFmpegSkip(Time: Single); + +var + VideoOpened, VideoPaused: Boolean; + VideoFormatContext: PAVFormatContext; + VideoStreamIndex: Integer; + VideoCodecContext: PAVCodecContext; + VideoCodec: PAVCodec; + AVFrame: PAVFrame; + AVFrameRGB: PAVFrame; + myBuffer: pByte; + VideoTex: glUint; + TexX, TexY, dataX, dataY: Cardinal; + TexData: array of Byte; + ScaledVideoWidth, ScaledVideoHeight: Real; + VideoAspect: Real; + VideoTextureU, VideoTextureV: Real; + VideoTimeBase, VideoTime, LastFrameTime, TimeDifference: Extended; + VideoSkipTime: Single; + +implementation + +procedure Init; +begin + av_register_all; + VideoOpened:=False; + VideoPaused:=False; + glGenTextures(1, PglUint(@VideoTex)); + SetLength(TexData,0); +end; + +procedure FFmpegOpenFile(FileName: pAnsiChar); +var errnum, i, x,y: Integer; +begin + VideoOpened:=False; + VideoPaused:=False; + VideoTimeBase:=0; + VideoTime:=0; + LastFrameTime:=0; + TimeDifference:=0; + errnum:=av_open_input_file(VideoFormatContext, FileName, Nil, 0, Nil); + if(errnum <> 0) + then begin + case errnum of + AVERROR_UNKNOWN: showmessage('failed to open file '+Filename+#13#10+'AVERROR_UNKNOWN'); + AVERROR_IO: showmessage('failed to open file '+Filename+#13#10+'AVERROR_IO'); + AVERROR_NUMEXPECTED: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NUMEXPECTED'); + AVERROR_INVALIDDATA: showmessage('failed to open file '+Filename+#13#10+'AVERROR_INVALIDDATA'); + AVERROR_NOMEM: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NOMEM'); + AVERROR_NOFMT: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NOFMT'); + AVERROR_NOTSUPP: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NOTSUPP'); + else showmessage('failed to open file '+Filename+#13#10+'Error number: '+inttostr(Errnum)); + end; + Exit; + end + else begin + VideoStreamIndex:=-1; + if(av_find_stream_info(VideoFormatContext)>=0) then + begin + for i:=0 to VideoFormatContext^.nb_streams-1 do + if(VideoFormatContext^.streams[i]^.codec^.codec_type=CODEC_TYPE_VIDEO) then begin + VideoStreamIndex:=i; + end else + end; + if(VideoStreamIndex >= 0) then + begin + VideoCodecContext:=VideoFormatContext^.streams[VideoStreamIndex]^.codec; + VideoCodec:=avcodec_find_decoder(VideoCodecContext^.codec_id); + end else begin + showmessage('found no video stream'); + av_close_input_file(VideoFormatContext); + Exit; + end; + if(VideoCodec<>Nil) then + begin + errnum:=avcodec_open(VideoCodecContext, VideoCodec); + end else begin + showmessage('no matching codec found'); + avcodec_close(VideoCodecContext); + av_close_input_file(VideoFormatContext); + Exit; + end; + if(errnum >=0) then + begin +{$ifdef DebugDisplay} + showmessage('Found a matching Codec:'+#13#10#13#10+ + 'Width='+inttostr(VideoCodecContext^.width)+ + ', Height='+inttostr(VideoCodecContext^.height)+#13#10+ + 'Aspect: '+inttostr(VideoCodecContext^.sample_aspect_ratio.num)+'/'+inttostr(VideoCodecContext^.sample_aspect_ratio.den)+#13#10+ + 'Framerate: '+inttostr(VideoCodecContext^.time_base.num)+'/'+inttostr(VideoCodecContext^.time_base.den)); +{$endif} + // allocate space for decoded frame and rgb frame + AVFrame:=avcodec_alloc_frame; + AVFrameRGB:=avcodec_alloc_frame; + end; + myBuffer:=Nil; + if(AVFrame <> Nil) and (AVFrameRGB <> Nil) then + begin + myBuffer:=av_malloc(avpicture_get_size(PIX_FMT_RGB24, VideoCodecContext^.width, + VideoCodecContext^.height)); + end; + if myBuffer <> Nil then errnum:=avpicture_fill(PAVPicture(AVFrameRGB), myBuffer, PIX_FMT_RGB24, + VideoCodecContext^.width, VideoCodecContext^.height) + else begin + showmessage('failed to allocate video buffer'); + av_free(AVFrameRGB); + av_free(AVFrame); + avcodec_close(VideoCodecContext); + av_close_input_file(VideoFormatContext); + Exit; + end; + if errnum >=0 then + begin + VideoOpened:=True; + + TexX := VideoCodecContext^.width; + TexY := VideoCodecContext^.height; + dataX := Round(Power(2, Ceil(Log2(TexX)))); + dataY := Round(Power(2, Ceil(Log2(TexY)))); + SetLength(TexData,dataX*dataY*3); + // calculate some information for video display + VideoAspect:=VideoCodecContext^.sample_aspect_ratio.num/VideoCodecContext^.sample_aspect_ratio.den; + if (VideoAspect = 0) then + VideoAspect:=VideoCodecContext^.width/VideoCodecContext^.height + else + VideoAspect:=VideoAspect*VideoCodecContext^.width/VideoCodecContext^.height; + if VideoAspect >= 4/3 then + begin + ScaledVideoWidth:=800.0; + ScaledVideoHeight:=800.0/VideoAspect; + end else + begin + ScaledVideoHeight:=600.0; + ScaledVideoWidth:=600.0*VideoAspect; + end; + VideoTimeBase:=VideoCodecContext^.time_base.num/VideoCodecContext^.time_base.den; + // hack to get reasonable timebase for divx +{$ifdef DebugDisplay} + showmessage('framerate: '+inttostr(floor(1/videotimebase))+'fps'); +{$endif} + if VideoTimeBase < 0.02 then // 0.02 <-> 50 fps + begin + VideoTimeBase:=VideoCodecContext^.time_base.den/VideoCodecContext^.time_base.num; + while VideoTimeBase > 50 do VideoTimeBase:=VideoTimeBase/10; + VideoTimeBase:=1/VideoTimeBase; + end; +{$ifdef DebugDisplay} + showmessage('corrected framerate: '+inttostr(floor(1/videotimebase))+'fps'); + if ((VideoAspect*VideoCodecContext^.width*VideoCodecContext^.height)>200000) then + showmessage('you are trying to play a rather large video'+#13#10+ + 'be prepared to experience some timing problems'); +{$endif} + end; + end; +end; + +procedure FFmpegClose; +begin + if VideoOpened then begin + av_free(myBuffer); + av_free(AVFrameRGB); + av_free(AVFrame); + avcodec_close(VideoCodecContext); + av_close_input_file(VideoFormatContext); + SetLength(TexData,0); + VideoOpened:=False; + end; +end; + +procedure FFmpegTogglePause; +begin + if VideoPaused then VideoPaused:=False + else VideoPaused:=True; +end; + +procedure FFmpegSkip(Time: Single); +begin + VideoSkiptime:=Time; + if VideoSkipTime > 0 then begin + av_seek_frame(VideoFormatContext,-1,Floor((VideoSkipTime)*1500000),0); + VideoTime:=VideoSkipTime; + end; +end; + +procedure FFmpegGetFrame(Time: Extended); +var + FrameFinished: Integer; + AVPacket: TAVPacket; + errnum, x, y: Integer; + FrameDataPtr: PByteArray; + linesize: integer; + myTime: Extended; + DropFrame: Boolean; + droppedFrames: Integer; +const + FRAMEDROPCOUNT=3; +begin + if not VideoOpened then Exit; + if VideoPaused then Exit; + myTime:=Time+VideoSkipTime; + TimeDifference:=myTime-VideoTime; + DropFrame:=False; +{ showmessage('Time: '+inttostr(floor(Time*1000))+#13#10+ + 'VideoTime: '+inttostr(floor(VideoTime*1000))+#13#10+ + 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ + 'TimeDiff: '+inttostr(floor(TimeDifference*1000))); +} + if (VideoTime <> 0) and (TimeDifference <= VideoTimeBase) then begin +{$ifdef DebugFrames} + // frame delay debug display + GoldenRec.Spawn(200,15,1,16,0,-1,ColoredStar,$00ff00); +{$endif} +{ showmessage('not getting new frame'+#13#10+ + 'Time: '+inttostr(floor(Time*1000))+#13#10+ + 'VideoTime: '+inttostr(floor(VideoTime*1000))+#13#10+ + 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ + 'TimeDiff: '+inttostr(floor(TimeDifference*1000))); +} + Exit;// we don't need a new frame now + end; + VideoTime:=VideoTime+VideoTimeBase; + TimeDifference:=myTime-VideoTime; + if TimeDifference >= (FRAMEDROPCOUNT-1)*VideoTimeBase then begin // skip frames +{$ifdef DebugFrames} + //frame drop debug display + GoldenRec.Spawn(200,55,1,16,0,-1,ColoredStar,$ff0000); +{$endif} +// showmessage('skipping frames'+#13#10+ +// 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ +// 'TimeDiff: '+inttostr(floor(TimeDifference*1000))+#13#10+ +// 'Time2Skip: '+inttostr(floor((Time-LastFrameTime)*1000))); +// av_seek_frame(VideoFormatContext,VideoStreamIndex,Floor(Time*VideoTimeBase),0); +{ av_seek_frame(VideoFormatContext,-1,Floor((myTime+VideoTimeBase)*1500000),0); + VideoTime:=floor(myTime/VideoTimeBase)*VideoTimeBase;} + VideoTime:=VideoTime+FRAMEDROPCOUNT*VideoTimeBase; + DropFrame:=True; + end; + + av_init_packet(@AVPacket); + FrameFinished:=0; + // read packets until we have a finished frame (or there are no more packets) + while (FrameFinished=0) and (av_read_frame(VideoFormatContext, @AVPacket)>=0) do + begin + // if we got a packet from the video stream, then decode it + if (AVPacket.stream_index=VideoStreamIndex) then + errnum:=avcodec_decode_video(VideoCodecContext, AVFrame, @frameFinished, + AVPacket.data, AVPacket.size); + // release internal packet structure created by av_read_frame + av_free_packet(PAVPacket(@AVPacket)); + end; + if DropFrame then + for droppedFrames:=1 to FRAMEDROPCOUNT do begin + FrameFinished:=0; + // read packets until we have a finished frame (or there are no more packets) + while (FrameFinished=0) and (av_read_frame(VideoFormatContext, @AVPacket)>=0) do + begin + // if we got a packet from the video stream, then decode it + if (AVPacket.stream_index=VideoStreamIndex) then + errnum:=avcodec_decode_video(VideoCodecContext, AVFrame, @frameFinished, + AVPacket.data, AVPacket.size); + // release internal packet structure created by av_read_frame + av_free_packet(PAVPacket(@AVPacket)); + end; + end; + + // if we did not get an new frame, there's nothing more to do + if Framefinished=0 then begin + GoldenRec.Spawn(220,15,1,16,0,-1,ColoredStar,$0000ff); + Exit; + end; + // otherwise we convert the pixeldata from YUV to RGB + errnum:=img_convert(PAVPicture(AVFrameRGB), PIX_FMT_RGB24, + PAVPicture(AVFrame), VideoCodecContext^.pix_fmt, + VideoCodecContext^.width, VideoCodecContext^.height); +//errnum:=1; + if errnum >=0 then begin + // copy RGB pixeldata to our TextureBuffer + // (line by line) + FrameDataPtr:=AVFrameRGB^.data[0]; + linesize:=AVFrameRGB^.linesize[0]; + for y:=0 to TexY-1 do begin + System.Move(FrameDataPtr[y*linesize],TexData[3*y*dataX],linesize); + end; + + // generate opengl texture out of whatever we got + glBindTexture(GL_TEXTURE_2D, VideoTex); + glTexImage2D(GL_TEXTURE_2D, 0, 3, dataX, dataY, 0, GL_RGB, GL_UNSIGNED_BYTE, TexData); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); +{$ifdef DebugFrames} + //frame decode debug display + GoldenRec.Spawn(200,35,1,16,0,-1,ColoredStar,$ffff00); +{$endif} + + end; +end; + +procedure FFmpegDrawGL(Screen: integer); +begin + // have a nice black background to draw on (even if there were errors opening the vid) + if Screen=1 then begin + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end; + // exit if there's nothing to draw + if not VideoOpened then Exit; + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, VideoTex); + glbegin(gl_quads); + glTexCoord2f( 0, 0); glVertex2f(400-ScaledVideoWidth/2, 300-ScaledVideoHeight/2); + glTexCoord2f( 0, TexY/dataY); glVertex2f(400-ScaledVideoWidth/2, 300+ScaledVideoHeight/2); + glTexCoord2f(TexX/dataX, TexY/dataY); glVertex2f(400+ScaledVideoWidth/2, 300+ScaledVideoHeight/2); + glTexCoord2f(TexX/dataX, 0); glVertex2f(400+ScaledVideoWidth/2, 300-ScaledVideoHeight/2); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + +{$ifdef Info} + if VideoSkipTime+VideoTime+VideoTimeBase < 0 then begin + glColor4f(0.7, 1, 0.3, 1); + SetFontStyle (1); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (300, 0); + glPrint('Delay due to negative VideoGap'); + glColor4f(1, 1, 1, 1); + end; +{$endif} + +{$ifdef DebugFrames} + glColor4f(0, 0, 0, 0.2); + glbegin(gl_quads); + glVertex2f(0, 0); + glVertex2f(0, 70); + glVertex2f(250, 70); + glVertex2f(250, 0); + glEnd; + + glColor4f(1,1,1,1); + SetFontStyle (1); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (5, 0); + glPrint('delaying frame'); + SetFontPos (5, 20); + glPrint('fetching frame'); + SetFontPos (5, 40); + glPrint('dropping frame'); +{$endif} +end; + +end. diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index 70e678fb..82b4acc7 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -40,7 +40,7 @@ type procedure PrintScreen; constructor Create; // fade mod - destructor Destroy; + destructor Destroy; override; // end procedure ScreenShot; diff --git a/Game/Code/Menu/UMenuButton.pas b/Game/Code/Menu/UMenuButton.pas index cb343cf8..f3b00830 100644 --- a/Game/Code/Menu/UMenuButton.pas +++ b/Game/Code/Menu/UMenuButton.pas @@ -87,9 +87,9 @@ implementation uses UDrawTexture, SysUtils, windows; procedure TButton.SetX(Value: real); -var +{var dx: real; - T: integer; // text + T: integer; // text} begin {dY := Value - Texture.y; @@ -105,9 +105,9 @@ begin end; procedure TButton.SetY(Value: real); -var +{var dY: real; - T: integer; // text + T: integer; // text} begin {dY := Value - PosY; @@ -276,6 +276,7 @@ var begin if Visible then begin //Fade Mod + T:=0; if Fade then begin if (FadeProgress < 1) and (FadeProgress > 0) then diff --git a/Game/Code/Menu/UMenuSelect.pas b/Game/Code/Menu/UMenuSelect.pas index f7bb871f..72141a27 100644 --- a/Game/Code/Menu/UMenuSelect.pas +++ b/Game/Code/Menu/UMenuSelect.pas @@ -99,8 +99,8 @@ begin end; procedure TSelect.SetSelect(Value: boolean); -var - SO: integer; +{var + SO: integer;} begin // default 1, 0.4 SelectBool := Value; if Value then begin diff --git a/Game/Code/Menu/UMenuSelectSlide.pas b/Game/Code/Menu/UMenuSelectSlide.pas index c1ccad6d..3659c00d 100644 --- a/Game/Code/Menu/UMenuSelectSlide.pas +++ b/Game/Code/Menu/UMenuSelectSlide.pas @@ -117,9 +117,9 @@ begin end; procedure TSelectSlide.SetSelect(Value: boolean); -var +{var SO: integer; - I: integer; + I: integer;} begin SelectBool := Value; if Value then begin @@ -187,7 +187,7 @@ procedure DoSelection(Sel: Cardinal); TextOpt[I].ColB := STDColB; TextOpt[I].Int := STDInt; end; - if (Sel <= high(TextOpt)) then + if (integer(Sel) <= high(TextOpt)) then begin TextOpt[Sel].ColR := STColR; TextOpt[Sel].ColG := STColG; diff --git a/Game/Code/Menu/UMenuStatic.pas b/Game/Code/Menu/UMenuStatic.pas index 5f19fbf3..cfa4a596 100644 --- a/Game/Code/Menu/UMenuStatic.pas +++ b/Game/Code/Menu/UMenuStatic.pas @@ -21,8 +21,6 @@ implementation uses UDrawTexture; procedure TStatic.Draw; -var - Pet: integer; begin if Visible then begin diff --git a/Game/Code/SMpeg/USmpeg.pas b/Game/Code/SMpeg/USmpeg.pas deleted file mode 100644 index 317b04bb..00000000 --- a/Game/Code/SMpeg/USmpeg.pas +++ /dev/null @@ -1,301 +0,0 @@ -unit USmpeg; - -interface -uses SDL, smpeg, OpenGL12, SysUtils, UIni; - -procedure OpenSmpeg(FileName: string); -procedure SkipSmpeg(Time: single); -procedure PlaySmpeg; -procedure PauseSmpeg; //PauseMod -procedure UpdateSmpeg; -procedure CloseSmpeg; -function glmovie_init(Width : GLuint; Height : TGLuint ) : TGLenum; -procedure glmpeg_update(surface: PSDL_Surface; x: Sint32; y: Sint32; w: Uint32; h: Uint32); cdecl; -procedure DrawSmpeg(frame: PGLubyte); -procedure glmovie_resize( width : GLuint; height : GLuint ); -procedure glmovie_quit; - -var - mpeg: PSMPEG; - mpeg_info: TSMPEG_Info; - surface: PSDL_Surface; - -type - { Some data is redundant at this stage. } - PGLMovieTexture = ^TGLMovieTexture; - TGLMovieTexture = record - id : TGLuint; (* OpenGL texture id. *) - poly_width : TGLuint; (* Quad width for tile. *) - poly_height : TGLuint; (* Quad height for tile. *) - movie_width : TGLuint; (* Width of movie inside tile. *) - movie_height : TGLuint; (* Height of movie inside tile. *) - skip_rows : TGLuint; (* Number of rows of movie to skip *) - skip_pixels : TGLuint; (* Number of columns of movie to skip *) - row : TGLuint; (* Row number of tile in scheme. *) - col : TGLuint; (* Column number of tile in scheme. *) - end; - -type - TGLuintArray = array of TGLuint; - PGLuintArray = ^TGLuintArray; - TGLMovieTextureArray = array of TGLMovieTexture; - PGLMovieTextureArray = ^TGLMovieTextureArray; - -var - (* Our evil maximum texture size. Boo 3Dfxnot *) - texture_size : TGLuint = 1024;//512; - texture_ids : TGLuint; - textures: TGLMovieTexture; - tiled_width : TGLuint = 0; - tiled_height : TGLuint = 0; - movie_width : TGLuint = 0; - movie_height : TGLuint = 0; - -implementation - -procedure OpenSmpeg(FileName: string); -begin - mpeg := SMPEG_new(PChar(FileName), @mpeg_info, 0); // audio - if ( mpeg = nil ) then begin - SDL_Quit; - Exit; - end; - -// SMPEG_setvolume(mpeg, 50); - SMPEG_enableaudio(mpeg, 0); - - (* Everything needs to be in RGB for GL, but needs to be 32-bit for SMPEG. *) - surface := SDL_AllocSurface( SDL_SWSURFACE, - mpeg_info.width, - mpeg_info.height, - 32, - $000000FF, - $0000FF00, - $00FF0000, - $FF000000 ); - - if ( surface = nil ) then begin - SDL_Quit; - Exit; - end; - - (* *Initialize* with mpeg size. *) - if (glmovie_init( mpeg_info.width, mpeg_info.height ) <> GL_NO_ERROR ) then begin - SDL_Quit; - Exit; - end; - - SMPEG_setdisplay(mpeg, surface, nil, @glmpeg_update); -end; - -procedure SkipSmpeg(Time: single); -begin - SMPEG_skip(mpeg, Time); -end; - -procedure PlaySmpeg; -begin - SMPEG_play(mpeg); -end; - -//Pause Mod -procedure PauseSmpeg; -begin - SMPEG_pause(mpeg); -end; - -procedure UpdateSmpeg; -begin -// glmpeg_update(surface,0,0,0,0); - DrawSmpeg( PGLubyte( surface.pixels ) ); -end; - -procedure CloseSmpeg; -begin - SMPEG_delete(mpeg); - //Fixing the Memory Lag in earlyer Versions (X-Mas Mod, all Official Versions) - glmovie_quit; -end; - -function glmovie_init( Width : GLuint; Height : TGLuint ) : TGLenum; -type - PGLubyteArray = ^TGLubyteArray; - TGLubyteArray = array of TGLubyte; -var - (* Initial black texels. *) - pixels : TGLubyteArray; - (* Absolute offsets from within tiled frame. *) - //offset_x: GLuint; - //offset_y: GLuint; - skip_rows : GLuint; - skip_pixels : GLuint; - i, j, current : GLuint; -begin - skip_rows := 0; - current := 0; - (* Save original movie dimensions. *) - movie_width := width; - movie_height := height; - - (* Get the power of 2 dimensions. *) - tiled_width := 1024{512}; - tiled_height := 1024{512}; - - texture_size := 1024{512}; - - (* Time for fun with data type = record *) - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glEnable(GL_TEXTURE_2D); - glEnable(GL_DITHER); - - glGenTextures(1, @texture_ids); - - current := 0; - (* Setup texture. *) - textures.id := texture_ids; - textures.poly_width := texture_size; - textures.poly_height := texture_size; - textures.movie_width := movie_width - 2; - textures.movie_height := movie_height - 2; - textures.row := i; - textures.col := j; - textures.skip_pixels := skip_pixels; - textures.skip_rows := skip_rows; - - SetLength( pixels, textures.poly_width * textures.poly_height * 4 ); - if ( pixels = nil ) then - begin - glDeleteTextures(1, @texture_ids); - result := GL_OUT_OF_MEMORY; - exit; - end; - //FillChar( pixels^, textures[ current ].poly_width * textures[ current ].poly_height * 4, 0 ); - - (* Do all of our useful binding. *) - glBindTexture(GL_TEXTURE_2D, texture_ids); -// glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - (* Specify our 256x256 black texture. *) - glTexImage2D( GL_TEXTURE_2D, - 0, - GL_RGB, - 1024{512},//textures.poly_width, - 1024{512},//textures.poly_height, - 0, - GL_RGBA, - GL_UNSIGNED_BYTE, - @pixels[0] ); - SetLength( pixels, 0 ); - - - (* Simple state setup at the end. *) - result := glGetError( ); -end; - -procedure glmpeg_update( surface : PSDL_Surface; x : Sint32; y : Sint32; w : Uint32; - h : Uint32 ); cdecl; -var - error : TGLenum; -begin - glClear( GL_COLOR_BUFFER_BIT ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity; - DrawSmpeg( PGLubyte( surface.pixels ) ); - error := glGetError( ); - if ( error <> GL_NO_ERROR ) then Exit; - SDL_GL_SwapBuffers; -end; - -procedure DrawSmpeg(frame: PGLubyte); -var - Shift: TGLdouble; - CropT: real; - CropB: real; - TexT: real; - TexB: real; - TexL: real; - TexR: real; - Wide: boolean; -begin - (* full screen mpeg *) -{ CropT := 0; - CropB := 600; - TexT := 0; - TexB := 1; - TexL := 0; - TexW := 1;} - - // set movie texture crop - Wide := false; - if (textures.movie_width = 720-2) and (textures.movie_height = 344-2) then begin - TexT := 0; - TexB := 342/1024; - Wide := true; - end; - if textures.movie_height = 304-2 then begin - TexT := 0; - TexB := 304/1024; - Wide := true; - end; - if textures.movie_height = 152-2 then begin - TexT := 0; - TexB := 152/1024; - Wide := true; - end; - - CropT := 110; // (110/800 = 13,75% max crop) - CropB := 490; // (110/800 = 13,75% max crop) - - if (textures.movie_height <> 304-2) and (textures.movie_height <> 152-2) and (textures.movie_height <> 344-2) then begin - TexT := 110 / 600 * (textures.movie_height / 1024{512}); - TexB := 490 / 600 * (textures.movie_height / 1024{512}); - - if Ini.MovieSize >= 1 then begin - // full screen size - CropT := 0; - CropB := 600; - TexT := 0; - TexB := textures.movie_height / 1024{512}; - end; - end; - - TexL := {10}0/600 * (textures.movie_width / 1024{512}); - TexR := {590}600/600 * (textures.movie_width / 1024{512}); - - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glColor3f(1, 1, 1); - glBindTexture( GL_TEXTURE_2D, texture_ids ); -// glPixelStorei( GL_UNPACK_ROW_LENGTH, movie_width ); - glPixelStorei( GL_UNPACK_SKIP_ROWS, 0); - glPixelStorei( GL_UNPACK_SKIP_PIXELS, 0); - glTexSubImage2D( GL_TEXTURE_2D, 0, 0, (* offset_x *) 0, (* offset_y *) textures.movie_width + 2, textures.movie_height + 2, GL_RGBA, GL_UNSIGNED_BYTE, frame ); - - // draw - glBegin( GL_QUADS ); - glTexCoord2f(TexL, TexT); glVertex2f(0, CropT); - glTexCoord2f(TexL, TexB); glVertex2f(0, CropB); - glTexCoord2f(TexR, TexB); glVertex2f(800, CropB); - glTexCoord2f(TexR, TexT); glVertex2f(800, CropT); - glEnd; - glDisable(GL_TEXTURE_2D); -end; - -procedure glmovie_resize( width : GLuint; height : GLuint ); -begin - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity; - gluOrtho2D(0, 800, 600, 0); -end; - -procedure glmovie_quit; -begin - glDeleteTextures(1, @texture_ids); - SDL_FreeSurface(surface); -end; - -end. diff --git a/Game/Code/SMpeg/Uffmpeg.pas b/Game/Code/SMpeg/Uffmpeg.pas deleted file mode 100644 index 6e08ca95..00000000 --- a/Game/Code/SMpeg/Uffmpeg.pas +++ /dev/null @@ -1,378 +0,0 @@ -{############################################################################ -# FFmpeg support for UltraStar deluxe # -# # -# Created by b1indy # -# based on 'An ffmpeg and SDL Tutorial' (http://www.dranger.com/ffmpeg/) # -#############################################################################} - -//{$define DebugDisplay} // uncomment if u want to see the debug stuff -{$define DebugFrames} -{$define Info} - - -unit Uffmpeg; - -interface -uses SDL, UGraphicClasses, textgl, avcodec, avformat, avutil, math, OpenGL12, SysUtils, UIni, dialogs; - -procedure Init; -procedure FFmpegOpenFile(FileName: pAnsiChar); -procedure FFmpegClose; -procedure FFmpegGetFrame(Time: Extended); -procedure FFmpegDrawGL(Screen: integer); -procedure FFmpegTogglePause; -procedure FFmpegSkip(Time: Single); - -var - VideoOpened, VideoPaused: Boolean; - VideoFormatContext: PAVFormatContext; - VideoStreamIndex: Integer; - VideoCodecContext: PAVCodecContext; - VideoCodec: PAVCodec; - AVFrame: PAVFrame; - AVFrameRGB: PAVFrame; - myBuffer: pByte; - VideoTex: glUint; - TexX, TexY, dataX, dataY: Cardinal; - TexData: array of Byte; - ScaledVideoWidth, ScaledVideoHeight: Real; - VideoAspect: Real; - VideoTextureU, VideoTextureV: Real; - VideoTimeBase, VideoTime, LastFrameTime, TimeDifference: Extended; - VideoSkipTime: Single; - -implementation - -procedure Init; -begin - av_register_all; - VideoOpened:=False; - VideoPaused:=False; - glGenTextures(1, PglUint(@VideoTex)); - SetLength(TexData,0); -end; - -procedure FFmpegOpenFile(FileName: pAnsiChar); -var errnum, i, x,y: Integer; -begin - VideoOpened:=False; - VideoPaused:=False; - VideoTimeBase:=0; - VideoTime:=0; - LastFrameTime:=0; - TimeDifference:=0; - errnum:=av_open_input_file(VideoFormatContext, FileName, Nil, 0, Nil); - if(errnum <> 0) - then begin - case errnum of - AVERROR_UNKNOWN: showmessage('failed to open file '+Filename+#13#10+'AVERROR_UNKNOWN'); - AVERROR_IO: showmessage('failed to open file '+Filename+#13#10+'AVERROR_IO'); - AVERROR_NUMEXPECTED: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NUMEXPECTED'); - AVERROR_INVALIDDATA: showmessage('failed to open file '+Filename+#13#10+'AVERROR_INVALIDDATA'); - AVERROR_NOMEM: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NOMEM'); - AVERROR_NOFMT: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NOFMT'); - AVERROR_NOTSUPP: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NOTSUPP'); - else showmessage('failed to open file '+Filename+#13#10+'Error number: '+inttostr(Errnum)); - end; - Exit; - end - else begin - VideoStreamIndex:=-1; - if(av_find_stream_info(VideoFormatContext)>=0) then - begin - for i:=0 to VideoFormatContext^.nb_streams-1 do - if(VideoFormatContext^.streams[i]^.codec^.codec_type=CODEC_TYPE_VIDEO) then begin - VideoStreamIndex:=i; - end else - end; - if(VideoStreamIndex >= 0) then - begin - VideoCodecContext:=VideoFormatContext^.streams[VideoStreamIndex]^.codec; - VideoCodec:=avcodec_find_decoder(VideoCodecContext^.codec_id); - end else begin - showmessage('found no video stream'); - av_close_input_file(VideoFormatContext); - Exit; - end; - if(VideoCodec<>Nil) then - begin - errnum:=avcodec_open(VideoCodecContext, VideoCodec); - end else begin - showmessage('no matching codec found'); - avcodec_close(VideoCodecContext); - av_close_input_file(VideoFormatContext); - Exit; - end; - if(errnum >=0) then - begin -{$ifdef DebugDisplay} - showmessage('Found a matching Codec:'+#13#10#13#10+ - 'Width='+inttostr(VideoCodecContext^.width)+ - ', Height='+inttostr(VideoCodecContext^.height)+#13#10+ - 'Aspect: '+inttostr(VideoCodecContext^.sample_aspect_ratio.num)+'/'+inttostr(VideoCodecContext^.sample_aspect_ratio.den)+#13#10+ - 'Framerate: '+inttostr(VideoCodecContext^.time_base.num)+'/'+inttostr(VideoCodecContext^.time_base.den)); -{$endif} - // allocate space for decoded frame and rgb frame - AVFrame:=avcodec_alloc_frame; - AVFrameRGB:=avcodec_alloc_frame; - end; - myBuffer:=Nil; - if(AVFrame <> Nil) and (AVFrameRGB <> Nil) then - begin - myBuffer:=av_malloc(avpicture_get_size(PIX_FMT_RGB24, VideoCodecContext^.width, - VideoCodecContext^.height)); - end; - if myBuffer <> Nil then errnum:=avpicture_fill(PAVPicture(AVFrameRGB), myBuffer, PIX_FMT_RGB24, - VideoCodecContext^.width, VideoCodecContext^.height) - else begin - showmessage('failed to allocate video buffer'); - av_free(AVFrameRGB); - av_free(AVFrame); - avcodec_close(VideoCodecContext); - av_close_input_file(VideoFormatContext); - Exit; - end; - if errnum >=0 then - begin - VideoOpened:=True; - - TexX := VideoCodecContext^.width; - TexY := VideoCodecContext^.height; - dataX := Round(Power(2, Ceil(Log2(TexX)))); - dataY := Round(Power(2, Ceil(Log2(TexY)))); - SetLength(TexData,dataX*dataY*3); - // calculate some information for video display - VideoAspect:=VideoCodecContext^.sample_aspect_ratio.num/VideoCodecContext^.sample_aspect_ratio.den; - if (VideoAspect = 0) then - VideoAspect:=VideoCodecContext^.width/VideoCodecContext^.height - else - VideoAspect:=VideoAspect*VideoCodecContext^.width/VideoCodecContext^.height; - if VideoAspect >= 4/3 then - begin - ScaledVideoWidth:=800.0; - ScaledVideoHeight:=800.0/VideoAspect; - end else - begin - ScaledVideoHeight:=600.0; - ScaledVideoWidth:=600.0*VideoAspect; - end; - VideoTimeBase:=VideoCodecContext^.time_base.num/VideoCodecContext^.time_base.den; - // hack to get reasonable timebase for divx -{$ifdef DebugDisplay} - showmessage('framerate: '+inttostr(floor(1/videotimebase))+'fps'); -{$endif} - if VideoTimeBase < 0.02 then // 0.02 <-> 50 fps - begin - VideoTimeBase:=VideoCodecContext^.time_base.den/VideoCodecContext^.time_base.num; - while VideoTimeBase > 50 do VideoTimeBase:=VideoTimeBase/10; - VideoTimeBase:=1/VideoTimeBase; - end; -{$ifdef DebugDisplay} - showmessage('corrected framerate: '+inttostr(floor(1/videotimebase))+'fps'); - if ((VideoAspect*VideoCodecContext^.width*VideoCodecContext^.height)>200000) then - showmessage('you are trying to play a rather large video'+#13#10+ - 'be prepared to experience some timing problems'); -{$endif} - end; - end; -end; - -procedure FFmpegClose; -begin - if VideoOpened then begin - av_free(myBuffer); - av_free(AVFrameRGB); - av_free(AVFrame); - avcodec_close(VideoCodecContext); - av_close_input_file(VideoFormatContext); - SetLength(TexData,0); - VideoOpened:=False; - end; -end; - -procedure FFmpegTogglePause; -begin - if VideoPaused then VideoPaused:=False - else VideoPaused:=True; -end; - -procedure FFmpegSkip(Time: Single); -begin - VideoSkiptime:=Time; - if VideoSkipTime > 0 then begin - av_seek_frame(VideoFormatContext,-1,Floor((VideoSkipTime)*1500000),0); - VideoTime:=VideoSkipTime; - end; -end; - -procedure FFmpegGetFrame(Time: Extended); -var - FrameFinished: Integer; - AVPacket: TAVPacket; - errnum, x, y: Integer; - FrameDataPtr: PByteArray; - linesize: integer; - myTime: Extended; - DropFrame: Boolean; - droppedFrames: Integer; -const - FRAMEDROPCOUNT=3; -begin - if not VideoOpened then Exit; - if VideoPaused then Exit; - myTime:=Time+VideoSkipTime; - TimeDifference:=myTime-VideoTime; - DropFrame:=False; -{ showmessage('Time: '+inttostr(floor(Time*1000))+#13#10+ - 'VideoTime: '+inttostr(floor(VideoTime*1000))+#13#10+ - 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ - 'TimeDiff: '+inttostr(floor(TimeDifference*1000))); -} - if (VideoTime <> 0) and (TimeDifference <= VideoTimeBase) then begin -{$ifdef DebugFrames} - // frame delay debug display - GoldenRec.Spawn(200,15,1,16,0,-1,ColoredStar,$00ff00); -{$endif} -{ showmessage('not getting new frame'+#13#10+ - 'Time: '+inttostr(floor(Time*1000))+#13#10+ - 'VideoTime: '+inttostr(floor(VideoTime*1000))+#13#10+ - 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ - 'TimeDiff: '+inttostr(floor(TimeDifference*1000))); -} - Exit;// we don't need a new frame now - end; - VideoTime:=VideoTime+VideoTimeBase; - TimeDifference:=myTime-VideoTime; - if TimeDifference >= (FRAMEDROPCOUNT-1)*VideoTimeBase then begin // skip frames -{$ifdef DebugFrames} - //frame drop debug display - GoldenRec.Spawn(200,55,1,16,0,-1,ColoredStar,$ff0000); -{$endif} -// showmessage('skipping frames'+#13#10+ -// 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ -// 'TimeDiff: '+inttostr(floor(TimeDifference*1000))+#13#10+ -// 'Time2Skip: '+inttostr(floor((Time-LastFrameTime)*1000))); -// av_seek_frame(VideoFormatContext,VideoStreamIndex,Floor(Time*VideoTimeBase),0); -{ av_seek_frame(VideoFormatContext,-1,Floor((myTime+VideoTimeBase)*1500000),0); - VideoTime:=floor(myTime/VideoTimeBase)*VideoTimeBase;} - VideoTime:=VideoTime+FRAMEDROPCOUNT*VideoTimeBase; - DropFrame:=True; - end; - - av_init_packet(@AVPacket); - FrameFinished:=0; - // read packets until we have a finished frame (or there are no more packets) - while (FrameFinished=0) and (av_read_frame(VideoFormatContext, @AVPacket)>=0) do - begin - // if we got a packet from the video stream, then decode it - if (AVPacket.stream_index=VideoStreamIndex) then - errnum:=avcodec_decode_video(VideoCodecContext, AVFrame, @frameFinished, - AVPacket.data, AVPacket.size); - // release internal packet structure created by av_read_frame - av_free_packet(PAVPacket(@AVPacket)); - end; - if DropFrame then - for droppedFrames:=1 to FRAMEDROPCOUNT do begin - FrameFinished:=0; - // read packets until we have a finished frame (or there are no more packets) - while (FrameFinished=0) and (av_read_frame(VideoFormatContext, @AVPacket)>=0) do - begin - // if we got a packet from the video stream, then decode it - if (AVPacket.stream_index=VideoStreamIndex) then - errnum:=avcodec_decode_video(VideoCodecContext, AVFrame, @frameFinished, - AVPacket.data, AVPacket.size); - // release internal packet structure created by av_read_frame - av_free_packet(PAVPacket(@AVPacket)); - end; - end; - - // if we did not get an new frame, there's nothing more to do - if Framefinished=0 then begin - GoldenRec.Spawn(220,15,1,16,0,-1,ColoredStar,$0000ff); - Exit; - end; - // otherwise we convert the pixeldata from YUV to RGB - errnum:=img_convert(PAVPicture(AVFrameRGB), PIX_FMT_RGB24, - PAVPicture(AVFrame), VideoCodecContext^.pix_fmt, - VideoCodecContext^.width, VideoCodecContext^.height); -//errnum:=1; - if errnum >=0 then begin - // copy RGB pixeldata to our TextureBuffer - // (line by line) - FrameDataPtr:=AVFrameRGB^.data[0]; - linesize:=AVFrameRGB^.linesize[0]; - for y:=0 to TexY-1 do begin - System.Move(FrameDataPtr[y*linesize],TexData[3*y*dataX],linesize); - end; - - // generate opengl texture out of whatever we got - glBindTexture(GL_TEXTURE_2D, VideoTex); - glTexImage2D(GL_TEXTURE_2D, 0, 3, dataX, dataY, 0, GL_RGB, GL_UNSIGNED_BYTE, TexData); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); -{$ifdef DebugFrames} - //frame decode debug display - GoldenRec.Spawn(200,35,1,16,0,-1,ColoredStar,$ffff00); -{$endif} - - end; -end; - -procedure FFmpegDrawGL(Screen: integer); -begin - // have a nice black background to draw on (even if there were errors opening the vid) - if Screen=1 then begin - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - end; - // exit if there's nothing to draw - if not VideoOpened then Exit; - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, VideoTex); - glbegin(gl_quads); - glTexCoord2f( 0, 0); glVertex2f(400-ScaledVideoWidth/2, 300-ScaledVideoHeight/2); - glTexCoord2f( 0, TexY/dataY); glVertex2f(400-ScaledVideoWidth/2, 300+ScaledVideoHeight/2); - glTexCoord2f(TexX/dataX, TexY/dataY); glVertex2f(400+ScaledVideoWidth/2, 300+ScaledVideoHeight/2); - glTexCoord2f(TexX/dataX, 0); glVertex2f(400+ScaledVideoWidth/2, 300-ScaledVideoHeight/2); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - -{$ifdef Info} - if VideoSkipTime+VideoTime+VideoTimeBase < 0 then begin - glColor4f(0.7, 1, 0.3, 1); - SetFontStyle (1); - SetFontItalic(False); - SetFontSize(9); - SetFontPos (300, 0); - glPrint('Delay due to negative VideoGap'); - glColor4f(1, 1, 1, 1); - end; -{$endif} - -{$ifdef DebugFrames} - glColor4f(0, 0, 0, 0.2); - glbegin(gl_quads); - glVertex2f(0, 0); - glVertex2f(0, 70); - glVertex2f(250, 70); - glVertex2f(250, 0); - glEnd; - - glColor4f(1,1,1,1); - SetFontStyle (1); - SetFontItalic(False); - SetFontSize(9); - SetFontPos (5, 0); - glPrint('delaying frame'); - SetFontPos (5, 20); - glPrint('fetching frame'); - SetFontPos (5, 40); - glPrint('dropping frame'); -{$endif} -end; - -end. diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index deaa042e..067414bd 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -165,6 +165,7 @@ end; function TScreenCredits.Draw: boolean; begin DrawCredits; + Draw:=true; end; procedure TScreenCredits.onShow; @@ -187,7 +188,7 @@ end; Procedure TScreenCredits.Draw_FunkyText; var - S,I, Len: Integer; + S: Integer; X,Y,A: Real; visibleText: PChar; begin @@ -208,6 +209,7 @@ begin for S := 0 to length(visibleText)-1 do begin Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); + A:=0; if (Credits_X+X < 15) then A:=0; if (Credits_X+X >=15) then A:=Credits_X+X-15; if Credits_X+X > 32 then A:=17; @@ -488,7 +490,6 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -511,7 +512,7 @@ Data := Music.GetFFTData; gltranslatef(223,0,0); if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin gltranslatef(223,0,0); - glrotatef((CTime-(STime+Delay-10))*-9,0,0,1); + glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1); gltranslatef(-223,0,0); end; glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum); @@ -541,7 +542,6 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -599,7 +599,6 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -652,7 +651,6 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -675,12 +673,11 @@ Data := Music.GetFFTData; f:=258.0-25.8*(CTime-STime) else f:=0; - + g:=0; if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin j:=CTime-(STime+Delay-10); g:=32.6*j; - end else - g:=0; + end; glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); @@ -742,7 +739,6 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -766,11 +762,11 @@ Data := Music.GetFFTData; else f:=0; + g:=0; if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin j:=CTime-(STime+Delay-10); g:=32.6*j; - end else - g:=0; + end; glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); @@ -798,7 +794,6 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -856,7 +851,6 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -882,9 +876,8 @@ Data := Music.GetFFTData; end; if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin j:=CTime-(STime+Delay-10); - f:=j*10.0; gltranslatef(0,-223,0); - glrotatef(j*-9,0,0,1); + glrotatef(integer(j)*-9,0,0,1); gltranslatef(0,223,0); glrotatef(j*9,0,0,1); end; @@ -915,7 +908,6 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 948ff2cc..6eef8509 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -2,7 +2,7 @@ unit UScreenEditSub; interface -uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, UMenuText, +uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, UMenuText, ULyrics, Math, OpenGL12, UThemes, MidiOut; type diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index 68667d87..c27ee762 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -2,7 +2,7 @@ unit UScreenOpen; interface -uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, UMenuText, +uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, UMenuText, ULyrics, Math, OpenGL12, UThemes; type diff --git a/Game/Code/Screens/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas index f583eb90..cc1b4492 100644 --- a/Game/Code/Screens/UScreenPopup.pas +++ b/Game/Code/Screens/UScreenPopup.pas @@ -19,8 +19,8 @@ type type TScreenPopupError = class(TMenu) - private - CurMenu: Byte; //Num of the cur. Shown Menu +{ private + CurMenu: Byte; //Num of the cur. Shown Menu} public Visible: Boolean; //Whether the Menu should be Drawn @@ -124,7 +124,7 @@ end; function TScreenPopupCheck.Draw: boolean; begin - inherited Draw; + Draw:=inherited Draw; end; procedure TScreenPopupCheck.onShow; @@ -207,7 +207,7 @@ end; function TScreenPopupError.Draw: boolean; begin - inherited Draw; + Draw:=inherited Draw; end; procedure TScreenPopupError.onShow; @@ -216,12 +216,10 @@ begin end; procedure TScreenPopupError.onHide; -var i: integer; begin end; procedure TScreenPopupError.ShowPopup(msg: String); -var i: integer; begin Interaction := 0; //Reset Interaction Visible := True; //Set Visible diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 8291a430..7a585cef 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -3,7 +3,7 @@ unit UScreenSing; interface uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, ULyrics, - TextGL, OpenGL12, BASS, UThemes, ULCD, UGraphicClasses, Uffmpeg; + TextGL, OpenGL12, BASS, UThemes, ULCD, UGraphicClasses, UVideo; type TScreenSing = class(TMenu) @@ -224,7 +224,7 @@ begin LyricMain := TLyric.Create; LyricSub := TLyric.Create; - Uffmpeg.Init; + UVideo.Init; end; procedure TScreenSing.onShow; diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index e046e193..0305315f 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -2,7 +2,7 @@ unit UScreenSingModi; interface -uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, ULyrics, +uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, ULyrics, TextGL, OpenGL12, BASS, UThemes, ULCD, UScreenSing, ModiSDK; type @@ -943,10 +943,11 @@ end; if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) then SingDrawBackground; + // comment by blindy: wo zum henker wird denn in diesem screen ein video abgespielt? // update and draw movie - if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin +{ if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin UpdateSmpeg; // this only draws - end; + end;} // draw static menu (FG) DrawFG; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 30c03e7e..d39df45b 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -84,9 +84,8 @@ uses //------------------------------ //Includes - Video Support //------------------------------ - Uffmpeg in 'SMpeg\Uffmpeg.pas', - USmpeg in 'SMpeg\USmpeg.pas', - + UVideo in 'Classes\UVideo.pas', + //------------------------------ //Includes - Screens //------------------------------ -- cgit v1.2.3 From af73174a22a52fd9e2a6320737fb5b1ef87628ce Mon Sep 17 00:00:00 2001 From: b1indy Date: Fri, 7 Sep 2007 21:37:23 +0000 Subject: removed "error" messages (are more like warnings and did only confuse users) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@375 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UDisplay.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index 82b4acc7..0bded712 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -174,7 +174,7 @@ begin // check if we had an initialization error (canfade=false, dofade=true) if doFade and not canFade then begin doFade:=False; //disable fading - ScreenPopupError.ShowPopup('Error initializing\nfade texture\n\nfading\ndisabled'); //show error message +// ScreenPopupError.ShowPopup('Error initializing\nfade texture\n\nfading\ndisabled'); //show error message end; if doFade and canFade then begin @@ -199,7 +199,7 @@ begin GL_OUT_OF_MEMORY: glErrorStr:='OUT_OF_MEMORY'; else glErrorStr:='unknown error'; end; - ScreenPopupError.ShowPopup('Error copying\nfade texture\n('+glErrorStr+')\nfading\ndisabled'); //show error message +// ScreenPopupError.ShowPopup('Error copying\nfade texture\n('+glErrorStr+')\nfading\ndisabled'); //show error message end; glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); // blackscreen-hack -- cgit v1.2.3 From 486040f9b4cc080b7c02da4b286824ad86e26a93 Mon Sep 17 00:00:00 2001 From: b1indy Date: Fri, 7 Sep 2007 21:51:20 +0000 Subject: removed smpeg git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@376 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.dpr | 1 - 1 file changed, 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index d39df45b..1cfa64f5 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -9,7 +9,6 @@ uses //Includes - 3rd Party Libraries //------------------------------ OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas', - smpeg in 'lib\JEDI-SDLv1.0\smpeg\Pas\smpeg.pas', bass in 'lib\bass\delphi\bass.pas', -- cgit v1.2.3 From e0b594a06c1e70df28b873b49e538ded7b3124c5 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 8 Sep 2007 09:46:16 +0000 Subject: Fixed USMPeg still in Uses from UScreenSing git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@377 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 7a585cef..deaff447 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -2,7 +2,7 @@ unit UScreenSing; interface -uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, ULyrics, +uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, ULyrics, TextGL, OpenGL12, BASS, UThemes, ULCD, UGraphicClasses, UVideo; type -- cgit v1.2.3 From 69def54f79cace3a1a90ae71f03910986ff74da7 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 8 Sep 2007 15:03:05 +0000 Subject: re-did the colorize stuff, now no need for GraphUtils git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@378 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 150 ++++++++++++++++++++++++++++++----------- 1 file changed, 112 insertions(+), 38 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index ab21d44c..dc1f9fc2 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -11,7 +11,7 @@ unit UTexture; // Arrow (for arrows, white is white, gray has color, black is transparent); interface -uses OpenGL12, Windows, Math, Classes, SysUtils, Graphics, JPEG, UThemes, PNGImage, GraphUtil, dialogs; +uses OpenGL12, Windows, Math, Classes, SysUtils, Graphics, JPEG, UThemes, PNGImage; procedure glGenTextures(n: GLsizei; var textures: GLuint); stdcall; external opengl32; @@ -66,10 +66,10 @@ type function LoadTexture(Identifier: string): TTexture; overload; function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; procedure UnloadTexture(Name: string; FromCache: boolean); - procedure Colorize(var R,G,B : Byte; Color: Cardinal); // Real colorize instead of: "150 grey is now blue, k?" end; var + lasthue: double; Texture: TTextureUnit; TextureDatabase: TTextureDatabase; @@ -165,6 +165,106 @@ begin Result := T; end; +// expects: src, dst: pointers to r,g,b,a +// hue: new hue within range [0.0-6.0) +procedure ColorizeCopy(Src, Dst: PByteArray; hue: Double); overload; +var + i,j,k: Cardinal; + clr, hls: array[0..2] of Double; + delta, f, p, q, t: Double; +begin + hls[0]:=hue; + + clr[0]:=src[0]/255; clr[1]:=src[1]/255; clr[2]:=src[2]/255; + //calculate luminance and saturation from rgb + hls[1]:=maxvalue(clr); //l:=... + delta:=hls[1]-minvalue(clr); + if hls[1]=0.0 then hls[2]:=0.0 else hls[2]:=delta/hls[1]; //v:=... + // calc new rgb from our hls (h from color, l ans s from pixel) +// if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense + begin + k:=trunc(hls[0]); + f:=hls[0]-k; + p:=hls[1]*(1.0-hls[2]); + q:=hls[1]*(1.0-(hls[2]*f)); + t:=hls[1]*(1.0-(hls[2]*(1.0-f))); + case k of + 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end; + 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end; + 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end; + 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end; + 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end; + 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; + end; + // and store new rgb back into the image + dst[0]:=floor(255*clr[0]); + dst[1]:=floor(255*clr[1]); + dst[2]:=floor(255*clr[2]); + dst[3]:=src[3]; + end; +end; + +// expects: src: $rrggbb +// dst: pointer to r,g,b,a +// hue: new hue within range [0.0-6.0) +procedure ColorizeCopy(Src: Cardinal; Dst: PByteArray; hue: Double); overload; +var + i,j,k: Cardinal; + clr, hls: array[0..2] of Double; + delta, f, p, q, t: Double; +begin + hls[0]:=hue; + + clr[0]:=((src shr 16) and $ff)/255; + clr[1]:=((src shr 8) and $ff)/255; + clr[2]:=(src and $ff)/255; + //calculate luminance and saturation from rgb + hls[1]:=maxvalue(clr); //l:=... + delta:=hls[1]-minvalue(clr); + if hls[1]=0.0 then hls[2]:=0.0 else hls[2]:=delta/hls[1]; //v:=... + // calc new rgb from our hls (h from color, l ans s from pixel) +// if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense + begin + k:=trunc(hls[0]); + f:=hls[0]-k; + p:=hls[1]*(1.0-hls[2]); + q:=hls[1]*(1.0-(hls[2]*f)); + t:=hls[1]*(1.0-(hls[2]*(1.0-f))); + case k of + 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end; + 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end; + 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end; + 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end; + 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end; + 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; + end; + // and store new rgb back into the image + dst[0]:=floor(255*clr[0]); + dst[1]:=floor(255*clr[1]); + dst[2]:=floor(255*clr[2]); + dst[3]:=255; + end; +end; +//returns hue within range [0.0-6.0) +function col2h(Color:Cardinal):double; +var + clr,hls: array[0..2] of double; + delta: double; +begin + clr[0]:=((Color and $ff0000) shr 16)/255; + clr[1]:=((Color and $ff00) shr 8)/255; + clr[2]:=(Color and $ff)/255; + hls[1]:=maxvalue(clr); + delta:=hls[1]-minvalue(clr); + if clr[0]=hls[1] then hls[0]:=(clr[1]-clr[2])/delta + else if clr[1]=hls[1] then hls[0]:=2.0+(clr[2]-clr[0])/delta + else if clr[2]=hls[1] then hls[0]:=4.0+(clr[0]-clr[1])/delta; + if hls[0]<0.0 then hls[0]:=hls[0]+6.0; + if hls[0]=6.0 then hls[0]:=0.0; + col2h:=hls[0]; +end; + + function TTextureUnit.LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; var Res: TResourceStream; @@ -187,6 +287,7 @@ var myAlpha: Real; myRGBABitmap: array of byte; RGBPtr: PByte; + myHue: Double; begin Log.BenchmarkStart(4); Mipmapping := true; @@ -426,29 +527,19 @@ begin TextureB.Width := TexNewW; TextureB.Height := TexNewH; + myHue:=col2h(Col); // copy and process pixeldata for Position := 0 to TexOrigH-1 do begin for Position2 := 0 to TexOrigW-1 do begin Pix := TextureB.Canvas.Pixels[Position2, Position]; - if (Format = 'PNG') and (length(MyRGBABitmap) <> 0) then begin - myAlpha:=TextureAlpha[Position*TexOrigW+Position2]; - TextureD32[Position*TexNewW + Position2+1, 1] := MyRGBABitmap[(Position*TexOrigW+Position2)*4+2]; // R - TextureD32[Position*TexNewW + Position2+1, 2] := MyRGBABitmap[(Position*TexOrigW+Position2)*4+1]; // G - TextureD32[Position*TexNewW + Position2+1, 3] := MyRGBABitmap[(Position*TexOrigW+Position2)*4]; // B - TextureD32[Position*TexNewW+Position2+1,4] := MyRGBABitmap[(Position*TexOrigW+Position2)*4+3]; // Alpha - end else begin - TextureD32[Position*TexNewW + Position2+1, 1] := (Pix and $ff); - TextureD32[Position*TexNewW + Position2+1, 2] := ((Pix shr 8) and $ff); - TextureD32[Position*TexNewW + Position2+1, 3] := ((Pix shr 16) and $ff); - TextureD32[Position*TexNewW + Position2+1, 4] := 255; - end; - end; - end; - - //now the colorize stuff - for Position := 0 to TexOrigH-1 do begin - for Position2 := 0 to TexOrigW-1 do begin - colorize(TextureD32[Position*TexNewW + Position2+1, 1],TextureD32[Position*TexNewW + Position2+1, 2],TextureD32[Position*TexNewW + Position2+1, 3], Col); //pinkie :P + if (Format = 'PNG') and (length(MyRGBABitmap) <> 0) then + ColorizeCopy(@MyRGBABitmap[(Position*TexOrigW+Position2)*4], + @TextureD32[Position*TexNewW + Position2+1, 1], + myHue) + else + ColorizeCopy(Pix, + @TextureD32[Position*TexNewW + Position2+1, 1], + myHue); end; end; @@ -803,23 +894,6 @@ begin end; - -// Funkyness of colorizing is done in this small box, remember to give credits when you copy from us -Procedure TTextureUnit.Colorize(var R,G,B : Byte; Color : Cardinal); -var - TexHue, TexLum, TexSat, ClrHue, ClrLum, ClrSat : Word; - ColorizedColors: Cardinal; -begin //red //green //blue - Color:=((Color and $ff) shl 16) or (Color and $ff00) or ((Color and $ff0000) shr 16); - ColorRGBToHLS(Color, ClrHue, ClrLum, ClrSat); - ColorRGBToHLS((((b shl 8) or g) shl 8 or r),TexHue, TexLum, TexSat); - ColorizedColors := ColorHLSToRGB(ClrHue, TexLum, TexSat); - R := ColorizedColors and $FF; - G := (ColorizedColors and $FF00) shr 8; - B := (ColorizedColors and $FF0000) shr 16; -end; -//eoa COLORIZE - function TTextureUnit.LoadTexture(Identifier: string): TTexture; begin Result := LoadTexture(false, pchar(Identifier), 'JPG', 'Plain', 0); -- cgit v1.2.3 From 16e0d37948cc1137d0c79f48f9b5e12e5bf77686 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 8 Sep 2007 15:33:52 +0000 Subject: did some cleanup and minor modifications UDisplay.pas: tried to make the screenfade-effect transparent (doesn't work for now) UMenu.pas: removed some unnecessary code from DrawBG UGraphic.pas: fixed display of loading screen (after it broke with the modifications in UMenu.pas) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@379 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphic.pas | 3 ++- Game/Code/Menu/UDisplay.pas | 8 ++++---- Game/Code/Menu/UMenu.pas | 16 ++++++---------- 3 files changed, 12 insertions(+), 15 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 068ed715..a79a16a2 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -358,7 +358,7 @@ begin SDL_GL_SwapBuffers; glMatrixMode(GL_PROJECTION); glLoadIdentity; - glOrtho(0, 800, 600, 0, -1, 100); + glOrtho(0, RenderW, RenderH, 0, -1, 100); glMatrixMode(GL_MODELVIEW); end; @@ -444,6 +444,7 @@ begin ScreenLoading := TScreenLoading.Create; ScreenLoading.onShow; Display.ActualScreen := @ScreenLoading; + swapbuffers; ScreenLoading.Draw; Display.Draw; SwapBuffers; diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index 0bded712..fcba4382 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -75,7 +75,7 @@ begin canFade:=True; // generate texture for fading between screens - GetMem(pTexData, 512*512*3); + GetMem(pTexData, 512*512*4); if pTexData <> NIL then for i:= 1 to 2 do begin @@ -83,7 +83,7 @@ begin if glGetError <> GL_NO_ERROR then canFade := False; glBindTexture(GL_TEXTURE_2D, pTex[i]); if glGetError <> GL_NO_ERROR then canFade := False; - glTexImage2D(GL_TEXTURE_2D, 0, 3, 512, 512, 0, GL_RGB, GL_UNSIGNED_BYTE, pTexData); + glTexImage2D(GL_TEXTURE_2D, 0, 4, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, pTexData); if glGetError <> GL_NO_ERROR then canFade := False; glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); if glGetError <> GL_NO_ERROR then canFade := False; @@ -185,7 +185,7 @@ begin glViewPort(0, 0, 512, 512); ActualScreen.Draw; glBindTexture(GL_TEXTURE_2D, pTex[S]); - glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 512, 512, 0); + glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 512, 512, 0); glError:=glGetError; if glError <> GL_NO_ERROR then begin @@ -229,7 +229,7 @@ begin // blackscreen-hack if not BlackScreen then NextScreen.Draw // draw next screen - else begin + else if ScreenAct=1 then begin glClearColor(0, 0, 0 , 0); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); end; diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 0fb1614f..b0622d4b 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -712,14 +712,6 @@ var PetX: integer; PetY: integer; begin -// glClearColor(1, 1, 1, 1); -// glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity; - glOrtho(0, RenderW, RenderH, 0, -1, 100); - glMatrixMode(GL_MODELVIEW); - BackImg.ColR := 1; BackImg.ColG := 1; BackImg.ColB := 1; @@ -728,13 +720,17 @@ begin BackImg.TexX2 := 1; BackImg.TexY2 := 1; if (BackImg.TexNum <> -1) then begin - // draw texture with overlapping + // does anyone know what these loops were for? +{ // draw texture with overlapping for PetY := 1 to BackH do for PetX := 1 to BackW do begin BackImg.X := (PetX-1)/BackW * 800; //640 BackImg.Y := (PetY-1)/BackH * 600; //480 DrawTexture(BackImg); - end; // for PetX + end; // for PetX} + BackImg.X:=BackW; + BackImg.Y:=BackW; + DrawTexture(BackImg); end; // if end; -- cgit v1.2.3 From 13666b8a713f7f46d1db186ba147aa91984ddb0f Mon Sep 17 00:00:00 2001 From: mogguh Date: Mon, 10 Sep 2007 13:06:56 +0000 Subject: Overall look: ScoreBGs and playerboxes (p1, p2,..) are now drawn as colorized pngs. Notes are drawn with 3 textures instead of 2: bg_glow, notebg (unsung) and note hit (sung) - these are colorized pngs - textures will come in the following commit. Known Bugs: - ScoreBGs are not yet drawn in playercolor (only affects player count > 3) - Phrasen bonus pop up, indexes are not yet filled with usable data, therefore textures are not yet loaded correctly - Linebonus not yet done git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@382 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 612 ++++++++++++++-------------------- Game/Code/Classes/UGraphic.pas | 47 ++- Game/Code/Classes/UMain.pas | 2 +- Game/Code/Classes/UThemes.pas | 301 +++++------------ Game/Code/Screens/UScreenSing.pas | 393 +++++++++------------- Game/Code/Screens/UScreenSingModi.pas | 1 + 6 files changed, 527 insertions(+), 829 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 8945e591..8cfa8d7e 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -1,7 +1,7 @@ unit UDraw; interface -uses UThemes, ModiSDK, UGraphicClasses; +uses UThemes, ModiSDK, UGraphicClasses, dialogs; procedure SingDraw; procedure SingModiDraw (PlayerInfo: TPlayerInfo); @@ -13,14 +13,9 @@ procedure SingDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: intege procedure SingDrawPlayerCzesc(X, Y, W: real; NrGracza: integer; Space: integer); procedure SingDrawPlayerBGCzesc(Left, Top, Right: real; NrCzesci, NrGracza: integer; Space: integer); -// TimeBar mod +// TimeBar procedure SingDrawTimeBar(); -// eoa TimeBar mod -{ for no use since we have UGraphicClasses -procedure SingDrawStar(X, Y, A: real); -procedure SingGoldenStar(X, Y, A: real); -} // The Singbar procedure SingDrawSingbar(X, Y, W, H: real; Percent: integer); @@ -52,15 +47,9 @@ var Starfr: integer; StarfrG: integer; - - - //SingBar Mod + //SingBar TickOld: cardinal; TickOld2:cardinal; - //end Singbar Mod - - - const Przedz = 32; @@ -208,8 +197,20 @@ var TempR: real; R,G,B: real; + PlayerNumber: Integer; + GoldenStarPos : real; begin +// We actually don't have a playernumber in this procedure, it should reside in NrCzesci - but it's always set to zero +// So we exploit this behavior a bit - we give NrCzesci the playernumber, keep it in playernumber - and then we set NrCzesci to zero +// This could also come quite in handy when we do the duet mode, cause just the notes for the player that has to sing should be drawn then +// BUT this is not implemented yet, all notes are drawn! :D + + PlayerNumber := NrCzesci + 1; // Player 1 is 0 + NrCzesci := 0; + +// exploit done + glColor3f(1, 1, 1); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); @@ -225,19 +226,19 @@ begin // If Golden note Effect of then Change not Color begin case Wartosc of - 1: glColor4f(1, 1, 1, 0.85); - 2: glColor4f(1, 1, 0.3, 0.85); // no stars, paint yellow -> glColor4f(1, 1, 0.3, 0.85); + 1: glColor4f(1, 1, 1, 1); // We set alpha to 1, cause we can control the transparency through the png itself + 2: glColor4f(1, 1, 0.3, 1); // no stars, paint yellow -> glColor4f(1, 1, 0.3, 0.85); - we could end; // case end //Else all Notes same Color else - glColor4f(1, 1, 1, 0.85); - + glColor4f(1, 1, 1, 1); // We set alpha to 1, cause we can control the transparency through the png itself + // Czesci == teil, element == piece, element | koniec == ende, schluss // lewa czesc - left part Rec.Left := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX; Rec.Right := Rec.Left + NotesW; Rec.Top := Top - (Ton-BaseNote)*Space/2 - NotesH; Rec.Bottom := Rec.Top + 2 * NotesH; - glBindTexture(GL_TEXTURE_2D, Tex_Left[Color].TexNum); + glBindTexture(GL_TEXTURE_2D, Tex_plain_Left[PlayerNumber].TexNum); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); @@ -249,12 +250,11 @@ begin GoldenStarPos := Rec.Left; //done - // srodkowa czesc - middle part Rec.Left := Rec.Right; - Rec.Right := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - NotesW - 0.5 + 10*ScreenX; + Rec.Right := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - NotesW - 0.5 + 10*ScreenX; // Dlugosc == länge - glBindTexture(GL_TEXTURE_2D, Tex_Mid[Color].TexNum); + glBindTexture(GL_TEXTURE_2D, Tex_plain_Mid[PlayerNumber].TexNum); glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); glBegin(GL_QUADS); @@ -268,7 +268,7 @@ begin Rec.Left := Rec.Right; Rec.Right := Rec.Right + NotesW; - glBindTexture(GL_TEXTURE_2D, Tex_Right[Color].TexNum); + glBindTexture(GL_TEXTURE_2D, Tex_plain_Right[PlayerNumber].TexNum); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); @@ -313,134 +313,100 @@ var // G := 175/255; // B := 247/255; - glColor3f(1, 1, 1); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - if Player[NrGracza].IlNut > 0 then begin - TempR := W / (Czesci[0].Czesc[Czesci[0].Akt].Koniec - Czesci[0].Czesc[Czesci[0].Akt].StartNote); - for N := 0 to Player[NrGracza].HighNut do begin - with Player[NrGracza].Nuta[N] do begin - // lewa czesc - Rec.Left := X + (Start-Czesci[0].Czesc[Czesci[0].Akt].StartNote) * TempR + 0.5 + 10*ScreenX; - Rec.Right := Rec.Left + NotesW; - - - // Half size Notes Patch - if Hit then begin - NotesH2 := NotesH - end else begin - NotesH2 := int(NotesH * 0.65); - end; //if - - - - // if True then - Rec.Top := Y - (Ton-Czesci[0].Czesc[Czesci[0].Akt].BaseNote)*Space/2 - NotesH2; - Rec.Bottom := Rec.Top + 2 *NotesH2; - - glColor3f(1, 1, 1); - glBindTexture(GL_TEXTURE_2D, Tex_Left[NrGracza+1].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - // srodkowa czesc - Rec.Left := Rec.Right; - Rec.Right := X + (Start+Dlugosc-Czesci[0].Czesc[Czesci[0].Akt].StartNote) * TempR - NotesW - 0.5 + 10*ScreenX; - // (nowe) - if (Start+Dlugosc-1 = Czas.AktBeatD) then - Rec.Right := Rec.Right - (1-Frac(Czas.MidBeatD)) * TempR; - - if Rec.Right <= Rec.Left then Rec.Right := Rec.Left; - - -// glColor3f(R, G, B); -// glBindTexture(GL_TEXTURE_2D, Tex_MidGray.TexNum); - glBindTexture(GL_TEXTURE_2D, Tex_Mid[NrGracza+1].TexNum); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(round((Rec.Right-Rec.Left)/32), 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(round((Rec.Right-Rec.Left)/32), 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - glColor3f(1, 1, 1); - - // prawa czesc - Rec.Left := Rec.Right; - Rec.Right := Rec.Right + NotesW; - - glBindTexture(GL_TEXTURE_2D, Tex_Right[NrGracza+1].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - - //Rec.Right := X + (Start+Dlugosc-Czesci[0].Czesc[Czesci[0].Akt].StartNote) * TempR - NotesW - 0.5 + 10*ScreenX; - //if (Start+Dlugosc-1 = Czas.AktBeatD) then - if Perfect and (Ini.EffectSing=1) then begin -// A := sqrt((1+sin(Music.Position * 3))/2); - A := 1 - 2*(Czas.Teraz - GetTimeFromBeat(Start+Dlugosc)); - if not (Start+Dlugosc-1 = Czas.AktBeatD) then - - //Star animation counter - //inc(Starfr); - //Starfr := Starfr mod 128; - GoldenRec.SavePerfectNotePos(Rec.Left, Rec.Top); - { SingDrawStar(Rec.Left+2, Rec.Top+4, A);} - end; - - // detekt -{ Rec.Left := Round((Detekt-Czesci.Czesc[Czesci.Akt].Start) * TempR) + 130; - glColor3f(1, 0.2, 0.2); - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - glBegin(GL_QUADS); - glVertex(Rec.Left, Rec.Top-5); - glVertex(Rec.Left, Rec.Bottom+5); - glVertex(Rec.Left+1, Rec.Bottom+5); - glVertex(Rec.Left+1, Rec.Top-5); - glEnd; - glColor3f(1, 1, 1); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D);} - - // detekt + FFT length -{ Rec.Right := (Detekt-Czesci.Czesc[Czesci.Akt].Start) * TempR + 130; - // TempR = dlugosc 1 kostki - // 60 * 4 / BPM = czas w sekundach na 1 kostke, np. 0,4s - // 4096 / 44100 = czas jednego sampla FFT, np. 0,1s - // ile to ma kostek? np. 0.25 - // (4096 / 44100) / (60 * 4 / BPM), np. 0,1s / 0,4s = 0.25 - // * TempR = dlugosc sampla FFT - Rec.Left := Rec.Right - (Sound.n / 44100) / (60 * 4 / Muzyka.BPM) * TempR; - - glColor3f(1, 0.2, 0.2); - glVertex(Rec.Left, Rec.Top-4); - glVertex(Rec.Left, Rec.Bottom+4); - glVertex(Rec.Right, Rec.Bottom+4); - glVertex(Rec.Right, Rec.Top-4);} - - end; // with - end; // for + if Player[NrGracza].IlNut > 0 then + begin + TempR := W / (Czesci[0].Czesc[Czesci[0].Akt].Koniec - Czesci[0].Czesc[Czesci[0].Akt].StartNote); + for N := 0 to Player[NrGracza].HighNut do + begin + with Player[NrGracza].Nuta[N] do + begin + // Left part of note + Rec.Left := X + (Start-Czesci[0].Czesc[Czesci[0].Akt].StartNote) * TempR + 0.5 + 10*ScreenX; + Rec.Right := Rec.Left + NotesW; + + // Draw it in half size, if not hit + if Hit then + begin + NotesH2 := NotesH + end + else + begin + NotesH2 := int(NotesH * 0.65); + end; + + Rec.Top := Y - (Ton-Czesci[0].Czesc[Czesci[0].Akt].BaseNote)*Space/2 - NotesH2; + Rec.Bottom := Rec.Top + 2 *NotesH2; + + // draw the left part + glColor3f(1, 1, 1); + glBindTexture(GL_TEXTURE_2D, Tex_Left[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // Middle part of the note + Rec.Left := Rec.Right; + Rec.Right := X + (Start+Dlugosc-Czesci[0].Czesc[Czesci[0].Akt].StartNote) * TempR - NotesW - 0.5 + 10*ScreenX; + + // (nowe) - dunno + if (Start+Dlugosc-1 = Czas.AktBeatD) then + Rec.Right := Rec.Right - (1-Frac(Czas.MidBeatD)) * TempR; + // the left note is more right than the right note itself, sounds weird - so we fix that xD + if Rec.Right <= Rec.Left then Rec.Right := Rec.Left; + + // draw the middle part + glBindTexture(GL_TEXTURE_2D, Tex_Mid[NrGracza+1].TexNum); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(round((Rec.Right-Rec.Left)/32), 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(round((Rec.Right-Rec.Left)/32), 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + glColor3f(1, 1, 1); + + // the right part of the note + Rec.Left := Rec.Right; + Rec.Right := Rec.Right + NotesW; + + glBindTexture(GL_TEXTURE_2D, Tex_Right[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // Perfect note is stored + if Perfect and (Ini.EffectSing=1) then + begin + A := 1 - 2*(Czas.Teraz - GetTimeFromBeat(Start+Dlugosc)); + if not (Start+Dlugosc-1 = Czas.AktBeatD) then + + //Star animation counter + //inc(Starfr); + //Starfr := Starfr mod 128; + GoldenRec.SavePerfectNotePos(Rec.Left, Rec.Top); + end; + end; // with + end; // for // eigentlich brauchen wir hier einen vergleich, um festzustellen, ob wir mit // singen schon weiter wären, als bei Rec.Right, _auch, wenn nicht gesungen wird_ // passing on NrGracza... hope this is really something like the player-number, not only // some kind of weird index into a colour-table - if (Ini.EffectSing=1) then - GoldenRec.GoldenNoteTwinkle(Rec.Top,Rec.Bottom,Rec.Right, NrGracza); + if (Ini.EffectSing=1) then + GoldenRec.GoldenNoteTwinkle(Rec.Top,Rec.Bottom,Rec.Right, NrGracza); end; // if end; @@ -523,64 +489,6 @@ begin end; end; -{not used anymore tough we have UGraphicClasses -procedure SingDrawStar(X, Y, A: real); -var - TempR: real; - W, H: real; - Starframe: real; - begin - W := 32; - H := 32; - -// Golden Star Patch -// case Z of -// 1: glColor4f(1, 1, 1, A); -// 2: glColor4f(1, 1, 0.3, A); -// end; // case - - glColor4f(1, 1, 1, A); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, Tex_Note_Star.TexNum); - - Starframe := 15 - ((GetTickCount div 33) mod 16); - - glBegin(GL_QUADS); - glTexCoord2f((1/16) * Starframe, 0); glVertex2f(X-W, Y-H); - glTexCoord2f((1/16) * Starframe + (1/16), 0); glVertex2f(X-W, Y+H); - glTexCoord2f((1/16) * Starframe + (1/16), 1); glVertex2f(X+W, Y+H); - glTexCoord2f((1/16) * Starframe, 1); glVertex2f(X+W, Y-H); - glEnd; -end; -} - -{not used anymore tough we have UGraphicClasses -procedure SingGoldenStar(X, Y, A: real); -var - TempR: real; - W, H: real; - StarfrG2: real; - begin - W := 16; - H := 16; - glColor4f(1, 1, 0.3, A); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, Tex_Note_Star.TexNum); - StarfrG2 := 15 - ((GetTickCount div 67) mod 16); - glBegin(GL_QUADS); - //x1 - glTexCoord2f((1/16) * StarfrG2, 0); glVertex2f(X-W, Y-H); - glTexCoord2f((1/16) * StarfrG2 + (1/16), 0); glVertex2f(X-W, Y+H); - glTexCoord2f((1/16) * StarfrG2 + (1/16), 1); glVertex2f(X+W, Y+H); - glTexCoord2f((1/16) * StarfrG2, 1); glVertex2f(X+W, Y-H); - glEnd; -end; -} - procedure SingDraw; var Pet: integer; @@ -598,16 +506,12 @@ var LyricTemp: string; PetCz: integer; - - //SingBar Mod A: Integer; E: Integer; I: Integer; //end Singbar Mod - - begin // positions if Ini.SingWindow = 0 then begin @@ -739,51 +643,40 @@ begin else if I < 0 then Dec(Player[E].ScorePercent); end; //for end; //if + if PlayersPlay = 1 then begin - //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP1SingBar.x, Theme.Sing.StaticP1SingBar.y, Theme.Sing.StaticP1SingBar.w, Theme.Sing.StaticP1SingBar.h , Player[0].ScorePercent); - end; + end; + if PlayersPlay = 2 then begin - //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); - //SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); - end; + end; + if PlayersPlay = 3 then begin - //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); - //SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); - //SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); end; + if PlayersPlay = 4 then begin if ScreenAct = 1 then begin - //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); - //SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); end; if ScreenAct = 2 then begin - //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); - //SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[3].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[2].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[3].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[2].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[3].ScorePercent); end; end; + if PlayersPlay = 6 then begin if ScreenAct = 1 then begin - //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); - //SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); - //SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); end; if ScreenAct = 2 then begin - //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[3].ScorePercent); - //SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[4].ScorePercent); - //SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[5].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[3].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[4].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[5].ScorePercent); @@ -798,53 +691,58 @@ begin if (A <> Tickold2) AND (Player[0].LineBonus_Visible) then begin Tickold2 := A; for E := 0 to (PlayersPlay - 1) do begin - //Change Alpha - Player[E].LineBonus_Alpha := Player[E].LineBonus_Alpha - 0.02; + //Change Alpha + Player[E].LineBonus_Alpha := Player[E].LineBonus_Alpha - 0.02; if Player[E].LineBonus_Alpha <= 0 then begin Player[E].LineBonus_Age := 0; Player[E].LineBonus_Visible := False end else - begin - inc(Player[E].LineBonus_Age, 1); - //Change Position - if (Player[E].LineBonus_PosX < Player[E].LineBonus_TargetX) then - Player[E].LineBonus_PosX := Player[E].LineBonus_PosX + (2 - Player[E].LineBonus_Alpha * 1.5) - else if (Player[E].LineBonus_PosX > Player[E].LineBonus_TargetX) then - Player[E].LineBonus_PosX := Player[E].LineBonus_PosX - (2 - Player[E].LineBonus_Alpha * 1.5); - - if (Player[E].LineBonus_PosY < Player[E].LineBonus_TargetY) then - Player[E].LineBonus_PosY := Player[E].LineBonus_PosY + (2 - Player[E].LineBonus_Alpha * 1.5) - else if (Player[E].LineBonus_PosY > Player[E].LineBonus_TargetY) then - Player[E].LineBonus_PosY := Player[E].LineBonus_PosY - (2 - Player[E].LineBonus_Alpha * 1.5); + begin + inc(Player[E].LineBonus_Age, 1); + //Change Position + if (Player[E].LineBonus_PosX < Player[E].LineBonus_TargetX) then + Player[E].LineBonus_PosX := Player[E].LineBonus_PosX + (2 - Player[E].LineBonus_Alpha * 1.5) + else if (Player[E].LineBonus_PosX > Player[E].LineBonus_TargetX) then + Player[E].LineBonus_PosX := Player[E].LineBonus_PosX - (2 - Player[E].LineBonus_Alpha * 1.5); - end; - end; - end; //if + if (Player[E].LineBonus_PosY < Player[E].LineBonus_TargetY) then + Player[E].LineBonus_PosY := Player[E].LineBonus_PosY + (2 - Player[E].LineBonus_Alpha * 1.5) + else if (Player[E].LineBonus_PosY > Player[E].LineBonus_TargetY) then + Player[E].LineBonus_PosY := Player[E].LineBonus_PosY - (2 - Player[E].LineBonus_Alpha * 1.5); - if PlayersPlay = 1 then begin + end; // shift position of the pop up (if not dead) + end; // loop - for all players + end; // if - linebonus + + + if PlayersPlay = 1 then begin SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - end - else if PlayersPlay = 2 then begin + end + + else if PlayersPlay = 2 then begin SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); end + else if PlayersPlay = 3 then begin SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); end + else if PlayersPlay = 4 then begin if ScreenAct = 1 then begin - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); end; if ScreenAct = 2 then begin - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); - SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); + SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); end; end; + if PlayersPlay = 6 then begin if ScreenAct = 1 then begin SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); @@ -860,9 +758,7 @@ begin end; //PhrasenBonus - Line Bonus Mod End - - // rysuje paski -// Log.LogStatus('Original notes', 'SingDraw'); +// Set the note heights according to the difficulty level case Ini.Difficulty of 0: begin @@ -881,10 +777,11 @@ begin end; end; +// Draw the Notes if PlayersPlay = 1 then begin - SingDrawPlayerBGCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 0, 15); - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 0, 15); + SingDrawPlayerBGCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 0, 15); // Background glow - colorized in playercolor + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); // Plain unsung notes - colorized in playercolor + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 0, 15); // imho the sung notes end; if (PlayersPlay = 2) then begin @@ -892,7 +789,7 @@ begin SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 1, 15); SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); @@ -907,8 +804,8 @@ begin SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); - SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 0, 12); - SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 0, 12); + SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 1, 12); + SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 2, 12); SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); @@ -925,8 +822,14 @@ begin SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 3, 15); end; - SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); + if ScreenAct = 1 then begin + SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 1, 15); + end; + if ScreenAct = 2 then begin + SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 2, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 3, 15); + end; if ScreenAct = 1 then begin SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); @@ -953,9 +856,16 @@ begin SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 5, 12); end; - SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); - SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 0, 12); - SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 0, 12); + if ScreenAct = 1 then begin + SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); + SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 1, 12); + SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 2, 12); + end; + if ScreenAct = 2 then begin + SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 3, 12); + SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 4, 12); + SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 5, 12); + end; if ScreenAct = 1 then begin SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); @@ -968,11 +878,11 @@ begin SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 5, 12); end; end; - glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); end; +// q'n'd for using the game mode dll's procedure SingModiDraw (PlayerInfo: TPlayerInfo); var Pet: integer; @@ -990,16 +900,12 @@ var LyricTemp: string; PetCz: integer; - - //SingBar Mod A: Integer; E: Integer; I: Integer; //end Singbar Mod - - begin // positions if Ini.SingWindow = 0 then begin @@ -1007,22 +913,17 @@ begin end else begin NR.Left := 20; end; - NR.Right := 780; + NR.Right := 780; NR.Width := NR.Right - NR.Left; - NR.WMid := NR.Width / 2; - NR.Mid := NR.Left + NR.WMid; - - // background //BG Fullsize Mod - //SingDrawBackground; + NR.WMid := NR.Width / 2; + NR.Mid := NR.Left + NR.WMid; // time bar -// Log.LogStatus('Time Bar', 'SingDraw'); SingDrawTimeBar(); if DLLMan.Selected.ShowNotes then begin - // rysuje paski pod nutami if PlayersPlay = 1 then SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); if (PlayersPlay = 2) or (PlayersPlay = 4) then begin @@ -1037,7 +938,7 @@ begin end; end; - // rysuje tekst - new Lyric engine + // Lyric engine ScreenSingModi.LyricMain.Draw; ScreenSingModi.LyricSub.Draw; @@ -1046,40 +947,30 @@ begin BarFrom := Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start; if BarFrom > 40 then BarFrom := 40; if (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start > 8) and // dluga przerwa //16->12 for more help bars and then 12->8 for even more - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat > 0) and // przed tekstem - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat < 40) then begin // ale nie za wczesnie - BarWspol := (Czas.MidBeat - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - BarFrom)) / BarFrom; - Rec.Left := NR.Left + BarWspol * - // (NR.WMid - Czesci[0].Czesc[Czesci[0].Akt].LyricWidth / 2 * FS - 50); - (ScreenSingModi.LyricMain.ClientX - NR.Left - 50) + 10*ScreenX; - Rec.Right := Rec.Left + 50; - Rec.Top := Skin_LyricsT + 3; - Rec.Bottom := Rec.Top + 33;//SingScreen.LyricMain.Size * 3; -{ // zapalanie - BarAlpha := (BarWspol*10) * 0.5; - if BarAlpha > 0.5 then BarAlpha := 0.5; - - // gaszenie - if BarWspol > 0.95 then BarAlpha := 0.5 * (1 - (BarWspol - 0.95) * 20);} - - //Change fuer Crazy Joker - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, Tex_Lyric_Help_Bar.TexNum); - glBegin(GL_QUADS); - glColor4f(1, 1, 1, 0); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glColor4f(1, 1, 1, 0.5); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - glDisable(GL_BLEND); + (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat > 0) and // przed tekstem + (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat < 40) then begin // ale nie za wczesnie + BarWspol := (Czas.MidBeat - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - BarFrom)) / BarFrom; + Rec.Left := NR.Left + BarWspol * (ScreenSingModi.LyricMain.ClientX - NR.Left - 50) + 10*ScreenX; + Rec.Right := Rec.Left + 50; + Rec.Top := Skin_LyricsT + 3; + Rec.Bottom := Rec.Top + 33;//SingScreen.LyricMain.Size * 3; + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_Lyric_Help_Bar.TexNum); + glBegin(GL_QUADS); + glColor4f(1, 1, 1, 0); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glColor4f(1, 1, 1, 0.5); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + glDisable(GL_BLEND); end; - // oscilloscope + // oscilloscope | the thing that moves when you yell into your mic (imho) if (((Ini.Oscilloscope = 1) AND (DLLMan.Selected.ShowRateBar_O)) AND (NOT DLLMan.Selected.ShowRateBar)) then begin if PlayersPlay = 1 then if PlayerInfo.Playerinfo[0].Enabled then @@ -1138,80 +1029,69 @@ begin end //SingBar Mod - // was fürn sinn hattn der quark hier? + // seems like we don't want the flicker thing, we want the linebonus rating bar beneath the scores else if ((Ini.Oscilloscope = 2) AND (DLLMan.Selected.ShowRateBar_O)) OR (DLLMan.Selected.ShowRateBar) then begin A := GetTickCount div 33; if A <> Tickold then begin Tickold := A; for E := 0 to (PlayersPlay - 1) do begin //Set new Pos + Alpha I := Player[E].ScorePercentTarget - Player[E].ScorePercent; - if I > 0 then Inc(Player[E].ScorePercent) - else if I < 0 then Dec(Player[E].ScorePercent); + if I > 0 then Inc(Player[E].ScorePercent) + else if I < 0 then Dec(Player[E].ScorePercent); end; //for end; //if + if PlayersPlay = 1 then begin if PlayerInfo.Playerinfo[0].Enabled then - //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP1SingBar.x, Theme.Sing.StaticP1SingBar.y, Theme.Sing.StaticP1SingBar.w, Theme.Sing.StaticP1SingBar.h , Player[0].ScorePercent); - end; + end; + if PlayersPlay = 2 then begin if PlayerInfo.Playerinfo[0].Enabled then - //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); if PlayerInfo.Playerinfo[1].Enabled then - //SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); - end; + end; + if PlayersPlay = 3 then begin if PlayerInfo.Playerinfo[0].Enabled then - //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); if PlayerInfo.Playerinfo[1].Enabled then - //SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); if PlayerInfo.Playerinfo[2].Enabled then - //SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); end; + if PlayersPlay = 4 then begin if ScreenAct = 1 then begin if PlayerInfo.Playerinfo[0].Enabled then - //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); if PlayerInfo.Playerinfo[1].Enabled then - //SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); end; if ScreenAct = 2 then begin if PlayerInfo.Playerinfo[2].Enabled then - //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[2].ScorePercent); if PlayerInfo.Playerinfo[3].Enabled then - //SingDrawSingbar(620 + 10*ScreenX, 95, 100, 8, Player[3].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[3].ScorePercent); end; end; + if PlayersPlay = 6 then begin if ScreenAct = 1 then begin if PlayerInfo.Playerinfo[0].Enabled then - //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[0].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); if PlayerInfo.Playerinfo[1].Enabled then - //SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[1].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); if PlayerInfo.Playerinfo[2].Enabled then - //SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[2].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); end; if ScreenAct = 2 then begin if PlayerInfo.Playerinfo[3].Enabled then - //SingDrawSingbar( 75 + 10*ScreenX, 95, 100, 8, Player[3].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[3].ScorePercent); if PlayerInfo.Playerinfo[4].Enabled then - //SingDrawSingbar(370 + 10*ScreenX, 95, 100, 8, Player[4].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[4].ScorePercent); if PlayerInfo.Playerinfo[5].Enabled then - //SingDrawSingbar(670 + 10*ScreenX, 95, 100, 8, Player[5].ScorePercent); SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[5].ScorePercent); end; end; @@ -1227,43 +1107,42 @@ begin //Change Alpha Player[E].LineBonus_Alpha := Player[E].LineBonus_Alpha - 0.02; - if Player[E].LineBonus_Alpha <= 0 then begin - Player[E].LineBonus_Age := 0; - Player[E].LineBonus_Visible := False - + Player[E].LineBonus_Age := 0; + Player[E].LineBonus_Visible := False end else - begin - inc(Player[E].LineBonus_Age, 1); - - //Change Position - if (Player[E].LineBonus_PosX < Player[E].LineBonus_TargetX) then - Player[E].LineBonus_PosX := Player[E].LineBonus_PosX + (2 - Player[E].LineBonus_Alpha * 1.5) - else if (Player[E].LineBonus_PosX > Player[E].LineBonus_TargetX) then - Player[E].LineBonus_PosX := Player[E].LineBonus_PosX - (2 - Player[E].LineBonus_Alpha * 1.5); - - if (Player[E].LineBonus_PosY < Player[E].LineBonus_TargetY) then - Player[E].LineBonus_PosY := Player[E].LineBonus_PosY + (2 - Player[E].LineBonus_Alpha * 1.5) - else if (Player[E].LineBonus_PosY > Player[E].LineBonus_TargetY) then - Player[E].LineBonus_PosY := Player[E].LineBonus_PosY - (2 - Player[E].LineBonus_Alpha * 1.5); - - end; - end; - end; //if - - if PlayersPlay = 1 then begin + begin + inc(Player[E].LineBonus_Age, 1); + //Change Position + if (Player[E].LineBonus_PosX < Player[E].LineBonus_TargetX) then // pop up has not yet reached it's position -> blend in + Player[E].LineBonus_PosX := Player[E].LineBonus_PosX + (2 - Player[E].LineBonus_Alpha * 1.5) + else if (Player[E].LineBonus_PosX > Player[E].LineBonus_TargetX) then // pop up has reached it's position -> blend out + Player[E].LineBonus_PosX := Player[E].LineBonus_PosX - (2 - Player[E].LineBonus_Alpha * 1.5); + + if (Player[E].LineBonus_PosY < Player[E].LineBonus_TargetY) then + Player[E].LineBonus_PosY := Player[E].LineBonus_PosY + (2 - Player[E].LineBonus_Alpha * 1.5) + else if (Player[E].LineBonus_PosY > Player[E].LineBonus_TargetY) then + Player[E].LineBonus_PosY := Player[E].LineBonus_PosY - (2 - Player[E].LineBonus_Alpha * 1.5); + + end; // pop up still visible, has not reached it's position - move it + end; // loop through all players + end; // if it's time to draw them + + if PlayersPlay = 1 then begin if PlayerInfo.Playerinfo[0].Enabled then SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - end - else if PlayersPlay = 2 then begin + end + + else if PlayersPlay = 2 then begin if PlayerInfo.Playerinfo[0].Enabled then SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); if PlayerInfo.Playerinfo[1].Enabled then SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - end - else if PlayersPlay = 3 then begin + end + + else if PlayersPlay = 3 then begin if PlayerInfo.Playerinfo[0].Enabled then SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); if PlayerInfo.Playerinfo[1].Enabled then @@ -1271,7 +1150,8 @@ begin if PlayerInfo.Playerinfo[2].Enabled then SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); end - else if PlayersPlay = 4 then begin + + else if PlayersPlay = 4 then begin if ScreenAct = 1 then begin if PlayerInfo.Playerinfo[0].Enabled then SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); @@ -1285,6 +1165,7 @@ begin SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); end; end; + if PlayersPlay = 6 then begin if ScreenAct = 1 then begin if PlayerInfo.Playerinfo[0].Enabled then @@ -1304,11 +1185,9 @@ begin end; end; end; - //PhrasenBonus - Line Bonus Mod End - +//PhrasenBonus - Line Bonus Mod End - // rysuje paski -// Log.LogStatus('Original notes', 'SingDraw'); +// resize the notes according to the difficulty level case Ini.Difficulty of 0: begin @@ -1518,11 +1397,11 @@ begin; end; //end Singbar Mod -//PhrasenBonus - Line Bonus Mod +//PhrasenBonus - Line Bonus Pop Up procedure SingDrawLineBonus( const X, Y: Single; Color: TRGB; Alpha: Single; Text: string; Age: Integer); var Length, X2: Real; //Length of Text -Size: Integer; //Size of Popup +Size: Integer; //Size of Popup begin if Alpha <> 0 then begin @@ -1542,14 +1421,17 @@ SetFontPos (X + 50 - (Length / 2), Y + 12); //Position if Age < 5 then Size := Age * 10 else Size := 50; //Draw Background - glColor4f(Color.R, Color.G, Color.B, Alpha); //Set Color + //glColor4f(Color.R, Color.G, Color.B, Alpha); //Set Color + glColor4f(1, 1, 1, Alpha); + + glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); //New Method, Not Variable - glBindTexture(GL_TEXTURE_2D, Tex_SingLineBonusBack.TexNum); + glBindTexture(GL_TEXTURE_2D, Tex_SingLineBonusBack[2]); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex2f(X + 50 - Size, Y + 25 - (Size/2)); diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index a79a16a2..79f82438 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -80,13 +80,17 @@ var ScreenPopupError: TScreenPopupError; //Notes - Tex_Left: array[0..6] of TTexture; - Tex_Mid: array[0..6] of TTexture; - Tex_Right: array[0..6] of TTexture; + Tex_Left: array[0..6] of TTexture; //rename to tex_note_left + Tex_Mid: array[0..6] of TTexture; //rename to tex_note_mid + Tex_Right: array[0..6] of TTexture; //rename to tex_note_right - Tex_BG_Left: array[1..6] of TTexture; - Tex_BG_Mid: array[1..6] of TTexture; - Tex_BG_Right: array[1..6] of TTexture; + Tex_plain_Left: array[1..6] of TTexture; //rename to tex_notebg_left + Tex_plain_Mid: array[1..6] of TTexture; //rename to tex_notebg_mid + Tex_plain_Right: array[1..6] of TTexture; //rename to tex_notebg_right + + Tex_BG_Left: array[1..6] of TTexture; //rename to tex_noteglow_left + Tex_BG_Mid: array[1..6] of TTexture; //rename to tex_noteglow_mid + Tex_BG_Right: array[1..6] of TTexture; //rename to tex_noteglow_right Tex_Note_Star: TTexture; Tex_Note_Perfect_Star: TTexture; @@ -105,7 +109,7 @@ var //end Singbar Mod //PhrasenBonus - Line Bonus Mod - Tex_SingLineBonusBack: TTexture; + Tex_SingLineBonusBack: array[0..8] of TTexture; //End PhrasenBonus - Line Bonus Mod const @@ -194,21 +198,25 @@ var begin // zaladowanie tekstur Log.LogStatus('Loading Textures', 'LoadTextures'); - Tex_Left[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'BMP', 'Transparent', 0); - Tex_Mid[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'BMP', 'Plain', 0); - Tex_Right[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'BMP', 'Transparent', 0); + Tex_Left[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'BMP', 'Transparent', 0); //brauch man die noch? + Tex_Mid[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'BMP', 'Plain', 0); //brauch man die noch? + Tex_Right[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'BMP', 'Transparent', 0); //brauch man die noch? // P1-6 for P := 1 to 6 do begin LoadColor(R, G, B, 'P' + IntToStr(P) + 'Light'); Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); - Tex_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'BMP', 'Note Transparent', Col); - Tex_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'BMP', 'Note Plain', Col); - Tex_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'BMP', 'Note Transparent', Col); + Tex_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'PNG', 'Colorized', Col); + Tex_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'PNG', 'Colorized', Col); + Tex_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'PNG', 'Colorized', Col); + + Tex_plain_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainLeft')), 'PNG', 'Colorized', Col); + Tex_plain_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainMid')), 'PNG', 'Colorized', Col); + Tex_plain_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainRight')), 'PNG', 'Colorized', Col); - Tex_BG_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGLeft')), 'BMP', 'Alpha Black Colored', Col); - Tex_BG_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGMid')), 'BMP', 'Alpha Black Colored', Col); - Tex_BG_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGRight')), 'BMP', 'Alpha Black Colored', Col); + Tex_BG_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGLeft')), 'PNG', 'Colorized', Col); + Tex_BG_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGMid')), 'PNG', 'Colorized', Col); + Tex_BG_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGRight')), 'PNG', 'Colorized', Col); end; Tex_Note_Perfect_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePerfectStar')), 'JPG', 'Font Black', 0); @@ -227,8 +235,11 @@ begin Tex_SingBar_Front := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarFront')), 'JPG', 'Font', 0); //end Singbar Mod - //PhrasenBonus - Line Bonus Mod - Tex_SingLineBonusBack := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LineBonusBack')), 'JPG', 'Font Black', 0); + //Line Bonus PopUp + for P := 0 to 9 do + begin + Tex_SingLineBonusBack[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LineBonusBack')), 'PNG', 'Colorized', $FFFFFF); + end; {//Set Texture to Font High Tex_SingLineBonusL.H := 32; Tex_SingLineBonusL.W := 8; Tex_SingLineBonusM.H := 32; //Tex_SingLineBonusM.TexW := Tex_SingLineBonusM.TexW/2; diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 3a1c9dd4..98e1acb4 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -33,7 +33,7 @@ type LineBonus_Text: string; LineBonus_Color: TRGB; LineBonus_Age: Integer; - + LineBonus_Rating: Integer; //Variable vor Positioning -> Set on ScreenShow, different when Playercount Changes LineBonus_TargetX: integer; LineBonus_TargetY: integer; diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index b55a84dc..b883363f 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -12,65 +12,6 @@ type B: single; end; - {TSkin = record - GrayLeft: string; - GrayMid: string; - GrayRight: string; - - NoteBGLeft: string; - NoteBGMid: string; - NoteBGRight: string; - - NoteStar: string; - - Ball: string; - - - - //SingBar Mod - SingBarBack: string; - SingBarBar: string; - SingBarFront: string; - //end Singbar Mod - - //PhrasenBonus - Line Bonus Mod - SingLineBonusBack: string; - //PhrasenBonus - Line Bonus Mod - - - - WelcomeBG: string; - - Background: string; - ScoreBG: string; - MainStart: string; - MainEditor: string; - MainOptions: string; - MainExit: string; - MainBar: string; - Cursor: string; - - SongFade: string; - SongCover: string; - SongSelection: string; - - SelectSong: string; - Button: string; - Bar: string; - P: string; - Arrow: string; - Arrow2: string; - ButtonF: string; - Star: string; - Line: string; - -// ThemePath: string; - SkinReg: boolean; - SkinName: string; - SkinPath: string; - SkinColor: integer; - end;} - TThemeBackground = record Tex: string; end; @@ -315,7 +256,7 @@ type //TimeBar mod StaticTimeProgress: TThemeStatic; - TextTimeText : TThemeText; + TextTimeText : TThemeText; //eoa TimeBar mod StaticP1: TThemeStatic; @@ -838,60 +779,6 @@ begin LoadTheme(FileName, Color); - - {Skin.GrayLeft := 'Left Gray.bmp'; - Skin.GrayMid := 'Mid Gray.bmp'; - Skin.GrayRight := 'Right Gray.bmp'; - - Skin.NoteBGLeft := 'Note BG Left.bmp'; - Skin.NoteBGMid := 'Note BG Mid.bmp'; - Skin.NoteBGRight := 'Note BG Right.bmp'; - - Skin.NoteStar := 'Note Star.jpg'; - - - - //SingBar Mod - Skin.SingBarBack := 'Sing Bar Back.jpg'; - Skin.SingBarBar := 'Sing Bar Bar.jpg'; - Skin.SingBarFront := 'Sing Bar Front.jpg'; - //end Singbar Mod - - //PhrasenBonus - Line Bonus Mod - Skin.SingLineBonusBack := 'Line Bonus PopUp.jpg'; - - - - -{ Skin.WelcomeBG := SkinPath + 'Welcome BG.jpg'; -// Skin.Background := SkinPath + 'Background.jpg'; - Skin.ScoreBG := SkinPath + 'Score BG.jpg'; -// Skin.GameStart := SkinPath + 'Game Start.jpg'; -// Skin.Editor := SkinPath + 'Editor.jpg'; -// Skin.Options := SkinPath + 'Options.jpg'; -// Skin.Exit := SkinPath + 'Exit.jpg'; - - Skin.MainStart := SkinPath + 'Main Solo.jpg'; - Skin.MainEditor := SkinPath + 'Main Multi.jpg'; - Skin.MainOptions := SkinPath + 'Main Options.jpg'; - Skin.MainExit := SkinPath + 'Main Exit.jpg'; - Skin.MainBar := SkinPath + 'Main Bar.jpg'; - Skin.Cursor := SkinPath + 'Main Cursor.jpg'; - - Skin.SongFade := SkinPath + 'Song Fade.jpg';}{ - Skin.SongCover := 'Song Cover.jpg'; - {Skin.SongSelection := SkinPath + 'Song Selection.jpg'; - - Skin.SelectSong := SkinPath + 'Select Song.jpg';}{ -// Skin.Button := SkinPath + 'MusicWheelItem song.jpg'; - Skin.Bar := 'Bar.jpg'; -{ Skin.P := SkinPath + 'P.jpg'; - Skin.Arrow := SkinPath + 'Arrow.jpg'; - Skin.Arrow2 := SkinPath + 'Arrow 2.jpg';}{ - Skin.ButtonF := 'Button.jpg'; - Skin.Ball := 'Ball3.bmp'; -{ Skin.Star := SkinPath + 'Star.bmp'; - Skin.Line := SkinPath + 'Line.jpg';} end; @@ -1144,51 +1031,51 @@ begin ThemeLoadText(Score.TextArtistTitle, 'ScoreTextArtistTitle'); for I := 1 to 6 do begin - ThemeLoadStatics(Score.PlayerStatic[I], 'ScorePlayer' + IntToStr(I) + 'Static'); - ThemeLoadTexts(Score.PlayerTexts[I], 'ScorePlayer' + IntToStr(I) + 'Text'); - - ThemeLoadText(Score.TextName[I], 'ScoreTextName' + IntToStr(I)); - ThemeLoadText(Score.TextScore[I], 'ScoreTextScore' + IntToStr(I)); - ThemeLoadText(Score.TextNotes[I], 'ScoreTextNotes' + IntToStr(I)); - ThemeLoadText(Score.TextNotesScore[I], 'ScoreTextNotesScore' + IntToStr(I)); - ThemeLoadText(Score.TextLineBonus[I], 'ScoreTextLineBonus' + IntToStr(I)); - ThemeLoadText(Score.TextLineBonusScore[I], 'ScoreTextLineBonusScore' + IntToStr(I)); - ThemeLoadText(Score.TextGoldenNotes[I], 'ScoreTextGoldenNotes' + IntToStr(I)); - ThemeLoadText(Score.TextGoldenNotesScore[I], 'ScoreTextGoldenNotesScore' + IntToStr(I)); - ThemeLoadText(Score.TextTotal[I], 'ScoreTextTotal' + IntToStr(I)); - ThemeLoadText(Score.TextTotalScore[I], 'ScoreTextTotalScore' + IntToStr(I)); - - ThemeLoadStatic(Score.StaticBoxLightest[I], 'ScoreStaticBoxLightest' + IntToStr(I)); - ThemeLoadStatic(Score.StaticBoxLight[I], 'ScoreStaticBoxLight' + IntToStr(I)); - ThemeLoadStatic(Score.StaticBoxDark[I], 'ScoreStaticBoxDark' + IntToStr(I)); - - ThemeLoadStatic(Score.StaticBackLevel[I], 'ScoreStaticBackLevel' + IntToStr(I)); + ThemeLoadStatics(Score.PlayerStatic[I], 'ScorePlayer' + IntToStr(I) + 'Static'); + ThemeLoadTexts(Score.PlayerTexts[I], 'ScorePlayer' + IntToStr(I) + 'Text'); + + ThemeLoadText(Score.TextName[I], 'ScoreTextName' + IntToStr(I)); + ThemeLoadText(Score.TextScore[I], 'ScoreTextScore' + IntToStr(I)); + ThemeLoadText(Score.TextNotes[I], 'ScoreTextNotes' + IntToStr(I)); + ThemeLoadText(Score.TextNotesScore[I], 'ScoreTextNotesScore' + IntToStr(I)); + ThemeLoadText(Score.TextLineBonus[I], 'ScoreTextLineBonus' + IntToStr(I)); + ThemeLoadText(Score.TextLineBonusScore[I], 'ScoreTextLineBonusScore' + IntToStr(I)); + ThemeLoadText(Score.TextGoldenNotes[I], 'ScoreTextGoldenNotes' + IntToStr(I)); + ThemeLoadText(Score.TextGoldenNotesScore[I], 'ScoreTextGoldenNotesScore' + IntToStr(I)); + ThemeLoadText(Score.TextTotal[I], 'ScoreTextTotal' + IntToStr(I)); + ThemeLoadText(Score.TextTotalScore[I], 'ScoreTextTotalScore' + IntToStr(I)); + + ThemeLoadStatic(Score.StaticBoxLightest[I], 'ScoreStaticBoxLightest' + IntToStr(I)); + ThemeLoadStatic(Score.StaticBoxLight[I], 'ScoreStaticBoxLight' + IntToStr(I)); + ThemeLoadStatic(Score.StaticBoxDark[I], 'ScoreStaticBoxDark' + IntToStr(I)); + + ThemeLoadStatic(Score.StaticBackLevel[I], 'ScoreStaticBackLevel' + IntToStr(I)); ThemeLoadStatic(Score.StaticBackLevelRound[I], 'ScoreStaticBackLevelRound' + IntToStr(I)); - ThemeLoadStatic(Score.StaticLevel[I], 'ScoreStaticLevel' + IntToStr(I)); - ThemeLoadStatic(Score.StaticLevelRound[I], 'ScoreStaticLevelRound' + IntToStr(I)); + ThemeLoadStatic(Score.StaticLevel[I], 'ScoreStaticLevel' + IntToStr(I)); + ThemeLoadStatic(Score.StaticLevelRound[I], 'ScoreStaticLevelRound' + IntToStr(I)); end; // Top5 ThemeLoadBasic(Top5, 'Top5'); - ThemeLoadText(Top5.TextLevel, 'Top5TextLevel'); + ThemeLoadText(Top5.TextLevel, 'Top5TextLevel'); ThemeLoadText(Top5.TextArtistTitle, 'Top5TextArtistTitle'); ThemeLoadStatics(Top5.StaticNumber, 'Top5StaticNumber'); - ThemeLoadTexts(Top5.TextNumber, 'Top5TextNumber'); - ThemeLoadTexts(Top5.TextName, 'Top5TextName'); - ThemeLoadTexts(Top5.TextScore, 'Top5TextScore'); + ThemeLoadTexts(Top5.TextNumber, 'Top5TextNumber'); + ThemeLoadTexts(Top5.TextName, 'Top5TextName'); + ThemeLoadTexts(Top5.TextScore, 'Top5TextScore'); // Options ThemeLoadBasic(Options, 'Options'); - ThemeLoadButton(Options.ButtonGame, 'OptionsButtonGame'); + ThemeLoadButton(Options.ButtonGame, 'OptionsButtonGame'); ThemeLoadButton(Options.ButtonGraphics, 'OptionsButtonGraphics'); - ThemeLoadButton(Options.ButtonSound, 'OptionsButtonSound'); - ThemeLoadButton(Options.ButtonLyrics, 'OptionsButtonLyrics'); - ThemeLoadButton(Options.ButtonThemes, 'OptionsButtonThemes'); - ThemeLoadButton(Options.ButtonRecord, 'OptionsButtonRecord'); + ThemeLoadButton(Options.ButtonSound, 'OptionsButtonSound'); + ThemeLoadButton(Options.ButtonLyrics, 'OptionsButtonLyrics'); + ThemeLoadButton(Options.ButtonThemes, 'OptionsButtonThemes'); + ThemeLoadButton(Options.ButtonRecord, 'OptionsButtonRecord'); ThemeLoadButton(Options.ButtonAdvanced, 'OptionsButtonAdvanced'); - ThemeLoadButton(Options.ButtonExit, 'OptionsButtonExit'); + ThemeLoadButton(Options.ButtonExit, 'OptionsButtonExit'); {{$IFDEF TRANSLATE} Options.Description[0] := Language.Translate('SING_OPTIONS_GAME'); @@ -1207,32 +1094,32 @@ begin // Options Game ThemeLoadBasic(OptionsGame, 'OptionsGame'); - ThemeLoadSelect(OptionsGame.SelectPlayers, 'OptionsGameSelectPlayers'); - ThemeLoadSelect(OptionsGame.SelectDifficulty, 'OptionsGameSelectDifficulty'); + ThemeLoadSelect(OptionsGame.SelectPlayers, 'OptionsGameSelectPlayers'); + ThemeLoadSelect(OptionsGame.SelectDifficulty, 'OptionsGameSelectDifficulty'); ThemeLoadSelectSlide(OptionsGame.SelectLanguage, 'OptionsGameSelectSlideLanguage'); - ThemeLoadSelect(OptionsGame.SelectTabs, 'OptionsGameSelectTabs'); - ThemeLoadSelectSlide(OptionsGame.SelectSorting, 'OptionsGameSelectSlideSorting'); - ThemeLoadSelect(OptionsGame.SelectDebug, 'OptionsGameSelectDebug'); - ThemeLoadButton(OptionsGame.ButtonExit, 'OptionsGameButtonExit'); + ThemeLoadSelect(OptionsGame.SelectTabs, 'OptionsGameSelectTabs'); + ThemeLoadSelectSlide(OptionsGame.SelectSorting, 'OptionsGameSelectSlideSorting'); + ThemeLoadSelect(OptionsGame.SelectDebug, 'OptionsGameSelectDebug'); + ThemeLoadButton(OptionsGame.ButtonExit, 'OptionsGameButtonExit'); // Options Graphics ThemeLoadBasic(OptionsGraphics, 'OptionsGraphics'); - ThemeLoadSelect(OptionsGraphics.SelectFullscreen, 'OptionsGraphicsSelectFullscreen'); + ThemeLoadSelect(OptionsGraphics.SelectFullscreen, 'OptionsGraphicsSelectFullscreen'); ThemeLoadSelectSlide(OptionsGraphics.SelectSlideResolution, 'OptionsGraphicsSelectSlideResolution'); - ThemeLoadSelect(OptionsGraphics.SelectDepth, 'OptionsGraphicsSelectDepth'); - ThemeLoadSelect(OptionsGraphics.SelectOscilloscope, 'OptionsGraphicsSelectOscilloscope'); - ThemeLoadSelect(OptionsGraphics.SelectLineBonus, 'OptionsGraphicsSelectLineBonus'); - ThemeLoadSelect(OptionsGraphics.SelectMovieSize, 'OptionsGraphicsSelectMovieSize'); - ThemeLoadButton(OptionsGraphics.ButtonExit, 'OptionsGraphicsButtonExit'); + ThemeLoadSelect(OptionsGraphics.SelectDepth, 'OptionsGraphicsSelectDepth'); + ThemeLoadSelect(OptionsGraphics.SelectOscilloscope, 'OptionsGraphicsSelectOscilloscope'); + ThemeLoadSelect(OptionsGraphics.SelectLineBonus, 'OptionsGraphicsSelectLineBonus'); + ThemeLoadSelect(OptionsGraphics.SelectMovieSize, 'OptionsGraphicsSelectMovieSize'); + ThemeLoadButton(OptionsGraphics.ButtonExit, 'OptionsGraphicsButtonExit'); // Options Sound ThemeLoadBasic(OptionsSound, 'OptionsSound'); - ThemeLoadSelect(OptionsSound.SelectMicBoost, 'OptionsSoundSelectMicBoost'); + ThemeLoadSelect(OptionsSound.SelectMicBoost, 'OptionsSoundSelectMicBoost'); ThemeLoadSelect(OptionsSound.SelectClickAssist, 'OptionsSoundSelectClickAssist'); - ThemeLoadSelect(OptionsSound.SelectBeatClick, 'OptionsSoundSelectBeatClick'); - ThemeLoadSelect(OptionsSound.SelectThreshold, 'OptionsSoundSelectThreshold'); + ThemeLoadSelect(OptionsSound.SelectBeatClick, 'OptionsSoundSelectBeatClick'); + ThemeLoadSelect(OptionsSound.SelectThreshold, 'OptionsSoundSelectThreshold'); //Song Preview ThemeLoadSelectSlide(OptionsSound.SelectSlidePreviewVolume, 'OptionsSoundSelectSlidePreviewVolume'); ThemeLoadSelectSlide(OptionsSound.SelectSlidePreviewFading, 'OptionsSoundSelectSlidePreviewFading'); @@ -1242,39 +1129,39 @@ begin // Options Lyrics ThemeLoadBasic(OptionsLyrics, 'OptionsLyrics'); - ThemeLoadSelect(OptionsLyrics.SelectLyricsFont, 'OptionsLyricsSelectLyricsFont'); + ThemeLoadSelect(OptionsLyrics.SelectLyricsFont, 'OptionsLyricsSelectLyricsFont'); ThemeLoadSelect(OptionsLyrics.SelectLyricsEffect, 'OptionsLyricsSelectLyricsEffect'); - ThemeLoadSelect(OptionsLyrics.SelectSolmization, 'OptionsLyricsSelectSolmization'); - ThemeLoadButton(OptionsLyrics.ButtonExit, 'OptionsLyricsButtonExit'); + ThemeLoadSelect(OptionsLyrics.SelectSolmization, 'OptionsLyricsSelectSolmization'); + ThemeLoadButton(OptionsLyrics.ButtonExit, 'OptionsLyricsButtonExit'); // Options Themes ThemeLoadBasic(OptionsThemes, 'OptionsThemes'); ThemeLoadSelectSlide(OptionsThemes.SelectTheme, 'OptionsThemesSelectTheme'); - ThemeLoadSelectSlide(OptionsThemes.SelectSkin, 'OptionsThemesSelectSkin'); + ThemeLoadSelectSlide(OptionsThemes.SelectSkin, 'OptionsThemesSelectSkin'); ThemeLoadSelectSlide(OptionsThemes.SelectColor, 'OptionsThemesSelectColor'); - ThemeLoadButton(OptionsThemes.ButtonExit, 'OptionsThemesButtonExit'); + ThemeLoadButton(OptionsThemes.ButtonExit, 'OptionsThemesButtonExit'); // Options Record ThemeLoadBasic(OptionsRecord, 'OptionsRecord'); - ThemeLoadSelectSlide(OptionsRecord.SelectSlideCard, 'OptionsRecordSelectSlideCard'); - ThemeLoadSelectSlide(OptionsRecord.SelectSlideInput, 'OptionsRecordSelectSlideInput'); + ThemeLoadSelectSlide(OptionsRecord.SelectSlideCard, 'OptionsRecordSelectSlideCard'); + ThemeLoadSelectSlide(OptionsRecord.SelectSlideInput, 'OptionsRecordSelectSlideInput'); ThemeLoadSelectSlide(OptionsRecord.SelectSlideChannelL, 'OptionsRecordSelectSlideChannelL'); ThemeLoadSelectSlide(OptionsRecord.SelectSlideChannelR, 'OptionsRecordSelectSlideChannelR'); - ThemeLoadButton(OptionsRecord.ButtonExit, 'OptionsRecordButtonExit'); + ThemeLoadButton(OptionsRecord.ButtonExit, 'OptionsRecordButtonExit'); //Options Advanced ThemeLoadBasic(OptionsAdvanced, 'OptionsAdvanced'); ThemeLoadSelect (OptionsAdvanced.SelectLoadAnimation, 'OptionsAdvancedSelectLoadAnimation'); - ThemeLoadSelect (OptionsAdvanced.SelectScreenFade, 'OptionsAdvancedSelectScreenFade'); - ThemeLoadSelect (OptionsAdvanced.SelectEffectSing, 'OptionsAdvancedSelectEffectSing'); - ThemeLoadSelect (OptionsAdvanced.SelectLineBonus, 'OptionsAdvancedSelectLineBonus'); - ThemeLoadSelectSlide (OptionsAdvanced.SelectOnSongClick, 'OptionsAdvancedSelectSlideOnSongClick'); - ThemeLoadSelect (OptionsAdvanced.SelectAskbeforeDel, 'OptionsAdvancedSelectAskbeforeDel'); - ThemeLoadSelect (OptionsAdvanced.SelectPartyPopup, 'OptionsAdvancedSelectPartyPopup'); - ThemeLoadButton (OptionsAdvanced.ButtonExit, 'OptionsAdvancedButtonExit'); + ThemeLoadSelect (OptionsAdvanced.SelectScreenFade, 'OptionsAdvancedSelectScreenFade'); + ThemeLoadSelect (OptionsAdvanced.SelectEffectSing, 'OptionsAdvancedSelectEffectSing'); + ThemeLoadSelect (OptionsAdvanced.SelectLineBonus, 'OptionsAdvancedSelectLineBonus'); + ThemeLoadSelectSlide (OptionsAdvanced.SelectOnSongClick, 'OptionsAdvancedSelectSlideOnSongClick'); + ThemeLoadSelect (OptionsAdvanced.SelectAskbeforeDel, 'OptionsAdvancedSelectAskbeforeDel'); + ThemeLoadSelect (OptionsAdvanced.SelectPartyPopup, 'OptionsAdvancedSelectPartyPopup'); + ThemeLoadButton (OptionsAdvanced.ButtonExit, 'OptionsAdvancedButtonExit'); //error and check popup ThemeLoadBasic (ErrorPopup, 'ErrorPopup'); @@ -1381,41 +1268,41 @@ begin //Load Party Score DecoTextures Object PartyScore.DecoTextures.ChangeTextures := (ThemeIni.ReadInteger('PartyScoreDecoTextures', 'ChangeTextures', 0) = 1); - PartyScore.DecoTextures.FirstTexture := ThemeIni.ReadString('PartyScoreDecoTextures', 'FirstTexture', ''); - PartyScore.DecoTextures.FirstTyp := ThemeIni.ReadString('PartyScoreDecoTextures', 'FirstTyp', 'Note Black'); - PartyScore.DecoTextures.FirstColor := ThemeIni.ReadString('PartyScoreDecoTextures', 'FirstColor', 'Black'); + PartyScore.DecoTextures.FirstTexture := ThemeIni.ReadString('PartyScoreDecoTextures', 'FirstTexture', ''); + PartyScore.DecoTextures.FirstTyp := ThemeIni.ReadString('PartyScoreDecoTextures', 'FirstTyp', 'Note Black'); + PartyScore.DecoTextures.FirstColor := ThemeIni.ReadString('PartyScoreDecoTextures', 'FirstColor', 'Black'); - PartyScore.DecoTextures.SecondTexture := ThemeIni.ReadString('PartyScoreDecoTextures', 'SecondTexture', ''); - PartyScore.DecoTextures.SecondTyp := ThemeIni.ReadString('PartyScoreDecoTextures', 'SecondTyp', 'Note Black'); - PartyScore.DecoTextures.SecondColor := ThemeIni.ReadString('PartyScoreDecoTextures', 'SecondColor', 'Black'); + PartyScore.DecoTextures.SecondTexture := ThemeIni.ReadString('PartyScoreDecoTextures', 'SecondTexture', ''); + PartyScore.DecoTextures.SecondTyp := ThemeIni.ReadString('PartyScoreDecoTextures', 'SecondTyp', 'Note Black'); + PartyScore.DecoTextures.SecondColor := ThemeIni.ReadString('PartyScoreDecoTextures', 'SecondColor', 'Black'); - PartyScore.DecoTextures.ThirdTexture := ThemeIni.ReadString('PartyScoreDecoTextures', 'ThirdTexture', ''); - PartyScore.DecoTextures.ThirdTyp := ThemeIni.ReadString('PartyScoreDecoTextures', 'ThirdTyp', 'Note Black'); - PartyScore.DecoTextures.ThirdColor := ThemeIni.ReadString('PartyScoreDecoTextures', 'ThirdColor', 'Black'); + PartyScore.DecoTextures.ThirdTexture := ThemeIni.ReadString('PartyScoreDecoTextures', 'ThirdTexture', ''); + PartyScore.DecoTextures.ThirdTyp := ThemeIni.ReadString('PartyScoreDecoTextures', 'ThirdTyp', 'Note Black'); + PartyScore.DecoTextures.ThirdColor := ThemeIni.ReadString('PartyScoreDecoTextures', 'ThirdColor', 'Black'); ThemeLoadText (PartyScore.TextWinner, 'PartyScoreTextWinner'); //Party Win ThemeLoadBasic(PartyWin, 'PartyWin'); - ThemeLoadText (PartyWin.TextScoreTeam1, 'PartyWinTextScoreTeam1'); - ThemeLoadText (PartyWin.TextScoreTeam2, 'PartyWinTextScoreTeam2'); - ThemeLoadText (PartyWin.TextScoreTeam3, 'PartyWinTextScoreTeam3'); - ThemeLoadText (PartyWin.TextNameTeam1, 'PartyWinTextNameTeam1'); - ThemeLoadText (PartyWin.TextNameTeam2, 'PartyWinTextNameTeam2'); - ThemeLoadText (PartyWin.TextNameTeam3, 'PartyWinTextNameTeam3'); + ThemeLoadText (PartyWin.TextScoreTeam1, 'PartyWinTextScoreTeam1'); + ThemeLoadText (PartyWin.TextScoreTeam2, 'PartyWinTextScoreTeam2'); + ThemeLoadText (PartyWin.TextScoreTeam3, 'PartyWinTextScoreTeam3'); + ThemeLoadText (PartyWin.TextNameTeam1, 'PartyWinTextNameTeam1'); + ThemeLoadText (PartyWin.TextNameTeam2, 'PartyWinTextNameTeam2'); + ThemeLoadText (PartyWin.TextNameTeam3, 'PartyWinTextNameTeam3'); - ThemeLoadStatic (PartyWin.StaticTeam1, 'PartyWinStaticTeam1'); - ThemeLoadStatic (PartyWin.StaticTeam1BG, 'PartyWinStaticTeam1BG'); + ThemeLoadStatic (PartyWin.StaticTeam1, 'PartyWinStaticTeam1'); + ThemeLoadStatic (PartyWin.StaticTeam1BG, 'PartyWinStaticTeam1BG'); ThemeLoadStatic (PartyWin.StaticTeam1Deco, 'PartyWinStaticTeam1Deco'); - ThemeLoadStatic (PartyWin.StaticTeam2, 'PartyWinStaticTeam2'); - ThemeLoadStatic (PartyWin.StaticTeam2BG, 'PartyWinStaticTeam2BG'); + ThemeLoadStatic (PartyWin.StaticTeam2, 'PartyWinStaticTeam2'); + ThemeLoadStatic (PartyWin.StaticTeam2BG, 'PartyWinStaticTeam2BG'); ThemeLoadStatic (PartyWin.StaticTeam2Deco, 'PartyWinStaticTeam2Deco'); - ThemeLoadStatic (PartyWin.StaticTeam3, 'PartyWinStaticTeam3'); - ThemeLoadStatic (PartyWin.StaticTeam3BG, 'PartyWinStaticTeam3BG'); + ThemeLoadStatic (PartyWin.StaticTeam3, 'PartyWinStaticTeam3'); + ThemeLoadStatic (PartyWin.StaticTeam3BG, 'PartyWinStaticTeam3BG'); ThemeLoadStatic (PartyWin.StaticTeam3Deco, 'PartyWinStaticTeam3Deco'); - ThemeLoadText (PartyWin.TextWinner, 'PartyWinTextWinner'); + ThemeLoadText (PartyWin.TextWinner, 'PartyWinTextWinner'); //Party Options ThemeLoadBasic(PartyOptions, 'PartyOptions'); @@ -1580,11 +1467,11 @@ begin ThemeStatic.X := ThemeIni.ReadInteger(Name, 'X', 0); ThemeStatic.Y := ThemeIni.ReadInteger(Name, 'Y', 0); - ThemeStatic.Z := ThemeIni.ReadFloat(Name, 'Z', 0); + ThemeStatic.Z := ThemeIni.ReadFloat (Name, 'Z', 0); ThemeStatic.W := ThemeIni.ReadInteger(Name, 'W', 0); ThemeStatic.H := ThemeIni.ReadInteger(Name, 'H', 0); - ThemeStatic.Typ := ThemeIni.ReadString(Name, 'Type', ''); + ThemeStatic.Typ := ThemeIni.ReadString(Name, 'Type', ''); ThemeStatic.Color := ThemeIni.ReadString(Name, 'Color', ''); C := ColorExists(ThemeStatic.Color); @@ -1600,7 +1487,7 @@ begin ThemeStatic.TexY2 := ThemeIni.ReadFloat(Name, 'TexY2', 1); //Reflection Mod - ThemeStatic.Reflection := (ThemeIni.ReadInteger(Name, 'Reflection', 0) = 1); + ThemeStatic.Reflection := (ThemeIni.ReadInteger(Name, 'Reflection', 0) = 1); ThemeStatic.ReflectionSpacing := ThemeIni.ReadFloat(Name, 'ReflectionSpacing', 15); DecimalSeparator := ','; @@ -1704,7 +1591,7 @@ begin ThemeButton.SelectW := ThemeIni.ReadInteger (Name, 'SelectW', ThemeButton.W); ThemeButton.DeSelectReflectionspacing := ThemeIni.ReadFloat(Name, 'DeSelectReflectionSpacing', ThemeButton.Reflectionspacing); - + ThemeButton.Fade := (ThemeIni.ReadInteger(Name, 'Fade', 0) = 1); ThemeButton.FadeText := (ThemeIni.ReadInteger(Name, 'FadeText', 0) = 1); @@ -2049,18 +1936,6 @@ begin //New Theme-Color Patch End end; - - // pink -// Col := clRed; -// Color[C].ColR := (32 + Col and $FF) / (255 + 32); -// Color[C].ColG := (32 + Col div 256 and $FF) / (255 + 32); -// Color[C].ColB := (32 + Col div (256*256) and $FF) / (255 + 32); - - // purple -// Color[C].ColR := 220/255; -// Color[C].ColG := 95/255; -// Color[C].ColB := 220/255;} - end; function ColorSqrt(RGB: TRGB): TRGB; diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index deaff447..a5f6a317 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -141,24 +141,34 @@ end; procedure TScreenSing.Pause; begin if not paused then //Pause einschalten - begin - PauseTime := Czas.Teraz; - Paused := true; - //stop Music - Music.Pause; - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then //Video - FFmpegTogglePause;//PauseSmpeg; //Video - end - else //Pause ausschalten - begin - Czas.Teraz := PauseTime; //Position of Notes - Music.MoveTo (PauseTime);//Position of Music - Music.Play; //Play Music - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then //Video - FFmpegTogglePause;//PlaySmpeg; + begin + // pause Time + PauseTime := Czas.Teraz; + Paused := true; + + // pause Music + Music.Pause; + + // pause Video + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + FFmpegTogglePause; + end + else //Pause ausschalten + begin + Czas.Teraz := PauseTime; //Position of Notes + + // Position of Music + Music.MoveTo (PauseTime); + // Play Music + Music.Play; + + // Video + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + FFmpegTogglePause; //SkipSmpeg(PauseTime); - Paused := false; - end; + + Paused := false; + end; end; //Pause Mod End @@ -171,59 +181,60 @@ begin LoadFromTheme(Theme.Sing); - // time - //TextTime := AddText(75, 14, 1, 8, 0.25, 0.25, 0.25, '00:00'); - - //TimeBar mod - StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); - TextTimeText := AddText(Theme.Sing.TextTimeText); - //eoa TimeBar mod - - StaticP1 := AddStatic(Theme.Sing.StaticP1); - StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); - TextP1 := AddText(Theme.Sing.TextP1); - TextP1Score := AddText(Theme.Sing.TextP1Score); - - //moveable singbar mod - StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar); - StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar); - StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); - StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); - StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar); - StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar); - //eoa moveable singbar - - //Added for ps3 skin - //This one is shown in 2/4P mode - StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); - StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG); - TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); - TextP1TwoPScore := AddText(Theme.Sing.TextP1TwoPScore); - - //This one is shown in 3/6P mode - StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); + //TimeBar + StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); + TextTimeText := AddText(Theme.Sing.TextTimeText); + +// 1 player | P1 + StaticP1 := AddStatic(Theme.Sing.StaticP1); + StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); + TextP1 := AddText(Theme.Sing.TextP1); + TextP1Score := AddText(Theme.Sing.TextP1Score); + StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar); + +// 2 or 4 players | P1 + StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); + StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG); + TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); + TextP1TwoPScore := AddText(Theme.Sing.TextP1TwoPScore); + StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); + + // | P2 + StaticP2R := AddStatic(Theme.Sing.StaticP2R); + StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); + TextP2R := AddText(Theme.Sing.TextP2R); + TextP2RScore := AddText(Theme.Sing.TextP2RScore); + StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); + +// 3 or 6 players | P1 + StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); StaticP1ThreePScoreBG := AddStatic(Theme.Sing.StaticP1ThreePScoreBG); - TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); - TextP1ThreePScore := AddText(Theme.Sing.TextP1ThreePScore); - //eoa - - StaticP2R := AddStatic(Theme.Sing.StaticP2R); - StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); - TextP2R := AddText(Theme.Sing.TextP2R); - TextP2RScore := AddText(Theme.Sing.TextP2RScore); - - StaticP2M := AddStatic(Theme.Sing.StaticP2M); - StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG); - TextP2M := AddText(Theme.Sing.TextP2M); - TextP2MScore := AddText(Theme.Sing.TextP2MScore); - - StaticP3R := AddStatic(Theme.Sing.StaticP3R); - StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG); - TextP3R := AddText(Theme.Sing.TextP3R); - TextP3RScore := AddText(Theme.Sing.TextP3RScore); - - LyricMain := TLyric.Create; - LyricSub := TLyric.Create; + TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); + TextP1ThreePScore := AddText(Theme.Sing.TextP1ThreePScore); + StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar); + + // | P2 + StaticP2M := AddStatic(Theme.Sing.StaticP2M); + StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG); + TextP2M := AddText(Theme.Sing.TextP2M); + TextP2MScore := AddText(Theme.Sing.TextP2MScore); + StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar); + + // | P3 + StaticP3R := AddStatic(Theme.Sing.StaticP3R); + StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG); + TextP3R := AddText(Theme.Sing.TextP3R); + TextP3RScore := AddText(Theme.Sing.TextP3RScore); + StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar); + + if ScreenAct = 2 then begin + // katze und affe + + end; + + LyricMain := TLyric.Create; + LyricSub := TLyric.Create; + UVideo.Init; end; @@ -245,44 +256,43 @@ begin SetLength(Player, PlayersPlay); // Player[0].ScoreTotalI := 0; - case PlayersPlay of 1: begin V1 := true; - V1TwoP := false; //added for ps3 skin - V1ThreeP := false; //added for ps3 skin + V1TwoP := false; + V1ThreeP := false; V2R := false; V2M := false; V3R := false; end; 2: begin V1 := false; - V1TwoP := true; //added for ps3 skin - V1ThreeP := false; //added for ps3 skin + V1TwoP := true; + V1ThreeP := false; V2R := true; V2M := false; V3R := false; end; 3: begin V1 := false; - V1TwoP := false; //added for ps3 skin - V1ThreeP := true; //added for ps3 skin + V1TwoP := false; + V1ThreeP := true; V2R := false; V2M := true; V3R := true; end; 4: begin // double screen V1 := false; - V1TwoP := true; //added for ps3 skin - V1ThreeP := false; //added for ps3 skin + V1TwoP := true; + V1ThreeP := false; V2R := true; V2M := false; V3R := false; end; 6: begin // double screen V1 := false; - V1TwoP := false; //added for ps3 skin - V1ThreeP := true; //added for ps3 skin + V1TwoP := false; + V1ThreeP := true; V2R := false; V2M := true; V3R := true; @@ -290,38 +300,40 @@ begin end; - //Added for ps3 skin //This one is shown in 1P mode - Static[StaticP1].Visible := V1; - Static[StaticP1ScoreBG].Visible := V1; - Text[TextP1].Visible := V1; - Text[TextP1Score].Visible := V1; + Static[StaticP1].Visible := V1; + Static[StaticP1ScoreBG].Visible := V1; + Text[TextP1].Visible := V1; + Text[TextP1Score].Visible := V1; + + //This one is shown in 2/4P mode - Static[StaticP1TwoP].Visible := V1TwoP; - Static[StaticP1TwoPScoreBG].Visible := V1TwoP; - Text[TextP1TwoP].Visible := V1TwoP; - Text[TextP1TwoPScore].Visible := V1TwoP; + Static[StaticP1TwoP].Visible := V1TwoP; + Static[StaticP1TwoPScoreBG].Visible := V1TwoP; + Text[TextP1TwoP].Visible := V1TwoP; + Text[TextP1TwoPScore].Visible := V1TwoP; + + Static[StaticP2R].Visible := V2R; + Static[StaticP2RScoreBG].Visible := V2R; + Text[TextP2R].Visible := V2R; + Text[TextP2RScore].Visible := V2R; + + //This one is shown in 3/6P mode - Static[StaticP1ThreeP].Visible := V1ThreeP; + Static[StaticP1ThreeP].Visible := V1ThreeP; Static[StaticP1ThreePScoreBG].Visible := V1ThreeP; - Text[TextP1ThreeP].Visible := V1ThreeP; - Text[TextP1ThreePScore].Visible := V1ThreeP; - //eoa + Text[TextP1ThreeP].Visible := V1ThreeP; + Text[TextP1ThreePScore].Visible := V1ThreeP; - Static[StaticP2R].Visible := V2R; - Static[StaticP2RScoreBG].Visible := V2R; - Text[TextP2R].Visible := V2R; - Text[TextP2RScore].Visible := V2R; + Static[StaticP2M].Visible := V2M; + Static[StaticP2MScoreBG].Visible := V2M; + Text[TextP2M].Visible := V2M; + Text[TextP2MScore].Visible := V2M; - Static[StaticP2M].Visible := V2M; - Static[StaticP2MScoreBG].Visible := V2M; - Text[TextP2M].Visible := V2M; - Text[TextP2MScore].Visible := V2M; - - Static[StaticP3R].Visible := V3R; - Static[StaticP3RScoreBG].Visible := V3R; - Text[TextP3R].Visible := V3R; - Text[TextP3RScore].Visible := V3R; + Static[StaticP3R].Visible := V3R; + Static[StaticP3RScoreBG].Visible := V3R; + Text[TextP3R].Visible := V3R; + Text[TextP3RScore].Visible := V3R; // load notes ResetSingTemp; @@ -479,21 +491,6 @@ begin GoldenRec.SentenceChange; //GoldenStarsTwinkle Mod End - {Static[StaticP2R].Visible := V2R; - Static[StaticP2RScoreBG].Visible := V2R; - Text[TextP2R].Visible := V2R; - Text[TextP2RScore].Visible := V2R; - - Static[StaticP2M].Visible := V2M; - Static[StaticP2MScoreBG].Visible := V2M; - Text[TextP2M].Visible := V2M; - Text[TextP2MScore].Visible := V2M; - - Static[StaticP3R].Visible := V3R; - Static[StaticP3RScoreBG].Visible := V3R; - Text[TextP3R].Visible := V3R; - Text[TextP3RScore].Visible := V3R;} - //Set Position of Line Bonus - PhrasenBonus if (Ini.LineBonus = 1) then //Show Line Bonus at Scores begin @@ -606,9 +603,6 @@ begin end else if (Ini.LineBonus = 2) then //Show Line Bonus at Notes begin - //SingDrawNoteLines(Nr.Left + 10*ScreenX, 120, Nr.Right + 10*ScreenX, 12); - //SingDrawNoteLines(Nr.Left + 10*ScreenX, 245, Nr.Right + 10*ScreenX, 12); - //SingDrawNoteLines(Nr.Left + 10*ScreenX, 370, Nr.Right + 10*ScreenX, 12); // positions if Ini.SingWindow = 0 then begin @@ -781,24 +775,19 @@ begin - //ScoreBG Mod - // set player colors - if PlayersPlay = 4 then begin + //ScoreBG Mod | den wirren Scheiss hier brauch mer nimmer, wir haben colorized png's - no need for wirrness also + // set player colors - macht nichts weiter als die farben des statics zu wechseln, was zu unschönen effekten bei colorized png führt +{ if PlayersPlay = 4 then begin if ScreenAct = 1 then begin LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P2Dark'); - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - - - end; if ScreenAct = 2 then begin LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, @@ -806,110 +795,57 @@ begin LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P4Dark'); - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); - - - end; end; if PlayersPlay = 6 then begin if ScreenAct = 1 then begin - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P2Dark'); LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, Static[StaticP3R].Texture.ColB, 'P3Dark'); - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); - - - end; if ScreenAct = 2 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P5Dark'); LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, Static[StaticP3R].Texture.ColB, 'P6Dark'); - - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); - - - - - end; - end; - -//Original 0.5.0 -{ // set player colors - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - //LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - //Static[StaticP1].Texture.ColB, 'P1Dark'); -// LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - // Static[StaticP2R].Texture.ColB, 'P2Dark'); - end; - if ScreenAct = 2 then begin - LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - Static[StaticP1].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P4Dark'); end; end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - Static[StaticP1].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P3Dark'); - end; - if ScreenAct = 2 then begin - LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - Static[StaticP1].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P6Dark'); - end; - end; } - //end ScoreBG Mod - - + } // set player names (for 2 screens and only Singstar skin) if ScreenAct = 1 then begin - Text[TextP1].Text := 'P1'; - Text[TextP1TwoP].Text := 'P1'; //added for ps3 skin - Text[TextP1ThreeP].Text := 'P1'; //added for ps3 skin - Text[TextP2R].Text := 'P2'; - Text[TextP2M].Text := 'P2'; - Text[TextP3R].Text := 'P3'; + Text[TextP1].Text := 'P1'; + Text[TextP1TwoP].Text := 'P1'; + Text[TextP1ThreeP].Text := 'P1'; + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; end; if ScreenAct = 2 then begin @@ -928,35 +864,37 @@ begin end;} 4: begin - Text[TextP1TwoP].Text := 'P3'; - Text[TextP2R].Text := 'P4'; + Text[TextP1TwoP].Text := 'P3'; + Text[TextP2R].Text := 'P4'; end; 6: begin Text[TextP1ThreeP].Text := 'P4'; - Text[TextP2M].Text := 'P5'; - Text[TextP3R].Text := 'P6'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; end; end; // case end; // if // stereo -// weird stuff, maybe this is for "dual screen?", but where is player three then? - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; +// weird stuff, maybe this is for "dual screen?", but where is player three then? | okay, i commented the stuff out the other day - nothing was missing on screen w/ 6 players - so do we even need this stuff? +// okay this stuff appears again some lines beneath this one, I commented it out for testing what it does - seems like it's doing nothing +// but I might be wrong, so what is this stuff here doing? O.o + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; - Text[TextP1].X := Text[TextP1].X + 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; + Text[TextP1].X := Text[TextP1].X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; - Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; + Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; // end of weird stuff - for S := 1 to 1 do + for S := 1 to 1 do //wtf? Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; for T := 0 to 1 do @@ -1052,17 +990,6 @@ begin end; end; - - // beat flash -{ Flash := 1 - (Czas.MidBeat - Czas.AktBeat); - if (Czas.AktBeat + AktSong.NotesGAP) mod AktSong.Resolution = 0 then Flash := 1 - else Flash := 0; - if Czas.AktBeat < 0 then Flash := 0; - glClearColor(Flash, Flash, Flash, 1);} - - // beat sound -// if (Ini.BeatClick = 1) and (Flash = 1) and (Czas.AktBeat <> Czas.OldBeat) then Music.PlayClick; - // draw static menu (BG) DrawBG; //Draw Background @@ -1120,21 +1047,23 @@ begin // back stereo // weird stuff, maybe this is for "dual screen?", but where is player three then? - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; +// okay this stuff appears again some lines above this one, I commented it out for testing what it does - seems like it's doing nothing +// but I might be wrong, so what is this stuff here doing? O.o + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; - Text[TextP1].X := Text[TextP1].X - 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; + Text[TextP1].X := Text[TextP1].X - 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; - Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; + Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; //weird end - for S := 1 to 1 do + for S := 1 to 1 do // wtf? Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; for T := 0 to 1 do @@ -1205,7 +1134,7 @@ begin If ({(Ini.Oscilloscope = 2) and }(Czesci[0].Czesc[S].TotalNotes>0)) then begin Player[I].ScorePercentTarget := Player[I].ScorePercentTarget + floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 40 - 26); - if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0; + if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0; if Player[I].ScorePercentTarget > 99 then Player[I].ScorePercentTarget := 99; //end Singbar Mod diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 0305315f..20ad0957 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -945,6 +945,7 @@ end; // comment by blindy: wo zum henker wird denn in diesem screen ein video abgespielt? // update and draw movie + // wie wo wadd? also in der selben funktion in der uscreensing kommt des video in der zeile 995, oder was wollteste wissen? :X { if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin UpdateSmpeg; // this only draws end;} -- cgit v1.2.3 From 08ad90ec9f574c7dc153c8d40169f3a58c9beb9a Mon Sep 17 00:00:00 2001 From: mogguh Date: Mon, 10 Sep 2007 19:02:04 +0000 Subject: BugFix: Changed a 9 with a 8.. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@384 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 2 +- Game/Code/Classes/UGraphic.pas | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 8cfa8d7e..94617583 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -1431,7 +1431,7 @@ if Age < 5 then Size := Age * 10 else Size := 50; //New Method, Not Variable - glBindTexture(GL_TEXTURE_2D, Tex_SingLineBonusBack[2]); + glBindTexture(GL_TEXTURE_2D, Tex_SingLineBonusBack[2].TexNum); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex2f(X + 50 - Size, Y + 25 - (Size/2)); diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 79f82438..0c022b8f 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -236,7 +236,7 @@ begin //end Singbar Mod //Line Bonus PopUp - for P := 0 to 9 do + for P := 0 to 8 do begin Tex_SingLineBonusBack[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LineBonusBack')), 'PNG', 'Colorized', $FFFFFF); end; -- cgit v1.2.3 From 6e7b96ca3a7d47b0441bed904a9b8bb25c3223de Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 12 Sep 2007 12:43:38 +0000 Subject: * added missed dependency PNGImage. * moved FUNCTION InitializePaths(), from uFiles to uMain as this is a more sane location for it. * updated files that used UFiles to point to UMain, and removed uFiles where its not needed. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@385 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCatCovers.pas | 7 +- Game/Code/Classes/UCommandLine.pas | 11 +- Game/Code/Classes/UCovers.pas | 64 +- Game/Code/Classes/UFiles.pas | 113 +- Game/Code/Classes/UIni.pas | 9 +- Game/Code/Classes/ULanguage.pas | 9 +- Game/Code/Classes/ULog.pas | 12 +- Game/Code/Classes/UMain.pas | 51 + Game/Code/Classes/UPlaylist.pas | 9 +- Game/Code/Classes/USongs.pas | 6 +- Game/Code/Menu/UDisplay.pas | 11 +- Game/Code/UltraStar.dpr | 10 +- Game/Code/lib/PngImage/Tpngimage.DPK | 34 + Game/Code/lib/PngImage/Tpngimage.bdsproj | 177 + Game/Code/lib/PngImage/Tpngimage.bdsproj.local | 2 + Game/Code/lib/PngImage/Tpngimage.cfg | 40 + Game/Code/lib/PngImage/Tpngimage.dcu | Bin 0 -> 1140 bytes Game/Code/lib/PngImage/Tpngimage.dof | 136 + Game/Code/lib/PngImage/Tpngimage.drc | 62 + Game/Code/lib/PngImage/Tpngimage.res | Bin 0 -> 1536 bytes Game/Code/lib/PngImage/Tpngimage.stat | 10 + Game/Code/lib/PngImage/obj/adler32.obj | Bin 0 -> 602 bytes Game/Code/lib/PngImage/obj/deflate.obj | Bin 0 -> 6993 bytes Game/Code/lib/PngImage/obj/infblock.obj | Bin 0 -> 5347 bytes Game/Code/lib/PngImage/obj/infcodes.obj | Bin 0 -> 3600 bytes Game/Code/lib/PngImage/obj/inffast.obj | Bin 0 -> 2323 bytes Game/Code/lib/PngImage/obj/inflate.obj | Bin 0 -> 3188 bytes Game/Code/lib/PngImage/obj/inftrees.obj | Bin 0 -> 7995 bytes Game/Code/lib/PngImage/obj/infutil.obj | Bin 0 -> 1339 bytes Game/Code/lib/PngImage/obj/trees.obj | Bin 0 -> 11623 bytes Game/Code/lib/PngImage/pngimage.chm | Bin 0 -> 162254 bytes Game/Code/lib/PngImage/pngimage.dcu | Bin 0 -> 91395 bytes Game/Code/lib/PngImage/pngimage.pas | 5205 ++++++++++++++++++++++++ Game/Code/lib/PngImage/pngimage.~pas | 5205 ++++++++++++++++++++++++ Game/Code/lib/PngImage/pnglang.dcu | Bin 0 -> 4226 bytes Game/Code/lib/PngImage/pnglang.pas | 301 ++ Game/Code/lib/PngImage/pngzlib.dcu | Bin 0 -> 37565 bytes Game/Code/lib/PngImage/pngzlib.pas | 169 + 38 files changed, 11556 insertions(+), 97 deletions(-) create mode 100644 Game/Code/lib/PngImage/Tpngimage.DPK create mode 100644 Game/Code/lib/PngImage/Tpngimage.bdsproj create mode 100644 Game/Code/lib/PngImage/Tpngimage.bdsproj.local create mode 100644 Game/Code/lib/PngImage/Tpngimage.cfg create mode 100644 Game/Code/lib/PngImage/Tpngimage.dcu create mode 100644 Game/Code/lib/PngImage/Tpngimage.dof create mode 100644 Game/Code/lib/PngImage/Tpngimage.drc create mode 100644 Game/Code/lib/PngImage/Tpngimage.res create mode 100644 Game/Code/lib/PngImage/Tpngimage.stat create mode 100644 Game/Code/lib/PngImage/obj/adler32.obj create mode 100644 Game/Code/lib/PngImage/obj/deflate.obj create mode 100644 Game/Code/lib/PngImage/obj/infblock.obj create mode 100644 Game/Code/lib/PngImage/obj/infcodes.obj create mode 100644 Game/Code/lib/PngImage/obj/inffast.obj create mode 100644 Game/Code/lib/PngImage/obj/inflate.obj create mode 100644 Game/Code/lib/PngImage/obj/inftrees.obj create mode 100644 Game/Code/lib/PngImage/obj/infutil.obj create mode 100644 Game/Code/lib/PngImage/obj/trees.obj create mode 100644 Game/Code/lib/PngImage/pngimage.chm create mode 100644 Game/Code/lib/PngImage/pngimage.dcu create mode 100644 Game/Code/lib/PngImage/pngimage.pas create mode 100644 Game/Code/lib/PngImage/pngimage.~pas create mode 100644 Game/Code/lib/PngImage/pnglang.dcu create mode 100644 Game/Code/lib/PngImage/pnglang.pas create mode 100644 Game/Code/lib/PngImage/pngzlib.dcu create mode 100644 Game/Code/lib/PngImage/pngzlib.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UCatCovers.pas b/Game/Code/Classes/UCatCovers.pas index 34742902..d40b2564 100644 --- a/Game/Code/Classes/UCatCovers.pas +++ b/Game/Code/Classes/UCatCovers.pas @@ -24,7 +24,12 @@ var CatCovers: TCatCovers; implementation -uses IniFiles, SysUtils, Classes, UFiles, ULog; +uses IniFiles, + SysUtils, + Classes, + // UFiles, + UMain, + ULog; constructor TCatCovers.Create; begin diff --git a/Game/Code/Classes/UCommandLine.pas b/Game/Code/Classes/UCommandLine.pas index 03229721..259c6e16 100644 --- a/Game/Code/Classes/UCommandLine.pas +++ b/Game/Code/Classes/UCommandLine.pas @@ -45,7 +45,10 @@ var Params: TCMDParams; implementation -uses SysUtils, UIni; + +uses SysUtils; +// uINI -- Nasty requirement... ( removed with permission of blindy ) + //------------- // Constructor - Create class, Reset Variables and Read Infos @@ -249,6 +252,7 @@ var I: integer; begin Result := -1; +{* JB - 12sep07 to remove uINI dependency //Search for Language For I := 0 to high(ILanguage) do @@ -257,6 +261,7 @@ begin Result := I; Break; end; +*} end; //------------- @@ -267,6 +272,7 @@ var I: integer; begin Result := -1; +{* JB - 12sep07 to remove uINI dependency //Search for Resolution For I := 0 to high(IResolution) do @@ -275,6 +281,7 @@ begin Result := I; Break; end; +*} end; -end. \ No newline at end of file +end. diff --git a/Game/Code/Classes/UCovers.pas b/Game/Code/Classes/UCovers.pas index 5b0a06d4..0740c143 100644 --- a/Game/Code/Classes/UCovers.pas +++ b/Game/Code/Classes/UCovers.pas @@ -34,7 +34,11 @@ var Covers: TCovers; implementation -uses UFiles, ULog, DateUtils; + +uses UMain, + // UFiles, + ULog, + DateUtils; constructor TCovers.Create; begin @@ -56,48 +60,50 @@ var Name: string; // Data: array of byte; begin - if FileExists(GamePath + 'covers.cache') then begin - AssignFile(F, GamePath + 'covers.cache'); - Reset(F, 1); + if FileExists(GamePath + 'covers.cache') then + begin + AssignFile(F, GamePath + 'covers.cache'); + Reset(F, 1); - WritetoFile := not FileIsReadOnly(GamePath + 'covers.cache'); + WritetoFile := not FileIsReadOnly(GamePath + 'covers.cache'); - SetLength(Cover, 0); + SetLength(Cover, 0); - while not EOF(F) do begin - SetLength(Cover, Length(Cover)+1); + while not EOF(F) do + begin + SetLength(Cover, Length(Cover)+1); - BlockRead(F, W, 2); - Cover[High(Cover)].W := W; + BlockRead(F, W, 2); + Cover[High(Cover)].W := W; - BlockRead(F, H, 2); - Cover[High(Cover)].H := H; + BlockRead(F, H, 2); + Cover[High(Cover)].H := H; - BlockRead(F, Bits, 1); + BlockRead(F, Bits, 1); - Cover[High(Cover)].Size := W * H * (Bits div 8); + Cover[High(Cover)].Size := W * H * (Bits div 8); - // test -// W := 128; -// H := 128; -// Bits := 24; -// Seek(F, FilePos(F) + 3); + // test + // W := 128; + // H := 128; + // Bits := 24; + // Seek(F, FilePos(F) + 3); - BlockRead(F, NLen, 2); - SetLength(Name, NLen); + BlockRead(F, NLen, 2); + SetLength(Name, NLen); - BlockRead(F, Name[1], NLen); - Cover[High(Cover)].Name := Name; + BlockRead(F, Name[1], NLen); + Cover[High(Cover)].Name := Name; - Cover[High(Cover)].Position := FilePos(F); - Seek(F, FilePos(F) + W*H*(Bits div 8)); + Cover[High(Cover)].Position := FilePos(F); + Seek(F, FilePos(F) + W*H*(Bits div 8)); -// SetLength(Cover[High(Cover)].Data, W*H*(Bits div 8)); -// BlockRead(F, Cover[High(Cover)].Data[0], W*H*(Bits div 8)); + // SetLength(Cover[High(Cover)].Data, W*H*(Bits div 8)); + // BlockRead(F, Cover[High(Cover)].Data[0], W*H*(Bits div 8)); - end; + end; // While - CloseFile(F); + CloseFile(F); end; // fileexists end; diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index e6982a1a..008061a4 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -2,9 +2,12 @@ unit UFiles; interface -uses USongs, SysUtils, ULog, UMusic; +uses SysUtils, + ULog, + UMusic, + USongs; -procedure InitializePaths; //Function sets All Absolute Paths eg. for Songs +//procedure InitializePaths; //Function sets All Absolute Paths eg. for Songs function ReadTXTHeader(var Song: TSong): boolean; //Reads Standard TXT Header function AnalyseFile(var Song: TSong): boolean; //Analyse Song File and Read Header procedure ClearSong(var Song: TSong); //Clears Song Header values @@ -13,12 +16,13 @@ procedure ClearSong(var Song: TSong); //Clears Song Header values procedure ResetSingTemp; procedure ParseNote(NrCzesci: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string); procedure NewSentence(NrCzesciP: integer; Param1, Param2: integer); -function LoadSong(Name: string): boolean; -function SaveSong(Song: TSong; Czesc: TCzesci; Name: string; Relative: boolean): boolean; +function LoadSong(Name: string): boolean; +function SaveSong(Song: TSong; Czesc: TCzesci; Name: string; Relative: boolean): boolean; var +{* //Absolute Paths GamePath: string; SoundPath: string; @@ -30,6 +34,7 @@ var LanguagesPath: string; PluginPath: string; PlayListPath: string; +*} SongFile: TextFile; // all procedures in this unit operates on this file FileLineNo: integer; //Line which is readed at Last, for error reporting @@ -41,57 +46,51 @@ var MultBPM: integer = 4; implementation -uses TextGL, UIni, UMain; +uses TextGL, + UIni, + UMain; +{* //-------------------- // Function sets all Absolute Paths e.g. Song Path and makes sure the Directorys exist //-------------------- procedure InitializePaths; -var - Writeable: Boolean; -begin - GamePath := ExtractFilePath(ParamStr(0)); - - SoundPath := GamePath + 'Sounds\'; - SongPath := GamePath + 'Songs\'; - LogPath := GamePath; - ThemePath := GamePath + 'Themes\'; - ScreenshotsPath := GamePath + 'Screenshots\'; - CoversPath := GamePath + 'Covers\'; - LanguagesPath := GamePath + 'Languages\'; - PluginPath := GamePath + 'Plugins\'; - PlaylistPath := GamePath + 'Playlists\'; - - //After Setting Paths, make sure that Paths exist - If not DirectoryExists(SoundPath) then - Writeable := ForceDirectories(SoundPath); - - If Writeable And (not DirectoryExists(SongPath)) then - Writeable := ForceDirectories(SongPath); - - If Writeable And (not DirectoryExists(ThemePath)) then - Writeable := ForceDirectories(ThemePath); - If Writeable And (not DirectoryExists(ScreenshotsPath)) then - Writeable := ForceDirectories(ScreenshotsPath); - - If Writeable And (not DirectoryExists(CoversPath)) then - Writeable := ForceDirectories(CoversPath); - - If Writeable And (not DirectoryExists(LanguagesPath)) then - Writeable := ForceDirectories(LanguagesPath); - - If Writeable And (not DirectoryExists(PluginPath)) then - Writeable := ForceDirectories(PluginPath); + // Initialize a Path Variable + // After Setting Paths, make sure that Paths exist + function initialize_path( out aPathVar : String; const aLocation : String ): boolean; + var + lWriteable: Boolean; + begin + aPathVar := aLocation; + + If DirectoryExists(aPathVar) then + lWriteable := ForceDirectories(aPathVar) + else + lWriteable := false; - If Writeable And (not DirectoryExists(PlaylistPath)) then - Writeable := ForceDirectories(PlaylistPath); + if not Writeable then + Log.LogError('Error: Dir ('+ aLocation +') is Readonly'); + + result := lWriteable; + end; - if not Writeable then - Log.LogError('Error: Dir is Readonly'); +begin + GamePath := ExtractFilePath(ParamStr(0)); + + initialize_path( LogPath , GamePath ); + initialize_path( SoundPath , GamePath + 'Sounds\' ); + initialize_path( SongPath , GamePath + 'Songs\' ); + initialize_path( ThemePath , GamePath + 'Themes\' ); + initialize_path( ScreenshotsPath , GamePath + 'Screenshots\'); + initialize_path( CoversPath , GamePath + 'Covers\' ); + initialize_path( LanguagesPath , GamePath + 'Languages\' ); + initialize_path( PluginPath , GamePath + 'Plugins\' ); + initialize_path( PlaylistPath , GamePath + 'Playlists\' ); DecimalSeparator := ','; end; +*} //-------------------- // Clears Song Header values @@ -99,29 +98,29 @@ end; procedure ClearSong(var Song: TSong); begin //Main Information - Song.Title := ''; + Song.Title := ''; Song.Artist := ''; //Sortings: - Song.Genre := 'Unknown'; - Song.Edition := 'Unknown'; + Song.Genre := 'Unknown'; + Song.Edition := 'Unknown'; Song.Language := 'Unknown'; //Language Patch //Required Information - Song.Mp3 := ''; - Song.BPM := 0; - Song.GAP := 0; - Song.Start := 0; + Song.Mp3 := ''; + Song.BPM := 0; + Song.GAP := 0; + Song.Start := 0; Song.Finish := 0; //Additional Information Song.Background := ''; - Song.Cover := ''; - Song.Video := ''; - Song.VideoGAP := 0; - Song.NotesGAP := 0; + Song.Cover := ''; + Song.Video := ''; + Song.VideoGAP := 0; + Song.NotesGAP := 0; Song.Resolution := 4; - Song.Creator := ''; + Song.Creator := ''; end; //-------------------- @@ -791,4 +790,4 @@ begin CloseFile(SongFile); end; -end. \ No newline at end of file +end. diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index 846c0deb..67649a51 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -162,7 +162,14 @@ const IChannel: array[0..6] of string = ('0', '1', '2', '3', '4', '5', '6'); implementation -uses UFiles, SDL, ULanguage, USkins, URecord, UCommandLine; + +uses //UFiles, + UMain, + SDL, + ULanguage, + USkins, + URecord, + UCommandLine; procedure TIni.Load; var diff --git a/Game/Code/Classes/ULanguage.pas b/Game/Code/Classes/ULanguage.pas index 4649c089..5deed1f7 100644 --- a/Game/Code/Classes/ULanguage.pas +++ b/Game/Code/Classes/ULanguage.pas @@ -36,7 +36,14 @@ var implementation -uses UFiles, UIni, IniFiles, Classes, SysUtils, Windows, ULog; +uses UMain, + // UFiles, + UIni, + IniFiles, + Classes, + SysUtils, + Windows, + ULog; //---------- //Create - Construct Class then LoadList + Standard Language + Set Standard Implode Glues diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index 9d20d2f1..2233ec1b 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -45,7 +45,17 @@ var Log: TLog; implementation -uses UFiles, SysUtils, DateUtils, URecord, UTime, UIni, Windows, UCommandLine; + +uses + Windows, + SysUtils, + DateUtils, +// UFiles, + UMain, + URecord, + UTime, +// UIni, // JB - Seems to not be needed. + UCommandLine; destructor TLog.Free; begin diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 98e1acb4..43010bde 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -70,6 +70,18 @@ type var + //Absolute Paths + GamePath: string; + SoundPath: string; + SongPath: string; + LogPath: string; + ThemePath: string; + ScreenshotsPath: string; + CoversPath: string; + LanguagesPath: string; + PluginPath: string; + PlayListPath: string; + OGL: Boolean; Done: Boolean; Event: TSDL_event; @@ -80,6 +92,7 @@ var Player: array of TPlayer; PlayersPlay: integer; +procedure InitializePaths; procedure MainLoop; procedure CheckEvents; @@ -706,9 +719,47 @@ begin Player[PlayerNum].LineBonus_TargetX := 70 + PlayerNum*500; Player[PlayerNum].LineBonus_TargetY := 30; //PhrasenBonus - Line Bonus Mod End +end; + +//-------------------- +// Function sets all Absolute Paths e.g. Song Path and makes sure the Directorys exist +//-------------------- +procedure InitializePaths; + + // Initialize a Path Variable + // After Setting Paths, make sure that Paths exist + function initialize_path( out aPathVar : String; const aLocation : String ): boolean; + var + lWriteable: Boolean; + begin + aPathVar := aLocation; + + If DirectoryExists(aPathVar) then + lWriteable := ForceDirectories(aPathVar) + else + lWriteable := false; + + if not lWriteable then + Log.LogError('Error: Dir ('+ aLocation +') is Readonly'); + + result := lWriteable; + end; + +begin + GamePath := ExtractFilePath(ParamStr(0)); + initialize_path( LogPath , GamePath ); + initialize_path( SoundPath , GamePath + 'Sounds\' ); + initialize_path( SongPath , GamePath + 'Songs\' ); + initialize_path( ThemePath , GamePath + 'Themes\' ); + initialize_path( ScreenshotsPath , GamePath + 'Screenshots\'); + initialize_path( CoversPath , GamePath + 'Covers\' ); + initialize_path( LanguagesPath , GamePath + 'Languages\' ); + initialize_path( PluginPath , GamePath + 'Plugins\' ); + initialize_path( PlaylistPath , GamePath + 'Playlists\' ); + DecimalSeparator := ','; end; end. diff --git a/Game/Code/Classes/UPlaylist.pas b/Game/Code/Classes/UPlaylist.pas index e3f68239..1e517ef7 100644 --- a/Game/Code/Classes/UPlaylist.pas +++ b/Game/Code/Classes/UPlaylist.pas @@ -59,7 +59,14 @@ type implementation -uses USongs, ULog, UFiles, UGraphic, UThemes, SysUtils; + +uses USongs, + ULog, + UMain, + //UFiles, + UGraphic, + UThemes, + SysUtils; //---------- //Create - Construct Class - Dummy for now diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index edf5b6df..7065024b 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -96,7 +96,11 @@ var implementation -uses UFiles, UIni, StrUtils; +uses StrUtils, + UFiles, + UMain, + UIni; + procedure TSongs.LoadSongList; begin diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index fcba4382..2af1dfa0 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -52,7 +52,16 @@ var implementation -uses UGraphic, UTime, Graphics, Jpeg, UFiles, UTexture, UIni, TextGL, UCommandLine; +uses Graphics, + Jpeg, + TextGL, + // UFiles, + UMain, + UTexture, + UIni, + UGraphic, + UTime, + UCommandLine; constructor TDisplay.Create; var i: integer; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 1cfa64f5..842b225e 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -8,10 +8,13 @@ uses //------------------------------ //Includes - 3rd Party Libraries //------------------------------ + SDL in 'lib\JEDI-SDLv1.0\SDL\Pas\SDL.pas', OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas', bass in 'lib\bass\delphi\bass.pas', + PNGImage in 'lib\PNGImage\PNGImage.pas', + midiout in 'lib\midi\midiout.pas', midiin in 'lib\midi\midiin.pas', Circbuf in 'lib\midi\CIRCBUF.PAS', @@ -136,7 +139,6 @@ uses //Includes - Delphi //------------------------------ Windows, - SDL, SysUtils; const @@ -219,7 +221,7 @@ begin Log.BenchmarkStart(1); Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; Ini.Load; - + //Load Languagefile if (Params.Language <> -1) then Language.ChangeLanguage(ILanguage[Params.Language]) @@ -229,6 +231,7 @@ begin Log.BenchmarkEnd(1); Log.LogBenchmark('Loading Ini', 1); + // LCD Log.BenchmarkStart(1); Log.LogStatus('Load LCD', 'Initialization'); LCD := TLCD.Create; @@ -251,6 +254,7 @@ begin Log.BenchmarkEnd(1); Log.LogBenchmark('Loading Light', 1); + // Theme Log.BenchmarkStart(1); Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); @@ -270,6 +274,8 @@ begin Log.BenchmarkEnd(1); Log.LogBenchmark('Loading Category Covers Array', 1); + + // Songs //Log.BenchmarkStart(1); Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; diff --git a/Game/Code/lib/PngImage/Tpngimage.DPK b/Game/Code/lib/PngImage/Tpngimage.DPK new file mode 100644 index 00000000..b9c395f4 --- /dev/null +++ b/Game/Code/lib/PngImage/Tpngimage.DPK @@ -0,0 +1,34 @@ +package Tpngimage; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$IMPLICITBUILD OFF} + +requires + rtl, + vcl; + +contains + pngimage in 'pngimage.pas'; + +end. diff --git a/Game/Code/lib/PngImage/Tpngimage.bdsproj b/Game/Code/lib/PngImage/Tpngimage.bdsproj new file mode 100644 index 00000000..b7a30970 --- /dev/null +++ b/Game/Code/lib/PngImage/Tpngimage.bdsproj @@ -0,0 +1,177 @@ + + + + + + + + + + + + Tpngimage.DPK + + + 7.0 + + + 8 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + True + True + WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; + + False + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + False + False + False + True + True + True True + True + + + + 3 + 0 + 1 + False + False + False + 16384 + 1048576 + 4194304 + False + + + + + + + + + + + False + + + + + + False + + + + + + False + True + False + + + + $00000000 + C:\Program Files\Borland\Delphi7\Bin\ + + + True + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1033 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + diff --git a/Game/Code/lib/PngImage/Tpngimage.bdsproj.local b/Game/Code/lib/PngImage/Tpngimage.bdsproj.local new file mode 100644 index 00000000..d576f039 --- /dev/null +++ b/Game/Code/lib/PngImage/Tpngimage.bdsproj.local @@ -0,0 +1,2 @@ + + diff --git a/Game/Code/lib/PngImage/Tpngimage.cfg b/Game/Code/lib/PngImage/Tpngimage.cfg new file mode 100644 index 00000000..4a78a005 --- /dev/null +++ b/Game/Code/lib/PngImage/Tpngimage.cfg @@ -0,0 +1,40 @@ +-$A8 +-$B- +-$C+ +-$D+ +-$E- +-$F- +-$G+ +-$H+ +-$I+ +-$J- +-$K- +-$L+ +-$M- +-$N+ +-$O+ +-$P+ +-$Q- +-$R- +-$S- +-$T- +-$U- +-$V+ +-$W- +-$X+ +-$YD +-$Z1 +-GD +-cg +-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; +-H+ +-W+ +-M +-$M16384,1048576 +-K$00400000 +-LE"C:\Documents and Settings\Jay Binks\My Documents\Borland Studio Projects\Bpl" +-LN"C:\Documents and Settings\Jay Binks\My Documents\Borland Studio Projects\Bpl" +-Z +-w-UNSAFE_TYPE +-w-UNSAFE_CODE +-w-UNSAFE_CAST diff --git a/Game/Code/lib/PngImage/Tpngimage.dcu b/Game/Code/lib/PngImage/Tpngimage.dcu new file mode 100644 index 00000000..8cbbd152 Binary files /dev/null and b/Game/Code/lib/PngImage/Tpngimage.dcu differ diff --git a/Game/Code/lib/PngImage/Tpngimage.dof b/Game/Code/lib/PngImage/Tpngimage.dof new file mode 100644 index 00000000..45e43c01 --- /dev/null +++ b/Game/Code/lib/PngImage/Tpngimage.dof @@ -0,0 +1,136 @@ +[FileVersion] +Version=7.0 +[Compiler] +A=8 +B=0 +C=1 +D=1 +E=0 +F=0 +G=1 +H=1 +I=1 +J=0 +K=0 +L=1 +M=0 +N=1 +O=1 +P=1 +Q=0 +R=0 +S=0 +T=0 +U=0 +V=1 +W=0 +X=1 +Y=1 +Z=1 +ShowHints=1 +ShowWarnings=1 +UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; +NamespacePrefix= +SymbolDeprecated=1 +SymbolLibrary=1 +SymbolPlatform=1 +UnitLibrary=1 +UnitPlatform=1 +UnitDeprecated=1 +HResultCompat=1 +HidingMember=1 +HiddenVirtual=1 +Garbage=1 +BoundsError=1 +ZeroNilCompat=1 +StringConstTruncated=1 +ForLoopVarVarPar=1 +TypedConstVarPar=1 +AsgToTypedConst=1 +CaseLabelRange=1 +ForVariable=1 +ConstructingAbstract=1 +ComparisonFalse=1 +ComparisonTrue=1 +ComparingSignedUnsigned=1 +CombiningSignedUnsigned=1 +UnsupportedConstruct=1 +FileOpen=1 +FileOpenUnitSrc=1 +BadGlobalSymbol=1 +DuplicateConstructorDestructor=1 +InvalidDirective=1 +PackageNoLink=1 +PackageThreadVar=1 +ImplicitImport=1 +HPPEMITIgnored=1 +NoRetVal=1 +UseBeforeDef=1 +ForLoopVarUndef=1 +UnitNameMismatch=1 +NoCFGFileFound=1 +MessageDirective=1 +ImplicitVariants=1 +UnicodeToLocale=1 +LocaleToUnicode=1 +ImagebaseMultiple=1 +SuspiciousTypecast=1 +PrivatePropAccessor=1 +UnsafeType=0 +UnsafeCode=0 +UnsafeCast=0 +[Linker] +MapFile=0 +OutputObjs=0 +ConsoleApp=1 +DebugInfo=0 +RemoteSymbols=0 +MinStackSize=16384 +MaxStackSize=1048576 +ImageBase=4194304 +ExeDescription= +[Directories] +OutputDir= +UnitOutputDir= +PackageDLLOutputDir= +PackageDCPOutputDir= +SearchPath= +Packages=vcl;rtl;vclx;VclSmp;vclshlctrls;VirtualTreesD7;Tpngimage;THTTPGet;XmlComponents_D6;EmbWb;TINetDetector;FolderDialog;Indy70;madBasic_;madHelp_;madDisAsm_;madExcept_;madRemote_;madKernel_;madCodeHook_;madSecurity_;madShell_;TRegs32;Progress;TTRAYICON;TXPPanel;DelphiX_for5 +Conditionals= +DebugSourceDirs= +UsePackages=0 +[Parameters] +RunParams= +HostApplication= +Launcher= +UseLauncher=0 +DebugCWD= +[Language] +ActiveLang= +ProjectLang= +RootDir=C:\Program Files\Borland\Delphi7\Bin\ +[Version Info] +IncludeVerInfo=1 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1033 +CodePage=1252 +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= diff --git a/Game/Code/lib/PngImage/Tpngimage.drc b/Game/Code/lib/PngImage/Tpngimage.drc new file mode 100644 index 00000000..52d3a522 --- /dev/null +++ b/Game/Code/lib/PngImage/Tpngimage.drc @@ -0,0 +1,62 @@ +/* VER180 + Generated by the Borland Delphi Pascal Compiler + because -GD or --drc was supplied to the compiler. + + This file contains compiler-generated resources that + were bound to the executable. + If this file is empty, then no compiler-generated + resources were bound to the produced executable. +*/ + +#define pnglang_EPNGNoImageDataText 65504 +#define pnglang_EPNGCannotChangeSizeText 65505 +#define pnglang_EPNGCannotAddChunkText 65506 +#define pnglang_EPNGCannotAddInvalidImageText 65507 +#define pnglang_EPNGCouldNotLoadResourceText 65508 +#define pnglang_EPNGOutMemoryText 65509 +#define pnglang_EPNGCannotChangeTransparentText 65510 +#define pnglang_EPNGHeaderNotPresentText 65511 +#define pnglang_EPngInvalidCRCText 65520 +#define pnglang_EPNGInvalidIHDRText 65521 +#define pnglang_EPNGMissingMultipleIDATText 65522 +#define pnglang_EPNGZLIBErrorText 65523 +#define pnglang_EPNGInvalidPaletteText 65524 +#define pnglang_EPNGInvalidFileHeaderText 65525 +#define pnglang_EPNGIHDRNotFirstText 65526 +#define pnglang_EPNGNotExistsText 65527 +#define pnglang_EPNGSizeExceedsText 65528 +#define pnglang_EPNGUnknownPalEntryText 65529 +#define pnglang_EPNGMissingPaletteText 65530 +#define pnglang_EPNGUnknownCriticalChunkText 65531 +#define pnglang_EPNGUnknownCompressionText 65532 +#define pnglang_EPNGUnknownInterlaceText 65533 +#define pnglang_EPNGCannotAssignChunkText 65534 +#define pnglang_EPNGUnexpectedEndText 65535 +STRINGTABLE +BEGIN + pnglang_EPNGNoImageDataText, "This \"Portable Network Graphics\" image contains no data." + pnglang_EPNGCannotChangeSizeText, "The \"Portable Network Graphics\" image can not be resize by changing width and height properties. Try assigning the image from a bitmap." + pnglang_EPNGCannotAddChunkText, "The program tried to add a existent critical chunk to the current image which is not allowed." + pnglang_EPNGCannotAddInvalidImageText, "It's not allowed to add a new chunk because the current image is invalid." + pnglang_EPNGCouldNotLoadResourceText, "The png image could not be loaded from the resource ID." + pnglang_EPNGOutMemoryText, "Some operation could not be performed because the system is out of resources. Close some windows and try again." + pnglang_EPNGCannotChangeTransparentText, "Setting bit transparency color is not allowed for png images containing alpha value for each pixel (COLOR_RGBALPHA and COLOR_GRAYSCALEALPHA)" + pnglang_EPNGHeaderNotPresentText, "This operation is not valid because the current image contains no valid header." + pnglang_EPngInvalidCRCText, "This \"Portable Network Graphics\" image is not valid because it contains invalid pieces of data (crc error)" + pnglang_EPNGInvalidIHDRText, "The \"Portable Network Graphics\" image could not be loaded because one of its main piece of data (ihdr) might be corrupted" + pnglang_EPNGMissingMultipleIDATText, "This \"Portable Network Graphics\" image is invalid because it has missing image parts." + pnglang_EPNGZLIBErrorText, "Could not decompress the image because it contains invalid compressed data.\r\n Description: " + pnglang_EPNGInvalidPaletteText, "The \"Portable Network Graphics\" image contains an invalid palette." + pnglang_EPNGInvalidFileHeaderText, "The file being readed is not a valid \"Portable Network Graphics\" image because it contains an invalid header. This file may be corruped, try obtaining it again." + pnglang_EPNGIHDRNotFirstText, "This \"Portable Network Graphics\" image is not supported or it might be invalid.\r\n(IHDR chunk is not the first)" + pnglang_EPNGNotExistsText, "The png file could not be loaded because it does not exists." + pnglang_EPNGSizeExceedsText, "This \"Portable Network Graphics\" image is not supported because either it's width or height exceeds the maximum size, which is 65535 pixels length." + pnglang_EPNGUnknownPalEntryText, "There is no such palette entry." + pnglang_EPNGMissingPaletteText, "This \"Portable Network Graphics\" could not be loaded because it uses a color table which is missing." + pnglang_EPNGUnknownCriticalChunkText, "This \"Portable Network Graphics\" image contains an unknown critical part which could not be decoded." + pnglang_EPNGUnknownCompressionText, "This \"Portable Network Graphics\" image is encoded with an unknown compression scheme which could not be decoded." + pnglang_EPNGUnknownInterlaceText, "This \"Portable Network Graphics\" image uses an unknown interlace scheme which could not be decoded." + pnglang_EPNGCannotAssignChunkText, "The chunks must be compatible to be assigned." + pnglang_EPNGUnexpectedEndText, "This \"Portable Network Graphics\" image is invalid because the decoder found an unexpected end of the file." +END + diff --git a/Game/Code/lib/PngImage/Tpngimage.res b/Game/Code/lib/PngImage/Tpngimage.res new file mode 100644 index 00000000..aac9aa64 Binary files /dev/null and b/Game/Code/lib/PngImage/Tpngimage.res differ diff --git a/Game/Code/lib/PngImage/Tpngimage.stat b/Game/Code/lib/PngImage/Tpngimage.stat new file mode 100644 index 00000000..57f32789 --- /dev/null +++ b/Game/Code/lib/PngImage/Tpngimage.stat @@ -0,0 +1,10 @@ +[Stats] +EditorSecs=3 +DesignerSecs=1 +InspectorSecs=1 +CompileSecs=1542 +OtherSecs=11 +StartTime=5/6/2004 7:36:05 PM +RealKeys=0 +EffectiveKeys=0 +DebugSecs=1 diff --git a/Game/Code/lib/PngImage/obj/adler32.obj b/Game/Code/lib/PngImage/obj/adler32.obj new file mode 100644 index 00000000..7da9fd19 Binary files /dev/null and b/Game/Code/lib/PngImage/obj/adler32.obj differ diff --git a/Game/Code/lib/PngImage/obj/deflate.obj b/Game/Code/lib/PngImage/obj/deflate.obj new file mode 100644 index 00000000..804e9334 Binary files /dev/null and b/Game/Code/lib/PngImage/obj/deflate.obj differ diff --git a/Game/Code/lib/PngImage/obj/infblock.obj b/Game/Code/lib/PngImage/obj/infblock.obj new file mode 100644 index 00000000..3bc38e41 Binary files /dev/null and b/Game/Code/lib/PngImage/obj/infblock.obj differ diff --git a/Game/Code/lib/PngImage/obj/infcodes.obj b/Game/Code/lib/PngImage/obj/infcodes.obj new file mode 100644 index 00000000..faec2222 Binary files /dev/null and b/Game/Code/lib/PngImage/obj/infcodes.obj differ diff --git a/Game/Code/lib/PngImage/obj/inffast.obj b/Game/Code/lib/PngImage/obj/inffast.obj new file mode 100644 index 00000000..62e18ceb Binary files /dev/null and b/Game/Code/lib/PngImage/obj/inffast.obj differ diff --git a/Game/Code/lib/PngImage/obj/inflate.obj b/Game/Code/lib/PngImage/obj/inflate.obj new file mode 100644 index 00000000..7dc522e0 Binary files /dev/null and b/Game/Code/lib/PngImage/obj/inflate.obj differ diff --git a/Game/Code/lib/PngImage/obj/inftrees.obj b/Game/Code/lib/PngImage/obj/inftrees.obj new file mode 100644 index 00000000..5755233f Binary files /dev/null and b/Game/Code/lib/PngImage/obj/inftrees.obj differ diff --git a/Game/Code/lib/PngImage/obj/infutil.obj b/Game/Code/lib/PngImage/obj/infutil.obj new file mode 100644 index 00000000..7e175a83 Binary files /dev/null and b/Game/Code/lib/PngImage/obj/infutil.obj differ diff --git a/Game/Code/lib/PngImage/obj/trees.obj b/Game/Code/lib/PngImage/obj/trees.obj new file mode 100644 index 00000000..81f05568 Binary files /dev/null and b/Game/Code/lib/PngImage/obj/trees.obj differ diff --git a/Game/Code/lib/PngImage/pngimage.chm b/Game/Code/lib/PngImage/pngimage.chm new file mode 100644 index 00000000..c7e51b2e Binary files /dev/null and b/Game/Code/lib/PngImage/pngimage.chm differ diff --git a/Game/Code/lib/PngImage/pngimage.dcu b/Game/Code/lib/PngImage/pngimage.dcu new file mode 100644 index 00000000..633a7430 Binary files /dev/null and b/Game/Code/lib/PngImage/pngimage.dcu differ diff --git a/Game/Code/lib/PngImage/pngimage.pas b/Game/Code/lib/PngImage/pngimage.pas new file mode 100644 index 00000000..ec712737 --- /dev/null +++ b/Game/Code/lib/PngImage/pngimage.pas @@ -0,0 +1,5205 @@ +{Portable Network Graphics Delphi 1.4361 (8 March 2003) } + +{This is the latest implementation for TPngImage component } +{It's meant to be a full replacement for the previous one. } +{There are lots of new improvements, including cleaner code, } +{full partial transparency support, speed improvements, } +{saving using ADAM 7 interlacing, better error handling, also } +{the best compression for the final image ever. And now it's } +{truly able to read about any png image. } + +{ + Version 1.4361 + 2003-03-04 - Fixed important bug for simple transparency when using + RGB, Grayscale color modes + + Version 1.436 + 2003-03-04 - * NEW * Property Pixels for direct access to pixels + * IMPROVED * Palette property (TPngObject) (read only) + Slovenian traslation for the component (Miha Petelin) + Help file update (scanline article/png->jpg example) + + Version 1.435 + 2003-11-03 - * NEW * New chunk implementation zTXt (method AddzTXt) + * NEW * New compiler flags to store the extra 8 bits + from 16 bits samples (when saving it is ignored), the + extra data may be acessed using ExtraScanline property + * Fixed * a bug on tIMe chunk + French translation included (Thanks to IBE Software) + Bugs fixed + + Version 1.432 + 2002-08-24 - * NEW * A new method, CreateAlpha will transform the + current image into partial transparency. + Help file updated with a new article on how to handle + partial transparency. + + Version 1.431 + 2002-08-14 - Fixed and tested to work on: + C++ Builder 3 + C++ Builder 5 + Delphi 3 + There was an error when setting TransparentColor, fixed + New method, RemoveTransparency to remove image + BIT TRANSPARENCY + + Version 1.43 + 2002-08-01 - * NEW * Support for Delphi 3 and C++ Builder 3 + Implements mostly some things that were missing, + a few tweaks and fixes. + + Version 1.428 + 2002-07-24 - More minor fixes (thanks to Ian Boyd) + Bit transparency fixes + * NEW * Finally support to bit transparency + (palette / rgb / grayscale -> all) + + Version 1.427 + 2002-07-19 - Lots of bugs and leaks fixed + * NEW * method to easy adding text comments, AddtEXt + * NEW * property for setting bit transparency, + TransparentColor + + Version 1.426 + 2002-07-18 - Clipboard finally fixed (hope) + Changed UseDelphi trigger to UseDelphi + * NEW * Support for bit transparency bitmaps + when assigning from/to TBitmap objects + Altough it does not support drawing transparent + parts of bit transparency pngs (only partial) + it is closer than ever + + Version 1.425 + 2002-07-01 - Clipboard methods implemented + Lots of bugs fixed + + Version 1.424 + 2002-05-16 - Scanline and AlphaScanline are now working correctly. + New methods for handling the clipboard + + Version 1.423 + 2002-05-16 - * NEW * Partial transparency for 1, 2, 4 and 8 bits is + also supported using the tRNS chunk (for palette and + grayscaling). + New bug fixes (Peter Haas). + + Version 1.422 + 2002-05-14 - Fixed some critical leaks, thanks to Peter Haas tips. + New translation for German (Peter Haas). + + Version 1.421 + 2002-05-06 - Now uses new ZLIB version, 1.1.4 with some security + fixes. + LoadFromResourceID and LoadFromResourceName added and + help file updated for that. + The resources strings are now located in pnglang.pas. + New translation for Brazilian Portuguese. + Bugs fixed. + + IMPORTANT: I'm currently looking for bugs on the library. If + anyone has found one, please send me an email and + I will fix right away. Thanks for all the help and + ideias I'm receiving so far.} + +{My new email is: gubadaud@terra.com.br} +{Website link : pngdelphi.sourceforge.net} +{Gustavo Huffenbacher Daud} + +unit pngimage; + +interface + +{Triggers avaliable (edit the fields bellow)} +{$DEFINE UseDelphi} //Disable fat vcl units (perfect to small apps) +{$DEFINE ErrorOnUnknownCritical} //Error when finds an unknown critical chunk +{$DEFINE CheckCRC} //Enables CRC checking +{$DEFINE RegisterGraphic} //Registers TPNGObject to use with TPicture +{$DEFINE PartialTransparentDraw} //Draws partial transparent images +{.$DEFINE Store16bits} //Stores the extra 8 bits from 16bits/sample +{.$DEFINE Debug} //For programming purposes +{$RANGECHECKS OFF} {$J+} + + + +uses + Windows {$IFDEF UseDelphi}, Classes, Graphics, SysUtils{$ENDIF} {$IFDEF Debug}, + dialogs{$ENDIF}, pngzlib, pnglang; + +{$IFNDEF UseDelphi} + const + soFromBeginning = 0; + soFromCurrent = 1; + soFromEnd = 2; +{$ENDIF} + +const + {ZLIB constants} + ZLIBErrors: Array[-6..2] of string = ('incompatible version (-6)', + 'buffer error (-5)', 'insufficient memory (-4)', 'data error (-3)', + 'stream error (-2)', 'file error (-1)', '(0)', 'stream end (1)', + 'need dictionary (2)'); + Z_NO_FLUSH = 0; + Z_FINISH = 4; + Z_STREAM_END = 1; + + {Avaliable PNG filters for mode 0} + FILTER_NONE = 0; + FILTER_SUB = 1; + FILTER_UP = 2; + FILTER_AVERAGE = 3; + FILTER_PAETH = 4; + + {Avaliable color modes for PNG} + COLOR_GRAYSCALE = 0; + COLOR_RGB = 2; + COLOR_PALETTE = 3; + COLOR_GRAYSCALEALPHA = 4; + COLOR_RGBALPHA = 6; + + +type + {$IFNDEF UseDelphi} + {Custom exception handler} + Exception = class(TObject) + constructor Create(Msg: String); + end; + ExceptClass = class of Exception; + TColor = ColorRef; + {$ENDIF} + + {Error types} + EPNGOutMemory = class(Exception); + EPngError = class(Exception); + EPngUnexpectedEnd = class(Exception); + EPngInvalidCRC = class(Exception); + EPngInvalidIHDR = class(Exception); + EPNGMissingMultipleIDAT = class(Exception); + EPNGZLIBError = class(Exception); + EPNGInvalidPalette = class(Exception); + EPNGInvalidFileHeader = class(Exception); + EPNGIHDRNotFirst = class(Exception); + EPNGNotExists = class(Exception); + EPNGSizeExceeds = class(Exception); + EPNGMissingPalette = class(Exception); + EPNGUnknownCriticalChunk = class(Exception); + EPNGUnknownCompression = class(Exception); + EPNGUnknownInterlace = class(Exception); + EPNGNoImageData = class(Exception); + EPNGCouldNotLoadResource = class(Exception); + EPNGCannotChangeTransparent = class(Exception); + EPNGHeaderNotPresent = class(Exception); + +type + {Direct access to pixels using R,G,B} + TRGBLine = array[word] of TRGBTriple; + pRGBLine = ^TRGBLine; + + {Same as TBitmapInfo but with allocated space for} + {palette entries} + TMAXBITMAPINFO = packed record + bmiHeader: TBitmapInfoHeader; + bmiColors: packed array[0..255] of TRGBQuad; + end; + + {Transparency mode for pngs} + TPNGTransparencyMode = (ptmNone, ptmBit, ptmPartial); + {Pointer to a cardinal type} + pCardinal = ^Cardinal; + {Access to a rgb pixel} + pRGBPixel = ^TRGBPixel; + TRGBPixel = packed record + B, G, R: Byte; + end; + + {Pointer to an array of bytes type} + TByteArray = Array[Word] of Byte; + pByteArray = ^TByteArray; + + {Forward} + TPNGObject = class; + pPointerArray = ^TPointerArray; + TPointerArray = Array[Word] of Pointer; + + {Contains a list of objects} + TPNGPointerList = class + private + fOwner: TPNGObject; + fCount : Cardinal; + fMemory: pPointerArray; + function GetItem(Index: Cardinal): Pointer; + procedure SetItem(Index: Cardinal; const Value: Pointer); + protected + {Removes an item} + function Remove(Value: Pointer): Pointer; virtual; + {Inserts an item} + procedure Insert(Value: Pointer; Position: Cardinal); + {Add a new item} + procedure Add(Value: Pointer); + {Returns an item} + property Item[Index: Cardinal]: Pointer read GetItem write SetItem; + {Set the size of the list} + procedure SetSize(const Size: Cardinal); + {Returns owner} + property Owner: TPNGObject read fOwner; + public + {Returns number of items} + property Count: Cardinal read fCount write SetSize; + {Object being either created or destroyed} + constructor Create(AOwner: TPNGObject); + destructor Destroy; override; + end; + + {Forward declaration} + TChunk = class; + TChunkClass = class of TChunk; + + {Same as TPNGPointerList but providing typecasted values} + TPNGList = class(TPNGPointerList) + private + {Used with property Item} + function GetItem(Index: Cardinal): TChunk; + public + {Removes an item} + procedure RemoveChunk(Chunk: TChunk); overload; + {Add a new chunk using the class from the parameter} + function Add(ChunkClass: TChunkClass): TChunk; + {Returns pointer to the first chunk of class} + function ItemFromClass(ChunkClass: TChunkClass): TChunk; + {Returns a chunk item from the list} + property Item[Index: Cardinal]: TChunk read GetItem; + end; + + {$IFNDEF UseDelphi} + {The STREAMs bellow are only needed in case delphi provided ones is not} + {avaliable (UseDelphi trigger not set)} + {Object becomes handles} + TCanvas = THandle; + TBitmap = HBitmap; + {Trick to work} + TPersistent = TObject; + + {Base class for all streams} + TStream = class + protected + {Returning/setting size} + function GetSize: Longint; virtual; + procedure SetSize(const Value: Longint); virtual; abstract; + {Returns/set position} + function GetPosition: Longint; virtual; + procedure SetPosition(const Value: Longint); virtual; + public + {Returns/sets current position} + property Position: Longint read GetPosition write SetPosition; + {Property returns/sets size} + property Size: Longint read GetSize write SetSize; + {Allows reading/writing data} + function Read(var Buffer; Count: Longint): Cardinal; virtual; abstract; + function Write(const Buffer; Count: Longint): Cardinal; virtual; abstract; + {Copies from another Stream} + function CopyFrom(Source: TStream; + Count: Cardinal): Cardinal; virtual; + {Seeks a stream position} + function Seek(Offset: Longint; Origin: Word): Longint; virtual; abstract; + end; + + {File stream modes} + TFileStreamMode = (fsmRead, fsmWrite, fsmCreate); + TFileStreamModeSet = set of TFileStreamMode; + + {File stream for reading from files} + TFileStream = class(TStream) + private + {Opened mode} + Filemode: TFileStreamModeSet; + {Handle} + fHandle: THandle; + protected + {Set the size of the file} + procedure SetSize(const Value: Longint); override; + public + {Seeks a file position} + function Seek(Offset: Longint; Origin: Word): Longint; override; + {Reads/writes data from/to the file} + function Read(var Buffer; Count: Longint): Cardinal; override; + function Write(const Buffer; Count: Longint): Cardinal; override; + {Stream being created and destroy} + constructor Create(Filename: String; Mode: TFileStreamModeSet); + destructor Destroy; override; + end; + + {Stream for reading from resources} + TResourceStream = class(TStream) + constructor Create(Instance: HInst; const ResName: String; ResType:PChar); + private + {Variables for reading} + Size: Integer; + Memory: Pointer; + Position: Integer; + protected + {Set the size of the file} + procedure SetSize(const Value: Longint); override; + public + {Stream processing} + function Read(var Buffer; Count: Integer): Cardinal; override; + function Seek(Offset: Integer; Origin: Word): Longint; override; + function Write(const Buffer; Count: Longint): Cardinal; override; + end; + {$ENDIF} + + {Forward} + TChunkIHDR = class; + {Interlace method} + TInterlaceMethod = (imNone, imAdam7); + {Compression level type} + TCompressionLevel = 0..9; + {Filters type} + TFilter = (pfNone, pfSub, pfUp, pfAverage, pfPaeth); + TFilters = set of TFilter; + + {Png implementation object} + TPngObject = class{$IFDEF UseDelphi}(TGraphic){$ENDIF} + protected + {Gamma table values} + GammaTable, InverseGamma: Array[Byte] of Byte; + procedure InitializeGamma; + private + {Temporary palette} + TempPalette: HPalette; + {Filters to test to encode} + fFilters: TFilters; + {Compression level for ZLIB} + fCompressionLevel: TCompressionLevel; + {Maximum size for IDAT chunks} + fMaxIdatSize: Cardinal; + {Returns if image is interlaced} + fInterlaceMethod: TInterlaceMethod; + {Chunks object} + fChunkList: TPngList; + {Clear all chunks in the list} + procedure ClearChunks; + {Returns if header is present} + function HeaderPresent: Boolean; + {Returns linesize and byte offset for pixels} + procedure GetPixelInfo(var LineSize, Offset: Cardinal); + procedure SetMaxIdatSize(const Value: Cardinal); + function GetAlphaScanline(const LineIndex: Integer): pByteArray; + function GetScanline(const LineIndex: Integer): Pointer; + {$IFDEF Store16bits} + function GetExtraScanline(const LineIndex: Integer): Pointer; + {$ENDIF} + function GetTransparencyMode: TPNGTransparencyMode; + function GetTransparentColor: TColor; + procedure SetTransparentColor(const Value: TColor); + protected + {Returns the image palette} + function GetPalette: HPALETTE; {$IFDEF UseDelphi}override;{$ENDIF} + {Returns/sets image width and height} + function GetWidth: Integer; {$IFDEF UseDelphi}override;{$ENDIF} + function GetHeight: Integer; {$IFDEF UseDelphi}override; {$ENDIF} + procedure SetWidth(Value: Integer); {$IFDEF UseDelphi}override; {$ENDIF} + procedure SetHeight(Value: Integer); {$IFDEF UseDelphi}override;{$ENDIF} + {Assigns from another TPNGObject} + procedure AssignPNG(Source: TPNGObject); + {Returns if the image is empty} + function GetEmpty: Boolean; {$IFDEF UseDelphi}override; {$ENDIF} + {Used with property Header} + function GetHeader: TChunkIHDR; + {Draws using partial transparency} + procedure DrawPartialTrans(DC: HDC; Rect: TRect); + {$IFDEF UseDelphi} + {Returns if the image is transparent} + function GetTransparent: Boolean; override; + {$ENDIF} + {Returns a pixel} + function GetPixels(const X, Y: Integer): TColor; virtual; + procedure SetPixels(const X, Y: Integer; const Value: TColor); virtual; + public + {Generates alpha information} + procedure CreateAlpha; + {Removes the image transparency} + procedure RemoveTransparency; + {Transparent color} + property TransparentColor: TColor read GetTransparentColor write + SetTransparentColor; + {Add text chunk, TChunkTEXT, TChunkzTXT} + procedure AddtEXt(const Keyword, Text: String); + procedure AddzTXt(const Keyword, Text: String); + {$IFDEF UseDelphi} + {Saves to clipboard format (thanks to Antoine Pottern)} + procedure SaveToClipboardFormat(var AFormat: Word; var AData: THandle; + var APalette: HPalette); override; + procedure LoadFromClipboardFormat(AFormat: Word; AData: THandle; + APalette: HPalette); override; + {$ENDIF} + {Calling errors} + procedure RaiseError(ExceptionClass: ExceptClass; Text: String); + {Returns a scanline from png} + property Scanline[const Index: Integer]: Pointer read GetScanline; + {$IFDEF Store16bits} + property ExtraScanline[const Index: Integer]: Pointer read GetExtraScanline; + {$ENDIF} + property AlphaScanline[const Index: Integer]: pByteArray read GetAlphaScanline; + {Returns pointer to the header} + property Header: TChunkIHDR read GetHeader; + {Returns the transparency mode used by this png} + property TransparencyMode: TPNGTransparencyMode read GetTransparencyMode; + {Assigns from another object} + procedure Assign(Source: TPersistent);{$IFDEF UseDelphi}override;{$ENDIF} + {Assigns to another object} + procedure AssignTo(Dest: TPersistent);{$IFDEF UseDelphi}override;{$ENDIF} + {Assigns from a windows bitmap handle} + procedure AssignHandle(Handle: HBitmap; Transparent: Boolean; + TransparentColor: ColorRef); + {Draws the image into a canvas} + procedure Draw(ACanvas: TCanvas; const Rect: TRect); + {$IFDEF UseDelphi}override;{$ENDIF} + {Width and height properties} + property Width: Integer read GetWidth; + property Height: Integer read GetHeight; + {Returns if the image is interlaced} + property InterlaceMethod: TInterlaceMethod read fInterlaceMethod + write fInterlaceMethod; + {Filters to test to encode} + property Filters: TFilters read fFilters write fFilters; + {Maximum size for IDAT chunks, default and minimum is 65536} + property MaxIdatSize: Cardinal read fMaxIdatSize write SetMaxIdatSize; + {Property to return if the image is empty or not} + property Empty: Boolean read GetEmpty; + {Compression level} + property CompressionLevel: TCompressionLevel read fCompressionLevel + write fCompressionLevel; + {Access to the chunk list} + property Chunks: TPngList read fChunkList; + {Object being created and destroyed} + constructor Create; {$IFDEF UseDelphi}override;{$ENDIF} + destructor Destroy; override; + {$IFNDEF UseDelphi}procedure LoadFromFile(const Filename: String);{$ENDIF} + {$IFNDEF UseDelphi}procedure SaveToFile(const Filename: String);{$ENDIF} + procedure LoadFromStream(Stream: TStream); {$IFDEF UseDelphi}override;{$ENDIF} + procedure SaveToStream(Stream: TStream); {$IFDEF UseDelphi}override;{$ENDIF} + {Loading the image from resources} + procedure LoadFromResourceName(Instance: HInst; const Name: String); + procedure LoadFromResourceID(Instance: HInst; ResID: Integer); + {Access to the png pixels} + property Pixels[const X, Y: Integer]: TColor read GetPixels write SetPixels; + {Palette property} + {$IFNDEF UseDelphi}property Palette: HPalette read GetPalette;{$ENDIF} + end; + + {Chunk name object} + TChunkName = Array[0..3] of Char; + + {Global chunk object} + TChunk = class + private + {Contains data} + fData: Pointer; + fDataSize: Cardinal; + {Stores owner} + fOwner: TPngObject; + {Stores the chunk name} + fName: TChunkName; + {Returns pointer to the TChunkIHDR} + function GetHeader: TChunkIHDR; + {Used with property index} + function GetIndex: Integer; + {Should return chunk class/name} + class function GetName: String; virtual; + {Returns the chunk name} + function GetChunkName: String; + public + {Returns index from list} + property Index: Integer read GetIndex; + {Returns pointer to the TChunkIHDR} + property Header: TChunkIHDR read GetHeader; + {Resize the data} + procedure ResizeData(const NewSize: Cardinal); + {Returns data and size} + property Data: Pointer read fData; + property DataSize: Cardinal read fDataSize; + {Assigns from another TChunk} + procedure Assign(Source: TChunk); virtual; + {Returns owner} + property Owner: TPngObject read fOwner; + {Being destroyed/created} + constructor Create(Owner: TPngObject); virtual; + destructor Destroy; override; + {Returns chunk class/name} + property Name: String read GetChunkName; + {Loads the chunk from a stream} + function LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; virtual; + {Saves the chunk to a stream} + function SaveData(Stream: TStream): Boolean; + function SaveToStream(Stream: TStream): Boolean; virtual; + end; + + {Chunk classes} + TChunkIEND = class(TChunk); {End chunk} + + {IHDR data} + pIHDRData = ^TIHDRData; + TIHDRData = packed record + Width, Height: Cardinal; + BitDepth, + ColorType, + CompressionMethod, + FilterMethod, + InterlaceMethod: Byte; + end; + + {Information header chunk} + TChunkIHDR = class(TChunk) + private + {Current image} + ImageHandle: HBitmap; + ImageDC: HDC; + + {Output windows bitmap} + HasPalette: Boolean; + BitmapInfo: TMaxBitmapInfo; + BytesPerRow: Integer; + {Stores the image bytes} + {$IFDEF Store16bits}ExtraImageData: Pointer;{$ENDIF} + ImageData: pointer; + ImageAlpha: Pointer; + + {Contains all the ihdr data} + IHDRData: TIHDRData; + protected + {Resizes the image data to fill the color type, bit depth, } + {width and height parameters} + procedure PrepareImageData; + {Release allocated ImageData memory} + procedure FreeImageData; + public + {Properties} + property Width: Cardinal read IHDRData.Width write IHDRData.Width; + property Height: Cardinal read IHDRData.Height write IHDRData.Height; + property BitDepth: Byte read IHDRData.BitDepth write IHDRData.BitDepth; + property ColorType: Byte read IHDRData.ColorType write IHDRData.ColorType; + property CompressionMethod: Byte read IHDRData.CompressionMethod + write IHDRData.CompressionMethod; + property FilterMethod: Byte read IHDRData.FilterMethod + write IHDRData.FilterMethod; + property InterlaceMethod: Byte read IHDRData.InterlaceMethod + write IHDRData.InterlaceMethod; + {Loads the chunk from a stream} + function LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; override; + {Saves the chunk to a stream} + function SaveToStream(Stream: TStream): Boolean; override; + {Destructor/constructor} + constructor Create(Owner: TPngObject); override; + destructor Destroy; override; + {Assigns from another TChunk} + procedure Assign(Source: TChunk); override; + end; + + {Gamma chunk} + TChunkgAMA = class(TChunk) + private + {Returns/sets the value for the gamma chunk} + function GetValue: Cardinal; + procedure SetValue(const Value: Cardinal); + public + {Returns/sets gamma value} + property Gamma: Cardinal read GetValue write SetValue; + {Loading the chunk from a stream} + function LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; override; + {Being created} + constructor Create(Owner: TPngObject); override; + {Assigns from another TChunk} + procedure Assign(Source: TChunk); override; + end; + + {ZLIB Decompression extra information} + TZStreamRec2 = packed record + {From ZLIB} + ZLIB: TZStreamRec; + {Additional info} + Data: Pointer; + fStream : TStream; + end; + + {Palette chunk} + TChunkPLTE = class(TChunk) + private + {Number of items in the palette} + fCount: Integer; + {Contains the palette handle} + function GetPaletteItem(Index: Byte): TRGBQuad; + public + {Returns the color for each item in the palette} + property Item[Index: Byte]: TRGBQuad read GetPaletteItem; + {Returns the number of items in the palette} + property Count: Integer read fCount; + {Loads the chunk from a stream} + function LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; override; + {Saves the chunk to a stream} + function SaveToStream(Stream: TStream): Boolean; override; + {Assigns from another TChunk} + procedure Assign(Source: TChunk); override; + end; + + {Transparency information} + TChunktRNS = class(TChunk) + private + fBitTransparency: Boolean; + function GetTransparentColor: ColorRef; + {Returns the transparent color} + procedure SetTransparentColor(const Value: ColorRef); + public + {Palette values for transparency} + PaletteValues: Array[Byte] of Byte; + {Returns if it uses bit transparency} + property BitTransparency: Boolean read fBitTransparency; + {Returns the transparent color} + property TransparentColor: ColorRef read GetTransparentColor write + SetTransparentColor; + {Loads/saves the chunk from/to a stream} + function LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; override; + function SaveToStream(Stream: TStream): Boolean; override; + {Assigns from another TChunk} + procedure Assign(Source: TChunk); override; + end; + + {Actual image information} + TChunkIDAT = class(TChunk) + private + {Holds another pointer to the TChunkIHDR} + Header: TChunkIHDR; + {Stores temporary image width and height} + ImageWidth, ImageHeight: Integer; + {Size in bytes of each line and offset} + Row_Bytes, Offset : Cardinal; + {Contains data for the lines} + Encode_Buffer: Array[0..5] of pByteArray; + Row_Buffer: Array[Boolean] of pByteArray; + {Variable to invert the Row_Buffer used} + RowUsed: Boolean; + {Ending position for the current IDAT chunk} + EndPos: Integer; + {Filter the current line} + procedure FilterRow; + {Filter to encode and returns the best filter} + function FilterToEncode: Byte; + {Reads ZLIB compressed data} + function IDATZlibRead(var ZLIBStream: TZStreamRec2; Buffer: Pointer; + Count: Integer; var EndPos: Integer; var crcfile: Cardinal): Integer; + {Compress and writes IDAT data} + procedure IDATZlibWrite(var ZLIBStream: TZStreamRec2; Buffer: Pointer; + const Length: Cardinal); + procedure FinishIDATZlib(var ZLIBStream: TZStreamRec2); + {Prepares the palette} + procedure PreparePalette; + protected + {Decode interlaced image} + procedure DecodeInterlacedAdam7(Stream: TStream; + var ZLIBStream: TZStreamRec2; const Size: Integer; var crcfile: Cardinal); + {Decode non interlaced imaged} + procedure DecodeNonInterlaced(Stream: TStream; + var ZLIBStream: TZStreamRec2; const Size: Integer; + var crcfile: Cardinal); + protected + {Encode non interlaced images} + procedure EncodeNonInterlaced(Stream: TStream; + var ZLIBStream: TZStreamRec2); + {Encode interlaced images} + procedure EncodeInterlacedAdam7(Stream: TStream; + var ZLIBStream: TZStreamRec2); + protected + {Memory copy methods to decode} + procedure CopyNonInterlacedRGB8( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyNonInterlacedRGB16( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyNonInterlacedPalette148( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyNonInterlacedPalette2( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyNonInterlacedGray2( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyNonInterlacedGrayscale16( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyNonInterlacedRGBAlpha8( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyNonInterlacedRGBAlpha16( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyNonInterlacedGrayscaleAlpha8( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyNonInterlacedGrayscaleAlpha16( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyInterlacedRGB8(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyInterlacedRGB16(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyInterlacedPalette148(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyInterlacedPalette2(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyInterlacedGray2(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyInterlacedGrayscale16(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyInterlacedRGBAlpha8(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyInterlacedRGBAlpha16(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyInterlacedGrayscaleAlpha8(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyInterlacedGrayscaleAlpha16(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + protected + {Memory copy methods to encode} + procedure EncodeNonInterlacedRGB8(Src, Dest, Trans: pChar); + procedure EncodeNonInterlacedRGB16(Src, Dest, Trans: pChar); + procedure EncodeNonInterlacedGrayscale16(Src, Dest, Trans: pChar); + procedure EncodeNonInterlacedPalette148(Src, Dest, Trans: pChar); + procedure EncodeNonInterlacedRGBAlpha8(Src, Dest, Trans: pChar); + procedure EncodeNonInterlacedRGBAlpha16(Src, Dest, Trans: pChar); + procedure EncodeNonInterlacedGrayscaleAlpha8(Src, Dest, Trans: pChar); + procedure EncodeNonInterlacedGrayscaleAlpha16(Src, Dest, Trans: pChar); + procedure EncodeInterlacedRGB8(const Pass: Byte; Src, Dest, Trans: pChar); + procedure EncodeInterlacedRGB16(const Pass: Byte; Src, Dest, Trans: pChar); + procedure EncodeInterlacedPalette148(const Pass: Byte; + Src, Dest, Trans: pChar); + procedure EncodeInterlacedGrayscale16(const Pass: Byte; + Src, Dest, Trans: pChar); + procedure EncodeInterlacedRGBAlpha8(const Pass: Byte; + Src, Dest, Trans: pChar); + procedure EncodeInterlacedRGBAlpha16(const Pass: Byte; + Src, Dest, Trans: pChar); + procedure EncodeInterlacedGrayscaleAlpha8(const Pass: Byte; + Src, Dest, Trans: pChar); + procedure EncodeInterlacedGrayscaleAlpha16(const Pass: Byte; + Src, Dest, Trans: pChar); + public + {Loads the chunk from a stream} + function LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; override; + {Saves the chunk to a stream} + function SaveToStream(Stream: TStream): Boolean; override; + end; + + {Image last modification chunk} + TChunktIME = class(TChunk) + private + {Holds the variables} + fYear: Word; + fMonth, fDay, fHour, fMinute, fSecond: Byte; + public + {Returns/sets variables} + property Year: Word read fYear write fYear; + property Month: Byte read fMonth write fMonth; + property Day: Byte read fDay write fDay; + property Hour: Byte read fHour write fHour; + property Minute: Byte read fMinute write fMinute; + property Second: Byte read fSecond write fSecond; + {Loads the chunk from a stream} + function LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; override; + {Saves the chunk to a stream} + function SaveToStream(Stream: TStream): Boolean; override; + end; + + {Textual data} + TChunktEXt = class(TChunk) + private + fKeyword, fText: String; + public + {Keyword and text} + property Keyword: String read fKeyword write fKeyword; + property Text: String read fText write fText; + {Loads the chunk from a stream} + function LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; override; + {Saves the chunk to a stream} + function SaveToStream(Stream: TStream): Boolean; override; + {Assigns from another TChunk} + procedure Assign(Source: TChunk); override; + end; + + {zTXT chunk} + TChunkzTXt = class(TChunktEXt) + {Loads the chunk from a stream} + function LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; override; + {Saves the chunk to a stream} + function SaveToStream(Stream: TStream): Boolean; override; + end; + +{Here we test if it's c++ builder or delphi version 3 or less} +{$IFDEF VER110}{$DEFINE DelphiBuilder3Less}{$ENDIF} +{$IFDEF VER100}{$DEFINE DelphiBuilder3Less}{$ENDIF} +{$IFDEF VER93}{$DEFINE DelphiBuilder3Less}{$ENDIF} +{$IFDEF VER90}{$DEFINE DelphiBuilder3Less}{$ENDIF} +{$IFDEF VER80}{$DEFINE DelphiBuilder3Less}{$ENDIF} + + +{Registers a new chunk class} +procedure RegisterChunk(ChunkClass: TChunkClass); +{Calculates crc} +function update_crc(crc: {$IFNDEF DelphiBuilder3Less}Cardinal{$ELSE}Integer + {$ENDIF}; buf: pByteArray; len: Integer): Cardinal; +{Invert bytes using assembly} +function ByteSwap(const a: integer): integer; + +implementation + +var + ChunkClasses: TPngPointerList; + {Table of CRCs of all 8-bit messages} + crc_table: Array[0..255] of Cardinal; + {Flag: has the table been computed? Initially false} + crc_table_computed: Boolean; + +{Draw transparent image using transparent color} +procedure DrawTransparentBitmap(dc: HDC; srcBits: Pointer; + var srcHeader: TBitmapInfoHeader; + srcBitmapInfo: pBitmapInfo; Rect: TRect; cTransparentColor: COLORREF); +var + cColor: COLORREF; + bmAndBack, bmAndObject, bmAndMem: HBITMAP; + bmBackOld, bmObjectOld, bmMemOld: HBITMAP; + hdcMem, hdcBack, hdcObject, hdcTemp: HDC; + ptSize, orgSize: TPOINT; + OldBitmap, DrawBitmap: HBITMAP; +begin + hdcTemp := CreateCompatibleDC(dc); + // Select the bitmap + DrawBitmap := CreateDIBitmap(dc, srcHeader, CBM_INIT, srcBits, srcBitmapInfo^, + DIB_RGB_COLORS); + OldBitmap := SelectObject(hdcTemp, DrawBitmap); + + // Sizes + OrgSize.x := abs(srcHeader.biWidth); + OrgSize.y := abs(srcHeader.biHeight); + ptSize.x := Rect.Right - Rect.Left; // Get width of bitmap + ptSize.y := Rect.Bottom - Rect.Top; // Get height of bitmap + + // Create some DCs to hold temporary data. + hdcBack := CreateCompatibleDC(dc); + hdcObject := CreateCompatibleDC(dc); + hdcMem := CreateCompatibleDC(dc); + + // Create a bitmap for each DC. DCs are required for a number of + // GDI functions. + + // Monochrome DCs + bmAndBack := CreateBitmap(ptSize.x, ptSize.y, 1, 1, nil); + bmAndObject := CreateBitmap(ptSize.x, ptSize.y, 1, 1, nil); + + bmAndMem := CreateCompatibleBitmap(dc, ptSize.x, ptSize.y); + + // Each DC must select a bitmap object to store pixel data. + bmBackOld := SelectObject(hdcBack, bmAndBack); + bmObjectOld := SelectObject(hdcObject, bmAndObject); + bmMemOld := SelectObject(hdcMem, bmAndMem); + + // Set the background color of the source DC to the color. + // contained in the parts of the bitmap that should be transparent + cColor := SetBkColor(hdcTemp, cTransparentColor); + + // Create the object mask for the bitmap by performing a BitBlt + // from the source bitmap to a monochrome bitmap. + StretchBlt(hdcObject, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, + orgSize.x, orgSize.y, SRCCOPY); + + // Set the background color of the source DC back to the original + // color. + SetBkColor(hdcTemp, cColor); + + // Create the inverse of the object mask. + BitBlt(hdcBack, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, + NOTSRCCOPY); + + // Copy the background of the main DC to the destination. + BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, dc, Rect.Left, Rect.Top, + SRCCOPY); + + // Mask out the places where the bitmap will be placed. + BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, SRCAND); + + // Mask out the transparent colored pixels on the bitmap. +// BitBlt(hdcTemp, 0, 0, ptSize.x, ptSize.y, hdcBack, 0, 0, SRCAND); + StretchBlt(hdcTemp, 0, 0, OrgSize.x, OrgSize.y, hdcBack, 0, 0, + PtSize.x, PtSize.y, SRCAND); + + // XOR the bitmap with the background on the destination DC. + StretchBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, + OrgSize.x, OrgSize.y, SRCPAINT); + + // Copy the destination to the screen. + BitBlt(dc, Rect.Left, Rect.Top, ptSize.x, ptSize.y, hdcMem, 0, 0, + SRCCOPY); + + // Delete the memory bitmaps. + DeleteObject(SelectObject(hdcBack, bmBackOld)); + DeleteObject(SelectObject(hdcObject, bmObjectOld)); + DeleteObject(SelectObject(hdcMem, bmMemOld)); + DeleteObject(SelectObject(hdcTemp, OldBitmap)); + + // Delete the memory DCs. + DeleteDC(hdcMem); + DeleteDC(hdcBack); + DeleteDC(hdcObject); + DeleteDC(hdcTemp); +end; + +{Make the table for a fast CRC.} +procedure make_crc_table; +var + c: Cardinal; + n, k: Integer; +begin + + {fill the crc table} + for n := 0 to 255 do + begin + c := Cardinal(n); + for k := 0 to 7 do + begin + if Boolean(c and 1) then + c := $edb88320 xor (c shr 1) + else + c := c shr 1; + end; + crc_table[n] := c; + end; + + {The table has already being computated} + crc_table_computed := true; +end; + +{Update a running CRC with the bytes buf[0..len-1]--the CRC + should be initialized to all 1's, and the transmitted value + is the 1's complement of the final running CRC (see the + crc() routine below)).} +function update_crc(crc: {$IFNDEF DelphiBuilder3Less}Cardinal{$ELSE}Integer + {$ENDIF}; buf: pByteArray; len: Integer): Cardinal; +var + c: Cardinal; + n: Integer; +begin + c := crc; + + {Create the crc table in case it has not being computed yet} + if not crc_table_computed then make_crc_table; + + {Update} + for n := 0 to len - 1 do + c := crc_table[(c XOR buf^[n]) and $FF] XOR (c shr 8); + + {Returns} + Result := c; +end; + +{$IFNDEF UseDelphi} + function FileExists(Filename: String): Boolean; + var + FindFile: THandle; + FindData: TWin32FindData; + begin + FindFile := FindFirstFile(PChar(Filename), FindData); + Result := FindFile <> INVALID_HANDLE_VALUE; + if Result then Windows.FindClose(FindFile); + end; + + +{$ENDIF} + +{$IFNDEF UseDelphi} + {Exception implementation} + constructor Exception.Create(Msg: String); + begin + end; +{$ENDIF} + +{Calculates the paeth predictor} +function PaethPredictor(a, b, c: Byte): Byte; +var + pa, pb, pc: Integer; +begin + { a = left, b = above, c = upper left } + pa := abs(b - c); { distances to a, b, c } + pb := abs(a - c); + pc := abs(a + b - c * 2); + + { return nearest of a, b, c, breaking ties in order a, b, c } + if (pa <= pb) and (pa <= pc) then + Result := a + else + if pb <= pc then + Result := b + else + Result := c; +end; + +{Invert bytes using assembly} +function ByteSwap(const a: integer): integer; +asm + bswap eax +end; +function ByteSwap16(inp:word): word; +asm + bswap eax + shr eax, 16 +end; + +{Calculates number of bytes for the number of pixels using the} +{color mode in the paramenter} +function BytesForPixels(const Pixels: Integer; const ColorType, + BitDepth: Byte): Integer; +begin + case ColorType of + {Palette and grayscale contains a single value, for palette} + {an value of size 2^bitdepth pointing to the palette index} + {and grayscale the value from 0 to 2^bitdepth with color intesity} + COLOR_GRAYSCALE, COLOR_PALETTE: + Result := (Pixels * BitDepth + 7) div 8; + {RGB contains 3 values R, G, B with size 2^bitdepth each} + COLOR_RGB: + Result := (Pixels * BitDepth * 3) div 8; + {Contains one value followed by alpha value booth size 2^bitdepth} + COLOR_GRAYSCALEALPHA: + Result := (Pixels * BitDepth * 2) div 8; + {Contains four values size 2^bitdepth, Red, Green, Blue and alpha} + COLOR_RGBALPHA: + Result := (Pixels * BitDepth * 4) div 8; + else + Result := 0; + end {case ColorType} +end; + +type + pChunkClassInfo = ^TChunkClassInfo; + TChunkClassInfo = record + ClassName: TChunkClass; + end; + +{Register a chunk type} +procedure RegisterChunk(ChunkClass: TChunkClass); +var + NewClass: pChunkClassInfo; +begin + {In case the list object has not being created yet} + if ChunkClasses = nil then ChunkClasses := TPngPointerList.Create(nil); + + {Add this new class} + new(NewClass); + NewClass^.ClassName := ChunkClass; + ChunkClasses.Add(NewClass); +end; + +{Free chunk class list} +procedure FreeChunkClassList; +var + i: Integer; +begin + if (ChunkClasses <> nil) then + begin + FOR i := 0 TO ChunkClasses.Count - 1 do + Dispose(pChunkClassInfo(ChunkClasses.Item[i])); + ChunkClasses.Free; + end; +end; + +{Registering of common chunk classes} +procedure RegisterCommonChunks; +begin + {Important chunks} + RegisterChunk(TChunkIEND); + RegisterChunk(TChunkIHDR); + RegisterChunk(TChunkIDAT); + RegisterChunk(TChunkPLTE); + RegisterChunk(TChunkgAMA); + RegisterChunk(TChunktRNS); + + {Not so important chunks} + RegisterChunk(TChunktIME); + RegisterChunk(TChunktEXt); + RegisterChunk(TChunkzTXt); +end; + +{Creates a new chunk of this class} +function CreateClassChunk(Owner: TPngObject; Name: TChunkName): TChunk; +var + i : Integer; + NewChunk: TChunkClass; +begin + {Looks for this chunk} + NewChunk := TChunk; {In case there is no registered class for this} + + {Looks for this class in all registered chunks} + if Assigned(ChunkClasses) then + FOR i := 0 TO ChunkClasses.Count - 1 DO + begin + if pChunkClassInfo(ChunkClasses.Item[i])^.ClassName.GetName = Name then + begin + NewChunk := pChunkClassInfo(ChunkClasses.Item[i])^.ClassName; + break; + end; + end; + + {Returns chunk class} + Result := NewChunk.Create(Owner); + Result.fName := Name; +end; + +{ZLIB support} + +const + ZLIBAllocate = High(Word); + +{Initializes ZLIB for decompression} +function ZLIBInitInflate(Stream: TStream): TZStreamRec2; +begin + {Fill record} + Fillchar(Result, SIZEOF(TZStreamRec2), #0); + + {Set internal record information} + with Result do + begin + GetMem(Data, ZLIBAllocate); + fStream := Stream; + end; + + {Init decompression} + InflateInit_(Result.zlib, zlib_version, SIZEOF(TZStreamRec)); +end; + +{Initializes ZLIB for compression} +function ZLIBInitDeflate(Stream: TStream; + Level: TCompressionlevel; Size: Cardinal): TZStreamRec2; +begin + {Fill record} + Fillchar(Result, SIZEOF(TZStreamRec2), #0); + + {Set internal record information} + with Result, ZLIB do + begin + GetMem(Data, Size); + fStream := Stream; + next_out := Data; + avail_out := Size; + end; + + {Inits compression} + deflateInit_(Result.zlib, Level, zlib_version, sizeof(TZStreamRec)); +end; + +{Terminates ZLIB for compression} +procedure ZLIBTerminateDeflate(var ZLIBStream: TZStreamRec2); +begin + {Terminates decompression} + DeflateEnd(ZLIBStream.zlib); + {Free internal record} + FreeMem(ZLIBStream.Data, ZLIBAllocate); +end; + +{Terminates ZLIB for decompression} +procedure ZLIBTerminateInflate(var ZLIBStream: TZStreamRec2); +begin + {Terminates decompression} + InflateEnd(ZLIBStream.zlib); + {Free internal record} + FreeMem(ZLIBStream.Data, ZLIBAllocate); +end; + +{Decompresses ZLIB into a memory address} +function DecompressZLIB(const Input: Pointer; InputSize: Integer; + var Output: Pointer; var OutputSize: Integer; + var ErrorOutput: String): Boolean; +var + StreamRec : TZStreamRec; + Buffer : Array[Byte] of Byte; + InflateRet: Integer; +begin + with StreamRec do + begin + {Initializes} + Result := True; + OutputSize := 0; + + {Prepares the data to decompress} + FillChar(StreamRec, SizeOf(TZStreamRec), #0); + InflateInit_(StreamRec, zlib_version, SIZEOF(TZStreamRec)); + next_in := Input; + avail_in := InputSize; + + {Decodes data} + repeat + {In case it needs an output buffer} + if (avail_out = 0) then + begin + next_out := @Buffer; + avail_out := SizeOf(Buffer); + end {if (avail_out = 0)}; + + {Decompress and put in output} + InflateRet := inflate(StreamRec, 0); + if (InflateRet = Z_STREAM_END) or (InflateRet = 0) then + begin + {Reallocates output buffer} + inc(OutputSize, total_out); + if Output = nil then + GetMem(Output, OutputSize) else ReallocMem(Output, OutputSize); + {Copies the new data} + CopyMemory(Ptr(Longint(Output) + OutputSize - total_out), + @Buffer, total_out); + end {if (InflateRet = Z_STREAM_END) or (InflateRet = 0)} + {Now tests for errors} + else if InflateRet < 0 then + begin + Result := False; + ErrorOutput := StreamRec.msg; + InflateEnd(StreamRec); + Exit; + end {if InflateRet < 0} + until InflateRet = Z_STREAM_END; + + {Terminates decompression} + InflateEnd(StreamRec); + end {with StreamRec} + +end; + +{Compresses ZLIB into a memory address} +function CompressZLIB(Input: Pointer; InputSize, CompressionLevel: Integer; + var Output: Pointer; var OutputSize: Integer; + var ErrorOutput: String): Boolean; +var + StreamRec : TZStreamRec; + Buffer : Array[Byte] of Byte; + DeflateRet: Integer; +begin + with StreamRec do + begin + Result := True; {By default returns TRUE as everything might have gone ok} + OutputSize := 0; {Initialize} + {Prepares the data to compress} + FillChar(StreamRec, SizeOf(TZStreamRec), #0); + DeflateInit_(StreamRec, CompressionLevel,zlib_version, SIZEOF(TZStreamRec)); + + next_in := Input; + avail_in := InputSize; + + while avail_in > 0 do + begin + {When it needs new buffer to stores the compressed data} + if avail_out = 0 then + begin + {Restore buffer} + next_out := @Buffer; + avail_out := SizeOf(Buffer); + end {if avail_out = 0}; + + {Compresses} + DeflateRet := deflate(StreamRec, Z_FINISH); + + if (DeflateRet = Z_STREAM_END) or (DeflateRet = 0) then + begin + {Updates the output memory} + inc(OutputSize, total_out); + if Output = nil then + GetMem(Output, OutputSize) else ReallocMem(Output, OutputSize); + + {Copies the new data} + CopyMemory(Ptr(Longint(Output) + OutputSize - total_out), + @Buffer, total_out); + end {if (InflateRet = Z_STREAM_END) or (InflateRet = 0)} + {Now tests for errors} + else if DeflateRet < 0 then + begin + Result := False; + ErrorOutput := StreamRec.msg; + DeflateEnd(StreamRec); + Exit; + end {if InflateRet < 0} + + end {while avail_in > 0}; + + {Finishes compressing} + DeflateEnd(StreamRec); + end {with StreamRec} + +end; + +{TPngPointerList implementation} + +{Object being created} +constructor TPngPointerList.Create(AOwner: TPNGObject); +begin + inherited Create; {Let ancestor work} + {Holds owner} + fOwner := AOwner; + {Memory pointer not being used yet} + fMemory := nil; + {No items yet} + fCount := 0; +end; + +{Removes value from the list} +function TPngPointerList.Remove(Value: Pointer): Pointer; +var + I, Position: Integer; +begin + {Gets item position} + Position := -1; + FOR I := 0 TO Count - 1 DO + if Value = Item[I] then Position := I; + {In case a match was found} + if Position >= 0 then + begin + Result := Item[Position]; {Returns pointer} + {Remove item and move memory} + Dec(fCount); + if Position < Integer(FCount) then + System.Move(fMemory^[Position + 1], fMemory^[Position], + (Integer(fCount) - Position) * SizeOf(Pointer)); + end {if Position >= 0} else Result := nil +end; + +{Add a new value in the list} +procedure TPngPointerList.Add(Value: Pointer); +begin + Count := Count + 1; + Item[Count - 1] := Value; +end; + + +{Object being destroyed} +destructor TPngPointerList.Destroy; +begin + {Release memory if needed} + if fMemory <> nil then + FreeMem(fMemory, fCount * sizeof(Pointer)); + + {Free things} + inherited Destroy; +end; + +{Returns one item from the list} +function TPngPointerList.GetItem(Index: Cardinal): Pointer; +begin + if (Index <= Count - 1) then + Result := fMemory[Index] + else + {In case it's out of bounds} + Result := nil; +end; + +{Inserts a new item in the list} +procedure TPngPointerList.Insert(Value: Pointer; Position: Cardinal); +begin + if (Position < Count) then + begin + {Increase item count} + SetSize(Count + 1); + {Move other pointers} + if Position < Count then + System.Move(fMemory^[Position], fMemory^[Position + 1], + (Count - Position - 1) * SizeOf(Pointer)); + {Sets item} + Item[Position] := Value; + end; +end; + +{Sets one item from the list} +procedure TPngPointerList.SetItem(Index: Cardinal; const Value: Pointer); +begin + {If index is in bounds, set value} + if (Index <= Count - 1) then + fMemory[Index] := Value +end; + +{This method resizes the list} +procedure TPngPointerList.SetSize(const Size: Cardinal); +begin + {Sets the size} + if (fMemory = nil) and (Size > 0) then + GetMem(fMemory, Size * SIZEOF(Pointer)) + else + if Size > 0 then {Only realloc if the new size is greater than 0} + ReallocMem(fMemory, Size * SIZEOF(Pointer)) + else + {In case user is resize to 0 items} + begin + FreeMem(fMemory); + fMemory := nil; + end; + {Update count} + fCount := Size; +end; + +{TPNGList implementation} + +{Removes an item} +procedure TPNGList.RemoveChunk(Chunk: TChunk); +begin + Remove(Chunk); + Chunk.Free +end; + +{Add a new item} +function TPNGList.Add(ChunkClass: TChunkClass): TChunk; +var + IHDR: TChunkIHDR; + IEND: TChunkIEND; + + IDAT: TChunkIDAT; + PLTE: TChunkPLTE; +begin + Result := nil; {Default result} + {Adding these is not allowed} + if (ChunkClass = TChunkIHDR) or (ChunkClass = TChunkIDAT) or + (ChunkClass = TChunkPLTE) or (ChunkClass = TChunkIEND) then + fOwner.RaiseError(EPngError, EPNGCannotAddChunkText) + {Two of these is not allowed} + else if ((ChunkClass = TChunkgAMA) and (ItemFromClass(TChunkgAMA) <> nil)) or + ((ChunkClass = TChunktRNS) and (ItemFromClass(TChunktRNS) <> nil)) then + fOwner.RaiseError(EPngError, EPNGCannotAddChunkText) + {There must have an IEND and IHDR chunk} + else if (ItemFromClass(TChunkIEND) = nil) or + (ItemFromClass(TChunkIHDR) = nil) then + fOwner.RaiseError(EPngError, EPNGCannotAddInvalidImageText) + else + begin + {Get common chunks} + IHDR := ItemFromClass(TChunkIHDR) as TChunkIHDR; + IEND := ItemFromClass(TChunkIEND) as TChunkIEND; + {Create new chunk} + Result := ChunkClass.Create(Owner); + {Add to the list} + if (ChunkClass = TChunkgAMA) then + Insert(Result, IHDR.Index + 1) + {Transparency chunk (fix by Ian Boyd)} + else if (ChunkClass = TChunktRNS) then + begin + {Transparecy chunk must be after PLTE; before IDAT} + IDAT := ItemFromClass(TChunkIDAT) as TChunkIDAT; + PLTE := ItemFromClass(TChunkPLTE) as TChunkPLTE; + + if Assigned(PLTE) then + Insert(Result, PLTE.Index + 1) + else if Assigned(IDAT) then + Insert(Result, IDAT.Index) + else + Insert(Result, IHDR.Index + 1) + end + else {All other chunks} + Insert(Result, IEND.Index); + end {if} +end; + +{Returns item from the list} +function TPNGList.GetItem(Index: Cardinal): TChunk; +begin + Result := inherited GetItem(Index); +end; + +{Returns first item from the list using the class from parameter} +function TPNGList.ItemFromClass(ChunkClass: TChunkClass): TChunk; +var + i: Integer; +begin + Result := nil; {Initial result} + FOR i := 0 TO Count - 1 DO + {Test if this item has the same class} + if Item[i] is ChunkClass then + begin + {Returns this item and exit} + Result := Item[i]; + break; + end {if} +end; + +{$IFNDEF UseDelphi} + + {TStream implementation} + + {Copies all from another stream} + function TStream.CopyFrom(Source: TStream; Count: Cardinal): Cardinal; + const + MaxBytes = $f000; + var + Buffer: PChar; + BufSize, N: Cardinal; + begin + {If count is zero, copy everything from Source} + if Count = 0 then + begin + Source.Seek(0, soFromBeginning); + Count := Source.Size; + end; + + Result := Count; {Returns the number of bytes readed} + {Allocates memory} + if Count > MaxBytes then BufSize := MaxBytes else BufSize := Count; + GetMem(Buffer, BufSize); + + {Copy memory} + while Count > 0 do + begin + if Count > BufSize then N := BufSize else N := Count; + Source.Read(Buffer^, N); + Write(Buffer^, N); + dec(Count, N); + end; + + {Deallocates memory} + FreeMem(Buffer, BufSize); + end; + +{Set current stream position} +procedure TStream.SetPosition(const Value: Longint); +begin + Seek(Value, soFromBeginning); +end; + +{Returns position} +function TStream.GetPosition: Longint; +begin + Result := Seek(0, soFromCurrent); +end; + + {Returns stream size} +function TStream.GetSize: Longint; + var + Pos: Cardinal; + begin + Pos := Seek(0, soFromCurrent); + Result := Seek(0, soFromEnd); + Seek(Pos, soFromCurrent); + end; + + {TFileStream implementation} + + {Filestream object being created} + constructor TFileStream.Create(Filename: String; Mode: TFileStreamModeSet); + {Makes file mode} + function OpenMode: DWORD; + begin + Result := 0; + if fsmRead in Mode then Result := GENERIC_READ; + if (fsmWrite in Mode) or (fsmCreate in Mode) then + Result := Result OR GENERIC_WRITE; + end; + const + IsCreate: Array[Boolean] of Integer = (OPEN_ALWAYS, CREATE_ALWAYS); + begin + {Call ancestor} + inherited Create; + + {Create handle} + fHandle := CreateFile(PChar(Filename), OpenMode, FILE_SHARE_READ or + FILE_SHARE_WRITE, nil, IsCreate[fsmCreate in Mode], 0, 0); + {Store mode} + FileMode := Mode; + end; + + {Filestream object being destroyed} + destructor TFileStream.Destroy; + begin + {Terminates file and close} + if FileMode = [fsmWrite] then + SetEndOfFile(fHandle); + CloseHandle(fHandle); + + {Call ancestor} + inherited Destroy; + end; + + {Writes data to the file} + function TFileStream.Write(const Buffer; Count: Longint): Cardinal; + begin + if not WriteFile(fHandle, Buffer, Count, Result, nil) then + Result := 0; + end; + + {Reads data from the file} + function TFileStream.Read(var Buffer; Count: Longint): Cardinal; + begin + if not ReadFile(fHandle, Buffer, Count, Result, nil) then + Result := 0; + end; + + {Seeks the file position} + function TFileStream.Seek(Offset: Integer; Origin: Word): Longint; + begin + Result := SetFilePointer(fHandle, Offset, nil, Origin); + end; + + {Sets the size of the file} + procedure TFileStream.SetSize(const Value: Longint); + begin + Seek(Value, soFromBeginning); + SetEndOfFile(fHandle); + end; + + {TResourceStream implementation} + + {Creates the resource stream} + constructor TResourceStream.Create(Instance: HInst; const ResName: String; + ResType: PChar); + var + ResID: HRSRC; + ResGlobal: HGlobal; + begin + {Obtains the resource ID} + ResID := FindResource(hInstance, PChar(ResName), RT_RCDATA); + if ResID = 0 then raise EPNGError.Create(''); + {Obtains memory and size} + ResGlobal := LoadResource(hInstance, ResID); + Size := SizeOfResource(hInstance, ResID); + Memory := LockResource(ResGlobal); + if (ResGlobal = 0) or (Memory = nil) then EPNGError.Create(''); + end; + + + {Setting resource stream size is not supported} + procedure TResourceStream.SetSize(const Value: Integer); + begin + end; + + {Writing into a resource stream is not supported} + function TResourceStream.Write(const Buffer; Count: Integer): Cardinal; + begin + Result := 0; + end; + + {Reads data from the stream} + function TResourceStream.Read(var Buffer; Count: Integer): Cardinal; + begin + //Returns data + CopyMemory(@Buffer, Ptr(Longint(Memory) + Position), Count); + //Update position + inc(Position, Count); + //Returns + Result := Count; + end; + + {Seeks data} + function TResourceStream.Seek(Offset: Integer; Origin: Word): Longint; + begin + {Move depending on the origin} + case Origin of + soFromBeginning: Position := Offset; + soFromCurrent: inc(Position, Offset); + soFromEnd: Position := Size + Offset; + end; + + {Returns the current position} + Result := Position; + end; + +{$ENDIF} + +{TChunk implementation} + +{Resizes the data} +procedure TChunk.ResizeData(const NewSize: Cardinal); +begin + fDataSize := NewSize; + ReallocMem(fData, NewSize + 1); +end; + +{Returns index from list} +function TChunk.GetIndex: Integer; +var + i: Integer; +begin + Result := -1; {Avoiding warnings} + {Searches in the list} + FOR i := 0 TO Owner.Chunks.Count - 1 DO + if Owner.Chunks.Item[i] = Self then + begin + {Found match} + Result := i; + exit; + end {for i} +end; + +{Returns pointer to the TChunkIHDR} +function TChunk.GetHeader: TChunkIHDR; +begin + Result := Owner.Chunks.Item[0] as TChunkIHDR; +end; + +{Assigns from another TChunk} +procedure TChunk.Assign(Source: TChunk); +begin + {Copy properties} + fName := Source.fName; + {Set data size and realloc} + ResizeData(Source.fDataSize); + + {Copy data (if there's any)} + if fDataSize > 0 then CopyMemory(fData, Source.fData, fDataSize); +end; + +{Chunk being created} +constructor TChunk.Create(Owner: TPngObject); +var + ChunkName: String; +begin + {Ancestor create} + inherited Create; + + {If it's a registered class, set the chunk name based on the class} + {name. For instance, if the class name is TChunkgAMA, the GAMA part} + {will become the chunk name} + ChunkName := Copy(ClassName, Length('TChunk') + 1, Length(ClassName)); + if Length(ChunkName) = 4 then CopyMemory(@fName[0], @ChunkName[1], 4); + + {Initialize data holder} + GetMem(fData, 1); + fDataSize := 0; + {Record owner} + fOwner := Owner; +end; + +{Chunk being destroyed} +destructor TChunk.Destroy; +begin + {Free data holder} + FreeMem(fData, fDataSize + 1); + {Let ancestor destroy} + inherited Destroy; +end; + +{Returns the chunk name 1} +function TChunk.GetChunkName: String; +begin + Result := fName +end; + +{Returns the chunk name 2} +class function TChunk.GetName: String; +begin + {For avoid writing GetName for each TChunk descendent, by default for} + {classes which don't declare GetName, it will look for the class name} + {to extract the chunk kind. Example, if the class name is TChunkIEND } + {this method extracts and returns IEND} + Result := Copy(ClassName, Length('TChunk') + 1, Length(ClassName)); +end; + +{Saves the data to the stream} +function TChunk.SaveData(Stream: TStream): Boolean; +var + ChunkSize, ChunkCRC: Cardinal; +begin + {First, write the size for the following data in the chunk} + ChunkSize := ByteSwap(DataSize); + Stream.Write(ChunkSize, 4); + {The chunk name} + Stream.Write(fName, 4); + {If there is data for the chunk, write it} + if DataSize > 0 then Stream.Write(Data^, DataSize); + {Calculates and write CRC} + ChunkCRC := update_crc($ffffffff, @fName[0], 4); + ChunkCRC := Byteswap(update_crc(ChunkCRC, Data, DataSize) xor $ffffffff); + Stream.Write(ChunkCRC, 4); + + {Returns that everything went ok} + Result := TRUE; +end; + +{Saves the chunk to the stream} +function TChunk.SaveToStream(Stream: TStream): Boolean; +begin + Result := SaveData(Stream) +end; + + +{Loads the chunk from a stream} +function TChunk.LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; +var + CheckCRC: Cardinal; + {$IFDEF CheckCRC}RightCRC: Cardinal;{$ENDIF} +begin + {Copies data from source} + ResizeData(Size); + if Size > 0 then Stream.Read(fData^, Size); + {Reads CRC} + Stream.Read(CheckCRC, 4); + CheckCrc := ByteSwap(CheckCRC); + + {Check if crc readed is valid} + {$IFDEF CheckCRC} + RightCRC := update_crc($ffffffff, @ChunkName[0], 4); + RightCRC := update_crc(RightCRC, fData, Size) xor $ffffffff; + Result := RightCRC = CheckCrc; + + {Handle CRC error} + if not Result then + begin + {In case it coult not load chunk} + Owner.RaiseError(EPngInvalidCRC, EPngInvalidCRCText); + exit; + end + {$ELSE}Result := TRUE; {$ENDIF} + +end; + +{TChunktIME implementation} + +{Chunk being loaded from a stream} +function TChunktIME.LoadFromStream(Stream: TStream; + const ChunkName: TChunkName; Size: Integer): Boolean; +begin + {Let ancestor load the data} + Result := inherited LoadFromStream(Stream, ChunkName, Size); + if not Result or (Size <> 7) then exit; {Size must be 7} + + {Reads data} + fYear := ((pByte(Longint(Data) )^) * 256)+ (pByte(Longint(Data) + 1)^); + fMonth := pByte(Longint(Data) + 2)^; + fDay := pByte(Longint(Data) + 3)^; + fHour := pByte(Longint(Data) + 4)^; + fMinute := pByte(Longint(Data) + 5)^; + fSecond := pByte(Longint(Data) + 6)^; +end; + +{Saving the chunk to a stream} +function TChunktIME.SaveToStream(Stream: TStream): Boolean; +begin + {Update data} + ResizeData(7); {Make sure the size is 7} + pWord(Data)^ := Year; + pByte(Longint(Data) + 2)^ := Month; + pByte(Longint(Data) + 3)^ := Day; + pByte(Longint(Data) + 4)^ := Hour; + pByte(Longint(Data) + 5)^ := Minute; + pByte(Longint(Data) + 6)^ := Second; + + {Let inherited save data} + Result := inherited SaveToStream(Stream); +end; + +{TChunkztXt implementation} + +{Loading the chunk from a stream} +function TChunkzTXt.LoadFromStream(Stream: TStream; + const ChunkName: TChunkName; Size: Integer): Boolean; +var + ErrorOutput: String; + CompressionMethod: Byte; + Output: Pointer; + OutputSize: Integer; +begin + {Load data from stream and validate} + Result := inherited LoadFromStream(Stream, ChunkName, Size); + if not Result or (Size < 4) then exit; + fKeyword := PChar(Data); {Get keyword and compression method bellow} + CompressionMethod := pByte(Longint(fKeyword) + Length(fKeyword))^; + fText := ''; + + {In case the compression is 0 (only one accepted by specs), reads it} + if CompressionMethod = 0 then + begin + Output := nil; + if DecompressZLIB(PChar(Longint(Data) + Length(fKeyword) + 2), + Size - Length(fKeyword) - 2, Output, OutputSize, ErrorOutput) then + begin + SetLength(fText, OutputSize); + CopyMemory(@fText[1], Output, OutputSize); + end {if DecompressZLIB(...}; + FreeMem(Output); + end {if CompressionMethod = 0} + +end; + +{Saving the chunk to a stream} +function TChunkztXt.SaveToStream(Stream: TStream): Boolean; +var + Output: Pointer; + OutputSize: Integer; + ErrorOutput: String; +begin + Output := nil; {Initializes output} + if fText = '' then fText := ' '; + + {Compresses the data} + if CompressZLIB(@fText[1], Length(fText), Owner.CompressionLevel, Output, + OutputSize, ErrorOutput) then + begin + {Size is length from keyword, plus a null character to divide} + {plus the compression method, plus the length of the text (zlib compressed)} + ResizeData(Length(fKeyword) + 2 + OutputSize); + + Fillchar(Data^, DataSize, #0); + {Copies the keyword data} + if Keyword <> '' then + CopyMemory(Data, @fKeyword[1], Length(Keyword)); + {Compression method 0 (inflate/deflate)} + pByte(Ptr(Longint(Data) + Length(Keyword) + 1))^ := 0; + if OutputSize > 0 then + CopyMemory(Ptr(Longint(Data) + Length(Keyword) + 2), Output, OutputSize); + + {Let ancestor calculate crc and save} + Result := SaveData(Stream); + end {if CompressZLIB(...} else Result := False; + + {Frees output} + if Output <> nil then FreeMem(Output) +end; + +{TChunktEXt implementation} + +{Assigns from another text chunk} +procedure TChunktEXt.Assign(Source: TChunk); +begin + fKeyword := TChunktEXt(Source).fKeyword; + fText := TChunktEXt(Source).fText; +end; + +{Loading the chunk from a stream} +function TChunktEXt.LoadFromStream(Stream: TStream; + const ChunkName: TChunkName; Size: Integer): Boolean; +begin + {Load data from stream and validate} + Result := inherited LoadFromStream(Stream, ChunkName, Size); + if not Result or (Size < 3) then exit; + {Get text} + fKeyword := PChar(Data); + SetLength(fText, Size - Length(fKeyword) - 1); + CopyMemory(@fText[1], Ptr(Longint(Data) + Length(fKeyword) + 1), + Length(fText)); +end; + +{Saving the chunk to a stream} +function TChunktEXt.SaveToStream(Stream: TStream): Boolean; +begin + {Size is length from keyword, plus a null character to divide} + {plus the length of the text} + ResizeData(Length(fKeyword) + 1 + Length(fText)); + Fillchar(Data^, DataSize, #0); + {Copy data} + if Keyword <> '' then + CopyMemory(Data, @fKeyword[1], Length(Keyword)); + if Text <> '' then + CopyMemory(Ptr(Longint(Data) + Length(Keyword) + 1), @fText[1], + Length(Text)); + {Let ancestor calculate crc and save} + Result := inherited SaveToStream(Stream); +end; + + +{TChunkIHDR implementation} + +{Chunk being created} +constructor TChunkIHDR.Create(Owner: TPngObject); +begin + {Call inherited} + inherited Create(Owner); + {Prepare pointers} + ImageHandle := 0; + ImageDC := 0; +end; + +{Chunk being destroyed} +destructor TChunkIHDR.Destroy; +begin + {Free memory} + FreeImageData(); + + {Calls TChunk destroy} + inherited Destroy; +end; + +{Assigns from another IHDR chunk} +procedure TChunkIHDR.Assign(Source: TChunk); +begin + {Copy the IHDR data} + if Source is TChunkIHDR then + begin + {Copy IHDR values} + IHDRData := TChunkIHDR(Source).IHDRData; + + {Prepare to hold data by filling BitmapInfo structure and} + {resizing ImageData and ImageAlpha memory allocations} + PrepareImageData(); + + {Copy image data} + CopyMemory(ImageData, TChunkIHDR(Source).ImageData, + BytesPerRow * Integer(Height)); + CopyMemory(ImageAlpha, TChunkIHDR(Source).ImageAlpha, + Integer(Width) * Integer(Height)); + + {Copy palette colors} + BitmapInfo.bmiColors := TChunkIHDR(Source).BitmapInfo.bmiColors; + end + else + Owner.RaiseError(EPNGError, EPNGCannotAssignChunkText); +end; + +{Release allocated image data} +procedure TChunkIHDR.FreeImageData; +begin + {Free old image data} + if ImageHandle <> 0 then DeleteObject(ImageHandle); + if ImageDC <> 0 then DeleteDC(ImageDC); + if ImageAlpha <> nil then FreeMem(ImageAlpha); + {$IFDEF Store16bits} + if ExtraImageData <> nil then FreeMem(ExtraImageData); + {$ENDIF} + ImageHandle := 0; ImageDC := 0; ImageAlpha := nil; ImageData := nil; +end; + +{Chunk being loaded from a stream} +function TChunkIHDR.LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; +begin + {Let TChunk load it} + Result := inherited LoadFromStream(Stream, ChunkName, Size); + if not Result then Exit; + + {Now check values} + {Note: It's recommended by png specification to make sure that the size} + {must be 13 bytes to be valid, but some images with 14 bytes were found} + {which could be loaded by internet explorer and other tools} + if (fDataSize < SIZEOF(TIHdrData)) then + begin + {Ihdr must always have at least 13 bytes} + Result := False; + Owner.RaiseError(EPNGInvalidIHDR, EPNGInvalidIHDRText); + exit; + end; + + {Everything ok, reads IHDR} + IHDRData := pIHDRData(fData)^; + IHDRData.Width := ByteSwap(IHDRData.Width); + IHDRData.Height := ByteSwap(IHDRData.Height); + + {The width and height must not be larger than 65535 pixels} + if (IHDRData.Width > High(Word)) or (IHDRData.Height > High(Word)) then + begin + Result := False; + Owner.RaiseError(EPNGSizeExceeds, EPNGSizeExceedsText); + exit; + end {if IHDRData.Width > High(Word)}; + {Compression method must be 0 (inflate/deflate)} + if (IHDRData.CompressionMethod <> 0) then + begin + Result := False; + Owner.RaiseError(EPNGUnknownCompression, EPNGUnknownCompressionText); + exit; + end; + {Interlace must be either 0 (none) or 7 (adam7)} + if (IHDRData.InterlaceMethod <> 0) and (IHDRData.InterlaceMethod <> 1) then + begin + Result := False; + Owner.RaiseError(EPNGUnknownInterlace, EPNGUnknownInterlaceText); + exit; + end; + + {Updates owner properties} + Owner.InterlaceMethod := TInterlaceMethod(IHDRData.InterlaceMethod); + + {Prepares data to hold image} + PrepareImageData(); +end; + +{Saving the IHDR chunk to a stream} +function TChunkIHDR.SaveToStream(Stream: TStream): Boolean; +begin + {Ignore 2 bits images} + if BitDepth = 2 then BitDepth := 4; + + {It needs to do is update the data with the IHDR data} + {structure containing the write values} + ResizeData(SizeOf(TIHDRData)); + pIHDRData(fData)^ := IHDRData; + {..byteswap 4 byte types} + pIHDRData(fData)^.Width := ByteSwap(pIHDRData(fData)^.Width); + pIHDRData(fData)^.Height := ByteSwap(pIHDRData(fData)^.Height); + {..update interlace method} + pIHDRData(fData)^.InterlaceMethod := Byte(Owner.InterlaceMethod); + {..and then let the ancestor SaveToStream do the hard work} + Result := inherited SaveToStream(Stream); +end; + +{Resizes the image data to fill the color type, bit depth, } +{width and height parameters} +procedure TChunkIHDR.PrepareImageData(); + + {Set the bitmap info} + procedure SetInfo(const Bitdepth: Integer; const Palette: Boolean); + begin + + {Copy if the bitmap contain palette entries} + HasPalette := Palette; + {Initialize the structure with zeros} + fillchar(BitmapInfo, sizeof(BitmapInfo), #0); + {Fill the strucutre} + with BitmapInfo.bmiHeader do + begin + biSize := sizeof(TBitmapInfoHeader); + biHeight := Height; + biWidth := Width; + biPlanes := 1; + biBitCount := BitDepth; + biCompression := BI_RGB; + end {with BitmapInfo.bmiHeader} + end; +begin + {Prepare bitmap info header} + Fillchar(BitmapInfo, sizeof(TMaxBitmapInfo), #0); + {Release old image data} + FreeImageData(); + + {Obtain number of bits for each pixel} + case ColorType of + COLOR_GRAYSCALE, COLOR_PALETTE, COLOR_GRAYSCALEALPHA: + case BitDepth of + {These are supported by windows} + 1, 4, 8: SetInfo(BitDepth, TRUE); + {2 bits for each pixel is not supported by windows bitmap} + 2 : SetInfo(4, TRUE); + {Also 16 bits (2 bytes) for each pixel is not supported} + {and should be transormed into a 8 bit grayscale} + 16 : SetInfo(8, TRUE); + end; + {Only 1 byte (8 bits) is supported} + COLOR_RGB, COLOR_RGBALPHA: SetInfo(24, FALSE); + end {case ColorType}; + {Number of bytes for each scanline} + BytesPerRow := (((BitmapInfo.bmiHeader.biBitCount * Width) + 31) + and not 31) div 8; + + {Build array for alpha information, if necessary} + if (ColorType = COLOR_RGBALPHA) or (ColorType = COLOR_GRAYSCALEALPHA) then + begin + GetMem(ImageAlpha, Integer(Width) * Integer(Height)); + FillChar(ImageAlpha^, Integer(Width) * Integer(Height), #0); + end; + + {Build array for extra byte information} + {$IFDEF Store16bits} + if (BitDepth = 16) then + begin + GetMem(ExtraImageData, BytesPerRow * Integer(Height)); + FillChar(ExtraImageData^, BytesPerRow * Integer(Height), #0); + end; + {$ENDIF} + + {Creates the image to hold the data, CreateDIBSection does a better} + {work in allocating necessary memory} + ImageDC := CreateCompatibleDC(0); + ImageHandle := CreateDIBSection(ImageDC, pBitmapInfo(@BitmapInfo)^, + DIB_RGB_COLORS, ImageData, 0, 0); + + {Clears the old palette (if any)} + with Owner do + if TempPalette <> 0 then + begin + DeleteObject(TempPalette); + TempPalette := 0; + end {with Owner, if TempPalette <> 0}; + + {Build array and allocate bytes for each row} + zeromemory(ImageData, BytesPerRow * Integer(Height)); +end; + +{TChunktRNS implementation} + +{$IFNDEF UseDelphi} +function CompareMem(P1, P2: pByte; const Size: Integer): Boolean; +var i: Integer; +begin + Result := True; + for i := 1 to Size do + begin + if P1^ <> P2^ then Result := False; + inc(P1); inc(P2); + end {for i} +end; +{$ENDIF} + +{Sets the transpararent color} +procedure TChunktRNS.SetTransparentColor(const Value: ColorRef); +var + i: Byte; + LookColor: TRGBQuad; +begin + {Clears the palette values} + Fillchar(PaletteValues, SizeOf(PaletteValues), #0); + {Sets that it uses bit transparency} + fBitTransparency := True; + + + {Depends on the color type} + with Header do + case ColorType of + COLOR_GRAYSCALE: + begin + Self.ResizeData(2); + pWord(@PaletteValues[0])^ := ByteSwap16(GetRValue(Value)); + end; + COLOR_RGB: + begin + Self.ResizeData(6); + pWord(@PaletteValues[0])^ := ByteSwap16(GetRValue(Value)); + pWord(@PaletteValues[2])^ := ByteSwap16(GetGValue(Value)); + pWord(@PaletteValues[4])^ := ByteSwap16(GetBValue(Value)); + end; + COLOR_PALETTE: + begin + {Creates a RGBQuad to search for the color} + LookColor.rgbRed := GetRValue(Value); + LookColor.rgbGreen := GetGValue(Value); + LookColor.rgbBlue := GetBValue(Value); + {Look in the table for the entry} + for i := 0 to 255 do + if CompareMem(@BitmapInfo.bmiColors[i], @LookColor, 3) then + Break; + {Fill the transparency table} + Fillchar(PaletteValues, i, 255); + Self.ResizeData(i + 1) + + end + end {case / with}; + +end; + +{Returns the transparent color for the image} +function TChunktRNS.GetTransparentColor: ColorRef; +var + PaletteChunk: TChunkPLTE; + i: Integer; +begin + Result := 0; {Default: Unknown transparent color} + + {Depends on the color type} + with Header do + case ColorType of + COLOR_GRAYSCALE: + Result := RGB(PaletteValues[0], PaletteValues[0], + PaletteValues[0]); + COLOR_RGB: + Result := RGB(PaletteValues[1], PaletteValues[3], PaletteValues[5]); + COLOR_PALETTE: + begin + {Obtains the palette chunk} + PaletteChunk := Owner.Chunks.ItemFromClass(TChunkPLTE) as TChunkPLTE; + + {Looks for an entry with 0 transparency meaning that it is the} + {full transparent entry} + for i := 0 to Self.DataSize - 1 do + if PaletteValues[i] = 0 then + with PaletteChunk.GetPaletteItem(i) do + begin + Result := RGB(rgbRed, rgbGreen, rgbBlue); + break + end + end {COLOR_PALETTE} + end {case Header.ColorType}; +end; + +{Saving the chunk to a stream} +function TChunktRNS.SaveToStream(Stream: TStream): Boolean; +begin + {Copy palette into data buffer} + if DataSize <= 256 then + CopyMemory(fData, @PaletteValues[0], DataSize); + + Result := inherited SaveToStream(Stream); +end; + +{Assigns from another chunk} +procedure TChunktRNS.Assign(Source: TChunk); +begin + CopyMemory(@PaletteValues[0], @TChunkTrns(Source).PaletteValues[0], 256); + fBitTransparency := TChunkTrns(Source).fBitTransparency; + inherited Assign(Source); +end; + +{Loads the chunk from a stream} +function TChunktRNS.LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; +var + i, Differ255: Integer; +begin + {Let inherited load} + Result := inherited LoadFromStream(Stream, ChunkName, Size); + + if not Result then Exit; + + {Make sure size is correct} + if Size > 256 then Owner.RaiseError(EPNGInvalidPalette, + EPNGInvalidPaletteText); + + {The unset items should have value 255} + Fillchar(PaletteValues[0], 256, 255); + {Copy the other values} + CopyMemory(@PaletteValues[0], fData, Size); + + {Create the mask if needed} + case Header.ColorType of + {Mask for grayscale and RGB} + COLOR_RGB, COLOR_GRAYSCALE: fBitTransparency := True; + COLOR_PALETTE: + begin + Differ255 := 0; {Count the entries with a value different from 255} + {Tests if it uses bit transparency} + for i := 0 to Size - 1 do + if PaletteValues[i] <> 255 then inc(Differ255); + + {If it has one value different from 255 it is a bit transparency} + fBitTransparency := (Differ255 = 1); + end {COLOR_PALETTE} + end {case Header.ColorType}; + +end; + +{Prepares the image palette} +procedure TChunkIDAT.PreparePalette; +var + Entries: Word; + j : Integer; +begin + {In case the image uses grayscale, build a grayscale palette} + with Header do + if (ColorType = COLOR_GRAYSCALE) or (ColorType = COLOR_GRAYSCALEALPHA) then + begin + {Calculate total number of palette entries} + Entries := (1 shl Byte(BitmapInfo.bmiHeader.biBitCount)); + + FOR j := 0 TO Entries - 1 DO + with BitmapInfo.bmiColors[j] do + begin + + {Calculate each palette entry} + rgbRed := fOwner.GammaTable[MulDiv(j, 255, Entries - 1)]; + rgbGreen := rgbRed; + rgbBlue := rgbRed; + end {with BitmapInfo.bmiColors[j]} + end {if ColorType = COLOR_GRAYSCALE..., with Header} +end; + +{Reads from ZLIB} +function TChunkIDAT.IDATZlibRead(var ZLIBStream: TZStreamRec2; + Buffer: Pointer; Count: Integer; var EndPos: Integer; + var crcfile: Cardinal): Integer; +var + ProcResult : Integer; + IDATHeader : Array[0..3] of char; + IDATCRC : Cardinal; +begin + {Uses internal record pointed by ZLIBStream to gather information} + with ZLIBStream, ZLIBStream.zlib do + begin + {Set the buffer the zlib will read into} + next_out := Buffer; + avail_out := Count; + + {Decode until it reach the Count variable} + while avail_out > 0 do + begin + {In case it needs more data and it's in the end of a IDAT chunk,} + {it means that there are more IDAT chunks} + if (fStream.Position = EndPos) and (avail_out > 0) and + (avail_in = 0) then + begin + {End this chunk by reading and testing the crc value} + fStream.Read(IDATCRC, 4); + + {$IFDEF CheckCRC} + if crcfile xor $ffffffff <> Cardinal(ByteSwap(IDATCRC)) then + begin + Result := -1; + Owner.RaiseError(EPNGInvalidCRC, EPNGInvalidCRCText); + exit; + end; + {$ENDIF} + + {Start reading the next chunk} + fStream.Read(EndPos, 4); {Reads next chunk size} + fStream.Read(IDATHeader[0], 4); {Next chunk header} + {It must be a IDAT chunk since image data is required and PNG} + {specification says that multiple IDAT chunks must be consecutive} + if IDATHeader <> 'IDAT' then + begin + Owner.RaiseError(EPNGMissingMultipleIDAT, EPNGMissingMultipleIDATText); + result := -1; + exit; + end; + + {Calculate chunk name part of the crc} + {$IFDEF CheckCRC} + crcfile := update_crc($ffffffff, @IDATHeader[0], 4); + {$ENDIF} + EndPos := fStream.Position + ByteSwap(EndPos); + end; + + + {In case it needs compressed data to read from} + if avail_in = 0 then + begin + {In case it's trying to read more than it is avaliable} + if fStream.Position + ZLIBAllocate > EndPos then + avail_in := fStream.Read(Data^, EndPos - fStream.Position) + else + avail_in := fStream.Read(Data^, ZLIBAllocate); + {Update crc} + {$IFDEF CheckCRC} + crcfile := update_crc(crcfile, Data, avail_in); + {$ENDIF} + + {In case there is no more compressed data to read from} + if avail_in = 0 then + begin + Result := Count - avail_out; + Exit; + end; + + {Set next buffer to read and record current position} + next_in := Data; + + end {if avail_in = 0}; + + ProcResult := inflate(zlib, 0); + + {In case the result was not sucessfull} + if (ProcResult < 0) then + begin + Result := -1; + Owner.RaiseError(EPNGZLIBError, + EPNGZLIBErrorText + zliberrors[procresult]); + exit; + end; + + end {while avail_out > 0}; + + end {with}; + + {If everything gone ok, it returns the count bytes} + Result := Count; +end; + +{TChunkIDAT implementation} + +const + {Adam 7 interlacing values} + RowStart: array[0..6] of Integer = (0, 0, 4, 0, 2, 0, 1); + ColumnStart: array[0..6] of Integer = (0, 4, 0, 2, 0, 1, 0); + RowIncrement: array[0..6] of Integer = (8, 8, 8, 4, 4, 2, 2); + ColumnIncrement: array[0..6] of Integer = (8, 8, 4, 4, 2, 2, 1); + +{Copy interlaced images with 1 byte for R, G, B} +procedure TChunkIDAT.CopyInterlacedRGB8(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Dest := pChar(Longint(Dest) + Col * 3); + repeat + {Copy this row} + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 1)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) )^]; inc(Dest); + + {Move to next column} + inc(Src, 3); + inc(Dest, ColumnIncrement[Pass] * 3 - 3); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Copy interlaced images with 2 bytes for R, G, B} +procedure TChunkIDAT.CopyInterlacedRGB16(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Dest := pChar(Longint(Dest) + Col * 3); + repeat + {Copy this row} + Byte(Dest^) := Owner.GammaTable[pByte(Longint(Src) + 4)^]; inc(Dest); + Byte(Dest^) := Owner.GammaTable[pByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := Owner.GammaTable[pByte(Longint(Src) )^]; inc(Dest); + {$IFDEF Store16bits} + {Copy extra pixel values} + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 5)^]; inc(Extra); + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 3)^]; inc(Extra); + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 1)^]; inc(Extra); + {$ENDIF} + + {Move to next column} + inc(Src, 6); + inc(Dest, ColumnIncrement[Pass] * 3 - 3); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Copy ímages with palette using bit depths 1, 4 or 8} +procedure TChunkIDAT.CopyInterlacedPalette148(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +const + BitTable: Array[1..8] of Integer = ($1, $3, 0, $F, 0, 0, 0, $FF); + StartBit: Array[1..8] of Integer = (7 , 0 , 0, 4, 0, 0, 0, 0); +var + CurBit, Col: Integer; + Dest2: PChar; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + repeat + {Copy data} + CurBit := StartBit[Header.BitDepth]; + repeat + {Adjust pointer to pixel byte bounds} + Dest2 := pChar(Longint(Dest) + (Header.BitDepth * Col) div 8); + {Copy data} + Byte(Dest2^) := Byte(Dest2^) or + ( ((Byte(Src^) shr CurBit) and BitTable[Header.BitDepth]) + shl (StartBit[Header.BitDepth] - (Col * Header.BitDepth mod 8))); + + {Move to next column} + inc(Col, ColumnIncrement[Pass]); + {Will read next bits} + dec(CurBit, Header.BitDepth); + until CurBit < 0; + + {Move to next byte in source} + inc(Src); + until Col >= ImageWidth; +end; + +{Copy ímages with palette using bit depth 2} +procedure TChunkIDAT.CopyInterlacedPalette2(const Pass: Byte; Src, Dest, + Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + CurBit, Col: Integer; + Dest2: PChar; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + repeat + {Copy data} + CurBit := 6; + repeat + {Adjust pointer to pixel byte bounds} + Dest2 := pChar(Longint(Dest) + Col div 2); + {Copy data} + Byte(Dest2^) := Byte(Dest2^) or (((Byte(Src^) shr CurBit) and $3) + shl (4 - (4 * Col) mod 8)); + {Move to next column} + inc(Col, ColumnIncrement[Pass]); + {Will read next bits} + dec(CurBit, 2); + until CurBit < 0; + + {Move to next byte in source} + inc(Src); + until Col >= ImageWidth; +end; + +{Copy ímages with grayscale using bit depth 2} +procedure TChunkIDAT.CopyInterlacedGray2(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + CurBit, Col: Integer; + Dest2: PChar; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + repeat + {Copy data} + CurBit := 6; + repeat + {Adjust pointer to pixel byte bounds} + Dest2 := pChar(Longint(Dest) + Col div 2); + {Copy data} + Byte(Dest2^) := Byte(Dest2^) or ((((Byte(Src^) shr CurBit) shl 2) and $F) + shl (4 - (Col*4) mod 8)); + {Move to next column} + inc(Col, ColumnIncrement[Pass]); + {Will read next bits} + dec(CurBit, 2); + until CurBit < 0; + + {Move to next byte in source} + inc(Src); + until Col >= ImageWidth; +end; + +{Copy ímages with palette using 2 bytes for each pixel} +procedure TChunkIDAT.CopyInterlacedGrayscale16(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Dest := pChar(Longint(Dest) + Col); + repeat + {Copy this row} + Dest^ := Src^; inc(Dest); + {$IFDEF Store16bits} + Extra^ := pChar(Longint(Src) + 1)^; inc(Extra); + {$ENDIF} + + {Move to next column} + inc(Src, 2); + inc(Dest, ColumnIncrement[Pass] - 1); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Decodes interlaced RGB alpha with 1 byte for each sample} +procedure TChunkIDAT.CopyInterlacedRGBAlpha8(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Dest := pChar(Longint(Dest) + Col * 3); + Trans := pChar(Longint(Trans) + Col); + repeat + {Copy this row and alpha value} + Trans^ := pChar(Longint(Src) + 3)^; + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 1)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) )^]; inc(Dest); + + {Move to next column} + inc(Src, 4); + inc(Dest, ColumnIncrement[Pass] * 3 - 3); + inc(Trans, ColumnIncrement[Pass]); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Decodes interlaced RGB alpha with 2 bytes for each sample} +procedure TChunkIDAT.CopyInterlacedRGBAlpha16(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Dest := pChar(Longint(Dest) + Col * 3); + Trans := pChar(Longint(Trans) + Col); + repeat + {Copy this row and alpha value} + Trans^ := pChar(Longint(Src) + 6)^; + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 4)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) )^]; inc(Dest); + {$IFDEF Store16bits} + {Copy extra pixel values} + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 5)^]; inc(Extra); + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 3)^]; inc(Extra); + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 1)^]; inc(Extra); + {$ENDIF} + + {Move to next column} + inc(Src, 8); + inc(Dest, ColumnIncrement[Pass] * 3 - 3); + inc(Trans, ColumnIncrement[Pass]); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Decodes 8 bit grayscale image followed by an alpha sample} +procedure TChunkIDAT.CopyInterlacedGrayscaleAlpha8(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + Col: Integer; +begin + {Get first column, pointers to the data and enter in loop} + Col := ColumnStart[Pass]; + Dest := pChar(Longint(Dest) + Col); + Trans := pChar(Longint(Trans) + Col); + repeat + {Copy this grayscale value and alpha} + Dest^ := Src^; inc(Src); + Trans^ := Src^; inc(Src); + + {Move to next column} + inc(Dest, ColumnIncrement[Pass]); + inc(Trans, ColumnIncrement[Pass]); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Decodes 16 bit grayscale image followed by an alpha sample} +procedure TChunkIDAT.CopyInterlacedGrayscaleAlpha16(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + Col: Integer; +begin + {Get first column, pointers to the data and enter in loop} + Col := ColumnStart[Pass]; + Dest := pChar(Longint(Dest) + Col); + Trans := pChar(Longint(Trans) + Col); + repeat + {$IFDEF Store16bits} + Extra^ := pChar(Longint(Src) + 1)^; inc(Extra); + {$ENDIF} + {Copy this grayscale value and alpha, transforming 16 bits into 8} + Dest^ := Src^; inc(Src, 2); + Trans^ := Src^; inc(Src, 2); + + {Move to next column} + inc(Dest, ColumnIncrement[Pass]); + inc(Trans, ColumnIncrement[Pass]); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Decodes an interlaced image} +procedure TChunkIDAT.DecodeInterlacedAdam7(Stream: TStream; + var ZLIBStream: TZStreamRec2; const Size: Integer; var crcfile: Cardinal); +var + CurrentPass: Byte; + PixelsThisRow: Integer; + CurrentRow: Integer; + Trans, Data{$IFDEF Store16bits}, Extra{$ENDIF}: pChar; + CopyProc: procedure(const Pass: Byte; Src, Dest, + Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar) of object; +begin + + CopyProc := nil; {Initialize} + {Determine method to copy the image data} + case Header.ColorType of + {R, G, B values for each pixel} + COLOR_RGB: + case Header.BitDepth of + 8: CopyProc := CopyInterlacedRGB8; + 16: CopyProc := CopyInterlacedRGB16; + end {case Header.BitDepth}; + {Palette} + COLOR_PALETTE, COLOR_GRAYSCALE: + case Header.BitDepth of + 1, 4, 8: CopyProc := CopyInterlacedPalette148; + 2 : if Header.ColorType = COLOR_PALETTE then + CopyProc := CopyInterlacedPalette2 + else + CopyProc := CopyInterlacedGray2; + 16 : CopyProc := CopyInterlacedGrayscale16; + end; + {RGB followed by alpha} + COLOR_RGBALPHA: + case Header.BitDepth of + 8: CopyProc := CopyInterlacedRGBAlpha8; + 16: CopyProc := CopyInterlacedRGBAlpha16; + end; + {Grayscale followed by alpha} + COLOR_GRAYSCALEALPHA: + case Header.BitDepth of + 8: CopyProc := CopyInterlacedGrayscaleAlpha8; + 16: CopyProc := CopyInterlacedGrayscaleAlpha16; + end; + end {case Header.ColorType}; + + {Adam7 method has 7 passes to make the final image} + FOR CurrentPass := 0 TO 6 DO + begin + {Calculates the number of pixels and bytes for this pass row} + PixelsThisRow := (ImageWidth - ColumnStart[CurrentPass] + + ColumnIncrement[CurrentPass] - 1) div ColumnIncrement[CurrentPass]; + Row_Bytes := BytesForPixels(PixelsThisRow, Header.ColorType, + Header.BitDepth); + {Clear buffer for this pass} + ZeroMemory(Row_Buffer[not RowUsed], Row_Bytes); + + {Get current row index} + CurrentRow := RowStart[CurrentPass]; + {Get a pointer to the current row image data} + Data := Ptr(Longint(Header.ImageData) + Header.BytesPerRow * + (ImageHeight - 1 - CurrentRow)); + Trans := Ptr(Longint(Header.ImageAlpha) + ImageWidth * CurrentRow); + {$IFDEF Store16bits} + Extra := Ptr(Longint(Header.ExtraImageData) + Header.BytesPerRow * + (ImageHeight - 1 - CurrentRow)); + {$ENDIF} + + if Row_Bytes > 0 then {There must have bytes for this interlaced pass} + while CurrentRow < ImageHeight do + begin + {Reads this line and filter} + if IDATZlibRead(ZLIBStream, @Row_Buffer[RowUsed][0], Row_Bytes + 1, + EndPos, CRCFile) = 0 then break; + + FilterRow; + {Copy image data} + + CopyProc(CurrentPass, @Row_Buffer[RowUsed][1], Data, Trans + {$IFDEF Store16bits}, Extra{$ENDIF}); + + {Use the other RowBuffer item} + RowUsed := not RowUsed; + + {Move to the next row} + inc(CurrentRow, RowIncrement[CurrentPass]); + {Move pointer to the next line} + dec(Data, RowIncrement[CurrentPass] * Header.BytesPerRow); + inc(Trans, RowIncrement[CurrentPass] * ImageWidth); + {$IFDEF Store16bits} + dec(Extra, RowIncrement[CurrentPass] * Header.BytesPerRow); + {$ENDIF} + end {while CurrentRow < ImageHeight}; + + end {FOR CurrentPass}; + +end; + +{Copy 8 bits RGB image} +procedure TChunkIDAT.CopyNonInterlacedRGB8( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + I: Integer; +begin + FOR I := 1 TO ImageWidth DO + begin + {Copy pixel values} + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 1)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) )^]; inc(Dest); + {Move to next pixel} + inc(Src, 3); + end {for I} +end; + +{Copy 16 bits RGB image} +procedure TChunkIDAT.CopyNonInterlacedRGB16( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + I: Integer; +begin + FOR I := 1 TO ImageWidth DO + begin + //Since windows does not supports 2 bytes for + //each R, G, B value, the method will read only 1 byte from it + {Copy pixel values} + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 4)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) )^]; inc(Dest); + {$IFDEF Store16bits} + {Copy extra pixel values} + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 5)^]; inc(Extra); + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 3)^]; inc(Extra); + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 1)^]; inc(Extra); + {$ENDIF} + + {Move to next pixel} + inc(Src, 6); + end {for I} +end; + +{Copy types using palettes (1, 4 or 8 bits per pixel)} +procedure TChunkIDAT.CopyNonInterlacedPalette148( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +begin + {It's simple as copying the data} + CopyMemory(Dest, Src, Row_Bytes); +end; + +{Copy grayscale types using 2 bits for each pixel} +procedure TChunkIDAT.CopyNonInterlacedGray2( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + i: Integer; +begin + {2 bits is not supported, this routine will converted into 4 bits} + FOR i := 1 TO Row_Bytes do + begin + Byte(Dest^) := ((Byte(Src^) shr 2) and $F) or ((Byte(Src^)) and $F0); inc(Dest); + Byte(Dest^) := ((Byte(Src^) shl 2) and $F) or ((Byte(Src^) shl 4) and $F0); inc(Dest); + inc(Src); + end {FOR i} +end; + +{Copy types using palette with 2 bits for each pixel} +procedure TChunkIDAT.CopyNonInterlacedPalette2( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + i: Integer; +begin + {2 bits is not supported, this routine will converted into 4 bits} + FOR i := 1 TO Row_Bytes do + begin + Byte(Dest^) := ((Byte(Src^) shr 4) and $3) or ((Byte(Src^) shr 2) and $30); inc(Dest); + Byte(Dest^) := (Byte(Src^) and $3) or ((Byte(Src^) shl 2) and $30); inc(Dest); + inc(Src); + end {FOR i} +end; + +{Copy grayscale images with 16 bits} +procedure TChunkIDAT.CopyNonInterlacedGrayscale16( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + I: Integer; +begin + FOR I := 1 TO ImageWidth DO + begin + {Windows does not supports 16 bits for each pixel in grayscale} + {mode, so reduce to 8} + Dest^ := Src^; inc(Dest); + {$IFDEF Store16bits} + Extra^ := pChar(Longint(Src) + 1)^; inc(Extra); + {$ENDIF} + + {Move to next pixel} + inc(Src, 2); + end {for I} +end; + +{Copy 8 bits per sample RGB images followed by an alpha byte} +procedure TChunkIDAT.CopyNonInterlacedRGBAlpha8( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + i: Integer; +begin + FOR I := 1 TO ImageWidth DO + begin + {Copy pixel values and transparency} + Trans^ := pChar(Longint(Src) + 3)^; + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 1)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) )^]; inc(Dest); + {Move to next pixel} + inc(Src, 4); inc(Trans); + end {for I} +end; + +{Copy 16 bits RGB image with alpha using 2 bytes for each sample} +procedure TChunkIDAT.CopyNonInterlacedRGBAlpha16( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + I: Integer; +begin + FOR I := 1 TO ImageWidth DO + begin + //Copy rgb and alpha values (transforming from 16 bits to 8 bits) + {Copy pixel values} + Trans^ := pChar(Longint(Src) + 6)^; + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 4)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) )^]; inc(Dest); + {$IFDEF Store16bits} + {Copy extra pixel values} + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 5)^]; inc(Extra); + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 3)^]; inc(Extra); + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 1)^]; inc(Extra); + {$ENDIF} + {Move to next pixel} + inc(Src, 8); inc(Trans); + end {for I} +end; + +{Copy 8 bits per sample grayscale followed by alpha} +procedure TChunkIDAT.CopyNonInterlacedGrayscaleAlpha8( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + I: Integer; +begin + FOR I := 1 TO ImageWidth DO + begin + {Copy alpha value and then gray value} + Dest^ := Src^; inc(Src); + Trans^ := Src^; inc(Src); + inc(Dest); inc(Trans); + end; +end; + +{Copy 16 bits per sample grayscale followed by alpha} +procedure TChunkIDAT.CopyNonInterlacedGrayscaleAlpha16( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + I: Integer; +begin + FOR I := 1 TO ImageWidth DO + begin + {Copy alpha value and then gray value} + {$IFDEF Store16bits} + Extra^ := pChar(Longint(Src) + 1)^; inc(Extra); + {$ENDIF} + Dest^ := Src^; inc(Src, 2); + Trans^ := Src^; inc(Src, 2); + inc(Dest); inc(Trans); + end; +end; + +{Decode non interlaced image} +procedure TChunkIDAT.DecodeNonInterlaced(Stream: TStream; + var ZLIBStream: TZStreamRec2; const Size: Integer; var crcfile: Cardinal); +var + j: Cardinal; + Trans, Data{$IFDEF Store16bits}, Extra{$ENDIF}: pChar; + CopyProc: procedure( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar) of object; +begin + CopyProc := nil; {Initialize} + {Determines the method to copy the image data} + case Header.ColorType of + {R, G, B values} + COLOR_RGB: + case Header.BitDepth of + 8: CopyProc := CopyNonInterlacedRGB8; + 16: CopyProc := CopyNonInterlacedRGB16; + end; + {Types using palettes} + COLOR_PALETTE, COLOR_GRAYSCALE: + case Header.BitDepth of + 1, 4, 8: CopyProc := CopyNonInterlacedPalette148; + 2 : if Header.ColorType = COLOR_PALETTE then + CopyProc := CopyNonInterlacedPalette2 + else + CopyProc := CopyNonInterlacedGray2; + 16 : CopyProc := CopyNonInterlacedGrayscale16; + end; + {R, G, B followed by alpha} + COLOR_RGBALPHA: + case Header.BitDepth of + 8 : CopyProc := CopyNonInterlacedRGBAlpha8; + 16 : CopyProc := CopyNonInterlacedRGBAlpha16; + end; + {Grayscale followed by alpha} + COLOR_GRAYSCALEALPHA: + case Header.BitDepth of + 8 : CopyProc := CopyNonInterlacedGrayscaleAlpha8; + 16 : CopyProc := CopyNonInterlacedGrayscaleAlpha16; + end; + end; + + {Get the image data pointer} + Longint(Data) := Longint(Header.ImageData) + + Header.BytesPerRow * (ImageHeight - 1); + Trans := Header.ImageAlpha; + {$IFDEF Store16bits} + Longint(Extra) := Longint(Header.ExtraImageData) + + Header.BytesPerRow * (ImageHeight - 1); + {$ENDIF} + {Reads each line} + FOR j := 0 to ImageHeight - 1 do + begin + {Read this line Row_Buffer[RowUsed][0] if the filter type for this line} + if IDATZlibRead(ZLIBStream, @Row_Buffer[RowUsed][0], Row_Bytes + 1, EndPos, + CRCFile) = 0 then break; + + {Filter the current row} + FilterRow; + {Copies non interlaced row to image} + CopyProc(@Row_Buffer[RowUsed][1], Data, Trans{$IFDEF Store16bits}, Extra + {$ENDIF}); + + {Invert line used} + RowUsed := not RowUsed; + dec(Data, Header.BytesPerRow); + {$IFDEF Store16bits}dec(Extra, Header.BytesPerRow);{$ENDIF} + inc(Trans, ImageWidth); + end {for I}; + + +end; + +{Filter the current line} +procedure TChunkIDAT.FilterRow; +var + pp: Byte; + vv, left, above, aboveleft: Integer; + Col: Cardinal; +begin + {Test the filter} + case Row_Buffer[RowUsed]^[0] of + {No filtering for this line} + FILTER_NONE: begin end; + {AND 255 serves only to never let the result be larger than one byte} + {Sub filter} + FILTER_SUB: + FOR Col := Offset + 1 to Row_Bytes DO + Row_Buffer[RowUsed][Col] := (Row_Buffer[RowUsed][Col] + + Row_Buffer[RowUsed][Col - Offset]) and 255; + {Up filter} + FILTER_UP: + FOR Col := 1 to Row_Bytes DO + Row_Buffer[RowUsed][Col] := (Row_Buffer[RowUsed][Col] + + Row_Buffer[not RowUsed][Col]) and 255; + {Average filter} + FILTER_AVERAGE: + FOR Col := 1 to Row_Bytes DO + begin + {Obtains up and left pixels} + above := Row_Buffer[not RowUsed][Col]; + if col - 1 < Offset then + left := 0 + else + Left := Row_Buffer[RowUsed][Col - Offset]; + + {Calculates} + Row_Buffer[RowUsed][Col] := (Row_Buffer[RowUsed][Col] + + (left + above) div 2) and 255; + end; + {Paeth filter} + FILTER_PAETH: + begin + {Initialize} + left := 0; + aboveleft := 0; + {Test each byte} + FOR Col := 1 to Row_Bytes DO + begin + {Obtains above pixel} + above := Row_Buffer[not RowUsed][Col]; + {Obtains left and top-left pixels} + if (col - 1 >= offset) Then + begin + left := row_buffer[RowUsed][col - offset]; + aboveleft := row_buffer[not RowUsed][col - offset]; + end; + + {Obtains current pixel and paeth predictor} + vv := row_buffer[RowUsed][Col]; + pp := PaethPredictor(left, above, aboveleft); + + {Calculates} + Row_Buffer[RowUsed][Col] := (pp + vv) and $FF; + end {for}; + end; + + end {case}; +end; + +{Reads the image data from the stream} +function TChunkIDAT.LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; +var + ZLIBStream: TZStreamRec2; + CRCCheck, + CRCFile : Cardinal; +begin + {Get pointer to the header chunk} + Header := Owner.Chunks.Item[0] as TChunkIHDR; + {Build palette if necessary} + if Header.HasPalette then PreparePalette(); + + {Copy image width and height} + ImageWidth := Header.Width; + ImageHeight := Header.Height; + + {Initialize to calculate CRC} + {$IFDEF CheckCRC} + CRCFile := update_crc($ffffffff, @ChunkName[0], 4); + {$ENDIF} + + Owner.GetPixelInfo(Row_Bytes, Offset); {Obtain line information} + ZLIBStream := ZLIBInitInflate(Stream); {Initializes decompression} + + {Calculate ending position for the current IDAT chunk} + EndPos := Stream.Position + Size; + + {Allocate memory} + GetMem(Row_Buffer[false], Row_Bytes + 1); + GetMem(Row_Buffer[true], Row_Bytes + 1); + ZeroMemory(Row_Buffer[false], Row_bytes + 1); + {Set the variable to alternate the Row_Buffer item to use} + RowUsed := TRUE; + + {Call special methods for the different interlace methods} + case Owner.InterlaceMethod of + imNone: DecodeNonInterlaced(stream, ZLIBStream, Size, crcfile); + imAdam7: DecodeInterlacedAdam7(stream, ZLIBStream, size, crcfile); + end; + + {Free memory} + ZLIBTerminateInflate(ZLIBStream); {Terminates decompression} + FreeMem(Row_Buffer[False], Row_Bytes + 1); + FreeMem(Row_Buffer[True], Row_Bytes + 1); + + {Now checks CRC} + Stream.Read(CRCCheck, 4); + {$IFDEF CheckCRC} + CRCFile := CRCFile xor $ffffffff; + CRCCheck := ByteSwap(CRCCheck); + Result := CRCCheck = CRCFile; + + {Handle CRC error} + if not Result then + begin + {In case it coult not load chunk} + Owner.RaiseError(EPngInvalidCRC, EPngInvalidCRCText); + exit; + end; + {$ELSE}Result := TRUE; {$ENDIF} +end; + +const + IDATHeader: Array[0..3] of char = ('I', 'D', 'A', 'T'); + BUFFER = 5; + +{Saves the IDAT chunk to a stream} +function TChunkIDAT.SaveToStream(Stream: TStream): Boolean; +var + ZLIBStream : TZStreamRec2; +begin + {Get pointer to the header chunk} + Header := Owner.Chunks.Item[0] as TChunkIHDR; + {Copy image width and height} + ImageWidth := Header.Width; + ImageHeight := Header.Height; + Owner.GetPixelInfo(Row_Bytes, Offset); {Obtain line information} + + {Allocate memory} + GetMem(Encode_Buffer[BUFFER], Row_Bytes); + ZeroMemory(Encode_Buffer[BUFFER], Row_Bytes); + {Allocate buffers for the filters selected} + {Filter none will always be calculated to the other filters to work} + GetMem(Encode_Buffer[FILTER_NONE], Row_Bytes); + ZeroMemory(Encode_Buffer[FILTER_NONE], Row_Bytes); + if pfSub in Owner.Filters then + GetMem(Encode_Buffer[FILTER_SUB], Row_Bytes); + if pfUp in Owner.Filters then + GetMem(Encode_Buffer[FILTER_UP], Row_Bytes); + if pfAverage in Owner.Filters then + GetMem(Encode_Buffer[FILTER_AVERAGE], Row_Bytes); + if pfPaeth in Owner.Filters then + GetMem(Encode_Buffer[FILTER_PAETH], Row_Bytes); + + {Initialize ZLIB} + ZLIBStream := ZLIBInitDeflate(Stream, Owner.fCompressionLevel, + Owner.MaxIdatSize); + {Write data depending on the interlace method} + case Owner.InterlaceMethod of + imNone: EncodeNonInterlaced(stream, ZLIBStream); + imAdam7: EncodeInterlacedAdam7(stream, ZLIBStream); + end; + {Terminates ZLIB} + ZLIBTerminateDeflate(ZLIBStream); + + {Release allocated memory} + FreeMem(Encode_Buffer[BUFFER], Row_Bytes); + FreeMem(Encode_Buffer[FILTER_NONE], Row_Bytes); + if pfSub in Owner.Filters then + FreeMem(Encode_Buffer[FILTER_SUB], Row_Bytes); + if pfUp in Owner.Filters then + FreeMem(Encode_Buffer[FILTER_UP], Row_Bytes); + if pfAverage in Owner.Filters then + FreeMem(Encode_Buffer[FILTER_AVERAGE], Row_Bytes); + if pfPaeth in Owner.Filters then + FreeMem(Encode_Buffer[FILTER_PAETH], Row_Bytes); + + {Everything went ok} + Result := True; +end; + +{Writes the IDAT using the settings} +procedure WriteIDAT(Stream: TStream; Data: Pointer; const Length: Cardinal); +var + ChunkLen, CRC: Cardinal; +begin + {Writes IDAT header} + ChunkLen := ByteSwap(Length); + Stream.Write(ChunkLen, 4); {Chunk length} + Stream.Write(IDATHeader[0], 4); {Idat header} + CRC := update_crc($ffffffff, @IDATHeader[0], 4); {Crc part for header} + + {Writes IDAT data and calculates CRC for data} + Stream.Write(Data^, Length); + CRC := Byteswap(update_crc(CRC, Data, Length) xor $ffffffff); + {Writes final CRC} + Stream.Write(CRC, 4); +end; + +{Compress and writes IDAT chunk data} +procedure TChunkIDAT.IDATZlibWrite(var ZLIBStream: TZStreamRec2; + Buffer: Pointer; const Length: Cardinal); +begin + with ZLIBStream, ZLIBStream.ZLIB do + begin + {Set data to be compressed} + next_in := Buffer; + avail_in := Length; + + {Compress all the data avaliable to compress} + while avail_in > 0 do + begin + deflate(ZLIB, Z_NO_FLUSH); + + {The whole buffer was used, save data to stream and restore buffer} + if avail_out = 0 then + begin + {Writes this IDAT chunk} + WriteIDAT(fStream, Data, ZLIBAllocate); + + {Restore buffer} + next_out := Data; + avail_out := ZLIBAllocate; + end {if avail_out = 0}; + + end {while avail_in}; + + end {with ZLIBStream, ZLIBStream.ZLIB} +end; + +{Finishes compressing data to write IDAT chunk} +procedure TChunkIDAT.FinishIDATZlib(var ZLIBStream: TZStreamRec2); +begin + with ZLIBStream, ZLIBStream.ZLIB do + begin + {Set data to be compressed} + next_in := nil; + avail_in := 0; + + while deflate(ZLIB,Z_FINISH) <> Z_STREAM_END do + begin + {Writes this IDAT chunk} + WriteIDAT(fStream, Data, ZLIBAllocate - avail_out); + {Re-update buffer} + next_out := Data; + avail_out := ZLIBAllocate; + end; + + if avail_out < ZLIBAllocate then + {Writes final IDAT} + WriteIDAT(fStream, Data, ZLIBAllocate - avail_out); + + end {with ZLIBStream, ZLIBStream.ZLIB}; +end; + +{Copy memory to encode RGB image with 1 byte for each color sample} +procedure TChunkIDAT.EncodeNonInterlacedRGB8(Src, Dest, Trans: pChar); +var + I: Integer; +begin + FOR I := 1 TO ImageWidth DO + begin + {Copy pixel values} + Byte(Dest^) := fOwner.InverseGamma[pByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := fOwner.InverseGamma[pByte(Longint(Src) + 1)^]; inc(Dest); + Byte(Dest^) := fOwner.InverseGamma[pByte(Longint(Src) )^]; inc(Dest); + {Move to next pixel} + inc(Src, 3); + end {for I} +end; + +{Copy memory to encode RGB images with 16 bits for each color sample} +procedure TChunkIDAT.EncodeNonInterlacedRGB16(Src, Dest, Trans: pChar); +var + I: Integer; +begin + FOR I := 1 TO ImageWidth DO + begin + //Now we copy from 1 byte for each sample stored to a 2 bytes (or 1 word) + //for sample + {Copy pixel values} + pWORD(Dest)^ := fOwner.InverseGamma[pByte(Longint(Src) + 2)^]; inc(Dest, 2); + pWORD(Dest)^ := fOwner.InverseGamma[pByte(Longint(Src) + 1)^]; inc(Dest, 2); + pWORD(Dest)^ := fOwner.InverseGamma[pByte(Longint(Src) )^]; inc(Dest, 2); + {Move to next pixel} + inc(Src, 3); + end {for I} + +end; + +{Copy memory to encode types using palettes (1, 4 or 8 bits per pixel)} +procedure TChunkIDAT.EncodeNonInterlacedPalette148(Src, Dest, Trans: pChar); +begin + {It's simple as copying the data} + CopyMemory(Dest, Src, Row_Bytes); +end; + +{Copy memory to encode grayscale images with 2 bytes for each sample} +procedure TChunkIDAT.EncodeNonInterlacedGrayscale16(Src, Dest, Trans: pChar); +var + I: Integer; +begin + FOR I := 1 TO ImageWidth DO + begin + //Now we copy from 1 byte for each sample stored to a 2 bytes (or 1 word) + //for sample + pWORD(Dest)^ := pByte(Longint(Src))^; inc(Dest, 2); + {Move to next pixel} + inc(Src); + end {for I} +end; + +{Encode images using RGB followed by an alpha value using 1 byte for each} +procedure TChunkIDAT.EncodeNonInterlacedRGBAlpha8(Src, Dest, Trans: pChar); +var + i: Integer; +begin + {Copy the data to the destination, including data from Trans pointer} + FOR i := 1 TO ImageWidth do + begin + Byte(Dest^) := Owner.InverseGamma[PByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := Owner.InverseGamma[PByte(Longint(Src) + 1)^]; inc(Dest); + Byte(Dest^) := Owner.InverseGamma[PByte(Longint(Src) )^]; inc(Dest); + Dest^ := Trans^; inc(Dest); + inc(Src, 3); inc(Trans); + end {for i}; +end; + +{Encode images using RGB followed by an alpha value using 2 byte for each} +procedure TChunkIDAT.EncodeNonInterlacedRGBAlpha16(Src, Dest, Trans: pChar); +var + i: Integer; +begin + {Copy the data to the destination, including data from Trans pointer} + FOR i := 1 TO ImageWidth do + begin + pWord(Dest)^ := Owner.InverseGamma[PByte(Longint(Src) + 2)^]; inc(Dest, 2); + pWord(Dest)^ := Owner.InverseGamma[PByte(Longint(Src) + 1)^]; inc(Dest, 2); + pWord(Dest)^ := Owner.InverseGamma[PByte(Longint(Src) )^]; inc(Dest, 2); + pWord(Dest)^ := PByte(Longint(Trans) )^; inc(Dest, 2); + inc(Src, 3); inc(Trans); + end {for i}; +end; + +{Encode grayscale images followed by an alpha value using 1 byte for each} +procedure TChunkIDAT.EncodeNonInterlacedGrayscaleAlpha8( + Src, Dest, Trans: pChar); +var + i: Integer; +begin + {Copy the data to the destination, including data from Trans pointer} + FOR i := 1 TO ImageWidth do + begin + Dest^ := Src^; inc(Dest); + Dest^ := Trans^; inc(Dest); + inc(Src); inc(Trans); + end {for i}; +end; + +{Encode grayscale images followed by an alpha value using 2 byte for each} +procedure TChunkIDAT.EncodeNonInterlacedGrayscaleAlpha16( + Src, Dest, Trans: pChar); +var + i: Integer; +begin + {Copy the data to the destination, including data from Trans pointer} + FOR i := 1 TO ImageWidth do + begin + pWord(Dest)^ := pByte(Src)^; inc(Dest, 2); + pWord(Dest)^ := pByte(Trans)^; inc(Dest, 2); + inc(Src); inc(Trans); + end {for i}; +end; + +{Encode non interlaced images} +procedure TChunkIDAT.EncodeNonInterlaced(Stream: TStream; + var ZLIBStream: TZStreamRec2); +var + {Current line} + j: Cardinal; + {Pointers to image data} + Data, Trans: PChar; + {Filter used for this line} + Filter: Byte; + {Method which will copy the data into the buffer} + CopyProc: procedure(Src, Dest, Trans: pChar) of object; +begin + CopyProc := nil; {Initialize to avoid warnings} + {Defines the method to copy the data to the buffer depending on} + {the image parameters} + case Header.ColorType of + {R, G, B values} + COLOR_RGB: + case Header.BitDepth of + 8: CopyProc := EncodeNonInterlacedRGB8; + 16: CopyProc := EncodeNonInterlacedRGB16; + end; + {Palette and grayscale values} + COLOR_GRAYSCALE, COLOR_PALETTE: + case Header.BitDepth of + 1, 4, 8: CopyProc := EncodeNonInterlacedPalette148; + 16: CopyProc := EncodeNonInterlacedGrayscale16; + end; + {RGB with a following alpha value} + COLOR_RGBALPHA: + case Header.BitDepth of + 8: CopyProc := EncodeNonInterlacedRGBAlpha8; + 16: CopyProc := EncodeNonInterlacedRGBAlpha16; + end; + {Grayscale images followed by an alpha} + COLOR_GRAYSCALEALPHA: + case Header.BitDepth of + 8: CopyProc := EncodeNonInterlacedGrayscaleAlpha8; + 16: CopyProc := EncodeNonInterlacedGrayscaleAlpha16; + end; + end {case Header.ColorType}; + + {Get the image data pointer} + Longint(Data) := Longint(Header.ImageData) + + Header.BytesPerRow * (ImageHeight - 1); + Trans := Header.ImageAlpha; + + {Writes each line} + FOR j := 0 to ImageHeight - 1 do + begin + {Copy data into buffer} + CopyProc(Data, @Encode_Buffer[BUFFER][0], Trans); + {Filter data} + Filter := FilterToEncode; + + {Compress data} + IDATZlibWrite(ZLIBStream, @Filter, 1); + IDATZlibWrite(ZLIBStream, @Encode_Buffer[Filter][0], Row_Bytes); + + {Adjust pointers to the actual image data} + dec(Data, Header.BytesPerRow); + inc(Trans, ImageWidth); + end; + + {Compress and finishes copying the remaining data} + FinishIDATZlib(ZLIBStream); +end; + +{Copy memory to encode interlaced images using RGB value with 1 byte for} +{each color sample} +procedure TChunkIDAT.EncodeInterlacedRGB8(const Pass: Byte; + Src, Dest, Trans: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Src := pChar(Longint(Src) + Col * 3); + repeat + {Copy this row} + Byte(Dest^) := fOwner.InverseGamma[pByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := fOwner.InverseGamma[pByte(Longint(Src) + 1)^]; inc(Dest); + Byte(Dest^) := fOwner.InverseGamma[pByte(Longint(Src) )^]; inc(Dest); + + {Move to next column} + inc(Src, ColumnIncrement[Pass] * 3); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Copy memory to encode interlaced RGB images with 2 bytes each color sample} +procedure TChunkIDAT.EncodeInterlacedRGB16(const Pass: Byte; + Src, Dest, Trans: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Src := pChar(Longint(Src) + Col * 3); + repeat + {Copy this row} + pWord(Dest)^ := Owner.InverseGamma[pByte(Longint(Src) + 2)^]; inc(Dest, 2); + pWord(Dest)^ := Owner.InverseGamma[pByte(Longint(Src) + 1)^]; inc(Dest, 2); + pWord(Dest)^ := Owner.InverseGamma[pByte(Longint(Src) )^]; inc(Dest, 2); + + {Move to next column} + inc(Src, ColumnIncrement[Pass] * 3); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Copy memory to encode interlaced images using palettes using bit depths} +{1, 4, 8 (each pixel in the image)} +procedure TChunkIDAT.EncodeInterlacedPalette148(const Pass: Byte; + Src, Dest, Trans: pChar); +const + BitTable: Array[1..8] of Integer = ($1, $3, 0, $F, 0, 0, 0, $FF); + StartBit: Array[1..8] of Integer = (7 , 0 , 0, 4, 0, 0, 0, 0); +var + CurBit, Col: Integer; + Src2: PChar; +begin + {Clean the line} + fillchar(Dest^, Row_Bytes, #0); + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + with Header.BitmapInfo.bmiHeader do + repeat + {Copy data} + CurBit := StartBit[biBitCount]; + repeat + {Adjust pointer to pixel byte bounds} + Src2 := pChar(Longint(Src) + (biBitCount * Col) div 8); + {Copy data} + Byte(Dest^) := Byte(Dest^) or + (((Byte(Src2^) shr (StartBit[Header.BitDepth] - (biBitCount * Col) + mod 8))) and (BitTable[biBitCount])) shl CurBit; + + {Move to next column} + inc(Col, ColumnIncrement[Pass]); + {Will read next bits} + dec(CurBit, biBitCount); + until CurBit < 0; + + {Move to next byte in source} + inc(Dest); + until Col >= ImageWidth; +end; + +{Copy to encode interlaced grayscale images using 16 bits for each sample} +procedure TChunkIDAT.EncodeInterlacedGrayscale16(const Pass: Byte; + Src, Dest, Trans: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Src := pChar(Longint(Src) + Col); + repeat + {Copy this row} + pWord(Dest)^ := Byte(Src^); inc(Dest, 2); + + {Move to next column} + inc(Src, ColumnIncrement[Pass]); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Copy to encode interlaced rgb images followed by an alpha value, all using} +{one byte for each sample} +procedure TChunkIDAT.EncodeInterlacedRGBAlpha8(const Pass: Byte; + Src, Dest, Trans: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Src := pChar(Longint(Src) + Col * 3); + Trans := pChar(Longint(Trans) + Col); + repeat + {Copy this row} + Byte(Dest^) := Owner.InverseGamma[pByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := Owner.InverseGamma[pByte(Longint(Src) + 1)^]; inc(Dest); + Byte(Dest^) := Owner.InverseGamma[pByte(Longint(Src) )^]; inc(Dest); + Dest^ := Trans^; inc(Dest); + + {Move to next column} + inc(Src, ColumnIncrement[Pass] * 3); + inc(Trans, ColumnIncrement[Pass]); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Copy to encode interlaced rgb images followed by an alpha value, all using} +{two byte for each sample} +procedure TChunkIDAT.EncodeInterlacedRGBAlpha16(const Pass: Byte; + Src, Dest, Trans: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Src := pChar(Longint(Src) + Col * 3); + Trans := pChar(Longint(Trans) + Col); + repeat + {Copy this row} + pWord(Dest)^ := pByte(Longint(Src) + 2)^; inc(Dest, 2); + pWord(Dest)^ := pByte(Longint(Src) + 1)^; inc(Dest, 2); + pWord(Dest)^ := pByte(Longint(Src) )^; inc(Dest, 2); + pWord(Dest)^ := pByte(Trans)^; inc(Dest, 2); + + {Move to next column} + inc(Src, ColumnIncrement[Pass] * 3); + inc(Trans, ColumnIncrement[Pass]); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Copy to encode grayscale interlaced images followed by an alpha value, all} +{using 1 byte for each sample} +procedure TChunkIDAT.EncodeInterlacedGrayscaleAlpha8(const Pass: Byte; + Src, Dest, Trans: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Src := pChar(Longint(Src) + Col); + Trans := pChar(Longint(Trans) + Col); + repeat + {Copy this row} + Dest^ := Src^; inc(Dest); + Dest^ := Trans^; inc(Dest); + + {Move to next column} + inc(Src, ColumnIncrement[Pass]); + inc(Trans, ColumnIncrement[Pass]); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Copy to encode grayscale interlaced images followed by an alpha value, all} +{using 2 bytes for each sample} +procedure TChunkIDAT.EncodeInterlacedGrayscaleAlpha16(const Pass: Byte; + Src, Dest, Trans: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Src := pChar(Longint(Src) + Col); + Trans := pChar(Longint(Trans) + Col); + repeat + {Copy this row} + pWord(Dest)^ := pByte(Src)^; inc(Dest, 2); + pWord(Dest)^ := pByte(Trans)^; inc(Dest, 2); + + {Move to next column} + inc(Src, ColumnIncrement[Pass]); + inc(Trans, ColumnIncrement[Pass]); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Encode interlaced images} +procedure TChunkIDAT.EncodeInterlacedAdam7(Stream: TStream; + var ZLIBStream: TZStreamRec2); +var + CurrentPass, Filter: Byte; + PixelsThisRow: Integer; + CurrentRow : Integer; + Trans, Data: pChar; + CopyProc: procedure(const Pass: Byte; + Src, Dest, Trans: pChar) of object; +begin + CopyProc := nil; {Initialize to avoid warnings} + {Defines the method to copy the data to the buffer depending on} + {the image parameters} + case Header.ColorType of + {R, G, B values} + COLOR_RGB: + case Header.BitDepth of + 8: CopyProc := EncodeInterlacedRGB8; + 16: CopyProc := EncodeInterlacedRGB16; + end; + {Grayscale and palette} + COLOR_PALETTE, COLOR_GRAYSCALE: + case Header.BitDepth of + 1, 4, 8: CopyProc := EncodeInterlacedPalette148; + 16: CopyProc := EncodeInterlacedGrayscale16; + end; + {RGB followed by alpha} + COLOR_RGBALPHA: + case Header.BitDepth of + 8: CopyProc := EncodeInterlacedRGBAlpha8; + 16: CopyProc := EncodeInterlacedRGBAlpha16; + end; + COLOR_GRAYSCALEALPHA: + {Grayscale followed by alpha} + case Header.BitDepth of + 8: CopyProc := EncodeInterlacedGrayscaleAlpha8; + 16: CopyProc := EncodeInterlacedGrayscaleAlpha16; + end; + end {case Header.ColorType}; + + {Compress the image using the seven passes for ADAM 7} + FOR CurrentPass := 0 TO 6 DO + begin + {Calculates the number of pixels and bytes for this pass row} + PixelsThisRow := (ImageWidth - ColumnStart[CurrentPass] + + ColumnIncrement[CurrentPass] - 1) div ColumnIncrement[CurrentPass]; + Row_Bytes := BytesForPixels(PixelsThisRow, Header.ColorType, + Header.BitDepth); + ZeroMemory(Encode_Buffer[FILTER_NONE], Row_Bytes); + + {Get current row index} + CurrentRow := RowStart[CurrentPass]; + {Get a pointer to the current row image data} + Data := Ptr(Longint(Header.ImageData) + Header.BytesPerRow * + (ImageHeight - 1 - CurrentRow)); + Trans := Ptr(Longint(Header.ImageAlpha) + ImageWidth * CurrentRow); + + {Process all the image rows} + if Row_Bytes > 0 then + while CurrentRow < ImageHeight do + begin + {Copy data into buffer} + CopyProc(CurrentPass, Data, @Encode_Buffer[BUFFER][0], Trans); + {Filter data} + Filter := FilterToEncode; + + {Compress data} + IDATZlibWrite(ZLIBStream, @Filter, 1); + IDATZlibWrite(ZLIBStream, @Encode_Buffer[Filter][0], Row_Bytes); + + {Move to the next row} + inc(CurrentRow, RowIncrement[CurrentPass]); + {Move pointer to the next line} + dec(Data, RowIncrement[CurrentPass] * Header.BytesPerRow); + inc(Trans, RowIncrement[CurrentPass] * ImageWidth); + end {while CurrentRow < ImageHeight} + + end {CurrentPass}; + + {Compress and finishes copying the remaining data} + FinishIDATZlib(ZLIBStream); +end; + +{Filters the row to be encoded and returns the best filter} +function TChunkIDAT.FilterToEncode: Byte; +var + Run, LongestRun, ii, jj: Cardinal; + Last, Above, LastAbove: Byte; +begin + {Selecting more filters using the Filters property from TPngObject} + {increases the chances to the file be much smaller, but decreases} + {the performace} + + {This method will creates the same line data using the different} + {filter methods and select the best} + + {Sub-filter} + if pfSub in Owner.Filters then + for ii := 0 to Row_Bytes - 1 do + begin + {There is no previous pixel when it's on the first pixel, so} + {set last as zero when in the first} + if (ii >= Offset) then + last := Encode_Buffer[BUFFER]^[ii - Offset] + else + last := 0; + Encode_Buffer[FILTER_SUB]^[ii] := Encode_Buffer[BUFFER]^[ii] - last; + end; + + {Up filter} + if pfUp in Owner.Filters then + for ii := 0 to Row_Bytes - 1 do + Encode_Buffer[FILTER_UP]^[ii] := Encode_Buffer[BUFFER]^[ii] - + Encode_Buffer[FILTER_NONE]^[ii]; + + {Average filter} + if pfAverage in Owner.Filters then + for ii := 0 to Row_Bytes - 1 do + begin + {Get the previous pixel, if the current pixel is the first, the} + {previous is considered to be 0} + if (ii >= Offset) then + last := Encode_Buffer[BUFFER]^[ii - Offset] + else + last := 0; + {Get the pixel above} + above := Encode_Buffer[FILTER_NONE]^[ii]; + + {Calculates formula to the average pixel} + Encode_Buffer[FILTER_AVERAGE]^[ii] := Encode_Buffer[BUFFER]^[ii] - + (above + last) div 2 ; + end; + + {Paeth filter (the slower)} + if pfPaeth in Owner.Filters then + begin + {Initialize} + last := 0; + lastabove := 0; + for ii := 0 to Row_Bytes - 1 do + begin + {In case this pixel is not the first in the line obtains the} + {previous one and the one above the previous} + if (ii >= Offset) then + begin + last := Encode_Buffer[BUFFER]^[ii - Offset]; + lastabove := Encode_Buffer[FILTER_NONE]^[ii - Offset]; + end; + {Obtains the pixel above} + above := Encode_Buffer[FILTER_NONE]^[ii]; + {Calculate paeth filter for this byte} + Encode_Buffer[FILTER_PAETH]^[ii] := Encode_Buffer[BUFFER]^[ii] - + PaethPredictor(last, above, lastabove); + end; + end; + + {Now calculates the same line using no filter, which is necessary} + {in order to have data to the filters when the next line comes} + CopyMemory(@Encode_Buffer[FILTER_NONE]^[0], + @Encode_Buffer[BUFFER]^[0], Row_Bytes); + + {If only filter none is selected in the filter list, we don't need} + {to proceed and further} + if (Owner.Filters = [pfNone]) or (Owner.Filters = []) then + begin + Result := FILTER_NONE; + exit; + end {if (Owner.Filters = [pfNone...}; + + {Check which filter is the best by checking which has the larger} + {sequence of the same byte, since they are best compressed} + LongestRun := 0; Result := FILTER_NONE; + for ii := FILTER_NONE TO FILTER_PAETH do + {Check if this filter was selected} + if TFilter(ii) in Owner.Filters then + begin + Run := 0; + {Check if it's the only filter} + if Owner.Filters = [TFilter(ii)] then + begin + Result := ii; + exit; + end; + + {Check using a sequence of four bytes} + for jj := 2 to Row_Bytes - 1 do + if (Encode_Buffer[ii]^[jj] = Encode_Buffer [ii]^[jj-1]) or + (Encode_Buffer[ii]^[jj] = Encode_Buffer [ii]^[jj-2]) then + inc(Run); {Count the number of sequences} + + {Check if this one is the best so far} + if (Run > LongestRun) then + begin + Result := ii; + LongestRun := Run; + end {if (Run > LongestRun)}; + + end {if TFilter(ii) in Owner.Filters}; +end; + +{TChunkPLTE implementation} + +{Returns an item in the palette} +function TChunkPLTE.GetPaletteItem(Index: Byte): TRGBQuad; +begin + {Test if item is valid, if not raise error} + if Index > Count - 1 then + Owner.RaiseError(EPNGError, EPNGUnknownPalEntryText) + else + {Returns the item} + Result := Header.BitmapInfo.bmiColors[Index]; +end; + +{Loads the palette chunk from a stream} +function TChunkPLTE.LoadFromStream(Stream: TStream; + const ChunkName: TChunkName; Size: Integer): Boolean; +type + pPalEntry = ^PalEntry; + PalEntry = record r, g, b: Byte end; +var + j : Integer; {For the FOR} + PalColor : pPalEntry; +begin + {Let ancestor load data and check CRC} + Result := inherited LoadFromStream(Stream, ChunkName, Size); + if not Result then exit; + + {This chunk must be divisible by 3 in order to be valid} + if (Size mod 3 <> 0) or (Size div 3 > 256) then + begin + {Raise error} + Result := FALSE; + Owner.RaiseError(EPNGInvalidPalette, EPNGInvalidPaletteText); + exit; + end {if Size mod 3 <> 0}; + + {Fill array with the palette entries} + fCount := Size div 3; + PalColor := Data; + FOR j := 0 TO fCount - 1 DO + with Header.BitmapInfo.bmiColors[j] do + begin + rgbRed := Owner.GammaTable[PalColor.r]; + rgbGreen := Owner.GammaTable[PalColor.g]; + rgbBlue := Owner.GammaTable[PalColor.b]; + rgbReserved := 0; + inc(PalColor); {Move to next palette entry} + end; +end; + +{Saves the PLTE chunk to a stream} +function TChunkPLTE.SaveToStream(Stream: TStream): Boolean; +var + J: Integer; + DataPtr: pByte; +begin + {Adjust size to hold all the palette items} + ResizeData(fCount * 3); + {Copy pointer to data} + DataPtr := fData; + + {Copy palette items} + with Header do + FOR j := 0 TO fCount - 1 DO + with BitmapInfo.bmiColors[j] do + begin + DataPtr^ := Owner.InverseGamma[rgbRed]; inc(DataPtr); + DataPtr^ := Owner.InverseGamma[rgbGreen]; inc(DataPtr); + DataPtr^ := Owner.InverseGamma[rgbBlue]; inc(DataPtr); + end {with BitmapInfo}; + + {Let ancestor do the rest of the work} + Result := inherited SaveToStream(Stream); +end; + +{Assigns from another PLTE chunk} +procedure TChunkPLTE.Assign(Source: TChunk); +begin + {Copy the number of palette items} + if Source is TChunkPLTE then + fCount := TChunkPLTE(Source).fCount + else + Owner.RaiseError(EPNGError, EPNGCannotAssignChunkText); +end; + +{TChunkgAMA implementation} + +{Assigns from another chunk} +procedure TChunkgAMA.Assign(Source: TChunk); +begin + {Copy the gamma value} + if Source is TChunkgAMA then + Gamma := TChunkgAMA(Source).Gamma + else + Owner.RaiseError(EPNGError, EPNGCannotAssignChunkText); +end; + +{Gamma chunk being created} +constructor TChunkgAMA.Create(Owner: TPngObject); +begin + {Call ancestor} + inherited Create(Owner); + Gamma := 1; {Initial value} +end; + +{Returns gamma value} +function TChunkgAMA.GetValue: Cardinal; +begin + {Make sure that the size is four bytes} + if DataSize <> 4 then + begin + {Adjust size and returns 1} + ResizeData(4); + Result := 1; + end + {If it's right, read the value} + else Result := Cardinal(ByteSwap(pCardinal(Data)^)) +end; + +function Power(Base, Exponent: Extended): Extended; +begin + if Exponent = 0.0 then + Result := 1.0 {Math rule} + else if (Base = 0) or (Exponent = 0) then Result := 0 + else + Result := Exp(Exponent * Ln(Base)); +end; + + +{Loading the chunk from a stream} +function TChunkgAMA.LoadFromStream(Stream: TStream; + const ChunkName: TChunkName; Size: Integer): Boolean; +var + i: Integer; + Value: Cardinal; +begin + {Call ancestor and test if it went ok} + Result := inherited LoadFromStream(Stream, ChunkName, Size); + if not Result then exit; + Value := Gamma; + {Build gamma table and inverse table for saving} + if Value <> 0 then + with Owner do + FOR i := 0 TO 255 DO + begin + GammaTable[I] := Round(Power((I / 255), 1 / + (Value / 100000 * 2.2)) * 255); + InverseGamma[Round(Power((I / 255), 1 / + (Value / 100000 * 2.2)) * 255)] := I; + end +end; + +{Sets the gamma value} +procedure TChunkgAMA.SetValue(const Value: Cardinal); +begin + {Make sure that the size is four bytes} + if DataSize <> 4 then ResizeData(4); + {If it's right, set the value} + pCardinal(Data)^ := ByteSwap(Value); +end; + +{TPngObject implementation} + +{Assigns from another object} +procedure TPngObject.Assign(Source: TPersistent); +begin + {Assigns contents from another TPNGObject} + if Source is TPNGObject then + AssignPNG(Source as TPNGObject) + {Copy contents from a TBitmap} + {$IFDEF UseDelphi}else if Source is TBitmap then + with Source as TBitmap do + AssignHandle(Handle, Transparent, + ColorToRGB(TransparentColor)){$ENDIF} + {Unknown source, let ancestor deal with it} + else + inherited; +end; + +{Clear all the chunks in the list} +procedure TPngObject.ClearChunks; +var + i: Integer; +begin + {Initialize gamma} + InitializeGamma(); + {Free all the objects and memory (0 chunks Bug fixed by Noel Sharpe)} + for i := 0 TO Integer(Chunks.Count) - 1 do + TChunk(Chunks.Item[i]).Free; + Chunks.Count := 0; +end; + +{Portable Network Graphics object being created} +constructor TPngObject.Create; +begin + {Let it be created} + inherited Create; + + {Initial properties} + TempPalette := 0; + fFilters := [pfSub]; + fCompressionLevel := 7; + fInterlaceMethod := imNone; + fMaxIdatSize := High(Word); + {Create chunklist object} + fChunkList := TPngList.Create(Self); +end; + +{Portable Network Graphics object being destroyed} +destructor TPngObject.Destroy; +begin + {Free object list} + ClearChunks; + fChunkList.Free; + {Free the temporary palette} + if TempPalette <> 0 then DeleteObject(TempPalette); + + {Call ancestor destroy} + inherited Destroy; +end; + +{Returns linesize and byte offset for pixels} +procedure TPngObject.GetPixelInfo(var LineSize, Offset: Cardinal); +begin + {There must be an Header chunk to calculate size} + if HeaderPresent then + begin + {Calculate number of bytes for each line} + LineSize := BytesForPixels(Header.Width, Header.ColorType, Header.BitDepth); + + {Calculates byte offset} + Case Header.ColorType of + {Grayscale} + COLOR_GRAYSCALE: + If Header.BitDepth = 16 Then + Offset := 2 + Else + Offset := 1 ; + {It always smaller or equal one byte, so it occupes one byte} + COLOR_PALETTE: + offset := 1; + {It might be 3 or 6 bytes} + COLOR_RGB: + offset := 3 * Header.BitDepth Div 8; + {It might be 2 or 4 bytes} + COLOR_GRAYSCALEALPHA: + offset := 2 * Header.BitDepth Div 8; + {4 or 8 bytes} + COLOR_RGBALPHA: + offset := 4 * Header.BitDepth Div 8; + else + Offset := 0; + End ; + + end + else + begin + {In case if there isn't any Header chunk} + Offset := 0; + LineSize := 0; + end; + +end; + +{Returns image height} +function TPngObject.GetHeight: Integer; +begin + {There must be a Header chunk to get the size, otherwise returns 0} + if HeaderPresent then + Result := TChunkIHDR(Chunks.Item[0]).Height + else Result := 0; +end; + +{Returns image width} +function TPngObject.GetWidth: Integer; +begin + {There must be a Header chunk to get the size, otherwise returns 0} + if HeaderPresent then + Result := Header.Width + else Result := 0; +end; + +{Returns if the image is empty} +function TPngObject.GetEmpty: Boolean; +begin + Result := (Chunks.Count = 0); +end; + +{Raises an error} +procedure TPngObject.RaiseError(ExceptionClass: ExceptClass; Text: String); +begin + raise ExceptionClass.Create(Text); +end; + +{Set the maximum size for IDAT chunk} +procedure TPngObject.SetMaxIdatSize(const Value: Cardinal); +begin + {Make sure the size is at least 65535} + if Value < High(Word) then + fMaxIdatSize := High(Word) else fMaxIdatSize := Value; +end; + +{$IFNDEF UseDelphi} + {Creates a file stream reading from the filename in the parameter and load} + procedure TPngObject.LoadFromFile(const Filename: String); + var + FileStream: TFileStream; + begin + {Test if the file exists} + if not FileExists(Filename) then + begin + {In case it does not exists, raise error} + RaiseError(EPNGNotExists, EPNGNotExistsText); + exit; + end; + + {Creates the file stream to read} + FileStream := TFileStream.Create(Filename, [fsmRead]); + LoadFromStream(FileStream); {Loads the data} + FileStream.Free; {Free file stream} + end; + + {Saves the current png image to a file} + procedure TPngObject.SaveToFile(const Filename: String); + var + FileStream: TFileStream; + begin + {Creates the file stream to write} + FileStream := TFileStream.Create(Filename, [fsmWrite]); + SaveToStream(FileStream); {Saves the data} + FileStream.Free; {Free file stream} + end; + +{$ENDIF} + +{Returns pointer to the chunk TChunkIHDR which should be the first} +function TPngObject.GetHeader: TChunkIHDR; +begin + {If there is a TChunkIHDR returns it, otherwise returns nil} + if (Chunks.Count <> 0) and (Chunks.Item[0] is TChunkIHDR) then + Result := Chunks.Item[0] as TChunkIHDR + else + begin + {No header, throw error message} + RaiseError(EPNGHeaderNotPresent, EPNGHeaderNotPresentText); + Result := nil + end +end; + +{Draws using partial transparency} +procedure TPngObject.DrawPartialTrans(DC: HDC; Rect: TRect); +type + {Access to pixels} + TPixelLine = Array[Word] of TRGBQuad; + pPixelLine = ^TPixelLine; +const + {Structure used to create the bitmap} + BitmapInfoHeader: TBitmapInfoHeader = + (biSize: sizeof(TBitmapInfoHeader); + biWidth: 100; + biHeight: 100; + biPlanes: 1; + biBitCount: 32; + biCompression: BI_RGB; + biSizeImage: 0; + biXPelsPerMeter: 0; + biYPelsPerMeter: 0; + biClrUsed: 0; + biClrImportant: 0); +var + {Buffer bitmap creation} + BitmapInfo : TBitmapInfo; + BufferDC : HDC; + BufferBits : Pointer; + OldBitmap, + BufferBitmap: HBitmap; + + {Transparency/palette chunks} + TransparencyChunk: TChunktRNS; + PaletteChunk: TChunkPLTE; + TransValue, PaletteIndex: Byte; + CurBit: Integer; + Data: PByte; + + {Buffer bitmap modification} + BytesPerRowDest, + BytesPerRowSrc, + BytesPerRowAlpha: Integer; + ImageSource, + AlphaSource : pByteArray; + ImageData : pPixelLine; + i, j : Integer; +begin + {Prepare to create the bitmap} + Fillchar(BitmapInfo, sizeof(BitmapInfo), #0); + BitmapInfoHeader.biWidth := Header.Width; + BitmapInfoHeader.biHeight := -1 * Header.Height; + BitmapInfo.bmiHeader := BitmapInfoHeader; + + {Create the bitmap which will receive the background, the applied} + {alpha blending and then will be painted on the background} + BufferDC := CreateCompatibleDC(0); + {In case BufferDC could not be created} + if (BufferDC = 0) then RaiseError(EPNGOutMemory, EPNGOutMemoryText); + BufferBitmap := CreateDIBSection(BufferDC, BitmapInfo, DIB_RGB_COLORS, + BufferBits, 0, 0); + {In case buffer bitmap could not be created} + if (BufferBitmap = 0) or (BufferBits = Nil) then + begin + if BufferBitmap <> 0 then DeleteObject(BufferBitmap); + DeleteDC(BufferDC); + RaiseError(EPNGOutMemory, EPNGOutMemoryText); + end; + + {Selects new bitmap and release old bitmap} + OldBitmap := SelectObject(BufferDC, BufferBitmap); + + {Draws the background on the buffer image} + StretchBlt(BufferDC, 0, 0, Header.Width, Header.height, DC, Rect.Left, + Rect.Top, Header.Width, Header.Height, SRCCOPY); + + {Obtain number of bytes for each row} + BytesPerRowAlpha := Header.Width; + BytesPerRowDest := (((BitmapInfo.bmiHeader.biBitCount * Width) + 31) + and not 31) div 8; {Number of bytes for each image row in destination} + BytesPerRowSrc := (((Header.BitmapInfo.bmiHeader.biBitCount * Header.Width) + + 31) and not 31) div 8; {Number of bytes for each image row in source} + + {Obtains image pointers} + ImageData := BufferBits; + AlphaSource := Header.ImageAlpha; + Longint(ImageSource) := Longint(Header.ImageData) + + Header.BytesPerRow * Longint(Header.Height - 1); + + case Header.BitmapInfo.bmiHeader.biBitCount of + {R, G, B images} + 24: + FOR j := 1 TO Header.Height DO + begin + {Process all the pixels in this line} + FOR i := 0 TO Header.Width - 1 DO + with ImageData[i] do + begin + rgbRed := (255+ImageSource[2+i*3] * AlphaSource[i] + rgbRed * (255 - + AlphaSource[i])) shr 8; + rgbGreen := (255+ImageSource[1+i*3] * AlphaSource[i] + rgbGreen * + (255 - AlphaSource[i])) shr 8; + rgbBlue := (255+ImageSource[i*3] * AlphaSource[i] + rgbBlue * + (255 - AlphaSource[i])) shr 8; + end; + + {Move pointers} + Longint(ImageData) := Longint(ImageData) + BytesPerRowDest; + Longint(ImageSource) := Longint(ImageSource) - BytesPerRowSrc; + Longint(AlphaSource) := Longint(AlphaSource) + BytesPerRowAlpha; + end; + {Palette images with 1 byte for each pixel} + 1,4,8: if Header.ColorType = COLOR_GRAYSCALEALPHA then + FOR j := 1 TO Header.Height DO + begin + {Process all the pixels in this line} + FOR i := 0 TO Header.Width - 1 DO + with ImageData[i], Header.BitmapInfo do begin + rgbRed := (255 + ImageSource[i] * AlphaSource[i] + + rgbRed * (255 - AlphaSource[i])) shr 8; + rgbGreen := (255 + ImageSource[i] * AlphaSource[i] + + rgbGreen * (255 - AlphaSource[i])) shr 8; + rgbBlue := (255 + ImageSource[i] * AlphaSource[i] + + rgbBlue * (255 - AlphaSource[i])) shr 8; + end; + + {Move pointers} + Longint(ImageData) := Longint(ImageData) + BytesPerRowDest; + Longint(ImageSource) := Longint(ImageSource) - BytesPerRowSrc; + Longint(AlphaSource) := Longint(AlphaSource) + BytesPerRowAlpha; + end + else {Palette images} + begin + {Obtain pointer to the transparency chunk} + TransparencyChunk := TChunktRNS(Chunks.ItemFromClass(TChunktRNS)); + PaletteChunk := TChunkPLTE(Chunks.ItemFromClass(TChunkPLTE)); + + FOR j := 1 TO Header.Height DO + begin + {Process all the pixels in this line} + i := 0; Data := @ImageSource[0]; + repeat + CurBit := 0; + + repeat + {Obtains the palette index} + case Header.BitDepth of + 1: PaletteIndex := (Data^ shr (7-(I Mod 8))) and 1; + 2,4: PaletteIndex := (Data^ shr ((1-(I Mod 2))*4)) and $0F; + else PaletteIndex := Data^; + end; + + {Updates the image with the new pixel} + with ImageData[i] do + begin + TransValue := TransparencyChunk.PaletteValues[PaletteIndex]; + rgbRed := (255 + PaletteChunk.Item[PaletteIndex].rgbRed * + TransValue + rgbRed * (255 - TransValue)) shr 8; + rgbGreen := (255 + PaletteChunk.Item[PaletteIndex].rgbGreen * + TransValue + rgbGreen * (255 - TransValue)) shr 8; + rgbBlue := (255 + PaletteChunk.Item[PaletteIndex].rgbBlue * + TransValue + rgbBlue * (255 - TransValue)) shr 8; + end; + + {Move to next data} + inc(i); inc(CurBit, Header.BitmapInfo.bmiHeader.biBitCount); + until CurBit >= 8; + {Move to next source data} + inc(Data); + until i >= Integer(Header.Width); + + {Move pointers} + Longint(ImageData) := Longint(ImageData) + BytesPerRowDest; + Longint(ImageSource) := Longint(ImageSource) - BytesPerRowSrc; + end + end {Palette images} + end {case Header.BitmapInfo.bmiHeader.biBitCount}; + + {Draws the new bitmap on the foreground} + StretchBlt(DC, Rect.Left, Rect.Top, Header.Width, Header.Height, BufferDC, + 0, 0, Header.Width, Header.Height, SRCCOPY); + + {Free bitmap} + SelectObject(BufferDC, OldBitmap); + DeleteObject(BufferBitmap); + DeleteDC(BufferDC); +end; + +{Draws the image into a canvas} +procedure TPngObject.Draw(ACanvas: TCanvas; const Rect: TRect); +var + Header: TChunkIHDR; +begin + {Quit in case there is no header, otherwise obtain it} + if (Chunks.Count = 0) or not (Chunks.GetItem(0) is TChunkIHDR) then Exit; + Header := Chunks.GetItem(0) as TChunkIHDR; + + {Copy the data to the canvas} + case Self.TransparencyMode of + {$IFDEF PartialTransparentDraw} + ptmPartial: + DrawPartialTrans(ACanvas{$IFDEF UseDelphi}.Handle{$ENDIF}, Rect); + {$ENDIF} + ptmBit: DrawTransparentBitmap(ACanvas{$IFDEF UseDelphi}.Handle{$ENDIF}, + Header.ImageData, Header.BitmapInfo.bmiHeader, + pBitmapInfo(@Header.BitmapInfo), Rect, + {$IFDEF UseDelphi}ColorToRGB({$ENDIF}TransparentColor) + {$IFDEF UseDelphi}){$ENDIF} + else + StretchDiBits(ACanvas{$IFDEF UseDelphi}.Handle{$ENDIF}, Rect.Left, + Rect.Top, Rect.Right - Rect.Left, Rect.Bottom - Rect.Top, 0, 0, + Header.Width, Header.Height, Header.ImageData, + pBitmapInfo(@Header.BitmapInfo)^, DIB_RGB_COLORS, SRCCOPY) + end {case} +end; + +{Characters for the header} +const + PngHeader: Array[0..7] of Char = (#137, #80, #78, #71, #13, #10, #26, #10); + +{Loads the image from a stream of data} +procedure TPngObject.LoadFromStream(Stream: TStream); +var + Header : Array[0..7] of Char; + HasIDAT : Boolean; + + {Chunks reading} + ChunkCount : Cardinal; + ChunkLength: Cardinal; + ChunkName : TChunkName; +begin + {Initialize before start loading chunks} + ChunkCount := 0; + ClearChunks(); + {Reads the header} + Stream.Read(Header[0], 8); + + {Test if the header matches} + if Header <> PngHeader then + begin + RaiseError(EPNGInvalidFileHeader, EPNGInvalidFileHeaderText); + Exit; + end; + + + HasIDAT := FALSE; + Chunks.Count := 10; + + {Load chunks} + repeat + inc(ChunkCount); {Increment number of chunks} + if Chunks.Count < ChunkCount then {Resize the chunks list if needed} + Chunks.Count := Chunks.Count + 10; + + {Reads chunk length and invert since it is in network order} + {also checks the Read method return, if it returns 0, it} + {means that no bytes was readed, probably because it reached} + {the end of the file} + if Stream.Read(ChunkLength, 4) = 0 then + begin + {In case it found the end of the file here} + Chunks.Count := ChunkCount - 1; + RaiseError(EPNGUnexpectedEnd, EPNGUnexpectedEndText); + end; + + ChunkLength := ByteSwap(ChunkLength); + {Reads chunk name} + Stream.Read(Chunkname, 4); + + {Here we check if the first chunk is the Header which is necessary} + {to the file in order to be a valid Portable Network Graphics image} + if (ChunkCount = 1) and (ChunkName <> 'IHDR') then + begin + Chunks.Count := ChunkCount - 1; + RaiseError(EPNGIHDRNotFirst, EPNGIHDRNotFirstText); + exit; + end; + + {Has a previous IDAT} + if (HasIDAT and (ChunkName = 'IDAT')) or (ChunkName = 'cHRM') then + begin + dec(ChunkCount); + Stream.Seek(ChunkLength + 4, soFromCurrent); + Continue; + end; + {Tell it has an IDAT chunk} + if ChunkName = 'IDAT' then HasIDAT := TRUE; + + {Creates object for this chunk} + Chunks.SetItem(ChunkCount - 1, CreateClassChunk(Self, ChunkName)); + + {Check if the chunk is critical and unknown} + {$IFDEF ErrorOnUnknownCritical} + if (TChunk(Chunks.Item[ChunkCount - 1]).ClassType = TChunk) and + ((Byte(ChunkName[0]) AND $20) = 0) and (ChunkName <> '') then + begin + Chunks.Count := ChunkCount; + RaiseError(EPNGUnknownCriticalChunk, EPNGUnknownCriticalChunkText); + end; + {$ENDIF} + + {Loads it} + try if not TChunk(Chunks.Item[ChunkCount - 1]).LoadFromStream(Stream, + ChunkName, ChunkLength) then break; + except + Chunks.Count := ChunkCount; + raise; + end; + + {Terminates when it reaches the IEND chunk} + until (ChunkName = 'IEND'); + + {Resize the list to the appropriate size} + Chunks.Count := ChunkCount; + + {Check if there is data} + if not HasIDAT then + RaiseError(EPNGNoImageData, EPNGNoImageDataText); +end; + +{Changing height is not supported} +procedure TPngObject.SetHeight(Value: Integer); +begin + RaiseError(EPNGError, EPNGCannotChangeSizeText); +end; + +{Changing width is not supported} +procedure TPngObject.SetWidth(Value: Integer); +begin + RaiseError(EPNGError, EPNGCannotChangeSizeText); +end; + +{$IFDEF UseDelphi} +{Saves to clipboard format (thanks to Antoine Pottern)} +procedure TPNGObject.SaveToClipboardFormat(var AFormat: Word; + var AData: THandle; var APalette: HPalette); +begin + with TBitmap.Create do + try + Width := Self.Width; + Height := Self.Height; + Self.Draw(Canvas, Rect(0, 0, Width, Height)); + SaveToClipboardFormat(AFormat, AData, APalette); + finally + Free; + end {try} +end; + +{Loads data from clipboard} +procedure TPngObject.LoadFromClipboardFormat(AFormat: Word; + AData: THandle; APalette: HPalette); +begin + with TBitmap.Create do + try + LoadFromClipboardFormat(AFormat, AData, APalette); + Self.AssignHandle(Handle, False, 0); + finally + Free; + end {try} +end; + +{Returns if the image is transparent} +function TPngObject.GetTransparent: Boolean; +begin + Result := (TransparencyMode <> ptmNone); +end; + +{$ENDIF} + +{Saving the PNG image to a stream of data} +procedure TPngObject.SaveToStream(Stream: TStream); +var + j: Integer; +begin + {Reads the header} + Stream.Write(PNGHeader[0], 8); + {Write each chunk} + FOR j := 0 TO Chunks.Count - 1 DO + Chunks.Item[j].SaveToStream(Stream) +end; + +{Prepares the Header chunk} +procedure BuildHeader(Header: TChunkIHDR; Handle: HBitmap; Info: pBitmap; + HasPalette: Boolean); +var + DC: HDC; +begin + {Set width and height} + Header.Width := Info.bmWidth; + Header.Height := abs(Info.bmHeight); + {Set bit depth} + if Info.bmBitsPixel >= 16 then + Header.BitDepth := 8 else Header.BitDepth := Info.bmBitsPixel; + {Set color type} + if Info.bmBitsPixel >= 16 then + Header.ColorType := COLOR_RGB else Header.ColorType := COLOR_PALETTE; + {Set other info} + Header.CompressionMethod := 0; {deflate/inflate} + Header.InterlaceMethod := 0; {no interlace} + + {Prepares bitmap headers to hold data} + Header.PrepareImageData(); + {Copy image data} + DC := CreateCompatibleDC(0); + GetDIBits(DC, Handle, 0, Header.Height, Header.ImageData, + pBitmapInfo(@Header.BitmapInfo)^, DIB_RGB_COLORS); + DeleteDC(DC); +end; + +{Loads the image from a resource} +procedure TPngObject.LoadFromResourceName(Instance: HInst; + const Name: String); +var + ResStream: TResourceStream; +begin + {Creates an especial stream to load from the resource} + try ResStream := TResourceStream.Create(Instance, Name, RT_RCDATA); + except RaiseError(EPNGCouldNotLoadResource, EPNGCouldNotLoadResourceText); + exit; end; + + {Loads the png image from the resource} + try + LoadFromStream(ResStream); + finally + ResStream.Free; + end; +end; + +{Loads the png from a resource ID} +procedure TPngObject.LoadFromResourceID(Instance: HInst; ResID: Integer); +begin + LoadFromResourceName(Instance, String(ResID)); +end; + +{Assigns this tpngobject to another object} +procedure TPngObject.AssignTo(Dest: TPersistent); +{$IFDEF UseDelphi} +var + DeskDC: HDC; + TRNS: TChunkTRNS; +{$ENDIF} +begin + {If the destination is also a TPNGObject make it assign} + {this one} + if Dest is TPNGObject then + TPNGObject(Dest).AssignPNG(Self) + {$IFDEF UseDelphi} + {In case the destination is a bitmap} + else if (Dest is TBitmap) and HeaderPresent then + begin + {Device context} + DeskDC := GetDC(0); + {Copy the data} + TBitmap(Dest).Handle := CreateDIBitmap(DeskDC, + Header.BitmapInfo.bmiHeader, CBM_INIT, Header.ImageData, + pBitmapInfo(@Header.BitmapInfo)^, DIB_RGB_COLORS); + ReleaseDC(0, DeskDC); + {Tests for the best pixelformat} + case Header.BitmapInfo.bmiHeader.biBitCount of + 1: TBitmap(Dest).PixelFormat := pf1Bit; + 4: TBitmap(Dest).PixelFormat := pf4Bit; + 8: TBitmap(Dest).PixelFormat := pf8Bit; + 24: TBitmap(Dest).PixelFormat := pf24Bit; + 32: TBitmap(Dest).PixelFormat := pf32Bit; + end {case Header.BitmapInfo.bmiHeader.biBitCount}; + + {Copy transparency mode} + if (TransparencyMode = ptmBit) then + begin + TRNS := Chunks.ItemFromClass(TChunkTRNS) as TChunkTRNS; + TBitmap(Dest).TransparentColor := TRNS.TransparentColor; + TBitmap(Dest).Transparent := True + end {if (TransparencyMode = ptmBit)} + + end + else + {Unknown destination kind, } + inherited AssignTo(Dest); + {$ENDIF} +end; + +{Assigns from a bitmap object} +procedure TPngObject.AssignHandle(Handle: HBitmap; Transparent: Boolean; + TransparentColor: ColorRef); +var + BitmapInfo: Windows.TBitmap; + HasPalette: Boolean; + + {Chunks} + Header: TChunkIHDR; + PLTE: TChunkPLTE; + IDAT: TChunkIDAT; + IEND: TChunkIEND; + TRNS: TChunkTRNS; +begin + {Obtain bitmap info} + GetObject(Handle, SizeOf(BitmapInfo), @BitmapInfo); + + {Only bit depths 1, 4 and 8 needs a palette} + HasPalette := (BitmapInfo.bmBitsPixel < 16); + + {Clear old chunks and prepare} + ClearChunks(); + + {Create the chunks} + Header := TChunkIHDR.Create(Self); + if HasPalette then PLTE := TChunkPLTE.Create(Self) else PLTE := nil; + if Transparent then TRNS := TChunkTRNS.Create(Self) else TRNS := nil; + IDAT := TChunkIDAT.Create(Self); + IEND := TChunkIEND.Create(Self); + + {Add chunks} + TPNGPointerList(Chunks).Add(Header); + if HasPalette then TPNGPointerList(Chunks).Add(PLTE); + if Transparent then TPNGPointerList(Chunks).Add(TRNS); + TPNGPointerList(Chunks).Add(IDAT); + TPNGPointerList(Chunks).Add(IEND); + + {This method will fill the Header chunk with bitmap information} + {and copy the image data} + BuildHeader(Header, Handle, @BitmapInfo, HasPalette); + {In case there is a image data, set the PLTE chunk fCount variable} + {to the actual number of palette colors which is 2^(Bits for each pixel)} + if HasPalette then PLTE.fCount := 1 shl BitmapInfo.bmBitsPixel; + + {In case it is a transparent bitmap, prepares it} + if Transparent then TRNS.TransparentColor := TransparentColor; + +end; + +{Assigns from another PNG} +procedure TPngObject.AssignPNG(Source: TPNGObject); +var + J: Integer; +begin + {Copy properties} + InterlaceMethod := Source.InterlaceMethod; + MaxIdatSize := Source.MaxIdatSize; + CompressionLevel := Source.CompressionLevel; + Filters := Source.Filters; + + {Clear old chunks and prepare} + ClearChunks(); + Chunks.Count := Source.Chunks.Count; + {Create chunks and makes a copy from the source} + FOR J := 0 TO Chunks.Count - 1 DO + with Source.Chunks do + begin + Chunks.SetItem(J, TChunkClass(TChunk(Item[J]).ClassType).Create(Self)); + TChunk(Chunks.Item[J]).Assign(TChunk(Item[J])); + end {with}; +end; + +{Returns a alpha data scanline} +function TPngObject.GetAlphaScanline(const LineIndex: Integer): pByteArray; +begin + with Header do + if (ColorType = COLOR_RGBALPHA) or (ColorType = COLOR_GRAYSCALEALPHA) then + Longint(Result) := Longint(ImageAlpha) + (LineIndex * Longint(Width)) + else Result := nil; {In case the image does not use alpha information} +end; + +{$IFDEF Store16bits} +{Returns a png data extra scanline} +function TPngObject.GetExtraScanline(const LineIndex: Integer): Pointer; +begin + with Header do + Longint(Result) := (Longint(ExtraImageData) + ((Longint(Height) - 1) * + BytesPerRow)) - (LineIndex * BytesPerRow); +end; +{$ENDIF} + +{Returns a png data scanline} +function TPngObject.GetScanline(const LineIndex: Integer): Pointer; +begin + with Header do + Longint(Result) := (Longint(ImageData) + ((Longint(Height) - 1) * + BytesPerRow)) - (LineIndex * BytesPerRow); +end; + +{Initialize gamma table} +procedure TPngObject.InitializeGamma; +var + i: Integer; +begin + {Build gamma table as if there was no gamma} + FOR i := 0 to 255 do + begin + GammaTable[i] := i; + InverseGamma[i] := i; + end {for i} +end; + +{Returns the transparency mode used by this png} +function TPngObject.GetTransparencyMode: TPNGTransparencyMode; +var + TRNS: TChunkTRNS; +begin + with Header do + begin + Result := ptmNone; {Default result} + {Gets the TRNS chunk pointer} + TRNS := Chunks.ItemFromClass(TChunkTRNS) as TChunkTRNS; + + {Test depending on the color type} + case ColorType of + {This modes are always partial} + COLOR_RGBALPHA, COLOR_GRAYSCALEALPHA: Result := ptmPartial; + {This modes support bit transparency} + COLOR_RGB, COLOR_GRAYSCALE: if TRNS <> nil then Result := ptmBit; + {Supports booth translucid and bit} + COLOR_PALETTE: + {A TRNS chunk must be present, otherwise it won't support transparency} + if TRNS <> nil then + if TRNS.BitTransparency then + Result := ptmBit else Result := ptmPartial + end {case} + + end {with Header} +end; + +{Add a text chunk} +procedure TPngObject.AddtEXt(const Keyword, Text: String); +var + TextChunk: TChunkTEXT; +begin + TextChunk := Chunks.Add(TChunkText) as TChunkTEXT; + TextChunk.Keyword := Keyword; + TextChunk.Text := Text; +end; + +{Add a text chunk} +procedure TPngObject.AddzTXt(const Keyword, Text: String); +var + TextChunk: TChunkzTXt; +begin + TextChunk := Chunks.Add(TChunkText) as TChunkzTXt; + TextChunk.Keyword := Keyword; + TextChunk.Text := Text; +end; + +{Removes the image transparency} +procedure TPngObject.RemoveTransparency; +var + TRNS: TChunkTRNS; +begin + TRNS := Chunks.ItemFromClass(TChunkTRNS) as TChunkTRNS; + if TRNS <> nil then Chunks.RemoveChunk(TRNS) +end; + +{Generates alpha information} +procedure TPngObject.CreateAlpha; +var + TRNS: TChunkTRNS; +begin + {Generates depending on the color type} + with Header do + case ColorType of + {Png allocates different memory space to hold alpha information} + {for these types} + COLOR_GRAYSCALE, COLOR_RGB: + begin + {Transform into the appropriate color type} + if ColorType = COLOR_GRAYSCALE then + ColorType := COLOR_GRAYSCALEALPHA + else ColorType := COLOR_RGBALPHA; + {Allocates memory to hold alpha information} + GetMem(ImageAlpha, Integer(Width) * Integer(Height)); + FillChar(ImageAlpha^, Integer(Width) * Integer(Height), #255); + end; + {Palette uses the TChunktRNS to store alpha} + COLOR_PALETTE: + begin + {Gets/creates TRNS chunk} + if Chunks.ItemFromClass(TChunkTRNS) = nil then + TRNS := Chunks.Add(TChunkTRNS) as TChunkTRNS + else + TRNS := Chunks.ItemFromClass(TChunkTRNS) as TChunkTRNS; + + {Prepares the TRNS chunk} + with TRNS do + begin + Fillchar(PaletteValues[0], 256, 255); + fDataSize := 1 shl Header.BitDepth; + fBitTransparency := False + end {with Chunks.Add}; + end; + end {case Header.ColorType} + +end; + +{Returns transparent color} +function TPngObject.GetTransparentColor: TColor; +var + TRNS: TChunkTRNS; +begin + TRNS := Chunks.ItemFromClass(TChunkTRNS) as TChunkTRNS; + {Reads the transparency chunk to get this info} + if Assigned(TRNS) then Result := TRNS.TransparentColor + else Result := 0 +end; + +{$OPTIMIZATION OFF} +procedure TPngObject.SetTransparentColor(const Value: TColor); +var + TRNS: TChunkTRNS; +begin + if HeaderPresent then + {Tests the ColorType} + case Header.ColorType of + {Not allowed for this modes} + COLOR_RGBALPHA, COLOR_GRAYSCALEALPHA: Self.RaiseError( + EPNGCannotChangeTransparent, EPNGCannotChangeTransparentText); + {Allowed} + COLOR_PALETTE, COLOR_RGB, COLOR_GRAYSCALE: + begin + TRNS := Chunks.ItemFromClass(TChunkTRNS) as TChunkTRNS; + if not Assigned(TRNS) then TRNS := Chunks.Add(TChunkTRNS) as TChunkTRNS; + + {Sets the transparency value from TRNS chunk} + TRNS.TransparentColor := {$IFDEF UseDelphi}ColorToRGB({$ENDIF}Value{$IFDEF UseDelphi}){$ENDIF} + end {COLOR_PALETTE, COLOR_RGB, COLOR_GRAYSCALE)} + end {case} +end; + +{Returns if header is present} +function TPngObject.HeaderPresent: Boolean; +begin + Result := ((Chunks.Count <> 0) and (Chunks.Item[0] is TChunkIHDR)) +end; + +{Returns pixel for png using palette and grayscale} +function GetByteArrayPixel(const png: TPngObject; const X, Y: Integer): TColor; +var + ByteData: Byte; + DataDepth: Byte; +begin + with png, Header do + begin + {Make sure the bitdepth is not greater than 8} + DataDepth := BitDepth; + if DataDepth > 8 then DataDepth := 8; + {Obtains the byte containing this pixel} + ByteData := pByteArray(png.Scanline[Y])^[X div (8 div DataDepth)]; + {Moves the bits we need to the right} + ByteData := (ByteData shr ((8 - DataDepth) - + (X mod (8 div DataDepth)) * DataDepth)); + {Discard the unwanted pixels} + ByteData:= ByteData and ($FF shr (8 - DataDepth)); + + {For palette mode map the palette entry and for grayscale convert and + returns the intensity} + case ColorType of + COLOR_PALETTE: + with TChunkPLTE(png.Chunks.ItemFromClass(TChunkPLTE)).Item[ByteData] do + Result := rgb(GammaTable[rgbRed], GammaTable[rgbGreen], + GammaTable[rgbBlue]); + COLOR_GRAYSCALE: + begin + ByteData := GammaTable[ByteData * ((1 shl DataDepth) + 1)]; + Result := rgb(ByteData, ByteData, ByteData); + end; + else Result := 0; + end {case}; + end {with} +end; + +{In case vcl units are not being used} +{$IFNDEF UseDelphi} +function ColorToRGB(const Color: TColor): COLORREF; +begin + Result := Color +end; +{$ENDIF} + +{Sets a pixel for grayscale and palette pngs} +procedure SetByteArrayPixel(const png: TPngObject; const X, Y: Integer; + const Value: TColor); +const + ClearFlag: Array[1..8] of Integer = (1, 3, 0, 15, 0, 0, 0, $FF); +var + ByteData: pByte; + DataDepth: Byte; + ValEntry: Byte; +begin + with png.Header do + begin + {Map into a palette entry} + ValEntry := GetNearestPaletteIndex(Png.Palette, ColorToRGB(Value)); + + {16 bits grayscale extra bits are discarted} + DataDepth := BitDepth; + if DataDepth > 8 then DataDepth := 8; + {Gets a pointer to the byte we intend to change} + ByteData := @pByteArray(png.Scanline[Y])^[X div (8 div DataDepth)]; + {Clears the old pixel data} + ByteData^ := ByteData^ and not (ClearFlag[DataDepth] shl ((8 - DataDepth) - + (X mod (8 div DataDepth)) * DataDepth)); + + {Setting the new pixel} + ByteData^ := ByteData^ or (ValEntry shl ((8 - DataDepth) - + (X mod (8 div DataDepth)) * DataDepth)); + end {with png.Header} +end; + +{Returns pixel when png uses RGB} +function GetRGBLinePixel(const png: TPngObject; + const X, Y: Integer): TColor; +begin + with pRGBLine(png.Scanline[Y])^[X] do + Result := RGB(rgbtRed, rgbtGreen, rgbtBlue) +end; + +{Sets pixel when png uses RGB} +procedure SetRGBLinePixel(const png: TPngObject; + const X, Y: Integer; Value: TColor); +begin + with pRGBLine(png.Scanline[Y])^[X] do + begin + rgbtRed := GetRValue(Value); + rgbtGreen := GetGValue(Value); + rgbtBlue := GetBValue(Value) + end +end; + +{Sets a pixel} +procedure TPngObject.SetPixels(const X, Y: Integer; const Value: TColor); +begin + if (X in [0..Width - 1]) and (Y in [0..Height - 1]) then + with Header do + begin + if ColorType in [COLOR_GRAYSCALE, COLOR_PALETTE] then + SetByteArrayPixel(Self, X, Y, Value) + else + SetRGBLinePixel(Self, X, Y, Value) + end {with} +end; + +{Returns a pixel} +function TPngObject.GetPixels(const X, Y: Integer): TColor; +begin + if (X in [0..Width - 1]) and (Y in [0..Height - 1]) then + with Header do + begin + if ColorType in [COLOR_GRAYSCALE, COLOR_PALETTE] then + Result := GetByteArrayPixel(Self, X, Y) + else + Result := GetRGBLinePixel(Self, X, Y) + end {with} + else Result := 0 +end; + +{Returns the image palette} +function TPngObject.GetPalette: HPALETTE; +var + LogPalette: TMaxLogPalette; + i: Integer; +begin + {Palette is avaliable for COLOR_PALETTE and COLOR_GRAYSCALE modes} + if (Header.ColorType in [COLOR_PALETTE, COLOR_GRAYSCALE]) then + begin + {In case the pal} + if TempPalette = 0 then + with LogPalette do + begin + {Prepares the new palette} + palVersion := $300; + palNumEntries := 256; + {Copy entries} + for i := 0 to LogPalette.palNumEntries - 1 do + begin + palPalEntry[i].peRed := Header.BitmapInfo.bmiColors[i].rgbRed; + palPalEntry[i].peGreen := Header.BitmapInfo.bmiColors[i].rgbGreen; + palPalEntry[i].peBlue := Header.BitmapInfo.bmiColors[i].rgbBlue; + palPalEntry[i].peFlags := 0; + end {for i}; + {Creates the palette} + TempPalette := CreatePalette(pLogPalette(@LogPalette)^); + end {with LogPalette, if Temppalette = 0} + end {if Header.ColorType in ...}; + Result := TempPalette; +end; + +initialization + {Initialize} + ChunkClasses := nil; + {crc table has not being computed yet} + crc_table_computed := FALSE; + {Register the necessary chunks for png} + RegisterCommonChunks; + {Registers TPNGObject to use with TPicture} + {$IFDEF UseDelphi}{$IFDEF RegisterGraphic} + TPicture.RegisterFileFormat('PNG', 'Portable Network Graphics', TPNGObject); + {$ENDIF}{$ENDIF} +finalization + {$IFDEF UseDelphi}{$IFDEF RegisterGraphic} + TPicture.UnregisterGraphicClass(TPNGObject); + {$ENDIF}{$ENDIF} + {Free chunk classes} + FreeChunkClassList; +end. + + diff --git a/Game/Code/lib/PngImage/pngimage.~pas b/Game/Code/lib/PngImage/pngimage.~pas new file mode 100644 index 00000000..ec712737 --- /dev/null +++ b/Game/Code/lib/PngImage/pngimage.~pas @@ -0,0 +1,5205 @@ +{Portable Network Graphics Delphi 1.4361 (8 March 2003) } + +{This is the latest implementation for TPngImage component } +{It's meant to be a full replacement for the previous one. } +{There are lots of new improvements, including cleaner code, } +{full partial transparency support, speed improvements, } +{saving using ADAM 7 interlacing, better error handling, also } +{the best compression for the final image ever. And now it's } +{truly able to read about any png image. } + +{ + Version 1.4361 + 2003-03-04 - Fixed important bug for simple transparency when using + RGB, Grayscale color modes + + Version 1.436 + 2003-03-04 - * NEW * Property Pixels for direct access to pixels + * IMPROVED * Palette property (TPngObject) (read only) + Slovenian traslation for the component (Miha Petelin) + Help file update (scanline article/png->jpg example) + + Version 1.435 + 2003-11-03 - * NEW * New chunk implementation zTXt (method AddzTXt) + * NEW * New compiler flags to store the extra 8 bits + from 16 bits samples (when saving it is ignored), the + extra data may be acessed using ExtraScanline property + * Fixed * a bug on tIMe chunk + French translation included (Thanks to IBE Software) + Bugs fixed + + Version 1.432 + 2002-08-24 - * NEW * A new method, CreateAlpha will transform the + current image into partial transparency. + Help file updated with a new article on how to handle + partial transparency. + + Version 1.431 + 2002-08-14 - Fixed and tested to work on: + C++ Builder 3 + C++ Builder 5 + Delphi 3 + There was an error when setting TransparentColor, fixed + New method, RemoveTransparency to remove image + BIT TRANSPARENCY + + Version 1.43 + 2002-08-01 - * NEW * Support for Delphi 3 and C++ Builder 3 + Implements mostly some things that were missing, + a few tweaks and fixes. + + Version 1.428 + 2002-07-24 - More minor fixes (thanks to Ian Boyd) + Bit transparency fixes + * NEW * Finally support to bit transparency + (palette / rgb / grayscale -> all) + + Version 1.427 + 2002-07-19 - Lots of bugs and leaks fixed + * NEW * method to easy adding text comments, AddtEXt + * NEW * property for setting bit transparency, + TransparentColor + + Version 1.426 + 2002-07-18 - Clipboard finally fixed (hope) + Changed UseDelphi trigger to UseDelphi + * NEW * Support for bit transparency bitmaps + when assigning from/to TBitmap objects + Altough it does not support drawing transparent + parts of bit transparency pngs (only partial) + it is closer than ever + + Version 1.425 + 2002-07-01 - Clipboard methods implemented + Lots of bugs fixed + + Version 1.424 + 2002-05-16 - Scanline and AlphaScanline are now working correctly. + New methods for handling the clipboard + + Version 1.423 + 2002-05-16 - * NEW * Partial transparency for 1, 2, 4 and 8 bits is + also supported using the tRNS chunk (for palette and + grayscaling). + New bug fixes (Peter Haas). + + Version 1.422 + 2002-05-14 - Fixed some critical leaks, thanks to Peter Haas tips. + New translation for German (Peter Haas). + + Version 1.421 + 2002-05-06 - Now uses new ZLIB version, 1.1.4 with some security + fixes. + LoadFromResourceID and LoadFromResourceName added and + help file updated for that. + The resources strings are now located in pnglang.pas. + New translation for Brazilian Portuguese. + Bugs fixed. + + IMPORTANT: I'm currently looking for bugs on the library. If + anyone has found one, please send me an email and + I will fix right away. Thanks for all the help and + ideias I'm receiving so far.} + +{My new email is: gubadaud@terra.com.br} +{Website link : pngdelphi.sourceforge.net} +{Gustavo Huffenbacher Daud} + +unit pngimage; + +interface + +{Triggers avaliable (edit the fields bellow)} +{$DEFINE UseDelphi} //Disable fat vcl units (perfect to small apps) +{$DEFINE ErrorOnUnknownCritical} //Error when finds an unknown critical chunk +{$DEFINE CheckCRC} //Enables CRC checking +{$DEFINE RegisterGraphic} //Registers TPNGObject to use with TPicture +{$DEFINE PartialTransparentDraw} //Draws partial transparent images +{.$DEFINE Store16bits} //Stores the extra 8 bits from 16bits/sample +{.$DEFINE Debug} //For programming purposes +{$RANGECHECKS OFF} {$J+} + + + +uses + Windows {$IFDEF UseDelphi}, Classes, Graphics, SysUtils{$ENDIF} {$IFDEF Debug}, + dialogs{$ENDIF}, pngzlib, pnglang; + +{$IFNDEF UseDelphi} + const + soFromBeginning = 0; + soFromCurrent = 1; + soFromEnd = 2; +{$ENDIF} + +const + {ZLIB constants} + ZLIBErrors: Array[-6..2] of string = ('incompatible version (-6)', + 'buffer error (-5)', 'insufficient memory (-4)', 'data error (-3)', + 'stream error (-2)', 'file error (-1)', '(0)', 'stream end (1)', + 'need dictionary (2)'); + Z_NO_FLUSH = 0; + Z_FINISH = 4; + Z_STREAM_END = 1; + + {Avaliable PNG filters for mode 0} + FILTER_NONE = 0; + FILTER_SUB = 1; + FILTER_UP = 2; + FILTER_AVERAGE = 3; + FILTER_PAETH = 4; + + {Avaliable color modes for PNG} + COLOR_GRAYSCALE = 0; + COLOR_RGB = 2; + COLOR_PALETTE = 3; + COLOR_GRAYSCALEALPHA = 4; + COLOR_RGBALPHA = 6; + + +type + {$IFNDEF UseDelphi} + {Custom exception handler} + Exception = class(TObject) + constructor Create(Msg: String); + end; + ExceptClass = class of Exception; + TColor = ColorRef; + {$ENDIF} + + {Error types} + EPNGOutMemory = class(Exception); + EPngError = class(Exception); + EPngUnexpectedEnd = class(Exception); + EPngInvalidCRC = class(Exception); + EPngInvalidIHDR = class(Exception); + EPNGMissingMultipleIDAT = class(Exception); + EPNGZLIBError = class(Exception); + EPNGInvalidPalette = class(Exception); + EPNGInvalidFileHeader = class(Exception); + EPNGIHDRNotFirst = class(Exception); + EPNGNotExists = class(Exception); + EPNGSizeExceeds = class(Exception); + EPNGMissingPalette = class(Exception); + EPNGUnknownCriticalChunk = class(Exception); + EPNGUnknownCompression = class(Exception); + EPNGUnknownInterlace = class(Exception); + EPNGNoImageData = class(Exception); + EPNGCouldNotLoadResource = class(Exception); + EPNGCannotChangeTransparent = class(Exception); + EPNGHeaderNotPresent = class(Exception); + +type + {Direct access to pixels using R,G,B} + TRGBLine = array[word] of TRGBTriple; + pRGBLine = ^TRGBLine; + + {Same as TBitmapInfo but with allocated space for} + {palette entries} + TMAXBITMAPINFO = packed record + bmiHeader: TBitmapInfoHeader; + bmiColors: packed array[0..255] of TRGBQuad; + end; + + {Transparency mode for pngs} + TPNGTransparencyMode = (ptmNone, ptmBit, ptmPartial); + {Pointer to a cardinal type} + pCardinal = ^Cardinal; + {Access to a rgb pixel} + pRGBPixel = ^TRGBPixel; + TRGBPixel = packed record + B, G, R: Byte; + end; + + {Pointer to an array of bytes type} + TByteArray = Array[Word] of Byte; + pByteArray = ^TByteArray; + + {Forward} + TPNGObject = class; + pPointerArray = ^TPointerArray; + TPointerArray = Array[Word] of Pointer; + + {Contains a list of objects} + TPNGPointerList = class + private + fOwner: TPNGObject; + fCount : Cardinal; + fMemory: pPointerArray; + function GetItem(Index: Cardinal): Pointer; + procedure SetItem(Index: Cardinal; const Value: Pointer); + protected + {Removes an item} + function Remove(Value: Pointer): Pointer; virtual; + {Inserts an item} + procedure Insert(Value: Pointer; Position: Cardinal); + {Add a new item} + procedure Add(Value: Pointer); + {Returns an item} + property Item[Index: Cardinal]: Pointer read GetItem write SetItem; + {Set the size of the list} + procedure SetSize(const Size: Cardinal); + {Returns owner} + property Owner: TPNGObject read fOwner; + public + {Returns number of items} + property Count: Cardinal read fCount write SetSize; + {Object being either created or destroyed} + constructor Create(AOwner: TPNGObject); + destructor Destroy; override; + end; + + {Forward declaration} + TChunk = class; + TChunkClass = class of TChunk; + + {Same as TPNGPointerList but providing typecasted values} + TPNGList = class(TPNGPointerList) + private + {Used with property Item} + function GetItem(Index: Cardinal): TChunk; + public + {Removes an item} + procedure RemoveChunk(Chunk: TChunk); overload; + {Add a new chunk using the class from the parameter} + function Add(ChunkClass: TChunkClass): TChunk; + {Returns pointer to the first chunk of class} + function ItemFromClass(ChunkClass: TChunkClass): TChunk; + {Returns a chunk item from the list} + property Item[Index: Cardinal]: TChunk read GetItem; + end; + + {$IFNDEF UseDelphi} + {The STREAMs bellow are only needed in case delphi provided ones is not} + {avaliable (UseDelphi trigger not set)} + {Object becomes handles} + TCanvas = THandle; + TBitmap = HBitmap; + {Trick to work} + TPersistent = TObject; + + {Base class for all streams} + TStream = class + protected + {Returning/setting size} + function GetSize: Longint; virtual; + procedure SetSize(const Value: Longint); virtual; abstract; + {Returns/set position} + function GetPosition: Longint; virtual; + procedure SetPosition(const Value: Longint); virtual; + public + {Returns/sets current position} + property Position: Longint read GetPosition write SetPosition; + {Property returns/sets size} + property Size: Longint read GetSize write SetSize; + {Allows reading/writing data} + function Read(var Buffer; Count: Longint): Cardinal; virtual; abstract; + function Write(const Buffer; Count: Longint): Cardinal; virtual; abstract; + {Copies from another Stream} + function CopyFrom(Source: TStream; + Count: Cardinal): Cardinal; virtual; + {Seeks a stream position} + function Seek(Offset: Longint; Origin: Word): Longint; virtual; abstract; + end; + + {File stream modes} + TFileStreamMode = (fsmRead, fsmWrite, fsmCreate); + TFileStreamModeSet = set of TFileStreamMode; + + {File stream for reading from files} + TFileStream = class(TStream) + private + {Opened mode} + Filemode: TFileStreamModeSet; + {Handle} + fHandle: THandle; + protected + {Set the size of the file} + procedure SetSize(const Value: Longint); override; + public + {Seeks a file position} + function Seek(Offset: Longint; Origin: Word): Longint; override; + {Reads/writes data from/to the file} + function Read(var Buffer; Count: Longint): Cardinal; override; + function Write(const Buffer; Count: Longint): Cardinal; override; + {Stream being created and destroy} + constructor Create(Filename: String; Mode: TFileStreamModeSet); + destructor Destroy; override; + end; + + {Stream for reading from resources} + TResourceStream = class(TStream) + constructor Create(Instance: HInst; const ResName: String; ResType:PChar); + private + {Variables for reading} + Size: Integer; + Memory: Pointer; + Position: Integer; + protected + {Set the size of the file} + procedure SetSize(const Value: Longint); override; + public + {Stream processing} + function Read(var Buffer; Count: Integer): Cardinal; override; + function Seek(Offset: Integer; Origin: Word): Longint; override; + function Write(const Buffer; Count: Longint): Cardinal; override; + end; + {$ENDIF} + + {Forward} + TChunkIHDR = class; + {Interlace method} + TInterlaceMethod = (imNone, imAdam7); + {Compression level type} + TCompressionLevel = 0..9; + {Filters type} + TFilter = (pfNone, pfSub, pfUp, pfAverage, pfPaeth); + TFilters = set of TFilter; + + {Png implementation object} + TPngObject = class{$IFDEF UseDelphi}(TGraphic){$ENDIF} + protected + {Gamma table values} + GammaTable, InverseGamma: Array[Byte] of Byte; + procedure InitializeGamma; + private + {Temporary palette} + TempPalette: HPalette; + {Filters to test to encode} + fFilters: TFilters; + {Compression level for ZLIB} + fCompressionLevel: TCompressionLevel; + {Maximum size for IDAT chunks} + fMaxIdatSize: Cardinal; + {Returns if image is interlaced} + fInterlaceMethod: TInterlaceMethod; + {Chunks object} + fChunkList: TPngList; + {Clear all chunks in the list} + procedure ClearChunks; + {Returns if header is present} + function HeaderPresent: Boolean; + {Returns linesize and byte offset for pixels} + procedure GetPixelInfo(var LineSize, Offset: Cardinal); + procedure SetMaxIdatSize(const Value: Cardinal); + function GetAlphaScanline(const LineIndex: Integer): pByteArray; + function GetScanline(const LineIndex: Integer): Pointer; + {$IFDEF Store16bits} + function GetExtraScanline(const LineIndex: Integer): Pointer; + {$ENDIF} + function GetTransparencyMode: TPNGTransparencyMode; + function GetTransparentColor: TColor; + procedure SetTransparentColor(const Value: TColor); + protected + {Returns the image palette} + function GetPalette: HPALETTE; {$IFDEF UseDelphi}override;{$ENDIF} + {Returns/sets image width and height} + function GetWidth: Integer; {$IFDEF UseDelphi}override;{$ENDIF} + function GetHeight: Integer; {$IFDEF UseDelphi}override; {$ENDIF} + procedure SetWidth(Value: Integer); {$IFDEF UseDelphi}override; {$ENDIF} + procedure SetHeight(Value: Integer); {$IFDEF UseDelphi}override;{$ENDIF} + {Assigns from another TPNGObject} + procedure AssignPNG(Source: TPNGObject); + {Returns if the image is empty} + function GetEmpty: Boolean; {$IFDEF UseDelphi}override; {$ENDIF} + {Used with property Header} + function GetHeader: TChunkIHDR; + {Draws using partial transparency} + procedure DrawPartialTrans(DC: HDC; Rect: TRect); + {$IFDEF UseDelphi} + {Returns if the image is transparent} + function GetTransparent: Boolean; override; + {$ENDIF} + {Returns a pixel} + function GetPixels(const X, Y: Integer): TColor; virtual; + procedure SetPixels(const X, Y: Integer; const Value: TColor); virtual; + public + {Generates alpha information} + procedure CreateAlpha; + {Removes the image transparency} + procedure RemoveTransparency; + {Transparent color} + property TransparentColor: TColor read GetTransparentColor write + SetTransparentColor; + {Add text chunk, TChunkTEXT, TChunkzTXT} + procedure AddtEXt(const Keyword, Text: String); + procedure AddzTXt(const Keyword, Text: String); + {$IFDEF UseDelphi} + {Saves to clipboard format (thanks to Antoine Pottern)} + procedure SaveToClipboardFormat(var AFormat: Word; var AData: THandle; + var APalette: HPalette); override; + procedure LoadFromClipboardFormat(AFormat: Word; AData: THandle; + APalette: HPalette); override; + {$ENDIF} + {Calling errors} + procedure RaiseError(ExceptionClass: ExceptClass; Text: String); + {Returns a scanline from png} + property Scanline[const Index: Integer]: Pointer read GetScanline; + {$IFDEF Store16bits} + property ExtraScanline[const Index: Integer]: Pointer read GetExtraScanline; + {$ENDIF} + property AlphaScanline[const Index: Integer]: pByteArray read GetAlphaScanline; + {Returns pointer to the header} + property Header: TChunkIHDR read GetHeader; + {Returns the transparency mode used by this png} + property TransparencyMode: TPNGTransparencyMode read GetTransparencyMode; + {Assigns from another object} + procedure Assign(Source: TPersistent);{$IFDEF UseDelphi}override;{$ENDIF} + {Assigns to another object} + procedure AssignTo(Dest: TPersistent);{$IFDEF UseDelphi}override;{$ENDIF} + {Assigns from a windows bitmap handle} + procedure AssignHandle(Handle: HBitmap; Transparent: Boolean; + TransparentColor: ColorRef); + {Draws the image into a canvas} + procedure Draw(ACanvas: TCanvas; const Rect: TRect); + {$IFDEF UseDelphi}override;{$ENDIF} + {Width and height properties} + property Width: Integer read GetWidth; + property Height: Integer read GetHeight; + {Returns if the image is interlaced} + property InterlaceMethod: TInterlaceMethod read fInterlaceMethod + write fInterlaceMethod; + {Filters to test to encode} + property Filters: TFilters read fFilters write fFilters; + {Maximum size for IDAT chunks, default and minimum is 65536} + property MaxIdatSize: Cardinal read fMaxIdatSize write SetMaxIdatSize; + {Property to return if the image is empty or not} + property Empty: Boolean read GetEmpty; + {Compression level} + property CompressionLevel: TCompressionLevel read fCompressionLevel + write fCompressionLevel; + {Access to the chunk list} + property Chunks: TPngList read fChunkList; + {Object being created and destroyed} + constructor Create; {$IFDEF UseDelphi}override;{$ENDIF} + destructor Destroy; override; + {$IFNDEF UseDelphi}procedure LoadFromFile(const Filename: String);{$ENDIF} + {$IFNDEF UseDelphi}procedure SaveToFile(const Filename: String);{$ENDIF} + procedure LoadFromStream(Stream: TStream); {$IFDEF UseDelphi}override;{$ENDIF} + procedure SaveToStream(Stream: TStream); {$IFDEF UseDelphi}override;{$ENDIF} + {Loading the image from resources} + procedure LoadFromResourceName(Instance: HInst; const Name: String); + procedure LoadFromResourceID(Instance: HInst; ResID: Integer); + {Access to the png pixels} + property Pixels[const X, Y: Integer]: TColor read GetPixels write SetPixels; + {Palette property} + {$IFNDEF UseDelphi}property Palette: HPalette read GetPalette;{$ENDIF} + end; + + {Chunk name object} + TChunkName = Array[0..3] of Char; + + {Global chunk object} + TChunk = class + private + {Contains data} + fData: Pointer; + fDataSize: Cardinal; + {Stores owner} + fOwner: TPngObject; + {Stores the chunk name} + fName: TChunkName; + {Returns pointer to the TChunkIHDR} + function GetHeader: TChunkIHDR; + {Used with property index} + function GetIndex: Integer; + {Should return chunk class/name} + class function GetName: String; virtual; + {Returns the chunk name} + function GetChunkName: String; + public + {Returns index from list} + property Index: Integer read GetIndex; + {Returns pointer to the TChunkIHDR} + property Header: TChunkIHDR read GetHeader; + {Resize the data} + procedure ResizeData(const NewSize: Cardinal); + {Returns data and size} + property Data: Pointer read fData; + property DataSize: Cardinal read fDataSize; + {Assigns from another TChunk} + procedure Assign(Source: TChunk); virtual; + {Returns owner} + property Owner: TPngObject read fOwner; + {Being destroyed/created} + constructor Create(Owner: TPngObject); virtual; + destructor Destroy; override; + {Returns chunk class/name} + property Name: String read GetChunkName; + {Loads the chunk from a stream} + function LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; virtual; + {Saves the chunk to a stream} + function SaveData(Stream: TStream): Boolean; + function SaveToStream(Stream: TStream): Boolean; virtual; + end; + + {Chunk classes} + TChunkIEND = class(TChunk); {End chunk} + + {IHDR data} + pIHDRData = ^TIHDRData; + TIHDRData = packed record + Width, Height: Cardinal; + BitDepth, + ColorType, + CompressionMethod, + FilterMethod, + InterlaceMethod: Byte; + end; + + {Information header chunk} + TChunkIHDR = class(TChunk) + private + {Current image} + ImageHandle: HBitmap; + ImageDC: HDC; + + {Output windows bitmap} + HasPalette: Boolean; + BitmapInfo: TMaxBitmapInfo; + BytesPerRow: Integer; + {Stores the image bytes} + {$IFDEF Store16bits}ExtraImageData: Pointer;{$ENDIF} + ImageData: pointer; + ImageAlpha: Pointer; + + {Contains all the ihdr data} + IHDRData: TIHDRData; + protected + {Resizes the image data to fill the color type, bit depth, } + {width and height parameters} + procedure PrepareImageData; + {Release allocated ImageData memory} + procedure FreeImageData; + public + {Properties} + property Width: Cardinal read IHDRData.Width write IHDRData.Width; + property Height: Cardinal read IHDRData.Height write IHDRData.Height; + property BitDepth: Byte read IHDRData.BitDepth write IHDRData.BitDepth; + property ColorType: Byte read IHDRData.ColorType write IHDRData.ColorType; + property CompressionMethod: Byte read IHDRData.CompressionMethod + write IHDRData.CompressionMethod; + property FilterMethod: Byte read IHDRData.FilterMethod + write IHDRData.FilterMethod; + property InterlaceMethod: Byte read IHDRData.InterlaceMethod + write IHDRData.InterlaceMethod; + {Loads the chunk from a stream} + function LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; override; + {Saves the chunk to a stream} + function SaveToStream(Stream: TStream): Boolean; override; + {Destructor/constructor} + constructor Create(Owner: TPngObject); override; + destructor Destroy; override; + {Assigns from another TChunk} + procedure Assign(Source: TChunk); override; + end; + + {Gamma chunk} + TChunkgAMA = class(TChunk) + private + {Returns/sets the value for the gamma chunk} + function GetValue: Cardinal; + procedure SetValue(const Value: Cardinal); + public + {Returns/sets gamma value} + property Gamma: Cardinal read GetValue write SetValue; + {Loading the chunk from a stream} + function LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; override; + {Being created} + constructor Create(Owner: TPngObject); override; + {Assigns from another TChunk} + procedure Assign(Source: TChunk); override; + end; + + {ZLIB Decompression extra information} + TZStreamRec2 = packed record + {From ZLIB} + ZLIB: TZStreamRec; + {Additional info} + Data: Pointer; + fStream : TStream; + end; + + {Palette chunk} + TChunkPLTE = class(TChunk) + private + {Number of items in the palette} + fCount: Integer; + {Contains the palette handle} + function GetPaletteItem(Index: Byte): TRGBQuad; + public + {Returns the color for each item in the palette} + property Item[Index: Byte]: TRGBQuad read GetPaletteItem; + {Returns the number of items in the palette} + property Count: Integer read fCount; + {Loads the chunk from a stream} + function LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; override; + {Saves the chunk to a stream} + function SaveToStream(Stream: TStream): Boolean; override; + {Assigns from another TChunk} + procedure Assign(Source: TChunk); override; + end; + + {Transparency information} + TChunktRNS = class(TChunk) + private + fBitTransparency: Boolean; + function GetTransparentColor: ColorRef; + {Returns the transparent color} + procedure SetTransparentColor(const Value: ColorRef); + public + {Palette values for transparency} + PaletteValues: Array[Byte] of Byte; + {Returns if it uses bit transparency} + property BitTransparency: Boolean read fBitTransparency; + {Returns the transparent color} + property TransparentColor: ColorRef read GetTransparentColor write + SetTransparentColor; + {Loads/saves the chunk from/to a stream} + function LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; override; + function SaveToStream(Stream: TStream): Boolean; override; + {Assigns from another TChunk} + procedure Assign(Source: TChunk); override; + end; + + {Actual image information} + TChunkIDAT = class(TChunk) + private + {Holds another pointer to the TChunkIHDR} + Header: TChunkIHDR; + {Stores temporary image width and height} + ImageWidth, ImageHeight: Integer; + {Size in bytes of each line and offset} + Row_Bytes, Offset : Cardinal; + {Contains data for the lines} + Encode_Buffer: Array[0..5] of pByteArray; + Row_Buffer: Array[Boolean] of pByteArray; + {Variable to invert the Row_Buffer used} + RowUsed: Boolean; + {Ending position for the current IDAT chunk} + EndPos: Integer; + {Filter the current line} + procedure FilterRow; + {Filter to encode and returns the best filter} + function FilterToEncode: Byte; + {Reads ZLIB compressed data} + function IDATZlibRead(var ZLIBStream: TZStreamRec2; Buffer: Pointer; + Count: Integer; var EndPos: Integer; var crcfile: Cardinal): Integer; + {Compress and writes IDAT data} + procedure IDATZlibWrite(var ZLIBStream: TZStreamRec2; Buffer: Pointer; + const Length: Cardinal); + procedure FinishIDATZlib(var ZLIBStream: TZStreamRec2); + {Prepares the palette} + procedure PreparePalette; + protected + {Decode interlaced image} + procedure DecodeInterlacedAdam7(Stream: TStream; + var ZLIBStream: TZStreamRec2; const Size: Integer; var crcfile: Cardinal); + {Decode non interlaced imaged} + procedure DecodeNonInterlaced(Stream: TStream; + var ZLIBStream: TZStreamRec2; const Size: Integer; + var crcfile: Cardinal); + protected + {Encode non interlaced images} + procedure EncodeNonInterlaced(Stream: TStream; + var ZLIBStream: TZStreamRec2); + {Encode interlaced images} + procedure EncodeInterlacedAdam7(Stream: TStream; + var ZLIBStream: TZStreamRec2); + protected + {Memory copy methods to decode} + procedure CopyNonInterlacedRGB8( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyNonInterlacedRGB16( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyNonInterlacedPalette148( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyNonInterlacedPalette2( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyNonInterlacedGray2( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyNonInterlacedGrayscale16( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyNonInterlacedRGBAlpha8( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyNonInterlacedRGBAlpha16( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyNonInterlacedGrayscaleAlpha8( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyNonInterlacedGrayscaleAlpha16( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyInterlacedRGB8(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyInterlacedRGB16(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyInterlacedPalette148(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyInterlacedPalette2(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyInterlacedGray2(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyInterlacedGrayscale16(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyInterlacedRGBAlpha8(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyInterlacedRGBAlpha16(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyInterlacedGrayscaleAlpha8(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + procedure CopyInterlacedGrayscaleAlpha16(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); + protected + {Memory copy methods to encode} + procedure EncodeNonInterlacedRGB8(Src, Dest, Trans: pChar); + procedure EncodeNonInterlacedRGB16(Src, Dest, Trans: pChar); + procedure EncodeNonInterlacedGrayscale16(Src, Dest, Trans: pChar); + procedure EncodeNonInterlacedPalette148(Src, Dest, Trans: pChar); + procedure EncodeNonInterlacedRGBAlpha8(Src, Dest, Trans: pChar); + procedure EncodeNonInterlacedRGBAlpha16(Src, Dest, Trans: pChar); + procedure EncodeNonInterlacedGrayscaleAlpha8(Src, Dest, Trans: pChar); + procedure EncodeNonInterlacedGrayscaleAlpha16(Src, Dest, Trans: pChar); + procedure EncodeInterlacedRGB8(const Pass: Byte; Src, Dest, Trans: pChar); + procedure EncodeInterlacedRGB16(const Pass: Byte; Src, Dest, Trans: pChar); + procedure EncodeInterlacedPalette148(const Pass: Byte; + Src, Dest, Trans: pChar); + procedure EncodeInterlacedGrayscale16(const Pass: Byte; + Src, Dest, Trans: pChar); + procedure EncodeInterlacedRGBAlpha8(const Pass: Byte; + Src, Dest, Trans: pChar); + procedure EncodeInterlacedRGBAlpha16(const Pass: Byte; + Src, Dest, Trans: pChar); + procedure EncodeInterlacedGrayscaleAlpha8(const Pass: Byte; + Src, Dest, Trans: pChar); + procedure EncodeInterlacedGrayscaleAlpha16(const Pass: Byte; + Src, Dest, Trans: pChar); + public + {Loads the chunk from a stream} + function LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; override; + {Saves the chunk to a stream} + function SaveToStream(Stream: TStream): Boolean; override; + end; + + {Image last modification chunk} + TChunktIME = class(TChunk) + private + {Holds the variables} + fYear: Word; + fMonth, fDay, fHour, fMinute, fSecond: Byte; + public + {Returns/sets variables} + property Year: Word read fYear write fYear; + property Month: Byte read fMonth write fMonth; + property Day: Byte read fDay write fDay; + property Hour: Byte read fHour write fHour; + property Minute: Byte read fMinute write fMinute; + property Second: Byte read fSecond write fSecond; + {Loads the chunk from a stream} + function LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; override; + {Saves the chunk to a stream} + function SaveToStream(Stream: TStream): Boolean; override; + end; + + {Textual data} + TChunktEXt = class(TChunk) + private + fKeyword, fText: String; + public + {Keyword and text} + property Keyword: String read fKeyword write fKeyword; + property Text: String read fText write fText; + {Loads the chunk from a stream} + function LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; override; + {Saves the chunk to a stream} + function SaveToStream(Stream: TStream): Boolean; override; + {Assigns from another TChunk} + procedure Assign(Source: TChunk); override; + end; + + {zTXT chunk} + TChunkzTXt = class(TChunktEXt) + {Loads the chunk from a stream} + function LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; override; + {Saves the chunk to a stream} + function SaveToStream(Stream: TStream): Boolean; override; + end; + +{Here we test if it's c++ builder or delphi version 3 or less} +{$IFDEF VER110}{$DEFINE DelphiBuilder3Less}{$ENDIF} +{$IFDEF VER100}{$DEFINE DelphiBuilder3Less}{$ENDIF} +{$IFDEF VER93}{$DEFINE DelphiBuilder3Less}{$ENDIF} +{$IFDEF VER90}{$DEFINE DelphiBuilder3Less}{$ENDIF} +{$IFDEF VER80}{$DEFINE DelphiBuilder3Less}{$ENDIF} + + +{Registers a new chunk class} +procedure RegisterChunk(ChunkClass: TChunkClass); +{Calculates crc} +function update_crc(crc: {$IFNDEF DelphiBuilder3Less}Cardinal{$ELSE}Integer + {$ENDIF}; buf: pByteArray; len: Integer): Cardinal; +{Invert bytes using assembly} +function ByteSwap(const a: integer): integer; + +implementation + +var + ChunkClasses: TPngPointerList; + {Table of CRCs of all 8-bit messages} + crc_table: Array[0..255] of Cardinal; + {Flag: has the table been computed? Initially false} + crc_table_computed: Boolean; + +{Draw transparent image using transparent color} +procedure DrawTransparentBitmap(dc: HDC; srcBits: Pointer; + var srcHeader: TBitmapInfoHeader; + srcBitmapInfo: pBitmapInfo; Rect: TRect; cTransparentColor: COLORREF); +var + cColor: COLORREF; + bmAndBack, bmAndObject, bmAndMem: HBITMAP; + bmBackOld, bmObjectOld, bmMemOld: HBITMAP; + hdcMem, hdcBack, hdcObject, hdcTemp: HDC; + ptSize, orgSize: TPOINT; + OldBitmap, DrawBitmap: HBITMAP; +begin + hdcTemp := CreateCompatibleDC(dc); + // Select the bitmap + DrawBitmap := CreateDIBitmap(dc, srcHeader, CBM_INIT, srcBits, srcBitmapInfo^, + DIB_RGB_COLORS); + OldBitmap := SelectObject(hdcTemp, DrawBitmap); + + // Sizes + OrgSize.x := abs(srcHeader.biWidth); + OrgSize.y := abs(srcHeader.biHeight); + ptSize.x := Rect.Right - Rect.Left; // Get width of bitmap + ptSize.y := Rect.Bottom - Rect.Top; // Get height of bitmap + + // Create some DCs to hold temporary data. + hdcBack := CreateCompatibleDC(dc); + hdcObject := CreateCompatibleDC(dc); + hdcMem := CreateCompatibleDC(dc); + + // Create a bitmap for each DC. DCs are required for a number of + // GDI functions. + + // Monochrome DCs + bmAndBack := CreateBitmap(ptSize.x, ptSize.y, 1, 1, nil); + bmAndObject := CreateBitmap(ptSize.x, ptSize.y, 1, 1, nil); + + bmAndMem := CreateCompatibleBitmap(dc, ptSize.x, ptSize.y); + + // Each DC must select a bitmap object to store pixel data. + bmBackOld := SelectObject(hdcBack, bmAndBack); + bmObjectOld := SelectObject(hdcObject, bmAndObject); + bmMemOld := SelectObject(hdcMem, bmAndMem); + + // Set the background color of the source DC to the color. + // contained in the parts of the bitmap that should be transparent + cColor := SetBkColor(hdcTemp, cTransparentColor); + + // Create the object mask for the bitmap by performing a BitBlt + // from the source bitmap to a monochrome bitmap. + StretchBlt(hdcObject, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, + orgSize.x, orgSize.y, SRCCOPY); + + // Set the background color of the source DC back to the original + // color. + SetBkColor(hdcTemp, cColor); + + // Create the inverse of the object mask. + BitBlt(hdcBack, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, + NOTSRCCOPY); + + // Copy the background of the main DC to the destination. + BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, dc, Rect.Left, Rect.Top, + SRCCOPY); + + // Mask out the places where the bitmap will be placed. + BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, SRCAND); + + // Mask out the transparent colored pixels on the bitmap. +// BitBlt(hdcTemp, 0, 0, ptSize.x, ptSize.y, hdcBack, 0, 0, SRCAND); + StretchBlt(hdcTemp, 0, 0, OrgSize.x, OrgSize.y, hdcBack, 0, 0, + PtSize.x, PtSize.y, SRCAND); + + // XOR the bitmap with the background on the destination DC. + StretchBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, + OrgSize.x, OrgSize.y, SRCPAINT); + + // Copy the destination to the screen. + BitBlt(dc, Rect.Left, Rect.Top, ptSize.x, ptSize.y, hdcMem, 0, 0, + SRCCOPY); + + // Delete the memory bitmaps. + DeleteObject(SelectObject(hdcBack, bmBackOld)); + DeleteObject(SelectObject(hdcObject, bmObjectOld)); + DeleteObject(SelectObject(hdcMem, bmMemOld)); + DeleteObject(SelectObject(hdcTemp, OldBitmap)); + + // Delete the memory DCs. + DeleteDC(hdcMem); + DeleteDC(hdcBack); + DeleteDC(hdcObject); + DeleteDC(hdcTemp); +end; + +{Make the table for a fast CRC.} +procedure make_crc_table; +var + c: Cardinal; + n, k: Integer; +begin + + {fill the crc table} + for n := 0 to 255 do + begin + c := Cardinal(n); + for k := 0 to 7 do + begin + if Boolean(c and 1) then + c := $edb88320 xor (c shr 1) + else + c := c shr 1; + end; + crc_table[n] := c; + end; + + {The table has already being computated} + crc_table_computed := true; +end; + +{Update a running CRC with the bytes buf[0..len-1]--the CRC + should be initialized to all 1's, and the transmitted value + is the 1's complement of the final running CRC (see the + crc() routine below)).} +function update_crc(crc: {$IFNDEF DelphiBuilder3Less}Cardinal{$ELSE}Integer + {$ENDIF}; buf: pByteArray; len: Integer): Cardinal; +var + c: Cardinal; + n: Integer; +begin + c := crc; + + {Create the crc table in case it has not being computed yet} + if not crc_table_computed then make_crc_table; + + {Update} + for n := 0 to len - 1 do + c := crc_table[(c XOR buf^[n]) and $FF] XOR (c shr 8); + + {Returns} + Result := c; +end; + +{$IFNDEF UseDelphi} + function FileExists(Filename: String): Boolean; + var + FindFile: THandle; + FindData: TWin32FindData; + begin + FindFile := FindFirstFile(PChar(Filename), FindData); + Result := FindFile <> INVALID_HANDLE_VALUE; + if Result then Windows.FindClose(FindFile); + end; + + +{$ENDIF} + +{$IFNDEF UseDelphi} + {Exception implementation} + constructor Exception.Create(Msg: String); + begin + end; +{$ENDIF} + +{Calculates the paeth predictor} +function PaethPredictor(a, b, c: Byte): Byte; +var + pa, pb, pc: Integer; +begin + { a = left, b = above, c = upper left } + pa := abs(b - c); { distances to a, b, c } + pb := abs(a - c); + pc := abs(a + b - c * 2); + + { return nearest of a, b, c, breaking ties in order a, b, c } + if (pa <= pb) and (pa <= pc) then + Result := a + else + if pb <= pc then + Result := b + else + Result := c; +end; + +{Invert bytes using assembly} +function ByteSwap(const a: integer): integer; +asm + bswap eax +end; +function ByteSwap16(inp:word): word; +asm + bswap eax + shr eax, 16 +end; + +{Calculates number of bytes for the number of pixels using the} +{color mode in the paramenter} +function BytesForPixels(const Pixels: Integer; const ColorType, + BitDepth: Byte): Integer; +begin + case ColorType of + {Palette and grayscale contains a single value, for palette} + {an value of size 2^bitdepth pointing to the palette index} + {and grayscale the value from 0 to 2^bitdepth with color intesity} + COLOR_GRAYSCALE, COLOR_PALETTE: + Result := (Pixels * BitDepth + 7) div 8; + {RGB contains 3 values R, G, B with size 2^bitdepth each} + COLOR_RGB: + Result := (Pixels * BitDepth * 3) div 8; + {Contains one value followed by alpha value booth size 2^bitdepth} + COLOR_GRAYSCALEALPHA: + Result := (Pixels * BitDepth * 2) div 8; + {Contains four values size 2^bitdepth, Red, Green, Blue and alpha} + COLOR_RGBALPHA: + Result := (Pixels * BitDepth * 4) div 8; + else + Result := 0; + end {case ColorType} +end; + +type + pChunkClassInfo = ^TChunkClassInfo; + TChunkClassInfo = record + ClassName: TChunkClass; + end; + +{Register a chunk type} +procedure RegisterChunk(ChunkClass: TChunkClass); +var + NewClass: pChunkClassInfo; +begin + {In case the list object has not being created yet} + if ChunkClasses = nil then ChunkClasses := TPngPointerList.Create(nil); + + {Add this new class} + new(NewClass); + NewClass^.ClassName := ChunkClass; + ChunkClasses.Add(NewClass); +end; + +{Free chunk class list} +procedure FreeChunkClassList; +var + i: Integer; +begin + if (ChunkClasses <> nil) then + begin + FOR i := 0 TO ChunkClasses.Count - 1 do + Dispose(pChunkClassInfo(ChunkClasses.Item[i])); + ChunkClasses.Free; + end; +end; + +{Registering of common chunk classes} +procedure RegisterCommonChunks; +begin + {Important chunks} + RegisterChunk(TChunkIEND); + RegisterChunk(TChunkIHDR); + RegisterChunk(TChunkIDAT); + RegisterChunk(TChunkPLTE); + RegisterChunk(TChunkgAMA); + RegisterChunk(TChunktRNS); + + {Not so important chunks} + RegisterChunk(TChunktIME); + RegisterChunk(TChunktEXt); + RegisterChunk(TChunkzTXt); +end; + +{Creates a new chunk of this class} +function CreateClassChunk(Owner: TPngObject; Name: TChunkName): TChunk; +var + i : Integer; + NewChunk: TChunkClass; +begin + {Looks for this chunk} + NewChunk := TChunk; {In case there is no registered class for this} + + {Looks for this class in all registered chunks} + if Assigned(ChunkClasses) then + FOR i := 0 TO ChunkClasses.Count - 1 DO + begin + if pChunkClassInfo(ChunkClasses.Item[i])^.ClassName.GetName = Name then + begin + NewChunk := pChunkClassInfo(ChunkClasses.Item[i])^.ClassName; + break; + end; + end; + + {Returns chunk class} + Result := NewChunk.Create(Owner); + Result.fName := Name; +end; + +{ZLIB support} + +const + ZLIBAllocate = High(Word); + +{Initializes ZLIB for decompression} +function ZLIBInitInflate(Stream: TStream): TZStreamRec2; +begin + {Fill record} + Fillchar(Result, SIZEOF(TZStreamRec2), #0); + + {Set internal record information} + with Result do + begin + GetMem(Data, ZLIBAllocate); + fStream := Stream; + end; + + {Init decompression} + InflateInit_(Result.zlib, zlib_version, SIZEOF(TZStreamRec)); +end; + +{Initializes ZLIB for compression} +function ZLIBInitDeflate(Stream: TStream; + Level: TCompressionlevel; Size: Cardinal): TZStreamRec2; +begin + {Fill record} + Fillchar(Result, SIZEOF(TZStreamRec2), #0); + + {Set internal record information} + with Result, ZLIB do + begin + GetMem(Data, Size); + fStream := Stream; + next_out := Data; + avail_out := Size; + end; + + {Inits compression} + deflateInit_(Result.zlib, Level, zlib_version, sizeof(TZStreamRec)); +end; + +{Terminates ZLIB for compression} +procedure ZLIBTerminateDeflate(var ZLIBStream: TZStreamRec2); +begin + {Terminates decompression} + DeflateEnd(ZLIBStream.zlib); + {Free internal record} + FreeMem(ZLIBStream.Data, ZLIBAllocate); +end; + +{Terminates ZLIB for decompression} +procedure ZLIBTerminateInflate(var ZLIBStream: TZStreamRec2); +begin + {Terminates decompression} + InflateEnd(ZLIBStream.zlib); + {Free internal record} + FreeMem(ZLIBStream.Data, ZLIBAllocate); +end; + +{Decompresses ZLIB into a memory address} +function DecompressZLIB(const Input: Pointer; InputSize: Integer; + var Output: Pointer; var OutputSize: Integer; + var ErrorOutput: String): Boolean; +var + StreamRec : TZStreamRec; + Buffer : Array[Byte] of Byte; + InflateRet: Integer; +begin + with StreamRec do + begin + {Initializes} + Result := True; + OutputSize := 0; + + {Prepares the data to decompress} + FillChar(StreamRec, SizeOf(TZStreamRec), #0); + InflateInit_(StreamRec, zlib_version, SIZEOF(TZStreamRec)); + next_in := Input; + avail_in := InputSize; + + {Decodes data} + repeat + {In case it needs an output buffer} + if (avail_out = 0) then + begin + next_out := @Buffer; + avail_out := SizeOf(Buffer); + end {if (avail_out = 0)}; + + {Decompress and put in output} + InflateRet := inflate(StreamRec, 0); + if (InflateRet = Z_STREAM_END) or (InflateRet = 0) then + begin + {Reallocates output buffer} + inc(OutputSize, total_out); + if Output = nil then + GetMem(Output, OutputSize) else ReallocMem(Output, OutputSize); + {Copies the new data} + CopyMemory(Ptr(Longint(Output) + OutputSize - total_out), + @Buffer, total_out); + end {if (InflateRet = Z_STREAM_END) or (InflateRet = 0)} + {Now tests for errors} + else if InflateRet < 0 then + begin + Result := False; + ErrorOutput := StreamRec.msg; + InflateEnd(StreamRec); + Exit; + end {if InflateRet < 0} + until InflateRet = Z_STREAM_END; + + {Terminates decompression} + InflateEnd(StreamRec); + end {with StreamRec} + +end; + +{Compresses ZLIB into a memory address} +function CompressZLIB(Input: Pointer; InputSize, CompressionLevel: Integer; + var Output: Pointer; var OutputSize: Integer; + var ErrorOutput: String): Boolean; +var + StreamRec : TZStreamRec; + Buffer : Array[Byte] of Byte; + DeflateRet: Integer; +begin + with StreamRec do + begin + Result := True; {By default returns TRUE as everything might have gone ok} + OutputSize := 0; {Initialize} + {Prepares the data to compress} + FillChar(StreamRec, SizeOf(TZStreamRec), #0); + DeflateInit_(StreamRec, CompressionLevel,zlib_version, SIZEOF(TZStreamRec)); + + next_in := Input; + avail_in := InputSize; + + while avail_in > 0 do + begin + {When it needs new buffer to stores the compressed data} + if avail_out = 0 then + begin + {Restore buffer} + next_out := @Buffer; + avail_out := SizeOf(Buffer); + end {if avail_out = 0}; + + {Compresses} + DeflateRet := deflate(StreamRec, Z_FINISH); + + if (DeflateRet = Z_STREAM_END) or (DeflateRet = 0) then + begin + {Updates the output memory} + inc(OutputSize, total_out); + if Output = nil then + GetMem(Output, OutputSize) else ReallocMem(Output, OutputSize); + + {Copies the new data} + CopyMemory(Ptr(Longint(Output) + OutputSize - total_out), + @Buffer, total_out); + end {if (InflateRet = Z_STREAM_END) or (InflateRet = 0)} + {Now tests for errors} + else if DeflateRet < 0 then + begin + Result := False; + ErrorOutput := StreamRec.msg; + DeflateEnd(StreamRec); + Exit; + end {if InflateRet < 0} + + end {while avail_in > 0}; + + {Finishes compressing} + DeflateEnd(StreamRec); + end {with StreamRec} + +end; + +{TPngPointerList implementation} + +{Object being created} +constructor TPngPointerList.Create(AOwner: TPNGObject); +begin + inherited Create; {Let ancestor work} + {Holds owner} + fOwner := AOwner; + {Memory pointer not being used yet} + fMemory := nil; + {No items yet} + fCount := 0; +end; + +{Removes value from the list} +function TPngPointerList.Remove(Value: Pointer): Pointer; +var + I, Position: Integer; +begin + {Gets item position} + Position := -1; + FOR I := 0 TO Count - 1 DO + if Value = Item[I] then Position := I; + {In case a match was found} + if Position >= 0 then + begin + Result := Item[Position]; {Returns pointer} + {Remove item and move memory} + Dec(fCount); + if Position < Integer(FCount) then + System.Move(fMemory^[Position + 1], fMemory^[Position], + (Integer(fCount) - Position) * SizeOf(Pointer)); + end {if Position >= 0} else Result := nil +end; + +{Add a new value in the list} +procedure TPngPointerList.Add(Value: Pointer); +begin + Count := Count + 1; + Item[Count - 1] := Value; +end; + + +{Object being destroyed} +destructor TPngPointerList.Destroy; +begin + {Release memory if needed} + if fMemory <> nil then + FreeMem(fMemory, fCount * sizeof(Pointer)); + + {Free things} + inherited Destroy; +end; + +{Returns one item from the list} +function TPngPointerList.GetItem(Index: Cardinal): Pointer; +begin + if (Index <= Count - 1) then + Result := fMemory[Index] + else + {In case it's out of bounds} + Result := nil; +end; + +{Inserts a new item in the list} +procedure TPngPointerList.Insert(Value: Pointer; Position: Cardinal); +begin + if (Position < Count) then + begin + {Increase item count} + SetSize(Count + 1); + {Move other pointers} + if Position < Count then + System.Move(fMemory^[Position], fMemory^[Position + 1], + (Count - Position - 1) * SizeOf(Pointer)); + {Sets item} + Item[Position] := Value; + end; +end; + +{Sets one item from the list} +procedure TPngPointerList.SetItem(Index: Cardinal; const Value: Pointer); +begin + {If index is in bounds, set value} + if (Index <= Count - 1) then + fMemory[Index] := Value +end; + +{This method resizes the list} +procedure TPngPointerList.SetSize(const Size: Cardinal); +begin + {Sets the size} + if (fMemory = nil) and (Size > 0) then + GetMem(fMemory, Size * SIZEOF(Pointer)) + else + if Size > 0 then {Only realloc if the new size is greater than 0} + ReallocMem(fMemory, Size * SIZEOF(Pointer)) + else + {In case user is resize to 0 items} + begin + FreeMem(fMemory); + fMemory := nil; + end; + {Update count} + fCount := Size; +end; + +{TPNGList implementation} + +{Removes an item} +procedure TPNGList.RemoveChunk(Chunk: TChunk); +begin + Remove(Chunk); + Chunk.Free +end; + +{Add a new item} +function TPNGList.Add(ChunkClass: TChunkClass): TChunk; +var + IHDR: TChunkIHDR; + IEND: TChunkIEND; + + IDAT: TChunkIDAT; + PLTE: TChunkPLTE; +begin + Result := nil; {Default result} + {Adding these is not allowed} + if (ChunkClass = TChunkIHDR) or (ChunkClass = TChunkIDAT) or + (ChunkClass = TChunkPLTE) or (ChunkClass = TChunkIEND) then + fOwner.RaiseError(EPngError, EPNGCannotAddChunkText) + {Two of these is not allowed} + else if ((ChunkClass = TChunkgAMA) and (ItemFromClass(TChunkgAMA) <> nil)) or + ((ChunkClass = TChunktRNS) and (ItemFromClass(TChunktRNS) <> nil)) then + fOwner.RaiseError(EPngError, EPNGCannotAddChunkText) + {There must have an IEND and IHDR chunk} + else if (ItemFromClass(TChunkIEND) = nil) or + (ItemFromClass(TChunkIHDR) = nil) then + fOwner.RaiseError(EPngError, EPNGCannotAddInvalidImageText) + else + begin + {Get common chunks} + IHDR := ItemFromClass(TChunkIHDR) as TChunkIHDR; + IEND := ItemFromClass(TChunkIEND) as TChunkIEND; + {Create new chunk} + Result := ChunkClass.Create(Owner); + {Add to the list} + if (ChunkClass = TChunkgAMA) then + Insert(Result, IHDR.Index + 1) + {Transparency chunk (fix by Ian Boyd)} + else if (ChunkClass = TChunktRNS) then + begin + {Transparecy chunk must be after PLTE; before IDAT} + IDAT := ItemFromClass(TChunkIDAT) as TChunkIDAT; + PLTE := ItemFromClass(TChunkPLTE) as TChunkPLTE; + + if Assigned(PLTE) then + Insert(Result, PLTE.Index + 1) + else if Assigned(IDAT) then + Insert(Result, IDAT.Index) + else + Insert(Result, IHDR.Index + 1) + end + else {All other chunks} + Insert(Result, IEND.Index); + end {if} +end; + +{Returns item from the list} +function TPNGList.GetItem(Index: Cardinal): TChunk; +begin + Result := inherited GetItem(Index); +end; + +{Returns first item from the list using the class from parameter} +function TPNGList.ItemFromClass(ChunkClass: TChunkClass): TChunk; +var + i: Integer; +begin + Result := nil; {Initial result} + FOR i := 0 TO Count - 1 DO + {Test if this item has the same class} + if Item[i] is ChunkClass then + begin + {Returns this item and exit} + Result := Item[i]; + break; + end {if} +end; + +{$IFNDEF UseDelphi} + + {TStream implementation} + + {Copies all from another stream} + function TStream.CopyFrom(Source: TStream; Count: Cardinal): Cardinal; + const + MaxBytes = $f000; + var + Buffer: PChar; + BufSize, N: Cardinal; + begin + {If count is zero, copy everything from Source} + if Count = 0 then + begin + Source.Seek(0, soFromBeginning); + Count := Source.Size; + end; + + Result := Count; {Returns the number of bytes readed} + {Allocates memory} + if Count > MaxBytes then BufSize := MaxBytes else BufSize := Count; + GetMem(Buffer, BufSize); + + {Copy memory} + while Count > 0 do + begin + if Count > BufSize then N := BufSize else N := Count; + Source.Read(Buffer^, N); + Write(Buffer^, N); + dec(Count, N); + end; + + {Deallocates memory} + FreeMem(Buffer, BufSize); + end; + +{Set current stream position} +procedure TStream.SetPosition(const Value: Longint); +begin + Seek(Value, soFromBeginning); +end; + +{Returns position} +function TStream.GetPosition: Longint; +begin + Result := Seek(0, soFromCurrent); +end; + + {Returns stream size} +function TStream.GetSize: Longint; + var + Pos: Cardinal; + begin + Pos := Seek(0, soFromCurrent); + Result := Seek(0, soFromEnd); + Seek(Pos, soFromCurrent); + end; + + {TFileStream implementation} + + {Filestream object being created} + constructor TFileStream.Create(Filename: String; Mode: TFileStreamModeSet); + {Makes file mode} + function OpenMode: DWORD; + begin + Result := 0; + if fsmRead in Mode then Result := GENERIC_READ; + if (fsmWrite in Mode) or (fsmCreate in Mode) then + Result := Result OR GENERIC_WRITE; + end; + const + IsCreate: Array[Boolean] of Integer = (OPEN_ALWAYS, CREATE_ALWAYS); + begin + {Call ancestor} + inherited Create; + + {Create handle} + fHandle := CreateFile(PChar(Filename), OpenMode, FILE_SHARE_READ or + FILE_SHARE_WRITE, nil, IsCreate[fsmCreate in Mode], 0, 0); + {Store mode} + FileMode := Mode; + end; + + {Filestream object being destroyed} + destructor TFileStream.Destroy; + begin + {Terminates file and close} + if FileMode = [fsmWrite] then + SetEndOfFile(fHandle); + CloseHandle(fHandle); + + {Call ancestor} + inherited Destroy; + end; + + {Writes data to the file} + function TFileStream.Write(const Buffer; Count: Longint): Cardinal; + begin + if not WriteFile(fHandle, Buffer, Count, Result, nil) then + Result := 0; + end; + + {Reads data from the file} + function TFileStream.Read(var Buffer; Count: Longint): Cardinal; + begin + if not ReadFile(fHandle, Buffer, Count, Result, nil) then + Result := 0; + end; + + {Seeks the file position} + function TFileStream.Seek(Offset: Integer; Origin: Word): Longint; + begin + Result := SetFilePointer(fHandle, Offset, nil, Origin); + end; + + {Sets the size of the file} + procedure TFileStream.SetSize(const Value: Longint); + begin + Seek(Value, soFromBeginning); + SetEndOfFile(fHandle); + end; + + {TResourceStream implementation} + + {Creates the resource stream} + constructor TResourceStream.Create(Instance: HInst; const ResName: String; + ResType: PChar); + var + ResID: HRSRC; + ResGlobal: HGlobal; + begin + {Obtains the resource ID} + ResID := FindResource(hInstance, PChar(ResName), RT_RCDATA); + if ResID = 0 then raise EPNGError.Create(''); + {Obtains memory and size} + ResGlobal := LoadResource(hInstance, ResID); + Size := SizeOfResource(hInstance, ResID); + Memory := LockResource(ResGlobal); + if (ResGlobal = 0) or (Memory = nil) then EPNGError.Create(''); + end; + + + {Setting resource stream size is not supported} + procedure TResourceStream.SetSize(const Value: Integer); + begin + end; + + {Writing into a resource stream is not supported} + function TResourceStream.Write(const Buffer; Count: Integer): Cardinal; + begin + Result := 0; + end; + + {Reads data from the stream} + function TResourceStream.Read(var Buffer; Count: Integer): Cardinal; + begin + //Returns data + CopyMemory(@Buffer, Ptr(Longint(Memory) + Position), Count); + //Update position + inc(Position, Count); + //Returns + Result := Count; + end; + + {Seeks data} + function TResourceStream.Seek(Offset: Integer; Origin: Word): Longint; + begin + {Move depending on the origin} + case Origin of + soFromBeginning: Position := Offset; + soFromCurrent: inc(Position, Offset); + soFromEnd: Position := Size + Offset; + end; + + {Returns the current position} + Result := Position; + end; + +{$ENDIF} + +{TChunk implementation} + +{Resizes the data} +procedure TChunk.ResizeData(const NewSize: Cardinal); +begin + fDataSize := NewSize; + ReallocMem(fData, NewSize + 1); +end; + +{Returns index from list} +function TChunk.GetIndex: Integer; +var + i: Integer; +begin + Result := -1; {Avoiding warnings} + {Searches in the list} + FOR i := 0 TO Owner.Chunks.Count - 1 DO + if Owner.Chunks.Item[i] = Self then + begin + {Found match} + Result := i; + exit; + end {for i} +end; + +{Returns pointer to the TChunkIHDR} +function TChunk.GetHeader: TChunkIHDR; +begin + Result := Owner.Chunks.Item[0] as TChunkIHDR; +end; + +{Assigns from another TChunk} +procedure TChunk.Assign(Source: TChunk); +begin + {Copy properties} + fName := Source.fName; + {Set data size and realloc} + ResizeData(Source.fDataSize); + + {Copy data (if there's any)} + if fDataSize > 0 then CopyMemory(fData, Source.fData, fDataSize); +end; + +{Chunk being created} +constructor TChunk.Create(Owner: TPngObject); +var + ChunkName: String; +begin + {Ancestor create} + inherited Create; + + {If it's a registered class, set the chunk name based on the class} + {name. For instance, if the class name is TChunkgAMA, the GAMA part} + {will become the chunk name} + ChunkName := Copy(ClassName, Length('TChunk') + 1, Length(ClassName)); + if Length(ChunkName) = 4 then CopyMemory(@fName[0], @ChunkName[1], 4); + + {Initialize data holder} + GetMem(fData, 1); + fDataSize := 0; + {Record owner} + fOwner := Owner; +end; + +{Chunk being destroyed} +destructor TChunk.Destroy; +begin + {Free data holder} + FreeMem(fData, fDataSize + 1); + {Let ancestor destroy} + inherited Destroy; +end; + +{Returns the chunk name 1} +function TChunk.GetChunkName: String; +begin + Result := fName +end; + +{Returns the chunk name 2} +class function TChunk.GetName: String; +begin + {For avoid writing GetName for each TChunk descendent, by default for} + {classes which don't declare GetName, it will look for the class name} + {to extract the chunk kind. Example, if the class name is TChunkIEND } + {this method extracts and returns IEND} + Result := Copy(ClassName, Length('TChunk') + 1, Length(ClassName)); +end; + +{Saves the data to the stream} +function TChunk.SaveData(Stream: TStream): Boolean; +var + ChunkSize, ChunkCRC: Cardinal; +begin + {First, write the size for the following data in the chunk} + ChunkSize := ByteSwap(DataSize); + Stream.Write(ChunkSize, 4); + {The chunk name} + Stream.Write(fName, 4); + {If there is data for the chunk, write it} + if DataSize > 0 then Stream.Write(Data^, DataSize); + {Calculates and write CRC} + ChunkCRC := update_crc($ffffffff, @fName[0], 4); + ChunkCRC := Byteswap(update_crc(ChunkCRC, Data, DataSize) xor $ffffffff); + Stream.Write(ChunkCRC, 4); + + {Returns that everything went ok} + Result := TRUE; +end; + +{Saves the chunk to the stream} +function TChunk.SaveToStream(Stream: TStream): Boolean; +begin + Result := SaveData(Stream) +end; + + +{Loads the chunk from a stream} +function TChunk.LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; +var + CheckCRC: Cardinal; + {$IFDEF CheckCRC}RightCRC: Cardinal;{$ENDIF} +begin + {Copies data from source} + ResizeData(Size); + if Size > 0 then Stream.Read(fData^, Size); + {Reads CRC} + Stream.Read(CheckCRC, 4); + CheckCrc := ByteSwap(CheckCRC); + + {Check if crc readed is valid} + {$IFDEF CheckCRC} + RightCRC := update_crc($ffffffff, @ChunkName[0], 4); + RightCRC := update_crc(RightCRC, fData, Size) xor $ffffffff; + Result := RightCRC = CheckCrc; + + {Handle CRC error} + if not Result then + begin + {In case it coult not load chunk} + Owner.RaiseError(EPngInvalidCRC, EPngInvalidCRCText); + exit; + end + {$ELSE}Result := TRUE; {$ENDIF} + +end; + +{TChunktIME implementation} + +{Chunk being loaded from a stream} +function TChunktIME.LoadFromStream(Stream: TStream; + const ChunkName: TChunkName; Size: Integer): Boolean; +begin + {Let ancestor load the data} + Result := inherited LoadFromStream(Stream, ChunkName, Size); + if not Result or (Size <> 7) then exit; {Size must be 7} + + {Reads data} + fYear := ((pByte(Longint(Data) )^) * 256)+ (pByte(Longint(Data) + 1)^); + fMonth := pByte(Longint(Data) + 2)^; + fDay := pByte(Longint(Data) + 3)^; + fHour := pByte(Longint(Data) + 4)^; + fMinute := pByte(Longint(Data) + 5)^; + fSecond := pByte(Longint(Data) + 6)^; +end; + +{Saving the chunk to a stream} +function TChunktIME.SaveToStream(Stream: TStream): Boolean; +begin + {Update data} + ResizeData(7); {Make sure the size is 7} + pWord(Data)^ := Year; + pByte(Longint(Data) + 2)^ := Month; + pByte(Longint(Data) + 3)^ := Day; + pByte(Longint(Data) + 4)^ := Hour; + pByte(Longint(Data) + 5)^ := Minute; + pByte(Longint(Data) + 6)^ := Second; + + {Let inherited save data} + Result := inherited SaveToStream(Stream); +end; + +{TChunkztXt implementation} + +{Loading the chunk from a stream} +function TChunkzTXt.LoadFromStream(Stream: TStream; + const ChunkName: TChunkName; Size: Integer): Boolean; +var + ErrorOutput: String; + CompressionMethod: Byte; + Output: Pointer; + OutputSize: Integer; +begin + {Load data from stream and validate} + Result := inherited LoadFromStream(Stream, ChunkName, Size); + if not Result or (Size < 4) then exit; + fKeyword := PChar(Data); {Get keyword and compression method bellow} + CompressionMethod := pByte(Longint(fKeyword) + Length(fKeyword))^; + fText := ''; + + {In case the compression is 0 (only one accepted by specs), reads it} + if CompressionMethod = 0 then + begin + Output := nil; + if DecompressZLIB(PChar(Longint(Data) + Length(fKeyword) + 2), + Size - Length(fKeyword) - 2, Output, OutputSize, ErrorOutput) then + begin + SetLength(fText, OutputSize); + CopyMemory(@fText[1], Output, OutputSize); + end {if DecompressZLIB(...}; + FreeMem(Output); + end {if CompressionMethod = 0} + +end; + +{Saving the chunk to a stream} +function TChunkztXt.SaveToStream(Stream: TStream): Boolean; +var + Output: Pointer; + OutputSize: Integer; + ErrorOutput: String; +begin + Output := nil; {Initializes output} + if fText = '' then fText := ' '; + + {Compresses the data} + if CompressZLIB(@fText[1], Length(fText), Owner.CompressionLevel, Output, + OutputSize, ErrorOutput) then + begin + {Size is length from keyword, plus a null character to divide} + {plus the compression method, plus the length of the text (zlib compressed)} + ResizeData(Length(fKeyword) + 2 + OutputSize); + + Fillchar(Data^, DataSize, #0); + {Copies the keyword data} + if Keyword <> '' then + CopyMemory(Data, @fKeyword[1], Length(Keyword)); + {Compression method 0 (inflate/deflate)} + pByte(Ptr(Longint(Data) + Length(Keyword) + 1))^ := 0; + if OutputSize > 0 then + CopyMemory(Ptr(Longint(Data) + Length(Keyword) + 2), Output, OutputSize); + + {Let ancestor calculate crc and save} + Result := SaveData(Stream); + end {if CompressZLIB(...} else Result := False; + + {Frees output} + if Output <> nil then FreeMem(Output) +end; + +{TChunktEXt implementation} + +{Assigns from another text chunk} +procedure TChunktEXt.Assign(Source: TChunk); +begin + fKeyword := TChunktEXt(Source).fKeyword; + fText := TChunktEXt(Source).fText; +end; + +{Loading the chunk from a stream} +function TChunktEXt.LoadFromStream(Stream: TStream; + const ChunkName: TChunkName; Size: Integer): Boolean; +begin + {Load data from stream and validate} + Result := inherited LoadFromStream(Stream, ChunkName, Size); + if not Result or (Size < 3) then exit; + {Get text} + fKeyword := PChar(Data); + SetLength(fText, Size - Length(fKeyword) - 1); + CopyMemory(@fText[1], Ptr(Longint(Data) + Length(fKeyword) + 1), + Length(fText)); +end; + +{Saving the chunk to a stream} +function TChunktEXt.SaveToStream(Stream: TStream): Boolean; +begin + {Size is length from keyword, plus a null character to divide} + {plus the length of the text} + ResizeData(Length(fKeyword) + 1 + Length(fText)); + Fillchar(Data^, DataSize, #0); + {Copy data} + if Keyword <> '' then + CopyMemory(Data, @fKeyword[1], Length(Keyword)); + if Text <> '' then + CopyMemory(Ptr(Longint(Data) + Length(Keyword) + 1), @fText[1], + Length(Text)); + {Let ancestor calculate crc and save} + Result := inherited SaveToStream(Stream); +end; + + +{TChunkIHDR implementation} + +{Chunk being created} +constructor TChunkIHDR.Create(Owner: TPngObject); +begin + {Call inherited} + inherited Create(Owner); + {Prepare pointers} + ImageHandle := 0; + ImageDC := 0; +end; + +{Chunk being destroyed} +destructor TChunkIHDR.Destroy; +begin + {Free memory} + FreeImageData(); + + {Calls TChunk destroy} + inherited Destroy; +end; + +{Assigns from another IHDR chunk} +procedure TChunkIHDR.Assign(Source: TChunk); +begin + {Copy the IHDR data} + if Source is TChunkIHDR then + begin + {Copy IHDR values} + IHDRData := TChunkIHDR(Source).IHDRData; + + {Prepare to hold data by filling BitmapInfo structure and} + {resizing ImageData and ImageAlpha memory allocations} + PrepareImageData(); + + {Copy image data} + CopyMemory(ImageData, TChunkIHDR(Source).ImageData, + BytesPerRow * Integer(Height)); + CopyMemory(ImageAlpha, TChunkIHDR(Source).ImageAlpha, + Integer(Width) * Integer(Height)); + + {Copy palette colors} + BitmapInfo.bmiColors := TChunkIHDR(Source).BitmapInfo.bmiColors; + end + else + Owner.RaiseError(EPNGError, EPNGCannotAssignChunkText); +end; + +{Release allocated image data} +procedure TChunkIHDR.FreeImageData; +begin + {Free old image data} + if ImageHandle <> 0 then DeleteObject(ImageHandle); + if ImageDC <> 0 then DeleteDC(ImageDC); + if ImageAlpha <> nil then FreeMem(ImageAlpha); + {$IFDEF Store16bits} + if ExtraImageData <> nil then FreeMem(ExtraImageData); + {$ENDIF} + ImageHandle := 0; ImageDC := 0; ImageAlpha := nil; ImageData := nil; +end; + +{Chunk being loaded from a stream} +function TChunkIHDR.LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; +begin + {Let TChunk load it} + Result := inherited LoadFromStream(Stream, ChunkName, Size); + if not Result then Exit; + + {Now check values} + {Note: It's recommended by png specification to make sure that the size} + {must be 13 bytes to be valid, but some images with 14 bytes were found} + {which could be loaded by internet explorer and other tools} + if (fDataSize < SIZEOF(TIHdrData)) then + begin + {Ihdr must always have at least 13 bytes} + Result := False; + Owner.RaiseError(EPNGInvalidIHDR, EPNGInvalidIHDRText); + exit; + end; + + {Everything ok, reads IHDR} + IHDRData := pIHDRData(fData)^; + IHDRData.Width := ByteSwap(IHDRData.Width); + IHDRData.Height := ByteSwap(IHDRData.Height); + + {The width and height must not be larger than 65535 pixels} + if (IHDRData.Width > High(Word)) or (IHDRData.Height > High(Word)) then + begin + Result := False; + Owner.RaiseError(EPNGSizeExceeds, EPNGSizeExceedsText); + exit; + end {if IHDRData.Width > High(Word)}; + {Compression method must be 0 (inflate/deflate)} + if (IHDRData.CompressionMethod <> 0) then + begin + Result := False; + Owner.RaiseError(EPNGUnknownCompression, EPNGUnknownCompressionText); + exit; + end; + {Interlace must be either 0 (none) or 7 (adam7)} + if (IHDRData.InterlaceMethod <> 0) and (IHDRData.InterlaceMethod <> 1) then + begin + Result := False; + Owner.RaiseError(EPNGUnknownInterlace, EPNGUnknownInterlaceText); + exit; + end; + + {Updates owner properties} + Owner.InterlaceMethod := TInterlaceMethod(IHDRData.InterlaceMethod); + + {Prepares data to hold image} + PrepareImageData(); +end; + +{Saving the IHDR chunk to a stream} +function TChunkIHDR.SaveToStream(Stream: TStream): Boolean; +begin + {Ignore 2 bits images} + if BitDepth = 2 then BitDepth := 4; + + {It needs to do is update the data with the IHDR data} + {structure containing the write values} + ResizeData(SizeOf(TIHDRData)); + pIHDRData(fData)^ := IHDRData; + {..byteswap 4 byte types} + pIHDRData(fData)^.Width := ByteSwap(pIHDRData(fData)^.Width); + pIHDRData(fData)^.Height := ByteSwap(pIHDRData(fData)^.Height); + {..update interlace method} + pIHDRData(fData)^.InterlaceMethod := Byte(Owner.InterlaceMethod); + {..and then let the ancestor SaveToStream do the hard work} + Result := inherited SaveToStream(Stream); +end; + +{Resizes the image data to fill the color type, bit depth, } +{width and height parameters} +procedure TChunkIHDR.PrepareImageData(); + + {Set the bitmap info} + procedure SetInfo(const Bitdepth: Integer; const Palette: Boolean); + begin + + {Copy if the bitmap contain palette entries} + HasPalette := Palette; + {Initialize the structure with zeros} + fillchar(BitmapInfo, sizeof(BitmapInfo), #0); + {Fill the strucutre} + with BitmapInfo.bmiHeader do + begin + biSize := sizeof(TBitmapInfoHeader); + biHeight := Height; + biWidth := Width; + biPlanes := 1; + biBitCount := BitDepth; + biCompression := BI_RGB; + end {with BitmapInfo.bmiHeader} + end; +begin + {Prepare bitmap info header} + Fillchar(BitmapInfo, sizeof(TMaxBitmapInfo), #0); + {Release old image data} + FreeImageData(); + + {Obtain number of bits for each pixel} + case ColorType of + COLOR_GRAYSCALE, COLOR_PALETTE, COLOR_GRAYSCALEALPHA: + case BitDepth of + {These are supported by windows} + 1, 4, 8: SetInfo(BitDepth, TRUE); + {2 bits for each pixel is not supported by windows bitmap} + 2 : SetInfo(4, TRUE); + {Also 16 bits (2 bytes) for each pixel is not supported} + {and should be transormed into a 8 bit grayscale} + 16 : SetInfo(8, TRUE); + end; + {Only 1 byte (8 bits) is supported} + COLOR_RGB, COLOR_RGBALPHA: SetInfo(24, FALSE); + end {case ColorType}; + {Number of bytes for each scanline} + BytesPerRow := (((BitmapInfo.bmiHeader.biBitCount * Width) + 31) + and not 31) div 8; + + {Build array for alpha information, if necessary} + if (ColorType = COLOR_RGBALPHA) or (ColorType = COLOR_GRAYSCALEALPHA) then + begin + GetMem(ImageAlpha, Integer(Width) * Integer(Height)); + FillChar(ImageAlpha^, Integer(Width) * Integer(Height), #0); + end; + + {Build array for extra byte information} + {$IFDEF Store16bits} + if (BitDepth = 16) then + begin + GetMem(ExtraImageData, BytesPerRow * Integer(Height)); + FillChar(ExtraImageData^, BytesPerRow * Integer(Height), #0); + end; + {$ENDIF} + + {Creates the image to hold the data, CreateDIBSection does a better} + {work in allocating necessary memory} + ImageDC := CreateCompatibleDC(0); + ImageHandle := CreateDIBSection(ImageDC, pBitmapInfo(@BitmapInfo)^, + DIB_RGB_COLORS, ImageData, 0, 0); + + {Clears the old palette (if any)} + with Owner do + if TempPalette <> 0 then + begin + DeleteObject(TempPalette); + TempPalette := 0; + end {with Owner, if TempPalette <> 0}; + + {Build array and allocate bytes for each row} + zeromemory(ImageData, BytesPerRow * Integer(Height)); +end; + +{TChunktRNS implementation} + +{$IFNDEF UseDelphi} +function CompareMem(P1, P2: pByte; const Size: Integer): Boolean; +var i: Integer; +begin + Result := True; + for i := 1 to Size do + begin + if P1^ <> P2^ then Result := False; + inc(P1); inc(P2); + end {for i} +end; +{$ENDIF} + +{Sets the transpararent color} +procedure TChunktRNS.SetTransparentColor(const Value: ColorRef); +var + i: Byte; + LookColor: TRGBQuad; +begin + {Clears the palette values} + Fillchar(PaletteValues, SizeOf(PaletteValues), #0); + {Sets that it uses bit transparency} + fBitTransparency := True; + + + {Depends on the color type} + with Header do + case ColorType of + COLOR_GRAYSCALE: + begin + Self.ResizeData(2); + pWord(@PaletteValues[0])^ := ByteSwap16(GetRValue(Value)); + end; + COLOR_RGB: + begin + Self.ResizeData(6); + pWord(@PaletteValues[0])^ := ByteSwap16(GetRValue(Value)); + pWord(@PaletteValues[2])^ := ByteSwap16(GetGValue(Value)); + pWord(@PaletteValues[4])^ := ByteSwap16(GetBValue(Value)); + end; + COLOR_PALETTE: + begin + {Creates a RGBQuad to search for the color} + LookColor.rgbRed := GetRValue(Value); + LookColor.rgbGreen := GetGValue(Value); + LookColor.rgbBlue := GetBValue(Value); + {Look in the table for the entry} + for i := 0 to 255 do + if CompareMem(@BitmapInfo.bmiColors[i], @LookColor, 3) then + Break; + {Fill the transparency table} + Fillchar(PaletteValues, i, 255); + Self.ResizeData(i + 1) + + end + end {case / with}; + +end; + +{Returns the transparent color for the image} +function TChunktRNS.GetTransparentColor: ColorRef; +var + PaletteChunk: TChunkPLTE; + i: Integer; +begin + Result := 0; {Default: Unknown transparent color} + + {Depends on the color type} + with Header do + case ColorType of + COLOR_GRAYSCALE: + Result := RGB(PaletteValues[0], PaletteValues[0], + PaletteValues[0]); + COLOR_RGB: + Result := RGB(PaletteValues[1], PaletteValues[3], PaletteValues[5]); + COLOR_PALETTE: + begin + {Obtains the palette chunk} + PaletteChunk := Owner.Chunks.ItemFromClass(TChunkPLTE) as TChunkPLTE; + + {Looks for an entry with 0 transparency meaning that it is the} + {full transparent entry} + for i := 0 to Self.DataSize - 1 do + if PaletteValues[i] = 0 then + with PaletteChunk.GetPaletteItem(i) do + begin + Result := RGB(rgbRed, rgbGreen, rgbBlue); + break + end + end {COLOR_PALETTE} + end {case Header.ColorType}; +end; + +{Saving the chunk to a stream} +function TChunktRNS.SaveToStream(Stream: TStream): Boolean; +begin + {Copy palette into data buffer} + if DataSize <= 256 then + CopyMemory(fData, @PaletteValues[0], DataSize); + + Result := inherited SaveToStream(Stream); +end; + +{Assigns from another chunk} +procedure TChunktRNS.Assign(Source: TChunk); +begin + CopyMemory(@PaletteValues[0], @TChunkTrns(Source).PaletteValues[0], 256); + fBitTransparency := TChunkTrns(Source).fBitTransparency; + inherited Assign(Source); +end; + +{Loads the chunk from a stream} +function TChunktRNS.LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; +var + i, Differ255: Integer; +begin + {Let inherited load} + Result := inherited LoadFromStream(Stream, ChunkName, Size); + + if not Result then Exit; + + {Make sure size is correct} + if Size > 256 then Owner.RaiseError(EPNGInvalidPalette, + EPNGInvalidPaletteText); + + {The unset items should have value 255} + Fillchar(PaletteValues[0], 256, 255); + {Copy the other values} + CopyMemory(@PaletteValues[0], fData, Size); + + {Create the mask if needed} + case Header.ColorType of + {Mask for grayscale and RGB} + COLOR_RGB, COLOR_GRAYSCALE: fBitTransparency := True; + COLOR_PALETTE: + begin + Differ255 := 0; {Count the entries with a value different from 255} + {Tests if it uses bit transparency} + for i := 0 to Size - 1 do + if PaletteValues[i] <> 255 then inc(Differ255); + + {If it has one value different from 255 it is a bit transparency} + fBitTransparency := (Differ255 = 1); + end {COLOR_PALETTE} + end {case Header.ColorType}; + +end; + +{Prepares the image palette} +procedure TChunkIDAT.PreparePalette; +var + Entries: Word; + j : Integer; +begin + {In case the image uses grayscale, build a grayscale palette} + with Header do + if (ColorType = COLOR_GRAYSCALE) or (ColorType = COLOR_GRAYSCALEALPHA) then + begin + {Calculate total number of palette entries} + Entries := (1 shl Byte(BitmapInfo.bmiHeader.biBitCount)); + + FOR j := 0 TO Entries - 1 DO + with BitmapInfo.bmiColors[j] do + begin + + {Calculate each palette entry} + rgbRed := fOwner.GammaTable[MulDiv(j, 255, Entries - 1)]; + rgbGreen := rgbRed; + rgbBlue := rgbRed; + end {with BitmapInfo.bmiColors[j]} + end {if ColorType = COLOR_GRAYSCALE..., with Header} +end; + +{Reads from ZLIB} +function TChunkIDAT.IDATZlibRead(var ZLIBStream: TZStreamRec2; + Buffer: Pointer; Count: Integer; var EndPos: Integer; + var crcfile: Cardinal): Integer; +var + ProcResult : Integer; + IDATHeader : Array[0..3] of char; + IDATCRC : Cardinal; +begin + {Uses internal record pointed by ZLIBStream to gather information} + with ZLIBStream, ZLIBStream.zlib do + begin + {Set the buffer the zlib will read into} + next_out := Buffer; + avail_out := Count; + + {Decode until it reach the Count variable} + while avail_out > 0 do + begin + {In case it needs more data and it's in the end of a IDAT chunk,} + {it means that there are more IDAT chunks} + if (fStream.Position = EndPos) and (avail_out > 0) and + (avail_in = 0) then + begin + {End this chunk by reading and testing the crc value} + fStream.Read(IDATCRC, 4); + + {$IFDEF CheckCRC} + if crcfile xor $ffffffff <> Cardinal(ByteSwap(IDATCRC)) then + begin + Result := -1; + Owner.RaiseError(EPNGInvalidCRC, EPNGInvalidCRCText); + exit; + end; + {$ENDIF} + + {Start reading the next chunk} + fStream.Read(EndPos, 4); {Reads next chunk size} + fStream.Read(IDATHeader[0], 4); {Next chunk header} + {It must be a IDAT chunk since image data is required and PNG} + {specification says that multiple IDAT chunks must be consecutive} + if IDATHeader <> 'IDAT' then + begin + Owner.RaiseError(EPNGMissingMultipleIDAT, EPNGMissingMultipleIDATText); + result := -1; + exit; + end; + + {Calculate chunk name part of the crc} + {$IFDEF CheckCRC} + crcfile := update_crc($ffffffff, @IDATHeader[0], 4); + {$ENDIF} + EndPos := fStream.Position + ByteSwap(EndPos); + end; + + + {In case it needs compressed data to read from} + if avail_in = 0 then + begin + {In case it's trying to read more than it is avaliable} + if fStream.Position + ZLIBAllocate > EndPos then + avail_in := fStream.Read(Data^, EndPos - fStream.Position) + else + avail_in := fStream.Read(Data^, ZLIBAllocate); + {Update crc} + {$IFDEF CheckCRC} + crcfile := update_crc(crcfile, Data, avail_in); + {$ENDIF} + + {In case there is no more compressed data to read from} + if avail_in = 0 then + begin + Result := Count - avail_out; + Exit; + end; + + {Set next buffer to read and record current position} + next_in := Data; + + end {if avail_in = 0}; + + ProcResult := inflate(zlib, 0); + + {In case the result was not sucessfull} + if (ProcResult < 0) then + begin + Result := -1; + Owner.RaiseError(EPNGZLIBError, + EPNGZLIBErrorText + zliberrors[procresult]); + exit; + end; + + end {while avail_out > 0}; + + end {with}; + + {If everything gone ok, it returns the count bytes} + Result := Count; +end; + +{TChunkIDAT implementation} + +const + {Adam 7 interlacing values} + RowStart: array[0..6] of Integer = (0, 0, 4, 0, 2, 0, 1); + ColumnStart: array[0..6] of Integer = (0, 4, 0, 2, 0, 1, 0); + RowIncrement: array[0..6] of Integer = (8, 8, 8, 4, 4, 2, 2); + ColumnIncrement: array[0..6] of Integer = (8, 8, 4, 4, 2, 2, 1); + +{Copy interlaced images with 1 byte for R, G, B} +procedure TChunkIDAT.CopyInterlacedRGB8(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Dest := pChar(Longint(Dest) + Col * 3); + repeat + {Copy this row} + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 1)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) )^]; inc(Dest); + + {Move to next column} + inc(Src, 3); + inc(Dest, ColumnIncrement[Pass] * 3 - 3); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Copy interlaced images with 2 bytes for R, G, B} +procedure TChunkIDAT.CopyInterlacedRGB16(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Dest := pChar(Longint(Dest) + Col * 3); + repeat + {Copy this row} + Byte(Dest^) := Owner.GammaTable[pByte(Longint(Src) + 4)^]; inc(Dest); + Byte(Dest^) := Owner.GammaTable[pByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := Owner.GammaTable[pByte(Longint(Src) )^]; inc(Dest); + {$IFDEF Store16bits} + {Copy extra pixel values} + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 5)^]; inc(Extra); + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 3)^]; inc(Extra); + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 1)^]; inc(Extra); + {$ENDIF} + + {Move to next column} + inc(Src, 6); + inc(Dest, ColumnIncrement[Pass] * 3 - 3); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Copy ímages with palette using bit depths 1, 4 or 8} +procedure TChunkIDAT.CopyInterlacedPalette148(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +const + BitTable: Array[1..8] of Integer = ($1, $3, 0, $F, 0, 0, 0, $FF); + StartBit: Array[1..8] of Integer = (7 , 0 , 0, 4, 0, 0, 0, 0); +var + CurBit, Col: Integer; + Dest2: PChar; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + repeat + {Copy data} + CurBit := StartBit[Header.BitDepth]; + repeat + {Adjust pointer to pixel byte bounds} + Dest2 := pChar(Longint(Dest) + (Header.BitDepth * Col) div 8); + {Copy data} + Byte(Dest2^) := Byte(Dest2^) or + ( ((Byte(Src^) shr CurBit) and BitTable[Header.BitDepth]) + shl (StartBit[Header.BitDepth] - (Col * Header.BitDepth mod 8))); + + {Move to next column} + inc(Col, ColumnIncrement[Pass]); + {Will read next bits} + dec(CurBit, Header.BitDepth); + until CurBit < 0; + + {Move to next byte in source} + inc(Src); + until Col >= ImageWidth; +end; + +{Copy ímages with palette using bit depth 2} +procedure TChunkIDAT.CopyInterlacedPalette2(const Pass: Byte; Src, Dest, + Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + CurBit, Col: Integer; + Dest2: PChar; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + repeat + {Copy data} + CurBit := 6; + repeat + {Adjust pointer to pixel byte bounds} + Dest2 := pChar(Longint(Dest) + Col div 2); + {Copy data} + Byte(Dest2^) := Byte(Dest2^) or (((Byte(Src^) shr CurBit) and $3) + shl (4 - (4 * Col) mod 8)); + {Move to next column} + inc(Col, ColumnIncrement[Pass]); + {Will read next bits} + dec(CurBit, 2); + until CurBit < 0; + + {Move to next byte in source} + inc(Src); + until Col >= ImageWidth; +end; + +{Copy ímages with grayscale using bit depth 2} +procedure TChunkIDAT.CopyInterlacedGray2(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + CurBit, Col: Integer; + Dest2: PChar; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + repeat + {Copy data} + CurBit := 6; + repeat + {Adjust pointer to pixel byte bounds} + Dest2 := pChar(Longint(Dest) + Col div 2); + {Copy data} + Byte(Dest2^) := Byte(Dest2^) or ((((Byte(Src^) shr CurBit) shl 2) and $F) + shl (4 - (Col*4) mod 8)); + {Move to next column} + inc(Col, ColumnIncrement[Pass]); + {Will read next bits} + dec(CurBit, 2); + until CurBit < 0; + + {Move to next byte in source} + inc(Src); + until Col >= ImageWidth; +end; + +{Copy ímages with palette using 2 bytes for each pixel} +procedure TChunkIDAT.CopyInterlacedGrayscale16(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Dest := pChar(Longint(Dest) + Col); + repeat + {Copy this row} + Dest^ := Src^; inc(Dest); + {$IFDEF Store16bits} + Extra^ := pChar(Longint(Src) + 1)^; inc(Extra); + {$ENDIF} + + {Move to next column} + inc(Src, 2); + inc(Dest, ColumnIncrement[Pass] - 1); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Decodes interlaced RGB alpha with 1 byte for each sample} +procedure TChunkIDAT.CopyInterlacedRGBAlpha8(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Dest := pChar(Longint(Dest) + Col * 3); + Trans := pChar(Longint(Trans) + Col); + repeat + {Copy this row and alpha value} + Trans^ := pChar(Longint(Src) + 3)^; + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 1)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) )^]; inc(Dest); + + {Move to next column} + inc(Src, 4); + inc(Dest, ColumnIncrement[Pass] * 3 - 3); + inc(Trans, ColumnIncrement[Pass]); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Decodes interlaced RGB alpha with 2 bytes for each sample} +procedure TChunkIDAT.CopyInterlacedRGBAlpha16(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Dest := pChar(Longint(Dest) + Col * 3); + Trans := pChar(Longint(Trans) + Col); + repeat + {Copy this row and alpha value} + Trans^ := pChar(Longint(Src) + 6)^; + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 4)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) )^]; inc(Dest); + {$IFDEF Store16bits} + {Copy extra pixel values} + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 5)^]; inc(Extra); + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 3)^]; inc(Extra); + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 1)^]; inc(Extra); + {$ENDIF} + + {Move to next column} + inc(Src, 8); + inc(Dest, ColumnIncrement[Pass] * 3 - 3); + inc(Trans, ColumnIncrement[Pass]); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Decodes 8 bit grayscale image followed by an alpha sample} +procedure TChunkIDAT.CopyInterlacedGrayscaleAlpha8(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + Col: Integer; +begin + {Get first column, pointers to the data and enter in loop} + Col := ColumnStart[Pass]; + Dest := pChar(Longint(Dest) + Col); + Trans := pChar(Longint(Trans) + Col); + repeat + {Copy this grayscale value and alpha} + Dest^ := Src^; inc(Src); + Trans^ := Src^; inc(Src); + + {Move to next column} + inc(Dest, ColumnIncrement[Pass]); + inc(Trans, ColumnIncrement[Pass]); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Decodes 16 bit grayscale image followed by an alpha sample} +procedure TChunkIDAT.CopyInterlacedGrayscaleAlpha16(const Pass: Byte; + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + Col: Integer; +begin + {Get first column, pointers to the data and enter in loop} + Col := ColumnStart[Pass]; + Dest := pChar(Longint(Dest) + Col); + Trans := pChar(Longint(Trans) + Col); + repeat + {$IFDEF Store16bits} + Extra^ := pChar(Longint(Src) + 1)^; inc(Extra); + {$ENDIF} + {Copy this grayscale value and alpha, transforming 16 bits into 8} + Dest^ := Src^; inc(Src, 2); + Trans^ := Src^; inc(Src, 2); + + {Move to next column} + inc(Dest, ColumnIncrement[Pass]); + inc(Trans, ColumnIncrement[Pass]); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Decodes an interlaced image} +procedure TChunkIDAT.DecodeInterlacedAdam7(Stream: TStream; + var ZLIBStream: TZStreamRec2; const Size: Integer; var crcfile: Cardinal); +var + CurrentPass: Byte; + PixelsThisRow: Integer; + CurrentRow: Integer; + Trans, Data{$IFDEF Store16bits}, Extra{$ENDIF}: pChar; + CopyProc: procedure(const Pass: Byte; Src, Dest, + Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar) of object; +begin + + CopyProc := nil; {Initialize} + {Determine method to copy the image data} + case Header.ColorType of + {R, G, B values for each pixel} + COLOR_RGB: + case Header.BitDepth of + 8: CopyProc := CopyInterlacedRGB8; + 16: CopyProc := CopyInterlacedRGB16; + end {case Header.BitDepth}; + {Palette} + COLOR_PALETTE, COLOR_GRAYSCALE: + case Header.BitDepth of + 1, 4, 8: CopyProc := CopyInterlacedPalette148; + 2 : if Header.ColorType = COLOR_PALETTE then + CopyProc := CopyInterlacedPalette2 + else + CopyProc := CopyInterlacedGray2; + 16 : CopyProc := CopyInterlacedGrayscale16; + end; + {RGB followed by alpha} + COLOR_RGBALPHA: + case Header.BitDepth of + 8: CopyProc := CopyInterlacedRGBAlpha8; + 16: CopyProc := CopyInterlacedRGBAlpha16; + end; + {Grayscale followed by alpha} + COLOR_GRAYSCALEALPHA: + case Header.BitDepth of + 8: CopyProc := CopyInterlacedGrayscaleAlpha8; + 16: CopyProc := CopyInterlacedGrayscaleAlpha16; + end; + end {case Header.ColorType}; + + {Adam7 method has 7 passes to make the final image} + FOR CurrentPass := 0 TO 6 DO + begin + {Calculates the number of pixels and bytes for this pass row} + PixelsThisRow := (ImageWidth - ColumnStart[CurrentPass] + + ColumnIncrement[CurrentPass] - 1) div ColumnIncrement[CurrentPass]; + Row_Bytes := BytesForPixels(PixelsThisRow, Header.ColorType, + Header.BitDepth); + {Clear buffer for this pass} + ZeroMemory(Row_Buffer[not RowUsed], Row_Bytes); + + {Get current row index} + CurrentRow := RowStart[CurrentPass]; + {Get a pointer to the current row image data} + Data := Ptr(Longint(Header.ImageData) + Header.BytesPerRow * + (ImageHeight - 1 - CurrentRow)); + Trans := Ptr(Longint(Header.ImageAlpha) + ImageWidth * CurrentRow); + {$IFDEF Store16bits} + Extra := Ptr(Longint(Header.ExtraImageData) + Header.BytesPerRow * + (ImageHeight - 1 - CurrentRow)); + {$ENDIF} + + if Row_Bytes > 0 then {There must have bytes for this interlaced pass} + while CurrentRow < ImageHeight do + begin + {Reads this line and filter} + if IDATZlibRead(ZLIBStream, @Row_Buffer[RowUsed][0], Row_Bytes + 1, + EndPos, CRCFile) = 0 then break; + + FilterRow; + {Copy image data} + + CopyProc(CurrentPass, @Row_Buffer[RowUsed][1], Data, Trans + {$IFDEF Store16bits}, Extra{$ENDIF}); + + {Use the other RowBuffer item} + RowUsed := not RowUsed; + + {Move to the next row} + inc(CurrentRow, RowIncrement[CurrentPass]); + {Move pointer to the next line} + dec(Data, RowIncrement[CurrentPass] * Header.BytesPerRow); + inc(Trans, RowIncrement[CurrentPass] * ImageWidth); + {$IFDEF Store16bits} + dec(Extra, RowIncrement[CurrentPass] * Header.BytesPerRow); + {$ENDIF} + end {while CurrentRow < ImageHeight}; + + end {FOR CurrentPass}; + +end; + +{Copy 8 bits RGB image} +procedure TChunkIDAT.CopyNonInterlacedRGB8( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + I: Integer; +begin + FOR I := 1 TO ImageWidth DO + begin + {Copy pixel values} + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 1)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) )^]; inc(Dest); + {Move to next pixel} + inc(Src, 3); + end {for I} +end; + +{Copy 16 bits RGB image} +procedure TChunkIDAT.CopyNonInterlacedRGB16( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + I: Integer; +begin + FOR I := 1 TO ImageWidth DO + begin + //Since windows does not supports 2 bytes for + //each R, G, B value, the method will read only 1 byte from it + {Copy pixel values} + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 4)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) )^]; inc(Dest); + {$IFDEF Store16bits} + {Copy extra pixel values} + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 5)^]; inc(Extra); + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 3)^]; inc(Extra); + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 1)^]; inc(Extra); + {$ENDIF} + + {Move to next pixel} + inc(Src, 6); + end {for I} +end; + +{Copy types using palettes (1, 4 or 8 bits per pixel)} +procedure TChunkIDAT.CopyNonInterlacedPalette148( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +begin + {It's simple as copying the data} + CopyMemory(Dest, Src, Row_Bytes); +end; + +{Copy grayscale types using 2 bits for each pixel} +procedure TChunkIDAT.CopyNonInterlacedGray2( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + i: Integer; +begin + {2 bits is not supported, this routine will converted into 4 bits} + FOR i := 1 TO Row_Bytes do + begin + Byte(Dest^) := ((Byte(Src^) shr 2) and $F) or ((Byte(Src^)) and $F0); inc(Dest); + Byte(Dest^) := ((Byte(Src^) shl 2) and $F) or ((Byte(Src^) shl 4) and $F0); inc(Dest); + inc(Src); + end {FOR i} +end; + +{Copy types using palette with 2 bits for each pixel} +procedure TChunkIDAT.CopyNonInterlacedPalette2( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + i: Integer; +begin + {2 bits is not supported, this routine will converted into 4 bits} + FOR i := 1 TO Row_Bytes do + begin + Byte(Dest^) := ((Byte(Src^) shr 4) and $3) or ((Byte(Src^) shr 2) and $30); inc(Dest); + Byte(Dest^) := (Byte(Src^) and $3) or ((Byte(Src^) shl 2) and $30); inc(Dest); + inc(Src); + end {FOR i} +end; + +{Copy grayscale images with 16 bits} +procedure TChunkIDAT.CopyNonInterlacedGrayscale16( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + I: Integer; +begin + FOR I := 1 TO ImageWidth DO + begin + {Windows does not supports 16 bits for each pixel in grayscale} + {mode, so reduce to 8} + Dest^ := Src^; inc(Dest); + {$IFDEF Store16bits} + Extra^ := pChar(Longint(Src) + 1)^; inc(Extra); + {$ENDIF} + + {Move to next pixel} + inc(Src, 2); + end {for I} +end; + +{Copy 8 bits per sample RGB images followed by an alpha byte} +procedure TChunkIDAT.CopyNonInterlacedRGBAlpha8( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + i: Integer; +begin + FOR I := 1 TO ImageWidth DO + begin + {Copy pixel values and transparency} + Trans^ := pChar(Longint(Src) + 3)^; + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 1)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) )^]; inc(Dest); + {Move to next pixel} + inc(Src, 4); inc(Trans); + end {for I} +end; + +{Copy 16 bits RGB image with alpha using 2 bytes for each sample} +procedure TChunkIDAT.CopyNonInterlacedRGBAlpha16( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + I: Integer; +begin + FOR I := 1 TO ImageWidth DO + begin + //Copy rgb and alpha values (transforming from 16 bits to 8 bits) + {Copy pixel values} + Trans^ := pChar(Longint(Src) + 6)^; + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 4)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := fOwner.GammaTable[pByte(Longint(Src) )^]; inc(Dest); + {$IFDEF Store16bits} + {Copy extra pixel values} + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 5)^]; inc(Extra); + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 3)^]; inc(Extra); + Byte(Extra^) := fOwner.GammaTable[pByte(Longint(Src) + 1)^]; inc(Extra); + {$ENDIF} + {Move to next pixel} + inc(Src, 8); inc(Trans); + end {for I} +end; + +{Copy 8 bits per sample grayscale followed by alpha} +procedure TChunkIDAT.CopyNonInterlacedGrayscaleAlpha8( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + I: Integer; +begin + FOR I := 1 TO ImageWidth DO + begin + {Copy alpha value and then gray value} + Dest^ := Src^; inc(Src); + Trans^ := Src^; inc(Src); + inc(Dest); inc(Trans); + end; +end; + +{Copy 16 bits per sample grayscale followed by alpha} +procedure TChunkIDAT.CopyNonInterlacedGrayscaleAlpha16( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar); +var + I: Integer; +begin + FOR I := 1 TO ImageWidth DO + begin + {Copy alpha value and then gray value} + {$IFDEF Store16bits} + Extra^ := pChar(Longint(Src) + 1)^; inc(Extra); + {$ENDIF} + Dest^ := Src^; inc(Src, 2); + Trans^ := Src^; inc(Src, 2); + inc(Dest); inc(Trans); + end; +end; + +{Decode non interlaced image} +procedure TChunkIDAT.DecodeNonInterlaced(Stream: TStream; + var ZLIBStream: TZStreamRec2; const Size: Integer; var crcfile: Cardinal); +var + j: Cardinal; + Trans, Data{$IFDEF Store16bits}, Extra{$ENDIF}: pChar; + CopyProc: procedure( + Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar) of object; +begin + CopyProc := nil; {Initialize} + {Determines the method to copy the image data} + case Header.ColorType of + {R, G, B values} + COLOR_RGB: + case Header.BitDepth of + 8: CopyProc := CopyNonInterlacedRGB8; + 16: CopyProc := CopyNonInterlacedRGB16; + end; + {Types using palettes} + COLOR_PALETTE, COLOR_GRAYSCALE: + case Header.BitDepth of + 1, 4, 8: CopyProc := CopyNonInterlacedPalette148; + 2 : if Header.ColorType = COLOR_PALETTE then + CopyProc := CopyNonInterlacedPalette2 + else + CopyProc := CopyNonInterlacedGray2; + 16 : CopyProc := CopyNonInterlacedGrayscale16; + end; + {R, G, B followed by alpha} + COLOR_RGBALPHA: + case Header.BitDepth of + 8 : CopyProc := CopyNonInterlacedRGBAlpha8; + 16 : CopyProc := CopyNonInterlacedRGBAlpha16; + end; + {Grayscale followed by alpha} + COLOR_GRAYSCALEALPHA: + case Header.BitDepth of + 8 : CopyProc := CopyNonInterlacedGrayscaleAlpha8; + 16 : CopyProc := CopyNonInterlacedGrayscaleAlpha16; + end; + end; + + {Get the image data pointer} + Longint(Data) := Longint(Header.ImageData) + + Header.BytesPerRow * (ImageHeight - 1); + Trans := Header.ImageAlpha; + {$IFDEF Store16bits} + Longint(Extra) := Longint(Header.ExtraImageData) + + Header.BytesPerRow * (ImageHeight - 1); + {$ENDIF} + {Reads each line} + FOR j := 0 to ImageHeight - 1 do + begin + {Read this line Row_Buffer[RowUsed][0] if the filter type for this line} + if IDATZlibRead(ZLIBStream, @Row_Buffer[RowUsed][0], Row_Bytes + 1, EndPos, + CRCFile) = 0 then break; + + {Filter the current row} + FilterRow; + {Copies non interlaced row to image} + CopyProc(@Row_Buffer[RowUsed][1], Data, Trans{$IFDEF Store16bits}, Extra + {$ENDIF}); + + {Invert line used} + RowUsed := not RowUsed; + dec(Data, Header.BytesPerRow); + {$IFDEF Store16bits}dec(Extra, Header.BytesPerRow);{$ENDIF} + inc(Trans, ImageWidth); + end {for I}; + + +end; + +{Filter the current line} +procedure TChunkIDAT.FilterRow; +var + pp: Byte; + vv, left, above, aboveleft: Integer; + Col: Cardinal; +begin + {Test the filter} + case Row_Buffer[RowUsed]^[0] of + {No filtering for this line} + FILTER_NONE: begin end; + {AND 255 serves only to never let the result be larger than one byte} + {Sub filter} + FILTER_SUB: + FOR Col := Offset + 1 to Row_Bytes DO + Row_Buffer[RowUsed][Col] := (Row_Buffer[RowUsed][Col] + + Row_Buffer[RowUsed][Col - Offset]) and 255; + {Up filter} + FILTER_UP: + FOR Col := 1 to Row_Bytes DO + Row_Buffer[RowUsed][Col] := (Row_Buffer[RowUsed][Col] + + Row_Buffer[not RowUsed][Col]) and 255; + {Average filter} + FILTER_AVERAGE: + FOR Col := 1 to Row_Bytes DO + begin + {Obtains up and left pixels} + above := Row_Buffer[not RowUsed][Col]; + if col - 1 < Offset then + left := 0 + else + Left := Row_Buffer[RowUsed][Col - Offset]; + + {Calculates} + Row_Buffer[RowUsed][Col] := (Row_Buffer[RowUsed][Col] + + (left + above) div 2) and 255; + end; + {Paeth filter} + FILTER_PAETH: + begin + {Initialize} + left := 0; + aboveleft := 0; + {Test each byte} + FOR Col := 1 to Row_Bytes DO + begin + {Obtains above pixel} + above := Row_Buffer[not RowUsed][Col]; + {Obtains left and top-left pixels} + if (col - 1 >= offset) Then + begin + left := row_buffer[RowUsed][col - offset]; + aboveleft := row_buffer[not RowUsed][col - offset]; + end; + + {Obtains current pixel and paeth predictor} + vv := row_buffer[RowUsed][Col]; + pp := PaethPredictor(left, above, aboveleft); + + {Calculates} + Row_Buffer[RowUsed][Col] := (pp + vv) and $FF; + end {for}; + end; + + end {case}; +end; + +{Reads the image data from the stream} +function TChunkIDAT.LoadFromStream(Stream: TStream; const ChunkName: TChunkName; + Size: Integer): Boolean; +var + ZLIBStream: TZStreamRec2; + CRCCheck, + CRCFile : Cardinal; +begin + {Get pointer to the header chunk} + Header := Owner.Chunks.Item[0] as TChunkIHDR; + {Build palette if necessary} + if Header.HasPalette then PreparePalette(); + + {Copy image width and height} + ImageWidth := Header.Width; + ImageHeight := Header.Height; + + {Initialize to calculate CRC} + {$IFDEF CheckCRC} + CRCFile := update_crc($ffffffff, @ChunkName[0], 4); + {$ENDIF} + + Owner.GetPixelInfo(Row_Bytes, Offset); {Obtain line information} + ZLIBStream := ZLIBInitInflate(Stream); {Initializes decompression} + + {Calculate ending position for the current IDAT chunk} + EndPos := Stream.Position + Size; + + {Allocate memory} + GetMem(Row_Buffer[false], Row_Bytes + 1); + GetMem(Row_Buffer[true], Row_Bytes + 1); + ZeroMemory(Row_Buffer[false], Row_bytes + 1); + {Set the variable to alternate the Row_Buffer item to use} + RowUsed := TRUE; + + {Call special methods for the different interlace methods} + case Owner.InterlaceMethod of + imNone: DecodeNonInterlaced(stream, ZLIBStream, Size, crcfile); + imAdam7: DecodeInterlacedAdam7(stream, ZLIBStream, size, crcfile); + end; + + {Free memory} + ZLIBTerminateInflate(ZLIBStream); {Terminates decompression} + FreeMem(Row_Buffer[False], Row_Bytes + 1); + FreeMem(Row_Buffer[True], Row_Bytes + 1); + + {Now checks CRC} + Stream.Read(CRCCheck, 4); + {$IFDEF CheckCRC} + CRCFile := CRCFile xor $ffffffff; + CRCCheck := ByteSwap(CRCCheck); + Result := CRCCheck = CRCFile; + + {Handle CRC error} + if not Result then + begin + {In case it coult not load chunk} + Owner.RaiseError(EPngInvalidCRC, EPngInvalidCRCText); + exit; + end; + {$ELSE}Result := TRUE; {$ENDIF} +end; + +const + IDATHeader: Array[0..3] of char = ('I', 'D', 'A', 'T'); + BUFFER = 5; + +{Saves the IDAT chunk to a stream} +function TChunkIDAT.SaveToStream(Stream: TStream): Boolean; +var + ZLIBStream : TZStreamRec2; +begin + {Get pointer to the header chunk} + Header := Owner.Chunks.Item[0] as TChunkIHDR; + {Copy image width and height} + ImageWidth := Header.Width; + ImageHeight := Header.Height; + Owner.GetPixelInfo(Row_Bytes, Offset); {Obtain line information} + + {Allocate memory} + GetMem(Encode_Buffer[BUFFER], Row_Bytes); + ZeroMemory(Encode_Buffer[BUFFER], Row_Bytes); + {Allocate buffers for the filters selected} + {Filter none will always be calculated to the other filters to work} + GetMem(Encode_Buffer[FILTER_NONE], Row_Bytes); + ZeroMemory(Encode_Buffer[FILTER_NONE], Row_Bytes); + if pfSub in Owner.Filters then + GetMem(Encode_Buffer[FILTER_SUB], Row_Bytes); + if pfUp in Owner.Filters then + GetMem(Encode_Buffer[FILTER_UP], Row_Bytes); + if pfAverage in Owner.Filters then + GetMem(Encode_Buffer[FILTER_AVERAGE], Row_Bytes); + if pfPaeth in Owner.Filters then + GetMem(Encode_Buffer[FILTER_PAETH], Row_Bytes); + + {Initialize ZLIB} + ZLIBStream := ZLIBInitDeflate(Stream, Owner.fCompressionLevel, + Owner.MaxIdatSize); + {Write data depending on the interlace method} + case Owner.InterlaceMethod of + imNone: EncodeNonInterlaced(stream, ZLIBStream); + imAdam7: EncodeInterlacedAdam7(stream, ZLIBStream); + end; + {Terminates ZLIB} + ZLIBTerminateDeflate(ZLIBStream); + + {Release allocated memory} + FreeMem(Encode_Buffer[BUFFER], Row_Bytes); + FreeMem(Encode_Buffer[FILTER_NONE], Row_Bytes); + if pfSub in Owner.Filters then + FreeMem(Encode_Buffer[FILTER_SUB], Row_Bytes); + if pfUp in Owner.Filters then + FreeMem(Encode_Buffer[FILTER_UP], Row_Bytes); + if pfAverage in Owner.Filters then + FreeMem(Encode_Buffer[FILTER_AVERAGE], Row_Bytes); + if pfPaeth in Owner.Filters then + FreeMem(Encode_Buffer[FILTER_PAETH], Row_Bytes); + + {Everything went ok} + Result := True; +end; + +{Writes the IDAT using the settings} +procedure WriteIDAT(Stream: TStream; Data: Pointer; const Length: Cardinal); +var + ChunkLen, CRC: Cardinal; +begin + {Writes IDAT header} + ChunkLen := ByteSwap(Length); + Stream.Write(ChunkLen, 4); {Chunk length} + Stream.Write(IDATHeader[0], 4); {Idat header} + CRC := update_crc($ffffffff, @IDATHeader[0], 4); {Crc part for header} + + {Writes IDAT data and calculates CRC for data} + Stream.Write(Data^, Length); + CRC := Byteswap(update_crc(CRC, Data, Length) xor $ffffffff); + {Writes final CRC} + Stream.Write(CRC, 4); +end; + +{Compress and writes IDAT chunk data} +procedure TChunkIDAT.IDATZlibWrite(var ZLIBStream: TZStreamRec2; + Buffer: Pointer; const Length: Cardinal); +begin + with ZLIBStream, ZLIBStream.ZLIB do + begin + {Set data to be compressed} + next_in := Buffer; + avail_in := Length; + + {Compress all the data avaliable to compress} + while avail_in > 0 do + begin + deflate(ZLIB, Z_NO_FLUSH); + + {The whole buffer was used, save data to stream and restore buffer} + if avail_out = 0 then + begin + {Writes this IDAT chunk} + WriteIDAT(fStream, Data, ZLIBAllocate); + + {Restore buffer} + next_out := Data; + avail_out := ZLIBAllocate; + end {if avail_out = 0}; + + end {while avail_in}; + + end {with ZLIBStream, ZLIBStream.ZLIB} +end; + +{Finishes compressing data to write IDAT chunk} +procedure TChunkIDAT.FinishIDATZlib(var ZLIBStream: TZStreamRec2); +begin + with ZLIBStream, ZLIBStream.ZLIB do + begin + {Set data to be compressed} + next_in := nil; + avail_in := 0; + + while deflate(ZLIB,Z_FINISH) <> Z_STREAM_END do + begin + {Writes this IDAT chunk} + WriteIDAT(fStream, Data, ZLIBAllocate - avail_out); + {Re-update buffer} + next_out := Data; + avail_out := ZLIBAllocate; + end; + + if avail_out < ZLIBAllocate then + {Writes final IDAT} + WriteIDAT(fStream, Data, ZLIBAllocate - avail_out); + + end {with ZLIBStream, ZLIBStream.ZLIB}; +end; + +{Copy memory to encode RGB image with 1 byte for each color sample} +procedure TChunkIDAT.EncodeNonInterlacedRGB8(Src, Dest, Trans: pChar); +var + I: Integer; +begin + FOR I := 1 TO ImageWidth DO + begin + {Copy pixel values} + Byte(Dest^) := fOwner.InverseGamma[pByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := fOwner.InverseGamma[pByte(Longint(Src) + 1)^]; inc(Dest); + Byte(Dest^) := fOwner.InverseGamma[pByte(Longint(Src) )^]; inc(Dest); + {Move to next pixel} + inc(Src, 3); + end {for I} +end; + +{Copy memory to encode RGB images with 16 bits for each color sample} +procedure TChunkIDAT.EncodeNonInterlacedRGB16(Src, Dest, Trans: pChar); +var + I: Integer; +begin + FOR I := 1 TO ImageWidth DO + begin + //Now we copy from 1 byte for each sample stored to a 2 bytes (or 1 word) + //for sample + {Copy pixel values} + pWORD(Dest)^ := fOwner.InverseGamma[pByte(Longint(Src) + 2)^]; inc(Dest, 2); + pWORD(Dest)^ := fOwner.InverseGamma[pByte(Longint(Src) + 1)^]; inc(Dest, 2); + pWORD(Dest)^ := fOwner.InverseGamma[pByte(Longint(Src) )^]; inc(Dest, 2); + {Move to next pixel} + inc(Src, 3); + end {for I} + +end; + +{Copy memory to encode types using palettes (1, 4 or 8 bits per pixel)} +procedure TChunkIDAT.EncodeNonInterlacedPalette148(Src, Dest, Trans: pChar); +begin + {It's simple as copying the data} + CopyMemory(Dest, Src, Row_Bytes); +end; + +{Copy memory to encode grayscale images with 2 bytes for each sample} +procedure TChunkIDAT.EncodeNonInterlacedGrayscale16(Src, Dest, Trans: pChar); +var + I: Integer; +begin + FOR I := 1 TO ImageWidth DO + begin + //Now we copy from 1 byte for each sample stored to a 2 bytes (or 1 word) + //for sample + pWORD(Dest)^ := pByte(Longint(Src))^; inc(Dest, 2); + {Move to next pixel} + inc(Src); + end {for I} +end; + +{Encode images using RGB followed by an alpha value using 1 byte for each} +procedure TChunkIDAT.EncodeNonInterlacedRGBAlpha8(Src, Dest, Trans: pChar); +var + i: Integer; +begin + {Copy the data to the destination, including data from Trans pointer} + FOR i := 1 TO ImageWidth do + begin + Byte(Dest^) := Owner.InverseGamma[PByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := Owner.InverseGamma[PByte(Longint(Src) + 1)^]; inc(Dest); + Byte(Dest^) := Owner.InverseGamma[PByte(Longint(Src) )^]; inc(Dest); + Dest^ := Trans^; inc(Dest); + inc(Src, 3); inc(Trans); + end {for i}; +end; + +{Encode images using RGB followed by an alpha value using 2 byte for each} +procedure TChunkIDAT.EncodeNonInterlacedRGBAlpha16(Src, Dest, Trans: pChar); +var + i: Integer; +begin + {Copy the data to the destination, including data from Trans pointer} + FOR i := 1 TO ImageWidth do + begin + pWord(Dest)^ := Owner.InverseGamma[PByte(Longint(Src) + 2)^]; inc(Dest, 2); + pWord(Dest)^ := Owner.InverseGamma[PByte(Longint(Src) + 1)^]; inc(Dest, 2); + pWord(Dest)^ := Owner.InverseGamma[PByte(Longint(Src) )^]; inc(Dest, 2); + pWord(Dest)^ := PByte(Longint(Trans) )^; inc(Dest, 2); + inc(Src, 3); inc(Trans); + end {for i}; +end; + +{Encode grayscale images followed by an alpha value using 1 byte for each} +procedure TChunkIDAT.EncodeNonInterlacedGrayscaleAlpha8( + Src, Dest, Trans: pChar); +var + i: Integer; +begin + {Copy the data to the destination, including data from Trans pointer} + FOR i := 1 TO ImageWidth do + begin + Dest^ := Src^; inc(Dest); + Dest^ := Trans^; inc(Dest); + inc(Src); inc(Trans); + end {for i}; +end; + +{Encode grayscale images followed by an alpha value using 2 byte for each} +procedure TChunkIDAT.EncodeNonInterlacedGrayscaleAlpha16( + Src, Dest, Trans: pChar); +var + i: Integer; +begin + {Copy the data to the destination, including data from Trans pointer} + FOR i := 1 TO ImageWidth do + begin + pWord(Dest)^ := pByte(Src)^; inc(Dest, 2); + pWord(Dest)^ := pByte(Trans)^; inc(Dest, 2); + inc(Src); inc(Trans); + end {for i}; +end; + +{Encode non interlaced images} +procedure TChunkIDAT.EncodeNonInterlaced(Stream: TStream; + var ZLIBStream: TZStreamRec2); +var + {Current line} + j: Cardinal; + {Pointers to image data} + Data, Trans: PChar; + {Filter used for this line} + Filter: Byte; + {Method which will copy the data into the buffer} + CopyProc: procedure(Src, Dest, Trans: pChar) of object; +begin + CopyProc := nil; {Initialize to avoid warnings} + {Defines the method to copy the data to the buffer depending on} + {the image parameters} + case Header.ColorType of + {R, G, B values} + COLOR_RGB: + case Header.BitDepth of + 8: CopyProc := EncodeNonInterlacedRGB8; + 16: CopyProc := EncodeNonInterlacedRGB16; + end; + {Palette and grayscale values} + COLOR_GRAYSCALE, COLOR_PALETTE: + case Header.BitDepth of + 1, 4, 8: CopyProc := EncodeNonInterlacedPalette148; + 16: CopyProc := EncodeNonInterlacedGrayscale16; + end; + {RGB with a following alpha value} + COLOR_RGBALPHA: + case Header.BitDepth of + 8: CopyProc := EncodeNonInterlacedRGBAlpha8; + 16: CopyProc := EncodeNonInterlacedRGBAlpha16; + end; + {Grayscale images followed by an alpha} + COLOR_GRAYSCALEALPHA: + case Header.BitDepth of + 8: CopyProc := EncodeNonInterlacedGrayscaleAlpha8; + 16: CopyProc := EncodeNonInterlacedGrayscaleAlpha16; + end; + end {case Header.ColorType}; + + {Get the image data pointer} + Longint(Data) := Longint(Header.ImageData) + + Header.BytesPerRow * (ImageHeight - 1); + Trans := Header.ImageAlpha; + + {Writes each line} + FOR j := 0 to ImageHeight - 1 do + begin + {Copy data into buffer} + CopyProc(Data, @Encode_Buffer[BUFFER][0], Trans); + {Filter data} + Filter := FilterToEncode; + + {Compress data} + IDATZlibWrite(ZLIBStream, @Filter, 1); + IDATZlibWrite(ZLIBStream, @Encode_Buffer[Filter][0], Row_Bytes); + + {Adjust pointers to the actual image data} + dec(Data, Header.BytesPerRow); + inc(Trans, ImageWidth); + end; + + {Compress and finishes copying the remaining data} + FinishIDATZlib(ZLIBStream); +end; + +{Copy memory to encode interlaced images using RGB value with 1 byte for} +{each color sample} +procedure TChunkIDAT.EncodeInterlacedRGB8(const Pass: Byte; + Src, Dest, Trans: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Src := pChar(Longint(Src) + Col * 3); + repeat + {Copy this row} + Byte(Dest^) := fOwner.InverseGamma[pByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := fOwner.InverseGamma[pByte(Longint(Src) + 1)^]; inc(Dest); + Byte(Dest^) := fOwner.InverseGamma[pByte(Longint(Src) )^]; inc(Dest); + + {Move to next column} + inc(Src, ColumnIncrement[Pass] * 3); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Copy memory to encode interlaced RGB images with 2 bytes each color sample} +procedure TChunkIDAT.EncodeInterlacedRGB16(const Pass: Byte; + Src, Dest, Trans: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Src := pChar(Longint(Src) + Col * 3); + repeat + {Copy this row} + pWord(Dest)^ := Owner.InverseGamma[pByte(Longint(Src) + 2)^]; inc(Dest, 2); + pWord(Dest)^ := Owner.InverseGamma[pByte(Longint(Src) + 1)^]; inc(Dest, 2); + pWord(Dest)^ := Owner.InverseGamma[pByte(Longint(Src) )^]; inc(Dest, 2); + + {Move to next column} + inc(Src, ColumnIncrement[Pass] * 3); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Copy memory to encode interlaced images using palettes using bit depths} +{1, 4, 8 (each pixel in the image)} +procedure TChunkIDAT.EncodeInterlacedPalette148(const Pass: Byte; + Src, Dest, Trans: pChar); +const + BitTable: Array[1..8] of Integer = ($1, $3, 0, $F, 0, 0, 0, $FF); + StartBit: Array[1..8] of Integer = (7 , 0 , 0, 4, 0, 0, 0, 0); +var + CurBit, Col: Integer; + Src2: PChar; +begin + {Clean the line} + fillchar(Dest^, Row_Bytes, #0); + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + with Header.BitmapInfo.bmiHeader do + repeat + {Copy data} + CurBit := StartBit[biBitCount]; + repeat + {Adjust pointer to pixel byte bounds} + Src2 := pChar(Longint(Src) + (biBitCount * Col) div 8); + {Copy data} + Byte(Dest^) := Byte(Dest^) or + (((Byte(Src2^) shr (StartBit[Header.BitDepth] - (biBitCount * Col) + mod 8))) and (BitTable[biBitCount])) shl CurBit; + + {Move to next column} + inc(Col, ColumnIncrement[Pass]); + {Will read next bits} + dec(CurBit, biBitCount); + until CurBit < 0; + + {Move to next byte in source} + inc(Dest); + until Col >= ImageWidth; +end; + +{Copy to encode interlaced grayscale images using 16 bits for each sample} +procedure TChunkIDAT.EncodeInterlacedGrayscale16(const Pass: Byte; + Src, Dest, Trans: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Src := pChar(Longint(Src) + Col); + repeat + {Copy this row} + pWord(Dest)^ := Byte(Src^); inc(Dest, 2); + + {Move to next column} + inc(Src, ColumnIncrement[Pass]); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Copy to encode interlaced rgb images followed by an alpha value, all using} +{one byte for each sample} +procedure TChunkIDAT.EncodeInterlacedRGBAlpha8(const Pass: Byte; + Src, Dest, Trans: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Src := pChar(Longint(Src) + Col * 3); + Trans := pChar(Longint(Trans) + Col); + repeat + {Copy this row} + Byte(Dest^) := Owner.InverseGamma[pByte(Longint(Src) + 2)^]; inc(Dest); + Byte(Dest^) := Owner.InverseGamma[pByte(Longint(Src) + 1)^]; inc(Dest); + Byte(Dest^) := Owner.InverseGamma[pByte(Longint(Src) )^]; inc(Dest); + Dest^ := Trans^; inc(Dest); + + {Move to next column} + inc(Src, ColumnIncrement[Pass] * 3); + inc(Trans, ColumnIncrement[Pass]); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Copy to encode interlaced rgb images followed by an alpha value, all using} +{two byte for each sample} +procedure TChunkIDAT.EncodeInterlacedRGBAlpha16(const Pass: Byte; + Src, Dest, Trans: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Src := pChar(Longint(Src) + Col * 3); + Trans := pChar(Longint(Trans) + Col); + repeat + {Copy this row} + pWord(Dest)^ := pByte(Longint(Src) + 2)^; inc(Dest, 2); + pWord(Dest)^ := pByte(Longint(Src) + 1)^; inc(Dest, 2); + pWord(Dest)^ := pByte(Longint(Src) )^; inc(Dest, 2); + pWord(Dest)^ := pByte(Trans)^; inc(Dest, 2); + + {Move to next column} + inc(Src, ColumnIncrement[Pass] * 3); + inc(Trans, ColumnIncrement[Pass]); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Copy to encode grayscale interlaced images followed by an alpha value, all} +{using 1 byte for each sample} +procedure TChunkIDAT.EncodeInterlacedGrayscaleAlpha8(const Pass: Byte; + Src, Dest, Trans: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Src := pChar(Longint(Src) + Col); + Trans := pChar(Longint(Trans) + Col); + repeat + {Copy this row} + Dest^ := Src^; inc(Dest); + Dest^ := Trans^; inc(Dest); + + {Move to next column} + inc(Src, ColumnIncrement[Pass]); + inc(Trans, ColumnIncrement[Pass]); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Copy to encode grayscale interlaced images followed by an alpha value, all} +{using 2 bytes for each sample} +procedure TChunkIDAT.EncodeInterlacedGrayscaleAlpha16(const Pass: Byte; + Src, Dest, Trans: pChar); +var + Col: Integer; +begin + {Get first column and enter in loop} + Col := ColumnStart[Pass]; + Src := pChar(Longint(Src) + Col); + Trans := pChar(Longint(Trans) + Col); + repeat + {Copy this row} + pWord(Dest)^ := pByte(Src)^; inc(Dest, 2); + pWord(Dest)^ := pByte(Trans)^; inc(Dest, 2); + + {Move to next column} + inc(Src, ColumnIncrement[Pass]); + inc(Trans, ColumnIncrement[Pass]); + inc(Col, ColumnIncrement[Pass]); + until Col >= ImageWidth; +end; + +{Encode interlaced images} +procedure TChunkIDAT.EncodeInterlacedAdam7(Stream: TStream; + var ZLIBStream: TZStreamRec2); +var + CurrentPass, Filter: Byte; + PixelsThisRow: Integer; + CurrentRow : Integer; + Trans, Data: pChar; + CopyProc: procedure(const Pass: Byte; + Src, Dest, Trans: pChar) of object; +begin + CopyProc := nil; {Initialize to avoid warnings} + {Defines the method to copy the data to the buffer depending on} + {the image parameters} + case Header.ColorType of + {R, G, B values} + COLOR_RGB: + case Header.BitDepth of + 8: CopyProc := EncodeInterlacedRGB8; + 16: CopyProc := EncodeInterlacedRGB16; + end; + {Grayscale and palette} + COLOR_PALETTE, COLOR_GRAYSCALE: + case Header.BitDepth of + 1, 4, 8: CopyProc := EncodeInterlacedPalette148; + 16: CopyProc := EncodeInterlacedGrayscale16; + end; + {RGB followed by alpha} + COLOR_RGBALPHA: + case Header.BitDepth of + 8: CopyProc := EncodeInterlacedRGBAlpha8; + 16: CopyProc := EncodeInterlacedRGBAlpha16; + end; + COLOR_GRAYSCALEALPHA: + {Grayscale followed by alpha} + case Header.BitDepth of + 8: CopyProc := EncodeInterlacedGrayscaleAlpha8; + 16: CopyProc := EncodeInterlacedGrayscaleAlpha16; + end; + end {case Header.ColorType}; + + {Compress the image using the seven passes for ADAM 7} + FOR CurrentPass := 0 TO 6 DO + begin + {Calculates the number of pixels and bytes for this pass row} + PixelsThisRow := (ImageWidth - ColumnStart[CurrentPass] + + ColumnIncrement[CurrentPass] - 1) div ColumnIncrement[CurrentPass]; + Row_Bytes := BytesForPixels(PixelsThisRow, Header.ColorType, + Header.BitDepth); + ZeroMemory(Encode_Buffer[FILTER_NONE], Row_Bytes); + + {Get current row index} + CurrentRow := RowStart[CurrentPass]; + {Get a pointer to the current row image data} + Data := Ptr(Longint(Header.ImageData) + Header.BytesPerRow * + (ImageHeight - 1 - CurrentRow)); + Trans := Ptr(Longint(Header.ImageAlpha) + ImageWidth * CurrentRow); + + {Process all the image rows} + if Row_Bytes > 0 then + while CurrentRow < ImageHeight do + begin + {Copy data into buffer} + CopyProc(CurrentPass, Data, @Encode_Buffer[BUFFER][0], Trans); + {Filter data} + Filter := FilterToEncode; + + {Compress data} + IDATZlibWrite(ZLIBStream, @Filter, 1); + IDATZlibWrite(ZLIBStream, @Encode_Buffer[Filter][0], Row_Bytes); + + {Move to the next row} + inc(CurrentRow, RowIncrement[CurrentPass]); + {Move pointer to the next line} + dec(Data, RowIncrement[CurrentPass] * Header.BytesPerRow); + inc(Trans, RowIncrement[CurrentPass] * ImageWidth); + end {while CurrentRow < ImageHeight} + + end {CurrentPass}; + + {Compress and finishes copying the remaining data} + FinishIDATZlib(ZLIBStream); +end; + +{Filters the row to be encoded and returns the best filter} +function TChunkIDAT.FilterToEncode: Byte; +var + Run, LongestRun, ii, jj: Cardinal; + Last, Above, LastAbove: Byte; +begin + {Selecting more filters using the Filters property from TPngObject} + {increases the chances to the file be much smaller, but decreases} + {the performace} + + {This method will creates the same line data using the different} + {filter methods and select the best} + + {Sub-filter} + if pfSub in Owner.Filters then + for ii := 0 to Row_Bytes - 1 do + begin + {There is no previous pixel when it's on the first pixel, so} + {set last as zero when in the first} + if (ii >= Offset) then + last := Encode_Buffer[BUFFER]^[ii - Offset] + else + last := 0; + Encode_Buffer[FILTER_SUB]^[ii] := Encode_Buffer[BUFFER]^[ii] - last; + end; + + {Up filter} + if pfUp in Owner.Filters then + for ii := 0 to Row_Bytes - 1 do + Encode_Buffer[FILTER_UP]^[ii] := Encode_Buffer[BUFFER]^[ii] - + Encode_Buffer[FILTER_NONE]^[ii]; + + {Average filter} + if pfAverage in Owner.Filters then + for ii := 0 to Row_Bytes - 1 do + begin + {Get the previous pixel, if the current pixel is the first, the} + {previous is considered to be 0} + if (ii >= Offset) then + last := Encode_Buffer[BUFFER]^[ii - Offset] + else + last := 0; + {Get the pixel above} + above := Encode_Buffer[FILTER_NONE]^[ii]; + + {Calculates formula to the average pixel} + Encode_Buffer[FILTER_AVERAGE]^[ii] := Encode_Buffer[BUFFER]^[ii] - + (above + last) div 2 ; + end; + + {Paeth filter (the slower)} + if pfPaeth in Owner.Filters then + begin + {Initialize} + last := 0; + lastabove := 0; + for ii := 0 to Row_Bytes - 1 do + begin + {In case this pixel is not the first in the line obtains the} + {previous one and the one above the previous} + if (ii >= Offset) then + begin + last := Encode_Buffer[BUFFER]^[ii - Offset]; + lastabove := Encode_Buffer[FILTER_NONE]^[ii - Offset]; + end; + {Obtains the pixel above} + above := Encode_Buffer[FILTER_NONE]^[ii]; + {Calculate paeth filter for this byte} + Encode_Buffer[FILTER_PAETH]^[ii] := Encode_Buffer[BUFFER]^[ii] - + PaethPredictor(last, above, lastabove); + end; + end; + + {Now calculates the same line using no filter, which is necessary} + {in order to have data to the filters when the next line comes} + CopyMemory(@Encode_Buffer[FILTER_NONE]^[0], + @Encode_Buffer[BUFFER]^[0], Row_Bytes); + + {If only filter none is selected in the filter list, we don't need} + {to proceed and further} + if (Owner.Filters = [pfNone]) or (Owner.Filters = []) then + begin + Result := FILTER_NONE; + exit; + end {if (Owner.Filters = [pfNone...}; + + {Check which filter is the best by checking which has the larger} + {sequence of the same byte, since they are best compressed} + LongestRun := 0; Result := FILTER_NONE; + for ii := FILTER_NONE TO FILTER_PAETH do + {Check if this filter was selected} + if TFilter(ii) in Owner.Filters then + begin + Run := 0; + {Check if it's the only filter} + if Owner.Filters = [TFilter(ii)] then + begin + Result := ii; + exit; + end; + + {Check using a sequence of four bytes} + for jj := 2 to Row_Bytes - 1 do + if (Encode_Buffer[ii]^[jj] = Encode_Buffer [ii]^[jj-1]) or + (Encode_Buffer[ii]^[jj] = Encode_Buffer [ii]^[jj-2]) then + inc(Run); {Count the number of sequences} + + {Check if this one is the best so far} + if (Run > LongestRun) then + begin + Result := ii; + LongestRun := Run; + end {if (Run > LongestRun)}; + + end {if TFilter(ii) in Owner.Filters}; +end; + +{TChunkPLTE implementation} + +{Returns an item in the palette} +function TChunkPLTE.GetPaletteItem(Index: Byte): TRGBQuad; +begin + {Test if item is valid, if not raise error} + if Index > Count - 1 then + Owner.RaiseError(EPNGError, EPNGUnknownPalEntryText) + else + {Returns the item} + Result := Header.BitmapInfo.bmiColors[Index]; +end; + +{Loads the palette chunk from a stream} +function TChunkPLTE.LoadFromStream(Stream: TStream; + const ChunkName: TChunkName; Size: Integer): Boolean; +type + pPalEntry = ^PalEntry; + PalEntry = record r, g, b: Byte end; +var + j : Integer; {For the FOR} + PalColor : pPalEntry; +begin + {Let ancestor load data and check CRC} + Result := inherited LoadFromStream(Stream, ChunkName, Size); + if not Result then exit; + + {This chunk must be divisible by 3 in order to be valid} + if (Size mod 3 <> 0) or (Size div 3 > 256) then + begin + {Raise error} + Result := FALSE; + Owner.RaiseError(EPNGInvalidPalette, EPNGInvalidPaletteText); + exit; + end {if Size mod 3 <> 0}; + + {Fill array with the palette entries} + fCount := Size div 3; + PalColor := Data; + FOR j := 0 TO fCount - 1 DO + with Header.BitmapInfo.bmiColors[j] do + begin + rgbRed := Owner.GammaTable[PalColor.r]; + rgbGreen := Owner.GammaTable[PalColor.g]; + rgbBlue := Owner.GammaTable[PalColor.b]; + rgbReserved := 0; + inc(PalColor); {Move to next palette entry} + end; +end; + +{Saves the PLTE chunk to a stream} +function TChunkPLTE.SaveToStream(Stream: TStream): Boolean; +var + J: Integer; + DataPtr: pByte; +begin + {Adjust size to hold all the palette items} + ResizeData(fCount * 3); + {Copy pointer to data} + DataPtr := fData; + + {Copy palette items} + with Header do + FOR j := 0 TO fCount - 1 DO + with BitmapInfo.bmiColors[j] do + begin + DataPtr^ := Owner.InverseGamma[rgbRed]; inc(DataPtr); + DataPtr^ := Owner.InverseGamma[rgbGreen]; inc(DataPtr); + DataPtr^ := Owner.InverseGamma[rgbBlue]; inc(DataPtr); + end {with BitmapInfo}; + + {Let ancestor do the rest of the work} + Result := inherited SaveToStream(Stream); +end; + +{Assigns from another PLTE chunk} +procedure TChunkPLTE.Assign(Source: TChunk); +begin + {Copy the number of palette items} + if Source is TChunkPLTE then + fCount := TChunkPLTE(Source).fCount + else + Owner.RaiseError(EPNGError, EPNGCannotAssignChunkText); +end; + +{TChunkgAMA implementation} + +{Assigns from another chunk} +procedure TChunkgAMA.Assign(Source: TChunk); +begin + {Copy the gamma value} + if Source is TChunkgAMA then + Gamma := TChunkgAMA(Source).Gamma + else + Owner.RaiseError(EPNGError, EPNGCannotAssignChunkText); +end; + +{Gamma chunk being created} +constructor TChunkgAMA.Create(Owner: TPngObject); +begin + {Call ancestor} + inherited Create(Owner); + Gamma := 1; {Initial value} +end; + +{Returns gamma value} +function TChunkgAMA.GetValue: Cardinal; +begin + {Make sure that the size is four bytes} + if DataSize <> 4 then + begin + {Adjust size and returns 1} + ResizeData(4); + Result := 1; + end + {If it's right, read the value} + else Result := Cardinal(ByteSwap(pCardinal(Data)^)) +end; + +function Power(Base, Exponent: Extended): Extended; +begin + if Exponent = 0.0 then + Result := 1.0 {Math rule} + else if (Base = 0) or (Exponent = 0) then Result := 0 + else + Result := Exp(Exponent * Ln(Base)); +end; + + +{Loading the chunk from a stream} +function TChunkgAMA.LoadFromStream(Stream: TStream; + const ChunkName: TChunkName; Size: Integer): Boolean; +var + i: Integer; + Value: Cardinal; +begin + {Call ancestor and test if it went ok} + Result := inherited LoadFromStream(Stream, ChunkName, Size); + if not Result then exit; + Value := Gamma; + {Build gamma table and inverse table for saving} + if Value <> 0 then + with Owner do + FOR i := 0 TO 255 DO + begin + GammaTable[I] := Round(Power((I / 255), 1 / + (Value / 100000 * 2.2)) * 255); + InverseGamma[Round(Power((I / 255), 1 / + (Value / 100000 * 2.2)) * 255)] := I; + end +end; + +{Sets the gamma value} +procedure TChunkgAMA.SetValue(const Value: Cardinal); +begin + {Make sure that the size is four bytes} + if DataSize <> 4 then ResizeData(4); + {If it's right, set the value} + pCardinal(Data)^ := ByteSwap(Value); +end; + +{TPngObject implementation} + +{Assigns from another object} +procedure TPngObject.Assign(Source: TPersistent); +begin + {Assigns contents from another TPNGObject} + if Source is TPNGObject then + AssignPNG(Source as TPNGObject) + {Copy contents from a TBitmap} + {$IFDEF UseDelphi}else if Source is TBitmap then + with Source as TBitmap do + AssignHandle(Handle, Transparent, + ColorToRGB(TransparentColor)){$ENDIF} + {Unknown source, let ancestor deal with it} + else + inherited; +end; + +{Clear all the chunks in the list} +procedure TPngObject.ClearChunks; +var + i: Integer; +begin + {Initialize gamma} + InitializeGamma(); + {Free all the objects and memory (0 chunks Bug fixed by Noel Sharpe)} + for i := 0 TO Integer(Chunks.Count) - 1 do + TChunk(Chunks.Item[i]).Free; + Chunks.Count := 0; +end; + +{Portable Network Graphics object being created} +constructor TPngObject.Create; +begin + {Let it be created} + inherited Create; + + {Initial properties} + TempPalette := 0; + fFilters := [pfSub]; + fCompressionLevel := 7; + fInterlaceMethod := imNone; + fMaxIdatSize := High(Word); + {Create chunklist object} + fChunkList := TPngList.Create(Self); +end; + +{Portable Network Graphics object being destroyed} +destructor TPngObject.Destroy; +begin + {Free object list} + ClearChunks; + fChunkList.Free; + {Free the temporary palette} + if TempPalette <> 0 then DeleteObject(TempPalette); + + {Call ancestor destroy} + inherited Destroy; +end; + +{Returns linesize and byte offset for pixels} +procedure TPngObject.GetPixelInfo(var LineSize, Offset: Cardinal); +begin + {There must be an Header chunk to calculate size} + if HeaderPresent then + begin + {Calculate number of bytes for each line} + LineSize := BytesForPixels(Header.Width, Header.ColorType, Header.BitDepth); + + {Calculates byte offset} + Case Header.ColorType of + {Grayscale} + COLOR_GRAYSCALE: + If Header.BitDepth = 16 Then + Offset := 2 + Else + Offset := 1 ; + {It always smaller or equal one byte, so it occupes one byte} + COLOR_PALETTE: + offset := 1; + {It might be 3 or 6 bytes} + COLOR_RGB: + offset := 3 * Header.BitDepth Div 8; + {It might be 2 or 4 bytes} + COLOR_GRAYSCALEALPHA: + offset := 2 * Header.BitDepth Div 8; + {4 or 8 bytes} + COLOR_RGBALPHA: + offset := 4 * Header.BitDepth Div 8; + else + Offset := 0; + End ; + + end + else + begin + {In case if there isn't any Header chunk} + Offset := 0; + LineSize := 0; + end; + +end; + +{Returns image height} +function TPngObject.GetHeight: Integer; +begin + {There must be a Header chunk to get the size, otherwise returns 0} + if HeaderPresent then + Result := TChunkIHDR(Chunks.Item[0]).Height + else Result := 0; +end; + +{Returns image width} +function TPngObject.GetWidth: Integer; +begin + {There must be a Header chunk to get the size, otherwise returns 0} + if HeaderPresent then + Result := Header.Width + else Result := 0; +end; + +{Returns if the image is empty} +function TPngObject.GetEmpty: Boolean; +begin + Result := (Chunks.Count = 0); +end; + +{Raises an error} +procedure TPngObject.RaiseError(ExceptionClass: ExceptClass; Text: String); +begin + raise ExceptionClass.Create(Text); +end; + +{Set the maximum size for IDAT chunk} +procedure TPngObject.SetMaxIdatSize(const Value: Cardinal); +begin + {Make sure the size is at least 65535} + if Value < High(Word) then + fMaxIdatSize := High(Word) else fMaxIdatSize := Value; +end; + +{$IFNDEF UseDelphi} + {Creates a file stream reading from the filename in the parameter and load} + procedure TPngObject.LoadFromFile(const Filename: String); + var + FileStream: TFileStream; + begin + {Test if the file exists} + if not FileExists(Filename) then + begin + {In case it does not exists, raise error} + RaiseError(EPNGNotExists, EPNGNotExistsText); + exit; + end; + + {Creates the file stream to read} + FileStream := TFileStream.Create(Filename, [fsmRead]); + LoadFromStream(FileStream); {Loads the data} + FileStream.Free; {Free file stream} + end; + + {Saves the current png image to a file} + procedure TPngObject.SaveToFile(const Filename: String); + var + FileStream: TFileStream; + begin + {Creates the file stream to write} + FileStream := TFileStream.Create(Filename, [fsmWrite]); + SaveToStream(FileStream); {Saves the data} + FileStream.Free; {Free file stream} + end; + +{$ENDIF} + +{Returns pointer to the chunk TChunkIHDR which should be the first} +function TPngObject.GetHeader: TChunkIHDR; +begin + {If there is a TChunkIHDR returns it, otherwise returns nil} + if (Chunks.Count <> 0) and (Chunks.Item[0] is TChunkIHDR) then + Result := Chunks.Item[0] as TChunkIHDR + else + begin + {No header, throw error message} + RaiseError(EPNGHeaderNotPresent, EPNGHeaderNotPresentText); + Result := nil + end +end; + +{Draws using partial transparency} +procedure TPngObject.DrawPartialTrans(DC: HDC; Rect: TRect); +type + {Access to pixels} + TPixelLine = Array[Word] of TRGBQuad; + pPixelLine = ^TPixelLine; +const + {Structure used to create the bitmap} + BitmapInfoHeader: TBitmapInfoHeader = + (biSize: sizeof(TBitmapInfoHeader); + biWidth: 100; + biHeight: 100; + biPlanes: 1; + biBitCount: 32; + biCompression: BI_RGB; + biSizeImage: 0; + biXPelsPerMeter: 0; + biYPelsPerMeter: 0; + biClrUsed: 0; + biClrImportant: 0); +var + {Buffer bitmap creation} + BitmapInfo : TBitmapInfo; + BufferDC : HDC; + BufferBits : Pointer; + OldBitmap, + BufferBitmap: HBitmap; + + {Transparency/palette chunks} + TransparencyChunk: TChunktRNS; + PaletteChunk: TChunkPLTE; + TransValue, PaletteIndex: Byte; + CurBit: Integer; + Data: PByte; + + {Buffer bitmap modification} + BytesPerRowDest, + BytesPerRowSrc, + BytesPerRowAlpha: Integer; + ImageSource, + AlphaSource : pByteArray; + ImageData : pPixelLine; + i, j : Integer; +begin + {Prepare to create the bitmap} + Fillchar(BitmapInfo, sizeof(BitmapInfo), #0); + BitmapInfoHeader.biWidth := Header.Width; + BitmapInfoHeader.biHeight := -1 * Header.Height; + BitmapInfo.bmiHeader := BitmapInfoHeader; + + {Create the bitmap which will receive the background, the applied} + {alpha blending and then will be painted on the background} + BufferDC := CreateCompatibleDC(0); + {In case BufferDC could not be created} + if (BufferDC = 0) then RaiseError(EPNGOutMemory, EPNGOutMemoryText); + BufferBitmap := CreateDIBSection(BufferDC, BitmapInfo, DIB_RGB_COLORS, + BufferBits, 0, 0); + {In case buffer bitmap could not be created} + if (BufferBitmap = 0) or (BufferBits = Nil) then + begin + if BufferBitmap <> 0 then DeleteObject(BufferBitmap); + DeleteDC(BufferDC); + RaiseError(EPNGOutMemory, EPNGOutMemoryText); + end; + + {Selects new bitmap and release old bitmap} + OldBitmap := SelectObject(BufferDC, BufferBitmap); + + {Draws the background on the buffer image} + StretchBlt(BufferDC, 0, 0, Header.Width, Header.height, DC, Rect.Left, + Rect.Top, Header.Width, Header.Height, SRCCOPY); + + {Obtain number of bytes for each row} + BytesPerRowAlpha := Header.Width; + BytesPerRowDest := (((BitmapInfo.bmiHeader.biBitCount * Width) + 31) + and not 31) div 8; {Number of bytes for each image row in destination} + BytesPerRowSrc := (((Header.BitmapInfo.bmiHeader.biBitCount * Header.Width) + + 31) and not 31) div 8; {Number of bytes for each image row in source} + + {Obtains image pointers} + ImageData := BufferBits; + AlphaSource := Header.ImageAlpha; + Longint(ImageSource) := Longint(Header.ImageData) + + Header.BytesPerRow * Longint(Header.Height - 1); + + case Header.BitmapInfo.bmiHeader.biBitCount of + {R, G, B images} + 24: + FOR j := 1 TO Header.Height DO + begin + {Process all the pixels in this line} + FOR i := 0 TO Header.Width - 1 DO + with ImageData[i] do + begin + rgbRed := (255+ImageSource[2+i*3] * AlphaSource[i] + rgbRed * (255 - + AlphaSource[i])) shr 8; + rgbGreen := (255+ImageSource[1+i*3] * AlphaSource[i] + rgbGreen * + (255 - AlphaSource[i])) shr 8; + rgbBlue := (255+ImageSource[i*3] * AlphaSource[i] + rgbBlue * + (255 - AlphaSource[i])) shr 8; + end; + + {Move pointers} + Longint(ImageData) := Longint(ImageData) + BytesPerRowDest; + Longint(ImageSource) := Longint(ImageSource) - BytesPerRowSrc; + Longint(AlphaSource) := Longint(AlphaSource) + BytesPerRowAlpha; + end; + {Palette images with 1 byte for each pixel} + 1,4,8: if Header.ColorType = COLOR_GRAYSCALEALPHA then + FOR j := 1 TO Header.Height DO + begin + {Process all the pixels in this line} + FOR i := 0 TO Header.Width - 1 DO + with ImageData[i], Header.BitmapInfo do begin + rgbRed := (255 + ImageSource[i] * AlphaSource[i] + + rgbRed * (255 - AlphaSource[i])) shr 8; + rgbGreen := (255 + ImageSource[i] * AlphaSource[i] + + rgbGreen * (255 - AlphaSource[i])) shr 8; + rgbBlue := (255 + ImageSource[i] * AlphaSource[i] + + rgbBlue * (255 - AlphaSource[i])) shr 8; + end; + + {Move pointers} + Longint(ImageData) := Longint(ImageData) + BytesPerRowDest; + Longint(ImageSource) := Longint(ImageSource) - BytesPerRowSrc; + Longint(AlphaSource) := Longint(AlphaSource) + BytesPerRowAlpha; + end + else {Palette images} + begin + {Obtain pointer to the transparency chunk} + TransparencyChunk := TChunktRNS(Chunks.ItemFromClass(TChunktRNS)); + PaletteChunk := TChunkPLTE(Chunks.ItemFromClass(TChunkPLTE)); + + FOR j := 1 TO Header.Height DO + begin + {Process all the pixels in this line} + i := 0; Data := @ImageSource[0]; + repeat + CurBit := 0; + + repeat + {Obtains the palette index} + case Header.BitDepth of + 1: PaletteIndex := (Data^ shr (7-(I Mod 8))) and 1; + 2,4: PaletteIndex := (Data^ shr ((1-(I Mod 2))*4)) and $0F; + else PaletteIndex := Data^; + end; + + {Updates the image with the new pixel} + with ImageData[i] do + begin + TransValue := TransparencyChunk.PaletteValues[PaletteIndex]; + rgbRed := (255 + PaletteChunk.Item[PaletteIndex].rgbRed * + TransValue + rgbRed * (255 - TransValue)) shr 8; + rgbGreen := (255 + PaletteChunk.Item[PaletteIndex].rgbGreen * + TransValue + rgbGreen * (255 - TransValue)) shr 8; + rgbBlue := (255 + PaletteChunk.Item[PaletteIndex].rgbBlue * + TransValue + rgbBlue * (255 - TransValue)) shr 8; + end; + + {Move to next data} + inc(i); inc(CurBit, Header.BitmapInfo.bmiHeader.biBitCount); + until CurBit >= 8; + {Move to next source data} + inc(Data); + until i >= Integer(Header.Width); + + {Move pointers} + Longint(ImageData) := Longint(ImageData) + BytesPerRowDest; + Longint(ImageSource) := Longint(ImageSource) - BytesPerRowSrc; + end + end {Palette images} + end {case Header.BitmapInfo.bmiHeader.biBitCount}; + + {Draws the new bitmap on the foreground} + StretchBlt(DC, Rect.Left, Rect.Top, Header.Width, Header.Height, BufferDC, + 0, 0, Header.Width, Header.Height, SRCCOPY); + + {Free bitmap} + SelectObject(BufferDC, OldBitmap); + DeleteObject(BufferBitmap); + DeleteDC(BufferDC); +end; + +{Draws the image into a canvas} +procedure TPngObject.Draw(ACanvas: TCanvas; const Rect: TRect); +var + Header: TChunkIHDR; +begin + {Quit in case there is no header, otherwise obtain it} + if (Chunks.Count = 0) or not (Chunks.GetItem(0) is TChunkIHDR) then Exit; + Header := Chunks.GetItem(0) as TChunkIHDR; + + {Copy the data to the canvas} + case Self.TransparencyMode of + {$IFDEF PartialTransparentDraw} + ptmPartial: + DrawPartialTrans(ACanvas{$IFDEF UseDelphi}.Handle{$ENDIF}, Rect); + {$ENDIF} + ptmBit: DrawTransparentBitmap(ACanvas{$IFDEF UseDelphi}.Handle{$ENDIF}, + Header.ImageData, Header.BitmapInfo.bmiHeader, + pBitmapInfo(@Header.BitmapInfo), Rect, + {$IFDEF UseDelphi}ColorToRGB({$ENDIF}TransparentColor) + {$IFDEF UseDelphi}){$ENDIF} + else + StretchDiBits(ACanvas{$IFDEF UseDelphi}.Handle{$ENDIF}, Rect.Left, + Rect.Top, Rect.Right - Rect.Left, Rect.Bottom - Rect.Top, 0, 0, + Header.Width, Header.Height, Header.ImageData, + pBitmapInfo(@Header.BitmapInfo)^, DIB_RGB_COLORS, SRCCOPY) + end {case} +end; + +{Characters for the header} +const + PngHeader: Array[0..7] of Char = (#137, #80, #78, #71, #13, #10, #26, #10); + +{Loads the image from a stream of data} +procedure TPngObject.LoadFromStream(Stream: TStream); +var + Header : Array[0..7] of Char; + HasIDAT : Boolean; + + {Chunks reading} + ChunkCount : Cardinal; + ChunkLength: Cardinal; + ChunkName : TChunkName; +begin + {Initialize before start loading chunks} + ChunkCount := 0; + ClearChunks(); + {Reads the header} + Stream.Read(Header[0], 8); + + {Test if the header matches} + if Header <> PngHeader then + begin + RaiseError(EPNGInvalidFileHeader, EPNGInvalidFileHeaderText); + Exit; + end; + + + HasIDAT := FALSE; + Chunks.Count := 10; + + {Load chunks} + repeat + inc(ChunkCount); {Increment number of chunks} + if Chunks.Count < ChunkCount then {Resize the chunks list if needed} + Chunks.Count := Chunks.Count + 10; + + {Reads chunk length and invert since it is in network order} + {also checks the Read method return, if it returns 0, it} + {means that no bytes was readed, probably because it reached} + {the end of the file} + if Stream.Read(ChunkLength, 4) = 0 then + begin + {In case it found the end of the file here} + Chunks.Count := ChunkCount - 1; + RaiseError(EPNGUnexpectedEnd, EPNGUnexpectedEndText); + end; + + ChunkLength := ByteSwap(ChunkLength); + {Reads chunk name} + Stream.Read(Chunkname, 4); + + {Here we check if the first chunk is the Header which is necessary} + {to the file in order to be a valid Portable Network Graphics image} + if (ChunkCount = 1) and (ChunkName <> 'IHDR') then + begin + Chunks.Count := ChunkCount - 1; + RaiseError(EPNGIHDRNotFirst, EPNGIHDRNotFirstText); + exit; + end; + + {Has a previous IDAT} + if (HasIDAT and (ChunkName = 'IDAT')) or (ChunkName = 'cHRM') then + begin + dec(ChunkCount); + Stream.Seek(ChunkLength + 4, soFromCurrent); + Continue; + end; + {Tell it has an IDAT chunk} + if ChunkName = 'IDAT' then HasIDAT := TRUE; + + {Creates object for this chunk} + Chunks.SetItem(ChunkCount - 1, CreateClassChunk(Self, ChunkName)); + + {Check if the chunk is critical and unknown} + {$IFDEF ErrorOnUnknownCritical} + if (TChunk(Chunks.Item[ChunkCount - 1]).ClassType = TChunk) and + ((Byte(ChunkName[0]) AND $20) = 0) and (ChunkName <> '') then + begin + Chunks.Count := ChunkCount; + RaiseError(EPNGUnknownCriticalChunk, EPNGUnknownCriticalChunkText); + end; + {$ENDIF} + + {Loads it} + try if not TChunk(Chunks.Item[ChunkCount - 1]).LoadFromStream(Stream, + ChunkName, ChunkLength) then break; + except + Chunks.Count := ChunkCount; + raise; + end; + + {Terminates when it reaches the IEND chunk} + until (ChunkName = 'IEND'); + + {Resize the list to the appropriate size} + Chunks.Count := ChunkCount; + + {Check if there is data} + if not HasIDAT then + RaiseError(EPNGNoImageData, EPNGNoImageDataText); +end; + +{Changing height is not supported} +procedure TPngObject.SetHeight(Value: Integer); +begin + RaiseError(EPNGError, EPNGCannotChangeSizeText); +end; + +{Changing width is not supported} +procedure TPngObject.SetWidth(Value: Integer); +begin + RaiseError(EPNGError, EPNGCannotChangeSizeText); +end; + +{$IFDEF UseDelphi} +{Saves to clipboard format (thanks to Antoine Pottern)} +procedure TPNGObject.SaveToClipboardFormat(var AFormat: Word; + var AData: THandle; var APalette: HPalette); +begin + with TBitmap.Create do + try + Width := Self.Width; + Height := Self.Height; + Self.Draw(Canvas, Rect(0, 0, Width, Height)); + SaveToClipboardFormat(AFormat, AData, APalette); + finally + Free; + end {try} +end; + +{Loads data from clipboard} +procedure TPngObject.LoadFromClipboardFormat(AFormat: Word; + AData: THandle; APalette: HPalette); +begin + with TBitmap.Create do + try + LoadFromClipboardFormat(AFormat, AData, APalette); + Self.AssignHandle(Handle, False, 0); + finally + Free; + end {try} +end; + +{Returns if the image is transparent} +function TPngObject.GetTransparent: Boolean; +begin + Result := (TransparencyMode <> ptmNone); +end; + +{$ENDIF} + +{Saving the PNG image to a stream of data} +procedure TPngObject.SaveToStream(Stream: TStream); +var + j: Integer; +begin + {Reads the header} + Stream.Write(PNGHeader[0], 8); + {Write each chunk} + FOR j := 0 TO Chunks.Count - 1 DO + Chunks.Item[j].SaveToStream(Stream) +end; + +{Prepares the Header chunk} +procedure BuildHeader(Header: TChunkIHDR; Handle: HBitmap; Info: pBitmap; + HasPalette: Boolean); +var + DC: HDC; +begin + {Set width and height} + Header.Width := Info.bmWidth; + Header.Height := abs(Info.bmHeight); + {Set bit depth} + if Info.bmBitsPixel >= 16 then + Header.BitDepth := 8 else Header.BitDepth := Info.bmBitsPixel; + {Set color type} + if Info.bmBitsPixel >= 16 then + Header.ColorType := COLOR_RGB else Header.ColorType := COLOR_PALETTE; + {Set other info} + Header.CompressionMethod := 0; {deflate/inflate} + Header.InterlaceMethod := 0; {no interlace} + + {Prepares bitmap headers to hold data} + Header.PrepareImageData(); + {Copy image data} + DC := CreateCompatibleDC(0); + GetDIBits(DC, Handle, 0, Header.Height, Header.ImageData, + pBitmapInfo(@Header.BitmapInfo)^, DIB_RGB_COLORS); + DeleteDC(DC); +end; + +{Loads the image from a resource} +procedure TPngObject.LoadFromResourceName(Instance: HInst; + const Name: String); +var + ResStream: TResourceStream; +begin + {Creates an especial stream to load from the resource} + try ResStream := TResourceStream.Create(Instance, Name, RT_RCDATA); + except RaiseError(EPNGCouldNotLoadResource, EPNGCouldNotLoadResourceText); + exit; end; + + {Loads the png image from the resource} + try + LoadFromStream(ResStream); + finally + ResStream.Free; + end; +end; + +{Loads the png from a resource ID} +procedure TPngObject.LoadFromResourceID(Instance: HInst; ResID: Integer); +begin + LoadFromResourceName(Instance, String(ResID)); +end; + +{Assigns this tpngobject to another object} +procedure TPngObject.AssignTo(Dest: TPersistent); +{$IFDEF UseDelphi} +var + DeskDC: HDC; + TRNS: TChunkTRNS; +{$ENDIF} +begin + {If the destination is also a TPNGObject make it assign} + {this one} + if Dest is TPNGObject then + TPNGObject(Dest).AssignPNG(Self) + {$IFDEF UseDelphi} + {In case the destination is a bitmap} + else if (Dest is TBitmap) and HeaderPresent then + begin + {Device context} + DeskDC := GetDC(0); + {Copy the data} + TBitmap(Dest).Handle := CreateDIBitmap(DeskDC, + Header.BitmapInfo.bmiHeader, CBM_INIT, Header.ImageData, + pBitmapInfo(@Header.BitmapInfo)^, DIB_RGB_COLORS); + ReleaseDC(0, DeskDC); + {Tests for the best pixelformat} + case Header.BitmapInfo.bmiHeader.biBitCount of + 1: TBitmap(Dest).PixelFormat := pf1Bit; + 4: TBitmap(Dest).PixelFormat := pf4Bit; + 8: TBitmap(Dest).PixelFormat := pf8Bit; + 24: TBitmap(Dest).PixelFormat := pf24Bit; + 32: TBitmap(Dest).PixelFormat := pf32Bit; + end {case Header.BitmapInfo.bmiHeader.biBitCount}; + + {Copy transparency mode} + if (TransparencyMode = ptmBit) then + begin + TRNS := Chunks.ItemFromClass(TChunkTRNS) as TChunkTRNS; + TBitmap(Dest).TransparentColor := TRNS.TransparentColor; + TBitmap(Dest).Transparent := True + end {if (TransparencyMode = ptmBit)} + + end + else + {Unknown destination kind, } + inherited AssignTo(Dest); + {$ENDIF} +end; + +{Assigns from a bitmap object} +procedure TPngObject.AssignHandle(Handle: HBitmap; Transparent: Boolean; + TransparentColor: ColorRef); +var + BitmapInfo: Windows.TBitmap; + HasPalette: Boolean; + + {Chunks} + Header: TChunkIHDR; + PLTE: TChunkPLTE; + IDAT: TChunkIDAT; + IEND: TChunkIEND; + TRNS: TChunkTRNS; +begin + {Obtain bitmap info} + GetObject(Handle, SizeOf(BitmapInfo), @BitmapInfo); + + {Only bit depths 1, 4 and 8 needs a palette} + HasPalette := (BitmapInfo.bmBitsPixel < 16); + + {Clear old chunks and prepare} + ClearChunks(); + + {Create the chunks} + Header := TChunkIHDR.Create(Self); + if HasPalette then PLTE := TChunkPLTE.Create(Self) else PLTE := nil; + if Transparent then TRNS := TChunkTRNS.Create(Self) else TRNS := nil; + IDAT := TChunkIDAT.Create(Self); + IEND := TChunkIEND.Create(Self); + + {Add chunks} + TPNGPointerList(Chunks).Add(Header); + if HasPalette then TPNGPointerList(Chunks).Add(PLTE); + if Transparent then TPNGPointerList(Chunks).Add(TRNS); + TPNGPointerList(Chunks).Add(IDAT); + TPNGPointerList(Chunks).Add(IEND); + + {This method will fill the Header chunk with bitmap information} + {and copy the image data} + BuildHeader(Header, Handle, @BitmapInfo, HasPalette); + {In case there is a image data, set the PLTE chunk fCount variable} + {to the actual number of palette colors which is 2^(Bits for each pixel)} + if HasPalette then PLTE.fCount := 1 shl BitmapInfo.bmBitsPixel; + + {In case it is a transparent bitmap, prepares it} + if Transparent then TRNS.TransparentColor := TransparentColor; + +end; + +{Assigns from another PNG} +procedure TPngObject.AssignPNG(Source: TPNGObject); +var + J: Integer; +begin + {Copy properties} + InterlaceMethod := Source.InterlaceMethod; + MaxIdatSize := Source.MaxIdatSize; + CompressionLevel := Source.CompressionLevel; + Filters := Source.Filters; + + {Clear old chunks and prepare} + ClearChunks(); + Chunks.Count := Source.Chunks.Count; + {Create chunks and makes a copy from the source} + FOR J := 0 TO Chunks.Count - 1 DO + with Source.Chunks do + begin + Chunks.SetItem(J, TChunkClass(TChunk(Item[J]).ClassType).Create(Self)); + TChunk(Chunks.Item[J]).Assign(TChunk(Item[J])); + end {with}; +end; + +{Returns a alpha data scanline} +function TPngObject.GetAlphaScanline(const LineIndex: Integer): pByteArray; +begin + with Header do + if (ColorType = COLOR_RGBALPHA) or (ColorType = COLOR_GRAYSCALEALPHA) then + Longint(Result) := Longint(ImageAlpha) + (LineIndex * Longint(Width)) + else Result := nil; {In case the image does not use alpha information} +end; + +{$IFDEF Store16bits} +{Returns a png data extra scanline} +function TPngObject.GetExtraScanline(const LineIndex: Integer): Pointer; +begin + with Header do + Longint(Result) := (Longint(ExtraImageData) + ((Longint(Height) - 1) * + BytesPerRow)) - (LineIndex * BytesPerRow); +end; +{$ENDIF} + +{Returns a png data scanline} +function TPngObject.GetScanline(const LineIndex: Integer): Pointer; +begin + with Header do + Longint(Result) := (Longint(ImageData) + ((Longint(Height) - 1) * + BytesPerRow)) - (LineIndex * BytesPerRow); +end; + +{Initialize gamma table} +procedure TPngObject.InitializeGamma; +var + i: Integer; +begin + {Build gamma table as if there was no gamma} + FOR i := 0 to 255 do + begin + GammaTable[i] := i; + InverseGamma[i] := i; + end {for i} +end; + +{Returns the transparency mode used by this png} +function TPngObject.GetTransparencyMode: TPNGTransparencyMode; +var + TRNS: TChunkTRNS; +begin + with Header do + begin + Result := ptmNone; {Default result} + {Gets the TRNS chunk pointer} + TRNS := Chunks.ItemFromClass(TChunkTRNS) as TChunkTRNS; + + {Test depending on the color type} + case ColorType of + {This modes are always partial} + COLOR_RGBALPHA, COLOR_GRAYSCALEALPHA: Result := ptmPartial; + {This modes support bit transparency} + COLOR_RGB, COLOR_GRAYSCALE: if TRNS <> nil then Result := ptmBit; + {Supports booth translucid and bit} + COLOR_PALETTE: + {A TRNS chunk must be present, otherwise it won't support transparency} + if TRNS <> nil then + if TRNS.BitTransparency then + Result := ptmBit else Result := ptmPartial + end {case} + + end {with Header} +end; + +{Add a text chunk} +procedure TPngObject.AddtEXt(const Keyword, Text: String); +var + TextChunk: TChunkTEXT; +begin + TextChunk := Chunks.Add(TChunkText) as TChunkTEXT; + TextChunk.Keyword := Keyword; + TextChunk.Text := Text; +end; + +{Add a text chunk} +procedure TPngObject.AddzTXt(const Keyword, Text: String); +var + TextChunk: TChunkzTXt; +begin + TextChunk := Chunks.Add(TChunkText) as TChunkzTXt; + TextChunk.Keyword := Keyword; + TextChunk.Text := Text; +end; + +{Removes the image transparency} +procedure TPngObject.RemoveTransparency; +var + TRNS: TChunkTRNS; +begin + TRNS := Chunks.ItemFromClass(TChunkTRNS) as TChunkTRNS; + if TRNS <> nil then Chunks.RemoveChunk(TRNS) +end; + +{Generates alpha information} +procedure TPngObject.CreateAlpha; +var + TRNS: TChunkTRNS; +begin + {Generates depending on the color type} + with Header do + case ColorType of + {Png allocates different memory space to hold alpha information} + {for these types} + COLOR_GRAYSCALE, COLOR_RGB: + begin + {Transform into the appropriate color type} + if ColorType = COLOR_GRAYSCALE then + ColorType := COLOR_GRAYSCALEALPHA + else ColorType := COLOR_RGBALPHA; + {Allocates memory to hold alpha information} + GetMem(ImageAlpha, Integer(Width) * Integer(Height)); + FillChar(ImageAlpha^, Integer(Width) * Integer(Height), #255); + end; + {Palette uses the TChunktRNS to store alpha} + COLOR_PALETTE: + begin + {Gets/creates TRNS chunk} + if Chunks.ItemFromClass(TChunkTRNS) = nil then + TRNS := Chunks.Add(TChunkTRNS) as TChunkTRNS + else + TRNS := Chunks.ItemFromClass(TChunkTRNS) as TChunkTRNS; + + {Prepares the TRNS chunk} + with TRNS do + begin + Fillchar(PaletteValues[0], 256, 255); + fDataSize := 1 shl Header.BitDepth; + fBitTransparency := False + end {with Chunks.Add}; + end; + end {case Header.ColorType} + +end; + +{Returns transparent color} +function TPngObject.GetTransparentColor: TColor; +var + TRNS: TChunkTRNS; +begin + TRNS := Chunks.ItemFromClass(TChunkTRNS) as TChunkTRNS; + {Reads the transparency chunk to get this info} + if Assigned(TRNS) then Result := TRNS.TransparentColor + else Result := 0 +end; + +{$OPTIMIZATION OFF} +procedure TPngObject.SetTransparentColor(const Value: TColor); +var + TRNS: TChunkTRNS; +begin + if HeaderPresent then + {Tests the ColorType} + case Header.ColorType of + {Not allowed for this modes} + COLOR_RGBALPHA, COLOR_GRAYSCALEALPHA: Self.RaiseError( + EPNGCannotChangeTransparent, EPNGCannotChangeTransparentText); + {Allowed} + COLOR_PALETTE, COLOR_RGB, COLOR_GRAYSCALE: + begin + TRNS := Chunks.ItemFromClass(TChunkTRNS) as TChunkTRNS; + if not Assigned(TRNS) then TRNS := Chunks.Add(TChunkTRNS) as TChunkTRNS; + + {Sets the transparency value from TRNS chunk} + TRNS.TransparentColor := {$IFDEF UseDelphi}ColorToRGB({$ENDIF}Value{$IFDEF UseDelphi}){$ENDIF} + end {COLOR_PALETTE, COLOR_RGB, COLOR_GRAYSCALE)} + end {case} +end; + +{Returns if header is present} +function TPngObject.HeaderPresent: Boolean; +begin + Result := ((Chunks.Count <> 0) and (Chunks.Item[0] is TChunkIHDR)) +end; + +{Returns pixel for png using palette and grayscale} +function GetByteArrayPixel(const png: TPngObject; const X, Y: Integer): TColor; +var + ByteData: Byte; + DataDepth: Byte; +begin + with png, Header do + begin + {Make sure the bitdepth is not greater than 8} + DataDepth := BitDepth; + if DataDepth > 8 then DataDepth := 8; + {Obtains the byte containing this pixel} + ByteData := pByteArray(png.Scanline[Y])^[X div (8 div DataDepth)]; + {Moves the bits we need to the right} + ByteData := (ByteData shr ((8 - DataDepth) - + (X mod (8 div DataDepth)) * DataDepth)); + {Discard the unwanted pixels} + ByteData:= ByteData and ($FF shr (8 - DataDepth)); + + {For palette mode map the palette entry and for grayscale convert and + returns the intensity} + case ColorType of + COLOR_PALETTE: + with TChunkPLTE(png.Chunks.ItemFromClass(TChunkPLTE)).Item[ByteData] do + Result := rgb(GammaTable[rgbRed], GammaTable[rgbGreen], + GammaTable[rgbBlue]); + COLOR_GRAYSCALE: + begin + ByteData := GammaTable[ByteData * ((1 shl DataDepth) + 1)]; + Result := rgb(ByteData, ByteData, ByteData); + end; + else Result := 0; + end {case}; + end {with} +end; + +{In case vcl units are not being used} +{$IFNDEF UseDelphi} +function ColorToRGB(const Color: TColor): COLORREF; +begin + Result := Color +end; +{$ENDIF} + +{Sets a pixel for grayscale and palette pngs} +procedure SetByteArrayPixel(const png: TPngObject; const X, Y: Integer; + const Value: TColor); +const + ClearFlag: Array[1..8] of Integer = (1, 3, 0, 15, 0, 0, 0, $FF); +var + ByteData: pByte; + DataDepth: Byte; + ValEntry: Byte; +begin + with png.Header do + begin + {Map into a palette entry} + ValEntry := GetNearestPaletteIndex(Png.Palette, ColorToRGB(Value)); + + {16 bits grayscale extra bits are discarted} + DataDepth := BitDepth; + if DataDepth > 8 then DataDepth := 8; + {Gets a pointer to the byte we intend to change} + ByteData := @pByteArray(png.Scanline[Y])^[X div (8 div DataDepth)]; + {Clears the old pixel data} + ByteData^ := ByteData^ and not (ClearFlag[DataDepth] shl ((8 - DataDepth) - + (X mod (8 div DataDepth)) * DataDepth)); + + {Setting the new pixel} + ByteData^ := ByteData^ or (ValEntry shl ((8 - DataDepth) - + (X mod (8 div DataDepth)) * DataDepth)); + end {with png.Header} +end; + +{Returns pixel when png uses RGB} +function GetRGBLinePixel(const png: TPngObject; + const X, Y: Integer): TColor; +begin + with pRGBLine(png.Scanline[Y])^[X] do + Result := RGB(rgbtRed, rgbtGreen, rgbtBlue) +end; + +{Sets pixel when png uses RGB} +procedure SetRGBLinePixel(const png: TPngObject; + const X, Y: Integer; Value: TColor); +begin + with pRGBLine(png.Scanline[Y])^[X] do + begin + rgbtRed := GetRValue(Value); + rgbtGreen := GetGValue(Value); + rgbtBlue := GetBValue(Value) + end +end; + +{Sets a pixel} +procedure TPngObject.SetPixels(const X, Y: Integer; const Value: TColor); +begin + if (X in [0..Width - 1]) and (Y in [0..Height - 1]) then + with Header do + begin + if ColorType in [COLOR_GRAYSCALE, COLOR_PALETTE] then + SetByteArrayPixel(Self, X, Y, Value) + else + SetRGBLinePixel(Self, X, Y, Value) + end {with} +end; + +{Returns a pixel} +function TPngObject.GetPixels(const X, Y: Integer): TColor; +begin + if (X in [0..Width - 1]) and (Y in [0..Height - 1]) then + with Header do + begin + if ColorType in [COLOR_GRAYSCALE, COLOR_PALETTE] then + Result := GetByteArrayPixel(Self, X, Y) + else + Result := GetRGBLinePixel(Self, X, Y) + end {with} + else Result := 0 +end; + +{Returns the image palette} +function TPngObject.GetPalette: HPALETTE; +var + LogPalette: TMaxLogPalette; + i: Integer; +begin + {Palette is avaliable for COLOR_PALETTE and COLOR_GRAYSCALE modes} + if (Header.ColorType in [COLOR_PALETTE, COLOR_GRAYSCALE]) then + begin + {In case the pal} + if TempPalette = 0 then + with LogPalette do + begin + {Prepares the new palette} + palVersion := $300; + palNumEntries := 256; + {Copy entries} + for i := 0 to LogPalette.palNumEntries - 1 do + begin + palPalEntry[i].peRed := Header.BitmapInfo.bmiColors[i].rgbRed; + palPalEntry[i].peGreen := Header.BitmapInfo.bmiColors[i].rgbGreen; + palPalEntry[i].peBlue := Header.BitmapInfo.bmiColors[i].rgbBlue; + palPalEntry[i].peFlags := 0; + end {for i}; + {Creates the palette} + TempPalette := CreatePalette(pLogPalette(@LogPalette)^); + end {with LogPalette, if Temppalette = 0} + end {if Header.ColorType in ...}; + Result := TempPalette; +end; + +initialization + {Initialize} + ChunkClasses := nil; + {crc table has not being computed yet} + crc_table_computed := FALSE; + {Register the necessary chunks for png} + RegisterCommonChunks; + {Registers TPNGObject to use with TPicture} + {$IFDEF UseDelphi}{$IFDEF RegisterGraphic} + TPicture.RegisterFileFormat('PNG', 'Portable Network Graphics', TPNGObject); + {$ENDIF}{$ENDIF} +finalization + {$IFDEF UseDelphi}{$IFDEF RegisterGraphic} + TPicture.UnregisterGraphicClass(TPNGObject); + {$ENDIF}{$ENDIF} + {Free chunk classes} + FreeChunkClassList; +end. + + diff --git a/Game/Code/lib/PngImage/pnglang.dcu b/Game/Code/lib/PngImage/pnglang.dcu new file mode 100644 index 00000000..70b1587f Binary files /dev/null and b/Game/Code/lib/PngImage/pnglang.dcu differ diff --git a/Game/Code/lib/PngImage/pnglang.pas b/Game/Code/lib/PngImage/pnglang.pas new file mode 100644 index 00000000..7a9c5078 --- /dev/null +++ b/Game/Code/lib/PngImage/pnglang.pas @@ -0,0 +1,301 @@ +{Portable Network Graphics Delphi Language Info (24 July 2002)} + +{Feel free to change the text bellow to adapt to your language} +{Also if you have a translation to other languages and want to} +{share it, send me: gubadaud@terra.com.br } +unit pnglang; + +interface + +{$DEFINE English} +{.$DEFINE Portuguese} +{.$DEFINE German} +{.$DEFINE French} +{.$DEFINE Slovenian} + +{Language strings for english} +resourcestring + {$IFDEF English} + EPngInvalidCRCText = 'This "Portable Network Graphics" image is not valid ' + + 'because it contains invalid pieces of data (crc error)'; + EPNGInvalidIHDRText = 'The "Portable Network Graphics" image could not be ' + + 'loaded because one of its main piece of data (ihdr) might be corrupted'; + EPNGMissingMultipleIDATText = 'This "Portable Network Graphics" image is ' + + 'invalid because it has missing image parts.'; + EPNGZLIBErrorText = 'Could not decompress the image because it contains ' + + 'invalid compressed data.'#13#10 + ' Description: '; + EPNGInvalidPaletteText = 'The "Portable Network Graphics" image contains ' + + 'an invalid palette.'; + EPNGInvalidFileHeaderText = 'The file being readed is not a valid '+ + '"Portable Network Graphics" image because it contains an invalid header.' + + ' This file may be corruped, try obtaining it again.'; + EPNGIHDRNotFirstText = 'This "Portable Network Graphics" image is not ' + + 'supported or it might be invalid.'#13#10 + '(IHDR chunk is not the first)'; + EPNGNotExistsText = 'The png file could not be loaded because it does not ' + + 'exists.'; + EPNGSizeExceedsText = 'This "Portable Network Graphics" image is not ' + + 'supported because either it''s width or height exceeds the maximum ' + + 'size, which is 65535 pixels length.'; + EPNGUnknownPalEntryText = 'There is no such palette entry.'; + EPNGMissingPaletteText = 'This "Portable Network Graphics" could not be ' + + 'loaded because it uses a color table which is missing.'; + EPNGUnknownCriticalChunkText = 'This "Portable Network Graphics" image ' + + 'contains an unknown critical part which could not be decoded.'; + EPNGUnknownCompressionText = 'This "Portable Network Graphics" image is ' + + 'encoded with an unknown compression scheme which could not be decoded.'; + EPNGUnknownInterlaceText = 'This "Portable Network Graphics" image uses ' + + 'an unknown interlace scheme which could not be decoded.'; + EPNGCannotAssignChunkText = 'The chunks must be compatible to be assigned.'; + EPNGUnexpectedEndText = 'This "Portable Network Graphics" image is invalid ' + + 'because the decoder found an unexpected end of the file.'; + EPNGNoImageDataText = 'This "Portable Network Graphics" image contains no ' + + 'data.'; + EPNGCannotChangeSizeText = 'The "Portable Network Graphics" image can not ' + + 'be resize by changing width and height properties. Try assigning the ' + + 'image from a bitmap.'; + EPNGCannotAddChunkText = 'The program tried to add a existent critical ' + + 'chunk to the current image which is not allowed.'; + EPNGCannotAddInvalidImageText = 'It''s not allowed to add a new chunk ' + + 'because the current image is invalid.'; + EPNGCouldNotLoadResourceText = 'The png image could not be loaded from the ' + + 'resource ID.'; + EPNGOutMemoryText = 'Some operation could not be performed because the ' + + 'system is out of resources. Close some windows and try again.'; + EPNGCannotChangeTransparentText = 'Setting bit transparency color is not ' + + 'allowed for png images containing alpha value for each pixel ' + + '(COLOR_RGBALPHA and COLOR_GRAYSCALEALPHA)'; + EPNGHeaderNotPresentText = 'This operation is not valid because the ' + + 'current image contains no valid header.'; + {$ENDIF} + {$IFDEF Portuguese} + EPngInvalidCRCText = 'Essa imagem "Portable Network Graphics" não é válida ' + + 'porque contém chunks inválidos de dados (erro crc)'; + EPNGInvalidIHDRText = 'A imagem "Portable Network Graphics" não pode ser ' + + 'carregada porque um dos seus chunks importantes (ihdr) pode estar '+ + 'inválido'; + EPNGMissingMultipleIDATText = 'Essa imagem "Portable Network Graphics" é ' + + 'inválida porque tem chunks de dados faltando.'; + EPNGZLIBErrorText = 'Não foi possível descomprimir os dados da imagem ' + + 'porque ela contém dados inválidos.'#13#10 + ' Descrição: '; + EPNGInvalidPaletteText = 'A imagem "Portable Network Graphics" contém ' + + 'uma paleta inválida.'; + EPNGInvalidFileHeaderText = 'O arquivo sendo lido não é uma imagem '+ + '"Portable Network Graphics" válida porque contém um cabeçalho inválido.' + + ' O arquivo pode estar corrompida, tente obter ela novamente.'; + EPNGIHDRNotFirstText = 'Essa imagem "Portable Network Graphics" não é ' + + 'suportada ou pode ser inválida.'#13#10 + '(O chunk IHDR não é o ' + + 'primeiro)'; + EPNGNotExistsText = 'A imagem png não pode ser carregada porque ela não ' + + 'existe.'; + EPNGSizeExceedsText = 'Essa imagem "Portable Network Graphics" não é ' + + 'suportada porque a largura ou a altura ultrapassam o tamanho máximo, ' + + 'que é de 65535 pixels de diâmetro.'; + EPNGUnknownPalEntryText = 'Não existe essa entrada de paleta.'; + EPNGMissingPaletteText = 'Essa imagem "Portable Network Graphics" não pode ' + + 'ser carregada porque usa uma paleta que está faltando.'; + EPNGUnknownCriticalChunkText = 'Essa imagem "Portable Network Graphics" ' + + 'contém um chunk crítico desconheçido que não pode ser decodificado.'; + EPNGUnknownCompressionText = 'Essa imagem "Portable Network Graphics" está ' + + 'codificada com um esquema de compressão desconheçido e não pode ser ' + + 'decodificada.'; + EPNGUnknownInterlaceText = 'Essa imagem "Portable Network Graphics" usa um ' + + 'um esquema de interlace que não pode ser decodificado.'; + EPNGCannotAssignChunkText = 'Os chunk devem ser compatíveis para serem ' + + 'copiados.'; + EPNGUnexpectedEndText = 'Essa imagem "Portable Network Graphics" é ' + + 'inválida porque o decodificador encontrou um fim inesperado.'; + EPNGNoImageDataText = 'Essa imagem "Portable Network Graphics" não contém ' + + 'dados.'; + EPNGCannotChangeSizeText = 'A imagem "Portable Network Graphics" não pode ' + + 'ser redimensionada mudando as propriedades width e height. Tente ' + + 'copiar a imagem de um bitmap usando a função assign.'; + EPNGCannotAddChunkText = 'O programa tentou adicionar um chunk crítico ' + + 'já existente para a imagem atual, oque não é permitido.'; + EPNGCannotAddInvalidImageText = 'Não é permitido adicionar um chunk novo ' + + 'porque a imagem atual é inválida.'; + EPNGCouldNotLoadResourceText = 'A imagem png não pode ser carregada apartir' + + ' do resource.'; + EPNGOutMemoryText = 'Uma operação não pode ser completada porque o sistema ' + + 'está sem recursos. Fecha algumas janelas e tente novamente.'; + EPNGCannotChangeTransparentText = 'Definir transparência booleana não é ' + + 'permitido para imagens png contendo informação alpha para cada pixel ' + + '(COLOR_RGBALPHA e COLOR_GRAYSCALEALPHA)'; + EPNGHeaderNotPresentText = 'Essa operação não é válida porque a ' + + 'imagem atual não contém um cabeçalho válido.'; + {$ENDIF} + {Language strings for German} + {$IFDEF German} + EPngInvalidCRCText = 'Dieses "Portable Network Graphics" Image ist ' + + 'ungültig, weil Teile der Daten ungültig sind (CRC-Fehler).'; + EPNGInvalidIHDRText = 'Dieses "Portable Network Graphics" Image konnte ' + + 'nicht geladen werden, weil eine der Hauptdaten (IHDR) beschädigt ' + + 'sein könnte.'; + EPNGMissingMultipleIDATText = 'Dieses "Portable Network Graphics" Image ' + + 'ist ungültig, weil Grafikdaten fehlen.'; + EPNGZLIBErrorText = 'Die Grafik konnte nicht entpackt werden, weil sie ' + + 'fehlerhafte komprimierte Daten enthält.'#13#10 + ' Beschreibung: '; + EPNGInvalidPaletteText = 'Das "Portable Network Graphics" Image enthält ' + + 'eine ungültige Palette.'; + EPNGInvalidFileHeaderText = 'Die Datei, die gelesen wird, ist kein ' + + 'gültiges "Portable Network Graphics" Image, da es keinen gültigen ' + + 'Header enthält. Die Datei könnte beschädigt sein, versuchen Sie, ' + + 'eine neue Kopie zu bekommen.'; + EPNGIHDRNotFirstText = 'Dieses "Portable Network Graphics" Image wird ' + + 'nicht unterstützt bzw. es könnte ungültig sein.'#13#10 + + '(Der IHDR-Chunk ist nicht der erste Chunk in der Datei).'; + EPNGNotExistsText = 'Die PNG Datei konnte nicht geladen werden, da sie ' + + 'nicht existiert.'; + EPNGSizeExceedsText = 'Dieses "Portable Network Graphics" Image wird nicht ' + + 'unterstützt, weil entweder seine Breite oder seine Höhe das Maximum von ' + + '65535 Pixeln überschreitet.'; + EPNGUnknownPalEntryText = 'Es gibt keinen solchen Palettenwert.'; + EPNGMissingPaletteText = 'Dieses "Portable Network Graphics" Image konnte ' + + 'nicht geladen werden, weil die benötigte Farbtabelle fehlt.'; + EPNGUnknownCriticalChunkText = 'Dieses "Portable Network Graphics" Image ' + + 'enhält einen unbekannten kritischen Teil, welcher nicht entschlüsselt ' + + 'werden kann.'; + EPNGUnknownCompressionText = 'Dieses "Portable Network Graphics" Image ' + + 'wurde mit einem unbekannten Komprimierungsalgorithmus kodiert, welcher ' + + 'nicht entschlüsselt werden kann.'; + EPNGUnknownInterlaceText = 'Dieses "Portable Network Graphics" Image ' + + 'benutzt ein unbekanntes Interlace-Schema, welcher nicht entschlüsselt ' + + 'werden kann.'; + EPNGCannotAssignChunkText = 'Die Chunks müssen kompatibel sein, um ' + + 'zugewiesen werden zu können.'; + EPNGUnexpectedEndText = 'Dieses "Portable Network Graphics" Image ist ' + + 'ungültig, der Dekoder stieß unerwarteterweise auf das Ende der Datei.'; + EPNGNoImageDataText = 'Dieses "Portable Network Graphics" Image enthält ' + + 'keine Daten.'; + EPNGCannotChangeSizeText = 'Das "Portable Network Graphics" Image kann ' + + 'nicht durch Ändern der Eigenschaften Width und Height in seinen ' + + 'Abmessungen geändert werden. Versuchen Sie das Image von einer Bitmap ' + + 'aus zuzuweisen.'; + EPNGCannotAddChunkText = 'Das Programm versucht einen existierenden ' + + 'kritischen Chunk zum aktuellen Image hinzuzufügen. Dies ist nicht ' + + 'zulässig.'; + EPNGCannotAddInvalidImageText = 'Es ist nicht zulässig, dem aktuellen ' + + 'Image einen neuen Chunk hinzuzufügen, da es ungültig ist.'; + EPNGCouldNotLoadResourceText = 'Das PNG Image konnte nicht von den ' + + 'Resourcendaten geladen werden.'; + EPNGOutMemoryText = 'Es stehen nicht genügend Resourcen im System zur ' + + 'Verfügung, um die Operation auszuführen. Schließen Sie einige Fenster '+ + 'und versuchen Sie es erneut.'; + EPNGCannotChangeTransparentText = 'Das Setzen der Bit-' + + 'Transparent-Farbe ist fuer PNG-Images die Alpha-Werte fuer jedes ' + + 'Pixel enthalten (COLOR_RGBALPHA und COLOR_GRAYSCALEALPHA) nicht ' + + 'zulaessig'; + EPNGHeaderNotPresentText = 'Die Datei, die gelesen wird, ist kein ' + + 'gültiges "Portable Network Graphics" Image, da es keinen gültigen ' + + 'Header enthält.'; + {$ENDIF} + {Language strings for French} + {$IFDEF French} + EPngInvalidCRCText = 'Cette image "Portable Network Graphics" n''est pas valide ' + + 'car elle contient des données invalides (erreur crc)'; + EPNGInvalidIHDRText = 'Cette image "Portable Network Graphics" n''a pu être ' + + 'chargée car l''une de ses principale donnée (ihdr) doit être corrompue'; + EPNGMissingMultipleIDATText = 'Cette image "Portable Network Graphics" est ' + + 'invalide car elle contient des parties d''image manquantes.'; + EPNGZLIBErrorText = 'Impossible de décompresser l''image car elle contient ' + + 'des données compressées invalides.'#13#10 + ' Description: '; + EPNGInvalidPaletteText = 'L''image "Portable Network Graphics" contient ' + + 'une palette invalide.'; + EPNGInvalidFileHeaderText = 'Le fichier actuellement lu est une image '+ + '"Portable Network Graphics" invalide car elle contient un en-tête invalide.' + + ' Ce fichier doit être corrompu, essayer de l''obtenir à nouveau.'; + EPNGIHDRNotFirstText = 'Cette image "Portable Network Graphics" n''est pas ' + + 'supportée ou doit être invalide.'#13#10 + '(la partie IHDR n''est pas la première)'; + EPNGNotExistsText = 'Le fichier png n''a pu être chargé car il n''éxiste pas.'; + EPNGSizeExceedsText = 'Cette image "Portable Network Graphics" n''est pas supportée ' + + 'car sa longueur ou sa largeur excède la taille maximale, qui est de 65535 pixels.'; + EPNGUnknownPalEntryText = 'Il n''y a aucune entrée pour cette palette.'; + EPNGMissingPaletteText = 'Cette image "Portable Network Graphics" n''a pu être ' + + 'chargée car elle utilise une table de couleur manquante.'; + EPNGUnknownCriticalChunkText = 'Cette image "Portable Network Graphics" ' + + 'contient une partie critique inconnue qui n'' pu être décodée.'; + EPNGUnknownCompressionText = 'Cette image "Portable Network Graphics" est ' + + 'encodée à l''aide d''un schémas de compression inconnu qui ne peut être décodé.'; + EPNGUnknownInterlaceText = 'Cette image "Portable Network Graphics" utilise ' + + 'un schémas d''entrelacement inconnu qui ne peut être décodé.'; + EPNGCannotAssignChunkText = 'Ce morceau doit être compatible pour être assigné.'; + EPNGUnexpectedEndText = 'Cette image "Portable Network Graphics" est invalide ' + + 'car le decodeur est arrivé à une fin de fichier non attendue.'; + EPNGNoImageDataText = 'Cette image "Portable Network Graphics" ne contient pas de ' + + 'données.'; + EPNGCannotChangeSizeText = 'Cette image "Portable Network Graphics" ne peut pas ' + + 'être retaillée en changeant ses propriétés width et height. Essayer d''assigner l''image depuis ' + + 'un bitmap.'; + EPNGCannotAddChunkText = 'Le programme a essayé d''ajouter un morceau critique existant ' + + 'à l''image actuelle, ce qui n''est pas autorisé.'; + EPNGCannotAddInvalidImageText = 'Il n''est pas permis d''ajouter un nouveau morceau ' + + 'car l''image actuelle est invalide.'; + EPNGCouldNotLoadResourceText = 'L''image png n''a pu être chargée depuis ' + + 'l''ID ressource.'; + EPNGOutMemoryText = 'Certaines opérations n''ont pu être effectuée car le ' + + 'système n''a plus de ressources. Fermez quelques fenêtres et essayez à nouveau.'; + EPNGCannotChangeTransparentText = 'Définir le bit de transparence n''est pas ' + + 'permis pour des images png qui contiennent une valeur alpha pour chaque pixel ' + + '(COLOR_RGBALPHA et COLOR_GRAYSCALEALPHA)'; + EPNGHeaderNotPresentText = 'Cette opération n''est pas valide car l''image ' + + 'actuelle ne contient pas de header valide.'; + EPNGAlphaNotSupportedText = 'Le type de couleur de l''image "Portable Network Graphics" actuelle ' + + 'contient déjà des informations alpha ou il ne peut être converti.'; + {$ENDIF} + {Language strings for slovenian} + {$IFDEF Slovenian} + EPngInvalidCRCText = 'Ta "Portable Network Graphics" slika je neveljavna, ' + + 'ker vsebuje neveljavne dele podatkov (CRC napaka).'; + EPNGInvalidIHDRText = 'Slike "Portable Network Graphics" ni bilo možno ' + + 'naložiti, ker je eden od glavnih delov podatkov (IHDR) verjetno pokvarjen.'; + EPNGMissingMultipleIDATText = 'Ta "Portable Network Graphics" slika je ' + + 'naveljavna, ker manjkajo deli slike.'; + EPNGZLIBErrorText = 'Ne morem raztegniti slike, ker vsebuje ' + + 'neveljavne stisnjene podatke.'#13#10 + ' Opis: '; + EPNGInvalidPaletteText = 'Slika "Portable Network Graphics" vsebuje ' + + 'neveljavno barvno paleto.'; + EPNGInvalidFileHeaderText = 'Datoteka za branje ni veljavna '+ + '"Portable Network Graphics" slika, ker vsebuje neveljavno glavo.' + + ' Datoteka je verjetno pokvarjena, poskusite jo ponovno naložiti.'; + EPNGIHDRNotFirstText = 'Ta "Portable Network Graphics" slika ni ' + + 'podprta ali pa je neveljavna.'#13#10 + '(IHDR del datoteke ni prvi).'; + EPNGNotExistsText = 'Ne morem naložiti png datoteke, ker ta ne ' + + 'obstaja.'; + EPNGSizeExceedsText = 'Ta "Portable Network Graphics" slika ni ' + + 'podprta, ker ali njena širina ali višina presega najvecjo možno vrednost ' + + '65535 pik.'; + EPNGUnknownPalEntryText = 'Slika nima vnešene take barvne palete.'; + EPNGMissingPaletteText = 'Te "Portable Network Graphics" ne morem ' + + 'naložiti, ker uporablja manjkajoco barvno paleto.'; + EPNGUnknownCriticalChunkText = 'Ta "Portable Network Graphics" slika ' + + 'vsebuje neznan kriticni del podatkov, ki ga ne morem prebrati.'; + EPNGUnknownCompressionText = 'Ta "Portable Network Graphics" slika je ' + + 'kodirana z neznano kompresijsko shemo, ki je ne morem prebrati.'; + EPNGUnknownInterlaceText = 'Ta "Portable Network Graphics" slika uporablja ' + + 'neznano shemo za preliv, ki je ne morem prebrati.'; + EPNGCannotAssignChunkText = Košcki morajo biti med seboj kompatibilni za prireditev vrednosti.'; + EPNGUnexpectedEndText = 'Ta "Portable Network Graphics" slika je neveljavna, ' + + 'ker je bralnik prišel do nepricakovanega konca datoteke.'; + EPNGNoImageDataText = 'Ta "Portable Network Graphics" ne vsebuje nobenih ' + + 'podatkov.'; + EPNGCannotChangeSizeText = 'Te "Portable Network Graphics" sliki ne morem ' + + 'spremeniti velikosti s spremembo lastnosti višine in širine. Poskusite ' + + 'sliko prirediti v bitno sliko.'; + EPNGCannotAddChunkText = 'Program je poskusil dodati obstojeci kriticni ' + + 'kos podatkov k trenutni sliki, kar ni dovoljeno.'; + EPNGCannotAddInvalidImageText = 'Ni dovoljeno dodati nov kos podatkov, ' + + 'ker trenutna slika ni veljavna.'; + EPNGCouldNotLoadResourceText = 'Ne morem naložiti png slike iz ' + + 'skladišca.'; + EPNGOutMemoryText = 'Ne morem izvesti operacije, ker je ' + + 'sistem ostal brez resorjev. Zaprite nekaj oken in poskusite znova.'; + EPNGCannotChangeTransparentText = 'Ni dovoljeno nastaviti prosojnosti posamezne barve ' + + 'za png slike, ki vsebujejo alfa prosojno vrednost za vsako piko ' + + '(COLOR_RGBALPHA and COLOR_GRAYSCALEALPHA)'; + EPNGHeaderNotPresentText = 'Ta operacija ni veljavna, ker ' + + 'izbrana slika ne vsebuje veljavne glave.'; + {$ENDIF} + + +implementation + +end. diff --git a/Game/Code/lib/PngImage/pngzlib.dcu b/Game/Code/lib/PngImage/pngzlib.dcu new file mode 100644 index 00000000..a090ddae Binary files /dev/null and b/Game/Code/lib/PngImage/pngzlib.dcu differ diff --git a/Game/Code/lib/PngImage/pngzlib.pas b/Game/Code/lib/PngImage/pngzlib.pas new file mode 100644 index 00000000..12324f2c --- /dev/null +++ b/Game/Code/lib/PngImage/pngzlib.pas @@ -0,0 +1,169 @@ +{Portable Network Graphics Delphi ZLIB linking (16 May 2002) } + +{This unit links ZLIB to pngimage unit in order to implement } +{the library. It's now using the new ZLIB version, 1.1.4 } +{Note: The .obj files must be located in the subdirectory \obj} + +unit pngzlib; + +interface + +type + + TAlloc = function (AppData: Pointer; Items, Size: Integer): Pointer; + TFree = procedure (AppData, Block: Pointer); + + // Internal structure. Ignore. + TZStreamRec = packed record + next_in: PChar; // next input byte + avail_in: Integer; // number of bytes available at next_in + total_in: Integer; // total nb of input bytes read so far + + next_out: PChar; // next output byte should be put here + avail_out: Integer; // remaining free space at next_out + total_out: Integer; // total nb of bytes output so far + + msg: PChar; // last error message, NULL if no error + internal: Pointer; // not visible by applications + + zalloc: TAlloc; // used to allocate the internal state + zfree: TFree; // used to free the internal state + AppData: Pointer; // private data object passed to zalloc and zfree + + data_type: Integer; // best guess about the data type: ascii or binary + adler: Integer; // adler32 value of the uncompressed data + reserved: Integer; // reserved for future use + end; + +function inflateInit_(var strm: TZStreamRec; version: PChar; + recsize: Integer): Integer; forward; +function inflate(var strm: TZStreamRec; flush: Integer): Integer; forward; +function inflateEnd(var strm: TZStreamRec): Integer; forward; +function deflateInit_(var strm: TZStreamRec; level: Integer; version: PChar; + recsize: Integer): Integer; forward; +function deflate(var strm: TZStreamRec; flush: Integer): Integer; forward; +function deflateEnd(var strm: TZStreamRec): Integer; forward; + +const + zlib_version = '1.1.4'; + +function adler32(adler: Integer; buf: PChar; len: Integer): Integer; + + +const + Z_NO_FLUSH = 0; + Z_PARTIAL_FLUSH = 1; + Z_SYNC_FLUSH = 2; + Z_FULL_FLUSH = 3; + Z_FINISH = 4; + + Z_OK = 0; + Z_STREAM_END = 1; + Z_NEED_DICT = 2; + Z_ERRNO = (-1); + Z_STREAM_ERROR = (-2); + Z_DATA_ERROR = (-3); + Z_MEM_ERROR = (-4); + Z_BUF_ERROR = (-5); + Z_VERSION_ERROR = (-6); + + Z_NO_COMPRESSION = 0; + Z_BEST_SPEED = 1; + Z_BEST_COMPRESSION = 9; + Z_DEFAULT_COMPRESSION = (-1); + + Z_FILTERED = 1; + Z_HUFFMAN_ONLY = 2; + Z_DEFAULT_STRATEGY = 0; + + Z_BINARY = 0; + Z_ASCII = 1; + Z_UNKNOWN = 2; + + Z_DEFLATED = 8; + + _z_errmsg: array[0..9] of PChar = ( + 'need dictionary', // Z_NEED_DICT (2) + 'stream end', // Z_STREAM_END (1) + '', // Z_OK (0) + 'file error', // Z_ERRNO (-1) + 'stream error', // Z_STREAM_ERROR (-2) + 'data error', // Z_DATA_ERROR (-3) + 'insufficient memory', // Z_MEM_ERROR (-4) + 'buffer error', // Z_BUF_ERROR (-5) + 'incompatible version', // Z_VERSION_ERROR (-6) + '' + ); + +implementation + +{$L obj\deflate.obj} +{$L obj\trees.obj} +{$L obj\inflate.obj} +{$L obj\inftrees.obj} +{$L obj\adler32.obj} +{$L obj\infblock.obj} +{$L obj\infcodes.obj} +{$L obj\infutil.obj} +{$L obj\inffast.obj} + +procedure _tr_init; external; +procedure _tr_tally; external; +procedure _tr_flush_block; external; +procedure _tr_align; external; +procedure _tr_stored_block; external; +function adler32; external; +procedure inflate_blocks_new; external; +procedure inflate_blocks; external; +procedure inflate_blocks_reset; external; +procedure inflate_blocks_free; external; +procedure inflate_set_dictionary; external; +procedure inflate_trees_bits; external; +procedure inflate_trees_dynamic; external; +procedure inflate_trees_fixed; external; +procedure inflate_codes_new; external; +procedure inflate_codes; external; +procedure inflate_codes_free; external; +procedure _inflate_mask; external; +procedure inflate_flush; external; +procedure inflate_fast; external; + +procedure _memset(P: Pointer; B: Byte; count: Integer);cdecl; +begin + FillChar(P^, count, B); +end; + +procedure _memcpy(dest, source: Pointer; count: Integer);cdecl; +begin + Move(source^, dest^, count); +end; + + +// deflate compresses data +function deflateInit_(var strm: TZStreamRec; level: Integer; version: PChar; + recsize: Integer): Integer; external; +function deflate(var strm: TZStreamRec; flush: Integer): Integer; external; +function deflateEnd(var strm: TZStreamRec): Integer; external; + +// inflate decompresses data +function inflateInit_(var strm: TZStreamRec; version: PChar; + recsize: Integer): Integer; external; +function inflate(var strm: TZStreamRec; flush: Integer): Integer; external; +function inflateEnd(var strm: TZStreamRec): Integer; external; +function inflateReset(var strm: TZStreamRec): Integer; external; + + +function zcalloc(AppData: Pointer; Items, Size: Integer): Pointer; +begin + GetMem(Result, Items*Size); +end; + +procedure zcfree(AppData, Block: Pointer); +begin + FreeMem(Block); +end; + +end. + + + -- cgit v1.2.3 From f0bf8c49eadf2656bf91a4b24a6ce5106b887b0a Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 13 Sep 2007 09:39:24 +0000 Subject: removed unneeded DCU files from svn. fixed borked PNGImage in the project file Sorry guys :P git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@386 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.dpr | 4 ++++ Game/Code/lib/PngImage/Tpngimage.dcu | Bin 1140 -> 0 bytes Game/Code/lib/PngImage/pngimage.dcu | Bin 91395 -> 0 bytes Game/Code/lib/PngImage/pnglang.dcu | Bin 4226 -> 0 bytes Game/Code/lib/PngImage/pngzlib.dcu | Bin 37565 -> 0 bytes 5 files changed, 4 insertions(+) delete mode 100644 Game/Code/lib/PngImage/Tpngimage.dcu delete mode 100644 Game/Code/lib/PngImage/pngimage.dcu delete mode 100644 Game/Code/lib/PngImage/pnglang.dcu delete mode 100644 Game/Code/lib/PngImage/pngzlib.dcu (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 842b225e..96172a42 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -4,6 +4,8 @@ program UltraStar; {$R 'UltraStar.res' 'UltraStar.rc'} + +// C:\Components\PngImage uses //------------------------------ //Includes - 3rd Party Libraries @@ -14,6 +16,8 @@ uses bass in 'lib\bass\delphi\bass.pas', PNGImage in 'lib\PNGImage\PNGImage.pas', + PNGzLib in 'lib\PNGImage\PNGzLib.pas', + pnglang in 'lib\PNGImage\pnglang.pas', midiout in 'lib\midi\midiout.pas', midiin in 'lib\midi\midiin.pas', diff --git a/Game/Code/lib/PngImage/Tpngimage.dcu b/Game/Code/lib/PngImage/Tpngimage.dcu deleted file mode 100644 index 8cbbd152..00000000 Binary files a/Game/Code/lib/PngImage/Tpngimage.dcu and /dev/null differ diff --git a/Game/Code/lib/PngImage/pngimage.dcu b/Game/Code/lib/PngImage/pngimage.dcu deleted file mode 100644 index 633a7430..00000000 Binary files a/Game/Code/lib/PngImage/pngimage.dcu and /dev/null differ diff --git a/Game/Code/lib/PngImage/pnglang.dcu b/Game/Code/lib/PngImage/pnglang.dcu deleted file mode 100644 index 70b1587f..00000000 Binary files a/Game/Code/lib/PngImage/pnglang.dcu and /dev/null differ diff --git a/Game/Code/lib/PngImage/pngzlib.dcu b/Game/Code/lib/PngImage/pngzlib.dcu deleted file mode 100644 index a090ddae..00000000 Binary files a/Game/Code/lib/PngImage/pngzlib.dcu and /dev/null differ -- cgit v1.2.3 From 5a778181e947cfb883f85d3239f6d1f1714dacc8 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 13 Sep 2007 11:39:57 +0000 Subject: changes to make 3rd party libraries compile / work in lazarus. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@387 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.dpr | 2 - Game/Code/lib/bass/lazarustest.lpi | 192 ++++++++++++++++++++++++++++++++++ Game/Code/lib/bass/lazarustest.lpr | 51 +++++++++ Game/Code/lib/ffmpeg/avcodec.pas | 6 +- Game/Code/lib/ffmpeg/avformat.pas | 13 ++- Game/Code/lib/ffmpeg/avio.pas | 2 + Game/Code/lib/ffmpeg/lazarustest.lpi | 194 +++++++++++++++++++++++++++++++++++ Game/Code/lib/ffmpeg/lazarustest.lpr | 27 +++++ 8 files changed, 481 insertions(+), 6 deletions(-) create mode 100644 Game/Code/lib/bass/lazarustest.lpi create mode 100644 Game/Code/lib/bass/lazarustest.lpr create mode 100644 Game/Code/lib/ffmpeg/lazarustest.lpi create mode 100644 Game/Code/lib/ffmpeg/lazarustest.lpr (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 96172a42..bef33632 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -4,8 +4,6 @@ program UltraStar; {$R 'UltraStar.res' 'UltraStar.rc'} - -// C:\Components\PngImage uses //------------------------------ //Includes - 3rd Party Libraries diff --git a/Game/Code/lib/bass/lazarustest.lpi b/Game/Code/lib/bass/lazarustest.lpi new file mode 100644 index 00000000..fd0f1c9c --- /dev/null +++ b/Game/Code/lib/bass/lazarustest.lpi @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Game/Code/lib/bass/lazarustest.lpr b/Game/Code/lib/bass/lazarustest.lpr new file mode 100644 index 00000000..6faee86d --- /dev/null +++ b/Game/Code/lib/bass/lazarustest.lpr @@ -0,0 +1,51 @@ +program lazarustest; + +{$mode objfpc}{$H+} + +uses + sysutils, + bass in 'delphi\bass.pas' + { add your units here }; + +var + chan : HSTREAM; + +begin + // check the correct BASS was loaded + if (hi(BASS_GetVersion) <> BASSVERSION) then + begin + writeln('An incorrect version of BASS.DLL was loaded'); + Halt; + end; + + //init BASS + if not BASS_Init(0,44100,0,0,nil) then + writeln('Can''t initialize device'); + + //creating stream + if fileexists( 'music.mp3 ') then + begin + chan := BASS_StreamCreateFile(FALSE,pchar('music.mp3'),0,0,0); + if chan = 0 then + begin + chan := BASS_MusicLoad(False, pchar('music.mp3'), 0, 0, BASS_MUSIC_RAMPS or BASS_MUSIC_POSRESET or BASS_MUSIC_PRESCAN, 0); + if (chan = 0) then + begin + writeln('Can''t play file'); + Exit; + end; + end; + + BASS_ChannelPlay(chan,FALSE); // start playing + end + else + begin + writeln( 'music.mp3 not found.. could not test mp3 playback'); + end; + + BASS_Free(); + writeln( 'Seems BASS is compatible with lazarus :) '); + + +end. + diff --git a/Game/Code/lib/ffmpeg/avcodec.pas b/Game/Code/lib/ffmpeg/avcodec.pas index 978b5fb6..ce08dcc9 100644 --- a/Game/Code/lib/ffmpeg/avcodec.pas +++ b/Game/Code/lib/ffmpeg/avcodec.pas @@ -576,7 +576,7 @@ type of AVIn/OutputFormat *) item_name: function (): pchar; cdecl; option: PAVOption; - end; + end; TAVCodecContext = record {720} (*** Info on struct for av_log @@ -1792,11 +1792,13 @@ procedure av_resample_close (c: PAVResampleContext); got_sub_ptr: pinteger; const buf: pchar; buf_size: integer): integer; cdecl; external av__codec; + + {$IFNDEF FPC} function avcodec_parse_frame (avctx: PAVCodecContext; pdata: PPointer; data_size_ptr: pinteger; buf: pchar; buf_size: integer): integer; cdecl; external av__codec; - + {$ENDIF} function avcodec_encode_audio (avctx: PAVCodecContext; buf: PByte; buf_size: integer; const samples: Pword): integer; cdecl; external av__codec; diff --git a/Game/Code/lib/ffmpeg/avformat.pas b/Game/Code/lib/ffmpeg/avformat.pas index 0aa98905..6d13bcdf 100644 --- a/Game/Code/lib/ffmpeg/avformat.pas +++ b/Game/Code/lib/ffmpeg/avformat.pas @@ -19,6 +19,10 @@ unit avformat; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + uses windows, avcodec, avio, rational, avutil; @@ -554,6 +558,7 @@ const const FFM_PACKET_SIZE = 4096; + {$IFNDEF FPC} function ffm_read_write_index (fd: integer): int64; cdecl; external av__format; @@ -562,20 +567,23 @@ const procedure ffm_set_write_index (s: PAVFormatContext; pos: int64; file_size: int64); cdecl; external av__format; - + {$ENDIF} + function find_info_tag (arg: pchar; arg_size: integer; tag1: pchar; info: pchar): integer; cdecl; external av__format; + {$IFNDEF FPC} function get_frame_filename(buf: pchar; buf_size: integer; path: pchar; number: integer): integer; cdecl; external av__format; + function filename_number_test (filename: pchar): integer; cdecl; external av__format; - (* grab specific *) function video_grab_init (): integer; cdecl; external av__format; + function audio_init (): integer; cdecl; external av__format; @@ -584,6 +592,7 @@ const cdecl; external av__format; function dc1394_init (): integer; cdecl; external av__format; + {$ENDIF} function strstart(str: pchar; val: pchar; ptr: PPointer): integer; cdecl; external av__format; diff --git a/Game/Code/lib/ffmpeg/avio.pas b/Game/Code/lib/ffmpeg/avio.pas index 20275ab7..7d0e8c04 100644 --- a/Game/Code/lib/ffmpeg/avio.pas +++ b/Game/Code/lib/ffmpeg/avio.pas @@ -224,12 +224,14 @@ type procedure init_checksum (s: PByteIOContext; update_checksum: pointer; checksum: cardinal); cdecl; external av__format; + {$IFNDEF FPC} function udp_set_remote_url(h: PURLContext; const uri: pchar): integer; cdecl; external av__format; function udp_get_local_port(h: PURLContext): integer; cdecl; external av__format; function udp_get_file_handle(h: PURLContext): integer; cdecl; external av__format; + {$ENDIF} implementation diff --git a/Game/Code/lib/ffmpeg/lazarustest.lpi b/Game/Code/lib/ffmpeg/lazarustest.lpi new file mode 100644 index 00000000..3cd1c3de --- /dev/null +++ b/Game/Code/lib/ffmpeg/lazarustest.lpi @@ -0,0 +1,194 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Game/Code/lib/ffmpeg/lazarustest.lpr b/Game/Code/lib/ffmpeg/lazarustest.lpr new file mode 100644 index 00000000..56efac75 --- /dev/null +++ b/Game/Code/lib/ffmpeg/lazarustest.lpr @@ -0,0 +1,27 @@ +program lazarustest; + +{$MODE Delphi} + +uses + + avcodec in 'avcodec.pas', + avformat in 'avformat.pas', + avutil in 'avutil.pas', + rational in 'rational.pas', + opt in 'opt.pas', + avio in 'avio.pas', + sysutils; + +begin + // This compiles with all units in.. + // but I cant run it, if its compiled with lazarus or delphi + // I get errors about not finding functions in dll's + + try +// av_register_all(); + writeln( 'If you see this then ffmpeg is probably lazarus compatible' ); + except + writeln( 'ffmpeg is NOT lazarus compatible' ); + end; +end. + -- cgit v1.2.3 From 12a7652fe6cf20441dec4aae8156978bf751861f Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 18 Sep 2007 10:47:12 +0000 Subject: pngimage is NOT ( yet ) lazarus compatible It might compile, however the object files are in borland obj format to use this, it will need to be in GCC object file format format Or we can use the lazarus / freepascal png unit if we decide that pngimage IS required ( and we cant use the lazarus unit ) then we should investigate how this developer went with the port. http://www.lazarus.freepascal.org/index.php?name=PNphpBB2&file=viewtopic&t=3206 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@388 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/PngImage/lazarustest.lpi | 239 +++++++++++++++++++++++++++++++++ Game/Code/lib/PngImage/lazarustest.lpr | 15 +++ Game/Code/lib/PngImage/pngimage.pas | 58 ++++---- Game/Code/lib/PngImage/pngzlib.pas | 41 +++--- 4 files changed, 309 insertions(+), 44 deletions(-) create mode 100644 Game/Code/lib/PngImage/lazarustest.lpi create mode 100644 Game/Code/lib/PngImage/lazarustest.lpr (limited to 'Game/Code') diff --git a/Game/Code/lib/PngImage/lazarustest.lpi b/Game/Code/lib/PngImage/lazarustest.lpi new file mode 100644 index 00000000..4dec8a9e --- /dev/null +++ b/Game/Code/lib/PngImage/lazarustest.lpi @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Game/Code/lib/PngImage/lazarustest.lpr b/Game/Code/lib/PngImage/lazarustest.lpr new file mode 100644 index 00000000..f567b6cb --- /dev/null +++ b/Game/Code/lib/PngImage/lazarustest.lpr @@ -0,0 +1,15 @@ +program lazarustest; + +uses + pngimage in 'pngimage.pas', + pnglang in 'pnglang.pas', + pngzlib in 'pngzlib.pas', + sysutils; + +begin + writeln( 'pngimage is NOT lazarus compatible' ); + writeln( 'It might compile ( not link though ), however the object files are in borland obj format' ); + writeln( 'to use this, it will need to be in GCC object file format format' ); + writeln( 'Or we can use the lazarus / freepascal png unit' ); +end. + diff --git a/Game/Code/lib/PngImage/pngimage.pas b/Game/Code/lib/PngImage/pngimage.pas index ec712737..ecd52c5b 100644 --- a/Game/Code/lib/PngImage/pngimage.pas +++ b/Game/Code/lib/PngImage/pngimage.pas @@ -109,8 +109,15 @@ unit pngimage; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + {Triggers avaliable (edit the fields bellow)} +{$IFNDef FPC} {$DEFINE UseDelphi} //Disable fat vcl units (perfect to small apps) +{$ENDIF} + {$DEFINE ErrorOnUnknownCritical} //Error when finds an unknown critical chunk {$DEFINE CheckCRC} //Enables CRC checking {$DEFINE RegisterGraphic} //Registers TPNGObject to use with TPicture @@ -122,8 +129,17 @@ interface uses - Windows {$IFDEF UseDelphi}, Classes, Graphics, SysUtils{$ENDIF} {$IFDEF Debug}, - dialogs{$ENDIF}, pngzlib, pnglang; + Windows, + {$IFDEF UseDelphi} + Classes, + Graphics, + SysUtils, + {$ENDIF} + {$IFDEF Debug} + dialogs, + {$ENDIF} + pngzlib, + pnglang; {$IFNDEF UseDelphi} const @@ -1249,8 +1265,7 @@ begin if Output = nil then GetMem(Output, OutputSize) else ReallocMem(Output, OutputSize); {Copies the new data} - CopyMemory(Ptr(Longint(Output) + OutputSize - total_out), - @Buffer, total_out); + CopyMemory(pointer(Longint(Output) + OutputSize - total_out), @Buffer, total_out); end {if (InflateRet = Z_STREAM_END) or (InflateRet = 0)} {Now tests for errors} else if InflateRet < 0 then @@ -1309,8 +1324,7 @@ begin GetMem(Output, OutputSize) else ReallocMem(Output, OutputSize); {Copies the new data} - CopyMemory(Ptr(Longint(Output) + OutputSize - total_out), - @Buffer, total_out); + CopyMemory(Pointer(Longint(Output) + OutputSize - total_out), @Buffer, total_out); end {if (InflateRet = Z_STREAM_END) or (InflateRet = 0)} {Now tests for errors} else if DeflateRet < 0 then @@ -1676,7 +1690,7 @@ function TStream.GetSize: Longint; function TResourceStream.Read(var Buffer; Count: Integer): Cardinal; begin //Returns data - CopyMemory(@Buffer, Ptr(Longint(Memory) + Position), Count); + CopyMemory(@Buffer, pointer(Longint(Memory) + Position), Count); //Update position inc(Position, Count); //Returns @@ -1938,9 +1952,9 @@ begin if Keyword <> '' then CopyMemory(Data, @fKeyword[1], Length(Keyword)); {Compression method 0 (inflate/deflate)} - pByte(Ptr(Longint(Data) + Length(Keyword) + 1))^ := 0; + pByte(pointer(Longint(Data) + Length(Keyword) + 1))^ := 0; if OutputSize > 0 then - CopyMemory(Ptr(Longint(Data) + Length(Keyword) + 2), Output, OutputSize); + CopyMemory(pointer(Longint(Data) + Length(Keyword) + 2), Output, OutputSize); {Let ancestor calculate crc and save} Result := SaveData(Stream); @@ -1969,8 +1983,7 @@ begin {Get text} fKeyword := PChar(Data); SetLength(fText, Size - Length(fKeyword) - 1); - CopyMemory(@fText[1], Ptr(Longint(Data) + Length(fKeyword) + 1), - Length(fText)); + CopyMemory(@fText[1], pointer(Longint(Data) + Length(fKeyword) + 1), Length(fText)); end; {Saving the chunk to a stream} @@ -1984,8 +1997,7 @@ begin if Keyword <> '' then CopyMemory(Data, @fKeyword[1], Length(Keyword)); if Text <> '' then - CopyMemory(Ptr(Longint(Data) + Length(Keyword) + 1), @fText[1], - Length(Text)); + CopyMemory(pointer(Longint(Data) + Length(Keyword) + 1), @fText[1], Length(Text)); {Let ancestor calculate crc and save} Result := inherited SaveToStream(Stream); end; @@ -2819,12 +2831,10 @@ begin {Get current row index} CurrentRow := RowStart[CurrentPass]; {Get a pointer to the current row image data} - Data := Ptr(Longint(Header.ImageData) + Header.BytesPerRow * - (ImageHeight - 1 - CurrentRow)); - Trans := Ptr(Longint(Header.ImageAlpha) + ImageWidth * CurrentRow); + Data := pointer(Longint(Header.ImageData) + Header.BytesPerRow * (ImageHeight - 1 - CurrentRow)); + Trans := pointer(Longint(Header.ImageAlpha) + ImageWidth * CurrentRow); {$IFDEF Store16bits} - Extra := Ptr(Longint(Header.ExtraImageData) + Header.BytesPerRow * - (ImageHeight - 1 - CurrentRow)); + Extra := pointer(Longint(Header.ExtraImageData) + Header.BytesPerRow * (ImageHeight - 1 - CurrentRow)); {$ENDIF} if Row_Bytes > 0 then {There must have bytes for this interlaced pass} @@ -3808,9 +3818,8 @@ begin {Get current row index} CurrentRow := RowStart[CurrentPass]; {Get a pointer to the current row image data} - Data := Ptr(Longint(Header.ImageData) + Header.BytesPerRow * - (ImageHeight - 1 - CurrentRow)); - Trans := Ptr(Longint(Header.ImageAlpha) + ImageWidth * CurrentRow); + Data := pointer(Longint(Header.ImageData) + Header.BytesPerRow * (ImageHeight - 1 - CurrentRow)); + Trans := pointer(Longint(Header.ImageAlpha) + ImageWidth * CurrentRow); {Process all the image rows} if Row_Bytes > 0 then @@ -4021,9 +4030,9 @@ begin FOR j := 0 TO fCount - 1 DO with BitmapInfo.bmiColors[j] do begin - DataPtr^ := Owner.InverseGamma[rgbRed]; inc(DataPtr); + DataPtr^ := Owner.InverseGamma[rgbRed] ; inc(DataPtr); DataPtr^ := Owner.InverseGamma[rgbGreen]; inc(DataPtr); - DataPtr^ := Owner.InverseGamma[rgbBlue]; inc(DataPtr); + DataPtr^ := Owner.InverseGamma[rgbBlue] ; inc(DataPtr); end {with BitmapInfo}; {Let ancestor do the rest of the work} @@ -5100,8 +5109,7 @@ begin (X mod (8 div DataDepth)) * DataDepth)); {Setting the new pixel} - ByteData^ := ByteData^ or (ValEntry shl ((8 - DataDepth) - - (X mod (8 div DataDepth)) * DataDepth)); + ByteData^ := ByteData^ or (ValEntry shl ((8 - DataDepth) - (X mod (8 div DataDepth)) * DataDepth)); end {with png.Header} end; diff --git a/Game/Code/lib/PngImage/pngzlib.pas b/Game/Code/lib/PngImage/pngzlib.pas index 12324f2c..3155946a 100644 --- a/Game/Code/lib/PngImage/pngzlib.pas +++ b/Game/Code/lib/PngImage/pngzlib.pas @@ -6,6 +6,10 @@ unit pngzlib; +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + interface type @@ -35,14 +39,12 @@ type reserved: Integer; // reserved for future use end; -function inflateInit_(var strm: TZStreamRec; version: PChar; - recsize: Integer): Integer; forward; -function inflate(var strm: TZStreamRec; flush: Integer): Integer; forward; -function inflateEnd(var strm: TZStreamRec): Integer; forward; -function deflateInit_(var strm: TZStreamRec; level: Integer; version: PChar; - recsize: Integer): Integer; forward; -function deflate(var strm: TZStreamRec; flush: Integer): Integer; forward; -function deflateEnd(var strm: TZStreamRec): Integer; forward; +function inflateInit_(var strm: TZStreamRec; version: PChar; recsize: Integer): Integer; // forward; +function inflate(var strm: TZStreamRec; flush: Integer): Integer; //forward; +function inflateEnd(var strm: TZStreamRec): Integer; //forward; +function deflateInit_(var strm: TZStreamRec; level: Integer; version: PChar; recsize: Integer): Integer; //forward; +function deflate(var strm: TZStreamRec; flush: Integer): Integer; //forward; +function deflateEnd(var strm: TZStreamRec): Integer; //forward; const zlib_version = '1.1.4'; @@ -97,15 +99,17 @@ const implementation -{$L obj\deflate.obj} -{$L obj\trees.obj} -{$L obj\inflate.obj} -{$L obj\inftrees.obj} -{$L obj\adler32.obj} -{$L obj\infblock.obj} -{$L obj\infcodes.obj} -{$L obj\infutil.obj} -{$L obj\inffast.obj} +{$IFNDef FPC} + {$L obj\deflate.obj} + {$L obj\trees.obj} + {$L obj\inflate.obj} + {$L obj\inftrees.obj} + {$L obj\adler32.obj} + {$L obj\infblock.obj} + {$L obj\infcodes.obj} + {$L obj\infutil.obj} + {$L obj\inffast.obj} +{$ENDIF} procedure _tr_init; external; procedure _tr_tally; external; @@ -146,8 +150,7 @@ function deflate(var strm: TZStreamRec; flush: Integer): Integer; external; function deflateEnd(var strm: TZStreamRec): Integer; external; // inflate decompresses data -function inflateInit_(var strm: TZStreamRec; version: PChar; - recsize: Integer): Integer; external; +function inflateInit_(var strm: TZStreamRec; version: PChar; recsize: Integer): Integer; external; function inflate(var strm: TZStreamRec; flush: Integer): Integer; external; function inflateEnd(var strm: TZStreamRec): Integer; external; function inflateReset(var strm: TZStreamRec): Integer; external; -- cgit v1.2.3 From 7e2e8a8f5a195ac0c49dcb941d065dd9bf0e0256 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 18 Sep 2007 10:54:41 +0000 Subject: SQLite unit's modified and tested to be lazarus compatible. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@389 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/SQLite/SQLiteTable3.pas | 4 + Game/Code/lib/SQLite/lazarustest.lpi | 142 ++++++++++++++++++++++++++++++++++ Game/Code/lib/SQLite/lazarustest.lpr | 79 +++++++++++++++++++ 3 files changed, 225 insertions(+) create mode 100644 Game/Code/lib/SQLite/lazarustest.lpi create mode 100644 Game/Code/lib/SQLite/lazarustest.lpr (limited to 'Game/Code') diff --git a/Game/Code/lib/SQLite/SQLiteTable3.pas b/Game/Code/lib/SQLite/SQLiteTable3.pas index 19346915..e09cc7a0 100644 --- a/Game/Code/lib/SQLite/SQLiteTable3.pas +++ b/Game/Code/lib/SQLite/SQLiteTable3.pas @@ -17,6 +17,10 @@ unit SQLiteTable3; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + uses Windows, SQLite3, Classes, SysUtils; diff --git a/Game/Code/lib/SQLite/lazarustest.lpi b/Game/Code/lib/SQLite/lazarustest.lpi new file mode 100644 index 00000000..0da6fab4 --- /dev/null +++ b/Game/Code/lib/SQLite/lazarustest.lpi @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Game/Code/lib/SQLite/lazarustest.lpr b/Game/Code/lib/SQLite/lazarustest.lpr new file mode 100644 index 00000000..61b7c748 --- /dev/null +++ b/Game/Code/lib/SQLite/lazarustest.lpr @@ -0,0 +1,79 @@ +program lazarustest; + +uses + SQLiteTable3 in 'SQLiteTable3.pas', + SQLite3 in 'SQLite3.pas', + sysutils; + + +procedure DoTest(); +var + slDBpath : string; + sldb : TSQLiteDatabase; + sltb : TSQLIteTable; + sSQL : String; + Notes : String; + +begin + slDBPath := ExtractFilepath( paramstr(0) ) + 'test.db'; + sldb := TSQLiteDatabase.Create(slDBPath); + + try + + if sldb.TableExists('testTable') then + begin + sSQL := 'DROP TABLE testtable'; + sldb.execsql(sSQL); + end; + + sSQL := 'CREATE TABLE testtable ([ID] INTEGER PRIMARY KEY,[OtherID] INTEGER NULL,'; + sSQL := sSQL + '[Name] VARCHAR (255),[Number] FLOAT, [notes] BLOB, [picture] BLOB COLLATE NOCASE);'; + sldb.execsql(sSQL); + + sldb.execsql('CREATE INDEX TestTableName ON [testtable]([Name]);'); + + //begin a transaction + sldb.BeginTransaction; + + sSQL := 'INSERT INTO testtable(Name,OtherID,Number,Notes) VALUES ("Some Name",4,587.6594,"Here are some notes");'; + //do the insert + sldb.ExecSQL(sSQL); + + sSQL := 'INSERT INTO testtable(Name,OtherID,Number,Notes) VALUES ("Another Name",12,4758.3265,"More notes");'; + //do the insert + sldb.ExecSQL(sSQL); + + //end the transaction + sldb.Commit; + + //query the data + sltb := slDb.GetTable('SELECT * FROM testtable'); + try + + if sltb.Count > 0 then + begin + //display first row + writeln( sltb.FieldAsString(sltb.FieldIndex['Name']) ); + writeln( inttostr(sltb.FieldAsInteger(sltb.FieldIndex['ID'])) ); + writeln( floattostr( sltb.FieldAsDouble(sltb.FieldIndex['Number'])) ); + end; + + finally + sltb.Free; + end; + + finally + sldb.Free; + end; + +end; + +begin + try + DoTest(); + writeln( 'SqlLite3 unit IS lazarus compatible' ); + except + writeln( 'ERROR : SqlLite3 unit is NOT lazarus compatible' ); + end; +end. + -- cgit v1.2.3 From e3fc5e2c58302159b79e0e25e183aa3e75397a41 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 18 Sep 2007 11:16:30 +0000 Subject: added switches.inc , which will contain compiler directives used ( at least ) for porting to linux. this file now contains compiler directive UseSerialPort, which is conditionally set depending on the compiler. at this point lazarus will not use the serial port ( LCD or Light ) units. however this functionality should be maintained at this point in delphi. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@390 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/ULCD.pas | 18 +++++++++++++++--- Game/Code/Classes/ULight.pas | 9 ++++++++- Game/Code/Classes/UMain.pas | 14 ++++++++++++-- Game/Code/Screens/UScreenSong.pas | 11 ++++++++--- Game/Code/UltraStar.dpr | 3 +++ Game/Code/switches.inc | 5 +++++ 6 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 Game/Code/switches.inc (limited to 'Game/Code') diff --git a/Game/Code/Classes/ULCD.pas b/Game/Code/Classes/ULCD.pas index a3cdac73..52b0f96a 100644 --- a/Game/Code/Classes/ULCD.pas +++ b/Game/Code/Classes/ULCD.pas @@ -1,6 +1,7 @@ unit ULCD; interface +{$I switches.inc} type TLCD = class @@ -41,16 +42,24 @@ const implementation uses - SysUtils, zlportio, UTime; + SysUtils, + {$IFDEF UseSerialPort} + zlportio, + {$ENDIF} + UTime; procedure TLCD.WriteCommand(B: Byte); // Wysylanie komend sterujacych begin - if not HalfInterface then begin +{$IFDEF UseSerialPort} + if not HalfInterface then + begin zlioportwrite(Control, 0, $02); zlioportwrite(Data, 0, B); zlioportwrite(Control, 0, $03); - end else begin + end + else + begin zlioportwrite(Control, 0, $02); zlioportwrite(Data, 0, B and $F0); zlioportwrite(Control, 0, $03); @@ -66,11 +75,13 @@ begin Sleep(2) else TimeSleep(0.1); +{$ENDIF} end; procedure TLCD.WriteData(B: Byte); // Wysylanie danych begin +{$IFDEF UseSerialPort} if not HalfInterface then begin zlioportwrite(Control, 0, $06); zlioportwrite(Data, 0, B); @@ -89,6 +100,7 @@ begin TimeSleep(0.1); Inc(Position); +{$ENDIF} end; procedure TLCD.WriteString(S: string); diff --git a/Game/Code/Classes/ULight.pas b/Game/Code/Classes/ULight.pas index 1fc4aba8..b9c7af9e 100644 --- a/Game/Code/Classes/ULight.pas +++ b/Game/Code/Classes/ULight.pas @@ -1,5 +1,6 @@ unit ULight; interface +{$I switches.inc} type TLight = class @@ -30,7 +31,11 @@ const implementation uses - SysUtils, zlportio, UTime; + SysUtils, + {$IFDEF UseSerialPort} + zlportio, + {$ENDIF} + UTime; constructor TLight.Create; begin @@ -45,8 +50,10 @@ end; procedure TLight.SetState(State: integer); begin + {$IFDEF UseSerialPort} if Enabled then PortWriteB($378, State); + {$ENDIF} end; procedure TLight.AutoSetState; diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 43010bde..e89b4785 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -1,8 +1,16 @@ unit UMain; interface +{$I switches.inc} + uses SDL, UGraphic, UMusic, URecord, UTime, SysUtils, UDisplay, UIni, ULog, ULyrics, UScreenSing, - OpenGL12, zlportio {you can disable it and all PortWriteB calls}, ULCD, ULight, UThemes{, UScreenPopup}; + OpenGL12, + + {$IFDEF UseSerialPort} + zlportio {you can disable it and all PortWriteB calls}, + {$ENDIF} + + ULCD, ULight, UThemes{, UScreenPopup}; type TPlayer = record @@ -512,7 +520,9 @@ begin if (TempBeat mod 4 <> 0) then Music.PlayHihat;*) end; - //PortWriteB($378, LPT_1 + LPT_2 * 2); // 0 zapala + {$IFDEF UseSerialPort} + // PortWriteB($378, LPT_1 + LPT_2 * 2); // 0 zapala + {$ENDIF} end; procedure NewBeatD(Sender: TScreenSing); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 38266797..2d10c9dc 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1,6 +1,7 @@ unit UScreenSong; interface +{$I switches.inc} uses UMenu, SDL, UMusic, UFiles, UTime, UDisplay, USongs, SysUtils, ULog, UThemes, UTexture, ULanguage, @@ -344,9 +345,13 @@ begin end; SDLK_RETURN: begin - if Length(Songs.Song) > 0 then begin -// PortWriteB($378, 0); - if CatSongs.Song[Interaction].Main then begin // clicked on Category Button + if Length(Songs.Song) > 0 then + begin + {$IFDEF UseSerialPort} + // PortWriteB($378, 0); + {$ENDIF} + if CatSongs.Song[Interaction].Main then + begin // clicked on Category Button //Show Cat in Top Left Mod ShowCatTL (Interaction); diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index bef33632..df4846b3 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -3,6 +3,7 @@ program UltraStar; {$DEFINE TRANSLATE} {$R 'UltraStar.res' 'UltraStar.rc'} +{$I switches.inc} uses //------------------------------ @@ -26,8 +27,10 @@ uses MidiFile in 'lib\midi\MidiFile.PAS', Delphmcb in 'lib\midi\Delphmcb.PAS', + {$IFDEF UseSerialPort} zlportio in 'lib\zlportio\zlportio.pas', ddkint in 'lib\zlportio\ddkint.pas', + {$ENDIF} avcodec in 'lib\ffmpeg\avcodec.pas', avformat in 'lib\ffmpeg\avformat.pas', diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc new file mode 100644 index 00000000..b980e754 --- /dev/null +++ b/Game/Code/switches.inc @@ -0,0 +1,5 @@ +{$IFDEF FPC} + {$UNDEF UseSerialPort} +{$ELSE} + {$DEFINE UseSerialPort} +{$ENDIF} -- cgit v1.2.3 From 45929c1df8bab8260149eeb40b5f9c2f6bec7973 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 18 Sep 2007 11:26:53 +0000 Subject: zlportio is NOT ( yet ) lazarus compatible it will need some work to make it lazarus compatible, but Im not going to do that work at this point. Im going to ifdef it out until after the initial port, then add it in later. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@391 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/zlportio/ddkint.pas | 4 +++- Game/Code/lib/zlportio/zlportio.pas | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/lib/zlportio/ddkint.pas b/Game/Code/lib/zlportio/ddkint.pas index d5b36be4..2b70ee54 100644 --- a/Game/Code/lib/zlportio/ddkint.pas +++ b/Game/Code/lib/zlportio/ddkint.pas @@ -26,7 +26,9 @@ unit ddkint; interface -uses windows,winsvc; +uses + windows, + winsvc; function CTL_CODE(const DeviceType,Func,Method,Access:Cardinal):cardinal; diff --git a/Game/Code/lib/zlportio/zlportio.pas b/Game/Code/lib/zlportio/zlportio.pas index 5a87be88..2cf57334 100644 --- a/Game/Code/lib/zlportio/zlportio.pas +++ b/Game/Code/lib/zlportio/zlportio.pas @@ -52,7 +52,9 @@ unit zlportio; interface -uses windows,sysutils,ddkint; +uses windows, + sysutils, + ddkint; Const ZLIO_BYTE = 0; -- cgit v1.2.3 From 611f516b33a0c109893354593e28afe10f48e7db Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 18 Sep 2007 12:07:57 +0000 Subject: major tidy up of Umusic ... removes mplayer unit and dependency. tidy up of other units in move to compile in lazarus. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@392 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCovers.pas | 12 +- Game/Code/Classes/ULyrics.pas | 27 +++-- Game/Code/Classes/UMusic.pas | 266 +++++------------------------------------ Game/Code/Classes/UTexture.pas | 16 ++- Game/Code/Classes/UThemes.pas | 4 + Game/Code/lib/requirements.txt | 7 ++ 6 files changed, 85 insertions(+), 247 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UCovers.pas b/Game/Code/Classes/UCovers.pas index 0740c143..4040b4d8 100644 --- a/Game/Code/Classes/UCovers.pas +++ b/Game/Code/Classes/UCovers.pas @@ -1,7 +1,17 @@ unit UCovers; interface -uses OpenGL12, Windows, Math, Classes, SysUtils, Graphics, UThemes, UTexture; + +uses OpenGL12, + Windows, + Math, + Classes, + SysUtils, + {$IFNDEF FPC} + Graphics, + {$ENDIF} + UThemes, + UTexture; type TCover = record diff --git a/Game/Code/Classes/ULyrics.pas b/Game/Code/Classes/ULyrics.pas index c3b440bc..64762265 100644 --- a/Game/Code/Classes/ULyrics.pas +++ b/Game/Code/Classes/ULyrics.pas @@ -1,7 +1,14 @@ unit ULyrics; interface -uses SysUtils, OpenGL12, UMusic; + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses SysUtils, + OpenGL12, + UMusic; type TWord = record @@ -57,6 +64,15 @@ type Italic: boolean; Text: string; // LCD + procedure AddWord(Text: string); // Moved from published, lazarus didnt like it + procedure AddCzesc(NrCzesci: integer); + + function SelectedLetter: integer; // LCD + function SelectedLength: integer; // LCD + + procedure Clear; + procedure Draw; + published property X: real write SetX; property Y: real write SetY; @@ -68,15 +84,6 @@ type property Scale: real write SetScale; property Style: integer write SetStyle; property FontStyle: integer write SetFStyle; - procedure AddWord(Text: string); - procedure AddCzesc(NrCzesci: integer); - - function SelectedLetter: integer; // LCD - function SelectedLength: integer; // LCD - - procedure Clear; - procedure Draw; - end; var diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index 979ba4e5..f9c6457d 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -2,7 +2,16 @@ unit UMusic; interface -uses Classes, MPlayer, Windows, Messages, SysUtils, Forms, ULog, USongs, Bass;//, DXSounds; +uses Classes, + Windows, + Messages, + SysUtils, + {$IFNDEF FPC} + Forms, + {$ENDIF} + ULog, + USongs, + Bass; procedure InitializeSound; @@ -22,17 +31,6 @@ type TMusic = class private -// MediaPlayer: TMediaPlayer; // It will be replaced by another component; -{ MediaPlayerStart: TMediaPlayer; // or maybe not if done this way ;) - MediaPlayerBack: TMediaPlayer; - MediaPlayerSwoosh: TMediaPlayer; - MediaPlayerChange: TMediaPlayer; - MediaPlayerOption: TMediaPlayer; - MediaPlayerClick: TMediaPlayer; - MediaPlayerDrum: TMediaPlayer; - MediaPlayerHihat: TMediaPlayer; - MediaPlayerClap: TMediaPlayer; - MediaPlayerShuffle: TMediaPlayer;} BassStart: hStream; // Wait, I've replaced this with BASS BassBack: hStream; // It has almost all features we need BassSwoosh: hStream; @@ -50,12 +48,8 @@ type Loaded: boolean; Loop: boolean; -// DXSound: TDXSound; -// Player: TcmxMp3; public Bass: hStream; - -// SoundCard: array of TSoundCard; procedure InitializePlayback; procedure InitializeRecord; procedure SetVolume(Volume: integer); @@ -86,7 +80,6 @@ type procedure CaptureStop; procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); procedure StopCard(Card: byte); - function LoadPlayerFromFile(var MediaPlayer: TMediaPlayer; Name: string): boolean; function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; //Equalizer @@ -105,11 +98,8 @@ type TMuzyka = record Path: string; Start: integer; // start of song in ms -// BPM: array of TBPM; -// Gap: real; IlNut: integer; DlugoscNut: integer; -// WartoscNut: integer; end; TCzesci = record @@ -138,27 +128,15 @@ type Tekst: string; FreeStyle: boolean; Wartosc: integer; // zwykla nuta x1, zlota nuta x2 - - - - end; end; end; TCzas = record // wszystko, co dotyczy aktualnej klatki -// BajtowTotal: integer; -// BajtowTeraz: integer; -// BajtowNaSek: integer; OldBeat: integer; // poprzednio wykryty beat w utworze AktBeat: integer; // aktualny beat w utworze MidBeat: real; // dokladny AktBeat - // should not be used -// OldHalf: integer; // poprzednio wykryta polowka -// AktHalf: integer; // aktualna polowka w utworze -// MidHalf: real; // dokladny AktHalf - // now we use this for super synchronization! // only used when analyzing voice OldBeatD: integer; // poprzednio wykryty beat w utworze @@ -178,11 +156,9 @@ type Teraz: real; // aktualny czas w utworze Razem: real; // caly czas utworu -// TerazSek: integer; end; var - Form: TForm; Music: TMusic; // muzyka @@ -196,6 +172,10 @@ var fHWND: Thandle; +type + TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, + mpPaused, mpOpen); + const ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); @@ -230,25 +210,8 @@ begin // BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); // BASS_SetConfig(BASS_CONFIG_BUFFER, 100); -{ MediaPlayer := TMediaPlayer.Create( nil ); - MediaPlayer.ParentWindow := fHWND; - MediaPlayer.Wait := true;} - Log.LogStatus('Loading Sounds', 'Music Initialize'); -{ LoadPlayerFromFile(MediaPlayerStart, SoundPath + 'Common Start.mp3'); - LoadPlayerFromFile(MediaPlayerBack, SoundPath + 'Common Back.mp3'); - LoadPlayerFromFile(MediaPlayerSwoosh, SoundPath + 'menu swoosh.mp3'); - LoadPlayerFromFile(MediaPlayerChange, SoundPath + 'select music change music.mp3'); - LoadPlayerFromFile(MediaPlayerOption, SoundPath + 'option change col.mp3'); - LoadPlayerFromFile(MediaPlayerClick, SoundPath + 'rimshot022b.mp3'); - - LoadPlayerFromFile(MediaPlayerDrum, SoundPath + 'bassdrumhard076b.mp3'); - LoadPlayerFromFile(MediaPlayerHihat, SoundPath + 'hihatclosed068b.mp3'); - LoadPlayerFromFile(MediaPlayerClap, SoundPath + 'claps050b.mp3'); - - LoadPlayerFromFile(MediaPlayerShuffle, SoundPath + 'Shuffle.mp3');} - Log.BenchmarkStart(4); LoadSoundFromFile(BassStart, SoundPath + 'Common Start.mp3'); LoadSoundFromFile(BassBack, SoundPath + 'Common Back.mp3'); @@ -370,9 +333,6 @@ function TMusic.Open(Name: string): boolean; begin Loaded := false; if FileExists(Name) then begin -{ MediaPlayer.FileName := Name; - MediaPlayer.Open;} - Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); Loaded := true; //Set Max Volume @@ -380,15 +340,11 @@ begin end; Result := Loaded; - -// Player := TcmxMp3.Create(Name); end; procedure TMusic.Rewind; begin if Loaded then begin -// MediaPlayer.Position := 0; - end; end; @@ -396,18 +352,17 @@ procedure TMusic.MoveTo(Time: real); var bytes: integer; begin -// if Loaded then begin -// MediaPlayer.StartPos := Round(Time); bytes := BASS_ChannelSeconds2Bytes(Bass, Time); BASS_ChannelSetPosition(Bass, bytes); -// end; end; procedure TMusic.Play; begin - if Loaded then begin -// MediaPlayer.Play; - if Loop then BASS_ChannelPlay(Bass, True); // start from beginning... actually bass itself does not loop, nor does this TMusic Class + if Loaded then + begin + if Loop then + BASS_ChannelPlay(Bass, True); // start from beginning... actually bass itself does not loop, nor does this TMusic Class + BASS_ChannelPlay(Bass, False); // for setting position before playing end; end; @@ -422,17 +377,11 @@ end; procedure TMusic.Stop; begin Bass_ChannelStop(Bass); -// Bass_StreamFree(Bass); -// if ModeStr[MediaPlayer.Mode] = 'Playing' then begin -// MediaPlayer.Stop; -// end; end; procedure TMusic.Close; begin Bass_StreamFree(Bass); -// Player.Free; -// MediaPlayer.Close; end; function TMusic.Length: real; @@ -441,129 +390,76 @@ var begin Result := 60; - bytes := BASS_ChannelGetLength(Bass); + bytes := BASS_ChannelGetLength(Bass); Result := BASS_ChannelBytes2Seconds(Bass, bytes); - -{ if Assigned(MediaPlayer) then begin - if Loaded then Result := MediaPlayer.Length / 1000; - end;} -// if Assigned(Player) then -// Result := Player.LengthInSeconds; end; function TMusic.Position: real; var bytes: integer; begin - Result := 0;//MediaPlayer.Position / 1000; - bytes := BASS_ChannelGetPosition(BASS); + Result := 0; + bytes := BASS_ChannelGetPosition(BASS); Result := BASS_ChannelBytes2Seconds(BASS, bytes); end; function TMusic.Finished: boolean; begin Result := false; -// if ModeStr[MediaPlayer.Mode] = 'Stopped' then Result := true; - if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then begin -// beep; + + if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then + begin Result := true; end; end; -{function myeffect( chan : integer; stream : Pointer; len : integer; udata : Pointer ): Pointer; cdecl; -var - dane: pwordarray; - pet: integer; - Prev: smallint; - PrevNew: smallint; -begin - dane := stream; - Prev := 0; - for pet := 0 to len div 2 -1 do begin - PrevNew := Dane[Pet]; - -// Dane[pet] := Round(PrevNew*1/8 + Prev*7/8); - - Prev := Dane[Pet]; - end; -end;} - procedure TMusic.PlayStart; -{var - Music: PMix_Chunk;} begin -{ Mix_OpenAudio(44100, 16, 1, 16*1024); - Music := Mix_LoadWAV('D:\Rozne\UltraStar\Old\Boys - Hej Sokoly 30s.wav'); - Mix_RegisterEffect(0, myeffect, nil, 0); - Mix_PlayChannel(0, Music, 0);} - -// MediaPlayerStart.Rewind; -// MediaPlayerStart.Play; BASS_ChannelPlay(BassStart, True); end; procedure TMusic.PlayBack; begin -// MediaPlayerBack.Rewind; -// MediaPlayerBack.Play; -// if not BASS_ChannelPlay(BassBack, True);// then -// Application.MessageBox ('Error playing stream!', 'Error'); end; procedure TMusic.PlaySwoosh; begin -// MediaPlayerSwoosh.Rewind; -// MediaPlayerSwoosh.Play; BASS_ChannelPlay(BassSwoosh, True); end; procedure TMusic.PlayChange; begin -// MediaPlayerChange.Rewind; -// MediaPlayerChange.Play; BASS_ChannelPlay(BassChange, True); end; procedure TMusic.PlayOption; begin -// MediaPlayerOption.Rewind; -// MediaPlayerOption.Play; BASS_ChannelPlay(BassOption, True); end; procedure TMusic.PlayClick; begin -// MediaPlayerClick.Rewind; -// MediaPlayerClick.Play; BASS_ChannelPlay(BassClick, True); end; procedure TMusic.PlayDrum; begin -// MediaPlayerDrum.Rewind; -// MediaPlayerDrum.Play; BASS_ChannelPlay(BassDrum, True); end; procedure TMusic.PlayHihat; begin -// MediaPlayerHihat.Rewind; -// MediaPlayerHihat.Play; BASS_ChannelPlay(BassHihat, True); end; procedure TMusic.PlayClap; begin -// MediaPlayerClap.Rewind; -// MediaPlayerClap.Play; BASS_ChannelPlay(BassClap, True); end; procedure TMusic.PlayShuffle; begin -// MediaPlayerShuffle.Rewind; -// MediaPlayerShuffle.Play; BASS_ChannelPlay(BassShuffle, True); end; @@ -582,35 +478,6 @@ begin for S := 0 to High(Sound) do Sound[S].BufferLong[0].Clear; -{ case PlayersPlay of - 1: begin - CaptureCard(0, 0, 1, 0); - end; - 2: begin - if Ini.TwoPlayerMode = 0 then begin - CaptureCard(0, 0, 1, 2); - end else begin - CaptureCard(0, 0, 1, 0); - CaptureCard(1, 1, 2, 0); - end; - end; - 3: begin - CaptureCard(0, 0, 1, 2); - CaptureCard(1, 1, 3, 0); - end; - end; // case} - -// CaptureCard(0, 0, 0, 0); -// end; - - {for SC := 0 to High(SoundCard) do begin - P1 := Ini.SoundCard[SC, 1]; - P2 := Ini.SoundCard[SC, 2]; - if P1 > PlayersPlay then P1 := 0; - if P2 > PlayersPlay then P2 := 0; - CaptureCard(SC, P1, P2); - end; } - // 0.5.2: new for SC := 0 to High(Ini.CardList) do begin P1 := Ini.CardList[SC].ChannelL; P2 := Ini.CardList[SC].ChannelR; @@ -627,31 +494,7 @@ var P1: integer; P2: integer; begin -{ if RecordSystem = 1 then begin - case PlayersPlay of - 1: begin - StopCard(0); - end; - 2: begin - if Ini.TwoPlayerMode = 0 then begin - StopCard(0); - end else begin - StopCard(0); - StopCard(1); - end; - end; - 3: begin - StopCard(0); - StopCard(1); - end; - end; - end;} - - {for SC := 0 to High(SoundCard) do begin - StopCard(SC); - end; } - // 0.5.2 for SC := 0 to High(Ini.CardList) do begin P1 := Ini.CardList[SC].ChannelL; P2 := Ini.CardList[SC].ChannelR; @@ -686,26 +529,10 @@ begin Log.LogError('Music -> CaptureCard: Error initializing record: ' + ErrorMsg); - end else begin - - //SoundCard[RecordI].BassRecordStream := BASS_RecordStart(44100, 2, MakeLong(0, 20) , @GetMicrophone, PlayerLeft + PlayerRight*256); - Recording.SoundCard[RecordI].BassRecordStream := BASS_RecordStart(44100, 2, MakeLong(0, 20) , @GetMicrophone, PlayerLeft + PlayerRight*256); - - {if SoundCard[RecordI].BassRecordStream = 0 then begin - Error := BASS_ErrorGetCode; - - ErrorMsg := IntToStr(Error); - if Error = BASS_ERROR_INIT then ErrorMsg := 'Not successfully called'; - if Error = BASS_ERROR_ALREADY then ErrorMsg := 'Recording is already in progress'; - if Error = BASS_ERROR_NOTAVAIL then ErrorMsg := 'The recording device is not available'; - if Error = BASS_ERROR_FORMAT then ErrorMsg := 'The specified format is not supported'; - if Error = BASS_ERROR_MEM then ErrorMsg := 'There is insufficent memory'; - if Error = BASS_ERROR_UNKNOWN then ErrorMsg := 'Unknown'; - - Log.LogError('Error creating record stream [' + IntToStr(RecordI) + ', ' - + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' - + ErrorMsg); - end; } + end + else + begin + Recording.SoundCard[RecordI].BassRecordStream := BASS_RecordStart(44100, 2, MakeLong(0, 20) , @GetMicrophone, PlayerLeft + PlayerRight*256); end; end; @@ -715,41 +542,12 @@ begin BASS_RecordFree; end; -function TMusic.LoadPlayerFromFile(var MediaPlayer: TMediaPlayer; Name: string): boolean; -begin - Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadPlayerFromFile'); - if FileExists(Name) then begin - try - MediaPlayer := TMediaPlayer.Create( nil ); - except - Log.LogError('Failed to create MediaPlayer', 'LoadPlayerFromFile'); - end; - try - MediaPlayer.ParentWindow := fHWND; - MediaPlayer.Wait := true; - MediaPlayer.FileName := Name; - MediaPlayer.DeviceType := dtAutoSelect; - MediaPlayer.Display := nil; - except - Log.LogError('Failed setting MediaPlayer: ' + MediaPlayer.ErrorMessage, 'LoadPlayerFromFile'); - end; - try - MediaPlayer.Open; - except - Log.LogError('Failed to open using MediaPlayer', 'LoadPlayerFromFile'); - end; - end else begin - Log.LogError('Sound not found: "' + Name + '"', 'LoadPlayerFromFile'); - exit; - end; -end; - function TMusic.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; var L: Integer; begin if FileExists(Name) then begin - Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadPlayerFromFile'); + Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); try hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); //Add CustomSound @@ -758,10 +556,10 @@ begin CustomSounds[L].Filename := Name; CustomSounds[L].Handle := hStream; except - Log.LogError('Failed to open using BASS', 'LoadPlayerFromFile'); + Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); end; end else begin - Log.LogError('Sound not found: "' + Name + '"', 'LoadPlayerFromFile'); + Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); exit; end; end; diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index dc1f9fc2..f79f66d6 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -11,7 +11,19 @@ unit UTexture; // Arrow (for arrows, white is white, gray has color, black is transparent); interface -uses OpenGL12, Windows, Math, Classes, SysUtils, Graphics, JPEG, UThemes, PNGImage; + +uses OpenGL12, + Windows, + Math, + Classes, + SysUtils, + {$IFNDEF FPC} + Graphics, + JPEG, + PNGImage, + {$ENDIF} + UThemes; + procedure glGenTextures(n: GLsizei; var textures: GLuint); stdcall; external opengl32; @@ -974,4 +986,4 @@ begin end; end; -end. \ No newline at end of file +end. diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index b883363f..b2e2b01e 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -2,6 +2,10 @@ unit UThemes; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + uses IniFiles, SysUtils, Classes; diff --git a/Game/Code/lib/requirements.txt b/Game/Code/lib/requirements.txt index bcf2fb82..8eafe2d2 100644 --- a/Game/Code/lib/requirements.txt +++ b/Game/Code/lib/requirements.txt @@ -1,8 +1,15 @@ +Not Included in SVN ( to many potential updates ) +--------------------------------------------------------------------------- + Jedi-sdl http://sourceforge.net/projects/jedi-sdl +Included in SVN .. +--------------------------------------------------------------------------- +pngImage + http://pngdelphi.sourceforge.net/ BASS.pas http://www.un4seen.com/download.php?bass23 -- cgit v1.2.3 From 067444c467e9f3e4dca07ecf10818023140c2873 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 18 Sep 2007 12:08:57 +0000 Subject: adding my lazarus project.. starting to get somewhere with compilation of it, but its still not compiling yet. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@393 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.lpi | 341 ++++++++++++++++++++++++++++++++++++++++++ Game/Code/UltraStar.lpr | 386 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 727 insertions(+) create mode 100644 Game/Code/UltraStar.lpi create mode 100644 Game/Code/UltraStar.lpr (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.lpi b/Game/Code/UltraStar.lpi new file mode 100644 index 00000000..9d260f69 --- /dev/null +++ b/Game/Code/UltraStar.lpi @@ -0,0 +1,341 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr new file mode 100644 index 00000000..793cc21a --- /dev/null +++ b/Game/Code/UltraStar.lpr @@ -0,0 +1,386 @@ +program UltraStar; + +{$DEFINE TRANSLATE} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +{$R 'UltraStar.res' 'UltraStar.rc'} + +uses + + //------------------------------ + //Includes - 3rd Party Libraries + //------------------------------ + sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', + moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', + OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas', + + bass in 'lib\bass\delphi\bass.pas', + +(* + midiout in 'lib\midi\midiout.pas', + midiin in 'lib\midi\midiin.pas', + Circbuf in 'lib\midi\CIRCBUF.PAS', + MidiType in 'lib\midi\MidiType.PAS', + MidiDefs in 'lib\midi\MidiDefs.PAS', + MidiCons in 'lib\midi\MidiCons.PAS', + MidiFile in 'lib\midi\MidiFile.PAS', + Delphmcb in 'lib\midi\Delphmcb.PAS', +*) + + avcodec in 'lib\ffmpeg\avcodec.pas', + avformat in 'lib\ffmpeg\avformat.pas', + avutil in 'lib\ffmpeg\avutil.pas', + rational in 'lib\ffmpeg\rational.pas', + opt in 'lib\ffmpeg\opt.pas', + avio in 'lib\ffmpeg\avio.pas', + + SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', + SQLite3 in 'lib\SQLite\SQLite3.pas', + + + //------------------------------ + //Includes - Menu System + //------------------------------ + UMenu in 'Menu\UMenu.pas', +(* + UDisplay in 'Menu\UDisplay.pas', + UMenuStatic in 'Menu\UMenuStatic.pas', + UMenuText in 'Menu\UMenuText.pas', + UMenuButton in 'Menu\UMenuButton.pas', + UMenuInteract in 'Menu\UMenuInteract.pas', + UMenuSelect in 'Menu\UMenuSelect.pas', + UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', + UDrawTexture in 'Menu\UDrawTexture.pas', + UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', +*) + + //------------------------------ + //Includes - Classes + //------------------------------ + UTime in 'Classes\UTime.pas', + UCommandLine in 'Classes\UCommandLine.pas', + ULog in 'Classes\ULog.pas', + + UMain in 'Classes\UMain.pas', + + UIni in 'Classes\UIni.pas', + UTexture in 'Classes\UTexture.pas', +(* + UGraphic in 'Classes\UGraphic.pas', + UMusic in 'Classes\UMusic.pas', + ULanguage in 'Classes\ULanguage.pas', + UMain in 'Classes\UMain.pas', + UDraw in 'Classes\UDraw.pas', + URecord in 'Classes\URecord.pas', + TextGL in 'Classes\TextGL.pas', + USongs in 'Classes\USongs.pas', + ULyrics in 'Classes\ULyrics.pas', + USkins in 'Classes\USkins.pas', + UThemes in 'Classes\UThemes.pas', + UJoystick in 'Classes\UJoystick.pas', + ULCD in 'Classes\ULCD.pas', + ULight in 'Classes\ULight.pas', + UDataBase in 'Classes\UDataBase.pas', + UCovers in 'Classes\UCovers.pas', + UCatCovers in 'Classes\UCatCovers.pas', + UFiles in 'Classes\UFiles.pas', + UGraphicClasses in 'Classes\UGraphicClasses.pas', + UDLLManager in 'Classes\UDLLManager.pas', + UParty in 'Classes\UParty.pas', + UPlaylist in 'Classes\UPlaylist.pas', +*) + + //------------------------------ + //Includes - Video Support + //------------------------------ +(* + UVideo in 'Classes\UVideo.pas', +*) + + //------------------------------ + //Includes - Screens + //------------------------------ + UScreenLoading in 'Screens\UScreenLoading.pas', +(* + UScreenWelcome in 'Screens\UScreenWelcome.pas', + UScreenMain in 'Screens\UScreenMain.pas', + UScreenName in 'Screens\UScreenName.pas', + UScreenLevel in 'Screens\UScreenLevel.pas', + UScreenSong in 'Screens\UScreenSong.pas', + UScreenSing in 'Screens\UScreenSing.pas', + UScreenScore in 'Screens\UScreenScore.pas', + UScreenOptions in 'Screens\UScreenOptions.pas', + UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', + UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', + UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', + UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', + UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', + UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', + UScreenOptionsAdvanced in 'Screens\UScreenOptionsAdvanced.pas', + UScreenEditSub in 'Screens\UScreenEditSub.pas', + UScreenEdit in 'Screens\UScreenEdit.pas', + UScreenEditConvert in 'Screens\UScreenEditConvert.pas', + UScreenEditHeader in 'Screens\UScreenEditHeader.pas', + UScreenOpen in 'Screens\UScreenOpen.pas', + UScreenTop5 in 'Screens\UScreenTop5.pas', + UScreenSongMenu in 'Screens\UScreenSongMenu.pas', + UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', + UScreenStatMain in 'Screens\UScreenStatMain.pas', + UScreenStatDetail in 'Screens\UScreenStatDetail.pas', + UScreenCredits in 'Screens\UScreenCredits.pas', + UScreenPopup in 'Screens\UScreenPopup.pas', +*) + + //------------------------------ + //Includes - Screens PartyMode + //------------------------------ +(* + UScreenSingModi in 'Screens\UScreenSingModi.pas', + UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', + UScreenPartyScore in 'Screens\UScreenPartyScore.pas', + UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', + UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', + UScreenPartyWin in 'Screens\UScreenPartyWin.pas', +*) + + //------------------------------ + //Includes - Modi SDK + //------------------------------ +(* + ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', +*) + + //------------------------------ + //Includes - Delphi + //------------------------------ + Windows, + SysUtils; + +const + Version = 'UltraStar Deluxe V 1.10 Alpha Build'; + +var + WndTitle: string; + hWnd: THandle; + I: Integer; + +begin + WndTitle := Version; + + //------------------------------ + //Start more than One Time Prevention + //------------------------------ + hWnd:= FindWindow(nil, PChar(WndTitle)); + //Programm already started + if (hWnd <> 0) then + begin + I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Contìnue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); + if (I = IDYes) then + begin + I := 1; + repeat + Inc(I); + hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); + until (hWnd = 0); + + WndTitle := WndTitle + ' Instance ' + InttoStr(I); + end + else + Exit; + end; + + //------------------------------ + //StartUp - Create Classes and Load Files + //------------------------------ + USTime := TTime.Create; + + // Commandline Parameter Parser + Params := TCMDParams.Create; + + // Log + Benchmark + Log := TLog.Create; + Log.Title := WndTitle; + Log.Enabled := Not Params.NoLog; + Log.BenchmarkStart(0); + +{* + // Language + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Paths', 'Initialization'); InitializePaths; + Log.LogStatus('Load Language', 'Initialization'); Language := TLanguage.Create; + //Add Const Values: + Language.AddConst('US_VERSION', Version); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Language', 1); + + // SDL + Log.BenchmarkStart(1); + Log.LogStatus('Initialize SDL', 'Initialization'); + SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing SDL', 1); + + // Skin + Log.BenchmarkStart(1); + Log.LogStatus('Loading Skin List', 'Initialization'); Skin := TSkin.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Skin List', 1); + + // Sound Card List + Log.BenchmarkStart(1); + Log.LogStatus('Loading Soundcard list', 'Initialization'); + Recording := TRecord.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Soundcard list', 1); + + // Ini + Paths + Log.BenchmarkStart(1); + Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; + Ini.Load; + + //Load Languagefile + if (Params.Language <> -1) then + Language.ChangeLanguage(ILanguage[Params.Language]) + else + Language.ChangeLanguage(ILanguage[Ini.Language]); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Ini', 1); + + // LCD + Log.BenchmarkStart(1); + Log.LogStatus('Load LCD', 'Initialization'); LCD := TLCD.Create; + if Ini.LPT = 1 then begin +// LCD.HalfInterface := true; + LCD.Enable; + LCD.Clear; + LCD.WriteText(1, ' UltraStar '); + LCD.WriteText(2, ' Loading... '); + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading LCD', 1); + + // Light + Log.BenchmarkStart(1); + Log.LogStatus('Load Light', 'Initialization'); Light := TLight.Create; + if Ini.LPT = 2 then begin + Light.Enable; + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Light', 1); + + // Theme + Log.BenchmarkStart(1); + Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Themes', 1); + + // Covers Cache + Log.BenchmarkStart(1); + Log.LogStatus('Creating Covers Cache', 'Initialization'); Covers := TCovers.Create; + Log.LogBenchmark('Loading Covers Cache Array', 1); + Log.BenchmarkStart(1); + + // Category Covers + Log.BenchmarkStart(1); + Log.LogStatus('Creating Category Covers Array', 'Initialization'); + CatCovers:= TCatCovers.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Category Covers Array', 1); + + // Songs + //Log.BenchmarkStart(1); + Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; + Songs.LoadSongList; + Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Songs', 1); + + // PluginManager + Log.BenchmarkStart(1); + Log.LogStatus('PluginManager', 'Initialization'); + DLLMan := TDLLMan.Create; //Load PluginList + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PluginManager', 1); + + // Party Mode Manager + Log.BenchmarkStart(1); + Log.LogStatus('PartySession Manager', 'Initialization'); + PartySession := TParty_Session.Create; //Load PartySession + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PartySession Manager', 1); + + // Graphics + Log.BenchmarkStart(1); + Log.LogStatus('Initialize 3D', 'Initialization'); Initialize3D(WndTitle); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing 3D', 1); + + // Sound + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Sound', 'Initialization'); + Log.LogStatus('Creating Music', 'InitializeSound'); Music := TMusic.Create; + InitializeSound; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Sound', 1); + + // Score Saving System + Log.BenchmarkStart(1); + Log.LogStatus('DataBase System', 'Initialization'); + DataBase := TDataBaseSystem.Create; + + if (Params.ScoreFile = '') then + DataBase.Init ('Ultrastar.db') + else + DataBase.Init (Params.ScoreFile); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading DataBase System', 1); + + //Playlist Manager + Log.BenchmarkStart(1); + Log.LogStatus('Playlist Manager', 'Initialization'); + PlaylistMan := TPlaylistManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Playlist Manager', 1); + + //GoldenStarsTwinkleMod + Log.BenchmarkStart(1); + Log.LogStatus('Effect Manager', 'Initialization'); + GoldenRec := TEffectManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Particel System', 1); + + // Joypad + if (Ini.Joypad = 1) OR (Params.Joypad) then begin + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Joystick', 'Initialization'); Joy := TJoy.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Joystick', 1); + end; + + Log.BenchmarkEnd(0); + Log.LogBenchmark('Loading Time', 0); + + + //------------------------------ + //Start- Mainloop + //------------------------------ + //Music.SetLoop(true); + //Music.SetVolume(50); + //Music.Open(SkinPath + 'Menu Music 3.mp3'); + //Music.Play; + Log.LogStatus('Main Loop', 'Initialization'); MainLoop; + + //------------------------------ + //Finish Application + //------------------------------ + if Ini.LPT = 1 then LCD.Clear; + if Ini.LPT = 2 then Light.TurnOff; +*} + Log.Free; +end. -- 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/Classes/UDLLManager.pas | 9 +- Game/Code/Classes/UDataBase.pas | 5 + Game/Code/Classes/UDraw.pas | 10 +- Game/Code/Classes/UGraphic.pas | 76 ++++- Game/Code/Classes/UIni.pas | 7 +- Game/Code/Classes/ULanguage.pas | 5 + Game/Code/Classes/ULight.pas | 28 +- Game/Code/Classes/UMain.pas | 5 + Game/Code/Classes/UParty.pas | 5 + Game/Code/Classes/UPlaylist.pas | 5 + Game/Code/Classes/URecord.pas | 117 +++---- Game/Code/Classes/USkins.pas | 5 + Game/Code/Classes/UTexture.pas | 5 + Game/Code/Classes/UVideo.pas | 27 +- Game/Code/Menu/UDisplay.pas | 7 +- Game/Code/Menu/UMenu.pas | 4 + Game/Code/Menu/UMenuSelectSlide.pas | 10 +- Game/Code/Menu/UMenuText.pas | 5 + Game/Code/Screens/UScreenCredits.pas | 19 +- Game/Code/Screens/UScreenEditConvert.pas | 41 ++- Game/Code/Screens/UScreenEditSub.pas | 30 +- Game/Code/Screens/UScreenMain.pas | 24 +- Game/Code/Screens/UScreenPartyNewRound.pas | 5 + Game/Code/Screens/UScreenPartyOptions.pas | 4 + Game/Code/Screens/UScreenScore.pas | 18 +- Game/Code/Screens/UScreenSingModi.pas | 479 ++--------------------------- Game/Code/Screens/UScreenSongMenu.pas | 6 +- Game/Code/Screens/UScreenStatMain.pas | 7 +- Game/Code/UltraStar.lpi | 422 +++++++++++++++++-------- Game/Code/UltraStar.lpr | 25 +- Game/Code/switches.inc | 2 + 31 files changed, 726 insertions(+), 691 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDLLManager.pas b/Game/Code/Classes/UDLLManager.pas index 4b8838b9..0d328c37 100644 --- a/Game/Code/Classes/UDLLManager.pas +++ b/Game/Code/Classes/UDLLManager.pas @@ -1,7 +1,14 @@ unit UDLLManager; +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + interface -uses ModiSDK, UFiles; + +uses ModiSDK, + UFiles; type TDLLMan = class diff --git a/Game/Code/Classes/UDataBase.pas b/Game/Code/Classes/UDataBase.pas index b8b41bc1..009d0d63 100644 --- a/Game/Code/Classes/UDataBase.pas +++ b/Game/Code/Classes/UDataBase.pas @@ -2,6 +2,11 @@ unit UDataBase; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + uses USongs, SQLiteTable3; //-------------------- diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 94617583..cbfafbe6 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -1,7 +1,15 @@ unit UDraw; interface -uses UThemes, ModiSDK, UGraphicClasses, dialogs; + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses UThemes, + ModiSDK, + UGraphicClasses; + // dialogs; procedure SingDraw; procedure SingModiDraw (PlayerInfo: TPlayerInfo); diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 0c022b8f..eb7dde8e 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -1,16 +1,59 @@ unit UGraphic; interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + uses - SDL, OpenGL12, UTexture, TextGL, ULog, SysUtils, ULyrics, UScreenLoading, - UScreenWelcome, UScreenMain, UScreenName, UScreenLevel, UScreenOptions, UScreenOptionsGame, - UScreenOptionsGraphics, UScreenOptionsSound, UScreenOptionsLyrics, UScreenOptionsThemes, UScreenOptionsRecord, UScreenOptionsAdvanced, - UScreenSong, UScreenSing, UScreenScore, UScreenTop5, UScreenEditSub, - UScreenEdit, UScreenEditConvert, UScreenEditHeader, UScreenOpen, UThemes, USkins, UScreenSongMenu, UScreenSongJumpto, - {Party Screens} UScreenSingModi, UScreenPartyNewRound, UScreenPartyScore, UScreenPartyOptions, UScreenPartyWin, UScreenPartyPlayer, - {Stats Screens} UScreenStatMain, UScreenStatDetail, - {CreditsScreen} UScreenCredits, - {Popup for errors, etc.} UScreenPopup; + SDL, + OpenGL12, + UTexture, + TextGL, + ULog, + SysUtils, + ULyrics, + UScreenLoading, + UScreenWelcome, + UScreenMain, + UScreenName, + UScreenLevel, + UScreenOptions, + UScreenOptionsGame, + UScreenOptionsGraphics, + UScreenOptionsSound, + UScreenOptionsLyrics, + UScreenOptionsThemes, + UScreenOptionsRecord, + UScreenOptionsAdvanced, + UScreenSong, + UScreenSing, + UScreenScore, + UScreenTop5, + UScreenEditSub, + UScreenEdit, + UScreenEditConvert, + UScreenEditHeader, + UScreenOpen, + UThemes, + USkins, + UScreenSongMenu, + UScreenSongJumpto, + {Party Screens} + UScreenSingModi, + UScreenPartyNewRound, + UScreenPartyScore, + UScreenPartyOptions, + UScreenPartyWin, + UScreenPartyPlayer, + {Stats Screens} + UScreenStatMain, + UScreenStatDetail, + {CreditsScreen} + UScreenCredits, + {Popup for errors, etc.} + UScreenPopup; type TRecR = record @@ -188,9 +231,20 @@ function LoadingThreadFunction: integer; implementation -uses UMain, UIni, UDisplay, UCommandLine, Graphics, Classes, Windows; + +uses UMain, + UIni, + UDisplay, + UCommandLine, + {$IFNDEF FPC} + Graphics, + {$ENDIF} + Classes, + Windows; procedure LoadTextures; + + var P: integer; R, G, B: real; @@ -253,7 +307,7 @@ end; procedure Initialize3D (Title: string); var - Icon: TIcon; +// Icon: TIcon; Res: TResourceStream; ISurface: PSDL_Surface; Pixel: PByteArray; diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index 67649a51..cd5c3716 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -1,6 +1,11 @@ unit UIni; interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + uses IniFiles, ULog, SysUtils; type @@ -768,4 +773,4 @@ begin end; end; -end. \ No newline at end of file +end. diff --git a/Game/Code/Classes/ULanguage.pas b/Game/Code/Classes/ULanguage.pas index 5deed1f7..f693694b 100644 --- a/Game/Code/Classes/ULanguage.pas +++ b/Game/Code/Classes/ULanguage.pas @@ -2,6 +2,11 @@ unit ULanguage; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + type TLanguageEntry = record ID: string; diff --git a/Game/Code/Classes/ULight.pas b/Game/Code/Classes/ULight.pas index b9c7af9e..74681a85 100644 --- a/Game/Code/Classes/ULight.pas +++ b/Game/Code/Classes/ULight.pas @@ -36,6 +36,32 @@ uses zlportio, {$ENDIF} UTime; + +{$IFDEF FPC} + function GetTime: TDateTime; + {$IFDEF MSWINDOWS} + var + SystemTime: TSystemTime; + begin + GetLocalTime(SystemTime); + with SystemTime do + Result := EncodeTime(wHour, wMinute, wSecond, wMilliSeconds); + end; + {$ENDIF} + {$IFDEF LINUX} + var + T: TTime_T; + TV: TTimeVal; + UT: TUnixTime; + begin + gettimeofday(TV, nil); + T := TV.tv_sec; + localtime_r(@T, UT); + Result := EncodeTime(UT.tm_hour, UT.tm_min, UT.tm_sec, TV.tv_usec div 1000); + end; + {$ENDIF} +{$ENDIF} + constructor TLight.Create; begin @@ -44,7 +70,7 @@ end; procedure TLight.Enable; begin - Enabled := true; + Enabled := true; LastTime := GetTime; end; diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index e89b4785..646724df 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -1,6 +1,11 @@ unit UMain; interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses SDL, UGraphic, UMusic, URecord, UTime, SysUtils, UDisplay, UIni, ULog, ULyrics, UScreenSing, diff --git a/Game/Code/Classes/UParty.pas b/Game/Code/Classes/UParty.pas index 7bf3dd1b..9be0df3e 100644 --- a/Game/Code/Classes/UParty.pas +++ b/Game/Code/Classes/UParty.pas @@ -2,6 +2,11 @@ unit UParty; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + uses ModiSDK; type diff --git a/Game/Code/Classes/UPlaylist.pas b/Game/Code/Classes/UPlaylist.pas index 1e517ef7..3f89ffed 100644 --- a/Game/Code/Classes/UPlaylist.pas +++ b/Game/Code/Classes/UPlaylist.pas @@ -2,6 +2,11 @@ unit UPlaylist; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + type TPlaylistItem = record Artist: String; diff --git a/Game/Code/Classes/URecord.pas b/Game/Code/Classes/URecord.pas index 6ce83c0a..03c87a35 100644 --- a/Game/Code/Classes/URecord.pas +++ b/Game/Code/Classes/URecord.pas @@ -1,7 +1,13 @@ unit URecord; interface -uses Classes, Math, SysUtils, {DXSounds, Wave, }UMusic, UIni, BASS; + +uses Classes, + Math, + SysUtils, + UMusic, + UIni, + BASS; type TSound = class @@ -11,8 +17,6 @@ type Num: integer; n: integer; // length of Signal to analyze -// Spectrum: array[1..8192] of single; // sound buffer from above as FFT -// Spektogram: array[0..100] of TSpekt; // FFT(t) // pitch detection SzczytJest: boolean; // czy jest szczyt @@ -63,7 +67,7 @@ var Recording: TRecord; implementation -uses UMain, ULog; +uses UMain; procedure TSound.ProcessNewBuffer; var @@ -87,7 +91,8 @@ begin BufferNew.ReadBuffer(BufferArray[1+n-L], 2*L); // process BufferLong - if Ini.SavePlayback = 1 then begin + if Ini.SavePlayback = 1 then + begin BufferNew.Seek(0, soBeginning); BufferLong[0].CopyFrom(BufferNew, BufferNew.Size); end; @@ -110,32 +115,29 @@ var S: integer; // Signal Threshold: real; // threshold begin -// Log.LogAnalyze('[Analyze by Autocorrelation]'); SzczytJest := false; // find maximum volume of first 1024 words of signal MaxV := 0; - for S := 1 to 1024 do begin // 0.5.2: fix. was from 0 to 1023 -// Log.LogDebug('1'); -// Log.LogDebug(IntTostr(S)); + for S := 1 to 1024 do // 0.5.2: fix. was from 0 to 1023 + begin V := Abs(BufferArray[S]) / $10000; -// Log.LogDebug('2'); -// Log.LogDebug(IntTostr(S) + ': ' + FloatToStr(V) + ', MaxV='+floattostr(maxv)+', buf='+inttostr(length(BufferArray))); - if V > MaxV then MaxV := V; -// Log.LogDebug('3'); -// Log.LogDebug(IntTostr(S) + ': ' + FloatToStr(V) + ', MaxV='+floattostr(maxv)+', buf='+inttostr(length(BufferArray))); - end; + if V > MaxV then + MaxV := V; + end; // prepare to analyze MaxW := 0; // analyze all 12 halftones - for T := 0 to 35 do begin // to 11, then 23, now 35 (for Whitney and my high voice) + for T := 0 to 35 do // to 11, then 23, now 35 (for Whitney and my high voice) + begin F := 130.81*Power(1.05946309436, T)/2; // let's analyze below 130.81 Wages[T] := AnalyzeAutocorrelationFreq(F); - if Wages[T] > MaxW then begin // this frequency has better wage + if Wages[T] > MaxW then + begin // this frequency has better wage MaxW := Wages[T]; MaxT := T; end; @@ -149,20 +151,13 @@ begin 3: Threshold := 0.2; end; - //Log.LogDebug('Sound -> AnalyzeByAutocorrelation: MaxV='+floattostr(maxv)+', Threshold='+floattostr(threshold)); - if MaxV >= Threshold then begin // found acceptable volume // 0.1 + if MaxV >= Threshold then + begin // found acceptable volume // 0.1 SzczytJest := true; TonGamy := MaxT mod 12; Ton := MaxT mod 12; end; -// Log.LogAnalyze('--> Weight: ') -// Log.LogAnalyze('--> Selected: ' + BoolToStr(SzczytJest, true) + -// ', TonGamy: ' + IntToStr(Ton) + -// ', MaxV: ' + FloatToStr(MaxV)); -// Log.LogAnalyze(''); - - end; function TSound.AnalyzeAutocorrelationFreq(Freq: real): real; // result medium difference @@ -175,25 +170,14 @@ var begin // we use Signal as source Count := 0; - Il := 0; - Src := 1; - Move := Round(44100/Freq); - Dst := Src + Move; - - // ver 1 - sample 1 and compare n-times -{ while (Src <= Move) do begin // process by moving Src by one - while (Dst < n) do begin // process up to n (4KB) of Signal - Count := Count + Abs(Signal[Src] - Signal[Dst]) / $10000; - Inc(Dst, Move); - Inc(Il); - end; - - Inc(Src); - Dst := Src + Move; - end;} + Il := 0; + Src := 1; + Move := Round(44100/Freq); + Dst := Src + Move; // ver 2 - compare in vertical - while (Dst < n) do begin // process up to n (4KB) of Signal + while (Dst < n) do + begin // process up to n (4KB) of Signal Count := Count + Abs(BufferArray[Src] - BufferArray[Dst]) / $10000; Inc(Src); Inc(Dst); @@ -208,8 +192,6 @@ var L: integer; S: integer; PB: pbytearray; - PW: pwordarray; - SI: smallintarray; PSI: psmallintarray; I: integer; Skip: integer; @@ -217,8 +199,6 @@ var P2: integer; Boost: byte; begin -// Log.LogDebug('Record -> GetMicrophone: len='+inttstr(len)); - // set boost case Ini.MicBoost of 0: Boost := 1; @@ -230,7 +210,8 @@ begin // boost buffer L := Len div 2; // number of samples PSI := Buffer; - for S := 0 to L-1 do begin + for S := 0 to L-1 do + begin I := PSI^[S] * Boost; if I > 32767 then I := 32767; // 0.5.0: limit if I < -32768 then I := -32768; // 0.5.0: limit @@ -241,37 +222,36 @@ begin P1 := (user and 255) - 1; P2 := (user div 256) - 1; -// Log.LogDebug('Record -> GetMicrophone: P1='+inttostr(p1)+', P2='+inttostr(p2)); // 2 players USB mic, left channel - if P1 >= 0 then begin - L := Len div 4; // number of samples + if P1 >= 0 then + begin + L := Len div 4; // number of samples PB := Buffer; -// Log.LogDebug('Record -> GetMicrophone -> Sound[P1].BufferNew.Clear'); + Sound[P1].BufferNew.Clear; // 0.5.2: problem on exiting - for S := 1 to L do begin + for S := 1 to L do + begin Sound[P1].BufferNew.Write(PB[(S-1)*4], 2); end; Sound[P1].ProcessNewBuffer; end; // 2 players USB mic, right channel -// if Ini.Debug = 0 then Skip := 2 -// else Skip := 0; Skip := 2; - if P2 >= 0 then begin + if P2 >= 0 then + begin L := Len div 4; // number of samples PB := Buffer; Sound[P2].BufferNew.Clear; - for S := 1 to L do begin + for S := 1 to L do + begin Sound[P2].BufferNew.Write(PB[Skip + (S-1)*4], 2); end; Sound[P2].ProcessNewBuffer; end; -// Log.LogDebug('Record -> GetMicrophone -> Finish'); - Result := true; end; @@ -283,6 +263,7 @@ var InputName: PChar; Flags: integer; No: integer; + function isDuplicate(Desc: String): Boolean; var I: Integer; @@ -306,15 +287,17 @@ begin SC := 0; Descr := BASS_RecordGetDeviceDescription(SC); - while (Descr <> '') do begin + while (Descr <> '') do + begin //If there is another SoundCard with the Same ID, Search an available Name if (IsDuplicate(Descr)) then begin No:= 1; //Count of SoundCards with same Name Repeat - Inc(No) + Inc(No) Until not IsDuplicate(Descr + ' (' + InttoStr(No) + ')'); + //Set Description Descr := Descr + ' (' + InttoStr(No) + ')'; end; @@ -333,12 +316,12 @@ begin SoundCard[SC].Input[SCI].Name := InputName; // process each input - while (InputName <> nil) do begin + while (InputName <> nil) do + begin Flags := BASS_RecordGetInput(SCI); - if (SCI >= 1) {AND (Flags AND BASS_INPUT_OFF = 0)} then begin - + if (SCI >= 1) {AND (Flags AND BASS_INPUT_OFF = 0)} then + begin SetLength(SoundCard[SC].Input, SCI+1); - SoundCard[SC].Input[SCI].Name := InputName; end; @@ -346,18 +329,18 @@ begin if ((Flags and BASS_INPUT_TYPE_MIC) = 1) then SoundCard[SC].MicInput := SCI; - Inc(SCI); InputName := BASS_RecordGetInputName(SCI); end; - BASS_RecordFree; Inc(SC); Descr := BASS_RecordGetDeviceDescription(SC); end; // while end; + + end. diff --git a/Game/Code/Classes/USkins.pas b/Game/Code/Classes/USkins.pas index 3bcd9357..a5f618ff 100644 --- a/Game/Code/Classes/USkins.pas +++ b/Game/Code/Classes/USkins.pas @@ -1,5 +1,10 @@ unit USkins; +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + interface type diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index f79f66d6..d1ca0917 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -1,5 +1,10 @@ unit UTexture; +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + // Plain (alpha = 1) // Transparent // Transparent Range diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index 8e2fc446..c97057ac 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -5,6 +5,10 @@ # based on 'An ffmpeg and SDL Tutorial' (http://www.dranger.com/ffmpeg/) # #############################################################################} +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + //{$define DebugDisplay} // uncomment if u want to see the debug stuff {$define DebugFrames} {$define Info} @@ -13,7 +17,20 @@ unit UVideo; interface -uses SDL, UGraphicClasses, textgl, avcodec, avformat, avutil, math, OpenGL12, SysUtils, UIni, dialogs; + +uses SDL, + UGraphicClasses, + textgl, + avcodec, + avformat, + avutil, + math, + OpenGL12, + SysUtils, + {$ifdef DebugDisplay} + dialogs, + {$ENDIF} + UIni; procedure Init; procedure FFmpegOpenFile(FileName: pAnsiChar); @@ -64,6 +81,7 @@ begin errnum:=av_open_input_file(VideoFormatContext, FileName, Nil, 0, Nil); if(errnum <> 0) then begin +{$ifdef DebugDisplay} case errnum of AVERROR_UNKNOWN: showmessage('failed to open file '+Filename+#13#10+'AVERROR_UNKNOWN'); AVERROR_IO: showmessage('failed to open file '+Filename+#13#10+'AVERROR_IO'); @@ -74,6 +92,7 @@ begin AVERROR_NOTSUPP: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NOTSUPP'); else showmessage('failed to open file '+Filename+#13#10+'Error number: '+inttostr(Errnum)); end; +{$ENDIF} Exit; end else begin @@ -90,7 +109,9 @@ begin VideoCodecContext:=VideoFormatContext^.streams[VideoStreamIndex]^.codec; VideoCodec:=avcodec_find_decoder(VideoCodecContext^.codec_id); end else begin +{$ifdef DebugDisplay} showmessage('found no video stream'); +{$ENDIF} av_close_input_file(VideoFormatContext); Exit; end; @@ -98,7 +119,9 @@ begin begin errnum:=avcodec_open(VideoCodecContext, VideoCodec); end else begin +{$ifdef DebugDisplay} showmessage('no matching codec found'); +{$ENDIF} avcodec_close(VideoCodecContext); av_close_input_file(VideoFormatContext); Exit; @@ -125,7 +148,9 @@ begin if myBuffer <> Nil then errnum:=avpicture_fill(PAVPicture(AVFrameRGB), myBuffer, PIX_FMT_RGB24, VideoCodecContext^.width, VideoCodecContext^.height) else begin +{$ifdef DebugDisplay} showmessage('failed to allocate video buffer'); +{$endif} av_free(AVFrameRGB); av_free(AVFrame); avcodec_close(VideoCodecContext); diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index 2af1dfa0..6ad01406 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -52,8 +52,11 @@ var implementation -uses Graphics, - Jpeg, +uses + {$IFNDEF FPC} + Graphics, + JPEG, + {$ENDIF} TextGL, // UFiles, UMain, diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index b0622d4b..3c50967d 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -2,6 +2,10 @@ unit UMenu; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + uses OpenGL12, SysUtils, UTexture, UMenuStatic, UMenuText, UMenuButton, UMenuSelect, UMenuSelectSlide, UMenuInteract, UThemes, UMenuButtonCollection, Math; diff --git a/Game/Code/Menu/UMenuSelectSlide.pas b/Game/Code/Menu/UMenuSelectSlide.pas index 3659c00d..bb9b5809 100644 --- a/Game/Code/Menu/UMenuSelectSlide.pas +++ b/Game/Code/Menu/UMenuSelectSlide.pas @@ -1,7 +1,15 @@ unit UMenuSelectSlide; interface -uses TextGL, UTexture, OpenGL12, UMenuText; + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses TextGL, + UTexture, + OpenGL12, + UMenuText; type PSelectSlide = ^TSelectSlide; diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas index 4713962e..cba237b8 100644 --- a/Game/Code/Menu/UMenuText.pas +++ b/Game/Code/Menu/UMenuText.pas @@ -1,6 +1,11 @@ unit UMenuText; interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + uses TextGL, UTexture, OpenGL12, SysUtils; type diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 067414bd..21e164b9 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -104,7 +104,24 @@ const implementation -uses Dialogs,Windows, UGraphic, UMain, UIni, USongs, Textgl, opengl, ULanguage, Math; +uses // Dialogs, + Windows, + UGraphic, + UMain, + UIni, + USongs, + Textgl, +// opengl, + ULanguage, + Math; + +{$IFDEF FPC} +// TODO : JB - move this to a lazarus common file for ultrastar +function RandomRange(aMin: Integer; aMax: Integer) : Integer; +begin +RandomRange := Random(aMax-aMin) + aMin ; +end; +{$ENDIF} function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index 791f8e50..cb6aef6d 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -2,7 +2,18 @@ unit UScreenEditConvert; interface -uses UMenu, SDL, MidiFile, MidiOut, ULog, USongs, UMusic, UThemes; +{$I switches.inc} + +uses UMenu, + SDL, + {$IFDEF UseMIDIPort} + MidiFile, + MidiOut, + {$ENDIF} + ULog, + USongs, + UMusic, + UThemes; type TNote = record @@ -45,10 +56,14 @@ type Sel: integer; Selected: boolean; // FileName: string; + + {$IFDEF UseMIDIPort} MidiFile: TMidiFile; MidiTrack: TMidiTrack; MidiEvent: pMidiEvent; MidiOut: TMidiOutput; + {$ENDIF} + Song: TSong; Czesc: TCzesci; BPM: real; @@ -58,7 +73,10 @@ type procedure AddLyric(Start: integer; Tekst: string); procedure Extract; + {$IFDEF UseMIDIPort} procedure MidiFile1MidiEvent(event: PMidiEvent); + {$ENDIF} + function SelectedNumber: integer; constructor Create; override; procedure onShow; override; @@ -68,7 +86,15 @@ type end; implementation -uses UGraphic, SysUtils, UDrawTexture, TextGL, UFiles, UMain, UIni, OpenGL, USkins; +uses UGraphic, + SysUtils, + UDrawTexture, + TextGL, + UFiles, + UMain, + UIni, + OpenGL12, + USkins; function TScreenEditConvert.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; var @@ -87,7 +113,9 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin + {$IFDEF UseMIDIPort} MidiFile.StopPlaying; + {$ENDIF} Music.PlayBack; FadeTo(@ScreenEdit); end; @@ -102,14 +130,18 @@ begin if Interaction = 1 then begin Selected := false; + {$IFDEF UseMIDIPort} MidiFile.OnMidiEvent := MidiFile1MidiEvent; // MidiFile.GoToTime(MidiFile.GetTrackLength div 2); MidiFile.StartPlaying; + {$ENDIF} end; if Interaction = 2 then begin Selected := true; + {$IFDEF UseMIDIPort} MidiFile.OnMidiEvent := nil; + {$ENDIF} {for T := 0 to High(ATrack) do begin if ATrack[T].Hear then begin MidiTrack := MidiFile.GetTrack(T); @@ -356,7 +388,9 @@ begin // MidiOut.SetVolume(100, 100); // temporary} FileName := GamePath + 'file.mid'; + {$IFDEF UseMIDIPort} MidiFile := TMidiFile.Create(nil); + {$ENDIF} for P := 0 to 100 do begin ColR[P] := Random(10)/10; @@ -380,7 +414,8 @@ begin MidiOut.Open; - if FileExists(FileName) then begin + if FileExists(FileName) then + begin MidiFile.Filename := FileName; MidiFile.ReadFile; diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 6eef8509..7184b0b6 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -2,8 +2,27 @@ unit UScreenEditSub; interface -uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, UMenuText, - ULyrics, Math, OpenGL12, UThemes, MidiOut; +{$I switches.inc} + +uses + UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + UIni, + ULog, + UTexture, + UMenuText, + ULyrics, + Math, + OpenGL12, + {$IFDEF UseMIDIPort} + MidiOut, + {$ENDIF} + UThemes; type TScreenEditSub = class(TMenu) @@ -31,7 +50,10 @@ type Click: boolean; CopySrc: integer; + {$IFDEF UseMIDIPort} MidiOut: TMidiOutput; + {$endif} + MidiStart: real; MidiStop: real; MidiTime: real; @@ -470,6 +492,7 @@ begin SDLK_DOWN: begin + {$IFDEF UseMIDIPort} // skip to next sentence if SDL_ModState = 0 then begin MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127); @@ -491,11 +514,13 @@ begin if SDL_ModState = KMOD_LCTRL then begin TransposeNote(-1); end; + {$endif} end; SDLK_UP: begin + {$IFDEF UseMIDIPort} // skip to previous sentence if SDL_ModState = 0 then begin MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127); @@ -517,6 +542,7 @@ begin if SDL_ModState = KMOD_LCTRL then begin TransposeNote(1); end; + {$endif} end; // Golden Note Patch diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 3d591a5c..5af3d4a6 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -3,7 +3,15 @@ unit UScreenMain; interface uses - UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes, ULCD, ULight; + UMenu, + SDL, + UDisplay, + UMusic, + UFiles, + SysUtils, + UThemes, + ULCD, + ULight; type TScreenMain = class(TMenu) @@ -25,7 +33,19 @@ type implementation -uses Windows, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl, ULanguage, UParty, UDLLManager, UScreenCredits, USkins; +uses Windows, + UGraphic, + UMain, + UIni, + UTexture, + USongs, + Textgl, +// opengl, + ULanguage, + UParty, + UDLLManager, + UScreenCredits, + USkins; function TScreenMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 938aacfb..30a1f8f0 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -2,6 +2,11 @@ unit UScreenPartyNewRound; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + uses UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 493f3939..ab6bd733 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -2,6 +2,10 @@ unit UScreenPartyOptions; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + uses UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 2fdccf8e..19e934f4 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -3,7 +3,15 @@ unit UScreenScore; interface uses - UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes, ULCD, OpenGL; + UMenu, + SDL, + SysUtils, + UDisplay, + UMusic, + USongs, + UThemes, + ULCD; +// OpenGL; type TScreenScore = class(TMenu) @@ -49,11 +57,11 @@ type implementation -{{$IFDEF TRANSLATE} +//{$IFDEF TRANSLATE} uses UGraphic, UScreenSong, UMenuStatic, UTime, UMain, UIni, ULanguage; -{{$ELSE}{ -uses UGraphic, UScreenSong, UMenuStatic, UTime, UMain, UIni; -{{$ENDIF} +//{$ELSE} +//uses UGraphic, UScreenSong, UMenuStatic, UTime, UMain, UIni; +//{$ENDIF} function TScreenScore.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin Result := true; diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 20ad0957..6d3add87 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -2,8 +2,28 @@ unit UScreenSingModi; interface -uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, ULyrics, - TextGL, OpenGL12, BASS, UThemes, ULCD, UScreenSing, ModiSDK; +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + UIni, + ULog, + UTexture, + ULyrics, + TextGL, + OpenGL12, + BASS, + UThemes, + ULCD, + UScreenSing, + ModiSDK; type TScreenSingModi = class(TScreenSing) @@ -134,459 +154,10 @@ begin end; procedure TScreenSingModi.onShow; -{var - P: integer; - V1: boolean; - V2R: boolean; - V2M: boolean; - V3R: boolean; - NR: TRecR; //Line Bonus Mod } var I: Integer; begin - { Log.LogStatus('Begin', 'onShow'); - FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented - - // prepare players - SetLength(Player, PlayersPlay); -// Player[0].ScoreTotalI := 0; - - - case PlayersPlay of - 1: begin - V1 := true; - V2R := false; - V2M := false; - V3R := false; - end; - 2: begin - V1 := true; - V2R := true; - V2M := false; - V3R := false; - end; - 3: begin - V1 := true; - V2R := false; - V2M := true; - V3R := true; - end; - 4: begin // double screen - V1 := true; - V2R := true; - V2M := false; - V3R := false; - end; - 6: begin // double screen - V1 := true; - V2R := false; - V2M := true; - V3R := true; - end; - - end; - - - - Static[StaticP2R].Visible := V2R; - Static[StaticP2RScoreBG].Visible := V2R; - Text[TextP2R].Visible := V2R; - Text[TextP2RScore].Visible := V2R; - - Static[StaticP2M].Visible := V2M; - Static[StaticP2MScoreBG].Visible := V2M; - Text[TextP2M].Visible := V2M; - Text[TextP2MScore].Visible := V2M; - - Static[StaticP3R].Visible := V3R; - Static[StaticP3RScoreBG].Visible := V3R; - Text[TextP3R].Visible := V3R; - Text[TextP3RScore].Visible := V3R; - - - - // load notes - CzyscNuty; -// Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); - AktSong := CatSongs.Song[CatSongs.Selected]; - - WczytajCzesci(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName); - AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; -// AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer}{ + 20 {microphone}{ + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed - - // set movie - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin - OpenSmpeg(AktSong.Path + AktSong.Video); - SkipSmpeg(AktSong.VideoGAP + AktSong.Start); - AktSong.VideoLoaded := true; - end; - - // set background - if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then - Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background) - else - Tex_Background.TexNum := -1; - - // play music (I) - //Music.CaptureStart; - Music.MoveTo(AktSong.Start); -// Music.Play; - - // prepare timer (I) -// CountSkipTimeSet; - Czas.Teraz := AktSong.Start; - Czas.Razem := Music.Length; - if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000; - Czas.OldBeat := -1; - for P := 0 to High(Player) do - ClearScores(P); - - // main text - LyricMain.Clear; - LyricMain.X := 400; - LyricMain.Y := Skin_LyricsT; - LyricMain.Scale := 1.4; //1.4 - LyricMain.Align := 1; - - // sub text - LyricSub.Clear; - LyricSub.X := 400; - LyricSub.Y := Skin_LyricsT + 42; //40 - LyricSub.Align := 1; - - // set custom options - case Ini.LyricsFont of - 0: - begin - LyricMain.FontStyle := 0; - LyricSub.FontStyle := 0; - LyricMain.Size := 14; // 13 - LyricSub.Size := 14; // 13 - LyricMain.ColR := Skin_FontR; - LyricMain.ColG := Skin_FontG; - LyricMain.ColB := Skin_FontB; //Change für Crazy Joker - {LyricMain.ColSR := Skin_FontHighlightR; - LyricMain.ColSG := Skin_FontHighlightG; - LyricMain.ColSB := Skin_FontHighlightB;1aa5dc} { - LyricMain.ColSR := 26/255; - LyricMain.ColSG := 165/255; - LyricMain.ColSB := 220/255; - - LyricSub.ColR := 0.6; - LyricSub.ColG := 0.6; - LyricSub.ColB := 0.6; - end; - 1: - begin - LyricMain.FontStyle := 2; - LyricSub.FontStyle := 2; - LyricMain.Size := 14; - LyricSub.Size := 14; - LyricMain.ColR := 0.75; - LyricMain.ColG := 0.75; - LyricMain.ColB := 1; - LyricMain.ColSR := 0.5; - LyricMain.ColSG := 0.5; - LyricMain.ColSB := 1; - LyricSub.ColR := 0.8; - LyricSub.ColG := 0.8; - LyricSub.ColB := 0.8; - end; - 2: - begin - LyricMain.FontStyle := 3; - LyricSub.FontStyle := 3; - LyricMain.Size := 12; - LyricSub.Size := 12; - LyricMain.ColR := 0.75; - LyricMain.ColG := 0.75; - LyricMain.ColB := 1; - LyricMain.ColSR := 0.5; - LyricMain.ColSG := 0.5; - LyricMain.ColSB := 1; - LyricSub.ColR := 0.8; - LyricSub.ColG := 0.8; - LyricSub.ColB := 0.8; - end; - end; // case - - case Ini.LyricsEffect of - 0: LyricMain.Style := 1; // 0 - one selected, 1 - selected all to the current - 1: LyricMain.Style := 2; - 2: LyricMain.Style := 3; - 3: LyricMain.Style := 4; - end; // case - - // fill texts - LyricMain.AddCzesc(0); - LyricMain.Selected := -1; - LyricSub.AddCzesc(1); - LyricSub.Selected := -1; - - UpdateLCD; - - //Deactivate Pause - Paused := False; - - {Static[StaticP2R].Visible := V2R; - Static[StaticP2RScoreBG].Visible := V2R; - Text[TextP2R].Visible := V2R; - Text[TextP2RScore].Visible := V2R; - - Static[StaticP2M].Visible := V2M; - Static[StaticP2MScoreBG].Visible := V2M; - Text[TextP2M].Visible := V2M; - Text[TextP2MScore].Visible := V2M; - - Static[StaticP3R].Visible := V3R; - Static[StaticP3RScoreBG].Visible := V3R; - Text[TextP3R].Visible := V3R; - Text[TextP3RScore].Visible := V3R;} { - - //Set Position of Line Bonus - PhrasenBonus - if (Ini.LineBonus = 1) then //Show Line Bonus at Scores - begin - Case PlayersPlay of - 1: begin - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; - end; - - 2: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.X; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.X; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.X; - Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - end; - - 3: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - end; - - 4: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; - - //P4 - Player[3].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; - Player[3].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[3].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; - Player[3].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - end; - - 6: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - - //P4 - Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[3].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[3].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[3].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; - - //P5 - Player[4].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[4].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[4].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[4].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P6 - Player[5].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[5].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[5].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[5].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - end; - end; - end - else if (Ini.LineBonus = 2) then //Show Line Bonus at Notes - begin - //SingDrawNoteLines(Nr.Left + 10*ScreenX, 120, Nr.Right + 10*ScreenX, 12); - //SingDrawNoteLines(Nr.Left + 10*ScreenX, 245, Nr.Right + 10*ScreenX, 12); - //SingDrawNoteLines(Nr.Left + 10*ScreenX, 370, Nr.Right + 10*ScreenX, 12); - - // positions - if Ini.SingWindow = 0 then begin - NR.Left := 120; - end else begin - NR.Left := 20; - end; - NR.Right := 780; - - NR.Width := NR.Right - NR.Left; - NR.WMid := NR.Width / 2; - NR.Mid := NR.Left + NR.WMid; - - Case PlayersPlay of - 1: begin - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[0].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[0].LineBonus_StartY := Skin_P2_NotesB - 105; - end; - - 2: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - end; - - 3: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[0].LineBonus_TargetY := 120 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[0].LineBonus_StartY := 120 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[1].LineBonus_TargetY := 245 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[1].LineBonus_StartY := 245 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[2].LineBonus_TargetY := 370 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[2].LineBonus_StartY := 370 + 28; - end; - - 4: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[2].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[2].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P4 - Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[3].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[3].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - end; - - 6: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[0].LineBonus_TargetY := 120 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[0].LineBonus_StartY := 120 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[1].LineBonus_TargetY := 245 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[1].LineBonus_StartY := 245 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[2].LineBonus_TargetY := 370 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[2].LineBonus_StartY := 370 + 28; - - //P4 - Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[3].LineBonus_TargetY := 120 - 65 + 28; - Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[3].LineBonus_StartY := 120 + 28; - - //P5 - Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[4].LineBonus_TargetY := 245 - 65 + 28; - Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[4].LineBonus_StartY := 245 + 28; - - //P6 - Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[5].LineBonus_TargetY := 370 - 65 + 28; - Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[5].LineBonus_StartY := 370 + 28; - end; - end; - end; - //Set Position of Line Bonus - PhrasenBonus End - //Set Num of Empty Sentences for Phrasen Bonus - NumEmptySentences := 0; - for P := low(Czesci[0].Czesc) to high(Czesci[0].Czesc) do - if Czesci[0].Czesc[P].TotalNotes = 0 then Inc(NumEmptySentences); - - Log.LogStatus('End', 'onShow'); } - PlayersPlay := TeamInfo.NumTeams; if DLLMan.Selected.LoadSong then //Start with Song @@ -602,9 +173,9 @@ begin PlayerInfo.NumPlayers := PlayersPlay; for I := 0 to PlayerInfo.NumPlayers-1 do begin - PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); - PlayerInfo.Playerinfo[I].Score:= 0; - PlayerInfo.Playerinfo[I].Bar := 50; + PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); + PlayerInfo.Playerinfo[I].Score := 0; + PlayerInfo.Playerinfo[I].Bar := 50; PlayerInfo.Playerinfo[I].Enabled := True; end; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 9fe70522..41432356 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -2,6 +2,10 @@ unit UScreenSongMenu; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + uses UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; @@ -612,4 +616,4 @@ begin end; end. - \ No newline at end of file + 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. diff --git a/Game/Code/UltraStar.lpi b/Game/Code/UltraStar.lpi index 9d260f69..43d4cd5c 100644 --- a/Game/Code/UltraStar.lpi +++ b/Game/Code/UltraStar.lpi @@ -12,7 +12,7 @@ - + @@ -31,50 +31,46 @@ - + - - + + - + - - - - - + + + - + - - - + - - + + - + - - + + @@ -82,27 +78,21 @@ - - - + - - - + - - - + @@ -113,205 +103,395 @@ - - - - - + + + - - - - + + + + - - - - - + + + - + - - - + - - - + - - - + - - - + - + - - - + - - - + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index 793cc21a..aebf549c 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -8,6 +8,8 @@ program UltraStar; {$R 'UltraStar.res' 'UltraStar.rc'} +{$I switches.inc} + uses //------------------------------ @@ -19,7 +21,7 @@ uses bass in 'lib\bass\delphi\bass.pas', -(* + {$IFDEF UseMIDIPort} midiout in 'lib\midi\midiout.pas', midiin in 'lib\midi\midiin.pas', Circbuf in 'lib\midi\CIRCBUF.PAS', @@ -28,7 +30,7 @@ uses MidiCons in 'lib\midi\MidiCons.PAS', MidiFile in 'lib\midi\MidiFile.PAS', Delphmcb in 'lib\midi\Delphmcb.PAS', -*) + {$ENDIF} avcodec in 'lib\ffmpeg\avcodec.pas', avformat in 'lib\ffmpeg\avformat.pas', @@ -45,7 +47,6 @@ uses //Includes - Menu System //------------------------------ UMenu in 'Menu\UMenu.pas', -(* UDisplay in 'Menu\UDisplay.pas', UMenuStatic in 'Menu\UMenuStatic.pas', UMenuText in 'Menu\UMenuText.pas', @@ -55,7 +56,7 @@ uses UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', UDrawTexture in 'Menu\UDrawTexture.pas', UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', -*) + //------------------------------ //Includes - Classes @@ -68,11 +69,10 @@ uses UIni in 'Classes\UIni.pas', UTexture in 'Classes\UTexture.pas', -(* + UGraphic in 'Classes\UGraphic.pas', UMusic in 'Classes\UMusic.pas', ULanguage in 'Classes\ULanguage.pas', - UMain in 'Classes\UMain.pas', UDraw in 'Classes\UDraw.pas', URecord in 'Classes\URecord.pas', TextGL in 'Classes\TextGL.pas', @@ -91,20 +91,17 @@ uses UDLLManager in 'Classes\UDLLManager.pas', UParty in 'Classes\UParty.pas', UPlaylist in 'Classes\UPlaylist.pas', -*) //------------------------------ //Includes - Video Support //------------------------------ -(* UVideo in 'Classes\UVideo.pas', -*) + //------------------------------ //Includes - Screens //------------------------------ UScreenLoading in 'Screens\UScreenLoading.pas', -(* UScreenWelcome in 'Screens\UScreenWelcome.pas', UScreenMain in 'Screens\UScreenMain.pas', UScreenName in 'Screens\UScreenName.pas', @@ -132,26 +129,24 @@ uses UScreenStatDetail in 'Screens\UScreenStatDetail.pas', UScreenCredits in 'Screens\UScreenCredits.pas', UScreenPopup in 'Screens\UScreenPopup.pas', -*) + //------------------------------ //Includes - Screens PartyMode //------------------------------ -(* UScreenSingModi in 'Screens\UScreenSingModi.pas', UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', UScreenPartyScore in 'Screens\UScreenPartyScore.pas', UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', UScreenPartyWin in 'Screens\UScreenPartyWin.pas', -*) + //------------------------------ //Includes - Modi SDK //------------------------------ -(* ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', -*) + //------------------------------ //Includes - Delphi diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index b980e754..8bfbff34 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -1,5 +1,7 @@ {$IFDEF FPC} {$UNDEF UseSerialPort} + {$UNDEF UseMIDIPort} {$ELSE} {$DEFINE UseSerialPort} + {$DEFINE UseMIDIPort} {$ENDIF} -- cgit v1.2.3 From 62c82114318ed04ce42617fa9ce2e179834dbda4 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 19 Sep 2007 11:44:10 +0000 Subject: added UCommon ( in classes ) for lazarus... common functions needed for lazarus ( and others ) can be put in here. also this now compiles on lazarus.. ( dosnt link yet... but I dont get any critical compiler errors ) tested to compile in my delphi, and basic functionality is fine. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@395 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.pas | 11 +- Game/Code/Classes/UCommon.pas | 98 ++++++++ Game/Code/Classes/UCovers.pas | 4 + Game/Code/Classes/UDraw.pas | 1 - Game/Code/Classes/UFiles.pas | 9 + Game/Code/Classes/UGraphicClasses.pas | 14 +- Game/Code/Classes/ULog.pas | 4 + Game/Code/Classes/UMusic.pas | 26 ++- Game/Code/Classes/USongs.pas | 6 + Game/Code/Classes/UTexture.pas | 45 +++- Game/Code/Classes/UThemes.pas | 7 +- Game/Code/Classes/UVideo.pas | 9 +- Game/Code/Menu/UDisplay.pas | 20 +- Game/Code/Menu/UMenu.pas | 7 +- Game/Code/Screens/UScreenCredits.pas | 12 +- Game/Code/Screens/UScreenEditConvert.pas | 14 +- Game/Code/Screens/UScreenEditSub.pas | 12 +- Game/Code/Screens/UScreenScore.pas | 14 +- Game/Code/Screens/UScreenSing.pas | 10 +- Game/Code/Screens/UScreenSong.pas | 7 +- Game/Code/Screens/UScreenTop5.pas | 13 +- Game/Code/UltraStar.dpr | 1 + Game/Code/UltraStar.lpi | 389 ++++++++++++++----------------- Game/Code/UltraStar.lpr | 6 +- Game/Code/lib/midi/MidiFile.pas | 13 +- Game/Code/lib/midi/Midiin.pas | 4 +- 26 files changed, 482 insertions(+), 274 deletions(-) create mode 100644 Game/Code/Classes/UCommon.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index 0f4ae82e..aa5fa18b 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -2,7 +2,16 @@ unit TextGL; interface -uses OpenGL12, SDL, UTexture, Classes, ULog; +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + + +uses OpenGL12, + SDL, + UTexture, + Classes, + ULog; procedure BuildFont; // Build Our Bitmap Font procedure KillFont; // Delete The Font diff --git a/Game/Code/Classes/UCommon.pas b/Game/Code/Classes/UCommon.pas new file mode 100644 index 00000000..f25e025b --- /dev/null +++ b/Game/Code/Classes/UCommon.pas @@ -0,0 +1,98 @@ +unit UCommon; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses + windows; + +{$IFDEF FPC} + +type + TWndMethod = procedure(var Message: TMessage) of object; + +function RandomRange(aMin: Integer; aMax: Integer) : Integer; +function AllocateHWnd(Method: TWndMethod): HWND; +procedure DeallocateHWnd(Wnd: HWND); + +function MaxValue(const Data: array of Double): Double; +function MinValue(const Data: array of Double): Double; +{$ENDIF} + +implementation + +{$IFDEF FPC} + +function MaxValue(const Data: array of Double): Double; +var + I: Integer; +begin + Result := Data[Low(Data)]; + for I := Low(Data) + 1 to High(Data) do + if Result < Data[I] then + Result := Data[I]; +end; + +function MinValue(const Data: array of Double): Double; +var + I: Integer; +begin + Result := Data[Low(Data)]; + for I := Low(Data) + 1 to High(Data) do + if Result > Data[I] then + Result := Data[I]; +end; + +function RandomRange(aMin: Integer; aMax: Integer) : Integer; +begin +RandomRange := Random(aMax-aMin) + aMin ; +end; + + + +// TODO : JB this is dodgey and bad... find a REAL solution ! +function AllocateHWnd(Method: TWndMethod): HWND; +var + TempClass: TWndClass; + ClassRegistered: Boolean; +begin +(* + UtilWindowClass.hInstance := HInstance; +{$IFDEF PIC} + UtilWindowClass.lpfnWndProc := @DefWindowProc; +{$ENDIF} + ClassRegistered := GetClassInfo(HInstance, UtilWindowClass.lpszClassName, TempClass); + if not ClassRegistered or (TempClass.lpfnWndProc <> @DefWindowProc) then + begin + if ClassRegistered then + Windows.UnregisterClass(UtilWindowClass.lpszClassName, HInstance); + Windows.RegisterClass(UtilWindowClass); + end; + Result := CreateWindowEx(WS_EX_TOOLWINDOW, UtilWindowClass.lpszClassName, '', WS_POPUP {+ 0}, 0, 0, 0, 0, 0, 0, HInstance, nil); +*) + Result := CreateWindowEx(WS_EX_TOOLWINDOW, '', '', WS_POPUP {+ 0}, 0, 0, 0, 0, 0, 0, HInstance, nil); + +(* + if Assigned(Method) then + SetWindowLong(Result, GWL_WNDPROC, Longint(MakeObjectInstance(Method))); +*) +end; + +procedure DeallocateHWnd(Wnd: HWND); +var + Instance: Pointer; +begin + Instance := Pointer(GetWindowLong(Wnd, GWL_WNDPROC)); + DestroyWindow(Wnd); + +// if Instance <> @DefWindowProc then +// FreeObjectInstance(Instance); +end; + +{$ENDIF} + + +end. diff --git a/Game/Code/Classes/UCovers.pas b/Game/Code/Classes/UCovers.pas index 4040b4d8..efed1435 100644 --- a/Game/Code/Classes/UCovers.pas +++ b/Game/Code/Classes/UCovers.pas @@ -2,6 +2,10 @@ unit UCovers; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + uses OpenGL12, Windows, Math, diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index cbfafbe6..a28f1efc 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -9,7 +9,6 @@ interface uses UThemes, ModiSDK, UGraphicClasses; - // dialogs; procedure SingDraw; procedure SingModiDraw (PlayerInfo: TPlayerInfo); diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index 008061a4..bbb22136 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -2,6 +2,10 @@ unit UFiles; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + uses SysUtils, ULog, UMusic, @@ -108,7 +112,12 @@ begin //Required Information Song.Mp3 := ''; + {$IFDEF FPC} + Song.BPM := NULL; + {$ELSE} Song.BPM := 0; + {$ENDIF} + Song.GAP := 0; Song.Start := 0; Song.Finish := 0; diff --git a/Game/Code/Classes/UGraphicClasses.pas b/Game/Code/Classes/UGraphicClasses.pas index 83d192d6..761ec058 100644 --- a/Game/Code/Classes/UGraphicClasses.pas +++ b/Game/Code/Classes/UGraphicClasses.pas @@ -3,6 +3,7 @@ unit UGraphicClasses; interface uses UTexture; + const DelayBetweenFrames : Cardinal = 60; type @@ -79,7 +80,18 @@ type var GoldenRec : TEffectManager; implementation -uses sysutils, Windows,OpenGl12, UIni, UMain, UThemes, USkins, UGraphic, UDrawTexture, math, dialogs; + +uses sysutils, + Windows, + OpenGl12, + UIni, + UMain, + UThemes, + USkins, + UGraphic, + UDrawTexture, + UCommon, + math; //TParticle Constructor TParticle.Create(cX,cY: Real; cScreen: Integer; cLive: Byte; cFrame : integer; cRecArrayIndex : Integer; cStarType : TParticleType; Player: Cardinal); diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index 2233ec1b..4a18b8e2 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -2,6 +2,10 @@ unit ULog; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + uses Classes; type diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index f9c6457d..be585ee1 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -2,6 +2,11 @@ unit UMusic; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + + uses Classes, Windows, Messages, @@ -180,7 +185,14 @@ const ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); implementation -uses UGraphic, URecord, UFiles, UIni, UMain, UThemes; + +uses UCommon, + UGraphic, + URecord, + UFiles, + UIni, + UMain, + UThemes; procedure InitializeSound; begin @@ -195,12 +207,18 @@ var begin Log.BenchmarkStart(4); Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); + Loaded := false; - Loop := false; - fHWND := AllocateHWND( nil); + Loop := false; + + fHWND := AllocateHWND( nil); // TODO : JB - can we do something different here ?? lazarus didnt like this function - if not BASS_Init(1, 44100, 0, fHWND, nil) then begin + if not BASS_Init(1, 44100, 0, fHWND, nil) then + begin + {$IFNDEF FPC} + // TODO : JB find a way to do this nice.. Application.MessageBox ('Could not initialize BASS', 'Error'); + {$ENDIF} Exit; end; diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 7065024b..f5afbee2 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -1,6 +1,12 @@ unit USongs; interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + uses SysUtils, ULog, UTexture, UCatCovers; type diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index d1ca0917..4eb00b4b 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -1,10 +1,5 @@ unit UTexture; -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - // Plain (alpha = 1) // Transparent // Transparent Range @@ -17,16 +12,24 @@ unit UTexture; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + uses OpenGL12, Windows, Math, Classes, SysUtils, - {$IFNDEF FPC} Graphics, + + {$IFDEF FPC} + lazjpeg, + {$ELSE} JPEG, PNGImage, {$ENDIF} + UCommon, UThemes; @@ -192,11 +195,19 @@ var begin hls[0]:=hue; - clr[0]:=src[0]/255; clr[1]:=src[1]/255; clr[2]:=src[2]/255; + clr[0] := src[0]/255; + clr[1] := src[1]/255; + clr[2] := src[2]/255; + //calculate luminance and saturation from rgb - hls[1]:=maxvalue(clr); //l:=... - delta:=hls[1]-minvalue(clr); - if hls[1]=0.0 then hls[2]:=0.0 else hls[2]:=delta/hls[1]; //v:=... + hls[1] := maxvalue(clr); //l:=... + delta := hls[1] - minvalue(clr); + + if hls[1] = 0.0 then + hls[2] := 0.0 + else + hls[2] := delta/hls[1]; //v:=... + // calc new rgb from our hls (h from color, l ans s from pixel) // if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense begin @@ -287,7 +298,10 @@ var Res: TResourceStream; TextureB: TBitmap; TextureJ: TJPEGImage; + {$IFNDEF FPC} TexturePNG: TPNGObject; + {$ENDIF} + TextureAlpha: array of byte; AlphaPtr: PByte; TransparentColor: TColor; @@ -306,6 +320,8 @@ var RGBPtr: PByte; myHue: Double; begin + {$IFNDEF FPC} // TODO : JB eeeew this is a nasty one... + // but lazarus implementation scanlines is different :( Log.BenchmarkStart(4); Mipmapping := true; @@ -347,7 +363,10 @@ begin TextureJ.Free; end - else if Format = 'PNG' then begin + else if Format = 'PNG' then + begin + {$IFNDEF FPC} + // TODO : JB - fix this for lazarus.. TexturePNG := TPNGObject.Create; if FromRegistry then TexturePNG.LoadFromStream(Res) else begin @@ -389,6 +408,7 @@ begin setlength(TextureAlpha,0); // just no special transparency for unimplemented transparency types (ptmBit) // transparent png hack end TexturePNG.Free; + {$ENDIF} end; if FromRegistry then Res.Free; @@ -872,7 +892,8 @@ begin if Log.BenchmarkTimeLength[4] >= 1 then Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4); - end; // logerror + end; // logerror + {$ENDIF} end; {procedure ResizeTexture(s: pbytearray; d: pbytearray); diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index b2e2b01e..6436ee39 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -7,7 +7,9 @@ interface {$ENDIF} uses -IniFiles, SysUtils, Classes; + IniFiles, + SysUtils, + Classes; type TRGB = record @@ -739,7 +741,8 @@ uses {{$IFDEF TRANSLATE} ULanguage, {{$ENDIF} -USkins, UIni, Dialogs; + USkins, + UIni; constructor TTheme.Create(FileName: string); begin diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index c97057ac..4c8a4076 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -5,10 +5,6 @@ # based on 'An ffmpeg and SDL Tutorial' (http://www.dranger.com/ffmpeg/) # #############################################################################} -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - //{$define DebugDisplay} // uncomment if u want to see the debug stuff {$define DebugFrames} {$define Info} @@ -18,6 +14,11 @@ unit UVideo; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + uses SDL, UGraphicClasses, textgl, diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index 6ad01406..160e8a73 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -2,7 +2,15 @@ unit UDisplay; interface -uses Windows, SDL, UMenu, OpenGL12, SysUtils; +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses Windows, + SDL, + UMenu, + OpenGL12, + SysUtils; type TDisplay = class @@ -53,10 +61,12 @@ var implementation uses - {$IFNDEF FPC} - Graphics, + {$IFDEF FPC} + lazjpeg, + {$ELSE} JPEG, {$ENDIF} + graphics, TextGL, // UFiles, UMain, @@ -320,8 +330,8 @@ begin end; glReadPixels(0, 0, ScreenW, ScreenH, GL_RGBA, GL_UNSIGNED_BYTE, @PrintScreenData[0]); - Bitmap := TBitmap.Create; - Bitmap.Width := ScreenW; + Bitmap := TBitmap.Create; + Bitmap.Width := ScreenW; Bitmap.Height := ScreenH; for Y := 0 to ScreenH-1 do diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 3c50967d..1e6c1e87 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -154,7 +154,12 @@ const implementation -uses UMain, UDrawTexture, UGraphic, UDisplay, UCovers, USkins, Dialogs; +uses UMain, + UDrawTexture, + UGraphic, + UDisplay, + UCovers, + USkins; destructor TMenu.Destroy; begin diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 21e164b9..3b1efc6e 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -104,24 +104,16 @@ const implementation -uses // Dialogs, - Windows, +uses Windows, UGraphic, UMain, UIni, USongs, Textgl, -// opengl, ULanguage, + UCommon, Math; -{$IFDEF FPC} -// TODO : JB - move this to a lazarus common file for ultrastar -function RandomRange(aMin: Integer; aMax: Integer) : Integer; -begin -RandomRange := Random(aMax-aMin) + aMin ; -end; -{$ENDIF} function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index cb6aef6d..762f84c2 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -2,6 +2,10 @@ unit UScreenEditConvert; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + {$I switches.inc} uses UMenu, @@ -353,11 +357,13 @@ begin if ((ATrack[T].Status div 1) and 1) = 1 then Inc(Result); end; +{$IFDEF UseMIDIPort} procedure TScreenEditConvert.MidiFile1MidiEvent(event: PMidiEvent); begin // Log.LogStatus(IntToStr(event.event), 'MIDI'); MidiOut.PutShort(event.event, event.data1, event.data2); end; +{$ENDIF} constructor TScreenEditConvert.Create; var @@ -407,6 +413,7 @@ var C: integer; // channel CN: integer; // channel note begin +{$IFDEF UseMIDIPort} MidiOut := TMidiOutput.Create(nil); if Ini.Debug = 1 then MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table @@ -486,6 +493,7 @@ begin end; Interaction := 0; +{$ENDIF} end; function TScreenEditConvert.Draw: boolean; @@ -552,7 +560,9 @@ begin end; // playing line - X := 60+MidiFile.GetCurrentTime/MidiFile.GetTrackLength*730; + {$IFDEF UseMIDIPort} + X := 60 + MidiFile.GetCurrentTime/MidiFile.GetTrackLength*730; + {$ENDIF} DrawLine(X, Y, X, Bottom, 0.3, 0.3, 0.3); @@ -560,8 +570,10 @@ end; procedure TScreenEditConvert.onHide; begin +{$IFDEF UseMIDIPort} MidiOut.Close; MidiOut.Free; +{$ENDIF} end; end. diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 7184b0b6..3843fbf4 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -1169,11 +1169,12 @@ begin Exit; end else begin + {$IFDEF UseMIDIPort} MidiOut := TMidiOutput.Create(nil); if Ini.Debug = 1 then MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table MidiOut.Open; - + {$ENDIF} Text[TextTitle].Text := AktSong.Title; Text[TextArtist].Text := AktSong.Artist; Text[TextMp3].Text := AktSong.Mp3; @@ -1224,11 +1225,13 @@ begin if PlaySentenceMidi then begin MidiPos := USTime.GetTime - MidiTime + MidiStart; + {$IFDEF UseMIDIPort} // stop the music if (MidiPos > MidiStop) then begin MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127); PlaySentenceMidi := false; end; + {$ENDIF} // click AktBeat := Floor(GetMidBeat(MidiPos - AktSong.GAP / 1000)); @@ -1236,13 +1239,16 @@ begin if AktBeat <> LastClick then begin for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do - if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then begin + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then + begin + {$IFDEF UseMIDIPort} LastClick := AktBeat; if Pet > 0 then MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet-1].Ton + 60, 127); MidiOut.PutShort($91, Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Ton + 60, 127); MidiLastNote := Pet; + {$ENDIF} end; end; @@ -1312,8 +1318,10 @@ end; procedure TScreenEditSub.onHide; begin + {$IFDEF UseMIDIPort} MidiOut.Close; MidiOut.Free; + {$ENDIF} //Music.SetVolume(100); end; diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 19e934f4..42edf4c9 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -2,6 +2,10 @@ unit UScreenScore; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + uses UMenu, SDL, @@ -274,7 +278,7 @@ begin Text[TextName[PP]].Text := Ini.Name[P]; - {{$IFDEF TRANSLATE} + //{$IFDEF TRANSLATE} case (Player[P].ScoreTotalI) of 0..2000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_TONE_DEAF'); 2010..4000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_AMATEUR'); @@ -284,7 +288,7 @@ begin 9010..9800: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_SUPERSTAR'); 9810..10000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_ULTRASTAR'); end; - {{$ELSE}{ + (* {$ELSE}{ case (Player[P].ScoreTotalI) of 0..2000: Text[TextScore[PP]].Text := 'Tone Deaf'; 2010..4000: Text[TextScore[PP]].Text := 'Amateur'; @@ -294,7 +298,7 @@ begin 9010..9800: Text[TextScore[PP]].Text := 'Superstar'; 9810..10000: Text[TextScore[PP]].Text := 'Ultrastar'; end; - {$ENDIF} + {$ENDIF} *) S := IntToStr(Player[P].ScoreI); while (Length(S)<4) do S := '0' + S; @@ -313,10 +317,12 @@ begin Text[TextTotalScore[PP]].Text := S; // Level bar length -{ Lev := ((Round(Player[P].Punkty) div 10) * 10) / 10000; +(* + Lev := ((Round(Player[P].Punkty) div 10) * 10) / 10000; Static[StaticLevel[PP]].Texture.H := Round(Static[StaticBackLevel[PP]].Texture.H * Lev); Static[StaticLevel[PP]].Texture.Y := Static[StaticBackLevel[PP]].Texture.Y + Static[StaticBackLevel[PP]].Texture.H - Static[StaticLevel[PP]].Texture.H; Static[StaticLevelRound[PP]].Texture.Y := Static[StaticLevel[PP]].Texture.Y - Static[StaticLevelRound[PP]].Texture.H;} +*) // doesn't align too much... (to fix) // hint: play with wrapping textures // resolution: setting TexY1 and TexY2 to 0.1 and 0.9 diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index a5f6a317..1dd31ae9 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -2,6 +2,11 @@ unit UScreenSing; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, ULyrics, TextGL, OpenGL12, BASS, UThemes, ULCD, UGraphicClasses, UVideo; @@ -364,8 +369,9 @@ begin // set movie if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin -{ OpenSmpeg(AktSong.Path + AktSong.Video); - SkipSmpeg(AktSong.VideoGAP + AktSong.Start);} +(* OpenSmpeg(AktSong.Path + AktSong.Video); + SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*) + // todo: VideoGap and Start time verwursten FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); FFmpegSkip(AktSong.VideoGAP + AktSong.Start); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 2d10c9dc..7b16c315 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1078,7 +1078,8 @@ begin end; end; -{procedure TScreenSong.SetScroll4; // rotate +(* +procedure TScreenSong.SetScroll4; // rotate var B: integer; Wsp: real; @@ -1158,7 +1159,7 @@ begin else Button[B].Visible := False; end; end; -end; } +end; *) procedure TScreenSong.SetScroll5; // rotate var @@ -2003,4 +2004,4 @@ FixSelected; } end; -end. \ No newline at end of file +end. diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas index f9de4114..4971d12a 100644 --- a/Game/Code/Screens/UScreenTop5.pas +++ b/Game/Code/Screens/UScreenTop5.pas @@ -2,6 +2,11 @@ unit UScreenTop5; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + uses UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes, ULCD; @@ -131,7 +136,7 @@ function TScreenTop5.Draw: boolean; C: integer;} begin // Singstar - let it be...... with 6 statics -{ if PlayersPlay = 6 then begin +(* if PlayersPlay = 6 then begin for Item := 4 to 6 do begin if ScreenAct = 1 then P := Item-4; if ScreenAct = 2 then P := Item-1; @@ -152,10 +157,10 @@ begin Static[StaticBoxLightest[Item]].Texture.ColG, Static[StaticBoxLightest[Item]].Texture.ColB, 'P4Dark'); - end;} + end; } -{ end; - end;} + end; + end; *) inherited Draw; end; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index df4846b3..474bf173 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -60,6 +60,7 @@ uses //------------------------------ //Includes - Classes //------------------------------ + UCommon in 'Classes\UCommon.pas', UGraphic in 'Classes\UGraphic.pas', UTexture in 'Classes\UTexture.pas', UMusic in 'Classes\UMusic.pas', diff --git a/Game/Code/UltraStar.lpi b/Game/Code/UltraStar.lpi index 43d4cd5c..519db01f 100644 --- a/Game/Code/UltraStar.lpi +++ b/Game/Code/UltraStar.lpi @@ -12,7 +12,7 @@ - + @@ -31,14 +31,22 @@ - + + + + + + + + + - - + + - + @@ -46,22 +54,25 @@ - + - - - + + + + + + - - + + @@ -69,183 +80,206 @@ - - + + - + - + + + - - + + + + - + - + - + + + - - + + - - - + + + + + - + + + - - + + + + - + - + - + + + - + - + - - - - - + + - - - + + + + + - + - + - + + + - - - + + + + + - + - + + + - - - + + + + + - + - + - + + + - - - - + + + + @@ -253,17 +287,17 @@ - - + + - - - - + + + + @@ -271,23 +305,25 @@ - - + + - + + + - - + + @@ -295,8 +331,8 @@ - - + + @@ -304,8 +340,8 @@ - - + + @@ -313,8 +349,8 @@ - - + + @@ -322,8 +358,8 @@ - - + + @@ -331,8 +367,8 @@ - - + + @@ -340,8 +376,8 @@ - - + + @@ -349,151 +385,80 @@ - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index aebf549c..2e2a98a2 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -61,14 +61,16 @@ uses //------------------------------ //Includes - Classes //------------------------------ + + UCommon in 'Classes\UCommon.pas', UTime in 'Classes\UTime.pas', UCommandLine in 'Classes\UCommandLine.pas', ULog in 'Classes\ULog.pas', UMain in 'Classes\UMain.pas', - UIni in 'Classes\UIni.pas', - UTexture in 'Classes\UTexture.pas', + UIni in 'Classes\UIni.pas', + UTexture in 'Classes\UTexture.pas', UGraphic in 'Classes\UGraphic.pas', UMusic in 'Classes\UMusic.pas', diff --git a/Game/Code/lib/midi/MidiFile.pas b/Game/Code/lib/midi/MidiFile.pas index 5c15481e..10b64a80 100644 --- a/Game/Code/lib/midi/MidiFile.pas +++ b/Game/Code/lib/midi/MidiFile.pas @@ -91,8 +91,17 @@ unit MidiFile; interface uses - Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, - stdctrls, ExtCtrls, WinProcs; + Windows, + Messages, + SysUtils, + Classes, + Graphics, + Controls, + Forms, + stdctrls, + ExtCtrls, + WinProcs; + type TChunkType = (illegal, header, track); TFileFormat = (single, multi_synch, multi_asynch); diff --git a/Game/Code/lib/midi/Midiin.pas b/Game/Code/lib/midi/Midiin.pas index 2f2e76c0..32a17c51 100644 --- a/Game/Code/lib/midi/Midiin.pas +++ b/Game/Code/lib/midi/Midiin.pas @@ -212,7 +212,9 @@ procedure Register; {====================================================================} implementation -uses Graphics, Controls, Forms, Dialogs; +uses Controls, + Forms, + Graphics; (* Not used in Delphi 3 { This is the callback procedure in the external DLL. -- cgit v1.2.3 From 90bf63406cd1dbcc9c041a858ef2f030d58f1f25 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 19 Sep 2007 12:10:31 +0000 Subject: now compiles & Links ... not running though yet. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@396 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.lpi | 153 ++++++++++++++++++++---------------------------- Game/Code/UltraStar.lpr | 8 ++- 2 files changed, 69 insertions(+), 92 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.lpi b/Game/Code/UltraStar.lpi index 519db01f..95603bb6 100644 --- a/Game/Code/UltraStar.lpi +++ b/Game/Code/UltraStar.lpi @@ -12,7 +12,7 @@ - + @@ -31,22 +31,14 @@ - - - - - - - - - + - - + + - + @@ -59,48 +51,42 @@ - - - + + + + + - - - - - - - - @@ -120,45 +106,35 @@ - - - - - - - + + - - - - - @@ -179,9 +155,7 @@ - - @@ -202,18 +176,14 @@ - - - - @@ -227,36 +197,28 @@ - - - - - - - - @@ -269,51 +231,41 @@ - - - + - - - - - - - - - + @@ -322,117 +274,91 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -446,9 +372,7 @@ - - @@ -457,8 +381,54 @@ + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -471,6 +441,7 @@ + diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index 2e2a98a2..40fb582c 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -6,7 +6,9 @@ program UltraStar; {$MODE DELPHI} {$ENDIF} -{$R 'UltraStar.res' 'UltraStar.rc'} +{$IFNDEF FPC} + {$R 'UltraStar.res' 'UltraStar.rc'} +{$ENDIF} {$I switches.inc} @@ -62,6 +64,10 @@ uses //Includes - Classes //------------------------------ + {$IFDEF FPC} + Ulazjpeg in 'Classes\Ulazjpeg.pas', + {$ENDIF} + UCommon in 'Classes\UCommon.pas', UTime in 'Classes\UTime.pas', UCommandLine in 'Classes\UCommandLine.pas', -- cgit v1.2.3 From 84beb7412eaca48cbf5c9915b83e5f8c79c9a0e7 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 19 Sep 2007 13:13:37 +0000 Subject: fixes to get working in lazarus.. compiling, linking, starting to run.. just fixing stuff :) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@397 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.pas | 51 ++++++++--- Game/Code/Classes/UFiles.pas | 2 +- Game/Code/Classes/UTexture.pas | 5 +- Game/Code/Menu/UDisplay.pas | 2 +- Game/Code/UltraStar.lpi | 188 ++++++++++++++++++++++++++++++++--------- Game/Code/UltraStar.lpr | 7 +- 6 files changed, 191 insertions(+), 64 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index aa5fa18b..12a9a8dc 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -59,13 +59,31 @@ var implementation -uses UMain, Windows, SysUtils, UGraphic; +uses UMain, + Windows, + SysUtils, + {$IFDEF FPC} + LResources, + {$ENDIF} + UGraphic; procedure BuildFont; // Build Our Bitmap Font + + procedure loadfont( aID : integer; aType, aResourceName : String); + var + Rejestr: TResourceStream; + begin + Rejestr := TResourceStream.Create(HInstance, aResourceName , pchar( aType ) ); + try + Rejestr.Read(Fonts[ aID ].Width, 256); + finally + Rejestr.Free; + end; + end; + var font: HFONT; // Windows Font ID h_dc: hdc; - Rejestr: TResourceStream; Pet: integer; begin ActFont := 0; @@ -102,21 +120,21 @@ begin Fonts[4].Outline := 5;} - Rejestr := TResourceStream.Create(HInstance, 'Font', 'FNT'); - Rejestr.Read(Fonts[0].Width, 256); - Rejestr.Free; - Rejestr := TResourceStream.Create(HInstance, 'FontB', 'FNT'); - Rejestr.Read(Fonts[1].Width, 256); - Rejestr.Free; + {$IFDEF FPC} + loadfont( 0, 'DAT', 'eurostar_regular' ); + loadfont( 1, 'DAT', 'eurostar_regular_bold' ); + loadfont( 2, 'DAT', 'Outline 1' ); + loadfont( 3, 'DAT', 'Outline 2' ); + {$ELSE} + loadfont( 0, 'FNT', 'Font' ); + loadfont( 1, 'FNT', 'FontB' ); + loadfont( 2, 'FNT', 'Font0' ); + loadfont( 3, 'FNT', 'FontO2' ); + {$ENDIF} + - Rejestr := TResourceStream.Create(HInstance, 'FontO', 'FNT'); - Rejestr.Read(Fonts[2].Width, 256); - Rejestr.Free; - Rejestr := TResourceStream.Create(HInstance, 'FontO2', 'FNT'); - Rejestr.Read(Fonts[3].Width, 256); - Rejestr.Free; { Rejestr := TResourceStream.Create(HInstance, 'FontO', 'FNT'); Rejestr.Read(Fonts[4].Width, 256); @@ -351,4 +369,9 @@ begin Fonts[ActFont].AspectW := Aspect; end; +initialization + {$I UltraStar.lrs} + end. + + diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index bbb22136..34342e26 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -113,7 +113,7 @@ begin //Required Information Song.Mp3 := ''; {$IFDEF FPC} - Song.BPM := NULL; + setlength( Song.BPM, 0 ); {$ELSE} Song.BPM := 0; {$ENDIF} diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 4eb00b4b..c1862828 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -21,11 +21,10 @@ uses OpenGL12, Math, Classes, SysUtils, - Graphics, - {$IFDEF FPC} - lazjpeg, + ulazjpeg, {$ELSE} + Graphics, JPEG, PNGImage, {$ENDIF} diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index 160e8a73..ed65d62d 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -62,7 +62,7 @@ implementation uses {$IFDEF FPC} - lazjpeg, + ulazjpeg, {$ELSE} JPEG, {$ENDIF} diff --git a/Game/Code/UltraStar.lpi b/Game/Code/UltraStar.lpi index 95603bb6..77bd613c 100644 --- a/Game/Code/UltraStar.lpi +++ b/Game/Code/UltraStar.lpi @@ -31,14 +31,19 @@ - + + + + + + - - + + - + @@ -51,13 +56,10 @@ - - - - - - - + + + + @@ -84,9 +86,11 @@ - - + + + + @@ -134,7 +138,7 @@ - + @@ -181,9 +185,11 @@ - - + + + + @@ -265,9 +271,7 @@ - - @@ -384,50 +388,154 @@ - - + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index 40fb582c..6aa8b53a 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -4,9 +4,7 @@ program UltraStar; {$IFDEF FPC} {$MODE DELPHI} -{$ENDIF} - -{$IFNDEF FPC} +{$ELSE} {$R 'UltraStar.res' 'UltraStar.rc'} {$ENDIF} @@ -209,7 +207,6 @@ begin Log.Enabled := Not Params.NoLog; Log.BenchmarkStart(0); -{* // Language Log.BenchmarkStart(1); Log.LogStatus('Initialize Paths', 'Initialization'); InitializePaths; @@ -384,6 +381,6 @@ begin //------------------------------ if Ini.LPT = 1 then LCD.Clear; if Ini.LPT = 2 then Light.TurnOff; -*} + Log.Free; end. -- cgit v1.2.3 From bf8524bf03d38784160ede29e3ab58c6455a17be Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 19 Sep 2007 13:15:08 +0000 Subject: added my lazarus batch files that make life easy. sorry for the absolute paths. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@398 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/build.bat | 4 ++++ Game/Code/lazres-UltraStar.bat | 2 ++ 2 files changed, 6 insertions(+) create mode 100644 Game/Code/build.bat create mode 100644 Game/Code/lazres-UltraStar.bat (limited to 'Game/Code') diff --git a/Game/Code/build.bat b/Game/Code/build.bat new file mode 100644 index 00000000..5ede5b0f --- /dev/null +++ b/Game/Code/build.bat @@ -0,0 +1,4 @@ +C:\lazarus\fpc\2.0.4\bin\i386-win32\ppc386.exe -S2cgi -OG1 -gl -vewnhi -l -Filib\JEDI-SDLv1.0\SDL\Pas\ -Fu..\..\..\..\..\lazarus\components\jpeg\lib\i386-win32\ -Fu..\..\..\..\..\lazarus\components\images\lib\i386-win32\ -Fu..\..\..\..\..\lazarus\lcl\units\i386-win32\ -Fu..\..\..\..\..\lazarus\lcl\units\i386-win32\win32\ -Fu..\..\..\..\..\lazarus\packager\units\i386-win32\ -Fu. -oUltraStar.exe -dLCL -dLCLwin32 UltraStar.lpr +rem C:\lazarus\fpc\2.0.4\bin\i386-win32\ppc386.exe -S2cgi -OG1 -gl -vewnhi -l -Filib\JEDI-SDLv1.0\SDL\Pas\ -Fu. -oUltraStar.exe UltraStar.lpr + +move UltraStar.exe ..\..\ \ No newline at end of file diff --git a/Game/Code/lazres-UltraStar.bat b/Game/Code/lazres-UltraStar.bat new file mode 100644 index 00000000..cb2617f0 --- /dev/null +++ b/Game/Code/lazres-UltraStar.bat @@ -0,0 +1,2 @@ +C:\lazarus\tools\lazres.exe UltraStar.lrs "..\Fonts\Normal\eurostar_regular.png" "..\Fonts\Normal\eurostar_regular.dat" "..\Fonts\Bold\eurostar_regular_bold.png" "..\Fonts\Bold\eurostar_regular_bold.dat" "..\Fonts\Outline 1\Outline 1.PNG" "..\Fonts\Outline 1\Outline 1.dat" "..\Fonts\Outline 2\Outline 2.PNG" "..\Fonts\Outline 2\Outline 2.dat" "..\Graphics\ustar-icon_v01.ico" "..\Graphics\credits_v5_bg.png" "..\Graphics\credits_v5_overlay.png" "..\Graphics\names_blindguard.png" "..\Graphics\names_blindy.png" "..\Graphics\names_canni.png" "..\Graphics\names_commandio.png" "..\Graphics\names_lazyjoker.png" "..\Graphics\names_mog.png" "..\Graphics\names_mota.png" "..\Graphics\names_skillmaster.png" "..\Graphics\names_whiteshark.png" "..\Graphics\intro-l-01.png" "..\Graphics\intro-l-02.png" "..\Graphics\intro-l-03.png" "..\Graphics\intro-l-04.png" "..\Graphics\intro-l-05.png" "..\Graphics\intro-l-06.png" "..\Graphics\intro-l-07.png" "..\Graphics\intro-l-08.png" "..\Graphics\intro-l-09.png" "..\Graphics\outro-bg.png" "..\Graphics\outro-esc.png" "..\Graphics\outro-exit-dark.png" + -- cgit v1.2.3 From 5e01f4ab6d0f3dd5ffa011b2a5638d5248e99f0f Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 19 Sep 2007 13:26:58 +0000 Subject: trying to fix lazarus runtime errors.. also adding files to make sure everything required for lazarus compile, is in svn. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@399 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.pas | 2 ++ Game/Code/Classes/UTexture.pas | 8 ++++---- Game/Code/UltraStar.cfg | 43 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 Game/Code/UltraStar.cfg (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index 12a9a8dc..b61e2657 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -73,12 +73,14 @@ procedure BuildFont; // Build Our Bitmap Font var Rejestr: TResourceStream; begin + {$IFNDEF FPC} Rejestr := TResourceStream.Create(HInstance, aResourceName , pchar( aType ) ); try Rejestr.Read(Fonts[ aID ].Width, 256); finally Rejestr.Free; end; + {$ENDIF} end; var diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index c1862828..6895a250 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -870,10 +870,10 @@ begin Result.TexW := TexOrigW / TexNewW; Result.TexH := TexOrigH / TexNewH; - Result.Int := 1; - Result.ColR := 1; - Result.ColG := 1; - Result.ColB := 1; + Result.Int := 1; + Result.ColR := 1; + Result.ColG := 1; + Result.ColB := 1; Result.Alpha := 1; // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these diff --git a/Game/Code/UltraStar.cfg b/Game/Code/UltraStar.cfg new file mode 100644 index 00000000..23f26b7f --- /dev/null +++ b/Game/Code/UltraStar.cfg @@ -0,0 +1,43 @@ +-$A8 +-$B- +-$C+ +-$D+ +-$E- +-$F- +-$G+ +-$H+ +-$I+ +-$J- +-$K- +-$L+ +-$M- +-$N+ +-$O+ +-$P+ +-$Q- +-$R- +-$S- +-$T- +-$U- +-$V+ +-$W- +-$X+ +-$YD +-$Z1 +-cg +-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; +-H+ +-W+ +-M +-$M16384,1048576 +-K$00400000 +-E"../../" +-LE"C:\Documents and Settings\Jay Binks\My Documents\Borland Studio Projects\Bpl" +-LN"C:\Documents and Settings\Jay Binks\My Documents\Borland Studio Projects\Bpl" +-U"lib\JEDI-SDLv1.0\SDL\Pas" +-O"lib\JEDI-SDLv1.0\SDL\Pas" +-I"lib\JEDI-SDLv1.0\SDL\Pas" +-R"lib\JEDI-SDLv1.0\SDL\Pas" +-w-UNSAFE_TYPE +-w-UNSAFE_CODE +-w-UNSAFE_CAST -- cgit v1.2.3 From a3904cbf6d498504bb0ab2510b50e6117d2869cc Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 19 Sep 2007 13:38:24 +0000 Subject: added in the lots of debug logging... sorry guys. will remove it soon enough. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@400 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/ULog.pas | 2 + Game/Code/UltraStar.lpi | 190 +++++++++++++++++++++++---------------------- 2 files changed, 99 insertions(+), 93 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index 4a18b8e2..d03ad8ed 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -217,6 +217,8 @@ begin //Just for Debugging //Comment for Release //LogAnalyze (Log2 + ': ' + Log1); + + LogError(Log2 + ': ' + Log1); end; procedure TLog.LogError(Log1, Log2: string); diff --git a/Game/Code/UltraStar.lpi b/Game/Code/UltraStar.lpi index 77bd613c..39d9c94f 100644 --- a/Game/Code/UltraStar.lpi +++ b/Game/Code/UltraStar.lpi @@ -40,8 +40,8 @@ - - + + @@ -51,14 +51,14 @@ - + - - - + + + @@ -67,29 +67,31 @@ - + - + - - + + + + - - + + @@ -97,27 +99,27 @@ - + - + - + - + @@ -131,7 +133,7 @@ - + @@ -145,50 +147,50 @@ - + - + - + - + - + - + - - + + @@ -196,41 +198,41 @@ - + - + - + - + - + - + @@ -242,30 +244,32 @@ - - + + + + - + - + - + @@ -278,91 +282,91 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -390,19 +394,19 @@ - + - - - + + + - + @@ -410,7 +414,7 @@ - + @@ -421,40 +425,40 @@ - - + + - - + + - - + + - - + + - + - + - + - + - + @@ -462,79 +466,79 @@ - + - + - + - + - + - + - + - + - + - - + + - + - + - + - - + + - + - - + + - - + + - - + + - - + + -- cgit v1.2.3 From 75279f0cdfb62b2fe3fb8043c40ed04a1ea594a7 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 19 Sep 2007 13:40:13 +0000 Subject: oops... broke delphi building.. sorry guys. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@401 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.pas | 2 ++ Game/Code/UltraStar.lpi | 86 ++++++++++++++++++++++---------------------- 2 files changed, 45 insertions(+), 43 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index b61e2657..9700ce7a 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -371,8 +371,10 @@ begin Fonts[ActFont].AspectW := Aspect; end; +{$IFDEF FPC} initialization {$I UltraStar.lrs} +{$ENDIF} end. diff --git a/Game/Code/UltraStar.lpi b/Game/Code/UltraStar.lpi index 39d9c94f..c63877cb 100644 --- a/Game/Code/UltraStar.lpi +++ b/Game/Code/UltraStar.lpi @@ -12,7 +12,7 @@ - + @@ -43,7 +43,7 @@ - + @@ -82,7 +82,7 @@ - + @@ -395,14 +395,14 @@ - + - - + + @@ -415,130 +415,130 @@ - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - + + + + - + - + - + - + - - + + - + - + - - - - + + + + -- cgit v1.2.3 From 7ea4704bee262bd2dfd7c1eb240806e3911140cf Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 19 Sep 2007 13:47:27 +0000 Subject: minor changes.. links to information on lazarus scanlines. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@402 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 34 ++++++++++----- Game/Code/UltraStar.lpi | 96 +++++++++++++++++++++--------------------- 2 files changed, 72 insertions(+), 58 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 6895a250..7f0b85c0 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -321,6 +321,10 @@ var begin {$IFNDEF FPC} // TODO : JB eeeew this is a nasty one... // but lazarus implementation scanlines is different :( + // need to implement as per + // http://www.lazarus.freepascal.org/index.php?name=PNphpBB2&file=viewtopic&p=18512 + // http://www.lazarus.freepascal.org/index.php?name=PNphpBB2&file=viewtopic&p=10797 + // http://wiki.lazarus.freepascal.org/Developing_with_Graphics Log.BenchmarkStart(4); Mipmapping := true; @@ -344,36 +348,46 @@ begin if FromRegistry or ((not FromRegistry) and FileExists(Identifier)) then begin TextureB := TBitmap.Create; - if Format = 'BMP' then begin - if FromRegistry then TextureB.LoadFromStream(Res) - else TextureB.LoadFromFile(Identifier); + if Format = 'BMP' then + begin + if FromRegistry then + TextureB.LoadFromStream(Res) + else + TextureB.LoadFromFile(Identifier); end - - else if Format = 'JPG' then begin + else + if Format = 'JPG' then + begin TextureJ := TJPEGImage.Create; - if FromRegistry then TextureJ.LoadFromStream(Res) - else begin + + if FromRegistry then + TextureJ.LoadFromStream(Res) + else + begin if FileExists(Identifier) then TextureJ.LoadFromFile(Identifier) else Exit; end; + TextureB.Assign(TextureJ); TextureJ.Free; end - else if Format = 'PNG' then begin {$IFNDEF FPC} // TODO : JB - fix this for lazarus.. TexturePNG := TPNGObject.Create; - if FromRegistry then TexturePNG.LoadFromStream(Res) - else begin + if FromRegistry then + TexturePNG.LoadFromStream(Res) + else + begin if FileExists(Identifier) then TexturePNG.LoadFromFile(Identifier) else Exit; end; + TextureB.Assign(TexturePNG); // transparent png hack start (part 1 of 2) if ((Typ = 'Transparent') or (Typ = 'Colorized')) and (TexturePNG.TransparencyMode = ptmPartial) then diff --git a/Game/Code/UltraStar.lpi b/Game/Code/UltraStar.lpi index c63877cb..a402e9a0 100644 --- a/Game/Code/UltraStar.lpi +++ b/Game/Code/UltraStar.lpi @@ -12,7 +12,7 @@ - + @@ -56,8 +56,8 @@ - - + + @@ -188,7 +188,7 @@ - + @@ -392,8 +392,8 @@ - - + + @@ -401,7 +401,7 @@ - + @@ -422,123 +422,123 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + -- cgit v1.2.3 From 04d71cd12f8e2666d0077317b6316419f747c918 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 19 Sep 2007 13:56:16 +0000 Subject: fix for delphi build... oops. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@403 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index 9700ce7a..8a702ca7 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -131,7 +131,7 @@ begin {$ELSE} loadfont( 0, 'FNT', 'Font' ); loadfont( 1, 'FNT', 'FontB' ); - loadfont( 2, 'FNT', 'Font0' ); + loadfont( 2, 'FNT', 'FontO' ); loadfont( 3, 'FNT', 'FontO2' ); {$ENDIF} -- cgit v1.2.3 From e73069b99f8350eb9bea66ed2d74fdd79e5c4fa1 Mon Sep 17 00:00:00 2001 From: b1indy Date: Wed, 19 Sep 2007 17:33:49 +0000 Subject: this file should not be in svn git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@404 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.cfg | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 Game/Code/UltraStar.cfg (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.cfg b/Game/Code/UltraStar.cfg deleted file mode 100644 index 23f26b7f..00000000 --- a/Game/Code/UltraStar.cfg +++ /dev/null @@ -1,43 +0,0 @@ --$A8 --$B- --$C+ --$D+ --$E- --$F- --$G+ --$H+ --$I+ --$J- --$K- --$L+ --$M- --$N+ --$O+ --$P+ --$Q- --$R- --$S- --$T- --$U- --$V+ --$W- --$X+ --$YD --$Z1 --cg --AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; --H+ --W+ --M --$M16384,1048576 --K$00400000 --E"../../" --LE"C:\Documents and Settings\Jay Binks\My Documents\Borland Studio Projects\Bpl" --LN"C:\Documents and Settings\Jay Binks\My Documents\Borland Studio Projects\Bpl" --U"lib\JEDI-SDLv1.0\SDL\Pas" --O"lib\JEDI-SDLv1.0\SDL\Pas" --I"lib\JEDI-SDLv1.0\SDL\Pas" --R"lib\JEDI-SDLv1.0\SDL\Pas" --w-UNSAFE_TYPE --w-UNSAFE_CODE --w-UNSAFE_CAST -- cgit v1.2.3 From 1c3dedbdd8522e63080133197af763d1995f8236 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 19 Sep 2007 23:34:09 +0000 Subject: tested ffmpeg in lazarus - linux.. working :) just need to make sure development packages are installed for ffmpeg. such as : libavcodec-dev & libavformat-dev git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@405 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/ffmpeg/avcodec.pas | 3950 +++++++++++++++++----------------- Game/Code/lib/ffmpeg/avformat.pas | 1259 +++++------ Game/Code/lib/ffmpeg/avio.pas | 492 ++--- Game/Code/lib/ffmpeg/avutil.pas | 270 +-- Game/Code/lib/ffmpeg/lazarustest.lpi | 420 ++-- Game/Code/lib/ffmpeg/lazarustest.lpr | 57 +- Game/Code/lib/ffmpeg/opt.pas | 210 +- Game/Code/lib/ffmpeg/rational.pas | 184 +- 8 files changed, 3457 insertions(+), 3385 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/lib/ffmpeg/avcodec.pas b/Game/Code/lib/ffmpeg/avcodec.pas index ce08dcc9..bef5f687 100644 --- a/Game/Code/lib/ffmpeg/avcodec.pas +++ b/Game/Code/lib/ffmpeg/avcodec.pas @@ -1,1970 +1,1980 @@ - (* - * copyright (c) 2001 Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - *) -unit avcodec; - -interface - -uses - windows, avutil, rational, opt; - -const - av__format = 'avformat-50.dll'; - - LIBAVUTIL_VERSION_INT = ((51 shl 16) + (16 shl 8) + 0); - LIBAVUTIL_VERSION = '51.16.0'; - LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; - - AV_NOPTS_VALUE: int64 = $8000000000000000; - AV_TIME_BASE = 1000000; - -type - TCodecID = ( - CODEC_ID_NONE, CODEC_ID_MPEG1VIDEO, - CODEC_ID_MPEG2VIDEO, //* prefered ID for MPEG Video 1 or 2 decoding */ - CODEC_ID_MPEG2VIDEO_XVMC, CODEC_ID_H261, CODEC_ID_H263, CODEC_ID_RV10, - CODEC_ID_RV20, CODEC_ID_MJPEG, CODEC_ID_MJPEGB, CODEC_ID_LJPEG, - CODEC_ID_SP5X, CODEC_ID_JPEGLS, CODEC_ID_MPEG4, CODEC_ID_RAWVIDEO, - CODEC_ID_MSMPEG4V1, CODEC_ID_MSMPEG4V2, CODEC_ID_MSMPEG4V3, - CODEC_ID_WMV1, CODEC_ID_WMV2, CODEC_ID_H263P, - CODEC_ID_H263I, CODEC_ID_FLV1, CODEC_ID_SVQ1, CODEC_ID_SVQ3, - CODEC_ID_DVVIDEO, CODEC_ID_HUFFYUV, CODEC_ID_CYUV, CODEC_ID_H264, - CODEC_ID_INDEO3, CODEC_ID_VP3, CODEC_ID_THEORA, CODEC_ID_ASV1, - CODEC_ID_ASV2, CODEC_ID_FFV1, CODEC_ID_4XM, CODEC_ID_VCR1, - CODEC_ID_CLJR, CODEC_ID_MDEC, CODEC_ID_ROQ, CODEC_ID_INTERPLAY_VIDEO, - CODEC_ID_XAN_WC3, CODEC_ID_XAN_WC4, CODEC_ID_RPZA, CODEC_ID_CINEPAK, - CODEC_ID_WS_VQA, CODEC_ID_MSRLE, CODEC_ID_MSVIDEO1, CODEC_ID_IDCIN, - CODEC_ID_8BPS, CODEC_ID_SMC, CODEC_ID_FLIC, CODEC_ID_TRUEMOTION1, - CODEC_ID_VMDVIDEO, CODEC_ID_MSZH, CODEC_ID_ZLIB, CODEC_ID_QTRLE, - CODEC_ID_SNOW, CODEC_ID_TSCC, CODEC_ID_ULTI, CODEC_ID_QDRAW, - CODEC_ID_VIXL, CODEC_ID_QPEG, CODEC_ID_XVID, CODEC_ID_PNG, - CODEC_ID_PPM, CODEC_ID_PBM, CODEC_ID_PGM, CODEC_ID_PGMYUV, - CODEC_ID_PAM, CODEC_ID_FFVHUFF, CODEC_ID_RV30, CODEC_ID_RV40, - CODEC_ID_VC1, CODEC_ID_WMV3, CODEC_ID_LOCO, CODEC_ID_WNV1, - CODEC_ID_AASC, CODEC_ID_INDEO2, CODEC_ID_FRAPS, CODEC_ID_TRUEMOTION2, - CODEC_ID_BMP, CODEC_ID_CSCD, CODEC_ID_MMVIDEO, CODEC_ID_ZMBV, - CODEC_ID_AVS, CODEC_ID_SMACKVIDEO, CODEC_ID_NUV, CODEC_ID_KMVC, - CODEC_ID_FLASHSV, CODEC_ID_CAVS, CODEC_ID_JPEG2000, CODEC_ID_VMNC, - CODEC_ID_VP5, CODEC_ID_VP6, CODEC_ID_VP6F, - - //* various pcm "codecs" */ - CODEC_ID_PCM_S16LE= $10000, CODEC_ID_PCM_S16BE, CODEC_ID_PCM_U16LE, - CODEC_ID_PCM_U16BE, CODEC_ID_PCM_S8, CODEC_ID_PCM_U8, CODEC_ID_PCM_MULAW, - CODEC_ID_PCM_ALAW, CODEC_ID_PCM_S32LE, CODEC_ID_PCM_S32BE, CODEC_ID_PCM_U32LE, - CODEC_ID_PCM_U32BE, CODEC_ID_PCM_S24LE, CODEC_ID_PCM_S24BE, CODEC_ID_PCM_U24LE, - CODEC_ID_PCM_U24BE, CODEC_ID_PCM_S24DAUD, - //* various adpcm codecs */ - CODEC_ID_ADPCM_IMA_QT= $11000, CODEC_ID_ADPCM_IMA_WAV, CODEC_ID_ADPCM_IMA_DK3, - CODEC_ID_ADPCM_IMA_DK4, CODEC_ID_ADPCM_IMA_WS, CODEC_ID_ADPCM_IMA_SMJPEG, - CODEC_ID_ADPCM_MS, CODEC_ID_ADPCM_4XM, CODEC_ID_ADPCM_XA, CODEC_ID_ADPCM_ADX, - CODEC_ID_ADPCM_EA, CODEC_ID_ADPCM_G726, CODEC_ID_ADPCM_CT, CODEC_ID_ADPCM_SWF, - CODEC_ID_ADPCM_YAMAHA, CODEC_ID_ADPCM_SBPRO_4, CODEC_ID_ADPCM_SBPRO_3, - CODEC_ID_ADPCM_SBPRO_2, - //* AMR */ - CODEC_ID_AMR_NB= $12000, CODEC_ID_AMR_WB, - //* RealAudio codecs*/ - CODEC_ID_RA_144= $13000, CODEC_ID_RA_288, - //* various DPCM codecs */ - CODEC_ID_ROQ_DPCM= $14000, CODEC_ID_INTERPLAY_DPCM, CODEC_ID_XAN_DPCM, - CODEC_ID_SOL_DPCM, CODEC_ID_MP2= $15000, - CODEC_ID_MP3, //* prefered ID for MPEG Audio layer 1, 2 or3 decoding */ - CODEC_ID_AAC, CODEC_ID_MPEG4AAC, CODEC_ID_AC3, CODEC_ID_DTS, CODEC_ID_VORBIS, - CODEC_ID_DVAUDIO, CODEC_ID_WMAV1, CODEC_ID_WMAV2, CODEC_ID_MACE3, - CODEC_ID_MACE6, CODEC_ID_VMDAUDIO, CODEC_ID_SONIC, CODEC_ID_SONIC_LS, - CODEC_ID_FLAC, CODEC_ID_MP3ADU, CODEC_ID_MP3ON4, CODEC_ID_SHORTEN, - CODEC_ID_ALAC, CODEC_ID_WESTWOOD_SND1, CODEC_ID_GSM, CODEC_ID_QDM2, - CODEC_ID_COOK, CODEC_ID_TRUESPEECH, CODEC_ID_TTA, CODEC_ID_SMACKAUDIO, - CODEC_ID_QCELP, CODEC_ID_WAVPACK, - //* subtitle codecs */ - CODEC_ID_DVD_SUBTITLE= $17000, CODEC_ID_DVB_SUBTITLE, - - CODEC_ID_MPEG2TS= $20000 //* _FAKE_ codec to indicate a raw MPEG2 transport - // stream (only used by libavformat) */ - ); - -//* CODEC_ID_MP3LAME is absolete */ -const - CODEC_ID_MP3LAME = CODEC_ID_MP3; - - AVPALETTE_SIZE = 1024; - AVPALETTE_COUNT = 256; - -type - TCodecType = ( - CODEC_TYPE_UNKNOWN = -1, - CODEC_TYPE_VIDEO, - CODEC_TYPE_AUDIO, - CODEC_TYPE_DATA, - CODEC_TYPE_SUBTITLE - ); - -//* currently unused, may be used if 24/32 bits samples ever supported */ -//* all in native endian */ - TSampleFormat = ( - SAMPLE_FMT_NONE = -1, - SAMPLE_FMT_U8, ///< unsigned 8 bits - SAMPLE_FMT_S16, ///< signed 16 bits - SAMPLE_FMT_S24, ///< signed 24 bits - SAMPLE_FMT_S32, ///< signed 32 bits - SAMPLE_FMT_FLT ///< float - ); - -const -//* in bytes */ - AVCODEC_MAX_AUDIO_FRAME_SIZE = 192000; // 1 second of 48khz 32bit audio - -(** - * Required number of additionally allocated bytes at the end of the input bitstream for decoding. - * this is mainly needed because some optimized bitstream readers read - * 32 or 64 bit at once and could read over the end
- * Note, if the first 23 bits of the additional bytes are not 0 then damaged - * MPEG bitstreams could cause overread and segfault - *) - FF_INPUT_BUFFER_PADDING_SIZE = 8; - -(** - * minimum encoding buffer size. - * used to avoid some checks during header writing - *) - FF_MIN_BUFFER_SIZE = 16384; - -type -//* motion estimation type, EPZS by default */ - TMotion_Est_ID = ( - ME_ZERO = 1, - ME_FULL, - ME_LOG, - ME_PHODS, - ME_EPZS, - ME_X1, - ME_HEX, - ME_UMH, - ME_ITER - ); - - TAVDiscard = ( -//we leave some space between them for extensions (drop some keyframes for intra only or drop just some bidir frames) - AVDISCARD_NONE = -16, ///< discard nothing - AVDISCARD_DEFAULT= 0, ///< discard useless packets like 0 size packets in avi - AVDISCARD_NONREF = 8, ///< discard all non reference - AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames - AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes - AVDISCARD_ALL = 48, ///< discard all - AVDISCARD_FUCK = $FFFFFF - ); - - PRcOverride = ^TRcOverride; - TRcOverride = record {16} - start_frame: integer; - end_frame: integer; - qscale: integer; // if this is 0 then quality_factor will be used instead - quality_factor: single; - end; - -const - FF_MAX_B_FRAMES = 16; - -(* encoding support - these flags can be passed in AVCodecContext.flags before initing - Note: not everything is supported yet. -*) - - CODEC_FLAG_QSCALE = $0002; ///< use fixed qscale - CODEC_FLAG_4MV = $0004; ///< 4 MV per MB allowed / Advanced prediction for H263 - CODEC_FLAG_QPEL = $0010; ///< use qpel MC - CODEC_FLAG_GMC = $0020; ///< use GMC - CODEC_FLAG_MV0 = $0040; ///< always try a MB with MV=<0,0> - CODEC_FLAG_PART = $0080; ///< use data partitioning -//* parent program gurantees that the input for b-frame containing streams is not written to -// for at least s->max_b_frames+1 frames, if this is not set than the input will be copied */ - CODEC_FLAG_INPUT_PRESERVED = $0100; - CODEC_FLAG_PASS1 = $0200; ///< use internal 2pass ratecontrol in first pass mode - CODEC_FLAG_PASS2 = $0400; ///< use internal 2pass ratecontrol in second pass mode - CODEC_FLAG_EXTERN_HUFF = $1000; ///< use external huffman table (for mjpeg) - CODEC_FLAG_GRAY = $2000; ///< only decode/encode grayscale - CODEC_FLAG_EMU_EDGE = $4000; ///< don't draw edges - CODEC_FLAG_PSNR = $8000; ///< error[?] variables will be set during encoding - CODEC_FLAG_TRUNCATED = $00010000; //** input bitstream might be truncated at a random location instead - // of only at frame boundaries */ - CODEC_FLAG_NORMALIZE_AQP = $00020000; ///< normalize adaptive quantization - CODEC_FLAG_INTERLACED_DCT = $00040000; ///< use interlaced dct - CODEC_FLAG_LOW_DELAY = $00080000; ///< force low delay - CODEC_FLAG_ALT_SCAN = $00100000; ///< use alternate scan - CODEC_FLAG_TRELLIS_QUANT = $00200000; ///< use trellis quantization - CODEC_FLAG_GLOBAL_HEADER = $00400000; ///< place global headers in extradata instead of every keyframe - CODEC_FLAG_BITEXACT = $00800000; ///< use only bitexact stuff (except (i)dct) -//* Fx : Flag for h263+ extra options */ - CODEC_FLAG_H263P_AIC = $01000000; ///< H263 Advanced intra coding / MPEG4 AC prediction (remove this) - CODEC_FLAG_AC_PRED = $01000000; ///< H263 Advanced intra coding / MPEG4 AC prediction - CODEC_FLAG_H263P_UMV = $02000000; ///< Unlimited motion vector - CODEC_FLAG_CBP_RD = $04000000; ///< use rate distortion optimization for cbp - CODEC_FLAG_QP_RD = $08000000; ///< use rate distortion optimization for qp selectioon - CODEC_FLAG_H263P_AIV = $00000008; ///< H263 Alternative inter vlc - CODEC_FLAG_OBMC = $00000001; ///< OBMC - CODEC_FLAG_LOOP_FILTER = $00000800; ///< loop filter - CODEC_FLAG_H263P_SLICE_STRUCT = $10000000; - CODEC_FLAG_INTERLACED_ME = $20000000; ///< interlaced motion estimation - CODEC_FLAG_SVCD_SCAN_OFFSET = $40000000; ///< will reserve space for SVCD scan offset user data - CODEC_FLAG_CLOSED_GOP = $80000000; - CODEC_FLAG2_FAST = $00000001; ///< allow non spec compliant speedup tricks - CODEC_FLAG2_STRICT_GOP = $00000002; ///< strictly enforce GOP size - CODEC_FLAG2_NO_OUTPUT = $00000004; ///< skip bitstream encoding - CODEC_FLAG2_LOCAL_HEADER = $00000008; ///< place global headers at every keyframe instead of in extradata - CODEC_FLAG2_BPYRAMID = $00000010; ///< H.264 allow b-frames to be used as references - CODEC_FLAG2_WPRED = $00000020; ///< H.264 weighted biprediction for b-frames - CODEC_FLAG2_MIXED_REFS = $00000040; ///< H.264 multiple references per partition - CODEC_FLAG2_8X8DCT = $00000080; ///< H.264 high profile 8x8 transform - CODEC_FLAG2_FASTPSKIP = $00000100; ///< H.264 fast pskip - CODEC_FLAG2_AUD = $00000200; ///< H.264 access unit delimiters - CODEC_FLAG2_BRDO = $00000400; ///< b-frame rate-distortion optimization - CODEC_FLAG2_INTRA_VLC = $00000800; ///< use MPEG-2 intra VLC table - CODEC_FLAG2_MEMC_ONLY = $00001000; ///< only do ME/MC (I frames -> ref, P frame -> ME+MC) - -(* Unsupported options : - * Syntax Arithmetic coding (SAC) - * Reference Picture Selection - * Independant Segment Decoding */ -/* /Fx */ -/* codec capabilities *) - -const - CODEC_CAP_DRAW_HORIZ_BAND = $001; ///< decoder can use draw_horiz_band callback -(** - * Codec uses get_buffer() for allocating buffers. - * direct rendering method 1 *) - CODEC_CAP_DR1 = $002; -(* if 'parse_only' field is true, then avcodec_parse_frame() can be used *) - CODEC_CAP_PARSE_ONLY = $004; - CODEC_CAP_TRUNCATED = $008; -//* codec can export data for HW decoding (XvMC) */ - CODEC_CAP_HWACCEL = $010; - -(** - * codec has a non zero delay and needs to be feeded with NULL at the end to get the delayed data. - * if this is not set, the codec is guranteed to never be feeded with NULL data *) - CODEC_CAP_DELAY = $0020; -(** - * Codec can be fed a final frame with a smaller size. - * This can be used to prevent truncation of the last audio samples. *) - CODEC_CAP_SMALL_LAST_FRAME = $0040; - -//the following defines may change, don't expect compatibility if you use them - MB_TYPE_INTRA4x4 = $001; - MB_TYPE_INTRA16x16 = $002; //FIXME h264 specific - MB_TYPE_INTRA_PCM = $004; //FIXME h264 specific - MB_TYPE_16x16 = $008; - MB_TYPE_16x8 = $010; - MB_TYPE_8x16 = $020; - MB_TYPE_8x8 = $040; - MB_TYPE_INTERLACED = $080; - MB_TYPE_DIRECT2 = $100; //FIXME - MB_TYPE_ACPRED = $200; - MB_TYPE_GMC = $400; - MB_TYPE_SKIP = $800; - MB_TYPE_P0L0 = $1000; - MB_TYPE_P1L0 = $2000; - MB_TYPE_P0L1 = $4000; - MB_TYPE_P1L1 = $8000; - MB_TYPE_L0 = (MB_TYPE_P0L0 or MB_TYPE_P1L0); - MB_TYPE_L1 = (MB_TYPE_P0L1 or MB_TYPE_P1L1); - MB_TYPE_L0L1 = (MB_TYPE_L0 or MB_TYPE_L1); - MB_TYPE_QUANT = $0010000; - MB_TYPE_CBP = $0020000; -//Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...) - -type -(** - * Pan Scan area. - * this specifies the area which should be displayed. Note there may be multiple such areas for one frame *) - PAVPanScan = ^TAVPanScan; - TAVPanScan = record {24} - (*** id. - * - encoding: set by user. - * - decoding: set by lavc *) - id: integer; - - (*** width and height in 1/16 pel - * - encoding: set by user. - * - decoding: set by lavc *) - width: integer; - height: integer; - - (*** position of the top left corner in 1/16 pel for up to 3 fields/frames. - * - encoding: set by user. - * - decoding: set by lavc *) - position: array [0..2] of array [0..1] of smallint; - end; - -const - FF_QSCALE_TYPE_MPEG1 = 0; - FF_QSCALE_TYPE_MPEG2 = 1; - - FF_BUFFER_TYPE_INTERNAL = 1; - FF_BUFFER_TYPE_USER = 2; ///< Direct rendering buffers (image is (de)allocated by user) - FF_BUFFER_TYPE_SHARED = 4; ///< buffer from somewhere else, don't dealloc image (data/base), all other tables are not shared - FF_BUFFER_TYPE_COPY = 8; ///< just a (modified) copy of some other buffer, don't dealloc anything - - - FF_I_TYPE = 1; // Intra - FF_P_TYPE = 2; // Predicted - FF_B_TYPE = 3; // Bi-dir predicted - FF_S_TYPE = 4; // S(GMC)-VOP MPEG4 - FF_SI_TYPE = 5; - FF_SP_TYPE = 6; - - FF_BUFFER_HINTS_VALID = $01; // Buffer hints value is meaningful (if 0 ignore) - FF_BUFFER_HINTS_READABLE = $02; // Codec will read from buffer - FF_BUFFER_HINTS_PRESERVE = $04; // User must not alter buffer content - FF_BUFFER_HINTS_REUSABLE = $08; // Codec will reuse the buffer (update) - -type - (*** Audio Video Frame. *) - PAVFrame = ^TAVFrame; - TAVFrame = record {200} - (*** pointer to the picture planes. - * this might be different from the first allocated byte *) - data: array [0..3] of pointer; - linesize: array [0..3] of integer; - (*** pointer to the first allocated byte of the picture. can be used in get_buffer/release_buffer - * this isn't used by lavc unless the default get/release_buffer() is used*) - base: array [0..3] of pchar; - (*** 1 -> keyframe, 0-> not *) - key_frame: integer; - (*** picture type of the frame, see ?_TYPE below.*) - pict_type: integer; - (*** presentation timestamp in time_base units (time when frame should be shown to user) - * if AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed*) - pts: int64; - (*** picture number in bitstream order.*) - coded_picture_number: integer; - (*** picture number in display order.*) - display_picture_number: integer; - (*** quality (between 1 (good) and FF_LAMBDA_MAX (bad)) *) - quality: integer; - (*** buffer age (1->was last buffer and dint change, 2->..., ...).*) - age: integer; - (*** is this picture used as reference*) - reference: integer; - (*** QP table*) - qscale_table: pchar; - (*** QP store stride*) - qstride: integer; - (*** mbskip_table[mb]>=1 if MB didnt change*) - mbskip_table: pchar; - (** - * Motion vector table. - * @code - * example: - * int mv_sample_log2= 4 - motion_subsample_log2; - * int mb_width= (width+15)>>4; - * int mv_stride= (mb_width << mv_sample_log2) + 1; - * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y]; - * @endcode - * - encoding: set by user - * - decoding: set by lavc *) - motion_val: array [0..1] of pointer; - (*** Macroblock type table - * mb_type_base + mb_width + 2 *) - mb_type: PCardinal; - (*** log2 of the size of the block which a single vector in motion_val represents: - * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)*) - motion_subsample_log2: byte; - (*** for some private data of the user*) - opaque: pointer; - (*** error*) - error: array [0..3] of int64; - (*** type of the buffer (to keep track of who has to dealloc data[*]) - * Note: user allocated (direct rendering) & internal buffers can not coexist currently*) - _type: integer; - (*** when decoding, this signal how much the picture must be delayed. - * extra_delay = repeat_pict / (2*fps)*) - repeat_pict: integer; - qscale_type: Integer; - (*** The content of the picture is interlaced.*) - interlaced_frame: Integer; - (*** if the content is interlaced, is top field displayed first.*) - top_field_first: integer; - (*** Pan scan.*) - pan_scan: PAVPanScan; - (*** tell user application that palette has changed from previous frame.*) - palette_has_changed: integer; - (*** Codec suggestion on buffer type if != 0 - * - decoding: set by lavc (before get_buffer() call))*) - buffer_hints: integer; - (*** DCT coeffitients*) - dct_coeff: PSmallInt; - (*** Motion referece frame index*) - ref_index: array [0..1] of pchar; - end; - -const - DEFAULT_FRAME_RATE_BASE = 1001000; - - FF_BUG_AUTODETECT = 1; ///< autodetection - FF_BUG_OLD_MSMPEG4 = 2; - FF_BUG_XVID_ILACE = 4; - FF_BUG_UMP4 = 8; - FF_BUG_NO_PADDING = 16; - FF_BUG_AMV = 32; - FF_BUG_AC_VLC = 0; ///< will be removed, libavcodec can now handle these non compliant files by default - FF_BUG_QPEL_CHROMA = 64; - FF_BUG_STD_QPEL = 128; - FF_BUG_QPEL_CHROMA2 = 256; - FF_BUG_DIRECT_BLOCKSIZE = 512; - FF_BUG_EDGE = 1024; - FF_BUG_HPEL_CHROMA = 2048; - FF_BUG_DC_CLIP = 4096; - FF_BUG_MS = 8192; ///< workaround various bugs in microsofts broken decoders - - FF_COMPLIANCE_VERY_STRICT = 2; ///< strictly conform to a older more strict version of the spec or reference software - FF_COMPLIANCE_STRICT = 1; ///< strictly conform to all the things in the spec no matter what consequences - FF_COMPLIANCE_NORMAL = 0; - FF_COMPLIANCE_INOFFICIAL = -1; ///< allow inofficial extensions - FF_COMPLIANCE_EXPERIMENTAL = -2; ///< allow non standarized experimental things - - FF_ER_CAREFUL = 1; - FF_ER_COMPLIANT = 2; - FF_ER_AGGRESSIVE = 3; - FF_ER_VERY_AGGRESSIVE = 4; - - FF_DCT_AUTO = 0; - FF_DCT_FASTINT = 1; - FF_DCT_INT = 2; - FF_DCT_MMX = 3; - FF_DCT_MLIB = 4; - FF_DCT_ALTIVEC = 5; - FF_DCT_FAAN = 6; - - FF_IDCT_AUTO = 0; - FF_IDCT_INT = 1; - FF_IDCT_SIMPLE = 2; - FF_IDCT_SIMPLEMMX = 3; - FF_IDCT_LIBMPEG2MMX = 4; - FF_IDCT_PS2 = 5; - FF_IDCT_MLIB = 6; - FF_IDCT_ARM = 7; - FF_IDCT_ALTIVEC = 8; - FF_IDCT_SH4 = 9; - FF_IDCT_SIMPLEARM = 10; - FF_IDCT_H264 = 11; - FF_IDCT_VP3 = 12; - FF_IDCT_IPP = 13; - FF_IDCT_XVIDMMX = 14; - - FF_EC_GUESS_MVS = 1; - FF_EC_DEBLOCK = 2; - - FF_MM_FORCE = $80000000; (* force usage of selected flags (OR) *) - (* lower 16 bits - CPU features *) - - FF_MM_MMX = $0001; (* standard MMX *) - FF_MM_3DNOW = $0004; (* AMD 3DNOW *) - FF_MM_MMXEXT = $0002; (* SSE integer functions or AMD MMX ext *) - FF_MM_SSE = $0008; (* SSE functions *) - FF_MM_SSE2 = $0010; (* PIV SSE2 functions *) - FF_MM_3DNOWEXT = $0020; (* AMD 3DNowExt *) - FF_MM_IWMMXT = $0100; (* XScale IWMMXT *) - - FF_PRED_LEFT = 0; - FF_PRED_PLANE = 1; - FF_PRED_MEDIAN = 2; - - FF_DEBUG_PICT_INFO = 1; - FF_DEBUG_RC = 2; - FF_DEBUG_BITSTREAM = 4; - FF_DEBUG_MB_TYPE = 8; - FF_DEBUG_QP = 16; - FF_DEBUG_MV = 32; - FF_DEBUG_DCT_COEFF = $00000040; - FF_DEBUG_SKIP = $00000080; - FF_DEBUG_STARTCODE = $00000100; - FF_DEBUG_PTS = $00000200; - FF_DEBUG_ER = $00000400; - FF_DEBUG_MMCO = $00000800; - FF_DEBUG_BUGS = $00001000; - FF_DEBUG_VIS_QP = $00002000; - FF_DEBUG_VIS_MB_TYPE = $00004000; - - FF_DEBUG_VIS_MV_P_FOR = $00000001; //visualize forward predicted MVs of P frames - FF_DEBUG_VIS_MV_B_FOR = $00000002; //visualize forward predicted MVs of B frames - FF_DEBUG_VIS_MV_B_BACK = $00000004; //visualize backward predicted MVs of B frames - - FF_CMP_SAD = 0; - FF_CMP_SSE = 1; - FF_CMP_SATD = 2; - FF_CMP_DCT = 3; - FF_CMP_PSNR = 4; - FF_CMP_BIT = 5; - FF_CMP_RD = 6; - FF_CMP_ZERO = 7; - FF_CMP_VSAD = 8; - FF_CMP_VSSE = 9; - FF_CMP_NSSE = 10; - FF_CMP_W53 = 11; - FF_CMP_W97 = 12; - FF_CMP_DCTMAX = 13; - FF_CMP_CHROMA = 256; - - FF_DTG_AFD_SAME = 8; - FF_DTG_AFD_4_3 = 9; - FF_DTG_AFD_16_9 = 10; - FF_DTG_AFD_14_9 = 11; - FF_DTG_AFD_4_3_SP_14_9 = 13; - FF_DTG_AFD_16_9_SP_14_9 = 14; - FF_DTG_AFD_SP_4_3 = 15; - - FF_DEFAULT_QUANT_BIAS = 999999; - - FF_LAMBDA_SHIFT = 7; - FF_LAMBDA_SCALE = (1 shl FF_LAMBDA_SHIFT); - FF_QP2LAMBDA = 118; ///< factor to convert from H.263 QP to lambda - FF_LAMBDA_MAX = (256 * 128 - 1); - - FF_QUALITY_SCALE = FF_LAMBDA_SCALE; //FIXME maybe remove - - FF_CODER_TYPE_VLC = 0; - FF_CODER_TYPE_AC = 1; - - SLICE_FLAG_CODED_ORDER = $0001; ///< draw_horiz_band() is called in coded order instead of display - SLICE_FLAG_ALLOW_FIELD = $0002; ///< allow draw_horiz_band() with field slices (MPEG2 field pics) - SLICE_FLAG_ALLOW_PLANE = $0004; ///< allow draw_horiz_band() with 1 component at a time (SVQ1) - - FF_MB_DECISION_SIMPLE = 0; ///< uses mb_cmp - FF_MB_DECISION_BITS = 1; ///< chooses the one which needs the fewest bits - FF_MB_DECISION_RD = 2; ///< rate distoration - - FF_AA_AUTO = 0; - FF_AA_FASTINT = 1; //not implemented yet - FF_AA_INT = 2; - FF_AA_FLOAT = 3; - - FF_PROFILE_UNKNOWN = -99; - - FF_LEVEL_UNKNOWN = -99; - - X264_PART_I4X4 = $001; (* Analyse i4x4 *) - X264_PART_I8X8 = $002; (* Analyse i8x8 (requires 8x8 transform) *) - X264_PART_P8X8 = $010; (* Analyse p16x8, p8x16 and p8x8 *) - X264_PART_P4X4 = $020; (* Analyse p8x4, p4x8, p4x4 *) - X264_PART_B8X8 = $100; (* Analyse b16x8, b8x16 and b8x8 *) - -type - PAVCLASS = ^TAVCLASS; - PAVCodecContext = ^TAVCodecContext; - PAVCodec = ^TAVCodec; - PAVPaletteControl = ^TAVPaletteControl; - - TAVCLASS = record {12} - class_name: pchar; - (* actually passing a pointer to an AVCodecContext - or AVFormatContext, which begin with an AVClass. - Needed because av_log is in libavcodec and has no visibility - of AVIn/OutputFormat *) - item_name: function (): pchar; cdecl; - option: PAVOption; - end; - - TAVCodecContext = record {720} - (*** Info on struct for av_log - * - set by avcodec_alloc_context *) - av_class: PAVClass; - (*** the average bitrate. - * - encoding: set by user. unused for constant quantizer encoding - * - decoding: set by lavc. 0 or some bitrate if this info is available in the stream *) - bit_rate: integer; - (*** number of bits the bitstream is allowed to diverge from the reference. - * the reference can be CBR (for CBR pass1) or VBR (for pass2) - * - encoding: set by user. unused for constant quantizer encoding - * - decoding: unused *) - bit_rate_tolerance: integer; - (*** CODEC_FLAG_*. - * - encoding: set by user. - * - decoding: set by user. *) - flags: integer; - (*** some codecs needs additionnal format info. It is stored here - * - encoding: set by user. - * - decoding: set by lavc. (FIXME is this ok?) *) - sub_id: integer; - - (** - * motion estimation algorithm used for video coding. - * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex), - * 8 (umh), 9 (iter) [7, 8 are x264 specific, 9 is snow specific] - * - encoding: MUST be set by user. - * - decoding: unused *) - me_method: integer; - - (** - * some codecs need / can use extra-data like huffman tables. - * mjpeg: huffman tables - * rv10: additional flags - * mpeg4: global headers (they can be in the bitstream or here) - * the allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger - * then extradata_size to avoid prolems if its read with the bitstream reader - * the bytewise contents of extradata must not depend on the architecture or cpu endianness - * - encoding: set/allocated/freed by lavc. - * - decoding: set/allocated/freed by user. - *) - extradata: pointer; - extradata_size: integer; - - (** - * this is the fundamental unit of time (in seconds) in terms - * of which frame timestamps are represented. for fixed-fps content, - * timebase should be 1/framerate and timestamp increments should be - * identically 1. - * - encoding: MUST be set by user - * - decoding: set by lavc. *) - time_base: TAVRational; - - (* video only *) - (*** picture width / height. - * - encoding: MUST be set by user. - * - decoding: set by lavc. - * Note, for compatibility its possible to set this instead of - * coded_width/height before decoding *) - width, height: integer; - (*** the number of pictures in a group of pitures, or 0 for intra_only. - * - encoding: set by user. - * - decoding: unused *) - gop_size: integer; - (*** pixel format, see PIX_FMT_xxx. - * - encoding: set by user. - * - decoding: set by lavc. *) - pix_fmt: TAVPixelFormat; - (*** Frame rate emulation. If not zero lower layer (i.e. format handler) - * has to read frames at native frame rate. - * - encoding: set by user. - * - decoding: unused. *) - rate_emu: integer; - (*** if non NULL, 'draw_horiz_band' is called by the libavcodec - * decoder to draw an horizontal band. It improve cache usage. Not - * all codecs can do that. You must check the codec capabilities - * before - * - encoding: unused - * - decoding: set by user. - * @param height the height of the slice - * @param y the y position of the slice - * @param type 1->top field, 2->bottom field, 3->frame - * @param offset offset into the AVFrame.data from which the slice should be read *) - draw_horiz_band: procedure (s: PAVCodecContext; - const src: PAVFrame; offset: PInteger; - y: integer; _type: integer; height: integer); cdecl; - - (* audio only *) - sample_rate: integer; ///< samples per sec - channels: integer; - (*** audio sample format. - * - encoding: set by user. - * - decoding: set by lavc. *) - sample_fmt: TSampleFormat; ///< sample format, currenly unused - - (* the following data should not be initialized *) - (*** samples per packet. initialized when calling 'init' *) - frame_size: integer; - frame_number: integer; ///< audio or video frame number - real_pict_num: integer; ///< returns the real picture number of previous encoded frame - - (*** number of frames the decoded output will be delayed relative to - * the encoded input. - * - encoding: set by lavc. - * - decoding: unused *) - delay: integer; - - (* - encoding parameters *) - qcompress: single; ///< amount of qscale change between easy & hard scenes (0.0-1.0) - qblur: single; ///< amount of qscale smoothing over time (0.0-1.0) - - (*** minimum quantizer. - * - encoding: set by user. - * - decoding: unused *) - qmin: integer; - - (*** maximum quantizer. - * - encoding: set by user. - * - decoding: unused *) - qmax: integer; - - (*** maximum quantizer difference etween frames. - * - encoding: set by user. - * - decoding: unused *) - max_qdiff: integer; - - (*** maximum number of b frames between non b frames. - * note: the output will be delayed by max_b_frames+1 relative to the input - * - encoding: set by user. - * - decoding: unused *) - max_b_frames: integer; - - (*** qscale factor between ip and b frames. - * - encoding: set by user. - * - decoding: unused *) - b_quant_factor: single; - - (** obsolete FIXME remove *) - rc_strategy: integer; - b_frame_strategy: integer; - - (*** hurry up amount. - * deprecated in favor of skip_idct and skip_frame - * - encoding: unused - * - decoding: set by user. 1-> skip b frames, 2-> skip idct/dequant too, 5-> skip everything except header *) - hurry_up: integer; - - codec: PAVCodec; - - priv_data: pointer; - - (* unused, FIXME remove*) - rtp_mode: integer; - - rtp_payload_size: integer; (* The size of the RTP payload: the coder will *) - (* do it's best to deliver a chunk with size *) - (* below rtp_payload_size, the chunk will start *) - (* with a start code on some codecs like H.263 *) - (* This doesn't take account of any particular *) - (* headers inside the transmited RTP payload *) - - - (* The RTP callback: This function is called *) - (* every time the encoder has a packet to send *) - (* Depends on the encoder if the data starts *) - (* with a Start Code (it should) H.263 does. *) - (* mb_nb contains the number of macroblocks *) - (* encoded in the RTP payload *) - rtp_callback: procedure (avctx: PAVCodecContext; data: pointer; - size: integer; mb_nb: integer); cdecl; - - (* statistics, used for 2-pass encoding *) - mv_bits: integer; - header_bits: integer; - i_tex_bits: integer; - p_tex_bits: integer; - i_count: integer; - p_count: integer; - skip_count: integer; - misc_bits: integer; - - (*** number of bits used for the previously encoded frame. - * - encoding: set by lavc - * - decoding: unused *) - frame_bits: integer; - - (*** private data of the user, can be used to carry app specific stuff. - * - encoding: set by user - * - decoding: set by user *) - opaque: pointer; - - codec_name: array [0..31] of char; - codec_type: TCodecType; (* see CODEC_TYPE_xxx *) - codec_id: TCodecID; (* see CODEC_ID_xxx *) - - (*** fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). - * this is used to workaround some encoder bugs - * - encoding: set by user, if not then the default based on codec_id will be used - * - decoding: set by user, will be converted to upper case by lavc during init *) -// codec_tag: cardinal; // ìîæíî array [0..3] of char - òîãäà âèäíî FOURCC - codec_tag: array [0..3] of char; - - (*** workaround bugs in encoders which sometimes cannot be detected automatically. - * - encoding: set by user - * - decoding: set by user *) - workaround_bugs: integer; - - (*** luma single coeff elimination threshold. - * - encoding: set by user - * - decoding: unused *) - luma_elim_threshold: integer; - - (*** chroma single coeff elimination threshold. - * - encoding: set by user - * - decoding: unused *) - chroma_elim_threshold: integer; - - (*** strictly follow the std (MPEG4, ...). - * - encoding: set by user - * - decoding: unused *) - strict_std_compliance: integer; - - (*** qscale offset between ip and b frames. - * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset) - * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset) - * - encoding: set by user. - * - decoding: unused *) - b_quant_offset: single; - - (*** error resilience higher values will detect more errors but may missdetect - * some more or less valid parts as errors. - * - encoding: unused - * - decoding: set by user *) - error_resilience: integer; - - (*** called at the beginning of each frame to get a buffer for it. - * if pic.reference is set then the frame will be read later by lavc - * avcodec_align_dimensions() should be used to find the required width and - * height, as they normally need to be rounded up to the next multiple of 16 - * - encoding: unused - * - decoding: set by lavc, user can override *) - get_buffer: function (c: PAVCodecContext; pic: PAVFrame): integer; cdecl; - - (*** called to release buffers which where allocated with get_buffer. - * a released buffer can be reused in get_buffer() - * pic.data[*] must be set to NULL - * - encoding: unused - * - decoding: set by lavc, user can override *) - release_buffer: procedure (c: PAVCodecContext; pic: PAVFrame); cdecl; - - (*** if 1 the stream has a 1 frame delay during decoding. - * - encoding: set by lavc - * - decoding: set by lavc *) - has_b_frames: integer; - - (*** number of bytes per packet if constant and known or 0 - * used by some WAV based audio codecs *) - block_align: integer; - - parse_only: integer; (* - decoding only: if true, only parsing is done - (function avcodec_parse_frame()). The frame - data is returned. Only MPEG codecs support this now. *) - - (*** 0-> h263 quant 1-> mpeg quant. - * - encoding: set by user. - * - decoding: unused *) - mpeg_quant: integer; - - (*** pass1 encoding statistics output buffer. - * - encoding: set by lavc - * - decoding: unused *) - stats_out: pchar; - - (*** pass2 encoding statistics input buffer. - * concatenated stuff from stats_out of pass1 should be placed here - * - encoding: allocated/set/freed by user - * - decoding: unused *) - stats_in: pchar; - - (*** ratecontrol qmin qmax limiting method. - * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax - * - encoding: set by user. - * - decoding: unused *) - rc_qsquish: single; - - rc_qmod_amp: single; - rc_qmod_freq: integer; - - (*** ratecontrol override, see RcOverride. - * - encoding: allocated/set/freed by user. - * - decoding: unused *) - rc_override: PRcOverride; - rc_override_count: integer; - - (*** rate control equation. - * - encoding: set by user - * - decoding: unused *) - rc_eq: pchar; - - (*** maximum bitrate. - * - encoding: set by user. - * - decoding: unused *) - rc_max_rate: integer; - - (*** minimum bitrate. - * - encoding: set by user. - * - decoding: unused *) - rc_min_rate: integer; - - (*** decoder bitstream buffer size. - * - encoding: set by user. - * - decoding: unused *) - rc_buffer_size: integer; - rc_buffer_aggressivity: single; - - (*** qscale factor between p and i frames. - * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset) - * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset) - * - encoding: set by user. - * - decoding: unused *) - i_quant_factor: single; - - (*** qscale offset between p and i frames. - * - encoding: set by user. - * - decoding: unused *) - i_quant_offset: single; - - (*** initial complexity for pass1 ratecontrol. - * - encoding: set by user. - * - decoding: unused *) - rc_initial_cplx: single; - - (*** dct algorithm, see FF_DCT_* below. - * - encoding: set by user - * - decoding: unused *) - dct_algo: integer; - - (*** luminance masking (0-> disabled). - * - encoding: set by user - * - decoding: unused *) - lumi_masking: single; - - (*** temporary complexity masking (0-> disabled). - * - encoding: set by user - * - decoding: unused *) - temporal_cplx_masking: single; - - (*** spatial complexity masking (0-> disabled). - * - encoding: set by user - * - decoding: unused *) - spatial_cplx_masking: single; - - (** * p block masking (0-> disabled). - * - encoding: set by user - * - decoding: unused *) - p_masking: single; - - (*** darkness masking (0-> disabled). - * - encoding: set by user - * - decoding: unused *) - dark_masking: single; - - (* for binary compatibility *) - unused: integer; - - (*** idct algorithm, see FF_IDCT_* below. - * - encoding: set by user - * - decoding: set by user *) - idct_algo: integer; - - (*** slice count. - * - encoding: set by lavc - * - decoding: set by user (or 0) *) - slice_count: integer; - - (*** slice offsets in the frame in bytes. - * - encoding: set/allocated by lavc - * - decoding: set/allocated by user (or NULL) *) - slice_offset: PInteger; - - (*** error concealment flags. - * - encoding: unused - * - decoding: set by user *) - error_concealment: integer; - - (*** dsp_mask could be add used to disable unwanted CPU features - * CPU features (i.e. MMX, SSE. ...) - * - * with FORCE flag you may instead enable given CPU features - * (Dangerous: usable in case of misdetection, improper usage however will - * result into program crash) *) - dsp_mask: cardinal; - - (*** bits per sample/pixel from the demuxer (needed for huffyuv). - * - encoding: set by lavc - * - decoding: set by user *) - bits_per_sample: integer; - - (*** prediction method (needed for huffyuv). - * - encoding: set by user - * - decoding: unused *) - prediction_method: integer; - - (*** sample aspect ratio (0 if unknown). - * numerator and denominator must be relative prime and smaller then 256 for some video standards - * - encoding: set by user. - * - decoding: set by lavc. *) - sample_aspect_ratio: TAVRational; - - (*** the picture in the bitstream. - * - encoding: set by lavc - * - decoding: set by lavc *) - coded_frame: PAVFrame; - - (*** debug. - * - encoding: set by user. - * - decoding: set by user. *) - debug: integer; - - (*** debug. - * - encoding: set by user. - * - decoding: set by user. *) - debug_mv: integer; - - (** error. - * - encoding: set by lavc if flags&CODEC_FLAG_PSNR - * - decoding: unused *) - error: array [0..3] of int64; - - (*** minimum MB quantizer. - * - encoding: unused - * - decoding: unused *) - mb_qmin: integer; - - (*** maximum MB quantizer. - * - encoding: unused - * - decoding: unused *) - mb_qmax: integer; - - (*** motion estimation compare function. - * - encoding: set by user. - * - decoding: unused *) - me_cmp: integer; - - (*** subpixel motion estimation compare function. - * - encoding: set by user. - * - decoding: unused *) - me_sub_cmp: integer; - (*** macroblock compare function (not supported yet). - * - encoding: set by user. - * - decoding: unused *) - mb_cmp: integer; - (*** interlaced dct compare function - * - encoding: set by user. - * - decoding: unused *) - ildct_cmp: integer; - (*** ME diamond size & shape. - * - encoding: set by user. - * - decoding: unused *) - dia_size: integer; - - (*** amount of previous MV predictors (2a+1 x 2a+1 square). - * - encoding: set by user. - * - decoding: unused *) - last_predictor_count: integer; - - (*** pre pass for motion estimation. - * - encoding: set by user. - * - decoding: unused *) - pre_me: integer; - - (*** motion estimation pre pass compare function. - * - encoding: set by user. - * - decoding: unused *) - me_pre_cmp: integer; - - (*** ME pre pass diamond size & shape. - * - encoding: set by user. - * - decoding: unused *) - pre_dia_size: integer; - - (*** subpel ME quality. - * - encoding: set by user. - * - decoding: unused *) - me_subpel_quality: integer; - - (*** callback to negotiate the pixelFormat. - * @param fmt is the list of formats which are supported by the codec, - * its terminated by -1 as 0 is a valid format, the formats are ordered by quality - * the first is allways the native one - * @return the choosen format - * - encoding: unused - * - decoding: set by user, if not set then the native format will always be choosen - *) - get_format: function (s: PAVCodecContext; const fmt: PAVPixelFormat): TAVPixelFormat; cdecl; - - (*** DTG active format information (additionnal aspect ratio - * information only used in DVB MPEG2 transport streams). 0 if - * not set. - * - encoding: unused. - * - decoding: set by decoder *) - dtg_active_format: integer; - - (*** Maximum motion estimation search range in subpel units. - * if 0 then no limit - * - encoding: set by user. - * - decoding: unused. *) - me_range: integer; - - (*** intra quantizer bias. - * - encoding: set by user. - * - decoding: unused *) - intra_quant_bias: integer; - - (*** inter quantizer bias. - * - encoding: set by user. - * - decoding: unused *) - inter_quant_bias: integer; - - (*** color table ID. - * - encoding: unused. - * - decoding: which clrtable should be used for 8bit RGB images - * table have to be stored somewhere FIXME *) - color_table_id: integer; - - (*** internal_buffer count. - * Don't touch, used by lavc default_get_buffer() *) - internal_buffer_count: integer; - - (*** internal_buffers. - * Don't touch, used by lavc default_get_buffer() *) - internal_buffer: pointer; - - (*** global quality for codecs which cannot change it per frame. - * this should be proportional to MPEG1/2/4 qscale. - * - encoding: set by user. - * - decoding: unused *) - global_quality: integer; - - (*** coder type - * - encoding: set by user. - * - decoding: unused *) - coder_type: integer; - - (*** context model - * - encoding: set by user. - * - decoding: unused *) - context_model: integer; - - (*** slice flags - * - encoding: unused - * - decoding: set by user. *) - slice_flags: integer; - - (*** XVideo Motion Acceleration - * - encoding: forbidden - * - decoding: set by decoder *) - xvmc_acceleration: integer; - - (*** macroblock decision mode - * - encoding: set by user. - * - decoding: unused *) - mb_decision: integer; - - (*** custom intra quantization matrix - * - encoding: set by user, can be NULL - * - decoding: set by lavc *) - intra_matrix: Pword; - - (*** custom inter quantization matrix - * - encoding: set by user, can be NULL - * - decoding: set by lavc *) - inter_matrix: Pword; - - (*** fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). - * this is used to workaround some encoder bugs - * - encoding: unused - * - decoding: set by user, will be converted to upper case by lavc during init *) - stream_codec_tag: array [0..3] of char; //cardinal; - - (*** scene change detection threshold. - * 0 is default, larger means fewer detected scene changes - * - encoding: set by user. - * - decoding: unused *) - scenechange_threshold: integer; - - (*** minimum lagrange multipler - * - encoding: set by user. - * - decoding: unused *) - lmin: integer; - - (*** maximum lagrange multipler - * - encoding: set by user. - * - decoding: unused *) - lmax: integer; - - (*** Palette control structure - * - encoding: ??? (no palette-enabled encoder yet) - * - decoding: set by user. *) - palctrl: PAVPaletteControl; - - (*** noise reduction strength - * - encoding: set by user. - * - decoding: unused *) - noise_reduction: integer; - - (*** called at the beginning of a frame to get cr buffer for it. - * buffer type (size, hints) must be the same. lavc won't check it. - * lavc will pass previous buffer in pic, function should return - * same buffer or new buffer with old frame "painted" into it. - * if pic.data[0] == NULL must behave like get_buffer(). - * - encoding: unused - * - decoding: set by lavc, user can override *) - reget_buffer: function (c: PAVCodecContext; pic: PAVFrame): integer; cdecl; - - (*** number of bits which should be loaded into the rc buffer before decoding starts - * - encoding: set by user. - * - decoding: unused *) - rc_initial_buffer_occupancy: integer; - inter_threshold: integer; - - (*** CODEC_FLAG2_*. - * - encoding: set by user. - * - decoding: set by user. *) - flags2: integer; - - (*** simulates errors in the bitstream to test error concealment. - * - encoding: set by user. - * - decoding: unused. *) - error_rate: integer; - - (*** MP3 antialias algorithm, see FF_AA_* below. - * - encoding: unused - * - decoding: set by user *) - antialias_algo: integer; - - (*** Quantizer noise shaping. - * - encoding: set by user - * - decoding: unused *) - quantizer_noise_shaping: integer; - - (*** Thread count. - * is used to decide how many independant tasks should be passed to execute() - * - encoding: set by user - * - decoding: set by user *) - thread_count: integer; - - (*** the codec may call this to execute several independant things. it will return only after - * finishing all tasks, the user may replace this with some multithreaded implementation, the - * default implementation will execute the parts serially - * @param count the number of things to execute - * - encoding: set by lavc, user can override - * - decoding: set by lavc, user can override *) - execute: function (c: PAVCodecContext; func: pointer; arg: PPointer; ret: PInteger; count: integer): integer; cdecl; - - (*** Thread opaque. - * can be used by execute() to store some per AVCodecContext stuff. - * - encoding: set by execute() - * - decoding: set by execute() *) - thread_opaque: pointer; - - (*** Motion estimation threshold. under which no motion estimation is - * performed, but instead the user specified motion vectors are used - * - encoding: set by user - * - decoding: unused *) - me_threshold: integer; - - (*** Macroblock threshold. under which the user specified macroblock types will be used - * - encoding: set by user - * - decoding: unused *) - mb_threshold: integer; - - (*** precision of the intra dc coefficient - 8. - * - encoding: set by user - * - decoding: unused *) - intra_dc_precision: integer; - - (*** noise vs. sse weight for the nsse comparsion function. - * - encoding: set by user - * - decoding: unused *) - nsse_weight: integer; - - (*** number of macroblock rows at the top which are skipped. - * - encoding: unused - * - decoding: set by user *) - skip_top: integer; - - (*** number of macroblock rows at the bottom which are skipped. - * - encoding: unused - * - decoding: set by user *) - skip_bottom: integer; - - (*** profile - * - encoding: set by user - * - decoding: set by lavc *) - profile: integer; - - (*** level - * - encoding: set by user - * - decoding: set by lavc *) - level: integer; - - (*** low resolution decoding. 1-> 1/2 size, 2->1/4 size - * - encoding: unused - * - decoding: set by user *) - lowres: integer; - - (*** bitsream width / height. may be different from width/height if lowres - * or other things are used - * - encoding: unused - * - decoding: set by user before init if known, codec should override / dynamically change if needed *) - coded_width, coded_height: integer; - - (*** frame skip threshold - * - encoding: set by user - * - decoding: unused *) - frame_skip_threshold: integer; - - (*** frame skip factor - * - encoding: set by user - * - decoding: unused *) - frame_skip_factor: integer; - - (*** frame skip exponent - * - encoding: set by user - * - decoding: unused *) - frame_skip_exp: integer; - - (*** frame skip comparission function - * - encoding: set by user. - * - decoding: unused *) - frame_skip_cmp: integer; - - (*** border processing masking. raises the quantizer for mbs on the borders - * of the picture. - * - encoding: set by user - * - decoding: unused *) - border_masking: single; - - (*** minimum MB lagrange multipler. - * - encoding: set by user. - * - decoding: unused *) - mb_lmin: integer; - - (*** maximum MB lagrange multipler. - * - encoding: set by user. - * - decoding: unused *) - mb_lmax: integer; - - (*** - * - encoding: set by user. - * - decoding: unused *) - me_penalty_compensation: integer; - - (*** - * - encoding: unused - * - decoding: set by user. *) - skip_loop_filter: TAVDiscard; - - (** * - * - encoding: unused - * - decoding: set by user. *) - skip_idct: TAVDiscard; - - (** * - * - encoding: unused - * - decoding: set by user. *) - skip_frame: TAVDiscard; - - (** * - * - encoding: set by user. - * - decoding: unused *) - bidir_refine: integer; - - (** * - * - encoding: set by user. - * - decoding: unused *) - brd_scale: integer; - - (** - * constant rate factor - quality-based VBR - values ~correspond to qps - * - encoding: set by user. - * - decoding: unused *) - crf: integer; - - (** - * constant quantization parameter rate control method - * - encoding: set by user. - * - decoding: unused *) - cqp: integer; - - (** - * minimum gop size - * - encoding: set by user. - * - decoding: unused *) - keyint_min: integer; - - (** - * number of reference frames - * - encoding: set by user. - * - decoding: unused *) - refs: integer; - - (** - * chroma qp offset from luma - * - encoding: set by user. - * - decoding: unused *) - chromaoffset: integer; - - (** - * influences how often b-frames are used - * - encoding: set by user. - * - decoding: unused *) - bframebias: integer; - - (** - * trellis RD quantization - * - encoding: set by user. - * - decoding: unused *) - trellis: integer; - - (** - * reduce fluctuations in qp (before curve compression) - * - encoding: set by user. - * - decoding: unused *) - complexityblur: single; - - (** - * in-loop deblocking filter alphac0 parameter - * alpha is in the range -6...6 - * - encoding: set by user. - * - decoding: unused *) - deblockalpha: integer; - - (** - * in-loop deblocking filter beta parameter - * beta is in the range -6...6 - * - encoding: set by user. - * - decoding: unused *) - deblockbeta: integer; - - (** - * macroblock subpartition sizes to consider - p8x8, p4x4, b8x8, i8x8, i4x4 - * - encoding: set by user. - * - decoding: unused *) - partitions: integer; - - (** - * direct mv prediction mode - 0 (none), 1 (spatial), 2 (temporal) - * - encoding: set by user. - * - decoding: unused *) - directpred: integer; - - (** - * audio cutoff bandwidth (0 means "automatic") . Currently used only by FAAC - * - encoding: set by user. - * - decoding: unused *) - cutoff: integer; - - (** - * multiplied by qscale for each frame and added to scene_change_score - * - encoding: set by user. - * - decoding: unused *) - scenechange_factor: integer; - - (** * - * note: value depends upon the compare functin used for fullpel ME - * - encoding: set by user. - * - decoding: unused *) - mv0_threshold: integer; - - (** - * adjusts sensitivity of b_frame_strategy 1 - * - encoding: set by user. - * - decoding: unused *) - b_sensitivity: integer; - - (** - * - encoding: set by user. - * - decoding: unused *) - compression_level: integer; - - (** - * sets whether to use LPC mode - used by FLAC encoder - * - encoding: set by user. - * - decoding: unused. *) - use_lpc: integer; - - (** - * LPC coefficient precision - used by FLAC encoder - * - encoding: set by user. - * - decoding: unused. *) - lpc_coeff_precision: integer; - - (** - * - encoding: set by user. - * - decoding: unused. *) - min_prediction_order: integer; - - (** - * - encoding: set by user. - * - decoding: unused. *) - max_prediction_order: integer; - - (** - * search method for selecting prediction order - * - encoding: set by user. - * - decoding: unused. *) - prediction_order_method: integer; - - (** - * - encoding: set by user. - * - decoding: unused. *) - min_partition_order: integer; - - (** - * - encoding: set by user. - * - decoding: unused. *) - max_partition_order: integer; - end; - -(** - * AVCodec. - *) - TAVCodec = record - name: pchar; - _type: TCodecType; - id: TCodecID; - priv_data_size: integer; - init: function (avctx: pAVCodecContext): integer; cdecl; - encode: function (avctx: PAVCodecContext; buf: pchar; buf_size: integer; data: pointer): integer; cdecl; - close: function (avctx: PAVCodecContext): integer; cdecl; - decode: function (avctx: PAVCodecContext; outdata: pointer; outdata_size: PInteger; - buf: pchar; buf_size: integer): integer; cdecl; - capabilities: integer; -// todo: check this -> -// void *dummy; // FIXME remove next time we break binary compatibility - next: PAVCodec; - flush: procedure (avctx: PAVCodecContext); cdecl; - supported_framerates: PAVRational; ///array of supported framerates, or NULL if any, array is terminated by {0,0} - pix_fmts: PAVPixelFormat; ///array of supported pixel formats, or NULL if unknown, array is terminanted by -1 - end; - -(** - * four components are given, that's all. - * the last component is alpha - *) - PAVPicture = ^TAVPicture; - TAVPicture = record - data: array [0..3] of pchar; - linesize: array [0..3] of integer; ///< number of bytes per line - end; - -(** - * AVPaletteControl - * This structure defines a method for communicating palette changes - * between and demuxer and a decoder. - * this is totally broken, palette changes should be sent as AVPackets - *) - TAVPaletteControl = record - (* demuxer sets this to 1 to indicate the palette has changed; - * decoder resets to 0 *) - palette_changed: integer; - - (* 4-byte ARGB palette entries, stored in native byte order; note that - * the individual palette components should be on a 8-bit scale; if - * the palette data comes from a IBM VGA native format, the component - * data is probably 6 bits in size and needs to be scaled *) - palette: array [0..AVPALETTE_COUNT - 1] of cardinal; - end; - - PAVSubtitleRect = ^TAVSubtitleRect; - TAVSubtitleRect = record - x: word; - y: word; - w: word; - h: word; - nb_colors: word; - linesize: integer; - rgba_palette: PCardinal; - bitmap: pchar; - end; - - PAVSubtitle = ^TAVSubtitle; - TAVSubtitle = record {20} - format: word; (* 0 = graphics *) - start_display_time: cardinal; (* relative to packet pts, in ms *) - end_display_time: cardinal; (* relative to packet pts, in ms *) - num_rects: cardinal; - rects: PAVSubtitleRect; - end; - - -(* resample.c *) - - PReSampleContext = pointer; - PAVResampleContext = pointer; - PImgReSampleContext = pointer; - -function audio_resample_init (output_channels: integer; input_channels: integer; - output_rate: integer; input_rate: integer): PReSampleContext; - cdecl; external av__codec; - -function audio_resample (s: PReSampleContext; output: PWord; input: PWord; nb_samples: integer): integer; - cdecl; external av__codec; - -procedure audio_resample_close (s: PReSampleContext); - cdecl; external av__codec; - - -function av_resample_init (out_rate: integer; in_rate: integer; filter_length: integer; - log2_phase_count: integer; linear: integer; cutoff: double): PAVResampleContext; - cdecl; external av__codec; - -function av_resample (c: PAVResampleContext; dst: PWord; src: PWord; consumed: PInteger; - src_size: integer; dst_size: integer; update_ctx: integer): integer; - cdecl; external av__codec; - -procedure av_resample_compensate (c: PAVResampleContext; sample_delta: integer; - compensation_distance: integer); - cdecl; external av__codec; - -procedure av_resample_close (c: PAVResampleContext); - cdecl; external av__codec; - - -(* YUV420 format is assumed ! *) - - function img_resample_init (output_width: integer; output_height: integer; - input_width: integer; input_height: integer): PImgReSampleContext; - cdecl; external av__codec; - - function img_resample_full_init (owidth: integer; oheight: integer; - iwidth: integer; iheight: integer; - topBand: integer; bottomBand: integer; - leftBand: integer; rightBand: integer; - padtop: integer; padbottom: integer; - padleft: integer; padright: integer): PImgReSampleContext; - cdecl; external av__codec; - - procedure img_resample (s: PImgReSampleContext; output: PAVPicture; const input: PAVPicture); - cdecl; external av__codec; - - procedure img_resample_close (s: PImgReSampleContext); - cdecl; external av__codec; - -(** - * Allocate memory for a picture. Call avpicture_free to free it. - * - * @param picture the picture to be filled in. - * @param pix_fmt the format of the picture. - * @param width the width of the picture. - * @param height the height of the picture. - * @return 0 if successful, -1 if not. - *) - function avpicture_alloc (picture: PAVPicture; pix_fmt: TAVPixelFormat; - width: integer; height: integer): integer; - cdecl; external av__codec; - - -(* Free a picture previously allocated by avpicture_alloc. *) - procedure avpicture_free (picture: PAVPicture); - cdecl; external av__codec; - - function avpicture_fill (picture: PAVPicture; ptr: pointer; - pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; - cdecl; external av__codec; - - function avpicture_layout (const src: PAVPicture; pix_fmt: TAVPixelFormat; - width: integer; height: integer; - dest: pchar; dest_size: integer): integer; - cdecl; external av__codec; - - function avpicture_get_size (pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; - cdecl; external av__codec; - - procedure avcodec_get_chroma_sub_sample (pix_fmt: TAVPixelFormat; h_shift: Pinteger; v_shift: pinteger); - cdecl; external av__codec; - - function avcodec_get_pix_fmt_name(pix_fmt: TAVPixelFormat): pchar; - cdecl; external av__codec; - - procedure avcodec_set_dimensions(s: PAVCodecContext; width: integer; height: integer); - cdecl; external av__codec; - - function avcodec_get_pix_fmt(const name: pchar): TAVPixelFormat; - cdecl; external av__codec; - - function avcodec_pix_fmt_to_codec_tag(p: TAVPixelFormat): cardinal; - cdecl; external av__codec; - - function avcodec_get_pix_fmt_loss (dst_pix_fmt: TAVPixelFormat; src_pix_fmt: TAVPixelFormat; - has_alpha: integer): integer; - cdecl; external av__codec; - - function avcodec_find_best_pix_fmt (pix_fmt_mask: integer; src_pix_fmt: TAVPixelFormat; - has_alpha: integer; loss_ptr: pinteger): integer; - cdecl; external av__codec; - - function img_get_alpha_info (const src: PAVPicture; - pix_fmt: TAVPixelFormat; - width: integer; height: integer): integer; - cdecl; external av__codec; - - -(* convert among pixel formats *) - function img_convert (dst: PAVPicture; dst_pix_fmt: TAVPixelFormat; - const src: PAVPicture; pix_fmt: TAVPixelFormat; - width: integer; height: integer): integer; - cdecl; external av__codec; - -(* deinterlace a picture *) - function avpicture_deinterlace (dst: PAVPicture; const src: PAVPicture; - pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; - cdecl; external av__codec; - -(* returns LIBAVCODEC_VERSION_INT constant *) - function avcodec_version (): cardinal; - cdecl; external av__codec; - -(* returns LIBAVCODEC_BUILD constant *) - function avcodec_build (): cardinal; - cdecl; external av__codec; - - procedure avcodec_init (); - cdecl; external av__codec; - - procedure register_avcodec (format: PAVCodec); - cdecl; external av__codec; - - function avcodec_find_encoder (id: TCodecID): PAVCodec; - cdecl; external av__codec; - function avcodec_find_encoder_by_name (name: pchar): PAVCodec; - cdecl; external av__codec; - function avcodec_find_decoder(id: TCodecID): PAVCodec; - cdecl; external av__codec; - function avcodec_find_decoder_by_name (name: pchar): PAVCodec; - cdecl; external av__codec; - procedure avcodec_string(buf: pchar; buf_size: integer; enc: PAVCodecContext; encode: integer); - cdecl; external av__codec; - - procedure avcodec_get_context_defaults (s: PAVCodecContext); - cdecl; external av__codec; - function avcodec_alloc_context (): PAVCodecContext; - cdecl; external av__codec; - procedure avcodec_get_frame_defaults (pic: PAVFrame); - cdecl; external av__codec; - function avcodec_alloc_frame (): PAVFrame; - cdecl; external av__codec; - - function avcodec_default_get_buffer (s: PAVCodecContext; pic: PAVFrame): integer; - cdecl; external av__codec; - procedure avcodec_default_release_buffer (s: PAVCodecContext; pic: PAVFrame); - cdecl; external av__codec; - function avcodec_default_reget_buffer (s: PAVCodecContext; pic: PAVFrame): integer; - cdecl; external av__codec; - procedure avcodec_align_dimensions(s: PAVCodecContext; width: Pinteger; height: PInteger); - cdecl; external av__codec; - function avcodec_check_dimensions (av_log_ctx: pointer; w: cardinal; h: cardinal): integer; - cdecl; external av__codec; - function avcodec_default_get_format(s: PAVCodecContext; const fmt: PAVPixelFormat): TAVPixelFormat; - cdecl; external av__codec; - - function avcodec_thread_init (s: PAVCodecContext; thread_count: integer): integer; - cdecl; external av__codec; - procedure avcodec_thread_free (s: PAVCodecContext); - cdecl; external av__codec; - function avcodec_thread_execute (s: PAVCodecContext; func: pointer; arg: PPointer; ret: Pinteger; count: integer): integer; - cdecl; external av__codec; - function avcodec_default_execute (s: PAVCodecContext; func: pointer; arg: PPointer; ret: Pinteger; count: integer): integer; - cdecl; external av__codec; - - -//FIXME func typedef - -(** - * opens / inits the AVCodecContext. - * not thread save! - *) - function avcodec_open (avctx: PAVCodecContext; codec: PAVCodec): integer; - cdecl; external av__codec; - - -(** - * Decode an audio frame. - * - * @param avctx the codec context. - * @param samples output buffer, 16 byte aligned - * @param frame_size_ptr the output buffer size in bytes, zero if no frame could be compressed - * @param buf input buffer, 16 byte aligned - * @param buf_size the input buffer size - * @return 0 if successful, -1 if not. - *) - - function avcodec_decode_audio (avctx: PAVCodecContext; samples: Pword; - frame_size_ptr: pinteger; - buf: pchar; buf_size: integer): integer; - cdecl; external av__codec; -(* decode a frame. - * @param buf bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE larger then the actual read bytes - * because some optimized bitstream readers read 32 or 64 bit at once and could read over the end - * @param buf_size the size of the buffer in bytes - * @param got_picture_ptr zero if no frame could be decompressed, Otherwise, it is non zero - * @return -1 if error, otherwise return the number of - * bytes used. *) - function avcodec_decode_video (avctx: PAVCodecContext; picture: PAVFrame; - got_picture_ptr: pinteger; - buf: PByte; buf_size: integer): integer; - cdecl; external av__codec; - - function avcodec_decode_subtitle (avctx: PAVCodecContext; sub: PAVSubtitle; - got_sub_ptr: pinteger; - const buf: pchar; buf_size: integer): integer; - cdecl; external av__codec; - - {$IFNDEF FPC} - function avcodec_parse_frame (avctx: PAVCodecContext; pdata: PPointer; - data_size_ptr: pinteger; - buf: pchar; buf_size: integer): integer; - cdecl; external av__codec; - {$ENDIF} - function avcodec_encode_audio (avctx: PAVCodecContext; buf: PByte; - buf_size: integer; const samples: Pword): integer; - cdecl; external av__codec; - - (* avcodec_encode_video: -1 if error *) - function avcodec_encode_video (avctx: PAVCodecContext; buf: pointer; - buf_size: integer; pict: PAVFrame): integer; - cdecl; external av__codec; - function avcodec_encode_subtitle (avctx: PAVCodecContext; buf: pchar; - buf_size: integer; const sub: PAVSubtitle): integer; - cdecl; external av__codec; - function avcodec_close (avctx: PAVCodecContext): integer; - cdecl; external av__codec; - - procedure avcodec_register_all (); - cdecl; external av__codec; - - procedure avcodec_flush_buffers (avctx: PAVCodecContext); - cdecl; external av__codec; - procedure avcodec_default_free_buffers (s: PAVCodecContext); - cdecl; external av__codec; - -(* misc usefull functions *) - -(** - * returns a single letter to describe the picture type - *) - function av_get_pict_type_char (pict_type: integer): char; - cdecl; external av__codec; - - -(** - * returns codec bits per sample - *) -function av_get_bits_per_sample (codec_id: TCodecID): integer; - cdecl; external av__codec; - -const - AV_PARSER_PTS_NB = 4; - PARSER_FLAG_COMPLETE_FRAMES = $0001; - -type - PAVCodecParserContext = ^TAVCodecParserContext; - PAVCodecParser = ^TAVCodecParser; - - TAVCodecParserContext = record - priv_data: pointer; - parser: PAVCodecParser; - frame_offset: int64; (* offset of the current frame *) - cur_offset: int64; (* current offset (incremented by each av_parser_parse()) *) - last_frame_offset: int64; (* offset of the last frame *) - (* video info *) - pict_type: integer; (* XXX: put it back in AVCodecContext *) - repeat_pict: integer; (* XXX: put it back in AVCodecContext *) - pts: int64; (* pts of the current frame *) - dts: int64; (* dts of the current frame *) - - (* private data *) - last_pts: int64; - last_dts: int64; - fetch_timestamp: integer; - - cur_frame_start_index: integer; - cur_frame_offset: array [0..AV_PARSER_PTS_NB - 1] of int64; - cur_frame_pts: array [0..AV_PARSER_PTS_NB - 1] of int64; - cur_frame_dts: array [0..AV_PARSER_PTS_NB - 1] of int64; - - flags: integer; - end; - - TAVCodecParser = record - codec_ids: array [0..4] of integer; (* several codec IDs are permitted *) - priv_data_size: integer; - parser_init: function (s: PAVCodecParserContext): integer; cdecl; - parser_parse: function (s: PAVCodecParserContext; avctx: PAVCodecContext; - poutbuf: PPointer; poutbuf_size: PInteger; - const buf: pchar; buf_size: integer): integer; cdecl; - parser_close: procedure (s: PAVCodecParserContext); cdecl; - split: function (avctx: PAVCodecContext; const buf: pchar; - buf_size: integer): integer; cdecl; - next: PAVCodecParser; - end; - - procedure av_register_codec_parser (parser: PAVCodecParser); cdecl; - cdecl; external av__codec; - - function av_parser_init (codec_id: integer): PAVCodecParserContext; - cdecl; external av__codec; - - function av_parser_parse (s: PAVCodecParserContext; - avctx: PAVCodecContext; - poutbuf: PPointer; poutbuf_size: pinteger; - const buf: pchar; buf_size: integer; - pts: int64; dts: int64): integer; - cdecl; external av__codec; - function av_parser_change (s: PAVCodecParserContext; - avctx: PAVCodecContext; - poutbuf: PPointer; poutbuf_size: PInteger; - const buf: pchar; buf_size: integer; keyframe: integer): integer; - cdecl; external av__codec; - procedure av_parser_close (s: PAVCodecParserContext); - cdecl; external av__codec; - -type - PAVBitStreamFilterContext = ^TAVBitStreamFilterContext; - PAVBitStreamFilter = ^TAVBitStreamFilter; - - TAVBitStreamFilterContext = record - priv_data: pointer; - filter: PAVBitStreamFilter; - parser: PAVCodecParserContext; - next: PAVBitStreamFilterContext; - end; - - TAVBitStreamFilter = record - name: pchar; - priv_data_size: integer; - filter: function (bsfc: PAVBitStreamFilterContext; - avctx: PAVCodecContext; args: pchar; - poutbuf: PPointer; poutbuf_size: PInteger; - buf: PByte; buf_size: integer; keyframe: integer): integer; cdecl; - next: PAVBitStreamFilter; - end; - -procedure av_register_bitstream_filter (bsf: PAVBitStreamFilter); - cdecl; external av__codec; - -function av_bitstream_filter_init (name: pchar): PAVBitStreamFilterContext; - cdecl; external av__codec; - -function av_bitstream_filter_filter (bsfc: PAVBitStreamFilterContext; - avctx: PAVCodecContext; args: pchar; - poutbuf: PPointer; poutbuf_size: PInteger; - buf: PByte; buf_size: integer; keyframe: integer): integer; - cdecl; external av__codec; -procedure av_bitstream_filter_close (bsf: PAVBitStreamFilterContext); - cdecl; external av__codec; - - -(* memory *) - procedure av_fast_realloc (ptr: pointer; size: PCardinal; min_size: Cardinal); - cdecl; external av__codec; -(* for static data only *) -(* call av_free_static to release all staticaly allocated tables *) - procedure av_free_static (); - cdecl; external av__codec; - - procedure av_mallocz_static(size: cardinal); - cdecl; external av__codec; - - procedure av_realloc_static(ptr: pointer; size: Cardinal); - cdecl; external av__codec; - - procedure img_copy (dst: PAVPicture; const src: PAVPicture; - pix_fmt: TAVPixelFormat; width: integer; height: integer); - cdecl; external av__codec; - - function img_crop (dst: PAVPicture; const src: PAVPicture; - pix_fmt: TAVPixelFormat; top_band, left_band: integer): integer; - cdecl; external av__codec; - - function img_pad (dst: PAVPicture; const src: PAVPicture; height, width: integer; - pix_fmt: TAVPixelFormat; padtop, padbottom, padleft, padright: integer; - color: PInteger): integer; - cdecl; external av__codec; - -implementation - -end. + (* + * copyright (c) 2001 Fabrice Bellard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *) +unit avcodec; + +interface + +uses + {$IFDEF win32} + windows, + {$ENDIF} + avutil, + rational, + opt; + +const + {$IFDEF win32} + av__format = 'avformat-50.dll'; + {$ELSE} + av__format = 'libavformat.so'; // .0d + {$ENDIF} + + + LIBAVUTIL_VERSION_INT = ((51 shl 16) + (16 shl 8) + 0); + LIBAVUTIL_VERSION = '51.16.0'; + LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; + + AV_NOPTS_VALUE: int64 = $8000000000000000; + AV_TIME_BASE = 1000000; + +type + TCodecID = ( + CODEC_ID_NONE, CODEC_ID_MPEG1VIDEO, + CODEC_ID_MPEG2VIDEO, //* prefered ID for MPEG Video 1 or 2 decoding */ + CODEC_ID_MPEG2VIDEO_XVMC, CODEC_ID_H261, CODEC_ID_H263, CODEC_ID_RV10, + CODEC_ID_RV20, CODEC_ID_MJPEG, CODEC_ID_MJPEGB, CODEC_ID_LJPEG, + CODEC_ID_SP5X, CODEC_ID_JPEGLS, CODEC_ID_MPEG4, CODEC_ID_RAWVIDEO, + CODEC_ID_MSMPEG4V1, CODEC_ID_MSMPEG4V2, CODEC_ID_MSMPEG4V3, + CODEC_ID_WMV1, CODEC_ID_WMV2, CODEC_ID_H263P, + CODEC_ID_H263I, CODEC_ID_FLV1, CODEC_ID_SVQ1, CODEC_ID_SVQ3, + CODEC_ID_DVVIDEO, CODEC_ID_HUFFYUV, CODEC_ID_CYUV, CODEC_ID_H264, + CODEC_ID_INDEO3, CODEC_ID_VP3, CODEC_ID_THEORA, CODEC_ID_ASV1, + CODEC_ID_ASV2, CODEC_ID_FFV1, CODEC_ID_4XM, CODEC_ID_VCR1, + CODEC_ID_CLJR, CODEC_ID_MDEC, CODEC_ID_ROQ, CODEC_ID_INTERPLAY_VIDEO, + CODEC_ID_XAN_WC3, CODEC_ID_XAN_WC4, CODEC_ID_RPZA, CODEC_ID_CINEPAK, + CODEC_ID_WS_VQA, CODEC_ID_MSRLE, CODEC_ID_MSVIDEO1, CODEC_ID_IDCIN, + CODEC_ID_8BPS, CODEC_ID_SMC, CODEC_ID_FLIC, CODEC_ID_TRUEMOTION1, + CODEC_ID_VMDVIDEO, CODEC_ID_MSZH, CODEC_ID_ZLIB, CODEC_ID_QTRLE, + CODEC_ID_SNOW, CODEC_ID_TSCC, CODEC_ID_ULTI, CODEC_ID_QDRAW, + CODEC_ID_VIXL, CODEC_ID_QPEG, CODEC_ID_XVID, CODEC_ID_PNG, + CODEC_ID_PPM, CODEC_ID_PBM, CODEC_ID_PGM, CODEC_ID_PGMYUV, + CODEC_ID_PAM, CODEC_ID_FFVHUFF, CODEC_ID_RV30, CODEC_ID_RV40, + CODEC_ID_VC1, CODEC_ID_WMV3, CODEC_ID_LOCO, CODEC_ID_WNV1, + CODEC_ID_AASC, CODEC_ID_INDEO2, CODEC_ID_FRAPS, CODEC_ID_TRUEMOTION2, + CODEC_ID_BMP, CODEC_ID_CSCD, CODEC_ID_MMVIDEO, CODEC_ID_ZMBV, + CODEC_ID_AVS, CODEC_ID_SMACKVIDEO, CODEC_ID_NUV, CODEC_ID_KMVC, + CODEC_ID_FLASHSV, CODEC_ID_CAVS, CODEC_ID_JPEG2000, CODEC_ID_VMNC, + CODEC_ID_VP5, CODEC_ID_VP6, CODEC_ID_VP6F, + + //* various pcm "codecs" */ + CODEC_ID_PCM_S16LE= $10000, CODEC_ID_PCM_S16BE, CODEC_ID_PCM_U16LE, + CODEC_ID_PCM_U16BE, CODEC_ID_PCM_S8, CODEC_ID_PCM_U8, CODEC_ID_PCM_MULAW, + CODEC_ID_PCM_ALAW, CODEC_ID_PCM_S32LE, CODEC_ID_PCM_S32BE, CODEC_ID_PCM_U32LE, + CODEC_ID_PCM_U32BE, CODEC_ID_PCM_S24LE, CODEC_ID_PCM_S24BE, CODEC_ID_PCM_U24LE, + CODEC_ID_PCM_U24BE, CODEC_ID_PCM_S24DAUD, + //* various adpcm codecs */ + CODEC_ID_ADPCM_IMA_QT= $11000, CODEC_ID_ADPCM_IMA_WAV, CODEC_ID_ADPCM_IMA_DK3, + CODEC_ID_ADPCM_IMA_DK4, CODEC_ID_ADPCM_IMA_WS, CODEC_ID_ADPCM_IMA_SMJPEG, + CODEC_ID_ADPCM_MS, CODEC_ID_ADPCM_4XM, CODEC_ID_ADPCM_XA, CODEC_ID_ADPCM_ADX, + CODEC_ID_ADPCM_EA, CODEC_ID_ADPCM_G726, CODEC_ID_ADPCM_CT, CODEC_ID_ADPCM_SWF, + CODEC_ID_ADPCM_YAMAHA, CODEC_ID_ADPCM_SBPRO_4, CODEC_ID_ADPCM_SBPRO_3, + CODEC_ID_ADPCM_SBPRO_2, + //* AMR */ + CODEC_ID_AMR_NB= $12000, CODEC_ID_AMR_WB, + //* RealAudio codecs*/ + CODEC_ID_RA_144= $13000, CODEC_ID_RA_288, + //* various DPCM codecs */ + CODEC_ID_ROQ_DPCM= $14000, CODEC_ID_INTERPLAY_DPCM, CODEC_ID_XAN_DPCM, + CODEC_ID_SOL_DPCM, CODEC_ID_MP2= $15000, + CODEC_ID_MP3, //* prefered ID for MPEG Audio layer 1, 2 or3 decoding */ + CODEC_ID_AAC, CODEC_ID_MPEG4AAC, CODEC_ID_AC3, CODEC_ID_DTS, CODEC_ID_VORBIS, + CODEC_ID_DVAUDIO, CODEC_ID_WMAV1, CODEC_ID_WMAV2, CODEC_ID_MACE3, + CODEC_ID_MACE6, CODEC_ID_VMDAUDIO, CODEC_ID_SONIC, CODEC_ID_SONIC_LS, + CODEC_ID_FLAC, CODEC_ID_MP3ADU, CODEC_ID_MP3ON4, CODEC_ID_SHORTEN, + CODEC_ID_ALAC, CODEC_ID_WESTWOOD_SND1, CODEC_ID_GSM, CODEC_ID_QDM2, + CODEC_ID_COOK, CODEC_ID_TRUESPEECH, CODEC_ID_TTA, CODEC_ID_SMACKAUDIO, + CODEC_ID_QCELP, CODEC_ID_WAVPACK, + //* subtitle codecs */ + CODEC_ID_DVD_SUBTITLE= $17000, CODEC_ID_DVB_SUBTITLE, + + CODEC_ID_MPEG2TS= $20000 //* _FAKE_ codec to indicate a raw MPEG2 transport + // stream (only used by libavformat) */ + ); + +//* CODEC_ID_MP3LAME is absolete */ +const + CODEC_ID_MP3LAME = CODEC_ID_MP3; + + AVPALETTE_SIZE = 1024; + AVPALETTE_COUNT = 256; + +type + TCodecType = ( + CODEC_TYPE_UNKNOWN = -1, + CODEC_TYPE_VIDEO, + CODEC_TYPE_AUDIO, + CODEC_TYPE_DATA, + CODEC_TYPE_SUBTITLE + ); + +//* currently unused, may be used if 24/32 bits samples ever supported */ +//* all in native endian */ + TSampleFormat = ( + SAMPLE_FMT_NONE = -1, + SAMPLE_FMT_U8, ///< unsigned 8 bits + SAMPLE_FMT_S16, ///< signed 16 bits + SAMPLE_FMT_S24, ///< signed 24 bits + SAMPLE_FMT_S32, ///< signed 32 bits + SAMPLE_FMT_FLT ///< float + ); + +const +//* in bytes */ + AVCODEC_MAX_AUDIO_FRAME_SIZE = 192000; // 1 second of 48khz 32bit audio + +(** + * Required number of additionally allocated bytes at the end of the input bitstream for decoding. + * this is mainly needed because some optimized bitstream readers read + * 32 or 64 bit at once and could read over the end
+ * Note, if the first 23 bits of the additional bytes are not 0 then damaged + * MPEG bitstreams could cause overread and segfault + *) + FF_INPUT_BUFFER_PADDING_SIZE = 8; + +(** + * minimum encoding buffer size. + * used to avoid some checks during header writing + *) + FF_MIN_BUFFER_SIZE = 16384; + +type +//* motion estimation type, EPZS by default */ + TMotion_Est_ID = ( + ME_ZERO = 1, + ME_FULL, + ME_LOG, + ME_PHODS, + ME_EPZS, + ME_X1, + ME_HEX, + ME_UMH, + ME_ITER + ); + + TAVDiscard = ( +//we leave some space between them for extensions (drop some keyframes for intra only or drop just some bidir frames) + AVDISCARD_NONE = -16, ///< discard nothing + AVDISCARD_DEFAULT= 0, ///< discard useless packets like 0 size packets in avi + AVDISCARD_NONREF = 8, ///< discard all non reference + AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames + AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes + AVDISCARD_ALL = 48, ///< discard all + AVDISCARD_FUCK = $FFFFFF + ); + + PRcOverride = ^TRcOverride; + TRcOverride = record {16} + start_frame: integer; + end_frame: integer; + qscale: integer; // if this is 0 then quality_factor will be used instead + quality_factor: single; + end; + +const + FF_MAX_B_FRAMES = 16; + +(* encoding support + these flags can be passed in AVCodecContext.flags before initing + Note: not everything is supported yet. +*) + + CODEC_FLAG_QSCALE = $0002; ///< use fixed qscale + CODEC_FLAG_4MV = $0004; ///< 4 MV per MB allowed / Advanced prediction for H263 + CODEC_FLAG_QPEL = $0010; ///< use qpel MC + CODEC_FLAG_GMC = $0020; ///< use GMC + CODEC_FLAG_MV0 = $0040; ///< always try a MB with MV=<0,0> + CODEC_FLAG_PART = $0080; ///< use data partitioning +//* parent program gurantees that the input for b-frame containing streams is not written to +// for at least s->max_b_frames+1 frames, if this is not set than the input will be copied */ + CODEC_FLAG_INPUT_PRESERVED = $0100; + CODEC_FLAG_PASS1 = $0200; ///< use internal 2pass ratecontrol in first pass mode + CODEC_FLAG_PASS2 = $0400; ///< use internal 2pass ratecontrol in second pass mode + CODEC_FLAG_EXTERN_HUFF = $1000; ///< use external huffman table (for mjpeg) + CODEC_FLAG_GRAY = $2000; ///< only decode/encode grayscale + CODEC_FLAG_EMU_EDGE = $4000; ///< don't draw edges + CODEC_FLAG_PSNR = $8000; ///< error[?] variables will be set during encoding + CODEC_FLAG_TRUNCATED = $00010000; //** input bitstream might be truncated at a random location instead + // of only at frame boundaries */ + CODEC_FLAG_NORMALIZE_AQP = $00020000; ///< normalize adaptive quantization + CODEC_FLAG_INTERLACED_DCT = $00040000; ///< use interlaced dct + CODEC_FLAG_LOW_DELAY = $00080000; ///< force low delay + CODEC_FLAG_ALT_SCAN = $00100000; ///< use alternate scan + CODEC_FLAG_TRELLIS_QUANT = $00200000; ///< use trellis quantization + CODEC_FLAG_GLOBAL_HEADER = $00400000; ///< place global headers in extradata instead of every keyframe + CODEC_FLAG_BITEXACT = $00800000; ///< use only bitexact stuff (except (i)dct) +//* Fx : Flag for h263+ extra options */ + CODEC_FLAG_H263P_AIC = $01000000; ///< H263 Advanced intra coding / MPEG4 AC prediction (remove this) + CODEC_FLAG_AC_PRED = $01000000; ///< H263 Advanced intra coding / MPEG4 AC prediction + CODEC_FLAG_H263P_UMV = $02000000; ///< Unlimited motion vector + CODEC_FLAG_CBP_RD = $04000000; ///< use rate distortion optimization for cbp + CODEC_FLAG_QP_RD = $08000000; ///< use rate distortion optimization for qp selectioon + CODEC_FLAG_H263P_AIV = $00000008; ///< H263 Alternative inter vlc + CODEC_FLAG_OBMC = $00000001; ///< OBMC + CODEC_FLAG_LOOP_FILTER = $00000800; ///< loop filter + CODEC_FLAG_H263P_SLICE_STRUCT = $10000000; + CODEC_FLAG_INTERLACED_ME = $20000000; ///< interlaced motion estimation + CODEC_FLAG_SVCD_SCAN_OFFSET = $40000000; ///< will reserve space for SVCD scan offset user data + CODEC_FLAG_CLOSED_GOP = $80000000; + CODEC_FLAG2_FAST = $00000001; ///< allow non spec compliant speedup tricks + CODEC_FLAG2_STRICT_GOP = $00000002; ///< strictly enforce GOP size + CODEC_FLAG2_NO_OUTPUT = $00000004; ///< skip bitstream encoding + CODEC_FLAG2_LOCAL_HEADER = $00000008; ///< place global headers at every keyframe instead of in extradata + CODEC_FLAG2_BPYRAMID = $00000010; ///< H.264 allow b-frames to be used as references + CODEC_FLAG2_WPRED = $00000020; ///< H.264 weighted biprediction for b-frames + CODEC_FLAG2_MIXED_REFS = $00000040; ///< H.264 multiple references per partition + CODEC_FLAG2_8X8DCT = $00000080; ///< H.264 high profile 8x8 transform + CODEC_FLAG2_FASTPSKIP = $00000100; ///< H.264 fast pskip + CODEC_FLAG2_AUD = $00000200; ///< H.264 access unit delimiters + CODEC_FLAG2_BRDO = $00000400; ///< b-frame rate-distortion optimization + CODEC_FLAG2_INTRA_VLC = $00000800; ///< use MPEG-2 intra VLC table + CODEC_FLAG2_MEMC_ONLY = $00001000; ///< only do ME/MC (I frames -> ref, P frame -> ME+MC) + +(* Unsupported options : + * Syntax Arithmetic coding (SAC) + * Reference Picture Selection + * Independant Segment Decoding */ +/* /Fx */ +/* codec capabilities *) + +const + CODEC_CAP_DRAW_HORIZ_BAND = $001; ///< decoder can use draw_horiz_band callback +(** + * Codec uses get_buffer() for allocating buffers. + * direct rendering method 1 *) + CODEC_CAP_DR1 = $002; +(* if 'parse_only' field is true, then avcodec_parse_frame() can be used *) + CODEC_CAP_PARSE_ONLY = $004; + CODEC_CAP_TRUNCATED = $008; +//* codec can export data for HW decoding (XvMC) */ + CODEC_CAP_HWACCEL = $010; + +(** + * codec has a non zero delay and needs to be feeded with NULL at the end to get the delayed data. + * if this is not set, the codec is guranteed to never be feeded with NULL data *) + CODEC_CAP_DELAY = $0020; +(** + * Codec can be fed a final frame with a smaller size. + * This can be used to prevent truncation of the last audio samples. *) + CODEC_CAP_SMALL_LAST_FRAME = $0040; + +//the following defines may change, don't expect compatibility if you use them + MB_TYPE_INTRA4x4 = $001; + MB_TYPE_INTRA16x16 = $002; //FIXME h264 specific + MB_TYPE_INTRA_PCM = $004; //FIXME h264 specific + MB_TYPE_16x16 = $008; + MB_TYPE_16x8 = $010; + MB_TYPE_8x16 = $020; + MB_TYPE_8x8 = $040; + MB_TYPE_INTERLACED = $080; + MB_TYPE_DIRECT2 = $100; //FIXME + MB_TYPE_ACPRED = $200; + MB_TYPE_GMC = $400; + MB_TYPE_SKIP = $800; + MB_TYPE_P0L0 = $1000; + MB_TYPE_P1L0 = $2000; + MB_TYPE_P0L1 = $4000; + MB_TYPE_P1L1 = $8000; + MB_TYPE_L0 = (MB_TYPE_P0L0 or MB_TYPE_P1L0); + MB_TYPE_L1 = (MB_TYPE_P0L1 or MB_TYPE_P1L1); + MB_TYPE_L0L1 = (MB_TYPE_L0 or MB_TYPE_L1); + MB_TYPE_QUANT = $0010000; + MB_TYPE_CBP = $0020000; +//Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...) + +type +(** + * Pan Scan area. + * this specifies the area which should be displayed. Note there may be multiple such areas for one frame *) + PAVPanScan = ^TAVPanScan; + TAVPanScan = record {24} + (*** id. + * - encoding: set by user. + * - decoding: set by lavc *) + id: integer; + + (*** width and height in 1/16 pel + * - encoding: set by user. + * - decoding: set by lavc *) + width: integer; + height: integer; + + (*** position of the top left corner in 1/16 pel for up to 3 fields/frames. + * - encoding: set by user. + * - decoding: set by lavc *) + position: array [0..2] of array [0..1] of smallint; + end; + +const + FF_QSCALE_TYPE_MPEG1 = 0; + FF_QSCALE_TYPE_MPEG2 = 1; + + FF_BUFFER_TYPE_INTERNAL = 1; + FF_BUFFER_TYPE_USER = 2; ///< Direct rendering buffers (image is (de)allocated by user) + FF_BUFFER_TYPE_SHARED = 4; ///< buffer from somewhere else, don't dealloc image (data/base), all other tables are not shared + FF_BUFFER_TYPE_COPY = 8; ///< just a (modified) copy of some other buffer, don't dealloc anything + + + FF_I_TYPE = 1; // Intra + FF_P_TYPE = 2; // Predicted + FF_B_TYPE = 3; // Bi-dir predicted + FF_S_TYPE = 4; // S(GMC)-VOP MPEG4 + FF_SI_TYPE = 5; + FF_SP_TYPE = 6; + + FF_BUFFER_HINTS_VALID = $01; // Buffer hints value is meaningful (if 0 ignore) + FF_BUFFER_HINTS_READABLE = $02; // Codec will read from buffer + FF_BUFFER_HINTS_PRESERVE = $04; // User must not alter buffer content + FF_BUFFER_HINTS_REUSABLE = $08; // Codec will reuse the buffer (update) + +type + (*** Audio Video Frame. *) + PAVFrame = ^TAVFrame; + TAVFrame = record {200} + (*** pointer to the picture planes. + * this might be different from the first allocated byte *) + data: array [0..3] of pointer; + linesize: array [0..3] of integer; + (*** pointer to the first allocated byte of the picture. can be used in get_buffer/release_buffer + * this isn't used by lavc unless the default get/release_buffer() is used*) + base: array [0..3] of pchar; + (*** 1 -> keyframe, 0-> not *) + key_frame: integer; + (*** picture type of the frame, see ?_TYPE below.*) + pict_type: integer; + (*** presentation timestamp in time_base units (time when frame should be shown to user) + * if AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed*) + pts: int64; + (*** picture number in bitstream order.*) + coded_picture_number: integer; + (*** picture number in display order.*) + display_picture_number: integer; + (*** quality (between 1 (good) and FF_LAMBDA_MAX (bad)) *) + quality: integer; + (*** buffer age (1->was last buffer and dint change, 2->..., ...).*) + age: integer; + (*** is this picture used as reference*) + reference: integer; + (*** QP table*) + qscale_table: pchar; + (*** QP store stride*) + qstride: integer; + (*** mbskip_table[mb]>=1 if MB didnt change*) + mbskip_table: pchar; + (** + * Motion vector table. + * @code + * example: + * int mv_sample_log2= 4 - motion_subsample_log2; + * int mb_width= (width+15)>>4; + * int mv_stride= (mb_width << mv_sample_log2) + 1; + * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y]; + * @endcode + * - encoding: set by user + * - decoding: set by lavc *) + motion_val: array [0..1] of pointer; + (*** Macroblock type table + * mb_type_base + mb_width + 2 *) + mb_type: PCardinal; + (*** log2 of the size of the block which a single vector in motion_val represents: + * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)*) + motion_subsample_log2: byte; + (*** for some private data of the user*) + opaque: pointer; + (*** error*) + error: array [0..3] of int64; + (*** type of the buffer (to keep track of who has to dealloc data[*]) + * Note: user allocated (direct rendering) & internal buffers can not coexist currently*) + _type: integer; + (*** when decoding, this signal how much the picture must be delayed. + * extra_delay = repeat_pict / (2*fps)*) + repeat_pict: integer; + qscale_type: Integer; + (*** The content of the picture is interlaced.*) + interlaced_frame: Integer; + (*** if the content is interlaced, is top field displayed first.*) + top_field_first: integer; + (*** Pan scan.*) + pan_scan: PAVPanScan; + (*** tell user application that palette has changed from previous frame.*) + palette_has_changed: integer; + (*** Codec suggestion on buffer type if != 0 + * - decoding: set by lavc (before get_buffer() call))*) + buffer_hints: integer; + (*** DCT coeffitients*) + dct_coeff: PSmallInt; + (*** Motion referece frame index*) + ref_index: array [0..1] of pchar; + end; + +const + DEFAULT_FRAME_RATE_BASE = 1001000; + + FF_BUG_AUTODETECT = 1; ///< autodetection + FF_BUG_OLD_MSMPEG4 = 2; + FF_BUG_XVID_ILACE = 4; + FF_BUG_UMP4 = 8; + FF_BUG_NO_PADDING = 16; + FF_BUG_AMV = 32; + FF_BUG_AC_VLC = 0; ///< will be removed, libavcodec can now handle these non compliant files by default + FF_BUG_QPEL_CHROMA = 64; + FF_BUG_STD_QPEL = 128; + FF_BUG_QPEL_CHROMA2 = 256; + FF_BUG_DIRECT_BLOCKSIZE = 512; + FF_BUG_EDGE = 1024; + FF_BUG_HPEL_CHROMA = 2048; + FF_BUG_DC_CLIP = 4096; + FF_BUG_MS = 8192; ///< workaround various bugs in microsofts broken decoders + + FF_COMPLIANCE_VERY_STRICT = 2; ///< strictly conform to a older more strict version of the spec or reference software + FF_COMPLIANCE_STRICT = 1; ///< strictly conform to all the things in the spec no matter what consequences + FF_COMPLIANCE_NORMAL = 0; + FF_COMPLIANCE_INOFFICIAL = -1; ///< allow inofficial extensions + FF_COMPLIANCE_EXPERIMENTAL = -2; ///< allow non standarized experimental things + + FF_ER_CAREFUL = 1; + FF_ER_COMPLIANT = 2; + FF_ER_AGGRESSIVE = 3; + FF_ER_VERY_AGGRESSIVE = 4; + + FF_DCT_AUTO = 0; + FF_DCT_FASTINT = 1; + FF_DCT_INT = 2; + FF_DCT_MMX = 3; + FF_DCT_MLIB = 4; + FF_DCT_ALTIVEC = 5; + FF_DCT_FAAN = 6; + + FF_IDCT_AUTO = 0; + FF_IDCT_INT = 1; + FF_IDCT_SIMPLE = 2; + FF_IDCT_SIMPLEMMX = 3; + FF_IDCT_LIBMPEG2MMX = 4; + FF_IDCT_PS2 = 5; + FF_IDCT_MLIB = 6; + FF_IDCT_ARM = 7; + FF_IDCT_ALTIVEC = 8; + FF_IDCT_SH4 = 9; + FF_IDCT_SIMPLEARM = 10; + FF_IDCT_H264 = 11; + FF_IDCT_VP3 = 12; + FF_IDCT_IPP = 13; + FF_IDCT_XVIDMMX = 14; + + FF_EC_GUESS_MVS = 1; + FF_EC_DEBLOCK = 2; + + FF_MM_FORCE = $80000000; (* force usage of selected flags (OR) *) + (* lower 16 bits - CPU features *) + + FF_MM_MMX = $0001; (* standard MMX *) + FF_MM_3DNOW = $0004; (* AMD 3DNOW *) + FF_MM_MMXEXT = $0002; (* SSE integer functions or AMD MMX ext *) + FF_MM_SSE = $0008; (* SSE functions *) + FF_MM_SSE2 = $0010; (* PIV SSE2 functions *) + FF_MM_3DNOWEXT = $0020; (* AMD 3DNowExt *) + FF_MM_IWMMXT = $0100; (* XScale IWMMXT *) + + FF_PRED_LEFT = 0; + FF_PRED_PLANE = 1; + FF_PRED_MEDIAN = 2; + + FF_DEBUG_PICT_INFO = 1; + FF_DEBUG_RC = 2; + FF_DEBUG_BITSTREAM = 4; + FF_DEBUG_MB_TYPE = 8; + FF_DEBUG_QP = 16; + FF_DEBUG_MV = 32; + FF_DEBUG_DCT_COEFF = $00000040; + FF_DEBUG_SKIP = $00000080; + FF_DEBUG_STARTCODE = $00000100; + FF_DEBUG_PTS = $00000200; + FF_DEBUG_ER = $00000400; + FF_DEBUG_MMCO = $00000800; + FF_DEBUG_BUGS = $00001000; + FF_DEBUG_VIS_QP = $00002000; + FF_DEBUG_VIS_MB_TYPE = $00004000; + + FF_DEBUG_VIS_MV_P_FOR = $00000001; //visualize forward predicted MVs of P frames + FF_DEBUG_VIS_MV_B_FOR = $00000002; //visualize forward predicted MVs of B frames + FF_DEBUG_VIS_MV_B_BACK = $00000004; //visualize backward predicted MVs of B frames + + FF_CMP_SAD = 0; + FF_CMP_SSE = 1; + FF_CMP_SATD = 2; + FF_CMP_DCT = 3; + FF_CMP_PSNR = 4; + FF_CMP_BIT = 5; + FF_CMP_RD = 6; + FF_CMP_ZERO = 7; + FF_CMP_VSAD = 8; + FF_CMP_VSSE = 9; + FF_CMP_NSSE = 10; + FF_CMP_W53 = 11; + FF_CMP_W97 = 12; + FF_CMP_DCTMAX = 13; + FF_CMP_CHROMA = 256; + + FF_DTG_AFD_SAME = 8; + FF_DTG_AFD_4_3 = 9; + FF_DTG_AFD_16_9 = 10; + FF_DTG_AFD_14_9 = 11; + FF_DTG_AFD_4_3_SP_14_9 = 13; + FF_DTG_AFD_16_9_SP_14_9 = 14; + FF_DTG_AFD_SP_4_3 = 15; + + FF_DEFAULT_QUANT_BIAS = 999999; + + FF_LAMBDA_SHIFT = 7; + FF_LAMBDA_SCALE = (1 shl FF_LAMBDA_SHIFT); + FF_QP2LAMBDA = 118; ///< factor to convert from H.263 QP to lambda + FF_LAMBDA_MAX = (256 * 128 - 1); + + FF_QUALITY_SCALE = FF_LAMBDA_SCALE; //FIXME maybe remove + + FF_CODER_TYPE_VLC = 0; + FF_CODER_TYPE_AC = 1; + + SLICE_FLAG_CODED_ORDER = $0001; ///< draw_horiz_band() is called in coded order instead of display + SLICE_FLAG_ALLOW_FIELD = $0002; ///< allow draw_horiz_band() with field slices (MPEG2 field pics) + SLICE_FLAG_ALLOW_PLANE = $0004; ///< allow draw_horiz_band() with 1 component at a time (SVQ1) + + FF_MB_DECISION_SIMPLE = 0; ///< uses mb_cmp + FF_MB_DECISION_BITS = 1; ///< chooses the one which needs the fewest bits + FF_MB_DECISION_RD = 2; ///< rate distoration + + FF_AA_AUTO = 0; + FF_AA_FASTINT = 1; //not implemented yet + FF_AA_INT = 2; + FF_AA_FLOAT = 3; + + FF_PROFILE_UNKNOWN = -99; + + FF_LEVEL_UNKNOWN = -99; + + X264_PART_I4X4 = $001; (* Analyse i4x4 *) + X264_PART_I8X8 = $002; (* Analyse i8x8 (requires 8x8 transform) *) + X264_PART_P8X8 = $010; (* Analyse p16x8, p8x16 and p8x8 *) + X264_PART_P4X4 = $020; (* Analyse p8x4, p4x8, p4x4 *) + X264_PART_B8X8 = $100; (* Analyse b16x8, b8x16 and b8x8 *) + +type + PAVCLASS = ^TAVCLASS; + PAVCodecContext = ^TAVCodecContext; + PAVCodec = ^TAVCodec; + PAVPaletteControl = ^TAVPaletteControl; + + TAVCLASS = record {12} + class_name: pchar; + (* actually passing a pointer to an AVCodecContext + or AVFormatContext, which begin with an AVClass. + Needed because av_log is in libavcodec and has no visibility + of AVIn/OutputFormat *) + item_name: function (): pchar; cdecl; + option: PAVOption; + end; + + TAVCodecContext = record {720} + (*** Info on struct for av_log + * - set by avcodec_alloc_context *) + av_class: PAVClass; + (*** the average bitrate. + * - encoding: set by user. unused for constant quantizer encoding + * - decoding: set by lavc. 0 or some bitrate if this info is available in the stream *) + bit_rate: integer; + (*** number of bits the bitstream is allowed to diverge from the reference. + * the reference can be CBR (for CBR pass1) or VBR (for pass2) + * - encoding: set by user. unused for constant quantizer encoding + * - decoding: unused *) + bit_rate_tolerance: integer; + (*** CODEC_FLAG_*. + * - encoding: set by user. + * - decoding: set by user. *) + flags: integer; + (*** some codecs needs additionnal format info. It is stored here + * - encoding: set by user. + * - decoding: set by lavc. (FIXME is this ok?) *) + sub_id: integer; + + (** + * motion estimation algorithm used for video coding. + * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex), + * 8 (umh), 9 (iter) [7, 8 are x264 specific, 9 is snow specific] + * - encoding: MUST be set by user. + * - decoding: unused *) + me_method: integer; + + (** + * some codecs need / can use extra-data like huffman tables. + * mjpeg: huffman tables + * rv10: additional flags + * mpeg4: global headers (they can be in the bitstream or here) + * the allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger + * then extradata_size to avoid prolems if its read with the bitstream reader + * the bytewise contents of extradata must not depend on the architecture or cpu endianness + * - encoding: set/allocated/freed by lavc. + * - decoding: set/allocated/freed by user. + *) + extradata: pointer; + extradata_size: integer; + + (** + * this is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. for fixed-fps content, + * timebase should be 1/framerate and timestamp increments should be + * identically 1. + * - encoding: MUST be set by user + * - decoding: set by lavc. *) + time_base: TAVRational; + + (* video only *) + (*** picture width / height. + * - encoding: MUST be set by user. + * - decoding: set by lavc. + * Note, for compatibility its possible to set this instead of + * coded_width/height before decoding *) + width, height: integer; + (*** the number of pictures in a group of pitures, or 0 for intra_only. + * - encoding: set by user. + * - decoding: unused *) + gop_size: integer; + (*** pixel format, see PIX_FMT_xxx. + * - encoding: set by user. + * - decoding: set by lavc. *) + pix_fmt: TAVPixelFormat; + (*** Frame rate emulation. If not zero lower layer (i.e. format handler) + * has to read frames at native frame rate. + * - encoding: set by user. + * - decoding: unused. *) + rate_emu: integer; + (*** if non NULL, 'draw_horiz_band' is called by the libavcodec + * decoder to draw an horizontal band. It improve cache usage. Not + * all codecs can do that. You must check the codec capabilities + * before + * - encoding: unused + * - decoding: set by user. + * @param height the height of the slice + * @param y the y position of the slice + * @param type 1->top field, 2->bottom field, 3->frame + * @param offset offset into the AVFrame.data from which the slice should be read *) + draw_horiz_band: procedure (s: PAVCodecContext; + const src: PAVFrame; offset: PInteger; + y: integer; _type: integer; height: integer); cdecl; + + (* audio only *) + sample_rate: integer; ///< samples per sec + channels: integer; + (*** audio sample format. + * - encoding: set by user. + * - decoding: set by lavc. *) + sample_fmt: TSampleFormat; ///< sample format, currenly unused + + (* the following data should not be initialized *) + (*** samples per packet. initialized when calling 'init' *) + frame_size: integer; + frame_number: integer; ///< audio or video frame number + real_pict_num: integer; ///< returns the real picture number of previous encoded frame + + (*** number of frames the decoded output will be delayed relative to + * the encoded input. + * - encoding: set by lavc. + * - decoding: unused *) + delay: integer; + + (* - encoding parameters *) + qcompress: single; ///< amount of qscale change between easy & hard scenes (0.0-1.0) + qblur: single; ///< amount of qscale smoothing over time (0.0-1.0) + + (*** minimum quantizer. + * - encoding: set by user. + * - decoding: unused *) + qmin: integer; + + (*** maximum quantizer. + * - encoding: set by user. + * - decoding: unused *) + qmax: integer; + + (*** maximum quantizer difference etween frames. + * - encoding: set by user. + * - decoding: unused *) + max_qdiff: integer; + + (*** maximum number of b frames between non b frames. + * note: the output will be delayed by max_b_frames+1 relative to the input + * - encoding: set by user. + * - decoding: unused *) + max_b_frames: integer; + + (*** qscale factor between ip and b frames. + * - encoding: set by user. + * - decoding: unused *) + b_quant_factor: single; + + (** obsolete FIXME remove *) + rc_strategy: integer; + b_frame_strategy: integer; + + (*** hurry up amount. + * deprecated in favor of skip_idct and skip_frame + * - encoding: unused + * - decoding: set by user. 1-> skip b frames, 2-> skip idct/dequant too, 5-> skip everything except header *) + hurry_up: integer; + + codec: PAVCodec; + + priv_data: pointer; + + (* unused, FIXME remove*) + rtp_mode: integer; + + rtp_payload_size: integer; (* The size of the RTP payload: the coder will *) + (* do it's best to deliver a chunk with size *) + (* below rtp_payload_size, the chunk will start *) + (* with a start code on some codecs like H.263 *) + (* This doesn't take account of any particular *) + (* headers inside the transmited RTP payload *) + + + (* The RTP callback: This function is called *) + (* every time the encoder has a packet to send *) + (* Depends on the encoder if the data starts *) + (* with a Start Code (it should) H.263 does. *) + (* mb_nb contains the number of macroblocks *) + (* encoded in the RTP payload *) + rtp_callback: procedure (avctx: PAVCodecContext; data: pointer; + size: integer; mb_nb: integer); cdecl; + + (* statistics, used for 2-pass encoding *) + mv_bits: integer; + header_bits: integer; + i_tex_bits: integer; + p_tex_bits: integer; + i_count: integer; + p_count: integer; + skip_count: integer; + misc_bits: integer; + + (*** number of bits used for the previously encoded frame. + * - encoding: set by lavc + * - decoding: unused *) + frame_bits: integer; + + (*** private data of the user, can be used to carry app specific stuff. + * - encoding: set by user + * - decoding: set by user *) + opaque: pointer; + + codec_name: array [0..31] of char; + codec_type: TCodecType; (* see CODEC_TYPE_xxx *) + codec_id: TCodecID; (* see CODEC_ID_xxx *) + + (*** fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). + * this is used to workaround some encoder bugs + * - encoding: set by user, if not then the default based on codec_id will be used + * - decoding: set by user, will be converted to upper case by lavc during init *) +// codec_tag: cardinal; // ìîæíî array [0..3] of char - òîãäà âèäíî FOURCC + codec_tag: array [0..3] of char; + + (*** workaround bugs in encoders which sometimes cannot be detected automatically. + * - encoding: set by user + * - decoding: set by user *) + workaround_bugs: integer; + + (*** luma single coeff elimination threshold. + * - encoding: set by user + * - decoding: unused *) + luma_elim_threshold: integer; + + (*** chroma single coeff elimination threshold. + * - encoding: set by user + * - decoding: unused *) + chroma_elim_threshold: integer; + + (*** strictly follow the std (MPEG4, ...). + * - encoding: set by user + * - decoding: unused *) + strict_std_compliance: integer; + + (*** qscale offset between ip and b frames. + * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset) + * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset) + * - encoding: set by user. + * - decoding: unused *) + b_quant_offset: single; + + (*** error resilience higher values will detect more errors but may missdetect + * some more or less valid parts as errors. + * - encoding: unused + * - decoding: set by user *) + error_resilience: integer; + + (*** called at the beginning of each frame to get a buffer for it. + * if pic.reference is set then the frame will be read later by lavc + * avcodec_align_dimensions() should be used to find the required width and + * height, as they normally need to be rounded up to the next multiple of 16 + * - encoding: unused + * - decoding: set by lavc, user can override *) + get_buffer: function (c: PAVCodecContext; pic: PAVFrame): integer; cdecl; + + (*** called to release buffers which where allocated with get_buffer. + * a released buffer can be reused in get_buffer() + * pic.data[*] must be set to NULL + * - encoding: unused + * - decoding: set by lavc, user can override *) + release_buffer: procedure (c: PAVCodecContext; pic: PAVFrame); cdecl; + + (*** if 1 the stream has a 1 frame delay during decoding. + * - encoding: set by lavc + * - decoding: set by lavc *) + has_b_frames: integer; + + (*** number of bytes per packet if constant and known or 0 + * used by some WAV based audio codecs *) + block_align: integer; + + parse_only: integer; (* - decoding only: if true, only parsing is done + (function avcodec_parse_frame()). The frame + data is returned. Only MPEG codecs support this now. *) + + (*** 0-> h263 quant 1-> mpeg quant. + * - encoding: set by user. + * - decoding: unused *) + mpeg_quant: integer; + + (*** pass1 encoding statistics output buffer. + * - encoding: set by lavc + * - decoding: unused *) + stats_out: pchar; + + (*** pass2 encoding statistics input buffer. + * concatenated stuff from stats_out of pass1 should be placed here + * - encoding: allocated/set/freed by user + * - decoding: unused *) + stats_in: pchar; + + (*** ratecontrol qmin qmax limiting method. + * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax + * - encoding: set by user. + * - decoding: unused *) + rc_qsquish: single; + + rc_qmod_amp: single; + rc_qmod_freq: integer; + + (*** ratecontrol override, see RcOverride. + * - encoding: allocated/set/freed by user. + * - decoding: unused *) + rc_override: PRcOverride; + rc_override_count: integer; + + (*** rate control equation. + * - encoding: set by user + * - decoding: unused *) + rc_eq: pchar; + + (*** maximum bitrate. + * - encoding: set by user. + * - decoding: unused *) + rc_max_rate: integer; + + (*** minimum bitrate. + * - encoding: set by user. + * - decoding: unused *) + rc_min_rate: integer; + + (*** decoder bitstream buffer size. + * - encoding: set by user. + * - decoding: unused *) + rc_buffer_size: integer; + rc_buffer_aggressivity: single; + + (*** qscale factor between p and i frames. + * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset) + * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset) + * - encoding: set by user. + * - decoding: unused *) + i_quant_factor: single; + + (*** qscale offset between p and i frames. + * - encoding: set by user. + * - decoding: unused *) + i_quant_offset: single; + + (*** initial complexity for pass1 ratecontrol. + * - encoding: set by user. + * - decoding: unused *) + rc_initial_cplx: single; + + (*** dct algorithm, see FF_DCT_* below. + * - encoding: set by user + * - decoding: unused *) + dct_algo: integer; + + (*** luminance masking (0-> disabled). + * - encoding: set by user + * - decoding: unused *) + lumi_masking: single; + + (*** temporary complexity masking (0-> disabled). + * - encoding: set by user + * - decoding: unused *) + temporal_cplx_masking: single; + + (*** spatial complexity masking (0-> disabled). + * - encoding: set by user + * - decoding: unused *) + spatial_cplx_masking: single; + + (** * p block masking (0-> disabled). + * - encoding: set by user + * - decoding: unused *) + p_masking: single; + + (*** darkness masking (0-> disabled). + * - encoding: set by user + * - decoding: unused *) + dark_masking: single; + + (* for binary compatibility *) + unused: integer; + + (*** idct algorithm, see FF_IDCT_* below. + * - encoding: set by user + * - decoding: set by user *) + idct_algo: integer; + + (*** slice count. + * - encoding: set by lavc + * - decoding: set by user (or 0) *) + slice_count: integer; + + (*** slice offsets in the frame in bytes. + * - encoding: set/allocated by lavc + * - decoding: set/allocated by user (or NULL) *) + slice_offset: PInteger; + + (*** error concealment flags. + * - encoding: unused + * - decoding: set by user *) + error_concealment: integer; + + (*** dsp_mask could be add used to disable unwanted CPU features + * CPU features (i.e. MMX, SSE. ...) + * + * with FORCE flag you may instead enable given CPU features + * (Dangerous: usable in case of misdetection, improper usage however will + * result into program crash) *) + dsp_mask: cardinal; + + (*** bits per sample/pixel from the demuxer (needed for huffyuv). + * - encoding: set by lavc + * - decoding: set by user *) + bits_per_sample: integer; + + (*** prediction method (needed for huffyuv). + * - encoding: set by user + * - decoding: unused *) + prediction_method: integer; + + (*** sample aspect ratio (0 if unknown). + * numerator and denominator must be relative prime and smaller then 256 for some video standards + * - encoding: set by user. + * - decoding: set by lavc. *) + sample_aspect_ratio: TAVRational; + + (*** the picture in the bitstream. + * - encoding: set by lavc + * - decoding: set by lavc *) + coded_frame: PAVFrame; + + (*** debug. + * - encoding: set by user. + * - decoding: set by user. *) + debug: integer; + + (*** debug. + * - encoding: set by user. + * - decoding: set by user. *) + debug_mv: integer; + + (** error. + * - encoding: set by lavc if flags&CODEC_FLAG_PSNR + * - decoding: unused *) + error: array [0..3] of int64; + + (*** minimum MB quantizer. + * - encoding: unused + * - decoding: unused *) + mb_qmin: integer; + + (*** maximum MB quantizer. + * - encoding: unused + * - decoding: unused *) + mb_qmax: integer; + + (*** motion estimation compare function. + * - encoding: set by user. + * - decoding: unused *) + me_cmp: integer; + + (*** subpixel motion estimation compare function. + * - encoding: set by user. + * - decoding: unused *) + me_sub_cmp: integer; + (*** macroblock compare function (not supported yet). + * - encoding: set by user. + * - decoding: unused *) + mb_cmp: integer; + (*** interlaced dct compare function + * - encoding: set by user. + * - decoding: unused *) + ildct_cmp: integer; + (*** ME diamond size & shape. + * - encoding: set by user. + * - decoding: unused *) + dia_size: integer; + + (*** amount of previous MV predictors (2a+1 x 2a+1 square). + * - encoding: set by user. + * - decoding: unused *) + last_predictor_count: integer; + + (*** pre pass for motion estimation. + * - encoding: set by user. + * - decoding: unused *) + pre_me: integer; + + (*** motion estimation pre pass compare function. + * - encoding: set by user. + * - decoding: unused *) + me_pre_cmp: integer; + + (*** ME pre pass diamond size & shape. + * - encoding: set by user. + * - decoding: unused *) + pre_dia_size: integer; + + (*** subpel ME quality. + * - encoding: set by user. + * - decoding: unused *) + me_subpel_quality: integer; + + (*** callback to negotiate the pixelFormat. + * @param fmt is the list of formats which are supported by the codec, + * its terminated by -1 as 0 is a valid format, the formats are ordered by quality + * the first is allways the native one + * @return the choosen format + * - encoding: unused + * - decoding: set by user, if not set then the native format will always be choosen + *) + get_format: function (s: PAVCodecContext; const fmt: PAVPixelFormat): TAVPixelFormat; cdecl; + + (*** DTG active format information (additionnal aspect ratio + * information only used in DVB MPEG2 transport streams). 0 if + * not set. + * - encoding: unused. + * - decoding: set by decoder *) + dtg_active_format: integer; + + (*** Maximum motion estimation search range in subpel units. + * if 0 then no limit + * - encoding: set by user. + * - decoding: unused. *) + me_range: integer; + + (*** intra quantizer bias. + * - encoding: set by user. + * - decoding: unused *) + intra_quant_bias: integer; + + (*** inter quantizer bias. + * - encoding: set by user. + * - decoding: unused *) + inter_quant_bias: integer; + + (*** color table ID. + * - encoding: unused. + * - decoding: which clrtable should be used for 8bit RGB images + * table have to be stored somewhere FIXME *) + color_table_id: integer; + + (*** internal_buffer count. + * Don't touch, used by lavc default_get_buffer() *) + internal_buffer_count: integer; + + (*** internal_buffers. + * Don't touch, used by lavc default_get_buffer() *) + internal_buffer: pointer; + + (*** global quality for codecs which cannot change it per frame. + * this should be proportional to MPEG1/2/4 qscale. + * - encoding: set by user. + * - decoding: unused *) + global_quality: integer; + + (*** coder type + * - encoding: set by user. + * - decoding: unused *) + coder_type: integer; + + (*** context model + * - encoding: set by user. + * - decoding: unused *) + context_model: integer; + + (*** slice flags + * - encoding: unused + * - decoding: set by user. *) + slice_flags: integer; + + (*** XVideo Motion Acceleration + * - encoding: forbidden + * - decoding: set by decoder *) + xvmc_acceleration: integer; + + (*** macroblock decision mode + * - encoding: set by user. + * - decoding: unused *) + mb_decision: integer; + + (*** custom intra quantization matrix + * - encoding: set by user, can be NULL + * - decoding: set by lavc *) + intra_matrix: Pword; + + (*** custom inter quantization matrix + * - encoding: set by user, can be NULL + * - decoding: set by lavc *) + inter_matrix: Pword; + + (*** fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). + * this is used to workaround some encoder bugs + * - encoding: unused + * - decoding: set by user, will be converted to upper case by lavc during init *) + stream_codec_tag: array [0..3] of char; //cardinal; + + (*** scene change detection threshold. + * 0 is default, larger means fewer detected scene changes + * - encoding: set by user. + * - decoding: unused *) + scenechange_threshold: integer; + + (*** minimum lagrange multipler + * - encoding: set by user. + * - decoding: unused *) + lmin: integer; + + (*** maximum lagrange multipler + * - encoding: set by user. + * - decoding: unused *) + lmax: integer; + + (*** Palette control structure + * - encoding: ??? (no palette-enabled encoder yet) + * - decoding: set by user. *) + palctrl: PAVPaletteControl; + + (*** noise reduction strength + * - encoding: set by user. + * - decoding: unused *) + noise_reduction: integer; + + (*** called at the beginning of a frame to get cr buffer for it. + * buffer type (size, hints) must be the same. lavc won't check it. + * lavc will pass previous buffer in pic, function should return + * same buffer or new buffer with old frame "painted" into it. + * if pic.data[0] == NULL must behave like get_buffer(). + * - encoding: unused + * - decoding: set by lavc, user can override *) + reget_buffer: function (c: PAVCodecContext; pic: PAVFrame): integer; cdecl; + + (*** number of bits which should be loaded into the rc buffer before decoding starts + * - encoding: set by user. + * - decoding: unused *) + rc_initial_buffer_occupancy: integer; + inter_threshold: integer; + + (*** CODEC_FLAG2_*. + * - encoding: set by user. + * - decoding: set by user. *) + flags2: integer; + + (*** simulates errors in the bitstream to test error concealment. + * - encoding: set by user. + * - decoding: unused. *) + error_rate: integer; + + (*** MP3 antialias algorithm, see FF_AA_* below. + * - encoding: unused + * - decoding: set by user *) + antialias_algo: integer; + + (*** Quantizer noise shaping. + * - encoding: set by user + * - decoding: unused *) + quantizer_noise_shaping: integer; + + (*** Thread count. + * is used to decide how many independant tasks should be passed to execute() + * - encoding: set by user + * - decoding: set by user *) + thread_count: integer; + + (*** the codec may call this to execute several independant things. it will return only after + * finishing all tasks, the user may replace this with some multithreaded implementation, the + * default implementation will execute the parts serially + * @param count the number of things to execute + * - encoding: set by lavc, user can override + * - decoding: set by lavc, user can override *) + execute: function (c: PAVCodecContext; func: pointer; arg: PPointer; ret: PInteger; count: integer): integer; cdecl; + + (*** Thread opaque. + * can be used by execute() to store some per AVCodecContext stuff. + * - encoding: set by execute() + * - decoding: set by execute() *) + thread_opaque: pointer; + + (*** Motion estimation threshold. under which no motion estimation is + * performed, but instead the user specified motion vectors are used + * - encoding: set by user + * - decoding: unused *) + me_threshold: integer; + + (*** Macroblock threshold. under which the user specified macroblock types will be used + * - encoding: set by user + * - decoding: unused *) + mb_threshold: integer; + + (*** precision of the intra dc coefficient - 8. + * - encoding: set by user + * - decoding: unused *) + intra_dc_precision: integer; + + (*** noise vs. sse weight for the nsse comparsion function. + * - encoding: set by user + * - decoding: unused *) + nsse_weight: integer; + + (*** number of macroblock rows at the top which are skipped. + * - encoding: unused + * - decoding: set by user *) + skip_top: integer; + + (*** number of macroblock rows at the bottom which are skipped. + * - encoding: unused + * - decoding: set by user *) + skip_bottom: integer; + + (*** profile + * - encoding: set by user + * - decoding: set by lavc *) + profile: integer; + + (*** level + * - encoding: set by user + * - decoding: set by lavc *) + level: integer; + + (*** low resolution decoding. 1-> 1/2 size, 2->1/4 size + * - encoding: unused + * - decoding: set by user *) + lowres: integer; + + (*** bitsream width / height. may be different from width/height if lowres + * or other things are used + * - encoding: unused + * - decoding: set by user before init if known, codec should override / dynamically change if needed *) + coded_width, coded_height: integer; + + (*** frame skip threshold + * - encoding: set by user + * - decoding: unused *) + frame_skip_threshold: integer; + + (*** frame skip factor + * - encoding: set by user + * - decoding: unused *) + frame_skip_factor: integer; + + (*** frame skip exponent + * - encoding: set by user + * - decoding: unused *) + frame_skip_exp: integer; + + (*** frame skip comparission function + * - encoding: set by user. + * - decoding: unused *) + frame_skip_cmp: integer; + + (*** border processing masking. raises the quantizer for mbs on the borders + * of the picture. + * - encoding: set by user + * - decoding: unused *) + border_masking: single; + + (*** minimum MB lagrange multipler. + * - encoding: set by user. + * - decoding: unused *) + mb_lmin: integer; + + (*** maximum MB lagrange multipler. + * - encoding: set by user. + * - decoding: unused *) + mb_lmax: integer; + + (*** + * - encoding: set by user. + * - decoding: unused *) + me_penalty_compensation: integer; + + (*** + * - encoding: unused + * - decoding: set by user. *) + skip_loop_filter: TAVDiscard; + + (** * + * - encoding: unused + * - decoding: set by user. *) + skip_idct: TAVDiscard; + + (** * + * - encoding: unused + * - decoding: set by user. *) + skip_frame: TAVDiscard; + + (** * + * - encoding: set by user. + * - decoding: unused *) + bidir_refine: integer; + + (** * + * - encoding: set by user. + * - decoding: unused *) + brd_scale: integer; + + (** + * constant rate factor - quality-based VBR - values ~correspond to qps + * - encoding: set by user. + * - decoding: unused *) + crf: integer; + + (** + * constant quantization parameter rate control method + * - encoding: set by user. + * - decoding: unused *) + cqp: integer; + + (** + * minimum gop size + * - encoding: set by user. + * - decoding: unused *) + keyint_min: integer; + + (** + * number of reference frames + * - encoding: set by user. + * - decoding: unused *) + refs: integer; + + (** + * chroma qp offset from luma + * - encoding: set by user. + * - decoding: unused *) + chromaoffset: integer; + + (** + * influences how often b-frames are used + * - encoding: set by user. + * - decoding: unused *) + bframebias: integer; + + (** + * trellis RD quantization + * - encoding: set by user. + * - decoding: unused *) + trellis: integer; + + (** + * reduce fluctuations in qp (before curve compression) + * - encoding: set by user. + * - decoding: unused *) + complexityblur: single; + + (** + * in-loop deblocking filter alphac0 parameter + * alpha is in the range -6...6 + * - encoding: set by user. + * - decoding: unused *) + deblockalpha: integer; + + (** + * in-loop deblocking filter beta parameter + * beta is in the range -6...6 + * - encoding: set by user. + * - decoding: unused *) + deblockbeta: integer; + + (** + * macroblock subpartition sizes to consider - p8x8, p4x4, b8x8, i8x8, i4x4 + * - encoding: set by user. + * - decoding: unused *) + partitions: integer; + + (** + * direct mv prediction mode - 0 (none), 1 (spatial), 2 (temporal) + * - encoding: set by user. + * - decoding: unused *) + directpred: integer; + + (** + * audio cutoff bandwidth (0 means "automatic") . Currently used only by FAAC + * - encoding: set by user. + * - decoding: unused *) + cutoff: integer; + + (** + * multiplied by qscale for each frame and added to scene_change_score + * - encoding: set by user. + * - decoding: unused *) + scenechange_factor: integer; + + (** * + * note: value depends upon the compare functin used for fullpel ME + * - encoding: set by user. + * - decoding: unused *) + mv0_threshold: integer; + + (** + * adjusts sensitivity of b_frame_strategy 1 + * - encoding: set by user. + * - decoding: unused *) + b_sensitivity: integer; + + (** + * - encoding: set by user. + * - decoding: unused *) + compression_level: integer; + + (** + * sets whether to use LPC mode - used by FLAC encoder + * - encoding: set by user. + * - decoding: unused. *) + use_lpc: integer; + + (** + * LPC coefficient precision - used by FLAC encoder + * - encoding: set by user. + * - decoding: unused. *) + lpc_coeff_precision: integer; + + (** + * - encoding: set by user. + * - decoding: unused. *) + min_prediction_order: integer; + + (** + * - encoding: set by user. + * - decoding: unused. *) + max_prediction_order: integer; + + (** + * search method for selecting prediction order + * - encoding: set by user. + * - decoding: unused. *) + prediction_order_method: integer; + + (** + * - encoding: set by user. + * - decoding: unused. *) + min_partition_order: integer; + + (** + * - encoding: set by user. + * - decoding: unused. *) + max_partition_order: integer; + end; + +(** + * AVCodec. + *) + TAVCodec = record + name: pchar; + _type: TCodecType; + id: TCodecID; + priv_data_size: integer; + init: function (avctx: pAVCodecContext): integer; cdecl; + encode: function (avctx: PAVCodecContext; buf: pchar; buf_size: integer; data: pointer): integer; cdecl; + close: function (avctx: PAVCodecContext): integer; cdecl; + decode: function (avctx: PAVCodecContext; outdata: pointer; outdata_size: PInteger; + buf: pchar; buf_size: integer): integer; cdecl; + capabilities: integer; +// todo: check this -> +// void *dummy; // FIXME remove next time we break binary compatibility + next: PAVCodec; + flush: procedure (avctx: PAVCodecContext); cdecl; + supported_framerates: PAVRational; ///array of supported framerates, or NULL if any, array is terminated by {0,0} + pix_fmts: PAVPixelFormat; ///array of supported pixel formats, or NULL if unknown, array is terminanted by -1 + end; + +(** + * four components are given, that's all. + * the last component is alpha + *) + PAVPicture = ^TAVPicture; + TAVPicture = record + data: array [0..3] of pchar; + linesize: array [0..3] of integer; ///< number of bytes per line + end; + +(** + * AVPaletteControl + * This structure defines a method for communicating palette changes + * between and demuxer and a decoder. + * this is totally broken, palette changes should be sent as AVPackets + *) + TAVPaletteControl = record + (* demuxer sets this to 1 to indicate the palette has changed; + * decoder resets to 0 *) + palette_changed: integer; + + (* 4-byte ARGB palette entries, stored in native byte order; note that + * the individual palette components should be on a 8-bit scale; if + * the palette data comes from a IBM VGA native format, the component + * data is probably 6 bits in size and needs to be scaled *) + palette: array [0..AVPALETTE_COUNT - 1] of cardinal; + end; + + PAVSubtitleRect = ^TAVSubtitleRect; + TAVSubtitleRect = record + x: word; + y: word; + w: word; + h: word; + nb_colors: word; + linesize: integer; + rgba_palette: PCardinal; + bitmap: pchar; + end; + + PAVSubtitle = ^TAVSubtitle; + TAVSubtitle = record {20} + format: word; (* 0 = graphics *) + start_display_time: cardinal; (* relative to packet pts, in ms *) + end_display_time: cardinal; (* relative to packet pts, in ms *) + num_rects: cardinal; + rects: PAVSubtitleRect; + end; + + +(* resample.c *) + + PReSampleContext = pointer; + PAVResampleContext = pointer; + PImgReSampleContext = pointer; + +function audio_resample_init (output_channels: integer; input_channels: integer; + output_rate: integer; input_rate: integer): PReSampleContext; + cdecl; external av__codec; + +function audio_resample (s: PReSampleContext; output: PWord; input: PWord; nb_samples: integer): integer; + cdecl; external av__codec; + +procedure audio_resample_close (s: PReSampleContext); + cdecl; external av__codec; + + +function av_resample_init (out_rate: integer; in_rate: integer; filter_length: integer; + log2_phase_count: integer; linear: integer; cutoff: double): PAVResampleContext; + cdecl; external av__codec; + +function av_resample (c: PAVResampleContext; dst: PWord; src: PWord; consumed: PInteger; + src_size: integer; dst_size: integer; update_ctx: integer): integer; + cdecl; external av__codec; + +procedure av_resample_compensate (c: PAVResampleContext; sample_delta: integer; + compensation_distance: integer); + cdecl; external av__codec; + +procedure av_resample_close (c: PAVResampleContext); + cdecl; external av__codec; + + +(* YUV420 format is assumed ! *) + + function img_resample_init (output_width: integer; output_height: integer; + input_width: integer; input_height: integer): PImgReSampleContext; + cdecl; external av__codec; + + function img_resample_full_init (owidth: integer; oheight: integer; + iwidth: integer; iheight: integer; + topBand: integer; bottomBand: integer; + leftBand: integer; rightBand: integer; + padtop: integer; padbottom: integer; + padleft: integer; padright: integer): PImgReSampleContext; + cdecl; external av__codec; + + procedure img_resample (s: PImgReSampleContext; output: PAVPicture; const input: PAVPicture); + cdecl; external av__codec; + + procedure img_resample_close (s: PImgReSampleContext); + cdecl; external av__codec; + +(** + * Allocate memory for a picture. Call avpicture_free to free it. + * + * @param picture the picture to be filled in. + * @param pix_fmt the format of the picture. + * @param width the width of the picture. + * @param height the height of the picture. + * @return 0 if successful, -1 if not. + *) + function avpicture_alloc (picture: PAVPicture; pix_fmt: TAVPixelFormat; + width: integer; height: integer): integer; + cdecl; external av__codec; + + +(* Free a picture previously allocated by avpicture_alloc. *) + procedure avpicture_free (picture: PAVPicture); + cdecl; external av__codec; + + function avpicture_fill (picture: PAVPicture; ptr: pointer; + pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; + cdecl; external av__codec; + + function avpicture_layout (const src: PAVPicture; pix_fmt: TAVPixelFormat; + width: integer; height: integer; + dest: pchar; dest_size: integer): integer; + cdecl; external av__codec; + + function avpicture_get_size (pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; + cdecl; external av__codec; + + procedure avcodec_get_chroma_sub_sample (pix_fmt: TAVPixelFormat; h_shift: Pinteger; v_shift: pinteger); + cdecl; external av__codec; + + function avcodec_get_pix_fmt_name(pix_fmt: TAVPixelFormat): pchar; + cdecl; external av__codec; + + procedure avcodec_set_dimensions(s: PAVCodecContext; width: integer; height: integer); + cdecl; external av__codec; + + function avcodec_get_pix_fmt(const name: pchar): TAVPixelFormat; + cdecl; external av__codec; + + function avcodec_pix_fmt_to_codec_tag(p: TAVPixelFormat): cardinal; + cdecl; external av__codec; + + function avcodec_get_pix_fmt_loss (dst_pix_fmt: TAVPixelFormat; src_pix_fmt: TAVPixelFormat; + has_alpha: integer): integer; + cdecl; external av__codec; + + function avcodec_find_best_pix_fmt (pix_fmt_mask: integer; src_pix_fmt: TAVPixelFormat; + has_alpha: integer; loss_ptr: pinteger): integer; + cdecl; external av__codec; + + function img_get_alpha_info (const src: PAVPicture; + pix_fmt: TAVPixelFormat; + width: integer; height: integer): integer; + cdecl; external av__codec; + + +(* convert among pixel formats *) + function img_convert (dst: PAVPicture; dst_pix_fmt: TAVPixelFormat; + const src: PAVPicture; pix_fmt: TAVPixelFormat; + width: integer; height: integer): integer; + cdecl; external av__codec; + +(* deinterlace a picture *) + function avpicture_deinterlace (dst: PAVPicture; const src: PAVPicture; + pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; + cdecl; external av__codec; + +(* returns LIBAVCODEC_VERSION_INT constant *) + function avcodec_version (): cardinal; + cdecl; external av__codec; + +(* returns LIBAVCODEC_BUILD constant *) + function avcodec_build (): cardinal; + cdecl; external av__codec; + + procedure avcodec_init (); + cdecl; external av__codec; + + procedure register_avcodec (format: PAVCodec); + cdecl; external av__codec; + + function avcodec_find_encoder (id: TCodecID): PAVCodec; + cdecl; external av__codec; + function avcodec_find_encoder_by_name (name: pchar): PAVCodec; + cdecl; external av__codec; + function avcodec_find_decoder(id: TCodecID): PAVCodec; + cdecl; external av__codec; + function avcodec_find_decoder_by_name (name: pchar): PAVCodec; + cdecl; external av__codec; + procedure avcodec_string(buf: pchar; buf_size: integer; enc: PAVCodecContext; encode: integer); + cdecl; external av__codec; + + procedure avcodec_get_context_defaults (s: PAVCodecContext); + cdecl; external av__codec; + function avcodec_alloc_context (): PAVCodecContext; + cdecl; external av__codec; + procedure avcodec_get_frame_defaults (pic: PAVFrame); + cdecl; external av__codec; + function avcodec_alloc_frame (): PAVFrame; + cdecl; external av__codec; + + function avcodec_default_get_buffer (s: PAVCodecContext; pic: PAVFrame): integer; + cdecl; external av__codec; + procedure avcodec_default_release_buffer (s: PAVCodecContext; pic: PAVFrame); + cdecl; external av__codec; + function avcodec_default_reget_buffer (s: PAVCodecContext; pic: PAVFrame): integer; + cdecl; external av__codec; + procedure avcodec_align_dimensions(s: PAVCodecContext; width: Pinteger; height: PInteger); + cdecl; external av__codec; + function avcodec_check_dimensions (av_log_ctx: pointer; w: cardinal; h: cardinal): integer; + cdecl; external av__codec; + function avcodec_default_get_format(s: PAVCodecContext; const fmt: PAVPixelFormat): TAVPixelFormat; + cdecl; external av__codec; + + function avcodec_thread_init (s: PAVCodecContext; thread_count: integer): integer; + cdecl; external av__codec; + procedure avcodec_thread_free (s: PAVCodecContext); + cdecl; external av__codec; + function avcodec_thread_execute (s: PAVCodecContext; func: pointer; arg: PPointer; ret: Pinteger; count: integer): integer; + cdecl; external av__codec; + function avcodec_default_execute (s: PAVCodecContext; func: pointer; arg: PPointer; ret: Pinteger; count: integer): integer; + cdecl; external av__codec; + + +//FIXME func typedef + +(** + * opens / inits the AVCodecContext. + * not thread save! + *) + function avcodec_open (avctx: PAVCodecContext; codec: PAVCodec): integer; + cdecl; external av__codec; + + +(** + * Decode an audio frame. + * + * @param avctx the codec context. + * @param samples output buffer, 16 byte aligned + * @param frame_size_ptr the output buffer size in bytes, zero if no frame could be compressed + * @param buf input buffer, 16 byte aligned + * @param buf_size the input buffer size + * @return 0 if successful, -1 if not. + *) + + function avcodec_decode_audio (avctx: PAVCodecContext; samples: Pword; + frame_size_ptr: pinteger; + buf: pchar; buf_size: integer): integer; + cdecl; external av__codec; +(* decode a frame. + * @param buf bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE larger then the actual read bytes + * because some optimized bitstream readers read 32 or 64 bit at once and could read over the end + * @param buf_size the size of the buffer in bytes + * @param got_picture_ptr zero if no frame could be decompressed, Otherwise, it is non zero + * @return -1 if error, otherwise return the number of + * bytes used. *) + function avcodec_decode_video (avctx: PAVCodecContext; picture: PAVFrame; + got_picture_ptr: pinteger; + buf: PByte; buf_size: integer): integer; + cdecl; external av__codec; + + function avcodec_decode_subtitle (avctx: PAVCodecContext; sub: PAVSubtitle; + got_sub_ptr: pinteger; + const buf: pchar; buf_size: integer): integer; + cdecl; external av__codec; + + {$IFNDEF FPC} + function avcodec_parse_frame (avctx: PAVCodecContext; pdata: PPointer; + data_size_ptr: pinteger; + buf: pchar; buf_size: integer): integer; + cdecl; external av__codec; + {$ENDIF} + function avcodec_encode_audio (avctx: PAVCodecContext; buf: PByte; + buf_size: integer; const samples: Pword): integer; + cdecl; external av__codec; + + (* avcodec_encode_video: -1 if error *) + function avcodec_encode_video (avctx: PAVCodecContext; buf: pointer; + buf_size: integer; pict: PAVFrame): integer; + cdecl; external av__codec; + function avcodec_encode_subtitle (avctx: PAVCodecContext; buf: pchar; + buf_size: integer; const sub: PAVSubtitle): integer; + cdecl; external av__codec; + function avcodec_close (avctx: PAVCodecContext): integer; + cdecl; external av__codec; + + procedure avcodec_register_all (); + cdecl; external av__codec; + + procedure avcodec_flush_buffers (avctx: PAVCodecContext); + cdecl; external av__codec; + procedure avcodec_default_free_buffers (s: PAVCodecContext); + cdecl; external av__codec; + +(* misc usefull functions *) + +(** + * returns a single letter to describe the picture type + *) + function av_get_pict_type_char (pict_type: integer): char; + cdecl; external av__codec; + + +(** + * returns codec bits per sample + *) +function av_get_bits_per_sample (codec_id: TCodecID): integer; + cdecl; external av__codec; + +const + AV_PARSER_PTS_NB = 4; + PARSER_FLAG_COMPLETE_FRAMES = $0001; + +type + PAVCodecParserContext = ^TAVCodecParserContext; + PAVCodecParser = ^TAVCodecParser; + + TAVCodecParserContext = record + priv_data: pointer; + parser: PAVCodecParser; + frame_offset: int64; (* offset of the current frame *) + cur_offset: int64; (* current offset (incremented by each av_parser_parse()) *) + last_frame_offset: int64; (* offset of the last frame *) + (* video info *) + pict_type: integer; (* XXX: put it back in AVCodecContext *) + repeat_pict: integer; (* XXX: put it back in AVCodecContext *) + pts: int64; (* pts of the current frame *) + dts: int64; (* dts of the current frame *) + + (* private data *) + last_pts: int64; + last_dts: int64; + fetch_timestamp: integer; + + cur_frame_start_index: integer; + cur_frame_offset: array [0..AV_PARSER_PTS_NB - 1] of int64; + cur_frame_pts: array [0..AV_PARSER_PTS_NB - 1] of int64; + cur_frame_dts: array [0..AV_PARSER_PTS_NB - 1] of int64; + + flags: integer; + end; + + TAVCodecParser = record + codec_ids: array [0..4] of integer; (* several codec IDs are permitted *) + priv_data_size: integer; + parser_init: function (s: PAVCodecParserContext): integer; cdecl; + parser_parse: function (s: PAVCodecParserContext; avctx: PAVCodecContext; + poutbuf: PPointer; poutbuf_size: PInteger; + const buf: pchar; buf_size: integer): integer; cdecl; + parser_close: procedure (s: PAVCodecParserContext); cdecl; + split: function (avctx: PAVCodecContext; const buf: pchar; + buf_size: integer): integer; cdecl; + next: PAVCodecParser; + end; + + procedure av_register_codec_parser (parser: PAVCodecParser); cdecl; + cdecl; external av__codec; + + function av_parser_init (codec_id: integer): PAVCodecParserContext; + cdecl; external av__codec; + + function av_parser_parse (s: PAVCodecParserContext; + avctx: PAVCodecContext; + poutbuf: PPointer; poutbuf_size: pinteger; + const buf: pchar; buf_size: integer; + pts: int64; dts: int64): integer; + cdecl; external av__codec; + function av_parser_change (s: PAVCodecParserContext; + avctx: PAVCodecContext; + poutbuf: PPointer; poutbuf_size: PInteger; + const buf: pchar; buf_size: integer; keyframe: integer): integer; + cdecl; external av__codec; + procedure av_parser_close (s: PAVCodecParserContext); + cdecl; external av__codec; + +type + PAVBitStreamFilterContext = ^TAVBitStreamFilterContext; + PAVBitStreamFilter = ^TAVBitStreamFilter; + + TAVBitStreamFilterContext = record + priv_data: pointer; + filter: PAVBitStreamFilter; + parser: PAVCodecParserContext; + next: PAVBitStreamFilterContext; + end; + + TAVBitStreamFilter = record + name: pchar; + priv_data_size: integer; + filter: function (bsfc: PAVBitStreamFilterContext; + avctx: PAVCodecContext; args: pchar; + poutbuf: PPointer; poutbuf_size: PInteger; + buf: PByte; buf_size: integer; keyframe: integer): integer; cdecl; + next: PAVBitStreamFilter; + end; + +procedure av_register_bitstream_filter (bsf: PAVBitStreamFilter); + cdecl; external av__codec; + +function av_bitstream_filter_init (name: pchar): PAVBitStreamFilterContext; + cdecl; external av__codec; + +function av_bitstream_filter_filter (bsfc: PAVBitStreamFilterContext; + avctx: PAVCodecContext; args: pchar; + poutbuf: PPointer; poutbuf_size: PInteger; + buf: PByte; buf_size: integer; keyframe: integer): integer; + cdecl; external av__codec; +procedure av_bitstream_filter_close (bsf: PAVBitStreamFilterContext); + cdecl; external av__codec; + + +(* memory *) + procedure av_fast_realloc (ptr: pointer; size: PCardinal; min_size: Cardinal); + cdecl; external av__codec; +(* for static data only *) +(* call av_free_static to release all staticaly allocated tables *) + procedure av_free_static (); + cdecl; external av__codec; + + procedure av_mallocz_static(size: cardinal); + cdecl; external av__codec; + + procedure av_realloc_static(ptr: pointer; size: Cardinal); + cdecl; external av__codec; + + procedure img_copy (dst: PAVPicture; const src: PAVPicture; + pix_fmt: TAVPixelFormat; width: integer; height: integer); + cdecl; external av__codec; + + function img_crop (dst: PAVPicture; const src: PAVPicture; + pix_fmt: TAVPixelFormat; top_band, left_band: integer): integer; + cdecl; external av__codec; + + function img_pad (dst: PAVPicture; const src: PAVPicture; height, width: integer; + pix_fmt: TAVPixelFormat; padtop, padbottom, padleft, padright: integer; + color: PInteger): integer; + cdecl; external av__codec; + +implementation + +end. diff --git a/Game/Code/lib/ffmpeg/avformat.pas b/Game/Code/lib/ffmpeg/avformat.pas index 6d13bcdf..6e9c5934 100644 --- a/Game/Code/lib/ffmpeg/avformat.pas +++ b/Game/Code/lib/ffmpeg/avformat.pas @@ -1,629 +1,630 @@ - (* - * copyright (c) 2001 Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) -unit avformat; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -uses - windows, avcodec, avio, rational, avutil; - -const - av__format = 'avformat-50.dll'; - - LIBAVUTIL_VERSION_INT = ((49 shl 16) + (0 shl 8) + 1); - LIBAVUTIL_VERSION = '49.0.1'; - LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; - - MAXINT64 = $7fffffffffffffff; - MININT64 = $8000000000000000; - - PKT_FLAG_KEY = $0001; - - (* AVImageFormat.flags field constants *) - AVIMAGE_INTERLEAVED = $0001; (* image format support interleaved output *) - MAX_STREAMS = 20; -type - int = integer; - - PAVPacket = ^TAVPacket; - PAVImageFormat = ^TAVImageFormat; - PAVFormatContext = ^TAVFormatContext; - PAVFormatParameters = ^TAVFormatParameters; - PAVOutputFormat = ^TAVOutputFormat; - PAVProbeData = ^TAVProbeData; - PAVInputFormat = ^TAVInputFormat; - PAVIndexEntry = ^TAVIndexEntry; - PAVStream = ^TAVStream; - PAVPacketList = ^TAVPacketList; - PAVImageInfo = ^TAVImageInfo; - - TAVPacket = record {56} - pts: int64; ///< presentation time stamp in time_base units - dts: int64; ///< decompression time stamp in time_base units - data: PByte; - size: integer; - stream_index: integer; - flags: integer; - duration: integer; ///< presentation duration in time_base units (0 if not available) - destruct: procedure (p: PAVPacket); - priv: pointer; - pos: int64; ///< byte position in stream, -1 if unknown - end; - -(*************************************************) -(* fractional numbers for exact pts handling *) - -(* the exact value of the fractional number is: 'val + num / den'. num - is assumed to be such as 0 <= num < den *) - PAVFrac = ^TAVFrac; - TAVFrac = record - val, num, den: int64; - end; - -(*************************************************) -(* input/output formats *) - -(* this structure contains the data a format has to probe a file *) - TAVProbeData = record {12} - filename: pchar; - buf: pchar; - buf_size: integer; - end; - - TAVFormatParameters = record {56} - time_base: TAVRational; (* 8 bytes *) - sample_rate: integer; - channels: integer; - width: integer; - height: integer; - pix_fmt: TAVPixelFormat; - image_format: PAVImageFormat; (* 4 bytes *) - channel: integer; (* used to select dv channel *) - device: pchar; (* video, audio or DV device *) - standard: pchar; (* tv standard, NTSC, PAL, SECAM *) -// int mpeg2ts_raw:1; (* force raw MPEG2 transport stream output, if possible *) -// int mpeg2ts_compute_pcr:1; (* compute exact PCR for each transport -// stream packet (only meaningful if -// mpeg2ts_raw is TRUE *) -// int initial_pause:1; (* do not begin to play the stream -// immediately (RTSP only) *) - dummy: byte; - video_codec_id: TCodecID; - audio_codec_id: TCodecID; - end; - - TAVOutputFormat = record {56} - name: pchar; - long_name: pchar; - mime_type: pchar; - extensions: pchar; (* comma separated extensions *) - (* size of private data so that it can be allocated in the wrapper *) - priv_data_size: integer; - (* output support *) - audio_codec: TCodecID; (* default audio codec *) - video_codec: TCodecID; (* default video codec *) - write_header: function (c: PAVFormatContext): integer; cdecl; - write_packet: function (c: PAVFormatContext; pkt: PAVPacket): integer; cdecl; - write_trailer: function (c: PAVFormatContext): integer; cdecl; - (* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER *) - flags: integer; - (* currently only used to set pixel format if not YUV420P *) - set_parameters: function (c: PAVFormatContext; f: PAVFormatParameters): integer; cdecl; - interleave_packet: function (s: PAVFormatContext; _out: PAVPacket; _in: PAVPacket; flush: integer): integer; cdecl; - (* private fields *) - next: PAVOutputFormat; - end; - - TAVInputFormat = record {60} - name: pchar; - long_name: pchar; - (* size of private data so that it can be allocated in the wrapper *) - priv_data_size: integer; - (* tell if a given file has a chance of being parsing by this format *) - read_probe: function (p: PAVProbeData): integer; cdecl; - (* read the format header and initialize the AVFormatContext - structure. Return 0 if OK. 'ap' if non NULL contains - additionnal paramters. Only used in raw format right - now. 'av_new_stream' should be called to create new streams. *) - read_header: function (c: PAVFormatContext; ap: PAVFormatParameters): integer; cdecl; - (* read one packet and put it in 'pkt'. pts and flags are also - set. 'av_new_stream' can be called only if the flag - AVFMTCTX_NOHEADER is used. *) - read_packet: function (c: PAVFormatContext; pkt: PAVPacket): integer; cdecl; - (* close the stream. The AVFormatContext and AVStreams are not - freed by this function *) - read_close: function (c: PAVFormatContext): integer; cdecl; - (*** seek to a given timestamp relative to the frames in - * stream component stream_index - * @param stream_index must not be -1 - * @param flags selects which direction should be preferred if no exact - * match is available *) - read_seek: function (c: PAVFormatContext; stream_index: integer; - timestamp: int64; flags: integer): integer; cdecl; - (*** gets the next timestamp in AV_TIME_BASE units. *) - read_timestamp: function (s: PAVFormatContext; stream_index: integer; - pos: pint64; pos_limit: int64): integer; cdecl; - (* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER *) - flags: integer; - (* if extensions are defined, then no probe is done. You should - usually not use extension format guessing because it is not - reliable enough *) - extensions: pchar; - (* general purpose read only value that the format can use *) - value: integer; - - (* start/resume playing - only meaningful if using a network based format (RTSP) *) - read_play: function (c: PAVFormatContext): integer; cdecl; - - (* pause playing - only meaningful if using a network based format (RTSP) *) - read_pause: function (c: PAVFormatContext): integer; cdecl; - - (* private fields *) - next: PAVInputFormat; - end; - - TAVIndexEntry = record {24} - pos: int64; - timestamp: int64; -(* the following 2 flags indicate that the next/prev keyframe is known, and scaning for it isnt needed *) - flags: integer; - min_distance: integer; (* min distance between this and the previous keyframe, used to avoid unneeded searching *) - end; - - TAVStream = record {168} - index: integer; (* stream index in AVFormatContext *) - id: integer; (* format specific stream id *) - codec: PAVCodecContext; (* codec context *) - (*** real base frame rate of the stream. - * for example if the timebase is 1/90000 and all frames have either - * approximately 3600 or 1800 timer ticks then r_frame_rate will be 50/1 *) - r_frame_rate: TAVRational; - priv_data: pointer; - (* internal data used in av_find_stream_info() *) - codec_info_duration: int64; - codec_info_nb_frames: integer; - (* encoding: PTS generation when outputing stream *) - pts: TAVFrac; - - (*** this is the fundamental unit of time (in seconds) in terms - * of which frame timestamps are represented. for fixed-fps content, - * timebase should be 1/framerate and timestamp increments should be - * identically 1. *) - time_base: TAVRational; - pts_wrap_bits: integer; (* number of bits in pts (used for wrapping control) *) - (* ffmpeg.c private use *) - stream_copy: integer; (* if TRUE, just copy stream *) - discard: TAVDiscard; ///< selects which packets can be discarded at will and dont need to be demuxed - //FIXME move stuff to a flags field? - (* quality, as it has been removed from AVCodecContext and put in AVVideoFrame - * MN:dunno if thats the right place, for it *) - quality: single; - (* decoding: position of the first frame of the component, in AV_TIME_BASE fractional seconds. *) - start_time: int64; - (* decoding: duration of the stream, in AV_TIME_BASE fractional seconds. *) - duration: int64; - - language: array [0..3] of char; (* ISO 639 3-letter language code (empty string if undefined) *) - - (* av_read_frame() support *) - need_parsing: integer; ///< 1->full parsing needed, 2->only parse headers dont repack - parser: PAVCodecParserContext; - - cur_dts: int64; - last_IP_duration: integer; - last_IP_pts: int64; - (* av_seek_frame() support *) - index_entries: PAVIndexEntry; (* only used if the format does not support seeking natively *) - nb_index_entries: integer; - index_entries_allocated_size: integer; - - nb_frames: int64; ///< number of frames in this stream if known or 0 - pts_buffer: array [0..4] of int64; - end; - -(* format I/O context *) - TAVFormatContext = record {3960} - av_class: PAVClass; (* set by av_alloc_format_context *) - (* can only be iformat or oformat, not both at the same time *) - iformat: PAVInputFormat; - oformat: PAVOutputFormat; - priv_data: pointer; - pb: TByteIOContext; - nb_streams: integer; - streams: array [0..MAX_STREAMS - 1] of PAVStream; - filename: array [0..1023] of char; (* input or output filename *) - (* stream info *) - timestamp: int64; - title: array [0..511] of char; - author: array [0..511] of char; - copyright: array [0..511] of char; - comment: array [0..511] of char; - album: array [0..511] of char; - year: integer; (* ID3 year, 0 if none *) - track: integer; (* track number, 0 if none *) - genre: array [0..31] of char; (* ID3 genre *) - - ctx_flags: integer; (* format specific flags, see AVFMTCTX_xx *) - (* private data for pts handling (do not modify directly) *) - (* This buffer is only needed when packets were already buffered but - not decoded, for example to get the codec parameters in mpeg - streams *) - packet_buffer: PAVPacketList; - - (* decoding: position of the first frame of the component, in - AV_TIME_BASE fractional seconds. NEVER set this value directly: - it is deduced from the AVStream values. *) - start_time: int64; - (* decoding: duration of the stream, in AV_TIME_BASE fractional - seconds. NEVER set this value directly: it is deduced from the - AVStream values. *) - duration: int64; - (* decoding: total file size. 0 if unknown *) - file_size: int64; - (* decoding: total stream bitrate in bit/s, 0 if not - available. Never set it directly if the file_size and the - duration are known as ffmpeg can compute it automatically. *) - bit_rate: integer; - - (* av_read_frame() support *) - cur_st: PAVStream; - cur_ptr: pchar; - cur_len: integer; - cur_pkt: TAVPacket; - - (* av_seek_frame() support *) - data_offset: int64; (* offset of the first packet *) - index_built: integer; - - mux_rate: integer; - packet_size: integer; - preload: integer; - max_delay: integer; - - (* number of times to loop output in formats that support it *) - loop_output: integer; - - flags: integer; - loop_input: integer; - (* decoding: size of data to probe; encoding unused *) - probesize: cardinal; - end; - - TAVPacketList = record {64} - pkt: TAVPacket; - next: PAVPacketList; - end; - -(* still image support *) - PAVInputImageContext = pointer; // attribute_deprecated; -// PAVInputImageContext = pointer; //AVInputImageContext attribute_deprecated; - -(* still image support *) - TAVImageInfo = record {48} - pix_fmt: TAVPixelFormat; (* requested pixel format *) - width: integer; (* requested width *) - height: integer; (* requested height *) - interleaved: integer; (* image is interleaved (e.g. interleaved GIF) *) - pict: TAVPicture; (* returned allocated image *) - end; - - TAVImageFormat = record {32} - name: pchar; - extensions: pchar; - (* tell if a given file has a chance of being parsing by this format *) - img_probe: function (d: PAVProbeData): integer; cdecl; - (* read a whole image. 'alloc_cb' is called when the image size is - known so that the caller can allocate the image. If 'allo_cb' - returns non zero, then the parsing is aborted. Return '0' if - OK. *) - img_read: function (b: PByteIOContext; alloc_cb: pointer; ptr: pointer): integer; cdecl; - (* write the image *) - supported_pixel_formats: integer; (* mask of supported formats for output *) - img_write: function (b: PByteIOContext; i: PAVImageInfo): integer; cdecl; - flags: integer; - next: PAVImageFormat; - end; - -procedure av_destruct_packet_nofree (pkt: PAVPacket); - cdecl; external av__format; -procedure av_destruct_packet (pkt: PAVPacket); - cdecl; external av__format; - -(* initialize optional fields of a packet *) -procedure av_init_packet (pkt: PAVPacket); - -function av_new_packet(pkt: PAVPacket; size: integer): integer; - cdecl; external av__format; - -function av_get_packet (s: PByteIOContext; pkt: PAVPacket; size: integer): integer; - cdecl; external av__format; - -function av_dup_packet (pkt: PAVPacket): integer; - cdecl; external av__format; - -(** * Free a packet - * - * @param pkt packet to free *) -procedure av_free_packet (pkt: PAVPacket); - -procedure av_register_image_format (img_fmt: PAVImageFormat); - cdecl; external av__format; - -function av_probe_image_format (pd: PAVProbeData): PAVImageFormat; - cdecl; external av__format; - -function guess_image_format (filename: pchar): PAVImageFormat; - cdecl; external av__format; - -function av_guess_image2_codec(filename: pchar): TCodecID; - cdecl; external av__format; - -function av_read_image (pb: PByteIOContext; filename: pchar; - fmt: PAVImageFormat; - alloc_cb: pointer; opaque: pointer): integer; - cdecl; external av__format; - -function av_write_image(pb: PByteIOContext; fmt: PAVImageFormat; img: PAVImageInfo): integer; - cdecl; external av__format; - -(* XXX: use automatic init with either ELF sections or C file parser *) -(* modules *) - -//#include "rtp.h" - -//#include "rtsp.h" - -(* utils.c *) - procedure av_register_input_format (format: PAVInputFormat); - cdecl; external av__format; - - procedure av_register_output_format (format: PAVOutputFormat); - cdecl; external av__format; - - function guess_stream_format (short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; - cdecl; external av__format; - - function guess_format(short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; - cdecl; external av__format; - - function av_guess_codec(fmt: PAVOutputFormat; short_name: pchar; - filename: pchar; mime_type: pchar; _type: TCodecType): TCodecID; - cdecl; external av__format; - - procedure av_hex_dump (f: HFILE; buf: pchar; size: integer); - cdecl; external av__format; - procedure av_pkt_dump(f: HFILE; pkt: pAVPacket; dump_payload: integer); - cdecl; external av__format; - - procedure av_register_all (); - cdecl; external av__format; - - -(* media file input *) - function av_find_input_format (short_name: pchar): PAVInputFormat; - cdecl; external av__format; - function av_probe_input_format (pd: PAVProbeData; is_opened: integer): PAVInputFormat; - cdecl; external av__format; - function av_open_input_stream (ic_ptr: PAVFormatContext; - pb: PByteIOContext; filename: pchar; - fmt: PAVInputFormat; ap: PAVFormatParameters): integer; - cdecl; external av__format; -(*** Open a media file as input. The codec are not opened. Only the file - * header (if present) is read. - * - * @param ic_ptr the opened media file handle is put here - * @param filename filename to open. - * @param fmt if non NULL, force the file format to use - * @param buf_size optional buffer size (zero if default is OK) - * @param ap additionnal parameters needed when opening the file (NULL if default) - * @return 0 if OK. AVERROR_xxx otherwise. *) - - function av_open_input_file (var ic_ptr: PAVFormatContext; filename: pchar; - fmt: PAVInputFormat; buf_size: integer; - ap: PAVFormatParameters): integer; - cdecl; external av__format; - - (* no av_open for output, so applications will need this: *) - function av_alloc_format_context (): PAVFormatContext; - cdecl; external av__format; - -const - AVERROR_UNKNOWN =(-1); (* unknown error *) - AVERROR_IO =(-2); (* i/o error *) - AVERROR_NUMEXPECTED =(-3); (* number syntax expected in filename *) - AVERROR_INVALIDDATA =(-4); (* invalid data found *) - AVERROR_NOMEM =(-5); (* not enough memory *) - AVERROR_NOFMT =(-6); (* unknown format *) - AVERROR_NOTSUPP =(-7); (* operation not supported *) - -(*** Read the beginning of a media file to get stream information. This - * is useful for file formats with no headers such as MPEG. This - * function also compute the real frame rate in case of mpeg2 repeat - * frame mode. - * - * @param ic media file handle - * @return >=0 if OK. AVERROR_xxx if error. - * @todo let user decide somehow what information is needed so we dont waste time geting stuff the user doesnt need *) - - function av_find_stream_info (ic: PAVFormatContext): integer; - cdecl; external av__format; - function av_read_packet (s: PAVFormatContext; pkt: PAVPacket): integer; - cdecl; external av__format; -(*** Return the next frame of a stream. - * - * The returned packet is valid - * until the next av_read_frame() or until av_close_input_file() and - * must be freed with av_free_packet. For video, the packet contains - * exactly one frame. For audio, it contains an integer number of - * frames if each frame has a known fixed size (e.g. PCM or ADPCM - * data). If the audio frames have a variable size (e.g. MPEG audio), - * then it contains one frame. - * - * pkt->pts, pkt->dts and pkt->duration are always set to correct - * values in AV_TIME_BASE unit (and guessed if the format cannot - * provided them). pkt->pts can be AV_NOPTS_VALUE if the video format - * has B frames, so it is better to rely on pkt->dts if you do not - * decompress the payload. - * - * @return 0 if OK, < 0 if error or end of file. *) - - function av_read_frame (s: PAVFormatContext; pkt: PAVPacket): integer; - cdecl; external av__format; - function av_seek_frame (s: PAVFormatContext; stream_index: integer; timestamp: int64; flags: integer): integer; - cdecl; external av__format; - function av_read_play (s: PAVFormatContext): integer; - cdecl; external av__format; - function av_read_pause (s: PAVFormatContext): integer; - cdecl; external av__format; - procedure av_close_input_file (s: PAVFormatContext); - cdecl; external av__format; - function av_new_stream (s: PAVFormatContext; id: integer): PAVStream; - cdecl; external av__format; - procedure av_set_pts_info (s: PAVStream; pts_wrap_bits: integer; - pts_num: integer; pts_den: integer); - cdecl; external av__format; - -const - AVSEEK_FLAG_BACKWARD =1; ///< seek backward - AVSEEK_FLAG_BYTE =2; ///< seeking based on position in bytes - AVSEEK_FLAG_ANY =4; ///< seek to any frame, even non keyframes - - function av_find_default_stream_index (s: PAVFormatContext): integer; - cdecl; external av__format; - function av_index_search_timestamp (st: PAVStream; timestamp: int64; flags: integer): integer; - cdecl; external av__format; - function av_add_index_entry (st: PAVStream; pos: int64; timestamp: int64; - distance: integer; flags: integer): integer; - cdecl; external av__format; - function av_seek_frame_binary (s: PAVFormatContext; stream_index: integer; - target_ts: int64; flags: integer): integer; - cdecl; external av__format; - - procedure av_update_cur_dts (s: PAVFormatContext; ref_st: PAVStream; - timestamp: int64); - cdecl; external av__format; - -(* media file output *) - function av_set_parameters (s: PAVFormatContext; ap: PAVFormatParameters): integer; - cdecl; external av__format; - - function av_write_header (s: PAVFormatContext): integer; - cdecl; external av__format; - - function av_write_frame(s: PAVFormatContext; pkt: PAVPacket): integer; - cdecl; external av__format; - - function av_interleaved_write_frame (s: PAVFormatContext; pkt: PAVPacket): integer; - cdecl; external av__format; - - function av_interleave_packet_per_dts(s: PAVFormatContext; _out: PAVPacket; - pkt: PAVPacket; flush: integer): integer; - cdecl; external av__format; - function av_write_trailer(s: pAVFormatContext): integer; - cdecl; external av__format; - - procedure dump_format(ic: PAVFormatContext; index: integer; url: pchar; - is_output: integer); - cdecl; external av__format; - - function parse_image_size(width_ptr: PInteger; height_ptr: PInteger; str: pchar): integer; - cdecl; external av__format; - function parse_frame_rate (frame_rate: PInteger; frame_rate_base: PInteger; arg: pchar): integer; - cdecl; external av__format; - function parse_date(datestr: pchar; duration: integer): int64; - cdecl; external av__format; - function av_gettime (): int64; - cdecl; external av__format; - -(* ffm specific for ffserver *) -const - FFM_PACKET_SIZE = 4096; - - {$IFNDEF FPC} - function ffm_read_write_index (fd: integer): int64; - cdecl; external av__format; - - procedure ffm_write_write_index(fd: integer; pos: int64); - cdecl; external av__format; - - procedure ffm_set_write_index (s: PAVFormatContext; pos: int64; file_size: int64); - cdecl; external av__format; - {$ENDIF} - - function find_info_tag (arg: pchar; arg_size: integer; tag1: pchar; info: pchar): integer; - cdecl; external av__format; - - {$IFNDEF FPC} - function get_frame_filename(buf: pchar; buf_size: integer; - path: pchar; number: integer): integer; - cdecl; external av__format; - - function filename_number_test (filename: pchar): integer; - cdecl; external av__format; - -(* grab specific *) - function video_grab_init (): integer; - cdecl; external av__format; - - function audio_init (): integer; - cdecl; external av__format; - -(* DV1394 *) - function dv1394_init (): integer; - cdecl; external av__format; - function dc1394_init (): integer; - cdecl; external av__format; - {$ENDIF} - - function strstart(str: pchar; val: pchar; ptr: PPointer): integer; - cdecl; external av__format; - function stristart(str: pchar; val: pchar; ptr: PPointer): integer; - cdecl; external av__format; - procedure pstrcpy(buf: pchar; buf_size: integer; str: pchar); - cdecl; external av__format; - function pstrcat(buf: pchar; buf_size: integer; s: pchar): pchar; - cdecl; external av__format; - - procedure __dynarray_add (tab_ptr: PPointer; nb_ptr: PInteger; elem: cardinal); - cdecl; external av__format; - - -implementation - -procedure av_init_packet (pkt: PAVPacket); -begin - pkt.pts := AV_NOPTS_VALUE; - pkt.dts := AV_NOPTS_VALUE; - pkt.pos := -1; - pkt.duration := 0; - pkt.flags := 0; - pkt.stream_index := 0; - pkt.destruct := @av_destruct_packet_nofree; -end; - -procedure av_free_packet (pkt: PAVPacket); -begin - if (pkt <> nil) and (@pkt^.destruct <> nil) then - pkt^.destruct (pkt); -end; - -end. + (* + * copyright (c) 2001 Fabrice Bellard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) +unit avformat; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses + {$IFDEF win32} + windows, + {$ENDIF} + avcodec, + avio, + rational, + avutil; + +const + {$IFDEF win32} + av__format = 'avformat-50.dll'; + {$ELSE} + av__format = 'libavformat.so'; // .0d + av__codec = 'libavcodec.so'; + {$ENDIF} + + LIBAVUTIL_VERSION_INT = ((49 shl 16) + (0 shl 8) + 1); + LIBAVUTIL_VERSION = '49.0.1'; + LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; + + MAXINT64 = $7fffffffffffffff; + MININT64 = $8000000000000000; + + PKT_FLAG_KEY = $0001; + + (* AVImageFormat.flags field constants *) + AVIMAGE_INTERLEAVED = $0001; (* image format support interleaved output *) + MAX_STREAMS = 20; +type + int = integer; + + PAVPacket = ^TAVPacket; + PAVImageFormat = ^TAVImageFormat; + PAVFormatContext = ^TAVFormatContext; + PAVFormatParameters = ^TAVFormatParameters; + PAVOutputFormat = ^TAVOutputFormat; + PAVProbeData = ^TAVProbeData; + PAVInputFormat = ^TAVInputFormat; + PAVIndexEntry = ^TAVIndexEntry; + PAVStream = ^TAVStream; + PAVPacketList = ^TAVPacketList; + PAVImageInfo = ^TAVImageInfo; + + TAVPacket = record {56} + pts: int64; ///< presentation time stamp in time_base units + dts: int64; ///< decompression time stamp in time_base units + data: PByte; + size: integer; + stream_index: integer; + flags: integer; + duration: integer; ///< presentation duration in time_base units (0 if not available) + destruct: procedure (p: PAVPacket); + priv: pointer; + pos: int64; ///< byte position in stream, -1 if unknown + end; + +(*************************************************) +(* fractional numbers for exact pts handling *) + +(* the exact value of the fractional number is: 'val + num / den'. num + is assumed to be such as 0 <= num < den *) + PAVFrac = ^TAVFrac; + TAVFrac = record + val, num, den: int64; + end; + +(*************************************************) +(* input/output formats *) + +(* this structure contains the data a format has to probe a file *) + TAVProbeData = record {12} + filename: pchar; + buf: pchar; + buf_size: integer; + end; + + TAVFormatParameters = record {56} + time_base: TAVRational; (* 8 bytes *) + sample_rate: integer; + channels: integer; + width: integer; + height: integer; + pix_fmt: TAVPixelFormat; + image_format: PAVImageFormat; (* 4 bytes *) + channel: integer; (* used to select dv channel *) + device: pchar; (* video, audio or DV device *) + standard: pchar; (* tv standard, NTSC, PAL, SECAM *) +// int mpeg2ts_raw:1; (* force raw MPEG2 transport stream output, if possible *) +// int mpeg2ts_compute_pcr:1; (* compute exact PCR for each transport +// stream packet (only meaningful if +// mpeg2ts_raw is TRUE *) +// int initial_pause:1; (* do not begin to play the stream +// immediately (RTSP only) *) + dummy: byte; + video_codec_id: TCodecID; + audio_codec_id: TCodecID; + end; + + TAVOutputFormat = record {56} + name: pchar; + long_name: pchar; + mime_type: pchar; + extensions: pchar; (* comma separated extensions *) + (* size of private data so that it can be allocated in the wrapper *) + priv_data_size: integer; + (* output support *) + audio_codec: TCodecID; (* default audio codec *) + video_codec: TCodecID; (* default video codec *) + write_header: function (c: PAVFormatContext): integer; cdecl; + write_packet: function (c: PAVFormatContext; pkt: PAVPacket): integer; cdecl; + write_trailer: function (c: PAVFormatContext): integer; cdecl; + (* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER *) + flags: integer; + (* currently only used to set pixel format if not YUV420P *) + set_parameters: function (c: PAVFormatContext; f: PAVFormatParameters): integer; cdecl; + interleave_packet: function (s: PAVFormatContext; _out: PAVPacket; _in: PAVPacket; flush: integer): integer; cdecl; + (* private fields *) + next: PAVOutputFormat; + end; + + TAVInputFormat = record {60} + name: pchar; + long_name: pchar; + (* size of private data so that it can be allocated in the wrapper *) + priv_data_size: integer; + (* tell if a given file has a chance of being parsing by this format *) + read_probe: function (p: PAVProbeData): integer; cdecl; + (* read the format header and initialize the AVFormatContext + structure. Return 0 if OK. 'ap' if non NULL contains + additionnal paramters. Only used in raw format right + now. 'av_new_stream' should be called to create new streams. *) + read_header: function (c: PAVFormatContext; ap: PAVFormatParameters): integer; cdecl; + (* read one packet and put it in 'pkt'. pts and flags are also + set. 'av_new_stream' can be called only if the flag + AVFMTCTX_NOHEADER is used. *) + read_packet: function (c: PAVFormatContext; pkt: PAVPacket): integer; cdecl; + (* close the stream. The AVFormatContext and AVStreams are not + freed by this function *) + read_close: function (c: PAVFormatContext): integer; cdecl; + (*** seek to a given timestamp relative to the frames in + * stream component stream_index + * @param stream_index must not be -1 + * @param flags selects which direction should be preferred if no exact + * match is available *) + read_seek: function (c: PAVFormatContext; stream_index: integer; + timestamp: int64; flags: integer): integer; cdecl; + (*** gets the next timestamp in AV_TIME_BASE units. *) + read_timestamp: function (s: PAVFormatContext; stream_index: integer; + pos: pint64; pos_limit: int64): integer; cdecl; + (* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER *) + flags: integer; + (* if extensions are defined, then no probe is done. You should + usually not use extension format guessing because it is not + reliable enough *) + extensions: pchar; + (* general purpose read only value that the format can use *) + value: integer; + + (* start/resume playing - only meaningful if using a network based format (RTSP) *) + read_play: function (c: PAVFormatContext): integer; cdecl; + + (* pause playing - only meaningful if using a network based format (RTSP) *) + read_pause: function (c: PAVFormatContext): integer; cdecl; + + (* private fields *) + next: PAVInputFormat; + end; + + TAVIndexEntry = record {24} + pos: int64; + timestamp: int64; +(* the following 2 flags indicate that the next/prev keyframe is known, and scaning for it isnt needed *) + flags: integer; + min_distance: integer; (* min distance between this and the previous keyframe, used to avoid unneeded searching *) + end; + + TAVStream = record {168} + index: integer; (* stream index in AVFormatContext *) + id: integer; (* format specific stream id *) + codec: PAVCodecContext; (* codec context *) + (*** real base frame rate of the stream. + * for example if the timebase is 1/90000 and all frames have either + * approximately 3600 or 1800 timer ticks then r_frame_rate will be 50/1 *) + r_frame_rate: TAVRational; + priv_data: pointer; + (* internal data used in av_find_stream_info() *) + codec_info_duration: int64; + codec_info_nb_frames: integer; + (* encoding: PTS generation when outputing stream *) + pts: TAVFrac; + + (*** this is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. for fixed-fps content, + * timebase should be 1/framerate and timestamp increments should be + * identically 1. *) + time_base: TAVRational; + pts_wrap_bits: integer; (* number of bits in pts (used for wrapping control) *) + (* ffmpeg.c private use *) + stream_copy: integer; (* if TRUE, just copy stream *) + discard: TAVDiscard; ///< selects which packets can be discarded at will and dont need to be demuxed + //FIXME move stuff to a flags field? + (* quality, as it has been removed from AVCodecContext and put in AVVideoFrame + * MN:dunno if thats the right place, for it *) + quality: single; + (* decoding: position of the first frame of the component, in AV_TIME_BASE fractional seconds. *) + start_time: int64; + (* decoding: duration of the stream, in AV_TIME_BASE fractional seconds. *) + duration: int64; + + language: array [0..3] of char; (* ISO 639 3-letter language code (empty string if undefined) *) + + (* av_read_frame() support *) + need_parsing: integer; ///< 1->full parsing needed, 2->only parse headers dont repack + parser: PAVCodecParserContext; + + cur_dts: int64; + last_IP_duration: integer; + last_IP_pts: int64; + (* av_seek_frame() support *) + index_entries: PAVIndexEntry; (* only used if the format does not support seeking natively *) + nb_index_entries: integer; + index_entries_allocated_size: integer; + + nb_frames: int64; ///< number of frames in this stream if known or 0 + pts_buffer: array [0..4] of int64; + end; + +(* format I/O context *) + TAVFormatContext = record {3960} + av_class: PAVClass; (* set by av_alloc_format_context *) + (* can only be iformat or oformat, not both at the same time *) + iformat: PAVInputFormat; + oformat: PAVOutputFormat; + priv_data: pointer; + pb: TByteIOContext; + nb_streams: integer; + streams: array [0..MAX_STREAMS - 1] of PAVStream; + filename: array [0..1023] of char; (* input or output filename *) + (* stream info *) + timestamp: int64; + title: array [0..511] of char; + author: array [0..511] of char; + copyright: array [0..511] of char; + comment: array [0..511] of char; + album: array [0..511] of char; + year: integer; (* ID3 year, 0 if none *) + track: integer; (* track number, 0 if none *) + genre: array [0..31] of char; (* ID3 genre *) + + ctx_flags: integer; (* format specific flags, see AVFMTCTX_xx *) + (* private data for pts handling (do not modify directly) *) + (* This buffer is only needed when packets were already buffered but + not decoded, for example to get the codec parameters in mpeg + streams *) + packet_buffer: PAVPacketList; + + (* decoding: position of the first frame of the component, in + AV_TIME_BASE fractional seconds. NEVER set this value directly: + it is deduced from the AVStream values. *) + start_time: int64; + (* decoding: duration of the stream, in AV_TIME_BASE fractional + seconds. NEVER set this value directly: it is deduced from the + AVStream values. *) + duration: int64; + (* decoding: total file size. 0 if unknown *) + file_size: int64; + (* decoding: total stream bitrate in bit/s, 0 if not + available. Never set it directly if the file_size and the + duration are known as ffmpeg can compute it automatically. *) + bit_rate: integer; + + (* av_read_frame() support *) + cur_st: PAVStream; + cur_ptr: pchar; + cur_len: integer; + cur_pkt: TAVPacket; + + (* av_seek_frame() support *) + data_offset: int64; (* offset of the first packet *) + index_built: integer; + + mux_rate: integer; + packet_size: integer; + preload: integer; + max_delay: integer; + + (* number of times to loop output in formats that support it *) + loop_output: integer; + + flags: integer; + loop_input: integer; + (* decoding: size of data to probe; encoding unused *) + probesize: cardinal; + end; + + TAVPacketList = record {64} + pkt: TAVPacket; + next: PAVPacketList; + end; + +(* still image support *) + PAVInputImageContext = pointer; // attribute_deprecated; +// PAVInputImageContext = pointer; //AVInputImageContext attribute_deprecated; + +(* still image support *) + TAVImageInfo = record {48} + pix_fmt: TAVPixelFormat; (* requested pixel format *) + width: integer; (* requested width *) + height: integer; (* requested height *) + interleaved: integer; (* image is interleaved (e.g. interleaved GIF) *) + pict: TAVPicture; (* returned allocated image *) + end; + + TAVImageFormat = record {32} + name: pchar; + extensions: pchar; + (* tell if a given file has a chance of being parsing by this format *) + img_probe: function (d: PAVProbeData): integer; cdecl; + (* read a whole image. 'alloc_cb' is called when the image size is + known so that the caller can allocate the image. If 'allo_cb' + returns non zero, then the parsing is aborted. Return '0' if + OK. *) + img_read: function (b: PByteIOContext; alloc_cb: pointer; ptr: pointer): integer; cdecl; + (* write the image *) + supported_pixel_formats: integer; (* mask of supported formats for output *) + img_write: function (b: PByteIOContext; i: PAVImageInfo): integer; cdecl; + flags: integer; + next: PAVImageFormat; + end; + + {$IFNDEF win32} + HFILE = THandle; + {$ENDIF} + +procedure av_destruct_packet_nofree (pkt: PAVPacket); + cdecl; external av__format; +procedure av_destruct_packet (pkt: PAVPacket); + cdecl; external av__format; + +(* initialize optional fields of a packet *) +procedure av_init_packet (pkt: PAVPacket); + +function av_new_packet(pkt: PAVPacket; size: integer): integer; + cdecl; external av__format; + +function av_get_packet (s: PByteIOContext; pkt: PAVPacket; size: integer): integer; + cdecl; external av__format; + +function av_dup_packet (pkt: PAVPacket): integer; + cdecl; external av__format; + +(** * Free a packet + * + * @param pkt packet to free *) +procedure av_free_packet (pkt: PAVPacket); + +procedure av_register_image_format (img_fmt: PAVImageFormat); + cdecl; external av__format; + +function av_probe_image_format (pd: PAVProbeData): PAVImageFormat; + cdecl; external av__format; + +function guess_image_format (filename: pchar): PAVImageFormat; + cdecl; external av__format; + +function av_guess_image2_codec(filename: pchar): TCodecID; + cdecl; external av__format; + +function av_read_image (pb: PByteIOContext; filename: pchar; + fmt: PAVImageFormat; + alloc_cb: pointer; opaque: pointer): integer; + cdecl; external av__format; + +function av_write_image(pb: PByteIOContext; fmt: PAVImageFormat; img: PAVImageInfo): integer; + cdecl; external av__format; + +(* XXX: use automatic init with either ELF sections or C file parser *) +(* modules *) + +//#include "rtp.h" + +//#include "rtsp.h" + +(* utils.c *) + procedure av_register_input_format (format: PAVInputFormat); cdecl; external av__format; + procedure av_register_output_format (format: PAVOutputFormat); cdecl; external av__format; + function guess_stream_format (short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; cdecl; external av__format; + function guess_format(short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; cdecl; external av__format; + function av_guess_codec(fmt: PAVOutputFormat; short_name: pchar; + filename: pchar; mime_type: pchar; _type: TCodecType): TCodecID; cdecl; external av__format; + procedure av_hex_dump (f: HFILE; buf: pchar; size: integer); cdecl; external av__format; + procedure av_pkt_dump(f: HFILE; pkt: pAVPacket; dump_payload: integer); cdecl; external av__format; + procedure av_register_all (); cdecl; external av__format; + + +(* media file input *) + function av_find_input_format (short_name: pchar): PAVInputFormat; + cdecl; external av__format; + function av_probe_input_format (pd: PAVProbeData; is_opened: integer): PAVInputFormat; + cdecl; external av__format; + function av_open_input_stream (ic_ptr: PAVFormatContext; + pb: PByteIOContext; filename: pchar; + fmt: PAVInputFormat; ap: PAVFormatParameters): integer; + cdecl; external av__format; +(*** Open a media file as input. The codec are not opened. Only the file + * header (if present) is read. + * + * @param ic_ptr the opened media file handle is put here + * @param filename filename to open. + * @param fmt if non NULL, force the file format to use + * @param buf_size optional buffer size (zero if default is OK) + * @param ap additionnal parameters needed when opening the file (NULL if default) + * @return 0 if OK. AVERROR_xxx otherwise. *) + + function av_open_input_file (var ic_ptr: PAVFormatContext; filename: pchar; + fmt: PAVInputFormat; buf_size: integer; + ap: PAVFormatParameters): integer; + cdecl; external av__format; + + (* no av_open for output, so applications will need this: *) + function av_alloc_format_context (): PAVFormatContext; + cdecl; external av__format; + +const + AVERROR_UNKNOWN =(-1); (* unknown error *) + AVERROR_IO =(-2); (* i/o error *) + AVERROR_NUMEXPECTED =(-3); (* number syntax expected in filename *) + AVERROR_INVALIDDATA =(-4); (* invalid data found *) + AVERROR_NOMEM =(-5); (* not enough memory *) + AVERROR_NOFMT =(-6); (* unknown format *) + AVERROR_NOTSUPP =(-7); (* operation not supported *) + +(*** Read the beginning of a media file to get stream information. This + * is useful for file formats with no headers such as MPEG. This + * function also compute the real frame rate in case of mpeg2 repeat + * frame mode. + * + * @param ic media file handle + * @return >=0 if OK. AVERROR_xxx if error. + * @todo let user decide somehow what information is needed so we dont waste time geting stuff the user doesnt need *) + + function av_find_stream_info (ic: PAVFormatContext): integer; + cdecl; external av__format; + function av_read_packet (s: PAVFormatContext; pkt: PAVPacket): integer; + cdecl; external av__format; +(*** Return the next frame of a stream. + * + * The returned packet is valid + * until the next av_read_frame() or until av_close_input_file() and + * must be freed with av_free_packet. For video, the packet contains + * exactly one frame. For audio, it contains an integer number of + * frames if each frame has a known fixed size (e.g. PCM or ADPCM + * data). If the audio frames have a variable size (e.g. MPEG audio), + * then it contains one frame. + * + * pkt->pts, pkt->dts and pkt->duration are always set to correct + * values in AV_TIME_BASE unit (and guessed if the format cannot + * provided them). pkt->pts can be AV_NOPTS_VALUE if the video format + * has B frames, so it is better to rely on pkt->dts if you do not + * decompress the payload. + * + * @return 0 if OK, < 0 if error or end of file. *) + + function av_read_frame (s: PAVFormatContext; pkt: PAVPacket): integer; + cdecl; external av__format; + function av_seek_frame (s: PAVFormatContext; stream_index: integer; timestamp: int64; flags: integer): integer; + cdecl; external av__format; + function av_read_play (s: PAVFormatContext): integer; + cdecl; external av__format; + function av_read_pause (s: PAVFormatContext): integer; + cdecl; external av__format; + procedure av_close_input_file (s: PAVFormatContext); + cdecl; external av__format; + function av_new_stream (s: PAVFormatContext; id: integer): PAVStream; + cdecl; external av__format; + procedure av_set_pts_info (s: PAVStream; pts_wrap_bits: integer; + pts_num: integer; pts_den: integer); + cdecl; external av__format; + +const + AVSEEK_FLAG_BACKWARD =1; ///< seek backward + AVSEEK_FLAG_BYTE =2; ///< seeking based on position in bytes + AVSEEK_FLAG_ANY =4; ///< seek to any frame, even non keyframes + + function av_find_default_stream_index (s: PAVFormatContext): integer; + cdecl; external av__format; + function av_index_search_timestamp (st: PAVStream; timestamp: int64; flags: integer): integer; + cdecl; external av__format; + function av_add_index_entry (st: PAVStream; pos: int64; timestamp: int64; + distance: integer; flags: integer): integer; + cdecl; external av__format; + function av_seek_frame_binary (s: PAVFormatContext; stream_index: integer; + target_ts: int64; flags: integer): integer; + cdecl; external av__format; + + procedure av_update_cur_dts (s: PAVFormatContext; ref_st: PAVStream; + timestamp: int64); + cdecl; external av__format; + +(* media file output *) + function av_set_parameters (s: PAVFormatContext; ap: PAVFormatParameters): integer; + cdecl; external av__format; + + function av_write_header (s: PAVFormatContext): integer; + cdecl; external av__format; + + function av_write_frame(s: PAVFormatContext; pkt: PAVPacket): integer; + cdecl; external av__format; + + function av_interleaved_write_frame (s: PAVFormatContext; pkt: PAVPacket): integer; + cdecl; external av__format; + + function av_interleave_packet_per_dts(s: PAVFormatContext; _out: PAVPacket; + pkt: PAVPacket; flush: integer): integer; + cdecl; external av__format; + function av_write_trailer(s: pAVFormatContext): integer; + cdecl; external av__format; + + procedure dump_format(ic: PAVFormatContext; index: integer; url: pchar; + is_output: integer); + cdecl; external av__format; + + function parse_image_size(width_ptr: PInteger; height_ptr: PInteger; str: pchar): integer; + cdecl; external av__format; + function parse_frame_rate (frame_rate: PInteger; frame_rate_base: PInteger; arg: pchar): integer; + cdecl; external av__format; + function parse_date(datestr: pchar; duration: integer): int64; + cdecl; external av__format; + function av_gettime (): int64; + cdecl; external av__format; + +(* ffm specific for ffserver *) +const + FFM_PACKET_SIZE = 4096; + + {$IFNDEF FPC} + function ffm_read_write_index (fd: integer): int64; + cdecl; external av__format; + + procedure ffm_write_write_index(fd: integer; pos: int64); + cdecl; external av__format; + + procedure ffm_set_write_index (s: PAVFormatContext; pos: int64; file_size: int64); + cdecl; external av__format; + {$ENDIF} + + function find_info_tag (arg: pchar; arg_size: integer; tag1: pchar; info: pchar): integer; + cdecl; external av__format; + + {$IFNDEF FPC} + function get_frame_filename(buf: pchar; buf_size: integer; + path: pchar; number: integer): integer; + cdecl; external av__format; + + function filename_number_test (filename: pchar): integer; + cdecl; external av__format; + +(* grab specific *) + function video_grab_init (): integer; + cdecl; external av__format; + + function audio_init (): integer; + cdecl; external av__format; + +(* DV1394 *) + function dv1394_init (): integer; + cdecl; external av__format; + function dc1394_init (): integer; + cdecl; external av__format; + {$ENDIF} + + function strstart(str: pchar; val: pchar; ptr: PPointer): integer; + cdecl; external av__format; + function stristart(str: pchar; val: pchar; ptr: PPointer): integer; + cdecl; external av__format; + procedure pstrcpy(buf: pchar; buf_size: integer; str: pchar); + cdecl; external av__format; + function pstrcat(buf: pchar; buf_size: integer; s: pchar): pchar; + cdecl; external av__format; + + procedure __dynarray_add (tab_ptr: PPointer; nb_ptr: PInteger; elem: cardinal); + cdecl; external av__format; + + +implementation + +procedure av_init_packet (pkt: PAVPacket); +begin + pkt.pts := AV_NOPTS_VALUE; + pkt.dts := AV_NOPTS_VALUE; + pkt.pos := -1; + pkt.duration := 0; + pkt.flags := 0; + pkt.stream_index := 0; + pkt.destruct := @av_destruct_packet_nofree; +end; + +procedure av_free_packet (pkt: PAVPacket); +begin + if (pkt <> nil) and (@pkt^.destruct <> nil) then + pkt^.destruct (pkt); +end; + +end. diff --git a/Game/Code/lib/ffmpeg/avio.pas b/Game/Code/lib/ffmpeg/avio.pas index 7d0e8c04..84622f0d 100644 --- a/Game/Code/lib/ffmpeg/avio.pas +++ b/Game/Code/lib/ffmpeg/avio.pas @@ -1,243 +1,249 @@ - (* - * unbuffered io for ffmpeg system - * copyright (c) 2001 Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) -unit avio; - -interface - -uses - windows; - -const - av__format = 'avformat-50.dll'; - - URL_RDONLY = 0; - URL_WRONLY = 1; - URL_RDWR = 2; - -(* output byte stream handling *) - -type - offset_t = int64; - int = integer; - -(* unbuffered I/O *) - PURLProtocol = ^TURLProtocol; - PURLContext = ^TURLContext; - TURLContext = record - prot: PURLProtocol; - flags: int; - is_streamed: int; //* true if streamed (no seek possible), default = false */ - max_packet_size: int; //* if non zero, the stream is packetized with this max packet size */ - priv_data: pointer; - filename: array [0..0] of char; (* specified filename *) - end; - - PURLPollEntry = ^TURLPollEntry; - TURLPollEntry = record - handle: PURLContext; - events: integer; - revents: integer; - end; - - TURLProtocol = record - name: pchar; - url_open: function (h: PURLContext; const filename: pchar; flags: integer): integer; cdecl; - url_read: function (h: PURLContext; buf: pchar; size: integer): integer; cdecl; - url_write: function (h: PURLContext; buf: pchar; size: integer): integer; cdecl; - url_seek: function (h: PURLContext; pos: int64; whence: integer): int64; cdecl; - url_close: function (h: PURLContext): integer; cdecl; - next: PURLProtocol; - end; - - PByteIOContext = ^TByteIOContext; - TByteIOContext = record - buffer: pchar; - buffer_size: integer; - buf_ptr: pchar; - buf_end: pchar; - opaque: pointer; - read_packet: function (opaque: pointer; buf: pchar; buf_size: integer): integer; cdecl; - write_packet: function (opaque: pointer; buf: pchar; buf_size: integer): integer; cdecl; - seek: function (opaque: pointer; offset: int64; whence: integer): int64; cdecl; - pos: int64; (* position in the file of the current buffer *) - must_flush: integer; (* true if the next seek should flush *) - eof_reached: integer; (* true if eof reached *) - write_flag: integer; (* true if open for writing *) - is_streamed: integer; - max_packet_size: integer; - checksum: longword; - checksum_ptr: pchar; - update_checksum: function (checksum: cardinal; const buf: pchar; size: cardinal): LongWord; cdecl; - error: integer; ///< contains the error code or 0 if no error happened - end; - - function url_open(h: PPointer; const filename: pchar; flags: integer): integer; - cdecl; external av__format; - function url_read (h: PURLContext; buf: pchar; size: integer): integer; - cdecl; external av__format; - function url_write (h: PURLContext; buf: pchar; size: integer): integer; - cdecl; external av__format; - function url_seek (h: PURLContext; pos: int64; whence: integer): int64; - cdecl; external av__format; - function url_close (h: PURLContext): integer; - cdecl; external av__format; - function url_exist(const filename: pchar): integer; - cdecl; external av__format; - function url_filesize (h: PURLContext): int64; - cdecl; external av__format; - function url_get_max_packet_size(h: PURLContext): integer; - cdecl; external av__format; - procedure url_get_filename(h: PURLContext; buf: pchar; buf_size: integer); - cdecl; external av__format; - -(* the callback is called in blocking functions to test regulary if - asynchronous interruption is needed. -EINTR is returned in this - case by the interrupted function. 'NULL' means no interrupt - callback is given. *) - procedure url_set_interrupt_cb (interrupt_cb: pinteger); - cdecl; external av__format; - -(* not implemented *) -//int url_poll(URLPollEntry *poll_table, int n, int timeout); - - function register_protocol (protocol: PURLProtocol): integer; - cdecl; external av__format; - - function init_put_byte(s: PByteIOContext; - buffer: pchar; - buffer_size: integer; write_flag: integer; - opaque: pointer; - read_packet: pointer; //int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), - write_packet: pointer; //int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), - seek: pointer //offset_t (*seek)(void *opaque, offset_t offset, int whence) - ): integer; - cdecl; external av__format; - procedure put_byte(s: PByteIOContext; b: integer); - cdecl; external av__format; - procedure put_buffer (s: PByteIOContext; const buf: pchar; size: integer); - cdecl; external av__format; - procedure put_le64(s: PByteIOContext; val: int64); - cdecl; external av__format; - procedure put_be64(s: PByteIOContext; val: int64); - cdecl; external av__format; - procedure put_le32(s: PByteIOContext; val: cardinal); - cdecl; external av__format; - procedure put_be32(s: PByteIOContext; val: cardinal); - cdecl; external av__format; - procedure put_be24(s: PByteIOContext; val: cardinal); - cdecl; external av__format; - procedure put_le16(s: PByteIOContext; val: cardinal); - cdecl; external av__format; - procedure put_be16(s: PByteIOContext; val: cardinal); - cdecl; external av__format; - procedure put_tag(s: PByteIOContext; const tag: pchar); - cdecl; external av__format; - - procedure put_strz(s: PByteIOContext; const buf: pchar); - cdecl; external av__format; - - function url_fseek(s: PByteIOContext; offset: int64; whence: integer): int64; - cdecl; external av__format; - procedure url_fskip(s: PByteIOContext; offset: int64); - cdecl; external av__format; - function url_ftell(s: PByteIOContext): int64; - cdecl; external av__format; - function url_fsize(s: PByteIOContext): int64; - cdecl; external av__format; - function url_feof(s: PByteIOContext): integer; - cdecl; external av__format; - function url_ferror(s: PByteIOContext): integer; - cdecl; external av__format; - - procedure put_flush_packet (s: PByteIOContext); - cdecl; external av__format; - function get_buffer(s: PByteIOContext; buf: pchar; size: integer): integer; - cdecl; external av__format; - function get_partial_buffer(s: PByteIOContext; buf: pchar; size: integer): integer; - cdecl; external av__format; - function get_byte(s: PByteIOContext): integer; - cdecl; external av__format; - function get_le32(s: PByteIOContext): cardinal; - cdecl; external av__format; - function get_le64(s: PByteIOContext): int64; - cdecl; external av__format; - function get_le16(s: PByteIOContext): cardinal; - cdecl; external av__format; - - function get_strz(s: PByteIOContext; buf: pchar; maxlen: integer): pchar; - cdecl; external av__format; - function get_be16(s: PByteIOContext): cardinal; - cdecl; external av__format; - function get_be24(s: PByteIOContext): cardinal; - cdecl; external av__format; - function get_be32(s: PByteIOContext): cardinal; - cdecl; external av__format; - function get_be64(s: PByteIOContext): int64; - cdecl; external av__format; - - function url_is_streamed(s: PByteIOContext): integer; - - function url_fdopen (s: PByteIOContext; h: PURLContext): integer; - cdecl; external av__format; - function url_setbufsize (s: PByteIOContext; buf_size: integer): integer; - cdecl; external av__format; - function url_fopen(s: PByteIOContext; const filename: pchar; flags: integer): integer; - cdecl; external av__format; - function url_fclose(s: PByteIOContext): integer; - cdecl; external av__format; - - function url_fileno(s: PByteIOContext): PURLContext; - cdecl; external av__format; - function url_fget_max_packet_size (s: PByteIOContext): integer; - cdecl; external av__format; - function url_open_buf(s: PByteIOContext; buf: pchar; buf_size: integer; flags: integer): integer; - cdecl; external av__format; - function url_close_buf(s: PByteIOContext): integer; - cdecl; external av__format; - - function url_open_dyn_buf(s: PByteIOContext): integer; - cdecl; external av__format; - function url_open_dyn_packet_buf(s: PByteIOContext; max_packet_size: integer): integer; - cdecl; external av__format; - function url_close_dyn_buf(s: PByteIOContext; pbuffer:PPointer): integer; - cdecl; external av__format; - - function get_checksum(s: PByteIOContext): cardinal; - cdecl; external av__format; - - procedure init_checksum (s: PByteIOContext; update_checksum: pointer; checksum: cardinal); - cdecl; external av__format; - - {$IFNDEF FPC} - function udp_set_remote_url(h: PURLContext; const uri: pchar): integer; - cdecl; external av__format; - function udp_get_local_port(h: PURLContext): integer; - cdecl; external av__format; - function udp_get_file_handle(h: PURLContext): integer; - cdecl; external av__format; - {$ENDIF} - -implementation - -function url_is_streamed(s: PByteIOContext): integer; -begin - Result := s^.is_streamed; -end; - -end. + (* + * unbuffered io for ffmpeg system + * copyright (c) 2001 Fabrice Bellard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) +unit avio; + +interface + +{$IFDEF win32} +uses + windows; +{$ENDIF} + +const + {$IFDEF win32} + av__format = 'avformat-50.dll'; + {$ELSE} + av__format = 'libavformat.so'; // .0d + {$ENDIF} + + URL_RDONLY = 0; + URL_WRONLY = 1; + URL_RDWR = 2; + +(* output byte stream handling *) + +type + offset_t = int64; + int = integer; + +(* unbuffered I/O *) + PURLProtocol = ^TURLProtocol; + PURLContext = ^TURLContext; + TURLContext = record + prot: PURLProtocol; + flags: int; + is_streamed: int; //* true if streamed (no seek possible), default = false */ + max_packet_size: int; //* if non zero, the stream is packetized with this max packet size */ + priv_data: pointer; + filename: array [0..0] of char; (* specified filename *) + end; + + PURLPollEntry = ^TURLPollEntry; + TURLPollEntry = record + handle: PURLContext; + events: integer; + revents: integer; + end; + + TURLProtocol = record + name: pchar; + url_open: function (h: PURLContext; const filename: pchar; flags: integer): integer; cdecl; + url_read: function (h: PURLContext; buf: pchar; size: integer): integer; cdecl; + url_write: function (h: PURLContext; buf: pchar; size: integer): integer; cdecl; + url_seek: function (h: PURLContext; pos: int64; whence: integer): int64; cdecl; + url_close: function (h: PURLContext): integer; cdecl; + next: PURLProtocol; + end; + + PByteIOContext = ^TByteIOContext; + TByteIOContext = record + buffer: pchar; + buffer_size: integer; + buf_ptr: pchar; + buf_end: pchar; + opaque: pointer; + read_packet: function (opaque: pointer; buf: pchar; buf_size: integer): integer; cdecl; + write_packet: function (opaque: pointer; buf: pchar; buf_size: integer): integer; cdecl; + seek: function (opaque: pointer; offset: int64; whence: integer): int64; cdecl; + pos: int64; (* position in the file of the current buffer *) + must_flush: integer; (* true if the next seek should flush *) + eof_reached: integer; (* true if eof reached *) + write_flag: integer; (* true if open for writing *) + is_streamed: integer; + max_packet_size: integer; + checksum: longword; + checksum_ptr: pchar; + update_checksum: function (checksum: cardinal; const buf: pchar; size: cardinal): LongWord; cdecl; + error: integer; ///< contains the error code or 0 if no error happened + end; + + function url_open(h: PPointer; const filename: pchar; flags: integer): integer; + cdecl; external av__format; + function url_read (h: PURLContext; buf: pchar; size: integer): integer; + cdecl; external av__format; + function url_write (h: PURLContext; buf: pchar; size: integer): integer; + cdecl; external av__format; + function url_seek (h: PURLContext; pos: int64; whence: integer): int64; + cdecl; external av__format; + function url_close (h: PURLContext): integer; + cdecl; external av__format; + function url_exist(const filename: pchar): integer; + cdecl; external av__format; + function url_filesize (h: PURLContext): int64; + cdecl; external av__format; + function url_get_max_packet_size(h: PURLContext): integer; + cdecl; external av__format; + procedure url_get_filename(h: PURLContext; buf: pchar; buf_size: integer); + cdecl; external av__format; + +(* the callback is called in blocking functions to test regulary if + asynchronous interruption is needed. -EINTR is returned in this + case by the interrupted function. 'NULL' means no interrupt + callback is given. *) + procedure url_set_interrupt_cb (interrupt_cb: pinteger); + cdecl; external av__format; + +(* not implemented *) +//int url_poll(URLPollEntry *poll_table, int n, int timeout); + + function register_protocol (protocol: PURLProtocol): integer; + cdecl; external av__format; + + function init_put_byte(s: PByteIOContext; + buffer: pchar; + buffer_size: integer; write_flag: integer; + opaque: pointer; + read_packet: pointer; //int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + write_packet: pointer; //int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + seek: pointer //offset_t (*seek)(void *opaque, offset_t offset, int whence) + ): integer; + cdecl; external av__format; + procedure put_byte(s: PByteIOContext; b: integer); + cdecl; external av__format; + procedure put_buffer (s: PByteIOContext; const buf: pchar; size: integer); + cdecl; external av__format; + procedure put_le64(s: PByteIOContext; val: int64); + cdecl; external av__format; + procedure put_be64(s: PByteIOContext; val: int64); + cdecl; external av__format; + procedure put_le32(s: PByteIOContext; val: cardinal); + cdecl; external av__format; + procedure put_be32(s: PByteIOContext; val: cardinal); + cdecl; external av__format; + procedure put_be24(s: PByteIOContext; val: cardinal); + cdecl; external av__format; + procedure put_le16(s: PByteIOContext; val: cardinal); + cdecl; external av__format; + procedure put_be16(s: PByteIOContext; val: cardinal); + cdecl; external av__format; + procedure put_tag(s: PByteIOContext; const tag: pchar); + cdecl; external av__format; + + procedure put_strz(s: PByteIOContext; const buf: pchar); + cdecl; external av__format; + + function url_fseek(s: PByteIOContext; offset: int64; whence: integer): int64; + cdecl; external av__format; + procedure url_fskip(s: PByteIOContext; offset: int64); + cdecl; external av__format; + function url_ftell(s: PByteIOContext): int64; + cdecl; external av__format; + function url_fsize(s: PByteIOContext): int64; + cdecl; external av__format; + function url_feof(s: PByteIOContext): integer; + cdecl; external av__format; + function url_ferror(s: PByteIOContext): integer; + cdecl; external av__format; + + procedure put_flush_packet (s: PByteIOContext); + cdecl; external av__format; + function get_buffer(s: PByteIOContext; buf: pchar; size: integer): integer; + cdecl; external av__format; + function get_partial_buffer(s: PByteIOContext; buf: pchar; size: integer): integer; + cdecl; external av__format; + function get_byte(s: PByteIOContext): integer; + cdecl; external av__format; + function get_le32(s: PByteIOContext): cardinal; + cdecl; external av__format; + function get_le64(s: PByteIOContext): int64; + cdecl; external av__format; + function get_le16(s: PByteIOContext): cardinal; + cdecl; external av__format; + + function get_strz(s: PByteIOContext; buf: pchar; maxlen: integer): pchar; + cdecl; external av__format; + function get_be16(s: PByteIOContext): cardinal; + cdecl; external av__format; + function get_be24(s: PByteIOContext): cardinal; + cdecl; external av__format; + function get_be32(s: PByteIOContext): cardinal; + cdecl; external av__format; + function get_be64(s: PByteIOContext): int64; + cdecl; external av__format; + + function url_is_streamed(s: PByteIOContext): integer; + + function url_fdopen (s: PByteIOContext; h: PURLContext): integer; + cdecl; external av__format; + function url_setbufsize (s: PByteIOContext; buf_size: integer): integer; + cdecl; external av__format; + function url_fopen(s: PByteIOContext; const filename: pchar; flags: integer): integer; + cdecl; external av__format; + function url_fclose(s: PByteIOContext): integer; + cdecl; external av__format; + + function url_fileno(s: PByteIOContext): PURLContext; + cdecl; external av__format; + function url_fget_max_packet_size (s: PByteIOContext): integer; + cdecl; external av__format; + function url_open_buf(s: PByteIOContext; buf: pchar; buf_size: integer; flags: integer): integer; + cdecl; external av__format; + function url_close_buf(s: PByteIOContext): integer; + cdecl; external av__format; + + function url_open_dyn_buf(s: PByteIOContext): integer; + cdecl; external av__format; + function url_open_dyn_packet_buf(s: PByteIOContext; max_packet_size: integer): integer; + cdecl; external av__format; + function url_close_dyn_buf(s: PByteIOContext; pbuffer:PPointer): integer; + cdecl; external av__format; + + function get_checksum(s: PByteIOContext): cardinal; + cdecl; external av__format; + + procedure init_checksum (s: PByteIOContext; update_checksum: pointer; checksum: cardinal); + cdecl; external av__format; + + {$IFNDEF FPC} + function udp_set_remote_url(h: PURLContext; const uri: pchar): integer; + cdecl; external av__format; + function udp_get_local_port(h: PURLContext): integer; + cdecl; external av__format; + function udp_get_file_handle(h: PURLContext): integer; + cdecl; external av__format; + {$ENDIF} + +implementation + +function url_is_streamed(s: PByteIOContext): integer; +begin + Result := s^.is_streamed; +end; + +end. diff --git a/Game/Code/lib/ffmpeg/avutil.pas b/Game/Code/lib/ffmpeg/avutil.pas index d947a3f0..7c5926ab 100644 --- a/Game/Code/lib/ffmpeg/avutil.pas +++ b/Game/Code/lib/ffmpeg/avutil.pas @@ -1,133 +1,137 @@ - (* - * copyright (c) 2006 Michael Niedermayer - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) - -unit avutil; - -interface - - -const - av__util = 'avutil-49.dll'; - - LIBAVUTIL_VERSION_INT = ((49 shl 16) + (0 shl 8) + 1); - LIBAVUTIL_VERSION = '49.0.1'; - LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; - -type -(** - * Pixel format. Notes: - * - * PIX_FMT_RGB32 is handled in an endian-specific manner. A RGBA - * color is put together as: - * (A << 24) | (R << 16) | (G << 8) | B - * This is stored as BGRA on little endian CPU architectures and ARGB on - * big endian CPUs. - * - * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized - * image data is stored in AVFrame.data[0]. The palette is transported in - * AVFrame.data[1] and, is 1024 bytes long (256 4-byte entries) and is - * formatted the same as in PIX_FMT_RGB32 described above (i.e., it is - * also endian-specific). Note also that the individual RGB palette - * components stored in AVFrame.data[1] should be in the range 0..255. - * This is important as many custom PAL8 video codecs that were designed - * to run on the IBM VGA graphics adapter use 6-bit palette components. - *) - - PAVPixelFormat = ^TAVPixelFormat; - TAVPixelFormat = ( - PIX_FMT_NONE= -1, - PIX_FMT_YUV420P, ///< Planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) - PIX_FMT_YUYV422, ///< Packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr - PIX_FMT_RGB24, ///< Packed RGB 8:8:8, 24bpp, RGBRGB... - PIX_FMT_BGR24, ///< Packed RGB 8:8:8, 24bpp, BGRBGR... - PIX_FMT_YUV422P, ///< Planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) - PIX_FMT_YUV444P, ///< Planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) - PIX_FMT_RGB32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in cpu endianness - PIX_FMT_YUV410P, ///< Planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) - PIX_FMT_YUV411P, ///< Planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) - PIX_FMT_RGB565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in cpu endianness - PIX_FMT_RGB555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in cpu endianness most significant bit to 1 - PIX_FMT_GRAY8, ///< Y , 8bpp - PIX_FMT_MONOWHITE, ///< Y , 1bpp, 1 is white - PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black - PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette - PIX_FMT_YUVJ420P, ///< Planar YUV 4:2:0, 12bpp, full scale (jpeg) - PIX_FMT_YUVJ422P, ///< Planar YUV 4:2:2, 16bpp, full scale (jpeg) - PIX_FMT_YUVJ444P, ///< Planar YUV 4:4:4, 24bpp, full scale (jpeg) - PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h) - PIX_FMT_XVMC_MPEG2_IDCT, - PIX_FMT_UYVY422, ///< Packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 - PIX_FMT_UYYVYY411, ///< Packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 - PIX_FMT_BGR32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in cpu endianness - PIX_FMT_BGR565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in cpu endianness - PIX_FMT_BGR555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in cpu endianness most significant bit to 1 - PIX_FMT_BGR8, ///< Packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) - PIX_FMT_BGR4, ///< Packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb) - PIX_FMT_BGR4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) - PIX_FMT_RGB8, ///< Packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) - PIX_FMT_RGB4, ///< Packed RGB 1:2:1, 4bpp, (msb)2R 3G 3B(lsb) - PIX_FMT_RGB4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)2R 3G 3B(lsb) - PIX_FMT_NV12, ///< Planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV - PIX_FMT_NV21, ///< as above, but U and V bytes are swapped - - PIX_FMT_RGB32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in cpu endianness - PIX_FMT_BGR32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in cpu endianness - - PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions - PIX_FMT_FACKED = $FFFFF - ); - -const -{$ifdef WORDS_BIGENDIAN} - PIX_FMT_RGBA = PIX_FMT_RGB32_1; - PIX_FMT_BGRA = PIX_FMT_BGR32_1; - PIX_FMT_ARGB = PIX_FMT_RGB32; - PIX_FMT_ABGR = PIX_FMT_BGR32; -{$else} - PIX_FMT_RGBA = PIX_FMT_BGR32; - PIX_FMT_BGRA = PIX_FMT_RGB32; - PIX_FMT_ARGB = PIX_FMT_BGR32_1; - PIX_FMT_ABGR = PIX_FMT_RGB32_1; -{$endif} - - PIX_FMT_UYVY411 = PIX_FMT_UYYVYY411; - PIX_FMT_RGBA32 = PIX_FMT_RGB32; - PIX_FMT_YUV422 = PIX_FMT_YUYV422; - -(* memory *) -function av_malloc (size: cardinal): pointer; - cdecl; external av__util; - -function av_realloc (ptr: pointer; size: cardinal): pointer; - cdecl; external av__util; - -procedure av_free (ptr: pointer); - cdecl; external av__util; - -function av_mallocz (size: cardinal): pointer; - cdecl; external av__util; - -function av_strdup(const s: pchar): pchar; - cdecl; external av__util; - -procedure av_freep (ptr: pointer); - cdecl; external av__util; - -implementation - -end. + (* + * copyright (c) 2006 Michael Niedermayer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +unit avutil; + +interface + + +const + {$IFDEF win32} + av__util = 'avutil-49.dll'; + {$ELSE} + av__util = 'libavutil.so'; // .0d + {$ENDIF} + + LIBAVUTIL_VERSION_INT = ((49 shl 16) + (0 shl 8) + 1); + LIBAVUTIL_VERSION = '49.0.1'; + LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; + +type +(** + * Pixel format. Notes: + * + * PIX_FMT_RGB32 is handled in an endian-specific manner. A RGBA + * color is put together as: + * (A << 24) | (R << 16) | (G << 8) | B + * This is stored as BGRA on little endian CPU architectures and ARGB on + * big endian CPUs. + * + * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized + * image data is stored in AVFrame.data[0]. The palette is transported in + * AVFrame.data[1] and, is 1024 bytes long (256 4-byte entries) and is + * formatted the same as in PIX_FMT_RGB32 described above (i.e., it is + * also endian-specific). Note also that the individual RGB palette + * components stored in AVFrame.data[1] should be in the range 0..255. + * This is important as many custom PAL8 video codecs that were designed + * to run on the IBM VGA graphics adapter use 6-bit palette components. + *) + + PAVPixelFormat = ^TAVPixelFormat; + TAVPixelFormat = ( + PIX_FMT_NONE= -1, + PIX_FMT_YUV420P, ///< Planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) + PIX_FMT_YUYV422, ///< Packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr + PIX_FMT_RGB24, ///< Packed RGB 8:8:8, 24bpp, RGBRGB... + PIX_FMT_BGR24, ///< Packed RGB 8:8:8, 24bpp, BGRBGR... + PIX_FMT_YUV422P, ///< Planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + PIX_FMT_YUV444P, ///< Planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) + PIX_FMT_RGB32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in cpu endianness + PIX_FMT_YUV410P, ///< Planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) + PIX_FMT_YUV411P, ///< Planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) + PIX_FMT_RGB565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in cpu endianness + PIX_FMT_RGB555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in cpu endianness most significant bit to 1 + PIX_FMT_GRAY8, ///< Y , 8bpp + PIX_FMT_MONOWHITE, ///< Y , 1bpp, 1 is white + PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black + PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette + PIX_FMT_YUVJ420P, ///< Planar YUV 4:2:0, 12bpp, full scale (jpeg) + PIX_FMT_YUVJ422P, ///< Planar YUV 4:2:2, 16bpp, full scale (jpeg) + PIX_FMT_YUVJ444P, ///< Planar YUV 4:4:4, 24bpp, full scale (jpeg) + PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h) + PIX_FMT_XVMC_MPEG2_IDCT, + PIX_FMT_UYVY422, ///< Packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 + PIX_FMT_UYYVYY411, ///< Packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 + PIX_FMT_BGR32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in cpu endianness + PIX_FMT_BGR565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in cpu endianness + PIX_FMT_BGR555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in cpu endianness most significant bit to 1 + PIX_FMT_BGR8, ///< Packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) + PIX_FMT_BGR4, ///< Packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb) + PIX_FMT_BGR4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) + PIX_FMT_RGB8, ///< Packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) + PIX_FMT_RGB4, ///< Packed RGB 1:2:1, 4bpp, (msb)2R 3G 3B(lsb) + PIX_FMT_RGB4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)2R 3G 3B(lsb) + PIX_FMT_NV12, ///< Planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV + PIX_FMT_NV21, ///< as above, but U and V bytes are swapped + + PIX_FMT_RGB32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in cpu endianness + PIX_FMT_BGR32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in cpu endianness + + PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions + PIX_FMT_FACKED = $FFFFF + ); + +const +{$ifdef WORDS_BIGENDIAN} + PIX_FMT_RGBA = PIX_FMT_RGB32_1; + PIX_FMT_BGRA = PIX_FMT_BGR32_1; + PIX_FMT_ARGB = PIX_FMT_RGB32; + PIX_FMT_ABGR = PIX_FMT_BGR32; +{$else} + PIX_FMT_RGBA = PIX_FMT_BGR32; + PIX_FMT_BGRA = PIX_FMT_RGB32; + PIX_FMT_ARGB = PIX_FMT_BGR32_1; + PIX_FMT_ABGR = PIX_FMT_RGB32_1; +{$endif} + + PIX_FMT_UYVY411 = PIX_FMT_UYYVYY411; + PIX_FMT_RGBA32 = PIX_FMT_RGB32; + PIX_FMT_YUV422 = PIX_FMT_YUYV422; + +(* memory *) +function av_malloc (size: cardinal): pointer; + cdecl; external av__util; + +function av_realloc (ptr: pointer; size: cardinal): pointer; + cdecl; external av__util; + +procedure av_free (ptr: pointer); + cdecl; external av__util; + +function av_mallocz (size: cardinal): pointer; + cdecl; external av__util; + +function av_strdup(const s: pchar): pchar; + cdecl; external av__util; + +procedure av_freep (ptr: pointer); + cdecl; external av__util; + +implementation + +end. diff --git a/Game/Code/lib/ffmpeg/lazarustest.lpi b/Game/Code/lib/ffmpeg/lazarustest.lpi index 3cd1c3de..399b8b7e 100644 --- a/Game/Code/lib/ffmpeg/lazarustest.lpi +++ b/Game/Code/lib/ffmpeg/lazarustest.lpi @@ -1,194 +1,226 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Game/Code/lib/ffmpeg/lazarustest.lpr b/Game/Code/lib/ffmpeg/lazarustest.lpr index 56efac75..10b59b9c 100644 --- a/Game/Code/lib/ffmpeg/lazarustest.lpr +++ b/Game/Code/lib/ffmpeg/lazarustest.lpr @@ -1,27 +1,30 @@ -program lazarustest; - -{$MODE Delphi} - -uses - - avcodec in 'avcodec.pas', - avformat in 'avformat.pas', - avutil in 'avutil.pas', - rational in 'rational.pas', - opt in 'opt.pas', - avio in 'avio.pas', - sysutils; - -begin - // This compiles with all units in.. - // but I cant run it, if its compiled with lazarus or delphi - // I get errors about not finding functions in dll's - - try -// av_register_all(); - writeln( 'If you see this then ffmpeg is probably lazarus compatible' ); - except - writeln( 'ffmpeg is NOT lazarus compatible' ); - end; -end. - +program lazarustest; + +{$MODE Delphi} + +uses + + avcodec in 'avcodec.pas', + avformat in 'avformat.pas', + avutil in 'avutil.pas', + rational in 'rational.pas', + opt in 'opt.pas', + avio in 'avio.pas', + sysutils; + +begin + // This compiles with all units in.. + // but I cant run it, if its compiled with lazarus or delphi + // I get errors about not finding functions in dll's + + // ON LINUX - Ubuntu .. you will probably need to + // sudo apt-get install libavcodec-dev libavformat-dev + + try + av_register_all(); + writeln( 'YES - If you see this then ffmpeg is probably lazarus compatible' ); + except + writeln( 'NO - ffmpeg is NOT lazarus compatible' ); + end; +end. + diff --git a/Game/Code/lib/ffmpeg/opt.pas b/Game/Code/lib/ffmpeg/opt.pas index f78ef201..c8b72479 100644 --- a/Game/Code/lib/ffmpeg/opt.pas +++ b/Game/Code/lib/ffmpeg/opt.pas @@ -1,101 +1,109 @@ -(* - * AVOptions - * copyright (c) 2005 Michael Niedermayer - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*) -unit opt; - -interface - -uses - windows, rational; - -type - TAVOptionType = ( - FF_OPT_TYPE_FLAGS, - FF_OPT_TYPE_INT, - FF_OPT_TYPE_INT64, - FF_OPT_TYPE_DOUBLE, - FF_OPT_TYPE_FLOAT, - FF_OPT_TYPE_STRING, - FF_OPT_TYPE_RATIONAL, - FF_OPT_TYPE_CONST = 128 - ); - -const - av__codec = 'avcodec-51.dll'; - - AV_OPT_FLAG_ENCODING_PARAM = 1; ///< a generic parameter which can be set by the user for muxing or encoding - AV_OPT_FLAG_DECODING_PARAM = 2; ///< a generic parameter which can be set by the user for demuxing or decoding - AV_OPT_FLAG_METADATA = 4; ///< some data extracted or inserted into the file like title, comment, ... - AV_OPT_FLAG_AUDIO_PARAM = 8; - AV_OPT_FLAG_VIDEO_PARAM = 16; - AV_OPT_FLAG_SUBTITLE_PARAM = 32; - -type - PAVOption = ^TAVOption; - TAVOption = record - name: pchar; - help: pchar; - offset: integer; ///< offset to context structure where the parsed value should be stored - _type: TAVOptionType; - - default_val: double; - min: double; - max: double; - - flags: integer; -//FIXME think about enc-audio, ... style flags - _unit: pchar; - end; - - -function av_set_string (obj: pointer; name: pchar; val: pchar): PAVOption; - cdecl; external av__codec; - -function av_set_double (obj: pointer; name: pchar; n: double): PAVOption; - cdecl; external av__codec; - -function av_set_q (obj: pointer; name: pchar; n: TAVRational): PAVOption; - cdecl; external av__codec; - -function av_set_int (obj: pointer; name: pchar; n: int64): PAVOption; - cdecl; external av__codec; - -function av_get_double (obj: pointer; name: pchar; o_out: PPointer): double; - cdecl; external av__codec; - -function av_get_q (obj: pointer; name: pchar; o_out: PPointer): TAVRational; - cdecl; external av__codec; - -function av_get_int (obj: pointer; name: pchar; o_out: PPointer): int64; - cdecl; external av__codec; - -function av_get_string (obj: pointer; name: pchar; o_out: PPOinter; buf: pchar; buf_len: integer): pchar; - cdecl; external av__codec; - -function av_next_option (obj: pointer; last: PAVOption): PAVOption; - cdecl; external av__codec; - -function av_opt_show (obj: pointer; av_log_obj: pointer): integer; - cdecl; external av__codec; - -procedure av_opt_set_defaults (s: pointer); - cdecl; external av__codec; - -implementation - -end. +(* + * AVOptions + * copyright (c) 2005 Michael Niedermayer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*) +unit opt; + +interface + +uses + {$IFDEF win32} + windows, + {$ENDIF} + rational; + +type + TAVOptionType = ( + FF_OPT_TYPE_FLAGS, + FF_OPT_TYPE_INT, + FF_OPT_TYPE_INT64, + FF_OPT_TYPE_DOUBLE, + FF_OPT_TYPE_FLOAT, + FF_OPT_TYPE_STRING, + FF_OPT_TYPE_RATIONAL, + FF_OPT_TYPE_CONST = 128 + ); + +const + + {$IFDEF win32} + av__codec = 'avcodec-51.dll'; + {$ELSE} + av__codec = 'avcodec.so'; // .0d + {$ENDIF} + + AV_OPT_FLAG_ENCODING_PARAM = 1; ///< a generic parameter which can be set by the user for muxing or encoding + AV_OPT_FLAG_DECODING_PARAM = 2; ///< a generic parameter which can be set by the user for demuxing or decoding + AV_OPT_FLAG_METADATA = 4; ///< some data extracted or inserted into the file like title, comment, ... + AV_OPT_FLAG_AUDIO_PARAM = 8; + AV_OPT_FLAG_VIDEO_PARAM = 16; + AV_OPT_FLAG_SUBTITLE_PARAM = 32; + +type + PAVOption = ^TAVOption; + TAVOption = record + name: pchar; + help: pchar; + offset: integer; ///< offset to context structure where the parsed value should be stored + _type: TAVOptionType; + + default_val: double; + min: double; + max: double; + + flags: integer; +//FIXME think about enc-audio, ... style flags + _unit: pchar; + end; + + +function av_set_string (obj: pointer; name: pchar; val: pchar): PAVOption; + cdecl; external av__codec; + +function av_set_double (obj: pointer; name: pchar; n: double): PAVOption; + cdecl; external av__codec; + +function av_set_q (obj: pointer; name: pchar; n: TAVRational): PAVOption; + cdecl; external av__codec; + +function av_set_int (obj: pointer; name: pchar; n: int64): PAVOption; + cdecl; external av__codec; + +function av_get_double (obj: pointer; name: pchar; o_out: PPointer): double; + cdecl; external av__codec; + +function av_get_q (obj: pointer; name: pchar; o_out: PPointer): TAVRational; + cdecl; external av__codec; + +function av_get_int (obj: pointer; name: pchar; o_out: PPointer): int64; + cdecl; external av__codec; + +function av_get_string (obj: pointer; name: pchar; o_out: PPOinter; buf: pchar; buf_len: integer): pchar; + cdecl; external av__codec; + +function av_next_option (obj: pointer; last: PAVOption): PAVOption; + cdecl; external av__codec; + +function av_opt_show (obj: pointer; av_log_obj: pointer): integer; + cdecl; external av__codec; + +procedure av_opt_set_defaults (s: pointer); + cdecl; external av__codec; + +implementation + +end. diff --git a/Game/Code/lib/ffmpeg/rational.pas b/Game/Code/lib/ffmpeg/rational.pas index a996e1df..40d1f093 100644 --- a/Game/Code/lib/ffmpeg/rational.pas +++ b/Game/Code/lib/ffmpeg/rational.pas @@ -1,88 +1,96 @@ -(* - * Rational numbers - * Copyright (c) 2003 Michael Niedermayer - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) -unit rational; - -interface - -uses - windows; - -const - av__util = 'avutil-49.dll'; - -type - -(* - * Rational number num/den. *) - PAVRational = ^TAVRational; - TAVRational = record - num: integer; ///< numerator - den: integer; ///< denominator - end; - -(** - * returns 0 if a==b, 1 if a>b and -1 if a + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) +unit rational; + +interface + +{$IFDEF win32} +uses + windows; +{$endif} + +const + + {$IFDEF win32} + av__util = 'avutil-49.dll'; + {$ELSE} + av__util = 'libavutil.so'; // .0d + {$ENDIF} + + +type + +(* + * Rational number num/den. *) + PAVRational = ^TAVRational; + TAVRational = record + num: integer; ///< numerator + den: integer; ///< denominator + end; + +(** + * returns 0 if a==b, 1 if a>b and -1 if a Date: Wed, 19 Sep 2007 23:34:34 +0000 Subject: tested ffmpeg in lazarus - linux.. working :) just need to make sure development packages are installed for ffmpeg. such as : libavcodec-dev & libavformat-dev git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@406 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.lpi | 1181 +++++++++++++++++++++------------------- Game/Code/UltraStar.lpr | 797 ++++++++++++++------------- Game/Code/lib/requirements.txt | 6 +- 3 files changed, 1027 insertions(+), 957 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.lpi b/Game/Code/UltraStar.lpi index a402e9a0..84980b53 100644 --- a/Game/Code/UltraStar.lpi +++ b/Game/Code/UltraStar.lpi @@ -1,569 +1,612 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index 6aa8b53a..31207bcb 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -1,386 +1,411 @@ -program UltraStar; - -{$DEFINE TRANSLATE} - -{$IFDEF FPC} - {$MODE DELPHI} -{$ELSE} - {$R 'UltraStar.res' 'UltraStar.rc'} -{$ENDIF} - -{$I switches.inc} - -uses - - //------------------------------ - //Includes - 3rd Party Libraries - //------------------------------ - sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', - moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', - OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas', - - bass in 'lib\bass\delphi\bass.pas', - - {$IFDEF UseMIDIPort} - midiout in 'lib\midi\midiout.pas', - midiin in 'lib\midi\midiin.pas', - Circbuf in 'lib\midi\CIRCBUF.PAS', - MidiType in 'lib\midi\MidiType.PAS', - MidiDefs in 'lib\midi\MidiDefs.PAS', - MidiCons in 'lib\midi\MidiCons.PAS', - MidiFile in 'lib\midi\MidiFile.PAS', - Delphmcb in 'lib\midi\Delphmcb.PAS', - {$ENDIF} - - avcodec in 'lib\ffmpeg\avcodec.pas', - avformat in 'lib\ffmpeg\avformat.pas', - avutil in 'lib\ffmpeg\avutil.pas', - rational in 'lib\ffmpeg\rational.pas', - opt in 'lib\ffmpeg\opt.pas', - avio in 'lib\ffmpeg\avio.pas', - - SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', - SQLite3 in 'lib\SQLite\SQLite3.pas', - - - //------------------------------ - //Includes - Menu System - //------------------------------ - UMenu in 'Menu\UMenu.pas', - UDisplay in 'Menu\UDisplay.pas', - UMenuStatic in 'Menu\UMenuStatic.pas', - UMenuText in 'Menu\UMenuText.pas', - UMenuButton in 'Menu\UMenuButton.pas', - UMenuInteract in 'Menu\UMenuInteract.pas', - UMenuSelect in 'Menu\UMenuSelect.pas', - UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', - UDrawTexture in 'Menu\UDrawTexture.pas', - UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', - - - //------------------------------ - //Includes - Classes - //------------------------------ - - {$IFDEF FPC} - Ulazjpeg in 'Classes\Ulazjpeg.pas', - {$ENDIF} - - UCommon in 'Classes\UCommon.pas', - UTime in 'Classes\UTime.pas', - UCommandLine in 'Classes\UCommandLine.pas', - ULog in 'Classes\ULog.pas', - - UMain in 'Classes\UMain.pas', - - UIni in 'Classes\UIni.pas', - UTexture in 'Classes\UTexture.pas', - - UGraphic in 'Classes\UGraphic.pas', - UMusic in 'Classes\UMusic.pas', - ULanguage in 'Classes\ULanguage.pas', - UDraw in 'Classes\UDraw.pas', - URecord in 'Classes\URecord.pas', - TextGL in 'Classes\TextGL.pas', - USongs in 'Classes\USongs.pas', - ULyrics in 'Classes\ULyrics.pas', - USkins in 'Classes\USkins.pas', - UThemes in 'Classes\UThemes.pas', - UJoystick in 'Classes\UJoystick.pas', - ULCD in 'Classes\ULCD.pas', - ULight in 'Classes\ULight.pas', - UDataBase in 'Classes\UDataBase.pas', - UCovers in 'Classes\UCovers.pas', - UCatCovers in 'Classes\UCatCovers.pas', - UFiles in 'Classes\UFiles.pas', - UGraphicClasses in 'Classes\UGraphicClasses.pas', - UDLLManager in 'Classes\UDLLManager.pas', - UParty in 'Classes\UParty.pas', - UPlaylist in 'Classes\UPlaylist.pas', - - //------------------------------ - //Includes - Video Support - //------------------------------ - UVideo in 'Classes\UVideo.pas', - - - //------------------------------ - //Includes - Screens - //------------------------------ - UScreenLoading in 'Screens\UScreenLoading.pas', - UScreenWelcome in 'Screens\UScreenWelcome.pas', - UScreenMain in 'Screens\UScreenMain.pas', - UScreenName in 'Screens\UScreenName.pas', - UScreenLevel in 'Screens\UScreenLevel.pas', - UScreenSong in 'Screens\UScreenSong.pas', - UScreenSing in 'Screens\UScreenSing.pas', - UScreenScore in 'Screens\UScreenScore.pas', - UScreenOptions in 'Screens\UScreenOptions.pas', - UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', - UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', - UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', - UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', - UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', - UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', - UScreenOptionsAdvanced in 'Screens\UScreenOptionsAdvanced.pas', - UScreenEditSub in 'Screens\UScreenEditSub.pas', - UScreenEdit in 'Screens\UScreenEdit.pas', - UScreenEditConvert in 'Screens\UScreenEditConvert.pas', - UScreenEditHeader in 'Screens\UScreenEditHeader.pas', - UScreenOpen in 'Screens\UScreenOpen.pas', - UScreenTop5 in 'Screens\UScreenTop5.pas', - UScreenSongMenu in 'Screens\UScreenSongMenu.pas', - UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', - UScreenStatMain in 'Screens\UScreenStatMain.pas', - UScreenStatDetail in 'Screens\UScreenStatDetail.pas', - UScreenCredits in 'Screens\UScreenCredits.pas', - UScreenPopup in 'Screens\UScreenPopup.pas', - - - //------------------------------ - //Includes - Screens PartyMode - //------------------------------ - UScreenSingModi in 'Screens\UScreenSingModi.pas', - UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', - UScreenPartyScore in 'Screens\UScreenPartyScore.pas', - UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', - UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', - UScreenPartyWin in 'Screens\UScreenPartyWin.pas', - - - //------------------------------ - //Includes - Modi SDK - //------------------------------ - ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', - - - //------------------------------ - //Includes - Delphi - //------------------------------ - Windows, - SysUtils; - -const - Version = 'UltraStar Deluxe V 1.10 Alpha Build'; - -var - WndTitle: string; - hWnd: THandle; - I: Integer; - -begin - WndTitle := Version; - - //------------------------------ - //Start more than One Time Prevention - //------------------------------ - hWnd:= FindWindow(nil, PChar(WndTitle)); - //Programm already started - if (hWnd <> 0) then - begin - I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Contìnue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); - if (I = IDYes) then - begin - I := 1; - repeat - Inc(I); - hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); - until (hWnd = 0); - - WndTitle := WndTitle + ' Instance ' + InttoStr(I); - end - else - Exit; - end; - - //------------------------------ - //StartUp - Create Classes and Load Files - //------------------------------ - USTime := TTime.Create; - - // Commandline Parameter Parser - Params := TCMDParams.Create; - - // Log + Benchmark - Log := TLog.Create; - Log.Title := WndTitle; - Log.Enabled := Not Params.NoLog; - Log.BenchmarkStart(0); - - // Language - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Paths', 'Initialization'); InitializePaths; - Log.LogStatus('Load Language', 'Initialization'); Language := TLanguage.Create; - //Add Const Values: - Language.AddConst('US_VERSION', Version); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Language', 1); - - // SDL - Log.BenchmarkStart(1); - Log.LogStatus('Initialize SDL', 'Initialization'); - SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing SDL', 1); - - // Skin - Log.BenchmarkStart(1); - Log.LogStatus('Loading Skin List', 'Initialization'); Skin := TSkin.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Skin List', 1); - - // Sound Card List - Log.BenchmarkStart(1); - Log.LogStatus('Loading Soundcard list', 'Initialization'); - Recording := TRecord.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Soundcard list', 1); - - // Ini + Paths - Log.BenchmarkStart(1); - Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; - Ini.Load; - - //Load Languagefile - if (Params.Language <> -1) then - Language.ChangeLanguage(ILanguage[Params.Language]) - else - Language.ChangeLanguage(ILanguage[Ini.Language]); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Ini', 1); - - // LCD - Log.BenchmarkStart(1); - Log.LogStatus('Load LCD', 'Initialization'); LCD := TLCD.Create; - if Ini.LPT = 1 then begin -// LCD.HalfInterface := true; - LCD.Enable; - LCD.Clear; - LCD.WriteText(1, ' UltraStar '); - LCD.WriteText(2, ' Loading... '); - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading LCD', 1); - - // Light - Log.BenchmarkStart(1); - Log.LogStatus('Load Light', 'Initialization'); Light := TLight.Create; - if Ini.LPT = 2 then begin - Light.Enable; - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Light', 1); - - // Theme - Log.BenchmarkStart(1); - Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Themes', 1); - - // Covers Cache - Log.BenchmarkStart(1); - Log.LogStatus('Creating Covers Cache', 'Initialization'); Covers := TCovers.Create; - Log.LogBenchmark('Loading Covers Cache Array', 1); - Log.BenchmarkStart(1); - - // Category Covers - Log.BenchmarkStart(1); - Log.LogStatus('Creating Category Covers Array', 'Initialization'); - CatCovers:= TCatCovers.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Category Covers Array', 1); - - // Songs - //Log.BenchmarkStart(1); - Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; - Songs.LoadSongList; - Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Songs', 1); - - // PluginManager - Log.BenchmarkStart(1); - Log.LogStatus('PluginManager', 'Initialization'); - DLLMan := TDLLMan.Create; //Load PluginList - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PluginManager', 1); - - // Party Mode Manager - Log.BenchmarkStart(1); - Log.LogStatus('PartySession Manager', 'Initialization'); - PartySession := TParty_Session.Create; //Load PartySession - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PartySession Manager', 1); - - // Graphics - Log.BenchmarkStart(1); - Log.LogStatus('Initialize 3D', 'Initialization'); Initialize3D(WndTitle); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing 3D', 1); - - // Sound - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Sound', 'Initialization'); - Log.LogStatus('Creating Music', 'InitializeSound'); Music := TMusic.Create; - InitializeSound; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Sound', 1); - - // Score Saving System - Log.BenchmarkStart(1); - Log.LogStatus('DataBase System', 'Initialization'); - DataBase := TDataBaseSystem.Create; - - if (Params.ScoreFile = '') then - DataBase.Init ('Ultrastar.db') - else - DataBase.Init (Params.ScoreFile); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading DataBase System', 1); - - //Playlist Manager - Log.BenchmarkStart(1); - Log.LogStatus('Playlist Manager', 'Initialization'); - PlaylistMan := TPlaylistManager.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Playlist Manager', 1); - - //GoldenStarsTwinkleMod - Log.BenchmarkStart(1); - Log.LogStatus('Effect Manager', 'Initialization'); - GoldenRec := TEffectManager.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Particel System', 1); - - // Joypad - if (Ini.Joypad = 1) OR (Params.Joypad) then begin - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Joystick', 'Initialization'); Joy := TJoy.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Joystick', 1); - end; - - Log.BenchmarkEnd(0); - Log.LogBenchmark('Loading Time', 0); - - - //------------------------------ - //Start- Mainloop - //------------------------------ - //Music.SetLoop(true); - //Music.SetVolume(50); - //Music.Open(SkinPath + 'Menu Music 3.mp3'); - //Music.Play; - Log.LogStatus('Main Loop', 'Initialization'); MainLoop; - - //------------------------------ - //Finish Application - //------------------------------ - if Ini.LPT = 1 then LCD.Clear; - if Ini.LPT = 2 then Light.TurnOff; - - Log.Free; -end. +program UltraStar; + +{$DEFINE TRANSLATE} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ELSE} + {$R 'UltraStar.res' 'UltraStar.rc'} +{$ENDIF} + +{$I switches.inc} + +uses + + // *************************************************************************** + // + // Developers PLEASE NOTE !!!!!!! + // + // As of september 2007, I am working towards porting Ultrastar-DX to run + // on Linux. I will be modifiying the source to make it compile in lazarus + // on windows & linux and I will make sure that it compiles in delphi still + // To help me in this endevour, please can you make a point of remembering + // that linux is CASE SENSATIVE, and file / unit names must be as per + // the filename exactly. + // + // EG : opengl12.pas must not be OpenGL in the uses cluase. + // + // thanks for your help... + // + // *************************************************************************** + + //------------------------------ + //Includes - 3rd Party Libraries + //------------------------------ + + // SDL / OpenGL + sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', + moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', + opengl12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\opengl12.pas', + + // Bass + {$IFDEF win32} + bass in 'lib\bass\delphi\bass.pas', + {$ENDIF} + + // Midi Units + {$IFDEF UseMIDIPort} + midiout in 'lib\midi\midiout.pas', + midiin in 'lib\midi\midiin.pas', + Circbuf in 'lib\midi\CIRCBUF.PAS', + MidiType in 'lib\midi\MidiType.PAS', + MidiDefs in 'lib\midi\MidiDefs.PAS', + MidiCons in 'lib\midi\MidiCons.PAS', + MidiFile in 'lib\midi\MidiFile.PAS', + Delphmcb in 'lib\midi\Delphmcb.PAS', + {$ENDIF} + + // FFMpeg units + avcodec in 'lib\ffmpeg\avcodec.pas', + avformat in 'lib\ffmpeg\avformat.pas', + avutil in 'lib\ffmpeg\avutil.pas', + rational in 'lib\ffmpeg\rational.pas', + opt in 'lib\ffmpeg\opt.pas', + avio in 'lib\ffmpeg\avio.pas', + + // Sql Lite + SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', + SQLite3 in 'lib\SQLite\SQLite3.pas', + + + //------------------------------ + //Includes - Menu System + //------------------------------ + UMenu in 'Menu\UMenu.pas', + UDisplay in 'Menu\UDisplay.pas', + UMenuStatic in 'Menu\UMenuStatic.pas', + UMenuText in 'Menu\UMenuText.pas', + UMenuButton in 'Menu\UMenuButton.pas', + UMenuInteract in 'Menu\UMenuInteract.pas', + UMenuSelect in 'Menu\UMenuSelect.pas', + UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', + UDrawTexture in 'Menu\UDrawTexture.pas', + UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', + + + //------------------------------ + //Includes - Classes + //------------------------------ + + {$IFDEF FPC} + ulazjpeg in 'Classes\ulazjpeg.pas', + {$ENDIF} + + UCommon in 'Classes\UCommon.pas', + UTime in 'Classes\UTime.pas', + UCommandLine in 'Classes\UCommandLine.pas', + ULog in 'Classes\ULog.pas', + + UMain in 'Classes\UMain.pas', + + UIni in 'Classes\UIni.pas', + UTexture in 'Classes\UTexture.pas', + + UGraphic in 'Classes\UGraphic.pas', + UMusic in 'Classes\UMusic.pas', + ULanguage in 'Classes\ULanguage.pas', + UDraw in 'Classes\UDraw.pas', + URecord in 'Classes\URecord.pas', + TextGL in 'Classes\TextGL.pas', + USongs in 'Classes\USongs.pas', + ULyrics in 'Classes\ULyrics.pas', + USkins in 'Classes\USkins.pas', + UThemes in 'Classes\UThemes.pas', + UJoystick in 'Classes\UJoystick.pas', + ULCD in 'Classes\ULCD.pas', + ULight in 'Classes\ULight.pas', + UDataBase in 'Classes\UDataBase.pas', + UCovers in 'Classes\UCovers.pas', + UCatCovers in 'Classes\UCatCovers.pas', + UFiles in 'Classes\UFiles.pas', + UGraphicClasses in 'Classes\UGraphicClasses.pas', + UDLLManager in 'Classes\UDLLManager.pas', + UParty in 'Classes\UParty.pas', + UPlaylist in 'Classes\UPlaylist.pas', + + //------------------------------ + //Includes - Video Support + //------------------------------ + UVideo in 'Classes\UVideo.pas', + + + //------------------------------ + //Includes - Screens + //------------------------------ + UScreenLoading in 'Screens\UScreenLoading.pas', + UScreenWelcome in 'Screens\UScreenWelcome.pas', + UScreenMain in 'Screens\UScreenMain.pas', + UScreenName in 'Screens\UScreenName.pas', + UScreenLevel in 'Screens\UScreenLevel.pas', + UScreenSong in 'Screens\UScreenSong.pas', + UScreenSing in 'Screens\UScreenSing.pas', + UScreenScore in 'Screens\UScreenScore.pas', + UScreenOptions in 'Screens\UScreenOptions.pas', + UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', + UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', + UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', + UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', + UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', + UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', + UScreenOptionsAdvanced in 'Screens\UScreenOptionsAdvanced.pas', + UScreenEditSub in 'Screens\UScreenEditSub.pas', + UScreenEdit in 'Screens\UScreenEdit.pas', + UScreenEditConvert in 'Screens\UScreenEditConvert.pas', + UScreenEditHeader in 'Screens\UScreenEditHeader.pas', + UScreenOpen in 'Screens\UScreenOpen.pas', + UScreenTop5 in 'Screens\UScreenTop5.pas', + UScreenSongMenu in 'Screens\UScreenSongMenu.pas', + UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', + UScreenStatMain in 'Screens\UScreenStatMain.pas', + UScreenStatDetail in 'Screens\UScreenStatDetail.pas', + UScreenCredits in 'Screens\UScreenCredits.pas', + UScreenPopup in 'Screens\UScreenPopup.pas', + + + //------------------------------ + //Includes - Screens PartyMode + //------------------------------ + UScreenSingModi in 'Screens\UScreenSingModi.pas', + UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', + UScreenPartyScore in 'Screens\UScreenPartyScore.pas', + UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', + UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', + UScreenPartyWin in 'Screens\UScreenPartyWin.pas', + + + //------------------------------ + //Includes - Modi SDK + //------------------------------ + ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', + + + //------------------------------ + //Includes - Delphi + //------------------------------ + Windows, + SysUtils; + +const + Version = 'UltraStar Deluxe V 1.10 Alpha Build'; + +var + WndTitle: string; + hWnd: THandle; + I: Integer; + +begin + WndTitle := Version; + + //------------------------------ + //Start more than One Time Prevention + //------------------------------ + hWnd:= FindWindow(nil, PChar(WndTitle)); + //Programm already started + if (hWnd <> 0) then + begin + I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Contìnue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); + if (I = IDYes) then + begin + I := 1; + repeat + Inc(I); + hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); + until (hWnd = 0); + + WndTitle := WndTitle + ' Instance ' + InttoStr(I); + end + else + Exit; + end; + + //------------------------------ + //StartUp - Create Classes and Load Files + //------------------------------ + USTime := TTime.Create; + + // Commandline Parameter Parser + Params := TCMDParams.Create; + + // Log + Benchmark + Log := TLog.Create; + Log.Title := WndTitle; + Log.Enabled := Not Params.NoLog; + Log.BenchmarkStart(0); + + // Language + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Paths', 'Initialization'); InitializePaths; + Log.LogStatus('Load Language', 'Initialization'); Language := TLanguage.Create; + //Add Const Values: + Language.AddConst('US_VERSION', Version); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Language', 1); + + // SDL + Log.BenchmarkStart(1); + Log.LogStatus('Initialize SDL', 'Initialization'); + SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing SDL', 1); + + // Skin + Log.BenchmarkStart(1); + Log.LogStatus('Loading Skin List', 'Initialization'); Skin := TSkin.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Skin List', 1); + + // Sound Card List + Log.BenchmarkStart(1); + Log.LogStatus('Loading Soundcard list', 'Initialization'); + Recording := TRecord.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Soundcard list', 1); + + // Ini + Paths + Log.BenchmarkStart(1); + Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; + Ini.Load; + + //Load Languagefile + if (Params.Language <> -1) then + Language.ChangeLanguage(ILanguage[Params.Language]) + else + Language.ChangeLanguage(ILanguage[Ini.Language]); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Ini', 1); + + // LCD + Log.BenchmarkStart(1); + Log.LogStatus('Load LCD', 'Initialization'); LCD := TLCD.Create; + if Ini.LPT = 1 then begin +// LCD.HalfInterface := true; + LCD.Enable; + LCD.Clear; + LCD.WriteText(1, ' UltraStar '); + LCD.WriteText(2, ' Loading... '); + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading LCD', 1); + + // Light + Log.BenchmarkStart(1); + Log.LogStatus('Load Light', 'Initialization'); Light := TLight.Create; + if Ini.LPT = 2 then begin + Light.Enable; + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Light', 1); + + // Theme + Log.BenchmarkStart(1); + Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Themes', 1); + + // Covers Cache + Log.BenchmarkStart(1); + Log.LogStatus('Creating Covers Cache', 'Initialization'); Covers := TCovers.Create; + Log.LogBenchmark('Loading Covers Cache Array', 1); + Log.BenchmarkStart(1); + + // Category Covers + Log.BenchmarkStart(1); + Log.LogStatus('Creating Category Covers Array', 'Initialization'); + CatCovers:= TCatCovers.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Category Covers Array', 1); + + // Songs + //Log.BenchmarkStart(1); + Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; + Songs.LoadSongList; + Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Songs', 1); + + // PluginManager + Log.BenchmarkStart(1); + Log.LogStatus('PluginManager', 'Initialization'); + DLLMan := TDLLMan.Create; //Load PluginList + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PluginManager', 1); + + // Party Mode Manager + Log.BenchmarkStart(1); + Log.LogStatus('PartySession Manager', 'Initialization'); + PartySession := TParty_Session.Create; //Load PartySession + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PartySession Manager', 1); + + // Graphics + Log.BenchmarkStart(1); + Log.LogStatus('Initialize 3D', 'Initialization'); Initialize3D(WndTitle); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing 3D', 1); + + // Sound + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Sound', 'Initialization'); + Log.LogStatus('Creating Music', 'InitializeSound'); Music := TMusic.Create; + InitializeSound; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Sound', 1); + + // Score Saving System + Log.BenchmarkStart(1); + Log.LogStatus('DataBase System', 'Initialization'); + DataBase := TDataBaseSystem.Create; + + if (Params.ScoreFile = '') then + DataBase.Init ('Ultrastar.db') + else + DataBase.Init (Params.ScoreFile); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading DataBase System', 1); + + //Playlist Manager + Log.BenchmarkStart(1); + Log.LogStatus('Playlist Manager', 'Initialization'); + PlaylistMan := TPlaylistManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Playlist Manager', 1); + + //GoldenStarsTwinkleMod + Log.BenchmarkStart(1); + Log.LogStatus('Effect Manager', 'Initialization'); + GoldenRec := TEffectManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Particel System', 1); + + // Joypad + if (Ini.Joypad = 1) OR (Params.Joypad) then begin + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Joystick', 'Initialization'); Joy := TJoy.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Joystick', 1); + end; + + Log.BenchmarkEnd(0); + Log.LogBenchmark('Loading Time', 0); + + + //------------------------------ + //Start- Mainloop + //------------------------------ + //Music.SetLoop(true); + //Music.SetVolume(50); + //Music.Open(SkinPath + 'Menu Music 3.mp3'); + //Music.Play; + Log.LogStatus('Main Loop', 'Initialization'); MainLoop; + + //------------------------------ + //Finish Application + //------------------------------ + if Ini.LPT = 1 then LCD.Clear; + if Ini.LPT = 2 then Light.TurnOff; + + Log.Free; +end. diff --git a/Game/Code/lib/requirements.txt b/Game/Code/lib/requirements.txt index 8eafe2d2..30f84f39 100644 --- a/Game/Code/lib/requirements.txt +++ b/Game/Code/lib/requirements.txt @@ -2,7 +2,9 @@ Not Included in SVN ( to many potential updates ) --------------------------------------------------------------------------- Jedi-sdl - http://sourceforge.net/projects/jedi-sdl + http://sourceforge.net/projects/jedi-sdl + Make sure to download VERSION 1, beta... + not version 0.5 Included in SVN .. @@ -21,4 +23,4 @@ ffmpeg http://www.iversenit.dk/dev/ffmpeg-headers/ SQLLite Wrapper - http://www.itwriting.com/sqlitesimple.php \ No newline at end of file + http://www.itwriting.com/sqlitesimple.php -- cgit v1.2.3 From 77ac0ce6d082dfc0bfd2c9a7efaa304aadfe3683 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 19 Sep 2007 23:40:11 +0000 Subject: tested sqlite3 in lazarus - linux.. working :) updated requirements text with instructions on how to get dev libraries for linux build. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@407 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/SQLite/SQLiteTable3.pas | 1535 +++++++++++++++++---------------- Game/Code/lib/SQLite/lazarustest.lpi | 271 +++--- Game/Code/lib/SQLite/lazarustest.lpr | 160 ++-- Game/Code/lib/requirements.txt | 13 + 4 files changed, 993 insertions(+), 986 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/lib/SQLite/SQLiteTable3.pas b/Game/Code/lib/SQLite/SQLiteTable3.pas index e09cc7a0..05fbd573 100644 --- a/Game/Code/lib/SQLite/SQLiteTable3.pas +++ b/Game/Code/lib/SQLite/SQLiteTable3.pas @@ -1,765 +1,770 @@ -unit SQLiteTable3; - -{ - Simple classes for using SQLite's exec and get_table. - - TSQLiteDatabase wraps the calls to open and close an SQLite database. - It also wraps SQLite_exec for queries that do not return a result set - - TSQLiteTable wraps sqlite_get_table. - It allows accessing fields by name as well as index and can step through a - result set with the Next procedure. - - Adapted by Tim Anderson (tim@itwriting.com) - Originally created by Pablo Pissanetzky (pablo@myhtpc.net) - Modified and enhanced by Lukas Gebauer -} - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -uses - Windows, SQLite3, Classes, SysUtils; - -const - - dtInt = 1; - dtNumeric = 2; - dtStr = 3; - dtBlob = 4; - dtNull = 5; - -type - - ESQLiteException = class(Exception) - end; - - TSQLiteTable = class; - - TSQLiteDatabase = class - private - fDB: TSQLiteDB; - fInTrans: boolean; - procedure RaiseError(s: string; SQL: string); - public - constructor Create(const FileName: string); - destructor Destroy; override; - function GetTable(const SQL: string): TSQLiteTable; - procedure ExecSQL(const SQL: string); - function GetTableValue(const SQL: string): int64; - function GetTableString(const SQL: string): string; - procedure UpdateBlob(const SQL: string; BlobData: TStream); - procedure BeginTransaction; - procedure Commit; - procedure Rollback; - function TableExists(TableName: string): boolean; - function GetLastInsertRowID: int64; - procedure SetTimeout(Value: integer); - function version: string; - published - property isTransactionOpen: boolean read fInTrans; - end; - - TSQLiteTable = class - private - fResults: TList; - fRowCount: cardinal; - fColCount: cardinal; - fCols: TStringList; - fColTypes: TList; - fRow: cardinal; - function GetFields(I: cardinal): string; - function GetEOF: boolean; - function GetBOF: boolean; - function GetColumns(I: integer): string; - function GetFieldByName(FieldName: string): string; - function GetFieldIndex(FieldName: string): integer; - function GetCount: integer; - function GetCountResult: integer; - public - constructor Create(DB: TSQLiteDatabase; const SQL: string); - destructor Destroy; override; - function FieldAsInteger(I: cardinal): int64; - function FieldAsBlob(I: cardinal): TMemoryStream; - function FieldAsBlobText(I: cardinal): string; - function FieldIsNull(I: cardinal): boolean; - function FieldAsString(I: cardinal): string; - function FieldAsDouble(I: cardinal): double; - function Next: boolean; - function Previous: boolean; - property EOF: boolean read GetEOF; - property BOF: boolean read GetBOF; - property Fields[I: cardinal]: string read GetFields; - property FieldByName[FieldName: string]: string read GetFieldByName; - property FieldIndex[FieldName: string]: integer read GetFieldIndex; - property Columns[I: integer]: string read GetColumns; - property ColCount: cardinal read fColCount; - property RowCount: cardinal read fRowCount; - property Row: cardinal read fRow; - function MoveFirst: boolean; - function MoveLast: boolean; - property Count: integer read GetCount; - // The property CountResult is used when you execute count(*) queries. - // It returns 0 if the result set is empty or the value of the - // first field as an integer. - property CountResult: integer read GetCountResult; - end; - -procedure DisposePointer(ptr: pointer); cdecl; - - -implementation - -procedure DisposePointer(ptr: pointer); cdecl; -begin - if assigned(ptr) then - freemem(ptr); -end; - -//------------------------------------------------------------------------------ -// TSQLiteDatabase -//------------------------------------------------------------------------------ - -constructor TSQLiteDatabase.Create(const FileName: string); -var - Msg: pchar; - iResult: integer; -begin - inherited Create; - - self.fInTrans := False; - - Msg := nil; - try - iResult := SQLite3_Open(PChar(FileName), Fdb); - - if iResult <> SQLITE_OK then - if Assigned(Fdb) then - begin - Msg := Sqlite3_ErrMsg(Fdb); - raise ESqliteException.CreateFmt('Failed to open database "%s" : %s', - [FileName, Msg]); - end - else - raise ESqliteException.CreateFmt('Failed to open database "%s" : unknown error', - [FileName]); - - //set a few configs - self.ExecSQL('PRAGMA SYNCHRONOUS=NORMAL;'); -// self.ExecSQL('PRAGMA full_column_names = 1;'); - self.ExecSQL('PRAGMA temp_store = MEMORY;'); - - finally - if Assigned(Msg) then - SQLite3_Free(Msg); - end; - -end; - - -//.............................................................................. - -destructor TSQLiteDatabase.Destroy; -begin - - if self.fInTrans then - self.ExecSQL('ROLLBACK;'); //assume rollback - - if Assigned(fDB) then - SQLite3_Close(fDB); - - inherited; -end; - -function TSQLiteDatabase.GetLastInsertRowID: int64; -begin - Result := Sqlite3_LastInsertRowID(self.fDB); -end; - -//.............................................................................. - -procedure TSQLiteDatabase.RaiseError(s: string; SQL: string); -//look up last error and raise an exception with an appropriate message -var - Msg: PChar; -begin - - Msg := nil; - - if sqlite3_errcode(self.fDB) <> SQLITE_OK then - Msg := sqlite3_errmsg(self.fDB); - - if Msg <> nil then - raise ESqliteException.CreateFmt(s + ' "%s" : %s', [SQL, Msg]) - else - raise ESqliteException.CreateFmt(s, [SQL, 'No message']); - -end; - -procedure TSQLiteDatabase.ExecSQL(const SQL: string); -var - Stmt: TSQLiteStmt; - NextSQLStatement: Pchar; - iStepResult: integer; -begin - try - - if Sqlite3_Prepare(self.fDB, PChar(SQL), -1, Stmt, NextSQLStatement) <> - SQLITE_OK then - RaiseError('Error executing SQL', SQL); - - if (Stmt = nil) then - RaiseError('Could not prepare SQL statement', SQL); - - iStepResult := Sqlite3_step(Stmt); - - if (iStepResult <> SQLITE_DONE) then - RaiseError('Error executing SQL statement', SQL); - - finally - - if Assigned(Stmt) then - Sqlite3_Finalize(stmt); - - end; -end; - -procedure TSQLiteDatabase.UpdateBlob(const SQL: string; BlobData: TStream); -var - iSize: integer; - ptr: pointer; - Stmt: TSQLiteStmt; - Msg: Pchar; - NextSQLStatement: Pchar; - iStepResult: integer; - iBindResult: integer; -begin - //expects SQL of the form 'UPDATE MYTABLE SET MYFIELD = ? WHERE MYKEY = 1' - - if pos('?', SQL) = 0 then - RaiseError('SQL must include a ? parameter', SQL); - - Msg := nil; - try - - if Sqlite3_Prepare(self.fDB, PChar(SQL), -1, Stmt, NextSQLStatement) <> - SQLITE_OK then - RaiseError('Could not prepare SQL statement', SQL); - - if (Stmt = nil) then - RaiseError('Could not prepare SQL statement', SQL); - - //now bind the blob data - iSize := BlobData.size; - - GetMem(ptr, iSize); - - if (ptr = nil) then - raise ESqliteException.CreateFmt('Error getting memory to save blob', - [SQL, 'Error']); - - BlobData.position := 0; - BlobData.Read(ptr^, iSize); - - iBindResult := SQLite3_BindBlob(stmt, 1, ptr, iSize, @DisposePointer); - - if iBindResult <> SQLITE_OK then - RaiseError('Error binding blob to database', SQL); - - iStepResult := Sqlite3_step(Stmt); - - if (iStepResult <> SQLITE_DONE) then - RaiseError('Error executing SQL statement', SQL); - - finally - - if Assigned(Stmt) then - Sqlite3_Finalize(stmt); - - if Assigned(Msg) then - SQLite3_Free(Msg); - end; - -end; - -//.............................................................................. - -function TSQLiteDatabase.GetTable(const SQL: string): TSQLiteTable; -begin - Result := TSQLiteTable.Create(Self, SQL); -end; - -function TSQLiteDatabase.GetTableValue(const SQL: string): int64; -var - Table: TSQLiteTable; -begin - Table := self.GetTable(SQL); - try - Result := Table.FieldAsInteger(0); - finally - Table.Free; - end; -end; - -function TSQLiteDatabase.GetTableString(const SQL: string): string; -var - Table: TSQLiteTable; -begin - Table := self.GetTable(SQL); - try - Result := Table.FieldAsString(0); - finally - Table.Free; - end; -end; - - -procedure TSQLiteDatabase.BeginTransaction; -begin - if not self.fInTrans then - begin - self.ExecSQL('BEGIN TRANSACTION;'); - self.fInTrans := True; - end - else - raise ESqliteException.Create('Transaction already open'); -end; - -procedure TSQLiteDatabase.Commit; -begin - self.ExecSQL('COMMIT;'); - self.fInTrans := False; -end; - -procedure TSQLiteDatabase.Rollback; -begin - self.ExecSQL('ROLLBACK;'); - self.fInTrans := False; -end; - -function TSQLiteDatabase.TableExists(TableName: string): boolean; -var - sql: string; - ds: TSqliteTable; -begin - //returns true if table exists in the database - sql := 'select [sql] from sqlite_master where [type] = ''table'' and lower(name) = ''' + - lowercase(TableName) + ''' '; - ds := self.GetTable(sql); - try - Result := (ds.Count > 0); - finally - ds.Free; - end; -end; - -procedure TSQLiteDatabase.SetTimeout(Value: integer); -begin - SQLite3_BusyTimeout(self.fDB, Value); -end; - -function TSQLiteDatabase.version: string; -begin - Result := SQLite3_Version; -end; - - -//------------------------------------------------------------------------------ -// TSQLiteTable -//------------------------------------------------------------------------------ - -constructor TSQLiteTable.Create(DB: TSQLiteDatabase; const SQL: string); -var - Stmt: TSQLiteStmt; - NextSQLStatement: Pchar; - iStepResult: integer; - ptr: pointer; - iNumBytes: integer; - thisBlobValue: TMemoryStream; - thisStringValue: pstring; - thisDoubleValue: pDouble; - thisIntValue: pInt64; - thisColType: pInteger; - i: integer; - DeclaredColType: Pchar; - ActualColType: integer; - ptrValue: Pchar; -begin - try - self.fRowCount := 0; - self.fColCount := 0; - //if there are several SQL statements in SQL, NextSQLStatment points to the - //beginning of the next one. Prepare only prepares the first SQL statement. - if Sqlite3_Prepare(DB.fDB, PChar(SQL), -1, Stmt, NextSQLStatement) <> SQLITE_OK then - DB.RaiseError('Error executing SQL', SQL); - if (Stmt = nil) then - DB.RaiseError('Could not prepare SQL statement', SQL); - iStepResult := Sqlite3_step(Stmt); - while (iStepResult <> SQLITE_DONE) do - begin - case iStepResult of - SQLITE_ROW: - begin - Inc(fRowCount); - if (fRowCount = 1) then - begin - //get data types - fCols := TStringList.Create; - fColTypes := TList.Create; - fColCount := SQLite3_ColumnCount(stmt); - for i := 0 to Pred(fColCount) do - fCols.Add(AnsiUpperCase(Sqlite3_ColumnName(stmt, i))); - for i := 0 to Pred(fColCount) do - begin - new(thisColType); - DeclaredColType := Sqlite3_ColumnDeclType(stmt, i); - if DeclaredColType = nil then - thisColType^ := Sqlite3_ColumnType(stmt, i) //use the actual column type instead - //seems to be needed for last_insert_rowid - else - if (DeclaredColType = 'INTEGER') or (DeclaredColType = 'BOOLEAN') then - thisColType^ := dtInt - else - if (DeclaredColType = 'NUMERIC') or - (DeclaredColType = 'FLOAT') or - (DeclaredColType = 'DOUBLE') or - (DeclaredColType = 'REAL') then - thisColType^ := dtNumeric - else - if DeclaredColType = 'BLOB' then - thisColType^ := dtBlob - else - thisColType^ := dtStr; - fColTypes.Add(thiscoltype); - end; - fResults := TList.Create; - end; - - //get column values - for i := 0 to Pred(ColCount) do - begin - ActualColType := Sqlite3_ColumnType(stmt, i); - if (ActualColType = SQLITE_NULL) then - fResults.Add(nil) - else - if pInteger(fColTypes[i])^ = dtInt then - begin - new(thisintvalue); - thisintvalue^ := Sqlite3_ColumnInt64(stmt, i); - fResults.Add(thisintvalue); - end - else - if pInteger(fColTypes[i])^ = dtNumeric then - begin - new(thisdoublevalue); - thisdoublevalue^ := Sqlite3_ColumnDouble(stmt, i); - fResults.Add(thisdoublevalue); - end - else - if pInteger(fColTypes[i])^ = dtBlob then - begin - iNumBytes := Sqlite3_ColumnBytes(stmt, i); - if iNumBytes = 0 then - thisblobvalue := nil - else - begin - thisblobvalue := TMemoryStream.Create; - thisblobvalue.position := 0; - ptr := Sqlite3_ColumnBlob(stmt, i); - thisblobvalue.writebuffer(ptr^, iNumBytes); - end; - fResults.Add(thisblobvalue); - end - else - begin - new(thisstringvalue); - ptrValue := Sqlite3_ColumnText(stmt, i); - setstring(thisstringvalue^, ptrvalue, strlen(ptrvalue)); - fResults.Add(thisstringvalue); - end; - end; - end; - SQLITE_BUSY: - raise ESqliteException.CreateFmt('Could not prepare SQL statement', - [SQL, 'SQLite is Busy']); - else - DB.RaiseError('Could not retrieve data', SQL); - end; - iStepResult := Sqlite3_step(Stmt); - end; - fRow := 0; - finally - if Assigned(Stmt) then - Sqlite3_Finalize(stmt); - end; -end; - -//.............................................................................. - -destructor TSQLiteTable.Destroy; -var - i: cardinal; - iColNo: integer; -begin - if Assigned(fResults) then - begin - for i := 0 to fResults.Count - 1 do - begin - //check for blob type - iColNo := (i mod fColCount); - case pInteger(self.fColTypes[iColNo])^ of - dtBlob: - TMemoryStream(fResults[i]).Free; - dtStr: - if fResults[i] <> nil then - begin - setstring(string(fResults[i]^), nil, 0); - dispose(fResults[i]); - end; - else - dispose(fResults[i]); - end; - end; - fResults.Free; - end; - if Assigned(fCols) then - fCols.Free; - if Assigned(fColTypes) then - for i := 0 to fColTypes.Count - 1 do - dispose(fColTypes[i]); - fColTypes.Free; - inherited; -end; - -//.............................................................................. - -function TSQLiteTable.GetColumns(I: integer): string; -begin - Result := fCols[I]; -end; - -//.............................................................................. - -function TSQLiteTable.GetCountResult: integer; -begin - if not EOF then - Result := StrToInt(Fields[0]) - else - Result := 0; -end; - -function TSQLiteTable.GetCount: integer; -begin - Result := FRowCount; -end; - -//.............................................................................. - -function TSQLiteTable.GetEOF: boolean; -begin - Result := fRow >= fRowCount; -end; - -function TSQLiteTable.GetBOF: boolean; -begin - Result := fRow <= 0; -end; - -//.............................................................................. - -function TSQLiteTable.GetFieldByName(FieldName: string): string; -begin - Result := GetFields(self.GetFieldIndex(FieldName)); -end; - -function TSQLiteTable.GetFieldIndex(FieldName: string): integer; -begin - - if (fCols = nil) then - begin - raise ESqliteException.Create('Field ' + fieldname + ' Not found. Empty dataset'); - exit; - end; - - if (fCols.count = 0) then - begin - raise ESqliteException.Create('Field ' + fieldname + ' Not found. Empty dataset'); - exit; - end; - - Result := fCols.IndexOf(AnsiUpperCase(FieldName)); - - if (result < 0) then - begin raise ESqliteException.Create('Field not found in dataset: ' + fieldname) end; - -end; - -//.............................................................................. - -function TSQLiteTable.GetFields(I: cardinal): string; -var - thisvalue: pstring; - thistype: integer; -begin - Result := ''; - if EOF then - raise ESqliteException.Create('Table is at End of File'); - //integer types are not stored in the resultset - //as strings, so they should be retrieved using the type-specific - //methods - thistype := pInteger(self.fColTypes[I])^; - - case thistype of - dtStr: - begin - thisvalue := self.fResults[(self.frow * self.fColCount) + I]; - if (thisvalue <> nil) then - Result := thisvalue^ - else - Result := ''; - end; - dtInt: - Result := IntToStr(self.FieldAsInteger(I)); - dtNumeric: - Result := FloatToStr(self.FieldAsDouble(I)); - dtBlob: - Result := self.FieldAsBlobText(I); - else - Result := ''; - end; -end; - -function TSqliteTable.FieldAsBlob(I: cardinal): TMemoryStream; -begin - if EOF then - raise ESqliteException.Create('Table is at End of File'); - if (self.fResults[(self.frow * self.fColCount) + I] = nil) then - Result := nil - else - if pInteger(self.fColTypes[I])^ = dtBlob then - Result := TMemoryStream(self.fResults[(self.frow * self.fColCount) + I]) - else - raise ESqliteException.Create('Not a Blob field'); -end; - -function TSqliteTable.FieldAsBlobText(I: cardinal): string; -var - MemStream: TMemoryStream; - Buffer: PChar; -begin - Result := ''; - MemStream := self.FieldAsBlob(I); - if MemStream <> nil then - if MemStream.Size > 0 then - begin - MemStream.position := 0; - Buffer := stralloc(MemStream.Size + 1); - MemStream.readbuffer(Buffer[0], MemStream.Size); - (Buffer + MemStream.Size)^ := chr(0); - SetString(Result, Buffer, MemStream.size); - strdispose(Buffer); - end; -end; - - -function TSqliteTable.FieldAsInteger(I: cardinal): int64; -begin - if EOF then - //raise ESqliteException.Create('Table is at End of File'); - Result := 0 - else if (self.fResults[(self.frow * self.fColCount) + I] = nil) then - Result := 0 - else - if pInteger(self.fColTypes[I])^ = dtInt then - Result := pInt64(self.fResults[(self.frow * self.fColCount) + I])^ - else - if pInteger(self.fColTypes[I])^ = dtNumeric then - Result := trunc(strtofloat(pString(self.fResults[(self.frow * self.fColCount) + I])^)) - else - raise ESqliteException.Create('Not an integer or numeric field'); -end; - -function TSqliteTable.FieldAsDouble(I: cardinal): double; -begin - if EOF then - raise ESqliteException.Create('Table is at End of File'); - if (self.fResults[(self.frow * self.fColCount) + I] = nil) then - Result := 0 - else - if pInteger(self.fColTypes[I])^ = dtInt then - Result := pInt64(self.fResults[(self.frow * self.fColCount) + I])^ - else - if pInteger(self.fColTypes[I])^ = dtNumeric then - Result := pDouble(self.fResults[(self.frow * self.fColCount) + I])^ - else - raise ESqliteException.Create('Not an integer or numeric field'); -end; - -function TSqliteTable.FieldAsString(I: cardinal): string; -begin - if EOF then - raise ESqliteException.Create('Table is at End of File'); - if (self.fResults[(self.frow * self.fColCount) + I] = nil) then - Result := '' - else - Result := self.GetFields(I); -end; - -function TSqliteTable.FieldIsNull(I: cardinal): boolean; -var - thisvalue: pointer; -begin - if EOF then - raise ESqliteException.Create('Table is at End of File'); - thisvalue := self.fResults[(self.frow * self.fColCount) + I]; - Result := (thisvalue = nil); -end; - -//.............................................................................. - -function TSQLiteTable.Next: boolean; -begin - Result := False; - if not EOF then - begin - Inc(fRow); - Result := True; - end; -end; - -function TSQLiteTable.Previous: boolean; -begin - Result := False; - if not BOF then - begin - Dec(fRow); - Result := True; - end; -end; - -function TSQLiteTable.MoveFirst: boolean; -begin - Result := False; - if self.fRowCount > 0 then - begin - fRow := 0; - Result := True; - end; -end; - -function TSQLiteTable.MoveLast: boolean; -begin - Result := False; - if self.fRowCount > 0 then - begin - fRow := fRowCount - 1; - Result := True; - end; -end; - - -end. - +unit SQLiteTable3; + +{ + Simple classes for using SQLite's exec and get_table. + + TSQLiteDatabase wraps the calls to open and close an SQLite database. + It also wraps SQLite_exec for queries that do not return a result set + + TSQLiteTable wraps sqlite_get_table. + It allows accessing fields by name as well as index and can step through a + result set with the Next procedure. + + Adapted by Tim Anderson (tim@itwriting.com) + Originally created by Pablo Pissanetzky (pablo@myhtpc.net) + Modified and enhanced by Lukas Gebauer +} + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses + {$ifdef win32} + Windows, + {$endif} + SQLite3, + Classes, + SysUtils; + +const + + dtInt = 1; + dtNumeric = 2; + dtStr = 3; + dtBlob = 4; + dtNull = 5; + +type + + ESQLiteException = class(Exception) + end; + + TSQLiteTable = class; + + TSQLiteDatabase = class + private + fDB: TSQLiteDB; + fInTrans: boolean; + procedure RaiseError(s: string; SQL: string); + public + constructor Create(const FileName: string); + destructor Destroy; override; + function GetTable(const SQL: string): TSQLiteTable; + procedure ExecSQL(const SQL: string); + function GetTableValue(const SQL: string): int64; + function GetTableString(const SQL: string): string; + procedure UpdateBlob(const SQL: string; BlobData: TStream); + procedure BeginTransaction; + procedure Commit; + procedure Rollback; + function TableExists(TableName: string): boolean; + function GetLastInsertRowID: int64; + procedure SetTimeout(Value: integer); + function version: string; + published + property isTransactionOpen: boolean read fInTrans; + end; + + TSQLiteTable = class + private + fResults: TList; + fRowCount: cardinal; + fColCount: cardinal; + fCols: TStringList; + fColTypes: TList; + fRow: cardinal; + function GetFields(I: cardinal): string; + function GetEOF: boolean; + function GetBOF: boolean; + function GetColumns(I: integer): string; + function GetFieldByName(FieldName: string): string; + function GetFieldIndex(FieldName: string): integer; + function GetCount: integer; + function GetCountResult: integer; + public + constructor Create(DB: TSQLiteDatabase; const SQL: string); + destructor Destroy; override; + function FieldAsInteger(I: cardinal): int64; + function FieldAsBlob(I: cardinal): TMemoryStream; + function FieldAsBlobText(I: cardinal): string; + function FieldIsNull(I: cardinal): boolean; + function FieldAsString(I: cardinal): string; + function FieldAsDouble(I: cardinal): double; + function Next: boolean; + function Previous: boolean; + property EOF: boolean read GetEOF; + property BOF: boolean read GetBOF; + property Fields[I: cardinal]: string read GetFields; + property FieldByName[FieldName: string]: string read GetFieldByName; + property FieldIndex[FieldName: string]: integer read GetFieldIndex; + property Columns[I: integer]: string read GetColumns; + property ColCount: cardinal read fColCount; + property RowCount: cardinal read fRowCount; + property Row: cardinal read fRow; + function MoveFirst: boolean; + function MoveLast: boolean; + property Count: integer read GetCount; + // The property CountResult is used when you execute count(*) queries. + // It returns 0 if the result set is empty or the value of the + // first field as an integer. + property CountResult: integer read GetCountResult; + end; + +procedure DisposePointer(ptr: pointer); cdecl; + + +implementation + +procedure DisposePointer(ptr: pointer); cdecl; +begin + if assigned(ptr) then + freemem(ptr); +end; + +//------------------------------------------------------------------------------ +// TSQLiteDatabase +//------------------------------------------------------------------------------ + +constructor TSQLiteDatabase.Create(const FileName: string); +var + Msg: pchar; + iResult: integer; +begin + inherited Create; + + self.fInTrans := False; + + Msg := nil; + try + iResult := SQLite3_Open(PChar(FileName), Fdb); + + if iResult <> SQLITE_OK then + if Assigned(Fdb) then + begin + Msg := Sqlite3_ErrMsg(Fdb); + raise ESqliteException.CreateFmt('Failed to open database "%s" : %s', + [FileName, Msg]); + end + else + raise ESqliteException.CreateFmt('Failed to open database "%s" : unknown error', + [FileName]); + + //set a few configs + self.ExecSQL('PRAGMA SYNCHRONOUS=NORMAL;'); +// self.ExecSQL('PRAGMA full_column_names = 1;'); + self.ExecSQL('PRAGMA temp_store = MEMORY;'); + + finally + if Assigned(Msg) then + SQLite3_Free(Msg); + end; + +end; + + +//.............................................................................. + +destructor TSQLiteDatabase.Destroy; +begin + + if self.fInTrans then + self.ExecSQL('ROLLBACK;'); //assume rollback + + if Assigned(fDB) then + SQLite3_Close(fDB); + + inherited; +end; + +function TSQLiteDatabase.GetLastInsertRowID: int64; +begin + Result := Sqlite3_LastInsertRowID(self.fDB); +end; + +//.............................................................................. + +procedure TSQLiteDatabase.RaiseError(s: string; SQL: string); +//look up last error and raise an exception with an appropriate message +var + Msg: PChar; +begin + + Msg := nil; + + if sqlite3_errcode(self.fDB) <> SQLITE_OK then + Msg := sqlite3_errmsg(self.fDB); + + if Msg <> nil then + raise ESqliteException.CreateFmt(s + ' "%s" : %s', [SQL, Msg]) + else + raise ESqliteException.CreateFmt(s, [SQL, 'No message']); + +end; + +procedure TSQLiteDatabase.ExecSQL(const SQL: string); +var + Stmt: TSQLiteStmt; + NextSQLStatement: Pchar; + iStepResult: integer; +begin + try + + if Sqlite3_Prepare(self.fDB, PChar(SQL), -1, Stmt, NextSQLStatement) <> + SQLITE_OK then + RaiseError('Error executing SQL', SQL); + + if (Stmt = nil) then + RaiseError('Could not prepare SQL statement', SQL); + + iStepResult := Sqlite3_step(Stmt); + + if (iStepResult <> SQLITE_DONE) then + RaiseError('Error executing SQL statement', SQL); + + finally + + if Assigned(Stmt) then + Sqlite3_Finalize(stmt); + + end; +end; + +procedure TSQLiteDatabase.UpdateBlob(const SQL: string; BlobData: TStream); +var + iSize: integer; + ptr: pointer; + Stmt: TSQLiteStmt; + Msg: Pchar; + NextSQLStatement: Pchar; + iStepResult: integer; + iBindResult: integer; +begin + //expects SQL of the form 'UPDATE MYTABLE SET MYFIELD = ? WHERE MYKEY = 1' + + if pos('?', SQL) = 0 then + RaiseError('SQL must include a ? parameter', SQL); + + Msg := nil; + try + + if Sqlite3_Prepare(self.fDB, PChar(SQL), -1, Stmt, NextSQLStatement) <> + SQLITE_OK then + RaiseError('Could not prepare SQL statement', SQL); + + if (Stmt = nil) then + RaiseError('Could not prepare SQL statement', SQL); + + //now bind the blob data + iSize := BlobData.size; + + GetMem(ptr, iSize); + + if (ptr = nil) then + raise ESqliteException.CreateFmt('Error getting memory to save blob', + [SQL, 'Error']); + + BlobData.position := 0; + BlobData.Read(ptr^, iSize); + + iBindResult := SQLite3_BindBlob(stmt, 1, ptr, iSize, @DisposePointer); + + if iBindResult <> SQLITE_OK then + RaiseError('Error binding blob to database', SQL); + + iStepResult := Sqlite3_step(Stmt); + + if (iStepResult <> SQLITE_DONE) then + RaiseError('Error executing SQL statement', SQL); + + finally + + if Assigned(Stmt) then + Sqlite3_Finalize(stmt); + + if Assigned(Msg) then + SQLite3_Free(Msg); + end; + +end; + +//.............................................................................. + +function TSQLiteDatabase.GetTable(const SQL: string): TSQLiteTable; +begin + Result := TSQLiteTable.Create(Self, SQL); +end; + +function TSQLiteDatabase.GetTableValue(const SQL: string): int64; +var + Table: TSQLiteTable; +begin + Table := self.GetTable(SQL); + try + Result := Table.FieldAsInteger(0); + finally + Table.Free; + end; +end; + +function TSQLiteDatabase.GetTableString(const SQL: string): string; +var + Table: TSQLiteTable; +begin + Table := self.GetTable(SQL); + try + Result := Table.FieldAsString(0); + finally + Table.Free; + end; +end; + + +procedure TSQLiteDatabase.BeginTransaction; +begin + if not self.fInTrans then + begin + self.ExecSQL('BEGIN TRANSACTION;'); + self.fInTrans := True; + end + else + raise ESqliteException.Create('Transaction already open'); +end; + +procedure TSQLiteDatabase.Commit; +begin + self.ExecSQL('COMMIT;'); + self.fInTrans := False; +end; + +procedure TSQLiteDatabase.Rollback; +begin + self.ExecSQL('ROLLBACK;'); + self.fInTrans := False; +end; + +function TSQLiteDatabase.TableExists(TableName: string): boolean; +var + sql: string; + ds: TSqliteTable; +begin + //returns true if table exists in the database + sql := 'select [sql] from sqlite_master where [type] = ''table'' and lower(name) = ''' + + lowercase(TableName) + ''' '; + ds := self.GetTable(sql); + try + Result := (ds.Count > 0); + finally + ds.Free; + end; +end; + +procedure TSQLiteDatabase.SetTimeout(Value: integer); +begin + SQLite3_BusyTimeout(self.fDB, Value); +end; + +function TSQLiteDatabase.version: string; +begin + Result := SQLite3_Version; +end; + + +//------------------------------------------------------------------------------ +// TSQLiteTable +//------------------------------------------------------------------------------ + +constructor TSQLiteTable.Create(DB: TSQLiteDatabase; const SQL: string); +var + Stmt: TSQLiteStmt; + NextSQLStatement: Pchar; + iStepResult: integer; + ptr: pointer; + iNumBytes: integer; + thisBlobValue: TMemoryStream; + thisStringValue: pstring; + thisDoubleValue: pDouble; + thisIntValue: pInt64; + thisColType: pInteger; + i: integer; + DeclaredColType: Pchar; + ActualColType: integer; + ptrValue: Pchar; +begin + try + self.fRowCount := 0; + self.fColCount := 0; + //if there are several SQL statements in SQL, NextSQLStatment points to the + //beginning of the next one. Prepare only prepares the first SQL statement. + if Sqlite3_Prepare(DB.fDB, PChar(SQL), -1, Stmt, NextSQLStatement) <> SQLITE_OK then + DB.RaiseError('Error executing SQL', SQL); + if (Stmt = nil) then + DB.RaiseError('Could not prepare SQL statement', SQL); + iStepResult := Sqlite3_step(Stmt); + while (iStepResult <> SQLITE_DONE) do + begin + case iStepResult of + SQLITE_ROW: + begin + Inc(fRowCount); + if (fRowCount = 1) then + begin + //get data types + fCols := TStringList.Create; + fColTypes := TList.Create; + fColCount := SQLite3_ColumnCount(stmt); + for i := 0 to Pred(fColCount) do + fCols.Add(AnsiUpperCase(Sqlite3_ColumnName(stmt, i))); + for i := 0 to Pred(fColCount) do + begin + new(thisColType); + DeclaredColType := Sqlite3_ColumnDeclType(stmt, i); + if DeclaredColType = nil then + thisColType^ := Sqlite3_ColumnType(stmt, i) //use the actual column type instead + //seems to be needed for last_insert_rowid + else + if (DeclaredColType = 'INTEGER') or (DeclaredColType = 'BOOLEAN') then + thisColType^ := dtInt + else + if (DeclaredColType = 'NUMERIC') or + (DeclaredColType = 'FLOAT') or + (DeclaredColType = 'DOUBLE') or + (DeclaredColType = 'REAL') then + thisColType^ := dtNumeric + else + if DeclaredColType = 'BLOB' then + thisColType^ := dtBlob + else + thisColType^ := dtStr; + fColTypes.Add(thiscoltype); + end; + fResults := TList.Create; + end; + + //get column values + for i := 0 to Pred(ColCount) do + begin + ActualColType := Sqlite3_ColumnType(stmt, i); + if (ActualColType = SQLITE_NULL) then + fResults.Add(nil) + else + if pInteger(fColTypes[i])^ = dtInt then + begin + new(thisintvalue); + thisintvalue^ := Sqlite3_ColumnInt64(stmt, i); + fResults.Add(thisintvalue); + end + else + if pInteger(fColTypes[i])^ = dtNumeric then + begin + new(thisdoublevalue); + thisdoublevalue^ := Sqlite3_ColumnDouble(stmt, i); + fResults.Add(thisdoublevalue); + end + else + if pInteger(fColTypes[i])^ = dtBlob then + begin + iNumBytes := Sqlite3_ColumnBytes(stmt, i); + if iNumBytes = 0 then + thisblobvalue := nil + else + begin + thisblobvalue := TMemoryStream.Create; + thisblobvalue.position := 0; + ptr := Sqlite3_ColumnBlob(stmt, i); + thisblobvalue.writebuffer(ptr^, iNumBytes); + end; + fResults.Add(thisblobvalue); + end + else + begin + new(thisstringvalue); + ptrValue := Sqlite3_ColumnText(stmt, i); + setstring(thisstringvalue^, ptrvalue, strlen(ptrvalue)); + fResults.Add(thisstringvalue); + end; + end; + end; + SQLITE_BUSY: + raise ESqliteException.CreateFmt('Could not prepare SQL statement', + [SQL, 'SQLite is Busy']); + else + DB.RaiseError('Could not retrieve data', SQL); + end; + iStepResult := Sqlite3_step(Stmt); + end; + fRow := 0; + finally + if Assigned(Stmt) then + Sqlite3_Finalize(stmt); + end; +end; + +//.............................................................................. + +destructor TSQLiteTable.Destroy; +var + i: cardinal; + iColNo: integer; +begin + if Assigned(fResults) then + begin + for i := 0 to fResults.Count - 1 do + begin + //check for blob type + iColNo := (i mod fColCount); + case pInteger(self.fColTypes[iColNo])^ of + dtBlob: + TMemoryStream(fResults[i]).Free; + dtStr: + if fResults[i] <> nil then + begin + setstring(string(fResults[i]^), nil, 0); + dispose(fResults[i]); + end; + else + dispose(fResults[i]); + end; + end; + fResults.Free; + end; + if Assigned(fCols) then + fCols.Free; + if Assigned(fColTypes) then + for i := 0 to fColTypes.Count - 1 do + dispose(fColTypes[i]); + fColTypes.Free; + inherited; +end; + +//.............................................................................. + +function TSQLiteTable.GetColumns(I: integer): string; +begin + Result := fCols[I]; +end; + +//.............................................................................. + +function TSQLiteTable.GetCountResult: integer; +begin + if not EOF then + Result := StrToInt(Fields[0]) + else + Result := 0; +end; + +function TSQLiteTable.GetCount: integer; +begin + Result := FRowCount; +end; + +//.............................................................................. + +function TSQLiteTable.GetEOF: boolean; +begin + Result := fRow >= fRowCount; +end; + +function TSQLiteTable.GetBOF: boolean; +begin + Result := fRow <= 0; +end; + +//.............................................................................. + +function TSQLiteTable.GetFieldByName(FieldName: string): string; +begin + Result := GetFields(self.GetFieldIndex(FieldName)); +end; + +function TSQLiteTable.GetFieldIndex(FieldName: string): integer; +begin + + if (fCols = nil) then + begin + raise ESqliteException.Create('Field ' + fieldname + ' Not found. Empty dataset'); + exit; + end; + + if (fCols.count = 0) then + begin + raise ESqliteException.Create('Field ' + fieldname + ' Not found. Empty dataset'); + exit; + end; + + Result := fCols.IndexOf(AnsiUpperCase(FieldName)); + + if (result < 0) then + begin raise ESqliteException.Create('Field not found in dataset: ' + fieldname) end; + +end; + +//.............................................................................. + +function TSQLiteTable.GetFields(I: cardinal): string; +var + thisvalue: pstring; + thistype: integer; +begin + Result := ''; + if EOF then + raise ESqliteException.Create('Table is at End of File'); + //integer types are not stored in the resultset + //as strings, so they should be retrieved using the type-specific + //methods + thistype := pInteger(self.fColTypes[I])^; + + case thistype of + dtStr: + begin + thisvalue := self.fResults[(self.frow * self.fColCount) + I]; + if (thisvalue <> nil) then + Result := thisvalue^ + else + Result := ''; + end; + dtInt: + Result := IntToStr(self.FieldAsInteger(I)); + dtNumeric: + Result := FloatToStr(self.FieldAsDouble(I)); + dtBlob: + Result := self.FieldAsBlobText(I); + else + Result := ''; + end; +end; + +function TSqliteTable.FieldAsBlob(I: cardinal): TMemoryStream; +begin + if EOF then + raise ESqliteException.Create('Table is at End of File'); + if (self.fResults[(self.frow * self.fColCount) + I] = nil) then + Result := nil + else + if pInteger(self.fColTypes[I])^ = dtBlob then + Result := TMemoryStream(self.fResults[(self.frow * self.fColCount) + I]) + else + raise ESqliteException.Create('Not a Blob field'); +end; + +function TSqliteTable.FieldAsBlobText(I: cardinal): string; +var + MemStream: TMemoryStream; + Buffer: PChar; +begin + Result := ''; + MemStream := self.FieldAsBlob(I); + if MemStream <> nil then + if MemStream.Size > 0 then + begin + MemStream.position := 0; + Buffer := stralloc(MemStream.Size + 1); + MemStream.readbuffer(Buffer[0], MemStream.Size); + (Buffer + MemStream.Size)^ := chr(0); + SetString(Result, Buffer, MemStream.size); + strdispose(Buffer); + end; +end; + + +function TSqliteTable.FieldAsInteger(I: cardinal): int64; +begin + if EOF then + //raise ESqliteException.Create('Table is at End of File'); + Result := 0 + else if (self.fResults[(self.frow * self.fColCount) + I] = nil) then + Result := 0 + else + if pInteger(self.fColTypes[I])^ = dtInt then + Result := pInt64(self.fResults[(self.frow * self.fColCount) + I])^ + else + if pInteger(self.fColTypes[I])^ = dtNumeric then + Result := trunc(strtofloat(pString(self.fResults[(self.frow * self.fColCount) + I])^)) + else + raise ESqliteException.Create('Not an integer or numeric field'); +end; + +function TSqliteTable.FieldAsDouble(I: cardinal): double; +begin + if EOF then + raise ESqliteException.Create('Table is at End of File'); + if (self.fResults[(self.frow * self.fColCount) + I] = nil) then + Result := 0 + else + if pInteger(self.fColTypes[I])^ = dtInt then + Result := pInt64(self.fResults[(self.frow * self.fColCount) + I])^ + else + if pInteger(self.fColTypes[I])^ = dtNumeric then + Result := pDouble(self.fResults[(self.frow * self.fColCount) + I])^ + else + raise ESqliteException.Create('Not an integer or numeric field'); +end; + +function TSqliteTable.FieldAsString(I: cardinal): string; +begin + if EOF then + raise ESqliteException.Create('Table is at End of File'); + if (self.fResults[(self.frow * self.fColCount) + I] = nil) then + Result := '' + else + Result := self.GetFields(I); +end; + +function TSqliteTable.FieldIsNull(I: cardinal): boolean; +var + thisvalue: pointer; +begin + if EOF then + raise ESqliteException.Create('Table is at End of File'); + thisvalue := self.fResults[(self.frow * self.fColCount) + I]; + Result := (thisvalue = nil); +end; + +//.............................................................................. + +function TSQLiteTable.Next: boolean; +begin + Result := False; + if not EOF then + begin + Inc(fRow); + Result := True; + end; +end; + +function TSQLiteTable.Previous: boolean; +begin + Result := False; + if not BOF then + begin + Dec(fRow); + Result := True; + end; +end; + +function TSQLiteTable.MoveFirst: boolean; +begin + Result := False; + if self.fRowCount > 0 then + begin + fRow := 0; + Result := True; + end; +end; + +function TSQLiteTable.MoveLast: boolean; +begin + Result := False; + if self.fRowCount > 0 then + begin + fRow := fRowCount - 1; + Result := True; + end; +end; + + +end. + diff --git a/Game/Code/lib/SQLite/lazarustest.lpi b/Game/Code/lib/SQLite/lazarustest.lpi index 0da6fab4..8c758bc6 100644 --- a/Game/Code/lib/SQLite/lazarustest.lpi +++ b/Game/Code/lib/SQLite/lazarustest.lpi @@ -1,142 +1,129 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Game/Code/lib/SQLite/lazarustest.lpr b/Game/Code/lib/SQLite/lazarustest.lpr index 61b7c748..bc005bec 100644 --- a/Game/Code/lib/SQLite/lazarustest.lpr +++ b/Game/Code/lib/SQLite/lazarustest.lpr @@ -1,79 +1,81 @@ -program lazarustest; - -uses - SQLiteTable3 in 'SQLiteTable3.pas', - SQLite3 in 'SQLite3.pas', - sysutils; - - -procedure DoTest(); -var - slDBpath : string; - sldb : TSQLiteDatabase; - sltb : TSQLIteTable; - sSQL : String; - Notes : String; - -begin - slDBPath := ExtractFilepath( paramstr(0) ) + 'test.db'; - sldb := TSQLiteDatabase.Create(slDBPath); - - try - - if sldb.TableExists('testTable') then - begin - sSQL := 'DROP TABLE testtable'; - sldb.execsql(sSQL); - end; - - sSQL := 'CREATE TABLE testtable ([ID] INTEGER PRIMARY KEY,[OtherID] INTEGER NULL,'; - sSQL := sSQL + '[Name] VARCHAR (255),[Number] FLOAT, [notes] BLOB, [picture] BLOB COLLATE NOCASE);'; - sldb.execsql(sSQL); - - sldb.execsql('CREATE INDEX TestTableName ON [testtable]([Name]);'); - - //begin a transaction - sldb.BeginTransaction; - - sSQL := 'INSERT INTO testtable(Name,OtherID,Number,Notes) VALUES ("Some Name",4,587.6594,"Here are some notes");'; - //do the insert - sldb.ExecSQL(sSQL); - - sSQL := 'INSERT INTO testtable(Name,OtherID,Number,Notes) VALUES ("Another Name",12,4758.3265,"More notes");'; - //do the insert - sldb.ExecSQL(sSQL); - - //end the transaction - sldb.Commit; - - //query the data - sltb := slDb.GetTable('SELECT * FROM testtable'); - try - - if sltb.Count > 0 then - begin - //display first row - writeln( sltb.FieldAsString(sltb.FieldIndex['Name']) ); - writeln( inttostr(sltb.FieldAsInteger(sltb.FieldIndex['ID'])) ); - writeln( floattostr( sltb.FieldAsDouble(sltb.FieldIndex['Number'])) ); - end; - - finally - sltb.Free; - end; - - finally - sldb.Free; - end; - -end; - -begin - try - DoTest(); - writeln( 'SqlLite3 unit IS lazarus compatible' ); - except - writeln( 'ERROR : SqlLite3 unit is NOT lazarus compatible' ); - end; -end. - +program lazarustest; + +uses + SQLiteTable3 in 'SQLiteTable3.pas', + SQLite3 in 'SQLite3.pas', + sysutils; + + +procedure DoTest(); +var + slDBpath : string; + sldb : TSQLiteDatabase; + sltb : TSQLIteTable; + sSQL : String; + Notes : String; + +begin + // needed for linux build. + + slDBPath := ExtractFilepath( paramstr(0) ) + 'test.db'; + sldb := TSQLiteDatabase.Create(slDBPath); + + try + + if sldb.TableExists('testTable') then + begin + sSQL := 'DROP TABLE testtable'; + sldb.execsql(sSQL); + end; + + sSQL := 'CREATE TABLE testtable ([ID] INTEGER PRIMARY KEY,[OtherID] INTEGER NULL,'; + sSQL := sSQL + '[Name] VARCHAR (255),[Number] FLOAT, [notes] BLOB, [picture] BLOB COLLATE NOCASE);'; + sldb.execsql(sSQL); + + sldb.execsql('CREATE INDEX TestTableName ON [testtable]([Name]);'); + + //begin a transaction + sldb.BeginTransaction; + + sSQL := 'INSERT INTO testtable(Name,OtherID,Number,Notes) VALUES ("Some Name",4,587.6594,"Here are some notes");'; + //do the insert + sldb.ExecSQL(sSQL); + + sSQL := 'INSERT INTO testtable(Name,OtherID,Number,Notes) VALUES ("Another Name",12,4758.3265,"More notes");'; + //do the insert + sldb.ExecSQL(sSQL); + + //end the transaction + sldb.Commit; + + //query the data + sltb := slDb.GetTable('SELECT * FROM testtable'); + try + + if sltb.Count > 0 then + begin + //display first row + writeln( sltb.FieldAsString(sltb.FieldIndex['Name']) ); + writeln( inttostr(sltb.FieldAsInteger(sltb.FieldIndex['ID'])) ); + writeln( floattostr( sltb.FieldAsDouble(sltb.FieldIndex['Number'])) ); + end; + + finally + sltb.Free; + end; + + finally + sldb.Free; + end; + +end; + +begin + try + DoTest(); + writeln( 'SqlLite3 unit IS lazarus compatible' ); + except + writeln( 'ERROR : SqlLite3 unit is NOT lazarus compatible' ); + end; +end. + diff --git a/Game/Code/lib/requirements.txt b/Game/Code/lib/requirements.txt index 30f84f39..49aad6ba 100644 --- a/Game/Code/lib/requirements.txt +++ b/Game/Code/lib/requirements.txt @@ -24,3 +24,16 @@ ffmpeg SQLLite Wrapper http://www.itwriting.com/sqlitesimple.php + +====================================== +For LINUX build +====================================== +On top of the above pas files, you will need development libraries for them. + +here are the instructions needed to compile on ubunty ( 7.04 ) + +ffmpeg : + sudo apt-get install libavcodec-dev libavformat-dev + +sqlite : + sudo apt-get install libsqlite3-dev -- 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/Classes/TextGL.pas | 769 +++---- Game/Code/Classes/UCommon.pas | 230 +- Game/Code/Classes/UCovers.pas | 494 ++-- Game/Code/Classes/UDLLManager.pas | 480 ++-- Game/Code/Classes/UDataBase.pas | 597 +++-- Game/Code/Classes/UDraw.pas | 3145 ++++++++++++------------- Game/Code/Classes/UGraphic.pas | 1218 +++++----- Game/Code/Classes/UGraphicClasses.pas | 1345 +++++------ Game/Code/Classes/UJoystick.pas | 555 ++--- Game/Code/Classes/ULanguage.pas | 470 ++-- Game/Code/Classes/ULight.pas | 311 +-- Game/Code/Classes/ULog.pas | 496 ++-- Game/Code/Classes/UMain.pas | 1573 ++++++------- Game/Code/Classes/UMusic.pas | 1356 ++++++----- Game/Code/Classes/URecord.pas | 706 +++--- Game/Code/Classes/UTexture.pas | 2071 ++++++++--------- Game/Code/Classes/UTime.pas | 212 +- Game/Code/Menu/UDisplay.pas | 929 ++++---- Game/Code/Menu/UMenuButton.pas | 1137 ++++----- Game/Code/Menu/UMenuText.pas | 668 +++--- Game/Code/Screens/UScreenCredits.pas | 2197 +++++++++--------- Game/Code/Screens/UScreenMain.pas | 554 ++--- Game/Code/Screens/UScreenSing.pas | 2492 ++++++++++---------- Game/Code/Screens/UScreenSingModi.pas | 1334 +++++------ Game/Code/Screens/UScreenSong.pas | 4047 +++++++++++++++++---------------- Game/Code/Screens/UScreenSongMenu.pas | 1251 +++++----- Game/Code/Screens/UScreenStatMain.pas | 516 +++-- Game/Code/UltraStar.lpi | 456 ++-- Game/Code/UltraStar.lpr | 203 +- Game/Code/switches.inc | 20 +- 30 files changed, 16209 insertions(+), 15623 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index 8a702ca7..ee1a74f3 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -1,381 +1,388 @@ -unit TextGL; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - - -uses OpenGL12, - SDL, - UTexture, - Classes, - ULog; - -procedure BuildFont; // Build Our Bitmap Font -procedure KillFont; // Delete The Font -function glTextWidth(text: pchar): real; // Returns Text Width -procedure glPrintDone(text: pchar; Done: real; ColR, ColG, ColB: real); -procedure glPrintLetter(letter: char); -procedure glPrintLetterCut(letter: char; Start, Finish: real); -procedure glPrint(text: pchar); // Custom GL "Print" Routine -procedure glPrintCut(text: pchar); -procedure SetFontPos(X, Y: real); // Sets X And Y -procedure SetFontSize(Size: real); -procedure SetFontStyle(Style: integer); // sets active font style (normal, bold, etc) -procedure SetFontItalic(Enable: boolean); // sets italic type letter (works for all fonts) -procedure SetFontAspectW(Aspect: real); - -type - TTextGL = record - X: real; - Y: real; - Text: string; - Size: real; - ColR: real; - ColG: real; - ColB: real; - end; - - TFont = record - Tex: TTexture; - Width: array[0..255] of byte; - AspectW: real; - Centered: boolean; - Done: real; - Outline: real; - Italic: boolean; - end; - - -var - base: GLuint; // Base Display List For The Font Set - Fonts: array of TFont; - ActFont: integer; - PColR: real; // temps for glPrintDone - PColG: real; - PColB: real; - -implementation - -uses UMain, - Windows, - SysUtils, - {$IFDEF FPC} - LResources, - {$ENDIF} - UGraphic; - -procedure BuildFont; // Build Our Bitmap Font - - procedure loadfont( aID : integer; aType, aResourceName : String); - var - Rejestr: TResourceStream; - begin - {$IFNDEF FPC} - Rejestr := TResourceStream.Create(HInstance, aResourceName , pchar( aType ) ); - try - Rejestr.Read(Fonts[ aID ].Width, 256); - finally - Rejestr.Free; - end; - {$ENDIF} - end; - -var - font: HFONT; // Windows Font ID - h_dc: hdc; - Pet: integer; -begin - ActFont := 0; - - SetLength(Fonts, 5); - Fonts[0].Tex := Texture.LoadTexture(true, 'Font', 'PNG', 'Font', 0); - Fonts[0].Tex.H := 30; - Fonts[0].AspectW := 0.9; - Fonts[0].Done := -1; - Fonts[0].Outline := 0; - - Fonts[1].Tex := Texture.LoadTexture(true, 'FontB', 'PNG', 'Font', 0); - Fonts[1].Tex.H := 30; - Fonts[1].AspectW := 1; - Fonts[1].Done := -1; - Fonts[1].Outline := 0; - - Fonts[2].Tex := Texture.LoadTexture(true, 'FontO', 'PNG', 'Font Outline', 0); - Fonts[2].Tex.H := 30; - Fonts[2].AspectW := 0.95; - Fonts[2].Done := -1; - Fonts[2].Outline := 5; - - Fonts[3].Tex := Texture.LoadTexture(true, 'FontO2', 'PNG', 'Font Outline 2', 0); - Fonts[3].Tex.H := 30; - Fonts[3].AspectW := 0.95; - Fonts[3].Done := -1; - Fonts[3].Outline := 4; - -{ Fonts[4].Tex := Texture.LoadTexture('FontO', 'BMP', 'Arrow', 0); // for score screen - Fonts[4].Tex.H := 30; - Fonts[4].AspectW := 0.95; - Fonts[4].Done := -1; - Fonts[4].Outline := 5;} - - - - {$IFDEF FPC} - loadfont( 0, 'DAT', 'eurostar_regular' ); - loadfont( 1, 'DAT', 'eurostar_regular_bold' ); - loadfont( 2, 'DAT', 'Outline 1' ); - loadfont( 3, 'DAT', 'Outline 2' ); - {$ELSE} - loadfont( 0, 'FNT', 'Font' ); - loadfont( 1, 'FNT', 'FontB' ); - loadfont( 2, 'FNT', 'FontO' ); - loadfont( 3, 'FNT', 'FontO2' ); - {$ENDIF} - - - - -{ Rejestr := TResourceStream.Create(HInstance, 'FontO', 'FNT'); - Rejestr.Read(Fonts[4].Width, 256); - Rejestr.Free;} - - for Pet := 0 to 255 do - Fonts[1].Width[Pet] := Fonts[1].Width[Pet] div 2; - - for Pet := 0 to 255 do - Fonts[2].Width[Pet] := Fonts[2].Width[Pet] div 2 + 2; - - for Pet := 0 to 255 do - Fonts[3].Width[Pet] := Fonts[3].Width[Pet] + 1; - -{ for Pet := 0 to 255 do - Fonts[4].Width[Pet] := Fonts[4].Width[Pet] div 2 + 2;} - -end; - -procedure KillFont; // Delete The Font -begin -// glDeleteLists(base, 256); // Delete All 96 Characters -end; - -function glTextWidth(text: pchar): real; -var - Letter: char; -begin -// Log.LogStatus(Text, 'glTextWidth'); - Result := 0; - while (length(text) > 0) do begin - Letter := Text[0]; - text := pchar(Copy(text, 2, Length(text)-1)); - Result := Result + Fonts[ActFont].Width[Ord(Letter)] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; - end; // while -end; - -procedure glPrintDone(text: pchar; Done: real; ColR, ColG, ColB: real); -begin - Fonts[ActFont].Done := Done; - PColR := ColR; - PColG := ColG; - PColB := ColB; - glPrintCut(text); - Fonts[ActFont].Done := -1; -end; - -procedure glPrintLetter(Letter: char); -var - TexX, TexY: real; - TexR, TexB: real; - FWidth: real; - PL, PT: real; - PR, PB: real; - XItal: real; // X shift for italic type letter -begin - with Fonts[ActFont].Tex do begin - FWidth := Fonts[ActFont].Width[Ord(Letter)]; - - W := FWidth * (H/30) * Fonts[ActFont].AspectW; -// H := 30; - - // set texture positions - TexX := (ord(Letter) mod 16) * 1/16 + 1/32 - FWidth/1024 - Fonts[ActFont].Outline/1024; - TexY := (ord(Letter) div 16) * 1/16 + 2/1024; // 2/1024 - TexR := (ord(Letter) mod 16) * 1/16 + 1/32 + FWidth/1024 + Fonts[ActFont].Outline/1024; - TexB := (1 + ord(Letter) div 16) * 1/16 - 2/1024; - - // set vector positions - PL := X - Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW /2; - PT := Y; - PR := PL + W + Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW; - PB := PT + H; - if Fonts[ActFont].Italic = false then - XItal := 0 - else - XItal := 12; - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, TexNum); - glBegin(GL_QUADS); - glTexCoord2f(TexX, TexY); glVertex2f(PL+XItal, PT); - glTexCoord2f(TexX, TexB); glVertex2f(PL, PB); - glTexCoord2f(TexR, TexB); glVertex2f(PR, PB); - glTexCoord2f(TexR, TexY); glVertex2f(PR+XItal, PT); - glEnd; - X := X + W; - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - end; // with -end; - -procedure glPrintLetterCut(letter: char; Start, Finish: real); -var - TexX, TexY: real; - TexR, TexB: real; - TexTemp: real; - FWidth: real; - PL, PT: real; - PR, PB: real; - OutTemp: real; - XItal: real; -begin - with Fonts[ActFont].Tex do begin - FWidth := Fonts[ActFont].Width[Ord(Letter)]; - - W := FWidth * (H/30) * Fonts[ActFont].AspectW; -// H := 30; - OutTemp := Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW; - - // set texture positions - TexX := (ord(Letter) mod 16) * 1/16 + 1/32 - FWidth/1024 - Fonts[ActFont].Outline/1024; - TexY := (ord(Letter) div 16) * 1/16 + 2/1024; // 2/1024 - TexR := (ord(Letter) mod 16) * 1/16 + 1/32 + FWidth/1024 + Fonts[ActFont].Outline/1024; - TexB := (1 + ord(Letter) div 16) * 1/16 - 2/1024; - - TexTemp := TexX + Start * (TexR - TexX); - TexR := TexX + Finish * (TexR - TexX); - TexX := TexTemp; - - // set vector positions - PL := X - OutTemp / 2 + OutTemp * Start; - PT := Y; - PR := PL + (W + OutTemp) * (Finish - Start); - PB := PT + H; - if Fonts[ActFont].Italic = false then - XItal := 0 - else - XItal := 12; - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, TexNum); - glBegin(GL_QUADS); - glTexCoord2f(TexX, TexY); glVertex2f(PL+XItal, PT); - glTexCoord2f(TexX, TexB); glVertex2f(PL, PB); - glTexCoord2f(TexR, TexB); glVertex2f(PR, PB); - glTexCoord2f(TexR, TexY); glVertex2f(PR+XItal, PT); // not tested with XItal - glEnd; - X := X + W * (Finish - Start); - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - end; // with - -end; - -procedure glPrint(text: pchar); // Custom GL "Print" Routine -var - Letter: char; -begin - if (Text = '') then // If There's No Text - Exit; // Do Nothing - - while (length(text) > 0) do begin - // cut - Letter := Text[0]; - Text := pchar(Copy(Text, 2, Length(Text)-1)); - - // print - glPrintLetter(Letter); - end; // while -end; - -procedure glPrintCut(text: pchar); -var - Letter: char; - PToDo: real; - PTotWidth: real; - PDoingNow: real; - S: string; -begin - if (Text = '') then // If There's No Text - Exit; // Do Nothing - - PTotWidth := glTextWidth(Text); - PToDo := Fonts[ActFont].Done; - - while (length(text) > 0) do begin - // cut - Letter := Text[0]; - Text := pchar(Copy(Text, 2, Length(Text)-1)); - - // analyze - S := Letter; - PDoingNow := glTextWidth(pchar(S)) / PTotWidth; - - // drawing - if (PToDo > 0) and (PDoingNow <= PToDo) then - glPrintLetter(Letter); - - if (PToDo > 0) and (PDoingNow > PToDo) then begin - glPrintLetterCut(Letter, 0, PToDo / PDoingNow); - glColor3f(PColR, PColG, PColB); - glPrintLetterCut(Letter, PToDo / PDoingNow, 1); - end; - - if (PToDo <= 0) then - glPrintLetter(Letter); - - PToDo := PToDo - PDoingNow; - - end; // while -end; - - -procedure SetFontPos(X, Y: real); -begin - Fonts[ActFont].Tex.X := X; - Fonts[ActFont].Tex.Y := Y; -end; - -procedure SetFontSize(Size: real); -begin - Fonts[ActFont].Tex.H := 30 * (Size/10); -end; - -procedure SetFontStyle(Style: integer); -begin - ActFont := Style; -end; - -procedure SetFontItalic(Enable: boolean); -begin - Fonts[ActFont].Italic := Enable; -end; - -procedure SetFontAspectW(Aspect: real); -begin - Fonts[ActFont].AspectW := Aspect; -end; - -{$IFDEF FPC} -initialization - {$I UltraStar.lrs} -{$ENDIF} - -end. - - +unit TextGL; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + + +uses OpenGL12, + SDL, + UTexture, + Classes, + ULog; + +procedure BuildFont; // Build Our Bitmap Font +procedure KillFont; // Delete The Font +function glTextWidth(text: pchar): real; // Returns Text Width +procedure glPrintDone(text: pchar; Done: real; ColR, ColG, ColB: real); +procedure glPrintLetter(letter: char); +procedure glPrintLetterCut(letter: char; Start, Finish: real); +procedure glPrint(text: pchar); // Custom GL "Print" Routine +procedure glPrintCut(text: pchar); +procedure SetFontPos(X, Y: real); // Sets X And Y +procedure SetFontSize(Size: real); +procedure SetFontStyle(Style: integer); // sets active font style (normal, bold, etc) +procedure SetFontItalic(Enable: boolean); // sets italic type letter (works for all fonts) +procedure SetFontAspectW(Aspect: real); + +type + TTextGL = record + X: real; + Y: real; + Text: string; + Size: real; + ColR: real; + ColG: real; + ColB: real; + end; + + TFont = record + Tex: TTexture; + Width: array[0..255] of byte; + AspectW: real; + Centered: boolean; + Done: real; + Outline: real; + Italic: boolean; + end; + + +var + base: GLuint; // Base Display List For The Font Set + Fonts: array of TFont; + ActFont: integer; + PColR: real; // temps for glPrintDone + PColG: real; + PColB: real; + +implementation + +uses UMain, + {$IFDEF win32} + windows, + {$ELSE} + lclintf, + lcltype, + {$ENDIF} + SysUtils, + {$IFDEF FPC} + LResources, + {$ENDIF} + UGraphic; + +procedure BuildFont; // Build Our Bitmap Font + + procedure loadfont( aID : integer; aType, aResourceName : String); + var + Rejestr: TResourceStream; + begin + {$IFNDEF FPC} + Rejestr := TResourceStream.Create(HInstance, aResourceName , pchar( aType ) ); + try + Rejestr.Read(Fonts[ aID ].Width, 256); + finally + Rejestr.Free; + end; + {$ENDIF} + end; + +var + font: HFONT; // Windows Font ID + h_dc: hdc; + Pet: integer; +begin + ActFont := 0; + + SetLength(Fonts, 5); + Fonts[0].Tex := Texture.LoadTexture(true, 'Font', 'PNG', 'Font', 0); + Fonts[0].Tex.H := 30; + Fonts[0].AspectW := 0.9; + Fonts[0].Done := -1; + Fonts[0].Outline := 0; + + Fonts[1].Tex := Texture.LoadTexture(true, 'FontB', 'PNG', 'Font', 0); + Fonts[1].Tex.H := 30; + Fonts[1].AspectW := 1; + Fonts[1].Done := -1; + Fonts[1].Outline := 0; + + Fonts[2].Tex := Texture.LoadTexture(true, 'FontO', 'PNG', 'Font Outline', 0); + Fonts[2].Tex.H := 30; + Fonts[2].AspectW := 0.95; + Fonts[2].Done := -1; + Fonts[2].Outline := 5; + + Fonts[3].Tex := Texture.LoadTexture(true, 'FontO2', 'PNG', 'Font Outline 2', 0); + Fonts[3].Tex.H := 30; + Fonts[3].AspectW := 0.95; + Fonts[3].Done := -1; + Fonts[3].Outline := 4; + +{ Fonts[4].Tex := Texture.LoadTexture('FontO', 'BMP', 'Arrow', 0); // for score screen + Fonts[4].Tex.H := 30; + Fonts[4].AspectW := 0.95; + Fonts[4].Done := -1; + Fonts[4].Outline := 5;} + + + + {$IFDEF FPC} + loadfont( 0, 'DAT', 'eurostar_regular' ); + loadfont( 1, 'DAT', 'eurostar_regular_bold' ); + loadfont( 2, 'DAT', 'Outline 1' ); + loadfont( 3, 'DAT', 'Outline 2' ); + {$ELSE} + loadfont( 0, 'FNT', 'Font' ); + loadfont( 1, 'FNT', 'FontB' ); + loadfont( 2, 'FNT', 'FontO' ); + loadfont( 3, 'FNT', 'FontO2' ); + {$ENDIF} + + + + +{ Rejestr := TResourceStream.Create(HInstance, 'FontO', 'FNT'); + Rejestr.Read(Fonts[4].Width, 256); + Rejestr.Free;} + + for Pet := 0 to 255 do + Fonts[1].Width[Pet] := Fonts[1].Width[Pet] div 2; + + for Pet := 0 to 255 do + Fonts[2].Width[Pet] := Fonts[2].Width[Pet] div 2 + 2; + + for Pet := 0 to 255 do + Fonts[3].Width[Pet] := Fonts[3].Width[Pet] + 1; + +{ for Pet := 0 to 255 do + Fonts[4].Width[Pet] := Fonts[4].Width[Pet] div 2 + 2;} + +end; + +procedure KillFont; // Delete The Font +begin +// glDeleteLists(base, 256); // Delete All 96 Characters +end; + +function glTextWidth(text: pchar): real; +var + Letter: char; +begin +// Log.LogStatus(Text, 'glTextWidth'); + Result := 0; + while (length(text) > 0) do begin + Letter := Text[0]; + text := pchar(Copy(text, 2, Length(text)-1)); + Result := Result + Fonts[ActFont].Width[Ord(Letter)] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + end; // while +end; + +procedure glPrintDone(text: pchar; Done: real; ColR, ColG, ColB: real); +begin + Fonts[ActFont].Done := Done; + PColR := ColR; + PColG := ColG; + PColB := ColB; + glPrintCut(text); + Fonts[ActFont].Done := -1; +end; + +procedure glPrintLetter(Letter: char); +var + TexX, TexY: real; + TexR, TexB: real; + FWidth: real; + PL, PT: real; + PR, PB: real; + XItal: real; // X shift for italic type letter +begin + with Fonts[ActFont].Tex do begin + FWidth := Fonts[ActFont].Width[Ord(Letter)]; + + W := FWidth * (H/30) * Fonts[ActFont].AspectW; +// H := 30; + + // set texture positions + TexX := (ord(Letter) mod 16) * 1/16 + 1/32 - FWidth/1024 - Fonts[ActFont].Outline/1024; + TexY := (ord(Letter) div 16) * 1/16 + 2/1024; // 2/1024 + TexR := (ord(Letter) mod 16) * 1/16 + 1/32 + FWidth/1024 + Fonts[ActFont].Outline/1024; + TexB := (1 + ord(Letter) div 16) * 1/16 - 2/1024; + + // set vector positions + PL := X - Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW /2; + PT := Y; + PR := PL + W + Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW; + PB := PT + H; + if Fonts[ActFont].Italic = false then + XItal := 0 + else + XItal := 12; + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, TexNum); + glBegin(GL_QUADS); + glTexCoord2f(TexX, TexY); glVertex2f(PL+XItal, PT); + glTexCoord2f(TexX, TexB); glVertex2f(PL, PB); + glTexCoord2f(TexR, TexB); glVertex2f(PR, PB); + glTexCoord2f(TexR, TexY); glVertex2f(PR+XItal, PT); + glEnd; + X := X + W; + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + end; // with +end; + +procedure glPrintLetterCut(letter: char; Start, Finish: real); +var + TexX, TexY: real; + TexR, TexB: real; + TexTemp: real; + FWidth: real; + PL, PT: real; + PR, PB: real; + OutTemp: real; + XItal: real; +begin + with Fonts[ActFont].Tex do begin + FWidth := Fonts[ActFont].Width[Ord(Letter)]; + + W := FWidth * (H/30) * Fonts[ActFont].AspectW; +// H := 30; + OutTemp := Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW; + + // set texture positions + TexX := (ord(Letter) mod 16) * 1/16 + 1/32 - FWidth/1024 - Fonts[ActFont].Outline/1024; + TexY := (ord(Letter) div 16) * 1/16 + 2/1024; // 2/1024 + TexR := (ord(Letter) mod 16) * 1/16 + 1/32 + FWidth/1024 + Fonts[ActFont].Outline/1024; + TexB := (1 + ord(Letter) div 16) * 1/16 - 2/1024; + + TexTemp := TexX + Start * (TexR - TexX); + TexR := TexX + Finish * (TexR - TexX); + TexX := TexTemp; + + // set vector positions + PL := X - OutTemp / 2 + OutTemp * Start; + PT := Y; + PR := PL + (W + OutTemp) * (Finish - Start); + PB := PT + H; + if Fonts[ActFont].Italic = false then + XItal := 0 + else + XItal := 12; + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, TexNum); + glBegin(GL_QUADS); + glTexCoord2f(TexX, TexY); glVertex2f(PL+XItal, PT); + glTexCoord2f(TexX, TexB); glVertex2f(PL, PB); + glTexCoord2f(TexR, TexB); glVertex2f(PR, PB); + glTexCoord2f(TexR, TexY); glVertex2f(PR+XItal, PT); // not tested with XItal + glEnd; + X := X + W * (Finish - Start); + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + end; // with + +end; + +procedure glPrint(text: pchar); // Custom GL "Print" Routine +var + Letter: char; +begin + if (Text = '') then // If There's No Text + Exit; // Do Nothing + + while (length(text) > 0) do begin + // cut + Letter := Text[0]; + Text := pchar(Copy(Text, 2, Length(Text)-1)); + + // print + glPrintLetter(Letter); + end; // while +end; + +procedure glPrintCut(text: pchar); +var + Letter: char; + PToDo: real; + PTotWidth: real; + PDoingNow: real; + S: string; +begin + if (Text = '') then // If There's No Text + Exit; // Do Nothing + + PTotWidth := glTextWidth(Text); + PToDo := Fonts[ActFont].Done; + + while (length(text) > 0) do begin + // cut + Letter := Text[0]; + Text := pchar(Copy(Text, 2, Length(Text)-1)); + + // analyze + S := Letter; + PDoingNow := glTextWidth(pchar(S)) / PTotWidth; + + // drawing + if (PToDo > 0) and (PDoingNow <= PToDo) then + glPrintLetter(Letter); + + if (PToDo > 0) and (PDoingNow > PToDo) then begin + glPrintLetterCut(Letter, 0, PToDo / PDoingNow); + glColor3f(PColR, PColG, PColB); + glPrintLetterCut(Letter, PToDo / PDoingNow, 1); + end; + + if (PToDo <= 0) then + glPrintLetter(Letter); + + PToDo := PToDo - PDoingNow; + + end; // while +end; + + +procedure SetFontPos(X, Y: real); +begin + Fonts[ActFont].Tex.X := X; + Fonts[ActFont].Tex.Y := Y; +end; + +procedure SetFontSize(Size: real); +begin + Fonts[ActFont].Tex.H := 30 * (Size/10); +end; + +procedure SetFontStyle(Style: integer); +begin + ActFont := Style; +end; + +procedure SetFontItalic(Enable: boolean); +begin + Fonts[ActFont].Italic := Enable; +end; + +procedure SetFontAspectW(Aspect: real); +begin + Fonts[ActFont].AspectW := Aspect; +end; + +{$IFDEF FPC} +{$IFDEF win32} +initialization + {$I UltraStar.lrs} +{$ENDIF} +{$ENDIF} + +end. + + diff --git a/Game/Code/Classes/UCommon.pas b/Game/Code/Classes/UCommon.pas index f25e025b..b7ddd7ba 100644 --- a/Game/Code/Classes/UCommon.pas +++ b/Game/Code/Classes/UCommon.pas @@ -1,98 +1,132 @@ -unit UCommon; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -uses - windows; - -{$IFDEF FPC} - -type - TWndMethod = procedure(var Message: TMessage) of object; - -function RandomRange(aMin: Integer; aMax: Integer) : Integer; -function AllocateHWnd(Method: TWndMethod): HWND; -procedure DeallocateHWnd(Wnd: HWND); - -function MaxValue(const Data: array of Double): Double; -function MinValue(const Data: array of Double): Double; -{$ENDIF} - -implementation - -{$IFDEF FPC} - -function MaxValue(const Data: array of Double): Double; -var - I: Integer; -begin - Result := Data[Low(Data)]; - for I := Low(Data) + 1 to High(Data) do - if Result < Data[I] then - Result := Data[I]; -end; - -function MinValue(const Data: array of Double): Double; -var - I: Integer; -begin - Result := Data[Low(Data)]; - for I := Low(Data) + 1 to High(Data) do - if Result > Data[I] then - Result := Data[I]; -end; - -function RandomRange(aMin: Integer; aMax: Integer) : Integer; -begin -RandomRange := Random(aMax-aMin) + aMin ; -end; - - - -// TODO : JB this is dodgey and bad... find a REAL solution ! -function AllocateHWnd(Method: TWndMethod): HWND; -var - TempClass: TWndClass; - ClassRegistered: Boolean; -begin -(* - UtilWindowClass.hInstance := HInstance; -{$IFDEF PIC} - UtilWindowClass.lpfnWndProc := @DefWindowProc; -{$ENDIF} - ClassRegistered := GetClassInfo(HInstance, UtilWindowClass.lpszClassName, TempClass); - if not ClassRegistered or (TempClass.lpfnWndProc <> @DefWindowProc) then - begin - if ClassRegistered then - Windows.UnregisterClass(UtilWindowClass.lpszClassName, HInstance); - Windows.RegisterClass(UtilWindowClass); - end; - Result := CreateWindowEx(WS_EX_TOOLWINDOW, UtilWindowClass.lpszClassName, '', WS_POPUP {+ 0}, 0, 0, 0, 0, 0, 0, HInstance, nil); -*) - Result := CreateWindowEx(WS_EX_TOOLWINDOW, '', '', WS_POPUP {+ 0}, 0, 0, 0, 0, 0, 0, HInstance, nil); - -(* - if Assigned(Method) then - SetWindowLong(Result, GWL_WNDPROC, Longint(MakeObjectInstance(Method))); -*) -end; - -procedure DeallocateHWnd(Wnd: HWND); -var - Instance: Pointer; -begin - Instance := Pointer(GetWindowLong(Wnd, GWL_WNDPROC)); - DestroyWindow(Wnd); - -// if Instance <> @DefWindowProc then -// FreeObjectInstance(Instance); -end; - -{$ENDIF} - - -end. +unit UCommon; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses + +{$IFDEF win32} + windows; +{$ELSE} + lcltype, + messages; +{$ENDIF} + +{$IFNDEF win32} +type + hStream = THandle; + HGLRC = THandle; + TLargeInteger = Int64; + TWin32FindData = LongInt; +{$ENDIF} + +{$IFDEF FPC} + +type + TWndMethod = procedure(var Message: TMessage) of object; + +function RandomRange(aMin: Integer; aMax: Integer) : Integer; +//function AllocateHWnd(Method: TWndMethod): HWND; +//procedure DeallocateHWnd(Wnd: HWND); + +function MaxValue(const Data: array of Double): Double; +function MinValue(const Data: array of Double): Double; +{$ENDIF} + +{$IFNDEF win32} +(* + function QueryPerformanceCounter(lpPerformanceCount:TLARGEINTEGER):Bool; + function QueryPerformanceFrequency(lpFrequency:TLARGEINTEGER):Bool; +*) + procedure ZeroMemory( Destination: Pointer; Length: DWORD ); +{$ENDIF} + +implementation + +{$IFNDEF win32} +procedure ZeroMemory( Destination: Pointer; Length: DWORD ); +begin + FillChar( Destination^, Length, 0 ); +end; //ZeroMemory + +(* +function QueryPerformanceCounter(lpPerformanceCount:TLARGEINTEGER):Bool; + + // From http://en.wikipedia.org/wiki/RDTSC + function RDTSC: Int64; register; + asm + rdtsc + end; + +begin + // Use clock_gettime here maybe ... from libc + lpPerformanceCount := RDTSC(); + result := true; +end; + +function QueryPerformanceFrequency(lpFrequency:TLARGEINTEGER):Bool; +begin + lpFrequency := 0; + result := true; +end; +*) +{$ENDIF} + + +{$IFDEF FPC} + +function MaxValue(const Data: array of Double): Double; +var + I: Integer; +begin + Result := Data[Low(Data)]; + for I := Low(Data) + 1 to High(Data) do + if Result < Data[I] then + Result := Data[I]; +end; + +function MinValue(const Data: array of Double): Double; +var + I: Integer; +begin + Result := Data[Low(Data)]; + for I := Low(Data) + 1 to High(Data) do + if Result > Data[I] then + Result := Data[I]; +end; + +function RandomRange(aMin: Integer; aMax: Integer) : Integer; +begin +RandomRange := Random(aMax-aMin) + aMin ; +end; + + +// NOTE !!!!!!!!!! +// AllocateHWnd is in lclintfh.inc + +{ +// TODO : JB this is dodgey and bad... find a REAL solution ! +function AllocateHWnd(Method: TWndMethod): HWND; +var + TempClass: TWndClass; + ClassRegistered: Boolean; +begin + Result := CreateWindowEx(WS_EX_TOOLWINDOW, '', '', WS_POPUP , 0, 0, 0, 0, 0, 0, HInstance, nil); +end; + +procedure DeallocateHWnd(Wnd: HWND); +var + Instance: Pointer; +begin + Instance := Pointer(GetWindowLong(Wnd, GWL_WNDPROC)); + DestroyWindow(Wnd); +end; +} + +{$ENDIF} + + +end. diff --git a/Game/Code/Classes/UCovers.pas b/Game/Code/Classes/UCovers.pas index efed1435..094fe43c 100644 --- a/Game/Code/Classes/UCovers.pas +++ b/Game/Code/Classes/UCovers.pas @@ -1,246 +1,248 @@ -unit UCovers; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -uses OpenGL12, - Windows, - Math, - Classes, - SysUtils, - {$IFNDEF FPC} - Graphics, - {$ENDIF} - UThemes, - UTexture; - -type - TCover = record - Name: string; - W: word; - H: word; - Size: integer; - Position: integer; // position of picture in the cache file -// Data: array of byte; - end; - - TCovers = class - Cover: array of TCover; - W: word; - H: word; - Size: integer; - Data: array of byte; - WritetoFile: Boolean; - - constructor Create; - procedure Load; - procedure Save; - procedure AddCover(Name: string); - function CoverExists(Name: string): boolean; - function CoverNumber(Name: string): integer; - procedure PrepareData(Name: string); - end; - -var - Covers: TCovers; - -implementation - -uses UMain, - // UFiles, - ULog, - DateUtils; - -constructor TCovers.Create; -begin - W := 128; - H := 128; - Size := W*H*3; - Load; - WritetoFile := True; -end; - -procedure TCovers.Load; -var - F: File; - C: integer; // cover number - W: word; - H: word; - Bits: byte; - NLen: word; - Name: string; -// Data: array of byte; -begin - if FileExists(GamePath + 'covers.cache') then - begin - AssignFile(F, GamePath + 'covers.cache'); - Reset(F, 1); - - WritetoFile := not FileIsReadOnly(GamePath + 'covers.cache'); - - SetLength(Cover, 0); - - while not EOF(F) do - begin - SetLength(Cover, Length(Cover)+1); - - BlockRead(F, W, 2); - Cover[High(Cover)].W := W; - - BlockRead(F, H, 2); - Cover[High(Cover)].H := H; - - BlockRead(F, Bits, 1); - - Cover[High(Cover)].Size := W * H * (Bits div 8); - - // test - // W := 128; - // H := 128; - // Bits := 24; - // Seek(F, FilePos(F) + 3); - - BlockRead(F, NLen, 2); - SetLength(Name, NLen); - - BlockRead(F, Name[1], NLen); - Cover[High(Cover)].Name := Name; - - Cover[High(Cover)].Position := FilePos(F); - Seek(F, FilePos(F) + W*H*(Bits div 8)); - - // SetLength(Cover[High(Cover)].Data, W*H*(Bits div 8)); - // BlockRead(F, Cover[High(Cover)].Data[0], W*H*(Bits div 8)); - - end; // While - - CloseFile(F); - end; // fileexists -end; - -procedure TCovers.Save; -var - F: File; - C: integer; // cover number - W: word; - H: word; - NLen: word; - Bits: byte; -begin -{ AssignFile(F, GamePath + 'covers.cache'); - Rewrite(F, 1); - - Bits := 24; - for C := 0 to High(Cover) do begin - W := Cover[C].W; - H := Cover[C].H; - - BlockWrite(F, W, 2); - BlockWrite(F, H, 2); - BlockWrite(F, Bits, 1); - - NLen := Length(Cover[C].Name); - BlockWrite(F, NLen, 2); - BlockWrite(F, Cover[C].Name[1], NLen); - BlockWrite(F, Cover[C].Data[0], W*H*(Bits div 8)); - end; - - CloseFile(F);} -end; - -procedure TCovers.AddCover(Name: string); -var - B: integer; - F: File; - C: integer; // cover number - NLen: word; - Bits: byte; -begin - if not CoverExists(Name) then begin - SetLength(Cover, Length(Cover)+1); - Cover[High(Cover)].Name := Name; - - Cover[High(Cover)].W := W; - Cover[High(Cover)].H := H; - Cover[High(Cover)].Size := Size; - - // do not copy data. write them directly to file -// SetLength(Cover[High(Cover)].Data, Size); -// for B := 0 to Size-1 do -// Cover[High(Cover)].Data[B] := CacheMipmap[B]; - - if WritetoFile then - begin - AssignFile(F, GamePath + 'covers.cache'); - if FileExists(GamePath + 'covers.cache') then begin - Reset(F, 1); - Seek(F, FileSize(F)); - end else - Rewrite(F, 1); - - Bits := 24; - - BlockWrite(F, W, 2); - BlockWrite(F, H, 2); - BlockWrite(F, Bits, 1); - - NLen := Length(Name); - BlockWrite(F, NLen, 2); - BlockWrite(F, Name[1], NLen); - - Cover[High(Cover)].Position := FilePos(F); - BlockWrite(F, CacheMipmap[0], W*H*(Bits div 8)); - - CloseFile(F); - end; - end - else - Cover[High(Cover)].Position := 0; -end; - -function TCovers.CoverExists(Name: string): boolean; -var - C: integer; // cover -begin - Result := false; - C := 0; - while (C <= High(Cover)) and (Result = false) do begin - if Cover[C].Name = Name then Result := true; - Inc(C); - end; -end; - -function TCovers.CoverNumber(Name: string): integer; -var - C: integer; -begin - Result := -1; - C := 0; - while (C <= High(Cover)) and (Result = -1) do begin - if Cover[C].Name = Name then Result := C; - Inc(C); - end; -end; - -procedure TCovers.PrepareData(Name: string); -var - F: File; - C: integer; -begin - if FileExists(GamePath + 'covers.cache') then begin - AssignFile(F, GamePath + 'covers.cache'); - Reset(F, 1); - - C := CoverNumber(Name); - SetLength(Data, Cover[C].Size); - if Length(Data) < 6 then beep; - Seek(F, Cover[C].Position); - BlockRead(F, Data[0], Cover[C].Size); - CloseFile(F); - end; -end; - -end. +unit UCovers; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses OpenGL12, + {$IFDEF win32} + windows, + {$ENDIF} + Math, + Classes, + SysUtils, + {$IFNDEF FPC} + Graphics, + {$ENDIF} + UThemes, + UTexture; + +type + TCover = record + Name: string; + W: word; + H: word; + Size: integer; + Position: integer; // position of picture in the cache file +// Data: array of byte; + end; + + TCovers = class + Cover: array of TCover; + W: word; + H: word; + Size: integer; + Data: array of byte; + WritetoFile: Boolean; + + constructor Create; + procedure Load; + procedure Save; + procedure AddCover(Name: string); + function CoverExists(Name: string): boolean; + function CoverNumber(Name: string): integer; + procedure PrepareData(Name: string); + end; + +var + Covers: TCovers; + +implementation + +uses UMain, + // UFiles, + ULog, + DateUtils; + +constructor TCovers.Create; +begin + W := 128; + H := 128; + Size := W*H*3; + Load; + WritetoFile := True; +end; + +procedure TCovers.Load; +var + F: File; + C: integer; // cover number + W: word; + H: word; + Bits: byte; + NLen: word; + Name: string; +// Data: array of byte; +begin + if FileExists(GamePath + 'covers.cache') then + begin + AssignFile(F, GamePath + 'covers.cache'); + Reset(F, 1); + + WritetoFile := not FileIsReadOnly(GamePath + 'covers.cache'); + + SetLength(Cover, 0); + + while not EOF(F) do + begin + SetLength(Cover, Length(Cover)+1); + + BlockRead(F, W, 2); + Cover[High(Cover)].W := W; + + BlockRead(F, H, 2); + Cover[High(Cover)].H := H; + + BlockRead(F, Bits, 1); + + Cover[High(Cover)].Size := W * H * (Bits div 8); + + // test + // W := 128; + // H := 128; + // Bits := 24; + // Seek(F, FilePos(F) + 3); + + BlockRead(F, NLen, 2); + SetLength(Name, NLen); + + BlockRead(F, Name[1], NLen); + Cover[High(Cover)].Name := Name; + + Cover[High(Cover)].Position := FilePos(F); + Seek(F, FilePos(F) + W*H*(Bits div 8)); + + // SetLength(Cover[High(Cover)].Data, W*H*(Bits div 8)); + // BlockRead(F, Cover[High(Cover)].Data[0], W*H*(Bits div 8)); + + end; // While + + CloseFile(F); + end; // fileexists +end; + +procedure TCovers.Save; +var + F: File; + C: integer; // cover number + W: word; + H: word; + NLen: word; + Bits: byte; +begin +{ AssignFile(F, GamePath + 'covers.cache'); + Rewrite(F, 1); + + Bits := 24; + for C := 0 to High(Cover) do begin + W := Cover[C].W; + H := Cover[C].H; + + BlockWrite(F, W, 2); + BlockWrite(F, H, 2); + BlockWrite(F, Bits, 1); + + NLen := Length(Cover[C].Name); + BlockWrite(F, NLen, 2); + BlockWrite(F, Cover[C].Name[1], NLen); + BlockWrite(F, Cover[C].Data[0], W*H*(Bits div 8)); + end; + + CloseFile(F);} +end; + +procedure TCovers.AddCover(Name: string); +var + B: integer; + F: File; + C: integer; // cover number + NLen: word; + Bits: byte; +begin + if not CoverExists(Name) then begin + SetLength(Cover, Length(Cover)+1); + Cover[High(Cover)].Name := Name; + + Cover[High(Cover)].W := W; + Cover[High(Cover)].H := H; + Cover[High(Cover)].Size := Size; + + // do not copy data. write them directly to file +// SetLength(Cover[High(Cover)].Data, Size); +// for B := 0 to Size-1 do +// Cover[High(Cover)].Data[B] := CacheMipmap[B]; + + if WritetoFile then + begin + AssignFile(F, GamePath + 'covers.cache'); + if FileExists(GamePath + 'covers.cache') then begin + Reset(F, 1); + Seek(F, FileSize(F)); + end else + Rewrite(F, 1); + + Bits := 24; + + BlockWrite(F, W, 2); + BlockWrite(F, H, 2); + BlockWrite(F, Bits, 1); + + NLen := Length(Name); + BlockWrite(F, NLen, 2); + BlockWrite(F, Name[1], NLen); + + Cover[High(Cover)].Position := FilePos(F); + BlockWrite(F, CacheMipmap[0], W*H*(Bits div 8)); + + CloseFile(F); + end; + end + else + Cover[High(Cover)].Position := 0; +end; + +function TCovers.CoverExists(Name: string): boolean; +var + C: integer; // cover +begin + Result := false; + C := 0; + while (C <= High(Cover)) and (Result = false) do begin + if Cover[C].Name = Name then Result := true; + Inc(C); + end; +end; + +function TCovers.CoverNumber(Name: string): integer; +var + C: integer; +begin + Result := -1; + C := 0; + while (C <= High(Cover)) and (Result = -1) do begin + if Cover[C].Name = Name then Result := C; + Inc(C); + end; +end; + +procedure TCovers.PrepareData(Name: string); +var + F: File; + C: integer; +begin + if FileExists(GamePath + 'covers.cache') then begin + AssignFile(F, GamePath + 'covers.cache'); + Reset(F, 1); + + C := CoverNumber(Name); + SetLength(Data, Cover[C].Size); + if Length(Data) < 6 then beep; + Seek(F, Cover[C].Position); + BlockRead(F, Data[0], Cover[C].Size); + CloseFile(F); + end; +end; + +end. diff --git a/Game/Code/Classes/UDLLManager.pas b/Game/Code/Classes/UDLLManager.pas index 0d328c37..d25efb35 100644 --- a/Game/Code/Classes/UDLLManager.pas +++ b/Game/Code/Classes/UDLLManager.pas @@ -1,233 +1,247 @@ -unit UDLLManager; - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - -interface - -uses ModiSDK, - UFiles; - -type - TDLLMan = class - private - hLib: THandle; - P_Init: fModi_Init; - P_Draw: fModi_Draw; - P_Finish: fModi_Finish; - P_RData: pModi_RData; - public - Plugins: array of TPluginInfo; - PluginPaths: array of String; - Selected: ^TPluginInfo; - - constructor Create; - - procedure GetPluginList; - procedure ClearPluginInfo(No: Cardinal); - function LoadPluginInfo(Filename: String; No: Cardinal): boolean; - - function LoadPlugin(No: Cardinal): boolean; - procedure UnLoadPlugin; - - function PluginInit (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: pModi_PlaySound): boolean; - function PluginDraw (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; - function PluginFinish (var Playerinfo: TPlayerinfo): byte; - procedure PluginRData (handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD); - end; - -var - DLLMan: TDLLMan; - -const DLLPath = 'Plugins\'; - -implementation -uses Windows, ULog, SysUtils; - - -constructor TDLLMan.Create; -begin - SetLength(Plugins, 0); - SetLength(PluginPaths, Length(Plugins)); - GetPluginList; -end; - -procedure TDLLMan.GetPluginList; -var - SR: TSearchRec; -begin - - if FindFirst(DLLPath + '*.dll', faAnyFile , SR) = 0 then - begin - repeat - SetLength(Plugins, Length(Plugins)+1); - SetLength(PluginPaths, Length(Plugins)); - - if LoadPluginInfo(SR.Name, High(Plugins)) then //Loaded succesful - begin - PluginPaths[High(PluginPaths)] := SR.Name; - end - else //Error Loading - begin - SetLength(Plugins, Length(Plugins)-1); - SetLength(PluginPaths, Length(Plugins)); - end; - - until FindNext(SR) <> 0; - FindClose(SR); - end; -end; - -procedure TDLLMan.ClearPluginInfo(No: Cardinal); -begin - //Set to Party Modi Plugin - Plugins[No].Typ := 8; - - Plugins[No].Name := 'unknown'; - Plugins[No].NumPlayers := 0; - - Plugins[No].Creator := 'Nobody'; - Plugins[No].PluginDesc := 'NO_PLUGIN_DESC'; - - Plugins[No].LoadSong := True; - Plugins[No].ShowScore := True; - Plugins[No].ShowBars := False; - Plugins[No].ShowNotes := True; - Plugins[No].LoadVideo := True; - Plugins[No].LoadBack := True; - - Plugins[No].TeamModeOnly := False; - Plugins[No].GetSoundData := False; - Plugins[No].Dummy := False; - - - Plugins[No].BGShowFull := False; - Plugins[No].BGShowFull_O := True; - - Plugins[No].ShowRateBar:= False; - Plugins[No].ShowRateBar_O := True; - - Plugins[No].EnLineBonus := False; - Plugins[No].EnLineBonus_O := True; -end; - -function TDLLMan.LoadPluginInfo(Filename: String; No: Cardinal): boolean; -var - hLibg: THandle; - Info: pModi_PluginInfo; - I: Integer; -begin - Result := False; - //Clear Plugin Info - ClearPluginInfo(No); - - {//Workaround Plugins Loaded 2 Times - For I := low(PluginPaths) to high(PluginPaths) do - if (PluginPaths[I] = Filename) then - exit; } - - //Load Libary - hLibg := LoadLibrary(PChar(DLLPath + Filename)); - //If Loaded - if (hLibg <> 0) then - begin - //Load Info Procedure - @Info := GetProcAddress (hLibg, PChar('PluginInfo')); - - //If Loaded - if (@Info <> nil) then - begin - //Load PluginInfo - Info (Plugins[No]); - Result := True; - end - else - Log.LogError('Could not Load Plugin "' + Filename + '": Info Procedure not Found'); - - FreeLibrary (hLibg); - end - else - Log.LogError('Could not Load Plugin "' + Filename + '": Libary not Loaded'); -end; - -function TDLLMan.LoadPlugin(No: Cardinal): boolean; -begin - Result := False; - //Load Libary - hLib := LoadLibrary(PChar(DLLPath + PluginPaths[No])); - //If Loaded - if (hLib <> 0) then - begin - //Load Info Procedure - @P_Init := GetProcAddress (hLib, PChar('Init')); - @P_Draw := GetProcAddress (hLib, PChar('Draw')); - @P_Finish := GetProcAddress (hLib, PChar('Finish')); - - //If Loaded - if (@P_Init <> nil) And (@P_Draw <> nil) And (@P_Finish <> nil) then - begin - Selected := @Plugins[No]; - Result := True; - end - else - begin - Log.LogError('Could not Load Plugin "' + PluginPaths[No] + '": Procedures not Found'); - - end; - end - else - Log.LogError('Could not Load Plugin "' + PluginPaths[No] + '": Libary not Loaded'); -end; - -procedure TDLLMan.UnLoadPlugin; -begin -if (hLib <> 0) then - FreeLibrary (hLib); - -//Selected := nil; -@P_Init := nil; -@P_Draw := nil; -@P_Finish := nil; -@P_RData := nil; -end; - -function TDLLMan.PluginInit (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: pModi_PlaySound): boolean; -var - Methods: TMethodRec; -begin - Methods.LoadTex := LoadTex; - Methods.Print := Print; - Methods.LoadSound := LoadSound; - Methods.PlaySound := PlaySound; - - if (@P_Init <> nil) then - Result := P_Init (TeamInfo, PlayerInfo, Sentences, Methods) - else - Result := False -end; - -function TDLLMan.PluginDraw (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; -begin -if (@P_Draw <> nil) then - Result := P_Draw (PlayerInfo, CurSentence) -else - Result := False -end; - -function TDLLMan.PluginFinish (var Playerinfo: TPlayerinfo): byte; -begin -if (@P_Finish <> nil) then - Result := P_Finish (PlayerInfo) -else - Result := 0; -end; - -procedure TDLLMan.PluginRData (handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD); -begin -if (@P_RData <> nil) then - P_RData (handle, buffer, len, user); -end; - -end. +unit UDLLManager; + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +interface + +uses ModiSDK, + UFiles; + +type + TDLLMan = class + private + hLib: THandle; + P_Init: fModi_Init; + P_Draw: fModi_Draw; + P_Finish: fModi_Finish; + P_RData: pModi_RData; + public + Plugins: array of TPluginInfo; + PluginPaths: array of String; + Selected: ^TPluginInfo; + + constructor Create; + + procedure GetPluginList; + procedure ClearPluginInfo(No: Cardinal); + function LoadPluginInfo(Filename: String; No: Cardinal): boolean; + + function LoadPlugin(No: Cardinal): boolean; + procedure UnLoadPlugin; + + function PluginInit (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: pModi_PlaySound): boolean; + function PluginDraw (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; + function PluginFinish (var Playerinfo: TPlayerinfo): byte; + procedure PluginRData (handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD); + end; + +var + DLLMan: TDLLMan; + +const + {$IFDEF win32} + DLLPath = 'Plugins\'; + DLLExt = '.dll'; + {$ELSE} + DLLPath = 'Plugins/'; + DLLExt = '.so'; + {$ENDIF} + +implementation + +uses {$IFDEF win32} + windows, + {$ELSE} + dynlibs, + {$ENDIF} + ULog, + SysUtils; + + +constructor TDLLMan.Create; +begin + SetLength(Plugins, 0); + SetLength(PluginPaths, Length(Plugins)); + GetPluginList; +end; + +procedure TDLLMan.GetPluginList; +var + SR: TSearchRec; +begin + + if FindFirst(DLLPath + '*' + DLLExt, faAnyFile , SR) = 0 then + begin + repeat + SetLength(Plugins, Length(Plugins)+1); + SetLength(PluginPaths, Length(Plugins)); + + if LoadPluginInfo(SR.Name, High(Plugins)) then //Loaded succesful + begin + PluginPaths[High(PluginPaths)] := SR.Name; + end + else //Error Loading + begin + SetLength(Plugins, Length(Plugins)-1); + SetLength(PluginPaths, Length(Plugins)); + end; + + until FindNext(SR) <> 0; + FindClose(SR); + end; +end; + +procedure TDLLMan.ClearPluginInfo(No: Cardinal); +begin + //Set to Party Modi Plugin + Plugins[No].Typ := 8; + + Plugins[No].Name := 'unknown'; + Plugins[No].NumPlayers := 0; + + Plugins[No].Creator := 'Nobody'; + Plugins[No].PluginDesc := 'NO_PLUGIN_DESC'; + + Plugins[No].LoadSong := True; + Plugins[No].ShowScore := True; + Plugins[No].ShowBars := False; + Plugins[No].ShowNotes := True; + Plugins[No].LoadVideo := True; + Plugins[No].LoadBack := True; + + Plugins[No].TeamModeOnly := False; + Plugins[No].GetSoundData := False; + Plugins[No].Dummy := False; + + + Plugins[No].BGShowFull := False; + Plugins[No].BGShowFull_O := True; + + Plugins[No].ShowRateBar:= False; + Plugins[No].ShowRateBar_O := True; + + Plugins[No].EnLineBonus := False; + Plugins[No].EnLineBonus_O := True; +end; + +function TDLLMan.LoadPluginInfo(Filename: String; No: Cardinal): boolean; +var + hLibg: THandle; + Info: pModi_PluginInfo; + I: Integer; +begin + Result := False; + //Clear Plugin Info + ClearPluginInfo(No); + + {//Workaround Plugins Loaded 2 Times + For I := low(PluginPaths) to high(PluginPaths) do + if (PluginPaths[I] = Filename) then + exit; } + + //Load Libary + hLibg := LoadLibrary(PChar(DLLPath + Filename)); + //If Loaded + if (hLibg <> 0) then + begin + //Load Info Procedure + @Info := GetProcAddress (hLibg, PChar('PluginInfo')); + + //If Loaded + if (@Info <> nil) then + begin + //Load PluginInfo + Info (Plugins[No]); + Result := True; + end + else + Log.LogError('Could not Load Plugin "' + Filename + '": Info Procedure not Found'); + + FreeLibrary (hLibg); + end + else + Log.LogError('Could not Load Plugin "' + Filename + '": Libary not Loaded'); +end; + +function TDLLMan.LoadPlugin(No: Cardinal): boolean; +begin + Result := False; + //Load Libary + hLib := LoadLibrary(PChar(DLLPath + PluginPaths[No])); + //If Loaded + if (hLib <> 0) then + begin + //Load Info Procedure + @P_Init := GetProcAddress (hLib, PChar('Init')); + @P_Draw := GetProcAddress (hLib, PChar('Draw')); + @P_Finish := GetProcAddress (hLib, PChar('Finish')); + + //If Loaded + if (@P_Init <> nil) And (@P_Draw <> nil) And (@P_Finish <> nil) then + begin + Selected := @Plugins[No]; + Result := True; + end + else + begin + Log.LogError('Could not Load Plugin "' + PluginPaths[No] + '": Procedures not Found'); + + end; + end + else + Log.LogError('Could not Load Plugin "' + PluginPaths[No] + '": Libary not Loaded'); +end; + +procedure TDLLMan.UnLoadPlugin; +begin +if (hLib <> 0) then + FreeLibrary (hLib); + +//Selected := nil; +@P_Init := nil; +@P_Draw := nil; +@P_Finish := nil; +@P_RData := nil; +end; + +function TDLLMan.PluginInit (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: pModi_PlaySound): boolean; +var + Methods: TMethodRec; +begin + Methods.LoadTex := LoadTex; + Methods.Print := Print; + Methods.LoadSound := LoadSound; + Methods.PlaySound := PlaySound; + + if (@P_Init <> nil) then + Result := P_Init (TeamInfo, PlayerInfo, Sentences, Methods) + else + Result := False +end; + +function TDLLMan.PluginDraw (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; +begin +if (@P_Draw <> nil) then + Result := P_Draw (PlayerInfo, CurSentence) +else + Result := False +end; + +function TDLLMan.PluginFinish (var Playerinfo: TPlayerinfo): byte; +begin +if (@P_Finish <> nil) then + Result := P_Finish (PlayerInfo) +else + Result := 0; +end; + +procedure TDLLMan.PluginRData (handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD); +begin +if (@P_RData <> nil) then + P_RData (handle, buffer, len, user); +end; + +end. diff --git a/Game/Code/Classes/UDataBase.pas b/Game/Code/Classes/UDataBase.pas index 009d0d63..deee85c0 100644 --- a/Game/Code/Classes/UDataBase.pas +++ b/Game/Code/Classes/UDataBase.pas @@ -1,299 +1,298 @@ -unit UDataBase; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - -uses USongs, SQLiteTable3; - -//-------------------- -//DataBaseSystem - Class including all DB Methods -//-------------------- -type - TStatResult = record - Case Typ: Byte of - 0: (Singer: ShortString; - Score: Word; - Difficulty: Byte; - SongArtist: ShortString; - SongTitle: ShortString); - - 1: (Player: ShortString; - AverageScore: Word); - - 2: (Artist: ShortString; - Title: ShortString; - TimesSung: Word); - - 3: (ArtistName: ShortString; - TimesSungtot: Word); - end; - AStatResult = Array of TStatResult; - - TDataBaseSystem = class - private - ScoreDB: TSqliteDatabase; - sFilename: string; - public - - - property Filename: String read sFilename; - - Destructor Free; - - Procedure Init(const Filename: string); - procedure ReadScore(var Song: TSong); - procedure AddScore(var Song: TSong; Level: integer; Name: string; Score: integer); - procedure WriteScore(var Song: TSong); - - Function GetStats(var Stats: AStatResult; const Typ, Count: Byte; const Page: Cardinal; const Reversed: Boolean): Boolean; - Function GetTotalEntrys(const Typ: Byte): Cardinal; - end; - -var - DataBase: TDataBaseSystem; - -implementation - -uses IniFiles, SysUtils; - -//-------------------- -//Create - Opens Database and Create Tables if not Exist -//-------------------- - -Procedure TDataBaseSystem.Init(const Filename: string); -begin - //Open Database - ScoreDB := TSqliteDatabase.Create(Filename); - sFilename := Filename; - - try - //Look for Tables => When not exist Create them - if not ScoreDB.TableExists('US_Scores') then - ScoreDB.execsql('CREATE TABLE `US_Scores` (`SongID` INT( 11 ) NOT NULL , `Difficulty` INT( 1 ) NOT NULL , `Player` VARCHAR( 150 ) NOT NULL , `Score` INT( 5 ) NOT NULL );'); - - if not ScoreDB.TableExists('US_Songs') then - ScoreDB.execsql('CREATE TABLE `US_Songs` (`ID` INTEGER PRIMARY KEY, `Artist` VARCHAR( 255 ) NOT NULL , `Title` VARCHAR( 255 ) NOT NULL , `TimesPlayed` int(5) NOT NULL );'); - //Not possible because of String Limitation to 255 Chars //Need to rewrite Wrapper - {if not ScoreDB.TableExists('US_SongCache') then - ScoreDB.ExecSQL('CREATE TABLE `US_SongCache` (`Path` VARCHAR( 255 ) NOT NULL , `Filename` VARCHAR( 255 ) NOT NULL , `Title` VARCHAR( 255 ) NOT NULL , `Artist` VARCHAR( 255 ) NOT NULL , `Folder` VARCHAR( 255 ) NOT NULL , `Genre` VARCHAR( 255 ) NOT NULL , `Edition` VARCHAR( 255 ) NOT NULL , `Language` VARCHAR( 255 ) NOT NULL , `Creator` VARCHAR( 255 ) NOT NULL , `Cover` VARCHAR( 255 ) NOT NULL , `Background` VARCHAR( 255 ) NOT NULL , `Video` VARCHAR( 255 ) NOT NULL , `VideoGap` FLOAT NOT NULL , `Gap` FLOAT NOT NULL , `Start` FLOAT NOT NULL , `Finish` INT( 11 ) NOT NULL , `BPM` INT( 5 ) NOT NULL , `Relative` BOOLEAN NOT NULL , `NotesGap` INT( 11 ) NOT NULL);');} - - - finally - //ScoreDB.Free; - end; - -end; - -//-------------------- -//Free - Frees Database -//-------------------- -Destructor TDataBaseSystem.Free; -begin - ScoreDB.Free; -end; - -//-------------------- -//ReadScore - Read Scores into SongArray -//-------------------- -procedure TDataBaseSystem.ReadScore(var Song: TSong); -var - TableData: TSqliteTable; - Dif: Byte; -begin - //ScoreDB := TSqliteDatabase.Create(sFilename); - try - try - //Search Song in DB - TableData := ScoreDB.GetTable('SELECT `Difficulty`, `Player`, `Score` FROM `us_scores` WHERE `SongID` = (SELECT `ID` FROM `us_songs` WHERE `Artist` = "' + Song.Artist + '" AND `Title` = "' + Song.Title + '" LIMIT 1) ORDER BY `Score` DESC LIMIT 15'); - //Empty Old Scores - SetLength (Song.Score[0], 0); - SetLength (Song.Score[1], 0); - SetLength (Song.Score[2], 0); - - while not TableData.Eof do//Go through all Entrys - begin//Add one Entry to Array - Dif := StrtoInt(TableData.FieldAsString(TableData.FieldIndex['Difficulty'])); - if (Dif>=0) AND (Dif<=2) then - begin - SetLength(Song.Score[Dif], Length(Song.Score[Dif]) + 1); - - Song.Score[Dif, high(Song.Score[Dif])].Name := TableData.FieldAsString(TableData.FieldIndex['Player']); - Song.Score[Dif, high(Song.Score[Dif])].Score:= StrtoInt(TableData.FieldAsString(TableData.FieldIndex['Score'])); - end; - TableData.Next; - end; - - except //Im Fehlerfall - for Dif := 0 to 2 do - begin - SetLength(Song.Score[Dif], 1); - Song.Score[Dif, 1].Name := 'Error Reading ScoreDB'; - end; - end; - finally - //ScoreDb.Free; - end; -end; - -//-------------------- -//AddScore - Add one new Score to DB -//-------------------- -procedure TDataBaseSystem.AddScore(var Song: TSong; Level: integer; Name: string; Score: integer); -var -ID: Integer; -TableData: TSqliteTable; -begin - //ScoreDB := TSqliteDatabase.Create(sFilename); - try - //Prevent 0 Scores from being added - if (Score > 0) then - begin - - ID := ScoreDB.GetTableValue('SELECT `ID` FROM `US_Songs` WHERE `Artist` = "' + Song.Artist + '" AND `Title` = "' + Song.Title + '"'); - if ID = 0 then //Song doesn't exist -> Create - begin - ScoreDB.ExecSQL ('INSERT INTO `US_Songs` ( `ID` , `Artist` , `Title` , `TimesPlayed` ) VALUES (NULL , "' + Song.Artist + '", "' + Song.Title + '", "0");'); - ID := ScoreDB.GetTableValue('SELECT `ID` FROM `US_Songs` WHERE `Artist` = "' + Song.Artist + '" AND `Title` = "' + Song.Title + '"'); - if ID = 0 then //Could not Create Table - exit; - end; - //Create new Entry - ScoreDB.ExecSQL('INSERT INTO `US_Scores` ( `SongID` , `Difficulty` , `Player` , `Score` ) VALUES ("' + InttoStr(ID) + '", "' + InttoStr(Level) + '", "' + Name + '", "' + InttoStr(Score) + '");'); - - //Delete Last Position when there are more than 5 Entrys - if ScoreDB.GetTableValue('SELECT COUNT(`SongID`) FROM `US_Scores` WHERE `SongID` = "' + InttoStr(ID) + '" AND `Difficulty` = "' + InttoStr(Level) +'"') > 5 then - begin - TableData := ScoreDB.GetTable('SELECT `Player`, `Score` FROM `US_Scores` WHERE SongID = "' + InttoStr(ID) + '" AND `Difficulty` = "' + InttoStr(Level) +'" ORDER BY `Score` ASC LIMIT 1'); - ScoreDB.ExecSQL('DELETE FROM `US_Scores` WHERE SongID = "' + InttoStr(ID) + '" AND `Difficulty` = "' + InttoStr(Level) +'" AND `Player` = "' + TableData.FieldAsString(TableData.FieldIndex['Player']) + '" AND `Score` = "' + TableData.FieldAsString(TableData.FieldIndex['Score']) + '"'); - end; - - end; - finally - //ScoreDB.Free; - end; -end; - -//-------------------- -//WriteScore - Not needed with new System; But used for Increment Played Count -//-------------------- -procedure TDataBaseSystem.WriteScore(var Song: TSong); -begin - try - //Increase TimesPlayed - ScoreDB.ExecSQL ('UPDATE `us_songs` SET `TimesPlayed` = `TimesPlayed` + "1" WHERE `Title` = "' + Song.Title + '" AND `Artist` = "' + Song.Artist + '";'); - except - - end; -end; - -//-------------------- -//GetStats - Write some Stats to Array, Returns True if Chossen Page has Entrys -//Case Typ of -//0 - Best Scores -//1 - Best Singers -//2 - Most sung Songs -//3 - Most popular Band -//-------------------- -Function TDataBaseSystem.GetStats(var Stats: AStatResult; const Typ, Count: Byte; const Page: Cardinal; const Reversed: Boolean): Boolean; -var - Query: String; - TableData: TSqliteTable; -begin - Result := False; - - if (Length(Stats) < Count) then - Exit; - - {Todo: - Add Prevention that only Players with more than 5 Scores are Selected at Typ 2} - - //Create Query - Case Typ of - 0: Query := 'SELECT `Player` , `Difficulty` , `Score` , `Artist` , `Title` FROM `US_Scores` INNER JOIN `US_Songs` ON (`SongID` = `ID`) ORDER BY `Score`'; - 1: Query := 'SELECT `Player` , ROUND (Sum(`Score`) / COUNT(`Score`)) FROM `US_Scores` GROUP BY `Player` ORDER BY (Sum(`Score`) / COUNT(`Score`))'; - 2: Query := 'SELECT `Artist` , `Title` , `TimesPlayed` FROM `US_Songs` ORDER BY `TimesPlayed`'; - 3: Query := 'SELECT `Artist` , Sum(`TimesPlayed`) FROM `US_Songs` GROUP BY `Artist` ORDER BY Sum(`TimesPlayed`)'; - end; - - //Add Order Direction - If Reversed then - Query := Query + ' ASC' - else - Query := Query + ' DESC'; - - //Add Limit - Query := Query + ' LIMIT ' + InttoStr(Count * Page) + ', ' + InttoStr(Count) + ';'; - - //Execute Query - //try - TableData := ScoreDB.GetTable(Query); - {except - exit; - end;} - - //if Result empty -> Exit - if (TableData.RowCount < 1) then - exit; - - //Copy Result to Stats Array - while not TableData.Eof do - begin - Stats[TableData.Row].Typ := Typ; - - Case Typ of - 0:begin - Stats[TableData.Row].Singer := TableData.Fields[0]; - - Stats[TableData.Row].Difficulty := StrtoIntDef(TableData.Fields[1], 0); - - Stats[TableData.Row].Score := StrtoIntDef(TableData.Fields[2], 0){TableData.FieldAsInteger(2)}; - Stats[TableData.Row].SongArtist := TableData.Fields[3]; - Stats[TableData.Row].SongTitle := TableData.Fields[4]; - end; - - 1:begin - Stats[TableData.Row].Player := TableData.Fields[0]; - Stats[TableData.Row].AverageScore := StrtoIntDef(TableData.Fields[1], 0); - end; - - 2:begin - Stats[TableData.Row].Artist := TableData.Fields[0]; - Stats[TableData.Row].Title := TableData.Fields[1]; - Stats[TableData.Row].TimesSung := StrtoIntDef(TableData.Fields[2], 0); - end; - - 3:begin - Stats[TableData.Row].ArtistName := TableData.Fields[0]; - Stats[TableData.Row].TimesSungtot := StrtoIntDef(TableData.Fields[1], 0); - end; - - end; - - TableData.Next; - end; - - Result := True; -end; - -//-------------------- -//GetTotalEntrys - Get Total Num of entrys for a Stats Query -//-------------------- -Function TDataBaseSystem.GetTotalEntrys(const Typ: Byte): Cardinal; -var Query: String; -begin - //Create Query - Case Typ of - 0: Query := 'SELECT COUNT(`SongID`) FROM `US_Scores`;'; - 1: Query := 'SELECT COUNT(DISTINCT `Player`) FROM `US_Scores`;'; - 2: Query := 'SELECT COUNT(`ID`) FROM `US_Songs`;'; - 3: Query := 'SELECT COUNT(DISTINCT `Artist`) FROM `US_Songs`;'; - end; - - Result := ScoreDB.GetTableValue(Query); -end; - -end. +unit UDataBase; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +uses USongs, SQLiteTable3; + +//-------------------- +//DataBaseSystem - Class including all DB Methods +//-------------------- +type + TStatResult = record + Case Typ: Byte of + 0: (Singer: ShortString; + Score: Word; + Difficulty: Byte; + SongArtist: ShortString; + SongTitle: ShortString); + + 1: (Player: ShortString; + AverageScore: Word); + + 2: (Artist: ShortString; + Title: ShortString; + TimesSung: Word); + + 3: (ArtistName: ShortString; + TimesSungtot: Word); + end; + AStatResult = Array of TStatResult; + + TDataBaseSystem = class + private + ScoreDB: TSqliteDatabase; + sFilename: string; + public + + + property Filename: String read sFilename; + + Destructor Free; + + Procedure Init(const Filename: string); + procedure ReadScore(var Song: TSong); + procedure AddScore(var Song: TSong; Level: integer; Name: string; Score: integer); + procedure WriteScore(var Song: TSong); + + Function GetStats(var Stats: AStatResult; const Typ, Count: Byte; const Page: Cardinal; const Reversed: Boolean): Boolean; + Function GetTotalEntrys(const Typ: Byte): Cardinal; + end; + +var + DataBase: TDataBaseSystem; + +implementation + +uses IniFiles, SysUtils; + +//-------------------- +//Create - Opens Database and Create Tables if not Exist +//-------------------- + +Procedure TDataBaseSystem.Init(const Filename: string); +begin + //Open Database + ScoreDB := TSqliteDatabase.Create(Filename); + sFilename := Filename; + + try + //Look for Tables => When not exist Create them + if not ScoreDB.TableExists('US_Scores') then + ScoreDB.execsql('CREATE TABLE `US_Scores` (`SongID` INT( 11 ) NOT NULL , `Difficulty` INT( 1 ) NOT NULL , `Player` VARCHAR( 150 ) NOT NULL , `Score` INT( 5 ) NOT NULL );'); + + if not ScoreDB.TableExists('US_Songs') then + ScoreDB.execsql('CREATE TABLE `US_Songs` (`ID` INTEGER PRIMARY KEY, `Artist` VARCHAR( 255 ) NOT NULL , `Title` VARCHAR( 255 ) NOT NULL , `TimesPlayed` int(5) NOT NULL );'); + //Not possible because of String Limitation to 255 Chars //Need to rewrite Wrapper + {if not ScoreDB.TableExists('US_SongCache') then + ScoreDB.ExecSQL('CREATE TABLE `US_SongCache` (`Path` VARCHAR( 255 ) NOT NULL , `Filename` VARCHAR( 255 ) NOT NULL , `Title` VARCHAR( 255 ) NOT NULL , `Artist` VARCHAR( 255 ) NOT NULL , `Folder` VARCHAR( 255 ) NOT NULL , `Genre` VARCHAR( 255 ) NOT NULL , `Edition` VARCHAR( 255 ) NOT NULL , `Language` VARCHAR( 255 ) NOT NULL , `Creator` VARCHAR( 255 ) NOT NULL , `Cover` VARCHAR( 255 ) NOT NULL , `Background` VARCHAR( 255 ) NOT NULL , `Video` VARCHAR( 255 ) NOT NULL , `VideoGap` FLOAT NOT NULL , `Gap` FLOAT NOT NULL , `Start` FLOAT NOT NULL , `Finish` INT( 11 ) NOT NULL , `BPM` INT( 5 ) NOT NULL , `Relative` BOOLEAN NOT NULL , `NotesGap` INT( 11 ) NOT NULL);');} + + + finally + //ScoreDB.Free; + end; + +end; + +//-------------------- +//Free - Frees Database +//-------------------- +Destructor TDataBaseSystem.Free; +begin + ScoreDB.Free; +end; + +//-------------------- +//ReadScore - Read Scores into SongArray +//-------------------- +procedure TDataBaseSystem.ReadScore(var Song: TSong); +var + TableData: TSqliteTable; + Dif: Byte; +begin + //ScoreDB := TSqliteDatabase.Create(sFilename); + try + try + //Search Song in DB + TableData := ScoreDB.GetTable('SELECT `Difficulty`, `Player`, `Score` FROM `us_scores` WHERE `SongID` = (SELECT `ID` FROM `us_songs` WHERE `Artist` = "' + Song.Artist + '" AND `Title` = "' + Song.Title + '" LIMIT 1) ORDER BY `Score` DESC LIMIT 15'); + //Empty Old Scores + SetLength (Song.Score[0], 0); + SetLength (Song.Score[1], 0); + SetLength (Song.Score[2], 0); + + while not TableData.Eof do//Go through all Entrys + begin//Add one Entry to Array + Dif := StrtoInt(TableData.FieldAsString(TableData.FieldIndex['Difficulty'])); + if (Dif>=0) AND (Dif<=2) then + begin + SetLength(Song.Score[Dif], Length(Song.Score[Dif]) + 1); + + Song.Score[Dif, high(Song.Score[Dif])].Name := TableData.FieldAsString(TableData.FieldIndex['Player']); + Song.Score[Dif, high(Song.Score[Dif])].Score:= StrtoInt(TableData.FieldAsString(TableData.FieldIndex['Score'])); + end; + TableData.Next; + end; + + except //Im Fehlerfall + for Dif := 0 to 2 do + begin + SetLength(Song.Score[Dif], 1); + Song.Score[Dif, 1].Name := 'Error Reading ScoreDB'; + end; + end; + finally + //ScoreDb.Free; + end; +end; + +//-------------------- +//AddScore - Add one new Score to DB +//-------------------- +procedure TDataBaseSystem.AddScore(var Song: TSong; Level: integer; Name: string; Score: integer); +var +ID: Integer; +TableData: TSqliteTable; +begin + //ScoreDB := TSqliteDatabase.Create(sFilename); + try + //Prevent 0 Scores from being added + if (Score > 0) then + begin + + ID := ScoreDB.GetTableValue('SELECT `ID` FROM `US_Songs` WHERE `Artist` = "' + Song.Artist + '" AND `Title` = "' + Song.Title + '"'); + if ID = 0 then //Song doesn't exist -> Create + begin + ScoreDB.ExecSQL ('INSERT INTO `US_Songs` ( `ID` , `Artist` , `Title` , `TimesPlayed` ) VALUES (NULL , "' + Song.Artist + '", "' + Song.Title + '", "0");'); + ID := ScoreDB.GetTableValue('SELECT `ID` FROM `US_Songs` WHERE `Artist` = "' + Song.Artist + '" AND `Title` = "' + Song.Title + '"'); + if ID = 0 then //Could not Create Table + exit; + end; + //Create new Entry + ScoreDB.ExecSQL('INSERT INTO `US_Scores` ( `SongID` , `Difficulty` , `Player` , `Score` ) VALUES ("' + InttoStr(ID) + '", "' + InttoStr(Level) + '", "' + Name + '", "' + InttoStr(Score) + '");'); + + //Delete Last Position when there are more than 5 Entrys + if ScoreDB.GetTableValue('SELECT COUNT(`SongID`) FROM `US_Scores` WHERE `SongID` = "' + InttoStr(ID) + '" AND `Difficulty` = "' + InttoStr(Level) +'"') > 5 then + begin + TableData := ScoreDB.GetTable('SELECT `Player`, `Score` FROM `US_Scores` WHERE SongID = "' + InttoStr(ID) + '" AND `Difficulty` = "' + InttoStr(Level) +'" ORDER BY `Score` ASC LIMIT 1'); + ScoreDB.ExecSQL('DELETE FROM `US_Scores` WHERE SongID = "' + InttoStr(ID) + '" AND `Difficulty` = "' + InttoStr(Level) +'" AND `Player` = "' + TableData.FieldAsString(TableData.FieldIndex['Player']) + '" AND `Score` = "' + TableData.FieldAsString(TableData.FieldIndex['Score']) + '"'); + end; + + end; + finally + //ScoreDB.Free; + end; +end; + +//-------------------- +//WriteScore - Not needed with new System; But used for Increment Played Count +//-------------------- +procedure TDataBaseSystem.WriteScore(var Song: TSong); +begin + try + //Increase TimesPlayed + ScoreDB.ExecSQL ('UPDATE `us_songs` SET `TimesPlayed` = `TimesPlayed` + "1" WHERE `Title` = "' + Song.Title + '" AND `Artist` = "' + Song.Artist + '";'); + except + + end; +end; + +//-------------------- +//GetStats - Write some Stats to Array, Returns True if Chossen Page has Entrys +//Case Typ of +//0 - Best Scores +//1 - Best Singers +//2 - Most sung Songs +//3 - Most popular Band +//-------------------- +Function TDataBaseSystem.GetStats(var Stats: AStatResult; const Typ, Count: Byte; const Page: Cardinal; const Reversed: Boolean): Boolean; +var + Query: String; + TableData: TSqliteTable; +begin + Result := False; + + if (Length(Stats) < Count) then + Exit; + + {Todo: Add Prevention that only Players with more than 5 Scores are Selected at Typ 2} + + //Create Query + Case Typ of + 0: Query := 'SELECT `Player` , `Difficulty` , `Score` , `Artist` , `Title` FROM `US_Scores` INNER JOIN `US_Songs` ON (`SongID` = `ID`) ORDER BY `Score`'; + 1: Query := 'SELECT `Player` , ROUND (Sum(`Score`) / COUNT(`Score`)) FROM `US_Scores` GROUP BY `Player` ORDER BY (Sum(`Score`) / COUNT(`Score`))'; + 2: Query := 'SELECT `Artist` , `Title` , `TimesPlayed` FROM `US_Songs` ORDER BY `TimesPlayed`'; + 3: Query := 'SELECT `Artist` , Sum(`TimesPlayed`) FROM `US_Songs` GROUP BY `Artist` ORDER BY Sum(`TimesPlayed`)'; + end; + + //Add Order Direction + If Reversed then + Query := Query + ' ASC' + else + Query := Query + ' DESC'; + + //Add Limit + Query := Query + ' LIMIT ' + InttoStr(Count * Page) + ', ' + InttoStr(Count) + ';'; + + //Execute Query + //try + TableData := ScoreDB.GetTable(Query); + {except + exit; + end;} + + //if Result empty -> Exit + if (TableData.RowCount < 1) then + exit; + + //Copy Result to Stats Array + while not TableData.Eof do + begin + Stats[TableData.Row].Typ := Typ; + + Case Typ of + 0:begin + Stats[TableData.Row].Singer := TableData.Fields[0]; + + Stats[TableData.Row].Difficulty := StrtoIntDef(TableData.Fields[1], 0); + + Stats[TableData.Row].Score := StrtoIntDef(TableData.Fields[2], 0){TableData.FieldAsInteger(2)}; + Stats[TableData.Row].SongArtist := TableData.Fields[3]; + Stats[TableData.Row].SongTitle := TableData.Fields[4]; + end; + + 1:begin + Stats[TableData.Row].Player := TableData.Fields[0]; + Stats[TableData.Row].AverageScore := StrtoIntDef(TableData.Fields[1], 0); + end; + + 2:begin + Stats[TableData.Row].Artist := TableData.Fields[0]; + Stats[TableData.Row].Title := TableData.Fields[1]; + Stats[TableData.Row].TimesSung := StrtoIntDef(TableData.Fields[2], 0); + end; + + 3:begin + Stats[TableData.Row].ArtistName := TableData.Fields[0]; + Stats[TableData.Row].TimesSungtot := StrtoIntDef(TableData.Fields[1], 0); + end; + + end; + + TableData.Next; + end; + + Result := True; +end; + +//-------------------- +//GetTotalEntrys - Get Total Num of entrys for a Stats Query +//-------------------- +Function TDataBaseSystem.GetTotalEntrys(const Typ: Byte): Cardinal; +var Query: String; +begin + //Create Query + Case Typ of + 0: Query := 'SELECT COUNT(`SongID`) FROM `US_Scores`;'; + 1: Query := 'SELECT COUNT(DISTINCT `Player`) FROM `US_Scores`;'; + 2: Query := 'SELECT COUNT(`ID`) FROM `US_Songs`;'; + 3: Query := 'SELECT COUNT(DISTINCT `Artist`) FROM `US_Songs`;'; + end; + + Result := ScoreDB.GetTableValue(Query); +end; + +end. diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index a28f1efc..ef1f2709 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -1,1562 +1,1583 @@ -unit UDraw; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -uses UThemes, - ModiSDK, - UGraphicClasses; - -procedure SingDraw; -procedure SingModiDraw (PlayerInfo: TPlayerInfo); -procedure SingDrawBackground; -procedure SingDrawOscilloscope(X, Y, W, H: real; NrSound: integer); -procedure SingDrawNoteLines(Left, Top, Right: real; Space: integer); -procedure SingDrawBeatDelimeters(Left, Top, Right: real; NrCzesci: integer); -procedure SingDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); -procedure SingDrawPlayerCzesc(X, Y, W: real; NrGracza: integer; Space: integer); -procedure SingDrawPlayerBGCzesc(Left, Top, Right: real; NrCzesci, NrGracza: integer; Space: integer); - -// TimeBar -procedure SingDrawTimeBar(); - -// The Singbar -procedure SingDrawSingbar(X, Y, W, H: real; Percent: integer); - -//Phrasen Bonus - Line Bonus -procedure SingDrawLineBonus( const X, Y: Single; Color: TRGB; Alpha: Single; Text: string; Age: Integer); - -//Draw Editor NoteLines -procedure EditDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); - - -type - TRecR = record - Top: real; - Left: real; - Right: real; - Bottom: real; - - Width: real; - WMid: real; - Height: real; - HMid: real; - - Mid: real; - end; - -var - NotesW: real; - NotesH: real; - Starfr: integer; - StarfrG: integer; - - //SingBar - TickOld: cardinal; - TickOld2:cardinal; - -const - Przedz = 32; - -implementation - -uses Windows, OpenGL12, UGraphic, SysUtils, UMusic, URecord, ULog, UScreenSing, UScreenSingModi, ULyrics, UMain, TextGL, UTexture, UDrawTexture, UIni, Math, UDLLManager; - -procedure SingDrawBackground; -var - Rec: TRecR; - TexRec: TRecR; -begin - if ScreenSing.Tex_Background.TexNum >= 1 then begin - - glClearColor (1, 1, 1, 1); - glColor4f (1, 1, 1, 1); - - 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) * ScreenSing.Tex_Background.TexH; - TexRec.Bottom := (Rec.Bottom / 600) * ScreenSing.Tex_Background.TexH; - TexRec.Left := 0; - TexRec.Right := ScreenSing.Tex_Background.TexW; - - glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, ScreenSing.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) * ScreenSing.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) * ScreenSing.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, ScreenSing.Tex_Background.TexNum); - //glEnable(GL_BLEND); - glBegin(GL_QUADS); - - glTexCoord2f(0, 0); glVertex2f(0, 0); - glTexCoord2f(0, ScreenSing.Tex_Background.TexH); glVertex2f(0, 600); - glTexCoord2f( ScreenSing.Tex_Background.TexW, ScreenSing.Tex_Background.TexH); glVertex2f(800, 600); - glTexCoord2f( ScreenSing.Tex_Background.TexW, 0); glVertex2f(800, 0); - - glEnd; - glDisable(GL_TEXTURE_2D); - //glDisable(GL_BLEND); - end; - end; -end; - -procedure SingDrawOscilloscope(X, Y, W, H: real; NrSound: integer); -var - Pet: integer; -begin; -// Log.LogStatus('Oscilloscope', 'SingDraw'); - glColor3f(Skin_OscR, Skin_OscG, Skin_OscB); - {if (ParamStr(1) = '-black') or (ParamStr(1) = '-fsblack') then - glColor3f(1, 1, 1); } - - glBegin(GL_LINE_STRIP); - glVertex2f(X, -Sound[NrSound].BufferArray[1] / $10000 * H + Y + H/2); - for Pet := 2 to Sound[NrSound].n div 1 do begin - glVertex2f(X + (Pet-1) * W / (Sound[NrSound].n - 1), - -Sound[NrSound].BufferArray[Pet] / $10000 * H + Y + H/2); - end; - glEnd; -end; - -procedure SingDrawNoteLines(Left, Top, Right: real; Space: integer); -var - Pet: integer; -begin - glEnable(GL_BLEND); - glColor4f(Skin_P1_LinesR, Skin_P1_LinesG, Skin_P1_LinesB, 0.4); - glBegin(GL_LINES); - for Pet := 0 to 9 do begin - glVertex2f(Left, Top + Pet * Space); - glVertex2f(Right, Top + Pet * Space); - end; - glEnd; - glDisable(GL_BLEND); -end; - -procedure SingDrawBeatDelimeters(Left, Top, Right: real; NrCzesci: integer); -var - Pet: integer; - TempR: real; -begin - TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); - glEnable(GL_BLEND); - glBegin(GL_LINES); - for Pet := Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote to Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec do begin - if (Pet mod Czesci[NrCzesci].Resolution) = Czesci[NrCzesci].NotesGAP then - glColor4f(0, 0, 0, 1) - else - glColor4f(0, 0, 0, 0.3); - glVertex2f(Left + TempR * (Pet - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote), Top); - glVertex2f(Left + TempR * (Pet - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote), Top + 135); - end; - glEnd; - glDisable(GL_BLEND); -end; - -// draw blank Notebars -procedure SingDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); -var - Rec: TRecR; - Pet: integer; - TempR: real; - R,G,B: real; - - PlayerNumber: Integer; - - GoldenStarPos : real; -begin -// We actually don't have a playernumber in this procedure, it should reside in NrCzesci - but it's always set to zero -// So we exploit this behavior a bit - we give NrCzesci the playernumber, keep it in playernumber - and then we set NrCzesci to zero -// This could also come quite in handy when we do the duet mode, cause just the notes for the player that has to sing should be drawn then -// BUT this is not implemented yet, all notes are drawn! :D - - PlayerNumber := NrCzesci + 1; // Player 1 is 0 - NrCzesci := 0; - -// exploit done - - glColor3f(1, 1, 1); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); - with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin - for Pet := 0 to HighNut do begin - with Nuta[Pet] do begin - if not FreeStyle then begin - - - if Ini.EffectSing = 0 then - // If Golden note Effect of then Change not Color - begin - case Wartosc of - 1: glColor4f(1, 1, 1, 1); // We set alpha to 1, cause we can control the transparency through the png itself - 2: glColor4f(1, 1, 0.3, 1); // no stars, paint yellow -> glColor4f(1, 1, 0.3, 0.85); - we could - end; // case - end //Else all Notes same Color - else - glColor4f(1, 1, 1, 1); // We set alpha to 1, cause we can control the transparency through the png itself - // Czesci == teil, element == piece, element | koniec == ende, schluss - // lewa czesc - left part - Rec.Left := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX; - Rec.Right := Rec.Left + NotesW; - Rec.Top := Top - (Ton-BaseNote)*Space/2 - NotesH; - Rec.Bottom := Rec.Top + 2 * NotesH; - glBindTexture(GL_TEXTURE_2D, Tex_plain_Left[PlayerNumber].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - //We keep the postion of the top left corner b4 it's overwritten - GoldenStarPos := Rec.Left; - //done - - // srodkowa czesc - middle part - Rec.Left := Rec.Right; - Rec.Right := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - NotesW - 0.5 + 10*ScreenX; // Dlugosc == länge - - glBindTexture(GL_TEXTURE_2D, Tex_plain_Mid[PlayerNumber].TexNum); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(round((Rec.Right-Rec.Left)/32), 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(round((Rec.Right-Rec.Left)/32), 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - // prawa czesc - right part - Rec.Left := Rec.Right; - Rec.Right := Rec.Right + NotesW; - - glBindTexture(GL_TEXTURE_2D, Tex_plain_Right[PlayerNumber].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - // Golden Star Patch - if (Wartosc = 2) AND (Ini.EffectSing=1) then - begin - GoldenRec.SaveGoldenStarsRec(GoldenStarPos, Rec.Top, Rec.Right, Rec.Bottom); - end; - - end; // if not FreeStyle - end; // with - end; // for - end; // with - - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); -end; - - -// draw sung notes -procedure SingDrawPlayerCzesc(X, Y, W: real; NrGracza: integer; Space: integer); -var - TempR: real; - Rec: TRecR; - N: integer; - R: real; - G: real; - B: real; - A: real; - NotesH2: real; - begin -// Log.LogStatus('Player notes', 'SingDraw'); - -// if NrGracza = 0 then LoadColor(R, G, B, 'P1Light') -// else LoadColor(R, G, B, 'P2Light'); - -// R := 71/255; -// G := 175/255; -// B := 247/255; - - glColor3f(1, 1, 1); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - if Player[NrGracza].IlNut > 0 then - begin - TempR := W / (Czesci[0].Czesc[Czesci[0].Akt].Koniec - Czesci[0].Czesc[Czesci[0].Akt].StartNote); - for N := 0 to Player[NrGracza].HighNut do - begin - with Player[NrGracza].Nuta[N] do - begin - // Left part of note - Rec.Left := X + (Start-Czesci[0].Czesc[Czesci[0].Akt].StartNote) * TempR + 0.5 + 10*ScreenX; - Rec.Right := Rec.Left + NotesW; - - // Draw it in half size, if not hit - if Hit then - begin - NotesH2 := NotesH - end - else - begin - NotesH2 := int(NotesH * 0.65); - end; - - Rec.Top := Y - (Ton-Czesci[0].Czesc[Czesci[0].Akt].BaseNote)*Space/2 - NotesH2; - Rec.Bottom := Rec.Top + 2 *NotesH2; - - // draw the left part - glColor3f(1, 1, 1); - glBindTexture(GL_TEXTURE_2D, Tex_Left[NrGracza+1].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - // Middle part of the note - Rec.Left := Rec.Right; - Rec.Right := X + (Start+Dlugosc-Czesci[0].Czesc[Czesci[0].Akt].StartNote) * TempR - NotesW - 0.5 + 10*ScreenX; - - // (nowe) - dunno - if (Start+Dlugosc-1 = Czas.AktBeatD) then - Rec.Right := Rec.Right - (1-Frac(Czas.MidBeatD)) * TempR; - // the left note is more right than the right note itself, sounds weird - so we fix that xD - if Rec.Right <= Rec.Left then Rec.Right := Rec.Left; - - // draw the middle part - glBindTexture(GL_TEXTURE_2D, Tex_Mid[NrGracza+1].TexNum); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(round((Rec.Right-Rec.Left)/32), 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(round((Rec.Right-Rec.Left)/32), 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - glColor3f(1, 1, 1); - - // the right part of the note - Rec.Left := Rec.Right; - Rec.Right := Rec.Right + NotesW; - - glBindTexture(GL_TEXTURE_2D, Tex_Right[NrGracza+1].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - // Perfect note is stored - if Perfect and (Ini.EffectSing=1) then - begin - A := 1 - 2*(Czas.Teraz - GetTimeFromBeat(Start+Dlugosc)); - if not (Start+Dlugosc-1 = Czas.AktBeatD) then - - //Star animation counter - //inc(Starfr); - //Starfr := Starfr mod 128; - GoldenRec.SavePerfectNotePos(Rec.Left, Rec.Top); - end; - end; // with - end; // for - // eigentlich brauchen wir hier einen vergleich, um festzustellen, ob wir mit - // singen schon weiter wären, als bei Rec.Right, _auch, wenn nicht gesungen wird_ - - // passing on NrGracza... hope this is really something like the player-number, not only - // some kind of weird index into a colour-table - - if (Ini.EffectSing=1) then - GoldenRec.GoldenNoteTwinkle(Rec.Top,Rec.Bottom,Rec.Right, NrGracza); - end; // if -end; - -//draw Note glow -procedure SingDrawPlayerBGCzesc(Left, Top, Right: real; NrCzesci, NrGracza: integer; Space: integer); -var - Rec: TRecR; - Pet: integer; - TempR: real; - R,G,B: real; - X1, X2, X3, X4: real; - W, H: real; -begin - if (Player[NrGracza].ScoreTotalI >= 0) then begin - glColor4f(1, 1, 1, sqrt((1+sin(Music.Position * 3))/4)/ 2 + 0.5 ); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); - with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin - for Pet := 0 to HighNut do begin - with Nuta[Pet] do begin - if not FreeStyle then begin - // begin: 14, 20 - // easy: 6, 11 - W := NotesW * 2 + 2; - H := NotesH * 1.5 + 3.5; - - X2 := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX + 4; // wciecie - X1 := X2-W; - - X3 := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - 0.5 + 10*ScreenX - 4; // wciecie - X4 := X3+W; - - // left - Rec.Left := X1; - Rec.Right := X2; - Rec.Top := Top - (Ton-BaseNote)*Space/2 - H; - Rec.Bottom := Rec.Top + 2 * H; - - glBindTexture(GL_TEXTURE_2D, Tex_BG_Left[NrGracza+1].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - - // srodkowa czesc - Rec.Left := X2; - Rec.Right := X3; - - glBindTexture(GL_TEXTURE_2D, Tex_BG_Mid[NrGracza+1].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - // prawa czesc - Rec.Left := X3; - Rec.Right := X4; - - glBindTexture(GL_TEXTURE_2D, Tex_BG_Right[NrGracza+1].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - end; // if not FreeStyle - end; // with - end; // for - end; // with - - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - end; -end; - -procedure SingDraw; -var - Pet: integer; - Pet2: integer; - TempR: real; - Rec: TRecR; - TexRec: TRecR; - NR: TRecR; - FS: real; - BarFrom: integer; - BarAlpha: real; - BarWspol: real; - TempCol: real; - Tekst: string; - LyricTemp: string; - PetCz: integer; - - //SingBar Mod - A: Integer; - E: Integer; - I: Integer; - //end Singbar Mod - -begin - // positions - if Ini.SingWindow = 0 then begin - NR.Left := 120; - end else begin - NR.Left := 20; - end; - NR.Right := 780; - - NR.Width := NR.Right - NR.Left; - NR.WMid := NR.Width / 2; - NR.Mid := NR.Left + NR.WMid; - - // background //BG Fullsize Mod - //SingDrawBackground; - - //TimeBar mod - SingDrawTimeBar(); - //eoa TimeBar mod - - // rysuje paski pod nutami - if PlayersPlay = 1 then - SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); - if (PlayersPlay = 2) or (PlayersPlay = 4) then begin - SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P1_NotesB - 105, Nr.Right + 10*ScreenX, 15); - SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); - end; - - if (PlayersPlay = 3) or (PlayersPlay = 6) then begin - SingDrawNoteLines(Nr.Left + 10*ScreenX, 120, Nr.Right + 10*ScreenX, 12); - SingDrawNoteLines(Nr.Left + 10*ScreenX, 245, Nr.Right + 10*ScreenX, 12); - SingDrawNoteLines(Nr.Left + 10*ScreenX, 370, Nr.Right + 10*ScreenX, 12); - end; - - // rysuje tekst - new Lyric engine - ScreenSing.LyricMain.Draw; - ScreenSing.LyricSub.Draw; - - // rysuje pasek, podpowiadajacy poczatek spiwania w scenie - FS := 1.3; - BarFrom := Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start; - if BarFrom > 40 then BarFrom := 40; - if (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start > 8) and // dluga przerwa //16->12 for more help bars and then 12->8 for even more - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat > 0) and // przed tekstem - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat < 40) then begin // ale nie za wczesnie - BarWspol := (Czas.MidBeat - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - BarFrom)) / BarFrom; - Rec.Left := NR.Left + BarWspol * -// (NR.WMid - Czesci[0].Czesc[Czesci[0].Akt].LyricWidth / 2 * FS - 50); - (ScreenSing.LyricMain.ClientX - NR.Left - 50) + 10*ScreenX; - Rec.Right := Rec.Left + 50; - Rec.Top := Skin_LyricsT + 3; - Rec.Bottom := Rec.Top + 33;//SingScreen.LyricMain.Size * 3; -{ // zapalanie - BarAlpha := (BarWspol*10) * 0.5; - if BarAlpha > 0.5 then BarAlpha := 0.5; - - // gaszenie - if BarWspol > 0.95 then BarAlpha := 0.5 * (1 - (BarWspol - 0.95) * 20);} - - //Change fuer Crazy Joker - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, Tex_Lyric_Help_Bar.TexNum); - glBegin(GL_QUADS); - glColor4f(1, 1, 1, 0); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glColor4f(1, 1, 1, 0.5); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - glDisable(GL_BLEND); - - end; - - // oscilloscope - if Ini.Oscilloscope = 1 then begin - if PlayersPlay = 1 then - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - - if PlayersPlay = 2 then begin - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); - end; - if ScreenAct = 2 then begin - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 2); - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 3); - end; - end; - - if PlayersPlay = 3 then begin - SingDrawOscilloscope(75 + 10*ScreenX, 95, 100, 20, 0); - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 0); - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); - end; - if ScreenAct = 2 then begin - SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 3); - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 4); - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 5); - end; - end; - - end - - //SingBar Mod - //modded again to make it moveable: it's working, so why try harder - else if Ini.Oscilloscope = 2 then begin - A := GetTickCount div 33; - if A <> Tickold then begin - Tickold := A; - for E := 0 to (PlayersPlay - 1) do begin //Set new Pos + Alpha - I := Player[E].ScorePercentTarget - Player[E].ScorePercent; - if I > 0 then Inc(Player[E].ScorePercent) - else if I < 0 then Dec(Player[E].ScorePercent); - end; //for - end; //if - - if PlayersPlay = 1 then begin - SingDrawSingbar(Theme.Sing.StaticP1SingBar.x, Theme.Sing.StaticP1SingBar.y, Theme.Sing.StaticP1SingBar.w, Theme.Sing.StaticP1SingBar.h , Player[0].ScorePercent); - end; - - if PlayersPlay = 2 then begin - SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); - end; - - if PlayersPlay = 3 then begin - SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); - end; - if ScreenAct = 2 then begin - SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[2].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[3].ScorePercent); - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); - end; - if ScreenAct = 2 then begin - SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[3].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[4].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[5].ScorePercent); - end; - end; - end; - //end Singbar Mod - - //PhrasenBonus - Line Bonus Mod - if Ini.LineBonus > 0 then begin - A := GetTickCount div 33; - if (A <> Tickold2) AND (Player[0].LineBonus_Visible) then begin - Tickold2 := A; - for E := 0 to (PlayersPlay - 1) do begin - //Change Alpha - Player[E].LineBonus_Alpha := Player[E].LineBonus_Alpha - 0.02; - if Player[E].LineBonus_Alpha <= 0 then - begin - Player[E].LineBonus_Age := 0; - Player[E].LineBonus_Visible := False - end - else - begin - inc(Player[E].LineBonus_Age, 1); - //Change Position - if (Player[E].LineBonus_PosX < Player[E].LineBonus_TargetX) then - Player[E].LineBonus_PosX := Player[E].LineBonus_PosX + (2 - Player[E].LineBonus_Alpha * 1.5) - else if (Player[E].LineBonus_PosX > Player[E].LineBonus_TargetX) then - Player[E].LineBonus_PosX := Player[E].LineBonus_PosX - (2 - Player[E].LineBonus_Alpha * 1.5); - - if (Player[E].LineBonus_PosY < Player[E].LineBonus_TargetY) then - Player[E].LineBonus_PosY := Player[E].LineBonus_PosY + (2 - Player[E].LineBonus_Alpha * 1.5) - else if (Player[E].LineBonus_PosY > Player[E].LineBonus_TargetY) then - Player[E].LineBonus_PosY := Player[E].LineBonus_PosY - (2 - Player[E].LineBonus_Alpha * 1.5); - - end; // shift position of the pop up (if not dead) - end; // loop - for all players - end; // if - linebonus - - - if PlayersPlay = 1 then begin - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - end - - else if PlayersPlay = 2 then begin - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - end - - else if PlayersPlay = 3 then begin - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); - end - - else if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - end; - if ScreenAct = 2 then begin - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); - SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); - end; - if ScreenAct = 2 then begin - SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); - SingDrawLineBonus( Player[4].LineBonus_PosX, Player[4].LineBonus_PosY, Player[4].LineBonus_Color, Player[4].LineBonus_Alpha, Player[4].LineBonus_Text, Player[4].LineBonus_Age); - SingDrawLineBonus( Player[5].LineBonus_PosX, Player[5].LineBonus_PosY, Player[5].LineBonus_Color, Player[5].LineBonus_Alpha, Player[5].LineBonus_Text, Player[5].LineBonus_Age); - end; - end; - end; - //PhrasenBonus - Line Bonus Mod End - -// Set the note heights according to the difficulty level - case Ini.Difficulty of - 0: - begin - NotesH := 11; // 9 - NotesW := 6; // 5 - end; - 1: - begin - NotesH := 8; // 7 - NotesW := 4; // 4 - end; - 2: - begin - NotesH := 5; - NotesW := 3; - end; - end; - -// Draw the Notes - if PlayersPlay = 1 then begin - SingDrawPlayerBGCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 0, 15); // Background glow - colorized in playercolor - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); // Plain unsung notes - colorized in playercolor - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 0, 15); // imho the sung notes - end; - - if (PlayersPlay = 2) then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); - - SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 1, 15); - - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); - end; - - if PlayersPlay = 3 then begin - NotesW := NotesW * 0.8; - NotesH := NotesH * 0.8; - - SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); - - SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); - SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 1, 12); - SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 2, 12); - - SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); - end; - if ScreenAct = 2 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 2, 15); - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 3, 15); - end; - - if ScreenAct = 1 then begin - SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 1, 15); - end; - if ScreenAct = 2 then begin - SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 2, 15); - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 3, 15); - end; - - if ScreenAct = 1 then begin - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); - end; - if ScreenAct = 2 then begin - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 2, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 3, 15); - end; - end; - - if PlayersPlay = 6 then begin - NotesW := NotesW * 0.8; - NotesH := NotesH * 0.8; - - if ScreenAct = 1 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); - end; - if ScreenAct = 2 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 3, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 4, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 5, 12); - end; - - if ScreenAct = 1 then begin - SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); - SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 1, 12); - SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 2, 12); - end; - if ScreenAct = 2 then begin - SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 3, 12); - SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 4, 12); - SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 5, 12); - end; - - if ScreenAct = 1 then begin - SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); - end; - if ScreenAct = 2 then begin - SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 3, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 4, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 5, 12); - end; - end; - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); -end; - -// q'n'd for using the game mode dll's -procedure SingModiDraw (PlayerInfo: TPlayerInfo); -var - Pet: integer; - Pet2: integer; - TempR: real; - Rec: TRecR; - TexRec: TRecR; - NR: TRecR; - FS: real; - BarFrom: integer; - BarAlpha: real; - BarWspol: real; - TempCol: real; - Tekst: string; - LyricTemp: string; - PetCz: integer; - - //SingBar Mod - A: Integer; - E: Integer; - I: Integer; - //end Singbar Mod - -begin - // positions - if Ini.SingWindow = 0 then begin - NR.Left := 120; - end else begin - NR.Left := 20; - end; - - NR.Right := 780; - NR.Width := NR.Right - NR.Left; - NR.WMid := NR.Width / 2; - NR.Mid := NR.Left + NR.WMid; - - // time bar - SingDrawTimeBar(); - - if DLLMan.Selected.ShowNotes then - begin - if PlayersPlay = 1 then - SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); - if (PlayersPlay = 2) or (PlayersPlay = 4) then begin - SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P1_NotesB - 105, Nr.Right + 10*ScreenX, 15); - SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); - end; - - if (PlayersPlay = 3) or (PlayersPlay = 6) then begin - SingDrawNoteLines(Nr.Left + 10*ScreenX, 120, Nr.Right + 10*ScreenX, 12); - SingDrawNoteLines(Nr.Left + 10*ScreenX, 245, Nr.Right + 10*ScreenX, 12); - SingDrawNoteLines(Nr.Left + 10*ScreenX, 370, Nr.Right + 10*ScreenX, 12); - end; - end; - - // Lyric engine - ScreenSingModi.LyricMain.Draw; - ScreenSingModi.LyricSub.Draw; - - // rysuje pasek, podpowiadajacy poczatek spiwania w scenie - FS := 1.3; - BarFrom := Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start; - if BarFrom > 40 then BarFrom := 40; - if (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start > 8) and // dluga przerwa //16->12 for more help bars and then 12->8 for even more - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat > 0) and // przed tekstem - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat < 40) then begin // ale nie za wczesnie - BarWspol := (Czas.MidBeat - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - BarFrom)) / BarFrom; - Rec.Left := NR.Left + BarWspol * (ScreenSingModi.LyricMain.ClientX - NR.Left - 50) + 10*ScreenX; - Rec.Right := Rec.Left + 50; - Rec.Top := Skin_LyricsT + 3; - Rec.Bottom := Rec.Top + 33;//SingScreen.LyricMain.Size * 3; - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, Tex_Lyric_Help_Bar.TexNum); - glBegin(GL_QUADS); - glColor4f(1, 1, 1, 0); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glColor4f(1, 1, 1, 0.5); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - glDisable(GL_BLEND); - end; - - // oscilloscope | the thing that moves when you yell into your mic (imho) - if (((Ini.Oscilloscope = 1) AND (DLLMan.Selected.ShowRateBar_O)) AND (NOT DLLMan.Selected.ShowRateBar)) then begin - if PlayersPlay = 1 then - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - - if PlayersPlay = 2 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); - end; - if ScreenAct = 2 then begin - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 2); - if PlayerInfo.Playerinfo[3].Enabled then - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 3); - end; - end; - - if PlayersPlay = 3 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawOscilloscope(75 + 10*ScreenX, 95, 100, 20, 0); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 0); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); - end; - if ScreenAct = 2 then begin - if PlayerInfo.Playerinfo[3].Enabled then - SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 3); - if PlayerInfo.Playerinfo[4].Enabled then - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 4); - if PlayerInfo.Playerinfo[5].Enabled then - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 5); - end; - end; - - end - - //SingBar Mod - // seems like we don't want the flicker thing, we want the linebonus rating bar beneath the scores - else if ((Ini.Oscilloscope = 2) AND (DLLMan.Selected.ShowRateBar_O)) OR (DLLMan.Selected.ShowRateBar) then begin - A := GetTickCount div 33; - if A <> Tickold then begin - Tickold := A; - for E := 0 to (PlayersPlay - 1) do begin //Set new Pos + Alpha - I := Player[E].ScorePercentTarget - Player[E].ScorePercent; - if I > 0 then Inc(Player[E].ScorePercent) - else if I < 0 then Dec(Player[E].ScorePercent); - end; //for - end; //if - - if PlayersPlay = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawSingbar(Theme.Sing.StaticP1SingBar.x, Theme.Sing.StaticP1SingBar.y, Theme.Sing.StaticP1SingBar.w, Theme.Sing.StaticP1SingBar.h , Player[0].ScorePercent); - end; - - if PlayersPlay = 2 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); - end; - - if PlayersPlay = 3 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); - end; - if ScreenAct = 2 then begin - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[2].ScorePercent); - if PlayerInfo.Playerinfo[3].Enabled then - SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[3].ScorePercent); - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); - end; - if ScreenAct = 2 then begin - if PlayerInfo.Playerinfo[3].Enabled then - SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[3].ScorePercent); - if PlayerInfo.Playerinfo[4].Enabled then - SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[4].ScorePercent); - if PlayerInfo.Playerinfo[5].Enabled then - SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[5].ScorePercent); - end; - end; - end; - //end Singbar Mod - - //PhrasenBonus - Line Bonus Mod - if ((Ini.LineBonus > 0) AND (DLLMan.Selected.EnLineBonus_O)) OR (DLLMan.Selected.EnLineBonus) then begin - A := GetTickCount div 33; - if (A <> Tickold2) AND (Player[0].LineBonus_Visible) then begin - Tickold2 := A; - for E := 0 to (PlayersPlay - 1) do begin - //Change Alpha - Player[E].LineBonus_Alpha := Player[E].LineBonus_Alpha - 0.02; - - if Player[E].LineBonus_Alpha <= 0 then - begin - Player[E].LineBonus_Age := 0; - Player[E].LineBonus_Visible := False - end - else - begin - inc(Player[E].LineBonus_Age, 1); - //Change Position - if (Player[E].LineBonus_PosX < Player[E].LineBonus_TargetX) then // pop up has not yet reached it's position -> blend in - Player[E].LineBonus_PosX := Player[E].LineBonus_PosX + (2 - Player[E].LineBonus_Alpha * 1.5) - else if (Player[E].LineBonus_PosX > Player[E].LineBonus_TargetX) then // pop up has reached it's position -> blend out - Player[E].LineBonus_PosX := Player[E].LineBonus_PosX - (2 - Player[E].LineBonus_Alpha * 1.5); - - if (Player[E].LineBonus_PosY < Player[E].LineBonus_TargetY) then - Player[E].LineBonus_PosY := Player[E].LineBonus_PosY + (2 - Player[E].LineBonus_Alpha * 1.5) - else if (Player[E].LineBonus_PosY > Player[E].LineBonus_TargetY) then - Player[E].LineBonus_PosY := Player[E].LineBonus_PosY - (2 - Player[E].LineBonus_Alpha * 1.5); - - end; // pop up still visible, has not reached it's position - move it - end; // loop through all players - end; // if it's time to draw them - - if PlayersPlay = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - end - - else if PlayersPlay = 2 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - end - - else if PlayersPlay = 3 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); - end - - else if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - end; - if ScreenAct = 2 then begin - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); - if PlayerInfo.Playerinfo[3].Enabled then - SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); - end; - if ScreenAct = 2 then begin - if PlayerInfo.Playerinfo[3].Enabled then - SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); - if PlayerInfo.Playerinfo[4].Enabled then - SingDrawLineBonus( Player[4].LineBonus_PosX, Player[4].LineBonus_PosY, Player[4].LineBonus_Color, Player[4].LineBonus_Alpha, Player[4].LineBonus_Text, Player[4].LineBonus_Age); - if PlayerInfo.Playerinfo[5].Enabled then - SingDrawLineBonus( Player[5].LineBonus_PosX, Player[5].LineBonus_PosY, Player[5].LineBonus_Color, Player[5].LineBonus_Alpha, Player[5].LineBonus_Text, Player[5].LineBonus_Age); - end; - end; - end; -//PhrasenBonus - Line Bonus Mod End - -// resize the notes according to the difficulty level - case Ini.Difficulty of - 0: - begin - NotesH := 11; // 9 - NotesW := 6; // 5 - end; - 1: - begin - NotesH := 8; // 7 - NotesW := 4; // 4 - end; - 2: - begin - NotesH := 5; - NotesW := 3; - end; - end; - - if (DLLMAn.Selected.ShowNotes And DLLMan.Selected.LoadSong) then - begin - if (PlayersPlay = 1) And PlayerInfo.Playerinfo[0].Enabled then begin - SingDrawPlayerBGCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 0, 15); - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 0, 15); - end; - - if (PlayersPlay = 2) then begin - if PlayerInfo.Playerinfo[0].Enabled then - begin - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); - SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); - end; - if PlayerInfo.Playerinfo[1].Enabled then - begin - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); - end; - - end; - - if PlayersPlay = 3 then begin - NotesW := NotesW * 0.8; - NotesH := NotesH * 0.8; - - if PlayerInfo.Playerinfo[0].Enabled then - begin - SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); - SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); - end; - - if PlayerInfo.Playerinfo[1].Enabled then - begin - SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); - SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 0, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); - end; - - if PlayerInfo.Playerinfo[2].Enabled then - begin - SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); - SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 0, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); - end; - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); - end; - if ScreenAct = 2 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 2, 15); - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 3, 15); - end; - - SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); - - if ScreenAct = 1 then begin - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); - end; - if ScreenAct = 2 then begin - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 2, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 3, 15); - end; - end; - - if PlayersPlay = 6 then begin - NotesW := NotesW * 0.8; - NotesH := NotesH * 0.8; - - if ScreenAct = 1 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); - end; - if ScreenAct = 2 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 3, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 4, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 5, 12); - end; - - SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); - SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 0, 12); - SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 0, 12); - - if ScreenAct = 1 then begin - SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); - end; - if ScreenAct = 2 then begin - SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 3, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 4, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 5, 12); - end; - end; - end; - - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); -end; - - -//SingBar Mod -procedure SingDrawSingbar(X, Y, W, H: real; Percent: integer); -var - R: Real; - G: Real; - B: Real; - A: cardinal; - I: Integer; - -begin; - - //SingBar Background - glColor4f(1, 1, 1, 0.8); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Back.TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(X, Y); - glTexCoord2f(0, 1); glVertex2f(X, Y+H); - glTexCoord2f(1, 1); glVertex2f(X+W, Y+H); - glTexCoord2f(1, 0); glVertex2f(X+W, Y); - glEnd; - - //SingBar coloured Bar - Case Percent of - 0..22: begin - R := 1; - G := 0; - B := 0; - end; - 23..42: begin - R := 1; - G := ((Percent-23)/100)*5; - B := 0; - end; - 43..57: begin - R := 1; - G := 1; - B := 0; - end; - 58..77: begin - R := 1-(Percent - 58)/100*5; - G := 1; - B := 0; - end; - 78..99: begin - R := 0; - G := 1; - B := 0; - end; - End; //Case - - glColor4f(R, G, B, 1); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Bar.TexNum); - //Size= Player[PlayerNum].ScorePercent of W - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(X, Y); - glTexCoord2f(0, 1); glVertex2f(X, Y+H); - glTexCoord2f(1, 1); glVertex2f(X+(W/100 * (Percent +1)), Y+H); - glTexCoord2f(1, 0); glVertex2f(X+(W/100 * (Percent +1)), Y); - glEnd; - - //SingBar Front - glColor4f(1, 1, 1, 0.6); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Front.TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(X, Y); - glTexCoord2f(0, 1); glVertex2f(X, Y+H); - glTexCoord2f(1, 1); glVertex2f(X+W, Y+H); - glTexCoord2f(1, 0); glVertex2f(X+W, Y); - glEnd; -end; -//end Singbar Mod - -//PhrasenBonus - Line Bonus Pop Up -procedure SingDrawLineBonus( const X, Y: Single; Color: TRGB; Alpha: Single; Text: string; Age: Integer); -var -Length, X2: Real; //Length of Text -Size: Integer; //Size of Popup -begin -if Alpha <> 0 then -begin - -//Set Font Propertys -SetFontStyle(2); //Font: Outlined1 -if Age < 5 then SetFontSize(Age + 1) else SetFontSize(6); -SetFontItalic(False); - -//Check Font Size -Length := glTextWidth ( PChar(Text)) + 3; //Little Space for a Better Look ^^ - -//Text -SetFontPos (X + 50 - (Length / 2), Y + 12); //Position - - -if Age < 5 then Size := Age * 10 else Size := 50; - - //Draw Background - //glColor4f(Color.R, Color.G, Color.B, Alpha); //Set Color - glColor4f(1, 1, 1, Alpha); - - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - - //New Method, Not Variable - glBindTexture(GL_TEXTURE_2D, Tex_SingLineBonusBack[2].TexNum); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(X + 50 - Size, Y + 25 - (Size/2)); - glTexCoord2f(0, 1); glVertex2f(X + 50 - Size, Y + 25 + (Size/2)); - glTexCoord2f(1, 1); glVertex2f(X + 50 + Size, Y + 25 + (Size/2)); - glTexCoord2f(1, 0); glVertex2f(X + 50 + Size, Y + 25 - (Size/2)); - glEnd; - - glColor4f(1, 1, 1, Alpha); //Set Color - //Draw Text - glPrint (PChar(Text)); -end; -end; -//PhrasenBonus - Line Bonus Mod - -// Draw Note Bars for Editor -//There are 11 Resons for a new Procdedure: -// 1. It don't look good when you Draw the Golden Note Star Effect in the Editor -// 2. You can see the Freestyle Notes in the Editor SemiTransparent -// 3. Its easier and Faster then changing the old Procedure -procedure EditDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); -var - Rec: TRecR; - Pet: integer; - TempR: real; -begin - glColor3f(1, 1, 1); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); - with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin - for Pet := 0 to HighNut do begin - with Nuta[Pet] do begin - - // Golden Note Patch - case Wartosc of - 0: glColor4f(1, 1, 1, 0.35); - 1: glColor4f(1, 1, 1, 0.85); - 2: glColor4f(1, 1, 0.3, 0.85); - end; // case - - - - // lewa czesc - left part - Rec.Left := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX; - Rec.Right := Rec.Left + NotesW; - Rec.Top := Top - (Ton-BaseNote)*Space/2 - NotesH; - Rec.Bottom := Rec.Top + 2 * NotesH; - glBindTexture(GL_TEXTURE_2D, Tex_Left[Color].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - // srodkowa czesc - middle part - Rec.Left := Rec.Right; - Rec.Right := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - NotesW - 0.5 + 10*ScreenX; - - glBindTexture(GL_TEXTURE_2D, Tex_Mid[Color].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - // prawa czesc - right part - Rec.Left := Rec.Right; - Rec.Right := Rec.Right + NotesW; - - glBindTexture(GL_TEXTURE_2D, Tex_Right[Color].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - end; // with - end; // for - end; // with - - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); -end; - -procedure SingDrawTimeBar(); -var x,y: real; - width, height: real; -begin - x := Theme.Sing.StaticTimeProgress.x; - y := Theme.Sing.StaticTimeProgress.y; - width:= Theme.Sing.StaticTimeProgress.w; - height:= Theme.Sing.StaticTimeProgress.h; - - glColor4f(Theme.Sing.StaticTimeProgress.ColR, - Theme.Sing.StaticTimeProgress.ColG, - Theme.Sing.StaticTimeProgress.ColB, 1); //Set Color - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - - glBindTexture(GL_TEXTURE_2D, Tex_TimeProgress.TexNum); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(x,y); - glTexCoord2f((width*(Czas.Teraz/Czas.Razem))/8, 0); glVertex2f(x+width*(Czas.Teraz/Czas.Razem), y); - glTexCoord2f((width*(Czas.Teraz/Czas.Razem))/8, 1); glVertex2f(x+width*(Czas.Teraz/Czas.Razem), y+height); - glTexCoord2f(0, 1); glVertex2f(x, y+height); - glEnd; - - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glcolor4f(1,1,1,1); -end; - -end. - +unit UDraw; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses UThemes, + ModiSDK, + UGraphicClasses; + +procedure SingDraw; +procedure SingModiDraw (PlayerInfo: TPlayerInfo); +procedure SingDrawBackground; +procedure SingDrawOscilloscope(X, Y, W, H: real; NrSound: integer); +procedure SingDrawNoteLines(Left, Top, Right: real; Space: integer); +procedure SingDrawBeatDelimeters(Left, Top, Right: real; NrCzesci: integer); +procedure SingDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); +procedure SingDrawPlayerCzesc(X, Y, W: real; NrGracza: integer; Space: integer); +procedure SingDrawPlayerBGCzesc(Left, Top, Right: real; NrCzesci, NrGracza: integer; Space: integer); + +// TimeBar +procedure SingDrawTimeBar(); + +// The Singbar +procedure SingDrawSingbar(X, Y, W, H: real; Percent: integer); + +//Phrasen Bonus - Line Bonus +procedure SingDrawLineBonus( const X, Y: Single; Color: TRGB; Alpha: Single; Text: string; Age: Integer); + +//Draw Editor NoteLines +procedure EditDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); + + +type + TRecR = record + Top: real; + Left: real; + Right: real; + Bottom: real; + + Width: real; + WMid: real; + Height: real; + HMid: real; + + Mid: real; + end; + +var + NotesW: real; + NotesH: real; + Starfr: integer; + StarfrG: integer; + + //SingBar + TickOld: cardinal; + TickOld2:cardinal; + +const + Przedz = 32; + +implementation + +uses {$IFDEF Win32} + windows, + {$ELSE} + lclintf, + {$ENDIF} + OpenGL12, + UGraphic, + SysUtils, + UMusic, + URecord, + ULog, + UScreenSing, + UScreenSingModi, + ULyrics, + UMain, + TextGL, + UTexture, + UDrawTexture, + UIni, + Math, + UDLLManager; + +procedure SingDrawBackground; +var + Rec: TRecR; + TexRec: TRecR; +begin + if ScreenSing.Tex_Background.TexNum >= 1 then begin + + glClearColor (1, 1, 1, 1); + glColor4f (1, 1, 1, 1); + + 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) * ScreenSing.Tex_Background.TexH; + TexRec.Bottom := (Rec.Bottom / 600) * ScreenSing.Tex_Background.TexH; + TexRec.Left := 0; + TexRec.Right := ScreenSing.Tex_Background.TexW; + + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, ScreenSing.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) * ScreenSing.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) * ScreenSing.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, ScreenSing.Tex_Background.TexNum); + //glEnable(GL_BLEND); + glBegin(GL_QUADS); + + glTexCoord2f(0, 0); glVertex2f(0, 0); + glTexCoord2f(0, ScreenSing.Tex_Background.TexH); glVertex2f(0, 600); + glTexCoord2f( ScreenSing.Tex_Background.TexW, ScreenSing.Tex_Background.TexH); glVertex2f(800, 600); + glTexCoord2f( ScreenSing.Tex_Background.TexW, 0); glVertex2f(800, 0); + + glEnd; + glDisable(GL_TEXTURE_2D); + //glDisable(GL_BLEND); + end; + end; +end; + +procedure SingDrawOscilloscope(X, Y, W, H: real; NrSound: integer); +var + Pet: integer; +begin; +// Log.LogStatus('Oscilloscope', 'SingDraw'); + glColor3f(Skin_OscR, Skin_OscG, Skin_OscB); + {if (ParamStr(1) = '-black') or (ParamStr(1) = '-fsblack') then + glColor3f(1, 1, 1); } + + glBegin(GL_LINE_STRIP); + glVertex2f(X, -Sound[NrSound].BufferArray[1] / $10000 * H + Y + H/2); + for Pet := 2 to Sound[NrSound].n div 1 do begin + glVertex2f(X + (Pet-1) * W / (Sound[NrSound].n - 1), + -Sound[NrSound].BufferArray[Pet] / $10000 * H + Y + H/2); + end; + glEnd; +end; + +procedure SingDrawNoteLines(Left, Top, Right: real; Space: integer); +var + Pet: integer; +begin + glEnable(GL_BLEND); + glColor4f(Skin_P1_LinesR, Skin_P1_LinesG, Skin_P1_LinesB, 0.4); + glBegin(GL_LINES); + for Pet := 0 to 9 do begin + glVertex2f(Left, Top + Pet * Space); + glVertex2f(Right, Top + Pet * Space); + end; + glEnd; + glDisable(GL_BLEND); +end; + +procedure SingDrawBeatDelimeters(Left, Top, Right: real; NrCzesci: integer); +var + Pet: integer; + TempR: real; +begin + TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); + glEnable(GL_BLEND); + glBegin(GL_LINES); + for Pet := Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote to Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec do begin + if (Pet mod Czesci[NrCzesci].Resolution) = Czesci[NrCzesci].NotesGAP then + glColor4f(0, 0, 0, 1) + else + glColor4f(0, 0, 0, 0.3); + glVertex2f(Left + TempR * (Pet - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote), Top); + glVertex2f(Left + TempR * (Pet - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote), Top + 135); + end; + glEnd; + glDisable(GL_BLEND); +end; + +// draw blank Notebars +procedure SingDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); +var + Rec: TRecR; + Pet: integer; + TempR: real; + R,G,B: real; + + PlayerNumber: Integer; + + GoldenStarPos : real; +begin +// We actually don't have a playernumber in this procedure, it should reside in NrCzesci - but it's always set to zero +// So we exploit this behavior a bit - we give NrCzesci the playernumber, keep it in playernumber - and then we set NrCzesci to zero +// This could also come quite in handy when we do the duet mode, cause just the notes for the player that has to sing should be drawn then +// BUT this is not implemented yet, all notes are drawn! :D + + PlayerNumber := NrCzesci + 1; // Player 1 is 0 + NrCzesci := 0; + +// exploit done + + glColor3f(1, 1, 1); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); + with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin + for Pet := 0 to HighNut do begin + with Nuta[Pet] do begin + if not FreeStyle then begin + + + if Ini.EffectSing = 0 then + // If Golden note Effect of then Change not Color + begin + case Wartosc of + 1: glColor4f(1, 1, 1, 1); // We set alpha to 1, cause we can control the transparency through the png itself + 2: glColor4f(1, 1, 0.3, 1); // no stars, paint yellow -> glColor4f(1, 1, 0.3, 0.85); - we could + end; // case + end //Else all Notes same Color + else + glColor4f(1, 1, 1, 1); // We set alpha to 1, cause we can control the transparency through the png itself + // Czesci == teil, element == piece, element | koniec == ende, schluss + // lewa czesc - left part + Rec.Left := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX; + Rec.Right := Rec.Left + NotesW; + Rec.Top := Top - (Ton-BaseNote)*Space/2 - NotesH; + Rec.Bottom := Rec.Top + 2 * NotesH; + glBindTexture(GL_TEXTURE_2D, Tex_plain_Left[PlayerNumber].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + //We keep the postion of the top left corner b4 it's overwritten + GoldenStarPos := Rec.Left; + //done + + // srodkowa czesc - middle part + Rec.Left := Rec.Right; + Rec.Right := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - NotesW - 0.5 + 10*ScreenX; // Dlugosc == länge + + glBindTexture(GL_TEXTURE_2D, Tex_plain_Mid[PlayerNumber].TexNum); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(round((Rec.Right-Rec.Left)/32), 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(round((Rec.Right-Rec.Left)/32), 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // prawa czesc - right part + Rec.Left := Rec.Right; + Rec.Right := Rec.Right + NotesW; + + glBindTexture(GL_TEXTURE_2D, Tex_plain_Right[PlayerNumber].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // Golden Star Patch + if (Wartosc = 2) AND (Ini.EffectSing=1) then + begin + GoldenRec.SaveGoldenStarsRec(GoldenStarPos, Rec.Top, Rec.Right, Rec.Bottom); + end; + + end; // if not FreeStyle + end; // with + end; // for + end; // with + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); +end; + + +// draw sung notes +procedure SingDrawPlayerCzesc(X, Y, W: real; NrGracza: integer; Space: integer); +var + TempR: real; + Rec: TRecR; + N: integer; + R: real; + G: real; + B: real; + A: real; + NotesH2: real; + begin +// Log.LogStatus('Player notes', 'SingDraw'); + +// if NrGracza = 0 then LoadColor(R, G, B, 'P1Light') +// else LoadColor(R, G, B, 'P2Light'); + +// R := 71/255; +// G := 175/255; +// B := 247/255; + + glColor3f(1, 1, 1); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + if Player[NrGracza].IlNut > 0 then + begin + TempR := W / (Czesci[0].Czesc[Czesci[0].Akt].Koniec - Czesci[0].Czesc[Czesci[0].Akt].StartNote); + for N := 0 to Player[NrGracza].HighNut do + begin + with Player[NrGracza].Nuta[N] do + begin + // Left part of note + Rec.Left := X + (Start-Czesci[0].Czesc[Czesci[0].Akt].StartNote) * TempR + 0.5 + 10*ScreenX; + Rec.Right := Rec.Left + NotesW; + + // Draw it in half size, if not hit + if Hit then + begin + NotesH2 := NotesH + end + else + begin + NotesH2 := int(NotesH * 0.65); + end; + + Rec.Top := Y - (Ton-Czesci[0].Czesc[Czesci[0].Akt].BaseNote)*Space/2 - NotesH2; + Rec.Bottom := Rec.Top + 2 *NotesH2; + + // draw the left part + glColor3f(1, 1, 1); + glBindTexture(GL_TEXTURE_2D, Tex_Left[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // Middle part of the note + Rec.Left := Rec.Right; + Rec.Right := X + (Start+Dlugosc-Czesci[0].Czesc[Czesci[0].Akt].StartNote) * TempR - NotesW - 0.5 + 10*ScreenX; + + // (nowe) - dunno + if (Start+Dlugosc-1 = Czas.AktBeatD) then + Rec.Right := Rec.Right - (1-Frac(Czas.MidBeatD)) * TempR; + // the left note is more right than the right note itself, sounds weird - so we fix that xD + if Rec.Right <= Rec.Left then Rec.Right := Rec.Left; + + // draw the middle part + glBindTexture(GL_TEXTURE_2D, Tex_Mid[NrGracza+1].TexNum); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(round((Rec.Right-Rec.Left)/32), 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(round((Rec.Right-Rec.Left)/32), 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + glColor3f(1, 1, 1); + + // the right part of the note + Rec.Left := Rec.Right; + Rec.Right := Rec.Right + NotesW; + + glBindTexture(GL_TEXTURE_2D, Tex_Right[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // Perfect note is stored + if Perfect and (Ini.EffectSing=1) then + begin + A := 1 - 2*(Czas.Teraz - GetTimeFromBeat(Start+Dlugosc)); + if not (Start+Dlugosc-1 = Czas.AktBeatD) then + + //Star animation counter + //inc(Starfr); + //Starfr := Starfr mod 128; + GoldenRec.SavePerfectNotePos(Rec.Left, Rec.Top); + end; + end; // with + end; // for + // eigentlich brauchen wir hier einen vergleich, um festzustellen, ob wir mit + // singen schon weiter wären, als bei Rec.Right, _auch, wenn nicht gesungen wird_ + + // passing on NrGracza... hope this is really something like the player-number, not only + // some kind of weird index into a colour-table + + if (Ini.EffectSing=1) then + GoldenRec.GoldenNoteTwinkle(Rec.Top,Rec.Bottom,Rec.Right, NrGracza); + end; // if +end; + +//draw Note glow +procedure SingDrawPlayerBGCzesc(Left, Top, Right: real; NrCzesci, NrGracza: integer; Space: integer); +var + Rec: TRecR; + Pet: integer; + TempR: real; + R,G,B: real; + X1, X2, X3, X4: real; + W, H: real; +begin + if (Player[NrGracza].ScoreTotalI >= 0) then begin + glColor4f(1, 1, 1, sqrt((1+sin(Music.Position * 3))/4)/ 2 + 0.5 ); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); + with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin + for Pet := 0 to HighNut do begin + with Nuta[Pet] do begin + if not FreeStyle then begin + // begin: 14, 20 + // easy: 6, 11 + W := NotesW * 2 + 2; + H := NotesH * 1.5 + 3.5; + + X2 := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX + 4; // wciecie + X1 := X2-W; + + X3 := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - 0.5 + 10*ScreenX - 4; // wciecie + X4 := X3+W; + + // left + Rec.Left := X1; + Rec.Right := X2; + Rec.Top := Top - (Ton-BaseNote)*Space/2 - H; + Rec.Bottom := Rec.Top + 2 * H; + + glBindTexture(GL_TEXTURE_2D, Tex_BG_Left[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + + // srodkowa czesc + Rec.Left := X2; + Rec.Right := X3; + + glBindTexture(GL_TEXTURE_2D, Tex_BG_Mid[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // prawa czesc + Rec.Left := X3; + Rec.Right := X4; + + glBindTexture(GL_TEXTURE_2D, Tex_BG_Right[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + end; // if not FreeStyle + end; // with + end; // for + end; // with + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + end; +end; + +procedure SingDraw; +var + Pet: integer; + Pet2: integer; + TempR: real; + Rec: TRecR; + TexRec: TRecR; + NR: TRecR; + FS: real; + BarFrom: integer; + BarAlpha: real; + BarWspol: real; + TempCol: real; + Tekst: string; + LyricTemp: string; + PetCz: integer; + + //SingBar Mod + A: Integer; + E: Integer; + I: Integer; + //end Singbar Mod + +begin + // positions + if Ini.SingWindow = 0 then begin + NR.Left := 120; + end else begin + NR.Left := 20; + end; + NR.Right := 780; + + NR.Width := NR.Right - NR.Left; + NR.WMid := NR.Width / 2; + NR.Mid := NR.Left + NR.WMid; + + // background //BG Fullsize Mod + //SingDrawBackground; + + //TimeBar mod + SingDrawTimeBar(); + //eoa TimeBar mod + + // rysuje paski pod nutami + if PlayersPlay = 1 then + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); + if (PlayersPlay = 2) or (PlayersPlay = 4) then begin + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P1_NotesB - 105, Nr.Right + 10*ScreenX, 15); + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); + end; + + if (PlayersPlay = 3) or (PlayersPlay = 6) then begin + SingDrawNoteLines(Nr.Left + 10*ScreenX, 120, Nr.Right + 10*ScreenX, 12); + SingDrawNoteLines(Nr.Left + 10*ScreenX, 245, Nr.Right + 10*ScreenX, 12); + SingDrawNoteLines(Nr.Left + 10*ScreenX, 370, Nr.Right + 10*ScreenX, 12); + end; + + // rysuje tekst - new Lyric engine + ScreenSing.LyricMain.Draw; + ScreenSing.LyricSub.Draw; + + // rysuje pasek, podpowiadajacy poczatek spiwania w scenie + FS := 1.3; + BarFrom := Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start; + if BarFrom > 40 then BarFrom := 40; + if (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start > 8) and // dluga przerwa //16->12 for more help bars and then 12->8 for even more + (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat > 0) and // przed tekstem + (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat < 40) then begin // ale nie za wczesnie + BarWspol := (Czas.MidBeat - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - BarFrom)) / BarFrom; + Rec.Left := NR.Left + BarWspol * +// (NR.WMid - Czesci[0].Czesc[Czesci[0].Akt].LyricWidth / 2 * FS - 50); + (ScreenSing.LyricMain.ClientX - NR.Left - 50) + 10*ScreenX; + Rec.Right := Rec.Left + 50; + Rec.Top := Skin_LyricsT + 3; + Rec.Bottom := Rec.Top + 33;//SingScreen.LyricMain.Size * 3; +{ // zapalanie + BarAlpha := (BarWspol*10) * 0.5; + if BarAlpha > 0.5 then BarAlpha := 0.5; + + // gaszenie + if BarWspol > 0.95 then BarAlpha := 0.5 * (1 - (BarWspol - 0.95) * 20);} + + //Change fuer Crazy Joker + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_Lyric_Help_Bar.TexNum); + glBegin(GL_QUADS); + glColor4f(1, 1, 1, 0); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glColor4f(1, 1, 1, 0.5); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + glDisable(GL_BLEND); + + end; + + // oscilloscope + if Ini.Oscilloscope = 1 then begin + if PlayersPlay = 1 then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + + if PlayersPlay = 2 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + if ScreenAct = 2 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 2); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 3); + end; + end; + + if PlayersPlay = 3 then begin + SingDrawOscilloscope(75 + 10*ScreenX, 95, 100, 20, 0); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 0); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + if ScreenAct = 2 then begin + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 3); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 4); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 5); + end; + end; + + end + + //SingBar Mod + //modded again to make it moveable: it's working, so why try harder + else if Ini.Oscilloscope = 2 then + begin + A := GetTickCount div 33; + if A <> Tickold then begin + Tickold := A; + for E := 0 to (PlayersPlay - 1) do begin //Set new Pos + Alpha + I := Player[E].ScorePercentTarget - Player[E].ScorePercent; + if I > 0 then Inc(Player[E].ScorePercent) + else if I < 0 then Dec(Player[E].ScorePercent); + end; //for + end; //if + + if PlayersPlay = 1 then begin + SingDrawSingbar(Theme.Sing.StaticP1SingBar.x, Theme.Sing.StaticP1SingBar.y, Theme.Sing.StaticP1SingBar.w, Theme.Sing.StaticP1SingBar.h , Player[0].ScorePercent); + end; + + if PlayersPlay = 2 then begin + SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); + end; + + if PlayersPlay = 3 then begin + SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); + end; + if ScreenAct = 2 then begin + SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[2].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[3].ScorePercent); + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); + end; + if ScreenAct = 2 then begin + SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[3].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[4].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[5].ScorePercent); + end; + end; + end; + //end Singbar Mod + + //PhrasenBonus - Line Bonus Mod + if Ini.LineBonus > 0 then begin + A := GetTickCount div 33; + if (A <> Tickold2) AND (Player[0].LineBonus_Visible) then begin + Tickold2 := A; + for E := 0 to (PlayersPlay - 1) do begin + //Change Alpha + Player[E].LineBonus_Alpha := Player[E].LineBonus_Alpha - 0.02; + if Player[E].LineBonus_Alpha <= 0 then + begin + Player[E].LineBonus_Age := 0; + Player[E].LineBonus_Visible := False + end + else + begin + inc(Player[E].LineBonus_Age, 1); + //Change Position + if (Player[E].LineBonus_PosX < Player[E].LineBonus_TargetX) then + Player[E].LineBonus_PosX := Player[E].LineBonus_PosX + (2 - Player[E].LineBonus_Alpha * 1.5) + else if (Player[E].LineBonus_PosX > Player[E].LineBonus_TargetX) then + Player[E].LineBonus_PosX := Player[E].LineBonus_PosX - (2 - Player[E].LineBonus_Alpha * 1.5); + + if (Player[E].LineBonus_PosY < Player[E].LineBonus_TargetY) then + Player[E].LineBonus_PosY := Player[E].LineBonus_PosY + (2 - Player[E].LineBonus_Alpha * 1.5) + else if (Player[E].LineBonus_PosY > Player[E].LineBonus_TargetY) then + Player[E].LineBonus_PosY := Player[E].LineBonus_PosY - (2 - Player[E].LineBonus_Alpha * 1.5); + + end; // shift position of the pop up (if not dead) + end; // loop - for all players + end; // if - linebonus + + + if PlayersPlay = 1 then begin + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + end + + else if PlayersPlay = 2 then begin + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); + end + + else if PlayersPlay = 3 then begin + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); + end + + else if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); + end; + if ScreenAct = 2 then begin + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); + SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); + end; + if ScreenAct = 2 then begin + SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); + SingDrawLineBonus( Player[4].LineBonus_PosX, Player[4].LineBonus_PosY, Player[4].LineBonus_Color, Player[4].LineBonus_Alpha, Player[4].LineBonus_Text, Player[4].LineBonus_Age); + SingDrawLineBonus( Player[5].LineBonus_PosX, Player[5].LineBonus_PosY, Player[5].LineBonus_Color, Player[5].LineBonus_Alpha, Player[5].LineBonus_Text, Player[5].LineBonus_Age); + end; + end; + end; + //PhrasenBonus - Line Bonus Mod End + +// Set the note heights according to the difficulty level + case Ini.Difficulty of + 0: + begin + NotesH := 11; // 9 + NotesW := 6; // 5 + end; + 1: + begin + NotesH := 8; // 7 + NotesW := 4; // 4 + end; + 2: + begin + NotesH := 5; + NotesW := 3; + end; + end; + +// Draw the Notes + if PlayersPlay = 1 then begin + SingDrawPlayerBGCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 0, 15); // Background glow - colorized in playercolor + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); // Plain unsung notes - colorized in playercolor + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 0, 15); // imho the sung notes + end; + + if (PlayersPlay = 2) then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); + + SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 1, 15); + + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); + end; + + if PlayersPlay = 3 then begin + NotesW := NotesW * 0.8; + NotesH := NotesH * 0.8; + + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); + + SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); + SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 1, 12); + SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 2, 12); + + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); + end; + if ScreenAct = 2 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 2, 15); + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 3, 15); + end; + + if ScreenAct = 1 then begin + SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 1, 15); + end; + if ScreenAct = 2 then begin + SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 2, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 3, 15); + end; + + if ScreenAct = 1 then begin + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); + end; + if ScreenAct = 2 then begin + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 2, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 3, 15); + end; + end; + + if PlayersPlay = 6 then begin + NotesW := NotesW * 0.8; + NotesH := NotesH * 0.8; + + if ScreenAct = 1 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); + end; + if ScreenAct = 2 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 3, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 4, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 5, 12); + end; + + if ScreenAct = 1 then begin + SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); + SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 1, 12); + SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 2, 12); + end; + if ScreenAct = 2 then begin + SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 3, 12); + SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 4, 12); + SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 5, 12); + end; + + if ScreenAct = 1 then begin + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); + end; + if ScreenAct = 2 then begin + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 3, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 4, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 5, 12); + end; + end; + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); +end; + +// q'n'd for using the game mode dll's +procedure SingModiDraw (PlayerInfo: TPlayerInfo); +var + Pet: integer; + Pet2: integer; + TempR: real; + Rec: TRecR; + TexRec: TRecR; + NR: TRecR; + FS: real; + BarFrom: integer; + BarAlpha: real; + BarWspol: real; + TempCol: real; + Tekst: string; + LyricTemp: string; + PetCz: integer; + + //SingBar Mod + A: Integer; + E: Integer; + I: Integer; + //end Singbar Mod + +begin + // positions + if Ini.SingWindow = 0 then begin + NR.Left := 120; + end else begin + NR.Left := 20; + end; + + NR.Right := 780; + NR.Width := NR.Right - NR.Left; + NR.WMid := NR.Width / 2; + NR.Mid := NR.Left + NR.WMid; + + // time bar + SingDrawTimeBar(); + + if DLLMan.Selected.ShowNotes then + begin + if PlayersPlay = 1 then + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); + if (PlayersPlay = 2) or (PlayersPlay = 4) then begin + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P1_NotesB - 105, Nr.Right + 10*ScreenX, 15); + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); + end; + + if (PlayersPlay = 3) or (PlayersPlay = 6) then begin + SingDrawNoteLines(Nr.Left + 10*ScreenX, 120, Nr.Right + 10*ScreenX, 12); + SingDrawNoteLines(Nr.Left + 10*ScreenX, 245, Nr.Right + 10*ScreenX, 12); + SingDrawNoteLines(Nr.Left + 10*ScreenX, 370, Nr.Right + 10*ScreenX, 12); + end; + end; + + // Lyric engine + ScreenSingModi.LyricMain.Draw; + ScreenSingModi.LyricSub.Draw; + + // rysuje pasek, podpowiadajacy poczatek spiwania w scenie + FS := 1.3; + BarFrom := Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start; + if BarFrom > 40 then BarFrom := 40; + if (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start > 8) and // dluga przerwa //16->12 for more help bars and then 12->8 for even more + (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat > 0) and // przed tekstem + (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat < 40) then begin // ale nie za wczesnie + BarWspol := (Czas.MidBeat - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - BarFrom)) / BarFrom; + Rec.Left := NR.Left + BarWspol * (ScreenSingModi.LyricMain.ClientX - NR.Left - 50) + 10*ScreenX; + Rec.Right := Rec.Left + 50; + Rec.Top := Skin_LyricsT + 3; + Rec.Bottom := Rec.Top + 33;//SingScreen.LyricMain.Size * 3; + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_Lyric_Help_Bar.TexNum); + glBegin(GL_QUADS); + glColor4f(1, 1, 1, 0); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glColor4f(1, 1, 1, 0.5); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + glDisable(GL_BLEND); + end; + + // oscilloscope | the thing that moves when you yell into your mic (imho) + if (((Ini.Oscilloscope = 1) AND (DLLMan.Selected.ShowRateBar_O)) AND (NOT DLLMan.Selected.ShowRateBar)) then begin + if PlayersPlay = 1 then + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + + if PlayersPlay = 2 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + if ScreenAct = 2 then begin + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 2); + if PlayerInfo.Playerinfo[3].Enabled then + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 3); + end; + end; + + if PlayersPlay = 3 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawOscilloscope(75 + 10*ScreenX, 95, 100, 20, 0); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 0); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + if ScreenAct = 2 then begin + if PlayerInfo.Playerinfo[3].Enabled then + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 3); + if PlayerInfo.Playerinfo[4].Enabled then + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 4); + if PlayerInfo.Playerinfo[5].Enabled then + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 5); + end; + end; + + end + + //SingBar Mod + // seems like we don't want the flicker thing, we want the linebonus rating bar beneath the scores + else if ((Ini.Oscilloscope = 2) AND (DLLMan.Selected.ShowRateBar_O)) OR (DLLMan.Selected.ShowRateBar) then begin + A := GetTickCount div 33; + if A <> Tickold then begin + Tickold := A; + for E := 0 to (PlayersPlay - 1) do begin //Set new Pos + Alpha + I := Player[E].ScorePercentTarget - Player[E].ScorePercent; + if I > 0 then Inc(Player[E].ScorePercent) + else if I < 0 then Dec(Player[E].ScorePercent); + end; //for + end; //if + + if PlayersPlay = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawSingbar(Theme.Sing.StaticP1SingBar.x, Theme.Sing.StaticP1SingBar.y, Theme.Sing.StaticP1SingBar.w, Theme.Sing.StaticP1SingBar.h , Player[0].ScorePercent); + end; + + if PlayersPlay = 2 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); + end; + + if PlayersPlay = 3 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); + end; + if ScreenAct = 2 then begin + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[2].ScorePercent); + if PlayerInfo.Playerinfo[3].Enabled then + SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[3].ScorePercent); + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); + end; + if ScreenAct = 2 then begin + if PlayerInfo.Playerinfo[3].Enabled then + SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[3].ScorePercent); + if PlayerInfo.Playerinfo[4].Enabled then + SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[4].ScorePercent); + if PlayerInfo.Playerinfo[5].Enabled then + SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[5].ScorePercent); + end; + end; + end; + //end Singbar Mod + + //PhrasenBonus - Line Bonus Mod + if ((Ini.LineBonus > 0) AND (DLLMan.Selected.EnLineBonus_O)) OR (DLLMan.Selected.EnLineBonus) then begin + A := GetTickCount div 33; + if (A <> Tickold2) AND (Player[0].LineBonus_Visible) then begin + Tickold2 := A; + for E := 0 to (PlayersPlay - 1) do begin + //Change Alpha + Player[E].LineBonus_Alpha := Player[E].LineBonus_Alpha - 0.02; + + if Player[E].LineBonus_Alpha <= 0 then + begin + Player[E].LineBonus_Age := 0; + Player[E].LineBonus_Visible := False + end + else + begin + inc(Player[E].LineBonus_Age, 1); + //Change Position + if (Player[E].LineBonus_PosX < Player[E].LineBonus_TargetX) then // pop up has not yet reached it's position -> blend in + Player[E].LineBonus_PosX := Player[E].LineBonus_PosX + (2 - Player[E].LineBonus_Alpha * 1.5) + else if (Player[E].LineBonus_PosX > Player[E].LineBonus_TargetX) then // pop up has reached it's position -> blend out + Player[E].LineBonus_PosX := Player[E].LineBonus_PosX - (2 - Player[E].LineBonus_Alpha * 1.5); + + if (Player[E].LineBonus_PosY < Player[E].LineBonus_TargetY) then + Player[E].LineBonus_PosY := Player[E].LineBonus_PosY + (2 - Player[E].LineBonus_Alpha * 1.5) + else if (Player[E].LineBonus_PosY > Player[E].LineBonus_TargetY) then + Player[E].LineBonus_PosY := Player[E].LineBonus_PosY - (2 - Player[E].LineBonus_Alpha * 1.5); + + end; // pop up still visible, has not reached it's position - move it + end; // loop through all players + end; // if it's time to draw them + + if PlayersPlay = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + end + + else if PlayersPlay = 2 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); + end + + else if PlayersPlay = 3 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); + end + + else if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); + end; + if ScreenAct = 2 then begin + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); + if PlayerInfo.Playerinfo[3].Enabled then + SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); + end; + if ScreenAct = 2 then begin + if PlayerInfo.Playerinfo[3].Enabled then + SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); + if PlayerInfo.Playerinfo[4].Enabled then + SingDrawLineBonus( Player[4].LineBonus_PosX, Player[4].LineBonus_PosY, Player[4].LineBonus_Color, Player[4].LineBonus_Alpha, Player[4].LineBonus_Text, Player[4].LineBonus_Age); + if PlayerInfo.Playerinfo[5].Enabled then + SingDrawLineBonus( Player[5].LineBonus_PosX, Player[5].LineBonus_PosY, Player[5].LineBonus_Color, Player[5].LineBonus_Alpha, Player[5].LineBonus_Text, Player[5].LineBonus_Age); + end; + end; + end; +//PhrasenBonus - Line Bonus Mod End + +// resize the notes according to the difficulty level + case Ini.Difficulty of + 0: + begin + NotesH := 11; // 9 + NotesW := 6; // 5 + end; + 1: + begin + NotesH := 8; // 7 + NotesW := 4; // 4 + end; + 2: + begin + NotesH := 5; + NotesW := 3; + end; + end; + + if (DLLMAn.Selected.ShowNotes And DLLMan.Selected.LoadSong) then + begin + if (PlayersPlay = 1) And PlayerInfo.Playerinfo[0].Enabled then begin + SingDrawPlayerBGCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 0, 15); + end; + + if (PlayersPlay = 2) then begin + if PlayerInfo.Playerinfo[0].Enabled then + begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); + end; + if PlayerInfo.Playerinfo[1].Enabled then + begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); + end; + + end; + + if PlayersPlay = 3 then begin + NotesW := NotesW * 0.8; + NotesH := NotesH * 0.8; + + if PlayerInfo.Playerinfo[0].Enabled then + begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); + SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); + end; + + if PlayerInfo.Playerinfo[1].Enabled then + begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); + SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); + end; + + if PlayerInfo.Playerinfo[2].Enabled then + begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); + SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); + end; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); + end; + if ScreenAct = 2 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 2, 15); + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 3, 15); + end; + + SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); + + if ScreenAct = 1 then begin + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); + end; + if ScreenAct = 2 then begin + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 2, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 3, 15); + end; + end; + + if PlayersPlay = 6 then begin + NotesW := NotesW * 0.8; + NotesH := NotesH * 0.8; + + if ScreenAct = 1 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); + end; + if ScreenAct = 2 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 3, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 4, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 5, 12); + end; + + SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); + SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 0, 12); + SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 0, 12); + + if ScreenAct = 1 then begin + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); + end; + if ScreenAct = 2 then begin + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 3, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 4, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 5, 12); + end; + end; + end; + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); +end; + + +//SingBar Mod +procedure SingDrawSingbar(X, Y, W, H: real; Percent: integer); +var + R: Real; + G: Real; + B: Real; + A: cardinal; + I: Integer; + +begin; + + //SingBar Background + glColor4f(1, 1, 1, 0.8); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Back.TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(X, Y); + glTexCoord2f(0, 1); glVertex2f(X, Y+H); + glTexCoord2f(1, 1); glVertex2f(X+W, Y+H); + glTexCoord2f(1, 0); glVertex2f(X+W, Y); + glEnd; + + //SingBar coloured Bar + Case Percent of + 0..22: begin + R := 1; + G := 0; + B := 0; + end; + 23..42: begin + R := 1; + G := ((Percent-23)/100)*5; + B := 0; + end; + 43..57: begin + R := 1; + G := 1; + B := 0; + end; + 58..77: begin + R := 1-(Percent - 58)/100*5; + G := 1; + B := 0; + end; + 78..99: begin + R := 0; + G := 1; + B := 0; + end; + End; //Case + + glColor4f(R, G, B, 1); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Bar.TexNum); + //Size= Player[PlayerNum].ScorePercent of W + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(X, Y); + glTexCoord2f(0, 1); glVertex2f(X, Y+H); + glTexCoord2f(1, 1); glVertex2f(X+(W/100 * (Percent +1)), Y+H); + glTexCoord2f(1, 0); glVertex2f(X+(W/100 * (Percent +1)), Y); + glEnd; + + //SingBar Front + glColor4f(1, 1, 1, 0.6); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Front.TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(X, Y); + glTexCoord2f(0, 1); glVertex2f(X, Y+H); + glTexCoord2f(1, 1); glVertex2f(X+W, Y+H); + glTexCoord2f(1, 0); glVertex2f(X+W, Y); + glEnd; +end; +//end Singbar Mod + +//PhrasenBonus - Line Bonus Pop Up +procedure SingDrawLineBonus( const X, Y: Single; Color: TRGB; Alpha: Single; Text: string; Age: Integer); +var +Length, X2: Real; //Length of Text +Size: Integer; //Size of Popup +begin +if Alpha <> 0 then +begin + +//Set Font Propertys +SetFontStyle(2); //Font: Outlined1 +if Age < 5 then SetFontSize(Age + 1) else SetFontSize(6); +SetFontItalic(False); + +//Check Font Size +Length := glTextWidth ( PChar(Text)) + 3; //Little Space for a Better Look ^^ + +//Text +SetFontPos (X + 50 - (Length / 2), Y + 12); //Position + + +if Age < 5 then Size := Age * 10 else Size := 50; + + //Draw Background + //glColor4f(Color.R, Color.G, Color.B, Alpha); //Set Color + glColor4f(1, 1, 1, Alpha); + + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + + //New Method, Not Variable + glBindTexture(GL_TEXTURE_2D, Tex_SingLineBonusBack[2].TexNum); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(X + 50 - Size, Y + 25 - (Size/2)); + glTexCoord2f(0, 1); glVertex2f(X + 50 - Size, Y + 25 + (Size/2)); + glTexCoord2f(1, 1); glVertex2f(X + 50 + Size, Y + 25 + (Size/2)); + glTexCoord2f(1, 0); glVertex2f(X + 50 + Size, Y + 25 - (Size/2)); + glEnd; + + glColor4f(1, 1, 1, Alpha); //Set Color + //Draw Text + glPrint (PChar(Text)); +end; +end; +//PhrasenBonus - Line Bonus Mod + +// Draw Note Bars for Editor +//There are 11 Resons for a new Procdedure: +// 1. It don't look good when you Draw the Golden Note Star Effect in the Editor +// 2. You can see the Freestyle Notes in the Editor SemiTransparent +// 3. Its easier and Faster then changing the old Procedure +procedure EditDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); +var + Rec: TRecR; + Pet: integer; + TempR: real; +begin + glColor3f(1, 1, 1); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); + with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin + for Pet := 0 to HighNut do begin + with Nuta[Pet] do begin + + // Golden Note Patch + case Wartosc of + 0: glColor4f(1, 1, 1, 0.35); + 1: glColor4f(1, 1, 1, 0.85); + 2: glColor4f(1, 1, 0.3, 0.85); + end; // case + + + + // lewa czesc - left part + Rec.Left := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX; + Rec.Right := Rec.Left + NotesW; + Rec.Top := Top - (Ton-BaseNote)*Space/2 - NotesH; + Rec.Bottom := Rec.Top + 2 * NotesH; + glBindTexture(GL_TEXTURE_2D, Tex_Left[Color].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // srodkowa czesc - middle part + Rec.Left := Rec.Right; + Rec.Right := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - NotesW - 0.5 + 10*ScreenX; + + glBindTexture(GL_TEXTURE_2D, Tex_Mid[Color].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // prawa czesc - right part + Rec.Left := Rec.Right; + Rec.Right := Rec.Right + NotesW; + + glBindTexture(GL_TEXTURE_2D, Tex_Right[Color].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + end; // with + end; // for + end; // with + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); +end; + +procedure SingDrawTimeBar(); +var x,y: real; + width, height: real; +begin + x := Theme.Sing.StaticTimeProgress.x; + y := Theme.Sing.StaticTimeProgress.y; + width:= Theme.Sing.StaticTimeProgress.w; + height:= Theme.Sing.StaticTimeProgress.h; + + glColor4f(Theme.Sing.StaticTimeProgress.ColR, + Theme.Sing.StaticTimeProgress.ColG, + Theme.Sing.StaticTimeProgress.ColB, 1); //Set Color + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + + glBindTexture(GL_TEXTURE_2D, Tex_TimeProgress.TexNum); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(x,y); + glTexCoord2f((width*(Czas.Teraz/Czas.Razem))/8, 0); glVertex2f(x+width*(Czas.Teraz/Czas.Razem), y); + glTexCoord2f((width*(Czas.Teraz/Czas.Razem))/8, 1); glVertex2f(x+width*(Czas.Teraz/Czas.Razem), y+height); + 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/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index eb7dde8e..aaa4b3d7 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -1,607 +1,611 @@ -unit UGraphic; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -uses - SDL, - OpenGL12, - UTexture, - TextGL, - ULog, - SysUtils, - ULyrics, - UScreenLoading, - UScreenWelcome, - UScreenMain, - UScreenName, - UScreenLevel, - UScreenOptions, - UScreenOptionsGame, - UScreenOptionsGraphics, - UScreenOptionsSound, - UScreenOptionsLyrics, - UScreenOptionsThemes, - UScreenOptionsRecord, - UScreenOptionsAdvanced, - UScreenSong, - UScreenSing, - UScreenScore, - UScreenTop5, - UScreenEditSub, - UScreenEdit, - UScreenEditConvert, - UScreenEditHeader, - UScreenOpen, - UThemes, - USkins, - UScreenSongMenu, - UScreenSongJumpto, - {Party Screens} - UScreenSingModi, - UScreenPartyNewRound, - UScreenPartyScore, - UScreenPartyOptions, - UScreenPartyWin, - UScreenPartyPlayer, - {Stats Screens} - UScreenStatMain, - UScreenStatDetail, - {CreditsScreen} - UScreenCredits, - {Popup for errors, etc.} - UScreenPopup; - -type - TRecR = record - Top: real; - Left: real; - Right: real; - Bottom: real; - end; - -var - Screen: PSDL_Surface; - - LoadingThread: PSDL_Thread; - Mutex: PSDL_Mutex; - - RenderW: integer; - RenderH: integer; - ScreenW: integer; - ScreenH: integer; - Screens: integer; - ScreenAct: integer; - ScreenX: integer; - - ScreenLoading: TScreenLoading; - ScreenWelcome: TScreenWelcome; - ScreenMain: TScreenMain; - ScreenName: TScreenName; - ScreenLevel: TScreenLevel; - ScreenSong: TScreenSong; - ScreenSing: TScreenSing; - ScreenScore: TScreenScore; - ScreenTop5: TScreenTop5; - ScreenOptions: TScreenOptions; - ScreenOptionsGame: TScreenOptionsGame; - ScreenOptionsGraphics: TScreenOptionsGraphics; - ScreenOptionsSound: TScreenOptionsSound; - ScreenOptionsLyrics: TScreenOptionsLyrics; - ScreenOptionsThemes: TScreenOptionsThemes; - ScreenOptionsRecord: TScreenOptionsRecord; - ScreenOptionsAdvanced: TScreenOptionsAdvanced; - ScreenEditSub: TScreenEditSub; - ScreenEdit: TScreenEdit; - ScreenEditConvert: TScreenEditConvert; - ScreenEditHeader: TScreenEditHeader; - ScreenOpen: TScreenOpen; - - ScreenSongMenu: TScreenSongMenu; - ScreenSongJumpto: TScreenSongJumpto; - - //Party Screens - ScreenSingModi: TScreenSingModi; - ScreenPartyNewRound: TScreenPartyNewRound; - ScreenPartyScore: TScreenPartyScore; - ScreenPartyWin: TScreenPartyWin; - ScreenPartyOptions: TScreenPartyOptions; - ScreenPartyPlayer: TScreenPartyPlayer; - - //StatsScreens - ScreenStatMain: TScreenStatMain; - ScreenStatDetail: TScreenStatDetail; - - //CreditsScreen - ScreenCredits: TScreenCredits; - - //popup mod - ScreenPopupCheck: TScreenPopupCheck; - ScreenPopupError: TScreenPopupError; - - //Notes - Tex_Left: array[0..6] of TTexture; //rename to tex_note_left - Tex_Mid: array[0..6] of TTexture; //rename to tex_note_mid - Tex_Right: array[0..6] of TTexture; //rename to tex_note_right - - Tex_plain_Left: array[1..6] of TTexture; //rename to tex_notebg_left - Tex_plain_Mid: array[1..6] of TTexture; //rename to tex_notebg_mid - Tex_plain_Right: array[1..6] of TTexture; //rename to tex_notebg_right - - Tex_BG_Left: array[1..6] of TTexture; //rename to tex_noteglow_left - Tex_BG_Mid: array[1..6] of TTexture; //rename to tex_noteglow_mid - Tex_BG_Right: array[1..6] of TTexture; //rename to tex_noteglow_right - - Tex_Note_Star: TTexture; - Tex_Note_Perfect_Star: TTexture; - - - Tex_Ball: TTexture; - Tex_Lyric_Help_Bar: TTexture; - FullScreen: boolean; - - Tex_TimeProgress: TTexture; - - //Sing Bar Mod - Tex_SingBar_Back: TTexture; - Tex_SingBar_Bar: TTexture; - Tex_SingBar_Front: TTexture; - //end Singbar Mod - - //PhrasenBonus - Line Bonus Mod - Tex_SingLineBonusBack: array[0..8] of TTexture; - //End PhrasenBonus - Line Bonus Mod - -const - Skin_BGColorR = 1; - Skin_BGColorG = 1; - Skin_BGColorB = 1; - - Skin_SpectrumR = 0; - Skin_SpectrumG = 0; - Skin_SpectrumB = 0; - - Skin_Spectograph1R = 0.6; - Skin_Spectograph1G = 0.8; - Skin_Spectograph1B = 1; - - Skin_Spectograph2R = 0; - Skin_Spectograph2G = 0; - Skin_Spectograph2B = 0.2; - - Skin_SzczytR = 0.8; - Skin_SzczytG = 0; - Skin_SzczytB = 0; - - Skin_SzczytLimitR = 0; - Skin_SzczytLimitG = 0.8; - Skin_SzczytLimitB = 0; - - Skin_FontR = 0; - Skin_FontG = 0; - Skin_FontB = 0; - - Skin_FontHighlightR = 0.3; // 0.3 - Skin_FontHighlightG = 0.3; // 0.3 - Skin_FontHighlightB = 1; // 1 - - Skin_TimeR = 0.25; //0,0,0 - Skin_TimeG = 0.25; - Skin_TimeB = 0.25; - - Skin_OscR = 0; - Skin_OscG = 0; - Skin_OscB = 0; - - Skin_LyricsT = 494; // 500 / 510 / 400 - Skin_SpectrumT = 470; - Skin_SpectrumBot = 570; - Skin_SpectrumH = 100; - - Skin_P1_LinesR = 0.5; // 0.6 0.6 1 - Skin_P1_LinesG = 0.5; - Skin_P1_LinesB = 0.5; - - Skin_P2_LinesR = 0.5; // 1 0.6 0.6 - Skin_P2_LinesG = 0.5; - Skin_P2_LinesB = 0.5; - - Skin_P1_NotesB = 250; - Skin_P2_NotesB = 430; // 430 / 300 - - Skin_P1_ScoreT = 50; - Skin_P1_ScoreL = 20; - - Skin_P2_ScoreT = 50; - Skin_P2_ScoreL = 640; - -procedure Initialize3D (Title: string); -procedure Reinitialize3D; -procedure SwapBuffers; - -procedure LoadTextures; -procedure InitializeScreen; -procedure LoadLoadingScreen; -procedure LoadScreens; - -function LoadingThreadFunction: integer; - - -implementation - -uses UMain, - UIni, - UDisplay, - UCommandLine, - {$IFNDEF FPC} - Graphics, - {$ENDIF} - Classes, - Windows; - -procedure LoadTextures; - - -var - P: integer; - R, G, B: real; - Col: integer; -begin - // zaladowanie tekstur - Log.LogStatus('Loading Textures', 'LoadTextures'); - Tex_Left[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'BMP', 'Transparent', 0); //brauch man die noch? - Tex_Mid[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'BMP', 'Plain', 0); //brauch man die noch? - Tex_Right[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'BMP', 'Transparent', 0); //brauch man die noch? - - // P1-6 - for P := 1 to 6 do begin - LoadColor(R, G, B, 'P' + IntToStr(P) + 'Light'); - Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); - Tex_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'PNG', 'Colorized', Col); - Tex_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'PNG', 'Colorized', Col); - Tex_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'PNG', 'Colorized', Col); - - Tex_plain_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainLeft')), 'PNG', 'Colorized', Col); - Tex_plain_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainMid')), 'PNG', 'Colorized', Col); - Tex_plain_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainRight')), 'PNG', 'Colorized', Col); - - Tex_BG_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGLeft')), 'PNG', 'Colorized', Col); - Tex_BG_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGMid')), 'PNG', 'Colorized', Col); - Tex_BG_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGRight')), 'PNG', 'Colorized', Col); - end; - - Tex_Note_Perfect_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePerfectStar')), 'JPG', 'Font Black', 0); - Tex_Note_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteStar')) , 'JPG', 'Alpha Black Colored', $FFFFFF); - Tex_Ball := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'BMP', 'Transparent', $FF00FF); - Tex_Lyric_Help_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricHelpBar')), 'BMP', 'Transparent', $FF00FF); - - - //TimeBar mod - Tex_TimeProgress := Texture.LoadTexture(pchar(Skin.GetTextureFileName('TimeBar'))); - //eoa TimeBar mod - - //SingBar Mod - Tex_SingBar_Back := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBack')), 'JPG', 'Plain', 0); - Tex_SingBar_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBar')), 'JPG', 'Plain', 0); - Tex_SingBar_Front := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarFront')), 'JPG', 'Font', 0); - //end Singbar Mod - - //Line Bonus PopUp - for P := 0 to 8 do - begin - Tex_SingLineBonusBack[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LineBonusBack')), 'PNG', 'Colorized', $FFFFFF); - end; - {//Set Texture to Font High - Tex_SingLineBonusL.H := 32; Tex_SingLineBonusL.W := 8; - Tex_SingLineBonusM.H := 32; //Tex_SingLineBonusM.TexW := Tex_SingLineBonusM.TexW/2; - Tex_SingLineBonusR.H := 32; Tex_SingLineBonusR.W := 8; } - //PhrasenBonus - Line Bonus Mod End - - // tworzenie czcionek - Log.LogStatus('Building Fonts', 'LoadTextures'); - BuildFont; -end; - -procedure Initialize3D (Title: string); -var -// Icon: TIcon; - Res: TResourceStream; - ISurface: PSDL_Surface; - Pixel: PByteArray; - I: Integer; -begin - Log.LogStatus('LoadOpenGL', 'Initialize3D'); - Log.BenchmarkStart(2); - - LoadOpenGL; - - Log.LogStatus('SDL_Init', 'Initialize3D'); - if ( SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO)= -1 ) then begin - Log.LogError('SDL_Init Failed', 'Initialize3D'); - exit; - end; - - { //Load Icon - Res := TResourceStream.CreateFromID(HInstance, 3, RT_ICON); - Icon := TIcon.Create; - Icon.LoadFromStream(Res); - Res.Free; - Icon. - //Create icon Surface - SDL_CreateRGBSurfaceFrom ( - SDL_SWSURFACE, - Icon.Width, - Icon.Height, - 32, - 128 or 64, - 32 or 16, - 8 or 4, - 2 or 1); - //SDL_BlitSurface( - - - SDL_WM_SetIcon(SDL_LoadBMP('DEFAULT_WINDOW_ICON'), 0); //} - - SDL_WM_SetCaption(PChar(Title), nil); - - InitializeScreen; - - Log.BenchmarkEnd(2); - Log.LogBenchmark('--> Setting Screen', 2); - - // ladowanie tekstur - Log.BenchmarkStart(2); - Texture := TTextureUnit.Create; - Texture.Limit := 1024*1024; - - LoadTextures; - Log.BenchmarkEnd(2); - Log.LogBenchmark('--> Loading Textures', 2); - - Log.BenchmarkStart(2); - Lyric := TLyric.Create; - Log.BenchmarkEnd(2); - Log.LogBenchmark('--> Loading Fonts', 2); - - Log.BenchmarkStart(2); - Display := TDisplay.Create; - SDL_EnableUnicode(1); - Log.BenchmarkEnd(2); Log.LogBenchmark('====> Creating Display', 2); - - Log.LogStatus('Loading Screens', 'Initialize3D'); - Log.BenchmarkStart(3); - - LoadLoadingScreen; - // now that we have something to display while loading, - // start thread that loads the rest of ultrastar -// Mutex := SDL_CreateMutex; -// SDL_UnLockMutex(Mutex); - - // funktioniert so noch nicht, da der ladethread unverändert auf opengl zugreifen will - // siehe dazu kommentar unten - //LoadingThread := SDL_CreateThread(@LoadingThread, nil); - - // das hier würde dann im ladethread ausgeführt - LoadScreens; - - - // TODO!!!!!!1 - // hier käme jetzt eine schleife, die - // * den ladescreen malt (ab und zu) - // * den "fortschritt" des ladescreens steuert - // * zwischendrin schaut, ob der ladethread texturen geladen hat (mutex prüfen) und - // * die texturen in die opengl lädt, sowie - // * dem ladethread signalisiert, dass der speicher für die textur - // zum laden der nächsten textur weiterverwendet werden kann (über weiteren mutex) - // * über einen 3. mutex so lange läuft, bis der ladethread signalisiert, - // dass er alles geladen hat fertig ist - // - // dafür muss loadtexture so umgeschrieben werden, dass es, statt selbst irgendwelche - // opengl funktionen aufzurufen, entsprechend mutexe verändert - // der hauptthread muss auch irgendwoher erfahren, was an opengl funktionen auszuführen ist, - // mit welchen parametern (texturtyp, entspr. texturobjekt, textur-zwischenspeicher-adresse, ... - - - //wait for loading thread to finish - // funktioniert so auch noch nicht - //SDL_WaitThread(LoadingThread, I); -// SDL_DestroyMutex(Mutex); - - Display.ActualScreen^.FadeTo(@ScreenMain); - - Log.BenchmarkEnd(2); - Log.LogBenchmark('--> Loading Screens', 2); - - Log.LogStatus('Finish', 'Initialize3D'); -end; - -procedure SwapBuffers; -begin - SDL_GL_SwapBuffers; - glMatrixMode(GL_PROJECTION); - glLoadIdentity; - glOrtho(0, RenderW, RenderH, 0, -1, 100); - glMatrixMode(GL_MODELVIEW); -end; - -procedure Reinitialize3D; -begin -// InitializeScreen; -// LoadTextures; -// LoadScreens; -end; - -procedure InitializeScreen; -var - S: string; - I: integer; - W, H: integer; - Depth: Integer; -begin - if (Params.Screens <> -1) then - Screens := Params.Screens + 1 - else - Screens := Ini.Screens + 1; - - SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - - // If there is a resolution in Parameters, use it, else use the Ini value - I := Params.Resolution; - if (I <> -1) then - S := IResolution[I] - else - S := IResolution[Ini.Resolution]; - - I := Pos('x', S); - W := StrToInt(Copy(S, 1, I-1)) * Screens; - H := StrToInt(Copy(S, I+1, 1000)); - - {if ParamStr(1) = '-fsblack' then begin - W := 800; - H := 600; - end; - if ParamStr(1) = '-320x240' then begin - W := 320; - H := 240; - end; } - - If (Params.Depth <> -1) then - Depth := Params.Depth - else - Depth := Ini.Depth; - - - Log.LogStatus('SDL_SetVideoMode', 'Initialize3D'); -// SDL_SetRefreshrate(85); -// SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); - if (Ini.FullScreen = 0) and (Not Params.FullScreen) then - screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL) - else begin - screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN); - SDL_ShowCursor(0); - end; - if (screen = nil) then begin - Log.LogError('SDL_SetVideoMode Failed', 'Initialize3D'); - exit; - end; - - // clear screen once window is being shown - glClearColor(1, 1, 1, 1); - glClear(GL_COLOR_BUFFER_BIT); - SwapBuffers; - - // zmienne - RenderW := 800; - RenderH := 600; - ScreenW := W; - ScreenH := H; -end; - -procedure LoadLoadingScreen; -begin - ScreenLoading := TScreenLoading.Create; - ScreenLoading.onShow; - Display.ActualScreen := @ScreenLoading; - swapbuffers; - ScreenLoading.Draw; - Display.Draw; - SwapBuffers; -end; - -procedure LoadScreens; -begin -{ ScreenLoading := TScreenLoading.Create; - ScreenLoading.onShow; - Display.ActualScreen := @ScreenLoading; - ScreenLoading.Draw; - Display.Draw; - SwapBuffers; -} - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Loading', 3); Log.BenchmarkStart(3); -{ ScreenWelcome := TScreenWelcome.Create; //'BG', 4, 3); - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Welcome', 3); Log.BenchmarkStart(3);} - ScreenMain := TScreenMain.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Main', 3); Log.BenchmarkStart(3); - ScreenName := TScreenName.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Name', 3); Log.BenchmarkStart(3); - ScreenLevel := TScreenLevel.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Level', 3); Log.BenchmarkStart(3); - ScreenSong := TScreenSong.Create; - 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); - ScreenSing := TScreenSing.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing', 3); Log.BenchmarkStart(3); - ScreenScore := TScreenScore.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Score', 3); Log.BenchmarkStart(3); - ScreenTop5 := TScreenTop5.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Top5', 3); Log.BenchmarkStart(3); - ScreenOptions := TScreenOptions.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options', 3); Log.BenchmarkStart(3); - ScreenOptionsGame := TScreenOptionsGame.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Game', 3); Log.BenchmarkStart(3); - ScreenOptionsGraphics := TScreenOptionsGraphics.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Graphics', 3); Log.BenchmarkStart(3); - ScreenOptionsSound := TScreenOptionsSound.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Sound', 3); Log.BenchmarkStart(3); - ScreenOptionsLyrics := TScreenOptionsLyrics.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Lyrics', 3); Log.BenchmarkStart(3); - ScreenOptionsThemes := TScreenOptionsThemes.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Themes', 3); Log.BenchmarkStart(3); - ScreenOptionsRecord := TScreenOptionsRecord.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Record', 3); Log.BenchmarkStart(3); - ScreenOptionsAdvanced := TScreenOptionsAdvanced.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Advanced', 3); Log.BenchmarkStart(3); - ScreenEditSub := TScreenEditSub.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Sub', 3); Log.BenchmarkStart(3); - ScreenEdit := TScreenEdit.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit', 3); Log.BenchmarkStart(3); - ScreenEditConvert := TScreenEditConvert.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen EditConvert', 3); Log.BenchmarkStart(3); -// ScreenEditHeader := TScreenEditHeader.Create(Skin.ScoreBG); -// Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Header', 3); Log.BenchmarkStart(3); - ScreenOpen := TScreenOpen.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Open', 3); Log.BenchmarkStart(3); - ScreenSingModi := TScreenSingModi.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing with Modi support', 3); Log.BenchmarkStart(3); - ScreenSongMenu := TScreenSongMenu.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongMenu', 3); Log.BenchmarkStart(3); - ScreenSongJumpto := TScreenSongJumpto.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongJumpto', 3); Log.BenchmarkStart(3); - ScreenPopupCheck := TScreenPopupCheck.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Popup (Check)', 3); Log.BenchmarkStart(3); - ScreenPopupError := TScreenPopupError.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Popup (Error)', 3); Log.BenchmarkStart(3); - ScreenPartyNewRound := TScreenPartyNewRound.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyNewRound', 3); Log.BenchmarkStart(3); - ScreenPartyScore := TScreenPartyScore.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyScore', 3); Log.BenchmarkStart(3); - ScreenPartyWin := TScreenPartyWin.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyWin', 3); Log.BenchmarkStart(3); - ScreenPartyOptions := TScreenPartyOptions.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyOptions', 3); Log.BenchmarkStart(3); - ScreenPartyPlayer := TScreenPartyPlayer.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyPlayer', 3); Log.BenchmarkStart(3); - ScreenStatMain := TScreenStatMain.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Main', 3); Log.BenchmarkStart(3); - ScreenStatDetail := TScreenStatDetail.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Detail', 3); Log.BenchmarkStart(3); - ScreenCredits := TScreenCredits.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Credits', 3); Log.BenchmarkStart(3); - - end; - -function LoadingThreadFunction: integer; -begin - LoadScreens; - Result:= 1; -end; - -end. +unit UGraphic; + +interface + +{$I switches.inc} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses + SDL, + OpenGL12, + UTexture, + TextGL, + ULog, + SysUtils, + ULyrics, + UScreenLoading, + UScreenWelcome, + UScreenMain, + UScreenName, + UScreenLevel, + UScreenOptions, + UScreenOptionsGame, + UScreenOptionsGraphics, + UScreenOptionsSound, + UScreenOptionsLyrics, + UScreenOptionsThemes, + UScreenOptionsRecord, + UScreenOptionsAdvanced, + UScreenSong, + UScreenSing, + UScreenScore, + UScreenTop5, + UScreenEditSub, + UScreenEdit, + UScreenEditConvert, + UScreenEditHeader, + UScreenOpen, + UThemes, + USkins, + UScreenSongMenu, + UScreenSongJumpto, + {Party Screens} + UScreenSingModi, + UScreenPartyNewRound, + UScreenPartyScore, + UScreenPartyOptions, + UScreenPartyWin, + UScreenPartyPlayer, + {Stats Screens} + UScreenStatMain, + UScreenStatDetail, + {CreditsScreen} + UScreenCredits, + {Popup for errors, etc.} + UScreenPopup; + +type + TRecR = record + Top: real; + Left: real; + Right: real; + Bottom: real; + end; + +var + Screen: PSDL_Surface; + + LoadingThread: PSDL_Thread; + Mutex: PSDL_Mutex; + + RenderW: integer; + RenderH: integer; + ScreenW: integer; + ScreenH: integer; + Screens: integer; + ScreenAct: integer; + ScreenX: integer; + + ScreenLoading: TScreenLoading; + ScreenWelcome: TScreenWelcome; + ScreenMain: TScreenMain; + ScreenName: TScreenName; + ScreenLevel: TScreenLevel; + ScreenSong: TScreenSong; + ScreenSing: TScreenSing; + ScreenScore: TScreenScore; + ScreenTop5: TScreenTop5; + ScreenOptions: TScreenOptions; + ScreenOptionsGame: TScreenOptionsGame; + ScreenOptionsGraphics: TScreenOptionsGraphics; + ScreenOptionsSound: TScreenOptionsSound; + ScreenOptionsLyrics: TScreenOptionsLyrics; + ScreenOptionsThemes: TScreenOptionsThemes; + ScreenOptionsRecord: TScreenOptionsRecord; + ScreenOptionsAdvanced: TScreenOptionsAdvanced; + ScreenEditSub: TScreenEditSub; + ScreenEdit: TScreenEdit; + ScreenEditConvert: TScreenEditConvert; + ScreenEditHeader: TScreenEditHeader; + ScreenOpen: TScreenOpen; + + ScreenSongMenu: TScreenSongMenu; + ScreenSongJumpto: TScreenSongJumpto; + + //Party Screens + ScreenSingModi: TScreenSingModi; + ScreenPartyNewRound: TScreenPartyNewRound; + ScreenPartyScore: TScreenPartyScore; + ScreenPartyWin: TScreenPartyWin; + ScreenPartyOptions: TScreenPartyOptions; + ScreenPartyPlayer: TScreenPartyPlayer; + + //StatsScreens + ScreenStatMain: TScreenStatMain; + ScreenStatDetail: TScreenStatDetail; + + //CreditsScreen + ScreenCredits: TScreenCredits; + + //popup mod + ScreenPopupCheck: TScreenPopupCheck; + ScreenPopupError: TScreenPopupError; + + //Notes + Tex_Left: array[0..6] of TTexture; //rename to tex_note_left + Tex_Mid: array[0..6] of TTexture; //rename to tex_note_mid + Tex_Right: array[0..6] of TTexture; //rename to tex_note_right + + Tex_plain_Left: array[1..6] of TTexture; //rename to tex_notebg_left + Tex_plain_Mid: array[1..6] of TTexture; //rename to tex_notebg_mid + Tex_plain_Right: array[1..6] of TTexture; //rename to tex_notebg_right + + Tex_BG_Left: array[1..6] of TTexture; //rename to tex_noteglow_left + Tex_BG_Mid: array[1..6] of TTexture; //rename to tex_noteglow_mid + Tex_BG_Right: array[1..6] of TTexture; //rename to tex_noteglow_right + + Tex_Note_Star: TTexture; + Tex_Note_Perfect_Star: TTexture; + + + Tex_Ball: TTexture; + Tex_Lyric_Help_Bar: TTexture; + FullScreen: boolean; + + Tex_TimeProgress: TTexture; + + //Sing Bar Mod + Tex_SingBar_Back: TTexture; + Tex_SingBar_Bar: TTexture; + Tex_SingBar_Front: TTexture; + //end Singbar Mod + + //PhrasenBonus - Line Bonus Mod + Tex_SingLineBonusBack: array[0..8] of TTexture; + //End PhrasenBonus - Line Bonus Mod + +const + Skin_BGColorR = 1; + Skin_BGColorG = 1; + Skin_BGColorB = 1; + + Skin_SpectrumR = 0; + Skin_SpectrumG = 0; + Skin_SpectrumB = 0; + + Skin_Spectograph1R = 0.6; + Skin_Spectograph1G = 0.8; + Skin_Spectograph1B = 1; + + Skin_Spectograph2R = 0; + Skin_Spectograph2G = 0; + Skin_Spectograph2B = 0.2; + + Skin_SzczytR = 0.8; + Skin_SzczytG = 0; + Skin_SzczytB = 0; + + Skin_SzczytLimitR = 0; + Skin_SzczytLimitG = 0.8; + Skin_SzczytLimitB = 0; + + Skin_FontR = 0; + Skin_FontG = 0; + Skin_FontB = 0; + + Skin_FontHighlightR = 0.3; // 0.3 + Skin_FontHighlightG = 0.3; // 0.3 + Skin_FontHighlightB = 1; // 1 + + Skin_TimeR = 0.25; //0,0,0 + Skin_TimeG = 0.25; + Skin_TimeB = 0.25; + + Skin_OscR = 0; + Skin_OscG = 0; + Skin_OscB = 0; + + Skin_LyricsT = 494; // 500 / 510 / 400 + Skin_SpectrumT = 470; + Skin_SpectrumBot = 570; + Skin_SpectrumH = 100; + + Skin_P1_LinesR = 0.5; // 0.6 0.6 1 + Skin_P1_LinesG = 0.5; + Skin_P1_LinesB = 0.5; + + Skin_P2_LinesR = 0.5; // 1 0.6 0.6 + Skin_P2_LinesG = 0.5; + Skin_P2_LinesB = 0.5; + + Skin_P1_NotesB = 250; + Skin_P2_NotesB = 430; // 430 / 300 + + Skin_P1_ScoreT = 50; + Skin_P1_ScoreL = 20; + + Skin_P2_ScoreT = 50; + Skin_P2_ScoreL = 640; + +procedure Initialize3D (Title: string); +procedure Reinitialize3D; +procedure SwapBuffers; + +procedure LoadTextures; +procedure InitializeScreen; +procedure LoadLoadingScreen; +procedure LoadScreens; + +function LoadingThreadFunction: integer; + + +implementation + +uses UMain, + UIni, + UDisplay, + UCommandLine, + {$IFNDEF FPC} + Graphics, + {$ENDIF} + {$IFDEF win32} + windows, + {$ENDIF} + Classes; + +procedure LoadTextures; + + +var + P: integer; + R, G, B: real; + Col: integer; +begin + // zaladowanie tekstur + Log.LogStatus('Loading Textures', 'LoadTextures'); + Tex_Left[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'BMP', 'Transparent', 0); //brauch man die noch? + Tex_Mid[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'BMP', 'Plain', 0); //brauch man die noch? + Tex_Right[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'BMP', 'Transparent', 0); //brauch man die noch? + + // P1-6 + for P := 1 to 6 do begin + LoadColor(R, G, B, 'P' + IntToStr(P) + 'Light'); + Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + Tex_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'PNG', 'Colorized', Col); + Tex_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'PNG', 'Colorized', Col); + Tex_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'PNG', 'Colorized', Col); + + Tex_plain_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainLeft')), 'PNG', 'Colorized', Col); + Tex_plain_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainMid')), 'PNG', 'Colorized', Col); + Tex_plain_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainRight')), 'PNG', 'Colorized', Col); + + Tex_BG_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGLeft')), 'PNG', 'Colorized', Col); + Tex_BG_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGMid')), 'PNG', 'Colorized', Col); + Tex_BG_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGRight')), 'PNG', 'Colorized', Col); + end; + + Tex_Note_Perfect_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePerfectStar')), 'JPG', 'Font Black', 0); + Tex_Note_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteStar')) , 'JPG', 'Alpha Black Colored', $FFFFFF); + Tex_Ball := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'BMP', 'Transparent', $FF00FF); + Tex_Lyric_Help_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricHelpBar')), 'BMP', 'Transparent', $FF00FF); + + + //TimeBar mod + Tex_TimeProgress := Texture.LoadTexture(pchar(Skin.GetTextureFileName('TimeBar'))); + //eoa TimeBar mod + + //SingBar Mod + Tex_SingBar_Back := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBack')), 'JPG', 'Plain', 0); + Tex_SingBar_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBar')), 'JPG', 'Plain', 0); + Tex_SingBar_Front := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarFront')), 'JPG', 'Font', 0); + //end Singbar Mod + + //Line Bonus PopUp + for P := 0 to 8 do + begin + Tex_SingLineBonusBack[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LineBonusBack')), 'PNG', 'Colorized', $FFFFFF); + end; + {//Set Texture to Font High + Tex_SingLineBonusL.H := 32; Tex_SingLineBonusL.W := 8; + Tex_SingLineBonusM.H := 32; //Tex_SingLineBonusM.TexW := Tex_SingLineBonusM.TexW/2; + Tex_SingLineBonusR.H := 32; Tex_SingLineBonusR.W := 8; } + //PhrasenBonus - Line Bonus Mod End + + // tworzenie czcionek + Log.LogStatus('Building Fonts', 'LoadTextures'); + BuildFont; +end; + +procedure Initialize3D (Title: string); +var +// Icon: TIcon; + Res: TResourceStream; + ISurface: PSDL_Surface; + Pixel: PByteArray; + I: Integer; +begin + Log.LogStatus('LoadOpenGL', 'Initialize3D'); + Log.BenchmarkStart(2); + + LoadOpenGL; + + Log.LogStatus('SDL_Init', 'Initialize3D'); + if ( SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO)= -1 ) then begin + Log.LogError('SDL_Init Failed', 'Initialize3D'); + exit; + end; + + { //Load Icon + Res := TResourceStream.CreateFromID(HInstance, 3, RT_ICON); + Icon := TIcon.Create; + Icon.LoadFromStream(Res); + Res.Free; + Icon. + //Create icon Surface + SDL_CreateRGBSurfaceFrom ( + SDL_SWSURFACE, + Icon.Width, + Icon.Height, + 32, + 128 or 64, + 32 or 16, + 8 or 4, + 2 or 1); + //SDL_BlitSurface( + + + SDL_WM_SetIcon(SDL_LoadBMP('DEFAULT_WINDOW_ICON'), 0); //} + + SDL_WM_SetCaption(PChar(Title), nil); + + InitializeScreen; + + Log.BenchmarkEnd(2); + Log.LogBenchmark('--> Setting Screen', 2); + + // ladowanie tekstur + Log.BenchmarkStart(2); + Texture := TTextureUnit.Create; + Texture.Limit := 1024*1024; + + LoadTextures; + Log.BenchmarkEnd(2); + Log.LogBenchmark('--> Loading Textures', 2); + + Log.BenchmarkStart(2); + Lyric := TLyric.Create; + Log.BenchmarkEnd(2); + Log.LogBenchmark('--> Loading Fonts', 2); + + Log.BenchmarkStart(2); + Display := TDisplay.Create; + SDL_EnableUnicode(1); + Log.BenchmarkEnd(2); Log.LogBenchmark('====> Creating Display', 2); + + Log.LogStatus('Loading Screens', 'Initialize3D'); + Log.BenchmarkStart(3); + + LoadLoadingScreen; + // now that we have something to display while loading, + // start thread that loads the rest of ultrastar +// Mutex := SDL_CreateMutex; +// SDL_UnLockMutex(Mutex); + + // funktioniert so noch nicht, da der ladethread unverändert auf opengl zugreifen will + // siehe dazu kommentar unten + //LoadingThread := SDL_CreateThread(@LoadingThread, nil); + + // das hier würde dann im ladethread ausgeführt + LoadScreens; + + + // TODO!!!!!!1 + // hier käme jetzt eine schleife, die + // * den ladescreen malt (ab und zu) + // * den "fortschritt" des ladescreens steuert + // * zwischendrin schaut, ob der ladethread texturen geladen hat (mutex prüfen) und + // * die texturen in die opengl lädt, sowie + // * dem ladethread signalisiert, dass der speicher für die textur + // zum laden der nächsten textur weiterverwendet werden kann (über weiteren mutex) + // * über einen 3. mutex so lange läuft, bis der ladethread signalisiert, + // dass er alles geladen hat fertig ist + // + // dafür muss loadtexture so umgeschrieben werden, dass es, statt selbst irgendwelche + // opengl funktionen aufzurufen, entsprechend mutexe verändert + // der hauptthread muss auch irgendwoher erfahren, was an opengl funktionen auszuführen ist, + // mit welchen parametern (texturtyp, entspr. texturobjekt, textur-zwischenspeicher-adresse, ... + + + //wait for loading thread to finish + // funktioniert so auch noch nicht + //SDL_WaitThread(LoadingThread, I); +// SDL_DestroyMutex(Mutex); + + Display.ActualScreen^.FadeTo(@ScreenMain); + + Log.BenchmarkEnd(2); + Log.LogBenchmark('--> Loading Screens', 2); + + Log.LogStatus('Finish', 'Initialize3D'); +end; + +procedure SwapBuffers; +begin + SDL_GL_SwapBuffers; + glMatrixMode(GL_PROJECTION); + glLoadIdentity; + glOrtho(0, RenderW, RenderH, 0, -1, 100); + glMatrixMode(GL_MODELVIEW); +end; + +procedure Reinitialize3D; +begin +// InitializeScreen; +// LoadTextures; +// LoadScreens; +end; + +procedure InitializeScreen; +var + S: string; + I: integer; + W, H: integer; + Depth: Integer; +begin + if (Params.Screens <> -1) then + Screens := Params.Screens + 1 + else + Screens := Ini.Screens + 1; + + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + + // If there is a resolution in Parameters, use it, else use the Ini value + I := Params.Resolution; + if (I <> -1) then + S := IResolution[I] + else + S := IResolution[Ini.Resolution]; + + I := Pos('x', S); + W := StrToInt(Copy(S, 1, I-1)) * Screens; + H := StrToInt(Copy(S, I+1, 1000)); + + {if ParamStr(1) = '-fsblack' then begin + W := 800; + H := 600; + end; + if ParamStr(1) = '-320x240' then begin + W := 320; + H := 240; + end; } + + If (Params.Depth <> -1) then + Depth := Params.Depth + else + Depth := Ini.Depth; + + + Log.LogStatus('SDL_SetVideoMode', 'Initialize3D'); +// SDL_SetRefreshrate(85); +// SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); + if (Ini.FullScreen = 0) and (Not Params.FullScreen) then + screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL) + else begin + screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN); + SDL_ShowCursor(0); + end; + if (screen = nil) then begin + Log.LogError('SDL_SetVideoMode Failed', 'Initialize3D'); + exit; + end; + + // clear screen once window is being shown + glClearColor(1, 1, 1, 1); + glClear(GL_COLOR_BUFFER_BIT); + SwapBuffers; + + // zmienne + RenderW := 800; + RenderH := 600; + ScreenW := W; + ScreenH := H; +end; + +procedure LoadLoadingScreen; +begin + ScreenLoading := TScreenLoading.Create; + ScreenLoading.onShow; + Display.ActualScreen := @ScreenLoading; + swapbuffers; + ScreenLoading.Draw; + Display.Draw; + SwapBuffers; +end; + +procedure LoadScreens; +begin +{ ScreenLoading := TScreenLoading.Create; + ScreenLoading.onShow; + Display.ActualScreen := @ScreenLoading; + ScreenLoading.Draw; + Display.Draw; + SwapBuffers; +} + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Loading', 3); Log.BenchmarkStart(3); +{ ScreenWelcome := TScreenWelcome.Create; //'BG', 4, 3); + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Welcome', 3); Log.BenchmarkStart(3);} + ScreenMain := TScreenMain.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Main', 3); Log.BenchmarkStart(3); + ScreenName := TScreenName.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Name', 3); Log.BenchmarkStart(3); + ScreenLevel := TScreenLevel.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Level', 3); Log.BenchmarkStart(3); + ScreenSong := TScreenSong.Create; + 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); + ScreenSing := TScreenSing.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing', 3); Log.BenchmarkStart(3); + ScreenScore := TScreenScore.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Score', 3); Log.BenchmarkStart(3); + ScreenTop5 := TScreenTop5.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Top5', 3); Log.BenchmarkStart(3); + ScreenOptions := TScreenOptions.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options', 3); Log.BenchmarkStart(3); + ScreenOptionsGame := TScreenOptionsGame.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Game', 3); Log.BenchmarkStart(3); + ScreenOptionsGraphics := TScreenOptionsGraphics.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Graphics', 3); Log.BenchmarkStart(3); + ScreenOptionsSound := TScreenOptionsSound.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Sound', 3); Log.BenchmarkStart(3); + ScreenOptionsLyrics := TScreenOptionsLyrics.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Lyrics', 3); Log.BenchmarkStart(3); + ScreenOptionsThemes := TScreenOptionsThemes.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Themes', 3); Log.BenchmarkStart(3); + ScreenOptionsRecord := TScreenOptionsRecord.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Record', 3); Log.BenchmarkStart(3); + ScreenOptionsAdvanced := TScreenOptionsAdvanced.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Advanced', 3); Log.BenchmarkStart(3); + ScreenEditSub := TScreenEditSub.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Sub', 3); Log.BenchmarkStart(3); + ScreenEdit := TScreenEdit.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit', 3); Log.BenchmarkStart(3); + ScreenEditConvert := TScreenEditConvert.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen EditConvert', 3); Log.BenchmarkStart(3); +// ScreenEditHeader := TScreenEditHeader.Create(Skin.ScoreBG); +// Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Header', 3); Log.BenchmarkStart(3); + ScreenOpen := TScreenOpen.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Open', 3); Log.BenchmarkStart(3); + ScreenSingModi := TScreenSingModi.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing with Modi support', 3); Log.BenchmarkStart(3); + ScreenSongMenu := TScreenSongMenu.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongMenu', 3); Log.BenchmarkStart(3); + ScreenSongJumpto := TScreenSongJumpto.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongJumpto', 3); Log.BenchmarkStart(3); + ScreenPopupCheck := TScreenPopupCheck.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Popup (Check)', 3); Log.BenchmarkStart(3); + ScreenPopupError := TScreenPopupError.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Popup (Error)', 3); Log.BenchmarkStart(3); + ScreenPartyNewRound := TScreenPartyNewRound.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyNewRound', 3); Log.BenchmarkStart(3); + ScreenPartyScore := TScreenPartyScore.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyScore', 3); Log.BenchmarkStart(3); + ScreenPartyWin := TScreenPartyWin.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyWin', 3); Log.BenchmarkStart(3); + ScreenPartyOptions := TScreenPartyOptions.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyOptions', 3); Log.BenchmarkStart(3); + ScreenPartyPlayer := TScreenPartyPlayer.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyPlayer', 3); Log.BenchmarkStart(3); + ScreenStatMain := TScreenStatMain.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Main', 3); Log.BenchmarkStart(3); + ScreenStatDetail := TScreenStatDetail.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Detail', 3); Log.BenchmarkStart(3); + ScreenCredits := TScreenCredits.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Credits', 3); Log.BenchmarkStart(3); + + end; + +function LoadingThreadFunction: integer; +begin + LoadScreens; + Result:= 1; +end; + +end. diff --git a/Game/Code/Classes/UGraphicClasses.pas b/Game/Code/Classes/UGraphicClasses.pas index 761ec058..c04a0ad8 100644 --- a/Game/Code/Classes/UGraphicClasses.pas +++ b/Game/Code/Classes/UGraphicClasses.pas @@ -1,667 +1,678 @@ -// notes: -unit UGraphicClasses; - -interface -uses UTexture; - -const DelayBetweenFrames : Cardinal = 60; -type - - TParticleType=(GoldenNote, PerfectNote, NoteHitTwinkle, PerfectLineTwinkle, ColoredStar, Flare); - - TColour3f = Record - r, g, b: Real; - end; - - TParticle = Class - X, Y : Real; //Position - Screen : Integer; - W, H : Cardinal; //dimensions of particle - Col : array of TColour3f; // Colour(s) of particle - Scale : array of Real; // Scaling factors of particle layers - Frame : Byte; //act. Frame - Tex : Cardinal; //Tex num from Textur Manager - Live : Byte; //How many Cycles before Kill - RecIndex : Integer; //To which rectangle this particle belongs (only GoldenNote) - StarType : TParticleType; // GoldenNote | PerfectNote | NoteHitTwinkle | PerfectLineTwinkle - Alpha : Real; // used for fading... - mX, mY : Real; // movement-vector for PerfectLineTwinkle - SizeMod : Real; // experimental size modifier - SurviveSentenceChange : Boolean; - - Constructor Create(cX,cY: Real; cScreen: Integer; cLive: Byte; cFrame : integer; cRecArrayIndex : Integer; cStarType : TParticleType; Player: Cardinal); - Destructor Destroy(); override; - procedure Draw; - procedure LiveOn; - end; - - RectanglePositions = Record - xTop, yTop, xBottom, yBottom : Real; - TotalStarCount : Integer; - CurrentStarCount : Integer; - Screen : Integer; - end; - - PerfectNotePositions = Record - xPos, yPos : Real; - Screen : Integer; - end; - - TEffectManager = Class - Particle : array of TParticle; - LastTime : Cardinal; - RecArray : Array of RectanglePositions; - TwinkleArray : Array[0..5] of Real; // store x-position of last twinkle for every player - PerfNoteArray : Array of PerfectNotePositions; - - FlareTex: TTexture; - - constructor Create; - destructor Destroy; override; - procedure Draw; - function Spawn(X, Y: Real; - Screen: Integer; - Live: Byte; - StartFrame: Integer; - RecArrayIndex: Integer; // this is only used with GoldenNotes - StarType: TParticleType; - Player: Cardinal // for PerfectLineTwinkle - ): Cardinal; - procedure SpawnRec(); - procedure Kill(index: Cardinal); - procedure KillAll(); - procedure SentenceChange(); - procedure SaveGoldenStarsRec(Xtop, Ytop, Xbottom, Ybottom: Real); - procedure SavePerfectNotePos(Xtop, Ytop: Real); - procedure GoldenNoteTwinkle(Top,Bottom,Right: Real; Player: Integer); - procedure SpawnPerfectLineTwinkle(); - end; - -var GoldenRec : TEffectManager; - -implementation - -uses sysutils, - Windows, - OpenGl12, - UIni, - UMain, - UThemes, - USkins, - UGraphic, - UDrawTexture, - UCommon, - math; - -//TParticle -Constructor TParticle.Create(cX,cY: Real; cScreen: Integer; cLive: Byte; cFrame : integer; cRecArrayIndex : Integer; cStarType : TParticleType; Player: Cardinal); -begin - inherited Create; - // in this constructor we set all initial values for our particle - X := cX; - Y := cY; - Screen := cScreen; - Live := cLive; - Frame:= cFrame; - RecIndex := cRecArrayIndex; - StarType := cStarType; - Alpha := (-cos((Frame+1)*2*pi/16)+1); // neat fade-in-and-out - SetLength(Scale,1); - Scale[0] := 1; - SurviveSentenceChange := False; - SizeMod := 1; - case cStarType of - GoldenNote: - begin - Tex := Tex_Note_Star.TexNum; - W := 20; - H := 20; - SetLength(Scale,4); - Scale[1]:=0.8; - Scale[2]:=0.4; - Scale[3]:=0.3; - SetLength(Col,4); - Col[0].r := 1; - Col[0].g := 0.7; - Col[0].b := 0.1; - - Col[1].r := 1; - Col[1].g := 1; - Col[1].b := 0.4; - - Col[2].r := 1; - Col[2].g := 1; - Col[2].b := 1; - - Col[3].r := 1; - Col[3].g := 1; - Col[3].b := 1; - end; - PerfectNote: - begin - Tex := Tex_Note_Perfect_Star.TexNum; - W := 30; - H := 30; - SetLength(Col,1); - Col[0].r := 1; - Col[0].g := 1; - Col[0].b := 0.95; - end; - NoteHitTwinkle: - begin - Tex := Tex_Note_Star.TexNum; - Alpha := (Live/16); // linear fade-out - W := 15; - H := 15; - Setlength(Col,1); - Col[0].r := 1; - Col[0].g := 1; - Col[0].b := RandomRange(10*Live,100)/90; //0.9; - end; - PerfectLineTwinkle: - begin - Tex := Tex_Note_Star.TexNum; - W := RandomRange(10,20); - H := W; - SizeMod := (-cos((Frame+1)*5*2*pi/16)*0.5+1.1); - SurviveSentenceChange:=True; - // assign colours according to player given - SetLength(Scale,3); - Scale[1]:=0.3; - Scale[2]:=0.2; - SetLength(Col,3); - case Player of - 0: LoadColor(Col[0].r,Col[0].g,Col[0].b,'P1Light'); - 1: LoadColor(Col[0].r,Col[0].g,Col[0].b,'P2Light'); - 2: LoadColor(Col[0].r,Col[0].g,Col[0].b,'P3Light'); - 3: LoadColor(Col[0].r,Col[0].g,Col[0].b,'P4Light'); - 4: LoadColor(Col[0].r,Col[0].g,Col[0].b,'P5Light'); - 5: LoadColor(Col[0].r,Col[0].g,Col[0].b,'P6Light'); - else LoadColor(Col[0].r,Col[0].g,Col[0].b,'P1Light'); - end; - Col[1].r := 1; - Col[1].g := 1; - Col[1].b := 0.4; - Col[2].r:=Col[0].r+0.5; - Col[2].g:=Col[0].g+0.5; - Col[2].b:=Col[0].b+0.5; - mX := RandomRange(-5,5); - mY := RandomRange(-5,5); - end; - ColoredStar: - begin - Tex := Tex_Note_Star.TexNum; - W := RandomRange(10,20); - H := W; - SizeMod := (-cos((Frame+1)*5*2*pi/16)*0.5+1.1); - SurviveSentenceChange:=True; - // assign colours according to player given - SetLength(Scale,1); - SetLength(Col,1); - Col[0].b := (Player and $ff)/255; - Col[0].g := ((Player shr 8) and $ff)/255; - Col[0].r := ((Player shr 16) and $ff)/255; - mX := 0; - mY := 0; - end; - Flare: - begin - Tex := Tex_Note_Star.TexNum; - W := 7; - H := 7; - SizeMod := (-cos((Frame+1)*5*2*pi/16)*0.5+1.1); - mX := RandomRange(-5,5); - mY := RandomRange(-5,5); - SetLength(Scale,4); - Scale[1]:=0.8; - Scale[2]:=0.4; - Scale[3]:=0.3; - SetLength(Col,4); - Col[0].r := 1; - Col[0].g := 0.7; - Col[0].b := 0.1; - - Col[1].r := 1; - Col[1].g := 1; - Col[1].b := 0.4; - - Col[2].r := 1; - Col[2].g := 1; - Col[2].b := 1; - - Col[3].r := 1; - Col[3].g := 1; - Col[3].b := 1; - - end; - else // just some random default values - begin - Tex := Tex_Note_Star.TexNum; - Alpha := 1; - W := 20; - H := 20; - SetLength(Col,1); - Col[0].r := 1; - Col[0].g := 1; - Col[0].b := 1; - end; - end; -end; - -Destructor TParticle.Destroy(); -begin - SetLength(Scale,0); - SetLength(Col,0); - inherited; -end; - -procedure TParticle.LiveOn; -begin - //Live = 0 => Live forever ?? die werden doch aber im Manager bei Draw getötet, wenns 0 is - if (Live > 0) then - Dec(Live); - - // animate frames - Frame := ( Frame + 1 ) mod 16; - - // make our particles do funny stuff (besides being animated) - // changes of any particle-values throughout its life are done here - case StarType of - GoldenNote: - begin - Alpha := (-cos((Frame+1)*2*pi/16)+1); // neat fade-in-and-out - end; - PerfectNote: - begin - Alpha := (-cos((Frame+1)*2*pi/16)+1); // neat fade-in-and-out - end; - NoteHitTwinkle: - begin - Alpha := (Live/10); // linear fade-out - end; - PerfectLineTwinkle: - begin - Alpha := (-cos((Frame+1)*2*pi/16)+1); // neat fade-in-and-out - SizeMod := (-cos((Frame+1)*5*2*pi/16)*0.5+1.1); - // move around - X := X + mX; - Y := Y + mY; - end; - ColoredStar: - begin - Alpha := (-cos((Frame+1)*2*pi/16)+1); // neat fade-in-and-out - end; - Flare: - begin - Alpha := (-cos((Frame+1)/16*1.7*pi+0.3*pi)+1); // neat fade-in-and-out - SizeMod := (-cos((Frame+1)*5*2*pi/16)*0.5+1.1); - // move around - X := X + mX; - Y := Y + mY; - mY:=mY+1.8; -// mX:=mX/2; - end; - end; -end; - -procedure TParticle.Draw; -var L: Cardinal; -begin - if ScreenAct = Screen then - // this draws (multiple) texture(s) of our particle - for L:=0 to High(Col) do - begin - glColor4f(Col[L].r, Col[L].g, Col[L].b, Alpha); - - glBindTexture(GL_TEXTURE_2D, Tex); - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - begin - glBegin(GL_QUADS); - glTexCoord2f((1/16) * Frame, 0); glVertex2f(X-W*Scale[L]*SizeMod, Y-H*Scale[L]*SizeMod); - glTexCoord2f((1/16) * Frame + (1/16), 0); glVertex2f(X-W*Scale[L]*SizeMod, Y+H*Scale[L]*SizeMod); - glTexCoord2f((1/16) * Frame + (1/16), 1); glVertex2f(X+W*Scale[L]*SizeMod, Y+H*Scale[L]*SizeMod); - glTexCoord2f((1/16) * Frame, 1); glVertex2f(X+W*Scale[L]*SizeMod, Y-H*Scale[L]*SizeMod); - glEnd; - end; - end; - glcolor4f(1,1,1,1); -end; -// end of TParticle - -// TEffectManager - -constructor TEffectManager.Create; -var c: Cardinal; -begin - inherited; - LastTime := GetTickCount; - for c:=0 to 5 do - begin - TwinkleArray[c] := 0; - end; -end; - -destructor TEffectManager.Destroy; -begin - Killall; - inherited; -end; - - -procedure TEffectManager.Draw; -var - I: Integer; - CurrentTime: Cardinal; -//const -// DelayBetweenFrames : Cardinal = 100; -begin - - CurrentTime := GetTickCount; - //Manage particle life - if (CurrentTime - LastTime) > DelayBetweenFrames then - begin - LastTime := CurrentTime; - for I := 0 to high(Particle) do - Particle[I].LiveOn; - end; - - I := 0; - //Kill dead particles - while (I <= High(Particle)) do - begin - if (Particle[I].Live <= 0) then - begin - kill(I); - end - else - begin - inc(I); - end; - end; - - //Draw - for I := 0 to high(Particle) do - begin - Particle[I].Draw; - end; -end; - -// this method creates just one particle -function TEffectManager.Spawn(X, Y: Real; Screen: Integer; Live: Byte; StartFrame : Integer; RecArrayIndex : Integer; StarType : TParticleType; Player: Cardinal): Cardinal; -begin - Result := Length(Particle); - SetLength(Particle, (Result + 1)); - Particle[Result] := TParticle.Create(X, Y, Screen, Live, StartFrame, RecArrayIndex, StarType, Player); -end; - -// manage Sparkling of GoldenNote Bars -procedure TEffectManager.SpawnRec(); -Var - Xkatze, Ykatze : Real; - RandomFrame : Integer; - P : Integer; // P as seen on TV as Positionman -begin -//Spawn a random amount of stars within the given coordinates -//RandomRange(0,14) <- this one starts at a random frame, 16 is our last frame - would be senseless to start a particle with 16, cause it would be dead at the next frame -for P:= 0 to high(RecArray) do - begin - while (RecArray[P].TotalStarCount > RecArray[P].CurrentStarCount) do - begin - Xkatze := RandomRange(Ceil(RecArray[P].xTop), Ceil(RecArray[P].xBottom)); - Ykatze := RandomRange(Ceil(RecArray[P].yTop), Ceil(RecArray[P].yBottom)); - RandomFrame := RandomRange(0,14); - // Spawn a GoldenNote Particle - Spawn(Xkatze, Ykatze, RecArray[P].Screen, 16 - RandomFrame, RandomFrame, P, GoldenNote, 0); - inc(RecArray[P].CurrentStarCount); - end; - end; - draw; -end; - -// kill one particle (with given index in our particle array) -procedure TEffectManager.Kill(Index: Cardinal); -var - LastParticleIndex : Integer; -begin -// delete particle indexed by Index, -// overwrite it's place in our particle-array with the particle stored at the last array index, -// shorten array - LastParticleIndex := high(Particle); - if not(LastParticleIndex = -1) then // is there still a particle to delete? - begin - if not(Particle[Index].RecIndex = -1) then // if it is a GoldenNote particle... - dec(RecArray[Particle[Index].RecIndex].CurrentStarCount); // take care of its associated GoldenRec - // now get rid of that particle - Particle[Index].Destroy; - Particle[Index] := Particle[LastParticleIndex]; - SetLength(Particle, LastParticleIndex); - end; -end; - -// clean up all particles and management structures -procedure TEffectManager.KillAll(); -var c: Cardinal; -begin -//It's the kill all kennies rotuine - while Length(Particle) > 0 do // kill all existing particles - Kill(0); - SetLength(RecArray,0); // remove GoldenRec positions - SetLength(PerfNoteArray,0); // remove PerfectNote positions - for c:=0 to 5 do - begin - TwinkleArray[c] := 0; // reset GoldenNoteHit memory - end; -end; - -procedure TEffectManager.SentenceChange(); -var c: Cardinal; -begin - c:=0; - while c <= High(Particle) do - begin - if Particle[c].SurviveSentenceChange then - inc(c) - else - Kill(c); - end; - SetLength(RecArray,0); // remove GoldenRec positions - SetLength(PerfNoteArray,0); // remove PerfectNote positions - for c:=0 to 5 do - begin - TwinkleArray[c] := 0; // reset GoldenNoteHit memory - end; -end; - -procedure TeffectManager.GoldenNoteTwinkle(Top,Bottom,Right: Real; Player: Integer); -//Twinkle stars while golden note hit -// this is called from UDraw.pas, SingDrawPlayerCzesc -var - C, P, XKatze, YKatze, LKatze: Integer; - H: Real; -begin - // make sure we spawn only one time at one position - if (TwinkleArray[Player] < Right) then - For P := 0 to high(RecArray) do // Are we inside a GoldenNoteRectangle? - begin - H := (Top+Bottom)/2; // helper... - with RecArray[P] do - if ((xBottom >= Right) and (xTop <= Right) and - (yTop <= H) and (yBottom >= H)) - and (Screen = ScreenAct) then - begin - TwinkleArray[Player] := Right; // remember twinkle position for this player - for C := 1 to 10 do - begin - Ykatze := RandomRange(ceil(Top) , ceil(Bottom)); - XKatze := RandomRange(-7,3); - LKatze := RandomRange(7,13); - Spawn(Ceil(Right)+XKatze, YKatze, ScreenAct, LKatze, 0, -1, NoteHitTwinkle, 0); - end; - for C := 1 to 3 do - begin - Ykatze := RandomRange(ceil(Top)-6 , ceil(Top)); - XKatze := RandomRange(-5,1); - LKatze := RandomRange(4,7); - Spawn(Ceil(Right)+XKatze, YKatze, ScreenAct, LKatze, 0, -1, NoteHitTwinkle, 0); - end; - for C := 1 to 3 do - begin - Ykatze := RandomRange(ceil(Bottom), ceil(Bottom)+6); - XKatze := RandomRange(-5,1); - LKatze := RandomRange(4,7); - Spawn(Ceil(Right)+XKatze, YKatze, ScreenAct, LKatze, 0, -1, NoteHitTwinkle, 0); - end; - for C := 1 to 3 do - begin - Ykatze := RandomRange(ceil(Top)-10 , ceil(Top)-6); - XKatze := RandomRange(-5,1); - LKatze := RandomRange(1,4); - Spawn(Ceil(Right)+XKatze, YKatze, ScreenAct, LKatze, 0, -1, NoteHitTwinkle, 0); - end; - for C := 1 to 3 do - begin - Ykatze := RandomRange(ceil(Bottom)+6 , ceil(Bottom)+10); - XKatze := RandomRange(-5,1); - LKatze := RandomRange(1,4); - Spawn(Ceil(Right)+XKatze, YKatze, ScreenAct, LKatze, 0, -1, NoteHitTwinkle, 0); - end; - - exit; // found a matching GoldenRec, did spawning stuff... done - end; - end; -end; - -procedure TEffectManager.SaveGoldenStarsRec(Xtop, Ytop, Xbottom, Ybottom: Real); -var - P : Integer; // P like used in Positions - NewIndex : Integer; -begin - For P := 0 to high(RecArray) do // Do we already have that "new" position? - begin - if (ceil(RecArray[P].xTop) = ceil(Xtop)) and - (ceil(RecArray[P].yTop) = ceil(Ytop)) and - (ScreenAct = RecArray[p].Screen) then - exit; // it's already in the array, so we don't have to create a new one - end; - - // we got a new position, add the new positions to our array - NewIndex := Length(RecArray); - SetLength(RecArray, NewIndex + 1); - RecArray[NewIndex].xTop := Xtop; - RecArray[NewIndex].yTop := Ytop; - RecArray[NewIndex].xBottom := Xbottom; - RecArray[NewIndex].yBottom := Ybottom; - RecArray[NewIndex].TotalStarCount := ceil(Xbottom - Xtop) div 12 + 3; - RecArray[NewIndex].CurrentStarCount := 0; - RecArray[NewIndex].Screen := ScreenAct; -end; - -procedure TEffectManager.SavePerfectNotePos(Xtop, Ytop: Real); -var - P : Integer; // P like used in Positions - NewIndex : Integer; - RandomFrame : Integer; - Xkatze, Ykatze : Integer; -begin - For P := 0 to high(PerfNoteArray) do // Do we already have that "new" position? - begin - with PerfNoteArray[P] do - if (ceil(xPos) = ceil(Xtop)) and (ceil(yPos) = ceil(Ytop)) and - (Screen = ScreenAct) then - exit; // it's already in the array, so we don't have to create a new one - end; //for - - // we got a new position, add the new positions to our array - NewIndex := Length(PerfNoteArray); - SetLength(PerfNoteArray, NewIndex + 1); - PerfNoteArray[NewIndex].xPos := Xtop; - PerfNoteArray[NewIndex].yPos := Ytop; - PerfNoteArray[NewIndex].Screen := ScreenAct; - - for P:= 0 to 2 do - begin - Xkatze := RandomRange(ceil(Xtop) - 5 , ceil(Xtop) + 10); - Ykatze := RandomRange(ceil(Ytop) - 5 , ceil(Ytop) + 10); - RandomFrame := RandomRange(0,14); - Spawn(Xkatze, Ykatze, ScreenAct, 16 - RandomFrame, RandomFrame, -1, PerfectNote, 0); - end; //for - -end; - -procedure TEffectManager.SpawnPerfectLineTwinkle(); -var - P,I,Life: Cardinal; - Left, Right, Top, Bottom: Cardinal; - cScreen: Integer; -begin -// calculation of coordinates done with hardcoded values like in UDraw.pas -// might need to be adjusted if drawing of SingScreen is modified -// coordinates may still be a bit weird and need adjustment - if Ini.SingWindow = 0 then begin - Left := 130; - end else begin - Left := 30; - end; - Right := 770; - // spawn effect for every player with a perfect line - for P:=0 to PlayersPlay-1 do - if Player[P].LastSentencePerfect then - begin - // calculate area where notes of this player are drawn - case PlayersPlay of - 1: begin - Bottom:=Skin_P2_NotesB+10; - Top:=Bottom-105; - cScreen:=1; - end; - 2,4: begin - case P of - 0,2: begin - Bottom:=Skin_P1_NotesB+10; - Top:=Bottom-105; - end; - else begin - Bottom:=Skin_P2_NotesB+10; - Top:=Bottom-105; - end; - end; - case P of - 0,1: cScreen:=1; - else cScreen:=2; - end; - end; - 3,6: begin - case P of - 0,3: begin - Top:=130; - Bottom:=Top+85; - end; - 1,4: begin - Top:=255; - Bottom:=Top+85; - end; - 2,5: begin - Top:=380; - Bottom:=Top+85; - end; - end; - case P of - 0,1,2: cScreen:=1; - else cScreen:=2; - end; - end; - end; - // spawn Sparkling Stars inside calculated coordinates - for I:= 0 to 80 do - begin - Life:=RandomRange(8,16); - Spawn(RandomRange(Left,Right), RandomRange(Top,Bottom), cScreen, Life, 16-Life, -1, PerfectLineTwinkle, P); - end; - end; -end; - -end. - +// notes: +unit UGraphicClasses; + +interface + +{$I switches.inc} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses UTexture; + +const DelayBetweenFrames : Cardinal = 60; +type + + TParticleType=(GoldenNote, PerfectNote, NoteHitTwinkle, PerfectLineTwinkle, ColoredStar, Flare); + + TColour3f = Record + r, g, b: Real; + end; + + TParticle = Class + X, Y : Real; //Position + Screen : Integer; + W, H : Cardinal; //dimensions of particle + Col : array of TColour3f; // Colour(s) of particle + Scale : array of Real; // Scaling factors of particle layers + Frame : Byte; //act. Frame + Tex : Cardinal; //Tex num from Textur Manager + Live : Byte; //How many Cycles before Kill + RecIndex : Integer; //To which rectangle this particle belongs (only GoldenNote) + StarType : TParticleType; // GoldenNote | PerfectNote | NoteHitTwinkle | PerfectLineTwinkle + Alpha : Real; // used for fading... + mX, mY : Real; // movement-vector for PerfectLineTwinkle + SizeMod : Real; // experimental size modifier + SurviveSentenceChange : Boolean; + + Constructor Create(cX,cY: Real; cScreen: Integer; cLive: Byte; cFrame : integer; cRecArrayIndex : Integer; cStarType : TParticleType; Player: Cardinal); + Destructor Destroy(); override; + procedure Draw; + procedure LiveOn; + end; + + RectanglePositions = Record + xTop, yTop, xBottom, yBottom : Real; + TotalStarCount : Integer; + CurrentStarCount : Integer; + Screen : Integer; + end; + + PerfectNotePositions = Record + xPos, yPos : Real; + Screen : Integer; + end; + + TEffectManager = Class + Particle : array of TParticle; + LastTime : Cardinal; + RecArray : Array of RectanglePositions; + TwinkleArray : Array[0..5] of Real; // store x-position of last twinkle for every player + PerfNoteArray : Array of PerfectNotePositions; + + FlareTex: TTexture; + + constructor Create; + destructor Destroy; override; + procedure Draw; + function Spawn(X, Y: Real; + Screen: Integer; + Live: Byte; + StartFrame: Integer; + RecArrayIndex: Integer; // this is only used with GoldenNotes + StarType: TParticleType; + Player: Cardinal // for PerfectLineTwinkle + ): Cardinal; + procedure SpawnRec(); + procedure Kill(index: Cardinal); + procedure KillAll(); + procedure SentenceChange(); + procedure SaveGoldenStarsRec(Xtop, Ytop, Xbottom, Ybottom: Real); + procedure SavePerfectNotePos(Xtop, Ytop: Real); + procedure GoldenNoteTwinkle(Top,Bottom,Right: Real; Player: Integer); + procedure SpawnPerfectLineTwinkle(); + end; + +var GoldenRec : TEffectManager; + +implementation + +uses sysutils, + {$IFDEF win32} + windows, + {$ELSE} + lclintf, + {$ENDIF} + OpenGl12, + UIni, + UMain, + UThemes, + USkins, + UGraphic, + UDrawTexture, + UCommon, + math; + +//TParticle +Constructor TParticle.Create(cX,cY: Real; cScreen: Integer; cLive: Byte; cFrame : integer; cRecArrayIndex : Integer; cStarType : TParticleType; Player: Cardinal); +begin + inherited Create; + // in this constructor we set all initial values for our particle + X := cX; + Y := cY; + Screen := cScreen; + Live := cLive; + Frame:= cFrame; + RecIndex := cRecArrayIndex; + StarType := cStarType; + Alpha := (-cos((Frame+1)*2*pi/16)+1); // neat fade-in-and-out + SetLength(Scale,1); + Scale[0] := 1; + SurviveSentenceChange := False; + SizeMod := 1; + case cStarType of + GoldenNote: + begin + Tex := Tex_Note_Star.TexNum; + W := 20; + H := 20; + SetLength(Scale,4); + Scale[1]:=0.8; + Scale[2]:=0.4; + Scale[3]:=0.3; + SetLength(Col,4); + Col[0].r := 1; + Col[0].g := 0.7; + Col[0].b := 0.1; + + Col[1].r := 1; + Col[1].g := 1; + Col[1].b := 0.4; + + Col[2].r := 1; + Col[2].g := 1; + Col[2].b := 1; + + Col[3].r := 1; + Col[3].g := 1; + Col[3].b := 1; + end; + PerfectNote: + begin + Tex := Tex_Note_Perfect_Star.TexNum; + W := 30; + H := 30; + SetLength(Col,1); + Col[0].r := 1; + Col[0].g := 1; + Col[0].b := 0.95; + end; + NoteHitTwinkle: + begin + Tex := Tex_Note_Star.TexNum; + Alpha := (Live/16); // linear fade-out + W := 15; + H := 15; + Setlength(Col,1); + Col[0].r := 1; + Col[0].g := 1; + Col[0].b := RandomRange(10*Live,100)/90; //0.9; + end; + PerfectLineTwinkle: + begin + Tex := Tex_Note_Star.TexNum; + W := RandomRange(10,20); + H := W; + SizeMod := (-cos((Frame+1)*5*2*pi/16)*0.5+1.1); + SurviveSentenceChange:=True; + // assign colours according to player given + SetLength(Scale,3); + Scale[1]:=0.3; + Scale[2]:=0.2; + SetLength(Col,3); + case Player of + 0: LoadColor(Col[0].r,Col[0].g,Col[0].b,'P1Light'); + 1: LoadColor(Col[0].r,Col[0].g,Col[0].b,'P2Light'); + 2: LoadColor(Col[0].r,Col[0].g,Col[0].b,'P3Light'); + 3: LoadColor(Col[0].r,Col[0].g,Col[0].b,'P4Light'); + 4: LoadColor(Col[0].r,Col[0].g,Col[0].b,'P5Light'); + 5: LoadColor(Col[0].r,Col[0].g,Col[0].b,'P6Light'); + else LoadColor(Col[0].r,Col[0].g,Col[0].b,'P1Light'); + end; + Col[1].r := 1; + Col[1].g := 1; + Col[1].b := 0.4; + Col[2].r:=Col[0].r+0.5; + Col[2].g:=Col[0].g+0.5; + Col[2].b:=Col[0].b+0.5; + mX := RandomRange(-5,5); + mY := RandomRange(-5,5); + end; + ColoredStar: + begin + Tex := Tex_Note_Star.TexNum; + W := RandomRange(10,20); + H := W; + SizeMod := (-cos((Frame+1)*5*2*pi/16)*0.5+1.1); + SurviveSentenceChange:=True; + // assign colours according to player given + SetLength(Scale,1); + SetLength(Col,1); + Col[0].b := (Player and $ff)/255; + Col[0].g := ((Player shr 8) and $ff)/255; + Col[0].r := ((Player shr 16) and $ff)/255; + mX := 0; + mY := 0; + end; + Flare: + begin + Tex := Tex_Note_Star.TexNum; + W := 7; + H := 7; + SizeMod := (-cos((Frame+1)*5*2*pi/16)*0.5+1.1); + mX := RandomRange(-5,5); + mY := RandomRange(-5,5); + SetLength(Scale,4); + Scale[1]:=0.8; + Scale[2]:=0.4; + Scale[3]:=0.3; + SetLength(Col,4); + Col[0].r := 1; + Col[0].g := 0.7; + Col[0].b := 0.1; + + Col[1].r := 1; + Col[1].g := 1; + Col[1].b := 0.4; + + Col[2].r := 1; + Col[2].g := 1; + Col[2].b := 1; + + Col[3].r := 1; + Col[3].g := 1; + Col[3].b := 1; + + end; + else // just some random default values + begin + Tex := Tex_Note_Star.TexNum; + Alpha := 1; + W := 20; + H := 20; + SetLength(Col,1); + Col[0].r := 1; + Col[0].g := 1; + Col[0].b := 1; + end; + end; +end; + +Destructor TParticle.Destroy(); +begin + SetLength(Scale,0); + SetLength(Col,0); + inherited; +end; + +procedure TParticle.LiveOn; +begin + //Live = 0 => Live forever ?? die werden doch aber im Manager bei Draw getötet, wenns 0 is + if (Live > 0) then + Dec(Live); + + // animate frames + Frame := ( Frame + 1 ) mod 16; + + // make our particles do funny stuff (besides being animated) + // changes of any particle-values throughout its life are done here + case StarType of + GoldenNote: + begin + Alpha := (-cos((Frame+1)*2*pi/16)+1); // neat fade-in-and-out + end; + PerfectNote: + begin + Alpha := (-cos((Frame+1)*2*pi/16)+1); // neat fade-in-and-out + end; + NoteHitTwinkle: + begin + Alpha := (Live/10); // linear fade-out + end; + PerfectLineTwinkle: + begin + Alpha := (-cos((Frame+1)*2*pi/16)+1); // neat fade-in-and-out + SizeMod := (-cos((Frame+1)*5*2*pi/16)*0.5+1.1); + // move around + X := X + mX; + Y := Y + mY; + end; + ColoredStar: + begin + Alpha := (-cos((Frame+1)*2*pi/16)+1); // neat fade-in-and-out + end; + Flare: + begin + Alpha := (-cos((Frame+1)/16*1.7*pi+0.3*pi)+1); // neat fade-in-and-out + SizeMod := (-cos((Frame+1)*5*2*pi/16)*0.5+1.1); + // move around + X := X + mX; + Y := Y + mY; + mY:=mY+1.8; +// mX:=mX/2; + end; + end; +end; + +procedure TParticle.Draw; +var L: Cardinal; +begin + if ScreenAct = Screen then + // this draws (multiple) texture(s) of our particle + for L:=0 to High(Col) do + begin + glColor4f(Col[L].r, Col[L].g, Col[L].b, Alpha); + + glBindTexture(GL_TEXTURE_2D, Tex); + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + begin + glBegin(GL_QUADS); + glTexCoord2f((1/16) * Frame, 0); glVertex2f(X-W*Scale[L]*SizeMod, Y-H*Scale[L]*SizeMod); + glTexCoord2f((1/16) * Frame + (1/16), 0); glVertex2f(X-W*Scale[L]*SizeMod, Y+H*Scale[L]*SizeMod); + glTexCoord2f((1/16) * Frame + (1/16), 1); glVertex2f(X+W*Scale[L]*SizeMod, Y+H*Scale[L]*SizeMod); + glTexCoord2f((1/16) * Frame, 1); glVertex2f(X+W*Scale[L]*SizeMod, Y-H*Scale[L]*SizeMod); + glEnd; + end; + end; + glcolor4f(1,1,1,1); +end; +// end of TParticle + +// TEffectManager + +constructor TEffectManager.Create; +var c: Cardinal; +begin + inherited; + LastTime := GetTickCount; + for c:=0 to 5 do + begin + TwinkleArray[c] := 0; + end; +end; + +destructor TEffectManager.Destroy; +begin + Killall; + inherited; +end; + + +procedure TEffectManager.Draw; +var + I: Integer; + CurrentTime: Cardinal; +//const +// DelayBetweenFrames : Cardinal = 100; +begin + + CurrentTime := GetTickCount; + //Manage particle life + if (CurrentTime - LastTime) > DelayBetweenFrames then + begin + LastTime := CurrentTime; + for I := 0 to high(Particle) do + Particle[I].LiveOn; + end; + + I := 0; + //Kill dead particles + while (I <= High(Particle)) do + begin + if (Particle[I].Live <= 0) then + begin + kill(I); + end + else + begin + inc(I); + end; + end; + + //Draw + for I := 0 to high(Particle) do + begin + Particle[I].Draw; + end; +end; + +// this method creates just one particle +function TEffectManager.Spawn(X, Y: Real; Screen: Integer; Live: Byte; StartFrame : Integer; RecArrayIndex : Integer; StarType : TParticleType; Player: Cardinal): Cardinal; +begin + Result := Length(Particle); + SetLength(Particle, (Result + 1)); + Particle[Result] := TParticle.Create(X, Y, Screen, Live, StartFrame, RecArrayIndex, StarType, Player); +end; + +// manage Sparkling of GoldenNote Bars +procedure TEffectManager.SpawnRec(); +Var + Xkatze, Ykatze : Real; + RandomFrame : Integer; + P : Integer; // P as seen on TV as Positionman +begin +//Spawn a random amount of stars within the given coordinates +//RandomRange(0,14) <- this one starts at a random frame, 16 is our last frame - would be senseless to start a particle with 16, cause it would be dead at the next frame +for P:= 0 to high(RecArray) do + begin + while (RecArray[P].TotalStarCount > RecArray[P].CurrentStarCount) do + begin + Xkatze := RandomRange(Ceil(RecArray[P].xTop), Ceil(RecArray[P].xBottom)); + Ykatze := RandomRange(Ceil(RecArray[P].yTop), Ceil(RecArray[P].yBottom)); + RandomFrame := RandomRange(0,14); + // Spawn a GoldenNote Particle + Spawn(Xkatze, Ykatze, RecArray[P].Screen, 16 - RandomFrame, RandomFrame, P, GoldenNote, 0); + inc(RecArray[P].CurrentStarCount); + end; + end; + draw; +end; + +// kill one particle (with given index in our particle array) +procedure TEffectManager.Kill(Index: Cardinal); +var + LastParticleIndex : Integer; +begin +// delete particle indexed by Index, +// overwrite it's place in our particle-array with the particle stored at the last array index, +// shorten array + LastParticleIndex := high(Particle); + if not(LastParticleIndex = -1) then // is there still a particle to delete? + begin + if not(Particle[Index].RecIndex = -1) then // if it is a GoldenNote particle... + dec(RecArray[Particle[Index].RecIndex].CurrentStarCount); // take care of its associated GoldenRec + // now get rid of that particle + Particle[Index].Destroy; + Particle[Index] := Particle[LastParticleIndex]; + SetLength(Particle, LastParticleIndex); + end; +end; + +// clean up all particles and management structures +procedure TEffectManager.KillAll(); +var c: Cardinal; +begin +//It's the kill all kennies rotuine + while Length(Particle) > 0 do // kill all existing particles + Kill(0); + SetLength(RecArray,0); // remove GoldenRec positions + SetLength(PerfNoteArray,0); // remove PerfectNote positions + for c:=0 to 5 do + begin + TwinkleArray[c] := 0; // reset GoldenNoteHit memory + end; +end; + +procedure TEffectManager.SentenceChange(); +var c: Cardinal; +begin + c:=0; + while c <= High(Particle) do + begin + if Particle[c].SurviveSentenceChange then + inc(c) + else + Kill(c); + end; + SetLength(RecArray,0); // remove GoldenRec positions + SetLength(PerfNoteArray,0); // remove PerfectNote positions + for c:=0 to 5 do + begin + TwinkleArray[c] := 0; // reset GoldenNoteHit memory + end; +end; + +procedure TeffectManager.GoldenNoteTwinkle(Top,Bottom,Right: Real; Player: Integer); +//Twinkle stars while golden note hit +// this is called from UDraw.pas, SingDrawPlayerCzesc +var + C, P, XKatze, YKatze, LKatze: Integer; + H: Real; +begin + // make sure we spawn only one time at one position + if (TwinkleArray[Player] < Right) then + For P := 0 to high(RecArray) do // Are we inside a GoldenNoteRectangle? + begin + H := (Top+Bottom)/2; // helper... + with RecArray[P] do + if ((xBottom >= Right) and (xTop <= Right) and + (yTop <= H) and (yBottom >= H)) + and (Screen = ScreenAct) then + begin + TwinkleArray[Player] := Right; // remember twinkle position for this player + for C := 1 to 10 do + begin + Ykatze := RandomRange(ceil(Top) , ceil(Bottom)); + XKatze := RandomRange(-7,3); + LKatze := RandomRange(7,13); + Spawn(Ceil(Right)+XKatze, YKatze, ScreenAct, LKatze, 0, -1, NoteHitTwinkle, 0); + end; + for C := 1 to 3 do + begin + Ykatze := RandomRange(ceil(Top)-6 , ceil(Top)); + XKatze := RandomRange(-5,1); + LKatze := RandomRange(4,7); + Spawn(Ceil(Right)+XKatze, YKatze, ScreenAct, LKatze, 0, -1, NoteHitTwinkle, 0); + end; + for C := 1 to 3 do + begin + Ykatze := RandomRange(ceil(Bottom), ceil(Bottom)+6); + XKatze := RandomRange(-5,1); + LKatze := RandomRange(4,7); + Spawn(Ceil(Right)+XKatze, YKatze, ScreenAct, LKatze, 0, -1, NoteHitTwinkle, 0); + end; + for C := 1 to 3 do + begin + Ykatze := RandomRange(ceil(Top)-10 , ceil(Top)-6); + XKatze := RandomRange(-5,1); + LKatze := RandomRange(1,4); + Spawn(Ceil(Right)+XKatze, YKatze, ScreenAct, LKatze, 0, -1, NoteHitTwinkle, 0); + end; + for C := 1 to 3 do + begin + Ykatze := RandomRange(ceil(Bottom)+6 , ceil(Bottom)+10); + XKatze := RandomRange(-5,1); + LKatze := RandomRange(1,4); + Spawn(Ceil(Right)+XKatze, YKatze, ScreenAct, LKatze, 0, -1, NoteHitTwinkle, 0); + end; + + exit; // found a matching GoldenRec, did spawning stuff... done + end; + end; +end; + +procedure TEffectManager.SaveGoldenStarsRec(Xtop, Ytop, Xbottom, Ybottom: Real); +var + P : Integer; // P like used in Positions + NewIndex : Integer; +begin + For P := 0 to high(RecArray) do // Do we already have that "new" position? + begin + if (ceil(RecArray[P].xTop) = ceil(Xtop)) and + (ceil(RecArray[P].yTop) = ceil(Ytop)) and + (ScreenAct = RecArray[p].Screen) then + exit; // it's already in the array, so we don't have to create a new one + end; + + // we got a new position, add the new positions to our array + NewIndex := Length(RecArray); + SetLength(RecArray, NewIndex + 1); + RecArray[NewIndex].xTop := Xtop; + RecArray[NewIndex].yTop := Ytop; + RecArray[NewIndex].xBottom := Xbottom; + RecArray[NewIndex].yBottom := Ybottom; + RecArray[NewIndex].TotalStarCount := ceil(Xbottom - Xtop) div 12 + 3; + RecArray[NewIndex].CurrentStarCount := 0; + RecArray[NewIndex].Screen := ScreenAct; +end; + +procedure TEffectManager.SavePerfectNotePos(Xtop, Ytop: Real); +var + P : Integer; // P like used in Positions + NewIndex : Integer; + RandomFrame : Integer; + Xkatze, Ykatze : Integer; +begin + For P := 0 to high(PerfNoteArray) do // Do we already have that "new" position? + begin + with PerfNoteArray[P] do + if (ceil(xPos) = ceil(Xtop)) and (ceil(yPos) = ceil(Ytop)) and + (Screen = ScreenAct) then + exit; // it's already in the array, so we don't have to create a new one + end; //for + + // we got a new position, add the new positions to our array + NewIndex := Length(PerfNoteArray); + SetLength(PerfNoteArray, NewIndex + 1); + PerfNoteArray[NewIndex].xPos := Xtop; + PerfNoteArray[NewIndex].yPos := Ytop; + PerfNoteArray[NewIndex].Screen := ScreenAct; + + for P:= 0 to 2 do + begin + Xkatze := RandomRange(ceil(Xtop) - 5 , ceil(Xtop) + 10); + Ykatze := RandomRange(ceil(Ytop) - 5 , ceil(Ytop) + 10); + RandomFrame := RandomRange(0,14); + Spawn(Xkatze, Ykatze, ScreenAct, 16 - RandomFrame, RandomFrame, -1, PerfectNote, 0); + end; //for + +end; + +procedure TEffectManager.SpawnPerfectLineTwinkle(); +var + P,I,Life: Cardinal; + Left, Right, Top, Bottom: Cardinal; + cScreen: Integer; +begin +// calculation of coordinates done with hardcoded values like in UDraw.pas +// might need to be adjusted if drawing of SingScreen is modified +// coordinates may still be a bit weird and need adjustment + if Ini.SingWindow = 0 then begin + Left := 130; + end else begin + Left := 30; + end; + Right := 770; + // spawn effect for every player with a perfect line + for P:=0 to PlayersPlay-1 do + if Player[P].LastSentencePerfect then + begin + // calculate area where notes of this player are drawn + case PlayersPlay of + 1: begin + Bottom:=Skin_P2_NotesB+10; + Top:=Bottom-105; + cScreen:=1; + end; + 2,4: begin + case P of + 0,2: begin + Bottom:=Skin_P1_NotesB+10; + Top:=Bottom-105; + end; + else begin + Bottom:=Skin_P2_NotesB+10; + Top:=Bottom-105; + end; + end; + case P of + 0,1: cScreen:=1; + else cScreen:=2; + end; + end; + 3,6: begin + case P of + 0,3: begin + Top:=130; + Bottom:=Top+85; + end; + 1,4: begin + Top:=255; + Bottom:=Top+85; + end; + 2,5: begin + Top:=380; + Bottom:=Top+85; + end; + end; + case P of + 0,1,2: cScreen:=1; + else cScreen:=2; + end; + end; + end; + // spawn Sparkling Stars inside calculated coordinates + for I:= 0 to 80 do + begin + Life:=RandomRange(8,16); + Spawn(RandomRange(Left,Right), RandomRange(Top,Bottom), cScreen, Life, 16-Life, -1, PerfectLineTwinkle, P); + end; + end; +end; + +end. + diff --git a/Game/Code/Classes/UJoystick.pas b/Game/Code/Classes/UJoystick.pas index b0c7b8cc..6b4ea63f 100644 --- a/Game/Code/Classes/UJoystick.pas +++ b/Game/Code/Classes/UJoystick.pas @@ -1,273 +1,282 @@ -unit UJoystick; - -interface - -uses SDL; - -type - TJoyButton = record - State: integer; - Enabled: boolean; - Type_: byte; - Sym: cardinal; - end; - - TJoyHatState = record - State: Boolean; - LastTick: Cardinal; - Enabled: boolean; - Type_: byte; - Sym: cardinal; - end; - - TJoyUnit = record - Button: array[0..15] of TJoyButton; - HatState: Array[0..3] of TJoyHatState; - end; - - TJoy = class - constructor Create; - procedure Update; - end; - -var - Joy: TJoy; - JoyUnit: TJoyUnit; - SDL_Joy: PSDL_Joystick; - JoyEvent: TSDL_Event; - -implementation - -uses SysUtils, Windows, ULog; - -constructor TJoy.Create; -var - B, N: integer; -begin - //Old Corvus5 Method - {// joystick support - SDL_JoystickEventState(SDL_IGNORE); - SDL_InitSubSystem(SDL_INIT_JOYSTICK); - if SDL_NumJoysticks <> 1 then beep; - - SDL_Joy := SDL_JoystickOpen(0); - if SDL_Joy = nil then beep; - - if SDL_JoystickNumButtons(SDL_Joy) <> 16 then beep; - -// SDL_JoystickEventState(SDL_ENABLE); - // Events don't work - thay hang the whole application with SDL_JoystickEventState(SDL_ENABLE) - - // clear states - for B := 0 to 15 do - JoyUnit.Button[B].State := 1; - - // mapping - JoyUnit.Button[1].Enabled := true; - JoyUnit.Button[1].Type_ := SDL_KEYDOWN; - JoyUnit.Button[1].Sym := SDLK_RETURN; - JoyUnit.Button[2].Enabled := true; - JoyUnit.Button[2].Type_ := SDL_KEYDOWN; - JoyUnit.Button[2].Sym := SDLK_ESCAPE; - - JoyUnit.Button[12].Enabled := true; - JoyUnit.Button[12].Type_ := SDL_KEYDOWN; - JoyUnit.Button[12].Sym := SDLK_LEFT; - JoyUnit.Button[13].Enabled := true; - JoyUnit.Button[13].Type_ := SDL_KEYDOWN; - JoyUnit.Button[13].Sym := SDLK_DOWN; - JoyUnit.Button[14].Enabled := true; - JoyUnit.Button[14].Type_ := SDL_KEYDOWN; - JoyUnit.Button[14].Sym := SDLK_RIGHT; - JoyUnit.Button[15].Enabled := true; - JoyUnit.Button[15].Type_ := SDL_KEYDOWN; - JoyUnit.Button[15].Sym := SDLK_UP; - } - //New Sarutas method - SDL_JoystickEventState(SDL_IGNORE); - SDL_InitSubSystem(SDL_INIT_JOYSTICK); - if SDL_NumJoysticks < 1 then - begin - Log.LogError('No Joystick found'); - exit; - end; - - - SDL_Joy := SDL_JoystickOpen(0); - if SDL_Joy = nil then - begin - Log.LogError('Could not Init Joystick'); - exit; - end; - N := SDL_JoystickNumButtons(SDL_Joy); - //if N < 6 then beep; - - for B := 0 to 5 do begin - JoyUnit.Button[B].Enabled := true; - JoyUnit.Button[B].State := 1; - JoyUnit.Button[B].Type_ := SDL_KEYDOWN; - end; - - JoyUnit.Button[0].Sym := SDLK_Return; - JoyUnit.Button[1].Sym := SDLK_Escape; - JoyUnit.Button[2].Sym := SDLK_M; - JoyUnit.Button[3].Sym := SDLK_R; - - JoyUnit.Button[4].Sym := SDLK_RETURN; - JoyUnit.Button[5].Sym := SDLK_ESCAPE; - - //Set HatState - for B := 0 to 3 do begin - JoyUnit.HatState[B].Enabled := true; - JoyUnit.HatState[B].State := False; - JoyUnit.HatState[B].Type_ := SDL_KEYDOWN; - end; - - JoyUnit.HatState[0].Sym := SDLK_UP; - JoyUnit.HatState[1].Sym := SDLK_RIGHT; - JoyUnit.HatState[2].Sym := SDLK_DOWN; - JoyUnit.HatState[3].Sym := SDLK_LEFT; -end; - -procedure TJoy.Update; -var - B: integer; - State: UInt8; - Tick: Cardinal; - Axes: Smallint; -begin - SDL_JoystickUpdate; - - //Manage Buttons - for B := 0 to 15 do begin - if (JoyUnit.Button[B].Enabled) and (JoyUnit.Button[B].State <> SDL_JoystickGetButton(SDL_Joy, B)) and (JoyUnit.Button[B].State = 0) then begin - JoyEvent.type_ := JoyUnit.Button[B].Type_; - JoyEvent.key.keysym.sym := JoyUnit.Button[B].Sym; - SDL_PushEvent(@JoyEvent); - end; - end; - - - for B := 0 to 15 do begin - JoyUnit.Button[B].State := SDL_JoystickGetButton(SDL_Joy, B); - end; - - //Get Tick - Tick := Gettickcount; - - //Get CoolieHat - if (SDL_JoystickNumHats(SDL_Joy)>=1) then - State := SDL_JoystickGetHat(SDL_Joy, 0) - else - State := 0; - - //Get Axis - if (SDL_JoystickNumAxes(SDL_Joy)>=2) then - begin - //Down - Up (X- Axis) - Axes := SDL_JoystickGetAxis(SDL_Joy, 1); - If Axes >= 15000 then - State := State or SDL_HAT_Down - Else If Axes <= -15000 then - State := State or SDL_HAT_UP; - - //Left - Right (Y- Axis) - Axes := SDL_JoystickGetAxis(SDL_Joy, 0); - If Axes >= 15000 then - State := State or SDL_HAT_Right - Else If Axes <= -15000 then - State := State or SDL_HAT_Left; - end; - - //Manage Hat and joystick Events - if (SDL_JoystickNumHats(SDL_Joy)>=1) OR (SDL_JoystickNumAxes(SDL_Joy)>=2) then - begin - - //Up Button - If (JoyUnit.HatState[0].Enabled) and ((SDL_HAT_UP AND State) = SDL_HAT_UP) then - begin //IF Button is newly Pressed or if he is Pressed longer than 500 msecs - if (JoyUnit.HatState[0].State = False) OR (JoyUnit.HatState[0].Lasttick < Tick) then - begin - //Set Tick and State - if JoyUnit.HatState[0].State then - JoyUnit.HatState[0].Lasttick := Tick + 200 - else - JoyUnit.HatState[0].Lasttick := Tick + 500; - - JoyUnit.HatState[0].State := True; - - JoyEvent.type_ := JoyUnit.HatState[0].Type_; - JoyEvent.key.keysym.sym := JoyUnit.HatState[0].Sym; - SDL_PushEvent(@JoyEvent); - end; - end - else - JoyUnit.HatState[0].State := False; - - //Right Button - If (JoyUnit.HatState[1].Enabled) and ((SDL_HAT_RIGHT AND State) = SDL_HAT_RIGHT) then - begin //IF Button is newly Pressed or if he is Pressed longer than 500 msecs - if (JoyUnit.HatState[1].State = False) OR (JoyUnit.HatState[1].Lasttick < Tick) then - begin - //Set Tick and State - if JoyUnit.HatState[1].State then - JoyUnit.HatState[1].Lasttick := Tick + 200 - else - JoyUnit.HatState[1].Lasttick := Tick + 500; - - JoyUnit.HatState[1].State := True; - - JoyEvent.type_ := JoyUnit.HatState[1].Type_; - JoyEvent.key.keysym.sym := JoyUnit.HatState[1].Sym; - SDL_PushEvent(@JoyEvent); - end; - end - else - JoyUnit.HatState[1].State := False; - - //Down button - If (JoyUnit.HatState[2].Enabled) and ((SDL_HAT_DOWN AND State) = SDL_HAT_DOWN) then - begin //IF Button is newly Pressed or if he is Pressed longer than 230 msecs - if (JoyUnit.HatState[2].State = False) OR (JoyUnit.HatState[2].Lasttick < Tick) then - begin - //Set Tick and State - if JoyUnit.HatState[2].State then - JoyUnit.HatState[2].Lasttick := Tick + 200 - else - JoyUnit.HatState[2].Lasttick := Tick + 500; - - JoyUnit.HatState[2].State := True; - - JoyEvent.type_ := JoyUnit.HatState[2].Type_; - JoyEvent.key.keysym.sym := JoyUnit.HatState[2].Sym; - SDL_PushEvent(@JoyEvent); - end; - end - else - JoyUnit.HatState[2].State := False; - - //Left Button - If (JoyUnit.HatState[3].Enabled) and ((SDL_HAT_LEFT AND State) = SDL_HAT_LEFT) then - begin //IF Button is newly Pressed or if he is Pressed longer than 230 msecs - if (JoyUnit.HatState[3].State = False) OR (JoyUnit.HatState[3].Lasttick < Tick) then - begin - //Set Tick and State - if JoyUnit.HatState[3].State then - JoyUnit.HatState[3].Lasttick := Tick + 200 - else - JoyUnit.HatState[3].Lasttick := Tick + 500; - - JoyUnit.HatState[3].State := True; - - JoyEvent.type_ := JoyUnit.HatState[3].Type_; - JoyEvent.key.keysym.sym := JoyUnit.HatState[3].Sym; - SDL_PushEvent(@JoyEvent); - end; - end - else - JoyUnit.HatState[3].State := False; - end; - -end; - -end. +unit UJoystick; + +interface + +{$I switches.inc} + + +uses SDL; + +type + TJoyButton = record + State: integer; + Enabled: boolean; + Type_: byte; + Sym: cardinal; + end; + + TJoyHatState = record + State: Boolean; + LastTick: Cardinal; + Enabled: boolean; + Type_: byte; + Sym: cardinal; + end; + + TJoyUnit = record + Button: array[0..15] of TJoyButton; + HatState: Array[0..3] of TJoyHatState; + end; + + TJoy = class + constructor Create; + procedure Update; + end; + +var + Joy: TJoy; + JoyUnit: TJoyUnit; + SDL_Joy: PSDL_Joystick; + JoyEvent: TSDL_Event; + +implementation + +uses SysUtils, + {$IFDEF win32} + windows, + {$ELSE} + LCLIntf, + {$ENDIF} + ULog; + +constructor TJoy.Create; +var + B, N: integer; +begin + //Old Corvus5 Method + {// joystick support + SDL_JoystickEventState(SDL_IGNORE); + SDL_InitSubSystem(SDL_INIT_JOYSTICK); + if SDL_NumJoysticks <> 1 then beep; + + SDL_Joy := SDL_JoystickOpen(0); + if SDL_Joy = nil then beep; + + if SDL_JoystickNumButtons(SDL_Joy) <> 16 then beep; + +// SDL_JoystickEventState(SDL_ENABLE); + // Events don't work - thay hang the whole application with SDL_JoystickEventState(SDL_ENABLE) + + // clear states + for B := 0 to 15 do + JoyUnit.Button[B].State := 1; + + // mapping + JoyUnit.Button[1].Enabled := true; + JoyUnit.Button[1].Type_ := SDL_KEYDOWN; + JoyUnit.Button[1].Sym := SDLK_RETURN; + JoyUnit.Button[2].Enabled := true; + JoyUnit.Button[2].Type_ := SDL_KEYDOWN; + JoyUnit.Button[2].Sym := SDLK_ESCAPE; + + JoyUnit.Button[12].Enabled := true; + JoyUnit.Button[12].Type_ := SDL_KEYDOWN; + JoyUnit.Button[12].Sym := SDLK_LEFT; + JoyUnit.Button[13].Enabled := true; + JoyUnit.Button[13].Type_ := SDL_KEYDOWN; + JoyUnit.Button[13].Sym := SDLK_DOWN; + JoyUnit.Button[14].Enabled := true; + JoyUnit.Button[14].Type_ := SDL_KEYDOWN; + JoyUnit.Button[14].Sym := SDLK_RIGHT; + JoyUnit.Button[15].Enabled := true; + JoyUnit.Button[15].Type_ := SDL_KEYDOWN; + JoyUnit.Button[15].Sym := SDLK_UP; + } + //New Sarutas method + SDL_JoystickEventState(SDL_IGNORE); + SDL_InitSubSystem(SDL_INIT_JOYSTICK); + if SDL_NumJoysticks < 1 then + begin + Log.LogError('No Joystick found'); + exit; + end; + + + SDL_Joy := SDL_JoystickOpen(0); + if SDL_Joy = nil then + begin + Log.LogError('Could not Init Joystick'); + exit; + end; + N := SDL_JoystickNumButtons(SDL_Joy); + //if N < 6 then beep; + + for B := 0 to 5 do begin + JoyUnit.Button[B].Enabled := true; + JoyUnit.Button[B].State := 1; + JoyUnit.Button[B].Type_ := SDL_KEYDOWN; + end; + + JoyUnit.Button[0].Sym := SDLK_Return; + JoyUnit.Button[1].Sym := SDLK_Escape; + JoyUnit.Button[2].Sym := SDLK_M; + JoyUnit.Button[3].Sym := SDLK_R; + + JoyUnit.Button[4].Sym := SDLK_RETURN; + JoyUnit.Button[5].Sym := SDLK_ESCAPE; + + //Set HatState + for B := 0 to 3 do begin + JoyUnit.HatState[B].Enabled := true; + JoyUnit.HatState[B].State := False; + JoyUnit.HatState[B].Type_ := SDL_KEYDOWN; + end; + + JoyUnit.HatState[0].Sym := SDLK_UP; + JoyUnit.HatState[1].Sym := SDLK_RIGHT; + JoyUnit.HatState[2].Sym := SDLK_DOWN; + JoyUnit.HatState[3].Sym := SDLK_LEFT; +end; + +procedure TJoy.Update; +var + B: integer; + State: UInt8; + Tick: Cardinal; + Axes: Smallint; +begin + SDL_JoystickUpdate; + + //Manage Buttons + for B := 0 to 15 do begin + if (JoyUnit.Button[B].Enabled) and (JoyUnit.Button[B].State <> SDL_JoystickGetButton(SDL_Joy, B)) and (JoyUnit.Button[B].State = 0) then begin + JoyEvent.type_ := JoyUnit.Button[B].Type_; + JoyEvent.key.keysym.sym := JoyUnit.Button[B].Sym; + SDL_PushEvent(@JoyEvent); + end; + end; + + + for B := 0 to 15 do begin + JoyUnit.Button[B].State := SDL_JoystickGetButton(SDL_Joy, B); + end; + + //Get Tick + Tick := Gettickcount; + + //Get CoolieHat + if (SDL_JoystickNumHats(SDL_Joy)>=1) then + State := SDL_JoystickGetHat(SDL_Joy, 0) + else + State := 0; + + //Get Axis + if (SDL_JoystickNumAxes(SDL_Joy)>=2) then + begin + //Down - Up (X- Axis) + Axes := SDL_JoystickGetAxis(SDL_Joy, 1); + If Axes >= 15000 then + State := State or SDL_HAT_Down + Else If Axes <= -15000 then + State := State or SDL_HAT_UP; + + //Left - Right (Y- Axis) + Axes := SDL_JoystickGetAxis(SDL_Joy, 0); + If Axes >= 15000 then + State := State or SDL_HAT_Right + Else If Axes <= -15000 then + State := State or SDL_HAT_Left; + end; + + //Manage Hat and joystick Events + if (SDL_JoystickNumHats(SDL_Joy)>=1) OR (SDL_JoystickNumAxes(SDL_Joy)>=2) then + begin + + //Up Button + If (JoyUnit.HatState[0].Enabled) and ((SDL_HAT_UP AND State) = SDL_HAT_UP) then + begin //IF Button is newly Pressed or if he is Pressed longer than 500 msecs + if (JoyUnit.HatState[0].State = False) OR (JoyUnit.HatState[0].Lasttick < Tick) then + begin + //Set Tick and State + if JoyUnit.HatState[0].State then + JoyUnit.HatState[0].Lasttick := Tick + 200 + else + JoyUnit.HatState[0].Lasttick := Tick + 500; + + JoyUnit.HatState[0].State := True; + + JoyEvent.type_ := JoyUnit.HatState[0].Type_; + JoyEvent.key.keysym.sym := JoyUnit.HatState[0].Sym; + SDL_PushEvent(@JoyEvent); + end; + end + else + JoyUnit.HatState[0].State := False; + + //Right Button + If (JoyUnit.HatState[1].Enabled) and ((SDL_HAT_RIGHT AND State) = SDL_HAT_RIGHT) then + begin //IF Button is newly Pressed or if he is Pressed longer than 500 msecs + if (JoyUnit.HatState[1].State = False) OR (JoyUnit.HatState[1].Lasttick < Tick) then + begin + //Set Tick and State + if JoyUnit.HatState[1].State then + JoyUnit.HatState[1].Lasttick := Tick + 200 + else + JoyUnit.HatState[1].Lasttick := Tick + 500; + + JoyUnit.HatState[1].State := True; + + JoyEvent.type_ := JoyUnit.HatState[1].Type_; + JoyEvent.key.keysym.sym := JoyUnit.HatState[1].Sym; + SDL_PushEvent(@JoyEvent); + end; + end + else + JoyUnit.HatState[1].State := False; + + //Down button + If (JoyUnit.HatState[2].Enabled) and ((SDL_HAT_DOWN AND State) = SDL_HAT_DOWN) then + begin //IF Button is newly Pressed or if he is Pressed longer than 230 msecs + if (JoyUnit.HatState[2].State = False) OR (JoyUnit.HatState[2].Lasttick < Tick) then + begin + //Set Tick and State + if JoyUnit.HatState[2].State then + JoyUnit.HatState[2].Lasttick := Tick + 200 + else + JoyUnit.HatState[2].Lasttick := Tick + 500; + + JoyUnit.HatState[2].State := True; + + JoyEvent.type_ := JoyUnit.HatState[2].Type_; + JoyEvent.key.keysym.sym := JoyUnit.HatState[2].Sym; + SDL_PushEvent(@JoyEvent); + end; + end + else + JoyUnit.HatState[2].State := False; + + //Left Button + If (JoyUnit.HatState[3].Enabled) and ((SDL_HAT_LEFT AND State) = SDL_HAT_LEFT) then + begin //IF Button is newly Pressed or if he is Pressed longer than 230 msecs + if (JoyUnit.HatState[3].State = False) OR (JoyUnit.HatState[3].Lasttick < Tick) then + begin + //Set Tick and State + if JoyUnit.HatState[3].State then + JoyUnit.HatState[3].Lasttick := Tick + 200 + else + JoyUnit.HatState[3].Lasttick := Tick + 500; + + JoyUnit.HatState[3].State := True; + + JoyEvent.type_ := JoyUnit.HatState[3].Type_; + JoyEvent.key.keysym.sym := JoyUnit.HatState[3].Sym; + SDL_PushEvent(@JoyEvent); + end; + end + else + JoyUnit.HatState[3].State := False; + end; + +end; + +end. diff --git a/Game/Code/Classes/ULanguage.pas b/Game/Code/Classes/ULanguage.pas index f693694b..679f6405 100644 --- a/Game/Code/Classes/ULanguage.pas +++ b/Game/Code/Classes/ULanguage.pas @@ -1,234 +1,236 @@ -unit ULanguage; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - -type - TLanguageEntry = record - ID: string; - Text: string; - end; - - TLanguageList = record - Name: string; - {FileName: string; } - end; - - TLanguage = class - public - Entry: array of TLanguageEntry; //Entrys of Chosen Language - SEntry: array of TLanguageEntry; //Entrys of Standard Language - CEntry: array of TLanguageEntry; //Constant Entrys e.g. Version - Implode_Glue1, Implode_Glue2: String; - public - List: array of TLanguageList; - - constructor Create; - procedure LoadList; - function Translate(Text: String): String; - procedure ChangeLanguage(Language: String); - procedure AddConst(ID, Text: String); - procedure ChangeConst(ID, Text: String); - function Implode(Pieces: Array of String): String; - end; - -var - Language: TLanguage; - -implementation - -uses UMain, - // UFiles, - UIni, - IniFiles, - Classes, - SysUtils, - Windows, - ULog; - -//---------- -//Create - Construct Class then LoadList + Standard Language + Set Standard Implode Glues -//---------- -constructor TLanguage.Create; -var - I, J: Integer; -begin - LoadList; - - //Set Implode Glues for Backward Compatibility - Implode_Glue1 := ', '; - Implode_Glue2 := ' and '; - - if (Length(List) = 0) then //No Language Files Loaded -> Abort Loading - Log.CriticalError('Could not load any Language File'); - - //Standard Language (If a Language File is Incomplete) - //Then use English Language - for I := 0 to high(List) do //Search for English Language - begin - //English Language Found -> Load - if Uppercase(List[I].Name) = 'ENGLISH' then - begin - ChangeLanguage('English'); - - SetLength(SEntry, Length(Entry)); - for J := low(Entry) to high(Entry) do - SEntry[J] := Entry[J]; - - SetLength(Entry, 0); - - Break; - end; - - if (I = high(List)) then - Log.LogError('English Languagefile missing! No standard Translation loaded'); - end; - //Standard Language END - -end; - -//---------- -//LoadList - Parse the Language Dir searching Translations -//---------- -procedure TLanguage.LoadList; -var - SR: TSearchRec; // for parsing directory -begin - SetLength(List, 0); - SetLength(ILanguage, 0); - - if FindFirst(LanguagesPath + '*.ini', 0, SR) = 0 then begin - repeat - SetLength(List, Length(List)+1); - SetLength(ILanguage, Length(ILanguage)+1); - SR.Name := ChangeFileExt(SR.Name, ''); - - List[High(List)].Name := SR.Name; - ILanguage[High(ILanguage)] := SR.Name; - - until FindNext(SR) <> 0; - SysUtils.FindClose(SR); - end; // if FindFirst -end; - -//---------- -//ChangeLanguage - Load the specified LanguageFile -//---------- -procedure TLanguage.ChangeLanguage(Language: String); -var - IniFile: TIniFile; - E: integer; // entry - S: TStringList; -begin - SetLength(Entry, 0); - IniFile := TIniFile.Create(LanguagesPath + Language + '.ini'); - S := TStringList.Create; - - IniFile.ReadSectionValues('Text', S); - SetLength(Entry, S.Count); - for E := 0 to high(Entry) do - begin - if S.Names[E] = 'IMPLODE_GLUE1' then - Implode_Glue1 := S.ValueFromIndex[E]+ ' ' - else if S.Names[E] = 'IMPLODE_GLUE2' then - Implode_Glue2 := ' ' + S.ValueFromIndex[E] + ' '; - - Entry[E].ID := S.Names[E]; - Entry[E].Text := S.ValueFromIndex[E]; - end; - - S.Free; - IniFile.Free; -end; - -//---------- -//Translate - Translate the Text -//---------- -Function TLanguage.Translate(Text: String): String; -var - E: integer; // entry -begin - Result := Text; - Text := Uppercase(Result); - - //Const Mod - for E := 0 to high(CEntry) do - if Text = CEntry[E].ID then - begin - Result := CEntry[E].Text; - exit; - end; - //Const Mod End - - for E := 0 to high(Entry) do - if Text = Entry[E].ID then - begin - Result := Entry[E].Text; - exit; - end; - - //Standard Language (If a Language File is Incomplete) - //Then use Standard Language - for E := low(SEntry) to high(SEntry) do - if Text = SEntry[E].ID then - begin - Result := SEntry[E].Text; - Break; - end; - //Standard Language END -end; - -//---------- -//AddConst - Add a Constant ID that will be Translated but not Loaded from the LanguageFile -//---------- -procedure TLanguage.AddConst (ID, Text: String); -begin - SetLength (CEntry, Length(CEntry) + 1); - CEntry[high(CEntry)].ID := ID; - CEntry[high(CEntry)].Text := Text; -end; - -//---------- -//ChangeConst - Change a Constant Value by ID -//---------- -procedure TLanguage.ChangeConst(ID, Text: String); -var - I: Integer; -begin - for I := 0 to high(CEntry) do - begin - if CEntry[I].ID = ID then - begin - CEntry[I].Text := Text; - Break; - end; - end; -end; - -//---------- -//Implode - Connect an Array of Strings with ' and ' or ', ' to one String -//---------- -function TLanguage.Implode(Pieces: Array of String): String; -var - I: Integer; -begin - Result := ''; - //Go through Pieces - for I := low(Pieces) to high(Pieces) do - begin - //Add Value - Result := Result + Pieces[I]; - - //Add Glue - if (I < high(Pieces) - 1) then - Result := Result + Implode_Glue1 - else if (I < high(Pieces)) then - Result := Result + Implode_Glue2; - end; -end; - -end. +unit ULanguage; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +type + TLanguageEntry = record + ID: string; + Text: string; + end; + + TLanguageList = record + Name: string; + {FileName: string; } + end; + + TLanguage = class + public + Entry: array of TLanguageEntry; //Entrys of Chosen Language + SEntry: array of TLanguageEntry; //Entrys of Standard Language + CEntry: array of TLanguageEntry; //Constant Entrys e.g. Version + Implode_Glue1, Implode_Glue2: String; + public + List: array of TLanguageList; + + constructor Create; + procedure LoadList; + function Translate(Text: String): String; + procedure ChangeLanguage(Language: String); + procedure AddConst(ID, Text: String); + procedure ChangeConst(ID, Text: String); + function Implode(Pieces: Array of String): String; + end; + +var + Language: TLanguage; + +implementation + +uses UMain, + // UFiles, + UIni, + IniFiles, + Classes, + SysUtils, + {$IFDEF win32} + windows, + {$ENDIF} + ULog; + +//---------- +//Create - Construct Class then LoadList + Standard Language + Set Standard Implode Glues +//---------- +constructor TLanguage.Create; +var + I, J: Integer; +begin + LoadList; + + //Set Implode Glues for Backward Compatibility + Implode_Glue1 := ', '; + Implode_Glue2 := ' and '; + + if (Length(List) = 0) then //No Language Files Loaded -> Abort Loading + Log.CriticalError('Could not load any Language File'); + + //Standard Language (If a Language File is Incomplete) + //Then use English Language + for I := 0 to high(List) do //Search for English Language + begin + //English Language Found -> Load + if Uppercase(List[I].Name) = 'ENGLISH' then + begin + ChangeLanguage('English'); + + SetLength(SEntry, Length(Entry)); + for J := low(Entry) to high(Entry) do + SEntry[J] := Entry[J]; + + SetLength(Entry, 0); + + Break; + end; + + if (I = high(List)) then + Log.LogError('English Languagefile missing! No standard Translation loaded'); + end; + //Standard Language END + +end; + +//---------- +//LoadList - Parse the Language Dir searching Translations +//---------- +procedure TLanguage.LoadList; +var + SR: TSearchRec; // for parsing directory +begin + SetLength(List, 0); + SetLength(ILanguage, 0); + + if FindFirst(LanguagesPath + '*.ini', 0, SR) = 0 then begin + repeat + SetLength(List, Length(List)+1); + SetLength(ILanguage, Length(ILanguage)+1); + SR.Name := ChangeFileExt(SR.Name, ''); + + List[High(List)].Name := SR.Name; + ILanguage[High(ILanguage)] := SR.Name; + + until FindNext(SR) <> 0; + SysUtils.FindClose(SR); + end; // if FindFirst +end; + +//---------- +//ChangeLanguage - Load the specified LanguageFile +//---------- +procedure TLanguage.ChangeLanguage(Language: String); +var + IniFile: TIniFile; + E: integer; // entry + S: TStringList; +begin + SetLength(Entry, 0); + IniFile := TIniFile.Create(LanguagesPath + Language + '.ini'); + S := TStringList.Create; + + IniFile.ReadSectionValues('Text', S); + SetLength(Entry, S.Count); + for E := 0 to high(Entry) do + begin + if S.Names[E] = 'IMPLODE_GLUE1' then + Implode_Glue1 := S.ValueFromIndex[E]+ ' ' + else if S.Names[E] = 'IMPLODE_GLUE2' then + Implode_Glue2 := ' ' + S.ValueFromIndex[E] + ' '; + + Entry[E].ID := S.Names[E]; + Entry[E].Text := S.ValueFromIndex[E]; + end; + + S.Free; + IniFile.Free; +end; + +//---------- +//Translate - Translate the Text +//---------- +Function TLanguage.Translate(Text: String): String; +var + E: integer; // entry +begin + Result := Text; + Text := Uppercase(Result); + + //Const Mod + for E := 0 to high(CEntry) do + if Text = CEntry[E].ID then + begin + Result := CEntry[E].Text; + exit; + end; + //Const Mod End + + for E := 0 to high(Entry) do + if Text = Entry[E].ID then + begin + Result := Entry[E].Text; + exit; + end; + + //Standard Language (If a Language File is Incomplete) + //Then use Standard Language + for E := low(SEntry) to high(SEntry) do + if Text = SEntry[E].ID then + begin + Result := SEntry[E].Text; + Break; + end; + //Standard Language END +end; + +//---------- +//AddConst - Add a Constant ID that will be Translated but not Loaded from the LanguageFile +//---------- +procedure TLanguage.AddConst (ID, Text: String); +begin + SetLength (CEntry, Length(CEntry) + 1); + CEntry[high(CEntry)].ID := ID; + CEntry[high(CEntry)].Text := Text; +end; + +//---------- +//ChangeConst - Change a Constant Value by ID +//---------- +procedure TLanguage.ChangeConst(ID, Text: String); +var + I: Integer; +begin + for I := 0 to high(CEntry) do + begin + if CEntry[I].ID = ID then + begin + CEntry[I].Text := Text; + Break; + end; + end; +end; + +//---------- +//Implode - Connect an Array of Strings with ' and ' or ', ' to one String +//---------- +function TLanguage.Implode(Pieces: Array of String): String; +var + I: Integer; +begin + Result := ''; + //Go through Pieces + for I := low(Pieces) to high(Pieces) do + begin + //Add Value + Result := Result + Pieces[I]; + + //Add Glue + if (I < high(Pieces) - 1) then + Result := Result + Implode_Glue1 + else if (I < high(Pieces)) then + Result := Result + Implode_Glue2; + end; +end; + +end. diff --git a/Game/Code/Classes/ULight.pas b/Game/Code/Classes/ULight.pas index 74681a85..99edc88c 100644 --- a/Game/Code/Classes/ULight.pas +++ b/Game/Code/Classes/ULight.pas @@ -1,149 +1,162 @@ -unit ULight; -interface -{$I switches.inc} - -type - TLight = class - private - Enabled: boolean; - Light: array[0..7] of boolean; - LightTime: array[0..7] of real; // time to stop, need to call update to change state - LastTime: real; - public - constructor Create; - procedure Enable; - procedure SetState(State: integer); - procedure AutoSetState; - procedure TurnOn; - procedure TurnOff; - procedure LightOne(Number: integer; Time: real); - procedure Refresh; - end; - -var - Light: TLight; - -const - Data = $378; // default port address - Status = Data + 1; - Control = Data + 2; - -implementation - -uses - SysUtils, - {$IFDEF UseSerialPort} - zlportio, - {$ENDIF} - UTime; - -{$IFDEF FPC} - function GetTime: TDateTime; - {$IFDEF MSWINDOWS} - var - SystemTime: TSystemTime; - begin - GetLocalTime(SystemTime); - with SystemTime do - Result := EncodeTime(wHour, wMinute, wSecond, wMilliSeconds); - end; - {$ENDIF} - {$IFDEF LINUX} - var - T: TTime_T; - TV: TTimeVal; - UT: TUnixTime; - begin - gettimeofday(TV, nil); - T := TV.tv_sec; - localtime_r(@T, UT); - Result := EncodeTime(UT.tm_hour, UT.tm_min, UT.tm_sec, TV.tv_usec div 1000); - end; - {$ENDIF} -{$ENDIF} - - -constructor TLight.Create; -begin - Enabled := false; -end; - -procedure TLight.Enable; -begin - Enabled := true; - LastTime := GetTime; -end; - -procedure TLight.SetState(State: integer); -begin - {$IFDEF UseSerialPort} - if Enabled then - PortWriteB($378, State); - {$ENDIF} -end; - -procedure TLight.AutoSetState; -var - State: integer; -begin - if Enabled then begin - State := 0; - if Light[0] then State := State + 2; - if Light[1] then State := State + 1; - // etc - SetState(State); - end; -end; - -procedure TLight.TurnOn; -begin - if Enabled then - SetState(3); -end; - -procedure TLight.TurnOff; -begin - if Enabled then - SetState(0); -end; - -procedure TLight.LightOne(Number: integer; Time: real); -begin - if Enabled then begin - if Light[Number] = false then begin - Light[Number] := true; - AutoSetState; - end; - - LightTime[Number] := GetTime + Time/1000; // [s] - end; -end; - -procedure TLight.Refresh; -var - Time: real; -// TimeSkip: real; - L: integer; -begin - if Enabled then begin - Time := GetTime; -// TimeSkip := Time - LastTime; - for L := 0 to 7 do begin - if Light[L] = true then begin - if LightTime[L] > Time then begin - // jest jeszcze zapas - bez zmian - //LightTime[L] := LightTime[L] - TimeSkip; - end else begin - // czas minal - Light[L] := false; - end; - end; - end; - LastTime := Time; - AutoSetState; - end; -end; - -end. - - +unit ULight; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +type + TLight = class + private + Enabled: boolean; + Light: array[0..7] of boolean; + LightTime: array[0..7] of real; // time to stop, need to call update to change state + LastTime: real; + public + constructor Create; + procedure Enable; + procedure SetState(State: integer); + procedure AutoSetState; + procedure TurnOn; + procedure TurnOff; + procedure LightOne(Number: integer; Time: real); + procedure Refresh; + end; + +var + Light: TLight; + +const + Data = $378; // default port address + Status = Data + 1; + Control = Data + 2; + +implementation + +uses + SysUtils, + {$IFDEF UseSerialPort} + zlportio, + {$ENDIF} + {$IFNDEF win32} + libc, + {$ENDIF} + UTime; + +{$IFDEF FPC} + + function GetTime: TDateTime; + {$IFDEF win32} + var + SystemTime: TSystemTime; + begin + GetLocalTime(SystemTime); + with SystemTime do + Result := EncodeTime(wHour, wMinute, wSecond, wMilliSeconds); + end; + {$ELSE} + Type + Time_t = longint; + TTime_T = Time_t; + var + T : TTime_T; + TV: TTimeVal; + UT: TUnixTime; + begin + gettimeofday(TV, nil); + T := TV.tv_sec; + localtime_r(@T, @UT); + Result := EncodeTime(UT.tm_hour, UT.tm_min, UT.tm_sec, TV.tv_usec div 1000); + end; + {$ENDIF} + +{$ENDIF} + + +constructor TLight.Create; +begin + Enabled := false; +end; + +procedure TLight.Enable; +begin + Enabled := true; + LastTime := GetTime; +end; + +procedure TLight.SetState(State: integer); +begin + {$IFDEF UseSerialPort} + if Enabled then + PortWriteB($378, State); + {$ENDIF} +end; + +procedure TLight.AutoSetState; +var + State: integer; +begin + if Enabled then begin + State := 0; + if Light[0] then State := State + 2; + if Light[1] then State := State + 1; + // etc + SetState(State); + end; +end; + +procedure TLight.TurnOn; +begin + if Enabled then + SetState(3); +end; + +procedure TLight.TurnOff; +begin + if Enabled then + SetState(0); +end; + +procedure TLight.LightOne(Number: integer; Time: real); +begin + if Enabled then begin + if Light[Number] = false then begin + Light[Number] := true; + AutoSetState; + end; + + LightTime[Number] := GetTime + Time/1000; // [s] + end; +end; + +procedure TLight.Refresh; +var + Time: real; +// TimeSkip: real; + L: integer; +begin + if Enabled then begin + Time := GetTime; +// TimeSkip := Time - LastTime; + for L := 0 to 7 do begin + if Light[L] = true then begin + if LightTime[L] > Time then begin + // jest jeszcze zapas - bez zmian + //LightTime[L] := LightTime[L] - TimeSkip; + end else begin + // czas minal + Light[L] := false; + end; + end; + end; + LastTime := Time; + AutoSetState; + end; +end; + +end. + + diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index d03ad8ed..7c93c6e9 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -1,243 +1,253 @@ -unit ULog; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -uses Classes; - -type - TLog = class - BenchmarkTimeStart: array[0..7] of real; - BenchmarkTimeLength: array[0..7] of real;//TDateTime; - - FileBenchmark: TextFile; - FileBenchmarkO: boolean; // opened - FileError: TextFile; - FileErrorO: boolean; // opened - - Title: String; //Application Title - - //Should Log Files be written - Enabled: Boolean; - - // destuctor - destructor Free; - - // benchmark - procedure BenchmarkStart(Number: integer); - procedure BenchmarkEnd(Number: integer); - procedure LogBenchmark(Text: string; Number: integer); - - // error - procedure LogError(Text: string); overload; - - //Critical Error (Halt + MessageBox) - procedure CriticalError(Text: string); - - // voice - procedure LogVoice(SoundNr: integer); - - // compability - procedure LogStatus(Log1, Log2: string); - procedure LogError(Log1, Log2: string); overload; - end; - -var - Log: TLog; - -implementation - -uses - Windows, - SysUtils, - DateUtils, -// UFiles, - UMain, - URecord, - UTime, -// UIni, // JB - Seems to not be needed. - UCommandLine; - -destructor TLog.Free; -begin - if FileBenchmarkO then CloseFile(FileBenchmark); -// if FileAnalyzeO then CloseFile(FileAnalyze); - if FileErrorO then CloseFile(FileError); -end; - -procedure TLog.BenchmarkStart(Number: integer); -begin - BenchmarkTimeStart[Number] := USTime.GetTime; //Time; -end; - -procedure TLog.BenchmarkEnd(Number: integer); -begin - BenchmarkTimeLength[Number] := USTime.GetTime {Time} - BenchmarkTimeStart[Number]; -end; - -procedure TLog.LogBenchmark(Text: string; Number: integer); -var - Minutes: integer; - Seconds: integer; - Miliseconds: integer; - - MinutesS: string; - SecondsS: string; - MilisecondsS: string; - - ValueText: string; -begin - if Enabled AND (Params.Benchmark) then begin - if not FileBenchmarkO then begin - FileBenchmarkO := true; - AssignFile(FileBenchmark, LogPath + 'Benchmark.log'); - {$I-} - Rewrite(FileBenchmark); - if IOResult = 0 then FileBenchmarkO := true; - {$I+} - - //If File is opened write Date to Benchmark File - If (FileBenchmarkO) then - begin - WriteLn(FileBenchmark, Title + ' Benchmark File'); - WriteLn(FileBenchmark, 'Date: ' + DatetoStr(Now) + ' Time: ' + TimetoStr(Now)); - WriteLn(FileBenchmark, '-------------------'); - - Flush(FileBenchmark); - end; - end; - - if FileBenchmarkO then begin - Miliseconds := Trunc(Frac(BenchmarkTimeLength[Number]) * 1000); - Seconds := Trunc(BenchmarkTimeLength[Number]) mod 60; - Minutes := Trunc((BenchmarkTimeLength[Number] - Seconds) / 60); -// ValueText := FloatToStr(BenchmarkTimeLength[Number]); - -{ ValueText := FloatToStr( - SecondOf(BenchmarkTimeLength[Number]) + MilliSecondOf(BenchmarkTimeLength[Number])/1000 - ); - if MinuteOf(BenchmarkTimeLength[Number]) >= 1 then - ValueText := IntToStr(MinuteOf(BenchmarkTimeLength[Number])) + ':' + ValueText; - WriteLn(FileBenchmark, Text + ': ' + ValueText + ' seconds');} - - if (Minutes = 0) and (Seconds = 0) then begin - MilisecondsS := IntToStr(Miliseconds); - ValueText := MilisecondsS + ' miliseconds'; - end; - - if (Minutes = 0) and (Seconds >= 1) then begin - MilisecondsS := IntToStr(Miliseconds); - while Length(MilisecondsS) < 3 do MilisecondsS := '0' + MilisecondsS; - - SecondsS := IntToStr(Seconds); - - ValueText := SecondsS + ',' + MilisecondsS + ' seconds'; - end; - - if Minutes >= 1 then begin - MilisecondsS := IntToStr(Miliseconds); - while Length(MilisecondsS) < 3 do MilisecondsS := '0' + MilisecondsS; - - SecondsS := IntToStr(Seconds); - while Length(SecondsS) < 2 do SecondsS := '0' + SecondsS; - - MinutesS := IntToStr(Minutes); - - ValueText := MinutesS + ':' + SecondsS + ',' + MilisecondsS + ' minutes'; - end; - - WriteLn(FileBenchmark, Text + ': ' + ValueText); - Flush(FileBenchmark); - end; - end; -end; - -procedure TLog.LogError(Text: string); -begin - if Enabled AND (not FileErrorO) then begin - FileErrorO := true; - AssignFile(FileError, LogPath + 'Error.log'); - {$I-} - Rewrite(FileError); - if IOResult = 0 then FileErrorO := true; - {$I+} - - //If File is opened write Date to Error File - If (FileErrorO) then - begin - WriteLn(FileError, Title + ' Error Log'); - WriteLn(FileError, 'Date: ' + DatetoStr(Now) + ' Time: ' + TimetoStr(Now)); - WriteLn(FileError, '-------------------'); - - Flush(FileError); - end; - end; - - if FileErrorO then begin - try - WriteLn(FileError, Text); - Flush(FileError); - except - FileErrorO := false; - end; - end; -end; - -procedure TLog.LogVoice(SoundNr: integer); -var - FileVoice: File; - FS: TFileStream; - FileName: string; - Num: integer; - BL: integer; -begin - for Num := 1 to 9999 do begin - FileName := IntToStr(Num); - while Length(FileName) < 4 do FileName := '0' + FileName; - FileName := LogPath + 'Voice' + FileName + '.raw'; - if not FileExists(FileName) then break - end; - - - FS := TFileStream.Create(FileName, fmCreate); - - for BL := 0 to High(Sound[SoundNr].BufferLong) do begin - Sound[SoundNr].BufferLong[BL].Seek(0, soBeginning); - FS.CopyFrom(Sound[SoundNr].BufferLong[BL], Sound[SoundNr].BufferLong[BL].Size); - end; - - FS.Free; -end; - -procedure TLog.LogStatus(Log1, Log2: string); -begin - //Just for Debugging - //Comment for Release - //LogAnalyze (Log2 + ': ' + Log1); - - LogError(Log2 + ': ' + Log1); -end; - -procedure TLog.LogError(Log1, Log2: string); -begin -//asd -end; - -procedure TLog.CriticalError(Text: string); -begin - //Write Error to Logfile: - LogError (Text); - - //Show Errormessage - Messagebox(0, PChar(Text), PChar(Title), MB_ICONERROR or MB_OK); - - //Exit Application - Halt; -end; - -end. - - +unit ULog; + +interface + +{$I switches.inc} + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses Classes; + +type + TLog = class + BenchmarkTimeStart: array[0..7] of real; + BenchmarkTimeLength: array[0..7] of real;//TDateTime; + + FileBenchmark: TextFile; + FileBenchmarkO: boolean; // opened + FileError: TextFile; + FileErrorO: boolean; // opened + + Title: String; //Application Title + + //Should Log Files be written + Enabled: Boolean; + + // destuctor + destructor Free; + + // benchmark + procedure BenchmarkStart(Number: integer); + procedure BenchmarkEnd(Number: integer); + procedure LogBenchmark(Text: string; Number: integer); + + // error + procedure LogError(Text: string); overload; + + //Critical Error (Halt + MessageBox) + procedure CriticalError(Text: string); + + // voice + procedure LogVoice(SoundNr: integer); + + // compability + procedure LogStatus(Log1, Log2: string); + procedure LogError(Log1, Log2: string); overload; + end; + +var + Log: TLog; + +implementation + +uses + {$IFDEF win32} + windows, + {$ENDIF} + SysUtils, + DateUtils, +// UFiles, + UMain, + URecord, + UTime, +// UIni, // JB - Seems to not be needed. + UCommandLine; + +destructor TLog.Free; +begin + if FileBenchmarkO then CloseFile(FileBenchmark); +// if FileAnalyzeO then CloseFile(FileAnalyze); + if FileErrorO then CloseFile(FileError); +end; + +procedure TLog.BenchmarkStart(Number: integer); +begin + BenchmarkTimeStart[Number] := USTime.GetTime; //Time; +end; + +procedure TLog.BenchmarkEnd(Number: integer); +begin + BenchmarkTimeLength[Number] := USTime.GetTime {Time} - BenchmarkTimeStart[Number]; +end; + +procedure TLog.LogBenchmark(Text: string; Number: integer); +var + Minutes: integer; + Seconds: integer; + Miliseconds: integer; + + MinutesS: string; + SecondsS: string; + MilisecondsS: string; + + ValueText: string; +begin + if Enabled AND (Params.Benchmark) then begin + if not FileBenchmarkO then begin + FileBenchmarkO := true; + AssignFile(FileBenchmark, LogPath + 'Benchmark.log'); + {$I-} + Rewrite(FileBenchmark); + if IOResult = 0 then FileBenchmarkO := true; + {$I+} + + //If File is opened write Date to Benchmark File + If (FileBenchmarkO) then + begin + WriteLn(FileBenchmark, Title + ' Benchmark File'); + WriteLn(FileBenchmark, 'Date: ' + DatetoStr(Now) + ' Time: ' + TimetoStr(Now)); + WriteLn(FileBenchmark, '-------------------'); + + Flush(FileBenchmark); + end; + end; + + if FileBenchmarkO then begin + Miliseconds := Trunc(Frac(BenchmarkTimeLength[Number]) * 1000); + Seconds := Trunc(BenchmarkTimeLength[Number]) mod 60; + Minutes := Trunc((BenchmarkTimeLength[Number] - Seconds) / 60); +// ValueText := FloatToStr(BenchmarkTimeLength[Number]); + +{ ValueText := FloatToStr( + SecondOf(BenchmarkTimeLength[Number]) + MilliSecondOf(BenchmarkTimeLength[Number])/1000 + ); + if MinuteOf(BenchmarkTimeLength[Number]) >= 1 then + ValueText := IntToStr(MinuteOf(BenchmarkTimeLength[Number])) + ':' + ValueText; + WriteLn(FileBenchmark, Text + ': ' + ValueText + ' seconds');} + + if (Minutes = 0) and (Seconds = 0) then begin + MilisecondsS := IntToStr(Miliseconds); + ValueText := MilisecondsS + ' miliseconds'; + end; + + if (Minutes = 0) and (Seconds >= 1) then begin + MilisecondsS := IntToStr(Miliseconds); + while Length(MilisecondsS) < 3 do MilisecondsS := '0' + MilisecondsS; + + SecondsS := IntToStr(Seconds); + + ValueText := SecondsS + ',' + MilisecondsS + ' seconds'; + end; + + if Minutes >= 1 then begin + MilisecondsS := IntToStr(Miliseconds); + while Length(MilisecondsS) < 3 do MilisecondsS := '0' + MilisecondsS; + + SecondsS := IntToStr(Seconds); + while Length(SecondsS) < 2 do SecondsS := '0' + SecondsS; + + MinutesS := IntToStr(Minutes); + + ValueText := MinutesS + ':' + SecondsS + ',' + MilisecondsS + ' minutes'; + end; + + WriteLn(FileBenchmark, Text + ': ' + ValueText); + Flush(FileBenchmark); + end; + end; +end; + +procedure TLog.LogError(Text: string); +begin + if Enabled AND (not FileErrorO) then begin + FileErrorO := true; + AssignFile(FileError, LogPath + 'Error.log'); + {$I-} + Rewrite(FileError); + if IOResult = 0 then FileErrorO := true; + {$I+} + + //If File is opened write Date to Error File + If (FileErrorO) then + begin + WriteLn(FileError, Title + ' Error Log'); + WriteLn(FileError, 'Date: ' + DatetoStr(Now) + ' Time: ' + TimetoStr(Now)); + WriteLn(FileError, '-------------------'); + + Flush(FileError); + end; + end; + + if FileErrorO then begin + try + WriteLn(FileError, Text); + Flush(FileError); + except + FileErrorO := false; + end; + end; +end; + +procedure TLog.LogVoice(SoundNr: integer); +var + FileVoice: File; + FS: TFileStream; + FileName: string; + Num: integer; + BL: integer; +begin + for Num := 1 to 9999 do begin + FileName := IntToStr(Num); + while Length(FileName) < 4 do FileName := '0' + FileName; + FileName := LogPath + 'Voice' + FileName + '.raw'; + if not FileExists(FileName) then break + end; + + + FS := TFileStream.Create(FileName, fmCreate); + + for BL := 0 to High(Sound[SoundNr].BufferLong) do begin + Sound[SoundNr].BufferLong[BL].Seek(0, soBeginning); + FS.CopyFrom(Sound[SoundNr].BufferLong[BL], Sound[SoundNr].BufferLong[BL].Size); + end; + + FS.Free; +end; + +procedure TLog.LogStatus(Log1, Log2: string); +begin + //Just for Debugging + //Comment for Release + //LogAnalyze (Log2 + ': ' + Log1); + + LogError(Log2 + ': ' + Log1); +end; + +procedure TLog.LogError(Log1, Log2: string); +begin +//asd +end; + +procedure TLog.CriticalError(Text: string); +begin + //Write Error to Logfile: + LogError (Text); + + {$IFDEF win32} + //Show Errormessage + Messagebox(0, PChar(Text), PChar(Title), MB_ICONERROR or MB_OK); + {$ELSE} + // TODO - JB_Linux handle critical error so user can see message. + writeln( 'Critical ERROR :' ); + writeln( Text ); + {$ENDIF} + + //Exit Application + Halt; +end; + +end. + + diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 646724df..f06345ec 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -1,781 +1,792 @@ -unit UMain; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses SDL, UGraphic, UMusic, URecord, UTime, SysUtils, UDisplay, UIni, ULog, ULyrics, UScreenSing, - OpenGL12, - - {$IFDEF UseSerialPort} - zlportio {you can disable it and all PortWriteB calls}, - {$ENDIF} - - ULCD, ULight, UThemes{, UScreenPopup}; - -type - TPlayer = record - Name: string; - - Score: real; - ScoreLine: real; - ScoreGolden: real; - - ScoreI: integer; - ScoreLineI: integer; - ScoreGoldenI: integer; - ScoreTotalI: integer; - - - - //SingBar Mod - ScoreLast: Real;//Last Line Score - ScorePercent: integer;//Aktual Fillstate of the SingBar - ScorePercentTarget: integer;//Target Fillstate of the SingBar - //end Singbar Mod - - //PhrasenBonus - Line Bonus Mod - LineBonus_PosX: Single; - LineBonus_PosY: Single; - LineBonus_Alpha: Single; - LineBonus_Visible: boolean; - LineBonus_Text: string; - LineBonus_Color: TRGB; - LineBonus_Age: Integer; - LineBonus_Rating: Integer; - //Variable vor Positioning -> Set on ScreenShow, different when Playercount Changes - LineBonus_TargetX: integer; - LineBonus_TargetY: integer; - LineBonus_StartX: integer; - LineBonus_StartY: integer; - //PhrasenBonus - Line Bonus Mod End - - //PerfectLineTwinkle Mod (effect) - LastSentencePerfect: Boolean; - //PerfectLineTwinkle Mod end - - -// Meter: real; - - HighNut: integer; - IlNut: integer; - Nuta: array of record - Start: integer; - Dlugosc: integer; - Detekt: real; // dokladne miejsce, w ktorym wykryto ta nute - Ton: real; - Perfect: boolean; // true if the note matches the original one, lit the star - - - - // Half size Notes Patch - Hit: boolean; // true if the note Hits the Line - //end Half size Notes Patch - - - - end; - end; - - -var - //Absolute Paths - GamePath: string; - SoundPath: string; - SongPath: string; - LogPath: string; - ThemePath: string; - ScreenshotsPath: string; - CoversPath: string; - LanguagesPath: string; - PluginPath: string; - PlayListPath: string; - - OGL: Boolean; - Done: Boolean; - Event: TSDL_event; - FileName: string; - Restart: boolean; - - // gracz i jego nuty - Player: array of TPlayer; - PlayersPlay: integer; - -procedure InitializePaths; - -procedure MainLoop; -procedure CheckEvents; -procedure Sing(Sender: TScreenSing); -procedure NewSentence(Sender: TScreenSing); -procedure NewBeat(Sender: TScreenSing); // executed when on then new beat -procedure NewBeatC(Sender: TScreenSing); // executed when on then new beat for click -procedure NewBeatD(Sender: TScreenSing); // executed when on then new beat for detection -//procedure NewHalf; // executed when in the half between beats -procedure NewNote(Sender: TScreenSing); // detect note -function GetMidBeat(Time: real): real; -function GetTimeFromBeat(Beat: integer): real; -procedure ClearScores(PlayerNum: integer); - -implementation -uses USongs, UJoystick, math, UCommandLine; - -procedure MainLoop; -var - Delay: integer; -begin - SDL_EnableKeyRepeat(125, 125); - While not Done do - Begin - // joypad - if (Ini.Joypad = 1) OR (Params.Joypad) then - Joy.Update; - - // keyboard events - CheckEvents; - - // display - done := not Display.Draw; - SwapBuffers; - - // light - Light.Refresh; - - // delay - CountMidTime; -// if 1000*TimeMid > 100 then beep; - Delay := Floor(1000 / 100 - 1000 * TimeMid); - if Delay >= 1 then - SDL_Delay(Delay); // dynamic, maximum is 100 fps - CountSkipTime; - - // reinitialization of graphics - if Restart then begin - Reinitialize3D; - Restart := false; - end; - - End; - UnloadOpenGL; -End; - -Procedure CheckEvents; -//var -// p: pointer; -Begin - if not Assigned(Display.NextScreen) then - While SDL_PollEvent( @event ) = 1 Do - Begin -// beep; - Case Event.type_ Of - SDL_QUITEV: begin - Display.Fade := 0; - Display.NextScreenWithCheck := nil; - Display.CheckOK := True; - end; -{ SDL_MOUSEBUTTONDOWN: - With Event.button Do - Begin - If State = SDL_BUTTON_LEFT Then - Begin - // - End; - End; // With} - SDL_KEYDOWN: - begin - //ScreenShot hack. If Print is pressed-> Make screenshot and Save to Screenshots Path - if (Event.key.keysym.sym = SDLK_SYSREQ) then - Display.ScreenShot - - // popup hack... if there is a visible popup then let it handle input instead of underlying screen - // shoud be done in a way to be sure the topmost popup has preference (maybe error, then check) - else if (ScreenPopupError <> NIL) and (ScreenPopupError.Visible) then - done := not ScreenPopupError.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) - else if (ScreenPopupCheck <> NIL) AND (ScreenPopupCheck.Visible) then - done := not ScreenPopupCheck.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) - // end of popup hack - - else - begin - // check for Screen want to Exit - done := Not Display.ActualScreen^.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True); - - //If Screen wants to Exit - if done then - begin - //If Question Option is enabled then Show Exit Popup - if (Ini.AskbeforeDel = 1) then - begin - Display.ActualScreen^.CheckFadeTo(NIL,'MSG_QUIT_USDX'); - end - else //When asking for exit is disabled then simply exit - begin - Display.Fade := 0; - Display.NextScreenWithCheck := nil; - Display.CheckOK := True; - end; - end; - - end; // if (Not Display.ActualScreen^.ParseInput(Event.key.keysym.scancode, True)) then - end; -// SDL_JOYAXISMOTION: -// begin -// beep -// end; - SDL_JOYBUTTONDOWN: - begin - beep - end; - End; // Case Event.type_ - End; // While -End; // CheckEvents - -function GetTimeForBeats(BPM, Beats: real): real; -begin - Result := 60 / BPM * Beats; -end; - -function GetBeats(BPM, msTime: real): real; -begin - Result := BPM * msTime / 60; -end; - -procedure GetMidBeatSub(BPMNum: integer; var Time: real; var CurBeat: real); -var - NewTime: real; -begin - if High(AktSong.BPM) = BPMNum then begin - // last BPM - CurBeat := AktSong.BPM[BPMNum].StartBeat + GetBeats(AktSong.BPM[BPMNum].BPM, Time); - Time := 0; - end else begin - // not last BPM - // count how much time is it for start of the new BPM and store it in NewTime - NewTime := GetTimeForBeats(AktSong.BPM[BPMNum].BPM, AktSong.BPM[BPMNum+1].StartBeat - AktSong.BPM[BPMNum].StartBeat); - - // compare it to remaining time - if (Time - NewTime) > 0 then begin - // there is still remaining time - CurBeat := AktSong.BPM[BPMNum].StartBeat; - Time := Time - NewTime; - end else begin - // there is no remaining time - CurBeat := AktSong.BPM[BPMNum].StartBeat + GetBeats(AktSong.BPM[BPMNum].BPM, Time); - Time := 0; - end; // if - end; // if -end; - -function GetMidBeat(Time: real): real; -var - CurBeat: real; - CurBPM: integer; -// TopBeat: real; -// TempBeat: real; -// TempTime: real; -begin - Result := 0; - if Length(AktSong.BPM) = 1 then Result := Time * AktSong.BPM[0].BPM / 60; - - (* 2 BPMs *) -{ if Length(AktSong.BPM) > 1 then begin - (* new system *) - CurBeat := 0; - TopBeat := GetBeats(AktSong.BPM[0].BPM, Time); - if TopBeat > AktSong.BPM[1].StartBeat then begin - // analyze second BPM - Time := Time - GetTimeForBeats(AktSong.BPM[0].BPM, AktSong.BPM[1].StartBeat - CurBeat); - CurBeat := AktSong.BPM[1].StartBeat; - TopBeat := GetBeats(AktSong.BPM[1].BPM, Time); - Result := CurBeat + TopBeat; - - end else begin - (* pierwszy przedzial *) - Result := TopBeat; - end; - end; // if} - - (* more BPMs *) - if Length(AktSong.BPM) > 1 then begin - - CurBeat := 0; - CurBPM := 0; - while (Time > 0) do begin - GetMidBeatSub(CurBPM, Time, CurBeat); - Inc(CurBPM); - end; - - Result := CurBeat; - end; // if -end; - -function GetTimeFromBeat(Beat: integer): real; -var - CurBPM: integer; -begin - Result := 0; - if Length(AktSong.BPM) = 1 then Result := AktSong.GAP / 1000 + Beat * 60 / AktSong.BPM[0].BPM; - - (* more BPMs *) - if Length(AktSong.BPM) > 1 then begin - Result := AktSong.GAP / 1000; - CurBPM := 0; - while (CurBPM <= High(AktSong.BPM)) and (Beat > AktSong.BPM[CurBPM].StartBeat) do begin - if (CurBPM < High(AktSong.BPM)) and (Beat >= AktSong.BPM[CurBPM+1].StartBeat) then begin - // full range - Result := Result + (60 / AktSong.BPM[CurBPM].BPM) * (AktSong.BPM[CurBPM+1].StartBeat - AktSong.BPM[CurBPM].StartBeat); - end; - - if (CurBPM = High(AktSong.BPM)) or (Beat < AktSong.BPM[CurBPM+1].StartBeat) then begin - // in the middle - Result := Result + (60 / AktSong.BPM[CurBPM].BPM) * (Beat - AktSong.BPM[CurBPM].StartBeat); - end; - Inc(CurBPM); - end; - -{ while (Time > 0) do begin - GetMidBeatSub(CurBPM, Time, CurBeat); - Inc(CurBPM); - end;} - end; // if} -end; - -procedure Sing(Sender: TScreenSing); -var - Pet: integer; - PetGr: integer; - CP: integer; - Done: real; - N: integer; -begin - Czas.Teraz := Czas.Teraz + TimeSkip; - - Czas.OldBeat := Czas.AktBeat; - Czas.MidBeat := GetMidBeat(Czas.Teraz - (AktSong.Gap{ + 90 I've forgotten for what it is}) / 1000); // new system with variable BPM in function - Czas.AktBeat := Floor(Czas.MidBeat); - -// Czas.OldHalf := Czas.AktHalf; -// Czas.MidHalf := Czas.MidBeat + 0.5; -// Czas.AktHalf := Floor(Czas.MidHalf); - - Czas.OldBeatC := Czas.AktBeatC; - Czas.MidBeatC := GetMidBeat(Czas.Teraz - (AktSong.Gap) / 1000); - Czas.AktBeatC := Floor(Czas.MidBeatC); - - Czas.OldBeatD := Czas.AktBeatD; - Czas.MidBeatD := -0.5+GetMidBeat(Czas.Teraz - (AktSong.Gap + 120 + 20) / 1000); // MidBeat with addition GAP - Czas.AktBeatD := Floor(Czas.MidBeatD); - Czas.FracBeatD := Frac(Czas.MidBeatD); - - // sentences routines - for PetGr := 0 to 0 do begin;//High(Gracz) do begin - CP := PetGr; - // ustawianie starej czesci - Czas.OldCzesc := Czesci[CP].Akt; - - // wybieranie aktualnej czesci - for Pet := 0 to Czesci[CP].High do - if Czas.AktBeat >= Czesci[CP].Czesc[Pet].Start then Czesci[CP].Akt := Pet; - - // czysczenie nut gracza, gdy to jest nowa plansza - // (optymizacja raz na halfbeat jest zla) - if Czesci[CP].Akt <> Czas.OldCzesc then NewSentence(Sender); - - end; // for PetGr - - // wykonuje operacje raz na beat - if (Czas.AktBeat >= 0) and (Czas.OldBeat <> Czas.AktBeat) then - NewBeat(Sender); - - // make some operations on clicks - if {(Czas.AktBeatC >= 0) and }(Czas.OldBeatC <> Czas.AktBeatC) then - NewBeatC(Sender); - - // make some operations when detecting new voice pitch - if (Czas.AktBeatD >= 0) and (Czas.OldBeatD <> Czas.AktBeatD) then - NewBeatD(Sender); - - // wykonuje operacje w polowie beatu -// if (Czas.AktHalf >= 1) and (Czas.OldHalf <> Czas.AktHalf) then -// NewHalf; - - // plynnie przesuwa text - Done := 1; - for N := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do - if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start <= Czas.MidBeat) - and (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start + Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc >= Czas.MidBeat) then - Done := (Czas.MidBeat - Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start) / (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc); - - N := Czesci[0].Czesc[Czesci[0].Akt].HighNut; - - // wylacza ostatnia nute po przejsciu - if (Ini.LyricsEffect = 1) and (Done = 1) and - (Czas.MidBeat > Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start + Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc) - then Sender.LyricMain.Selected := -1; - - if Done > 1 then Done := 1; - Sender.LyricMain.Done := Done; - - // use Done with LCD -{ with ScreenSing do begin - if LyricMain.Selected >= 0 then begin - LCD.MoveCursor(1, LyricMain.SelectedLetter + Round((LyricMain.SelectedLength-1) * Done)); - LCD.ShowCursor; - end; - end;} - - -end; - -procedure NewSentence(Sender: TScreenSing); -var -G: Integer; -begin - // czyszczenie nut graczy - for G := 0 to High(Player) do begin - Player[G].IlNut := 0; - Player[G].HighNut := -1; - SetLength(Player[G].Nuta, 0); - end; - - // wstawianie tekstow - with Sender do begin - LyricMain.AddCzesc(Czesci[0].Akt); - if Czesci[0].Akt < Czesci[0].High then - LyricSub.AddCzesc(Czesci[0].Akt+1) - else - LyricSub.Clear; - end; - - Sender.UpdateLCD; - - //On Sentence Change... - Sender.onSentenceChange(Czesci[0].Akt); -end; - -procedure NewBeat(Sender: TScreenSing); -var - Pet: integer; -// TempBeat: integer; -begin - // ustawia zaznaczenie tekstu -// SingScreen.LyricMain.Selected := -1; - for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do - if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeat) then begin - // operates on currently beated note - Sender.LyricMain.Selected := Pet; - -// LCD.MoveCursor(1, ScreenSing.LyricMain.SelectedLetter); -// LCD.ShowCursor; - - LCD.MoveCursorBR(Sender.LyricMain.SelectedLetter); - LCD.ShowCursor; - - end; -end; - -procedure NewBeatC; -var - Pet: integer; -// LPT_1: integer; -// LPT_2: integer; -begin -// LPT_1 := 1; -// LPT_2 := 1; - - // beat click - if (Ini.BeatClick = 1) and ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then - Music.PlayClick; - - // debug system on LPT - if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then begin - //LPT_1 := 0; -// Light.LightOne(0, 150); - - Light.LightOne(1, 200); // beat light - if ParamStr(1) = '-doublelights' then - Light.LightOne(0, 200); // beat light - - -{ if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod (Czesci[0].Resolution * 2) = 0) then - Light.LightOne(0, 150) - else - Light.LightOne(1, 150)} - end; - - for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do - if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeatC) then begin - // click assist - if Ini.ClickAssist = 1 then - Music.PlayClick; - - //LPT_2 := 0; - if ParamStr(1) <> '-doublelights' then - Light.LightOne(0, 150); //125 - - - // drum machine -(* TempBeat := Czas.AktBeat;// + 2; - if (TempBeat mod 8 = 0) then Music.PlayDrum; - if (TempBeat mod 8 = 4) then Music.PlayClap; -// if (TempBeat mod 4 = 2) then Music.PlayHihat; - if (TempBeat mod 4 <> 0) then Music.PlayHihat;*) - end; - - {$IFDEF UseSerialPort} - // PortWriteB($378, LPT_1 + LPT_2 * 2); // 0 zapala - {$ENDIF} -end; - -procedure NewBeatD(Sender: TScreenSing); -begin - NewNote(Sender); -end; - -//procedure NewHalf; -//begin -// NewNote; -//end; - -procedure NewNote(Sender: TScreenSing); -var - CP: integer; // current player - S: integer; // sentence - SMin: integer; - SMax: integer; - SDet: integer; // temporary: sentence of detected note - Pet: integer; - Mozna: boolean; - Nowa: boolean; - Range: integer; - NoteHit:boolean; -begin -// Log.LogStatus('Beat ' + IntToStr(Czas.AktBeat) + ' HalfBeat ' + IntToStr(Czas.AktHalf), 'NewBeat'); -// beep; - - // analizuje dla obu graczy ten sam sygnal (Sound.OneSrcForBoth) - // albo juz lepiej nie - for CP := 0 to PlayersPlay-1 do begin - - // analyze buffer - Sound[CP].AnalizujBufor; - - // adds some noise -// Czas.Ton := Czas.Ton + Round(Random(3)) - 1; - - // 0.5.0: count min and max sentence range for checking (detection is delayed to the notes we see on the screen) - SMin := Czesci[0].Akt-1; - if SMin < 0 then SMin := 0; - SMax := Czesci[0].Akt; - - // check if we can add new note - Mozna := false; - SDet:=SMin; - for S := SMin to SMax do - for Pet := 0 to Czesci[0].Czesc[S].HighNut do - if ((Czesci[0].Czesc[S].Nuta[Pet].Start <= Czas.AktBeatD) - and (Czesci[0].Czesc[S].Nuta[Pet].Start + Czesci[0].Czesc[S].Nuta[Pet].Dlugosc - 1 >= Czas.AktBeatD)) - and (not Czesci[0].Czesc[S].Nuta[Pet].FreeStyle) // but don't allow when it's FreeStyle note - and (Czesci[0].Czesc[S].Nuta[Pet].Dlugosc > 0) // and make sure the note lenghts is at least 1 - then begin - SDet := S; - Mozna := true; - Break; - end; - - S := SDet; - - - - - -// Czas.SzczytJest := true; -// Czas.Ton := 27; - - // gdy moze, to dodaje nute - if (Sound[CP].SzczytJest) and (Mozna) then begin - // operowanie na ostatniej nucie - for Pet := 0 to Czesci[0].Czesc[S].HighNut do - if (Czesci[0].Czesc[S].Nuta[Pet].Start <= Czas.OldBeatD+1) - and (Czesci[0].Czesc[S].Nuta[Pet].Start + - Czesci[0].Czesc[S].Nuta[Pet].Dlugosc > Czas.OldBeatD+1) then begin - // to robi, tylko dla pary nut (oryginalnej i gracza) - - // przesuwanie tonu w odpowiednia game - while (Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton > 6) do - Sound[CP].Ton := Sound[CP].Ton - 12; - while (Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton < -6) do - Sound[CP].Ton := Sound[CP].Ton + 12; - - // Half size Notes Patch - NoteHit := false; - - //if Ini.Difficulty = 0 then Range := 2; - //if Ini.Difficulty = 1 then Range := 1; - //if Ini.Difficulty = 2 then Range := 0; - Range := 2 - Ini.Difficulty; - if abs(Czesci[0].Czesc[S].Nuta[Pet].Ton - Sound[CP].Ton) <= Range then begin - Sound[CP].Ton := Czesci[0].Czesc[S].Nuta[Pet].Ton; - - - // Half size Notes Patch - NoteHit := true; - - - if (Ini.LineBonus = 0) then - begin - // add points without LineBonus - case Czesci[0].Czesc[S].Nuta[Pet].Wartosc of - 1: Player[CP].Score := Player[CP].Score + 10000 / Czesci[0].Wartosc * - Czesci[0].Czesc[S].Nuta[Pet].Wartosc; - 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 10000 / Czesci[0].Wartosc * - Czesci[0].Czesc[S].Nuta[Pet].Wartosc; - end; - end - else - begin - // add points with Line Bonus - case Czesci[0].Czesc[S].Nuta[Pet].Wartosc of - 1: Player[CP].Score := Player[CP].Score + 9000 / Czesci[0].Wartosc * - Czesci[0].Czesc[S].Nuta[Pet].Wartosc; - 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 9000 / Czesci[0].Wartosc * - Czesci[0].Czesc[S].Nuta[Pet].Wartosc; - end; - end; - - Player[CP].ScoreI := Floor(Player[CP].Score / 10) * 10; - Player[CP].ScoreGoldenI := Floor(Player[CP].ScoreGolden / 10) * 10; - - Player[CP].ScoreTotalI := Player[CP].ScoreI + Player[CP].ScoreGoldenI + Player[CP].ScoreLineI; - end; - - end; // operowanie - - // sprawdzanie czy to nowa nuta, czy przedluzenie - if S = SMax then begin - Nowa := true; - // jezeli ostatnia ma ten sam ton - if (Player[CP].IlNut > 0 ) and (Player[CP].Nuta[Player[CP].HighNut].Ton = Sound[CP].Ton) - and (Player[CP].Nuta[Player[CP].HighNut].Start + Player[CP].Nuta[Player[CP].HighNut].Dlugosc = Czas.AktBeatD) - then Nowa := false; - // jezeli jest jakas nowa nuta na sprawdzanym beacie - for Pet := 0 to Czesci[0].Czesc[S].HighNut do - if (Czesci[0].Czesc[S].Nuta[Pet].Start = Czas.AktBeatD) then - Nowa := true; - - // dodawanie nowej nuty - if Nowa then begin - // nowa nuta - Player[CP].IlNut := Player[CP].IlNut + 1; - Player[CP].HighNut := Player[CP].HighNut + 1; - SetLength(Player[CP].Nuta, Player[CP].IlNut); - Player[CP].Nuta[Player[CP].HighNut].Start := Czas.AktBeatD; - Player[CP].Nuta[Player[CP].HighNut].Dlugosc := 1; - Player[CP].Nuta[Player[CP].HighNut].Ton := Sound[CP].Ton; // Ton || TonDokl - Player[CP].Nuta[Player[CP].HighNut].Detekt := Czas.MidBeat; - - - // Half Note Patch - Player[CP].Nuta[Player[CP].HighNut].Hit := NoteHit; - - - // Log.LogStatus('Nowa Nuta ' + IntToStr(Gracz.Nuta[Gracz.HighNut].Start), 'NewBeat'); - - end else begin - // przedluzenie nuty - Player[CP].Nuta[Player[CP].HighNut].Dlugosc := Player[CP].Nuta[Player[CP].HighNut].Dlugosc + 1; - end; - - - // check for perfect note and then lit the star (on Draw) - for Pet := 0 to Czesci[0].Czesc[S].HighNut do - if (Czesci[0].Czesc[S].Nuta[Pet].Start = Player[CP].Nuta[Player[CP].HighNut].Start) - and (Czesci[0].Czesc[S].Nuta[Pet].Dlugosc = Player[CP].Nuta[Player[CP].HighNut].Dlugosc) - and (Czesci[0].Czesc[S].Nuta[Pet].Ton = Player[CP].Nuta[Player[CP].HighNut].Ton) then begin - Player[CP].Nuta[Player[CP].HighNut].Perfect := true; - end; - - end;// else beep; // if S = SMax - - end; // if moze - end; // for CP -// Log.LogStatus('EndBeat', 'NewBeat'); - -//On Sentence End -> For LineBonus + SingBar -if (sDet >= low(Czesci[0].Czesc)) AND (sDet <= high(Czesci[0].Czesc)) then -if ((Czesci[0].Czesc[SDet].Nuta[Czesci[0].Czesc[SDet].HighNut].Start + Czesci[0].Czesc[SDet].Nuta[Czesci[0].Czesc[SDet].HighNut].Dlugosc - 1) = Czas.AktBeatD) then - Sender.onSentenceEnd(sDet); - -end; - -procedure ClearScores(PlayerNum: integer); -begin - Player[PlayerNum].Score := 0; - Player[PlayerNum].ScoreI := 0; - Player[PlayerNum].ScoreLine := 0; - Player[PlayerNum].ScoreLineI := 0; - Player[PlayerNum].ScoreGolden := 0; - Player[PlayerNum].ScoreGoldenI := 0; - Player[PlayerNum].ScoreTotalI := 0; - - - //SingBar Mod - Player[PlayerNum].ScoreLast := 0; - Player[PlayerNum].ScorePercent := 50;// Sets to 50% when song starts - Player[PlayerNum].ScorePercentTarget := 50;// Sets to 50% when song starts - //end SingBar Mod - - //PhrasenBonus - Line Bonus Mod - Player[PlayerNum].LineBonus_Visible := False; //Hide Line Bonus - Player[PlayerNum].LineBonus_Alpha := 0; - Player[PlayerNum].LineBonus_TargetX := 70 + PlayerNum*500; - Player[PlayerNum].LineBonus_TargetY := 30; - //PhrasenBonus - Line Bonus Mod End -end; - -//-------------------- -// Function sets all Absolute Paths e.g. Song Path and makes sure the Directorys exist -//-------------------- -procedure InitializePaths; - - // Initialize a Path Variable - // After Setting Paths, make sure that Paths exist - function initialize_path( out aPathVar : String; const aLocation : String ): boolean; - var - lWriteable: Boolean; - begin - aPathVar := aLocation; - - If DirectoryExists(aPathVar) then - lWriteable := ForceDirectories(aPathVar) - else - lWriteable := false; - - if not lWriteable then - Log.LogError('Error: Dir ('+ aLocation +') is Readonly'); - - result := lWriteable; - end; - -begin - - GamePath := ExtractFilePath(ParamStr(0)); - - initialize_path( LogPath , GamePath ); - initialize_path( SoundPath , GamePath + 'Sounds\' ); - initialize_path( SongPath , GamePath + 'Songs\' ); - initialize_path( ThemePath , GamePath + 'Themes\' ); - initialize_path( ScreenshotsPath , GamePath + 'Screenshots\'); - initialize_path( CoversPath , GamePath + 'Covers\' ); - initialize_path( LanguagesPath , GamePath + 'Languages\' ); - initialize_path( PluginPath , GamePath + 'Plugins\' ); - initialize_path( PlaylistPath , GamePath + 'Playlists\' ); - - DecimalSeparator := ','; -end; - -end. - +unit UMain; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + SDL, + UGraphic, + UMusic, + URecord, + UTime, + SysUtils, + UDisplay, + UIni, + ULog, + ULyrics, + UScreenSing, + OpenGL12, + {$IFDEF UseSerialPort} + zlportio {you can disable it and all PortWriteB calls}, + {$ENDIF} + ULCD, + ULight, + UThemes; + +type + TPlayer = record + Name: string; + + Score: real; + ScoreLine: real; + ScoreGolden: real; + + ScoreI: integer; + ScoreLineI: integer; + ScoreGoldenI: integer; + ScoreTotalI: integer; + + + + //SingBar Mod + ScoreLast: Real;//Last Line Score + ScorePercent: integer;//Aktual Fillstate of the SingBar + ScorePercentTarget: integer;//Target Fillstate of the SingBar + //end Singbar Mod + + //PhrasenBonus - Line Bonus Mod + LineBonus_PosX: Single; + LineBonus_PosY: Single; + LineBonus_Alpha: Single; + LineBonus_Visible: boolean; + LineBonus_Text: string; + LineBonus_Color: TRGB; + LineBonus_Age: Integer; + LineBonus_Rating: Integer; + //Variable vor Positioning -> Set on ScreenShow, different when Playercount Changes + LineBonus_TargetX: integer; + LineBonus_TargetY: integer; + LineBonus_StartX: integer; + LineBonus_StartY: integer; + //PhrasenBonus - Line Bonus Mod End + + //PerfectLineTwinkle Mod (effect) + LastSentencePerfect: Boolean; + //PerfectLineTwinkle Mod end + + +// Meter: real; + + HighNut: integer; + IlNut: integer; + Nuta: array of record + Start: integer; + Dlugosc: integer; + Detekt: real; // dokladne miejsce, w ktorym wykryto ta nute + Ton: real; + Perfect: boolean; // true if the note matches the original one, lit the star + + + + // Half size Notes Patch + Hit: boolean; // true if the note Hits the Line + //end Half size Notes Patch + + + + end; + end; + + +var + //Absolute Paths + GamePath: string; + SoundPath: string; + SongPath: string; + LogPath: string; + ThemePath: string; + ScreenshotsPath: string; + CoversPath: string; + LanguagesPath: string; + PluginPath: string; + PlayListPath: string; + + OGL: Boolean; + Done: Boolean; + Event: TSDL_event; + FileName: string; + Restart: boolean; + + // gracz i jego nuty + Player: array of TPlayer; + PlayersPlay: integer; + +procedure InitializePaths; + +procedure MainLoop; +procedure CheckEvents; +procedure Sing(Sender: TScreenSing); +procedure NewSentence(Sender: TScreenSing); +procedure NewBeat(Sender: TScreenSing); // executed when on then new beat +procedure NewBeatC(Sender: TScreenSing); // executed when on then new beat for click +procedure NewBeatD(Sender: TScreenSing); // executed when on then new beat for detection +//procedure NewHalf; // executed when in the half between beats +procedure NewNote(Sender: TScreenSing); // detect note +function GetMidBeat(Time: real): real; +function GetTimeFromBeat(Beat: integer): real; +procedure ClearScores(PlayerNum: integer); + +implementation +uses USongs, UJoystick, math, UCommandLine; + +procedure MainLoop; +var + Delay: integer; +begin + SDL_EnableKeyRepeat(125, 125); + While not Done do + Begin + // joypad + if (Ini.Joypad = 1) OR (Params.Joypad) then + Joy.Update; + + // keyboard events + CheckEvents; + + // display + done := not Display.Draw; + SwapBuffers; + + // light + Light.Refresh; + + // delay + CountMidTime; +// if 1000*TimeMid > 100 then beep; + Delay := Floor(1000 / 100 - 1000 * TimeMid); + if Delay >= 1 then + SDL_Delay(Delay); // dynamic, maximum is 100 fps + CountSkipTime; + + // reinitialization of graphics + if Restart then begin + Reinitialize3D; + Restart := false; + end; + + End; + UnloadOpenGL; +End; + +Procedure CheckEvents; +//var +// p: pointer; +Begin + if not Assigned(Display.NextScreen) then + While SDL_PollEvent( @event ) = 1 Do + Begin +// beep; + Case Event.type_ Of + SDL_QUITEV: begin + Display.Fade := 0; + Display.NextScreenWithCheck := nil; + Display.CheckOK := True; + end; +{ SDL_MOUSEBUTTONDOWN: + With Event.button Do + Begin + If State = SDL_BUTTON_LEFT Then + Begin + // + End; + End; // With} + SDL_KEYDOWN: + begin + //ScreenShot hack. If Print is pressed-> Make screenshot and Save to Screenshots Path + if (Event.key.keysym.sym = SDLK_SYSREQ) then + Display.ScreenShot + + // popup hack... if there is a visible popup then let it handle input instead of underlying screen + // shoud be done in a way to be sure the topmost popup has preference (maybe error, then check) + else if (ScreenPopupError <> NIL) and (ScreenPopupError.Visible) then + done := not ScreenPopupError.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) + else if (ScreenPopupCheck <> NIL) AND (ScreenPopupCheck.Visible) then + done := not ScreenPopupCheck.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) + // end of popup hack + + else + begin + // check for Screen want to Exit + done := Not Display.ActualScreen^.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True); + + //If Screen wants to Exit + if done then + begin + //If Question Option is enabled then Show Exit Popup + if (Ini.AskbeforeDel = 1) then + begin + Display.ActualScreen^.CheckFadeTo(NIL,'MSG_QUIT_USDX'); + end + else //When asking for exit is disabled then simply exit + begin + Display.Fade := 0; + Display.NextScreenWithCheck := nil; + Display.CheckOK := True; + end; + end; + + end; // if (Not Display.ActualScreen^.ParseInput(Event.key.keysym.scancode, True)) then + end; +// SDL_JOYAXISMOTION: +// begin +// beep +// end; + SDL_JOYBUTTONDOWN: + begin + beep + end; + End; // Case Event.type_ + End; // While +End; // CheckEvents + +function GetTimeForBeats(BPM, Beats: real): real; +begin + Result := 60 / BPM * Beats; +end; + +function GetBeats(BPM, msTime: real): real; +begin + Result := BPM * msTime / 60; +end; + +procedure GetMidBeatSub(BPMNum: integer; var Time: real; var CurBeat: real); +var + NewTime: real; +begin + if High(AktSong.BPM) = BPMNum then begin + // last BPM + CurBeat := AktSong.BPM[BPMNum].StartBeat + GetBeats(AktSong.BPM[BPMNum].BPM, Time); + Time := 0; + end else begin + // not last BPM + // count how much time is it for start of the new BPM and store it in NewTime + NewTime := GetTimeForBeats(AktSong.BPM[BPMNum].BPM, AktSong.BPM[BPMNum+1].StartBeat - AktSong.BPM[BPMNum].StartBeat); + + // compare it to remaining time + if (Time - NewTime) > 0 then begin + // there is still remaining time + CurBeat := AktSong.BPM[BPMNum].StartBeat; + Time := Time - NewTime; + end else begin + // there is no remaining time + CurBeat := AktSong.BPM[BPMNum].StartBeat + GetBeats(AktSong.BPM[BPMNum].BPM, Time); + Time := 0; + end; // if + end; // if +end; + +function GetMidBeat(Time: real): real; +var + CurBeat: real; + CurBPM: integer; +// TopBeat: real; +// TempBeat: real; +// TempTime: real; +begin + Result := 0; + if Length(AktSong.BPM) = 1 then Result := Time * AktSong.BPM[0].BPM / 60; + + (* 2 BPMs *) +{ if Length(AktSong.BPM) > 1 then begin + (* new system *) + CurBeat := 0; + TopBeat := GetBeats(AktSong.BPM[0].BPM, Time); + if TopBeat > AktSong.BPM[1].StartBeat then begin + // analyze second BPM + Time := Time - GetTimeForBeats(AktSong.BPM[0].BPM, AktSong.BPM[1].StartBeat - CurBeat); + CurBeat := AktSong.BPM[1].StartBeat; + TopBeat := GetBeats(AktSong.BPM[1].BPM, Time); + Result := CurBeat + TopBeat; + + end else begin + (* pierwszy przedzial *) + Result := TopBeat; + end; + end; // if} + + (* more BPMs *) + if Length(AktSong.BPM) > 1 then begin + + CurBeat := 0; + CurBPM := 0; + while (Time > 0) do begin + GetMidBeatSub(CurBPM, Time, CurBeat); + Inc(CurBPM); + end; + + Result := CurBeat; + end; // if +end; + +function GetTimeFromBeat(Beat: integer): real; +var + CurBPM: integer; +begin + Result := 0; + if Length(AktSong.BPM) = 1 then Result := AktSong.GAP / 1000 + Beat * 60 / AktSong.BPM[0].BPM; + + (* more BPMs *) + if Length(AktSong.BPM) > 1 then begin + Result := AktSong.GAP / 1000; + CurBPM := 0; + while (CurBPM <= High(AktSong.BPM)) and (Beat > AktSong.BPM[CurBPM].StartBeat) do begin + if (CurBPM < High(AktSong.BPM)) and (Beat >= AktSong.BPM[CurBPM+1].StartBeat) then begin + // full range + Result := Result + (60 / AktSong.BPM[CurBPM].BPM) * (AktSong.BPM[CurBPM+1].StartBeat - AktSong.BPM[CurBPM].StartBeat); + end; + + if (CurBPM = High(AktSong.BPM)) or (Beat < AktSong.BPM[CurBPM+1].StartBeat) then begin + // in the middle + Result := Result + (60 / AktSong.BPM[CurBPM].BPM) * (Beat - AktSong.BPM[CurBPM].StartBeat); + end; + Inc(CurBPM); + end; + +{ while (Time > 0) do begin + GetMidBeatSub(CurBPM, Time, CurBeat); + Inc(CurBPM); + end;} + end; // if} +end; + +procedure Sing(Sender: TScreenSing); +var + Pet: integer; + PetGr: integer; + CP: integer; + Done: real; + N: integer; +begin + Czas.Teraz := Czas.Teraz + TimeSkip; + + Czas.OldBeat := Czas.AktBeat; + Czas.MidBeat := GetMidBeat(Czas.Teraz - (AktSong.Gap{ + 90 I've forgotten for what it is}) / 1000); // new system with variable BPM in function + Czas.AktBeat := Floor(Czas.MidBeat); + +// Czas.OldHalf := Czas.AktHalf; +// Czas.MidHalf := Czas.MidBeat + 0.5; +// Czas.AktHalf := Floor(Czas.MidHalf); + + Czas.OldBeatC := Czas.AktBeatC; + Czas.MidBeatC := GetMidBeat(Czas.Teraz - (AktSong.Gap) / 1000); + Czas.AktBeatC := Floor(Czas.MidBeatC); + + Czas.OldBeatD := Czas.AktBeatD; + Czas.MidBeatD := -0.5+GetMidBeat(Czas.Teraz - (AktSong.Gap + 120 + 20) / 1000); // MidBeat with addition GAP + Czas.AktBeatD := Floor(Czas.MidBeatD); + Czas.FracBeatD := Frac(Czas.MidBeatD); + + // sentences routines + for PetGr := 0 to 0 do begin;//High(Gracz) do begin + CP := PetGr; + // ustawianie starej czesci + Czas.OldCzesc := Czesci[CP].Akt; + + // wybieranie aktualnej czesci + for Pet := 0 to Czesci[CP].High do + if Czas.AktBeat >= Czesci[CP].Czesc[Pet].Start then Czesci[CP].Akt := Pet; + + // czysczenie nut gracza, gdy to jest nowa plansza + // (optymizacja raz na halfbeat jest zla) + if Czesci[CP].Akt <> Czas.OldCzesc then NewSentence(Sender); + + end; // for PetGr + + // wykonuje operacje raz na beat + if (Czas.AktBeat >= 0) and (Czas.OldBeat <> Czas.AktBeat) then + NewBeat(Sender); + + // make some operations on clicks + if {(Czas.AktBeatC >= 0) and }(Czas.OldBeatC <> Czas.AktBeatC) then + NewBeatC(Sender); + + // make some operations when detecting new voice pitch + if (Czas.AktBeatD >= 0) and (Czas.OldBeatD <> Czas.AktBeatD) then + NewBeatD(Sender); + + // wykonuje operacje w polowie beatu +// if (Czas.AktHalf >= 1) and (Czas.OldHalf <> Czas.AktHalf) then +// NewHalf; + + // plynnie przesuwa text + Done := 1; + for N := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start <= Czas.MidBeat) + and (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start + Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc >= Czas.MidBeat) then + Done := (Czas.MidBeat - Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start) / (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc); + + N := Czesci[0].Czesc[Czesci[0].Akt].HighNut; + + // wylacza ostatnia nute po przejsciu + if (Ini.LyricsEffect = 1) and (Done = 1) and + (Czas.MidBeat > Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start + Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc) + then Sender.LyricMain.Selected := -1; + + if Done > 1 then Done := 1; + Sender.LyricMain.Done := Done; + + // use Done with LCD +{ with ScreenSing do begin + if LyricMain.Selected >= 0 then begin + LCD.MoveCursor(1, LyricMain.SelectedLetter + Round((LyricMain.SelectedLength-1) * Done)); + LCD.ShowCursor; + end; + end;} + + +end; + +procedure NewSentence(Sender: TScreenSing); +var +G: Integer; +begin + // czyszczenie nut graczy + for G := 0 to High(Player) do begin + Player[G].IlNut := 0; + Player[G].HighNut := -1; + SetLength(Player[G].Nuta, 0); + end; + + // wstawianie tekstow + with Sender do begin + LyricMain.AddCzesc(Czesci[0].Akt); + if Czesci[0].Akt < Czesci[0].High then + LyricSub.AddCzesc(Czesci[0].Akt+1) + else + LyricSub.Clear; + end; + + Sender.UpdateLCD; + + //On Sentence Change... + Sender.onSentenceChange(Czesci[0].Akt); +end; + +procedure NewBeat(Sender: TScreenSing); +var + Pet: integer; +// TempBeat: integer; +begin + // ustawia zaznaczenie tekstu +// SingScreen.LyricMain.Selected := -1; + for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeat) then begin + // operates on currently beated note + Sender.LyricMain.Selected := Pet; + +// LCD.MoveCursor(1, ScreenSing.LyricMain.SelectedLetter); +// LCD.ShowCursor; + + LCD.MoveCursorBR(Sender.LyricMain.SelectedLetter); + LCD.ShowCursor; + + end; +end; + +procedure NewBeatC; +var + Pet: integer; +// LPT_1: integer; +// LPT_2: integer; +begin +// LPT_1 := 1; +// LPT_2 := 1; + + // beat click + if (Ini.BeatClick = 1) and ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then + Music.PlayClick; + + // debug system on LPT + if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then begin + //LPT_1 := 0; +// Light.LightOne(0, 150); + + Light.LightOne(1, 200); // beat light + if ParamStr(1) = '-doublelights' then + Light.LightOne(0, 200); // beat light + + +{ if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod (Czesci[0].Resolution * 2) = 0) then + Light.LightOne(0, 150) + else + Light.LightOne(1, 150)} + end; + + for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeatC) then begin + // click assist + if Ini.ClickAssist = 1 then + Music.PlayClick; + + //LPT_2 := 0; + if ParamStr(1) <> '-doublelights' then + Light.LightOne(0, 150); //125 + + + // drum machine +(* TempBeat := Czas.AktBeat;// + 2; + if (TempBeat mod 8 = 0) then Music.PlayDrum; + if (TempBeat mod 8 = 4) then Music.PlayClap; +// if (TempBeat mod 4 = 2) then Music.PlayHihat; + if (TempBeat mod 4 <> 0) then Music.PlayHihat;*) + end; + + {$IFDEF UseSerialPort} + // PortWriteB($378, LPT_1 + LPT_2 * 2); // 0 zapala + {$ENDIF} +end; + +procedure NewBeatD(Sender: TScreenSing); +begin + NewNote(Sender); +end; + +//procedure NewHalf; +//begin +// NewNote; +//end; + +procedure NewNote(Sender: TScreenSing); +var + CP: integer; // current player + S: integer; // sentence + SMin: integer; + SMax: integer; + SDet: integer; // temporary: sentence of detected note + Pet: integer; + Mozna: boolean; + Nowa: boolean; + Range: integer; + NoteHit:boolean; +begin +// Log.LogStatus('Beat ' + IntToStr(Czas.AktBeat) + ' HalfBeat ' + IntToStr(Czas.AktHalf), 'NewBeat'); +// beep; + + // analizuje dla obu graczy ten sam sygnal (Sound.OneSrcForBoth) + // albo juz lepiej nie + for CP := 0 to PlayersPlay-1 do begin + + // analyze buffer + Sound[CP].AnalizujBufor; + + // adds some noise +// Czas.Ton := Czas.Ton + Round(Random(3)) - 1; + + // 0.5.0: count min and max sentence range for checking (detection is delayed to the notes we see on the screen) + SMin := Czesci[0].Akt-1; + if SMin < 0 then SMin := 0; + SMax := Czesci[0].Akt; + + // check if we can add new note + Mozna := false; + SDet:=SMin; + for S := SMin to SMax do + for Pet := 0 to Czesci[0].Czesc[S].HighNut do + if ((Czesci[0].Czesc[S].Nuta[Pet].Start <= Czas.AktBeatD) + and (Czesci[0].Czesc[S].Nuta[Pet].Start + Czesci[0].Czesc[S].Nuta[Pet].Dlugosc - 1 >= Czas.AktBeatD)) + and (not Czesci[0].Czesc[S].Nuta[Pet].FreeStyle) // but don't allow when it's FreeStyle note + and (Czesci[0].Czesc[S].Nuta[Pet].Dlugosc > 0) // and make sure the note lenghts is at least 1 + then begin + SDet := S; + Mozna := true; + Break; + end; + + S := SDet; + + + + + +// Czas.SzczytJest := true; +// Czas.Ton := 27; + + // gdy moze, to dodaje nute + if (Sound[CP].SzczytJest) and (Mozna) then begin + // operowanie na ostatniej nucie + for Pet := 0 to Czesci[0].Czesc[S].HighNut do + if (Czesci[0].Czesc[S].Nuta[Pet].Start <= Czas.OldBeatD+1) + and (Czesci[0].Czesc[S].Nuta[Pet].Start + + Czesci[0].Czesc[S].Nuta[Pet].Dlugosc > Czas.OldBeatD+1) then begin + // to robi, tylko dla pary nut (oryginalnej i gracza) + + // przesuwanie tonu w odpowiednia game + while (Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton > 6) do + Sound[CP].Ton := Sound[CP].Ton - 12; + while (Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton < -6) do + Sound[CP].Ton := Sound[CP].Ton + 12; + + // Half size Notes Patch + NoteHit := false; + + //if Ini.Difficulty = 0 then Range := 2; + //if Ini.Difficulty = 1 then Range := 1; + //if Ini.Difficulty = 2 then Range := 0; + Range := 2 - Ini.Difficulty; + if abs(Czesci[0].Czesc[S].Nuta[Pet].Ton - Sound[CP].Ton) <= Range then begin + Sound[CP].Ton := Czesci[0].Czesc[S].Nuta[Pet].Ton; + + + // Half size Notes Patch + NoteHit := true; + + + if (Ini.LineBonus = 0) then + begin + // add points without LineBonus + case Czesci[0].Czesc[S].Nuta[Pet].Wartosc of + 1: Player[CP].Score := Player[CP].Score + 10000 / Czesci[0].Wartosc * + Czesci[0].Czesc[S].Nuta[Pet].Wartosc; + 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 10000 / Czesci[0].Wartosc * + Czesci[0].Czesc[S].Nuta[Pet].Wartosc; + end; + end + else + begin + // add points with Line Bonus + case Czesci[0].Czesc[S].Nuta[Pet].Wartosc of + 1: Player[CP].Score := Player[CP].Score + 9000 / Czesci[0].Wartosc * + Czesci[0].Czesc[S].Nuta[Pet].Wartosc; + 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 9000 / Czesci[0].Wartosc * + Czesci[0].Czesc[S].Nuta[Pet].Wartosc; + end; + end; + + Player[CP].ScoreI := Floor(Player[CP].Score / 10) * 10; + Player[CP].ScoreGoldenI := Floor(Player[CP].ScoreGolden / 10) * 10; + + Player[CP].ScoreTotalI := Player[CP].ScoreI + Player[CP].ScoreGoldenI + Player[CP].ScoreLineI; + end; + + end; // operowanie + + // sprawdzanie czy to nowa nuta, czy przedluzenie + if S = SMax then begin + Nowa := true; + // jezeli ostatnia ma ten sam ton + if (Player[CP].IlNut > 0 ) and (Player[CP].Nuta[Player[CP].HighNut].Ton = Sound[CP].Ton) + and (Player[CP].Nuta[Player[CP].HighNut].Start + Player[CP].Nuta[Player[CP].HighNut].Dlugosc = Czas.AktBeatD) + then Nowa := false; + // jezeli jest jakas nowa nuta na sprawdzanym beacie + for Pet := 0 to Czesci[0].Czesc[S].HighNut do + if (Czesci[0].Czesc[S].Nuta[Pet].Start = Czas.AktBeatD) then + Nowa := true; + + // dodawanie nowej nuty + if Nowa then begin + // nowa nuta + Player[CP].IlNut := Player[CP].IlNut + 1; + Player[CP].HighNut := Player[CP].HighNut + 1; + SetLength(Player[CP].Nuta, Player[CP].IlNut); + Player[CP].Nuta[Player[CP].HighNut].Start := Czas.AktBeatD; + Player[CP].Nuta[Player[CP].HighNut].Dlugosc := 1; + Player[CP].Nuta[Player[CP].HighNut].Ton := Sound[CP].Ton; // Ton || TonDokl + Player[CP].Nuta[Player[CP].HighNut].Detekt := Czas.MidBeat; + + + // Half Note Patch + Player[CP].Nuta[Player[CP].HighNut].Hit := NoteHit; + + + // Log.LogStatus('Nowa Nuta ' + IntToStr(Gracz.Nuta[Gracz.HighNut].Start), 'NewBeat'); + + end else begin + // przedluzenie nuty + Player[CP].Nuta[Player[CP].HighNut].Dlugosc := Player[CP].Nuta[Player[CP].HighNut].Dlugosc + 1; + end; + + + // check for perfect note and then lit the star (on Draw) + for Pet := 0 to Czesci[0].Czesc[S].HighNut do + if (Czesci[0].Czesc[S].Nuta[Pet].Start = Player[CP].Nuta[Player[CP].HighNut].Start) + and (Czesci[0].Czesc[S].Nuta[Pet].Dlugosc = Player[CP].Nuta[Player[CP].HighNut].Dlugosc) + and (Czesci[0].Czesc[S].Nuta[Pet].Ton = Player[CP].Nuta[Player[CP].HighNut].Ton) then begin + Player[CP].Nuta[Player[CP].HighNut].Perfect := true; + end; + + end;// else beep; // if S = SMax + + end; // if moze + end; // for CP +// Log.LogStatus('EndBeat', 'NewBeat'); + +//On Sentence End -> For LineBonus + SingBar +if (sDet >= low(Czesci[0].Czesc)) AND (sDet <= high(Czesci[0].Czesc)) then +if ((Czesci[0].Czesc[SDet].Nuta[Czesci[0].Czesc[SDet].HighNut].Start + Czesci[0].Czesc[SDet].Nuta[Czesci[0].Czesc[SDet].HighNut].Dlugosc - 1) = Czas.AktBeatD) then + Sender.onSentenceEnd(sDet); + +end; + +procedure ClearScores(PlayerNum: integer); +begin + Player[PlayerNum].Score := 0; + Player[PlayerNum].ScoreI := 0; + Player[PlayerNum].ScoreLine := 0; + Player[PlayerNum].ScoreLineI := 0; + Player[PlayerNum].ScoreGolden := 0; + Player[PlayerNum].ScoreGoldenI := 0; + Player[PlayerNum].ScoreTotalI := 0; + + + //SingBar Mod + Player[PlayerNum].ScoreLast := 0; + Player[PlayerNum].ScorePercent := 50;// Sets to 50% when song starts + Player[PlayerNum].ScorePercentTarget := 50;// Sets to 50% when song starts + //end SingBar Mod + + //PhrasenBonus - Line Bonus Mod + Player[PlayerNum].LineBonus_Visible := False; //Hide Line Bonus + Player[PlayerNum].LineBonus_Alpha := 0; + Player[PlayerNum].LineBonus_TargetX := 70 + PlayerNum*500; + Player[PlayerNum].LineBonus_TargetY := 30; + //PhrasenBonus - Line Bonus Mod End +end; + +//-------------------- +// Function sets all Absolute Paths e.g. Song Path and makes sure the Directorys exist +//-------------------- +procedure InitializePaths; + + // Initialize a Path Variable + // After Setting Paths, make sure that Paths exist + function initialize_path( out aPathVar : String; const aLocation : String ): boolean; + var + lWriteable: Boolean; + begin + aPathVar := aLocation; + + If DirectoryExists(aPathVar) then + lWriteable := ForceDirectories(aPathVar) + else + lWriteable := false; + + if not lWriteable then + Log.LogError('Error: Dir ('+ aLocation +') is Readonly'); + + result := lWriteable; + end; + +begin + + GamePath := ExtractFilePath(ParamStr(0)); + + initialize_path( LogPath , GamePath ); + initialize_path( SoundPath , GamePath + 'Sounds' + PathDelim ); + initialize_path( SongPath , GamePath + 'Songs' + PathDelim ); + initialize_path( ThemePath , GamePath + 'Themes' + PathDelim ); + initialize_path( ScreenshotsPath , GamePath + 'Screenshots' + PathDelim ); + initialize_path( CoversPath , GamePath + 'Covers' + PathDelim ); + initialize_path( LanguagesPath , GamePath + 'Languages' + PathDelim ); + initialize_path( PluginPath , GamePath + 'Plugins' + PathDelim ); + initialize_path( PlaylistPath , GamePath + 'Playlists' + PathDelim ); + + DecimalSeparator := ','; +end; + +end. + diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index be585ee1..e2e1f27e 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -1,625 +1,731 @@ -unit UMusic; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - - -uses Classes, - Windows, - Messages, - SysUtils, - {$IFNDEF FPC} - Forms, - {$ENDIF} - ULog, - USongs, - Bass; - -procedure InitializeSound; - -type - TSoundCard = record - Name: string; - Source: array of string; - end; - - TFFTData = array [0..256] of Single; - - TCustomSoundEntry = record - Filename: String; - Handle: hStream; - end; - - - TMusic = class - private - BassStart: hStream; // Wait, I've replaced this with BASS - BassBack: hStream; // It has almost all features we need - BassSwoosh: hStream; - BassChange: hStream; // Almost? It aleady has them all :) - BassOption: hStream; - BassClick: hStream; - BassDrum: hStream; - BassHihat: hStream; - BassClap: hStream; - BassShuffle: hStream; - - //Custom Sounds - CustomSounds: array of TCustomSoundEntry; - - - Loaded: boolean; - Loop: boolean; - public - Bass: hStream; - procedure InitializePlayback; - procedure InitializeRecord; - procedure SetVolume(Volume: integer); - procedure SetMusicVolume(Volume: integer); - procedure SetLoop(Enabled: boolean); - function Open(Name: string): boolean; // true if succeed - procedure Rewind; - procedure MoveTo(Time: real); - procedure Play; - procedure Pause; //Pause Mod - procedure Stop; - procedure Close; - function Finished: boolean; - function Length: real; - function Position: real; - procedure PlayStart; - procedure PlayBack; - procedure PlaySwoosh; - procedure PlayChange; - procedure PlayOption; - procedure PlayClick; - procedure PlayDrum; - procedure PlayHihat; - procedure PlayClap; - procedure PlayShuffle; - procedure StopShuffle; - procedure CaptureStart; - procedure CaptureStop; - procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); - procedure StopCard(Card: byte); - function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; - - //Equalizer - function GetFFTData: TFFTData; - - //Custom Sounds - function LoadCustomSound(const Filename: String): Cardinal; - procedure PlayCustomSound(const Index: Cardinal); - -end; - -const - RecordSystem = 1; - -type - TMuzyka = record - Path: string; - Start: integer; // start of song in ms - IlNut: integer; - DlugoscNut: integer; - end; - - TCzesci = record - Akt: integer; // aktualna czesc utworu do rysowania - High: integer; - Ilosc: integer; - Resolution: integer; - NotesGAP: integer; - Wartosc: integer; - Czesc: array of record - Start: integer; - StartNote: integer; - Lyric: string; - LyricWidth: real; - Koniec: integer; - BaseNote: integer; - HighNut: integer; - IlNut: integer; - TotalNotes: integer; - Nuta: array of record - Color: integer; - Start: integer; - Dlugosc: integer; - Ton: integer; - TonGamy: integer; - Tekst: string; - FreeStyle: boolean; - Wartosc: integer; // zwykla nuta x1, zlota nuta x2 - end; - end; - end; - - TCzas = record // wszystko, co dotyczy aktualnej klatki - OldBeat: integer; // poprzednio wykryty beat w utworze - AktBeat: integer; // aktualny beat w utworze - MidBeat: real; // dokladny AktBeat - - // now we use this for super synchronization! - // only used when analyzing voice - OldBeatD: integer; // poprzednio wykryty beat w utworze - AktBeatD: integer; // aktualny beat w utworze - MidBeatD: real; // dokladny AktBeatD - FracBeatD: real; // fractional part of MidBeatD - - // we use this for audiable clicks - OldBeatC: integer; // poprzednio wykryty beat w utworze - AktBeatC: integer; // aktualny beat w utworze - MidBeatC: real; // dokladny AktBeatC - FracBeatC: real; // fractional part of MidBeatC - - - OldCzesc: integer; // poprzednio wyswietlana czesc - // akt jest w czesci.akt - - Teraz: real; // aktualny czas w utworze - Razem: real; // caly czas utworu - end; - -var - Music: TMusic; - - // muzyka - Muzyka: TMuzyka; - - // czesci z nutami; - Czesci: array of TCzesci; - - // czas - Czas: TCzas; - - fHWND: Thandle; - -type - TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, - mpPaused, mpOpen); - -const - ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); - -implementation - -uses UCommon, - UGraphic, - URecord, - UFiles, - UIni, - UMain, - UThemes; - -procedure InitializeSound; -begin - Log.LogStatus('Initializing Playback', 'InitializeSound'); Music.InitializePlayback; - Log.LogStatus('Initializing Record', 'InitializeSound'); Music.InitializeRecord; -end; - -procedure TMusic.InitializePlayback; -var - Pet: integer; - S: integer; -begin - Log.BenchmarkStart(4); - Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); - - Loaded := false; - Loop := false; - - fHWND := AllocateHWND( nil); // TODO : JB - can we do something different here ?? lazarus didnt like this function - - if not BASS_Init(1, 44100, 0, fHWND, nil) then - begin - {$IFNDEF FPC} - // TODO : JB find a way to do this nice.. - Application.MessageBox ('Could not initialize BASS', 'Error'); - {$ENDIF} - Exit; - end; - - Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); - - // config playing buffer -// BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); -// BASS_SetConfig(BASS_CONFIG_BUFFER, 100); - - Log.LogStatus('Loading Sounds', 'Music Initialize'); - - Log.BenchmarkStart(4); - LoadSoundFromFile(BassStart, SoundPath + 'Common Start.mp3'); - LoadSoundFromFile(BassBack, SoundPath + 'Common Back.mp3'); - LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3'); - LoadSoundFromFile(BassChange, SoundPath + 'select music change music 50.mp3'); - LoadSoundFromFile(BassOption, SoundPath + 'option change col.mp3'); - LoadSoundFromFile(BassClick, SoundPath + 'rimshot022b.mp3'); - -// LoadSoundFromFile(BassDrum, SoundPath + 'bassdrumhard076b.mp3'); -// LoadSoundFromFile(BassHihat, SoundPath + 'hihatclosed068b.mp3'); -// LoadSoundFromFile(BassClap, SoundPath + 'claps050b.mp3'); - -// LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3'); - - Log.BenchmarkEnd(4); Log.LogBenchmark('--> Loading Sounds', 4); -end; - -procedure TMusic.InitializeRecord; -var - S: integer; - device: integer; - descr: string; - input: integer; - input2: integer; - flags: integer; - mic: array[0..15] of integer; - SC: integer; // soundcard - SCI: integer; // soundcard input -begin - if RecordSystem = 1 then begin - SetLength(Sound, 6 {max players});//Ini.Players+1); - for S := 0 to High(Sound) do begin //Ini.Players do begin - Sound[S] := TSound.Create; - Sound[S].Num := S; - Sound[S].BufferNew := TMemoryStream.Create; - SetLength(Sound[S].BufferLong, 1); - Sound[S].BufferLong[0] := TMemoryStream.Create; - Sound[S].n := 4*1024; - end; - - - // check for recording devices; - {device := 0; - descr := BASS_RecordGetDeviceDescription(device); - - SetLength(SoundCard, 0); - while (descr <> '') do begin - SC := High(SoundCard) + 1; - SetLength(SoundCard, SC+1); - - Log.LogAnalyze('Device #'+IntToStr(device)+': '+ descr); - SoundCard[SC].Description := Descr; - - // check for recording inputs - mic[device] := -1; // default to no change - input := 0; - BASS_RecordInit(device); - Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); - flags := BASS_RecordGetInput(input); - - SetLength(SoundCard[SC].Input, 0); - while (flags <> -1) do begin - SCI := High(SoundCard[SC].Input) + 1; - SetLength(SoundCard[SC].Input, SCI+1); - - Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); - SoundCard[SC].Input[SCI].Name := BASS_RecordGetInputName(Input); - - if (flags and BASS_INPUT_TYPE_MASK) = BASS_INPUT_TYPE_MIC then begin - mic[device] := input; // auto set microphone - end; - Inc(Input); - flags := BASS_RecordGetInput(input); - end; - - if mic[device] <> -1 then begin - Log.LogAnalyze('Found the mic at input ' + IntToStr(Mic[device])) - end else begin - Log.LogAnalyze('Mic not found'); - mic[device] := 0; // setting to the first one (for kxproject) - end; - SoundCard[SC].InputSeleceted := Mic[Device]; - - - BASS_RecordFree; - - inc(Device); - descr := BASS_RecordGetDeviceDescription(Device); - end; // while} - end; // if -end; - -procedure TMusic.SetVolume(Volume: integer); -begin - //Old Sets Wave Volume - //BASS_SetVolume(Volume); - //New: Sets Volume only for this Application - BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); -end; - -procedure TMusic.SetMusicVolume(Volume: Integer); -begin - //Max Volume Prevention - if Volume > 100 then - Volume := 100; - - //Set Volume - BASS_ChannelSetAttributes (Bass, -1, Volume, -101); -end; - -procedure TMusic.SetLoop(Enabled: boolean); -begin - Loop := Enabled; -end; - -function TMusic.Open(Name: string): boolean; -begin - Loaded := false; - if FileExists(Name) then begin - Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); - Loaded := true; - //Set Max Volume - SetMusicVolume (100); - end; - - Result := Loaded; -end; - -procedure TMusic.Rewind; -begin - if Loaded then begin - end; -end; - -procedure TMusic.MoveTo(Time: real); -var - bytes: integer; -begin - bytes := BASS_ChannelSeconds2Bytes(Bass, Time); - BASS_ChannelSetPosition(Bass, bytes); -end; - -procedure TMusic.Play; -begin - if Loaded then - begin - if Loop then - BASS_ChannelPlay(Bass, True); // start from beginning... actually bass itself does not loop, nor does this TMusic Class - - BASS_ChannelPlay(Bass, False); // for setting position before playing - end; -end; - -procedure TMusic.Pause; //Pause Mod -begin - if Loaded then begin - BASS_ChannelPause(Bass); // Pauses Song - end; -end; - -procedure TMusic.Stop; -begin - Bass_ChannelStop(Bass); -end; - -procedure TMusic.Close; -begin - Bass_StreamFree(Bass); -end; - -function TMusic.Length: real; -var - bytes: integer; -begin - Result := 60; - - bytes := BASS_ChannelGetLength(Bass); - Result := BASS_ChannelBytes2Seconds(Bass, bytes); -end; - -function TMusic.Position: real; -var - bytes: integer; -begin - Result := 0; - bytes := BASS_ChannelGetPosition(BASS); - Result := BASS_ChannelBytes2Seconds(BASS, bytes); -end; - -function TMusic.Finished: boolean; -begin - Result := false; - - if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then - begin - Result := true; - end; -end; - -procedure TMusic.PlayStart; -begin - BASS_ChannelPlay(BassStart, True); -end; - -procedure TMusic.PlayBack; -begin - BASS_ChannelPlay(BassBack, True);// then -end; - -procedure TMusic.PlaySwoosh; -begin - BASS_ChannelPlay(BassSwoosh, True); -end; - -procedure TMusic.PlayChange; -begin - BASS_ChannelPlay(BassChange, True); -end; - -procedure TMusic.PlayOption; -begin - BASS_ChannelPlay(BassOption, True); -end; - -procedure TMusic.PlayClick; -begin - BASS_ChannelPlay(BassClick, True); -end; - -procedure TMusic.PlayDrum; -begin - BASS_ChannelPlay(BassDrum, True); -end; - -procedure TMusic.PlayHihat; -begin - BASS_ChannelPlay(BassHihat, True); -end; - -procedure TMusic.PlayClap; -begin - BASS_ChannelPlay(BassClap, True); -end; - -procedure TMusic.PlayShuffle; -begin - BASS_ChannelPlay(BassShuffle, True); -end; - -procedure TMusic.StopShuffle; -begin - BASS_ChannelStop(BassShuffle); -end; - -procedure TMusic.CaptureStart; -var - S: integer; - SC: integer; - P1: integer; - P2: integer; -begin - for S := 0 to High(Sound) do - Sound[S].BufferLong[0].Clear; - - for SC := 0 to High(Ini.CardList) do begin - P1 := Ini.CardList[SC].ChannelL; - P2 := Ini.CardList[SC].ChannelR; - if P1 > PlayersPlay then P1 := 0; - if P2 > PlayersPlay then P2 := 0; - if (P1 > 0) or (P2 > 0) then - CaptureCard(SC, P1, P2); - end; -end; - -procedure TMusic.CaptureStop; -var - SC: integer; - P1: integer; - P2: integer; -begin - - for SC := 0 to High(Ini.CardList) do begin - P1 := Ini.CardList[SC].ChannelL; - P2 := Ini.CardList[SC].ChannelR; - if P1 > PlayersPlay then P1 := 0; - if P2 > PlayersPlay then P2 := 0; - if (P1 > 0) or (P2 > 0) then StopCard(SC); - end; - -end; - -//procedure TMusic.CaptureCard(RecordI, SoundNum, PlayerLeft, PlayerRight: byte); -procedure TMusic.CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); -var - Error: integer; - ErrorMsg: string; -begin - if not BASS_RecordInit(RecordI) then begin - Error := BASS_ErrorGetCode; - - ErrorMsg := IntToStr(Error); - if Error = BASS_ERROR_DX then ErrorMsg := 'No DX5'; - if Error = BASS_ERROR_ALREADY then ErrorMsg := 'The device has already been initialized'; - if Error = BASS_ERROR_DEVICE then ErrorMsg := 'The device number specified is invalid'; - if Error = BASS_ERROR_DRIVER then ErrorMsg := 'There is no available device driver'; - - {Log.LogAnalyze('Error initializing record [' + IntToStr(RecordI) + ', ' - + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' - + ErrorMsg);} - Log.LogError('Error initializing record [' + IntToStr(RecordI) + ', ' - + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' - + ErrorMsg); - Log.LogError('Music -> CaptureCard: Error initializing record: ' + ErrorMsg); - - - end - else - begin - Recording.SoundCard[RecordI].BassRecordStream := BASS_RecordStart(44100, 2, MakeLong(0, 20) , @GetMicrophone, PlayerLeft + PlayerRight*256); - end; -end; - -procedure TMusic.StopCard(Card: byte); -begin - BASS_RecordSetDevice(Card); - BASS_RecordFree; -end; - -function TMusic.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; -var - L: Integer; -begin - if FileExists(Name) then begin - Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); - try - hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); - //Add CustomSound - L := High(CustomSounds) + 1; - SetLength (CustomSounds, L + 1); - CustomSounds[L].Filename := Name; - CustomSounds[L].Handle := hStream; - except - Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); - end; - end else begin - Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); - exit; - end; -end; - -//Equalizer -function TMusic.GetFFTData: TFFTData; -var -Data: TFFTData; -begin - //Get Channel Data Mono and 256 Values - BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); - //Result := Data; -end; - -function TMusic.LoadCustomSound(const Filename: String): Cardinal; -var - S: hStream; - I: Integer; - F: String; -begin - //Search for Sound in already loaded Sounds - F := UpperCase(SoundPath + FileName); - For I := 0 to High(CustomSounds) do - begin - if (UpperCase(CustomSounds[I].Filename) = F) then - begin - Result := I; - Exit; - end; - end; - - if LoadSoundFromFile(S, SoundPath + Filename) then - Result := High(CustomSounds) - else - Result := 0; -end; - -procedure TMusic.PlayCustomSound(const Index: Cardinal); -begin -if Index <= High(CustomSounds) then - BASS_ChannelPlay(CustomSounds[Index].Handle, True); -end; - - -end. +unit UMusic; + +interface + +{$I switches.inc} + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + + +uses Classes, + {$IFDEF win32} + windows, + {$ENDIF} + UCommon, + Messages, + SysUtils, + {$IFNDEF FPC} + Forms, + {$ENDIF} + {$IFDEF useBASS} + bass, + {$ENDIF} + ULog, + USongs; + + +procedure InitializeSound; + +type + TSoundCard = record + Name: string; + Source: array of string; + end; + + TFFTData = array [0..256] of Single; + + TCustomSoundEntry = record + Filename : String; + Handle : hStream; + end; + + + TMusic = class + private + BassStart: hStream; // Wait, I've replaced this with BASS + BassBack: hStream; // It has almost all features we need + BassSwoosh: hStream; + BassChange: hStream; // Almost? It aleady has them all :) + BassOption: hStream; + BassClick: hStream; + BassDrum: hStream; + BassHihat: hStream; + BassClap: hStream; + BassShuffle: hStream; + + //Custom Sounds + CustomSounds: array of TCustomSoundEntry; + + + Loaded: boolean; + Loop: boolean; + public + Bass: hStream; + procedure InitializePlayback; + procedure InitializeRecord; + procedure SetVolume(Volume: integer); + procedure SetMusicVolume(Volume: integer); + procedure SetLoop(Enabled: boolean); + function Open(Name: string): boolean; // true if succeed + procedure Rewind; + procedure MoveTo(Time: real); + procedure Play; + procedure Pause; //Pause Mod + procedure Stop; + procedure Close; + function Finished: boolean; + function Length: real; + function Position: real; + procedure PlayStart; + procedure PlayBack; + procedure PlaySwoosh; + procedure PlayChange; + procedure PlayOption; + procedure PlayClick; + procedure PlayDrum; + procedure PlayHihat; + procedure PlayClap; + procedure PlayShuffle; + procedure StopShuffle; + procedure CaptureStart; + procedure CaptureStop; + procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); + procedure StopCard(Card: byte); + function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; + + //Equalizer + function GetFFTData: TFFTData; + + //Custom Sounds + function LoadCustomSound(const Filename: String): Cardinal; + procedure PlayCustomSound(const Index: Cardinal); + +end; + +const + RecordSystem = 1; + +type + TMuzyka = record + Path: string; + Start: integer; // start of song in ms + IlNut: integer; + DlugoscNut: integer; + end; + + TCzesci = record + Akt: integer; // aktualna czesc utworu do rysowania + High: integer; + Ilosc: integer; + Resolution: integer; + NotesGAP: integer; + Wartosc: integer; + Czesc: array of record + Start: integer; + StartNote: integer; + Lyric: string; + LyricWidth: real; + Koniec: integer; + BaseNote: integer; + HighNut: integer; + IlNut: integer; + TotalNotes: integer; + Nuta: array of record + Color: integer; + Start: integer; + Dlugosc: integer; + Ton: integer; + TonGamy: integer; + Tekst: string; + FreeStyle: boolean; + Wartosc: integer; // zwykla nuta x1, zlota nuta x2 + end; + end; + end; + + TCzas = record // wszystko, co dotyczy aktualnej klatki + OldBeat: integer; // poprzednio wykryty beat w utworze + AktBeat: integer; // aktualny beat w utworze + MidBeat: real; // dokladny AktBeat + + // now we use this for super synchronization! + // only used when analyzing voice + OldBeatD: integer; // poprzednio wykryty beat w utworze + AktBeatD: integer; // aktualny beat w utworze + MidBeatD: real; // dokladny AktBeatD + FracBeatD: real; // fractional part of MidBeatD + + // we use this for audiable clicks + OldBeatC: integer; // poprzednio wykryty beat w utworze + AktBeatC: integer; // aktualny beat w utworze + MidBeatC: real; // dokladny AktBeatC + FracBeatC: real; // fractional part of MidBeatC + + + OldCzesc: integer; // poprzednio wyswietlana czesc + // akt jest w czesci.akt + + Teraz: real; // aktualny czas w utworze + Razem: real; // caly czas utworu + end; + +var + Music: TMusic; + + // muzyka + Muzyka: TMuzyka; + + // czesci z nutami; + Czesci: array of TCzesci; + + // czas + Czas: TCzas; + + fHWND: Thandle; + +type + TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, + mpPaused, mpOpen); + +const + ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); + +implementation + +uses + {$IFDEF FPC} + lclintf, + {$ENDIF} + UGraphic, + URecord, + UFiles, + UIni, + UMain, + UThemes; + +procedure InitializeSound; +begin + Log.LogStatus('Initializing Playback', 'InitializeSound'); Music.InitializePlayback; + Log.LogStatus('Initializing Record', 'InitializeSound'); Music.InitializeRecord; +end; + +procedure TMusic.InitializePlayback; +var + Pet: integer; + S: integer; +begin + Log.BenchmarkStart(4); + Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); + + Loaded := false; + Loop := false; + + fHWND := AllocateHWND( nil); // TODO : JB_lazarus - can we do something different here ?? lazarus didnt like this function + + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + if not BASS_Init(1, 44100, 0, fHWND, nil) then + begin + {$IFNDEF FPC} + // TODO : JB_lazarus find a way to do this nice.. + Application.MessageBox ('Could not initialize BASS', 'Error'); + {$ENDIF} + Exit; + end; + {$ENDIF} + + Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); + + // config playing buffer +// BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); +// BASS_SetConfig(BASS_CONFIG_BUFFER, 100); + + Log.LogStatus('Loading Sounds', 'Music Initialize'); + + Log.BenchmarkStart(4); + LoadSoundFromFile(BassStart, SoundPath + 'Common Start.mp3'); + LoadSoundFromFile(BassBack, SoundPath + 'Common Back.mp3'); + LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3'); + LoadSoundFromFile(BassChange, SoundPath + 'select music change music 50.mp3'); + LoadSoundFromFile(BassOption, SoundPath + 'option change col.mp3'); + LoadSoundFromFile(BassClick, SoundPath + 'rimshot022b.mp3'); + +// LoadSoundFromFile(BassDrum, SoundPath + 'bassdrumhard076b.mp3'); +// LoadSoundFromFile(BassHihat, SoundPath + 'hihatclosed068b.mp3'); +// LoadSoundFromFile(BassClap, SoundPath + 'claps050b.mp3'); + +// LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3'); + + Log.BenchmarkEnd(4); Log.LogBenchmark('--> Loading Sounds', 4); +end; + +procedure TMusic.InitializeRecord; +var + S: integer; + device: integer; + descr: string; + input: integer; + input2: integer; + flags: integer; + mic: array[0..15] of integer; + SC: integer; // soundcard + SCI: integer; // soundcard input +begin + if RecordSystem = 1 then begin + SetLength(Sound, 6 {max players});//Ini.Players+1); + for S := 0 to High(Sound) do begin //Ini.Players do begin + Sound[S] := TSound.Create; + Sound[S].Num := S; + Sound[S].BufferNew := TMemoryStream.Create; + SetLength(Sound[S].BufferLong, 1); + Sound[S].BufferLong[0] := TMemoryStream.Create; + Sound[S].n := 4*1024; + end; + + + // check for recording devices; + {device := 0; + descr := BASS_RecordGetDeviceDescription(device); + + SetLength(SoundCard, 0); + while (descr <> '') do begin + SC := High(SoundCard) + 1; + SetLength(SoundCard, SC+1); + + Log.LogAnalyze('Device #'+IntToStr(device)+': '+ descr); + SoundCard[SC].Description := Descr; + + // check for recording inputs + mic[device] := -1; // default to no change + input := 0; + BASS_RecordInit(device); + Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); + flags := BASS_RecordGetInput(input); + + SetLength(SoundCard[SC].Input, 0); + while (flags <> -1) do begin + SCI := High(SoundCard[SC].Input) + 1; + SetLength(SoundCard[SC].Input, SCI+1); + + Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); + SoundCard[SC].Input[SCI].Name := BASS_RecordGetInputName(Input); + + if (flags and BASS_INPUT_TYPE_MASK) = BASS_INPUT_TYPE_MIC then begin + mic[device] := input; // auto set microphone + end; + Inc(Input); + flags := BASS_RecordGetInput(input); + end; + + if mic[device] <> -1 then begin + Log.LogAnalyze('Found the mic at input ' + IntToStr(Mic[device])) + end else begin + Log.LogAnalyze('Mic not found'); + mic[device] := 0; // setting to the first one (for kxproject) + end; + SoundCard[SC].InputSeleceted := Mic[Device]; + + + BASS_RecordFree; + + inc(Device); + descr := BASS_RecordGetDeviceDescription(Device); + end; // while} + end; // if +end; + +procedure TMusic.SetVolume(Volume: integer); +begin + //Old Sets Wave Volume + //BASS_SetVolume(Volume); + //New: Sets Volume only for this Application + + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); + {$ENDIF} +end; + +procedure TMusic.SetMusicVolume(Volume: Integer); +begin + //Max Volume Prevention + if Volume > 100 then + Volume := 100; + + //Set Volume + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelSetAttributes (Bass, -1, Volume, -101); + {$ENDIF} +end; + +procedure TMusic.SetLoop(Enabled: boolean); +begin + Loop := Enabled; +end; + +function TMusic.Open(Name: string): boolean; +begin + Loaded := false; + if FileExists(Name) then + begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); + {$ENDIF} + + Loaded := true; + //Set Max Volume + SetMusicVolume (100); + end; + + Result := Loaded; +end; + +procedure TMusic.Rewind; +begin + if Loaded then begin + end; +end; + +procedure TMusic.MoveTo(Time: real); +var + bytes: integer; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + bytes := BASS_ChannelSeconds2Bytes(Bass, Time); + BASS_ChannelSetPosition(Bass, bytes); + {$ENDIF} +end; + +procedure TMusic.Play; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + if Loaded then + begin + if Loop then + BASS_ChannelPlay(Bass, True); // start from beginning... actually bass itself does not loop, nor does this TMusic Class + + BASS_ChannelPlay(Bass, False); // for setting position before playing + end; + {$ENDIF} +end; + +procedure TMusic.Pause; //Pause Mod +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + if Loaded then begin + BASS_ChannelPause(Bass); // Pauses Song + end; + {$ENDIF} +end; + +procedure TMusic.Stop; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + Bass_ChannelStop(Bass); + {$ENDIF} +end; + +procedure TMusic.Close; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + Bass_StreamFree(Bass); + {$ENDIF} +end; + +function TMusic.Length: real; +var + bytes: integer; +begin + Result := 60; + + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + bytes := BASS_ChannelGetLength(Bass); + Result := BASS_ChannelBytes2Seconds(Bass, bytes); + {$ENDIF} +end; + +function TMusic.Position: real; +var + bytes: integer; +begin + Result := 0; + + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + bytes := BASS_ChannelGetPosition(BASS); + Result := BASS_ChannelBytes2Seconds(BASS, bytes); + {$ENDIF} +end; + +function TMusic.Finished: boolean; +begin + Result := false; + + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then + begin + Result := true; + end; + {$ENDIF} +end; + +procedure TMusic.PlayStart; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassStart, True); + {$ENDIF} +end; + +procedure TMusic.PlayBack; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassBack, True);// then + {$ENDIF} +end; + +procedure TMusic.PlaySwoosh; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassSwoosh, True); + {$ENDIF} +end; + +procedure TMusic.PlayChange; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassChange, True); + {$ENDIF} +end; + +procedure TMusic.PlayOption; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassOption, True); + {$ENDIF} +end; + +procedure TMusic.PlayClick; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassClick, True); + {$ENDIF} +end; + +procedure TMusic.PlayDrum; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassDrum, True); + {$ENDIF} +end; + +procedure TMusic.PlayHihat; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassHihat, True); + {$ENDIF} +end; + +procedure TMusic.PlayClap; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassClap, True); + {$ENDIF} +end; + +procedure TMusic.PlayShuffle; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassShuffle, True); + {$ENDIF} +end; + +procedure TMusic.StopShuffle; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelStop(BassShuffle); + {$ENDIF} +end; + +procedure TMusic.CaptureStart; +var + S: integer; + SC: integer; + P1: integer; + P2: integer; +begin + for S := 0 to High(Sound) do + Sound[S].BufferLong[0].Clear; + + for SC := 0 to High(Ini.CardList) do begin + P1 := Ini.CardList[SC].ChannelL; + P2 := Ini.CardList[SC].ChannelR; + if P1 > PlayersPlay then P1 := 0; + if P2 > PlayersPlay then P2 := 0; + if (P1 > 0) or (P2 > 0) then + CaptureCard(SC, P1, P2); + end; +end; + +procedure TMusic.CaptureStop; +var + SC: integer; + P1: integer; + P2: integer; +begin + + for SC := 0 to High(Ini.CardList) do begin + P1 := Ini.CardList[SC].ChannelL; + P2 := Ini.CardList[SC].ChannelR; + if P1 > PlayersPlay then P1 := 0; + if P2 > PlayersPlay then P2 := 0; + if (P1 > 0) or (P2 > 0) then StopCard(SC); + end; + +end; + +//procedure TMusic.CaptureCard(RecordI, SoundNum, PlayerLeft, PlayerRight: byte); +procedure TMusic.CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); +var + Error: integer; + ErrorMsg: string; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + + if not BASS_RecordInit(RecordI) then begin + Error := BASS_ErrorGetCode; + + ErrorMsg := IntToStr(Error); + if Error = BASS_ERROR_DX then ErrorMsg := 'No DX5'; + if Error = BASS_ERROR_ALREADY then ErrorMsg := 'The device has already been initialized'; + if Error = BASS_ERROR_DEVICE then ErrorMsg := 'The device number specified is invalid'; + if Error = BASS_ERROR_DRIVER then ErrorMsg := 'There is no available device driver'; + + {Log.LogAnalyze('Error initializing record [' + IntToStr(RecordI) + ', ' + + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' + + ErrorMsg);} + Log.LogError('Error initializing record [' + IntToStr(RecordI) + ', ' + + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' + + ErrorMsg); + Log.LogError('Music -> CaptureCard: Error initializing record: ' + ErrorMsg); + + + end + else + begin + Recording.SoundCard[RecordI].BassRecordStream := BASS_RecordStart(44100, 2, MakeLong(0, 20) , @GetMicrophone, PlayerLeft + PlayerRight*256); + end; + + {$ENDIF} +end; + +procedure TMusic.StopCard(Card: byte); +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_RecordSetDevice(Card); + BASS_RecordFree; + {$ENDIF} +end; + +function TMusic.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; +var + L: Integer; +begin + if FileExists(Name) then begin + Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); + try + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); + {$ENDIF} + + //Add CustomSound + L := High(CustomSounds) + 1; + SetLength (CustomSounds, L + 1); + CustomSounds[L].Filename := Name; + CustomSounds[L].Handle := hStream; + except + Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); + end; + end else begin + Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); + exit; + end; +end; + +//Equalizer +function TMusic.GetFFTData: TFFTData; +var +Data: TFFTData; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + + //Get Channel Data Mono and 256 Values + BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); + //Result := Data; + + {$ENDIF} +end; + +function TMusic.LoadCustomSound(const Filename: String): Cardinal; +var + S: hStream; + I: Integer; + F: String; +begin + //Search for Sound in already loaded Sounds + F := UpperCase(SoundPath + FileName); + For I := 0 to High(CustomSounds) do + begin + if (UpperCase(CustomSounds[I].Filename) = F) then + begin + Result := I; + Exit; + end; + end; + + if LoadSoundFromFile(S, SoundPath + Filename) then + Result := High(CustomSounds) + else + Result := 0; +end; + +procedure TMusic.PlayCustomSound(const Index: Cardinal); +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + + if Index <= High(CustomSounds) then + BASS_ChannelPlay(CustomSounds[Index].Handle, True); + + {$ENDIF} +end; + + +end. diff --git a/Game/Code/Classes/URecord.pas b/Game/Code/Classes/URecord.pas index 03c87a35..d22e20d3 100644 --- a/Game/Code/Classes/URecord.pas +++ b/Game/Code/Classes/URecord.pas @@ -1,347 +1,359 @@ -unit URecord; - -interface - -uses Classes, - Math, - SysUtils, - UMusic, - UIni, - BASS; - -type - TSound = class - BufferNew: TMemoryStream; // buffer for newest sample - BufferArray: array[1..4096] of smallint; // (Signal) newest 4096 samples - BufferLong: array of TMemoryStream; // full buffer - - Num: integer; - n: integer; // length of Signal to analyze - - // pitch detection - SzczytJest: boolean; // czy jest szczyt - Szczyt: integer; // pozycja szczytu na osi poziomej - TonDokl: real; // ton aktualnego szczytu - Ton: integer; // ton bez ulamka - TonGamy: integer; // ton w gamie. wartosci: 0-11 - Skala: real; // skala FFT - - // procedures - procedure ProcessNewBuffer; - procedure AnalizujBufor; // use to analyze sound from buffers to get new pitch - procedure AnalizujByAutocorrelation; // we call it to analyze sound by checking Autocorrelation - function AnalyzeAutocorrelationFreq(Freq: real): real; // use this to check one frequency by Autocorrelation - end; - - TSoundCardInput = record - Name: string; - end; - - TSoundCard = record - // here can be the soundcard information - whole database from which user will select recording source - Description: string; - Input: array of TSoundCardInput; - InputSelected: integer; - MicInput: Integer; - - // bass record - BassRecordStream: hStream; - end; - - TRecord = class - SoundCard: array of TSoundCard; - constructor Create; - end; - - smallintarray = array [0..maxInt shr 1-1] of smallInt; - psmallintarray = ^smallintarray; - - // procedures - bass record - function GetMicrophone(handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD): boolean; stdcall; - - -var - Sound: array of TSound; - SoundCard: array of TSoundCard; - Poz: integer; - Recording: TRecord; - -implementation -uses UMain; - -procedure TSound.ProcessNewBuffer; -var - S: integer; - L: integer; - A: integer; -begin - // process BufferArray - S := 0; - L := BufferNew.Size div 2; - if L > n then begin - S := L - n; - L := n; - end; - - // copy to array - for A := L+1 to n do - BufferArray[A-L] := BufferArray[A]; - - BufferNew.Seek(2*S, soBeginning); - BufferNew.ReadBuffer(BufferArray[1+n-L], 2*L); - - // process BufferLong - if Ini.SavePlayback = 1 then - begin - BufferNew.Seek(0, soBeginning); - BufferLong[0].CopyFrom(BufferNew, BufferNew.Size); - end; -end; - -procedure TSound.AnalizujBufor; -begin - AnalizujByAutocorrelation; -end; - -procedure TSound.AnalizujByAutocorrelation; -var - T: integer; // tone - F: real; // freq - Wages: array[0..35] of real; // wages - MaxT: integer; // max tone - MaxW: real; // max wage - V: real; // volume - MaxV: real; // max volume - S: integer; // Signal - Threshold: real; // threshold -begin - SzczytJest := false; - - // find maximum volume of first 1024 words of signal - MaxV := 0; - for S := 1 to 1024 do // 0.5.2: fix. was from 0 to 1023 - begin - V := Abs(BufferArray[S]) / $10000; - - if V > MaxV then - MaxV := V; - end; - - // prepare to analyze - MaxW := 0; - - // analyze all 12 halftones - for T := 0 to 35 do // to 11, then 23, now 35 (for Whitney and my high voice) - begin - F := 130.81*Power(1.05946309436, T)/2; // let's analyze below 130.81 - Wages[T] := AnalyzeAutocorrelationFreq(F); - - if Wages[T] > MaxW then - begin // this frequency has better wage - MaxW := Wages[T]; - MaxT := T; - end; - end; // for T - - Threshold := 0.1; - case Ini.Threshold of - 0: Threshold := 0.05; - 1: Threshold := 0.1; - 2: Threshold := 0.15; - 3: Threshold := 0.2; - end; - - if MaxV >= Threshold then - begin // found acceptable volume // 0.1 - SzczytJest := true; - TonGamy := MaxT mod 12; - Ton := MaxT mod 12; - end; - -end; - -function TSound.AnalyzeAutocorrelationFreq(Freq: real): real; // result medium difference -var - Count: real; - Src: integer; - Dst: integer; - Move: integer; - Il: integer; // how many counts were done -begin - // we use Signal as source - Count := 0; - Il := 0; - Src := 1; - Move := Round(44100/Freq); - Dst := Src + Move; - - // ver 2 - compare in vertical - while (Dst < n) do - begin // process up to n (4KB) of Signal - Count := Count + Abs(BufferArray[Src] - BufferArray[Dst]) / $10000; - Inc(Src); - Inc(Dst); - Inc(Il); - end; - - Result := 1 - Count / Il; -end; - -function GetMicrophone(handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD): boolean; stdcall; -var - L: integer; - S: integer; - PB: pbytearray; - PSI: psmallintarray; - I: integer; - Skip: integer; - P1: integer; - P2: integer; - Boost: byte; -begin - // set boost - case Ini.MicBoost of - 0: Boost := 1; - 1: Boost := 2; - 2: Boost := 4; - 3: Boost := 8; - end; - - // boost buffer - L := Len div 2; // number of samples - PSI := Buffer; - for S := 0 to L-1 do - begin - I := PSI^[S] * Boost; - if I > 32767 then I := 32767; // 0.5.0: limit - if I < -32768 then I := -32768; // 0.5.0: limit - PSI^[S] := I; - end; - - // decode user - P1 := (user and 255) - 1; - P2 := (user div 256) - 1; - - - // 2 players USB mic, left channel - if P1 >= 0 then - begin - L := Len div 4; // number of samples - PB := Buffer; - - Sound[P1].BufferNew.Clear; // 0.5.2: problem on exiting - for S := 1 to L do - begin - Sound[P1].BufferNew.Write(PB[(S-1)*4], 2); - end; - Sound[P1].ProcessNewBuffer; - end; - - // 2 players USB mic, right channel - Skip := 2; - - if P2 >= 0 then - begin - L := Len div 4; // number of samples - PB := Buffer; - Sound[P2].BufferNew.Clear; - for S := 1 to L do - begin - Sound[P2].BufferNew.Write(PB[Skip + (S-1)*4], 2); - end; - Sound[P2].ProcessNewBuffer; - end; - - Result := true; -end; - -constructor TRecord.Create; -var - SC: integer; // soundcard - SCI: integer; // soundcard input - Descr: string; - InputName: PChar; - Flags: integer; - No: integer; - - function isDuplicate(Desc: String): Boolean; - var - I: Integer; - begin - Result := False; - //Check for Soundcard with same Description - For I := 0 to SC-1 do - begin - if (SoundCard[I].Description = Desc) then - begin - Result := True; - Break; - end; - end; - end; - -begin - // checks for recording devices and puts them into array; - SetLength(SoundCard, 0); - - SC := 0; - Descr := BASS_RecordGetDeviceDescription(SC); - - while (Descr <> '') do - begin - - //If there is another SoundCard with the Same ID, Search an available Name - if (IsDuplicate(Descr)) then - begin - No:= 1; //Count of SoundCards with same Name - Repeat - Inc(No) - Until not IsDuplicate(Descr + ' (' + InttoStr(No) + ')'); - - //Set Description - Descr := Descr + ' (' + InttoStr(No) + ')'; - end; - - SetLength(SoundCard, SC+1); - - SoundCard[SC].Description := Descr; - - //Get Recording Inputs - SCI := 0; - BASS_RecordInit(SC); - - InputName := BASS_RecordGetInputName(SCI); - - SetLength(SoundCard[SC].Input, 1); - SoundCard[SC].Input[SCI].Name := InputName; - - // process each input - while (InputName <> nil) do - begin - Flags := BASS_RecordGetInput(SCI); - if (SCI >= 1) {AND (Flags AND BASS_INPUT_OFF = 0)} then - begin - SetLength(SoundCard[SC].Input, SCI+1); - SoundCard[SC].Input[SCI].Name := InputName; - end; - - //Set Mic Index - if ((Flags and BASS_INPUT_TYPE_MIC) = 1) then - SoundCard[SC].MicInput := SCI; - - Inc(SCI); - InputName := BASS_RecordGetInputName(SCI); - end; - - BASS_RecordFree; - - Inc(SC); - Descr := BASS_RecordGetDeviceDescription(SC); - end; // while -end; - - -end. - - - +unit URecord; + +interface + +{$I switches.inc} + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses Classes, + Math, + SysUtils, + {$IFDEF useBASS} + bass, + {$ENDIF} + UCommon, + UMusic, + UIni; + +type + TSound = class + BufferNew: TMemoryStream; // buffer for newest sample + BufferArray: array[1..4096] of smallint; // (Signal) newest 4096 samples + BufferLong: array of TMemoryStream; // full buffer + + Num: integer; + n: integer; // length of Signal to analyze + + // pitch detection + SzczytJest: boolean; // czy jest szczyt + Szczyt: integer; // pozycja szczytu na osi poziomej + TonDokl: real; // ton aktualnego szczytu + Ton: integer; // ton bez ulamka + TonGamy: integer; // ton w gamie. wartosci: 0-11 + Skala: real; // skala FFT + + // procedures + procedure ProcessNewBuffer; + procedure AnalizujBufor; // use to analyze sound from buffers to get new pitch + procedure AnalizujByAutocorrelation; // we call it to analyze sound by checking Autocorrelation + function AnalyzeAutocorrelationFreq(Freq: real): real; // use this to check one frequency by Autocorrelation + end; + + TSoundCardInput = record + Name: string; + end; + + TSoundCard = record + // here can be the soundcard information - whole database from which user will select recording source + Description: string; + Input: array of TSoundCardInput; + InputSelected: integer; + MicInput: Integer; + + // bass record + BassRecordStream: hStream; + end; + + TRecord = class + SoundCard: array of TSoundCard; + constructor Create; + end; + + smallintarray = array [0..maxInt shr 1-1] of smallInt; + psmallintarray = ^smallintarray; + + // procedures - bass record + function GetMicrophone(handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD): boolean; stdcall; + + +var + Sound: array of TSound; + SoundCard: array of TSoundCard; + Poz: integer; + Recording: TRecord; + +implementation +uses UMain; + +procedure TSound.ProcessNewBuffer; +var + S: integer; + L: integer; + A: integer; +begin + // process BufferArray + S := 0; + L := BufferNew.Size div 2; + if L > n then begin + S := L - n; + L := n; + end; + + // copy to array + for A := L+1 to n do + BufferArray[A-L] := BufferArray[A]; + + BufferNew.Seek(2*S, soBeginning); + BufferNew.ReadBuffer(BufferArray[1+n-L], 2*L); + + // process BufferLong + if Ini.SavePlayback = 1 then + begin + BufferNew.Seek(0, soBeginning); + BufferLong[0].CopyFrom(BufferNew, BufferNew.Size); + end; +end; + +procedure TSound.AnalizujBufor; +begin + AnalizujByAutocorrelation; +end; + +procedure TSound.AnalizujByAutocorrelation; +var + T: integer; // tone + F: real; // freq + Wages: array[0..35] of real; // wages + MaxT: integer; // max tone + MaxW: real; // max wage + V: real; // volume + MaxV: real; // max volume + S: integer; // Signal + Threshold: real; // threshold +begin + SzczytJest := false; + + // find maximum volume of first 1024 words of signal + MaxV := 0; + for S := 1 to 1024 do // 0.5.2: fix. was from 0 to 1023 + begin + V := Abs(BufferArray[S]) / $10000; + + if V > MaxV then + MaxV := V; + end; + + // prepare to analyze + MaxW := 0; + + // analyze all 12 halftones + for T := 0 to 35 do // to 11, then 23, now 35 (for Whitney and my high voice) + begin + F := 130.81*Power(1.05946309436, T)/2; // let's analyze below 130.81 + Wages[T] := AnalyzeAutocorrelationFreq(F); + + if Wages[T] > MaxW then + begin // this frequency has better wage + MaxW := Wages[T]; + MaxT := T; + end; + end; // for T + + Threshold := 0.1; + case Ini.Threshold of + 0: Threshold := 0.05; + 1: Threshold := 0.1; + 2: Threshold := 0.15; + 3: Threshold := 0.2; + end; + + if MaxV >= Threshold then + begin // found acceptable volume // 0.1 + SzczytJest := true; + TonGamy := MaxT mod 12; + Ton := MaxT mod 12; + end; + +end; + +function TSound.AnalyzeAutocorrelationFreq(Freq: real): real; // result medium difference +var + Count: real; + Src: integer; + Dst: integer; + Move: integer; + Il: integer; // how many counts were done +begin + // we use Signal as source + Count := 0; + Il := 0; + Src := 1; + Move := Round(44100/Freq); + Dst := Src + Move; + + // ver 2 - compare in vertical + while (Dst < n) do + begin // process up to n (4KB) of Signal + Count := Count + Abs(BufferArray[Src] - BufferArray[Dst]) / $10000; + Inc(Src); + Inc(Dst); + Inc(Il); + end; + + Result := 1 - Count / Il; +end; + +function GetMicrophone(handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD): boolean; stdcall; +var + L: integer; + S: integer; + PB: pbytearray; + PSI: psmallintarray; + I: integer; + Skip: integer; + P1: integer; + P2: integer; + Boost: byte; +begin + // set boost + case Ini.MicBoost of + 0: Boost := 1; + 1: Boost := 2; + 2: Boost := 4; + 3: Boost := 8; + end; + + // boost buffer + L := Len div 2; // number of samples + PSI := Buffer; + for S := 0 to L-1 do + begin + I := PSI^[S] * Boost; + if I > 32767 then I := 32767; // 0.5.0: limit + if I < -32768 then I := -32768; // 0.5.0: limit + PSI^[S] := I; + end; + + // decode user + P1 := (user and 255) - 1; + P2 := (user div 256) - 1; + + + // 2 players USB mic, left channel + if P1 >= 0 then + begin + L := Len div 4; // number of samples + PB := Buffer; + + Sound[P1].BufferNew.Clear; // 0.5.2: problem on exiting + for S := 1 to L do + begin + Sound[P1].BufferNew.Write(PB[(S-1)*4], 2); + end; + Sound[P1].ProcessNewBuffer; + end; + + // 2 players USB mic, right channel + Skip := 2; + + if P2 >= 0 then + begin + L := Len div 4; // number of samples + PB := Buffer; + Sound[P2].BufferNew.Clear; + for S := 1 to L do + begin + Sound[P2].BufferNew.Write(PB[Skip + (S-1)*4], 2); + end; + Sound[P2].ProcessNewBuffer; + end; + + Result := true; +end; + +constructor TRecord.Create; +var + SC: integer; // soundcard + SCI: integer; // soundcard input + Descr: string; + InputName: PChar; + Flags: integer; + No: integer; + + function isDuplicate(Desc: String): Boolean; + var + I: Integer; + begin + Result := False; + //Check for Soundcard with same Description + For I := 0 to SC-1 do + begin + if (SoundCard[I].Description = Desc) then + begin + Result := True; + Break; + end; + end; + end; + +begin + // TODO : JB_linux - Reimplement recording, without bass for linux + {$IFDEF useBASS} + // checks for recording devices and puts them into array; + SetLength(SoundCard, 0); + + SC := 0; + Descr := BASS_RecordGetDeviceDescription(SC); + + while (Descr <> '') do + begin + + //If there is another SoundCard with the Same ID, Search an available Name + if (IsDuplicate(Descr)) then + begin + No:= 1; //Count of SoundCards with same Name + Repeat + Inc(No) + Until not IsDuplicate(Descr + ' (' + InttoStr(No) + ')'); + + //Set Description + Descr := Descr + ' (' + InttoStr(No) + ')'; + end; + + SetLength(SoundCard, SC+1); + + SoundCard[SC].Description := Descr; + + //Get Recording Inputs + SCI := 0; + BASS_RecordInit(SC); + + InputName := BASS_RecordGetInputName(SCI); + + SetLength(SoundCard[SC].Input, 1); + SoundCard[SC].Input[SCI].Name := InputName; + + // process each input + while (InputName <> nil) do + begin + Flags := BASS_RecordGetInput(SCI); + if (SCI >= 1) {AND (Flags AND BASS_INPUT_OFF = 0)} then + begin + SetLength(SoundCard[SC].Input, SCI+1); + SoundCard[SC].Input[SCI].Name := InputName; + end; + + //Set Mic Index + if ((Flags and BASS_INPUT_TYPE_MIC) = 1) then + SoundCard[SC].MicInput := SCI; + + Inc(SCI); + InputName := BASS_RecordGetInputName(SCI); + end; + + BASS_RecordFree; + + Inc(SC); + Descr := BASS_RecordGetDeviceDescription(SC); + end; // while + {$ENDIF} +end; + + +end. + + + diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 7f0b85c0..1bc4c558 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -1,1028 +1,1043 @@ -unit UTexture; - -// Plain (alpha = 1) -// Transparent -// Transparent Range -// Font (white is drawn, black is transparent) -// Font Outline (Font with darker outline) -// Font Outline 2 (Font with darker outline) -// Font Black (black is drawn, white is transparent) -// Font Gray (gray is drawn, white is transparent) -// Arrow (for arrows, white is white, gray has color, black is transparent); - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -uses OpenGL12, - Windows, - Math, - Classes, - SysUtils, - {$IFDEF FPC} - ulazjpeg, - {$ELSE} - Graphics, - JPEG, - PNGImage, - {$ENDIF} - UCommon, - UThemes; - - -procedure glGenTextures(n: GLsizei; var textures: GLuint); stdcall; external opengl32; - -type - TTexture = record - TexNum: integer; - X: real; - Y: real; - Z: real; // new - W: real; - H: real; - ScaleW: real; // for dynamic scalling while leaving width constant - ScaleH: real; // for dynamic scalling while leaving height constant - Rot: real; // 0 - 2*pi - Int: real; // intensity - ColR: real; - ColG: real; - ColB: real; - TexW: real; // used? - TexH: real; // used? - TexX1: real; - TexY1: real; - TexX2: real; - TexY2: real; - Alpha: real; - Name: string; // 0.5.0: experimental for handling cache images. maybe it's useful for dynamic skins - end; - - TTextureEntry = record - Name: string; - Typ: string; - - // we use normal TTexture, it's easier to implement and if needed - we copy ready data - Texture: TTexture; - TextureCache: TTexture; // 0.5.0 - end; - - TTextureDatabase = record - Texture: array of TTextureEntry; - end; - - TTextureUnit = class - Limit: integer; - CreateCacheMipmap: boolean; - -// function GetNumberFor - function GetTexture(Name, Typ: string): TTexture; overload; - function GetTexture(Name, Typ: string; FromCache: boolean): TTexture; overload; - function FindTexture(Name: string): integer; - function LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; - function LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; - function LoadTexture(Identifier: string): TTexture; overload; - function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; - procedure UnloadTexture(Name: string; FromCache: boolean); - end; - -var - lasthue: double; - Texture: TTextureUnit; - TextureDatabase: TTextureDatabase; - - PrintScreenData: array[0..1024*768-1] of longword; - - ActTex: GLuint;//integer; - - TexOrigW: integer; - TexOrigH: integer; - TexNewW: integer; - TexNewH: integer; - - TexFitW: integer; - TexFitH: integer; // new for limit - - TextureD8: array[1..1024*1024] of byte; // 1MB - TextureD16: array[1..1024*1024, 1..2] of byte; // luminance/alpha tex (2MB) - TextureD24: array[1..1024*1024, 1..3] of byte; // normal 24-bit tex (3MB) - TextureD242: array[1..512*512, 1..3] of byte; // normal 24-bit tex (0,75MB) - TextureD32: array[1..1024*1024, 1..4] of byte; // transparent 32-bit tex (4MB) - // total 40MB at 2048*2048 - // total 10MB at 1024*1024 - - Mipmapping: Boolean; - - CacheMipmap: array[0..256*256*3-1] of byte; // 3KB - - -implementation -uses ULog, DateUtils, UCovers, StrUtils; - -function TTextureUnit.GetTexture(Name, Typ: string): TTexture; -begin - Result := GetTexture(Name, Typ, true); -end; - -function TTextureUnit.GetTexture(Name, Typ: string; FromCache: boolean): TTexture; -var - T: integer; // texture - C: integer; // cover - Data: array of byte; -begin - // find texture entry - T := FindTexture(Name); - - if T = -1 then begin - // create texture entry - T := Length(TextureDatabase.Texture); - SetLength(TextureDatabase.Texture, T+1); - TextureDatabase.Texture[T].Name := Name; - TextureDatabase.Texture[T].Typ := Typ; - - // inform database that no textures have been loaded into memory - TextureDatabase.Texture[T].Texture.TexNum := -1; - TextureDatabase.Texture[T].TextureCache.TexNum := -1; - end; - - // use preloaded texture - if (not FromCache) or (FromCache and not Covers.CoverExists(Name)) then begin - // use full texture - if TextureDatabase.Texture[T].Texture.TexNum = -1 then begin - // load texture - TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', pchar(Typ), $0); - end; - - // use texture - Result := TextureDatabase.Texture[T].Texture; - - end; - - if FromCache and Covers.CoverExists(Name) then begin - // use cache texture - C := Covers.CoverNumber(Name); - - if TextureDatabase.Texture[T].TextureCache.TexNum = -1 then begin - // load texture - Covers.PrepareData(Name); - TextureDatabase.Texture[T].TextureCache := CreateTexture(Covers.Data, Name, Covers.Cover[C].W, Covers.Cover[C].H, 24); - end; - - // use texture - Result := TextureDatabase.Texture[T].TextureCache; - end; -end; - -function TTextureUnit.FindTexture(Name: string): integer; -var - T: integer; // texture -begin - Result := -1; - for T := 0 to high(TextureDatabase.Texture) do - if TextureDatabase.Texture[T].Name = Name then - Result := T; -end; - -// expects: src, dst: pointers to r,g,b,a -// hue: new hue within range [0.0-6.0) -procedure ColorizeCopy(Src, Dst: PByteArray; hue: Double); overload; -var - i,j,k: Cardinal; - clr, hls: array[0..2] of Double; - delta, f, p, q, t: Double; -begin - hls[0]:=hue; - - clr[0] := src[0]/255; - clr[1] := src[1]/255; - clr[2] := src[2]/255; - - //calculate luminance and saturation from rgb - hls[1] := maxvalue(clr); //l:=... - delta := hls[1] - minvalue(clr); - - if hls[1] = 0.0 then - hls[2] := 0.0 - else - hls[2] := delta/hls[1]; //v:=... - - // calc new rgb from our hls (h from color, l ans s from pixel) -// if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense - begin - k:=trunc(hls[0]); - f:=hls[0]-k; - p:=hls[1]*(1.0-hls[2]); - q:=hls[1]*(1.0-(hls[2]*f)); - t:=hls[1]*(1.0-(hls[2]*(1.0-f))); - case k of - 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end; - 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end; - 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end; - 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end; - 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end; - 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; - end; - // and store new rgb back into the image - dst[0]:=floor(255*clr[0]); - dst[1]:=floor(255*clr[1]); - dst[2]:=floor(255*clr[2]); - dst[3]:=src[3]; - end; -end; - -// expects: src: $rrggbb -// dst: pointer to r,g,b,a -// hue: new hue within range [0.0-6.0) -procedure ColorizeCopy(Src: Cardinal; Dst: PByteArray; hue: Double); overload; -var - i,j,k: Cardinal; - clr, hls: array[0..2] of Double; - delta, f, p, q, t: Double; -begin - hls[0]:=hue; - - clr[0]:=((src shr 16) and $ff)/255; - clr[1]:=((src shr 8) and $ff)/255; - clr[2]:=(src and $ff)/255; - //calculate luminance and saturation from rgb - hls[1]:=maxvalue(clr); //l:=... - delta:=hls[1]-minvalue(clr); - if hls[1]=0.0 then hls[2]:=0.0 else hls[2]:=delta/hls[1]; //v:=... - // calc new rgb from our hls (h from color, l ans s from pixel) -// if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense - begin - k:=trunc(hls[0]); - f:=hls[0]-k; - p:=hls[1]*(1.0-hls[2]); - q:=hls[1]*(1.0-(hls[2]*f)); - t:=hls[1]*(1.0-(hls[2]*(1.0-f))); - case k of - 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end; - 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end; - 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end; - 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end; - 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end; - 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; - end; - // and store new rgb back into the image - dst[0]:=floor(255*clr[0]); - dst[1]:=floor(255*clr[1]); - dst[2]:=floor(255*clr[2]); - dst[3]:=255; - end; -end; -//returns hue within range [0.0-6.0) -function col2h(Color:Cardinal):double; -var - clr,hls: array[0..2] of double; - delta: double; -begin - clr[0]:=((Color and $ff0000) shr 16)/255; - clr[1]:=((Color and $ff00) shr 8)/255; - clr[2]:=(Color and $ff)/255; - hls[1]:=maxvalue(clr); - delta:=hls[1]-minvalue(clr); - if clr[0]=hls[1] then hls[0]:=(clr[1]-clr[2])/delta - else if clr[1]=hls[1] then hls[0]:=2.0+(clr[2]-clr[0])/delta - else if clr[2]=hls[1] then hls[0]:=4.0+(clr[0]-clr[1])/delta; - if hls[0]<0.0 then hls[0]:=hls[0]+6.0; - if hls[0]=6.0 then hls[0]:=0.0; - col2h:=hls[0]; -end; - - -function TTextureUnit.LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; -var - Res: TResourceStream; - TextureB: TBitmap; - TextureJ: TJPEGImage; - {$IFNDEF FPC} - TexturePNG: TPNGObject; - {$ENDIF} - - TextureAlpha: array of byte; - AlphaPtr: PByte; - TransparentColor: TColor; - PixelColor: TColor; - - Position: integer; - Position2: integer; - Pix: integer; - ColInt: real; - PPix: PByteArray; - TempA: integer; - Error: integer; - SkipX: integer; - myAlpha: Real; - myRGBABitmap: array of byte; - RGBPtr: PByte; - myHue: Double; -begin - {$IFNDEF FPC} // TODO : JB eeeew this is a nasty one... - // but lazarus implementation scanlines is different :( - // need to implement as per - // http://www.lazarus.freepascal.org/index.php?name=PNphpBB2&file=viewtopic&p=18512 - // http://www.lazarus.freepascal.org/index.php?name=PNphpBB2&file=viewtopic&p=10797 - // http://wiki.lazarus.freepascal.org/Developing_with_Graphics - Log.BenchmarkStart(4); - Mipmapping := true; - - if FromRegistry then begin - try - Res := TResourceStream.Create(HInstance, Identifier, Format); - except - beep; - Exit; - end; - end; - - // filetype "detection" - if (not FromRegistry) and (FileExists(Identifier)) then begin - Format:=''; - Format := PAnsichar(UpperCase(RightStr(ExtractFileExt(Identifier),3))); - end; -// else Format:='JPG'; -// if not ((Format='BMP')or(Format='JPG')or(Format='PNG')) then Format:='JPG'; - - if FromRegistry or ((not FromRegistry) and FileExists(Identifier)) then begin - TextureB := TBitmap.Create; - - if Format = 'BMP' then - begin - if FromRegistry then - TextureB.LoadFromStream(Res) - else - TextureB.LoadFromFile(Identifier); - end - else - if Format = 'JPG' then - begin - TextureJ := TJPEGImage.Create; - - if FromRegistry then - TextureJ.LoadFromStream(Res) - else - begin - if FileExists(Identifier) then - TextureJ.LoadFromFile(Identifier) - else - Exit; - end; - - TextureB.Assign(TextureJ); - TextureJ.Free; - end - else if Format = 'PNG' then - begin - {$IFNDEF FPC} - // TODO : JB - fix this for lazarus.. - TexturePNG := TPNGObject.Create; - if FromRegistry then - TexturePNG.LoadFromStream(Res) - else - begin - if FileExists(Identifier) then - TexturePNG.LoadFromFile(Identifier) - else - Exit; - end; - - TextureB.Assign(TexturePNG); - // transparent png hack start (part 1 of 2) - if ((Typ = 'Transparent') or (Typ = 'Colorized')) and (TexturePNG.TransparencyMode = ptmPartial) then - begin - setlength(TextureAlpha, TextureB.Width*TextureB.Height); - setlength(MyRGBABitmap,TextureB.Width*TextureB.Height*4); - if (TexturePNG.Header.ColorType = COLOR_GRAYSCALEALPHA) or - (TexturePNG.Header.ColorType = COLOR_RGBALPHA) then - begin - // i would have preferred english variables here but i use Position because i'm lazy - for Position := 0 to TextureB.Height - 1 do - begin - AlphaPtr := PByte(TexturePNG.AlphaScanline[Position]); - RGBPtr:=PByte(TexturePNG.Scanline[Position]); - for Position2 := 0 to TextureB.Width - 1 do - begin - TextureAlpha[Position*TextureB.Width+Position2]:= AlphaPtr^; - MyRGBABitmap[(Position*TextureB.Width+Position2)*4]:= RGBPtr^; - Inc(RGBPtr); - MyRGBABitmap[(Position*TextureB.Width+Position2)*4+1]:= RGBPtr^; - Inc(RGBPtr); - MyRGBABitmap[(Position*TextureB.Width+Position2)*4+2]:= RGBPtr^; - Inc(RGBPtr); - MyRGBABitmap[(Position*TextureB.Width+Position2)*4+3]:= AlphaPtr^; -// Inc(RGBPtr); - Inc(AlphaPtr); - end; - end; - end; - end else - setlength(TextureAlpha,0); // just no special transparency for unimplemented transparency types (ptmBit) - // transparent png hack end - TexturePNG.Free; - {$ENDIF} - end; - - if FromRegistry then Res.Free; - - if (TextureB.Width > 1024) or (TextureB.Height > 1024) then begin // will be fixed in 0.5.1 and dynamically extended to 8192x8192 depending on the driver - Log.LogError('Image ' + Identifier + ' is too big (' + IntToStr(TextureB.Width) + 'x' + IntToStr(TextureB.Height) + ')'); - Result.TexNum := -1; - end else begin - - glGenTextures(1, ActTex); - glBindTexture(GL_TEXTURE_2D, ActTex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - if Typ = 'Plain' then begin - // dimensions - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - - // copy and process pixeldata - TextureB.PixelFormat := pf24bit; -{ if (TextureB.PixelFormat = pf8bit) then begin - for Position := 0 to TexOrigH-1 do begin - for Position2 := 0 to TexOrigW-1 do begin - Pix := TextureB.Canvas.Pixels[Position2, Position]; - TextureD24[Position*TexNewW + Position2+1, 1] := Pix; - TextureD24[Position*TexNewW + Position2+1, 2] := Pix div 256; - TextureD24[Position*TexNewW + Position2+1, 3] := Pix div (256*256); - end; - end; - end;} - if (TexOrigW <= Limit) and (TexOrigW <= Limit) then begin - if (TextureB.PixelFormat = pf24bit) then begin - for Position := 0 to TexOrigH-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TexOrigW-1 do begin - TextureD24[Position*TexNewW + Position2+1, 1] := PPix[Position2*3+2]; - TextureD24[Position*TexNewW + Position2+1, 2] := PPix[Position2*3+1]; - TextureD24[Position*TexNewW + Position2+1, 3] := PPix[Position2*3]; - end; - end; - end; - end else begin - // limit - TexFitW := 4 * (TexOrigW div 4); // fix for bug in gluScaleImage - TexFitH := TexOrigH; - if (TextureB.PixelFormat = pf24bit) then begin - for Position := 0 to TexOrigH-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TexOrigW-1 do begin - TextureD24[Position*TexFitW + Position2+1, 1] := PPix[Position2*3+2]; - TextureD24[Position*TexFitW + Position2+1, 2] := PPix[Position2*3+1]; - TextureD24[Position*TexFitW + Position2+1, 3] := PPix[Position2*3]; - end; - end; - end; - gluScaleImage(GL_RGB, TexFitW, TexFitH, GL_UNSIGNED_BYTE, @TextureD24, - Limit, Limit, GL_UNSIGNED_BYTE, @TextureD24); // takes some time - - TexNewW := Limit; - TexNewH := Limit; - TexOrigW := Limit; - TexOrigH := Limit; - end; - - // creating cache mipmap - if CreateCacheMipmap then begin - if (TexOrigW <> TexNewW) or (TexOrigH <> TexNewH) then begin - // texture only uses some of it's space. there's a need for resize to fit full size - // and get best quality - TexFitW := 4 * (TexOrigW div 4); // 0.5.0: fix for bug in gluScaleImage - SkipX := (TexOrigW div 2) mod 2; // 0.5.0: try to center image - - TexFitH := TexOrigH; - for Position := 0 to TexOrigH-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TexOrigW-1 do begin - TextureD242[Position*TexFitW + Position2+1, 1] := PPix[(Position2+SkipX)*3+2]; - TextureD242[Position*TexFitW + Position2+1, 2] := PPix[(Position2+SkipX)*3+1]; - TextureD242[Position*TexFitW + Position2+1, 3] := PPix[(Position2+SkipX)*3]; - end; - end; - gluScaleImage(GL_RGB, TexFitW, TexFitH, GL_UNSIGNED_BYTE, @TextureD242, - Covers.W, Covers.H, GL_UNSIGNED_BYTE, @CacheMipmap[0]); // takes some time - - end else begin - // texture fits perfectly - gluScaleImage(GL_RGB, TexOrigW, TexOrigH, GL_UNSIGNED_BYTE, @TextureD24, - Covers.W, Covers.H, GL_UNSIGNED_BYTE, @CacheMipmap[0]); // takes some time - end; - end; - - glTexImage2D(GL_TEXTURE_2D, 0, 3, TexNewW, TexNewH, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TexNewW, TexNewH, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); - if Error > 0 then beep; - end - end; - - if Typ = 'Transparent' then begin - // dimensions - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - - // copy and process pixeldata - for Position := 0 to TexOrigH-1 do begin - for Position2 := 0 to TexOrigW-1 do begin - Pix := TextureB.Canvas.Pixels[Position2, Position]; - // ,- part of transparent png hack - if ((Pix = $fefefe) or (Pix = Col)) and (length(TextureAlpha)=0) then begin //Small fix, that caused artefacts to be drawn (#fe == dec254) - TextureD32[Position*TexNewW + Position2 + 1, 1] := 0; - TextureD32[Position*TexNewW + Position2 + 1, 2] := 0; - TextureD32[Position*TexNewW + Position2 + 1, 3] := 0; - TextureD32[Position*TexNewW + Position2 + 1, 4] := 0; - end else if (Format = 'PNG') and (length(TextureAlpha) <> 0) then begin - myAlpha:=TextureAlpha[Position*TexOrigW+Position2]; - TextureD32[Position*TexNewW + Position2+1, 1] := MyRGBABitmap[(Position*TexOrigW+Position2)*4+2]; - TextureD32[Position*TexNewW + Position2+1, 2] := MyRGBABitmap[(Position*TexOrigW+Position2)*4+1]; - TextureD32[Position*TexNewW + Position2+1, 3] := MyRGBABitmap[(Position*TexOrigW+Position2)*4]; - TextureD32[Position*TexNewW+Position2+1,4]:=MyRGBABitmap[(Position*TexOrigW+Position2)*4+3]; - end else begin - TextureD32[Position*TexNewW + Position2+1, 1] := (Pix and $ff); - TextureD32[Position*TexNewW + Position2+1, 2] := ((Pix shr 8) and $ff); - TextureD32[Position*TexNewW + Position2+1, 3] := ((Pix shr 16) and $ff); - TextureD32[Position*TexNewW + Position2+1, 4] := 255; - end; - end; - end; - setlength(TextureAlpha,0); - setlength(MyRGBABitmap,0); - glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); -{ if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - if Error > 0 then beep; - end;} - end; - -// The new awesomeness of colorized pngs starts here -// We're the first who had this feature, so give credit when you copy+paste :P - if Typ = 'Colorized' then begin - // dimensions - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - - myHue:=col2h(Col); - // copy and process pixeldata - for Position := 0 to TexOrigH-1 do begin - for Position2 := 0 to TexOrigW-1 do begin - Pix := TextureB.Canvas.Pixels[Position2, Position]; - if (Format = 'PNG') and (length(MyRGBABitmap) <> 0) then - ColorizeCopy(@MyRGBABitmap[(Position*TexOrigW+Position2)*4], - @TextureD32[Position*TexNewW + Position2+1, 1], - myHue) - else - ColorizeCopy(Pix, - @TextureD32[Position*TexNewW + Position2+1, 1], - myHue); - end; - end; - - setlength(TextureAlpha,0); - setlength(MyRGBABitmap,0); - glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; -// eoa COLORIZE - - if Typ = 'Transparent Range' then begin - // dimensions - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TexOrigH-1 do begin - for Position2 := 0 to TexOrigW-1 do begin - Pix := TextureB.Canvas.Pixels[Position2, Position]; - TextureD32[Position*TexNewW + Position2+1, 1] := Pix; - TextureD32[Position*TexNewW + Position2+1, 2] := Pix div 256; - TextureD32[Position*TexNewW + Position2+1, 3] := Pix div (256*256); - TextureD32[Position*TexNewW + Position2+1, 4] := 256 - Pix div 256; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); -{ if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - if Error > 0 then beep; - end;} - end; - - if Typ = 'Font' then begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - TextureD16[Position*TextureB.Width + Position2 + 1, 1] := 255; - TextureD16[Position*TextureB.Width + Position2 + 1, 2] := Pix; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - - if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - if Error > 0 then beep; - end; - end; - - if Typ = 'Font Outline' then begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - - Col := Pix; - if Col < 127 then Col := 127; - - TempA := Pix; - if TempA >= 95 then TempA := 255; - if TempA >= 31 then TempA := 255; - if Pix < 95 then TempA := (Pix * 256) div 96; - - - TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; - TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - - if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - if Error > 0 then beep; - end; - end; - - if Typ = 'Font Outline 2' then begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - - Col := Pix; - if Col < 31 then Col := 31; - - TempA := Pix; - if TempA >= 31 then TempA := 255; - if Pix < 31 then TempA := Pix * (256 div 32); - - TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; - TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - - if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - if Error > 0 then beep; - end; - end; - - if Typ = 'Font Black' then begin - // normalnie 0,125s bez niczego 0,015s - 0,030s z pix 0,125s <-- ??? - // dimensions - TextureB.PixelFormat := pf24bit; - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2*3]; - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; - - if Typ = 'Alpha Black Colored' then begin - TextureB.PixelFormat := pf24bit; - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2*3]; - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := (Col div $10000) and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Col div $100) and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Col and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; - - if Typ = 'Font Gray' then begin - // dimensions - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TextureB.Height-1 do begin - for Position2 := 0 to TextureB.Width-1 do begin - Pix := TextureB.Canvas.Pixels[Position2, Position]; - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 127; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 127; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 127; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); -{ if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - if Error > 0 then beep; - end;} - end; - - if Typ = 'Arrow' then begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - - // transparency - if Pix >= 127 then TempA := 255; - if Pix < 127 then TempA := Pix * 2; - - // ColInt = color intensity - if Pix < 127 then ColInt := 1; - if Pix >= 127 then ColInt := 2 - Pix / 128; - //0.75, 0.6, 0.25 - - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Round(ColInt * 0.75 * 255 + (1 - ColInt) * 255); - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := Round(ColInt * 0.6 * 255 + (1 - ColInt) * 255); - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Round(ColInt * 0.25 * 255 + (1 - ColInt) * 255); - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - - if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - if Error > 0 then beep; - end; - end; - - if Typ = 'Note Plain' then begin - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - - - - // Skin Patch - // 0-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White - case PPix[Position2*3] of - 0..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); - 192: Pix := Col; - 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); - 255: Pix := $FFFFFF; - end; -// 0.5.0. Original -// case PPix[Position2*3] of -// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; -// 192: Pix := Col; -// 255: Pix := $FFFFFF; -// end; - - - - - - TextureD24[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; - TextureD24[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; - TextureD24[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureB.Width, TextureB.Height, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); - end; - - if Typ = 'Note Transparent' then begin - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - TempA := 255; - - - - //Skin Patch - // 0= Transparent, 1-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White - case PPix[Position2*3] of - 0: TempA := 0; - 1..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); - 192: Pix := Col; - 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); - 255: Pix := $FFFFFF; - end; -// 0.5.0 Original -// case PPix[Position2*3] of -// 0: TempA := 0; -// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; -// 192: Pix := Col; -// 255: Pix := $FFFFFF; -// end; - - - - - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; - - TextureB.Free; - Result.X := 0; - Result.Y := 0; - Result.W := 0; - Result.H := 0; - Result.ScaleW := 1; - Result.ScaleH := 1; - Result.Rot := 0; - Result.TexNum := ActTex; - Result.TexW := TexOrigW / TexNewW; - Result.TexH := TexOrigH / TexNewH; - - Result.Int := 1; - Result.ColR := 1; - Result.ColG := 1; - Result.ColB := 1; - Result.Alpha := 1; - - // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these - Result.TexX1 := 0; - Result.TexY1 := 0; - Result.TexX2 := 1; - Result.TexY2 := 1; - - // 0.5.0 - Result.Name := Identifier; - - end; - - Log.BenchmarkEnd(4); - if Log.BenchmarkTimeLength[4] >= 1 then - Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4); - - end; // logerror - {$ENDIF} -end; - -{procedure ResizeTexture(s: pbytearray; d: pbytearray); -var - Position: integer; - Position2: integer; -begin - for Position := 0 to TexNewH*4-1 do - for Position2 := 0 to TexNewW-1 do - d[Position*TexNewW + Position2] := 0; - - for Position := 0 to TexOrigH-1 do begin - for Position2 := 0 to TexOrigW-1 do begin - d[(Position*TexNewW + Position2)*4] := Paleta[s[Position*TexOrigW + Position2], 1]; - d[(Position*TexNewW + Position2)*4+1] := Paleta[s[Position*TexOrigW + Position2], 2]; - d[(Position*TexNewW + Position2)*4+2] := Paleta[s[Position*TexOrigW + Position2], 3]; - d[(Position*TexNewW + Position2)*4+3] := Paleta[s[Position*TexOrigW + Position2], 4]; - end; - end; -end;} - -{procedure SetTexture(p: pointer); -begin - glGenTextures(1, Tekstur); - glBindTexture(GL_TEXTURE_2D, Tekstur); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, p); -end;} - -function TTextureUnit.LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; -begin - Result := LoadTexture(false, Identifier, Format, Typ, Col); -// Result := LoadTexture(SkinReg, Identifier, Format, Typ, Col); // default to SkinReg - -end; - -function TTextureUnit.LoadTexture(Identifier: string): TTexture; -begin - Result := LoadTexture(false, pchar(Identifier), 'JPG', 'Plain', 0); -end; - -function TTextureUnit.CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; -var - Position: integer; - Position2: integer; - Pix: integer; - ColInt: real; - PPix: PByteArray; - TempA: integer; - Error: integer; -begin - Mipmapping := false; - - glGenTextures(1, ActTex); // ActText = new texture number - glBindTexture(GL_TEXTURE_2D, ActTex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - glTexImage2D(GL_TEXTURE_2D, 0, 3, W, H, 0, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, W, H, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); - if Error > 0 then beep; - end; - - Result.X := 0; - Result.Y := 0; - Result.W := 0; - Result.H := 0; - Result.ScaleW := 1; - Result.ScaleH := 1; - Result.Rot := 0; - Result.TexNum := ActTex; - Result.TexW := 1; - Result.TexH := 1; - - Result.Int := 1; - Result.ColR := 1; - Result.ColG := 1; - Result.ColB := 1; - Result.Alpha := 1; - - // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these - Result.TexX1 := 0; - Result.TexY1 := 0; - Result.TexX2 := 1; - Result.TexY2 := 1; - - // 0.5.0 - Result.Name := Name; -end; - -procedure TTextureUnit.UnloadTexture(Name: string; FromCache: boolean); -var - T: integer; - TexNum: GLuint; -begin - T := FindTexture(Name); - - if not FromCache then begin - TexNum := TextureDatabase.Texture[T].Texture.TexNum; - if TexNum >= 0 then begin - glDeleteTextures(1, @TexNum); - TextureDatabase.Texture[T].Texture.TexNum := -1; -// Log.LogError('Unload texture no '+IntToStr(TexNum)); - end; - end else begin - TexNum := TextureDatabase.Texture[T].TextureCache.TexNum; - if TexNum >= 0 then begin - glDeleteTextures(1, @TexNum); - TextureDatabase.Texture[T].TextureCache.TexNum := -1; -// Log.LogError('Unload texture cache no '+IntToStr(TexNum)); - end; - end; -end; - -end. +unit UTexture; + +// Plain (alpha = 1) +// Transparent +// Transparent Range +// Font (white is drawn, black is transparent) +// Font Outline (Font with darker outline) +// Font Outline 2 (Font with darker outline) +// Font Black (black is drawn, white is transparent) +// Font Gray (gray is drawn, white is transparent) +// Arrow (for arrows, white is white, gray has color, black is transparent); + +interface + +{$I switches.inc} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses OpenGL12, + {$IFDEF win32} + windows, + {$ENDIF} + Math, + Classes, + SysUtils, + {$IFDEF FPC} + ulazjpeg, + {$ELSE} + JPEG, + PNGImage, + {$ENDIF} + Graphics, + UCommon, + UThemes; + + + {$IFDEF Win32} + procedure glGenTextures(n: GLsizei; var textures: GLuint); stdcall; external opengl32; + + {$ELSE} + {$ifdef darwin} + const opengl32 = '/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib'; + {$ELSE} + const opengl32 = 'libGL.so' ; // YES Capital GL + {$ENDIF} + + procedure glGenTextures(n: GLsizei; var textures: GLuint); stdcall; external opengl32; + {$ENDIF} + +type + TTexture = record + TexNum: integer; + X: real; + Y: real; + Z: real; // new + W: real; + H: real; + ScaleW: real; // for dynamic scalling while leaving width constant + ScaleH: real; // for dynamic scalling while leaving height constant + Rot: real; // 0 - 2*pi + Int: real; // intensity + ColR: real; + ColG: real; + ColB: real; + TexW: real; // used? + TexH: real; // used? + TexX1: real; + TexY1: real; + TexX2: real; + TexY2: real; + Alpha: real; + Name: string; // 0.5.0: experimental for handling cache images. maybe it's useful for dynamic skins + end; + + TTextureEntry = record + Name: string; + Typ: string; + + // we use normal TTexture, it's easier to implement and if needed - we copy ready data + Texture: TTexture; + TextureCache: TTexture; // 0.5.0 + end; + + TTextureDatabase = record + Texture: array of TTextureEntry; + end; + + TTextureUnit = class + Limit: integer; + CreateCacheMipmap: boolean; + +// function GetNumberFor + function GetTexture(Name, Typ: string): TTexture; overload; + function GetTexture(Name, Typ: string; FromCache: boolean): TTexture; overload; + function FindTexture(Name: string): integer; + function LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; + function LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; + function LoadTexture(Identifier: string): TTexture; overload; + function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; + procedure UnloadTexture(Name: string; FromCache: boolean); + end; + +var + lasthue: double; + Texture: TTextureUnit; + TextureDatabase: TTextureDatabase; + + PrintScreenData: array[0..1024*768-1] of longword; + + ActTex: GLuint;//integer; + + TexOrigW: integer; + TexOrigH: integer; + TexNewW: integer; + TexNewH: integer; + + TexFitW: integer; + TexFitH: integer; // new for limit + + TextureD8: array[1..1024*1024] of byte; // 1MB + TextureD16: array[1..1024*1024, 1..2] of byte; // luminance/alpha tex (2MB) + TextureD24: array[1..1024*1024, 1..3] of byte; // normal 24-bit tex (3MB) + TextureD242: array[1..512*512, 1..3] of byte; // normal 24-bit tex (0,75MB) + TextureD32: array[1..1024*1024, 1..4] of byte; // transparent 32-bit tex (4MB) + // total 40MB at 2048*2048 + // total 10MB at 1024*1024 + + Mipmapping: Boolean; + + CacheMipmap: array[0..256*256*3-1] of byte; // 3KB + + +implementation +uses ULog, DateUtils, UCovers, StrUtils; + +function TTextureUnit.GetTexture(Name, Typ: string): TTexture; +begin + Result := GetTexture(Name, Typ, true); +end; + +function TTextureUnit.GetTexture(Name, Typ: string; FromCache: boolean): TTexture; +var + T: integer; // texture + C: integer; // cover + Data: array of byte; +begin + // find texture entry + T := FindTexture(Name); + + if T = -1 then begin + // create texture entry + T := Length(TextureDatabase.Texture); + SetLength(TextureDatabase.Texture, T+1); + TextureDatabase.Texture[T].Name := Name; + TextureDatabase.Texture[T].Typ := Typ; + + // inform database that no textures have been loaded into memory + TextureDatabase.Texture[T].Texture.TexNum := -1; + TextureDatabase.Texture[T].TextureCache.TexNum := -1; + end; + + // use preloaded texture + if (not FromCache) or (FromCache and not Covers.CoverExists(Name)) then begin + // use full texture + if TextureDatabase.Texture[T].Texture.TexNum = -1 then begin + // load texture + TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', pchar(Typ), $0); + end; + + // use texture + Result := TextureDatabase.Texture[T].Texture; + + end; + + if FromCache and Covers.CoverExists(Name) then begin + // use cache texture + C := Covers.CoverNumber(Name); + + if TextureDatabase.Texture[T].TextureCache.TexNum = -1 then begin + // load texture + Covers.PrepareData(Name); + TextureDatabase.Texture[T].TextureCache := CreateTexture(Covers.Data, Name, Covers.Cover[C].W, Covers.Cover[C].H, 24); + end; + + // use texture + Result := TextureDatabase.Texture[T].TextureCache; + end; +end; + +function TTextureUnit.FindTexture(Name: string): integer; +var + T: integer; // texture +begin + Result := -1; + for T := 0 to high(TextureDatabase.Texture) do + if TextureDatabase.Texture[T].Name = Name then + Result := T; +end; + +// expects: src, dst: pointers to r,g,b,a +// hue: new hue within range [0.0-6.0) +procedure ColorizeCopy(Src, Dst: PByteArray; hue: Double); overload; +var + i,j,k: Cardinal; + clr, hls: array[0..2] of Double; + delta, f, p, q, t: Double; +begin + hls[0]:=hue; + + clr[0] := src[0]/255; + clr[1] := src[1]/255; + clr[2] := src[2]/255; + + //calculate luminance and saturation from rgb + hls[1] := maxvalue(clr); //l:=... + delta := hls[1] - minvalue(clr); + + if hls[1] = 0.0 then + hls[2] := 0.0 + else + hls[2] := delta/hls[1]; //v:=... + + // calc new rgb from our hls (h from color, l ans s from pixel) +// if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense + begin + k:=trunc(hls[0]); + f:=hls[0]-k; + p:=hls[1]*(1.0-hls[2]); + q:=hls[1]*(1.0-(hls[2]*f)); + t:=hls[1]*(1.0-(hls[2]*(1.0-f))); + case k of + 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end; + 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end; + 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end; + 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end; + 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end; + 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; + end; + // and store new rgb back into the image + dst[0]:=floor(255*clr[0]); + dst[1]:=floor(255*clr[1]); + dst[2]:=floor(255*clr[2]); + dst[3]:=src[3]; + end; +end; + +// expects: src: $rrggbb +// dst: pointer to r,g,b,a +// hue: new hue within range [0.0-6.0) +procedure ColorizeCopy(Src: Cardinal; Dst: PByteArray; hue: Double); overload; +var + i,j,k: Cardinal; + clr, hls: array[0..2] of Double; + delta, f, p, q, t: Double; +begin + hls[0]:=hue; + + clr[0]:=((src shr 16) and $ff)/255; + clr[1]:=((src shr 8) and $ff)/255; + clr[2]:=(src and $ff)/255; + //calculate luminance and saturation from rgb + hls[1]:=maxvalue(clr); //l:=... + delta:=hls[1]-minvalue(clr); + if hls[1]=0.0 then hls[2]:=0.0 else hls[2]:=delta/hls[1]; //v:=... + // calc new rgb from our hls (h from color, l ans s from pixel) +// if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense + begin + k:=trunc(hls[0]); + f:=hls[0]-k; + p:=hls[1]*(1.0-hls[2]); + q:=hls[1]*(1.0-(hls[2]*f)); + t:=hls[1]*(1.0-(hls[2]*(1.0-f))); + case k of + 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end; + 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end; + 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end; + 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end; + 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end; + 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; + end; + // and store new rgb back into the image + dst[0]:=floor(255*clr[0]); + dst[1]:=floor(255*clr[1]); + dst[2]:=floor(255*clr[2]); + dst[3]:=255; + end; +end; +//returns hue within range [0.0-6.0) +function col2h(Color:Cardinal):double; +var + clr,hls: array[0..2] of double; + delta: double; +begin + clr[0]:=((Color and $ff0000) shr 16)/255; + clr[1]:=((Color and $ff00) shr 8)/255; + clr[2]:=(Color and $ff)/255; + hls[1]:=maxvalue(clr); + delta:=hls[1]-minvalue(clr); + if clr[0]=hls[1] then hls[0]:=(clr[1]-clr[2])/delta + else if clr[1]=hls[1] then hls[0]:=2.0+(clr[2]-clr[0])/delta + else if clr[2]=hls[1] then hls[0]:=4.0+(clr[0]-clr[1])/delta; + if hls[0]<0.0 then hls[0]:=hls[0]+6.0; + if hls[0]=6.0 then hls[0]:=0.0; + col2h:=hls[0]; +end; + + +function TTextureUnit.LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; +var + Res: TResourceStream; + TextureB: TBitmap; + TextureJ: TJPEGImage; + {$IFNDEF FPC} + TexturePNG: TPNGObject; + {$ENDIF} + + TextureAlpha: array of byte; + AlphaPtr: PByte; + TransparentColor: TColor; + PixelColor: TColor; + + Position: integer; + Position2: integer; + Pix: integer; + ColInt: real; + PPix: PByteArray; + TempA: integer; + Error: integer; + SkipX: integer; + myAlpha: Real; + myRGBABitmap: array of byte; + RGBPtr: PByte; + myHue: Double; +begin + {$IFNDEF FPC} // TODO : JB_lazarus eeeew this is a nasty one... + // but lazarus implementation scanlines is different :( + // need to implement as per + // http://www.lazarus.freepascal.org/index.php?name=PNphpBB2&file=viewtopic&p=18512 + // http://www.lazarus.freepascal.org/index.php?name=PNphpBB2&file=viewtopic&p=10797 + // http://wiki.lazarus.freepascal.org/Developing_with_Graphics + Log.BenchmarkStart(4); + Mipmapping := true; + + if FromRegistry then begin + try + Res := TResourceStream.Create(HInstance, Identifier, Format); + except + beep; + Exit; + end; + end; + + // filetype "detection" + if (not FromRegistry) and (FileExists(Identifier)) then begin + Format:=''; + Format := PAnsichar(UpperCase(RightStr(ExtractFileExt(Identifier),3))); + end; +// else Format:='JPG'; +// if not ((Format='BMP')or(Format='JPG')or(Format='PNG')) then Format:='JPG'; + + if FromRegistry or ((not FromRegistry) and FileExists(Identifier)) then begin + TextureB := TBitmap.Create; + + if Format = 'BMP' then + begin + if FromRegistry then + TextureB.LoadFromStream(Res) + else + TextureB.LoadFromFile(Identifier); + end + else + if Format = 'JPG' then + begin + TextureJ := TJPEGImage.Create; + + if FromRegistry then + TextureJ.LoadFromStream(Res) + else + begin + if FileExists(Identifier) then + TextureJ.LoadFromFile(Identifier) + else + Exit; + end; + + TextureB.Assign(TextureJ); + TextureJ.Free; + end + else if Format = 'PNG' then + begin + {$IFNDEF FPC} + // TODO : JB_lazarus - fix this for lazarus.. + TexturePNG := TPNGObject.Create; + if FromRegistry then + TexturePNG.LoadFromStream(Res) + else + begin + if FileExists(Identifier) then + TexturePNG.LoadFromFile(Identifier) + else + Exit; + end; + + TextureB.Assign(TexturePNG); + // transparent png hack start (part 1 of 2) + if ((Typ = 'Transparent') or (Typ = 'Colorized')) and (TexturePNG.TransparencyMode = ptmPartial) then + begin + setlength(TextureAlpha, TextureB.Width*TextureB.Height); + setlength(MyRGBABitmap,TextureB.Width*TextureB.Height*4); + if (TexturePNG.Header.ColorType = COLOR_GRAYSCALEALPHA) or + (TexturePNG.Header.ColorType = COLOR_RGBALPHA) then + begin + // i would have preferred english variables here but i use Position because i'm lazy + for Position := 0 to TextureB.Height - 1 do + begin + AlphaPtr := PByte(TexturePNG.AlphaScanline[Position]); + RGBPtr:=PByte(TexturePNG.Scanline[Position]); + for Position2 := 0 to TextureB.Width - 1 do + begin + TextureAlpha[Position*TextureB.Width+Position2]:= AlphaPtr^; + MyRGBABitmap[(Position*TextureB.Width+Position2)*4]:= RGBPtr^; + Inc(RGBPtr); + MyRGBABitmap[(Position*TextureB.Width+Position2)*4+1]:= RGBPtr^; + Inc(RGBPtr); + MyRGBABitmap[(Position*TextureB.Width+Position2)*4+2]:= RGBPtr^; + Inc(RGBPtr); + MyRGBABitmap[(Position*TextureB.Width+Position2)*4+3]:= AlphaPtr^; +// Inc(RGBPtr); + Inc(AlphaPtr); + end; + end; + end; + end else + setlength(TextureAlpha,0); // just no special transparency for unimplemented transparency types (ptmBit) + // transparent png hack end + TexturePNG.Free; + {$ENDIF} + end; + + if FromRegistry then Res.Free; + + if (TextureB.Width > 1024) or (TextureB.Height > 1024) then begin // will be fixed in 0.5.1 and dynamically extended to 8192x8192 depending on the driver + Log.LogError('Image ' + Identifier + ' is too big (' + IntToStr(TextureB.Width) + 'x' + IntToStr(TextureB.Height) + ')'); + Result.TexNum := -1; + end else begin + + glGenTextures(1, ActTex); + glBindTexture(GL_TEXTURE_2D, ActTex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + if Typ = 'Plain' then begin + // dimensions + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + + // copy and process pixeldata + TextureB.PixelFormat := pf24bit; +{ if (TextureB.PixelFormat = pf8bit) then begin + for Position := 0 to TexOrigH-1 do begin + for Position2 := 0 to TexOrigW-1 do begin + Pix := TextureB.Canvas.Pixels[Position2, Position]; + TextureD24[Position*TexNewW + Position2+1, 1] := Pix; + TextureD24[Position*TexNewW + Position2+1, 2] := Pix div 256; + TextureD24[Position*TexNewW + Position2+1, 3] := Pix div (256*256); + end; + end; + end;} + if (TexOrigW <= Limit) and (TexOrigW <= Limit) then begin + if (TextureB.PixelFormat = pf24bit) then begin + for Position := 0 to TexOrigH-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TexOrigW-1 do begin + TextureD24[Position*TexNewW + Position2+1, 1] := PPix[Position2*3+2]; + TextureD24[Position*TexNewW + Position2+1, 2] := PPix[Position2*3+1]; + TextureD24[Position*TexNewW + Position2+1, 3] := PPix[Position2*3]; + end; + end; + end; + end else begin + // limit + TexFitW := 4 * (TexOrigW div 4); // fix for bug in gluScaleImage + TexFitH := TexOrigH; + if (TextureB.PixelFormat = pf24bit) then begin + for Position := 0 to TexOrigH-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TexOrigW-1 do begin + TextureD24[Position*TexFitW + Position2+1, 1] := PPix[Position2*3+2]; + TextureD24[Position*TexFitW + Position2+1, 2] := PPix[Position2*3+1]; + TextureD24[Position*TexFitW + Position2+1, 3] := PPix[Position2*3]; + end; + end; + end; + gluScaleImage(GL_RGB, TexFitW, TexFitH, GL_UNSIGNED_BYTE, @TextureD24, + Limit, Limit, GL_UNSIGNED_BYTE, @TextureD24); // takes some time + + TexNewW := Limit; + TexNewH := Limit; + TexOrigW := Limit; + TexOrigH := Limit; + end; + + // creating cache mipmap + if CreateCacheMipmap then begin + if (TexOrigW <> TexNewW) or (TexOrigH <> TexNewH) then begin + // texture only uses some of it's space. there's a need for resize to fit full size + // and get best quality + TexFitW := 4 * (TexOrigW div 4); // 0.5.0: fix for bug in gluScaleImage + SkipX := (TexOrigW div 2) mod 2; // 0.5.0: try to center image + + TexFitH := TexOrigH; + for Position := 0 to TexOrigH-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TexOrigW-1 do begin + TextureD242[Position*TexFitW + Position2+1, 1] := PPix[(Position2+SkipX)*3+2]; + TextureD242[Position*TexFitW + Position2+1, 2] := PPix[(Position2+SkipX)*3+1]; + TextureD242[Position*TexFitW + Position2+1, 3] := PPix[(Position2+SkipX)*3]; + end; + end; + gluScaleImage(GL_RGB, TexFitW, TexFitH, GL_UNSIGNED_BYTE, @TextureD242, + Covers.W, Covers.H, GL_UNSIGNED_BYTE, @CacheMipmap[0]); // takes some time + + end else begin + // texture fits perfectly + gluScaleImage(GL_RGB, TexOrigW, TexOrigH, GL_UNSIGNED_BYTE, @TextureD24, + Covers.W, Covers.H, GL_UNSIGNED_BYTE, @CacheMipmap[0]); // takes some time + end; + end; + + glTexImage2D(GL_TEXTURE_2D, 0, 3, TexNewW, TexNewH, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TexNewW, TexNewH, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); + if Error > 0 then beep; + end + end; + + if Typ = 'Transparent' then begin + // dimensions + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + + // copy and process pixeldata + for Position := 0 to TexOrigH-1 do begin + for Position2 := 0 to TexOrigW-1 do begin + Pix := TextureB.Canvas.Pixels[Position2, Position]; + // ,- part of transparent png hack + if ((Pix = $fefefe) or (Pix = Col)) and (length(TextureAlpha)=0) then begin //Small fix, that caused artefacts to be drawn (#fe == dec254) + TextureD32[Position*TexNewW + Position2 + 1, 1] := 0; + TextureD32[Position*TexNewW + Position2 + 1, 2] := 0; + TextureD32[Position*TexNewW + Position2 + 1, 3] := 0; + TextureD32[Position*TexNewW + Position2 + 1, 4] := 0; + end else if (Format = 'PNG') and (length(TextureAlpha) <> 0) then begin + myAlpha:=TextureAlpha[Position*TexOrigW+Position2]; + TextureD32[Position*TexNewW + Position2+1, 1] := MyRGBABitmap[(Position*TexOrigW+Position2)*4+2]; + TextureD32[Position*TexNewW + Position2+1, 2] := MyRGBABitmap[(Position*TexOrigW+Position2)*4+1]; + TextureD32[Position*TexNewW + Position2+1, 3] := MyRGBABitmap[(Position*TexOrigW+Position2)*4]; + TextureD32[Position*TexNewW+Position2+1,4]:=MyRGBABitmap[(Position*TexOrigW+Position2)*4+3]; + end else begin + TextureD32[Position*TexNewW + Position2+1, 1] := (Pix and $ff); + TextureD32[Position*TexNewW + Position2+1, 2] := ((Pix shr 8) and $ff); + TextureD32[Position*TexNewW + Position2+1, 3] := ((Pix shr 16) and $ff); + TextureD32[Position*TexNewW + Position2+1, 4] := 255; + end; + end; + end; + setlength(TextureAlpha,0); + setlength(MyRGBABitmap,0); + glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); +{ if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + if Error > 0 then beep; + end;} + end; + +// The new awesomeness of colorized pngs starts here +// We're the first who had this feature, so give credit when you copy+paste :P + if Typ = 'Colorized' then begin + // dimensions + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + + myHue:=col2h(Col); + // copy and process pixeldata + for Position := 0 to TexOrigH-1 do begin + for Position2 := 0 to TexOrigW-1 do begin + Pix := TextureB.Canvas.Pixels[Position2, Position]; + if (Format = 'PNG') and (length(MyRGBABitmap) <> 0) then + ColorizeCopy(@MyRGBABitmap[(Position*TexOrigW+Position2)*4], + @TextureD32[Position*TexNewW + Position2+1, 1], + myHue) + else + ColorizeCopy(Pix, + @TextureD32[Position*TexNewW + Position2+1, 1], + myHue); + end; + end; + + setlength(TextureAlpha,0); + setlength(MyRGBABitmap,0); + glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; +// eoa COLORIZE + + if Typ = 'Transparent Range' then begin + // dimensions + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TexOrigH-1 do begin + for Position2 := 0 to TexOrigW-1 do begin + Pix := TextureB.Canvas.Pixels[Position2, Position]; + TextureD32[Position*TexNewW + Position2+1, 1] := Pix; + TextureD32[Position*TexNewW + Position2+1, 2] := Pix div 256; + TextureD32[Position*TexNewW + Position2+1, 3] := Pix div (256*256); + TextureD32[Position*TexNewW + Position2+1, 4] := 256 - Pix div 256; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); +{ if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + if Error > 0 then beep; + end;} + end; + + if Typ = 'Font' then begin + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := 255; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := Pix; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + if Error > 0 then beep; + end; + end; + + if Typ = 'Font Outline' then begin + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + Col := Pix; + if Col < 127 then Col := 127; + + TempA := Pix; + if TempA >= 95 then TempA := 255; + if TempA >= 31 then TempA := 255; + if Pix < 95 then TempA := (Pix * 256) div 96; + + + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + if Error > 0 then beep; + end; + end; + + if Typ = 'Font Outline 2' then begin + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + Col := Pix; + if Col < 31 then Col := 31; + + TempA := Pix; + if TempA >= 31 then TempA := 255; + if Pix < 31 then TempA := Pix * (256 div 32); + + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + if Error > 0 then beep; + end; + end; + + if Typ = 'Font Black' then begin + // normalnie 0,125s bez niczego 0,015s - 0,030s z pix 0,125s <-- ??? + // dimensions + TextureB.PixelFormat := pf24bit; + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2*3]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + if Typ = 'Alpha Black Colored' then begin + TextureB.PixelFormat := pf24bit; + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2*3]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := (Col div $10000) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Col div $100) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Col and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + if Typ = 'Font Gray' then begin + // dimensions + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + for Position2 := 0 to TextureB.Width-1 do begin + Pix := TextureB.Canvas.Pixels[Position2, Position]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); +{ if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + if Error > 0 then beep; + end;} + end; + + if Typ = 'Arrow' then begin + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + // transparency + if Pix >= 127 then TempA := 255; + if Pix < 127 then TempA := Pix * 2; + + // ColInt = color intensity + if Pix < 127 then ColInt := 1; + if Pix >= 127 then ColInt := 2 - Pix / 128; + //0.75, 0.6, 0.25 + + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Round(ColInt * 0.75 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := Round(ColInt * 0.6 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Round(ColInt * 0.25 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + if Error > 0 then beep; + end; + end; + + if Typ = 'Note Plain' then begin + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + + + + // Skin Patch + // 0-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White + case PPix[Position2*3] of + 0..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); + 192: Pix := Col; + 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); + 255: Pix := $FFFFFF; + end; +// 0.5.0. Original +// case PPix[Position2*3] of +// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; +// 192: Pix := Col; +// 255: Pix := $FFFFFF; +// end; + + + + + + TextureD24[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; + TextureD24[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; + TextureD24[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureB.Width, TextureB.Height, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); + end; + + if Typ = 'Note Transparent' then begin + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + TempA := 255; + + + + //Skin Patch + // 0= Transparent, 1-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White + case PPix[Position2*3] of + 0: TempA := 0; + 1..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); + 192: Pix := Col; + 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); + 255: Pix := $FFFFFF; + end; +// 0.5.0 Original +// case PPix[Position2*3] of +// 0: TempA := 0; +// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; +// 192: Pix := Col; +// 255: Pix := $FFFFFF; +// end; + + + + + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + TextureB.Free; + Result.X := 0; + Result.Y := 0; + Result.W := 0; + Result.H := 0; + Result.ScaleW := 1; + Result.ScaleH := 1; + Result.Rot := 0; + Result.TexNum := ActTex; + Result.TexW := TexOrigW / TexNewW; + Result.TexH := TexOrigH / TexNewH; + + Result.Int := 1; + Result.ColR := 1; + Result.ColG := 1; + Result.ColB := 1; + Result.Alpha := 1; + + // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these + Result.TexX1 := 0; + Result.TexY1 := 0; + Result.TexX2 := 1; + Result.TexY2 := 1; + + // 0.5.0 + Result.Name := Identifier; + + end; + + Log.BenchmarkEnd(4); + if Log.BenchmarkTimeLength[4] >= 1 then + Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4); + + end; // logerror + {$ENDIF} +end; + +{procedure ResizeTexture(s: pbytearray; d: pbytearray); +var + Position: integer; + Position2: integer; +begin + for Position := 0 to TexNewH*4-1 do + for Position2 := 0 to TexNewW-1 do + d[Position*TexNewW + Position2] := 0; + + for Position := 0 to TexOrigH-1 do begin + for Position2 := 0 to TexOrigW-1 do begin + d[(Position*TexNewW + Position2)*4] := Paleta[s[Position*TexOrigW + Position2], 1]; + d[(Position*TexNewW + Position2)*4+1] := Paleta[s[Position*TexOrigW + Position2], 2]; + d[(Position*TexNewW + Position2)*4+2] := Paleta[s[Position*TexOrigW + Position2], 3]; + d[(Position*TexNewW + Position2)*4+3] := Paleta[s[Position*TexOrigW + Position2], 4]; + end; + end; +end;} + +{procedure SetTexture(p: pointer); +begin + glGenTextures(1, Tekstur); + glBindTexture(GL_TEXTURE_2D, Tekstur); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, p); +end;} + +function TTextureUnit.LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; +begin + Result := LoadTexture(false, Identifier, Format, Typ, Col); +// Result := LoadTexture(SkinReg, Identifier, Format, Typ, Col); // default to SkinReg + +end; + +function TTextureUnit.LoadTexture(Identifier: string): TTexture; +begin + Result := LoadTexture(false, pchar(Identifier), 'JPG', 'Plain', 0); +end; + +function TTextureUnit.CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; +var + Position: integer; + Position2: integer; + Pix: integer; + ColInt: real; + PPix: PByteArray; + TempA: integer; + Error: integer; +begin + Mipmapping := false; + + glGenTextures(1, ActTex); // ActText = new texture number + glBindTexture(GL_TEXTURE_2D, ActTex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + glTexImage2D(GL_TEXTURE_2D, 0, 3, W, H, 0, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, W, H, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); + if Error > 0 then beep; + end; + + Result.X := 0; + Result.Y := 0; + Result.W := 0; + Result.H := 0; + Result.ScaleW := 1; + Result.ScaleH := 1; + Result.Rot := 0; + Result.TexNum := ActTex; + Result.TexW := 1; + Result.TexH := 1; + + Result.Int := 1; + Result.ColR := 1; + Result.ColG := 1; + Result.ColB := 1; + Result.Alpha := 1; + + // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these + Result.TexX1 := 0; + Result.TexY1 := 0; + Result.TexX2 := 1; + Result.TexY2 := 1; + + // 0.5.0 + Result.Name := Name; +end; + +procedure TTextureUnit.UnloadTexture(Name: string; FromCache: boolean); +var + T: integer; + TexNum: GLuint; +begin + T := FindTexture(Name); + + if not FromCache then begin + TexNum := TextureDatabase.Texture[T].Texture.TexNum; + if TexNum >= 0 then begin + glDeleteTextures(1, @TexNum); + TextureDatabase.Texture[T].Texture.TexNum := -1; +// Log.LogError('Unload texture no '+IntToStr(TexNum)); + end; + end else begin + TexNum := TextureDatabase.Texture[T].TextureCache.TexNum; + if TexNum >= 0 then begin + glDeleteTextures(1, @TexNum); + TextureDatabase.Texture[T].TextureCache.TexNum := -1; +// Log.LogError('Unload texture cache no '+IntToStr(TexNum)); + end; + end; +end; + +end. diff --git a/Game/Code/Classes/UTime.pas b/Game/Code/Classes/UTime.pas index 29e972ae..87d4f922 100644 --- a/Game/Code/Classes/UTime.pas +++ b/Game/Code/Classes/UTime.pas @@ -1,81 +1,131 @@ -unit UTime; - -interface - -type - TTime = class - constructor Create; - function GetTime: real; - end; - -procedure CountSkipTimeSet; -procedure CountSkipTime; -procedure CountMidTime; -procedure TimeSleep(ms: real); - -var - USTime: TTime; - - TimeFreq: int64; - TimeNew: int64; - TimeOld: int64; - TimeSkip: real; - TimeMid: real; - TimeMidTemp: int64; - -implementation - -uses Windows; - -constructor TTime.Create; -begin - CountSkipTimeSet; -end; - -procedure CountSkipTimeSet; -begin - QueryPerformanceFrequency(TimeFreq); - QueryPerformanceCounter(TimeNew); -end; - -procedure CountSkipTime; -begin - TimeOld := TimeNew; - QueryPerformanceCounter(TimeNew); - TimeSkip := (TimeNew-TimeOld)/TimeFreq; -end; - -procedure CountMidTime; -begin - QueryPerformanceCounter(TimeMidTemp); - TimeMid := (TimeMidTemp-TimeNew)/TimeFreq; -end; - -procedure TimeSleep(ms: real); -var - TimeStart: int64; - TimeHalf: int64; - Time: real; - Stop: boolean; -begin - QueryPerformanceCounter(TimeStart); - - Stop := false; - while (not Stop) do begin - QueryPerformanceCounter(TimeHalf); - Time := 1000 * (TimeHalf-TimeStart)/TimeFreq; - if Time > ms then Stop := true; - end; - -end; - -function TTime.GetTime: real; -var - TimeTemp: int64; -begin - QueryPerformanceCounter(TimeTemp); - Result := TimeTemp/TimeFreq; -end; - - -end. +unit UTime; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +type + TTime = class + constructor Create; + function GetTime: real; + end; + +procedure CountSkipTimeSet; +procedure CountSkipTime; +procedure CountMidTime; +procedure TimeSleep(ms: real); + +var + USTime: TTime; + + TimeFreq: int64; + TimeNew: int64; + TimeOld: int64; + TimeSkip: real; + TimeMid: real; + TimeMidTemp: int64; + +implementation + +uses + {$IFDEF win32} + windows, + {$ELSE} + libc, + time, + {$ENDIF} + ucommon; + + +// -- ON Linux it MAY Be better to use ... clock_gettime() instead of CurrentSec100OfDay +// who knows how fast or slow that function is ! +// but this gets a compile for now .. :) + +constructor TTime.Create; +begin + CountSkipTimeSet; +end; + +procedure CountSkipTimeSet; +begin + {$IFDEF win32} + QueryPerformanceFrequency(TimeFreq); + QueryPerformanceCounter(TimeNew); + {$ELSE} + TimeNew := CurrentSec100OfDay(); // TODO - JB_Linux will prob need looking at + TimeFreq := 0; + {$ENDIF} +end; + +procedure CountSkipTime; +begin + TimeOld := TimeNew; + + {$IFDEF win32} + QueryPerformanceCounter(TimeNew); + {$ELSE} + TimeNew := CurrentSec100OfDay(); // TODO - JB_Linux will prob need looking at + {$ENDIF} + + TimeSkip := (TimeNew-TimeOld)/TimeFreq; +end; + +procedure CountMidTime; +begin + {$IFDEF win32} + QueryPerformanceCounter(TimeMidTemp); + TimeMid := (TimeMidTemp-TimeNew)/TimeFreq; + {$ELSE} + TimeMidTemp := CurrentSec100OfDay(); + TimeMid := (TimeMidTemp-TimeNew); // TODO - JB_Linux will prob need looking at + {$ENDIF} +end; + +procedure TimeSleep(ms: real); +var + TimeStart: int64; + TimeHalf: int64; + Time: real; + Stop: boolean; +begin + {$IFDEF win32} + QueryPerformanceCounter(TimeStart); + {$ELSE} + TimeStart := CurrentSec100OfDay(); // TODO - JB_Linux will prob need looking at + {$ENDIF} + + + Stop := false; + while (not Stop) do + begin + {$IFDEF win32} + QueryPerformanceCounter(TimeHalf); + Time := 1000 * (TimeHalf-TimeStart)/TimeFreq; + {$ELSE} + TimeHalf := CurrentSec100OfDay(); + Time := 1000 * (TimeHalf-TimeStart); // TODO - JB_Linux will prob need looking at + {$ENDIF} + + if Time > ms then + Stop := true; + end; + +end; + +function TTime.GetTime: real; +var + TimeTemp: int64; +begin + {$IFDEF win32} + QueryPerformanceCounter(TimeTemp); + Result := TimeTemp / TimeFreq; + {$ELSE} + TimeTemp := CurrentSec100OfDay(); + Result := TimeTemp; // TODO - JB_Linux will prob need looking at + {$ENDIF} +end; + + +end. diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index ed65d62d..6181fab1 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -1,460 +1,469 @@ -unit UDisplay; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -uses Windows, - SDL, - UMenu, - OpenGL12, - SysUtils; - -type - TDisplay = class - ActualScreen: PMenu; - NextScreen: PMenu; - - //fade-to-black-hack - BlackScreen: Boolean; - //popup hack - NextScreenWithCheck: Pmenu; - CheckOK: Boolean; - - h_DC: HDC; - h_RC: HGLRC; - - Fade: Real; - // fade-mod - doFade: Boolean; - canFade: Boolean; - myFade: integer; - lastTime: Cardinal; - pTexData : Pointer; - pTex : array[1..2] of glUInt; - // end - - //FPS Counter - FPSCounter: Cardinal; - LastFPS: Cardinal; - NextFPSSwap:Cardinal; - - //For Debug OSD - OSD_LastError: String; - - function Draw: Boolean; - procedure PrintScreen; - constructor Create; - // fade mod - destructor Destroy; override; - // end - procedure ScreenShot; - - procedure DrawDebugInformation; - end; - -var - Display: TDisplay; - -implementation - -uses - {$IFDEF FPC} - ulazjpeg, - {$ELSE} - JPEG, - {$ENDIF} - graphics, - TextGL, - // UFiles, - UMain, - UTexture, - UIni, - UGraphic, - UTime, - UCommandLine; - -constructor TDisplay.Create; -var i: integer; -begin - inherited Create; - - //popup hack - CheckOK:=False; - NextScreen:=NIL; - NextScreenWithCheck:=NIL; - BlackScreen:=False; - - // fade mod - myfade:=0; - - if Ini.ScreenFade=1 then - doFade:=True - else - doFade:=False; - - canFade:=True; - // generate texture for fading between screens - GetMem(pTexData, 512*512*4); - if pTexData <> NIL then - for i:= 1 to 2 do - begin - glGenTextures(1, pTex[i]); - if glGetError <> GL_NO_ERROR then canFade := False; - glBindTexture(GL_TEXTURE_2D, pTex[i]); - if glGetError <> GL_NO_ERROR then canFade := False; - glTexImage2D(GL_TEXTURE_2D, 0, 4, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, pTexData); - if glGetError <> GL_NO_ERROR then canFade := False; - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - if glGetError <> GL_NO_ERROR then canFade := False; - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - if glGetError <> GL_NO_ERROR then canFade := False; - end - else - begin - canFade:=False; - end; - FreeMem(pTexData); - // end - - //Set LastError for OSD to No Error - OSD_LastError := 'No Errors'; -end; - -// fade mod -destructor TDisplay.Destroy; -begin - if canFade then - glDeleteTextures(1,@pTex); - inherited Destroy; -end; -// end - -function TDisplay.Draw: Boolean; -var - S: integer; - Col: Real; - // fade mod - myFade2: Real; - currentTime: Cardinal; - glError: glEnum; - glErrorStr: String; - // end -begin - Result := True; - - Col := 1; - {if (ParamStr(1) = '-black') or (ParamStr(1) = '-fsblack') then - Col := 0; } - - glClearColor(Col, Col, Col , 0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - - for S := 1 to Screens do begin - ScreenAct := S; - -// if Screens = 1 then ScreenX := 0; -// if (Screens = 2) and (S = 1) then ScreenX := -1; -// if (Screens = 2) and (S = 2) then ScreenX := 1; - ScreenX := 0; - - if S = 2 then TimeSkip := 0 else; - glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); - - //popup hack - // check was successful... move on - if CheckOK then - if assigned (NextScreenWithCheck)then - begin - NextScreen:=NextScreenWithCheck; - NextScreenWithCheck := NIL; - CheckOk:=False; - end - else - BlackScreen:=True; // end of game - fade to black before exit - //end popup hack - -// ActualScreen.SetAnimationProgress(1); - if (not assigned (NextScreen)) and (not BlackScreen) then begin - ActualScreen.Draw; - //popup mod - if ScreenPopupError <> NIL then if ScreenPopupError.Visible then ScreenPopupError.Draw else - if ScreenPopupCheck <> NIL then if ScreenPopupCheck.Visible then ScreenPopupCheck.Draw; - //popup end - // fade mod - myfade:=0; - if (Ini.ScreenFade=1) and canFade then - doFade:=True - else if Ini.ScreenFade=0 then - doFade:=False; - // end - end - else - begin - // check if we had an initialization error (canfade=false, dofade=true) - if doFade and not canFade then begin - doFade:=False; //disable fading -// ScreenPopupError.ShowPopup('Error initializing\nfade texture\n\nfading\ndisabled'); //show error message - end; - if doFade and canFade then - begin - // fade mod - //Create Fading texture if we're just starting - if myfade = 0 then - begin - glViewPort(0, 0, 512, 512); - ActualScreen.Draw; - glBindTexture(GL_TEXTURE_2D, pTex[S]); - glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 512, 512, 0); - glError:=glGetError; - if glError <> GL_NO_ERROR then - begin - canFade := False; - case glError of - GL_INVALID_ENUM: glErrorStr:='INVALID_ENUM'; - GL_INVALID_VALUE: glErrorStr:='INVALID_VALUE'; - GL_INVALID_OPERATION: glErrorStr:='INVALID_OPERATION'; - GL_STACK_OVERFLOW: glErrorStr:='STACK_OVERFLOW'; - GL_STACK_UNDERFLOW: glErrorStr:='STACK_UNDERFLOW'; - GL_OUT_OF_MEMORY: glErrorStr:='OUT_OF_MEMORY'; - else glErrorStr:='unknown error'; - end; -// ScreenPopupError.ShowPopup('Error copying\nfade texture\n('+glErrorStr+')\nfading\ndisabled'); //show error message - end; - glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); - // blackscreen-hack - if not BlackScreen then - NextScreen.onShow; - lastTime:=GetTickCount; - if (S=2) or (Screens = 1) then - myfade:=myfade+1; - end; // end texture creation in first fading step - - //do some time-based fading - currentTime:=GetTickCount; - if (currentTime > lastTime+30) and (S=1) then - begin - myfade:=myfade+4; - lastTime:=currentTime; - end; - -// LastFade := Fade; // whatever -// Fade := Fade -0.999; // start fading out - - -// ActualScreen.ShowFinish := false; // no purpose? - -// ActualScreen.SetAnimationProgress(Fade-1); // nop? - - // blackscreen-hack - if not BlackScreen then - NextScreen.Draw // draw next screen - else if ScreenAct=1 then begin - glClearColor(0, 0, 0 , 0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - end; - - // and draw old screen over it... slowly fading out - myfade2:=(myfade*myfade)/10000; - glBindTexture(GL_TEXTURE_2D, pTex[S]); - glColor4f(1, 1, 1, (1000-myfade*myfade)/1000); // strange calculation - alpha gets negative... but looks good this way - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glTexCoord2f(0+myfade2,0+myfade2);glVertex2f(0, 600); - glTexCoord2f(0+myfade2,1-myfade2);glVertex2f(0, 0); - glTexCoord2f(1-myfade2,1-myfade2);glVertex2f(800, 0); - glTexCoord2f(1-myfade2,0+myfade2);glVertex2f(800, 600); - glEnd; - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - end - else - // blackscreen hack - if not BlackScreen then - NextScreen.OnShow; - - - if ((myfade > 40) or (not doFade) or (not canFade)) And (S = 1) then begin // fade out complete... - myFade:=0; - ActualScreen.onHide; - ActualScreen.ShowFinish:=False; - ActualScreen:=NextScreen; - NextScreen := nil; - if not blackscreen then - begin - ActualScreen.onShowFinish; - ActualScreen.ShowFinish := true; - end - else - begin - Result:=False; - Break; - end; - // end of fade mod - end; - end; // if - - //Draw OSD only on first Screen if Debug Mode is enabled - if ((Ini.Debug = 1) OR (Params.Debug)) AND (S=1) then - DrawDebugInformation; - - end; // for -// SwapBuffers(h_DC); -end; - -{function TDisplay.Fade(FadeIn : Boolean; Steps : UInt8): UInt8; -begin - Self.FadeIn := FadeIn; - FadeStep := (SizeOf(FadeStep) * $FF) div Steps; - ActualStep := $FF; - Result := $FF div FadeStep; -end;} - -procedure TDisplay.PrintScreen; -var - Bitmap: TBitmap; - Jpeg: TJpegImage; - X, Y: integer; - Num: integer; - FileName: string; -begin - for Num := 1 to 9999 do begin - FileName := IntToStr(Num); - while Length(FileName) < 4 do FileName := '0' + FileName; - FileName := ScreenshotsPath + 'screenshot' + FileName + '.jpg'; - if not FileExists(FileName) then break - end; - - glReadPixels(0, 0, ScreenW, ScreenH, GL_RGBA, GL_UNSIGNED_BYTE, @PrintScreenData[0]); - Bitmap := TBitmap.Create; - Bitmap.Width := ScreenW; - Bitmap.Height := ScreenH; - - for Y := 0 to ScreenH-1 do - for X := 0 to ScreenW-1 do - Bitmap.Canvas.Pixels[X, Y] := PrintScreenData[(ScreenH-1-Y) * ScreenW + X] and $00FFFFFF; - - Jpeg := TJpegImage.Create; - Jpeg.Assign(Bitmap); - Bitmap.Free; - Jpeg.CompressionQuality := 95;//90; - Jpeg.SaveToFile(FileName); - Jpeg.Free; -end; - -procedure TDisplay.ScreenShot; - var F : file; - FileInfo: BITMAPINFOHEADER; - FileHeader : BITMAPFILEHEADER; - pPicData:Pointer; - FileName: String; - Num: Integer; -begin - //bilddatei Suchen - for Num := 1 to 9999 do begin - FileName := IntToStr(Num); - while Length(FileName) < 4 do FileName := '0' + FileName; - FileName := ScreenshotsPath + FileName + '.BMP'; - if not FileExists(FileName) then break - end; - - //Speicher für die Speicherung der Header-Informationen vorbereiten - ZeroMemory(@FileHeader, SizeOf(BITMAPFILEHEADER)); - ZeroMemory(@FileInfo, SizeOf(BITMAPINFOHEADER)); - - //Initialisieren der Daten des Headers - FileHeader.bfType := 19778; //$4D42 = 'BM' - FileHeader.bfOffBits := SizeOf(BITMAPINFOHEADER)+SizeOf(BITMAPFILEHEADER); - - //Schreiben der Bitmap-Informationen - FileInfo.biSize := SizeOf(BITMAPINFOHEADER); - FileInfo.biWidth := ScreenW; - FileInfo.biHeight := ScreenH; - FileInfo.biPlanes := 1; - FileInfo.biBitCount := 32; - FileInfo.biSizeImage := FileInfo.biWidth*FileInfo.biHeight*(FileInfo.biBitCount div 8); - - //Größenangabe auch in den Header übernehmen - FileHeader.bfSize := FileHeader.bfOffBits + FileInfo.biSizeImage; - - //Speicher für die Bilddaten reservieren - GetMem(pPicData, FileInfo.biSizeImage); - try - //Bilddaten von OpenGL anfordern (siehe oben) - glReadPixels(0, 0, ScreenW, ScreenH, GL_BGRA, GL_UNSIGNED_BYTE, pPicData); - - //Und den ganzen Müll in die Datei schieben ;-) - //Moderne Leute nehmen dafür auch Streams ... - AssignFile(f, Filename); - Rewrite( f,1 ); - try - BlockWrite(F, FileHeader, SizeOf(BITMAPFILEHEADER)); - BlockWrite(F, FileInfo, SizeOf(BITMAPINFOHEADER)); - BlockWrite(F, pPicData^, FileInfo.biSizeImage ); - finally - CloseFile(f); - end; - finally - //Und den angeforderten Speicher wieder freigeben ... - FreeMem(pPicData, FileInfo.biSizeImage); - end; -end; - -//------------ -// DrawDebugInformation - Procedure draw FPS and some other Informations on Screen -//------------ -procedure TDisplay.DrawDebugInformation; -var Ticks: Cardinal; -begin - //Some White Background for information - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - glColor4f(1, 1, 1, 0.5); - glBegin(GL_QUADS); - glVertex2f(690, 44); - glVertex2f(690, 0); - glVertex2f(800, 0); - glVertex2f(800, 44); - glEnd; - glDisable(GL_BLEND); - - //Set Font Specs - SetFontStyle(0); - SetFontSize(7); - SetFontItalic(False); - glColor4f(0, 0, 0, 1); - - //Calculate FPS - Ticks := GetTickCount; - if (Ticks >= NextFPSSwap) then - begin - LastFPS := FPSCounter * 4; - FPSCounter := 0; - NextFPSSwap := Ticks + 250; - end; - - Inc(FPSCounter); - - //Draw Text - - //FPS - SetFontPos(695, 0); - glPrint (PChar('FPS: ' + InttoStr(LastFPS))); - - //RSpeed - SetFontPos(695, 13); - glPrint (PChar('RSpeed: ' + InttoStr(Round(1000 * TimeMid)))); - - //LastError - SetFontPos(695, 26); - glColor4f(1, 0, 0, 1); - glPrint (PChar(OSD_LastError)); - - glColor4f(1, 1, 1, 1); -end; - -end. +unit UDisplay; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses {$IFDEF win32} + windows, + {$ELSE} + LCLType, + {$ENDIF} + ucommon, + SDL, + UMenu, + OpenGL12, + SysUtils; + +type + TDisplay = class + ActualScreen: PMenu; + NextScreen: PMenu; + + //fade-to-black-hack + BlackScreen: Boolean; + //popup hack + NextScreenWithCheck: Pmenu; + CheckOK: Boolean; + + h_DC: HDC; + h_RC: HGLRC; + + Fade: Real; + // fade-mod + doFade: Boolean; + canFade: Boolean; + myFade: integer; + lastTime: Cardinal; + pTexData : Pointer; + pTex : array[1..2] of glUInt; + // end + + //FPS Counter + FPSCounter: Cardinal; + LastFPS: Cardinal; + NextFPSSwap:Cardinal; + + //For Debug OSD + OSD_LastError: String; + + function Draw: Boolean; + procedure PrintScreen; + constructor Create; + // fade mod + destructor Destroy; override; + // end + procedure ScreenShot; + + procedure DrawDebugInformation; + end; + +var + Display: TDisplay; + +implementation + +uses + {$IFDEF FPC} + ulazjpeg, + {$ELSE} + JPEG, + {$ENDIF} + {$IFNDEF win32} + lclintf, + {$ENDIF} + graphics, + TextGL, + // UFiles, + UMain, + UTexture, + UIni, + UGraphic, + UTime, + UCommandLine; + +constructor TDisplay.Create; +var i: integer; +begin + inherited Create; + + //popup hack + CheckOK:=False; + NextScreen:=NIL; + NextScreenWithCheck:=NIL; + BlackScreen:=False; + + // fade mod + myfade:=0; + + if Ini.ScreenFade=1 then + doFade:=True + else + doFade:=False; + + canFade:=True; + // generate texture for fading between screens + GetMem(pTexData, 512*512*4); + if pTexData <> NIL then + for i:= 1 to 2 do + begin + glGenTextures(1, pTex[i]); + if glGetError <> GL_NO_ERROR then canFade := False; + glBindTexture(GL_TEXTURE_2D, pTex[i]); + if glGetError <> GL_NO_ERROR then canFade := False; + glTexImage2D(GL_TEXTURE_2D, 0, 4, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, pTexData); + if glGetError <> GL_NO_ERROR then canFade := False; + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + if glGetError <> GL_NO_ERROR then canFade := False; + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + if glGetError <> GL_NO_ERROR then canFade := False; + end + else + begin + canFade:=False; + end; + FreeMem(pTexData); + // end + + //Set LastError for OSD to No Error + OSD_LastError := 'No Errors'; +end; + +// fade mod +destructor TDisplay.Destroy; +begin + if canFade then + glDeleteTextures(1,@pTex); + inherited Destroy; +end; +// end + +function TDisplay.Draw: Boolean; +var + S: integer; + Col: Real; + // fade mod + myFade2: Real; + currentTime: Cardinal; + glError: glEnum; + glErrorStr: String; + // end +begin + Result := True; + + Col := 1; + {if (ParamStr(1) = '-black') or (ParamStr(1) = '-fsblack') then + Col := 0; } + + glClearColor(Col, Col, Col , 0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + for S := 1 to Screens do begin + ScreenAct := S; + +// if Screens = 1 then ScreenX := 0; +// if (Screens = 2) and (S = 1) then ScreenX := -1; +// if (Screens = 2) and (S = 2) then ScreenX := 1; + ScreenX := 0; + + if S = 2 then TimeSkip := 0 else; + glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); + + //popup hack + // check was successful... move on + if CheckOK then + if assigned (NextScreenWithCheck)then + begin + NextScreen:=NextScreenWithCheck; + NextScreenWithCheck := NIL; + CheckOk:=False; + end + else + BlackScreen:=True; // end of game - fade to black before exit + //end popup hack + +// ActualScreen.SetAnimationProgress(1); + if (not assigned (NextScreen)) and (not BlackScreen) then begin + ActualScreen.Draw; + //popup mod + if ScreenPopupError <> NIL then if ScreenPopupError.Visible then ScreenPopupError.Draw else + if ScreenPopupCheck <> NIL then if ScreenPopupCheck.Visible then ScreenPopupCheck.Draw; + //popup end + // fade mod + myfade:=0; + if (Ini.ScreenFade=1) and canFade then + doFade:=True + else if Ini.ScreenFade=0 then + doFade:=False; + // end + end + else + begin + // check if we had an initialization error (canfade=false, dofade=true) + if doFade and not canFade then begin + doFade:=False; //disable fading +// ScreenPopupError.ShowPopup('Error initializing\nfade texture\n\nfading\ndisabled'); //show error message + end; + if doFade and canFade then + begin + // fade mod + //Create Fading texture if we're just starting + if myfade = 0 then + begin + glViewPort(0, 0, 512, 512); + ActualScreen.Draw; + glBindTexture(GL_TEXTURE_2D, pTex[S]); + glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 512, 512, 0); + glError:=glGetError; + if glError <> GL_NO_ERROR then + begin + canFade := False; + case glError of + GL_INVALID_ENUM: glErrorStr:='INVALID_ENUM'; + GL_INVALID_VALUE: glErrorStr:='INVALID_VALUE'; + GL_INVALID_OPERATION: glErrorStr:='INVALID_OPERATION'; + GL_STACK_OVERFLOW: glErrorStr:='STACK_OVERFLOW'; + GL_STACK_UNDERFLOW: glErrorStr:='STACK_UNDERFLOW'; + GL_OUT_OF_MEMORY: glErrorStr:='OUT_OF_MEMORY'; + else glErrorStr:='unknown error'; + end; +// ScreenPopupError.ShowPopup('Error copying\nfade texture\n('+glErrorStr+')\nfading\ndisabled'); //show error message + end; + glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); + // blackscreen-hack + if not BlackScreen then + NextScreen.onShow; + + lastTime:=GetTickCount; + if (S=2) or (Screens = 1) then + myfade:=myfade+1; + end; // end texture creation in first fading step + + //do some time-based fading + currentTime:=GetTickCount; + if (currentTime > lastTime+30) and (S=1) then + begin + myfade:=myfade+4; + lastTime:=currentTime; + end; + +// LastFade := Fade; // whatever +// Fade := Fade -0.999; // start fading out + + +// ActualScreen.ShowFinish := false; // no purpose? + +// ActualScreen.SetAnimationProgress(Fade-1); // nop? + + // blackscreen-hack + if not BlackScreen then + NextScreen.Draw // draw next screen + else if ScreenAct=1 then begin + glClearColor(0, 0, 0 , 0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end; + + // and draw old screen over it... slowly fading out + myfade2:=(myfade*myfade)/10000; + glBindTexture(GL_TEXTURE_2D, pTex[S]); + glColor4f(1, 1, 1, (1000-myfade*myfade)/1000); // strange calculation - alpha gets negative... but looks good this way + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glTexCoord2f(0+myfade2,0+myfade2);glVertex2f(0, 600); + glTexCoord2f(0+myfade2,1-myfade2);glVertex2f(0, 0); + glTexCoord2f(1-myfade2,1-myfade2);glVertex2f(800, 0); + glTexCoord2f(1-myfade2,0+myfade2);glVertex2f(800, 600); + glEnd; + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + end + else + // blackscreen hack + if not BlackScreen then + NextScreen.OnShow; + + + if ((myfade > 40) or (not doFade) or (not canFade)) And (S = 1) then begin // fade out complete... + myFade:=0; + ActualScreen.onHide; + ActualScreen.ShowFinish:=False; + ActualScreen:=NextScreen; + NextScreen := nil; + if not blackscreen then + begin + ActualScreen.onShowFinish; + ActualScreen.ShowFinish := true; + end + else + begin + Result:=False; + Break; + end; + // end of fade mod + end; + end; // if + + //Draw OSD only on first Screen if Debug Mode is enabled + if ((Ini.Debug = 1) OR (Params.Debug)) AND (S=1) then + DrawDebugInformation; + + end; // for +// SwapBuffers(h_DC); +end; + +{function TDisplay.Fade(FadeIn : Boolean; Steps : UInt8): UInt8; +begin + Self.FadeIn := FadeIn; + FadeStep := (SizeOf(FadeStep) * $FF) div Steps; + ActualStep := $FF; + Result := $FF div FadeStep; +end;} + +procedure TDisplay.PrintScreen; +var + Bitmap: TBitmap; + Jpeg: TJpegImage; + X, Y: integer; + Num: integer; + FileName: string; +begin + for Num := 1 to 9999 do begin + FileName := IntToStr(Num); + while Length(FileName) < 4 do FileName := '0' + FileName; + FileName := ScreenshotsPath + 'screenshot' + FileName + '.jpg'; + if not FileExists(FileName) then break + end; + + glReadPixels(0, 0, ScreenW, ScreenH, GL_RGBA, GL_UNSIGNED_BYTE, @PrintScreenData[0]); + Bitmap := TBitmap.Create; + Bitmap.Width := ScreenW; + Bitmap.Height := ScreenH; + + for Y := 0 to ScreenH-1 do + for X := 0 to ScreenW-1 do + Bitmap.Canvas.Pixels[X, Y] := PrintScreenData[(ScreenH-1-Y) * ScreenW + X] and $00FFFFFF; + + Jpeg := TJpegImage.Create; + Jpeg.Assign(Bitmap); + Bitmap.Free; + Jpeg.CompressionQuality := 95;//90; + Jpeg.SaveToFile(FileName); + Jpeg.Free; +end; + +procedure TDisplay.ScreenShot; + var F : file; + FileInfo: BITMAPINFOHEADER; + FileHeader : BITMAPFILEHEADER; + pPicData:Pointer; + FileName: String; + Num: Integer; +begin + //bilddatei Suchen + for Num := 1 to 9999 do begin + FileName := IntToStr(Num); + while Length(FileName) < 4 do FileName := '0' + FileName; + FileName := ScreenshotsPath + FileName + '.BMP'; + if not FileExists(FileName) then break + end; + + //Speicher für die Speicherung der Header-Informationen vorbereiten + ZeroMemory(@FileHeader, SizeOf(BITMAPFILEHEADER)); + ZeroMemory(@FileInfo , SizeOf(BITMAPINFOHEADER)); + + //Initialisieren der Daten des Headers + FileHeader.bfType := 19778; //$4D42 = 'BM' + FileHeader.bfOffBits := SizeOf(BITMAPINFOHEADER)+SizeOf(BITMAPFILEHEADER); + + //Schreiben der Bitmap-Informationen + FileInfo.biSize := SizeOf(BITMAPINFOHEADER); + FileInfo.biWidth := ScreenW; + FileInfo.biHeight := ScreenH; + FileInfo.biPlanes := 1; + FileInfo.biBitCount := 32; + FileInfo.biSizeImage := FileInfo.biWidth*FileInfo.biHeight*(FileInfo.biBitCount div 8); + + //Größenangabe auch in den Header übernehmen + FileHeader.bfSize := FileHeader.bfOffBits + FileInfo.biSizeImage; + + //Speicher für die Bilddaten reservieren + GetMem(pPicData, FileInfo.biSizeImage); + try + //Bilddaten von OpenGL anfordern (siehe oben) + glReadPixels(0, 0, ScreenW, ScreenH, GL_BGRA, GL_UNSIGNED_BYTE, pPicData); + + //Und den ganzen Müll in die Datei schieben ;-) + //Moderne Leute nehmen dafür auch Streams ... + AssignFile(f, Filename); + Rewrite( f,1 ); + try + BlockWrite(F, FileHeader, SizeOf(BITMAPFILEHEADER)); + BlockWrite(F, FileInfo, SizeOf(BITMAPINFOHEADER)); + BlockWrite(F, pPicData^, FileInfo.biSizeImage ); + finally + CloseFile(f); + end; + finally + //Und den angeforderten Speicher wieder freigeben ... + FreeMem(pPicData, FileInfo.biSizeImage); + end; +end; + +//------------ +// DrawDebugInformation - Procedure draw FPS and some other Informations on Screen +//------------ +procedure TDisplay.DrawDebugInformation; +var Ticks: Cardinal; +begin + //Some White Background for information + glEnable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + glColor4f(1, 1, 1, 0.5); + glBegin(GL_QUADS); + glVertex2f(690, 44); + glVertex2f(690, 0); + glVertex2f(800, 0); + glVertex2f(800, 44); + glEnd; + glDisable(GL_BLEND); + + //Set Font Specs + SetFontStyle(0); + SetFontSize(7); + SetFontItalic(False); + glColor4f(0, 0, 0, 1); + + //Calculate FPS + Ticks := GetTickCount; + if (Ticks >= NextFPSSwap) then + begin + LastFPS := FPSCounter * 4; + FPSCounter := 0; + NextFPSSwap := Ticks + 250; + end; + + Inc(FPSCounter); + + //Draw Text + + //FPS + SetFontPos(695, 0); + glPrint (PChar('FPS: ' + InttoStr(LastFPS))); + + //RSpeed + SetFontPos(695, 13); + glPrint (PChar('RSpeed: ' + InttoStr(Round(1000 * TimeMid)))); + + //LastError + SetFontPos(695, 26); + glColor4f(1, 0, 0, 1); + glPrint (PChar(OSD_LastError)); + + glColor4f(1, 1, 1, 1); +end; + +end. diff --git a/Game/Code/Menu/UMenuButton.pas b/Game/Code/Menu/UMenuButton.pas index f3b00830..af4f69ee 100644 --- a/Game/Code/Menu/UMenuButton.pas +++ b/Game/Code/Menu/UMenuButton.pas @@ -1,565 +1,572 @@ -unit UMenuButton; - -interface -uses TextGL, UTexture, OpenGL12, UMenuText; - -type - CButton = class of TButton; - TButton = class - protected - SelectBool: Boolean; - - FadeProgress: Real; - FadeLastTick: Cardinal; - - DeSelectW: Real; - DeSelectH: Real; - PosX: Real; - PosY: Real; - - constructor Create(); overload; - - public - Text: Array of TText; - Texture: TTexture; // Button Screen position and size - Texture2: TTexture; // second texture only used for fading full resolution covers - //colorized hack - Colorized: Boolean; - DeSelectTexture: TTexture; // texture for colorized hack - - FadeTex: TTexture; //Texture for beautiful fading - FadeTexPos: byte; //Pos of the FadeTexture (0: Top, 1: Left, 2: Bottom, 3: Right) -// Texture2Blend: real; // blending factor for second texture (0=invisible, 1=visible) - // now uses alpha - - DeselectType: integer; // not used yet - Visible: boolean; - //Reflection Mod - Reflection: boolean; - Reflectionspacing: Real; - DeSelectReflectionspacing: Real; - - //Fade Mod - Fade: Boolean; - FadeText: Boolean; - - Selectable: boolean; - - //No of the Parent Collection, 0 if in no Collection - Parent: Byte; - - SelectColR: real; - SelectColG: real; - SelectColB: real; - SelectInt: real; - SelectTInt: real; - //Fade Mod - SelectW: real; - SelectH: real; - - DeselectColR: real; - DeselectColG: real; - DeselectColB: real; - DeselectInt: real; - DeselectTInt: real; - - procedure SetY(Value: real); - procedure SetX(Value: real); - procedure SetW(Value: real); - procedure SetH(Value: real); - - procedure SetSelect(Value: Boolean); virtual; - property X: real read PosX write SetX; - property Y: real read PosY write SetY; - property Z: real read Texture.z write Texture.z; - property W: real read DeSelectW write SetW; - property H: real read DeSelectH write SetH; - property Selected: Boolean read SelectBool write SetSelect; - - procedure Draw; virtual; - - constructor Create(Textura: TTexture); overload; - constructor Create(Textura, DSTexture: TTexture); overload; - destructor Destroy; override; - end; - -implementation -uses UDrawTexture, SysUtils, windows; - -procedure TButton.SetX(Value: real); -{var - dx: real; - T: integer; // text} -begin - {dY := Value - Texture.y; - - Texture.X := Value; - - for T := 0 to High(Text) do - Text[T].X := Text[T].X + dY;} - - PosX := Value; - if (FadeTex.TexNum = -1) then - Texture.X := Value; - -end; - -procedure TButton.SetY(Value: real); -{var - dY: real; - T: integer; // text} -begin - {dY := Value - PosY; - - - for T := 0 to High(Text) do - Text[T].Y := Text[T].Y + dY;} - - PosY := Value; - if (FadeTex.TexNum = -1) then - Texture.y := Value; -end; - -procedure TButton.SetW(Value: real); -begin - if SelectW = DeSelectW then - SelectW := Value; - - DeSelectW := Value; - - if Not Fade then - begin - if SelectBool then - Texture.W := SelectW - else - Texture.W := DeSelectW; - end; -end; - -procedure TButton.SetH(Value: real); -begin - if SelectH = DeSelectH then - SelectH := Value; - - DeSelectH := Value; - - if Not Fade then - begin - if SelectBool then - Texture.H := SelectH - else - Texture.H := DeSelectH; - end; -end; - -procedure TButton.SetSelect(Value : Boolean); -var - T: integer; -begin - SelectBool := Value; - if (Value) then begin - Texture.ColR := SelectColR; - Texture.ColG := SelectColG; - Texture.ColB := SelectColB; - Texture.Int := SelectInt; - - Texture2.ColR := SelectColR; - Texture2.ColG := SelectColG; - Texture2.ColB := SelectColB; - Texture2.Int := SelectInt; - - for T := 0 to High(Text) do - Text[T].Int := SelectTInt; - - //Fade Mod - if Fade then - begin - if (FadeProgress <= 0) then - FadeProgress := 0.125; - end - else - begin - Texture.W := SelectW; - Texture.H := SelectH; - end; - end else begin - Texture.ColR := DeselectColR; - Texture.ColG := DeselectColG; - Texture.ColB := DeselectColB; - Texture.Int := DeselectInt; - - Texture2.ColR := DeselectColR; - Texture2.ColG := DeselectColG; - Texture2.ColB := DeselectColB; - Texture2.Int := DeselectInt; - - for T := 0 to High(Text) do - Text[T].Int := DeselectTInt; - - //Fade Mod - if Fade then - begin - if (FadeProgress >= 1) then - FadeProgress := 0.875; - end - else - begin - Texture.W := DeSelectW; - Texture.H := DeSelectH; - end; - end; -end; - -constructor TButton.Create(); -begin - inherited Create; - // We initialize all to 0, nil or false - Visible := true; - SelectBool := false; - DeselectType := 0; - Selectable := true; - //Reflection Mod - Reflection := true; - - //colorized hack - Colorized:=False; - - // Default -// SelectInt := 1; -// DeselectInt := 0.5; - -{ SelectColR := 0.5; - SelectColG := 0.75; - SelectColB := 0; - SelectInt := 1; - SelectTInt := 1; - - DeselectColR := 1; - DeselectColG := 1; - DeselectColB := 1; - DeselectInt := 0.5; - DeselectTInt := 1;} - - SelectColR := 1; - SelectColG := 1; - SelectColB := 1; - SelectInt := 1; - SelectTInt := 1; - - DeselectColR := 1; - DeselectColG := 1; - DeselectColB := 1; - DeselectInt := 0.5; - DeselectTInt := 1; - - FadeTex.TexNum := -1; - - FadeProgress := 0; - Fade := False; - FadeText := False; - SelectW := DeSelectW; - SelectH := DeSelectH; - - PosX := 0; - PosY := 0; - - Parent := 0; -end; - -// ***** Public methods ****** // - -procedure TButton.Draw; -var - T: integer; - Tick: Cardinal; - Spacing: Real; -begin - if Visible then begin - //Fade Mod - T:=0; - if Fade then - begin - if (FadeProgress < 1) and (FadeProgress > 0) then - begin - Tick := GetTickCount div 16; - if (Tick <> FadeLastTick) then - begin - FadeLastTick := Tick; - if SelectBool then - FadeProgress := FadeProgress + 0.125 - else - FadeProgress := FadeProgress - 0.125; - - if (FadeText) then - begin - For T := 0 to high(Text) do - begin - Text[T].MoveX := (SelectW - DeSelectW) * FadeProgress; - Text[T].MoveY := (SelectH - DeSelectH) * FadeProgress; - end; - end; - end; - end; - //Method without Fade Texture - if (FadeTex.TexNum = -1) then - begin - Texture.W := DeSelectW + (SelectW - DeSelectW) * FadeProgress; - Texture.H := DeSelectH + (SelectH - DeSelectH) * FadeProgress; - DeselectTexture.W := Texture.W; - DeselectTexture.H := Texture.H; - end - else //method with Fade Texture - begin - Texture.W := DeSelectW; - Texture.H := DeSelectH; - DeselectTexture.W := Texture.W; - DeselectTexture.H := Texture.H; - - FadeTex.ColR := Texture.ColR; - FadeTex.ColG := Texture.ColG; - FadeTex.ColB := Texture.ColB; - FadeTex.Int := Texture.Int; - - FadeTex.Z := Texture.Z; - - FadeTex.Alpha := Texture.Alpha; - FadeTex.TexX1 := 0; - FadeTex.TexX2 := 1; - FadeTex.TexY1 := 0; - FadeTex.TexY2 := 1; - - Case FadeTexPos of - 0: //FadeTex on Top - begin - //Standard Texture - Texture.X := PosX; - Texture.Y := PosY + (SelectH - DeSelectH) * FadeProgress; - DeselectTexture.X := Texture.X; - DeselectTexture.Y := Texture.Y; - //Fade Tex - FadeTex.X := PosX; - FadeTex.Y := PosY; - FadeTex.W := Texture.W; - FadeTex.H := (SelectH - DeSelectH) * FadeProgress; - FadeTex.ScaleW := Texture.ScaleW; - //Some Hack that Fixes a little Space between both Textures - FadeTex.TexY2 := 0.9; - end; - 1: //FadeTex on Left - begin - //Standard Texture - Texture.X := PosX + (SelectW - DeSelectW) * FadeProgress; - Texture.Y := PosY; - DeselectTexture.X := Texture.X; - DeselectTexture.Y := Texture.Y; - //Fade Tex - FadeTex.X := PosX; - FadeTex.Y := PosY; - FadeTex.H := Texture.H; - FadeTex.W := (SelectW - DeSelectW) * FadeProgress; - FadeTex.ScaleH := Texture.ScaleH; - //Some Hack that Fixes a little Space between both Textures - FadeTex.TexX2 := 0.9; - end; - 2: //FadeTex on Bottom - begin - //Standard Texture - Texture.X := PosX; - Texture.Y := PosY; - DeselectTexture.X := Texture.X; - DeselectTexture.Y := Texture.Y; - //Fade Tex - FadeTex.X := PosX; - FadeTex.Y := PosY + (SelectH - DeSelectH) * FadeProgress;; - FadeTex.W := Texture.W; - FadeTex.H := (SelectH - DeSelectH) * FadeProgress; - FadeTex.ScaleW := Texture.ScaleW; - //Some Hack that Fixes a little Space between both Textures - FadeTex.TexY1 := 0.1; - end; - 3: //FadeTex on Right - begin - //Standard Texture - Texture.X := PosX; - Texture.Y := PosY; - DeselectTexture.X := Texture.X; - DeselectTexture.Y := Texture.Y; - //Fade Tex - FadeTex.X := PosX + (SelectW - DeSelectW) * FadeProgress; - FadeTex.Y := PosY; - FadeTex.H := Texture.H; - FadeTex.W := (SelectW - DeSelectW) * FadeProgress; - FadeTex.ScaleH := Texture.ScaleH; - //Some Hack that Fixes a little Space between both Textures - FadeTex.TexX1 := 0.1; - end; - end; - end; - end - else if (FadeText) then - begin - Text[T].MoveX := (SelectW - DeSelectW); - Text[T].MoveY := (SelectH - DeSelectH); - end; - - if SelectBool or (FadeProgress > 0) or not Colorized then - DrawTexture(Texture) - else - DrawTexture(DeselectTexture); - - //Draw FadeTex - if (FadeTex.TexNum <> -1) then - DrawTexture(FadeTex); - - if Texture2.Alpha > 0 then begin - Texture2.ScaleW := Texture.ScaleW; - Texture2.ScaleH := Texture.ScaleH; - - Texture2.X := Texture.X; - Texture2.Y := Texture.Y; - Texture2.W := Texture.W; - Texture2.H := Texture.H; - - Texture2.ColR := Texture.ColR; - Texture2.ColG := Texture.ColG; - Texture2.ColB := Texture.ColB; - Texture2.Int := Texture.Int; - - Texture2.Z := Texture.Z; - - DrawTexture(Texture2); - end; - - //Reflection Mod - if (Reflection) then // Draw Reflections - begin - if (FadeProgress <> 0) AND (FadeProgress <> 1) then - begin - Spacing := DeSelectReflectionspacing - (DeSelectReflectionspacing - Reflectionspacing) * FadeProgress; - end - else if SelectBool then - Spacing := Reflectionspacing - else - Spacing := DeSelectReflectionspacing; - - if SelectBool or not Colorized then - with Texture do - begin - //Bind Tex and GL Attributes - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - - glDepthRange(0, 10); - glDepthFunc(GL_LEQUAL); - glEnable(GL_DEPTH_TEST); - - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, TexNum); - - //Draw - glBegin(GL_QUADS);//Top Left - glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); - glTexCoord2f(TexX1*TexW, TexY2*TexH); - glVertex3f(x, y+h*scaleH+ Spacing, z); - - //Bottom Left - glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); - glTexCoord2f(TexX1*TexW, TexY1+TexH*0.5); - glVertex3f(x, y+h*scaleH + h*scaleH/2 + Spacing, z); - - - //Bottom Right - glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); - glTexCoord2f(TexX2*TexW, TexY1+TexH*0.5); - glVertex3f(x+w*scaleW, y+h*scaleH + h*scaleH/2 + Spacing, z); - - //Top Right - glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); - glTexCoord2f(TexX2*TexW, TexY2*TexH); - glVertex3f(x+w*scaleW, y+h*scaleH + Spacing, z); - glEnd; - - glDisable(GL_TEXTURE_2D); - glDisable(GL_DEPTH_TEST); - glDisable(GL_BLEND); - end else - with DeselectTexture do - begin - //Bind Tex and GL Attributes - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - - glDepthRange(0, 10); - glDepthFunc(GL_LEQUAL); - glEnable(GL_DEPTH_TEST); - - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, TexNum); - - //Draw - glBegin(GL_QUADS);//Top Left - glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); - glTexCoord2f(TexX1*TexW, TexY2*TexH); - glVertex3f(x, y+h*scaleH+ Spacing, z); - - //Bottom Left - glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); - glTexCoord2f(TexX1*TexW, TexY1+TexH*0.5); - glVertex3f(x, y+h*scaleH + h*scaleH/2 + Spacing, z); - - - //Bottom Right - glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); - glTexCoord2f(TexX2*TexW, TexY1+TexH*0.5); - glVertex3f(x+w*scaleW, y+h*scaleH + h*scaleH/2 + Spacing, z); - - //Top Right - glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); - glTexCoord2f(TexX2*TexW, TexY2*TexH); - glVertex3f(x+w*scaleW, y+h*scaleH + Spacing, z); - glEnd; - - glDisable(GL_TEXTURE_2D); - glDisable(GL_DEPTH_TEST); - glDisable(GL_BLEND); - end; - end; - - for T := 0 to High(Text) do begin - Text[T].Draw; - end; - end; -end; - -// ***** ****** // - -destructor TButton.Destroy; -begin - inherited; -end; - -constructor TButton.Create(Textura: TTexture); -begin - Create(); - Texture := Textura; - DeselectTexture:=Textura; - Texture.ColR := 0; - Texture.ColG := 0.5; - Texture.ColB := 0; - Texture.Int := 1; - Colorized:=False; -end; - -constructor TButton.Create(Textura, DSTexture: TTexture); -begin - Create(); - Texture := Textura; - DeselectTexture := DSTexture; - Texture.ColR := 1; - Texture.ColG := 1; - Texture.ColB := 1; - Texture.Int := 1; - Colorized:=True; -end; - -end. +unit UMenuButton; + +interface +uses TextGL, UTexture, OpenGL12, UMenuText; + +type + CButton = class of TButton; + TButton = class + protected + SelectBool: Boolean; + + FadeProgress: Real; + FadeLastTick: Cardinal; + + DeSelectW: Real; + DeSelectH: Real; + PosX: Real; + PosY: Real; + + constructor Create(); overload; + + public + Text: Array of TText; + Texture: TTexture; // Button Screen position and size + Texture2: TTexture; // second texture only used for fading full resolution covers + //colorized hack + Colorized: Boolean; + DeSelectTexture: TTexture; // texture for colorized hack + + FadeTex: TTexture; //Texture for beautiful fading + FadeTexPos: byte; //Pos of the FadeTexture (0: Top, 1: Left, 2: Bottom, 3: Right) +// Texture2Blend: real; // blending factor for second texture (0=invisible, 1=visible) + // now uses alpha + + DeselectType: integer; // not used yet + Visible: boolean; + //Reflection Mod + Reflection: boolean; + Reflectionspacing: Real; + DeSelectReflectionspacing: Real; + + //Fade Mod + Fade: Boolean; + FadeText: Boolean; + + Selectable: boolean; + + //No of the Parent Collection, 0 if in no Collection + Parent: Byte; + + SelectColR: real; + SelectColG: real; + SelectColB: real; + SelectInt: real; + SelectTInt: real; + //Fade Mod + SelectW: real; + SelectH: real; + + DeselectColR: real; + DeselectColG: real; + DeselectColB: real; + DeselectInt: real; + DeselectTInt: real; + + procedure SetY(Value: real); + procedure SetX(Value: real); + procedure SetW(Value: real); + procedure SetH(Value: real); + + procedure SetSelect(Value: Boolean); virtual; + property X: real read PosX write SetX; + property Y: real read PosY write SetY; + property Z: real read Texture.z write Texture.z; + property W: real read DeSelectW write SetW; + property H: real read DeSelectH write SetH; + property Selected: Boolean read SelectBool write SetSelect; + + procedure Draw; virtual; + + constructor Create(Textura: TTexture); overload; + constructor Create(Textura, DSTexture: TTexture); overload; + destructor Destroy; override; + end; + +implementation + +uses SysUtils, + {$IFDEF win32} + windows, + {$ELSE} + lclintf, + {$ENDIF} + UDrawTexture; + +procedure TButton.SetX(Value: real); +{var + dx: real; + T: integer; // text} +begin + {dY := Value - Texture.y; + + Texture.X := Value; + + for T := 0 to High(Text) do + Text[T].X := Text[T].X + dY;} + + PosX := Value; + if (FadeTex.TexNum = -1) then + Texture.X := Value; + +end; + +procedure TButton.SetY(Value: real); +{var + dY: real; + T: integer; // text} +begin + {dY := Value - PosY; + + + for T := 0 to High(Text) do + Text[T].Y := Text[T].Y + dY;} + + PosY := Value; + if (FadeTex.TexNum = -1) then + Texture.y := Value; +end; + +procedure TButton.SetW(Value: real); +begin + if SelectW = DeSelectW then + SelectW := Value; + + DeSelectW := Value; + + if Not Fade then + begin + if SelectBool then + Texture.W := SelectW + else + Texture.W := DeSelectW; + end; +end; + +procedure TButton.SetH(Value: real); +begin + if SelectH = DeSelectH then + SelectH := Value; + + DeSelectH := Value; + + if Not Fade then + begin + if SelectBool then + Texture.H := SelectH + else + Texture.H := DeSelectH; + end; +end; + +procedure TButton.SetSelect(Value : Boolean); +var + T: integer; +begin + SelectBool := Value; + if (Value) then begin + Texture.ColR := SelectColR; + Texture.ColG := SelectColG; + Texture.ColB := SelectColB; + Texture.Int := SelectInt; + + Texture2.ColR := SelectColR; + Texture2.ColG := SelectColG; + Texture2.ColB := SelectColB; + Texture2.Int := SelectInt; + + for T := 0 to High(Text) do + Text[T].Int := SelectTInt; + + //Fade Mod + if Fade then + begin + if (FadeProgress <= 0) then + FadeProgress := 0.125; + end + else + begin + Texture.W := SelectW; + Texture.H := SelectH; + end; + end else begin + Texture.ColR := DeselectColR; + Texture.ColG := DeselectColG; + Texture.ColB := DeselectColB; + Texture.Int := DeselectInt; + + Texture2.ColR := DeselectColR; + Texture2.ColG := DeselectColG; + Texture2.ColB := DeselectColB; + Texture2.Int := DeselectInt; + + for T := 0 to High(Text) do + Text[T].Int := DeselectTInt; + + //Fade Mod + if Fade then + begin + if (FadeProgress >= 1) then + FadeProgress := 0.875; + end + else + begin + Texture.W := DeSelectW; + Texture.H := DeSelectH; + end; + end; +end; + +constructor TButton.Create(); +begin + inherited Create; + // We initialize all to 0, nil or false + Visible := true; + SelectBool := false; + DeselectType := 0; + Selectable := true; + //Reflection Mod + Reflection := true; + + //colorized hack + Colorized:=False; + + // Default +// SelectInt := 1; +// DeselectInt := 0.5; + +{ SelectColR := 0.5; + SelectColG := 0.75; + SelectColB := 0; + SelectInt := 1; + SelectTInt := 1; + + DeselectColR := 1; + DeselectColG := 1; + DeselectColB := 1; + DeselectInt := 0.5; + DeselectTInt := 1;} + + SelectColR := 1; + SelectColG := 1; + SelectColB := 1; + SelectInt := 1; + SelectTInt := 1; + + DeselectColR := 1; + DeselectColG := 1; + DeselectColB := 1; + DeselectInt := 0.5; + DeselectTInt := 1; + + FadeTex.TexNum := -1; + + FadeProgress := 0; + Fade := False; + FadeText := False; + SelectW := DeSelectW; + SelectH := DeSelectH; + + PosX := 0; + PosY := 0; + + Parent := 0; +end; + +// ***** Public methods ****** // + +procedure TButton.Draw; +var + T: integer; + Tick: Cardinal; + Spacing: Real; +begin + if Visible then begin + //Fade Mod + T:=0; + if Fade then + begin + if (FadeProgress < 1) and (FadeProgress > 0) then + begin + Tick := GetTickCount div 16; + if (Tick <> FadeLastTick) then + begin + FadeLastTick := Tick; + if SelectBool then + FadeProgress := FadeProgress + 0.125 + else + FadeProgress := FadeProgress - 0.125; + + if (FadeText) then + begin + For T := 0 to high(Text) do + begin + Text[T].MoveX := (SelectW - DeSelectW) * FadeProgress; + Text[T].MoveY := (SelectH - DeSelectH) * FadeProgress; + end; + end; + end; + end; + //Method without Fade Texture + if (FadeTex.TexNum = -1) then + begin + Texture.W := DeSelectW + (SelectW - DeSelectW) * FadeProgress; + Texture.H := DeSelectH + (SelectH - DeSelectH) * FadeProgress; + DeselectTexture.W := Texture.W; + DeselectTexture.H := Texture.H; + end + else //method with Fade Texture + begin + Texture.W := DeSelectW; + Texture.H := DeSelectH; + DeselectTexture.W := Texture.W; + DeselectTexture.H := Texture.H; + + FadeTex.ColR := Texture.ColR; + FadeTex.ColG := Texture.ColG; + FadeTex.ColB := Texture.ColB; + FadeTex.Int := Texture.Int; + + FadeTex.Z := Texture.Z; + + FadeTex.Alpha := Texture.Alpha; + FadeTex.TexX1 := 0; + FadeTex.TexX2 := 1; + FadeTex.TexY1 := 0; + FadeTex.TexY2 := 1; + + Case FadeTexPos of + 0: //FadeTex on Top + begin + //Standard Texture + Texture.X := PosX; + Texture.Y := PosY + (SelectH - DeSelectH) * FadeProgress; + DeselectTexture.X := Texture.X; + DeselectTexture.Y := Texture.Y; + //Fade Tex + FadeTex.X := PosX; + FadeTex.Y := PosY; + FadeTex.W := Texture.W; + FadeTex.H := (SelectH - DeSelectH) * FadeProgress; + FadeTex.ScaleW := Texture.ScaleW; + //Some Hack that Fixes a little Space between both Textures + FadeTex.TexY2 := 0.9; + end; + 1: //FadeTex on Left + begin + //Standard Texture + Texture.X := PosX + (SelectW - DeSelectW) * FadeProgress; + Texture.Y := PosY; + DeselectTexture.X := Texture.X; + DeselectTexture.Y := Texture.Y; + //Fade Tex + FadeTex.X := PosX; + FadeTex.Y := PosY; + FadeTex.H := Texture.H; + FadeTex.W := (SelectW - DeSelectW) * FadeProgress; + FadeTex.ScaleH := Texture.ScaleH; + //Some Hack that Fixes a little Space between both Textures + FadeTex.TexX2 := 0.9; + end; + 2: //FadeTex on Bottom + begin + //Standard Texture + Texture.X := PosX; + Texture.Y := PosY; + DeselectTexture.X := Texture.X; + DeselectTexture.Y := Texture.Y; + //Fade Tex + FadeTex.X := PosX; + FadeTex.Y := PosY + (SelectH - DeSelectH) * FadeProgress;; + FadeTex.W := Texture.W; + FadeTex.H := (SelectH - DeSelectH) * FadeProgress; + FadeTex.ScaleW := Texture.ScaleW; + //Some Hack that Fixes a little Space between both Textures + FadeTex.TexY1 := 0.1; + end; + 3: //FadeTex on Right + begin + //Standard Texture + Texture.X := PosX; + Texture.Y := PosY; + DeselectTexture.X := Texture.X; + DeselectTexture.Y := Texture.Y; + //Fade Tex + FadeTex.X := PosX + (SelectW - DeSelectW) * FadeProgress; + FadeTex.Y := PosY; + FadeTex.H := Texture.H; + FadeTex.W := (SelectW - DeSelectW) * FadeProgress; + FadeTex.ScaleH := Texture.ScaleH; + //Some Hack that Fixes a little Space between both Textures + FadeTex.TexX1 := 0.1; + end; + end; + end; + end + else if (FadeText) then + begin + Text[T].MoveX := (SelectW - DeSelectW); + Text[T].MoveY := (SelectH - DeSelectH); + end; + + if SelectBool or (FadeProgress > 0) or not Colorized then + DrawTexture(Texture) + else + DrawTexture(DeselectTexture); + + //Draw FadeTex + if (FadeTex.TexNum <> -1) then + DrawTexture(FadeTex); + + if Texture2.Alpha > 0 then begin + Texture2.ScaleW := Texture.ScaleW; + Texture2.ScaleH := Texture.ScaleH; + + Texture2.X := Texture.X; + Texture2.Y := Texture.Y; + Texture2.W := Texture.W; + Texture2.H := Texture.H; + + Texture2.ColR := Texture.ColR; + Texture2.ColG := Texture.ColG; + Texture2.ColB := Texture.ColB; + Texture2.Int := Texture.Int; + + Texture2.Z := Texture.Z; + + DrawTexture(Texture2); + end; + + //Reflection Mod + if (Reflection) then // Draw Reflections + begin + if (FadeProgress <> 0) AND (FadeProgress <> 1) then + begin + Spacing := DeSelectReflectionspacing - (DeSelectReflectionspacing - Reflectionspacing) * FadeProgress; + end + else if SelectBool then + Spacing := Reflectionspacing + else + Spacing := DeSelectReflectionspacing; + + if SelectBool or not Colorized then + with Texture do + begin + //Bind Tex and GL Attributes + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + + glDepthRange(0, 10); + glDepthFunc(GL_LEQUAL); + glEnable(GL_DEPTH_TEST); + + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, TexNum); + + //Draw + glBegin(GL_QUADS);//Top Left + glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); + glTexCoord2f(TexX1*TexW, TexY2*TexH); + glVertex3f(x, y+h*scaleH+ Spacing, z); + + //Bottom Left + glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); + glTexCoord2f(TexX1*TexW, TexY1+TexH*0.5); + glVertex3f(x, y+h*scaleH + h*scaleH/2 + Spacing, z); + + + //Bottom Right + glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); + glTexCoord2f(TexX2*TexW, TexY1+TexH*0.5); + glVertex3f(x+w*scaleW, y+h*scaleH + h*scaleH/2 + Spacing, z); + + //Top Right + glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); + glTexCoord2f(TexX2*TexW, TexY2*TexH); + glVertex3f(x+w*scaleW, y+h*scaleH + Spacing, z); + glEnd; + + glDisable(GL_TEXTURE_2D); + glDisable(GL_DEPTH_TEST); + glDisable(GL_BLEND); + end else + with DeselectTexture do + begin + //Bind Tex and GL Attributes + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + + glDepthRange(0, 10); + glDepthFunc(GL_LEQUAL); + glEnable(GL_DEPTH_TEST); + + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, TexNum); + + //Draw + glBegin(GL_QUADS);//Top Left + glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); + glTexCoord2f(TexX1*TexW, TexY2*TexH); + glVertex3f(x, y+h*scaleH+ Spacing, z); + + //Bottom Left + glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); + glTexCoord2f(TexX1*TexW, TexY1+TexH*0.5); + glVertex3f(x, y+h*scaleH + h*scaleH/2 + Spacing, z); + + + //Bottom Right + glColor4f(ColR * Int, ColG * Int, ColB * Int, 0); + glTexCoord2f(TexX2*TexW, TexY1+TexH*0.5); + glVertex3f(x+w*scaleW, y+h*scaleH + h*scaleH/2 + Spacing, z); + + //Top Right + glColor4f(ColR * Int, ColG * Int, ColB * Int, Alpha-0.3); + glTexCoord2f(TexX2*TexW, TexY2*TexH); + glVertex3f(x+w*scaleW, y+h*scaleH + Spacing, z); + glEnd; + + glDisable(GL_TEXTURE_2D); + glDisable(GL_DEPTH_TEST); + glDisable(GL_BLEND); + end; + end; + + for T := 0 to High(Text) do begin + Text[T].Draw; + end; + end; +end; + +// ***** ****** // + +destructor TButton.Destroy; +begin + inherited; +end; + +constructor TButton.Create(Textura: TTexture); +begin + Create(); + Texture := Textura; + DeselectTexture:=Textura; + Texture.ColR := 0; + Texture.ColG := 0.5; + Texture.ColB := 0; + Texture.Int := 1; + Colorized:=False; +end; + +constructor TButton.Create(Textura, DSTexture: TTexture); +begin + Create(); + Texture := Textura; + DeselectTexture := DSTexture; + Texture.ColR := 1; + Texture.ColG := 1; + Texture.ColB := 1; + Texture.Int := 1; + Colorized:=True; +end; + +end. diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas index cba237b8..d1c8b7b1 100644 --- a/Game/Code/Menu/UMenuText.pas +++ b/Game/Code/Menu/UMenuText.pas @@ -1,329 +1,339 @@ -unit UMenuText; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -uses TextGL, UTexture, OpenGL12, SysUtils; - -type - TText = class - private - SelectBool: boolean; - TextString: String; - TextTiles: Array of String; - - STicks: Cardinal; - SelectBlink: Boolean; - public - X: real; - Y: real; - MoveX: real; //Some Modifier for X - Position that don't Affect the Real Y - MoveY: real; //Some Modifier for Y - Position that don't Affect the Real Y - W: real; // if text is wider than W then it is breaked -// H: real; - Size: real; - ColR: real; - ColG: real; - ColB: real; - Alpha: real; - Int: real; - Style: integer; - Visible: boolean; - Align: integer; // 0 = left, 1 = center, 2 = right - - procedure SetSelect(Value: Boolean); - property Selected: Boolean read SelectBool write SetSelect; - - procedure SetText(Value: String); - property Text: String read TextString write SetText; - - procedure DeleteLastL; //Procedure to Delete Last Letter - - procedure Draw; - constructor Create; overload; - constructor Create(X, Y: real; Tekst: string); overload; - constructor Create(ParX, ParY, ParW: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; ParTekst: string); overload; - end; - -implementation -uses UGraphic, StrUtils, Windows; - -procedure TText.SetSelect(Value: Boolean); -begin - SelectBool := Value; - - //Set Cursor Visible - SelectBlink := True; - STicks := GettickCount div 550; -end; - -procedure TText.SetText(Value: String); -var - NextPos: Cardinal; //NextPos of a Space etc. - LastPos: Cardinal; //LastPos " - LastBreak: Cardinal; //Last Break - isBreak: Boolean; //True if the Break is not Caused because the Text is out of the area - FirstWord: Word; //Is First Word after Break? - Len: Word; //Length of the Tiles Array - Function Smallest(const A, B: Cardinal):Cardinal; - begin - if (A < B) then - Result := A - else - Result := B; - end; - - Function GetNextPos: Boolean; - var - T1, T2, T3: Cardinal; - begin - LastPos := NextPos; - - //Next Space (If Width is given) - if (W > 0) then - T1 := PosEx(' ', Value, LastPos + 1) - else T1 := Length(Value); - - {//Next - - T2 := PosEx('-', Value, LastPos + 1);} - - //Next Break - T3 := PosEx('\n', Value, LastPos + 1); - - if T1 = 0 then - T1 := Length(Value); - {if T2 = 0 then - T2 := Length(Value); } - if T3 = 0 then - T3 := Length(Value); - - //Get Nearest Pos - NextPos := Smallest(T1, T3{Smallest(T2, T3)}); - - if (LastPos = Length(Value)) then - NextPos := 0; - - isBreak := (NextPos = T3) AND (NextPos <> Length(Value)); - Result := (NextPos <> 0); - end; - procedure AddBreak(const From, bTo: Cardinal); - begin - if (isBreak) OR (bTo - From >= 1) then - begin - Inc(Len); - SetLength (TextTiles, Len); - TextTiles[Len-1] := Trim(Copy(Value, From, bTo - From)); - - if isBreak then - LastBreak := bTo + 2 - else - LastBreak := bTo + 1; - FirstWord := 0; - end; - end; -begin - //Set TExtstring - TextString := Value; - - //Set Cursor Visible - SelectBlink := True; - STicks := GettickCount div 550; - - //Exit if there is no Need to Create Tiles - If (W <= 0) and (Pos('\n', Value) = 0) then - begin - SetLength (TextTiles, 1); - TextTiles[0] := Value; - Exit; - end; - - //Create Tiles - //Reset Text Array - SetLength (TextTiles, 0); - Len := 0; - - //Reset Counter Vars - LastPos := 1; - NextPos := 1; - LastBreak := 1; - FirstWord := 1; - - - if (W > 0) then - begin - //Set Font Propertys - SetFontStyle(Style); - SetFontSize(Size); - end; - - //go Through Text - While (GetNextPos) do - begin - //Break in Text - if isBreak then - begin - //Look for Break before the Break - if (glTextWidth(PChar(Copy(Value, LastBreak, NextPos - LastBreak + 1))) > W) AND (NextPos-LastPos > 1) then - begin - isBreak := False; - //Not the First word after Break, so we don't have to break within a word - if (FirstWord > 1) then - begin - //Add Break before actual Position, because there the Text fits the Area - AddBreak(LastBreak, LastPos); - end - else //First Word after Break Break within the Word - begin - //ToDo - //AddBreak(LastBreak, LastBreak + 155); - end; - end; - - isBreak := True; - //Add Break from Text - AddBreak(LastBreak, NextPos); - end - //Text comes out of the Text Area -> CreateBreak - else if (glTextWidth(PChar(Copy(Value, LastBreak, NextPos - LastBreak + 1))) > W) then - begin - //Not the First word after Break, so we don't have to break within a word - if (FirstWord > 1) then - begin - //Add Break before actual Position, because there the Text fits the Area - AddBreak(LastBreak, LastPos); - end - else //First Word after Break -> Break within the Word - begin - //ToDo - //AddBreak(LastBreak, LastBreak + 155); - end; - end; - //end; - Inc(FirstWord) - end; - //Add Ending - AddBreak(LastBreak, Length(Value)+1); -end; - -Procedure TText.DeleteLastL; -var - S: String; - L: Integer; -begin - S := TextString; - L := Length(S); - if (L > 0) then - SetLength(S, L-1); - - SetText(S); -end; - -procedure TText.Draw; -var - X2, Y2: real; - Text2: string; - I: Integer; -begin - if Visible then begin - SetFontStyle(Style); - SetFontSize(Size); - SetFontItalic(False); - glColor4f(ColR*Int, ColG*Int, ColB*Int, Alpha); - - //If Selected Set Blink... - if SelectBool then - begin - I := Gettickcount div 550; - if I <> STicks then - begin //Change Visability - STicks := I; - SelectBlink := Not SelectBlink; - end; - end; - - {if (False) then //No Width set Draw as one Long String - begin - if not (SelectBool AND SelectBlink) then - Text2 := Text - else - Text2 := Text + '|'; - - case Align of - 0: X2 := X; - 1: X2 := X - glTextWidth(pchar(Text2))/2; - 2: X2 := X - glTextWidth(pchar(Text2)); - end; - - SetFontPos(X2, Y); - glPrint(PChar(Text2)); - SetFontStyle(0); // reset to default - end - else - begin} - //Now Use allways: - //Draw Text as Many Strings - Y2 := Y + MoveY; - for I := 0 to high(TextTiles) do - begin - if (not (SelectBool AND SelectBlink)) OR (I <> high(TextTiles)) then - Text2 := TextTiles[I] - else - Text2 := TextTiles[I] + '|'; - - case Align of - 0: X2 := X + MoveX; - 1: X2 := X + MoveX - glTextWidth(pchar(Text2))/2; - 2: X2 := X + MoveX - glTextWidth(pchar(Text2)); - end; - - SetFontPos(X2, Y2); - glPrint(PChar(Text2)); - - {if Size >= 10 then - Y2 := Y2 + Size * 2.8 - else} - if (Style = 1) then - Y2 := Y2 + Size * 2.8 - else - Y2 := Y2 + Size * 2.15; - end; - SetFontStyle(0); // reset to default - - //end; - end; -end; - -constructor TText.Create; -begin - Create(0, 0, ''); -end; - -constructor TText.Create(X, Y: real; Tekst: string); -begin - Create(X, Y, 0, 0, 10, 0, 0, 0, 0, Tekst); -end; - -constructor TText.Create(ParX, ParY, ParW: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; ParTekst: string); -begin - inherited Create; - Alpha := 1; - X := ParX; - Y := ParY; - W := ParW; - Style := ParStyle; - Size := ParSize; - Text := ParTekst; - ColR := ParColR; - ColG := ParColG; - ColB := ParColB; - Int := 1; - Align := ParAlign; - SelectBool := false; - Visible := true; -end; - - -end. +unit UMenuText; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses TextGL, + UTexture, + OpenGL12, + SysUtils; + +type + TText = class + private + SelectBool: boolean; + TextString: String; + TextTiles: Array of String; + + STicks: Cardinal; + SelectBlink: Boolean; + public + X: real; + Y: real; + MoveX: real; //Some Modifier for X - Position that don't Affect the Real Y + MoveY: real; //Some Modifier for Y - Position that don't Affect the Real Y + W: real; // if text is wider than W then it is breaked +// H: real; + Size: real; + ColR: real; + ColG: real; + ColB: real; + Alpha: real; + Int: real; + Style: integer; + Visible: boolean; + Align: integer; // 0 = left, 1 = center, 2 = right + + procedure SetSelect(Value: Boolean); + property Selected: Boolean read SelectBool write SetSelect; + + procedure SetText(Value: String); + property Text: String read TextString write SetText; + + procedure DeleteLastL; //Procedure to Delete Last Letter + + procedure Draw; + constructor Create; overload; + constructor Create(X, Y: real; Tekst: string); overload; + constructor Create(ParX, ParY, ParW: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; ParTekst: string); overload; + end; + +implementation + +uses UGraphic, + {$IFDEF win32} + windows, + {$ELSE} + lclintf, + {$ENDIF} + StrUtils; + +procedure TText.SetSelect(Value: Boolean); +begin + SelectBool := Value; + + //Set Cursor Visible + SelectBlink := True; + STicks := GettickCount div 550; +end; + +procedure TText.SetText(Value: String); +var + NextPos: Cardinal; //NextPos of a Space etc. + LastPos: Cardinal; //LastPos " + LastBreak: Cardinal; //Last Break + isBreak: Boolean; //True if the Break is not Caused because the Text is out of the area + FirstWord: Word; //Is First Word after Break? + Len: Word; //Length of the Tiles Array + Function Smallest(const A, B: Cardinal):Cardinal; + begin + if (A < B) then + Result := A + else + Result := B; + end; + + Function GetNextPos: Boolean; + var + T1, T2, T3: Cardinal; + begin + LastPos := NextPos; + + //Next Space (If Width is given) + if (W > 0) then + T1 := PosEx(' ', Value, LastPos + 1) + else T1 := Length(Value); + + {//Next - + T2 := PosEx('-', Value, LastPos + 1);} + + //Next Break + T3 := PosEx('\n', Value, LastPos + 1); + + if T1 = 0 then + T1 := Length(Value); + {if T2 = 0 then + T2 := Length(Value); } + if T3 = 0 then + T3 := Length(Value); + + //Get Nearest Pos + NextPos := Smallest(T1, T3{Smallest(T2, T3)}); + + if (LastPos = Length(Value)) then + NextPos := 0; + + isBreak := (NextPos = T3) AND (NextPos <> Length(Value)); + Result := (NextPos <> 0); + end; + procedure AddBreak(const From, bTo: Cardinal); + begin + if (isBreak) OR (bTo - From >= 1) then + begin + Inc(Len); + SetLength (TextTiles, Len); + TextTiles[Len-1] := Trim(Copy(Value, From, bTo - From)); + + if isBreak then + LastBreak := bTo + 2 + else + LastBreak := bTo + 1; + FirstWord := 0; + end; + end; +begin + //Set TExtstring + TextString := Value; + + //Set Cursor Visible + SelectBlink := True; + STicks := GettickCount div 550; + + //Exit if there is no Need to Create Tiles + If (W <= 0) and (Pos('\n', Value) = 0) then + begin + SetLength (TextTiles, 1); + TextTiles[0] := Value; + Exit; + end; + + //Create Tiles + //Reset Text Array + SetLength (TextTiles, 0); + Len := 0; + + //Reset Counter Vars + LastPos := 1; + NextPos := 1; + LastBreak := 1; + FirstWord := 1; + + + if (W > 0) then + begin + //Set Font Propertys + SetFontStyle(Style); + SetFontSize(Size); + end; + + //go Through Text + While (GetNextPos) do + begin + //Break in Text + if isBreak then + begin + //Look for Break before the Break + if (glTextWidth(PChar(Copy(Value, LastBreak, NextPos - LastBreak + 1))) > W) AND (NextPos-LastPos > 1) then + begin + isBreak := False; + //Not the First word after Break, so we don't have to break within a word + if (FirstWord > 1) then + begin + //Add Break before actual Position, because there the Text fits the Area + AddBreak(LastBreak, LastPos); + end + else //First Word after Break Break within the Word + begin + //ToDo + //AddBreak(LastBreak, LastBreak + 155); + end; + end; + + isBreak := True; + //Add Break from Text + AddBreak(LastBreak, NextPos); + end + //Text comes out of the Text Area -> CreateBreak + else if (glTextWidth(PChar(Copy(Value, LastBreak, NextPos - LastBreak + 1))) > W) then + begin + //Not the First word after Break, so we don't have to break within a word + if (FirstWord > 1) then + begin + //Add Break before actual Position, because there the Text fits the Area + AddBreak(LastBreak, LastPos); + end + else //First Word after Break -> Break within the Word + begin + //ToDo + //AddBreak(LastBreak, LastBreak + 155); + end; + end; + //end; + Inc(FirstWord) + end; + //Add Ending + AddBreak(LastBreak, Length(Value)+1); +end; + +Procedure TText.DeleteLastL; +var + S: String; + L: Integer; +begin + S := TextString; + L := Length(S); + if (L > 0) then + SetLength(S, L-1); + + SetText(S); +end; + +procedure TText.Draw; +var + X2, Y2: real; + Text2: string; + I: Integer; +begin + if Visible then begin + SetFontStyle(Style); + SetFontSize(Size); + SetFontItalic(False); + glColor4f(ColR*Int, ColG*Int, ColB*Int, Alpha); + + //If Selected Set Blink... + if SelectBool then + begin + I := Gettickcount div 550; + if I <> STicks then + begin //Change Visability + STicks := I; + SelectBlink := Not SelectBlink; + end; + end; + + {if (False) then //No Width set Draw as one Long String + begin + if not (SelectBool AND SelectBlink) then + Text2 := Text + else + Text2 := Text + '|'; + + case Align of + 0: X2 := X; + 1: X2 := X - glTextWidth(pchar(Text2))/2; + 2: X2 := X - glTextWidth(pchar(Text2)); + end; + + SetFontPos(X2, Y); + glPrint(PChar(Text2)); + SetFontStyle(0); // reset to default + end + else + begin} + //Now Use allways: + //Draw Text as Many Strings + Y2 := Y + MoveY; + for I := 0 to high(TextTiles) do + begin + if (not (SelectBool AND SelectBlink)) OR (I <> high(TextTiles)) then + Text2 := TextTiles[I] + else + Text2 := TextTiles[I] + '|'; + + case Align of + 0: X2 := X + MoveX; + 1: X2 := X + MoveX - glTextWidth(pchar(Text2))/2; + 2: X2 := X + MoveX - glTextWidth(pchar(Text2)); + end; + + SetFontPos(X2, Y2); + glPrint(PChar(Text2)); + + {if Size >= 10 then + Y2 := Y2 + Size * 2.8 + else} + if (Style = 1) then + Y2 := Y2 + Size * 2.8 + else + Y2 := Y2 + Size * 2.15; + end; + SetFontStyle(0); // reset to default + + //end; + end; +end; + +constructor TText.Create; +begin + Create(0, 0, ''); +end; + +constructor TText.Create(X, Y: real; Tekst: string); +begin + Create(X, Y, 0, 0, 10, 0, 0, 0, 0, Tekst); +end; + +constructor TText.Create(ParX, ParY, ParW: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; ParTekst: string); +begin + inherited Create; + Alpha := 1; + X := ParX; + Y := ParY; + W := ParW; + Style := ParStyle; + Size := ParSize; + Text := ParTekst; + ColR := ParColR; + ColG := ParColG; + ColB := ParColB; + Int := 1; + Align := ParAlign; + SelectBool := false; + Visible := true; +end; + + +end. diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 3b1efc6e..b931f461 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -1,1092 +1,1105 @@ -unit UScreenCredits; - -interface - -uses - UMenu, SDL, UDisplay, UTexture, OpenGL12, UMusic, UFiles, SysUtils, UThemes, ULCD, ULight, UGraphicClasses; - -type - TCreditsStages=(InitialDelay,Intro,MainPart,Outro); - - TScreenCredits = class(TMenu) - public - - Credits_X: Real; - Credits_Time: Cardinal; - Credits_Alpha: Cardinal; - CTime: Cardinal; - CTime_hold: Cardinal; - ESC_Alpha: Integer; - - credits_entry_tex: TTexture; - credits_entry_dx_tex: TTexture; - credits_bg_tex: TTexture; - credits_bg_ovl: TTexture; -// credits_bg_logo: TTexture; - credits_bg_scrollbox_left: TTexture; - credits_blindguard: TTexture; - credits_blindy: TTexture; - credits_canni: TTexture; - credits_commandio: TTexture; - credits_lazyjoker: TTexture; - credits_mog: TTexture; - credits_mota: TTexture; - credits_skillmaster: TTexture; - credits_whiteshark: TTexture; - intro_layer01: TTexture; - intro_layer02: TTexture; - intro_layer03: TTexture; - intro_layer04: TTexture; - intro_layer05: TTexture; - intro_layer06: TTexture; - intro_layer07: TTexture; - intro_layer08: TTexture; - intro_layer09: TTexture; - outro_bg: TTexture; - outro_esc: TTexture; - outro_exd: TTexture; - - deluxe_slidein: cardinal; - - CurrentScrollText: String; - NextScrollUpdate: Real; - EndofLastScrollingPart: Cardinal; - CurrentScrollStart, CurrentScrollEnd: Integer; - - CRDTS_Stage: TCreditsStages; - - myTex: glUint; - - Fadeout: boolean; - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure onShow; override; - procedure onHide; override; - procedure DrawCredits; - procedure Draw_FunkyText; - end; - -const - Funky_Text: AnsiString = - 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+ - 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+ - 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+ - 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..'; - - - Timings: array[0..21] of Cardinal=( - 20, // 0 Delay vor Start - - 149, // 1 Ende erster Intro Zoom - 155, // 2 Start 2. Action im Intro - 170, // 3 Ende Separation im Intro - 271, // 4 Anfang Zoomout im Intro - 0, // 5 unused - 261, // 6 Start fade-to-white im Intro - - 271, // 7 Start Main Part - 280, // 8 Start On-Beat-Sternchen Main Part - - 396, // 9 Start BlindGuard - 666, // 10 Start blindy - 936, // 11 Start Canni - 1206, // 12 Start Commandio - 1476, // 13 Start LazyJoker - 1746, // 14 Start Mog - 2016, // 15 Start Mota - 2286, // 16 Start SkillMaster - 2556, // 17 Start WhiteShark - 2826, // 18 Ende Whiteshark - 3096, // 19 Start FadeOut Mainscreen - 3366, // 20 Ende Credits Tune - 60); // 21 start flare im intro - -implementation - -uses Windows, - UGraphic, - UMain, - UIni, - USongs, - Textgl, - ULanguage, - UCommon, - Math; - - -function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then - begin // Key Down - case PressedKey of - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - FadeTo(@ScreenMain); - Music.PlayBack; - end; -{ SDLK_SPACE: - begin - setlength(CTime_hold,length(CTime_hold)+1); - CTime_hold[high(CTime_hold)]:=CTime; - end; -} - end;//esac - end; //fi -end; - -constructor TScreenCredits.Create; -begin - inherited Create; - credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0); - credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0); - - credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', 'PNG', 'Font Black', 0); - credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0); - credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0); - credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', 'PNG', 'Font Black', 0); - credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', 'PNG', 'Font Black', 0); - credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', 'Font Black', 0); - credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', 'PNG', 'Font Black', 0); - credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', 'PNG', 'Font Black', 0); - credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', 'PNG', 'Font Black', 0); - - intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', 'PNG', 'Transparent', 0); - intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', 'PNG', 'Transparent', 0); - intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', 'PNG', 'Transparent', 0); - intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', 'PNG', 'Transparent', 0); - intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', 'PNG', 'Transparent', 0); - intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', 'PNG', 'Transparent', 0); - intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', 'PNG', 'Transparent', 0); - intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', 'PNG', 'Transparent', 0); - intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', 'PNG', 'Transparent', 0); - - outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0); - outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0); - outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Transparent', 0); - - CRDTS_Stage:=InitialDelay; -end; - -function TScreenCredits.Draw: boolean; -begin - DrawCredits; - Draw:=true; -end; - -procedure TScreenCredits.onShow; -begin - CRDTS_Stage:=InitialDelay; - Credits_X := 580; - deluxe_slidein := 0; - Credits_Alpha := 0; - //Music.SetLoop(true); Loop looped ned, so ne scheisse - Music.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! -// Music.Play; - CTime:=0; -// setlength(CTime_hold,0); -end; - -procedure TScreenCredits.onHide; -begin - Music.Stop; -end; - -Procedure TScreenCredits.Draw_FunkyText; -var - S: Integer; - X,Y,A: Real; - visibleText: PChar; -begin - SetFontSize(10); - //Init ScrollingText - if (CTime = Timings[7]) then - begin - //Set Position of Text - Credits_X := 600; - CurrentScrollStart:=1; - CurrentScrollEnd:=1; - end; - - if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then - begin - X:=0; - visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); - for S := 0 to length(visibleText)-1 do begin - Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); - SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); - A:=0; - if (Credits_X+X < 15) then A:=0; - if (Credits_X+X >=15) then A:=Credits_X+X-15; - if Credits_X+X > 32 then A:=17; - glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17); - glPrintLetter(visibleText[S]); - X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; - end; - if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin - Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; - inc(CurrentScrollStart); - end; - visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); - if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin - inc(CurrentScrollEnd); - end; - end; -{ // timing hack - X:=5; - SetFontStyle (2); - SetFontItalic(False); - SetFontSize(9); - glColor4f(1, 1, 1, 1); - for S:=0 to high(CTime_hold) do begin - visibleText:=pchar(inttostr(CTime_hold[S])); - SetFontPos (500, X); - glPrint (Addr(visibleText[0])); - X:=X+20; - end;} -end; - -procedure Start3D; -begin - glMatrixMode(GL_PROJECTION); - glPushMatrix; - glLoadIdentity; - glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity; -end; -procedure End3D; -begin - glMatrixMode(GL_PROJECTION); - glPopMatrix; - glMatrixMode(GL_MODELVIEW); -end; - -procedure TScreenCredits.DrawCredits; -var - T,I: Cardinal; - X: Real; - Ver: PChar; - RuntimeStr: AnsiString; - Data: TFFTData; - j,k,l:cardinal; - f,g,h: Real; - STime:cardinal; - Delay:cardinal; - - myPixel: longword; - myColor: Cardinal; - myScale: Real; - myAngle: Real; - - -const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24), - (154,31),(156,58),(168,32),(203,36), - (258,34),(251,50),(274,93),(294,84), - (232,54),(278,62),(319,34),(336,92), - (347,23),(374,32),(377,58),(361,83), - (385,91),(405,91),(429,35),(423,51), - (450,32),(485,34),(444,91),(486,93)); - -begin -//dis does teh muiwk y0r -Data := Music.GetFFTData; - - - - T := GetTickCount div 33; - if T <> Credits_Time then - begin - Credits_Time := T; - inc(CTime); - inc(CTime_hold); - Credits_X := Credits_X-2; - if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then - begin -// CTime:=Timings[20]; -// CRDTS_Stage:=Outro; - - CRDTS_Stage:=Intro; - CTime:=0; - Music.Play; - - end; - if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then - begin - CRDTS_Stage:=MainPart; - end; - if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then - begin - CRDTS_Stage:=Outro; - end; - end; - - //draw background - if CRDTS_Stage=InitialDelay then - begin - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - end - else - if CRDTS_Stage=Intro then - begin - Start3D; - glPushMatrix; - - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - if CTime < Timings[1] then begin - myScale:= 0.5+0.5*(Timings[1]-CTime)/(Timings[1]); // slowly move layers together - myAngle:=cos((CTime)*pi/((Timings[1])*2)); // and make logo face towards camera - end else begin // this is the part when the logo stands still - myScale:=0.5; - myAngle:=0; - end; - if CTime > Timings[2] then begin - myScale:= 0.5+0.5*(CTime-Timings[2])/(Timings[3]-Timings[2]); // get some space between layers - myAngle:=0; - end; -// if CTime > Timings[3] then myScale:=1; // keep the space between layers - glTranslatef(0,0,-5+0.5*myScale); - if CTime > Timings[3] then myScale:=1; // keep the space between layers - if CTime > Timings[3] then begin // make logo rotate left and grow -// myScale:=(CTime-Timings[4])/(Timings[7]-Timings[4]); - glRotatef(20*sqr(CTime-Timings[3])/sqr((Timings[7]-Timings[3])/2),0,0,1); - glScalef(1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1); - end; - if CTime < Timings[2] then - glRotatef(30*myAngle,0.5*myScale+myScale,1+myScale,0); -// glScalef(0.5,0.5,0.5); - glScalef(4/3,-1,1); - glColor4f(1, 1, 1, 1); - - glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.4 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.4 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.4 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.4 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.3 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.3 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.3 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.3 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.2 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.2 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.2 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.2 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.1 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.1 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.1 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.1 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.1 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.1 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.1 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.1 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.2 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.2 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.2 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.2 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.3 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.3 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.3 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.3 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.22 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.22 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.22 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.22 * myScale); - glEnd; - gldisable(gl_texture_2d); - glDisable(GL_BLEND); - - glPopMatrix; - End3D; - - // do some sparkling effects - if (CTime < Timings[1]) and (CTime > Timings[21]) then - begin - for k:=1 to 3 do begin - l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5); - j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301); - GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0); - end; - end; - - // fade to white at end - if Ctime > Timings[6] then - begin - glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6])); - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glVertex2f(0,0); - glVertex2f(0,600); - glVertex2f(800,600); - glVertex2f(800,0); - glEnd; - glDisable(GL_BLEND); - end; - - end; - if (CRDTS_Stage=MainPart) then - // main credits screen background, scroller, logo and girl - begin - - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,600/1024);glVertex2f(0, 600); - glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); - glTexCoord2f(800/1024,0);glVertex2f(800, 0); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - // draw scroller - Draw_FunkyText; - -//######################################################################### -// draw credits names - -// BlindGuard (von links oben reindrehen, nach rechts unten rausdrehen) - STime:=Timings[9]-10; - Delay:=Timings[10]-Timings[9]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(0,329,0); - if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end; - gltranslatef(223,0,0); - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - gltranslatef(223,0,0); - glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1); - gltranslatef(-223,0,0); - end; - glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Blindy (zoom von 0 auf volle grösse und drehung, zoom auf doppelte grösse und nach rechts oben schieben) - STime:=Timings[10]-10; - Delay:=Timings[11]-Timings[10]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+20) and (CTime<=STime+22) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+20 then begin - j:=CTime-Stime; - glscalef(j*j/400,j*j/400,j*j/400); - glrotatef(j*18.0,0,0,1); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - f:=j*10.0; - gltranslatef(f*3,-f,0); - glscalef(1+j/10,1+j/10,1+j/10); - glrotatef(j*9.0,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Canni (von links reinschieben, nach rechts oben rausschieben) - STime:=Timings[11]-10; - Delay:=Timings[12]-Timings[11]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - gltranslatef(((CTime-STime)*21.0)-210,0,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=(CTime-(STime+Delay-10))*21; - gltranslatef(j,-j/2,0); - end; - glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Commandio (von unten reinklappen, nach rechts oben rausklappen) - STime:=Timings[12]-10; - Delay:=Timings[13]-Timings[12]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=258.0-25.8*(CTime-STime) - else - f:=0; - g:=0; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end; - glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163+g-f*1.5, -129+f*1.5-g/2); - glTexCoord2f(0,1);glVertex2f(-163+g*1.5, 129-(g*1.5*258/326)); - glTexCoord2f(1,1); glVertex2f(163+g, 129+g/4); - glTexCoord2f(1,0);glVertex2f(163+f*1.5+g/4, -129+f*1.5-g/4); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing) - STime:=Timings[13]-35; - Delay:=Timings[14]-Timings[13]+5; - if CTime > STime then - begin - k:=0; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20; - ESC_Alpha:=10; - f:=CTime-STime; - if CTime <=STime+40 then j:=CTime-STime else j:=40; - if (CTime >=STime+Delay-40) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j*j/1600); - - glPushMatrix; - gltranslatef(180+(f-70),329,0); - glBindTexture(GL_TEXTURE_2D, credits_lazyjoker.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Mog (von links reinklappen, nach rechts unten rausklappen) - STime:=Timings[14]-10; - Delay:=Timings[15]-Timings[14]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=326.0-32.6*(CTime-STime) - else - f:=0; - - g:=0; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end; - glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163+g*1.5, -129+g*1.5); - glTexCoord2f(0,1);glVertex2f(-163+g*1.2, 129+g); - glTexCoord2f(1,1); glVertex2f(163-f+g/2, 129+f*1.5+g/4); - glTexCoord2f(1,0);glVertex2f(163-f+g*1.5, -129-f*1.5); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Mota (von rechts oben reindrehen, nach links unten rausschieben und verkleinern und dabei drehen) - STime:=Timings[15]-10; - Delay:=Timings[16]-Timings[15]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - gltranslatef(223,0,0); - glrotatef((10-(CTime-STime))*9,0,0,1); - gltranslatef(-223,0,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - f:=j*10.0; - gltranslatef(-f*2,-f,0); - glscalef(1-j/10,1-j/10,1-j/10); - glrotatef(-j*9.0,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Skillmaster (von rechts unten reinschieben, nach rechts oben rausdrehen) - STime:=Timings[16]-10; - Delay:=Timings[17]-Timings[16]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - j:=STime+10-CTime; - f:=j*10.0; - gltranslatef(+f*2,+f/2,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - gltranslatef(0,-223,0); - glrotatef(integer(j)*-9,0,0,1); - gltranslatef(0,223,0); - glrotatef(j*9,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// WhiteShark (von links unten reinklappen, nach rechts oben rausklappen) - STime:=Timings[17]-10; - Delay:=Timings[18]-Timings[17]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=326.0-32.6*(CTime-STime) - else - f:=0; - - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end else - g:=0; - glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2); - glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4); - glTexCoord2f(1,1); glVertex2f(163-f*1.2+g/4, 129+f/2-g/4); - glTexCoord2f(1,0);glVertex2f(163-f*1.5+g/4, -129+f*1.5+g/4); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - - -// #################################################################### -// do some twinkle stuff (kinda on beat) - if (CTime>Timings[8]) and (CTime < Timings[19]) then begin - k:=0; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.2 then begin - l:=RandomRange(6,16); - j:=RandomRange(0,27); - GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); - end; - end; - -//################################################# -// draw the rest of the main screen (girl and logo - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(800-393, 0); - glTexCoord2f(0,600/1024);glVertex2f(800-393, 600); - glTexCoord2f(393/512,600/1024); glVertex2f(800, 600); - glTexCoord2f(393/512,0);glVertex2f(800, 0); - glEnd; -{ glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,112/128);glVertex2f(0, 112); - glTexCoord2f(497/512,112/128); glVertex2f(497, 112); - glTexCoord2f(497/512,0);glVertex2f(497, 0); - glEnd; -} - gldisable(gl_texture_2d); - glDisable(GL_BLEND); - - // fade out at end of main part - if Ctime > Timings[19] then - begin - glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19])); - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glVertex2f(0,0); - glVertex2f(0,600); - glVertex2f(800,600); - glVertex2f(800,0); - glEnd; - glDisable(GL_BLEND); - end; - end - else - if (CRDTS_Stage=Outro) then - begin - if CTime=Timings[20] then begin - CTime_hold:=0; - Music.Stop; - Music.Open(soundpath + 'credits-outro-tune.mp3'); - Music.Play; - Music.SetVolume(20); - Music.SetLoop(True); - end; - if CTime_hold > 231 then begin - Music.Play; - Ctime_hold:=0; - end; - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - - // do something useful - // outro background - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,600/1024);glVertex2f(0, 600); - glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); - glTexCoord2f(800/1024,0);glVertex2f(800, 0); - glEnd; - - //outro overlays - glColor4f(1, 1, 1, (1+sin(CTime/15))/3+1/3); - glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,223/256);glVertex2f(0, 223); - glTexCoord2f(487/512,223/256); glVertex2f(487, 223); - glTexCoord2f(487/512,0);glVertex2f(487, 0); - glEnd; - - ESC_Alpha:=20; - if (RandomRange(0,20) > 18) and (ESC_Alpha=20) then - ESC_Alpha:=0 - else inc(ESC_Alpha); - if ESC_Alpha > 20 then ESC_Alpha:=20; - glColor4f(1, 1, 1, ESC_Alpha/20); - glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(800-310, 600-247); - glTexCoord2f(0,247/256);glVertex2f(800-310, 600); - glTexCoord2f(310/512,247/256); glVertex2f(800, 600); - glTexCoord2f(310/512,0);glVertex2f(800, 600-247); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - // outro scrollers? - // ... - end; - -{ // draw credits runtime counter - SetFontStyle (2); - SetFontItalic(False); - SetFontSize(9); - SetFontPos (5, 5); - glColor4f(1, 1, 1, 1); -// RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10); - RuntimeStr:='CTime: '+inttostr(CTime); - glPrint (Addr(RuntimeStr[1])); -} - // make the stars shine - GoldenRec.Draw; -end; - -end. +unit UScreenCredits; + +interface + +uses + UMenu, + SDL, + UDisplay, + UTexture, + OpenGL12, + UMusic, + UFiles, + SysUtils, + UThemes, + ULCD, + ULight, + UGraphicClasses; + +type + TCreditsStages=(InitialDelay,Intro,MainPart,Outro); + + TScreenCredits = class(TMenu) + public + + Credits_X: Real; + Credits_Time: Cardinal; + Credits_Alpha: Cardinal; + CTime: Cardinal; + CTime_hold: Cardinal; + ESC_Alpha: Integer; + + credits_entry_tex: TTexture; + credits_entry_dx_tex: TTexture; + credits_bg_tex: TTexture; + credits_bg_ovl: TTexture; +// credits_bg_logo: TTexture; + credits_bg_scrollbox_left: TTexture; + credits_blindguard: TTexture; + credits_blindy: TTexture; + credits_canni: TTexture; + credits_commandio: TTexture; + credits_lazyjoker: TTexture; + credits_mog: TTexture; + credits_mota: TTexture; + credits_skillmaster: TTexture; + credits_whiteshark: TTexture; + intro_layer01: TTexture; + intro_layer02: TTexture; + intro_layer03: TTexture; + intro_layer04: TTexture; + intro_layer05: TTexture; + intro_layer06: TTexture; + intro_layer07: TTexture; + intro_layer08: TTexture; + intro_layer09: TTexture; + outro_bg: TTexture; + outro_esc: TTexture; + outro_exd: TTexture; + + deluxe_slidein: cardinal; + + CurrentScrollText: String; + NextScrollUpdate: Real; + EndofLastScrollingPart: Cardinal; + CurrentScrollStart, CurrentScrollEnd: Integer; + + CRDTS_Stage: TCreditsStages; + + myTex: glUint; + + Fadeout: boolean; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure DrawCredits; + procedure Draw_FunkyText; + end; + +const + Funky_Text: AnsiString = + 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+ + 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+ + 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+ + 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..'; + + + Timings: array[0..21] of Cardinal=( + 20, // 0 Delay vor Start + + 149, // 1 Ende erster Intro Zoom + 155, // 2 Start 2. Action im Intro + 170, // 3 Ende Separation im Intro + 271, // 4 Anfang Zoomout im Intro + 0, // 5 unused + 261, // 6 Start fade-to-white im Intro + + 271, // 7 Start Main Part + 280, // 8 Start On-Beat-Sternchen Main Part + + 396, // 9 Start BlindGuard + 666, // 10 Start blindy + 936, // 11 Start Canni + 1206, // 12 Start Commandio + 1476, // 13 Start LazyJoker + 1746, // 14 Start Mog + 2016, // 15 Start Mota + 2286, // 16 Start SkillMaster + 2556, // 17 Start WhiteShark + 2826, // 18 Ende Whiteshark + 3096, // 19 Start FadeOut Mainscreen + 3366, // 20 Ende Credits Tune + 60); // 21 start flare im intro + +implementation + +uses {$IFDEF win32} + windows, + {$ELSE} + lclintf, + {$ENDIF} + UGraphic, + UMain, + UIni, + USongs, + Textgl, + ULanguage, + UCommon, + Math; + + +function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + FadeTo(@ScreenMain); + Music.PlayBack; + end; +{ SDLK_SPACE: + begin + setlength(CTime_hold,length(CTime_hold)+1); + CTime_hold[high(CTime_hold)]:=CTime; + end; +} + end;//esac + end; //fi +end; + +constructor TScreenCredits.Create; +begin + inherited Create; + credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0); + credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0); + + credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', 'PNG', 'Font Black', 0); + credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0); + credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0); + credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', 'PNG', 'Font Black', 0); + credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', 'PNG', 'Font Black', 0); + credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', 'Font Black', 0); + credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', 'PNG', 'Font Black', 0); + credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', 'PNG', 'Font Black', 0); + credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', 'PNG', 'Font Black', 0); + + intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', 'PNG', 'Transparent', 0); + intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', 'PNG', 'Transparent', 0); + intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', 'PNG', 'Transparent', 0); + intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', 'PNG', 'Transparent', 0); + intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', 'PNG', 'Transparent', 0); + intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', 'PNG', 'Transparent', 0); + intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', 'PNG', 'Transparent', 0); + intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', 'PNG', 'Transparent', 0); + intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', 'PNG', 'Transparent', 0); + + outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0); + outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0); + outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Transparent', 0); + + CRDTS_Stage:=InitialDelay; +end; + +function TScreenCredits.Draw: boolean; +begin + DrawCredits; + Draw:=true; +end; + +procedure TScreenCredits.onShow; +begin + CRDTS_Stage:=InitialDelay; + Credits_X := 580; + deluxe_slidein := 0; + Credits_Alpha := 0; + //Music.SetLoop(true); Loop looped ned, so ne scheisse + Music.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! +// Music.Play; + CTime:=0; +// setlength(CTime_hold,0); +end; + +procedure TScreenCredits.onHide; +begin + Music.Stop; +end; + +Procedure TScreenCredits.Draw_FunkyText; +var + S: Integer; + X,Y,A: Real; + visibleText: PChar; +begin + SetFontSize(10); + //Init ScrollingText + if (CTime = Timings[7]) then + begin + //Set Position of Text + Credits_X := 600; + CurrentScrollStart:=1; + CurrentScrollEnd:=1; + end; + + if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then + begin + X:=0; + visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); + for S := 0 to length(visibleText)-1 do begin + Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); + SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); + A:=0; + if (Credits_X+X < 15) then A:=0; + if (Credits_X+X >=15) then A:=Credits_X+X-15; + if Credits_X+X > 32 then A:=17; + glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17); + glPrintLetter(visibleText[S]); + X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + end; + if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin + Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + inc(CurrentScrollStart); + end; + visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); + if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin + inc(CurrentScrollEnd); + end; + end; +{ // timing hack + X:=5; + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + glColor4f(1, 1, 1, 1); + for S:=0 to high(CTime_hold) do begin + visibleText:=pchar(inttostr(CTime_hold[S])); + SetFontPos (500, X); + glPrint (Addr(visibleText[0])); + X:=X+20; + end;} +end; + +procedure Start3D; +begin + glMatrixMode(GL_PROJECTION); + glPushMatrix; + glLoadIdentity; + glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity; +end; +procedure End3D; +begin + glMatrixMode(GL_PROJECTION); + glPopMatrix; + glMatrixMode(GL_MODELVIEW); +end; + +procedure TScreenCredits.DrawCredits; +var + T,I: Cardinal; + X: Real; + Ver: PChar; + RuntimeStr: AnsiString; + Data: TFFTData; + j,k,l:cardinal; + f,g,h: Real; + STime:cardinal; + Delay:cardinal; + + myPixel: longword; + myColor: Cardinal; + myScale: Real; + myAngle: Real; + + +const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24), + (154,31),(156,58),(168,32),(203,36), + (258,34),(251,50),(274,93),(294,84), + (232,54),(278,62),(319,34),(336,92), + (347,23),(374,32),(377,58),(361,83), + (385,91),(405,91),(429,35),(423,51), + (450,32),(485,34),(444,91),(486,93)); + +begin + //dis does teh muiwk y0r + Data := Music.GetFFTData; + + T := GetTickCount div 33; + if T <> Credits_Time then + begin + Credits_Time := T; + inc(CTime); + inc(CTime_hold); + Credits_X := Credits_X-2; + if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then + begin +// CTime:=Timings[20]; +// CRDTS_Stage:=Outro; + + CRDTS_Stage:=Intro; + CTime:=0; + Music.Play; + + end; + if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then + begin + CRDTS_Stage:=MainPart; + end; + if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then + begin + CRDTS_Stage:=Outro; + end; + end; + + //draw background + if CRDTS_Stage=InitialDelay then + begin + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end + else + if CRDTS_Stage=Intro then + begin + Start3D; + glPushMatrix; + + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + if CTime < Timings[1] then begin + myScale:= 0.5+0.5*(Timings[1]-CTime)/(Timings[1]); // slowly move layers together + myAngle:=cos((CTime)*pi/((Timings[1])*2)); // and make logo face towards camera + end else begin // this is the part when the logo stands still + myScale:=0.5; + myAngle:=0; + end; + if CTime > Timings[2] then begin + myScale:= 0.5+0.5*(CTime-Timings[2])/(Timings[3]-Timings[2]); // get some space between layers + myAngle:=0; + end; +// if CTime > Timings[3] then myScale:=1; // keep the space between layers + glTranslatef(0,0,-5+0.5*myScale); + if CTime > Timings[3] then myScale:=1; // keep the space between layers + if CTime > Timings[3] then begin // make logo rotate left and grow +// myScale:=(CTime-Timings[4])/(Timings[7]-Timings[4]); + glRotatef(20*sqr(CTime-Timings[3])/sqr((Timings[7]-Timings[3])/2),0,0,1); + glScalef(1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1); + end; + if CTime < Timings[2] then + glRotatef(30*myAngle,0.5*myScale+myScale,1+myScale,0); +// glScalef(0.5,0.5,0.5); + glScalef(4/3,-1,1); + glColor4f(1, 1, 1, 1); + + glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.4 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.4 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.4 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.4 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.22 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.22 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.22 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.22 * myScale); + glEnd; + gldisable(gl_texture_2d); + glDisable(GL_BLEND); + + glPopMatrix; + End3D; + + // do some sparkling effects + if (CTime < Timings[1]) and (CTime > Timings[21]) then + begin + for k:=1 to 3 do begin + l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5); + j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301); + GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0); + end; + end; + + // fade to white at end + if Ctime > Timings[6] then + begin + glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + + end; + if (CRDTS_Stage=MainPart) then + // main credits screen background, scroller, logo and girl + begin + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // draw scroller + Draw_FunkyText; + +//######################################################################### +// draw credits names + +// BlindGuard (von links oben reindrehen, nach rechts unten rausdrehen) + STime:=Timings[9]-10; + Delay:=Timings[10]-Timings[9]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(0,329,0); + if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end; + gltranslatef(223,0,0); + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + gltranslatef(223,0,0); + glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1); + gltranslatef(-223,0,0); + end; + glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Blindy (zoom von 0 auf volle grösse und drehung, zoom auf doppelte grösse und nach rechts oben schieben) + STime:=Timings[10]-10; + Delay:=Timings[11]-Timings[10]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+20) and (CTime<=STime+22) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+20 then begin + j:=CTime-Stime; + glscalef(j*j/400,j*j/400,j*j/400); + glrotatef(j*18.0,0,0,1); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(f*3,-f,0); + glscalef(1+j/10,1+j/10,1+j/10); + glrotatef(j*9.0,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Canni (von links reinschieben, nach rechts oben rausschieben) + STime:=Timings[11]-10; + Delay:=Timings[12]-Timings[11]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(((CTime-STime)*21.0)-210,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=(CTime-(STime+Delay-10))*21; + gltranslatef(j,-j/2,0); + end; + glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Commandio (von unten reinklappen, nach rechts oben rausklappen) + STime:=Timings[12]-10; + Delay:=Timings[13]-Timings[12]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=258.0-25.8*(CTime-STime) + else + f:=0; + g:=0; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end; + glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163+g-f*1.5, -129+f*1.5-g/2); + glTexCoord2f(0,1);glVertex2f(-163+g*1.5, 129-(g*1.5*258/326)); + glTexCoord2f(1,1); glVertex2f(163+g, 129+g/4); + glTexCoord2f(1,0);glVertex2f(163+f*1.5+g/4, -129+f*1.5-g/4); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing) + STime:=Timings[13]-35; + Delay:=Timings[14]-Timings[13]+5; + if CTime > STime then + begin + k:=0; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20; + ESC_Alpha:=10; + f:=CTime-STime; + if CTime <=STime+40 then j:=CTime-STime else j:=40; + if (CTime >=STime+Delay-40) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j*j/1600); + + glPushMatrix; + gltranslatef(180+(f-70),329,0); + glBindTexture(GL_TEXTURE_2D, credits_lazyjoker.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Mog (von links reinklappen, nach rechts unten rausklappen) + STime:=Timings[14]-10; + Delay:=Timings[15]-Timings[14]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) + else + f:=0; + + g:=0; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end; + glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163+g*1.5, -129+g*1.5); + glTexCoord2f(0,1);glVertex2f(-163+g*1.2, 129+g); + glTexCoord2f(1,1); glVertex2f(163-f+g/2, 129+f*1.5+g/4); + glTexCoord2f(1,0);glVertex2f(163-f+g*1.5, -129-f*1.5); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Mota (von rechts oben reindrehen, nach links unten rausschieben und verkleinern und dabei drehen) + STime:=Timings[15]-10; + Delay:=Timings[16]-Timings[15]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(223,0,0); + glrotatef((10-(CTime-STime))*9,0,0,1); + gltranslatef(-223,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(-f*2,-f,0); + glscalef(1-j/10,1-j/10,1-j/10); + glrotatef(-j*9.0,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Skillmaster (von rechts unten reinschieben, nach rechts oben rausdrehen) + STime:=Timings[16]-10; + Delay:=Timings[17]-Timings[16]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + j:=STime+10-CTime; + f:=j*10.0; + gltranslatef(+f*2,+f/2,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + gltranslatef(0,-223,0); + glrotatef(integer(j)*-9,0,0,1); + gltranslatef(0,223,0); + glrotatef(j*9,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// WhiteShark (von links unten reinklappen, nach rechts oben rausklappen) + STime:=Timings[17]-10; + Delay:=Timings[18]-Timings[17]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) + else + f:=0; + + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end else + g:=0; + glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2); + glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4); + glTexCoord2f(1,1); glVertex2f(163-f*1.2+g/4, 129+f/2-g/4); + glTexCoord2f(1,0);glVertex2f(163-f*1.5+g/4, -129+f*1.5+g/4); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + + +// #################################################################### +// do some twinkle stuff (kinda on beat) + if (CTime>Timings[8]) and (CTime < Timings[19]) then begin + k:=0; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.2 then begin + l:=RandomRange(6,16); + j:=RandomRange(0,27); + GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); + end; + end; + +//################################################# +// draw the rest of the main screen (girl and logo + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(800-393, 0); + glTexCoord2f(0,600/1024);glVertex2f(800-393, 600); + glTexCoord2f(393/512,600/1024); glVertex2f(800, 600); + glTexCoord2f(393/512,0);glVertex2f(800, 0); + glEnd; +{ glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,112/128);glVertex2f(0, 112); + glTexCoord2f(497/512,112/128); glVertex2f(497, 112); + glTexCoord2f(497/512,0);glVertex2f(497, 0); + glEnd; +} + gldisable(gl_texture_2d); + glDisable(GL_BLEND); + + // fade out at end of main part + if Ctime > Timings[19] then + begin + glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + end + else + if (CRDTS_Stage=Outro) then + begin + if CTime=Timings[20] then begin + CTime_hold:=0; + Music.Stop; + Music.Open(soundpath + 'credits-outro-tune.mp3'); + Music.Play; + Music.SetVolume(20); + Music.SetLoop(True); + end; + if CTime_hold > 231 then begin + Music.Play; + Ctime_hold:=0; + end; + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + // do something useful + // outro background + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); + glEnd; + + //outro overlays + glColor4f(1, 1, 1, (1+sin(CTime/15))/3+1/3); + glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,223/256);glVertex2f(0, 223); + glTexCoord2f(487/512,223/256); glVertex2f(487, 223); + glTexCoord2f(487/512,0);glVertex2f(487, 0); + glEnd; + + ESC_Alpha:=20; + if (RandomRange(0,20) > 18) and (ESC_Alpha=20) then + ESC_Alpha:=0 + else inc(ESC_Alpha); + if ESC_Alpha > 20 then ESC_Alpha:=20; + glColor4f(1, 1, 1, ESC_Alpha/20); + glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(800-310, 600-247); + glTexCoord2f(0,247/256);glVertex2f(800-310, 600); + glTexCoord2f(310/512,247/256); glVertex2f(800, 600); + glTexCoord2f(310/512,0);glVertex2f(800, 600-247); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // outro scrollers? + // ... + end; + +{ // draw credits runtime counter + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (5, 5); + glColor4f(1, 1, 1, 1); +// RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10); + RuntimeStr:='CTime: '+inttostr(CTime); + glPrint (Addr(RuntimeStr[1])); +} + // make the stars shine + GoldenRec.Draw; +end; + +end. diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 5af3d4a6..7bcc9e65 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -1,276 +1,278 @@ -unit UScreenMain; - -interface - -uses - UMenu, - SDL, - UDisplay, - UMusic, - UFiles, - SysUtils, - UThemes, - ULCD, - ULight; - -type - TScreenMain = class(TMenu) - public - TextDescription: integer; - TextDescriptionLong: integer; - - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - procedure onShow; override; - procedure InteractNext; override; - procedure InteractPrev; override; - procedure InteractInc; override; - procedure InteractDec; override; - procedure UpdateLCD; - procedure SetAnimationProgress(Progress: real); override; - //function Draw: boolean; override; - end; - -implementation - -uses Windows, - UGraphic, - UMain, - UIni, - UTexture, - USongs, - Textgl, -// opengl, - ULanguage, - UParty, - UDLLManager, - UScreenCredits, - USkins; - - -function TScreenMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -var -I: Integer; -SDL_ModState: Word; -begin - Result := true; - - SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT - + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); - - //Deactivate Credits when Key is pressed -// if Credits_Visible then -// begin -// Credits_Visible := False; -// exit; -// end; - - If (PressedDown) Then - begin // Key Down - case PressedKey of - SDLK_Q: - begin - Result := false; - end; - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - Result := False; - end; - - SDLK_C: - begin - if (SDL_ModState = KMOD_LALT) then - begin - //Credits_Y := 600; - //Credits_Alpha := 0; - //Credits_Visible := True; - Music.PlayStart; - FadeTo(@ScreenCredits); - end; - end; - SDLK_M: - begin - if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then - begin - Music.PlayStart; - FadeTo(@ScreenPartyOptions); - end; - end; - - SDLK_S: - begin - Music.PlayStart; - FadeTo(@ScreenStatMain); - end; - - SDLK_E: - begin - Music.PlayStart; - FadeTo(@ScreenEdit); - end; - - SDLK_RETURN: - begin - //Solo - if (Interaction = 0) then - begin - if (Length(Songs.Song) >= 1) then - begin - Music.PlayStart; - if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1; - if (Ini.Players = 4) then PlayersPlay := 6; - - ScreenName.Goto_SingScreen := False; - FadeTo(@ScreenName); - end - else //show error message - ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); - end; - - //Multi - if Interaction = 1 then begin - if (Length(Songs.Song) >= 1) then - begin - if (Length(DLLMan.Plugins)>=1) then - begin - Music.PlayStart; - FadeTo(@ScreenPartyOptions); - end - else //show error message, No Plugins Loaded - ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS')); - end - else //show error message, No Songs Loaded - ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); - end; - - //Stats - if Interaction = 2 then begin - Music.PlayStart; - FadeTo(@ScreenStatMain); - end; - - //Editor - if Interaction = 3 then begin - Music.PlayStart; - FadeTo(@ScreenEdit); - end; - - //Options - if Interaction = 4 then begin - Music.PlayStart; - FadeTo(@ScreenOptions); - end; - - //Exit - if Interaction = 5 then begin - Result := false; - end; - end; - // Up and Down could be done at the same time, - // but I don't want to declare variables inside - // functions like this one, called so many times - SDLK_DOWN: InteractInc; - SDLK_UP: InteractDec; - SDLK_RIGHT: InteractNext; - SDLK_LEFT: InteractPrev; - end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; - end; -end; - -constructor TScreenMain.Create; -var - I: integer; -begin - inherited Create; - - //---------------- - //Attention ^^: - //New Creation Order needed because of LoadFromTheme - //and Button Collections. - //At First Custom Texts and Statics - //Then LoadFromTheme - //after LoadFromTheme the Buttons and Selects - //---------------- - - - TextDescription := AddText(Theme.Main.TextDescription); - TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong); - - LoadFromTheme(Theme.Main); - - AddButton(Theme.Main.ButtonSolo); - AddButton(Theme.Main.ButtonMulti); - AddButton(Theme.Main.ButtonStat); - AddButton(Theme.Main.ButtonEditor); - AddButton(Theme.Main.ButtonOptions); - AddButton(Theme.Main.ButtonExit); - - Interaction := 0; -end; - -procedure TScreenMain.onShow; -begin - LCD.WriteText(1, ' Choose mode: '); - UpdateLCD; -end; - -procedure TScreenMain.InteractNext; -begin - inherited InteractNext; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; - Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; - UpdateLCD; - Light.LightOne(1, 200); -end; - -procedure TScreenMain.InteractPrev; -begin - inherited InteractPrev; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; - Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; - UpdateLCD; - Light.LightOne(0, 200); -end; - -procedure TScreenMain.InteractDec; -begin - inherited InteractDec; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; - Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; - UpdateLCD; - Light.LightOne(0, 200); -end; - -procedure TScreenMain.InteractInc; -begin - inherited InteractInc; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; - Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; - UpdateLCD; - Light.LightOne(1, 200); -end; - -procedure TScreenMain.UpdateLCD; -begin - case Interaction of - 0: LCD.WriteText(2, ' sing '); - 1: LCD.WriteText(2, ' editor '); - 2: LCD.WriteText(2, ' options '); - 3: LCD.WriteText(2, ' exit '); - end -end; - -procedure TScreenMain.SetAnimationProgress(Progress: real); -begin - Static[0].Texture.ScaleW := Progress; - Static[0].Texture.ScaleH := Progress; -end; -end. +unit UScreenMain; + +interface + +uses + UMenu, + SDL, + UDisplay, + UMusic, + UFiles, + SysUtils, + UThemes, + ULCD, + ULight; + +type + TScreenMain = class(TMenu) + public + TextDescription: integer; + TextDescriptionLong: integer; + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure InteractNext; override; + procedure InteractPrev; override; + procedure InteractInc; override; + procedure InteractDec; override; + procedure UpdateLCD; + procedure SetAnimationProgress(Progress: real); override; + //function Draw: boolean; override; + end; + +implementation + +uses {$IFDEF win32} + windows, + {$ENDIF} + UGraphic, + UMain, + UIni, + UTexture, + USongs, + Textgl, +// opengl, + ULanguage, + UParty, + UDLLManager, + UScreenCredits, + USkins; + + +function TScreenMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var +I: Integer; +SDL_ModState: Word; +begin + Result := true; + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + + //Deactivate Credits when Key is pressed +// if Credits_Visible then +// begin +// Credits_Visible := False; +// exit; +// end; + + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + Result := False; + end; + + SDLK_C: + begin + if (SDL_ModState = KMOD_LALT) then + begin + //Credits_Y := 600; + //Credits_Alpha := 0; + //Credits_Visible := True; + Music.PlayStart; + FadeTo(@ScreenCredits); + end; + end; + SDLK_M: + begin + if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then + begin + Music.PlayStart; + FadeTo(@ScreenPartyOptions); + end; + end; + + SDLK_S: + begin + Music.PlayStart; + FadeTo(@ScreenStatMain); + end; + + SDLK_E: + begin + Music.PlayStart; + FadeTo(@ScreenEdit); + end; + + SDLK_RETURN: + begin + //Solo + if (Interaction = 0) then + begin + if (Length(Songs.Song) >= 1) then + begin + Music.PlayStart; + if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1; + if (Ini.Players = 4) then PlayersPlay := 6; + + ScreenName.Goto_SingScreen := False; + FadeTo(@ScreenName); + end + else //show error message + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); + end; + + //Multi + if Interaction = 1 then begin + if (Length(Songs.Song) >= 1) then + begin + if (Length(DLLMan.Plugins)>=1) then + begin + Music.PlayStart; + FadeTo(@ScreenPartyOptions); + end + else //show error message, No Plugins Loaded + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS')); + end + else //show error message, No Songs Loaded + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); + end; + + //Stats + if Interaction = 2 then begin + Music.PlayStart; + FadeTo(@ScreenStatMain); + end; + + //Editor + if Interaction = 3 then begin + Music.PlayStart; + FadeTo(@ScreenEdit); + end; + + //Options + if Interaction = 4 then begin + Music.PlayStart; + FadeTo(@ScreenOptions); + end; + + //Exit + if Interaction = 5 then begin + Result := false; + end; + end; + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN: InteractInc; + SDLK_UP: InteractDec; + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN : + begin + end; + end; +end; + +constructor TScreenMain.Create; +var + I: integer; +begin + inherited Create; + + //---------------- + //Attention ^^: + //New Creation Order needed because of LoadFromTheme + //and Button Collections. + //At First Custom Texts and Statics + //Then LoadFromTheme + //after LoadFromTheme the Buttons and Selects + //---------------- + + + TextDescription := AddText(Theme.Main.TextDescription); + TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong); + + LoadFromTheme(Theme.Main); + + AddButton(Theme.Main.ButtonSolo); + AddButton(Theme.Main.ButtonMulti); + AddButton(Theme.Main.ButtonStat); + AddButton(Theme.Main.ButtonEditor); + AddButton(Theme.Main.ButtonOptions); + AddButton(Theme.Main.ButtonExit); + + Interaction := 0; +end; + +procedure TScreenMain.onShow; +begin + LCD.WriteText(1, ' Choose mode: '); + UpdateLCD; +end; + +procedure TScreenMain.InteractNext; +begin + inherited InteractNext; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; + UpdateLCD; + Light.LightOne(1, 200); +end; + +procedure TScreenMain.InteractPrev; +begin + inherited InteractPrev; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; + UpdateLCD; + Light.LightOne(0, 200); +end; + +procedure TScreenMain.InteractDec; +begin + inherited InteractDec; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; + UpdateLCD; + Light.LightOne(0, 200); +end; + +procedure TScreenMain.InteractInc; +begin + inherited InteractInc; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; + UpdateLCD; + Light.LightOne(1, 200); +end; + +procedure TScreenMain.UpdateLCD; +begin + case Interaction of + 0: LCD.WriteText(2, ' sing '); + 1: LCD.WriteText(2, ' editor '); + 2: LCD.WriteText(2, ' options '); + 3: LCD.WriteText(2, ' exit '); + end +end; + +procedure TScreenMain.SetAnimationProgress(Progress: real); +begin + Static[0].Texture.ScaleW := Progress; + Static[0].Texture.ScaleH := Progress; +end; +end. diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 1dd31ae9..343a2e6d 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1,1236 +1,1256 @@ -unit UScreenSing; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - -uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, ULyrics, - TextGL, OpenGL12, BASS, UThemes, ULCD, UGraphicClasses, UVideo; - -type - TScreenSing = class(TMenu) - protected - paused: boolean; //Pause Mod - PauseTime: Real; - NumEmptySentences: integer; - public - //TextTime: integer; - - //TimeBar mod - StaticTimeProgress: integer; - TextTimeText: integer; - //eoa TimeBar mod - - StaticP1: integer; - StaticP1ScoreBG: integer; - TextP1: integer; - TextP1Score: integer; - - //moveable singbar mod - StaticP1SingBar: integer; - StaticP1ThreePSingBar: integer; - StaticP1TwoPSingBar: integer; - StaticP2RSingBar: integer; - StaticP2MSingBar: integer; - StaticP3SingBar: integer; - //eoa moveable singbar - - //Added for ps3 skin - //shown when game is in 2/4 player modus - StaticP1TwoP: integer; - StaticP1TwoPScoreBG: integer; - TextP1TwoP: integer; - TextP1TwoPScore: integer; - //shown when game is in 3/6 player modus - StaticP1ThreeP: integer; - StaticP1ThreePScoreBG: integer; - TextP1ThreeP: integer; - TextP1ThreePScore: integer; - //eoa - - StaticP2R: integer; - StaticP2RScoreBG: integer; - TextP2R: integer; - TextP2RScore: integer; - - StaticP2M: integer; - StaticP2MScoreBG: integer; - TextP2M: integer; - TextP2MScore: integer; - - StaticP3R: integer; - StaticP3RScoreBG: integer; - TextP3R: integer; - TextP3RScore: integer; - - Tex_Background: TTexture; - FadeOut: boolean; - LyricMain: TLyric; - LyricSub: TLyric; - - constructor Create; override; - procedure onShow; override; - procedure onShowFinish; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure Finish; virtual; - procedure UpdateLCD; - procedure Pause; //Pause Mod(Toggles Pause) - - //OnSentenceEnd for LineBonus + Singbar - procedure onSentenceEnd(S: Cardinal); - //OnSentenceChange (for Golden Notes) - procedure onSentenceChange(S: Cardinal); - end; - -implementation -uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math; - -// Method for input parsing. If False is returned, GetNextWindow -// should be checked to know the next window to load; -function TScreenSing.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then - begin // Key Down - case PressedKey of - SDLK_Q: - begin - //When not ask before Exit then Finish now - if (Ini.AskbeforeDel <> 1) then - Finish - //else just Pause and let the Popup make the Work - else if not paused then - Pause; - - Result := false; - end; - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - //Record Sound Hack: - //Sound[0].BufferLong - - Finish; - Music.PlayBack; - FadeTo(@ScreenScore); - end; - - SDLK_P://Pause Mod - begin - Pause; - end; - - SDLK_RETURN: - begin - end; - - // Up and Down could be done at the same time, - // but I don't want to declare variables inside - // functions like this one, called so many times - SDLK_DOWN : - begin - end; - SDLK_UP : - begin - end; - end; - end; -end; - -//Pause Mod -procedure TScreenSing.Pause; -begin - if not paused then //Pause einschalten - begin - // pause Time - PauseTime := Czas.Teraz; - Paused := true; - - // pause Music - Music.Pause; - - // pause Video - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then - FFmpegTogglePause; - end - else //Pause ausschalten - begin - Czas.Teraz := PauseTime; //Position of Notes - - // Position of Music - Music.MoveTo (PauseTime); - // Play Music - Music.Play; - - // Video - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then - FFmpegTogglePause; - //SkipSmpeg(PauseTime); - - Paused := false; - end; -end; -//Pause Mod End - -constructor TScreenSing.Create; -var - I: integer; - P: integer; -begin - inherited Create; - - LoadFromTheme(Theme.Sing); - - //TimeBar - StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); - TextTimeText := AddText(Theme.Sing.TextTimeText); - -// 1 player | P1 - StaticP1 := AddStatic(Theme.Sing.StaticP1); - StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); - TextP1 := AddText(Theme.Sing.TextP1); - TextP1Score := AddText(Theme.Sing.TextP1Score); - StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar); - -// 2 or 4 players | P1 - StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); - StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG); - TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); - TextP1TwoPScore := AddText(Theme.Sing.TextP1TwoPScore); - StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); - - // | P2 - StaticP2R := AddStatic(Theme.Sing.StaticP2R); - StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); - TextP2R := AddText(Theme.Sing.TextP2R); - TextP2RScore := AddText(Theme.Sing.TextP2RScore); - StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); - -// 3 or 6 players | P1 - StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); - StaticP1ThreePScoreBG := AddStatic(Theme.Sing.StaticP1ThreePScoreBG); - TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); - TextP1ThreePScore := AddText(Theme.Sing.TextP1ThreePScore); - StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar); - - // | P2 - StaticP2M := AddStatic(Theme.Sing.StaticP2M); - StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG); - TextP2M := AddText(Theme.Sing.TextP2M); - TextP2MScore := AddText(Theme.Sing.TextP2MScore); - StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar); - - // | P3 - StaticP3R := AddStatic(Theme.Sing.StaticP3R); - StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG); - TextP3R := AddText(Theme.Sing.TextP3R); - TextP3RScore := AddText(Theme.Sing.TextP3RScore); - StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar); - - if ScreenAct = 2 then begin - // katze und affe - - end; - - LyricMain := TLyric.Create; - LyricSub := TLyric.Create; - - UVideo.Init; -end; - -procedure TScreenSing.onShow; -var - P: integer; - V1: boolean; - V1TwoP: boolean; //added for ps3 skin - V1ThreeP: boolean; //added for ps3 skin - V2R: boolean; - V2M: boolean; - V3R: boolean; - NR: TRecR; //Line Bonus Mod -begin - Log.LogStatus('Begin', 'onShow'); - FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented - - // prepare players - SetLength(Player, PlayersPlay); -// Player[0].ScoreTotalI := 0; - - case PlayersPlay of - 1: begin - V1 := true; - V1TwoP := false; - V1ThreeP := false; - V2R := false; - V2M := false; - V3R := false; - end; - 2: begin - V1 := false; - V1TwoP := true; - V1ThreeP := false; - V2R := true; - V2M := false; - V3R := false; - end; - 3: begin - V1 := false; - V1TwoP := false; - V1ThreeP := true; - V2R := false; - V2M := true; - V3R := true; - end; - 4: begin // double screen - V1 := false; - V1TwoP := true; - V1ThreeP := false; - V2R := true; - V2M := false; - V3R := false; - end; - 6: begin // double screen - V1 := false; - V1TwoP := false; - V1ThreeP := true; - V2R := false; - V2M := true; - V3R := true; - end; - - end; - - //This one is shown in 1P mode - Static[StaticP1].Visible := V1; - Static[StaticP1ScoreBG].Visible := V1; - Text[TextP1].Visible := V1; - Text[TextP1Score].Visible := V1; - - - //This one is shown in 2/4P mode - Static[StaticP1TwoP].Visible := V1TwoP; - Static[StaticP1TwoPScoreBG].Visible := V1TwoP; - Text[TextP1TwoP].Visible := V1TwoP; - Text[TextP1TwoPScore].Visible := V1TwoP; - - Static[StaticP2R].Visible := V2R; - Static[StaticP2RScoreBG].Visible := V2R; - Text[TextP2R].Visible := V2R; - Text[TextP2RScore].Visible := V2R; - - - //This one is shown in 3/6P mode - Static[StaticP1ThreeP].Visible := V1ThreeP; - Static[StaticP1ThreePScoreBG].Visible := V1ThreeP; - Text[TextP1ThreeP].Visible := V1ThreeP; - Text[TextP1ThreePScore].Visible := V1ThreeP; - - Static[StaticP2M].Visible := V2M; - Static[StaticP2MScoreBG].Visible := V2M; - Text[TextP2M].Visible := V2M; - Text[TextP2MScore].Visible := V2M; - - Static[StaticP3R].Visible := V3R; - Static[StaticP3RScoreBG].Visible := V3R; - Text[TextP3R].Visible := V3R; - Text[TextP3RScore].Visible := V3R; - - // load notes - ResetSingTemp; -// Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); - AktSong := CatSongs.Song[CatSongs.Selected]; - try - if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName) then - begin - //Error Loading Song -> Go back to Song Screen and Show some Error Message - FadeTo(@ScreenSong); - //Select New Song in Party Mode - if ScreenSong.Mode = 1 then - ScreenSong.SelectRandomSong; - ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); - Exit; - end; - except - //Error Loading Song -> Go back to Song Screen and Show some Error Message - FadeTo(@ScreenSong); - //Select New Song in Party Mode - if ScreenSong.Mode = 1 then - ScreenSong.SelectRandomSong; - ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); - Exit; - end; - AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; -// AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed - - // set movie - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin -(* OpenSmpeg(AktSong.Path + AktSong.Video); - SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*) - - // todo: VideoGap and Start time verwursten - FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); - FFmpegSkip(AktSong.VideoGAP + AktSong.Start); - AktSong.VideoLoaded := true; - end; - - // set background - if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then - try - Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background); - except - log.LogError('Background could not be loaded: ' + AktSong.Path + AktSong.Background); - Tex_Background.TexNum := -1; - end - else - Tex_Background.TexNum := -1; - - - - // play music (I) - Music.CaptureStart; - Music.MoveTo(AktSong.Start); -// Music.Play; - - // prepare timer (I) -// CountSkipTimeSet; - Czas.Teraz := AktSong.Start; - Czas.Razem := Music.Length; - if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000; - Czas.OldBeat := -1; - for P := 0 to High(Player) do - ClearScores(P); - - // main text - LyricMain.Clear; - LyricMain.X := 400; - LyricMain.Y := Skin_LyricsT; - LyricMain.Scale := 1.4; //1.4 - LyricMain.Align := 1; - - // sub text - LyricSub.Clear; - LyricSub.X := 400; - LyricSub.Y := Skin_LyricsT + 35; //42 //40 - LyricSub.Align := 1; - - // set custom options - case Ini.LyricsFont of - 0: - begin - LyricMain.FontStyle := 0; - LyricSub.FontStyle := 0; - LyricMain.Size := 14; // 13 - LyricSub.Size := 14; // 13 - LyricMain.ColR := Skin_FontR; - LyricMain.ColG := Skin_FontG; - LyricMain.ColB := Skin_FontB; //Change für Crazy Joker - {LyricMain.ColSR := Skin_FontHighlightR; - LyricMain.ColSG := Skin_FontHighlightG; - LyricMain.ColSB := Skin_FontHighlightB;1aa5dc} - LyricMain.ColSR := 5/255; //26 - LyricMain.ColSG := 163/255; //165 - LyricMain.ColSB := 210/255; //220 - - LyricSub.ColR := 0.4; //0.6 - LyricSub.ColG := 0.4; //0.6 - LyricSub.ColB := 0.4; //0.6 - end; - 1: - begin - LyricMain.FontStyle := 2; - LyricSub.FontStyle := 2; - LyricMain.Size := 14; - LyricSub.Size := 14; - LyricMain.ColR := 0.75; - LyricMain.ColG := 0.75; - LyricMain.ColB := 1; - LyricMain.ColSR := 0.5; - LyricMain.ColSG := 0.5; - LyricMain.ColSB := 1; - LyricSub.ColR := 0.8; - LyricSub.ColG := 0.8; - LyricSub.ColB := 0.8; - end; - 2: - begin - LyricMain.FontStyle := 3; - LyricSub.FontStyle := 3; - LyricMain.Size := 12; - LyricSub.Size := 12; - LyricMain.ColR := 0.75; - LyricMain.ColG := 0.75; - LyricMain.ColB := 1; - LyricMain.ColSR := 0.5; - LyricMain.ColSG := 0.5; - LyricMain.ColSB := 1; - LyricSub.ColR := 0.8; - LyricSub.ColG := 0.8; - LyricSub.ColB := 0.8; - end; - end; // case - - case Ini.LyricsEffect of - 0: LyricMain.Style := 1; // 0 - one selected, 1 - selected all to the current - 1: LyricMain.Style := 2; - 2: LyricMain.Style := 3; - 3: LyricMain.Style := 4; - end; // case - - // fill texts - LyricMain.AddCzesc(0); - LyricMain.Selected := -1; - LyricSub.AddCzesc(1); - LyricSub.Selected := -1; - - UpdateLCD; - - //Deactivate Pause - Paused := False; - - //Kill all Stars not Killed yet - //GoldenStarsTwinkle Mod - GoldenRec.SentenceChange; - //GoldenStarsTwinkle Mod End - - //Set Position of Line Bonus - PhrasenBonus - if (Ini.LineBonus = 1) then //Show Line Bonus at Scores - begin - Case PlayersPlay of - 1: begin - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; - end; - - 2: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.X; - Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.X; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.X; - Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - end; - - 3: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - end; - - 4: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; - - //P4 - Player[3].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; - Player[3].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[3].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; - Player[3].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - end; - - 6: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - - //P4 - Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[3].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; - Player[3].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[3].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; - - //P5 - Player[4].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[4].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[4].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[4].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P6 - Player[5].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[5].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[5].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[5].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - end; - end; - end - else if (Ini.LineBonus = 2) then //Show Line Bonus at Notes - begin - - // positions - if Ini.SingWindow = 0 then begin - NR.Left := 120; - end else begin - NR.Left := 20; - end; - NR.Right := 780; - - NR.Width := NR.Right - NR.Left; - NR.WMid := NR.Width / 2; - NR.Mid := NR.Left + NR.WMid; - - Case PlayersPlay of - 1: begin - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := Skin_P2_NotesB - 105; - end; - - 2: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - end; - - 3: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := 120 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := 120 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := 245 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := 245 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_TargetY := 370 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_StartY := 370 + 28; - end; - - 4: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P4 - Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - end; - - 6: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := 120 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := 120 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := 245 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := 245 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_TargetY := 370 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_StartY := 370 + 28; - - //P4 - Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_TargetY := 120 - 65 + 28; - Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_StartY := 120 + 28; - - //P5 - Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[4].LineBonus_TargetY := 245 - 65 + 28; - Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[4].LineBonus_StartY := 245 + 28; - - //P6 - Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[5].LineBonus_TargetY := 370 - 65 + 28; - Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[5].LineBonus_StartY := 370 + 28; - end; - end; - end; - //Set Position of Line Bonus - PhrasenBonus End - //Set Num of Empty Sentences for Phrasen Bonus - NumEmptySentences := 0; - for P := low(Czesci[0].Czesc) to high(Czesci[0].Czesc) do - if Czesci[0].Czesc[P].TotalNotes = 0 then Inc(NumEmptySentences); - - Log.LogStatus('End', 'onShow'); -end; - -procedure TScreenSing.onShowFinish; -begin - // play movie (II) - - if AktSong.VideoLoaded then - begin - try - FFmpegGetFrame(Czas.Teraz); - FFmpegDrawGL(ScreenAct); -// PlaySmpeg; - except - //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video - AktSong.VideoLoaded := False; - Log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); - Log.LogError('Corrupted File: ' + AktSong.Video); - try -// CloseSmpeg; - FFmpegClose; - except - - end; - end; - end; - - // play music (II) - Music.Play; - - // prepare timer (II) - CountSkipTimeSet; -end; - -function TScreenSing.Draw: boolean; -var - Min: integer; - Sec: integer; - Tekst: string; - Flash: real; - S: integer; - T: integer; -begin - - - - //ScoreBG Mod | den wirren Scheiss hier brauch mer nimmer, wir haben colorized png's - no need for wirrness also - // set player colors - macht nichts weiter als die farben des statics zu wechseln, was zu unschönen effekten bei colorized png führt -{ if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - end; - if ScreenAct = 2 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P4Dark'); - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P3Dark'); - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); - end; - if ScreenAct = 2 then begin - - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P6Dark'); - - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); - end; - end; - } - - // set player names (for 2 screens and only Singstar skin) - if ScreenAct = 1 then begin - Text[TextP1].Text := 'P1'; - Text[TextP1TwoP].Text := 'P1'; - Text[TextP1ThreeP].Text := 'P1'; - Text[TextP2R].Text := 'P2'; - Text[TextP2M].Text := 'P2'; - Text[TextP3R].Text := 'P3'; - end; - - if ScreenAct = 2 then begin - case PlayersPlay of -{ 1: begin - Text[TextP1].Text := 'P2'; - end; - 2: begin - Text[TextP1].Text := 'P3'; - Text[TextP2R].Text := 'P4'; - end; - 3: begin - Text[TextP1].Text := 'P4'; - Text[TextP2M].Text := 'P5'; - Text[TextP3R].Text := 'P6'; - end;} - - 4: begin - Text[TextP1TwoP].Text := 'P3'; - Text[TextP2R].Text := 'P4'; - end; - 6: begin - Text[TextP1ThreeP].Text := 'P4'; - Text[TextP2M].Text := 'P5'; - Text[TextP3R].Text := 'P6'; - end; - end; // case - end; // if - - // stereo - -// weird stuff, maybe this is for "dual screen?", but where is player three then? | okay, i commented the stuff out the other day - nothing was missing on screen w/ 6 players - so do we even need this stuff? -// okay this stuff appears again some lines beneath this one, I commented it out for testing what it does - seems like it's doing nothing -// but I might be wrong, so what is this stuff here doing? O.o - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; - - Text[TextP1].X := Text[TextP1].X + 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; - - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; - Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; - - Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; -// end of weird stuff - - for S := 1 to 1 do //wtf? - Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X + 10*ScreenX; - - // update static menu with time ... - Min := Round(Czas.Teraz) div 60; - Sec := Round(Czas.Teraz) mod 60; - 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); - - // .. and scores - if PlayersPlay = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; - end; - - if PlayersPlay = 2 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - - if PlayersPlay = 3 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[4].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[5].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - end; - - // draw static menu (BG) - DrawBG; - //Draw Background - SingDrawBackground; - // update and draw movie - if ShowFinish and AktSong.VideoLoaded then begin - try -// UpdateSmpeg; // this only draws - // todo: find a way to determine, when a new frame is needed - // toto: same for the need to skip frames - FFmpegGetFrame(Czas.Teraz); - FFmpegDrawGL(ScreenAct); - except - //If an Error occurs drawing: prevent Video from being Drawn again and Close Video - AktSong.VideoLoaded := False; - log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); - Log.LogError('Corrupted File: ' + AktSong.Video); - try -// CloseSmpeg; - FFmpegClose; - except - - end; - end; - end; - - // draw static menu (FG) - DrawFG; - - // check for music finish -// Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(AktSong.Finish)); - if ShowFinish then begin - if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin - //Pause Mod: - if not Paused then - Sing(Self); // analyze song - end else begin -// Log.LogError('End'); - if not FadeOut then begin -// Log.LogError('End2'); - Finish; - FadeOut := true; - FadeTo(@ScreenScore); - end; - end; - end; - - // draw custom items - SingDraw; // always draw - -//GoldenNoteStarsTwinkle Mod - GoldenRec.SpawnRec; -//GoldenNoteStarsTwinkle Mod - - // back stereo - -// weird stuff, maybe this is for "dual screen?", but where is player three then? -// okay this stuff appears again some lines above this one, I commented it out for testing what it does - seems like it's doing nothing -// but I might be wrong, so what is this stuff here doing? O.o - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; - - Text[TextP1].X := Text[TextP1].X - 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; - - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; - Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; - - Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; -//weird end - - for S := 1 to 1 do // wtf? - Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X - 10*ScreenX; - -end; - -procedure TScreenSing.Finish; -begin - Music.CaptureStop; - Music.Stop; - - if Ini.SavePlayback = 1 then begin - Log.BenchmarkStart(0); - Log.LogVoice(0); - Log.LogVoice(1); - Log.LogVoice(2); - Log.BenchmarkEnd(0); - Log.LogBenchmark('Creating files', 0); - end; - - if AktSong.VideoLoaded then begin -// CloseSmpeg; - FFmpegClose; - AktSong.VideoLoaded := false; // to prevent drawing closed video - end; - - SetFontItalic (False); -end; - -procedure TScreenSing.UpdateLCD; -var - T: string; -begin - LCD.HideCursor; - LCD.Clear; - - T := LyricMain.Text; - if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; - LCD.AddTextBR(T); - - T := LyricSub.Text; - if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; - LCD.AddTextBR(T); -end; - -procedure TScreenSing.onSentenceEnd(S: Cardinal); -var -I: Integer; -A: Real; -B: integer; //Max Points for Notes -begin - - //Check for Empty Sentence - if (Czesci[0].Czesc[S].TotalNotes<=0) then - exit; - - //Set Max Note Points - if (Ini.LineBonus > 0) then - B := 9000 - else - B := 10000; - - for I := 0 to High(Player) do begin - A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2; - - //SingBar Mod - If ({(Ini.Oscilloscope = 2) and }(Czesci[0].Czesc[S].TotalNotes>0)) then - begin - Player[I].ScorePercentTarget := Player[I].ScorePercentTarget + floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 40 - 26); - if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0; - if Player[I].ScorePercentTarget > 99 then Player[I].ScorePercentTarget := 99; - - //end Singbar Mod - end; - - //PhrasenBonus - Line Bonus Mod - - //Generate Steps 0 to 8 - A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); - - If (Ini.LineBonus > 0) then - begin - - //Generate Text - if A >= 8 then - Player[I].LineBonus_Text := Theme.Sing.LineBonusText[8] - else - Player[I].LineBonus_Text := Theme.Sing.LineBonusText[Floor(A)]; - - //PhrasenBonus give Points - Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8); - Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10; - //Update Total Score - Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; - - //Color - Case Floor(A) of - 0: begin - Player[I].LineBonus_Color.R := 1; - Player[I].LineBonus_Color.G := 0; - Player[I].LineBonus_Color.B := 0; - end; - 1..3: begin - Player[I].LineBonus_Color.R := 1; - Player[I].LineBonus_Color.G := (A * 0.25); - Player[I].LineBonus_Color.B := 0; - end; - 4: begin - Player[I].LineBonus_Color.R := 1; - Player[I].LineBonus_Color.G := 1; - Player[I].LineBonus_Color.B := 0; - end; - 5..7: begin - Player[I].LineBonus_Color.R := 1-((a-4)*0.25); - Player[I].LineBonus_Color.G := 1; - Player[I].LineBonus_Color.B := 0; - end; - 8: begin - Player[I].LineBonus_Color.R := 0; - Player[I].LineBonus_Color.G := 1; - Player[I].LineBonus_Color.B := 0; - end; - End; //Case - //Player[I].LineBonus_Color.B := 0; - //Player[I].LineBonus_Color.R := (8-A)/8; - //Player[I].LineBonus_Color.G := A/10; - - Player[I].LineBonus_PosX := Player[I].LineBonus_StartX; - Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; - Player[I].LineBonus_Alpha := 0.92; - Player[I].LineBonus_Visible := True; - Player[I].LineBonus_Age := 1; - end; - //PhrasenBonus - Line Bonus Mod End// } - - //PerfectLineTwinkle Mod (effect) Pt.1 - If (Ini.EffectSing=1) then - begin - if A >= 8 then Player[I].LastSentencePerfect := True - else Player[I].LastSentencePerfect := False; - end; - //PerfectLineTwinkle Mod end - - //Refresh LastScore - Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; - - end; - - //PerfectLineTwinkle Mod (effect) Pt.2 - if Ini.EffectSing=1 then - GoldenRec.SpawnPerfectLineTwinkle; - //PerfectLineTwinkle Mod end -end; - -//Called on Sentence Change S= New Current Sentence -procedure TScreenSing.onSentenceChange(S: Cardinal); -begin - //GoldenStarsTwinkle Mod - GoldenRec.SentenceChange; - //GoldenStarsTwinkle Mod End -end; - -end. +unit UScreenSing; + +interface + +{$I switches.inc} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +uses UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + UIni, + ULog, + UTexture, + ULyrics, + TextGL, + OpenGL12, + {$IFDEF useBASS} + bass, + {$ENDIF} + UThemes, + ULCD, + UGraphicClasses, + UVideo; + +type + TScreenSing = class(TMenu) + protected + paused: boolean; //Pause Mod + PauseTime: Real; + NumEmptySentences: integer; + public + //TextTime: integer; + + //TimeBar mod + StaticTimeProgress: integer; + TextTimeText: integer; + //eoa TimeBar mod + + StaticP1: integer; + StaticP1ScoreBG: integer; + TextP1: integer; + TextP1Score: integer; + + //moveable singbar mod + StaticP1SingBar: integer; + StaticP1ThreePSingBar: integer; + StaticP1TwoPSingBar: integer; + StaticP2RSingBar: integer; + StaticP2MSingBar: integer; + StaticP3SingBar: integer; + //eoa moveable singbar + + //Added for ps3 skin + //shown when game is in 2/4 player modus + StaticP1TwoP: integer; + StaticP1TwoPScoreBG: integer; + TextP1TwoP: integer; + TextP1TwoPScore: integer; + //shown when game is in 3/6 player modus + StaticP1ThreeP: integer; + StaticP1ThreePScoreBG: integer; + TextP1ThreeP: integer; + TextP1ThreePScore: integer; + //eoa + + StaticP2R: integer; + StaticP2RScoreBG: integer; + TextP2R: integer; + TextP2RScore: integer; + + StaticP2M: integer; + StaticP2MScoreBG: integer; + TextP2M: integer; + TextP2MScore: integer; + + StaticP3R: integer; + StaticP3RScoreBG: integer; + TextP3R: integer; + TextP3RScore: integer; + + Tex_Background: TTexture; + FadeOut: boolean; + LyricMain: TLyric; + LyricSub: TLyric; + + constructor Create; override; + procedure onShow; override; + procedure onShowFinish; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure Finish; virtual; + procedure UpdateLCD; + procedure Pause; //Pause Mod(Toggles Pause) + + //OnSentenceEnd for LineBonus + Singbar + procedure onSentenceEnd(S: Cardinal); + //OnSentenceChange (for Golden Notes) + procedure onSentenceChange(S: Cardinal); + end; + +implementation +uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math; + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenSing.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_Q: + begin + //When not ask before Exit then Finish now + if (Ini.AskbeforeDel <> 1) then + Finish + //else just Pause and let the Popup make the Work + else if not paused then + Pause; + + Result := false; + end; + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + //Record Sound Hack: + //Sound[0].BufferLong + + Finish; + Music.PlayBack; + FadeTo(@ScreenScore); + end; + + SDLK_P://Pause Mod + begin + Pause; + end; + + SDLK_RETURN: + begin + end; + + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN : + begin + end; + SDLK_UP : + begin + end; + end; + end; +end; + +//Pause Mod +procedure TScreenSing.Pause; +begin + if not paused then //Pause einschalten + begin + // pause Time + PauseTime := Czas.Teraz; + Paused := true; + + // pause Music + Music.Pause; + + // pause Video + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + FFmpegTogglePause; + end + else //Pause ausschalten + begin + Czas.Teraz := PauseTime; //Position of Notes + + // Position of Music + Music.MoveTo (PauseTime); + // Play Music + Music.Play; + + // Video + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + FFmpegTogglePause; + //SkipSmpeg(PauseTime); + + Paused := false; + end; +end; +//Pause Mod End + +constructor TScreenSing.Create; +var + I: integer; + P: integer; +begin + inherited Create; + + LoadFromTheme(Theme.Sing); + + //TimeBar + StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); + TextTimeText := AddText(Theme.Sing.TextTimeText); + +// 1 player | P1 + StaticP1 := AddStatic(Theme.Sing.StaticP1); + StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); + TextP1 := AddText(Theme.Sing.TextP1); + TextP1Score := AddText(Theme.Sing.TextP1Score); + StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar); + +// 2 or 4 players | P1 + StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); + StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG); + TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); + TextP1TwoPScore := AddText(Theme.Sing.TextP1TwoPScore); + StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); + + // | P2 + StaticP2R := AddStatic(Theme.Sing.StaticP2R); + StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); + TextP2R := AddText(Theme.Sing.TextP2R); + TextP2RScore := AddText(Theme.Sing.TextP2RScore); + StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); + +// 3 or 6 players | P1 + StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); + StaticP1ThreePScoreBG := AddStatic(Theme.Sing.StaticP1ThreePScoreBG); + TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); + TextP1ThreePScore := AddText(Theme.Sing.TextP1ThreePScore); + StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar); + + // | P2 + StaticP2M := AddStatic(Theme.Sing.StaticP2M); + StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG); + TextP2M := AddText(Theme.Sing.TextP2M); + TextP2MScore := AddText(Theme.Sing.TextP2MScore); + StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar); + + // | P3 + StaticP3R := AddStatic(Theme.Sing.StaticP3R); + StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG); + TextP3R := AddText(Theme.Sing.TextP3R); + TextP3RScore := AddText(Theme.Sing.TextP3RScore); + StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar); + + if ScreenAct = 2 then begin + // katze und affe + + end; + + LyricMain := TLyric.Create; + LyricSub := TLyric.Create; + + UVideo.Init; +end; + +procedure TScreenSing.onShow; +var + P: integer; + V1: boolean; + V1TwoP: boolean; //added for ps3 skin + V1ThreeP: boolean; //added for ps3 skin + V2R: boolean; + V2M: boolean; + V3R: boolean; + NR: TRecR; //Line Bonus Mod +begin + Log.LogStatus('Begin', 'onShow'); + FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented + + // prepare players + SetLength(Player, PlayersPlay); +// Player[0].ScoreTotalI := 0; + + case PlayersPlay of + 1: begin + V1 := true; + V1TwoP := false; + V1ThreeP := false; + V2R := false; + V2M := false; + V3R := false; + end; + 2: begin + V1 := false; + V1TwoP := true; + V1ThreeP := false; + V2R := true; + V2M := false; + V3R := false; + end; + 3: begin + V1 := false; + V1TwoP := false; + V1ThreeP := true; + V2R := false; + V2M := true; + V3R := true; + end; + 4: begin // double screen + V1 := false; + V1TwoP := true; + V1ThreeP := false; + V2R := true; + V2M := false; + V3R := false; + end; + 6: begin // double screen + V1 := false; + V1TwoP := false; + V1ThreeP := true; + V2R := false; + V2M := true; + V3R := true; + end; + + end; + + //This one is shown in 1P mode + Static[StaticP1].Visible := V1; + Static[StaticP1ScoreBG].Visible := V1; + Text[TextP1].Visible := V1; + Text[TextP1Score].Visible := V1; + + + //This one is shown in 2/4P mode + Static[StaticP1TwoP].Visible := V1TwoP; + Static[StaticP1TwoPScoreBG].Visible := V1TwoP; + Text[TextP1TwoP].Visible := V1TwoP; + Text[TextP1TwoPScore].Visible := V1TwoP; + + Static[StaticP2R].Visible := V2R; + Static[StaticP2RScoreBG].Visible := V2R; + Text[TextP2R].Visible := V2R; + Text[TextP2RScore].Visible := V2R; + + + //This one is shown in 3/6P mode + Static[StaticP1ThreeP].Visible := V1ThreeP; + Static[StaticP1ThreePScoreBG].Visible := V1ThreeP; + Text[TextP1ThreeP].Visible := V1ThreeP; + Text[TextP1ThreePScore].Visible := V1ThreeP; + + Static[StaticP2M].Visible := V2M; + Static[StaticP2MScoreBG].Visible := V2M; + Text[TextP2M].Visible := V2M; + Text[TextP2MScore].Visible := V2M; + + Static[StaticP3R].Visible := V3R; + Static[StaticP3RScoreBG].Visible := V3R; + Text[TextP3R].Visible := V3R; + Text[TextP3RScore].Visible := V3R; + + // load notes + ResetSingTemp; +// Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); + AktSong := CatSongs.Song[CatSongs.Selected]; + try + if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName) then + begin + //Error Loading Song -> Go back to Song Screen and Show some Error Message + FadeTo(@ScreenSong); + //Select New Song in Party Mode + if ScreenSong.Mode = 1 then + ScreenSong.SelectRandomSong; + ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); + Exit; + end; + except + //Error Loading Song -> Go back to Song Screen and Show some Error Message + FadeTo(@ScreenSong); + //Select New Song in Party Mode + if ScreenSong.Mode = 1 then + ScreenSong.SelectRandomSong; + ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); + Exit; + end; + AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; +// AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed + + // set movie + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin +(* OpenSmpeg(AktSong.Path + AktSong.Video); + SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*) + + // todo: VideoGap and Start time verwursten + FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); + FFmpegSkip(AktSong.VideoGAP + AktSong.Start); + AktSong.VideoLoaded := true; + end; + + // set background + if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then + try + Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background); + except + log.LogError('Background could not be loaded: ' + AktSong.Path + AktSong.Background); + Tex_Background.TexNum := -1; + end + else + Tex_Background.TexNum := -1; + + + + // play music (I) + Music.CaptureStart; + Music.MoveTo(AktSong.Start); +// Music.Play; + + // prepare timer (I) +// CountSkipTimeSet; + Czas.Teraz := AktSong.Start; + Czas.Razem := Music.Length; + if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000; + Czas.OldBeat := -1; + for P := 0 to High(Player) do + ClearScores(P); + + // main text + LyricMain.Clear; + LyricMain.X := 400; + LyricMain.Y := Skin_LyricsT; + LyricMain.Scale := 1.4; //1.4 + LyricMain.Align := 1; + + // sub text + LyricSub.Clear; + LyricSub.X := 400; + LyricSub.Y := Skin_LyricsT + 35; //42 //40 + LyricSub.Align := 1; + + // set custom options + case Ini.LyricsFont of + 0: + begin + LyricMain.FontStyle := 0; + LyricSub.FontStyle := 0; + LyricMain.Size := 14; // 13 + LyricSub.Size := 14; // 13 + LyricMain.ColR := Skin_FontR; + LyricMain.ColG := Skin_FontG; + LyricMain.ColB := Skin_FontB; //Change für Crazy Joker + {LyricMain.ColSR := Skin_FontHighlightR; + LyricMain.ColSG := Skin_FontHighlightG; + LyricMain.ColSB := Skin_FontHighlightB;1aa5dc} + LyricMain.ColSR := 5/255; //26 + LyricMain.ColSG := 163/255; //165 + LyricMain.ColSB := 210/255; //220 + + LyricSub.ColR := 0.4; //0.6 + LyricSub.ColG := 0.4; //0.6 + LyricSub.ColB := 0.4; //0.6 + end; + 1: + begin + LyricMain.FontStyle := 2; + LyricSub.FontStyle := 2; + LyricMain.Size := 14; + LyricSub.Size := 14; + LyricMain.ColR := 0.75; + LyricMain.ColG := 0.75; + LyricMain.ColB := 1; + LyricMain.ColSR := 0.5; + LyricMain.ColSG := 0.5; + LyricMain.ColSB := 1; + LyricSub.ColR := 0.8; + LyricSub.ColG := 0.8; + LyricSub.ColB := 0.8; + end; + 2: + begin + LyricMain.FontStyle := 3; + LyricSub.FontStyle := 3; + LyricMain.Size := 12; + LyricSub.Size := 12; + LyricMain.ColR := 0.75; + LyricMain.ColG := 0.75; + LyricMain.ColB := 1; + LyricMain.ColSR := 0.5; + LyricMain.ColSG := 0.5; + LyricMain.ColSB := 1; + LyricSub.ColR := 0.8; + LyricSub.ColG := 0.8; + LyricSub.ColB := 0.8; + end; + end; // case + + case Ini.LyricsEffect of + 0: LyricMain.Style := 1; // 0 - one selected, 1 - selected all to the current + 1: LyricMain.Style := 2; + 2: LyricMain.Style := 3; + 3: LyricMain.Style := 4; + end; // case + + // fill texts + LyricMain.AddCzesc(0); + LyricMain.Selected := -1; + LyricSub.AddCzesc(1); + LyricSub.Selected := -1; + + UpdateLCD; + + //Deactivate Pause + Paused := False; + + //Kill all Stars not Killed yet + //GoldenStarsTwinkle Mod + GoldenRec.SentenceChange; + //GoldenStarsTwinkle Mod End + + //Set Position of Line Bonus - PhrasenBonus + if (Ini.LineBonus = 1) then //Show Line Bonus at Scores + begin + Case PlayersPlay of + 1: begin + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + end; + + 2: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.X; + Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.X; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.X; + Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + end; + + 3: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + end; + + 4: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; + + //P4 + Player[3].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; + Player[3].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[3].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; + Player[3].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + end; + + 6: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + + //P4 + Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[3].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[3].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[3].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; + + //P5 + Player[4].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[4].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[4].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[4].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P6 + Player[5].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[5].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[5].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[5].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + end; + end; + end + else if (Ini.LineBonus = 2) then //Show Line Bonus at Notes + begin + + // positions + if Ini.SingWindow = 0 then begin + NR.Left := 120; + end else begin + NR.Left := 20; + end; + NR.Right := 780; + + NR.Width := NR.Right - NR.Left; + NR.WMid := NR.Width / 2; + NR.Mid := NR.Left + NR.WMid; + + Case PlayersPlay of + 1: begin + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := Skin_P2_NotesB - 105; + end; + + 2: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + end; + + 3: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := 120 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := 120 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := 245 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := 245 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_TargetY := 370 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_StartY := 370 + 28; + end; + + 4: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P4 + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + end; + + 6: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := 120 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := 120 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := 245 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := 245 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_TargetY := 370 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_StartY := 370 + 28; + + //P4 + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_TargetY := 120 - 65 + 28; + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_StartY := 120 + 28; + + //P5 + Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[4].LineBonus_TargetY := 245 - 65 + 28; + Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[4].LineBonus_StartY := 245 + 28; + + //P6 + Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[5].LineBonus_TargetY := 370 - 65 + 28; + Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[5].LineBonus_StartY := 370 + 28; + end; + end; + end; + //Set Position of Line Bonus - PhrasenBonus End + //Set Num of Empty Sentences for Phrasen Bonus + NumEmptySentences := 0; + for P := low(Czesci[0].Czesc) to high(Czesci[0].Czesc) do + if Czesci[0].Czesc[P].TotalNotes = 0 then Inc(NumEmptySentences); + + Log.LogStatus('End', 'onShow'); +end; + +procedure TScreenSing.onShowFinish; +begin + // play movie (II) + + if AktSong.VideoLoaded then + begin + try + FFmpegGetFrame(Czas.Teraz); + FFmpegDrawGL(ScreenAct); +// PlaySmpeg; + except + //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video + AktSong.VideoLoaded := False; + Log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); + Log.LogError('Corrupted File: ' + AktSong.Video); + try +// CloseSmpeg; + FFmpegClose; + except + + end; + end; + end; + + // play music (II) + Music.Play; + + // prepare timer (II) + CountSkipTimeSet; +end; + +function TScreenSing.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + Flash: real; + S: integer; + T: integer; +begin + + + + //ScoreBG Mod | den wirren Scheiss hier brauch mer nimmer, wir haben colorized png's - no need for wirrness also + // set player colors - macht nichts weiter als die farben des statics zu wechseln, was zu unschönen effekten bei colorized png führt +{ if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P4Dark'); + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P3Dark'); + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); + end; + if ScreenAct = 2 then begin + + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P6Dark'); + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); + end; + end; + } + + // set player names (for 2 screens and only Singstar skin) + if ScreenAct = 1 then begin + Text[TextP1].Text := 'P1'; + Text[TextP1TwoP].Text := 'P1'; + Text[TextP1ThreeP].Text := 'P1'; + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; + end; + + if ScreenAct = 2 then begin + case PlayersPlay of +{ 1: begin + Text[TextP1].Text := 'P2'; + end; + 2: begin + Text[TextP1].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 3: begin + Text[TextP1].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end;} + + 4: begin + Text[TextP1TwoP].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 6: begin + Text[TextP1ThreeP].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end; + end; // case + end; // if + + // stereo + +// weird stuff, maybe this is for "dual screen?", but where is player three then? | okay, i commented the stuff out the other day - nothing was missing on screen w/ 6 players - so do we even need this stuff? +// okay this stuff appears again some lines beneath this one, I commented it out for testing what it does - seems like it's doing nothing +// but I might be wrong, so what is this stuff here doing? O.o + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + + Text[TextP1].X := Text[TextP1].X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; + + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; + Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + + Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; +// end of weird stuff + + for S := 1 to 1 do //wtf? + Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X + 10*ScreenX; + + // update static menu with time ... + Min := Round(Czas.Teraz) div 60; + Sec := Round(Czas.Teraz) mod 60; + 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); + + // .. and scores + if PlayersPlay = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + end; + + if PlayersPlay = 2 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + + if PlayersPlay = 3 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[4].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[5].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + end; + + // draw static menu (BG) + DrawBG; + //Draw Background + SingDrawBackground; + // update and draw movie + if ShowFinish and AktSong.VideoLoaded then begin + try +// UpdateSmpeg; // this only draws + // todo: find a way to determine, when a new frame is needed + // toto: same for the need to skip frames + FFmpegGetFrame(Czas.Teraz); + FFmpegDrawGL(ScreenAct); + except + //If an Error occurs drawing: prevent Video from being Drawn again and Close Video + AktSong.VideoLoaded := False; + log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); + Log.LogError('Corrupted File: ' + AktSong.Video); + try +// CloseSmpeg; + FFmpegClose; + except + + end; + end; + end; + + // draw static menu (FG) + DrawFG; + + // check for music finish +// Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(AktSong.Finish)); + if ShowFinish then begin + if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + //Pause Mod: + if not Paused then + Sing(Self); // analyze song + end else begin +// Log.LogError('End'); + if not FadeOut then begin +// Log.LogError('End2'); + Finish; + FadeOut := true; + FadeTo(@ScreenScore); + end; + end; + end; + + // draw custom items + SingDraw; // always draw + +//GoldenNoteStarsTwinkle Mod + GoldenRec.SpawnRec; +//GoldenNoteStarsTwinkle Mod + + // back stereo + +// weird stuff, maybe this is for "dual screen?", but where is player three then? +// okay this stuff appears again some lines above this one, I commented it out for testing what it does - seems like it's doing nothing +// but I might be wrong, so what is this stuff here doing? O.o + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; + + Text[TextP1].X := Text[TextP1].X - 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; + + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; + Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; + + Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; +//weird end + + for S := 1 to 1 do // wtf? + Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X - 10*ScreenX; + +end; + +procedure TScreenSing.Finish; +begin + Music.CaptureStop; + Music.Stop; + + if Ini.SavePlayback = 1 then begin + Log.BenchmarkStart(0); + Log.LogVoice(0); + Log.LogVoice(1); + Log.LogVoice(2); + Log.BenchmarkEnd(0); + Log.LogBenchmark('Creating files', 0); + end; + + if AktSong.VideoLoaded then begin +// CloseSmpeg; + FFmpegClose; + AktSong.VideoLoaded := false; // to prevent drawing closed video + end; + + SetFontItalic (False); +end; + +procedure TScreenSing.UpdateLCD; +var + T: string; +begin + LCD.HideCursor; + LCD.Clear; + + T := LyricMain.Text; + if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; + LCD.AddTextBR(T); + + T := LyricSub.Text; + if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; + LCD.AddTextBR(T); +end; + +procedure TScreenSing.onSentenceEnd(S: Cardinal); +var +I: Integer; +A: Real; +B: integer; //Max Points for Notes +begin + + //Check for Empty Sentence + if (Czesci[0].Czesc[S].TotalNotes<=0) then + exit; + + //Set Max Note Points + if (Ini.LineBonus > 0) then + B := 9000 + else + B := 10000; + + for I := 0 to High(Player) do begin + A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2; + + //SingBar Mod + If ({(Ini.Oscilloscope = 2) and }(Czesci[0].Czesc[S].TotalNotes>0)) then + begin + Player[I].ScorePercentTarget := Player[I].ScorePercentTarget + floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 40 - 26); + if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0; + if Player[I].ScorePercentTarget > 99 then Player[I].ScorePercentTarget := 99; + + //end Singbar Mod + end; + + //PhrasenBonus - Line Bonus Mod + + //Generate Steps 0 to 8 + A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); + + If (Ini.LineBonus > 0) then + begin + + //Generate Text + if A >= 8 then + Player[I].LineBonus_Text := Theme.Sing.LineBonusText[8] + else + Player[I].LineBonus_Text := Theme.Sing.LineBonusText[Floor(A)]; + + //PhrasenBonus give Points + Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8); + Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10; + //Update Total Score + Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; + + //Color + Case Floor(A) of + 0: begin + Player[I].LineBonus_Color.R := 1; + Player[I].LineBonus_Color.G := 0; + Player[I].LineBonus_Color.B := 0; + end; + 1..3: begin + Player[I].LineBonus_Color.R := 1; + Player[I].LineBonus_Color.G := (A * 0.25); + Player[I].LineBonus_Color.B := 0; + end; + 4: begin + Player[I].LineBonus_Color.R := 1; + Player[I].LineBonus_Color.G := 1; + Player[I].LineBonus_Color.B := 0; + end; + 5..7: begin + Player[I].LineBonus_Color.R := 1-((a-4)*0.25); + Player[I].LineBonus_Color.G := 1; + Player[I].LineBonus_Color.B := 0; + end; + 8: begin + Player[I].LineBonus_Color.R := 0; + Player[I].LineBonus_Color.G := 1; + Player[I].LineBonus_Color.B := 0; + end; + End; //Case + //Player[I].LineBonus_Color.B := 0; + //Player[I].LineBonus_Color.R := (8-A)/8; + //Player[I].LineBonus_Color.G := A/10; + + Player[I].LineBonus_PosX := Player[I].LineBonus_StartX; + Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; + Player[I].LineBonus_Alpha := 0.92; + Player[I].LineBonus_Visible := True; + Player[I].LineBonus_Age := 1; + end; + //PhrasenBonus - Line Bonus Mod End// } + + //PerfectLineTwinkle Mod (effect) Pt.1 + If (Ini.EffectSing=1) then + begin + if A >= 8 then Player[I].LastSentencePerfect := True + else Player[I].LastSentencePerfect := False; + end; + //PerfectLineTwinkle Mod end + + //Refresh LastScore + Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; + + end; + + //PerfectLineTwinkle Mod (effect) Pt.2 + if Ini.EffectSing=1 then + GoldenRec.SpawnPerfectLineTwinkle; + //PerfectLineTwinkle Mod end +end; + +//Called on Sentence Change S= New Current Sentence +procedure TScreenSing.onSentenceChange(S: Cardinal); +begin + //GoldenStarsTwinkle Mod + GoldenRec.SentenceChange; + //GoldenStarsTwinkle Mod End +end; + +end. diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 6d3add87..455d7b40 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -1,665 +1,669 @@ -unit UScreenSingModi; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -uses UMenu, - UMusic, - SDL, - SysUtils, - UFiles, - UTime, - USongs, - UIni, - ULog, - UTexture, - ULyrics, - TextGL, - OpenGL12, - BASS, - UThemes, - ULCD, - UScreenSing, - ModiSDK; - -type - TScreenSingModi = class(TScreenSing) - protected - //paused: boolean; //Pause Mod - //PauseTime: Real; - //NumEmptySentences: integer; - public - //TextTime: integer; - - //StaticP1: integer; - //StaticP1ScoreBG: integer; - //TextP1: integer; - //TextP1Score: integer; - - //StaticP2R: integer; - //StaticP2RScoreBG: integer; - //TextP2R: integer; - //TextP2RScore: integer; - - //StaticP2M: integer; - //StaticP2MScoreBG: integer; - //TextP2M: integer; - //TextP2MScore: integer; - - //StaticP3R: integer; - //StaticP3RScoreBG: integer; - //TextP3R: integer; - //TextP3RScore: integer; - - //Tex_Background: TTexture; - //FadeOut: boolean; - //LyricMain: TLyric; - //LyricSub: TLyric; - Winner: Byte; //Who Wins - PlayerInfo: TPlayerInfo; - TeamInfo: TTeamInfo; - - constructor Create; override; - procedure onShow; override; - //procedure onShowFinish; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure Finish; override; - //procedure UpdateLCD; - //procedure Pause; //Pause Mod(Toggles Pause) - end; - -//Procedured for Plugin -function LoadTex (const Name, Typ: PChar): TsmallTexture; stdcall; -//function Translate (const Name: PChar): PChar; stdcall; -procedure Print (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text -function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound -procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound - -//Utilys -function ToSentences(Const Czeski: TCzesci): TSentences; - -implementation -uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math, UDLLManager, USkins, UGraphicClasses; - -// Method for input parsing. If False is returned, GetNextWindow -// should be checked to know the next window to load; -function TScreenSingModi.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then - begin // Key Down - case PressedKey of - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - Finish; - Music.PlayBack; - FadeTo(@ScreenPartyScore); - end; - - else - Result := inherited ParseInput(PressedKey, ScanCode, PressedDown); - end; - end; -end; - -constructor TScreenSingModi.Create; -begin - inherited Create; - -end; - -function ToSentences(Const Czeski: TCzesci): TSentences; -var - I, J: Integer; -begin - Result.Akt := Czeski.Akt; - Result.High := Czeski.High; - Result.Ilosc := Czeski.Ilosc; - Result.Resolution := Czeski.Resolution; - Result.NotesGAP := Czeski.NotesGAP; - Result.TotalLength := Czeski.Wartosc; - - SetLength(Result.Sentence, Length(Czeski.Czesc)); - for I := low(Result.Sentence) to high(Result.Sentence) do - begin - Result.Sentence[I].Start := Czeski.Czesc[I].Start; - Result.Sentence[I].StartNote := Czeski.Czesc[I].StartNote; - Result.Sentence[I].Lyric := Czeski.Czesc[I].Lyric; - Result.Sentence[I].LyricWidth := Czeski.Czesc[I].LyricWidth; - Result.Sentence[I].Koniec := Czeski.Czesc[I].Koniec; - Result.Sentence[I].BaseNote := Czeski.Czesc[I].BaseNote; - Result.Sentence[I].HighNote := Czeski.Czesc[I].HighNut; - Result.Sentence[I].IlNut := Czeski.Czesc[I].IlNut; - Result.Sentence[I].TotalNotes := Czeski.Czesc[I].TotalNotes; - - SetLength(Result.Sentence[I].Note, Length(Czeski.Czesc[I].Nuta)); - for J := low(Result.Sentence[I].Note) to high(Result.Sentence[I].Note) do - begin - Result.Sentence[I].Note[J].Color := Czeski.Czesc[I].Nuta[J].Color; - Result.Sentence[I].Note[J].Start := Czeski.Czesc[I].Nuta[J].Start; - Result.Sentence[I].Note[J].Length := Czeski.Czesc[I].Nuta[J].Dlugosc; - Result.Sentence[I].Note[J].Ton := Czeski.Czesc[I].Nuta[J].Ton; - Result.Sentence[I].Note[J].TonGamy := Czeski.Czesc[I].Nuta[J].TonGamy; - //Result.Sentence[I].Note[J].Text := Czeski.Czesc[I].Nuta[J].Tekst; - Result.Sentence[I].Note[J].FreeStyle := Czeski.Czesc[I].Nuta[J].FreeStyle; - Result.Sentence[I].Note[J].Typ := Czeski.Czesc[I].Nuta[J].Wartosc; - end; - end; -end; - -procedure TScreenSingModi.onShow; -var - I: Integer; -begin - - PlayersPlay := TeamInfo.NumTeams; - - if DLLMan.Selected.LoadSong then //Start with Song - begin - inherited; - end - else //Start Without Song - begin - Music.CaptureStart; - end; - -//Set Playerinfo - PlayerInfo.NumPlayers := PlayersPlay; - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); - PlayerInfo.Playerinfo[I].Score := 0; - PlayerInfo.Playerinfo[I].Bar := 50; - PlayerInfo.Playerinfo[I].Enabled := True; - end; - - for I := PlayerInfo.NumPlayers to high(PlayerInfo.Playerinfo) do - begin - PlayerInfo.Playerinfo[I].Score:= 0; - PlayerInfo.Playerinfo[I].Bar := 0; - PlayerInfo.Playerinfo[I].Enabled := False; - end; - - Case PlayersPlay of - 1: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; - end; - 2,4: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1TwoPScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; - PlayerInfo.Playerinfo[2].PosX := Static[StaticP1TwoPScoreBG].Texture.X; - PlayerInfo.Playerinfo[2].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; - PlayerInfo.Playerinfo[1].PosX := Static[StaticP2RScoreBG].Texture.X; - PlayerInfo.Playerinfo[1].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; - PlayerInfo.Playerinfo[3].PosX := Static[StaticP2RScoreBG].Texture.X; - PlayerInfo.Playerinfo[3].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; - end; - 3,6: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ThreePScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; - PlayerInfo.Playerinfo[3].PosX := Static[StaticP1ThreePScoreBG].Texture.X; - PlayerInfo.Playerinfo[3].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; - PlayerInfo.Playerinfo[1].PosX := Static[StaticP2MScoreBG].Texture.X; - PlayerInfo.Playerinfo[1].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; - PlayerInfo.Playerinfo[4].PosX := Static[StaticP2MScoreBG].Texture.X; - PlayerInfo.Playerinfo[4].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; - PlayerInfo.Playerinfo[2].PosX := Static[StaticP3RScoreBG].Texture.X; - PlayerInfo.Playerinfo[2].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; - PlayerInfo.Playerinfo[5].PosX := Static[StaticP3RScoreBG].Texture.X; - PlayerInfo.Playerinfo[5].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; - end; - end; - - // play music (I) - //Music.CaptureStart; - //Music.MoveTo(AktSong.Start); - - //Init Plugin - if not DLLMan.PluginInit(TeamInfo, PlayerInfo, ToSentences(Czesci[0]), LoadTex, Print, LoadSound, PlaySound) then - begin - //Fehler - Log.LogError('Could not Init Plugin'); - Halt; - end; - - // Set Background (Little Workaround, maybe change sometime) - if (DLLMan.Selected.LoadBack) AND (DLLMan.Selected.LoadSong) then - ScreenSing.Tex_Background := Tex_Background; - - Winner := 0; - - //Set Score Visibility - if PlayersPlay = 1 then begin - Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; - Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; - end; - - if (PlayersPlay = 2) OR (PlayersPlay = 4) then begin - Text[TextP1TwoPScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP1TwoPScoreBG].Visible := DLLMan.Selected.ShowScore; - - Text[TextP2RScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP2RScoreBG].Visible := DLLMan.Selected.ShowScore; - end; - - if (PlayersPlay = 3) OR (PlayersPlay = 6) then begin - Text[TextP1ThreePScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP1ThreePScoreBG].Visible := DLLMan.Selected.ShowScore; - - Text[TextP2MScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP2MScoreBG].Visible := DLLMan.Selected.ShowScore; - - Text[TextP3RScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP3RScoreBG].Visible := DLLMan.Selected.ShowScore; - end; -end; - -function TScreenSingModi.Draw: boolean; -var - Min: integer; - Sec: integer; - Tekst: string; - S, I: integer; - T: integer; -begin -//Set Playerinfo - PlayerInfo.NumPlayers := PlayersPlay; - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - PlayerInfo.Playerinfo[I].Name := PChar(Player[I].Name); - if PlayerInfo.Playerinfo[I].Enabled then - begin - if (Player[I].ScoreTotalI<=10000) then - PlayerInfo.Playerinfo[I].Score:= Player[I].ScoreTotalI; - PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; - end; - end; - -//Show Score -if DLLMan.Selected.ShowScore then -begin - //ScoreBG Mod - // set player colors - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - - - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - - - - end; - if ScreenAct = 2 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P4Dark'); - - - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); - - - - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P3Dark'); - - - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); - - - - end; - if ScreenAct = 2 then begin - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P6Dark'); - - - - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); - - - - - end; - end; - //end ScoreBG Mod - -// set player names (for 2 screens and only Singstar skin) - if ScreenAct = 1 then begin - Text[TextP1].Text := 'P1'; - Text[TextP1TwoP].Text := 'P1'; // added for ps3 skin - Text[TextP1ThreeP].Text := 'P1'; // added for ps3 skin - Text[TextP2R].Text := 'P2'; - Text[TextP2M].Text := 'P2'; - Text[TextP3R].Text := 'P3'; - end; - - if ScreenAct = 2 then begin - case PlayersPlay of - 4: begin - Text[TextP1TwoP].Text := 'P3'; - Text[TextP2R].Text := 'P4'; - end; - 6: begin - Text[TextP1ThreeP].Text := 'P4'; - Text[TextP2M].Text := 'P5'; - Text[TextP3R].Text := 'P6'; - end; - end; // case - end; // if - - - // stereo <- and where iss P2M? or P3? - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; - - Text[TextP1].X := Text[TextP1].X + 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; - Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; - - Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; - - // .. and scores - if PlayersPlay = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; - end; - - if PlayersPlay = 2 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - - if PlayersPlay = 3 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[4].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[5].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - end; - -end; //ShowScore - - for S := 1 to 1 do - Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X + 10*ScreenX; - -if DLLMan.Selected.LoadSong then -begin - // update static menu with time ... - Min := Round(Czas.Teraz) div 60; - Sec := Round(Czas.Teraz) mod 60; - 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); -end; - - // draw static menu (BG) - DrawBG; - - //Draw Background - if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) then - SingDrawBackground; - - // comment by blindy: wo zum henker wird denn in diesem screen ein video abgespielt? - // update and draw movie - // wie wo wadd? also in der selben funktion in der uscreensing kommt des video in der zeile 995, oder was wollteste wissen? :X -{ if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin - UpdateSmpeg; // this only draws - end;} - - // draw static menu (FG) - DrawFG; - - if ShowFinish then begin - if DllMan.Selected.LoadSong then - begin - if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin - //Pause Mod: - if not Paused then - Sing(Self); // analyze song - end else begin - if not FadeOut then begin - Finish; - FadeOut := true; - FadeTo(@ScreenPartyScore); - end; - end; - end; - end; - - // draw custom items - SingModiDraw(PlayerInfo); // always draw - - //GoldenNoteStarsTwinkle Mod - GoldenRec.SpawnRec; - //GoldenNoteStarsTwinkle Mod - - //Update PlayerInfo - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - if PlayerInfo.Playerinfo[I].Enabled then - begin - PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; - PlayerInfo.Playerinfo[I].Score := Player[I].ScoreTotalI; - end; - end; - - if ((ShowFinish) AND (NOT Paused)) then - begin - if not DLLMan.PluginDraw(Playerinfo, Czesci[0].Akt) then - begin - if not FadeOut then begin - Finish; - FadeOut := true; - FadeTo(@ScreenPartyScore); - end; - end; - end; - - //Change PlayerInfo/Changeables - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - if (Player[I].ScoreTotalI <> PlayerInfo.Playerinfo[I].Score) then - begin - //Player[I].ScoreTotal := Player[I].ScoreTotal + (PlayerInfo.Playerinfo[I].Score - Player[I].ScoreTotalI); - Player[I].ScoreTotalI := PlayerInfo.Playerinfo[I].Score; - end; - if (PlayerInfo.Playerinfo[I].Bar <> Player[I].ScorePercent) then - Player[I].ScorePercentTarget := PlayerInfo.Playerinfo[I].Bar; - end; - - // back stereo - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; - - Text[TextP1].X := Text[TextP1].X - 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; - - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; - Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; - - Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; - - - for S := 1 to 1 do - Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X - 10*ScreenX; - - -end; - -procedure TScreenSingModi.Finish; -begin -inherited Finish; - -Winner := DllMan.PluginFinish(PlayerInfo); - -//Log.LogError('Winner: ' + InttoStr(Winner)); - -//DLLMan.UnLoadPlugin; -end; - -function LoadTex (const Name, Typ: PChar): TsmallTexture; stdcall; -var - Texname, EXT: String; - Tex: TTexture; -begin - //Get texture Name - TexName := Skin.GetTextureFileName(String(Name)); - //Get File Typ - Ext := ExtractFileExt(TexName); - if (uppercase(Ext) = '.JPG') then - Ext := 'JPG' - else - Ext := 'BMP'; - - Tex := Texture.LoadTexture(PChar(TexName), PChar(Ext), Typ, 0); - - Result.TexNum := Tex.TexNum; - Result.W := Tex.W; - Result.H := Tex.H; -end; -{ -function Translate (const Name: PChar): PChar; stdcall; -begin - Result := PChar(Language.Translate(String(Name))); -end; } - -procedure Print (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text -begin - SetFontItalic ((Style and 128) = 128); - SetFontStyle(Style and 7); - SetFontSize(Size); - SetFontPos (X, Y); - glPrint (PChar(Language.Translate(String(Text)))); -end; - -function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound -begin - Result := Music.LoadCustomSound(String(Name)); -end; - -procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound -begin - Music.PlayCustomSound(Index); -end; - -end. +unit UScreenSingModi; + +interface + +{$I switches.inc} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + UIni, + ULog, + UTexture, + ULyrics, + TextGL, + OpenGL12, + {$IFDEF useBASS} + bass, + {$ENDIF} + UThemes, + ULCD, + UScreenSing, + ModiSDK; + +type + TScreenSingModi = class(TScreenSing) + protected + //paused: boolean; //Pause Mod + //PauseTime: Real; + //NumEmptySentences: integer; + public + //TextTime: integer; + + //StaticP1: integer; + //StaticP1ScoreBG: integer; + //TextP1: integer; + //TextP1Score: integer; + + //StaticP2R: integer; + //StaticP2RScoreBG: integer; + //TextP2R: integer; + //TextP2RScore: integer; + + //StaticP2M: integer; + //StaticP2MScoreBG: integer; + //TextP2M: integer; + //TextP2MScore: integer; + + //StaticP3R: integer; + //StaticP3RScoreBG: integer; + //TextP3R: integer; + //TextP3RScore: integer; + + //Tex_Background: TTexture; + //FadeOut: boolean; + //LyricMain: TLyric; + //LyricSub: TLyric; + Winner: Byte; //Who Wins + PlayerInfo: TPlayerInfo; + TeamInfo: TTeamInfo; + + constructor Create; override; + procedure onShow; override; + //procedure onShowFinish; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure Finish; override; + //procedure UpdateLCD; + //procedure Pause; //Pause Mod(Toggles Pause) + end; + +//Procedured for Plugin +function LoadTex (const Name, Typ: PChar): TsmallTexture; stdcall; +//function Translate (const Name: PChar): PChar; stdcall; +procedure Print (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text +function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound +procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound + +//Utilys +function ToSentences(Const Czeski: TCzesci): TSentences; + +implementation +uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math, UDLLManager, USkins, UGraphicClasses; + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenSingModi.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + Finish; + Music.PlayBack; + FadeTo(@ScreenPartyScore); + end; + + else + Result := inherited ParseInput(PressedKey, ScanCode, PressedDown); + end; + end; +end; + +constructor TScreenSingModi.Create; +begin + inherited Create; + +end; + +function ToSentences(Const Czeski: TCzesci): TSentences; +var + I, J: Integer; +begin + Result.Akt := Czeski.Akt; + Result.High := Czeski.High; + Result.Ilosc := Czeski.Ilosc; + Result.Resolution := Czeski.Resolution; + Result.NotesGAP := Czeski.NotesGAP; + Result.TotalLength := Czeski.Wartosc; + + SetLength(Result.Sentence, Length(Czeski.Czesc)); + for I := low(Result.Sentence) to high(Result.Sentence) do + begin + Result.Sentence[I].Start := Czeski.Czesc[I].Start; + Result.Sentence[I].StartNote := Czeski.Czesc[I].StartNote; + Result.Sentence[I].Lyric := Czeski.Czesc[I].Lyric; + Result.Sentence[I].LyricWidth := Czeski.Czesc[I].LyricWidth; + Result.Sentence[I].Koniec := Czeski.Czesc[I].Koniec; + Result.Sentence[I].BaseNote := Czeski.Czesc[I].BaseNote; + Result.Sentence[I].HighNote := Czeski.Czesc[I].HighNut; + Result.Sentence[I].IlNut := Czeski.Czesc[I].IlNut; + Result.Sentence[I].TotalNotes := Czeski.Czesc[I].TotalNotes; + + SetLength(Result.Sentence[I].Note, Length(Czeski.Czesc[I].Nuta)); + for J := low(Result.Sentence[I].Note) to high(Result.Sentence[I].Note) do + begin + Result.Sentence[I].Note[J].Color := Czeski.Czesc[I].Nuta[J].Color; + Result.Sentence[I].Note[J].Start := Czeski.Czesc[I].Nuta[J].Start; + Result.Sentence[I].Note[J].Length := Czeski.Czesc[I].Nuta[J].Dlugosc; + Result.Sentence[I].Note[J].Ton := Czeski.Czesc[I].Nuta[J].Ton; + Result.Sentence[I].Note[J].TonGamy := Czeski.Czesc[I].Nuta[J].TonGamy; + //Result.Sentence[I].Note[J].Text := Czeski.Czesc[I].Nuta[J].Tekst; + Result.Sentence[I].Note[J].FreeStyle := Czeski.Czesc[I].Nuta[J].FreeStyle; + Result.Sentence[I].Note[J].Typ := Czeski.Czesc[I].Nuta[J].Wartosc; + end; + end; +end; + +procedure TScreenSingModi.onShow; +var + I: Integer; +begin + + PlayersPlay := TeamInfo.NumTeams; + + if DLLMan.Selected.LoadSong then //Start with Song + begin + inherited; + end + else //Start Without Song + begin + Music.CaptureStart; + end; + +//Set Playerinfo + PlayerInfo.NumPlayers := PlayersPlay; + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); + PlayerInfo.Playerinfo[I].Score := 0; + PlayerInfo.Playerinfo[I].Bar := 50; + PlayerInfo.Playerinfo[I].Enabled := True; + end; + + for I := PlayerInfo.NumPlayers to high(PlayerInfo.Playerinfo) do + begin + PlayerInfo.Playerinfo[I].Score:= 0; + PlayerInfo.Playerinfo[I].Bar := 0; + PlayerInfo.Playerinfo[I].Enabled := False; + end; + + Case PlayersPlay of + 1: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; + end; + 2,4: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1TwoPScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; + PlayerInfo.Playerinfo[2].PosX := Static[StaticP1TwoPScoreBG].Texture.X; + PlayerInfo.Playerinfo[2].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; + PlayerInfo.Playerinfo[1].PosX := Static[StaticP2RScoreBG].Texture.X; + PlayerInfo.Playerinfo[1].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; + PlayerInfo.Playerinfo[3].PosX := Static[StaticP2RScoreBG].Texture.X; + PlayerInfo.Playerinfo[3].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; + end; + 3,6: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ThreePScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; + PlayerInfo.Playerinfo[3].PosX := Static[StaticP1ThreePScoreBG].Texture.X; + PlayerInfo.Playerinfo[3].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; + PlayerInfo.Playerinfo[1].PosX := Static[StaticP2MScoreBG].Texture.X; + PlayerInfo.Playerinfo[1].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; + PlayerInfo.Playerinfo[4].PosX := Static[StaticP2MScoreBG].Texture.X; + PlayerInfo.Playerinfo[4].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; + PlayerInfo.Playerinfo[2].PosX := Static[StaticP3RScoreBG].Texture.X; + PlayerInfo.Playerinfo[2].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; + PlayerInfo.Playerinfo[5].PosX := Static[StaticP3RScoreBG].Texture.X; + PlayerInfo.Playerinfo[5].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; + end; + end; + + // play music (I) + //Music.CaptureStart; + //Music.MoveTo(AktSong.Start); + + //Init Plugin + if not DLLMan.PluginInit(TeamInfo, PlayerInfo, ToSentences(Czesci[0]), LoadTex, Print, LoadSound, PlaySound) then + begin + //Fehler + Log.LogError('Could not Init Plugin'); + Halt; + end; + + // Set Background (Little Workaround, maybe change sometime) + if (DLLMan.Selected.LoadBack) AND (DLLMan.Selected.LoadSong) then + ScreenSing.Tex_Background := Tex_Background; + + Winner := 0; + + //Set Score Visibility + if PlayersPlay = 1 then begin + Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; + end; + + if (PlayersPlay = 2) OR (PlayersPlay = 4) then begin + Text[TextP1TwoPScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1TwoPScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP2RScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP2RScoreBG].Visible := DLLMan.Selected.ShowScore; + end; + + if (PlayersPlay = 3) OR (PlayersPlay = 6) then begin + Text[TextP1ThreePScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1ThreePScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP2MScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP2MScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP3RScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP3RScoreBG].Visible := DLLMan.Selected.ShowScore; + end; +end; + +function TScreenSingModi.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + S, I: integer; + T: integer; +begin +//Set Playerinfo + PlayerInfo.NumPlayers := PlayersPlay; + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + PlayerInfo.Playerinfo[I].Name := PChar(Player[I].Name); + if PlayerInfo.Playerinfo[I].Enabled then + begin + if (Player[I].ScoreTotalI<=10000) then + PlayerInfo.Playerinfo[I].Score:= Player[I].ScoreTotalI; + PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; + end; + end; + +//Show Score +if DLLMan.Selected.ShowScore then +begin + //ScoreBG Mod + // set player colors + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + + + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P4Dark'); + + + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); + + + + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P3Dark'); + + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P6Dark'); + + + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); + + + + + end; + end; + //end ScoreBG Mod + +// set player names (for 2 screens and only Singstar skin) + if ScreenAct = 1 then begin + Text[TextP1].Text := 'P1'; + Text[TextP1TwoP].Text := 'P1'; // added for ps3 skin + Text[TextP1ThreeP].Text := 'P1'; // added for ps3 skin + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; + end; + + if ScreenAct = 2 then begin + case PlayersPlay of + 4: begin + Text[TextP1TwoP].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 6: begin + Text[TextP1ThreeP].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end; + end; // case + end; // if + + + // stereo <- and where iss P2M? or P3? + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + + Text[TextP1].X := Text[TextP1].X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; + Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + + Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; + + // .. and scores + if PlayersPlay = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + end; + + if PlayersPlay = 2 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + + if PlayersPlay = 3 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[4].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[5].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + end; + +end; //ShowScore + + for S := 1 to 1 do + Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X + 10*ScreenX; + +if DLLMan.Selected.LoadSong then +begin + // update static menu with time ... + Min := Round(Czas.Teraz) div 60; + Sec := Round(Czas.Teraz) mod 60; + 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); +end; + + // draw static menu (BG) + DrawBG; + + //Draw Background + if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) then + SingDrawBackground; + + // comment by blindy: wo zum henker wird denn in diesem screen ein video abgespielt? + // update and draw movie + // wie wo wadd? also in der selben funktion in der uscreensing kommt des video in der zeile 995, oder was wollteste wissen? :X +{ if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin + UpdateSmpeg; // this only draws + end;} + + // draw static menu (FG) + DrawFG; + + if ShowFinish then begin + if DllMan.Selected.LoadSong then + begin + if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + //Pause Mod: + if not Paused then + Sing(Self); // analyze song + end else begin + if not FadeOut then begin + Finish; + FadeOut := true; + FadeTo(@ScreenPartyScore); + end; + end; + end; + end; + + // draw custom items + SingModiDraw(PlayerInfo); // always draw + + //GoldenNoteStarsTwinkle Mod + GoldenRec.SpawnRec; + //GoldenNoteStarsTwinkle Mod + + //Update PlayerInfo + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + if PlayerInfo.Playerinfo[I].Enabled then + begin + PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; + PlayerInfo.Playerinfo[I].Score := Player[I].ScoreTotalI; + end; + end; + + if ((ShowFinish) AND (NOT Paused)) then + begin + if not DLLMan.PluginDraw(Playerinfo, Czesci[0].Akt) then + begin + if not FadeOut then begin + Finish; + FadeOut := true; + FadeTo(@ScreenPartyScore); + end; + end; + end; + + //Change PlayerInfo/Changeables + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + if (Player[I].ScoreTotalI <> PlayerInfo.Playerinfo[I].Score) then + begin + //Player[I].ScoreTotal := Player[I].ScoreTotal + (PlayerInfo.Playerinfo[I].Score - Player[I].ScoreTotalI); + Player[I].ScoreTotalI := PlayerInfo.Playerinfo[I].Score; + end; + if (PlayerInfo.Playerinfo[I].Bar <> Player[I].ScorePercent) then + Player[I].ScorePercentTarget := PlayerInfo.Playerinfo[I].Bar; + end; + + // back stereo + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; + + Text[TextP1].X := Text[TextP1].X - 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; + + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; + Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; + + Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; + + + for S := 1 to 1 do + Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X - 10*ScreenX; + + +end; + +procedure TScreenSingModi.Finish; +begin +inherited Finish; + +Winner := DllMan.PluginFinish(PlayerInfo); + +//Log.LogError('Winner: ' + InttoStr(Winner)); + +//DLLMan.UnLoadPlugin; +end; + +function LoadTex (const Name, Typ: PChar): TsmallTexture; stdcall; +var + Texname, EXT: String; + Tex: TTexture; +begin + //Get texture Name + TexName := Skin.GetTextureFileName(String(Name)); + //Get File Typ + Ext := ExtractFileExt(TexName); + if (uppercase(Ext) = '.JPG') then + Ext := 'JPG' + else + Ext := 'BMP'; + + Tex := Texture.LoadTexture(PChar(TexName), PChar(Ext), Typ, 0); + + Result.TexNum := Tex.TexNum; + Result.W := Tex.W; + Result.H := Tex.H; +end; +{ +function Translate (const Name: PChar): PChar; stdcall; +begin + Result := PChar(Language.Translate(String(Name))); +end; } + +procedure Print (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text +begin + SetFontItalic ((Style and 128) = 128); + SetFontStyle(Style and 7); + SetFontSize(Size); + SetFontPos (X, Y); + glPrint (PChar(Language.Translate(String(Text)))); +end; + +function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound +begin + Result := Music.LoadCustomSound(String(Name)); +end; + +procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound +begin + Music.PlayCustomSound(Index); +end; + +end. diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 7b16c315..569645d4 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1,2007 +1,2040 @@ -unit UScreenSong; - -interface -{$I switches.inc} - -uses - UMenu, SDL, UMusic, UFiles, UTime, UDisplay, USongs, SysUtils, ULog, UThemes, UTexture, ULanguage, - ULCD, ULight, UIni; - -type - TScreenSong = class(TMenu) - public - TextArtist: integer; - TextTitle: integer; - TextNumber: integer; - - //Video Icon Mod - VideoIcon: Cardinal; - - TextCat: integer; - StaticCat: integer; - - SongCurrent: real; - SongTarget: real; - - HighSpeed: boolean; - CoverFull: boolean; - CoverTime: real; - CoverX: integer; - CoverY: integer; - CoverW: integer; - is_jump: boolean; // Jump to Song Mod - is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title - - EqualizerBands: array of Byte; - EqualizerTime: Cardinal; - EqualizerTime2: Byte; - - //Party Mod - Mode: Byte; //0 = Standard, 1= Go to PartyMode after Selection + Change to Random Song at Show - //party Statics (Joker) - StaticTeam1Joker1: Cardinal; - StaticTeam1Joker2: Cardinal; - StaticTeam1Joker3: Cardinal; - StaticTeam1Joker4: Cardinal; - StaticTeam1Joker5: Cardinal; - - StaticTeam2Joker1: Cardinal; - StaticTeam2Joker2: Cardinal; - StaticTeam2Joker3: Cardinal; - StaticTeam2Joker4: Cardinal; - StaticTeam2Joker5: Cardinal; - - StaticTeam3Joker1: Cardinal; - StaticTeam3Joker2: Cardinal; - StaticTeam3Joker3: Cardinal; - StaticTeam3Joker4: Cardinal; - StaticTeam3Joker5: Cardinal; - - StaticParty: Array of Cardinal; - TextParty: Array of Cardinal; - StaticNonParty: Array of Cardinal; - TextNonParty: Array of Cardinal; - - - constructor Create; override; - procedure SetScroll; - procedure SetScroll1; - procedure SetScroll2; - procedure SetScroll3; - procedure SetScroll4; - procedure SetScroll5; - procedure SetScroll6; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure onShow; override; - procedure onHide; override; - procedure SelectNext; - procedure SelectPrev; - procedure UpdateLCD; - procedure SkipTo(Target: Cardinal); - procedure FixSelected; //Show Wrong Song when Tabs on Fix - procedure FixSelected2; //Show Wrong Song when Tabs on Fix - procedure ShowCatTL(Cat: Integer);// Show Cat in Top left - procedure ShowCatTLCustom(Caption: String);// Show Custom Text in Top left - procedure HideCatTL;// Show Cat in Tob left - procedure Refresh; //Refresh Song Sorting - procedure DrawEqualizer; - procedure ChangeMusic; - //Party Mode - procedure SelectRandomSong; - procedure SetJoker; - procedure SetStatics; - //procedures for Menu - procedure StartSong; - procedure OpenEditor; - procedure DoJoker(Team: Byte); - procedure SelectPlayers; - - procedure UnLoadDetailedCover; - - //Extensions - procedure DrawExtensions; - end; - -implementation -uses UGraphic, UMain, UCovers, math, OpenGL12, Windows, USkins, UDLLManager, UParty, UPlaylist, UScreenSongMenu; - -// ***** Public methods ****** // - -//Show Wrong Song when Tabs on Fix -procedure TScreenSong.FixSelected; -var I, I2: Integer; - begin - if CatSongs.VisibleSongs > 0 then - begin - I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do - begin - if CatSongs.Song[I].Visible then - inc(I2); - - if I = Interaction - 1 then - break; - end; - - SongCurrent := I2; - SongTarget := I2; - end; - end; - -procedure TScreenSong.FixSelected2; -var I, I2: Integer; - begin - if CatSongs.VisibleSongs > 0 then - begin - I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do - begin - if CatSongs.Song[I].Visible then - inc(I2); - - if I = Interaction - 1 then - break; - end; - - SongTarget := I2; - end; - end; -//Show Wrong Song when Tabs on Fix End - - procedure TScreenSong.ShowCatTLCustom(Caption: String);// Show Custom Text in Top left - begin - Text[TextCat].Text := Caption; - Text[TextCat].Visible := true; - Static[StaticCat].Visible := False; - end; - - //Show Cat in Top Left Mod - procedure TScreenSong.ShowCatTL(Cat: Integer); - begin - //Change - Text[TextCat].Text := CatSongs.Song[Cat].Artist; - //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover); - //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); - - Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); - //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false); - //Button[Cat]. - //Cover - - - //Show - Text[TextCat].Visible := true; - Static[StaticCat].Visible := True; - end; - - procedure TScreenSong.HideCatTL; - begin - //Hide - //Text[TextCat].Visible := false; - Static[StaticCat].Visible := false; - //New -> Show Text specified in Theme - Text[TextCat].Visible := True; - Text[TextCat].Text := Theme.Song.TextCat.Text; - end; - //Show Cat in Top Left Mod End - - -// Method for input parsing. If False is returned, GetNextWindow -// should be checked to know the next window to load; -function TScreenSong.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -var - I: integer; - I2: integer; - HS: integer; - SDL_ModState: Word; - Letter: Char; -begin - Result := true; - - //Song Screen Extensions (Jumpto + Menu) - if (ScreenSongMenu.Visible) then - begin - Result := ScreenSongMenu.ParseInput(PressedKey, ScanCode, PressedDown); - Exit; - end - else if (ScreenSongJumpto.Visible) then - begin - Result := ScreenSongJumpto.ParseInput(PressedKey, ScanCode, PressedDown); - Exit; - end; - - If (PressedDown) Then - begin // Key Down - - SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT - + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); - - //Jump to Artist/Titel - if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then - begin - Letter := UpCase(Chr(ScanCode)); - I2 := Length(CatSongs.Song); - - //Jump To Titel - if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then - begin - For I := 1 to high(CatSongs.Song) do - begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then - begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - - Music.PlayChange; - - ChangeMusic; - SetScroll4; - UpdateLCD; - //Break and Exit - Exit; - end; - end; - end - //Jump to Artist - else if (SDL_ModState = KMOD_LALT) then - begin - For I := 1 to high(CatSongs.Song) do - begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Artist[1]) = Letter) then - begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - - Music.PlayChange; - - ChangeMusic; - SetScroll4; - UpdateLCD; - - //Break and Exit - Exit; - end; - end; - end; - Exit; - end; - - case PressedKey of - SDLK_Q: - begin - Result := false; - end; - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - if (Mode = 0) then - begin - //On Escape goto Cat-List Hack - if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then - begin - //Find Category - I := Interaction; - while not catsongs.Song[I].Main do - begin - Dec (I); - if (I < low(catsongs.Song)) then - break; - end; - if (I<= 1) then - Interaction := high(catsongs.Song) - else - Interaction := I - 1; - - //Stop Music - Music.Stop; - - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - HideCatTL; - - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - //SelectPrev; - //CatSongs.Song[0].Visible := False; - end - else - begin - //On Escape goto Cat-List Hack End - //Tabs off and in Search or Playlist -> Go back to Song view - if (CatSongs.CatNumShow < -1) then - begin - //Atm: Set Empty Filter - CatSongs.SetFilter('', 0); - - //Show Cat in Top Left Mod - HideCatTL; - Interaction := 0; - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - - ChangeMusic; - end - else - begin - Music.Stop; - Music.PlayBack; - - FadeTo(@ScreenMain); - end; - - end; - end - //When in party Mode then Ask before Close - else if (Mode = 1) then - begin - Music.PlayBack; - CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); - end; - end; - SDLK_RETURN: - begin - if Length(Songs.Song) > 0 then - begin - {$IFDEF UseSerialPort} - // PortWriteB($378, 0); - {$ENDIF} - if CatSongs.Song[Interaction].Main then - begin // clicked on Category Button - - //Show Cat in Top Left Mod - ShowCatTL (Interaction); - - //I := CatSongs.VisibleIndex(Interaction); - CatSongs.ClickCategoryButton(Interaction); - {I2 := CatSongs.VisibleIndex(Interaction); - SongCurrent := SongCurrent - I + I2; - SongTarget := SongTarget - I + I2; } - -// if I<>I2 then beep; - // SetScroll4; - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - - //Play Music: - ChangeMusic; - - end else begin // clicked on song - if (Mode = 0) then //Normal Mode -> Start Song - begin - //Do the Action that is specified in Ini - case Ini.OnSongClick of - 0: StartSong; - 1: SelectPlayers; - 2:begin - If (CatSongs.CatNumShow = -3) then - ScreenSongMenu.MenuShow(SM_Playlist) - else - ScreenSongMenu.MenuShow(SM_Main); - end; - end; - end - else if (Mode = 1) then //PartyMode -> Show Menu - begin - if (Ini.PartyPopup = 1) then - ScreenSongMenu.MenuShow(SM_Party_Main) - else - ScreenSong.StartSong; - end; - end; - end; - end; - - SDLK_M: //Show SongMenu - begin - if (Length(Songs.Song) > 0) then begin - if (Mode = 0) then begin - if not CatSongs.Song[Interaction].Main then begin // clicked on Song - if CatSongs.CatNumShow = -3 then - ScreenSongMenu.MenuShow(SM_Playlist) - else - ScreenSongMenu.MenuShow(SM_Main); - end - else - begin - ScreenSongMenu.MenuShow(SM_Playlist_Load); - end; - end //Party Mode -> Show Party Menu - else ScreenSongMenu.MenuShow(SM_Party_Main); - end; - end; - - SDLK_P: //Show Playlist Menu - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin - ScreenSongMenu.MenuShow(SM_Playlist_Load); - end; - end; - - SDLK_J: //Show Jumpto Menu - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then - begin - ScreenSongJumpto.Visible := True; - end; - end; - - SDLK_DOWN: - begin - if (Mode = 0) then - begin - //Only Change Cat when not in Playlist or Search Mode - if (CatSongs.CatNumShow > -2) then - begin - //Cat Change Hack - if Ini.Tabs_at_startup = 1 then - begin - I := Interaction; - if I <= 0 then I := 1; - - while not catsongs.Song[I].Main do - begin - Inc (I); - if (I > high(catsongs.Song)) then - I := low(catsongs.Song); - end; - - Interaction := I; - - //Show Cat in Top Left Mod - ShowCatTL (Interaction); - - CatSongs.ClickCategoryButton(Interaction); - SelectNext; - FixSelected; - - //Play Music: - Music.PlayChange; - ChangeMusic; - - end; - - // - //Cat Change Hack End} - end; - end; - end; - SDLK_UP: - begin - if (Mode = 0) then - begin - //Only Change Cat when not in Playlist or Search Mode - if (CatSongs.CatNumShow > -2) then - begin - //Cat Change Hack - if Ini.Tabs_at_startup = 1 then - begin - I := Interaction; - I2 := 0; - if I <= 0 then I := 1; - - while not catsongs.Song[I].Main or (I2 = 0) do - begin - if catsongs.Song[I].Main then - Inc(I2); - Dec (I); - if (I < low(catsongs.Song)) then - I := high(catsongs.Song); - end; - - Interaction := I; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - FixSelected; - - //Play Music: - Music.PlayChange; - ChangeMusic; - end; - end; - //Cat Change Hack End} - end; - end; - - SDLK_RIGHT: - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin - Music.PlayChange; - SelectNext; -// InteractNext; -// SongTarget := Interaction; - ChangeMusic; - SetScroll4; - UpdateLCD; - Light.LightOne(1, 200); - end; - end; - - SDLK_LEFT: - begin - if (Length(Songs.Song) > 0)AND (Mode = 0) then begin - Music.PlayChange; - SelectPrev; - ChangeMusic; - SetScroll4; - UpdateLCD; - Light.LightOne(0, 200); - end; - end; - - SDLK_E: - begin - OpenEditor; - end; - - SDLK_R: - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin - - if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category - begin - I2 := 0; //Count Cats - for I:= low(CatSongs.Song) to high (CatSongs.Song) do - if CatSongs.Song[I].Main then Inc(I2); - - I2 := Random (I2)+1; //Zufall - - //Find Cat: - for I:= low(CatSongs.Song) to high (CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - Dec(I2); - if (I2<=0) then - begin - //Show Cat in Top Left Mod - ShowCatTL (I); - - Interaction := I; - - CatSongs.ShowCategoryList; - CatSongs.ClickCategoryButton(I); - SelectNext; - FixSelected; - break; - end; - end; - - - end - else if (SDL_ModState = KMOD_LCTRL) AND (Ini.Tabs_at_startup = 1) then //random in All Categorys - begin - repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; - - //Search Cat - for I := I2 downto low(CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - break; - end; - //In I ist jetzt die Kategorie in I2 der Song - - //Choose Cat - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - - //Fix: Not Existing Song selected: - //if (I+1=I2) then Inc(I2); - - //Choose Song - SkipTo(I2-I); - - end - else //Random in one Category - begin - SkipTo(Random(CatSongs.VisibleSongs)); - end; - Music.PlayChange; - - ChangeMusic; - SetScroll4; - UpdateLCD; - end; - end; - - SDLK_1: - begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[0].Joker); - SelectRandomSong; - SetJoker; - end; - end; - - SDLK_2: - begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[1].Joker); - SelectRandomSong; - SetJoker; - end; - end; - - SDLK_3: - begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[2].Joker); - SelectRandomSong; - SetJoker; - end; - end; - end; - end; -end; - -constructor TScreenSong.Create; -var - Pet: integer; - I: integer; -Label CreateSongButtons; -begin - inherited Create; - - LoadFromTheme(Theme.Song); - - TextArtist := AddText(Theme.Song.TextArtist); - TextTitle := AddText(Theme.Song.TextTitle); - TextNumber := AddText(Theme.Song.TextNumber); - - //Show Cat in Top Left mod - TextCat := AddText(Theme.Song.TextCat); - StaticCat := AddStatic(Theme.Song.StaticCat); - - //Show Video Icon Mod - VideoIcon := AddStatic(Theme.Song.VideoIcon); - - //Party Mode - StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1); - StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2); - StaticTeam1Joker3 := AddStatic(Theme.Song.StaticTeam1Joker3); - StaticTeam1Joker4 := AddStatic(Theme.Song.StaticTeam1Joker4); - StaticTeam1Joker5 := AddStatic(Theme.Song.StaticTeam1Joker5); - - StaticTeam2Joker1 := AddStatic(Theme.Song.StaticTeam2Joker1); - StaticTeam2Joker2 := AddStatic(Theme.Song.StaticTeam2Joker2); - StaticTeam2Joker3 := AddStatic(Theme.Song.StaticTeam2Joker3); - StaticTeam2Joker4 := AddStatic(Theme.Song.StaticTeam2Joker4); - StaticTeam2Joker5 := AddStatic(Theme.Song.StaticTeam2Joker5); - - StaticTeam3Joker1 := AddStatic(Theme.Song.StaticTeam3Joker1); - StaticTeam3Joker2 := AddStatic(Theme.Song.StaticTeam3Joker2); - StaticTeam3Joker3 := AddStatic(Theme.Song.StaticTeam3Joker3); - StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); - StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); - - //Load Party or NonParty specific Statics and Texts - SetLength(StaticParty, Length(Theme.Song.StaticParty)); - for I := 0 to High(Theme.Song.StaticParty) do - StaticParty[I] := AddStatic(Theme.Song.StaticParty[I]); - - SetLength(TextParty, Length(Theme.Song.TextParty)); - for I := 0 to High(Theme.Song.TextParty) do - TextParty[I] := AddText(Theme.Song.TextParty[I]); - - SetLength(StaticNonParty, Length(Theme.Song.StaticNonParty)); - for I := 0 to High(Theme.Song.StaticNonParty) do - StaticNonParty[I] := AddStatic(Theme.Song.StaticNonParty[I]); - - SetLength(TextNonParty, Length(Theme.Song.TextNonParty)); - for I := 0 to High(Theme.Song.TextNonParty) do - TextNonParty[I] := AddText(Theme.Song.TextNonParty[I]); - - // Song List -// Songs.LoadSongList; // moved to the UltraStar unit - CatSongs.Refresh; - - if (length(CatSongs.Song) > 0) then - begin - //Set Length of Button Array one Time Instead of one time for every Song - SetButtonLength(Length(CatSongs.Song)); - - I := 0; - CreateSongButtons: - - try - for Pet := I to High(CatSongs.Song) do begin // creating all buttons - // new - Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 - - if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then - CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' - - if CatSongs.Song[Pet].Cover = '' then - AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) - else begin - // cache texture if there is a need to this - if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then begin - Texture.CreateCacheMipmap := true; - Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap - Texture.CreateCacheMipmap := false; - - // puts this texture to the cache file - Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); - - // unload full size texture - Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); - - // we should also add mipmap texture by calling createtexture and use mipmap cache as data source - end; - - // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) - AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); - end; - Texture.Limit := 1024*1024; - I := -1; - end; - except - //When Error is reported the First time for this Song - if (I <> Pet) then - begin - //Some Error reporting: - Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); - - //Change Cover to NoCover and Continue Loading - CatSongs.Song[Pet].Cover := ''; - I := Pet; - end - else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song - begin - Log.LogError('NoCover Cover is damaged!'); - try - AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); - except - Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); - Halt; - end; - I := Pet + 1; - end; - end; - - if (I <> -1) then - GoTo CreateSongButtons; - - end; - - // Randomize Patch - Randomize; - //Equalizer - SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); - //ClearArray - For I := low(EqualizerBands) to high(EqualizerBands) do - EqualizerBands[I] := 3; - - if (Length(CatSongs.Song) > 0) then - Interaction := 0; -end; - -procedure TScreenSong.SetScroll; -var - VS, B: Integer; -begin - VS := CatSongs.VisibleSongs; - if VS > 0 then - begin - //Set Positions - Case Theme.Song.Cover.Style of - 3: SetScroll3; - 5:begin - if VS > 5 then - SetScroll5 - else - SetScroll4; - end; - 6: SetScroll6; - else SetScroll4; - end; - //Set Visibility of Video Icon - Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> ''); - - //Set Texts: - Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; - Text[TextTitle].Text := CatSongs.Song[Interaction].Title; - if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then - begin - Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); - Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; - end - else if (CatSongs.CatNumShow = -2) then - Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) - else if (CatSongs.CatNumShow = -3) then - Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) - else if (Ini.Tabs_at_startup = 1) then - Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) - else - Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); - end - else - begin - Text[TextNumber].Text := '0/0'; - Text[TextArtist].Text := ''; - Text[TextTitle].Text := ''; - for B := 0 to High(Button) do - Button[B].Visible := False; - - end; -end; - -procedure TScreenSong.SetScroll1; -var - B: integer; // button - BMin: integer; // button min - BMax: integer; // button max - Src: integer; -// Dst: integer; - Count: integer; // Dst is not used. Count is used. - Ready: boolean; - - VisCount: integer; // count of visible (or selectable) buttons - VisInt: integer; // visible position of interacted button - Typ: integer; // 0 when all songs fits the screen - Placed: integer; // number of placed visible buttons -begin -// Src := 0; -// Dst := -1; - Count := 1; - Typ := 0; - Ready := false; - Placed := 0; - - VisCount := 0; - for B := 0 to High(Button) do - if CatSongs.Song[B].Visible then Inc(VisCount); - - VisInt := 0; - for B := 0 to Interaction-1 do - if CatSongs.Song[B].Visible then Inc(VisInt); - - - if VisCount <= 6 then begin - Typ := 0; - end else begin - if VisInt <= 3 then begin - Typ := 1; - Count := 7; - Ready := true; - end; - - if (VisCount - VisInt) <= 3 then begin - Typ := 2; - Count := 7; - Ready := true; - end; - - if not Ready then begin - Typ := 3; - Src := Interaction; - end; - end; - - - - // hide all buttons - for B := 0 to High(Button) do begin - Button[B].Visible := false; - Button[B].Selectable := CatSongs.Song[B].Visible; - end; - -{ for B := Src to Dst do begin -// Button[B].Visible := true; - Button[B].Visible := CatSongs.Song[B].Visible; - Button[B].Selectable := Button[B].Visible; - Button[B].Y := 140 + (B-Src) * 60; - end;} - - - if Typ = 0 then begin - for B := 0 to High(Button) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (Placed) * 60; - Inc(Placed); - end; - end; - end; - - if Typ = 1 then begin - B := 0; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Inc(B); - end; - end; - - if Typ = 2 then begin - B := High(Button); - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (6-Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Dec(B); - end; - end; - - if Typ = 3 then begin - B := Src; - Count := 4; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (3+Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Inc(B); - end; - - B := Src-1; - Placed := 0; - Count := 3; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (2-Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Dec(B); - end; - - end; - - if Length(Button) > 0 then - Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture -end; - -procedure TScreenSong.SetScroll2; -var - B: integer; - Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu - Wsp2: real; -begin - // liniowe - for B := 0 to High(Button) do - Button[B].X := 300 + (B - Interaction) * 260; - - if Length(Button) >= 3 then begin - if Interaction = 0 then - Button[High(Button)].X := 300 - 260; - - if Interaction = High(Button) then - Button[0].X := 300 + 260; - end; - - // kolowe -{ for B := 0 to High(Button) do begin - Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. - Wsp2 := Wsp / Length(Button); - Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); -// Button[B].Y := 140 + 50 * ; - end;} -end; - -procedure TScreenSong.SetScroll3; // with slide -var - B: integer; - Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu - Wsp2: real; -begin - SongTarget := Interaction; - - // liniowe - for B := 0 to High(Button) do - begin - Button[B].X := 300 + (B - SongCurrent) * 260; - if (Button[B].X < -Button[B].W) OR (Button[B].X > 800) then - Button[B].Visible := False - else - Button[B].Visible := True; - end; - -{ if Length(Button) >= 3 then begin - if Interaction = 0 then - Button[High(Button)].X := 300 - 260; - - if Interaction = High(Button) then - Button[0].X := 300 + 260; - end;} - - // kolowe -{ for B := 0 to High(Button) do begin - Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. - Wsp2 := Wsp / Length(Button); - Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); -// Button[B].Y := 140 + 50 * ; - end;} -end; - -procedure TScreenSong.SetScroll4; // rotate -var - B: integer; - Wsp: real; - Z, Z2: real; - VS: integer; -begin - VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important - - // kolowe - for B := 0 to High(Button) do begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2; - Z2 := (1 + 2*Z) / 3; - - - Button[B].X := Theme.Song.Cover.X + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - Button[B].Z := Z / 2 + 0.3; - - Button[B].W := Theme.Song.Cover.H * Z2; - -// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; - Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; - Button[B].H := Button[B].W; - end; - end; -end; - -(* -procedure TScreenSong.SetScroll4; // rotate -var - B: integer; - Wsp: real; - Z: real; - Z2, Z3: real; - VS: integer; - function modreal (const X, Y: real):real; - begin - Result := Frac(x / y) * y; - if Result < -3 then - Result := Result + Y - else if Result > 3 then - Result := Result - Y; - end; -begin - VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important - Z3 := 1; - if VS < 12 then - Z2 := VS - else - Z2 := 12; - - // kolowe - for B := 0 to High(Button) do begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - if ((ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)>-3) AND (ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)<3)) then - begin - if CatSongs.VisibleIndex(B)> SongCurrent then - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2 - else - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2; - - Z3 := 2; - Z := (1 + cos(Wsp)) / 2; - //Z2 := (1 + 2*Z) / 3; - //Z2 := (0.5 + Z/2); - //Z2 := sin(Wsp); - - //Z2 := Power (Z2,Z3); - - Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); - - //Button[B].X := Theme.Song.CoverX + ({Theme.Song.CoverX + Theme.Song.CoverW/2 + Theme.Song.CoverW*0.18 * VS {CatSongs.VisibleSongs {Length(Button) * sin(Wsp) {- Theme.Song.CoverX - Theme.Song.CoverW) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - if (sin(Wsp)<0) then - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W - else //*Theme.Song.CoverW*0.004*Z3 - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; - Button[B].Z := Z-0.00001; - -// Button[B].Y := {50 + 140 + 50 - 50 * Z2; - // Button[B].Y := (Theme.Song.CoverY + 40 + 50 - 50 * Z2); - Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); - Button[B].H := Button[B].W; - Button[B].Visible := True; - end - {else if (((CatSongs.VisibleIndex(B) - SongCurrent)>-3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) OR ((round (CatSongs.VisibleIndex(B) - SongCurrent) mod VS > -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) then - begin - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / 12 ;// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2 -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); - - if (sin(Wsp)<0) then - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W - else - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; - - Button[B].Z := Z; - - Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); - - Button[B].H := Button[B].W; - Button[B].Visible := True; - end - else Button[B].Visible := False; - end; - end; -end; *) - -procedure TScreenSong.SetScroll5; // rotate -var - B: integer; - Angle: real; - Pos: Real; - VS: integer; - diff: real; - X: Real; - helper: real; -begin - VS := CatSongs.VisibleSongs; // cache Visible Songs - {Vars - Theme.Song.CoverW: Radius des Kreises - Theme.Song.CoverX: X Pos Linke Kante des gewählten Covers - Theme.Song.CoverX: Y Pos Obere Kante des gewählten Covers - Theme.Song.CoverH: Höhe der Cover - - (CatSongs.VisibleIndex(B) - SongCurrent)/VS = Abstand zum MIttleren Cover in % - } - - //Change Pos of all Buttons - for B := low(Button) to high(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility - if Button[B].Visible then //Only Change Pos for Visible Buttons - begin - Pos := (CatSongs.VisibleIndex(B) - SongCurrent); - if (Pos < -VS/2) then - Pos := Pos + VS - else if (Pos > VS/2) then - Pos := Pos - VS; - - if (Abs(Pos) < 2.5) then {fixed Positions} - begin - Angle := Pi * (Pos / 5); -// Button[B].Visible := False; - - Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); - -// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Z := 0.95 - Abs(Pos) * 0.01; - - Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); - - Button[B].W := Button[B].H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - - X := Sin(Angle*1.3)*0.9; - - Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Diff; - - end - else - begin {Behind the Front Covers} - - // limit-bg-covers hack - if (abs(abs(Pos)-VS/2)>10) then Button[B].Visible:=False; - // end of limit-bg-covers hack - - if Pos < 0 then - Pos := (Pos - VS/2)/VS - else - Pos := (Pos + VS/2)/VS; - - Angle := pi * Pos*2; - if VS > 24 then - begin - if Angle < 0 then helper:=-1 else helper:=1; - Angle:=2*pi-abs(Angle); - Angle:=Angle*(VS/24); - Angle:=(2*pi-Angle)*helper; - end; - - Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); - - Button[B].W := Button[B].H; - - Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; - -// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*((Theme.Song.Cover.H)*sin(Angle/2)*1.52); - - end; - - //Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field -// Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); - - end; - end; -end; - -procedure TScreenSong.SetScroll6; // rotate (slotmachine style) -var - B: integer; - Angle: real; - Pos: Real; - VS: integer; - diff: real; - X: Real; - Wsp: real; - Z, Z2: real; -begin - VS := CatSongs.VisibleSongs; // cache Visible Songs - if VS <=5 then begin - // kolowe - for B := 0 to High(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2; - Z2 := (1 + 2*Z) / 3; - - - Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - Button[B].Z := Z / 2 + 0.3; - - Button[B].W := Theme.Song.Cover.H * Z2; - -// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; - Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; - Button[B].H := Button[B].W; - end; - end; - end - else begin - - //Change Pos of all Buttons - for B := low(Button) to high(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility - if Button[B].Visible then //Only Change Pos for Visible Buttons - begin - Pos := (CatSongs.VisibleIndex(B) - SongCurrent); - if (Pos < -VS/2) then - Pos := Pos + VS - else if (Pos > VS/2) then - Pos := Pos - VS; - - if (Abs(Pos) < 2.5) then {fixed Positions} - begin - Angle := Pi * (Pos / 5); -// Button[B].Visible := False; - - Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); - - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Z := 0.95 - Abs(Pos) * 0.01; - - Button[B].X := (Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); - - Button[B].W := Button[B].H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - - X := Sin(Angle*1.3)*0.9; - - Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff; - end - else - begin {Behind the Front Covers} - - // limit-bg-covers hack - if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; - if VS > 25 then VS:=25; - // end of limit-bg-covers hack - - if Pos < 0 then - Pos := (Pos - VS/2)/VS - else - Pos := (Pos + VS/2)/VS; - - Angle := pi * Pos*2; - - Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); - - Button[B].W := Button[B].H; - - Button[B].X := Theme.Song.Cover.X - (Button[B].H - Theme.Song.Cover.H)*0.5; - - - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Y := Theme.Song.Cover.Y+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*(Theme.Song.Cover.H*sin(Angle/2)*1.52); - end; - end; - end; - end; -end; - - -procedure TScreenSong.onShow; -begin - Music.Stop; - - if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; - if Ini.Players = 4 then PlayersPlay := 6; - - //Cat Mod etc - if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then - begin - CatSongs.ShowCategoryList; - FixSelected; - //Show Cat in Top Left Mod - HideCatTL; - end; - - - if Length(CatSongs.Song) > 0 then begin - //Load Music only when Song Preview is activated - if (Ini.PreviewVolume <> 0) then - begin - Music.SetLoop(false); - Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); - Music.MoveTo(Music.Length / 4); - Music.Play; - - //Set Preview Volume - Music.SetMusicVolume (Ini.PreviewVolume * 10); - {//if Music Fade is activated, Set Volume to 0 % - if (Ini.PreviewFading <> 0) then - Music.SetMusicVolume(0);} - end; - - SetScroll; - UpdateLCD; - end; - - //Playlist Mode - if (Mode = 0) then - begin - //If Playlist Shown -> Select Next automatically - if (CatSongs.CatNumShow = -3) then - begin - SelectNext; - ChangeMusic; - end; - end - //Party Mode - else if (Mode = 1) then - begin - - SelectRandomSong; - //Show Menu directly in PartyMode - //But only if selected in Options - if (Ini.PartyPopup = 1) then - begin - ScreenSongMenu.MenuShow(SM_Party_Main); - end; - - - end; - - SetJoker; - SetStatics; -end; - -procedure TScreenSong.onHide; -begin - //When Music Fading is activated, Turn Music to 100 % - If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then - Music.SetMusicVolume(100); - - //If Preview is deactivated: Load MUsicfile now - If (Ini.PreviewVolume = 0) then - Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); - - //When hide then Stop Music (For Party Mode Popup on Exit) - if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then - Music.Stop; -end; - -procedure TScreenSong.DrawExtensions; -begin - //Draw Song Menu - if (ScreenSongMenu.Visible) then - begin - ScreenSongMenu.Draw; - end - else if (ScreenSongJumpto.Visible) then - begin - ScreenSongJumpto.Draw; - end -end; - -function TScreenSong.Draw: boolean; -var - dx: real; - dt: real; - I: Integer; -begin - dx := SongTarget-SongCurrent; - dt := TimeSkip*7; - if dt > 1 then dt := 1; - SongCurrent := SongCurrent + dx*dt; - -{ if SongCurrent > Catsongs.VisibleSongs then begin - SongCurrent := SongCurrent - Catsongs.VisibleSongs; - SongTarget := SongTarget - Catsongs.VisibleSongs; - end;} - -// Log.BenchmarkStart(5); - SetScroll; -// Log.BenchmarkEnd(5); -// Log.LogBenchmark('SetScroll4', 5); - - //Fading Functions, Only if Covertime is under 5 Seconds - If (CoverTime < 5) then - begin - // 0.5.0: cover fade - if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin - // load new texture - Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); - Button[Interaction].Texture.Alpha := 1; - Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); - Button[Interaction].Texture2.Alpha := 1; - end; - - //Song Fade - if (CatSongs.VisibleSongs > 0) AND (Ini.PreviewVolume <> 0) AND (Not CatSongs.Song[Interaction].Main) AND (Ini.PreviewFading <> 0) then - begin - //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling - if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then - Music.Play; - - //Update Song Volume - if (CoverTime < Ini.PreviewFading) then - Music.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) - else - Music.SetMusicVolume(Ini.PreviewVolume * 10); - - end; - - - //Update Fading Time - CoverTime := CoverTime + TimeSkip; - - //Update Fading Texture - Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; - if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; - - end; - - //inherited Draw; - //heres a little Hack, that causes the Statics - //are Drawn after the Buttons because of some Blending Problems. - //This should cause no Problems because all Buttons on this screen - //Has Z Position. - //Draw BG - DrawBG; - - //Instead of Draw FG Procedure: - //We draw Buttons for our own - for I := 0 to Length(Button) - 1 do - Button[I].Draw; - - // Statics - for I := 0 to Length(Static) - 1 do - Static[I].Draw; - - // and texts - for I := 0 to Length(Text) - 1 do - Text[I].Draw; - - - //Draw Equalizer - if Theme.Song.Equalizer.Visible then - DrawEqualizer; - - DrawExtensions; - -end; - -procedure TScreenSong.SelectNext; -var - Skip: integer; - I: integer; - VS: Integer; -begin - VS := CatSongs.VisibleSongs; - - if VS > 0 then - begin - UnLoadDetailedCover; - - Skip := 1; - - // this 1 could be changed by CatSongs.FindNextVisible - while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); - - SongTarget := SongTarget + 1;//Skip; - - Interaction := (Interaction + Skip) mod Length(Interactions); - - // try to keep all at the beginning - if SongTarget > VS-1 then begin - SongTarget := SongTarget - VS; - SongCurrent := SongCurrent - VS; - end; - - end; - // Interaction -> Button, ktorego okladke przeczytamy - // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture -end; - -procedure TScreenSong.SelectPrev; -var - Skip: integer; - I: integer; - VS: Integer; -begin - VS := CatSongs.VisibleSongs; - - if VS > 0 then - begin - UnLoadDetailedCover; - - Skip := 1; - - while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); - SongTarget := SongTarget - 1;//Skip; - - Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); - - // try to keep all at the beginning - if SongTarget < 0 then begin - SongTarget := SongTarget + CatSongs.VisibleSongs; - SongCurrent := SongCurrent + CatSongs.VisibleSongs; - end; - - // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture - end; -end; - -procedure TScreenSong.UpdateLCD; -begin - LCD.HideCursor; - LCD.Clear; - LCD.WriteText(1, Text[TextArtist].Text); - LCD.WriteText(2, Text[TextTitle].Text); -end; - -//Procedure Change current played Preview -procedure TScreenSong.ChangeMusic; -begin - //When Music Preview is avtivated -> then Change Music - if (Ini.PreviewVolume <> 0) then - begin - if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then - begin - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); - //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal - if (Ini.PreviewFading = 0) then - Music.Play - else - Music.SetMusicVolume(0); - end; - end - else - Music.Stop; - end; -end; - -procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0 -var - Skip: integer; - I: integer; -begin - UnLoadDetailedCover; - - Interaction := High(CatSongs.Song); - SongTarget := 0; - - for I := 1 to Target+1 do - SelectNext; - - FixSelected2; -end; - -procedure TScreenSong.DrawEqualizer; -var - Data: TFFTData; //Audio Data - I, J: Integer; - Res: byte; - A, B: Integer; - PosX, PosY: Integer; - Pos: Real; -begin -if (not Music.Finished) AND (Theme.Song.Equalizer.Length > 0) then -begin - - - A := GetTickCount div 44; - - if (A <> EqualizerTime) then - begin - EqualizerTime := A; - Data := Music.GetFFTData; - - B:=0; - Pos := 0; - Res := ceil(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band - - //Change Lengths - for I := 0 to (Res * Theme.Song.Equalizer.Bands - 1) do - begin - A := floor(I/Res); - - if (A<>B) then //Band changed - begin - if (Pos <= Theme.Song.Equalizer.Length) then - begin - if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then - EqualizerBands[B] := EqualizerBands[B] - 1 - else - EqualizerBands[B] := floor(Pos); - end - else - EqualizerBands[B] := 1; - - B := A; - Pos := 0; - end; - - if I > 35 then - Data[i] := Data[i] * 8 - else if I > 11 then - Data[i] := Data[i] * 4.5 - else - Data[i] := Data[i] * 1.1; - - if (Data[i] >= 1) then - Data[i] := 0.9999999999999; - - if Data[i]*Theme.Song.Equalizer.Length > Pos then - Pos := Data[i]*Theme.Song.Equalizer.Length; - end; - - //Change Last Band - if (EqualizerBands[B] <= Theme.Song.Equalizer.Length) then - begin - if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then - EqualizerBands[B] := EqualizerBands[B] - 1 - else - EqualizerBands[B] := floor(Pos) - end - else - EqualizerBands[B] := 1; - end; - - //Draw every Channel - glColor4f(Theme.Song.Equalizer.ColR, Theme.Song.Equalizer.ColG, Theme.Song.Equalizer.ColB, Theme.Song.Equalizer.Alpha); //Set Color - glDisable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - - PosY := Theme.Song.Equalizer.Y; - PosX := Theme.Song.Equalizer.X; - - For I := 0 to Theme.Song.Equalizer.Bands-1 do - begin - if Theme.Song.Equalizer.Direction then - PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length - else - PosX := Theme.Song.Equalizer.X; - //Draw for every visible quad - for J := 1 to EqualizerBands[I] do - begin - glBegin(GL_QUADS); - glVertex3f(PosX, PosY, Theme.Song.Equalizer.Z); - glVertex3f(PosX, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); - glVertex3f(PosX+Theme.Song.Equalizer.W, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); - glVertex3f(PosX+Theme.Song.Equalizer.W, PosY, Theme.Song.Equalizer.Z); - glEnd; - - if Theme.Song.Equalizer.Direction then //Vertically - PosY := PosY - Theme.Song.Equalizer.H - Theme.Song.Equalizer.Space - else //Horizontally - PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space; - end; - if Theme.Song.Equalizer.Direction then //Horizontally - PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space - else //Vertically - PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space; - end; -end; -end; - -Procedure TScreenSong.SelectRandomSong; -var - I, I2: Integer; -begin - Case PlaylistMan.Mode of - 0: //All Songs Just Select Random Song - begin - //When Tabs are activated then use Tab Method - if (Ini.Tabs_at_startup = 1) then - begin - repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; - - //Search Cat - for I := I2 downto low(CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - break; - end; - //In I ist jetzt die Kategorie in I2 der Song - //I is the CatNum, I2 is the No of the Song within this Cat - - //Choose Cat - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - - //Choose Song - SkipTo(I2-I); - end - //When Tabs are deactivated use easy Method - else - SkipTo(Random(CatSongs.VisibleSongs)); - end; - 1: //One Category Select Category and Select Random Song - begin - CatSongs.ShowCategoryList; - CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); - ShowCatTL(PlaylistMan.CurPlayList); - - SelectNext; - FixSelected2; - - SkipTo(Random(CatSongs.VisibleSongs)); - end; - 2: //Playlist: Select Playlist and Select Random Song - begin - PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); - - SkipTo(Random(CatSongs.VisibleSongs)); - FixSelected2; - end; - end; - - Music.PlayChange; - ChangeMusic; - SetScroll; - UpdateLCD; -end; - -procedure TScreenSong.SetJoker; -begin - //If Party Mode - if Mode = 1 then //Show Joker that are available - begin - if (PartySession.Teams.NumTeams >= 1) then - begin - Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1); - Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2); - Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3); - Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4); - Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5); - end - else - begin - Static[StaticTeam1Joker1].Visible := False; - Static[StaticTeam1Joker2].Visible := False; - Static[StaticTeam1Joker3].Visible := False; - Static[StaticTeam1Joker4].Visible := False; - Static[StaticTeam1Joker5].Visible := False; - end; - - if (PartySession.Teams.NumTeams >= 2) then - begin - Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1); - Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2); - Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3); - Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4); - Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5); - end - else - begin - Static[StaticTeam2Joker1].Visible := False; - Static[StaticTeam2Joker2].Visible := False; - Static[StaticTeam2Joker3].Visible := False; - Static[StaticTeam2Joker4].Visible := False; - Static[StaticTeam2Joker5].Visible := False; - end; - - if (PartySession.Teams.NumTeams >= 3) then - begin - Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1); - Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2); - Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3); - Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4); - Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5); - end - else - begin - Static[StaticTeam3Joker1].Visible := False; - Static[StaticTeam3Joker2].Visible := False; - Static[StaticTeam3Joker3].Visible := False; - Static[StaticTeam3Joker4].Visible := False; - Static[StaticTeam3Joker5].Visible := False; - end; - end - else - begin //Hide all - Static[StaticTeam1Joker1].Visible := False; - Static[StaticTeam1Joker2].Visible := False; - Static[StaticTeam1Joker3].Visible := False; - Static[StaticTeam1Joker4].Visible := False; - Static[StaticTeam1Joker5].Visible := False; - - Static[StaticTeam2Joker1].Visible := False; - Static[StaticTeam2Joker2].Visible := False; - Static[StaticTeam2Joker3].Visible := False; - Static[StaticTeam2Joker4].Visible := False; - Static[StaticTeam2Joker5].Visible := False; - - Static[StaticTeam3Joker1].Visible := False; - Static[StaticTeam3Joker2].Visible := False; - Static[StaticTeam3Joker3].Visible := False; - Static[StaticTeam3Joker4].Visible := False; - Static[StaticTeam3Joker5].Visible := False; - end; -end; - -procedure TScreenSong.SetStatics; -var - I: Integer; - Visible: Boolean; -begin - //Set Visibility of Party Statics and Text - Visible := (Mode = 1); - - For I := 0 to high(StaticParty) do - Static[StaticParty[I]].Visible := Visible; - - For I := 0 to high(TextParty) do - Text[TextParty[I]].Visible := Visible; - - //Set Visibility of Non Party Statics and Text - Visible := not Visible; - - For I := 0 to high(StaticNonParty) do - Static[StaticNonParty[I]].Visible := Visible; - - For I := 0 to high(TextNonParty) do - Text[TextNonParty[I]].Visible := Visible; -end; - -//Procedures for Menu - -procedure TScreenSong.StartSong; -begin - CatSongs.Selected := Interaction; - Music.Stop; - //Party Mode - if (Mode = 1) then - begin - FadeTo(@ScreenSingModi); - end - else - begin - FadeTo(@ScreenSing); - end; -end; - -procedure TScreenSong.SelectPlayers; -begin - CatSongs.Selected := Interaction; - Music.Stop; - - ScreenName.Goto_SingScreen := True; - FadeTo(@ScreenName); -end; - -procedure TScreenSong.OpenEditor; -begin - if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin - Music.Stop; - Music.PlayStart; - ScreenEditSub.Path := CatSongs.Song[Interaction].Path; - ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName; - FadeTo(@ScreenEditSub); - end; -end; - -//Team No of Team (0-5) -procedure TScreenSong.DoJoker (Team: Byte); -begin - if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[Team].Joker); - SelectRandomSong; - SetJoker; - end; -end; - -//Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song -procedure TScreenSong.UnLoadDetailedCover; -begin - CoverTime := 0; - - Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture - Button[Interaction].Texture2.Alpha := 0; - - if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then - Texture.UnloadTexture(Button[Interaction].Texture.Name, false); -end; - -procedure TScreenSong.Refresh; -begin { -CatSongs.Refresh; -CatSongs.ShowCategoryList; -Interaction := 0; -SelectNext; -FixSelected; } - -end; - -end. +unit UScreenSong; + +interface +{$I switches.inc} + +uses + UMenu, + SDL, + UMusic, + UFiles, + UTime, + UDisplay, + USongs, + SysUtils, + ULog, + UThemes, + UTexture, + ULanguage, + ULCD, + ULight, + UIni; + +type + TScreenSong = class(TMenu) + public + TextArtist: integer; + TextTitle: integer; + TextNumber: integer; + + //Video Icon Mod + VideoIcon: Cardinal; + + TextCat: integer; + StaticCat: integer; + + SongCurrent: real; + SongTarget: real; + + HighSpeed: boolean; + CoverFull: boolean; + CoverTime: real; + CoverX: integer; + CoverY: integer; + CoverW: integer; + is_jump: boolean; // Jump to Song Mod + is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title + + EqualizerBands: array of Byte; + EqualizerTime: Cardinal; + EqualizerTime2: Byte; + + //Party Mod + Mode: Byte; //0 = Standard, 1= Go to PartyMode after Selection + Change to Random Song at Show + //party Statics (Joker) + StaticTeam1Joker1: Cardinal; + StaticTeam1Joker2: Cardinal; + StaticTeam1Joker3: Cardinal; + StaticTeam1Joker4: Cardinal; + StaticTeam1Joker5: Cardinal; + + StaticTeam2Joker1: Cardinal; + StaticTeam2Joker2: Cardinal; + StaticTeam2Joker3: Cardinal; + StaticTeam2Joker4: Cardinal; + StaticTeam2Joker5: Cardinal; + + StaticTeam3Joker1: Cardinal; + StaticTeam3Joker2: Cardinal; + StaticTeam3Joker3: Cardinal; + StaticTeam3Joker4: Cardinal; + StaticTeam3Joker5: Cardinal; + + StaticParty: Array of Cardinal; + TextParty: Array of Cardinal; + StaticNonParty: Array of Cardinal; + TextNonParty: Array of Cardinal; + + + constructor Create; override; + procedure SetScroll; + procedure SetScroll1; + procedure SetScroll2; + procedure SetScroll3; + procedure SetScroll4; + procedure SetScroll5; + procedure SetScroll6; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure SelectNext; + procedure SelectPrev; + procedure UpdateLCD; + procedure SkipTo(Target: Cardinal); + procedure FixSelected; //Show Wrong Song when Tabs on Fix + procedure FixSelected2; //Show Wrong Song when Tabs on Fix + procedure ShowCatTL(Cat: Integer);// Show Cat in Top left + procedure ShowCatTLCustom(Caption: String);// Show Custom Text in Top left + procedure HideCatTL;// Show Cat in Tob left + procedure Refresh; //Refresh Song Sorting + procedure DrawEqualizer; + procedure ChangeMusic; + //Party Mode + procedure SelectRandomSong; + procedure SetJoker; + procedure SetStatics; + //procedures for Menu + procedure StartSong; + procedure OpenEditor; + procedure DoJoker(Team: Byte); + procedure SelectPlayers; + + procedure UnLoadDetailedCover; + + //Extensions + procedure DrawExtensions; + end; + +implementation +uses UGraphic, + UMain, + UCovers, + math, + OpenGL12, + {$IFDEF win32} + windows, + {$ELSE} + lclintf, + {$ENDIF} + USkins, + UDLLManager, + UParty, + UPlaylist, + UScreenSongMenu; + +// ***** Public methods ****** // + +//Show Wrong Song when Tabs on Fix +procedure TScreenSong.FixSelected; +var I, I2: Integer; + begin + if CatSongs.VisibleSongs > 0 then + begin + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); + + if I = Interaction - 1 then + break; + end; + + SongCurrent := I2; + SongTarget := I2; + end; + end; + +procedure TScreenSong.FixSelected2; +var I, I2: Integer; + begin + if CatSongs.VisibleSongs > 0 then + begin + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); + + if I = Interaction - 1 then + break; + end; + + SongTarget := I2; + end; + end; +//Show Wrong Song when Tabs on Fix End + + procedure TScreenSong.ShowCatTLCustom(Caption: String);// Show Custom Text in Top left + begin + Text[TextCat].Text := Caption; + Text[TextCat].Visible := true; + Static[StaticCat].Visible := False; + end; + + //Show Cat in Top Left Mod + procedure TScreenSong.ShowCatTL(Cat: Integer); + begin + //Change + Text[TextCat].Text := CatSongs.Song[Cat].Artist; + //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover); + //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); + + Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); + //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false); + //Button[Cat]. + //Cover + + + //Show + Text[TextCat].Visible := true; + Static[StaticCat].Visible := True; + end; + + procedure TScreenSong.HideCatTL; + begin + //Hide + //Text[TextCat].Visible := false; + Static[StaticCat].Visible := false; + //New -> Show Text specified in Theme + Text[TextCat].Visible := True; + Text[TextCat].Text := Theme.Song.TextCat.Text; + end; + //Show Cat in Top Left Mod End + + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenSong.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var + I: integer; + I2: integer; + HS: integer; + SDL_ModState: Word; + Letter: Char; +begin + Result := true; + + //Song Screen Extensions (Jumpto + Menu) + if (ScreenSongMenu.Visible) then + begin + Result := ScreenSongMenu.ParseInput(PressedKey, ScanCode, PressedDown); + Exit; + end + else if (ScreenSongJumpto.Visible) then + begin + Result := ScreenSongJumpto.ParseInput(PressedKey, ScanCode, PressedDown); + Exit; + end; + + If (PressedDown) Then + begin // Key Down + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + + //Jump to Artist/Titel + if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then + begin + Letter := UpCase(Chr(ScanCode)); + I2 := Length(CatSongs.Song); + + //Jump To Titel + if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then + begin + For I := 1 to high(CatSongs.Song) do + begin + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + + Music.PlayChange; + + ChangeMusic; + SetScroll4; + UpdateLCD; + //Break and Exit + Exit; + end; + end; + end + //Jump to Artist + else if (SDL_ModState = KMOD_LALT) then + begin + For I := 1 to high(CatSongs.Song) do + begin + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Artist[1]) = Letter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + + Music.PlayChange; + + ChangeMusic; + SetScroll4; + UpdateLCD; + + //Break and Exit + Exit; + end; + end; + end; + Exit; + end; + + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + if (Mode = 0) then + begin + //On Escape goto Cat-List Hack + if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then + begin + //Find Category + I := Interaction; + while not catsongs.Song[I].Main do + begin + Dec (I); + if (I < low(catsongs.Song)) then + break; + end; + if (I<= 1) then + Interaction := high(catsongs.Song) + else + Interaction := I - 1; + + //Stop Music + Music.Stop; + + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + HideCatTL; + + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + //SelectPrev; + //CatSongs.Song[0].Visible := False; + end + else + begin + //On Escape goto Cat-List Hack End + //Tabs off and in Search or Playlist -> Go back to Song view + if (CatSongs.CatNumShow < -1) then + begin + //Atm: Set Empty Filter + CatSongs.SetFilter('', 0); + + //Show Cat in Top Left Mod + HideCatTL; + Interaction := 0; + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + + ChangeMusic; + end + else + begin + Music.Stop; + Music.PlayBack; + + FadeTo(@ScreenMain); + end; + + end; + end + //When in party Mode then Ask before Close + else if (Mode = 1) then + begin + Music.PlayBack; + CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); + end; + end; + SDLK_RETURN: + begin + if Length(Songs.Song) > 0 then + begin + {$IFDEF UseSerialPort} + // PortWriteB($378, 0); + {$ENDIF} + if CatSongs.Song[Interaction].Main then + begin // clicked on Category Button + + //Show Cat in Top Left Mod + ShowCatTL (Interaction); + + //I := CatSongs.VisibleIndex(Interaction); + CatSongs.ClickCategoryButton(Interaction); + {I2 := CatSongs.VisibleIndex(Interaction); + SongCurrent := SongCurrent - I + I2; + SongTarget := SongTarget - I + I2; } + +// if I<>I2 then beep; + // SetScroll4; + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + + //Play Music: + ChangeMusic; + + end else begin // clicked on song + if (Mode = 0) then //Normal Mode -> Start Song + begin + //Do the Action that is specified in Ini + case Ini.OnSongClick of + 0: StartSong; + 1: SelectPlayers; + 2:begin + If (CatSongs.CatNumShow = -3) then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end; + end; + end + else if (Mode = 1) then //PartyMode -> Show Menu + begin + if (Ini.PartyPopup = 1) then + ScreenSongMenu.MenuShow(SM_Party_Main) + else + ScreenSong.StartSong; + end; + end; + end; + end; + + SDLK_M: //Show SongMenu + begin + if (Length(Songs.Song) > 0) then begin + if (Mode = 0) then begin + if not CatSongs.Song[Interaction].Main then begin // clicked on Song + if CatSongs.CatNumShow = -3 then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end + else + begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); + end; + end //Party Mode -> Show Party Menu + else ScreenSongMenu.MenuShow(SM_Party_Main); + end; + end; + + SDLK_P: //Show Playlist Menu + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); + end; + end; + + SDLK_J: //Show Jumpto Menu + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then + begin + ScreenSongJumpto.Visible := True; + end; + end; + + SDLK_DOWN: + begin + if (Mode = 0) then + begin + //Only Change Cat when not in Playlist or Search Mode + if (CatSongs.CatNumShow > -2) then + begin + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then + begin + I := Interaction; + if I <= 0 then I := 1; + + while not catsongs.Song[I].Main do + begin + Inc (I); + if (I > high(catsongs.Song)) then + I := low(catsongs.Song); + end; + + Interaction := I; + + //Show Cat in Top Left Mod + ShowCatTL (Interaction); + + CatSongs.ClickCategoryButton(Interaction); + SelectNext; + FixSelected; + + //Play Music: + Music.PlayChange; + ChangeMusic; + + end; + + // + //Cat Change Hack End} + end; + end; + end; + SDLK_UP: + begin + if (Mode = 0) then + begin + //Only Change Cat when not in Playlist or Search Mode + if (CatSongs.CatNumShow > -2) then + begin + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then + begin + I := Interaction; + I2 := 0; + if I <= 0 then I := 1; + + while not catsongs.Song[I].Main or (I2 = 0) do + begin + if catsongs.Song[I].Main then + Inc(I2); + Dec (I); + if (I < low(catsongs.Song)) then + I := high(catsongs.Song); + end; + + Interaction := I; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + + //Play Music: + Music.PlayChange; + ChangeMusic; + end; + end; + //Cat Change Hack End} + end; + end; + + SDLK_RIGHT: + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + Music.PlayChange; + SelectNext; +// InteractNext; +// SongTarget := Interaction; + ChangeMusic; + SetScroll4; + UpdateLCD; + Light.LightOne(1, 200); + end; + end; + + SDLK_LEFT: + begin + if (Length(Songs.Song) > 0)AND (Mode = 0) then begin + Music.PlayChange; + SelectPrev; + ChangeMusic; + SetScroll4; + UpdateLCD; + Light.LightOne(0, 200); + end; + end; + + SDLK_E: + begin + OpenEditor; + end; + + SDLK_R: + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + + if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category + begin + I2 := 0; //Count Cats + for I:= low(CatSongs.Song) to high (CatSongs.Song) do + if CatSongs.Song[I].Main then Inc(I2); + + I2 := Random (I2)+1; //Zufall + + //Find Cat: + for I:= low(CatSongs.Song) to high (CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + Dec(I2); + if (I2<=0) then + begin + //Show Cat in Top Left Mod + ShowCatTL (I); + + Interaction := I; + + CatSongs.ShowCategoryList; + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + break; + end; + end; + + + end + else if (SDL_ModState = KMOD_LCTRL) AND (Ini.Tabs_at_startup = 1) then //random in All Categorys + begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; + + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + + //Choose Cat + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Fix: Not Existing Song selected: + //if (I+1=I2) then Inc(I2); + + //Choose Song + SkipTo(I2-I); + + end + else //Random in one Category + begin + SkipTo(Random(CatSongs.VisibleSongs)); + end; + Music.PlayChange; + + ChangeMusic; + SetScroll4; + UpdateLCD; + end; + end; + + SDLK_1: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[0].Joker); + SelectRandomSong; + SetJoker; + end; + end; + + SDLK_2: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[1].Joker); + SelectRandomSong; + SetJoker; + end; + end; + + SDLK_3: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[2].Joker); + SelectRandomSong; + SetJoker; + end; + end; + end; + end; +end; + +constructor TScreenSong.Create; +var + Pet: integer; + I: integer; +Label CreateSongButtons; +begin + inherited Create; + + LoadFromTheme(Theme.Song); + + TextArtist := AddText(Theme.Song.TextArtist); + TextTitle := AddText(Theme.Song.TextTitle); + TextNumber := AddText(Theme.Song.TextNumber); + + //Show Cat in Top Left mod + TextCat := AddText(Theme.Song.TextCat); + StaticCat := AddStatic(Theme.Song.StaticCat); + + //Show Video Icon Mod + VideoIcon := AddStatic(Theme.Song.VideoIcon); + + //Party Mode + StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1); + StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2); + StaticTeam1Joker3 := AddStatic(Theme.Song.StaticTeam1Joker3); + StaticTeam1Joker4 := AddStatic(Theme.Song.StaticTeam1Joker4); + StaticTeam1Joker5 := AddStatic(Theme.Song.StaticTeam1Joker5); + + StaticTeam2Joker1 := AddStatic(Theme.Song.StaticTeam2Joker1); + StaticTeam2Joker2 := AddStatic(Theme.Song.StaticTeam2Joker2); + StaticTeam2Joker3 := AddStatic(Theme.Song.StaticTeam2Joker3); + StaticTeam2Joker4 := AddStatic(Theme.Song.StaticTeam2Joker4); + StaticTeam2Joker5 := AddStatic(Theme.Song.StaticTeam2Joker5); + + StaticTeam3Joker1 := AddStatic(Theme.Song.StaticTeam3Joker1); + StaticTeam3Joker2 := AddStatic(Theme.Song.StaticTeam3Joker2); + StaticTeam3Joker3 := AddStatic(Theme.Song.StaticTeam3Joker3); + StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); + StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); + + //Load Party or NonParty specific Statics and Texts + SetLength(StaticParty, Length(Theme.Song.StaticParty)); + for I := 0 to High(Theme.Song.StaticParty) do + StaticParty[I] := AddStatic(Theme.Song.StaticParty[I]); + + SetLength(TextParty, Length(Theme.Song.TextParty)); + for I := 0 to High(Theme.Song.TextParty) do + TextParty[I] := AddText(Theme.Song.TextParty[I]); + + SetLength(StaticNonParty, Length(Theme.Song.StaticNonParty)); + for I := 0 to High(Theme.Song.StaticNonParty) do + StaticNonParty[I] := AddStatic(Theme.Song.StaticNonParty[I]); + + SetLength(TextNonParty, Length(Theme.Song.TextNonParty)); + for I := 0 to High(Theme.Song.TextNonParty) do + TextNonParty[I] := AddText(Theme.Song.TextNonParty[I]); + + // Song List +// Songs.LoadSongList; // moved to the UltraStar unit + CatSongs.Refresh; + + if (length(CatSongs.Song) > 0) then + begin + //Set Length of Button Array one Time Instead of one time for every Song + SetButtonLength(Length(CatSongs.Song)); + + I := 0; + CreateSongButtons: + + try + for Pet := I to High(CatSongs.Song) do begin // creating all buttons + // new + Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 + + if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' + + if CatSongs.Song[Pet].Cover = '' then + AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) + else begin + // cache texture if there is a need to this + if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then begin + Texture.CreateCacheMipmap := true; + Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap + Texture.CreateCacheMipmap := false; + + // puts this texture to the cache file + Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + + // unload full size texture + Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); + + // we should also add mipmap texture by calling createtexture and use mipmap cache as data source + end; + + // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) + AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + end; + Texture.Limit := 1024*1024; + I := -1; + end; + except + //When Error is reported the First time for this Song + if (I <> Pet) then + begin + //Some Error reporting: + Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); + + //Change Cover to NoCover and Continue Loading + CatSongs.Song[Pet].Cover := ''; + I := Pet; + end + else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song + begin + Log.LogError('NoCover Cover is damaged!'); + try + AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); + except + {$IFDEF win32} + Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); + {$ELSE} + // TODO : JB_linux - better handle this message and display to user.. + writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'); + Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' ); + {$ENDIF} + Halt; + end; + I := Pet + 1; + end; + end; + + if (I <> -1) then + GoTo CreateSongButtons; + + end; + + // Randomize Patch + Randomize; + //Equalizer + SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); + //ClearArray + For I := low(EqualizerBands) to high(EqualizerBands) do + EqualizerBands[I] := 3; + + if (Length(CatSongs.Song) > 0) then + Interaction := 0; +end; + +procedure TScreenSong.SetScroll; +var + VS, B: Integer; +begin + VS := CatSongs.VisibleSongs; + if VS > 0 then + begin + //Set Positions + Case Theme.Song.Cover.Style of + 3: SetScroll3; + 5:begin + if VS > 5 then + SetScroll5 + else + SetScroll4; + end; + 6: SetScroll6; + else SetScroll4; + end; + //Set Visibility of Video Icon + Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> ''); + + //Set Texts: + Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; + Text[TextTitle].Text := CatSongs.Song[Interaction].Title; + if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then + begin + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); + Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; + end + else if (CatSongs.CatNumShow = -2) then + Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) + else if (CatSongs.CatNumShow = -3) then + Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) + else if (Ini.Tabs_at_startup = 1) then + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) + else + Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); + end + else + begin + Text[TextNumber].Text := '0/0'; + Text[TextArtist].Text := ''; + Text[TextTitle].Text := ''; + for B := 0 to High(Button) do + Button[B].Visible := False; + + end; +end; + +procedure TScreenSong.SetScroll1; +var + B: integer; // button + BMin: integer; // button min + BMax: integer; // button max + Src: integer; +// Dst: integer; + Count: integer; // Dst is not used. Count is used. + Ready: boolean; + + VisCount: integer; // count of visible (or selectable) buttons + VisInt: integer; // visible position of interacted button + Typ: integer; // 0 when all songs fits the screen + Placed: integer; // number of placed visible buttons +begin +// Src := 0; +// Dst := -1; + Count := 1; + Typ := 0; + Ready := false; + Placed := 0; + + VisCount := 0; + for B := 0 to High(Button) do + if CatSongs.Song[B].Visible then Inc(VisCount); + + VisInt := 0; + for B := 0 to Interaction-1 do + if CatSongs.Song[B].Visible then Inc(VisInt); + + + if VisCount <= 6 then begin + Typ := 0; + end else begin + if VisInt <= 3 then begin + Typ := 1; + Count := 7; + Ready := true; + end; + + if (VisCount - VisInt) <= 3 then begin + Typ := 2; + Count := 7; + Ready := true; + end; + + if not Ready then begin + Typ := 3; + Src := Interaction; + end; + end; + + + + // hide all buttons + for B := 0 to High(Button) do begin + Button[B].Visible := false; + Button[B].Selectable := CatSongs.Song[B].Visible; + end; + +{ for B := Src to Dst do begin +// Button[B].Visible := true; + Button[B].Visible := CatSongs.Song[B].Visible; + Button[B].Selectable := Button[B].Visible; + Button[B].Y := 140 + (B-Src) * 60; + end;} + + + if Typ = 0 then begin + for B := 0 to High(Button) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (Placed) * 60; + Inc(Placed); + end; + end; + end; + + if Typ = 1 then begin + B := 0; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Inc(B); + end; + end; + + if Typ = 2 then begin + B := High(Button); + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (6-Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Dec(B); + end; + end; + + if Typ = 3 then begin + B := Src; + Count := 4; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (3+Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Inc(B); + end; + + B := Src-1; + Placed := 0; + Count := 3; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (2-Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Dec(B); + end; + + end; + + if Length(Button) > 0 then + Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture +end; + +procedure TScreenSong.SetScroll2; +var + B: integer; + Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu + Wsp2: real; +begin + // liniowe + for B := 0 to High(Button) do + Button[B].X := 300 + (B - Interaction) * 260; + + if Length(Button) >= 3 then begin + if Interaction = 0 then + Button[High(Button)].X := 300 - 260; + + if Interaction = High(Button) then + Button[0].X := 300 + 260; + end; + + // kolowe +{ for B := 0 to High(Button) do begin + Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. + Wsp2 := Wsp / Length(Button); + Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); +// Button[B].Y := 140 + 50 * ; + end;} +end; + +procedure TScreenSong.SetScroll3; // with slide +var + B: integer; + Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu + Wsp2: real; +begin + SongTarget := Interaction; + + // liniowe + for B := 0 to High(Button) do + begin + Button[B].X := 300 + (B - SongCurrent) * 260; + if (Button[B].X < -Button[B].W) OR (Button[B].X > 800) then + Button[B].Visible := False + else + Button[B].Visible := True; + end; + +{ if Length(Button) >= 3 then begin + if Interaction = 0 then + Button[High(Button)].X := 300 - 260; + + if Interaction = High(Button) then + Button[0].X := 300 + 260; + end;} + + // kolowe +{ for B := 0 to High(Button) do begin + Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. + Wsp2 := Wsp / Length(Button); + Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); +// Button[B].Y := 140 + 50 * ; + end;} +end; + +procedure TScreenSong.SetScroll4; // rotate +var + B: integer; + Wsp: real; + Z, Z2: real; + VS: integer; +begin + VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important + + // kolowe + for B := 0 to High(Button) do begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2; + Z2 := (1 + 2*Z) / 3; + + + Button[B].X := Theme.Song.Cover.X + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z / 2 + 0.3; + + Button[B].W := Theme.Song.Cover.H * Z2; + +// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; + Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; + Button[B].H := Button[B].W; + end; + end; +end; + +(* +procedure TScreenSong.SetScroll4; // rotate +var + B: integer; + Wsp: real; + Z: real; + Z2, Z3: real; + VS: integer; + function modreal (const X, Y: real):real; + begin + Result := Frac(x / y) * y; + if Result < -3 then + Result := Result + Y + else if Result > 3 then + Result := Result - Y; + end; +begin + VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important + Z3 := 1; + if VS < 12 then + Z2 := VS + else + Z2 := 12; + + // kolowe + for B := 0 to High(Button) do begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + if ((ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)>-3) AND (ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)<3)) then + begin + if CatSongs.VisibleIndex(B)> SongCurrent then + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2 + else + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2; + + Z3 := 2; + Z := (1 + cos(Wsp)) / 2; + //Z2 := (1 + 2*Z) / 3; + //Z2 := (0.5 + Z/2); + //Z2 := sin(Wsp); + + //Z2 := Power (Z2,Z3); + + Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); + + //Button[B].X := Theme.Song.CoverX + ({Theme.Song.CoverX + Theme.Song.CoverW/2 + Theme.Song.CoverW*0.18 * VS {CatSongs.VisibleSongs {Length(Button) * sin(Wsp) {- Theme.Song.CoverX - Theme.Song.CoverW) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + if (sin(Wsp)<0) then + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W + else //*Theme.Song.CoverW*0.004*Z3 + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; + Button[B].Z := Z-0.00001; + +// Button[B].Y := {50 + 140 + 50 - 50 * Z2; + // Button[B].Y := (Theme.Song.CoverY + 40 + 50 - 50 * Z2); + Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); + Button[B].H := Button[B].W; + Button[B].Visible := True; + end + {else if (((CatSongs.VisibleIndex(B) - SongCurrent)>-3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) OR ((round (CatSongs.VisibleIndex(B) - SongCurrent) mod VS > -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) then + begin + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / 12 ;// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2 -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); + + if (sin(Wsp)<0) then + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W + else + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; + + Button[B].Z := Z; + + Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); + + Button[B].H := Button[B].W; + Button[B].Visible := True; + end + else Button[B].Visible := False; + end; + end; +end; *) + +procedure TScreenSong.SetScroll5; // rotate +var + B: integer; + Angle: real; + Pos: Real; + VS: integer; + diff: real; + X: Real; + helper: real; +begin + VS := CatSongs.VisibleSongs; // cache Visible Songs + {Vars + Theme.Song.CoverW: Radius des Kreises + Theme.Song.CoverX: X Pos Linke Kante des gewählten Covers + Theme.Song.CoverX: Y Pos Obere Kante des gewählten Covers + Theme.Song.CoverH: Höhe der Cover + + (CatSongs.VisibleIndex(B) - SongCurrent)/VS = Abstand zum MIttleren Cover in % + } + + //Change Pos of all Buttons + for B := low(Button) to high(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility + if Button[B].Visible then //Only Change Pos for Visible Buttons + begin + Pos := (CatSongs.VisibleIndex(B) - SongCurrent); + if (Pos < -VS/2) then + Pos := Pos + VS + else if (Pos > VS/2) then + Pos := Pos - VS; + + if (Abs(Pos) < 2.5) then {fixed Positions} + begin + Angle := Pi * (Pos / 5); +// Button[B].Visible := False; + + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); + +// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Z := 0.95 - Abs(Pos) * 0.01; + + Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); + + Button[B].W := Button[B].H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + + X := Sin(Angle*1.3)*0.9; + + Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Diff; + + end + else + begin {Behind the Front Covers} + + // limit-bg-covers hack + if (abs(abs(Pos)-VS/2)>10) then Button[B].Visible:=False; + // end of limit-bg-covers hack + + if Pos < 0 then + Pos := (Pos - VS/2)/VS + else + Pos := (Pos + VS/2)/VS; + + Angle := pi * Pos*2; + if VS > 24 then + begin + if Angle < 0 then helper:=-1 else helper:=1; + Angle:=2*pi-abs(Angle); + Angle:=Angle*(VS/24); + Angle:=(2*pi-Angle)*helper; + end; + + Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); + + Button[B].W := Button[B].H; + + Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; + +// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*((Theme.Song.Cover.H)*sin(Angle/2)*1.52); + + end; + + //Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field +// Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); + + end; + end; +end; + +procedure TScreenSong.SetScroll6; // rotate (slotmachine style) +var + B: integer; + Angle: real; + Pos: Real; + VS: integer; + diff: real; + X: Real; + Wsp: real; + Z, Z2: real; +begin + VS := CatSongs.VisibleSongs; // cache Visible Songs + if VS <=5 then begin + // kolowe + for B := 0 to High(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2; + Z2 := (1 + 2*Z) / 3; + + + Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z / 2 + 0.3; + + Button[B].W := Theme.Song.Cover.H * Z2; + +// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; + Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; + Button[B].H := Button[B].W; + end; + end; + end + else begin + + //Change Pos of all Buttons + for B := low(Button) to high(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility + if Button[B].Visible then //Only Change Pos for Visible Buttons + begin + Pos := (CatSongs.VisibleIndex(B) - SongCurrent); + if (Pos < -VS/2) then + Pos := Pos + VS + else if (Pos > VS/2) then + Pos := Pos - VS; + + if (Abs(Pos) < 2.5) then {fixed Positions} + begin + Angle := Pi * (Pos / 5); +// Button[B].Visible := False; + + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); + + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Z := 0.95 - Abs(Pos) * 0.01; + + Button[B].X := (Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); + + Button[B].W := Button[B].H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + + X := Sin(Angle*1.3)*0.9; + + Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff; + end + else + begin {Behind the Front Covers} + + // limit-bg-covers hack + if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; + if VS > 25 then VS:=25; + // end of limit-bg-covers hack + + if Pos < 0 then + Pos := (Pos - VS/2)/VS + else + Pos := (Pos + VS/2)/VS; + + Angle := pi * Pos*2; + + Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); + + Button[B].W := Button[B].H; + + Button[B].X := Theme.Song.Cover.X - (Button[B].H - Theme.Song.Cover.H)*0.5; + + + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Y := Theme.Song.Cover.Y+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*(Theme.Song.Cover.H*sin(Angle/2)*1.52); + end; + end; + end; + end; +end; + + +procedure TScreenSong.onShow; +begin + Music.Stop; + + if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; + if Ini.Players = 4 then PlayersPlay := 6; + + //Cat Mod etc + if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then + begin + CatSongs.ShowCategoryList; + FixSelected; + //Show Cat in Top Left Mod + HideCatTL; + end; + + + if Length(CatSongs.Song) > 0 then begin + //Load Music only when Song Preview is activated + if (Ini.PreviewVolume <> 0) then + begin + Music.SetLoop(false); + Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + Music.MoveTo(Music.Length / 4); + Music.Play; + + //Set Preview Volume + Music.SetMusicVolume (Ini.PreviewVolume * 10); + {//if Music Fade is activated, Set Volume to 0 % + if (Ini.PreviewFading <> 0) then + Music.SetMusicVolume(0);} + end; + + SetScroll; + UpdateLCD; + end; + + //Playlist Mode + if (Mode = 0) then + begin + //If Playlist Shown -> Select Next automatically + if (CatSongs.CatNumShow = -3) then + begin + SelectNext; + ChangeMusic; + end; + end + //Party Mode + else if (Mode = 1) then + begin + + SelectRandomSong; + //Show Menu directly in PartyMode + //But only if selected in Options + if (Ini.PartyPopup = 1) then + begin + ScreenSongMenu.MenuShow(SM_Party_Main); + end; + + + end; + + SetJoker; + SetStatics; +end; + +procedure TScreenSong.onHide; +begin + //When Music Fading is activated, Turn Music to 100 % + If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then + Music.SetMusicVolume(100); + + //If Preview is deactivated: Load MUsicfile now + If (Ini.PreviewVolume = 0) then + Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + + //When hide then Stop Music (For Party Mode Popup on Exit) + if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then + Music.Stop; +end; + +procedure TScreenSong.DrawExtensions; +begin + //Draw Song Menu + if (ScreenSongMenu.Visible) then + begin + ScreenSongMenu.Draw; + end + else if (ScreenSongJumpto.Visible) then + begin + ScreenSongJumpto.Draw; + end +end; + +function TScreenSong.Draw: boolean; +var + dx: real; + dt: real; + I: Integer; +begin + dx := SongTarget-SongCurrent; + dt := TimeSkip*7; + if dt > 1 then dt := 1; + SongCurrent := SongCurrent + dx*dt; + +{ if SongCurrent > Catsongs.VisibleSongs then begin + SongCurrent := SongCurrent - Catsongs.VisibleSongs; + SongTarget := SongTarget - Catsongs.VisibleSongs; + end;} + +// Log.BenchmarkStart(5); + SetScroll; +// Log.BenchmarkEnd(5); +// Log.LogBenchmark('SetScroll4', 5); + + //Fading Functions, Only if Covertime is under 5 Seconds + If (CoverTime < 5) then + begin + // 0.5.0: cover fade + if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin + // load new texture + Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture.Alpha := 1; + Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture2.Alpha := 1; + end; + + //Song Fade + if (CatSongs.VisibleSongs > 0) AND (Ini.PreviewVolume <> 0) AND (Not CatSongs.Song[Interaction].Main) AND (Ini.PreviewFading <> 0) then + begin + //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling + if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then + Music.Play; + + //Update Song Volume + if (CoverTime < Ini.PreviewFading) then + Music.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) + else + Music.SetMusicVolume(Ini.PreviewVolume * 10); + + end; + + + //Update Fading Time + CoverTime := CoverTime + TimeSkip; + + //Update Fading Texture + Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; + if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; + + end; + + //inherited Draw; + //heres a little Hack, that causes the Statics + //are Drawn after the Buttons because of some Blending Problems. + //This should cause no Problems because all Buttons on this screen + //Has Z Position. + //Draw BG + DrawBG; + + //Instead of Draw FG Procedure: + //We draw Buttons for our own + for I := 0 to Length(Button) - 1 do + Button[I].Draw; + + // Statics + for I := 0 to Length(Static) - 1 do + Static[I].Draw; + + // and texts + for I := 0 to Length(Text) - 1 do + Text[I].Draw; + + + //Draw Equalizer + if Theme.Song.Equalizer.Visible then + DrawEqualizer; + + DrawExtensions; + +end; + +procedure TScreenSong.SelectNext; +var + Skip: integer; + I: integer; + VS: Integer; +begin + VS := CatSongs.VisibleSongs; + + if VS > 0 then + begin + UnLoadDetailedCover; + + Skip := 1; + + // this 1 could be changed by CatSongs.FindNextVisible + while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); + + SongTarget := SongTarget + 1;//Skip; + + Interaction := (Interaction + Skip) mod Length(Interactions); + + // try to keep all at the beginning + if SongTarget > VS-1 then begin + SongTarget := SongTarget - VS; + SongCurrent := SongCurrent - VS; + end; + + end; + // Interaction -> Button, ktorego okladke przeczytamy + // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture +end; + +procedure TScreenSong.SelectPrev; +var + Skip: integer; + I: integer; + VS: Integer; +begin + VS := CatSongs.VisibleSongs; + + if VS > 0 then + begin + UnLoadDetailedCover; + + Skip := 1; + + while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); + SongTarget := SongTarget - 1;//Skip; + + Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); + + // try to keep all at the beginning + if SongTarget < 0 then begin + SongTarget := SongTarget + CatSongs.VisibleSongs; + SongCurrent := SongCurrent + CatSongs.VisibleSongs; + end; + + // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture + end; +end; + +procedure TScreenSong.UpdateLCD; +begin + LCD.HideCursor; + LCD.Clear; + LCD.WriteText(1, Text[TextArtist].Text); + LCD.WriteText(2, Text[TextTitle].Text); +end; + +//Procedure Change current played Preview +procedure TScreenSong.ChangeMusic; +begin + //When Music Preview is avtivated -> then Change Music + if (Ini.PreviewVolume <> 0) then + begin + if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then + begin + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal + if (Ini.PreviewFading = 0) then + Music.Play + else + Music.SetMusicVolume(0); + end; + end + else + Music.Stop; + end; +end; + +procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0 +var + Skip: integer; + I: integer; +begin + UnLoadDetailedCover; + + Interaction := High(CatSongs.Song); + SongTarget := 0; + + for I := 1 to Target+1 do + SelectNext; + + FixSelected2; +end; + +procedure TScreenSong.DrawEqualizer; +var + Data: TFFTData; //Audio Data + I, J: Integer; + Res: byte; + A, B: Integer; + PosX, PosY: Integer; + Pos: Real; +begin +if (not Music.Finished) AND (Theme.Song.Equalizer.Length > 0) then +begin + + + A := GetTickCount div 44; + + if (A <> EqualizerTime) then + begin + EqualizerTime := A; + Data := Music.GetFFTData; + + B:=0; + Pos := 0; + Res := ceil(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band + + //Change Lengths + for I := 0 to (Res * Theme.Song.Equalizer.Bands - 1) do + begin + A := floor(I/Res); + + if (A<>B) then //Band changed + begin + if (Pos <= Theme.Song.Equalizer.Length) then + begin + if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then + EqualizerBands[B] := EqualizerBands[B] - 1 + else + EqualizerBands[B] := floor(Pos); + end + else + EqualizerBands[B] := 1; + + B := A; + Pos := 0; + end; + + if I > 35 then + Data[i] := Data[i] * 8 + else if I > 11 then + Data[i] := Data[i] * 4.5 + else + Data[i] := Data[i] * 1.1; + + if (Data[i] >= 1) then + Data[i] := 0.9999999999999; + + if Data[i]*Theme.Song.Equalizer.Length > Pos then + Pos := Data[i]*Theme.Song.Equalizer.Length; + end; + + //Change Last Band + if (EqualizerBands[B] <= Theme.Song.Equalizer.Length) then + begin + if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then + EqualizerBands[B] := EqualizerBands[B] - 1 + else + EqualizerBands[B] := floor(Pos) + end + else + EqualizerBands[B] := 1; + end; + + //Draw every Channel + glColor4f(Theme.Song.Equalizer.ColR, Theme.Song.Equalizer.ColG, Theme.Song.Equalizer.ColB, Theme.Song.Equalizer.Alpha); //Set Color + glDisable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + + PosY := Theme.Song.Equalizer.Y; + PosX := Theme.Song.Equalizer.X; + + For I := 0 to Theme.Song.Equalizer.Bands-1 do + begin + if Theme.Song.Equalizer.Direction then + PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length + else + PosX := Theme.Song.Equalizer.X; + //Draw for every visible quad + for J := 1 to EqualizerBands[I] do + begin + glBegin(GL_QUADS); + glVertex3f(PosX, PosY, Theme.Song.Equalizer.Z); + glVertex3f(PosX, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); + glVertex3f(PosX+Theme.Song.Equalizer.W, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); + glVertex3f(PosX+Theme.Song.Equalizer.W, PosY, Theme.Song.Equalizer.Z); + glEnd; + + if Theme.Song.Equalizer.Direction then //Vertically + PosY := PosY - Theme.Song.Equalizer.H - Theme.Song.Equalizer.Space + else //Horizontally + PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space; + end; + if Theme.Song.Equalizer.Direction then //Horizontally + PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space + else //Vertically + PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space; + end; +end; +end; + +Procedure TScreenSong.SelectRandomSong; +var + I, I2: Integer; +begin + Case PlaylistMan.Mode of + 0: //All Songs Just Select Random Song + begin + //When Tabs are activated then use Tab Method + if (Ini.Tabs_at_startup = 1) then + begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; + + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + //I is the CatNum, I2 is the No of the Song within this Cat + + //Choose Cat + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Choose Song + SkipTo(I2-I); + end + //When Tabs are deactivated use easy Method + else + SkipTo(Random(CatSongs.VisibleSongs)); + end; + 1: //One Category Select Category and Select Random Song + begin + CatSongs.ShowCategoryList; + CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); + ShowCatTL(PlaylistMan.CurPlayList); + + SelectNext; + FixSelected2; + + SkipTo(Random(CatSongs.VisibleSongs)); + end; + 2: //Playlist: Select Playlist and Select Random Song + begin + PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); + + SkipTo(Random(CatSongs.VisibleSongs)); + FixSelected2; + end; + end; + + Music.PlayChange; + ChangeMusic; + SetScroll; + UpdateLCD; +end; + +procedure TScreenSong.SetJoker; +begin + //If Party Mode + if Mode = 1 then //Show Joker that are available + begin + if (PartySession.Teams.NumTeams >= 1) then + begin + Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1); + Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2); + Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3); + Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4); + Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5); + end + else + begin + Static[StaticTeam1Joker1].Visible := False; + Static[StaticTeam1Joker2].Visible := False; + Static[StaticTeam1Joker3].Visible := False; + Static[StaticTeam1Joker4].Visible := False; + Static[StaticTeam1Joker5].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 2) then + begin + Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1); + Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2); + Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3); + Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4); + Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5); + end + else + begin + Static[StaticTeam2Joker1].Visible := False; + Static[StaticTeam2Joker2].Visible := False; + Static[StaticTeam2Joker3].Visible := False; + Static[StaticTeam2Joker4].Visible := False; + Static[StaticTeam2Joker5].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 3) then + begin + Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1); + Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2); + Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3); + Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4); + Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5); + end + else + begin + Static[StaticTeam3Joker1].Visible := False; + Static[StaticTeam3Joker2].Visible := False; + Static[StaticTeam3Joker3].Visible := False; + Static[StaticTeam3Joker4].Visible := False; + Static[StaticTeam3Joker5].Visible := False; + end; + end + else + begin //Hide all + Static[StaticTeam1Joker1].Visible := False; + Static[StaticTeam1Joker2].Visible := False; + Static[StaticTeam1Joker3].Visible := False; + Static[StaticTeam1Joker4].Visible := False; + Static[StaticTeam1Joker5].Visible := False; + + Static[StaticTeam2Joker1].Visible := False; + Static[StaticTeam2Joker2].Visible := False; + Static[StaticTeam2Joker3].Visible := False; + Static[StaticTeam2Joker4].Visible := False; + Static[StaticTeam2Joker5].Visible := False; + + Static[StaticTeam3Joker1].Visible := False; + Static[StaticTeam3Joker2].Visible := False; + Static[StaticTeam3Joker3].Visible := False; + Static[StaticTeam3Joker4].Visible := False; + Static[StaticTeam3Joker5].Visible := False; + end; +end; + +procedure TScreenSong.SetStatics; +var + I: Integer; + Visible: Boolean; +begin + //Set Visibility of Party Statics and Text + Visible := (Mode = 1); + + For I := 0 to high(StaticParty) do + Static[StaticParty[I]].Visible := Visible; + + For I := 0 to high(TextParty) do + Text[TextParty[I]].Visible := Visible; + + //Set Visibility of Non Party Statics and Text + Visible := not Visible; + + For I := 0 to high(StaticNonParty) do + Static[StaticNonParty[I]].Visible := Visible; + + For I := 0 to high(TextNonParty) do + Text[TextNonParty[I]].Visible := Visible; +end; + +//Procedures for Menu + +procedure TScreenSong.StartSong; +begin + CatSongs.Selected := Interaction; + Music.Stop; + //Party Mode + if (Mode = 1) then + begin + FadeTo(@ScreenSingModi); + end + else + begin + FadeTo(@ScreenSing); + end; +end; + +procedure TScreenSong.SelectPlayers; +begin + CatSongs.Selected := Interaction; + Music.Stop; + + ScreenName.Goto_SingScreen := True; + FadeTo(@ScreenName); +end; + +procedure TScreenSong.OpenEditor; +begin + if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin + Music.Stop; + Music.PlayStart; + ScreenEditSub.Path := CatSongs.Song[Interaction].Path; + ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName; + FadeTo(@ScreenEditSub); + end; +end; + +//Team No of Team (0-5) +procedure TScreenSong.DoJoker (Team: Byte); +begin + if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[Team].Joker); + SelectRandomSong; + SetJoker; + end; +end; + +//Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song +procedure TScreenSong.UnLoadDetailedCover; +begin + CoverTime := 0; + + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture + Button[Interaction].Texture2.Alpha := 0; + + if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then + Texture.UnloadTexture(Button[Interaction].Texture.Name, false); +end; + +procedure TScreenSong.Refresh; +begin { +CatSongs.Refresh; +CatSongs.ShowCategoryList; +Interaction := 0; +SelectNext; +FixSelected; } + +end; + +end. diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 41432356..ce331e2f 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -1,619 +1,632 @@ -unit UScreenSongMenu; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -uses - UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; - -type - TScreenSongMenu = class(TMenu) - private - CurMenu: Byte; //Num of the cur. Shown Menu - public - Visible: Boolean; //Whether the Menu should be Drawn - - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - procedure onShow; override; - function Draw: boolean; override; - procedure MenuShow(sMenu: Byte); - procedure HandleReturn; - end; - -const - SM_Main = 1; - - SM_PlayList = 64 or 1; - SM_Playlist_Add = 64 or 2; - SM_Playlist_New = 64 or 3; - - SM_Playlist_DelItem = 64 or 5; - - SM_Playlist_Load = 64 or 8 or 1; - SM_Playlist_Del = 64 or 8 or 5; - - - SM_Party_Main = 128 or 1; - SM_Party_Joker = 128 or 2; - -var - ISelections: Array of String; - SelectValue: Integer; - - -implementation - -uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist, USongs; - -function TScreenSongMenu.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then - begin // Key Down - if (CurMenu = SM_Playlist_New) AND (Interaction=0) then - begin - case PressedKey of - SDLK_0..SDLK_9, SDLK_A..SDLK_Z, SDLK_SPACE, SDLK_MINUS, SDLK_EXCLAIM, SDLK_COMMA, SDLK_SLASH, SDLK_ASTERISK, SDLK_QUESTION, SDLK_QUOTE, SDLK_QUOTEDBL: - begin - Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + chr(ScanCode); - exit; - end; - - SDLK_BACKSPACE: - begin - Button[Interaction].Text[0].DeleteLastL; - exit; - end; - end; - end; - - case PressedKey of - SDLK_Q: - begin - Result := false; - end; - - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - Music.PlayBack; - Visible := False; - end; - - SDLK_RETURN: - begin - HandleReturn; - end; - - SDLK_DOWN: InteractNext; - SDLK_UP: InteractPrev; - - SDLK_RIGHT: - begin - if (Interaction=3) then - InteractInc; - end; - SDLK_LEFT: - begin - if (Interaction=3) then - InteractDec; - end; - - SDLK_1: - begin //Jocker - //Joker spielen - case CurMenu of - SM_Party_Main: - begin - ScreenSong.DoJoker(0) - end; - end; - end; - SDLK_2: - begin //Jocker - //Joker spielen - case CurMenu of - SM_Party_Main: - begin - ScreenSong.DoJoker(1) - end; - end; - end; - SDLK_3: - begin //Jocker - //Joker spielen - case CurMenu of - SM_Party_Main: - begin - ScreenSong.DoJoker(2) - end; - end; - end; - - - end; - end; -end; - -constructor TScreenSongMenu.Create; -var - I: integer; -begin - inherited Create; - - //Create Dummy SelectSlide Entrys - SetLength(ISelections, 1); - ISelections[0] := 'Dummy'; - - - AddText(Theme.SongMenu.TextMenu); - - LoadFromTheme(Theme.SongMenu); - - AddButton(Theme.SongMenu.Button1); - if (Length(Button[0].Text) = 0) then - AddButtonText(14, 20, 'Button 1'); - - AddButton(Theme.SongMenu.Button2); - if (Length(Button[1].Text) = 0) then - AddButtonText(14, 20, 'Button 2'); - - AddButton(Theme.SongMenu.Button3); - if (Length(Button[2].Text) = 0) then - AddButtonText(14, 20, 'Button 3'); - - AddSelectSlide(Theme.SongMenu.SelectSlide3, SelectValue, ISelections); - - AddButton(Theme.SongMenu.Button4); - if (Length(Button[3].Text) = 0) then - AddButtonText(14, 20, 'Button 4'); - - - Interaction := 0; -end; - -function TScreenSongMenu.Draw: boolean; -begin - inherited Draw; -end; - -procedure TScreenSongMenu.onShow; -begin - -end; - -procedure TScreenSongMenu.MenuShow(sMenu: Byte); -begin - Interaction := 0; //Reset Interaction - Visible := True; //Set Visible - Case sMenu of - SM_Main: - begin - CurMenu := sMenu; - Text[0].Text := Language.Translate('SONG_MENU_NAME_MAIN'); - - Button[0].Visible := True; - Button[1].Visible := True; - Button[2].Visible := True; - Button[3].Visible := True; - SelectsS[0].Visible := False; - - Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY'); - Button[1].Text[0].Text := Language.Translate('SONG_MENU_CHANGEPLAYERS'); - Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD'); - Button[3].Text[0].Text := Language.Translate('SONG_MENU_EDIT'); - end; - - SM_PlayList: - begin - CurMenu := sMenu; - Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST'); - - Button[0].Visible := True; - Button[1].Visible := True; - Button[2].Visible := True; - Button[3].Visible := True; - SelectsS[0].Visible := False; - - Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY'); - Button[1].Text[0].Text := Language.Translate('SONG_MENU_CHANGEPLAYERS'); - Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_DEL'); - Button[3].Text[0].Text := Language.Translate('SONG_MENU_EDIT'); - end; - - SM_Playlist_Add: - begin - CurMenu := sMenu; - Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_ADD'); - - Button[0].Visible := True; - Button[1].Visible := False; - Button[2].Visible := False; - Button[3].Visible := True; - SelectsS[0].Visible := True; - - Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD_NEW'); - Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD_EXISTING'); - - SetLength(ISelections, Length(PlaylistMan.Playlists)); - PlaylistMan.GetNames(ISelections); - - if (Length(ISelections)>=1) then - begin - UpdateSelectSlideOptions(Theme.SongMenu.SelectSlide3, 0, ISelections, SelectValue); - end - else - begin - Button[3].Visible := False; - SelectsS[0].Visible := False; - Button[2].Visible := True; - Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING'); - end; - end; - - SM_Playlist_New: - begin - CurMenu := sMenu; - Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_NEW'); - - Button[0].Visible := True; - Button[1].Visible := False; - Button[2].Visible := True; - Button[3].Visible := True; - SelectsS[0].Visible := False; - - Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NEW_UNNAMED'); - Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NEW_CREATE'); - Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); - end; - - SM_Playlist_DelItem: - begin - CurMenu := sMenu; - Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_DELITEM'); - - Button[0].Visible := True; - Button[1].Visible := False; - Button[2].Visible := False; - Button[3].Visible := True; - SelectsS[0].Visible := False; - - Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES'); - Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); - end; - - SM_Playlist_Load: - begin - CurMenu := sMenu; - Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_LOAD'); - - //Show Delete Curent Playlist Button when Playlist is opened - Button[0].Visible := (CatSongs.CatNumShow = -3); - - Button[1].Visible := False; - Button[2].Visible := False; - Button[3].Visible := True; - SelectsS[0].Visible := True; - - Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_DELCURRENT'); - Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_LOAD'); - - SetLength(ISelections, Length(PlaylistMan.Playlists)); - PlaylistMan.GetNames(ISelections); - - if (Length(ISelections)>=1) then - begin - UpdateSelectSlideOptions(Theme.SongMenu.SelectSlide3, 0, ISelections, SelectValue); - Interaction := 3; - end - else - begin - Button[3].Visible := False; - SelectsS[0].Visible := False; - Button[2].Visible := True; - Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING'); - Interaction := 2; - end; - end; - - SM_Playlist_Del: - begin - CurMenu := sMenu; - Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_DEL'); - - Button[0].Visible := True; - Button[1].Visible := False; - Button[2].Visible := False; - Button[3].Visible := True; - SelectsS[0].Visible := False; - - Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES'); - Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); - end; - - - SM_Party_Main: - begin - CurMenu := sMenu; - Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_MAIN'); - - Button[0].Visible := True; - Button[1].Visible := False; - Button[2].Visible := False; - Button[3].Visible := True; - SelectsS[0].Visible := False; - - Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY'); - //Button[1].Text[0].Text := Language.Translate('SONG_MENU_JOKER'); - //Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYMODI'); - Button[3].Text[0].Text := Language.Translate('SONG_MENU_JOKER'); - end; - - SM_Party_Joker: - begin - CurMenu := sMenu; - Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_JOKER'); - - Button[0].Visible := (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0); - Button[1].Visible := (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0); - Button[2].Visible := (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0); - Button[3].Visible := True; - SelectsS[0].Visible := False; - - Button[0].Text[0].Text := String(PartySession.Teams.Teaminfo[0].Name); - Button[1].Text[0].Text := String(PartySession.Teams.Teaminfo[1].Name); - Button[2].Text[0].Text := String(PartySession.Teams.Teaminfo[2].Name); - Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); - - //Set right Interaction - if (not Button[0].Visible) then - begin - if (not Button[1].Visible) then - begin - if (not Button[2].Visible) then - begin - Interaction := 4; - end - else Interaction := 2; - end - else Interaction := 1; - end; - - end; - end; -end; - -procedure TScreenSongMenu.HandleReturn; -begin - Case CurMenu of - SM_Main: - begin - Case Interaction of - 0: //Button 1 - begin - ScreenSong.StartSong; - Visible := False; - end; - - 1: //Button 2 - begin - //Select New Players then Sing: - ScreenSong.SelectPlayers; - Visible := False; - end; - - 2: //Button 3 - begin - //Show add to Playlist Menu - MenuShow(SM_Playlist_Add); - end; - - 3: //SelectSlide 3 - begin - //Dummy - end; - - 4: //Button 4 - begin - ScreenSong.OpenEditor; - Visible := False; - end; - end; - end; - - SM_PlayList: - begin - Visible := False; - Case Interaction of - 0: //Button 1 - begin - ScreenSong.StartSong; - Visible := False; - end; - - 1: //Button 2 - begin - //Select New Players then Sing: - ScreenSong.SelectPlayers; - Visible := False; - end; - - 2: //Button 3 - begin - //Show add to Playlist Menu - MenuShow(SM_Playlist_DelItem); - end; - - 3: //SelectSlide 3 - begin - //Dummy - end; - - 4: //Button 4 - begin - ScreenSong.OpenEditor; - Visible := False; - end; - end; - end; - - SM_Playlist_Add: - begin - Case Interaction of - 0: //Button 1 - begin - MenuShow(SM_Playlist_New); - end; - - 3: //SelectSlide 3 - begin - //Dummy - end; - - 4: //Button 4 - begin - PlaylistMan.AddItem(ScreenSong.Interaction, SelectValue); - Visible := False; - end; - end; - end; - - SM_Playlist_New: - begin - Case Interaction of - 0: //Button 1 - begin - //Nothing, Button for Entering Name - end; - - 2: //Button 3 - begin - //Create Playlist and Add Song - PlaylistMan.AddItem( - ScreenSong.Interaction, - PlaylistMan.AddPlaylist(Button[0].Text[0].Text)); - Visible := False; - end; - - 3: //SelectSlide 3 - begin - //Cancel -> Go back to Add screen - MenuShow(SM_Playlist_Add); - end; - - 4: //Button 4 - begin - Visible := False; - end; - end; - end; - - SM_Playlist_DelItem: - begin - Visible := False; - Case Interaction of - 0: //Button 1 - begin - //Delete - PlayListMan.DelItem(PlayListMan.GetIndexbySongID(ScreenSong.Interaction)); - Visible := False; - end; - - 4: //Button 4 - begin - MenuShow(SM_Playlist); - end; - end; - end; - - SM_Playlist_Load: - begin - Case Interaction of - 0: //Button 1 (Delete Playlist) - begin - MenuShow(SM_Playlist_Del); - end; - 4: //Button 4 - begin - //Load Playlist - PlaylistMan.SetPlayList(SelectValue); - Visible := False; - end; - end; - end; - - SM_Playlist_Del: - begin - Visible := False; - Case Interaction of - 0: //Button 1 - begin - //Delete - PlayListMan.DelPlaylist(PlaylistMan.CurPlayList); - Visible := False; - end; - - 4: //Button 4 - begin - MenuShow(SM_Playlist_Load); - end; - end; - end; - - SM_Party_Main: - begin - Case Interaction of - 0: //Button 1 - begin - //Start Singing - ScreenSong.StartSong; - Visible := False; - end; - - 4: //Button 4 - begin - //Joker - MenuShow(SM_Party_Joker); - end; - end; - end; - - SM_Party_Joker: - begin - Visible := False; - Case Interaction of - 0: //Button 1 - begin - //Joker Team 1 - ScreenSong.DoJoker(0); - end; - - 1: //Button 2 - begin - //Joker Team 2 - ScreenSong.DoJoker(1); - end; - - 2: //Button 3 - begin - //Joker Team 3 - ScreenSong.DoJoker(2); - end; - - 4: //Button 4 - begin - //Cancel... (Fo back to old Menu) - MenuShow(SM_Party_Main); - end; - end; - end; - end; -end; - -end. - +unit UScreenSongMenu; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses + UMenu, + SDL, + UDisplay, + UMusic, + UFiles, + SysUtils, + UThemes; + +type + TScreenSongMenu = class(TMenu) + private + CurMenu: Byte; //Num of the cur. Shown Menu + public + Visible: Boolean; //Whether the Menu should be Drawn + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + function Draw: boolean; override; + procedure MenuShow(sMenu: Byte); + procedure HandleReturn; + end; + +const + SM_Main = 1; + + SM_PlayList = 64 or 1; + SM_Playlist_Add = 64 or 2; + SM_Playlist_New = 64 or 3; + + SM_Playlist_DelItem = 64 or 5; + + SM_Playlist_Load = 64 or 8 or 1; + SM_Playlist_Del = 64 or 8 or 5; + + + SM_Party_Main = 128 or 1; + SM_Party_Joker = 128 or 2; + +var + ISelections: Array of String; + SelectValue: Integer; + + +implementation + +uses UGraphic, + UMain, + UIni, + UTexture, + ULanguage, + UParty, + UPlaylist, + USongs; + +function TScreenSongMenu.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + if (CurMenu = SM_Playlist_New) AND (Interaction=0) then + begin + case PressedKey of + SDLK_0..SDLK_9, SDLK_A..SDLK_Z, SDLK_SPACE, SDLK_MINUS, SDLK_EXCLAIM, SDLK_COMMA, SDLK_SLASH, SDLK_ASTERISK, SDLK_QUESTION, SDLK_QUOTE, SDLK_QUOTEDBL: + begin + Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + chr(ScanCode); + exit; + end; + + SDLK_BACKSPACE: + begin + Button[Interaction].Text[0].DeleteLastL; + exit; + end; + end; + end; + + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + Music.PlayBack; + Visible := False; + end; + + SDLK_RETURN: + begin + HandleReturn; + end; + + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; + + SDLK_RIGHT: + begin + if (Interaction=3) then + InteractInc; + end; + SDLK_LEFT: + begin + if (Interaction=3) then + InteractDec; + end; + + SDLK_1: + begin //Jocker + //Joker spielen + case CurMenu of + SM_Party_Main: + begin + ScreenSong.DoJoker(0) + end; + end; + end; + SDLK_2: + begin //Jocker + //Joker spielen + case CurMenu of + SM_Party_Main: + begin + ScreenSong.DoJoker(1) + end; + end; + end; + SDLK_3: + begin //Jocker + //Joker spielen + case CurMenu of + SM_Party_Main: + begin + ScreenSong.DoJoker(2) + end; + end; + end; + + + end; + end; +end; + +constructor TScreenSongMenu.Create; +var + I: integer; +begin + inherited Create; + + //Create Dummy SelectSlide Entrys + SetLength(ISelections, 1); + ISelections[0] := 'Dummy'; + + + AddText(Theme.SongMenu.TextMenu); + + LoadFromTheme(Theme.SongMenu); + + AddButton(Theme.SongMenu.Button1); + if (Length(Button[0].Text) = 0) then + AddButtonText(14, 20, 'Button 1'); + + AddButton(Theme.SongMenu.Button2); + if (Length(Button[1].Text) = 0) then + AddButtonText(14, 20, 'Button 2'); + + AddButton(Theme.SongMenu.Button3); + if (Length(Button[2].Text) = 0) then + AddButtonText(14, 20, 'Button 3'); + + AddSelectSlide(Theme.SongMenu.SelectSlide3, SelectValue, ISelections); + + AddButton(Theme.SongMenu.Button4); + if (Length(Button[3].Text) = 0) then + AddButtonText(14, 20, 'Button 4'); + + + Interaction := 0; +end; + +function TScreenSongMenu.Draw: boolean; +begin + inherited Draw; +end; + +procedure TScreenSongMenu.onShow; +begin + +end; + +procedure TScreenSongMenu.MenuShow(sMenu: Byte); +begin + Interaction := 0; //Reset Interaction + Visible := True; //Set Visible + Case sMenu of + SM_Main: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_MAIN'); + + Button[0].Visible := True; + Button[1].Visible := True; + Button[2].Visible := True; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY'); + Button[1].Text[0].Text := Language.Translate('SONG_MENU_CHANGEPLAYERS'); + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_EDIT'); + end; + + SM_PlayList: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST'); + + Button[0].Visible := True; + Button[1].Visible := True; + Button[2].Visible := True; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY'); + Button[1].Text[0].Text := Language.Translate('SONG_MENU_CHANGEPLAYERS'); + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_DEL'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_EDIT'); + end; + + SM_Playlist_Add: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_ADD'); + + Button[0].Visible := True; + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := True; + SelectsS[0].Visible := True; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD_NEW'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD_EXISTING'); + + SetLength(ISelections, Length(PlaylistMan.Playlists)); + PlaylistMan.GetNames(ISelections); + + if (Length(ISelections)>=1) then + begin + UpdateSelectSlideOptions(Theme.SongMenu.SelectSlide3, 0, ISelections, SelectValue); + end + else + begin + Button[3].Visible := False; + SelectsS[0].Visible := False; + Button[2].Visible := True; + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING'); + end; + end; + + SM_Playlist_New: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_NEW'); + + Button[0].Visible := True; + Button[1].Visible := False; + Button[2].Visible := True; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NEW_UNNAMED'); + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NEW_CREATE'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); + end; + + SM_Playlist_DelItem: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_DELITEM'); + + Button[0].Visible := True; + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); + end; + + SM_Playlist_Load: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_LOAD'); + + //Show Delete Curent Playlist Button when Playlist is opened + Button[0].Visible := (CatSongs.CatNumShow = -3); + + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := True; + SelectsS[0].Visible := True; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_DELCURRENT'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_LOAD'); + + SetLength(ISelections, Length(PlaylistMan.Playlists)); + PlaylistMan.GetNames(ISelections); + + if (Length(ISelections)>=1) then + begin + UpdateSelectSlideOptions(Theme.SongMenu.SelectSlide3, 0, ISelections, SelectValue); + Interaction := 3; + end + else + begin + Button[3].Visible := False; + SelectsS[0].Visible := False; + Button[2].Visible := True; + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING'); + Interaction := 2; + end; + end; + + SM_Playlist_Del: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_DEL'); + + Button[0].Visible := True; + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); + end; + + + SM_Party_Main: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_MAIN'); + + Button[0].Visible := True; + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY'); + //Button[1].Text[0].Text := Language.Translate('SONG_MENU_JOKER'); + //Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYMODI'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_JOKER'); + end; + + SM_Party_Joker: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_JOKER'); + + Button[0].Visible := (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0); + Button[1].Visible := (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0); + Button[2].Visible := (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0); + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := String(PartySession.Teams.Teaminfo[0].Name); + Button[1].Text[0].Text := String(PartySession.Teams.Teaminfo[1].Name); + Button[2].Text[0].Text := String(PartySession.Teams.Teaminfo[2].Name); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); + + //Set right Interaction + if (not Button[0].Visible) then + begin + if (not Button[1].Visible) then + begin + if (not Button[2].Visible) then + begin + Interaction := 4; + end + else Interaction := 2; + end + else Interaction := 1; + end; + + end; + end; +end; + +procedure TScreenSongMenu.HandleReturn; +begin + Case CurMenu of + SM_Main: + begin + Case Interaction of + 0: //Button 1 + begin + ScreenSong.StartSong; + Visible := False; + end; + + 1: //Button 2 + begin + //Select New Players then Sing: + ScreenSong.SelectPlayers; + Visible := False; + end; + + 2: //Button 3 + begin + //Show add to Playlist Menu + MenuShow(SM_Playlist_Add); + end; + + 3: //SelectSlide 3 + begin + //Dummy + end; + + 4: //Button 4 + begin + ScreenSong.OpenEditor; + Visible := False; + end; + end; + end; + + SM_PlayList: + begin + Visible := False; + Case Interaction of + 0: //Button 1 + begin + ScreenSong.StartSong; + Visible := False; + end; + + 1: //Button 2 + begin + //Select New Players then Sing: + ScreenSong.SelectPlayers; + Visible := False; + end; + + 2: //Button 3 + begin + //Show add to Playlist Menu + MenuShow(SM_Playlist_DelItem); + end; + + 3: //SelectSlide 3 + begin + //Dummy + end; + + 4: //Button 4 + begin + ScreenSong.OpenEditor; + Visible := False; + end; + end; + end; + + SM_Playlist_Add: + begin + Case Interaction of + 0: //Button 1 + begin + MenuShow(SM_Playlist_New); + end; + + 3: //SelectSlide 3 + begin + //Dummy + end; + + 4: //Button 4 + begin + PlaylistMan.AddItem(ScreenSong.Interaction, SelectValue); + Visible := False; + end; + end; + end; + + SM_Playlist_New: + begin + Case Interaction of + 0: //Button 1 + begin + //Nothing, Button for Entering Name + end; + + 2: //Button 3 + begin + //Create Playlist and Add Song + PlaylistMan.AddItem( + ScreenSong.Interaction, + PlaylistMan.AddPlaylist(Button[0].Text[0].Text)); + Visible := False; + end; + + 3: //SelectSlide 3 + begin + //Cancel -> Go back to Add screen + MenuShow(SM_Playlist_Add); + end; + + 4: //Button 4 + begin + Visible := False; + end; + end; + end; + + SM_Playlist_DelItem: + begin + Visible := False; + Case Interaction of + 0: //Button 1 + begin + //Delete + PlayListMan.DelItem(PlayListMan.GetIndexbySongID(ScreenSong.Interaction)); + Visible := False; + end; + + 4: //Button 4 + begin + MenuShow(SM_Playlist); + end; + end; + end; + + SM_Playlist_Load: + begin + Case Interaction of + 0: //Button 1 (Delete Playlist) + begin + MenuShow(SM_Playlist_Del); + end; + 4: //Button 4 + begin + //Load Playlist + PlaylistMan.SetPlayList(SelectValue); + Visible := False; + end; + end; + end; + + SM_Playlist_Del: + begin + Visible := False; + Case Interaction of + 0: //Button 1 + begin + //Delete + PlayListMan.DelPlaylist(PlaylistMan.CurPlayList); + Visible := False; + end; + + 4: //Button 4 + begin + MenuShow(SM_Playlist_Load); + end; + end; + end; + + SM_Party_Main: + begin + Case Interaction of + 0: //Button 1 + begin + //Start Singing + ScreenSong.StartSong; + Visible := False; + end; + + 4: //Button 4 + begin + //Joker + MenuShow(SM_Party_Joker); + end; + end; + end; + + SM_Party_Joker: + begin + Visible := False; + Case Interaction of + 0: //Button 1 + begin + //Joker Team 1 + ScreenSong.DoJoker(0); + end; + + 1: //Button 2 + begin + //Joker Team 2 + ScreenSong.DoJoker(1); + end; + + 2: //Button 3 + begin + //Joker Team 3 + ScreenSong.DoJoker(2); + end; + + 4: //Button 4 + begin + //Cancel... (Fo back to old Menu) + MenuShow(SM_Party_Main); + end; + end; + end; + end; +end; + +end. + 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. diff --git a/Game/Code/UltraStar.lpi b/Game/Code/UltraStar.lpi index 84980b53..97a25a66 100644 --- a/Game/Code/UltraStar.lpi +++ b/Game/Code/UltraStar.lpi @@ -12,7 +12,7 @@ - + @@ -36,62 +36,62 @@ - + - - + + - + - - - + + + - - - - - + + + - + - + - + + + - - - - + + + + - - - - + + + + @@ -99,26 +99,28 @@ - + - + - - + + + + - - + + @@ -126,169 +128,170 @@ - + - + - + - - - + + + - + - + - + - - - + + + - + - - - + + + - - - - - + + + - - - + + + + + + - - - + + + - + - + - + - + - + - + - - - + - - - + + + - - + + - - - + + + - + - - - + + + + + - - + + @@ -296,76 +299,79 @@ - + - - - + + + - - + + + + + - + - + - + - - - + + + - + - + - + - + - - + + @@ -373,217 +379,305 @@ - + - - - + + + + + - + - + - - - - - - - - + + + - + - - - + + - - - - + - - - - - + + + - - - + - - - + - - - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + - + - + - - + + - + - + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index 31207bcb..bb3b50b3 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -34,155 +34,154 @@ uses //------------------------------ // SDL / OpenGL - sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', - moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', - opengl12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\opengl12.pas', + moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', + opengl12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\opengl12.pas', + sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', // Bass - {$IFDEF win32} - bass in 'lib\bass\delphi\bass.pas', + {$IFDEF UseBASS} + bass in 'lib\bass\delphi\bass.pas', {$ENDIF} // Midi Units {$IFDEF UseMIDIPort} - midiout in 'lib\midi\midiout.pas', - midiin in 'lib\midi\midiin.pas', - Circbuf in 'lib\midi\CIRCBUF.PAS', - MidiType in 'lib\midi\MidiType.PAS', - MidiDefs in 'lib\midi\MidiDefs.PAS', - MidiCons in 'lib\midi\MidiCons.PAS', - MidiFile in 'lib\midi\MidiFile.PAS', - Delphmcb in 'lib\midi\Delphmcb.PAS', + Circbuf in 'lib\midi\CIRCBUF.PAS', + Delphmcb in 'lib\midi\Delphmcb.PAS', + MidiCons in 'lib\midi\MidiCons.PAS', + MidiDefs in 'lib\midi\MidiDefs.PAS', + MidiFile in 'lib\midi\MidiFile.PAS', + midiin in 'lib\midi\midiin.pas', + midiout in 'lib\midi\midiout.pas', + MidiType in 'lib\midi\MidiType.PAS', {$ENDIF} // FFMpeg units - avcodec in 'lib\ffmpeg\avcodec.pas', - avformat in 'lib\ffmpeg\avformat.pas', - avutil in 'lib\ffmpeg\avutil.pas', - rational in 'lib\ffmpeg\rational.pas', - opt in 'lib\ffmpeg\opt.pas', - avio in 'lib\ffmpeg\avio.pas', + avcodec in 'lib\ffmpeg\avcodec.pas', + avformat in 'lib\ffmpeg\avformat.pas', + avio in 'lib\ffmpeg\avio.pas', + avutil in 'lib\ffmpeg\avutil.pas', + opt in 'lib\ffmpeg\opt.pas', + rational in 'lib\ffmpeg\rational.pas', + // Sql Lite - SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', - SQLite3 in 'lib\SQLite\SQLite3.pas', + SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', + SQLite3 in 'lib\SQLite\SQLite3.pas', //------------------------------ //Includes - Menu System //------------------------------ - UMenu in 'Menu\UMenu.pas', - UDisplay in 'Menu\UDisplay.pas', - UMenuStatic in 'Menu\UMenuStatic.pas', - UMenuText in 'Menu\UMenuText.pas', - UMenuButton in 'Menu\UMenuButton.pas', - UMenuInteract in 'Menu\UMenuInteract.pas', - UMenuSelect in 'Menu\UMenuSelect.pas', - UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', - UDrawTexture in 'Menu\UDrawTexture.pas', - UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', - + + UDisplay in 'Menu\UDisplay.pas', + UDrawTexture in 'Menu\UDrawTexture.pas', + UMenu in 'Menu\UMenu.pas', + UMenuButton in 'Menu\UMenuButton.pas', + UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', + UMenuInteract in 'Menu\UMenuInteract.pas', + UMenuSelect in 'Menu\UMenuSelect.pas', + UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', + UMenuStatic in 'Menu\UMenuStatic.pas', + UMenuText in 'Menu\UMenuText.pas', //------------------------------ //Includes - Classes //------------------------------ {$IFDEF FPC} - ulazjpeg in 'Classes\ulazjpeg.pas', + ulazjpeg in 'Classes\ulazjpeg.pas', {$ENDIF} - - UCommon in 'Classes\UCommon.pas', - UTime in 'Classes\UTime.pas', - UCommandLine in 'Classes\UCommandLine.pas', - ULog in 'Classes\ULog.pas', - UMain in 'Classes\UMain.pas', - - UIni in 'Classes\UIni.pas', - UTexture in 'Classes\UTexture.pas', - - UGraphic in 'Classes\UGraphic.pas', - UMusic in 'Classes\UMusic.pas', - ULanguage in 'Classes\ULanguage.pas', - UDraw in 'Classes\UDraw.pas', - URecord in 'Classes\URecord.pas', - TextGL in 'Classes\TextGL.pas', - USongs in 'Classes\USongs.pas', - ULyrics in 'Classes\ULyrics.pas', - USkins in 'Classes\USkins.pas', - UThemes in 'Classes\UThemes.pas', - UJoystick in 'Classes\UJoystick.pas', - ULCD in 'Classes\ULCD.pas', - ULight in 'Classes\ULight.pas', - UDataBase in 'Classes\UDataBase.pas', - UCovers in 'Classes\UCovers.pas', - UCatCovers in 'Classes\UCatCovers.pas', - UFiles in 'Classes\UFiles.pas', - UGraphicClasses in 'Classes\UGraphicClasses.pas', - UDLLManager in 'Classes\UDLLManager.pas', - UParty in 'Classes\UParty.pas', - UPlaylist in 'Classes\UPlaylist.pas', + TextGL in 'Classes\TextGL.pas', + UCatCovers in 'Classes\UCatCovers.pas', + UCommandLine in 'Classes\UCommandLine.pas', + UCommon in 'Classes\UCommon.pas', + UCovers in 'Classes\UCovers.pas', + UDataBase in 'Classes\UDataBase.pas', + UDLLManager in 'Classes\UDLLManager.pas', + UDraw in 'Classes\UDraw.pas', + UFiles in 'Classes\UFiles.pas', + UGraphic in 'Classes\UGraphic.pas', + UGraphicClasses in 'Classes\UGraphicClasses.pas', + UIni in 'Classes\UIni.pas', + UJoystick in 'Classes\UJoystick.pas', + ULanguage in 'Classes\ULanguage.pas', + ULCD in 'Classes\ULCD.pas', + ULight in 'Classes\ULight.pas', + ULog in 'Classes\ULog.pas', + ULyrics in 'Classes\ULyrics.pas', + UMain in 'Classes\UMain.pas', + UMusic in 'Classes\UMusic.pas', + UParty in 'Classes\UParty.pas', + UPlaylist in 'Classes\UPlaylist.pas', + URecord in 'Classes\URecord.pas', + USkins in 'Classes\USkins.pas', + USongs in 'Classes\USongs.pas', + UTexture in 'Classes\UTexture.pas', + UThemes in 'Classes\UThemes.pas', + UTime in 'Classes\UTime.pas', + //------------------------------ //Includes - Video Support //------------------------------ - UVideo in 'Classes\UVideo.pas', + UVideo in 'Classes\UVideo.pas', //------------------------------ //Includes - Screens //------------------------------ - UScreenLoading in 'Screens\UScreenLoading.pas', - UScreenWelcome in 'Screens\UScreenWelcome.pas', - UScreenMain in 'Screens\UScreenMain.pas', - UScreenName in 'Screens\UScreenName.pas', - UScreenLevel in 'Screens\UScreenLevel.pas', - UScreenSong in 'Screens\UScreenSong.pas', - UScreenSing in 'Screens\UScreenSing.pas', - UScreenScore in 'Screens\UScreenScore.pas', - UScreenOptions in 'Screens\UScreenOptions.pas', - UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', - UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', - UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', - UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', - UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', - UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', + UScreenCredits in 'Screens\UScreenCredits.pas', + UScreenEdit in 'Screens\UScreenEdit.pas', + UScreenEditConvert in 'Screens\UScreenEditConvert.pas', + UScreenEditHeader in 'Screens\UScreenEditHeader.pas', + UScreenEditSub in 'Screens\UScreenEditSub.pas', + UScreenLevel in 'Screens\UScreenLevel.pas', + UScreenLoading in 'Screens\UScreenLoading.pas', + UScreenMain in 'Screens\UScreenMain.pas', + UScreenName in 'Screens\UScreenName.pas', + UScreenOpen in 'Screens\UScreenOpen.pas', + UScreenOptions in 'Screens\UScreenOptions.pas', UScreenOptionsAdvanced in 'Screens\UScreenOptionsAdvanced.pas', - UScreenEditSub in 'Screens\UScreenEditSub.pas', - UScreenEdit in 'Screens\UScreenEdit.pas', - UScreenEditConvert in 'Screens\UScreenEditConvert.pas', - UScreenEditHeader in 'Screens\UScreenEditHeader.pas', - UScreenOpen in 'Screens\UScreenOpen.pas', - UScreenTop5 in 'Screens\UScreenTop5.pas', - UScreenSongMenu in 'Screens\UScreenSongMenu.pas', - UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', - UScreenStatMain in 'Screens\UScreenStatMain.pas', - UScreenStatDetail in 'Screens\UScreenStatDetail.pas', - UScreenCredits in 'Screens\UScreenCredits.pas', - UScreenPopup in 'Screens\UScreenPopup.pas', - + UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', + UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', + UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', + UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', + UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', + UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', + UScreenPopup in 'Screens\UScreenPopup.pas', + UScreenScore in 'Screens\UScreenScore.pas', + UScreenSing in 'Screens\UScreenSing.pas', + UScreenSong in 'Screens\UScreenSong.pas', + UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', + UScreenSongMenu in 'Screens\UScreenSongMenu.pas', + UScreenStatDetail in 'Screens\UScreenStatDetail.pas', + UScreenStatMain in 'Screens\UScreenStatMain.pas', + UScreenTop5 in 'Screens\UScreenTop5.pas', + UScreenWelcome in 'Screens\UScreenWelcome.pas', //------------------------------ //Includes - Screens PartyMode //------------------------------ - UScreenSingModi in 'Screens\UScreenSingModi.pas', - UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', - UScreenPartyScore in 'Screens\UScreenPartyScore.pas', - UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', - UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', - UScreenPartyWin in 'Screens\UScreenPartyWin.pas', - + UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', + UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', + UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', + UScreenPartyScore in 'Screens\UScreenPartyScore.pas', + UScreenPartyWin in 'Screens\UScreenPartyWin.pas', + UScreenSingModi in 'Screens\UScreenSingModi.pas', //------------------------------ //Includes - Modi SDK //------------------------------ - ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', + ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', //------------------------------ //Includes - Delphi //------------------------------ + {$IFDEF win32} Windows, + {$ENDIF} SysUtils; const @@ -196,6 +195,7 @@ var begin WndTitle := Version; + {$ifdef Win32} //------------------------------ //Start more than One Time Prevention //------------------------------ @@ -217,6 +217,7 @@ begin else Exit; end; + {$endif} //------------------------------ //StartUp - Create Classes and Load Files diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index 8bfbff34..0bace1cb 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -1,7 +1,13 @@ -{$IFDEF FPC} - {$UNDEF UseSerialPort} - {$UNDEF UseMIDIPort} -{$ELSE} - {$DEFINE UseSerialPort} - {$DEFINE UseMIDIPort} -{$ENDIF} +{$IFDEF FPC} + {$UNDEF UseSerialPort} + {$UNDEF UseMIDIPort} +{$ELSE} + {$DEFINE UseSerialPort} + {$DEFINE UseMIDIPort} +{$ENDIF} + +{$IFDEF win32} + {$DEFINE UseBASS} +{$ELSE} + {$UNDEF UseBASS} +{$ENDIF} -- cgit v1.2.3 From 6562243c21b8ed122befd58c8bf256d7f7aacf35 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Sep 2007 06:37:31 +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@409 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/SQLite/lazarustest.lpi | 14 ++++---------- Game/Code/lib/ffmpeg/lazarustest.lpi | 10 +++++----- 2 files changed, 9 insertions(+), 15 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/lib/SQLite/lazarustest.lpi b/Game/Code/lib/SQLite/lazarustest.lpi index 8c758bc6..0e65a1e2 100644 --- a/Game/Code/lib/SQLite/lazarustest.lpi +++ b/Game/Code/lib/SQLite/lazarustest.lpi @@ -89,22 +89,16 @@ - - - + + - - + - - - - - + diff --git a/Game/Code/lib/ffmpeg/lazarustest.lpi b/Game/Code/lib/ffmpeg/lazarustest.lpi index 399b8b7e..6ba93830 100644 --- a/Game/Code/lib/ffmpeg/lazarustest.lpi +++ b/Game/Code/lib/ffmpeg/lazarustest.lpi @@ -31,7 +31,7 @@ - + @@ -50,7 +50,7 @@ - +
@@ -59,7 +59,7 @@ - + @@ -68,7 +68,7 @@ - + @@ -77,7 +77,7 @@ - +
-- cgit v1.2.3 From 7636d51e65782bfcb902b7bb554eeba668516a6c Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Sep 2007 06:38:52 +0000 Subject: adding my helper script :) sorry bout the absolute paths.. ( will fix it up.. promise :P ) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@410 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/linux-build.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 Game/Code/linux-build.sh (limited to 'Game/Code') diff --git a/Game/Code/linux-build.sh b/Game/Code/linux-build.sh new file mode 100755 index 00000000..ebf73542 --- /dev/null +++ b/Game/Code/linux-build.sh @@ -0,0 +1,4 @@ +clear +fpc -S2cgi -OG1 -gl -vewnhi -l -Filib/JEDI-SDLv1.0/SDL/Pas/ -Fu/usr/bin/lazarus/components/images/lib/i386-linux/ -Fu/usr/bin/lazarus/lcl/units/i386-linux/ -Fu/usr/bin/lazarus/lcl/units/i386-linux/gtk2/ -Fu/usr/bin/lazarus/packager/units/i386-linux/ -Fu. -oUltraStar -dLCL -dLCLgtk2 UltraStar.lpr + +mv ./UltraStar /home/jay/src/ultrastardx/output/ -- cgit v1.2.3 From 0a0728b1bc280ed0e2e932b4d8f3b3b151aa62a8 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Sep 2007 06:51:40 +0000 Subject: fixed a bunch of path delimiter issues on linux build :) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@411 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDLLManager.pas | 10 +- Game/Code/Classes/UIni.pas | 1552 ++++++++++++++++++------------------- Game/Code/Classes/USkins.pas | 328 ++++---- Game/Code/Classes/USongs.pas | 1506 +++++++++++++++++------------------ Game/Code/UltraStar.lpi | 178 +++-- 5 files changed, 1799 insertions(+), 1775 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDLLManager.pas b/Game/Code/Classes/UDLLManager.pas index d25efb35..ff6c16a4 100644 --- a/Game/Code/Classes/UDLLManager.pas +++ b/Game/Code/Classes/UDLLManager.pas @@ -42,11 +42,11 @@ var DLLMan: TDLLMan; const + DLLPath = 'Plugins'; + {$IFDEF win32} - DLLPath = 'Plugins\'; DLLExt = '.dll'; {$ELSE} - DLLPath = 'Plugins/'; DLLExt = '.so'; {$ENDIF} @@ -73,7 +73,7 @@ var SR: TSearchRec; begin - if FindFirst(DLLPath + '*' + DLLExt, faAnyFile , SR) = 0 then + if FindFirst(DLLPath +PathDelim+ '*' + DLLExt, faAnyFile , SR) = 0 then begin repeat SetLength(Plugins, Length(Plugins)+1); @@ -143,7 +143,7 @@ begin exit; } //Load Libary - hLibg := LoadLibrary(PChar(DLLPath + Filename)); + hLibg := LoadLibrary(PChar(DLLPath +PathDelim+ Filename)); //If Loaded if (hLibg <> 0) then begin @@ -170,7 +170,7 @@ function TDLLMan.LoadPlugin(No: Cardinal): boolean; begin Result := False; //Load Libary - hLib := LoadLibrary(PChar(DLLPath + PluginPaths[No])); + hLib := LoadLibrary(PChar(DLLPath +PathDelim+ PluginPaths[No])); //If Loaded if (hLib <> 0) then begin diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index cd5c3716..86ce7361 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -1,776 +1,776 @@ -unit UIni; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -uses IniFiles, ULog, SysUtils; - -type - TIni = class - Name: array[0..11] of string; - - // Templates for Names Mod - NameTeam: array[0..2] of string; - NameTemplate: array[0..11] of string; - - //Filename of the opened iniFile - Filename: string; - - // Game - Players: integer; - Difficulty: integer; - Language: integer; - Tabs: integer; - Tabs_at_startup:integer; //Tabs at Startup fix - Sorting: integer; - Debug: integer; - - // Graphics - Screens: integer; - Resolution: integer; - Depth: integer; - FullScreen: integer; - TextureSize: integer; - SingWindow: integer; - Oscilloscope: integer; - Spectrum: integer; - Spectrograph: integer; - MovieSize: integer; - - // Sound - MicBoost: integer; - ClickAssist: integer; - BeatClick: integer; - SavePlayback: integer; - Threshold: integer; - - //Song Preview - PreviewVolume: integer; - PreviewFading: integer; - - // Lyrics - LyricsFont: integer; - LyricsEffect: integer; - Solmization: integer; - - // Themes - Theme: integer; - SkinNo: integer; - Color: integer; - - // Record - Card: integer; // not saved in config.ini - - CardList: array of record - Name: string; - Input: integer; - ChannelL: integer; - ChannelR: integer; - end; - - // Advanced - LoadAnimation: integer; - EffectSing: integer; - ScreenFade: integer; - AskbeforeDel: integer; - OnSongClick: integer; - LineBonus: integer; - PartyPopup: integer; - - // Controller - Joypad: integer; - - // Soundcards - SoundCard: array[0..7, 1..2] of integer; - - // Devices - LPT: integer; - - procedure Load; - procedure Save; - procedure SaveNames; - procedure SaveLevel; - end; - - -var - Ini: TIni; - IResolution: array of string; - ILanguage: array of string; - ITheme: array of string; - ISkin: array of string; - ICard: array of string; - IInput: array of string; - -const - IPlayers: array[0..4] of string = ('1', '2', '3', '4', '6'); - IDifficulty: array[0..2] of string = ('Easy', 'Medium', 'Hard'); - ITabs: array[0..1] of string = ('Off', 'On'); - - ISorting: array[0..7] of string = ('Edition', 'Genre', 'Language', 'Folder', 'Title', 'Artist', 'Title2', 'Artist2'); - sEdition = 0; - sGenre = 1; - sLanguage = 2; - sFolder = 3; - sTitle = 4; - sArtist = 5; - sTitle2 = 6; - sArtist2 = 7; - - IDebug: array[0..1] of string = ('Off', 'On'); - - IScreens: array[0..1] of string = ('1', '2'); - IFullScreen: array[0..1] of string = ('Off', 'On'); - IDepth: array[0..1] of string = ('16 bit', '32 bit'); - ITextureSize: array[0..2] of string = ('128', '256', '512'); - ISingWindow: array[0..1] of string = ('Small', 'Big'); - - //SingBar Mod - IOscilloscope: array[0..2] of string = ('Off', 'Osci', 'Bar'); - //IOscilloscope: array[0..1] of string = ('Off', 'On'); - - ISpectrum: array[0..1] of string = ('Off', 'On'); - ISpectrograph: array[0..1] of string = ('Off', 'On'); - IMovieSize: array[0..2] of string = ('Half', 'Full [Vid]', 'Full [BG+Vid]'); - - IMicBoost: array[0..3] of string = ('Off', '+6dB', '+12dB', '+18dB'); - IClickAssist: array[0..1] of string = ('Off', 'On'); - IBeatClick: array[0..1] of string = ('Off', 'On'); - ISavePlayback: array[0..1] of string = ('Off', 'On'); - IThreshold: array[0..3] of string = ('5%', '10%', '15%', '20%'); - //Song Preview - IPreviewVolume: array[0..10] of string = ('Off', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%'); - IPreviewFading: array[0..5] of string = ('Off', '1 Sec', '2 Secs', '3 Secs', '4 Secs', '5 Secs'); - - - ILyricsFont: array[0..2] of string = ('Plain', 'OLine1', 'OLine2'); - ILyricsEffect: array[0..3] of string = ('Simple', 'Zoom', 'Slide', 'Ball'); - ISolmization: array[0..3] of string = ('Off', 'Euro', 'Jap', 'American'); - - IColor: array[0..8] of string = ('Blue', 'Green', 'Pink', 'Red', 'Violet', 'Orange', 'Yellow', 'Brown', 'Black'); - - // Advanced - ILoadAnimation: array[0..1] of string = ('Off', 'On'); - IEffectSing: array[0..1] of string = ('Off', 'On'); - IScreenFade: array [0..1] of String =('Off', 'On'); - IAskbeforeDel: array[0..1] of string = ('Off', 'On'); - IOnSongClick: array[0..2] of string = ('Sing', 'Select Players', 'Open Menu'); - ILineBonus: array[0..2] of string = ('Off', 'At Score', 'At Notes'); - IPartyPopup: array[0..1] of string = ('Off', 'On'); - - IJoypad: array[0..1] of string = ('Off', 'On'); - ILPT: array[0..2] of string = ('Off', 'LCD', 'Lights'); - - IChannel: array[0..6] of string = ('0', '1', '2', '3', '4', '5', '6'); - -implementation - -uses //UFiles, - UMain, - SDL, - ULanguage, - USkins, - URecord, - UCommandLine; - -procedure TIni.Load; -var - IniFile: TMemIniFile; - ThemeIni: TMemIniFile; - Tekst: string; - Pet: integer; - B: boolean; - I, I2, I3: integer; - S: string; - Modes: PPSDL_Rect; - SR: TSearchRec; //Skin List Patch - - function GetFileName (S: String):String; - begin - //Result := copy (S,0,StrRScan (PChar(S),char('.'))+1); - Result := copy (S,0,Pos ('.ini',S)-1); - end; - -begin - GamePath := ExtractFilePath(ParamStr(0)); - - if (Params.ConfigFile <> '') then - try - IniFile := TMemIniFile.Create(Params.ConfigFile); - except - IniFile := TMemIniFile.Create(GamePath + 'config.ini'); - end - else - IniFile := TMemIniFile.Create(GamePath + 'config.ini'); - - - // Name - for I := 0 to 11 do - Ini.Name[I] := IniFile.ReadString('Name', 'P'+IntToStr(I+1), 'Player'+IntToStr(I+1)); - - - // Templates for Names Mod - for I := 0 to 2 do - Ini.NameTeam[I] := IniFile.ReadString('NameTeam', 'T'+IntToStr(I+1), 'Team'+IntToStr(I+1)); - for I := 0 to 11 do - Ini.NameTemplate[I] := IniFile.ReadString('NameTemplate', 'Name'+IntToStr(I+1), 'Template'+IntToStr(I+1)); - - // Players - Tekst := IniFile.ReadString('Game', 'Players', IPlayers[0]); - for Pet := 0 to High(IPlayers) do - if Tekst = IPlayers[Pet] then Ini.Players := Pet; - - // Difficulty - Tekst := IniFile.ReadString('Game', 'Difficulty', 'Easy'); - for Pet := 0 to High(IDifficulty) do - if Tekst = IDifficulty[Pet] then Ini.Difficulty := Pet; - - // Language - Tekst := IniFile.ReadString('Game', 'Language', 'English'); - for Pet := 0 to High(ILanguage) do - if Tekst = ILanguage[Pet] then Ini.Language := Pet; - -// Language.ChangeLanguage(ILanguage[Ini.Language]); - - // Tabs - Tekst := IniFile.ReadString('Game', 'Tabs', ITabs[0]); - for Pet := 0 to High(ITabs) do - if Tekst = ITabs[Pet] then Ini.Tabs := Pet; - - //Tabs at Startup fix - Ini.Tabs_at_startup := Ini.Tabs; - - // Sorting - Tekst := IniFile.ReadString('Game', 'Sorting', ISorting[0]); - for Pet := 0 to High(ISorting) do - if Tekst = ISorting[Pet] then Ini.Sorting := Pet; - - // Debug - Tekst := IniFile.ReadString('Game', 'Debug', IDebug[0]); - for Pet := 0 to High(IDebug) do - if Tekst = IDebug[Pet] then Ini.Debug := Pet; - - //if Ini.Debug = 1 then SongPath := 'E:\UltraStar 03\Songs\'; - - // Screens - Tekst := IniFile.ReadString('Graphics', 'Screens', IScreens[0]); - for Pet := 0 to High(IScreens) do - if Tekst = IScreens[Pet] then Ini.Screens := Pet; - - // Resolution - SetLength(IResolution, 0); - Modes := SDL_ListModes(nil, SDL_OPENGL or SDL_FULLSCREEN); // Check if there are any modes available - repeat -// Log.LogError(Format( ' %d x %d', [ modes^.w, modes^.h ] ) ); - SetLength(IResolution, Length(IResolution) + 1); - IResolution[High(IResolution)] := IntToStr(Modes^.w) + 'x' + IntToStr(Modes^.h); - Inc(Modes); - until Modes^ = nil; - - // reverse order - for I := 0 to (Length(IResolution) div 2) - 1 do begin - S := IResolution[I]; - IResolution[I] := IResolution[High(IResolution)-I]; - IResolution[High(IResolution)-I] := S; - end; - - Tekst := IniFile.ReadString('Graphics', 'Resolution', '800x600'); - for Pet := 0 to High(IResolution) do - if Tekst = IResolution[Pet] then Ini.Resolution := Pet; - - // FullScreen - Tekst := IniFile.ReadString('Graphics', 'FullScreen', 'On'); - for Pet := 0 to High(IFullScreen) do - if Tekst = IFullScreen[Pet] then Ini.FullScreen := Pet; - - // Resolution - Tekst := IniFile.ReadString('Graphics', 'Depth', '32 bit'); - for Pet := 0 to High(IDepth) do - if Tekst = IDepth[Pet] then Ini.Depth := Pet; - - // Texture Size - Tekst := IniFile.ReadString('Graphics', 'TextureSize', ITextureSize[1]); - for Pet := 0 to High(ITextureSize) do - if Tekst = ITextureSize[Pet] then Ini.TextureSize := Pet; - - // SingWindow - Tekst := IniFile.ReadString('Graphics', 'SingWindow', 'Big'); - for Pet := 0 to High(ISingWindow) do - if Tekst = ISingWindow[Pet] then Ini.SingWindow := Pet; - - // Oscilloscope - Tekst := IniFile.ReadString('Graphics', 'Oscilloscope', 'Bar'); - for Pet := 0 to High(IOscilloscope) do - if Tekst = IOscilloscope[Pet] then Ini.Oscilloscope := Pet; - - // Spectrum - Tekst := IniFile.ReadString('Graphics', 'Spectrum', 'Off'); - for Pet := 0 to High(ISpectrum) do - if Tekst = ISpectrum[Pet] then Ini.Spectrum := Pet; - - // Spectrograph - Tekst := IniFile.ReadString('Graphics', 'Spectrograph', 'Off'); - for Pet := 0 to High(ISpectrograph) do - if Tekst = ISpectrograph[Pet] then Ini.Spectrograph := Pet; - - // MovieSize - Tekst := IniFile.ReadString('Graphics', 'MovieSize', IMovieSize[2]); - for Pet := 0 to High(IMovieSize) do - if Tekst = IMovieSize[Pet] then Ini.MovieSize := Pet; - - // MicBoost - Tekst := IniFile.ReadString('Sound', 'MicBoost', 'Off'); - for Pet := 0 to High(IMicBoost) do - if Tekst = IMicBoost[Pet] then Ini.MicBoost := Pet; - - // ClickAssist - Tekst := IniFile.ReadString('Sound', 'ClickAssist', 'Off'); - for Pet := 0 to High(IClickAssist) do - if Tekst = IClickAssist[Pet] then Ini.ClickAssist := Pet; - - // BeatClick - Tekst := IniFile.ReadString('Sound', 'BeatClick', IBeatClick[0]); - for Pet := 0 to High(IBeatClick) do - if Tekst = IBeatClick[Pet] then Ini.BeatClick := Pet; - - // SavePlayback - Tekst := IniFile.ReadString('Sound', 'SavePlayback', ISavePlayback[0]); - for Pet := 0 to High(ISavePlayback) do - if Tekst = ISavePlayback[Pet] then Ini.SavePlayback := Pet; - - // Threshold - Tekst := IniFile.ReadString('Sound', 'Threshold', IThreshold[2]); - for Pet := 0 to High(IThreshold) do - if Tekst = IThreshold[Pet] then Ini.Threshold := Pet; - - //Song Preview - Tekst := IniFile.ReadString('Sound', 'PreviewVolume', IPreviewVolume[7]); - for Pet := 0 to High(IPreviewVolume) do - if Tekst = IPreviewVolume[Pet] then Ini.PreviewVolume := Pet; - - Tekst := IniFile.ReadString('Sound', 'PreviewFading', IPreviewFading[1]); - for Pet := 0 to High(IPreviewFading) do - if Tekst = IPreviewFading[Pet] then Ini.PreviewFading := Pet; - - // Lyrics Font - Tekst := IniFile.ReadString('Lyrics', 'LyricsFont', ILyricsFont[1]); - for Pet := 0 to High(ILyricsFont) do - if Tekst = ILyricsFont[Pet] then Ini.LyricsFont := Pet; - - // Lyrics Effect - Tekst := IniFile.ReadString('Lyrics', 'LyricsEffect', ILyricsEffect[1]); - for Pet := 0 to High(ILyricsEffect) do - if Tekst = ILyricsEffect[Pet] then Ini.LyricsEffect := Pet; - - // Solmization - Tekst := IniFile.ReadString('Lyrics', 'Solmization', ISolmization[0]); - for Pet := 0 to High(ISolmization) do - if Tekst = ISolmization[Pet] then Ini.Solmization := Pet; - - // Theme - - //Theme List Patch - - //I2 Saves the no of the Deluxe (Standard-) Theme - I2 := 0; - //I counts is the cur. Theme no - I := 0; - - SetLength(ITheme, 0); - FindFirst('Themes\*.ini',faAnyFile,SR); - Repeat - //Read Themename from Theme - ThemeIni := TMemIniFile.Create(SR.Name); - Tekst := UpperCase(ThemeIni.ReadString('Theme','Name',GetFileName(SR.Name))); - ThemeIni.Free; - - //if Deluxe Theme then save Themeno to I2 - if (Tekst = 'DELUXE') then - I2 := I; - - //Search for Skins for this Theme - for Pet := low(Skin.Skin) to high(Skin.Skin) do - begin - if UpperCase(Skin.Skin[Pet].Theme) = Tekst then - begin - SetLength(ITheme, Length(ITheme)+1); - ITheme[High(ITheme)] := GetFileName(SR.Name); - break; - end; - end; - - Inc(I); - Until FindNext(SR) <> 0; - FindClose(SR); - //Theme List Patch End } - - //No Theme Found - if (Length(ITheme)=0) then - begin - Log.CriticalError('Could not find any valid Themes.'); - end; - - - Tekst := IniFile.ReadString('Themes', 'Theme', ITheme[I2]); - Ini.Theme := 0; - for Pet := 0 to High(ITheme) do - if Uppercase(Tekst) = Uppercase(ITheme[Pet]) then Ini.Theme := Pet; - - // Skin - Skin.onThemeChange; - Ini.SkinNo := 0; - - Tekst := IniFile.ReadString('Themes', 'Skin', ISkin[0]); - for Pet := 0 to High(ISkin) do - if Tekst = ISkin[Pet] then Ini.SkinNo := Pet; - - // Color - Tekst := IniFile.ReadString('Themes', 'Color', IColor[0]); - for Pet := 0 to High(IColor) do - if Tekst = IColor[Pet] then Ini.Color := Pet; - - // Record - load ini list - SetLength(CardList, 0); - I := 1; - while (IniFile.ValueExists('Record', 'DeviceName' + IntToStr(I)) = true) do begin - //Automatically Delete not Existing Sound Cards - S := IniFile.ReadString('Record', 'DeviceName' + IntToStr(I), ''); - //{ - B := False; - //Look for Soundcard - for I2 := 0 to High(Recording.SoundCard) do - begin - if (S = Trim(Recording.SoundCard[I2].Description)) then - begin - B := True; - Break; - end; - end; - - if B then - begin //} - I3 := Length(CardList); - SetLength(CardList, I3+1); - Ini.CardList[I3].Name := S; - Ini.CardList[I3].Input := IniFile.ReadInteger('Record', 'Input' + IntToStr(I), 0); - Ini.CardList[I3].ChannelL := IniFile.ReadInteger('Record', 'ChannelL' + IntToStr(I), 0); - Ini.CardList[I3].ChannelR := IniFile.ReadInteger('Record', 'ChannelR' + IntToStr(I), 0); - end; - Inc(I); - end; - - // Record - append detected soundcards - for I := 0 to High(Recording.SoundCard) do - begin - B := False; - For I2 := 0 to High(CardList) do - begin //Search for Card in List - if (CardList[I2].Name = Trim(Recording.SoundCard[I].Description)) then - begin - B := True; - Break; - end; - end; - - //If not in List -> Add - If not B then - begin - I3 := Length(CardList); - SetLength(CardList, I3+1); - CardList[I3].Name := Trim(Recording.SoundCard[I].Description); - CardList[I3].Input := 0; - CardList[I3].ChannelL := 0; - CardList[I3].ChannelR := 0; - // default for new users - if (Length(CardList) = 1) then - CardList[I].ChannelL := 1; - end; - end; - - //Advanced Settings - - // LoadAnimation - Tekst := IniFile.ReadString('Advanced', 'LoadAnimation', 'On'); - for Pet := 0 to High(ILoadAnimation) do - if Tekst = ILoadAnimation[Pet] then Ini.LoadAnimation := Pet; - - // ScreenFade - Tekst := IniFile.ReadString('Advanced', 'ScreenFade', 'On'); - for Pet := 0 to High(IScreenFade) do - if Tekst = IScreenFade[Pet] then Ini.ScreenFade := Pet; - - // EffectSing - Tekst := IniFile.ReadString('Advanced', 'EffectSing', 'On'); - for Pet := 0 to High(IEffectSing) do - if Tekst = IEffectSing[Pet] then Ini.EffectSing := Pet; - - // AskbeforeDel - Tekst := IniFile.ReadString('Advanced', 'AskbeforeDel', 'On'); - for Pet := 0 to High(IAskbeforeDel) do - if Tekst = IAskbeforeDel[Pet] then Ini.AskbeforeDel := Pet; - - // OnSongClick - Tekst := IniFile.ReadString('Advanced', 'OnSongClick', 'Sing'); - for Pet := 0 to High(IOnSongClick) do - if Tekst = IOnSongClick[Pet] then Ini.OnSongClick := Pet; - - // Linebonus - Tekst := IniFile.ReadString('Advanced', 'LineBonus', 'At Score'); - for Pet := 0 to High(ILineBonus) do - if Tekst = ILineBonus[Pet] then Ini.LineBonus := Pet; - - // PartyPopup - Tekst := IniFile.ReadString('Advanced', 'PartyPopup', 'On'); - for Pet := 0 to High(IPartyPopup) do - if Tekst = IPartyPopup[Pet] then Ini.PartyPopup := Pet; - - - // Joypad - Tekst := IniFile.ReadString('Controller', 'Joypad', IJoypad[0]); - for Pet := 0 to High(IJoypad) do - if Tekst = IJoypad[Pet] then Ini.Joypad := Pet; - - // LCD - Tekst := IniFile.ReadString('Devices', 'LPT', ILPT[0]); - for Pet := 0 to High(ILPT) do - if Tekst = ILPT[Pet] then Ini.LPT := Pet; - - - // SongPath - if (Params.SongPath <> '') then - SongPath := IncludeTrailingPathDelimiter(Params.SongPath) - else - SongPath := IncludeTrailingPathDelimiter(IniFile.ReadString('Path', 'Songs', SongPath)); - - Filename := IniFile.FileName; - IniFile.Free; -end; - -procedure TIni.Save; -var - IniFile: TIniFile; - Tekst: string; - I: Integer; - S: String; -begin - //if not (FileExists(GamePath + 'config.ini') and FileIsReadOnly(GamePath + 'config.ini')) then begin - if not (FileExists(Filename) and FileIsReadOnly(Filename)) then begin - - IniFile := TIniFile.Create(Filename); - - // Players - Tekst := IPlayers[Ini.Players]; - IniFile.WriteString('Game', 'Players', Tekst); - - // Difficulty - Tekst := IDifficulty[Ini.Difficulty]; - IniFile.WriteString('Game', 'Difficulty', Tekst); - - // Language - Tekst := ILanguage[Ini.Language]; - IniFile.WriteString('Game', 'Language', Tekst); - - // Tabs - Tekst := ITabs[Ini.Tabs]; - IniFile.WriteString('Game', 'Tabs', Tekst); - - // Sorting - Tekst := ISorting[Ini.Sorting]; - IniFile.WriteString('Game', 'Sorting', Tekst); - - // Debug - Tekst := IDebug[Ini.Debug]; - IniFile.WriteString('Game', 'Debug', Tekst); - - // Screens - Tekst := IScreens[Ini.Screens]; - IniFile.WriteString('Graphics', 'Screens', Tekst); - - // FullScreen - Tekst := IFullScreen[Ini.FullScreen]; - IniFile.WriteString('Graphics', 'FullScreen', Tekst); - - // Resolution - Tekst := IResolution[Ini.Resolution]; - IniFile.WriteString('Graphics', 'Resolution', Tekst); - - // Depth - Tekst := IDepth[Ini.Depth]; - IniFile.WriteString('Graphics', 'Depth', Tekst); - - // Resolution - Tekst := ITextureSize[Ini.TextureSize]; - IniFile.WriteString('Graphics', 'TextureSize', Tekst); - - // Sing Window - Tekst := ISingWindow[Ini.SingWindow]; - IniFile.WriteString('Graphics', 'SingWindow', Tekst); - - // Oscilloscope - Tekst := IOscilloscope[Ini.Oscilloscope]; - IniFile.WriteString('Graphics', 'Oscilloscope', Tekst); - - // Spectrum - Tekst := ISpectrum[Ini.Spectrum]; - IniFile.WriteString('Graphics', 'Spectrum', Tekst); - - // Spectrograph - Tekst := ISpectrograph[Ini.Spectrograph]; - IniFile.WriteString('Graphics', 'Spectrograph', Tekst); - - // Movie Size - Tekst := IMovieSize[Ini.MovieSize]; - IniFile.WriteString('Graphics', 'MovieSize', Tekst); - - // MicBoost - Tekst := IMicBoost[Ini.MicBoost]; - IniFile.WriteString('Sound', 'MicBoost', Tekst); - - // ClickAssist - Tekst := IClickAssist[Ini.ClickAssist]; - IniFile.WriteString('Sound', 'ClickAssist', Tekst); - - // BeatClick - Tekst := IBeatClick[Ini.BeatClick]; - IniFile.WriteString('Sound', 'BeatClick', Tekst); - - // Threshold - Tekst := IThreshold[Ini.Threshold]; - IniFile.WriteString('Sound', 'Threshold', Tekst); - - // Song Preview - Tekst := IPreviewVolume[Ini.PreviewVolume]; - IniFile.WriteString('Sound', 'PreviewVolume', Tekst); - - Tekst := IPreviewFading[Ini.PreviewFading]; - IniFile.WriteString('Sound', 'PreviewFading', Tekst); - - // SavePlayback - Tekst := ISavePlayback[Ini.SavePlayback]; - IniFile.WriteString('Sound', 'SavePlayback', Tekst); - - // Lyrics Font - Tekst := ILyricsFont[Ini.LyricsFont]; - IniFile.WriteString('Lyrics', 'LyricsFont', Tekst); - - // Lyrics Effect - Tekst := ILyricsEffect[Ini.LyricsEffect]; - IniFile.WriteString('Lyrics', 'LyricsEffect', Tekst); - - // Solmization - Tekst := ISolmization[Ini.Solmization]; - IniFile.WriteString('Lyrics', 'Solmization', Tekst); - - // Theme - Tekst := ITheme[Ini.Theme]; - IniFile.WriteString('Themes', 'Theme', Tekst); - - // Skin - Tekst := ISkin[Ini.SkinNo]; - IniFile.WriteString('Themes', 'Skin', Tekst); - - // Color - Tekst := IColor[Ini.Color]; - IniFile.WriteString('Themes', 'Color', Tekst); - - // Record - for I := 0 to High(CardList) do begin - S := IntToStr(I+1); - - Tekst := CardList[I].Name; - IniFile.WriteString('Record', 'DeviceName' + S, Tekst); - - Tekst := IntToStr(CardList[I].Input); - IniFile.WriteString('Record', 'Input' + S, Tekst); - - Tekst := IntToStr(CardList[I].ChannelL); - IniFile.WriteString('Record', 'ChannelL' + S, Tekst); - - Tekst := IntToStr(CardList[I].ChannelR); - IniFile.WriteString('Record', 'ChannelR' + S, Tekst); - end; - - //Log.LogError(InttoStr(Length(CardList)) + ' Cards Saved'); - - //Advanced Settings - - //LoadAnimation - Tekst := ILoadAnimation[Ini.LoadAnimation]; - IniFile.WriteString('Advanced', 'LoadAnimation', Tekst); - - //EffectSing - Tekst := IEffectSing[Ini.EffectSing]; - IniFile.WriteString('Advanced', 'EffectSing', Tekst); - - //ScreenFade - Tekst := IScreenFade[Ini.ScreenFade]; - IniFile.WriteString('Advanced', 'ScreenFade', Tekst); - - //AskbeforeDel - Tekst := IAskbeforeDel[Ini.AskbeforeDel]; - IniFile.WriteString('Advanced', 'AskbeforeDel', Tekst); - - //OnSongClick - Tekst := IOnSongClick[Ini.OnSongClick]; - IniFile.WriteString('Advanced', 'OnSongClick', Tekst); - - //Line Bonus - Tekst := ILineBonus[Ini.LineBonus]; - IniFile.WriteString('Advanced', 'LineBonus', Tekst); - - //Party Popup - Tekst := IPartyPopup[Ini.PartyPopup]; - IniFile.WriteString('Advanced', 'PartyPopup', Tekst); - - // Joypad - Tekst := IJoypad[Ini.Joypad]; - IniFile.WriteString('Controller', 'Joypad', Tekst); - - IniFile.Free; - end; -end; - -procedure TIni.SaveNames; -var - IniFile: TIniFile; - I: integer; -begin - //if not FileIsReadOnly(GamePath + 'config.ini') then begin - //IniFile := TIniFile.Create(GamePath + 'config.ini'); - if not FileIsReadOnly(Filename) then begin - IniFile := TIniFile.Create(Filename); - - //Name - // Templates for Names Mod - for I := 1 to 12 do - IniFile.WriteString('Name', 'P' + IntToStr(I), Ini.Name[I-1]); - for I := 1 to 3 do - IniFile.WriteString('NameTeam', 'T' + IntToStr(I), Ini.NameTeam[I-1]); - for I := 1 to 12 do - IniFile.WriteString('NameTemplate', 'Name' + IntToStr(I), Ini.NameTemplate[I-1]); - - IniFile.Free; - end; -end; - -procedure TIni.SaveLevel; -var - IniFile: TIniFile; - I: integer; -begin - //if not FileIsReadOnly(GamePath + 'config.ini') then begin - //IniFile := TIniFile.Create(GamePath + 'config.ini'); - if not FileIsReadOnly(Filename) then begin - IniFile := TIniFile.Create(Filename); - - // Difficulty - IniFile.WriteString('Game', 'Difficulty', IDifficulty[Ini.Difficulty]); - - IniFile.Free; - end; -end; - -end. +unit UIni; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses IniFiles, ULog, SysUtils; + +type + TIni = class + Name: array[0..11] of string; + + // Templates for Names Mod + NameTeam: array[0..2] of string; + NameTemplate: array[0..11] of string; + + //Filename of the opened iniFile + Filename: string; + + // Game + Players: integer; + Difficulty: integer; + Language: integer; + Tabs: integer; + Tabs_at_startup:integer; //Tabs at Startup fix + Sorting: integer; + Debug: integer; + + // Graphics + Screens: integer; + Resolution: integer; + Depth: integer; + FullScreen: integer; + TextureSize: integer; + SingWindow: integer; + Oscilloscope: integer; + Spectrum: integer; + Spectrograph: integer; + MovieSize: integer; + + // Sound + MicBoost: integer; + ClickAssist: integer; + BeatClick: integer; + SavePlayback: integer; + Threshold: integer; + + //Song Preview + PreviewVolume: integer; + PreviewFading: integer; + + // Lyrics + LyricsFont: integer; + LyricsEffect: integer; + Solmization: integer; + + // Themes + Theme: integer; + SkinNo: integer; + Color: integer; + + // Record + Card: integer; // not saved in config.ini + + CardList: array of record + Name: string; + Input: integer; + ChannelL: integer; + ChannelR: integer; + end; + + // Advanced + LoadAnimation: integer; + EffectSing: integer; + ScreenFade: integer; + AskbeforeDel: integer; + OnSongClick: integer; + LineBonus: integer; + PartyPopup: integer; + + // Controller + Joypad: integer; + + // Soundcards + SoundCard: array[0..7, 1..2] of integer; + + // Devices + LPT: integer; + + procedure Load; + procedure Save; + procedure SaveNames; + procedure SaveLevel; + end; + + +var + Ini: TIni; + IResolution: array of string; + ILanguage: array of string; + ITheme: array of string; + ISkin: array of string; + ICard: array of string; + IInput: array of string; + +const + IPlayers: array[0..4] of string = ('1', '2', '3', '4', '6'); + IDifficulty: array[0..2] of string = ('Easy', 'Medium', 'Hard'); + ITabs: array[0..1] of string = ('Off', 'On'); + + ISorting: array[0..7] of string = ('Edition', 'Genre', 'Language', 'Folder', 'Title', 'Artist', 'Title2', 'Artist2'); + sEdition = 0; + sGenre = 1; + sLanguage = 2; + sFolder = 3; + sTitle = 4; + sArtist = 5; + sTitle2 = 6; + sArtist2 = 7; + + IDebug: array[0..1] of string = ('Off', 'On'); + + IScreens: array[0..1] of string = ('1', '2'); + IFullScreen: array[0..1] of string = ('Off', 'On'); + IDepth: array[0..1] of string = ('16 bit', '32 bit'); + ITextureSize: array[0..2] of string = ('128', '256', '512'); + ISingWindow: array[0..1] of string = ('Small', 'Big'); + + //SingBar Mod + IOscilloscope: array[0..2] of string = ('Off', 'Osci', 'Bar'); + //IOscilloscope: array[0..1] of string = ('Off', 'On'); + + ISpectrum: array[0..1] of string = ('Off', 'On'); + ISpectrograph: array[0..1] of string = ('Off', 'On'); + IMovieSize: array[0..2] of string = ('Half', 'Full [Vid]', 'Full [BG+Vid]'); + + IMicBoost: array[0..3] of string = ('Off', '+6dB', '+12dB', '+18dB'); + IClickAssist: array[0..1] of string = ('Off', 'On'); + IBeatClick: array[0..1] of string = ('Off', 'On'); + ISavePlayback: array[0..1] of string = ('Off', 'On'); + IThreshold: array[0..3] of string = ('5%', '10%', '15%', '20%'); + //Song Preview + IPreviewVolume: array[0..10] of string = ('Off', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%'); + IPreviewFading: array[0..5] of string = ('Off', '1 Sec', '2 Secs', '3 Secs', '4 Secs', '5 Secs'); + + + ILyricsFont: array[0..2] of string = ('Plain', 'OLine1', 'OLine2'); + ILyricsEffect: array[0..3] of string = ('Simple', 'Zoom', 'Slide', 'Ball'); + ISolmization: array[0..3] of string = ('Off', 'Euro', 'Jap', 'American'); + + IColor: array[0..8] of string = ('Blue', 'Green', 'Pink', 'Red', 'Violet', 'Orange', 'Yellow', 'Brown', 'Black'); + + // Advanced + ILoadAnimation: array[0..1] of string = ('Off', 'On'); + IEffectSing: array[0..1] of string = ('Off', 'On'); + IScreenFade: array [0..1] of String =('Off', 'On'); + IAskbeforeDel: array[0..1] of string = ('Off', 'On'); + IOnSongClick: array[0..2] of string = ('Sing', 'Select Players', 'Open Menu'); + ILineBonus: array[0..2] of string = ('Off', 'At Score', 'At Notes'); + IPartyPopup: array[0..1] of string = ('Off', 'On'); + + IJoypad: array[0..1] of string = ('Off', 'On'); + ILPT: array[0..2] of string = ('Off', 'LCD', 'Lights'); + + IChannel: array[0..6] of string = ('0', '1', '2', '3', '4', '5', '6'); + +implementation + +uses //UFiles, + UMain, + SDL, + ULanguage, + USkins, + URecord, + UCommandLine; + +procedure TIni.Load; +var + IniFile: TMemIniFile; + ThemeIni: TMemIniFile; + Tekst: string; + Pet: integer; + B: boolean; + I, I2, I3: integer; + S: string; + Modes: PPSDL_Rect; + SR: TSearchRec; //Skin List Patch + + function GetFileName (S: String):String; + begin + //Result := copy (S,0,StrRScan (PChar(S),char('.'))+1); + Result := copy (S,0,Pos ('.ini',S)-1); + end; + +begin + GamePath := ExtractFilePath(ParamStr(0)); + + if (Params.ConfigFile <> '') then + try + IniFile := TMemIniFile.Create(Params.ConfigFile); + except + IniFile := TMemIniFile.Create(GamePath + 'config.ini'); + end + else + IniFile := TMemIniFile.Create(GamePath + 'config.ini'); + + + // Name + for I := 0 to 11 do + Ini.Name[I] := IniFile.ReadString('Name', 'P'+IntToStr(I+1), 'Player'+IntToStr(I+1)); + + + // Templates for Names Mod + for I := 0 to 2 do + Ini.NameTeam[I] := IniFile.ReadString('NameTeam', 'T'+IntToStr(I+1), 'Team'+IntToStr(I+1)); + for I := 0 to 11 do + Ini.NameTemplate[I] := IniFile.ReadString('NameTemplate', 'Name'+IntToStr(I+1), 'Template'+IntToStr(I+1)); + + // Players + Tekst := IniFile.ReadString('Game', 'Players', IPlayers[0]); + for Pet := 0 to High(IPlayers) do + if Tekst = IPlayers[Pet] then Ini.Players := Pet; + + // Difficulty + Tekst := IniFile.ReadString('Game', 'Difficulty', 'Easy'); + for Pet := 0 to High(IDifficulty) do + if Tekst = IDifficulty[Pet] then Ini.Difficulty := Pet; + + // Language + Tekst := IniFile.ReadString('Game', 'Language', 'English'); + for Pet := 0 to High(ILanguage) do + if Tekst = ILanguage[Pet] then Ini.Language := Pet; + +// Language.ChangeLanguage(ILanguage[Ini.Language]); + + // Tabs + Tekst := IniFile.ReadString('Game', 'Tabs', ITabs[0]); + for Pet := 0 to High(ITabs) do + if Tekst = ITabs[Pet] then Ini.Tabs := Pet; + + //Tabs at Startup fix + Ini.Tabs_at_startup := Ini.Tabs; + + // Sorting + Tekst := IniFile.ReadString('Game', 'Sorting', ISorting[0]); + for Pet := 0 to High(ISorting) do + if Tekst = ISorting[Pet] then Ini.Sorting := Pet; + + // Debug + Tekst := IniFile.ReadString('Game', 'Debug', IDebug[0]); + for Pet := 0 to High(IDebug) do + if Tekst = IDebug[Pet] then Ini.Debug := Pet; + + //if Ini.Debug = 1 then SongPath := 'E:\UltraStar 03\Songs\'; + + // Screens + Tekst := IniFile.ReadString('Graphics', 'Screens', IScreens[0]); + for Pet := 0 to High(IScreens) do + if Tekst = IScreens[Pet] then Ini.Screens := Pet; + + // Resolution + SetLength(IResolution, 0); + Modes := SDL_ListModes(nil, SDL_OPENGL or SDL_FULLSCREEN); // Check if there are any modes available + repeat +// Log.LogError(Format( ' %d x %d', [ modes^.w, modes^.h ] ) ); + SetLength(IResolution, Length(IResolution) + 1); + IResolution[High(IResolution)] := IntToStr(Modes^.w) + 'x' + IntToStr(Modes^.h); + Inc(Modes); + until Modes^ = nil; + + // reverse order + for I := 0 to (Length(IResolution) div 2) - 1 do begin + S := IResolution[I]; + IResolution[I] := IResolution[High(IResolution)-I]; + IResolution[High(IResolution)-I] := S; + end; + + Tekst := IniFile.ReadString('Graphics', 'Resolution', '800x600'); + for Pet := 0 to High(IResolution) do + if Tekst = IResolution[Pet] then Ini.Resolution := Pet; + + // FullScreen + Tekst := IniFile.ReadString('Graphics', 'FullScreen', 'On'); + for Pet := 0 to High(IFullScreen) do + if Tekst = IFullScreen[Pet] then Ini.FullScreen := Pet; + + // Resolution + Tekst := IniFile.ReadString('Graphics', 'Depth', '32 bit'); + for Pet := 0 to High(IDepth) do + if Tekst = IDepth[Pet] then Ini.Depth := Pet; + + // Texture Size + Tekst := IniFile.ReadString('Graphics', 'TextureSize', ITextureSize[1]); + for Pet := 0 to High(ITextureSize) do + if Tekst = ITextureSize[Pet] then Ini.TextureSize := Pet; + + // SingWindow + Tekst := IniFile.ReadString('Graphics', 'SingWindow', 'Big'); + for Pet := 0 to High(ISingWindow) do + if Tekst = ISingWindow[Pet] then Ini.SingWindow := Pet; + + // Oscilloscope + Tekst := IniFile.ReadString('Graphics', 'Oscilloscope', 'Bar'); + for Pet := 0 to High(IOscilloscope) do + if Tekst = IOscilloscope[Pet] then Ini.Oscilloscope := Pet; + + // Spectrum + Tekst := IniFile.ReadString('Graphics', 'Spectrum', 'Off'); + for Pet := 0 to High(ISpectrum) do + if Tekst = ISpectrum[Pet] then Ini.Spectrum := Pet; + + // Spectrograph + Tekst := IniFile.ReadString('Graphics', 'Spectrograph', 'Off'); + for Pet := 0 to High(ISpectrograph) do + if Tekst = ISpectrograph[Pet] then Ini.Spectrograph := Pet; + + // MovieSize + Tekst := IniFile.ReadString('Graphics', 'MovieSize', IMovieSize[2]); + for Pet := 0 to High(IMovieSize) do + if Tekst = IMovieSize[Pet] then Ini.MovieSize := Pet; + + // MicBoost + Tekst := IniFile.ReadString('Sound', 'MicBoost', 'Off'); + for Pet := 0 to High(IMicBoost) do + if Tekst = IMicBoost[Pet] then Ini.MicBoost := Pet; + + // ClickAssist + Tekst := IniFile.ReadString('Sound', 'ClickAssist', 'Off'); + for Pet := 0 to High(IClickAssist) do + if Tekst = IClickAssist[Pet] then Ini.ClickAssist := Pet; + + // BeatClick + Tekst := IniFile.ReadString('Sound', 'BeatClick', IBeatClick[0]); + for Pet := 0 to High(IBeatClick) do + if Tekst = IBeatClick[Pet] then Ini.BeatClick := Pet; + + // SavePlayback + Tekst := IniFile.ReadString('Sound', 'SavePlayback', ISavePlayback[0]); + for Pet := 0 to High(ISavePlayback) do + if Tekst = ISavePlayback[Pet] then Ini.SavePlayback := Pet; + + // Threshold + Tekst := IniFile.ReadString('Sound', 'Threshold', IThreshold[2]); + for Pet := 0 to High(IThreshold) do + if Tekst = IThreshold[Pet] then Ini.Threshold := Pet; + + //Song Preview + Tekst := IniFile.ReadString('Sound', 'PreviewVolume', IPreviewVolume[7]); + for Pet := 0 to High(IPreviewVolume) do + if Tekst = IPreviewVolume[Pet] then Ini.PreviewVolume := Pet; + + Tekst := IniFile.ReadString('Sound', 'PreviewFading', IPreviewFading[1]); + for Pet := 0 to High(IPreviewFading) do + if Tekst = IPreviewFading[Pet] then Ini.PreviewFading := Pet; + + // Lyrics Font + Tekst := IniFile.ReadString('Lyrics', 'LyricsFont', ILyricsFont[1]); + for Pet := 0 to High(ILyricsFont) do + if Tekst = ILyricsFont[Pet] then Ini.LyricsFont := Pet; + + // Lyrics Effect + Tekst := IniFile.ReadString('Lyrics', 'LyricsEffect', ILyricsEffect[1]); + for Pet := 0 to High(ILyricsEffect) do + if Tekst = ILyricsEffect[Pet] then Ini.LyricsEffect := Pet; + + // Solmization + Tekst := IniFile.ReadString('Lyrics', 'Solmization', ISolmization[0]); + for Pet := 0 to High(ISolmization) do + if Tekst = ISolmization[Pet] then Ini.Solmization := Pet; + + // Theme + + //Theme List Patch + + //I2 Saves the no of the Deluxe (Standard-) Theme + I2 := 0; + //I counts is the cur. Theme no + I := 0; + + SetLength(ITheme, 0); + FindFirst('Themes' + PathDelim + '*.ini',faAnyFile,SR); + Repeat + //Read Themename from Theme + ThemeIni := TMemIniFile.Create(SR.Name); + Tekst := UpperCase(ThemeIni.ReadString('Theme','Name',GetFileName(SR.Name))); + ThemeIni.Free; + + //if Deluxe Theme then save Themeno to I2 + if (Tekst = 'DELUXE') then + I2 := I; + + //Search for Skins for this Theme + for Pet := low(Skin.Skin) to high(Skin.Skin) do + begin + if UpperCase(Skin.Skin[Pet].Theme) = Tekst then + begin + SetLength(ITheme, Length(ITheme)+1); + ITheme[High(ITheme)] := GetFileName(SR.Name); + break; + end; + end; + + Inc(I); + Until FindNext(SR) <> 0; + FindClose(SR); + //Theme List Patch End } + + //No Theme Found + if (Length(ITheme)=0) then + begin + Log.CriticalError('Could not find any valid Themes.'); + end; + + + Tekst := IniFile.ReadString('Themes', 'Theme', ITheme[I2]); + Ini.Theme := 0; + for Pet := 0 to High(ITheme) do + if Uppercase(Tekst) = Uppercase(ITheme[Pet]) then Ini.Theme := Pet; + + // Skin + Skin.onThemeChange; + Ini.SkinNo := 0; + + Tekst := IniFile.ReadString('Themes', 'Skin', ISkin[0]); + for Pet := 0 to High(ISkin) do + if Tekst = ISkin[Pet] then Ini.SkinNo := Pet; + + // Color + Tekst := IniFile.ReadString('Themes', 'Color', IColor[0]); + for Pet := 0 to High(IColor) do + if Tekst = IColor[Pet] then Ini.Color := Pet; + + // Record - load ini list + SetLength(CardList, 0); + I := 1; + while (IniFile.ValueExists('Record', 'DeviceName' + IntToStr(I)) = true) do begin + //Automatically Delete not Existing Sound Cards + S := IniFile.ReadString('Record', 'DeviceName' + IntToStr(I), ''); + //{ + B := False; + //Look for Soundcard + for I2 := 0 to High(Recording.SoundCard) do + begin + if (S = Trim(Recording.SoundCard[I2].Description)) then + begin + B := True; + Break; + end; + end; + + if B then + begin //} + I3 := Length(CardList); + SetLength(CardList, I3+1); + Ini.CardList[I3].Name := S; + Ini.CardList[I3].Input := IniFile.ReadInteger('Record', 'Input' + IntToStr(I), 0); + Ini.CardList[I3].ChannelL := IniFile.ReadInteger('Record', 'ChannelL' + IntToStr(I), 0); + Ini.CardList[I3].ChannelR := IniFile.ReadInteger('Record', 'ChannelR' + IntToStr(I), 0); + end; + Inc(I); + end; + + // Record - append detected soundcards + for I := 0 to High(Recording.SoundCard) do + begin + B := False; + For I2 := 0 to High(CardList) do + begin //Search for Card in List + if (CardList[I2].Name = Trim(Recording.SoundCard[I].Description)) then + begin + B := True; + Break; + end; + end; + + //If not in List -> Add + If not B then + begin + I3 := Length(CardList); + SetLength(CardList, I3+1); + CardList[I3].Name := Trim(Recording.SoundCard[I].Description); + CardList[I3].Input := 0; + CardList[I3].ChannelL := 0; + CardList[I3].ChannelR := 0; + // default for new users + if (Length(CardList) = 1) then + CardList[I].ChannelL := 1; + end; + end; + + //Advanced Settings + + // LoadAnimation + Tekst := IniFile.ReadString('Advanced', 'LoadAnimation', 'On'); + for Pet := 0 to High(ILoadAnimation) do + if Tekst = ILoadAnimation[Pet] then Ini.LoadAnimation := Pet; + + // ScreenFade + Tekst := IniFile.ReadString('Advanced', 'ScreenFade', 'On'); + for Pet := 0 to High(IScreenFade) do + if Tekst = IScreenFade[Pet] then Ini.ScreenFade := Pet; + + // EffectSing + Tekst := IniFile.ReadString('Advanced', 'EffectSing', 'On'); + for Pet := 0 to High(IEffectSing) do + if Tekst = IEffectSing[Pet] then Ini.EffectSing := Pet; + + // AskbeforeDel + Tekst := IniFile.ReadString('Advanced', 'AskbeforeDel', 'On'); + for Pet := 0 to High(IAskbeforeDel) do + if Tekst = IAskbeforeDel[Pet] then Ini.AskbeforeDel := Pet; + + // OnSongClick + Tekst := IniFile.ReadString('Advanced', 'OnSongClick', 'Sing'); + for Pet := 0 to High(IOnSongClick) do + if Tekst = IOnSongClick[Pet] then Ini.OnSongClick := Pet; + + // Linebonus + Tekst := IniFile.ReadString('Advanced', 'LineBonus', 'At Score'); + for Pet := 0 to High(ILineBonus) do + if Tekst = ILineBonus[Pet] then Ini.LineBonus := Pet; + + // PartyPopup + Tekst := IniFile.ReadString('Advanced', 'PartyPopup', 'On'); + for Pet := 0 to High(IPartyPopup) do + if Tekst = IPartyPopup[Pet] then Ini.PartyPopup := Pet; + + + // Joypad + Tekst := IniFile.ReadString('Controller', 'Joypad', IJoypad[0]); + for Pet := 0 to High(IJoypad) do + if Tekst = IJoypad[Pet] then Ini.Joypad := Pet; + + // LCD + Tekst := IniFile.ReadString('Devices', 'LPT', ILPT[0]); + for Pet := 0 to High(ILPT) do + if Tekst = ILPT[Pet] then Ini.LPT := Pet; + + + // SongPath + if (Params.SongPath <> '') then + SongPath := IncludeTrailingPathDelimiter(Params.SongPath) + else + SongPath := IncludeTrailingPathDelimiter(IniFile.ReadString('Path', 'Songs', SongPath)); + + Filename := IniFile.FileName; + IniFile.Free; +end; + +procedure TIni.Save; +var + IniFile: TIniFile; + Tekst: string; + I: Integer; + S: String; +begin + //if not (FileExists(GamePath + 'config.ini') and FileIsReadOnly(GamePath + 'config.ini')) then begin + if not (FileExists(Filename) and FileIsReadOnly(Filename)) then begin + + IniFile := TIniFile.Create(Filename); + + // Players + Tekst := IPlayers[Ini.Players]; + IniFile.WriteString('Game', 'Players', Tekst); + + // Difficulty + Tekst := IDifficulty[Ini.Difficulty]; + IniFile.WriteString('Game', 'Difficulty', Tekst); + + // Language + Tekst := ILanguage[Ini.Language]; + IniFile.WriteString('Game', 'Language', Tekst); + + // Tabs + Tekst := ITabs[Ini.Tabs]; + IniFile.WriteString('Game', 'Tabs', Tekst); + + // Sorting + Tekst := ISorting[Ini.Sorting]; + IniFile.WriteString('Game', 'Sorting', Tekst); + + // Debug + Tekst := IDebug[Ini.Debug]; + IniFile.WriteString('Game', 'Debug', Tekst); + + // Screens + Tekst := IScreens[Ini.Screens]; + IniFile.WriteString('Graphics', 'Screens', Tekst); + + // FullScreen + Tekst := IFullScreen[Ini.FullScreen]; + IniFile.WriteString('Graphics', 'FullScreen', Tekst); + + // Resolution + Tekst := IResolution[Ini.Resolution]; + IniFile.WriteString('Graphics', 'Resolution', Tekst); + + // Depth + Tekst := IDepth[Ini.Depth]; + IniFile.WriteString('Graphics', 'Depth', Tekst); + + // Resolution + Tekst := ITextureSize[Ini.TextureSize]; + IniFile.WriteString('Graphics', 'TextureSize', Tekst); + + // Sing Window + Tekst := ISingWindow[Ini.SingWindow]; + IniFile.WriteString('Graphics', 'SingWindow', Tekst); + + // Oscilloscope + Tekst := IOscilloscope[Ini.Oscilloscope]; + IniFile.WriteString('Graphics', 'Oscilloscope', Tekst); + + // Spectrum + Tekst := ISpectrum[Ini.Spectrum]; + IniFile.WriteString('Graphics', 'Spectrum', Tekst); + + // Spectrograph + Tekst := ISpectrograph[Ini.Spectrograph]; + IniFile.WriteString('Graphics', 'Spectrograph', Tekst); + + // Movie Size + Tekst := IMovieSize[Ini.MovieSize]; + IniFile.WriteString('Graphics', 'MovieSize', Tekst); + + // MicBoost + Tekst := IMicBoost[Ini.MicBoost]; + IniFile.WriteString('Sound', 'MicBoost', Tekst); + + // ClickAssist + Tekst := IClickAssist[Ini.ClickAssist]; + IniFile.WriteString('Sound', 'ClickAssist', Tekst); + + // BeatClick + Tekst := IBeatClick[Ini.BeatClick]; + IniFile.WriteString('Sound', 'BeatClick', Tekst); + + // Threshold + Tekst := IThreshold[Ini.Threshold]; + IniFile.WriteString('Sound', 'Threshold', Tekst); + + // Song Preview + Tekst := IPreviewVolume[Ini.PreviewVolume]; + IniFile.WriteString('Sound', 'PreviewVolume', Tekst); + + Tekst := IPreviewFading[Ini.PreviewFading]; + IniFile.WriteString('Sound', 'PreviewFading', Tekst); + + // SavePlayback + Tekst := ISavePlayback[Ini.SavePlayback]; + IniFile.WriteString('Sound', 'SavePlayback', Tekst); + + // Lyrics Font + Tekst := ILyricsFont[Ini.LyricsFont]; + IniFile.WriteString('Lyrics', 'LyricsFont', Tekst); + + // Lyrics Effect + Tekst := ILyricsEffect[Ini.LyricsEffect]; + IniFile.WriteString('Lyrics', 'LyricsEffect', Tekst); + + // Solmization + Tekst := ISolmization[Ini.Solmization]; + IniFile.WriteString('Lyrics', 'Solmization', Tekst); + + // Theme + Tekst := ITheme[Ini.Theme]; + IniFile.WriteString('Themes', 'Theme', Tekst); + + // Skin + Tekst := ISkin[Ini.SkinNo]; + IniFile.WriteString('Themes', 'Skin', Tekst); + + // Color + Tekst := IColor[Ini.Color]; + IniFile.WriteString('Themes', 'Color', Tekst); + + // Record + for I := 0 to High(CardList) do begin + S := IntToStr(I+1); + + Tekst := CardList[I].Name; + IniFile.WriteString('Record', 'DeviceName' + S, Tekst); + + Tekst := IntToStr(CardList[I].Input); + IniFile.WriteString('Record', 'Input' + S, Tekst); + + Tekst := IntToStr(CardList[I].ChannelL); + IniFile.WriteString('Record', 'ChannelL' + S, Tekst); + + Tekst := IntToStr(CardList[I].ChannelR); + IniFile.WriteString('Record', 'ChannelR' + S, Tekst); + end; + + //Log.LogError(InttoStr(Length(CardList)) + ' Cards Saved'); + + //Advanced Settings + + //LoadAnimation + Tekst := ILoadAnimation[Ini.LoadAnimation]; + IniFile.WriteString('Advanced', 'LoadAnimation', Tekst); + + //EffectSing + Tekst := IEffectSing[Ini.EffectSing]; + IniFile.WriteString('Advanced', 'EffectSing', Tekst); + + //ScreenFade + Tekst := IScreenFade[Ini.ScreenFade]; + IniFile.WriteString('Advanced', 'ScreenFade', Tekst); + + //AskbeforeDel + Tekst := IAskbeforeDel[Ini.AskbeforeDel]; + IniFile.WriteString('Advanced', 'AskbeforeDel', Tekst); + + //OnSongClick + Tekst := IOnSongClick[Ini.OnSongClick]; + IniFile.WriteString('Advanced', 'OnSongClick', Tekst); + + //Line Bonus + Tekst := ILineBonus[Ini.LineBonus]; + IniFile.WriteString('Advanced', 'LineBonus', Tekst); + + //Party Popup + Tekst := IPartyPopup[Ini.PartyPopup]; + IniFile.WriteString('Advanced', 'PartyPopup', Tekst); + + // Joypad + Tekst := IJoypad[Ini.Joypad]; + IniFile.WriteString('Controller', 'Joypad', Tekst); + + IniFile.Free; + end; +end; + +procedure TIni.SaveNames; +var + IniFile: TIniFile; + I: integer; +begin + //if not FileIsReadOnly(GamePath + 'config.ini') then begin + //IniFile := TIniFile.Create(GamePath + 'config.ini'); + if not FileIsReadOnly(Filename) then begin + IniFile := TIniFile.Create(Filename); + + //Name + // Templates for Names Mod + for I := 1 to 12 do + IniFile.WriteString('Name', 'P' + IntToStr(I), Ini.Name[I-1]); + for I := 1 to 3 do + IniFile.WriteString('NameTeam', 'T' + IntToStr(I), Ini.NameTeam[I-1]); + for I := 1 to 12 do + IniFile.WriteString('NameTemplate', 'Name' + IntToStr(I), Ini.NameTemplate[I-1]); + + IniFile.Free; + end; +end; + +procedure TIni.SaveLevel; +var + IniFile: TIniFile; + I: integer; +begin + //if not FileIsReadOnly(GamePath + 'config.ini') then begin + //IniFile := TIniFile.Create(GamePath + 'config.ini'); + if not FileIsReadOnly(Filename) then begin + IniFile := TIniFile.Create(Filename); + + // Difficulty + IniFile.WriteString('Game', 'Difficulty', IDifficulty[Ini.Difficulty]); + + IniFile.Free; + end; +end; + +end. diff --git a/Game/Code/Classes/USkins.pas b/Game/Code/Classes/USkins.pas index a5f618ff..a825050f 100644 --- a/Game/Code/Classes/USkins.pas +++ b/Game/Code/Classes/USkins.pas @@ -1,164 +1,164 @@ -unit USkins; - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - -interface - -type - TSkinTexture = record - Name: string; - FileName: string; - end; - - TSkinEntry = record - Theme: string; - Name: string; - Path: string; - FileName: string; - Creator: string; // not used yet - end; - - TSkin = class - Skin: array of TSkinEntry; - SkinTexture: array of TSkinTexture; - SkinPath: string; - Color: integer; - constructor Create; - procedure LoadList; - procedure ParseDir(Dir: string); - procedure LoadHeader(FileName: string); - procedure LoadSkin(Name: string); - function GetTextureFileName(TextureName: string): string; - function GetSkinNumber(Name: string): integer; - procedure onThemeChange; - end; - -var - Skin: TSkin; - -implementation - -uses IniFiles, Classes, SysUtils, ULog, UIni; - -constructor TSkin.Create; -begin - LoadList; -// LoadSkin('Lisek'); -// SkinColor := Color; -end; - -procedure TSkin.LoadList; -var - SR: TSearchRec; -// SR2: TSearchRec; -// SLen: integer; -begin - if FindFirst('Skins\*', faDirectory, SR) = 0 then begin - repeat - if (SR.Name <> '.') and (SR.Name <> '..') then - ParseDir('Skins\' + SR.Name + '\'); - until FindNext(SR) <> 0; - end; // if - FindClose(SR); -end; - -procedure TSkin.ParseDir(Dir: string); -var - SR: TSearchRec; -// SLen: integer; -begin - if FindFirst(Dir + '*.ini', faAnyFile, SR) = 0 then begin - repeat - if (SR.Name <> '.') and (SR.Name <> '..') then - LoadHeader(Dir + SR.Name); - //Log.LogError(SR.Name); - until FindNext(SR) <> 0; - end; -end; - -procedure TSkin.LoadHeader(FileName: string); -var - SkinIni: TMemIniFile; - S: integer; -begin - SkinIni := TMemIniFile.Create(FileName); - - S := Length(Skin); - SetLength(Skin, S+1); - Skin[S].Path := IncludeTrailingBackslash(ExtractFileDir(FileName)); - Skin[S].FileName := ExtractFileName(FileName); - Skin[S].Theme := SkinIni.ReadString('Skin', 'Theme', ''); - Skin[S].Name := SkinIni.ReadString('Skin', 'Name', ''); - Skin[S].Creator := SkinIni.ReadString('Skin', 'Creator', ''); - - SkinIni.Free; -end; - -procedure TSkin.LoadSkin(Name: string); -var - SkinIni: TMemIniFile; - SL: TStringList; - T: integer; - S: integer; -begin - S := GetSkinNumber(Name); - SkinPath := Skin[S].Path; - - SkinIni := TMemIniFile.Create(SkinPath + Skin[S].FileName); - - SL := TStringList.Create; - SkinIni.ReadSection('Textures', SL); - - SetLength(SkinTexture, SL.Count); - for T := 0 to SL.Count-1 do begin - SkinTexture[T].Name := SL.Strings[T]; - SkinTexture[T].FileName := SkinIni.ReadString('Textures', SL.Strings[T], ''); - end; - - SL.Free; - SkinIni.Free; -end; - -function TSkin.GetTextureFileName(TextureName: string): string; -var - T: integer; -begin - Result := ''; - for T := 0 to High(SkinTexture) do - if SkinTexture[T].Name = TextureName then Result := SkinPath + SkinTexture[T].FileName; - -{ Result := SkinPath + 'Bar.jpg'; - if TextureName = 'Ball' then Result := SkinPath + 'Ball.bmp'; - if Copy(TextureName, 1, 4) = 'Gray' then Result := SkinPath + 'Ball.bmp'; - if Copy(TextureName, 1, 6) = 'NoteBG' then Result := SkinPath + 'Ball.bmp';} -end; - -function TSkin.GetSkinNumber(Name: string): integer; -var - S: integer; -begin - Result := 0; // set default to the first available skin - for S := 0 to High(Skin) do - if Skin[S].Name = Name then Result := S; -end; - -procedure TSkin.onThemeChange; -var - S: integer; - Name: String; -begin - Ini.SkinNo:=0; - SetLength(ISkin, 0); - Name := Uppercase(ITheme[Ini.Theme]); - for S := 0 to High(Skin) do - if Name = Uppercase(Skin[S].Theme) then begin - SetLength(ISkin, Length(ISkin)+1); - ISkin[High(ISkin)] := Skin[S].Name; - end; - -end; - -end. +unit USkins; + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +interface + +type + TSkinTexture = record + Name: string; + FileName: string; + end; + + TSkinEntry = record + Theme: string; + Name: string; + Path: string; + FileName: string; + Creator: string; // not used yet + end; + + TSkin = class + Skin: array of TSkinEntry; + SkinTexture: array of TSkinTexture; + SkinPath: string; + Color: integer; + constructor Create; + procedure LoadList; + procedure ParseDir(Dir: string); + procedure LoadHeader(FileName: string); + procedure LoadSkin(Name: string); + function GetTextureFileName(TextureName: string): string; + function GetSkinNumber(Name: string): integer; + procedure onThemeChange; + end; + +var + Skin: TSkin; + +implementation + +uses IniFiles, Classes, SysUtils, ULog, UIni; + +constructor TSkin.Create; +begin + LoadList; +// LoadSkin('Lisek'); +// SkinColor := Color; +end; + +procedure TSkin.LoadList; +var + SR: TSearchRec; +// SR2: TSearchRec; +// SLen: integer; +begin + if FindFirst('Skins'+PathDelim+'*', faDirectory, SR) = 0 then begin + repeat + if (SR.Name <> '.') and (SR.Name <> '..') then + ParseDir('Skins'+PathDelim + SR.Name + PathDelim); + until FindNext(SR) <> 0; + end; // if + FindClose(SR); +end; + +procedure TSkin.ParseDir(Dir: string); +var + SR: TSearchRec; +// SLen: integer; +begin + if FindFirst(Dir + '*.ini', faAnyFile, SR) = 0 then begin + repeat + if (SR.Name <> '.') and (SR.Name <> '..') then + LoadHeader(Dir + SR.Name); + //Log.LogError(SR.Name); + until FindNext(SR) <> 0; + end; +end; + +procedure TSkin.LoadHeader(FileName: string); +var + SkinIni: TMemIniFile; + S: integer; +begin + SkinIni := TMemIniFile.Create(FileName); + + S := Length(Skin); + SetLength(Skin, S+1); + Skin[S].Path := IncludeTrailingBackslash(ExtractFileDir(FileName)); + Skin[S].FileName := ExtractFileName(FileName); + Skin[S].Theme := SkinIni.ReadString('Skin', 'Theme', ''); + Skin[S].Name := SkinIni.ReadString('Skin', 'Name', ''); + Skin[S].Creator := SkinIni.ReadString('Skin', 'Creator', ''); + + SkinIni.Free; +end; + +procedure TSkin.LoadSkin(Name: string); +var + SkinIni: TMemIniFile; + SL: TStringList; + T: integer; + S: integer; +begin + S := GetSkinNumber(Name); + SkinPath := Skin[S].Path; + + SkinIni := TMemIniFile.Create(SkinPath + Skin[S].FileName); + + SL := TStringList.Create; + SkinIni.ReadSection('Textures', SL); + + SetLength(SkinTexture, SL.Count); + for T := 0 to SL.Count-1 do begin + SkinTexture[T].Name := SL.Strings[T]; + SkinTexture[T].FileName := SkinIni.ReadString('Textures', SL.Strings[T], ''); + end; + + SL.Free; + SkinIni.Free; +end; + +function TSkin.GetTextureFileName(TextureName: string): string; +var + T: integer; +begin + Result := ''; + for T := 0 to High(SkinTexture) do + if SkinTexture[T].Name = TextureName then Result := SkinPath + SkinTexture[T].FileName; + +{ Result := SkinPath + 'Bar.jpg'; + if TextureName = 'Ball' then Result := SkinPath + 'Ball.bmp'; + if Copy(TextureName, 1, 4) = 'Gray' then Result := SkinPath + 'Ball.bmp'; + if Copy(TextureName, 1, 6) = 'NoteBG' then Result := SkinPath + 'Ball.bmp';} +end; + +function TSkin.GetSkinNumber(Name: string): integer; +var + S: integer; +begin + Result := 0; // set default to the first available skin + for S := 0 to High(Skin) do + if Skin[S].Name = Name then Result := S; +end; + +procedure TSkin.onThemeChange; +var + S: integer; + Name: String; +begin + Ini.SkinNo:=0; + SetLength(ISkin, 0); + Name := Uppercase(ITheme[Ini.Theme]); + for S := 0 to High(Skin) do + if Name = Uppercase(Skin[S].Theme) then begin + SetLength(ISkin, Length(ISkin)+1); + ISkin[High(ISkin)] := Skin[S].Name; + end; + +end; + +end. diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index f5afbee2..301eb15c 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -1,753 +1,753 @@ -unit USongs; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - -uses SysUtils, ULog, UTexture, UCatCovers; - -type - TBPM = record - BPM: real; - StartBeat: real; - end; - - TScore = record - Name: string; - Score: integer; - Length: string; - end; - - TSong = record - Path: string; - Folder: string; // for sorting by folder - FileName: string; - - // sorting methods - Category: array of string; // I think I won't need this - Genre: string; - Edition: string; - Language: string; // 0.5.0: new - - Title: string; - Artist: string; - - Text: string; - Creator: string; - - Cover: string; - CoverTex: TTexture; - Mp3: string; - Background: string; - Video: string; - VideoGAP: real; - VideoLoaded: boolean; // 0.5.0: true if the video has been loaded - NotesGAP: integer; - Start: real; // in seconds - Finish: integer; // in miliseconds - Relative: boolean; - Resolution: integer; - BPM: array of TBPM; - GAP: real; // in miliseconds - - Score: array[0..2] of array of TScore; - - // these are used when sorting is enabled - Visible: boolean; // false if hidden, true if visible - Main: boolean; // false for songs, true for category buttons - OrderNum: integer; // has a number of category for category buttons and songs - OrderTyp: integer; // type of sorting for this button (0=name) - CatNumber: integer; // Count of Songs in Category for Cats and Number of Song in Category for Songs - end; - - TSongs = class - private - BrowsePos: Cardinal; //Actual Pos in Song Array - public - Song: array of TSong; // array of songs - Selected: integer; // selected song index - procedure LoadSongList; // load all songs - procedure BrowseDir(Dir: string); // should return number of songs in the future - procedure Sort(Order: integer); - function FindSongFile(Dir, Mask: string): string; - end; - - TCatSongs = class - Song: array of TSong; // array of categories with songs - Selected: integer; // selected song index - Order: integer; // order type (0=title) - CatNumShow: integer; // Category Number being seen - CatCount: integer; //Number of Categorys - - procedure Refresh; // refreshes arrays by recreating them from Songs array -// procedure Sort(Order: integer); - procedure ShowCategory(Index: integer); // expands all songs in category - procedure HideCategory(Index: integer); // hides all songs in category - procedure ClickCategoryButton(Index: integer); // uses ShowCategory and HideCategory when needed - procedure ShowCategoryList; //Hides all Songs And Show the List of all Categorys - function FindNextVisible(SearchFrom:integer): integer; //Find Next visible Song - function VisibleSongs: integer; // returns number of visible songs (for tabs) - function VisibleIndex(Index: integer): integer; // returns visible song index (skips invisible) - - function SetFilter(FilterStr: String; const fType: Byte): Cardinal; - end; - -var - Songs: TSongs; // all songs - CatSongs: TCatSongs; // categorized songs - AktSong: TSong; // one song *unknown use) - -implementation - -uses StrUtils, - UFiles, - UMain, - UIni; - - -procedure TSongs.LoadSongList; -begin - Log.LogStatus('Initializing', 'LoadSongList'); - - // clear - Setlength(Song, 50); - - BrowsePos := 0; - // browse directories - BrowseDir(SongPath); - - //Set Correct SongArray Length - SetLength(Song, BrowsePos); -// if Ini.Debug = 1 then BrowseDir('D:\Extract\Songs\'); -end; - -procedure TSongs.BrowseDir(Dir: string); -var - SR: TSearchRec; // for parsing Songs Directory - SLen: integer; -begin - if FindFirst(Dir + '*', faDirectory, SR) = 0 then begin - repeat - if (SR.Name <> '.') and (SR.Name <> '..') then - BrowseDir(Dir + Sr.Name + '\'); - until FindNext(SR) <> 0; - end; // if - FindClose(SR); - -// Log.LogStatus('Parsing directory: ' + Dir + SR.Name, 'LoadSongList'); - - if FindFirst(Dir + '*.txt', 0, SR) = 0 then begin -// Log.LogStatus('Parsing file: ' + Dir + SR.Name + '\' + SRD.Name, 'LoadSongList'); - repeat - //New Mod for better Memory Management - - SLen := BrowsePos; - {//Old - SLen := Length(Song); - SetLength(Song, SLen + 1);//} - - Song[SLen].Path := Dir; - Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); - Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos('\', Song[SLen].Folder)-1); - Song[SLen].FileName := SR.Name; - - if (AnalyseFile(Song[SLen]) = false) then Dec(BrowsePos) - else begin - // scanning complete, file is good - // if there is no cover then try to find it - if Song[SLen].Cover = '' then Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); -// if Song[SLen].Background = '' then begin -// Song[SLen].Background := FindSongFile(Dir, '*[BG].jpg'); -// end; // no needed here} - - // fix by adding path. no, don't fix it. -// if Song[SLen].Cover <> '' then -// Song[SLen].Cover := Song[SLen].Path + Song[SLen].Cover; - end; - - //Change Length Only every 50 Entrys - Inc(BrowsePos); - - if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then - begin - SetLength(Song, Length(Song) + 50); - end; - - until FindNext(SR) <> 0; - end; // if FindFirst - FindClose(SR); -end; - -procedure TSongs.Sort(Order: integer); -var - S: integer; - S2: integer; - TempSong: TSong; -begin - case Order of - sEdition: // by edition - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Edition, Song[S-1].Edition) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sGenre: // by genre - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Genre, Song[S-1].Genre) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sTitle: // by title - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - - end; - sArtist: // by artist - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sFolder: // by folder - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Folder, Song[S-1].Folder) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sTitle2: // by title2 - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - - end; - sArtist2: // by artist2 - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sLanguage: // by Language - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Language, Song[S-1].Language) < 0 then begin - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - - end; // case -end; - -function TSongs.FindSongFile(Dir, Mask: string): string; -var - SR: TSearchRec; // for parsing song directory -begin - Result := ''; - if FindFirst(Dir + Mask, faDirectory, SR) = 0 then begin - Result := SR.Name; - end; // if - FindClose(SR); -end; - -procedure TCatSongs.Refresh; -var - S: integer; // temporary song index - CatLen: integer; // length of CatSongs.Song - Letter: char; // current letter for sorting using letter - SS: string; // current edition for sorting using edition, genre etc. - Order: integer; // number used for ordernum - Letter2: char; // - CatNumber:integer; // Number of Song in Category -begin - CatNumShow := -1; -// Songs.Sort(0); // by title - -case Ini.Sorting of - sEdition: begin - Songs.Sort(sArtist); - Songs.Sort(sEdition); - end; - sGenre: begin - Songs.Sort(sArtist); - Songs.Sort(sGenre); - end; - sLanguage: begin - Songs.Sort(sArtist); - Songs.Sort(sLanguage); - end; - sFolder: begin - Songs.Sort(sArtist); - Songs.Sort(sFolder); - end; - sTitle: Songs.Sort(sTitle); - sArtist: Songs.Sort(sArtist); - sTitle2: Songs.Sort(sTitle2); // by title2 - sArtist2: Songs.Sort(sArtist2); // by artist2 - - end; // case - - - Letter := ' '; - SS := ''; - Order := 0; - CatNumber := 0; - - //Songs leeren - SetLength (Song, 0); - - for S := Low(Songs.Song) to High(Songs.Song) do begin - if (Ini.Tabs = 1) then - if (Ini.Sorting = sEdition) and (CompareText(SS, Songs.Song[S].Edition) <> 0) then begin - // add Category Button - Inc(Order); - SS := Songs.Song[S].Edition; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + SS + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - - - // 0.4.3 - // if SS = 'Singstar' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Part 2' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar German' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Spanish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Italian' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar French' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Party' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Party.jpg'; - // if SS = 'Singstar Popworld' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Popworld.jpg'; - // if SS = 'Singstar 80s' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; - // if SS = 'Singstar 80s Polish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; - // if SS = 'Singstar Rocks' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Rocks.jpg'; - // if SS = 'Singstar Anthems' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Anthems.jpg'; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';//} - - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sGenre) and (CompareText(SS, Songs.Song[S].Genre) <> 0) then begin - // add Genre Button - Inc(Order); - SS := Songs.Song[S].Genre; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sLanguage) and (CompareText(SS, Songs.Song[S].Language) <> 0) then begin - // add Language Button - Inc(Order); - SS := Songs.Song[S].Language; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sTitle) and (Length(Songs.Song[S].Title)>=1) and (Letter <> UpCase(Songs.Song[S].Title[1])) then begin - // add a letter Category Button - Inc(Order); - Letter := UpCase(Songs.Song[S].Title[1]); - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - - {// cover-patch - if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sArtist) and (Length(Songs.Song[S].Artist)>=1) and (Letter <> UpCase(Songs.Song[S].Artist[1])) then begin - // add a letter Category Button - Inc(Order); - Letter := UpCase(Songs.Song[S].Artist[1]); - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sFolder) and (CompareText(SS, Songs.Song[S].Folder) <> 0) then begin - // 0.5.0: add folder tab - Inc(Order); - SS := Songs.Song[S].Folder; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sTitle2) AND (Length(Songs.Song[S].Title)>=1) then begin - if (ord(Songs.Song[S].Title[1]) > 47) and (ord(Songs.Song[S].Title[1]) < 58) then Letter2 := '#' else Letter2 := UpCase(Songs.Song[S].Title[1]); - if (Letter <> Letter2) then begin - // add a letter Category Button - Inc(Order); - Letter := Letter2; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end; - end - - else if (Ini.Sorting = sArtist2) AND (Length(Songs.Song[S].Artist)>=1) then begin - if (ord(Songs.Song[S].Artist[1]) > 47) and (ord(Songs.Song[S].Artist[1]) < 58) then Letter2 := '#' else Letter2 := UpCase(Songs.Song[S].Artist[1]); - if (Letter <> Letter2) then begin - // add a letter Category Button - Inc(Order); - Letter := Letter2; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end; - end; - - - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - - Inc (CatNumber); //Increase Number in Cat - - CatSongs.Song[CatLen] := Songs.Song[S]; - CatSongs.Song[CatLen].OrderNum := Order; // assigns category - CatSongs.Song[CatLen].CatNumber := CatNumber; - - if (Ini.Tabs = 0) then CatSongs.Song[CatLen].Visible := true - else if (Ini.Tabs = 1) then CatSongs.Song[CatLen].Visible := false; -// if (Ini.Tabs = 1) and (Order = 1) then CatSongs.Song[CatLen].Visible := true; // open first tab -//CatSongs.Song[CatLen].Visible := true; - - end; -//CatNumber Patch - Set CatNumber of Last Category -if (ini.Tabs_at_startup = 1) And (high(Song) >=1) then - Song[CatLen - CatNumber].CatNumber := CatNumber;//Set CatNumber of Categroy -//CatCount Patch -CatCount := Order; -end; - -procedure TCatSongs.ShowCategory(Index: integer); -var - S: integer; // song -begin - CatNumShow := Index; - for S := 0 to high(CatSongs.Song) do - begin - if (CatSongs.Song[S].OrderNum = Index) AND (Not CatSongs.Song[S].Main) then - CatSongs.Song[S].Visible := true - else - CatSongs.Song[S].Visible := false; - end; -end; - -procedure TCatSongs.HideCategory(Index: integer); // hides all songs in category -var - S: integer; // song -begin - for S := 0 to high(CatSongs.Song) do begin - if not CatSongs.Song[S].Main then - CatSongs.Song[S].Visible := false // hides all at now - end; -end; - -procedure TCatSongs.ClickCategoryButton(Index: integer); -var - Num, S: integer; -begin - Num := CatSongs.Song[Index].OrderNum; - if Num <> CatNumShow then - begin - ShowCategory(Num); - end - else begin - ShowCategoryList; - end; -end; - -//Hide Categorys when in Category Hack -procedure TCatSongs.ShowCategoryList; -var - Num, S: integer; -begin - //Hide All Songs Show All Cats - for S := 0 to high(CatSongs.Song) do begin - if CatSongs.Song[S].Main then - CatSongs.Song[S].Visible := true - else - CatSongs.Song[S].Visible := false - end; - CatSongs.Selected := CatNumShow; //Show last shown Category - CatNumShow := -1; -end; -//Hide Categorys when in Category Hack End - -//Wrong song selected when tabs on bug -function TCatSongs.FindNextVisible(SearchFrom:integer): integer;//Find next Visible Song -var - I: Integer; - begin - Result := -1; - I := SearchFrom + 1; - while not CatSongs.Song[I].Visible do - begin - Inc (I); - if (I>high(CatSongs.Song)) then - I := low(CatSongs.Song); - if (I = SearchFrom) then //Make One Round and no song found->quit - break; - end; - end; -//Wrong song selected when tabs on bug End - -function TCatSongs.VisibleSongs: integer; -var - S: integer; // song -begin - Result := 0; - for S := 0 to high(CatSongs.Song) do - if CatSongs.Song[S].Visible = true then Inc(Result); -end; - -function TCatSongs.VisibleIndex(Index: integer): integer; -var - S: integer; // song -begin - Result := 0; - for S := 0 to Index-1 do - if CatSongs.Song[S].Visible = true then Inc(Result); -end; - -function TCatSongs.SetFilter(FilterStr: String; const fType: Byte): Cardinal; -var - I, J: Integer; - cString: String; - SearchStr: Array of String; -begin - {fType: 0: All - 1: Title - 2: Artist} - FilterStr := Trim(FilterStr); - if FilterStr<>'' then begin - Result := 0; - //Create Search Array - SetLength(SearchStr, 1); - I := Pos (' ', FilterStr); - While (I <> 0) do - begin - SetLength (SearchStr, Length(SearchStr) + 1); - cString := Copy(FilterStr, 1, I-1); - if (cString <> ' ') AND (cString <> '') then - SearchStr[High(SearchStr)-1] := cString; - Delete (FilterStr, 1, I); - - I := Pos (' ', FilterStr); - end; - //Copy last Word - if (FilterStr <> ' ') AND (FilterStr <> '') then - SearchStr[High(SearchStr)] := FilterStr; - - for I:=0 to High(Song) do begin - if not Song[i].Main then - begin - case fType of - 0: cString := Song[I].Artist + ' ' + Song[i].Title + ' ' + Song[i].Folder; - 1: cString := Song[I].Title; - 2: cString := Song[I].Artist; - end; - Song[i].Visible:=True; - //Look for every Searched Word - For J := 0 to High(SearchStr) do - begin - Song[i].Visible := Song[i].Visible AND AnsiContainsText(cString, SearchStr[J]) - end; - if Song[i].Visible then - Inc(Result); - end - else - Song[i].Visible:=False; - end; - CatNumShow := -2; - end - else begin - for i:=0 to High(Song) do begin - Song[i].Visible:=(Ini.Tabs=1)=Song[i].Main; - CatNumShow := -1; - end; - Result := 0; - end; -end; - -end. +unit USongs; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +uses SysUtils, ULog, UTexture, UCatCovers; + +type + TBPM = record + BPM: real; + StartBeat: real; + end; + + TScore = record + Name: string; + Score: integer; + Length: string; + end; + + TSong = record + Path: string; + Folder: string; // for sorting by folder + FileName: string; + + // sorting methods + Category: array of string; // I think I won't need this + Genre: string; + Edition: string; + Language: string; // 0.5.0: new + + Title: string; + Artist: string; + + Text: string; + Creator: string; + + Cover: string; + CoverTex: TTexture; + Mp3: string; + Background: string; + Video: string; + VideoGAP: real; + VideoLoaded: boolean; // 0.5.0: true if the video has been loaded + NotesGAP: integer; + Start: real; // in seconds + Finish: integer; // in miliseconds + Relative: boolean; + Resolution: integer; + BPM: array of TBPM; + GAP: real; // in miliseconds + + Score: array[0..2] of array of TScore; + + // these are used when sorting is enabled + Visible: boolean; // false if hidden, true if visible + Main: boolean; // false for songs, true for category buttons + OrderNum: integer; // has a number of category for category buttons and songs + OrderTyp: integer; // type of sorting for this button (0=name) + CatNumber: integer; // Count of Songs in Category for Cats and Number of Song in Category for Songs + end; + + TSongs = class + private + BrowsePos: Cardinal; //Actual Pos in Song Array + public + Song: array of TSong; // array of songs + Selected: integer; // selected song index + procedure LoadSongList; // load all songs + procedure BrowseDir(Dir: string); // should return number of songs in the future + procedure Sort(Order: integer); + function FindSongFile(Dir, Mask: string): string; + end; + + TCatSongs = class + Song: array of TSong; // array of categories with songs + Selected: integer; // selected song index + Order: integer; // order type (0=title) + CatNumShow: integer; // Category Number being seen + CatCount: integer; //Number of Categorys + + procedure Refresh; // refreshes arrays by recreating them from Songs array +// procedure Sort(Order: integer); + procedure ShowCategory(Index: integer); // expands all songs in category + procedure HideCategory(Index: integer); // hides all songs in category + procedure ClickCategoryButton(Index: integer); // uses ShowCategory and HideCategory when needed + procedure ShowCategoryList; //Hides all Songs And Show the List of all Categorys + function FindNextVisible(SearchFrom:integer): integer; //Find Next visible Song + function VisibleSongs: integer; // returns number of visible songs (for tabs) + function VisibleIndex(Index: integer): integer; // returns visible song index (skips invisible) + + function SetFilter(FilterStr: String; const fType: Byte): Cardinal; + end; + +var + Songs: TSongs; // all songs + CatSongs: TCatSongs; // categorized songs + AktSong: TSong; // one song *unknown use) + +implementation + +uses StrUtils, + UFiles, + UMain, + UIni; + + +procedure TSongs.LoadSongList; +begin + Log.LogStatus('Initializing', 'LoadSongList'); + + // clear + Setlength(Song, 50); + + BrowsePos := 0; + // browse directories + BrowseDir(SongPath); + + //Set Correct SongArray Length + SetLength(Song, BrowsePos); +// if Ini.Debug = 1 then BrowseDir('D:\Extract\Songs\'); +end; + +procedure TSongs.BrowseDir(Dir: string); +var + SR: TSearchRec; // for parsing Songs Directory + SLen: integer; +begin + if FindFirst(Dir + '*', faDirectory, SR) = 0 then begin + repeat + if (SR.Name <> '.') and (SR.Name <> '..') then + BrowseDir(Dir + Sr.Name + PathDelim); + until FindNext(SR) <> 0; + end; // if + FindClose(SR); + +// Log.LogStatus('Parsing directory: ' + Dir + SR.Name, 'LoadSongList'); + + if FindFirst(Dir + '*.txt', 0, SR) = 0 then begin +// Log.LogStatus('Parsing file: ' + Dir + SR.Name + '\' + SRD.Name, 'LoadSongList'); + repeat + //New Mod for better Memory Management + + SLen := BrowsePos; + {//Old + SLen := Length(Song); + SetLength(Song, SLen + 1);//} + + Song[SLen].Path := Dir; + Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); + Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); + Song[SLen].FileName := SR.Name; + + if (AnalyseFile(Song[SLen]) = false) then Dec(BrowsePos) + else begin + // scanning complete, file is good + // if there is no cover then try to find it + if Song[SLen].Cover = '' then Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); +// if Song[SLen].Background = '' then begin +// Song[SLen].Background := FindSongFile(Dir, '*[BG].jpg'); +// end; // no needed here} + + // fix by adding path. no, don't fix it. +// if Song[SLen].Cover <> '' then +// Song[SLen].Cover := Song[SLen].Path + Song[SLen].Cover; + end; + + //Change Length Only every 50 Entrys + Inc(BrowsePos); + + if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then + begin + SetLength(Song, Length(Song) + 50); + end; + + until FindNext(SR) <> 0; + end; // if FindFirst + FindClose(SR); +end; + +procedure TSongs.Sort(Order: integer); +var + S: integer; + S2: integer; + TempSong: TSong; +begin + case Order of + sEdition: // by edition + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Edition, Song[S-1].Edition) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sGenre: // by genre + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Genre, Song[S-1].Genre) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sTitle: // by title + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + + end; + sArtist: // by artist + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sFolder: // by folder + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Folder, Song[S-1].Folder) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sTitle2: // by title2 + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + + end; + sArtist2: // by artist2 + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sLanguage: // by Language + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Language, Song[S-1].Language) < 0 then begin + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + + end; // case +end; + +function TSongs.FindSongFile(Dir, Mask: string): string; +var + SR: TSearchRec; // for parsing song directory +begin + Result := ''; + if FindFirst(Dir + Mask, faDirectory, SR) = 0 then begin + Result := SR.Name; + end; // if + FindClose(SR); +end; + +procedure TCatSongs.Refresh; +var + S: integer; // temporary song index + CatLen: integer; // length of CatSongs.Song + Letter: char; // current letter for sorting using letter + SS: string; // current edition for sorting using edition, genre etc. + Order: integer; // number used for ordernum + Letter2: char; // + CatNumber:integer; // Number of Song in Category +begin + CatNumShow := -1; +// Songs.Sort(0); // by title + +case Ini.Sorting of + sEdition: begin + Songs.Sort(sArtist); + Songs.Sort(sEdition); + end; + sGenre: begin + Songs.Sort(sArtist); + Songs.Sort(sGenre); + end; + sLanguage: begin + Songs.Sort(sArtist); + Songs.Sort(sLanguage); + end; + sFolder: begin + Songs.Sort(sArtist); + Songs.Sort(sFolder); + end; + sTitle: Songs.Sort(sTitle); + sArtist: Songs.Sort(sArtist); + sTitle2: Songs.Sort(sTitle2); // by title2 + sArtist2: Songs.Sort(sArtist2); // by artist2 + + end; // case + + + Letter := ' '; + SS := ''; + Order := 0; + CatNumber := 0; + + //Songs leeren + SetLength (Song, 0); + + for S := Low(Songs.Song) to High(Songs.Song) do begin + if (Ini.Tabs = 1) then + if (Ini.Sorting = sEdition) and (CompareText(SS, Songs.Song[S].Edition) <> 0) then begin + // add Category Button + Inc(Order); + SS := Songs.Song[S].Edition; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + SS + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + + + // 0.4.3 + // if SS = 'Singstar' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Part 2' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar German' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Spanish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Italian' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar French' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Party' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Party.jpg'; + // if SS = 'Singstar Popworld' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Popworld.jpg'; + // if SS = 'Singstar 80s' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; + // if SS = 'Singstar 80s Polish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; + // if SS = 'Singstar Rocks' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Rocks.jpg'; + // if SS = 'Singstar Anthems' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Anthems.jpg'; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';//} + + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sGenre) and (CompareText(SS, Songs.Song[S].Genre) <> 0) then begin + // add Genre Button + Inc(Order); + SS := Songs.Song[S].Genre; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sLanguage) and (CompareText(SS, Songs.Song[S].Language) <> 0) then begin + // add Language Button + Inc(Order); + SS := Songs.Song[S].Language; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sTitle) and (Length(Songs.Song[S].Title)>=1) and (Letter <> UpCase(Songs.Song[S].Title[1])) then begin + // add a letter Category Button + Inc(Order); + Letter := UpCase(Songs.Song[S].Title[1]); + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + + {// cover-patch + if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sArtist) and (Length(Songs.Song[S].Artist)>=1) and (Letter <> UpCase(Songs.Song[S].Artist[1])) then begin + // add a letter Category Button + Inc(Order); + Letter := UpCase(Songs.Song[S].Artist[1]); + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sFolder) and (CompareText(SS, Songs.Song[S].Folder) <> 0) then begin + // 0.5.0: add folder tab + Inc(Order); + SS := Songs.Song[S].Folder; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sTitle2) AND (Length(Songs.Song[S].Title)>=1) then begin + if (ord(Songs.Song[S].Title[1]) > 47) and (ord(Songs.Song[S].Title[1]) < 58) then Letter2 := '#' else Letter2 := UpCase(Songs.Song[S].Title[1]); + if (Letter <> Letter2) then begin + // add a letter Category Button + Inc(Order); + Letter := Letter2; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end; + end + + else if (Ini.Sorting = sArtist2) AND (Length(Songs.Song[S].Artist)>=1) then begin + if (ord(Songs.Song[S].Artist[1]) > 47) and (ord(Songs.Song[S].Artist[1]) < 58) then Letter2 := '#' else Letter2 := UpCase(Songs.Song[S].Artist[1]); + if (Letter <> Letter2) then begin + // add a letter Category Button + Inc(Order); + Letter := Letter2; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end; + end; + + + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + + Inc (CatNumber); //Increase Number in Cat + + CatSongs.Song[CatLen] := Songs.Song[S]; + CatSongs.Song[CatLen].OrderNum := Order; // assigns category + CatSongs.Song[CatLen].CatNumber := CatNumber; + + if (Ini.Tabs = 0) then CatSongs.Song[CatLen].Visible := true + else if (Ini.Tabs = 1) then CatSongs.Song[CatLen].Visible := false; +// if (Ini.Tabs = 1) and (Order = 1) then CatSongs.Song[CatLen].Visible := true; // open first tab +//CatSongs.Song[CatLen].Visible := true; + + end; +//CatNumber Patch - Set CatNumber of Last Category +if (ini.Tabs_at_startup = 1) And (high(Song) >=1) then + Song[CatLen - CatNumber].CatNumber := CatNumber;//Set CatNumber of Categroy +//CatCount Patch +CatCount := Order; +end; + +procedure TCatSongs.ShowCategory(Index: integer); +var + S: integer; // song +begin + CatNumShow := Index; + for S := 0 to high(CatSongs.Song) do + begin + if (CatSongs.Song[S].OrderNum = Index) AND (Not CatSongs.Song[S].Main) then + CatSongs.Song[S].Visible := true + else + CatSongs.Song[S].Visible := false; + end; +end; + +procedure TCatSongs.HideCategory(Index: integer); // hides all songs in category +var + S: integer; // song +begin + for S := 0 to high(CatSongs.Song) do begin + if not CatSongs.Song[S].Main then + CatSongs.Song[S].Visible := false // hides all at now + end; +end; + +procedure TCatSongs.ClickCategoryButton(Index: integer); +var + Num, S: integer; +begin + Num := CatSongs.Song[Index].OrderNum; + if Num <> CatNumShow then + begin + ShowCategory(Num); + end + else begin + ShowCategoryList; + end; +end; + +//Hide Categorys when in Category Hack +procedure TCatSongs.ShowCategoryList; +var + Num, S: integer; +begin + //Hide All Songs Show All Cats + for S := 0 to high(CatSongs.Song) do begin + if CatSongs.Song[S].Main then + CatSongs.Song[S].Visible := true + else + CatSongs.Song[S].Visible := false + end; + CatSongs.Selected := CatNumShow; //Show last shown Category + CatNumShow := -1; +end; +//Hide Categorys when in Category Hack End + +//Wrong song selected when tabs on bug +function TCatSongs.FindNextVisible(SearchFrom:integer): integer;//Find next Visible Song +var + I: Integer; + begin + Result := -1; + I := SearchFrom + 1; + while not CatSongs.Song[I].Visible do + begin + Inc (I); + if (I>high(CatSongs.Song)) then + I := low(CatSongs.Song); + if (I = SearchFrom) then //Make One Round and no song found->quit + break; + end; + end; +//Wrong song selected when tabs on bug End + +function TCatSongs.VisibleSongs: integer; +var + S: integer; // song +begin + Result := 0; + for S := 0 to high(CatSongs.Song) do + if CatSongs.Song[S].Visible = true then Inc(Result); +end; + +function TCatSongs.VisibleIndex(Index: integer): integer; +var + S: integer; // song +begin + Result := 0; + for S := 0 to Index-1 do + if CatSongs.Song[S].Visible = true then Inc(Result); +end; + +function TCatSongs.SetFilter(FilterStr: String; const fType: Byte): Cardinal; +var + I, J: Integer; + cString: String; + SearchStr: Array of String; +begin + {fType: 0: All + 1: Title + 2: Artist} + FilterStr := Trim(FilterStr); + if FilterStr<>'' then begin + Result := 0; + //Create Search Array + SetLength(SearchStr, 1); + I := Pos (' ', FilterStr); + While (I <> 0) do + begin + SetLength (SearchStr, Length(SearchStr) + 1); + cString := Copy(FilterStr, 1, I-1); + if (cString <> ' ') AND (cString <> '') then + SearchStr[High(SearchStr)-1] := cString; + Delete (FilterStr, 1, I); + + I := Pos (' ', FilterStr); + end; + //Copy last Word + if (FilterStr <> ' ') AND (FilterStr <> '') then + SearchStr[High(SearchStr)] := FilterStr; + + for I:=0 to High(Song) do begin + if not Song[i].Main then + begin + case fType of + 0: cString := Song[I].Artist + ' ' + Song[i].Title + ' ' + Song[i].Folder; + 1: cString := Song[I].Title; + 2: cString := Song[I].Artist; + end; + Song[i].Visible:=True; + //Look for every Searched Word + For J := 0 to High(SearchStr) do + begin + Song[i].Visible := Song[i].Visible AND AnsiContainsText(cString, SearchStr[J]) + end; + if Song[i].Visible then + Inc(Result); + end + else + Song[i].Visible:=False; + end; + CatNumShow := -2; + end + else begin + for i:=0 to High(Song) do begin + Song[i].Visible:=(Ini.Tabs=1)=Song[i].Main; + CatNumShow := -1; + end; + Result := 0; + end; +end; + +end. diff --git a/Game/Code/UltraStar.lpi b/Game/Code/UltraStar.lpi index 97a25a66..a3ff59ad 100644 --- a/Game/Code/UltraStar.lpi +++ b/Game/Code/UltraStar.lpi @@ -36,12 +36,12 @@ - + - - + + @@ -58,7 +58,7 @@ - + @@ -70,9 +70,9 @@ - - - + + + @@ -81,8 +81,8 @@ - - + + @@ -90,16 +90,18 @@ - - + + - - - + + + + + @@ -112,7 +114,7 @@ - + @@ -283,23 +285,27 @@ - + - - + + + + + + @@ -386,8 +392,8 @@ - - + + @@ -485,7 +491,7 @@ - + @@ -501,7 +507,7 @@ - + @@ -543,7 +549,7 @@ - + @@ -552,130 +558,148 @@ - + + + + + + + + + + + + + + + + + + + - - + + - - + + - - + + - + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - + -- cgit v1.2.3 From 26d8c209beba866f111a9d047bf1a70fe245b75d Mon Sep 17 00:00:00 2001 From: b1indy Date: Thu, 20 Sep 2007 07:19:45 +0000 Subject: new lyrics stuff; it's broken (lyrics don't show) and in "debug" mode (weird stuff going on in the singscreen) but i'm tired of editing conflicts git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@412 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 3167 +++++++++++++++++----------------- Game/Code/Classes/UGraphic.pas | 1222 ++++++------- Game/Code/Classes/ULyrics.pas | 777 +++++---- Game/Code/Classes/UMain.pas | 1588 ++++++++--------- Game/Code/Classes/UMusic.pas | 1466 ++++++++-------- Game/Code/Classes/UThemes.pas | 4 + Game/Code/Screens/UScreenEditSub.pas | 2 +- Game/Code/Screens/UScreenSing.pas | 2557 +++++++++++++-------------- Game/Code/UltraStar.dpr | 92 +- 9 files changed, 5520 insertions(+), 5355 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index ef1f2709..4c5d2ce0 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -1,1583 +1,1584 @@ -unit UDraw; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -uses UThemes, - ModiSDK, - UGraphicClasses; - -procedure SingDraw; -procedure SingModiDraw (PlayerInfo: TPlayerInfo); -procedure SingDrawBackground; -procedure SingDrawOscilloscope(X, Y, W, H: real; NrSound: integer); -procedure SingDrawNoteLines(Left, Top, Right: real; Space: integer); -procedure SingDrawBeatDelimeters(Left, Top, Right: real; NrCzesci: integer); -procedure SingDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); -procedure SingDrawPlayerCzesc(X, Y, W: real; NrGracza: integer; Space: integer); -procedure SingDrawPlayerBGCzesc(Left, Top, Right: real; NrCzesci, NrGracza: integer; Space: integer); - -// TimeBar -procedure SingDrawTimeBar(); - -// The Singbar -procedure SingDrawSingbar(X, Y, W, H: real; Percent: integer); - -//Phrasen Bonus - Line Bonus -procedure SingDrawLineBonus( const X, Y: Single; Color: TRGB; Alpha: Single; Text: string; Age: Integer); - -//Draw Editor NoteLines -procedure EditDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); - - -type - TRecR = record - Top: real; - Left: real; - Right: real; - Bottom: real; - - Width: real; - WMid: real; - Height: real; - HMid: real; - - Mid: real; - end; - -var - NotesW: real; - NotesH: real; - Starfr: integer; - StarfrG: integer; - - //SingBar - TickOld: cardinal; - TickOld2:cardinal; - -const - Przedz = 32; - -implementation - -uses {$IFDEF Win32} - windows, - {$ELSE} - lclintf, - {$ENDIF} - OpenGL12, - UGraphic, - SysUtils, - UMusic, - URecord, - ULog, - UScreenSing, - UScreenSingModi, - ULyrics, - UMain, - TextGL, - UTexture, - UDrawTexture, - UIni, - Math, - UDLLManager; - -procedure SingDrawBackground; -var - Rec: TRecR; - TexRec: TRecR; -begin - if ScreenSing.Tex_Background.TexNum >= 1 then begin - - glClearColor (1, 1, 1, 1); - glColor4f (1, 1, 1, 1); - - 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) * ScreenSing.Tex_Background.TexH; - TexRec.Bottom := (Rec.Bottom / 600) * ScreenSing.Tex_Background.TexH; - TexRec.Left := 0; - TexRec.Right := ScreenSing.Tex_Background.TexW; - - glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, ScreenSing.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) * ScreenSing.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) * ScreenSing.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, ScreenSing.Tex_Background.TexNum); - //glEnable(GL_BLEND); - glBegin(GL_QUADS); - - glTexCoord2f(0, 0); glVertex2f(0, 0); - glTexCoord2f(0, ScreenSing.Tex_Background.TexH); glVertex2f(0, 600); - glTexCoord2f( ScreenSing.Tex_Background.TexW, ScreenSing.Tex_Background.TexH); glVertex2f(800, 600); - glTexCoord2f( ScreenSing.Tex_Background.TexW, 0); glVertex2f(800, 0); - - glEnd; - glDisable(GL_TEXTURE_2D); - //glDisable(GL_BLEND); - end; - end; -end; - -procedure SingDrawOscilloscope(X, Y, W, H: real; NrSound: integer); -var - Pet: integer; -begin; -// Log.LogStatus('Oscilloscope', 'SingDraw'); - glColor3f(Skin_OscR, Skin_OscG, Skin_OscB); - {if (ParamStr(1) = '-black') or (ParamStr(1) = '-fsblack') then - glColor3f(1, 1, 1); } - - glBegin(GL_LINE_STRIP); - glVertex2f(X, -Sound[NrSound].BufferArray[1] / $10000 * H + Y + H/2); - for Pet := 2 to Sound[NrSound].n div 1 do begin - glVertex2f(X + (Pet-1) * W / (Sound[NrSound].n - 1), - -Sound[NrSound].BufferArray[Pet] / $10000 * H + Y + H/2); - end; - glEnd; -end; - -procedure SingDrawNoteLines(Left, Top, Right: real; Space: integer); -var - Pet: integer; -begin - glEnable(GL_BLEND); - glColor4f(Skin_P1_LinesR, Skin_P1_LinesG, Skin_P1_LinesB, 0.4); - glBegin(GL_LINES); - for Pet := 0 to 9 do begin - glVertex2f(Left, Top + Pet * Space); - glVertex2f(Right, Top + Pet * Space); - end; - glEnd; - glDisable(GL_BLEND); -end; - -procedure SingDrawBeatDelimeters(Left, Top, Right: real; NrCzesci: integer); -var - Pet: integer; - TempR: real; -begin - TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); - glEnable(GL_BLEND); - glBegin(GL_LINES); - for Pet := Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote to Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec do begin - if (Pet mod Czesci[NrCzesci].Resolution) = Czesci[NrCzesci].NotesGAP then - glColor4f(0, 0, 0, 1) - else - glColor4f(0, 0, 0, 0.3); - glVertex2f(Left + TempR * (Pet - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote), Top); - glVertex2f(Left + TempR * (Pet - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote), Top + 135); - end; - glEnd; - glDisable(GL_BLEND); -end; - -// draw blank Notebars -procedure SingDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); -var - Rec: TRecR; - Pet: integer; - TempR: real; - R,G,B: real; - - PlayerNumber: Integer; - - GoldenStarPos : real; -begin -// We actually don't have a playernumber in this procedure, it should reside in NrCzesci - but it's always set to zero -// So we exploit this behavior a bit - we give NrCzesci the playernumber, keep it in playernumber - and then we set NrCzesci to zero -// This could also come quite in handy when we do the duet mode, cause just the notes for the player that has to sing should be drawn then -// BUT this is not implemented yet, all notes are drawn! :D - - PlayerNumber := NrCzesci + 1; // Player 1 is 0 - NrCzesci := 0; - -// exploit done - - glColor3f(1, 1, 1); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); - with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin - for Pet := 0 to HighNut do begin - with Nuta[Pet] do begin - if not FreeStyle then begin - - - if Ini.EffectSing = 0 then - // If Golden note Effect of then Change not Color - begin - case Wartosc of - 1: glColor4f(1, 1, 1, 1); // We set alpha to 1, cause we can control the transparency through the png itself - 2: glColor4f(1, 1, 0.3, 1); // no stars, paint yellow -> glColor4f(1, 1, 0.3, 0.85); - we could - end; // case - end //Else all Notes same Color - else - glColor4f(1, 1, 1, 1); // We set alpha to 1, cause we can control the transparency through the png itself - // Czesci == teil, element == piece, element | koniec == ende, schluss - // lewa czesc - left part - Rec.Left := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX; - Rec.Right := Rec.Left + NotesW; - Rec.Top := Top - (Ton-BaseNote)*Space/2 - NotesH; - Rec.Bottom := Rec.Top + 2 * NotesH; - glBindTexture(GL_TEXTURE_2D, Tex_plain_Left[PlayerNumber].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - //We keep the postion of the top left corner b4 it's overwritten - GoldenStarPos := Rec.Left; - //done - - // srodkowa czesc - middle part - Rec.Left := Rec.Right; - Rec.Right := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - NotesW - 0.5 + 10*ScreenX; // Dlugosc == länge - - glBindTexture(GL_TEXTURE_2D, Tex_plain_Mid[PlayerNumber].TexNum); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(round((Rec.Right-Rec.Left)/32), 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(round((Rec.Right-Rec.Left)/32), 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - // prawa czesc - right part - Rec.Left := Rec.Right; - Rec.Right := Rec.Right + NotesW; - - glBindTexture(GL_TEXTURE_2D, Tex_plain_Right[PlayerNumber].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - // Golden Star Patch - if (Wartosc = 2) AND (Ini.EffectSing=1) then - begin - GoldenRec.SaveGoldenStarsRec(GoldenStarPos, Rec.Top, Rec.Right, Rec.Bottom); - end; - - end; // if not FreeStyle - end; // with - end; // for - end; // with - - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); -end; - - -// draw sung notes -procedure SingDrawPlayerCzesc(X, Y, W: real; NrGracza: integer; Space: integer); -var - TempR: real; - Rec: TRecR; - N: integer; - R: real; - G: real; - B: real; - A: real; - NotesH2: real; - begin -// Log.LogStatus('Player notes', 'SingDraw'); - -// if NrGracza = 0 then LoadColor(R, G, B, 'P1Light') -// else LoadColor(R, G, B, 'P2Light'); - -// R := 71/255; -// G := 175/255; -// B := 247/255; - - glColor3f(1, 1, 1); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - if Player[NrGracza].IlNut > 0 then - begin - TempR := W / (Czesci[0].Czesc[Czesci[0].Akt].Koniec - Czesci[0].Czesc[Czesci[0].Akt].StartNote); - for N := 0 to Player[NrGracza].HighNut do - begin - with Player[NrGracza].Nuta[N] do - begin - // Left part of note - Rec.Left := X + (Start-Czesci[0].Czesc[Czesci[0].Akt].StartNote) * TempR + 0.5 + 10*ScreenX; - Rec.Right := Rec.Left + NotesW; - - // Draw it in half size, if not hit - if Hit then - begin - NotesH2 := NotesH - end - else - begin - NotesH2 := int(NotesH * 0.65); - end; - - Rec.Top := Y - (Ton-Czesci[0].Czesc[Czesci[0].Akt].BaseNote)*Space/2 - NotesH2; - Rec.Bottom := Rec.Top + 2 *NotesH2; - - // draw the left part - glColor3f(1, 1, 1); - glBindTexture(GL_TEXTURE_2D, Tex_Left[NrGracza+1].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - // Middle part of the note - Rec.Left := Rec.Right; - Rec.Right := X + (Start+Dlugosc-Czesci[0].Czesc[Czesci[0].Akt].StartNote) * TempR - NotesW - 0.5 + 10*ScreenX; - - // (nowe) - dunno - if (Start+Dlugosc-1 = Czas.AktBeatD) then - Rec.Right := Rec.Right - (1-Frac(Czas.MidBeatD)) * TempR; - // the left note is more right than the right note itself, sounds weird - so we fix that xD - if Rec.Right <= Rec.Left then Rec.Right := Rec.Left; - - // draw the middle part - glBindTexture(GL_TEXTURE_2D, Tex_Mid[NrGracza+1].TexNum); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(round((Rec.Right-Rec.Left)/32), 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(round((Rec.Right-Rec.Left)/32), 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - glColor3f(1, 1, 1); - - // the right part of the note - Rec.Left := Rec.Right; - Rec.Right := Rec.Right + NotesW; - - glBindTexture(GL_TEXTURE_2D, Tex_Right[NrGracza+1].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - // Perfect note is stored - if Perfect and (Ini.EffectSing=1) then - begin - A := 1 - 2*(Czas.Teraz - GetTimeFromBeat(Start+Dlugosc)); - if not (Start+Dlugosc-1 = Czas.AktBeatD) then - - //Star animation counter - //inc(Starfr); - //Starfr := Starfr mod 128; - GoldenRec.SavePerfectNotePos(Rec.Left, Rec.Top); - end; - end; // with - end; // for - // eigentlich brauchen wir hier einen vergleich, um festzustellen, ob wir mit - // singen schon weiter wären, als bei Rec.Right, _auch, wenn nicht gesungen wird_ - - // passing on NrGracza... hope this is really something like the player-number, not only - // some kind of weird index into a colour-table - - if (Ini.EffectSing=1) then - GoldenRec.GoldenNoteTwinkle(Rec.Top,Rec.Bottom,Rec.Right, NrGracza); - end; // if -end; - -//draw Note glow -procedure SingDrawPlayerBGCzesc(Left, Top, Right: real; NrCzesci, NrGracza: integer; Space: integer); -var - Rec: TRecR; - Pet: integer; - TempR: real; - R,G,B: real; - X1, X2, X3, X4: real; - W, H: real; -begin - if (Player[NrGracza].ScoreTotalI >= 0) then begin - glColor4f(1, 1, 1, sqrt((1+sin(Music.Position * 3))/4)/ 2 + 0.5 ); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); - with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin - for Pet := 0 to HighNut do begin - with Nuta[Pet] do begin - if not FreeStyle then begin - // begin: 14, 20 - // easy: 6, 11 - W := NotesW * 2 + 2; - H := NotesH * 1.5 + 3.5; - - X2 := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX + 4; // wciecie - X1 := X2-W; - - X3 := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - 0.5 + 10*ScreenX - 4; // wciecie - X4 := X3+W; - - // left - Rec.Left := X1; - Rec.Right := X2; - Rec.Top := Top - (Ton-BaseNote)*Space/2 - H; - Rec.Bottom := Rec.Top + 2 * H; - - glBindTexture(GL_TEXTURE_2D, Tex_BG_Left[NrGracza+1].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - - // srodkowa czesc - Rec.Left := X2; - Rec.Right := X3; - - glBindTexture(GL_TEXTURE_2D, Tex_BG_Mid[NrGracza+1].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - // prawa czesc - Rec.Left := X3; - Rec.Right := X4; - - glBindTexture(GL_TEXTURE_2D, Tex_BG_Right[NrGracza+1].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - end; // if not FreeStyle - end; // with - end; // for - end; // with - - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - end; -end; - -procedure SingDraw; -var - Pet: integer; - Pet2: integer; - TempR: real; - Rec: TRecR; - TexRec: TRecR; - NR: TRecR; - FS: real; - BarFrom: integer; - BarAlpha: real; - BarWspol: real; - TempCol: real; - Tekst: string; - LyricTemp: string; - PetCz: integer; - - //SingBar Mod - A: Integer; - E: Integer; - I: Integer; - //end Singbar Mod - -begin - // positions - if Ini.SingWindow = 0 then begin - NR.Left := 120; - end else begin - NR.Left := 20; - end; - NR.Right := 780; - - NR.Width := NR.Right - NR.Left; - NR.WMid := NR.Width / 2; - NR.Mid := NR.Left + NR.WMid; - - // background //BG Fullsize Mod - //SingDrawBackground; - - //TimeBar mod - SingDrawTimeBar(); - //eoa TimeBar mod - - // rysuje paski pod nutami - if PlayersPlay = 1 then - SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); - if (PlayersPlay = 2) or (PlayersPlay = 4) then begin - SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P1_NotesB - 105, Nr.Right + 10*ScreenX, 15); - SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); - end; - - if (PlayersPlay = 3) or (PlayersPlay = 6) then begin - SingDrawNoteLines(Nr.Left + 10*ScreenX, 120, Nr.Right + 10*ScreenX, 12); - SingDrawNoteLines(Nr.Left + 10*ScreenX, 245, Nr.Right + 10*ScreenX, 12); - SingDrawNoteLines(Nr.Left + 10*ScreenX, 370, Nr.Right + 10*ScreenX, 12); - end; - - // rysuje tekst - new Lyric engine - ScreenSing.LyricMain.Draw; - ScreenSing.LyricSub.Draw; - - // rysuje pasek, podpowiadajacy poczatek spiwania w scenie - FS := 1.3; - BarFrom := Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start; - if BarFrom > 40 then BarFrom := 40; - if (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start > 8) and // dluga przerwa //16->12 for more help bars and then 12->8 for even more - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat > 0) and // przed tekstem - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat < 40) then begin // ale nie za wczesnie - BarWspol := (Czas.MidBeat - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - BarFrom)) / BarFrom; - Rec.Left := NR.Left + BarWspol * -// (NR.WMid - Czesci[0].Czesc[Czesci[0].Akt].LyricWidth / 2 * FS - 50); - (ScreenSing.LyricMain.ClientX - NR.Left - 50) + 10*ScreenX; - Rec.Right := Rec.Left + 50; - Rec.Top := Skin_LyricsT + 3; - Rec.Bottom := Rec.Top + 33;//SingScreen.LyricMain.Size * 3; -{ // zapalanie - BarAlpha := (BarWspol*10) * 0.5; - if BarAlpha > 0.5 then BarAlpha := 0.5; - - // gaszenie - if BarWspol > 0.95 then BarAlpha := 0.5 * (1 - (BarWspol - 0.95) * 20);} - - //Change fuer Crazy Joker - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, Tex_Lyric_Help_Bar.TexNum); - glBegin(GL_QUADS); - glColor4f(1, 1, 1, 0); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glColor4f(1, 1, 1, 0.5); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - glDisable(GL_BLEND); - - end; - - // oscilloscope - if Ini.Oscilloscope = 1 then begin - if PlayersPlay = 1 then - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - - if PlayersPlay = 2 then begin - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); - end; - if ScreenAct = 2 then begin - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 2); - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 3); - end; - end; - - if PlayersPlay = 3 then begin - SingDrawOscilloscope(75 + 10*ScreenX, 95, 100, 20, 0); - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 0); - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); - end; - if ScreenAct = 2 then begin - SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 3); - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 4); - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 5); - end; - end; - - end - - //SingBar Mod - //modded again to make it moveable: it's working, so why try harder - else if Ini.Oscilloscope = 2 then - begin - A := GetTickCount div 33; - if A <> Tickold then begin - Tickold := A; - for E := 0 to (PlayersPlay - 1) do begin //Set new Pos + Alpha - I := Player[E].ScorePercentTarget - Player[E].ScorePercent; - if I > 0 then Inc(Player[E].ScorePercent) - else if I < 0 then Dec(Player[E].ScorePercent); - end; //for - end; //if - - if PlayersPlay = 1 then begin - SingDrawSingbar(Theme.Sing.StaticP1SingBar.x, Theme.Sing.StaticP1SingBar.y, Theme.Sing.StaticP1SingBar.w, Theme.Sing.StaticP1SingBar.h , Player[0].ScorePercent); - end; - - if PlayersPlay = 2 then begin - SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); - end; - - if PlayersPlay = 3 then begin - SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); - end; - if ScreenAct = 2 then begin - SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[2].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[3].ScorePercent); - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); - end; - if ScreenAct = 2 then begin - SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[3].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[4].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[5].ScorePercent); - end; - end; - end; - //end Singbar Mod - - //PhrasenBonus - Line Bonus Mod - if Ini.LineBonus > 0 then begin - A := GetTickCount div 33; - if (A <> Tickold2) AND (Player[0].LineBonus_Visible) then begin - Tickold2 := A; - for E := 0 to (PlayersPlay - 1) do begin - //Change Alpha - Player[E].LineBonus_Alpha := Player[E].LineBonus_Alpha - 0.02; - if Player[E].LineBonus_Alpha <= 0 then - begin - Player[E].LineBonus_Age := 0; - Player[E].LineBonus_Visible := False - end - else - begin - inc(Player[E].LineBonus_Age, 1); - //Change Position - if (Player[E].LineBonus_PosX < Player[E].LineBonus_TargetX) then - Player[E].LineBonus_PosX := Player[E].LineBonus_PosX + (2 - Player[E].LineBonus_Alpha * 1.5) - else if (Player[E].LineBonus_PosX > Player[E].LineBonus_TargetX) then - Player[E].LineBonus_PosX := Player[E].LineBonus_PosX - (2 - Player[E].LineBonus_Alpha * 1.5); - - if (Player[E].LineBonus_PosY < Player[E].LineBonus_TargetY) then - Player[E].LineBonus_PosY := Player[E].LineBonus_PosY + (2 - Player[E].LineBonus_Alpha * 1.5) - else if (Player[E].LineBonus_PosY > Player[E].LineBonus_TargetY) then - Player[E].LineBonus_PosY := Player[E].LineBonus_PosY - (2 - Player[E].LineBonus_Alpha * 1.5); - - end; // shift position of the pop up (if not dead) - end; // loop - for all players - end; // if - linebonus - - - if PlayersPlay = 1 then begin - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - end - - else if PlayersPlay = 2 then begin - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - end - - else if PlayersPlay = 3 then begin - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); - end - - else if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - end; - if ScreenAct = 2 then begin - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); - SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); - end; - if ScreenAct = 2 then begin - SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); - SingDrawLineBonus( Player[4].LineBonus_PosX, Player[4].LineBonus_PosY, Player[4].LineBonus_Color, Player[4].LineBonus_Alpha, Player[4].LineBonus_Text, Player[4].LineBonus_Age); - SingDrawLineBonus( Player[5].LineBonus_PosX, Player[5].LineBonus_PosY, Player[5].LineBonus_Color, Player[5].LineBonus_Alpha, Player[5].LineBonus_Text, Player[5].LineBonus_Age); - end; - end; - end; - //PhrasenBonus - Line Bonus Mod End - -// Set the note heights according to the difficulty level - case Ini.Difficulty of - 0: - begin - NotesH := 11; // 9 - NotesW := 6; // 5 - end; - 1: - begin - NotesH := 8; // 7 - NotesW := 4; // 4 - end; - 2: - begin - NotesH := 5; - NotesW := 3; - end; - end; - -// Draw the Notes - if PlayersPlay = 1 then begin - SingDrawPlayerBGCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 0, 15); // Background glow - colorized in playercolor - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); // Plain unsung notes - colorized in playercolor - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 0, 15); // imho the sung notes - end; - - if (PlayersPlay = 2) then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); - - SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 1, 15); - - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); - end; - - if PlayersPlay = 3 then begin - NotesW := NotesW * 0.8; - NotesH := NotesH * 0.8; - - SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); - - SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); - SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 1, 12); - SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 2, 12); - - SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); - end; - if ScreenAct = 2 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 2, 15); - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 3, 15); - end; - - if ScreenAct = 1 then begin - SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 1, 15); - end; - if ScreenAct = 2 then begin - SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 2, 15); - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 3, 15); - end; - - if ScreenAct = 1 then begin - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); - end; - if ScreenAct = 2 then begin - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 2, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 3, 15); - end; - end; - - if PlayersPlay = 6 then begin - NotesW := NotesW * 0.8; - NotesH := NotesH * 0.8; - - if ScreenAct = 1 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); - end; - if ScreenAct = 2 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 3, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 4, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 5, 12); - end; - - if ScreenAct = 1 then begin - SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); - SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 1, 12); - SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 2, 12); - end; - if ScreenAct = 2 then begin - SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 3, 12); - SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 4, 12); - SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 5, 12); - end; - - if ScreenAct = 1 then begin - SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); - end; - if ScreenAct = 2 then begin - SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 3, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 4, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 5, 12); - end; - end; - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); -end; - -// q'n'd for using the game mode dll's -procedure SingModiDraw (PlayerInfo: TPlayerInfo); -var - Pet: integer; - Pet2: integer; - TempR: real; - Rec: TRecR; - TexRec: TRecR; - NR: TRecR; - FS: real; - BarFrom: integer; - BarAlpha: real; - BarWspol: real; - TempCol: real; - Tekst: string; - LyricTemp: string; - PetCz: integer; - - //SingBar Mod - A: Integer; - E: Integer; - I: Integer; - //end Singbar Mod - -begin - // positions - if Ini.SingWindow = 0 then begin - NR.Left := 120; - end else begin - NR.Left := 20; - end; - - NR.Right := 780; - NR.Width := NR.Right - NR.Left; - NR.WMid := NR.Width / 2; - NR.Mid := NR.Left + NR.WMid; - - // time bar - SingDrawTimeBar(); - - if DLLMan.Selected.ShowNotes then - begin - if PlayersPlay = 1 then - SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); - if (PlayersPlay = 2) or (PlayersPlay = 4) then begin - SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P1_NotesB - 105, Nr.Right + 10*ScreenX, 15); - SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); - end; - - if (PlayersPlay = 3) or (PlayersPlay = 6) then begin - SingDrawNoteLines(Nr.Left + 10*ScreenX, 120, Nr.Right + 10*ScreenX, 12); - SingDrawNoteLines(Nr.Left + 10*ScreenX, 245, Nr.Right + 10*ScreenX, 12); - SingDrawNoteLines(Nr.Left + 10*ScreenX, 370, Nr.Right + 10*ScreenX, 12); - end; - end; - - // Lyric engine - ScreenSingModi.LyricMain.Draw; - ScreenSingModi.LyricSub.Draw; - - // rysuje pasek, podpowiadajacy poczatek spiwania w scenie - FS := 1.3; - BarFrom := Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start; - if BarFrom > 40 then BarFrom := 40; - if (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start > 8) and // dluga przerwa //16->12 for more help bars and then 12->8 for even more - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat > 0) and // przed tekstem - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat < 40) then begin // ale nie za wczesnie - BarWspol := (Czas.MidBeat - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - BarFrom)) / BarFrom; - Rec.Left := NR.Left + BarWspol * (ScreenSingModi.LyricMain.ClientX - NR.Left - 50) + 10*ScreenX; - Rec.Right := Rec.Left + 50; - Rec.Top := Skin_LyricsT + 3; - Rec.Bottom := Rec.Top + 33;//SingScreen.LyricMain.Size * 3; - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, Tex_Lyric_Help_Bar.TexNum); - glBegin(GL_QUADS); - glColor4f(1, 1, 1, 0); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glColor4f(1, 1, 1, 0.5); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - glDisable(GL_BLEND); - end; - - // oscilloscope | the thing that moves when you yell into your mic (imho) - if (((Ini.Oscilloscope = 1) AND (DLLMan.Selected.ShowRateBar_O)) AND (NOT DLLMan.Selected.ShowRateBar)) then begin - if PlayersPlay = 1 then - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - - if PlayersPlay = 2 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); - end; - if ScreenAct = 2 then begin - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 2); - if PlayerInfo.Playerinfo[3].Enabled then - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 3); - end; - end; - - if PlayersPlay = 3 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawOscilloscope(75 + 10*ScreenX, 95, 100, 20, 0); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 0); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); - end; - if ScreenAct = 2 then begin - if PlayerInfo.Playerinfo[3].Enabled then - SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 3); - if PlayerInfo.Playerinfo[4].Enabled then - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 4); - if PlayerInfo.Playerinfo[5].Enabled then - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 5); - end; - end; - - end - - //SingBar Mod - // seems like we don't want the flicker thing, we want the linebonus rating bar beneath the scores - else if ((Ini.Oscilloscope = 2) AND (DLLMan.Selected.ShowRateBar_O)) OR (DLLMan.Selected.ShowRateBar) then begin - A := GetTickCount div 33; - if A <> Tickold then begin - Tickold := A; - for E := 0 to (PlayersPlay - 1) do begin //Set new Pos + Alpha - I := Player[E].ScorePercentTarget - Player[E].ScorePercent; - if I > 0 then Inc(Player[E].ScorePercent) - else if I < 0 then Dec(Player[E].ScorePercent); - end; //for - end; //if - - if PlayersPlay = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawSingbar(Theme.Sing.StaticP1SingBar.x, Theme.Sing.StaticP1SingBar.y, Theme.Sing.StaticP1SingBar.w, Theme.Sing.StaticP1SingBar.h , Player[0].ScorePercent); - end; - - if PlayersPlay = 2 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); - end; - - if PlayersPlay = 3 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); - end; - if ScreenAct = 2 then begin - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[2].ScorePercent); - if PlayerInfo.Playerinfo[3].Enabled then - SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[3].ScorePercent); - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); - end; - if ScreenAct = 2 then begin - if PlayerInfo.Playerinfo[3].Enabled then - SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[3].ScorePercent); - if PlayerInfo.Playerinfo[4].Enabled then - SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[4].ScorePercent); - if PlayerInfo.Playerinfo[5].Enabled then - SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[5].ScorePercent); - end; - end; - end; - //end Singbar Mod - - //PhrasenBonus - Line Bonus Mod - if ((Ini.LineBonus > 0) AND (DLLMan.Selected.EnLineBonus_O)) OR (DLLMan.Selected.EnLineBonus) then begin - A := GetTickCount div 33; - if (A <> Tickold2) AND (Player[0].LineBonus_Visible) then begin - Tickold2 := A; - for E := 0 to (PlayersPlay - 1) do begin - //Change Alpha - Player[E].LineBonus_Alpha := Player[E].LineBonus_Alpha - 0.02; - - if Player[E].LineBonus_Alpha <= 0 then - begin - Player[E].LineBonus_Age := 0; - Player[E].LineBonus_Visible := False - end - else - begin - inc(Player[E].LineBonus_Age, 1); - //Change Position - if (Player[E].LineBonus_PosX < Player[E].LineBonus_TargetX) then // pop up has not yet reached it's position -> blend in - Player[E].LineBonus_PosX := Player[E].LineBonus_PosX + (2 - Player[E].LineBonus_Alpha * 1.5) - else if (Player[E].LineBonus_PosX > Player[E].LineBonus_TargetX) then // pop up has reached it's position -> blend out - Player[E].LineBonus_PosX := Player[E].LineBonus_PosX - (2 - Player[E].LineBonus_Alpha * 1.5); - - if (Player[E].LineBonus_PosY < Player[E].LineBonus_TargetY) then - Player[E].LineBonus_PosY := Player[E].LineBonus_PosY + (2 - Player[E].LineBonus_Alpha * 1.5) - else if (Player[E].LineBonus_PosY > Player[E].LineBonus_TargetY) then - Player[E].LineBonus_PosY := Player[E].LineBonus_PosY - (2 - Player[E].LineBonus_Alpha * 1.5); - - end; // pop up still visible, has not reached it's position - move it - end; // loop through all players - end; // if it's time to draw them - - if PlayersPlay = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - end - - else if PlayersPlay = 2 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - end - - else if PlayersPlay = 3 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); - end - - else if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - end; - if ScreenAct = 2 then begin - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); - if PlayerInfo.Playerinfo[3].Enabled then - SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); - end; - if ScreenAct = 2 then begin - if PlayerInfo.Playerinfo[3].Enabled then - SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); - if PlayerInfo.Playerinfo[4].Enabled then - SingDrawLineBonus( Player[4].LineBonus_PosX, Player[4].LineBonus_PosY, Player[4].LineBonus_Color, Player[4].LineBonus_Alpha, Player[4].LineBonus_Text, Player[4].LineBonus_Age); - if PlayerInfo.Playerinfo[5].Enabled then - SingDrawLineBonus( Player[5].LineBonus_PosX, Player[5].LineBonus_PosY, Player[5].LineBonus_Color, Player[5].LineBonus_Alpha, Player[5].LineBonus_Text, Player[5].LineBonus_Age); - end; - end; - end; -//PhrasenBonus - Line Bonus Mod End - -// resize the notes according to the difficulty level - case Ini.Difficulty of - 0: - begin - NotesH := 11; // 9 - NotesW := 6; // 5 - end; - 1: - begin - NotesH := 8; // 7 - NotesW := 4; // 4 - end; - 2: - begin - NotesH := 5; - NotesW := 3; - end; - end; - - if (DLLMAn.Selected.ShowNotes And DLLMan.Selected.LoadSong) then - begin - if (PlayersPlay = 1) And PlayerInfo.Playerinfo[0].Enabled then begin - SingDrawPlayerBGCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 0, 15); - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 0, 15); - end; - - if (PlayersPlay = 2) then begin - if PlayerInfo.Playerinfo[0].Enabled then - begin - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); - SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); - end; - if PlayerInfo.Playerinfo[1].Enabled then - begin - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); - end; - - end; - - if PlayersPlay = 3 then begin - NotesW := NotesW * 0.8; - NotesH := NotesH * 0.8; - - if PlayerInfo.Playerinfo[0].Enabled then - begin - SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); - SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); - end; - - if PlayerInfo.Playerinfo[1].Enabled then - begin - SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); - SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 0, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); - end; - - if PlayerInfo.Playerinfo[2].Enabled then - begin - SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); - SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 0, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); - end; - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); - end; - if ScreenAct = 2 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 2, 15); - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 3, 15); - end; - - SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); - - if ScreenAct = 1 then begin - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); - end; - if ScreenAct = 2 then begin - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 2, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 3, 15); - end; - end; - - if PlayersPlay = 6 then begin - NotesW := NotesW * 0.8; - NotesH := NotesH * 0.8; - - if ScreenAct = 1 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); - end; - if ScreenAct = 2 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 3, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 4, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 5, 12); - end; - - SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); - SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 0, 12); - SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 0, 12); - - if ScreenAct = 1 then begin - SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); - end; - if ScreenAct = 2 then begin - SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 3, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 4, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 5, 12); - end; - end; - end; - - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); -end; - - -//SingBar Mod -procedure SingDrawSingbar(X, Y, W, H: real; Percent: integer); -var - R: Real; - G: Real; - B: Real; - A: cardinal; - I: Integer; - -begin; - - //SingBar Background - glColor4f(1, 1, 1, 0.8); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Back.TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(X, Y); - glTexCoord2f(0, 1); glVertex2f(X, Y+H); - glTexCoord2f(1, 1); glVertex2f(X+W, Y+H); - glTexCoord2f(1, 0); glVertex2f(X+W, Y); - glEnd; - - //SingBar coloured Bar - Case Percent of - 0..22: begin - R := 1; - G := 0; - B := 0; - end; - 23..42: begin - R := 1; - G := ((Percent-23)/100)*5; - B := 0; - end; - 43..57: begin - R := 1; - G := 1; - B := 0; - end; - 58..77: begin - R := 1-(Percent - 58)/100*5; - G := 1; - B := 0; - end; - 78..99: begin - R := 0; - G := 1; - B := 0; - end; - End; //Case - - glColor4f(R, G, B, 1); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Bar.TexNum); - //Size= Player[PlayerNum].ScorePercent of W - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(X, Y); - glTexCoord2f(0, 1); glVertex2f(X, Y+H); - glTexCoord2f(1, 1); glVertex2f(X+(W/100 * (Percent +1)), Y+H); - glTexCoord2f(1, 0); glVertex2f(X+(W/100 * (Percent +1)), Y); - glEnd; - - //SingBar Front - glColor4f(1, 1, 1, 0.6); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Front.TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(X, Y); - glTexCoord2f(0, 1); glVertex2f(X, Y+H); - glTexCoord2f(1, 1); glVertex2f(X+W, Y+H); - glTexCoord2f(1, 0); glVertex2f(X+W, Y); - glEnd; -end; -//end Singbar Mod - -//PhrasenBonus - Line Bonus Pop Up -procedure SingDrawLineBonus( const X, Y: Single; Color: TRGB; Alpha: Single; Text: string; Age: Integer); -var -Length, X2: Real; //Length of Text -Size: Integer; //Size of Popup -begin -if Alpha <> 0 then -begin - -//Set Font Propertys -SetFontStyle(2); //Font: Outlined1 -if Age < 5 then SetFontSize(Age + 1) else SetFontSize(6); -SetFontItalic(False); - -//Check Font Size -Length := glTextWidth ( PChar(Text)) + 3; //Little Space for a Better Look ^^ - -//Text -SetFontPos (X + 50 - (Length / 2), Y + 12); //Position - - -if Age < 5 then Size := Age * 10 else Size := 50; - - //Draw Background - //glColor4f(Color.R, Color.G, Color.B, Alpha); //Set Color - glColor4f(1, 1, 1, Alpha); - - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - - //New Method, Not Variable - glBindTexture(GL_TEXTURE_2D, Tex_SingLineBonusBack[2].TexNum); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(X + 50 - Size, Y + 25 - (Size/2)); - glTexCoord2f(0, 1); glVertex2f(X + 50 - Size, Y + 25 + (Size/2)); - glTexCoord2f(1, 1); glVertex2f(X + 50 + Size, Y + 25 + (Size/2)); - glTexCoord2f(1, 0); glVertex2f(X + 50 + Size, Y + 25 - (Size/2)); - glEnd; - - glColor4f(1, 1, 1, Alpha); //Set Color - //Draw Text - glPrint (PChar(Text)); -end; -end; -//PhrasenBonus - Line Bonus Mod - -// Draw Note Bars for Editor -//There are 11 Resons for a new Procdedure: -// 1. It don't look good when you Draw the Golden Note Star Effect in the Editor -// 2. You can see the Freestyle Notes in the Editor SemiTransparent -// 3. Its easier and Faster then changing the old Procedure -procedure EditDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); -var - Rec: TRecR; - Pet: integer; - TempR: real; -begin - glColor3f(1, 1, 1); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); - with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin - for Pet := 0 to HighNut do begin - with Nuta[Pet] do begin - - // Golden Note Patch - case Wartosc of - 0: glColor4f(1, 1, 1, 0.35); - 1: glColor4f(1, 1, 1, 0.85); - 2: glColor4f(1, 1, 0.3, 0.85); - end; // case - - - - // lewa czesc - left part - Rec.Left := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX; - Rec.Right := Rec.Left + NotesW; - Rec.Top := Top - (Ton-BaseNote)*Space/2 - NotesH; - Rec.Bottom := Rec.Top + 2 * NotesH; - glBindTexture(GL_TEXTURE_2D, Tex_Left[Color].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - // srodkowa czesc - middle part - Rec.Left := Rec.Right; - Rec.Right := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - NotesW - 0.5 + 10*ScreenX; - - glBindTexture(GL_TEXTURE_2D, Tex_Mid[Color].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - // prawa czesc - right part - Rec.Left := Rec.Right; - Rec.Right := Rec.Right + NotesW; - - glBindTexture(GL_TEXTURE_2D, Tex_Right[Color].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - end; // with - end; // for - end; // with - - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); -end; - -procedure SingDrawTimeBar(); -var x,y: real; - width, height: real; -begin - x := Theme.Sing.StaticTimeProgress.x; - y := Theme.Sing.StaticTimeProgress.y; - width:= Theme.Sing.StaticTimeProgress.w; - height:= Theme.Sing.StaticTimeProgress.h; - - glColor4f(Theme.Sing.StaticTimeProgress.ColR, - Theme.Sing.StaticTimeProgress.ColG, - Theme.Sing.StaticTimeProgress.ColB, 1); //Set Color - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - - glBindTexture(GL_TEXTURE_2D, Tex_TimeProgress.TexNum); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(x,y); - glTexCoord2f((width*(Czas.Teraz/Czas.Razem))/8, 0); glVertex2f(x+width*(Czas.Teraz/Czas.Razem), y); - glTexCoord2f((width*(Czas.Teraz/Czas.Razem))/8, 1); glVertex2f(x+width*(Czas.Teraz/Czas.Razem), y+height); - glTexCoord2f(0, 1); glVertex2f(x, y+height); - glEnd; - - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glcolor4f(1,1,1,1); -end; - -end. - +unit UDraw; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses UThemes, + ModiSDK, + UGraphicClasses; + +procedure SingDraw; +procedure SingModiDraw (PlayerInfo: TPlayerInfo); +procedure SingDrawBackground; +procedure SingDrawOscilloscope(X, Y, W, H: real; NrSound: integer); +procedure SingDrawNoteLines(Left, Top, Right: real; Space: integer); +procedure SingDrawBeatDelimeters(Left, Top, Right: real; NrCzesci: integer); +procedure SingDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); +procedure SingDrawPlayerCzesc(X, Y, W: real; NrGracza: integer; Space: integer); +procedure SingDrawPlayerBGCzesc(Left, Top, Right: real; NrCzesci, NrGracza: integer; Space: integer); + +// TimeBar +procedure SingDrawTimeBar(); + +// The Singbar +procedure SingDrawSingbar(X, Y, W, H: real; Percent: integer); + +//Phrasen Bonus - Line Bonus +procedure SingDrawLineBonus( const X, Y: Single; Color: TRGB; Alpha: Single; Text: string; Age: Integer); + +//Draw Editor NoteLines +procedure EditDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); + + +type + TRecR = record + Top: real; + Left: real; + Right: real; + Bottom: real; + + Width: real; + WMid: real; + Height: real; + HMid: real; + + Mid: real; + end; + +var + NotesW: real; + NotesH: real; + Starfr: integer; + StarfrG: integer; + + //SingBar + TickOld: cardinal; + TickOld2:cardinal; + +const + Przedz = 32; + +implementation + +uses {$IFDEF Win32} + windows, + {$ELSE} + lclintf, + {$ENDIF} + OpenGL12, + UGraphic, + SysUtils, + UMusic, + URecord, + ULog, + UScreenSing, + UScreenSingModi, + ULyrics, + UMain, + TextGL, + UTexture, + UDrawTexture, + UIni, + Math, + UDLLManager; + +procedure SingDrawBackground; +var + Rec: TRecR; + TexRec: TRecR; +begin + if ScreenSing.Tex_Background.TexNum >= 1 then begin + + glClearColor (1, 1, 1, 1); + glColor4f (1, 1, 1, 1); + + 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) * ScreenSing.Tex_Background.TexH; + TexRec.Bottom := (Rec.Bottom / 600) * ScreenSing.Tex_Background.TexH; + TexRec.Left := 0; + TexRec.Right := ScreenSing.Tex_Background.TexW; + + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, ScreenSing.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) * ScreenSing.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) * ScreenSing.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, ScreenSing.Tex_Background.TexNum); + //glEnable(GL_BLEND); + glBegin(GL_QUADS); + + glTexCoord2f(0, 0); glVertex2f(0, 0); + glTexCoord2f(0, ScreenSing.Tex_Background.TexH); glVertex2f(0, 600); + glTexCoord2f( ScreenSing.Tex_Background.TexW, ScreenSing.Tex_Background.TexH); glVertex2f(800, 600); + glTexCoord2f( ScreenSing.Tex_Background.TexW, 0); glVertex2f(800, 0); + + glEnd; + glDisable(GL_TEXTURE_2D); + //glDisable(GL_BLEND); + end; + end; +end; + +procedure SingDrawOscilloscope(X, Y, W, H: real; NrSound: integer); +var + Pet: integer; +begin; +// Log.LogStatus('Oscilloscope', 'SingDraw'); + glColor3f(Skin_OscR, Skin_OscG, Skin_OscB); + {if (ParamStr(1) = '-black') or (ParamStr(1) = '-fsblack') then + glColor3f(1, 1, 1); } + + glBegin(GL_LINE_STRIP); + glVertex2f(X, -Sound[NrSound].BufferArray[1] / $10000 * H + Y + H/2); + for Pet := 2 to Sound[NrSound].n div 1 do begin + glVertex2f(X + (Pet-1) * W / (Sound[NrSound].n - 1), + -Sound[NrSound].BufferArray[Pet] / $10000 * H + Y + H/2); + end; + glEnd; +end; + +procedure SingDrawNoteLines(Left, Top, Right: real; Space: integer); +var + Pet: integer; +begin + glEnable(GL_BLEND); + glColor4f(Skin_P1_LinesR, Skin_P1_LinesG, Skin_P1_LinesB, 0.4); + glBegin(GL_LINES); + for Pet := 0 to 9 do begin + glVertex2f(Left, Top + Pet * Space); + glVertex2f(Right, Top + Pet * Space); + end; + glEnd; + glDisable(GL_BLEND); +end; + +procedure SingDrawBeatDelimeters(Left, Top, Right: real; NrCzesci: integer); +var + Pet: integer; + TempR: real; +begin + TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); + glEnable(GL_BLEND); + glBegin(GL_LINES); + for Pet := Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote to Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec do begin + if (Pet mod Czesci[NrCzesci].Resolution) = Czesci[NrCzesci].NotesGAP then + glColor4f(0, 0, 0, 1) + else + glColor4f(0, 0, 0, 0.3); + glVertex2f(Left + TempR * (Pet - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote), Top); + glVertex2f(Left + TempR * (Pet - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote), Top + 135); + end; + glEnd; + glDisable(GL_BLEND); +end; + +// draw blank Notebars +procedure SingDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); +var + Rec: TRecR; + Pet: integer; + TempR: real; + R,G,B: real; + + PlayerNumber: Integer; + + GoldenStarPos : real; +begin +// We actually don't have a playernumber in this procedure, it should reside in NrCzesci - but it's always set to zero +// So we exploit this behavior a bit - we give NrCzesci the playernumber, keep it in playernumber - and then we set NrCzesci to zero +// This could also come quite in handy when we do the duet mode, cause just the notes for the player that has to sing should be drawn then +// BUT this is not implemented yet, all notes are drawn! :D + + PlayerNumber := NrCzesci + 1; // Player 1 is 0 + NrCzesci := 0; + +// exploit done + + glColor3f(1, 1, 1); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); + with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin + for Pet := 0 to HighNut do begin + with Nuta[Pet] do begin + if not FreeStyle then begin + + + if Ini.EffectSing = 0 then + // If Golden note Effect of then Change not Color + begin + case Wartosc of + 1: glColor4f(1, 1, 1, 1); // We set alpha to 1, cause we can control the transparency through the png itself + 2: glColor4f(1, 1, 0.3, 1); // no stars, paint yellow -> glColor4f(1, 1, 0.3, 0.85); - we could + end; // case + end //Else all Notes same Color + else + glColor4f(1, 1, 1, 1); // We set alpha to 1, cause we can control the transparency through the png itself + // Czesci == teil, element == piece, element | koniec == ende, schluss + // lewa czesc - left part + Rec.Left := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX; + Rec.Right := Rec.Left + NotesW; + Rec.Top := Top - (Ton-BaseNote)*Space/2 - NotesH; + Rec.Bottom := Rec.Top + 2 * NotesH; + glBindTexture(GL_TEXTURE_2D, Tex_plain_Left[PlayerNumber].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + //We keep the postion of the top left corner b4 it's overwritten + GoldenStarPos := Rec.Left; + //done + + // srodkowa czesc - middle part + Rec.Left := Rec.Right; + Rec.Right := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - NotesW - 0.5 + 10*ScreenX; // Dlugosc == länge + + glBindTexture(GL_TEXTURE_2D, Tex_plain_Mid[PlayerNumber].TexNum); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(round((Rec.Right-Rec.Left)/32), 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(round((Rec.Right-Rec.Left)/32), 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // prawa czesc - right part + Rec.Left := Rec.Right; + Rec.Right := Rec.Right + NotesW; + + glBindTexture(GL_TEXTURE_2D, Tex_plain_Right[PlayerNumber].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // Golden Star Patch + if (Wartosc = 2) AND (Ini.EffectSing=1) then + begin + GoldenRec.SaveGoldenStarsRec(GoldenStarPos, Rec.Top, Rec.Right, Rec.Bottom); + end; + + end; // if not FreeStyle + end; // with + end; // for + end; // with + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); +end; + + +// draw sung notes +procedure SingDrawPlayerCzesc(X, Y, W: real; NrGracza: integer; Space: integer); +var + TempR: real; + Rec: TRecR; + N: integer; + R: real; + G: real; + B: real; + A: real; + NotesH2: real; + begin +// Log.LogStatus('Player notes', 'SingDraw'); + +// if NrGracza = 0 then LoadColor(R, G, B, 'P1Light') +// else LoadColor(R, G, B, 'P2Light'); + +// R := 71/255; +// G := 175/255; +// B := 247/255; + + glColor3f(1, 1, 1); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + if Player[NrGracza].IlNut > 0 then + begin + TempR := W / (Czesci[0].Czesc[Czesci[0].Akt].Koniec - Czesci[0].Czesc[Czesci[0].Akt].StartNote); + for N := 0 to Player[NrGracza].HighNut do + begin + with Player[NrGracza].Nuta[N] do + begin + // Left part of note + Rec.Left := X + (Start-Czesci[0].Czesc[Czesci[0].Akt].StartNote) * TempR + 0.5 + 10*ScreenX; + Rec.Right := Rec.Left + NotesW; + + // Draw it in half size, if not hit + if Hit then + begin + NotesH2 := NotesH + end + else + begin + NotesH2 := int(NotesH * 0.65); + end; + + Rec.Top := Y - (Ton-Czesci[0].Czesc[Czesci[0].Akt].BaseNote)*Space/2 - NotesH2; + Rec.Bottom := Rec.Top + 2 *NotesH2; + + // draw the left part + glColor3f(1, 1, 1); + glBindTexture(GL_TEXTURE_2D, Tex_Left[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // Middle part of the note + Rec.Left := Rec.Right; + Rec.Right := X + (Start+Dlugosc-Czesci[0].Czesc[Czesci[0].Akt].StartNote) * TempR - NotesW - 0.5 + 10*ScreenX; + + // (nowe) - dunno + if (Start+Dlugosc-1 = Czas.AktBeatD) then + Rec.Right := Rec.Right - (1-Frac(Czas.MidBeatD)) * TempR; + // the left note is more right than the right note itself, sounds weird - so we fix that xD + if Rec.Right <= Rec.Left then Rec.Right := Rec.Left; + + // draw the middle part + glBindTexture(GL_TEXTURE_2D, Tex_Mid[NrGracza+1].TexNum); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(round((Rec.Right-Rec.Left)/32), 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(round((Rec.Right-Rec.Left)/32), 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + glColor3f(1, 1, 1); + + // the right part of the note + Rec.Left := Rec.Right; + Rec.Right := Rec.Right + NotesW; + + glBindTexture(GL_TEXTURE_2D, Tex_Right[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // Perfect note is stored + if Perfect and (Ini.EffectSing=1) then + begin + A := 1 - 2*(Czas.Teraz - GetTimeFromBeat(Start+Dlugosc)); + if not (Start+Dlugosc-1 = Czas.AktBeatD) then + + //Star animation counter + //inc(Starfr); + //Starfr := Starfr mod 128; + GoldenRec.SavePerfectNotePos(Rec.Left, Rec.Top); + end; + end; // with + end; // for + // eigentlich brauchen wir hier einen vergleich, um festzustellen, ob wir mit + // singen schon weiter wären, als bei Rec.Right, _auch, wenn nicht gesungen wird_ + + // passing on NrGracza... hope this is really something like the player-number, not only + // some kind of weird index into a colour-table + + if (Ini.EffectSing=1) then + GoldenRec.GoldenNoteTwinkle(Rec.Top,Rec.Bottom,Rec.Right, NrGracza); + end; // if +end; + +//draw Note glow +procedure SingDrawPlayerBGCzesc(Left, Top, Right: real; NrCzesci, NrGracza: integer; Space: integer); +var + Rec: TRecR; + Pet: integer; + TempR: real; + R,G,B: real; + X1, X2, X3, X4: real; + W, H: real; +begin + if (Player[NrGracza].ScoreTotalI >= 0) then begin + glColor4f(1, 1, 1, sqrt((1+sin(Music.Position * 3))/4)/ 2 + 0.5 ); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); + with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin + for Pet := 0 to HighNut do begin + with Nuta[Pet] do begin + if not FreeStyle then begin + // begin: 14, 20 + // easy: 6, 11 + W := NotesW * 2 + 2; + H := NotesH * 1.5 + 3.5; + + X2 := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX + 4; // wciecie + X1 := X2-W; + + X3 := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - 0.5 + 10*ScreenX - 4; // wciecie + X4 := X3+W; + + // left + Rec.Left := X1; + Rec.Right := X2; + Rec.Top := Top - (Ton-BaseNote)*Space/2 - H; + Rec.Bottom := Rec.Top + 2 * H; + + glBindTexture(GL_TEXTURE_2D, Tex_BG_Left[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + + // srodkowa czesc + Rec.Left := X2; + Rec.Right := X3; + + glBindTexture(GL_TEXTURE_2D, Tex_BG_Mid[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // prawa czesc + Rec.Left := X3; + Rec.Right := X4; + + glBindTexture(GL_TEXTURE_2D, Tex_BG_Right[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + end; // if not FreeStyle + end; // with + end; // for + end; // with + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + end; +end; + +procedure SingDraw; +var + Pet: integer; + Pet2: integer; + TempR: real; + Rec: TRecR; + TexRec: TRecR; + NR: TRecR; + FS: real; + BarFrom: integer; + BarAlpha: real; + BarWspol: real; + TempCol: real; + Tekst: string; + LyricTemp: string; + PetCz: integer; + + //SingBar Mod + A: Integer; + E: Integer; + I: Integer; + //end Singbar Mod + +begin + // positions + if Ini.SingWindow = 0 then begin + NR.Left := 120; + end else begin + NR.Left := 20; + end; + NR.Right := 780; + + NR.Width := NR.Right - NR.Left; + NR.WMid := NR.Width / 2; + NR.Mid := NR.Left + NR.WMid; + + // background //BG Fullsize Mod + //SingDrawBackground; + + //TimeBar mod + SingDrawTimeBar(); + //eoa TimeBar mod + + // rysuje paski pod nutami + if PlayersPlay = 1 then + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); + if (PlayersPlay = 2) or (PlayersPlay = 4) then begin + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P1_NotesB - 105, Nr.Right + 10*ScreenX, 15); + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); + end; + + if (PlayersPlay = 3) or (PlayersPlay = 6) then begin + SingDrawNoteLines(Nr.Left + 10*ScreenX, 120, Nr.Right + 10*ScreenX, 12); + SingDrawNoteLines(Nr.Left + 10*ScreenX, 245, Nr.Right + 10*ScreenX, 12); + SingDrawNoteLines(Nr.Left + 10*ScreenX, 370, Nr.Right + 10*ScreenX, 12); + end; + + // Draw Lyrics + ScreenSing.Lyrics.Draw(Czas.MidBeat); + + // todo: Lyrics +{ // rysuje pasek, podpowiadajacy poczatek spiwania w scenie + FS := 1.3; + BarFrom := Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start; + if BarFrom > 40 then BarFrom := 40; + if (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start > 8) and // dluga przerwa //16->12 for more help bars and then 12->8 for even more + (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat > 0) and // przed tekstem + (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat < 40) then begin // ale nie za wczesnie + BarWspol := (Czas.MidBeat - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - BarFrom)) / BarFrom; + Rec.Left := NR.Left + BarWspol * +// (NR.WMid - Czesci[0].Czesc[Czesci[0].Akt].LyricWidth / 2 * FS - 50); + (ScreenSing.LyricMain.ClientX - NR.Left - 50) + 10*ScreenX; + Rec.Right := Rec.Left + 50; + Rec.Top := Skin_LyricsT + 3; + Rec.Bottom := Rec.Top + 33;//SingScreen.LyricMain.Size * 3; +{ // zapalanie + BarAlpha := (BarWspol*10) * 0.5; + if BarAlpha > 0.5 then BarAlpha := 0.5; + + // gaszenie + if BarWspol > 0.95 then BarAlpha := 0.5 * (1 - (BarWspol - 0.95) * 20);}{ + + //Change fuer Crazy Joker + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_Lyric_Help_Bar.TexNum); + glBegin(GL_QUADS); + glColor4f(1, 1, 1, 0); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glColor4f(1, 1, 1, 0.5); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + glDisable(GL_BLEND); + + end; } + + // oscilloscope + if Ini.Oscilloscope = 1 then begin + if PlayersPlay = 1 then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + + if PlayersPlay = 2 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + if ScreenAct = 2 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 2); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 3); + end; + end; + + if PlayersPlay = 3 then begin + SingDrawOscilloscope(75 + 10*ScreenX, 95, 100, 20, 0); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 0); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + if ScreenAct = 2 then begin + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 3); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 4); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 5); + end; + end; + + end + + //SingBar Mod + //modded again to make it moveable: it's working, so why try harder + else if Ini.Oscilloscope = 2 then + begin + A := GetTickCount div 33; + if A <> Tickold then begin + Tickold := A; + for E := 0 to (PlayersPlay - 1) do begin //Set new Pos + Alpha + I := Player[E].ScorePercentTarget - Player[E].ScorePercent; + if I > 0 then Inc(Player[E].ScorePercent) + else if I < 0 then Dec(Player[E].ScorePercent); + end; //for + end; //if + + if PlayersPlay = 1 then begin + SingDrawSingbar(Theme.Sing.StaticP1SingBar.x, Theme.Sing.StaticP1SingBar.y, Theme.Sing.StaticP1SingBar.w, Theme.Sing.StaticP1SingBar.h , Player[0].ScorePercent); + end; + + if PlayersPlay = 2 then begin + SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); + end; + + if PlayersPlay = 3 then begin + SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); + end; + if ScreenAct = 2 then begin + SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[2].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[3].ScorePercent); + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); + end; + if ScreenAct = 2 then begin + SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[3].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[4].ScorePercent); + SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[5].ScorePercent); + end; + end; + end; + //end Singbar Mod + + //PhrasenBonus - Line Bonus Mod + if Ini.LineBonus > 0 then begin + A := GetTickCount div 33; + if (A <> Tickold2) AND (Player[0].LineBonus_Visible) then begin + Tickold2 := A; + for E := 0 to (PlayersPlay - 1) do begin + //Change Alpha + Player[E].LineBonus_Alpha := Player[E].LineBonus_Alpha - 0.02; + if Player[E].LineBonus_Alpha <= 0 then + begin + Player[E].LineBonus_Age := 0; + Player[E].LineBonus_Visible := False + end + else + begin + inc(Player[E].LineBonus_Age, 1); + //Change Position + if (Player[E].LineBonus_PosX < Player[E].LineBonus_TargetX) then + Player[E].LineBonus_PosX := Player[E].LineBonus_PosX + (2 - Player[E].LineBonus_Alpha * 1.5) + else if (Player[E].LineBonus_PosX > Player[E].LineBonus_TargetX) then + Player[E].LineBonus_PosX := Player[E].LineBonus_PosX - (2 - Player[E].LineBonus_Alpha * 1.5); + + if (Player[E].LineBonus_PosY < Player[E].LineBonus_TargetY) then + Player[E].LineBonus_PosY := Player[E].LineBonus_PosY + (2 - Player[E].LineBonus_Alpha * 1.5) + else if (Player[E].LineBonus_PosY > Player[E].LineBonus_TargetY) then + Player[E].LineBonus_PosY := Player[E].LineBonus_PosY - (2 - Player[E].LineBonus_Alpha * 1.5); + + end; // shift position of the pop up (if not dead) + end; // loop - for all players + end; // if - linebonus + + + if PlayersPlay = 1 then begin + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + end + + else if PlayersPlay = 2 then begin + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); + end + + else if PlayersPlay = 3 then begin + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); + end + + else if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); + end; + if ScreenAct = 2 then begin + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); + SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); + end; + if ScreenAct = 2 then begin + SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); + SingDrawLineBonus( Player[4].LineBonus_PosX, Player[4].LineBonus_PosY, Player[4].LineBonus_Color, Player[4].LineBonus_Alpha, Player[4].LineBonus_Text, Player[4].LineBonus_Age); + SingDrawLineBonus( Player[5].LineBonus_PosX, Player[5].LineBonus_PosY, Player[5].LineBonus_Color, Player[5].LineBonus_Alpha, Player[5].LineBonus_Text, Player[5].LineBonus_Age); + end; + end; + end; + //PhrasenBonus - Line Bonus Mod End + +// Set the note heights according to the difficulty level + case Ini.Difficulty of + 0: + begin + NotesH := 11; // 9 + NotesW := 6; // 5 + end; + 1: + begin + NotesH := 8; // 7 + NotesW := 4; // 4 + end; + 2: + begin + NotesH := 5; + NotesW := 3; + end; + end; + +// Draw the Notes + if PlayersPlay = 1 then begin + SingDrawPlayerBGCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 0, 15); // Background glow - colorized in playercolor + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); // Plain unsung notes - colorized in playercolor + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 0, 15); // imho the sung notes + end; + + if (PlayersPlay = 2) then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); + + SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 1, 15); + + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); + end; + + if PlayersPlay = 3 then begin + NotesW := NotesW * 0.8; + NotesH := NotesH * 0.8; + + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); + + SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); + SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 1, 12); + SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 2, 12); + + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); + end; + if ScreenAct = 2 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 2, 15); + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 3, 15); + end; + + if ScreenAct = 1 then begin + SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 1, 15); + end; + if ScreenAct = 2 then begin + SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 2, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 3, 15); + end; + + if ScreenAct = 1 then begin + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); + end; + if ScreenAct = 2 then begin + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 2, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 3, 15); + end; + end; + + if PlayersPlay = 6 then begin + NotesW := NotesW * 0.8; + NotesH := NotesH * 0.8; + + if ScreenAct = 1 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); + end; + if ScreenAct = 2 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 3, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 4, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 5, 12); + end; + + if ScreenAct = 1 then begin + SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); + SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 1, 12); + SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 2, 12); + end; + if ScreenAct = 2 then begin + SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 3, 12); + SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 4, 12); + SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 5, 12); + end; + + if ScreenAct = 1 then begin + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); + end; + if ScreenAct = 2 then begin + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 3, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 4, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 5, 12); + end; + end; + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); +end; + +// q'n'd for using the game mode dll's +procedure SingModiDraw (PlayerInfo: TPlayerInfo); +var + Pet: integer; + Pet2: integer; + TempR: real; + Rec: TRecR; + TexRec: TRecR; + NR: TRecR; + FS: real; + BarFrom: integer; + BarAlpha: real; + BarWspol: real; + TempCol: real; + Tekst: string; + LyricTemp: string; + PetCz: integer; + + //SingBar Mod + A: Integer; + E: Integer; + I: Integer; + //end Singbar Mod + +begin + // positions + if Ini.SingWindow = 0 then begin + NR.Left := 120; + end else begin + NR.Left := 20; + end; + + NR.Right := 780; + NR.Width := NR.Right - NR.Left; + NR.WMid := NR.Width / 2; + NR.Mid := NR.Left + NR.WMid; + + // time bar + SingDrawTimeBar(); + + if DLLMan.Selected.ShowNotes then + begin + if PlayersPlay = 1 then + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); + if (PlayersPlay = 2) or (PlayersPlay = 4) then begin + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P1_NotesB - 105, Nr.Right + 10*ScreenX, 15); + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); + end; + + if (PlayersPlay = 3) or (PlayersPlay = 6) then begin + SingDrawNoteLines(Nr.Left + 10*ScreenX, 120, Nr.Right + 10*ScreenX, 12); + SingDrawNoteLines(Nr.Left + 10*ScreenX, 245, Nr.Right + 10*ScreenX, 12); + SingDrawNoteLines(Nr.Left + 10*ScreenX, 370, Nr.Right + 10*ScreenX, 12); + end; + end; + + // Draw Lyrics + ScreenSingModi.Lyrics.Draw(Czas.MidBeat); + + // todo: Lyrics +{ // rysuje pasek, podpowiadajacy poczatek spiwania w scenie + FS := 1.3; + BarFrom := Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start; + if BarFrom > 40 then BarFrom := 40; + if (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start > 8) and // dluga przerwa //16->12 for more help bars and then 12->8 for even more + (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat > 0) and // przed tekstem + (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat < 40) then begin // ale nie za wczesnie + BarWspol := (Czas.MidBeat - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - BarFrom)) / BarFrom; + Rec.Left := NR.Left + BarWspol * (ScreenSingModi.LyricMain.ClientX - NR.Left - 50) + 10*ScreenX; + Rec.Right := Rec.Left + 50; + Rec.Top := Skin_LyricsT + 3; + Rec.Bottom := Rec.Top + 33;//SingScreen.LyricMain.Size * 3; + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_Lyric_Help_Bar.TexNum); + glBegin(GL_QUADS); + glColor4f(1, 1, 1, 0); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glColor4f(1, 1, 1, 0.5); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + glDisable(GL_BLEND); + end; + } + + // oscilloscope | the thing that moves when you yell into your mic (imho) + if (((Ini.Oscilloscope = 1) AND (DLLMan.Selected.ShowRateBar_O)) AND (NOT DLLMan.Selected.ShowRateBar)) then begin + if PlayersPlay = 1 then + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + + if PlayersPlay = 2 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + if ScreenAct = 2 then begin + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 2); + if PlayerInfo.Playerinfo[3].Enabled then + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 3); + end; + end; + + if PlayersPlay = 3 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawOscilloscope(75 + 10*ScreenX, 95, 100, 20, 0); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 0); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + if ScreenAct = 2 then begin + if PlayerInfo.Playerinfo[3].Enabled then + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 3); + if PlayerInfo.Playerinfo[4].Enabled then + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 4); + if PlayerInfo.Playerinfo[5].Enabled then + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 5); + end; + end; + + end + + //SingBar Mod + // seems like we don't want the flicker thing, we want the linebonus rating bar beneath the scores + else if ((Ini.Oscilloscope = 2) AND (DLLMan.Selected.ShowRateBar_O)) OR (DLLMan.Selected.ShowRateBar) then begin + A := GetTickCount div 33; + if A <> Tickold then begin + Tickold := A; + for E := 0 to (PlayersPlay - 1) do begin //Set new Pos + Alpha + I := Player[E].ScorePercentTarget - Player[E].ScorePercent; + if I > 0 then Inc(Player[E].ScorePercent) + else if I < 0 then Dec(Player[E].ScorePercent); + end; //for + end; //if + + if PlayersPlay = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawSingbar(Theme.Sing.StaticP1SingBar.x, Theme.Sing.StaticP1SingBar.y, Theme.Sing.StaticP1SingBar.w, Theme.Sing.StaticP1SingBar.h , Player[0].ScorePercent); + end; + + if PlayersPlay = 2 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); + end; + + if PlayersPlay = 3 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); + end; + if ScreenAct = 2 then begin + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[2].ScorePercent); + if PlayerInfo.Playerinfo[3].Enabled then + SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[3].ScorePercent); + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); + end; + if ScreenAct = 2 then begin + if PlayerInfo.Playerinfo[3].Enabled then + SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[3].ScorePercent); + if PlayerInfo.Playerinfo[4].Enabled then + SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[4].ScorePercent); + if PlayerInfo.Playerinfo[5].Enabled then + SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[5].ScorePercent); + end; + end; + end; + //end Singbar Mod + + //PhrasenBonus - Line Bonus Mod + if ((Ini.LineBonus > 0) AND (DLLMan.Selected.EnLineBonus_O)) OR (DLLMan.Selected.EnLineBonus) then begin + A := GetTickCount div 33; + if (A <> Tickold2) AND (Player[0].LineBonus_Visible) then begin + Tickold2 := A; + for E := 0 to (PlayersPlay - 1) do begin + //Change Alpha + Player[E].LineBonus_Alpha := Player[E].LineBonus_Alpha - 0.02; + + if Player[E].LineBonus_Alpha <= 0 then + begin + Player[E].LineBonus_Age := 0; + Player[E].LineBonus_Visible := False + end + else + begin + inc(Player[E].LineBonus_Age, 1); + //Change Position + if (Player[E].LineBonus_PosX < Player[E].LineBonus_TargetX) then // pop up has not yet reached it's position -> blend in + Player[E].LineBonus_PosX := Player[E].LineBonus_PosX + (2 - Player[E].LineBonus_Alpha * 1.5) + else if (Player[E].LineBonus_PosX > Player[E].LineBonus_TargetX) then // pop up has reached it's position -> blend out + Player[E].LineBonus_PosX := Player[E].LineBonus_PosX - (2 - Player[E].LineBonus_Alpha * 1.5); + + if (Player[E].LineBonus_PosY < Player[E].LineBonus_TargetY) then + Player[E].LineBonus_PosY := Player[E].LineBonus_PosY + (2 - Player[E].LineBonus_Alpha * 1.5) + else if (Player[E].LineBonus_PosY > Player[E].LineBonus_TargetY) then + Player[E].LineBonus_PosY := Player[E].LineBonus_PosY - (2 - Player[E].LineBonus_Alpha * 1.5); + + end; // pop up still visible, has not reached it's position - move it + end; // loop through all players + end; // if it's time to draw them + + if PlayersPlay = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + end + + else if PlayersPlay = 2 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); + end + + else if PlayersPlay = 3 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); + end + + else if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); + end; + if ScreenAct = 2 then begin + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); + if PlayerInfo.Playerinfo[3].Enabled then + SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); + end; + if ScreenAct = 2 then begin + if PlayerInfo.Playerinfo[3].Enabled then + SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); + if PlayerInfo.Playerinfo[4].Enabled then + SingDrawLineBonus( Player[4].LineBonus_PosX, Player[4].LineBonus_PosY, Player[4].LineBonus_Color, Player[4].LineBonus_Alpha, Player[4].LineBonus_Text, Player[4].LineBonus_Age); + if PlayerInfo.Playerinfo[5].Enabled then + SingDrawLineBonus( Player[5].LineBonus_PosX, Player[5].LineBonus_PosY, Player[5].LineBonus_Color, Player[5].LineBonus_Alpha, Player[5].LineBonus_Text, Player[5].LineBonus_Age); + end; + end; + end; +//PhrasenBonus - Line Bonus Mod End + +// resize the notes according to the difficulty level + case Ini.Difficulty of + 0: + begin + NotesH := 11; // 9 + NotesW := 6; // 5 + end; + 1: + begin + NotesH := 8; // 7 + NotesW := 4; // 4 + end; + 2: + begin + NotesH := 5; + NotesW := 3; + end; + end; + + if (DLLMAn.Selected.ShowNotes And DLLMan.Selected.LoadSong) then + begin + if (PlayersPlay = 1) And PlayerInfo.Playerinfo[0].Enabled then begin + SingDrawPlayerBGCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 0, 15); + end; + + if (PlayersPlay = 2) then begin + if PlayerInfo.Playerinfo[0].Enabled then + begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); + end; + if PlayerInfo.Playerinfo[1].Enabled then + begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); + end; + + end; + + if PlayersPlay = 3 then begin + NotesW := NotesW * 0.8; + NotesH := NotesH * 0.8; + + if PlayerInfo.Playerinfo[0].Enabled then + begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); + SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); + end; + + if PlayerInfo.Playerinfo[1].Enabled then + begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); + SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); + end; + + if PlayerInfo.Playerinfo[2].Enabled then + begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); + SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); + end; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); + end; + if ScreenAct = 2 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 2, 15); + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 3, 15); + end; + + SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); + + if ScreenAct = 1 then begin + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); + end; + if ScreenAct = 2 then begin + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 2, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 3, 15); + end; + end; + + if PlayersPlay = 6 then begin + NotesW := NotesW * 0.8; + NotesH := NotesH * 0.8; + + if ScreenAct = 1 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); + end; + if ScreenAct = 2 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 3, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 4, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 5, 12); + end; + + SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); + SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 0, 12); + SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 0, 12); + + if ScreenAct = 1 then begin + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); + end; + if ScreenAct = 2 then begin + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 3, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 4, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 5, 12); + end; + end; + end; + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); +end; + + +//SingBar Mod +procedure SingDrawSingbar(X, Y, W, H: real; Percent: integer); +var + R: Real; + G: Real; + B: Real; + A: cardinal; + I: Integer; + +begin; + + //SingBar Background + glColor4f(1, 1, 1, 0.8); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Back.TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(X, Y); + glTexCoord2f(0, 1); glVertex2f(X, Y+H); + glTexCoord2f(1, 1); glVertex2f(X+W, Y+H); + glTexCoord2f(1, 0); glVertex2f(X+W, Y); + glEnd; + + //SingBar coloured Bar + Case Percent of + 0..22: begin + R := 1; + G := 0; + B := 0; + end; + 23..42: begin + R := 1; + G := ((Percent-23)/100)*5; + B := 0; + end; + 43..57: begin + R := 1; + G := 1; + B := 0; + end; + 58..77: begin + R := 1-(Percent - 58)/100*5; + G := 1; + B := 0; + end; + 78..99: begin + R := 0; + G := 1; + B := 0; + end; + End; //Case + + glColor4f(R, G, B, 1); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Bar.TexNum); + //Size= Player[PlayerNum].ScorePercent of W + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(X, Y); + glTexCoord2f(0, 1); glVertex2f(X, Y+H); + glTexCoord2f(1, 1); glVertex2f(X+(W/100 * (Percent +1)), Y+H); + glTexCoord2f(1, 0); glVertex2f(X+(W/100 * (Percent +1)), Y); + glEnd; + + //SingBar Front + glColor4f(1, 1, 1, 0.6); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Front.TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(X, Y); + glTexCoord2f(0, 1); glVertex2f(X, Y+H); + glTexCoord2f(1, 1); glVertex2f(X+W, Y+H); + glTexCoord2f(1, 0); glVertex2f(X+W, Y); + glEnd; +end; +//end Singbar Mod + +//PhrasenBonus - Line Bonus Pop Up +procedure SingDrawLineBonus( const X, Y: Single; Color: TRGB; Alpha: Single; Text: string; Age: Integer); +var +Length, X2: Real; //Length of Text +Size: Integer; //Size of Popup +begin +if Alpha <> 0 then +begin + +//Set Font Propertys +SetFontStyle(2); //Font: Outlined1 +if Age < 5 then SetFontSize(Age + 1) else SetFontSize(6); +SetFontItalic(False); + +//Check Font Size +Length := glTextWidth ( PChar(Text)) + 3; //Little Space for a Better Look ^^ + +//Text +SetFontPos (X + 50 - (Length / 2), Y + 12); //Position + + +if Age < 5 then Size := Age * 10 else Size := 50; + + //Draw Background + //glColor4f(Color.R, Color.G, Color.B, Alpha); //Set Color + glColor4f(1, 1, 1, Alpha); + + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + + //New Method, Not Variable + glBindTexture(GL_TEXTURE_2D, Tex_SingLineBonusBack[2].TexNum); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(X + 50 - Size, Y + 25 - (Size/2)); + glTexCoord2f(0, 1); glVertex2f(X + 50 - Size, Y + 25 + (Size/2)); + glTexCoord2f(1, 1); glVertex2f(X + 50 + Size, Y + 25 + (Size/2)); + glTexCoord2f(1, 0); glVertex2f(X + 50 + Size, Y + 25 - (Size/2)); + glEnd; + + glColor4f(1, 1, 1, Alpha); //Set Color + //Draw Text + glPrint (PChar(Text)); +end; +end; +//PhrasenBonus - Line Bonus Mod + +// Draw Note Bars for Editor +//There are 11 Resons for a new Procdedure: +// 1. It don't look good when you Draw the Golden Note Star Effect in the Editor +// 2. You can see the Freestyle Notes in the Editor SemiTransparent +// 3. Its easier and Faster then changing the old Procedure +procedure EditDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); +var + Rec: TRecR; + Pet: integer; + TempR: real; +begin + glColor3f(1, 1, 1); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); + with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin + for Pet := 0 to HighNut do begin + with Nuta[Pet] do begin + + // Golden Note Patch + case Wartosc of + 0: glColor4f(1, 1, 1, 0.35); + 1: glColor4f(1, 1, 1, 0.85); + 2: glColor4f(1, 1, 0.3, 0.85); + end; // case + + + + // lewa czesc - left part + Rec.Left := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX; + Rec.Right := Rec.Left + NotesW; + Rec.Top := Top - (Ton-BaseNote)*Space/2 - NotesH; + Rec.Bottom := Rec.Top + 2 * NotesH; + glBindTexture(GL_TEXTURE_2D, Tex_Left[Color].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // srodkowa czesc - middle part + Rec.Left := Rec.Right; + Rec.Right := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - NotesW - 0.5 + 10*ScreenX; + + glBindTexture(GL_TEXTURE_2D, Tex_Mid[Color].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // prawa czesc - right part + Rec.Left := Rec.Right; + Rec.Right := Rec.Right + NotesW; + + glBindTexture(GL_TEXTURE_2D, Tex_Right[Color].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + end; // with + end; // for + end; // with + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); +end; + +procedure SingDrawTimeBar(); +var x,y: real; + width, height: real; +begin + x := Theme.Sing.StaticTimeProgress.x; + y := Theme.Sing.StaticTimeProgress.y; + width:= Theme.Sing.StaticTimeProgress.w; + height:= Theme.Sing.StaticTimeProgress.h; + + glColor4f(Theme.Sing.StaticTimeProgress.ColR, + Theme.Sing.StaticTimeProgress.ColG, + Theme.Sing.StaticTimeProgress.ColB, 1); //Set Color + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + + glBindTexture(GL_TEXTURE_2D, Tex_TimeProgress.TexNum); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(x,y); + glTexCoord2f((width*(Czas.Teraz/Czas.Razem))/8, 0); glVertex2f(x+width*(Czas.Teraz/Czas.Razem), y); + glTexCoord2f((width*(Czas.Teraz/Czas.Razem))/8, 1); glVertex2f(x+width*(Czas.Teraz/Czas.Razem), y+height); + 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/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index aaa4b3d7..09bbc1c9 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -1,611 +1,611 @@ -unit UGraphic; - -interface - -{$I switches.inc} - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -uses - SDL, - OpenGL12, - UTexture, - TextGL, - ULog, - SysUtils, - ULyrics, - UScreenLoading, - UScreenWelcome, - UScreenMain, - UScreenName, - UScreenLevel, - UScreenOptions, - UScreenOptionsGame, - UScreenOptionsGraphics, - UScreenOptionsSound, - UScreenOptionsLyrics, - UScreenOptionsThemes, - UScreenOptionsRecord, - UScreenOptionsAdvanced, - UScreenSong, - UScreenSing, - UScreenScore, - UScreenTop5, - UScreenEditSub, - UScreenEdit, - UScreenEditConvert, - UScreenEditHeader, - UScreenOpen, - UThemes, - USkins, - UScreenSongMenu, - UScreenSongJumpto, - {Party Screens} - UScreenSingModi, - UScreenPartyNewRound, - UScreenPartyScore, - UScreenPartyOptions, - UScreenPartyWin, - UScreenPartyPlayer, - {Stats Screens} - UScreenStatMain, - UScreenStatDetail, - {CreditsScreen} - UScreenCredits, - {Popup for errors, etc.} - UScreenPopup; - -type - TRecR = record - Top: real; - Left: real; - Right: real; - Bottom: real; - end; - -var - Screen: PSDL_Surface; - - LoadingThread: PSDL_Thread; - Mutex: PSDL_Mutex; - - RenderW: integer; - RenderH: integer; - ScreenW: integer; - ScreenH: integer; - Screens: integer; - ScreenAct: integer; - ScreenX: integer; - - ScreenLoading: TScreenLoading; - ScreenWelcome: TScreenWelcome; - ScreenMain: TScreenMain; - ScreenName: TScreenName; - ScreenLevel: TScreenLevel; - ScreenSong: TScreenSong; - ScreenSing: TScreenSing; - ScreenScore: TScreenScore; - ScreenTop5: TScreenTop5; - ScreenOptions: TScreenOptions; - ScreenOptionsGame: TScreenOptionsGame; - ScreenOptionsGraphics: TScreenOptionsGraphics; - ScreenOptionsSound: TScreenOptionsSound; - ScreenOptionsLyrics: TScreenOptionsLyrics; - ScreenOptionsThemes: TScreenOptionsThemes; - ScreenOptionsRecord: TScreenOptionsRecord; - ScreenOptionsAdvanced: TScreenOptionsAdvanced; - ScreenEditSub: TScreenEditSub; - ScreenEdit: TScreenEdit; - ScreenEditConvert: TScreenEditConvert; - ScreenEditHeader: TScreenEditHeader; - ScreenOpen: TScreenOpen; - - ScreenSongMenu: TScreenSongMenu; - ScreenSongJumpto: TScreenSongJumpto; - - //Party Screens - ScreenSingModi: TScreenSingModi; - ScreenPartyNewRound: TScreenPartyNewRound; - ScreenPartyScore: TScreenPartyScore; - ScreenPartyWin: TScreenPartyWin; - ScreenPartyOptions: TScreenPartyOptions; - ScreenPartyPlayer: TScreenPartyPlayer; - - //StatsScreens - ScreenStatMain: TScreenStatMain; - ScreenStatDetail: TScreenStatDetail; - - //CreditsScreen - ScreenCredits: TScreenCredits; - - //popup mod - ScreenPopupCheck: TScreenPopupCheck; - ScreenPopupError: TScreenPopupError; - - //Notes - Tex_Left: array[0..6] of TTexture; //rename to tex_note_left - Tex_Mid: array[0..6] of TTexture; //rename to tex_note_mid - Tex_Right: array[0..6] of TTexture; //rename to tex_note_right - - Tex_plain_Left: array[1..6] of TTexture; //rename to tex_notebg_left - Tex_plain_Mid: array[1..6] of TTexture; //rename to tex_notebg_mid - Tex_plain_Right: array[1..6] of TTexture; //rename to tex_notebg_right - - Tex_BG_Left: array[1..6] of TTexture; //rename to tex_noteglow_left - Tex_BG_Mid: array[1..6] of TTexture; //rename to tex_noteglow_mid - Tex_BG_Right: array[1..6] of TTexture; //rename to tex_noteglow_right - - Tex_Note_Star: TTexture; - Tex_Note_Perfect_Star: TTexture; - - - Tex_Ball: TTexture; - Tex_Lyric_Help_Bar: TTexture; - FullScreen: boolean; - - Tex_TimeProgress: TTexture; - - //Sing Bar Mod - Tex_SingBar_Back: TTexture; - Tex_SingBar_Bar: TTexture; - Tex_SingBar_Front: TTexture; - //end Singbar Mod - - //PhrasenBonus - Line Bonus Mod - Tex_SingLineBonusBack: array[0..8] of TTexture; - //End PhrasenBonus - Line Bonus Mod - -const - Skin_BGColorR = 1; - Skin_BGColorG = 1; - Skin_BGColorB = 1; - - Skin_SpectrumR = 0; - Skin_SpectrumG = 0; - Skin_SpectrumB = 0; - - Skin_Spectograph1R = 0.6; - Skin_Spectograph1G = 0.8; - Skin_Spectograph1B = 1; - - Skin_Spectograph2R = 0; - Skin_Spectograph2G = 0; - Skin_Spectograph2B = 0.2; - - Skin_SzczytR = 0.8; - Skin_SzczytG = 0; - Skin_SzczytB = 0; - - Skin_SzczytLimitR = 0; - Skin_SzczytLimitG = 0.8; - Skin_SzczytLimitB = 0; - - Skin_FontR = 0; - Skin_FontG = 0; - Skin_FontB = 0; - - Skin_FontHighlightR = 0.3; // 0.3 - Skin_FontHighlightG = 0.3; // 0.3 - Skin_FontHighlightB = 1; // 1 - - Skin_TimeR = 0.25; //0,0,0 - Skin_TimeG = 0.25; - Skin_TimeB = 0.25; - - Skin_OscR = 0; - Skin_OscG = 0; - Skin_OscB = 0; - - Skin_LyricsT = 494; // 500 / 510 / 400 - Skin_SpectrumT = 470; - Skin_SpectrumBot = 570; - Skin_SpectrumH = 100; - - Skin_P1_LinesR = 0.5; // 0.6 0.6 1 - Skin_P1_LinesG = 0.5; - Skin_P1_LinesB = 0.5; - - Skin_P2_LinesR = 0.5; // 1 0.6 0.6 - Skin_P2_LinesG = 0.5; - Skin_P2_LinesB = 0.5; - - Skin_P1_NotesB = 250; - Skin_P2_NotesB = 430; // 430 / 300 - - Skin_P1_ScoreT = 50; - Skin_P1_ScoreL = 20; - - Skin_P2_ScoreT = 50; - Skin_P2_ScoreL = 640; - -procedure Initialize3D (Title: string); -procedure Reinitialize3D; -procedure SwapBuffers; - -procedure LoadTextures; -procedure InitializeScreen; -procedure LoadLoadingScreen; -procedure LoadScreens; - -function LoadingThreadFunction: integer; - - -implementation - -uses UMain, - UIni, - UDisplay, - UCommandLine, - {$IFNDEF FPC} - Graphics, - {$ENDIF} - {$IFDEF win32} - windows, - {$ENDIF} - Classes; - -procedure LoadTextures; - - -var - P: integer; - R, G, B: real; - Col: integer; -begin - // zaladowanie tekstur - Log.LogStatus('Loading Textures', 'LoadTextures'); - Tex_Left[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'BMP', 'Transparent', 0); //brauch man die noch? - Tex_Mid[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'BMP', 'Plain', 0); //brauch man die noch? - Tex_Right[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'BMP', 'Transparent', 0); //brauch man die noch? - - // P1-6 - for P := 1 to 6 do begin - LoadColor(R, G, B, 'P' + IntToStr(P) + 'Light'); - Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); - Tex_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'PNG', 'Colorized', Col); - Tex_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'PNG', 'Colorized', Col); - Tex_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'PNG', 'Colorized', Col); - - Tex_plain_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainLeft')), 'PNG', 'Colorized', Col); - Tex_plain_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainMid')), 'PNG', 'Colorized', Col); - Tex_plain_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainRight')), 'PNG', 'Colorized', Col); - - Tex_BG_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGLeft')), 'PNG', 'Colorized', Col); - Tex_BG_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGMid')), 'PNG', 'Colorized', Col); - Tex_BG_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGRight')), 'PNG', 'Colorized', Col); - end; - - Tex_Note_Perfect_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePerfectStar')), 'JPG', 'Font Black', 0); - Tex_Note_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteStar')) , 'JPG', 'Alpha Black Colored', $FFFFFF); - Tex_Ball := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'BMP', 'Transparent', $FF00FF); - Tex_Lyric_Help_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricHelpBar')), 'BMP', 'Transparent', $FF00FF); - - - //TimeBar mod - Tex_TimeProgress := Texture.LoadTexture(pchar(Skin.GetTextureFileName('TimeBar'))); - //eoa TimeBar mod - - //SingBar Mod - Tex_SingBar_Back := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBack')), 'JPG', 'Plain', 0); - Tex_SingBar_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBar')), 'JPG', 'Plain', 0); - Tex_SingBar_Front := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarFront')), 'JPG', 'Font', 0); - //end Singbar Mod - - //Line Bonus PopUp - for P := 0 to 8 do - begin - Tex_SingLineBonusBack[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LineBonusBack')), 'PNG', 'Colorized', $FFFFFF); - end; - {//Set Texture to Font High - Tex_SingLineBonusL.H := 32; Tex_SingLineBonusL.W := 8; - Tex_SingLineBonusM.H := 32; //Tex_SingLineBonusM.TexW := Tex_SingLineBonusM.TexW/2; - Tex_SingLineBonusR.H := 32; Tex_SingLineBonusR.W := 8; } - //PhrasenBonus - Line Bonus Mod End - - // tworzenie czcionek - Log.LogStatus('Building Fonts', 'LoadTextures'); - BuildFont; -end; - -procedure Initialize3D (Title: string); -var -// Icon: TIcon; - Res: TResourceStream; - ISurface: PSDL_Surface; - Pixel: PByteArray; - I: Integer; -begin - Log.LogStatus('LoadOpenGL', 'Initialize3D'); - Log.BenchmarkStart(2); - - LoadOpenGL; - - Log.LogStatus('SDL_Init', 'Initialize3D'); - if ( SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO)= -1 ) then begin - Log.LogError('SDL_Init Failed', 'Initialize3D'); - exit; - end; - - { //Load Icon - Res := TResourceStream.CreateFromID(HInstance, 3, RT_ICON); - Icon := TIcon.Create; - Icon.LoadFromStream(Res); - Res.Free; - Icon. - //Create icon Surface - SDL_CreateRGBSurfaceFrom ( - SDL_SWSURFACE, - Icon.Width, - Icon.Height, - 32, - 128 or 64, - 32 or 16, - 8 or 4, - 2 or 1); - //SDL_BlitSurface( - - - SDL_WM_SetIcon(SDL_LoadBMP('DEFAULT_WINDOW_ICON'), 0); //} - - SDL_WM_SetCaption(PChar(Title), nil); - - InitializeScreen; - - Log.BenchmarkEnd(2); - Log.LogBenchmark('--> Setting Screen', 2); - - // ladowanie tekstur - Log.BenchmarkStart(2); - Texture := TTextureUnit.Create; - Texture.Limit := 1024*1024; - - LoadTextures; - Log.BenchmarkEnd(2); - Log.LogBenchmark('--> Loading Textures', 2); - - Log.BenchmarkStart(2); - Lyric := TLyric.Create; - Log.BenchmarkEnd(2); - Log.LogBenchmark('--> Loading Fonts', 2); - - Log.BenchmarkStart(2); - Display := TDisplay.Create; - SDL_EnableUnicode(1); - Log.BenchmarkEnd(2); Log.LogBenchmark('====> Creating Display', 2); - - Log.LogStatus('Loading Screens', 'Initialize3D'); - Log.BenchmarkStart(3); - - LoadLoadingScreen; - // now that we have something to display while loading, - // start thread that loads the rest of ultrastar -// Mutex := SDL_CreateMutex; -// SDL_UnLockMutex(Mutex); - - // funktioniert so noch nicht, da der ladethread unverändert auf opengl zugreifen will - // siehe dazu kommentar unten - //LoadingThread := SDL_CreateThread(@LoadingThread, nil); - - // das hier würde dann im ladethread ausgeführt - LoadScreens; - - - // TODO!!!!!!1 - // hier käme jetzt eine schleife, die - // * den ladescreen malt (ab und zu) - // * den "fortschritt" des ladescreens steuert - // * zwischendrin schaut, ob der ladethread texturen geladen hat (mutex prüfen) und - // * die texturen in die opengl lädt, sowie - // * dem ladethread signalisiert, dass der speicher für die textur - // zum laden der nächsten textur weiterverwendet werden kann (über weiteren mutex) - // * über einen 3. mutex so lange läuft, bis der ladethread signalisiert, - // dass er alles geladen hat fertig ist - // - // dafür muss loadtexture so umgeschrieben werden, dass es, statt selbst irgendwelche - // opengl funktionen aufzurufen, entsprechend mutexe verändert - // der hauptthread muss auch irgendwoher erfahren, was an opengl funktionen auszuführen ist, - // mit welchen parametern (texturtyp, entspr. texturobjekt, textur-zwischenspeicher-adresse, ... - - - //wait for loading thread to finish - // funktioniert so auch noch nicht - //SDL_WaitThread(LoadingThread, I); -// SDL_DestroyMutex(Mutex); - - Display.ActualScreen^.FadeTo(@ScreenMain); - - Log.BenchmarkEnd(2); - Log.LogBenchmark('--> Loading Screens', 2); - - Log.LogStatus('Finish', 'Initialize3D'); -end; - -procedure SwapBuffers; -begin - SDL_GL_SwapBuffers; - glMatrixMode(GL_PROJECTION); - glLoadIdentity; - glOrtho(0, RenderW, RenderH, 0, -1, 100); - glMatrixMode(GL_MODELVIEW); -end; - -procedure Reinitialize3D; -begin -// InitializeScreen; -// LoadTextures; -// LoadScreens; -end; - -procedure InitializeScreen; -var - S: string; - I: integer; - W, H: integer; - Depth: Integer; -begin - if (Params.Screens <> -1) then - Screens := Params.Screens + 1 - else - Screens := Ini.Screens + 1; - - SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - - // If there is a resolution in Parameters, use it, else use the Ini value - I := Params.Resolution; - if (I <> -1) then - S := IResolution[I] - else - S := IResolution[Ini.Resolution]; - - I := Pos('x', S); - W := StrToInt(Copy(S, 1, I-1)) * Screens; - H := StrToInt(Copy(S, I+1, 1000)); - - {if ParamStr(1) = '-fsblack' then begin - W := 800; - H := 600; - end; - if ParamStr(1) = '-320x240' then begin - W := 320; - H := 240; - end; } - - If (Params.Depth <> -1) then - Depth := Params.Depth - else - Depth := Ini.Depth; - - - Log.LogStatus('SDL_SetVideoMode', 'Initialize3D'); -// SDL_SetRefreshrate(85); -// SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); - if (Ini.FullScreen = 0) and (Not Params.FullScreen) then - screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL) - else begin - screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN); - SDL_ShowCursor(0); - end; - if (screen = nil) then begin - Log.LogError('SDL_SetVideoMode Failed', 'Initialize3D'); - exit; - end; - - // clear screen once window is being shown - glClearColor(1, 1, 1, 1); - glClear(GL_COLOR_BUFFER_BIT); - SwapBuffers; - - // zmienne - RenderW := 800; - RenderH := 600; - ScreenW := W; - ScreenH := H; -end; - -procedure LoadLoadingScreen; -begin - ScreenLoading := TScreenLoading.Create; - ScreenLoading.onShow; - Display.ActualScreen := @ScreenLoading; - swapbuffers; - ScreenLoading.Draw; - Display.Draw; - SwapBuffers; -end; - -procedure LoadScreens; -begin -{ ScreenLoading := TScreenLoading.Create; - ScreenLoading.onShow; - Display.ActualScreen := @ScreenLoading; - ScreenLoading.Draw; - Display.Draw; - SwapBuffers; -} - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Loading', 3); Log.BenchmarkStart(3); -{ ScreenWelcome := TScreenWelcome.Create; //'BG', 4, 3); - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Welcome', 3); Log.BenchmarkStart(3);} - ScreenMain := TScreenMain.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Main', 3); Log.BenchmarkStart(3); - ScreenName := TScreenName.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Name', 3); Log.BenchmarkStart(3); - ScreenLevel := TScreenLevel.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Level', 3); Log.BenchmarkStart(3); - ScreenSong := TScreenSong.Create; - 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); - ScreenSing := TScreenSing.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing', 3); Log.BenchmarkStart(3); - ScreenScore := TScreenScore.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Score', 3); Log.BenchmarkStart(3); - ScreenTop5 := TScreenTop5.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Top5', 3); Log.BenchmarkStart(3); - ScreenOptions := TScreenOptions.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options', 3); Log.BenchmarkStart(3); - ScreenOptionsGame := TScreenOptionsGame.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Game', 3); Log.BenchmarkStart(3); - ScreenOptionsGraphics := TScreenOptionsGraphics.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Graphics', 3); Log.BenchmarkStart(3); - ScreenOptionsSound := TScreenOptionsSound.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Sound', 3); Log.BenchmarkStart(3); - ScreenOptionsLyrics := TScreenOptionsLyrics.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Lyrics', 3); Log.BenchmarkStart(3); - ScreenOptionsThemes := TScreenOptionsThemes.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Themes', 3); Log.BenchmarkStart(3); - ScreenOptionsRecord := TScreenOptionsRecord.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Record', 3); Log.BenchmarkStart(3); - ScreenOptionsAdvanced := TScreenOptionsAdvanced.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Advanced', 3); Log.BenchmarkStart(3); - ScreenEditSub := TScreenEditSub.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Sub', 3); Log.BenchmarkStart(3); - ScreenEdit := TScreenEdit.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit', 3); Log.BenchmarkStart(3); - ScreenEditConvert := TScreenEditConvert.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen EditConvert', 3); Log.BenchmarkStart(3); -// ScreenEditHeader := TScreenEditHeader.Create(Skin.ScoreBG); -// Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Header', 3); Log.BenchmarkStart(3); - ScreenOpen := TScreenOpen.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Open', 3); Log.BenchmarkStart(3); - ScreenSingModi := TScreenSingModi.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing with Modi support', 3); Log.BenchmarkStart(3); - ScreenSongMenu := TScreenSongMenu.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongMenu', 3); Log.BenchmarkStart(3); - ScreenSongJumpto := TScreenSongJumpto.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongJumpto', 3); Log.BenchmarkStart(3); - ScreenPopupCheck := TScreenPopupCheck.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Popup (Check)', 3); Log.BenchmarkStart(3); - ScreenPopupError := TScreenPopupError.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Popup (Error)', 3); Log.BenchmarkStart(3); - ScreenPartyNewRound := TScreenPartyNewRound.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyNewRound', 3); Log.BenchmarkStart(3); - ScreenPartyScore := TScreenPartyScore.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyScore', 3); Log.BenchmarkStart(3); - ScreenPartyWin := TScreenPartyWin.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyWin', 3); Log.BenchmarkStart(3); - ScreenPartyOptions := TScreenPartyOptions.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyOptions', 3); Log.BenchmarkStart(3); - ScreenPartyPlayer := TScreenPartyPlayer.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyPlayer', 3); Log.BenchmarkStart(3); - ScreenStatMain := TScreenStatMain.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Main', 3); Log.BenchmarkStart(3); - ScreenStatDetail := TScreenStatDetail.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Detail', 3); Log.BenchmarkStart(3); - ScreenCredits := TScreenCredits.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Credits', 3); Log.BenchmarkStart(3); - - end; - -function LoadingThreadFunction: integer; -begin - LoadScreens; - Result:= 1; -end; - -end. +unit UGraphic; + +interface + +{$I switches.inc} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses + SDL, + OpenGL12, + UTexture, + TextGL, + ULog, + SysUtils, + ULyrics, + UScreenLoading, + UScreenWelcome, + UScreenMain, + UScreenName, + UScreenLevel, + UScreenOptions, + UScreenOptionsGame, + UScreenOptionsGraphics, + UScreenOptionsSound, + UScreenOptionsLyrics, + UScreenOptionsThemes, + UScreenOptionsRecord, + UScreenOptionsAdvanced, + UScreenSong, + UScreenSing, + UScreenScore, + UScreenTop5, + UScreenEditSub, + UScreenEdit, + UScreenEditConvert, + UScreenEditHeader, + UScreenOpen, + UThemes, + USkins, + UScreenSongMenu, + UScreenSongJumpto, + {Party Screens} + UScreenSingModi, + UScreenPartyNewRound, + UScreenPartyScore, + UScreenPartyOptions, + UScreenPartyWin, + UScreenPartyPlayer, + {Stats Screens} + UScreenStatMain, + UScreenStatDetail, + {CreditsScreen} + UScreenCredits, + {Popup for errors, etc.} + UScreenPopup; + +type + TRecR = record + Top: real; + Left: real; + Right: real; + Bottom: real; + end; + +var + Screen: PSDL_Surface; + + LoadingThread: PSDL_Thread; + Mutex: PSDL_Mutex; + + RenderW: integer; + RenderH: integer; + ScreenW: integer; + ScreenH: integer; + Screens: integer; + ScreenAct: integer; + ScreenX: integer; + + ScreenLoading: TScreenLoading; + ScreenWelcome: TScreenWelcome; + ScreenMain: TScreenMain; + ScreenName: TScreenName; + ScreenLevel: TScreenLevel; + ScreenSong: TScreenSong; + ScreenSing: TScreenSing; + ScreenScore: TScreenScore; + ScreenTop5: TScreenTop5; + ScreenOptions: TScreenOptions; + ScreenOptionsGame: TScreenOptionsGame; + ScreenOptionsGraphics: TScreenOptionsGraphics; + ScreenOptionsSound: TScreenOptionsSound; + ScreenOptionsLyrics: TScreenOptionsLyrics; + ScreenOptionsThemes: TScreenOptionsThemes; + ScreenOptionsRecord: TScreenOptionsRecord; + ScreenOptionsAdvanced: TScreenOptionsAdvanced; + ScreenEditSub: TScreenEditSub; + ScreenEdit: TScreenEdit; + ScreenEditConvert: TScreenEditConvert; + ScreenEditHeader: TScreenEditHeader; + ScreenOpen: TScreenOpen; + + ScreenSongMenu: TScreenSongMenu; + ScreenSongJumpto: TScreenSongJumpto; + + //Party Screens + ScreenSingModi: TScreenSingModi; + ScreenPartyNewRound: TScreenPartyNewRound; + ScreenPartyScore: TScreenPartyScore; + ScreenPartyWin: TScreenPartyWin; + ScreenPartyOptions: TScreenPartyOptions; + ScreenPartyPlayer: TScreenPartyPlayer; + + //StatsScreens + ScreenStatMain: TScreenStatMain; + ScreenStatDetail: TScreenStatDetail; + + //CreditsScreen + ScreenCredits: TScreenCredits; + + //popup mod + ScreenPopupCheck: TScreenPopupCheck; + ScreenPopupError: TScreenPopupError; + + //Notes + Tex_Left: array[0..6] of TTexture; //rename to tex_note_left + Tex_Mid: array[0..6] of TTexture; //rename to tex_note_mid + Tex_Right: array[0..6] of TTexture; //rename to tex_note_right + + Tex_plain_Left: array[1..6] of TTexture; //rename to tex_notebg_left + Tex_plain_Mid: array[1..6] of TTexture; //rename to tex_notebg_mid + Tex_plain_Right: array[1..6] of TTexture; //rename to tex_notebg_right + + Tex_BG_Left: array[1..6] of TTexture; //rename to tex_noteglow_left + Tex_BG_Mid: array[1..6] of TTexture; //rename to tex_noteglow_mid + Tex_BG_Right: array[1..6] of TTexture; //rename to tex_noteglow_right + + Tex_Note_Star: TTexture; + Tex_Note_Perfect_Star: TTexture; + + + Tex_Ball: TTexture; + Tex_Lyric_Help_Bar: TTexture; + FullScreen: boolean; + + Tex_TimeProgress: TTexture; + + //Sing Bar Mod + Tex_SingBar_Back: TTexture; + Tex_SingBar_Bar: TTexture; + Tex_SingBar_Front: TTexture; + //end Singbar Mod + + //PhrasenBonus - Line Bonus Mod + Tex_SingLineBonusBack: array[0..8] of TTexture; + //End PhrasenBonus - Line Bonus Mod + +const + Skin_BGColorR = 1; + Skin_BGColorG = 1; + Skin_BGColorB = 1; + + Skin_SpectrumR = 0; + Skin_SpectrumG = 0; + Skin_SpectrumB = 0; + + Skin_Spectograph1R = 0.6; + Skin_Spectograph1G = 0.8; + Skin_Spectograph1B = 1; + + Skin_Spectograph2R = 0; + Skin_Spectograph2G = 0; + Skin_Spectograph2B = 0.2; + + Skin_SzczytR = 0.8; + Skin_SzczytG = 0; + Skin_SzczytB = 0; + + Skin_SzczytLimitR = 0; + Skin_SzczytLimitG = 0.8; + Skin_SzczytLimitB = 0; + + Skin_FontR = 0; + Skin_FontG = 0; + Skin_FontB = 0; + + Skin_FontHighlightR = 0.3; // 0.3 + Skin_FontHighlightG = 0.3; // 0.3 + Skin_FontHighlightB = 1; // 1 + + Skin_TimeR = 0.25; //0,0,0 + Skin_TimeG = 0.25; + Skin_TimeB = 0.25; + + Skin_OscR = 0; + Skin_OscG = 0; + Skin_OscB = 0; + + Skin_LyricsT = 494; // 500 / 510 / 400 + Skin_SpectrumT = 470; + Skin_SpectrumBot = 570; + Skin_SpectrumH = 100; + + Skin_P1_LinesR = 0.5; // 0.6 0.6 1 + Skin_P1_LinesG = 0.5; + Skin_P1_LinesB = 0.5; + + Skin_P2_LinesR = 0.5; // 1 0.6 0.6 + Skin_P2_LinesG = 0.5; + Skin_P2_LinesB = 0.5; + + Skin_P1_NotesB = 250; + Skin_P2_NotesB = 430; // 430 / 300 + + Skin_P1_ScoreT = 50; + Skin_P1_ScoreL = 20; + + Skin_P2_ScoreT = 50; + Skin_P2_ScoreL = 640; + +procedure Initialize3D (Title: string); +procedure Reinitialize3D; +procedure SwapBuffers; + +procedure LoadTextures; +procedure InitializeScreen; +procedure LoadLoadingScreen; +procedure LoadScreens; + +function LoadingThreadFunction: integer; + + +implementation + +uses UMain, + UIni, + UDisplay, + UCommandLine, + {$IFNDEF FPC} + Graphics, + {$ENDIF} + {$IFDEF win32} + windows, + {$ENDIF} + Classes; + +procedure LoadTextures; + + +var + P: integer; + R, G, B: real; + Col: integer; +begin + // zaladowanie tekstur + Log.LogStatus('Loading Textures', 'LoadTextures'); + Tex_Left[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'BMP', 'Transparent', 0); //brauch man die noch? + Tex_Mid[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'BMP', 'Plain', 0); //brauch man die noch? + Tex_Right[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'BMP', 'Transparent', 0); //brauch man die noch? + + // P1-6 + for P := 1 to 6 do begin + LoadColor(R, G, B, 'P' + IntToStr(P) + 'Light'); + Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + Tex_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'PNG', 'Colorized', Col); + Tex_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'PNG', 'Colorized', Col); + Tex_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'PNG', 'Colorized', Col); + + Tex_plain_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainLeft')), 'PNG', 'Colorized', Col); + Tex_plain_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainMid')), 'PNG', 'Colorized', Col); + Tex_plain_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainRight')), 'PNG', 'Colorized', Col); + + Tex_BG_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGLeft')), 'PNG', 'Colorized', Col); + Tex_BG_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGMid')), 'PNG', 'Colorized', Col); + Tex_BG_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGRight')), 'PNG', 'Colorized', Col); + end; + + Tex_Note_Perfect_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePerfectStar')), 'JPG', 'Font Black', 0); + Tex_Note_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteStar')) , 'JPG', 'Alpha Black Colored', $FFFFFF); + Tex_Ball := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'BMP', 'Transparent', $FF00FF); + Tex_Lyric_Help_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricHelpBar')), 'BMP', 'Transparent', $FF00FF); + + + //TimeBar mod + Tex_TimeProgress := Texture.LoadTexture(pchar(Skin.GetTextureFileName('TimeBar'))); + //eoa TimeBar mod + + //SingBar Mod + Tex_SingBar_Back := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBack')), 'JPG', 'Plain', 0); + Tex_SingBar_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBar')), 'JPG', 'Plain', 0); + Tex_SingBar_Front := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarFront')), 'JPG', 'Font', 0); + //end Singbar Mod + + //Line Bonus PopUp + for P := 0 to 8 do + begin + Tex_SingLineBonusBack[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LineBonusBack')), 'PNG', 'Colorized', $FFFFFF); + end; + {//Set Texture to Font High + Tex_SingLineBonusL.H := 32; Tex_SingLineBonusL.W := 8; + Tex_SingLineBonusM.H := 32; //Tex_SingLineBonusM.TexW := Tex_SingLineBonusM.TexW/2; + Tex_SingLineBonusR.H := 32; Tex_SingLineBonusR.W := 8; } + //PhrasenBonus - Line Bonus Mod End + + // tworzenie czcionek + Log.LogStatus('Building Fonts', 'LoadTextures'); + BuildFont; +end; + +procedure Initialize3D (Title: string); +var +// Icon: TIcon; + Res: TResourceStream; + ISurface: PSDL_Surface; + Pixel: PByteArray; + I: Integer; +begin + Log.LogStatus('LoadOpenGL', 'Initialize3D'); + Log.BenchmarkStart(2); + + LoadOpenGL; + + Log.LogStatus('SDL_Init', 'Initialize3D'); + if ( SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO)= -1 ) then begin + Log.LogError('SDL_Init Failed', 'Initialize3D'); + exit; + end; + + { //Load Icon + Res := TResourceStream.CreateFromID(HInstance, 3, RT_ICON); + Icon := TIcon.Create; + Icon.LoadFromStream(Res); + Res.Free; + Icon. + //Create icon Surface + SDL_CreateRGBSurfaceFrom ( + SDL_SWSURFACE, + Icon.Width, + Icon.Height, + 32, + 128 or 64, + 32 or 16, + 8 or 4, + 2 or 1); + //SDL_BlitSurface( + + + SDL_WM_SetIcon(SDL_LoadBMP('DEFAULT_WINDOW_ICON'), 0); //} + + SDL_WM_SetCaption(PChar(Title), nil); + + InitializeScreen; + + Log.BenchmarkEnd(2); + Log.LogBenchmark('--> Setting Screen', 2); + + // ladowanie tekstur + Log.BenchmarkStart(2); + Texture := TTextureUnit.Create; + Texture.Limit := 1024*1024; + + LoadTextures; + Log.BenchmarkEnd(2); + Log.LogBenchmark('--> Loading Textures', 2); + +{ Log.BenchmarkStart(2); + Lyric:= TLyric.Create; + Log.BenchmarkEnd(2); + Log.LogBenchmark('--> Loading Fonts', 2); +} + Log.BenchmarkStart(2); + Display := TDisplay.Create; + SDL_EnableUnicode(1); + Log.BenchmarkEnd(2); Log.LogBenchmark('====> Creating Display', 2); + + Log.LogStatus('Loading Screens', 'Initialize3D'); + Log.BenchmarkStart(3); + + LoadLoadingScreen; + // now that we have something to display while loading, + // start thread that loads the rest of ultrastar +// Mutex := SDL_CreateMutex; +// SDL_UnLockMutex(Mutex); + + // funktioniert so noch nicht, da der ladethread unverändert auf opengl zugreifen will + // siehe dazu kommentar unten + //LoadingThread := SDL_CreateThread(@LoadingThread, nil); + + // das hier würde dann im ladethread ausgeführt + LoadScreens; + + + // TODO!!!!!!1 + // hier käme jetzt eine schleife, die + // * den ladescreen malt (ab und zu) + // * den "fortschritt" des ladescreens steuert + // * zwischendrin schaut, ob der ladethread texturen geladen hat (mutex prüfen) und + // * die texturen in die opengl lädt, sowie + // * dem ladethread signalisiert, dass der speicher für die textur + // zum laden der nächsten textur weiterverwendet werden kann (über weiteren mutex) + // * über einen 3. mutex so lange läuft, bis der ladethread signalisiert, + // dass er alles geladen hat fertig ist + // + // dafür muss loadtexture so umgeschrieben werden, dass es, statt selbst irgendwelche + // opengl funktionen aufzurufen, entsprechend mutexe verändert + // der hauptthread muss auch irgendwoher erfahren, was an opengl funktionen auszuführen ist, + // mit welchen parametern (texturtyp, entspr. texturobjekt, textur-zwischenspeicher-adresse, ... + + + //wait for loading thread to finish + // funktioniert so auch noch nicht + //SDL_WaitThread(LoadingThread, I); +// SDL_DestroyMutex(Mutex); + + Display.ActualScreen^.FadeTo(@ScreenMain); + + Log.BenchmarkEnd(2); + Log.LogBenchmark('--> Loading Screens', 2); + + Log.LogStatus('Finish', 'Initialize3D'); +end; + +procedure SwapBuffers; +begin + SDL_GL_SwapBuffers; + glMatrixMode(GL_PROJECTION); + glLoadIdentity; + glOrtho(0, RenderW, RenderH, 0, -1, 100); + glMatrixMode(GL_MODELVIEW); +end; + +procedure Reinitialize3D; +begin +// InitializeScreen; +// LoadTextures; +// LoadScreens; +end; + +procedure InitializeScreen; +var + S: string; + I: integer; + W, H: integer; + Depth: Integer; +begin + if (Params.Screens <> -1) then + Screens := Params.Screens + 1 + else + Screens := Ini.Screens + 1; + + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + + // If there is a resolution in Parameters, use it, else use the Ini value + I := Params.Resolution; + if (I <> -1) then + S := IResolution[I] + else + S := IResolution[Ini.Resolution]; + + I := Pos('x', S); + W := StrToInt(Copy(S, 1, I-1)) * Screens; + H := StrToInt(Copy(S, I+1, 1000)); + + {if ParamStr(1) = '-fsblack' then begin + W := 800; + H := 600; + end; + if ParamStr(1) = '-320x240' then begin + W := 320; + H := 240; + end; } + + If (Params.Depth <> -1) then + Depth := Params.Depth + else + Depth := Ini.Depth; + + + Log.LogStatus('SDL_SetVideoMode', 'Initialize3D'); +// SDL_SetRefreshrate(85); +// SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); + if (Ini.FullScreen = 0) and (Not Params.FullScreen) then + screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL) + else begin + screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN); + SDL_ShowCursor(0); + end; + if (screen = nil) then begin + Log.LogError('SDL_SetVideoMode Failed', 'Initialize3D'); + exit; + end; + + // clear screen once window is being shown + glClearColor(1, 1, 1, 1); + glClear(GL_COLOR_BUFFER_BIT); + SwapBuffers; + + // zmienne + RenderW := 800; + RenderH := 600; + ScreenW := W; + ScreenH := H; +end; + +procedure LoadLoadingScreen; +begin + ScreenLoading := TScreenLoading.Create; + ScreenLoading.onShow; + Display.ActualScreen := @ScreenLoading; + swapbuffers; + ScreenLoading.Draw; + Display.Draw; + SwapBuffers; +end; + +procedure LoadScreens; +begin +{ ScreenLoading := TScreenLoading.Create; + ScreenLoading.onShow; + Display.ActualScreen := @ScreenLoading; + ScreenLoading.Draw; + Display.Draw; + SwapBuffers; +} + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Loading', 3); Log.BenchmarkStart(3); +{ ScreenWelcome := TScreenWelcome.Create; //'BG', 4, 3); + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Welcome', 3); Log.BenchmarkStart(3);} + ScreenMain := TScreenMain.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Main', 3); Log.BenchmarkStart(3); + ScreenName := TScreenName.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Name', 3); Log.BenchmarkStart(3); + ScreenLevel := TScreenLevel.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Level', 3); Log.BenchmarkStart(3); + ScreenSong := TScreenSong.Create; + 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); + ScreenSing := TScreenSing.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing', 3); Log.BenchmarkStart(3); + ScreenScore := TScreenScore.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Score', 3); Log.BenchmarkStart(3); + ScreenTop5 := TScreenTop5.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Top5', 3); Log.BenchmarkStart(3); + ScreenOptions := TScreenOptions.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options', 3); Log.BenchmarkStart(3); + ScreenOptionsGame := TScreenOptionsGame.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Game', 3); Log.BenchmarkStart(3); + ScreenOptionsGraphics := TScreenOptionsGraphics.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Graphics', 3); Log.BenchmarkStart(3); + ScreenOptionsSound := TScreenOptionsSound.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Sound', 3); Log.BenchmarkStart(3); + ScreenOptionsLyrics := TScreenOptionsLyrics.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Lyrics', 3); Log.BenchmarkStart(3); + ScreenOptionsThemes := TScreenOptionsThemes.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Themes', 3); Log.BenchmarkStart(3); + ScreenOptionsRecord := TScreenOptionsRecord.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Record', 3); Log.BenchmarkStart(3); + ScreenOptionsAdvanced := TScreenOptionsAdvanced.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Advanced', 3); Log.BenchmarkStart(3); + ScreenEditSub := TScreenEditSub.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Sub', 3); Log.BenchmarkStart(3); + ScreenEdit := TScreenEdit.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit', 3); Log.BenchmarkStart(3); + ScreenEditConvert := TScreenEditConvert.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen EditConvert', 3); Log.BenchmarkStart(3); +// ScreenEditHeader := TScreenEditHeader.Create(Skin.ScoreBG); +// Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Header', 3); Log.BenchmarkStart(3); + ScreenOpen := TScreenOpen.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Open', 3); Log.BenchmarkStart(3); + ScreenSingModi := TScreenSingModi.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing with Modi support', 3); Log.BenchmarkStart(3); + ScreenSongMenu := TScreenSongMenu.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongMenu', 3); Log.BenchmarkStart(3); + ScreenSongJumpto := TScreenSongJumpto.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongJumpto', 3); Log.BenchmarkStart(3); + ScreenPopupCheck := TScreenPopupCheck.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Popup (Check)', 3); Log.BenchmarkStart(3); + ScreenPopupError := TScreenPopupError.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Popup (Error)', 3); Log.BenchmarkStart(3); + ScreenPartyNewRound := TScreenPartyNewRound.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyNewRound', 3); Log.BenchmarkStart(3); + ScreenPartyScore := TScreenPartyScore.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyScore', 3); Log.BenchmarkStart(3); + ScreenPartyWin := TScreenPartyWin.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyWin', 3); Log.BenchmarkStart(3); + ScreenPartyOptions := TScreenPartyOptions.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyOptions', 3); Log.BenchmarkStart(3); + ScreenPartyPlayer := TScreenPartyPlayer.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyPlayer', 3); Log.BenchmarkStart(3); + ScreenStatMain := TScreenStatMain.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Main', 3); Log.BenchmarkStart(3); + ScreenStatDetail := TScreenStatDetail.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Detail', 3); Log.BenchmarkStart(3); + ScreenCredits := TScreenCredits.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Credits', 3); Log.BenchmarkStart(3); + + end; + +function LoadingThreadFunction: integer; +begin + LoadScreens; + Result:= 1; +end; + +end. diff --git a/Game/Code/Classes/ULyrics.pas b/Game/Code/Classes/ULyrics.pas index 64762265..5cf6114d 100644 --- a/Game/Code/Classes/ULyrics.pas +++ b/Game/Code/Classes/ULyrics.pas @@ -1,390 +1,537 @@ unit ULyrics; interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -uses SysUtils, - OpenGL12, - UMusic; +uses OpenGL12, UTexture, UThemes, UMusic; type - TWord = record - X: real; - Y: real; - Size: real; - Width: real; - Text: string; - ColR: real; - ColG: real; - ColB: real; - Scale: real; - Done: real; - FontStyle: integer; - Italic: boolean; - Selected: boolean; + TLyricWord = record + X: Real; //X Pos of the Word + Width: Real; //Width of the Text + TexPos: Real; //Pos of the Word (0 to 1) in the Sentence Texture + TexWidth: Real; //width of the Word in Sentence Texture (0 to 1) + Start: Cardinal; //Start of the Words in Quarters (Beats) + Length: Cardinal; //Length of the Word in Quarters + Text: String; //Text of this Word + Freestyle: Boolean; //Is this Word Freestyle + end; + ALyricWord = array of TLyricWord; + + PLyricLine = ^TLyricLine; + TLyricLine = record + Text: String; //Text of the Line + Tex: glUInt; //Texture of the Text from this Line + Width: Real; //Width of the Lyricline in Tex + Size: Byte; //Size of the Font in the Texture + Words: ALyricWord; //Words from this Line + Start: Cardinal; //Start in Quarters of teh Line + Length: Cardinal; //Length in Quarters (From Start of First Note to the End of Last Note) + Freestyle: Boolean; //Complete Line is Freestyle ? + Players: Byte; //Which Players Sing this Line (1: Player1; 2: Player2; 4: Player3; [..]) + Done: Boolean; //Is Sentence Sung end; - TLyric = class + TLyricEngine = class private - AlignI: integer; - XR: real; - YR: real; - SizeR: real; - SelectedI: integer; - ScaleR: real; - StyleI: integer; // 0 - one selection, 1 - long selection, 2 - one selection with fade to normal text, 3 - long selection with fade with color from left - FontStyleI: integer; // font number - Word: array of TWord; - procedure SetX(Value: real); - procedure SetY(Value: real); - function GetClientX: real; - procedure SetAlign(Value: integer); - function GetSize: real; - procedure SetSize(Value: real); - procedure SetSelected(Value: integer); - procedure SetDone(Value: real); - procedure SetScale(Value: real); - procedure SetStyle(Value: integer); - procedure SetFStyle(Value: integer); - procedure Refresh; - procedure DrawNormal(W: integer); - procedure DrawPlain(W: integer); - procedure DrawScaled(W: integer); - procedure DrawSlide(W: integer); + EoLastSentence: Real; //When did the Last Sentence End (in Beats) + UpperLine: TLyricLine; //Line in the Upper Part of the Lyric Display + LowerLine: TLyricLine; //Line in the Lower Part of teh Lyric Display + QueueLine: TLyricLine; //Line that is in Queue and will be added when next Line is Finished + PUpperLine, PLowerLine, PQueueLine: PLyricLine; + + IndicatorTex: TTexture; //Texture for Lyric Indikator(Bar that indicates when the Line start) + BallTex: TTexture; //Texture of the Ball for cur. Word hover in Ballmode + PlayerIconTex: array[0..5] of //Textures for PlayerIcon Index: Playernum; Index2: Enabled/Disabled + array [0..1] of + TTexture; + + inQueue: Boolean; + LCounter: Word; + + //Some helper Procedures for Lyric Drawing + procedure DrawLyrics (Beat: Real); + procedure DrawLyricsLine(const X, W, Y: Real; Size: Byte; const Line: TLyricLine; Beat: Real); + procedure DrawPlayerIcon(const Player: Byte; const Enabled: Boolean; const X, Y, Size, Alpha: Real); public - ColR: real; - ColG: real; - ColB: real; - ColSR: real; - ColSG: real; - ColSB: real; - Italic: boolean; - Text: string; // LCD - - procedure AddWord(Text: string); // Moved from published, lazarus didnt like it - procedure AddCzesc(NrCzesci: integer); - - function SelectedLetter: integer; // LCD - function SelectedLength: integer; // LCD - - procedure Clear; - procedure Draw; - - published - property X: real write SetX; - property Y: real write SetY; - property ClientX: real read GetClientX; - property Align: integer write SetAlign; - property Size: real read GetSize write SetSize; - property Selected: integer read SelectedI write SetSelected; - property Done: real write SetDone; - property Scale: real write SetScale; - property Style: integer write SetStyle; - property FontStyle: integer write SetFStyle; + //Positions, Line specific Settings + UpperLineX: Real; //X Start Pos of UpperLine + UpperLineW: Real; //Width of UpperLine with Icon(s) and Text + UpperLineY: Real; //Y Start Pos of UpperLine + UpperLineSize: Byte; //Max Size of Lyrics Text in UpperLine + + LowerLineX: Real; //X Start Pos of LowerLine + LowerLineW: Real; //Width of LowerLine with Icon(s) and Text + LowerLineY: Real; //Y Start Pos of LowerLine + LowerLineSize: Byte; //Max Size of Lyrics Text in LowerLine + + //Display Propertys + LineColor_en: TRGBA; //Color of Words in an Enabled Line + LineColor_dis: TRGBA; //Color of Words in a Disabled Line + LineColor_akt: TRGBA; //Color of teh active Word + FontStyle: Byte; //Font for the Lyric Text + FontReSize: Boolean; //ReSize Lyrics if they don't fit Screen + + HoverEffekt: Byte; //Effekt of Hovering active Word: 0 - one selection, 1 - long selection, 2 - one selection with fade to normal text, 3 - long selection with fade with color from left + FadeInEffekt: Byte; //Effekt for Line Fading in: 0: No Effekt; 1: Fade Effekt; 2: Move Upwards from Bottom to Pos + FadeOutEffekt: Byte; //Effekt for Line Fading out: 0: No Effekt; 1: Fade Effekt; 2: Move Upwards + + UseLinearFilter:Boolean; //Should Linear Tex Filter be used + + //Song specific Settings + BPM: Real; + Resolution: Integer; + + + //properties to easily update this Class within other Parts of Code + property LineinQueue: Boolean read inQueue; //True when there is a Line in Queue + property LineCounter: Word read LCounter; //Lines that was Progressed so far (after last Clear) + + Constructor Create; overload; //Constructor, just get Memory + Constructor Create(ULX,ULY,ULW,ULS,LLX,LLY,LLW,LLS:Real); overload; + Procedure LoadTextures; //Load Player Textures and Create + + Procedure AddLine(Line: PLine); //Adds a Line to the Queue if there is Space + Procedure Draw (Beat: Real); //Procedure Draws Lyrics; Beat is curent Beat in Quarters + Procedure Clear (const cBPM: Real = 0; const cResolution: Integer = 0); //Clears all cached Song specific Information + + Destructor Free; //Frees Memory end; -var - Lyric: TLyric; +const LyricTexStart = 2/512; implementation -uses TextGL, UGraphic, UDrawTexture; +uses SysUtils, USkins, TextGL, UGraphic, UDisplay, dialogs; -procedure TLyric.SetX(Value: real); +//----------- +//Helper procs to use TRGB in Opengl ...maybe this should be somewhere else +//----------- +procedure glColorRGB(Color: TRGB); overload; begin - XR := Value; + glColor3f(Color.R, Color.G, Color.B); end; -procedure TLyric.SetY(Value: real); +procedure glColorRGB(Color: TRGBA); overload; begin - YR := Value; + glColor4f(Color.R, Color.G, Color.B, Color.A); end; -function TLyric.GetClientX: real; + + +//--------------- +// Create - Constructor, just get Memory +//--------------- +Constructor TLyricEngine.Create; begin - Result := Word[0].X; + BPM := 0; + Resolution := 0; + LCounter := 0; + inQueue := False; + + UpperLine.Done := True; + LowerLine.Done := True; + QueueLine.Done := True; + PUpperline:=@UpperLine; + PLowerLine:=@LowerLine; + PQueueLine:=@QueueLine; + + UseLinearFilter := True; end; -procedure TLyric.SetAlign(Value: integer); +Constructor TLyricEngine.Create(ULX,ULY,ULW,ULS,LLX,LLY,LLW,LLS:Real); begin - AlignI := Value; -// if AlignInt = 0 then beep; + Create; + UpperLineX := ULX; + UpperLineW := ULW; + UpperLineY := ULY; + UpperLineSize := Trunc(ULS); + + LowerLineX := LLX; + LowerLineW := LLW; + LowerLineY := LLY; + LowerLineSize := Trunc(LLS); + LoadTextures; end; -function TLyric.GetSize: real; + +//--------------- +// Free - Frees Memory +//--------------- +Destructor TLyricEngine.Free; begin - Result := SizeR; + end; -procedure TLyric.SetSize(Value: real); +//--------------- +// Clear - Clears all cached Song specific Information +//--------------- +Procedure TLyricEngine.Clear (const cBPM: Real; const cResolution: Integer); begin - SizeR := Value; + BPM := cBPM; + Resolution := cResolution; + LCounter := 0; + inQueue := False; + + UpperLine.Done := True; + LowerLine.Done := True; + QueueLine.Done := True; + + PUpperline:=@UpperLine; + PLowerLine:=@LowerLine; + PQueueLine:=@QueueLine; end; -procedure TLyric.SetSelected(Value: integer); + +//--------------- +// LoadTextures - Load Player Textures and Create Lyric Textures +//--------------- +Procedure TLyricEngine.LoadTextures; var - W: integer; -begin - if (StyleI = 0) or (StyleI = 2) or (StyleI = 4) then begin - if (SelectedI > -1) and (SelectedI <= High(Word)) then begin - Word[SelectedI].Selected := false; - Word[SelectedI].ColR := ColR; - Word[SelectedI].ColG := ColG; - Word[SelectedI].ColB := ColB; - Word[SelectedI].Done := 0; - end; + I: Integer; + PTexData: Pointer; - SelectedI := Value; - if (Value > -1) and (Value <= High(Word)) then begin - Word[Value].Selected := true; - Word[Value].ColR := ColSR; - Word[Value].ColG := ColSG; - Word[Value].ColB := ColSB; - Word[Value].Scale := ScaleR; - end; - end; + function CreateLineTex: glUint; + begin + GetMem(pTexData, 1024*128*4); //get Memory to save Tex in - if (StyleI = 1) or (StyleI = 3) then begin - if (SelectedI > -1) and (SelectedI <= High(Word)) then begin - for W := SelectedI to High(Word) do begin - Word[W].Selected := false; - Word[W].ColR := ColR; - Word[W].ColG := ColG; - Word[W].ColB := ColB; - Word[W].Done := 0; - end; - end; + //generate and bind Texture + glGenTextures(1, Result); + glBindTexture(GL_TEXTURE_2D, Result); - SelectedI := Value; - if (Value > -1) and (Value <= High(Word)) then begin - for W := 0 to Value do begin - Word[W].Selected := true; - Word[W].ColR := ColSR; - Word[W].ColG := ColSG; - Word[W].ColB := ColSB; - Word[W].Scale := ScaleR; - Word[W].Done := 1; - end; + //Get Memory + glTexImage2D(GL_TEXTURE_2D, 0, 4, 1024, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, pTexData); + + if UseLinearFilter then + begin + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); end; + + //Free now unused Memory + FreeMem(pTexData); end; +begin + //Load Texture for Lyric Indikator(Bar that indicates when the Line start) + IndicatorTex := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricHelpBar')), 'BMP', 'Transparent', $FF00FF); - Refresh; -end; + //Load Texture of the Ball for cur. Word hover in Ballmode + BallTex := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'BMP', 'Transparent', $FF00FF); -procedure TLyric.SetDone(Value: real); -var - W: integer; -begin - W := SelectedI; - if W > -1 then - Word[W].Done := Value; -end; + //Load PlayerTexs + For I := 0 to 1 do + begin + PlayerIconTex[I][0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIcon_P' + InttoStr(I+1))), 'PNG', 'Transparent', 0); + PlayerIconTex[I][1] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIconD_P' + InttoStr(I+1))), 'PNG', 'Transparent', 0); + end; -procedure TLyric.SetScale(Value: real); -begin - ScaleR := Value; -end; + //atm just unset other texs + For I := 2 to 5 do + begin + PlayerIconTex[I][0].TexNum := high(Cardinal); //Set to C's -1 + PlayerIconTex[I][1].TexNum := high(Cardinal); + end; -procedure TLyric.SetStyle(Value: integer); -begin - StyleI := Value; + //Create LineTexs + UpperLine.Tex := CreateLineTex; + LowerLine.Tex := CreateLineTex; + QueueLine.Tex := CreateLineTex; end; -procedure TLyric.SetFStyle(Value: integer); -begin - FontStyleI := Value; -end; -procedure TLyric.AddWord(Text: string); +//--------------- +// AddLine - Adds LyricLine to queue +//--------------- +Procedure TLyricEngine.AddLine(Line: PLine); var - WordNum: integer; + LyricLine: PLyricLine; + I: Integer; + countNotes: Cardinal; + PosX: Real; + Viewport: Array[0..3] of Integer; begin - WordNum := Length(Word); - SetLength(Word, WordNum + 1); - if WordNum = 0 then begin - Word[WordNum].X := XR; - end else begin - Word[WordNum].X := Word[WordNum - 1].X + Word[WordNum - 1].Width; + //Only Add Lines if there is enough space + If not LineinQueue then + begin + //Set Pointer to Line to Write + If (LineCounter = 0) then + LyricLine := PUpperLine //Set Upper Line + else if (LineCounter = 1) then + LyricLine := PLowerLine //Set Lower Line + else + begin + LyricLine := PQueueLine; //Set Queue Line + inQueue := True; //now there is a Queued Line + end; + end + else + begin + LyricLine:=PUpperLine; + PUpperLine:=PLowerLine; + PLowerLine:=PQueueLine; + PQueueLine:=LyricLine; end; - Word[WordNum].Y := YR; - Word[WordNum].Size := SizeR; - Word[WordNum].FontStyle := FontStyleI; // new - SetFontStyle(FontStyleI); - SetFontSize(SizeR); - Word[WordNum].Width := glTextWidth(pchar(Text)); - Word[WordNum].Text := Text; - Word[WordNum].ColR := ColR; - Word[WordNum].ColG := ColG; - Word[WordNum].ColB := ColB; - Word[WordNum].Scale := 1; - Word[WordNum].Done := 0; - Word[WordNum].Italic := Italic; - - Refresh; -end; + //Check if Sentence has Notes + If (Length(Line.Nuta) > 0) then + begin + //Copy Values from SongLine to LyricLine + CountNotes := high(Line.Nuta); + LyricLine.Start := Line.Nuta[0].Start; + LyricLine.Length := Line.Nuta[CountNotes].Start + Line.Nuta[CountNotes].Dlugosc - LyricLine.Start; + LyricLine.Freestyle := True; //is set by And Notes Freestyle while copying Notes + LyricLine.Text := ''; //Also Set while copying Notes + LyricLine.Players := 127; //All Players for now, no Duett Mode available + //Copy Words + SetLength(LyricLine.Words, CountNotes + 1); + For I := 0 to CountNotes do + begin + LyricLine.Freestyle := LyricLine.Freestyle AND Line.Nuta[I].FreeStyle; + LyricLine.Words[I].Start := Line.Nuta[I].Start; + LyricLine.Words[I].Length := Line.Nuta[I].Dlugosc; + LyricLine.Words[I].Text := Line.Nuta[I].Tekst; + LyricLine.Words[I].Freestyle := Line.Nuta[I].FreeStyle; + LyricLine.Text := LyricLine.Text + LyricLine.Words[I].Text + end; -procedure TLyric.AddCzesc(NrCzesci: integer); -var - N: integer; -begin - Clear; - for N := 0 to Czesci[0].Czesc[NrCzesci].HighNut do begin - Italic := Czesci[0].Czesc[NrCzesci].Nuta[N].FreeStyle; - AddWord(Czesci[0].Czesc[NrCzesci].Nuta[N].Tekst); - Text := Text + Czesci[0].Czesc[NrCzesci].Nuta[N].Tekst; - end; - Selected := -1; -end; + //Set Font Params + SetFontStyle(FontStyle); + SetFontPos(0, 0); + LyricLine.Size := UpperLineSize; + SetFontSize(LyricLine.Size); + SetFontItalic(False); + glColor4f(1, 1, 1, 1); -procedure TLyric.Clear; -begin -{ ColR := Skin_FontR; - ColG := Skin_FontG; - ColB := Skin_FontB;} - SetLength(Word, 0); - Text := ''; - SelectedI := -1; -end; + //Change Fontsize to Fit the Screen + While (LyricLine.Width > 508) do + begin + Dec(LyricLine.Size); -procedure TLyric.Refresh; -var - W: integer; - TotWidth: real; -begin - if AlignI = 1 then begin - TotWidth := 0; - for W := 0 to High(Word) do - TotWidth := TotWidth + Word[W].Width; - - Word[0].X := XR - TotWidth / 2; - for W := 1 to High(Word) do - Word[W].X := Word[W - 1].X + Word[W - 1].Width; + if (LyricLine.Size <=1) then + Break; + + SetFontSize(LyricLine.Size); + LyricLine.Width := glTextWidth(PChar(LyricLine.Text)); + end; + + //Set Word Positions and Line Size + PosX := 2 {LowerLineX + LowerLineW/2 + 80 - LyricLine.Width/2}; + For I := 0 to High(LyricLine.Words) do + begin + LyricLine.Words[I].X := PosX; + LyricLine.Words[I].Width := glTextWidth(PChar(LyricLine.Words[I].Text)); + LyricLine.Words[I].TexPos := PosX / 512; + LyricLine.Words[I].TexWidth := LyricLine.Words[I].TexWidth / 512; + + PosX := PosX + LyricLine.Words[I].Width; + end; + + //Create LyricTexture + //Prepare Ogl + glGetIntegerv(GL_VIEWPORT, @ViewPort); + glClearColor(0.0,0.0,0.0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + {glMatrixMode(GL_PROJECTION); + glLoadIdentity; + glOrtho(0, 1024, 64, 0, -1, 100); + glMatrixMode(GL_MODELVIEW);} + glViewport(0, 0, 512, 512); + + //Draw Lyrics + SetFontPos(0, 0); + glPrint(PChar(LyricLine.Text)); + + Display.ScreenShot; + //Copy to Texture + glBindTexture(GL_TEXTURE_2D, LyricLine.Tex); + glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 448, 512, 64, 0); + + //Clear Buffer + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + glViewPort(ViewPort[0], ViewPort[1], ViewPort[2], ViewPort[3]); + {glMatrixMode(GL_PROJECTION); + glLoadIdentity; + glOrtho(0, RenderW, RenderH, 0, -1, 100); + glMatrixMode(GL_MODELVIEW); } end; -end; -procedure TLyric.Draw; -var - W: integer; -begin - case StyleI of - 0: - begin - for W := 0 to High(Word) do - DrawNormal(W); - end; - 1: - begin - for W := 0 to High(Word) do - DrawPlain(W); - end; - 2: // zoom - begin - for W := 0 to High(Word) do - if not Word[W].Selected then - DrawNormal(W); - - for W := 0 to High(Word) do - if Word[W].Selected then - DrawScaled(W); - end; - 3: // slide - begin - for W := 0 to High(Word) do begin - if not Word[W].Selected then - DrawNormal(W) - else - DrawSlide(W); - end; - end; - 4: // ball - begin - for W := 0 to High(Word) do - DrawNormal(W); - - for W := 0 to High(Word) do - if Word[W].Selected then begin - Tex_Ball.X := (Word[W].X - 10) + Word[W].Done * Word[W].Width; - Tex_Ball.Y := 480 - 10*sin(Word[W].Done * pi); - Tex_Ball.W := 20; - Tex_Ball.H := 20; - DrawTexture(Tex_Ball); - end; - end; - end; // case + //Increase the Counter + Inc(LCounter); end; -procedure TLyric.DrawNormal(W: integer); -begin - SetFontStyle(Word[W].FontStyle); - SetFontPos(Word[W].X+ 10*ScreenX, Word[W].Y); - SetFontSize(Word[W].Size); - SetFontItalic(Word[W].Italic); - glColor3f(Word[W].ColR, Word[W].ColG, Word[W].ColB); - glPrint(pchar(Word[W].Text)); -end; -procedure TLyric.DrawPlain(W: integer); -var - D: real; +//--------------- +// Draw - Procedure Draws Lyrics; Beat is curent Beat in Quarters +// Draw just manage the Lyrics, drawing is done by a call of DrawLyrics +//--------------- +Procedure TLyricEngine.Draw (Beat: Real); begin - D := Word[W].Done; // przyrost - SetFontStyle(Word[W].FontStyle); - SetFontPos(Word[W].X, Word[W].Y); - SetFontSize(Word[W].Size); - SetFontItalic(Word[W].Italic); + DrawLyrics(Beat); - if D = 0 then - glColor3f(ColR, ColG, ColB) - else - glColor3f(ColSR, ColSG, ColSB); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_Alpha {GL_ONE_MINUS_SRC_COLOR}, GL_ONE_MINUS_SRC_Alpha); + glBindTexture(GL_TEXTURE_2D, PUpperLine^.Tex); + + glColor4f(1,1,0,1); + glBegin(GL_QUADS); + glTexCoord2f(0, 1); glVertex2f(100, 100); + glTexCoord2f(0, 0); glVertex2f(100, 200); + glTexCoord2f(1, 0); glVertex2f(612, 200); + glTexCoord2f(1, 1); glVertex2f(612, 100); + glEnd; + + glBindTexture(GL_TEXTURE_2D, PLowerLine^.Tex); + + glColor4f(1,0,1,1); + glBegin(GL_QUADS); + glTexCoord2f(0, 1); glVertex2f(100, 200); + glTexCoord2f(0, 0); glVertex2f(100, 300); + glTexCoord2f(1, 0); glVertex2f(612, 300); + glTexCoord2f(1, 1); glVertex2f(612, 200); + glEnd; + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); - glPrint(pchar(Word[W].Text)); end; -procedure TLyric.DrawScaled(W: integer); -var - D: real; +//--------------- +// DrawLyrics(private) - Helper for Draw; main Drawing procedure +//--------------- +procedure TLyricEngine.DrawLyrics (Beat: Real); begin - // previous plus dynamic scaling effect - D := 1-Word[W].Done; // przyrost - SetFontStyle(Word[W].FontStyle); - SetFontPos(Word[W].X - D * Word[W].Width * (Word[W].Scale - 1) / 2 + (D+1)*10*ScreenX, Word[W].Y - D * 1.5 * Word[W].Size *(Word[W].Scale - 1)); - SetFontSize(Word[W].Size + D * (Word[W].Size * Word[W].Scale - Word[W].Size)); - SetFontItalic(Word[W].Italic); - glColor3f(Word[W].ColR, Word[W].ColG, Word[W].ColB); - glPrint(pchar(Word[W].Text)) + DrawLyricsLine(UpperLineX, UpperLineW, UpperlineY, 15, Upperline, Beat); + DrawLyricsLine(LowerLineX, LowerLineW, LowerlineY, 15, Lowerline, Beat); end; -procedure TLyric.DrawSlide(W: integer); -var - D: real; +//--------------- +// DrawPlayerIcon(private) - Helper for Draw; Draws a Playericon +//--------------- +procedure TLyricEngine.DrawPlayerIcon(const Player: Byte; const Enabled: Boolean; const X, Y, Size, Alpha: Real); +var IEnabled: Byte; begin - D := Word[W].Done; // przyrost - SetFontStyle(Word[W].FontStyle); - SetFontPos(Word[W].X, Word[W].Y); - SetFontSize(Word[W].Size); - SetFontItalic(Word[W].Italic); - glColor3f(Word[W].ColR, Word[W].ColG, Word[W].ColB); - glPrintDone(pchar(Word[W].Text), D, ColR, ColG, ColB); + Case Enabled of + True: IEnabled := 0; + False: IEnabled:= 1; + end; + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, PlayerIconTex[Player][IEnabled].TexNum); + + glColor4f(1,1,1,Alpha); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(X, Y); + glTexCoord2f(0, 1); glVertex2f(X, Y + Size); + glTexCoord2f(1, 1); glVertex2f(X + Size, Y + Size); + glTexCoord2f(1, 0); glVertex2f(X + Size, Y); + glEnd; + + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); end; - -function TLyric.SelectedLetter; // LCD +//--------------- +// DrawLyricsLine(private) - Helper for Draw; Draws one LyricLine +//--------------- +procedure TLyricEngine.DrawLyricsLine(const X, W, Y: Real; Size: Byte; const Line: TLyricLine; Beat: Real); var - W: integer; + I: Integer; + CurWord: Integer; + Progress: Real; + LyricX: Real; //Left Corner on X Axis + LyricX2: Real;//Right Corner " " + LyricScale: Real; //Up or Downscale the Lyrics need + IconSize: Real; + IconAlpha: Real; begin - Result := 1; - for W := 0 to SelectedI-1 do - Result := Result + Length(Word[W].Text); -end; +{ For I := 0 to High(Line.Words) do + begin + //Set Font Params + SetFontStyle(FontStyle); + SetFontSize(Size); + SetFontItalic(Line.Words[I].Freestyle); + glColor4f(1, 1, 1, 1); + + SetFontPos(Line.Words[I].X, Y); + + glPrint(PChar(Line.Words[I].Text)); + end; } + + LyricScale := Size / Line.Size; + + //Draw Icons + IconSize := (2 * Size); + //IconAlpha := 1; + IconAlpha := Frac(Beat/(Resolution*4)); + + {DrawPlayerIcon (0, True, X, Y, IconSize, IconAlpha); + DrawPlayerIcon (1, True, X + IconSize + 1, Y, IconSize, IconAlpha); + DrawPlayerIcon (2, True, X + (IconSize + 1)*2, Y, IconSize, IconAlpha);} + + //Check if a Word in the Sentence is active + if ((Line.Start > Beat) AND (Line.Start + Line.Length < Beat)) then + begin + //Get Start Position: + { Start of Line - Width of all Icons + LineWidth/2 (Center} + LyricX := X + (W - ((IconSize + 1) * 6))/2 + ((IconSize + 1) * 3); + + LyricX2 := LyricX + Line.Width; + + //Draw complete Sentence + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_COLOR {GL_ONE_MINUS_SRC_COLOR}, GL_ONE_MINUS_SRC_COLOR); + glBindTexture(GL_TEXTURE_2D, Line.Tex); + + glColorRGB(LineColor_en); + glBegin(GL_QUADS); + glTexCoord2f(0, 1); glVertex2f(LyricX, Y); + glTexCoord2f(0, 0); glVertex2f(LyricX, Y + 64 * W / 512); + glTexCoord2f(1, 0); glVertex2f(LyricX + LyricX2, Y + 64 * W / 512); + glTexCoord2f(1, 1); glVertex2f(LyricX + LyricX2, Y); + glEnd; + + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + end + else + begin -function TLyric.SelectedLength: integer; // LCD -begin - Result := Length(Word[SelectedI].Text); + end; + + {//Search for active Word + For I := 0 to High(Line.Words) do + if (Line.Words[I].Start < Beat) then + begin + CurWord := I - 1; + end; + + if (CurWord < 0) then Exit; + + //Draw Part until cur Word + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_COLOR {GL_ONE_MINUS_SRC_COLOR}{, GL_ONE_MINUS_SRC_COLOR); + glBindTexture(GL_TEXTURE_2D, Line.Tex); + + glColorRGB(LineColor_en); + glBegin(GL_QUADS); + glTexCoord2f(0, 1); glVertex2f(X, Y); + glTexCoord2f(0, 0); glVertex2f(X, Y + 64 * W / 512); + glTexCoord2f(Line.Words[CurWord].TexPos, 0); glVertex2f(X + W, Y + 64 * W / 512); + glTexCoord2f(Line.Words[CurWord].TexPos, 1); glVertex2f(X + W, Y); + glEnd; + + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D);} end; + end. + diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index f06345ec..1970730a 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -1,792 +1,796 @@ -unit UMain; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses - SDL, - UGraphic, - UMusic, - URecord, - UTime, - SysUtils, - UDisplay, - UIni, - ULog, - ULyrics, - UScreenSing, - OpenGL12, - {$IFDEF UseSerialPort} - zlportio {you can disable it and all PortWriteB calls}, - {$ENDIF} - ULCD, - ULight, - UThemes; - -type - TPlayer = record - Name: string; - - Score: real; - ScoreLine: real; - ScoreGolden: real; - - ScoreI: integer; - ScoreLineI: integer; - ScoreGoldenI: integer; - ScoreTotalI: integer; - - - - //SingBar Mod - ScoreLast: Real;//Last Line Score - ScorePercent: integer;//Aktual Fillstate of the SingBar - ScorePercentTarget: integer;//Target Fillstate of the SingBar - //end Singbar Mod - - //PhrasenBonus - Line Bonus Mod - LineBonus_PosX: Single; - LineBonus_PosY: Single; - LineBonus_Alpha: Single; - LineBonus_Visible: boolean; - LineBonus_Text: string; - LineBonus_Color: TRGB; - LineBonus_Age: Integer; - LineBonus_Rating: Integer; - //Variable vor Positioning -> Set on ScreenShow, different when Playercount Changes - LineBonus_TargetX: integer; - LineBonus_TargetY: integer; - LineBonus_StartX: integer; - LineBonus_StartY: integer; - //PhrasenBonus - Line Bonus Mod End - - //PerfectLineTwinkle Mod (effect) - LastSentencePerfect: Boolean; - //PerfectLineTwinkle Mod end - - -// Meter: real; - - HighNut: integer; - IlNut: integer; - Nuta: array of record - Start: integer; - Dlugosc: integer; - Detekt: real; // dokladne miejsce, w ktorym wykryto ta nute - Ton: real; - Perfect: boolean; // true if the note matches the original one, lit the star - - - - // Half size Notes Patch - Hit: boolean; // true if the note Hits the Line - //end Half size Notes Patch - - - - end; - end; - - -var - //Absolute Paths - GamePath: string; - SoundPath: string; - SongPath: string; - LogPath: string; - ThemePath: string; - ScreenshotsPath: string; - CoversPath: string; - LanguagesPath: string; - PluginPath: string; - PlayListPath: string; - - OGL: Boolean; - Done: Boolean; - Event: TSDL_event; - FileName: string; - Restart: boolean; - - // gracz i jego nuty - Player: array of TPlayer; - PlayersPlay: integer; - -procedure InitializePaths; - -procedure MainLoop; -procedure CheckEvents; -procedure Sing(Sender: TScreenSing); -procedure NewSentence(Sender: TScreenSing); -procedure NewBeat(Sender: TScreenSing); // executed when on then new beat -procedure NewBeatC(Sender: TScreenSing); // executed when on then new beat for click -procedure NewBeatD(Sender: TScreenSing); // executed when on then new beat for detection -//procedure NewHalf; // executed when in the half between beats -procedure NewNote(Sender: TScreenSing); // detect note -function GetMidBeat(Time: real): real; -function GetTimeFromBeat(Beat: integer): real; -procedure ClearScores(PlayerNum: integer); - -implementation -uses USongs, UJoystick, math, UCommandLine; - -procedure MainLoop; -var - Delay: integer; -begin - SDL_EnableKeyRepeat(125, 125); - While not Done do - Begin - // joypad - if (Ini.Joypad = 1) OR (Params.Joypad) then - Joy.Update; - - // keyboard events - CheckEvents; - - // display - done := not Display.Draw; - SwapBuffers; - - // light - Light.Refresh; - - // delay - CountMidTime; -// if 1000*TimeMid > 100 then beep; - Delay := Floor(1000 / 100 - 1000 * TimeMid); - if Delay >= 1 then - SDL_Delay(Delay); // dynamic, maximum is 100 fps - CountSkipTime; - - // reinitialization of graphics - if Restart then begin - Reinitialize3D; - Restart := false; - end; - - End; - UnloadOpenGL; -End; - -Procedure CheckEvents; -//var -// p: pointer; -Begin - if not Assigned(Display.NextScreen) then - While SDL_PollEvent( @event ) = 1 Do - Begin -// beep; - Case Event.type_ Of - SDL_QUITEV: begin - Display.Fade := 0; - Display.NextScreenWithCheck := nil; - Display.CheckOK := True; - end; -{ SDL_MOUSEBUTTONDOWN: - With Event.button Do - Begin - If State = SDL_BUTTON_LEFT Then - Begin - // - End; - End; // With} - SDL_KEYDOWN: - begin - //ScreenShot hack. If Print is pressed-> Make screenshot and Save to Screenshots Path - if (Event.key.keysym.sym = SDLK_SYSREQ) then - Display.ScreenShot - - // popup hack... if there is a visible popup then let it handle input instead of underlying screen - // shoud be done in a way to be sure the topmost popup has preference (maybe error, then check) - else if (ScreenPopupError <> NIL) and (ScreenPopupError.Visible) then - done := not ScreenPopupError.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) - else if (ScreenPopupCheck <> NIL) AND (ScreenPopupCheck.Visible) then - done := not ScreenPopupCheck.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) - // end of popup hack - - else - begin - // check for Screen want to Exit - done := Not Display.ActualScreen^.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True); - - //If Screen wants to Exit - if done then - begin - //If Question Option is enabled then Show Exit Popup - if (Ini.AskbeforeDel = 1) then - begin - Display.ActualScreen^.CheckFadeTo(NIL,'MSG_QUIT_USDX'); - end - else //When asking for exit is disabled then simply exit - begin - Display.Fade := 0; - Display.NextScreenWithCheck := nil; - Display.CheckOK := True; - end; - end; - - end; // if (Not Display.ActualScreen^.ParseInput(Event.key.keysym.scancode, True)) then - end; -// SDL_JOYAXISMOTION: -// begin -// beep -// end; - SDL_JOYBUTTONDOWN: - begin - beep - end; - End; // Case Event.type_ - End; // While -End; // CheckEvents - -function GetTimeForBeats(BPM, Beats: real): real; -begin - Result := 60 / BPM * Beats; -end; - -function GetBeats(BPM, msTime: real): real; -begin - Result := BPM * msTime / 60; -end; - -procedure GetMidBeatSub(BPMNum: integer; var Time: real; var CurBeat: real); -var - NewTime: real; -begin - if High(AktSong.BPM) = BPMNum then begin - // last BPM - CurBeat := AktSong.BPM[BPMNum].StartBeat + GetBeats(AktSong.BPM[BPMNum].BPM, Time); - Time := 0; - end else begin - // not last BPM - // count how much time is it for start of the new BPM and store it in NewTime - NewTime := GetTimeForBeats(AktSong.BPM[BPMNum].BPM, AktSong.BPM[BPMNum+1].StartBeat - AktSong.BPM[BPMNum].StartBeat); - - // compare it to remaining time - if (Time - NewTime) > 0 then begin - // there is still remaining time - CurBeat := AktSong.BPM[BPMNum].StartBeat; - Time := Time - NewTime; - end else begin - // there is no remaining time - CurBeat := AktSong.BPM[BPMNum].StartBeat + GetBeats(AktSong.BPM[BPMNum].BPM, Time); - Time := 0; - end; // if - end; // if -end; - -function GetMidBeat(Time: real): real; -var - CurBeat: real; - CurBPM: integer; -// TopBeat: real; -// TempBeat: real; -// TempTime: real; -begin - Result := 0; - if Length(AktSong.BPM) = 1 then Result := Time * AktSong.BPM[0].BPM / 60; - - (* 2 BPMs *) -{ if Length(AktSong.BPM) > 1 then begin - (* new system *) - CurBeat := 0; - TopBeat := GetBeats(AktSong.BPM[0].BPM, Time); - if TopBeat > AktSong.BPM[1].StartBeat then begin - // analyze second BPM - Time := Time - GetTimeForBeats(AktSong.BPM[0].BPM, AktSong.BPM[1].StartBeat - CurBeat); - CurBeat := AktSong.BPM[1].StartBeat; - TopBeat := GetBeats(AktSong.BPM[1].BPM, Time); - Result := CurBeat + TopBeat; - - end else begin - (* pierwszy przedzial *) - Result := TopBeat; - end; - end; // if} - - (* more BPMs *) - if Length(AktSong.BPM) > 1 then begin - - CurBeat := 0; - CurBPM := 0; - while (Time > 0) do begin - GetMidBeatSub(CurBPM, Time, CurBeat); - Inc(CurBPM); - end; - - Result := CurBeat; - end; // if -end; - -function GetTimeFromBeat(Beat: integer): real; -var - CurBPM: integer; -begin - Result := 0; - if Length(AktSong.BPM) = 1 then Result := AktSong.GAP / 1000 + Beat * 60 / AktSong.BPM[0].BPM; - - (* more BPMs *) - if Length(AktSong.BPM) > 1 then begin - Result := AktSong.GAP / 1000; - CurBPM := 0; - while (CurBPM <= High(AktSong.BPM)) and (Beat > AktSong.BPM[CurBPM].StartBeat) do begin - if (CurBPM < High(AktSong.BPM)) and (Beat >= AktSong.BPM[CurBPM+1].StartBeat) then begin - // full range - Result := Result + (60 / AktSong.BPM[CurBPM].BPM) * (AktSong.BPM[CurBPM+1].StartBeat - AktSong.BPM[CurBPM].StartBeat); - end; - - if (CurBPM = High(AktSong.BPM)) or (Beat < AktSong.BPM[CurBPM+1].StartBeat) then begin - // in the middle - Result := Result + (60 / AktSong.BPM[CurBPM].BPM) * (Beat - AktSong.BPM[CurBPM].StartBeat); - end; - Inc(CurBPM); - end; - -{ while (Time > 0) do begin - GetMidBeatSub(CurBPM, Time, CurBeat); - Inc(CurBPM); - end;} - end; // if} -end; - -procedure Sing(Sender: TScreenSing); -var - Pet: integer; - PetGr: integer; - CP: integer; - Done: real; - N: integer; -begin - Czas.Teraz := Czas.Teraz + TimeSkip; - - Czas.OldBeat := Czas.AktBeat; - Czas.MidBeat := GetMidBeat(Czas.Teraz - (AktSong.Gap{ + 90 I've forgotten for what it is}) / 1000); // new system with variable BPM in function - Czas.AktBeat := Floor(Czas.MidBeat); - -// Czas.OldHalf := Czas.AktHalf; -// Czas.MidHalf := Czas.MidBeat + 0.5; -// Czas.AktHalf := Floor(Czas.MidHalf); - - Czas.OldBeatC := Czas.AktBeatC; - Czas.MidBeatC := GetMidBeat(Czas.Teraz - (AktSong.Gap) / 1000); - Czas.AktBeatC := Floor(Czas.MidBeatC); - - Czas.OldBeatD := Czas.AktBeatD; - Czas.MidBeatD := -0.5+GetMidBeat(Czas.Teraz - (AktSong.Gap + 120 + 20) / 1000); // MidBeat with addition GAP - Czas.AktBeatD := Floor(Czas.MidBeatD); - Czas.FracBeatD := Frac(Czas.MidBeatD); - - // sentences routines - for PetGr := 0 to 0 do begin;//High(Gracz) do begin - CP := PetGr; - // ustawianie starej czesci - Czas.OldCzesc := Czesci[CP].Akt; - - // wybieranie aktualnej czesci - for Pet := 0 to Czesci[CP].High do - if Czas.AktBeat >= Czesci[CP].Czesc[Pet].Start then Czesci[CP].Akt := Pet; - - // czysczenie nut gracza, gdy to jest nowa plansza - // (optymizacja raz na halfbeat jest zla) - if Czesci[CP].Akt <> Czas.OldCzesc then NewSentence(Sender); - - end; // for PetGr - - // wykonuje operacje raz na beat - if (Czas.AktBeat >= 0) and (Czas.OldBeat <> Czas.AktBeat) then - NewBeat(Sender); - - // make some operations on clicks - if {(Czas.AktBeatC >= 0) and }(Czas.OldBeatC <> Czas.AktBeatC) then - NewBeatC(Sender); - - // make some operations when detecting new voice pitch - if (Czas.AktBeatD >= 0) and (Czas.OldBeatD <> Czas.AktBeatD) then - NewBeatD(Sender); - - // wykonuje operacje w polowie beatu -// if (Czas.AktHalf >= 1) and (Czas.OldHalf <> Czas.AktHalf) then -// NewHalf; - - // plynnie przesuwa text - Done := 1; - for N := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do - if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start <= Czas.MidBeat) - and (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start + Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc >= Czas.MidBeat) then - Done := (Czas.MidBeat - Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start) / (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc); - - N := Czesci[0].Czesc[Czesci[0].Akt].HighNut; - - // wylacza ostatnia nute po przejsciu - if (Ini.LyricsEffect = 1) and (Done = 1) and - (Czas.MidBeat > Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start + Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc) - then Sender.LyricMain.Selected := -1; - - if Done > 1 then Done := 1; - Sender.LyricMain.Done := Done; - - // use Done with LCD -{ with ScreenSing do begin - if LyricMain.Selected >= 0 then begin - LCD.MoveCursor(1, LyricMain.SelectedLetter + Round((LyricMain.SelectedLength-1) * Done)); - LCD.ShowCursor; - end; - end;} - - -end; - -procedure NewSentence(Sender: TScreenSing); -var -G: Integer; -begin - // czyszczenie nut graczy - for G := 0 to High(Player) do begin - Player[G].IlNut := 0; - Player[G].HighNut := -1; - SetLength(Player[G].Nuta, 0); - end; - - // wstawianie tekstow - with Sender do begin - LyricMain.AddCzesc(Czesci[0].Akt); - if Czesci[0].Akt < Czesci[0].High then - LyricSub.AddCzesc(Czesci[0].Akt+1) - else - LyricSub.Clear; - end; - - Sender.UpdateLCD; - - //On Sentence Change... - Sender.onSentenceChange(Czesci[0].Akt); -end; - -procedure NewBeat(Sender: TScreenSing); -var - Pet: integer; -// TempBeat: integer; -begin - // ustawia zaznaczenie tekstu -// SingScreen.LyricMain.Selected := -1; - for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do - if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeat) then begin - // operates on currently beated note - Sender.LyricMain.Selected := Pet; - -// LCD.MoveCursor(1, ScreenSing.LyricMain.SelectedLetter); -// LCD.ShowCursor; - - LCD.MoveCursorBR(Sender.LyricMain.SelectedLetter); - LCD.ShowCursor; - - end; -end; - -procedure NewBeatC; -var - Pet: integer; -// LPT_1: integer; -// LPT_2: integer; -begin -// LPT_1 := 1; -// LPT_2 := 1; - - // beat click - if (Ini.BeatClick = 1) and ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then - Music.PlayClick; - - // debug system on LPT - if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then begin - //LPT_1 := 0; -// Light.LightOne(0, 150); - - Light.LightOne(1, 200); // beat light - if ParamStr(1) = '-doublelights' then - Light.LightOne(0, 200); // beat light - - -{ if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod (Czesci[0].Resolution * 2) = 0) then - Light.LightOne(0, 150) - else - Light.LightOne(1, 150)} - end; - - for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do - if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeatC) then begin - // click assist - if Ini.ClickAssist = 1 then - Music.PlayClick; - - //LPT_2 := 0; - if ParamStr(1) <> '-doublelights' then - Light.LightOne(0, 150); //125 - - - // drum machine -(* TempBeat := Czas.AktBeat;// + 2; - if (TempBeat mod 8 = 0) then Music.PlayDrum; - if (TempBeat mod 8 = 4) then Music.PlayClap; -// if (TempBeat mod 4 = 2) then Music.PlayHihat; - if (TempBeat mod 4 <> 0) then Music.PlayHihat;*) - end; - - {$IFDEF UseSerialPort} - // PortWriteB($378, LPT_1 + LPT_2 * 2); // 0 zapala - {$ENDIF} -end; - -procedure NewBeatD(Sender: TScreenSing); -begin - NewNote(Sender); -end; - -//procedure NewHalf; -//begin -// NewNote; -//end; - -procedure NewNote(Sender: TScreenSing); -var - CP: integer; // current player - S: integer; // sentence - SMin: integer; - SMax: integer; - SDet: integer; // temporary: sentence of detected note - Pet: integer; - Mozna: boolean; - Nowa: boolean; - Range: integer; - NoteHit:boolean; -begin -// Log.LogStatus('Beat ' + IntToStr(Czas.AktBeat) + ' HalfBeat ' + IntToStr(Czas.AktHalf), 'NewBeat'); -// beep; - - // analizuje dla obu graczy ten sam sygnal (Sound.OneSrcForBoth) - // albo juz lepiej nie - for CP := 0 to PlayersPlay-1 do begin - - // analyze buffer - Sound[CP].AnalizujBufor; - - // adds some noise -// Czas.Ton := Czas.Ton + Round(Random(3)) - 1; - - // 0.5.0: count min and max sentence range for checking (detection is delayed to the notes we see on the screen) - SMin := Czesci[0].Akt-1; - if SMin < 0 then SMin := 0; - SMax := Czesci[0].Akt; - - // check if we can add new note - Mozna := false; - SDet:=SMin; - for S := SMin to SMax do - for Pet := 0 to Czesci[0].Czesc[S].HighNut do - if ((Czesci[0].Czesc[S].Nuta[Pet].Start <= Czas.AktBeatD) - and (Czesci[0].Czesc[S].Nuta[Pet].Start + Czesci[0].Czesc[S].Nuta[Pet].Dlugosc - 1 >= Czas.AktBeatD)) - and (not Czesci[0].Czesc[S].Nuta[Pet].FreeStyle) // but don't allow when it's FreeStyle note - and (Czesci[0].Czesc[S].Nuta[Pet].Dlugosc > 0) // and make sure the note lenghts is at least 1 - then begin - SDet := S; - Mozna := true; - Break; - end; - - S := SDet; - - - - - -// Czas.SzczytJest := true; -// Czas.Ton := 27; - - // gdy moze, to dodaje nute - if (Sound[CP].SzczytJest) and (Mozna) then begin - // operowanie na ostatniej nucie - for Pet := 0 to Czesci[0].Czesc[S].HighNut do - if (Czesci[0].Czesc[S].Nuta[Pet].Start <= Czas.OldBeatD+1) - and (Czesci[0].Czesc[S].Nuta[Pet].Start + - Czesci[0].Czesc[S].Nuta[Pet].Dlugosc > Czas.OldBeatD+1) then begin - // to robi, tylko dla pary nut (oryginalnej i gracza) - - // przesuwanie tonu w odpowiednia game - while (Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton > 6) do - Sound[CP].Ton := Sound[CP].Ton - 12; - while (Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton < -6) do - Sound[CP].Ton := Sound[CP].Ton + 12; - - // Half size Notes Patch - NoteHit := false; - - //if Ini.Difficulty = 0 then Range := 2; - //if Ini.Difficulty = 1 then Range := 1; - //if Ini.Difficulty = 2 then Range := 0; - Range := 2 - Ini.Difficulty; - if abs(Czesci[0].Czesc[S].Nuta[Pet].Ton - Sound[CP].Ton) <= Range then begin - Sound[CP].Ton := Czesci[0].Czesc[S].Nuta[Pet].Ton; - - - // Half size Notes Patch - NoteHit := true; - - - if (Ini.LineBonus = 0) then - begin - // add points without LineBonus - case Czesci[0].Czesc[S].Nuta[Pet].Wartosc of - 1: Player[CP].Score := Player[CP].Score + 10000 / Czesci[0].Wartosc * - Czesci[0].Czesc[S].Nuta[Pet].Wartosc; - 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 10000 / Czesci[0].Wartosc * - Czesci[0].Czesc[S].Nuta[Pet].Wartosc; - end; - end - else - begin - // add points with Line Bonus - case Czesci[0].Czesc[S].Nuta[Pet].Wartosc of - 1: Player[CP].Score := Player[CP].Score + 9000 / Czesci[0].Wartosc * - Czesci[0].Czesc[S].Nuta[Pet].Wartosc; - 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 9000 / Czesci[0].Wartosc * - Czesci[0].Czesc[S].Nuta[Pet].Wartosc; - end; - end; - - Player[CP].ScoreI := Floor(Player[CP].Score / 10) * 10; - Player[CP].ScoreGoldenI := Floor(Player[CP].ScoreGolden / 10) * 10; - - Player[CP].ScoreTotalI := Player[CP].ScoreI + Player[CP].ScoreGoldenI + Player[CP].ScoreLineI; - end; - - end; // operowanie - - // sprawdzanie czy to nowa nuta, czy przedluzenie - if S = SMax then begin - Nowa := true; - // jezeli ostatnia ma ten sam ton - if (Player[CP].IlNut > 0 ) and (Player[CP].Nuta[Player[CP].HighNut].Ton = Sound[CP].Ton) - and (Player[CP].Nuta[Player[CP].HighNut].Start + Player[CP].Nuta[Player[CP].HighNut].Dlugosc = Czas.AktBeatD) - then Nowa := false; - // jezeli jest jakas nowa nuta na sprawdzanym beacie - for Pet := 0 to Czesci[0].Czesc[S].HighNut do - if (Czesci[0].Czesc[S].Nuta[Pet].Start = Czas.AktBeatD) then - Nowa := true; - - // dodawanie nowej nuty - if Nowa then begin - // nowa nuta - Player[CP].IlNut := Player[CP].IlNut + 1; - Player[CP].HighNut := Player[CP].HighNut + 1; - SetLength(Player[CP].Nuta, Player[CP].IlNut); - Player[CP].Nuta[Player[CP].HighNut].Start := Czas.AktBeatD; - Player[CP].Nuta[Player[CP].HighNut].Dlugosc := 1; - Player[CP].Nuta[Player[CP].HighNut].Ton := Sound[CP].Ton; // Ton || TonDokl - Player[CP].Nuta[Player[CP].HighNut].Detekt := Czas.MidBeat; - - - // Half Note Patch - Player[CP].Nuta[Player[CP].HighNut].Hit := NoteHit; - - - // Log.LogStatus('Nowa Nuta ' + IntToStr(Gracz.Nuta[Gracz.HighNut].Start), 'NewBeat'); - - end else begin - // przedluzenie nuty - Player[CP].Nuta[Player[CP].HighNut].Dlugosc := Player[CP].Nuta[Player[CP].HighNut].Dlugosc + 1; - end; - - - // check for perfect note and then lit the star (on Draw) - for Pet := 0 to Czesci[0].Czesc[S].HighNut do - if (Czesci[0].Czesc[S].Nuta[Pet].Start = Player[CP].Nuta[Player[CP].HighNut].Start) - and (Czesci[0].Czesc[S].Nuta[Pet].Dlugosc = Player[CP].Nuta[Player[CP].HighNut].Dlugosc) - and (Czesci[0].Czesc[S].Nuta[Pet].Ton = Player[CP].Nuta[Player[CP].HighNut].Ton) then begin - Player[CP].Nuta[Player[CP].HighNut].Perfect := true; - end; - - end;// else beep; // if S = SMax - - end; // if moze - end; // for CP -// Log.LogStatus('EndBeat', 'NewBeat'); - -//On Sentence End -> For LineBonus + SingBar -if (sDet >= low(Czesci[0].Czesc)) AND (sDet <= high(Czesci[0].Czesc)) then -if ((Czesci[0].Czesc[SDet].Nuta[Czesci[0].Czesc[SDet].HighNut].Start + Czesci[0].Czesc[SDet].Nuta[Czesci[0].Czesc[SDet].HighNut].Dlugosc - 1) = Czas.AktBeatD) then - Sender.onSentenceEnd(sDet); - -end; - -procedure ClearScores(PlayerNum: integer); -begin - Player[PlayerNum].Score := 0; - Player[PlayerNum].ScoreI := 0; - Player[PlayerNum].ScoreLine := 0; - Player[PlayerNum].ScoreLineI := 0; - Player[PlayerNum].ScoreGolden := 0; - Player[PlayerNum].ScoreGoldenI := 0; - Player[PlayerNum].ScoreTotalI := 0; - - - //SingBar Mod - Player[PlayerNum].ScoreLast := 0; - Player[PlayerNum].ScorePercent := 50;// Sets to 50% when song starts - Player[PlayerNum].ScorePercentTarget := 50;// Sets to 50% when song starts - //end SingBar Mod - - //PhrasenBonus - Line Bonus Mod - Player[PlayerNum].LineBonus_Visible := False; //Hide Line Bonus - Player[PlayerNum].LineBonus_Alpha := 0; - Player[PlayerNum].LineBonus_TargetX := 70 + PlayerNum*500; - Player[PlayerNum].LineBonus_TargetY := 30; - //PhrasenBonus - Line Bonus Mod End -end; - -//-------------------- -// Function sets all Absolute Paths e.g. Song Path and makes sure the Directorys exist -//-------------------- -procedure InitializePaths; - - // Initialize a Path Variable - // After Setting Paths, make sure that Paths exist - function initialize_path( out aPathVar : String; const aLocation : String ): boolean; - var - lWriteable: Boolean; - begin - aPathVar := aLocation; - - If DirectoryExists(aPathVar) then - lWriteable := ForceDirectories(aPathVar) - else - lWriteable := false; - - if not lWriteable then - Log.LogError('Error: Dir ('+ aLocation +') is Readonly'); - - result := lWriteable; - end; - -begin - - GamePath := ExtractFilePath(ParamStr(0)); - - initialize_path( LogPath , GamePath ); - initialize_path( SoundPath , GamePath + 'Sounds' + PathDelim ); - initialize_path( SongPath , GamePath + 'Songs' + PathDelim ); - initialize_path( ThemePath , GamePath + 'Themes' + PathDelim ); - initialize_path( ScreenshotsPath , GamePath + 'Screenshots' + PathDelim ); - initialize_path( CoversPath , GamePath + 'Covers' + PathDelim ); - initialize_path( LanguagesPath , GamePath + 'Languages' + PathDelim ); - initialize_path( PluginPath , GamePath + 'Plugins' + PathDelim ); - initialize_path( PlaylistPath , GamePath + 'Playlists' + PathDelim ); - - DecimalSeparator := ','; -end; - -end. - +unit UMain; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + SDL, + UGraphic, + UMusic, + URecord, + UTime, + SysUtils, + UDisplay, + UIni, + ULog, + ULyrics, + UScreenSing, + OpenGL12, + {$IFDEF UseSerialPort} + zlportio {you can disable it and all PortWriteB calls}, + {$ENDIF} + ULCD, + ULight, + UThemes; + +type + TPlayer = record + Name: string; + + Score: real; + ScoreLine: real; + ScoreGolden: real; + + ScoreI: integer; + ScoreLineI: integer; + ScoreGoldenI: integer; + ScoreTotalI: integer; + + + + //SingBar Mod + ScoreLast: Real;//Last Line Score + ScorePercent: integer;//Aktual Fillstate of the SingBar + ScorePercentTarget: integer;//Target Fillstate of the SingBar + //end Singbar Mod + + //PhrasenBonus - Line Bonus Mod + LineBonus_PosX: Single; + LineBonus_PosY: Single; + LineBonus_Alpha: Single; + LineBonus_Visible: boolean; + LineBonus_Text: string; + LineBonus_Color: TRGB; + LineBonus_Age: Integer; + LineBonus_Rating: Integer; + //Variable vor Positioning -> Set on ScreenShow, different when Playercount Changes + LineBonus_TargetX: integer; + LineBonus_TargetY: integer; + LineBonus_StartX: integer; + LineBonus_StartY: integer; + //PhrasenBonus - Line Bonus Mod End + + //PerfectLineTwinkle Mod (effect) + LastSentencePerfect: Boolean; + //PerfectLineTwinkle Mod end + + +// Meter: real; + + HighNut: integer; + IlNut: integer; + Nuta: array of record + Start: integer; + Dlugosc: integer; + Detekt: real; // dokladne miejsce, w ktorym wykryto ta nute + Ton: real; + Perfect: boolean; // true if the note matches the original one, lit the star + + + + // Half size Notes Patch + Hit: boolean; // true if the note Hits the Line + //end Half size Notes Patch + + + + end; + end; + + +var + //Absolute Paths + GamePath: string; + SoundPath: string; + SongPath: string; + LogPath: string; + ThemePath: string; + ScreenshotsPath: string; + CoversPath: string; + LanguagesPath: string; + PluginPath: string; + PlayListPath: string; + + OGL: Boolean; + Done: Boolean; + Event: TSDL_event; + FileName: string; + Restart: boolean; + + // gracz i jego nuty + Player: array of TPlayer; + PlayersPlay: integer; + +procedure InitializePaths; + +procedure MainLoop; +procedure CheckEvents; +procedure Sing(Sender: TScreenSing); +procedure NewSentence(Sender: TScreenSing); +procedure NewBeat(Sender: TScreenSing); // executed when on then new beat +procedure NewBeatC(Sender: TScreenSing); // executed when on then new beat for click +procedure NewBeatD(Sender: TScreenSing); // executed when on then new beat for detection +//procedure NewHalf; // executed when in the half between beats +procedure NewNote(Sender: TScreenSing); // detect note +function GetMidBeat(Time: real): real; +function GetTimeFromBeat(Beat: integer): real; +procedure ClearScores(PlayerNum: integer); + +implementation +uses USongs, UJoystick, math, UCommandLine; + +procedure MainLoop; +var + Delay: integer; +begin + SDL_EnableKeyRepeat(125, 125); + While not Done do + Begin + // joypad + if (Ini.Joypad = 1) OR (Params.Joypad) then + Joy.Update; + + // keyboard events + CheckEvents; + + // display + done := not Display.Draw; + SwapBuffers; + + // light + Light.Refresh; + + // delay + CountMidTime; +// if 1000*TimeMid > 100 then beep; + Delay := Floor(1000 / 100 - 1000 * TimeMid); + if Delay >= 1 then + SDL_Delay(Delay); // dynamic, maximum is 100 fps + CountSkipTime; + + // reinitialization of graphics + if Restart then begin + Reinitialize3D; + Restart := false; + end; + + End; + UnloadOpenGL; +End; + +Procedure CheckEvents; +//var +// p: pointer; +Begin + if not Assigned(Display.NextScreen) then + While SDL_PollEvent( @event ) = 1 Do + Begin +// beep; + Case Event.type_ Of + SDL_QUITEV: begin + Display.Fade := 0; + Display.NextScreenWithCheck := nil; + Display.CheckOK := True; + end; +{ SDL_MOUSEBUTTONDOWN: + With Event.button Do + Begin + If State = SDL_BUTTON_LEFT Then + Begin + // + End; + End; // With} + SDL_KEYDOWN: + begin + //ScreenShot hack. If Print is pressed-> Make screenshot and Save to Screenshots Path + if (Event.key.keysym.sym = SDLK_SYSREQ) then + Display.ScreenShot + + // popup hack... if there is a visible popup then let it handle input instead of underlying screen + // shoud be done in a way to be sure the topmost popup has preference (maybe error, then check) + else if (ScreenPopupError <> NIL) and (ScreenPopupError.Visible) then + done := not ScreenPopupError.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) + else if (ScreenPopupCheck <> NIL) AND (ScreenPopupCheck.Visible) then + done := not ScreenPopupCheck.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) + // end of popup hack + + else + begin + // check for Screen want to Exit + done := Not Display.ActualScreen^.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True); + + //If Screen wants to Exit + if done then + begin + //If Question Option is enabled then Show Exit Popup + if (Ini.AskbeforeDel = 1) then + begin + Display.ActualScreen^.CheckFadeTo(NIL,'MSG_QUIT_USDX'); + end + else //When asking for exit is disabled then simply exit + begin + Display.Fade := 0; + Display.NextScreenWithCheck := nil; + Display.CheckOK := True; + end; + end; + + end; // if (Not Display.ActualScreen^.ParseInput(Event.key.keysym.scancode, True)) then + end; +// SDL_JOYAXISMOTION: +// begin +// beep +// end; + SDL_JOYBUTTONDOWN: + begin + beep + end; + End; // Case Event.type_ + End; // While +End; // CheckEvents + +function GetTimeForBeats(BPM, Beats: real): real; +begin + Result := 60 / BPM * Beats; +end; + +function GetBeats(BPM, msTime: real): real; +begin + Result := BPM * msTime / 60; +end; + +procedure GetMidBeatSub(BPMNum: integer; var Time: real; var CurBeat: real); +var + NewTime: real; +begin + if High(AktSong.BPM) = BPMNum then begin + // last BPM + CurBeat := AktSong.BPM[BPMNum].StartBeat + GetBeats(AktSong.BPM[BPMNum].BPM, Time); + Time := 0; + end else begin + // not last BPM + // count how much time is it for start of the new BPM and store it in NewTime + NewTime := GetTimeForBeats(AktSong.BPM[BPMNum].BPM, AktSong.BPM[BPMNum+1].StartBeat - AktSong.BPM[BPMNum].StartBeat); + + // compare it to remaining time + if (Time - NewTime) > 0 then begin + // there is still remaining time + CurBeat := AktSong.BPM[BPMNum].StartBeat; + Time := Time - NewTime; + end else begin + // there is no remaining time + CurBeat := AktSong.BPM[BPMNum].StartBeat + GetBeats(AktSong.BPM[BPMNum].BPM, Time); + Time := 0; + end; // if + end; // if +end; + +function GetMidBeat(Time: real): real; +var + CurBeat: real; + CurBPM: integer; +// TopBeat: real; +// TempBeat: real; +// TempTime: real; +begin + Result := 0; + if Length(AktSong.BPM) = 1 then Result := Time * AktSong.BPM[0].BPM / 60; + + (* 2 BPMs *) +{ if Length(AktSong.BPM) > 1 then begin + (* new system *) + CurBeat := 0; + TopBeat := GetBeats(AktSong.BPM[0].BPM, Time); + if TopBeat > AktSong.BPM[1].StartBeat then begin + // analyze second BPM + Time := Time - GetTimeForBeats(AktSong.BPM[0].BPM, AktSong.BPM[1].StartBeat - CurBeat); + CurBeat := AktSong.BPM[1].StartBeat; + TopBeat := GetBeats(AktSong.BPM[1].BPM, Time); + Result := CurBeat + TopBeat; + + end else begin + (* pierwszy przedzial *) + Result := TopBeat; + end; + end; // if} + + (* more BPMs *) + if Length(AktSong.BPM) > 1 then begin + + CurBeat := 0; + CurBPM := 0; + while (Time > 0) do begin + GetMidBeatSub(CurBPM, Time, CurBeat); + Inc(CurBPM); + end; + + Result := CurBeat; + end; // if +end; + +function GetTimeFromBeat(Beat: integer): real; +var + CurBPM: integer; +begin + Result := 0; + if Length(AktSong.BPM) = 1 then Result := AktSong.GAP / 1000 + Beat * 60 / AktSong.BPM[0].BPM; + + (* more BPMs *) + if Length(AktSong.BPM) > 1 then begin + Result := AktSong.GAP / 1000; + CurBPM := 0; + while (CurBPM <= High(AktSong.BPM)) and (Beat > AktSong.BPM[CurBPM].StartBeat) do begin + if (CurBPM < High(AktSong.BPM)) and (Beat >= AktSong.BPM[CurBPM+1].StartBeat) then begin + // full range + Result := Result + (60 / AktSong.BPM[CurBPM].BPM) * (AktSong.BPM[CurBPM+1].StartBeat - AktSong.BPM[CurBPM].StartBeat); + end; + + if (CurBPM = High(AktSong.BPM)) or (Beat < AktSong.BPM[CurBPM+1].StartBeat) then begin + // in the middle + Result := Result + (60 / AktSong.BPM[CurBPM].BPM) * (Beat - AktSong.BPM[CurBPM].StartBeat); + end; + Inc(CurBPM); + end; + +{ while (Time > 0) do begin + GetMidBeatSub(CurBPM, Time, CurBeat); + Inc(CurBPM); + end;} + end; // if} +end; + +procedure Sing(Sender: TScreenSing); +var + Pet: integer; + PetGr: integer; + CP: integer; + Done: real; + N: integer; +begin + Czas.Teraz := Czas.Teraz + TimeSkip; + + Czas.OldBeat := Czas.AktBeat; + Czas.MidBeat := GetMidBeat(Czas.Teraz - (AktSong.Gap{ + 90 I've forgotten for what it is}) / 1000); // new system with variable BPM in function + Czas.AktBeat := Floor(Czas.MidBeat); + +// Czas.OldHalf := Czas.AktHalf; +// Czas.MidHalf := Czas.MidBeat + 0.5; +// Czas.AktHalf := Floor(Czas.MidHalf); + + Czas.OldBeatC := Czas.AktBeatC; + Czas.MidBeatC := GetMidBeat(Czas.Teraz - (AktSong.Gap) / 1000); + Czas.AktBeatC := Floor(Czas.MidBeatC); + + Czas.OldBeatD := Czas.AktBeatD; + Czas.MidBeatD := -0.5+GetMidBeat(Czas.Teraz - (AktSong.Gap + 120 + 20) / 1000); // MidBeat with addition GAP + Czas.AktBeatD := Floor(Czas.MidBeatD); + Czas.FracBeatD := Frac(Czas.MidBeatD); + + // sentences routines + for PetGr := 0 to 0 do begin;//High(Gracz) do begin + CP := PetGr; + // ustawianie starej czesci + Czas.OldCzesc := Czesci[CP].Akt; + + // wybieranie aktualnej czesci + for Pet := 0 to Czesci[CP].High do + if Czas.AktBeat >= Czesci[CP].Czesc[Pet].Start then Czesci[CP].Akt := Pet; + + // czysczenie nut gracza, gdy to jest nowa plansza + // (optymizacja raz na halfbeat jest zla) + if Czesci[CP].Akt <> Czas.OldCzesc then NewSentence(Sender); + + end; // for PetGr + + // wykonuje operacje raz na beat + if (Czas.AktBeat >= 0) and (Czas.OldBeat <> Czas.AktBeat) then + NewBeat(Sender); + + // make some operations on clicks + if {(Czas.AktBeatC >= 0) and }(Czas.OldBeatC <> Czas.AktBeatC) then + NewBeatC(Sender); + + // make some operations when detecting new voice pitch + if (Czas.AktBeatD >= 0) and (Czas.OldBeatD <> Czas.AktBeatD) then + NewBeatD(Sender); + + // wykonuje operacje w polowie beatu +// if (Czas.AktHalf >= 1) and (Czas.OldHalf <> Czas.AktHalf) then +// NewHalf; + + // plynnie przesuwa text + Done := 1; + for N := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start <= Czas.MidBeat) + and (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start + Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc >= Czas.MidBeat) then + Done := (Czas.MidBeat - Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start) / (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc); + + N := Czesci[0].Czesc[Czesci[0].Akt].HighNut; + + // wylacza ostatnia nute po przejsciu + {// todo: Lyrics + if (Ini.LyricsEffect = 1) and (Done = 1) and + (Czas.MidBeat > Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start + Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc) + then Sender.LyricMain.Selected := -1; + + if Done > 1 then Done := 1; + Sender.LyricMain.Done := Done; } + + // use Done with LCD +{ with ScreenSing do begin + if LyricMain.Selected >= 0 then begin + LCD.MoveCursor(1, LyricMain.SelectedLetter + Round((LyricMain.SelectedLength-1) * Done)); + LCD.ShowCursor; + end; + end;} + + +end; + +procedure NewSentence(Sender: TScreenSing); +var +G: Integer; +begin + // czyszczenie nut graczy + for G := 0 to High(Player) do begin + Player[G].IlNut := 0; + Player[G].HighNut := -1; + SetLength(Player[G].Nuta, 0); + end; + + // Add Words to Lyrics + with Sender do begin + {LyricMain.AddCzesc(Czesci[0].Akt); + if Czesci[0].Akt < Czesci[0].High then + LyricSub.AddCzesc(Czesci[0].Akt+1) + else + LyricSub.Clear;} + while (not Lyrics.LineinQueue) AND (Lyrics.LineCounter <= High(Czesci[0].Czesc)) do + Lyrics.AddLine(@Czesci[0].Czesc[Lyrics.LineCounter]); + end; + + Sender.UpdateLCD; + + //On Sentence Change... + Sender.onSentenceChange(Czesci[0].Akt); +end; + +procedure NewBeat(Sender: TScreenSing); +var + Pet: integer; +// TempBeat: integer; +begin + // ustawia zaznaczenie tekstu +// SingScreen.LyricMain.Selected := -1; + for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeat) then begin + // operates on currently beated note + //Todo: Lyrics + //Sender.LyricMain.Selected := Pet; + +// LCD.MoveCursor(1, ScreenSing.LyricMain.SelectedLetter); +// LCD.ShowCursor; + + //LCD.MoveCursorBR(Sender.LyricMain.SelectedLetter); + LCD.ShowCursor; + + end; +end; + +procedure NewBeatC; +var + Pet: integer; +// LPT_1: integer; +// LPT_2: integer; +begin +// LPT_1 := 1; +// LPT_2 := 1; + + // beat click + if (Ini.BeatClick = 1) and ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then + Music.PlayClick; + + // debug system on LPT + if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then begin + //LPT_1 := 0; +// Light.LightOne(0, 150); + + Light.LightOne(1, 200); // beat light + if ParamStr(1) = '-doublelights' then + Light.LightOne(0, 200); // beat light + + +{ if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod (Czesci[0].Resolution * 2) = 0) then + Light.LightOne(0, 150) + else + Light.LightOne(1, 150)} + end; + + for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeatC) then begin + // click assist + if Ini.ClickAssist = 1 then + Music.PlayClick; + + //LPT_2 := 0; + if ParamStr(1) <> '-doublelights' then + Light.LightOne(0, 150); //125 + + + // drum machine +(* TempBeat := Czas.AktBeat;// + 2; + if (TempBeat mod 8 = 0) then Music.PlayDrum; + if (TempBeat mod 8 = 4) then Music.PlayClap; +// if (TempBeat mod 4 = 2) then Music.PlayHihat; + if (TempBeat mod 4 <> 0) then Music.PlayHihat;*) + end; + + {$IFDEF UseSerialPort} + // PortWriteB($378, LPT_1 + LPT_2 * 2); // 0 zapala + {$ENDIF} +end; + +procedure NewBeatD(Sender: TScreenSing); +begin + NewNote(Sender); +end; + +//procedure NewHalf; +//begin +// NewNote; +//end; + +procedure NewNote(Sender: TScreenSing); +var + CP: integer; // current player + S: integer; // sentence + SMin: integer; + SMax: integer; + SDet: integer; // temporary: sentence of detected note + Pet: integer; + Mozna: boolean; + Nowa: boolean; + Range: integer; + NoteHit:boolean; +begin +// Log.LogStatus('Beat ' + IntToStr(Czas.AktBeat) + ' HalfBeat ' + IntToStr(Czas.AktHalf), 'NewBeat'); +// beep; + + // analizuje dla obu graczy ten sam sygnal (Sound.OneSrcForBoth) + // albo juz lepiej nie + for CP := 0 to PlayersPlay-1 do begin + + // analyze buffer + Sound[CP].AnalizujBufor; + + // adds some noise +// Czas.Ton := Czas.Ton + Round(Random(3)) - 1; + + // 0.5.0: count min and max sentence range for checking (detection is delayed to the notes we see on the screen) + SMin := Czesci[0].Akt-1; + if SMin < 0 then SMin := 0; + SMax := Czesci[0].Akt; + + // check if we can add new note + Mozna := false; + SDet:=SMin; + for S := SMin to SMax do + for Pet := 0 to Czesci[0].Czesc[S].HighNut do + if ((Czesci[0].Czesc[S].Nuta[Pet].Start <= Czas.AktBeatD) + and (Czesci[0].Czesc[S].Nuta[Pet].Start + Czesci[0].Czesc[S].Nuta[Pet].Dlugosc - 1 >= Czas.AktBeatD)) + and (not Czesci[0].Czesc[S].Nuta[Pet].FreeStyle) // but don't allow when it's FreeStyle note + and (Czesci[0].Czesc[S].Nuta[Pet].Dlugosc > 0) // and make sure the note lenghts is at least 1 + then begin + SDet := S; + Mozna := true; + Break; + end; + + S := SDet; + + + + + +// Czas.SzczytJest := true; +// Czas.Ton := 27; + + // gdy moze, to dodaje nute + if (Sound[CP].SzczytJest) and (Mozna) then begin + // operowanie na ostatniej nucie + for Pet := 0 to Czesci[0].Czesc[S].HighNut do + if (Czesci[0].Czesc[S].Nuta[Pet].Start <= Czas.OldBeatD+1) + and (Czesci[0].Czesc[S].Nuta[Pet].Start + + Czesci[0].Czesc[S].Nuta[Pet].Dlugosc > Czas.OldBeatD+1) then begin + // to robi, tylko dla pary nut (oryginalnej i gracza) + + // przesuwanie tonu w odpowiednia game + while (Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton > 6) do + Sound[CP].Ton := Sound[CP].Ton - 12; + while (Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton < -6) do + Sound[CP].Ton := Sound[CP].Ton + 12; + + // Half size Notes Patch + NoteHit := false; + + //if Ini.Difficulty = 0 then Range := 2; + //if Ini.Difficulty = 1 then Range := 1; + //if Ini.Difficulty = 2 then Range := 0; + Range := 2 - Ini.Difficulty; + if abs(Czesci[0].Czesc[S].Nuta[Pet].Ton - Sound[CP].Ton) <= Range then begin + Sound[CP].Ton := Czesci[0].Czesc[S].Nuta[Pet].Ton; + + + // Half size Notes Patch + NoteHit := true; + + + if (Ini.LineBonus = 0) then + begin + // add points without LineBonus + case Czesci[0].Czesc[S].Nuta[Pet].Wartosc of + 1: Player[CP].Score := Player[CP].Score + 10000 / Czesci[0].Wartosc * + Czesci[0].Czesc[S].Nuta[Pet].Wartosc; + 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 10000 / Czesci[0].Wartosc * + Czesci[0].Czesc[S].Nuta[Pet].Wartosc; + end; + end + else + begin + // add points with Line Bonus + case Czesci[0].Czesc[S].Nuta[Pet].Wartosc of + 1: Player[CP].Score := Player[CP].Score + 9000 / Czesci[0].Wartosc * + Czesci[0].Czesc[S].Nuta[Pet].Wartosc; + 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 9000 / Czesci[0].Wartosc * + Czesci[0].Czesc[S].Nuta[Pet].Wartosc; + end; + end; + + Player[CP].ScoreI := Floor(Player[CP].Score / 10) * 10; + Player[CP].ScoreGoldenI := Floor(Player[CP].ScoreGolden / 10) * 10; + + Player[CP].ScoreTotalI := Player[CP].ScoreI + Player[CP].ScoreGoldenI + Player[CP].ScoreLineI; + end; + + end; // operowanie + + // sprawdzanie czy to nowa nuta, czy przedluzenie + if S = SMax then begin + Nowa := true; + // jezeli ostatnia ma ten sam ton + if (Player[CP].IlNut > 0 ) and (Player[CP].Nuta[Player[CP].HighNut].Ton = Sound[CP].Ton) + and (Player[CP].Nuta[Player[CP].HighNut].Start + Player[CP].Nuta[Player[CP].HighNut].Dlugosc = Czas.AktBeatD) + then Nowa := false; + // jezeli jest jakas nowa nuta na sprawdzanym beacie + for Pet := 0 to Czesci[0].Czesc[S].HighNut do + if (Czesci[0].Czesc[S].Nuta[Pet].Start = Czas.AktBeatD) then + Nowa := true; + + // dodawanie nowej nuty + if Nowa then begin + // nowa nuta + Player[CP].IlNut := Player[CP].IlNut + 1; + Player[CP].HighNut := Player[CP].HighNut + 1; + SetLength(Player[CP].Nuta, Player[CP].IlNut); + Player[CP].Nuta[Player[CP].HighNut].Start := Czas.AktBeatD; + Player[CP].Nuta[Player[CP].HighNut].Dlugosc := 1; + Player[CP].Nuta[Player[CP].HighNut].Ton := Sound[CP].Ton; // Ton || TonDokl + Player[CP].Nuta[Player[CP].HighNut].Detekt := Czas.MidBeat; + + + // Half Note Patch + Player[CP].Nuta[Player[CP].HighNut].Hit := NoteHit; + + + // Log.LogStatus('Nowa Nuta ' + IntToStr(Gracz.Nuta[Gracz.HighNut].Start), 'NewBeat'); + + end else begin + // przedluzenie nuty + Player[CP].Nuta[Player[CP].HighNut].Dlugosc := Player[CP].Nuta[Player[CP].HighNut].Dlugosc + 1; + end; + + + // check for perfect note and then lit the star (on Draw) + for Pet := 0 to Czesci[0].Czesc[S].HighNut do + if (Czesci[0].Czesc[S].Nuta[Pet].Start = Player[CP].Nuta[Player[CP].HighNut].Start) + and (Czesci[0].Czesc[S].Nuta[Pet].Dlugosc = Player[CP].Nuta[Player[CP].HighNut].Dlugosc) + and (Czesci[0].Czesc[S].Nuta[Pet].Ton = Player[CP].Nuta[Player[CP].HighNut].Ton) then begin + Player[CP].Nuta[Player[CP].HighNut].Perfect := true; + end; + + end;// else beep; // if S = SMax + + end; // if moze + end; // for CP +// Log.LogStatus('EndBeat', 'NewBeat'); + +//On Sentence End -> For LineBonus + SingBar +if (sDet >= low(Czesci[0].Czesc)) AND (sDet <= high(Czesci[0].Czesc)) then +if ((Czesci[0].Czesc[SDet].Nuta[Czesci[0].Czesc[SDet].HighNut].Start + Czesci[0].Czesc[SDet].Nuta[Czesci[0].Czesc[SDet].HighNut].Dlugosc - 1) = Czas.AktBeatD) then + Sender.onSentenceEnd(sDet); + +end; + +procedure ClearScores(PlayerNum: integer); +begin + Player[PlayerNum].Score := 0; + Player[PlayerNum].ScoreI := 0; + Player[PlayerNum].ScoreLine := 0; + Player[PlayerNum].ScoreLineI := 0; + Player[PlayerNum].ScoreGolden := 0; + Player[PlayerNum].ScoreGoldenI := 0; + Player[PlayerNum].ScoreTotalI := 0; + + + //SingBar Mod + Player[PlayerNum].ScoreLast := 0; + Player[PlayerNum].ScorePercent := 50;// Sets to 50% when song starts + Player[PlayerNum].ScorePercentTarget := 50;// Sets to 50% when song starts + //end SingBar Mod + + //PhrasenBonus - Line Bonus Mod + Player[PlayerNum].LineBonus_Visible := False; //Hide Line Bonus + Player[PlayerNum].LineBonus_Alpha := 0; + Player[PlayerNum].LineBonus_TargetX := 70 + PlayerNum*500; + Player[PlayerNum].LineBonus_TargetY := 30; + //PhrasenBonus - Line Bonus Mod End +end; + +//-------------------- +// Function sets all Absolute Paths e.g. Song Path and makes sure the Directorys exist +//-------------------- +procedure InitializePaths; + + // Initialize a Path Variable + // After Setting Paths, make sure that Paths exist + function initialize_path( out aPathVar : String; const aLocation : String ): boolean; + var + lWriteable: Boolean; + begin + aPathVar := aLocation; + + If DirectoryExists(aPathVar) then + lWriteable := ForceDirectories(aPathVar) + else + lWriteable := false; + + if not lWriteable then + Log.LogError('Error: Dir ('+ aLocation +') is Readonly'); + + result := lWriteable; + end; + +begin + + GamePath := ExtractFilePath(ParamStr(0)); + + initialize_path( LogPath , GamePath ); + initialize_path( SoundPath , GamePath + 'Sounds' + PathDelim ); + initialize_path( SongPath , GamePath + 'Songs' + PathDelim ); + initialize_path( ThemePath , GamePath + 'Themes' + PathDelim ); + initialize_path( ScreenshotsPath , GamePath + 'Screenshots' + PathDelim ); + initialize_path( CoversPath , GamePath + 'Covers' + PathDelim ); + initialize_path( LanguagesPath , GamePath + 'Languages' + PathDelim ); + initialize_path( PluginPath , GamePath + 'Plugins' + PathDelim ); + initialize_path( PlaylistPath , GamePath + 'Playlists' + PathDelim ); + + DecimalSeparator := ','; +end; + +end. + diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index e2e1f27e..b9ed47b4 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -1,731 +1,735 @@ -unit UMusic; - -interface - -{$I switches.inc} - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - - -uses Classes, - {$IFDEF win32} - windows, - {$ENDIF} - UCommon, - Messages, - SysUtils, - {$IFNDEF FPC} - Forms, - {$ENDIF} - {$IFDEF useBASS} - bass, - {$ENDIF} - ULog, - USongs; - - -procedure InitializeSound; - -type - TSoundCard = record - Name: string; - Source: array of string; - end; - - TFFTData = array [0..256] of Single; - - TCustomSoundEntry = record - Filename : String; - Handle : hStream; - end; - - - TMusic = class - private - BassStart: hStream; // Wait, I've replaced this with BASS - BassBack: hStream; // It has almost all features we need - BassSwoosh: hStream; - BassChange: hStream; // Almost? It aleady has them all :) - BassOption: hStream; - BassClick: hStream; - BassDrum: hStream; - BassHihat: hStream; - BassClap: hStream; - BassShuffle: hStream; - - //Custom Sounds - CustomSounds: array of TCustomSoundEntry; - - - Loaded: boolean; - Loop: boolean; - public - Bass: hStream; - procedure InitializePlayback; - procedure InitializeRecord; - procedure SetVolume(Volume: integer); - procedure SetMusicVolume(Volume: integer); - procedure SetLoop(Enabled: boolean); - function Open(Name: string): boolean; // true if succeed - procedure Rewind; - procedure MoveTo(Time: real); - procedure Play; - procedure Pause; //Pause Mod - procedure Stop; - procedure Close; - function Finished: boolean; - function Length: real; - function Position: real; - procedure PlayStart; - procedure PlayBack; - procedure PlaySwoosh; - procedure PlayChange; - procedure PlayOption; - procedure PlayClick; - procedure PlayDrum; - procedure PlayHihat; - procedure PlayClap; - procedure PlayShuffle; - procedure StopShuffle; - procedure CaptureStart; - procedure CaptureStop; - procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); - procedure StopCard(Card: byte); - function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; - - //Equalizer - function GetFFTData: TFFTData; - - //Custom Sounds - function LoadCustomSound(const Filename: String): Cardinal; - procedure PlayCustomSound(const Index: Cardinal); - -end; - -const - RecordSystem = 1; - -type - TMuzyka = record - Path: string; - Start: integer; // start of song in ms - IlNut: integer; - DlugoscNut: integer; - end; - - TCzesci = record - Akt: integer; // aktualna czesc utworu do rysowania - High: integer; - Ilosc: integer; - Resolution: integer; - NotesGAP: integer; - Wartosc: integer; - Czesc: array of record - Start: integer; - StartNote: integer; - Lyric: string; - LyricWidth: real; - Koniec: integer; - BaseNote: integer; - HighNut: integer; - IlNut: integer; - TotalNotes: integer; - Nuta: array of record - Color: integer; - Start: integer; - Dlugosc: integer; - Ton: integer; - TonGamy: integer; - Tekst: string; - FreeStyle: boolean; - Wartosc: integer; // zwykla nuta x1, zlota nuta x2 - end; - end; - end; - - TCzas = record // wszystko, co dotyczy aktualnej klatki - OldBeat: integer; // poprzednio wykryty beat w utworze - AktBeat: integer; // aktualny beat w utworze - MidBeat: real; // dokladny AktBeat - - // now we use this for super synchronization! - // only used when analyzing voice - OldBeatD: integer; // poprzednio wykryty beat w utworze - AktBeatD: integer; // aktualny beat w utworze - MidBeatD: real; // dokladny AktBeatD - FracBeatD: real; // fractional part of MidBeatD - - // we use this for audiable clicks - OldBeatC: integer; // poprzednio wykryty beat w utworze - AktBeatC: integer; // aktualny beat w utworze - MidBeatC: real; // dokladny AktBeatC - FracBeatC: real; // fractional part of MidBeatC - - - OldCzesc: integer; // poprzednio wyswietlana czesc - // akt jest w czesci.akt - - Teraz: real; // aktualny czas w utworze - Razem: real; // caly czas utworu - end; - -var - Music: TMusic; - - // muzyka - Muzyka: TMuzyka; - - // czesci z nutami; - Czesci: array of TCzesci; - - // czas - Czas: TCzas; - - fHWND: Thandle; - -type - TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, - mpPaused, mpOpen); - -const - ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); - -implementation - -uses - {$IFDEF FPC} - lclintf, - {$ENDIF} - UGraphic, - URecord, - UFiles, - UIni, - UMain, - UThemes; - -procedure InitializeSound; -begin - Log.LogStatus('Initializing Playback', 'InitializeSound'); Music.InitializePlayback; - Log.LogStatus('Initializing Record', 'InitializeSound'); Music.InitializeRecord; -end; - -procedure TMusic.InitializePlayback; -var - Pet: integer; - S: integer; -begin - Log.BenchmarkStart(4); - Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); - - Loaded := false; - Loop := false; - - fHWND := AllocateHWND( nil); // TODO : JB_lazarus - can we do something different here ?? lazarus didnt like this function - - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - if not BASS_Init(1, 44100, 0, fHWND, nil) then - begin - {$IFNDEF FPC} - // TODO : JB_lazarus find a way to do this nice.. - Application.MessageBox ('Could not initialize BASS', 'Error'); - {$ENDIF} - Exit; - end; - {$ENDIF} - - Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); - - // config playing buffer -// BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); -// BASS_SetConfig(BASS_CONFIG_BUFFER, 100); - - Log.LogStatus('Loading Sounds', 'Music Initialize'); - - Log.BenchmarkStart(4); - LoadSoundFromFile(BassStart, SoundPath + 'Common Start.mp3'); - LoadSoundFromFile(BassBack, SoundPath + 'Common Back.mp3'); - LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3'); - LoadSoundFromFile(BassChange, SoundPath + 'select music change music 50.mp3'); - LoadSoundFromFile(BassOption, SoundPath + 'option change col.mp3'); - LoadSoundFromFile(BassClick, SoundPath + 'rimshot022b.mp3'); - -// LoadSoundFromFile(BassDrum, SoundPath + 'bassdrumhard076b.mp3'); -// LoadSoundFromFile(BassHihat, SoundPath + 'hihatclosed068b.mp3'); -// LoadSoundFromFile(BassClap, SoundPath + 'claps050b.mp3'); - -// LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3'); - - Log.BenchmarkEnd(4); Log.LogBenchmark('--> Loading Sounds', 4); -end; - -procedure TMusic.InitializeRecord; -var - S: integer; - device: integer; - descr: string; - input: integer; - input2: integer; - flags: integer; - mic: array[0..15] of integer; - SC: integer; // soundcard - SCI: integer; // soundcard input -begin - if RecordSystem = 1 then begin - SetLength(Sound, 6 {max players});//Ini.Players+1); - for S := 0 to High(Sound) do begin //Ini.Players do begin - Sound[S] := TSound.Create; - Sound[S].Num := S; - Sound[S].BufferNew := TMemoryStream.Create; - SetLength(Sound[S].BufferLong, 1); - Sound[S].BufferLong[0] := TMemoryStream.Create; - Sound[S].n := 4*1024; - end; - - - // check for recording devices; - {device := 0; - descr := BASS_RecordGetDeviceDescription(device); - - SetLength(SoundCard, 0); - while (descr <> '') do begin - SC := High(SoundCard) + 1; - SetLength(SoundCard, SC+1); - - Log.LogAnalyze('Device #'+IntToStr(device)+': '+ descr); - SoundCard[SC].Description := Descr; - - // check for recording inputs - mic[device] := -1; // default to no change - input := 0; - BASS_RecordInit(device); - Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); - flags := BASS_RecordGetInput(input); - - SetLength(SoundCard[SC].Input, 0); - while (flags <> -1) do begin - SCI := High(SoundCard[SC].Input) + 1; - SetLength(SoundCard[SC].Input, SCI+1); - - Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); - SoundCard[SC].Input[SCI].Name := BASS_RecordGetInputName(Input); - - if (flags and BASS_INPUT_TYPE_MASK) = BASS_INPUT_TYPE_MIC then begin - mic[device] := input; // auto set microphone - end; - Inc(Input); - flags := BASS_RecordGetInput(input); - end; - - if mic[device] <> -1 then begin - Log.LogAnalyze('Found the mic at input ' + IntToStr(Mic[device])) - end else begin - Log.LogAnalyze('Mic not found'); - mic[device] := 0; // setting to the first one (for kxproject) - end; - SoundCard[SC].InputSeleceted := Mic[Device]; - - - BASS_RecordFree; - - inc(Device); - descr := BASS_RecordGetDeviceDescription(Device); - end; // while} - end; // if -end; - -procedure TMusic.SetVolume(Volume: integer); -begin - //Old Sets Wave Volume - //BASS_SetVolume(Volume); - //New: Sets Volume only for this Application - - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); - {$ENDIF} -end; - -procedure TMusic.SetMusicVolume(Volume: Integer); -begin - //Max Volume Prevention - if Volume > 100 then - Volume := 100; - - //Set Volume - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelSetAttributes (Bass, -1, Volume, -101); - {$ENDIF} -end; - -procedure TMusic.SetLoop(Enabled: boolean); -begin - Loop := Enabled; -end; - -function TMusic.Open(Name: string): boolean; -begin - Loaded := false; - if FileExists(Name) then - begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); - {$ENDIF} - - Loaded := true; - //Set Max Volume - SetMusicVolume (100); - end; - - Result := Loaded; -end; - -procedure TMusic.Rewind; -begin - if Loaded then begin - end; -end; - -procedure TMusic.MoveTo(Time: real); -var - bytes: integer; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - bytes := BASS_ChannelSeconds2Bytes(Bass, Time); - BASS_ChannelSetPosition(Bass, bytes); - {$ENDIF} -end; - -procedure TMusic.Play; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - if Loaded then - begin - if Loop then - BASS_ChannelPlay(Bass, True); // start from beginning... actually bass itself does not loop, nor does this TMusic Class - - BASS_ChannelPlay(Bass, False); // for setting position before playing - end; - {$ENDIF} -end; - -procedure TMusic.Pause; //Pause Mod -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - if Loaded then begin - BASS_ChannelPause(Bass); // Pauses Song - end; - {$ENDIF} -end; - -procedure TMusic.Stop; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - Bass_ChannelStop(Bass); - {$ENDIF} -end; - -procedure TMusic.Close; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - Bass_StreamFree(Bass); - {$ENDIF} -end; - -function TMusic.Length: real; -var - bytes: integer; -begin - Result := 60; - - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - bytes := BASS_ChannelGetLength(Bass); - Result := BASS_ChannelBytes2Seconds(Bass, bytes); - {$ENDIF} -end; - -function TMusic.Position: real; -var - bytes: integer; -begin - Result := 0; - - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - bytes := BASS_ChannelGetPosition(BASS); - Result := BASS_ChannelBytes2Seconds(BASS, bytes); - {$ENDIF} -end; - -function TMusic.Finished: boolean; -begin - Result := false; - - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then - begin - Result := true; - end; - {$ENDIF} -end; - -procedure TMusic.PlayStart; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassStart, True); - {$ENDIF} -end; - -procedure TMusic.PlayBack; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassBack, True);// then - {$ENDIF} -end; - -procedure TMusic.PlaySwoosh; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassSwoosh, True); - {$ENDIF} -end; - -procedure TMusic.PlayChange; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassChange, True); - {$ENDIF} -end; - -procedure TMusic.PlayOption; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassOption, True); - {$ENDIF} -end; - -procedure TMusic.PlayClick; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassClick, True); - {$ENDIF} -end; - -procedure TMusic.PlayDrum; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassDrum, True); - {$ENDIF} -end; - -procedure TMusic.PlayHihat; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassHihat, True); - {$ENDIF} -end; - -procedure TMusic.PlayClap; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassClap, True); - {$ENDIF} -end; - -procedure TMusic.PlayShuffle; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassShuffle, True); - {$ENDIF} -end; - -procedure TMusic.StopShuffle; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelStop(BassShuffle); - {$ENDIF} -end; - -procedure TMusic.CaptureStart; -var - S: integer; - SC: integer; - P1: integer; - P2: integer; -begin - for S := 0 to High(Sound) do - Sound[S].BufferLong[0].Clear; - - for SC := 0 to High(Ini.CardList) do begin - P1 := Ini.CardList[SC].ChannelL; - P2 := Ini.CardList[SC].ChannelR; - if P1 > PlayersPlay then P1 := 0; - if P2 > PlayersPlay then P2 := 0; - if (P1 > 0) or (P2 > 0) then - CaptureCard(SC, P1, P2); - end; -end; - -procedure TMusic.CaptureStop; -var - SC: integer; - P1: integer; - P2: integer; -begin - - for SC := 0 to High(Ini.CardList) do begin - P1 := Ini.CardList[SC].ChannelL; - P2 := Ini.CardList[SC].ChannelR; - if P1 > PlayersPlay then P1 := 0; - if P2 > PlayersPlay then P2 := 0; - if (P1 > 0) or (P2 > 0) then StopCard(SC); - end; - -end; - -//procedure TMusic.CaptureCard(RecordI, SoundNum, PlayerLeft, PlayerRight: byte); -procedure TMusic.CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); -var - Error: integer; - ErrorMsg: string; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - - if not BASS_RecordInit(RecordI) then begin - Error := BASS_ErrorGetCode; - - ErrorMsg := IntToStr(Error); - if Error = BASS_ERROR_DX then ErrorMsg := 'No DX5'; - if Error = BASS_ERROR_ALREADY then ErrorMsg := 'The device has already been initialized'; - if Error = BASS_ERROR_DEVICE then ErrorMsg := 'The device number specified is invalid'; - if Error = BASS_ERROR_DRIVER then ErrorMsg := 'There is no available device driver'; - - {Log.LogAnalyze('Error initializing record [' + IntToStr(RecordI) + ', ' - + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' - + ErrorMsg);} - Log.LogError('Error initializing record [' + IntToStr(RecordI) + ', ' - + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' - + ErrorMsg); - Log.LogError('Music -> CaptureCard: Error initializing record: ' + ErrorMsg); - - - end - else - begin - Recording.SoundCard[RecordI].BassRecordStream := BASS_RecordStart(44100, 2, MakeLong(0, 20) , @GetMicrophone, PlayerLeft + PlayerRight*256); - end; - - {$ENDIF} -end; - -procedure TMusic.StopCard(Card: byte); -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_RecordSetDevice(Card); - BASS_RecordFree; - {$ENDIF} -end; - -function TMusic.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; -var - L: Integer; -begin - if FileExists(Name) then begin - Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); - try - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); - {$ENDIF} - - //Add CustomSound - L := High(CustomSounds) + 1; - SetLength (CustomSounds, L + 1); - CustomSounds[L].Filename := Name; - CustomSounds[L].Handle := hStream; - except - Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); - end; - end else begin - Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); - exit; - end; -end; - -//Equalizer -function TMusic.GetFFTData: TFFTData; -var -Data: TFFTData; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - - //Get Channel Data Mono and 256 Values - BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); - //Result := Data; - - {$ENDIF} -end; - -function TMusic.LoadCustomSound(const Filename: String): Cardinal; -var - S: hStream; - I: Integer; - F: String; -begin - //Search for Sound in already loaded Sounds - F := UpperCase(SoundPath + FileName); - For I := 0 to High(CustomSounds) do - begin - if (UpperCase(CustomSounds[I].Filename) = F) then - begin - Result := I; - Exit; - end; - end; - - if LoadSoundFromFile(S, SoundPath + Filename) then - Result := High(CustomSounds) - else - Result := 0; -end; - -procedure TMusic.PlayCustomSound(const Index: Cardinal); -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - - if Index <= High(CustomSounds) then - BASS_ChannelPlay(CustomSounds[Index].Handle, True); - - {$ENDIF} -end; - - -end. +unit UMusic; + +interface + +{$I switches.inc} + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + + +uses Classes, + {$IFDEF win32} + windows, + {$ENDIF} + UCommon, + Messages, + SysUtils, + {$IFNDEF FPC} + Forms, + {$ENDIF} + {$IFDEF useBASS} + bass, + {$ENDIF} + ULog, + USongs; + + +procedure InitializeSound; + +type + TSoundCard = record + Name: string; + Source: array of string; + end; + + TFFTData = array [0..256] of Single; + + TCustomSoundEntry = record + Filename : String; + Handle : hStream; + end; + + + TMusic = class + private + BassStart: hStream; // Wait, I've replaced this with BASS + BassBack: hStream; // It has almost all features we need + BassSwoosh: hStream; + BassChange: hStream; // Almost? It aleady has them all :) + BassOption: hStream; + BassClick: hStream; + BassDrum: hStream; + BassHihat: hStream; + BassClap: hStream; + BassShuffle: hStream; + + //Custom Sounds + CustomSounds: array of TCustomSoundEntry; + + + Loaded: boolean; + Loop: boolean; + public + Bass: hStream; + procedure InitializePlayback; + procedure InitializeRecord; + procedure SetVolume(Volume: integer); + procedure SetMusicVolume(Volume: integer); + procedure SetLoop(Enabled: boolean); + function Open(Name: string): boolean; // true if succeed + procedure Rewind; + procedure MoveTo(Time: real); + procedure Play; + procedure Pause; //Pause Mod + procedure Stop; + procedure Close; + function Finished: boolean; + function Length: real; + function Position: real; + procedure PlayStart; + procedure PlayBack; + procedure PlaySwoosh; + procedure PlayChange; + procedure PlayOption; + procedure PlayClick; + procedure PlayDrum; + procedure PlayHihat; + procedure PlayClap; + procedure PlayShuffle; + procedure StopShuffle; + procedure CaptureStart; + procedure CaptureStop; + procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); + procedure StopCard(Card: byte); + function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; + + //Equalizer + function GetFFTData: TFFTData; + + //Custom Sounds + function LoadCustomSound(const Filename: String): Cardinal; + procedure PlayCustomSound(const Index: Cardinal); + +end; + +const + RecordSystem = 1; + +type + TMuzyka = record + Path: string; + Start: integer; // start of song in ms + IlNut: integer; + DlugoscNut: integer; + end; + + PLine = ^TLine; + TLine = record + Start: integer; + StartNote: integer; + Lyric: string; + LyricWidth: real; + Koniec: integer; + BaseNote: integer; + HighNut: integer; + IlNut: integer; + TotalNotes: integer; + Nuta: array of record + Color: integer; + Start: integer; + Dlugosc: integer; + Ton: integer; + TonGamy: integer; + Tekst: string; + FreeStyle: boolean; + Wartosc: integer; // zwykla nuta x1, zlota nuta x2 + end; + end; + ALine = array of TLine; + + TCzesci = record + Akt: integer; // aktualna czesc utworu do rysowania + High: integer; + Ilosc: integer; + Resolution: integer; + NotesGAP: integer; + Wartosc: integer; + Czesc: ALine; + end; + + TCzas = record // wszystko, co dotyczy aktualnej klatki + OldBeat: integer; // poprzednio wykryty beat w utworze + AktBeat: integer; // aktualny beat w utworze + MidBeat: real; // dokladny AktBeat + + // now we use this for super synchronization! + // only used when analyzing voice + OldBeatD: integer; // poprzednio wykryty beat w utworze + AktBeatD: integer; // aktualny beat w utworze + MidBeatD: real; // dokladny AktBeatD + FracBeatD: real; // fractional part of MidBeatD + + // we use this for audiable clicks + OldBeatC: integer; // poprzednio wykryty beat w utworze + AktBeatC: integer; // aktualny beat w utworze + MidBeatC: real; // dokladny AktBeatC + FracBeatC: real; // fractional part of MidBeatC + + + OldCzesc: integer; // poprzednio wyswietlana czesc + // akt jest w czesci.akt + + Teraz: real; // aktualny czas w utworze + Razem: real; // caly czas utworu + end; + +var + Music: TMusic; + + // muzyka + Muzyka: TMuzyka; + + // czesci z nutami; + Czesci: array of TCzesci; + + // czas + Czas: TCzas; + + fHWND: Thandle; + +type + TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, + mpPaused, mpOpen); + +const + ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); + +implementation + +uses + {$IFDEF FPC} + lclintf, + {$ENDIF} + UGraphic, + URecord, + UFiles, + UIni, + UMain, + UThemes; + +procedure InitializeSound; +begin + Log.LogStatus('Initializing Playback', 'InitializeSound'); Music.InitializePlayback; + Log.LogStatus('Initializing Record', 'InitializeSound'); Music.InitializeRecord; +end; + +procedure TMusic.InitializePlayback; +var + Pet: integer; + S: integer; +begin + Log.BenchmarkStart(4); + Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); + + Loaded := false; + Loop := false; + + fHWND := AllocateHWND( nil); // TODO : JB_lazarus - can we do something different here ?? lazarus didnt like this function + + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + if not BASS_Init(1, 44100, 0, fHWND, nil) then + begin + {$IFNDEF FPC} + // TODO : JB_lazarus find a way to do this nice.. + Application.MessageBox ('Could not initialize BASS', 'Error'); + {$ENDIF} + Exit; + end; + {$ENDIF} + + Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); + + // config playing buffer +// BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); +// BASS_SetConfig(BASS_CONFIG_BUFFER, 100); + + Log.LogStatus('Loading Sounds', 'Music Initialize'); + + Log.BenchmarkStart(4); + LoadSoundFromFile(BassStart, SoundPath + 'Common Start.mp3'); + LoadSoundFromFile(BassBack, SoundPath + 'Common Back.mp3'); + LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3'); + LoadSoundFromFile(BassChange, SoundPath + 'select music change music 50.mp3'); + LoadSoundFromFile(BassOption, SoundPath + 'option change col.mp3'); + LoadSoundFromFile(BassClick, SoundPath + 'rimshot022b.mp3'); + +// LoadSoundFromFile(BassDrum, SoundPath + 'bassdrumhard076b.mp3'); +// LoadSoundFromFile(BassHihat, SoundPath + 'hihatclosed068b.mp3'); +// LoadSoundFromFile(BassClap, SoundPath + 'claps050b.mp3'); + +// LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3'); + + Log.BenchmarkEnd(4); Log.LogBenchmark('--> Loading Sounds', 4); +end; + +procedure TMusic.InitializeRecord; +var + S: integer; + device: integer; + descr: string; + input: integer; + input2: integer; + flags: integer; + mic: array[0..15] of integer; + SC: integer; // soundcard + SCI: integer; // soundcard input +begin + if RecordSystem = 1 then begin + SetLength(Sound, 6 {max players});//Ini.Players+1); + for S := 0 to High(Sound) do begin //Ini.Players do begin + Sound[S] := TSound.Create; + Sound[S].Num := S; + Sound[S].BufferNew := TMemoryStream.Create; + SetLength(Sound[S].BufferLong, 1); + Sound[S].BufferLong[0] := TMemoryStream.Create; + Sound[S].n := 4*1024; + end; + + + // check for recording devices; + {device := 0; + descr := BASS_RecordGetDeviceDescription(device); + + SetLength(SoundCard, 0); + while (descr <> '') do begin + SC := High(SoundCard) + 1; + SetLength(SoundCard, SC+1); + + Log.LogAnalyze('Device #'+IntToStr(device)+': '+ descr); + SoundCard[SC].Description := Descr; + + // check for recording inputs + mic[device] := -1; // default to no change + input := 0; + BASS_RecordInit(device); + Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); + flags := BASS_RecordGetInput(input); + + SetLength(SoundCard[SC].Input, 0); + while (flags <> -1) do begin + SCI := High(SoundCard[SC].Input) + 1; + SetLength(SoundCard[SC].Input, SCI+1); + + Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); + SoundCard[SC].Input[SCI].Name := BASS_RecordGetInputName(Input); + + if (flags and BASS_INPUT_TYPE_MASK) = BASS_INPUT_TYPE_MIC then begin + mic[device] := input; // auto set microphone + end; + Inc(Input); + flags := BASS_RecordGetInput(input); + end; + + if mic[device] <> -1 then begin + Log.LogAnalyze('Found the mic at input ' + IntToStr(Mic[device])) + end else begin + Log.LogAnalyze('Mic not found'); + mic[device] := 0; // setting to the first one (for kxproject) + end; + SoundCard[SC].InputSeleceted := Mic[Device]; + + + BASS_RecordFree; + + inc(Device); + descr := BASS_RecordGetDeviceDescription(Device); + end; // while} + end; // if +end; + +procedure TMusic.SetVolume(Volume: integer); +begin + //Old Sets Wave Volume + //BASS_SetVolume(Volume); + //New: Sets Volume only for this Application + + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); + {$ENDIF} +end; + +procedure TMusic.SetMusicVolume(Volume: Integer); +begin + //Max Volume Prevention + if Volume > 100 then + Volume := 100; + + //Set Volume + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelSetAttributes (Bass, -1, Volume, -101); + {$ENDIF} +end; + +procedure TMusic.SetLoop(Enabled: boolean); +begin + Loop := Enabled; +end; + +function TMusic.Open(Name: string): boolean; +begin + Loaded := false; + if FileExists(Name) then + begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); + {$ENDIF} + + Loaded := true; + //Set Max Volume + SetMusicVolume (100); + end; + + Result := Loaded; +end; + +procedure TMusic.Rewind; +begin + if Loaded then begin + end; +end; + +procedure TMusic.MoveTo(Time: real); +var + bytes: integer; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + bytes := BASS_ChannelSeconds2Bytes(Bass, Time); + BASS_ChannelSetPosition(Bass, bytes); + {$ENDIF} +end; + +procedure TMusic.Play; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + if Loaded then + begin + if Loop then + BASS_ChannelPlay(Bass, True); // start from beginning... actually bass itself does not loop, nor does this TMusic Class + + BASS_ChannelPlay(Bass, False); // for setting position before playing + end; + {$ENDIF} +end; + +procedure TMusic.Pause; //Pause Mod +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + if Loaded then begin + BASS_ChannelPause(Bass); // Pauses Song + end; + {$ENDIF} +end; + +procedure TMusic.Stop; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + Bass_ChannelStop(Bass); + {$ENDIF} +end; + +procedure TMusic.Close; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + Bass_StreamFree(Bass); + {$ENDIF} +end; + +function TMusic.Length: real; +var + bytes: integer; +begin + Result := 60; + + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + bytes := BASS_ChannelGetLength(Bass); + Result := BASS_ChannelBytes2Seconds(Bass, bytes); + {$ENDIF} +end; + +function TMusic.Position: real; +var + bytes: integer; +begin + Result := 0; + + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + bytes := BASS_ChannelGetPosition(BASS); + Result := BASS_ChannelBytes2Seconds(BASS, bytes); + {$ENDIF} +end; + +function TMusic.Finished: boolean; +begin + Result := false; + + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then + begin + Result := true; + end; + {$ENDIF} +end; + +procedure TMusic.PlayStart; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassStart, True); + {$ENDIF} +end; + +procedure TMusic.PlayBack; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassBack, True);// then + {$ENDIF} +end; + +procedure TMusic.PlaySwoosh; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassSwoosh, True); + {$ENDIF} +end; + +procedure TMusic.PlayChange; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassChange, True); + {$ENDIF} +end; + +procedure TMusic.PlayOption; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassOption, True); + {$ENDIF} +end; + +procedure TMusic.PlayClick; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassClick, True); + {$ENDIF} +end; + +procedure TMusic.PlayDrum; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassDrum, True); + {$ENDIF} +end; + +procedure TMusic.PlayHihat; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassHihat, True); + {$ENDIF} +end; + +procedure TMusic.PlayClap; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassClap, True); + {$ENDIF} +end; + +procedure TMusic.PlayShuffle; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassShuffle, True); + {$ENDIF} +end; + +procedure TMusic.StopShuffle; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelStop(BassShuffle); + {$ENDIF} +end; + +procedure TMusic.CaptureStart; +var + S: integer; + SC: integer; + P1: integer; + P2: integer; +begin + for S := 0 to High(Sound) do + Sound[S].BufferLong[0].Clear; + + for SC := 0 to High(Ini.CardList) do begin + P1 := Ini.CardList[SC].ChannelL; + P2 := Ini.CardList[SC].ChannelR; + if P1 > PlayersPlay then P1 := 0; + if P2 > PlayersPlay then P2 := 0; + if (P1 > 0) or (P2 > 0) then + CaptureCard(SC, P1, P2); + end; +end; + +procedure TMusic.CaptureStop; +var + SC: integer; + P1: integer; + P2: integer; +begin + + for SC := 0 to High(Ini.CardList) do begin + P1 := Ini.CardList[SC].ChannelL; + P2 := Ini.CardList[SC].ChannelR; + if P1 > PlayersPlay then P1 := 0; + if P2 > PlayersPlay then P2 := 0; + if (P1 > 0) or (P2 > 0) then StopCard(SC); + end; + +end; + +//procedure TMusic.CaptureCard(RecordI, SoundNum, PlayerLeft, PlayerRight: byte); +procedure TMusic.CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); +var + Error: integer; + ErrorMsg: string; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + + if not BASS_RecordInit(RecordI) then begin + Error := BASS_ErrorGetCode; + + ErrorMsg := IntToStr(Error); + if Error = BASS_ERROR_DX then ErrorMsg := 'No DX5'; + if Error = BASS_ERROR_ALREADY then ErrorMsg := 'The device has already been initialized'; + if Error = BASS_ERROR_DEVICE then ErrorMsg := 'The device number specified is invalid'; + if Error = BASS_ERROR_DRIVER then ErrorMsg := 'There is no available device driver'; + + {Log.LogAnalyze('Error initializing record [' + IntToStr(RecordI) + ', ' + + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' + + ErrorMsg);} + Log.LogError('Error initializing record [' + IntToStr(RecordI) + ', ' + + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' + + ErrorMsg); + Log.LogError('Music -> CaptureCard: Error initializing record: ' + ErrorMsg); + + + end + else + begin + Recording.SoundCard[RecordI].BassRecordStream := BASS_RecordStart(44100, 2, MakeLong(0, 20) , @GetMicrophone, PlayerLeft + PlayerRight*256); + end; + + {$ENDIF} +end; + +procedure TMusic.StopCard(Card: byte); +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_RecordSetDevice(Card); + BASS_RecordFree; + {$ENDIF} +end; + +function TMusic.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; +var + L: Integer; +begin + if FileExists(Name) then begin + Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); + try + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); + {$ENDIF} + + //Add CustomSound + L := High(CustomSounds) + 1; + SetLength (CustomSounds, L + 1); + CustomSounds[L].Filename := Name; + CustomSounds[L].Handle := hStream; + except + Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); + end; + end else begin + Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); + exit; + end; +end; + +//Equalizer +function TMusic.GetFFTData: TFFTData; +var +Data: TFFTData; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + + //Get Channel Data Mono and 256 Values + BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); + //Result := Data; + + {$ENDIF} +end; + +function TMusic.LoadCustomSound(const Filename: String): Cardinal; +var + S: hStream; + I: Integer; + F: String; +begin + //Search for Sound in already loaded Sounds + F := UpperCase(SoundPath + FileName); + For I := 0 to High(CustomSounds) do + begin + if (UpperCase(CustomSounds[I].Filename) = F) then + begin + Result := I; + Exit; + end; + end; + + if LoadSoundFromFile(S, SoundPath + Filename) then + Result := High(CustomSounds) + else + Result := 0; +end; + +procedure TMusic.PlayCustomSound(const Index: Cardinal); +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + + if Index <= High(CustomSounds) then + BASS_ChannelPlay(CustomSounds[Index].Handle, True); + + {$ENDIF} +end; + + +end. diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 6436ee39..1e102987 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -18,6 +18,10 @@ type B: single; end; + TRGBA = record + R, G, B, A: Double; + end; + TThemeBackground = record Tex: string; end; diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 3843fbf4..93a4892a 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -16,7 +16,7 @@ uses ULog, UTexture, UMenuText, - ULyrics, + ULyrics.bak, Math, OpenGL12, {$IFDEF UseMIDIPort} diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 343a2e6d..ff6bfe20 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1,1256 +1,1301 @@ -unit UScreenSing; - -interface - -{$I switches.inc} - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - -uses UMenu, - UMusic, - SDL, - SysUtils, - UFiles, - UTime, - USongs, - UIni, - ULog, - UTexture, - ULyrics, - TextGL, - OpenGL12, - {$IFDEF useBASS} - bass, - {$ENDIF} - UThemes, - ULCD, - UGraphicClasses, - UVideo; - -type - TScreenSing = class(TMenu) - protected - paused: boolean; //Pause Mod - PauseTime: Real; - NumEmptySentences: integer; - public - //TextTime: integer; - - //TimeBar mod - StaticTimeProgress: integer; - TextTimeText: integer; - //eoa TimeBar mod - - StaticP1: integer; - StaticP1ScoreBG: integer; - TextP1: integer; - TextP1Score: integer; - - //moveable singbar mod - StaticP1SingBar: integer; - StaticP1ThreePSingBar: integer; - StaticP1TwoPSingBar: integer; - StaticP2RSingBar: integer; - StaticP2MSingBar: integer; - StaticP3SingBar: integer; - //eoa moveable singbar - - //Added for ps3 skin - //shown when game is in 2/4 player modus - StaticP1TwoP: integer; - StaticP1TwoPScoreBG: integer; - TextP1TwoP: integer; - TextP1TwoPScore: integer; - //shown when game is in 3/6 player modus - StaticP1ThreeP: integer; - StaticP1ThreePScoreBG: integer; - TextP1ThreeP: integer; - TextP1ThreePScore: integer; - //eoa - - StaticP2R: integer; - StaticP2RScoreBG: integer; - TextP2R: integer; - TextP2RScore: integer; - - StaticP2M: integer; - StaticP2MScoreBG: integer; - TextP2M: integer; - TextP2MScore: integer; - - StaticP3R: integer; - StaticP3RScoreBG: integer; - TextP3R: integer; - TextP3RScore: integer; - - Tex_Background: TTexture; - FadeOut: boolean; - LyricMain: TLyric; - LyricSub: TLyric; - - constructor Create; override; - procedure onShow; override; - procedure onShowFinish; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure Finish; virtual; - procedure UpdateLCD; - procedure Pause; //Pause Mod(Toggles Pause) - - //OnSentenceEnd for LineBonus + Singbar - procedure onSentenceEnd(S: Cardinal); - //OnSentenceChange (for Golden Notes) - procedure onSentenceChange(S: Cardinal); - end; - -implementation -uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math; - -// Method for input parsing. If False is returned, GetNextWindow -// should be checked to know the next window to load; -function TScreenSing.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then - begin // Key Down - case PressedKey of - SDLK_Q: - begin - //When not ask before Exit then Finish now - if (Ini.AskbeforeDel <> 1) then - Finish - //else just Pause and let the Popup make the Work - else if not paused then - Pause; - - Result := false; - end; - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - //Record Sound Hack: - //Sound[0].BufferLong - - Finish; - Music.PlayBack; - FadeTo(@ScreenScore); - end; - - SDLK_P://Pause Mod - begin - Pause; - end; - - SDLK_RETURN: - begin - end; - - // Up and Down could be done at the same time, - // but I don't want to declare variables inside - // functions like this one, called so many times - SDLK_DOWN : - begin - end; - SDLK_UP : - begin - end; - end; - end; -end; - -//Pause Mod -procedure TScreenSing.Pause; -begin - if not paused then //Pause einschalten - begin - // pause Time - PauseTime := Czas.Teraz; - Paused := true; - - // pause Music - Music.Pause; - - // pause Video - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then - FFmpegTogglePause; - end - else //Pause ausschalten - begin - Czas.Teraz := PauseTime; //Position of Notes - - // Position of Music - Music.MoveTo (PauseTime); - // Play Music - Music.Play; - - // Video - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then - FFmpegTogglePause; - //SkipSmpeg(PauseTime); - - Paused := false; - end; -end; -//Pause Mod End - -constructor TScreenSing.Create; -var - I: integer; - P: integer; -begin - inherited Create; - - LoadFromTheme(Theme.Sing); - - //TimeBar - StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); - TextTimeText := AddText(Theme.Sing.TextTimeText); - -// 1 player | P1 - StaticP1 := AddStatic(Theme.Sing.StaticP1); - StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); - TextP1 := AddText(Theme.Sing.TextP1); - TextP1Score := AddText(Theme.Sing.TextP1Score); - StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar); - -// 2 or 4 players | P1 - StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); - StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG); - TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); - TextP1TwoPScore := AddText(Theme.Sing.TextP1TwoPScore); - StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); - - // | P2 - StaticP2R := AddStatic(Theme.Sing.StaticP2R); - StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); - TextP2R := AddText(Theme.Sing.TextP2R); - TextP2RScore := AddText(Theme.Sing.TextP2RScore); - StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); - -// 3 or 6 players | P1 - StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); - StaticP1ThreePScoreBG := AddStatic(Theme.Sing.StaticP1ThreePScoreBG); - TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); - TextP1ThreePScore := AddText(Theme.Sing.TextP1ThreePScore); - StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar); - - // | P2 - StaticP2M := AddStatic(Theme.Sing.StaticP2M); - StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG); - TextP2M := AddText(Theme.Sing.TextP2M); - TextP2MScore := AddText(Theme.Sing.TextP2MScore); - StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar); - - // | P3 - StaticP3R := AddStatic(Theme.Sing.StaticP3R); - StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG); - TextP3R := AddText(Theme.Sing.TextP3R); - TextP3RScore := AddText(Theme.Sing.TextP3RScore); - StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar); - - if ScreenAct = 2 then begin - // katze und affe - - end; - - LyricMain := TLyric.Create; - LyricSub := TLyric.Create; - - UVideo.Init; -end; - -procedure TScreenSing.onShow; -var - P: integer; - V1: boolean; - V1TwoP: boolean; //added for ps3 skin - V1ThreeP: boolean; //added for ps3 skin - V2R: boolean; - V2M: boolean; - V3R: boolean; - NR: TRecR; //Line Bonus Mod -begin - Log.LogStatus('Begin', 'onShow'); - FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented - - // prepare players - SetLength(Player, PlayersPlay); -// Player[0].ScoreTotalI := 0; - - case PlayersPlay of - 1: begin - V1 := true; - V1TwoP := false; - V1ThreeP := false; - V2R := false; - V2M := false; - V3R := false; - end; - 2: begin - V1 := false; - V1TwoP := true; - V1ThreeP := false; - V2R := true; - V2M := false; - V3R := false; - end; - 3: begin - V1 := false; - V1TwoP := false; - V1ThreeP := true; - V2R := false; - V2M := true; - V3R := true; - end; - 4: begin // double screen - V1 := false; - V1TwoP := true; - V1ThreeP := false; - V2R := true; - V2M := false; - V3R := false; - end; - 6: begin // double screen - V1 := false; - V1TwoP := false; - V1ThreeP := true; - V2R := false; - V2M := true; - V3R := true; - end; - - end; - - //This one is shown in 1P mode - Static[StaticP1].Visible := V1; - Static[StaticP1ScoreBG].Visible := V1; - Text[TextP1].Visible := V1; - Text[TextP1Score].Visible := V1; - - - //This one is shown in 2/4P mode - Static[StaticP1TwoP].Visible := V1TwoP; - Static[StaticP1TwoPScoreBG].Visible := V1TwoP; - Text[TextP1TwoP].Visible := V1TwoP; - Text[TextP1TwoPScore].Visible := V1TwoP; - - Static[StaticP2R].Visible := V2R; - Static[StaticP2RScoreBG].Visible := V2R; - Text[TextP2R].Visible := V2R; - Text[TextP2RScore].Visible := V2R; - - - //This one is shown in 3/6P mode - Static[StaticP1ThreeP].Visible := V1ThreeP; - Static[StaticP1ThreePScoreBG].Visible := V1ThreeP; - Text[TextP1ThreeP].Visible := V1ThreeP; - Text[TextP1ThreePScore].Visible := V1ThreeP; - - Static[StaticP2M].Visible := V2M; - Static[StaticP2MScoreBG].Visible := V2M; - Text[TextP2M].Visible := V2M; - Text[TextP2MScore].Visible := V2M; - - Static[StaticP3R].Visible := V3R; - Static[StaticP3RScoreBG].Visible := V3R; - Text[TextP3R].Visible := V3R; - Text[TextP3RScore].Visible := V3R; - - // load notes - ResetSingTemp; -// Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); - AktSong := CatSongs.Song[CatSongs.Selected]; - try - if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName) then - begin - //Error Loading Song -> Go back to Song Screen and Show some Error Message - FadeTo(@ScreenSong); - //Select New Song in Party Mode - if ScreenSong.Mode = 1 then - ScreenSong.SelectRandomSong; - ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); - Exit; - end; - except - //Error Loading Song -> Go back to Song Screen and Show some Error Message - FadeTo(@ScreenSong); - //Select New Song in Party Mode - if ScreenSong.Mode = 1 then - ScreenSong.SelectRandomSong; - ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); - Exit; - end; - AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; -// AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed - - // set movie - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin -(* OpenSmpeg(AktSong.Path + AktSong.Video); - SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*) - - // todo: VideoGap and Start time verwursten - FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); - FFmpegSkip(AktSong.VideoGAP + AktSong.Start); - AktSong.VideoLoaded := true; - end; - - // set background - if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then - try - Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background); - except - log.LogError('Background could not be loaded: ' + AktSong.Path + AktSong.Background); - Tex_Background.TexNum := -1; - end - else - Tex_Background.TexNum := -1; - - - - // play music (I) - Music.CaptureStart; - Music.MoveTo(AktSong.Start); -// Music.Play; - - // prepare timer (I) -// CountSkipTimeSet; - Czas.Teraz := AktSong.Start; - Czas.Razem := Music.Length; - if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000; - Czas.OldBeat := -1; - for P := 0 to High(Player) do - ClearScores(P); - - // main text - LyricMain.Clear; - LyricMain.X := 400; - LyricMain.Y := Skin_LyricsT; - LyricMain.Scale := 1.4; //1.4 - LyricMain.Align := 1; - - // sub text - LyricSub.Clear; - LyricSub.X := 400; - LyricSub.Y := Skin_LyricsT + 35; //42 //40 - LyricSub.Align := 1; - - // set custom options - case Ini.LyricsFont of - 0: - begin - LyricMain.FontStyle := 0; - LyricSub.FontStyle := 0; - LyricMain.Size := 14; // 13 - LyricSub.Size := 14; // 13 - LyricMain.ColR := Skin_FontR; - LyricMain.ColG := Skin_FontG; - LyricMain.ColB := Skin_FontB; //Change für Crazy Joker - {LyricMain.ColSR := Skin_FontHighlightR; - LyricMain.ColSG := Skin_FontHighlightG; - LyricMain.ColSB := Skin_FontHighlightB;1aa5dc} - LyricMain.ColSR := 5/255; //26 - LyricMain.ColSG := 163/255; //165 - LyricMain.ColSB := 210/255; //220 - - LyricSub.ColR := 0.4; //0.6 - LyricSub.ColG := 0.4; //0.6 - LyricSub.ColB := 0.4; //0.6 - end; - 1: - begin - LyricMain.FontStyle := 2; - LyricSub.FontStyle := 2; - LyricMain.Size := 14; - LyricSub.Size := 14; - LyricMain.ColR := 0.75; - LyricMain.ColG := 0.75; - LyricMain.ColB := 1; - LyricMain.ColSR := 0.5; - LyricMain.ColSG := 0.5; - LyricMain.ColSB := 1; - LyricSub.ColR := 0.8; - LyricSub.ColG := 0.8; - LyricSub.ColB := 0.8; - end; - 2: - begin - LyricMain.FontStyle := 3; - LyricSub.FontStyle := 3; - LyricMain.Size := 12; - LyricSub.Size := 12; - LyricMain.ColR := 0.75; - LyricMain.ColG := 0.75; - LyricMain.ColB := 1; - LyricMain.ColSR := 0.5; - LyricMain.ColSG := 0.5; - LyricMain.ColSB := 1; - LyricSub.ColR := 0.8; - LyricSub.ColG := 0.8; - LyricSub.ColB := 0.8; - end; - end; // case - - case Ini.LyricsEffect of - 0: LyricMain.Style := 1; // 0 - one selected, 1 - selected all to the current - 1: LyricMain.Style := 2; - 2: LyricMain.Style := 3; - 3: LyricMain.Style := 4; - end; // case - - // fill texts - LyricMain.AddCzesc(0); - LyricMain.Selected := -1; - LyricSub.AddCzesc(1); - LyricSub.Selected := -1; - - UpdateLCD; - - //Deactivate Pause - Paused := False; - - //Kill all Stars not Killed yet - //GoldenStarsTwinkle Mod - GoldenRec.SentenceChange; - //GoldenStarsTwinkle Mod End - - //Set Position of Line Bonus - PhrasenBonus - if (Ini.LineBonus = 1) then //Show Line Bonus at Scores - begin - Case PlayersPlay of - 1: begin - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; - end; - - 2: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.X; - Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.X; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.X; - Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - end; - - 3: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - end; - - 4: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; - - //P4 - Player[3].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; - Player[3].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[3].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; - Player[3].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - end; - - 6: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - - //P4 - Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[3].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; - Player[3].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[3].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; - - //P5 - Player[4].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[4].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[4].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[4].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P6 - Player[5].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[5].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[5].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[5].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - end; - end; - end - else if (Ini.LineBonus = 2) then //Show Line Bonus at Notes - begin - - // positions - if Ini.SingWindow = 0 then begin - NR.Left := 120; - end else begin - NR.Left := 20; - end; - NR.Right := 780; - - NR.Width := NR.Right - NR.Left; - NR.WMid := NR.Width / 2; - NR.Mid := NR.Left + NR.WMid; - - Case PlayersPlay of - 1: begin - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := Skin_P2_NotesB - 105; - end; - - 2: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - end; - - 3: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := 120 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := 120 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := 245 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := 245 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_TargetY := 370 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_StartY := 370 + 28; - end; - - 4: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P4 - Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - end; - - 6: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := 120 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := 120 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := 245 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := 245 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_TargetY := 370 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_StartY := 370 + 28; - - //P4 - Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_TargetY := 120 - 65 + 28; - Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_StartY := 120 + 28; - - //P5 - Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[4].LineBonus_TargetY := 245 - 65 + 28; - Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[4].LineBonus_StartY := 245 + 28; - - //P6 - Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[5].LineBonus_TargetY := 370 - 65 + 28; - Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[5].LineBonus_StartY := 370 + 28; - end; - end; - end; - //Set Position of Line Bonus - PhrasenBonus End - //Set Num of Empty Sentences for Phrasen Bonus - NumEmptySentences := 0; - for P := low(Czesci[0].Czesc) to high(Czesci[0].Czesc) do - if Czesci[0].Czesc[P].TotalNotes = 0 then Inc(NumEmptySentences); - - Log.LogStatus('End', 'onShow'); -end; - -procedure TScreenSing.onShowFinish; -begin - // play movie (II) - - if AktSong.VideoLoaded then - begin - try - FFmpegGetFrame(Czas.Teraz); - FFmpegDrawGL(ScreenAct); -// PlaySmpeg; - except - //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video - AktSong.VideoLoaded := False; - Log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); - Log.LogError('Corrupted File: ' + AktSong.Video); - try -// CloseSmpeg; - FFmpegClose; - except - - end; - end; - end; - - // play music (II) - Music.Play; - - // prepare timer (II) - CountSkipTimeSet; -end; - -function TScreenSing.Draw: boolean; -var - Min: integer; - Sec: integer; - Tekst: string; - Flash: real; - S: integer; - T: integer; -begin - - - - //ScoreBG Mod | den wirren Scheiss hier brauch mer nimmer, wir haben colorized png's - no need for wirrness also - // set player colors - macht nichts weiter als die farben des statics zu wechseln, was zu unschönen effekten bei colorized png führt -{ if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - end; - if ScreenAct = 2 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P4Dark'); - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P3Dark'); - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); - end; - if ScreenAct = 2 then begin - - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P6Dark'); - - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); - end; - end; - } - - // set player names (for 2 screens and only Singstar skin) - if ScreenAct = 1 then begin - Text[TextP1].Text := 'P1'; - Text[TextP1TwoP].Text := 'P1'; - Text[TextP1ThreeP].Text := 'P1'; - Text[TextP2R].Text := 'P2'; - Text[TextP2M].Text := 'P2'; - Text[TextP3R].Text := 'P3'; - end; - - if ScreenAct = 2 then begin - case PlayersPlay of -{ 1: begin - Text[TextP1].Text := 'P2'; - end; - 2: begin - Text[TextP1].Text := 'P3'; - Text[TextP2R].Text := 'P4'; - end; - 3: begin - Text[TextP1].Text := 'P4'; - Text[TextP2M].Text := 'P5'; - Text[TextP3R].Text := 'P6'; - end;} - - 4: begin - Text[TextP1TwoP].Text := 'P3'; - Text[TextP2R].Text := 'P4'; - end; - 6: begin - Text[TextP1ThreeP].Text := 'P4'; - Text[TextP2M].Text := 'P5'; - Text[TextP3R].Text := 'P6'; - end; - end; // case - end; // if - - // stereo - -// weird stuff, maybe this is for "dual screen?", but where is player three then? | okay, i commented the stuff out the other day - nothing was missing on screen w/ 6 players - so do we even need this stuff? -// okay this stuff appears again some lines beneath this one, I commented it out for testing what it does - seems like it's doing nothing -// but I might be wrong, so what is this stuff here doing? O.o - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; - - Text[TextP1].X := Text[TextP1].X + 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; - - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; - Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; - - Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; -// end of weird stuff - - for S := 1 to 1 do //wtf? - Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X + 10*ScreenX; - - // update static menu with time ... - Min := Round(Czas.Teraz) div 60; - Sec := Round(Czas.Teraz) mod 60; - 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); - - // .. and scores - if PlayersPlay = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; - end; - - if PlayersPlay = 2 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - - if PlayersPlay = 3 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[4].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[5].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - end; - - // draw static menu (BG) - DrawBG; - //Draw Background - SingDrawBackground; - // update and draw movie - if ShowFinish and AktSong.VideoLoaded then begin - try -// UpdateSmpeg; // this only draws - // todo: find a way to determine, when a new frame is needed - // toto: same for the need to skip frames - FFmpegGetFrame(Czas.Teraz); - FFmpegDrawGL(ScreenAct); - except - //If an Error occurs drawing: prevent Video from being Drawn again and Close Video - AktSong.VideoLoaded := False; - log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); - Log.LogError('Corrupted File: ' + AktSong.Video); - try -// CloseSmpeg; - FFmpegClose; - except - - end; - end; - end; - - // draw static menu (FG) - DrawFG; - - // check for music finish -// Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(AktSong.Finish)); - if ShowFinish then begin - if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin - //Pause Mod: - if not Paused then - Sing(Self); // analyze song - end else begin -// Log.LogError('End'); - if not FadeOut then begin -// Log.LogError('End2'); - Finish; - FadeOut := true; - FadeTo(@ScreenScore); - end; - end; - end; - - // draw custom items - SingDraw; // always draw - -//GoldenNoteStarsTwinkle Mod - GoldenRec.SpawnRec; -//GoldenNoteStarsTwinkle Mod - - // back stereo - -// weird stuff, maybe this is for "dual screen?", but where is player three then? -// okay this stuff appears again some lines above this one, I commented it out for testing what it does - seems like it's doing nothing -// but I might be wrong, so what is this stuff here doing? O.o - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; - - Text[TextP1].X := Text[TextP1].X - 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; - - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; - Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; - - Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; -//weird end - - for S := 1 to 1 do // wtf? - Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X - 10*ScreenX; - -end; - -procedure TScreenSing.Finish; -begin - Music.CaptureStop; - Music.Stop; - - if Ini.SavePlayback = 1 then begin - Log.BenchmarkStart(0); - Log.LogVoice(0); - Log.LogVoice(1); - Log.LogVoice(2); - Log.BenchmarkEnd(0); - Log.LogBenchmark('Creating files', 0); - end; - - if AktSong.VideoLoaded then begin -// CloseSmpeg; - FFmpegClose; - AktSong.VideoLoaded := false; // to prevent drawing closed video - end; - - SetFontItalic (False); -end; - -procedure TScreenSing.UpdateLCD; -var - T: string; -begin - LCD.HideCursor; - LCD.Clear; - - T := LyricMain.Text; - if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; - LCD.AddTextBR(T); - - T := LyricSub.Text; - if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; - LCD.AddTextBR(T); -end; - -procedure TScreenSing.onSentenceEnd(S: Cardinal); -var -I: Integer; -A: Real; -B: integer; //Max Points for Notes -begin - - //Check for Empty Sentence - if (Czesci[0].Czesc[S].TotalNotes<=0) then - exit; - - //Set Max Note Points - if (Ini.LineBonus > 0) then - B := 9000 - else - B := 10000; - - for I := 0 to High(Player) do begin - A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2; - - //SingBar Mod - If ({(Ini.Oscilloscope = 2) and }(Czesci[0].Czesc[S].TotalNotes>0)) then - begin - Player[I].ScorePercentTarget := Player[I].ScorePercentTarget + floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 40 - 26); - if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0; - if Player[I].ScorePercentTarget > 99 then Player[I].ScorePercentTarget := 99; - - //end Singbar Mod - end; - - //PhrasenBonus - Line Bonus Mod - - //Generate Steps 0 to 8 - A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); - - If (Ini.LineBonus > 0) then - begin - - //Generate Text - if A >= 8 then - Player[I].LineBonus_Text := Theme.Sing.LineBonusText[8] - else - Player[I].LineBonus_Text := Theme.Sing.LineBonusText[Floor(A)]; - - //PhrasenBonus give Points - Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8); - Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10; - //Update Total Score - Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; - - //Color - Case Floor(A) of - 0: begin - Player[I].LineBonus_Color.R := 1; - Player[I].LineBonus_Color.G := 0; - Player[I].LineBonus_Color.B := 0; - end; - 1..3: begin - Player[I].LineBonus_Color.R := 1; - Player[I].LineBonus_Color.G := (A * 0.25); - Player[I].LineBonus_Color.B := 0; - end; - 4: begin - Player[I].LineBonus_Color.R := 1; - Player[I].LineBonus_Color.G := 1; - Player[I].LineBonus_Color.B := 0; - end; - 5..7: begin - Player[I].LineBonus_Color.R := 1-((a-4)*0.25); - Player[I].LineBonus_Color.G := 1; - Player[I].LineBonus_Color.B := 0; - end; - 8: begin - Player[I].LineBonus_Color.R := 0; - Player[I].LineBonus_Color.G := 1; - Player[I].LineBonus_Color.B := 0; - end; - End; //Case - //Player[I].LineBonus_Color.B := 0; - //Player[I].LineBonus_Color.R := (8-A)/8; - //Player[I].LineBonus_Color.G := A/10; - - Player[I].LineBonus_PosX := Player[I].LineBonus_StartX; - Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; - Player[I].LineBonus_Alpha := 0.92; - Player[I].LineBonus_Visible := True; - Player[I].LineBonus_Age := 1; - end; - //PhrasenBonus - Line Bonus Mod End// } - - //PerfectLineTwinkle Mod (effect) Pt.1 - If (Ini.EffectSing=1) then - begin - if A >= 8 then Player[I].LastSentencePerfect := True - else Player[I].LastSentencePerfect := False; - end; - //PerfectLineTwinkle Mod end - - //Refresh LastScore - Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; - - end; - - //PerfectLineTwinkle Mod (effect) Pt.2 - if Ini.EffectSing=1 then - GoldenRec.SpawnPerfectLineTwinkle; - //PerfectLineTwinkle Mod end -end; - -//Called on Sentence Change S= New Current Sentence -procedure TScreenSing.onSentenceChange(S: Cardinal); -begin - //GoldenStarsTwinkle Mod - GoldenRec.SentenceChange; - //GoldenStarsTwinkle Mod End -end; - -end. +unit UScreenSing; + +interface + +{$I switches.inc} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +uses UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + UIni, + ULog, + UTexture, + ULyrics, + TextGL, + OpenGL12, + {$IFDEF useBASS} + bass, + {$ENDIF} + UThemes, + ULCD, + UGraphicClasses, + UVideo; + +type + TScreenSing = class(TMenu) + protected + paused: boolean; //Pause Mod + PauseTime: Real; + NumEmptySentences: integer; + public + //TextTime: integer; + + //TimeBar mod + StaticTimeProgress: integer; + TextTimeText: integer; + //eoa TimeBar mod + + StaticP1: integer; + StaticP1ScoreBG: integer; + TextP1: integer; + TextP1Score: integer; + + //moveable singbar mod + StaticP1SingBar: integer; + StaticP1ThreePSingBar: integer; + StaticP1TwoPSingBar: integer; + StaticP2RSingBar: integer; + StaticP2MSingBar: integer; + StaticP3SingBar: integer; + //eoa moveable singbar + + //Added for ps3 skin + //shown when game is in 2/4 player modus + StaticP1TwoP: integer; + StaticP1TwoPScoreBG: integer; + TextP1TwoP: integer; + TextP1TwoPScore: integer; + //shown when game is in 3/6 player modus + StaticP1ThreeP: integer; + StaticP1ThreePScoreBG: integer; + TextP1ThreeP: integer; + TextP1ThreePScore: integer; + //eoa + + StaticP2R: integer; + StaticP2RScoreBG: integer; + TextP2R: integer; + TextP2RScore: integer; + + StaticP2M: integer; + StaticP2MScoreBG: integer; + TextP2M: integer; + TextP2MScore: integer; + + StaticP3R: integer; + StaticP3RScoreBG: integer; + TextP3R: integer; + TextP3RScore: integer; + + Tex_Background: TTexture; + FadeOut: boolean; +// LyricMain: TLyric; +// LyricSub: TLyric; + Lyrics: TLyricEngine; + + constructor Create; override; + procedure onShow; override; + procedure onShowFinish; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure Finish; virtual; + procedure UpdateLCD; + procedure Pause; //Pause Mod(Toggles Pause) + + //OnSentenceEnd for LineBonus + Singbar + procedure onSentenceEnd(S: Cardinal); + //OnSentenceChange (for Golden Notes) + procedure onSentenceChange(S: Cardinal); + end; + +implementation +uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math; + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenSing.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_Q: + begin + //When not ask before Exit then Finish now + if (Ini.AskbeforeDel <> 1) then + Finish + //else just Pause and let the Popup make the Work + else if not paused then + Pause; + + Result := false; + end; + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + //Record Sound Hack: + //Sound[0].BufferLong + + Finish; + Music.PlayBack; + FadeTo(@ScreenScore); + end; + + SDLK_P://Pause Mod + begin + Pause; + end; + + SDLK_RETURN: + begin + end; + + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN : + begin + end; + SDLK_UP : + begin + end; + end; + end; +end; + +//Pause Mod +procedure TScreenSing.Pause; +begin + if not paused then //Pause einschalten + begin + // pause Time + PauseTime := Czas.Teraz; + Paused := true; + + // pause Music + Music.Pause; + + // pause Video + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + FFmpegTogglePause; + end + else //Pause ausschalten + begin + Czas.Teraz := PauseTime; //Position of Notes + + // Position of Music + Music.MoveTo (PauseTime); + // Play Music + Music.Play; + + // Video + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + FFmpegTogglePause; + //SkipSmpeg(PauseTime); + + Paused := false; + end; +end; +//Pause Mod End + +constructor TScreenSing.Create; +var + I: integer; + P: integer; +begin + inherited Create; + + LoadFromTheme(Theme.Sing); + + //TimeBar + StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); + TextTimeText := AddText(Theme.Sing.TextTimeText); + +// 1 player | P1 + StaticP1 := AddStatic(Theme.Sing.StaticP1); + StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); + TextP1 := AddText(Theme.Sing.TextP1); + TextP1Score := AddText(Theme.Sing.TextP1Score); + StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar); + +// 2 or 4 players | P1 + StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); + StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG); + TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); + TextP1TwoPScore := AddText(Theme.Sing.TextP1TwoPScore); + StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); + + // | P2 + StaticP2R := AddStatic(Theme.Sing.StaticP2R); + StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); + TextP2R := AddText(Theme.Sing.TextP2R); + TextP2RScore := AddText(Theme.Sing.TextP2RScore); + StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); + +// 3 or 6 players | P1 + StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); + StaticP1ThreePScoreBG := AddStatic(Theme.Sing.StaticP1ThreePScoreBG); + TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); + TextP1ThreePScore := AddText(Theme.Sing.TextP1ThreePScore); + StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar); + + // | P2 + StaticP2M := AddStatic(Theme.Sing.StaticP2M); + StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG); + TextP2M := AddText(Theme.Sing.TextP2M); + TextP2MScore := AddText(Theme.Sing.TextP2MScore); + StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar); + + // | P3 + StaticP3R := AddStatic(Theme.Sing.StaticP3R); + StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG); + TextP3R := AddText(Theme.Sing.TextP3R); + TextP3RScore := AddText(Theme.Sing.TextP3RScore); + StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar); + + if ScreenAct = 2 then begin + // katze und affe + + end; + + Lyrics := TLyricEngine.Create(80,Skin_LyricsT,640,12,80,Skin_LyricsT+36,640,12); + + UVideo.Init; +end; + +procedure TScreenSing.onShow; +var + P: integer; + V1: boolean; + V1TwoP: boolean; //added for ps3 skin + V1ThreeP: boolean; //added for ps3 skin + V2R: boolean; + V2M: boolean; + V3R: boolean; + NR: TRecR; //Line Bonus Mod +begin + Log.LogStatus('Begin', 'onShow'); + FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented + + // prepare players + SetLength(Player, PlayersPlay); +// Player[0].ScoreTotalI := 0; + + case PlayersPlay of + 1: begin + V1 := true; + V1TwoP := false; + V1ThreeP := false; + V2R := false; + V2M := false; + V3R := false; + end; + 2: begin + V1 := false; + V1TwoP := true; + V1ThreeP := false; + V2R := true; + V2M := false; + V3R := false; + end; + 3: begin + V1 := false; + V1TwoP := false; + V1ThreeP := true; + V2R := false; + V2M := true; + V3R := true; + end; + 4: begin // double screen + V1 := false; + V1TwoP := true; + V1ThreeP := false; + V2R := true; + V2M := false; + V3R := false; + end; + 6: begin // double screen + V1 := false; + V1TwoP := false; + V1ThreeP := true; + V2R := false; + V2M := true; + V3R := true; + end; + + end; + + //This one is shown in 1P mode + Static[StaticP1].Visible := V1; + Static[StaticP1ScoreBG].Visible := V1; + Text[TextP1].Visible := V1; + Text[TextP1Score].Visible := V1; + + + //This one is shown in 2/4P mode + Static[StaticP1TwoP].Visible := V1TwoP; + Static[StaticP1TwoPScoreBG].Visible := V1TwoP; + Text[TextP1TwoP].Visible := V1TwoP; + Text[TextP1TwoPScore].Visible := V1TwoP; + + Static[StaticP2R].Visible := V2R; + Static[StaticP2RScoreBG].Visible := V2R; + Text[TextP2R].Visible := V2R; + Text[TextP2RScore].Visible := V2R; + + + //This one is shown in 3/6P mode + Static[StaticP1ThreeP].Visible := V1ThreeP; + Static[StaticP1ThreePScoreBG].Visible := V1ThreeP; + Text[TextP1ThreeP].Visible := V1ThreeP; + Text[TextP1ThreePScore].Visible := V1ThreeP; + + Static[StaticP2M].Visible := V2M; + Static[StaticP2MScoreBG].Visible := V2M; + Text[TextP2M].Visible := V2M; + Text[TextP2MScore].Visible := V2M; + + Static[StaticP3R].Visible := V3R; + Static[StaticP3RScoreBG].Visible := V3R; + Text[TextP3R].Visible := V3R; + Text[TextP3RScore].Visible := V3R; + + // load notes + ResetSingTemp; +// Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); + AktSong := CatSongs.Song[CatSongs.Selected]; + try + if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName) then + begin + //Error Loading Song -> Go back to Song Screen and Show some Error Message + FadeTo(@ScreenSong); + //Select New Song in Party Mode + if ScreenSong.Mode = 1 then + ScreenSong.SelectRandomSong; + ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); + Exit; + end; + except + //Error Loading Song -> Go back to Song Screen and Show some Error Message + FadeTo(@ScreenSong); + //Select New Song in Party Mode + if ScreenSong.Mode = 1 then + ScreenSong.SelectRandomSong; + ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); + Exit; + end; + AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; +// AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed + + // set movie + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin +(* OpenSmpeg(AktSong.Path + AktSong.Video); + SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*) + + // todo: VideoGap and Start time verwursten + FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); + FFmpegSkip(AktSong.VideoGAP + AktSong.Start); + AktSong.VideoLoaded := true; + end; + + // set background + if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then + try + Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background); + except + log.LogError('Background could not be loaded: ' + AktSong.Path + AktSong.Background); + Tex_Background.TexNum := -1; + end + else + Tex_Background.TexNum := -1; + + + + // play music (I) + Music.CaptureStart; + Music.MoveTo(AktSong.Start); +// Music.Play; + + // prepare timer (I) +// CountSkipTimeSet; + Czas.Teraz := AktSong.Start; + Czas.Razem := Music.Length; + if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000; + Czas.OldBeat := -1; + for P := 0 to High(Player) do + ClearScores(P); + + // main text + Lyrics.Clear (AktSong.BPM[0].BPM, AktSong.Resolution); + + // set custom options + case Ini.LyricsFont of + 0: + begin + Lyrics.UpperLineSize := 14; + Lyrics.LowerLineSize := 14; + Lyrics.FontStyle := 0; + + Lyrics.LineColor_en.R := Skin_FontR; + Lyrics.LineColor_en.G := Skin_FontG; + Lyrics.LineColor_en.B := Skin_FontB; + Lyrics.LineColor_en.A := 1; + + Lyrics.LineColor_dis.R := 0.4; + Lyrics.LineColor_dis.G := 0.4; + Lyrics.LineColor_dis.B := 0.4; + Lyrics.LineColor_dis.A := 1; + + Lyrics.LineColor_akt.R := 5/256; + Lyrics.LineColor_akt.G := 163/256; + Lyrics.LineColor_akt.B := 210/256; + Lyrics.LineColor_akt.A := 1; + +{ LyricSub.FontStyle := 0; + LyricMain.Size := 14; // 13 + LyricSub.Size := 14; // 13 + LyricMain.ColR := Skin_FontR; + LyricMain.ColG := Skin_FontG; + LyricMain.ColB := Skin_FontB; //Change für Crazy Joker + {LyricMain.ColSR := Skin_FontHighlightR; + LyricMain.ColSG := Skin_FontHighlightG; + LyricMain.ColSB := Skin_FontHighlightB;1aa5dc}{ + LyricMain.ColSR := 5/255; //26 + LyricMain.ColSG := 163/255; //165 + LyricMain.ColSB := 210/255; //220 + + LyricSub.ColR := 0.4; //0.6 + LyricSub.ColG := 0.4; //0.6 + LyricSub.ColB := 0.4; //0.6 } + end; + 1: + begin + { LyricMain.FontStyle := 2; + LyricSub.FontStyle := 2; + LyricMain.Size := 14; + LyricSub.Size := 14; + LyricMain.ColR := 0.75; + LyricMain.ColG := 0.75; + LyricMain.ColB := 1; + LyricMain.ColSR := 0.5; + LyricMain.ColSG := 0.5; + LyricMain.ColSB := 1; + LyricSub.ColR := 0.8; + LyricSub.ColG := 0.8; + LyricSub.ColB := 0.8; } + + Lyrics.UpperLineSize := 14; + Lyrics.LowerLineSize := 14; + Lyrics.FontStyle := 2; + + Lyrics.LineColor_en.R := 0.75; + Lyrics.LineColor_en.G := 0.75; + Lyrics.LineColor_en.B := 1; + Lyrics.LineColor_en.A := 1; + + Lyrics.LineColor_dis.R := 0.8; + Lyrics.LineColor_dis.G := 0.8; + Lyrics.LineColor_dis.B := 0.8; + Lyrics.LineColor_dis.A := 1; + + Lyrics.LineColor_akt.R := 0.5; + Lyrics.LineColor_akt.G := 0.5; + Lyrics.LineColor_akt.B := 1; + Lyrics.LineColor_akt.A := 1; + end; + 2: + begin + Lyrics.UpperLineSize := 12; + Lyrics.LowerLineSize := 12; + Lyrics.FontStyle := 3; + + Lyrics.LineColor_en.R := 0.75; + Lyrics.LineColor_en.G := 0.75; + Lyrics.LineColor_en.B := 1; + Lyrics.LineColor_en.A := 1; + + Lyrics.LineColor_dis.R := 0.8; + Lyrics.LineColor_dis.G := 0.8; + Lyrics.LineColor_dis.B := 0.8; + Lyrics.LineColor_dis.A := 1; + + Lyrics.LineColor_akt.R := 0.5; + Lyrics.LineColor_akt.G := 0.5; + Lyrics.LineColor_akt.B := 1; + Lyrics.LineColor_akt.A := 1; +{ LyricSub.FontStyle := 3; + LyricMain.Size := 12; + LyricSub.Size := 12; + LyricMain.ColR := 0.75; + LyricMain.ColG := 0.75; + LyricMain.ColB := 1; + LyricMain.ColSR := 0.5; + LyricMain.ColSG := 0.5; + LyricMain.ColSB := 1; + LyricSub.ColR := 0.8; + LyricSub.ColG := 0.8; + LyricSub.ColB := 0.8;} + end; + end; // case + + case Ini.LyricsEffect of + 0: Lyrics.HoverEffekt := 1; // 0 - one selected, 1 - selected all to the current + 1: Lyrics.HoverEffekt := 2; + 2: Lyrics.HoverEffekt := 3; + 3: Lyrics.HoverEffekt := 4; + end; // case + + // Add Lines to Lyrics + While (not Lyrics.LineinQueue) AND (Lyrics.LineCounter <= High(Czesci[0].Czesc)) do + Lyrics.AddLine(@Czesci[0].Czesc[Lyrics.LineCounter]); + + UpdateLCD; + + //Deactivate Pause + Paused := False; + + //Kill all Stars not Killed yet + //GoldenStarsTwinkle Mod + GoldenRec.SentenceChange; + //GoldenStarsTwinkle Mod End + + //Set Position of Line Bonus - PhrasenBonus + if (Ini.LineBonus = 1) then //Show Line Bonus at Scores + begin + Case PlayersPlay of + 1: begin + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + end; + + 2: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.X; + Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.X; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.X; + Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + end; + + 3: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + end; + + 4: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; + + //P4 + Player[3].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; + Player[3].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[3].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; + Player[3].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + end; + + 6: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + + //P4 + Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[3].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[3].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[3].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; + + //P5 + Player[4].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[4].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[4].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[4].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P6 + Player[5].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[5].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[5].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[5].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + end; + end; + end + else if (Ini.LineBonus = 2) then //Show Line Bonus at Notes + begin + + // positions + if Ini.SingWindow = 0 then begin + NR.Left := 120; + end else begin + NR.Left := 20; + end; + NR.Right := 780; + + NR.Width := NR.Right - NR.Left; + NR.WMid := NR.Width / 2; + NR.Mid := NR.Left + NR.WMid; + + Case PlayersPlay of + 1: begin + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := Skin_P2_NotesB - 105; + end; + + 2: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + end; + + 3: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := 120 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := 120 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := 245 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := 245 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_TargetY := 370 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_StartY := 370 + 28; + end; + + 4: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P4 + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + end; + + 6: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := 120 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := 120 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := 245 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := 245 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_TargetY := 370 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_StartY := 370 + 28; + + //P4 + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_TargetY := 120 - 65 + 28; + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_StartY := 120 + 28; + + //P5 + Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[4].LineBonus_TargetY := 245 - 65 + 28; + Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[4].LineBonus_StartY := 245 + 28; + + //P6 + Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[5].LineBonus_TargetY := 370 - 65 + 28; + Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[5].LineBonus_StartY := 370 + 28; + end; + end; + end; + //Set Position of Line Bonus - PhrasenBonus End + //Set Num of Empty Sentences for Phrasen Bonus + NumEmptySentences := 0; + for P := low(Czesci[0].Czesc) to high(Czesci[0].Czesc) do + if Czesci[0].Czesc[P].TotalNotes = 0 then Inc(NumEmptySentences); + + Log.LogStatus('End', 'onShow'); +end; + +procedure TScreenSing.onShowFinish; +begin + // play movie (II) + + if AktSong.VideoLoaded then + begin + try + FFmpegGetFrame(Czas.Teraz); + FFmpegDrawGL(ScreenAct); +// PlaySmpeg; + except + //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video + AktSong.VideoLoaded := False; + Log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); + Log.LogError('Corrupted File: ' + AktSong.Video); + try +// CloseSmpeg; + FFmpegClose; + except + + end; + end; + end; + + // play music (II) + Music.Play; + + // prepare timer (II) + CountSkipTimeSet; +end; + +function TScreenSing.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + Flash: real; + S: integer; + T: integer; +begin + + + + //ScoreBG Mod | den wirren Scheiss hier brauch mer nimmer, wir haben colorized png's - no need for wirrness also + // set player colors - macht nichts weiter als die farben des statics zu wechseln, was zu unschönen effekten bei colorized png führt +{ if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P4Dark'); + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P3Dark'); + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); + end; + if ScreenAct = 2 then begin + + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P6Dark'); + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); + end; + end; + } + + // set player names (for 2 screens and only Singstar skin) + if ScreenAct = 1 then begin + Text[TextP1].Text := 'P1'; + Text[TextP1TwoP].Text := 'P1'; + Text[TextP1ThreeP].Text := 'P1'; + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; + end; + + if ScreenAct = 2 then begin + case PlayersPlay of +{ 1: begin + Text[TextP1].Text := 'P2'; + end; + 2: begin + Text[TextP1].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 3: begin + Text[TextP1].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end;} + + 4: begin + Text[TextP1TwoP].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 6: begin + Text[TextP1ThreeP].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end; + end; // case + end; // if + + // stereo + +// weird stuff, maybe this is for "dual screen?", but where is player three then? | okay, i commented the stuff out the other day - nothing was missing on screen w/ 6 players - so do we even need this stuff? +// okay this stuff appears again some lines beneath this one, I commented it out for testing what it does - seems like it's doing nothing +// but I might be wrong, so what is this stuff here doing? O.o + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + + Text[TextP1].X := Text[TextP1].X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; + + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; + Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + + Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; +// end of weird stuff + + for S := 1 to 1 do //wtf? + Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X + 10*ScreenX; + + // update static menu with time ... + Min := Round(Czas.Teraz) div 60; + Sec := Round(Czas.Teraz) mod 60; + 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); + + // .. and scores + if PlayersPlay = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + end; + + if PlayersPlay = 2 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + + if PlayersPlay = 3 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[4].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[5].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + end; + + // draw static menu (BG) + DrawBG; + //Draw Background + SingDrawBackground; + // update and draw movie + if ShowFinish and AktSong.VideoLoaded then begin + try +// UpdateSmpeg; // this only draws + // todo: find a way to determine, when a new frame is needed + // toto: same for the need to skip frames + FFmpegGetFrame(Czas.Teraz); + FFmpegDrawGL(ScreenAct); + except + //If an Error occurs drawing: prevent Video from being Drawn again and Close Video + AktSong.VideoLoaded := False; + log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); + Log.LogError('Corrupted File: ' + AktSong.Video); + try +// CloseSmpeg; + FFmpegClose; + except + + end; + end; + end; + + // draw static menu (FG) + DrawFG; + + // check for music finish +// Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(AktSong.Finish)); + if ShowFinish then begin + if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + //Pause Mod: + if not Paused then + Sing(Self); // analyze song + end else begin +// Log.LogError('End'); + if not FadeOut then begin +// Log.LogError('End2'); + Finish; + FadeOut := true; + FadeTo(@ScreenScore); + end; + end; + end; + + // draw custom items + SingDraw; // always draw + +//GoldenNoteStarsTwinkle Mod + GoldenRec.SpawnRec; +//GoldenNoteStarsTwinkle Mod + + // back stereo + +// weird stuff, maybe this is for "dual screen?", but where is player three then? +// okay this stuff appears again some lines above this one, I commented it out for testing what it does - seems like it's doing nothing +// but I might be wrong, so what is this stuff here doing? O.o + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; + + Text[TextP1].X := Text[TextP1].X - 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; + + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; + Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; + + Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; +//weird end + + for S := 1 to 1 do // wtf? + Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X - 10*ScreenX; + +end; + +procedure TScreenSing.Finish; +begin + Music.CaptureStop; + Music.Stop; + + if Ini.SavePlayback = 1 then begin + Log.BenchmarkStart(0); + Log.LogVoice(0); + Log.LogVoice(1); + Log.LogVoice(2); + Log.BenchmarkEnd(0); + Log.LogBenchmark('Creating files', 0); + end; + + if AktSong.VideoLoaded then begin +// CloseSmpeg; + FFmpegClose; + AktSong.VideoLoaded := false; // to prevent drawing closed video + end; + + SetFontItalic (False); +end; + +procedure TScreenSing.UpdateLCD; +var + T: string; +begin + //Todo: Lyrics +{ LCD.HideCursor; + LCD.Clear; + + T := LyricMain.Text; + if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; + LCD.AddTextBR(T); + + T := LyricSub.Text; + if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; + LCD.AddTextBR(T);} +end; + +procedure TScreenSing.onSentenceEnd(S: Cardinal); +var +I: Integer; +A: Real; +B: integer; //Max Points for Notes +begin + + //Check for Empty Sentence + if (Czesci[0].Czesc[S].TotalNotes<=0) then + exit; + + //Set Max Note Points + if (Ini.LineBonus > 0) then + B := 9000 + else + B := 10000; + + for I := 0 to High(Player) do begin + A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2; + + //SingBar Mod + If ({(Ini.Oscilloscope = 2) and }(Czesci[0].Czesc[S].TotalNotes>0)) then + begin + Player[I].ScorePercentTarget := Player[I].ScorePercentTarget + floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 40 - 26); + if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0; + if Player[I].ScorePercentTarget > 99 then Player[I].ScorePercentTarget := 99; + + //end Singbar Mod + end; + + //PhrasenBonus - Line Bonus Mod + + //Generate Steps 0 to 8 + A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); + + If (Ini.LineBonus > 0) then + begin + + //Generate Text + if A >= 8 then + Player[I].LineBonus_Text := Theme.Sing.LineBonusText[8] + else + Player[I].LineBonus_Text := Theme.Sing.LineBonusText[Floor(A)]; + + //PhrasenBonus give Points + Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8); + Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10; + //Update Total Score + Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; + + //Color + Case Floor(A) of + 0: begin + Player[I].LineBonus_Color.R := 1; + Player[I].LineBonus_Color.G := 0; + Player[I].LineBonus_Color.B := 0; + end; + 1..3: begin + Player[I].LineBonus_Color.R := 1; + Player[I].LineBonus_Color.G := (A * 0.25); + Player[I].LineBonus_Color.B := 0; + end; + 4: begin + Player[I].LineBonus_Color.R := 1; + Player[I].LineBonus_Color.G := 1; + Player[I].LineBonus_Color.B := 0; + end; + 5..7: begin + Player[I].LineBonus_Color.R := 1-((a-4)*0.25); + Player[I].LineBonus_Color.G := 1; + Player[I].LineBonus_Color.B := 0; + end; + 8: begin + Player[I].LineBonus_Color.R := 0; + Player[I].LineBonus_Color.G := 1; + Player[I].LineBonus_Color.B := 0; + end; + End; //Case + //Player[I].LineBonus_Color.B := 0; + //Player[I].LineBonus_Color.R := (8-A)/8; + //Player[I].LineBonus_Color.G := A/10; + + Player[I].LineBonus_PosX := Player[I].LineBonus_StartX; + Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; + Player[I].LineBonus_Alpha := 0.92; + Player[I].LineBonus_Visible := True; + Player[I].LineBonus_Age := 1; + end; + //PhrasenBonus - Line Bonus Mod End// } + + //PerfectLineTwinkle Mod (effect) Pt.1 + If (Ini.EffectSing=1) then + begin + if A >= 8 then Player[I].LastSentencePerfect := True + else Player[I].LastSentencePerfect := False; + end; + //PerfectLineTwinkle Mod end + + //Refresh LastScore + Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; + + end; + + //PerfectLineTwinkle Mod (effect) Pt.2 + if Ini.EffectSing=1 then + GoldenRec.SpawnPerfectLineTwinkle; + //PerfectLineTwinkle Mod end +end; + +//Called on Sentence Change S= New Current Sentence +procedure TScreenSing.onSentenceChange(S: Cardinal); +begin + //GoldenStarsTwinkle Mod + GoldenRec.SentenceChange; + if (Lyrics.LineCounter <= High(Czesci[0].Czesc)) then + Lyrics.AddLine(@Czesci[0].Czesc[Lyrics.LineCounter]); + //GoldenStarsTwinkle Mod End +end; + +end. diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 474bf173..65109055 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -6,46 +6,28 @@ program UltraStar; {$I switches.inc} uses - //------------------------------ - //Includes - 3rd Party Libraries - //------------------------------ - SDL in 'lib\JEDI-SDLv1.0\SDL\Pas\SDL.pas', - OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas', - - bass in 'lib\bass\delphi\bass.pas', - - PNGImage in 'lib\PNGImage\PNGImage.pas', - PNGzLib in 'lib\PNGImage\PNGzLib.pas', - pnglang in 'lib\PNGImage\pnglang.pas', - - midiout in 'lib\midi\midiout.pas', - midiin in 'lib\midi\midiin.pas', - Circbuf in 'lib\midi\CIRCBUF.PAS', - MidiType in 'lib\midi\MidiType.PAS', - MidiDefs in 'lib\midi\MidiDefs.PAS', - MidiCons in 'lib\midi\MidiCons.PAS', - MidiFile in 'lib\midi\MidiFile.PAS', - Delphmcb in 'lib\midi\Delphmcb.PAS', - - {$IFDEF UseSerialPort} - zlportio in 'lib\zlportio\zlportio.pas', - ddkint in 'lib\zlportio\ddkint.pas', - {$ENDIF} - - avcodec in 'lib\ffmpeg\avcodec.pas', - avformat in 'lib\ffmpeg\avformat.pas', - avutil in 'lib\ffmpeg\avutil.pas', - rational in 'lib\ffmpeg\rational.pas', - opt in 'lib\ffmpeg\opt.pas', - avio in 'lib\ffmpeg\avio.pas', - + SDL in 'lib\JEDI-SDLv1.0\SDL\Pas\SDL.pas', + OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas', + bass in 'lib\bass\delphi\bass.pas', + PNGImage in 'lib\PNGImage\PNGImage.pas', + PNGzLib in 'lib\PNGImage\PNGzLib.pas', + pnglang in 'lib\PNGImage\pnglang.pas', + midiout in 'lib\midi\midiout.pas', + midiin in 'lib\midi\midiin.pas', + CIRCBUF in 'lib\midi\CIRCBUF.PAS', + MidiType in 'lib\midi\MidiType.PAS', + MidiDefs in 'lib\midi\MidiDefs.PAS', + MidiCons in 'lib\midi\MidiCons.PAS', + MidiFile in 'lib\midi\MidiFile.PAS', + Delphmcb in 'lib\midi\Delphmcb.PAS', + avcodec in 'lib\ffmpeg\avcodec.pas', + avformat in 'lib\ffmpeg\avformat.pas', + avutil in 'lib\ffmpeg\avutil.pas', + rational in 'lib\ffmpeg\rational.pas', + opt in 'lib\ffmpeg\opt.pas', + avio in 'lib\ffmpeg\avio.pas', SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', - SQLite3 in 'lib\SQLite\SQLite3.pas', - - - //------------------------------ - //Includes - Menu System - //------------------------------ + SQLite3 in 'lib\SQLite\SQLite3.pas', UDisplay in 'Menu\UDisplay.pas', UMenu in 'Menu\UMenu.pas', UMenuStatic in 'Menu\UMenuStatic.pas', @@ -56,11 +38,7 @@ uses UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', UDrawTexture in 'Menu\UDrawTexture.pas', UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', - - //------------------------------ - //Includes - Classes - //------------------------------ - UCommon in 'Classes\UCommon.pas', + UCommon in 'Classes\UCommon.pas', UGraphic in 'Classes\UGraphic.pas', UTexture in 'Classes\UTexture.pas', UMusic in 'Classes\UMusic.pas', @@ -87,16 +65,8 @@ uses UDLLManager in 'Classes\UDLLManager.pas', UParty in 'Classes\UParty.pas', UPlaylist in 'Classes\UPlaylist.pas', - UCommandLine in 'Classes\UCommandLine.pas', - - //------------------------------ - //Includes - Video Support - //------------------------------ + UCommandLine in 'Classes\UCommandLine.pas', UVideo in 'Classes\UVideo.pas', - - //------------------------------ - //Includes - Screens - //------------------------------ UScreenLoading in 'Screens\UScreenLoading.pas', UScreenWelcome in 'Screens\UScreenWelcome.pas', UScreenMain in 'Screens\UScreenMain.pas', @@ -125,27 +95,16 @@ uses UScreenStatDetail in 'Screens\UScreenStatDetail.pas', UScreenCredits in 'Screens\UScreenCredits.pas', UScreenPopup in 'Screens\UScreenPopup.pas', - - //------------------------------ - //Includes - Screens PartyMode - //------------------------------ UScreenSingModi in 'Screens\UScreenSingModi.pas', UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', UScreenPartyScore in 'Screens\UScreenPartyScore.pas', UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', UScreenPartyWin in 'Screens\UScreenPartyWin.pas', - - //------------------------------ - //Includes - Modi SDK - //------------------------------ ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', - - //------------------------------ - //Includes - Delphi - //------------------------------ Windows, - SysUtils; + SysUtils, + ULyrics.bak in 'Classes\ULyrics.bak.pas'; const Version = 'UltraStar Deluxe V 1.10 Alpha Build'; @@ -357,6 +316,7 @@ begin Log.BenchmarkEnd(0); Log.LogBenchmark('Loading Time', 0); + Lyric := TLyric.Create; //------------------------------ //Start- Mainloop -- cgit v1.2.3 From 4e1c6d261a7b51c58f261c5642bec17988aa549f Mon Sep 17 00:00:00 2001 From: b1indy Date: Thu, 20 Sep 2007 07:38:21 +0000 Subject: forgot something ^^; git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@413 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/ULyrics.bak.pas | 418 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 418 insertions(+) create mode 100644 Game/Code/Classes/ULyrics.bak.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/ULyrics.bak.pas b/Game/Code/Classes/ULyrics.bak.pas new file mode 100644 index 00000000..e432f7e5 --- /dev/null +++ b/Game/Code/Classes/ULyrics.bak.pas @@ -0,0 +1,418 @@ +unit ULyrics.bak; + +interface +uses SysUtils, OpenGL12, UMusic, UTexture; + +type + TWord = record + X: real; + Y: real; + Size: real; + Width: real; + Text: string; + ColR: real; + ColG: real; + ColB: real; + Scale: real; + Done: real; + FontStyle: integer; + Italic: boolean; + Selected: boolean; + end; + + TLyric = class + private + AlignI: integer; + XR: real; + YR: real; + SizeR: real; + SelectedI: integer; + ScaleR: real; + StyleI: integer; // 0 - one selection, 1 - long selection, 2 - one selection with fade to normal text, 3 - long selection with fade with color from left + FontStyleI: integer; // font number + Word: array of TWord; + + //Textures for PlayerIcon Index: Playernum; Index2: Enabled/Disabled + PlayerIconTex: array[0..5] of array [0..1] of TTexture; + + procedure SetX(Value: real); + procedure SetY(Value: real); + function GetClientX: real; + procedure SetAlign(Value: integer); + function GetSize: real; + procedure SetSize(Value: real); + procedure SetSelected(Value: integer); + procedure SetDone(Value: real); + procedure SetScale(Value: real); + procedure SetStyle(Value: integer); + procedure SetFStyle(Value: integer); + procedure Refresh; + + procedure DrawNormal(W: integer); + procedure DrawPlain(W: integer); + procedure DrawScaled(W: integer); + procedure DrawSlide(W: integer); + + procedure DrawPlayerIcons; + public + //Array containing Players Singing the Next Sentence + // 1: Player 1 Active + // 2: Player 2 Active + // 3: Player 3 Active + PlayersActive: Byte; + + //Dark or Light Colors + Enabled: Boolean; + + ColR: real; + ColG: real; + ColB: real; + ColSR: real; + ColSG: real; + ColSB: real; + Italic: boolean; + Text: string; // LCD + + constructor Create; + published + property X: real write SetX; + property Y: real write SetY; + property ClientX: real read GetClientX; + property Align: integer write SetAlign; + property Size: real read GetSize write SetSize; + property Selected: integer read SelectedI write SetSelected; + property Done: real write SetDone; + property Scale: real write SetScale; + property Style: integer write SetStyle; + property FontStyle: integer write SetFStyle; + procedure AddWord(Text: string); + procedure AddCzesc(NrCzesci: integer); + + function SelectedLetter: integer; // LCD + function SelectedLength: integer; // LCD + + procedure Clear; + procedure Draw; + + end; + +var + Lyric: TLyric; + +implementation +uses TextGL, UGraphic, UDrawTexture, Math, USkins; + +Constructor TLyric.Create; +var + I: Integer; +begin + //Only 2 Players for now + For I := 0 to 1 do + begin + PlayerIconTex[I][0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIcon_P' + InttoStr(I+1))), 'PNG', 'Transparent', 0); + PlayerIconTex[I][1] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIconD_P' + InttoStr(I+1))), 'PNG', 'Transparent', 0); + end; + PlayersActive := Trunc(Power(2, 1)) + 1; +end; + +procedure TLyric.SetX(Value: real); +begin + XR := Value; +end; + +procedure TLyric.SetY(Value: real); +begin + YR := Value; +end; + +function TLyric.GetClientX: real; +begin + Result := Word[0].X; +end; + +procedure TLyric.SetAlign(Value: integer); +begin + AlignI := Value; +// if AlignInt = 0 then beep; +end; + +function TLyric.GetSize: real; +begin + Result := SizeR; +end; + +procedure TLyric.SetSize(Value: real); +begin + SizeR := Value; +end; + +procedure TLyric.SetSelected(Value: integer); +var + W: integer; +begin + if (StyleI = 0) or (StyleI = 2) or (StyleI = 4) then begin + if (SelectedI > -1) and (SelectedI <= High(Word)) then begin + Word[SelectedI].Selected := false; + Word[SelectedI].ColR := ColR; + Word[SelectedI].ColG := ColG; + Word[SelectedI].ColB := ColB; + Word[SelectedI].Done := 0; + end; + + SelectedI := Value; + if (Value > -1) and (Value <= High(Word)) then begin + Word[Value].Selected := true; + Word[Value].ColR := ColSR; + Word[Value].ColG := ColSG; + Word[Value].ColB := ColSB; + Word[Value].Scale := ScaleR; + end; + end; + + if (StyleI = 1) or (StyleI = 3) then begin + if (SelectedI > -1) and (SelectedI <= High(Word)) then begin + for W := SelectedI to High(Word) do begin + Word[W].Selected := false; + Word[W].ColR := ColR; + Word[W].ColG := ColG; + Word[W].ColB := ColB; + Word[W].Done := 0; + end; + end; + + SelectedI := Value; + if (Value > -1) and (Value <= High(Word)) then begin + for W := 0 to Value do begin + Word[W].Selected := true; + Word[W].ColR := ColSR; + Word[W].ColG := ColSG; + Word[W].ColB := ColSB; + Word[W].Scale := ScaleR; + Word[W].Done := 1; + end; + end; + end; + + Refresh; +end; + +procedure TLyric.SetDone(Value: real); +var + W: integer; +begin + W := SelectedI; + if W > -1 then + Word[W].Done := Value; +end; + +procedure TLyric.SetScale(Value: real); +begin + ScaleR := Value; +end; + +procedure TLyric.SetStyle(Value: integer); +begin + StyleI := Value; +end; + +procedure TLyric.SetFStyle(Value: integer); +begin + FontStyleI := Value; +end; + +procedure TLyric.AddWord(Text: string); +var + WordNum: integer; +begin + WordNum := Length(Word); + SetLength(Word, WordNum + 1); + if WordNum = 0 then begin + Word[WordNum].X := XR; + end else begin + Word[WordNum].X := Word[WordNum - 1].X + Word[WordNum - 1].Width; + end; + + Word[WordNum].Y := YR; + Word[WordNum].Size := SizeR; + Word[WordNum].FontStyle := FontStyleI; // new + SetFontStyle(FontStyleI); + SetFontSize(SizeR); + Word[WordNum].Width := glTextWidth(pchar(Text)); + Word[WordNum].Text := Text; + Word[WordNum].ColR := ColR; + Word[WordNum].ColG := ColG; + Word[WordNum].ColB := ColB; + Word[WordNum].Scale := 1; + Word[WordNum].Done := 0; + Word[WordNum].Italic := Italic; + + Refresh; +end; + +procedure TLyric.AddCzesc(NrCzesci: integer); +var + N: integer; +begin + Clear; + for N := 0 to Czesci[0].Czesc[NrCzesci].HighNut do begin + Italic := Czesci[0].Czesc[NrCzesci].Nuta[N].FreeStyle; + AddWord(Czesci[0].Czesc[NrCzesci].Nuta[N].Tekst); + Text := Text + Czesci[0].Czesc[NrCzesci].Nuta[N].Tekst; + end; + Selected := -1; +end; + +procedure TLyric.Clear; +begin +{ ColR := Skin_FontR; + ColG := Skin_FontG; + ColB := Skin_FontB;} + SetLength(Word, 0); + Text := ''; + SelectedI := -1; +end; + +procedure TLyric.Refresh; +var + W: integer; + TotWidth: real; +begin + if AlignI = 1 then begin + TotWidth := 0; + for W := 0 to High(Word) do + TotWidth := TotWidth + Word[W].Width; + + Word[0].X := XR - TotWidth / 2; + for W := 1 to High(Word) do + Word[W].X := Word[W - 1].X + Word[W - 1].Width; + end; +end; + +procedure TLyric.DrawPlayerIcons; +begin + +end; + +procedure TLyric.Draw; +var + W: integer; +begin + case StyleI of + 0: + begin + for W := 0 to High(Word) do + DrawNormal(W); + end; + 1: + begin + for W := 0 to High(Word) do + DrawPlain(W); + end; + 2: // zoom + begin + for W := 0 to High(Word) do + if not Word[W].Selected then + DrawNormal(W); + + for W := 0 to High(Word) do + if Word[W].Selected then + DrawScaled(W); + end; + 3: // slide + begin + for W := 0 to High(Word) do begin + if not Word[W].Selected then + DrawNormal(W) + else + DrawSlide(W); + end; + end; + 4: // ball + begin + for W := 0 to High(Word) do + DrawNormal(W); + + for W := 0 to High(Word) do + if Word[W].Selected then begin + Tex_Ball.X := (Word[W].X - 10) + Word[W].Done * Word[W].Width; + Tex_Ball.Y := 480 - 10*sin(Word[W].Done * pi); + Tex_Ball.W := 20; + Tex_Ball.H := 20; + DrawTexture(Tex_Ball); + end; + end; + end; // case +end; + +procedure TLyric.DrawNormal(W: integer); +begin + SetFontStyle(Word[W].FontStyle); + SetFontPos(Word[W].X+ 10*ScreenX, Word[W].Y); + SetFontSize(Word[W].Size); + SetFontItalic(Word[W].Italic); + glColor3f(Word[W].ColR, Word[W].ColG, Word[W].ColB); + glPrint(pchar(Word[W].Text)); +end; + +procedure TLyric.DrawPlain(W: integer); +var + D: real; +begin + D := Word[W].Done; // przyrost + + SetFontStyle(Word[W].FontStyle); + SetFontPos(Word[W].X, Word[W].Y); + SetFontSize(Word[W].Size); + SetFontItalic(Word[W].Italic); + + if D = 0 then + glColor3f(ColR, ColG, ColB) + else + glColor3f(ColSR, ColSG, ColSB); + + glPrint(pchar(Word[W].Text)); +end; + +procedure TLyric.DrawScaled(W: integer); +var + D: real; +begin + // previous plus dynamic scaling effect + D := 1-Word[W].Done; // przyrost + SetFontStyle(Word[W].FontStyle); + SetFontPos(Word[W].X - D * Word[W].Width * (Word[W].Scale - 1) / 2 + (D+1)*10*ScreenX, Word[W].Y - D * 1.5 * Word[W].Size *(Word[W].Scale - 1)); + SetFontSize(Word[W].Size + D * (Word[W].Size * Word[W].Scale - Word[W].Size)); + SetFontItalic(Word[W].Italic); + glColor3f(Word[W].ColR, Word[W].ColG, Word[W].ColB); + glPrint(pchar(Word[W].Text)) +end; + +procedure TLyric.DrawSlide(W: integer); +var + D: real; +begin + D := Word[W].Done; // przyrost + SetFontStyle(Word[W].FontStyle); + SetFontPos(Word[W].X, Word[W].Y); + SetFontSize(Word[W].Size); + SetFontItalic(Word[W].Italic); + glColor3f(Word[W].ColR, Word[W].ColG, Word[W].ColB); + glPrintDone(pchar(Word[W].Text), D, ColR, ColG, ColB); +end; + +function TLyric.SelectedLetter; // LCD +var + W: integer; +begin + Result := 1; + + for W := 0 to SelectedI-1 do + Result := Result + Length(Word[W].Text); +end; + +function TLyric.SelectedLength: integer; // LCD +begin + Result := Length(Word[SelectedI].Text); +end; + +end. -- cgit v1.2.3 From fb923e76a9d728805670c58a8eece411fb2b0b02 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Sep 2007 09:28:52 +0000 Subject: modified to make it build blindys current work. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@414 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphic.pas | 2 +- Game/Code/UltraStar.dpr | 102 ++++++++++++++++++++++++++++++----------- 2 files changed, 75 insertions(+), 29 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 09bbc1c9..7c0ef57e 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -312,7 +312,7 @@ end; procedure Initialize3D (Title: string); var // Icon: TIcon; - Res: TResourceStream; +// Res: TResourceStream; ISurface: PSDL_Surface; Pixel: PByteArray; I: Integer; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 65109055..42301946 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -1,4 +1,4 @@ -program UltraStar; +program UltraStar; {$DEFINE TRANSLATE} @@ -6,28 +6,46 @@ program UltraStar; {$I switches.inc} uses - SDL in 'lib\JEDI-SDLv1.0\SDL\Pas\SDL.pas', - OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas', - bass in 'lib\bass\delphi\bass.pas', - PNGImage in 'lib\PNGImage\PNGImage.pas', - PNGzLib in 'lib\PNGImage\PNGzLib.pas', - pnglang in 'lib\PNGImage\pnglang.pas', - midiout in 'lib\midi\midiout.pas', - midiin in 'lib\midi\midiin.pas', - CIRCBUF in 'lib\midi\CIRCBUF.PAS', - MidiType in 'lib\midi\MidiType.PAS', - MidiDefs in 'lib\midi\MidiDefs.PAS', - MidiCons in 'lib\midi\MidiCons.PAS', - MidiFile in 'lib\midi\MidiFile.PAS', - Delphmcb in 'lib\midi\Delphmcb.PAS', - avcodec in 'lib\ffmpeg\avcodec.pas', - avformat in 'lib\ffmpeg\avformat.pas', - avutil in 'lib\ffmpeg\avutil.pas', - rational in 'lib\ffmpeg\rational.pas', - opt in 'lib\ffmpeg\opt.pas', - avio in 'lib\ffmpeg\avio.pas', + //------------------------------ + //Includes - 3rd Party Libraries + //------------------------------ + SDL in 'lib\JEDI-SDLv1.0\SDL\Pas\SDL.pas', + OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas', + + bass in 'lib\bass\delphi\bass.pas', + + PNGImage in 'lib\PNGImage\PNGImage.pas', + PNGzLib in 'lib\PNGImage\PNGzLib.pas', + pnglang in 'lib\PNGImage\pnglang.pas', + + midiout in 'lib\midi\midiout.pas', + midiin in 'lib\midi\midiin.pas', + Circbuf in 'lib\midi\CIRCBUF.PAS', + MidiType in 'lib\midi\MidiType.PAS', + MidiDefs in 'lib\midi\MidiDefs.PAS', + MidiCons in 'lib\midi\MidiCons.PAS', + MidiFile in 'lib\midi\MidiFile.PAS', + Delphmcb in 'lib\midi\Delphmcb.PAS', + + {$IFDEF UseSerialPort} + zlportio in 'lib\zlportio\zlportio.pas', + ddkint in 'lib\zlportio\ddkint.pas', + {$ENDIF} + + avcodec in 'lib\ffmpeg\avcodec.pas', + avformat in 'lib\ffmpeg\avformat.pas', + avutil in 'lib\ffmpeg\avutil.pas', + rational in 'lib\ffmpeg\rational.pas', + opt in 'lib\ffmpeg\opt.pas', + avio in 'lib\ffmpeg\avio.pas', + SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', - SQLite3 in 'lib\SQLite\SQLite3.pas', + SQLite3 in 'lib\SQLite\SQLite3.pas', + + + //------------------------------ + //Includes - Menu System + //------------------------------ UDisplay in 'Menu\UDisplay.pas', UMenu in 'Menu\UMenu.pas', UMenuStatic in 'Menu\UMenuStatic.pas', @@ -38,7 +56,11 @@ uses UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', UDrawTexture in 'Menu\UDrawTexture.pas', UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', - UCommon in 'Classes\UCommon.pas', + + //------------------------------ + //Includes - Classes + //------------------------------ + UCommon in 'Classes\UCommon.pas', UGraphic in 'Classes\UGraphic.pas', UTexture in 'Classes\UTexture.pas', UMusic in 'Classes\UMusic.pas', @@ -51,6 +73,7 @@ uses USongs in 'Classes\USongs.pas', UIni in 'Classes\UIni.pas', ULyrics in 'Classes\ULyrics.pas', + ULyrics.bak in 'Classes\ULyrics.bak.pas', USkins in 'Classes\USkins.pas', UThemes in 'Classes\UThemes.pas', ULog in 'Classes\ULog.pas', @@ -65,8 +88,16 @@ uses UDLLManager in 'Classes\UDLLManager.pas', UParty in 'Classes\UParty.pas', UPlaylist in 'Classes\UPlaylist.pas', - UCommandLine in 'Classes\UCommandLine.pas', + UCommandLine in 'Classes\UCommandLine.pas', + + //------------------------------ + //Includes - Video Support + //------------------------------ UVideo in 'Classes\UVideo.pas', + + //------------------------------ + //Includes - Screens + //------------------------------ UScreenLoading in 'Screens\UScreenLoading.pas', UScreenWelcome in 'Screens\UScreenWelcome.pas', UScreenMain in 'Screens\UScreenMain.pas', @@ -95,16 +126,29 @@ uses UScreenStatDetail in 'Screens\UScreenStatDetail.pas', UScreenCredits in 'Screens\UScreenCredits.pas', UScreenPopup in 'Screens\UScreenPopup.pas', + + //------------------------------ + //Includes - Screens PartyMode + //------------------------------ UScreenSingModi in 'Screens\UScreenSingModi.pas', UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', UScreenPartyScore in 'Screens\UScreenPartyScore.pas', UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', UScreenPartyWin in 'Screens\UScreenPartyWin.pas', + + //------------------------------ + //Includes - Modi SDK + //------------------------------ ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', + + //------------------------------ + //Includes - Delphi + //------------------------------ Windows, - SysUtils, - ULyrics.bak in 'Classes\ULyrics.bak.pas'; + SysUtils; + + const Version = 'UltraStar Deluxe V 1.10 Alpha Build'; @@ -124,7 +168,7 @@ begin //Programm already started if (hWnd <> 0) then begin - I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Contìnue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); + I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Continue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); if (I = IDYes) then begin I := 1; @@ -316,7 +360,8 @@ begin Log.BenchmarkEnd(0); Log.LogBenchmark('Loading Time', 0); - Lyric := TLyric.Create; + Lyric := TLyric.Create; + //------------------------------ //Start- Mainloop @@ -335,3 +380,4 @@ begin Log.Free; end. + -- cgit v1.2.3 From 3c41f973b397b718135a7713c7501607812b0192 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Sep 2007 09:42:35 +0000 Subject: renamed Ulyrics.bak.pas hack to Ulyrics_bak.pas for lazarus compatiblity. minor changes to get code base compiling in Lazarus(win) and Delphi git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@415 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCommon.pas | 268 +++---- Game/Code/Classes/ULyrics.bak.pas | 418 ---------- Game/Code/Classes/ULyrics.pas | 7 + Game/Code/Classes/ULyrics_bak.pas | 428 +++++++++++ Game/Code/Screens/UScreenEditSub.pas | 6 +- Game/Code/UltraStar.dpr | 2 +- Game/Code/UltraStar.lpi | 1397 ++++++++++++++++------------------ Game/Code/UltraStar.lpr | 825 ++++++++++---------- 8 files changed, 1657 insertions(+), 1694 deletions(-) delete mode 100644 Game/Code/Classes/ULyrics.bak.pas create mode 100644 Game/Code/Classes/ULyrics_bak.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UCommon.pas b/Game/Code/Classes/UCommon.pas index b7ddd7ba..b572a768 100644 --- a/Game/Code/Classes/UCommon.pas +++ b/Game/Code/Classes/UCommon.pas @@ -1,132 +1,136 @@ -unit UCommon; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -uses - -{$IFDEF win32} - windows; -{$ELSE} - lcltype, - messages; -{$ENDIF} - -{$IFNDEF win32} -type - hStream = THandle; - HGLRC = THandle; - TLargeInteger = Int64; - TWin32FindData = LongInt; -{$ENDIF} - -{$IFDEF FPC} - -type - TWndMethod = procedure(var Message: TMessage) of object; - -function RandomRange(aMin: Integer; aMax: Integer) : Integer; -//function AllocateHWnd(Method: TWndMethod): HWND; -//procedure DeallocateHWnd(Wnd: HWND); - -function MaxValue(const Data: array of Double): Double; -function MinValue(const Data: array of Double): Double; -{$ENDIF} - -{$IFNDEF win32} -(* - function QueryPerformanceCounter(lpPerformanceCount:TLARGEINTEGER):Bool; - function QueryPerformanceFrequency(lpFrequency:TLARGEINTEGER):Bool; -*) - procedure ZeroMemory( Destination: Pointer; Length: DWORD ); -{$ENDIF} - -implementation - -{$IFNDEF win32} -procedure ZeroMemory( Destination: Pointer; Length: DWORD ); -begin - FillChar( Destination^, Length, 0 ); -end; //ZeroMemory - -(* -function QueryPerformanceCounter(lpPerformanceCount:TLARGEINTEGER):Bool; - - // From http://en.wikipedia.org/wiki/RDTSC - function RDTSC: Int64; register; - asm - rdtsc - end; - -begin - // Use clock_gettime here maybe ... from libc - lpPerformanceCount := RDTSC(); - result := true; -end; - -function QueryPerformanceFrequency(lpFrequency:TLARGEINTEGER):Bool; -begin - lpFrequency := 0; - result := true; -end; -*) -{$ENDIF} - - -{$IFDEF FPC} - -function MaxValue(const Data: array of Double): Double; -var - I: Integer; -begin - Result := Data[Low(Data)]; - for I := Low(Data) + 1 to High(Data) do - if Result < Data[I] then - Result := Data[I]; -end; - -function MinValue(const Data: array of Double): Double; -var - I: Integer; -begin - Result := Data[Low(Data)]; - for I := Low(Data) + 1 to High(Data) do - if Result > Data[I] then - Result := Data[I]; -end; - -function RandomRange(aMin: Integer; aMax: Integer) : Integer; -begin -RandomRange := Random(aMax-aMin) + aMin ; -end; - - -// NOTE !!!!!!!!!! -// AllocateHWnd is in lclintfh.inc - -{ -// TODO : JB this is dodgey and bad... find a REAL solution ! -function AllocateHWnd(Method: TWndMethod): HWND; -var - TempClass: TWndClass; - ClassRegistered: Boolean; -begin - Result := CreateWindowEx(WS_EX_TOOLWINDOW, '', '', WS_POPUP , 0, 0, 0, 0, 0, 0, HInstance, nil); -end; - -procedure DeallocateHWnd(Wnd: HWND); -var - Instance: Pointer; -begin - Instance := Pointer(GetWindowLong(Wnd, GWL_WNDPROC)); - DestroyWindow(Wnd); -end; -} - -{$ENDIF} - - -end. +unit UCommon; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses + +{$IFDEF win32} + windows; +{$ELSE} + lcltype, + messages; +{$ENDIF} + +{$IFNDEF win32} +type + hStream = THandle; + HGLRC = THandle; + TLargeInteger = Int64; + TWin32FindData = LongInt; +{$ENDIF} + +{$IFDEF FPC} + +type + TWndMethod = procedure(var Message: TMessage) of object; + +function RandomRange(aMin: Integer; aMax: Integer) : Integer; + +function MaxValue(const Data: array of Double): Double; +function MinValue(const Data: array of Double): Double; + +{$IFDEF Win32} +function AllocateHWnd(Method: TWndMethod): HWND; +procedure DeallocateHWnd(Wnd: HWND); +{$ENDIF} + +{$ENDIF} + +{$IFNDEF win32} +(* + function QueryPerformanceCounter(lpPerformanceCount:TLARGEINTEGER):Bool; + function QueryPerformanceFrequency(lpFrequency:TLARGEINTEGER):Bool; +*) + procedure ZeroMemory( Destination: Pointer; Length: DWORD ); +{$ENDIF} + +implementation + +{$IFNDEF win32} +procedure ZeroMemory( Destination: Pointer; Length: DWORD ); +begin + FillChar( Destination^, Length, 0 ); +end; //ZeroMemory + +(* +function QueryPerformanceCounter(lpPerformanceCount:TLARGEINTEGER):Bool; + + // From http://en.wikipedia.org/wiki/RDTSC + function RDTSC: Int64; register; + asm + rdtsc + end; + +begin + // Use clock_gettime here maybe ... from libc + lpPerformanceCount := RDTSC(); + result := true; +end; + +function QueryPerformanceFrequency(lpFrequency:TLARGEINTEGER):Bool; +begin + lpFrequency := 0; + result := true; +end; +*) +{$ENDIF} + + +{$IFDEF FPC} + +function MaxValue(const Data: array of Double): Double; +var + I: Integer; +begin + Result := Data[Low(Data)]; + for I := Low(Data) + 1 to High(Data) do + if Result < Data[I] then + Result := Data[I]; +end; + +function MinValue(const Data: array of Double): Double; +var + I: Integer; +begin + Result := Data[Low(Data)]; + for I := Low(Data) + 1 to High(Data) do + if Result > Data[I] then + Result := Data[I]; +end; + +function RandomRange(aMin: Integer; aMax: Integer) : Integer; +begin +RandomRange := Random(aMax-aMin) + aMin ; +end; + + +// NOTE !!!!!!!!!! +// AllocateHWnd is in lclintfh.inc + +{$IFDEF Win32} +// TODO : JB this is dodgey and bad... find a REAL solution ! +function AllocateHWnd(Method: TWndMethod): HWND; +var + TempClass: TWndClass; + ClassRegistered: Boolean; +begin + Result := CreateWindowEx(WS_EX_TOOLWINDOW, '', '', WS_POPUP , 0, 0, 0, 0, 0, 0, HInstance, nil); +end; + +procedure DeallocateHWnd(Wnd: HWND); +var + Instance: Pointer; +begin + Instance := Pointer(GetWindowLong(Wnd, GWL_WNDPROC)); + DestroyWindow(Wnd); +end; +{$ENDIF} + +{$ENDIF} + + +end. diff --git a/Game/Code/Classes/ULyrics.bak.pas b/Game/Code/Classes/ULyrics.bak.pas deleted file mode 100644 index e432f7e5..00000000 --- a/Game/Code/Classes/ULyrics.bak.pas +++ /dev/null @@ -1,418 +0,0 @@ -unit ULyrics.bak; - -interface -uses SysUtils, OpenGL12, UMusic, UTexture; - -type - TWord = record - X: real; - Y: real; - Size: real; - Width: real; - Text: string; - ColR: real; - ColG: real; - ColB: real; - Scale: real; - Done: real; - FontStyle: integer; - Italic: boolean; - Selected: boolean; - end; - - TLyric = class - private - AlignI: integer; - XR: real; - YR: real; - SizeR: real; - SelectedI: integer; - ScaleR: real; - StyleI: integer; // 0 - one selection, 1 - long selection, 2 - one selection with fade to normal text, 3 - long selection with fade with color from left - FontStyleI: integer; // font number - Word: array of TWord; - - //Textures for PlayerIcon Index: Playernum; Index2: Enabled/Disabled - PlayerIconTex: array[0..5] of array [0..1] of TTexture; - - procedure SetX(Value: real); - procedure SetY(Value: real); - function GetClientX: real; - procedure SetAlign(Value: integer); - function GetSize: real; - procedure SetSize(Value: real); - procedure SetSelected(Value: integer); - procedure SetDone(Value: real); - procedure SetScale(Value: real); - procedure SetStyle(Value: integer); - procedure SetFStyle(Value: integer); - procedure Refresh; - - procedure DrawNormal(W: integer); - procedure DrawPlain(W: integer); - procedure DrawScaled(W: integer); - procedure DrawSlide(W: integer); - - procedure DrawPlayerIcons; - public - //Array containing Players Singing the Next Sentence - // 1: Player 1 Active - // 2: Player 2 Active - // 3: Player 3 Active - PlayersActive: Byte; - - //Dark or Light Colors - Enabled: Boolean; - - ColR: real; - ColG: real; - ColB: real; - ColSR: real; - ColSG: real; - ColSB: real; - Italic: boolean; - Text: string; // LCD - - constructor Create; - published - property X: real write SetX; - property Y: real write SetY; - property ClientX: real read GetClientX; - property Align: integer write SetAlign; - property Size: real read GetSize write SetSize; - property Selected: integer read SelectedI write SetSelected; - property Done: real write SetDone; - property Scale: real write SetScale; - property Style: integer write SetStyle; - property FontStyle: integer write SetFStyle; - procedure AddWord(Text: string); - procedure AddCzesc(NrCzesci: integer); - - function SelectedLetter: integer; // LCD - function SelectedLength: integer; // LCD - - procedure Clear; - procedure Draw; - - end; - -var - Lyric: TLyric; - -implementation -uses TextGL, UGraphic, UDrawTexture, Math, USkins; - -Constructor TLyric.Create; -var - I: Integer; -begin - //Only 2 Players for now - For I := 0 to 1 do - begin - PlayerIconTex[I][0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIcon_P' + InttoStr(I+1))), 'PNG', 'Transparent', 0); - PlayerIconTex[I][1] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIconD_P' + InttoStr(I+1))), 'PNG', 'Transparent', 0); - end; - PlayersActive := Trunc(Power(2, 1)) + 1; -end; - -procedure TLyric.SetX(Value: real); -begin - XR := Value; -end; - -procedure TLyric.SetY(Value: real); -begin - YR := Value; -end; - -function TLyric.GetClientX: real; -begin - Result := Word[0].X; -end; - -procedure TLyric.SetAlign(Value: integer); -begin - AlignI := Value; -// if AlignInt = 0 then beep; -end; - -function TLyric.GetSize: real; -begin - Result := SizeR; -end; - -procedure TLyric.SetSize(Value: real); -begin - SizeR := Value; -end; - -procedure TLyric.SetSelected(Value: integer); -var - W: integer; -begin - if (StyleI = 0) or (StyleI = 2) or (StyleI = 4) then begin - if (SelectedI > -1) and (SelectedI <= High(Word)) then begin - Word[SelectedI].Selected := false; - Word[SelectedI].ColR := ColR; - Word[SelectedI].ColG := ColG; - Word[SelectedI].ColB := ColB; - Word[SelectedI].Done := 0; - end; - - SelectedI := Value; - if (Value > -1) and (Value <= High(Word)) then begin - Word[Value].Selected := true; - Word[Value].ColR := ColSR; - Word[Value].ColG := ColSG; - Word[Value].ColB := ColSB; - Word[Value].Scale := ScaleR; - end; - end; - - if (StyleI = 1) or (StyleI = 3) then begin - if (SelectedI > -1) and (SelectedI <= High(Word)) then begin - for W := SelectedI to High(Word) do begin - Word[W].Selected := false; - Word[W].ColR := ColR; - Word[W].ColG := ColG; - Word[W].ColB := ColB; - Word[W].Done := 0; - end; - end; - - SelectedI := Value; - if (Value > -1) and (Value <= High(Word)) then begin - for W := 0 to Value do begin - Word[W].Selected := true; - Word[W].ColR := ColSR; - Word[W].ColG := ColSG; - Word[W].ColB := ColSB; - Word[W].Scale := ScaleR; - Word[W].Done := 1; - end; - end; - end; - - Refresh; -end; - -procedure TLyric.SetDone(Value: real); -var - W: integer; -begin - W := SelectedI; - if W > -1 then - Word[W].Done := Value; -end; - -procedure TLyric.SetScale(Value: real); -begin - ScaleR := Value; -end; - -procedure TLyric.SetStyle(Value: integer); -begin - StyleI := Value; -end; - -procedure TLyric.SetFStyle(Value: integer); -begin - FontStyleI := Value; -end; - -procedure TLyric.AddWord(Text: string); -var - WordNum: integer; -begin - WordNum := Length(Word); - SetLength(Word, WordNum + 1); - if WordNum = 0 then begin - Word[WordNum].X := XR; - end else begin - Word[WordNum].X := Word[WordNum - 1].X + Word[WordNum - 1].Width; - end; - - Word[WordNum].Y := YR; - Word[WordNum].Size := SizeR; - Word[WordNum].FontStyle := FontStyleI; // new - SetFontStyle(FontStyleI); - SetFontSize(SizeR); - Word[WordNum].Width := glTextWidth(pchar(Text)); - Word[WordNum].Text := Text; - Word[WordNum].ColR := ColR; - Word[WordNum].ColG := ColG; - Word[WordNum].ColB := ColB; - Word[WordNum].Scale := 1; - Word[WordNum].Done := 0; - Word[WordNum].Italic := Italic; - - Refresh; -end; - -procedure TLyric.AddCzesc(NrCzesci: integer); -var - N: integer; -begin - Clear; - for N := 0 to Czesci[0].Czesc[NrCzesci].HighNut do begin - Italic := Czesci[0].Czesc[NrCzesci].Nuta[N].FreeStyle; - AddWord(Czesci[0].Czesc[NrCzesci].Nuta[N].Tekst); - Text := Text + Czesci[0].Czesc[NrCzesci].Nuta[N].Tekst; - end; - Selected := -1; -end; - -procedure TLyric.Clear; -begin -{ ColR := Skin_FontR; - ColG := Skin_FontG; - ColB := Skin_FontB;} - SetLength(Word, 0); - Text := ''; - SelectedI := -1; -end; - -procedure TLyric.Refresh; -var - W: integer; - TotWidth: real; -begin - if AlignI = 1 then begin - TotWidth := 0; - for W := 0 to High(Word) do - TotWidth := TotWidth + Word[W].Width; - - Word[0].X := XR - TotWidth / 2; - for W := 1 to High(Word) do - Word[W].X := Word[W - 1].X + Word[W - 1].Width; - end; -end; - -procedure TLyric.DrawPlayerIcons; -begin - -end; - -procedure TLyric.Draw; -var - W: integer; -begin - case StyleI of - 0: - begin - for W := 0 to High(Word) do - DrawNormal(W); - end; - 1: - begin - for W := 0 to High(Word) do - DrawPlain(W); - end; - 2: // zoom - begin - for W := 0 to High(Word) do - if not Word[W].Selected then - DrawNormal(W); - - for W := 0 to High(Word) do - if Word[W].Selected then - DrawScaled(W); - end; - 3: // slide - begin - for W := 0 to High(Word) do begin - if not Word[W].Selected then - DrawNormal(W) - else - DrawSlide(W); - end; - end; - 4: // ball - begin - for W := 0 to High(Word) do - DrawNormal(W); - - for W := 0 to High(Word) do - if Word[W].Selected then begin - Tex_Ball.X := (Word[W].X - 10) + Word[W].Done * Word[W].Width; - Tex_Ball.Y := 480 - 10*sin(Word[W].Done * pi); - Tex_Ball.W := 20; - Tex_Ball.H := 20; - DrawTexture(Tex_Ball); - end; - end; - end; // case -end; - -procedure TLyric.DrawNormal(W: integer); -begin - SetFontStyle(Word[W].FontStyle); - SetFontPos(Word[W].X+ 10*ScreenX, Word[W].Y); - SetFontSize(Word[W].Size); - SetFontItalic(Word[W].Italic); - glColor3f(Word[W].ColR, Word[W].ColG, Word[W].ColB); - glPrint(pchar(Word[W].Text)); -end; - -procedure TLyric.DrawPlain(W: integer); -var - D: real; -begin - D := Word[W].Done; // przyrost - - SetFontStyle(Word[W].FontStyle); - SetFontPos(Word[W].X, Word[W].Y); - SetFontSize(Word[W].Size); - SetFontItalic(Word[W].Italic); - - if D = 0 then - glColor3f(ColR, ColG, ColB) - else - glColor3f(ColSR, ColSG, ColSB); - - glPrint(pchar(Word[W].Text)); -end; - -procedure TLyric.DrawScaled(W: integer); -var - D: real; -begin - // previous plus dynamic scaling effect - D := 1-Word[W].Done; // przyrost - SetFontStyle(Word[W].FontStyle); - SetFontPos(Word[W].X - D * Word[W].Width * (Word[W].Scale - 1) / 2 + (D+1)*10*ScreenX, Word[W].Y - D * 1.5 * Word[W].Size *(Word[W].Scale - 1)); - SetFontSize(Word[W].Size + D * (Word[W].Size * Word[W].Scale - Word[W].Size)); - SetFontItalic(Word[W].Italic); - glColor3f(Word[W].ColR, Word[W].ColG, Word[W].ColB); - glPrint(pchar(Word[W].Text)) -end; - -procedure TLyric.DrawSlide(W: integer); -var - D: real; -begin - D := Word[W].Done; // przyrost - SetFontStyle(Word[W].FontStyle); - SetFontPos(Word[W].X, Word[W].Y); - SetFontSize(Word[W].Size); - SetFontItalic(Word[W].Italic); - glColor3f(Word[W].ColR, Word[W].ColG, Word[W].ColB); - glPrintDone(pchar(Word[W].Text), D, ColR, ColG, ColB); -end; - -function TLyric.SelectedLetter; // LCD -var - W: integer; -begin - Result := 1; - - for W := 0 to SelectedI-1 do - Result := Result + Length(Word[W].Text); -end; - -function TLyric.SelectedLength: integer; // LCD -begin - Result := Length(Word[SelectedI].Text); -end; - -end. diff --git a/Game/Code/Classes/ULyrics.pas b/Game/Code/Classes/ULyrics.pas index 5cf6114d..1c2795ce 100644 --- a/Game/Code/Classes/ULyrics.pas +++ b/Game/Code/Classes/ULyrics.pas @@ -1,6 +1,13 @@ unit ULyrics; interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +{$I switches.inc} + uses OpenGL12, UTexture, UThemes, UMusic; type diff --git a/Game/Code/Classes/ULyrics_bak.pas b/Game/Code/Classes/ULyrics_bak.pas new file mode 100644 index 00000000..43fa46f5 --- /dev/null +++ b/Game/Code/Classes/ULyrics_bak.pas @@ -0,0 +1,428 @@ +unit ULyrics_bak; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +{$I switches.inc} + +uses SysUtils, + OpenGL12, + UMusic, + UTexture; + +type + TWord = record + X: real; + Y: real; + Size: real; + Width: real; + Text: string; + ColR: real; + ColG: real; + ColB: real; + Scale: real; + Done: real; + FontStyle: integer; + Italic: boolean; + Selected: boolean; + end; + + TLyric = class + private + AlignI: integer; + XR: real; + YR: real; + SizeR: real; + SelectedI: integer; + ScaleR: real; + StyleI: integer; // 0 - one selection, 1 - long selection, 2 - one selection with fade to normal text, 3 - long selection with fade with color from left + FontStyleI: integer; // font number + Word: array of TWord; + + //Textures for PlayerIcon Index: Playernum; Index2: Enabled/Disabled + PlayerIconTex: array[0..5] of array [0..1] of TTexture; + + procedure SetX(Value: real); + procedure SetY(Value: real); + function GetClientX: real; + procedure SetAlign(Value: integer); + function GetSize: real; + procedure SetSize(Value: real); + procedure SetSelected(Value: integer); + procedure SetDone(Value: real); + procedure SetScale(Value: real); + procedure SetStyle(Value: integer); + procedure SetFStyle(Value: integer); + procedure Refresh; + + procedure DrawNormal(W: integer); + procedure DrawPlain(W: integer); + procedure DrawScaled(W: integer); + procedure DrawSlide(W: integer); + + procedure DrawPlayerIcons; + public + //Array containing Players Singing the Next Sentence + // 1: Player 1 Active + // 2: Player 2 Active + // 3: Player 3 Active + PlayersActive: Byte; + + //Dark or Light Colors + Enabled: Boolean; + + ColR: real; + ColG: real; + ColB: real; + ColSR: real; + ColSG: real; + ColSB: real; + Italic: boolean; + Text: string; // LCD + + constructor Create; + + procedure AddWord(Text: string); + procedure AddCzesc(NrCzesci: integer); + + function SelectedLetter: integer; // LCD + function SelectedLength: integer; // LCD + + procedure Clear; + procedure Draw; + published + property X: real write SetX; + property Y: real write SetY; + property ClientX: real read GetClientX; + property Align: integer write SetAlign; + property Size: real read GetSize write SetSize; + property Selected: integer read SelectedI write SetSelected; + property Done: real write SetDone; + property Scale: real write SetScale; + property Style: integer write SetStyle; + property FontStyle: integer write SetFStyle; + end; + +var + Lyric: TLyric; + +implementation +uses TextGL, UGraphic, UDrawTexture, Math, USkins; + +Constructor TLyric.Create; +var + I: Integer; +begin + //Only 2 Players for now + For I := 0 to 1 do + begin + PlayerIconTex[I][0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIcon_P' + InttoStr(I+1))), 'PNG', 'Transparent', 0); + PlayerIconTex[I][1] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIconD_P' + InttoStr(I+1))), 'PNG', 'Transparent', 0); + end; + PlayersActive := Trunc(Power(2, 1)) + 1; +end; + +procedure TLyric.SetX(Value: real); +begin + XR := Value; +end; + +procedure TLyric.SetY(Value: real); +begin + YR := Value; +end; + +function TLyric.GetClientX: real; +begin + Result := Word[0].X; +end; + +procedure TLyric.SetAlign(Value: integer); +begin + AlignI := Value; +// if AlignInt = 0 then beep; +end; + +function TLyric.GetSize: real; +begin + Result := SizeR; +end; + +procedure TLyric.SetSize(Value: real); +begin + SizeR := Value; +end; + +procedure TLyric.SetSelected(Value: integer); +var + W: integer; +begin + if (StyleI = 0) or (StyleI = 2) or (StyleI = 4) then begin + if (SelectedI > -1) and (SelectedI <= High(Word)) then begin + Word[SelectedI].Selected := false; + Word[SelectedI].ColR := ColR; + Word[SelectedI].ColG := ColG; + Word[SelectedI].ColB := ColB; + Word[SelectedI].Done := 0; + end; + + SelectedI := Value; + if (Value > -1) and (Value <= High(Word)) then begin + Word[Value].Selected := true; + Word[Value].ColR := ColSR; + Word[Value].ColG := ColSG; + Word[Value].ColB := ColSB; + Word[Value].Scale := ScaleR; + end; + end; + + if (StyleI = 1) or (StyleI = 3) then begin + if (SelectedI > -1) and (SelectedI <= High(Word)) then begin + for W := SelectedI to High(Word) do begin + Word[W].Selected := false; + Word[W].ColR := ColR; + Word[W].ColG := ColG; + Word[W].ColB := ColB; + Word[W].Done := 0; + end; + end; + + SelectedI := Value; + if (Value > -1) and (Value <= High(Word)) then begin + for W := 0 to Value do begin + Word[W].Selected := true; + Word[W].ColR := ColSR; + Word[W].ColG := ColSG; + Word[W].ColB := ColSB; + Word[W].Scale := ScaleR; + Word[W].Done := 1; + end; + end; + end; + + Refresh; +end; + +procedure TLyric.SetDone(Value: real); +var + W: integer; +begin + W := SelectedI; + if W > -1 then + Word[W].Done := Value; +end; + +procedure TLyric.SetScale(Value: real); +begin + ScaleR := Value; +end; + +procedure TLyric.SetStyle(Value: integer); +begin + StyleI := Value; +end; + +procedure TLyric.SetFStyle(Value: integer); +begin + FontStyleI := Value; +end; + +procedure TLyric.AddWord(Text: string); +var + WordNum: integer; +begin + WordNum := Length(Word); + SetLength(Word, WordNum + 1); + if WordNum = 0 then begin + Word[WordNum].X := XR; + end else begin + Word[WordNum].X := Word[WordNum - 1].X + Word[WordNum - 1].Width; + end; + + Word[WordNum].Y := YR; + Word[WordNum].Size := SizeR; + Word[WordNum].FontStyle := FontStyleI; // new + SetFontStyle(FontStyleI); + SetFontSize(SizeR); + Word[WordNum].Width := glTextWidth(pchar(Text)); + Word[WordNum].Text := Text; + Word[WordNum].ColR := ColR; + Word[WordNum].ColG := ColG; + Word[WordNum].ColB := ColB; + Word[WordNum].Scale := 1; + Word[WordNum].Done := 0; + Word[WordNum].Italic := Italic; + + Refresh; +end; + +procedure TLyric.AddCzesc(NrCzesci: integer); +var + N: integer; +begin + Clear; + for N := 0 to Czesci[0].Czesc[NrCzesci].HighNut do begin + Italic := Czesci[0].Czesc[NrCzesci].Nuta[N].FreeStyle; + AddWord(Czesci[0].Czesc[NrCzesci].Nuta[N].Tekst); + Text := Text + Czesci[0].Czesc[NrCzesci].Nuta[N].Tekst; + end; + Selected := -1; +end; + +procedure TLyric.Clear; +begin +{ ColR := Skin_FontR; + ColG := Skin_FontG; + ColB := Skin_FontB;} + SetLength(Word, 0); + Text := ''; + SelectedI := -1; +end; + +procedure TLyric.Refresh; +var + W: integer; + TotWidth: real; +begin + if AlignI = 1 then begin + TotWidth := 0; + for W := 0 to High(Word) do + TotWidth := TotWidth + Word[W].Width; + + Word[0].X := XR - TotWidth / 2; + for W := 1 to High(Word) do + Word[W].X := Word[W - 1].X + Word[W - 1].Width; + end; +end; + +procedure TLyric.DrawPlayerIcons; +begin + +end; + +procedure TLyric.Draw; +var + W: integer; +begin + case StyleI of + 0: + begin + for W := 0 to High(Word) do + DrawNormal(W); + end; + 1: + begin + for W := 0 to High(Word) do + DrawPlain(W); + end; + 2: // zoom + begin + for W := 0 to High(Word) do + if not Word[W].Selected then + DrawNormal(W); + + for W := 0 to High(Word) do + if Word[W].Selected then + DrawScaled(W); + end; + 3: // slide + begin + for W := 0 to High(Word) do begin + if not Word[W].Selected then + DrawNormal(W) + else + DrawSlide(W); + end; + end; + 4: // ball + begin + for W := 0 to High(Word) do + DrawNormal(W); + + for W := 0 to High(Word) do + if Word[W].Selected then begin + Tex_Ball.X := (Word[W].X - 10) + Word[W].Done * Word[W].Width; + Tex_Ball.Y := 480 - 10*sin(Word[W].Done * pi); + Tex_Ball.W := 20; + Tex_Ball.H := 20; + DrawTexture(Tex_Ball); + end; + end; + end; // case +end; + +procedure TLyric.DrawNormal(W: integer); +begin + SetFontStyle(Word[W].FontStyle); + SetFontPos(Word[W].X+ 10*ScreenX, Word[W].Y); + SetFontSize(Word[W].Size); + SetFontItalic(Word[W].Italic); + glColor3f(Word[W].ColR, Word[W].ColG, Word[W].ColB); + glPrint(pchar(Word[W].Text)); +end; + +procedure TLyric.DrawPlain(W: integer); +var + D: real; +begin + D := Word[W].Done; // przyrost + + SetFontStyle(Word[W].FontStyle); + SetFontPos(Word[W].X, Word[W].Y); + SetFontSize(Word[W].Size); + SetFontItalic(Word[W].Italic); + + if D = 0 then + glColor3f(ColR, ColG, ColB) + else + glColor3f(ColSR, ColSG, ColSB); + + glPrint(pchar(Word[W].Text)); +end; + +procedure TLyric.DrawScaled(W: integer); +var + D: real; +begin + // previous plus dynamic scaling effect + D := 1-Word[W].Done; // przyrost + SetFontStyle(Word[W].FontStyle); + SetFontPos(Word[W].X - D * Word[W].Width * (Word[W].Scale - 1) / 2 + (D+1)*10*ScreenX, Word[W].Y - D * 1.5 * Word[W].Size *(Word[W].Scale - 1)); + SetFontSize(Word[W].Size + D * (Word[W].Size * Word[W].Scale - Word[W].Size)); + SetFontItalic(Word[W].Italic); + glColor3f(Word[W].ColR, Word[W].ColG, Word[W].ColB); + glPrint(pchar(Word[W].Text)) +end; + +procedure TLyric.DrawSlide(W: integer); +var + D: real; +begin + D := Word[W].Done; // przyrost + SetFontStyle(Word[W].FontStyle); + SetFontPos(Word[W].X, Word[W].Y); + SetFontSize(Word[W].Size); + SetFontItalic(Word[W].Italic); + glColor3f(Word[W].ColR, Word[W].ColG, Word[W].ColB); + glPrintDone(pchar(Word[W].Text), D, ColR, ColG, ColB); +end; + +function TLyric.SelectedLetter; // LCD +var + W: integer; +begin + Result := 1; + + for W := 0 to SelectedI-1 do + Result := Result + Length(Word[W].Text); +end; + +function TLyric.SelectedLength: integer; // LCD +begin + Result := Length(Word[SelectedI].Text); +end; + +end. diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 93a4892a..e896d603 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -2,6 +2,10 @@ unit UScreenEditSub; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + {$I switches.inc} uses @@ -16,7 +20,7 @@ uses ULog, UTexture, UMenuText, - ULyrics.bak, + ULyrics_bak, Math, OpenGL12, {$IFDEF UseMIDIPort} diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 42301946..7cbc2e55 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -73,7 +73,7 @@ uses USongs in 'Classes\USongs.pas', UIni in 'Classes\UIni.pas', ULyrics in 'Classes\ULyrics.pas', - ULyrics.bak in 'Classes\ULyrics.bak.pas', + ULyrics_bak in 'Classes\ULyrics_bak.pas', USkins in 'Classes\USkins.pas', UThemes in 'Classes\UThemes.pas', ULog in 'Classes\ULog.pas', diff --git a/Game/Code/UltraStar.lpi b/Game/Code/UltraStar.lpi index a3ff59ad..1b925455 100644 --- a/Game/Code/UltraStar.lpi +++ b/Game/Code/UltraStar.lpi @@ -1,730 +1,667 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index bb3b50b3..9793928e 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -1,412 +1,413 @@ -program UltraStar; - -{$DEFINE TRANSLATE} - -{$IFDEF FPC} - {$MODE DELPHI} -{$ELSE} - {$R 'UltraStar.res' 'UltraStar.rc'} -{$ENDIF} - -{$I switches.inc} - -uses - - // *************************************************************************** - // - // Developers PLEASE NOTE !!!!!!! - // - // As of september 2007, I am working towards porting Ultrastar-DX to run - // on Linux. I will be modifiying the source to make it compile in lazarus - // on windows & linux and I will make sure that it compiles in delphi still - // To help me in this endevour, please can you make a point of remembering - // that linux is CASE SENSATIVE, and file / unit names must be as per - // the filename exactly. - // - // EG : opengl12.pas must not be OpenGL in the uses cluase. - // - // thanks for your help... - // - // *************************************************************************** - - //------------------------------ - //Includes - 3rd Party Libraries - //------------------------------ - - // SDL / OpenGL - moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', - opengl12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\opengl12.pas', - sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', - - // Bass - {$IFDEF UseBASS} - bass in 'lib\bass\delphi\bass.pas', - {$ENDIF} - - // Midi Units - {$IFDEF UseMIDIPort} - Circbuf in 'lib\midi\CIRCBUF.PAS', - Delphmcb in 'lib\midi\Delphmcb.PAS', - MidiCons in 'lib\midi\MidiCons.PAS', - MidiDefs in 'lib\midi\MidiDefs.PAS', - MidiFile in 'lib\midi\MidiFile.PAS', - midiin in 'lib\midi\midiin.pas', - midiout in 'lib\midi\midiout.pas', - MidiType in 'lib\midi\MidiType.PAS', - {$ENDIF} - - // FFMpeg units - avcodec in 'lib\ffmpeg\avcodec.pas', - avformat in 'lib\ffmpeg\avformat.pas', - avio in 'lib\ffmpeg\avio.pas', - avutil in 'lib\ffmpeg\avutil.pas', - opt in 'lib\ffmpeg\opt.pas', - rational in 'lib\ffmpeg\rational.pas', - - - // Sql Lite - SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', - SQLite3 in 'lib\SQLite\SQLite3.pas', - - - //------------------------------ - //Includes - Menu System - //------------------------------ - - UDisplay in 'Menu\UDisplay.pas', - UDrawTexture in 'Menu\UDrawTexture.pas', - UMenu in 'Menu\UMenu.pas', - UMenuButton in 'Menu\UMenuButton.pas', - UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', - UMenuInteract in 'Menu\UMenuInteract.pas', - UMenuSelect in 'Menu\UMenuSelect.pas', - UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', - UMenuStatic in 'Menu\UMenuStatic.pas', - UMenuText in 'Menu\UMenuText.pas', - - //------------------------------ - //Includes - Classes - //------------------------------ - - {$IFDEF FPC} - ulazjpeg in 'Classes\ulazjpeg.pas', - {$ENDIF} - - TextGL in 'Classes\TextGL.pas', - UCatCovers in 'Classes\UCatCovers.pas', - UCommandLine in 'Classes\UCommandLine.pas', - UCommon in 'Classes\UCommon.pas', - UCovers in 'Classes\UCovers.pas', - UDataBase in 'Classes\UDataBase.pas', - UDLLManager in 'Classes\UDLLManager.pas', - UDraw in 'Classes\UDraw.pas', - UFiles in 'Classes\UFiles.pas', - UGraphic in 'Classes\UGraphic.pas', - UGraphicClasses in 'Classes\UGraphicClasses.pas', - UIni in 'Classes\UIni.pas', - UJoystick in 'Classes\UJoystick.pas', - ULanguage in 'Classes\ULanguage.pas', - ULCD in 'Classes\ULCD.pas', - ULight in 'Classes\ULight.pas', - ULog in 'Classes\ULog.pas', - ULyrics in 'Classes\ULyrics.pas', - UMain in 'Classes\UMain.pas', - UMusic in 'Classes\UMusic.pas', - UParty in 'Classes\UParty.pas', - UPlaylist in 'Classes\UPlaylist.pas', - URecord in 'Classes\URecord.pas', - USkins in 'Classes\USkins.pas', - USongs in 'Classes\USongs.pas', - UTexture in 'Classes\UTexture.pas', - UThemes in 'Classes\UThemes.pas', - UTime in 'Classes\UTime.pas', - - - //------------------------------ - //Includes - Video Support - //------------------------------ - UVideo in 'Classes\UVideo.pas', - - - //------------------------------ - //Includes - Screens - //------------------------------ - UScreenCredits in 'Screens\UScreenCredits.pas', - UScreenEdit in 'Screens\UScreenEdit.pas', - UScreenEditConvert in 'Screens\UScreenEditConvert.pas', - UScreenEditHeader in 'Screens\UScreenEditHeader.pas', - UScreenEditSub in 'Screens\UScreenEditSub.pas', - UScreenLevel in 'Screens\UScreenLevel.pas', - UScreenLoading in 'Screens\UScreenLoading.pas', - UScreenMain in 'Screens\UScreenMain.pas', - UScreenName in 'Screens\UScreenName.pas', - UScreenOpen in 'Screens\UScreenOpen.pas', - UScreenOptions in 'Screens\UScreenOptions.pas', - UScreenOptionsAdvanced in 'Screens\UScreenOptionsAdvanced.pas', - UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', - UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', - UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', - UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', - UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', - UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', - UScreenPopup in 'Screens\UScreenPopup.pas', - UScreenScore in 'Screens\UScreenScore.pas', - UScreenSing in 'Screens\UScreenSing.pas', - UScreenSong in 'Screens\UScreenSong.pas', - UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', - UScreenSongMenu in 'Screens\UScreenSongMenu.pas', - UScreenStatDetail in 'Screens\UScreenStatDetail.pas', - UScreenStatMain in 'Screens\UScreenStatMain.pas', - UScreenTop5 in 'Screens\UScreenTop5.pas', - UScreenWelcome in 'Screens\UScreenWelcome.pas', - - //------------------------------ - //Includes - Screens PartyMode - //------------------------------ - UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', - UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', - UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', - UScreenPartyScore in 'Screens\UScreenPartyScore.pas', - UScreenPartyWin in 'Screens\UScreenPartyWin.pas', - UScreenSingModi in 'Screens\UScreenSingModi.pas', - - //------------------------------ - //Includes - Modi SDK - //------------------------------ - ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', - - - //------------------------------ - //Includes - Delphi - //------------------------------ - {$IFDEF win32} - Windows, - {$ENDIF} - SysUtils; - -const - Version = 'UltraStar Deluxe V 1.10 Alpha Build'; - -var - WndTitle: string; - hWnd: THandle; - I: Integer; - -begin - WndTitle := Version; - - {$ifdef Win32} - //------------------------------ - //Start more than One Time Prevention - //------------------------------ - hWnd:= FindWindow(nil, PChar(WndTitle)); - //Programm already started - if (hWnd <> 0) then - begin - I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Contìnue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); - if (I = IDYes) then - begin - I := 1; - repeat - Inc(I); - hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); - until (hWnd = 0); - - WndTitle := WndTitle + ' Instance ' + InttoStr(I); - end - else - Exit; - end; - {$endif} - - //------------------------------ - //StartUp - Create Classes and Load Files - //------------------------------ - USTime := TTime.Create; - - // Commandline Parameter Parser - Params := TCMDParams.Create; - - // Log + Benchmark - Log := TLog.Create; - Log.Title := WndTitle; - Log.Enabled := Not Params.NoLog; - Log.BenchmarkStart(0); - - // Language - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Paths', 'Initialization'); InitializePaths; - Log.LogStatus('Load Language', 'Initialization'); Language := TLanguage.Create; - //Add Const Values: - Language.AddConst('US_VERSION', Version); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Language', 1); - - // SDL - Log.BenchmarkStart(1); - Log.LogStatus('Initialize SDL', 'Initialization'); - SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing SDL', 1); - - // Skin - Log.BenchmarkStart(1); - Log.LogStatus('Loading Skin List', 'Initialization'); Skin := TSkin.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Skin List', 1); - - // Sound Card List - Log.BenchmarkStart(1); - Log.LogStatus('Loading Soundcard list', 'Initialization'); - Recording := TRecord.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Soundcard list', 1); - - // Ini + Paths - Log.BenchmarkStart(1); - Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; - Ini.Load; - - //Load Languagefile - if (Params.Language <> -1) then - Language.ChangeLanguage(ILanguage[Params.Language]) - else - Language.ChangeLanguage(ILanguage[Ini.Language]); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Ini', 1); - - // LCD - Log.BenchmarkStart(1); - Log.LogStatus('Load LCD', 'Initialization'); LCD := TLCD.Create; - if Ini.LPT = 1 then begin -// LCD.HalfInterface := true; - LCD.Enable; - LCD.Clear; - LCD.WriteText(1, ' UltraStar '); - LCD.WriteText(2, ' Loading... '); - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading LCD', 1); - - // Light - Log.BenchmarkStart(1); - Log.LogStatus('Load Light', 'Initialization'); Light := TLight.Create; - if Ini.LPT = 2 then begin - Light.Enable; - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Light', 1); - - // Theme - Log.BenchmarkStart(1); - Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Themes', 1); - - // Covers Cache - Log.BenchmarkStart(1); - Log.LogStatus('Creating Covers Cache', 'Initialization'); Covers := TCovers.Create; - Log.LogBenchmark('Loading Covers Cache Array', 1); - Log.BenchmarkStart(1); - - // Category Covers - Log.BenchmarkStart(1); - Log.LogStatus('Creating Category Covers Array', 'Initialization'); - CatCovers:= TCatCovers.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Category Covers Array', 1); - - // Songs - //Log.BenchmarkStart(1); - Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; - Songs.LoadSongList; - Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Songs', 1); - - // PluginManager - Log.BenchmarkStart(1); - Log.LogStatus('PluginManager', 'Initialization'); - DLLMan := TDLLMan.Create; //Load PluginList - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PluginManager', 1); - - // Party Mode Manager - Log.BenchmarkStart(1); - Log.LogStatus('PartySession Manager', 'Initialization'); - PartySession := TParty_Session.Create; //Load PartySession - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PartySession Manager', 1); - - // Graphics - Log.BenchmarkStart(1); - Log.LogStatus('Initialize 3D', 'Initialization'); Initialize3D(WndTitle); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing 3D', 1); - - // Sound - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Sound', 'Initialization'); - Log.LogStatus('Creating Music', 'InitializeSound'); Music := TMusic.Create; - InitializeSound; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Sound', 1); - - // Score Saving System - Log.BenchmarkStart(1); - Log.LogStatus('DataBase System', 'Initialization'); - DataBase := TDataBaseSystem.Create; - - if (Params.ScoreFile = '') then - DataBase.Init ('Ultrastar.db') - else - DataBase.Init (Params.ScoreFile); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading DataBase System', 1); - - //Playlist Manager - Log.BenchmarkStart(1); - Log.LogStatus('Playlist Manager', 'Initialization'); - PlaylistMan := TPlaylistManager.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Playlist Manager', 1); - - //GoldenStarsTwinkleMod - Log.BenchmarkStart(1); - Log.LogStatus('Effect Manager', 'Initialization'); - GoldenRec := TEffectManager.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Particel System', 1); - - // Joypad - if (Ini.Joypad = 1) OR (Params.Joypad) then begin - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Joystick', 'Initialization'); Joy := TJoy.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Joystick', 1); - end; - - Log.BenchmarkEnd(0); - Log.LogBenchmark('Loading Time', 0); - - - //------------------------------ - //Start- Mainloop - //------------------------------ - //Music.SetLoop(true); - //Music.SetVolume(50); - //Music.Open(SkinPath + 'Menu Music 3.mp3'); - //Music.Play; - Log.LogStatus('Main Loop', 'Initialization'); MainLoop; - - //------------------------------ - //Finish Application - //------------------------------ - if Ini.LPT = 1 then LCD.Clear; - if Ini.LPT = 2 then Light.TurnOff; - - Log.Free; -end. +program UltraStar; + +{$DEFINE TRANSLATE} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ELSE} + {$R 'UltraStar.res' 'UltraStar.rc'} +{$ENDIF} + +{$I switches.inc} + +uses + + // *************************************************************************** + // + // Developers PLEASE NOTE !!!!!!! + // + // As of september 2007, I am working towards porting Ultrastar-DX to run + // on Linux. I will be modifiying the source to make it compile in lazarus + // on windows & linux and I will make sure that it compiles in delphi still + // To help me in this endevour, please can you make a point of remembering + // that linux is CASE SENSATIVE, and file / unit names must be as per + // the filename exactly. + // + // EG : opengl12.pas must not be OpenGL in the uses cluase. + // + // thanks for your help... + // + // *************************************************************************** + + //------------------------------ + //Includes - 3rd Party Libraries + //------------------------------ + + // SDL / OpenGL + moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', + opengl12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\opengl12.pas', + sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', + + // Bass + {$IFDEF UseBASS} + bass in 'lib\bass\delphi\bass.pas', + {$ENDIF} + + // Midi Units + {$IFDEF UseMIDIPort} + Circbuf in 'lib\midi\CIRCBUF.PAS', + Delphmcb in 'lib\midi\Delphmcb.PAS', + MidiCons in 'lib\midi\MidiCons.PAS', + MidiDefs in 'lib\midi\MidiDefs.PAS', + MidiFile in 'lib\midi\MidiFile.PAS', + midiin in 'lib\midi\midiin.pas', + midiout in 'lib\midi\midiout.pas', + MidiType in 'lib\midi\MidiType.PAS', + {$ENDIF} + + // FFMpeg units + avcodec in 'lib\ffmpeg\avcodec.pas', + avformat in 'lib\ffmpeg\avformat.pas', + avio in 'lib\ffmpeg\avio.pas', + avutil in 'lib\ffmpeg\avutil.pas', + opt in 'lib\ffmpeg\opt.pas', + rational in 'lib\ffmpeg\rational.pas', + + + // Sql Lite + SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', + SQLite3 in 'lib\SQLite\SQLite3.pas', + + + //------------------------------ + //Includes - Menu System + //------------------------------ + + UDisplay in 'Menu\UDisplay.pas', + UDrawTexture in 'Menu\UDrawTexture.pas', + UMenu in 'Menu\UMenu.pas', + UMenuButton in 'Menu\UMenuButton.pas', + UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', + UMenuInteract in 'Menu\UMenuInteract.pas', + UMenuSelect in 'Menu\UMenuSelect.pas', + UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', + UMenuStatic in 'Menu\UMenuStatic.pas', + UMenuText in 'Menu\UMenuText.pas', + + //------------------------------ + //Includes - Classes + //------------------------------ + + {$IFDEF FPC} + ulazjpeg in 'Classes\ulazjpeg.pas', + {$ENDIF} + + TextGL in 'Classes\TextGL.pas', + UCatCovers in 'Classes\UCatCovers.pas', + UCommandLine in 'Classes\UCommandLine.pas', + UCommon in 'Classes\UCommon.pas', + UCovers in 'Classes\UCovers.pas', + UDataBase in 'Classes\UDataBase.pas', + UDLLManager in 'Classes\UDLLManager.pas', + UDraw in 'Classes\UDraw.pas', + UFiles in 'Classes\UFiles.pas', + UGraphic in 'Classes\UGraphic.pas', + UGraphicClasses in 'Classes\UGraphicClasses.pas', + UIni in 'Classes\UIni.pas', + UJoystick in 'Classes\UJoystick.pas', + ULanguage in 'Classes\ULanguage.pas', + ULCD in 'Classes\ULCD.pas', + ULight in 'Classes\ULight.pas', + ULog in 'Classes\ULog.pas', + ULyrics in 'Classes\ULyrics.pas', + ULyrics_bak in 'Classes\ULyrics_bak.pas', + UMain in 'Classes\UMain.pas', + UMusic in 'Classes\UMusic.pas', + UParty in 'Classes\UParty.pas', + UPlaylist in 'Classes\UPlaylist.pas', + URecord in 'Classes\URecord.pas', + USkins in 'Classes\USkins.pas', + USongs in 'Classes\USongs.pas', + UTexture in 'Classes\UTexture.pas', + UThemes in 'Classes\UThemes.pas', + UTime in 'Classes\UTime.pas', + + + //------------------------------ + //Includes - Video Support + //------------------------------ + UVideo in 'Classes\UVideo.pas', + + + //------------------------------ + //Includes - Screens + //------------------------------ + UScreenCredits in 'Screens\UScreenCredits.pas', + UScreenEdit in 'Screens\UScreenEdit.pas', + UScreenEditConvert in 'Screens\UScreenEditConvert.pas', + UScreenEditHeader in 'Screens\UScreenEditHeader.pas', + UScreenEditSub in 'Screens\UScreenEditSub.pas', + UScreenLevel in 'Screens\UScreenLevel.pas', + UScreenLoading in 'Screens\UScreenLoading.pas', + UScreenMain in 'Screens\UScreenMain.pas', + UScreenName in 'Screens\UScreenName.pas', + UScreenOpen in 'Screens\UScreenOpen.pas', + UScreenOptions in 'Screens\UScreenOptions.pas', + UScreenOptionsAdvanced in 'Screens\UScreenOptionsAdvanced.pas', + UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', + UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', + UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', + UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', + UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', + UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', + UScreenPopup in 'Screens\UScreenPopup.pas', + UScreenScore in 'Screens\UScreenScore.pas', + UScreenSing in 'Screens\UScreenSing.pas', + UScreenSong in 'Screens\UScreenSong.pas', + UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', + UScreenSongMenu in 'Screens\UScreenSongMenu.pas', + UScreenStatDetail in 'Screens\UScreenStatDetail.pas', + UScreenStatMain in 'Screens\UScreenStatMain.pas', + UScreenTop5 in 'Screens\UScreenTop5.pas', + UScreenWelcome in 'Screens\UScreenWelcome.pas', + + //------------------------------ + //Includes - Screens PartyMode + //------------------------------ + UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', + UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', + UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', + UScreenPartyScore in 'Screens\UScreenPartyScore.pas', + UScreenPartyWin in 'Screens\UScreenPartyWin.pas', + UScreenSingModi in 'Screens\UScreenSingModi.pas', + + //------------------------------ + //Includes - Modi SDK + //------------------------------ + ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', + + + //------------------------------ + //Includes - Delphi + //------------------------------ + {$IFDEF win32} + Windows, + {$ENDIF} + SysUtils; + +const + Version = 'UltraStar Deluxe V 1.10 Alpha Build'; + +var + WndTitle: string; + hWnd: THandle; + I: Integer; + +begin + WndTitle := Version; + + {$ifdef Win32} + //------------------------------ + //Start more than One Time Prevention + //------------------------------ + hWnd:= FindWindow(nil, PChar(WndTitle)); + //Programm already started + if (hWnd <> 0) then + begin + I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Contìnue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); + if (I = IDYes) then + begin + I := 1; + repeat + Inc(I); + hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); + until (hWnd = 0); + + WndTitle := WndTitle + ' Instance ' + InttoStr(I); + end + else + Exit; + end; + {$endif} + + //------------------------------ + //StartUp - Create Classes and Load Files + //------------------------------ + USTime := TTime.Create; + + // Commandline Parameter Parser + Params := TCMDParams.Create; + + // Log + Benchmark + Log := TLog.Create; + Log.Title := WndTitle; + Log.Enabled := Not Params.NoLog; + Log.BenchmarkStart(0); + + // Language + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Paths', 'Initialization'); InitializePaths; + Log.LogStatus('Load Language', 'Initialization'); Language := TLanguage.Create; + //Add Const Values: + Language.AddConst('US_VERSION', Version); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Language', 1); + + // SDL + Log.BenchmarkStart(1); + Log.LogStatus('Initialize SDL', 'Initialization'); + SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing SDL', 1); + + // Skin + Log.BenchmarkStart(1); + Log.LogStatus('Loading Skin List', 'Initialization'); Skin := TSkin.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Skin List', 1); + + // Sound Card List + Log.BenchmarkStart(1); + Log.LogStatus('Loading Soundcard list', 'Initialization'); + Recording := TRecord.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Soundcard list', 1); + + // Ini + Paths + Log.BenchmarkStart(1); + Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; + Ini.Load; + + //Load Languagefile + if (Params.Language <> -1) then + Language.ChangeLanguage(ILanguage[Params.Language]) + else + Language.ChangeLanguage(ILanguage[Ini.Language]); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Ini', 1); + + // LCD + Log.BenchmarkStart(1); + Log.LogStatus('Load LCD', 'Initialization'); LCD := TLCD.Create; + if Ini.LPT = 1 then begin +// LCD.HalfInterface := true; + LCD.Enable; + LCD.Clear; + LCD.WriteText(1, ' UltraStar '); + LCD.WriteText(2, ' Loading... '); + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading LCD', 1); + + // Light + Log.BenchmarkStart(1); + Log.LogStatus('Load Light', 'Initialization'); Light := TLight.Create; + if Ini.LPT = 2 then begin + Light.Enable; + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Light', 1); + + // Theme + Log.BenchmarkStart(1); + Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Themes', 1); + + // Covers Cache + Log.BenchmarkStart(1); + Log.LogStatus('Creating Covers Cache', 'Initialization'); Covers := TCovers.Create; + Log.LogBenchmark('Loading Covers Cache Array', 1); + Log.BenchmarkStart(1); + + // Category Covers + Log.BenchmarkStart(1); + Log.LogStatus('Creating Category Covers Array', 'Initialization'); + CatCovers:= TCatCovers.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Category Covers Array', 1); + + // Songs + //Log.BenchmarkStart(1); + Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; + Songs.LoadSongList; + Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Songs', 1); + + // PluginManager + Log.BenchmarkStart(1); + Log.LogStatus('PluginManager', 'Initialization'); + DLLMan := TDLLMan.Create; //Load PluginList + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PluginManager', 1); + + // Party Mode Manager + Log.BenchmarkStart(1); + Log.LogStatus('PartySession Manager', 'Initialization'); + PartySession := TParty_Session.Create; //Load PartySession + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PartySession Manager', 1); + + // Graphics + Log.BenchmarkStart(1); + Log.LogStatus('Initialize 3D', 'Initialization'); Initialize3D(WndTitle); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing 3D', 1); + + // Sound + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Sound', 'Initialization'); + Log.LogStatus('Creating Music', 'InitializeSound'); Music := TMusic.Create; + InitializeSound; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Sound', 1); + + // Score Saving System + Log.BenchmarkStart(1); + Log.LogStatus('DataBase System', 'Initialization'); + DataBase := TDataBaseSystem.Create; + + if (Params.ScoreFile = '') then + DataBase.Init ('Ultrastar.db') + else + DataBase.Init (Params.ScoreFile); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading DataBase System', 1); + + //Playlist Manager + Log.BenchmarkStart(1); + Log.LogStatus('Playlist Manager', 'Initialization'); + PlaylistMan := TPlaylistManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Playlist Manager', 1); + + //GoldenStarsTwinkleMod + Log.BenchmarkStart(1); + Log.LogStatus('Effect Manager', 'Initialization'); + GoldenRec := TEffectManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Particel System', 1); + + // Joypad + if (Ini.Joypad = 1) OR (Params.Joypad) then begin + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Joystick', 'Initialization'); Joy := TJoy.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Joystick', 1); + end; + + Log.BenchmarkEnd(0); + Log.LogBenchmark('Loading Time', 0); + + + //------------------------------ + //Start- Mainloop + //------------------------------ + //Music.SetLoop(true); + //Music.SetVolume(50); + //Music.Open(SkinPath + 'Menu Music 3.mp3'); + //Music.Play; + Log.LogStatus('Main Loop', 'Initialization'); MainLoop; + + //------------------------------ + //Finish Application + //------------------------------ + if Ini.LPT = 1 then LCD.Clear; + if Ini.LPT = 2 then Light.TurnOff; + + Log.Free; +end. -- cgit v1.2.3 From a1c2876fb12cfc860044f00210f69a9bdc2cf687 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Sep 2007 10:35:02 +0000 Subject: minor fixes for lazarus build.. forgot file... oops.. :) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@416 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphic.pas | 66 +- Game/Code/Classes/UTexture.pas | 2143 +++++++++++++++++----------------- Game/Code/Classes/Ulazjpeg.pas | 118 ++ Game/Code/Screens/UScreenLoading.pas | 21 +- Game/Code/UltraStar.lpi | 172 +-- Game/Code/UltraStar.lpr | 2 + 6 files changed, 1383 insertions(+), 1139 deletions(-) create mode 100644 Game/Code/Classes/Ulazjpeg.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 7c0ef57e..7094c0f9 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -66,9 +66,8 @@ type end; var - Screen: PSDL_Surface; - - LoadingThread: PSDL_Thread; + Screen: PSDL_Surface; + LoadingThread: PSDL_Thread; Mutex: PSDL_Mutex; RenderW: integer; @@ -256,41 +255,44 @@ var begin // zaladowanie tekstur Log.LogStatus('Loading Textures', 'LoadTextures'); + Tex_Left[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'BMP', 'Transparent', 0); //brauch man die noch? Tex_Mid[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'BMP', 'Plain', 0); //brauch man die noch? Tex_Right[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'BMP', 'Transparent', 0); //brauch man die noch? // P1-6 - for P := 1 to 6 do begin + for P := 1 to 6 do + begin LoadColor(R, G, B, 'P' + IntToStr(P) + 'Light'); Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); - Tex_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'PNG', 'Colorized', Col); - Tex_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'PNG', 'Colorized', Col); - Tex_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'PNG', 'Colorized', Col); - - Tex_plain_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainLeft')), 'PNG', 'Colorized', Col); - Tex_plain_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainMid')), 'PNG', 'Colorized', Col); - Tex_plain_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainRight')), 'PNG', 'Colorized', Col); - - Tex_BG_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGLeft')), 'PNG', 'Colorized', Col); - Tex_BG_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGMid')), 'PNG', 'Colorized', Col); - Tex_BG_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGRight')), 'PNG', 'Colorized', Col); + + Tex_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'PNG', 'Colorized', Col); + Tex_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'PNG', 'Colorized', Col); + Tex_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'PNG', 'Colorized', Col); + + Tex_plain_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainLeft')), 'PNG', 'Colorized', Col); + Tex_plain_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainMid')), 'PNG', 'Colorized', Col); + Tex_plain_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainRight')), 'PNG', 'Colorized', Col); + + Tex_BG_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGLeft')), 'PNG', 'Colorized', Col); + Tex_BG_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGMid')), 'PNG', 'Colorized', Col); + Tex_BG_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGRight')), 'PNG', 'Colorized', Col); end; Tex_Note_Perfect_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePerfectStar')), 'JPG', 'Font Black', 0); - Tex_Note_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteStar')) , 'JPG', 'Alpha Black Colored', $FFFFFF); - Tex_Ball := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'BMP', 'Transparent', $FF00FF); - Tex_Lyric_Help_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricHelpBar')), 'BMP', 'Transparent', $FF00FF); + Tex_Note_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteStar')) , 'JPG', 'Alpha Black Colored', $FFFFFF); + Tex_Ball := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'BMP', 'Transparent', $FF00FF); + Tex_Lyric_Help_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricHelpBar')), 'BMP', 'Transparent', $FF00FF); //TimeBar mod - Tex_TimeProgress := Texture.LoadTexture(pchar(Skin.GetTextureFileName('TimeBar'))); + Tex_TimeProgress := Texture.LoadTexture(pchar(Skin.GetTextureFileName('TimeBar'))); //eoa TimeBar mod //SingBar Mod - Tex_SingBar_Back := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBack')), 'JPG', 'Plain', 0); - Tex_SingBar_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBar')), 'JPG', 'Plain', 0); - Tex_SingBar_Front := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarFront')), 'JPG', 'Font', 0); + Tex_SingBar_Back := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBack')), 'JPG', 'Plain', 0); + Tex_SingBar_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBar')), 'JPG', 'Plain', 0); + Tex_SingBar_Front := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarFront')), 'JPG', 'Font', 0); //end Singbar Mod //Line Bonus PopUp @@ -370,6 +372,7 @@ begin Log.BenchmarkEnd(2); Log.LogBenchmark('--> Loading Fonts', 2); } + Log.BenchmarkStart(2); Display := TDisplay.Create; SDL_EnableUnicode(1); @@ -378,7 +381,11 @@ begin Log.LogStatus('Loading Screens', 'Initialize3D'); Log.BenchmarkStart(3); + // Show the Loading Screen ------------- LoadLoadingScreen; + + + // now that we have something to display while loading, // start thread that loads the rest of ultrastar // Mutex := SDL_CreateMutex; @@ -414,7 +421,7 @@ begin //SDL_WaitThread(LoadingThread, I); // SDL_DestroyMutex(Mutex); - Display.ActualScreen^.FadeTo(@ScreenMain); + Display.ActualScreen^.FadeTo( @ScreenMain ); Log.BenchmarkEnd(2); Log.LogBenchmark('--> Loading Screens', 2); @@ -486,12 +493,17 @@ begin // SDL_SetRefreshrate(85); // SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); if (Ini.FullScreen = 0) and (Not Params.FullScreen) then + begin screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL) - else begin + end + else + begin screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN); SDL_ShowCursor(0); end; - if (screen = nil) then begin + + if (screen = nil) then + begin Log.LogError('SDL_SetVideoMode Failed', 'Initialize3D'); exit; end; @@ -512,10 +524,14 @@ procedure LoadLoadingScreen; begin ScreenLoading := TScreenLoading.Create; ScreenLoading.onShow; + Display.ActualScreen := @ScreenLoading; + swapbuffers; + ScreenLoading.Draw; Display.Draw; + SwapBuffers; end; diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 1bc4c558..364bbcc8 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -1,1043 +1,1100 @@ -unit UTexture; - -// Plain (alpha = 1) -// Transparent -// Transparent Range -// Font (white is drawn, black is transparent) -// Font Outline (Font with darker outline) -// Font Outline 2 (Font with darker outline) -// Font Black (black is drawn, white is transparent) -// Font Gray (gray is drawn, white is transparent) -// Arrow (for arrows, white is white, gray has color, black is transparent); - -interface - -{$I switches.inc} - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -uses OpenGL12, - {$IFDEF win32} - windows, - {$ENDIF} - Math, - Classes, - SysUtils, - {$IFDEF FPC} - ulazjpeg, - {$ELSE} - JPEG, - PNGImage, - {$ENDIF} - Graphics, - UCommon, - UThemes; - - - {$IFDEF Win32} - procedure glGenTextures(n: GLsizei; var textures: GLuint); stdcall; external opengl32; - - {$ELSE} - {$ifdef darwin} - const opengl32 = '/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib'; - {$ELSE} - const opengl32 = 'libGL.so' ; // YES Capital GL - {$ENDIF} - - procedure glGenTextures(n: GLsizei; var textures: GLuint); stdcall; external opengl32; - {$ENDIF} - -type - TTexture = record - TexNum: integer; - X: real; - Y: real; - Z: real; // new - W: real; - H: real; - ScaleW: real; // for dynamic scalling while leaving width constant - ScaleH: real; // for dynamic scalling while leaving height constant - Rot: real; // 0 - 2*pi - Int: real; // intensity - ColR: real; - ColG: real; - ColB: real; - TexW: real; // used? - TexH: real; // used? - TexX1: real; - TexY1: real; - TexX2: real; - TexY2: real; - Alpha: real; - Name: string; // 0.5.0: experimental for handling cache images. maybe it's useful for dynamic skins - end; - - TTextureEntry = record - Name: string; - Typ: string; - - // we use normal TTexture, it's easier to implement and if needed - we copy ready data - Texture: TTexture; - TextureCache: TTexture; // 0.5.0 - end; - - TTextureDatabase = record - Texture: array of TTextureEntry; - end; - - TTextureUnit = class - Limit: integer; - CreateCacheMipmap: boolean; - -// function GetNumberFor - function GetTexture(Name, Typ: string): TTexture; overload; - function GetTexture(Name, Typ: string; FromCache: boolean): TTexture; overload; - function FindTexture(Name: string): integer; - function LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; - function LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; - function LoadTexture(Identifier: string): TTexture; overload; - function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; - procedure UnloadTexture(Name: string; FromCache: boolean); - end; - -var - lasthue: double; - Texture: TTextureUnit; - TextureDatabase: TTextureDatabase; - - PrintScreenData: array[0..1024*768-1] of longword; - - ActTex: GLuint;//integer; - - TexOrigW: integer; - TexOrigH: integer; - TexNewW: integer; - TexNewH: integer; - - TexFitW: integer; - TexFitH: integer; // new for limit - - TextureD8: array[1..1024*1024] of byte; // 1MB - TextureD16: array[1..1024*1024, 1..2] of byte; // luminance/alpha tex (2MB) - TextureD24: array[1..1024*1024, 1..3] of byte; // normal 24-bit tex (3MB) - TextureD242: array[1..512*512, 1..3] of byte; // normal 24-bit tex (0,75MB) - TextureD32: array[1..1024*1024, 1..4] of byte; // transparent 32-bit tex (4MB) - // total 40MB at 2048*2048 - // total 10MB at 1024*1024 - - Mipmapping: Boolean; - - CacheMipmap: array[0..256*256*3-1] of byte; // 3KB - - -implementation -uses ULog, DateUtils, UCovers, StrUtils; - -function TTextureUnit.GetTexture(Name, Typ: string): TTexture; -begin - Result := GetTexture(Name, Typ, true); -end; - -function TTextureUnit.GetTexture(Name, Typ: string; FromCache: boolean): TTexture; -var - T: integer; // texture - C: integer; // cover - Data: array of byte; -begin - // find texture entry - T := FindTexture(Name); - - if T = -1 then begin - // create texture entry - T := Length(TextureDatabase.Texture); - SetLength(TextureDatabase.Texture, T+1); - TextureDatabase.Texture[T].Name := Name; - TextureDatabase.Texture[T].Typ := Typ; - - // inform database that no textures have been loaded into memory - TextureDatabase.Texture[T].Texture.TexNum := -1; - TextureDatabase.Texture[T].TextureCache.TexNum := -1; - end; - - // use preloaded texture - if (not FromCache) or (FromCache and not Covers.CoverExists(Name)) then begin - // use full texture - if TextureDatabase.Texture[T].Texture.TexNum = -1 then begin - // load texture - TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', pchar(Typ), $0); - end; - - // use texture - Result := TextureDatabase.Texture[T].Texture; - - end; - - if FromCache and Covers.CoverExists(Name) then begin - // use cache texture - C := Covers.CoverNumber(Name); - - if TextureDatabase.Texture[T].TextureCache.TexNum = -1 then begin - // load texture - Covers.PrepareData(Name); - TextureDatabase.Texture[T].TextureCache := CreateTexture(Covers.Data, Name, Covers.Cover[C].W, Covers.Cover[C].H, 24); - end; - - // use texture - Result := TextureDatabase.Texture[T].TextureCache; - end; -end; - -function TTextureUnit.FindTexture(Name: string): integer; -var - T: integer; // texture -begin - Result := -1; - for T := 0 to high(TextureDatabase.Texture) do - if TextureDatabase.Texture[T].Name = Name then - Result := T; -end; - -// expects: src, dst: pointers to r,g,b,a -// hue: new hue within range [0.0-6.0) -procedure ColorizeCopy(Src, Dst: PByteArray; hue: Double); overload; -var - i,j,k: Cardinal; - clr, hls: array[0..2] of Double; - delta, f, p, q, t: Double; -begin - hls[0]:=hue; - - clr[0] := src[0]/255; - clr[1] := src[1]/255; - clr[2] := src[2]/255; - - //calculate luminance and saturation from rgb - hls[1] := maxvalue(clr); //l:=... - delta := hls[1] - minvalue(clr); - - if hls[1] = 0.0 then - hls[2] := 0.0 - else - hls[2] := delta/hls[1]; //v:=... - - // calc new rgb from our hls (h from color, l ans s from pixel) -// if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense - begin - k:=trunc(hls[0]); - f:=hls[0]-k; - p:=hls[1]*(1.0-hls[2]); - q:=hls[1]*(1.0-(hls[2]*f)); - t:=hls[1]*(1.0-(hls[2]*(1.0-f))); - case k of - 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end; - 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end; - 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end; - 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end; - 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end; - 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; - end; - // and store new rgb back into the image - dst[0]:=floor(255*clr[0]); - dst[1]:=floor(255*clr[1]); - dst[2]:=floor(255*clr[2]); - dst[3]:=src[3]; - end; -end; - -// expects: src: $rrggbb -// dst: pointer to r,g,b,a -// hue: new hue within range [0.0-6.0) -procedure ColorizeCopy(Src: Cardinal; Dst: PByteArray; hue: Double); overload; -var - i,j,k: Cardinal; - clr, hls: array[0..2] of Double; - delta, f, p, q, t: Double; -begin - hls[0]:=hue; - - clr[0]:=((src shr 16) and $ff)/255; - clr[1]:=((src shr 8) and $ff)/255; - clr[2]:=(src and $ff)/255; - //calculate luminance and saturation from rgb - hls[1]:=maxvalue(clr); //l:=... - delta:=hls[1]-minvalue(clr); - if hls[1]=0.0 then hls[2]:=0.0 else hls[2]:=delta/hls[1]; //v:=... - // calc new rgb from our hls (h from color, l ans s from pixel) -// if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense - begin - k:=trunc(hls[0]); - f:=hls[0]-k; - p:=hls[1]*(1.0-hls[2]); - q:=hls[1]*(1.0-(hls[2]*f)); - t:=hls[1]*(1.0-(hls[2]*(1.0-f))); - case k of - 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end; - 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end; - 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end; - 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end; - 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end; - 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; - end; - // and store new rgb back into the image - dst[0]:=floor(255*clr[0]); - dst[1]:=floor(255*clr[1]); - dst[2]:=floor(255*clr[2]); - dst[3]:=255; - end; -end; -//returns hue within range [0.0-6.0) -function col2h(Color:Cardinal):double; -var - clr,hls: array[0..2] of double; - delta: double; -begin - clr[0]:=((Color and $ff0000) shr 16)/255; - clr[1]:=((Color and $ff00) shr 8)/255; - clr[2]:=(Color and $ff)/255; - hls[1]:=maxvalue(clr); - delta:=hls[1]-minvalue(clr); - if clr[0]=hls[1] then hls[0]:=(clr[1]-clr[2])/delta - else if clr[1]=hls[1] then hls[0]:=2.0+(clr[2]-clr[0])/delta - else if clr[2]=hls[1] then hls[0]:=4.0+(clr[0]-clr[1])/delta; - if hls[0]<0.0 then hls[0]:=hls[0]+6.0; - if hls[0]=6.0 then hls[0]:=0.0; - col2h:=hls[0]; -end; - - -function TTextureUnit.LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; -var - Res: TResourceStream; - TextureB: TBitmap; - TextureJ: TJPEGImage; - {$IFNDEF FPC} - TexturePNG: TPNGObject; - {$ENDIF} - - TextureAlpha: array of byte; - AlphaPtr: PByte; - TransparentColor: TColor; - PixelColor: TColor; - - Position: integer; - Position2: integer; - Pix: integer; - ColInt: real; - PPix: PByteArray; - TempA: integer; - Error: integer; - SkipX: integer; - myAlpha: Real; - myRGBABitmap: array of byte; - RGBPtr: PByte; - myHue: Double; -begin - {$IFNDEF FPC} // TODO : JB_lazarus eeeew this is a nasty one... - // but lazarus implementation scanlines is different :( - // need to implement as per - // http://www.lazarus.freepascal.org/index.php?name=PNphpBB2&file=viewtopic&p=18512 - // http://www.lazarus.freepascal.org/index.php?name=PNphpBB2&file=viewtopic&p=10797 - // http://wiki.lazarus.freepascal.org/Developing_with_Graphics - Log.BenchmarkStart(4); - Mipmapping := true; - - if FromRegistry then begin - try - Res := TResourceStream.Create(HInstance, Identifier, Format); - except - beep; - Exit; - end; - end; - - // filetype "detection" - if (not FromRegistry) and (FileExists(Identifier)) then begin - Format:=''; - Format := PAnsichar(UpperCase(RightStr(ExtractFileExt(Identifier),3))); - end; -// else Format:='JPG'; -// if not ((Format='BMP')or(Format='JPG')or(Format='PNG')) then Format:='JPG'; - - if FromRegistry or ((not FromRegistry) and FileExists(Identifier)) then begin - TextureB := TBitmap.Create; - - if Format = 'BMP' then - begin - if FromRegistry then - TextureB.LoadFromStream(Res) - else - TextureB.LoadFromFile(Identifier); - end - else - if Format = 'JPG' then - begin - TextureJ := TJPEGImage.Create; - - if FromRegistry then - TextureJ.LoadFromStream(Res) - else - begin - if FileExists(Identifier) then - TextureJ.LoadFromFile(Identifier) - else - Exit; - end; - - TextureB.Assign(TextureJ); - TextureJ.Free; - end - else if Format = 'PNG' then - begin - {$IFNDEF FPC} - // TODO : JB_lazarus - fix this for lazarus.. - TexturePNG := TPNGObject.Create; - if FromRegistry then - TexturePNG.LoadFromStream(Res) - else - begin - if FileExists(Identifier) then - TexturePNG.LoadFromFile(Identifier) - else - Exit; - end; - - TextureB.Assign(TexturePNG); - // transparent png hack start (part 1 of 2) - if ((Typ = 'Transparent') or (Typ = 'Colorized')) and (TexturePNG.TransparencyMode = ptmPartial) then - begin - setlength(TextureAlpha, TextureB.Width*TextureB.Height); - setlength(MyRGBABitmap,TextureB.Width*TextureB.Height*4); - if (TexturePNG.Header.ColorType = COLOR_GRAYSCALEALPHA) or - (TexturePNG.Header.ColorType = COLOR_RGBALPHA) then - begin - // i would have preferred english variables here but i use Position because i'm lazy - for Position := 0 to TextureB.Height - 1 do - begin - AlphaPtr := PByte(TexturePNG.AlphaScanline[Position]); - RGBPtr:=PByte(TexturePNG.Scanline[Position]); - for Position2 := 0 to TextureB.Width - 1 do - begin - TextureAlpha[Position*TextureB.Width+Position2]:= AlphaPtr^; - MyRGBABitmap[(Position*TextureB.Width+Position2)*4]:= RGBPtr^; - Inc(RGBPtr); - MyRGBABitmap[(Position*TextureB.Width+Position2)*4+1]:= RGBPtr^; - Inc(RGBPtr); - MyRGBABitmap[(Position*TextureB.Width+Position2)*4+2]:= RGBPtr^; - Inc(RGBPtr); - MyRGBABitmap[(Position*TextureB.Width+Position2)*4+3]:= AlphaPtr^; -// Inc(RGBPtr); - Inc(AlphaPtr); - end; - end; - end; - end else - setlength(TextureAlpha,0); // just no special transparency for unimplemented transparency types (ptmBit) - // transparent png hack end - TexturePNG.Free; - {$ENDIF} - end; - - if FromRegistry then Res.Free; - - if (TextureB.Width > 1024) or (TextureB.Height > 1024) then begin // will be fixed in 0.5.1 and dynamically extended to 8192x8192 depending on the driver - Log.LogError('Image ' + Identifier + ' is too big (' + IntToStr(TextureB.Width) + 'x' + IntToStr(TextureB.Height) + ')'); - Result.TexNum := -1; - end else begin - - glGenTextures(1, ActTex); - glBindTexture(GL_TEXTURE_2D, ActTex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - if Typ = 'Plain' then begin - // dimensions - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - - // copy and process pixeldata - TextureB.PixelFormat := pf24bit; -{ if (TextureB.PixelFormat = pf8bit) then begin - for Position := 0 to TexOrigH-1 do begin - for Position2 := 0 to TexOrigW-1 do begin - Pix := TextureB.Canvas.Pixels[Position2, Position]; - TextureD24[Position*TexNewW + Position2+1, 1] := Pix; - TextureD24[Position*TexNewW + Position2+1, 2] := Pix div 256; - TextureD24[Position*TexNewW + Position2+1, 3] := Pix div (256*256); - end; - end; - end;} - if (TexOrigW <= Limit) and (TexOrigW <= Limit) then begin - if (TextureB.PixelFormat = pf24bit) then begin - for Position := 0 to TexOrigH-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TexOrigW-1 do begin - TextureD24[Position*TexNewW + Position2+1, 1] := PPix[Position2*3+2]; - TextureD24[Position*TexNewW + Position2+1, 2] := PPix[Position2*3+1]; - TextureD24[Position*TexNewW + Position2+1, 3] := PPix[Position2*3]; - end; - end; - end; - end else begin - // limit - TexFitW := 4 * (TexOrigW div 4); // fix for bug in gluScaleImage - TexFitH := TexOrigH; - if (TextureB.PixelFormat = pf24bit) then begin - for Position := 0 to TexOrigH-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TexOrigW-1 do begin - TextureD24[Position*TexFitW + Position2+1, 1] := PPix[Position2*3+2]; - TextureD24[Position*TexFitW + Position2+1, 2] := PPix[Position2*3+1]; - TextureD24[Position*TexFitW + Position2+1, 3] := PPix[Position2*3]; - end; - end; - end; - gluScaleImage(GL_RGB, TexFitW, TexFitH, GL_UNSIGNED_BYTE, @TextureD24, - Limit, Limit, GL_UNSIGNED_BYTE, @TextureD24); // takes some time - - TexNewW := Limit; - TexNewH := Limit; - TexOrigW := Limit; - TexOrigH := Limit; - end; - - // creating cache mipmap - if CreateCacheMipmap then begin - if (TexOrigW <> TexNewW) or (TexOrigH <> TexNewH) then begin - // texture only uses some of it's space. there's a need for resize to fit full size - // and get best quality - TexFitW := 4 * (TexOrigW div 4); // 0.5.0: fix for bug in gluScaleImage - SkipX := (TexOrigW div 2) mod 2; // 0.5.0: try to center image - - TexFitH := TexOrigH; - for Position := 0 to TexOrigH-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TexOrigW-1 do begin - TextureD242[Position*TexFitW + Position2+1, 1] := PPix[(Position2+SkipX)*3+2]; - TextureD242[Position*TexFitW + Position2+1, 2] := PPix[(Position2+SkipX)*3+1]; - TextureD242[Position*TexFitW + Position2+1, 3] := PPix[(Position2+SkipX)*3]; - end; - end; - gluScaleImage(GL_RGB, TexFitW, TexFitH, GL_UNSIGNED_BYTE, @TextureD242, - Covers.W, Covers.H, GL_UNSIGNED_BYTE, @CacheMipmap[0]); // takes some time - - end else begin - // texture fits perfectly - gluScaleImage(GL_RGB, TexOrigW, TexOrigH, GL_UNSIGNED_BYTE, @TextureD24, - Covers.W, Covers.H, GL_UNSIGNED_BYTE, @CacheMipmap[0]); // takes some time - end; - end; - - glTexImage2D(GL_TEXTURE_2D, 0, 3, TexNewW, TexNewH, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TexNewW, TexNewH, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); - if Error > 0 then beep; - end - end; - - if Typ = 'Transparent' then begin - // dimensions - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - - // copy and process pixeldata - for Position := 0 to TexOrigH-1 do begin - for Position2 := 0 to TexOrigW-1 do begin - Pix := TextureB.Canvas.Pixels[Position2, Position]; - // ,- part of transparent png hack - if ((Pix = $fefefe) or (Pix = Col)) and (length(TextureAlpha)=0) then begin //Small fix, that caused artefacts to be drawn (#fe == dec254) - TextureD32[Position*TexNewW + Position2 + 1, 1] := 0; - TextureD32[Position*TexNewW + Position2 + 1, 2] := 0; - TextureD32[Position*TexNewW + Position2 + 1, 3] := 0; - TextureD32[Position*TexNewW + Position2 + 1, 4] := 0; - end else if (Format = 'PNG') and (length(TextureAlpha) <> 0) then begin - myAlpha:=TextureAlpha[Position*TexOrigW+Position2]; - TextureD32[Position*TexNewW + Position2+1, 1] := MyRGBABitmap[(Position*TexOrigW+Position2)*4+2]; - TextureD32[Position*TexNewW + Position2+1, 2] := MyRGBABitmap[(Position*TexOrigW+Position2)*4+1]; - TextureD32[Position*TexNewW + Position2+1, 3] := MyRGBABitmap[(Position*TexOrigW+Position2)*4]; - TextureD32[Position*TexNewW+Position2+1,4]:=MyRGBABitmap[(Position*TexOrigW+Position2)*4+3]; - end else begin - TextureD32[Position*TexNewW + Position2+1, 1] := (Pix and $ff); - TextureD32[Position*TexNewW + Position2+1, 2] := ((Pix shr 8) and $ff); - TextureD32[Position*TexNewW + Position2+1, 3] := ((Pix shr 16) and $ff); - TextureD32[Position*TexNewW + Position2+1, 4] := 255; - end; - end; - end; - setlength(TextureAlpha,0); - setlength(MyRGBABitmap,0); - glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); -{ if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - if Error > 0 then beep; - end;} - end; - -// The new awesomeness of colorized pngs starts here -// We're the first who had this feature, so give credit when you copy+paste :P - if Typ = 'Colorized' then begin - // dimensions - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - - myHue:=col2h(Col); - // copy and process pixeldata - for Position := 0 to TexOrigH-1 do begin - for Position2 := 0 to TexOrigW-1 do begin - Pix := TextureB.Canvas.Pixels[Position2, Position]; - if (Format = 'PNG') and (length(MyRGBABitmap) <> 0) then - ColorizeCopy(@MyRGBABitmap[(Position*TexOrigW+Position2)*4], - @TextureD32[Position*TexNewW + Position2+1, 1], - myHue) - else - ColorizeCopy(Pix, - @TextureD32[Position*TexNewW + Position2+1, 1], - myHue); - end; - end; - - setlength(TextureAlpha,0); - setlength(MyRGBABitmap,0); - glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; -// eoa COLORIZE - - if Typ = 'Transparent Range' then begin - // dimensions - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TexOrigH-1 do begin - for Position2 := 0 to TexOrigW-1 do begin - Pix := TextureB.Canvas.Pixels[Position2, Position]; - TextureD32[Position*TexNewW + Position2+1, 1] := Pix; - TextureD32[Position*TexNewW + Position2+1, 2] := Pix div 256; - TextureD32[Position*TexNewW + Position2+1, 3] := Pix div (256*256); - TextureD32[Position*TexNewW + Position2+1, 4] := 256 - Pix div 256; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); -{ if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - if Error > 0 then beep; - end;} - end; - - if Typ = 'Font' then begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - TextureD16[Position*TextureB.Width + Position2 + 1, 1] := 255; - TextureD16[Position*TextureB.Width + Position2 + 1, 2] := Pix; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - - if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - if Error > 0 then beep; - end; - end; - - if Typ = 'Font Outline' then begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - - Col := Pix; - if Col < 127 then Col := 127; - - TempA := Pix; - if TempA >= 95 then TempA := 255; - if TempA >= 31 then TempA := 255; - if Pix < 95 then TempA := (Pix * 256) div 96; - - - TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; - TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - - if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - if Error > 0 then beep; - end; - end; - - if Typ = 'Font Outline 2' then begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - - Col := Pix; - if Col < 31 then Col := 31; - - TempA := Pix; - if TempA >= 31 then TempA := 255; - if Pix < 31 then TempA := Pix * (256 div 32); - - TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; - TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - - if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - if Error > 0 then beep; - end; - end; - - if Typ = 'Font Black' then begin - // normalnie 0,125s bez niczego 0,015s - 0,030s z pix 0,125s <-- ??? - // dimensions - TextureB.PixelFormat := pf24bit; - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2*3]; - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; - - if Typ = 'Alpha Black Colored' then begin - TextureB.PixelFormat := pf24bit; - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2*3]; - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := (Col div $10000) and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Col div $100) and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Col and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; - - if Typ = 'Font Gray' then begin - // dimensions - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TextureB.Height-1 do begin - for Position2 := 0 to TextureB.Width-1 do begin - Pix := TextureB.Canvas.Pixels[Position2, Position]; - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 127; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 127; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 127; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); -{ if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - if Error > 0 then beep; - end;} - end; - - if Typ = 'Arrow' then begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - - // transparency - if Pix >= 127 then TempA := 255; - if Pix < 127 then TempA := Pix * 2; - - // ColInt = color intensity - if Pix < 127 then ColInt := 1; - if Pix >= 127 then ColInt := 2 - Pix / 128; - //0.75, 0.6, 0.25 - - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Round(ColInt * 0.75 * 255 + (1 - ColInt) * 255); - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := Round(ColInt * 0.6 * 255 + (1 - ColInt) * 255); - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Round(ColInt * 0.25 * 255 + (1 - ColInt) * 255); - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - - if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - if Error > 0 then beep; - end; - end; - - if Typ = 'Note Plain' then begin - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - - - - // Skin Patch - // 0-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White - case PPix[Position2*3] of - 0..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); - 192: Pix := Col; - 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); - 255: Pix := $FFFFFF; - end; -// 0.5.0. Original -// case PPix[Position2*3] of -// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; -// 192: Pix := Col; -// 255: Pix := $FFFFFF; -// end; - - - - - - TextureD24[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; - TextureD24[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; - TextureD24[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureB.Width, TextureB.Height, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); - end; - - if Typ = 'Note Transparent' then begin - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - TempA := 255; - - - - //Skin Patch - // 0= Transparent, 1-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White - case PPix[Position2*3] of - 0: TempA := 0; - 1..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); - 192: Pix := Col; - 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); - 255: Pix := $FFFFFF; - end; -// 0.5.0 Original -// case PPix[Position2*3] of -// 0: TempA := 0; -// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; -// 192: Pix := Col; -// 255: Pix := $FFFFFF; -// end; - - - - - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; - - TextureB.Free; - Result.X := 0; - Result.Y := 0; - Result.W := 0; - Result.H := 0; - Result.ScaleW := 1; - Result.ScaleH := 1; - Result.Rot := 0; - Result.TexNum := ActTex; - Result.TexW := TexOrigW / TexNewW; - Result.TexH := TexOrigH / TexNewH; - - Result.Int := 1; - Result.ColR := 1; - Result.ColG := 1; - Result.ColB := 1; - Result.Alpha := 1; - - // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these - Result.TexX1 := 0; - Result.TexY1 := 0; - Result.TexX2 := 1; - Result.TexY2 := 1; - - // 0.5.0 - Result.Name := Identifier; - - end; - - Log.BenchmarkEnd(4); - if Log.BenchmarkTimeLength[4] >= 1 then - Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4); - - end; // logerror - {$ENDIF} -end; - -{procedure ResizeTexture(s: pbytearray; d: pbytearray); -var - Position: integer; - Position2: integer; -begin - for Position := 0 to TexNewH*4-1 do - for Position2 := 0 to TexNewW-1 do - d[Position*TexNewW + Position2] := 0; - - for Position := 0 to TexOrigH-1 do begin - for Position2 := 0 to TexOrigW-1 do begin - d[(Position*TexNewW + Position2)*4] := Paleta[s[Position*TexOrigW + Position2], 1]; - d[(Position*TexNewW + Position2)*4+1] := Paleta[s[Position*TexOrigW + Position2], 2]; - d[(Position*TexNewW + Position2)*4+2] := Paleta[s[Position*TexOrigW + Position2], 3]; - d[(Position*TexNewW + Position2)*4+3] := Paleta[s[Position*TexOrigW + Position2], 4]; - end; - end; -end;} - -{procedure SetTexture(p: pointer); -begin - glGenTextures(1, Tekstur); - glBindTexture(GL_TEXTURE_2D, Tekstur); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, p); -end;} - -function TTextureUnit.LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; -begin - Result := LoadTexture(false, Identifier, Format, Typ, Col); -// Result := LoadTexture(SkinReg, Identifier, Format, Typ, Col); // default to SkinReg - -end; - -function TTextureUnit.LoadTexture(Identifier: string): TTexture; -begin - Result := LoadTexture(false, pchar(Identifier), 'JPG', 'Plain', 0); -end; - -function TTextureUnit.CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; -var - Position: integer; - Position2: integer; - Pix: integer; - ColInt: real; - PPix: PByteArray; - TempA: integer; - Error: integer; -begin - Mipmapping := false; - - glGenTextures(1, ActTex); // ActText = new texture number - glBindTexture(GL_TEXTURE_2D, ActTex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - glTexImage2D(GL_TEXTURE_2D, 0, 3, W, H, 0, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, W, H, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); - if Error > 0 then beep; - end; - - Result.X := 0; - Result.Y := 0; - Result.W := 0; - Result.H := 0; - Result.ScaleW := 1; - Result.ScaleH := 1; - Result.Rot := 0; - Result.TexNum := ActTex; - Result.TexW := 1; - Result.TexH := 1; - - Result.Int := 1; - Result.ColR := 1; - Result.ColG := 1; - Result.ColB := 1; - Result.Alpha := 1; - - // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these - Result.TexX1 := 0; - Result.TexY1 := 0; - Result.TexX2 := 1; - Result.TexY2 := 1; - - // 0.5.0 - Result.Name := Name; -end; - -procedure TTextureUnit.UnloadTexture(Name: string; FromCache: boolean); -var - T: integer; - TexNum: GLuint; -begin - T := FindTexture(Name); - - if not FromCache then begin - TexNum := TextureDatabase.Texture[T].Texture.TexNum; - if TexNum >= 0 then begin - glDeleteTextures(1, @TexNum); - TextureDatabase.Texture[T].Texture.TexNum := -1; -// Log.LogError('Unload texture no '+IntToStr(TexNum)); - end; - end else begin - TexNum := TextureDatabase.Texture[T].TextureCache.TexNum; - if TexNum >= 0 then begin - glDeleteTextures(1, @TexNum); - TextureDatabase.Texture[T].TextureCache.TexNum := -1; -// Log.LogError('Unload texture cache no '+IntToStr(TexNum)); - end; - end; -end; - -end. +unit UTexture; + +// Plain (alpha = 1) +// Transparent +// Transparent Range +// Font (white is drawn, black is transparent) +// Font Outline (Font with darker outline) +// Font Outline 2 (Font with darker outline) +// Font Black (black is drawn, white is transparent) +// Font Gray (gray is drawn, white is transparent) +// Arrow (for arrows, white is white, gray has color, black is transparent); + +interface + +{$I switches.inc} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses OpenGL12, + {$IFDEF win32} + windows, + {$ENDIF} + Math, + Classes, + SysUtils, + {$IFDEF FPC} + ulazjpeg, + {$ELSE} + JPEG, + PNGImage, + {$ENDIF} + Graphics, + UCommon, + UThemes; + + + {$IFDEF Win32} + procedure glGenTextures(n: GLsizei; var textures: GLuint); stdcall; external opengl32; + + {$ELSE} + {$ifdef darwin} + const opengl32 = '/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib'; + {$ELSE} + const opengl32 = 'libGL.so' ; // YES Capital GL + {$ENDIF} + + procedure glGenTextures(n: GLsizei; var textures: GLuint); stdcall; external opengl32; + {$ENDIF} + +type + TTexture = record + TexNum: integer; + X: real; + Y: real; + Z: real; // new + W: real; + H: real; + ScaleW: real; // for dynamic scalling while leaving width constant + ScaleH: real; // for dynamic scalling while leaving height constant + Rot: real; // 0 - 2*pi + Int: real; // intensity + ColR: real; + ColG: real; + ColB: real; + TexW: real; // used? + TexH: real; // used? + TexX1: real; + TexY1: real; + TexX2: real; + TexY2: real; + Alpha: real; + Name: string; // 0.5.0: experimental for handling cache images. maybe it's useful for dynamic skins + end; + + TTextureEntry = record + Name: string; + Typ: string; + + // we use normal TTexture, it's easier to implement and if needed - we copy ready data + Texture: TTexture; + TextureCache: TTexture; // 0.5.0 + end; + + TTextureDatabase = record + Texture: array of TTextureEntry; + end; + + TTextureUnit = class + + private + function LoadBitmap( aSourceStream : TStream; aBMP : TBitMap ): boolean; + public + Limit: integer; + CreateCacheMipmap: boolean; + +// function GetNumberFor + function GetTexture(Name, Typ: string): TTexture; overload; + function GetTexture(Name, Typ: string; FromCache: boolean): TTexture; overload; + function FindTexture(Name: string): integer; + function LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; + function LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; + function LoadTexture(Identifier: string): TTexture; overload; + function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; + procedure UnloadTexture(Name: string; FromCache: boolean); + end; + +var + lasthue: double; + Texture: TTextureUnit; + TextureDatabase: TTextureDatabase; + + PrintScreenData: array[0..1024*768-1] of longword; + + ActTex: GLuint;//integer; + + TexOrigW: integer; + TexOrigH: integer; + TexNewW: integer; + TexNewH: integer; + + TexFitW: integer; + TexFitH: integer; // new for limit + + TextureD8: array[1..1024*1024] of byte; // 1MB + TextureD16: array[1..1024*1024, 1..2] of byte; // luminance/alpha tex (2MB) + TextureD24: array[1..1024*1024, 1..3] of byte; // normal 24-bit tex (3MB) + TextureD242: array[1..512*512, 1..3] of byte; // normal 24-bit tex (0,75MB) + TextureD32: array[1..1024*1024, 1..4] of byte; // transparent 32-bit tex (4MB) + // total 40MB at 2048*2048 + // total 10MB at 1024*1024 + + Mipmapping: Boolean; + + CacheMipmap: array[0..256*256*3-1] of byte; // 3KB + + +implementation +uses ULog, DateUtils, UCovers, StrUtils; + +function TTextureUnit.GetTexture(Name, Typ: string): TTexture; +begin + Result := GetTexture(Name, Typ, true); +end; + +function TTextureUnit.GetTexture(Name, Typ: string; FromCache: boolean): TTexture; +var + T: integer; // texture + C: integer; // cover + Data: array of byte; +begin + // find texture entry + T := FindTexture(Name); + + if T = -1 then begin + // create texture entry + T := Length(TextureDatabase.Texture); + SetLength(TextureDatabase.Texture, T+1); + TextureDatabase.Texture[T].Name := Name; + TextureDatabase.Texture[T].Typ := Typ; + + // inform database that no textures have been loaded into memory + TextureDatabase.Texture[T].Texture.TexNum := -1; + TextureDatabase.Texture[T].TextureCache.TexNum := -1; + end; + + // use preloaded texture + if (not FromCache) or (FromCache and not Covers.CoverExists(Name)) then begin + // use full texture + if TextureDatabase.Texture[T].Texture.TexNum = -1 then begin + // load texture + TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', pchar(Typ), $0); + end; + + // use texture + Result := TextureDatabase.Texture[T].Texture; + + end; + + if FromCache and Covers.CoverExists(Name) then begin + // use cache texture + C := Covers.CoverNumber(Name); + + if TextureDatabase.Texture[T].TextureCache.TexNum = -1 then begin + // load texture + Covers.PrepareData(Name); + TextureDatabase.Texture[T].TextureCache := CreateTexture(Covers.Data, Name, Covers.Cover[C].W, Covers.Cover[C].H, 24); + end; + + // use texture + Result := TextureDatabase.Texture[T].TextureCache; + end; +end; + +function TTextureUnit.FindTexture(Name: string): integer; +var + T: integer; // texture +begin + Result := -1; + for T := 0 to high(TextureDatabase.Texture) do + if TextureDatabase.Texture[T].Name = Name then + Result := T; +end; + +// expects: src, dst: pointers to r,g,b,a +// hue: new hue within range [0.0-6.0) +procedure ColorizeCopy(Src, Dst: PByteArray; hue: Double); overload; +var + i,j,k: Cardinal; + clr, hls: array[0..2] of Double; + delta, f, p, q, t: Double; +begin + hls[0]:=hue; + + clr[0] := src[0]/255; + clr[1] := src[1]/255; + clr[2] := src[2]/255; + + //calculate luminance and saturation from rgb + hls[1] := maxvalue(clr); //l:=... + delta := hls[1] - minvalue(clr); + + if hls[1] = 0.0 then + hls[2] := 0.0 + else + hls[2] := delta/hls[1]; //v:=... + + // calc new rgb from our hls (h from color, l ans s from pixel) +// if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense + begin + k:=trunc(hls[0]); + f:=hls[0]-k; + p:=hls[1]*(1.0-hls[2]); + q:=hls[1]*(1.0-(hls[2]*f)); + t:=hls[1]*(1.0-(hls[2]*(1.0-f))); + case k of + 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end; + 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end; + 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end; + 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end; + 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end; + 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; + end; + // and store new rgb back into the image + dst[0]:=floor(255*clr[0]); + dst[1]:=floor(255*clr[1]); + dst[2]:=floor(255*clr[2]); + dst[3]:=src[3]; + end; +end; + +// expects: src: $rrggbb +// dst: pointer to r,g,b,a +// hue: new hue within range [0.0-6.0) +procedure ColorizeCopy(Src: Cardinal; Dst: PByteArray; hue: Double); overload; +var + i,j,k: Cardinal; + clr, hls: array[0..2] of Double; + delta, f, p, q, t: Double; +begin + hls[0]:=hue; + + clr[0]:=((src shr 16) and $ff)/255; + clr[1]:=((src shr 8) and $ff)/255; + clr[2]:=(src and $ff)/255; + //calculate luminance and saturation from rgb + hls[1]:=maxvalue(clr); //l:=... + delta:=hls[1]-minvalue(clr); + if hls[1]=0.0 then hls[2]:=0.0 else hls[2]:=delta/hls[1]; //v:=... + // calc new rgb from our hls (h from color, l ans s from pixel) +// if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense + begin + k:=trunc(hls[0]); + f:=hls[0]-k; + p:=hls[1]*(1.0-hls[2]); + q:=hls[1]*(1.0-(hls[2]*f)); + t:=hls[1]*(1.0-(hls[2]*(1.0-f))); + case k of + 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end; + 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end; + 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end; + 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end; + 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end; + 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; + end; + // and store new rgb back into the image + dst[0]:=floor(255*clr[0]); + dst[1]:=floor(255*clr[1]); + dst[2]:=floor(255*clr[2]); + dst[3]:=255; + end; +end; +//returns hue within range [0.0-6.0) +function col2h(Color:Cardinal):double; +var + clr,hls: array[0..2] of double; + delta: double; +begin + clr[0]:=((Color and $ff0000) shr 16)/255; + clr[1]:=((Color and $ff00) shr 8)/255; + clr[2]:=(Color and $ff)/255; + hls[1]:=maxvalue(clr); + delta:=hls[1]-minvalue(clr); + if clr[0]=hls[1] then hls[0]:=(clr[1]-clr[2])/delta + else if clr[1]=hls[1] then hls[0]:=2.0+(clr[2]-clr[0])/delta + else if clr[2]=hls[1] then hls[0]:=4.0+(clr[0]-clr[1])/delta; + if hls[0]<0.0 then hls[0]:=hls[0]+6.0; + if hls[0]=6.0 then hls[0]:=0.0; + col2h:=hls[0]; +end; + + +function TTextureUnit.LoadBitmap( aSourceStream : TStream; aBMP : TBitMap ): boolean; +begin + aSourceStream.position := 0; + boolean := aBMP.LoadFromStream( aSourceStream ) > 0; +end; + +function TTextureUnit.LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; +var + Res: TResourceStream; + TextureB: TBitmap; + TextureJ: TJPEGImage; + {$IFNDEF FPC} + TexturePNG: TPNGObject; + {$ENDIF} + + TextureAlpha: array of byte; + AlphaPtr: PByte; + TransparentColor: TColor; + PixelColor: TColor; + + Position: integer; + Position2: integer; + Pix: integer; + ColInt: real; + PPix: PByteArray; + TempA: integer; + Error: integer; + SkipX: integer; + myAlpha: Real; + myRGBABitmap: array of byte; + RGBPtr: PByte; + myHue: Double; + + lTextureStream : TStream; +begin + + Log.LogStatus( 'From Resource - ' + inttostr( integer( FromRegistry ) ) , Identifier +' '+ Format +' '+ Typ ); +// {$IFNDEF FPC} + // TODO : JB_lazarus eeeew this is a nasty one... + // but lazarus implementation scanlines is different :( + // need to implement as per + // http://www.lazarus.freepascal.org/index.php?name=PNphpBB2&file=viewtopic&p=18512 + // http://www.lazarus.freepascal.org/index.php?name=PNphpBB2&file=viewtopic&p=10797 + // http://wiki.lazarus.freepascal.org/Developing_with_Graphics + Log.BenchmarkStart(4); + Mipmapping := true; + + if FromRegistry then + begin + try +// Res := TResourceStream.Create(HInstance, Identifier, Format); + lTextureStream := TResourceStream.Create(HInstance, Identifier, Format); + + // TODO : Where does the format come from + except + Log.LogStatus( 'ERROR Could not load from resource' , Identifier +' '+ Format +' '+ Typ ); + beep; + Exit; + end; + end + else + begin + if ( FileExists(Identifier) ) then + begin + // Get the File Extension... + Format := PAnsichar(UpperCase(RightStr(ExtractFileExt(Identifier),3))); + lTextureStream := TFileStream.create( Identifier , fmOpenRead ); + end; + end; + + if FromRegistry or + ((not FromRegistry) and FileExists(Identifier)) then + begin + TextureB := TBitmap.Create; + + if Format = 'BMP' then + begin + LoadBitmap( aSourceStream : TStream; TextureB ); + + if FromRegistry then + TextureB.LoadFromStream(Res) + else + TextureB.LoadFromFile(Identifier); + end + else + if Format = 'JPG' then + begin + TextureJ := TJPEGImage.Create; + + if FromRegistry then + TextureJ.LoadFromStream(Res) + else + begin + if FileExists(Identifier) then + TextureJ.LoadFromFile(Identifier) + else + Exit; + end; + + TextureB.Assign(TextureJ); + TextureJ.Free; + end + else if Format = 'PNG' then + begin + {$IFNDEF FPC} + // TODO : JB_lazarus - fix this for lazarus.. + TexturePNG := TPNGObject.Create; + if FromRegistry then + TexturePNG.LoadFromStream(Res) + else + begin + if FileExists(Identifier) then + TexturePNG.LoadFromFile(Identifier) + else + Exit; + end; + + TextureB.Assign(TexturePNG); + // transparent png hack start (part 1 of 2) + if ((Typ = 'Transparent') or (Typ = 'Colorized')) and (TexturePNG.TransparencyMode = ptmPartial) then + begin + setlength(TextureAlpha, TextureB.Width*TextureB.Height); + setlength(MyRGBABitmap,TextureB.Width*TextureB.Height*4); + if (TexturePNG.Header.ColorType = COLOR_GRAYSCALEALPHA) or + (TexturePNG.Header.ColorType = COLOR_RGBALPHA) then + begin + // i would have preferred english variables here but i use Position because i'm lazy + for Position := 0 to TextureB.Height - 1 do + begin + AlphaPtr := PByte(TexturePNG.AlphaScanline[Position]); + RGBPtr:=PByte(TexturePNG.Scanline[Position]); + for Position2 := 0 to TextureB.Width - 1 do + begin + TextureAlpha[Position*TextureB.Width+Position2]:= AlphaPtr^; + MyRGBABitmap[(Position*TextureB.Width+Position2)*4]:= RGBPtr^; + Inc(RGBPtr); + MyRGBABitmap[(Position*TextureB.Width+Position2)*4+1]:= RGBPtr^; + Inc(RGBPtr); + MyRGBABitmap[(Position*TextureB.Width+Position2)*4+2]:= RGBPtr^; + Inc(RGBPtr); + MyRGBABitmap[(Position*TextureB.Width+Position2)*4+3]:= AlphaPtr^; +// Inc(RGBPtr); + Inc(AlphaPtr); + end; + end; + end; + end else + setlength(TextureAlpha,0); // just no special transparency for unimplemented transparency types (ptmBit) + // transparent png hack end + TexturePNG.Free; + {$ENDIF} + end; + + if FromRegistry then Res.Free; + + if (TextureB.Width > 1024) or (TextureB.Height > 1024) then begin // will be fixed in 0.5.1 and dynamically extended to 8192x8192 depending on the driver + Log.LogError('Image ' + Identifier + ' is too big (' + IntToStr(TextureB.Width) + 'x' + IntToStr(TextureB.Height) + ')'); + Result.TexNum := -1; + end else begin + + glGenTextures(1, ActTex); + glBindTexture(GL_TEXTURE_2D, ActTex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + if Typ = 'Plain' then + begin + {$IFNDEF FPC} + // dimensions + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + + // copy and process pixeldata + TextureB.PixelFormat := pf24bit; +{ if (TextureB.PixelFormat = pf8bit) then begin + for Position := 0 to TexOrigH-1 do begin + for Position2 := 0 to TexOrigW-1 do begin + Pix := TextureB.Canvas.Pixels[Position2, Position]; + TextureD24[Position*TexNewW + Position2+1, 1] := Pix; + TextureD24[Position*TexNewW + Position2+1, 2] := Pix div 256; + TextureD24[Position*TexNewW + Position2+1, 3] := Pix div (256*256); + end; + end; + end;} + if (TexOrigW <= Limit) and (TexOrigW <= Limit) then begin + if (TextureB.PixelFormat = pf24bit) then begin + for Position := 0 to TexOrigH-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TexOrigW-1 do begin + TextureD24[Position*TexNewW + Position2+1, 1] := PPix[Position2*3+2]; + TextureD24[Position*TexNewW + Position2+1, 2] := PPix[Position2*3+1]; + TextureD24[Position*TexNewW + Position2+1, 3] := PPix[Position2*3]; + end; + end; + end; + end else begin + // limit + TexFitW := 4 * (TexOrigW div 4); // fix for bug in gluScaleImage + TexFitH := TexOrigH; + if (TextureB.PixelFormat = pf24bit) then begin + for Position := 0 to TexOrigH-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TexOrigW-1 do begin + TextureD24[Position*TexFitW + Position2+1, 1] := PPix[Position2*3+2]; + TextureD24[Position*TexFitW + Position2+1, 2] := PPix[Position2*3+1]; + TextureD24[Position*TexFitW + Position2+1, 3] := PPix[Position2*3]; + end; + end; + end; + gluScaleImage(GL_RGB, TexFitW, TexFitH, GL_UNSIGNED_BYTE, @TextureD24, + Limit, Limit, GL_UNSIGNED_BYTE, @TextureD24); // takes some time + + TexNewW := Limit; + TexNewH := Limit; + TexOrigW := Limit; + TexOrigH := Limit; + end; + + // creating cache mipmap + if CreateCacheMipmap then begin + if (TexOrigW <> TexNewW) or (TexOrigH <> TexNewH) then begin + // texture only uses some of it's space. there's a need for resize to fit full size + // and get best quality + TexFitW := 4 * (TexOrigW div 4); // 0.5.0: fix for bug in gluScaleImage + SkipX := (TexOrigW div 2) mod 2; // 0.5.0: try to center image + + TexFitH := TexOrigH; + for Position := 0 to TexOrigH-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TexOrigW-1 do begin + TextureD242[Position*TexFitW + Position2+1, 1] := PPix[(Position2+SkipX)*3+2]; + TextureD242[Position*TexFitW + Position2+1, 2] := PPix[(Position2+SkipX)*3+1]; + TextureD242[Position*TexFitW + Position2+1, 3] := PPix[(Position2+SkipX)*3]; + end; + end; + gluScaleImage(GL_RGB, TexFitW, TexFitH, GL_UNSIGNED_BYTE, @TextureD242, + Covers.W, Covers.H, GL_UNSIGNED_BYTE, @CacheMipmap[0]); // takes some time + + end else begin + // texture fits perfectly + gluScaleImage(GL_RGB, TexOrigW, TexOrigH, GL_UNSIGNED_BYTE, @TextureD24, + Covers.W, Covers.H, GL_UNSIGNED_BYTE, @CacheMipmap[0]); // takes some time + end; + end; + + glTexImage2D(GL_TEXTURE_2D, 0, 3, TexNewW, TexNewH, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TexNewW, TexNewH, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); + if Error > 0 then beep; + end + {$ENDIF} + end; + + if Typ = 'Transparent' then begin + // dimensions + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + + // copy and process pixeldata + for Position := 0 to TexOrigH-1 do begin + for Position2 := 0 to TexOrigW-1 do begin + Pix := TextureB.Canvas.Pixels[Position2, Position]; + // ,- part of transparent png hack + if ((Pix = $fefefe) or (Pix = Col)) and (length(TextureAlpha)=0) then begin //Small fix, that caused artefacts to be drawn (#fe == dec254) + TextureD32[Position*TexNewW + Position2 + 1, 1] := 0; + TextureD32[Position*TexNewW + Position2 + 1, 2] := 0; + TextureD32[Position*TexNewW + Position2 + 1, 3] := 0; + TextureD32[Position*TexNewW + Position2 + 1, 4] := 0; + end else if (Format = 'PNG') and (length(TextureAlpha) <> 0) then begin + myAlpha:=TextureAlpha[Position*TexOrigW+Position2]; + TextureD32[Position*TexNewW + Position2+1, 1] := MyRGBABitmap[(Position*TexOrigW+Position2)*4+2]; + TextureD32[Position*TexNewW + Position2+1, 2] := MyRGBABitmap[(Position*TexOrigW+Position2)*4+1]; + TextureD32[Position*TexNewW + Position2+1, 3] := MyRGBABitmap[(Position*TexOrigW+Position2)*4]; + TextureD32[Position*TexNewW+Position2+1,4]:=MyRGBABitmap[(Position*TexOrigW+Position2)*4+3]; + end else begin + TextureD32[Position*TexNewW + Position2+1, 1] := (Pix and $ff); + TextureD32[Position*TexNewW + Position2+1, 2] := ((Pix shr 8) and $ff); + TextureD32[Position*TexNewW + Position2+1, 3] := ((Pix shr 16) and $ff); + TextureD32[Position*TexNewW + Position2+1, 4] := 255; + end; + end; + end; + setlength(TextureAlpha,0); + setlength(MyRGBABitmap,0); + glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); +{ if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + if Error > 0 then beep; + end;} + end; + +// The new awesomeness of colorized pngs starts here +// We're the first who had this feature, so give credit when you copy+paste :P + if Typ = 'Colorized' then begin + // dimensions + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + + myHue:=col2h(Col); + // copy and process pixeldata + for Position := 0 to TexOrigH-1 do begin + for Position2 := 0 to TexOrigW-1 do begin + Pix := TextureB.Canvas.Pixels[Position2, Position]; + if (Format = 'PNG') and (length(MyRGBABitmap) <> 0) then + ColorizeCopy(@MyRGBABitmap[(Position*TexOrigW+Position2)*4], + @TextureD32[Position*TexNewW + Position2+1, 1], + myHue) + else + ColorizeCopy(Pix, + @TextureD32[Position*TexNewW + Position2+1, 1], + myHue); + end; + end; + + setlength(TextureAlpha,0); + setlength(MyRGBABitmap,0); + glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; +// eoa COLORIZE + + if Typ = 'Transparent Range' then begin + // dimensions + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TexOrigH-1 do begin + for Position2 := 0 to TexOrigW-1 do begin + Pix := TextureB.Canvas.Pixels[Position2, Position]; + TextureD32[Position*TexNewW + Position2+1, 1] := Pix; + TextureD32[Position*TexNewW + Position2+1, 2] := Pix div 256; + TextureD32[Position*TexNewW + Position2+1, 3] := Pix div (256*256); + TextureD32[Position*TexNewW + Position2+1, 4] := 256 - Pix div 256; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); +{ if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + if Error > 0 then beep; + end;} + end; + + if Typ = 'Font' then + begin + {$IFNDEF FPC} + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := 255; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := Pix; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + if Error > 0 then beep; + end; + {$ENDIF} + end; + + if Typ = 'Font Outline' then + begin + {$IFNDEF FPC} + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + Col := Pix; + if Col < 127 then Col := 127; + + TempA := Pix; + if TempA >= 95 then TempA := 255; + if TempA >= 31 then TempA := 255; + if Pix < 95 then TempA := (Pix * 256) div 96; + + + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + if Error > 0 then beep; + end; + {$ENDIF} + end; + + if Typ = 'Font Outline 2' then + begin + {$IFNDEF FPC} + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + Col := Pix; + if Col < 31 then Col := 31; + + TempA := Pix; + if TempA >= 31 then TempA := 255; + if Pix < 31 then TempA := Pix * (256 div 32); + + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + if Error > 0 then beep; + end; + {$ENDIF} + end; + + if Typ = 'Font Black' then + begin + {$IFNDEF FPC} + // normalnie 0,125s bez niczego 0,015s - 0,030s z pix 0,125s <-- ??? + // dimensions + TextureB.PixelFormat := pf24bit; + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2*3]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + {$ENDIF} + end; + + if Typ = 'Alpha Black Colored' then + begin + {$IFNDEF FPC} + TextureB.PixelFormat := pf24bit; + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2*3]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := (Col div $10000) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Col div $100) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Col and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + {$ENDIF} + end; + + if Typ = 'Font Gray' then + begin + {$IFNDEF FPC} + // dimensions + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + for Position2 := 0 to TextureB.Width-1 do begin + Pix := TextureB.Canvas.Pixels[Position2, Position]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); +{ if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + if Error > 0 then beep; + end;} + {$ENDIF} + end; + + if Typ = 'Arrow' then + begin + {$IFNDEF FPC} + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + // transparency + if Pix >= 127 then TempA := 255; + if Pix < 127 then TempA := Pix * 2; + + // ColInt = color intensity + if Pix < 127 then ColInt := 1; + if Pix >= 127 then ColInt := 2 - Pix / 128; + //0.75, 0.6, 0.25 + + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Round(ColInt * 0.75 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := Round(ColInt * 0.6 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Round(ColInt * 0.25 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + if Error > 0 then beep; + end; + {$ENDIF} + end; + + if Typ = 'Note Plain' then + begin + {$IFNDEF FPC} + for Position := 0 to TextureB.Height-1 do + begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do + begin + + + + // Skin Patch + // 0-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White + case PPix[Position2*3] of + 0..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); + 192: Pix := Col; + 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); + 255: Pix := $FFFFFF; + end; +// 0.5.0. Original +// case PPix[Position2*3] of +// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; +// 192: Pix := Col; +// 255: Pix := $FFFFFF; +// end; + + + + + + TextureD24[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; + TextureD24[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; + TextureD24[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureB.Width, TextureB.Height, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); + {$ENDIF} + end; + + if Typ = 'Note Transparent' then + begin + {$IFNDEF FPC} + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + TempA := 255; + + + + //Skin Patch + // 0= Transparent, 1-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White + case PPix[Position2*3] of + 0: TempA := 0; + 1..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); + 192: Pix := Col; + 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); + 255: Pix := $FFFFFF; + end; +// 0.5.0 Original +// case PPix[Position2*3] of +// 0: TempA := 0; +// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; +// 192: Pix := Col; +// 255: Pix := $FFFFFF; +// end; + + + + + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + {$ENDIF} + end; + + TextureB.Free; + Result.X := 0; + Result.Y := 0; + Result.W := 0; + Result.H := 0; + Result.ScaleW := 1; + Result.ScaleH := 1; + Result.Rot := 0; + Result.TexNum := ActTex; + Result.TexW := TexOrigW / TexNewW; + Result.TexH := TexOrigH / TexNewH; + + Result.Int := 1; + Result.ColR := 1; + Result.ColG := 1; + Result.ColB := 1; + Result.Alpha := 1; + + // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these + Result.TexX1 := 0; + Result.TexY1 := 0; + Result.TexX2 := 1; + Result.TexY2 := 1; + + // 0.5.0 + Result.Name := Identifier; + + end; + + Log.BenchmarkEnd(4); + if Log.BenchmarkTimeLength[4] >= 1 then + Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4); + + end; // logerror +// {$ENDIF} +end; + +{procedure ResizeTexture(s: pbytearray; d: pbytearray); +var + Position: integer; + Position2: integer; +begin + for Position := 0 to TexNewH*4-1 do + for Position2 := 0 to TexNewW-1 do + d[Position*TexNewW + Position2] := 0; + + for Position := 0 to TexOrigH-1 do begin + for Position2 := 0 to TexOrigW-1 do begin + d[(Position*TexNewW + Position2)*4] := Paleta[s[Position*TexOrigW + Position2], 1]; + d[(Position*TexNewW + Position2)*4+1] := Paleta[s[Position*TexOrigW + Position2], 2]; + d[(Position*TexNewW + Position2)*4+2] := Paleta[s[Position*TexOrigW + Position2], 3]; + d[(Position*TexNewW + Position2)*4+3] := Paleta[s[Position*TexOrigW + Position2], 4]; + end; + end; +end;} + +{procedure SetTexture(p: pointer); +begin + glGenTextures(1, Tekstur); + glBindTexture(GL_TEXTURE_2D, Tekstur); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, p); +end;} + +function TTextureUnit.LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; +begin + Result := LoadTexture(false, Identifier, Format, Typ, Col); +// Result := LoadTexture(SkinReg, Identifier, Format, Typ, Col); // default to SkinReg + +end; + +function TTextureUnit.LoadTexture(Identifier: string): TTexture; +begin + Result := LoadTexture(false, pchar(Identifier), 'JPG', 'Plain', 0); +end; + +function TTextureUnit.CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; +var + Position: integer; + Position2: integer; + Pix: integer; + ColInt: real; + PPix: PByteArray; + TempA: integer; + Error: integer; +begin + Mipmapping := false; + + glGenTextures(1, ActTex); // ActText = new texture number + glBindTexture(GL_TEXTURE_2D, ActTex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + glTexImage2D(GL_TEXTURE_2D, 0, 3, W, H, 0, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, W, H, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); + if Error > 0 then beep; + end; + + Result.X := 0; + Result.Y := 0; + Result.W := 0; + Result.H := 0; + Result.ScaleW := 1; + Result.ScaleH := 1; + Result.Rot := 0; + Result.TexNum := ActTex; + Result.TexW := 1; + Result.TexH := 1; + + Result.Int := 1; + Result.ColR := 1; + Result.ColG := 1; + Result.ColB := 1; + Result.Alpha := 1; + + // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these + Result.TexX1 := 0; + Result.TexY1 := 0; + Result.TexX2 := 1; + Result.TexY2 := 1; + + // 0.5.0 + Result.Name := Name; +end; + +procedure TTextureUnit.UnloadTexture(Name: string; FromCache: boolean); +var + T: integer; + TexNum: GLuint; +begin + T := FindTexture(Name); + + if not FromCache then begin + TexNum := TextureDatabase.Texture[T].Texture.TexNum; + if TexNum >= 0 then begin + glDeleteTextures(1, @TexNum); + TextureDatabase.Texture[T].Texture.TexNum := -1; +// Log.LogError('Unload texture no '+IntToStr(TexNum)); + end; + end else begin + TexNum := TextureDatabase.Texture[T].TextureCache.TexNum; + if TexNum >= 0 then begin + glDeleteTextures(1, @TexNum); + TextureDatabase.Texture[T].TextureCache.TexNum := -1; +// Log.LogError('Unload texture cache no '+IntToStr(TexNum)); + end; + end; +end; + +end. diff --git a/Game/Code/Classes/Ulazjpeg.pas b/Game/Code/Classes/Ulazjpeg.pas new file mode 100644 index 00000000..1f6d8b99 --- /dev/null +++ b/Game/Code/Classes/Ulazjpeg.pas @@ -0,0 +1,118 @@ +{ Copyright (C) 2003 Mattias Gaertner + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License + for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +} +unit Ulazjpeg; + +{$mode objfpc}{$H+} + +interface + +uses + SysUtils, Classes, FPImage, IntfGraphics, Graphics, FPReadJPEG, FPWriteJPEG; + +type + TJPEGQualityRange = TFPJPEGCompressionQuality; + TJPEGPerformance = TJPEGReadPerformance; + + TJPEGImage = class(TFPImageBitmap) + private + FPerformance: TJPEGPerformance; + FProgressiveEncoding: boolean; + FQuality: TJPEGQualityRange; + protected + procedure InitFPImageReader(ImgReader: TFPCustomImageReader); override; + procedure FinalizeFPImageReader(ImgReader: TFPCustomImageReader); override; + procedure InitFPImageWriter(ImgWriter: TFPCustomImageWriter); override; + public + constructor Create; override; + class function GetFileExtensions: string; override; + class function GetDefaultFPReader: TFPCustomImageReaderClass; override; + class function GetDefaultFPWriter: TFPCustomImageWriterClass; override; + public + property CompressionQuality: TJPEGQualityRange read FQuality write FQuality; + property ProgressiveEncoding: boolean read FProgressiveEncoding; + property Performance: TJPEGPerformance read FPerformance write FPerformance; + end; + +const + DefaultJPEGMimeType = 'image/jpeg'; + + +implementation + + +{ TJPEGImage } + +procedure TJPEGImage.InitFPImageReader(ImgReader: TFPCustomImageReader); +var + JPEGReader: TFPReaderJPEG; +begin + if ImgReader is TFPReaderJPEG then begin + JPEGReader:=TFPReaderJPEG(ImgReader); + JPEGReader.Performance:=Performance; + end; + inherited InitFPImageReader(ImgReader); +end; + +procedure TJPEGImage.FinalizeFPImageReader(ImgReader: TFPCustomImageReader); +var + JPEGReader: TFPReaderJPEG; +begin + if ImgReader is TFPReaderJPEG then begin + JPEGReader:=TFPReaderJPEG(ImgReader); + FProgressiveEncoding:=JPEGReader.ProgressiveEncoding; + end; + inherited FinalizeFPImageReader(ImgReader); +end; + +procedure TJPEGImage.InitFPImageWriter(ImgWriter: TFPCustomImageWriter); +var + JPEGWriter: TFPWriterJPEG; +begin + if ImgWriter is TFPWriterJPEG then begin + JPEGWriter:=TFPWriterJPEG(ImgWriter); + if JPEGWriter<>nil then ; + JPEGWriter.ProgressiveEncoding:=ProgressiveEncoding; + JPEGWriter.CompressionQuality:=CompressionQuality; + end; + inherited InitFPImageWriter(ImgWriter); +end; + +class function TJPEGImage.GetDefaultFPReader: TFPCustomImageReaderClass; +begin + Result:=TFPReaderJPEG; +end; + +class function TJPEGImage.GetDefaultFPWriter: TFPCustomImageWriterClass; +begin + Result:=TFPWriterJPEG; +end; + +constructor TJPEGImage.Create; +begin + inherited Create; + FPerformance:=jpBestQuality; + FProgressiveEncoding:=false; + FQuality:=75; +end; + +class function TJPEGImage.GetFileExtensions: string; +begin + Result:='jpg;jpeg'; +end; + +end. + diff --git a/Game/Code/Screens/UScreenLoading.pas b/Game/Code/Screens/UScreenLoading.pas index 438b606e..2ccc5c79 100644 --- a/Game/Code/Screens/UScreenLoading.pas +++ b/Game/Code/Screens/UScreenLoading.pas @@ -2,22 +2,33 @@ unit UScreenLoading; interface +{$I switches.inc} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + uses - UMenu, SDL, SysUtils, UThemes, OpenGL12; + UMenu, + SDL, + SysUtils, + UThemes, + OpenGL12; type TScreenLoading = class(TMenu) public Fadeout: boolean; constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function GetBGTexNum: GLUInt; - procedure onShow; override; + procedure onShow; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function GetBGTexNum: GLUInt; end; implementation -uses UGraphic, UTime; +uses UGraphic, + UTime; function TScreenLoading.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin diff --git a/Game/Code/UltraStar.lpi b/Game/Code/UltraStar.lpi index 1b925455..947c694c 100644 --- a/Game/Code/UltraStar.lpi +++ b/Game/Code/UltraStar.lpi @@ -12,7 +12,7 @@ - + @@ -41,10 +41,10 @@ - - + + - + @@ -57,9 +57,15 @@ - - + + + + + + + + @@ -78,9 +84,11 @@ - - + + + + @@ -112,8 +120,8 @@ - - + + @@ -135,25 +143,21 @@ - - - - - - - + + + @@ -186,8 +190,8 @@ - - + + @@ -226,9 +230,7 @@ - - @@ -253,9 +255,11 @@ - + + + @@ -340,7 +344,7 @@ - + @@ -361,7 +365,7 @@ - + @@ -381,11 +385,9 @@ - + - - @@ -404,8 +406,8 @@ - - + + @@ -564,80 +566,118 @@ - - - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index 9793928e..51867b87 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -402,6 +402,8 @@ begin //Music.Open(SkinPath + 'Menu Music 3.mp3'); //Music.Play; Log.LogStatus('Main Loop', 'Initialization'); MainLoop; + + Log.LogStatus('Cleanup', 'Done'); //------------------------------ //Finish Application -- cgit v1.2.3 From 50523ba17fcb19d37c54420ec3ea651538121e35 Mon Sep 17 00:00:00 2001 From: b1indy Date: Thu, 20 Sep 2007 10:39:30 +0000 Subject: moved a hack to a more appropriate place git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@417 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditSub.pas | 1 + Game/Code/UltraStar.dpr | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index e896d603..22420b26 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -1072,6 +1072,7 @@ procedure TScreenEditSub.CopySentences(Src, Dst, Num: integer); var C: integer; begin + Lyric := TLyric.Create; // create place for new sentences SetLength(Czesci[0].Czesc, Czesci[0].Ilosc + Num - 1); diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 7cbc2e55..cbb5dd7e 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -1,4 +1,4 @@ -program UltraStar; +program UltraStar; {$DEFINE TRANSLATE} @@ -360,8 +360,6 @@ begin Log.BenchmarkEnd(0); Log.LogBenchmark('Loading Time', 0); - Lyric := TLyric.Create; - //------------------------------ //Start- Mainloop -- cgit v1.2.3 From efef73dfde7de1692afb9aa8a9d51dcafc59fbb2 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Sep 2007 10:53:12 +0000 Subject: started re-factoring TTextureUnit.LoadTexture only done BPM and JPEG for now. will do more as I add support for it to lazarus. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@418 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 69 +++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 31 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 364bbcc8..e7038e78 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -90,7 +90,8 @@ type TTextureUnit = class private - function LoadBitmap( aSourceStream : TStream; aBMP : TBitMap ): boolean; + function LoadBitmap( aSourceStream : TStream; aIMG : TBitMap ): boolean; + function LoadJpeg( aSourceStream : TStream; aIMG : TBitMap ): boolean; public Limit: integer; CreateCacheMipmap: boolean; @@ -311,12 +312,40 @@ begin end; -function TTextureUnit.LoadBitmap( aSourceStream : TStream; aBMP : TBitMap ): boolean; +function TTextureUnit.LoadBitmap( aSourceStream : TStream; aIMG : TBitMap ): boolean; begin - aSourceStream.position := 0; - boolean := aBMP.LoadFromStream( aSourceStream ) > 0; + result := false; + try + aSourceStream.position := 0; + aIMG.LoadFromStream( aSourceStream ); + finally + result := aSourceStream.position > 0; + end; +end; + +function TTextureUnit.LoadJpeg( aSourceStream : TStream; aIMG : TBitMap ): boolean; +var + TextureJ: TJPEGImage; +begin + result := false; + try + aSourceStream.position := 0; + + TextureJ := TJPEGImage.Create; + try + TextureJ.LoadFromStream( aSourceStream ); + aIMG.Assign(TextureJ); + finally + TextureJ.Free; + end; + finally + result := aSourceStream.position > 0; + end; end; + + + function TTextureUnit.LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; var Res: TResourceStream; @@ -381,38 +410,16 @@ begin end; end; - if FromRegistry or - ((not FromRegistry) and FileExists(Identifier)) then +// if FromRegistry or +// ((not FromRegistry) and FileExists(Identifier)) then begin - TextureB := TBitmap.Create; + TextureB := TBitmap.Create; if Format = 'BMP' then - begin - LoadBitmap( aSourceStream : TStream; TextureB ); - - if FromRegistry then - TextureB.LoadFromStream(Res) - else - TextureB.LoadFromFile(Identifier); - end + LoadBitmap( lTextureStream , TextureB ) else if Format = 'JPG' then - begin - TextureJ := TJPEGImage.Create; - - if FromRegistry then - TextureJ.LoadFromStream(Res) - else - begin - if FileExists(Identifier) then - TextureJ.LoadFromFile(Identifier) - else - Exit; - end; - - TextureB.Assign(TextureJ); - TextureJ.Free; - end + LoadJpeg( lTextureStream , TextureB ) else if Format = 'PNG' then begin {$IFNDEF FPC} -- cgit v1.2.3 From 7e01085a1981f28e538b06bff5cebf2b88c975af Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Sep 2007 11:20:20 +0000 Subject: fixed nasty bug I introduced... sorry.. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@419 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.pas | 2 ++ Game/Code/Classes/UTexture.pas | 23 ++++++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index ee1a74f3..1e4a9f6a 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -79,6 +79,8 @@ procedure BuildFont; // Build Our Bitmap Font Rejestr: TResourceStream; begin {$IFNDEF FPC} + Log.LogStatus( 'TextGL - BUILDFONT - load Font Resource - ' + inttostr( integer( aID ) ) , aType +' '+ aResourceName ); + Rejestr := TResourceStream.Create(HInstance, aResourceName , pchar( aType ) ); try Rejestr.Read(Fonts[ aID ].Width, 256); diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index e7038e78..96c0ec28 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -316,6 +316,8 @@ function TTextureUnit.LoadBitmap( aSourceStream : TStream; aIMG : TBitMap ): boo begin result := false; try + Log.LogStatus( ' TTextureUnit.LoadBitmap' , '' ); + aSourceStream.position := 0; aIMG.LoadFromStream( aSourceStream ); finally @@ -329,6 +331,8 @@ var begin result := false; try + Log.LogStatus( ' TTextureUnit.LoadJpeg' , ''); + aSourceStream.position := 0; TextureJ := TJPEGImage.Create; @@ -375,6 +379,7 @@ var lTextureStream : TStream; begin + lTextureStream := nil; Log.LogStatus( 'From Resource - ' + inttostr( integer( FromRegistry ) ) , Identifier +' '+ Format +' '+ Typ ); // {$IFNDEF FPC} @@ -390,9 +395,13 @@ begin if FromRegistry then begin try -// Res := TResourceStream.Create(HInstance, Identifier, Format); + + Log.LogStatus( ' A' , ''); + + // Res := TResourceStream.Create(HInstance, Identifier, Format); lTextureStream := TResourceStream.Create(HInstance, Identifier, Format); - + Log.LogStatus( ' B' , ''); + // TODO : Where does the format come from except Log.LogStatus( 'ERROR Could not load from resource' , Identifier +' '+ Format +' '+ Typ ); @@ -406,13 +415,17 @@ begin begin // Get the File Extension... Format := PAnsichar(UpperCase(RightStr(ExtractFileExt(Identifier),3))); - lTextureStream := TFileStream.create( Identifier , fmOpenRead ); + lTextureStream := TFileStream.create( Identifier , fmOpenRead or fmShareDenyNone ); end; end; -// if FromRegistry or -// ((not FromRegistry) and FileExists(Identifier)) then + if assigned( lTextureStream ) then begin + Log.LogStatus( ' C - '+Format , ''); + + // TEmp, untill all code is moved to refactord way.. + Res := TResourceStream( lTextureStream ); + TextureB := TBitmap.Create; if Format = 'BMP' then -- cgit v1.2.3 From 333ec29a5275fb851f38f7be695930ea1dfe8340 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Sep 2007 11:28:04 +0000 Subject: remove logging git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@420 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 96c0ec28..389dd0b0 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -381,7 +381,8 @@ var begin lTextureStream := nil; - Log.LogStatus( 'From Resource - ' + inttostr( integer( FromRegistry ) ) , Identifier +' '+ Format +' '+ Typ ); +// Log.LogStatus( 'From Resource - ' + inttostr( integer( FromRegistry ) ) , Identifier +' '+ Format +' '+ Typ ); + // {$IFNDEF FPC} // TODO : JB_lazarus eeeew this is a nasty one... // but lazarus implementation scanlines is different :( @@ -395,14 +396,11 @@ begin if FromRegistry then begin try - - Log.LogStatus( ' A' , ''); - // Res := TResourceStream.Create(HInstance, Identifier, Format); lTextureStream := TResourceStream.Create(HInstance, Identifier, Format); - Log.LogStatus( ' B' , ''); - // TODO : Where does the format come from + // TEmp, untill all code is moved to refactord way.. + Res := TResourceStream( lTextureStream ); except Log.LogStatus( 'ERROR Could not load from resource' , Identifier +' '+ Format +' '+ Typ ); beep; @@ -421,11 +419,6 @@ begin if assigned( lTextureStream ) then begin - Log.LogStatus( ' C - '+Format , ''); - - // TEmp, untill all code is moved to refactord way.. - Res := TResourceStream( lTextureStream ); - TextureB := TBitmap.Create; if Format = 'BMP' then -- cgit v1.2.3 From 707441e6eac0f628f9c61f0130df07c6768ba291 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Sep 2007 11:45:24 +0000 Subject: tidy texture loading. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@421 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.pas | 3 +- Game/Code/Classes/UGraphic.pas | 9 +++- Game/Code/Classes/UTexture.pas | 17 +++--- Game/Code/UltraStar.lpi | 116 +++++++++++++++++++++++------------------ 4 files changed, 82 insertions(+), 63 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index 1e4a9f6a..c228b40a 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -79,8 +79,7 @@ procedure BuildFont; // Build Our Bitmap Font Rejestr: TResourceStream; begin {$IFNDEF FPC} - Log.LogStatus( 'TextGL - BUILDFONT - load Font Resource - ' + inttostr( integer( aID ) ) , aType +' '+ aResourceName ); - + Rejestr := TResourceStream.Create(HInstance, aResourceName , pchar( aType ) ); try Rejestr.Read(Fonts[ aID ].Width, 256); diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 7094c0f9..a8728fa7 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -383,8 +383,13 @@ begin // Show the Loading Screen ------------- LoadLoadingScreen; - - + Log.LogStatus('Loading Screens', 'Initialize3D'); + + +// LoadTextures; // jb +// Log.LogStatus(' Loading Textures', ''); + + // now that we have something to display while loading, // start thread that loads the rest of ultrastar diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 389dd0b0..f01cfd23 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -90,8 +90,8 @@ type TTextureUnit = class private - function LoadBitmap( aSourceStream : TStream; aIMG : TBitMap ): boolean; - function LoadJpeg( aSourceStream : TStream; aIMG : TBitMap ): boolean; + function LoadBitmap( const aSourceStream : TStream; const aIMG : TBitMap ): boolean; + function LoadJpeg( const aSourceStream : TStream; const aIMG : TBitMap ): boolean; public Limit: integer; CreateCacheMipmap: boolean; @@ -312,7 +312,7 @@ begin end; -function TTextureUnit.LoadBitmap( aSourceStream : TStream; aIMG : TBitMap ): boolean; +function TTextureUnit.LoadBitmap( const aSourceStream : TStream; const aIMG : TBitMap ): boolean; begin result := false; try @@ -325,7 +325,7 @@ begin end; end; -function TTextureUnit.LoadJpeg( aSourceStream : TStream; aIMG : TBitMap ): boolean; +function TTextureUnit.LoadJpeg( const aSourceStream : TStream; const aIMG : TBitMap ): boolean; var TextureJ: TJPEGImage; begin @@ -396,7 +396,6 @@ begin if FromRegistry then begin try - // Res := TResourceStream.Create(HInstance, Identifier, Format); lTextureStream := TResourceStream.Create(HInstance, Identifier, Format); // TEmp, untill all code is moved to refactord way.. @@ -413,7 +412,9 @@ begin begin // Get the File Extension... Format := PAnsichar(UpperCase(RightStr(ExtractFileExt(Identifier),3))); - lTextureStream := TFileStream.create( Identifier , fmOpenRead or fmShareDenyNone ); + + lTextureStream := TMemoryStream.create(); + TMemoryStream(lTextureStream).loadfromfile( Identifier ); end; end; @@ -990,7 +991,9 @@ begin if Log.BenchmarkTimeLength[4] >= 1 then Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4); - end; // logerror + end; // logerror + +// freeandnil( lTextureStream ); // TODO - jb - free this.. but we cant at the moment :( // {$ENDIF} end; diff --git a/Game/Code/UltraStar.lpi b/Game/Code/UltraStar.lpi index 947c694c..7dfeb7cc 100644 --- a/Game/Code/UltraStar.lpi +++ b/Game/Code/UltraStar.lpi @@ -41,10 +41,10 @@ - - + + - + @@ -57,13 +57,13 @@ - - + + - + - - + + @@ -87,7 +87,7 @@ - + @@ -258,7 +258,7 @@ - + @@ -569,115 +569,127 @@
- + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - - + + - - + + - + - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - + + + + + + + + + + + + + -- cgit v1.2.3 From fd5f18250e6da98c47f23f49b7c4663c9a8bf7d3 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Sep 2007 12:37:24 +0000 Subject: Adding new Resource compiler for lazarus projects.. (other one did not name resources correctly) this resource compiler could be expanded by someone to Parse Ultrastar.rc and compile the lrs file, rather than having it hardcoded in USDXResCompiler other changes, include ability to read the Resource String properly in code generated by lazarus. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@422 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphic.pas | 43 ++++++++++++++++++++++++++---------------- Game/Code/Classes/UTexture.pas | 22 +++++++++++++-------- Game/Code/Menu/UMenu.pas | 3 ++- 3 files changed, 43 insertions(+), 25 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index a8728fa7..3fbef8b1 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -245,6 +245,12 @@ uses UMain, {$ENDIF} Classes; +procedure LoadFontTextures; +begin + Log.LogStatus('Building Fonts', 'LoadTextures'); + BuildFont; +end; + procedure LoadTextures; @@ -261,6 +267,8 @@ begin Tex_Right[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'BMP', 'Transparent', 0); //brauch man die noch? // P1-6 + // TODO... do it once for each player... this is a bit crappy !! + // can we make it any better !? for P := 1 to 6 do begin LoadColor(R, G, B, 'P' + IntToStr(P) + 'Light'); @@ -307,8 +315,8 @@ begin //PhrasenBonus - Line Bonus Mod End // tworzenie czcionek - Log.LogStatus('Building Fonts', 'LoadTextures'); - BuildFont; +// Log.LogStatus('Building Fonts', 'LoadTextures'); +// BuildFont; end; procedure Initialize3D (Title: string); @@ -320,12 +328,13 @@ var I: Integer; begin Log.LogStatus('LoadOpenGL', 'Initialize3D'); - Log.BenchmarkStart(2); +// Log.BenchmarkStart(2); LoadOpenGL; Log.LogStatus('SDL_Init', 'Initialize3D'); - if ( SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO)= -1 ) then begin + if ( SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO)= -1 ) then + begin Log.LogError('SDL_Init Failed', 'Initialize3D'); exit; end; @@ -355,17 +364,17 @@ begin InitializeScreen; - Log.BenchmarkEnd(2); - Log.LogBenchmark('--> Setting Screen', 2); +// Log.BenchmarkEnd(2); +// Log.LogBenchmark('--> Setting Screen', 2); // ladowanie tekstur - Log.BenchmarkStart(2); +// Log.BenchmarkStart(2); Texture := TTextureUnit.Create; Texture.Limit := 1024*1024; - LoadTextures; - Log.BenchmarkEnd(2); - Log.LogBenchmark('--> Loading Textures', 2); +// LoadTextures; +// Log.BenchmarkEnd(2); +// Log.LogBenchmark('--> Loading Textures', 2); { Log.BenchmarkStart(2); Lyric:= TLyric.Create; @@ -373,21 +382,23 @@ begin Log.LogBenchmark('--> Loading Fonts', 2); } - Log.BenchmarkStart(2); +// Log.BenchmarkStart(2); Display := TDisplay.Create; SDL_EnableUnicode(1); - Log.BenchmarkEnd(2); Log.LogBenchmark('====> Creating Display', 2); +// Log.BenchmarkEnd(2); Log.LogBenchmark('====> Creating Display', 2); - Log.LogStatus('Loading Screens', 'Initialize3D'); - Log.BenchmarkStart(3); +// Log.LogStatus('Loading Screens', 'Initialize3D'); +// Log.BenchmarkStart(3); + + LoadFontTextures(); // Show the Loading Screen ------------- LoadLoadingScreen; Log.LogStatus('Loading Screens', 'Initialize3D'); -// LoadTextures; // jb -// Log.LogStatus(' Loading Textures', ''); + LoadTextures; // jb + Log.LogStatus(' Loading Textures', ''); diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index f01cfd23..1c436f04 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -154,32 +154,36 @@ begin // find texture entry T := FindTexture(Name); - if T = -1 then begin + if T = -1 then + begin // create texture entry T := Length(TextureDatabase.Texture); SetLength(TextureDatabase.Texture, T+1); + TextureDatabase.Texture[T].Name := Name; - TextureDatabase.Texture[T].Typ := Typ; + TextureDatabase.Texture[T].Typ := Typ; // inform database that no textures have been loaded into memory - TextureDatabase.Texture[T].Texture.TexNum := -1; + TextureDatabase.Texture[T].Texture.TexNum := -1; TextureDatabase.Texture[T].TextureCache.TexNum := -1; end; // use preloaded texture - if (not FromCache) or (FromCache and not Covers.CoverExists(Name)) then begin + if (not FromCache) or (FromCache and not Covers.CoverExists(Name)) then + begin // use full texture - if TextureDatabase.Texture[T].Texture.TexNum = -1 then begin + if TextureDatabase.Texture[T].Texture.TexNum = -1 then + begin // load texture TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', pchar(Typ), $0); end; // use texture Result := TextureDatabase.Texture[T].Texture; - end; - if FromCache and Covers.CoverExists(Name) then begin + if FromCache and Covers.CoverExists(Name) then + begin // use cache texture C := Covers.CoverNumber(Name); @@ -381,7 +385,7 @@ var begin lTextureStream := nil; -// Log.LogStatus( 'From Resource - ' + inttostr( integer( FromRegistry ) ) , Identifier +' '+ Format +' '+ Typ ); + Log.LogStatus( 'From Resource - ' + inttostr( integer( FromRegistry ) ) , Identifier +' '+ Format +' '+ Typ ); // {$IFNDEF FPC} // TODO : JB_lazarus eeeew this is a nasty one... @@ -396,10 +400,12 @@ begin if FromRegistry then begin try + {$IFNDEF FPC} lTextureStream := TResourceStream.Create(HInstance, Identifier, Format); // TEmp, untill all code is moved to refactord way.. Res := TResourceStream( lTextureStream ); + {$ENDIF} except Log.LogStatus( 'ERROR Could not load from resource' , Identifier +' '+ Format +' '+ Typ ); beep; diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 1e6c1e87..ccce325e 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -288,7 +288,8 @@ end; procedure TMenu.AddBackground(Name: string); begin - if Name <> '' then begin + if Name <> '' then + begin // BackImg := Texture.LoadTexture(false, PChar(Skin.SkinPath + FileName), 'JPG', 'Plain', 0); // new theme system BackImg := Texture.GetTexture(Skin.GetTextureFileName(Name), 'Plain'); BackImg.W := 800; -- cgit v1.2.3 From bc436ae00c8098f2e77f20bfe2ab185ecfe7a8e0 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Sep 2007 12:46:13 +0000 Subject: now we have a better laz-resource compiler.. we use the correct resource names and types.. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@423 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.pas | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index c228b40a..14f81a9b 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -78,15 +78,12 @@ procedure BuildFont; // Build Our Bitmap Font var Rejestr: TResourceStream; begin - {$IFNDEF FPC} - Rejestr := TResourceStream.Create(HInstance, aResourceName , pchar( aType ) ); try Rejestr.Read(Fonts[ aID ].Width, 256); finally Rejestr.Free; end; - {$ENDIF} end; var @@ -129,20 +126,10 @@ begin - {$IFDEF FPC} - loadfont( 0, 'DAT', 'eurostar_regular' ); - loadfont( 1, 'DAT', 'eurostar_regular_bold' ); - loadfont( 2, 'DAT', 'Outline 1' ); - loadfont( 3, 'DAT', 'Outline 2' ); - {$ELSE} - loadfont( 0, 'FNT', 'Font' ); - loadfont( 1, 'FNT', 'FontB' ); - loadfont( 2, 'FNT', 'FontO' ); - loadfont( 3, 'FNT', 'FontO2' ); - {$ENDIF} - - - + loadfont( 0, 'FNT', 'Font' ); + loadfont( 1, 'FNT', 'FontB' ); + loadfont( 2, 'FNT', 'FontO' ); + loadfont( 3, 'FNT', 'FontO2' ); { Rejestr := TResourceStream.Create(HInstance, 'FontO', 'FNT'); Rejestr.Read(Fonts[4].Width, 256); -- cgit v1.2.3 From cac6be301884b2c0f0b968ff156631cdda9d0410 Mon Sep 17 00:00:00 2001 From: b1indy Date: Thu, 20 Sep 2007 22:49:41 +0000 Subject: testing SDL_Image in credits screen (code is in TScreenCredits.OnShow) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@424 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 138 ++++++++++++++++++++++++++++++++++- Game/Code/UltraStar.dpr | 1 + 2 files changed, 137 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index b931f461..30237f95 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -5,6 +5,7 @@ interface uses UMenu, SDL, + SDL_Image, UDisplay, UTexture, OpenGL12, @@ -67,6 +68,7 @@ type CRDTS_Stage: TCreditsStages; myTex: glUint; + mysdlimage,myconvertedsdlimage: PSDL_Surface; Fadeout: boolean; constructor Create; override; @@ -113,6 +115,26 @@ const 3366, // 20 Ende Credits Tune 60); // 21 start flare im intro + + sdl32bpprgba: TSDL_Pixelformat=(palette: nil; + BitsPerPixel: 32; + BytesPerPixel: 4; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 24; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $ff000000; + colorkey: 0; + alpha: 255 ); + + implementation uses {$IFDEF win32} @@ -127,8 +149,9 @@ uses {$IFDEF win32} Textgl, ULanguage, UCommon, - Math; - + Math, + dialogs; + function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -156,6 +179,7 @@ end; constructor TScreenCredits.Create; begin inherited Create; + credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0); credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0); @@ -192,6 +216,63 @@ begin Draw:=true; end; +function pixfmt_eq(fmt1,fmt2: TSDL_Pixelformat): boolean; +begin + if (fmt1.BitsPerPixel = fmt2.BitsPerPixel) and + (fmt1.BytesPerPixel = fmt2.BytesPerPixel) and + (fmt1.Rloss = fmt2.Rloss) and + (fmt1.Gloss = fmt2.Gloss) and + (fmt1.Bloss = fmt2.Bloss) and + (fmt1.Rmask = fmt2.Rmask) and + (fmt1.Gmask = fmt2.Gmask) and + (fmt1.Bmask = fmt2.Bmask) and + (fmt1.Rshift = fmt2.Rshift) and + (fmt1.Gshift = fmt2.Gshift) and + (fmt1.Bshift = fmt2.Bshift) + then + pixfmt_eq:=True + else + pixfmt_eq:=False; +end; + +function inttohexstr(i: cardinal):pchar; +var helper, i2, c:cardinal; + tmpstr: string; +begin + helper:=0; + i2:=i; + tmpstr:=''; + for c:=1 to 8 do + begin + helper:=(helper shl 4) or (i2 and $f); + i2:=i2 shr 4; + end; + for c:=1 to 8 do + begin + i2:=helper and $f; + helper := helper shr 4; + case i2 of + 0: tmpstr:=tmpstr+'0'; + 1: tmpstr:=tmpstr+'1'; + 2: tmpstr:=tmpstr+'2'; + 3: tmpstr:=tmpstr+'3'; + 4: tmpstr:=tmpstr+'4'; + 5: tmpstr:=tmpstr+'5'; + 6: tmpstr:=tmpstr+'6'; + 7: tmpstr:=tmpstr+'7'; + 8: tmpstr:=tmpstr+'8'; + 9: tmpstr:=tmpstr+'9'; + 10: tmpstr:=tmpstr+'a'; + 11: tmpstr:=tmpstr+'b'; + 12: tmpstr:=tmpstr+'c'; + 13: tmpstr:=tmpstr+'d'; + 14: tmpstr:=tmpstr+'e'; + 15: tmpstr:=tmpstr+'f'; + end; + end; + inttohexstr:=pchar(tmpstr); +end; + procedure TScreenCredits.onShow; begin CRDTS_Stage:=InitialDelay; @@ -203,6 +284,43 @@ begin // Music.Play; CTime:=0; // setlength(CTime_hold,0); + mysdlimage:=IMG_Load('test.png'); + if assigned(mysdlimage) then + begin + showmessage('opened image via SDL_Image'+#13#10+ + 'Width: '+inttostr(mysdlimage^.w)+#13#10+ + 'Height: '+inttostr(mysdlimage^.h)+#13#10+ + 'BitsPP: '+inttostr(mysdlimage^.format.BitsPerPixel)+#13#10+ + 'BytesPP: '+inttostr(mysdlimage^.format.BytesPerPixel)+#13#10+ + 'Rloss: '+inttostr(mysdlimage^.format.Rloss)+#13#10+ + 'Gloss: '+inttostr(mysdlimage^.format.Gloss)+#13#10+ + 'Bloss: '+inttostr(mysdlimage^.format.Bloss)+#13#10+ + 'Aloss: '+inttostr(mysdlimage^.format.Aloss)+#13#10+ + 'Rshift: '+inttostr(mysdlimage^.format.Rshift)+#13#10+ + 'Gshift: '+inttostr(mysdlimage^.format.Gshift)+#13#10+ + 'Bshift: '+inttostr(mysdlimage^.format.Bshift)+#13#10+ + 'Ashift: '+inttostr(mysdlimage^.format.Ashift)+#13#10+ + 'Rmask: '+inttohexstr(mysdlimage^.format.Rmask)+#13#10+ + 'Gmask: '+inttohexstr(mysdlimage^.format.Gmask)+#13#10+ + 'Bmask: '+inttohexstr(mysdlimage^.format.Bmask)+#13#10+ + 'Amask: '+inttohexstr(mysdlimage^.format.Amask)+#13#10+ + 'ColKey: '+inttostr(mysdlimage^.format.Colorkey)+#13#10+ + 'Alpha: '+inttostr(mysdlimage^.format.Alpha)); + if pixfmt_eq(mysdlimage^.format^,sdl32bpprgba) + then showmessage('equal pixelformats') + else showmessage('different pixelformats'); + myconvertedsdlimage:=SDL_ConvertSurface(mysdlimage,@sdl32bpprgba,SDL_SWSURFACE); + glGenTextures(1,@myTex); + glBindTexture(GL_TEXTURE_2D, myTex); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + glTexImage2D( GL_TEXTURE_2D, 0, 4, myconvertedsdlimage^.w, myconvertedsdlimage^.h, 0, + GL_RGBA, GL_UNSIGNED_BYTE, myconvertedsdlimage^.pixels ); + SDL_FreeSurface(mysdlimage); + SDL_FreeSurface(myconvertedsdlimage); + end else + showmessage('could not open file'); + end; procedure TScreenCredits.onHide; @@ -1098,6 +1216,22 @@ begin RuntimeStr:='CTime: '+inttostr(CTime); glPrint (Addr(RuntimeStr[1])); } + + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, myTex); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(100, 100); + glTexCoord2f(0,1);glVertex2f(100, 200); + glTexCoord2f(1,1); glVertex2f(200, 200); + glTexCoord2f(1,0);glVertex2f(200, 100); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // make the stars shine GoldenRec.Draw; end; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index cbb5dd7e..773b8c67 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -10,6 +10,7 @@ uses //Includes - 3rd Party Libraries //------------------------------ SDL in 'lib\JEDI-SDLv1.0\SDL\Pas\SDL.pas', + SDL_Image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas', bass in 'lib\bass\delphi\bass.pas', -- cgit v1.2.3 From f0a22b8ae97aebaf6dc4a9924a22204bc9e3a306 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Fri, 21 Sep 2007 00:55:56 +0000 Subject: added sdl_image to project uses clause and fixed credits screen to compile in lazarus / linux after the minor changes, to use sdl_image git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@425 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 9 +- Game/Code/UltraStar.lpi | 719 ------------------------------ Game/Code/UltraStar.lpr | 831 ++++++++++++++++++----------------- 3 files changed, 424 insertions(+), 1135 deletions(-) delete mode 100644 Game/Code/UltraStar.lpi (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 30237f95..7b5e4c00 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -2,6 +2,13 @@ unit UScreenCredits; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +{$I switches.inc} + + uses UMenu, SDL, @@ -313,7 +320,7 @@ begin glGenTextures(1,@myTex); glBindTexture(GL_TEXTURE_2D, myTex); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexImage2D( GL_TEXTURE_2D, 0, 4, myconvertedsdlimage^.w, myconvertedsdlimage^.h, 0, GL_RGBA, GL_UNSIGNED_BYTE, myconvertedsdlimage^.pixels ); SDL_FreeSurface(mysdlimage); diff --git a/Game/Code/UltraStar.lpi b/Game/Code/UltraStar.lpi deleted file mode 100644 index 7dfeb7cc..00000000 --- a/Game/Code/UltraStar.lpi +++ /dev/null @@ -1,719 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index 51867b87..67d4d9da 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -1,415 +1,416 @@ -program UltraStar; - -{$DEFINE TRANSLATE} - -{$IFDEF FPC} - {$MODE DELPHI} -{$ELSE} - {$R 'UltraStar.res' 'UltraStar.rc'} -{$ENDIF} - -{$I switches.inc} - -uses - - // *************************************************************************** - // - // Developers PLEASE NOTE !!!!!!! - // - // As of september 2007, I am working towards porting Ultrastar-DX to run - // on Linux. I will be modifiying the source to make it compile in lazarus - // on windows & linux and I will make sure that it compiles in delphi still - // To help me in this endevour, please can you make a point of remembering - // that linux is CASE SENSATIVE, and file / unit names must be as per - // the filename exactly. - // - // EG : opengl12.pas must not be OpenGL in the uses cluase. - // - // thanks for your help... - // - // *************************************************************************** - - //------------------------------ - //Includes - 3rd Party Libraries - //------------------------------ - - // SDL / OpenGL - moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', - opengl12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\opengl12.pas', - sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', - - // Bass - {$IFDEF UseBASS} - bass in 'lib\bass\delphi\bass.pas', - {$ENDIF} - - // Midi Units - {$IFDEF UseMIDIPort} - Circbuf in 'lib\midi\CIRCBUF.PAS', - Delphmcb in 'lib\midi\Delphmcb.PAS', - MidiCons in 'lib\midi\MidiCons.PAS', - MidiDefs in 'lib\midi\MidiDefs.PAS', - MidiFile in 'lib\midi\MidiFile.PAS', - midiin in 'lib\midi\midiin.pas', - midiout in 'lib\midi\midiout.pas', - MidiType in 'lib\midi\MidiType.PAS', - {$ENDIF} - - // FFMpeg units - avcodec in 'lib\ffmpeg\avcodec.pas', - avformat in 'lib\ffmpeg\avformat.pas', - avio in 'lib\ffmpeg\avio.pas', - avutil in 'lib\ffmpeg\avutil.pas', - opt in 'lib\ffmpeg\opt.pas', - rational in 'lib\ffmpeg\rational.pas', - - - // Sql Lite - SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', - SQLite3 in 'lib\SQLite\SQLite3.pas', - - - //------------------------------ - //Includes - Menu System - //------------------------------ - - UDisplay in 'Menu\UDisplay.pas', - UDrawTexture in 'Menu\UDrawTexture.pas', - UMenu in 'Menu\UMenu.pas', - UMenuButton in 'Menu\UMenuButton.pas', - UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', - UMenuInteract in 'Menu\UMenuInteract.pas', - UMenuSelect in 'Menu\UMenuSelect.pas', - UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', - UMenuStatic in 'Menu\UMenuStatic.pas', - UMenuText in 'Menu\UMenuText.pas', - - //------------------------------ - //Includes - Classes - //------------------------------ - - {$IFDEF FPC} - ulazjpeg in 'Classes\ulazjpeg.pas', - {$ENDIF} - - TextGL in 'Classes\TextGL.pas', - UCatCovers in 'Classes\UCatCovers.pas', - UCommandLine in 'Classes\UCommandLine.pas', - UCommon in 'Classes\UCommon.pas', - UCovers in 'Classes\UCovers.pas', - UDataBase in 'Classes\UDataBase.pas', - UDLLManager in 'Classes\UDLLManager.pas', - UDraw in 'Classes\UDraw.pas', - UFiles in 'Classes\UFiles.pas', - UGraphic in 'Classes\UGraphic.pas', - UGraphicClasses in 'Classes\UGraphicClasses.pas', - UIni in 'Classes\UIni.pas', - UJoystick in 'Classes\UJoystick.pas', - ULanguage in 'Classes\ULanguage.pas', - ULCD in 'Classes\ULCD.pas', - ULight in 'Classes\ULight.pas', - ULog in 'Classes\ULog.pas', - ULyrics in 'Classes\ULyrics.pas', - ULyrics_bak in 'Classes\ULyrics_bak.pas', - UMain in 'Classes\UMain.pas', - UMusic in 'Classes\UMusic.pas', - UParty in 'Classes\UParty.pas', - UPlaylist in 'Classes\UPlaylist.pas', - URecord in 'Classes\URecord.pas', - USkins in 'Classes\USkins.pas', - USongs in 'Classes\USongs.pas', - UTexture in 'Classes\UTexture.pas', - UThemes in 'Classes\UThemes.pas', - UTime in 'Classes\UTime.pas', - - - //------------------------------ - //Includes - Video Support - //------------------------------ - UVideo in 'Classes\UVideo.pas', - - - //------------------------------ - //Includes - Screens - //------------------------------ - UScreenCredits in 'Screens\UScreenCredits.pas', - UScreenEdit in 'Screens\UScreenEdit.pas', - UScreenEditConvert in 'Screens\UScreenEditConvert.pas', - UScreenEditHeader in 'Screens\UScreenEditHeader.pas', - UScreenEditSub in 'Screens\UScreenEditSub.pas', - UScreenLevel in 'Screens\UScreenLevel.pas', - UScreenLoading in 'Screens\UScreenLoading.pas', - UScreenMain in 'Screens\UScreenMain.pas', - UScreenName in 'Screens\UScreenName.pas', - UScreenOpen in 'Screens\UScreenOpen.pas', - UScreenOptions in 'Screens\UScreenOptions.pas', - UScreenOptionsAdvanced in 'Screens\UScreenOptionsAdvanced.pas', - UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', - UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', - UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', - UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', - UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', - UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', - UScreenPopup in 'Screens\UScreenPopup.pas', - UScreenScore in 'Screens\UScreenScore.pas', - UScreenSing in 'Screens\UScreenSing.pas', - UScreenSong in 'Screens\UScreenSong.pas', - UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', - UScreenSongMenu in 'Screens\UScreenSongMenu.pas', - UScreenStatDetail in 'Screens\UScreenStatDetail.pas', - UScreenStatMain in 'Screens\UScreenStatMain.pas', - UScreenTop5 in 'Screens\UScreenTop5.pas', - UScreenWelcome in 'Screens\UScreenWelcome.pas', - - //------------------------------ - //Includes - Screens PartyMode - //------------------------------ - UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', - UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', - UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', - UScreenPartyScore in 'Screens\UScreenPartyScore.pas', - UScreenPartyWin in 'Screens\UScreenPartyWin.pas', - UScreenSingModi in 'Screens\UScreenSingModi.pas', - - //------------------------------ - //Includes - Modi SDK - //------------------------------ - ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', - - - //------------------------------ - //Includes - Delphi - //------------------------------ - {$IFDEF win32} - Windows, - {$ENDIF} - SysUtils; - -const - Version = 'UltraStar Deluxe V 1.10 Alpha Build'; - -var - WndTitle: string; - hWnd: THandle; - I: Integer; - -begin - WndTitle := Version; - - {$ifdef Win32} - //------------------------------ - //Start more than One Time Prevention - //------------------------------ - hWnd:= FindWindow(nil, PChar(WndTitle)); - //Programm already started - if (hWnd <> 0) then - begin - I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Contìnue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); - if (I = IDYes) then - begin - I := 1; - repeat - Inc(I); - hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); - until (hWnd = 0); - - WndTitle := WndTitle + ' Instance ' + InttoStr(I); - end - else - Exit; - end; - {$endif} - - //------------------------------ - //StartUp - Create Classes and Load Files - //------------------------------ - USTime := TTime.Create; - - // Commandline Parameter Parser - Params := TCMDParams.Create; - - // Log + Benchmark - Log := TLog.Create; - Log.Title := WndTitle; - Log.Enabled := Not Params.NoLog; - Log.BenchmarkStart(0); - - // Language - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Paths', 'Initialization'); InitializePaths; - Log.LogStatus('Load Language', 'Initialization'); Language := TLanguage.Create; - //Add Const Values: - Language.AddConst('US_VERSION', Version); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Language', 1); - - // SDL - Log.BenchmarkStart(1); - Log.LogStatus('Initialize SDL', 'Initialization'); - SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing SDL', 1); - - // Skin - Log.BenchmarkStart(1); - Log.LogStatus('Loading Skin List', 'Initialization'); Skin := TSkin.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Skin List', 1); - - // Sound Card List - Log.BenchmarkStart(1); - Log.LogStatus('Loading Soundcard list', 'Initialization'); - Recording := TRecord.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Soundcard list', 1); - - // Ini + Paths - Log.BenchmarkStart(1); - Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; - Ini.Load; - - //Load Languagefile - if (Params.Language <> -1) then - Language.ChangeLanguage(ILanguage[Params.Language]) - else - Language.ChangeLanguage(ILanguage[Ini.Language]); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Ini', 1); - - // LCD - Log.BenchmarkStart(1); - Log.LogStatus('Load LCD', 'Initialization'); LCD := TLCD.Create; - if Ini.LPT = 1 then begin -// LCD.HalfInterface := true; - LCD.Enable; - LCD.Clear; - LCD.WriteText(1, ' UltraStar '); - LCD.WriteText(2, ' Loading... '); - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading LCD', 1); - - // Light - Log.BenchmarkStart(1); - Log.LogStatus('Load Light', 'Initialization'); Light := TLight.Create; - if Ini.LPT = 2 then begin - Light.Enable; - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Light', 1); - - // Theme - Log.BenchmarkStart(1); - Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Themes', 1); - - // Covers Cache - Log.BenchmarkStart(1); - Log.LogStatus('Creating Covers Cache', 'Initialization'); Covers := TCovers.Create; - Log.LogBenchmark('Loading Covers Cache Array', 1); - Log.BenchmarkStart(1); - - // Category Covers - Log.BenchmarkStart(1); - Log.LogStatus('Creating Category Covers Array', 'Initialization'); - CatCovers:= TCatCovers.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Category Covers Array', 1); - - // Songs - //Log.BenchmarkStart(1); - Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; - Songs.LoadSongList; - Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Songs', 1); - - // PluginManager - Log.BenchmarkStart(1); - Log.LogStatus('PluginManager', 'Initialization'); - DLLMan := TDLLMan.Create; //Load PluginList - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PluginManager', 1); - - // Party Mode Manager - Log.BenchmarkStart(1); - Log.LogStatus('PartySession Manager', 'Initialization'); - PartySession := TParty_Session.Create; //Load PartySession - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PartySession Manager', 1); - - // Graphics - Log.BenchmarkStart(1); - Log.LogStatus('Initialize 3D', 'Initialization'); Initialize3D(WndTitle); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing 3D', 1); - - // Sound - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Sound', 'Initialization'); - Log.LogStatus('Creating Music', 'InitializeSound'); Music := TMusic.Create; - InitializeSound; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Sound', 1); - - // Score Saving System - Log.BenchmarkStart(1); - Log.LogStatus('DataBase System', 'Initialization'); - DataBase := TDataBaseSystem.Create; - - if (Params.ScoreFile = '') then - DataBase.Init ('Ultrastar.db') - else - DataBase.Init (Params.ScoreFile); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading DataBase System', 1); - - //Playlist Manager - Log.BenchmarkStart(1); - Log.LogStatus('Playlist Manager', 'Initialization'); - PlaylistMan := TPlaylistManager.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Playlist Manager', 1); - - //GoldenStarsTwinkleMod - Log.BenchmarkStart(1); - Log.LogStatus('Effect Manager', 'Initialization'); - GoldenRec := TEffectManager.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Particel System', 1); - - // Joypad - if (Ini.Joypad = 1) OR (Params.Joypad) then begin - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Joystick', 'Initialization'); Joy := TJoy.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Joystick', 1); - end; - - Log.BenchmarkEnd(0); - Log.LogBenchmark('Loading Time', 0); - - - //------------------------------ - //Start- Mainloop - //------------------------------ - //Music.SetLoop(true); - //Music.SetVolume(50); - //Music.Open(SkinPath + 'Menu Music 3.mp3'); - //Music.Play; - Log.LogStatus('Main Loop', 'Initialization'); MainLoop; - - Log.LogStatus('Cleanup', 'Done'); - - //------------------------------ - //Finish Application - //------------------------------ - if Ini.LPT = 1 then LCD.Clear; - if Ini.LPT = 2 then Light.TurnOff; - - Log.Free; -end. +program UltraStar; + +{$DEFINE TRANSLATE} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ELSE} + {$R 'UltraStar.res' 'UltraStar.rc'} +{$ENDIF} + +{$I switches.inc} + +uses + + // *************************************************************************** + // + // Developers PLEASE NOTE !!!!!!! + // + // As of september 2007, I am working towards porting Ultrastar-DX to run + // on Linux. I will be modifiying the source to make it compile in lazarus + // on windows & linux and I will make sure that it compiles in delphi still + // To help me in this endevour, please can you make a point of remembering + // that linux is CASE SENSATIVE, and file / unit names must be as per + // the filename exactly. + // + // EG : opengl12.pas must not be OpenGL in the uses cluase. + // + // thanks for your help... + // + // *************************************************************************** + + //------------------------------ + //Includes - 3rd Party Libraries + //------------------------------ + + // SDL / OpenGL + moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', + opengl12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\opengl12.pas', + sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', + sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', + + // Bass + {$IFDEF UseBASS} + bass in 'lib\bass\delphi\bass.pas', + {$ENDIF} + + // Midi Units + {$IFDEF UseMIDIPort} + Circbuf in 'lib\midi\CIRCBUF.PAS', + Delphmcb in 'lib\midi\Delphmcb.PAS', + MidiCons in 'lib\midi\MidiCons.PAS', + MidiDefs in 'lib\midi\MidiDefs.PAS', + MidiFile in 'lib\midi\MidiFile.PAS', + midiin in 'lib\midi\midiin.pas', + midiout in 'lib\midi\midiout.pas', + MidiType in 'lib\midi\MidiType.PAS', + {$ENDIF} + + // FFMpeg units + avcodec in 'lib\ffmpeg\avcodec.pas', + avformat in 'lib\ffmpeg\avformat.pas', + avio in 'lib\ffmpeg\avio.pas', + avutil in 'lib\ffmpeg\avutil.pas', + opt in 'lib\ffmpeg\opt.pas', + rational in 'lib\ffmpeg\rational.pas', + + + // Sql Lite + SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', + SQLite3 in 'lib\SQLite\SQLite3.pas', + + + //------------------------------ + //Includes - Menu System + //------------------------------ + + UDisplay in 'Menu\UDisplay.pas', + UDrawTexture in 'Menu\UDrawTexture.pas', + UMenu in 'Menu\UMenu.pas', + UMenuButton in 'Menu\UMenuButton.pas', + UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', + UMenuInteract in 'Menu\UMenuInteract.pas', + UMenuSelect in 'Menu\UMenuSelect.pas', + UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', + UMenuStatic in 'Menu\UMenuStatic.pas', + UMenuText in 'Menu\UMenuText.pas', + + //------------------------------ + //Includes - Classes + //------------------------------ + + {$IFDEF FPC} + ulazjpeg in 'Classes\ulazjpeg.pas', + {$ENDIF} + + TextGL in 'Classes\TextGL.pas', + UCatCovers in 'Classes\UCatCovers.pas', + UCommandLine in 'Classes\UCommandLine.pas', + UCommon in 'Classes\UCommon.pas', + UCovers in 'Classes\UCovers.pas', + UDataBase in 'Classes\UDataBase.pas', + UDLLManager in 'Classes\UDLLManager.pas', + UDraw in 'Classes\UDraw.pas', + UFiles in 'Classes\UFiles.pas', + UGraphic in 'Classes\UGraphic.pas', + UGraphicClasses in 'Classes\UGraphicClasses.pas', + UIni in 'Classes\UIni.pas', + UJoystick in 'Classes\UJoystick.pas', + ULanguage in 'Classes\ULanguage.pas', + ULCD in 'Classes\ULCD.pas', + ULight in 'Classes\ULight.pas', + ULog in 'Classes\ULog.pas', + ULyrics in 'Classes\ULyrics.pas', + ULyrics_bak in 'Classes\ULyrics_bak.pas', + UMain in 'Classes\UMain.pas', + UMusic in 'Classes\UMusic.pas', + UParty in 'Classes\UParty.pas', + UPlaylist in 'Classes\UPlaylist.pas', + URecord in 'Classes\URecord.pas', + USkins in 'Classes\USkins.pas', + USongs in 'Classes\USongs.pas', + UTexture in 'Classes\UTexture.pas', + UThemes in 'Classes\UThemes.pas', + UTime in 'Classes\UTime.pas', + + + //------------------------------ + //Includes - Video Support + //------------------------------ + UVideo in 'Classes\UVideo.pas', + + + //------------------------------ + //Includes - Screens + //------------------------------ + UScreenCredits in 'Screens\UScreenCredits.pas', + UScreenEdit in 'Screens\UScreenEdit.pas', + UScreenEditConvert in 'Screens\UScreenEditConvert.pas', + UScreenEditHeader in 'Screens\UScreenEditHeader.pas', + UScreenEditSub in 'Screens\UScreenEditSub.pas', + UScreenLevel in 'Screens\UScreenLevel.pas', + UScreenLoading in 'Screens\UScreenLoading.pas', + UScreenMain in 'Screens\UScreenMain.pas', + UScreenName in 'Screens\UScreenName.pas', + UScreenOpen in 'Screens\UScreenOpen.pas', + UScreenOptions in 'Screens\UScreenOptions.pas', + UScreenOptionsAdvanced in 'Screens\UScreenOptionsAdvanced.pas', + UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', + UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', + UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', + UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', + UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', + UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', + UScreenPopup in 'Screens\UScreenPopup.pas', + UScreenScore in 'Screens\UScreenScore.pas', + UScreenSing in 'Screens\UScreenSing.pas', + UScreenSong in 'Screens\UScreenSong.pas', + UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', + UScreenSongMenu in 'Screens\UScreenSongMenu.pas', + UScreenStatDetail in 'Screens\UScreenStatDetail.pas', + UScreenStatMain in 'Screens\UScreenStatMain.pas', + UScreenTop5 in 'Screens\UScreenTop5.pas', + UScreenWelcome in 'Screens\UScreenWelcome.pas', + + //------------------------------ + //Includes - Screens PartyMode + //------------------------------ + UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', + UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', + UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', + UScreenPartyScore in 'Screens\UScreenPartyScore.pas', + UScreenPartyWin in 'Screens\UScreenPartyWin.pas', + UScreenSingModi in 'Screens\UScreenSingModi.pas', + + //------------------------------ + //Includes - Modi SDK + //------------------------------ + ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', + + + //------------------------------ + //Includes - Delphi + //------------------------------ + {$IFDEF win32} + Windows, + {$ENDIF} + SysUtils; + +const + Version = 'UltraStar Deluxe V 1.10 Alpha Build'; + +var + WndTitle: string; + hWnd: THandle; + I: Integer; + +begin + WndTitle := Version; + + {$ifdef Win32} + //------------------------------ + //Start more than One Time Prevention + //------------------------------ + hWnd:= FindWindow(nil, PChar(WndTitle)); + //Programm already started + if (hWnd <> 0) then + begin + I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Contìnue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); + if (I = IDYes) then + begin + I := 1; + repeat + Inc(I); + hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); + until (hWnd = 0); + + WndTitle := WndTitle + ' Instance ' + InttoStr(I); + end + else + Exit; + end; + {$endif} + + //------------------------------ + //StartUp - Create Classes and Load Files + //------------------------------ + USTime := TTime.Create; + + // Commandline Parameter Parser + Params := TCMDParams.Create; + + // Log + Benchmark + Log := TLog.Create; + Log.Title := WndTitle; + Log.Enabled := Not Params.NoLog; + Log.BenchmarkStart(0); + + // Language + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Paths', 'Initialization'); InitializePaths; + Log.LogStatus('Load Language', 'Initialization'); Language := TLanguage.Create; + //Add Const Values: + Language.AddConst('US_VERSION', Version); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Language', 1); + + // SDL + Log.BenchmarkStart(1); + Log.LogStatus('Initialize SDL', 'Initialization'); + SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing SDL', 1); + + // Skin + Log.BenchmarkStart(1); + Log.LogStatus('Loading Skin List', 'Initialization'); Skin := TSkin.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Skin List', 1); + + // Sound Card List + Log.BenchmarkStart(1); + Log.LogStatus('Loading Soundcard list', 'Initialization'); + Recording := TRecord.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Soundcard list', 1); + + // Ini + Paths + Log.BenchmarkStart(1); + Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; + Ini.Load; + + //Load Languagefile + if (Params.Language <> -1) then + Language.ChangeLanguage(ILanguage[Params.Language]) + else + Language.ChangeLanguage(ILanguage[Ini.Language]); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Ini', 1); + + // LCD + Log.BenchmarkStart(1); + Log.LogStatus('Load LCD', 'Initialization'); LCD := TLCD.Create; + if Ini.LPT = 1 then begin +// LCD.HalfInterface := true; + LCD.Enable; + LCD.Clear; + LCD.WriteText(1, ' UltraStar '); + LCD.WriteText(2, ' Loading... '); + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading LCD', 1); + + // Light + Log.BenchmarkStart(1); + Log.LogStatus('Load Light', 'Initialization'); Light := TLight.Create; + if Ini.LPT = 2 then begin + Light.Enable; + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Light', 1); + + // Theme + Log.BenchmarkStart(1); + Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Themes', 1); + + // Covers Cache + Log.BenchmarkStart(1); + Log.LogStatus('Creating Covers Cache', 'Initialization'); Covers := TCovers.Create; + Log.LogBenchmark('Loading Covers Cache Array', 1); + Log.BenchmarkStart(1); + + // Category Covers + Log.BenchmarkStart(1); + Log.LogStatus('Creating Category Covers Array', 'Initialization'); + CatCovers:= TCatCovers.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Category Covers Array', 1); + + // Songs + //Log.BenchmarkStart(1); + Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; + Songs.LoadSongList; + Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Songs', 1); + + // PluginManager + Log.BenchmarkStart(1); + Log.LogStatus('PluginManager', 'Initialization'); + DLLMan := TDLLMan.Create; //Load PluginList + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PluginManager', 1); + + // Party Mode Manager + Log.BenchmarkStart(1); + Log.LogStatus('PartySession Manager', 'Initialization'); + PartySession := TParty_Session.Create; //Load PartySession + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PartySession Manager', 1); + + // Graphics + Log.BenchmarkStart(1); + Log.LogStatus('Initialize 3D', 'Initialization'); Initialize3D(WndTitle); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing 3D', 1); + + // Sound + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Sound', 'Initialization'); + Log.LogStatus('Creating Music', 'InitializeSound'); Music := TMusic.Create; + InitializeSound; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Sound', 1); + + // Score Saving System + Log.BenchmarkStart(1); + Log.LogStatus('DataBase System', 'Initialization'); + DataBase := TDataBaseSystem.Create; + + if (Params.ScoreFile = '') then + DataBase.Init ('Ultrastar.db') + else + DataBase.Init (Params.ScoreFile); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading DataBase System', 1); + + //Playlist Manager + Log.BenchmarkStart(1); + Log.LogStatus('Playlist Manager', 'Initialization'); + PlaylistMan := TPlaylistManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Playlist Manager', 1); + + //GoldenStarsTwinkleMod + Log.BenchmarkStart(1); + Log.LogStatus('Effect Manager', 'Initialization'); + GoldenRec := TEffectManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Particel System', 1); + + // Joypad + if (Ini.Joypad = 1) OR (Params.Joypad) then begin + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Joystick', 'Initialization'); Joy := TJoy.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Joystick', 1); + end; + + Log.BenchmarkEnd(0); + Log.LogBenchmark('Loading Time', 0); + + + //------------------------------ + //Start- Mainloop + //------------------------------ + //Music.SetLoop(true); + //Music.SetVolume(50); + //Music.Open(SkinPath + 'Menu Music 3.mp3'); + //Music.Play; + Log.LogStatus('Main Loop', 'Initialization'); MainLoop; + + Log.LogStatus('Cleanup', 'Done'); + + //------------------------------ + //Finish Application + //------------------------------ + if Ini.LPT = 1 then LCD.Clear; + if Ini.LPT = 2 then Light.TurnOff; + + Log.Free; +end. -- cgit v1.2.3 From f26a2364e41b95665d9e55593eb0c0e8f4cf646b Mon Sep 17 00:00:00 2001 From: mogguh Date: Fri, 21 Sep 2007 11:20:41 +0000 Subject: ScoreScreen, still working on some minor things like simplifying the src (messy joes), color stuff, overlay for the bars, 2 screen fix and when the bars should be drawn (regarding to the playercount) - other skin stuff will follow soon git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@426 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UVideo.pas | 4 +- Game/Code/Screens/UScreenScore.pas | 436 ++++++++++++++++++++++++++----------- 2 files changed, 305 insertions(+), 135 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index 4c8a4076..290db271 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -6,8 +6,8 @@ #############################################################################} //{$define DebugDisplay} // uncomment if u want to see the debug stuff -{$define DebugFrames} -{$define Info} +//{$define DebugFrames} +//{$define Info} unit UVideo; diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 42edf4c9..222879ba 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -14,7 +14,11 @@ uses UMusic, USongs, UThemes, + OpenGL12, + Windows, + math, ULCD; + // OpenGL; type @@ -52,11 +56,30 @@ type Animation: real; Fadeout: boolean; + + BarScore_ActualHeight : array[1..6] of real; + BarPhrase_ActualHeight : array[1..6] of real; + BarGolden_ActualHeight : array[1..6] of real; + + BarScore_EaseOut_Step : real; + BarPhrase_EaseOut_Step : real; + BarGolden_EaseOut_Step : real; + + TextScore_ActualValue : array[1..6] of integer; + TextPhrase_ActualValue : array[1..6] of integer; + TextGolden_ActualValue : array[1..6] of integer; + + EaseOut_MaxSteps : real; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; + procedure onShowFinish; override; function Draw: boolean; override; procedure FillPlayer(Item, P: integer); + + function RaiseBar(PlayerNumber: integer; BarStartPosY: Single; ActualHeight: real; Score: integer; ColorBrightness : String; EaseOut_Step: Real) : real; + function IncrementScore(PlayerNumber: integer; ActualScoreValue: Integer; ScoreReached: integer; EaseOut_Step: Real) : integer; end; implementation @@ -239,34 +262,45 @@ begin end; for P := 1 to 6 do begin - Text[TextName[P]].Visible := V[P]; - Text[TextScore[P]].Visible := V[P]; - - Text[TextNotes[P]].Visible := V[P]; - Text[TextNotesScore[P]].Visible := V[P]; - Text[TextLineBonus[P]].Visible := V[P]; - Text[TextLineBonusScore[P]].Visible := V[P]; - Text[TextGoldenNotes[P]].Visible := V[P]; - Text[TextGoldenNotesScore[P]].Visible := V[P]; - Text[TextTotal[P]].Visible := V[P]; - Text[TextTotalScore[P]].Visible := V[P]; + Text[TextName[P]].Visible := V[P]; + Text[TextScore[P]].Visible := V[P]; + + // We set alpha to 0 , so we can nicely blend them in when we need them + Text[TextScore[P]].Alpha := 0; + Text[TextNotesScore[P]].Alpha := 0; + Text[TextNotes[P]].Alpha := 0; + Text[TextLineBonus[P]].Alpha := 0; + Text[TextLineBonusScore[P]].Alpha := 0; + Text[TextGoldenNotes[P]].Alpha := 0; + Text[TextGoldenNotesScore[P]].Alpha := 0; + Text[TextTotal[P]].Alpha := 0; + Text[TextTotalScore[P]].Alpha := 0; + + Text[TextNotes[P]].Visible := V[P]; + Text[TextNotesScore[P]].Visible := V[P]; + Text[TextLineBonus[P]].Visible := V[P]; + Text[TextLineBonusScore[P]].Visible := V[P]; + Text[TextGoldenNotes[P]].Visible := V[P]; + Text[TextGoldenNotesScore[P]].Visible := V[P]; + Text[TextTotal[P]].Visible := V[P]; + Text[TextTotalScore[P]].Visible := V[P]; for I := 0 to high(PlayerStatic[P]) do - Static[PlayerStatic[P, I]].Visible := V[P]; + Static[PlayerStatic[P, I]].Visible := V[P]; for I := 0 to high(PlayerTexts[P]) do - Text[PlayerTexts[P, I]].Visible := V[P]; + Text[PlayerTexts[P, I]].Visible := V[P]; - Static[StaticBoxLightest[P]].Visible := V[P]; - Static[StaticBoxLight[P]].Visible := V[P]; - Static[StaticBoxDark[P]].Visible := V[P]; + Static[StaticBoxLightest[P]].Visible := V[P]; + Static[StaticBoxLight[P]].Visible := V[P]; + Static[StaticBoxDark[P]].Visible := V[P]; - Static[StaticBackLevel[P]].Visible := V[P]; - Static[StaticBackLevelRound[P]].Visible := V[P]; - Static[StaticLevel[P]].Visible := V[P]; - Static[StaticLevelRound[P]].Visible := V[P]; + Static[StaticBackLevel[P]].Visible := false; //V[P]; + Static[StaticBackLevelRound[P]].Visible := false; //V[P]; + Static[StaticLevel[P]].Visible := false; //V[P]; + Static[StaticLevelRound[P]].Visible := false; //V[P]; end; - +{ if PlayersPlay <= 3 then begin // only for 1 screen mode for P := 0 to PlayersPlay-1 do begin case PlayersPlay of @@ -279,7 +313,7 @@ begin Text[TextName[PP]].Text := Ini.Name[P]; //{$IFDEF TRANSLATE} - case (Player[P].ScoreTotalI) of +{ case (Player[P].ScoreTotalI) of 0..2000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_TONE_DEAF'); 2010..4000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_AMATEUR'); 4010..6000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_RISING_STAR'); @@ -298,9 +332,10 @@ begin 9010..9800: Text[TextScore[PP]].Text := 'Superstar'; 9810..10000: Text[TextScore[PP]].Text := 'Ultrastar'; end; - {$ENDIF} *) +{ {$ENDIF} +//*) - S := IntToStr(Player[P].ScoreI); +{ S := IntToStr(Player[P].ScoreI); while (Length(S)<4) do S := '0' + S; Text[TextNotesScore[PP]].Text := S; @@ -322,12 +357,12 @@ begin Static[StaticLevel[PP]].Texture.H := Round(Static[StaticBackLevel[PP]].Texture.H * Lev); Static[StaticLevel[PP]].Texture.Y := Static[StaticBackLevel[PP]].Texture.Y + Static[StaticBackLevel[PP]].Texture.H - Static[StaticLevel[PP]].Texture.H; Static[StaticLevelRound[PP]].Texture.Y := Static[StaticLevel[PP]].Texture.Y - Static[StaticLevelRound[PP]].Texture.H;} -*) +//*) // doesn't align too much... (to fix) // hint: play with wrapping textures // resolution: setting TexY1 and TexY2 to 0.1 and 0.9 - Lev := Player[P].ScoreTotalI / 10000; +{ Lev := Player[P].ScoreTotalI / 10000; MaxH := Static[StaticBackLevel[PP]].Texture.H + Static[StaticBackLevelRound[PP]].Texture.H / 2; // developer note (Polish): @@ -370,7 +405,30 @@ begin LCD.Clear; LCD.WriteText(1, Ini.Name[0]); LCD.WriteText(2, 'Score: ' + Text[TextTotalScore[1]].Text); +} +end; + +procedure TScreenScore.onShowFinish; +var + index : integer; +begin +for index := 1 to 2 do + begin + BarScore_ActualHeight[index] := 0; + BarPhrase_ActualHeight[index] := 0; + BarGolden_ActualHeight[index] := 0; + + TextScore_ActualValue[index] := 0; + TextPhrase_ActualValue[index] := 0; + TextGolden_ActualValue[index] := 0; + end; + + + BarScore_EaseOut_Step := 1; + BarPhrase_EaseOut_Step := 1; + BarGolden_EaseOut_Step := 1; + EaseOut_MaxSteps := 100; end; function TScreenScore.Draw: boolean; @@ -381,117 +439,14 @@ var Wsp2: real; Pet: integer;} + ActualTime, OldTime : Integer; + Item: integer; P: integer; C: integer; -begin - // star animation -{ Animation := Animation + TimeSkip*1000; - - // move right - Min := 0; Max := 500; - if (Animation >= Min) and (Animation < Max) then begin - Wsp := (Animation - Min) / (Max - Min); - Wsp2 := 1 - Wsp; - - Static[0].Texture.X := 400 + Wsp2 * 50; // prawa mala - Static[0].Texture.Y := 150 - Wsp2 * 500; - Static[1].Texture.X := -50 - Wsp2 * 500; // lewa mala - Static[1].Texture.Y := 200 + Wsp2 * 50; - Static[2].Texture.X := 100 - Wsp2 * 200; // gorna w prawo - Static[2].Texture.Y := 80 - Wsp2 * 200; - Static[3].Texture.X := -280 - Wsp2 * 1000; // lewa wieksza gorna - Static[3].Texture.Y := 90; - - - Static[4].Texture.X := -1200 + Wsp * 1000; - Text[0].X := Static[4].Texture.X + 430; - end; - - // slowly move right - Min := 500; Max := 4100; - if (Animation >= Min) and (Animation < Max) then begin - Wsp := (Animation - Min) / (Max - Min); - - Static[0].Texture.X := 400 - Wsp * 10; // prawa mala - Static[0].Texture.Y := 150 + Wsp * 50; - Static[1].Texture.X := -50 + Wsp * 50; // lewa mala - Static[1].Texture.Y := 200; - Static[2].Texture.X := 100 + Wsp * 50; // gorna w prawo - Static[2].Texture.Y := 80 + Wsp * 30; - Static[3].Texture.X := -280 + Wsp * 200; // lewa wieksza gorna - Static[3].Texture.Y := 90; - - Static[4].Texture.X := -200 + Wsp * 150; // duza glowna - Text[0].X := Static[4].Texture.X + 430; - end; - - // fast move right - Min := 4100; Max := 4400; - if (Animation >= Min) and (Animation < Max) then begin - Wsp := (Animation - Min) / (Max - Min); - Wsp2 := 1 - Wsp; - - Static[0].Texture.X := 390 - Wsp * 200; // prawa mala - Static[0].Texture.Y := 200 + Wsp * 1000; - Static[1].Texture.X := 0 + Wsp * 1000; // lewa mala - Static[1].Texture.Y := 200; - Static[2].Texture.X := 150 + Wsp * 1000; // gorna w prawo - Static[2].Texture.Y := 110 + Wsp * 600; - Static[3].Texture.X := -80 + Wsp * 2000; // lewa wieksza gorna - Static[3].Texture.Y := 90; - - Static[4].Texture.X := -50 + Wsp * 2000; - Text[0].X := Static[4].Texture.X + 430; - - Static[7].Texture.X := 100 + Wsp2 * 3000; - Text[1].X := Static[7].Texture.X + 230; // 300 - Text[1].Y := Static[7].Texture.Y + 140; // 120 Sh - - Text[2].X := Static[7].Texture.X + 250; - Text[2].Y := Static[7].Texture.Y - 250; - Text[3].X := Static[7].Texture.X + 250; - Text[3].Y := Static[7].Texture.Y - 200; - end; - - // last arrow - Min := 4400; Max := 8000; - if (Animation >= Min) and (Animation < Max) then begin - Wsp := (Animation - Min) / (Max - Min); - - Static[7].Texture.X := 100 - Wsp * 100; - Text[1].X := Static[7].Texture.X + 230; // 300 - Text[1].Y := Static[7].Texture.Y + 140; // 120 - - Text[2].X := Static[7].Texture.X + 250; - Text[2].Y := Static[7].Texture.Y - 250; - Text[3].X := Static[7].Texture.X + 250; - Text[3].Y := Static[7].Texture.Y - 200; - end; - - // fade last arrow to left - Min := 8000; Max := 8300; - if (Animation >= Min) and (Animation < Max) then begin - Wsp := (Animation - Min) / (Max - Min); - - Static[7].Texture.X := 0 - Wsp * 3000; - Static[7].Texture.Y := 340 - Wsp * 50; - Text[1].X := Static[7].Texture.X + 230; // 300 Sh - Text[1].Y := Static[7].Texture.Y + 140; // 120 Sh - - Text[2].X := Static[7].Texture.X + 250; - Text[2].Y := Static[7].Texture.Y - 250; - Text[3].X := Static[7].Texture.X + 250; - Text[3].Y := Static[7].Texture.Y - 200; - end; - - Min := 8300; - if (Animation >= Min) and (not Fadeout) then begin - Music.StopShuffle; - FadeTo(@ScreenSong); - Fadeout := true; - end;} + katze : integer; +begin // 0.5.0: try also use 4 players screen with nicks if PlayersPlay = 4 then begin @@ -532,6 +487,221 @@ begin end; inherited Draw; +{ + player[1].ScoreI := 7000; + player[1].ScoreLineI := 2000; + player[1].ScoreGoldenI := 1000; + + player[2].ScoreI := 2500; + player[2].ScoreLineI := 1100; + player[2].ScoreGoldenI := 900; + } +// Let's arise the bars + ActualTime := GetTickCount div 33; + if ((ActualTime <> OldTime) and ShowFinish )then + begin + OldTime := ActualTime; + + For katze:= 0 to 5 do + begin + + // We actually araise them in the right order, but we have to draw them in reverse order (golden -> phrase -> mainscore) + Case BarScore_EaseOut_Step < EaseOut_MaxSteps * 10 of + true : BarScore_EaseOut_Step := BarScore_EaseOut_Step + 1; + end; + + // PhrasenBonus + if (BarScore_EaseOut_Step >= (EaseOut_MaxSteps * 10)) then + begin + Case BarPhrase_EaseOut_Step < EaseOut_MaxSteps * 10 of + true : BarPhrase_EaseOut_Step := BarPhrase_EaseOut_Step + 1; + end; + + // GoldenNotebonus + if (BarPhrase_EaseOut_Step >= (EaseOut_MaxSteps * 10)) then + begin + Case BarGolden_EaseOut_Step < EaseOut_MaxSteps * 10 of + true : BarGolden_EaseOut_Step := BarGolden_EaseOut_Step + 1; + end; + + //######################## + // Draw golden score bar # + //######################## + + BarGolden_ActualHeight[katze] := RaiseBar(katze, + Static[StaticBackLevel[katze+1]].Texture.y - BarScore_ActualHeight[katze] - BarPhrase_ActualHeight[katze], + BarGolden_ActualHeight[katze], + player[katze+1].ScoreGoldenI, + 'Lightest', + BarGolden_EaseOut_Step); + + // Increment and show total score and plain score + TextGolden_ActualValue[katze] := IncrementScore(katze, + TextGolden_ActualValue[katze], + Player[katze+1].ScoreGoldenI, + BarGolden_EaseOut_Step); + Text[TextGoldenNotesScore[katze+1]].Text := IntToStr(TextGolden_ActualValue[katze]); + + // Blend in + Text[TextGoldenNotesScore[katze+1]].Alpha := (BarGolden_EaseOut_Step / 100); + Text[TextGoldenNotes[katze+1]].Alpha := (BarGolden_EaseOut_Step / 100); + + end; + //######################## + // Draw phrase score bar # + //######################## + BarPhrase_ActualHeight[katze] := RaiseBar(katze, + Static[StaticBackLevel[katze+1]].Texture.y - BarScore_ActualHeight[katze], + BarPhrase_ActualHeight[katze], + Player[katze+1].ScoreLineI, + 'Light', + BarPhrase_EaseOut_Step); + + // Increment and show total score and plain score + TextPhrase_ActualValue[katze] := IncrementScore(katze, + TextPhrase_ActualValue[katze], + Player[katze+1].ScoreLineI, + BarPhrase_EaseOut_Step); + Text[TextLineBonusScore[katze+1]].Text := IntToStr(TextPhrase_ActualValue[katze]); + + //Blend in + Text[TextLineBonusScore[katze+1]].Alpha := (BarPhrase_EaseOut_Step / 100); + Text[TextLineBonus[katze+1]].Alpha := (BarPhrase_EaseOut_Step / 100); + + + end; + //####################### + // Draw plain score bar # + //####################### + BarScore_ActualHeight[katze] := RaiseBar(katze, + Static[StaticBackLevel[katze+1]].Texture.y, + BarScore_ActualHeight[katze], + Player[katze+1].ScoreI, + 'Dark', + BarScore_EaseOut_Step); + // Increment and show total score and plain score + TextScore_ActualValue[katze] := IncrementScore(katze, + TextScore_ActualValue[katze], + Player[katze+1].ScoreI, + BarScore_EaseOut_Step); + Text[TextNotesScore[katze+1]].Text := IntToStr(TextScore_ActualValue[katze]); + + Text[TextTotalScore[katze+1]].Text := IntToStr(TextScore_ActualValue[katze] + TextPhrase_ActualValue[katze] + TextGolden_ActualValue[katze]); + + //Blend em in + Text[TextTotalScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextTotal[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextNotesScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextNotes[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + + end; // me loop + end; +end; + + +function TscreenScore.RaiseBar(PlayerNumber: integer; BarStartPosY: Single; ActualHeight: real; Score: integer; ColorBrightness : String; EaseOut_Step: Real) : real; +const + RaiseSmoothness : integer = 100; +var + MaxHeight : real; + NewHeight : real; + Width : real; + + Height2Reach : real; + + RaiseStep : real; + + BarStartPosX : Single; + + R,G,B : real; +begin + + MaxHeight := Static[StaticBackLevel[PlayerNumber + 1]].Texture.H; + Width := Static[StaticBackLevel[PlayerNumber + 1]].Texture.W; + + BarStartPosX := Static[StaticBackLevel[PlayerNumber + 1]].Texture.X; + + BarStartPosY := BarStartPosY + MaxHeight; // The texture starts in the upper left corner, so let's subtract the height - so we can arise it + + // the height dependend of the score + Height2Reach := (Score / 10000) * MaxHeight; + + // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps + RaiseStep := EaseOut_Step; + + if (ActualHeight < Height2Reach) then + begin + // Check http://proto.layer51.com/d.aspx?f=400 for more info on easing functions + // Calculate the actual step according to the maxsteps + RaiseStep := RaiseStep / EaseOut_MaxSteps; + + // quadratic easing out - decelerating to zero velocity + // -end_position * current_time * ( current_time - 2 ) + start_postion + NewHeight := (-Height2Reach * RaiseStep * (RaiseStep - 20) + BarStartPosY) / RaiseSmoothness; + end + else + begin + NewHeight := Height2Reach; + end; + //+1 + LoadColor(R, G, B, 'P' + inttostr(PlayerNumber+1) + ColorBrightness); //dark, light, lightest + glColor4f(R, G, B, 1); + + //the actual bar + glBindTexture(GL_TEXTURE_2D, Static[StaticLevel[PlayerNumber + 1]].Texture.TexNum); + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(BarStartPosX, BarStartPosY - NewHeight); + glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, BarStartPosY - NewHeight); + glTexCoord2f(1, 1); glVertex2f(BarStartPosX + Width, BarStartPosY); + glTexCoord2f(0, 1); glVertex2f(BarStartPosX, BarStartPosY); + glEnd; + + //the round thing on top + glBindTexture(GL_TEXTURE_2D, Static[StaticLevelRound[PlayerNumber + 1]].Texture.TexNum); + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(BarStartPosX, (BarStartPosY - Static[StaticLevelRound[PlayerNumber + 1]].Texture.h) - NewHeight); + glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, (BarStartPosY - Static[StaticLevelRound[PlayerNumber + 1]].Texture.h) - NewHeight); + glTexCoord2f(1, 1); glVertex2f(BarStartPosX + Width, BarStartPosY - NewHeight); + glTexCoord2f(0, 1); glVertex2f(BarStartPosX, BarStartPosY - NewHeight); + glEnd; + + Result := NewHeight; +end; + +function TScreenScore.IncrementScore(PlayerNumber: integer; ActualScoreValue: Integer; ScoreReached: integer; EaseOut_Step: Real) : integer; +const + RaiseSmoothness : integer = 100; +var + RaiseStep : Real; +begin + // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps + RaiseStep := EaseOut_Step; + + if (ActualScoreValue < ScoreReached) then + begin + // Calculate the actual step according to the maxsteps + RaiseStep := RaiseStep / EaseOut_MaxSteps; + + // quadratic easing out - decelerating to zero velocity + // -end_position * current_time * ( current_time - 2 ) + start_postion + Result := floor((-ScoreReached * RaiseStep * (RaiseStep - 20)) / RaiseSmoothness); + end + else + begin + Result := ScoreReached; + end; + end; procedure TScreenScore.FillPlayer(Item, P: integer); -- cgit v1.2.3 From c2400c9068e053375bd496ab8f2092a4840bc3ca Mon Sep 17 00:00:00 2001 From: mogguh Date: Fri, 21 Sep 2007 15:13:54 +0000 Subject: Feature: window title bar icon / taskman icon pre-work, needs fixing after we can read from res w/ sdl_img git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@427 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphic.pas | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 3fbef8b1..3f251be2 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -506,6 +506,11 @@ begin Log.LogStatus('SDL_SetVideoMode', 'Initialize3D'); + +// Okay it's possible to set the title bar / taskbar icon here +// it's working this way, but just if the bmp is in your exe folder + SDL_WM_SetIcon(SDL_LoadBMP('ustar-icon.bmp'), 0); + // SDL_SetRefreshrate(85); // SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); if (Ini.FullScreen = 0) and (Not Params.FullScreen) then -- cgit v1.2.3 From 217cd16e10ff809e7382e5447f1ccde60f3e8564 Mon Sep 17 00:00:00 2001 From: b1indy Date: Fri, 21 Sep 2007 22:15:36 +0000 Subject: first try to load textures with SDL_Image supported texture types are: Plain, Transparent and Colorized (textures in the resource file must be typed TEX) everything else (Font Black, ...) is not implemented. So beware - it looks really broken. There seems to be a problem with The covers - I just didn't understand, what's going on there. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@428 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 942 +++++++++++++++++------------------------ Game/Code/UltraStar.dpr | 2 + Game/Code/UltraStar.rc | 54 +-- 3 files changed, 410 insertions(+), 588 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 1c436f04..78a2573f 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -2,6 +2,9 @@ unit UTexture; // Plain (alpha = 1) // Transparent +// Colorized + +// obsolete? // Transparent Range // Font (white is drawn, black is transparent) // Font Outline (Font with darker outline) @@ -25,15 +28,12 @@ uses OpenGL12, Math, Classes, SysUtils, - {$IFDEF FPC} - ulazjpeg, - {$ELSE} - JPEG, - PNGImage, - {$ENDIF} Graphics, UCommon, - UThemes; + UThemes, + SDL, + sdlutils, + SDL_Image; {$IFDEF Win32} @@ -45,7 +45,7 @@ uses OpenGL12, {$ELSE} const opengl32 = 'libGL.so' ; // YES Capital GL {$ENDIF} - + procedure glGenTextures(n: GLsizei; var textures: GLuint); stdcall; external opengl32; {$ENDIF} @@ -88,10 +88,16 @@ type end; TTextureUnit = class - + private - function LoadBitmap( const aSourceStream : TStream; const aIMG : TBitMap ): boolean; - function LoadJpeg( const aSourceStream : TStream; const aIMG : TBitMap ): boolean; + function LoadImage(Identifier: PChar): PSDL_Surface; + function pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; + procedure AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); + function GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; + procedure ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); + procedure FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); + procedure ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); + public Limit: integer; CreateCacheMipmap: boolean; @@ -108,27 +114,19 @@ type end; var - lasthue: double; Texture: TTextureUnit; TextureDatabase: TTextureDatabase; + // this should be in UDisplay?! PrintScreenData: array[0..1024*768-1] of longword; ActTex: GLuint;//integer; - TexOrigW: integer; - TexOrigH: integer; - TexNewW: integer; - TexNewH: integer; - - TexFitW: integer; - TexFitH: integer; // new for limit - - TextureD8: array[1..1024*1024] of byte; // 1MB +// TextureD8: array[1..1024*1024] of byte; // 1MB TextureD16: array[1..1024*1024, 1..2] of byte; // luminance/alpha tex (2MB) - TextureD24: array[1..1024*1024, 1..3] of byte; // normal 24-bit tex (3MB) - TextureD242: array[1..512*512, 1..3] of byte; // normal 24-bit tex (0,75MB) - TextureD32: array[1..1024*1024, 1..4] of byte; // transparent 32-bit tex (4MB) +// TextureD24: array[1..1024*1024, 1..3] of byte; // normal 24-bit tex (3MB) +// TextureD242: array[1..512*512, 1..3] of byte; // normal 24-bit tex (0,75MB) +// TextureD32: array[1..1024*1024, 1..4] of byte; // transparent 32-bit tex (4MB) // total 40MB at 2048*2048 // total 10MB at 1024*1024 @@ -140,141 +138,244 @@ var implementation uses ULog, DateUtils, UCovers, StrUtils; -function TTextureUnit.GetTexture(Name, Typ: string): TTexture; -begin - Result := GetTexture(Name, Typ, true); +const + fmt_rgba: TSDL_Pixelformat=(palette: nil; + BitsPerPixel: 32; + BytesPerPixel: 4; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 24; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $ff000000; + ColorKey: 0; + Alpha: 255); + fmt_rgb: TSDL_Pixelformat=( palette: nil; + BitsPerPixel: 24; + BytesPerPixel: 3; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 0; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $00000000; + ColorKey: 0; + Alpha: 255); + + +function TTextureUnit.pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; +begin + if (fmt1^.BitsPerPixel = fmt2^.BitsPerPixel) and + (fmt1^.BytesPerPixel = fmt2^.BytesPerPixel) and + (fmt1^.Rloss = fmt2^.Rloss) and (fmt1^.Gloss = fmt2^.Gloss) and + (fmt1^.Bloss = fmt2^.Bloss) and (fmt1^.Rmask = fmt2^.Rmask) and + (fmt1^.Gmask = fmt2^.Gmask) and (fmt1^.Bmask = fmt2^.Bmask) and + (fmt1^.Rshift = fmt2^.Rshift) and (fmt1^.Gshift = fmt2^.Gshift) and + (fmt1^.Bshift = fmt2^.Bshift) + then + Result:=True + else + Result:=False; end; -function TTextureUnit.GetTexture(Name, Typ: string; FromCache: boolean): TTexture; -var - T: integer; // texture - C: integer; // cover - Data: array of byte; -begin - // find texture entry - T := FindTexture(Name); - - if T = -1 then +// +++++++++++++++++++++ helpers for loadimage +++++++++++++++ + function SdlStreamSeek( context : PSDL_RWops; offset : Integer; whence : Integer ) : integer; cdecl; + var + stream : TStream; + origin : Word; begin - // create texture entry - T := Length(TextureDatabase.Texture); - SetLength(TextureDatabase.Texture, T+1); - - TextureDatabase.Texture[T].Name := Name; - TextureDatabase.Texture[T].Typ := Typ; - - // inform database that no textures have been loaded into memory - TextureDatabase.Texture[T].Texture.TexNum := -1; - TextureDatabase.Texture[T].TextureCache.TexNum := -1; + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamSeek on nil' ); + case whence of + 0 : origin := soFromBeginning; // Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0. + 1 : origin := soFromCurrent; // Offset is from the current position in the resource. Seek moves to Position + Offset. + 2 : origin := soFromEnd; + else + origin := soFromBeginning; // just in case + end; + Result := stream.Seek( offset, origin ); end; - - // use preloaded texture - if (not FromCache) or (FromCache and not Covers.CoverExists(Name)) then + function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : Integer; maxnum: Integer ) : Integer; cdecl; + var + stream : TStream; begin - // use full texture - if TextureDatabase.Texture[T].Texture.TexNum = -1 then - begin - // load texture - TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', pchar(Typ), $0); + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamRead on nil' ); + try + Result := stream.read( Ptr^, Size * maxnum ) div size; + except + Result := -1; end; - - // use texture - Result := TextureDatabase.Texture[T].Texture; end; - - if FromCache and Covers.CoverExists(Name) then + function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl; + var + stream : TStream; begin - // use cache texture - C := Covers.CoverNumber(Name); + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamClose on nil' ); + stream.Free; + Result := 1; + end; +// ----------------------------------------------- - if TextureDatabase.Texture[T].TextureCache.TexNum = -1 then begin - // load texture - Covers.PrepareData(Name); - TextureDatabase.Texture[T].TextureCache := CreateTexture(Covers.Data, Name, Covers.Cover[C].W, Covers.Cover[C].H, 24); +function TTextureUnit.LoadImage(Identifier: PChar): PSDL_Surface; +var + TexStream: TStream; + TexRWops: PSDL_RWops; + dHandle: THandle; + +begin + Result:=nil; + TexRWops:=nil; + Log.LogStatus( ' start' , Identifier); + if ( FileExists(Identifier) ) then + begin + Log.LogStatus( ' found file' , ' '+ Identifier); + // load from file + Result:=IMG_Load(Identifier); + end + else + begin + Log.LogStatus( ' trying resource' , ' '+ Identifier); + // load from resource stream + dHandle:=FindResource(hInstance,Identifier,'TEX'); + if dHandle=0 then begin + Log.LogStatus( 'ERROR Could not find resource' , Identifier); + beep; + Exit; end; + + try + TexStream := TResourceStream.Create(HInstance, Identifier, 'TEX'); + TexRWops:=SDL_AllocRW; + TexRWops.unknown:=TUnknown(TexStream); + TexRWops.seek:=SDLStreamSeek; + TexRWops.read:=SDLStreamRead; + TexRWops.write:=nil; + TexRWops.close:=SDLStreamClose; + TexRWops.type_:=2; + except + Log.LogStatus( 'ERROR Could not load from resource' , Identifier); + beep; + Exit; + end; + Result:=IMG_Load_RW(TexRWops,0); + SDL_FreeRW(TexRWops); + TexStream.Free; + end; + Log.LogStatus( ' DONE' , '---'+ Identifier); +end; - // use texture - Result := TextureDatabase.Texture[T].TextureCache; +procedure TTextureUnit.AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); +var + TempSurface: PSDL_Surface; + NeededPixFmt: PSDL_Pixelformat; +begin + NeededPixFmt:=@fmt_rgba; + if Typ= 'Plain' then NeededPixFmt:=@fmt_rgb; + if (Typ='Transparent') or + (Typ='Colorized') + then NeededPixFmt:=@fmt_rgba; + + if not pixfmt_eq(TexSurface^.format, NeededPixFmt) then + begin + TempSurface:=TexSurface; + TexSurface:=SDL_ConvertSurface(TempSurface,NeededPixFmt,SDL_SWSURFACE); + SDL_FreeSurface(TempSurface); end; end; -function TTextureUnit.FindTexture(Name: string): integer; +function TTextureUnit.GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; var - T: integer; // texture + TempSurface: PSDL_Surface; begin - Result := -1; - for T := 0 to high(TextureDatabase.Texture) do - if TextureDatabase.Texture[T].Name = Name then - Result := T; + TempSurface:=TexSurface; + Result:=SDL_ScaleSurfaceRect(TempSurface, + 0,0,TempSurface^.W,TempSurface^.H, + W,H); +end; + +procedure TTextureUnit.ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); +var + TempSurface: PSDL_Surface; +begin + TempSurface:=TexSurface; + TexSurface:=SDL_ScaleSurfaceRect(TempSurface, + 0,0,TempSurface^.W,TempSurface^.H, + W,H); + SDL_FreeSurface(TempSurface); end; -// expects: src, dst: pointers to r,g,b,a -// hue: new hue within range [0.0-6.0) -procedure ColorizeCopy(Src, Dst: PByteArray; hue: Double); overload; +procedure TTextureUnit.FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); var - i,j,k: Cardinal; - clr, hls: array[0..2] of Double; - delta, f, p, q, t: Double; + TempSurface: PSDL_Surface; begin - hls[0]:=hue; + TempSurface:=TexSurface; + with TempSurface^.format^ do + TexSurface:=SDL_CreateRGBSurface(SDL_SWSURFACE,W,H,BitsPerPixel,RMask, GMask, BMask, AMask); + SDL_SetAlpha(TexSurface, 0, 255); + SDL_SetAlpha(TempSurface, 0, 255); + SDL_BlitSurface(TempSurface,nil,TexSurface,nil); + SDL_FreeSurface(TempSurface); +end; + +procedure TTextureUnit.ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); + //returns hue within range [0.0-6.0) + function col2h(Color:Cardinal):double; + var + clr,hls: array[0..2] of double; + delta: double; + begin + clr[0]:=((Color and $ff0000) shr 16)/255; + clr[1]:=((Color and $ff00) shr 8)/255; + clr[2]:=(Color and $ff)/255; + hls[1]:=maxvalue(clr); + delta:=hls[1]-minvalue(clr); + if clr[0]=hls[1] then hls[0]:=(clr[1]-clr[2])/delta + else if clr[1]=hls[1] then hls[0]:=2.0+(clr[2]-clr[0])/delta + else if clr[2]=hls[1] then hls[0]:=4.0+(clr[0]-clr[1])/delta; + if hls[0]<0.0 then hls[0]:=hls[0]+6.0; + if hls[0]=6.0 then hls[0]:=0.0; + col2h:=hls[0]; + end; + procedure ColorizePixel(Pix: PByteArray; hue: Double); + var + i,j,k: Cardinal; + clr, hls: array[0..2] of Double; + delta, f, p, q, t: Double; + begin + hls[0]:=hue; + + clr[0] := Pix[0]/255; + clr[1] := Pix[1]/255; + clr[2] := Pix[2]/255; - clr[0] := src[0]/255; - clr[1] := src[1]/255; - clr[2] := src[2]/255; - //calculate luminance and saturation from rgb hls[1] := maxvalue(clr); //l:=... delta := hls[1] - minvalue(clr); - + if hls[1] = 0.0 then hls[2] := 0.0 else hls[2] := delta/hls[1]; //v:=... - - // calc new rgb from our hls (h from color, l ans s from pixel) -// if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense - begin - k:=trunc(hls[0]); - f:=hls[0]-k; - p:=hls[1]*(1.0-hls[2]); - q:=hls[1]*(1.0-(hls[2]*f)); - t:=hls[1]*(1.0-(hls[2]*(1.0-f))); - case k of - 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end; - 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end; - 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end; - 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end; - 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end; - 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; - end; - // and store new rgb back into the image - dst[0]:=floor(255*clr[0]); - dst[1]:=floor(255*clr[1]); - dst[2]:=floor(255*clr[2]); - dst[3]:=src[3]; - end; -end; -// expects: src: $rrggbb -// dst: pointer to r,g,b,a -// hue: new hue within range [0.0-6.0) -procedure ColorizeCopy(Src: Cardinal; Dst: PByteArray; hue: Double); overload; -var - i,j,k: Cardinal; - clr, hls: array[0..2] of Double; - delta, f, p, q, t: Double; -begin - hls[0]:=hue; - - clr[0]:=((src shr 16) and $ff)/255; - clr[1]:=((src shr 8) and $ff)/255; - clr[2]:=(src and $ff)/255; - //calculate luminance and saturation from rgb - hls[1]:=maxvalue(clr); //l:=... - delta:=hls[1]-minvalue(clr); - if hls[1]=0.0 then hls[2]:=0.0 else hls[2]:=delta/hls[1]; //v:=... // calc new rgb from our hls (h from color, l ans s from pixel) -// if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense + // if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense begin k:=trunc(hls[0]); f:=hls[0]-k; @@ -290,428 +391,135 @@ begin 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; end; // and store new rgb back into the image - dst[0]:=floor(255*clr[0]); - dst[1]:=floor(255*clr[1]); - dst[2]:=floor(255*clr[2]); - dst[3]:=255; + Pix[0]:=floor(255*clr[0]); + Pix[1]:=floor(255*clr[1]); + Pix[2]:=floor(255*clr[2]); end; -end; -//returns hue within range [0.0-6.0) -function col2h(Color:Cardinal):double; -var - clr,hls: array[0..2] of double; - delta: double; -begin - clr[0]:=((Color and $ff0000) shr 16)/255; - clr[1]:=((Color and $ff00) shr 8)/255; - clr[2]:=(Color and $ff)/255; - hls[1]:=maxvalue(clr); - delta:=hls[1]-minvalue(clr); - if clr[0]=hls[1] then hls[0]:=(clr[1]-clr[2])/delta - else if clr[1]=hls[1] then hls[0]:=2.0+(clr[2]-clr[0])/delta - else if clr[2]=hls[1] then hls[0]:=4.0+(clr[0]-clr[1])/delta; - if hls[0]<0.0 then hls[0]:=hls[0]+6.0; - if hls[0]=6.0 then hls[0]:=0.0; - col2h:=hls[0]; -end; - - -function TTextureUnit.LoadBitmap( const aSourceStream : TStream; const aIMG : TBitMap ): boolean; -begin - result := false; - try - Log.LogStatus( ' TTextureUnit.LoadBitmap' , '' ); - - aSourceStream.position := 0; - aIMG.LoadFromStream( aSourceStream ); - finally - result := aSourceStream.position > 0; end; -end; -function TTextureUnit.LoadJpeg( const aSourceStream : TStream; const aIMG : TBitMap ): boolean; var - TextureJ: TJPEGImage; + DestinationHue: Double; + PixelIndex: Cardinal; begin - result := false; - try - Log.LogStatus( ' TTextureUnit.LoadJpeg' , ''); - - aSourceStream.position := 0; - - TextureJ := TJPEGImage.Create; - try - TextureJ.LoadFromStream( aSourceStream ); - aIMG.Assign(TextureJ); - finally - TextureJ.Free; - end; - finally - result := aSourceStream.position > 0; - end; + DestinationHue:=col2h(Col); + for PixelIndex:=0 to (TexSurface^.W*TexSurface^.H -1) do + ColorizePixel(@(PByteArray(TexSurface^.Pixels)[PixelIndex*TexSurface^.format.BytesPerPixel]),DestinationHue); end; - - - function TTextureUnit.LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; var - Res: TResourceStream; - TextureB: TBitmap; - TextureJ: TJPEGImage; - {$IFNDEF FPC} - TexturePNG: TPNGObject; - {$ENDIF} - - TextureAlpha: array of byte; - AlphaPtr: PByte; - TransparentColor: TColor; - PixelColor: TColor; + TexSurface: PSDL_Surface; + MipmapSurface: PSDL_Surface; + newWidth, newHeight: Cardinal; + oldWidth, oldHeight: Cardinal; - Position: integer; - Position2: integer; - Pix: integer; - ColInt: real; - PPix: PByteArray; - TempA: integer; - Error: integer; - SkipX: integer; - myAlpha: Real; - myRGBABitmap: array of byte; - RGBPtr: PByte; - myHue: Double; - - lTextureStream : TStream; begin - lTextureStream := nil; - - Log.LogStatus( 'From Resource - ' + inttostr( integer( FromRegistry ) ) , Identifier +' '+ Format +' '+ Typ ); - -// {$IFNDEF FPC} - // TODO : JB_lazarus eeeew this is a nasty one... - // but lazarus implementation scanlines is different :( - // need to implement as per - // http://www.lazarus.freepascal.org/index.php?name=PNphpBB2&file=viewtopic&p=18512 - // http://www.lazarus.freepascal.org/index.php?name=PNphpBB2&file=viewtopic&p=10797 - // http://wiki.lazarus.freepascal.org/Developing_with_Graphics Log.BenchmarkStart(4); Mipmapping := true; - if FromRegistry then - begin - try - {$IFNDEF FPC} - lTextureStream := TResourceStream.Create(HInstance, Identifier, Format); - - // TEmp, untill all code is moved to refactord way.. - Res := TResourceStream( lTextureStream ); - {$ENDIF} - except - Log.LogStatus( 'ERROR Could not load from resource' , Identifier +' '+ Format +' '+ Typ ); - beep; - Exit; - end; - end + if Identifier = nil then + Log.LogStatus(' ERROR unknown Identifier', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+'''') else - begin - if ( FileExists(Identifier) ) then - begin - // Get the File Extension... - Format := PAnsichar(UpperCase(RightStr(ExtractFileExt(Identifier),3))); + Log.LogStatus(' should be ok - trying to load', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+''''); - lTextureStream := TMemoryStream.create(); - TMemoryStream(lTextureStream).loadfromfile( Identifier ); - end; - end; - - if assigned( lTextureStream ) then + // load texture data into memory + TexSurface:=LoadImage(Identifier); + if not assigned(TexSurface) then begin - TextureB := TBitmap.Create; + Log.LogStatus( 'ERROR Could not load texture' , Identifier +' '+ Format +' '+ Typ ); + beep; + Exit; + end; - if Format = 'BMP' then - LoadBitmap( lTextureStream , TextureB ) - else - if Format = 'JPG' then - LoadJpeg( lTextureStream , TextureB ) - else if Format = 'PNG' then + // convert pixel format as needed + AdjustPixelFormat(TexSurface, Typ); + + // adjust texture size (scale down, if necessary) + newWidth:=TexSurface^.W; + newHeight:=TexSurface.H; + if (newWidth > Limit) then + newWidth:=Limit; + if (newHeight > Limit) then + newHeight:=Limit; + if (TexSurface.W > newWidth) or (TexSurface^.H > newHeight) then + ScaleTexture(TexSurface,newWidth,newHeight); + + // don't actually understand, if this is needed... + // this should definately be changed... together with all this + // cover cache stuff + if (CreateCacheMipmap) and (Typ='Plain') then begin - {$IFNDEF FPC} - // TODO : JB_lazarus - fix this for lazarus.. - TexturePNG := TPNGObject.Create; - if FromRegistry then - TexturePNG.LoadFromStream(Res) - else + if (Covers.W <= 256) and (Covers.H <= 256) then begin - if FileExists(Identifier) then - TexturePNG.LoadFromFile(Identifier) - else - Exit; + MipmapSurface:=GetScaledTexture(TexSurface,Covers.W, Covers.H); + System.Move(MipmapSurface^.pixels,CacheMipmap,Covers.W*Covers.H*3-1); + SDL_FreeSurface(MipmapSurface); end; - - TextureB.Assign(TexturePNG); - // transparent png hack start (part 1 of 2) - if ((Typ = 'Transparent') or (Typ = 'Colorized')) and (TexturePNG.TransparencyMode = ptmPartial) then - begin - setlength(TextureAlpha, TextureB.Width*TextureB.Height); - setlength(MyRGBABitmap,TextureB.Width*TextureB.Height*4); - if (TexturePNG.Header.ColorType = COLOR_GRAYSCALEALPHA) or - (TexturePNG.Header.ColorType = COLOR_RGBALPHA) then - begin - // i would have preferred english variables here but i use Position because i'm lazy - for Position := 0 to TextureB.Height - 1 do - begin - AlphaPtr := PByte(TexturePNG.AlphaScanline[Position]); - RGBPtr:=PByte(TexturePNG.Scanline[Position]); - for Position2 := 0 to TextureB.Width - 1 do - begin - TextureAlpha[Position*TextureB.Width+Position2]:= AlphaPtr^; - MyRGBABitmap[(Position*TextureB.Width+Position2)*4]:= RGBPtr^; - Inc(RGBPtr); - MyRGBABitmap[(Position*TextureB.Width+Position2)*4+1]:= RGBPtr^; - Inc(RGBPtr); - MyRGBABitmap[(Position*TextureB.Width+Position2)*4+2]:= RGBPtr^; - Inc(RGBPtr); - MyRGBABitmap[(Position*TextureB.Width+Position2)*4+3]:= AlphaPtr^; -// Inc(RGBPtr); - Inc(AlphaPtr); - end; - end; - end; - end else - setlength(TextureAlpha,0); // just no special transparency for unimplemented transparency types (ptmBit) - // transparent png hack end - TexturePNG.Free; - {$ENDIF} + // should i create a cache texture, if Covers.W/H are larger? end; - if FromRegistry then Res.Free; - if (TextureB.Width > 1024) or (TextureB.Height > 1024) then begin // will be fixed in 0.5.1 and dynamically extended to 8192x8192 depending on the driver - Log.LogError('Image ' + Identifier + ' is too big (' + IntToStr(TextureB.Width) + 'x' + IntToStr(TextureB.Height) + ')'); - Result.TexNum := -1; - end else begin + // now we might colorize the whole thing + if Typ='Colorized' then ColorizeTexture(TexSurface,Col); + + // save actual dimensions of our texture + oldWidth:=newWidth; + oldHeight:=newHeight; + // make texture dimensions be powers of 2 + newWidth:=Round(Power(2, Ceil(Log2(newWidth)))); + newHeight:=Round(Power(2, Ceil(Log2(newHeight)))); + if (newHeight <> oldHeight) or (newWidth <> oldWidth) then + FitTexture(TexSurface,newWidth,newHeight); + + // at this point we have the image in memory... + // scaled to be at most 1024x1024 pixels large + // scaled so that dimensions are powers of 2 + // and converted to either RGB or RGBA + + // if we got a Texture of Type Plain, Transparent or Colorized, + // then we're done manipulating it + // and could now create our openGL texture from it + + // prepare OpenGL texture glGenTextures(1, ActTex); glBindTexture(GL_TEXTURE_2D, ActTex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + // load data into gl texture if Typ = 'Plain' then begin - {$IFNDEF FPC} - // dimensions - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - - // copy and process pixeldata - TextureB.PixelFormat := pf24bit; -{ if (TextureB.PixelFormat = pf8bit) then begin - for Position := 0 to TexOrigH-1 do begin - for Position2 := 0 to TexOrigW-1 do begin - Pix := TextureB.Canvas.Pixels[Position2, Position]; - TextureD24[Position*TexNewW + Position2+1, 1] := Pix; - TextureD24[Position*TexNewW + Position2+1, 2] := Pix div 256; - TextureD24[Position*TexNewW + Position2+1, 3] := Pix div (256*256); - end; - end; - end;} - if (TexOrigW <= Limit) and (TexOrigW <= Limit) then begin - if (TextureB.PixelFormat = pf24bit) then begin - for Position := 0 to TexOrigH-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TexOrigW-1 do begin - TextureD24[Position*TexNewW + Position2+1, 1] := PPix[Position2*3+2]; - TextureD24[Position*TexNewW + Position2+1, 2] := PPix[Position2*3+1]; - TextureD24[Position*TexNewW + Position2+1, 3] := PPix[Position2*3]; - end; - end; - end; - end else begin - // limit - TexFitW := 4 * (TexOrigW div 4); // fix for bug in gluScaleImage - TexFitH := TexOrigH; - if (TextureB.PixelFormat = pf24bit) then begin - for Position := 0 to TexOrigH-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TexOrigW-1 do begin - TextureD24[Position*TexFitW + Position2+1, 1] := PPix[Position2*3+2]; - TextureD24[Position*TexFitW + Position2+1, 2] := PPix[Position2*3+1]; - TextureD24[Position*TexFitW + Position2+1, 3] := PPix[Position2*3]; - end; - end; - end; - gluScaleImage(GL_RGB, TexFitW, TexFitH, GL_UNSIGNED_BYTE, @TextureD24, - Limit, Limit, GL_UNSIGNED_BYTE, @TextureD24); // takes some time - - TexNewW := Limit; - TexNewH := Limit; - TexOrigW := Limit; - TexOrigH := Limit; - end; - - // creating cache mipmap - if CreateCacheMipmap then begin - if (TexOrigW <> TexNewW) or (TexOrigH <> TexNewH) then begin - // texture only uses some of it's space. there's a need for resize to fit full size - // and get best quality - TexFitW := 4 * (TexOrigW div 4); // 0.5.0: fix for bug in gluScaleImage - SkipX := (TexOrigW div 2) mod 2; // 0.5.0: try to center image - - TexFitH := TexOrigH; - for Position := 0 to TexOrigH-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TexOrigW-1 do begin - TextureD242[Position*TexFitW + Position2+1, 1] := PPix[(Position2+SkipX)*3+2]; - TextureD242[Position*TexFitW + Position2+1, 2] := PPix[(Position2+SkipX)*3+1]; - TextureD242[Position*TexFitW + Position2+1, 3] := PPix[(Position2+SkipX)*3]; - end; - end; - gluScaleImage(GL_RGB, TexFitW, TexFitH, GL_UNSIGNED_BYTE, @TextureD242, - Covers.W, Covers.H, GL_UNSIGNED_BYTE, @CacheMipmap[0]); // takes some time - - end else begin - // texture fits perfectly - gluScaleImage(GL_RGB, TexOrigW, TexOrigH, GL_UNSIGNED_BYTE, @TextureD24, - Covers.W, Covers.H, GL_UNSIGNED_BYTE, @CacheMipmap[0]); // takes some time - end; - end; - - glTexImage2D(GL_TEXTURE_2D, 0, 3, TexNewW, TexNewH, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TexNewW, TexNewH, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); - if Error > 0 then beep; - end - {$ENDIF} + glTexImage2D(GL_TEXTURE_2D, 0, 3, newWidth, newHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, TexSurface^.pixels); end; - if Typ = 'Transparent' then begin - // dimensions - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - - // copy and process pixeldata - for Position := 0 to TexOrigH-1 do begin - for Position2 := 0 to TexOrigW-1 do begin - Pix := TextureB.Canvas.Pixels[Position2, Position]; - // ,- part of transparent png hack - if ((Pix = $fefefe) or (Pix = Col)) and (length(TextureAlpha)=0) then begin //Small fix, that caused artefacts to be drawn (#fe == dec254) - TextureD32[Position*TexNewW + Position2 + 1, 1] := 0; - TextureD32[Position*TexNewW + Position2 + 1, 2] := 0; - TextureD32[Position*TexNewW + Position2 + 1, 3] := 0; - TextureD32[Position*TexNewW + Position2 + 1, 4] := 0; - end else if (Format = 'PNG') and (length(TextureAlpha) <> 0) then begin - myAlpha:=TextureAlpha[Position*TexOrigW+Position2]; - TextureD32[Position*TexNewW + Position2+1, 1] := MyRGBABitmap[(Position*TexOrigW+Position2)*4+2]; - TextureD32[Position*TexNewW + Position2+1, 2] := MyRGBABitmap[(Position*TexOrigW+Position2)*4+1]; - TextureD32[Position*TexNewW + Position2+1, 3] := MyRGBABitmap[(Position*TexOrigW+Position2)*4]; - TextureD32[Position*TexNewW+Position2+1,4]:=MyRGBABitmap[(Position*TexOrigW+Position2)*4+3]; - end else begin - TextureD32[Position*TexNewW + Position2+1, 1] := (Pix and $ff); - TextureD32[Position*TexNewW + Position2+1, 2] := ((Pix shr 8) and $ff); - TextureD32[Position*TexNewW + Position2+1, 3] := ((Pix shr 16) and $ff); - TextureD32[Position*TexNewW + Position2+1, 4] := 255; - end; - end; - end; - setlength(TextureAlpha,0); - setlength(MyRGBABitmap,0); - glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); -{ if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - if Error > 0 then beep; - end;} + if (Typ = 'Transparent') or (Typ='Colorized') then begin + glTexImage2D(GL_TEXTURE_2D, 0, 4, newWidth, newHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, TexSurface^.pixels); end; - -// The new awesomeness of colorized pngs starts here -// We're the first who had this feature, so give credit when you copy+paste :P - if Typ = 'Colorized' then begin - // dimensions - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - - myHue:=col2h(Col); - // copy and process pixeldata - for Position := 0 to TexOrigH-1 do begin - for Position2 := 0 to TexOrigW-1 do begin - Pix := TextureB.Canvas.Pixels[Position2, Position]; - if (Format = 'PNG') and (length(MyRGBABitmap) <> 0) then - ColorizeCopy(@MyRGBABitmap[(Position*TexOrigW+Position2)*4], - @TextureD32[Position*TexNewW + Position2+1, 1], - myHue) - else - ColorizeCopy(Pix, - @TextureD32[Position*TexNewW + Position2+1, 1], - myHue); - end; - end; - - setlength(TextureAlpha,0); - setlength(MyRGBABitmap,0); - glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; -// eoa COLORIZE - - if Typ = 'Transparent Range' then begin - // dimensions - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TexOrigH-1 do begin - for Position2 := 0 to TexOrigW-1 do begin +{ + if Typ = 'Transparent Range' then + // set alpha to 256-green-component (not sure) Pix := TextureB.Canvas.Pixels[Position2, Position]; TextureD32[Position*TexNewW + Position2+1, 1] := Pix; TextureD32[Position*TexNewW + Position2+1, 2] := Pix div 256; TextureD32[Position*TexNewW + Position2+1, 3] := Pix div (256*256); TextureD32[Position*TexNewW + Position2+1, 4] := 256 - Pix div 256; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); -{ if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - if Error > 0 then beep; - end;} - end; - +} +{ if Typ = 'Font' then - begin - {$IFNDEF FPC} - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin + // either create luminance-alpha texture + // or use transparency from differently saved file + // or do something totally different (text engine with ttf) Pix := PPix[Position2 * 3]; TextureD16[Position*TextureB.Width + Position2 + 1, 1] := 255; TextureD16[Position*TextureB.Width + Position2 + 1, 2] := Pix; - end; - end; glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - - if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - if Error > 0 then beep; - end; - {$ENDIF} - end; - +} +{ if Typ = 'Font Outline' then + // no idea... begin - {$IFNDEF FPC} TextureB.PixelFormat := pf24bit; for Position := 0 to TextureB.Height-1 do begin PPix := TextureB.ScanLine[Position]; @@ -732,18 +540,12 @@ begin end; end; glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - - if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - if Error > 0 then beep; - end; - {$ENDIF} end; - +} +{ if Typ = 'Font Outline 2' then + // same as above begin - {$IFNDEF FPC} TextureB.PixelFormat := pf24bit; for Position := 0 to TextureB.Height-1 do begin PPix := TextureB.ScanLine[Position]; @@ -762,18 +564,16 @@ begin end; end; glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); if Mipmapping then begin Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); if Error > 0 then beep; end; - {$ENDIF} end; if Typ = 'Font Black' then + // and so on begin - {$IFNDEF FPC} // normalnie 0,125s bez niczego 0,015s - 0,030s z pix 0,125s <-- ??? // dimensions TextureB.PixelFormat := pf24bit; @@ -795,12 +595,11 @@ begin end; end; glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - {$ENDIF} end; if Typ = 'Alpha Black Colored' then + // ... hope, noone needs this begin - {$IFNDEF FPC} TextureB.PixelFormat := pf24bit; TexOrigW := TextureB.Width; TexOrigH := TextureB.Height; @@ -820,12 +619,10 @@ begin end; end; glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - {$ENDIF} end; if Typ = 'Font Gray' then begin - {$IFNDEF FPC} // dimensions TexOrigW := TextureB.Width; TexOrigH := TextureB.Height; @@ -844,16 +641,10 @@ begin end; end; glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); -{ if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - if Error > 0 then beep; - end;} - {$ENDIF} end; if Typ = 'Arrow' then begin - {$IFNDEF FPC} TextureB.PixelFormat := pf24bit; for Position := 0 to TextureB.Height-1 do begin PPix := TextureB.ScanLine[Position]; @@ -882,12 +673,10 @@ begin Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); if Error > 0 then beep; end; - {$ENDIF} end; if Typ = 'Note Plain' then begin - {$IFNDEF FPC} for Position := 0 to TextureB.Height-1 do begin PPix := TextureB.ScanLine[Position]; @@ -921,12 +710,10 @@ begin end; end; glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureB.Width, TextureB.Height, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); - {$ENDIF} end; if Typ = 'Note Transparent' then begin - {$IFNDEF FPC} for Position := 0 to TextureB.Height-1 do begin PPix := TextureB.ScanLine[Position]; for Position2 := 0 to TextureB.Width-1 do begin @@ -961,10 +748,9 @@ begin end; end; glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - {$ENDIF} end; +} - TextureB.Free; Result.X := 0; Result.Y := 0; Result.W := 0; @@ -973,8 +759,8 @@ begin Result.ScaleH := 1; Result.Rot := 0; Result.TexNum := ActTex; - Result.TexW := TexOrigW / TexNewW; - Result.TexH := TexOrigH / TexNewH; + Result.TexW := oldWidth / newWidth; + Result.TexH := oldHeight / newHeight; Result.Int := 1; Result.ColR := 1; @@ -991,52 +777,86 @@ begin // 0.5.0 Result.Name := Identifier; - end; + SDL_FreeSurface(TexSurface); + Log.BenchmarkEnd(4); if Log.BenchmarkTimeLength[4] >= 1 then Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4); +end; - end; // logerror -// freeandnil( lTextureStream ); // TODO - jb - free this.. but we cant at the moment :( -// {$ENDIF} +function TTextureUnit.GetTexture(Name, Typ: string): TTexture; +begin + Result := GetTexture(Name, Typ, true); end; -{procedure ResizeTexture(s: pbytearray; d: pbytearray); +function TTextureUnit.GetTexture(Name, Typ: string; FromCache: boolean): TTexture; var - Position: integer; - Position2: integer; + T: integer; // texture + C: integer; // cover + Data: array of byte; begin - for Position := 0 to TexNewH*4-1 do - for Position2 := 0 to TexNewW-1 do - d[Position*TexNewW + Position2] := 0; - - for Position := 0 to TexOrigH-1 do begin - for Position2 := 0 to TexOrigW-1 do begin - d[(Position*TexNewW + Position2)*4] := Paleta[s[Position*TexOrigW + Position2], 1]; - d[(Position*TexNewW + Position2)*4+1] := Paleta[s[Position*TexOrigW + Position2], 2]; - d[(Position*TexNewW + Position2)*4+2] := Paleta[s[Position*TexOrigW + Position2], 3]; - d[(Position*TexNewW + Position2)*4+3] := Paleta[s[Position*TexOrigW + Position2], 4]; + // find texture entry + T := FindTexture(Name); + + if T = -1 then + begin + // create texture entry + T := Length(TextureDatabase.Texture); + SetLength(TextureDatabase.Texture, T+1); + + TextureDatabase.Texture[T].Name := Name; + TextureDatabase.Texture[T].Typ := Typ; + + // inform database that no textures have been loaded into memory + TextureDatabase.Texture[T].Texture.TexNum := -1; + TextureDatabase.Texture[T].TextureCache.TexNum := -1; + end; + + // use preloaded texture + if (not FromCache) or (FromCache and not Covers.CoverExists(Name)) then + begin + // use full texture + if TextureDatabase.Texture[T].Texture.TexNum = -1 then + begin + // load texture + TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', pchar(Typ), $0); + end; + + // use texture + Result := TextureDatabase.Texture[T].Texture; + end; + + if FromCache and Covers.CoverExists(Name) then + begin + // use cache texture + C := Covers.CoverNumber(Name); + + if TextureDatabase.Texture[T].TextureCache.TexNum = -1 then begin + // load texture + Covers.PrepareData(Name); + TextureDatabase.Texture[T].TextureCache := CreateTexture(Covers.Data, Name, Covers.Cover[C].W, Covers.Cover[C].H, 24); end; + + // use texture + Result := TextureDatabase.Texture[T].TextureCache; end; -end;} +end; -{procedure SetTexture(p: pointer); +function TTextureUnit.FindTexture(Name: string): integer; +var + T: integer; // texture begin - glGenTextures(1, Tekstur); - glBindTexture(GL_TEXTURE_2D, Tekstur); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - glTexImage2D(GL_TEXTURE_2D, 0, 4, TexNewW, TexNewH, 0, GL_RGBA, GL_UNSIGNED_BYTE, p); -end;} + Result := -1; + for T := 0 to high(TextureDatabase.Texture) do + if TextureDatabase.Texture[T].Name = Name then + Result := T; +end; function TTextureUnit.LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; begin Result := LoadTexture(false, Identifier, Format, Typ, Col); -// Result := LoadTexture(SkinReg, Identifier, Format, Typ, Col); // default to SkinReg - end; function TTextureUnit.LoadTexture(Identifier: string): TTexture; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 773b8c67..f7dd7e9b 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -10,6 +10,8 @@ uses //Includes - 3rd Party Libraries //------------------------------ SDL in 'lib\JEDI-SDLv1.0\SDL\Pas\SDL.pas', + moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', + sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', SDL_Image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas', diff --git a/Game/Code/UltraStar.rc b/Game/Code/UltraStar.rc index cf954deb..cc12eb51 100644 --- a/Game/Code/UltraStar.rc +++ b/Game/Code/UltraStar.rc @@ -1,38 +1,38 @@ -Font PNG "..\Fonts\Normal\eurostar_regular.png" +Font TEX "..\Fonts\Normal\eurostar_regular.png" Font FNT "..\Fonts\Normal\eurostar_regular.dat" -FontB PNG "..\Fonts\Bold\eurostar_regular_bold.png" +FontB TEX "..\Fonts\Bold\eurostar_regular_bold.png" FontB FNT "..\Fonts\Bold\eurostar_regular_bold.dat" -FontO PNG "..\Fonts\Outline 1\Outline 1.PNG" +FontO TEX "..\Fonts\Outline 1\Outline 1.png" FontO FNT "..\Fonts\Outline 1\Outline 1.dat" -FontO2 PNG "..\Fonts\Outline 2\Outline 2.PNG" +FontO2 TEX "..\Fonts\Outline 2\Outline 2.png" FontO2 FNT "..\Fonts\Outline 2\Outline 2.dat" MAINICON ICON "..\Graphics\ustar-icon_v01.ico" //MAINICON ICON "..\Graphics\us.ico" -CRDTS_BG PNG "..\Graphics\credits_v5_bg.png" -CRDTS_OVL PNG "..\Graphics\credits_v5_overlay.png" -CRDTS_blindguard PNG "..\Graphics\names_blindguard.png" -CRDTS_blindy PNG "..\Graphics\names_blindy.png" -CRDTS_canni PNG "..\Graphics\names_canni.png" -CRDTS_commandio PNG "..\Graphics\names_commandio.png" -CRDTS_lazyjoker PNG "..\Graphics\names_lazyjoker.png" -CRDTS_mog PNG "..\Graphics\names_mog.png" -CRDTS_mota PNG "..\Graphics\names_mota.png" -CRDTS_skillmaster PNG "..\Graphics\names_skillmaster.png" -CRDTS_whiteshark PNG "..\Graphics\names_whiteshark.png" -INTRO_L01 PNG "..\Graphics\intro-l-01.png" -INTRO_L02 PNG "..\Graphics\intro-l-02.png" -INTRO_L03 PNG "..\Graphics\intro-l-03.png" -INTRO_L04 PNG "..\Graphics\intro-l-04.png" -INTRO_L05 PNG "..\Graphics\intro-l-05.png" -INTRO_L06 PNG "..\Graphics\intro-l-06.png" -INTRO_L07 PNG "..\Graphics\intro-l-07.png" -INTRO_L08 PNG "..\Graphics\intro-l-08.png" -INTRO_L09 PNG "..\Graphics\intro-l-09.png" -OUTRO_BG PNG "..\Graphics\outro-bg.png" -OUTRO_ESC PNG "..\Graphics\outro-esc.png" -OUTRO_EXD PNG "..\Graphics\outro-exit-dark.png" \ No newline at end of file +CRDTS_BG TEX "..\Graphics\credits_v5_bg.png" +CRDTS_OVL TEX "..\Graphics\credits_v5_overlay.png" +CRDTS_blindguard TEX "..\Graphics\names_blindguard.png" +CRDTS_blindy TEX "..\Graphics\names_blindy.png" +CRDTS_canni TEX "..\Graphics\names_canni.png" +CRDTS_commandio TEX "..\Graphics\names_commandio.png" +CRDTS_lazyjoker TEX "..\Graphics\names_lazyjoker.png" +CRDTS_mog TEX "..\Graphics\names_mog.png" +CRDTS_mota TEX "..\Graphics\names_mota.png" +CRDTS_skillmaster TEX "..\Graphics\names_skillmaster.png" +CRDTS_whiteshark TEX "..\Graphics\names_whiteshark.png" +INTRO_L01 TEX "..\Graphics\intro-l-01.png" +INTRO_L02 TEX "..\Graphics\intro-l-02.png" +INTRO_L03 TEX "..\Graphics\intro-l-03.png" +INTRO_L04 TEX "..\Graphics\intro-l-04.png" +INTRO_L05 TEX "..\Graphics\intro-l-05.png" +INTRO_L06 TEX "..\Graphics\intro-l-06.png" +INTRO_L07 TEX "..\Graphics\intro-l-07.png" +INTRO_L08 TEX "..\Graphics\intro-l-08.png" +INTRO_L09 TEX "..\Graphics\intro-l-09.png" +OUTRO_BG TEX "..\Graphics\outro-bg.png" +OUTRO_ESC TEX "..\Graphics\outro-esc.png" +OUTRO_EXD TEX "..\Graphics\outro-exit-dark.png" \ No newline at end of file -- cgit v1.2.3 From cf1102dac69a569279ae05dd95426d9e1c544ffc Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sat, 22 Sep 2007 08:15:59 +0000 Subject: minor bug fixes to have lazarus build load resources into SDL_Image correctly... ( lazarus Resources are weak compared to delphi :( ) also Laz build will now run, and main loop works properly. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@429 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.pas | 780 +++++++++++++++++++------------------- Game/Code/Classes/UCommon.pas | 26 +- Game/Code/Classes/UGraphic.pas | 26 +- Game/Code/Classes/USkins.pas | 335 +++++++++-------- Game/Code/Classes/UTexture.pas | 250 ++++++++---- Game/Code/Menu/UMenu.pas | 18 +- Game/Code/UltraStar.lpr | 835 +++++++++++++++++++++-------------------- 7 files changed, 1224 insertions(+), 1046 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index 14f81a9b..e8d5e878 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -1,376 +1,404 @@ -unit TextGL; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - - -uses OpenGL12, - SDL, - UTexture, - Classes, - ULog; - -procedure BuildFont; // Build Our Bitmap Font -procedure KillFont; // Delete The Font -function glTextWidth(text: pchar): real; // Returns Text Width -procedure glPrintDone(text: pchar; Done: real; ColR, ColG, ColB: real); -procedure glPrintLetter(letter: char); -procedure glPrintLetterCut(letter: char; Start, Finish: real); -procedure glPrint(text: pchar); // Custom GL "Print" Routine -procedure glPrintCut(text: pchar); -procedure SetFontPos(X, Y: real); // Sets X And Y -procedure SetFontSize(Size: real); -procedure SetFontStyle(Style: integer); // sets active font style (normal, bold, etc) -procedure SetFontItalic(Enable: boolean); // sets italic type letter (works for all fonts) -procedure SetFontAspectW(Aspect: real); - -type - TTextGL = record - X: real; - Y: real; - Text: string; - Size: real; - ColR: real; - ColG: real; - ColB: real; - end; - - TFont = record - Tex: TTexture; - Width: array[0..255] of byte; - AspectW: real; - Centered: boolean; - Done: real; - Outline: real; - Italic: boolean; - end; - - -var - base: GLuint; // Base Display List For The Font Set - Fonts: array of TFont; - ActFont: integer; - PColR: real; // temps for glPrintDone - PColG: real; - PColB: real; - -implementation - -uses UMain, - {$IFDEF win32} - windows, - {$ELSE} - lclintf, - lcltype, - {$ENDIF} - SysUtils, - {$IFDEF FPC} - LResources, - {$ENDIF} - UGraphic; - -procedure BuildFont; // Build Our Bitmap Font - - procedure loadfont( aID : integer; aType, aResourceName : String); - var - Rejestr: TResourceStream; - begin - Rejestr := TResourceStream.Create(HInstance, aResourceName , pchar( aType ) ); - try - Rejestr.Read(Fonts[ aID ].Width, 256); - finally - Rejestr.Free; - end; - end; - -var - font: HFONT; // Windows Font ID - h_dc: hdc; - Pet: integer; -begin - ActFont := 0; - - SetLength(Fonts, 5); - Fonts[0].Tex := Texture.LoadTexture(true, 'Font', 'PNG', 'Font', 0); - Fonts[0].Tex.H := 30; - Fonts[0].AspectW := 0.9; - Fonts[0].Done := -1; - Fonts[0].Outline := 0; - - Fonts[1].Tex := Texture.LoadTexture(true, 'FontB', 'PNG', 'Font', 0); - Fonts[1].Tex.H := 30; - Fonts[1].AspectW := 1; - Fonts[1].Done := -1; - Fonts[1].Outline := 0; - - Fonts[2].Tex := Texture.LoadTexture(true, 'FontO', 'PNG', 'Font Outline', 0); - Fonts[2].Tex.H := 30; - Fonts[2].AspectW := 0.95; - Fonts[2].Done := -1; - Fonts[2].Outline := 5; - - Fonts[3].Tex := Texture.LoadTexture(true, 'FontO2', 'PNG', 'Font Outline 2', 0); - Fonts[3].Tex.H := 30; - Fonts[3].AspectW := 0.95; - Fonts[3].Done := -1; - Fonts[3].Outline := 4; - -{ Fonts[4].Tex := Texture.LoadTexture('FontO', 'BMP', 'Arrow', 0); // for score screen - Fonts[4].Tex.H := 30; - Fonts[4].AspectW := 0.95; - Fonts[4].Done := -1; - Fonts[4].Outline := 5;} - - - - loadfont( 0, 'FNT', 'Font' ); - loadfont( 1, 'FNT', 'FontB' ); - loadfont( 2, 'FNT', 'FontO' ); - loadfont( 3, 'FNT', 'FontO2' ); - -{ Rejestr := TResourceStream.Create(HInstance, 'FontO', 'FNT'); - Rejestr.Read(Fonts[4].Width, 256); - Rejestr.Free;} - - for Pet := 0 to 255 do - Fonts[1].Width[Pet] := Fonts[1].Width[Pet] div 2; - - for Pet := 0 to 255 do - Fonts[2].Width[Pet] := Fonts[2].Width[Pet] div 2 + 2; - - for Pet := 0 to 255 do - Fonts[3].Width[Pet] := Fonts[3].Width[Pet] + 1; - -{ for Pet := 0 to 255 do - Fonts[4].Width[Pet] := Fonts[4].Width[Pet] div 2 + 2;} - -end; - -procedure KillFont; // Delete The Font -begin -// glDeleteLists(base, 256); // Delete All 96 Characters -end; - -function glTextWidth(text: pchar): real; -var - Letter: char; -begin -// Log.LogStatus(Text, 'glTextWidth'); - Result := 0; - while (length(text) > 0) do begin - Letter := Text[0]; - text := pchar(Copy(text, 2, Length(text)-1)); - Result := Result + Fonts[ActFont].Width[Ord(Letter)] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; - end; // while -end; - -procedure glPrintDone(text: pchar; Done: real; ColR, ColG, ColB: real); -begin - Fonts[ActFont].Done := Done; - PColR := ColR; - PColG := ColG; - PColB := ColB; - glPrintCut(text); - Fonts[ActFont].Done := -1; -end; - -procedure glPrintLetter(Letter: char); -var - TexX, TexY: real; - TexR, TexB: real; - FWidth: real; - PL, PT: real; - PR, PB: real; - XItal: real; // X shift for italic type letter -begin - with Fonts[ActFont].Tex do begin - FWidth := Fonts[ActFont].Width[Ord(Letter)]; - - W := FWidth * (H/30) * Fonts[ActFont].AspectW; -// H := 30; - - // set texture positions - TexX := (ord(Letter) mod 16) * 1/16 + 1/32 - FWidth/1024 - Fonts[ActFont].Outline/1024; - TexY := (ord(Letter) div 16) * 1/16 + 2/1024; // 2/1024 - TexR := (ord(Letter) mod 16) * 1/16 + 1/32 + FWidth/1024 + Fonts[ActFont].Outline/1024; - TexB := (1 + ord(Letter) div 16) * 1/16 - 2/1024; - - // set vector positions - PL := X - Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW /2; - PT := Y; - PR := PL + W + Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW; - PB := PT + H; - if Fonts[ActFont].Italic = false then - XItal := 0 - else - XItal := 12; - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, TexNum); - glBegin(GL_QUADS); - glTexCoord2f(TexX, TexY); glVertex2f(PL+XItal, PT); - glTexCoord2f(TexX, TexB); glVertex2f(PL, PB); - glTexCoord2f(TexR, TexB); glVertex2f(PR, PB); - glTexCoord2f(TexR, TexY); glVertex2f(PR+XItal, PT); - glEnd; - X := X + W; - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - end; // with -end; - -procedure glPrintLetterCut(letter: char; Start, Finish: real); -var - TexX, TexY: real; - TexR, TexB: real; - TexTemp: real; - FWidth: real; - PL, PT: real; - PR, PB: real; - OutTemp: real; - XItal: real; -begin - with Fonts[ActFont].Tex do begin - FWidth := Fonts[ActFont].Width[Ord(Letter)]; - - W := FWidth * (H/30) * Fonts[ActFont].AspectW; -// H := 30; - OutTemp := Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW; - - // set texture positions - TexX := (ord(Letter) mod 16) * 1/16 + 1/32 - FWidth/1024 - Fonts[ActFont].Outline/1024; - TexY := (ord(Letter) div 16) * 1/16 + 2/1024; // 2/1024 - TexR := (ord(Letter) mod 16) * 1/16 + 1/32 + FWidth/1024 + Fonts[ActFont].Outline/1024; - TexB := (1 + ord(Letter) div 16) * 1/16 - 2/1024; - - TexTemp := TexX + Start * (TexR - TexX); - TexR := TexX + Finish * (TexR - TexX); - TexX := TexTemp; - - // set vector positions - PL := X - OutTemp / 2 + OutTemp * Start; - PT := Y; - PR := PL + (W + OutTemp) * (Finish - Start); - PB := PT + H; - if Fonts[ActFont].Italic = false then - XItal := 0 - else - XItal := 12; - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, TexNum); - glBegin(GL_QUADS); - glTexCoord2f(TexX, TexY); glVertex2f(PL+XItal, PT); - glTexCoord2f(TexX, TexB); glVertex2f(PL, PB); - glTexCoord2f(TexR, TexB); glVertex2f(PR, PB); - glTexCoord2f(TexR, TexY); glVertex2f(PR+XItal, PT); // not tested with XItal - glEnd; - X := X + W * (Finish - Start); - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - end; // with - -end; - -procedure glPrint(text: pchar); // Custom GL "Print" Routine -var - Letter: char; -begin - if (Text = '') then // If There's No Text - Exit; // Do Nothing - - while (length(text) > 0) do begin - // cut - Letter := Text[0]; - Text := pchar(Copy(Text, 2, Length(Text)-1)); - - // print - glPrintLetter(Letter); - end; // while -end; - -procedure glPrintCut(text: pchar); -var - Letter: char; - PToDo: real; - PTotWidth: real; - PDoingNow: real; - S: string; -begin - if (Text = '') then // If There's No Text - Exit; // Do Nothing - - PTotWidth := glTextWidth(Text); - PToDo := Fonts[ActFont].Done; - - while (length(text) > 0) do begin - // cut - Letter := Text[0]; - Text := pchar(Copy(Text, 2, Length(Text)-1)); - - // analyze - S := Letter; - PDoingNow := glTextWidth(pchar(S)) / PTotWidth; - - // drawing - if (PToDo > 0) and (PDoingNow <= PToDo) then - glPrintLetter(Letter); - - if (PToDo > 0) and (PDoingNow > PToDo) then begin - glPrintLetterCut(Letter, 0, PToDo / PDoingNow); - glColor3f(PColR, PColG, PColB); - glPrintLetterCut(Letter, PToDo / PDoingNow, 1); - end; - - if (PToDo <= 0) then - glPrintLetter(Letter); - - PToDo := PToDo - PDoingNow; - - end; // while -end; - - -procedure SetFontPos(X, Y: real); -begin - Fonts[ActFont].Tex.X := X; - Fonts[ActFont].Tex.Y := Y; -end; - -procedure SetFontSize(Size: real); -begin - Fonts[ActFont].Tex.H := 30 * (Size/10); -end; - -procedure SetFontStyle(Style: integer); -begin - ActFont := Style; -end; - -procedure SetFontItalic(Enable: boolean); -begin - Fonts[ActFont].Italic := Enable; -end; - -procedure SetFontAspectW(Aspect: real); -begin - Fonts[ActFont].AspectW := Aspect; -end; - -{$IFDEF FPC} -{$IFDEF win32} -initialization - {$I UltraStar.lrs} -{$ENDIF} -{$ENDIF} - -end. - - +unit TextGL; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + + +uses OpenGL12, + SDL, + UTexture, + Classes, + ULog; + +procedure BuildFont; // Build Our Bitmap Font +procedure KillFont; // Delete The Font +function glTextWidth(text: pchar): real; // Returns Text Width +procedure glPrintDone(text: pchar; Done: real; ColR, ColG, ColB: real); +procedure glPrintLetter(letter: char); +procedure glPrintLetterCut(letter: char; Start, Finish: real); +procedure glPrint(text: pchar); // Custom GL "Print" Routine +procedure glPrintCut(text: pchar); +procedure SetFontPos(X, Y: real); // Sets X And Y +procedure SetFontSize(Size: real); +procedure SetFontStyle(Style: integer); // sets active font style (normal, bold, etc) +procedure SetFontItalic(Enable: boolean); // sets italic type letter (works for all fonts) +procedure SetFontAspectW(Aspect: real); + +type + TTextGL = record + X: real; + Y: real; + Text: string; + Size: real; + ColR: real; + ColG: real; + ColB: real; + end; + + TFont = record + Tex: TTexture; + Width: array[0..255] of byte; + AspectW: real; + Centered: boolean; + Done: real; + Outline: real; + Italic: boolean; + end; + + +var + base: GLuint; // Base Display List For The Font Set + Fonts: array of TFont; + ActFont: integer; + PColR: real; // temps for glPrintDone + PColG: real; + PColB: real; + +implementation + +uses UMain, + UCommon, + {$IFDEF win32} + windows, + {$ELSE} + lclintf, + lcltype, + {$ENDIF} + SysUtils, + {$IFDEF FPC} + LResources, + {$ENDIF} + UGraphic; + +procedure BuildFont; // Build Our Bitmap Font + + procedure loadfont( aID : integer; aType, aResourceName : String); + {$IFDEF FPC} + var + lLazRes : TLResource; + lResData : TStringStream; + begin + try + lLazRes := LazFindResource( aResourceName, aType ); + if lLazRes <> nil then + begin + lResData := TStringStream.create( lLazRes.value ); + try + lResData.position := 0; + lResData.Read(Fonts[ aID ].Width, 256); + finally + freeandnil( lResData ); + end; + end; + + {$ELSE} + var + Rejestr: TResourceStream; + begin + try + Rejestr := TResourceStream.Create(HInstance, aResourceName , pchar( aType ) ); + try + Rejestr.Read(Fonts[ aID ].Width, 256); + finally + Rejestr.Free; + end; + {$ENDIF} + + except + Log.LogStatus( 'Could not load font : loadfont( '+ inttostr( aID ) +' , '+aType+' )' , 'ERROR'); + end; + end; + +var + font: HFONT; // Windows Font ID + h_dc: hdc; + Pet: integer; +begin + ActFont := 0; + + SetLength(Fonts, 5); + Fonts[0].Tex := Texture.LoadTexture(true, 'Font', 'PNG', 'Font', 0); + Fonts[0].Tex.H := 30; + Fonts[0].AspectW := 0.9; + Fonts[0].Done := -1; + Fonts[0].Outline := 0; + + Fonts[1].Tex := Texture.LoadTexture(true, 'FontB', 'PNG', 'Font', 0); + Fonts[1].Tex.H := 30; + Fonts[1].AspectW := 1; + Fonts[1].Done := -1; + Fonts[1].Outline := 0; + + Fonts[2].Tex := Texture.LoadTexture(true, 'FontO', 'PNG', 'Font Outline', 0); + Fonts[2].Tex.H := 30; + Fonts[2].AspectW := 0.95; + Fonts[2].Done := -1; + Fonts[2].Outline := 5; + + Fonts[3].Tex := Texture.LoadTexture(true, 'FontO2', 'PNG', 'Font Outline 2', 0); + Fonts[3].Tex.H := 30; + Fonts[3].AspectW := 0.95; + Fonts[3].Done := -1; + Fonts[3].Outline := 4; + +{ Fonts[4].Tex := Texture.LoadTexture('FontO', 'BMP', 'Arrow', 0); // for score screen + Fonts[4].Tex.H := 30; + Fonts[4].AspectW := 0.95; + Fonts[4].Done := -1; + Fonts[4].Outline := 5;} + + + + loadfont( 0, 'FNT', 'Font' ); + loadfont( 1, 'FNT', 'FontB' ); + loadfont( 2, 'FNT', 'FontO' ); + loadfont( 3, 'FNT', 'FontO2' ); + +{ Rejestr := TResourceStream.Create(HInstance, 'FontO', 'FNT'); + Rejestr.Read(Fonts[4].Width, 256); + Rejestr.Free;} + + for Pet := 0 to 255 do + Fonts[1].Width[Pet] := Fonts[1].Width[Pet] div 2; + + for Pet := 0 to 255 do + Fonts[2].Width[Pet] := Fonts[2].Width[Pet] div 2 + 2; + + for Pet := 0 to 255 do + Fonts[3].Width[Pet] := Fonts[3].Width[Pet] + 1; + +{ for Pet := 0 to 255 do + Fonts[4].Width[Pet] := Fonts[4].Width[Pet] div 2 + 2;} + +end; + +procedure KillFont; // Delete The Font +begin +// glDeleteLists(base, 256); // Delete All 96 Characters +end; + +function glTextWidth(text: pchar): real; +var + Letter: char; +begin +// Log.LogStatus(Text, 'glTextWidth'); + Result := 0; + while (length(text) > 0) do begin + Letter := Text[0]; + text := pchar(Copy(text, 2, Length(text)-1)); + Result := Result + Fonts[ActFont].Width[Ord(Letter)] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + end; // while +end; + +procedure glPrintDone(text: pchar; Done: real; ColR, ColG, ColB: real); +begin + Fonts[ActFont].Done := Done; + PColR := ColR; + PColG := ColG; + PColB := ColB; + glPrintCut(text); + Fonts[ActFont].Done := -1; +end; + +procedure glPrintLetter(Letter: char); +var + TexX, TexY: real; + TexR, TexB: real; + FWidth: real; + PL, PT: real; + PR, PB: real; + XItal: real; // X shift for italic type letter +begin + with Fonts[ActFont].Tex do begin + FWidth := Fonts[ActFont].Width[Ord(Letter)]; + + W := FWidth * (H/30) * Fonts[ActFont].AspectW; +// H := 30; + + // set texture positions + TexX := (ord(Letter) mod 16) * 1/16 + 1/32 - FWidth/1024 - Fonts[ActFont].Outline/1024; + TexY := (ord(Letter) div 16) * 1/16 + 2/1024; // 2/1024 + TexR := (ord(Letter) mod 16) * 1/16 + 1/32 + FWidth/1024 + Fonts[ActFont].Outline/1024; + TexB := (1 + ord(Letter) div 16) * 1/16 - 2/1024; + + // set vector positions + PL := X - Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW /2; + PT := Y; + PR := PL + W + Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW; + PB := PT + H; + if Fonts[ActFont].Italic = false then + XItal := 0 + else + XItal := 12; + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, TexNum); + glBegin(GL_QUADS); + glTexCoord2f(TexX, TexY); glVertex2f(PL+XItal, PT); + glTexCoord2f(TexX, TexB); glVertex2f(PL, PB); + glTexCoord2f(TexR, TexB); glVertex2f(PR, PB); + glTexCoord2f(TexR, TexY); glVertex2f(PR+XItal, PT); + glEnd; + X := X + W; + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + end; // with +end; + +procedure glPrintLetterCut(letter: char; Start, Finish: real); +var + TexX, TexY: real; + TexR, TexB: real; + TexTemp: real; + FWidth: real; + PL, PT: real; + PR, PB: real; + OutTemp: real; + XItal: real; +begin + with Fonts[ActFont].Tex do begin + FWidth := Fonts[ActFont].Width[Ord(Letter)]; + + W := FWidth * (H/30) * Fonts[ActFont].AspectW; +// H := 30; + OutTemp := Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW; + + // set texture positions + TexX := (ord(Letter) mod 16) * 1/16 + 1/32 - FWidth/1024 - Fonts[ActFont].Outline/1024; + TexY := (ord(Letter) div 16) * 1/16 + 2/1024; // 2/1024 + TexR := (ord(Letter) mod 16) * 1/16 + 1/32 + FWidth/1024 + Fonts[ActFont].Outline/1024; + TexB := (1 + ord(Letter) div 16) * 1/16 - 2/1024; + + TexTemp := TexX + Start * (TexR - TexX); + TexR := TexX + Finish * (TexR - TexX); + TexX := TexTemp; + + // set vector positions + PL := X - OutTemp / 2 + OutTemp * Start; + PT := Y; + PR := PL + (W + OutTemp) * (Finish - Start); + PB := PT + H; + if Fonts[ActFont].Italic = false then + XItal := 0 + else + XItal := 12; + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, TexNum); + glBegin(GL_QUADS); + glTexCoord2f(TexX, TexY); glVertex2f(PL+XItal, PT); + glTexCoord2f(TexX, TexB); glVertex2f(PL, PB); + glTexCoord2f(TexR, TexB); glVertex2f(PR, PB); + glTexCoord2f(TexR, TexY); glVertex2f(PR+XItal, PT); // not tested with XItal + glEnd; + X := X + W * (Finish - Start); + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + end; // with + +end; + +procedure glPrint(text: pchar); // Custom GL "Print" Routine +var + Letter: char; +begin + if (Text = '') then // If There's No Text + Exit; // Do Nothing + + while (length(text) > 0) do begin + // cut + Letter := Text[0]; + Text := pchar(Copy(Text, 2, Length(Text)-1)); + + // print + glPrintLetter(Letter); + end; // while +end; + +procedure glPrintCut(text: pchar); +var + Letter: char; + PToDo: real; + PTotWidth: real; + PDoingNow: real; + S: string; +begin + if (Text = '') then // If There's No Text + Exit; // Do Nothing + + PTotWidth := glTextWidth(Text); + PToDo := Fonts[ActFont].Done; + + while (length(text) > 0) do begin + // cut + Letter := Text[0]; + Text := pchar(Copy(Text, 2, Length(Text)-1)); + + // analyze + S := Letter; + PDoingNow := glTextWidth(pchar(S)) / PTotWidth; + + // drawing + if (PToDo > 0) and (PDoingNow <= PToDo) then + glPrintLetter(Letter); + + if (PToDo > 0) and (PDoingNow > PToDo) then begin + glPrintLetterCut(Letter, 0, PToDo / PDoingNow); + glColor3f(PColR, PColG, PColB); + glPrintLetterCut(Letter, PToDo / PDoingNow, 1); + end; + + if (PToDo <= 0) then + glPrintLetter(Letter); + + PToDo := PToDo - PDoingNow; + + end; // while +end; + + +procedure SetFontPos(X, Y: real); +begin + Fonts[ActFont].Tex.X := X; + Fonts[ActFont].Tex.Y := Y; +end; + +procedure SetFontSize(Size: real); +begin + Fonts[ActFont].Tex.H := 30 * (Size/10); +end; + +procedure SetFontStyle(Style: integer); +begin + ActFont := Style; +end; + +procedure SetFontItalic(Enable: boolean); +begin + Fonts[ActFont].Italic := Enable; +end; + +procedure SetFontAspectW(Aspect: real); +begin + Fonts[ActFont].AspectW := Aspect; +end; + + +{$IFDEF FPC} +{$IFDEF win32} +initialization + {$I UltraStar.lrs} +{$ENDIF} +{$ENDIF} + + +end. + + diff --git a/Game/Code/Classes/UCommon.pas b/Game/Code/Classes/UCommon.pas index b572a768..8089f28c 100644 --- a/Game/Code/Classes/UCommon.pas +++ b/Game/Code/Classes/UCommon.pas @@ -7,7 +7,10 @@ interface {$ENDIF} uses - +{$IFDEF FPC} + lResources, +{$ENDIF} + ULog, {$IFDEF win32} windows; {$ELSE} @@ -28,7 +31,9 @@ type type TWndMethod = procedure(var Message: TMessage) of object; -function RandomRange(aMin: Integer; aMax: Integer) : Integer; +function LazFindResource( const aName, aType : String ): TLResource; + +function RandomRange(aMin: Integer; aMax: Integer) : Integer; function MaxValue(const Data: array of Double): Double; function MinValue(const Data: array of Double): Double; @@ -82,6 +87,23 @@ end; {$IFDEF FPC} +function LazFindResource( const aName, aType : String ): TLResource; +var + iCount : Integer; +begin + result := nil; + + for iCount := 0 to LazarusResources.count -1 do + begin + if ( LazarusResources.items[ iCount ].Name = aName ) AND + ( LazarusResources.items[ iCount ].ValueType = aType ) THEN + begin + result := LazarusResources.items[ iCount ]; + exit; + end; + end; +end; + function MaxValue(const Data: array of Double): Double; var I: Integer; diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 3f251be2..f350d0d2 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -266,6 +266,8 @@ begin Tex_Mid[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'BMP', 'Plain', 0); //brauch man die noch? Tex_Right[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'BMP', 'Transparent', 0); //brauch man die noch? + Log.LogStatus('Loading Textures - A', 'LoadTextures'); + // P1-6 // TODO... do it once for each player... this is a bit crappy !! // can we make it any better !? @@ -287,6 +289,8 @@ begin Tex_BG_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGRight')), 'PNG', 'Colorized', Col); end; + Log.LogStatus('Loading Textures - B', 'LoadTextures'); + Tex_Note_Perfect_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePerfectStar')), 'JPG', 'Font Black', 0); Tex_Note_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteStar')) , 'JPG', 'Alpha Black Colored', $FFFFFF); Tex_Ball := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'BMP', 'Transparent', $FF00FF); @@ -303,17 +307,27 @@ begin Tex_SingBar_Front := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarFront')), 'JPG', 'Font', 0); //end Singbar Mod + Log.LogStatus('Loading Textures - C', 'LoadTextures'); + + {$IFNDEF FPC} + // TODO : jb_FPC why does this cause lazarus build, to have runtime error.. + // TODO : jb_FPC - START HERE !! //Line Bonus PopUp for P := 0 to 8 do begin Tex_SingLineBonusBack[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LineBonusBack')), 'PNG', 'Colorized', $FFFFFF); end; + {$ENDIF} + + {//Set Texture to Font High Tex_SingLineBonusL.H := 32; Tex_SingLineBonusL.W := 8; Tex_SingLineBonusM.H := 32; //Tex_SingLineBonusM.TexW := Tex_SingLineBonusM.TexW/2; Tex_SingLineBonusR.H := 32; Tex_SingLineBonusR.W := 8; } //PhrasenBonus - Line Bonus Mod End + Log.LogStatus('Loading Textures - D', 'LoadTextures'); + // tworzenie czcionek // Log.LogStatus('Building Fonts', 'LoadTextures'); // BuildFont; @@ -327,15 +341,15 @@ var Pixel: PByteArray; I: Integer; begin - Log.LogStatus('LoadOpenGL', 'Initialize3D'); + Log.LogStatus('LoadOpenGL', 'UGraphic.Initialize3D'); // Log.BenchmarkStart(2); LoadOpenGL; - Log.LogStatus('SDL_Init', 'Initialize3D'); + Log.LogStatus('SDL_Init', 'UGraphic.Initialize3D'); if ( SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO)= -1 ) then begin - Log.LogError('SDL_Init Failed', 'Initialize3D'); + Log.LogError('SDL_Init Failed', 'UGraphic.Initialize3D'); exit; end; @@ -390,15 +404,16 @@ begin // Log.LogStatus('Loading Screens', 'Initialize3D'); // Log.BenchmarkStart(3); + Log.LogStatus('Loading Font Textures', 'UGraphic.Initialize3D'); LoadFontTextures(); // Show the Loading Screen ------------- + Log.LogStatus('Loading Loading Screen', 'UGraphic.Initialize3D'); LoadLoadingScreen; - Log.LogStatus('Loading Screens', 'Initialize3D'); + Log.LogStatus(' Loading Textures', 'UGraphic.Initialize3D'); LoadTextures; // jb - Log.LogStatus(' Loading Textures', ''); @@ -412,6 +427,7 @@ begin //LoadingThread := SDL_CreateThread(@LoadingThread, nil); // das hier würde dann im ladethread ausgeführt + Log.LogStatus(' Loading Screens', 'UGraphic.Initialize3D'); LoadScreens; diff --git a/Game/Code/Classes/USkins.pas b/Game/Code/Classes/USkins.pas index a825050f..7fdbacde 100644 --- a/Game/Code/Classes/USkins.pas +++ b/Game/Code/Classes/USkins.pas @@ -1,164 +1,171 @@ -unit USkins; - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - -interface - -type - TSkinTexture = record - Name: string; - FileName: string; - end; - - TSkinEntry = record - Theme: string; - Name: string; - Path: string; - FileName: string; - Creator: string; // not used yet - end; - - TSkin = class - Skin: array of TSkinEntry; - SkinTexture: array of TSkinTexture; - SkinPath: string; - Color: integer; - constructor Create; - procedure LoadList; - procedure ParseDir(Dir: string); - procedure LoadHeader(FileName: string); - procedure LoadSkin(Name: string); - function GetTextureFileName(TextureName: string): string; - function GetSkinNumber(Name: string): integer; - procedure onThemeChange; - end; - -var - Skin: TSkin; - -implementation - -uses IniFiles, Classes, SysUtils, ULog, UIni; - -constructor TSkin.Create; -begin - LoadList; -// LoadSkin('Lisek'); -// SkinColor := Color; -end; - -procedure TSkin.LoadList; -var - SR: TSearchRec; -// SR2: TSearchRec; -// SLen: integer; -begin - if FindFirst('Skins'+PathDelim+'*', faDirectory, SR) = 0 then begin - repeat - if (SR.Name <> '.') and (SR.Name <> '..') then - ParseDir('Skins'+PathDelim + SR.Name + PathDelim); - until FindNext(SR) <> 0; - end; // if - FindClose(SR); -end; - -procedure TSkin.ParseDir(Dir: string); -var - SR: TSearchRec; -// SLen: integer; -begin - if FindFirst(Dir + '*.ini', faAnyFile, SR) = 0 then begin - repeat - if (SR.Name <> '.') and (SR.Name <> '..') then - LoadHeader(Dir + SR.Name); - //Log.LogError(SR.Name); - until FindNext(SR) <> 0; - end; -end; - -procedure TSkin.LoadHeader(FileName: string); -var - SkinIni: TMemIniFile; - S: integer; -begin - SkinIni := TMemIniFile.Create(FileName); - - S := Length(Skin); - SetLength(Skin, S+1); - Skin[S].Path := IncludeTrailingBackslash(ExtractFileDir(FileName)); - Skin[S].FileName := ExtractFileName(FileName); - Skin[S].Theme := SkinIni.ReadString('Skin', 'Theme', ''); - Skin[S].Name := SkinIni.ReadString('Skin', 'Name', ''); - Skin[S].Creator := SkinIni.ReadString('Skin', 'Creator', ''); - - SkinIni.Free; -end; - -procedure TSkin.LoadSkin(Name: string); -var - SkinIni: TMemIniFile; - SL: TStringList; - T: integer; - S: integer; -begin - S := GetSkinNumber(Name); - SkinPath := Skin[S].Path; - - SkinIni := TMemIniFile.Create(SkinPath + Skin[S].FileName); - - SL := TStringList.Create; - SkinIni.ReadSection('Textures', SL); - - SetLength(SkinTexture, SL.Count); - for T := 0 to SL.Count-1 do begin - SkinTexture[T].Name := SL.Strings[T]; - SkinTexture[T].FileName := SkinIni.ReadString('Textures', SL.Strings[T], ''); - end; - - SL.Free; - SkinIni.Free; -end; - -function TSkin.GetTextureFileName(TextureName: string): string; -var - T: integer; -begin - Result := ''; - for T := 0 to High(SkinTexture) do - if SkinTexture[T].Name = TextureName then Result := SkinPath + SkinTexture[T].FileName; - -{ Result := SkinPath + 'Bar.jpg'; - if TextureName = 'Ball' then Result := SkinPath + 'Ball.bmp'; - if Copy(TextureName, 1, 4) = 'Gray' then Result := SkinPath + 'Ball.bmp'; - if Copy(TextureName, 1, 6) = 'NoteBG' then Result := SkinPath + 'Ball.bmp';} -end; - -function TSkin.GetSkinNumber(Name: string): integer; -var - S: integer; -begin - Result := 0; // set default to the first available skin - for S := 0 to High(Skin) do - if Skin[S].Name = Name then Result := S; -end; - -procedure TSkin.onThemeChange; -var - S: integer; - Name: String; -begin - Ini.SkinNo:=0; - SetLength(ISkin, 0); - Name := Uppercase(ITheme[Ini.Theme]); - for S := 0 to High(Skin) do - if Name = Uppercase(Skin[S].Theme) then begin - SetLength(ISkin, Length(ISkin)+1); - ISkin[High(ISkin)] := Skin[S].Name; - end; - -end; - -end. +unit USkins; + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +interface + +type + TSkinTexture = record + Name: string; + FileName: string; + end; + + TSkinEntry = record + Theme: string; + Name: string; + Path: string; + FileName: string; + Creator: string; // not used yet + end; + + TSkin = class + Skin: array of TSkinEntry; + SkinTexture: array of TSkinTexture; + SkinPath: string; + Color: integer; + constructor Create; + procedure LoadList; + procedure ParseDir(Dir: string); + procedure LoadHeader(FileName: string); + procedure LoadSkin(Name: string); + function GetTextureFileName(TextureName: string): string; + function GetSkinNumber(Name: string): integer; + procedure onThemeChange; + end; + +var + Skin: TSkin; + +implementation + +uses IniFiles, Classes, SysUtils, ULog, UIni; + +constructor TSkin.Create; +begin + LoadList; +// LoadSkin('Lisek'); +// SkinColor := Color; +end; + +procedure TSkin.LoadList; +var + SR: TSearchRec; +// SR2: TSearchRec; +// SLen: integer; +begin + if FindFirst('Skins'+PathDelim+'*', faDirectory, SR) = 0 then begin + repeat + if (SR.Name <> '.') and (SR.Name <> '..') then + ParseDir('Skins'+PathDelim + SR.Name + PathDelim); + until FindNext(SR) <> 0; + end; // if + FindClose(SR); +end; + +procedure TSkin.ParseDir(Dir: string); +var + SR: TSearchRec; +// SLen: integer; +begin + if FindFirst(Dir + '*.ini', faAnyFile, SR) = 0 then begin + repeat + if (SR.Name <> '.') and (SR.Name <> '..') then + LoadHeader(Dir + SR.Name); + //Log.LogError(SR.Name); + until FindNext(SR) <> 0; + end; +end; + +procedure TSkin.LoadHeader(FileName: string); +var + SkinIni: TMemIniFile; + S: integer; +begin + SkinIni := TMemIniFile.Create(FileName); + + S := Length(Skin); + SetLength(Skin, S+1); + Skin[S].Path := IncludeTrailingBackslash(ExtractFileDir(FileName)); + Skin[S].FileName := ExtractFileName(FileName); + Skin[S].Theme := SkinIni.ReadString('Skin', 'Theme', ''); + Skin[S].Name := SkinIni.ReadString('Skin', 'Name', ''); + Skin[S].Creator := SkinIni.ReadString('Skin', 'Creator', ''); + + SkinIni.Free; +end; + +procedure TSkin.LoadSkin(Name: string); +var + SkinIni: TMemIniFile; + SL: TStringList; + T: integer; + S: integer; +begin + S := GetSkinNumber(Name); + SkinPath := Skin[S].Path; + + SkinIni := TMemIniFile.Create(SkinPath + Skin[S].FileName); + + SL := TStringList.Create; + SkinIni.ReadSection('Textures', SL); + + SetLength(SkinTexture, SL.Count); + for T := 0 to SL.Count-1 do begin + SkinTexture[T].Name := SL.Strings[T]; + SkinTexture[T].FileName := SkinIni.ReadString('Textures', SL.Strings[T], ''); + end; + + SL.Free; + SkinIni.Free; +end; + +function TSkin.GetTextureFileName(TextureName: string): string; +var + T: integer; +begin + Result := ''; + + for T := 0 to High(SkinTexture) do + begin + if ( SkinTexture[T].Name = TextureName ) AND + ( SkinTexture[T].FileName <> '' ) then + begin + Result := SkinPath + SkinTexture[T].FileName; + end; + end; + +{ Result := SkinPath + 'Bar.jpg'; + if TextureName = 'Ball' then Result := SkinPath + 'Ball.bmp'; + if Copy(TextureName, 1, 4) = 'Gray' then Result := SkinPath + 'Ball.bmp'; + if Copy(TextureName, 1, 6) = 'NoteBG' then Result := SkinPath + 'Ball.bmp';} +end; + +function TSkin.GetSkinNumber(Name: string): integer; +var + S: integer; +begin + Result := 0; // set default to the first available skin + for S := 0 to High(Skin) do + if Skin[S].Name = Name then Result := S; +end; + +procedure TSkin.onThemeChange; +var + S: integer; + Name: String; +begin + Ini.SkinNo:=0; + SetLength(ISkin, 0); + Name := Uppercase(ITheme[Ini.Theme]); + for S := 0 to High(Skin) do + if Name = Uppercase(Skin[S].Theme) then begin + SetLength(ISkin, Length(ISkin)+1); + ISkin[High(ISkin)] := Skin[S].Name; + end; + +end; + +end. diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 78a2573f..3d746813 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -136,58 +136,65 @@ var implementation -uses ULog, DateUtils, UCovers, StrUtils; + +uses ULog, + DateUtils, + UCovers, + {$IFDEF FPC} + LResources, + {$ENDIF} + StrUtils; const fmt_rgba: TSDL_Pixelformat=(palette: nil; - BitsPerPixel: 32; - BytesPerPixel: 4; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 24; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $ff000000; - ColorKey: 0; - Alpha: 255); - fmt_rgb: TSDL_Pixelformat=( palette: nil; - BitsPerPixel: 24; - BytesPerPixel: 3; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 0; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $00000000; - ColorKey: 0; - Alpha: 255); + BitsPerPixel: 32; + BytesPerPixel: 4; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 24; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $ff000000; + ColorKey: 0; + Alpha: 255); + fmt_rgb: TSDL_Pixelformat=( palette: nil; + BitsPerPixel: 24; + BytesPerPixel: 3; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 0; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $00000000; + ColorKey: 0; + Alpha: 255); function TTextureUnit.pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; -begin - if (fmt1^.BitsPerPixel = fmt2^.BitsPerPixel) and - (fmt1^.BytesPerPixel = fmt2^.BytesPerPixel) and - (fmt1^.Rloss = fmt2^.Rloss) and (fmt1^.Gloss = fmt2^.Gloss) and - (fmt1^.Bloss = fmt2^.Bloss) and (fmt1^.Rmask = fmt2^.Rmask) and - (fmt1^.Gmask = fmt2^.Gmask) and (fmt1^.Bmask = fmt2^.Bmask) and - (fmt1^.Rshift = fmt2^.Rshift) and (fmt1^.Gshift = fmt2^.Gshift) and - (fmt1^.Bshift = fmt2^.Bshift) - then - Result:=True - else - Result:=False; +begin + if (fmt1^.BitsPerPixel = fmt2^.BitsPerPixel) and + (fmt1^.BytesPerPixel = fmt2^.BytesPerPixel) and + (fmt1^.Rloss = fmt2^.Rloss) and (fmt1^.Gloss = fmt2^.Gloss) and + (fmt1^.Bloss = fmt2^.Bloss) and (fmt1^.Rmask = fmt2^.Rmask) and + (fmt1^.Gmask = fmt2^.Gmask) and (fmt1^.Bmask = fmt2^.Bmask) and + (fmt1^.Rshift = fmt2^.Rshift) and (fmt1^.Gshift = fmt2^.Gshift) and + (fmt1^.Bshift = fmt2^.Bshift) + then + Result:=True + else + Result:=False; end; // +++++++++++++++++++++ helpers for loadimage +++++++++++++++ @@ -235,50 +242,119 @@ end; function TTextureUnit.LoadImage(Identifier: PChar): PSDL_Surface; var - TexStream: TStream; + TexRWops: PSDL_RWops; dHandle: THandle; + {$IFDEF FPC} + lLazRes : TLResource; + lResData : TStringStream; + {$ELSE} + TexStream: TStream; + {$ENDIF} + begin - Result:=nil; - TexRWops:=nil; - Log.LogStatus( ' start' , Identifier); + Result := nil; + TexRWops := nil; + +// Log.LogStatus( Identifier, 'LoadImage' ); + if ( FileExists(Identifier) ) then begin - Log.LogStatus( ' found file' , ' '+ Identifier); // load from file - Result:=IMG_Load(Identifier); - end - else - begin - Log.LogStatus( ' trying resource' , ' '+ Identifier); - // load from resource stream - dHandle:=FindResource(hInstance,Identifier,'TEX'); - if dHandle=0 then begin - Log.LogStatus( 'ERROR Could not find resource' , Identifier); - beep; - Exit; - end; - +// Log.LogStatus( 'Is File', ' LoadImage' ); try - TexStream := TResourceStream.Create(HInstance, Identifier, 'TEX'); - TexRWops:=SDL_AllocRW; - TexRWops.unknown:=TUnknown(TexStream); - TexRWops.seek:=SDLStreamSeek; - TexRWops.read:=SDLStreamRead; - TexRWops.write:=nil; - TexRWops.close:=SDLStreamClose; - TexRWops.type_:=2; + Result:=IMG_Load(Identifier); except - Log.LogStatus( 'ERROR Could not load from resource' , Identifier); + Log.LogStatus( 'ERROR Could not load from file' , Identifier); beep; Exit; end; - Result:=IMG_Load_RW(TexRWops,0); - SDL_FreeRW(TexRWops); - TexStream.Free; + end + else + begin +// Log.LogStatus( 'NOT File', ' LoadImage' ); + + // load from resource stream + {$IFNDEF FPC} + dHandle := FindResource(hInstance, Identifier, 'TEX'); + if dHandle=0 then + begin + Log.LogStatus( 'ERROR Could not find resource' , ' '+ Identifier); + beep; + Exit; + end; + + + TexStream := nil; + try + TexStream := TResourceStream.Create(HInstance, Identifier, 'TEX'); + except + Log.LogStatus( 'ERROR Could not load from resource' , Identifier); + beep; + Exit; + end; + + try + try + TexRWops := SDL_AllocRW; + TexRWops.unknown := TUnknown(TexStream); + TexRWops.seek := SDLStreamSeek; + TexRWops.read := SDLStreamRead; + TexRWops.write := nil; + TexRWops.close := SDLStreamClose; + TexRWops.type_ := 2; + except + Log.LogStatus( 'ERROR Could not assign resource' , Identifier); + beep; + Exit; + end; + + Result:=IMG_Load_RW(TexRWops,0); + SDL_FreeRW(TexRWops); + + finally + if assigned( TexStream ) then + freeandnil( TexStream ); + end; + + + {$ELSE} + lLazRes := LazFindResource( Identifier, 'TEX' ); + if lLazRes <> nil then + begin + lResData := TStringStream.create( lLazRes.value ); + try + lResData.position := 0; + try + TexRWops := SDL_AllocRW; + TexRWops.unknown := TUnknown( lResData ); + TexRWops.seek := SDLStreamSeek; + TexRWops.read := SDLStreamRead; + TexRWops.write := nil; + TexRWops.close := SDLStreamClose; + TexRWops.type_ := 2; + except + Log.LogStatus( 'ERROR Could not assign resource' , Identifier); + beep; + Exit; + end; + + Result:=IMG_Load_RW(TexRWops,0); + SDL_FreeRW(TexRWops); + + finally + freeandnil( lResData ); + end; + end + else + begin + Log.LogStatus( 'NOT found in Resource', ' LoadImage' ); + end; + {$ENDIF} + + end; - Log.LogStatus( ' DONE' , '---'+ Identifier); end; procedure TTextureUnit.AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); @@ -417,13 +493,19 @@ begin Log.BenchmarkStart(4); Mipmapping := true; + + +(* + Log.LogStatus( '', '' ); + if Identifier = nil then Log.LogStatus(' ERROR unknown Identifier', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+'''') else Log.LogStatus(' should be ok - trying to load', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+''''); +*) // load texture data into memory - TexSurface:=LoadImage(Identifier); + TexSurface := LoadImage(Identifier); if not assigned(TexSurface) then begin Log.LogStatus( 'ERROR Could not load texture' , Identifier +' '+ Format +' '+ Typ ); @@ -797,6 +879,10 @@ var C: integer; // cover Data: array of byte; begin + + if Name = '' then + exit; + // find texture entry T := FindTexture(Name); @@ -939,4 +1025,12 @@ begin end; end; +{$IFDEF FPC} +{$IFDEF win32} +initialization + {$I UltraStar.lrs} +{$ENDIF} +{$ENDIF} + + end. diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index ccce325e..16bc4ab2 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -287,15 +287,23 @@ begin end; procedure TMenu.AddBackground(Name: string); +var + lFileName : string; begin if Name <> '' then begin // BackImg := Texture.LoadTexture(false, PChar(Skin.SkinPath + FileName), 'JPG', 'Plain', 0); // new theme system - BackImg := Texture.GetTexture(Skin.GetTextureFileName(Name), 'Plain'); - BackImg.W := 800; - BackImg.H := 600; - BackW := 1; - BackH := 1; + lFileName := Skin.GetTextureFileName(Name); + + if lFileName <> '' then + begin + BackImg := Texture.GetTexture( lFileName , 'Plain'); + + BackImg.W := 800; + BackImg.H := 600; + BackW := 1; + BackH := 1; + end; end; end; diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index 67d4d9da..802fb4e5 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -1,416 +1,419 @@ -program UltraStar; - -{$DEFINE TRANSLATE} - -{$IFDEF FPC} - {$MODE DELPHI} -{$ELSE} - {$R 'UltraStar.res' 'UltraStar.rc'} -{$ENDIF} - -{$I switches.inc} - -uses - - // *************************************************************************** - // - // Developers PLEASE NOTE !!!!!!! - // - // As of september 2007, I am working towards porting Ultrastar-DX to run - // on Linux. I will be modifiying the source to make it compile in lazarus - // on windows & linux and I will make sure that it compiles in delphi still - // To help me in this endevour, please can you make a point of remembering - // that linux is CASE SENSATIVE, and file / unit names must be as per - // the filename exactly. - // - // EG : opengl12.pas must not be OpenGL in the uses cluase. - // - // thanks for your help... - // - // *************************************************************************** - - //------------------------------ - //Includes - 3rd Party Libraries - //------------------------------ - - // SDL / OpenGL - moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', - opengl12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\opengl12.pas', - sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', - sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', - - // Bass - {$IFDEF UseBASS} - bass in 'lib\bass\delphi\bass.pas', - {$ENDIF} - - // Midi Units - {$IFDEF UseMIDIPort} - Circbuf in 'lib\midi\CIRCBUF.PAS', - Delphmcb in 'lib\midi\Delphmcb.PAS', - MidiCons in 'lib\midi\MidiCons.PAS', - MidiDefs in 'lib\midi\MidiDefs.PAS', - MidiFile in 'lib\midi\MidiFile.PAS', - midiin in 'lib\midi\midiin.pas', - midiout in 'lib\midi\midiout.pas', - MidiType in 'lib\midi\MidiType.PAS', - {$ENDIF} - - // FFMpeg units - avcodec in 'lib\ffmpeg\avcodec.pas', - avformat in 'lib\ffmpeg\avformat.pas', - avio in 'lib\ffmpeg\avio.pas', - avutil in 'lib\ffmpeg\avutil.pas', - opt in 'lib\ffmpeg\opt.pas', - rational in 'lib\ffmpeg\rational.pas', - - - // Sql Lite - SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', - SQLite3 in 'lib\SQLite\SQLite3.pas', - - - //------------------------------ - //Includes - Menu System - //------------------------------ - - UDisplay in 'Menu\UDisplay.pas', - UDrawTexture in 'Menu\UDrawTexture.pas', - UMenu in 'Menu\UMenu.pas', - UMenuButton in 'Menu\UMenuButton.pas', - UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', - UMenuInteract in 'Menu\UMenuInteract.pas', - UMenuSelect in 'Menu\UMenuSelect.pas', - UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', - UMenuStatic in 'Menu\UMenuStatic.pas', - UMenuText in 'Menu\UMenuText.pas', - - //------------------------------ - //Includes - Classes - //------------------------------ - - {$IFDEF FPC} - ulazjpeg in 'Classes\ulazjpeg.pas', - {$ENDIF} - - TextGL in 'Classes\TextGL.pas', - UCatCovers in 'Classes\UCatCovers.pas', - UCommandLine in 'Classes\UCommandLine.pas', - UCommon in 'Classes\UCommon.pas', - UCovers in 'Classes\UCovers.pas', - UDataBase in 'Classes\UDataBase.pas', - UDLLManager in 'Classes\UDLLManager.pas', - UDraw in 'Classes\UDraw.pas', - UFiles in 'Classes\UFiles.pas', - UGraphic in 'Classes\UGraphic.pas', - UGraphicClasses in 'Classes\UGraphicClasses.pas', - UIni in 'Classes\UIni.pas', - UJoystick in 'Classes\UJoystick.pas', - ULanguage in 'Classes\ULanguage.pas', - ULCD in 'Classes\ULCD.pas', - ULight in 'Classes\ULight.pas', - ULog in 'Classes\ULog.pas', - ULyrics in 'Classes\ULyrics.pas', - ULyrics_bak in 'Classes\ULyrics_bak.pas', - UMain in 'Classes\UMain.pas', - UMusic in 'Classes\UMusic.pas', - UParty in 'Classes\UParty.pas', - UPlaylist in 'Classes\UPlaylist.pas', - URecord in 'Classes\URecord.pas', - USkins in 'Classes\USkins.pas', - USongs in 'Classes\USongs.pas', - UTexture in 'Classes\UTexture.pas', - UThemes in 'Classes\UThemes.pas', - UTime in 'Classes\UTime.pas', - - - //------------------------------ - //Includes - Video Support - //------------------------------ - UVideo in 'Classes\UVideo.pas', - - - //------------------------------ - //Includes - Screens - //------------------------------ - UScreenCredits in 'Screens\UScreenCredits.pas', - UScreenEdit in 'Screens\UScreenEdit.pas', - UScreenEditConvert in 'Screens\UScreenEditConvert.pas', - UScreenEditHeader in 'Screens\UScreenEditHeader.pas', - UScreenEditSub in 'Screens\UScreenEditSub.pas', - UScreenLevel in 'Screens\UScreenLevel.pas', - UScreenLoading in 'Screens\UScreenLoading.pas', - UScreenMain in 'Screens\UScreenMain.pas', - UScreenName in 'Screens\UScreenName.pas', - UScreenOpen in 'Screens\UScreenOpen.pas', - UScreenOptions in 'Screens\UScreenOptions.pas', - UScreenOptionsAdvanced in 'Screens\UScreenOptionsAdvanced.pas', - UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', - UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', - UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', - UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', - UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', - UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', - UScreenPopup in 'Screens\UScreenPopup.pas', - UScreenScore in 'Screens\UScreenScore.pas', - UScreenSing in 'Screens\UScreenSing.pas', - UScreenSong in 'Screens\UScreenSong.pas', - UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', - UScreenSongMenu in 'Screens\UScreenSongMenu.pas', - UScreenStatDetail in 'Screens\UScreenStatDetail.pas', - UScreenStatMain in 'Screens\UScreenStatMain.pas', - UScreenTop5 in 'Screens\UScreenTop5.pas', - UScreenWelcome in 'Screens\UScreenWelcome.pas', - - //------------------------------ - //Includes - Screens PartyMode - //------------------------------ - UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', - UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', - UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', - UScreenPartyScore in 'Screens\UScreenPartyScore.pas', - UScreenPartyWin in 'Screens\UScreenPartyWin.pas', - UScreenSingModi in 'Screens\UScreenSingModi.pas', - - //------------------------------ - //Includes - Modi SDK - //------------------------------ - ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', - - - //------------------------------ - //Includes - Delphi - //------------------------------ - {$IFDEF win32} - Windows, - {$ENDIF} - SysUtils; - -const - Version = 'UltraStar Deluxe V 1.10 Alpha Build'; - -var - WndTitle: string; - hWnd: THandle; - I: Integer; - -begin - WndTitle := Version; - - {$ifdef Win32} - //------------------------------ - //Start more than One Time Prevention - //------------------------------ - hWnd:= FindWindow(nil, PChar(WndTitle)); - //Programm already started - if (hWnd <> 0) then - begin - I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Contìnue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); - if (I = IDYes) then - begin - I := 1; - repeat - Inc(I); - hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); - until (hWnd = 0); - - WndTitle := WndTitle + ' Instance ' + InttoStr(I); - end - else - Exit; - end; - {$endif} - - //------------------------------ - //StartUp - Create Classes and Load Files - //------------------------------ - USTime := TTime.Create; - - // Commandline Parameter Parser - Params := TCMDParams.Create; - - // Log + Benchmark - Log := TLog.Create; - Log.Title := WndTitle; - Log.Enabled := Not Params.NoLog; - Log.BenchmarkStart(0); - - // Language - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Paths', 'Initialization'); InitializePaths; - Log.LogStatus('Load Language', 'Initialization'); Language := TLanguage.Create; - //Add Const Values: - Language.AddConst('US_VERSION', Version); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Language', 1); - - // SDL - Log.BenchmarkStart(1); - Log.LogStatus('Initialize SDL', 'Initialization'); - SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing SDL', 1); - - // Skin - Log.BenchmarkStart(1); - Log.LogStatus('Loading Skin List', 'Initialization'); Skin := TSkin.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Skin List', 1); - - // Sound Card List - Log.BenchmarkStart(1); - Log.LogStatus('Loading Soundcard list', 'Initialization'); - Recording := TRecord.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Soundcard list', 1); - - // Ini + Paths - Log.BenchmarkStart(1); - Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; - Ini.Load; - - //Load Languagefile - if (Params.Language <> -1) then - Language.ChangeLanguage(ILanguage[Params.Language]) - else - Language.ChangeLanguage(ILanguage[Ini.Language]); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Ini', 1); - - // LCD - Log.BenchmarkStart(1); - Log.LogStatus('Load LCD', 'Initialization'); LCD := TLCD.Create; - if Ini.LPT = 1 then begin -// LCD.HalfInterface := true; - LCD.Enable; - LCD.Clear; - LCD.WriteText(1, ' UltraStar '); - LCD.WriteText(2, ' Loading... '); - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading LCD', 1); - - // Light - Log.BenchmarkStart(1); - Log.LogStatus('Load Light', 'Initialization'); Light := TLight.Create; - if Ini.LPT = 2 then begin - Light.Enable; - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Light', 1); - - // Theme - Log.BenchmarkStart(1); - Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Themes', 1); - - // Covers Cache - Log.BenchmarkStart(1); - Log.LogStatus('Creating Covers Cache', 'Initialization'); Covers := TCovers.Create; - Log.LogBenchmark('Loading Covers Cache Array', 1); - Log.BenchmarkStart(1); - - // Category Covers - Log.BenchmarkStart(1); - Log.LogStatus('Creating Category Covers Array', 'Initialization'); - CatCovers:= TCatCovers.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Category Covers Array', 1); - - // Songs - //Log.BenchmarkStart(1); - Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; - Songs.LoadSongList; - Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Songs', 1); - - // PluginManager - Log.BenchmarkStart(1); - Log.LogStatus('PluginManager', 'Initialization'); - DLLMan := TDLLMan.Create; //Load PluginList - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PluginManager', 1); - - // Party Mode Manager - Log.BenchmarkStart(1); - Log.LogStatus('PartySession Manager', 'Initialization'); - PartySession := TParty_Session.Create; //Load PartySession - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PartySession Manager', 1); - - // Graphics - Log.BenchmarkStart(1); - Log.LogStatus('Initialize 3D', 'Initialization'); Initialize3D(WndTitle); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing 3D', 1); - - // Sound - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Sound', 'Initialization'); - Log.LogStatus('Creating Music', 'InitializeSound'); Music := TMusic.Create; - InitializeSound; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Sound', 1); - - // Score Saving System - Log.BenchmarkStart(1); - Log.LogStatus('DataBase System', 'Initialization'); - DataBase := TDataBaseSystem.Create; - - if (Params.ScoreFile = '') then - DataBase.Init ('Ultrastar.db') - else - DataBase.Init (Params.ScoreFile); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading DataBase System', 1); - - //Playlist Manager - Log.BenchmarkStart(1); - Log.LogStatus('Playlist Manager', 'Initialization'); - PlaylistMan := TPlaylistManager.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Playlist Manager', 1); - - //GoldenStarsTwinkleMod - Log.BenchmarkStart(1); - Log.LogStatus('Effect Manager', 'Initialization'); - GoldenRec := TEffectManager.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Particel System', 1); - - // Joypad - if (Ini.Joypad = 1) OR (Params.Joypad) then begin - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Joystick', 'Initialization'); Joy := TJoy.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Joystick', 1); - end; - - Log.BenchmarkEnd(0); - Log.LogBenchmark('Loading Time', 0); - - - //------------------------------ - //Start- Mainloop - //------------------------------ - //Music.SetLoop(true); - //Music.SetVolume(50); - //Music.Open(SkinPath + 'Menu Music 3.mp3'); - //Music.Play; - Log.LogStatus('Main Loop', 'Initialization'); MainLoop; - - Log.LogStatus('Cleanup', 'Done'); - - //------------------------------ - //Finish Application - //------------------------------ - if Ini.LPT = 1 then LCD.Clear; - if Ini.LPT = 2 then Light.TurnOff; - - Log.Free; -end. +program UltraStar; + +{$DEFINE TRANSLATE} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ELSE} + {$R 'UltraStar.res' 'UltraStar.rc'} +{$ENDIF} + +{$I switches.inc} + +uses + + // *************************************************************************** + // + // Developers PLEASE NOTE !!!!!!! + // + // As of september 2007, I am working towards porting Ultrastar-DX to run + // on Linux. I will be modifiying the source to make it compile in lazarus + // on windows & linux and I will make sure that it compiles in delphi still + // To help me in this endevour, please can you make a point of remembering + // that linux is CASE SENSATIVE, and file / unit names must be as per + // the filename exactly. + // + // EG : opengl12.pas must not be OpenGL in the uses cluase. + // + // thanks for your help... + // + // *************************************************************************** + + //------------------------------ + //Includes - 3rd Party Libraries + //------------------------------ + + // SDL / OpenGL + moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', + opengl12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\opengl12.pas', + sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', + sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', + sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', + + + // Bass + {$IFDEF UseBASS} + bass in 'lib\bass\delphi\bass.pas', + {$ENDIF} + + // Midi Units + {$IFDEF UseMIDIPort} + Circbuf in 'lib\midi\CIRCBUF.PAS', + Delphmcb in 'lib\midi\Delphmcb.PAS', + MidiCons in 'lib\midi\MidiCons.PAS', + MidiDefs in 'lib\midi\MidiDefs.PAS', + MidiFile in 'lib\midi\MidiFile.PAS', + midiin in 'lib\midi\midiin.pas', + midiout in 'lib\midi\midiout.pas', + MidiType in 'lib\midi\MidiType.PAS', + {$ENDIF} + + // FFMpeg units + avcodec in 'lib\ffmpeg\avcodec.pas', + avformat in 'lib\ffmpeg\avformat.pas', + avio in 'lib\ffmpeg\avio.pas', + avutil in 'lib\ffmpeg\avutil.pas', + opt in 'lib\ffmpeg\opt.pas', + rational in 'lib\ffmpeg\rational.pas', + + + // Sql Lite + SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', + SQLite3 in 'lib\SQLite\SQLite3.pas', + + + //------------------------------ + //Includes - Menu System + //------------------------------ + + UDisplay in 'Menu\UDisplay.pas', + UDrawTexture in 'Menu\UDrawTexture.pas', + UMenu in 'Menu\UMenu.pas', + UMenuButton in 'Menu\UMenuButton.pas', + UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', + UMenuInteract in 'Menu\UMenuInteract.pas', + UMenuSelect in 'Menu\UMenuSelect.pas', + UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', + UMenuStatic in 'Menu\UMenuStatic.pas', + UMenuText in 'Menu\UMenuText.pas', + + //------------------------------ + //Includes - Classes + //------------------------------ + + {$IFDEF FPC} + ulazjpeg in 'Classes\ulazjpeg.pas', + {$ENDIF} + + TextGL in 'Classes\TextGL.pas', + UCatCovers in 'Classes\UCatCovers.pas', + UCommandLine in 'Classes\UCommandLine.pas', + UCommon in 'Classes\UCommon.pas', + UCovers in 'Classes\UCovers.pas', + UDataBase in 'Classes\UDataBase.pas', + UDLLManager in 'Classes\UDLLManager.pas', + UDraw in 'Classes\UDraw.pas', + UFiles in 'Classes\UFiles.pas', + UGraphic in 'Classes\UGraphic.pas', + UGraphicClasses in 'Classes\UGraphicClasses.pas', + UIni in 'Classes\UIni.pas', + UJoystick in 'Classes\UJoystick.pas', + ULanguage in 'Classes\ULanguage.pas', + ULCD in 'Classes\ULCD.pas', + ULight in 'Classes\ULight.pas', + ULog in 'Classes\ULog.pas', + ULyrics in 'Classes\ULyrics.pas', + ULyrics_bak in 'Classes\ULyrics_bak.pas', + UMain in 'Classes\UMain.pas', + UMusic in 'Classes\UMusic.pas', + UParty in 'Classes\UParty.pas', + UPlaylist in 'Classes\UPlaylist.pas', + URecord in 'Classes\URecord.pas', + USkins in 'Classes\USkins.pas', + USongs in 'Classes\USongs.pas', + UTexture in 'Classes\UTexture.pas', + UThemes in 'Classes\UThemes.pas', + UTime in 'Classes\UTime.pas', + + + //------------------------------ + //Includes - Video Support + //------------------------------ + UVideo in 'Classes\UVideo.pas', + + + //------------------------------ + //Includes - Screens + //------------------------------ + UScreenCredits in 'Screens\UScreenCredits.pas', + UScreenEdit in 'Screens\UScreenEdit.pas', + UScreenEditConvert in 'Screens\UScreenEditConvert.pas', + UScreenEditHeader in 'Screens\UScreenEditHeader.pas', + UScreenEditSub in 'Screens\UScreenEditSub.pas', + UScreenLevel in 'Screens\UScreenLevel.pas', + UScreenLoading in 'Screens\UScreenLoading.pas', + UScreenMain in 'Screens\UScreenMain.pas', + UScreenName in 'Screens\UScreenName.pas', + UScreenOpen in 'Screens\UScreenOpen.pas', + UScreenOptions in 'Screens\UScreenOptions.pas', + UScreenOptionsAdvanced in 'Screens\UScreenOptionsAdvanced.pas', + UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', + UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', + UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', + UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', + UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', + UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', + UScreenPopup in 'Screens\UScreenPopup.pas', + UScreenScore in 'Screens\UScreenScore.pas', + UScreenSing in 'Screens\UScreenSing.pas', + UScreenSong in 'Screens\UScreenSong.pas', + UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', + UScreenSongMenu in 'Screens\UScreenSongMenu.pas', + UScreenStatDetail in 'Screens\UScreenStatDetail.pas', + UScreenStatMain in 'Screens\UScreenStatMain.pas', + UScreenTop5 in 'Screens\UScreenTop5.pas', + UScreenWelcome in 'Screens\UScreenWelcome.pas', + + //------------------------------ + //Includes - Screens PartyMode + //------------------------------ + UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', + UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', + UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', + UScreenPartyScore in 'Screens\UScreenPartyScore.pas', + UScreenPartyWin in 'Screens\UScreenPartyWin.pas', + UScreenSingModi in 'Screens\UScreenSingModi.pas', + + //------------------------------ + //Includes - Modi SDK + //------------------------------ + ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', + + + //------------------------------ + //Includes - Delphi + //------------------------------ + {$IFDEF win32} + Windows, + {$ENDIF} + SysUtils; + +const + Version = 'UltraStar Deluxe V 1.10 Alpha Build'; + +var + WndTitle: string; + hWnd: THandle; + I: Integer; + +begin + WndTitle := Version; + + + {$ifdef Win32} + //------------------------------ + //Start more than One Time Prevention + //------------------------------ + hWnd:= FindWindow(nil, PChar(WndTitle)); + //Programm already started + if (hWnd <> 0) then + begin + I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Contìnue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); + if (I = IDYes) then + begin + I := 1; + repeat + Inc(I); + hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); + until (hWnd = 0); + + WndTitle := WndTitle + ' Instance ' + InttoStr(I); + end + else + Exit; + end; + {$endif} + + //------------------------------ + //StartUp - Create Classes and Load Files + //------------------------------ + USTime := TTime.Create; + + // Commandline Parameter Parser + Params := TCMDParams.Create; + + // Log + Benchmark + Log := TLog.Create; + Log.Title := WndTitle; + Log.Enabled := Not Params.NoLog; + Log.BenchmarkStart(0); + + // Language + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Paths', 'Initialization'); InitializePaths; + Log.LogStatus('Load Language', 'Initialization'); Language := TLanguage.Create; + //Add Const Values: + Language.AddConst('US_VERSION', Version); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Language', 1); + + // SDL + Log.BenchmarkStart(1); + Log.LogStatus('Initialize SDL', 'Initialization'); + SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing SDL', 1); + + // Skin + Log.BenchmarkStart(1); + Log.LogStatus('Loading Skin List', 'Initialization'); Skin := TSkin.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Skin List', 1); + + // Sound Card List + Log.BenchmarkStart(1); + Log.LogStatus('Loading Soundcard list', 'Initialization'); + Recording := TRecord.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Soundcard list', 1); + + // Ini + Paths + Log.BenchmarkStart(1); + Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; + Ini.Load; + + //Load Languagefile + if (Params.Language <> -1) then + Language.ChangeLanguage(ILanguage[Params.Language]) + else + Language.ChangeLanguage(ILanguage[Ini.Language]); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Ini', 1); + + // LCD + Log.BenchmarkStart(1); + Log.LogStatus('Load LCD', 'Initialization'); LCD := TLCD.Create; + if Ini.LPT = 1 then begin +// LCD.HalfInterface := true; + LCD.Enable; + LCD.Clear; + LCD.WriteText(1, ' UltraStar '); + LCD.WriteText(2, ' Loading... '); + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading LCD', 1); + + // Light + Log.BenchmarkStart(1); + Log.LogStatus('Load Light', 'Initialization'); Light := TLight.Create; + if Ini.LPT = 2 then begin + Light.Enable; + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Light', 1); + + // Theme + Log.BenchmarkStart(1); + Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Themes', 1); + + // Covers Cache + Log.BenchmarkStart(1); + Log.LogStatus('Creating Covers Cache', 'Initialization'); Covers := TCovers.Create; + Log.LogBenchmark('Loading Covers Cache Array', 1); + Log.BenchmarkStart(1); + + // Category Covers + Log.BenchmarkStart(1); + Log.LogStatus('Creating Category Covers Array', 'Initialization'); + CatCovers:= TCatCovers.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Category Covers Array', 1); + + // Songs + //Log.BenchmarkStart(1); + Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; + Songs.LoadSongList; + Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Songs', 1); + + // PluginManager + Log.BenchmarkStart(1); + Log.LogStatus('PluginManager', 'Initialization'); + DLLMan := TDLLMan.Create; //Load PluginList + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PluginManager', 1); + + // Party Mode Manager + Log.BenchmarkStart(1); + Log.LogStatus('PartySession Manager', 'Initialization'); + PartySession := TParty_Session.Create; //Load PartySession + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PartySession Manager', 1); + + // Graphics + Log.BenchmarkStart(1); + Log.LogStatus('Initialize 3D', 'Initialization'); Initialize3D(WndTitle); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing 3D', 1); + + // Sound + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Sound', 'Initialization'); + Log.LogStatus('Creating Music', 'InitializeSound'); Music := TMusic.Create; + InitializeSound; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Sound', 1); + + // Score Saving System + Log.BenchmarkStart(1); + Log.LogStatus('DataBase System', 'Initialization'); + DataBase := TDataBaseSystem.Create; + + if (Params.ScoreFile = '') then + DataBase.Init ('Ultrastar.db') + else + DataBase.Init (Params.ScoreFile); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading DataBase System', 1); + + //Playlist Manager + Log.BenchmarkStart(1); + Log.LogStatus('Playlist Manager', 'Initialization'); + PlaylistMan := TPlaylistManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Playlist Manager', 1); + + //GoldenStarsTwinkleMod + Log.BenchmarkStart(1); + Log.LogStatus('Effect Manager', 'Initialization'); + GoldenRec := TEffectManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Particel System', 1); + + // Joypad + if (Ini.Joypad = 1) OR (Params.Joypad) then begin + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Joystick', 'Initialization'); Joy := TJoy.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Joystick', 1); + end; + + Log.BenchmarkEnd(0); + Log.LogBenchmark('Loading Time', 0); + + + //------------------------------ + //Start- Mainloop + //------------------------------ + //Music.SetLoop(true); + //Music.SetVolume(50); + //Music.Open(SkinPath + 'Menu Music 3.mp3'); + //Music.Play; + Log.LogStatus('Main Loop', 'Initialization'); MainLoop; + + Log.LogStatus('Cleanup', 'Done'); + + //------------------------------ + //Finish Application + //------------------------------ + if Ini.LPT = 1 then LCD.Clear; + if Ini.LPT = 2 then Light.TurnOff; + + Log.Free; +end. -- cgit v1.2.3 From 1f9fd791bbe68741b8273a64eb5c0abe928e431c Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 23 Sep 2007 14:00:46 +0000 Subject: New class for score management -Scores are raised when PopUp slides under the scorebg -1 to 6 Player support (even 5 Players(not supported by Core atm)) -Display 3 Players instead of 2 when 4 Players are set in the Options and Screens=2 Ratingbar is not drawn by class atm. Have to be done git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@430 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 8 +- Game/Code/Classes/UGraphic.pas | 53 +- Game/Code/Classes/USingNotes.pas | 10 + Game/Code/Classes/USingScores.pas | 759 ++++++++++++++++++++++++++++ Game/Code/Screens/UScreenSing.pas | 163 +++--- Game/Code/Screens/UScreenSingModi.pas | 903 +++++++++++++++++----------------- Game/Code/UltraStar.dpr | 10 +- 7 files changed, 1380 insertions(+), 526 deletions(-) create mode 100644 Game/Code/Classes/USingNotes.pas create mode 100644 Game/Code/Classes/USingScores.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 4c5d2ce0..5a175289 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -713,7 +713,7 @@ begin end; //end Singbar Mod - //PhrasenBonus - Line Bonus Mod + {//PhrasenBonus - Line Bonus Mod if Ini.LineBonus > 0 then begin A := GetTickCount div 33; if (A <> Tickold2) AND (Player[0].LineBonus_Visible) then begin @@ -784,7 +784,7 @@ begin end; end; end; - //PhrasenBonus - Line Bonus Mod End + //PhrasenBonus - Line Bonus Mod End } // Set the note heights according to the difficulty level case Ini.Difficulty of @@ -1127,7 +1127,7 @@ begin end; //end Singbar Mod - //PhrasenBonus - Line Bonus Mod + {//PhrasenBonus - Line Bonus Mod if ((Ini.LineBonus > 0) AND (DLLMan.Selected.EnLineBonus_O)) OR (DLLMan.Selected.EnLineBonus) then begin A := GetTickCount div 33; if (A <> Tickold2) AND (Player[0].LineBonus_Visible) then begin @@ -1214,7 +1214,7 @@ begin end; end; end; -//PhrasenBonus - Line Bonus Mod End +//PhrasenBonus - Line Bonus Mod End } // resize the notes according to the difficulty level case Ini.Difficulty of diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index f350d0d2..6ea89c0f 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -156,6 +156,9 @@ var Tex_SingLineBonusBack: array[0..8] of TTexture; //End PhrasenBonus - Line Bonus Mod + //ScoreBG Texs + Tex_ScoreBG: array [0..5] of TTexture; + const Skin_BGColorR = 1; Skin_BGColorG = 1; @@ -315,22 +318,48 @@ begin //Line Bonus PopUp for P := 0 to 8 do begin - Tex_SingLineBonusBack[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LineBonusBack')), 'PNG', 'Colorized', $FFFFFF); + Case P of + 0: begin + R := 1; + G := 0; + B := 0; + end; + 1..3: begin + R := 1; + G := (P * 0.25); + B := 0; + end; + 4: begin + R := 1; + G := 1; + B := 0; + end; + 5..7: begin + R := 1-((P-4)*0.25); + G := 1; + B := 0; + end; + 8: begin + R := 0; + G := 1; + B := 0; + end; + End; + + Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + Tex_SingLineBonusBack[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LineBonusBack')), 'PNG', 'Colorized', Col); end; + + //Score BG Textures + for P := 0 to 5 do begin + LoadColor(R, G, B, 'P' + IntToStr(P+1) + 'Light'); + Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + Tex_ScoreBG[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreBG')), 'PNG', 'Colorized', Col); + end; + {$ENDIF} - - - {//Set Texture to Font High - Tex_SingLineBonusL.H := 32; Tex_SingLineBonusL.W := 8; - Tex_SingLineBonusM.H := 32; //Tex_SingLineBonusM.TexW := Tex_SingLineBonusM.TexW/2; - Tex_SingLineBonusR.H := 32; Tex_SingLineBonusR.W := 8; } - //PhrasenBonus - Line Bonus Mod End Log.LogStatus('Loading Textures - D', 'LoadTextures'); - - // tworzenie czcionek -// Log.LogStatus('Building Fonts', 'LoadTextures'); -// BuildFont; end; procedure Initialize3D (Title: string); diff --git a/Game/Code/Classes/USingNotes.pas b/Game/Code/Classes/USingNotes.pas new file mode 100644 index 00000000..e2162bf1 --- /dev/null +++ b/Game/Code/Classes/USingNotes.pas @@ -0,0 +1,10 @@ +unit USingNotes; + +interface +{ Dummy Unit atm + For further expantation + Placeholder for Class that will handle the Notes Drawing} + +implementation + +end. diff --git a/Game/Code/Classes/USingScores.pas b/Game/Code/Classes/USingScores.pas new file mode 100644 index 00000000..27a65b32 --- /dev/null +++ b/Game/Code/Classes/USingScores.pas @@ -0,0 +1,759 @@ +unit USingScores; + +interface +uses UThemes, OpenGl12, UTexture; + +//Some Constances containing Options that could change by time +const + MaxPlayers = 6; //Maximum of Players that could be added + MaxPositions = 6; //Maximum of Score Positions that could be added + +type + //----------- + // TScorePlayer - Record Containing Information about a Players Score + //----------- + TScorePlayer = record + Position: Byte; //Index of the Position where the Player should be Drawn + Enabled: Boolean; //Is the Score Display Enabled + Visible: Boolean; //Is the Score Display Visible + Score: Word; //Current Score of the Player + ScoreDisplayed: Word; //Score cur. Displayed(for counting up) + ScoreBG: TTexture;//Texture of the Players Scores BG + Color: TRGB; //Teh Players Color + end; + aScorePlayer = array[0..MaxPlayers-1] of TScorePlayer; + + //----------- + // TScorePosition - Record Containing Information about a Score Position, that can be used + //----------- + PScorePosition = ^TScorePosition; + TScorePosition = record + //The Position is Used for Which Playercount + PlayerCount: Byte; + // 1 - One Player per Screen + // 2 - 2 Players per Screen + // 4 - 3 Players per Screen + // 6 would be 2 and 3 Players per Screen + + BGX: Real; //X Position of the Score BG + BGY: Real; //Y Position of the Score BG + BGW: Real; //Width of the Score BG + BGH: Real; //Height of the Score BG + + RBX: Real; //X Position of the Rating Bar + RBY: Real; //Y Position of the Rating Bar + RBW: Real; //Width of the Rating Bar + RBH: Real; //Height of the Rating Bar + + TextX: Real; //X Position of the Score Text + TextY: Real; //Y Position of the Score Text + TextFont: Byte; //Font of the Score Text + TextSize: Byte; //Size of the Score Text + + PUW: Real; //Width of the LineBonus Popup + PUH: Real; //Height of the LineBonus Popup + PUFont: Byte; //Font for the PopUps + PUFontSize: Byte; //FontSize for the PopUps + PUStartX: Real; //X Start Position of the LineBonus Popup + PUStartY: Real; //Y Start Position of the LineBonus Popup + PUTargetX: Real; //X Target Position of the LineBonus Popup + PUTargetY: Real; //Y Target Position of the LineBonus Popup + end; + aScorePosition = array[0..MaxPositions-1] of TScorePosition; + + //----------- + // TScorePopUp - Record Containing Information about a LineBonus Popup + // List, Next Item is Saved in Next attribute + //----------- + PScorePopUp = ^TScorePopUp; + TScorePopUp = record + Player: Byte; //Index of the PopUps Player + TimeStamp: Cardinal; //Timestamp of Popups Spawn + Rating: Byte; //0 to 8, Type of Rating (Cool, bad, etc.) + ScoreGiven:Word; //Score that has already been given to the Player + ScoreDiff: Word; //Difference Between Cur Score at Spawn and Old Score + Next: PScorePopUp; //Next Item in List + end; + aScorePopUp = array of TScorePopUp; + + //----------- + // TSingScores - Class containing Scores Positions and Drawing Scores, Rating Bar + Popups + //----------- + TSingScores = class + private + Positions: aScorePosition; + aPlayers: aScorePlayer; + oPositionCount: Byte; + oPlayerCount: Byte; + + //Saves the First and Last Popup of the List + FirstPopUp: PScorePopUp; + LastPopUp: PScorePopUp; + + //Procedure Draws a Popup by Pointer + Procedure DrawPopUp(const PopUp: PScorePopUp); + + //Procedure Draws a Score by Playerindex + Procedure DrawScore(const Index: Integer); + + //Procedure Removes a PopUp w/o destroying the List + Procedure KillPopUp(const last, cur: PScorePopUp); + public + Settings: record //Record containing some Displaying Options + Phase1Time: Real; //time for Phase 1 to complete (in msecs) + //The Plop Up of the PopUp + Phase2Time: Real; //time for Phase 2 to complete (in msecs) + //The Moving (mainly Upwards) of the Popup + Phase3Time: Real; //time for Phase 3 to complete (in msecs) + //The Fade out and Score adding + + PopUpTex: Array [0..8] of TTexture; //Textures for every Popup Rating + + RatingBar_BG_Tex: TTexture; //Rating Bar Texs + RatingBar_FG_Tex: TTexture; + RatingBar_Bar_Tex: TTexture; + + end; + + //Propertys for Reading Position and Playercount + Property PositionCount: Byte read oPositionCount; + Property PlayerCount: Byte read oPlayerCount; + Property Players: aScorePlayer read aPlayers; + + //Constructor just sets some standard Settings + Constructor Create; + + //Procedure Adds a Position to Array and Increases Position Count + Procedure AddPosition(const pPosition: PScorePosition); + + //Procedure Adds a Player to Array and Increases Player Count + Procedure AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: Word = 0; const Enabled: Boolean = True; const Visible: Boolean = True); + + //Change a Players Visibility, Enable + Procedure ChangePlayerVisibility(const Index: Byte; const pVisible: Boolean); + Procedure ChangePlayerEnabled(const Index: Byte; const pEnabled: Boolean); + + //Procedure Deletes all Player Information + Procedure ClearPlayers; + + //Procedure Deletes Positions and Playerinformation + Procedure Clear; + + //Procedure Loads some Settings and the Positions from Theme + Procedure LoadfromTheme; + + //Procedure has to be called after Positions and Players have been added, before first call of Draw + //It gives every Player a Score Position + Procedure Init; + + //Spawns a new Line Bonus PopUp for the Player + Procedure SpawnPopUp(const PlayerIndex: Byte; const Rating: Byte; const Score: Word); + + //Removes all PopUps from Mem + Procedure KillAllPopUps; + + //Procedure Draws Scores and Linebonus PopUps + Procedure Draw; + end; + + +implementation +uses SDL, SysUtils, ULog, UGraphic, TextGL; + +//----------- +//Constructor just sets some standard Settings +//----------- +Constructor TSingScores.Create; +begin + //Clear PopupList Pointers + FirstPopUp := nil; + LastPopUp := nil; + + //Clear Position Index + oPositionCount := 0; + oPlayerCount := 0; + + Settings.Phase1Time := 1000; + Settings.Phase2Time := 2000; + Settings.Phase3Time := 2000; + + Settings.PopUpTex[0].TexNum := High(gluInt); + Settings.PopUpTex[1].TexNum := High(gluInt); + Settings.PopUpTex[2].TexNum := High(gluInt); + Settings.PopUpTex[3].TexNum := High(gluInt); + Settings.PopUpTex[4].TexNum := High(gluInt); + Settings.PopUpTex[5].TexNum := High(gluInt); + Settings.PopUpTex[6].TexNum := High(gluInt); + Settings.PopUpTex[7].TexNum := High(gluInt); + Settings.PopUpTex[8].TexNum := High(gluInt); + + Settings.RatingBar_BG_Tex.TexNum := High(gluInt); + Settings.RatingBar_FG_Tex.TexNum := High(gluInt); + Settings.RatingBar_Bar_Tex.TexNum := High(gluInt); +end; + +//----------- +//Procedure Adds a Position to Array and Increases Position Count +//----------- +Procedure TSingScores.AddPosition(const pPosition: PScorePosition); +begin + if (PositionCount < MaxPositions) then + begin + Positions[PositionCount] := pPosition^; + + Inc(oPositionCount); + end; +end; + +//----------- +//Procedure Adds a Player to Array and Increases Player Count +//----------- +Procedure TSingScores.AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: Word; const Enabled: Boolean; const Visible: Boolean); +begin + if (PlayerCount < MaxPlayers) then + begin + aPlayers[PlayerCount].Position := High(byte); + aPlayers[PlayerCount].Enabled := Enabled; + aPlayers[PlayerCount].Visible := Visible; + aPlayers[PlayerCount].Score := Score; + aPlayers[PlayerCount].ScoreDisplayed := Score; + aPlayers[PlayerCount].ScoreBG := ScoreBG; + aPlayers[PlayerCount].Color := Color; + + Inc(oPlayerCount); + end; +end; + +//----------- +//Change a Players Visibility +//----------- +Procedure TSingScores.ChangePlayerVisibility(const Index: Byte; const pVisible: Boolean); +begin + if (Index < MaxPlayers) then + aPlayers[Index].Visible := pVisible; +end; + +//----------- +//Change Player Enabled +//----------- +Procedure TSingScores.ChangePlayerEnabled(const Index: Byte; const pEnabled: Boolean); +begin + if (Index < MaxPlayers) then + aPlayers[Index].Enabled := pEnabled; +end; + +//----------- +//Procedure Deletes all Player Information +//----------- +Procedure TSingScores.ClearPlayers; +begin + KillAllPopUps; + oPlayerCount := 0; +end; + +//----------- +//Procedure Deletes Positions and Playerinformation +//----------- +Procedure TSingScores.Clear; +begin + KillAllPopUps; + oPlayerCount := 0; + oPositionCount := 0; +end; + +//----------- +//Procedure Loads some Settings and the Positions from Theme +//----------- +Procedure TSingScores.LoadfromTheme; +var I: Integer; + Procedure AddbyStatics(const PC: Byte; const ScoreStatic, SingBarStatic: TThemeStatic; ScoreText: TThemeText); + var nPosition: TScorePosition; + begin + nPosition.PlayerCount := PC; //Only for one Player Playing + + nPosition.BGX := ScoreStatic.X; + nPosition.BGY := ScoreStatic.Y; + nPosition.BGW := ScoreStatic.W; + nPosition.BGH := ScoreStatic.H; + + nPosition.TextX := ScoreText.X; + nPosition.TextY := ScoreText.Y; + nPosition.TextFont := ScoreText.Font; + nPosition.TextSize := ScoreText.Size; + + nPosition.RBX := SingBarStatic.X; + nPosition.RBY := SingBarStatic.Y; + nPosition.RBW := SingBarStatic.W; + nPosition.RBH := SingBarStatic.H; + + nPosition.PUW := nPosition.BGW; + nPosition.PUH := nPosition.BGH; + + nPosition.PUFont := 2; + nPosition.PUFontSize := 6; + + nPosition.PUStartX := nPosition.BGX; + nPosition.PUStartY := nPosition.TextY + 65; + + nPosition.PUTargetX := nPosition.BGX; + nPosition.PUTargetY := nPosition.TextY; + + AddPosition(@nPosition); + end; +begin + Clear; + + //Set Textures + //Popup Tex + For I := 0 to 8 do + Settings.PopUpTex[I] := Tex_SingLineBonusBack[I]; + + //Rating Bar Tex + Settings.RatingBar_BG_Tex := Tex_SingBar_Back; + Settings.RatingBar_FG_Tex := Tex_SingBar_Front; + Settings.RatingBar_Bar_Tex := Tex_SingBar_Bar; + + //Load Positions from Theme + + // Player1: + AddByStatics(1, Theme.Sing.StaticP1ScoreBG, Theme.Sing.StaticP1SingBar, Theme.Sing.TextP1Score); + AddByStatics(2, Theme.Sing.StaticP1TwoPScoreBG, Theme.Sing.StaticP1TwoPSingBar, Theme.Sing.TextP1TwoPScore); + AddByStatics(4, Theme.Sing.StaticP1ThreePScoreBG, Theme.Sing.StaticP1ThreePSingBar, Theme.Sing.TextP1ThreePScore); + + // Player2: + AddByStatics(2, Theme.Sing.StaticP2RScoreBG, Theme.Sing.StaticP2RSingBar, Theme.Sing.TextP2RScore); + AddByStatics(4, Theme.Sing.StaticP2MScoreBG, Theme.Sing.StaticP2MSingBar, Theme.Sing.TextP2MScore); + + // Player3: + AddByStatics(4, Theme.Sing.StaticP3RScoreBG, Theme.Sing.StaticP3RScoreBG, Theme.Sing.TextP3RScore); +end; + +//----------- +//Spawns a new Line Bonus PopUp for the Player +//----------- +Procedure TSingScores.SpawnPopUp(const PlayerIndex: Byte; const Rating: Byte; const Score: Word); +var Cur: PScorePopUp; +begin + Log.LogError('Spawn PopUp: Score: ' + InttoStr(Score)); + if (PlayerIndex < PlayerCount) then + begin + //Get Memory and Add Data + GetMem(Cur, SizeOf(TScorePopUp)); + + Cur.Player := PlayerIndex; + Cur.TimeStamp := SDL_GetTicks; + Cur.Rating := Rating; + Cur.ScoreGiven:= 0; + If (Players[PlayerIndex].Score < Score) then + begin + Cur.ScoreDiff := Score - Players[PlayerIndex].Score; + aPlayers[PlayerIndex].Score := Score; + end + else + Cur.ScoreDiff := 0; + Cur.Next := nil; + + //Log.LogError('TSingScores.SpawnPopUp| Player: ' + InttoStr(PlayerIndex) + ', Score: ' + InttoStr(Score) + ', ScoreDiff: ' + InttoStr(Cur.ScoreDiff)); + + //Add it to the Chain + if (FirstPopUp = nil) then + //the first PopUp in the List + FirstPopUp := Cur + else + //second or earlier popup + LastPopUp.Next := Cur; + + //Set new Popup to Last PopUp in the List + LastPopUp := Cur; + end + else + Log.LogError('TSingScores: Try to add PopUp for not existing player'); +end; + +//----------- +// Removes a PopUp w/o destroying the List +//----------- +Procedure TSingScores.KillPopUp(const last, cur: PScorePopUp); +begin + //Give Player the Last Points that missing till now + aPlayers[Cur.Player].ScoreDisplayed := aPlayers[Cur.Player].ScoreDisplayed + Cur.ScoreDiff - Cur.ScoreGiven; + + //If this is the First PopUp => Make Next PopUp the First + If (Cur = FirstPopUp) then + FirstPopUp := Cur.Next + //Else => Remove Curent Popup from Chain + else + Last.Next := Cur.Next; + + //If this is the Last PopUp, Make PopUp before the Last + If (Cur = LastPopUp) then + LastPopUp := Last; + + //Free the Memory + FreeMem(Cur, SizeOf(TScorePopUp)); +end; + +//----------- +//Removes all PopUps from Mem +//----------- +Procedure TSingScores.KillAllPopUps; +var + Cur: PScorePopUp; + Last: PScorePopUp; +begin + Cur := FirstPopUp; + + //Remove all PopUps: + While (Cur <> nil) do + begin + Last := Cur; + Cur := Cur.Next; + FreeMem(Last, SizeOf(TScorePopUp)); + end; + + FirstPopUp := nil; + LastPopUp := nil; +end; + +//----------- +//Init - has to be called after Positions and Players have been added, before first call of Draw +//It gives every Player a Score Position +//----------- +Procedure TSingScores.Init; +var + PlC: Array [0..1] of Byte; //Playercount First Screen and Second Screen + I, J: Integer; + MaxPlayersperScreen: Byte; + CurPlayer: Byte; + + Function GetPositionCountbyPlayerCount(bPlayerCount: Byte): Byte; + var I: Integer; + begin + Result := 0; + bPlayerCount := 1 shl (bPlayerCount - 1); + + For I := 0 to PositionCount-1 do + begin + If ((Positions[I].PlayerCount AND bPlayerCount) <> 0) then + Inc(Result); + end; + end; + + Function GetPositionbyPlayernum(bPlayerCount, bPlayer: Byte): Byte; + var I: Integer; + begin + bPlayerCount := 1 shl (bPlayerCount - 1); + Result := High(Byte); + + For I := 0 to PositionCount-1 do + begin + If ((Positions[I].PlayerCount AND bPlayerCount) <> 0) then + begin + If (bPlayer = 0) then + begin + Result := I; + Break; + end + else + Dec(bPlayer); + end; + end; + end; + +begin + + For I := 1 to 6 do + begin + //If there are enough Positions -> Write to MaxPlayers + If (GetPositionCountbyPlayerCount(I) = I) then + MaxPlayersperScreen := I + else + Break; + end; + + + //Split Players to both Screen or Display on One Screen + if (Screens = 2) and (MaxPlayersperScreen < PlayerCount) then + begin + PlC[0] := PlayerCount div 2 + PlayerCount mod 2; + PlC[1] := PlayerCount div 2; + end + else + begin + PlC[0] := PlayerCount; + PlC[1] := 0; + end; + + + //Check if there are enough Positions for all Players + For I := 0 to Screens - 1 do + begin + if (PlC[I] > MaxPlayersperScreen) then + begin + PlC[I] := MaxPlayersperScreen; + Log.LogError('More Players than available Positions, TSingScores'); + end; + end; + + CurPlayer := 0; + //Give every Player a Position + For I := 0 to Screens - 1 do + For J := 0 to PlC[I]-1 do + begin + aPlayers[CurPlayer].Position := GetPositionbyPlayernum(PlC[I], J) OR (I shl 7); + //Log.LogError('Player ' + InttoStr(CurPlayer) + ' gets Position: ' + InttoStr(aPlayers[CurPlayer].Position)); + Inc(CurPlayer); + end; +end; + +//----------- +//Procedure Draws Scores and Linebonus PopUps +//----------- +Procedure TSingScores.Draw; +var + I: Integer; + CurTime: Cardinal; + CurPopUp, LastPopUp: PScorePopUp; +begin + CurTime := SDL_GetTicks; + + //Draw Popups + LastPopUp := nil; + CurPopUp := FirstPopUp; + + While (CurPopUp <> nil) do + begin + if (CurTime - CurPopUp.TimeStamp > Settings.Phase1Time + Settings.Phase2Time + Settings.Phase3Time) then + begin + KillPopUp(LastPopUp, CurPopUp); + if (LastPopUp = nil) then + CurPopUp := FirstPopUp + else + CurPopUp := LastPopUp.Next; + end + else + begin + DrawPopUp(CurPopUp); + LastPopUp := CurPopUp; + CurPopUp := LastPopUp.Next; + end; + end; + + + //Draw Players + For I := 0 to PlayerCount-1 do + begin + DrawScore(I); + end; +end; + +//----------- +//Procedure Draws a Popup by Pointer +//----------- +Procedure TSingScores.DrawPopUp(const PopUp: PScorePopUp); +var + Progress: Real; + CurTime: Cardinal; + X, Y, W, H, Alpha: Real; + FontSize: Byte; + TimeDiff: Cardinal; + PIndex: Byte; + TextLen: Real; + ScoretoAdd: Word; + PosDiff: Real; +begin + if (PopUp <> nil) then + begin + //Only Draw if Player has a Position + PIndex := Players[PopUp.Player].Position; + If PIndex <> high(byte) then + begin + //Only Draw if Player is on Cur Screen + If ((Players[PopUp.Player].Position AND 128) = 0) = (ScreenAct = 1) then + begin + CurTime := SDL_GetTicks; + TimeDiff := CurTime - PopUp.TimeStamp; + + //Get Position of PopUp + PIndex := PIndex AND 127; + + + //Check for Phase ... + If (TimeDiff <= Settings.Phase1Time) then + begin + //Phase 1 - The Ploping up + Progress := TimeDiff / Settings.Phase1Time; + + + W := Positions[PIndex].PUW * Sin(Progress/2*Pi); + H := Positions[PIndex].PUH * Sin(Progress/2*Pi); + + X := Positions[PIndex].PUStartX + (Positions[PIndex].PUW - W)/2; + Y := Positions[PIndex].PUStartY + (Positions[PIndex].PUH - H)/2; + + FontSize := Round(Progress * Positions[PIndex].PUFontSize); + Alpha := 1; + end + + Else If (TimeDiff <= Settings.Phase2Time + Settings.Phase1Time) then + begin + //Phase 2 - The Moving + Progress := (TimeDiff - Settings.Phase1Time) / Settings.Phase2Time; + + W := Positions[PIndex].PUW; + H := Positions[PIndex].PUH; + + PosDiff := Positions[PIndex].PUTargetX - Positions[PIndex].PUStartX; + If PosDiff > 0 then + PosDiff := PosDiff + W; + X := Positions[PIndex].PUStartX + PosDiff * sqr(Progress); + + PosDiff := Positions[PIndex].PUTargetY - Positions[PIndex].PUStartY; + If PosDiff < 0 then + PosDiff := PosDiff + Positions[PIndex].BGH; + Y := Positions[PIndex].PUStartY + PosDiff * sqr(Progress); + + FontSize := Positions[PIndex].PUFontSize; + Alpha := 1 - 0.3 * Progress; + end + + else + begin + //Phase 3 - The Fading out + Score adding + Progress := (TimeDiff - Settings.Phase1Time - Settings.Phase2Time) / Settings.Phase3Time; + + If (PopUp.Rating > 0) then + begin + //Add Scores + ScoreToAdd := Round(PopUp.ScoreDiff * Progress) - PopUp.ScoreGiven; + Inc(PopUp.ScoreGiven, ScoreToAdd); + aPlayers[PopUp.Player].ScoreDisplayed := Players[PopUp.Player].ScoreDisplayed + ScoreToAdd; + + //Set Positions etc. + Alpha := 0.7 - 0.7 * Progress; + + W := Positions[PIndex].PUW; + H := Positions[PIndex].PUH; + + PosDiff := Positions[PIndex].PUTargetX - Positions[PIndex].PUStartX; + If (PosDiff > 0) then + PosDiff := W + else + PosDiff := 0; + X := Positions[PIndex].PUTargetX + PosDiff * Progress; + + PosDiff := Positions[PIndex].PUTargetY - Positions[PIndex].PUStartY; + If (PosDiff < 0) then + PosDiff := -Positions[PIndex].BGH + else + PosDiff := 0; + Y := Positions[PIndex].PUTargetY - PosDiff * (1-Progress); + + FontSize := Positions[PIndex].PUFontSize; + end + else + begin + //Here the Effect that Should be shown if a PopUp without Score is Drawn + //And or Spawn with the GraphicObjects etc. + //Some Work for Blindy to do :P + + //ATM: Just Let it Slide in the Scores just like the Normal PopUp + Alpha := 0; + end; + end; + + //Draw PopUp + + if (Alpha > 0) then + begin + //Draw BG: + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glColor4f(1,1,1, Alpha); + glBindTexture(GL_TEXTURE_2D, Settings.PopUpTex[PopUp.Rating].TexNum); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(X, Y); + glTexCoord2f(0, Settings.PopUpTex[PopUp.Rating].TexH); glVertex2f(X, Y + H); + glTexCoord2f(Settings.PopUpTex[PopUp.Rating].TexW, Settings.PopUpTex[PopUp.Rating].TexH); glVertex2f(X + W, Y + H); + glTexCoord2f(Settings.PopUpTex[PopUp.Rating].TexW, 0); glVertex2f(X + W, Y); + glEnd; + + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + //Set FontStyle and Size + SetFontStyle(Positions[PIndex].PUFont); + SetFontItalic(False); + SetFontSize(FontSize); + + //Draw Text + TextLen := glTextWidth(PChar(Theme.Sing.LineBonusText[PopUp.Rating])); + + //Color and Pos + SetFontPos (X + (W - TextLen) / 2, Y + 12); + glColor4f(1, 1, 1, Alpha); + + //Draw + glPrint(PChar(Theme.Sing.LineBonusText[PopUp.Rating])); + end; //eo Alpha check + end; //eo Right Screen + end; //eo Player has Position + end + else + Log.LogError('TSingScores: Try to Draw a not existing PopUp'); +end; + +//----------- +//Procedure Draws a Score by Playerindex +//----------- +Procedure TSingScores.DrawScore(const Index: Integer); +var + Position: PScorePosition; + ScoreStr: String; +begin + //Only Draw if Player has a Position + If Players[Index].Position <> high(byte) then + begin + //Only Draw if Player is on Cur Screen + If ((Players[Index].Position AND 128) = 0) = (ScreenAct = 1) then + begin + Position := @Positions[Players[Index].Position and 127]; + + //Draw ScoreBG + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glColor4f(1,1,1, 1); + glBindTexture(GL_TEXTURE_2D, Players[Index].ScoreBG.TexNum); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Position.BGX, Position.BGY); + glTexCoord2f(0, Players[Index].ScoreBG.TexH); glVertex2f(Position.BGX, Position.BGY + Position.BGH); + glTexCoord2f(Players[Index].ScoreBG.TexW, Players[Index].ScoreBG.TexH); glVertex2f(Position.BGX + Position.BGW, Position.BGY + Position.BGH); + glTexCoord2f(Players[Index].ScoreBG.TexW, 0); glVertex2f(Position.BGX + Position.BGW, Position.BGY); + glEnd; + + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + //Draw Score Text + SetFontStyle(Position.TextFont); + SetFontItalic(False); + SetFontSize(Position.TextSize); + SetFontPos(Position.TextX, Position.TextY); + + ScoreStr := InttoStr(Players[Index].ScoreDisplayed div 10) + '0'; + While (Length(ScoreStr) < 5) do + ScoreStr := '0' + ScoreStr; + + glPrint(PChar(ScoreStr)); + + end; //eo Right Screen + end; //eo Player has Position +end; + +end. diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index ff6bfe20..b953cc07 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -28,7 +28,8 @@ uses UMenu, UThemes, ULCD, UGraphicClasses, - UVideo; + UVideo, + USingScores; type TScreenSing = class(TMenu) @@ -45,46 +46,51 @@ type //eoa TimeBar mod StaticP1: integer; - StaticP1ScoreBG: integer; TextP1: integer; - TextP1Score: integer; + {StaticP1ScoreBG: integer; + TextP1Score: integer;} - //moveable singbar mod + {//moveable singbar mod StaticP1SingBar: integer; StaticP1ThreePSingBar: integer; StaticP1TwoPSingBar: integer; StaticP2RSingBar: integer; StaticP2MSingBar: integer; StaticP3SingBar: integer; - //eoa moveable singbar + //eoa moveable singbar } //Added for ps3 skin //shown when game is in 2/4 player modus StaticP1TwoP: integer; - StaticP1TwoPScoreBG: integer; TextP1TwoP: integer; - TextP1TwoPScore: integer; + + {StaticP1TwoPScoreBG: integer; + TextP1TwoPScore: integer;} //shown when game is in 3/6 player modus StaticP1ThreeP: integer; - StaticP1ThreePScoreBG: integer; TextP1ThreeP: integer; - TextP1ThreePScore: integer; + + {TextP1ThreePScore: integer; + StaticP1ThreePScoreBG: integer; } //eoa StaticP2R: integer; - StaticP2RScoreBG: integer; TextP2R: integer; - TextP2RScore: integer; + + {StaticP2RScoreBG: integer; + TextP2RScore: integer;} StaticP2M: integer; - StaticP2MScoreBG: integer; TextP2M: integer; - TextP2MScore: integer; + + {StaticP2MScoreBG: integer; + TextP2MScore: integer; } StaticP3R: integer; - StaticP3RScoreBG: integer; TextP3R: integer; - TextP3RScore: integer; + + {StaticP3RScoreBG: integer; + TextP3RScore: integer;} Tex_Background: TTexture; FadeOut: boolean; @@ -92,6 +98,9 @@ type // LyricSub: TLyric; Lyrics: TLyricEngine; + //Score Manager: + Scores: TSingScores; + constructor Create; override; procedure onShow; override; procedure onShowFinish; override; @@ -205,6 +214,10 @@ var begin inherited Create; + //Create Score Class + Scores := TSingScores.Create; + Scores.LoadfromTheme; + LoadFromTheme(Theme.Sing); //TimeBar @@ -213,45 +226,51 @@ begin // 1 player | P1 StaticP1 := AddStatic(Theme.Sing.StaticP1); - StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); TextP1 := AddText(Theme.Sing.TextP1); + + {StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); TextP1Score := AddText(Theme.Sing.TextP1Score); - StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar); + StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar);} // 2 or 4 players | P1 StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); - StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG); TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); + + {StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG); TextP1TwoPScore := AddText(Theme.Sing.TextP1TwoPScore); - StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); + StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar);} // | P2 StaticP2R := AddStatic(Theme.Sing.StaticP2R); - StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); TextP2R := AddText(Theme.Sing.TextP2R); + + {StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); TextP2RScore := AddText(Theme.Sing.TextP2RScore); - StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); + StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); } // 3 or 6 players | P1 StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); - StaticP1ThreePScoreBG := AddStatic(Theme.Sing.StaticP1ThreePScoreBG); TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); + + {StaticP1ThreePScoreBG := AddStatic(Theme.Sing.StaticP1ThreePScoreBG); TextP1ThreePScore := AddText(Theme.Sing.TextP1ThreePScore); - StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar); + StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar);} // | P2 StaticP2M := AddStatic(Theme.Sing.StaticP2M); - StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG); TextP2M := AddText(Theme.Sing.TextP2M); + + {StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG); TextP2MScore := AddText(Theme.Sing.TextP2MScore); - StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar); + StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar);} // | P3 StaticP3R := AddStatic(Theme.Sing.StaticP3R); - StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG); TextP3R := AddText(Theme.Sing.TextP3R); + + {StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG); TextP3RScore := AddText(Theme.Sing.TextP3RScore); - StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar); + StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar);} if ScreenAct = 2 then begin // katze und affe @@ -273,10 +292,24 @@ var V2M: boolean; V3R: boolean; NR: TRecR; //Line Bonus Mod + + Color: TRGB; begin Log.LogStatus('Begin', 'onShow'); FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented + //SetUp Score Manager + Scores.ClearPlayers; //Clear Old Player Values + Color.R := 0; Color.G := 0; Color.B := 0; //Dummy atm + For P := 0 to PlayersPlay -1 do //Add new Ones + begin + Scores.AddPlayer(Tex_ScoreBG[P], Color); + end; + + Scores.Init; //Get Positions for Players + + + // prepare players SetLength(Player, PlayersPlay); // Player[0].ScoreTotalI := 0; @@ -327,38 +360,44 @@ begin //This one is shown in 1P mode Static[StaticP1].Visible := V1; - Static[StaticP1ScoreBG].Visible := V1; Text[TextP1].Visible := V1; - Text[TextP1Score].Visible := V1; + + {Static[StaticP1ScoreBG].Visible := V1; + Text[TextP1Score].Visible := V1;} //This one is shown in 2/4P mode Static[StaticP1TwoP].Visible := V1TwoP; - Static[StaticP1TwoPScoreBG].Visible := V1TwoP; Text[TextP1TwoP].Visible := V1TwoP; - Text[TextP1TwoPScore].Visible := V1TwoP; + + {Static[StaticP1TwoPScoreBG].Visible := V1TwoP; + Text[TextP1TwoPScore].Visible := V1TwoP;} Static[StaticP2R].Visible := V2R; - Static[StaticP2RScoreBG].Visible := V2R; Text[TextP2R].Visible := V2R; - Text[TextP2RScore].Visible := V2R; + + {Static[StaticP2RScoreBG].Visible := V2R; + Text[TextP2RScore].Visible := V2R; } //This one is shown in 3/6P mode Static[StaticP1ThreeP].Visible := V1ThreeP; - Static[StaticP1ThreePScoreBG].Visible := V1ThreeP; Text[TextP1ThreeP].Visible := V1ThreeP; - Text[TextP1ThreePScore].Visible := V1ThreeP; + + {Static[StaticP1ThreePScoreBG].Visible := V1ThreeP; + Text[TextP1ThreePScore].Visible := V1ThreeP; } Static[StaticP2M].Visible := V2M; - Static[StaticP2MScoreBG].Visible := V2M; Text[TextP2M].Visible := V2M; - Text[TextP2MScore].Visible := V2M; + + {Static[StaticP2MScoreBG].Visible := V2M; + Text[TextP2MScore].Visible := V2M; } Static[StaticP3R].Visible := V3R; - Static[StaticP3RScoreBG].Visible := V3R; Text[TextP3R].Visible := V3R; - Text[TextP3RScore].Visible := V3R; + + {Static[StaticP3RScoreBG].Visible := V3R; + Text[TextP3RScore].Visible := V3R; } // load notes ResetSingTemp; @@ -559,7 +598,7 @@ begin GoldenRec.SentenceChange; //GoldenStarsTwinkle Mod End - //Set Position of Line Bonus - PhrasenBonus + {//Set Position of Line Bonus - PhrasenBonus if (Ini.LineBonus = 1) then //Show Line Bonus at Scores begin Case PlayersPlay of @@ -790,7 +829,8 @@ begin Player[5].LineBonus_StartY := 370 + 28; end; end; - end; + end; } + //Set Position of Line Bonus - PhrasenBonus End //Set Num of Empty Sentences for Phrasen Bonus NumEmptySentences := 0; @@ -949,17 +989,19 @@ begin // okay this stuff appears again some lines beneath this one, I commented it out for testing what it does - seems like it's doing nothing // but I might be wrong, so what is this stuff here doing? O.o Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; Text[TextP1].X := Text[TextP1].X + 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; + + {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; - Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; + + {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} // end of weird stuff for S := 1 to 1 do //wtf? @@ -977,7 +1019,7 @@ begin if Sec < 10 then Text[TextTimeText].Text := Text[TextTimeText].Text + '0'; Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec); - // .. and scores + {// .. and scores if PlayersPlay = 1 then begin Tekst := IntToStr(Player[0].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -1056,7 +1098,7 @@ begin while Length(Tekst) < 5 do Tekst := '0' + Tekst; Text[TextP3RScore].Text := Tekst; end; - end; + end; } // draw static menu (BG) DrawBG; @@ -1112,23 +1154,26 @@ begin GoldenRec.SpawnRec; //GoldenNoteStarsTwinkle Mod + //Draw Scores + Scores.Draw; + // back stereo // weird stuff, maybe this is for "dual screen?", but where is player three then? // okay this stuff appears again some lines above this one, I commented it out for testing what it does - seems like it's doing nothing // but I might be wrong, so what is this stuff here doing? O.o Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; - Text[TextP1].X := Text[TextP1].X - 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; + {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX;} - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; - Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; + + {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX;} //weird end for S := 1 to 1 do // wtf? @@ -1229,7 +1274,7 @@ begin //Update Total Score Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; - //Color + {//Color Case Floor(A) of 0: begin Player[I].LineBonus_Color.R := 1; @@ -1265,7 +1310,15 @@ begin Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; Player[I].LineBonus_Alpha := 0.92; Player[I].LineBonus_Visible := True; - Player[I].LineBonus_Age := 1; + Player[I].LineBonus_Age := 1;} + + //Spawn PopUp + If (A >= 8) then + A := 8 + else IF A < 0 then + A := 0; + //Round(Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8)); + Scores.SpawnPopUp(I, Floor(A), Player[I].ScoreTotalI); end; //PhrasenBonus - Line Bonus Mod End// } diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 455d7b40..44615662 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -1,4 +1,4 @@ -unit UScreenSingModi; +unit UScreenSingModi; interface @@ -158,456 +158,456 @@ begin end; procedure TScreenSingModi.onShow; -var - I: Integer; -begin - - PlayersPlay := TeamInfo.NumTeams; - - if DLLMan.Selected.LoadSong then //Start with Song - begin - inherited; - end - else //Start Without Song - begin - Music.CaptureStart; - end; - -//Set Playerinfo - PlayerInfo.NumPlayers := PlayersPlay; - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); - PlayerInfo.Playerinfo[I].Score := 0; - PlayerInfo.Playerinfo[I].Bar := 50; - PlayerInfo.Playerinfo[I].Enabled := True; - end; - - for I := PlayerInfo.NumPlayers to high(PlayerInfo.Playerinfo) do - begin - PlayerInfo.Playerinfo[I].Score:= 0; - PlayerInfo.Playerinfo[I].Bar := 0; - PlayerInfo.Playerinfo[I].Enabled := False; - end; - - Case PlayersPlay of - 1: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; - end; - 2,4: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1TwoPScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; - PlayerInfo.Playerinfo[2].PosX := Static[StaticP1TwoPScoreBG].Texture.X; - PlayerInfo.Playerinfo[2].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; - PlayerInfo.Playerinfo[1].PosX := Static[StaticP2RScoreBG].Texture.X; - PlayerInfo.Playerinfo[1].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; - PlayerInfo.Playerinfo[3].PosX := Static[StaticP2RScoreBG].Texture.X; - PlayerInfo.Playerinfo[3].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; - end; - 3,6: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ThreePScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; - PlayerInfo.Playerinfo[3].PosX := Static[StaticP1ThreePScoreBG].Texture.X; - PlayerInfo.Playerinfo[3].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; - PlayerInfo.Playerinfo[1].PosX := Static[StaticP2MScoreBG].Texture.X; - PlayerInfo.Playerinfo[1].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; - PlayerInfo.Playerinfo[4].PosX := Static[StaticP2MScoreBG].Texture.X; - PlayerInfo.Playerinfo[4].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; - PlayerInfo.Playerinfo[2].PosX := Static[StaticP3RScoreBG].Texture.X; - PlayerInfo.Playerinfo[2].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; - PlayerInfo.Playerinfo[5].PosX := Static[StaticP3RScoreBG].Texture.X; - PlayerInfo.Playerinfo[5].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; - end; - end; - - // play music (I) - //Music.CaptureStart; - //Music.MoveTo(AktSong.Start); - - //Init Plugin - if not DLLMan.PluginInit(TeamInfo, PlayerInfo, ToSentences(Czesci[0]), LoadTex, Print, LoadSound, PlaySound) then - begin - //Fehler - Log.LogError('Could not Init Plugin'); - Halt; - end; - - // Set Background (Little Workaround, maybe change sometime) - if (DLLMan.Selected.LoadBack) AND (DLLMan.Selected.LoadSong) then - ScreenSing.Tex_Background := Tex_Background; - - Winner := 0; - - //Set Score Visibility - if PlayersPlay = 1 then begin - Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; - Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; - end; - - if (PlayersPlay = 2) OR (PlayersPlay = 4) then begin - Text[TextP1TwoPScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP1TwoPScoreBG].Visible := DLLMan.Selected.ShowScore; - - Text[TextP2RScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP2RScoreBG].Visible := DLLMan.Selected.ShowScore; - end; - - if (PlayersPlay = 3) OR (PlayersPlay = 6) then begin - Text[TextP1ThreePScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP1ThreePScoreBG].Visible := DLLMan.Selected.ShowScore; - - Text[TextP2MScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP2MScoreBG].Visible := DLLMan.Selected.ShowScore; - - Text[TextP3RScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP3RScoreBG].Visible := DLLMan.Selected.ShowScore; - end; -end; - -function TScreenSingModi.Draw: boolean; -var - Min: integer; - Sec: integer; - Tekst: string; - S, I: integer; - T: integer; -begin -//Set Playerinfo - PlayerInfo.NumPlayers := PlayersPlay; - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - PlayerInfo.Playerinfo[I].Name := PChar(Player[I].Name); - if PlayerInfo.Playerinfo[I].Enabled then - begin - if (Player[I].ScoreTotalI<=10000) then - PlayerInfo.Playerinfo[I].Score:= Player[I].ScoreTotalI; - PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; - end; - end; - -//Show Score -if DLLMan.Selected.ShowScore then -begin - //ScoreBG Mod - // set player colors - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - - - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - - - - end; - if ScreenAct = 2 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P4Dark'); - - - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); - - - - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P3Dark'); - - - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); - - - - end; - if ScreenAct = 2 then begin - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P6Dark'); - - - - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); - - - - - end; - end; - //end ScoreBG Mod - -// set player names (for 2 screens and only Singstar skin) - if ScreenAct = 1 then begin - Text[TextP1].Text := 'P1'; - Text[TextP1TwoP].Text := 'P1'; // added for ps3 skin - Text[TextP1ThreeP].Text := 'P1'; // added for ps3 skin - Text[TextP2R].Text := 'P2'; - Text[TextP2M].Text := 'P2'; - Text[TextP3R].Text := 'P3'; - end; - - if ScreenAct = 2 then begin - case PlayersPlay of - 4: begin - Text[TextP1TwoP].Text := 'P3'; - Text[TextP2R].Text := 'P4'; - end; - 6: begin - Text[TextP1ThreeP].Text := 'P4'; - Text[TextP2M].Text := 'P5'; - Text[TextP3R].Text := 'P6'; - end; - end; // case - end; // if - - - // stereo <- and where iss P2M? or P3? - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; - - Text[TextP1].X := Text[TextP1].X + 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; - Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; - - Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; - - // .. and scores - if PlayersPlay = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; - end; - - if PlayersPlay = 2 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - - if PlayersPlay = 3 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[4].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[5].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - end; - -end; //ShowScore - - for S := 1 to 1 do - Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X + 10*ScreenX; - -if DLLMan.Selected.LoadSong then -begin - // update static menu with time ... - Min := Round(Czas.Teraz) div 60; - Sec := Round(Czas.Teraz) mod 60; - 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); -end; - - // draw static menu (BG) - DrawBG; - - //Draw Background - if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) then - SingDrawBackground; - - // comment by blindy: wo zum henker wird denn in diesem screen ein video abgespielt? - // update and draw movie - // wie wo wadd? also in der selben funktion in der uscreensing kommt des video in der zeile 995, oder was wollteste wissen? :X -{ if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin - UpdateSmpeg; // this only draws - end;} - - // draw static menu (FG) - DrawFG; - - if ShowFinish then begin - if DllMan.Selected.LoadSong then - begin - if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin - //Pause Mod: - if not Paused then - Sing(Self); // analyze song - end else begin - if not FadeOut then begin - Finish; - FadeOut := true; - FadeTo(@ScreenPartyScore); - end; - end; - end; - end; - - // draw custom items - SingModiDraw(PlayerInfo); // always draw - - //GoldenNoteStarsTwinkle Mod - GoldenRec.SpawnRec; - //GoldenNoteStarsTwinkle Mod - - //Update PlayerInfo - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - if PlayerInfo.Playerinfo[I].Enabled then - begin - PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; - PlayerInfo.Playerinfo[I].Score := Player[I].ScoreTotalI; - end; - end; - - if ((ShowFinish) AND (NOT Paused)) then - begin - if not DLLMan.PluginDraw(Playerinfo, Czesci[0].Akt) then - begin - if not FadeOut then begin - Finish; - FadeOut := true; - FadeTo(@ScreenPartyScore); - end; - end; - end; - - //Change PlayerInfo/Changeables - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - if (Player[I].ScoreTotalI <> PlayerInfo.Playerinfo[I].Score) then - begin - //Player[I].ScoreTotal := Player[I].ScoreTotal + (PlayerInfo.Playerinfo[I].Score - Player[I].ScoreTotalI); - Player[I].ScoreTotalI := PlayerInfo.Playerinfo[I].Score; - end; - if (PlayerInfo.Playerinfo[I].Bar <> Player[I].ScorePercent) then - Player[I].ScorePercentTarget := PlayerInfo.Playerinfo[I].Bar; - end; - - // back stereo - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; - - Text[TextP1].X := Text[TextP1].X - 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; - - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; - Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; - - Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; - - - for S := 1 to 1 do - Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X - 10*ScreenX; - - +var + I: Integer; +begin + + PlayersPlay := TeamInfo.NumTeams; + + if DLLMan.Selected.LoadSong then //Start with Song + begin + inherited; + end + else //Start Without Song + begin + Music.CaptureStart; + end; + +//Set Playerinfo + PlayerInfo.NumPlayers := PlayersPlay; + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); + PlayerInfo.Playerinfo[I].Score := 0; + PlayerInfo.Playerinfo[I].Bar := 50; + PlayerInfo.Playerinfo[I].Enabled := True; + end; + + for I := PlayerInfo.NumPlayers to high(PlayerInfo.Playerinfo) do + begin + PlayerInfo.Playerinfo[I].Score:= 0; + PlayerInfo.Playerinfo[I].Bar := 0; + PlayerInfo.Playerinfo[I].Enabled := False; + end; + + {Case PlayersPlay of + 1: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; + end; + 2,4: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1TwoPScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; + PlayerInfo.Playerinfo[2].PosX := Static[StaticP1TwoPScoreBG].Texture.X; + PlayerInfo.Playerinfo[2].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; + PlayerInfo.Playerinfo[1].PosX := Static[StaticP2RScoreBG].Texture.X; + PlayerInfo.Playerinfo[1].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; + PlayerInfo.Playerinfo[3].PosX := Static[StaticP2RScoreBG].Texture.X; + PlayerInfo.Playerinfo[3].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; + end; + 3,6: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ThreePScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; + PlayerInfo.Playerinfo[3].PosX := Static[StaticP1ThreePScoreBG].Texture.X; + PlayerInfo.Playerinfo[3].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; + PlayerInfo.Playerinfo[1].PosX := Static[StaticP2MScoreBG].Texture.X; + PlayerInfo.Playerinfo[1].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; + PlayerInfo.Playerinfo[4].PosX := Static[StaticP2MScoreBG].Texture.X; + PlayerInfo.Playerinfo[4].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; + PlayerInfo.Playerinfo[2].PosX := Static[StaticP3RScoreBG].Texture.X; + PlayerInfo.Playerinfo[2].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; + PlayerInfo.Playerinfo[5].PosX := Static[StaticP3RScoreBG].Texture.X; + PlayerInfo.Playerinfo[5].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; + end; + end; } + + // play music (I) + //Music.CaptureStart; + //Music.MoveTo(AktSong.Start); + + //Init Plugin + if not DLLMan.PluginInit(TeamInfo, PlayerInfo, ToSentences(Czesci[0]), LoadTex, Print, LoadSound, PlaySound) then + begin + //Fehler + Log.LogError('Could not Init Plugin'); + Halt; + end; + + // Set Background (Little Workaround, maybe change sometime) + if (DLLMan.Selected.LoadBack) AND (DLLMan.Selected.LoadSong) then + ScreenSing.Tex_Background := Tex_Background; + + Winner := 0; + + //Set Score Visibility + {if PlayersPlay = 1 then begin + Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; + end; + + if (PlayersPlay = 2) OR (PlayersPlay = 4) then begin + Text[TextP1TwoPScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1TwoPScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP2RScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP2RScoreBG].Visible := DLLMan.Selected.ShowScore; + end; + + if (PlayersPlay = 3) OR (PlayersPlay = 6) then begin + Text[TextP1ThreePScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1ThreePScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP2MScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP2MScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP3RScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP3RScoreBG].Visible := DLLMan.Selected.ShowScore; + end; } +end; + +function TScreenSingModi.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + S, I: integer; + T: integer; +begin +//Set Playerinfo + PlayerInfo.NumPlayers := PlayersPlay; + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + PlayerInfo.Playerinfo[I].Name := PChar(Player[I].Name); + if PlayerInfo.Playerinfo[I].Enabled then + begin + if (Player[I].ScoreTotalI<=10000) then + PlayerInfo.Playerinfo[I].Score:= Player[I].ScoreTotalI; + PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; + end; + end; + +//Show Score +if DLLMan.Selected.ShowScore then +begin + {//ScoreBG Mod + // set player colors + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + + + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P4Dark'); + + + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); + + + + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P3Dark'); + + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P6Dark'); + + + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); + + + + + end; + end; + //end ScoreBG Mod } + +// set player names (for 2 screens and only Singstar skin) + if ScreenAct = 1 then begin + Text[TextP1].Text := 'P1'; + Text[TextP1TwoP].Text := 'P1'; // added for ps3 skin + Text[TextP1ThreeP].Text := 'P1'; // added for ps3 skin + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; + end; + + if ScreenAct = 2 then begin + case PlayersPlay of + 4: begin + Text[TextP1TwoP].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 6: begin + Text[TextP1ThreeP].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end; + end; // case + end; // if + + + // stereo <- and where iss P2M? or P3? + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; + Text[TextP1].X := Text[TextP1].X + 10*ScreenX; + + {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; + Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; + + {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} + + // .. and scores + {if PlayersPlay = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + end; + + if PlayersPlay = 2 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + + if PlayersPlay = 3 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[4].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[5].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + end; } + +end; //ShowScore + + for S := 1 to 1 do + Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X + 10*ScreenX; + +if DLLMan.Selected.LoadSong then +begin + // update static menu with time ... + Min := Round(Czas.Teraz) div 60; + Sec := Round(Czas.Teraz) mod 60; + 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); +end; + + // draw static menu (BG) + DrawBG; + + //Draw Background + if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) then + SingDrawBackground; + + // comment by blindy: wo zum henker wird denn in diesem screen ein video abgespielt? + // update and draw movie + // wie wo wadd? also in der selben funktion in der uscreensing kommt des video in der zeile 995, oder was wollteste wissen? :X +{ if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin + UpdateSmpeg; // this only draws + end;} + + // draw static menu (FG) + DrawFG; + + if ShowFinish then begin + if DllMan.Selected.LoadSong then + begin + if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + //Pause Mod: + if not Paused then + Sing(Self); // analyze song + end else begin + if not FadeOut then begin + Finish; + FadeOut := true; + FadeTo(@ScreenPartyScore); + end; + end; + end; + end; + + // draw custom items + SingModiDraw(PlayerInfo); // always draw + + //GoldenNoteStarsTwinkle Mod + GoldenRec.SpawnRec; + //GoldenNoteStarsTwinkle Mod + + //Update PlayerInfo + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + if PlayerInfo.Playerinfo[I].Enabled then + begin + PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; + PlayerInfo.Playerinfo[I].Score := Player[I].ScoreTotalI; + end; + end; + + if ((ShowFinish) AND (NOT Paused)) then + begin + if not DLLMan.PluginDraw(Playerinfo, Czesci[0].Akt) then + begin + if not FadeOut then begin + Finish; + FadeOut := true; + FadeTo(@ScreenPartyScore); + end; + end; + end; + + //Change PlayerInfo/Changeables + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + if (Player[I].ScoreTotalI <> PlayerInfo.Playerinfo[I].Score) then + begin + //Player[I].ScoreTotal := Player[I].ScoreTotal + (PlayerInfo.Playerinfo[I].Score - Player[I].ScoreTotalI); + Player[I].ScoreTotalI := PlayerInfo.Playerinfo[I].Score; + end; + if (PlayerInfo.Playerinfo[I].Bar <> Player[I].ScorePercent) then + Player[I].ScorePercentTarget := PlayerInfo.Playerinfo[I].Bar; + end; + + // back stereo + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; + Text[TextP1].X := Text[TextP1].X - 10*ScreenX; + + {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX;} + + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; + Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; + + {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX;} + + + for S := 1 to 1 do + Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X - 10*ScreenX; + + end; procedure TScreenSingModi.Finish; @@ -667,3 +667,4 @@ begin end; end. +>>>>>>> .r429 diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index f7dd7e9b..6aafda26 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -92,12 +92,14 @@ uses UParty in 'Classes\UParty.pas', UPlaylist in 'Classes\UPlaylist.pas', UCommandLine in 'Classes\UCommandLine.pas', + USingScores in 'Classes\USingScores.pas', + USingNotes in 'Classes\USingNotes.pas', //------------------------------ //Includes - Video Support //------------------------------ UVideo in 'Classes\UVideo.pas', - + //------------------------------ //Includes - Screens //------------------------------ @@ -233,7 +235,7 @@ begin Log.BenchmarkStart(1); Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; Ini.Load; - + //Load Languagefile if (Params.Language <> -1) then Language.ChangeLanguage(ILanguage[Params.Language]) @@ -307,7 +309,7 @@ begin Log.BenchmarkStart(1); Log.LogStatus('PartySession Manager', 'Initialization'); PartySession := TParty_Session.Create; //Load PartySession - + Log.BenchmarkEnd(1); Log.LogBenchmark('Loading PartySession Manager', 1); @@ -380,5 +382,5 @@ begin if Ini.LPT = 2 then Light.TurnOff; Log.Free; -end. +end. -- cgit v1.2.3 From 739ad9a6dee57375f05dcd20dc59ba2d619f11fa Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 24 Sep 2007 13:31:43 +0000 Subject: fixed song loading in Lazarus.. cant assume variables are initialized as 0 :) in UFile "Done: byte;" was no initialized on lazarus compiler. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@431 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.pas | 106 ++- Game/Code/Classes/UFiles.pas | 13 +- Game/Code/Classes/USingScores.pas | 16 +- Game/Code/Classes/USongs.pas | 1509 +++++++++++++++++++------------------ Game/Code/Classes/UTexture.pas | 11 +- Game/Code/Classes/UThemes.pas | 25 +- Game/Code/Menu/UMenu.pas | 1 + Game/Code/Menu/UMenuText.pas | 4 +- 8 files changed, 866 insertions(+), 819 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index e8d5e878..5ce3ebf7 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -119,6 +119,9 @@ var begin ActFont := 0; + Log.LogStatus( '' , '---------------------------'); + + Log.LogStatus( 'Font' , '---------------------------'); SetLength(Fonts, 5); Fonts[0].Tex := Texture.LoadTexture(true, 'Font', 'PNG', 'Font', 0); Fonts[0].Tex.H := 30; @@ -126,18 +129,22 @@ begin Fonts[0].Done := -1; Fonts[0].Outline := 0; + Log.LogStatus( 'FontB' , '---------------------------'); + Fonts[1].Tex := Texture.LoadTexture(true, 'FontB', 'PNG', 'Font', 0); Fonts[1].Tex.H := 30; Fonts[1].AspectW := 1; Fonts[1].Done := -1; Fonts[1].Outline := 0; + Log.LogStatus( 'FontO' , '---------------------------'); Fonts[2].Tex := Texture.LoadTexture(true, 'FontO', 'PNG', 'Font Outline', 0); Fonts[2].Tex.H := 30; Fonts[2].AspectW := 0.95; Fonts[2].Done := -1; Fonts[2].Outline := 5; + Log.LogStatus( 'FontO2' , '---------------------------'); Fonts[3].Tex := Texture.LoadTexture(true, 'FontO2', 'PNG', 'Font Outline 2', 0); Fonts[3].Tex.H := 30; Fonts[3].AspectW := 0.95; @@ -212,41 +219,48 @@ var PR, PB: real; XItal: real; // X shift for italic type letter begin - with Fonts[ActFont].Tex do begin - FWidth := Fonts[ActFont].Width[Ord(Letter)]; - - W := FWidth * (H/30) * Fonts[ActFont].AspectW; -// H := 30; - - // set texture positions - TexX := (ord(Letter) mod 16) * 1/16 + 1/32 - FWidth/1024 - Fonts[ActFont].Outline/1024; - TexY := (ord(Letter) div 16) * 1/16 + 2/1024; // 2/1024 - TexR := (ord(Letter) mod 16) * 1/16 + 1/32 + FWidth/1024 + Fonts[ActFont].Outline/1024; - TexB := (1 + ord(Letter) div 16) * 1/16 - 2/1024; - - // set vector positions - PL := X - Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW /2; - PT := Y; - PR := PL + W + Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW; - PB := PT + H; - if Fonts[ActFont].Italic = false then - XItal := 0 - else - XItal := 12; + with Fonts[ActFont].Tex do + begin + FWidth := Fonts[ActFont].Width[Ord(Letter)]; + + W := FWidth * (H/30) * Fonts[ActFont].AspectW; + // H := 30; + + // set texture positions + TexX := (ord(Letter) mod 16) * 1/16 + 1/32 - FWidth/1024 - Fonts[ActFont].Outline/1024; + TexY := (ord(Letter) div 16) * 1/16 + 2/1024; // 2/1024 + TexR := (ord(Letter) mod 16) * 1/16 + 1/32 + FWidth/1024 + Fonts[ActFont].Outline/1024; + TexB := (1 + ord(Letter) div 16) * 1/16 - 2/1024; + + // set vector positions + PL := X - Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW /2; + PT := Y; + PR := PL + W + Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW; + PB := PT + H; + + if Fonts[ActFont].Italic = false then + XItal := 0 + else + XItal := 12; + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, TexNum); + + glBegin(GL_QUADS); + try + glTexCoord2f(TexX, TexY); glVertex2f(PL+XItal, PT); + glTexCoord2f(TexX, TexB); glVertex2f(PL, PB); + glTexCoord2f(TexR, TexB); glVertex2f(PR, PB); + glTexCoord2f(TexR, TexY); glVertex2f(PR+XItal, PT); + finally + glEnd; + end; - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, TexNum); - glBegin(GL_QUADS); - glTexCoord2f(TexX, TexY); glVertex2f(PL+XItal, PT); - glTexCoord2f(TexX, TexB); glVertex2f(PL, PB); - glTexCoord2f(TexR, TexB); glVertex2f(PR, PB); - glTexCoord2f(TexR, TexY); glVertex2f(PR+XItal, PT); - glEnd; - X := X + W; - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); + X := X + W; + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); end; // with end; @@ -307,19 +321,33 @@ end; procedure glPrint(text: pchar); // Custom GL "Print" Routine var - Letter: char; +// Letter : char; + iPos : Integer; begin - if (Text = '') then // If There's No Text - Exit; // Do Nothing + if (Text = '') then // If There's No Text + Exit; // Do Nothing - while (length(text) > 0) do begin +(* + while (length(text) > 0) do + begin // cut Letter := Text[0]; - Text := pchar(Copy(Text, 2, Length(Text)-1)); + Text := pchar(Copy(Text, 2, Length(Text)-1)); // print glPrintLetter(Letter); end; // while +*) + + // This code is better, because doing a Copy of for every + // letter in a string is a waste of CPU & Memory resources. + // Copy operations are quite memory intensive, and this simple + // code achieves the same result. + for iPos := 0 to length( text ) - 1 do + begin + glPrintLetter( Text[iPos] ); + end; + end; procedure glPrintCut(text: pchar); diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index 34342e26..565c5ee3 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -137,11 +137,12 @@ end; //-------------------- function ReadTXTHeader(var Song: TSong): boolean; var -Line, Identifier, Value: String; -Temp: word; -Done: byte; + Line, Identifier, Value: String; + Temp: word; + Done: byte; begin Result := true; + Done := 0; //Read first Line ReadLn (SongFile, Line); @@ -167,6 +168,8 @@ begin Identifier := Uppercase(Trim(Copy(Line, 2, Temp - 2))); //Uppercase is for Case Insensitive Checks Value := Trim(Copy(Line, Temp + 1,Length(Line) - Temp)); + Log.LogError('Identifier: '+Identifier+' - '+ Value ); + //Check the Identifier (If Value is given) if (Length(Value) <> 0) then begin @@ -332,7 +335,7 @@ begin else begin Result := False; - Log.LogError('File Incomplete or not Ultrastar TxT: ' + Song.FileName); + Log.LogError('File Incomplete or not Ultrastar TxT (A): ' + Song.FileName); break; end; @@ -354,7 +357,7 @@ begin else if (Done and 1) = 0 then //No Title Flag Log.LogError('Title Tag Missing: ' + Song.FileName) else //unknown Error - Log.LogError('File Incomplete or not Ultrastar TxT: ' + Song.FileName); + Log.LogError('File Incomplete or not Ultrastar TxT (B - '+ inttostr(Done) +'): ' + Song.FileName); end; end; diff --git a/Game/Code/Classes/USingScores.pas b/Game/Code/Classes/USingScores.pas index 27a65b32..881a5515 100644 --- a/Game/Code/Classes/USingScores.pas +++ b/Game/Code/Classes/USingScores.pas @@ -1,7 +1,14 @@ unit USingScores; interface -uses UThemes, OpenGl12, UTexture; + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses UThemes, + OpenGl12, + UTexture; //Some Constances containing Options that could change by time const @@ -158,7 +165,12 @@ type implementation -uses SDL, SysUtils, ULog, UGraphic, TextGL; + +uses SDL, + SysUtils, + ULog, + UGraphic, + TextGL; //----------- //Constructor just sets some standard Settings diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 301eb15c..e236abf0 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -1,753 +1,756 @@ -unit USongs; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - -uses SysUtils, ULog, UTexture, UCatCovers; - -type - TBPM = record - BPM: real; - StartBeat: real; - end; - - TScore = record - Name: string; - Score: integer; - Length: string; - end; - - TSong = record - Path: string; - Folder: string; // for sorting by folder - FileName: string; - - // sorting methods - Category: array of string; // I think I won't need this - Genre: string; - Edition: string; - Language: string; // 0.5.0: new - - Title: string; - Artist: string; - - Text: string; - Creator: string; - - Cover: string; - CoverTex: TTexture; - Mp3: string; - Background: string; - Video: string; - VideoGAP: real; - VideoLoaded: boolean; // 0.5.0: true if the video has been loaded - NotesGAP: integer; - Start: real; // in seconds - Finish: integer; // in miliseconds - Relative: boolean; - Resolution: integer; - BPM: array of TBPM; - GAP: real; // in miliseconds - - Score: array[0..2] of array of TScore; - - // these are used when sorting is enabled - Visible: boolean; // false if hidden, true if visible - Main: boolean; // false for songs, true for category buttons - OrderNum: integer; // has a number of category for category buttons and songs - OrderTyp: integer; // type of sorting for this button (0=name) - CatNumber: integer; // Count of Songs in Category for Cats and Number of Song in Category for Songs - end; - - TSongs = class - private - BrowsePos: Cardinal; //Actual Pos in Song Array - public - Song: array of TSong; // array of songs - Selected: integer; // selected song index - procedure LoadSongList; // load all songs - procedure BrowseDir(Dir: string); // should return number of songs in the future - procedure Sort(Order: integer); - function FindSongFile(Dir, Mask: string): string; - end; - - TCatSongs = class - Song: array of TSong; // array of categories with songs - Selected: integer; // selected song index - Order: integer; // order type (0=title) - CatNumShow: integer; // Category Number being seen - CatCount: integer; //Number of Categorys - - procedure Refresh; // refreshes arrays by recreating them from Songs array -// procedure Sort(Order: integer); - procedure ShowCategory(Index: integer); // expands all songs in category - procedure HideCategory(Index: integer); // hides all songs in category - procedure ClickCategoryButton(Index: integer); // uses ShowCategory and HideCategory when needed - procedure ShowCategoryList; //Hides all Songs And Show the List of all Categorys - function FindNextVisible(SearchFrom:integer): integer; //Find Next visible Song - function VisibleSongs: integer; // returns number of visible songs (for tabs) - function VisibleIndex(Index: integer): integer; // returns visible song index (skips invisible) - - function SetFilter(FilterStr: String; const fType: Byte): Cardinal; - end; - -var - Songs: TSongs; // all songs - CatSongs: TCatSongs; // categorized songs - AktSong: TSong; // one song *unknown use) - -implementation - -uses StrUtils, - UFiles, - UMain, - UIni; - - -procedure TSongs.LoadSongList; -begin - Log.LogStatus('Initializing', 'LoadSongList'); - - // clear - Setlength(Song, 50); - - BrowsePos := 0; - // browse directories - BrowseDir(SongPath); - - //Set Correct SongArray Length - SetLength(Song, BrowsePos); -// if Ini.Debug = 1 then BrowseDir('D:\Extract\Songs\'); -end; - -procedure TSongs.BrowseDir(Dir: string); -var - SR: TSearchRec; // for parsing Songs Directory - SLen: integer; -begin - if FindFirst(Dir + '*', faDirectory, SR) = 0 then begin - repeat - if (SR.Name <> '.') and (SR.Name <> '..') then - BrowseDir(Dir + Sr.Name + PathDelim); - until FindNext(SR) <> 0; - end; // if - FindClose(SR); - -// Log.LogStatus('Parsing directory: ' + Dir + SR.Name, 'LoadSongList'); - - if FindFirst(Dir + '*.txt', 0, SR) = 0 then begin -// Log.LogStatus('Parsing file: ' + Dir + SR.Name + '\' + SRD.Name, 'LoadSongList'); - repeat - //New Mod for better Memory Management - - SLen := BrowsePos; - {//Old - SLen := Length(Song); - SetLength(Song, SLen + 1);//} - - Song[SLen].Path := Dir; - Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); - Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); - Song[SLen].FileName := SR.Name; - - if (AnalyseFile(Song[SLen]) = false) then Dec(BrowsePos) - else begin - // scanning complete, file is good - // if there is no cover then try to find it - if Song[SLen].Cover = '' then Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); -// if Song[SLen].Background = '' then begin -// Song[SLen].Background := FindSongFile(Dir, '*[BG].jpg'); -// end; // no needed here} - - // fix by adding path. no, don't fix it. -// if Song[SLen].Cover <> '' then -// Song[SLen].Cover := Song[SLen].Path + Song[SLen].Cover; - end; - - //Change Length Only every 50 Entrys - Inc(BrowsePos); - - if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then - begin - SetLength(Song, Length(Song) + 50); - end; - - until FindNext(SR) <> 0; - end; // if FindFirst - FindClose(SR); -end; - -procedure TSongs.Sort(Order: integer); -var - S: integer; - S2: integer; - TempSong: TSong; -begin - case Order of - sEdition: // by edition - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Edition, Song[S-1].Edition) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sGenre: // by genre - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Genre, Song[S-1].Genre) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sTitle: // by title - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - - end; - sArtist: // by artist - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sFolder: // by folder - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Folder, Song[S-1].Folder) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sTitle2: // by title2 - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - - end; - sArtist2: // by artist2 - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sLanguage: // by Language - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Language, Song[S-1].Language) < 0 then begin - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - - end; // case -end; - -function TSongs.FindSongFile(Dir, Mask: string): string; -var - SR: TSearchRec; // for parsing song directory -begin - Result := ''; - if FindFirst(Dir + Mask, faDirectory, SR) = 0 then begin - Result := SR.Name; - end; // if - FindClose(SR); -end; - -procedure TCatSongs.Refresh; -var - S: integer; // temporary song index - CatLen: integer; // length of CatSongs.Song - Letter: char; // current letter for sorting using letter - SS: string; // current edition for sorting using edition, genre etc. - Order: integer; // number used for ordernum - Letter2: char; // - CatNumber:integer; // Number of Song in Category -begin - CatNumShow := -1; -// Songs.Sort(0); // by title - -case Ini.Sorting of - sEdition: begin - Songs.Sort(sArtist); - Songs.Sort(sEdition); - end; - sGenre: begin - Songs.Sort(sArtist); - Songs.Sort(sGenre); - end; - sLanguage: begin - Songs.Sort(sArtist); - Songs.Sort(sLanguage); - end; - sFolder: begin - Songs.Sort(sArtist); - Songs.Sort(sFolder); - end; - sTitle: Songs.Sort(sTitle); - sArtist: Songs.Sort(sArtist); - sTitle2: Songs.Sort(sTitle2); // by title2 - sArtist2: Songs.Sort(sArtist2); // by artist2 - - end; // case - - - Letter := ' '; - SS := ''; - Order := 0; - CatNumber := 0; - - //Songs leeren - SetLength (Song, 0); - - for S := Low(Songs.Song) to High(Songs.Song) do begin - if (Ini.Tabs = 1) then - if (Ini.Sorting = sEdition) and (CompareText(SS, Songs.Song[S].Edition) <> 0) then begin - // add Category Button - Inc(Order); - SS := Songs.Song[S].Edition; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + SS + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - - - // 0.4.3 - // if SS = 'Singstar' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Part 2' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar German' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Spanish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Italian' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar French' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Party' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Party.jpg'; - // if SS = 'Singstar Popworld' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Popworld.jpg'; - // if SS = 'Singstar 80s' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; - // if SS = 'Singstar 80s Polish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; - // if SS = 'Singstar Rocks' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Rocks.jpg'; - // if SS = 'Singstar Anthems' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Anthems.jpg'; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';//} - - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sGenre) and (CompareText(SS, Songs.Song[S].Genre) <> 0) then begin - // add Genre Button - Inc(Order); - SS := Songs.Song[S].Genre; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sLanguage) and (CompareText(SS, Songs.Song[S].Language) <> 0) then begin - // add Language Button - Inc(Order); - SS := Songs.Song[S].Language; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sTitle) and (Length(Songs.Song[S].Title)>=1) and (Letter <> UpCase(Songs.Song[S].Title[1])) then begin - // add a letter Category Button - Inc(Order); - Letter := UpCase(Songs.Song[S].Title[1]); - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - - {// cover-patch - if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sArtist) and (Length(Songs.Song[S].Artist)>=1) and (Letter <> UpCase(Songs.Song[S].Artist[1])) then begin - // add a letter Category Button - Inc(Order); - Letter := UpCase(Songs.Song[S].Artist[1]); - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sFolder) and (CompareText(SS, Songs.Song[S].Folder) <> 0) then begin - // 0.5.0: add folder tab - Inc(Order); - SS := Songs.Song[S].Folder; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sTitle2) AND (Length(Songs.Song[S].Title)>=1) then begin - if (ord(Songs.Song[S].Title[1]) > 47) and (ord(Songs.Song[S].Title[1]) < 58) then Letter2 := '#' else Letter2 := UpCase(Songs.Song[S].Title[1]); - if (Letter <> Letter2) then begin - // add a letter Category Button - Inc(Order); - Letter := Letter2; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end; - end - - else if (Ini.Sorting = sArtist2) AND (Length(Songs.Song[S].Artist)>=1) then begin - if (ord(Songs.Song[S].Artist[1]) > 47) and (ord(Songs.Song[S].Artist[1]) < 58) then Letter2 := '#' else Letter2 := UpCase(Songs.Song[S].Artist[1]); - if (Letter <> Letter2) then begin - // add a letter Category Button - Inc(Order); - Letter := Letter2; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end; - end; - - - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - - Inc (CatNumber); //Increase Number in Cat - - CatSongs.Song[CatLen] := Songs.Song[S]; - CatSongs.Song[CatLen].OrderNum := Order; // assigns category - CatSongs.Song[CatLen].CatNumber := CatNumber; - - if (Ini.Tabs = 0) then CatSongs.Song[CatLen].Visible := true - else if (Ini.Tabs = 1) then CatSongs.Song[CatLen].Visible := false; -// if (Ini.Tabs = 1) and (Order = 1) then CatSongs.Song[CatLen].Visible := true; // open first tab -//CatSongs.Song[CatLen].Visible := true; - - end; -//CatNumber Patch - Set CatNumber of Last Category -if (ini.Tabs_at_startup = 1) And (high(Song) >=1) then - Song[CatLen - CatNumber].CatNumber := CatNumber;//Set CatNumber of Categroy -//CatCount Patch -CatCount := Order; -end; - -procedure TCatSongs.ShowCategory(Index: integer); -var - S: integer; // song -begin - CatNumShow := Index; - for S := 0 to high(CatSongs.Song) do - begin - if (CatSongs.Song[S].OrderNum = Index) AND (Not CatSongs.Song[S].Main) then - CatSongs.Song[S].Visible := true - else - CatSongs.Song[S].Visible := false; - end; -end; - -procedure TCatSongs.HideCategory(Index: integer); // hides all songs in category -var - S: integer; // song -begin - for S := 0 to high(CatSongs.Song) do begin - if not CatSongs.Song[S].Main then - CatSongs.Song[S].Visible := false // hides all at now - end; -end; - -procedure TCatSongs.ClickCategoryButton(Index: integer); -var - Num, S: integer; -begin - Num := CatSongs.Song[Index].OrderNum; - if Num <> CatNumShow then - begin - ShowCategory(Num); - end - else begin - ShowCategoryList; - end; -end; - -//Hide Categorys when in Category Hack -procedure TCatSongs.ShowCategoryList; -var - Num, S: integer; -begin - //Hide All Songs Show All Cats - for S := 0 to high(CatSongs.Song) do begin - if CatSongs.Song[S].Main then - CatSongs.Song[S].Visible := true - else - CatSongs.Song[S].Visible := false - end; - CatSongs.Selected := CatNumShow; //Show last shown Category - CatNumShow := -1; -end; -//Hide Categorys when in Category Hack End - -//Wrong song selected when tabs on bug -function TCatSongs.FindNextVisible(SearchFrom:integer): integer;//Find next Visible Song -var - I: Integer; - begin - Result := -1; - I := SearchFrom + 1; - while not CatSongs.Song[I].Visible do - begin - Inc (I); - if (I>high(CatSongs.Song)) then - I := low(CatSongs.Song); - if (I = SearchFrom) then //Make One Round and no song found->quit - break; - end; - end; -//Wrong song selected when tabs on bug End - -function TCatSongs.VisibleSongs: integer; -var - S: integer; // song -begin - Result := 0; - for S := 0 to high(CatSongs.Song) do - if CatSongs.Song[S].Visible = true then Inc(Result); -end; - -function TCatSongs.VisibleIndex(Index: integer): integer; -var - S: integer; // song -begin - Result := 0; - for S := 0 to Index-1 do - if CatSongs.Song[S].Visible = true then Inc(Result); -end; - -function TCatSongs.SetFilter(FilterStr: String; const fType: Byte): Cardinal; -var - I, J: Integer; - cString: String; - SearchStr: Array of String; -begin - {fType: 0: All - 1: Title - 2: Artist} - FilterStr := Trim(FilterStr); - if FilterStr<>'' then begin - Result := 0; - //Create Search Array - SetLength(SearchStr, 1); - I := Pos (' ', FilterStr); - While (I <> 0) do - begin - SetLength (SearchStr, Length(SearchStr) + 1); - cString := Copy(FilterStr, 1, I-1); - if (cString <> ' ') AND (cString <> '') then - SearchStr[High(SearchStr)-1] := cString; - Delete (FilterStr, 1, I); - - I := Pos (' ', FilterStr); - end; - //Copy last Word - if (FilterStr <> ' ') AND (FilterStr <> '') then - SearchStr[High(SearchStr)] := FilterStr; - - for I:=0 to High(Song) do begin - if not Song[i].Main then - begin - case fType of - 0: cString := Song[I].Artist + ' ' + Song[i].Title + ' ' + Song[i].Folder; - 1: cString := Song[I].Title; - 2: cString := Song[I].Artist; - end; - Song[i].Visible:=True; - //Look for every Searched Word - For J := 0 to High(SearchStr) do - begin - Song[i].Visible := Song[i].Visible AND AnsiContainsText(cString, SearchStr[J]) - end; - if Song[i].Visible then - Inc(Result); - end - else - Song[i].Visible:=False; - end; - CatNumShow := -2; - end - else begin - for i:=0 to High(Song) do begin - Song[i].Visible:=(Ini.Tabs=1)=Song[i].Main; - CatNumShow := -1; - end; - Result := 0; - end; -end; - -end. +unit USongs; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +uses SysUtils, ULog, UTexture, UCatCovers; + +type + TBPM = record + BPM: real; + StartBeat: real; + end; + + TScore = record + Name: string; + Score: integer; + Length: string; + end; + + TSong = record + Path: string; + Folder: string; // for sorting by folder + FileName: string; + + // sorting methods + Category: array of string; // I think I won't need this + Genre: string; + Edition: string; + Language: string; // 0.5.0: new + + Title: string; + Artist: string; + + Text: string; + Creator: string; + + Cover: string; + CoverTex: TTexture; + Mp3: string; + Background: string; + Video: string; + VideoGAP: real; + VideoLoaded: boolean; // 0.5.0: true if the video has been loaded + NotesGAP: integer; + Start: real; // in seconds + Finish: integer; // in miliseconds + Relative: boolean; + Resolution: integer; + BPM: array of TBPM; + GAP: real; // in miliseconds + + Score: array[0..2] of array of TScore; + + // these are used when sorting is enabled + Visible: boolean; // false if hidden, true if visible + Main: boolean; // false for songs, true for category buttons + OrderNum: integer; // has a number of category for category buttons and songs + OrderTyp: integer; // type of sorting for this button (0=name) + CatNumber: integer; // Count of Songs in Category for Cats and Number of Song in Category for Songs + end; + + TSongs = class + private + BrowsePos: Cardinal; //Actual Pos in Song Array + public + Song: array of TSong; // array of songs + Selected: integer; // selected song index + procedure LoadSongList; // load all songs + procedure BrowseDir(Dir: string); // should return number of songs in the future + procedure Sort(Order: integer); + function FindSongFile(Dir, Mask: string): string; + end; + + TCatSongs = class + Song: array of TSong; // array of categories with songs + Selected: integer; // selected song index + Order: integer; // order type (0=title) + CatNumShow: integer; // Category Number being seen + CatCount: integer; //Number of Categorys + + procedure Refresh; // refreshes arrays by recreating them from Songs array +// procedure Sort(Order: integer); + procedure ShowCategory(Index: integer); // expands all songs in category + procedure HideCategory(Index: integer); // hides all songs in category + procedure ClickCategoryButton(Index: integer); // uses ShowCategory and HideCategory when needed + procedure ShowCategoryList; //Hides all Songs And Show the List of all Categorys + function FindNextVisible(SearchFrom:integer): integer; //Find Next visible Song + function VisibleSongs: integer; // returns number of visible songs (for tabs) + function VisibleIndex(Index: integer): integer; // returns visible song index (skips invisible) + + function SetFilter(FilterStr: String; const fType: Byte): Cardinal; + end; + +var + Songs: TSongs; // all songs + CatSongs: TCatSongs; // categorized songs + AktSong: TSong; // one song *unknown use) + +implementation + +uses StrUtils, + UFiles, + UMain, + UIni; + + +procedure TSongs.LoadSongList; +begin + Log.LogStatus('Initializing', 'LoadSongList'); + + // clear + Setlength(Song, 50); + + BrowsePos := 0; + // browse directories + BrowseDir(SongPath); + + //Set Correct SongArray Length + SetLength(Song, BrowsePos); +// if Ini.Debug = 1 then BrowseDir('D:\Extract\Songs\'); +end; + +procedure TSongs.BrowseDir(Dir: string); +var + SR: TSearchRec; // for parsing Songs Directory + SLen: integer; +begin + if FindFirst(Dir + '*', faDirectory, SR) = 0 then begin + repeat + if (SR.Name <> '.') and (SR.Name <> '..') then + BrowseDir(Dir + Sr.Name + PathDelim); + until FindNext(SR) <> 0; + end; // if + FindClose(SR); + +// Log.LogStatus('Parsing directory: ' + Dir + SR.Name, 'LoadSongList'); + + if FindFirst(Dir + '*.txt', 0, SR) = 0 then + begin + repeat + //New Mod for better Memory Management + +// Log.LogStatus('Parsing file: ' + Dir + SR.Name, 'LoadSongList'); + + + SLen := BrowsePos; + {//Old + SLen := Length(Song); + SetLength(Song, SLen + 1);//} + + Song[SLen].Path := Dir; + Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); + Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); + Song[SLen].FileName := SR.Name; + + if (AnalyseFile(Song[SLen]) = false) then Dec(BrowsePos) + else begin + // scanning complete, file is good + // if there is no cover then try to find it + if Song[SLen].Cover = '' then Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); +// if Song[SLen].Background = '' then begin +// Song[SLen].Background := FindSongFile(Dir, '*[BG].jpg'); +// end; // no needed here} + + // fix by adding path. no, don't fix it. +// if Song[SLen].Cover <> '' then +// Song[SLen].Cover := Song[SLen].Path + Song[SLen].Cover; + end; + + //Change Length Only every 50 Entrys + Inc(BrowsePos); + + if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then + begin + SetLength(Song, Length(Song) + 50); + end; + + until FindNext(SR) <> 0; + end; // if FindFirst + FindClose(SR); +end; + +procedure TSongs.Sort(Order: integer); +var + S: integer; + S2: integer; + TempSong: TSong; +begin + case Order of + sEdition: // by edition + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Edition, Song[S-1].Edition) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sGenre: // by genre + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Genre, Song[S-1].Genre) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sTitle: // by title + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + + end; + sArtist: // by artist + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sFolder: // by folder + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Folder, Song[S-1].Folder) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sTitle2: // by title2 + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + + end; + sArtist2: // by artist2 + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sLanguage: // by Language + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Language, Song[S-1].Language) < 0 then begin + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + + end; // case +end; + +function TSongs.FindSongFile(Dir, Mask: string): string; +var + SR: TSearchRec; // for parsing song directory +begin + Result := ''; + if FindFirst(Dir + Mask, faDirectory, SR) = 0 then begin + Result := SR.Name; + end; // if + FindClose(SR); +end; + +procedure TCatSongs.Refresh; +var + S: integer; // temporary song index + CatLen: integer; // length of CatSongs.Song + Letter: char; // current letter for sorting using letter + SS: string; // current edition for sorting using edition, genre etc. + Order: integer; // number used for ordernum + Letter2: char; // + CatNumber:integer; // Number of Song in Category +begin + CatNumShow := -1; +// Songs.Sort(0); // by title + +case Ini.Sorting of + sEdition: begin + Songs.Sort(sArtist); + Songs.Sort(sEdition); + end; + sGenre: begin + Songs.Sort(sArtist); + Songs.Sort(sGenre); + end; + sLanguage: begin + Songs.Sort(sArtist); + Songs.Sort(sLanguage); + end; + sFolder: begin + Songs.Sort(sArtist); + Songs.Sort(sFolder); + end; + sTitle: Songs.Sort(sTitle); + sArtist: Songs.Sort(sArtist); + sTitle2: Songs.Sort(sTitle2); // by title2 + sArtist2: Songs.Sort(sArtist2); // by artist2 + + end; // case + + + Letter := ' '; + SS := ''; + Order := 0; + CatNumber := 0; + + //Songs leeren + SetLength (Song, 0); + + for S := Low(Songs.Song) to High(Songs.Song) do begin + if (Ini.Tabs = 1) then + if (Ini.Sorting = sEdition) and (CompareText(SS, Songs.Song[S].Edition) <> 0) then begin + // add Category Button + Inc(Order); + SS := Songs.Song[S].Edition; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + SS + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + + + // 0.4.3 + // if SS = 'Singstar' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Part 2' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar German' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Spanish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Italian' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar French' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Party' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Party.jpg'; + // if SS = 'Singstar Popworld' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Popworld.jpg'; + // if SS = 'Singstar 80s' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; + // if SS = 'Singstar 80s Polish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; + // if SS = 'Singstar Rocks' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Rocks.jpg'; + // if SS = 'Singstar Anthems' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Anthems.jpg'; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';//} + + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sGenre) and (CompareText(SS, Songs.Song[S].Genre) <> 0) then begin + // add Genre Button + Inc(Order); + SS := Songs.Song[S].Genre; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sLanguage) and (CompareText(SS, Songs.Song[S].Language) <> 0) then begin + // add Language Button + Inc(Order); + SS := Songs.Song[S].Language; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sTitle) and (Length(Songs.Song[S].Title)>=1) and (Letter <> UpCase(Songs.Song[S].Title[1])) then begin + // add a letter Category Button + Inc(Order); + Letter := UpCase(Songs.Song[S].Title[1]); + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + + {// cover-patch + if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sArtist) and (Length(Songs.Song[S].Artist)>=1) and (Letter <> UpCase(Songs.Song[S].Artist[1])) then begin + // add a letter Category Button + Inc(Order); + Letter := UpCase(Songs.Song[S].Artist[1]); + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sFolder) and (CompareText(SS, Songs.Song[S].Folder) <> 0) then begin + // 0.5.0: add folder tab + Inc(Order); + SS := Songs.Song[S].Folder; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sTitle2) AND (Length(Songs.Song[S].Title)>=1) then begin + if (ord(Songs.Song[S].Title[1]) > 47) and (ord(Songs.Song[S].Title[1]) < 58) then Letter2 := '#' else Letter2 := UpCase(Songs.Song[S].Title[1]); + if (Letter <> Letter2) then begin + // add a letter Category Button + Inc(Order); + Letter := Letter2; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end; + end + + else if (Ini.Sorting = sArtist2) AND (Length(Songs.Song[S].Artist)>=1) then begin + if (ord(Songs.Song[S].Artist[1]) > 47) and (ord(Songs.Song[S].Artist[1]) < 58) then Letter2 := '#' else Letter2 := UpCase(Songs.Song[S].Artist[1]); + if (Letter <> Letter2) then begin + // add a letter Category Button + Inc(Order); + Letter := Letter2; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end; + end; + + + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + + Inc (CatNumber); //Increase Number in Cat + + CatSongs.Song[CatLen] := Songs.Song[S]; + CatSongs.Song[CatLen].OrderNum := Order; // assigns category + CatSongs.Song[CatLen].CatNumber := CatNumber; + + if (Ini.Tabs = 0) then CatSongs.Song[CatLen].Visible := true + else if (Ini.Tabs = 1) then CatSongs.Song[CatLen].Visible := false; +// if (Ini.Tabs = 1) and (Order = 1) then CatSongs.Song[CatLen].Visible := true; // open first tab +//CatSongs.Song[CatLen].Visible := true; + + end; +//CatNumber Patch - Set CatNumber of Last Category +if (ini.Tabs_at_startup = 1) And (high(Song) >=1) then + Song[CatLen - CatNumber].CatNumber := CatNumber;//Set CatNumber of Categroy +//CatCount Patch +CatCount := Order; +end; + +procedure TCatSongs.ShowCategory(Index: integer); +var + S: integer; // song +begin + CatNumShow := Index; + for S := 0 to high(CatSongs.Song) do + begin + if (CatSongs.Song[S].OrderNum = Index) AND (Not CatSongs.Song[S].Main) then + CatSongs.Song[S].Visible := true + else + CatSongs.Song[S].Visible := false; + end; +end; + +procedure TCatSongs.HideCategory(Index: integer); // hides all songs in category +var + S: integer; // song +begin + for S := 0 to high(CatSongs.Song) do begin + if not CatSongs.Song[S].Main then + CatSongs.Song[S].Visible := false // hides all at now + end; +end; + +procedure TCatSongs.ClickCategoryButton(Index: integer); +var + Num, S: integer; +begin + Num := CatSongs.Song[Index].OrderNum; + if Num <> CatNumShow then + begin + ShowCategory(Num); + end + else begin + ShowCategoryList; + end; +end; + +//Hide Categorys when in Category Hack +procedure TCatSongs.ShowCategoryList; +var + Num, S: integer; +begin + //Hide All Songs Show All Cats + for S := 0 to high(CatSongs.Song) do begin + if CatSongs.Song[S].Main then + CatSongs.Song[S].Visible := true + else + CatSongs.Song[S].Visible := false + end; + CatSongs.Selected := CatNumShow; //Show last shown Category + CatNumShow := -1; +end; +//Hide Categorys when in Category Hack End + +//Wrong song selected when tabs on bug +function TCatSongs.FindNextVisible(SearchFrom:integer): integer;//Find next Visible Song +var + I: Integer; + begin + Result := -1; + I := SearchFrom + 1; + while not CatSongs.Song[I].Visible do + begin + Inc (I); + if (I>high(CatSongs.Song)) then + I := low(CatSongs.Song); + if (I = SearchFrom) then //Make One Round and no song found->quit + break; + end; + end; +//Wrong song selected when tabs on bug End + +function TCatSongs.VisibleSongs: integer; +var + S: integer; // song +begin + Result := 0; + for S := 0 to high(CatSongs.Song) do + if CatSongs.Song[S].Visible = true then Inc(Result); +end; + +function TCatSongs.VisibleIndex(Index: integer): integer; +var + S: integer; // song +begin + Result := 0; + for S := 0 to Index-1 do + if CatSongs.Song[S].Visible = true then Inc(Result); +end; + +function TCatSongs.SetFilter(FilterStr: String; const fType: Byte): Cardinal; +var + I, J: Integer; + cString: String; + SearchStr: Array of String; +begin + {fType: 0: All + 1: Title + 2: Artist} + FilterStr := Trim(FilterStr); + if FilterStr<>'' then begin + Result := 0; + //Create Search Array + SetLength(SearchStr, 1); + I := Pos (' ', FilterStr); + While (I <> 0) do + begin + SetLength (SearchStr, Length(SearchStr) + 1); + cString := Copy(FilterStr, 1, I-1); + if (cString <> ' ') AND (cString <> '') then + SearchStr[High(SearchStr)-1] := cString; + Delete (FilterStr, 1, I); + + I := Pos (' ', FilterStr); + end; + //Copy last Word + if (FilterStr <> ' ') AND (FilterStr <> '') then + SearchStr[High(SearchStr)] := FilterStr; + + for I:=0 to High(Song) do begin + if not Song[i].Main then + begin + case fType of + 0: cString := Song[I].Artist + ' ' + Song[i].Title + ' ' + Song[i].Folder; + 1: cString := Song[I].Title; + 2: cString := Song[I].Artist; + end; + Song[i].Visible:=True; + //Look for every Searched Word + For J := 0 to High(SearchStr) do + begin + Song[i].Visible := Song[i].Visible AND AnsiContainsText(cString, SearchStr[J]) + end; + if Song[i].Visible then + Inc(Result); + end + else + Song[i].Visible:=False; + end; + CatNumShow := -2; + end + else begin + for i:=0 to High(Song) do begin + Song[i].Visible:=(Ini.Tabs=1)=Song[i].Main; + CatNumShow := -1; + end; + Result := 0; + end; +end; + +end. diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 3d746813..40a3a30b 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -262,7 +262,7 @@ begin if ( FileExists(Identifier) ) then begin // load from file -// Log.LogStatus( 'Is File', ' LoadImage' ); + Log.LogStatus( 'Is File', ' LoadImage' ); try Result:=IMG_Load(Identifier); except @@ -273,7 +273,7 @@ begin end else begin -// Log.LogStatus( 'NOT File', ' LoadImage' ); + Log.LogStatus( 'IS Resource', ' LoadImage' ); // load from resource stream {$IFNDEF FPC} @@ -296,6 +296,7 @@ begin end; try + TexStream.position := 0; try TexRWops := SDL_AllocRW; TexRWops.unknown := TUnknown(TexStream); @@ -309,7 +310,8 @@ begin beep; Exit; end; - + + Log.LogStatus( 'resource Assigned....' , Identifier); Result:=IMG_Load_RW(TexRWops,0); SDL_FreeRW(TexRWops); @@ -340,9 +342,8 @@ begin Exit; end; - Result:=IMG_Load_RW(TexRWops,0); + Result := IMG_Load_RW(TexRWops,0); SDL_FreeRW(TexRWops); - finally freeandnil( lResData ); end; diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 1e102987..9da176df 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -7,6 +7,7 @@ interface {$ENDIF} uses + ULog, IniFiles, SysUtils, Classes; @@ -1426,24 +1427,20 @@ var C: integer; begin DecimalSeparator := '.'; - ThemeText.X := ThemeIni.ReadInteger(Name, 'X', 0); - ThemeText.Y := ThemeIni.ReadInteger(Name, 'Y', 0); - ThemeText.W := ThemeIni.ReadInteger(Name, 'W', 0); + + ThemeText.X := ThemeIni.ReadInteger(Name, 'X', 0); + ThemeText.Y := ThemeIni.ReadInteger(Name, 'Y', 0); + ThemeText.W := ThemeIni.ReadInteger(Name, 'W', 0); - ThemeText.ColR := ThemeIni.ReadFloat(Name, 'ColR', 0); - ThemeText.ColG := ThemeIni.ReadFloat(Name, 'ColG', 0); - ThemeText.ColB := ThemeIni.ReadFloat(Name, 'ColB', 0); + ThemeText.ColR := ThemeIni.ReadFloat(Name, 'ColR', 0); + ThemeText.ColG := ThemeIni.ReadFloat(Name, 'ColG', 0); + ThemeText.ColB := ThemeIni.ReadFloat(Name, 'ColB', 0); - ThemeText.Font := ThemeIni.ReadInteger(Name, 'Font', 0); - ThemeText.Size := ThemeIni.ReadInteger(Name, 'Size', 0); + ThemeText.Font := ThemeIni.ReadInteger(Name, 'Font', 0); + ThemeText.Size := ThemeIni.ReadInteger(Name, 'Size', 0); ThemeText.Align := ThemeIni.ReadInteger(Name, 'Align', 0); - {{$IFDEF TRANSLATE} - ThemeText.Text := Language.Translate(ThemeIni.ReadString(Name, 'Text', '')); - {{$ELSE}{ - ThemeText.Text := ThemeIni.ReadString(Name, 'Text', ''); - {$ENDIF} - + ThemeText.Text := Language.Translate(ThemeIni.ReadString(Name, 'Text', '')); ThemeText.Color := ThemeIni.ReadString(Name, 'Color', ''); C := ColorExists(ThemeText.Color); diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 16bc4ab2..291dc201 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -764,6 +764,7 @@ begin for J := 0 to Length(Text) - 1 do Text[J].Draw; + // Draw all ButtonCollections For J := 0 to High(ButtonCollection) do ButtonCollection[J].Draw; diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas index d1c8b7b1..19adef03 100644 --- a/Game/Code/Menu/UMenuText.pas +++ b/Game/Code/Menu/UMenuText.pas @@ -237,10 +237,12 @@ var Text2: string; I: Integer; begin - if Visible then begin + if Visible then + begin SetFontStyle(Style); SetFontSize(Size); SetFontItalic(False); + glColor4f(ColR*Int, ColG*Int, ColB*Int, Alpha); //If Selected Set Blink... -- cgit v1.2.3 From a89edc606724e5d6d6fb36d81101d61c9f24b5fb Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 25 Sep 2007 18:50:13 +0000 Subject: Add Ratingbar to score class Ratingbar algorithm needs some finetuning. too much lowering atm Some atm not used functions of scoreclass don't work correctly. See USingScores. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@433 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/USingScores.pas | 240 +++++++++++++++++++++++++++++++++----- 1 file changed, 212 insertions(+), 28 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/USingScores.pas b/Game/Code/Classes/USingScores.pas index 881a5515..052ff678 100644 --- a/Game/Code/Classes/USingScores.pas +++ b/Game/Code/Classes/USingScores.pas @@ -10,6 +10,16 @@ uses UThemes, OpenGl12, UTexture; +////////////////////////////////////////////////////////////// +// ATTENTION: // +// Enabled Flag does not Work atm. This should cause Popups // +// Not to Move and Scores to stay until Renenabling. // +// To use e.g. in Pause Mode // +// Also InVisible Flag causes Attributes not to change. // +// This should be fixed after next Draw when Visible = True,// +// but not testet yet // +////////////////////////////////////////////////////////////// + //Some Constances containing Options that could change by time const MaxPlayers = 6; //Maximum of Players that could be added @@ -27,6 +37,9 @@ type ScoreDisplayed: Word; //Score cur. Displayed(for counting up) ScoreBG: TTexture;//Texture of the Players Scores BG Color: TRGB; //Teh Players Color + RBPos: Real; //Cur. Percentille of the Rating Bar + RBTarget: Real; //Target Position of Rating Bar + RBVisible:Boolean; //Is Rating bar Drawn end; aScorePlayer = array[0..MaxPlayers-1] of TScorePlayer; @@ -103,6 +116,9 @@ type //Procedure Draws a Score by Playerindex Procedure DrawScore(const Index: Integer); + //Procedure Draws the RatingBar by Playerindex + Procedure DrawRatingBar(const Index: Integer); + //Procedure Removes a PopUp w/o destroying the List Procedure KillPopUp(const last, cur: PScorePopUp); public @@ -122,6 +138,10 @@ type end; + Visible: Boolean; //Visibility of all Scores + Enabled: Boolean; //Scores are changed, PopUps are Moved etc. + RBVisible: Boolean; //Visibility of all Rating Bars + //Propertys for Reading Position and Playercount Property PositionCount: Byte read oPositionCount; Property PlayerCount: Byte read oPlayerCount; @@ -180,6 +200,11 @@ begin //Clear PopupList Pointers FirstPopUp := nil; LastPopUp := nil; + + //Clear Variables + Visible := True; + Enabled := True; + RBVisible := True; //Clear Position Index oPositionCount := 0; @@ -231,6 +256,9 @@ begin aPlayers[PlayerCount].ScoreDisplayed := Score; aPlayers[PlayerCount].ScoreBG := ScoreBG; aPlayers[PlayerCount].Color := Color; + aPlayers[PlayerCount].RBPos := 0.5; + aPlayers[PlayerCount].RBTarget := 0.5; + aPlayers[PlayerCount].RBVisible := True; Inc(oPlayerCount); end; @@ -390,6 +418,13 @@ begin //Give Player the Last Points that missing till now aPlayers[Cur.Player].ScoreDisplayed := aPlayers[Cur.Player].ScoreDisplayed + Cur.ScoreDiff - Cur.ScoreGiven; + //Change Bars Position + aPlayers[Cur.Player].RBTarget := aPlayers[Cur.Player].RBTarget + (Cur.ScoreDiff - Cur.ScoreGiven)/Cur.ScoreDiff * (Cur.Rating / 20 - 0.26); + If (aPlayers[Cur.Player].RBTarget > 1) then + aPlayers[Cur.Player].RBTarget := 1 + else If (aPlayers[Cur.Player].RBTarget < 0) then + aPlayers[Cur.Player].RBTarget := 0; + //If this is the First PopUp => Make Next PopUp the First If (Cur = FirstPopUp) then FirstPopUp := Cur.Next @@ -528,35 +563,47 @@ var CurPopUp, LastPopUp: PScorePopUp; begin CurTime := SDL_GetTicks; - - //Draw Popups - LastPopUp := nil; - CurPopUp := FirstPopUp; - - While (CurPopUp <> nil) do + + If Visible then begin - if (CurTime - CurPopUp.TimeStamp > Settings.Phase1Time + Settings.Phase2Time + Settings.Phase3Time) then + //Draw Popups + LastPopUp := nil; + CurPopUp := FirstPopUp; + + While (CurPopUp <> nil) do begin - KillPopUp(LastPopUp, CurPopUp); - if (LastPopUp = nil) then - CurPopUp := FirstPopUp + if (CurTime - CurPopUp.TimeStamp > Settings.Phase1Time + Settings.Phase2Time + Settings.Phase3Time) then + begin + KillPopUp(LastPopUp, CurPopUp); + if (LastPopUp = nil) then + CurPopUp := FirstPopUp + else + CurPopUp := LastPopUp.Next; + end else + begin + DrawPopUp(CurPopUp); + LastPopUp := CurPopUp; CurPopUp := LastPopUp.Next; - end - else - begin - DrawPopUp(CurPopUp); - LastPopUp := CurPopUp; - CurPopUp := LastPopUp.Next; + end; end; - end; - //Draw Players - For I := 0 to PlayerCount-1 do - begin - DrawScore(I); - end; + IF (RBVisible) then + //Draw Players w/ Rating Bar + For I := 0 to PlayerCount-1 do + begin + DrawScore(I); + DrawRatingBar(I); + end + else + //Draw Players w/o Rating Bar + For I := 0 to PlayerCount-1 do + begin + DrawScore(I); + end; + + end; //eo Visible end; //----------- @@ -584,6 +631,11 @@ begin If ((Players[PopUp.Player].Position AND 128) = 0) = (ScreenAct = 1) then begin CurTime := SDL_GetTicks; + If Not (Enabled AND Players[PopUp.Player].Enabled) then + //Increase Timestamp with TIem where there is no Movement ... + begin + //Inc(PopUp.TimeStamp, LastRender); + end; TimeDiff := CurTime - PopUp.TimeStamp; //Get Position of PopUp @@ -636,10 +688,20 @@ begin If (PopUp.Rating > 0) then begin - //Add Scores - ScoreToAdd := Round(PopUp.ScoreDiff * Progress) - PopUp.ScoreGiven; - Inc(PopUp.ScoreGiven, ScoreToAdd); - aPlayers[PopUp.Player].ScoreDisplayed := Players[PopUp.Player].ScoreDisplayed + ScoreToAdd; + //Add Scores if Player Enabled + If (Enabled AND Players[PopUp.Player].Enabled) then + begin + ScoreToAdd := Round(PopUp.ScoreDiff * Progress) - PopUp.ScoreGiven; + Inc(PopUp.ScoreGiven, ScoreToAdd); + aPlayers[PopUp.Player].ScoreDisplayed := Players[PopUp.Player].ScoreDisplayed + ScoreToAdd; + + //Change Bars Position + aPlayers[PopUp.Player].RBTarget := aPlayers[PopUp.Player].RBTarget + ScoreToAdd/PopUp.ScoreDiff * (PopUp.Rating / 20 - 0.26); + If (aPlayers[PopUp.Player].RBTarget > 1) then + aPlayers[PopUp.Player].RBTarget := 1 + else If (aPlayers[PopUp.Player].RBTarget < 0) then + aPlayers[PopUp.Player].RBTarget := 0; + end; //Set Positions etc. Alpha := 0.7 - 0.7 * Progress; @@ -676,7 +738,7 @@ begin //Draw PopUp - if (Alpha > 0) then + if (Alpha > 0) AND (Players[PopUp.Player].Visible) then begin //Draw BG: glEnable(GL_TEXTURE_2D); @@ -730,7 +792,7 @@ begin If Players[Index].Position <> high(byte) then begin //Only Draw if Player is on Cur Screen - If ((Players[Index].Position AND 128) = 0) = (ScreenAct = 1) then + If (((Players[Index].Position AND 128) = 0) = (ScreenAct = 1)) AND Players[Index].Visible then begin Position := @Positions[Players[Index].Position and 127]; @@ -768,4 +830,126 @@ begin end; //eo Player has Position end; + +Procedure TSingScores.DrawRatingBar(const Index: Integer); +var + Position: PScorePosition; + R,G,B, Size: Real; + Diff: Real; +begin + //Only Draw if Player has a Position + If Players[Index].Position <> high(byte) then + begin + //Only Draw if Player is on Cur Screen + If ((Players[Index].Position AND 128) = 0) = (ScreenAct = 1) AND (Players[index].RBVisible AND Players[index].Visible) then + begin + Position := @Positions[Players[Index].Position and 127]; + + If (Enabled AND Players[Index].Enabled) then + begin + //Move Position if Enabled + Diff := Players[Index].RBTarget - Players[Index].RBPos; + If(Abs(Diff) < 0.02) then + aPlayers[Index].RBPos := aPlayers[Index].RBTarget + else + aPlayers[Index].RBPos := aPlayers[Index].RBPos + Diff*0.1; + end; + + //Get Colors for RatingBar + If Players[index].RBPos <=0.22 then + begin + R := 1; + G := 0; + B := 0; + end + Else If Players[index].RBPos <=0.42 then + begin + R := 1; + G := Players[index].RBPos*5; + B := 0; + end + Else If Players[index].RBPos <=0.57 then + begin + R := 1; + G := 1; + B := 0; + end + Else If Players[index].RBPos <=0.77 then + begin + R := 1-(Players[index].RBPos-0.57)*5; + G := 1; + B := 0; + end + else + begin + R := 0; + G := 1; + B := 0; + end; + + //Enable all glFuncs Needed + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + //Draw RatingBar BG + glColor4f(1, 1, 1, 0.8); + glBindTexture(GL_TEXTURE_2D, Settings.RatingBar_BG_Tex.TexNum); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex2f(Position.RBX, Position.RBY); + + glTexCoord2f(0, Settings.RatingBar_BG_Tex.TexH); + glVertex2f(Position.RBX, Position.RBY+Position.RBH); + + glTexCoord2f(Settings.RatingBar_BG_Tex.TexW, Settings.RatingBar_BG_Tex.TexH); + glVertex2f(Position.RBX+Position.RBW, Position.RBY+Position.RBH); + + glTexCoord2f(Settings.RatingBar_BG_Tex.TexW, 0); + glVertex2f(Position.RBX+Position.RBW, Position.RBY); + glEnd; + + //Draw Rating bar itself + Size := Position.RBX + Position.RBW * Players[Index].RBPos; + glColor4f(R, G, B, 1); + glBindTexture(GL_TEXTURE_2D, Settings.RatingBar_Bar_Tex.TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex2f(Position.RBX, Position.RBY); + + glTexCoord2f(0, Settings.RatingBar_Bar_Tex.TexH); + glVertex2f(Position.RBX, Position.RBY + Position.RBH); + + glTexCoord2f(Settings.RatingBar_Bar_Tex.TexW, Settings.RatingBar_Bar_Tex.TexH); + glVertex2f(Size, Position.RBY + Position.RBH); + + glTexCoord2f(Settings.RatingBar_Bar_Tex.TexW, 0); + glVertex2f(Size, Position.RBY); + glEnd; + + //Draw Ratingbar FG (Teh thing with the 3 lines to get better readability) + glColor4f(1, 1, 1, 0.6); + glBindTexture(GL_TEXTURE_2D, Settings.RatingBar_FG_Tex.TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex2f(Position.RBX, Position.RBY); + + glTexCoord2f(0, Settings.RatingBar_FG_Tex.TexH); + glVertex2f(Position.RBX, Position.RBY + Position.RBH); + + glTexCoord2f(Settings.RatingBar_FG_Tex.TexW, Settings.RatingBar_FG_Tex.TexH); + glVertex2f(Position.RBX + Position.RBW, Position.RBY + Position.RBH); + + glTexCoord2f(Settings.RatingBar_FG_Tex.TexW, 0); + glVertex2f(Position.RBX + Position.RBW, Position.RBY); + glEnd; + + //Disable all Enabled glFuncs + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + end; //eo Right Screen + end; //eo Player has Position +end; + end. -- cgit v1.2.3 From 1acdd4a165647aa45d44f537326506d97c90c121 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 25 Sep 2007 18:59:00 +0000 Subject: Some Cleanup in UDraw, UMain and UScreenSing Removed some old, yet not used functions One class todo(Notes) then the dirty UDraw will be a thing of the past. Also Player and Notes Array needs some rewriting. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@434 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 312 +------------------------------------- Game/Code/Classes/UMain.pas | 21 +-- Game/Code/Screens/UScreenSing.pas | 49 +----- 3 files changed, 4 insertions(+), 378 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 5a175289..1e631648 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -23,12 +23,6 @@ procedure SingDrawPlayerBGCzesc(Left, Top, Right: real; NrCzesci, NrGracza: inte // TimeBar procedure SingDrawTimeBar(); -// The Singbar -procedure SingDrawSingbar(X, Y, W, H: real; Percent: integer); - -//Phrasen Bonus - Line Bonus -procedure SingDrawLineBonus( const X, Y: Single; Color: TRGB; Alpha: Single; Text: string; Age: Integer); - //Draw Editor NoteLines procedure EditDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); @@ -530,15 +524,8 @@ var BarWspol: real; TempCol: real; Tekst: string; - LyricTemp: string; PetCz: integer; - //SingBar Mod - A: Integer; - E: Integer; - I: Integer; - //end Singbar Mod - begin // positions if Ini.SingWindow = 0 then begin @@ -656,135 +643,7 @@ begin end; end; - end - - //SingBar Mod - //modded again to make it moveable: it's working, so why try harder - else if Ini.Oscilloscope = 2 then - begin - A := GetTickCount div 33; - if A <> Tickold then begin - Tickold := A; - for E := 0 to (PlayersPlay - 1) do begin //Set new Pos + Alpha - I := Player[E].ScorePercentTarget - Player[E].ScorePercent; - if I > 0 then Inc(Player[E].ScorePercent) - else if I < 0 then Dec(Player[E].ScorePercent); - end; //for - end; //if - - if PlayersPlay = 1 then begin - SingDrawSingbar(Theme.Sing.StaticP1SingBar.x, Theme.Sing.StaticP1SingBar.y, Theme.Sing.StaticP1SingBar.w, Theme.Sing.StaticP1SingBar.h , Player[0].ScorePercent); - end; - - if PlayersPlay = 2 then begin - SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); - end; - - if PlayersPlay = 3 then begin - SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); - end; - if ScreenAct = 2 then begin - SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[2].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[3].ScorePercent); - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); - end; - if ScreenAct = 2 then begin - SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[3].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[4].ScorePercent); - SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[5].ScorePercent); - end; - end; end; - //end Singbar Mod - - {//PhrasenBonus - Line Bonus Mod - if Ini.LineBonus > 0 then begin - A := GetTickCount div 33; - if (A <> Tickold2) AND (Player[0].LineBonus_Visible) then begin - Tickold2 := A; - for E := 0 to (PlayersPlay - 1) do begin - //Change Alpha - Player[E].LineBonus_Alpha := Player[E].LineBonus_Alpha - 0.02; - if Player[E].LineBonus_Alpha <= 0 then - begin - Player[E].LineBonus_Age := 0; - Player[E].LineBonus_Visible := False - end - else - begin - inc(Player[E].LineBonus_Age, 1); - //Change Position - if (Player[E].LineBonus_PosX < Player[E].LineBonus_TargetX) then - Player[E].LineBonus_PosX := Player[E].LineBonus_PosX + (2 - Player[E].LineBonus_Alpha * 1.5) - else if (Player[E].LineBonus_PosX > Player[E].LineBonus_TargetX) then - Player[E].LineBonus_PosX := Player[E].LineBonus_PosX - (2 - Player[E].LineBonus_Alpha * 1.5); - - if (Player[E].LineBonus_PosY < Player[E].LineBonus_TargetY) then - Player[E].LineBonus_PosY := Player[E].LineBonus_PosY + (2 - Player[E].LineBonus_Alpha * 1.5) - else if (Player[E].LineBonus_PosY > Player[E].LineBonus_TargetY) then - Player[E].LineBonus_PosY := Player[E].LineBonus_PosY - (2 - Player[E].LineBonus_Alpha * 1.5); - - end; // shift position of the pop up (if not dead) - end; // loop - for all players - end; // if - linebonus - - - if PlayersPlay = 1 then begin - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - end - - else if PlayersPlay = 2 then begin - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - end - - else if PlayersPlay = 3 then begin - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); - end - - else if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - end; - if ScreenAct = 2 then begin - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); - SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); - end; - if ScreenAct = 2 then begin - SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); - SingDrawLineBonus( Player[4].LineBonus_PosX, Player[4].LineBonus_PosY, Player[4].LineBonus_Color, Player[4].LineBonus_Alpha, Player[4].LineBonus_Text, Player[4].LineBonus_Age); - SingDrawLineBonus( Player[5].LineBonus_PosX, Player[5].LineBonus_PosY, Player[5].LineBonus_Color, Player[5].LineBonus_Alpha, Player[5].LineBonus_Text, Player[5].LineBonus_Age); - end; - end; - end; - //PhrasenBonus - Line Bonus Mod End } // Set the note heights according to the difficulty level case Ini.Difficulty of @@ -925,15 +784,7 @@ var BarWspol: real; TempCol: real; Tekst: string; - LyricTemp: string; PetCz: integer; - - //SingBar Mod - A: Integer; - E: Integer; - I: Integer; - //end Singbar Mod - begin // positions if Ini.SingWindow = 0 then begin @@ -1055,166 +906,7 @@ begin end; end; - end - - //SingBar Mod - // seems like we don't want the flicker thing, we want the linebonus rating bar beneath the scores - else if ((Ini.Oscilloscope = 2) AND (DLLMan.Selected.ShowRateBar_O)) OR (DLLMan.Selected.ShowRateBar) then begin - A := GetTickCount div 33; - if A <> Tickold then begin - Tickold := A; - for E := 0 to (PlayersPlay - 1) do begin //Set new Pos + Alpha - I := Player[E].ScorePercentTarget - Player[E].ScorePercent; - if I > 0 then Inc(Player[E].ScorePercent) - else if I < 0 then Dec(Player[E].ScorePercent); - end; //for - end; //if - - if PlayersPlay = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawSingbar(Theme.Sing.StaticP1SingBar.x, Theme.Sing.StaticP1SingBar.y, Theme.Sing.StaticP1SingBar.w, Theme.Sing.StaticP1SingBar.h , Player[0].ScorePercent); - end; - - if PlayersPlay = 2 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); - end; - - if PlayersPlay = 3 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[0].ScorePercent); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[1].ScorePercent); - end; - if ScreenAct = 2 then begin - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawSingbar(Theme.Sing.StaticP1TwoPSingBar.x, Theme.Sing.StaticP1TwoPSingBar.y, Theme.Sing.StaticP1TwoPSingBar.w, Theme.Sing.StaticP1TwoPSingBar.h , Player[2].ScorePercent); - if PlayerInfo.Playerinfo[3].Enabled then - SingDrawSingbar(Theme.Sing.StaticP2RSingBar.x, Theme.Sing.StaticP2RSingBar.y, Theme.Sing.StaticP2RSingBar.w, Theme.Sing.StaticP2RSingBar.h , Player[3].ScorePercent); - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[0].ScorePercent); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[1].ScorePercent); - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[2].ScorePercent); - end; - if ScreenAct = 2 then begin - if PlayerInfo.Playerinfo[3].Enabled then - SingDrawSingbar(Theme.Sing.StaticP1ThreePSingBar.x, Theme.Sing.StaticP1ThreePSingBar.y, Theme.Sing.StaticP1ThreePSingBar.w, Theme.Sing.StaticP1ThreePSingBar.h , Player[3].ScorePercent); - if PlayerInfo.Playerinfo[4].Enabled then - SingDrawSingbar(Theme.Sing.StaticP2MSingBar.x, Theme.Sing.StaticP2MSingBar.y, Theme.Sing.StaticP2MSingBar.w, Theme.Sing.StaticP2MSingBar.h , Player[4].ScorePercent); - if PlayerInfo.Playerinfo[5].Enabled then - SingDrawSingbar(Theme.Sing.StaticP3SingBar.x, Theme.Sing.StaticP3SingBar.y, Theme.Sing.StaticP3SingBar.w, Theme.Sing.StaticP3SingBar.h , Player[5].ScorePercent); - end; - end; - end; - //end Singbar Mod - - {//PhrasenBonus - Line Bonus Mod - if ((Ini.LineBonus > 0) AND (DLLMan.Selected.EnLineBonus_O)) OR (DLLMan.Selected.EnLineBonus) then begin - A := GetTickCount div 33; - if (A <> Tickold2) AND (Player[0].LineBonus_Visible) then begin - Tickold2 := A; - for E := 0 to (PlayersPlay - 1) do begin - //Change Alpha - Player[E].LineBonus_Alpha := Player[E].LineBonus_Alpha - 0.02; - - if Player[E].LineBonus_Alpha <= 0 then - begin - Player[E].LineBonus_Age := 0; - Player[E].LineBonus_Visible := False - end - else - begin - inc(Player[E].LineBonus_Age, 1); - //Change Position - if (Player[E].LineBonus_PosX < Player[E].LineBonus_TargetX) then // pop up has not yet reached it's position -> blend in - Player[E].LineBonus_PosX := Player[E].LineBonus_PosX + (2 - Player[E].LineBonus_Alpha * 1.5) - else if (Player[E].LineBonus_PosX > Player[E].LineBonus_TargetX) then // pop up has reached it's position -> blend out - Player[E].LineBonus_PosX := Player[E].LineBonus_PosX - (2 - Player[E].LineBonus_Alpha * 1.5); - - if (Player[E].LineBonus_PosY < Player[E].LineBonus_TargetY) then - Player[E].LineBonus_PosY := Player[E].LineBonus_PosY + (2 - Player[E].LineBonus_Alpha * 1.5) - else if (Player[E].LineBonus_PosY > Player[E].LineBonus_TargetY) then - Player[E].LineBonus_PosY := Player[E].LineBonus_PosY - (2 - Player[E].LineBonus_Alpha * 1.5); - - end; // pop up still visible, has not reached it's position - move it - end; // loop through all players - end; // if it's time to draw them - - if PlayersPlay = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - end - - else if PlayersPlay = 2 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - end - - else if PlayersPlay = 3 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); - end - - else if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - end; - if ScreenAct = 2 then begin - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); - if PlayerInfo.Playerinfo[3].Enabled then - SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawLineBonus( Player[0].LineBonus_PosX, Player[0].LineBonus_PosY, Player[0].LineBonus_Color, Player[0].LineBonus_Alpha, Player[0].LineBonus_Text, Player[0].LineBonus_Age); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawLineBonus( Player[1].LineBonus_PosX, Player[1].LineBonus_PosY, Player[1].LineBonus_Color, Player[1].LineBonus_Alpha, Player[1].LineBonus_Text, Player[1].LineBonus_Age); - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawLineBonus( Player[2].LineBonus_PosX, Player[2].LineBonus_PosY, Player[2].LineBonus_Color, Player[2].LineBonus_Alpha, Player[2].LineBonus_Text, Player[2].LineBonus_Age); - end; - if ScreenAct = 2 then begin - if PlayerInfo.Playerinfo[3].Enabled then - SingDrawLineBonus( Player[3].LineBonus_PosX, Player[3].LineBonus_PosY, Player[3].LineBonus_Color, Player[3].LineBonus_Alpha, Player[3].LineBonus_Text, Player[3].LineBonus_Age); - if PlayerInfo.Playerinfo[4].Enabled then - SingDrawLineBonus( Player[4].LineBonus_PosX, Player[4].LineBonus_PosY, Player[4].LineBonus_Color, Player[4].LineBonus_Alpha, Player[4].LineBonus_Text, Player[4].LineBonus_Age); - if PlayerInfo.Playerinfo[5].Enabled then - SingDrawLineBonus( Player[5].LineBonus_PosX, Player[5].LineBonus_PosY, Player[5].LineBonus_Color, Player[5].LineBonus_Alpha, Player[5].LineBonus_Text, Player[5].LineBonus_Age); - end; - end; end; -//PhrasenBonus - Line Bonus Mod End } // resize the notes according to the difficulty level case Ini.Difficulty of @@ -1345,7 +1037,7 @@ begin end; -//SingBar Mod +{//SingBar Mod procedure SingDrawSingbar(X, Y, W, H: real; Percent: integer); var R: Real; @@ -1474,7 +1166,7 @@ if Age < 5 then Size := Age * 10 else Size := 50; glPrint (PChar(Text)); end; end; -//PhrasenBonus - Line Bonus Mod +//PhrasenBonus - Line Bonus Mod} // Draw Note Bars for Editor //There are 11 Resons for a new Procdedure: diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 1970730a..878ff35c 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -43,27 +43,8 @@ type - //SingBar Mod + //LineBonus Mod ScoreLast: Real;//Last Line Score - ScorePercent: integer;//Aktual Fillstate of the SingBar - ScorePercentTarget: integer;//Target Fillstate of the SingBar - //end Singbar Mod - - //PhrasenBonus - Line Bonus Mod - LineBonus_PosX: Single; - LineBonus_PosY: Single; - LineBonus_Alpha: Single; - LineBonus_Visible: boolean; - LineBonus_Text: string; - LineBonus_Color: TRGB; - LineBonus_Age: Integer; - LineBonus_Rating: Integer; - //Variable vor Positioning -> Set on ScreenShow, different when Playercount Changes - LineBonus_TargetX: integer; - LineBonus_TargetY: integer; - LineBonus_StartX: integer; - LineBonus_StartY: integer; - //PhrasenBonus - Line Bonus Mod End //PerfectLineTwinkle Mod (effect) LastSentencePerfect: Boolean; diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index b953cc07..4e60a78b 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1244,15 +1244,6 @@ begin for I := 0 to High(Player) do begin A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2; - //SingBar Mod - If ({(Ini.Oscilloscope = 2) and }(Czesci[0].Czesc[S].TotalNotes>0)) then - begin - Player[I].ScorePercentTarget := Player[I].ScorePercentTarget + floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 40 - 26); - if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0; - if Player[I].ScorePercentTarget > 99 then Player[I].ScorePercentTarget := 99; - - //end Singbar Mod - end; //PhrasenBonus - Line Bonus Mod @@ -1274,50 +1265,12 @@ begin //Update Total Score Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; - {//Color - Case Floor(A) of - 0: begin - Player[I].LineBonus_Color.R := 1; - Player[I].LineBonus_Color.G := 0; - Player[I].LineBonus_Color.B := 0; - end; - 1..3: begin - Player[I].LineBonus_Color.R := 1; - Player[I].LineBonus_Color.G := (A * 0.25); - Player[I].LineBonus_Color.B := 0; - end; - 4: begin - Player[I].LineBonus_Color.R := 1; - Player[I].LineBonus_Color.G := 1; - Player[I].LineBonus_Color.B := 0; - end; - 5..7: begin - Player[I].LineBonus_Color.R := 1-((a-4)*0.25); - Player[I].LineBonus_Color.G := 1; - Player[I].LineBonus_Color.B := 0; - end; - 8: begin - Player[I].LineBonus_Color.R := 0; - Player[I].LineBonus_Color.G := 1; - Player[I].LineBonus_Color.B := 0; - end; - End; //Case - //Player[I].LineBonus_Color.B := 0; - //Player[I].LineBonus_Color.R := (8-A)/8; - //Player[I].LineBonus_Color.G := A/10; - - Player[I].LineBonus_PosX := Player[I].LineBonus_StartX; - Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; - Player[I].LineBonus_Alpha := 0.92; - Player[I].LineBonus_Visible := True; - Player[I].LineBonus_Age := 1;} - //Spawn PopUp If (A >= 8) then A := 8 else IF A < 0 then A := 0; - //Round(Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8)); + Scores.SpawnPopUp(I, Floor(A), Player[I].ScoreTotalI); end; //PhrasenBonus - Line Bonus Mod End// } -- cgit v1.2.3 From 2221d3db9408f3d7c6ee0ab0cc024e253cac80e0 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 27 Sep 2007 11:58:51 +0000 Subject: fixed compile error from whiteshark.. now it compiles :) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@435 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMain.pas | 20 ++ Game/Code/Screens/UScreenMain.pas | 560 +++++++++++++++++++------------------- 2 files changed, 302 insertions(+), 278 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 878ff35c..8dd8c0a3 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -45,6 +45,26 @@ type //LineBonus Mod ScoreLast: Real;//Last Line Score + ScorePercent: integer;//Aktual Fillstate of the SingBar + ScorePercentTarget: integer;//Target Fillstate of the SingBar + //end Singbar Mod + + //PhrasenBonus - Line Bonus Mod + LineBonus_PosX: Single; + LineBonus_PosY: Single; + LineBonus_Alpha: Single; + LineBonus_Visible: boolean; + LineBonus_Text: string; + LineBonus_Color: TRGB; + LineBonus_Age: Integer; + LineBonus_Rating: Integer; + //Variable vor Positioning -> Set on ScreenShow, different when Playercount Changes + LineBonus_TargetX: integer; + LineBonus_TargetY: integer; + LineBonus_StartX: integer; + LineBonus_StartY: integer; + //PhrasenBonus - Line Bonus Mod End + //PerfectLineTwinkle Mod (effect) LastSentencePerfect: Boolean; diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 7bcc9e65..aecc40bb 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -1,278 +1,282 @@ -unit UScreenMain; - -interface - -uses - UMenu, - SDL, - UDisplay, - UMusic, - UFiles, - SysUtils, - UThemes, - ULCD, - ULight; - -type - TScreenMain = class(TMenu) - public - TextDescription: integer; - TextDescriptionLong: integer; - - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - procedure onShow; override; - procedure InteractNext; override; - procedure InteractPrev; override; - procedure InteractInc; override; - procedure InteractDec; override; - procedure UpdateLCD; - procedure SetAnimationProgress(Progress: real); override; - //function Draw: boolean; override; - end; - -implementation - -uses {$IFDEF win32} - windows, - {$ENDIF} - UGraphic, - UMain, - UIni, - UTexture, - USongs, - Textgl, -// opengl, - ULanguage, - UParty, - UDLLManager, - UScreenCredits, - USkins; - - -function TScreenMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -var -I: Integer; -SDL_ModState: Word; -begin - Result := true; - - SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT - + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); - - //Deactivate Credits when Key is pressed -// if Credits_Visible then -// begin -// Credits_Visible := False; -// exit; -// end; - - If (PressedDown) Then - begin // Key Down - case PressedKey of - SDLK_Q: - begin - Result := false; - end; - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - Result := False; - end; - - SDLK_C: - begin - if (SDL_ModState = KMOD_LALT) then - begin - //Credits_Y := 600; - //Credits_Alpha := 0; - //Credits_Visible := True; - Music.PlayStart; - FadeTo(@ScreenCredits); - end; - end; - SDLK_M: - begin - if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then - begin - Music.PlayStart; - FadeTo(@ScreenPartyOptions); - end; - end; - - SDLK_S: - begin - Music.PlayStart; - FadeTo(@ScreenStatMain); - end; - - SDLK_E: - begin - Music.PlayStart; - FadeTo(@ScreenEdit); - end; - - SDLK_RETURN: - begin - //Solo - if (Interaction = 0) then - begin - if (Length(Songs.Song) >= 1) then - begin - Music.PlayStart; - if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1; - if (Ini.Players = 4) then PlayersPlay := 6; - - ScreenName.Goto_SingScreen := False; - FadeTo(@ScreenName); - end - else //show error message - ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); - end; - - //Multi - if Interaction = 1 then begin - if (Length(Songs.Song) >= 1) then - begin - if (Length(DLLMan.Plugins)>=1) then - begin - Music.PlayStart; - FadeTo(@ScreenPartyOptions); - end - else //show error message, No Plugins Loaded - ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS')); - end - else //show error message, No Songs Loaded - ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); - end; - - //Stats - if Interaction = 2 then begin - Music.PlayStart; - FadeTo(@ScreenStatMain); - end; - - //Editor - if Interaction = 3 then begin - Music.PlayStart; - FadeTo(@ScreenEdit); - end; - - //Options - if Interaction = 4 then begin - Music.PlayStart; - FadeTo(@ScreenOptions); - end; - - //Exit - if Interaction = 5 then begin - Result := false; - end; - end; - // Up and Down could be done at the same time, - // but I don't want to declare variables inside - // functions like this one, called so many times - SDLK_DOWN: InteractInc; - SDLK_UP: InteractDec; - SDLK_RIGHT: InteractNext; - SDLK_LEFT: InteractPrev; - end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; - end; -end; - -constructor TScreenMain.Create; -var - I: integer; -begin - inherited Create; - - //---------------- - //Attention ^^: - //New Creation Order needed because of LoadFromTheme - //and Button Collections. - //At First Custom Texts and Statics - //Then LoadFromTheme - //after LoadFromTheme the Buttons and Selects - //---------------- - - - TextDescription := AddText(Theme.Main.TextDescription); - TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong); - - LoadFromTheme(Theme.Main); - - AddButton(Theme.Main.ButtonSolo); - AddButton(Theme.Main.ButtonMulti); - AddButton(Theme.Main.ButtonStat); - AddButton(Theme.Main.ButtonEditor); - AddButton(Theme.Main.ButtonOptions); - AddButton(Theme.Main.ButtonExit); - - Interaction := 0; -end; - -procedure TScreenMain.onShow; -begin - LCD.WriteText(1, ' Choose mode: '); - UpdateLCD; -end; - -procedure TScreenMain.InteractNext; -begin - inherited InteractNext; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; - Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; - UpdateLCD; - Light.LightOne(1, 200); -end; - -procedure TScreenMain.InteractPrev; -begin - inherited InteractPrev; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; - Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; - UpdateLCD; - Light.LightOne(0, 200); -end; - -procedure TScreenMain.InteractDec; -begin - inherited InteractDec; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; - Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; - UpdateLCD; - Light.LightOne(0, 200); -end; - -procedure TScreenMain.InteractInc; -begin - inherited InteractInc; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; - Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; - UpdateLCD; - Light.LightOne(1, 200); -end; - -procedure TScreenMain.UpdateLCD; -begin - case Interaction of - 0: LCD.WriteText(2, ' sing '); - 1: LCD.WriteText(2, ' editor '); - 2: LCD.WriteText(2, ' options '); - 3: LCD.WriteText(2, ' exit '); - end -end; - -procedure TScreenMain.SetAnimationProgress(Progress: real); -begin - Static[0].Texture.ScaleW := Progress; - Static[0].Texture.ScaleH := Progress; -end; -end. +unit UScreenMain; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses + UMenu, + SDL, + UDisplay, + UMusic, + UFiles, + SysUtils, + UThemes, + ULCD, + ULight; + +type + TScreenMain = class(TMenu) + public + TextDescription: integer; + TextDescriptionLong: integer; + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure InteractNext; override; + procedure InteractPrev; override; + procedure InteractInc; override; + procedure InteractDec; override; + procedure UpdateLCD; + procedure SetAnimationProgress(Progress: real); override; + //function Draw: boolean; override; + end; + +implementation + +uses {$IFDEF win32} + windows, + {$ENDIF} + UGraphic, + UMain, + UIni, + UTexture, + USongs, + Textgl, +// opengl, + ULanguage, + UParty, + UDLLManager, + UScreenCredits, + USkins; + + +function TScreenMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var +I: Integer; +SDL_ModState: Word; +begin + Result := true; + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + + //Deactivate Credits when Key is pressed +// if Credits_Visible then +// begin +// Credits_Visible := False; +// exit; +// end; + + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + Result := False; + end; + + SDLK_C: + begin + if (SDL_ModState = KMOD_LALT) then + begin + //Credits_Y := 600; + //Credits_Alpha := 0; + //Credits_Visible := True; + Music.PlayStart; + FadeTo(@ScreenCredits); + end; + end; + SDLK_M: + begin + if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then + begin + Music.PlayStart; + FadeTo(@ScreenPartyOptions); + end; + end; + + SDLK_S: + begin + Music.PlayStart; + FadeTo(@ScreenStatMain); + end; + + SDLK_E: + begin + Music.PlayStart; + FadeTo(@ScreenEdit); + end; + + SDLK_RETURN: + begin + //Solo + if (Interaction = 0) then + begin + if (Length(Songs.Song) >= 1) then + begin + Music.PlayStart; + if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1; + if (Ini.Players = 4) then PlayersPlay := 6; + + ScreenName.Goto_SingScreen := False; + FadeTo(@ScreenName); + end + else //show error message + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); + end; + + //Multi + if Interaction = 1 then begin + if (Length(Songs.Song) >= 1) then + begin + if (Length(DLLMan.Plugins)>=1) then + begin + Music.PlayStart; + FadeTo(@ScreenPartyOptions); + end + else //show error message, No Plugins Loaded + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS')); + end + else //show error message, No Songs Loaded + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); + end; + + //Stats + if Interaction = 2 then begin + Music.PlayStart; + FadeTo(@ScreenStatMain); + end; + + //Editor + if Interaction = 3 then begin + Music.PlayStart; + FadeTo(@ScreenEdit); + end; + + //Options + if Interaction = 4 then begin + Music.PlayStart; + FadeTo(@ScreenOptions); + end; + + //Exit + if Interaction = 5 then begin + Result := false; + end; + end; + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN: InteractInc; + SDLK_UP: InteractDec; + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN : + begin + end; + end; +end; + +constructor TScreenMain.Create; +var + I: integer; +begin + inherited Create; + + //---------------- + //Attention ^^: + //New Creation Order needed because of LoadFromTheme + //and Button Collections. + //At First Custom Texts and Statics + //Then LoadFromTheme + //after LoadFromTheme the Buttons and Selects + //---------------- + + + TextDescription := AddText(Theme.Main.TextDescription); + TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong); + + LoadFromTheme(Theme.Main); + + AddButton(Theme.Main.ButtonSolo); + AddButton(Theme.Main.ButtonMulti); + AddButton(Theme.Main.ButtonStat); + AddButton(Theme.Main.ButtonEditor); + AddButton(Theme.Main.ButtonOptions); + AddButton(Theme.Main.ButtonExit); + + Interaction := 0; +end; + +procedure TScreenMain.onShow; +begin + LCD.WriteText(1, ' Choose mode: '); + UpdateLCD; +end; + +procedure TScreenMain.InteractNext; +begin + inherited InteractNext; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; + UpdateLCD; + Light.LightOne(1, 200); +end; + +procedure TScreenMain.InteractPrev; +begin + inherited InteractPrev; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; + UpdateLCD; + Light.LightOne(0, 200); +end; + +procedure TScreenMain.InteractDec; +begin + inherited InteractDec; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; + UpdateLCD; + Light.LightOne(0, 200); +end; + +procedure TScreenMain.InteractInc; +begin + inherited InteractInc; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; + UpdateLCD; + Light.LightOne(1, 200); +end; + +procedure TScreenMain.UpdateLCD; +begin + case Interaction of + 0: LCD.WriteText(2, ' sing '); + 1: LCD.WriteText(2, ' editor '); + 2: LCD.WriteText(2, ' options '); + 3: LCD.WriteText(2, ' exit '); + end +end; + +procedure TScreenMain.SetAnimationProgress(Progress: real); +begin + Static[0].Texture.ScaleW := Progress; + Static[0].Texture.ScaleH := Progress; +end; +end. -- cgit v1.2.3 From f9f9bf9ddda71fb65949fdea21bb0019445ea7d4 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 27 Sep 2007 12:01:16 +0000 Subject: test build script for bamboo git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@436 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/bamboo-build-win-laz.bat | 1 + 1 file changed, 1 insertion(+) create mode 100644 Game/Code/bamboo-build-win-laz.bat (limited to 'Game/Code') diff --git a/Game/Code/bamboo-build-win-laz.bat b/Game/Code/bamboo-build-win-laz.bat new file mode 100644 index 00000000..aa69e6b2 --- /dev/null +++ b/Game/Code/bamboo-build-win-laz.bat @@ -0,0 +1 @@ +C:\lazarus\fpc\2.0.4\bin\i386-win32\ppc386.exe -S2cgi -OG1 -gl -vewnhi -l -Filib\JEDI-SDLv1.0\SDL\Pas\ -Fuc:\lazarus\components\jpeg\lib\i386-win32\ -Fuc:\lazarus\components\images\lib\i386-win32\ -Fuc:\lazarus\lcl\units\i386-win32\ -Fuc:\lazarus\lcl\units\i386-win32\win32\ -Fuc:\lazarus\packager\units\i386-win32\ -Fu. -oUltraStar.exe -dLCL -dLCLwin32 UltraStar.lpr -- cgit v1.2.3 From f789ab98424f588f0bffedf9e0f2c4a16f5e387a Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 27 Sep 2007 12:09:45 +0000 Subject: fix for lazarus build git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@437 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.lpr | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index 802fb4e5..149573ca 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -124,6 +124,8 @@ uses UTexture in 'Classes\UTexture.pas', UThemes in 'Classes\UThemes.pas', UTime in 'Classes\UTime.pas', + USingScores in 'Classes\USingScores.pas', + USingNotes in 'Classes\USingNotes.pas', //------------------------------ -- cgit v1.2.3 From 60c7258e42776b9f5b054dfcaa2840f813c0a2cc Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 27 Sep 2007 12:15:06 +0000 Subject: test checkin to test bamboo.. :) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@438 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.dpr | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 6aafda26..f795e250 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -381,6 +381,8 @@ begin if Ini.LPT = 1 then LCD.Clear; if Ini.LPT = 2 then Light.TurnOff; + Log.LogStatus('Main Loop', 'Finished'); + Log.Free; end. -- cgit v1.2.3 From cb94be45369f2aefe958b715642895cc6a932b6f Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 27 Sep 2007 12:18:07 +0000 Subject: adding interesting link. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@439 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.lpr | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index 149573ca..5d8cdd81 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -29,6 +29,10 @@ uses // // *************************************************************************** + // Interesting stuff... :) + // http://burningsmell.org/sdl_audioin/ + + //------------------------------ //Includes - 3rd Party Libraries //------------------------------ @@ -120,6 +124,7 @@ uses UPlaylist in 'Classes\UPlaylist.pas', URecord in 'Classes\URecord.pas', USkins in 'Classes\USkins.pas', + USingScores in 'Classes\USingScores.pas', USongs in 'Classes\USongs.pas', UTexture in 'Classes\UTexture.pas', UThemes in 'Classes\UThemes.pas', -- cgit v1.2.3 From cb712545d311092e355b1a805e820ff27bf8889c Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 27 Sep 2007 12:21:13 +0000 Subject: oops.... fixed build issue.. after dud build build#USDX-DEF-7 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@440 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.lpr | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index 5d8cdd81..f47d9d81 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -129,8 +129,7 @@ uses UTexture in 'Classes\UTexture.pas', UThemes in 'Classes\UThemes.pas', UTime in 'Classes\UTime.pas', - USingScores in 'Classes\USingScores.pas', - USingNotes in 'Classes\USingNotes.pas', + USingNotes in 'Classes\USingNotes.pas', //------------------------------ -- cgit v1.2.3 From bf3cb9322bc1f582061b489ddf7a65c681fafed5 Mon Sep 17 00:00:00 2001 From: b1indy Date: Thu, 27 Sep 2007 22:33:35 +0000 Subject: Loading of Covers should now work (should be tested) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@441 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 122 ++++++++++++++++++++++++++++++----------- 1 file changed, 91 insertions(+), 31 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 40a3a30b..76eab676 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -1,4 +1,6 @@ unit UTexture; +// added for easier debug disabling +//{$define blindydebug} // Plain (alpha = 1) // Transparent @@ -111,6 +113,8 @@ type function LoadTexture(Identifier: string): TTexture; overload; function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; procedure UnloadTexture(Name: string; FromCache: boolean); + Constructor Create; + Destructor Destroy; end; var @@ -133,6 +137,7 @@ var Mipmapping: Boolean; CacheMipmap: array[0..256*256*3-1] of byte; // 3KB + CacheMipmapSurface: PSDL_Surface; implementation @@ -143,7 +148,7 @@ uses ULog, {$IFDEF FPC} LResources, {$ENDIF} - StrUtils; + StrUtils, dialogs; const fmt_rgba: TSDL_Pixelformat=(palette: nil; @@ -182,6 +187,16 @@ const Alpha: 255); +Constructor TTextureUnit.Create; +begin + inherited Create; +end; + +Destructor TTextureUnit.Destroy; +begin + inherited Destroy; +end; + function TTextureUnit.pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; begin if (fmt1^.BitsPerPixel = fmt2^.BitsPerPixel) and @@ -364,10 +379,14 @@ var NeededPixFmt: PSDL_Pixelformat; begin NeededPixFmt:=@fmt_rgba; - if Typ= 'Plain' then NeededPixFmt:=@fmt_rgb; + if Typ= 'Plain' then NeededPixFmt:=@fmt_rgb + else if (Typ='Transparent') or (Typ='Colorized') - then NeededPixFmt:=@fmt_rgba; + then NeededPixFmt:=@fmt_rgba + else + NeededPixFmt:=@fmt_rgb; + if not pixfmt_eq(TexSurface^.format, NeededPixFmt) then begin @@ -489,43 +508,58 @@ var MipmapSurface: PSDL_Surface; newWidth, newHeight: Cardinal; oldWidth, oldHeight: Cardinal; - + kopierindex: Cardinal; begin Log.BenchmarkStart(4); Mipmapping := true; - - - (* Log.LogStatus( '', '' ); - + if Identifier = nil then Log.LogStatus(' ERROR unknown Identifier', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+'''') else Log.LogStatus(' should be ok - trying to load', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+''''); *) - // load texture data into memory + // load texture data into memory + {$ifdef blindydebug} + Log.LogStatus('',' LoadImage('''+Identifier+''') (called by '+Format+')'); + {$endif} TexSurface := LoadImage(Identifier); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} if not assigned(TexSurface) then begin Log.LogStatus( 'ERROR Could not load texture' , Identifier +' '+ Format +' '+ Typ ); beep; Exit; end; - - // convert pixel format as needed + // convert pixel format as needed + {$ifdef blindydebug} + Log.LogStatus('',' AdjustPixelFormat'); + {$endif} AdjustPixelFormat(TexSurface, Typ); - - // adjust texture size (scale down, if necessary) - newWidth:=TexSurface^.W; + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + // adjust texture size (scale down, if necessary) + newWidth:=TexSurface.W; newHeight:=TexSurface.H; if (newWidth > Limit) then newWidth:=Limit; if (newHeight > Limit) then newHeight:=Limit; - if (TexSurface.W > newWidth) or (TexSurface^.H > newHeight) then + if (TexSurface.W > newWidth) or (TexSurface.H > newHeight) then + begin + {$ifdef blindydebug} + Log.LogStatus('',' ScaleTexture'); + {$endif} ScaleTexture(TexSurface,newWidth,newHeight); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + end; // don't actually understand, if this is needed... // this should definately be changed... together with all this @@ -534,21 +568,43 @@ begin begin if (Covers.W <= 256) and (Covers.H <= 256) then begin + {$ifdef blindydebug} + Log.LogStatus('',' GetScaledTexture('''+inttostr(Covers.W)+''','''+inttostr(Covers.H)+''') (for CacheMipmap)'); + {$endif} MipmapSurface:=GetScaledTexture(TexSurface,Covers.W, Covers.H); - System.Move(MipmapSurface^.pixels,CacheMipmap,Covers.W*Covers.H*3-1); - SDL_FreeSurface(MipmapSurface); + if assigned(MipmapSurface) then + begin + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + Log.LogStatus('',' BlitSurface Stuff'); + {$endif} + // creating and freeing the surface could be done once, if Cover.W and Cover.H don't change + CacheMipmapSurface:=SDL_CreateRGBSurfaceFrom(@CacheMipmap[0], Covers.W, Covers.H, 24, Covers.W*3, $000000ff, $0000ff00, $00ff0000, 0); + SDL_BlitSurface(MipMapSurface,nil,CacheMipmapSurface,nil); + SDL_FreeSurface(CacheMipmapSurface); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + Log.LogStatus('',' SDL_FreeSurface (CacheMipmap)'); + {$endif} + SDL_FreeSurface(MipmapSurface); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + end + else + begin + Log.LogStatus(' Error creating CacheMipmap',' LoadTexture('''+Identifier+''')'); + end; end; // should i create a cache texture, if Covers.W/H are larger? end; - - // now we might colorize the whole thing + // now we might colorize the whole thing if Typ='Colorized' then ColorizeTexture(TexSurface,Col); - - // save actual dimensions of our texture + // save actual dimensions of our texture oldWidth:=newWidth; oldHeight:=newHeight; - // make texture dimensions be powers of 2 + // make texture dimensions be powers of 2 newWidth:=Round(Power(2, Ceil(Log2(newWidth)))); newHeight:=Round(Power(2, Ceil(Log2(newHeight)))); if (newHeight <> oldHeight) or (newWidth <> oldWidth) then @@ -564,21 +620,19 @@ begin // then we're done manipulating it // and could now create our openGL texture from it - // prepare OpenGL texture + // prepare OpenGL texture glGenTextures(1, ActTex); glBindTexture(GL_TEXTURE_2D, ActTex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - // load data into gl texture - if Typ = 'Plain' then - begin - glTexImage2D(GL_TEXTURE_2D, 0, 3, newWidth, newHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, TexSurface^.pixels); - end; - + // load data into gl texture if (Typ = 'Transparent') or (Typ='Colorized') then begin - glTexImage2D(GL_TEXTURE_2D, 0, 4, newWidth, newHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, TexSurface^.pixels); + glTexImage2D(GL_TEXTURE_2D, 0, 4, newWidth, newHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, TexSurface.pixels); + end + {if Typ = 'Plain' then} else + begin + glTexImage2D(GL_TEXTURE_2D, 0, 3, newWidth, newHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, TexSurface.pixels); end; { if Typ = 'Transparent Range' then @@ -908,7 +962,13 @@ begin if TextureDatabase.Texture[T].Texture.TexNum = -1 then begin // load texture + {$ifdef blindydebug} + Log.LogStatus('...', 'GetTexture('''+Name+''','''+Typ+''')'); + {$endif} TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', pchar(Typ), $0); + {$ifdef blindydebug} + Log.LogStatus('done',' '); + {$endif} end; // use texture -- cgit v1.2.3 From 4ae028b8f6e105f2628303a4f8bacbb6f7bcb93a Mon Sep 17 00:00:00 2001 From: b1indy Date: Thu, 27 Sep 2007 23:01:40 +0000 Subject: TextGL.pas: changed text blendmode... most texts should be readable UDisplay.pas: disabled Screenshot code, something's broken (it's called without me even getting close to the print button), maybe we can fix this and rewrite everything to use SDL_Image (any thoughts on this?) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@442 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.pas | 4 ++-- Game/Code/Menu/UDisplay.pas | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index 5ce3ebf7..c73908f8 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -245,7 +245,7 @@ begin glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBlendFunc(GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR); glBindTexture(GL_TEXTURE_2D, TexNum); glBegin(GL_QUADS); @@ -304,7 +304,7 @@ begin glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBlendFunc(GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR); glBindTexture(GL_TEXTURE_2D, TexNum); glBegin(GL_QUADS); glTexCoord2f(TexX, TexY); glVertex2f(PL+XItal, PT); diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index 6181fab1..077342d3 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -363,6 +363,7 @@ procedure TDisplay.ScreenShot; FileName: String; Num: Integer; begin + Exit; // something broken in here... quick fix... disabled it //bilddatei Suchen for Num := 1 to 9999 do begin FileName := IntToStr(Num); -- cgit v1.2.3 From 668a5da76b4d7179a1286d839a001f9d9fdce456 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Fri, 28 Sep 2007 05:02:30 +0000 Subject: bamboo build script for delphi :) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@443 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/bamboo-build-win-delphi.bat | 1 + 1 file changed, 1 insertion(+) create mode 100644 Game/Code/bamboo-build-win-delphi.bat (limited to 'Game/Code') diff --git a/Game/Code/bamboo-build-win-delphi.bat b/Game/Code/bamboo-build-win-delphi.bat new file mode 100644 index 00000000..794f385f --- /dev/null +++ b/Game/Code/bamboo-build-win-delphi.bat @@ -0,0 +1 @@ +"C:\Program Files\Borland\BDS\4.0\Bin\dcc32.exe" -U"lib\JEDI-SDLv1.0\SDL\Pas" -O"lib\JEDI-SDLv1.0\SDL\Pas" -I"lib\JEDI-SDLv1.0\SDL\Pas" -R"lib\JEDI-SDLv1.0\SDL\Pas" UltraStar.dpr -- cgit v1.2.3 From e5b70a52b5fc4a572136a3a07ee2f5e443c5e52b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 28 Sep 2007 13:57:52 +0000 Subject: Reremoved old TPlayer attributes and removed some code fragments that still links to these attributes git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@444 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMain.pas | 18 ++---------------- Game/Code/Screens/UScreenSing.pas | 7 ------- Game/Code/Screens/UScreenSingModi.pas | 8 ++++---- 3 files changed, 6 insertions(+), 27 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 8dd8c0a3..9b6ea3d5 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -45,7 +45,7 @@ type //LineBonus Mod ScoreLast: Real;//Last Line Score - ScorePercent: integer;//Aktual Fillstate of the SingBar + {ScorePercent: integer;//Aktual Fillstate of the SingBar ScorePercentTarget: integer;//Target Fillstate of the SingBar //end Singbar Mod @@ -63,7 +63,7 @@ type LineBonus_TargetY: integer; LineBonus_StartX: integer; LineBonus_StartY: integer; - //PhrasenBonus - Line Bonus Mod End + //PhrasenBonus - Line Bonus Mod End } //PerfectLineTwinkle Mod (effect) @@ -736,20 +736,6 @@ begin Player[PlayerNum].ScoreGolden := 0; Player[PlayerNum].ScoreGoldenI := 0; Player[PlayerNum].ScoreTotalI := 0; - - - //SingBar Mod - Player[PlayerNum].ScoreLast := 0; - Player[PlayerNum].ScorePercent := 50;// Sets to 50% when song starts - Player[PlayerNum].ScorePercentTarget := 50;// Sets to 50% when song starts - //end SingBar Mod - - //PhrasenBonus - Line Bonus Mod - Player[PlayerNum].LineBonus_Visible := False; //Hide Line Bonus - Player[PlayerNum].LineBonus_Alpha := 0; - Player[PlayerNum].LineBonus_TargetX := 70 + PlayerNum*500; - Player[PlayerNum].LineBonus_TargetY := 30; - //PhrasenBonus - Line Bonus Mod End end; //-------------------- diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 4e60a78b..391fdccf 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1252,13 +1252,6 @@ begin If (Ini.LineBonus > 0) then begin - - //Generate Text - if A >= 8 then - Player[I].LineBonus_Text := Theme.Sing.LineBonusText[8] - else - Player[I].LineBonus_Text := Theme.Sing.LineBonusText[Floor(A)]; - //PhrasenBonus give Points Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8); Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10; diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 44615662..d18dd5bc 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -282,7 +282,7 @@ begin begin if (Player[I].ScoreTotalI<=10000) then PlayerInfo.Playerinfo[I].Score:= Player[I].ScoreTotalI; - PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; + PlayerInfo.Playerinfo[I].Bar := Round(Scores.Players[I].RBPos * 100); end; end; @@ -557,7 +557,7 @@ end; begin if PlayerInfo.Playerinfo[I].Enabled then begin - PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; + //PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; PlayerInfo.Playerinfo[I].Score := Player[I].ScoreTotalI; end; end; @@ -582,8 +582,8 @@ end; //Player[I].ScoreTotal := Player[I].ScoreTotal + (PlayerInfo.Playerinfo[I].Score - Player[I].ScoreTotalI); Player[I].ScoreTotalI := PlayerInfo.Playerinfo[I].Score; end; - if (PlayerInfo.Playerinfo[I].Bar <> Player[I].ScorePercent) then - Player[I].ScorePercentTarget := PlayerInfo.Playerinfo[I].Bar; + {if (PlayerInfo.Playerinfo[I].Bar <> Player[I].ScorePercent) then + Player[I].ScorePercentTarget := PlayerInfo.Playerinfo[I].Bar; } end; // back stereo -- cgit v1.2.3 From 95662b4cb8252ae665de8222762f9fc320f11ea0 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sat, 29 Sep 2007 01:47:49 +0000 Subject: small fixes for lazarus build. cleanup on some code. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@445 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCovers.pas | 511 ++--- Game/Code/Classes/UGraphic.pas | 5 - Game/Code/Classes/UMusic.pas | 2 +- Game/Code/Classes/UTexture.pas | 3 +- Game/Code/Screens/UScreenSong.pas | 4081 +++++++++++++++++++------------------ 5 files changed, 2307 insertions(+), 2295 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UCovers.pas b/Game/Code/Classes/UCovers.pas index 094fe43c..966277cd 100644 --- a/Game/Code/Classes/UCovers.pas +++ b/Game/Code/Classes/UCovers.pas @@ -1,248 +1,263 @@ -unit UCovers; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -uses OpenGL12, - {$IFDEF win32} - windows, - {$ENDIF} - Math, - Classes, - SysUtils, - {$IFNDEF FPC} - Graphics, - {$ENDIF} - UThemes, - UTexture; - -type - TCover = record - Name: string; - W: word; - H: word; - Size: integer; - Position: integer; // position of picture in the cache file -// Data: array of byte; - end; - - TCovers = class - Cover: array of TCover; - W: word; - H: word; - Size: integer; - Data: array of byte; - WritetoFile: Boolean; - - constructor Create; - procedure Load; - procedure Save; - procedure AddCover(Name: string); - function CoverExists(Name: string): boolean; - function CoverNumber(Name: string): integer; - procedure PrepareData(Name: string); - end; - -var - Covers: TCovers; - -implementation - -uses UMain, - // UFiles, - ULog, - DateUtils; - -constructor TCovers.Create; -begin - W := 128; - H := 128; - Size := W*H*3; - Load; - WritetoFile := True; -end; - -procedure TCovers.Load; -var - F: File; - C: integer; // cover number - W: word; - H: word; - Bits: byte; - NLen: word; - Name: string; -// Data: array of byte; -begin - if FileExists(GamePath + 'covers.cache') then - begin - AssignFile(F, GamePath + 'covers.cache'); - Reset(F, 1); - - WritetoFile := not FileIsReadOnly(GamePath + 'covers.cache'); - - SetLength(Cover, 0); - - while not EOF(F) do - begin - SetLength(Cover, Length(Cover)+1); - - BlockRead(F, W, 2); - Cover[High(Cover)].W := W; - - BlockRead(F, H, 2); - Cover[High(Cover)].H := H; - - BlockRead(F, Bits, 1); - - Cover[High(Cover)].Size := W * H * (Bits div 8); - - // test - // W := 128; - // H := 128; - // Bits := 24; - // Seek(F, FilePos(F) + 3); - - BlockRead(F, NLen, 2); - SetLength(Name, NLen); - - BlockRead(F, Name[1], NLen); - Cover[High(Cover)].Name := Name; - - Cover[High(Cover)].Position := FilePos(F); - Seek(F, FilePos(F) + W*H*(Bits div 8)); - - // SetLength(Cover[High(Cover)].Data, W*H*(Bits div 8)); - // BlockRead(F, Cover[High(Cover)].Data[0], W*H*(Bits div 8)); - - end; // While - - CloseFile(F); - end; // fileexists -end; - -procedure TCovers.Save; -var - F: File; - C: integer; // cover number - W: word; - H: word; - NLen: word; - Bits: byte; -begin -{ AssignFile(F, GamePath + 'covers.cache'); - Rewrite(F, 1); - - Bits := 24; - for C := 0 to High(Cover) do begin - W := Cover[C].W; - H := Cover[C].H; - - BlockWrite(F, W, 2); - BlockWrite(F, H, 2); - BlockWrite(F, Bits, 1); - - NLen := Length(Cover[C].Name); - BlockWrite(F, NLen, 2); - BlockWrite(F, Cover[C].Name[1], NLen); - BlockWrite(F, Cover[C].Data[0], W*H*(Bits div 8)); - end; - - CloseFile(F);} -end; - -procedure TCovers.AddCover(Name: string); -var - B: integer; - F: File; - C: integer; // cover number - NLen: word; - Bits: byte; -begin - if not CoverExists(Name) then begin - SetLength(Cover, Length(Cover)+1); - Cover[High(Cover)].Name := Name; - - Cover[High(Cover)].W := W; - Cover[High(Cover)].H := H; - Cover[High(Cover)].Size := Size; - - // do not copy data. write them directly to file -// SetLength(Cover[High(Cover)].Data, Size); -// for B := 0 to Size-1 do -// Cover[High(Cover)].Data[B] := CacheMipmap[B]; - - if WritetoFile then - begin - AssignFile(F, GamePath + 'covers.cache'); - if FileExists(GamePath + 'covers.cache') then begin - Reset(F, 1); - Seek(F, FileSize(F)); - end else - Rewrite(F, 1); - - Bits := 24; - - BlockWrite(F, W, 2); - BlockWrite(F, H, 2); - BlockWrite(F, Bits, 1); - - NLen := Length(Name); - BlockWrite(F, NLen, 2); - BlockWrite(F, Name[1], NLen); - - Cover[High(Cover)].Position := FilePos(F); - BlockWrite(F, CacheMipmap[0], W*H*(Bits div 8)); - - CloseFile(F); - end; - end - else - Cover[High(Cover)].Position := 0; -end; - -function TCovers.CoverExists(Name: string): boolean; -var - C: integer; // cover -begin - Result := false; - C := 0; - while (C <= High(Cover)) and (Result = false) do begin - if Cover[C].Name = Name then Result := true; - Inc(C); - end; -end; - -function TCovers.CoverNumber(Name: string): integer; -var - C: integer; -begin - Result := -1; - C := 0; - while (C <= High(Cover)) and (Result = -1) do begin - if Cover[C].Name = Name then Result := C; - Inc(C); - end; -end; - -procedure TCovers.PrepareData(Name: string); -var - F: File; - C: integer; -begin - if FileExists(GamePath + 'covers.cache') then begin - AssignFile(F, GamePath + 'covers.cache'); - Reset(F, 1); - - C := CoverNumber(Name); - SetLength(Data, Cover[C].Size); - if Length(Data) < 6 then beep; - Seek(F, Cover[C].Position); - BlockRead(F, Data[0], Cover[C].Size); - CloseFile(F); - end; -end; - -end. +unit UCovers; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses OpenGL12, + {$IFDEF win32} + windows, + {$ENDIF} + Math, + Classes, + SysUtils, + {$IFNDEF FPC} + Graphics, + {$ENDIF} + UThemes, + UTexture; + +type + TCover = record + Name: string; + W: word; + H: word; + Size: integer; + Position: integer; // position of picture in the cache file +// Data: array of byte; + end; + + TCovers = class + Cover: array of TCover; + W: word; + H: word; + Size: integer; + Data: array of byte; + WritetoFile: Boolean; + + constructor Create; + procedure Load; + procedure Save; + procedure AddCover(Name: string); + function CoverExists(Name: string): boolean; + function CoverNumber(Name: string): integer; + procedure PrepareData(Name: string); + end; + +var + Covers: TCovers; + +implementation + +uses UMain, + // UFiles, + ULog, + DateUtils; + +constructor TCovers.Create; +begin + W := 128; + H := 128; + Size := W*H*3; + Load; + WritetoFile := True; +end; + +procedure TCovers.Load; +var + F: File; + C: integer; // cover number + W: word; + H: word; + Bits: byte; + NLen: word; + Name: string; +// Data: array of byte; +begin + if FileExists(GamePath + 'covers.cache') then + begin + AssignFile(F, GamePath + 'covers.cache'); + Reset(F, 1); + + WritetoFile := not FileIsReadOnly(GamePath + 'covers.cache'); + + SetLength(Cover, 0); + + while not EOF(F) do + begin + SetLength(Cover, Length(Cover)+1); + + BlockRead(F, W, 2); + Cover[High(Cover)].W := W; + + BlockRead(F, H, 2); + Cover[High(Cover)].H := H; + + BlockRead(F, Bits, 1); + + Cover[High(Cover)].Size := W * H * (Bits div 8); + + // test + // W := 128; + // H := 128; + // Bits := 24; + // Seek(F, FilePos(F) + 3); + + BlockRead(F, NLen, 2); + SetLength(Name, NLen); + + BlockRead(F, Name[1], NLen); + Cover[High(Cover)].Name := Name; + + Cover[High(Cover)].Position := FilePos(F); + Seek(F, FilePos(F) + W*H*(Bits div 8)); + + // SetLength(Cover[High(Cover)].Data, W*H*(Bits div 8)); + // BlockRead(F, Cover[High(Cover)].Data[0], W*H*(Bits div 8)); + + end; // While + + CloseFile(F); + end; // fileexists +end; + +procedure TCovers.Save; +var + F: File; + C: integer; // cover number + W: word; + H: word; + NLen: word; + Bits: byte; +begin +{ AssignFile(F, GamePath + 'covers.cache'); + Rewrite(F, 1); + + Bits := 24; + for C := 0 to High(Cover) do begin + W := Cover[C].W; + H := Cover[C].H; + + BlockWrite(F, W, 2); + BlockWrite(F, H, 2); + BlockWrite(F, Bits, 1); + + NLen := Length(Cover[C].Name); + BlockWrite(F, NLen, 2); + BlockWrite(F, Cover[C].Name[1], NLen); + BlockWrite(F, Cover[C].Data[0], W*H*(Bits div 8)); + end; + + CloseFile(F);} +end; + +procedure TCovers.AddCover(Name: string); +var + B: integer; + F: File; + C: integer; // cover number + NLen: word; + Bits: byte; +begin + if not CoverExists(Name) then + begin + SetLength(Cover, Length(Cover)+1); + Cover[High(Cover)].Name := Name; + + Cover[High(Cover)].W := W; + Cover[High(Cover)].H := H; + Cover[High(Cover)].Size := Size; + + // do not copy data. write them directly to file +// SetLength(Cover[High(Cover)].Data, Size); +// for B := 0 to Size-1 do +// Cover[High(Cover)].Data[B] := CacheMipmap[B]; + + if WritetoFile then + begin + AssignFile(F, GamePath + 'covers.cache'); + + if FileExists(GamePath + 'covers.cache') then + begin + Reset(F, 1); + Seek(F, FileSize(F)); + end + else + begin + Rewrite(F, 1); + end; + + Bits := 24; + + BlockWrite(F, W, 2); + BlockWrite(F, H, 2); + BlockWrite(F, Bits, 1); + + NLen := Length(Name); + BlockWrite(F, NLen, 2); + BlockWrite(F, Name[1], NLen); + + Cover[High(Cover)].Position := FilePos(F); + BlockWrite(F, CacheMipmap[0], W*H*(Bits div 8)); + + CloseFile(F); + end; + end + else + Cover[High(Cover)].Position := 0; +end; + +function TCovers.CoverExists(Name: string): boolean; +var + C: integer; // cover +begin + Result := false; + C := 0; + + while (C <= High(Cover)) and (Result = false) do + begin + if Cover[C].Name = Name then + Result := true; + + Inc(C); + end; +end; + +function TCovers.CoverNumber(Name: string): integer; +var + C: integer; +begin + Result := -1; + C := 0; + + while (C <= High(Cover)) and (Result = -1) do + begin + if Cover[C].Name = Name then + Result := C; + + Inc(C); + end; +end; + +procedure TCovers.PrepareData(Name: string); +var + F: File; + C: integer; +begin + if FileExists(GamePath + 'covers.cache') then + begin + AssignFile(F, GamePath + 'covers.cache'); + Reset(F, 1); + + C := CoverNumber(Name); + SetLength(Data, Cover[C].Size); + if Length(Data) < 6 then beep; + Seek(F, Cover[C].Position); + BlockRead(F, Data[0], Cover[C].Size); + CloseFile(F); + end; +end; + +end. diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 6ea89c0f..44c068a0 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -312,9 +312,6 @@ begin Log.LogStatus('Loading Textures - C', 'LoadTextures'); - {$IFNDEF FPC} - // TODO : jb_FPC why does this cause lazarus build, to have runtime error.. - // TODO : jb_FPC - START HERE !! //Line Bonus PopUp for P := 0 to 8 do begin @@ -357,8 +354,6 @@ begin Tex_ScoreBG[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreBG')), 'PNG', 'Colorized', Col); end; - {$ENDIF} - Log.LogStatus('Loading Textures - D', 'LoadTextures'); end; diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index b9ed47b4..b9f93b29 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -233,7 +233,7 @@ begin if not BASS_Init(1, 44100, 0, fHWND, nil) then begin {$IFNDEF FPC} - // TODO : JB_lazarus find a way to do this nice.. + // TODO : JB_linux find a way to do this nice.. Application.MessageBox ('Could not initialize BASS', 'Error'); {$ENDIF} Exit; diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 76eab676..eb01b4c4 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -980,7 +980,8 @@ begin // use cache texture C := Covers.CoverNumber(Name); - if TextureDatabase.Texture[T].TextureCache.TexNum = -1 then begin + if TextureDatabase.Texture[T].TextureCache.TexNum = -1 then + begin // load texture Covers.PrepareData(Name); TextureDatabase.Texture[T].TextureCache := CreateTexture(Covers.Data, Name, Covers.Cover[C].W, Covers.Cover[C].H, 24); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 569645d4..0a3c1d02 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1,2040 +1,2041 @@ -unit UScreenSong; - -interface -{$I switches.inc} - -uses - UMenu, - SDL, - UMusic, - UFiles, - UTime, - UDisplay, - USongs, - SysUtils, - ULog, - UThemes, - UTexture, - ULanguage, - ULCD, - ULight, - UIni; - -type - TScreenSong = class(TMenu) - public - TextArtist: integer; - TextTitle: integer; - TextNumber: integer; - - //Video Icon Mod - VideoIcon: Cardinal; - - TextCat: integer; - StaticCat: integer; - - SongCurrent: real; - SongTarget: real; - - HighSpeed: boolean; - CoverFull: boolean; - CoverTime: real; - CoverX: integer; - CoverY: integer; - CoverW: integer; - is_jump: boolean; // Jump to Song Mod - is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title - - EqualizerBands: array of Byte; - EqualizerTime: Cardinal; - EqualizerTime2: Byte; - - //Party Mod - Mode: Byte; //0 = Standard, 1= Go to PartyMode after Selection + Change to Random Song at Show - //party Statics (Joker) - StaticTeam1Joker1: Cardinal; - StaticTeam1Joker2: Cardinal; - StaticTeam1Joker3: Cardinal; - StaticTeam1Joker4: Cardinal; - StaticTeam1Joker5: Cardinal; - - StaticTeam2Joker1: Cardinal; - StaticTeam2Joker2: Cardinal; - StaticTeam2Joker3: Cardinal; - StaticTeam2Joker4: Cardinal; - StaticTeam2Joker5: Cardinal; - - StaticTeam3Joker1: Cardinal; - StaticTeam3Joker2: Cardinal; - StaticTeam3Joker3: Cardinal; - StaticTeam3Joker4: Cardinal; - StaticTeam3Joker5: Cardinal; - - StaticParty: Array of Cardinal; - TextParty: Array of Cardinal; - StaticNonParty: Array of Cardinal; - TextNonParty: Array of Cardinal; - - - constructor Create; override; - procedure SetScroll; - procedure SetScroll1; - procedure SetScroll2; - procedure SetScroll3; - procedure SetScroll4; - procedure SetScroll5; - procedure SetScroll6; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure onShow; override; - procedure onHide; override; - procedure SelectNext; - procedure SelectPrev; - procedure UpdateLCD; - procedure SkipTo(Target: Cardinal); - procedure FixSelected; //Show Wrong Song when Tabs on Fix - procedure FixSelected2; //Show Wrong Song when Tabs on Fix - procedure ShowCatTL(Cat: Integer);// Show Cat in Top left - procedure ShowCatTLCustom(Caption: String);// Show Custom Text in Top left - procedure HideCatTL;// Show Cat in Tob left - procedure Refresh; //Refresh Song Sorting - procedure DrawEqualizer; - procedure ChangeMusic; - //Party Mode - procedure SelectRandomSong; - procedure SetJoker; - procedure SetStatics; - //procedures for Menu - procedure StartSong; - procedure OpenEditor; - procedure DoJoker(Team: Byte); - procedure SelectPlayers; - - procedure UnLoadDetailedCover; - - //Extensions - procedure DrawExtensions; - end; - -implementation -uses UGraphic, - UMain, - UCovers, - math, - OpenGL12, - {$IFDEF win32} - windows, - {$ELSE} - lclintf, - {$ENDIF} - USkins, - UDLLManager, - UParty, - UPlaylist, - UScreenSongMenu; - -// ***** Public methods ****** // - -//Show Wrong Song when Tabs on Fix -procedure TScreenSong.FixSelected; -var I, I2: Integer; - begin - if CatSongs.VisibleSongs > 0 then - begin - I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do - begin - if CatSongs.Song[I].Visible then - inc(I2); - - if I = Interaction - 1 then - break; - end; - - SongCurrent := I2; - SongTarget := I2; - end; - end; - -procedure TScreenSong.FixSelected2; -var I, I2: Integer; - begin - if CatSongs.VisibleSongs > 0 then - begin - I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do - begin - if CatSongs.Song[I].Visible then - inc(I2); - - if I = Interaction - 1 then - break; - end; - - SongTarget := I2; - end; - end; -//Show Wrong Song when Tabs on Fix End - - procedure TScreenSong.ShowCatTLCustom(Caption: String);// Show Custom Text in Top left - begin - Text[TextCat].Text := Caption; - Text[TextCat].Visible := true; - Static[StaticCat].Visible := False; - end; - - //Show Cat in Top Left Mod - procedure TScreenSong.ShowCatTL(Cat: Integer); - begin - //Change - Text[TextCat].Text := CatSongs.Song[Cat].Artist; - //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover); - //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); - - Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); - //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false); - //Button[Cat]. - //Cover - - - //Show - Text[TextCat].Visible := true; - Static[StaticCat].Visible := True; - end; - - procedure TScreenSong.HideCatTL; - begin - //Hide - //Text[TextCat].Visible := false; - Static[StaticCat].Visible := false; - //New -> Show Text specified in Theme - Text[TextCat].Visible := True; - Text[TextCat].Text := Theme.Song.TextCat.Text; - end; - //Show Cat in Top Left Mod End - - -// Method for input parsing. If False is returned, GetNextWindow -// should be checked to know the next window to load; -function TScreenSong.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -var - I: integer; - I2: integer; - HS: integer; - SDL_ModState: Word; - Letter: Char; -begin - Result := true; - - //Song Screen Extensions (Jumpto + Menu) - if (ScreenSongMenu.Visible) then - begin - Result := ScreenSongMenu.ParseInput(PressedKey, ScanCode, PressedDown); - Exit; - end - else if (ScreenSongJumpto.Visible) then - begin - Result := ScreenSongJumpto.ParseInput(PressedKey, ScanCode, PressedDown); - Exit; - end; - - If (PressedDown) Then - begin // Key Down - - SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT - + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); - - //Jump to Artist/Titel - if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then - begin - Letter := UpCase(Chr(ScanCode)); - I2 := Length(CatSongs.Song); - - //Jump To Titel - if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then - begin - For I := 1 to high(CatSongs.Song) do - begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then - begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - - Music.PlayChange; - - ChangeMusic; - SetScroll4; - UpdateLCD; - //Break and Exit - Exit; - end; - end; - end - //Jump to Artist - else if (SDL_ModState = KMOD_LALT) then - begin - For I := 1 to high(CatSongs.Song) do - begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Artist[1]) = Letter) then - begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - - Music.PlayChange; - - ChangeMusic; - SetScroll4; - UpdateLCD; - - //Break and Exit - Exit; - end; - end; - end; - Exit; - end; - - case PressedKey of - SDLK_Q: - begin - Result := false; - end; - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - if (Mode = 0) then - begin - //On Escape goto Cat-List Hack - if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then - begin - //Find Category - I := Interaction; - while not catsongs.Song[I].Main do - begin - Dec (I); - if (I < low(catsongs.Song)) then - break; - end; - if (I<= 1) then - Interaction := high(catsongs.Song) - else - Interaction := I - 1; - - //Stop Music - Music.Stop; - - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - HideCatTL; - - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - //SelectPrev; - //CatSongs.Song[0].Visible := False; - end - else - begin - //On Escape goto Cat-List Hack End - //Tabs off and in Search or Playlist -> Go back to Song view - if (CatSongs.CatNumShow < -1) then - begin - //Atm: Set Empty Filter - CatSongs.SetFilter('', 0); - - //Show Cat in Top Left Mod - HideCatTL; - Interaction := 0; - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - - ChangeMusic; - end - else - begin - Music.Stop; - Music.PlayBack; - - FadeTo(@ScreenMain); - end; - - end; - end - //When in party Mode then Ask before Close - else if (Mode = 1) then - begin - Music.PlayBack; - CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); - end; - end; - SDLK_RETURN: - begin - if Length(Songs.Song) > 0 then - begin - {$IFDEF UseSerialPort} - // PortWriteB($378, 0); - {$ENDIF} - if CatSongs.Song[Interaction].Main then - begin // clicked on Category Button - - //Show Cat in Top Left Mod - ShowCatTL (Interaction); - - //I := CatSongs.VisibleIndex(Interaction); - CatSongs.ClickCategoryButton(Interaction); - {I2 := CatSongs.VisibleIndex(Interaction); - SongCurrent := SongCurrent - I + I2; - SongTarget := SongTarget - I + I2; } - -// if I<>I2 then beep; - // SetScroll4; - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - - //Play Music: - ChangeMusic; - - end else begin // clicked on song - if (Mode = 0) then //Normal Mode -> Start Song - begin - //Do the Action that is specified in Ini - case Ini.OnSongClick of - 0: StartSong; - 1: SelectPlayers; - 2:begin - If (CatSongs.CatNumShow = -3) then - ScreenSongMenu.MenuShow(SM_Playlist) - else - ScreenSongMenu.MenuShow(SM_Main); - end; - end; - end - else if (Mode = 1) then //PartyMode -> Show Menu - begin - if (Ini.PartyPopup = 1) then - ScreenSongMenu.MenuShow(SM_Party_Main) - else - ScreenSong.StartSong; - end; - end; - end; - end; - - SDLK_M: //Show SongMenu - begin - if (Length(Songs.Song) > 0) then begin - if (Mode = 0) then begin - if not CatSongs.Song[Interaction].Main then begin // clicked on Song - if CatSongs.CatNumShow = -3 then - ScreenSongMenu.MenuShow(SM_Playlist) - else - ScreenSongMenu.MenuShow(SM_Main); - end - else - begin - ScreenSongMenu.MenuShow(SM_Playlist_Load); - end; - end //Party Mode -> Show Party Menu - else ScreenSongMenu.MenuShow(SM_Party_Main); - end; - end; - - SDLK_P: //Show Playlist Menu - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin - ScreenSongMenu.MenuShow(SM_Playlist_Load); - end; - end; - - SDLK_J: //Show Jumpto Menu - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then - begin - ScreenSongJumpto.Visible := True; - end; - end; - - SDLK_DOWN: - begin - if (Mode = 0) then - begin - //Only Change Cat when not in Playlist or Search Mode - if (CatSongs.CatNumShow > -2) then - begin - //Cat Change Hack - if Ini.Tabs_at_startup = 1 then - begin - I := Interaction; - if I <= 0 then I := 1; - - while not catsongs.Song[I].Main do - begin - Inc (I); - if (I > high(catsongs.Song)) then - I := low(catsongs.Song); - end; - - Interaction := I; - - //Show Cat in Top Left Mod - ShowCatTL (Interaction); - - CatSongs.ClickCategoryButton(Interaction); - SelectNext; - FixSelected; - - //Play Music: - Music.PlayChange; - ChangeMusic; - - end; - - // - //Cat Change Hack End} - end; - end; - end; - SDLK_UP: - begin - if (Mode = 0) then - begin - //Only Change Cat when not in Playlist or Search Mode - if (CatSongs.CatNumShow > -2) then - begin - //Cat Change Hack - if Ini.Tabs_at_startup = 1 then - begin - I := Interaction; - I2 := 0; - if I <= 0 then I := 1; - - while not catsongs.Song[I].Main or (I2 = 0) do - begin - if catsongs.Song[I].Main then - Inc(I2); - Dec (I); - if (I < low(catsongs.Song)) then - I := high(catsongs.Song); - end; - - Interaction := I; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - FixSelected; - - //Play Music: - Music.PlayChange; - ChangeMusic; - end; - end; - //Cat Change Hack End} - end; - end; - - SDLK_RIGHT: - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin - Music.PlayChange; - SelectNext; -// InteractNext; -// SongTarget := Interaction; - ChangeMusic; - SetScroll4; - UpdateLCD; - Light.LightOne(1, 200); - end; - end; - - SDLK_LEFT: - begin - if (Length(Songs.Song) > 0)AND (Mode = 0) then begin - Music.PlayChange; - SelectPrev; - ChangeMusic; - SetScroll4; - UpdateLCD; - Light.LightOne(0, 200); - end; - end; - - SDLK_E: - begin - OpenEditor; - end; - - SDLK_R: - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin - - if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category - begin - I2 := 0; //Count Cats - for I:= low(CatSongs.Song) to high (CatSongs.Song) do - if CatSongs.Song[I].Main then Inc(I2); - - I2 := Random (I2)+1; //Zufall - - //Find Cat: - for I:= low(CatSongs.Song) to high (CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - Dec(I2); - if (I2<=0) then - begin - //Show Cat in Top Left Mod - ShowCatTL (I); - - Interaction := I; - - CatSongs.ShowCategoryList; - CatSongs.ClickCategoryButton(I); - SelectNext; - FixSelected; - break; - end; - end; - - - end - else if (SDL_ModState = KMOD_LCTRL) AND (Ini.Tabs_at_startup = 1) then //random in All Categorys - begin - repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; - - //Search Cat - for I := I2 downto low(CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - break; - end; - //In I ist jetzt die Kategorie in I2 der Song - - //Choose Cat - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - - //Fix: Not Existing Song selected: - //if (I+1=I2) then Inc(I2); - - //Choose Song - SkipTo(I2-I); - - end - else //Random in one Category - begin - SkipTo(Random(CatSongs.VisibleSongs)); - end; - Music.PlayChange; - - ChangeMusic; - SetScroll4; - UpdateLCD; - end; - end; - - SDLK_1: - begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[0].Joker); - SelectRandomSong; - SetJoker; - end; - end; - - SDLK_2: - begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[1].Joker); - SelectRandomSong; - SetJoker; - end; - end; - - SDLK_3: - begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[2].Joker); - SelectRandomSong; - SetJoker; - end; - end; - end; - end; -end; - -constructor TScreenSong.Create; -var - Pet: integer; - I: integer; -Label CreateSongButtons; -begin - inherited Create; - - LoadFromTheme(Theme.Song); - - TextArtist := AddText(Theme.Song.TextArtist); - TextTitle := AddText(Theme.Song.TextTitle); - TextNumber := AddText(Theme.Song.TextNumber); - - //Show Cat in Top Left mod - TextCat := AddText(Theme.Song.TextCat); - StaticCat := AddStatic(Theme.Song.StaticCat); - - //Show Video Icon Mod - VideoIcon := AddStatic(Theme.Song.VideoIcon); - - //Party Mode - StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1); - StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2); - StaticTeam1Joker3 := AddStatic(Theme.Song.StaticTeam1Joker3); - StaticTeam1Joker4 := AddStatic(Theme.Song.StaticTeam1Joker4); - StaticTeam1Joker5 := AddStatic(Theme.Song.StaticTeam1Joker5); - - StaticTeam2Joker1 := AddStatic(Theme.Song.StaticTeam2Joker1); - StaticTeam2Joker2 := AddStatic(Theme.Song.StaticTeam2Joker2); - StaticTeam2Joker3 := AddStatic(Theme.Song.StaticTeam2Joker3); - StaticTeam2Joker4 := AddStatic(Theme.Song.StaticTeam2Joker4); - StaticTeam2Joker5 := AddStatic(Theme.Song.StaticTeam2Joker5); - - StaticTeam3Joker1 := AddStatic(Theme.Song.StaticTeam3Joker1); - StaticTeam3Joker2 := AddStatic(Theme.Song.StaticTeam3Joker2); - StaticTeam3Joker3 := AddStatic(Theme.Song.StaticTeam3Joker3); - StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); - StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); - - //Load Party or NonParty specific Statics and Texts - SetLength(StaticParty, Length(Theme.Song.StaticParty)); - for I := 0 to High(Theme.Song.StaticParty) do - StaticParty[I] := AddStatic(Theme.Song.StaticParty[I]); - - SetLength(TextParty, Length(Theme.Song.TextParty)); - for I := 0 to High(Theme.Song.TextParty) do - TextParty[I] := AddText(Theme.Song.TextParty[I]); - - SetLength(StaticNonParty, Length(Theme.Song.StaticNonParty)); - for I := 0 to High(Theme.Song.StaticNonParty) do - StaticNonParty[I] := AddStatic(Theme.Song.StaticNonParty[I]); - - SetLength(TextNonParty, Length(Theme.Song.TextNonParty)); - for I := 0 to High(Theme.Song.TextNonParty) do - TextNonParty[I] := AddText(Theme.Song.TextNonParty[I]); - - // Song List -// Songs.LoadSongList; // moved to the UltraStar unit - CatSongs.Refresh; - - if (length(CatSongs.Song) > 0) then - begin - //Set Length of Button Array one Time Instead of one time for every Song - SetButtonLength(Length(CatSongs.Song)); - - I := 0; - CreateSongButtons: - - try - for Pet := I to High(CatSongs.Song) do begin // creating all buttons - // new - Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 - - if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then - CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' - - if CatSongs.Song[Pet].Cover = '' then - AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) - else begin - // cache texture if there is a need to this - if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then begin - Texture.CreateCacheMipmap := true; - Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap - Texture.CreateCacheMipmap := false; - - // puts this texture to the cache file - Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); - - // unload full size texture - Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); - - // we should also add mipmap texture by calling createtexture and use mipmap cache as data source - end; - - // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) - AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); - end; - Texture.Limit := 1024*1024; - I := -1; - end; - except - //When Error is reported the First time for this Song - if (I <> Pet) then - begin - //Some Error reporting: - Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); - - //Change Cover to NoCover and Continue Loading - CatSongs.Song[Pet].Cover := ''; - I := Pet; - end - else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song - begin - Log.LogError('NoCover Cover is damaged!'); - try - AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); - except - {$IFDEF win32} - Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); - {$ELSE} - // TODO : JB_linux - better handle this message and display to user.. - writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'); - Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' ); - {$ENDIF} - Halt; - end; - I := Pet + 1; - end; - end; - - if (I <> -1) then - GoTo CreateSongButtons; - - end; - - // Randomize Patch - Randomize; - //Equalizer - SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); - //ClearArray - For I := low(EqualizerBands) to high(EqualizerBands) do - EqualizerBands[I] := 3; - - if (Length(CatSongs.Song) > 0) then - Interaction := 0; -end; - -procedure TScreenSong.SetScroll; -var - VS, B: Integer; -begin - VS := CatSongs.VisibleSongs; - if VS > 0 then - begin - //Set Positions - Case Theme.Song.Cover.Style of - 3: SetScroll3; - 5:begin - if VS > 5 then - SetScroll5 - else - SetScroll4; - end; - 6: SetScroll6; - else SetScroll4; - end; - //Set Visibility of Video Icon - Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> ''); - - //Set Texts: - Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; - Text[TextTitle].Text := CatSongs.Song[Interaction].Title; - if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then - begin - Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); - Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; - end - else if (CatSongs.CatNumShow = -2) then - Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) - else if (CatSongs.CatNumShow = -3) then - Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) - else if (Ini.Tabs_at_startup = 1) then - Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) - else - Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); - end - else - begin - Text[TextNumber].Text := '0/0'; - Text[TextArtist].Text := ''; - Text[TextTitle].Text := ''; - for B := 0 to High(Button) do - Button[B].Visible := False; - - end; -end; - -procedure TScreenSong.SetScroll1; -var - B: integer; // button - BMin: integer; // button min - BMax: integer; // button max - Src: integer; -// Dst: integer; - Count: integer; // Dst is not used. Count is used. - Ready: boolean; - - VisCount: integer; // count of visible (or selectable) buttons - VisInt: integer; // visible position of interacted button - Typ: integer; // 0 when all songs fits the screen - Placed: integer; // number of placed visible buttons -begin -// Src := 0; -// Dst := -1; - Count := 1; - Typ := 0; - Ready := false; - Placed := 0; - - VisCount := 0; - for B := 0 to High(Button) do - if CatSongs.Song[B].Visible then Inc(VisCount); - - VisInt := 0; - for B := 0 to Interaction-1 do - if CatSongs.Song[B].Visible then Inc(VisInt); - - - if VisCount <= 6 then begin - Typ := 0; - end else begin - if VisInt <= 3 then begin - Typ := 1; - Count := 7; - Ready := true; - end; - - if (VisCount - VisInt) <= 3 then begin - Typ := 2; - Count := 7; - Ready := true; - end; - - if not Ready then begin - Typ := 3; - Src := Interaction; - end; - end; - - - - // hide all buttons - for B := 0 to High(Button) do begin - Button[B].Visible := false; - Button[B].Selectable := CatSongs.Song[B].Visible; - end; - -{ for B := Src to Dst do begin -// Button[B].Visible := true; - Button[B].Visible := CatSongs.Song[B].Visible; - Button[B].Selectable := Button[B].Visible; - Button[B].Y := 140 + (B-Src) * 60; - end;} - - - if Typ = 0 then begin - for B := 0 to High(Button) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (Placed) * 60; - Inc(Placed); - end; - end; - end; - - if Typ = 1 then begin - B := 0; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Inc(B); - end; - end; - - if Typ = 2 then begin - B := High(Button); - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (6-Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Dec(B); - end; - end; - - if Typ = 3 then begin - B := Src; - Count := 4; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (3+Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Inc(B); - end; - - B := Src-1; - Placed := 0; - Count := 3; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (2-Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Dec(B); - end; - - end; - - if Length(Button) > 0 then - Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture -end; - -procedure TScreenSong.SetScroll2; -var - B: integer; - Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu - Wsp2: real; -begin - // liniowe - for B := 0 to High(Button) do - Button[B].X := 300 + (B - Interaction) * 260; - - if Length(Button) >= 3 then begin - if Interaction = 0 then - Button[High(Button)].X := 300 - 260; - - if Interaction = High(Button) then - Button[0].X := 300 + 260; - end; - - // kolowe -{ for B := 0 to High(Button) do begin - Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. - Wsp2 := Wsp / Length(Button); - Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); -// Button[B].Y := 140 + 50 * ; - end;} -end; - -procedure TScreenSong.SetScroll3; // with slide -var - B: integer; - Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu - Wsp2: real; -begin - SongTarget := Interaction; - - // liniowe - for B := 0 to High(Button) do - begin - Button[B].X := 300 + (B - SongCurrent) * 260; - if (Button[B].X < -Button[B].W) OR (Button[B].X > 800) then - Button[B].Visible := False - else - Button[B].Visible := True; - end; - -{ if Length(Button) >= 3 then begin - if Interaction = 0 then - Button[High(Button)].X := 300 - 260; - - if Interaction = High(Button) then - Button[0].X := 300 + 260; - end;} - - // kolowe -{ for B := 0 to High(Button) do begin - Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. - Wsp2 := Wsp / Length(Button); - Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); -// Button[B].Y := 140 + 50 * ; - end;} -end; - -procedure TScreenSong.SetScroll4; // rotate -var - B: integer; - Wsp: real; - Z, Z2: real; - VS: integer; -begin - VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important - - // kolowe - for B := 0 to High(Button) do begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2; - Z2 := (1 + 2*Z) / 3; - - - Button[B].X := Theme.Song.Cover.X + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - Button[B].Z := Z / 2 + 0.3; - - Button[B].W := Theme.Song.Cover.H * Z2; - -// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; - Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; - Button[B].H := Button[B].W; - end; - end; -end; - -(* -procedure TScreenSong.SetScroll4; // rotate -var - B: integer; - Wsp: real; - Z: real; - Z2, Z3: real; - VS: integer; - function modreal (const X, Y: real):real; - begin - Result := Frac(x / y) * y; - if Result < -3 then - Result := Result + Y - else if Result > 3 then - Result := Result - Y; - end; -begin - VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important - Z3 := 1; - if VS < 12 then - Z2 := VS - else - Z2 := 12; - - // kolowe - for B := 0 to High(Button) do begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - if ((ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)>-3) AND (ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)<3)) then - begin - if CatSongs.VisibleIndex(B)> SongCurrent then - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2 - else - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2; - - Z3 := 2; - Z := (1 + cos(Wsp)) / 2; - //Z2 := (1 + 2*Z) / 3; - //Z2 := (0.5 + Z/2); - //Z2 := sin(Wsp); - - //Z2 := Power (Z2,Z3); - - Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); - - //Button[B].X := Theme.Song.CoverX + ({Theme.Song.CoverX + Theme.Song.CoverW/2 + Theme.Song.CoverW*0.18 * VS {CatSongs.VisibleSongs {Length(Button) * sin(Wsp) {- Theme.Song.CoverX - Theme.Song.CoverW) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - if (sin(Wsp)<0) then - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W - else //*Theme.Song.CoverW*0.004*Z3 - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; - Button[B].Z := Z-0.00001; - -// Button[B].Y := {50 + 140 + 50 - 50 * Z2; - // Button[B].Y := (Theme.Song.CoverY + 40 + 50 - 50 * Z2); - Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); - Button[B].H := Button[B].W; - Button[B].Visible := True; - end - {else if (((CatSongs.VisibleIndex(B) - SongCurrent)>-3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) OR ((round (CatSongs.VisibleIndex(B) - SongCurrent) mod VS > -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) then - begin - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / 12 ;// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2 -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); - - if (sin(Wsp)<0) then - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W - else - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; - - Button[B].Z := Z; - - Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); - - Button[B].H := Button[B].W; - Button[B].Visible := True; - end - else Button[B].Visible := False; - end; - end; -end; *) - -procedure TScreenSong.SetScroll5; // rotate -var - B: integer; - Angle: real; - Pos: Real; - VS: integer; - diff: real; - X: Real; - helper: real; -begin - VS := CatSongs.VisibleSongs; // cache Visible Songs - {Vars - Theme.Song.CoverW: Radius des Kreises - Theme.Song.CoverX: X Pos Linke Kante des gewählten Covers - Theme.Song.CoverX: Y Pos Obere Kante des gewählten Covers - Theme.Song.CoverH: Höhe der Cover - - (CatSongs.VisibleIndex(B) - SongCurrent)/VS = Abstand zum MIttleren Cover in % - } - - //Change Pos of all Buttons - for B := low(Button) to high(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility - if Button[B].Visible then //Only Change Pos for Visible Buttons - begin - Pos := (CatSongs.VisibleIndex(B) - SongCurrent); - if (Pos < -VS/2) then - Pos := Pos + VS - else if (Pos > VS/2) then - Pos := Pos - VS; - - if (Abs(Pos) < 2.5) then {fixed Positions} - begin - Angle := Pi * (Pos / 5); -// Button[B].Visible := False; - - Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); - -// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Z := 0.95 - Abs(Pos) * 0.01; - - Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); - - Button[B].W := Button[B].H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - - X := Sin(Angle*1.3)*0.9; - - Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Diff; - - end - else - begin {Behind the Front Covers} - - // limit-bg-covers hack - if (abs(abs(Pos)-VS/2)>10) then Button[B].Visible:=False; - // end of limit-bg-covers hack - - if Pos < 0 then - Pos := (Pos - VS/2)/VS - else - Pos := (Pos + VS/2)/VS; - - Angle := pi * Pos*2; - if VS > 24 then - begin - if Angle < 0 then helper:=-1 else helper:=1; - Angle:=2*pi-abs(Angle); - Angle:=Angle*(VS/24); - Angle:=(2*pi-Angle)*helper; - end; - - Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); - - Button[B].W := Button[B].H; - - Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; - -// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*((Theme.Song.Cover.H)*sin(Angle/2)*1.52); - - end; - - //Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field -// Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); - - end; - end; -end; - -procedure TScreenSong.SetScroll6; // rotate (slotmachine style) -var - B: integer; - Angle: real; - Pos: Real; - VS: integer; - diff: real; - X: Real; - Wsp: real; - Z, Z2: real; -begin - VS := CatSongs.VisibleSongs; // cache Visible Songs - if VS <=5 then begin - // kolowe - for B := 0 to High(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2; - Z2 := (1 + 2*Z) / 3; - - - Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - Button[B].Z := Z / 2 + 0.3; - - Button[B].W := Theme.Song.Cover.H * Z2; - -// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; - Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; - Button[B].H := Button[B].W; - end; - end; - end - else begin - - //Change Pos of all Buttons - for B := low(Button) to high(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility - if Button[B].Visible then //Only Change Pos for Visible Buttons - begin - Pos := (CatSongs.VisibleIndex(B) - SongCurrent); - if (Pos < -VS/2) then - Pos := Pos + VS - else if (Pos > VS/2) then - Pos := Pos - VS; - - if (Abs(Pos) < 2.5) then {fixed Positions} - begin - Angle := Pi * (Pos / 5); -// Button[B].Visible := False; - - Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); - - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Z := 0.95 - Abs(Pos) * 0.01; - - Button[B].X := (Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); - - Button[B].W := Button[B].H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - - X := Sin(Angle*1.3)*0.9; - - Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff; - end - else - begin {Behind the Front Covers} - - // limit-bg-covers hack - if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; - if VS > 25 then VS:=25; - // end of limit-bg-covers hack - - if Pos < 0 then - Pos := (Pos - VS/2)/VS - else - Pos := (Pos + VS/2)/VS; - - Angle := pi * Pos*2; - - Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); - - Button[B].W := Button[B].H; - - Button[B].X := Theme.Song.Cover.X - (Button[B].H - Theme.Song.Cover.H)*0.5; - - - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Y := Theme.Song.Cover.Y+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*(Theme.Song.Cover.H*sin(Angle/2)*1.52); - end; - end; - end; - end; -end; - - -procedure TScreenSong.onShow; -begin - Music.Stop; - - if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; - if Ini.Players = 4 then PlayersPlay := 6; - - //Cat Mod etc - if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then - begin - CatSongs.ShowCategoryList; - FixSelected; - //Show Cat in Top Left Mod - HideCatTL; - end; - - - if Length(CatSongs.Song) > 0 then begin - //Load Music only when Song Preview is activated - if (Ini.PreviewVolume <> 0) then - begin - Music.SetLoop(false); - Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); - Music.MoveTo(Music.Length / 4); - Music.Play; - - //Set Preview Volume - Music.SetMusicVolume (Ini.PreviewVolume * 10); - {//if Music Fade is activated, Set Volume to 0 % - if (Ini.PreviewFading <> 0) then - Music.SetMusicVolume(0);} - end; - - SetScroll; - UpdateLCD; - end; - - //Playlist Mode - if (Mode = 0) then - begin - //If Playlist Shown -> Select Next automatically - if (CatSongs.CatNumShow = -3) then - begin - SelectNext; - ChangeMusic; - end; - end - //Party Mode - else if (Mode = 1) then - begin - - SelectRandomSong; - //Show Menu directly in PartyMode - //But only if selected in Options - if (Ini.PartyPopup = 1) then - begin - ScreenSongMenu.MenuShow(SM_Party_Main); - end; - - - end; - - SetJoker; - SetStatics; -end; - -procedure TScreenSong.onHide; -begin - //When Music Fading is activated, Turn Music to 100 % - If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then - Music.SetMusicVolume(100); - - //If Preview is deactivated: Load MUsicfile now - If (Ini.PreviewVolume = 0) then - Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); - - //When hide then Stop Music (For Party Mode Popup on Exit) - if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then - Music.Stop; -end; - -procedure TScreenSong.DrawExtensions; -begin - //Draw Song Menu - if (ScreenSongMenu.Visible) then - begin - ScreenSongMenu.Draw; - end - else if (ScreenSongJumpto.Visible) then - begin - ScreenSongJumpto.Draw; - end -end; - -function TScreenSong.Draw: boolean; -var - dx: real; - dt: real; - I: Integer; -begin - dx := SongTarget-SongCurrent; - dt := TimeSkip*7; - if dt > 1 then dt := 1; - SongCurrent := SongCurrent + dx*dt; - -{ if SongCurrent > Catsongs.VisibleSongs then begin - SongCurrent := SongCurrent - Catsongs.VisibleSongs; - SongTarget := SongTarget - Catsongs.VisibleSongs; - end;} - -// Log.BenchmarkStart(5); - SetScroll; -// Log.BenchmarkEnd(5); -// Log.LogBenchmark('SetScroll4', 5); - - //Fading Functions, Only if Covertime is under 5 Seconds - If (CoverTime < 5) then - begin - // 0.5.0: cover fade - if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin - // load new texture - Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); - Button[Interaction].Texture.Alpha := 1; - Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); - Button[Interaction].Texture2.Alpha := 1; - end; - - //Song Fade - if (CatSongs.VisibleSongs > 0) AND (Ini.PreviewVolume <> 0) AND (Not CatSongs.Song[Interaction].Main) AND (Ini.PreviewFading <> 0) then - begin - //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling - if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then - Music.Play; - - //Update Song Volume - if (CoverTime < Ini.PreviewFading) then - Music.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) - else - Music.SetMusicVolume(Ini.PreviewVolume * 10); - - end; - - - //Update Fading Time - CoverTime := CoverTime + TimeSkip; - - //Update Fading Texture - Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; - if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; - - end; - - //inherited Draw; - //heres a little Hack, that causes the Statics - //are Drawn after the Buttons because of some Blending Problems. - //This should cause no Problems because all Buttons on this screen - //Has Z Position. - //Draw BG - DrawBG; - - //Instead of Draw FG Procedure: - //We draw Buttons for our own - for I := 0 to Length(Button) - 1 do - Button[I].Draw; - - // Statics - for I := 0 to Length(Static) - 1 do - Static[I].Draw; - - // and texts - for I := 0 to Length(Text) - 1 do - Text[I].Draw; - - - //Draw Equalizer - if Theme.Song.Equalizer.Visible then - DrawEqualizer; - - DrawExtensions; - -end; - -procedure TScreenSong.SelectNext; -var - Skip: integer; - I: integer; - VS: Integer; -begin - VS := CatSongs.VisibleSongs; - - if VS > 0 then - begin - UnLoadDetailedCover; - - Skip := 1; - - // this 1 could be changed by CatSongs.FindNextVisible - while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); - - SongTarget := SongTarget + 1;//Skip; - - Interaction := (Interaction + Skip) mod Length(Interactions); - - // try to keep all at the beginning - if SongTarget > VS-1 then begin - SongTarget := SongTarget - VS; - SongCurrent := SongCurrent - VS; - end; - - end; - // Interaction -> Button, ktorego okladke przeczytamy - // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture -end; - -procedure TScreenSong.SelectPrev; -var - Skip: integer; - I: integer; - VS: Integer; -begin - VS := CatSongs.VisibleSongs; - - if VS > 0 then - begin - UnLoadDetailedCover; - - Skip := 1; - - while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); - SongTarget := SongTarget - 1;//Skip; - - Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); - - // try to keep all at the beginning - if SongTarget < 0 then begin - SongTarget := SongTarget + CatSongs.VisibleSongs; - SongCurrent := SongCurrent + CatSongs.VisibleSongs; - end; - - // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture - end; -end; - -procedure TScreenSong.UpdateLCD; -begin - LCD.HideCursor; - LCD.Clear; - LCD.WriteText(1, Text[TextArtist].Text); - LCD.WriteText(2, Text[TextTitle].Text); -end; - -//Procedure Change current played Preview -procedure TScreenSong.ChangeMusic; -begin - //When Music Preview is avtivated -> then Change Music - if (Ini.PreviewVolume <> 0) then - begin - if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then - begin - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); - //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal - if (Ini.PreviewFading = 0) then - Music.Play - else - Music.SetMusicVolume(0); - end; - end - else - Music.Stop; - end; -end; - -procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0 -var - Skip: integer; - I: integer; -begin - UnLoadDetailedCover; - - Interaction := High(CatSongs.Song); - SongTarget := 0; - - for I := 1 to Target+1 do - SelectNext; - - FixSelected2; -end; - -procedure TScreenSong.DrawEqualizer; -var - Data: TFFTData; //Audio Data - I, J: Integer; - Res: byte; - A, B: Integer; - PosX, PosY: Integer; - Pos: Real; -begin -if (not Music.Finished) AND (Theme.Song.Equalizer.Length > 0) then -begin - - - A := GetTickCount div 44; - - if (A <> EqualizerTime) then - begin - EqualizerTime := A; - Data := Music.GetFFTData; - - B:=0; - Pos := 0; - Res := ceil(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band - - //Change Lengths - for I := 0 to (Res * Theme.Song.Equalizer.Bands - 1) do - begin - A := floor(I/Res); - - if (A<>B) then //Band changed - begin - if (Pos <= Theme.Song.Equalizer.Length) then - begin - if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then - EqualizerBands[B] := EqualizerBands[B] - 1 - else - EqualizerBands[B] := floor(Pos); - end - else - EqualizerBands[B] := 1; - - B := A; - Pos := 0; - end; - - if I > 35 then - Data[i] := Data[i] * 8 - else if I > 11 then - Data[i] := Data[i] * 4.5 - else - Data[i] := Data[i] * 1.1; - - if (Data[i] >= 1) then - Data[i] := 0.9999999999999; - - if Data[i]*Theme.Song.Equalizer.Length > Pos then - Pos := Data[i]*Theme.Song.Equalizer.Length; - end; - - //Change Last Band - if (EqualizerBands[B] <= Theme.Song.Equalizer.Length) then - begin - if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then - EqualizerBands[B] := EqualizerBands[B] - 1 - else - EqualizerBands[B] := floor(Pos) - end - else - EqualizerBands[B] := 1; - end; - - //Draw every Channel - glColor4f(Theme.Song.Equalizer.ColR, Theme.Song.Equalizer.ColG, Theme.Song.Equalizer.ColB, Theme.Song.Equalizer.Alpha); //Set Color - glDisable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - - PosY := Theme.Song.Equalizer.Y; - PosX := Theme.Song.Equalizer.X; - - For I := 0 to Theme.Song.Equalizer.Bands-1 do - begin - if Theme.Song.Equalizer.Direction then - PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length - else - PosX := Theme.Song.Equalizer.X; - //Draw for every visible quad - for J := 1 to EqualizerBands[I] do - begin - glBegin(GL_QUADS); - glVertex3f(PosX, PosY, Theme.Song.Equalizer.Z); - glVertex3f(PosX, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); - glVertex3f(PosX+Theme.Song.Equalizer.W, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); - glVertex3f(PosX+Theme.Song.Equalizer.W, PosY, Theme.Song.Equalizer.Z); - glEnd; - - if Theme.Song.Equalizer.Direction then //Vertically - PosY := PosY - Theme.Song.Equalizer.H - Theme.Song.Equalizer.Space - else //Horizontally - PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space; - end; - if Theme.Song.Equalizer.Direction then //Horizontally - PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space - else //Vertically - PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space; - end; -end; -end; - -Procedure TScreenSong.SelectRandomSong; -var - I, I2: Integer; -begin - Case PlaylistMan.Mode of - 0: //All Songs Just Select Random Song - begin - //When Tabs are activated then use Tab Method - if (Ini.Tabs_at_startup = 1) then - begin - repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; - - //Search Cat - for I := I2 downto low(CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - break; - end; - //In I ist jetzt die Kategorie in I2 der Song - //I is the CatNum, I2 is the No of the Song within this Cat - - //Choose Cat - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - - //Choose Song - SkipTo(I2-I); - end - //When Tabs are deactivated use easy Method - else - SkipTo(Random(CatSongs.VisibleSongs)); - end; - 1: //One Category Select Category and Select Random Song - begin - CatSongs.ShowCategoryList; - CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); - ShowCatTL(PlaylistMan.CurPlayList); - - SelectNext; - FixSelected2; - - SkipTo(Random(CatSongs.VisibleSongs)); - end; - 2: //Playlist: Select Playlist and Select Random Song - begin - PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); - - SkipTo(Random(CatSongs.VisibleSongs)); - FixSelected2; - end; - end; - - Music.PlayChange; - ChangeMusic; - SetScroll; - UpdateLCD; -end; - -procedure TScreenSong.SetJoker; -begin - //If Party Mode - if Mode = 1 then //Show Joker that are available - begin - if (PartySession.Teams.NumTeams >= 1) then - begin - Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1); - Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2); - Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3); - Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4); - Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5); - end - else - begin - Static[StaticTeam1Joker1].Visible := False; - Static[StaticTeam1Joker2].Visible := False; - Static[StaticTeam1Joker3].Visible := False; - Static[StaticTeam1Joker4].Visible := False; - Static[StaticTeam1Joker5].Visible := False; - end; - - if (PartySession.Teams.NumTeams >= 2) then - begin - Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1); - Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2); - Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3); - Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4); - Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5); - end - else - begin - Static[StaticTeam2Joker1].Visible := False; - Static[StaticTeam2Joker2].Visible := False; - Static[StaticTeam2Joker3].Visible := False; - Static[StaticTeam2Joker4].Visible := False; - Static[StaticTeam2Joker5].Visible := False; - end; - - if (PartySession.Teams.NumTeams >= 3) then - begin - Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1); - Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2); - Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3); - Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4); - Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5); - end - else - begin - Static[StaticTeam3Joker1].Visible := False; - Static[StaticTeam3Joker2].Visible := False; - Static[StaticTeam3Joker3].Visible := False; - Static[StaticTeam3Joker4].Visible := False; - Static[StaticTeam3Joker5].Visible := False; - end; - end - else - begin //Hide all - Static[StaticTeam1Joker1].Visible := False; - Static[StaticTeam1Joker2].Visible := False; - Static[StaticTeam1Joker3].Visible := False; - Static[StaticTeam1Joker4].Visible := False; - Static[StaticTeam1Joker5].Visible := False; - - Static[StaticTeam2Joker1].Visible := False; - Static[StaticTeam2Joker2].Visible := False; - Static[StaticTeam2Joker3].Visible := False; - Static[StaticTeam2Joker4].Visible := False; - Static[StaticTeam2Joker5].Visible := False; - - Static[StaticTeam3Joker1].Visible := False; - Static[StaticTeam3Joker2].Visible := False; - Static[StaticTeam3Joker3].Visible := False; - Static[StaticTeam3Joker4].Visible := False; - Static[StaticTeam3Joker5].Visible := False; - end; -end; - -procedure TScreenSong.SetStatics; -var - I: Integer; - Visible: Boolean; -begin - //Set Visibility of Party Statics and Text - Visible := (Mode = 1); - - For I := 0 to high(StaticParty) do - Static[StaticParty[I]].Visible := Visible; - - For I := 0 to high(TextParty) do - Text[TextParty[I]].Visible := Visible; - - //Set Visibility of Non Party Statics and Text - Visible := not Visible; - - For I := 0 to high(StaticNonParty) do - Static[StaticNonParty[I]].Visible := Visible; - - For I := 0 to high(TextNonParty) do - Text[TextNonParty[I]].Visible := Visible; -end; - -//Procedures for Menu - -procedure TScreenSong.StartSong; -begin - CatSongs.Selected := Interaction; - Music.Stop; - //Party Mode - if (Mode = 1) then - begin - FadeTo(@ScreenSingModi); - end - else - begin - FadeTo(@ScreenSing); - end; -end; - -procedure TScreenSong.SelectPlayers; -begin - CatSongs.Selected := Interaction; - Music.Stop; - - ScreenName.Goto_SingScreen := True; - FadeTo(@ScreenName); -end; - -procedure TScreenSong.OpenEditor; -begin - if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin - Music.Stop; - Music.PlayStart; - ScreenEditSub.Path := CatSongs.Song[Interaction].Path; - ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName; - FadeTo(@ScreenEditSub); - end; -end; - -//Team No of Team (0-5) -procedure TScreenSong.DoJoker (Team: Byte); -begin - if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[Team].Joker); - SelectRandomSong; - SetJoker; - end; -end; - -//Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song -procedure TScreenSong.UnLoadDetailedCover; -begin - CoverTime := 0; - - Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture - Button[Interaction].Texture2.Alpha := 0; - - if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then - Texture.UnloadTexture(Button[Interaction].Texture.Name, false); -end; - -procedure TScreenSong.Refresh; -begin { -CatSongs.Refresh; -CatSongs.ShowCategoryList; -Interaction := 0; -SelectNext; -FixSelected; } - -end; - -end. +unit UScreenSong; + +interface +{$I switches.inc} + +uses + UMenu, + SDL, + UMusic, + UFiles, + UTime, + UDisplay, + USongs, + SysUtils, + ULog, + UThemes, + UTexture, + ULanguage, + ULCD, + ULight, + UIni; + +type + TScreenSong = class(TMenu) + public + TextArtist: integer; + TextTitle: integer; + TextNumber: integer; + + //Video Icon Mod + VideoIcon: Cardinal; + + TextCat: integer; + StaticCat: integer; + + SongCurrent: real; + SongTarget: real; + + HighSpeed: boolean; + CoverFull: boolean; + CoverTime: real; + CoverX: integer; + CoverY: integer; + CoverW: integer; + is_jump: boolean; // Jump to Song Mod + is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title + + EqualizerBands: array of Byte; + EqualizerTime: Cardinal; + EqualizerTime2: Byte; + + //Party Mod + Mode: Byte; //0 = Standard, 1= Go to PartyMode after Selection + Change to Random Song at Show + //party Statics (Joker) + StaticTeam1Joker1: Cardinal; + StaticTeam1Joker2: Cardinal; + StaticTeam1Joker3: Cardinal; + StaticTeam1Joker4: Cardinal; + StaticTeam1Joker5: Cardinal; + + StaticTeam2Joker1: Cardinal; + StaticTeam2Joker2: Cardinal; + StaticTeam2Joker3: Cardinal; + StaticTeam2Joker4: Cardinal; + StaticTeam2Joker5: Cardinal; + + StaticTeam3Joker1: Cardinal; + StaticTeam3Joker2: Cardinal; + StaticTeam3Joker3: Cardinal; + StaticTeam3Joker4: Cardinal; + StaticTeam3Joker5: Cardinal; + + StaticParty: Array of Cardinal; + TextParty: Array of Cardinal; + StaticNonParty: Array of Cardinal; + TextNonParty: Array of Cardinal; + + + constructor Create; override; + procedure SetScroll; + procedure SetScroll1; + procedure SetScroll2; + procedure SetScroll3; + procedure SetScroll4; + procedure SetScroll5; + procedure SetScroll6; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure SelectNext; + procedure SelectPrev; + procedure UpdateLCD; + procedure SkipTo(Target: Cardinal); + procedure FixSelected; //Show Wrong Song when Tabs on Fix + procedure FixSelected2; //Show Wrong Song when Tabs on Fix + procedure ShowCatTL(Cat: Integer);// Show Cat in Top left + procedure ShowCatTLCustom(Caption: String);// Show Custom Text in Top left + procedure HideCatTL;// Show Cat in Tob left + procedure Refresh; //Refresh Song Sorting + procedure DrawEqualizer; + procedure ChangeMusic; + //Party Mode + procedure SelectRandomSong; + procedure SetJoker; + procedure SetStatics; + //procedures for Menu + procedure StartSong; + procedure OpenEditor; + procedure DoJoker(Team: Byte); + procedure SelectPlayers; + + procedure UnLoadDetailedCover; + + //Extensions + procedure DrawExtensions; + end; + +implementation +uses UGraphic, + UMain, + UCovers, + math, + OpenGL12, + {$IFDEF win32} + windows, + {$ELSE} + lclintf, + {$ENDIF} + USkins, + UDLLManager, + UParty, + UPlaylist, + UScreenSongMenu; + +// ***** Public methods ****** // + +//Show Wrong Song when Tabs on Fix +procedure TScreenSong.FixSelected; +var I, I2: Integer; + begin + if CatSongs.VisibleSongs > 0 then + begin + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); + + if I = Interaction - 1 then + break; + end; + + SongCurrent := I2; + SongTarget := I2; + end; + end; + +procedure TScreenSong.FixSelected2; +var I, I2: Integer; + begin + if CatSongs.VisibleSongs > 0 then + begin + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); + + if I = Interaction - 1 then + break; + end; + + SongTarget := I2; + end; + end; +//Show Wrong Song when Tabs on Fix End + + procedure TScreenSong.ShowCatTLCustom(Caption: String);// Show Custom Text in Top left + begin + Text[TextCat].Text := Caption; + Text[TextCat].Visible := true; + Static[StaticCat].Visible := False; + end; + + //Show Cat in Top Left Mod + procedure TScreenSong.ShowCatTL(Cat: Integer); + begin + //Change + Text[TextCat].Text := CatSongs.Song[Cat].Artist; + //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover); + //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); + + Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); + //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false); + //Button[Cat]. + //Cover + + + //Show + Text[TextCat].Visible := true; + Static[StaticCat].Visible := True; + end; + + procedure TScreenSong.HideCatTL; + begin + //Hide + //Text[TextCat].Visible := false; + Static[StaticCat].Visible := false; + //New -> Show Text specified in Theme + Text[TextCat].Visible := True; + Text[TextCat].Text := Theme.Song.TextCat.Text; + end; + //Show Cat in Top Left Mod End + + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenSong.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var + I: integer; + I2: integer; + HS: integer; + SDL_ModState: Word; + Letter: Char; +begin + Result := true; + + //Song Screen Extensions (Jumpto + Menu) + if (ScreenSongMenu.Visible) then + begin + Result := ScreenSongMenu.ParseInput(PressedKey, ScanCode, PressedDown); + Exit; + end + else if (ScreenSongJumpto.Visible) then + begin + Result := ScreenSongJumpto.ParseInput(PressedKey, ScanCode, PressedDown); + Exit; + end; + + If (PressedDown) Then + begin // Key Down + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + + //Jump to Artist/Titel + if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then + begin + Letter := UpCase(Chr(ScanCode)); + I2 := Length(CatSongs.Song); + + //Jump To Titel + if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then + begin + For I := 1 to high(CatSongs.Song) do + begin + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + + Music.PlayChange; + + ChangeMusic; + SetScroll4; + UpdateLCD; + //Break and Exit + Exit; + end; + end; + end + //Jump to Artist + else if (SDL_ModState = KMOD_LALT) then + begin + For I := 1 to high(CatSongs.Song) do + begin + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Artist[1]) = Letter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + + Music.PlayChange; + + ChangeMusic; + SetScroll4; + UpdateLCD; + + //Break and Exit + Exit; + end; + end; + end; + Exit; + end; + + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + if (Mode = 0) then + begin + //On Escape goto Cat-List Hack + if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then + begin + //Find Category + I := Interaction; + while not catsongs.Song[I].Main do + begin + Dec (I); + if (I < low(catsongs.Song)) then + break; + end; + if (I<= 1) then + Interaction := high(catsongs.Song) + else + Interaction := I - 1; + + //Stop Music + Music.Stop; + + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + HideCatTL; + + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + //SelectPrev; + //CatSongs.Song[0].Visible := False; + end + else + begin + //On Escape goto Cat-List Hack End + //Tabs off and in Search or Playlist -> Go back to Song view + if (CatSongs.CatNumShow < -1) then + begin + //Atm: Set Empty Filter + CatSongs.SetFilter('', 0); + + //Show Cat in Top Left Mod + HideCatTL; + Interaction := 0; + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + + ChangeMusic; + end + else + begin + Music.Stop; + Music.PlayBack; + + FadeTo(@ScreenMain); + end; + + end; + end + //When in party Mode then Ask before Close + else if (Mode = 1) then + begin + Music.PlayBack; + CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); + end; + end; + SDLK_RETURN: + begin + if Length(Songs.Song) > 0 then + begin + {$IFDEF UseSerialPort} + // PortWriteB($378, 0); + {$ENDIF} + if CatSongs.Song[Interaction].Main then + begin // clicked on Category Button + + //Show Cat in Top Left Mod + ShowCatTL (Interaction); + + //I := CatSongs.VisibleIndex(Interaction); + CatSongs.ClickCategoryButton(Interaction); + {I2 := CatSongs.VisibleIndex(Interaction); + SongCurrent := SongCurrent - I + I2; + SongTarget := SongTarget - I + I2; } + +// if I<>I2 then beep; + // SetScroll4; + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + + //Play Music: + ChangeMusic; + + end else begin // clicked on song + if (Mode = 0) then //Normal Mode -> Start Song + begin + //Do the Action that is specified in Ini + case Ini.OnSongClick of + 0: StartSong; + 1: SelectPlayers; + 2:begin + If (CatSongs.CatNumShow = -3) then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end; + end; + end + else if (Mode = 1) then //PartyMode -> Show Menu + begin + if (Ini.PartyPopup = 1) then + ScreenSongMenu.MenuShow(SM_Party_Main) + else + ScreenSong.StartSong; + end; + end; + end; + end; + + SDLK_M: //Show SongMenu + begin + if (Length(Songs.Song) > 0) then begin + if (Mode = 0) then begin + if not CatSongs.Song[Interaction].Main then begin // clicked on Song + if CatSongs.CatNumShow = -3 then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end + else + begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); + end; + end //Party Mode -> Show Party Menu + else ScreenSongMenu.MenuShow(SM_Party_Main); + end; + end; + + SDLK_P: //Show Playlist Menu + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); + end; + end; + + SDLK_J: //Show Jumpto Menu + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then + begin + ScreenSongJumpto.Visible := True; + end; + end; + + SDLK_DOWN: + begin + if (Mode = 0) then + begin + //Only Change Cat when not in Playlist or Search Mode + if (CatSongs.CatNumShow > -2) then + begin + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then + begin + I := Interaction; + if I <= 0 then I := 1; + + while not catsongs.Song[I].Main do + begin + Inc (I); + if (I > high(catsongs.Song)) then + I := low(catsongs.Song); + end; + + Interaction := I; + + //Show Cat in Top Left Mod + ShowCatTL (Interaction); + + CatSongs.ClickCategoryButton(Interaction); + SelectNext; + FixSelected; + + //Play Music: + Music.PlayChange; + ChangeMusic; + + end; + + // + //Cat Change Hack End} + end; + end; + end; + SDLK_UP: + begin + if (Mode = 0) then + begin + //Only Change Cat when not in Playlist or Search Mode + if (CatSongs.CatNumShow > -2) then + begin + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then + begin + I := Interaction; + I2 := 0; + if I <= 0 then I := 1; + + while not catsongs.Song[I].Main or (I2 = 0) do + begin + if catsongs.Song[I].Main then + Inc(I2); + Dec (I); + if (I < low(catsongs.Song)) then + I := high(catsongs.Song); + end; + + Interaction := I; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + + //Play Music: + Music.PlayChange; + ChangeMusic; + end; + end; + //Cat Change Hack End} + end; + end; + + SDLK_RIGHT: + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + Music.PlayChange; + SelectNext; +// InteractNext; +// SongTarget := Interaction; + ChangeMusic; + SetScroll4; + UpdateLCD; + Light.LightOne(1, 200); + end; + end; + + SDLK_LEFT: + begin + if (Length(Songs.Song) > 0)AND (Mode = 0) then begin + Music.PlayChange; + SelectPrev; + ChangeMusic; + SetScroll4; + UpdateLCD; + Light.LightOne(0, 200); + end; + end; + + SDLK_E: + begin + OpenEditor; + end; + + SDLK_R: + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + + if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category + begin + I2 := 0; //Count Cats + for I:= low(CatSongs.Song) to high (CatSongs.Song) do + if CatSongs.Song[I].Main then Inc(I2); + + I2 := Random (I2)+1; //Zufall + + //Find Cat: + for I:= low(CatSongs.Song) to high (CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + Dec(I2); + if (I2<=0) then + begin + //Show Cat in Top Left Mod + ShowCatTL (I); + + Interaction := I; + + CatSongs.ShowCategoryList; + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + break; + end; + end; + + + end + else if (SDL_ModState = KMOD_LCTRL) AND (Ini.Tabs_at_startup = 1) then //random in All Categorys + begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; + + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + + //Choose Cat + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Fix: Not Existing Song selected: + //if (I+1=I2) then Inc(I2); + + //Choose Song + SkipTo(I2-I); + + end + else //Random in one Category + begin + SkipTo(Random(CatSongs.VisibleSongs)); + end; + Music.PlayChange; + + ChangeMusic; + SetScroll4; + UpdateLCD; + end; + end; + + SDLK_1: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[0].Joker); + SelectRandomSong; + SetJoker; + end; + end; + + SDLK_2: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[1].Joker); + SelectRandomSong; + SetJoker; + end; + end; + + SDLK_3: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[2].Joker); + SelectRandomSong; + SetJoker; + end; + end; + end; + end; +end; + +constructor TScreenSong.Create; +var + Pet: integer; + I: integer; +Label CreateSongButtons; +begin + inherited Create; + + LoadFromTheme(Theme.Song); + + TextArtist := AddText(Theme.Song.TextArtist); + TextTitle := AddText(Theme.Song.TextTitle); + TextNumber := AddText(Theme.Song.TextNumber); + + //Show Cat in Top Left mod + TextCat := AddText(Theme.Song.TextCat); + StaticCat := AddStatic(Theme.Song.StaticCat); + + //Show Video Icon Mod + VideoIcon := AddStatic(Theme.Song.VideoIcon); + + //Party Mode + StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1); + StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2); + StaticTeam1Joker3 := AddStatic(Theme.Song.StaticTeam1Joker3); + StaticTeam1Joker4 := AddStatic(Theme.Song.StaticTeam1Joker4); + StaticTeam1Joker5 := AddStatic(Theme.Song.StaticTeam1Joker5); + + StaticTeam2Joker1 := AddStatic(Theme.Song.StaticTeam2Joker1); + StaticTeam2Joker2 := AddStatic(Theme.Song.StaticTeam2Joker2); + StaticTeam2Joker3 := AddStatic(Theme.Song.StaticTeam2Joker3); + StaticTeam2Joker4 := AddStatic(Theme.Song.StaticTeam2Joker4); + StaticTeam2Joker5 := AddStatic(Theme.Song.StaticTeam2Joker5); + + StaticTeam3Joker1 := AddStatic(Theme.Song.StaticTeam3Joker1); + StaticTeam3Joker2 := AddStatic(Theme.Song.StaticTeam3Joker2); + StaticTeam3Joker3 := AddStatic(Theme.Song.StaticTeam3Joker3); + StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); + StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); + + //Load Party or NonParty specific Statics and Texts + SetLength(StaticParty, Length(Theme.Song.StaticParty)); + for I := 0 to High(Theme.Song.StaticParty) do + StaticParty[I] := AddStatic(Theme.Song.StaticParty[I]); + + SetLength(TextParty, Length(Theme.Song.TextParty)); + for I := 0 to High(Theme.Song.TextParty) do + TextParty[I] := AddText(Theme.Song.TextParty[I]); + + SetLength(StaticNonParty, Length(Theme.Song.StaticNonParty)); + for I := 0 to High(Theme.Song.StaticNonParty) do + StaticNonParty[I] := AddStatic(Theme.Song.StaticNonParty[I]); + + SetLength(TextNonParty, Length(Theme.Song.TextNonParty)); + for I := 0 to High(Theme.Song.TextNonParty) do + TextNonParty[I] := AddText(Theme.Song.TextNonParty[I]); + + // Song List +// Songs.LoadSongList; // moved to the UltraStar unit + CatSongs.Refresh; + + if (length(CatSongs.Song) > 0) then + begin + //Set Length of Button Array one Time Instead of one time for every Song + SetButtonLength(Length(CatSongs.Song)); + + I := 0; + CreateSongButtons: + + try + for Pet := I to High(CatSongs.Song) do begin // creating all buttons + // new + Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 + + if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' + + if CatSongs.Song[Pet].Cover = '' then + AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) + else begin + // cache texture if there is a need to this + if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + begin + Texture.CreateCacheMipmap := true; + Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap + Texture.CreateCacheMipmap := false; + + // puts this texture to the cache file + Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + + // unload full size texture + Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); + + // we should also add mipmap texture by calling createtexture and use mipmap cache as data source + end; + + // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) + AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + end; + Texture.Limit := 1024*1024; + I := -1; + end; + except + //When Error is reported the First time for this Song + if (I <> Pet) then + begin + //Some Error reporting: + Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); + + //Change Cover to NoCover and Continue Loading + CatSongs.Song[Pet].Cover := ''; + I := Pet; + end + else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song + begin + Log.LogError('NoCover Cover is damaged!'); + try + AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); + except + {$IFDEF win32} + Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); + {$ELSE} + // TODO : JB_linux - better handle this message and display to user.. + writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'); + Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' ); + {$ENDIF} + Halt; + end; + I := Pet + 1; + end; + end; + + if (I <> -1) then + GoTo CreateSongButtons; + + end; + + // Randomize Patch + Randomize; + //Equalizer + SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); + //ClearArray + For I := low(EqualizerBands) to high(EqualizerBands) do + EqualizerBands[I] := 3; + + if (Length(CatSongs.Song) > 0) then + Interaction := 0; +end; + +procedure TScreenSong.SetScroll; +var + VS, B: Integer; +begin + VS := CatSongs.VisibleSongs; + if VS > 0 then + begin + //Set Positions + Case Theme.Song.Cover.Style of + 3: SetScroll3; + 5:begin + if VS > 5 then + SetScroll5 + else + SetScroll4; + end; + 6: SetScroll6; + else SetScroll4; + end; + //Set Visibility of Video Icon + Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> ''); + + //Set Texts: + Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; + Text[TextTitle].Text := CatSongs.Song[Interaction].Title; + if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then + begin + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); + Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; + end + else if (CatSongs.CatNumShow = -2) then + Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) + else if (CatSongs.CatNumShow = -3) then + Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) + else if (Ini.Tabs_at_startup = 1) then + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) + else + Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); + end + else + begin + Text[TextNumber].Text := '0/0'; + Text[TextArtist].Text := ''; + Text[TextTitle].Text := ''; + for B := 0 to High(Button) do + Button[B].Visible := False; + + end; +end; + +procedure TScreenSong.SetScroll1; +var + B: integer; // button + BMin: integer; // button min + BMax: integer; // button max + Src: integer; +// Dst: integer; + Count: integer; // Dst is not used. Count is used. + Ready: boolean; + + VisCount: integer; // count of visible (or selectable) buttons + VisInt: integer; // visible position of interacted button + Typ: integer; // 0 when all songs fits the screen + Placed: integer; // number of placed visible buttons +begin +// Src := 0; +// Dst := -1; + Count := 1; + Typ := 0; + Ready := false; + Placed := 0; + + VisCount := 0; + for B := 0 to High(Button) do + if CatSongs.Song[B].Visible then Inc(VisCount); + + VisInt := 0; + for B := 0 to Interaction-1 do + if CatSongs.Song[B].Visible then Inc(VisInt); + + + if VisCount <= 6 then begin + Typ := 0; + end else begin + if VisInt <= 3 then begin + Typ := 1; + Count := 7; + Ready := true; + end; + + if (VisCount - VisInt) <= 3 then begin + Typ := 2; + Count := 7; + Ready := true; + end; + + if not Ready then begin + Typ := 3; + Src := Interaction; + end; + end; + + + + // hide all buttons + for B := 0 to High(Button) do begin + Button[B].Visible := false; + Button[B].Selectable := CatSongs.Song[B].Visible; + end; + +{ for B := Src to Dst do begin +// Button[B].Visible := true; + Button[B].Visible := CatSongs.Song[B].Visible; + Button[B].Selectable := Button[B].Visible; + Button[B].Y := 140 + (B-Src) * 60; + end;} + + + if Typ = 0 then begin + for B := 0 to High(Button) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (Placed) * 60; + Inc(Placed); + end; + end; + end; + + if Typ = 1 then begin + B := 0; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Inc(B); + end; + end; + + if Typ = 2 then begin + B := High(Button); + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (6-Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Dec(B); + end; + end; + + if Typ = 3 then begin + B := Src; + Count := 4; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (3+Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Inc(B); + end; + + B := Src-1; + Placed := 0; + Count := 3; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (2-Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Dec(B); + end; + + end; + + if Length(Button) > 0 then + Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture +end; + +procedure TScreenSong.SetScroll2; +var + B: integer; + Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu + Wsp2: real; +begin + // liniowe + for B := 0 to High(Button) do + Button[B].X := 300 + (B - Interaction) * 260; + + if Length(Button) >= 3 then begin + if Interaction = 0 then + Button[High(Button)].X := 300 - 260; + + if Interaction = High(Button) then + Button[0].X := 300 + 260; + end; + + // kolowe +{ for B := 0 to High(Button) do begin + Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. + Wsp2 := Wsp / Length(Button); + Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); +// Button[B].Y := 140 + 50 * ; + end;} +end; + +procedure TScreenSong.SetScroll3; // with slide +var + B: integer; + Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu + Wsp2: real; +begin + SongTarget := Interaction; + + // liniowe + for B := 0 to High(Button) do + begin + Button[B].X := 300 + (B - SongCurrent) * 260; + if (Button[B].X < -Button[B].W) OR (Button[B].X > 800) then + Button[B].Visible := False + else + Button[B].Visible := True; + end; + +{ if Length(Button) >= 3 then begin + if Interaction = 0 then + Button[High(Button)].X := 300 - 260; + + if Interaction = High(Button) then + Button[0].X := 300 + 260; + end;} + + // kolowe +{ for B := 0 to High(Button) do begin + Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. + Wsp2 := Wsp / Length(Button); + Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); +// Button[B].Y := 140 + 50 * ; + end;} +end; + +procedure TScreenSong.SetScroll4; // rotate +var + B: integer; + Wsp: real; + Z, Z2: real; + VS: integer; +begin + VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important + + // kolowe + for B := 0 to High(Button) do begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2; + Z2 := (1 + 2*Z) / 3; + + + Button[B].X := Theme.Song.Cover.X + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z / 2 + 0.3; + + Button[B].W := Theme.Song.Cover.H * Z2; + +// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; + Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; + Button[B].H := Button[B].W; + end; + end; +end; + +(* +procedure TScreenSong.SetScroll4; // rotate +var + B: integer; + Wsp: real; + Z: real; + Z2, Z3: real; + VS: integer; + function modreal (const X, Y: real):real; + begin + Result := Frac(x / y) * y; + if Result < -3 then + Result := Result + Y + else if Result > 3 then + Result := Result - Y; + end; +begin + VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important + Z3 := 1; + if VS < 12 then + Z2 := VS + else + Z2 := 12; + + // kolowe + for B := 0 to High(Button) do begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + if ((ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)>-3) AND (ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)<3)) then + begin + if CatSongs.VisibleIndex(B)> SongCurrent then + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2 + else + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2; + + Z3 := 2; + Z := (1 + cos(Wsp)) / 2; + //Z2 := (1 + 2*Z) / 3; + //Z2 := (0.5 + Z/2); + //Z2 := sin(Wsp); + + //Z2 := Power (Z2,Z3); + + Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); + + //Button[B].X := Theme.Song.CoverX + ({Theme.Song.CoverX + Theme.Song.CoverW/2 + Theme.Song.CoverW*0.18 * VS {CatSongs.VisibleSongs {Length(Button) * sin(Wsp) {- Theme.Song.CoverX - Theme.Song.CoverW) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + if (sin(Wsp)<0) then + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W + else //*Theme.Song.CoverW*0.004*Z3 + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; + Button[B].Z := Z-0.00001; + +// Button[B].Y := {50 + 140 + 50 - 50 * Z2; + // Button[B].Y := (Theme.Song.CoverY + 40 + 50 - 50 * Z2); + Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); + Button[B].H := Button[B].W; + Button[B].Visible := True; + end + {else if (((CatSongs.VisibleIndex(B) - SongCurrent)>-3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) OR ((round (CatSongs.VisibleIndex(B) - SongCurrent) mod VS > -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) then + begin + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / 12 ;// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2 -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); + + if (sin(Wsp)<0) then + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W + else + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; + + Button[B].Z := Z; + + Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); + + Button[B].H := Button[B].W; + Button[B].Visible := True; + end + else Button[B].Visible := False; + end; + end; +end; *) + +procedure TScreenSong.SetScroll5; // rotate +var + B: integer; + Angle: real; + Pos: Real; + VS: integer; + diff: real; + X: Real; + helper: real; +begin + VS := CatSongs.VisibleSongs; // cache Visible Songs + {Vars + Theme.Song.CoverW: Radius des Kreises + Theme.Song.CoverX: X Pos Linke Kante des gewählten Covers + Theme.Song.CoverX: Y Pos Obere Kante des gewählten Covers + Theme.Song.CoverH: Höhe der Cover + + (CatSongs.VisibleIndex(B) - SongCurrent)/VS = Abstand zum MIttleren Cover in % + } + + //Change Pos of all Buttons + for B := low(Button) to high(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility + if Button[B].Visible then //Only Change Pos for Visible Buttons + begin + Pos := (CatSongs.VisibleIndex(B) - SongCurrent); + if (Pos < -VS/2) then + Pos := Pos + VS + else if (Pos > VS/2) then + Pos := Pos - VS; + + if (Abs(Pos) < 2.5) then {fixed Positions} + begin + Angle := Pi * (Pos / 5); +// Button[B].Visible := False; + + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); + +// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Z := 0.95 - Abs(Pos) * 0.01; + + Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); + + Button[B].W := Button[B].H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + + X := Sin(Angle*1.3)*0.9; + + Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Diff; + + end + else + begin {Behind the Front Covers} + + // limit-bg-covers hack + if (abs(abs(Pos)-VS/2)>10) then Button[B].Visible:=False; + // end of limit-bg-covers hack + + if Pos < 0 then + Pos := (Pos - VS/2)/VS + else + Pos := (Pos + VS/2)/VS; + + Angle := pi * Pos*2; + if VS > 24 then + begin + if Angle < 0 then helper:=-1 else helper:=1; + Angle:=2*pi-abs(Angle); + Angle:=Angle*(VS/24); + Angle:=(2*pi-Angle)*helper; + end; + + Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); + + Button[B].W := Button[B].H; + + Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; + +// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*((Theme.Song.Cover.H)*sin(Angle/2)*1.52); + + end; + + //Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field +// Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); + + end; + end; +end; + +procedure TScreenSong.SetScroll6; // rotate (slotmachine style) +var + B: integer; + Angle: real; + Pos: Real; + VS: integer; + diff: real; + X: Real; + Wsp: real; + Z, Z2: real; +begin + VS := CatSongs.VisibleSongs; // cache Visible Songs + if VS <=5 then begin + // kolowe + for B := 0 to High(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2; + Z2 := (1 + 2*Z) / 3; + + + Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z / 2 + 0.3; + + Button[B].W := Theme.Song.Cover.H * Z2; + +// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; + Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; + Button[B].H := Button[B].W; + end; + end; + end + else begin + + //Change Pos of all Buttons + for B := low(Button) to high(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility + if Button[B].Visible then //Only Change Pos for Visible Buttons + begin + Pos := (CatSongs.VisibleIndex(B) - SongCurrent); + if (Pos < -VS/2) then + Pos := Pos + VS + else if (Pos > VS/2) then + Pos := Pos - VS; + + if (Abs(Pos) < 2.5) then {fixed Positions} + begin + Angle := Pi * (Pos / 5); +// Button[B].Visible := False; + + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); + + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Z := 0.95 - Abs(Pos) * 0.01; + + Button[B].X := (Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); + + Button[B].W := Button[B].H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + + X := Sin(Angle*1.3)*0.9; + + Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff; + end + else + begin {Behind the Front Covers} + + // limit-bg-covers hack + if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; + if VS > 25 then VS:=25; + // end of limit-bg-covers hack + + if Pos < 0 then + Pos := (Pos - VS/2)/VS + else + Pos := (Pos + VS/2)/VS; + + Angle := pi * Pos*2; + + Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); + + Button[B].W := Button[B].H; + + Button[B].X := Theme.Song.Cover.X - (Button[B].H - Theme.Song.Cover.H)*0.5; + + + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Y := Theme.Song.Cover.Y+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*(Theme.Song.Cover.H*sin(Angle/2)*1.52); + end; + end; + end; + end; +end; + + +procedure TScreenSong.onShow; +begin + Music.Stop; + + if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; + if Ini.Players = 4 then PlayersPlay := 6; + + //Cat Mod etc + if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then + begin + CatSongs.ShowCategoryList; + FixSelected; + //Show Cat in Top Left Mod + HideCatTL; + end; + + + if Length(CatSongs.Song) > 0 then begin + //Load Music only when Song Preview is activated + if (Ini.PreviewVolume <> 0) then + begin + Music.SetLoop(false); + Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + Music.MoveTo(Music.Length / 4); + Music.Play; + + //Set Preview Volume + Music.SetMusicVolume (Ini.PreviewVolume * 10); + {//if Music Fade is activated, Set Volume to 0 % + if (Ini.PreviewFading <> 0) then + Music.SetMusicVolume(0);} + end; + + SetScroll; + UpdateLCD; + end; + + //Playlist Mode + if (Mode = 0) then + begin + //If Playlist Shown -> Select Next automatically + if (CatSongs.CatNumShow = -3) then + begin + SelectNext; + ChangeMusic; + end; + end + //Party Mode + else if (Mode = 1) then + begin + + SelectRandomSong; + //Show Menu directly in PartyMode + //But only if selected in Options + if (Ini.PartyPopup = 1) then + begin + ScreenSongMenu.MenuShow(SM_Party_Main); + end; + + + end; + + SetJoker; + SetStatics; +end; + +procedure TScreenSong.onHide; +begin + //When Music Fading is activated, Turn Music to 100 % + If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then + Music.SetMusicVolume(100); + + //If Preview is deactivated: Load MUsicfile now + If (Ini.PreviewVolume = 0) then + Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + + //When hide then Stop Music (For Party Mode Popup on Exit) + if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then + Music.Stop; +end; + +procedure TScreenSong.DrawExtensions; +begin + //Draw Song Menu + if (ScreenSongMenu.Visible) then + begin + ScreenSongMenu.Draw; + end + else if (ScreenSongJumpto.Visible) then + begin + ScreenSongJumpto.Draw; + end +end; + +function TScreenSong.Draw: boolean; +var + dx: real; + dt: real; + I: Integer; +begin + dx := SongTarget-SongCurrent; + dt := TimeSkip*7; + if dt > 1 then dt := 1; + SongCurrent := SongCurrent + dx*dt; + +{ if SongCurrent > Catsongs.VisibleSongs then begin + SongCurrent := SongCurrent - Catsongs.VisibleSongs; + SongTarget := SongTarget - Catsongs.VisibleSongs; + end;} + +// Log.BenchmarkStart(5); + SetScroll; +// Log.BenchmarkEnd(5); +// Log.LogBenchmark('SetScroll4', 5); + + //Fading Functions, Only if Covertime is under 5 Seconds + If (CoverTime < 5) then + begin + // 0.5.0: cover fade + if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin + // load new texture + Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture.Alpha := 1; + Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture2.Alpha := 1; + end; + + //Song Fade + if (CatSongs.VisibleSongs > 0) AND (Ini.PreviewVolume <> 0) AND (Not CatSongs.Song[Interaction].Main) AND (Ini.PreviewFading <> 0) then + begin + //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling + if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then + Music.Play; + + //Update Song Volume + if (CoverTime < Ini.PreviewFading) then + Music.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) + else + Music.SetMusicVolume(Ini.PreviewVolume * 10); + + end; + + + //Update Fading Time + CoverTime := CoverTime + TimeSkip; + + //Update Fading Texture + Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; + if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; + + end; + + //inherited Draw; + //heres a little Hack, that causes the Statics + //are Drawn after the Buttons because of some Blending Problems. + //This should cause no Problems because all Buttons on this screen + //Has Z Position. + //Draw BG + DrawBG; + + //Instead of Draw FG Procedure: + //We draw Buttons for our own + for I := 0 to Length(Button) - 1 do + Button[I].Draw; + + // Statics + for I := 0 to Length(Static) - 1 do + Static[I].Draw; + + // and texts + for I := 0 to Length(Text) - 1 do + Text[I].Draw; + + + //Draw Equalizer + if Theme.Song.Equalizer.Visible then + DrawEqualizer; + + DrawExtensions; + +end; + +procedure TScreenSong.SelectNext; +var + Skip: integer; + I: integer; + VS: Integer; +begin + VS := CatSongs.VisibleSongs; + + if VS > 0 then + begin + UnLoadDetailedCover; + + Skip := 1; + + // this 1 could be changed by CatSongs.FindNextVisible + while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); + + SongTarget := SongTarget + 1;//Skip; + + Interaction := (Interaction + Skip) mod Length(Interactions); + + // try to keep all at the beginning + if SongTarget > VS-1 then begin + SongTarget := SongTarget - VS; + SongCurrent := SongCurrent - VS; + end; + + end; + // Interaction -> Button, ktorego okladke przeczytamy + // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture +end; + +procedure TScreenSong.SelectPrev; +var + Skip: integer; + I: integer; + VS: Integer; +begin + VS := CatSongs.VisibleSongs; + + if VS > 0 then + begin + UnLoadDetailedCover; + + Skip := 1; + + while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); + SongTarget := SongTarget - 1;//Skip; + + Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); + + // try to keep all at the beginning + if SongTarget < 0 then begin + SongTarget := SongTarget + CatSongs.VisibleSongs; + SongCurrent := SongCurrent + CatSongs.VisibleSongs; + end; + + // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture + end; +end; + +procedure TScreenSong.UpdateLCD; +begin + LCD.HideCursor; + LCD.Clear; + LCD.WriteText(1, Text[TextArtist].Text); + LCD.WriteText(2, Text[TextTitle].Text); +end; + +//Procedure Change current played Preview +procedure TScreenSong.ChangeMusic; +begin + //When Music Preview is avtivated -> then Change Music + if (Ini.PreviewVolume <> 0) then + begin + if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then + begin + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal + if (Ini.PreviewFading = 0) then + Music.Play + else + Music.SetMusicVolume(0); + end; + end + else + Music.Stop; + end; +end; + +procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0 +var + Skip: integer; + I: integer; +begin + UnLoadDetailedCover; + + Interaction := High(CatSongs.Song); + SongTarget := 0; + + for I := 1 to Target+1 do + SelectNext; + + FixSelected2; +end; + +procedure TScreenSong.DrawEqualizer; +var + Data: TFFTData; //Audio Data + I, J: Integer; + Res: byte; + A, B: Integer; + PosX, PosY: Integer; + Pos: Real; +begin +if (not Music.Finished) AND (Theme.Song.Equalizer.Length > 0) then +begin + + + A := GetTickCount div 44; + + if (A <> EqualizerTime) then + begin + EqualizerTime := A; + Data := Music.GetFFTData; + + B:=0; + Pos := 0; + Res := ceil(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band + + //Change Lengths + for I := 0 to (Res * Theme.Song.Equalizer.Bands - 1) do + begin + A := floor(I/Res); + + if (A<>B) then //Band changed + begin + if (Pos <= Theme.Song.Equalizer.Length) then + begin + if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then + EqualizerBands[B] := EqualizerBands[B] - 1 + else + EqualizerBands[B] := floor(Pos); + end + else + EqualizerBands[B] := 1; + + B := A; + Pos := 0; + end; + + if I > 35 then + Data[i] := Data[i] * 8 + else if I > 11 then + Data[i] := Data[i] * 4.5 + else + Data[i] := Data[i] * 1.1; + + if (Data[i] >= 1) then + Data[i] := 0.9999999999999; + + if Data[i]*Theme.Song.Equalizer.Length > Pos then + Pos := Data[i]*Theme.Song.Equalizer.Length; + end; + + //Change Last Band + if (EqualizerBands[B] <= Theme.Song.Equalizer.Length) then + begin + if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then + EqualizerBands[B] := EqualizerBands[B] - 1 + else + EqualizerBands[B] := floor(Pos) + end + else + EqualizerBands[B] := 1; + end; + + //Draw every Channel + glColor4f(Theme.Song.Equalizer.ColR, Theme.Song.Equalizer.ColG, Theme.Song.Equalizer.ColB, Theme.Song.Equalizer.Alpha); //Set Color + glDisable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + + PosY := Theme.Song.Equalizer.Y; + PosX := Theme.Song.Equalizer.X; + + For I := 0 to Theme.Song.Equalizer.Bands-1 do + begin + if Theme.Song.Equalizer.Direction then + PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length + else + PosX := Theme.Song.Equalizer.X; + //Draw for every visible quad + for J := 1 to EqualizerBands[I] do + begin + glBegin(GL_QUADS); + glVertex3f(PosX, PosY, Theme.Song.Equalizer.Z); + glVertex3f(PosX, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); + glVertex3f(PosX+Theme.Song.Equalizer.W, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); + glVertex3f(PosX+Theme.Song.Equalizer.W, PosY, Theme.Song.Equalizer.Z); + glEnd; + + if Theme.Song.Equalizer.Direction then //Vertically + PosY := PosY - Theme.Song.Equalizer.H - Theme.Song.Equalizer.Space + else //Horizontally + PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space; + end; + if Theme.Song.Equalizer.Direction then //Horizontally + PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space + else //Vertically + PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space; + end; +end; +end; + +Procedure TScreenSong.SelectRandomSong; +var + I, I2: Integer; +begin + Case PlaylistMan.Mode of + 0: //All Songs Just Select Random Song + begin + //When Tabs are activated then use Tab Method + if (Ini.Tabs_at_startup = 1) then + begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; + + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + //I is the CatNum, I2 is the No of the Song within this Cat + + //Choose Cat + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Choose Song + SkipTo(I2-I); + end + //When Tabs are deactivated use easy Method + else + SkipTo(Random(CatSongs.VisibleSongs)); + end; + 1: //One Category Select Category and Select Random Song + begin + CatSongs.ShowCategoryList; + CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); + ShowCatTL(PlaylistMan.CurPlayList); + + SelectNext; + FixSelected2; + + SkipTo(Random(CatSongs.VisibleSongs)); + end; + 2: //Playlist: Select Playlist and Select Random Song + begin + PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); + + SkipTo(Random(CatSongs.VisibleSongs)); + FixSelected2; + end; + end; + + Music.PlayChange; + ChangeMusic; + SetScroll; + UpdateLCD; +end; + +procedure TScreenSong.SetJoker; +begin + //If Party Mode + if Mode = 1 then //Show Joker that are available + begin + if (PartySession.Teams.NumTeams >= 1) then + begin + Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1); + Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2); + Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3); + Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4); + Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5); + end + else + begin + Static[StaticTeam1Joker1].Visible := False; + Static[StaticTeam1Joker2].Visible := False; + Static[StaticTeam1Joker3].Visible := False; + Static[StaticTeam1Joker4].Visible := False; + Static[StaticTeam1Joker5].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 2) then + begin + Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1); + Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2); + Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3); + Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4); + Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5); + end + else + begin + Static[StaticTeam2Joker1].Visible := False; + Static[StaticTeam2Joker2].Visible := False; + Static[StaticTeam2Joker3].Visible := False; + Static[StaticTeam2Joker4].Visible := False; + Static[StaticTeam2Joker5].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 3) then + begin + Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1); + Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2); + Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3); + Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4); + Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5); + end + else + begin + Static[StaticTeam3Joker1].Visible := False; + Static[StaticTeam3Joker2].Visible := False; + Static[StaticTeam3Joker3].Visible := False; + Static[StaticTeam3Joker4].Visible := False; + Static[StaticTeam3Joker5].Visible := False; + end; + end + else + begin //Hide all + Static[StaticTeam1Joker1].Visible := False; + Static[StaticTeam1Joker2].Visible := False; + Static[StaticTeam1Joker3].Visible := False; + Static[StaticTeam1Joker4].Visible := False; + Static[StaticTeam1Joker5].Visible := False; + + Static[StaticTeam2Joker1].Visible := False; + Static[StaticTeam2Joker2].Visible := False; + Static[StaticTeam2Joker3].Visible := False; + Static[StaticTeam2Joker4].Visible := False; + Static[StaticTeam2Joker5].Visible := False; + + Static[StaticTeam3Joker1].Visible := False; + Static[StaticTeam3Joker2].Visible := False; + Static[StaticTeam3Joker3].Visible := False; + Static[StaticTeam3Joker4].Visible := False; + Static[StaticTeam3Joker5].Visible := False; + end; +end; + +procedure TScreenSong.SetStatics; +var + I: Integer; + Visible: Boolean; +begin + //Set Visibility of Party Statics and Text + Visible := (Mode = 1); + + For I := 0 to high(StaticParty) do + Static[StaticParty[I]].Visible := Visible; + + For I := 0 to high(TextParty) do + Text[TextParty[I]].Visible := Visible; + + //Set Visibility of Non Party Statics and Text + Visible := not Visible; + + For I := 0 to high(StaticNonParty) do + Static[StaticNonParty[I]].Visible := Visible; + + For I := 0 to high(TextNonParty) do + Text[TextNonParty[I]].Visible := Visible; +end; + +//Procedures for Menu + +procedure TScreenSong.StartSong; +begin + CatSongs.Selected := Interaction; + Music.Stop; + //Party Mode + if (Mode = 1) then + begin + FadeTo(@ScreenSingModi); + end + else + begin + FadeTo(@ScreenSing); + end; +end; + +procedure TScreenSong.SelectPlayers; +begin + CatSongs.Selected := Interaction; + Music.Stop; + + ScreenName.Goto_SingScreen := True; + FadeTo(@ScreenName); +end; + +procedure TScreenSong.OpenEditor; +begin + if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin + Music.Stop; + Music.PlayStart; + ScreenEditSub.Path := CatSongs.Song[Interaction].Path; + ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName; + FadeTo(@ScreenEditSub); + end; +end; + +//Team No of Team (0-5) +procedure TScreenSong.DoJoker (Team: Byte); +begin + if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[Team].Joker); + SelectRandomSong; + SetJoker; + end; +end; + +//Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song +procedure TScreenSong.UnLoadDetailedCover; +begin + CoverTime := 0; + + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture + Button[Interaction].Texture2.Alpha := 0; + + if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then + Texture.UnloadTexture(Button[Interaction].Texture.Name, false); +end; + +procedure TScreenSong.Refresh; +begin { +CatSongs.Refresh; +CatSongs.ShowCategoryList; +Interaction := 0; +SelectNext; +FixSelected; } + +end; + +end. -- cgit v1.2.3 From 76616a7974a926ddee09ab605f89acc78321e728 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sat, 29 Sep 2007 03:24:33 +0000 Subject: fixed runtime sing errors, when compiled in lazarus. mainly divide by 0 errors. need to be more careful with these, as they can be a pain to track down git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@446 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 48 +++++++++++++++++++++++++++++++++++++-- Game/Code/Classes/USingScores.pas | 35 ++++++++++++++++++++++++++-- 2 files changed, 79 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 1e631648..22b1263d 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -221,6 +221,9 @@ var PlayerNumber: Integer; GoldenStarPos : real; + + lTmpA , + lTmpB : real; begin // We actually don't have a playernumber in this procedure, it should reside in NrCzesci - but it's always set to zero // So we exploit this behavior a bit - we give NrCzesci the playernumber, keep it in playernumber - and then we set NrCzesci to zero @@ -236,7 +239,26 @@ begin glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); + + lTmpA := (Right-Left); + lTmpB := (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); + + writeln( 'UDRAW (Right-Left) : ' + floattostr( lTmpA ) ); + writeln( 'UDRAW : ' + floattostr( lTmpB ) ); + writeln( '' ); + + + if ( lTmpA > 0 ) AND + ( lTmpB > 0 ) THEN + begin + TempR := lTmpA / lTmpB; + end + else + begin + TempR := 0; + end; + + with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin for Pet := 0 to HighNut do begin with Nuta[Pet] do begin @@ -440,13 +462,35 @@ var R,G,B: real; X1, X2, X3, X4: real; W, H: real; + + lTmpA , + lTmpB : real; begin if (Player[NrGracza].ScoreTotalI >= 0) then begin glColor4f(1, 1, 1, sqrt((1+sin(Music.Position * 3))/4)/ 2 + 0.5 ); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); + + + lTmpA := (Right-Left); + lTmpB := (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); + + writeln( 'UDRAW (Right-Left) : ' + floattostr( lTmpA ) ); + writeln( 'UDRAW : ' + floattostr( lTmpB ) ); + writeln( '' ); + + + if ( lTmpA > 0 ) AND + ( lTmpB > 0 ) THEN + begin + TempR := lTmpA / lTmpB; + end + else + begin + TempR := 0; + end; + with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin for Pet := 0 to HighNut do begin with Nuta[Pet] do begin diff --git a/Game/Code/Classes/USingScores.pas b/Game/Code/Classes/USingScores.pas index 052ff678..88b278b7 100644 --- a/Game/Code/Classes/USingScores.pas +++ b/Game/Code/Classes/USingScores.pas @@ -414,15 +414,46 @@ end; // Removes a PopUp w/o destroying the List //----------- Procedure TSingScores.KillPopUp(const last, cur: PScorePopUp); +var + lTempA , + lTempB : real; begin //Give Player the Last Points that missing till now aPlayers[Cur.Player].ScoreDisplayed := aPlayers[Cur.Player].ScoreDisplayed + Cur.ScoreDiff - Cur.ScoreGiven; //Change Bars Position - aPlayers[Cur.Player].RBTarget := aPlayers[Cur.Player].RBTarget + (Cur.ScoreDiff - Cur.ScoreGiven)/Cur.ScoreDiff * (Cur.Rating / 20 - 0.26); + + // TODO : JB_Lazarus - Exception=Invalid floating point operation + // AT THIS LINE ! + + writeln( 'USINGSCORES-aPlayers[Cur.Player].RBTarget : ' + floattostr( aPlayers[Cur.Player].RBTarget ) ); + writeln( 'USINGSCORES-(Cur.ScoreDiff - Cur.ScoreGiven) : ' + floattostr( (Cur.ScoreDiff - Cur.ScoreGiven) ) ); + writeln( 'USINGSCORES-Cur.ScoreDiff : ' + floattostr( Cur.ScoreDiff ) ); + writeln( 'USINGSCORES-(Cur.Rating / 20 - 0.26) : ' + floattostr( (Cur.Rating / 20 - 0.26) ) ); + writeln( '' ); + + lTempA := ( aPlayers[Cur.Player].RBTarget + (Cur.ScoreDiff - Cur.ScoreGiven) ); + lTempB := ( Cur.ScoreDiff * (Cur.Rating / 20 - 0.26) ); + + writeln( 'USINGSCORES-lTempA : ' + floattostr( lTempA ) ); + writeln( 'USINGSCORES-lTempB : ' + floattostr( lTempB ) ); + writeln( '----------------------------------------------------------' ); + + + if ( lTempA > 0 ) AND + ( lTempB > 0 ) THEN + begin + writeln( 'USINGSCORES-lTempA / lTempB :' + floattostr( lTempA / lTempB ) ); + aPlayers[Cur.Player].RBTarget := lTempA / lTempB; + end; + + writeln( '----------------------------------------------------------' ); + writeln( '' ); + If (aPlayers[Cur.Player].RBTarget > 1) then aPlayers[Cur.Player].RBTarget := 1 - else If (aPlayers[Cur.Player].RBTarget < 0) then + else + If (aPlayers[Cur.Player].RBTarget < 0) then aPlayers[Cur.Player].RBTarget := 0; //If this is the First PopUp => Make Next PopUp the First -- cgit v1.2.3 From 7a08105b029d22762039d9b6c66494cab85cfc49 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sat, 29 Sep 2007 03:38:24 +0000 Subject: removed debug code from previous checkin. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@447 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 10 ++++++++-- Game/Code/Classes/USingScores.pas | 15 +++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 22b1263d..90a3875b 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -243,10 +243,13 @@ begin lTmpA := (Right-Left); lTmpB := (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); + {$IFDEF FPC} +(* writeln( 'UDRAW (Right-Left) : ' + floattostr( lTmpA ) ); writeln( 'UDRAW : ' + floattostr( lTmpB ) ); writeln( '' ); - +*) + {$ENFIF} if ( lTmpA > 0 ) AND ( lTmpB > 0 ) THEN @@ -476,10 +479,13 @@ begin lTmpA := (Right-Left); lTmpB := (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); + {$IFDEF FPC} +{* writeln( 'UDRAW (Right-Left) : ' + floattostr( lTmpA ) ); writeln( 'UDRAW : ' + floattostr( lTmpB ) ); writeln( '' ); - +*} + {$ENDIF} if ( lTmpA > 0 ) AND ( lTmpB > 0 ) THEN diff --git a/Game/Code/Classes/USingScores.pas b/Game/Code/Classes/USingScores.pas index 88b278b7..7625c17c 100644 --- a/Game/Code/Classes/USingScores.pas +++ b/Game/Code/Classes/USingScores.pas @@ -426,30 +426,33 @@ begin // TODO : JB_Lazarus - Exception=Invalid floating point operation // AT THIS LINE ! + {$IFDEF FPC} +(* writeln( 'USINGSCORES-aPlayers[Cur.Player].RBTarget : ' + floattostr( aPlayers[Cur.Player].RBTarget ) ); writeln( 'USINGSCORES-(Cur.ScoreDiff - Cur.ScoreGiven) : ' + floattostr( (Cur.ScoreDiff - Cur.ScoreGiven) ) ); writeln( 'USINGSCORES-Cur.ScoreDiff : ' + floattostr( Cur.ScoreDiff ) ); writeln( 'USINGSCORES-(Cur.Rating / 20 - 0.26) : ' + floattostr( (Cur.Rating / 20 - 0.26) ) ); writeln( '' ); +*) + {$ENDIF} lTempA := ( aPlayers[Cur.Player].RBTarget + (Cur.ScoreDiff - Cur.ScoreGiven) ); lTempB := ( Cur.ScoreDiff * (Cur.Rating / 20 - 0.26) ); - + + {$IFDEF FPC} +(* writeln( 'USINGSCORES-lTempA : ' + floattostr( lTempA ) ); writeln( 'USINGSCORES-lTempB : ' + floattostr( lTempB ) ); writeln( '----------------------------------------------------------' ); - +*) + {$ENDIF} if ( lTempA > 0 ) AND ( lTempB > 0 ) THEN begin - writeln( 'USINGSCORES-lTempA / lTempB :' + floattostr( lTempA / lTempB ) ); aPlayers[Cur.Player].RBTarget := lTempA / lTempB; end; - writeln( '----------------------------------------------------------' ); - writeln( '' ); - If (aPlayers[Cur.Player].RBTarget > 1) then aPlayers[Cur.Player].RBTarget := 1 else -- cgit v1.2.3 From 4ef0a0f9d2de3483107e7c2961ffb063757ad944 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sat, 29 Sep 2007 03:42:24 +0000 Subject: oops :) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@448 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 90a3875b..a8404355 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -249,7 +249,7 @@ begin writeln( 'UDRAW : ' + floattostr( lTmpB ) ); writeln( '' ); *) - {$ENFIF} + {$ENDIF} if ( lTmpA > 0 ) AND ( lTmpB > 0 ) THEN -- cgit v1.2.3 From 68268f528f54583698970fa4a4b24a9e8bf68364 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sat, 29 Sep 2007 04:38:55 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@449 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.lpr | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index f47d9d81..e2c08aeb 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -421,5 +421,7 @@ begin if Ini.LPT = 1 then LCD.Clear; if Ini.LPT = 2 then Light.TurnOff; + // Insignificant change.. + Log.Free; end. -- cgit v1.2.3 From 82621bfeb1ccbda7425b5d11b8315a9cb91509c2 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sun, 30 Sep 2007 04:54:03 +0000 Subject: fixed credits screen in lazarus build. ( now looks and operates the same as delphi build ) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@450 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 2 +- Game/Code/Screens/UScreenCredits.pas | 2503 +++++++++++++++++----------------- 2 files changed, 1258 insertions(+), 1247 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index eb01b4c4..f5169e8c 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -1,6 +1,6 @@ unit UTexture; // added for easier debug disabling -//{$define blindydebug} +{$define blindydebug} // Plain (alpha = 1) // Transparent diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 7b5e4c00..9c571b2b 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -1,1246 +1,1257 @@ -unit UScreenCredits; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -{$I switches.inc} - - -uses - UMenu, - SDL, - SDL_Image, - UDisplay, - UTexture, - OpenGL12, - UMusic, - UFiles, - SysUtils, - UThemes, - ULCD, - ULight, - UGraphicClasses; - -type - TCreditsStages=(InitialDelay,Intro,MainPart,Outro); - - TScreenCredits = class(TMenu) - public - - Credits_X: Real; - Credits_Time: Cardinal; - Credits_Alpha: Cardinal; - CTime: Cardinal; - CTime_hold: Cardinal; - ESC_Alpha: Integer; - - credits_entry_tex: TTexture; - credits_entry_dx_tex: TTexture; - credits_bg_tex: TTexture; - credits_bg_ovl: TTexture; -// credits_bg_logo: TTexture; - credits_bg_scrollbox_left: TTexture; - credits_blindguard: TTexture; - credits_blindy: TTexture; - credits_canni: TTexture; - credits_commandio: TTexture; - credits_lazyjoker: TTexture; - credits_mog: TTexture; - credits_mota: TTexture; - credits_skillmaster: TTexture; - credits_whiteshark: TTexture; - intro_layer01: TTexture; - intro_layer02: TTexture; - intro_layer03: TTexture; - intro_layer04: TTexture; - intro_layer05: TTexture; - intro_layer06: TTexture; - intro_layer07: TTexture; - intro_layer08: TTexture; - intro_layer09: TTexture; - outro_bg: TTexture; - outro_esc: TTexture; - outro_exd: TTexture; - - deluxe_slidein: cardinal; - - CurrentScrollText: String; - NextScrollUpdate: Real; - EndofLastScrollingPart: Cardinal; - CurrentScrollStart, CurrentScrollEnd: Integer; - - CRDTS_Stage: TCreditsStages; - - myTex: glUint; - mysdlimage,myconvertedsdlimage: PSDL_Surface; - - Fadeout: boolean; - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure onShow; override; - procedure onHide; override; - procedure DrawCredits; - procedure Draw_FunkyText; - end; - -const - Funky_Text: AnsiString = - 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+ - 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+ - 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+ - 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..'; - - - Timings: array[0..21] of Cardinal=( - 20, // 0 Delay vor Start - - 149, // 1 Ende erster Intro Zoom - 155, // 2 Start 2. Action im Intro - 170, // 3 Ende Separation im Intro - 271, // 4 Anfang Zoomout im Intro - 0, // 5 unused - 261, // 6 Start fade-to-white im Intro - - 271, // 7 Start Main Part - 280, // 8 Start On-Beat-Sternchen Main Part - - 396, // 9 Start BlindGuard - 666, // 10 Start blindy - 936, // 11 Start Canni - 1206, // 12 Start Commandio - 1476, // 13 Start LazyJoker - 1746, // 14 Start Mog - 2016, // 15 Start Mota - 2286, // 16 Start SkillMaster - 2556, // 17 Start WhiteShark - 2826, // 18 Ende Whiteshark - 3096, // 19 Start FadeOut Mainscreen - 3366, // 20 Ende Credits Tune - 60); // 21 start flare im intro - - - sdl32bpprgba: TSDL_Pixelformat=(palette: nil; - BitsPerPixel: 32; - BytesPerPixel: 4; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 24; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $ff000000; - colorkey: 0; - alpha: 255 ); - - -implementation - -uses {$IFDEF win32} - windows, - {$ELSE} - lclintf, - {$ENDIF} - UGraphic, - UMain, - UIni, - USongs, - Textgl, - ULanguage, - UCommon, - Math, - dialogs; - - -function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then - begin // Key Down - case PressedKey of - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - FadeTo(@ScreenMain); - Music.PlayBack; - end; -{ SDLK_SPACE: - begin - setlength(CTime_hold,length(CTime_hold)+1); - CTime_hold[high(CTime_hold)]:=CTime; - end; -} - end;//esac - end; //fi -end; - -constructor TScreenCredits.Create; -begin - inherited Create; - - credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0); - credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0); - - credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', 'PNG', 'Font Black', 0); - credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0); - credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0); - credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', 'PNG', 'Font Black', 0); - credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', 'PNG', 'Font Black', 0); - credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', 'Font Black', 0); - credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', 'PNG', 'Font Black', 0); - credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', 'PNG', 'Font Black', 0); - credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', 'PNG', 'Font Black', 0); - - intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', 'PNG', 'Transparent', 0); - intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', 'PNG', 'Transparent', 0); - intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', 'PNG', 'Transparent', 0); - intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', 'PNG', 'Transparent', 0); - intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', 'PNG', 'Transparent', 0); - intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', 'PNG', 'Transparent', 0); - intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', 'PNG', 'Transparent', 0); - intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', 'PNG', 'Transparent', 0); - intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', 'PNG', 'Transparent', 0); - - outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0); - outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0); - outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Transparent', 0); - - CRDTS_Stage:=InitialDelay; -end; - -function TScreenCredits.Draw: boolean; -begin - DrawCredits; - Draw:=true; -end; - -function pixfmt_eq(fmt1,fmt2: TSDL_Pixelformat): boolean; -begin - if (fmt1.BitsPerPixel = fmt2.BitsPerPixel) and - (fmt1.BytesPerPixel = fmt2.BytesPerPixel) and - (fmt1.Rloss = fmt2.Rloss) and - (fmt1.Gloss = fmt2.Gloss) and - (fmt1.Bloss = fmt2.Bloss) and - (fmt1.Rmask = fmt2.Rmask) and - (fmt1.Gmask = fmt2.Gmask) and - (fmt1.Bmask = fmt2.Bmask) and - (fmt1.Rshift = fmt2.Rshift) and - (fmt1.Gshift = fmt2.Gshift) and - (fmt1.Bshift = fmt2.Bshift) - then - pixfmt_eq:=True - else - pixfmt_eq:=False; -end; - -function inttohexstr(i: cardinal):pchar; -var helper, i2, c:cardinal; - tmpstr: string; -begin - helper:=0; - i2:=i; - tmpstr:=''; - for c:=1 to 8 do - begin - helper:=(helper shl 4) or (i2 and $f); - i2:=i2 shr 4; - end; - for c:=1 to 8 do - begin - i2:=helper and $f; - helper := helper shr 4; - case i2 of - 0: tmpstr:=tmpstr+'0'; - 1: tmpstr:=tmpstr+'1'; - 2: tmpstr:=tmpstr+'2'; - 3: tmpstr:=tmpstr+'3'; - 4: tmpstr:=tmpstr+'4'; - 5: tmpstr:=tmpstr+'5'; - 6: tmpstr:=tmpstr+'6'; - 7: tmpstr:=tmpstr+'7'; - 8: tmpstr:=tmpstr+'8'; - 9: tmpstr:=tmpstr+'9'; - 10: tmpstr:=tmpstr+'a'; - 11: tmpstr:=tmpstr+'b'; - 12: tmpstr:=tmpstr+'c'; - 13: tmpstr:=tmpstr+'d'; - 14: tmpstr:=tmpstr+'e'; - 15: tmpstr:=tmpstr+'f'; - end; - end; - inttohexstr:=pchar(tmpstr); -end; - -procedure TScreenCredits.onShow; -begin - CRDTS_Stage:=InitialDelay; - Credits_X := 580; - deluxe_slidein := 0; - Credits_Alpha := 0; - //Music.SetLoop(true); Loop looped ned, so ne scheisse - Music.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! -// Music.Play; - CTime:=0; -// setlength(CTime_hold,0); - mysdlimage:=IMG_Load('test.png'); - if assigned(mysdlimage) then - begin - showmessage('opened image via SDL_Image'+#13#10+ - 'Width: '+inttostr(mysdlimage^.w)+#13#10+ - 'Height: '+inttostr(mysdlimage^.h)+#13#10+ - 'BitsPP: '+inttostr(mysdlimage^.format.BitsPerPixel)+#13#10+ - 'BytesPP: '+inttostr(mysdlimage^.format.BytesPerPixel)+#13#10+ - 'Rloss: '+inttostr(mysdlimage^.format.Rloss)+#13#10+ - 'Gloss: '+inttostr(mysdlimage^.format.Gloss)+#13#10+ - 'Bloss: '+inttostr(mysdlimage^.format.Bloss)+#13#10+ - 'Aloss: '+inttostr(mysdlimage^.format.Aloss)+#13#10+ - 'Rshift: '+inttostr(mysdlimage^.format.Rshift)+#13#10+ - 'Gshift: '+inttostr(mysdlimage^.format.Gshift)+#13#10+ - 'Bshift: '+inttostr(mysdlimage^.format.Bshift)+#13#10+ - 'Ashift: '+inttostr(mysdlimage^.format.Ashift)+#13#10+ - 'Rmask: '+inttohexstr(mysdlimage^.format.Rmask)+#13#10+ - 'Gmask: '+inttohexstr(mysdlimage^.format.Gmask)+#13#10+ - 'Bmask: '+inttohexstr(mysdlimage^.format.Bmask)+#13#10+ - 'Amask: '+inttohexstr(mysdlimage^.format.Amask)+#13#10+ - 'ColKey: '+inttostr(mysdlimage^.format.Colorkey)+#13#10+ - 'Alpha: '+inttostr(mysdlimage^.format.Alpha)); - if pixfmt_eq(mysdlimage^.format^,sdl32bpprgba) - then showmessage('equal pixelformats') - else showmessage('different pixelformats'); - myconvertedsdlimage:=SDL_ConvertSurface(mysdlimage,@sdl32bpprgba,SDL_SWSURFACE); - glGenTextures(1,@myTex); - glBindTexture(GL_TEXTURE_2D, myTex); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - glTexImage2D( GL_TEXTURE_2D, 0, 4, myconvertedsdlimage^.w, myconvertedsdlimage^.h, 0, - GL_RGBA, GL_UNSIGNED_BYTE, myconvertedsdlimage^.pixels ); - SDL_FreeSurface(mysdlimage); - SDL_FreeSurface(myconvertedsdlimage); - end else - showmessage('could not open file'); - -end; - -procedure TScreenCredits.onHide; -begin - Music.Stop; -end; - -Procedure TScreenCredits.Draw_FunkyText; -var - S: Integer; - X,Y,A: Real; - visibleText: PChar; -begin - SetFontSize(10); - //Init ScrollingText - if (CTime = Timings[7]) then - begin - //Set Position of Text - Credits_X := 600; - CurrentScrollStart:=1; - CurrentScrollEnd:=1; - end; - - if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then - begin - X:=0; - visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); - for S := 0 to length(visibleText)-1 do begin - Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); - SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); - A:=0; - if (Credits_X+X < 15) then A:=0; - if (Credits_X+X >=15) then A:=Credits_X+X-15; - if Credits_X+X > 32 then A:=17; - glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17); - glPrintLetter(visibleText[S]); - X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; - end; - if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin - Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; - inc(CurrentScrollStart); - end; - visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); - if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin - inc(CurrentScrollEnd); - end; - end; -{ // timing hack - X:=5; - SetFontStyle (2); - SetFontItalic(False); - SetFontSize(9); - glColor4f(1, 1, 1, 1); - for S:=0 to high(CTime_hold) do begin - visibleText:=pchar(inttostr(CTime_hold[S])); - SetFontPos (500, X); - glPrint (Addr(visibleText[0])); - X:=X+20; - end;} -end; - -procedure Start3D; -begin - glMatrixMode(GL_PROJECTION); - glPushMatrix; - glLoadIdentity; - glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity; -end; -procedure End3D; -begin - glMatrixMode(GL_PROJECTION); - glPopMatrix; - glMatrixMode(GL_MODELVIEW); -end; - -procedure TScreenCredits.DrawCredits; -var - T,I: Cardinal; - X: Real; - Ver: PChar; - RuntimeStr: AnsiString; - Data: TFFTData; - j,k,l:cardinal; - f,g,h: Real; - STime:cardinal; - Delay:cardinal; - - myPixel: longword; - myColor: Cardinal; - myScale: Real; - myAngle: Real; - - -const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24), - (154,31),(156,58),(168,32),(203,36), - (258,34),(251,50),(274,93),(294,84), - (232,54),(278,62),(319,34),(336,92), - (347,23),(374,32),(377,58),(361,83), - (385,91),(405,91),(429,35),(423,51), - (450,32),(485,34),(444,91),(486,93)); - -begin - //dis does teh muiwk y0r - Data := Music.GetFFTData; - - T := GetTickCount div 33; - if T <> Credits_Time then - begin - Credits_Time := T; - inc(CTime); - inc(CTime_hold); - Credits_X := Credits_X-2; - if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then - begin -// CTime:=Timings[20]; -// CRDTS_Stage:=Outro; - - CRDTS_Stage:=Intro; - CTime:=0; - Music.Play; - - end; - if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then - begin - CRDTS_Stage:=MainPart; - end; - if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then - begin - CRDTS_Stage:=Outro; - end; - end; - - //draw background - if CRDTS_Stage=InitialDelay then - begin - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - end - else - if CRDTS_Stage=Intro then - begin - Start3D; - glPushMatrix; - - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - if CTime < Timings[1] then begin - myScale:= 0.5+0.5*(Timings[1]-CTime)/(Timings[1]); // slowly move layers together - myAngle:=cos((CTime)*pi/((Timings[1])*2)); // and make logo face towards camera - end else begin // this is the part when the logo stands still - myScale:=0.5; - myAngle:=0; - end; - if CTime > Timings[2] then begin - myScale:= 0.5+0.5*(CTime-Timings[2])/(Timings[3]-Timings[2]); // get some space between layers - myAngle:=0; - end; -// if CTime > Timings[3] then myScale:=1; // keep the space between layers - glTranslatef(0,0,-5+0.5*myScale); - if CTime > Timings[3] then myScale:=1; // keep the space between layers - if CTime > Timings[3] then begin // make logo rotate left and grow -// myScale:=(CTime-Timings[4])/(Timings[7]-Timings[4]); - glRotatef(20*sqr(CTime-Timings[3])/sqr((Timings[7]-Timings[3])/2),0,0,1); - glScalef(1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1); - end; - if CTime < Timings[2] then - glRotatef(30*myAngle,0.5*myScale+myScale,1+myScale,0); -// glScalef(0.5,0.5,0.5); - glScalef(4/3,-1,1); - glColor4f(1, 1, 1, 1); - - glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.4 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.4 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.4 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.4 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.3 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.3 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.3 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.3 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.2 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.2 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.2 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.2 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.1 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.1 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.1 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.1 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.1 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.1 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.1 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.1 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.2 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.2 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.2 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.2 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.3 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.3 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.3 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.3 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.22 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.22 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.22 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.22 * myScale); - glEnd; - gldisable(gl_texture_2d); - glDisable(GL_BLEND); - - glPopMatrix; - End3D; - - // do some sparkling effects - if (CTime < Timings[1]) and (CTime > Timings[21]) then - begin - for k:=1 to 3 do begin - l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5); - j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301); - GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0); - end; - end; - - // fade to white at end - if Ctime > Timings[6] then - begin - glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6])); - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glVertex2f(0,0); - glVertex2f(0,600); - glVertex2f(800,600); - glVertex2f(800,0); - glEnd; - glDisable(GL_BLEND); - end; - - end; - if (CRDTS_Stage=MainPart) then - // main credits screen background, scroller, logo and girl - begin - - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,600/1024);glVertex2f(0, 600); - glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); - glTexCoord2f(800/1024,0);glVertex2f(800, 0); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - // draw scroller - Draw_FunkyText; - -//######################################################################### -// draw credits names - -// BlindGuard (von links oben reindrehen, nach rechts unten rausdrehen) - STime:=Timings[9]-10; - Delay:=Timings[10]-Timings[9]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(0,329,0); - if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end; - gltranslatef(223,0,0); - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - gltranslatef(223,0,0); - glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1); - gltranslatef(-223,0,0); - end; - glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Blindy (zoom von 0 auf volle grösse und drehung, zoom auf doppelte grösse und nach rechts oben schieben) - STime:=Timings[10]-10; - Delay:=Timings[11]-Timings[10]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+20) and (CTime<=STime+22) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+20 then begin - j:=CTime-Stime; - glscalef(j*j/400,j*j/400,j*j/400); - glrotatef(j*18.0,0,0,1); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - f:=j*10.0; - gltranslatef(f*3,-f,0); - glscalef(1+j/10,1+j/10,1+j/10); - glrotatef(j*9.0,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Canni (von links reinschieben, nach rechts oben rausschieben) - STime:=Timings[11]-10; - Delay:=Timings[12]-Timings[11]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - gltranslatef(((CTime-STime)*21.0)-210,0,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=(CTime-(STime+Delay-10))*21; - gltranslatef(j,-j/2,0); - end; - glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Commandio (von unten reinklappen, nach rechts oben rausklappen) - STime:=Timings[12]-10; - Delay:=Timings[13]-Timings[12]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=258.0-25.8*(CTime-STime) - else - f:=0; - g:=0; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end; - glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163+g-f*1.5, -129+f*1.5-g/2); - glTexCoord2f(0,1);glVertex2f(-163+g*1.5, 129-(g*1.5*258/326)); - glTexCoord2f(1,1); glVertex2f(163+g, 129+g/4); - glTexCoord2f(1,0);glVertex2f(163+f*1.5+g/4, -129+f*1.5-g/4); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing) - STime:=Timings[13]-35; - Delay:=Timings[14]-Timings[13]+5; - if CTime > STime then - begin - k:=0; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20; - ESC_Alpha:=10; - f:=CTime-STime; - if CTime <=STime+40 then j:=CTime-STime else j:=40; - if (CTime >=STime+Delay-40) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j*j/1600); - - glPushMatrix; - gltranslatef(180+(f-70),329,0); - glBindTexture(GL_TEXTURE_2D, credits_lazyjoker.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Mog (von links reinklappen, nach rechts unten rausklappen) - STime:=Timings[14]-10; - Delay:=Timings[15]-Timings[14]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=326.0-32.6*(CTime-STime) - else - f:=0; - - g:=0; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end; - glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163+g*1.5, -129+g*1.5); - glTexCoord2f(0,1);glVertex2f(-163+g*1.2, 129+g); - glTexCoord2f(1,1); glVertex2f(163-f+g/2, 129+f*1.5+g/4); - glTexCoord2f(1,0);glVertex2f(163-f+g*1.5, -129-f*1.5); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Mota (von rechts oben reindrehen, nach links unten rausschieben und verkleinern und dabei drehen) - STime:=Timings[15]-10; - Delay:=Timings[16]-Timings[15]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - gltranslatef(223,0,0); - glrotatef((10-(CTime-STime))*9,0,0,1); - gltranslatef(-223,0,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - f:=j*10.0; - gltranslatef(-f*2,-f,0); - glscalef(1-j/10,1-j/10,1-j/10); - glrotatef(-j*9.0,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Skillmaster (von rechts unten reinschieben, nach rechts oben rausdrehen) - STime:=Timings[16]-10; - Delay:=Timings[17]-Timings[16]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - j:=STime+10-CTime; - f:=j*10.0; - gltranslatef(+f*2,+f/2,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - gltranslatef(0,-223,0); - glrotatef(integer(j)*-9,0,0,1); - gltranslatef(0,223,0); - glrotatef(j*9,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// WhiteShark (von links unten reinklappen, nach rechts oben rausklappen) - STime:=Timings[17]-10; - Delay:=Timings[18]-Timings[17]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=326.0-32.6*(CTime-STime) - else - f:=0; - - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end else - g:=0; - glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2); - glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4); - glTexCoord2f(1,1); glVertex2f(163-f*1.2+g/4, 129+f/2-g/4); - glTexCoord2f(1,0);glVertex2f(163-f*1.5+g/4, -129+f*1.5+g/4); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - - -// #################################################################### -// do some twinkle stuff (kinda on beat) - if (CTime>Timings[8]) and (CTime < Timings[19]) then begin - k:=0; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.2 then begin - l:=RandomRange(6,16); - j:=RandomRange(0,27); - GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); - end; - end; - -//################################################# -// draw the rest of the main screen (girl and logo - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(800-393, 0); - glTexCoord2f(0,600/1024);glVertex2f(800-393, 600); - glTexCoord2f(393/512,600/1024); glVertex2f(800, 600); - glTexCoord2f(393/512,0);glVertex2f(800, 0); - glEnd; -{ glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,112/128);glVertex2f(0, 112); - glTexCoord2f(497/512,112/128); glVertex2f(497, 112); - glTexCoord2f(497/512,0);glVertex2f(497, 0); - glEnd; -} - gldisable(gl_texture_2d); - glDisable(GL_BLEND); - - // fade out at end of main part - if Ctime > Timings[19] then - begin - glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19])); - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glVertex2f(0,0); - glVertex2f(0,600); - glVertex2f(800,600); - glVertex2f(800,0); - glEnd; - glDisable(GL_BLEND); - end; - end - else - if (CRDTS_Stage=Outro) then - begin - if CTime=Timings[20] then begin - CTime_hold:=0; - Music.Stop; - Music.Open(soundpath + 'credits-outro-tune.mp3'); - Music.Play; - Music.SetVolume(20); - Music.SetLoop(True); - end; - if CTime_hold > 231 then begin - Music.Play; - Ctime_hold:=0; - end; - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - - // do something useful - // outro background - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,600/1024);glVertex2f(0, 600); - glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); - glTexCoord2f(800/1024,0);glVertex2f(800, 0); - glEnd; - - //outro overlays - glColor4f(1, 1, 1, (1+sin(CTime/15))/3+1/3); - glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,223/256);glVertex2f(0, 223); - glTexCoord2f(487/512,223/256); glVertex2f(487, 223); - glTexCoord2f(487/512,0);glVertex2f(487, 0); - glEnd; - - ESC_Alpha:=20; - if (RandomRange(0,20) > 18) and (ESC_Alpha=20) then - ESC_Alpha:=0 - else inc(ESC_Alpha); - if ESC_Alpha > 20 then ESC_Alpha:=20; - glColor4f(1, 1, 1, ESC_Alpha/20); - glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(800-310, 600-247); - glTexCoord2f(0,247/256);glVertex2f(800-310, 600); - glTexCoord2f(310/512,247/256); glVertex2f(800, 600); - glTexCoord2f(310/512,0);glVertex2f(800, 600-247); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - // outro scrollers? - // ... - end; - -{ // draw credits runtime counter - SetFontStyle (2); - SetFontItalic(False); - SetFontSize(9); - SetFontPos (5, 5); - glColor4f(1, 1, 1, 1); -// RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10); - RuntimeStr:='CTime: '+inttostr(CTime); - glPrint (Addr(RuntimeStr[1])); -} - - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, myTex); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(100, 100); - glTexCoord2f(0,1);glVertex2f(100, 200); - glTexCoord2f(1,1); glVertex2f(200, 200); - glTexCoord2f(1,0);glVertex2f(200, 100); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - - // make the stars shine - GoldenRec.Draw; -end; - -end. +unit UScreenCredits; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +{$I switches.inc} + + +uses + UMenu, + SDL, + SDL_Image, + UDisplay, + UTexture, + OpenGL12, + UMusic, + UFiles, + SysUtils, + UThemes, + ULCD, + ULight, + UGraphicClasses; + +type + TCreditsStages=(InitialDelay,Intro,MainPart,Outro); + + TScreenCredits = class(TMenu) + public + + Credits_X: Real; + Credits_Time: Cardinal; + Credits_Alpha: Cardinal; + CTime: Cardinal; + CTime_hold: Cardinal; + ESC_Alpha: Integer; + + credits_entry_tex: TTexture; + credits_entry_dx_tex: TTexture; + credits_bg_tex: TTexture; + credits_bg_ovl: TTexture; +// credits_bg_logo: TTexture; + credits_bg_scrollbox_left: TTexture; + credits_blindguard: TTexture; + credits_blindy: TTexture; + credits_canni: TTexture; + credits_commandio: TTexture; + credits_lazyjoker: TTexture; + credits_mog: TTexture; + credits_mota: TTexture; + credits_skillmaster: TTexture; + credits_whiteshark: TTexture; + intro_layer01: TTexture; + intro_layer02: TTexture; + intro_layer03: TTexture; + intro_layer04: TTexture; + intro_layer05: TTexture; + intro_layer06: TTexture; + intro_layer07: TTexture; + intro_layer08: TTexture; + intro_layer09: TTexture; + outro_bg: TTexture; + outro_esc: TTexture; + outro_exd: TTexture; + + deluxe_slidein: cardinal; + + CurrentScrollText: String; + NextScrollUpdate: Real; + EndofLastScrollingPart: Cardinal; + CurrentScrollStart, CurrentScrollEnd: Integer; + + CRDTS_Stage: TCreditsStages; + + myTex: glUint; + mysdlimage,myconvertedsdlimage: PSDL_Surface; + + Fadeout: boolean; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure DrawCredits; + procedure Draw_FunkyText; + end; + +const + Funky_Text: AnsiString = + 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+ + 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+ + 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+ + 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..'; + + + Timings: array[0..21] of Cardinal=( + 20, // 0 Delay vor Start + + 149, // 1 Ende erster Intro Zoom + 155, // 2 Start 2. Action im Intro + 170, // 3 Ende Separation im Intro + 271, // 4 Anfang Zoomout im Intro + 0, // 5 unused + 261, // 6 Start fade-to-white im Intro + + 271, // 7 Start Main Part + 280, // 8 Start On-Beat-Sternchen Main Part + + 396, // 9 Start BlindGuard + 666, // 10 Start blindy + 936, // 11 Start Canni + 1206, // 12 Start Commandio + 1476, // 13 Start LazyJoker + 1746, // 14 Start Mog + 2016, // 15 Start Mota + 2286, // 16 Start SkillMaster + 2556, // 17 Start WhiteShark + 2826, // 18 Ende Whiteshark + 3096, // 19 Start FadeOut Mainscreen + 3366, // 20 Ende Credits Tune + 60); // 21 start flare im intro + + + sdl32bpprgba: TSDL_Pixelformat=(palette: nil; + BitsPerPixel: 32; + BytesPerPixel: 4; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 24; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $ff000000; + colorkey: 0; + alpha: 255 ); + + +implementation + +uses {$IFDEF win32} + windows, + {$ELSE} + lclintf, + {$ENDIF} + UGraphic, + UMain, + UIni, + USongs, + Textgl, + ULanguage, + UCommon, + Math, + dialogs; + + +function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + FadeTo(@ScreenMain); + Music.PlayBack; + end; +{ SDLK_SPACE: + begin + setlength(CTime_hold,length(CTime_hold)+1); + CTime_hold[high(CTime_hold)]:=CTime; + end; +} + end;//esac + end; //fi +end; + +constructor TScreenCredits.Create; +begin + inherited Create; + + credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0); + credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0); + + credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', 'PNG', 'Font Black', 0); + credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0); + credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0); + credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', 'PNG', 'Font Black', 0); + credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', 'PNG', 'Font Black', 0); + credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', 'Font Black', 0); + credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', 'PNG', 'Font Black', 0); + credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', 'PNG', 'Font Black', 0); + credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', 'PNG', 'Font Black', 0); + + intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', 'PNG', 'Transparent', 0); + intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', 'PNG', 'Transparent', 0); + intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', 'PNG', 'Transparent', 0); + intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', 'PNG', 'Transparent', 0); + intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', 'PNG', 'Transparent', 0); + intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', 'PNG', 'Transparent', 0); + intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', 'PNG', 'Transparent', 0); + intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', 'PNG', 'Transparent', 0); + intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', 'PNG', 'Transparent', 0); + + outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0); + outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0); + outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Transparent', 0); + + CRDTS_Stage:=InitialDelay; +end; + +function TScreenCredits.Draw: boolean; +begin + DrawCredits; + Draw:=true; +end; + +function pixfmt_eq(fmt1,fmt2: TSDL_Pixelformat): boolean; +begin + if (fmt1.BitsPerPixel = fmt2.BitsPerPixel) and + (fmt1.BytesPerPixel = fmt2.BytesPerPixel) and + (fmt1.Rloss = fmt2.Rloss) and + (fmt1.Gloss = fmt2.Gloss) and + (fmt1.Bloss = fmt2.Bloss) and + (fmt1.Rmask = fmt2.Rmask) and + (fmt1.Gmask = fmt2.Gmask) and + (fmt1.Bmask = fmt2.Bmask) and + (fmt1.Rshift = fmt2.Rshift) and + (fmt1.Gshift = fmt2.Gshift) and + (fmt1.Bshift = fmt2.Bshift) + then + pixfmt_eq:=True + else + pixfmt_eq:=False; +end; + +function inttohexstr(i: cardinal):pchar; +var helper, i2, c:cardinal; + tmpstr: string; +begin + helper:=0; + i2:=i; + tmpstr:=''; + for c:=1 to 8 do + begin + helper:=(helper shl 4) or (i2 and $f); + i2:=i2 shr 4; + end; + for c:=1 to 8 do + begin + i2:=helper and $f; + helper := helper shr 4; + case i2 of + 0: tmpstr:=tmpstr+'0'; + 1: tmpstr:=tmpstr+'1'; + 2: tmpstr:=tmpstr+'2'; + 3: tmpstr:=tmpstr+'3'; + 4: tmpstr:=tmpstr+'4'; + 5: tmpstr:=tmpstr+'5'; + 6: tmpstr:=tmpstr+'6'; + 7: tmpstr:=tmpstr+'7'; + 8: tmpstr:=tmpstr+'8'; + 9: tmpstr:=tmpstr+'9'; + 10: tmpstr:=tmpstr+'a'; + 11: tmpstr:=tmpstr+'b'; + 12: tmpstr:=tmpstr+'c'; + 13: tmpstr:=tmpstr+'d'; + 14: tmpstr:=tmpstr+'e'; + 15: tmpstr:=tmpstr+'f'; + end; + end; + inttohexstr:=pchar(tmpstr); +end; + +procedure TScreenCredits.onShow; +begin + CRDTS_Stage:=InitialDelay; + Credits_X := 580; + deluxe_slidein := 0; + Credits_Alpha := 0; + //Music.SetLoop(true); Loop looped ned, so ne scheisse + Music.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! +// Music.Play; + CTime:=0; +// setlength(CTime_hold,0); + + mysdlimage:=IMG_Load('test.png'); + if assigned(mysdlimage) then + begin + {$IFNDEF FPC} + showmessage('opened image via SDL_Image'+#13#10+ + 'Width: '+inttostr(mysdlimage^.w)+#13#10+ + 'Height: '+inttostr(mysdlimage^.h)+#13#10+ + 'BitsPP: '+inttostr(mysdlimage^.format.BitsPerPixel)+#13#10+ + 'BytesPP: '+inttostr(mysdlimage^.format.BytesPerPixel)+#13#10+ + 'Rloss: '+inttostr(mysdlimage^.format.Rloss)+#13#10+ + 'Gloss: '+inttostr(mysdlimage^.format.Gloss)+#13#10+ + 'Bloss: '+inttostr(mysdlimage^.format.Bloss)+#13#10+ + 'Aloss: '+inttostr(mysdlimage^.format.Aloss)+#13#10+ + 'Rshift: '+inttostr(mysdlimage^.format.Rshift)+#13#10+ + 'Gshift: '+inttostr(mysdlimage^.format.Gshift)+#13#10+ + 'Bshift: '+inttostr(mysdlimage^.format.Bshift)+#13#10+ + 'Ashift: '+inttostr(mysdlimage^.format.Ashift)+#13#10+ + 'Rmask: '+inttohexstr(mysdlimage^.format.Rmask)+#13#10+ + 'Gmask: '+inttohexstr(mysdlimage^.format.Gmask)+#13#10+ + 'Bmask: '+inttohexstr(mysdlimage^.format.Bmask)+#13#10+ + 'Amask: '+inttohexstr(mysdlimage^.format.Amask)+#13#10+ + 'ColKey: '+inttostr(mysdlimage^.format.Colorkey)+#13#10+ + 'Alpha: '+inttostr(mysdlimage^.format.Alpha)); + + if pixfmt_eq(mysdlimage^.format^,sdl32bpprgba) then + showmessage('equal pixelformats') + else + showmessage('different pixelformats'); + {$ENDIF} + + myconvertedsdlimage:=SDL_ConvertSurface(mysdlimage,@sdl32bpprgba,SDL_SWSURFACE); + glGenTextures(1,@myTex); + glBindTexture(GL_TEXTURE_2D, myTex); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + glTexImage2D( GL_TEXTURE_2D, 0, 4, myconvertedsdlimage^.w, myconvertedsdlimage^.h, 0, + GL_RGBA, GL_UNSIGNED_BYTE, myconvertedsdlimage^.pixels ); + SDL_FreeSurface(mysdlimage); + SDL_FreeSurface(myconvertedsdlimage); + end + else + {$IFDEF FPC} + writeln( 'could not open file - test.png'); + {$ELSE} + showmessage('could not open file - test.png'); + {$ENDIF} + +end; + +procedure TScreenCredits.onHide; +begin + Music.Stop; +end; + +Procedure TScreenCredits.Draw_FunkyText; +var + S: Integer; + X,Y,A: Real; + visibleText: PChar; +begin + SetFontSize(10); + //Init ScrollingText + if (CTime = Timings[7]) then + begin + //Set Position of Text + Credits_X := 600; + CurrentScrollStart:=1; + CurrentScrollEnd:=1; + end; + + if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then + begin + X:=0; + visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); + for S := 0 to length(visibleText)-1 do begin + Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); + SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); + A:=0; + if (Credits_X+X < 15) then A:=0; + if (Credits_X+X >=15) then A:=Credits_X+X-15; + if Credits_X+X > 32 then A:=17; + glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17); + glPrintLetter(visibleText[S]); + X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + end; + if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin + Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + inc(CurrentScrollStart); + end; + visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); + if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin + inc(CurrentScrollEnd); + end; + end; +{ // timing hack + X:=5; + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + glColor4f(1, 1, 1, 1); + for S:=0 to high(CTime_hold) do begin + visibleText:=pchar(inttostr(CTime_hold[S])); + SetFontPos (500, X); + glPrint (Addr(visibleText[0])); + X:=X+20; + end;} +end; + +procedure Start3D; +begin + glMatrixMode(GL_PROJECTION); + glPushMatrix; + glLoadIdentity; + glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity; +end; +procedure End3D; +begin + glMatrixMode(GL_PROJECTION); + glPopMatrix; + glMatrixMode(GL_MODELVIEW); +end; + +procedure TScreenCredits.DrawCredits; +var + T,I: Cardinal; + X: Real; + Ver: PChar; + RuntimeStr: AnsiString; + Data: TFFTData; + j,k,l:cardinal; + f,g,h: Real; + STime:cardinal; + Delay:cardinal; + + myPixel: longword; + myColor: Cardinal; + myScale: Real; + myAngle: Real; + + +const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24), + (154,31),(156,58),(168,32),(203,36), + (258,34),(251,50),(274,93),(294,84), + (232,54),(278,62),(319,34),(336,92), + (347,23),(374,32),(377,58),(361,83), + (385,91),(405,91),(429,35),(423,51), + (450,32),(485,34),(444,91),(486,93)); + +begin + //dis does teh muiwk y0r + Data := Music.GetFFTData; + + T := GetTickCount div 33; + if T <> Credits_Time then + begin + Credits_Time := T; + inc(CTime); + inc(CTime_hold); + Credits_X := Credits_X-2; + if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then + begin +// CTime:=Timings[20]; +// CRDTS_Stage:=Outro; + + CRDTS_Stage:=Intro; + CTime:=0; + Music.Play; + + end; + if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then + begin + CRDTS_Stage:=MainPart; + end; + if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then + begin + CRDTS_Stage:=Outro; + end; + end; + + //draw background + if CRDTS_Stage=InitialDelay then + begin + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end + else + if CRDTS_Stage=Intro then + begin + Start3D; + glPushMatrix; + + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + if CTime < Timings[1] then begin + myScale:= 0.5+0.5*(Timings[1]-CTime)/(Timings[1]); // slowly move layers together + myAngle:=cos((CTime)*pi/((Timings[1])*2)); // and make logo face towards camera + end else begin // this is the part when the logo stands still + myScale:=0.5; + myAngle:=0; + end; + if CTime > Timings[2] then begin + myScale:= 0.5+0.5*(CTime-Timings[2])/(Timings[3]-Timings[2]); // get some space between layers + myAngle:=0; + end; +// if CTime > Timings[3] then myScale:=1; // keep the space between layers + glTranslatef(0,0,-5+0.5*myScale); + if CTime > Timings[3] then myScale:=1; // keep the space between layers + if CTime > Timings[3] then begin // make logo rotate left and grow +// myScale:=(CTime-Timings[4])/(Timings[7]-Timings[4]); + glRotatef(20*sqr(CTime-Timings[3])/sqr((Timings[7]-Timings[3])/2),0,0,1); + glScalef(1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1); + end; + if CTime < Timings[2] then + glRotatef(30*myAngle,0.5*myScale+myScale,1+myScale,0); +// glScalef(0.5,0.5,0.5); + glScalef(4/3,-1,1); + glColor4f(1, 1, 1, 1); + + glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.4 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.4 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.4 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.4 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.22 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.22 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.22 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.22 * myScale); + glEnd; + gldisable(gl_texture_2d); + glDisable(GL_BLEND); + + glPopMatrix; + End3D; + + // do some sparkling effects + if (CTime < Timings[1]) and (CTime > Timings[21]) then + begin + for k:=1 to 3 do begin + l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5); + j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301); + GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0); + end; + end; + + // fade to white at end + if Ctime > Timings[6] then + begin + glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + + end; + if (CRDTS_Stage=MainPart) then + // main credits screen background, scroller, logo and girl + begin + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // draw scroller + Draw_FunkyText; + +//######################################################################### +// draw credits names + +// BlindGuard (von links oben reindrehen, nach rechts unten rausdrehen) + STime:=Timings[9]-10; + Delay:=Timings[10]-Timings[9]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(0,329,0); + if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end; + gltranslatef(223,0,0); + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + gltranslatef(223,0,0); + glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1); + gltranslatef(-223,0,0); + end; + glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Blindy (zoom von 0 auf volle grösse und drehung, zoom auf doppelte grösse und nach rechts oben schieben) + STime:=Timings[10]-10; + Delay:=Timings[11]-Timings[10]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+20) and (CTime<=STime+22) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+20 then begin + j:=CTime-Stime; + glscalef(j*j/400,j*j/400,j*j/400); + glrotatef(j*18.0,0,0,1); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(f*3,-f,0); + glscalef(1+j/10,1+j/10,1+j/10); + glrotatef(j*9.0,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Canni (von links reinschieben, nach rechts oben rausschieben) + STime:=Timings[11]-10; + Delay:=Timings[12]-Timings[11]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(((CTime-STime)*21.0)-210,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=(CTime-(STime+Delay-10))*21; + gltranslatef(j,-j/2,0); + end; + glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Commandio (von unten reinklappen, nach rechts oben rausklappen) + STime:=Timings[12]-10; + Delay:=Timings[13]-Timings[12]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=258.0-25.8*(CTime-STime) + else + f:=0; + g:=0; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end; + glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163+g-f*1.5, -129+f*1.5-g/2); + glTexCoord2f(0,1);glVertex2f(-163+g*1.5, 129-(g*1.5*258/326)); + glTexCoord2f(1,1); glVertex2f(163+g, 129+g/4); + glTexCoord2f(1,0);glVertex2f(163+f*1.5+g/4, -129+f*1.5-g/4); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing) + STime:=Timings[13]-35; + Delay:=Timings[14]-Timings[13]+5; + if CTime > STime then + begin + k:=0; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20; + ESC_Alpha:=10; + f:=CTime-STime; + if CTime <=STime+40 then j:=CTime-STime else j:=40; + if (CTime >=STime+Delay-40) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j*j/1600); + + glPushMatrix; + gltranslatef(180+(f-70),329,0); + glBindTexture(GL_TEXTURE_2D, credits_lazyjoker.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Mog (von links reinklappen, nach rechts unten rausklappen) + STime:=Timings[14]-10; + Delay:=Timings[15]-Timings[14]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) + else + f:=0; + + g:=0; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end; + glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163+g*1.5, -129+g*1.5); + glTexCoord2f(0,1);glVertex2f(-163+g*1.2, 129+g); + glTexCoord2f(1,1); glVertex2f(163-f+g/2, 129+f*1.5+g/4); + glTexCoord2f(1,0);glVertex2f(163-f+g*1.5, -129-f*1.5); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Mota (von rechts oben reindrehen, nach links unten rausschieben und verkleinern und dabei drehen) + STime:=Timings[15]-10; + Delay:=Timings[16]-Timings[15]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(223,0,0); + glrotatef((10-(CTime-STime))*9,0,0,1); + gltranslatef(-223,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(-f*2,-f,0); + glscalef(1-j/10,1-j/10,1-j/10); + glrotatef(-j*9.0,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Skillmaster (von rechts unten reinschieben, nach rechts oben rausdrehen) + STime:=Timings[16]-10; + Delay:=Timings[17]-Timings[16]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + j:=STime+10-CTime; + f:=j*10.0; + gltranslatef(+f*2,+f/2,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + gltranslatef(0,-223,0); + glrotatef(integer(j)*-9,0,0,1); + gltranslatef(0,223,0); + glrotatef(j*9,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// WhiteShark (von links unten reinklappen, nach rechts oben rausklappen) + STime:=Timings[17]-10; + Delay:=Timings[18]-Timings[17]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) + else + f:=0; + + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end else + g:=0; + glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2); + glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4); + glTexCoord2f(1,1); glVertex2f(163-f*1.2+g/4, 129+f/2-g/4); + glTexCoord2f(1,0);glVertex2f(163-f*1.5+g/4, -129+f*1.5+g/4); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + + +// #################################################################### +// do some twinkle stuff (kinda on beat) + if (CTime>Timings[8]) and (CTime < Timings[19]) then begin + k:=0; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.2 then begin + l:=RandomRange(6,16); + j:=RandomRange(0,27); + GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); + end; + end; + +//################################################# +// draw the rest of the main screen (girl and logo + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(800-393, 0); + glTexCoord2f(0,600/1024);glVertex2f(800-393, 600); + glTexCoord2f(393/512,600/1024); glVertex2f(800, 600); + glTexCoord2f(393/512,0);glVertex2f(800, 0); + glEnd; +{ glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,112/128);glVertex2f(0, 112); + glTexCoord2f(497/512,112/128); glVertex2f(497, 112); + glTexCoord2f(497/512,0);glVertex2f(497, 0); + glEnd; +} + gldisable(gl_texture_2d); + glDisable(GL_BLEND); + + // fade out at end of main part + if Ctime > Timings[19] then + begin + glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + end + else + if (CRDTS_Stage=Outro) then + begin + if CTime=Timings[20] then begin + CTime_hold:=0; + Music.Stop; + Music.Open(soundpath + 'credits-outro-tune.mp3'); + Music.Play; + Music.SetVolume(20); + Music.SetLoop(True); + end; + if CTime_hold > 231 then begin + Music.Play; + Ctime_hold:=0; + end; + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + // do something useful + // outro background + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); + glEnd; + + //outro overlays + glColor4f(1, 1, 1, (1+sin(CTime/15))/3+1/3); + glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,223/256);glVertex2f(0, 223); + glTexCoord2f(487/512,223/256); glVertex2f(487, 223); + glTexCoord2f(487/512,0);glVertex2f(487, 0); + glEnd; + + ESC_Alpha:=20; + if (RandomRange(0,20) > 18) and (ESC_Alpha=20) then + ESC_Alpha:=0 + else inc(ESC_Alpha); + if ESC_Alpha > 20 then ESC_Alpha:=20; + glColor4f(1, 1, 1, ESC_Alpha/20); + glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(800-310, 600-247); + glTexCoord2f(0,247/256);glVertex2f(800-310, 600); + glTexCoord2f(310/512,247/256); glVertex2f(800, 600); + glTexCoord2f(310/512,0);glVertex2f(800, 600-247); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // outro scrollers? + // ... + end; + +{ // draw credits runtime counter + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (5, 5); + glColor4f(1, 1, 1, 1); +// RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10); + RuntimeStr:='CTime: '+inttostr(CTime); + glPrint (Addr(RuntimeStr[1])); +} + + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, myTex); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(100, 100); + glTexCoord2f(0,1);glVertex2f(100, 200); + glTexCoord2f(1,1); glVertex2f(200, 200); + glTexCoord2f(1,0);glVertex2f(200, 100); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + + // make the stars shine + GoldenRec.Draw; +end; + +end. -- cgit v1.2.3 From fac1634f48835f46249ec25d2758c81addd09d52 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sun, 30 Sep 2007 05:56:29 +0000 Subject: some minor bug fixes.. added Installer script.. for NSIS install compiler. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@451 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UFiles.pas | 41 ------------- Game/Code/Classes/UMain.pas | 16 +++-- Game/Code/Screens/UScreenScore.pas | 119 ++++--------------------------------- Game/Code/switches.inc | 2 +- 4 files changed, 24 insertions(+), 154 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index 565c5ee3..9cd3bdc1 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -54,47 +54,6 @@ implementation uses TextGL, UIni, UMain; -{* -//-------------------- -// Function sets all Absolute Paths e.g. Song Path and makes sure the Directorys exist -//-------------------- -procedure InitializePaths; - - // Initialize a Path Variable - // After Setting Paths, make sure that Paths exist - function initialize_path( out aPathVar : String; const aLocation : String ): boolean; - var - lWriteable: Boolean; - begin - aPathVar := aLocation; - - If DirectoryExists(aPathVar) then - lWriteable := ForceDirectories(aPathVar) - else - lWriteable := false; - - if not Writeable then - Log.LogError('Error: Dir ('+ aLocation +') is Readonly'); - - result := lWriteable; - end; - -begin - GamePath := ExtractFilePath(ParamStr(0)); - - initialize_path( LogPath , GamePath ); - initialize_path( SoundPath , GamePath + 'Sounds\' ); - initialize_path( SongPath , GamePath + 'Songs\' ); - initialize_path( ThemePath , GamePath + 'Themes\' ); - initialize_path( ScreenshotsPath , GamePath + 'Screenshots\'); - initialize_path( CoversPath , GamePath + 'Covers\' ); - initialize_path( LanguagesPath , GamePath + 'Languages\' ); - initialize_path( PluginPath , GamePath + 'Plugins\' ); - initialize_path( PlaylistPath , GamePath + 'Playlists\' ); - - DecimalSeparator := ','; -end; -*} //-------------------- // Clears Song Header values diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 9b6ea3d5..66e1d07e 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -748,14 +748,22 @@ procedure InitializePaths; function initialize_path( out aPathVar : String; const aLocation : String ): boolean; var lWriteable: Boolean; + lAttrib : integer; begin - aPathVar := aLocation; + lWriteable := false; + aPathVar := aLocation; + + // Make sure the directory is needex + ForceDirectories(aPathVar); If DirectoryExists(aPathVar) then - lWriteable := ForceDirectories(aPathVar) - else - lWriteable := false; + begin + lAttrib := fileGetAttr('C:Temp'); + lWriteable := ( lAttrib and faDirectory <> 0 ) AND + NOT ( lAttrib and faReadOnly <> 0 ) + end; + if not lWriteable then Log.LogError('Error: Dir ('+ aLocation +') is Readonly'); diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 222879ba..0182bbd2 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -192,7 +192,8 @@ var MaxH: real; // maximum height of score bar Wsp: real; begin -{ CountSkipTimeSet; +{* + CountSkipTimeSet; Animation := 0; Fadeout := false; @@ -224,7 +225,8 @@ begin 9010..10000: Text[3].Text := ' Superstar'; end; - Music.PlayShuffle;} + Music.PlayShuffle; +*} // Singstar Fadeout := false; @@ -300,112 +302,7 @@ begin Static[StaticLevel[P]].Visible := false; //V[P]; Static[StaticLevelRound[P]].Visible := false; //V[P]; end; -{ - if PlayersPlay <= 3 then begin // only for 1 screen mode - for P := 0 to PlayersPlay-1 do begin - case PlayersPlay of - 1: PP := 1; - 2: PP := P + 2; - 3: PP := P + 4; - end; - //PP := 1; - - Text[TextName[PP]].Text := Ini.Name[P]; - - //{$IFDEF TRANSLATE} -{ case (Player[P].ScoreTotalI) of - 0..2000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_TONE_DEAF'); - 2010..4000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_AMATEUR'); - 4010..6000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_RISING_STAR'); - 6010..8000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_LEAD_SINGER'); - 8010..9000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_HIT_ARTIST'); - 9010..9800: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_SUPERSTAR'); - 9810..10000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_ULTRASTAR'); - end; - (* {$ELSE}{ - case (Player[P].ScoreTotalI) of - 0..2000: Text[TextScore[PP]].Text := 'Tone Deaf'; - 2010..4000: Text[TextScore[PP]].Text := 'Amateur'; - 4010..6000: Text[TextScore[PP]].Text := 'Rising Star'; - 6010..8000: Text[TextScore[PP]].Text := 'Lead Singer'; - 8010..9000: Text[TextScore[PP]].Text := 'Hit Artist'; - 9010..9800: Text[TextScore[PP]].Text := 'Superstar'; - 9810..10000: Text[TextScore[PP]].Text := 'Ultrastar'; - end; -{ {$ENDIF} -//*) - -{ S := IntToStr(Player[P].ScoreI); - while (Length(S)<4) do S := '0' + S; - Text[TextNotesScore[PP]].Text := S; - S := IntToStr(Player[P].ScoreLineI); - while (Length(S)<4) do S := '0' + S; - Text[TextLineBonusScore[PP]].Text := S; - - S := IntToStr(Player[P].ScoreGoldenI); - while (Length(S)<4) do S := '0' + S; - Text[TextGoldenNotesScore[PP]].Text := S; - - S := IntToStr(Player[P].ScoreTotalI); - while (Length(S)<5) do S := '0' + S; - Text[TextTotalScore[PP]].Text := S; - - // Level bar length -(* - Lev := ((Round(Player[P].Punkty) div 10) * 10) / 10000; - Static[StaticLevel[PP]].Texture.H := Round(Static[StaticBackLevel[PP]].Texture.H * Lev); - Static[StaticLevel[PP]].Texture.Y := Static[StaticBackLevel[PP]].Texture.Y + Static[StaticBackLevel[PP]].Texture.H - Static[StaticLevel[PP]].Texture.H; - Static[StaticLevelRound[PP]].Texture.Y := Static[StaticLevel[PP]].Texture.Y - Static[StaticLevelRound[PP]].Texture.H;} -//*) - // doesn't align too much... (to fix) - // hint: play with wrapping textures - // resolution: setting TexY1 and TexY2 to 0.1 and 0.9 - -{ Lev := Player[P].ScoreTotalI / 10000; - MaxH := Static[StaticBackLevel[PP]].Texture.H + Static[StaticBackLevelRound[PP]].Texture.H / 2; - - // developer note (Polish): - // w sumie np. 120 pix - // ten static moze miec 100 pix - // wlacza sie od 20 pix i rosnie do 120 pix - // wiec wysokosc = wyznaczona ilosc - 20 - // nie moze byc mniejsze od 0 - // Lev * MaxH = total number of pixels to draw - Static[StaticLevel[PP]].Visible := true; - Static[StaticLevel[PP]].Texture.H := Lev * MaxH - Static[StaticBackLevelRound[PP]].Texture.H / 2; - if Static[StaticLevel[PP]].Texture.H < 0 then Static[StaticLevel[PP]].Visible := false; - - // Y doesn't change and depend on the back texture coordinate - Static[StaticLevel[PP]].Texture.Y := Static[StaticBackLevel[PP]].Texture.Y + Static[StaticBackLevel[PP]].Texture.H - Static[StaticLevel[PP]].Texture.H; - - // we modify LevelRound texture by changing it's Y. TexY1 and TexY2 change when the height to draw is lower than 20 - if Lev * MaxH < Static[StaticBackLevelRound[PP]].Texture.H / 2 then begin - // when it's lower than 20 => we move TexY1 and TexY2 higher to show only part of this texture - Static[StaticLevelRound[PP]].Texture.Y := Static[StaticBackLevel[PP]].Texture.Y + Static[StaticBackLevel[PP]].Texture.H - Static[StaticBackLevelRound[PP]].Texture.H; - // - 0.25 when points = 0 - // - 0 wnen there are more points - // if Lev * MaxH = Static[StaticBackLevelRound[PP]].Texture.H / 2) then we do not change it - // if Lev * MaxH = 0 then we substract 0.25 - // we substract (0.25 - 0.25 * (Lev * MaxH)/Static[StaticBackLevelRound[PP]].Texture.H / 2) - Wsp := Lev * MaxH / (Static[StaticBackLevelRound[PP]].Texture.H / 2); - Static[StaticLevelRound[PP]].Texture.TexY1 := Static[StaticBackLevelRound[PP]].Texture.TexY1 - 0.25 + 0.25 * Wsp; - Static[StaticLevelRound[PP]].Texture.TexY2 := Static[StaticBackLevelRound[PP]].Texture.TexY2 - 0.25 + 0.25 * Wsp; - end else begin - // when it's higher or equal 20 => full texture is being shown - Static[StaticLevelRound[PP]].Texture.TexY1 := Static[StaticBackLevelRound[PP]].Texture.TexY1; - Static[StaticLevelRound[PP]].Texture.TexY2 := Static[StaticBackLevelRound[PP]].Texture.TexY2; - Static[StaticLevelRound[PP]].Texture.Y := Static[StaticLevel[PP]].Texture.Y - Static[StaticBackLevelRound[PP]].Texture.H; - end; - - end; // for - end; // if - - LCD.HideCursor; - LCD.Clear; - LCD.WriteText(1, Ini.Name[0]); - LCD.WriteText(2, 'Score: ' + Text[TextTotalScore[1]].Text); -} end; procedure TScreenScore.onShowFinish; @@ -684,6 +581,7 @@ const RaiseSmoothness : integer = 100; var RaiseStep : Real; + lTmpA : Real; begin // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps RaiseStep := EaseOut_Step; @@ -695,7 +593,12 @@ begin // quadratic easing out - decelerating to zero velocity // -end_position * current_time * ( current_time - 2 ) + start_postion - Result := floor((-ScoreReached * RaiseStep * (RaiseStep - 20)) / RaiseSmoothness); + lTmpA := (-ScoreReached * RaiseStep * (RaiseStep - 20)); + if ( lTmpA > 0 ) AND + ( RaiseSmoothness > 0 ) THEN + begin + Result := floor( lTmpA / RaiseSmoothness); + end; end else begin diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index 0bace1cb..a895712a 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -2,7 +2,7 @@ {$UNDEF UseSerialPort} {$UNDEF UseMIDIPort} {$ELSE} - {$DEFINE UseSerialPort} + {$UNDEF UseSerialPort} {$DEFINE UseMIDIPort} {$ENDIF} -- cgit v1.2.3 From 1df4ec21cdf891aa4302b2fda620069d8d765a70 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sun, 30 Sep 2007 06:35:59 +0000 Subject: updated USDX-Lazaurs Resource compiler.. it now reads the Ultrastar.rc file and builds based on that. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@452 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/USDXResCompiler.exe | Bin 0 -> 401920 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Game/Code/USDXResCompiler.exe (limited to 'Game/Code') diff --git a/Game/Code/USDXResCompiler.exe b/Game/Code/USDXResCompiler.exe new file mode 100644 index 00000000..6b0137be Binary files /dev/null and b/Game/Code/USDXResCompiler.exe differ -- cgit v1.2.3 From da754bece1dc05115f06bce0c7719d75a97f6962 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sun, 30 Sep 2007 06:36:44 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@453 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/bamboo-build-win-laz.bat | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/bamboo-build-win-laz.bat b/Game/Code/bamboo-build-win-laz.bat index aa69e6b2..77f8d54b 100644 --- a/Game/Code/bamboo-build-win-laz.bat +++ b/Game/Code/bamboo-build-win-laz.bat @@ -1 +1,3 @@ +USDXResCompiler.exe UltraStar.rc + C:\lazarus\fpc\2.0.4\bin\i386-win32\ppc386.exe -S2cgi -OG1 -gl -vewnhi -l -Filib\JEDI-SDLv1.0\SDL\Pas\ -Fuc:\lazarus\components\jpeg\lib\i386-win32\ -Fuc:\lazarus\components\images\lib\i386-win32\ -Fuc:\lazarus\lcl\units\i386-win32\ -Fuc:\lazarus\lcl\units\i386-win32\win32\ -Fuc:\lazarus\packager\units\i386-win32\ -Fu. -oUltraStar.exe -dLCL -dLCLwin32 UltraStar.lpr -- cgit v1.2.3 From 73a9802c1417cc36106f88fe1e6b5989fd47b8b0 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 1 Oct 2007 10:41:06 +0000 Subject: added patch (with small modification) which apparently enables USDX to run on linux, using wine. ( currently untested by myself ) BIG THANKS goes to linnex from sourceforge. http://sourceforge.net/forum/message.php?msg_id=4544965 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@454 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UIni.pas | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index 86ce7361..5d599eab 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -264,12 +264,20 @@ begin SetLength(IResolution, 0); Modes := SDL_ListModes(nil, SDL_OPENGL or SDL_FULLSCREEN); // Check if there are any modes available repeat -// Log.LogError(Format( ' %d x %d', [ modes^.w, modes^.h ] ) ); SetLength(IResolution, Length(IResolution) + 1); IResolution[High(IResolution)] := IntToStr(Modes^.w) + 'x' + IntToStr(Modes^.h); Inc(Modes); until Modes^ = nil; + // if no modes were set, then failback to 800x600 + // as per http://sourceforge.net/forum/message.php?msg_id=4544965 + // THANKS : linnex at users.sourceforge.net + if Length(IResolution) < 1 then + begin + SetLength(IResolution, Length(IResolution) + 1); + IResolution[High(IResolution)] := IntToStr(800) + 'x' + IntToStr(600); + end; + // reverse order for I := 0 to (Length(IResolution) div 2) - 1 do begin S := IResolution[I]; -- cgit v1.2.3 From c21f87b7235114f4d7b5afdc1b097310e36e5129 Mon Sep 17 00:00:00 2001 From: mogguh Date: Mon, 1 Oct 2007 11:05:52 +0000 Subject: SDL_ttf: TextGl.pas - some code for testing (just add printrandomtext(); in ucreditsscreen (ie)) UTextClasses - started to throw everything into classes git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@455 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.pas | 122 +++++++++++++++++++++++++++++++++++++ Game/Code/Classes/UTextClasses.pas | 57 +++++++++++++++++ Game/Code/UltraStar.dpr | 105 +++++++++++-------------------- 3 files changed, 214 insertions(+), 70 deletions(-) create mode 100644 Game/Code/Classes/UTextClasses.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index c73908f8..3f5d52b8 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -11,6 +11,8 @@ uses OpenGL12, SDL, UTexture, Classes, + dialogs, + SDL_ttf, ULog; procedure BuildFont; // Build Our Bitmap Font @@ -27,6 +29,16 @@ procedure SetFontStyle(Style: integer); // sets active font style (normal, bold, procedure SetFontItalic(Enable: boolean); // sets italic type letter (works for all fonts) procedure SetFontAspectW(Aspect: real); +// Start of SDL_ttf +function NextPowerOfTwo(Value: Integer): Integer; +//Checks if the ttf exists, if yes then a SDL_ttf is returned +function LoadFont(FileName: PAnsiChar; PointSize: integer):PTTF_Font; + +// Does the renderstuff, color is in $ffeecc style +function RenderText(font: PTTF_Font; Text:PAnsiChar; Color: Cardinal):PSDL_Surface; +procedure printrandomtext(); +// End of SDL_ttf + type TTextGL = record X: real; @@ -323,6 +335,7 @@ procedure glPrint(text: pchar); // Custom GL "Print" Routine var // Letter : char; iPos : Integer; + begin if (Text = '') then // If There's No Text Exit; // Do Nothing @@ -350,6 +363,115 @@ begin end; +function NextPowerOfTwo(Value: Integer): Integer; +// tyty to Asphyre +begin + Result:= 1; + asm + xor ecx, ecx + bsr ecx, Value + inc ecx + shl Result, cl + end; +end; + +function LoadFont(FileName: PAnsiChar; PointSize: integer):PTTF_Font; +begin + if (FileExists(FileName)) then + begin + Result := TTF_OpenFont( FileName, PointSize ); + end + else + begin + Log.LogStatus('ERROR Could not find font in ' + FileName , ''); + ShowMessage( 'ERROR Could not find font in ' + FileName ); + end; +end; + +function RenderText(font: PTTF_Font; Text:PAnsiChar; Color: Cardinal): PSDL_Surface; +var + clr : TSDL_color; +begin + clr.r := (((Color and $ff0000) shr 16) / 255); + clr.g := ((Color and $ff00) shr 8)/255; + clr.b := ( Color and $ff)/255; + + result := TTF_RenderText_Blended( font, text, cLr); +end; + +procedure printrandomtext(); +var + stext,intermediary : PSDL_surface; + clrFg, clrBG : TSDL_color; + texture : Gluint; + font : PTTF_Font; + w,h : integer; +begin + +font := LoadFont('fonts\comicbd.ttf', 42); + +clrFg.r := 255; +clrFg.g := 255; +clrFg.b := 255; +clrFg.unused := 255; + +clrBg.r := 255; +clrbg.g := 0; +clrbg.b := 255; +clrbg.unused := 0; + + sText := RenderText(font, 'katzeeeeeee', $fe198e); +//sText := TTF_RenderText_Blended( font, 'huuuuuuuuuund', clrFG); + + // Convert the rendered text to a known format + w := nextpoweroftwo(sText.w); + h := nextpoweroftwo(sText.h); + +intermediary := SDL_CreateRGBSurface(0, w, h, 32, + $000000ff, $0000ff00, $00ff0000, $ff000000); + + SDL_SetAlpha(intermediary, 0, 255); + SDL_SetAlpha(sText, 0, 255); + SDL_BlitSurface(sText, 0, intermediary, 0); + + glGenTextures(1, texture); + + glBindTexture(GL_TEXTURE_2D, texture); + + glTexImage2D(GL_TEXTURE_2D, 0, 4, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, intermediary.pixels); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + + + + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glBindTexture(GL_TEXTURE_2D, texture); + glColor4f(1, 0, 1, 1); + + glbegin(gl_quads); + glTexCoord2f(0,0); glVertex2f(200, 300); + glTexCoord2f(0,sText.h/h); glVertex2f(200 , 300 + sText.h); + glTexCoord2f(sText.w/w,sText.h/h); glVertex2f(200 + sText.w, 300 + sText.h); + glTexCoord2f(sText.w/w,0); glVertex2f(200 + sText.w, 300); + glEnd; + glfinish(); + glDisable(GL_BLEND); + gldisable(gl_texture_2d); + + + + +SDL_FreeSurface( sText ); +SDL_FreeSurface( intermediary ); +glDeleteTextures(1, @texture); +TTF_CloseFont( font ); + +end; + procedure glPrintCut(text: pchar); var Letter: char; diff --git a/Game/Code/Classes/UTextClasses.pas b/Game/Code/Classes/UTextClasses.pas new file mode 100644 index 00000000..5f66d0e8 --- /dev/null +++ b/Game/Code/Classes/UTextClasses.pas @@ -0,0 +1,57 @@ +unit UTextClasses; + +interface +uses OpenGL12, + SDL, + UTexture, + Classes, + dialogs, + SDL_ttf, + ULog; + +{ +// okay i just outline what should be here, so we can create a nice and clean implementation of sdl_ttf +// based up on this uml: http://jnr.sourceforge.net/fusion_images/www_FRS.png +// thanks to Bob Pendelton and Koshmaar! +// (1) let's start with a glyph, this represents one character in a word + +type + TGlyph = record + character : Char; // unsigned char, uchar is something else in delphi + glyphsSolid[8] : GlyphTexture; // fast, but not that + glyphsBlended[8] : GlyphTexture; // slower than solid, but it look's more pretty + +//this class has a method, which should be a deconstructor (mog is on his way to understand the principles of oop :P) + deconstructor procedure ReleaseTextures(); +end; + +// okay, we now need the stuff that's even beneath this glyph - we're right at the birth of text in here :P + + GlyphTexture = record + textureID : GLuint; // we need this for caching the letters, if the texture wasn't created before create it, should be very fast because of this one + width, + height : Cardinal; + charWidth, + charHeight : Integer; + advance : Integer; // don't know yet for what this one is +} + +{ +// after the glyph is done, we now start to build whole words - this one is pretty important, and does most of the work we need + TGlyphsContainer = record + glyphs array of TGlyph; + FontName array of string; + refCount : uChar; // unsigned char, uchar is something else in delphi + font : PTTF_font; + size, + lineSkip : Cardinal; // vertical distance between multi line text output + descent : Integer; + + + +} + + +implementation + +end. diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index f795e250..cdd4aca4 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -6,49 +6,32 @@ program UltraStar; {$I switches.inc} uses - //------------------------------ - //Includes - 3rd Party Libraries - //------------------------------ - SDL in 'lib\JEDI-SDLv1.0\SDL\Pas\SDL.pas', + SDL in 'lib\JEDI-SDLv1.0\SDL\Pas\SDL.pas', moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', - sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', - SDL_Image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', - OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas', - - bass in 'lib\bass\delphi\bass.pas', - - PNGImage in 'lib\PNGImage\PNGImage.pas', - PNGzLib in 'lib\PNGImage\PNGzLib.pas', - pnglang in 'lib\PNGImage\pnglang.pas', - - midiout in 'lib\midi\midiout.pas', - midiin in 'lib\midi\midiin.pas', - Circbuf in 'lib\midi\CIRCBUF.PAS', - MidiType in 'lib\midi\MidiType.PAS', - MidiDefs in 'lib\midi\MidiDefs.PAS', - MidiCons in 'lib\midi\MidiCons.PAS', - MidiFile in 'lib\midi\MidiFile.PAS', - Delphmcb in 'lib\midi\Delphmcb.PAS', - - {$IFDEF UseSerialPort} - zlportio in 'lib\zlportio\zlportio.pas', - ddkint in 'lib\zlportio\ddkint.pas', - {$ENDIF} - - avcodec in 'lib\ffmpeg\avcodec.pas', - avformat in 'lib\ffmpeg\avformat.pas', - avutil in 'lib\ffmpeg\avutil.pas', - rational in 'lib\ffmpeg\rational.pas', - opt in 'lib\ffmpeg\opt.pas', - avio in 'lib\ffmpeg\avio.pas', - + sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', + sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', + OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas', + sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', + bass in 'lib\bass\delphi\bass.pas', + PNGImage in 'lib\PNGImage\PNGImage.pas', + PNGzLib in 'lib\PNGImage\PNGzLib.pas', + pnglang in 'lib\PNGImage\pnglang.pas', + midiout in 'lib\midi\midiout.pas', + midiin in 'lib\midi\midiin.pas', + CIRCBUF in 'lib\midi\CIRCBUF.PAS', + MidiType in 'lib\midi\MidiType.PAS', + MidiDefs in 'lib\midi\MidiDefs.PAS', + MidiCons in 'lib\midi\MidiCons.PAS', + MidiFile in 'lib\midi\MidiFile.PAS', + Delphmcb in 'lib\midi\Delphmcb.PAS', + avcodec in 'lib\ffmpeg\avcodec.pas', + avformat in 'lib\ffmpeg\avformat.pas', + avutil in 'lib\ffmpeg\avutil.pas', + rational in 'lib\ffmpeg\rational.pas', + opt in 'lib\ffmpeg\opt.pas', + avio in 'lib\ffmpeg\avio.pas', SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', - SQLite3 in 'lib\SQLite\SQLite3.pas', - - - //------------------------------ - //Includes - Menu System - //------------------------------ + SQLite3 in 'lib\SQLite\SQLite3.pas', UDisplay in 'Menu\UDisplay.pas', UMenu in 'Menu\UMenu.pas', UMenuStatic in 'Menu\UMenuStatic.pas', @@ -59,11 +42,7 @@ uses UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', UDrawTexture in 'Menu\UDrawTexture.pas', UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', - - //------------------------------ - //Includes - Classes - //------------------------------ - UCommon in 'Classes\UCommon.pas', + UCommon in 'Classes\UCommon.pas', UGraphic in 'Classes\UGraphic.pas', UTexture in 'Classes\UTexture.pas', UMusic in 'Classes\UMusic.pas', @@ -91,18 +70,10 @@ uses UDLLManager in 'Classes\UDLLManager.pas', UParty in 'Classes\UParty.pas', UPlaylist in 'Classes\UPlaylist.pas', - UCommandLine in 'Classes\UCommandLine.pas', + UCommandLine in 'Classes\UCommandLine.pas', USingScores in 'Classes\USingScores.pas', USingNotes in 'Classes\USingNotes.pas', - - //------------------------------ - //Includes - Video Support - //------------------------------ UVideo in 'Classes\UVideo.pas', - - //------------------------------ - //Includes - Screens - //------------------------------ UScreenLoading in 'Screens\UScreenLoading.pas', UScreenWelcome in 'Screens\UScreenWelcome.pas', UScreenMain in 'Screens\UScreenMain.pas', @@ -131,29 +102,16 @@ uses UScreenStatDetail in 'Screens\UScreenStatDetail.pas', UScreenCredits in 'Screens\UScreenCredits.pas', UScreenPopup in 'Screens\UScreenPopup.pas', - - //------------------------------ - //Includes - Screens PartyMode - //------------------------------ UScreenSingModi in 'Screens\UScreenSingModi.pas', UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', UScreenPartyScore in 'Screens\UScreenPartyScore.pas', UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', UScreenPartyWin in 'Screens\UScreenPartyWin.pas', - - //------------------------------ - //Includes - Modi SDK - //------------------------------ ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', - - //------------------------------ - //Includes - Delphi - //------------------------------ Windows, - SysUtils; - - + SysUtils, + UTextClasses in 'Classes\UTextClasses.pas'; const Version = 'UltraStar Deluxe V 1.10 Alpha Build'; @@ -218,6 +176,13 @@ begin Log.BenchmarkEnd(1); Log.LogBenchmark('Initializing SDL', 1); + // SDL_ttf + Log.BenchmarkStart(1); + Log.LogStatus('Initialize SDL_ttf', 'Initialization'); + TTF_Init(); //ttf_quit(); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing SDL_ttf', 1); + // Skin Log.BenchmarkStart(1); Log.LogStatus('Loading Skin List', 'Initialization'); Skin := TSkin.Create; -- cgit v1.2.3 From 47128a387be23abfb800909e4662a968c9846397 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 1 Oct 2007 11:31:49 +0000 Subject: fix mogs compile error :) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@456 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.pas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index 3f5d52b8..9b125812 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -392,9 +392,9 @@ function RenderText(font: PTTF_Font; Text:PAnsiChar; Color: Cardinal): PSDL_Surf var clr : TSDL_color; begin - clr.r := (((Color and $ff0000) shr 16) / 255); - clr.g := ((Color and $ff00) shr 8)/255; - clr.b := ( Color and $ff)/255; + clr.r := ((Color and $ff0000) shr 16 ) div 255; + clr.g := ((Color and $ff00 ) shr 8 ) div 255; + clr.b := ( Color and $ff ) div 255 ; result := TTF_RenderText_Blended( font, text, cLr); end; -- cgit v1.2.3 From c83a2d2149582187c79958f9cda90013e550ce8f Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 1 Oct 2007 11:35:25 +0000 Subject: fix mogs compile error :) ( In lazarus build ) hmmm need to get this to $Include the DPR or something .... git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@457 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.lpr | 1 + 1 file changed, 1 insertion(+) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index e2c08aeb..026d0d69 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -42,6 +42,7 @@ uses opengl12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\opengl12.pas', sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', + sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', -- cgit v1.2.3 From b29759fbfdd8a013e3d0a85b578934ebec028c41 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 2 Oct 2007 04:39:22 +0000 Subject: Fixed linux compilation. Linux is now running in the main loop fine. * no audio playback or input yet... * Timing hack inplace.. that must be replace * bunch of textures not working.. however the play screen is looking similar to windows builds. I hope this dosnt break windows builds to much. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@460 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.pas | 1108 +++---- Game/Code/Classes/UCommon.pas | 341 ++- Game/Code/Classes/UGraphic.pas | 1391 ++++----- Game/Code/Classes/UIni.pas | 22 +- Game/Code/Classes/ULyrics.pas | 1094 +++---- Game/Code/Classes/UMain.pas | 1584 +++++----- Game/Code/Classes/UMusic.pas | 1473 +++++----- Game/Code/Classes/USkins.pas | 345 +-- Game/Code/Classes/UTexture.pas | 2249 +++++++------- Game/Code/Classes/UThemes.pas | 4412 ++++++++++++++-------------- Game/Code/Classes/UTime.pas | 6 +- Game/Code/Menu/UDisplay.pas | 90 +- Game/Code/Menu/UMenu.pas | 3073 +++++++++---------- Game/Code/Screens/UScreenOptionsRecord.pas | 270 +- Game/Code/Screens/UScreenScore.pas | 1335 ++++----- Game/Code/Screens/UScreenTop5.pas | 336 +-- Game/Code/UltraStar.lpr | 856 +++--- Game/Code/UltraStar.rc | 22 +- Game/Code/lib/requirements.txt | 4 + 19 files changed, 10093 insertions(+), 9918 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index 9b125812..fbe9a050 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -1,554 +1,554 @@ -unit TextGL; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - - -uses OpenGL12, - SDL, - UTexture, - Classes, - dialogs, - SDL_ttf, - ULog; - -procedure BuildFont; // Build Our Bitmap Font -procedure KillFont; // Delete The Font -function glTextWidth(text: pchar): real; // Returns Text Width -procedure glPrintDone(text: pchar; Done: real; ColR, ColG, ColB: real); -procedure glPrintLetter(letter: char); -procedure glPrintLetterCut(letter: char; Start, Finish: real); -procedure glPrint(text: pchar); // Custom GL "Print" Routine -procedure glPrintCut(text: pchar); -procedure SetFontPos(X, Y: real); // Sets X And Y -procedure SetFontSize(Size: real); -procedure SetFontStyle(Style: integer); // sets active font style (normal, bold, etc) -procedure SetFontItalic(Enable: boolean); // sets italic type letter (works for all fonts) -procedure SetFontAspectW(Aspect: real); - -// Start of SDL_ttf -function NextPowerOfTwo(Value: Integer): Integer; -//Checks if the ttf exists, if yes then a SDL_ttf is returned -function LoadFont(FileName: PAnsiChar; PointSize: integer):PTTF_Font; - -// Does the renderstuff, color is in $ffeecc style -function RenderText(font: PTTF_Font; Text:PAnsiChar; Color: Cardinal):PSDL_Surface; -procedure printrandomtext(); -// End of SDL_ttf - -type - TTextGL = record - X: real; - Y: real; - Text: string; - Size: real; - ColR: real; - ColG: real; - ColB: real; - end; - - TFont = record - Tex: TTexture; - Width: array[0..255] of byte; - AspectW: real; - Centered: boolean; - Done: real; - Outline: real; - Italic: boolean; - end; - - -var - base: GLuint; // Base Display List For The Font Set - Fonts: array of TFont; - ActFont: integer; - PColR: real; // temps for glPrintDone - PColG: real; - PColB: real; - -implementation - -uses UMain, - UCommon, - {$IFDEF win32} - windows, - {$ELSE} - lclintf, - lcltype, - {$ENDIF} - SysUtils, - {$IFDEF FPC} - LResources, - {$ENDIF} - UGraphic; - -procedure BuildFont; // Build Our Bitmap Font - - procedure loadfont( aID : integer; aType, aResourceName : String); - {$IFDEF FPC} - var - lLazRes : TLResource; - lResData : TStringStream; - begin - try - lLazRes := LazFindResource( aResourceName, aType ); - if lLazRes <> nil then - begin - lResData := TStringStream.create( lLazRes.value ); - try - lResData.position := 0; - lResData.Read(Fonts[ aID ].Width, 256); - finally - freeandnil( lResData ); - end; - end; - - {$ELSE} - var - Rejestr: TResourceStream; - begin - try - Rejestr := TResourceStream.Create(HInstance, aResourceName , pchar( aType ) ); - try - Rejestr.Read(Fonts[ aID ].Width, 256); - finally - Rejestr.Free; - end; - {$ENDIF} - - except - Log.LogStatus( 'Could not load font : loadfont( '+ inttostr( aID ) +' , '+aType+' )' , 'ERROR'); - end; - end; - -var - font: HFONT; // Windows Font ID - h_dc: hdc; - Pet: integer; -begin - ActFont := 0; - - Log.LogStatus( '' , '---------------------------'); - - Log.LogStatus( 'Font' , '---------------------------'); - SetLength(Fonts, 5); - Fonts[0].Tex := Texture.LoadTexture(true, 'Font', 'PNG', 'Font', 0); - Fonts[0].Tex.H := 30; - Fonts[0].AspectW := 0.9; - Fonts[0].Done := -1; - Fonts[0].Outline := 0; - - Log.LogStatus( 'FontB' , '---------------------------'); - - Fonts[1].Tex := Texture.LoadTexture(true, 'FontB', 'PNG', 'Font', 0); - Fonts[1].Tex.H := 30; - Fonts[1].AspectW := 1; - Fonts[1].Done := -1; - Fonts[1].Outline := 0; - - Log.LogStatus( 'FontO' , '---------------------------'); - Fonts[2].Tex := Texture.LoadTexture(true, 'FontO', 'PNG', 'Font Outline', 0); - Fonts[2].Tex.H := 30; - Fonts[2].AspectW := 0.95; - Fonts[2].Done := -1; - Fonts[2].Outline := 5; - - Log.LogStatus( 'FontO2' , '---------------------------'); - Fonts[3].Tex := Texture.LoadTexture(true, 'FontO2', 'PNG', 'Font Outline 2', 0); - Fonts[3].Tex.H := 30; - Fonts[3].AspectW := 0.95; - Fonts[3].Done := -1; - Fonts[3].Outline := 4; - -{ Fonts[4].Tex := Texture.LoadTexture('FontO', 'BMP', 'Arrow', 0); // for score screen - Fonts[4].Tex.H := 30; - Fonts[4].AspectW := 0.95; - Fonts[4].Done := -1; - Fonts[4].Outline := 5;} - - - - loadfont( 0, 'FNT', 'Font' ); - loadfont( 1, 'FNT', 'FontB' ); - loadfont( 2, 'FNT', 'FontO' ); - loadfont( 3, 'FNT', 'FontO2' ); - -{ Rejestr := TResourceStream.Create(HInstance, 'FontO', 'FNT'); - Rejestr.Read(Fonts[4].Width, 256); - Rejestr.Free;} - - for Pet := 0 to 255 do - Fonts[1].Width[Pet] := Fonts[1].Width[Pet] div 2; - - for Pet := 0 to 255 do - Fonts[2].Width[Pet] := Fonts[2].Width[Pet] div 2 + 2; - - for Pet := 0 to 255 do - Fonts[3].Width[Pet] := Fonts[3].Width[Pet] + 1; - -{ for Pet := 0 to 255 do - Fonts[4].Width[Pet] := Fonts[4].Width[Pet] div 2 + 2;} - -end; - -procedure KillFont; // Delete The Font -begin -// glDeleteLists(base, 256); // Delete All 96 Characters -end; - -function glTextWidth(text: pchar): real; -var - Letter: char; -begin -// Log.LogStatus(Text, 'glTextWidth'); - Result := 0; - while (length(text) > 0) do begin - Letter := Text[0]; - text := pchar(Copy(text, 2, Length(text)-1)); - Result := Result + Fonts[ActFont].Width[Ord(Letter)] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; - end; // while -end; - -procedure glPrintDone(text: pchar; Done: real; ColR, ColG, ColB: real); -begin - Fonts[ActFont].Done := Done; - PColR := ColR; - PColG := ColG; - PColB := ColB; - glPrintCut(text); - Fonts[ActFont].Done := -1; -end; - -procedure glPrintLetter(Letter: char); -var - TexX, TexY: real; - TexR, TexB: real; - FWidth: real; - PL, PT: real; - PR, PB: real; - XItal: real; // X shift for italic type letter -begin - with Fonts[ActFont].Tex do - begin - FWidth := Fonts[ActFont].Width[Ord(Letter)]; - - W := FWidth * (H/30) * Fonts[ActFont].AspectW; - // H := 30; - - // set texture positions - TexX := (ord(Letter) mod 16) * 1/16 + 1/32 - FWidth/1024 - Fonts[ActFont].Outline/1024; - TexY := (ord(Letter) div 16) * 1/16 + 2/1024; // 2/1024 - TexR := (ord(Letter) mod 16) * 1/16 + 1/32 + FWidth/1024 + Fonts[ActFont].Outline/1024; - TexB := (1 + ord(Letter) div 16) * 1/16 - 2/1024; - - // set vector positions - PL := X - Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW /2; - PT := Y; - PR := PL + W + Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW; - PB := PT + H; - - if Fonts[ActFont].Italic = false then - XItal := 0 - else - XItal := 12; - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR); - glBindTexture(GL_TEXTURE_2D, TexNum); - - glBegin(GL_QUADS); - try - glTexCoord2f(TexX, TexY); glVertex2f(PL+XItal, PT); - glTexCoord2f(TexX, TexB); glVertex2f(PL, PB); - glTexCoord2f(TexR, TexB); glVertex2f(PR, PB); - glTexCoord2f(TexR, TexY); glVertex2f(PR+XItal, PT); - finally - glEnd; - end; - - X := X + W; - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - end; // with -end; - -procedure glPrintLetterCut(letter: char; Start, Finish: real); -var - TexX, TexY: real; - TexR, TexB: real; - TexTemp: real; - FWidth: real; - PL, PT: real; - PR, PB: real; - OutTemp: real; - XItal: real; -begin - with Fonts[ActFont].Tex do begin - FWidth := Fonts[ActFont].Width[Ord(Letter)]; - - W := FWidth * (H/30) * Fonts[ActFont].AspectW; -// H := 30; - OutTemp := Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW; - - // set texture positions - TexX := (ord(Letter) mod 16) * 1/16 + 1/32 - FWidth/1024 - Fonts[ActFont].Outline/1024; - TexY := (ord(Letter) div 16) * 1/16 + 2/1024; // 2/1024 - TexR := (ord(Letter) mod 16) * 1/16 + 1/32 + FWidth/1024 + Fonts[ActFont].Outline/1024; - TexB := (1 + ord(Letter) div 16) * 1/16 - 2/1024; - - TexTemp := TexX + Start * (TexR - TexX); - TexR := TexX + Finish * (TexR - TexX); - TexX := TexTemp; - - // set vector positions - PL := X - OutTemp / 2 + OutTemp * Start; - PT := Y; - PR := PL + (W + OutTemp) * (Finish - Start); - PB := PT + H; - if Fonts[ActFont].Italic = false then - XItal := 0 - else - XItal := 12; - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR); - glBindTexture(GL_TEXTURE_2D, TexNum); - glBegin(GL_QUADS); - glTexCoord2f(TexX, TexY); glVertex2f(PL+XItal, PT); - glTexCoord2f(TexX, TexB); glVertex2f(PL, PB); - glTexCoord2f(TexR, TexB); glVertex2f(PR, PB); - glTexCoord2f(TexR, TexY); glVertex2f(PR+XItal, PT); // not tested with XItal - glEnd; - X := X + W * (Finish - Start); - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - end; // with - -end; - -procedure glPrint(text: pchar); // Custom GL "Print" Routine -var -// Letter : char; - iPos : Integer; - -begin - if (Text = '') then // If There's No Text - Exit; // Do Nothing - -(* - while (length(text) > 0) do - begin - // cut - Letter := Text[0]; - Text := pchar(Copy(Text, 2, Length(Text)-1)); - - // print - glPrintLetter(Letter); - end; // while -*) - - // This code is better, because doing a Copy of for every - // letter in a string is a waste of CPU & Memory resources. - // Copy operations are quite memory intensive, and this simple - // code achieves the same result. - for iPos := 0 to length( text ) - 1 do - begin - glPrintLetter( Text[iPos] ); - end; - -end; - -function NextPowerOfTwo(Value: Integer): Integer; -// tyty to Asphyre -begin - Result:= 1; - asm - xor ecx, ecx - bsr ecx, Value - inc ecx - shl Result, cl - end; -end; - -function LoadFont(FileName: PAnsiChar; PointSize: integer):PTTF_Font; -begin - if (FileExists(FileName)) then - begin - Result := TTF_OpenFont( FileName, PointSize ); - end - else - begin - Log.LogStatus('ERROR Could not find font in ' + FileName , ''); - ShowMessage( 'ERROR Could not find font in ' + FileName ); - end; -end; - -function RenderText(font: PTTF_Font; Text:PAnsiChar; Color: Cardinal): PSDL_Surface; -var - clr : TSDL_color; -begin - clr.r := ((Color and $ff0000) shr 16 ) div 255; - clr.g := ((Color and $ff00 ) shr 8 ) div 255; - clr.b := ( Color and $ff ) div 255 ; - - result := TTF_RenderText_Blended( font, text, cLr); -end; - -procedure printrandomtext(); -var - stext,intermediary : PSDL_surface; - clrFg, clrBG : TSDL_color; - texture : Gluint; - font : PTTF_Font; - w,h : integer; -begin - -font := LoadFont('fonts\comicbd.ttf', 42); - -clrFg.r := 255; -clrFg.g := 255; -clrFg.b := 255; -clrFg.unused := 255; - -clrBg.r := 255; -clrbg.g := 0; -clrbg.b := 255; -clrbg.unused := 0; - - sText := RenderText(font, 'katzeeeeeee', $fe198e); -//sText := TTF_RenderText_Blended( font, 'huuuuuuuuuund', clrFG); - - // Convert the rendered text to a known format - w := nextpoweroftwo(sText.w); - h := nextpoweroftwo(sText.h); - -intermediary := SDL_CreateRGBSurface(0, w, h, 32, - $000000ff, $0000ff00, $00ff0000, $ff000000); - - SDL_SetAlpha(intermediary, 0, 255); - SDL_SetAlpha(sText, 0, 255); - SDL_BlitSurface(sText, 0, intermediary, 0); - - glGenTextures(1, texture); - - glBindTexture(GL_TEXTURE_2D, texture); - - glTexImage2D(GL_TEXTURE_2D, 0, 4, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, intermediary.pixels); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - - - - - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glBindTexture(GL_TEXTURE_2D, texture); - glColor4f(1, 0, 1, 1); - - glbegin(gl_quads); - glTexCoord2f(0,0); glVertex2f(200, 300); - glTexCoord2f(0,sText.h/h); glVertex2f(200 , 300 + sText.h); - glTexCoord2f(sText.w/w,sText.h/h); glVertex2f(200 + sText.w, 300 + sText.h); - glTexCoord2f(sText.w/w,0); glVertex2f(200 + sText.w, 300); - glEnd; - glfinish(); - glDisable(GL_BLEND); - gldisable(gl_texture_2d); - - - - -SDL_FreeSurface( sText ); -SDL_FreeSurface( intermediary ); -glDeleteTextures(1, @texture); -TTF_CloseFont( font ); - -end; - -procedure glPrintCut(text: pchar); -var - Letter: char; - PToDo: real; - PTotWidth: real; - PDoingNow: real; - S: string; -begin - if (Text = '') then // If There's No Text - Exit; // Do Nothing - - PTotWidth := glTextWidth(Text); - PToDo := Fonts[ActFont].Done; - - while (length(text) > 0) do begin - // cut - Letter := Text[0]; - Text := pchar(Copy(Text, 2, Length(Text)-1)); - - // analyze - S := Letter; - PDoingNow := glTextWidth(pchar(S)) / PTotWidth; - - // drawing - if (PToDo > 0) and (PDoingNow <= PToDo) then - glPrintLetter(Letter); - - if (PToDo > 0) and (PDoingNow > PToDo) then begin - glPrintLetterCut(Letter, 0, PToDo / PDoingNow); - glColor3f(PColR, PColG, PColB); - glPrintLetterCut(Letter, PToDo / PDoingNow, 1); - end; - - if (PToDo <= 0) then - glPrintLetter(Letter); - - PToDo := PToDo - PDoingNow; - - end; // while -end; - - -procedure SetFontPos(X, Y: real); -begin - Fonts[ActFont].Tex.X := X; - Fonts[ActFont].Tex.Y := Y; -end; - -procedure SetFontSize(Size: real); -begin - Fonts[ActFont].Tex.H := 30 * (Size/10); -end; - -procedure SetFontStyle(Style: integer); -begin - ActFont := Style; -end; - -procedure SetFontItalic(Enable: boolean); -begin - Fonts[ActFont].Italic := Enable; -end; - -procedure SetFontAspectW(Aspect: real); -begin - Fonts[ActFont].AspectW := Aspect; -end; - - -{$IFDEF FPC} -{$IFDEF win32} -initialization - {$I UltraStar.lrs} -{$ENDIF} -{$ENDIF} - - -end. - - +unit TextGL; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + + +uses OpenGL12, + SDL, + UTexture, + Classes, + dialogs, + SDL_ttf, + ULog; + +procedure BuildFont; // Build Our Bitmap Font +procedure KillFont; // Delete The Font +function glTextWidth(text: pchar): real; // Returns Text Width +procedure glPrintDone(text: pchar; Done: real; ColR, ColG, ColB: real); +procedure glPrintLetter(letter: char); +procedure glPrintLetterCut(letter: char; Start, Finish: real); +procedure glPrint(text: pchar); // Custom GL "Print" Routine +procedure glPrintCut(text: pchar); +procedure SetFontPos(X, Y: real); // Sets X And Y +procedure SetFontSize(Size: real); +procedure SetFontStyle(Style: integer); // sets active font style (normal, bold, etc) +procedure SetFontItalic(Enable: boolean); // sets italic type letter (works for all fonts) +procedure SetFontAspectW(Aspect: real); + +// Start of SDL_ttf +function NextPowerOfTwo(Value: Integer): Integer; +//Checks if the ttf exists, if yes then a SDL_ttf is returned +function LoadFont(FileName: PAnsiChar; PointSize: integer):PTTF_Font; + +// Does the renderstuff, color is in $ffeecc style +function RenderText(font: PTTF_Font; Text:PAnsiChar; Color: Cardinal):PSDL_Surface; +procedure printrandomtext(); +// End of SDL_ttf + +type + TTextGL = record + X: real; + Y: real; + Text: string; + Size: real; + ColR: real; + ColG: real; + ColB: real; + end; + + TFont = record + Tex: TTexture; + Width: array[0..255] of byte; + AspectW: real; + Centered: boolean; + Done: real; + Outline: real; + Italic: boolean; + end; + + +var + base: GLuint; // Base Display List For The Font Set + Fonts: array of TFont; + ActFont: integer; + PColR: real; // temps for glPrintDone + PColG: real; + PColB: real; + +implementation + +uses UMain, + UCommon, + {$IFDEF win32} + windows, + {$ELSE} + lclintf, + lcltype, + {$ENDIF} + SysUtils, + {$IFDEF FPC} + LResources, + {$ENDIF} + UGraphic; + +procedure BuildFont; // Build Our Bitmap Font + + procedure loadfont( aID : integer; aType, aResourceName : String); + {$IFDEF FPC} + var + lLazRes : TLResource; + lResData : TStringStream; + begin + try + lLazRes := LazFindResource( aResourceName, aType ); + if lLazRes <> nil then + begin + lResData := TStringStream.create( lLazRes.value ); + try + lResData.position := 0; + lResData.Read(Fonts[ aID ].Width, 256); + finally + freeandnil( lResData ); + end; + end; + + {$ELSE} + var + Rejestr: TResourceStream; + begin + try + Rejestr := TResourceStream.Create(HInstance, aResourceName , pchar( aType ) ); + try + Rejestr.Read(Fonts[ aID ].Width, 256); + finally + Rejestr.Free; + end; + {$ENDIF} + + except + Log.LogStatus( 'Could not load font : loadfont( '+ inttostr( aID ) +' , '+aType+' )' , 'ERROR'); + end; + end; + +var + font: HFONT; // Windows Font ID + h_dc: hdc; + Pet: integer; +begin + ActFont := 0; + + Log.LogStatus( '' , '---------------------------'); + + Log.LogStatus( 'Font' , '---------------------------'); + SetLength(Fonts, 5); + Fonts[0].Tex := Texture.LoadTexture(true, 'Font', 'PNG', 'Font', 0); + Fonts[0].Tex.H := 30; + Fonts[0].AspectW := 0.9; + Fonts[0].Done := -1; + Fonts[0].Outline := 0; + + Log.LogStatus( 'FontB' , '---------------------------'); + + Fonts[1].Tex := Texture.LoadTexture(true, 'FontB', 'PNG', 'Font', 0); + Fonts[1].Tex.H := 30; + Fonts[1].AspectW := 1; + Fonts[1].Done := -1; + Fonts[1].Outline := 0; + + Log.LogStatus( 'FontO' , '---------------------------'); + Fonts[2].Tex := Texture.LoadTexture(true, 'FontO', 'PNG', 'Font Outline', 0); + Fonts[2].Tex.H := 30; + Fonts[2].AspectW := 0.95; + Fonts[2].Done := -1; + Fonts[2].Outline := 5; + + Log.LogStatus( 'FontO2' , '---------------------------'); + Fonts[3].Tex := Texture.LoadTexture(true, 'FontO2', 'PNG', 'Font Outline 2', 0); + Fonts[3].Tex.H := 30; + Fonts[3].AspectW := 0.95; + Fonts[3].Done := -1; + Fonts[3].Outline := 4; + +{ Fonts[4].Tex := Texture.LoadTexture('FontO', 'BMP', 'Arrow', 0); // for score screen + Fonts[4].Tex.H := 30; + Fonts[4].AspectW := 0.95; + Fonts[4].Done := -1; + Fonts[4].Outline := 5;} + + + + loadfont( 0, 'FNT', 'Font' ); + loadfont( 1, 'FNT', 'FontB' ); + loadfont( 2, 'FNT', 'FontO' ); + loadfont( 3, 'FNT', 'FontO2' ); + +{ Rejestr := TResourceStream.Create(HInstance, 'FontO', 'FNT'); + Rejestr.Read(Fonts[4].Width, 256); + Rejestr.Free;} + + for Pet := 0 to 255 do + Fonts[1].Width[Pet] := Fonts[1].Width[Pet] div 2; + + for Pet := 0 to 255 do + Fonts[2].Width[Pet] := Fonts[2].Width[Pet] div 2 + 2; + + for Pet := 0 to 255 do + Fonts[3].Width[Pet] := Fonts[3].Width[Pet] + 1; + +{ for Pet := 0 to 255 do + Fonts[4].Width[Pet] := Fonts[4].Width[Pet] div 2 + 2;} + +end; + +procedure KillFont; // Delete The Font +begin +// glDeleteLists(base, 256); // Delete All 96 Characters +end; + +function glTextWidth(text: pchar): real; +var + Letter: char; +begin +// Log.LogStatus(Text, 'glTextWidth'); + Result := 0; + while (length(text) > 0) do begin + Letter := Text[0]; + text := pchar(Copy(text, 2, Length(text)-1)); + Result := Result + Fonts[ActFont].Width[Ord(Letter)] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + end; // while +end; + +procedure glPrintDone(text: pchar; Done: real; ColR, ColG, ColB: real); +begin + Fonts[ActFont].Done := Done; + PColR := ColR; + PColG := ColG; + PColB := ColB; + glPrintCut(text); + Fonts[ActFont].Done := -1; +end; + +procedure glPrintLetter(Letter: char); +var + TexX, TexY: real; + TexR, TexB: real; + FWidth: real; + PL, PT: real; + PR, PB: real; + XItal: real; // X shift for italic type letter +begin + with Fonts[ActFont].Tex do + begin + FWidth := Fonts[ActFont].Width[Ord(Letter)]; + + W := FWidth * (H/30) * Fonts[ActFont].AspectW; + // H := 30; + + // set texture positions + TexX := (ord(Letter) mod 16) * 1/16 + 1/32 - FWidth/1024 - Fonts[ActFont].Outline/1024; + TexY := (ord(Letter) div 16) * 1/16 + 2/1024; // 2/1024 + TexR := (ord(Letter) mod 16) * 1/16 + 1/32 + FWidth/1024 + Fonts[ActFont].Outline/1024; + TexB := (1 + ord(Letter) div 16) * 1/16 - 2/1024; + + // set vector positions + PL := X - Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW /2; + PT := Y; + PR := PL + W + Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW; + PB := PT + H; + + if Fonts[ActFont].Italic = false then + XItal := 0 + else + XItal := 12; + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR); + glBindTexture(GL_TEXTURE_2D, TexNum); + + glBegin(GL_QUADS); + try + glTexCoord2f(TexX, TexY); glVertex2f(PL+XItal, PT); + glTexCoord2f(TexX, TexB); glVertex2f(PL, PB); + glTexCoord2f(TexR, TexB); glVertex2f(PR, PB); + glTexCoord2f(TexR, TexY); glVertex2f(PR+XItal, PT); + finally + glEnd; + end; + + X := X + W; + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + end; // with +end; + +procedure glPrintLetterCut(letter: char; Start, Finish: real); +var + TexX, TexY: real; + TexR, TexB: real; + TexTemp: real; + FWidth: real; + PL, PT: real; + PR, PB: real; + OutTemp: real; + XItal: real; +begin + with Fonts[ActFont].Tex do begin + FWidth := Fonts[ActFont].Width[Ord(Letter)]; + + W := FWidth * (H/30) * Fonts[ActFont].AspectW; +// H := 30; + OutTemp := Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW; + + // set texture positions + TexX := (ord(Letter) mod 16) * 1/16 + 1/32 - FWidth/1024 - Fonts[ActFont].Outline/1024; + TexY := (ord(Letter) div 16) * 1/16 + 2/1024; // 2/1024 + TexR := (ord(Letter) mod 16) * 1/16 + 1/32 + FWidth/1024 + Fonts[ActFont].Outline/1024; + TexB := (1 + ord(Letter) div 16) * 1/16 - 2/1024; + + TexTemp := TexX + Start * (TexR - TexX); + TexR := TexX + Finish * (TexR - TexX); + TexX := TexTemp; + + // set vector positions + PL := X - OutTemp / 2 + OutTemp * Start; + PT := Y; + PR := PL + (W + OutTemp) * (Finish - Start); + PB := PT + H; + if Fonts[ActFont].Italic = false then + XItal := 0 + else + XItal := 12; + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR); + glBindTexture(GL_TEXTURE_2D, TexNum); + glBegin(GL_QUADS); + glTexCoord2f(TexX, TexY); glVertex2f(PL+XItal, PT); + glTexCoord2f(TexX, TexB); glVertex2f(PL, PB); + glTexCoord2f(TexR, TexB); glVertex2f(PR, PB); + glTexCoord2f(TexR, TexY); glVertex2f(PR+XItal, PT); // not tested with XItal + glEnd; + X := X + W * (Finish - Start); + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + end; // with + +end; + +procedure glPrint(text: pchar); // Custom GL "Print" Routine +var +// Letter : char; + iPos : Integer; + +begin + if (Text = '') then // If There's No Text + Exit; // Do Nothing + +(* + while (length(text) > 0) do + begin + // cut + Letter := Text[0]; + Text := pchar(Copy(Text, 2, Length(Text)-1)); + + // print + glPrintLetter(Letter); + end; // while +*) + + // This code is better, because doing a Copy of for every + // letter in a string is a waste of CPU & Memory resources. + // Copy operations are quite memory intensive, and this simple + // code achieves the same result. + for iPos := 0 to length( text ) - 1 do + begin + glPrintLetter( Text[iPos] ); + end; + +end; + +function NextPowerOfTwo(Value: Integer): Integer; +// tyty to Asphyre +begin + Result:= 1; + asm + xor ecx, ecx + bsr ecx, Value + inc ecx + shl Result, cl + end; +end; + +function LoadFont(FileName: PAnsiChar; PointSize: integer):PTTF_Font; +begin + if (FileExists(FileName)) then + begin + Result := TTF_OpenFont( FileName, PointSize ); + end + else + begin + Log.LogStatus('ERROR Could not find font in ' + FileName , ''); + ShowMessage( 'ERROR Could not find font in ' + FileName ); + end; +end; + +function RenderText(font: PTTF_Font; Text:PAnsiChar; Color: Cardinal): PSDL_Surface; +var + clr : TSDL_color; +begin + clr.r := ((Color and $ff0000) shr 16 ) div 255; + clr.g := ((Color and $ff00 ) shr 8 ) div 255; + clr.b := ( Color and $ff ) div 255 ; + + result := TTF_RenderText_Blended( font, text, cLr); +end; + +procedure printrandomtext(); +var + stext,intermediary : PSDL_surface; + clrFg, clrBG : TSDL_color; + texture : Gluint; + font : PTTF_Font; + w,h : integer; +begin + +font := LoadFont('fonts\comicbd.ttf', 42); + +clrFg.r := 255; +clrFg.g := 255; +clrFg.b := 255; +clrFg.unused := 255; + +clrBg.r := 255; +clrbg.g := 0; +clrbg.b := 255; +clrbg.unused := 0; + + sText := RenderText(font, 'katzeeeeeee', $fe198e); +//sText := TTF_RenderText_Blended( font, 'huuuuuuuuuund', clrFG); + + // Convert the rendered text to a known format + w := nextpoweroftwo(sText.w); + h := nextpoweroftwo(sText.h); + +intermediary := SDL_CreateRGBSurface(0, w, h, 32, + $000000ff, $0000ff00, $00ff0000, $ff000000); + + SDL_SetAlpha(intermediary, 0, 255); + SDL_SetAlpha(sText, 0, 255); + SDL_BlitSurface(sText, 0, intermediary, 0); + + glGenTextures(1, @texture); + + glBindTexture(GL_TEXTURE_2D, texture); + + glTexImage2D(GL_TEXTURE_2D, 0, 4, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, intermediary.pixels); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + + + + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glBindTexture(GL_TEXTURE_2D, texture); + glColor4f(1, 0, 1, 1); + + glbegin(gl_quads); + glTexCoord2f(0,0); glVertex2f(200, 300); + glTexCoord2f(0,sText.h/h); glVertex2f(200 , 300 + sText.h); + glTexCoord2f(sText.w/w,sText.h/h); glVertex2f(200 + sText.w, 300 + sText.h); + glTexCoord2f(sText.w/w,0); glVertex2f(200 + sText.w, 300); + glEnd; + glfinish(); + glDisable(GL_BLEND); + gldisable(gl_texture_2d); + + + + +SDL_FreeSurface( sText ); +SDL_FreeSurface( intermediary ); +glDeleteTextures(1, @texture); +TTF_CloseFont( font ); + +end; + +procedure glPrintCut(text: pchar); +var + Letter: char; + PToDo: real; + PTotWidth: real; + PDoingNow: real; + S: string; +begin + if (Text = '') then // If There's No Text + Exit; // Do Nothing + + PTotWidth := glTextWidth(Text); + PToDo := Fonts[ActFont].Done; + + while (length(text) > 0) do begin + // cut + Letter := Text[0]; + Text := pchar(Copy(Text, 2, Length(Text)-1)); + + // analyze + S := Letter; + PDoingNow := glTextWidth(pchar(S)) / PTotWidth; + + // drawing + if (PToDo > 0) and (PDoingNow <= PToDo) then + glPrintLetter(Letter); + + if (PToDo > 0) and (PDoingNow > PToDo) then begin + glPrintLetterCut(Letter, 0, PToDo / PDoingNow); + glColor3f(PColR, PColG, PColB); + glPrintLetterCut(Letter, PToDo / PDoingNow, 1); + end; + + if (PToDo <= 0) then + glPrintLetter(Letter); + + PToDo := PToDo - PDoingNow; + + end; // while +end; + + +procedure SetFontPos(X, Y: real); +begin + Fonts[ActFont].Tex.X := X; + Fonts[ActFont].Tex.Y := Y; +end; + +procedure SetFontSize(Size: real); +begin + Fonts[ActFont].Tex.H := 30 * (Size/10); +end; + +procedure SetFontStyle(Style: integer); +begin + ActFont := Style; +end; + +procedure SetFontItalic(Enable: boolean); +begin + Fonts[ActFont].Italic := Enable; +end; + +procedure SetFontAspectW(Aspect: real); +begin + Fonts[ActFont].AspectW := Aspect; +end; + + +{$IFDEF FPC} +{$IFDEF win32} +initialization + {$I UltraStar.lrs} +{$ENDIF} +{$ENDIF} + + +end. + + diff --git a/Game/Code/Classes/UCommon.pas b/Game/Code/Classes/UCommon.pas index 8089f28c..7337751a 100644 --- a/Game/Code/Classes/UCommon.pas +++ b/Game/Code/Classes/UCommon.pas @@ -1,158 +1,183 @@ -unit UCommon; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -uses -{$IFDEF FPC} - lResources, -{$ENDIF} - ULog, -{$IFDEF win32} - windows; -{$ELSE} - lcltype, - messages; -{$ENDIF} - -{$IFNDEF win32} -type - hStream = THandle; - HGLRC = THandle; - TLargeInteger = Int64; - TWin32FindData = LongInt; -{$ENDIF} - -{$IFDEF FPC} - -type - TWndMethod = procedure(var Message: TMessage) of object; - -function LazFindResource( const aName, aType : String ): TLResource; - -function RandomRange(aMin: Integer; aMax: Integer) : Integer; - -function MaxValue(const Data: array of Double): Double; -function MinValue(const Data: array of Double): Double; - -{$IFDEF Win32} -function AllocateHWnd(Method: TWndMethod): HWND; -procedure DeallocateHWnd(Wnd: HWND); -{$ENDIF} - -{$ENDIF} - -{$IFNDEF win32} -(* - function QueryPerformanceCounter(lpPerformanceCount:TLARGEINTEGER):Bool; - function QueryPerformanceFrequency(lpFrequency:TLARGEINTEGER):Bool; -*) - procedure ZeroMemory( Destination: Pointer; Length: DWORD ); -{$ENDIF} - -implementation - -{$IFNDEF win32} -procedure ZeroMemory( Destination: Pointer; Length: DWORD ); -begin - FillChar( Destination^, Length, 0 ); -end; //ZeroMemory - -(* -function QueryPerformanceCounter(lpPerformanceCount:TLARGEINTEGER):Bool; - - // From http://en.wikipedia.org/wiki/RDTSC - function RDTSC: Int64; register; - asm - rdtsc - end; - -begin - // Use clock_gettime here maybe ... from libc - lpPerformanceCount := RDTSC(); - result := true; -end; - -function QueryPerformanceFrequency(lpFrequency:TLARGEINTEGER):Bool; -begin - lpFrequency := 0; - result := true; -end; -*) -{$ENDIF} - - -{$IFDEF FPC} - -function LazFindResource( const aName, aType : String ): TLResource; -var - iCount : Integer; -begin - result := nil; - - for iCount := 0 to LazarusResources.count -1 do - begin - if ( LazarusResources.items[ iCount ].Name = aName ) AND - ( LazarusResources.items[ iCount ].ValueType = aType ) THEN - begin - result := LazarusResources.items[ iCount ]; - exit; - end; - end; -end; - -function MaxValue(const Data: array of Double): Double; -var - I: Integer; -begin - Result := Data[Low(Data)]; - for I := Low(Data) + 1 to High(Data) do - if Result < Data[I] then - Result := Data[I]; -end; - -function MinValue(const Data: array of Double): Double; -var - I: Integer; -begin - Result := Data[Low(Data)]; - for I := Low(Data) + 1 to High(Data) do - if Result > Data[I] then - Result := Data[I]; -end; - -function RandomRange(aMin: Integer; aMax: Integer) : Integer; -begin -RandomRange := Random(aMax-aMin) + aMin ; -end; - - -// NOTE !!!!!!!!!! -// AllocateHWnd is in lclintfh.inc - -{$IFDEF Win32} -// TODO : JB this is dodgey and bad... find a REAL solution ! -function AllocateHWnd(Method: TWndMethod): HWND; -var - TempClass: TWndClass; - ClassRegistered: Boolean; -begin - Result := CreateWindowEx(WS_EX_TOOLWINDOW, '', '', WS_POPUP , 0, 0, 0, 0, 0, 0, HInstance, nil); -end; - -procedure DeallocateHWnd(Wnd: HWND); -var - Instance: Pointer; -begin - Instance := Pointer(GetWindowLong(Wnd, GWL_WNDPROC)); - DestroyWindow(Wnd); -end; -{$ENDIF} - -{$ENDIF} - - -end. +unit UCommon; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses + SysUtils, +{$IFDEF FPC} + lResources, +{$ENDIF} + ULog, +{$IFDEF win32} + windows; +{$ELSE} + lcltype, + messages; +{$ENDIF} + +{$IFNDEF win32} +type + hStream = THandle; + HGLRC = THandle; + TLargeInteger = Int64; + TWin32FindData = LongInt; +{$ENDIF} + +{$IFDEF FPC} + +type + TWndMethod = procedure(var Message: TMessage) of object; + +function StringReplaceW(text, search, rep: WideString):WideString; +function AdaptFilePaths( const aPath : widestring ): widestring; + +function LazFindResource( const aName, aType : String ): TLResource; + +function RandomRange(aMin: Integer; aMax: Integer) : Integer; + +function MaxValue(const Data: array of Double): Double; +function MinValue(const Data: array of Double): Double; + +{$IFDEF Win32} +function AllocateHWnd(Method: TWndMethod): HWND; +procedure DeallocateHWnd(Wnd: HWND); +{$ENDIF} + +{$ENDIF} + +{$IFNDEF win32} +(* + function QueryPerformanceCounter(lpPerformanceCount:TLARGEINTEGER):Bool; + function QueryPerformanceFrequency(lpFrequency:TLARGEINTEGER):Bool; +*) + procedure ZeroMemory( Destination: Pointer; Length: DWORD ); +{$ENDIF} + +implementation + +function StringReplaceW(text, search, rep: WideString):WideString; +var + iPos : integer; + sTemp : WideString; +begin + result := text; + iPos := Pos(search, result); + while (iPos > 0) do + begin + sTEmp := copy(result, iPos + length(search), length(result)); + result := copy(result, 1, iPos - 1) + rep + sTEmp; + iPos := Pos(search, result); + end; +end; + +function AdaptFilePaths( const aPath : widestring ): widestring; +begin + result := StringReplaceW( aPath, '\', PathDelim );//, [rfReplaceAll] ); +end; + + +{$IFNDEF win32} +procedure ZeroMemory( Destination: Pointer; Length: DWORD ); +begin + FillChar( Destination^, Length, 0 ); +end; //ZeroMemory + +(* +function QueryPerformanceCounter(lpPerformanceCount:TLARGEINTEGER):Bool; + + // From http://en.wikipedia.org/wiki/RDTSC + function RDTSC: Int64; register; + asm + rdtsc + end; + +begin + // Use clock_gettime here maybe ... from libc + lpPerformanceCount := RDTSC(); + result := true; +end; + +function QueryPerformanceFrequency(lpFrequency:TLARGEINTEGER):Bool; +begin + lpFrequency := 0; + result := true; +end; +*) +{$ENDIF} + + +{$IFDEF FPC} + +function LazFindResource( const aName, aType : String ): TLResource; +var + iCount : Integer; +begin + result := nil; + + for iCount := 0 to LazarusResources.count -1 do + begin + if ( LazarusResources.items[ iCount ].Name = aName ) AND + ( LazarusResources.items[ iCount ].ValueType = aType ) THEN + begin + result := LazarusResources.items[ iCount ]; + exit; + end; + end; +end; + +function MaxValue(const Data: array of Double): Double; +var + I: Integer; +begin + Result := Data[Low(Data)]; + for I := Low(Data) + 1 to High(Data) do + if Result < Data[I] then + Result := Data[I]; +end; + +function MinValue(const Data: array of Double): Double; +var + I: Integer; +begin + Result := Data[Low(Data)]; + for I := Low(Data) + 1 to High(Data) do + if Result > Data[I] then + Result := Data[I]; +end; + +function RandomRange(aMin: Integer; aMax: Integer) : Integer; +begin +RandomRange := Random(aMax-aMin) + aMin ; +end; + + +// NOTE !!!!!!!!!! +// AllocateHWnd is in lclintfh.inc + +{$IFDEF Win32} +// TODO : JB this is dodgey and bad... find a REAL solution ! +function AllocateHWnd(Method: TWndMethod): HWND; +var + TempClass: TWndClass; + ClassRegistered: Boolean; +begin + Result := CreateWindowEx(WS_EX_TOOLWINDOW, '', '', WS_POPUP , 0, 0, 0, 0, 0, 0, HInstance, nil); +end; + +procedure DeallocateHWnd(Wnd: HWND); +var + Instance: Pointer; +begin + Instance := Pointer(GetWindowLong(Wnd, GWL_WNDPROC)); + DestroyWindow(Wnd); +end; +{$ENDIF} + +{$ENDIF} + + +end. diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 44c068a0..5847e41c 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -1,688 +1,703 @@ -unit UGraphic; - -interface - -{$I switches.inc} - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -uses - SDL, - OpenGL12, - UTexture, - TextGL, - ULog, - SysUtils, - ULyrics, - UScreenLoading, - UScreenWelcome, - UScreenMain, - UScreenName, - UScreenLevel, - UScreenOptions, - UScreenOptionsGame, - UScreenOptionsGraphics, - UScreenOptionsSound, - UScreenOptionsLyrics, - UScreenOptionsThemes, - UScreenOptionsRecord, - UScreenOptionsAdvanced, - UScreenSong, - UScreenSing, - UScreenScore, - UScreenTop5, - UScreenEditSub, - UScreenEdit, - UScreenEditConvert, - UScreenEditHeader, - UScreenOpen, - UThemes, - USkins, - UScreenSongMenu, - UScreenSongJumpto, - {Party Screens} - UScreenSingModi, - UScreenPartyNewRound, - UScreenPartyScore, - UScreenPartyOptions, - UScreenPartyWin, - UScreenPartyPlayer, - {Stats Screens} - UScreenStatMain, - UScreenStatDetail, - {CreditsScreen} - UScreenCredits, - {Popup for errors, etc.} - UScreenPopup; - -type - TRecR = record - Top: real; - Left: real; - Right: real; - Bottom: real; - end; - -var - Screen: PSDL_Surface; - LoadingThread: PSDL_Thread; - Mutex: PSDL_Mutex; - - RenderW: integer; - RenderH: integer; - ScreenW: integer; - ScreenH: integer; - Screens: integer; - ScreenAct: integer; - ScreenX: integer; - - ScreenLoading: TScreenLoading; - ScreenWelcome: TScreenWelcome; - ScreenMain: TScreenMain; - ScreenName: TScreenName; - ScreenLevel: TScreenLevel; - ScreenSong: TScreenSong; - ScreenSing: TScreenSing; - ScreenScore: TScreenScore; - ScreenTop5: TScreenTop5; - ScreenOptions: TScreenOptions; - ScreenOptionsGame: TScreenOptionsGame; - ScreenOptionsGraphics: TScreenOptionsGraphics; - ScreenOptionsSound: TScreenOptionsSound; - ScreenOptionsLyrics: TScreenOptionsLyrics; - ScreenOptionsThemes: TScreenOptionsThemes; - ScreenOptionsRecord: TScreenOptionsRecord; - ScreenOptionsAdvanced: TScreenOptionsAdvanced; - ScreenEditSub: TScreenEditSub; - ScreenEdit: TScreenEdit; - ScreenEditConvert: TScreenEditConvert; - ScreenEditHeader: TScreenEditHeader; - ScreenOpen: TScreenOpen; - - ScreenSongMenu: TScreenSongMenu; - ScreenSongJumpto: TScreenSongJumpto; - - //Party Screens - ScreenSingModi: TScreenSingModi; - ScreenPartyNewRound: TScreenPartyNewRound; - ScreenPartyScore: TScreenPartyScore; - ScreenPartyWin: TScreenPartyWin; - ScreenPartyOptions: TScreenPartyOptions; - ScreenPartyPlayer: TScreenPartyPlayer; - - //StatsScreens - ScreenStatMain: TScreenStatMain; - ScreenStatDetail: TScreenStatDetail; - - //CreditsScreen - ScreenCredits: TScreenCredits; - - //popup mod - ScreenPopupCheck: TScreenPopupCheck; - ScreenPopupError: TScreenPopupError; - - //Notes - Tex_Left: array[0..6] of TTexture; //rename to tex_note_left - Tex_Mid: array[0..6] of TTexture; //rename to tex_note_mid - Tex_Right: array[0..6] of TTexture; //rename to tex_note_right - - Tex_plain_Left: array[1..6] of TTexture; //rename to tex_notebg_left - Tex_plain_Mid: array[1..6] of TTexture; //rename to tex_notebg_mid - Tex_plain_Right: array[1..6] of TTexture; //rename to tex_notebg_right - - Tex_BG_Left: array[1..6] of TTexture; //rename to tex_noteglow_left - Tex_BG_Mid: array[1..6] of TTexture; //rename to tex_noteglow_mid - Tex_BG_Right: array[1..6] of TTexture; //rename to tex_noteglow_right - - Tex_Note_Star: TTexture; - Tex_Note_Perfect_Star: TTexture; - - - Tex_Ball: TTexture; - Tex_Lyric_Help_Bar: TTexture; - FullScreen: boolean; - - Tex_TimeProgress: TTexture; - - //Sing Bar Mod - Tex_SingBar_Back: TTexture; - Tex_SingBar_Bar: TTexture; - Tex_SingBar_Front: TTexture; - //end Singbar Mod - - //PhrasenBonus - Line Bonus Mod - Tex_SingLineBonusBack: array[0..8] of TTexture; - //End PhrasenBonus - Line Bonus Mod - - //ScoreBG Texs - Tex_ScoreBG: array [0..5] of TTexture; - -const - Skin_BGColorR = 1; - Skin_BGColorG = 1; - Skin_BGColorB = 1; - - Skin_SpectrumR = 0; - Skin_SpectrumG = 0; - Skin_SpectrumB = 0; - - Skin_Spectograph1R = 0.6; - Skin_Spectograph1G = 0.8; - Skin_Spectograph1B = 1; - - Skin_Spectograph2R = 0; - Skin_Spectograph2G = 0; - Skin_Spectograph2B = 0.2; - - Skin_SzczytR = 0.8; - Skin_SzczytG = 0; - Skin_SzczytB = 0; - - Skin_SzczytLimitR = 0; - Skin_SzczytLimitG = 0.8; - Skin_SzczytLimitB = 0; - - Skin_FontR = 0; - Skin_FontG = 0; - Skin_FontB = 0; - - Skin_FontHighlightR = 0.3; // 0.3 - Skin_FontHighlightG = 0.3; // 0.3 - Skin_FontHighlightB = 1; // 1 - - Skin_TimeR = 0.25; //0,0,0 - Skin_TimeG = 0.25; - Skin_TimeB = 0.25; - - Skin_OscR = 0; - Skin_OscG = 0; - Skin_OscB = 0; - - Skin_LyricsT = 494; // 500 / 510 / 400 - Skin_SpectrumT = 470; - Skin_SpectrumBot = 570; - Skin_SpectrumH = 100; - - Skin_P1_LinesR = 0.5; // 0.6 0.6 1 - Skin_P1_LinesG = 0.5; - Skin_P1_LinesB = 0.5; - - Skin_P2_LinesR = 0.5; // 1 0.6 0.6 - Skin_P2_LinesG = 0.5; - Skin_P2_LinesB = 0.5; - - Skin_P1_NotesB = 250; - Skin_P2_NotesB = 430; // 430 / 300 - - Skin_P1_ScoreT = 50; - Skin_P1_ScoreL = 20; - - Skin_P2_ScoreT = 50; - Skin_P2_ScoreL = 640; - -procedure Initialize3D (Title: string); -procedure Reinitialize3D; -procedure SwapBuffers; - -procedure LoadTextures; -procedure InitializeScreen; -procedure LoadLoadingScreen; -procedure LoadScreens; - -function LoadingThreadFunction: integer; - - -implementation - -uses UMain, - UIni, - UDisplay, - UCommandLine, - {$IFNDEF FPC} - Graphics, - {$ENDIF} - {$IFDEF win32} - windows, - {$ENDIF} - Classes; - -procedure LoadFontTextures; -begin - Log.LogStatus('Building Fonts', 'LoadTextures'); - BuildFont; -end; - -procedure LoadTextures; - - -var - P: integer; - R, G, B: real; - Col: integer; -begin - // zaladowanie tekstur - Log.LogStatus('Loading Textures', 'LoadTextures'); - - Tex_Left[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'BMP', 'Transparent', 0); //brauch man die noch? - Tex_Mid[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'BMP', 'Plain', 0); //brauch man die noch? - Tex_Right[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'BMP', 'Transparent', 0); //brauch man die noch? - - Log.LogStatus('Loading Textures - A', 'LoadTextures'); - - // P1-6 - // TODO... do it once for each player... this is a bit crappy !! - // can we make it any better !? - for P := 1 to 6 do - begin - LoadColor(R, G, B, 'P' + IntToStr(P) + 'Light'); - Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); - - Tex_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'PNG', 'Colorized', Col); - Tex_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'PNG', 'Colorized', Col); - Tex_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'PNG', 'Colorized', Col); - - Tex_plain_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainLeft')), 'PNG', 'Colorized', Col); - Tex_plain_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainMid')), 'PNG', 'Colorized', Col); - Tex_plain_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainRight')), 'PNG', 'Colorized', Col); - - Tex_BG_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGLeft')), 'PNG', 'Colorized', Col); - Tex_BG_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGMid')), 'PNG', 'Colorized', Col); - Tex_BG_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGRight')), 'PNG', 'Colorized', Col); - end; - - Log.LogStatus('Loading Textures - B', 'LoadTextures'); - - Tex_Note_Perfect_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePerfectStar')), 'JPG', 'Font Black', 0); - Tex_Note_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteStar')) , 'JPG', 'Alpha Black Colored', $FFFFFF); - Tex_Ball := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'BMP', 'Transparent', $FF00FF); - Tex_Lyric_Help_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricHelpBar')), 'BMP', 'Transparent', $FF00FF); - - - //TimeBar mod - Tex_TimeProgress := Texture.LoadTexture(pchar(Skin.GetTextureFileName('TimeBar'))); - //eoa TimeBar mod - - //SingBar Mod - Tex_SingBar_Back := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBack')), 'JPG', 'Plain', 0); - Tex_SingBar_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBar')), 'JPG', 'Plain', 0); - Tex_SingBar_Front := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarFront')), 'JPG', 'Font', 0); - //end Singbar Mod - - Log.LogStatus('Loading Textures - C', 'LoadTextures'); - - //Line Bonus PopUp - for P := 0 to 8 do - begin - Case P of - 0: begin - R := 1; - G := 0; - B := 0; - end; - 1..3: begin - R := 1; - G := (P * 0.25); - B := 0; - end; - 4: begin - R := 1; - G := 1; - B := 0; - end; - 5..7: begin - R := 1-((P-4)*0.25); - G := 1; - B := 0; - end; - 8: begin - R := 0; - G := 1; - B := 0; - end; - End; - - Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); - Tex_SingLineBonusBack[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LineBonusBack')), 'PNG', 'Colorized', Col); - end; - - //Score BG Textures - for P := 0 to 5 do begin - LoadColor(R, G, B, 'P' + IntToStr(P+1) + 'Light'); - Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); - Tex_ScoreBG[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreBG')), 'PNG', 'Colorized', Col); - end; - - Log.LogStatus('Loading Textures - D', 'LoadTextures'); -end; - -procedure Initialize3D (Title: string); -var -// Icon: TIcon; -// Res: TResourceStream; - ISurface: PSDL_Surface; - Pixel: PByteArray; - I: Integer; -begin - Log.LogStatus('LoadOpenGL', 'UGraphic.Initialize3D'); -// Log.BenchmarkStart(2); - - LoadOpenGL; - - Log.LogStatus('SDL_Init', 'UGraphic.Initialize3D'); - if ( SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO)= -1 ) then - begin - Log.LogError('SDL_Init Failed', 'UGraphic.Initialize3D'); - exit; - end; - - { //Load Icon - Res := TResourceStream.CreateFromID(HInstance, 3, RT_ICON); - Icon := TIcon.Create; - Icon.LoadFromStream(Res); - Res.Free; - Icon. - //Create icon Surface - SDL_CreateRGBSurfaceFrom ( - SDL_SWSURFACE, - Icon.Width, - Icon.Height, - 32, - 128 or 64, - 32 or 16, - 8 or 4, - 2 or 1); - //SDL_BlitSurface( - - - SDL_WM_SetIcon(SDL_LoadBMP('DEFAULT_WINDOW_ICON'), 0); //} - - SDL_WM_SetCaption(PChar(Title), nil); - - InitializeScreen; - -// Log.BenchmarkEnd(2); -// Log.LogBenchmark('--> Setting Screen', 2); - - // ladowanie tekstur -// Log.BenchmarkStart(2); - Texture := TTextureUnit.Create; - Texture.Limit := 1024*1024; - -// LoadTextures; -// Log.BenchmarkEnd(2); -// Log.LogBenchmark('--> Loading Textures', 2); - -{ Log.BenchmarkStart(2); - Lyric:= TLyric.Create; - Log.BenchmarkEnd(2); - Log.LogBenchmark('--> Loading Fonts', 2); -} - -// Log.BenchmarkStart(2); - Display := TDisplay.Create; - SDL_EnableUnicode(1); -// Log.BenchmarkEnd(2); Log.LogBenchmark('====> Creating Display', 2); - -// Log.LogStatus('Loading Screens', 'Initialize3D'); -// Log.BenchmarkStart(3); - - Log.LogStatus('Loading Font Textures', 'UGraphic.Initialize3D'); - LoadFontTextures(); - - // Show the Loading Screen ------------- - Log.LogStatus('Loading Loading Screen', 'UGraphic.Initialize3D'); - LoadLoadingScreen; - - - Log.LogStatus(' Loading Textures', 'UGraphic.Initialize3D'); - LoadTextures; // jb - - - - // now that we have something to display while loading, - // start thread that loads the rest of ultrastar -// Mutex := SDL_CreateMutex; -// SDL_UnLockMutex(Mutex); - - // funktioniert so noch nicht, da der ladethread unverändert auf opengl zugreifen will - // siehe dazu kommentar unten - //LoadingThread := SDL_CreateThread(@LoadingThread, nil); - - // das hier würde dann im ladethread ausgeführt - Log.LogStatus(' Loading Screens', 'UGraphic.Initialize3D'); - LoadScreens; - - - // TODO!!!!!!1 - // hier käme jetzt eine schleife, die - // * den ladescreen malt (ab und zu) - // * den "fortschritt" des ladescreens steuert - // * zwischendrin schaut, ob der ladethread texturen geladen hat (mutex prüfen) und - // * die texturen in die opengl lädt, sowie - // * dem ladethread signalisiert, dass der speicher für die textur - // zum laden der nächsten textur weiterverwendet werden kann (über weiteren mutex) - // * über einen 3. mutex so lange läuft, bis der ladethread signalisiert, - // dass er alles geladen hat fertig ist - // - // dafür muss loadtexture so umgeschrieben werden, dass es, statt selbst irgendwelche - // opengl funktionen aufzurufen, entsprechend mutexe verändert - // der hauptthread muss auch irgendwoher erfahren, was an opengl funktionen auszuführen ist, - // mit welchen parametern (texturtyp, entspr. texturobjekt, textur-zwischenspeicher-adresse, ... - - - //wait for loading thread to finish - // funktioniert so auch noch nicht - //SDL_WaitThread(LoadingThread, I); -// SDL_DestroyMutex(Mutex); - - Display.ActualScreen^.FadeTo( @ScreenMain ); - - Log.BenchmarkEnd(2); - Log.LogBenchmark('--> Loading Screens', 2); - - Log.LogStatus('Finish', 'Initialize3D'); -end; - -procedure SwapBuffers; -begin - SDL_GL_SwapBuffers; - glMatrixMode(GL_PROJECTION); - glLoadIdentity; - glOrtho(0, RenderW, RenderH, 0, -1, 100); - glMatrixMode(GL_MODELVIEW); -end; - -procedure Reinitialize3D; -begin -// InitializeScreen; -// LoadTextures; -// LoadScreens; -end; - -procedure InitializeScreen; -var - S: string; - I: integer; - W, H: integer; - Depth: Integer; -begin - if (Params.Screens <> -1) then - Screens := Params.Screens + 1 - else - Screens := Ini.Screens + 1; - - SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - - // If there is a resolution in Parameters, use it, else use the Ini value - I := Params.Resolution; - if (I <> -1) then - S := IResolution[I] - else - S := IResolution[Ini.Resolution]; - - I := Pos('x', S); - W := StrToInt(Copy(S, 1, I-1)) * Screens; - H := StrToInt(Copy(S, I+1, 1000)); - - {if ParamStr(1) = '-fsblack' then begin - W := 800; - H := 600; - end; - if ParamStr(1) = '-320x240' then begin - W := 320; - H := 240; - end; } - - If (Params.Depth <> -1) then - Depth := Params.Depth - else - Depth := Ini.Depth; - - - Log.LogStatus('SDL_SetVideoMode', 'Initialize3D'); - -// Okay it's possible to set the title bar / taskbar icon here -// it's working this way, but just if the bmp is in your exe folder - SDL_WM_SetIcon(SDL_LoadBMP('ustar-icon.bmp'), 0); - -// SDL_SetRefreshrate(85); -// SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); - if (Ini.FullScreen = 0) and (Not Params.FullScreen) then - begin - screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL) - end - else - begin - screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN); - SDL_ShowCursor(0); - end; - - if (screen = nil) then - begin - Log.LogError('SDL_SetVideoMode Failed', 'Initialize3D'); - exit; - end; - - // clear screen once window is being shown - glClearColor(1, 1, 1, 1); - glClear(GL_COLOR_BUFFER_BIT); - SwapBuffers; - - // zmienne - RenderW := 800; - RenderH := 600; - ScreenW := W; - ScreenH := H; -end; - -procedure LoadLoadingScreen; -begin - ScreenLoading := TScreenLoading.Create; - ScreenLoading.onShow; - - Display.ActualScreen := @ScreenLoading; - - swapbuffers; - - ScreenLoading.Draw; - Display.Draw; - - SwapBuffers; -end; - -procedure LoadScreens; -begin -{ ScreenLoading := TScreenLoading.Create; - ScreenLoading.onShow; - Display.ActualScreen := @ScreenLoading; - ScreenLoading.Draw; - Display.Draw; - SwapBuffers; -} - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Loading', 3); Log.BenchmarkStart(3); -{ ScreenWelcome := TScreenWelcome.Create; //'BG', 4, 3); - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Welcome', 3); Log.BenchmarkStart(3);} - ScreenMain := TScreenMain.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Main', 3); Log.BenchmarkStart(3); - ScreenName := TScreenName.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Name', 3); Log.BenchmarkStart(3); - ScreenLevel := TScreenLevel.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Level', 3); Log.BenchmarkStart(3); - ScreenSong := TScreenSong.Create; - 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); - ScreenSing := TScreenSing.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing', 3); Log.BenchmarkStart(3); - ScreenScore := TScreenScore.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Score', 3); Log.BenchmarkStart(3); - ScreenTop5 := TScreenTop5.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Top5', 3); Log.BenchmarkStart(3); - ScreenOptions := TScreenOptions.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options', 3); Log.BenchmarkStart(3); - ScreenOptionsGame := TScreenOptionsGame.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Game', 3); Log.BenchmarkStart(3); - ScreenOptionsGraphics := TScreenOptionsGraphics.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Graphics', 3); Log.BenchmarkStart(3); - ScreenOptionsSound := TScreenOptionsSound.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Sound', 3); Log.BenchmarkStart(3); - ScreenOptionsLyrics := TScreenOptionsLyrics.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Lyrics', 3); Log.BenchmarkStart(3); - ScreenOptionsThemes := TScreenOptionsThemes.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Themes', 3); Log.BenchmarkStart(3); - ScreenOptionsRecord := TScreenOptionsRecord.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Record', 3); Log.BenchmarkStart(3); - ScreenOptionsAdvanced := TScreenOptionsAdvanced.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Advanced', 3); Log.BenchmarkStart(3); - ScreenEditSub := TScreenEditSub.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Sub', 3); Log.BenchmarkStart(3); - ScreenEdit := TScreenEdit.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit', 3); Log.BenchmarkStart(3); - ScreenEditConvert := TScreenEditConvert.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen EditConvert', 3); Log.BenchmarkStart(3); -// ScreenEditHeader := TScreenEditHeader.Create(Skin.ScoreBG); -// Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Header', 3); Log.BenchmarkStart(3); - ScreenOpen := TScreenOpen.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Open', 3); Log.BenchmarkStart(3); - ScreenSingModi := TScreenSingModi.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing with Modi support', 3); Log.BenchmarkStart(3); - ScreenSongMenu := TScreenSongMenu.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongMenu', 3); Log.BenchmarkStart(3); - ScreenSongJumpto := TScreenSongJumpto.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongJumpto', 3); Log.BenchmarkStart(3); - ScreenPopupCheck := TScreenPopupCheck.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Popup (Check)', 3); Log.BenchmarkStart(3); - ScreenPopupError := TScreenPopupError.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Popup (Error)', 3); Log.BenchmarkStart(3); - ScreenPartyNewRound := TScreenPartyNewRound.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyNewRound', 3); Log.BenchmarkStart(3); - ScreenPartyScore := TScreenPartyScore.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyScore', 3); Log.BenchmarkStart(3); - ScreenPartyWin := TScreenPartyWin.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyWin', 3); Log.BenchmarkStart(3); - ScreenPartyOptions := TScreenPartyOptions.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyOptions', 3); Log.BenchmarkStart(3); - ScreenPartyPlayer := TScreenPartyPlayer.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyPlayer', 3); Log.BenchmarkStart(3); - ScreenStatMain := TScreenStatMain.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Main', 3); Log.BenchmarkStart(3); - ScreenStatDetail := TScreenStatDetail.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Detail', 3); Log.BenchmarkStart(3); - ScreenCredits := TScreenCredits.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Credits', 3); Log.BenchmarkStart(3); - - end; - -function LoadingThreadFunction: integer; -begin - LoadScreens; - Result:= 1; -end; - -end. +unit UGraphic; + +interface + +{$I switches.inc} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses + SDL, + OpenGL12, + UTexture, + TextGL, + ULog, + SysUtils, + ULyrics, + UScreenLoading, + UScreenWelcome, + UScreenMain, + UScreenName, + UScreenLevel, + UScreenOptions, + UScreenOptionsGame, + UScreenOptionsGraphics, + UScreenOptionsSound, + UScreenOptionsLyrics, + UScreenOptionsThemes, + UScreenOptionsRecord, + UScreenOptionsAdvanced, + UScreenSong, + UScreenSing, + UScreenScore, + UScreenTop5, + UScreenEditSub, + UScreenEdit, + UScreenEditConvert, + UScreenEditHeader, + UScreenOpen, + UThemes, + USkins, + UScreenSongMenu, + UScreenSongJumpto, + {Party Screens} + UScreenSingModi, + UScreenPartyNewRound, + UScreenPartyScore, + UScreenPartyOptions, + UScreenPartyWin, + UScreenPartyPlayer, + {Stats Screens} + UScreenStatMain, + UScreenStatDetail, + {CreditsScreen} + UScreenCredits, + {Popup for errors, etc.} + UScreenPopup; + +type + TRecR = record + Top: real; + Left: real; + Right: real; + Bottom: real; + end; + +var + Screen: PSDL_Surface; + LoadingThread: PSDL_Thread; + Mutex: PSDL_Mutex; + + RenderW: integer; + RenderH: integer; + ScreenW: integer; + ScreenH: integer; + Screens: integer; + ScreenAct: integer; + ScreenX: integer; + + ScreenLoading: TScreenLoading; + ScreenWelcome: TScreenWelcome; + ScreenMain: TScreenMain; + ScreenName: TScreenName; + ScreenLevel: TScreenLevel; + ScreenSong: TScreenSong; + ScreenSing: TScreenSing; + ScreenScore: TScreenScore; + ScreenTop5: TScreenTop5; + ScreenOptions: TScreenOptions; + ScreenOptionsGame: TScreenOptionsGame; + ScreenOptionsGraphics: TScreenOptionsGraphics; + ScreenOptionsSound: TScreenOptionsSound; + ScreenOptionsLyrics: TScreenOptionsLyrics; + ScreenOptionsThemes: TScreenOptionsThemes; + ScreenOptionsRecord: TScreenOptionsRecord; + ScreenOptionsAdvanced: TScreenOptionsAdvanced; + ScreenEditSub: TScreenEditSub; + ScreenEdit: TScreenEdit; + ScreenEditConvert: TScreenEditConvert; + ScreenEditHeader: TScreenEditHeader; + ScreenOpen: TScreenOpen; + + ScreenSongMenu: TScreenSongMenu; + ScreenSongJumpto: TScreenSongJumpto; + + //Party Screens + ScreenSingModi: TScreenSingModi; + ScreenPartyNewRound: TScreenPartyNewRound; + ScreenPartyScore: TScreenPartyScore; + ScreenPartyWin: TScreenPartyWin; + ScreenPartyOptions: TScreenPartyOptions; + ScreenPartyPlayer: TScreenPartyPlayer; + + //StatsScreens + ScreenStatMain: TScreenStatMain; + ScreenStatDetail: TScreenStatDetail; + + //CreditsScreen + ScreenCredits: TScreenCredits; + + //popup mod + ScreenPopupCheck: TScreenPopupCheck; + ScreenPopupError: TScreenPopupError; + + //Notes + Tex_Left: array[0..6] of TTexture; //rename to tex_note_left + Tex_Mid: array[0..6] of TTexture; //rename to tex_note_mid + Tex_Right: array[0..6] of TTexture; //rename to tex_note_right + + Tex_plain_Left: array[1..6] of TTexture; //rename to tex_notebg_left + Tex_plain_Mid: array[1..6] of TTexture; //rename to tex_notebg_mid + Tex_plain_Right: array[1..6] of TTexture; //rename to tex_notebg_right + + Tex_BG_Left: array[1..6] of TTexture; //rename to tex_noteglow_left + Tex_BG_Mid: array[1..6] of TTexture; //rename to tex_noteglow_mid + Tex_BG_Right: array[1..6] of TTexture; //rename to tex_noteglow_right + + Tex_Note_Star: TTexture; + Tex_Note_Perfect_Star: TTexture; + + + Tex_Ball: TTexture; + Tex_Lyric_Help_Bar: TTexture; + FullScreen: boolean; + + Tex_TimeProgress: TTexture; + + //Sing Bar Mod + Tex_SingBar_Back: TTexture; + Tex_SingBar_Bar: TTexture; + Tex_SingBar_Front: TTexture; + //end Singbar Mod + + //PhrasenBonus - Line Bonus Mod + Tex_SingLineBonusBack: array[0..8] of TTexture; + //End PhrasenBonus - Line Bonus Mod + + //ScoreBG Texs + Tex_ScoreBG: array [0..5] of TTexture; + +const + Skin_BGColorR = 1; + Skin_BGColorG = 1; + Skin_BGColorB = 1; + + Skin_SpectrumR = 0; + Skin_SpectrumG = 0; + Skin_SpectrumB = 0; + + Skin_Spectograph1R = 0.6; + Skin_Spectograph1G = 0.8; + Skin_Spectograph1B = 1; + + Skin_Spectograph2R = 0; + Skin_Spectograph2G = 0; + Skin_Spectograph2B = 0.2; + + Skin_SzczytR = 0.8; + Skin_SzczytG = 0; + Skin_SzczytB = 0; + + Skin_SzczytLimitR = 0; + Skin_SzczytLimitG = 0.8; + Skin_SzczytLimitB = 0; + + Skin_FontR = 0; + Skin_FontG = 0; + Skin_FontB = 0; + + Skin_FontHighlightR = 0.3; // 0.3 + Skin_FontHighlightG = 0.3; // 0.3 + Skin_FontHighlightB = 1; // 1 + + Skin_TimeR = 0.25; //0,0,0 + Skin_TimeG = 0.25; + Skin_TimeB = 0.25; + + Skin_OscR = 0; + Skin_OscG = 0; + Skin_OscB = 0; + + Skin_LyricsT = 494; // 500 / 510 / 400 + Skin_SpectrumT = 470; + Skin_SpectrumBot = 570; + Skin_SpectrumH = 100; + + Skin_P1_LinesR = 0.5; // 0.6 0.6 1 + Skin_P1_LinesG = 0.5; + Skin_P1_LinesB = 0.5; + + Skin_P2_LinesR = 0.5; // 1 0.6 0.6 + Skin_P2_LinesG = 0.5; + Skin_P2_LinesB = 0.5; + + Skin_P1_NotesB = 250; + Skin_P2_NotesB = 430; // 430 / 300 + + Skin_P1_ScoreT = 50; + Skin_P1_ScoreL = 20; + + Skin_P2_ScoreT = 50; + Skin_P2_ScoreL = 640; + +procedure Initialize3D (Title: string); +procedure Reinitialize3D; +procedure SwapBuffers; + +procedure LoadTextures; +procedure InitializeScreen; +procedure LoadLoadingScreen; +procedure LoadScreens; + +function LoadingThreadFunction: integer; + + +implementation + +uses UMain, + UIni, + UDisplay, + UCommandLine, + {$IFNDEF FPC} + Graphics, + {$ENDIF} + {$IFDEF win32} + windows, + {$ENDIF} + Classes; + +procedure LoadFontTextures; +begin + Log.LogStatus('Building Fonts', 'LoadTextures'); + BuildFont; +end; + +procedure LoadTextures; + + +var + P: integer; + R, G, B: real; + Col: integer; +begin + // zaladowanie tekstur + Log.LogStatus('Loading Textures', 'LoadTextures'); + + Tex_Left[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'BMP', 'Transparent', 0); //brauch man die noch? + Tex_Mid[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'BMP', 'Plain', 0); //brauch man die noch? + Tex_Right[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'BMP', 'Transparent', 0); //brauch man die noch? + + Log.LogStatus('Loading Textures - A', 'LoadTextures'); + + // P1-6 + // TODO... do it once for each player... this is a bit crappy !! + // can we make it any better !? + for P := 1 to 6 do + begin + LoadColor(R, G, B, 'P' + IntToStr(P) + 'Light'); + Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + + Tex_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'PNG', 'Colorized', Col); + Tex_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'PNG', 'Colorized', Col); + Tex_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'PNG', 'Colorized', Col); + + Tex_plain_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainLeft')), 'PNG', 'Colorized', Col); + Tex_plain_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainMid')), 'PNG', 'Colorized', Col); + Tex_plain_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainRight')), 'PNG', 'Colorized', Col); + + Tex_BG_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGLeft')), 'PNG', 'Colorized', Col); + Tex_BG_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGMid')), 'PNG', 'Colorized', Col); + Tex_BG_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGRight')), 'PNG', 'Colorized', Col); + end; + + Log.LogStatus('Loading Textures - B', 'LoadTextures'); + + Tex_Note_Perfect_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePerfectStar')), 'JPG', 'Font Black', 0); + Tex_Note_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteStar')) , 'JPG', 'Alpha Black Colored', $FFFFFF); + Tex_Ball := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'BMP', 'Transparent', $FF00FF); + Tex_Lyric_Help_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricHelpBar')), 'BMP', 'Transparent', $FF00FF); + + + //TimeBar mod + Tex_TimeProgress := Texture.LoadTexture(pchar(Skin.GetTextureFileName('TimeBar'))); + //eoa TimeBar mod + + //SingBar Mod + Tex_SingBar_Back := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBack')), 'JPG', 'Plain', 0); + Tex_SingBar_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBar')), 'JPG', 'Plain', 0); + Tex_SingBar_Front := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarFront')), 'JPG', 'Font', 0); + //end Singbar Mod + + Log.LogStatus('Loading Textures - C', 'LoadTextures'); + + //Line Bonus PopUp + for P := 0 to 8 do + begin + Case P of + 0: begin + R := 1; + G := 0; + B := 0; + end; + 1..3: begin + R := 1; + G := (P * 0.25); + B := 0; + end; + 4: begin + R := 1; + G := 1; + B := 0; + end; + 5..7: begin + R := 1-((P-4)*0.25); + G := 1; + B := 0; + end; + 8: begin + R := 0; + G := 1; + B := 0; + end; + End; + + Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + Tex_SingLineBonusBack[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LineBonusBack')), 'PNG', 'Colorized', Col); + end; + + //Score BG Textures + for P := 0 to 5 do begin + LoadColor(R, G, B, 'P' + IntToStr(P+1) + 'Light'); + Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + Tex_ScoreBG[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreBG')), 'PNG', 'Colorized', Col); + end; + + Log.LogStatus('Loading Textures - D', 'LoadTextures'); +end; + +procedure Initialize3D (Title: string); +var +// Icon: TIcon; +// Res: TResourceStream; + ISurface: PSDL_Surface; + Pixel: PByteArray; + I: Integer; +begin + Log.LogStatus('LoadOpenGL', 'UGraphic.Initialize3D'); +// Log.BenchmarkStart(2); + + LoadOpenGL; + + Log.LogStatus('SDL_Init', 'UGraphic.Initialize3D'); + if ( SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO)= -1 ) then + begin + Log.LogError('SDL_Init Failed', 'UGraphic.Initialize3D'); + exit; + end; + + { //Load Icon + Res := TResourceStream.CreateFromID(HInstance, 3, RT_ICON); + Icon := TIcon.Create; + Icon.LoadFromStream(Res); + Res.Free; + Icon. + //Create icon Surface + SDL_CreateRGBSurfaceFrom ( + SDL_SWSURFACE, + Icon.Width, + Icon.Height, + 32, + 128 or 64, + 32 or 16, + 8 or 4, + 2 or 1); + //SDL_BlitSurface( + + + SDL_WM_SetIcon(SDL_LoadBMP('DEFAULT_WINDOW_ICON'), 0); //} + + SDL_WM_SetCaption(PChar(Title), nil); + + InitializeScreen; + +// Log.BenchmarkEnd(2); +// Log.LogBenchmark('--> Setting Screen', 2); + + // ladowanie tekstur +// Log.BenchmarkStart(2); + Texture := TTextureUnit.Create; + Texture.Limit := 1024*1024; + +// LoadTextures; +// Log.BenchmarkEnd(2); +// Log.LogBenchmark('--> Loading Textures', 2); + +{ Log.BenchmarkStart(2); + Lyric:= TLyric.Create; + Log.BenchmarkEnd(2); + Log.LogBenchmark('--> Loading Fonts', 2); +} + +// Log.BenchmarkStart(2); + + Log.LogStatus('TDisplay.Create', 'UGraphic.Initialize3D'); + Display := TDisplay.Create; + + Log.LogStatus('SDL_EnableUnicode', 'UGraphic.Initialize3D'); + SDL_EnableUnicode(1); +// Log.BenchmarkEnd(2); Log.LogBenchmark('====> Creating Display', 2); + +// Log.LogStatus('Loading Screens', 'Initialize3D'); +// Log.BenchmarkStart(3); + + Log.LogStatus('Loading Font Textures', 'UGraphic.Initialize3D'); + LoadFontTextures(); + + // Show the Loading Screen ------------- + Log.LogStatus('Loading Loading Screen', 'UGraphic.Initialize3D'); + LoadLoadingScreen; + + + Log.LogStatus(' Loading Textures', 'UGraphic.Initialize3D'); + LoadTextures; // jb + + + + // now that we have something to display while loading, + // start thread that loads the rest of ultrastar +// Mutex := SDL_CreateMutex; +// SDL_UnLockMutex(Mutex); + + // funktioniert so noch nicht, da der ladethread unverändert auf opengl zugreifen will + // siehe dazu kommentar unten + //LoadingThread := SDL_CreateThread(@LoadingThread, nil); + + // das hier würde dann im ladethread ausgeführt + Log.LogStatus(' Loading Screens', 'UGraphic.Initialize3D'); + LoadScreens; + + + // TODO!!!!!!1 + // hier käme jetzt eine schleife, die + // * den ladescreen malt (ab und zu) + // * den "fortschritt" des ladescreens steuert + // * zwischendrin schaut, ob der ladethread texturen geladen hat (mutex prüfen) und + // * die texturen in die opengl lädt, sowie + // * dem ladethread signalisiert, dass der speicher für die textur + // zum laden der nächsten textur weiterverwendet werden kann (über weiteren mutex) + // * über einen 3. mutex so lange läuft, bis der ladethread signalisiert, + // dass er alles geladen hat fertig ist + // + // dafür muss loadtexture so umgeschrieben werden, dass es, statt selbst irgendwelche + // opengl funktionen aufzurufen, entsprechend mutexe verändert + // der hauptthread muss auch irgendwoher erfahren, was an opengl funktionen auszuführen ist, + // mit welchen parametern (texturtyp, entspr. texturobjekt, textur-zwischenspeicher-adresse, ... + + + //wait for loading thread to finish + // funktioniert so auch noch nicht + //SDL_WaitThread(LoadingThread, I); +// SDL_DestroyMutex(Mutex); + + Display.ActualScreen^.FadeTo( @ScreenMain ); + + Log.BenchmarkEnd(2); + Log.LogBenchmark('--> Loading Screens', 2); + + Log.LogStatus('Finish', 'Initialize3D'); +end; + +procedure SwapBuffers; +begin + SDL_GL_SwapBuffers; + glMatrixMode(GL_PROJECTION); + glLoadIdentity; + glOrtho(0, RenderW, RenderH, 0, -1, 100); + glMatrixMode(GL_MODELVIEW); +end; + +procedure Reinitialize3D; +begin +// InitializeScreen; +// LoadTextures; +// LoadScreens; +end; + +procedure InitializeScreen; +var + S: string; + I: integer; + W, H: integer; + Depth: Integer; +begin + if (Params.Screens <> -1) then + Screens := Params.Screens + 1 + else + Screens := Ini.Screens + 1; + + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + + // If there is a resolution in Parameters, use it, else use the Ini value + I := Params.Resolution; + if (I <> -1) then + S := IResolution[I] + else + S := IResolution[Ini.Resolution]; + + I := Pos('x', S); + W := StrToInt(Copy(S, 1, I-1)) * Screens; + H := StrToInt(Copy(S, I+1, 1000)); + + {if ParamStr(1) = '-fsblack' then begin + W := 800; + H := 600; + end; + if ParamStr(1) = '-320x240' then begin + W := 320; + H := 240; + end; } + + If (Params.Depth <> -1) then + Depth := Params.Depth + else + Depth := Ini.Depth; + + + Log.LogStatus('SDL_SetVideoMode', 'Set Window Icon'); + +// Okay it's possible to set the title bar / taskbar icon here +// it's working this way, but just if the bmp is in your exe folder + SDL_WM_SetIcon(SDL_LoadBMP('ustar-icon.bmp'), 0); + + Log.LogStatus('SDL_SetVideoMode', 'Initialize3D'); +// SDL_SetRefreshrate(85); +// SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); + + {$ifndef win32} + // Todo : jb_linux remove this for linux... but helps for debugging + Ini.FullScreen := 0; + W := 800; + H := 600; + {$endif} + + if (Ini.FullScreen = 0) and (Not Params.FullScreen) then + begin + Log.LogStatus('SDL_SetVideoMode', 'Set Video Mode... Windowed'); + screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL) + end + else + begin + Log.LogStatus('SDL_SetVideoMode', 'Set Video Mode... Full Screen'); + screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN); + SDL_ShowCursor(0); + end; + + if (screen = nil) then + begin + Log.LogError('SDL_SetVideoMode Failed', 'Initialize3D'); + exit; + end; + + // clear screen once window is being shown + glClearColor(1, 1, 1, 1); + glClear(GL_COLOR_BUFFER_BIT); + SwapBuffers; + + // zmienne + RenderW := 800; + RenderH := 600; + ScreenW := W; + ScreenH := H; +end; + +procedure LoadLoadingScreen; +begin + ScreenLoading := TScreenLoading.Create; + ScreenLoading.onShow; + + Display.ActualScreen := @ScreenLoading; + + swapbuffers; + + ScreenLoading.Draw; + Display.Draw; + + SwapBuffers; +end; + +procedure LoadScreens; +begin +{ ScreenLoading := TScreenLoading.Create; + ScreenLoading.onShow; + Display.ActualScreen := @ScreenLoading; + ScreenLoading.Draw; + Display.Draw; + SwapBuffers; +} + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Loading', 3); Log.BenchmarkStart(3); +{ ScreenWelcome := TScreenWelcome.Create; //'BG', 4, 3); + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Welcome', 3); Log.BenchmarkStart(3);} + ScreenMain := TScreenMain.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Main', 3); Log.BenchmarkStart(3); + ScreenName := TScreenName.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Name', 3); Log.BenchmarkStart(3); + ScreenLevel := TScreenLevel.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Level', 3); Log.BenchmarkStart(3); + ScreenSong := TScreenSong.Create; + 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); + ScreenSing := TScreenSing.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing', 3); Log.BenchmarkStart(3); + ScreenScore := TScreenScore.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Score', 3); Log.BenchmarkStart(3); + ScreenTop5 := TScreenTop5.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Top5', 3); Log.BenchmarkStart(3); + ScreenOptions := TScreenOptions.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options', 3); Log.BenchmarkStart(3); + ScreenOptionsGame := TScreenOptionsGame.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Game', 3); Log.BenchmarkStart(3); + ScreenOptionsGraphics := TScreenOptionsGraphics.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Graphics', 3); Log.BenchmarkStart(3); + ScreenOptionsSound := TScreenOptionsSound.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Sound', 3); Log.BenchmarkStart(3); + ScreenOptionsLyrics := TScreenOptionsLyrics.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Lyrics', 3); Log.BenchmarkStart(3); + ScreenOptionsThemes := TScreenOptionsThemes.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Themes', 3); Log.BenchmarkStart(3); + ScreenOptionsRecord := TScreenOptionsRecord.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Record', 3); Log.BenchmarkStart(3); + ScreenOptionsAdvanced := TScreenOptionsAdvanced.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Advanced', 3); Log.BenchmarkStart(3); + ScreenEditSub := TScreenEditSub.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Sub', 3); Log.BenchmarkStart(3); + ScreenEdit := TScreenEdit.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit', 3); Log.BenchmarkStart(3); + ScreenEditConvert := TScreenEditConvert.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen EditConvert', 3); Log.BenchmarkStart(3); +// ScreenEditHeader := TScreenEditHeader.Create(Skin.ScoreBG); +// Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Header', 3); Log.BenchmarkStart(3); + ScreenOpen := TScreenOpen.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Open', 3); Log.BenchmarkStart(3); + ScreenSingModi := TScreenSingModi.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing with Modi support', 3); Log.BenchmarkStart(3); + ScreenSongMenu := TScreenSongMenu.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongMenu', 3); Log.BenchmarkStart(3); + ScreenSongJumpto := TScreenSongJumpto.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongJumpto', 3); Log.BenchmarkStart(3); + ScreenPopupCheck := TScreenPopupCheck.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Popup (Check)', 3); Log.BenchmarkStart(3); + ScreenPopupError := TScreenPopupError.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Popup (Error)', 3); Log.BenchmarkStart(3); + ScreenPartyNewRound := TScreenPartyNewRound.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyNewRound', 3); Log.BenchmarkStart(3); + ScreenPartyScore := TScreenPartyScore.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyScore', 3); Log.BenchmarkStart(3); + ScreenPartyWin := TScreenPartyWin.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyWin', 3); Log.BenchmarkStart(3); + ScreenPartyOptions := TScreenPartyOptions.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyOptions', 3); Log.BenchmarkStart(3); + ScreenPartyPlayer := TScreenPartyPlayer.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyPlayer', 3); Log.BenchmarkStart(3); + ScreenStatMain := TScreenStatMain.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Main', 3); Log.BenchmarkStart(3); + ScreenStatDetail := TScreenStatDetail.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Detail', 3); Log.BenchmarkStart(3); + ScreenCredits := TScreenCredits.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Credits', 3); Log.BenchmarkStart(3); + + end; + +function LoadingThreadFunction: integer; +begin + LoadScreens; + Result:= 1; +end; + +end. diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index 5d599eab..6b7f3cea 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -260,12 +260,22 @@ begin for Pet := 0 to High(IScreens) do if Tekst = IScreens[Pet] then Ini.Screens := Pet; + // FullScreen + Tekst := IniFile.ReadString('Graphics', 'FullScreen', 'On'); + for Pet := 0 to High(IFullScreen) do + if Tekst = IFullScreen[Pet] then Ini.FullScreen := Pet; + + // Resolution SetLength(IResolution, 0); Modes := SDL_ListModes(nil, SDL_OPENGL or SDL_FULLSCREEN); // Check if there are any modes available repeat SetLength(IResolution, Length(IResolution) + 1); IResolution[High(IResolution)] := IntToStr(Modes^.w) + 'x' + IntToStr(Modes^.h); + Tekst := IniFile.ReadString('Graphics', 'Screens', IScreens[0]); + + Log.LogStatus('SDL_ListModes Res : ' + IResolution[High(IResolution)], 'Graphics - Resolutions'); + Inc(Modes); until Modes^ = nil; @@ -274,8 +284,12 @@ begin // THANKS : linnex at users.sourceforge.net if Length(IResolution) < 1 then begin - SetLength(IResolution, Length(IResolution) + 1); - IResolution[High(IResolution)] := IntToStr(800) + 'x' + IntToStr(600); + SetLength(IResolution, Length(IResolution) + 1); + IResolution[High(IResolution)] := IntToStr(800) + 'x' + IntToStr(600); + Log.LogStatus('SDL_ListModes Defaulted Res To : ' + IResolution[High(IResolution)] , 'Graphics - Resolutions'); + + // Default to fullscreen OFF, in this case ! + Ini.FullScreen := 0; end; // reverse order @@ -289,10 +303,6 @@ begin for Pet := 0 to High(IResolution) do if Tekst = IResolution[Pet] then Ini.Resolution := Pet; - // FullScreen - Tekst := IniFile.ReadString('Graphics', 'FullScreen', 'On'); - for Pet := 0 to High(IFullScreen) do - if Tekst = IFullScreen[Pet] then Ini.FullScreen := Pet; // Resolution Tekst := IniFile.ReadString('Graphics', 'Depth', '32 bit'); diff --git a/Game/Code/Classes/ULyrics.pas b/Game/Code/Classes/ULyrics.pas index 1c2795ce..4fd360b7 100644 --- a/Game/Code/Classes/ULyrics.pas +++ b/Game/Code/Classes/ULyrics.pas @@ -1,544 +1,550 @@ -unit ULyrics; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -{$I switches.inc} - -uses OpenGL12, UTexture, UThemes, UMusic; - -type - TLyricWord = record - X: Real; //X Pos of the Word - Width: Real; //Width of the Text - TexPos: Real; //Pos of the Word (0 to 1) in the Sentence Texture - TexWidth: Real; //width of the Word in Sentence Texture (0 to 1) - Start: Cardinal; //Start of the Words in Quarters (Beats) - Length: Cardinal; //Length of the Word in Quarters - Text: String; //Text of this Word - Freestyle: Boolean; //Is this Word Freestyle - end; - ALyricWord = array of TLyricWord; - - PLyricLine = ^TLyricLine; - TLyricLine = record - Text: String; //Text of the Line - Tex: glUInt; //Texture of the Text from this Line - Width: Real; //Width of the Lyricline in Tex - Size: Byte; //Size of the Font in the Texture - Words: ALyricWord; //Words from this Line - Start: Cardinal; //Start in Quarters of teh Line - Length: Cardinal; //Length in Quarters (From Start of First Note to the End of Last Note) - Freestyle: Boolean; //Complete Line is Freestyle ? - Players: Byte; //Which Players Sing this Line (1: Player1; 2: Player2; 4: Player3; [..]) - Done: Boolean; //Is Sentence Sung - end; - - TLyricEngine = class - private - EoLastSentence: Real; //When did the Last Sentence End (in Beats) - UpperLine: TLyricLine; //Line in the Upper Part of the Lyric Display - LowerLine: TLyricLine; //Line in the Lower Part of teh Lyric Display - QueueLine: TLyricLine; //Line that is in Queue and will be added when next Line is Finished - PUpperLine, PLowerLine, PQueueLine: PLyricLine; - - IndicatorTex: TTexture; //Texture for Lyric Indikator(Bar that indicates when the Line start) - BallTex: TTexture; //Texture of the Ball for cur. Word hover in Ballmode - PlayerIconTex: array[0..5] of //Textures for PlayerIcon Index: Playernum; Index2: Enabled/Disabled - array [0..1] of - TTexture; - - inQueue: Boolean; - LCounter: Word; - - //Some helper Procedures for Lyric Drawing - procedure DrawLyrics (Beat: Real); - procedure DrawLyricsLine(const X, W, Y: Real; Size: Byte; const Line: TLyricLine; Beat: Real); - procedure DrawPlayerIcon(const Player: Byte; const Enabled: Boolean; const X, Y, Size, Alpha: Real); - public - //Positions, Line specific Settings - UpperLineX: Real; //X Start Pos of UpperLine - UpperLineW: Real; //Width of UpperLine with Icon(s) and Text - UpperLineY: Real; //Y Start Pos of UpperLine - UpperLineSize: Byte; //Max Size of Lyrics Text in UpperLine - - LowerLineX: Real; //X Start Pos of LowerLine - LowerLineW: Real; //Width of LowerLine with Icon(s) and Text - LowerLineY: Real; //Y Start Pos of LowerLine - LowerLineSize: Byte; //Max Size of Lyrics Text in LowerLine - - //Display Propertys - LineColor_en: TRGBA; //Color of Words in an Enabled Line - LineColor_dis: TRGBA; //Color of Words in a Disabled Line - LineColor_akt: TRGBA; //Color of teh active Word - FontStyle: Byte; //Font for the Lyric Text - FontReSize: Boolean; //ReSize Lyrics if they don't fit Screen - - HoverEffekt: Byte; //Effekt of Hovering active Word: 0 - one selection, 1 - long selection, 2 - one selection with fade to normal text, 3 - long selection with fade with color from left - FadeInEffekt: Byte; //Effekt for Line Fading in: 0: No Effekt; 1: Fade Effekt; 2: Move Upwards from Bottom to Pos - FadeOutEffekt: Byte; //Effekt for Line Fading out: 0: No Effekt; 1: Fade Effekt; 2: Move Upwards - - UseLinearFilter:Boolean; //Should Linear Tex Filter be used - - //Song specific Settings - BPM: Real; - Resolution: Integer; - - - //properties to easily update this Class within other Parts of Code - property LineinQueue: Boolean read inQueue; //True when there is a Line in Queue - property LineCounter: Word read LCounter; //Lines that was Progressed so far (after last Clear) - - Constructor Create; overload; //Constructor, just get Memory - Constructor Create(ULX,ULY,ULW,ULS,LLX,LLY,LLW,LLS:Real); overload; - Procedure LoadTextures; //Load Player Textures and Create - - Procedure AddLine(Line: PLine); //Adds a Line to the Queue if there is Space - Procedure Draw (Beat: Real); //Procedure Draws Lyrics; Beat is curent Beat in Quarters - Procedure Clear (const cBPM: Real = 0; const cResolution: Integer = 0); //Clears all cached Song specific Information - - Destructor Free; //Frees Memory - end; - -const LyricTexStart = 2/512; - -implementation -uses SysUtils, USkins, TextGL, UGraphic, UDisplay, dialogs; - -//----------- -//Helper procs to use TRGB in Opengl ...maybe this should be somewhere else -//----------- -procedure glColorRGB(Color: TRGB); overload; -begin - glColor3f(Color.R, Color.G, Color.B); -end; - -procedure glColorRGB(Color: TRGBA); overload; -begin - glColor4f(Color.R, Color.G, Color.B, Color.A); -end; - - - -//--------------- -// Create - Constructor, just get Memory -//--------------- -Constructor TLyricEngine.Create; -begin - BPM := 0; - Resolution := 0; - LCounter := 0; - inQueue := False; - - UpperLine.Done := True; - LowerLine.Done := True; - QueueLine.Done := True; - PUpperline:=@UpperLine; - PLowerLine:=@LowerLine; - PQueueLine:=@QueueLine; - - UseLinearFilter := True; -end; - -Constructor TLyricEngine.Create(ULX,ULY,ULW,ULS,LLX,LLY,LLW,LLS:Real); -begin - Create; - UpperLineX := ULX; - UpperLineW := ULW; - UpperLineY := ULY; - UpperLineSize := Trunc(ULS); - - LowerLineX := LLX; - LowerLineW := LLW; - LowerLineY := LLY; - LowerLineSize := Trunc(LLS); - LoadTextures; -end; - - -//--------------- -// Free - Frees Memory -//--------------- -Destructor TLyricEngine.Free; -begin - -end; - -//--------------- -// Clear - Clears all cached Song specific Information -//--------------- -Procedure TLyricEngine.Clear (const cBPM: Real; const cResolution: Integer); -begin - BPM := cBPM; - Resolution := cResolution; - LCounter := 0; - inQueue := False; - - UpperLine.Done := True; - LowerLine.Done := True; - QueueLine.Done := True; - - PUpperline:=@UpperLine; - PLowerLine:=@LowerLine; - PQueueLine:=@QueueLine; -end; - - -//--------------- -// LoadTextures - Load Player Textures and Create Lyric Textures -//--------------- -Procedure TLyricEngine.LoadTextures; -var - I: Integer; - PTexData: Pointer; - - function CreateLineTex: glUint; - begin - GetMem(pTexData, 1024*128*4); //get Memory to save Tex in - - //generate and bind Texture - glGenTextures(1, Result); - glBindTexture(GL_TEXTURE_2D, Result); - - //Get Memory - glTexImage2D(GL_TEXTURE_2D, 0, 4, 1024, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, pTexData); - - if UseLinearFilter then - begin - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - end; - - //Free now unused Memory - FreeMem(pTexData); - end; -begin - //Load Texture for Lyric Indikator(Bar that indicates when the Line start) - IndicatorTex := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricHelpBar')), 'BMP', 'Transparent', $FF00FF); - - //Load Texture of the Ball for cur. Word hover in Ballmode - BallTex := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'BMP', 'Transparent', $FF00FF); - - //Load PlayerTexs - For I := 0 to 1 do - begin - PlayerIconTex[I][0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIcon_P' + InttoStr(I+1))), 'PNG', 'Transparent', 0); - PlayerIconTex[I][1] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIconD_P' + InttoStr(I+1))), 'PNG', 'Transparent', 0); - end; - - //atm just unset other texs - For I := 2 to 5 do - begin - PlayerIconTex[I][0].TexNum := high(Cardinal); //Set to C's -1 - PlayerIconTex[I][1].TexNum := high(Cardinal); - end; - - //Create LineTexs - UpperLine.Tex := CreateLineTex; - LowerLine.Tex := CreateLineTex; - QueueLine.Tex := CreateLineTex; -end; - - -//--------------- -// AddLine - Adds LyricLine to queue -//--------------- -Procedure TLyricEngine.AddLine(Line: PLine); -var - LyricLine: PLyricLine; - I: Integer; - countNotes: Cardinal; - PosX: Real; - Viewport: Array[0..3] of Integer; -begin - //Only Add Lines if there is enough space - If not LineinQueue then - begin - //Set Pointer to Line to Write - If (LineCounter = 0) then - LyricLine := PUpperLine //Set Upper Line - else if (LineCounter = 1) then - LyricLine := PLowerLine //Set Lower Line - else - begin - LyricLine := PQueueLine; //Set Queue Line - inQueue := True; //now there is a Queued Line - end; - end - else - begin - LyricLine:=PUpperLine; - PUpperLine:=PLowerLine; - PLowerLine:=PQueueLine; - PQueueLine:=LyricLine; - end; - - //Check if Sentence has Notes - If (Length(Line.Nuta) > 0) then - begin - //Copy Values from SongLine to LyricLine - CountNotes := high(Line.Nuta); - LyricLine.Start := Line.Nuta[0].Start; - LyricLine.Length := Line.Nuta[CountNotes].Start + Line.Nuta[CountNotes].Dlugosc - LyricLine.Start; - LyricLine.Freestyle := True; //is set by And Notes Freestyle while copying Notes - LyricLine.Text := ''; //Also Set while copying Notes - LyricLine.Players := 127; //All Players for now, no Duett Mode available - //Copy Words - SetLength(LyricLine.Words, CountNotes + 1); - For I := 0 to CountNotes do - begin - LyricLine.Freestyle := LyricLine.Freestyle AND Line.Nuta[I].FreeStyle; - LyricLine.Words[I].Start := Line.Nuta[I].Start; - LyricLine.Words[I].Length := Line.Nuta[I].Dlugosc; - LyricLine.Words[I].Text := Line.Nuta[I].Tekst; - LyricLine.Words[I].Freestyle := Line.Nuta[I].FreeStyle; - LyricLine.Text := LyricLine.Text + LyricLine.Words[I].Text - end; - - //Set Font Params - SetFontStyle(FontStyle); - SetFontPos(0, 0); - LyricLine.Size := UpperLineSize; - SetFontSize(LyricLine.Size); - SetFontItalic(False); - glColor4f(1, 1, 1, 1); - - //Change Fontsize to Fit the Screen - While (LyricLine.Width > 508) do - begin - Dec(LyricLine.Size); - - if (LyricLine.Size <=1) then - Break; - - SetFontSize(LyricLine.Size); - LyricLine.Width := glTextWidth(PChar(LyricLine.Text)); - end; - - //Set Word Positions and Line Size - PosX := 2 {LowerLineX + LowerLineW/2 + 80 - LyricLine.Width/2}; - For I := 0 to High(LyricLine.Words) do - begin - LyricLine.Words[I].X := PosX; - LyricLine.Words[I].Width := glTextWidth(PChar(LyricLine.Words[I].Text)); - LyricLine.Words[I].TexPos := PosX / 512; - LyricLine.Words[I].TexWidth := LyricLine.Words[I].TexWidth / 512; - - PosX := PosX + LyricLine.Words[I].Width; - end; - - //Create LyricTexture - //Prepare Ogl - glGetIntegerv(GL_VIEWPORT, @ViewPort); - glClearColor(0.0,0.0,0.0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - {glMatrixMode(GL_PROJECTION); - glLoadIdentity; - glOrtho(0, 1024, 64, 0, -1, 100); - glMatrixMode(GL_MODELVIEW);} - glViewport(0, 0, 512, 512); - - //Draw Lyrics - SetFontPos(0, 0); - glPrint(PChar(LyricLine.Text)); - - Display.ScreenShot; - //Copy to Texture - glBindTexture(GL_TEXTURE_2D, LyricLine.Tex); - glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 448, 512, 64, 0); - - //Clear Buffer - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - - glViewPort(ViewPort[0], ViewPort[1], ViewPort[2], ViewPort[3]); - {glMatrixMode(GL_PROJECTION); - glLoadIdentity; - glOrtho(0, RenderW, RenderH, 0, -1, 100); - glMatrixMode(GL_MODELVIEW); } - end; - - //Increase the Counter - Inc(LCounter); -end; - - -//--------------- -// Draw - Procedure Draws Lyrics; Beat is curent Beat in Quarters -// Draw just manage the Lyrics, drawing is done by a call of DrawLyrics -//--------------- -Procedure TLyricEngine.Draw (Beat: Real); -begin - - DrawLyrics(Beat); - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_Alpha {GL_ONE_MINUS_SRC_COLOR}, GL_ONE_MINUS_SRC_Alpha); - glBindTexture(GL_TEXTURE_2D, PUpperLine^.Tex); - - glColor4f(1,1,0,1); - glBegin(GL_QUADS); - glTexCoord2f(0, 1); glVertex2f(100, 100); - glTexCoord2f(0, 0); glVertex2f(100, 200); - glTexCoord2f(1, 0); glVertex2f(612, 200); - glTexCoord2f(1, 1); glVertex2f(612, 100); - glEnd; - - glBindTexture(GL_TEXTURE_2D, PLowerLine^.Tex); - - glColor4f(1,0,1,1); - glBegin(GL_QUADS); - glTexCoord2f(0, 1); glVertex2f(100, 200); - glTexCoord2f(0, 0); glVertex2f(100, 300); - glTexCoord2f(1, 0); glVertex2f(612, 300); - glTexCoord2f(1, 1); glVertex2f(612, 200); - glEnd; - - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - -end; - -//--------------- -// DrawLyrics(private) - Helper for Draw; main Drawing procedure -//--------------- -procedure TLyricEngine.DrawLyrics (Beat: Real); -begin - DrawLyricsLine(UpperLineX, UpperLineW, UpperlineY, 15, Upperline, Beat); - DrawLyricsLine(LowerLineX, LowerLineW, LowerlineY, 15, Lowerline, Beat); -end; - -//--------------- -// DrawPlayerIcon(private) - Helper for Draw; Draws a Playericon -//--------------- -procedure TLyricEngine.DrawPlayerIcon(const Player: Byte; const Enabled: Boolean; const X, Y, Size, Alpha: Real); -var IEnabled: Byte; -begin - Case Enabled of - True: IEnabled := 0; - False: IEnabled:= 1; - end; - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, PlayerIconTex[Player][IEnabled].TexNum); - - glColor4f(1,1,1,Alpha); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(X, Y); - glTexCoord2f(0, 1); glVertex2f(X, Y + Size); - glTexCoord2f(1, 1); glVertex2f(X + Size, Y + Size); - glTexCoord2f(1, 0); glVertex2f(X + Size, Y); - glEnd; - - - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); -end; -//--------------- -// DrawLyricsLine(private) - Helper for Draw; Draws one LyricLine -//--------------- -procedure TLyricEngine.DrawLyricsLine(const X, W, Y: Real; Size: Byte; const Line: TLyricLine; Beat: Real); -var - I: Integer; - CurWord: Integer; - Progress: Real; - LyricX: Real; //Left Corner on X Axis - LyricX2: Real;//Right Corner " " - LyricScale: Real; //Up or Downscale the Lyrics need - IconSize: Real; - IconAlpha: Real; -begin - -{ For I := 0 to High(Line.Words) do - begin - //Set Font Params - SetFontStyle(FontStyle); - SetFontSize(Size); - SetFontItalic(Line.Words[I].Freestyle); - glColor4f(1, 1, 1, 1); - - SetFontPos(Line.Words[I].X, Y); - - glPrint(PChar(Line.Words[I].Text)); - end; } - - LyricScale := Size / Line.Size; - - //Draw Icons - IconSize := (2 * Size); - //IconAlpha := 1; - IconAlpha := Frac(Beat/(Resolution*4)); - - {DrawPlayerIcon (0, True, X, Y, IconSize, IconAlpha); - DrawPlayerIcon (1, True, X + IconSize + 1, Y, IconSize, IconAlpha); - DrawPlayerIcon (2, True, X + (IconSize + 1)*2, Y, IconSize, IconAlpha);} - - //Check if a Word in the Sentence is active - if ((Line.Start > Beat) AND (Line.Start + Line.Length < Beat)) then - begin - //Get Start Position: - { Start of Line - Width of all Icons + LineWidth/2 (Center} - LyricX := X + (W - ((IconSize + 1) * 6))/2 + ((IconSize + 1) * 3); - - LyricX2 := LyricX + Line.Width; - - //Draw complete Sentence - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_COLOR {GL_ONE_MINUS_SRC_COLOR}, GL_ONE_MINUS_SRC_COLOR); - glBindTexture(GL_TEXTURE_2D, Line.Tex); - - glColorRGB(LineColor_en); - glBegin(GL_QUADS); - glTexCoord2f(0, 1); glVertex2f(LyricX, Y); - glTexCoord2f(0, 0); glVertex2f(LyricX, Y + 64 * W / 512); - glTexCoord2f(1, 0); glVertex2f(LyricX + LyricX2, Y + 64 * W / 512); - glTexCoord2f(1, 1); glVertex2f(LyricX + LyricX2, Y); - glEnd; - - - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - end - else - begin - - end; - - {//Search for active Word - For I := 0 to High(Line.Words) do - if (Line.Words[I].Start < Beat) then - begin - CurWord := I - 1; - end; - - if (CurWord < 0) then Exit; - - //Draw Part until cur Word - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_COLOR {GL_ONE_MINUS_SRC_COLOR}{, GL_ONE_MINUS_SRC_COLOR); - glBindTexture(GL_TEXTURE_2D, Line.Tex); - - glColorRGB(LineColor_en); - glBegin(GL_QUADS); - glTexCoord2f(0, 1); glVertex2f(X, Y); - glTexCoord2f(0, 0); glVertex2f(X, Y + 64 * W / 512); - glTexCoord2f(Line.Words[CurWord].TexPos, 0); glVertex2f(X + W, Y + 64 * W / 512); - glTexCoord2f(Line.Words[CurWord].TexPos, 1); glVertex2f(X + W, Y); - glEnd; - - - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D);} -end; - - -end. - +unit ULyrics; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +{$I switches.inc} + +uses OpenGL12, UTexture, UThemes, UMusic; + +type + TLyricWord = record + X: Real; //X Pos of the Word + Width: Real; //Width of the Text + TexPos: Real; //Pos of the Word (0 to 1) in the Sentence Texture + TexWidth: Real; //width of the Word in Sentence Texture (0 to 1) + Start: Cardinal; //Start of the Words in Quarters (Beats) + Length: Cardinal; //Length of the Word in Quarters + Text: String; //Text of this Word + Freestyle: Boolean; //Is this Word Freestyle + end; + ALyricWord = array of TLyricWord; + + PLyricLine = ^TLyricLine; + TLyricLine = record + Text: String; //Text of the Line + Tex: glUInt; //Texture of the Text from this Line + Width: Real; //Width of the Lyricline in Tex + Size: Byte; //Size of the Font in the Texture + Words: ALyricWord; //Words from this Line + Start: Cardinal; //Start in Quarters of teh Line + Length: Cardinal; //Length in Quarters (From Start of First Note to the End of Last Note) + Freestyle: Boolean; //Complete Line is Freestyle ? + Players: Byte; //Which Players Sing this Line (1: Player1; 2: Player2; 4: Player3; [..]) + Done: Boolean; //Is Sentence Sung + end; + + TLyricEngine = class + private + EoLastSentence: Real; //When did the Last Sentence End (in Beats) + UpperLine: TLyricLine; //Line in the Upper Part of the Lyric Display + LowerLine: TLyricLine; //Line in the Lower Part of teh Lyric Display + QueueLine: TLyricLine; //Line that is in Queue and will be added when next Line is Finished + PUpperLine, PLowerLine, PQueueLine: PLyricLine; + + IndicatorTex: TTexture; //Texture for Lyric Indikator(Bar that indicates when the Line start) + BallTex: TTexture; //Texture of the Ball for cur. Word hover in Ballmode + PlayerIconTex: array[0..5] of //Textures for PlayerIcon Index: Playernum; Index2: Enabled/Disabled + array [0..1] of + TTexture; + + inQueue: Boolean; + LCounter: Word; + + //Some helper Procedures for Lyric Drawing + procedure DrawLyrics (Beat: Real); + procedure DrawLyricsLine(const X, W, Y: Real; Size: Byte; const Line: TLyricLine; Beat: Real); + procedure DrawPlayerIcon(const Player: Byte; const Enabled: Boolean; const X, Y, Size, Alpha: Real); + public + //Positions, Line specific Settings + UpperLineX: Real; //X Start Pos of UpperLine + UpperLineW: Real; //Width of UpperLine with Icon(s) and Text + UpperLineY: Real; //Y Start Pos of UpperLine + UpperLineSize: Byte; //Max Size of Lyrics Text in UpperLine + + LowerLineX: Real; //X Start Pos of LowerLine + LowerLineW: Real; //Width of LowerLine with Icon(s) and Text + LowerLineY: Real; //Y Start Pos of LowerLine + LowerLineSize: Byte; //Max Size of Lyrics Text in LowerLine + + //Display Propertys + LineColor_en: TRGBA; //Color of Words in an Enabled Line + LineColor_dis: TRGBA; //Color of Words in a Disabled Line + LineColor_akt: TRGBA; //Color of teh active Word + FontStyle: Byte; //Font for the Lyric Text + FontReSize: Boolean; //ReSize Lyrics if they don't fit Screen + + HoverEffekt: Byte; //Effekt of Hovering active Word: 0 - one selection, 1 - long selection, 2 - one selection with fade to normal text, 3 - long selection with fade with color from left + FadeInEffekt: Byte; //Effekt for Line Fading in: 0: No Effekt; 1: Fade Effekt; 2: Move Upwards from Bottom to Pos + FadeOutEffekt: Byte; //Effekt for Line Fading out: 0: No Effekt; 1: Fade Effekt; 2: Move Upwards + + UseLinearFilter:Boolean; //Should Linear Tex Filter be used + + //Song specific Settings + BPM: Real; + Resolution: Integer; + + + //properties to easily update this Class within other Parts of Code + property LineinQueue: Boolean read inQueue; //True when there is a Line in Queue + property LineCounter: Word read LCounter; //Lines that was Progressed so far (after last Clear) + + Constructor Create; overload; //Constructor, just get Memory + Constructor Create(ULX,ULY,ULW,ULS,LLX,LLY,LLW,LLS:Real); overload; + Procedure LoadTextures; //Load Player Textures and Create + + Procedure AddLine(Line: PLine); //Adds a Line to the Queue if there is Space + Procedure Draw (Beat: Real); //Procedure Draws Lyrics; Beat is curent Beat in Quarters + Procedure Clear (const cBPM: Real = 0; const cResolution: Integer = 0); //Clears all cached Song specific Information + + Destructor Free; //Frees Memory + end; + +const LyricTexStart = 2/512; + +implementation + +uses SysUtils, + USkins, + TextGL, + UGraphic, + UDisplay, + dialogs; + +//----------- +//Helper procs to use TRGB in Opengl ...maybe this should be somewhere else +//----------- +procedure glColorRGB(Color: TRGB); overload; +begin + glColor3f(Color.R, Color.G, Color.B); +end; + +procedure glColorRGB(Color: TRGBA); overload; +begin + glColor4f(Color.R, Color.G, Color.B, Color.A); +end; + + + +//--------------- +// Create - Constructor, just get Memory +//--------------- +Constructor TLyricEngine.Create; +begin + BPM := 0; + Resolution := 0; + LCounter := 0; + inQueue := False; + + UpperLine.Done := True; + LowerLine.Done := True; + QueueLine.Done := True; + PUpperline:=@UpperLine; + PLowerLine:=@LowerLine; + PQueueLine:=@QueueLine; + + UseLinearFilter := True; +end; + +Constructor TLyricEngine.Create(ULX,ULY,ULW,ULS,LLX,LLY,LLW,LLS:Real); +begin + Create; + UpperLineX := ULX; + UpperLineW := ULW; + UpperLineY := ULY; + UpperLineSize := Trunc(ULS); + + LowerLineX := LLX; + LowerLineW := LLW; + LowerLineY := LLY; + LowerLineSize := Trunc(LLS); + LoadTextures; +end; + + +//--------------- +// Free - Frees Memory +//--------------- +Destructor TLyricEngine.Free; +begin + +end; + +//--------------- +// Clear - Clears all cached Song specific Information +//--------------- +Procedure TLyricEngine.Clear (const cBPM: Real; const cResolution: Integer); +begin + BPM := cBPM; + Resolution := cResolution; + LCounter := 0; + inQueue := False; + + UpperLine.Done := True; + LowerLine.Done := True; + QueueLine.Done := True; + + PUpperline:=@UpperLine; + PLowerLine:=@LowerLine; + PQueueLine:=@QueueLine; +end; + + +//--------------- +// LoadTextures - Load Player Textures and Create Lyric Textures +//--------------- +Procedure TLyricEngine.LoadTextures; +var + I: Integer; + PTexData: Pointer; + + function CreateLineTex: glUint; + begin + GetMem(pTexData, 1024*128*4); //get Memory to save Tex in + + //generate and bind Texture + glGenTextures(1, @Result); + glBindTexture(GL_TEXTURE_2D, Result); + + //Get Memory + glTexImage2D(GL_TEXTURE_2D, 0, 4, 1024, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, pTexData); + + if UseLinearFilter then + begin + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + end; + + //Free now unused Memory + FreeMem(pTexData); + end; +begin + //Load Texture for Lyric Indikator(Bar that indicates when the Line start) + IndicatorTex := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricHelpBar')), 'BMP', 'Transparent', $FF00FF); + + //Load Texture of the Ball for cur. Word hover in Ballmode + BallTex := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'BMP', 'Transparent', $FF00FF); + + //Load PlayerTexs + For I := 0 to 1 do + begin + PlayerIconTex[I][0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIcon_P' + InttoStr(I+1))), 'PNG', 'Transparent', 0); + PlayerIconTex[I][1] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIconD_P' + InttoStr(I+1))), 'PNG', 'Transparent', 0); + end; + + //atm just unset other texs + For I := 2 to 5 do + begin + PlayerIconTex[I][0].TexNum := high(Cardinal); //Set to C's -1 + PlayerIconTex[I][1].TexNum := high(Cardinal); + end; + + //Create LineTexs + UpperLine.Tex := CreateLineTex; + LowerLine.Tex := CreateLineTex; + QueueLine.Tex := CreateLineTex; +end; + + +//--------------- +// AddLine - Adds LyricLine to queue +//--------------- +Procedure TLyricEngine.AddLine(Line: PLine); +var + LyricLine: PLyricLine; + I: Integer; + countNotes: Cardinal; + PosX: Real; + Viewport: Array[0..3] of Integer; +begin + //Only Add Lines if there is enough space + If not LineinQueue then + begin + //Set Pointer to Line to Write + If (LineCounter = 0) then + LyricLine := PUpperLine //Set Upper Line + else if (LineCounter = 1) then + LyricLine := PLowerLine //Set Lower Line + else + begin + LyricLine := PQueueLine; //Set Queue Line + inQueue := True; //now there is a Queued Line + end; + end + else + begin + LyricLine:=PUpperLine; + PUpperLine:=PLowerLine; + PLowerLine:=PQueueLine; + PQueueLine:=LyricLine; + end; + + //Check if Sentence has Notes + If (Length(Line.Nuta) > 0) then + begin + //Copy Values from SongLine to LyricLine + CountNotes := high(Line.Nuta); + LyricLine.Start := Line.Nuta[0].Start; + LyricLine.Length := Line.Nuta[CountNotes].Start + Line.Nuta[CountNotes].Dlugosc - LyricLine.Start; + LyricLine.Freestyle := True; //is set by And Notes Freestyle while copying Notes + LyricLine.Text := ''; //Also Set while copying Notes + LyricLine.Players := 127; //All Players for now, no Duett Mode available + //Copy Words + SetLength(LyricLine.Words, CountNotes + 1); + For I := 0 to CountNotes do + begin + LyricLine.Freestyle := LyricLine.Freestyle AND Line.Nuta[I].FreeStyle; + LyricLine.Words[I].Start := Line.Nuta[I].Start; + LyricLine.Words[I].Length := Line.Nuta[I].Dlugosc; + LyricLine.Words[I].Text := Line.Nuta[I].Tekst; + LyricLine.Words[I].Freestyle := Line.Nuta[I].FreeStyle; + LyricLine.Text := LyricLine.Text + LyricLine.Words[I].Text + end; + + //Set Font Params + SetFontStyle(FontStyle); + SetFontPos(0, 0); + LyricLine.Size := UpperLineSize; + SetFontSize(LyricLine.Size); + SetFontItalic(False); + glColor4f(1, 1, 1, 1); + + //Change Fontsize to Fit the Screen + While (LyricLine.Width > 508) do + begin + Dec(LyricLine.Size); + + if (LyricLine.Size <=1) then + Break; + + SetFontSize(LyricLine.Size); + LyricLine.Width := glTextWidth(PChar(LyricLine.Text)); + end; + + //Set Word Positions and Line Size + PosX := 2 {LowerLineX + LowerLineW/2 + 80 - LyricLine.Width/2}; + For I := 0 to High(LyricLine.Words) do + begin + LyricLine.Words[I].X := PosX; + LyricLine.Words[I].Width := glTextWidth(PChar(LyricLine.Words[I].Text)); + LyricLine.Words[I].TexPos := PosX / 512; + LyricLine.Words[I].TexWidth := LyricLine.Words[I].TexWidth / 512; + + PosX := PosX + LyricLine.Words[I].Width; + end; + + //Create LyricTexture + //Prepare Ogl + glGetIntegerv(GL_VIEWPORT, @ViewPort); + glClearColor(0.0,0.0,0.0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + {glMatrixMode(GL_PROJECTION); + glLoadIdentity; + glOrtho(0, 1024, 64, 0, -1, 100); + glMatrixMode(GL_MODELVIEW);} + glViewport(0, 0, 512, 512); + + //Draw Lyrics + SetFontPos(0, 0); + glPrint(PChar(LyricLine.Text)); + + Display.ScreenShot; + //Copy to Texture + glBindTexture(GL_TEXTURE_2D, LyricLine.Tex); + glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 448, 512, 64, 0); + + //Clear Buffer + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + glViewPort(ViewPort[0], ViewPort[1], ViewPort[2], ViewPort[3]); + {glMatrixMode(GL_PROJECTION); + glLoadIdentity; + glOrtho(0, RenderW, RenderH, 0, -1, 100); + glMatrixMode(GL_MODELVIEW); } + end; + + //Increase the Counter + Inc(LCounter); +end; + + +//--------------- +// Draw - Procedure Draws Lyrics; Beat is curent Beat in Quarters +// Draw just manage the Lyrics, drawing is done by a call of DrawLyrics +//--------------- +Procedure TLyricEngine.Draw (Beat: Real); +begin + + DrawLyrics(Beat); + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_Alpha {GL_ONE_MINUS_SRC_COLOR}, GL_ONE_MINUS_SRC_Alpha); + glBindTexture(GL_TEXTURE_2D, PUpperLine^.Tex); + + glColor4f(1,1,0,1); + glBegin(GL_QUADS); + glTexCoord2f(0, 1); glVertex2f(100, 100); + glTexCoord2f(0, 0); glVertex2f(100, 200); + glTexCoord2f(1, 0); glVertex2f(612, 200); + glTexCoord2f(1, 1); glVertex2f(612, 100); + glEnd; + + glBindTexture(GL_TEXTURE_2D, PLowerLine^.Tex); + + glColor4f(1,0,1,1); + glBegin(GL_QUADS); + glTexCoord2f(0, 1); glVertex2f(100, 200); + glTexCoord2f(0, 0); glVertex2f(100, 300); + glTexCoord2f(1, 0); glVertex2f(612, 300); + glTexCoord2f(1, 1); glVertex2f(612, 200); + glEnd; + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + +end; + +//--------------- +// DrawLyrics(private) - Helper for Draw; main Drawing procedure +//--------------- +procedure TLyricEngine.DrawLyrics (Beat: Real); +begin + DrawLyricsLine(UpperLineX, UpperLineW, UpperlineY, 15, Upperline, Beat); + DrawLyricsLine(LowerLineX, LowerLineW, LowerlineY, 15, Lowerline, Beat); +end; + +//--------------- +// DrawPlayerIcon(private) - Helper for Draw; Draws a Playericon +//--------------- +procedure TLyricEngine.DrawPlayerIcon(const Player: Byte; const Enabled: Boolean; const X, Y, Size, Alpha: Real); +var IEnabled: Byte; +begin + Case Enabled of + True: IEnabled := 0; + False: IEnabled:= 1; + end; + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, PlayerIconTex[Player][IEnabled].TexNum); + + glColor4f(1,1,1,Alpha); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(X, Y); + glTexCoord2f(0, 1); glVertex2f(X, Y + Size); + glTexCoord2f(1, 1); glVertex2f(X + Size, Y + Size); + glTexCoord2f(1, 0); glVertex2f(X + Size, Y); + glEnd; + + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); +end; +//--------------- +// DrawLyricsLine(private) - Helper for Draw; Draws one LyricLine +//--------------- +procedure TLyricEngine.DrawLyricsLine(const X, W, Y: Real; Size: Byte; const Line: TLyricLine; Beat: Real); +var + I: Integer; + CurWord: Integer; + Progress: Real; + LyricX: Real; //Left Corner on X Axis + LyricX2: Real;//Right Corner " " + LyricScale: Real; //Up or Downscale the Lyrics need + IconSize: Real; + IconAlpha: Real; +begin + +{ For I := 0 to High(Line.Words) do + begin + //Set Font Params + SetFontStyle(FontStyle); + SetFontSize(Size); + SetFontItalic(Line.Words[I].Freestyle); + glColor4f(1, 1, 1, 1); + + SetFontPos(Line.Words[I].X, Y); + + glPrint(PChar(Line.Words[I].Text)); + end; } + + LyricScale := Size / Line.Size; + + //Draw Icons + IconSize := (2 * Size); + //IconAlpha := 1; + IconAlpha := Frac(Beat/(Resolution*4)); + + {DrawPlayerIcon (0, True, X, Y, IconSize, IconAlpha); + DrawPlayerIcon (1, True, X + IconSize + 1, Y, IconSize, IconAlpha); + DrawPlayerIcon (2, True, X + (IconSize + 1)*2, Y, IconSize, IconAlpha);} + + //Check if a Word in the Sentence is active + if ((Line.Start > Beat) AND (Line.Start + Line.Length < Beat)) then + begin + //Get Start Position: + { Start of Line - Width of all Icons + LineWidth/2 (Center} + LyricX := X + (W - ((IconSize + 1) * 6))/2 + ((IconSize + 1) * 3); + + LyricX2 := LyricX + Line.Width; + + //Draw complete Sentence + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_COLOR {GL_ONE_MINUS_SRC_COLOR}, GL_ONE_MINUS_SRC_COLOR); + glBindTexture(GL_TEXTURE_2D, Line.Tex); + + glColorRGB(LineColor_en); + glBegin(GL_QUADS); + glTexCoord2f(0, 1); glVertex2f(LyricX, Y); + glTexCoord2f(0, 0); glVertex2f(LyricX, Y + 64 * W / 512); + glTexCoord2f(1, 0); glVertex2f(LyricX + LyricX2, Y + 64 * W / 512); + glTexCoord2f(1, 1); glVertex2f(LyricX + LyricX2, Y); + glEnd; + + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + end + else + begin + + end; + + {//Search for active Word + For I := 0 to High(Line.Words) do + if (Line.Words[I].Start < Beat) then + begin + CurWord := I - 1; + end; + + if (CurWord < 0) then Exit; + + //Draw Part until cur Word + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_COLOR {GL_ONE_MINUS_SRC_COLOR}{, GL_ONE_MINUS_SRC_COLOR); + glBindTexture(GL_TEXTURE_2D, Line.Tex); + + glColorRGB(LineColor_en); + glBegin(GL_QUADS); + glTexCoord2f(0, 1); glVertex2f(X, Y); + glTexCoord2f(0, 0); glVertex2f(X, Y + 64 * W / 512); + glTexCoord2f(Line.Words[CurWord].TexPos, 0); glVertex2f(X + W, Y + 64 * W / 512); + glTexCoord2f(Line.Words[CurWord].TexPos, 1); glVertex2f(X + W, Y); + glEnd; + + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D);} +end; + + +end. + diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 66e1d07e..aa4bc639 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -1,791 +1,793 @@ -unit UMain; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses - SDL, - UGraphic, - UMusic, - URecord, - UTime, - SysUtils, - UDisplay, - UIni, - ULog, - ULyrics, - UScreenSing, - OpenGL12, - {$IFDEF UseSerialPort} - zlportio {you can disable it and all PortWriteB calls}, - {$ENDIF} - ULCD, - ULight, - UThemes; - -type - TPlayer = record - Name: string; - - Score: real; - ScoreLine: real; - ScoreGolden: real; - - ScoreI: integer; - ScoreLineI: integer; - ScoreGoldenI: integer; - ScoreTotalI: integer; - - - - //LineBonus Mod - ScoreLast: Real;//Last Line Score - {ScorePercent: integer;//Aktual Fillstate of the SingBar - ScorePercentTarget: integer;//Target Fillstate of the SingBar - //end Singbar Mod - - //PhrasenBonus - Line Bonus Mod - LineBonus_PosX: Single; - LineBonus_PosY: Single; - LineBonus_Alpha: Single; - LineBonus_Visible: boolean; - LineBonus_Text: string; - LineBonus_Color: TRGB; - LineBonus_Age: Integer; - LineBonus_Rating: Integer; - //Variable vor Positioning -> Set on ScreenShow, different when Playercount Changes - LineBonus_TargetX: integer; - LineBonus_TargetY: integer; - LineBonus_StartX: integer; - LineBonus_StartY: integer; - //PhrasenBonus - Line Bonus Mod End } - - - //PerfectLineTwinkle Mod (effect) - LastSentencePerfect: Boolean; - //PerfectLineTwinkle Mod end - - -// Meter: real; - - HighNut: integer; - IlNut: integer; - Nuta: array of record - Start: integer; - Dlugosc: integer; - Detekt: real; // dokladne miejsce, w ktorym wykryto ta nute - Ton: real; - Perfect: boolean; // true if the note matches the original one, lit the star - - - - // Half size Notes Patch - Hit: boolean; // true if the note Hits the Line - //end Half size Notes Patch - - - - end; - end; - - -var - //Absolute Paths - GamePath: string; - SoundPath: string; - SongPath: string; - LogPath: string; - ThemePath: string; - ScreenshotsPath: string; - CoversPath: string; - LanguagesPath: string; - PluginPath: string; - PlayListPath: string; - - OGL: Boolean; - Done: Boolean; - Event: TSDL_event; - FileName: string; - Restart: boolean; - - // gracz i jego nuty - Player: array of TPlayer; - PlayersPlay: integer; - -procedure InitializePaths; - -procedure MainLoop; -procedure CheckEvents; -procedure Sing(Sender: TScreenSing); -procedure NewSentence(Sender: TScreenSing); -procedure NewBeat(Sender: TScreenSing); // executed when on then new beat -procedure NewBeatC(Sender: TScreenSing); // executed when on then new beat for click -procedure NewBeatD(Sender: TScreenSing); // executed when on then new beat for detection -//procedure NewHalf; // executed when in the half between beats -procedure NewNote(Sender: TScreenSing); // detect note -function GetMidBeat(Time: real): real; -function GetTimeFromBeat(Beat: integer): real; -procedure ClearScores(PlayerNum: integer); - -implementation -uses USongs, UJoystick, math, UCommandLine; - -procedure MainLoop; -var - Delay: integer; -begin - SDL_EnableKeyRepeat(125, 125); - While not Done do - Begin - // joypad - if (Ini.Joypad = 1) OR (Params.Joypad) then - Joy.Update; - - // keyboard events - CheckEvents; - - // display - done := not Display.Draw; - SwapBuffers; - - // light - Light.Refresh; - - // delay - CountMidTime; -// if 1000*TimeMid > 100 then beep; - Delay := Floor(1000 / 100 - 1000 * TimeMid); - if Delay >= 1 then - SDL_Delay(Delay); // dynamic, maximum is 100 fps - CountSkipTime; - - // reinitialization of graphics - if Restart then begin - Reinitialize3D; - Restart := false; - end; - - End; - UnloadOpenGL; -End; - -Procedure CheckEvents; -//var -// p: pointer; -Begin - if not Assigned(Display.NextScreen) then - While SDL_PollEvent( @event ) = 1 Do - Begin -// beep; - Case Event.type_ Of - SDL_QUITEV: begin - Display.Fade := 0; - Display.NextScreenWithCheck := nil; - Display.CheckOK := True; - end; -{ SDL_MOUSEBUTTONDOWN: - With Event.button Do - Begin - If State = SDL_BUTTON_LEFT Then - Begin - // - End; - End; // With} - SDL_KEYDOWN: - begin - //ScreenShot hack. If Print is pressed-> Make screenshot and Save to Screenshots Path - if (Event.key.keysym.sym = SDLK_SYSREQ) then - Display.ScreenShot - - // popup hack... if there is a visible popup then let it handle input instead of underlying screen - // shoud be done in a way to be sure the topmost popup has preference (maybe error, then check) - else if (ScreenPopupError <> NIL) and (ScreenPopupError.Visible) then - done := not ScreenPopupError.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) - else if (ScreenPopupCheck <> NIL) AND (ScreenPopupCheck.Visible) then - done := not ScreenPopupCheck.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) - // end of popup hack - - else - begin - // check for Screen want to Exit - done := Not Display.ActualScreen^.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True); - - //If Screen wants to Exit - if done then - begin - //If Question Option is enabled then Show Exit Popup - if (Ini.AskbeforeDel = 1) then - begin - Display.ActualScreen^.CheckFadeTo(NIL,'MSG_QUIT_USDX'); - end - else //When asking for exit is disabled then simply exit - begin - Display.Fade := 0; - Display.NextScreenWithCheck := nil; - Display.CheckOK := True; - end; - end; - - end; // if (Not Display.ActualScreen^.ParseInput(Event.key.keysym.scancode, True)) then - end; -// SDL_JOYAXISMOTION: -// begin -// beep -// end; - SDL_JOYBUTTONDOWN: - begin - beep - end; - End; // Case Event.type_ - End; // While -End; // CheckEvents - -function GetTimeForBeats(BPM, Beats: real): real; -begin - Result := 60 / BPM * Beats; -end; - -function GetBeats(BPM, msTime: real): real; -begin - Result := BPM * msTime / 60; -end; - -procedure GetMidBeatSub(BPMNum: integer; var Time: real; var CurBeat: real); -var - NewTime: real; -begin - if High(AktSong.BPM) = BPMNum then begin - // last BPM - CurBeat := AktSong.BPM[BPMNum].StartBeat + GetBeats(AktSong.BPM[BPMNum].BPM, Time); - Time := 0; - end else begin - // not last BPM - // count how much time is it for start of the new BPM and store it in NewTime - NewTime := GetTimeForBeats(AktSong.BPM[BPMNum].BPM, AktSong.BPM[BPMNum+1].StartBeat - AktSong.BPM[BPMNum].StartBeat); - - // compare it to remaining time - if (Time - NewTime) > 0 then begin - // there is still remaining time - CurBeat := AktSong.BPM[BPMNum].StartBeat; - Time := Time - NewTime; - end else begin - // there is no remaining time - CurBeat := AktSong.BPM[BPMNum].StartBeat + GetBeats(AktSong.BPM[BPMNum].BPM, Time); - Time := 0; - end; // if - end; // if -end; - -function GetMidBeat(Time: real): real; -var - CurBeat: real; - CurBPM: integer; -// TopBeat: real; -// TempBeat: real; -// TempTime: real; -begin - Result := 0; - if Length(AktSong.BPM) = 1 then Result := Time * AktSong.BPM[0].BPM / 60; - - (* 2 BPMs *) -{ if Length(AktSong.BPM) > 1 then begin - (* new system *) - CurBeat := 0; - TopBeat := GetBeats(AktSong.BPM[0].BPM, Time); - if TopBeat > AktSong.BPM[1].StartBeat then begin - // analyze second BPM - Time := Time - GetTimeForBeats(AktSong.BPM[0].BPM, AktSong.BPM[1].StartBeat - CurBeat); - CurBeat := AktSong.BPM[1].StartBeat; - TopBeat := GetBeats(AktSong.BPM[1].BPM, Time); - Result := CurBeat + TopBeat; - - end else begin - (* pierwszy przedzial *) - Result := TopBeat; - end; - end; // if} - - (* more BPMs *) - if Length(AktSong.BPM) > 1 then begin - - CurBeat := 0; - CurBPM := 0; - while (Time > 0) do begin - GetMidBeatSub(CurBPM, Time, CurBeat); - Inc(CurBPM); - end; - - Result := CurBeat; - end; // if -end; - -function GetTimeFromBeat(Beat: integer): real; -var - CurBPM: integer; -begin - Result := 0; - if Length(AktSong.BPM) = 1 then Result := AktSong.GAP / 1000 + Beat * 60 / AktSong.BPM[0].BPM; - - (* more BPMs *) - if Length(AktSong.BPM) > 1 then begin - Result := AktSong.GAP / 1000; - CurBPM := 0; - while (CurBPM <= High(AktSong.BPM)) and (Beat > AktSong.BPM[CurBPM].StartBeat) do begin - if (CurBPM < High(AktSong.BPM)) and (Beat >= AktSong.BPM[CurBPM+1].StartBeat) then begin - // full range - Result := Result + (60 / AktSong.BPM[CurBPM].BPM) * (AktSong.BPM[CurBPM+1].StartBeat - AktSong.BPM[CurBPM].StartBeat); - end; - - if (CurBPM = High(AktSong.BPM)) or (Beat < AktSong.BPM[CurBPM+1].StartBeat) then begin - // in the middle - Result := Result + (60 / AktSong.BPM[CurBPM].BPM) * (Beat - AktSong.BPM[CurBPM].StartBeat); - end; - Inc(CurBPM); - end; - -{ while (Time > 0) do begin - GetMidBeatSub(CurBPM, Time, CurBeat); - Inc(CurBPM); - end;} - end; // if} -end; - -procedure Sing(Sender: TScreenSing); -var - Pet: integer; - PetGr: integer; - CP: integer; - Done: real; - N: integer; -begin - Czas.Teraz := Czas.Teraz + TimeSkip; - - Czas.OldBeat := Czas.AktBeat; - Czas.MidBeat := GetMidBeat(Czas.Teraz - (AktSong.Gap{ + 90 I've forgotten for what it is}) / 1000); // new system with variable BPM in function - Czas.AktBeat := Floor(Czas.MidBeat); - -// Czas.OldHalf := Czas.AktHalf; -// Czas.MidHalf := Czas.MidBeat + 0.5; -// Czas.AktHalf := Floor(Czas.MidHalf); - - Czas.OldBeatC := Czas.AktBeatC; - Czas.MidBeatC := GetMidBeat(Czas.Teraz - (AktSong.Gap) / 1000); - Czas.AktBeatC := Floor(Czas.MidBeatC); - - Czas.OldBeatD := Czas.AktBeatD; - Czas.MidBeatD := -0.5+GetMidBeat(Czas.Teraz - (AktSong.Gap + 120 + 20) / 1000); // MidBeat with addition GAP - Czas.AktBeatD := Floor(Czas.MidBeatD); - Czas.FracBeatD := Frac(Czas.MidBeatD); - - // sentences routines - for PetGr := 0 to 0 do begin;//High(Gracz) do begin - CP := PetGr; - // ustawianie starej czesci - Czas.OldCzesc := Czesci[CP].Akt; - - // wybieranie aktualnej czesci - for Pet := 0 to Czesci[CP].High do - if Czas.AktBeat >= Czesci[CP].Czesc[Pet].Start then Czesci[CP].Akt := Pet; - - // czysczenie nut gracza, gdy to jest nowa plansza - // (optymizacja raz na halfbeat jest zla) - if Czesci[CP].Akt <> Czas.OldCzesc then NewSentence(Sender); - - end; // for PetGr - - // wykonuje operacje raz na beat - if (Czas.AktBeat >= 0) and (Czas.OldBeat <> Czas.AktBeat) then - NewBeat(Sender); - - // make some operations on clicks - if {(Czas.AktBeatC >= 0) and }(Czas.OldBeatC <> Czas.AktBeatC) then - NewBeatC(Sender); - - // make some operations when detecting new voice pitch - if (Czas.AktBeatD >= 0) and (Czas.OldBeatD <> Czas.AktBeatD) then - NewBeatD(Sender); - - // wykonuje operacje w polowie beatu -// if (Czas.AktHalf >= 1) and (Czas.OldHalf <> Czas.AktHalf) then -// NewHalf; - - // plynnie przesuwa text - Done := 1; - for N := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do - if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start <= Czas.MidBeat) - and (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start + Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc >= Czas.MidBeat) then - Done := (Czas.MidBeat - Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start) / (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc); - - N := Czesci[0].Czesc[Czesci[0].Akt].HighNut; - - // wylacza ostatnia nute po przejsciu - {// todo: Lyrics - if (Ini.LyricsEffect = 1) and (Done = 1) and - (Czas.MidBeat > Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start + Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc) - then Sender.LyricMain.Selected := -1; - - if Done > 1 then Done := 1; - Sender.LyricMain.Done := Done; } - - // use Done with LCD -{ with ScreenSing do begin - if LyricMain.Selected >= 0 then begin - LCD.MoveCursor(1, LyricMain.SelectedLetter + Round((LyricMain.SelectedLength-1) * Done)); - LCD.ShowCursor; - end; - end;} - - -end; - -procedure NewSentence(Sender: TScreenSing); -var -G: Integer; -begin - // czyszczenie nut graczy - for G := 0 to High(Player) do begin - Player[G].IlNut := 0; - Player[G].HighNut := -1; - SetLength(Player[G].Nuta, 0); - end; - - // Add Words to Lyrics - with Sender do begin - {LyricMain.AddCzesc(Czesci[0].Akt); - if Czesci[0].Akt < Czesci[0].High then - LyricSub.AddCzesc(Czesci[0].Akt+1) - else - LyricSub.Clear;} - while (not Lyrics.LineinQueue) AND (Lyrics.LineCounter <= High(Czesci[0].Czesc)) do - Lyrics.AddLine(@Czesci[0].Czesc[Lyrics.LineCounter]); - end; - - Sender.UpdateLCD; - - //On Sentence Change... - Sender.onSentenceChange(Czesci[0].Akt); -end; - -procedure NewBeat(Sender: TScreenSing); -var - Pet: integer; -// TempBeat: integer; -begin - // ustawia zaznaczenie tekstu -// SingScreen.LyricMain.Selected := -1; - for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do - if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeat) then begin - // operates on currently beated note - //Todo: Lyrics - //Sender.LyricMain.Selected := Pet; - -// LCD.MoveCursor(1, ScreenSing.LyricMain.SelectedLetter); -// LCD.ShowCursor; - - //LCD.MoveCursorBR(Sender.LyricMain.SelectedLetter); - LCD.ShowCursor; - - end; -end; - -procedure NewBeatC; -var - Pet: integer; -// LPT_1: integer; -// LPT_2: integer; -begin -// LPT_1 := 1; -// LPT_2 := 1; - - // beat click - if (Ini.BeatClick = 1) and ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then - Music.PlayClick; - - // debug system on LPT - if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then begin - //LPT_1 := 0; -// Light.LightOne(0, 150); - - Light.LightOne(1, 200); // beat light - if ParamStr(1) = '-doublelights' then - Light.LightOne(0, 200); // beat light - - -{ if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod (Czesci[0].Resolution * 2) = 0) then - Light.LightOne(0, 150) - else - Light.LightOne(1, 150)} - end; - - for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do - if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeatC) then begin - // click assist - if Ini.ClickAssist = 1 then - Music.PlayClick; - - //LPT_2 := 0; - if ParamStr(1) <> '-doublelights' then - Light.LightOne(0, 150); //125 - - - // drum machine -(* TempBeat := Czas.AktBeat;// + 2; - if (TempBeat mod 8 = 0) then Music.PlayDrum; - if (TempBeat mod 8 = 4) then Music.PlayClap; -// if (TempBeat mod 4 = 2) then Music.PlayHihat; - if (TempBeat mod 4 <> 0) then Music.PlayHihat;*) - end; - - {$IFDEF UseSerialPort} - // PortWriteB($378, LPT_1 + LPT_2 * 2); // 0 zapala - {$ENDIF} -end; - -procedure NewBeatD(Sender: TScreenSing); -begin - NewNote(Sender); -end; - -//procedure NewHalf; -//begin -// NewNote; -//end; - -procedure NewNote(Sender: TScreenSing); -var - CP: integer; // current player - S: integer; // sentence - SMin: integer; - SMax: integer; - SDet: integer; // temporary: sentence of detected note - Pet: integer; - Mozna: boolean; - Nowa: boolean; - Range: integer; - NoteHit:boolean; -begin -// Log.LogStatus('Beat ' + IntToStr(Czas.AktBeat) + ' HalfBeat ' + IntToStr(Czas.AktHalf), 'NewBeat'); -// beep; - - // analizuje dla obu graczy ten sam sygnal (Sound.OneSrcForBoth) - // albo juz lepiej nie - for CP := 0 to PlayersPlay-1 do begin - - // analyze buffer - Sound[CP].AnalizujBufor; - - // adds some noise -// Czas.Ton := Czas.Ton + Round(Random(3)) - 1; - - // 0.5.0: count min and max sentence range for checking (detection is delayed to the notes we see on the screen) - SMin := Czesci[0].Akt-1; - if SMin < 0 then SMin := 0; - SMax := Czesci[0].Akt; - - // check if we can add new note - Mozna := false; - SDet:=SMin; - for S := SMin to SMax do - for Pet := 0 to Czesci[0].Czesc[S].HighNut do - if ((Czesci[0].Czesc[S].Nuta[Pet].Start <= Czas.AktBeatD) - and (Czesci[0].Czesc[S].Nuta[Pet].Start + Czesci[0].Czesc[S].Nuta[Pet].Dlugosc - 1 >= Czas.AktBeatD)) - and (not Czesci[0].Czesc[S].Nuta[Pet].FreeStyle) // but don't allow when it's FreeStyle note - and (Czesci[0].Czesc[S].Nuta[Pet].Dlugosc > 0) // and make sure the note lenghts is at least 1 - then begin - SDet := S; - Mozna := true; - Break; - end; - - S := SDet; - - - - - -// Czas.SzczytJest := true; -// Czas.Ton := 27; - - // gdy moze, to dodaje nute - if (Sound[CP].SzczytJest) and (Mozna) then begin - // operowanie na ostatniej nucie - for Pet := 0 to Czesci[0].Czesc[S].HighNut do - if (Czesci[0].Czesc[S].Nuta[Pet].Start <= Czas.OldBeatD+1) - and (Czesci[0].Czesc[S].Nuta[Pet].Start + - Czesci[0].Czesc[S].Nuta[Pet].Dlugosc > Czas.OldBeatD+1) then begin - // to robi, tylko dla pary nut (oryginalnej i gracza) - - // przesuwanie tonu w odpowiednia game - while (Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton > 6) do - Sound[CP].Ton := Sound[CP].Ton - 12; - while (Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton < -6) do - Sound[CP].Ton := Sound[CP].Ton + 12; - - // Half size Notes Patch - NoteHit := false; - - //if Ini.Difficulty = 0 then Range := 2; - //if Ini.Difficulty = 1 then Range := 1; - //if Ini.Difficulty = 2 then Range := 0; - Range := 2 - Ini.Difficulty; - if abs(Czesci[0].Czesc[S].Nuta[Pet].Ton - Sound[CP].Ton) <= Range then begin - Sound[CP].Ton := Czesci[0].Czesc[S].Nuta[Pet].Ton; - - - // Half size Notes Patch - NoteHit := true; - - - if (Ini.LineBonus = 0) then - begin - // add points without LineBonus - case Czesci[0].Czesc[S].Nuta[Pet].Wartosc of - 1: Player[CP].Score := Player[CP].Score + 10000 / Czesci[0].Wartosc * - Czesci[0].Czesc[S].Nuta[Pet].Wartosc; - 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 10000 / Czesci[0].Wartosc * - Czesci[0].Czesc[S].Nuta[Pet].Wartosc; - end; - end - else - begin - // add points with Line Bonus - case Czesci[0].Czesc[S].Nuta[Pet].Wartosc of - 1: Player[CP].Score := Player[CP].Score + 9000 / Czesci[0].Wartosc * - Czesci[0].Czesc[S].Nuta[Pet].Wartosc; - 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 9000 / Czesci[0].Wartosc * - Czesci[0].Czesc[S].Nuta[Pet].Wartosc; - end; - end; - - Player[CP].ScoreI := Floor(Player[CP].Score / 10) * 10; - Player[CP].ScoreGoldenI := Floor(Player[CP].ScoreGolden / 10) * 10; - - Player[CP].ScoreTotalI := Player[CP].ScoreI + Player[CP].ScoreGoldenI + Player[CP].ScoreLineI; - end; - - end; // operowanie - - // sprawdzanie czy to nowa nuta, czy przedluzenie - if S = SMax then begin - Nowa := true; - // jezeli ostatnia ma ten sam ton - if (Player[CP].IlNut > 0 ) and (Player[CP].Nuta[Player[CP].HighNut].Ton = Sound[CP].Ton) - and (Player[CP].Nuta[Player[CP].HighNut].Start + Player[CP].Nuta[Player[CP].HighNut].Dlugosc = Czas.AktBeatD) - then Nowa := false; - // jezeli jest jakas nowa nuta na sprawdzanym beacie - for Pet := 0 to Czesci[0].Czesc[S].HighNut do - if (Czesci[0].Czesc[S].Nuta[Pet].Start = Czas.AktBeatD) then - Nowa := true; - - // dodawanie nowej nuty - if Nowa then begin - // nowa nuta - Player[CP].IlNut := Player[CP].IlNut + 1; - Player[CP].HighNut := Player[CP].HighNut + 1; - SetLength(Player[CP].Nuta, Player[CP].IlNut); - Player[CP].Nuta[Player[CP].HighNut].Start := Czas.AktBeatD; - Player[CP].Nuta[Player[CP].HighNut].Dlugosc := 1; - Player[CP].Nuta[Player[CP].HighNut].Ton := Sound[CP].Ton; // Ton || TonDokl - Player[CP].Nuta[Player[CP].HighNut].Detekt := Czas.MidBeat; - - - // Half Note Patch - Player[CP].Nuta[Player[CP].HighNut].Hit := NoteHit; - - - // Log.LogStatus('Nowa Nuta ' + IntToStr(Gracz.Nuta[Gracz.HighNut].Start), 'NewBeat'); - - end else begin - // przedluzenie nuty - Player[CP].Nuta[Player[CP].HighNut].Dlugosc := Player[CP].Nuta[Player[CP].HighNut].Dlugosc + 1; - end; - - - // check for perfect note and then lit the star (on Draw) - for Pet := 0 to Czesci[0].Czesc[S].HighNut do - if (Czesci[0].Czesc[S].Nuta[Pet].Start = Player[CP].Nuta[Player[CP].HighNut].Start) - and (Czesci[0].Czesc[S].Nuta[Pet].Dlugosc = Player[CP].Nuta[Player[CP].HighNut].Dlugosc) - and (Czesci[0].Czesc[S].Nuta[Pet].Ton = Player[CP].Nuta[Player[CP].HighNut].Ton) then begin - Player[CP].Nuta[Player[CP].HighNut].Perfect := true; - end; - - end;// else beep; // if S = SMax - - end; // if moze - end; // for CP -// Log.LogStatus('EndBeat', 'NewBeat'); - -//On Sentence End -> For LineBonus + SingBar -if (sDet >= low(Czesci[0].Czesc)) AND (sDet <= high(Czesci[0].Czesc)) then -if ((Czesci[0].Czesc[SDet].Nuta[Czesci[0].Czesc[SDet].HighNut].Start + Czesci[0].Czesc[SDet].Nuta[Czesci[0].Czesc[SDet].HighNut].Dlugosc - 1) = Czas.AktBeatD) then - Sender.onSentenceEnd(sDet); - -end; - -procedure ClearScores(PlayerNum: integer); -begin - Player[PlayerNum].Score := 0; - Player[PlayerNum].ScoreI := 0; - Player[PlayerNum].ScoreLine := 0; - Player[PlayerNum].ScoreLineI := 0; - Player[PlayerNum].ScoreGolden := 0; - Player[PlayerNum].ScoreGoldenI := 0; - Player[PlayerNum].ScoreTotalI := 0; -end; - -//-------------------- -// Function sets all Absolute Paths e.g. Song Path and makes sure the Directorys exist -//-------------------- -procedure InitializePaths; - - // Initialize a Path Variable - // After Setting Paths, make sure that Paths exist - function initialize_path( out aPathVar : String; const aLocation : String ): boolean; - var - lWriteable: Boolean; - lAttrib : integer; - begin - lWriteable := false; - aPathVar := aLocation; - - // Make sure the directory is needex - ForceDirectories(aPathVar); - - If DirectoryExists(aPathVar) then - begin - lAttrib := fileGetAttr('C:Temp'); - - lWriteable := ( lAttrib and faDirectory <> 0 ) AND - NOT ( lAttrib and faReadOnly <> 0 ) - end; - - if not lWriteable then - Log.LogError('Error: Dir ('+ aLocation +') is Readonly'); - - result := lWriteable; - end; - -begin - - GamePath := ExtractFilePath(ParamStr(0)); - - initialize_path( LogPath , GamePath ); - initialize_path( SoundPath , GamePath + 'Sounds' + PathDelim ); - initialize_path( SongPath , GamePath + 'Songs' + PathDelim ); - initialize_path( ThemePath , GamePath + 'Themes' + PathDelim ); - initialize_path( ScreenshotsPath , GamePath + 'Screenshots' + PathDelim ); - initialize_path( CoversPath , GamePath + 'Covers' + PathDelim ); - initialize_path( LanguagesPath , GamePath + 'Languages' + PathDelim ); - initialize_path( PluginPath , GamePath + 'Plugins' + PathDelim ); - initialize_path( PlaylistPath , GamePath + 'Playlists' + PathDelim ); - - DecimalSeparator := ','; -end; - -end. - +unit UMain; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + SDL, + UGraphic, + UMusic, + URecord, + UTime, + SysUtils, + UDisplay, + UIni, + ULog, + ULyrics, + UScreenSing, + OpenGL12, + {$IFDEF UseSerialPort} + zlportio {you can disable it and all PortWriteB calls}, + {$ENDIF} + ULCD, + ULight, + UThemes; + +type + TPlayer = record + Name: string; + + Score: real; + ScoreLine: real; + ScoreGolden: real; + + ScoreI: integer; + ScoreLineI: integer; + ScoreGoldenI: integer; + ScoreTotalI: integer; + + + + //LineBonus Mod + ScoreLast: Real;//Last Line Score + {ScorePercent: integer;//Aktual Fillstate of the SingBar + ScorePercentTarget: integer;//Target Fillstate of the SingBar + //end Singbar Mod + + //PhrasenBonus - Line Bonus Mod + LineBonus_PosX: Single; + LineBonus_PosY: Single; + LineBonus_Alpha: Single; + LineBonus_Visible: boolean; + LineBonus_Text: string; + LineBonus_Color: TRGB; + LineBonus_Age: Integer; + LineBonus_Rating: Integer; + //Variable vor Positioning -> Set on ScreenShow, different when Playercount Changes + LineBonus_TargetX: integer; + LineBonus_TargetY: integer; + LineBonus_StartX: integer; + LineBonus_StartY: integer; + //PhrasenBonus - Line Bonus Mod End } + + + //PerfectLineTwinkle Mod (effect) + LastSentencePerfect: Boolean; + //PerfectLineTwinkle Mod end + + +// Meter: real; + + HighNut: integer; + IlNut: integer; + Nuta: array of record + Start: integer; + Dlugosc: integer; + Detekt: real; // dokladne miejsce, w ktorym wykryto ta nute + Ton: real; + Perfect: boolean; // true if the note matches the original one, lit the star + + + + // Half size Notes Patch + Hit: boolean; // true if the note Hits the Line + //end Half size Notes Patch + + + + end; + end; + + +var + //Absolute Paths + GamePath: string; + SoundPath: string; + SongPath: string; + LogPath: string; + ThemePath: string; + ScreenshotsPath: string; + CoversPath: string; + LanguagesPath: string; + PluginPath: string; + PlayListPath: string; + + OGL: Boolean; + Done: Boolean; + Event: TSDL_event; + FileName: string; + Restart: boolean; + + // gracz i jego nuty + Player: array of TPlayer; + PlayersPlay: integer; + +procedure InitializePaths; + +procedure MainLoop; +procedure CheckEvents; +procedure Sing(Sender: TScreenSing); +procedure NewSentence(Sender: TScreenSing); +procedure NewBeat(Sender: TScreenSing); // executed when on then new beat +procedure NewBeatC(Sender: TScreenSing); // executed when on then new beat for click +procedure NewBeatD(Sender: TScreenSing); // executed when on then new beat for detection +//procedure NewHalf; // executed when in the half between beats +procedure NewNote(Sender: TScreenSing); // detect note +function GetMidBeat(Time: real): real; +function GetTimeFromBeat(Beat: integer): real; +procedure ClearScores(PlayerNum: integer); + +implementation +uses USongs, UJoystick, math, UCommandLine; + +procedure MainLoop; +var + Delay: integer; +begin + SDL_EnableKeyRepeat(125, 125); + While not Done do + Begin + // joypad + if (Ini.Joypad = 1) OR (Params.Joypad) then + Joy.Update; + + // keyboard events + CheckEvents; + + // display + done := not Display.Draw; + SwapBuffers; + + // light + Light.Refresh; + + // delay + CountMidTime; +// if 1000*TimeMid > 100 then beep; + Delay := Floor(1000 / 100 - 1000 * TimeMid); + + if Delay >= 1 then + SDL_Delay(Delay); // dynamic, maximum is 100 fps + + CountSkipTime; + + // reinitialization of graphics + if Restart then begin + Reinitialize3D; + Restart := false; + end; + + End; + UnloadOpenGL; +End; + +Procedure CheckEvents; +//var +// p: pointer; +Begin + if not Assigned(Display.NextScreen) then + While SDL_PollEvent( @event ) = 1 Do + Begin +// beep; + Case Event.type_ Of + SDL_QUITEV: begin + Display.Fade := 0; + Display.NextScreenWithCheck := nil; + Display.CheckOK := True; + end; +{ SDL_MOUSEBUTTONDOWN: + With Event.button Do + Begin + If State = SDL_BUTTON_LEFT Then + Begin + // + End; + End; // With} + SDL_KEYDOWN: + begin + //ScreenShot hack. If Print is pressed-> Make screenshot and Save to Screenshots Path + if (Event.key.keysym.sym = SDLK_SYSREQ) then + Display.ScreenShot + + // popup hack... if there is a visible popup then let it handle input instead of underlying screen + // shoud be done in a way to be sure the topmost popup has preference (maybe error, then check) + else if (ScreenPopupError <> NIL) and (ScreenPopupError.Visible) then + done := not ScreenPopupError.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) + else if (ScreenPopupCheck <> NIL) AND (ScreenPopupCheck.Visible) then + done := not ScreenPopupCheck.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) + // end of popup hack + + else + begin + // check for Screen want to Exit + done := Not Display.ActualScreen^.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True); + + //If Screen wants to Exit + if done then + begin + //If Question Option is enabled then Show Exit Popup + if (Ini.AskbeforeDel = 1) then + begin + Display.ActualScreen^.CheckFadeTo(NIL,'MSG_QUIT_USDX'); + end + else //When asking for exit is disabled then simply exit + begin + Display.Fade := 0; + Display.NextScreenWithCheck := nil; + Display.CheckOK := True; + end; + end; + + end; // if (Not Display.ActualScreen^.ParseInput(Event.key.keysym.scancode, True)) then + end; +// SDL_JOYAXISMOTION: +// begin +// beep +// end; + SDL_JOYBUTTONDOWN: + begin + beep + end; + End; // Case Event.type_ + End; // While +End; // CheckEvents + +function GetTimeForBeats(BPM, Beats: real): real; +begin + Result := 60 / BPM * Beats; +end; + +function GetBeats(BPM, msTime: real): real; +begin + Result := BPM * msTime / 60; +end; + +procedure GetMidBeatSub(BPMNum: integer; var Time: real; var CurBeat: real); +var + NewTime: real; +begin + if High(AktSong.BPM) = BPMNum then begin + // last BPM + CurBeat := AktSong.BPM[BPMNum].StartBeat + GetBeats(AktSong.BPM[BPMNum].BPM, Time); + Time := 0; + end else begin + // not last BPM + // count how much time is it for start of the new BPM and store it in NewTime + NewTime := GetTimeForBeats(AktSong.BPM[BPMNum].BPM, AktSong.BPM[BPMNum+1].StartBeat - AktSong.BPM[BPMNum].StartBeat); + + // compare it to remaining time + if (Time - NewTime) > 0 then begin + // there is still remaining time + CurBeat := AktSong.BPM[BPMNum].StartBeat; + Time := Time - NewTime; + end else begin + // there is no remaining time + CurBeat := AktSong.BPM[BPMNum].StartBeat + GetBeats(AktSong.BPM[BPMNum].BPM, Time); + Time := 0; + end; // if + end; // if +end; + +function GetMidBeat(Time: real): real; +var + CurBeat: real; + CurBPM: integer; +// TopBeat: real; +// TempBeat: real; +// TempTime: real; +begin + Result := 0; + if Length(AktSong.BPM) = 1 then Result := Time * AktSong.BPM[0].BPM / 60; + + (* 2 BPMs *) +{ if Length(AktSong.BPM) > 1 then begin + (* new system *) + CurBeat := 0; + TopBeat := GetBeats(AktSong.BPM[0].BPM, Time); + if TopBeat > AktSong.BPM[1].StartBeat then begin + // analyze second BPM + Time := Time - GetTimeForBeats(AktSong.BPM[0].BPM, AktSong.BPM[1].StartBeat - CurBeat); + CurBeat := AktSong.BPM[1].StartBeat; + TopBeat := GetBeats(AktSong.BPM[1].BPM, Time); + Result := CurBeat + TopBeat; + + end else begin + (* pierwszy przedzial *) + Result := TopBeat; + end; + end; // if} + + (* more BPMs *) + if Length(AktSong.BPM) > 1 then begin + + CurBeat := 0; + CurBPM := 0; + while (Time > 0) do begin + GetMidBeatSub(CurBPM, Time, CurBeat); + Inc(CurBPM); + end; + + Result := CurBeat; + end; // if +end; + +function GetTimeFromBeat(Beat: integer): real; +var + CurBPM: integer; +begin + Result := 0; + if Length(AktSong.BPM) = 1 then Result := AktSong.GAP / 1000 + Beat * 60 / AktSong.BPM[0].BPM; + + (* more BPMs *) + if Length(AktSong.BPM) > 1 then begin + Result := AktSong.GAP / 1000; + CurBPM := 0; + while (CurBPM <= High(AktSong.BPM)) and (Beat > AktSong.BPM[CurBPM].StartBeat) do begin + if (CurBPM < High(AktSong.BPM)) and (Beat >= AktSong.BPM[CurBPM+1].StartBeat) then begin + // full range + Result := Result + (60 / AktSong.BPM[CurBPM].BPM) * (AktSong.BPM[CurBPM+1].StartBeat - AktSong.BPM[CurBPM].StartBeat); + end; + + if (CurBPM = High(AktSong.BPM)) or (Beat < AktSong.BPM[CurBPM+1].StartBeat) then begin + // in the middle + Result := Result + (60 / AktSong.BPM[CurBPM].BPM) * (Beat - AktSong.BPM[CurBPM].StartBeat); + end; + Inc(CurBPM); + end; + +{ while (Time > 0) do begin + GetMidBeatSub(CurBPM, Time, CurBeat); + Inc(CurBPM); + end;} + end; // if} +end; + +procedure Sing(Sender: TScreenSing); +var + Pet: integer; + PetGr: integer; + CP: integer; + Done: real; + N: integer; +begin + Czas.Teraz := Czas.Teraz + TimeSkip; + + Czas.OldBeat := Czas.AktBeat; + Czas.MidBeat := GetMidBeat(Czas.Teraz - (AktSong.Gap{ + 90 I've forgotten for what it is}) / 1000); // new system with variable BPM in function + Czas.AktBeat := Floor(Czas.MidBeat); + +// Czas.OldHalf := Czas.AktHalf; +// Czas.MidHalf := Czas.MidBeat + 0.5; +// Czas.AktHalf := Floor(Czas.MidHalf); + + Czas.OldBeatC := Czas.AktBeatC; + Czas.MidBeatC := GetMidBeat(Czas.Teraz - (AktSong.Gap) / 1000); + Czas.AktBeatC := Floor(Czas.MidBeatC); + + Czas.OldBeatD := Czas.AktBeatD; + Czas.MidBeatD := -0.5+GetMidBeat(Czas.Teraz - (AktSong.Gap + 120 + 20) / 1000); // MidBeat with addition GAP + Czas.AktBeatD := Floor(Czas.MidBeatD); + Czas.FracBeatD := Frac(Czas.MidBeatD); + + // sentences routines + for PetGr := 0 to 0 do begin;//High(Gracz) do begin + CP := PetGr; + // ustawianie starej czesci + Czas.OldCzesc := Czesci[CP].Akt; + + // wybieranie aktualnej czesci + for Pet := 0 to Czesci[CP].High do + if Czas.AktBeat >= Czesci[CP].Czesc[Pet].Start then Czesci[CP].Akt := Pet; + + // czysczenie nut gracza, gdy to jest nowa plansza + // (optymizacja raz na halfbeat jest zla) + if Czesci[CP].Akt <> Czas.OldCzesc then NewSentence(Sender); + + end; // for PetGr + + // wykonuje operacje raz na beat + if (Czas.AktBeat >= 0) and (Czas.OldBeat <> Czas.AktBeat) then + NewBeat(Sender); + + // make some operations on clicks + if {(Czas.AktBeatC >= 0) and }(Czas.OldBeatC <> Czas.AktBeatC) then + NewBeatC(Sender); + + // make some operations when detecting new voice pitch + if (Czas.AktBeatD >= 0) and (Czas.OldBeatD <> Czas.AktBeatD) then + NewBeatD(Sender); + + // wykonuje operacje w polowie beatu +// if (Czas.AktHalf >= 1) and (Czas.OldHalf <> Czas.AktHalf) then +// NewHalf; + + // plynnie przesuwa text + Done := 1; + for N := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start <= Czas.MidBeat) + and (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start + Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc >= Czas.MidBeat) then + Done := (Czas.MidBeat - Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start) / (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc); + + N := Czesci[0].Czesc[Czesci[0].Akt].HighNut; + + // wylacza ostatnia nute po przejsciu + {// todo: Lyrics + if (Ini.LyricsEffect = 1) and (Done = 1) and + (Czas.MidBeat > Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start + Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc) + then Sender.LyricMain.Selected := -1; + + if Done > 1 then Done := 1; + Sender.LyricMain.Done := Done; } + + // use Done with LCD +{ with ScreenSing do begin + if LyricMain.Selected >= 0 then begin + LCD.MoveCursor(1, LyricMain.SelectedLetter + Round((LyricMain.SelectedLength-1) * Done)); + LCD.ShowCursor; + end; + end;} + + +end; + +procedure NewSentence(Sender: TScreenSing); +var +G: Integer; +begin + // czyszczenie nut graczy + for G := 0 to High(Player) do begin + Player[G].IlNut := 0; + Player[G].HighNut := -1; + SetLength(Player[G].Nuta, 0); + end; + + // Add Words to Lyrics + with Sender do begin + {LyricMain.AddCzesc(Czesci[0].Akt); + if Czesci[0].Akt < Czesci[0].High then + LyricSub.AddCzesc(Czesci[0].Akt+1) + else + LyricSub.Clear;} + while (not Lyrics.LineinQueue) AND (Lyrics.LineCounter <= High(Czesci[0].Czesc)) do + Lyrics.AddLine(@Czesci[0].Czesc[Lyrics.LineCounter]); + end; + + Sender.UpdateLCD; + + //On Sentence Change... + Sender.onSentenceChange(Czesci[0].Akt); +end; + +procedure NewBeat(Sender: TScreenSing); +var + Pet: integer; +// TempBeat: integer; +begin + // ustawia zaznaczenie tekstu +// SingScreen.LyricMain.Selected := -1; + for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeat) then begin + // operates on currently beated note + //Todo: Lyrics + //Sender.LyricMain.Selected := Pet; + +// LCD.MoveCursor(1, ScreenSing.LyricMain.SelectedLetter); +// LCD.ShowCursor; + + //LCD.MoveCursorBR(Sender.LyricMain.SelectedLetter); + LCD.ShowCursor; + + end; +end; + +procedure NewBeatC; +var + Pet: integer; +// LPT_1: integer; +// LPT_2: integer; +begin +// LPT_1 := 1; +// LPT_2 := 1; + + // beat click + if (Ini.BeatClick = 1) and ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then + Music.PlayClick; + + // debug system on LPT + if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then begin + //LPT_1 := 0; +// Light.LightOne(0, 150); + + Light.LightOne(1, 200); // beat light + if ParamStr(1) = '-doublelights' then + Light.LightOne(0, 200); // beat light + + +{ if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod (Czesci[0].Resolution * 2) = 0) then + Light.LightOne(0, 150) + else + Light.LightOne(1, 150)} + end; + + for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeatC) then begin + // click assist + if Ini.ClickAssist = 1 then + Music.PlayClick; + + //LPT_2 := 0; + if ParamStr(1) <> '-doublelights' then + Light.LightOne(0, 150); //125 + + + // drum machine +(* TempBeat := Czas.AktBeat;// + 2; + if (TempBeat mod 8 = 0) then Music.PlayDrum; + if (TempBeat mod 8 = 4) then Music.PlayClap; +// if (TempBeat mod 4 = 2) then Music.PlayHihat; + if (TempBeat mod 4 <> 0) then Music.PlayHihat;*) + end; + + {$IFDEF UseSerialPort} + // PortWriteB($378, LPT_1 + LPT_2 * 2); // 0 zapala + {$ENDIF} +end; + +procedure NewBeatD(Sender: TScreenSing); +begin + NewNote(Sender); +end; + +//procedure NewHalf; +//begin +// NewNote; +//end; + +procedure NewNote(Sender: TScreenSing); +var + CP: integer; // current player + S: integer; // sentence + SMin: integer; + SMax: integer; + SDet: integer; // temporary: sentence of detected note + Pet: integer; + Mozna: boolean; + Nowa: boolean; + Range: integer; + NoteHit:boolean; +begin +// Log.LogStatus('Beat ' + IntToStr(Czas.AktBeat) + ' HalfBeat ' + IntToStr(Czas.AktHalf), 'NewBeat'); +// beep; + + // analizuje dla obu graczy ten sam sygnal (Sound.OneSrcForBoth) + // albo juz lepiej nie + for CP := 0 to PlayersPlay-1 do begin + + // analyze buffer + Sound[CP].AnalizujBufor; + + // adds some noise +// Czas.Ton := Czas.Ton + Round(Random(3)) - 1; + + // 0.5.0: count min and max sentence range for checking (detection is delayed to the notes we see on the screen) + SMin := Czesci[0].Akt-1; + if SMin < 0 then SMin := 0; + SMax := Czesci[0].Akt; + + // check if we can add new note + Mozna := false; + SDet:=SMin; + for S := SMin to SMax do + for Pet := 0 to Czesci[0].Czesc[S].HighNut do + if ((Czesci[0].Czesc[S].Nuta[Pet].Start <= Czas.AktBeatD) + and (Czesci[0].Czesc[S].Nuta[Pet].Start + Czesci[0].Czesc[S].Nuta[Pet].Dlugosc - 1 >= Czas.AktBeatD)) + and (not Czesci[0].Czesc[S].Nuta[Pet].FreeStyle) // but don't allow when it's FreeStyle note + and (Czesci[0].Czesc[S].Nuta[Pet].Dlugosc > 0) // and make sure the note lenghts is at least 1 + then begin + SDet := S; + Mozna := true; + Break; + end; + + S := SDet; + + + + + +// Czas.SzczytJest := true; +// Czas.Ton := 27; + + // gdy moze, to dodaje nute + if (Sound[CP].SzczytJest) and (Mozna) then begin + // operowanie na ostatniej nucie + for Pet := 0 to Czesci[0].Czesc[S].HighNut do + if (Czesci[0].Czesc[S].Nuta[Pet].Start <= Czas.OldBeatD+1) + and (Czesci[0].Czesc[S].Nuta[Pet].Start + + Czesci[0].Czesc[S].Nuta[Pet].Dlugosc > Czas.OldBeatD+1) then begin + // to robi, tylko dla pary nut (oryginalnej i gracza) + + // przesuwanie tonu w odpowiednia game + while (Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton > 6) do + Sound[CP].Ton := Sound[CP].Ton - 12; + while (Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton < -6) do + Sound[CP].Ton := Sound[CP].Ton + 12; + + // Half size Notes Patch + NoteHit := false; + + //if Ini.Difficulty = 0 then Range := 2; + //if Ini.Difficulty = 1 then Range := 1; + //if Ini.Difficulty = 2 then Range := 0; + Range := 2 - Ini.Difficulty; + if abs(Czesci[0].Czesc[S].Nuta[Pet].Ton - Sound[CP].Ton) <= Range then begin + Sound[CP].Ton := Czesci[0].Czesc[S].Nuta[Pet].Ton; + + + // Half size Notes Patch + NoteHit := true; + + + if (Ini.LineBonus = 0) then + begin + // add points without LineBonus + case Czesci[0].Czesc[S].Nuta[Pet].Wartosc of + 1: Player[CP].Score := Player[CP].Score + 10000 / Czesci[0].Wartosc * + Czesci[0].Czesc[S].Nuta[Pet].Wartosc; + 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 10000 / Czesci[0].Wartosc * + Czesci[0].Czesc[S].Nuta[Pet].Wartosc; + end; + end + else + begin + // add points with Line Bonus + case Czesci[0].Czesc[S].Nuta[Pet].Wartosc of + 1: Player[CP].Score := Player[CP].Score + 9000 / Czesci[0].Wartosc * + Czesci[0].Czesc[S].Nuta[Pet].Wartosc; + 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 9000 / Czesci[0].Wartosc * + Czesci[0].Czesc[S].Nuta[Pet].Wartosc; + end; + end; + + Player[CP].ScoreI := Floor(Player[CP].Score / 10) * 10; + Player[CP].ScoreGoldenI := Floor(Player[CP].ScoreGolden / 10) * 10; + + Player[CP].ScoreTotalI := Player[CP].ScoreI + Player[CP].ScoreGoldenI + Player[CP].ScoreLineI; + end; + + end; // operowanie + + // sprawdzanie czy to nowa nuta, czy przedluzenie + if S = SMax then begin + Nowa := true; + // jezeli ostatnia ma ten sam ton + if (Player[CP].IlNut > 0 ) and (Player[CP].Nuta[Player[CP].HighNut].Ton = Sound[CP].Ton) + and (Player[CP].Nuta[Player[CP].HighNut].Start + Player[CP].Nuta[Player[CP].HighNut].Dlugosc = Czas.AktBeatD) + then Nowa := false; + // jezeli jest jakas nowa nuta na sprawdzanym beacie + for Pet := 0 to Czesci[0].Czesc[S].HighNut do + if (Czesci[0].Czesc[S].Nuta[Pet].Start = Czas.AktBeatD) then + Nowa := true; + + // dodawanie nowej nuty + if Nowa then begin + // nowa nuta + Player[CP].IlNut := Player[CP].IlNut + 1; + Player[CP].HighNut := Player[CP].HighNut + 1; + SetLength(Player[CP].Nuta, Player[CP].IlNut); + Player[CP].Nuta[Player[CP].HighNut].Start := Czas.AktBeatD; + Player[CP].Nuta[Player[CP].HighNut].Dlugosc := 1; + Player[CP].Nuta[Player[CP].HighNut].Ton := Sound[CP].Ton; // Ton || TonDokl + Player[CP].Nuta[Player[CP].HighNut].Detekt := Czas.MidBeat; + + + // Half Note Patch + Player[CP].Nuta[Player[CP].HighNut].Hit := NoteHit; + + + // Log.LogStatus('Nowa Nuta ' + IntToStr(Gracz.Nuta[Gracz.HighNut].Start), 'NewBeat'); + + end else begin + // przedluzenie nuty + Player[CP].Nuta[Player[CP].HighNut].Dlugosc := Player[CP].Nuta[Player[CP].HighNut].Dlugosc + 1; + end; + + + // check for perfect note and then lit the star (on Draw) + for Pet := 0 to Czesci[0].Czesc[S].HighNut do + if (Czesci[0].Czesc[S].Nuta[Pet].Start = Player[CP].Nuta[Player[CP].HighNut].Start) + and (Czesci[0].Czesc[S].Nuta[Pet].Dlugosc = Player[CP].Nuta[Player[CP].HighNut].Dlugosc) + and (Czesci[0].Czesc[S].Nuta[Pet].Ton = Player[CP].Nuta[Player[CP].HighNut].Ton) then begin + Player[CP].Nuta[Player[CP].HighNut].Perfect := true; + end; + + end;// else beep; // if S = SMax + + end; // if moze + end; // for CP +// Log.LogStatus('EndBeat', 'NewBeat'); + +//On Sentence End -> For LineBonus + SingBar +if (sDet >= low(Czesci[0].Czesc)) AND (sDet <= high(Czesci[0].Czesc)) then +if ((Czesci[0].Czesc[SDet].Nuta[Czesci[0].Czesc[SDet].HighNut].Start + Czesci[0].Czesc[SDet].Nuta[Czesci[0].Czesc[SDet].HighNut].Dlugosc - 1) = Czas.AktBeatD) then + Sender.onSentenceEnd(sDet); + +end; + +procedure ClearScores(PlayerNum: integer); +begin + Player[PlayerNum].Score := 0; + Player[PlayerNum].ScoreI := 0; + Player[PlayerNum].ScoreLine := 0; + Player[PlayerNum].ScoreLineI := 0; + Player[PlayerNum].ScoreGolden := 0; + Player[PlayerNum].ScoreGoldenI := 0; + Player[PlayerNum].ScoreTotalI := 0; +end; + +//-------------------- +// Function sets all Absolute Paths e.g. Song Path and makes sure the Directorys exist +//-------------------- +procedure InitializePaths; + + // Initialize a Path Variable + // After Setting Paths, make sure that Paths exist + function initialize_path( out aPathVar : String; const aLocation : String ): boolean; + var + lWriteable: Boolean; + lAttrib : integer; + begin + lWriteable := false; + aPathVar := aLocation; + + // Make sure the directory is needex + ForceDirectories(aPathVar); + + If DirectoryExists(aPathVar) then + begin + lAttrib := fileGetAttr('C:Temp'); + + lWriteable := ( lAttrib and faDirectory <> 0 ) AND + NOT ( lAttrib and faReadOnly <> 0 ) + end; + + if not lWriteable then + Log.LogError('Error: Dir ('+ aLocation +') is Readonly'); + + result := lWriteable; + end; + +begin + + GamePath := ExtractFilePath(ParamStr(0)); + + initialize_path( LogPath , GamePath ); + initialize_path( SoundPath , GamePath + 'Sounds' + PathDelim ); + initialize_path( SongPath , GamePath + 'Songs' + PathDelim ); + initialize_path( ThemePath , GamePath + 'Themes' + PathDelim ); + initialize_path( ScreenshotsPath , GamePath + 'Screenshots' + PathDelim ); + initialize_path( CoversPath , GamePath + 'Covers' + PathDelim ); + initialize_path( LanguagesPath , GamePath + 'Languages' + PathDelim ); + initialize_path( PluginPath , GamePath + 'Plugins' + PathDelim ); + initialize_path( PlaylistPath , GamePath + 'Playlists' + PathDelim ); + + DecimalSeparator := ','; +end; + +end. + diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index b9f93b29..b3729e69 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -1,735 +1,738 @@ -unit UMusic; - -interface - -{$I switches.inc} - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - - -uses Classes, - {$IFDEF win32} - windows, - {$ENDIF} - UCommon, - Messages, - SysUtils, - {$IFNDEF FPC} - Forms, - {$ENDIF} - {$IFDEF useBASS} - bass, - {$ENDIF} - ULog, - USongs; - - -procedure InitializeSound; - -type - TSoundCard = record - Name: string; - Source: array of string; - end; - - TFFTData = array [0..256] of Single; - - TCustomSoundEntry = record - Filename : String; - Handle : hStream; - end; - - - TMusic = class - private - BassStart: hStream; // Wait, I've replaced this with BASS - BassBack: hStream; // It has almost all features we need - BassSwoosh: hStream; - BassChange: hStream; // Almost? It aleady has them all :) - BassOption: hStream; - BassClick: hStream; - BassDrum: hStream; - BassHihat: hStream; - BassClap: hStream; - BassShuffle: hStream; - - //Custom Sounds - CustomSounds: array of TCustomSoundEntry; - - - Loaded: boolean; - Loop: boolean; - public - Bass: hStream; - procedure InitializePlayback; - procedure InitializeRecord; - procedure SetVolume(Volume: integer); - procedure SetMusicVolume(Volume: integer); - procedure SetLoop(Enabled: boolean); - function Open(Name: string): boolean; // true if succeed - procedure Rewind; - procedure MoveTo(Time: real); - procedure Play; - procedure Pause; //Pause Mod - procedure Stop; - procedure Close; - function Finished: boolean; - function Length: real; - function Position: real; - procedure PlayStart; - procedure PlayBack; - procedure PlaySwoosh; - procedure PlayChange; - procedure PlayOption; - procedure PlayClick; - procedure PlayDrum; - procedure PlayHihat; - procedure PlayClap; - procedure PlayShuffle; - procedure StopShuffle; - procedure CaptureStart; - procedure CaptureStop; - procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); - procedure StopCard(Card: byte); - function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; - - //Equalizer - function GetFFTData: TFFTData; - - //Custom Sounds - function LoadCustomSound(const Filename: String): Cardinal; - procedure PlayCustomSound(const Index: Cardinal); - -end; - -const - RecordSystem = 1; - -type - TMuzyka = record - Path: string; - Start: integer; // start of song in ms - IlNut: integer; - DlugoscNut: integer; - end; - - PLine = ^TLine; - TLine = record - Start: integer; - StartNote: integer; - Lyric: string; - LyricWidth: real; - Koniec: integer; - BaseNote: integer; - HighNut: integer; - IlNut: integer; - TotalNotes: integer; - Nuta: array of record - Color: integer; - Start: integer; - Dlugosc: integer; - Ton: integer; - TonGamy: integer; - Tekst: string; - FreeStyle: boolean; - Wartosc: integer; // zwykla nuta x1, zlota nuta x2 - end; - end; - ALine = array of TLine; - - TCzesci = record - Akt: integer; // aktualna czesc utworu do rysowania - High: integer; - Ilosc: integer; - Resolution: integer; - NotesGAP: integer; - Wartosc: integer; - Czesc: ALine; - end; - - TCzas = record // wszystko, co dotyczy aktualnej klatki - OldBeat: integer; // poprzednio wykryty beat w utworze - AktBeat: integer; // aktualny beat w utworze - MidBeat: real; // dokladny AktBeat - - // now we use this for super synchronization! - // only used when analyzing voice - OldBeatD: integer; // poprzednio wykryty beat w utworze - AktBeatD: integer; // aktualny beat w utworze - MidBeatD: real; // dokladny AktBeatD - FracBeatD: real; // fractional part of MidBeatD - - // we use this for audiable clicks - OldBeatC: integer; // poprzednio wykryty beat w utworze - AktBeatC: integer; // aktualny beat w utworze - MidBeatC: real; // dokladny AktBeatC - FracBeatC: real; // fractional part of MidBeatC - - - OldCzesc: integer; // poprzednio wyswietlana czesc - // akt jest w czesci.akt - - Teraz: real; // aktualny czas w utworze - Razem: real; // caly czas utworu - end; - -var - Music: TMusic; - - // muzyka - Muzyka: TMuzyka; - - // czesci z nutami; - Czesci: array of TCzesci; - - // czas - Czas: TCzas; - - fHWND: Thandle; - -type - TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, - mpPaused, mpOpen); - -const - ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); - -implementation - -uses - {$IFDEF FPC} - lclintf, - {$ENDIF} - UGraphic, - URecord, - UFiles, - UIni, - UMain, - UThemes; - -procedure InitializeSound; -begin - Log.LogStatus('Initializing Playback', 'InitializeSound'); Music.InitializePlayback; - Log.LogStatus('Initializing Record', 'InitializeSound'); Music.InitializeRecord; -end; - -procedure TMusic.InitializePlayback; -var - Pet: integer; - S: integer; -begin - Log.BenchmarkStart(4); - Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); - - Loaded := false; - Loop := false; - - fHWND := AllocateHWND( nil); // TODO : JB_lazarus - can we do something different here ?? lazarus didnt like this function - - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - if not BASS_Init(1, 44100, 0, fHWND, nil) then - begin - {$IFNDEF FPC} - // TODO : JB_linux find a way to do this nice.. - Application.MessageBox ('Could not initialize BASS', 'Error'); - {$ENDIF} - Exit; - end; - {$ENDIF} - - Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); - - // config playing buffer -// BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); -// BASS_SetConfig(BASS_CONFIG_BUFFER, 100); - - Log.LogStatus('Loading Sounds', 'Music Initialize'); - - Log.BenchmarkStart(4); - LoadSoundFromFile(BassStart, SoundPath + 'Common Start.mp3'); - LoadSoundFromFile(BassBack, SoundPath + 'Common Back.mp3'); - LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3'); - LoadSoundFromFile(BassChange, SoundPath + 'select music change music 50.mp3'); - LoadSoundFromFile(BassOption, SoundPath + 'option change col.mp3'); - LoadSoundFromFile(BassClick, SoundPath + 'rimshot022b.mp3'); - -// LoadSoundFromFile(BassDrum, SoundPath + 'bassdrumhard076b.mp3'); -// LoadSoundFromFile(BassHihat, SoundPath + 'hihatclosed068b.mp3'); -// LoadSoundFromFile(BassClap, SoundPath + 'claps050b.mp3'); - -// LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3'); - - Log.BenchmarkEnd(4); Log.LogBenchmark('--> Loading Sounds', 4); -end; - -procedure TMusic.InitializeRecord; -var - S: integer; - device: integer; - descr: string; - input: integer; - input2: integer; - flags: integer; - mic: array[0..15] of integer; - SC: integer; // soundcard - SCI: integer; // soundcard input -begin - if RecordSystem = 1 then begin - SetLength(Sound, 6 {max players});//Ini.Players+1); - for S := 0 to High(Sound) do begin //Ini.Players do begin - Sound[S] := TSound.Create; - Sound[S].Num := S; - Sound[S].BufferNew := TMemoryStream.Create; - SetLength(Sound[S].BufferLong, 1); - Sound[S].BufferLong[0] := TMemoryStream.Create; - Sound[S].n := 4*1024; - end; - - - // check for recording devices; - {device := 0; - descr := BASS_RecordGetDeviceDescription(device); - - SetLength(SoundCard, 0); - while (descr <> '') do begin - SC := High(SoundCard) + 1; - SetLength(SoundCard, SC+1); - - Log.LogAnalyze('Device #'+IntToStr(device)+': '+ descr); - SoundCard[SC].Description := Descr; - - // check for recording inputs - mic[device] := -1; // default to no change - input := 0; - BASS_RecordInit(device); - Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); - flags := BASS_RecordGetInput(input); - - SetLength(SoundCard[SC].Input, 0); - while (flags <> -1) do begin - SCI := High(SoundCard[SC].Input) + 1; - SetLength(SoundCard[SC].Input, SCI+1); - - Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); - SoundCard[SC].Input[SCI].Name := BASS_RecordGetInputName(Input); - - if (flags and BASS_INPUT_TYPE_MASK) = BASS_INPUT_TYPE_MIC then begin - mic[device] := input; // auto set microphone - end; - Inc(Input); - flags := BASS_RecordGetInput(input); - end; - - if mic[device] <> -1 then begin - Log.LogAnalyze('Found the mic at input ' + IntToStr(Mic[device])) - end else begin - Log.LogAnalyze('Mic not found'); - mic[device] := 0; // setting to the first one (for kxproject) - end; - SoundCard[SC].InputSeleceted := Mic[Device]; - - - BASS_RecordFree; - - inc(Device); - descr := BASS_RecordGetDeviceDescription(Device); - end; // while} - end; // if -end; - -procedure TMusic.SetVolume(Volume: integer); -begin - //Old Sets Wave Volume - //BASS_SetVolume(Volume); - //New: Sets Volume only for this Application - - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); - {$ENDIF} -end; - -procedure TMusic.SetMusicVolume(Volume: Integer); -begin - //Max Volume Prevention - if Volume > 100 then - Volume := 100; - - //Set Volume - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelSetAttributes (Bass, -1, Volume, -101); - {$ENDIF} -end; - -procedure TMusic.SetLoop(Enabled: boolean); -begin - Loop := Enabled; -end; - -function TMusic.Open(Name: string): boolean; -begin - Loaded := false; - if FileExists(Name) then - begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); - {$ENDIF} - - Loaded := true; - //Set Max Volume - SetMusicVolume (100); - end; - - Result := Loaded; -end; - -procedure TMusic.Rewind; -begin - if Loaded then begin - end; -end; - -procedure TMusic.MoveTo(Time: real); -var - bytes: integer; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - bytes := BASS_ChannelSeconds2Bytes(Bass, Time); - BASS_ChannelSetPosition(Bass, bytes); - {$ENDIF} -end; - -procedure TMusic.Play; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - if Loaded then - begin - if Loop then - BASS_ChannelPlay(Bass, True); // start from beginning... actually bass itself does not loop, nor does this TMusic Class - - BASS_ChannelPlay(Bass, False); // for setting position before playing - end; - {$ENDIF} -end; - -procedure TMusic.Pause; //Pause Mod -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - if Loaded then begin - BASS_ChannelPause(Bass); // Pauses Song - end; - {$ENDIF} -end; - -procedure TMusic.Stop; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - Bass_ChannelStop(Bass); - {$ENDIF} -end; - -procedure TMusic.Close; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - Bass_StreamFree(Bass); - {$ENDIF} -end; - -function TMusic.Length: real; -var - bytes: integer; -begin - Result := 60; - - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - bytes := BASS_ChannelGetLength(Bass); - Result := BASS_ChannelBytes2Seconds(Bass, bytes); - {$ENDIF} -end; - -function TMusic.Position: real; -var - bytes: integer; -begin - Result := 0; - - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - bytes := BASS_ChannelGetPosition(BASS); - Result := BASS_ChannelBytes2Seconds(BASS, bytes); - {$ENDIF} -end; - -function TMusic.Finished: boolean; -begin - Result := false; - - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then - begin - Result := true; - end; - {$ENDIF} -end; - -procedure TMusic.PlayStart; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassStart, True); - {$ENDIF} -end; - -procedure TMusic.PlayBack; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassBack, True);// then - {$ENDIF} -end; - -procedure TMusic.PlaySwoosh; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassSwoosh, True); - {$ENDIF} -end; - -procedure TMusic.PlayChange; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassChange, True); - {$ENDIF} -end; - -procedure TMusic.PlayOption; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassOption, True); - {$ENDIF} -end; - -procedure TMusic.PlayClick; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassClick, True); - {$ENDIF} -end; - -procedure TMusic.PlayDrum; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassDrum, True); - {$ENDIF} -end; - -procedure TMusic.PlayHihat; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassHihat, True); - {$ENDIF} -end; - -procedure TMusic.PlayClap; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassClap, True); - {$ENDIF} -end; - -procedure TMusic.PlayShuffle; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassShuffle, True); - {$ENDIF} -end; - -procedure TMusic.StopShuffle; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelStop(BassShuffle); - {$ENDIF} -end; - -procedure TMusic.CaptureStart; -var - S: integer; - SC: integer; - P1: integer; - P2: integer; -begin - for S := 0 to High(Sound) do - Sound[S].BufferLong[0].Clear; - - for SC := 0 to High(Ini.CardList) do begin - P1 := Ini.CardList[SC].ChannelL; - P2 := Ini.CardList[SC].ChannelR; - if P1 > PlayersPlay then P1 := 0; - if P2 > PlayersPlay then P2 := 0; - if (P1 > 0) or (P2 > 0) then - CaptureCard(SC, P1, P2); - end; -end; - -procedure TMusic.CaptureStop; -var - SC: integer; - P1: integer; - P2: integer; -begin - - for SC := 0 to High(Ini.CardList) do begin - P1 := Ini.CardList[SC].ChannelL; - P2 := Ini.CardList[SC].ChannelR; - if P1 > PlayersPlay then P1 := 0; - if P2 > PlayersPlay then P2 := 0; - if (P1 > 0) or (P2 > 0) then StopCard(SC); - end; - -end; - -//procedure TMusic.CaptureCard(RecordI, SoundNum, PlayerLeft, PlayerRight: byte); -procedure TMusic.CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); -var - Error: integer; - ErrorMsg: string; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - - if not BASS_RecordInit(RecordI) then begin - Error := BASS_ErrorGetCode; - - ErrorMsg := IntToStr(Error); - if Error = BASS_ERROR_DX then ErrorMsg := 'No DX5'; - if Error = BASS_ERROR_ALREADY then ErrorMsg := 'The device has already been initialized'; - if Error = BASS_ERROR_DEVICE then ErrorMsg := 'The device number specified is invalid'; - if Error = BASS_ERROR_DRIVER then ErrorMsg := 'There is no available device driver'; - - {Log.LogAnalyze('Error initializing record [' + IntToStr(RecordI) + ', ' - + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' - + ErrorMsg);} - Log.LogError('Error initializing record [' + IntToStr(RecordI) + ', ' - + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' - + ErrorMsg); - Log.LogError('Music -> CaptureCard: Error initializing record: ' + ErrorMsg); - - - end - else - begin - Recording.SoundCard[RecordI].BassRecordStream := BASS_RecordStart(44100, 2, MakeLong(0, 20) , @GetMicrophone, PlayerLeft + PlayerRight*256); - end; - - {$ENDIF} -end; - -procedure TMusic.StopCard(Card: byte); -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_RecordSetDevice(Card); - BASS_RecordFree; - {$ENDIF} -end; - -function TMusic.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; -var - L: Integer; -begin - if FileExists(Name) then begin - Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); - try - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); - {$ENDIF} - - //Add CustomSound - L := High(CustomSounds) + 1; - SetLength (CustomSounds, L + 1); - CustomSounds[L].Filename := Name; - CustomSounds[L].Handle := hStream; - except - Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); - end; - end else begin - Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); - exit; - end; -end; - -//Equalizer -function TMusic.GetFFTData: TFFTData; -var -Data: TFFTData; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - - //Get Channel Data Mono and 256 Values - BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); - //Result := Data; - - {$ENDIF} -end; - -function TMusic.LoadCustomSound(const Filename: String): Cardinal; -var - S: hStream; - I: Integer; - F: String; -begin - //Search for Sound in already loaded Sounds - F := UpperCase(SoundPath + FileName); - For I := 0 to High(CustomSounds) do - begin - if (UpperCase(CustomSounds[I].Filename) = F) then - begin - Result := I; - Exit; - end; - end; - - if LoadSoundFromFile(S, SoundPath + Filename) then - Result := High(CustomSounds) - else - Result := 0; -end; - -procedure TMusic.PlayCustomSound(const Index: Cardinal); -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - - if Index <= High(CustomSounds) then - BASS_ChannelPlay(CustomSounds[Index].Handle, True); - - {$ENDIF} -end; - - -end. +unit UMusic; + +interface + +{$I switches.inc} + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + + +uses Classes, + {$IFDEF win32} + windows, + {$ENDIF} + UCommon, + Messages, + SysUtils, + {$IFNDEF FPC} + Forms, + {$ENDIF} + {$IFDEF useBASS} + bass, + {$ENDIF} + ULog, + USongs; + + +procedure InitializeSound; + +type + TSoundCard = record + Name: string; + Source: array of string; + end; + + TFFTData = array [0..256] of Single; + + TCustomSoundEntry = record + Filename : String; + Handle : hStream; + end; + + + TMusic = class + private + BassStart: hStream; // Wait, I've replaced this with BASS + BassBack: hStream; // It has almost all features we need + BassSwoosh: hStream; + BassChange: hStream; // Almost? It aleady has them all :) + BassOption: hStream; + BassClick: hStream; + BassDrum: hStream; + BassHihat: hStream; + BassClap: hStream; + BassShuffle: hStream; + + //Custom Sounds + CustomSounds: array of TCustomSoundEntry; + + + Loaded: boolean; + Loop: boolean; + public + Bass: hStream; + procedure InitializePlayback; + procedure InitializeRecord; + procedure SetVolume(Volume: integer); + procedure SetMusicVolume(Volume: integer); + procedure SetLoop(Enabled: boolean); + function Open(Name: string): boolean; // true if succeed + procedure Rewind; + procedure MoveTo(Time: real); + procedure Play; + procedure Pause; //Pause Mod + procedure Stop; + procedure Close; + function Finished: boolean; + function Length: real; + function Position: real; + procedure PlayStart; + procedure PlayBack; + procedure PlaySwoosh; + procedure PlayChange; + procedure PlayOption; + procedure PlayClick; + procedure PlayDrum; + procedure PlayHihat; + procedure PlayClap; + procedure PlayShuffle; + procedure StopShuffle; + procedure CaptureStart; + procedure CaptureStop; + procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); + procedure StopCard(Card: byte); + function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; + + //Equalizer + function GetFFTData: TFFTData; + + //Custom Sounds + function LoadCustomSound(const Filename: String): Cardinal; + procedure PlayCustomSound(const Index: Cardinal); + +end; + +const + RecordSystem = 1; + +type + TMuzyka = record + Path: string; + Start: integer; // start of song in ms + IlNut: integer; + DlugoscNut: integer; + end; + + PLine = ^TLine; + TLine = record + Start: integer; + StartNote: integer; + Lyric: string; + LyricWidth: real; + Koniec: integer; + BaseNote: integer; + HighNut: integer; + IlNut: integer; + TotalNotes: integer; + Nuta: array of record + Color: integer; + Start: integer; + Dlugosc: integer; + Ton: integer; + TonGamy: integer; + Tekst: string; + FreeStyle: boolean; + Wartosc: integer; // zwykla nuta x1, zlota nuta x2 + end; + end; + ALine = array of TLine; + + TCzesci = record + Akt: integer; // aktualna czesc utworu do rysowania + High: integer; + Ilosc: integer; + Resolution: integer; + NotesGAP: integer; + Wartosc: integer; + Czesc: ALine; + end; + + TCzas = record // wszystko, co dotyczy aktualnej klatki + OldBeat: integer; // poprzednio wykryty beat w utworze + AktBeat: integer; // aktualny beat w utworze + MidBeat: real; // dokladny AktBeat + + // now we use this for super synchronization! + // only used when analyzing voice + OldBeatD: integer; // poprzednio wykryty beat w utworze + AktBeatD: integer; // aktualny beat w utworze + MidBeatD: real; // dokladny AktBeatD + FracBeatD: real; // fractional part of MidBeatD + + // we use this for audiable clicks + OldBeatC: integer; // poprzednio wykryty beat w utworze + AktBeatC: integer; // aktualny beat w utworze + MidBeatC: real; // dokladny AktBeatC + FracBeatC: real; // fractional part of MidBeatC + + + OldCzesc: integer; // poprzednio wyswietlana czesc + // akt jest w czesci.akt + + Teraz: real; // aktualny czas w utworze + Razem: real; // caly czas utworu + end; + +var + Music: TMusic; + + // muzyka + Muzyka: TMuzyka; + + // czesci z nutami; + Czesci: array of TCzesci; + + // czas + Czas: TCzas; + + fHWND: Thandle; + +type + TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, + mpPaused, mpOpen); + +const + ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); + +implementation + +uses + {$IFDEF FPC} + lclintf, + {$ENDIF} + UGraphic, + URecord, + UFiles, + UIni, + UMain, + UThemes; + +procedure InitializeSound; +begin + Log.LogStatus('Initializing Playback', 'InitializeSound'); Music.InitializePlayback; + Log.LogStatus('Initializing Record', 'InitializeSound'); Music.InitializeRecord; +end; + +procedure TMusic.InitializePlayback; +var + Pet: integer; + S: integer; +begin + Log.BenchmarkStart(4); + Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); + + Loaded := false; + Loop := false; + + {$ifdef win32} + // TODO : JB_Linux ... is this needed ? :) + fHWND := AllocateHWND( nil); // TODO : JB_lazarus - can we do something different here ?? lazarus didnt like this function + {$ENDIF} + + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + if not BASS_Init(1, 44100, 0, fHWND, nil) then + begin + {$IFNDEF FPC} + // TODO : JB_linux find a way to do this nice.. + Application.MessageBox ('Could not initialize BASS', 'Error'); + {$ENDIF} + Exit; + end; + {$ENDIF} + + Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); + + // config playing buffer +// BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); +// BASS_SetConfig(BASS_CONFIG_BUFFER, 100); + + Log.LogStatus('Loading Sounds', 'Music Initialize'); + + Log.BenchmarkStart(4); + LoadSoundFromFile(BassStart, SoundPath + 'Common Start.mp3'); + LoadSoundFromFile(BassBack, SoundPath + 'Common Back.mp3'); + LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3'); + LoadSoundFromFile(BassChange, SoundPath + 'select music change music 50.mp3'); + LoadSoundFromFile(BassOption, SoundPath + 'option change col.mp3'); + LoadSoundFromFile(BassClick, SoundPath + 'rimshot022b.mp3'); + +// LoadSoundFromFile(BassDrum, SoundPath + 'bassdrumhard076b.mp3'); +// LoadSoundFromFile(BassHihat, SoundPath + 'hihatclosed068b.mp3'); +// LoadSoundFromFile(BassClap, SoundPath + 'claps050b.mp3'); + +// LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3'); + + Log.BenchmarkEnd(4); Log.LogBenchmark('--> Loading Sounds', 4); +end; + +procedure TMusic.InitializeRecord; +var + S: integer; + device: integer; + descr: string; + input: integer; + input2: integer; + flags: integer; + mic: array[0..15] of integer; + SC: integer; // soundcard + SCI: integer; // soundcard input +begin + if RecordSystem = 1 then begin + SetLength(Sound, 6 {max players});//Ini.Players+1); + for S := 0 to High(Sound) do begin //Ini.Players do begin + Sound[S] := TSound.Create; + Sound[S].Num := S; + Sound[S].BufferNew := TMemoryStream.Create; + SetLength(Sound[S].BufferLong, 1); + Sound[S].BufferLong[0] := TMemoryStream.Create; + Sound[S].n := 4*1024; + end; + + + // check for recording devices; + {device := 0; + descr := BASS_RecordGetDeviceDescription(device); + + SetLength(SoundCard, 0); + while (descr <> '') do begin + SC := High(SoundCard) + 1; + SetLength(SoundCard, SC+1); + + Log.LogAnalyze('Device #'+IntToStr(device)+': '+ descr); + SoundCard[SC].Description := Descr; + + // check for recording inputs + mic[device] := -1; // default to no change + input := 0; + BASS_RecordInit(device); + Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); + flags := BASS_RecordGetInput(input); + + SetLength(SoundCard[SC].Input, 0); + while (flags <> -1) do begin + SCI := High(SoundCard[SC].Input) + 1; + SetLength(SoundCard[SC].Input, SCI+1); + + Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); + SoundCard[SC].Input[SCI].Name := BASS_RecordGetInputName(Input); + + if (flags and BASS_INPUT_TYPE_MASK) = BASS_INPUT_TYPE_MIC then begin + mic[device] := input; // auto set microphone + end; + Inc(Input); + flags := BASS_RecordGetInput(input); + end; + + if mic[device] <> -1 then begin + Log.LogAnalyze('Found the mic at input ' + IntToStr(Mic[device])) + end else begin + Log.LogAnalyze('Mic not found'); + mic[device] := 0; // setting to the first one (for kxproject) + end; + SoundCard[SC].InputSeleceted := Mic[Device]; + + + BASS_RecordFree; + + inc(Device); + descr := BASS_RecordGetDeviceDescription(Device); + end; // while} + end; // if +end; + +procedure TMusic.SetVolume(Volume: integer); +begin + //Old Sets Wave Volume + //BASS_SetVolume(Volume); + //New: Sets Volume only for this Application + + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); + {$ENDIF} +end; + +procedure TMusic.SetMusicVolume(Volume: Integer); +begin + //Max Volume Prevention + if Volume > 100 then + Volume := 100; + + //Set Volume + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelSetAttributes (Bass, -1, Volume, -101); + {$ENDIF} +end; + +procedure TMusic.SetLoop(Enabled: boolean); +begin + Loop := Enabled; +end; + +function TMusic.Open(Name: string): boolean; +begin + Loaded := false; + if FileExists(Name) then + begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); + {$ENDIF} + + Loaded := true; + //Set Max Volume + SetMusicVolume (100); + end; + + Result := Loaded; +end; + +procedure TMusic.Rewind; +begin + if Loaded then begin + end; +end; + +procedure TMusic.MoveTo(Time: real); +var + bytes: integer; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + bytes := BASS_ChannelSeconds2Bytes(Bass, Time); + BASS_ChannelSetPosition(Bass, bytes); + {$ENDIF} +end; + +procedure TMusic.Play; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + if Loaded then + begin + if Loop then + BASS_ChannelPlay(Bass, True); // start from beginning... actually bass itself does not loop, nor does this TMusic Class + + BASS_ChannelPlay(Bass, False); // for setting position before playing + end; + {$ENDIF} +end; + +procedure TMusic.Pause; //Pause Mod +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + if Loaded then begin + BASS_ChannelPause(Bass); // Pauses Song + end; + {$ENDIF} +end; + +procedure TMusic.Stop; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + Bass_ChannelStop(Bass); + {$ENDIF} +end; + +procedure TMusic.Close; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + Bass_StreamFree(Bass); + {$ENDIF} +end; + +function TMusic.Length: real; +var + bytes: integer; +begin + Result := 60; + + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + bytes := BASS_ChannelGetLength(Bass); + Result := BASS_ChannelBytes2Seconds(Bass, bytes); + {$ENDIF} +end; + +function TMusic.Position: real; +var + bytes: integer; +begin + Result := 0; + + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + bytes := BASS_ChannelGetPosition(BASS); + Result := BASS_ChannelBytes2Seconds(BASS, bytes); + {$ENDIF} +end; + +function TMusic.Finished: boolean; +begin + Result := false; + + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then + begin + Result := true; + end; + {$ENDIF} +end; + +procedure TMusic.PlayStart; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassStart, True); + {$ENDIF} +end; + +procedure TMusic.PlayBack; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassBack, True);// then + {$ENDIF} +end; + +procedure TMusic.PlaySwoosh; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassSwoosh, True); + {$ENDIF} +end; + +procedure TMusic.PlayChange; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassChange, True); + {$ENDIF} +end; + +procedure TMusic.PlayOption; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassOption, True); + {$ENDIF} +end; + +procedure TMusic.PlayClick; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassClick, True); + {$ENDIF} +end; + +procedure TMusic.PlayDrum; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassDrum, True); + {$ENDIF} +end; + +procedure TMusic.PlayHihat; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassHihat, True); + {$ENDIF} +end; + +procedure TMusic.PlayClap; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassClap, True); + {$ENDIF} +end; + +procedure TMusic.PlayShuffle; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassShuffle, True); + {$ENDIF} +end; + +procedure TMusic.StopShuffle; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelStop(BassShuffle); + {$ENDIF} +end; + +procedure TMusic.CaptureStart; +var + S: integer; + SC: integer; + P1: integer; + P2: integer; +begin + for S := 0 to High(Sound) do + Sound[S].BufferLong[0].Clear; + + for SC := 0 to High(Ini.CardList) do begin + P1 := Ini.CardList[SC].ChannelL; + P2 := Ini.CardList[SC].ChannelR; + if P1 > PlayersPlay then P1 := 0; + if P2 > PlayersPlay then P2 := 0; + if (P1 > 0) or (P2 > 0) then + CaptureCard(SC, P1, P2); + end; +end; + +procedure TMusic.CaptureStop; +var + SC: integer; + P1: integer; + P2: integer; +begin + + for SC := 0 to High(Ini.CardList) do begin + P1 := Ini.CardList[SC].ChannelL; + P2 := Ini.CardList[SC].ChannelR; + if P1 > PlayersPlay then P1 := 0; + if P2 > PlayersPlay then P2 := 0; + if (P1 > 0) or (P2 > 0) then StopCard(SC); + end; + +end; + +//procedure TMusic.CaptureCard(RecordI, SoundNum, PlayerLeft, PlayerRight: byte); +procedure TMusic.CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); +var + Error: integer; + ErrorMsg: string; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + + if not BASS_RecordInit(RecordI) then begin + Error := BASS_ErrorGetCode; + + ErrorMsg := IntToStr(Error); + if Error = BASS_ERROR_DX then ErrorMsg := 'No DX5'; + if Error = BASS_ERROR_ALREADY then ErrorMsg := 'The device has already been initialized'; + if Error = BASS_ERROR_DEVICE then ErrorMsg := 'The device number specified is invalid'; + if Error = BASS_ERROR_DRIVER then ErrorMsg := 'There is no available device driver'; + + {Log.LogAnalyze('Error initializing record [' + IntToStr(RecordI) + ', ' + + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' + + ErrorMsg);} + Log.LogError('Error initializing record [' + IntToStr(RecordI) + ', ' + + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' + + ErrorMsg); + Log.LogError('Music -> CaptureCard: Error initializing record: ' + ErrorMsg); + + + end + else + begin + Recording.SoundCard[RecordI].BassRecordStream := BASS_RecordStart(44100, 2, MakeLong(0, 20) , @GetMicrophone, PlayerLeft + PlayerRight*256); + end; + + {$ENDIF} +end; + +procedure TMusic.StopCard(Card: byte); +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_RecordSetDevice(Card); + BASS_RecordFree; + {$ENDIF} +end; + +function TMusic.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; +var + L: Integer; +begin + if FileExists(Name) then begin + Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); + try + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); + {$ENDIF} + + //Add CustomSound + L := High(CustomSounds) + 1; + SetLength (CustomSounds, L + 1); + CustomSounds[L].Filename := Name; + CustomSounds[L].Handle := hStream; + except + Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); + end; + end else begin + Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); + exit; + end; +end; + +//Equalizer +function TMusic.GetFFTData: TFFTData; +var +Data: TFFTData; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + + //Get Channel Data Mono and 256 Values + BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); + //Result := Data; + + {$ENDIF} +end; + +function TMusic.LoadCustomSound(const Filename: String): Cardinal; +var + S: hStream; + I: Integer; + F: String; +begin + //Search for Sound in already loaded Sounds + F := UpperCase(SoundPath + FileName); + For I := 0 to High(CustomSounds) do + begin + if (UpperCase(CustomSounds[I].Filename) = F) then + begin + Result := I; + Exit; + end; + end; + + if LoadSoundFromFile(S, SoundPath + Filename) then + Result := High(CustomSounds) + else + Result := 0; +end; + +procedure TMusic.PlayCustomSound(const Index: Cardinal); +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + + if Index <= High(CustomSounds) then + BASS_ChannelPlay(CustomSounds[Index].Handle, True); + + {$ENDIF} +end; + + +end. diff --git a/Game/Code/Classes/USkins.pas b/Game/Code/Classes/USkins.pas index 7fdbacde..c9d7f2fd 100644 --- a/Game/Code/Classes/USkins.pas +++ b/Game/Code/Classes/USkins.pas @@ -1,171 +1,174 @@ -unit USkins; - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - -interface - -type - TSkinTexture = record - Name: string; - FileName: string; - end; - - TSkinEntry = record - Theme: string; - Name: string; - Path: string; - FileName: string; - Creator: string; // not used yet - end; - - TSkin = class - Skin: array of TSkinEntry; - SkinTexture: array of TSkinTexture; - SkinPath: string; - Color: integer; - constructor Create; - procedure LoadList; - procedure ParseDir(Dir: string); - procedure LoadHeader(FileName: string); - procedure LoadSkin(Name: string); - function GetTextureFileName(TextureName: string): string; - function GetSkinNumber(Name: string): integer; - procedure onThemeChange; - end; - -var - Skin: TSkin; - -implementation - -uses IniFiles, Classes, SysUtils, ULog, UIni; - -constructor TSkin.Create; -begin - LoadList; -// LoadSkin('Lisek'); -// SkinColor := Color; -end; - -procedure TSkin.LoadList; -var - SR: TSearchRec; -// SR2: TSearchRec; -// SLen: integer; -begin - if FindFirst('Skins'+PathDelim+'*', faDirectory, SR) = 0 then begin - repeat - if (SR.Name <> '.') and (SR.Name <> '..') then - ParseDir('Skins'+PathDelim + SR.Name + PathDelim); - until FindNext(SR) <> 0; - end; // if - FindClose(SR); -end; - -procedure TSkin.ParseDir(Dir: string); -var - SR: TSearchRec; -// SLen: integer; -begin - if FindFirst(Dir + '*.ini', faAnyFile, SR) = 0 then begin - repeat - if (SR.Name <> '.') and (SR.Name <> '..') then - LoadHeader(Dir + SR.Name); - //Log.LogError(SR.Name); - until FindNext(SR) <> 0; - end; -end; - -procedure TSkin.LoadHeader(FileName: string); -var - SkinIni: TMemIniFile; - S: integer; -begin - SkinIni := TMemIniFile.Create(FileName); - - S := Length(Skin); - SetLength(Skin, S+1); - Skin[S].Path := IncludeTrailingBackslash(ExtractFileDir(FileName)); - Skin[S].FileName := ExtractFileName(FileName); - Skin[S].Theme := SkinIni.ReadString('Skin', 'Theme', ''); - Skin[S].Name := SkinIni.ReadString('Skin', 'Name', ''); - Skin[S].Creator := SkinIni.ReadString('Skin', 'Creator', ''); - - SkinIni.Free; -end; - -procedure TSkin.LoadSkin(Name: string); -var - SkinIni: TMemIniFile; - SL: TStringList; - T: integer; - S: integer; -begin - S := GetSkinNumber(Name); - SkinPath := Skin[S].Path; - - SkinIni := TMemIniFile.Create(SkinPath + Skin[S].FileName); - - SL := TStringList.Create; - SkinIni.ReadSection('Textures', SL); - - SetLength(SkinTexture, SL.Count); - for T := 0 to SL.Count-1 do begin - SkinTexture[T].Name := SL.Strings[T]; - SkinTexture[T].FileName := SkinIni.ReadString('Textures', SL.Strings[T], ''); - end; - - SL.Free; - SkinIni.Free; -end; - -function TSkin.GetTextureFileName(TextureName: string): string; -var - T: integer; -begin - Result := ''; - - for T := 0 to High(SkinTexture) do - begin - if ( SkinTexture[T].Name = TextureName ) AND - ( SkinTexture[T].FileName <> '' ) then - begin - Result := SkinPath + SkinTexture[T].FileName; - end; - end; - -{ Result := SkinPath + 'Bar.jpg'; - if TextureName = 'Ball' then Result := SkinPath + 'Ball.bmp'; - if Copy(TextureName, 1, 4) = 'Gray' then Result := SkinPath + 'Ball.bmp'; - if Copy(TextureName, 1, 6) = 'NoteBG' then Result := SkinPath + 'Ball.bmp';} -end; - -function TSkin.GetSkinNumber(Name: string): integer; -var - S: integer; -begin - Result := 0; // set default to the first available skin - for S := 0 to High(Skin) do - if Skin[S].Name = Name then Result := S; -end; - -procedure TSkin.onThemeChange; -var - S: integer; - Name: String; -begin - Ini.SkinNo:=0; - SetLength(ISkin, 0); - Name := Uppercase(ITheme[Ini.Theme]); - for S := 0 to High(Skin) do - if Name = Uppercase(Skin[S].Theme) then begin - SetLength(ISkin, Length(ISkin)+1); - ISkin[High(ISkin)] := Skin[S].Name; - end; - -end; - -end. +unit USkins; + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +interface + +type + TSkinTexture = record + Name: string; + FileName: string; + end; + + TSkinEntry = record + Theme: string; + Name: string; + Path: string; + FileName: string; + Creator: string; // not used yet + end; + + TSkin = class + Skin: array of TSkinEntry; + SkinTexture: array of TSkinTexture; + SkinPath: string; + Color: integer; + constructor Create; + procedure LoadList; + procedure ParseDir(Dir: string); + procedure LoadHeader(FileName: string); + procedure LoadSkin(Name: string); + function GetTextureFileName(TextureName: string): string; + function GetSkinNumber(Name: string): integer; + procedure onThemeChange; + end; + +var + Skin: TSkin; + +implementation + +uses IniFiles, Classes, SysUtils, ULog, UIni; + +constructor TSkin.Create; +begin + LoadList; +// LoadSkin('Lisek'); +// SkinColor := Color; +end; + +procedure TSkin.LoadList; +var + SR: TSearchRec; +// SR2: TSearchRec; +// SLen: integer; +begin + if FindFirst('Skins'+PathDelim+'*', faDirectory, SR) = 0 then begin + repeat + if (SR.Name <> '.') and (SR.Name <> '..') then + ParseDir('Skins'+PathDelim + SR.Name + PathDelim); + until FindNext(SR) <> 0; + end; // if + FindClose(SR); +end; + +procedure TSkin.ParseDir(Dir: string); +var + SR: TSearchRec; +// SLen: integer; +begin + if FindFirst(Dir + '*.ini', faAnyFile, SR) = 0 then begin + repeat + if (SR.Name <> '.') and (SR.Name <> '..') then + LoadHeader(Dir + SR.Name); + //Log.LogError(SR.Name); + until FindNext(SR) <> 0; + end; +end; + +procedure TSkin.LoadHeader(FileName: string); +var + SkinIni: TMemIniFile; + S: integer; +begin + SkinIni := TMemIniFile.Create(FileName); + + S := Length(Skin); + SetLength(Skin, S+1); + Skin[S].Path := IncludeTrailingBackslash(ExtractFileDir(FileName)); + Skin[S].FileName := ExtractFileName(FileName); + Skin[S].Theme := SkinIni.ReadString('Skin', 'Theme', ''); + Skin[S].Name := SkinIni.ReadString('Skin', 'Name', ''); + Skin[S].Creator := SkinIni.ReadString('Skin', 'Creator', ''); + + SkinIni.Free; +end; + +procedure TSkin.LoadSkin(Name: string); +var + SkinIni: TMemIniFile; + SL: TStringList; + T: integer; + S: integer; +begin + S := GetSkinNumber(Name); + SkinPath := Skin[S].Path; + + SkinIni := TMemIniFile.Create(SkinPath + Skin[S].FileName); + + SL := TStringList.Create; + SkinIni.ReadSection('Textures', SL); + + SetLength(SkinTexture, SL.Count); + for T := 0 to SL.Count-1 do begin + SkinTexture[T].Name := SL.Strings[T]; + SkinTexture[T].FileName := SkinIni.ReadString('Textures', SL.Strings[T], ''); + end; + + SL.Free; + SkinIni.Free; +end; + +function TSkin.GetTextureFileName(TextureName: string): string; +var + T: integer; +begin + Result := ''; + + for T := 0 to High(SkinTexture) do + begin + if ( SkinTexture[T].Name = TextureName ) AND + ( SkinTexture[T].FileName <> '' ) then + begin + Result := SkinPath + SkinTexture[T].FileName; + end; + end; + + Log.LogStatus('', '-----------------------------------------'); + Log.LogStatus(TextureName+' - '+ Result, 'TSkin.GetTextureFileName'); + +{ Result := SkinPath + 'Bar.jpg'; + if TextureName = 'Ball' then Result := SkinPath + 'Ball.bmp'; + if Copy(TextureName, 1, 4) = 'Gray' then Result := SkinPath + 'Ball.bmp'; + if Copy(TextureName, 1, 6) = 'NoteBG' then Result := SkinPath + 'Ball.bmp';} +end; + +function TSkin.GetSkinNumber(Name: string): integer; +var + S: integer; +begin + Result := 0; // set default to the first available skin + for S := 0 to High(Skin) do + if Skin[S].Name = Name then Result := S; +end; + +procedure TSkin.onThemeChange; +var + S: integer; + Name: String; +begin + Ini.SkinNo:=0; + SetLength(ISkin, 0); + Name := Uppercase(ITheme[Ini.Theme]); + for S := 0 to High(Skin) do + if Name = Uppercase(Skin[S].Theme) then begin + SetLength(ISkin, Length(ISkin)+1); + ISkin[High(ISkin)] := Skin[S].Name; + end; + +end; + +end. diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index f5169e8c..173fbd4c 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -1,1098 +1,1151 @@ -unit UTexture; -// added for easier debug disabling -{$define blindydebug} - -// Plain (alpha = 1) -// Transparent -// Colorized - -// obsolete? -// Transparent Range -// Font (white is drawn, black is transparent) -// Font Outline (Font with darker outline) -// Font Outline 2 (Font with darker outline) -// Font Black (black is drawn, white is transparent) -// Font Gray (gray is drawn, white is transparent) -// Arrow (for arrows, white is white, gray has color, black is transparent); - -interface - -{$I switches.inc} - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -uses OpenGL12, - {$IFDEF win32} - windows, - {$ENDIF} - Math, - Classes, - SysUtils, - Graphics, - UCommon, - UThemes, - SDL, - sdlutils, - SDL_Image; - - - {$IFDEF Win32} - procedure glGenTextures(n: GLsizei; var textures: GLuint); stdcall; external opengl32; - - {$ELSE} - {$ifdef darwin} - const opengl32 = '/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib'; - {$ELSE} - const opengl32 = 'libGL.so' ; // YES Capital GL - {$ENDIF} - - procedure glGenTextures(n: GLsizei; var textures: GLuint); stdcall; external opengl32; - {$ENDIF} - -type - TTexture = record - TexNum: integer; - X: real; - Y: real; - Z: real; // new - W: real; - H: real; - ScaleW: real; // for dynamic scalling while leaving width constant - ScaleH: real; // for dynamic scalling while leaving height constant - Rot: real; // 0 - 2*pi - Int: real; // intensity - ColR: real; - ColG: real; - ColB: real; - TexW: real; // used? - TexH: real; // used? - TexX1: real; - TexY1: real; - TexX2: real; - TexY2: real; - Alpha: real; - Name: string; // 0.5.0: experimental for handling cache images. maybe it's useful for dynamic skins - end; - - TTextureEntry = record - Name: string; - Typ: string; - - // we use normal TTexture, it's easier to implement and if needed - we copy ready data - Texture: TTexture; - TextureCache: TTexture; // 0.5.0 - end; - - TTextureDatabase = record - Texture: array of TTextureEntry; - end; - - TTextureUnit = class - - private - function LoadImage(Identifier: PChar): PSDL_Surface; - function pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; - procedure AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); - function GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; - procedure ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); - procedure FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); - procedure ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); - - public - Limit: integer; - CreateCacheMipmap: boolean; - -// function GetNumberFor - function GetTexture(Name, Typ: string): TTexture; overload; - function GetTexture(Name, Typ: string; FromCache: boolean): TTexture; overload; - function FindTexture(Name: string): integer; - function LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; - function LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; - function LoadTexture(Identifier: string): TTexture; overload; - function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; - procedure UnloadTexture(Name: string; FromCache: boolean); - Constructor Create; - Destructor Destroy; - end; - -var - Texture: TTextureUnit; - TextureDatabase: TTextureDatabase; - - // this should be in UDisplay?! - PrintScreenData: array[0..1024*768-1] of longword; - - ActTex: GLuint;//integer; - -// TextureD8: array[1..1024*1024] of byte; // 1MB - TextureD16: array[1..1024*1024, 1..2] of byte; // luminance/alpha tex (2MB) -// TextureD24: array[1..1024*1024, 1..3] of byte; // normal 24-bit tex (3MB) -// TextureD242: array[1..512*512, 1..3] of byte; // normal 24-bit tex (0,75MB) -// TextureD32: array[1..1024*1024, 1..4] of byte; // transparent 32-bit tex (4MB) - // total 40MB at 2048*2048 - // total 10MB at 1024*1024 - - Mipmapping: Boolean; - - CacheMipmap: array[0..256*256*3-1] of byte; // 3KB - CacheMipmapSurface: PSDL_Surface; - - -implementation - -uses ULog, - DateUtils, - UCovers, - {$IFDEF FPC} - LResources, - {$ENDIF} - StrUtils, dialogs; - -const - fmt_rgba: TSDL_Pixelformat=(palette: nil; - BitsPerPixel: 32; - BytesPerPixel: 4; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 24; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $ff000000; - ColorKey: 0; - Alpha: 255); - fmt_rgb: TSDL_Pixelformat=( palette: nil; - BitsPerPixel: 24; - BytesPerPixel: 3; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 0; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $00000000; - ColorKey: 0; - Alpha: 255); - - -Constructor TTextureUnit.Create; -begin - inherited Create; -end; - -Destructor TTextureUnit.Destroy; -begin - inherited Destroy; -end; - -function TTextureUnit.pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; -begin - if (fmt1^.BitsPerPixel = fmt2^.BitsPerPixel) and - (fmt1^.BytesPerPixel = fmt2^.BytesPerPixel) and - (fmt1^.Rloss = fmt2^.Rloss) and (fmt1^.Gloss = fmt2^.Gloss) and - (fmt1^.Bloss = fmt2^.Bloss) and (fmt1^.Rmask = fmt2^.Rmask) and - (fmt1^.Gmask = fmt2^.Gmask) and (fmt1^.Bmask = fmt2^.Bmask) and - (fmt1^.Rshift = fmt2^.Rshift) and (fmt1^.Gshift = fmt2^.Gshift) and - (fmt1^.Bshift = fmt2^.Bshift) - then - Result:=True - else - Result:=False; -end; - -// +++++++++++++++++++++ helpers for loadimage +++++++++++++++ - function SdlStreamSeek( context : PSDL_RWops; offset : Integer; whence : Integer ) : integer; cdecl; - var - stream : TStream; - origin : Word; - begin - stream := TStream( context.unknown ); - if ( stream = nil ) then - raise EInvalidContainer.Create( 'SDLStreamSeek on nil' ); - case whence of - 0 : origin := soFromBeginning; // Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0. - 1 : origin := soFromCurrent; // Offset is from the current position in the resource. Seek moves to Position + Offset. - 2 : origin := soFromEnd; - else - origin := soFromBeginning; // just in case - end; - Result := stream.Seek( offset, origin ); - end; - function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : Integer; maxnum: Integer ) : Integer; cdecl; - var - stream : TStream; - begin - stream := TStream( context.unknown ); - if ( stream = nil ) then - raise EInvalidContainer.Create( 'SDLStreamRead on nil' ); - try - Result := stream.read( Ptr^, Size * maxnum ) div size; - except - Result := -1; - end; - end; - function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl; - var - stream : TStream; - begin - stream := TStream( context.unknown ); - if ( stream = nil ) then - raise EInvalidContainer.Create( 'SDLStreamClose on nil' ); - stream.Free; - Result := 1; - end; -// ----------------------------------------------- - -function TTextureUnit.LoadImage(Identifier: PChar): PSDL_Surface; -var - - TexRWops: PSDL_RWops; - dHandle: THandle; - - {$IFDEF FPC} - lLazRes : TLResource; - lResData : TStringStream; - {$ELSE} - TexStream: TStream; - {$ENDIF} - -begin - Result := nil; - TexRWops := nil; - -// Log.LogStatus( Identifier, 'LoadImage' ); - - if ( FileExists(Identifier) ) then - begin - // load from file - Log.LogStatus( 'Is File', ' LoadImage' ); - try - Result:=IMG_Load(Identifier); - except - Log.LogStatus( 'ERROR Could not load from file' , Identifier); - beep; - Exit; - end; - end - else - begin - Log.LogStatus( 'IS Resource', ' LoadImage' ); - - // load from resource stream - {$IFNDEF FPC} - dHandle := FindResource(hInstance, Identifier, 'TEX'); - if dHandle=0 then - begin - Log.LogStatus( 'ERROR Could not find resource' , ' '+ Identifier); - beep; - Exit; - end; - - - TexStream := nil; - try - TexStream := TResourceStream.Create(HInstance, Identifier, 'TEX'); - except - Log.LogStatus( 'ERROR Could not load from resource' , Identifier); - beep; - Exit; - end; - - try - TexStream.position := 0; - try - TexRWops := SDL_AllocRW; - TexRWops.unknown := TUnknown(TexStream); - TexRWops.seek := SDLStreamSeek; - TexRWops.read := SDLStreamRead; - TexRWops.write := nil; - TexRWops.close := SDLStreamClose; - TexRWops.type_ := 2; - except - Log.LogStatus( 'ERROR Could not assign resource' , Identifier); - beep; - Exit; - end; - - Log.LogStatus( 'resource Assigned....' , Identifier); - Result:=IMG_Load_RW(TexRWops,0); - SDL_FreeRW(TexRWops); - - finally - if assigned( TexStream ) then - freeandnil( TexStream ); - end; - - - {$ELSE} - lLazRes := LazFindResource( Identifier, 'TEX' ); - if lLazRes <> nil then - begin - lResData := TStringStream.create( lLazRes.value ); - try - lResData.position := 0; - try - TexRWops := SDL_AllocRW; - TexRWops.unknown := TUnknown( lResData ); - TexRWops.seek := SDLStreamSeek; - TexRWops.read := SDLStreamRead; - TexRWops.write := nil; - TexRWops.close := SDLStreamClose; - TexRWops.type_ := 2; - except - Log.LogStatus( 'ERROR Could not assign resource' , Identifier); - beep; - Exit; - end; - - Result := IMG_Load_RW(TexRWops,0); - SDL_FreeRW(TexRWops); - finally - freeandnil( lResData ); - end; - end - else - begin - Log.LogStatus( 'NOT found in Resource', ' LoadImage' ); - end; - {$ENDIF} - - - end; -end; - -procedure TTextureUnit.AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); -var - TempSurface: PSDL_Surface; - NeededPixFmt: PSDL_Pixelformat; -begin - NeededPixFmt:=@fmt_rgba; - if Typ= 'Plain' then NeededPixFmt:=@fmt_rgb - else - if (Typ='Transparent') or - (Typ='Colorized') - then NeededPixFmt:=@fmt_rgba - else - NeededPixFmt:=@fmt_rgb; - - - if not pixfmt_eq(TexSurface^.format, NeededPixFmt) then - begin - TempSurface:=TexSurface; - TexSurface:=SDL_ConvertSurface(TempSurface,NeededPixFmt,SDL_SWSURFACE); - SDL_FreeSurface(TempSurface); - end; -end; - -function TTextureUnit.GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; -var - TempSurface: PSDL_Surface; -begin - TempSurface:=TexSurface; - Result:=SDL_ScaleSurfaceRect(TempSurface, - 0,0,TempSurface^.W,TempSurface^.H, - W,H); -end; - -procedure TTextureUnit.ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); -var - TempSurface: PSDL_Surface; -begin - TempSurface:=TexSurface; - TexSurface:=SDL_ScaleSurfaceRect(TempSurface, - 0,0,TempSurface^.W,TempSurface^.H, - W,H); - SDL_FreeSurface(TempSurface); -end; - -procedure TTextureUnit.FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); -var - TempSurface: PSDL_Surface; -begin - TempSurface:=TexSurface; - with TempSurface^.format^ do - TexSurface:=SDL_CreateRGBSurface(SDL_SWSURFACE,W,H,BitsPerPixel,RMask, GMask, BMask, AMask); - SDL_SetAlpha(TexSurface, 0, 255); - SDL_SetAlpha(TempSurface, 0, 255); - SDL_BlitSurface(TempSurface,nil,TexSurface,nil); - SDL_FreeSurface(TempSurface); -end; - -procedure TTextureUnit.ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); - //returns hue within range [0.0-6.0) - function col2h(Color:Cardinal):double; - var - clr,hls: array[0..2] of double; - delta: double; - begin - clr[0]:=((Color and $ff0000) shr 16)/255; - clr[1]:=((Color and $ff00) shr 8)/255; - clr[2]:=(Color and $ff)/255; - hls[1]:=maxvalue(clr); - delta:=hls[1]-minvalue(clr); - if clr[0]=hls[1] then hls[0]:=(clr[1]-clr[2])/delta - else if clr[1]=hls[1] then hls[0]:=2.0+(clr[2]-clr[0])/delta - else if clr[2]=hls[1] then hls[0]:=4.0+(clr[0]-clr[1])/delta; - if hls[0]<0.0 then hls[0]:=hls[0]+6.0; - if hls[0]=6.0 then hls[0]:=0.0; - col2h:=hls[0]; - end; - procedure ColorizePixel(Pix: PByteArray; hue: Double); - var - i,j,k: Cardinal; - clr, hls: array[0..2] of Double; - delta, f, p, q, t: Double; - begin - hls[0]:=hue; - - clr[0] := Pix[0]/255; - clr[1] := Pix[1]/255; - clr[2] := Pix[2]/255; - - //calculate luminance and saturation from rgb - hls[1] := maxvalue(clr); //l:=... - delta := hls[1] - minvalue(clr); - - if hls[1] = 0.0 then - hls[2] := 0.0 - else - hls[2] := delta/hls[1]; //v:=... - - // calc new rgb from our hls (h from color, l ans s from pixel) - // if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense - begin - k:=trunc(hls[0]); - f:=hls[0]-k; - p:=hls[1]*(1.0-hls[2]); - q:=hls[1]*(1.0-(hls[2]*f)); - t:=hls[1]*(1.0-(hls[2]*(1.0-f))); - case k of - 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end; - 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end; - 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end; - 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end; - 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end; - 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; - end; - // and store new rgb back into the image - Pix[0]:=floor(255*clr[0]); - Pix[1]:=floor(255*clr[1]); - Pix[2]:=floor(255*clr[2]); - end; - end; - -var - DestinationHue: Double; - PixelIndex: Cardinal; -begin - DestinationHue:=col2h(Col); - for PixelIndex:=0 to (TexSurface^.W*TexSurface^.H -1) do - ColorizePixel(@(PByteArray(TexSurface^.Pixels)[PixelIndex*TexSurface^.format.BytesPerPixel]),DestinationHue); -end; - -function TTextureUnit.LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; -var - TexSurface: PSDL_Surface; - MipmapSurface: PSDL_Surface; - newWidth, newHeight: Cardinal; - oldWidth, oldHeight: Cardinal; - kopierindex: Cardinal; -begin - Log.BenchmarkStart(4); - Mipmapping := true; -(* - Log.LogStatus( '', '' ); - - if Identifier = nil then - Log.LogStatus(' ERROR unknown Identifier', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+'''') - else - Log.LogStatus(' should be ok - trying to load', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+''''); -*) - - // load texture data into memory - {$ifdef blindydebug} - Log.LogStatus('',' LoadImage('''+Identifier+''') (called by '+Format+')'); - {$endif} - TexSurface := LoadImage(Identifier); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - {$endif} - if not assigned(TexSurface) then - begin - Log.LogStatus( 'ERROR Could not load texture' , Identifier +' '+ Format +' '+ Typ ); - beep; - Exit; - end; - // convert pixel format as needed - {$ifdef blindydebug} - Log.LogStatus('',' AdjustPixelFormat'); - {$endif} - AdjustPixelFormat(TexSurface, Typ); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - {$endif} - // adjust texture size (scale down, if necessary) - newWidth:=TexSurface.W; - newHeight:=TexSurface.H; - if (newWidth > Limit) then - newWidth:=Limit; - if (newHeight > Limit) then - newHeight:=Limit; - if (TexSurface.W > newWidth) or (TexSurface.H > newHeight) then - begin - {$ifdef blindydebug} - Log.LogStatus('',' ScaleTexture'); - {$endif} - ScaleTexture(TexSurface,newWidth,newHeight); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - {$endif} - end; - - // don't actually understand, if this is needed... - // this should definately be changed... together with all this - // cover cache stuff - if (CreateCacheMipmap) and (Typ='Plain') then - begin - if (Covers.W <= 256) and (Covers.H <= 256) then - begin - {$ifdef blindydebug} - Log.LogStatus('',' GetScaledTexture('''+inttostr(Covers.W)+''','''+inttostr(Covers.H)+''') (for CacheMipmap)'); - {$endif} - MipmapSurface:=GetScaledTexture(TexSurface,Covers.W, Covers.H); - if assigned(MipmapSurface) then - begin - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - Log.LogStatus('',' BlitSurface Stuff'); - {$endif} - // creating and freeing the surface could be done once, if Cover.W and Cover.H don't change - CacheMipmapSurface:=SDL_CreateRGBSurfaceFrom(@CacheMipmap[0], Covers.W, Covers.H, 24, Covers.W*3, $000000ff, $0000ff00, $00ff0000, 0); - SDL_BlitSurface(MipMapSurface,nil,CacheMipmapSurface,nil); - SDL_FreeSurface(CacheMipmapSurface); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - Log.LogStatus('',' SDL_FreeSurface (CacheMipmap)'); - {$endif} - SDL_FreeSurface(MipmapSurface); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - {$endif} - end - else - begin - Log.LogStatus(' Error creating CacheMipmap',' LoadTexture('''+Identifier+''')'); - end; - end; - // should i create a cache texture, if Covers.W/H are larger? - end; - - // now we might colorize the whole thing - if Typ='Colorized' then ColorizeTexture(TexSurface,Col); - // save actual dimensions of our texture - oldWidth:=newWidth; - oldHeight:=newHeight; - // make texture dimensions be powers of 2 - newWidth:=Round(Power(2, Ceil(Log2(newWidth)))); - newHeight:=Round(Power(2, Ceil(Log2(newHeight)))); - if (newHeight <> oldHeight) or (newWidth <> oldWidth) then - FitTexture(TexSurface,newWidth,newHeight); - - // at this point we have the image in memory... - // scaled to be at most 1024x1024 pixels large - // scaled so that dimensions are powers of 2 - // and converted to either RGB or RGBA - - - // if we got a Texture of Type Plain, Transparent or Colorized, - // then we're done manipulating it - // and could now create our openGL texture from it - - // prepare OpenGL texture - glGenTextures(1, ActTex); - glBindTexture(GL_TEXTURE_2D, ActTex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - // load data into gl texture - if (Typ = 'Transparent') or (Typ='Colorized') then begin - glTexImage2D(GL_TEXTURE_2D, 0, 4, newWidth, newHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, TexSurface.pixels); - end - {if Typ = 'Plain' then} else - begin - glTexImage2D(GL_TEXTURE_2D, 0, 3, newWidth, newHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, TexSurface.pixels); - end; -{ - if Typ = 'Transparent Range' then - // set alpha to 256-green-component (not sure) - Pix := TextureB.Canvas.Pixels[Position2, Position]; - TextureD32[Position*TexNewW + Position2+1, 1] := Pix; - TextureD32[Position*TexNewW + Position2+1, 2] := Pix div 256; - TextureD32[Position*TexNewW + Position2+1, 3] := Pix div (256*256); - TextureD32[Position*TexNewW + Position2+1, 4] := 256 - Pix div 256; -} -{ - if Typ = 'Font' then - // either create luminance-alpha texture - // or use transparency from differently saved file - // or do something totally different (text engine with ttf) - Pix := PPix[Position2 * 3]; - TextureD16[Position*TextureB.Width + Position2 + 1, 1] := 255; - TextureD16[Position*TextureB.Width + Position2 + 1, 2] := Pix; - glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); -} -{ - if Typ = 'Font Outline' then - // no idea... - begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - - Col := Pix; - if Col < 127 then Col := 127; - - TempA := Pix; - if TempA >= 95 then TempA := 255; - if TempA >= 31 then TempA := 255; - if Pix < 95 then TempA := (Pix * 256) div 96; - - - TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; - TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - end; -} -{ - if Typ = 'Font Outline 2' then - // same as above - begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - - Col := Pix; - if Col < 31 then Col := 31; - - TempA := Pix; - if TempA >= 31 then TempA := 255; - if Pix < 31 then TempA := Pix * (256 div 32); - - TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; - TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - if Error > 0 then beep; - end; - end; - - if Typ = 'Font Black' then - // and so on - begin - // normalnie 0,125s bez niczego 0,015s - 0,030s z pix 0,125s <-- ??? - // dimensions - TextureB.PixelFormat := pf24bit; - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2*3]; - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; - - if Typ = 'Alpha Black Colored' then - // ... hope, noone needs this - begin - TextureB.PixelFormat := pf24bit; - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2*3]; - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := (Col div $10000) and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Col div $100) and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Col and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; - - if Typ = 'Font Gray' then - begin - // dimensions - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TextureB.Height-1 do begin - for Position2 := 0 to TextureB.Width-1 do begin - Pix := TextureB.Canvas.Pixels[Position2, Position]; - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 127; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 127; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 127; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; - - if Typ = 'Arrow' then - begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - - // transparency - if Pix >= 127 then TempA := 255; - if Pix < 127 then TempA := Pix * 2; - - // ColInt = color intensity - if Pix < 127 then ColInt := 1; - if Pix >= 127 then ColInt := 2 - Pix / 128; - //0.75, 0.6, 0.25 - - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Round(ColInt * 0.75 * 255 + (1 - ColInt) * 255); - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := Round(ColInt * 0.6 * 255 + (1 - ColInt) * 255); - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Round(ColInt * 0.25 * 255 + (1 - ColInt) * 255); - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - - if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - if Error > 0 then beep; - end; - end; - - if Typ = 'Note Plain' then - begin - for Position := 0 to TextureB.Height-1 do - begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do - begin - - - - // Skin Patch - // 0-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White - case PPix[Position2*3] of - 0..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); - 192: Pix := Col; - 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); - 255: Pix := $FFFFFF; - end; -// 0.5.0. Original -// case PPix[Position2*3] of -// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; -// 192: Pix := Col; -// 255: Pix := $FFFFFF; -// end; - - - - - - TextureD24[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; - TextureD24[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; - TextureD24[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureB.Width, TextureB.Height, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); - end; - - if Typ = 'Note Transparent' then - begin - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - TempA := 255; - - - - //Skin Patch - // 0= Transparent, 1-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White - case PPix[Position2*3] of - 0: TempA := 0; - 1..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); - 192: Pix := Col; - 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); - 255: Pix := $FFFFFF; - end; -// 0.5.0 Original -// case PPix[Position2*3] of -// 0: TempA := 0; -// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; -// 192: Pix := Col; -// 255: Pix := $FFFFFF; -// end; - - - - - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; -} - - Result.X := 0; - Result.Y := 0; - Result.W := 0; - Result.H := 0; - Result.ScaleW := 1; - Result.ScaleH := 1; - Result.Rot := 0; - Result.TexNum := ActTex; - Result.TexW := oldWidth / newWidth; - Result.TexH := oldHeight / newHeight; - - Result.Int := 1; - Result.ColR := 1; - Result.ColG := 1; - Result.ColB := 1; - Result.Alpha := 1; - - // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these - Result.TexX1 := 0; - Result.TexY1 := 0; - Result.TexX2 := 1; - Result.TexY2 := 1; - - // 0.5.0 - Result.Name := Identifier; - - SDL_FreeSurface(TexSurface); - - - Log.BenchmarkEnd(4); - if Log.BenchmarkTimeLength[4] >= 1 then - Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4); -end; - - -function TTextureUnit.GetTexture(Name, Typ: string): TTexture; -begin - Result := GetTexture(Name, Typ, true); -end; - -function TTextureUnit.GetTexture(Name, Typ: string; FromCache: boolean): TTexture; -var - T: integer; // texture - C: integer; // cover - Data: array of byte; -begin - - if Name = '' then - exit; - - // find texture entry - T := FindTexture(Name); - - if T = -1 then - begin - // create texture entry - T := Length(TextureDatabase.Texture); - SetLength(TextureDatabase.Texture, T+1); - - TextureDatabase.Texture[T].Name := Name; - TextureDatabase.Texture[T].Typ := Typ; - - // inform database that no textures have been loaded into memory - TextureDatabase.Texture[T].Texture.TexNum := -1; - TextureDatabase.Texture[T].TextureCache.TexNum := -1; - end; - - // use preloaded texture - if (not FromCache) or (FromCache and not Covers.CoverExists(Name)) then - begin - // use full texture - if TextureDatabase.Texture[T].Texture.TexNum = -1 then - begin - // load texture - {$ifdef blindydebug} - Log.LogStatus('...', 'GetTexture('''+Name+''','''+Typ+''')'); - {$endif} - TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', pchar(Typ), $0); - {$ifdef blindydebug} - Log.LogStatus('done',' '); - {$endif} - end; - - // use texture - Result := TextureDatabase.Texture[T].Texture; - end; - - if FromCache and Covers.CoverExists(Name) then - begin - // use cache texture - C := Covers.CoverNumber(Name); - - if TextureDatabase.Texture[T].TextureCache.TexNum = -1 then - begin - // load texture - Covers.PrepareData(Name); - TextureDatabase.Texture[T].TextureCache := CreateTexture(Covers.Data, Name, Covers.Cover[C].W, Covers.Cover[C].H, 24); - end; - - // use texture - Result := TextureDatabase.Texture[T].TextureCache; - end; -end; - -function TTextureUnit.FindTexture(Name: string): integer; -var - T: integer; // texture -begin - Result := -1; - for T := 0 to high(TextureDatabase.Texture) do - if TextureDatabase.Texture[T].Name = Name then - Result := T; -end; - -function TTextureUnit.LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; -begin - Result := LoadTexture(false, Identifier, Format, Typ, Col); -end; - -function TTextureUnit.LoadTexture(Identifier: string): TTexture; -begin - Result := LoadTexture(false, pchar(Identifier), 'JPG', 'Plain', 0); -end; - -function TTextureUnit.CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; -var - Position: integer; - Position2: integer; - Pix: integer; - ColInt: real; - PPix: PByteArray; - TempA: integer; - Error: integer; -begin - Mipmapping := false; - - glGenTextures(1, ActTex); // ActText = new texture number - glBindTexture(GL_TEXTURE_2D, ActTex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - glTexImage2D(GL_TEXTURE_2D, 0, 3, W, H, 0, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, W, H, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); - if Error > 0 then beep; - end; - - Result.X := 0; - Result.Y := 0; - Result.W := 0; - Result.H := 0; - Result.ScaleW := 1; - Result.ScaleH := 1; - Result.Rot := 0; - Result.TexNum := ActTex; - Result.TexW := 1; - Result.TexH := 1; - - Result.Int := 1; - Result.ColR := 1; - Result.ColG := 1; - Result.ColB := 1; - Result.Alpha := 1; - - // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these - Result.TexX1 := 0; - Result.TexY1 := 0; - Result.TexX2 := 1; - Result.TexY2 := 1; - - // 0.5.0 - Result.Name := Name; -end; - -procedure TTextureUnit.UnloadTexture(Name: string; FromCache: boolean); -var - T: integer; - TexNum: GLuint; -begin - T := FindTexture(Name); - - if not FromCache then begin - TexNum := TextureDatabase.Texture[T].Texture.TexNum; - if TexNum >= 0 then begin - glDeleteTextures(1, @TexNum); - TextureDatabase.Texture[T].Texture.TexNum := -1; -// Log.LogError('Unload texture no '+IntToStr(TexNum)); - end; - end else begin - TexNum := TextureDatabase.Texture[T].TextureCache.TexNum; - if TexNum >= 0 then begin - glDeleteTextures(1, @TexNum); - TextureDatabase.Texture[T].TextureCache.TexNum := -1; -// Log.LogError('Unload texture cache no '+IntToStr(TexNum)); - end; - end; -end; - -{$IFDEF FPC} -{$IFDEF win32} -initialization - {$I UltraStar.lrs} -{$ENDIF} -{$ENDIF} - - -end. +unit UTexture; +// added for easier debug disabling +{$define blindydebug} + +// Plain (alpha = 1) +// Transparent +// Colorized + +// obsolete? +// Transparent Range +// Font (white is drawn, black is transparent) +// Font Outline (Font with darker outline) +// Font Outline 2 (Font with darker outline) +// Font Black (black is drawn, white is transparent) +// Font Gray (gray is drawn, white is transparent) +// Arrow (for arrows, white is white, gray has color, black is transparent); + +interface + +{$I switches.inc} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses OpenGL12, + {$IFDEF win32} + windows, + {$ENDIF} + Math, + Classes, + SysUtils, + Graphics, + UCommon, + UThemes, + SDL, + sdlutils, + SDL_Image; + + + {$IFDEF Win32} + procedure glGenTextures(n: GLsizei; var textures: GLuint); stdcall; external opengl32; + +(* + {$ELSE} + {$ifdef darwin} + const opengl32 = '/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib'; + {$ELSE} + const opengl32 = 'libGL.so' ; // YES Capital GL + {$ENDIF} + + procedure glGenTextures(n: GLsizei; var textures: PGLuint); stdcall; external opengl32; +*) + {$ENDIF} + +type + TTexture = record + TexNum: integer; + X: real; + Y: real; + Z: real; // new + W: real; + H: real; + ScaleW: real; // for dynamic scalling while leaving width constant + ScaleH: real; // for dynamic scalling while leaving height constant + Rot: real; // 0 - 2*pi + Int: real; // intensity + ColR: real; + ColG: real; + ColB: real; + TexW: real; // used? + TexH: real; // used? + TexX1: real; + TexY1: real; + TexX2: real; + TexY2: real; + Alpha: real; + Name: string; // 0.5.0: experimental for handling cache images. maybe it's useful for dynamic skins + end; + + TTextureEntry = record + Name: string; + Typ: string; + + // we use normal TTexture, it's easier to implement and if needed - we copy ready data + Texture: TTexture; + TextureCache: TTexture; // 0.5.0 + end; + + TTextureDatabase = record + Texture: array of TTextureEntry; + end; + + TTextureUnit = class + + private + function LoadImage(Identifier: PChar): PSDL_Surface; + function pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; + procedure AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); + function GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; + procedure ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); + procedure FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); + procedure ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); + + public + Limit: integer; + CreateCacheMipmap: boolean; + +// function GetNumberFor + function GetTexture(Name, Typ: string): TTexture; overload; + function GetTexture(Name, Typ: string; FromCache: boolean): TTexture; overload; + function FindTexture(Name: string): integer; + function LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; + function LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; + function LoadTexture(Identifier: string): TTexture; overload; + function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; + procedure UnloadTexture(Name: string; FromCache: boolean); + Constructor Create; + Destructor Destroy; + end; + +var + Texture: TTextureUnit; + TextureDatabase: TTextureDatabase; + + // this should be in UDisplay?! + PrintScreenData: array[0..1024*768-1] of longword; + + ActTex: GLuint;//integer; + +// TextureD8: array[1..1024*1024] of byte; // 1MB + TextureD16: array[1..1024*1024, 1..2] of byte; // luminance/alpha tex (2MB) +// TextureD24: array[1..1024*1024, 1..3] of byte; // normal 24-bit tex (3MB) +// TextureD242: array[1..512*512, 1..3] of byte; // normal 24-bit tex (0,75MB) +// TextureD32: array[1..1024*1024, 1..4] of byte; // transparent 32-bit tex (4MB) + // total 40MB at 2048*2048 + // total 10MB at 1024*1024 + + Mipmapping: Boolean; + + CacheMipmap: array[0..256*256*3-1] of byte; // 3KB + CacheMipmapSurface: PSDL_Surface; + + +implementation + +uses ULog, + DateUtils, + UCovers, + {$IFDEF FPC} + LResources, + {$ENDIF} + StrUtils, dialogs; + +const + fmt_rgba: TSDL_Pixelformat=(palette: nil; + BitsPerPixel: 32; + BytesPerPixel: 4; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 24; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $ff000000; + ColorKey: 0; + Alpha: 255); + fmt_rgb: TSDL_Pixelformat=( palette: nil; + BitsPerPixel: 24; + BytesPerPixel: 3; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 0; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $00000000; + ColorKey: 0; + Alpha: 255); + + +Constructor TTextureUnit.Create; +begin + inherited Create; +end; + +Destructor TTextureUnit.Destroy; +begin + inherited Destroy; +end; + +function TTextureUnit.pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; +begin + if (fmt1^.BitsPerPixel = fmt2^.BitsPerPixel) and + (fmt1^.BytesPerPixel = fmt2^.BytesPerPixel) and + (fmt1^.Rloss = fmt2^.Rloss) and (fmt1^.Gloss = fmt2^.Gloss) and + (fmt1^.Bloss = fmt2^.Bloss) and (fmt1^.Rmask = fmt2^.Rmask) and + (fmt1^.Gmask = fmt2^.Gmask) and (fmt1^.Bmask = fmt2^.Bmask) and + (fmt1^.Rshift = fmt2^.Rshift) and (fmt1^.Gshift = fmt2^.Gshift) and + (fmt1^.Bshift = fmt2^.Bshift) + then + Result:=True + else + Result:=False; +end; + +// +++++++++++++++++++++ helpers for loadimage +++++++++++++++ + function SdlStreamSeek( context : PSDL_RWops; offset : Integer; whence : Integer ) : integer; cdecl; + var + stream : TStream; + origin : Word; + begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamSeek on nil' ); + case whence of + 0 : origin := soFromBeginning; // Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0. + 1 : origin := soFromCurrent; // Offset is from the current position in the resource. Seek moves to Position + Offset. + 2 : origin := soFromEnd; + else + origin := soFromBeginning; // just in case + end; + Result := stream.Seek( offset, origin ); + end; + function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : Integer; maxnum: Integer ) : Integer; cdecl; + var + stream : TStream; + begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamRead on nil' ); + try + Result := stream.read( Ptr^, Size * maxnum ) div size; + except + Result := -1; + end; + end; + function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl; + var + stream : TStream; + begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamClose on nil' ); + stream.Free; + Result := 1; + end; +// ----------------------------------------------- + +function TTextureUnit.LoadImage(Identifier: PChar): PSDL_Surface; +var + + TexRWops: PSDL_RWops; + dHandle: THandle; + + {$IFDEF FPC} + lLazRes : TLResource; + lResData : TStringStream; + {$ELSE} + TexStream: TStream; + {$ENDIF} + +begin + Result := nil; + TexRWops := nil; + +// Log.LogStatus( Identifier, 'LoadImage' ); + + if ( FileExists(Identifier) ) then + begin + // load from file + Log.LogStatus( 'Is File', ' LoadImage' ); + try + Result:=IMG_Load(Identifier); + except + Log.LogStatus( 'ERROR Could not load from file' , Identifier); + beep; + Exit; + end; + end + else + begin + Log.LogStatus( 'IS Resource, because file does not exist.('+Identifier+')', ' LoadImage' ); + + // load from resource stream + {$IFNDEF FPC} + dHandle := FindResource(hInstance, Identifier, 'TEX'); + if dHandle=0 then + begin + Log.LogStatus( 'ERROR Could not find resource' , ' '+ Identifier); + beep; + Exit; + end; + + + TexStream := nil; + try + TexStream := TResourceStream.Create(HInstance, Identifier, 'TEX'); + except + Log.LogStatus( 'ERROR Could not load from resource' , Identifier); + beep; + Exit; + end; + + try + TexStream.position := 0; + try + TexRWops := SDL_AllocRW; + TexRWops.unknown := TUnknown(TexStream); + TexRWops.seek := SDLStreamSeek; + TexRWops.read := SDLStreamRead; + TexRWops.write := nil; + TexRWops.close := SDLStreamClose; + TexRWops.type_ := 2; + except + Log.LogStatus( 'ERROR Could not assign resource' , Identifier); + beep; + Exit; + end; + + Log.LogStatus( 'resource Assigned....' , Identifier); + Result:=IMG_Load_RW(TexRWops,0); + SDL_FreeRW(TexRWops); + + finally + if assigned( TexStream ) then + freeandnil( TexStream ); + end; + + + {$ELSE} + lLazRes := LazFindResource( Identifier, 'TEX' ); + if lLazRes <> nil then + begin + lResData := TStringStream.create( lLazRes.value ); + try + lResData.position := 0; + try + TexRWops := SDL_AllocRW; + TexRWops.unknown := TUnknown( lResData ); + TexRWops.seek := SDLStreamSeek; + TexRWops.read := SDLStreamRead; + TexRWops.write := nil; + TexRWops.close := SDLStreamClose; + TexRWops.type_ := 2; + except + Log.LogStatus( 'ERROR Could not assign resource ('+Identifier+')' , Identifier); + beep; + Exit; + end; + + Result := IMG_Load_RW(TexRWops,0); + SDL_FreeRW(TexRWops); + finally + freeandnil( lResData ); + end; + end + else + begin + Log.LogStatus( 'NOT found in Resource ('+Identifier+')', ' LoadImage' ); + end; + {$ENDIF} + + + end; +end; + +procedure TTextureUnit.AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); +var + TempSurface: PSDL_Surface; + NeededPixFmt: PSDL_Pixelformat; +begin + NeededPixFmt:=@fmt_rgba; + if Typ= 'Plain' then NeededPixFmt:=@fmt_rgb + else + if (Typ='Transparent') or + (Typ='Colorized') + then NeededPixFmt:=@fmt_rgba + else + NeededPixFmt:=@fmt_rgb; + + + if not pixfmt_eq(TexSurface^.format, NeededPixFmt) then + begin + TempSurface:=TexSurface; + TexSurface:=SDL_ConvertSurface(TempSurface,NeededPixFmt,SDL_SWSURFACE); + SDL_FreeSurface(TempSurface); + end; +end; + +function TTextureUnit.GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; +var + TempSurface: PSDL_Surface; +begin + TempSurface:=TexSurface; + Result:=SDL_ScaleSurfaceRect(TempSurface, + 0,0,TempSurface^.W,TempSurface^.H, + W,H); +end; + +procedure TTextureUnit.ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); +var + TempSurface: PSDL_Surface; +begin + TempSurface:=TexSurface; + TexSurface:=SDL_ScaleSurfaceRect(TempSurface, + 0,0,TempSurface^.W,TempSurface^.H, + W,H); + SDL_FreeSurface(TempSurface); +end; + +procedure TTextureUnit.FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); +var + TempSurface: PSDL_Surface; +begin + TempSurface:=TexSurface; + with TempSurface^.format^ do + TexSurface:=SDL_CreateRGBSurface(SDL_SWSURFACE,W,H,BitsPerPixel,RMask, GMask, BMask, AMask); + SDL_SetAlpha(TexSurface, 0, 255); + SDL_SetAlpha(TempSurface, 0, 255); + SDL_BlitSurface(TempSurface,nil,TexSurface,nil); + SDL_FreeSurface(TempSurface); +end; + +procedure TTextureUnit.ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); + //returns hue within range [0.0-6.0) + function col2h(Color:Cardinal):double; + var + clr,hls: array[0..2] of double; + delta: double; + begin + clr[0]:=((Color and $ff0000) shr 16)/255; + clr[1]:=((Color and $ff00) shr 8)/255; + clr[2]:=(Color and $ff)/255; + hls[1]:=maxvalue(clr); + delta:=hls[1]-minvalue(clr); + if clr[0]=hls[1] then hls[0]:=(clr[1]-clr[2])/delta + else if clr[1]=hls[1] then hls[0]:=2.0+(clr[2]-clr[0])/delta + else if clr[2]=hls[1] then hls[0]:=4.0+(clr[0]-clr[1])/delta; + if hls[0]<0.0 then hls[0]:=hls[0]+6.0; + if hls[0]=6.0 then hls[0]:=0.0; + col2h:=hls[0]; + end; + procedure ColorizePixel(Pix: PByteArray; hue: Double); + var + i,j,k: Cardinal; + clr, hls: array[0..2] of Double; + delta, f, p, q, t: Double; + begin + hls[0]:=hue; + + clr[0] := Pix[0]/255; + clr[1] := Pix[1]/255; + clr[2] := Pix[2]/255; + + //calculate luminance and saturation from rgb + hls[1] := maxvalue(clr); //l:=... + delta := hls[1] - minvalue(clr); + + if hls[1] = 0.0 then + hls[2] := 0.0 + else + hls[2] := delta/hls[1]; //v:=... + + // calc new rgb from our hls (h from color, l ans s from pixel) + // if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense + begin + k:=trunc(hls[0]); + f:=hls[0]-k; + p:=hls[1]*(1.0-hls[2]); + q:=hls[1]*(1.0-(hls[2]*f)); + t:=hls[1]*(1.0-(hls[2]*(1.0-f))); + case k of + 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end; + 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end; + 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end; + 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end; + 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end; + 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; + end; + // and store new rgb back into the image + Pix[0]:=floor(255*clr[0]); + Pix[1]:=floor(255*clr[1]); + Pix[2]:=floor(255*clr[2]); + end; + end; + +var + DestinationHue: Double; + PixelIndex: Cardinal; +begin + DestinationHue:=col2h(Col); + for PixelIndex:=0 to (TexSurface^.W*TexSurface^.H -1) do + ColorizePixel(@(PByteArray(TexSurface^.Pixels)[PixelIndex*TexSurface^.format.BytesPerPixel]),DestinationHue); +end; + +function TTextureUnit.LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; +var + TexSurface: PSDL_Surface; + MipmapSurface: PSDL_Surface; + newWidth, newHeight: Cardinal; + oldWidth, oldHeight: Cardinal; + kopierindex: Cardinal; +begin + Log.BenchmarkStart(4); + Mipmapping := true; +(* + Log.LogStatus( '', '' ); + + if Identifier = nil then + Log.LogStatus(' ERROR unknown Identifier', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+'''') + else + Log.LogStatus(' should be ok - trying to load', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+''''); +*) + + // load texture data into memory + {$ifdef blindydebug} + Log.LogStatus('',' LoadImage('''+Identifier+''') (called by '+Format+')'); + {$endif} + TexSurface := LoadImage(Identifier); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + if not assigned(TexSurface) then + begin + Log.LogStatus( 'ERROR Could not load texture' , Identifier +' '+ Format +' '+ Typ ); + beep; + Exit; + end; + // convert pixel format as needed + {$ifdef blindydebug} + Log.LogStatus('',' AdjustPixelFormat'); + {$endif} + AdjustPixelFormat(TexSurface, Typ); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + // adjust texture size (scale down, if necessary) + newWidth := TexSurface.W; + newHeight := TexSurface.H; + + if (newWidth > Limit) then + newWidth := Limit; + + if (newHeight > Limit) then + newHeight := Limit; + + if (TexSurface.W > newWidth) or (TexSurface.H > newHeight) then + begin + {$ifdef blindydebug} + Log.LogStatus('',' ScaleTexture'); + {$endif} + ScaleTexture(TexSurface,newWidth,newHeight); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + end; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-1'); + {$endif} + + + + // don't actually understand, if this is needed... + // this should definately be changed... together with all this + // cover cache stuff + if (CreateCacheMipmap) and (Typ='Plain') then + begin + if (Covers.W <= 256) and (Covers.H <= 256) then + begin + {$ifdef blindydebug} + Log.LogStatus('',' GetScaledTexture('''+inttostr(Covers.W)+''','''+inttostr(Covers.H)+''') (for CacheMipmap)'); + {$endif} + MipmapSurface:=GetScaledTexture(TexSurface,Covers.W, Covers.H); + if assigned(MipmapSurface) then + begin + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + Log.LogStatus('',' BlitSurface Stuff'); + {$endif} + // creating and freeing the surface could be done once, if Cover.W and Cover.H don't change + CacheMipmapSurface:=SDL_CreateRGBSurfaceFrom(@CacheMipmap[0], Covers.W, Covers.H, 24, Covers.W*3, $000000ff, $0000ff00, $00ff0000, 0); + SDL_BlitSurface(MipMapSurface,nil,CacheMipmapSurface,nil); + SDL_FreeSurface(CacheMipmapSurface); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + Log.LogStatus('',' SDL_FreeSurface (CacheMipmap)'); + {$endif} + SDL_FreeSurface(MipmapSurface); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + end + else + begin + Log.LogStatus(' Error creating CacheMipmap',' LoadTexture('''+Identifier+''')'); + end; + end; + // should i create a cache texture, if Covers.W/H are larger? + end; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-2'); + {$endif} + + + // now we might colorize the whole thing + if Typ='Colorized' then + ColorizeTexture(TexSurface,Col); + + // save actual dimensions of our texture + oldWidth:=newWidth; + oldHeight:=newHeight; + // make texture dimensions be powers of 2 + newWidth:=Round(Power(2, Ceil(Log2(newWidth)))); + newHeight:=Round(Power(2, Ceil(Log2(newHeight)))); + if (newHeight <> oldHeight) or (newWidth <> oldWidth) then + FitTexture(TexSurface,newWidth,newHeight); + + // at this point we have the image in memory... + // scaled to be at most 1024x1024 pixels large + // scaled so that dimensions are powers of 2 + // and converted to either RGB or RGBA + + {$ifdef blindydebug} + Log.LogStatus('',' JB-3'); + {$endif} + + + // if we got a Texture of Type Plain, Transparent or Colorized, + // then we're done manipulating it + // and could now create our openGL texture from it + + // prepare OpenGL texture + + // JB_linux : this is causing AV's on linux... ActText seems to be nil ! + {$IFnDEF win32} + if pointer(ActTex) = nil then + exit; + {$endif} + + glGenTextures(1, @ActTex); + + glBindTexture(GL_TEXTURE_2D, ActTex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + // load data into gl texture + if (Typ = 'Transparent') or (Typ='Colorized') then begin + glTexImage2D(GL_TEXTURE_2D, 0, 4, newWidth, newHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, TexSurface.pixels); + end + {if Typ = 'Plain' then} else + begin + glTexImage2D(GL_TEXTURE_2D, 0, 3, newWidth, newHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, TexSurface.pixels); + end; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-4'); + {$endif} + +{ + if Typ = 'Transparent Range' then + // set alpha to 256-green-component (not sure) + Pix := TextureB.Canvas.Pixels[Position2, Position]; + TextureD32[Position*TexNewW + Position2+1, 1] := Pix; + TextureD32[Position*TexNewW + Position2+1, 2] := Pix div 256; + TextureD32[Position*TexNewW + Position2+1, 3] := Pix div (256*256); + TextureD32[Position*TexNewW + Position2+1, 4] := 256 - Pix div 256; +} +{ + if Typ = 'Font' then + // either create luminance-alpha texture + // or use transparency from differently saved file + // or do something totally different (text engine with ttf) + Pix := PPix[Position2 * 3]; + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := 255; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := Pix; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); +} +{ + if Typ = 'Font Outline' then + // no idea... + begin + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + Col := Pix; + if Col < 127 then Col := 127; + + TempA := Pix; + if TempA >= 95 then TempA := 255; + if TempA >= 31 then TempA := 255; + if Pix < 95 then TempA := (Pix * 256) div 96; + + + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + end; +} +{ + if Typ = 'Font Outline 2' then + // same as above + begin + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + Col := Pix; + if Col < 31 then Col := 31; + + TempA := Pix; + if TempA >= 31 then TempA := 255; + if Pix < 31 then TempA := Pix * (256 div 32); + + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + if Error > 0 then beep; + end; + end; + + if Typ = 'Font Black' then + // and so on + begin + // normalnie 0,125s bez niczego 0,015s - 0,030s z pix 0,125s <-- ??? + // dimensions + TextureB.PixelFormat := pf24bit; + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2*3]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + if Typ = 'Alpha Black Colored' then + // ... hope, noone needs this + begin + TextureB.PixelFormat := pf24bit; + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2*3]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := (Col div $10000) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Col div $100) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Col and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + if Typ = 'Font Gray' then + begin + // dimensions + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + for Position2 := 0 to TextureB.Width-1 do begin + Pix := TextureB.Canvas.Pixels[Position2, Position]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + if Typ = 'Arrow' then + begin + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + // transparency + if Pix >= 127 then TempA := 255; + if Pix < 127 then TempA := Pix * 2; + + // ColInt = color intensity + if Pix < 127 then ColInt := 1; + if Pix >= 127 then ColInt := 2 - Pix / 128; + //0.75, 0.6, 0.25 + + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Round(ColInt * 0.75 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := Round(ColInt * 0.6 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Round(ColInt * 0.25 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + if Error > 0 then beep; + end; + end; + + if Typ = 'Note Plain' then + begin + for Position := 0 to TextureB.Height-1 do + begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do + begin + + + + // Skin Patch + // 0-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White + case PPix[Position2*3] of + 0..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); + 192: Pix := Col; + 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); + 255: Pix := $FFFFFF; + end; +// 0.5.0. Original +// case PPix[Position2*3] of +// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; +// 192: Pix := Col; +// 255: Pix := $FFFFFF; +// end; + + + + + + TextureD24[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; + TextureD24[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; + TextureD24[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureB.Width, TextureB.Height, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); + end; + + if Typ = 'Note Transparent' then + begin + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + TempA := 255; + + + + //Skin Patch + // 0= Transparent, 1-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White + case PPix[Position2*3] of + 0: TempA := 0; + 1..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); + 192: Pix := Col; + 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); + 255: Pix := $FFFFFF; + end; +// 0.5.0 Original +// case PPix[Position2*3] of +// 0: TempA := 0; +// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; +// 192: Pix := Col; +// 255: Pix := $FFFFFF; +// end; + + + + + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; +} + + {$ifdef blindydebug} + Log.LogStatus('',' JB-5'); + {$endif} + + + Result.X := 0; + Result.Y := 0; + Result.W := 0; + Result.H := 0; + Result.ScaleW := 1; + Result.ScaleH := 1; + Result.Rot := 0; + Result.TexNum := ActTex; + Result.TexW := oldWidth / newWidth; + Result.TexH := oldHeight / newHeight; + + Result.Int := 1; + Result.ColR := 1; + Result.ColG := 1; + Result.ColB := 1; + Result.Alpha := 1; + + // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these + Result.TexX1 := 0; + Result.TexY1 := 0; + Result.TexX2 := 1; + Result.TexY2 := 1; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-6'); + {$endif} + + + // 0.5.0 + Result.Name := Identifier; + + SDL_FreeSurface(TexSurface); + + {$ifdef blindydebug} + Log.LogStatus('',' JB-7'); + {$endif} + + + Log.BenchmarkEnd(4); + if Log.BenchmarkTimeLength[4] >= 1 then + Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4); + + {$ifdef blindydebug} + Log.LogStatus('',' JB-8'); + {$endif} + +end; + + +function TTextureUnit.GetTexture(Name, Typ: string): TTexture; +begin + Result := GetTexture(Name, Typ, true); +end; + +function TTextureUnit.GetTexture(Name, Typ: string; FromCache: boolean): TTexture; +var + T: integer; // texture + C: integer; // cover + Data: array of byte; +begin + + if Name = '' then + exit; + + // find texture entry + T := FindTexture(Name); + + if T = -1 then + begin + // create texture entry + T := Length(TextureDatabase.Texture); + SetLength(TextureDatabase.Texture, T+1); + + TextureDatabase.Texture[T].Name := Name; + TextureDatabase.Texture[T].Typ := Typ; + + // inform database that no textures have been loaded into memory + TextureDatabase.Texture[T].Texture.TexNum := -1; + TextureDatabase.Texture[T].TextureCache.TexNum := -1; + end; + + // use preloaded texture + if (not FromCache) or (FromCache and not Covers.CoverExists(Name)) then + begin + // use full texture + if TextureDatabase.Texture[T].Texture.TexNum = -1 then + begin + // load texture + {$ifdef blindydebug} + Log.LogStatus('...', 'GetTexture('''+Name+''','''+Typ+''')'); + {$endif} + TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', pchar(Typ), $0); + {$ifdef blindydebug} + Log.LogStatus('done',' '); + {$endif} + end; + + // use texture + Result := TextureDatabase.Texture[T].Texture; + end; + + if FromCache and Covers.CoverExists(Name) then + begin + // use cache texture + C := Covers.CoverNumber(Name); + + if TextureDatabase.Texture[T].TextureCache.TexNum = -1 then + begin + // load texture + Covers.PrepareData(Name); + TextureDatabase.Texture[T].TextureCache := CreateTexture(Covers.Data, Name, Covers.Cover[C].W, Covers.Cover[C].H, 24); + end; + + // use texture + Result := TextureDatabase.Texture[T].TextureCache; + end; +end; + +function TTextureUnit.FindTexture(Name: string): integer; +var + T: integer; // texture +begin + Result := -1; + for T := 0 to high(TextureDatabase.Texture) do + if TextureDatabase.Texture[T].Name = Name then + Result := T; +end; + +function TTextureUnit.LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; +begin + Result := LoadTexture(false, Identifier, Format, Typ, Col); +end; + +function TTextureUnit.LoadTexture(Identifier: string): TTexture; +begin + Result := LoadTexture(false, pchar(Identifier), 'JPG', 'Plain', 0); +end; + +function TTextureUnit.CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; +var + Position: integer; + Position2: integer; + Pix: integer; + ColInt: real; + PPix: PByteArray; + TempA: integer; + Error: integer; +begin + Mipmapping := false; + + glGenTextures(1, @ActTex); // ActText = new texture number + glBindTexture(GL_TEXTURE_2D, ActTex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + glTexImage2D(GL_TEXTURE_2D, 0, 3, W, H, 0, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, W, H, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); + if Error > 0 then beep; + end; + + Result.X := 0; + Result.Y := 0; + Result.W := 0; + Result.H := 0; + Result.ScaleW := 1; + Result.ScaleH := 1; + Result.Rot := 0; + Result.TexNum := ActTex; + Result.TexW := 1; + Result.TexH := 1; + + Result.Int := 1; + Result.ColR := 1; + Result.ColG := 1; + Result.ColB := 1; + Result.Alpha := 1; + + // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these + Result.TexX1 := 0; + Result.TexY1 := 0; + Result.TexX2 := 1; + Result.TexY2 := 1; + + // 0.5.0 + Result.Name := Name; +end; + +procedure TTextureUnit.UnloadTexture(Name: string; FromCache: boolean); +var + T: integer; + TexNum: GLuint; +begin + T := FindTexture(Name); + + if not FromCache then begin + TexNum := TextureDatabase.Texture[T].Texture.TexNum; + if TexNum >= 0 then begin + glDeleteTextures(1, @TexNum); + TextureDatabase.Texture[T].Texture.TexNum := -1; +// Log.LogError('Unload texture no '+IntToStr(TexNum)); + end; + end else begin + TexNum := TextureDatabase.Texture[T].TextureCache.TexNum; + if TexNum >= 0 then begin + glDeleteTextures(1, @TexNum); + TextureDatabase.Texture[T].TextureCache.TexNum := -1; +// Log.LogError('Unload texture cache no '+IntToStr(TexNum)); + end; + end; +end; + +{$IFDEF FPC} +initialization + {$I UltraStar.lrs} +{$ENDIF} + + +end. diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 9da176df..00b763f0 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -1,2200 +1,2212 @@ -unit UThemes; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -uses - ULog, - IniFiles, - SysUtils, - Classes; - -type - TRGB = record - R: single; - G: single; - B: single; - end; - - TRGBA = record - R, G, B, A: Double; - end; - - TThemeBackground = record - Tex: string; - end; - - TThemeStatic = record - X: integer; - Y: integer; - Z: real; - W: integer; - H: integer; - Color: string; - ColR: real; - ColG: real; - ColB: real; - Tex: string; - Typ: string; - TexX1: real; - TexY1: real; - TexX2: real; - TexY2: real; - //Reflection Mod - Reflection: boolean; - Reflectionspacing: Real; - end; - AThemeStatic = array of TThemeStatic; - - TThemeText = record - X: integer; - Y: integer; - W: integer; - Color: string; - ColR: real; - ColG: real; - ColB: real; - Font: integer; - Size: integer; - Align: integer; - Text: string; - end; - AThemeText = array of TThemeText; - - TThemeButton = record - Text: AThemeText; - X: integer; - Y: integer; - Z: Real; - W: integer; - H: integer; - Color: string; - ColR: real; - ColG: real; - ColB: real; - Int: real; - DColor: string; - DColR: real; - DColG: real; - DColB: real; - DInt: real; - Tex: string; - Typ: string; - - Visible: Boolean; - - //Reflection Mod - Reflection: boolean; - Reflectionspacing: Real; - //Fade Mod - SelectH: integer; - SelectW: integer; - Fade: boolean; - FadeText: boolean; - DeSelectReflectionspacing : Real; - FadeTex: string; - FadeTexPos: integer; - - //Button Collection Mod - Parent: Byte; //Number of the Button Collection this Button is assigned to. IF 0: No Assignement - end; - - //Button Collection Mod - TThemeButtonCollection = record - Style: TThemeButton; - ChildCount: Byte; //No of assigned Childs - FirstChild: Byte; //No of Child on whose Interaction Position the Button should be - end; - - AThemeButtonCollection = array of TThemeButtonCollection; - PAThemeButtonCollection = ^AThemeButtonCollection; - - TThemeSelect = record - Tex: string; - TexSBG: string; - X: integer; - Y: integer; - W: integer; - H: integer; - Text: string; - ColR, ColG, ColB, Int: real; - DColR, DColG, DColB, DInt: real; - TColR, TColG, TColB, TInt: real; - TDColR, TDColG, TDColB, TDInt: real; - SBGColR, SBGColG, SBGColB, SBGInt: real; - SBGDColR, SBGDColG, SBGDColB, SBGDInt: real; - STColR, STColG, STColB, STInt: real; - STDColR, STDColG, STDColB, STDInt: real; - SkipX: integer; - end; - - TThemeSelectSlide = record - Tex: string; - TexSBG: string; - X: integer; - Y: integer; - W: integer; - H: integer; - Z: real; - - TextSize: integer; - - //SBGW Mod - SBGW: integer; - - Text: string; - ColR, ColG, ColB, Int: real; - DColR, DColG, DColB, DInt: real; - TColR, TColG, TColB, TInt: real; - TDColR, TDColG, TDColB, TDInt: real; - SBGColR, SBGColG, SBGColB, SBGInt: real; - SBGDColR, SBGDColG, SBGDColB, SBGDInt: real; - STColR, STColG, STColB, STInt: real; - STDColR, STDColG, STDColB, STDInt: real; - SkipX: integer; - end; - - PThemeBasic = ^TThemeBasic; - TThemeBasic = class - Background: TThemeBackground; - Text: AThemeText; - Static: AThemeStatic; - - //Button Collection Mod - ButtonCollection: AThemeButtonCollection; - end; - - TThemeLoading = class(TThemeBasic) - StaticAnimation: TThemeStatic; - TextLoading: TThemeText; - end; - - TThemeMain = class(TThemeBasic) - ButtonSolo: TThemeButton; - ButtonMulti: TThemeButton; - ButtonStat: TThemeButton; - ButtonEditor: TThemeButton; - ButtonOptions: TThemeButton; - ButtonExit: TThemeButton; - - TextDescription: TThemeText; - TextDescriptionLong: TThemeText; - Description: array[0..5] of string; - DescriptionLong: array[0..5] of string; - end; - - TThemeName = class(TThemeBasic) - ButtonPlayer: array[1..6] of TThemeButton; - end; - - TThemeLevel = class(TThemeBasic) - ButtonEasy: TThemeButton; - ButtonMedium: TThemeButton; - ButtonHard: TThemeButton; - end; - - TThemeSong = class(TThemeBasic) - TextArtist: TThemeText; - TextTitle: TThemeText; - TextNumber: TThemeText; - - //Video Icon Mod - VideoIcon: TThemeStatic; - - //Show Cat in TopLeft Mod - TextCat: TThemeText; - StaticCat: TThemeStatic; - - //Cover Mod - Cover: record - Reflections: Boolean; - X: Integer; - Y: Integer; - Z: Integer; - W: Integer; - H: Integer; - Style: Integer; - end; - - //Equalizer Mod - Equalizer: record - Visible: Boolean; - Direction: Boolean; - Alpha: real; - X: Integer; - Y: Integer; - Z: Real; - W: Integer; - H: Integer; - Space: Integer; - Bands: Integer; - Length: Integer; - ColR, ColG, ColB: Real; - end; - - - //Party and Non Party specific Statics and Texts - StaticParty: AThemeStatic; - TextParty: AThemeText; - - StaticNonParty: AThemeStatic; - TextNonParty: AThemeText; - - //Party Mode - StaticTeam1Joker1: TThemeStatic; - StaticTeam1Joker2: TThemeStatic; - StaticTeam1Joker3: TThemeStatic; - StaticTeam1Joker4: TThemeStatic; - StaticTeam1Joker5: TThemeStatic; - StaticTeam2Joker1: TThemeStatic; - StaticTeam2Joker2: TThemeStatic; - StaticTeam2Joker3: TThemeStatic; - StaticTeam2Joker4: TThemeStatic; - StaticTeam2Joker5: TThemeStatic; - StaticTeam3Joker1: TThemeStatic; - StaticTeam3Joker2: TThemeStatic; - StaticTeam3Joker3: TThemeStatic; - StaticTeam3Joker4: TThemeStatic; - StaticTeam3Joker5: TThemeStatic; - - - end; - - TThemeSing = class(TThemeBasic) - - //TimeBar mod - StaticTimeProgress: TThemeStatic; - TextTimeText : TThemeText; - //eoa TimeBar mod - - StaticP1: TThemeStatic; - TextP1: TThemeText; - StaticP1ScoreBG: TThemeStatic; //Static for ScoreBG - TextP1Score: TThemeText; - - //moveable singbar mod - StaticP1SingBar: TThemeStatic; - StaticP1ThreePSingBar: TThemeStatic; - StaticP1TwoPSingBar: TThemeStatic; - StaticP2RSingBar: TThemeStatic; - StaticP2MSingBar: TThemeStatic; - StaticP3SingBar: TThemeStatic; - //eoa moveable singbar - - //added for ps3 skin - //game in 2/4 player modi - StaticP1TwoP: TThemeStatic; - StaticP1TwoPScoreBG: TThemeStatic; //Static for ScoreBG - TextP1TwoP: TThemeText; - TextP1TwoPScore: TThemeText; - //game in 3/6 player modi - StaticP1ThreeP: TThemeStatic; - StaticP1ThreePScoreBG: TThemeStatic; //Static for ScoreBG - TextP1ThreeP: TThemeText; - TextP1ThreePScore: TThemeText; - //eoa - - StaticP2R: TThemeStatic; - StaticP2RScoreBG: TThemeStatic; //Static for ScoreBG - TextP2R: TThemeText; - TextP2RScore: TThemeText; - - StaticP2M: TThemeStatic; - StaticP2MScoreBG: TThemeStatic; //Static for ScoreBG - TextP2M: TThemeText; - TextP2MScore: TThemeText; - - StaticP3R: TThemeStatic; - StaticP3RScoreBG: TThemeStatic; //Static for ScoreBG - TextP3R: TThemeText; - TextP3RScore: TThemeText; - - //Linebonus Translations - LineBonusText: Array [0..8] of String; - end; - - TThemeScore = class(TThemeBasic) - TextArtist: TThemeText; - TextTitle: TThemeText; - - TextArtistTitle: TThemeText; - - PlayerStatic: array[1..6] of AThemeStatic; - PlayerTexts: array[1..6] of AThemeText; - - TextName: array[1..6] of TThemeText; - TextScore: array[1..6] of TThemeText; - - TextNotes: array[1..6] of TThemeText; - TextNotesScore: array[1..6] of TThemeText; - TextLineBonus: array[1..6] of TThemeText; - TextLineBonusScore: array[1..6] of TThemeText; - TextGoldenNotes: array[1..6] of TThemeText; - TextGoldenNotesScore: array[1..6] of TThemeText; - TextTotal: array[1..6] of TThemeText; - TextTotalScore: array[1..6] of TThemeText; - - StaticBoxLightest: array[1..6] of TThemeStatic; - StaticBoxLight: array[1..6] of TThemeStatic; - StaticBoxDark: array[1..6] of TThemeStatic; - - StaticBackLevel: array[1..6] of TThemeStatic; - StaticBackLevelRound: array[1..6] of TThemeStatic; - StaticLevel: array[1..6] of TThemeStatic; - StaticLevelRound: array[1..6] of TThemeStatic; - -// Description: array[0..5] of string;} - end; - - TThemeTop5 = class(TThemeBasic) - TextLevel: TThemeText; - TextArtistTitle: TThemeText; - - StaticNumber: AThemeStatic; - TextNumber: AThemeText; - TextName: AThemeText; - TextScore: AThemeText; - end; - - TThemeOptions = class(TThemeBasic) - ButtonGame: TThemeButton; - ButtonGraphics: TThemeButton; - ButtonSound: TThemeButton; - ButtonLyrics: TThemeButton; - ButtonThemes: TThemeButton; - ButtonRecord: TThemeButton; - ButtonAdvanced: TThemeButton; - ButtonExit: TThemeButton; - - TextDescription: TThemeText; - Description: array[0..7] of string; - end; - - TThemeOptionsGame = class(TThemeBasic) - SelectPlayers: TThemeSelect; - SelectDifficulty: TThemeSelect; - SelectLanguage: TThemeSelectSlide; - SelectTabs: TThemeSelect; - SelectSorting: TThemeSelectSlide; - SelectDebug: TThemeSelect; - ButtonExit: TThemeButton; - end; - - TThemeOptionsGraphics = class(TThemeBasic) - SelectFullscreen: TThemeSelect; - SelectSlideResolution: TThemeSelectSlide; - SelectDepth: TThemeSelect; - SelectOscilloscope: TThemeSelect; - SelectLineBonus: TThemeSelect; - SelectMovieSize: TThemeSelect; - ButtonExit: TThemeButton; - end; - - TThemeOptionsSound = class(TThemeBasic) - SelectMicBoost: TThemeSelect; - SelectClickAssist: TThemeSelect; - SelectBeatClick: TThemeSelect; - SelectThreshold: TThemeSelect; - //Song Preview - SelectSlidePreviewVolume: TThemeSelectSlide; - SelectSlidePreviewFading: TThemeSelectSlide; - ButtonExit: TThemeButton; - end; - - TThemeOptionsLyrics = class(TThemeBasic) - SelectLyricsFont: TThemeSelect; - SelectLyricsEffect: TThemeSelect; - SelectSolmization: TThemeSelect; - ButtonExit: TThemeButton; - end; - - TThemeOptionsThemes = class(TThemeBasic) - SelectTheme: TThemeSelectSlide; - SelectSkin: TThemeSelectSlide; - SelectColor: TThemeSelectSlide; - ButtonExit: TThemeButton; - end; - - TThemeOptionsRecord = class(TThemeBasic) - SelectSlideCard: TThemeSelectSlide; - SelectSlideInput: TThemeSelectSlide; - SelectSlideChannelL: TThemeSelectSlide; - SelectSlideChannelR: TThemeSelectSlide; - ButtonExit: TThemeButton; - end; - - TThemeOptionsAdvanced = class(TThemeBasic) - SelectLoadAnimation: TThemeSelect; - SelectEffectSing: TThemeSelect; - SelectScreenFade: TThemeSelect; - SelectLineBonus: TThemeSelect; - SelectAskbeforeDel: TThemeSelect; - SelectOnSongClick: TThemeSelectSlide; - SelectPartyPopup: TThemeSelect; - ButtonExit: TThemeButton; - end; - - //Error- and Check-Popup - TThemeError = class(TThemeBasic) - Button1: TThemeButton; - TextError: TThemeText; - end; - - TThemeCheck = class(TThemeBasic) - Button1: TThemeButton; - Button2: TThemeButton; - TextCheck: TThemeText; - end; - - - //ScreenSong Menue - TThemeSongMenu = class(TThemeBasic) - Button1: TThemeButton; - Button2: TThemeButton; - Button3: TThemeButton; - Button4: TThemeButton; - - SelectSlide3: TThemeSelectSlide; - - TextMenu: TThemeText; - end; - - TThemeSongJumpTo = class(TThemeBasic) - ButtonSearchText: TThemeButton; - SelectSlideType: TThemeSelectSlide; - TextFound: TThemeText; - - //Translated Texts - Songsfound: String; - NoSongsfound: String; - CatText: String; - IType: array [0..2] of String; - end; - - //Party Screens - TThemePartyNewRound = class(TThemeBasic) - TextRound1: TThemeText; - TextRound2: TThemeText; - TextRound3: TThemeText; - TextRound4: TThemeText; - TextRound5: TThemeText; - TextRound6: TThemeText; - TextRound7: TThemeText; - TextWinner1: TThemeText; - TextWinner2: TThemeText; - TextWinner3: TThemeText; - TextWinner4: TThemeText; - TextWinner5: TThemeText; - TextWinner6: TThemeText; - TextWinner7: TThemeText; - TextNextRound: TThemeText; - TextNextRoundNo: TThemeText; - TextNextPlayer1: TThemeText; - TextNextPlayer2: TThemeText; - TextNextPlayer3: TThemeText; - - StaticRound1: TThemeStatic; - StaticRound2: TThemeStatic; - StaticRound3: TThemeStatic; - StaticRound4: TThemeStatic; - StaticRound5: TThemeStatic; - StaticRound6: TThemeStatic; - StaticRound7: TThemeStatic; - - TextScoreTeam1: TThemeText; - TextScoreTeam2: TThemeText; - TextScoreTeam3: TThemeText; - TextNameTeam1: TThemeText; - TextNameTeam2: TThemeText; - TextNameTeam3: TThemeText; - TextTeam1Players: TThemeText; - TextTeam2Players: TThemeText; - TextTeam3Players: TThemeText; - - StaticTeam1: TThemeStatic; - StaticTeam2: TThemeStatic; - StaticTeam3: TThemeStatic; - StaticNextPlayer1: TThemeStatic; - StaticNextPlayer2: TThemeStatic; - StaticNextPlayer3: TThemeStatic; - end; - - TThemePartyScore = class(TThemeBasic) - TextScoreTeam1: TThemeText; - TextScoreTeam2: TThemeText; - TextScoreTeam3: TThemeText; - TextNameTeam1: TThemeText; - TextNameTeam2: TThemeText; - TextNameTeam3: TThemeText; - StaticTeam1: TThemeStatic; - StaticTeam1BG: TThemeStatic; - StaticTeam1Deco: TThemeStatic; - StaticTeam2: TThemeStatic; - StaticTeam2BG: TThemeStatic; - StaticTeam2Deco: TThemeStatic; - StaticTeam3: TThemeStatic; - StaticTeam3BG: TThemeStatic; - StaticTeam3Deco: TThemeStatic; - - DecoTextures: record - ChangeTextures: Boolean; - - FirstTexture: String; - FirstTyp: String; - FirstColor: String; - - SecondTexture: String; - SecondTyp: String; - SecondColor: String; - - ThirdTexture: String; - ThirdTyp: String; - ThirdColor: String; - end; - - - TextWinner: TThemeText; - end; - - TThemePartyWin = class(TThemeBasic) - TextScoreTeam1: TThemeText; - TextScoreTeam2: TThemeText; - TextScoreTeam3: TThemeText; - TextNameTeam1: TThemeText; - TextNameTeam2: TThemeText; - TextNameTeam3: TThemeText; - StaticTeam1: TThemeStatic; - StaticTeam1BG: TThemeStatic; - StaticTeam1Deco: TThemeStatic; - StaticTeam2: TThemeStatic; - StaticTeam2BG: TThemeStatic; - StaticTeam2Deco: TThemeStatic; - StaticTeam3: TThemeStatic; - StaticTeam3BG: TThemeStatic; - StaticTeam3Deco: TThemeStatic; - - TextWinner: TThemeText; - end; - - TThemePartyOptions = class(TThemeBasic) - SelectLevel: TThemeSelectSlide; - SelectPlayList: TThemeSelectSlide; - SelectPlayList2: TThemeSelectSlide; - SelectRounds: TThemeSelectSlide; - SelectTeams: TThemeSelectSlide; - SelectPlayers1: TThemeSelectSlide; - SelectPlayers2: TThemeSelectSlide; - SelectPlayers3: TThemeSelectSlide; - - {ButtonNext: TThemeButton; - ButtonPrev: TThemeButton;} - end; - - TThemePartyPlayer = class(TThemeBasic) - Team1Name: TThemeButton; - Player1Name: TThemeButton; - Player2Name: TThemeButton; - Player3Name: TThemeButton; - Player4Name: TThemeButton; - - Team2Name: TThemeButton; - Player5Name: TThemeButton; - Player6Name: TThemeButton; - Player7Name: TThemeButton; - Player8Name: TThemeButton; - - Team3Name: TThemeButton; - Player9Name: TThemeButton; - Player10Name: TThemeButton; - Player11Name: TThemeButton; - Player12Name: TThemeButton; - - {ButtonNext: TThemeButton; - ButtonPrev: TThemeButton;} - end; - - //Stats Screens - TThemeStatMain = class(TThemeBasic) - ButtonScores: TThemeButton; - ButtonSingers: TThemeButton; - ButtonSongs: TThemeButton; - ButtonBands: TThemeButton; - ButtonExit: TThemeButton; - - TextOverview: TThemeText; - end; - - TThemeStatDetail = class(TThemeBasic) - ButtonNext: TThemeButton; - ButtonPrev: TThemeButton; - ButtonReverse: TThemeButton; - ButtonExit: TThemeButton; - - TextDescription: TThemeText; - TextPage: TThemeText; - TextList: AThemeText; - - Description: array[0..3] of string; - DescriptionR: array[0..3] of string; - FormatStr: array[0..3] of string; - PageStr: String; - end; - - //Playlist Translations - TThemePlaylist = record - CatText: string; - end; - - TTheme = class - private - {$IFDEF THEMESAVE} - ThemeIni: TIniFile; - {$ELSE} - ThemeIni: TMemIniFile; - {$ENDIF} - - LastThemeBasic: TThemeBasic; - public - - Loading: TThemeLoading; - Main: TThemeMain; - Name: TThemeName; - Level: TThemeLevel; - Song: TThemeSong; - Sing: TThemeSing; - Score: TThemeScore; - Top5: TThemeTop5; - Options: TThemeOptions; - OptionsGame: TThemeOptionsGame; - OptionsGraphics: TThemeOptionsGraphics; - OptionsSound: TThemeOptionsSound; - OptionsLyrics: TThemeOptionsLyrics; - OptionsThemes: TThemeOptionsThemes; - OptionsRecord: TThemeOptionsRecord; - OptionsAdvanced: TThemeOptionsAdvanced; - //error and check popup - ErrorPopup: TThemeError; - CheckPopup: TThemeCheck; - //ScreenSong extensions - SongMenu: TThemeSongMenu; - SongJumpto: TThemeSongJumpTo; - //Party Screens: - PartyNewRound: TThemePartyNewRound; - PartyScore: TThemePartyScore; - PartyWin: TThemePartyWin; - PartyOptions: TThemePartyOptions; - PartyPlayer: TThemePartyPlayer; - - //Stats Screens: - StatMain: TThemeStatMain; - StatDetail: TThemeStatDetail; - - Playlist: TThemePlaylist; - - ILevel: array[0..2] of String; - - constructor Create(FileName: string); overload; // Initialize theme system - constructor Create(FileName: string; Color: integer); overload; // Initialize theme system with color - function LoadTheme(FileName: string; sColor: integer): boolean; // Load some theme settings from file - - procedure LoadColors; - - procedure ThemeLoadBasic(Theme: TThemeBasic; Name: string); - procedure ThemeLoadBackground(var ThemeBackground: TThemeBackground; Name: string); - procedure ThemeLoadText(var ThemeText: TThemeText; Name: string); - procedure ThemeLoadTexts(var ThemeText: AThemeText; Name: string); - procedure ThemeLoadStatic(var ThemeStatic: TThemeStatic; Name: string); - procedure ThemeLoadStatics(var ThemeStatic: AThemeStatic; Name: string); - procedure ThemeLoadButton(var ThemeButton: TThemeButton; Name: string; const Collections: PAThemeButtonCollection = nil); - procedure ThemeLoadButtonCollection(var Collection: TThemeButtonCollection; Name: string); - procedure ThemeLoadButtonCollections(var Collections: AThemeButtonCollection; Name: string); - procedure ThemeLoadSelect(var ThemeSelect: TThemeSelect; Name: string); - procedure ThemeLoadSelectSlide(var ThemeSelectS: TThemeSelectSlide; Name: string); - - procedure ThemeSave(FileName: string); - procedure ThemeSaveBasic(Theme: TThemeBasic; Name: string); - procedure ThemeSaveBackground(ThemeBackground: TThemeBackground; Name: string); - procedure ThemeSaveStatic(ThemeStatic: TThemeStatic; Name: string); - procedure ThemeSaveStatics(ThemeStatic: AThemeStatic; Name: string); - procedure ThemeSaveText(ThemeText: TThemeText; Name: string); - procedure ThemeSaveTexts(ThemeText: AThemeText; Name: string); - procedure ThemeSaveButton(ThemeButton: TThemeButton; Name: string); - - end; - - TColor = record - Name: string; - RGB: TRGB; - end; - -function ColorExists(Name: string): integer; -procedure LoadColor(var R, G, B: real; ColorName: string); -function GetSystemColor(Color: integer): TRGB; -function ColorSqrt(RGB: TRGB): TRGB; - -var - //Skin: TSkin; - Theme: TTheme; - Color: array of TColor; - -implementation - -uses -{{$IFDEF TRANSLATE} - ULanguage, -{{$ENDIF} - USkins, - UIni; - -constructor TTheme.Create(FileName: string); -begin - Create(FileName, 0); -end; - -constructor TTheme.Create(FileName: string; Color: integer); -begin - Loading := TThemeLoading.Create; - Main := TThemeMain.Create; - Name := TThemeName.Create; - Level := TThemeLevel.Create; - Song := TThemeSong.Create; - Sing := TThemeSing.Create; - Score := TThemeScore.Create; - Top5 := TThemeTop5.Create; - Options := TThemeOptions.Create; - OptionsGame := TThemeOptionsGame.Create; - OptionsGraphics := TThemeOptionsGraphics.Create; - OptionsSound := TThemeOptionsSound.Create; - OptionsLyrics := TThemeOptionsLyrics.Create; - OptionsThemes := TThemeOptionsThemes.Create; - OptionsRecord := TThemeOptionsRecord.Create; - OptionsAdvanced := TThemeOptionsAdvanced.Create; - - ErrorPopup := TThemeError.Create; - CheckPopup := TThemeCheck.Create; - - SongMenu := TThemeSongMenu.Create; - SongJumpto := TThemeSongJumpto.Create; - //Party Screens - PartyNewRound := TThemePartyNewRound.Create; - PartyWin := TThemePartyWin.Create; - PartyScore := TThemePartyScore.Create; - PartyOptions := TThemePartyOptions.Create; - PartyPlayer := TThemePartyPlayer.Create; - - //Stats Screens: - StatMain := TThemeStatMain.Create; - StatDetail := TThemeStatDetail.Create; - - LoadTheme(FileName, Color); - -end; - - -function TTheme.LoadTheme(FileName: string; sColor: integer): boolean; -var - I: integer; - Path: string; -begin - Result := false; - if FileExists(FileName) then begin - Result := true; - - {$IFDEF THEMESAVE} - ThemeIni := TIniFile.Create(FileName); - {$ELSE} - ThemeIni := TMemIniFile.Create(FileName); - {$ENDIF} - - if ThemeIni.ReadString('Theme', 'Name', '') <> '' then begin - - {Skin.SkinName := ThemeIni.ReadString('Theme', 'Name', 'Singstar'); - Skin.SkinPath := 'Skins\' + Skin.SkinName + '\'; - Skin.SkinReg := false; } - Skin.Color := sColor; - - Skin.LoadSkin(ISkin[Ini.SkinNo]); - - LoadColors; - -// ThemeIni.Free; -// ThemeIni := TIniFile.Create('Themes\Singstar\Main.ini'); - - // Loading - ThemeLoadBasic(Loading, 'Loading'); - ThemeLoadText(Loading.TextLoading, 'LoadingTextLoading'); - ThemeLoadStatic(Loading.StaticAnimation, 'LoadingStaticAnimation'); - - // Main - ThemeLoadBasic(Main, 'Main'); - - ThemeLoadText(Main.TextDescription, 'MainTextDescription'); - ThemeLoadText(Main.TextDescriptionLong, 'MainTextDescriptionLong'); - ThemeLoadButton(Main.ButtonSolo, 'MainButtonSolo'); - ThemeLoadButton(Main.ButtonMulti, 'MainButtonMulti'); - ThemeLoadButton(Main.ButtonStat, 'MainButtonStats'); - ThemeLoadButton(Main.ButtonEditor, 'MainButtonEditor'); - ThemeLoadButton(Main.ButtonOptions, 'MainButtonOptions'); - ThemeLoadButton(Main.ButtonExit, 'MainButtonExit'); - - //Main Desc Text Translation Start - - {{$IFDEF TRANSLATE} - Main.Description[0] := Language.Translate('SING_SING'); - Main.DescriptionLong[0] := Language.Translate('SING_SING_DESC'); - Main.Description[1] := Language.Translate('SING_MULTI'); - Main.DescriptionLong[1] := Language.Translate('SING_MULTI_DESC'); - Main.Description[2] := Language.Translate('SING_STATS'); - Main.DescriptionLong[2] := Language.Translate('SING_STATS_DESC'); - Main.Description[3] := Language.Translate('SING_EDITOR'); - Main.DescriptionLong[3] := Language.Translate('SING_EDITOR_DESC'); - Main.Description[4] := Language.Translate('SING_GAME_OPTIONS'); - Main.DescriptionLong[4] := Language.Translate('SING_GAME_OPTIONS_DESC'); - Main.Description[5] := Language.Translate('SING_EXIT'); - Main.DescriptionLong[5] := Language.Translate('SING_EXIT_DESC'); - {{$ENDIF} - - //Main Desc Text Translation End - - Main.TextDescription.Text := Main.Description[0]; - Main.TextDescriptionLong.Text := Main.DescriptionLong[0]; - - // Name - ThemeLoadBasic(Name, 'Name'); - - for I := 1 to 6 do - ThemeLoadButton(Name.ButtonPlayer[I], 'NameButtonPlayer'+IntToStr(I)); - - // Level - ThemeLoadBasic(Level, 'Level'); - - ThemeLoadButton(Level.ButtonEasy, 'LevelButtonEasy'); - ThemeLoadButton(Level.ButtonMedium, 'LevelButtonMedium'); - ThemeLoadButton(Level.ButtonHard, 'LevelButtonHard'); - - - // Song - ThemeLoadBasic(Song, 'Song'); - - ThemeLoadText(Song.TextArtist, 'SongTextArtist'); - ThemeLoadText(Song.TextTitle, 'SongTextTitle'); - ThemeLoadText(Song.TextNumber, 'SongTextNumber'); - - //Video Icon Mod - ThemeLoadStatic(Song.VideoIcon, 'SongVideoIcon'); - - //Show Cat in TopLeft Mod - ThemeLoadStatic(Song.StaticCat, 'SongStaticCat'); - ThemeLoadText(Song.TextCat, 'SongTextCat'); - - //Load Cover Pos and Size from Theme Mod - Song.Cover.X := ThemeIni.ReadInteger('SongCover', 'X', 300); - Song.Cover.Y := ThemeIni.ReadInteger('SongCover', 'Y', 190); - Song.Cover.W := ThemeIni.ReadInteger('SongCover', 'W', 300); - Song.Cover.H := ThemeIni.ReadInteger('SongCover', 'H', 200); - Song.Cover.Style := ThemeIni.ReadInteger('SongCover', 'Style', 4); - Song.Cover.Reflections := (ThemeIni.ReadInteger('SongCover', 'Reflections', 0) = 1); - //Load Cover Pos and Size from Theme Mod End - - //Load Equalizer Pos and Size from Theme Mod - Song.Equalizer.Visible := (ThemeIni.ReadInteger('SongEqualizer', 'Visible', 0) = 1); - Song.Equalizer.Direction := (ThemeIni.ReadInteger('SongEqualizer', 'Direction', 0) = 1); - Song.Equalizer.Alpha := ThemeIni.ReadInteger('SongEqualizer', 'Alpha', 1); - Song.Equalizer.Space := ThemeIni.ReadInteger('SongEqualizer', 'Space', 1); - Song.Equalizer.X := ThemeIni.ReadInteger('SongEqualizer', 'X', 0); - Song.Equalizer.Y := ThemeIni.ReadInteger('SongEqualizer', 'Y', 0); - Song.Equalizer.Z := ThemeIni.ReadInteger('SongEqualizer', 'Z', 1); - Song.Equalizer.W := ThemeIni.ReadInteger('SongEqualizer', 'PieceW', 8); - Song.Equalizer.H := ThemeIni.ReadInteger('SongEqualizer', 'PieceH', 8); - Song.Equalizer.Bands := ThemeIni.ReadInteger('SongEqualizer', 'Bands', 5); - Song.Equalizer.Length := ThemeIni.ReadInteger('SongEqualizer', 'Length', 12); - - //Color - I := ColorExists(ThemeIni.ReadString('SongEqualizer', 'Color', 'Black')); - if I >= 0 then begin - Song.Equalizer.ColR := Color[I].RGB.R; - Song.Equalizer.ColG := Color[I].RGB.G; - Song.Equalizer.ColB := Color[I].RGB.B; - end - else begin - Song.Equalizer.ColR := 0; - Song.Equalizer.ColG := 0; - Song.Equalizer.ColB := 0; - end; - //Load Equalizer Pos and Size from Theme Mod End - - //Party and Non Party specific Statics and Texts - ThemeLoadStatics (Song.StaticParty, 'SongStaticParty'); - ThemeLoadTexts (Song.TextParty, 'SongTextParty'); - - ThemeLoadStatics (Song.StaticNonParty, 'SongStaticNonParty'); - ThemeLoadTexts (Song.TextNonParty, 'SongTextNonParty'); - - //Party Mode - ThemeLoadStatic(Song.StaticTeam1Joker1, 'SongStaticTeam1Joker1'); - ThemeLoadStatic(Song.StaticTeam1Joker2, 'SongStaticTeam1Joker2'); - ThemeLoadStatic(Song.StaticTeam1Joker3, 'SongStaticTeam1Joker3'); - ThemeLoadStatic(Song.StaticTeam1Joker4, 'SongStaticTeam1Joker4'); - ThemeLoadStatic(Song.StaticTeam1Joker5, 'SongStaticTeam1Joker5'); - - ThemeLoadStatic(Song.StaticTeam2Joker1, 'SongStaticTeam2Joker1'); - ThemeLoadStatic(Song.StaticTeam2Joker2, 'SongStaticTeam2Joker2'); - ThemeLoadStatic(Song.StaticTeam2Joker3, 'SongStaticTeam2Joker3'); - ThemeLoadStatic(Song.StaticTeam2Joker4, 'SongStaticTeam2Joker4'); - ThemeLoadStatic(Song.StaticTeam2Joker5, 'SongStaticTeam2Joker5'); - - ThemeLoadStatic(Song.StaticTeam3Joker1, 'SongStaticTeam3Joker1'); - ThemeLoadStatic(Song.StaticTeam3Joker2, 'SongStaticTeam3Joker2'); - ThemeLoadStatic(Song.StaticTeam3Joker3, 'SongStaticTeam3Joker3'); - ThemeLoadStatic(Song.StaticTeam3Joker4, 'SongStaticTeam3Joker4'); - ThemeLoadStatic(Song.StaticTeam3Joker5, 'SongStaticTeam3Joker5'); - - - // Sing - ThemeLoadBasic(Sing, 'Sing'); - - //TimeBar mod - ThemeLoadStatic(Sing.StaticTimeProgress, 'SingTimeProgress'); - ThemeLoadText(Sing.TextTimeText, 'SingTimeText'); - //eoa TimeBar mod - - //moveable singbar mod - ThemeLoadStatic(Sing.StaticP1SingBar, 'SingP1SingBar'); - ThemeLoadStatic(Sing.StaticP1TwoPSingBar, 'SingP1TwoPSingBar'); - ThemeLoadStatic(Sing.StaticP1ThreePSingBar, 'SingP1ThreePSingBar'); - ThemeLoadStatic(Sing.StaticP2RSingBar, 'SingP2RSingBar'); - ThemeLoadStatic(Sing.StaticP2MSingBar, 'SingP2MSingBar'); - ThemeLoadStatic(Sing.StaticP3SingBar, 'SingP3SingBar'); - //eoa moveable singbar - - ThemeLoadStatic(Sing.StaticP1, 'SingP1Static'); - ThemeLoadText(Sing.TextP1, 'SingP1Text'); - ThemeLoadStatic(Sing.StaticP1ScoreBG, 'SingP1Static2'); - ThemeLoadText(Sing.TextP1Score, 'SingP1TextScore'); - //Added for ps3 skin - //This one is shown in 2/4P mode - //if it exists, otherwise the one Player equivaltents are used - if (ThemeIni.SectionExists('SingP1TwoPTextScore')) then - begin - ThemeLoadStatic(Sing.StaticP1TwoP, 'SingP1TwoPStatic'); - ThemeLoadText(Sing.TextP1TwoP, 'SingP1TwoPText'); - ThemeLoadStatic(Sing.StaticP1TwoPScoreBG, 'SingP1TwoPStatic2'); - ThemeLoadText(Sing.TextP1TwoPScore, 'SingP1TwoPTextScore'); - end - else - begin - Sing.StaticP1TwoP := Sing.StaticP1; - Sing.TextP1TwoP := Sing.TextP1; - Sing.StaticP1TwoPScoreBG := Sing.StaticP1ScoreBG; - Sing.TextP1TwoPScore := Sing.TextP1Score; - end; - - //This one is shown in 3/6P mode - //if it exists, otherwise the one Player equivaltents are used - if (ThemeIni.SectionExists('SingP1TwoPTextScore')) then - begin - ThemeLoadStatic(Sing.StaticP1ThreeP, 'SingP1ThreePStatic'); - ThemeLoadText(Sing.TextP1ThreeP, 'SingP1ThreePText'); - ThemeLoadStatic(Sing.StaticP1ThreePScoreBG, 'SingP1ThreePStatic2'); - ThemeLoadText(Sing.TextP1ThreePScore, 'SingP1ThreePTextScore'); - end - else - begin - Sing.StaticP1ThreeP := Sing.StaticP1; - Sing.TextP1ThreeP := Sing.TextP1; - Sing.StaticP1ThreePScoreBG := Sing.StaticP1ScoreBG; - Sing.TextP1ThreePScore := Sing.TextP1Score; - end; - //eoa - ThemeLoadStatic(Sing.StaticP2R, 'SingP2RStatic'); - ThemeLoadText(Sing.TextP2R, 'SingP2RText'); - ThemeLoadStatic(Sing.StaticP2RScoreBG, 'SingP2RStatic2'); - ThemeLoadText(Sing.TextP2RScore, 'SingP2RTextScore'); - - ThemeLoadStatic(Sing.StaticP2M, 'SingP2MStatic'); - ThemeLoadText(Sing.TextP2M, 'SingP2MText'); - ThemeLoadStatic(Sing.StaticP2MScoreBG, 'SingP2MStatic2'); - ThemeLoadText(Sing.TextP2MScore, 'SingP2MTextScore'); - - ThemeLoadStatic(Sing.StaticP3R, 'SingP3RStatic'); - ThemeLoadText(Sing.TextP3R, 'SingP3RText'); - ThemeLoadStatic(Sing.StaticP3RScoreBG, 'SingP3RStatic2'); - ThemeLoadText(Sing.TextP3RScore, 'SingP3RTextScore'); - - //Line Bonus Texts - Sing.LineBonusText[0] := Language.Translate('POPUP_AWFUL'); - Sing.LineBonusText[1] := Sing.LineBonusText[0]; - Sing.LineBonusText[2] := Language.Translate('POPUP_POOR'); - Sing.LineBonusText[3] := Language.Translate('POPUP_BAD'); - Sing.LineBonusText[4] := Language.Translate('POPUP_NOTBAD'); - Sing.LineBonusText[5] := Language.Translate('POPUP_GOOD'); - Sing.LineBonusText[6] := Language.Translate('POPUP_GREAT'); - Sing.LineBonusText[7] := Language.Translate('POPUP_AWESOME'); - Sing.LineBonusText[8] := Language.Translate('POPUP_PERFECT'); - - // Score - ThemeLoadBasic(Score, 'Score'); - - ThemeLoadText(Score.TextArtist, 'ScoreTextArtist'); - ThemeLoadText(Score.TextTitle, 'ScoreTextTitle'); - ThemeLoadText(Score.TextArtistTitle, 'ScoreTextArtistTitle'); - - for I := 1 to 6 do begin - ThemeLoadStatics(Score.PlayerStatic[I], 'ScorePlayer' + IntToStr(I) + 'Static'); - ThemeLoadTexts(Score.PlayerTexts[I], 'ScorePlayer' + IntToStr(I) + 'Text'); - - ThemeLoadText(Score.TextName[I], 'ScoreTextName' + IntToStr(I)); - ThemeLoadText(Score.TextScore[I], 'ScoreTextScore' + IntToStr(I)); - ThemeLoadText(Score.TextNotes[I], 'ScoreTextNotes' + IntToStr(I)); - ThemeLoadText(Score.TextNotesScore[I], 'ScoreTextNotesScore' + IntToStr(I)); - ThemeLoadText(Score.TextLineBonus[I], 'ScoreTextLineBonus' + IntToStr(I)); - ThemeLoadText(Score.TextLineBonusScore[I], 'ScoreTextLineBonusScore' + IntToStr(I)); - ThemeLoadText(Score.TextGoldenNotes[I], 'ScoreTextGoldenNotes' + IntToStr(I)); - ThemeLoadText(Score.TextGoldenNotesScore[I], 'ScoreTextGoldenNotesScore' + IntToStr(I)); - ThemeLoadText(Score.TextTotal[I], 'ScoreTextTotal' + IntToStr(I)); - ThemeLoadText(Score.TextTotalScore[I], 'ScoreTextTotalScore' + IntToStr(I)); - - ThemeLoadStatic(Score.StaticBoxLightest[I], 'ScoreStaticBoxLightest' + IntToStr(I)); - ThemeLoadStatic(Score.StaticBoxLight[I], 'ScoreStaticBoxLight' + IntToStr(I)); - ThemeLoadStatic(Score.StaticBoxDark[I], 'ScoreStaticBoxDark' + IntToStr(I)); - - ThemeLoadStatic(Score.StaticBackLevel[I], 'ScoreStaticBackLevel' + IntToStr(I)); - ThemeLoadStatic(Score.StaticBackLevelRound[I], 'ScoreStaticBackLevelRound' + IntToStr(I)); - ThemeLoadStatic(Score.StaticLevel[I], 'ScoreStaticLevel' + IntToStr(I)); - ThemeLoadStatic(Score.StaticLevelRound[I], 'ScoreStaticLevelRound' + IntToStr(I)); - end; - - // Top5 - ThemeLoadBasic(Top5, 'Top5'); - - ThemeLoadText(Top5.TextLevel, 'Top5TextLevel'); - ThemeLoadText(Top5.TextArtistTitle, 'Top5TextArtistTitle'); - ThemeLoadStatics(Top5.StaticNumber, 'Top5StaticNumber'); - ThemeLoadTexts(Top5.TextNumber, 'Top5TextNumber'); - ThemeLoadTexts(Top5.TextName, 'Top5TextName'); - ThemeLoadTexts(Top5.TextScore, 'Top5TextScore'); - - // Options - ThemeLoadBasic(Options, 'Options'); - - ThemeLoadButton(Options.ButtonGame, 'OptionsButtonGame'); - ThemeLoadButton(Options.ButtonGraphics, 'OptionsButtonGraphics'); - ThemeLoadButton(Options.ButtonSound, 'OptionsButtonSound'); - ThemeLoadButton(Options.ButtonLyrics, 'OptionsButtonLyrics'); - ThemeLoadButton(Options.ButtonThemes, 'OptionsButtonThemes'); - ThemeLoadButton(Options.ButtonRecord, 'OptionsButtonRecord'); - ThemeLoadButton(Options.ButtonAdvanced, 'OptionsButtonAdvanced'); - ThemeLoadButton(Options.ButtonExit, 'OptionsButtonExit'); - - {{$IFDEF TRANSLATE} - Options.Description[0] := Language.Translate('SING_OPTIONS_GAME'); - Options.Description[1] := Language.Translate('SING_OPTIONS_GRAPHICS'); - Options.Description[2] := Language.Translate('SING_OPTIONS_SOUND'); - Options.Description[3] := Language.Translate('SING_OPTIONS_LYRICS'); - Options.Description[4] := Language.Translate('SING_OPTIONS_THEMES'); - Options.Description[5] := Language.Translate('SING_OPTIONS_RECORD'); - Options.Description[6] := Language.Translate('SING_OPTIONS_ADVANCED'); - Options.Description[7] := Language.Translate('SING_OPTIONS_EXIT'); - {{$ENDIF} - - ThemeLoadText(Options.TextDescription, 'OptionsTextDescription'); - Options.TextDescription.Text := Options.Description[0]; - - // Options Game - ThemeLoadBasic(OptionsGame, 'OptionsGame'); - - ThemeLoadSelect(OptionsGame.SelectPlayers, 'OptionsGameSelectPlayers'); - ThemeLoadSelect(OptionsGame.SelectDifficulty, 'OptionsGameSelectDifficulty'); - ThemeLoadSelectSlide(OptionsGame.SelectLanguage, 'OptionsGameSelectSlideLanguage'); - ThemeLoadSelect(OptionsGame.SelectTabs, 'OptionsGameSelectTabs'); - ThemeLoadSelectSlide(OptionsGame.SelectSorting, 'OptionsGameSelectSlideSorting'); - ThemeLoadSelect(OptionsGame.SelectDebug, 'OptionsGameSelectDebug'); - ThemeLoadButton(OptionsGame.ButtonExit, 'OptionsGameButtonExit'); - - // Options Graphics - ThemeLoadBasic(OptionsGraphics, 'OptionsGraphics'); - - ThemeLoadSelect(OptionsGraphics.SelectFullscreen, 'OptionsGraphicsSelectFullscreen'); - ThemeLoadSelectSlide(OptionsGraphics.SelectSlideResolution, 'OptionsGraphicsSelectSlideResolution'); - ThemeLoadSelect(OptionsGraphics.SelectDepth, 'OptionsGraphicsSelectDepth'); - ThemeLoadSelect(OptionsGraphics.SelectOscilloscope, 'OptionsGraphicsSelectOscilloscope'); - ThemeLoadSelect(OptionsGraphics.SelectLineBonus, 'OptionsGraphicsSelectLineBonus'); - ThemeLoadSelect(OptionsGraphics.SelectMovieSize, 'OptionsGraphicsSelectMovieSize'); - ThemeLoadButton(OptionsGraphics.ButtonExit, 'OptionsGraphicsButtonExit'); - - // Options Sound - ThemeLoadBasic(OptionsSound, 'OptionsSound'); - - ThemeLoadSelect(OptionsSound.SelectMicBoost, 'OptionsSoundSelectMicBoost'); - ThemeLoadSelect(OptionsSound.SelectClickAssist, 'OptionsSoundSelectClickAssist'); - ThemeLoadSelect(OptionsSound.SelectBeatClick, 'OptionsSoundSelectBeatClick'); - ThemeLoadSelect(OptionsSound.SelectThreshold, 'OptionsSoundSelectThreshold'); - //Song Preview - ThemeLoadSelectSlide(OptionsSound.SelectSlidePreviewVolume, 'OptionsSoundSelectSlidePreviewVolume'); - ThemeLoadSelectSlide(OptionsSound.SelectSlidePreviewFading, 'OptionsSoundSelectSlidePreviewFading'); - - ThemeLoadButton(OptionsSound.ButtonExit, 'OptionsSoundButtonExit'); - - // Options Lyrics - ThemeLoadBasic(OptionsLyrics, 'OptionsLyrics'); - - ThemeLoadSelect(OptionsLyrics.SelectLyricsFont, 'OptionsLyricsSelectLyricsFont'); - ThemeLoadSelect(OptionsLyrics.SelectLyricsEffect, 'OptionsLyricsSelectLyricsEffect'); - ThemeLoadSelect(OptionsLyrics.SelectSolmization, 'OptionsLyricsSelectSolmization'); - ThemeLoadButton(OptionsLyrics.ButtonExit, 'OptionsLyricsButtonExit'); - - // Options Themes - ThemeLoadBasic(OptionsThemes, 'OptionsThemes'); - - ThemeLoadSelectSlide(OptionsThemes.SelectTheme, 'OptionsThemesSelectTheme'); - ThemeLoadSelectSlide(OptionsThemes.SelectSkin, 'OptionsThemesSelectSkin'); - ThemeLoadSelectSlide(OptionsThemes.SelectColor, 'OptionsThemesSelectColor'); - ThemeLoadButton(OptionsThemes.ButtonExit, 'OptionsThemesButtonExit'); - - // Options Record - ThemeLoadBasic(OptionsRecord, 'OptionsRecord'); - - ThemeLoadSelectSlide(OptionsRecord.SelectSlideCard, 'OptionsRecordSelectSlideCard'); - ThemeLoadSelectSlide(OptionsRecord.SelectSlideInput, 'OptionsRecordSelectSlideInput'); - ThemeLoadSelectSlide(OptionsRecord.SelectSlideChannelL, 'OptionsRecordSelectSlideChannelL'); - ThemeLoadSelectSlide(OptionsRecord.SelectSlideChannelR, 'OptionsRecordSelectSlideChannelR'); - ThemeLoadButton(OptionsRecord.ButtonExit, 'OptionsRecordButtonExit'); - - //Options Advanced - ThemeLoadBasic(OptionsAdvanced, 'OptionsAdvanced'); - - ThemeLoadSelect (OptionsAdvanced.SelectLoadAnimation, 'OptionsAdvancedSelectLoadAnimation'); - ThemeLoadSelect (OptionsAdvanced.SelectScreenFade, 'OptionsAdvancedSelectScreenFade'); - ThemeLoadSelect (OptionsAdvanced.SelectEffectSing, 'OptionsAdvancedSelectEffectSing'); - ThemeLoadSelect (OptionsAdvanced.SelectLineBonus, 'OptionsAdvancedSelectLineBonus'); - ThemeLoadSelectSlide (OptionsAdvanced.SelectOnSongClick, 'OptionsAdvancedSelectSlideOnSongClick'); - ThemeLoadSelect (OptionsAdvanced.SelectAskbeforeDel, 'OptionsAdvancedSelectAskbeforeDel'); - ThemeLoadSelect (OptionsAdvanced.SelectPartyPopup, 'OptionsAdvancedSelectPartyPopup'); - ThemeLoadButton (OptionsAdvanced.ButtonExit, 'OptionsAdvancedButtonExit'); - - //error and check popup - ThemeLoadBasic (ErrorPopup, 'ErrorPopup'); - ThemeLoadButton(ErrorPopup.Button1, 'ErrorPopupButton1'); - ThemeLoadText (ErrorPopup.TextError,'ErrorPopupText'); - ThemeLoadBasic (CheckPopup, 'CheckPopup'); - ThemeLoadButton(CheckPopup.Button1, 'CheckPopupButton1'); - ThemeLoadButton(CheckPopup.Button2, 'CheckPopupButton2'); - ThemeLoadText(CheckPopup.TextCheck , 'CheckPopupText'); - - //Song Menu - ThemeLoadBasic (SongMenu, 'SongMenu'); - ThemeLoadButton(SongMenu.Button1, 'SongMenuButton1'); - ThemeLoadButton(SongMenu.Button2, 'SongMenuButton2'); - ThemeLoadButton(SongMenu.Button3, 'SongMenuButton3'); - ThemeLoadButton(SongMenu.Button4, 'SongMenuButton4'); - ThemeLoadSelectSlide(SongMenu.SelectSlide3, 'SongMenuSelectSlide3'); - - ThemeLoadText(SongMenu.TextMenu, 'SongMenuTextMenu'); - - //Song Jumpto - ThemeLoadBasic (SongJumpto, 'SongJumpto'); - ThemeLoadButton(SongJumpto.ButtonSearchText, 'SongJumptoButtonSearchText'); - ThemeLoadSelectSlide(SongJumpto.SelectSlideType, 'SongJumptoSelectSlideType'); - ThemeLoadText(SongJumpto.TextFound, 'SongJumptoTextFound'); - //Translations - SongJumpto.IType[0] := Language.Translate('SONG_JUMPTO_TYPE1'); - SongJumpto.IType[1] := Language.Translate('SONG_JUMPTO_TYPE2'); - SongJumpto.IType[2] := Language.Translate('SONG_JUMPTO_TYPE3'); - SongJumpto.SongsFound := Language.Translate('SONG_JUMPTO_SONGSFOUND'); - SongJumpto.NoSongsFound := Language.Translate('SONG_JUMPTO_NOSONGSFOUND'); - SongJumpto.CatText := Language.Translate('SONG_JUMPTO_CATTEXT'); - - //Party Screens: - //Party NewRound - ThemeLoadBasic(PartyNewRound, 'PartyNewRound'); - - ThemeLoadText (PartyNewRound.TextRound1, 'PartyNewRoundTextRound1'); - ThemeLoadText (PartyNewRound.TextRound2, 'PartyNewRoundTextRound2'); - ThemeLoadText (PartyNewRound.TextRound3, 'PartyNewRoundTextRound3'); - ThemeLoadText (PartyNewRound.TextRound4, 'PartyNewRoundTextRound4'); - ThemeLoadText (PartyNewRound.TextRound5, 'PartyNewRoundTextRound5'); - ThemeLoadText (PartyNewRound.TextRound6, 'PartyNewRoundTextRound6'); - ThemeLoadText (PartyNewRound.TextRound7, 'PartyNewRoundTextRound7'); - ThemeLoadText (PartyNewRound.TextWinner1, 'PartyNewRoundTextWinner1'); - ThemeLoadText (PartyNewRound.TextWinner2, 'PartyNewRoundTextWinner2'); - ThemeLoadText (PartyNewRound.TextWinner3, 'PartyNewRoundTextWinner3'); - ThemeLoadText (PartyNewRound.TextWinner4, 'PartyNewRoundTextWinner4'); - ThemeLoadText (PartyNewRound.TextWinner5, 'PartyNewRoundTextWinner5'); - ThemeLoadText (PartyNewRound.TextWinner6, 'PartyNewRoundTextWinner6'); - ThemeLoadText (PartyNewRound.TextWinner7, 'PartyNewRoundTextWinner7'); - ThemeLoadText (PartyNewRound.TextNextRound, 'PartyNewRoundTextNextRound'); - ThemeLoadText (PartyNewRound.TextNextRoundNo, 'PartyNewRoundTextNextRoundNo'); - ThemeLoadText (PartyNewRound.TextNextPlayer1, 'PartyNewRoundTextNextPlayer1'); - ThemeLoadText (PartyNewRound.TextNextPlayer2, 'PartyNewRoundTextNextPlayer2'); - ThemeLoadText (PartyNewRound.TextNextPlayer3, 'PartyNewRoundTextNextPlayer3'); - - ThemeLoadStatic (PartyNewRound.StaticRound1, 'PartyNewRoundStaticRound1'); - ThemeLoadStatic (PartyNewRound.StaticRound2, 'PartyNewRoundStaticRound2'); - ThemeLoadStatic (PartyNewRound.StaticRound3, 'PartyNewRoundStaticRound3'); - ThemeLoadStatic (PartyNewRound.StaticRound4, 'PartyNewRoundStaticRound4'); - ThemeLoadStatic (PartyNewRound.StaticRound5, 'PartyNewRoundStaticRound5'); - ThemeLoadStatic (PartyNewRound.StaticRound6, 'PartyNewRoundStaticRound6'); - ThemeLoadStatic (PartyNewRound.StaticRound7, 'PartyNewRoundStaticRound7'); - - ThemeLoadText (PartyNewRound.TextScoreTeam1, 'PartyNewRoundTextScoreTeam1'); - ThemeLoadText (PartyNewRound.TextScoreTeam2, 'PartyNewRoundTextScoreTeam2'); - ThemeLoadText (PartyNewRound.TextScoreTeam3, 'PartyNewRoundTextScoreTeam3'); - ThemeLoadText (PartyNewRound.TextNameTeam1, 'PartyNewRoundTextNameTeam1'); - ThemeLoadText (PartyNewRound.TextNameTeam2, 'PartyNewRoundTextNameTeam2'); - ThemeLoadText (PartyNewRound.TextNameTeam3, 'PartyNewRoundTextNameTeam3'); - - ThemeLoadText (PartyNewRound.TextTeam1Players, 'PartyNewRoundTextTeam1Players'); - ThemeLoadText (PartyNewRound.TextTeam2Players, 'PartyNewRoundTextTeam2Players'); - ThemeLoadText (PartyNewRound.TextTeam3Players, 'PartyNewRoundTextTeam3Players'); - - ThemeLoadStatic (PartyNewRound.StaticTeam1, 'PartyNewRoundStaticTeam1'); - ThemeLoadStatic (PartyNewRound.StaticTeam2, 'PartyNewRoundStaticTeam2'); - ThemeLoadStatic (PartyNewRound.StaticTeam3, 'PartyNewRoundStaticTeam3'); - ThemeLoadStatic (PartyNewRound.StaticNextPlayer1, 'PartyNewRoundStaticNextPlayer1'); - ThemeLoadStatic (PartyNewRound.StaticNextPlayer2, 'PartyNewRoundStaticNextPlayer2'); - ThemeLoadStatic (PartyNewRound.StaticNextPlayer3, 'PartyNewRoundStaticNextPlayer3'); - - //Party Score - ThemeLoadBasic(PartyScore, 'PartyScore'); - - ThemeLoadText (PartyScore.TextScoreTeam1, 'PartyScoreTextScoreTeam1'); - ThemeLoadText (PartyScore.TextScoreTeam2, 'PartyScoreTextScoreTeam2'); - ThemeLoadText (PartyScore.TextScoreTeam3, 'PartyScoreTextScoreTeam3'); - ThemeLoadText (PartyScore.TextNameTeam1, 'PartyScoreTextNameTeam1'); - ThemeLoadText (PartyScore.TextNameTeam2, 'PartyScoreTextNameTeam2'); - ThemeLoadText (PartyScore.TextNameTeam3, 'PartyScoreTextNameTeam3'); - - ThemeLoadStatic (PartyScore.StaticTeam1, 'PartyScoreStaticTeam1'); - ThemeLoadStatic (PartyScore.StaticTeam1BG, 'PartyScoreStaticTeam1BG'); - ThemeLoadStatic (PartyScore.StaticTeam1Deco, 'PartyScoreStaticTeam1Deco'); - ThemeLoadStatic (PartyScore.StaticTeam2, 'PartyScoreStaticTeam2'); - ThemeLoadStatic (PartyScore.StaticTeam2BG, 'PartyScoreStaticTeam2BG'); - ThemeLoadStatic (PartyScore.StaticTeam2Deco, 'PartyScoreStaticTeam2Deco'); - ThemeLoadStatic (PartyScore.StaticTeam3, 'PartyScoreStaticTeam3'); - ThemeLoadStatic (PartyScore.StaticTeam3BG, 'PartyScoreStaticTeam3BG'); - ThemeLoadStatic (PartyScore.StaticTeam3Deco, 'PartyScoreStaticTeam3Deco'); - - //Load Party Score DecoTextures Object - PartyScore.DecoTextures.ChangeTextures := (ThemeIni.ReadInteger('PartyScoreDecoTextures', 'ChangeTextures', 0) = 1); - - PartyScore.DecoTextures.FirstTexture := ThemeIni.ReadString('PartyScoreDecoTextures', 'FirstTexture', ''); - PartyScore.DecoTextures.FirstTyp := ThemeIni.ReadString('PartyScoreDecoTextures', 'FirstTyp', 'Note Black'); - PartyScore.DecoTextures.FirstColor := ThemeIni.ReadString('PartyScoreDecoTextures', 'FirstColor', 'Black'); - - PartyScore.DecoTextures.SecondTexture := ThemeIni.ReadString('PartyScoreDecoTextures', 'SecondTexture', ''); - PartyScore.DecoTextures.SecondTyp := ThemeIni.ReadString('PartyScoreDecoTextures', 'SecondTyp', 'Note Black'); - PartyScore.DecoTextures.SecondColor := ThemeIni.ReadString('PartyScoreDecoTextures', 'SecondColor', 'Black'); - - PartyScore.DecoTextures.ThirdTexture := ThemeIni.ReadString('PartyScoreDecoTextures', 'ThirdTexture', ''); - PartyScore.DecoTextures.ThirdTyp := ThemeIni.ReadString('PartyScoreDecoTextures', 'ThirdTyp', 'Note Black'); - PartyScore.DecoTextures.ThirdColor := ThemeIni.ReadString('PartyScoreDecoTextures', 'ThirdColor', 'Black'); - - ThemeLoadText (PartyScore.TextWinner, 'PartyScoreTextWinner'); - - //Party Win - ThemeLoadBasic(PartyWin, 'PartyWin'); - - ThemeLoadText (PartyWin.TextScoreTeam1, 'PartyWinTextScoreTeam1'); - ThemeLoadText (PartyWin.TextScoreTeam2, 'PartyWinTextScoreTeam2'); - ThemeLoadText (PartyWin.TextScoreTeam3, 'PartyWinTextScoreTeam3'); - ThemeLoadText (PartyWin.TextNameTeam1, 'PartyWinTextNameTeam1'); - ThemeLoadText (PartyWin.TextNameTeam2, 'PartyWinTextNameTeam2'); - ThemeLoadText (PartyWin.TextNameTeam3, 'PartyWinTextNameTeam3'); - - ThemeLoadStatic (PartyWin.StaticTeam1, 'PartyWinStaticTeam1'); - ThemeLoadStatic (PartyWin.StaticTeam1BG, 'PartyWinStaticTeam1BG'); - ThemeLoadStatic (PartyWin.StaticTeam1Deco, 'PartyWinStaticTeam1Deco'); - ThemeLoadStatic (PartyWin.StaticTeam2, 'PartyWinStaticTeam2'); - ThemeLoadStatic (PartyWin.StaticTeam2BG, 'PartyWinStaticTeam2BG'); - ThemeLoadStatic (PartyWin.StaticTeam2Deco, 'PartyWinStaticTeam2Deco'); - ThemeLoadStatic (PartyWin.StaticTeam3, 'PartyWinStaticTeam3'); - ThemeLoadStatic (PartyWin.StaticTeam3BG, 'PartyWinStaticTeam3BG'); - ThemeLoadStatic (PartyWin.StaticTeam3Deco, 'PartyWinStaticTeam3Deco'); - - ThemeLoadText (PartyWin.TextWinner, 'PartyWinTextWinner'); - - //Party Options - ThemeLoadBasic(PartyOptions, 'PartyOptions'); - ThemeLoadSelectSlide(PartyOptions.SelectLevel, 'PartyOptionsSelectLevel'); - ThemeLoadSelectSlide(PartyOptions.SelectPlayList, 'PartyOptionsSelectPlayList'); - ThemeLoadSelectSlide(PartyOptions.SelectPlayList2, 'PartyOptionsSelectPlayList2'); - ThemeLoadSelectSlide(PartyOptions.SelectRounds, 'PartyOptionsSelectRounds'); - ThemeLoadSelectSlide(PartyOptions.SelectTeams, 'PartyOptionsSelectTeams'); - ThemeLoadSelectSlide(PartyOptions.SelectPlayers1, 'PartyOptionsSelectPlayers1'); - ThemeLoadSelectSlide(PartyOptions.SelectPlayers2, 'PartyOptionsSelectPlayers2'); - ThemeLoadSelectSlide(PartyOptions.SelectPlayers3, 'PartyOptionsSelectPlayers3'); - - {ThemeLoadButton (ButtonNext, 'ButtonNext'); - ThemeLoadButton (ButtonPrev, 'ButtonPrev');} - - //Party Player - ThemeLoadBasic(PartyPlayer, 'PartyPlayer'); - ThemeLoadButton(PartyPlayer.Team1Name, 'PartyPlayerTeam1Name'); - ThemeLoadButton(PartyPlayer.Player1Name, 'PartyPlayerPlayer1Name'); - ThemeLoadButton(PartyPlayer.Player2Name, 'PartyPlayerPlayer2Name'); - ThemeLoadButton(PartyPlayer.Player3Name, 'PartyPlayerPlayer3Name'); - ThemeLoadButton(PartyPlayer.Player4Name, 'PartyPlayerPlayer4Name'); - - ThemeLoadButton(PartyPlayer.Team2Name, 'PartyPlayerTeam2Name'); - ThemeLoadButton(PartyPlayer.Player5Name, 'PartyPlayerPlayer5Name'); - ThemeLoadButton(PartyPlayer.Player6Name, 'PartyPlayerPlayer6Name'); - ThemeLoadButton(PartyPlayer.Player7Name, 'PartyPlayerPlayer7Name'); - ThemeLoadButton(PartyPlayer.Player8Name, 'PartyPlayerPlayer8Name'); - - ThemeLoadButton(PartyPlayer.Team3Name, 'PartyPlayerTeam3Name'); - ThemeLoadButton(PartyPlayer.Player9Name, 'PartyPlayerPlayer9Name'); - ThemeLoadButton(PartyPlayer.Player10Name, 'PartyPlayerPlayer10Name'); - ThemeLoadButton(PartyPlayer.Player11Name, 'PartyPlayerPlayer11Name'); - ThemeLoadButton(PartyPlayer.Player12Name, 'PartyPlayerPlayer12Name'); - - {ThemeLoadButton(ButtonNext, 'PartyPlayerButtonNext'); - ThemeLoadButton(ButtonPrev, 'PartyPlayerButtonPrev');} - - ThemeLoadBasic(StatMain, 'StatMain'); - - ThemeLoadButton(StatMain.ButtonScores, 'StatMainButtonScores'); - ThemeLoadButton(StatMain.ButtonSingers, 'StatMainButtonSingers'); - ThemeLoadButton(StatMain.ButtonSongs, 'StatMainButtonSongs'); - ThemeLoadButton(StatMain.ButtonBands, 'StatMainButtonBands'); - ThemeLoadButton(StatMain.ButtonExit, 'StatMainButtonExit'); - - ThemeLoadText (StatMain.TextOverview, 'StatMainTextOverview'); - - - ThemeLoadBasic(StatDetail, 'StatDetail'); - - ThemeLoadButton(StatDetail.ButtonNext, 'StatDetailButtonNext'); - ThemeLoadButton(StatDetail.ButtonPrev, 'StatDetailButtonPrev'); - ThemeLoadButton(StatDetail.ButtonReverse, 'StatDetailButtonReverse'); - ThemeLoadButton(StatDetail.ButtonExit, 'StatDetailButtonExit'); - - ThemeLoadText (StatDetail.TextDescription, 'StatDetailTextDescription'); - ThemeLoadText (StatDetail.TextPage, 'StatDetailTextPage'); - ThemeLoadTexts(StatDetail.TextList, 'StatDetailTextList'); - - //Translate Texts - StatDetail.Description[0] := Language.Translate('STAT_DESC_SCORES'); - StatDetail.Description[1] := Language.Translate('STAT_DESC_SINGERS'); - StatDetail.Description[2] := Language.Translate('STAT_DESC_SONGS'); - StatDetail.Description[3] := Language.Translate('STAT_DESC_BANDS'); - - StatDetail.DescriptionR[0] := Language.Translate('STAT_DESC_SCORES_REVERSED'); - StatDetail.DescriptionR[1] := Language.Translate('STAT_DESC_SINGERS_REVERSED'); - StatDetail.DescriptionR[2] := Language.Translate('STAT_DESC_SONGS_REVERSED'); - StatDetail.DescriptionR[3] := Language.Translate('STAT_DESC_BANDS_REVERSED'); - - StatDetail.FormatStr[0] := Language.Translate('STAT_FORMAT_SCORES'); - StatDetail.FormatStr[1] := Language.Translate('STAT_FORMAT_SINGERS'); - StatDetail.FormatStr[2] := Language.Translate('STAT_FORMAT_SONGS'); - StatDetail.FormatStr[3] := Language.Translate('STAT_FORMAT_BANDS'); - - StatDetail.PageStr := Language.Translate('STAT_PAGE'); - - //Playlist Translations - Playlist.CatText := Language.Translate('PLAYLIST_CATTEXT'); - - //Level Translations - //Fill ILevel - ILevel[0] := Language.Translate('SING_EASY'); - ILevel[1] := Language.Translate('SING_MEDIUM'); - ILevel[2] := Language.Translate('SING_HARD'); - end; - - ThemeIni.Free; - end; -end; - -procedure TTheme.ThemeLoadBasic(Theme: TThemeBasic; Name: string); -begin - ThemeLoadBackground(Theme.Background, Name); - ThemeLoadTexts(Theme.Text, Name + 'Text'); - ThemeLoadStatics(Theme.Static, Name + 'Static'); - ThemeLoadButtonCollections(Theme.ButtonCollection, Name + 'ButtonCollection'); - - LastThemeBasic := Theme; -end; - -procedure TTheme.ThemeLoadBackground(var ThemeBackground: TThemeBackground; Name: string); -begin - ThemeBackground.Tex := ThemeIni.ReadString(Name + 'Background', 'Tex', ''); -end; - -procedure TTheme.ThemeLoadText(var ThemeText: TThemeText; Name: string); -var - C: integer; -begin - DecimalSeparator := '.'; - - ThemeText.X := ThemeIni.ReadInteger(Name, 'X', 0); - ThemeText.Y := ThemeIni.ReadInteger(Name, 'Y', 0); - ThemeText.W := ThemeIni.ReadInteger(Name, 'W', 0); - - ThemeText.ColR := ThemeIni.ReadFloat(Name, 'ColR', 0); - ThemeText.ColG := ThemeIni.ReadFloat(Name, 'ColG', 0); - ThemeText.ColB := ThemeIni.ReadFloat(Name, 'ColB', 0); - - ThemeText.Font := ThemeIni.ReadInteger(Name, 'Font', 0); - ThemeText.Size := ThemeIni.ReadInteger(Name, 'Size', 0); - ThemeText.Align := ThemeIni.ReadInteger(Name, 'Align', 0); - - ThemeText.Text := Language.Translate(ThemeIni.ReadString(Name, 'Text', '')); - ThemeText.Color := ThemeIni.ReadString(Name, 'Color', ''); - - C := ColorExists(ThemeText.Color); - if C >= 0 then begin - ThemeText.ColR := Color[C].RGB.R; - ThemeText.ColG := Color[C].RGB.G; - ThemeText.ColB := Color[C].RGB.B; - end; - - DecimalSeparator := ','; -end; - -procedure TTheme.ThemeLoadTexts(var ThemeText: AThemeText; Name: string); -var - T: integer; -begin - T := 1; - while ThemeIni.SectionExists(Name + IntToStr(T)) do begin - SetLength(ThemeText, T); - ThemeLoadText(ThemeText[T-1], Name + IntToStr(T)); - Inc(T); - end; -end; - -procedure TTheme.ThemeLoadStatic(var ThemeStatic: TThemeStatic; Name: string); -var - C: integer; -begin - DecimalSeparator := '.'; - - ThemeStatic.Tex := ThemeIni.ReadString(Name, 'Tex', ''); - - ThemeStatic.X := ThemeIni.ReadInteger(Name, 'X', 0); - ThemeStatic.Y := ThemeIni.ReadInteger(Name, 'Y', 0); - ThemeStatic.Z := ThemeIni.ReadFloat (Name, 'Z', 0); - ThemeStatic.W := ThemeIni.ReadInteger(Name, 'W', 0); - ThemeStatic.H := ThemeIni.ReadInteger(Name, 'H', 0); - - ThemeStatic.Typ := ThemeIni.ReadString(Name, 'Type', ''); - ThemeStatic.Color := ThemeIni.ReadString(Name, 'Color', ''); - - C := ColorExists(ThemeStatic.Color); - if C >= 0 then begin - ThemeStatic.ColR := Color[C].RGB.R; - ThemeStatic.ColG := Color[C].RGB.G; - ThemeStatic.ColB := Color[C].RGB.B; - end; - - ThemeStatic.TexX1 := ThemeIni.ReadFloat(Name, 'TexX1', 0); - ThemeStatic.TexY1 := ThemeIni.ReadFloat(Name, 'TexY1', 0); - ThemeStatic.TexX2 := ThemeIni.ReadFloat(Name, 'TexX2', 1); - ThemeStatic.TexY2 := ThemeIni.ReadFloat(Name, 'TexY2', 1); - - //Reflection Mod - ThemeStatic.Reflection := (ThemeIni.ReadInteger(Name, 'Reflection', 0) = 1); - ThemeStatic.ReflectionSpacing := ThemeIni.ReadFloat(Name, 'ReflectionSpacing', 15); - - DecimalSeparator := ','; -end; - -procedure TTheme.ThemeLoadStatics(var ThemeStatic: AThemeStatic; Name: string); -var - S: integer; -begin - S := 1; - while ThemeIni.SectionExists(Name + IntToStr(S)) do begin - SetLength(ThemeStatic, S); - ThemeLoadStatic(ThemeStatic[S-1], Name + IntToStr(S)); - Inc(S); - end; -end; - -//Button Collection Mod -procedure TTheme.ThemeLoadButtonCollection(var Collection: TThemeButtonCollection; Name: string); -var T: Integer; -begin - //Load Collection Style - ThemeLoadButton(Collection.Style, Name); - - //Load Other Attributes - T := ThemeIni.ReadInteger (Name, 'FirstChild', 0); - if (T > 0) And (T < 256) then - Collection.FirstChild := T - else - Collection.FirstChild := 0; -end; - -procedure TTheme.ThemeLoadButtonCollections(var Collections: AThemeButtonCollection; Name: string); -var - I: integer; -begin - I := 1; - while ThemeIni.SectionExists(Name + IntToStr(I)) do begin - SetLength(Collections, I); - ThemeLoadButtonCollection(Collections[I-1], Name + IntToStr(I)); - Inc(I); - end; -end; -//End Button Collection Mod - -procedure TTheme.ThemeLoadButton(var ThemeButton: TThemeButton; Name: string; const Collections: PAThemeButtonCollection); -var - C: integer; - TLen: integer; - T: integer; - Collections2: PAThemeButtonCollection; -begin - if not ThemeIni.SectionExists(Name) then - begin - ThemeButton.Visible := False; - exit; - end; - DecimalSeparator := '.'; - ThemeButton.Tex := ThemeIni.ReadString(Name, 'Tex', ''); - ThemeButton.X := ThemeIni.ReadInteger (Name, 'X', 0); - ThemeButton.Y := ThemeIni.ReadInteger (Name, 'Y', 0); - ThemeButton.Z := ThemeIni.ReadFloat (Name, 'Z', 0); - ThemeButton.W := ThemeIni.ReadInteger (Name, 'W', 0); - ThemeButton.H := ThemeIni.ReadInteger (Name, 'H', 0); - - ThemeButton.Typ := ThemeIni.ReadString(Name, 'Type', ''); - - //Reflection Mod - ThemeButton.Reflection := (ThemeIni.ReadInteger(Name, 'Reflection', 0) = 1); - ThemeButton.ReflectionSpacing := ThemeIni.ReadFloat(Name, 'ReflectionSpacing', 15); - - ThemeButton.ColR := ThemeIni.ReadFloat(Name, 'ColR', 1); - ThemeButton.ColG := ThemeIni.ReadFloat(Name, 'ColG', 1); - ThemeButton.ColB := ThemeIni.ReadFloat(Name, 'ColB', 1); - ThemeButton.Int := ThemeIni.ReadFloat(Name, 'Int', 1); - ThemeButton.DColR := ThemeIni.ReadFloat(Name, 'DColR', 1); - ThemeButton.DColG := ThemeIni.ReadFloat(Name, 'DColG', 1); - ThemeButton.DColB := ThemeIni.ReadFloat(Name, 'DColB', 1); - ThemeButton.DInt := ThemeIni.ReadFloat(Name, 'DInt', 1); - - ThemeButton.Color := ThemeIni.ReadString(Name, 'Color', ''); - C := ColorExists(ThemeButton.Color); - if C >= 0 then begin - ThemeButton.ColR := Color[C].RGB.R; - ThemeButton.ColG := Color[C].RGB.G; - ThemeButton.ColB := Color[C].RGB.B; - end; - - ThemeButton.DColor := ThemeIni.ReadString(Name, 'DColor', ''); - C := ColorExists(ThemeButton.DColor); - if C >= 0 then begin - ThemeButton.DColR := Color[C].RGB.R; - ThemeButton.DColG := Color[C].RGB.G; - ThemeButton.DColB := Color[C].RGB.B; - end; - - ThemeButton.Visible := (ThemeIni.ReadInteger(Name, 'Visible', 1) = 1); - - //Fade Mod - ThemeButton.SelectH := ThemeIni.ReadInteger (Name, 'SelectH', ThemeButton.H); - ThemeButton.SelectW := ThemeIni.ReadInteger (Name, 'SelectW', ThemeButton.W); - - ThemeButton.DeSelectReflectionspacing := ThemeIni.ReadFloat(Name, 'DeSelectReflectionSpacing', ThemeButton.Reflectionspacing); - - ThemeButton.Fade := (ThemeIni.ReadInteger(Name, 'Fade', 0) = 1); - ThemeButton.FadeText := (ThemeIni.ReadInteger(Name, 'FadeText', 0) = 1); - - - ThemeButton.FadeTex := ThemeIni.ReadString(Name, 'FadeTex', ''); - ThemeButton.FadeTexPos:= ThemeIni.ReadInteger(Name, 'FadeTexPos', 0); - if (ThemeButton.FadeTexPos > 4) Or (ThemeButton.FadeTexPos < 0) then - ThemeButton.FadeTexPos := 0; - - //Button Collection Mod - T := ThemeIni.ReadInteger(Name, 'Parent', 0); - - //Set Collections to Last Basic Collections if no valid Value - if (Collections = nil) then - Collections2 := @LastThemeBasic.ButtonCollection - else - Collections2 := Collections; - //Test for valid Value - if (Collections2 <> nil) AND (T > 0) AND (T <= Length(Collections2^)) then - begin - Inc(Collections2^[T-1].ChildCount); - ThemeButton.Parent := T; - end - else - ThemeButton.Parent := 0; - - //Read ButtonTexts - TLen := ThemeIni.ReadInteger(Name, 'Texts', 0); - SetLength(ThemeButton.Text, TLen); - for T := 1 to TLen do - ThemeLoadText(ThemeButton.Text[T-1], Name + 'Text' + IntToStr(T)); - - DecimalSeparator := ','; -end; - -procedure TTheme.ThemeLoadSelect(var ThemeSelect: TThemeSelect; Name: string); -var - C: integer; -begin - DecimalSeparator := '.'; - - {{$IFDEF TRANSLATE} - ThemeSelect.Text := Language.Translate(ThemeIni.ReadString(Name, 'Text', '')); - {{$ELSE}{ - ThemeSelect.Text := ThemeIni.ReadString(Name, 'Text', ''); - {$ENDIF} - - ThemeSelect.Tex := {Skin.SkinPath + }ThemeIni.ReadString(Name, 'Tex', ''); - ThemeSelect.TexSBG := {Skin.SkinPath + }ThemeIni.ReadString(Name, 'TexSBG', ''); - - ThemeSelect.X := ThemeIni.ReadInteger(Name, 'X', 0); - ThemeSelect.Y := ThemeIni.ReadInteger(Name, 'Y', 0); - ThemeSelect.W := ThemeIni.ReadInteger(Name, 'W', 0); - ThemeSelect.H := ThemeIni.ReadInteger(Name, 'H', 0); - ThemeSelect.SkipX := ThemeIni.ReadInteger(Name, 'SkipX', 0); - - - LoadColor(ThemeSelect.ColR, ThemeSelect.ColG, ThemeSelect.ColB, ThemeIni.ReadString(Name, 'Color', '')); - ThemeSelect.Int := ThemeIni.ReadFloat(Name, 'Int', 1); - LoadColor(ThemeSelect.DColR, ThemeSelect.DColG, ThemeSelect.DColB, ThemeIni.ReadString(Name, 'DColor', '')); - ThemeSelect.DInt := ThemeIni.ReadFloat(Name, 'DInt', 1); - - LoadColor(ThemeSelect.TColR, ThemeSelect.TColG, ThemeSelect.TColB, ThemeIni.ReadString(Name, 'TColor', '')); - ThemeSelect.TInt := ThemeIni.ReadFloat(Name, 'TInt', 1); - LoadColor(ThemeSelect.TDColR, ThemeSelect.TDColG, ThemeSelect.TDColB, ThemeIni.ReadString(Name, 'TDColor', '')); - ThemeSelect.TDInt := ThemeIni.ReadFloat(Name, 'TDInt', 1); - - LoadColor(ThemeSelect.SBGColR, ThemeSelect.SBGColG, ThemeSelect.SBGColB, ThemeIni.ReadString(Name, 'SBGColor', '')); - ThemeSelect.SBGInt := ThemeIni.ReadFloat(Name, 'SBGInt', 1); - LoadColor(ThemeSelect.SBGDColR, ThemeSelect.SBGDColG, ThemeSelect.SBGDColB, ThemeIni.ReadString(Name, 'SBGDColor', '')); - ThemeSelect.SBGDInt := ThemeIni.ReadFloat(Name, 'SBGDInt', 1); - - LoadColor(ThemeSelect.STColR, ThemeSelect.STColG, ThemeSelect.STColB, ThemeIni.ReadString(Name, 'STColor', '')); - ThemeSelect.STInt := ThemeIni.ReadFloat(Name, 'STInt', 1); - LoadColor(ThemeSelect.STDColR, ThemeSelect.STDColG, ThemeSelect.STDColB, ThemeIni.ReadString(Name, 'STDColor', '')); - ThemeSelect.STDInt := ThemeIni.ReadFloat(Name, 'STDInt', 1); - - - DecimalSeparator := ','; -end; - -procedure TTheme.ThemeLoadSelectSlide(var ThemeSelectS: TThemeSelectSlide; Name: string); -var - C: integer; -begin - DecimalSeparator := '.'; - - {{$IFDEF TRANSLATE} - ThemeSelectS.Text := Language.Translate(ThemeIni.ReadString(Name, 'Text', '')); - {{$ELSE}{ - ThemeSelectS.Text := ThemeIni.ReadString(Name, 'Text', ''); - {$ENDIF} - - ThemeSelectS.Tex := {Skin.SkinPath + }ThemeIni.ReadString(Name, 'Tex', ''); - ThemeSelectS.TexSBG := {Skin.SkinPath + }ThemeIni.ReadString(Name, 'TexSBG', ''); - - ThemeSelectS.X := ThemeIni.ReadInteger(Name, 'X', 0); - ThemeSelectS.Y := ThemeIni.ReadInteger(Name, 'Y', 0); - ThemeSelectS.W := ThemeIni.ReadInteger(Name, 'W', 0); - ThemeSelectS.H := ThemeIni.ReadInteger(Name, 'H', 0); - - ThemeSelectS.Z := ThemeIni.ReadFloat(Name, 'Z', 0); - - ThemeSelectS.TextSize := ThemeIni.ReadInteger(Name, 'TextSize', 10); - - ThemeSelectS.SkipX := ThemeIni.ReadInteger(Name, 'SkipX', 0); - - ThemeSelectS.SBGW := ThemeIni.ReadInteger(Name, 'SBGW', 450); - - LoadColor(ThemeSelectS.ColR, ThemeSelectS.ColG, ThemeSelectS.ColB, ThemeIni.ReadString(Name, 'Color', '')); - ThemeSelectS.Int := ThemeIni.ReadFloat(Name, 'Int', 1); - LoadColor(ThemeSelectS.DColR, ThemeSelectS.DColG, ThemeSelectS.DColB, ThemeIni.ReadString(Name, 'DColor', '')); - ThemeSelectS.DInt := ThemeIni.ReadFloat(Name, 'DInt', 1); - - LoadColor(ThemeSelectS.TColR, ThemeSelectS.TColG, ThemeSelectS.TColB, ThemeIni.ReadString(Name, 'TColor', '')); - ThemeSelectS.TInt := ThemeIni.ReadFloat(Name, 'TInt', 1); - LoadColor(ThemeSelectS.TDColR, ThemeSelectS.TDColG, ThemeSelectS.TDColB, ThemeIni.ReadString(Name, 'TDColor', '')); - ThemeSelectS.TDInt := ThemeIni.ReadFloat(Name, 'TDInt', 1); - - LoadColor(ThemeSelectS.SBGColR, ThemeSelectS.SBGColG, ThemeSelectS.SBGColB, ThemeIni.ReadString(Name, 'SBGColor', '')); - ThemeSelectS.SBGInt := ThemeIni.ReadFloat(Name, 'SBGInt', 1); - LoadColor(ThemeSelectS.SBGDColR, ThemeSelectS.SBGDColG, ThemeSelectS.SBGDColB, ThemeIni.ReadString(Name, 'SBGDColor', '')); - ThemeSelectS.SBGDInt := ThemeIni.ReadFloat(Name, 'SBGDInt', 1); - - LoadColor(ThemeSelectS.STColR, ThemeSelectS.STColG, ThemeSelectS.STColB, ThemeIni.ReadString(Name, 'STColor', '')); - ThemeSelectS.STInt := ThemeIni.ReadFloat(Name, 'STInt', 1); - LoadColor(ThemeSelectS.STDColR, ThemeSelectS.STDColG, ThemeSelectS.STDColB, ThemeIni.ReadString(Name, 'STDColor', '')); - ThemeSelectS.STDInt := ThemeIni.ReadFloat(Name, 'STDInt', 1); - - - DecimalSeparator := ','; -end; - -procedure TTheme.LoadColors; -var - SL: TStringList; - C: integer; - S: string; - Col: integer; - RGB: TRGB; -begin - SL := TStringList.Create; - ThemeIni.ReadSection('Colors', SL); - - // normal colors - SetLength(Color, SL.Count); - for C := 0 to SL.Count-1 do begin - Color[C].Name := SL.Strings[C]; - - S := ThemeIni.ReadString('Colors', SL.Strings[C], ''); - - Color[C].RGB.R := StrToInt(Copy(S, 1, Pos(' ' , S)-1))/255; - Delete(S, 1, Pos(' ', S)); - - Color[C].RGB.G := StrToInt(Copy(S, 1, Pos(' ' , S)-1))/255; - Delete(S, 1, Pos(' ', S)); - - Color[C].RGB.B := StrToInt(S)/255; - end; - - // skin color - SetLength(Color, SL.Count + 3); - C := SL.Count; - Color[C].Name := 'ColorDark'; - Color[C].RGB := GetSystemColor(Skin.Color); //Ini.Color); - - C := C+1; - Color[C].Name := 'ColorLight'; - Color[C].RGB := ColorSqrt(Color[C-1].RGB); - - C := C+1; - Color[C].Name := 'ColorLightest'; - Color[C].RGB := ColorSqrt(Color[C-1].RGB); - - // players colors - SetLength(Color, Length(Color)+18); - - // P1 - C := C+1; - Color[C].Name := 'P1Dark'; - Color[C].RGB := GetSystemColor(0); // 0 - blue - - C := C+1; - Color[C].Name := 'P1Light'; - Color[C].RGB := ColorSqrt(Color[C-1].RGB); - - C := C+1; - Color[C].Name := 'P1Lightest'; - Color[C].RGB := ColorSqrt(Color[C-1].RGB); - - // P2 - C := C+1; - Color[C].Name := 'P2Dark'; - Color[C].RGB := GetSystemColor(3); // 3 - red - - C := C+1; - Color[C].Name := 'P2Light'; - Color[C].RGB := ColorSqrt(Color[C-1].RGB); - - C := C+1; - Color[C].Name := 'P2Lightest'; - Color[C].RGB := ColorSqrt(Color[C-1].RGB); - - // P3 - C := C+1; - Color[C].Name := 'P3Dark'; - Color[C].RGB := GetSystemColor(1); // 1 - green - - C := C+1; - Color[C].Name := 'P3Light'; - Color[C].RGB := ColorSqrt(Color[C-1].RGB); - - C := C+1; - Color[C].Name := 'P3Lightest'; - Color[C].RGB := ColorSqrt(Color[C-1].RGB); - - // P4 - C := C+1; - Color[C].Name := 'P4Dark'; - Color[C].RGB := GetSystemColor(4); // 4 - brown - - C := C+1; - Color[C].Name := 'P4Light'; - Color[C].RGB := ColorSqrt(Color[C-1].RGB); - - C := C+1; - Color[C].Name := 'P4Lightest'; - Color[C].RGB := ColorSqrt(Color[C-1].RGB); - - // P5 - C := C+1; - Color[C].Name := 'P5Dark'; - Color[C].RGB := GetSystemColor(5); // 5 - yellow - - C := C+1; - Color[C].Name := 'P5Light'; - Color[C].RGB := ColorSqrt(Color[C-1].RGB); - - C := C+1; - Color[C].Name := 'P5Lightest'; - Color[C].RGB := ColorSqrt(Color[C-1].RGB); - - // P6 - C := C+1; - Color[C].Name := 'P6Dark'; - Color[C].RGB := GetSystemColor(6); // 6 - violet - - C := C+1; - Color[C].Name := 'P6Light'; - Color[C].RGB := ColorSqrt(Color[C-1].RGB); - - C := C+1; - Color[C].Name := 'P6Lightest'; - Color[C].RGB := ColorSqrt(Color[C-1].RGB); - - - SL.Free; -end; - -function ColorExists(Name: string): integer; -var - C: integer; -begin - Result := -1; - for C := 0 to High(Color) do - if Color[C].Name = Name then Result := C; -end; - -procedure LoadColor(var R, G, B: real; ColorName: string); -var - C: integer; -begin - C := ColorExists(ColorName); - if C >= 0 then begin - R := Color[C].RGB.R; - G := Color[C].RGB.G; - B := Color[C].RGB.B; - end; -end; - -function GetSystemColor(Color: integer): TRGB; -begin - case Color of - 0: begin - // blue - Result.R := 71/255; - Result.G := 175/255; - Result.B := 247/255; - end; - 1: begin - // green - Result.R := 63/255; - Result.G := 191/255; - Result.B := 63/255; - end; - 2: begin - // pink - Result.R := 255/255; -{ Result.G := 63/255; - Result.B := 192/255;} - Result.G := 175/255; - Result.B := 247/255; - end; - 3: begin - // red - Result.R := 247/255; - Result.G := 71/255; - Result.B := 71/255; - end; - //'Violet', 'Orange', 'Yellow', 'Brown', 'Black' - //New Theme-Color Patch - 4: begin - // violet - Result.R := 230/255; - Result.G := 63/255; - Result.B := 230/255; - end; - 5: begin - // orange - Result.R := 255/255; - Result.G := 144/255; - Result.B := 0; - end; - 6: begin - // yellow - Result.R := 230/255; - Result.G := 230/255; - Result.B := 95/255; - end; - 7: begin - // brown - Result.R := 192/255; - Result.G := 127/255; - Result.B := 31/255; - end; - 8: begin - // black - Result.R := 0; - Result.G := 0; - Result.B := 0; - end; - //New Theme-Color Patch End - - end; -end; - -function ColorSqrt(RGB: TRGB): TRGB; -begin - Result.R := sqrt(RGB.R); - Result.G := sqrt(RGB.G); - Result.B := sqrt(RGB.B); -end; - -procedure TTheme.ThemeSave(FileName: string); -var - I: integer; -begin - {$IFDEF THEMESAVE} - ThemeIni := TIniFile.Create(FileName); - {$ELSE} - ThemeIni := TMemIniFile.Create(FileName); - {$ENDIF} - - ThemeSaveBasic(Loading, 'Loading'); - - ThemeSaveBasic(Main, 'Main'); - ThemeSaveText(Main.TextDescription, 'MainTextDescription'); - ThemeSaveText(Main.TextDescriptionLong, 'MainTextDescriptionLong'); - ThemeSaveButton(Main.ButtonSolo, 'MainButtonSolo'); - ThemeSaveButton(Main.ButtonEditor, 'MainButtonEditor'); - ThemeSaveButton(Main.ButtonOptions, 'MainButtonOptions'); - ThemeSaveButton(Main.ButtonExit, 'MainButtonExit'); - - ThemeSaveBasic(Name, 'Name'); - for I := 1 to 6 do - ThemeSaveButton(Name.ButtonPlayer[I], 'NameButtonPlayer' + IntToStr(I)); - - ThemeSaveBasic(Level, 'Level'); - ThemeSaveButton(Level.ButtonEasy, 'LevelButtonEasy'); - ThemeSaveButton(Level.ButtonMedium, 'LevelButtonMedium'); - ThemeSaveButton(Level.ButtonHard, 'LevelButtonHard'); - - ThemeSaveBasic(Song, 'Song'); - ThemeSaveText(Song.TextArtist, 'SongTextArtist'); - ThemeSaveText(Song.TextTitle, 'SongTextTitle'); - ThemeSaveText(Song.TextNumber, 'SongTextNumber'); - - //Show CAt in Top Left Mod - ThemeSaveText(Song.TextCat, 'SongTextCat'); - ThemeSaveStatic(Song.StaticCat, 'SongStaticCat'); - - ThemeSaveBasic(Sing, 'Sing'); - - //TimeBar mod - ThemeSaveStatic(Sing.StaticTimeProgress, 'SingTimeProgress'); - ThemeSaveText(Sing.TextTimeText, 'SingTimeText'); - //eoa TimeBar mod - - ThemeSaveStatic(Sing.StaticP1, 'SingP1Static'); - ThemeSaveText(Sing.TextP1, 'SingP1Text'); - ThemeSaveStatic(Sing.StaticP1ScoreBG, 'SingP1Static2'); - ThemeSaveText(Sing.TextP1Score, 'SingP1TextScore'); - - //moveable singbar mod - ThemeSaveStatic(Sing.StaticP1SingBar, 'SingP1SingBar'); - ThemeSaveStatic(Sing.StaticP1TwoPSingBar, 'SingP1TwoPSingBar'); - ThemeSaveStatic(Sing.StaticP1ThreePSingBar, 'SingP1ThreePSingBar'); - ThemeSaveStatic(Sing.StaticP2RSingBar, 'SingP2RSingBar'); - ThemeSaveStatic(Sing.StaticP2MSingBar, 'SingP2MSingBar'); - ThemeSaveStatic(Sing.StaticP3SingBar, 'SingP3SingBar'); - //eoa moveable singbar - - //Added for ps3 skin - //This one is shown in 2/4P mode - ThemeSaveStatic(Sing.StaticP1TwoP, 'SingP1TwoPStatic'); - ThemeSaveText(Sing.TextP1TwoP, 'SingP1TwoPText'); - ThemeSaveStatic(Sing.StaticP1TwoPScoreBG, 'SingP1TwoPStatic2'); - ThemeSaveText(Sing.TextP1TwoPScore, 'SingP1TwoPTextScore'); - - //This one is shown in 3/6P mode - ThemeSaveStatic(Sing.StaticP1ThreeP, 'SingP1ThreePStatic'); - ThemeSaveText(Sing.TextP1ThreeP, 'SingP1ThreePText'); - ThemeSaveStatic(Sing.StaticP1ThreePScoreBG, 'SingP1ThreePStatic2'); - ThemeSaveText(Sing.TextP1ThreePScore, 'SingP1ThreePTextScore'); - //eoa - - ThemeSaveStatic(Sing.StaticP2R, 'SingP2RStatic'); - ThemeSaveText(Sing.TextP2R, 'SingP2RText'); - ThemeSaveStatic(Sing.StaticP2RScoreBG, 'SingP2RStatic2'); - ThemeSaveText(Sing.TextP2RScore, 'SingP2RTextScore'); - - ThemeSaveStatic(Sing.StaticP2M, 'SingP2MStatic'); - ThemeSaveText(Sing.TextP2M, 'SingP2MText'); - ThemeSaveStatic(Sing.StaticP2MScoreBG, 'SingP2MStatic2'); - ThemeSaveText(Sing.TextP2MScore, 'SingP2MTextScore'); - - ThemeSaveStatic(Sing.StaticP3R, 'SingP3RStatic'); - ThemeSaveText(Sing.TextP3R, 'SingP3RText'); - ThemeSaveStatic(Sing.StaticP3RScoreBG, 'SingP3RStatic2'); - ThemeSaveText(Sing.TextP3RScore, 'SingP3RTextScore'); - - ThemeSaveBasic(Score, 'Score'); - ThemeSaveText(Score.TextArtist, 'ScoreTextArtist'); - ThemeSaveText(Score.TextTitle, 'ScoreTextTitle'); - - for I := 1 to 6 do begin - ThemeSaveStatics(Score.PlayerStatic[I], 'ScorePlayer' + IntToStr(I) + 'Static'); - - ThemeSaveText(Score.TextName[I], 'ScoreTextName' + IntToStr(I)); - ThemeSaveText(Score.TextScore[I], 'ScoreTextScore' + IntToStr(I)); - ThemeSaveText(Score.TextNotes[I], 'ScoreTextNotes' + IntToStr(I)); - ThemeSaveText(Score.TextNotesScore[I], 'ScoreTextNotesScore' + IntToStr(I)); - ThemeSaveText(Score.TextLineBonus[I], 'ScoreTextLineBonus' + IntToStr(I)); - ThemeSaveText(Score.TextLineBonusScore[I], 'ScoreTextLineBonusScore' + IntToStr(I)); - ThemeSaveText(Score.TextGoldenNotes[I], 'ScoreTextGoldenNotes' + IntToStr(I)); - ThemeSaveText(Score.TextGoldenNotesScore[I], 'ScoreTextGoldenNotesScore' + IntToStr(I)); - ThemeSaveText(Score.TextTotal[I], 'ScoreTextTotal' + IntToStr(I)); - ThemeSaveText(Score.TextTotalScore[I], 'ScoreTextTotalScore' + IntToStr(I)); - - ThemeSaveStatic(Score.StaticBackLevel[I], 'ScoreStaticBackLevel' + IntToStr(I)); - ThemeSaveStatic(Score.StaticBackLevelRound[I], 'ScoreStaticBackLevelRound' + IntToStr(I)); - ThemeSaveStatic(Score.StaticLevel[I], 'ScoreStaticLevel' + IntToStr(I)); - ThemeSaveStatic(Score.StaticLevelRound[I], 'ScoreStaticLevelRound' + IntToStr(I)); - end; - - ThemeSaveBasic(Top5, 'Top5'); - ThemeSaveText(Top5.TextLevel, 'Top5TextLevel'); - ThemeSaveText(Top5.TextArtistTitle, 'Top5TextArtistTitle'); - ThemeSaveStatics(Top5.StaticNumber, 'Top5StaticNumber'); - ThemeSaveTexts(Top5.TextNumber, 'Top5TextNumber'); - ThemeSaveTexts(Top5.TextName, 'Top5TextName'); - ThemeSaveTexts(Top5.TextScore, 'Top5TextScore'); - - - ThemeIni.Free; -end; - -procedure TTheme.ThemeSaveBasic(Theme: TThemeBasic; Name: string); -begin - ThemeIni.WriteInteger(Name, 'Texts', Length(Theme.Text)); - - ThemeSaveBackground(Theme.Background, Name + 'Background'); - ThemeSaveStatics(Theme.Static, Name + 'Static'); - ThemeSaveTexts(Theme.Text, Name + 'Text'); -end; - -procedure TTheme.ThemeSaveBackground(ThemeBackground: TThemeBackground; Name: string); -begin - if ThemeBackground.Tex <> '' then - ThemeIni.WriteString(Name, 'Tex', ThemeBackground.Tex) - else begin - ThemeIni.EraseSection(Name); - end; -end; - -procedure TTheme.ThemeSaveStatic(ThemeStatic: TThemeStatic; Name: string); -begin - DecimalSeparator := '.'; - ThemeIni.WriteInteger(Name, 'X', ThemeStatic.X); - ThemeIni.WriteInteger(Name, 'Y', ThemeStatic.Y); - ThemeIni.WriteInteger(Name, 'W', ThemeStatic.W); - ThemeIni.WriteInteger(Name, 'H', ThemeStatic.H); - - ThemeIni.WriteString(Name, 'Tex', ThemeStatic.Tex); - ThemeIni.WriteString(Name, 'Type', ThemeStatic.Typ); - ThemeIni.WriteString(Name, 'Color', ThemeStatic.Color); - - ThemeIni.WriteFloat(Name, 'TexX1', ThemeStatic.TexX1); - ThemeIni.WriteFloat(Name, 'TexY1', ThemeStatic.TexY1); - ThemeIni.WriteFloat(Name, 'TexX2', ThemeStatic.TexX2); - ThemeIni.WriteFloat(Name, 'TexY2', ThemeStatic.TexY2); - - DecimalSeparator := ','; -end; - -procedure TTheme.ThemeSaveStatics(ThemeStatic: AThemeStatic; Name: string); -var - S: integer; -begin - for S := 0 to Length(ThemeStatic)-1 do - ThemeSaveStatic(ThemeStatic[S], Name + {'Static' +} IntToStr(S+1)); - - ThemeIni.EraseSection(Name + {'Static' + }IntToStr(S+1)); -end; - -procedure TTheme.ThemeSaveText(ThemeText: TThemeText; Name: string); -begin - DecimalSeparator := '.'; - ThemeIni.WriteInteger(Name, 'X', ThemeText.X); - ThemeIni.WriteInteger(Name, 'Y', ThemeText.Y); - - ThemeIni.WriteInteger(Name, 'Font', ThemeText.Font); - ThemeIni.WriteInteger(Name, 'Size', ThemeText.Size); - ThemeIni.WriteInteger(Name, 'Align', ThemeText.Align); - - ThemeIni.WriteString(Name, 'Text', ThemeText.Text); - ThemeIni.WriteString(Name, 'Color', ThemeText.Color); - - DecimalSeparator := ','; -end; - -procedure TTheme.ThemeSaveTexts(ThemeText: AThemeText; Name: string); -var - T: integer; -begin - for T := 0 to Length(ThemeText)-1 do - ThemeSaveText(ThemeText[T], Name + {'Text' + }IntToStr(T+1)); - - ThemeIni.EraseSection(Name + {'Text' + }IntToStr(T+1)); -end; - -procedure TTheme.ThemeSaveButton(ThemeButton: TThemeButton; Name: string); -var - T: integer; -begin - DecimalSeparator := '.'; - ThemeIni.WriteString(Name, 'Tex', ThemeButton.Tex); - ThemeIni.WriteInteger(Name, 'X', ThemeButton.X); - ThemeIni.WriteInteger(Name, 'Y', ThemeButton.Y); - ThemeIni.WriteInteger(Name, 'W', ThemeButton.W); - ThemeIni.WriteInteger(Name, 'H', ThemeButton.H); - - ThemeIni.WriteString(Name, 'Type', ThemeButton.Typ); - ThemeIni.WriteInteger(Name, 'Texts', Length(ThemeButton.Text)); - - ThemeIni.WriteString(Name, 'Color', ThemeButton.Color); - -{ ThemeButton.ColR := ThemeIni.ReadFloat(Name, 'ColR', 1); - ThemeButton.ColG := ThemeIni.ReadFloat(Name, 'ColG', 1); - ThemeButton.ColB := ThemeIni.ReadFloat(Name, 'ColB', 1); - ThemeButton.Int := ThemeIni.ReadFloat(Name, 'Int', 1); - ThemeButton.DColR := ThemeIni.ReadFloat(Name, 'DColR', 1); - ThemeButton.DColG := ThemeIni.ReadFloat(Name, 'DColG', 1); - ThemeButton.DColB := ThemeIni.ReadFloat(Name, 'DColB', 1); - ThemeButton.DInt := ThemeIni.ReadFloat(Name, 'DInt', 1);} - -{ C := ColorExists(ThemeIni.ReadString(Name, 'Color', '')); - if C >= 0 then begin - ThemeButton.ColR := Color[C].RGB.R; - ThemeButton.ColG := Color[C].RGB.G; - ThemeButton.ColB := Color[C].RGB.B; - end; - - C := ColorExists(ThemeIni.ReadString(Name, 'DColor', '')); - if C >= 0 then begin - ThemeButton.DColR := Color[C].RGB.R; - ThemeButton.DColG := Color[C].RGB.G; - ThemeButton.DColB := Color[C].RGB.B; - end;} - - for T := 0 to High(ThemeButton.Text) do - ThemeSaveText(ThemeButton.Text[T], Name + 'Text' + IntToStr(T+1)); - - DecimalSeparator := ','; -end; - - -end. +unit UThemes; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses + ULog, + IniFiles, + SysUtils, + Classes; + +type + TRGB = record + R: single; + G: single; + B: single; + end; + + TRGBA = record + R, G, B, A: Double; + end; + + TThemeBackground = record + Tex: string; + end; + + TThemeStatic = record + X: integer; + Y: integer; + Z: real; + W: integer; + H: integer; + Color: string; + ColR: real; + ColG: real; + ColB: real; + Tex: string; + Typ: string; + TexX1: real; + TexY1: real; + TexX2: real; + TexY2: real; + //Reflection Mod + Reflection: boolean; + Reflectionspacing: Real; + end; + AThemeStatic = array of TThemeStatic; + + TThemeText = record + X: integer; + Y: integer; + W: integer; + Color: string; + ColR: real; + ColG: real; + ColB: real; + Font: integer; + Size: integer; + Align: integer; + Text: string; + end; + AThemeText = array of TThemeText; + + TThemeButton = record + Text: AThemeText; + X: integer; + Y: integer; + Z: Real; + W: integer; + H: integer; + Color: string; + ColR: real; + ColG: real; + ColB: real; + Int: real; + DColor: string; + DColR: real; + DColG: real; + DColB: real; + DInt: real; + Tex: string; + Typ: string; + + Visible: Boolean; + + //Reflection Mod + Reflection: boolean; + Reflectionspacing: Real; + //Fade Mod + SelectH: integer; + SelectW: integer; + Fade: boolean; + FadeText: boolean; + DeSelectReflectionspacing : Real; + FadeTex: string; + FadeTexPos: integer; + + //Button Collection Mod + Parent: Byte; //Number of the Button Collection this Button is assigned to. IF 0: No Assignement + end; + + //Button Collection Mod + TThemeButtonCollection = record + Style: TThemeButton; + ChildCount: Byte; //No of assigned Childs + FirstChild: Byte; //No of Child on whose Interaction Position the Button should be + end; + + AThemeButtonCollection = array of TThemeButtonCollection; + PAThemeButtonCollection = ^AThemeButtonCollection; + + TThemeSelect = record + Tex: string; + TexSBG: string; + X: integer; + Y: integer; + W: integer; + H: integer; + Text: string; + ColR, ColG, ColB, Int: real; + DColR, DColG, DColB, DInt: real; + TColR, TColG, TColB, TInt: real; + TDColR, TDColG, TDColB, TDInt: real; + SBGColR, SBGColG, SBGColB, SBGInt: real; + SBGDColR, SBGDColG, SBGDColB, SBGDInt: real; + STColR, STColG, STColB, STInt: real; + STDColR, STDColG, STDColB, STDInt: real; + SkipX: integer; + end; + + TThemeSelectSlide = record + Tex: string; + TexSBG: string; + X: integer; + Y: integer; + W: integer; + H: integer; + Z: real; + + TextSize: integer; + + //SBGW Mod + SBGW: integer; + + Text: string; + ColR, ColG, ColB, Int: real; + DColR, DColG, DColB, DInt: real; + TColR, TColG, TColB, TInt: real; + TDColR, TDColG, TDColB, TDInt: real; + SBGColR, SBGColG, SBGColB, SBGInt: real; + SBGDColR, SBGDColG, SBGDColB, SBGDInt: real; + STColR, STColG, STColB, STInt: real; + STDColR, STDColG, STDColB, STDInt: real; + SkipX: integer; + end; + + PThemeBasic = ^TThemeBasic; + TThemeBasic = class + Background: TThemeBackground; + Text: AThemeText; + Static: AThemeStatic; + + //Button Collection Mod + ButtonCollection: AThemeButtonCollection; + end; + + TThemeLoading = class(TThemeBasic) + StaticAnimation: TThemeStatic; + TextLoading: TThemeText; + end; + + TThemeMain = class(TThemeBasic) + ButtonSolo: TThemeButton; + ButtonMulti: TThemeButton; + ButtonStat: TThemeButton; + ButtonEditor: TThemeButton; + ButtonOptions: TThemeButton; + ButtonExit: TThemeButton; + + TextDescription: TThemeText; + TextDescriptionLong: TThemeText; + Description: array[0..5] of string; + DescriptionLong: array[0..5] of string; + end; + + TThemeName = class(TThemeBasic) + ButtonPlayer: array[1..6] of TThemeButton; + end; + + TThemeLevel = class(TThemeBasic) + ButtonEasy: TThemeButton; + ButtonMedium: TThemeButton; + ButtonHard: TThemeButton; + end; + + TThemeSong = class(TThemeBasic) + TextArtist: TThemeText; + TextTitle: TThemeText; + TextNumber: TThemeText; + + //Video Icon Mod + VideoIcon: TThemeStatic; + + //Show Cat in TopLeft Mod + TextCat: TThemeText; + StaticCat: TThemeStatic; + + //Cover Mod + Cover: record + Reflections: Boolean; + X: Integer; + Y: Integer; + Z: Integer; + W: Integer; + H: Integer; + Style: Integer; + end; + + //Equalizer Mod + Equalizer: record + Visible: Boolean; + Direction: Boolean; + Alpha: real; + X: Integer; + Y: Integer; + Z: Real; + W: Integer; + H: Integer; + Space: Integer; + Bands: Integer; + Length: Integer; + ColR, ColG, ColB: Real; + end; + + + //Party and Non Party specific Statics and Texts + StaticParty: AThemeStatic; + TextParty: AThemeText; + + StaticNonParty: AThemeStatic; + TextNonParty: AThemeText; + + //Party Mode + StaticTeam1Joker1: TThemeStatic; + StaticTeam1Joker2: TThemeStatic; + StaticTeam1Joker3: TThemeStatic; + StaticTeam1Joker4: TThemeStatic; + StaticTeam1Joker5: TThemeStatic; + StaticTeam2Joker1: TThemeStatic; + StaticTeam2Joker2: TThemeStatic; + StaticTeam2Joker3: TThemeStatic; + StaticTeam2Joker4: TThemeStatic; + StaticTeam2Joker5: TThemeStatic; + StaticTeam3Joker1: TThemeStatic; + StaticTeam3Joker2: TThemeStatic; + StaticTeam3Joker3: TThemeStatic; + StaticTeam3Joker4: TThemeStatic; + StaticTeam3Joker5: TThemeStatic; + + + end; + + TThemeSing = class(TThemeBasic) + + //TimeBar mod + StaticTimeProgress: TThemeStatic; + TextTimeText : TThemeText; + //eoa TimeBar mod + + StaticP1: TThemeStatic; + TextP1: TThemeText; + StaticP1ScoreBG: TThemeStatic; //Static for ScoreBG + TextP1Score: TThemeText; + + //moveable singbar mod + StaticP1SingBar: TThemeStatic; + StaticP1ThreePSingBar: TThemeStatic; + StaticP1TwoPSingBar: TThemeStatic; + StaticP2RSingBar: TThemeStatic; + StaticP2MSingBar: TThemeStatic; + StaticP3SingBar: TThemeStatic; + //eoa moveable singbar + + //added for ps3 skin + //game in 2/4 player modi + StaticP1TwoP: TThemeStatic; + StaticP1TwoPScoreBG: TThemeStatic; //Static for ScoreBG + TextP1TwoP: TThemeText; + TextP1TwoPScore: TThemeText; + //game in 3/6 player modi + StaticP1ThreeP: TThemeStatic; + StaticP1ThreePScoreBG: TThemeStatic; //Static for ScoreBG + TextP1ThreeP: TThemeText; + TextP1ThreePScore: TThemeText; + //eoa + + StaticP2R: TThemeStatic; + StaticP2RScoreBG: TThemeStatic; //Static for ScoreBG + TextP2R: TThemeText; + TextP2RScore: TThemeText; + + StaticP2M: TThemeStatic; + StaticP2MScoreBG: TThemeStatic; //Static for ScoreBG + TextP2M: TThemeText; + TextP2MScore: TThemeText; + + StaticP3R: TThemeStatic; + StaticP3RScoreBG: TThemeStatic; //Static for ScoreBG + TextP3R: TThemeText; + TextP3RScore: TThemeText; + + //Linebonus Translations + LineBonusText: Array [0..8] of String; + end; + + TThemeScore = class(TThemeBasic) + TextArtist: TThemeText; + TextTitle: TThemeText; + + TextArtistTitle: TThemeText; + + PlayerStatic: array[1..6] of AThemeStatic; + PlayerTexts: array[1..6] of AThemeText; + + TextName: array[1..6] of TThemeText; + TextScore: array[1..6] of TThemeText; + + TextNotes: array[1..6] of TThemeText; + TextNotesScore: array[1..6] of TThemeText; + TextLineBonus: array[1..6] of TThemeText; + TextLineBonusScore: array[1..6] of TThemeText; + TextGoldenNotes: array[1..6] of TThemeText; + TextGoldenNotesScore: array[1..6] of TThemeText; + TextTotal: array[1..6] of TThemeText; + TextTotalScore: array[1..6] of TThemeText; + + StaticBoxLightest: array[1..6] of TThemeStatic; + StaticBoxLight: array[1..6] of TThemeStatic; + StaticBoxDark: array[1..6] of TThemeStatic; + + StaticBackLevel: array[1..6] of TThemeStatic; + StaticBackLevelRound: array[1..6] of TThemeStatic; + StaticLevel: array[1..6] of TThemeStatic; + StaticLevelRound: array[1..6] of TThemeStatic; + +// Description: array[0..5] of string;} + end; + + TThemeTop5 = class(TThemeBasic) + TextLevel: TThemeText; + TextArtistTitle: TThemeText; + + StaticNumber: AThemeStatic; + TextNumber: AThemeText; + TextName: AThemeText; + TextScore: AThemeText; + end; + + TThemeOptions = class(TThemeBasic) + ButtonGame: TThemeButton; + ButtonGraphics: TThemeButton; + ButtonSound: TThemeButton; + ButtonLyrics: TThemeButton; + ButtonThemes: TThemeButton; + ButtonRecord: TThemeButton; + ButtonAdvanced: TThemeButton; + ButtonExit: TThemeButton; + + TextDescription: TThemeText; + Description: array[0..7] of string; + end; + + TThemeOptionsGame = class(TThemeBasic) + SelectPlayers: TThemeSelect; + SelectDifficulty: TThemeSelect; + SelectLanguage: TThemeSelectSlide; + SelectTabs: TThemeSelect; + SelectSorting: TThemeSelectSlide; + SelectDebug: TThemeSelect; + ButtonExit: TThemeButton; + end; + + TThemeOptionsGraphics = class(TThemeBasic) + SelectFullscreen: TThemeSelect; + SelectSlideResolution: TThemeSelectSlide; + SelectDepth: TThemeSelect; + SelectOscilloscope: TThemeSelect; + SelectLineBonus: TThemeSelect; + SelectMovieSize: TThemeSelect; + ButtonExit: TThemeButton; + end; + + TThemeOptionsSound = class(TThemeBasic) + SelectMicBoost: TThemeSelect; + SelectClickAssist: TThemeSelect; + SelectBeatClick: TThemeSelect; + SelectThreshold: TThemeSelect; + //Song Preview + SelectSlidePreviewVolume: TThemeSelectSlide; + SelectSlidePreviewFading: TThemeSelectSlide; + ButtonExit: TThemeButton; + end; + + TThemeOptionsLyrics = class(TThemeBasic) + SelectLyricsFont: TThemeSelect; + SelectLyricsEffect: TThemeSelect; + SelectSolmization: TThemeSelect; + ButtonExit: TThemeButton; + end; + + TThemeOptionsThemes = class(TThemeBasic) + SelectTheme: TThemeSelectSlide; + SelectSkin: TThemeSelectSlide; + SelectColor: TThemeSelectSlide; + ButtonExit: TThemeButton; + end; + + TThemeOptionsRecord = class(TThemeBasic) + SelectSlideCard: TThemeSelectSlide; + SelectSlideInput: TThemeSelectSlide; + SelectSlideChannelL: TThemeSelectSlide; + SelectSlideChannelR: TThemeSelectSlide; + ButtonExit: TThemeButton; + end; + + TThemeOptionsAdvanced = class(TThemeBasic) + SelectLoadAnimation: TThemeSelect; + SelectEffectSing: TThemeSelect; + SelectScreenFade: TThemeSelect; + SelectLineBonus: TThemeSelect; + SelectAskbeforeDel: TThemeSelect; + SelectOnSongClick: TThemeSelectSlide; + SelectPartyPopup: TThemeSelect; + ButtonExit: TThemeButton; + end; + + //Error- and Check-Popup + TThemeError = class(TThemeBasic) + Button1: TThemeButton; + TextError: TThemeText; + end; + + TThemeCheck = class(TThemeBasic) + Button1: TThemeButton; + Button2: TThemeButton; + TextCheck: TThemeText; + end; + + + //ScreenSong Menue + TThemeSongMenu = class(TThemeBasic) + Button1: TThemeButton; + Button2: TThemeButton; + Button3: TThemeButton; + Button4: TThemeButton; + + SelectSlide3: TThemeSelectSlide; + + TextMenu: TThemeText; + end; + + TThemeSongJumpTo = class(TThemeBasic) + ButtonSearchText: TThemeButton; + SelectSlideType: TThemeSelectSlide; + TextFound: TThemeText; + + //Translated Texts + Songsfound: String; + NoSongsfound: String; + CatText: String; + IType: array [0..2] of String; + end; + + //Party Screens + TThemePartyNewRound = class(TThemeBasic) + TextRound1: TThemeText; + TextRound2: TThemeText; + TextRound3: TThemeText; + TextRound4: TThemeText; + TextRound5: TThemeText; + TextRound6: TThemeText; + TextRound7: TThemeText; + TextWinner1: TThemeText; + TextWinner2: TThemeText; + TextWinner3: TThemeText; + TextWinner4: TThemeText; + TextWinner5: TThemeText; + TextWinner6: TThemeText; + TextWinner7: TThemeText; + TextNextRound: TThemeText; + TextNextRoundNo: TThemeText; + TextNextPlayer1: TThemeText; + TextNextPlayer2: TThemeText; + TextNextPlayer3: TThemeText; + + StaticRound1: TThemeStatic; + StaticRound2: TThemeStatic; + StaticRound3: TThemeStatic; + StaticRound4: TThemeStatic; + StaticRound5: TThemeStatic; + StaticRound6: TThemeStatic; + StaticRound7: TThemeStatic; + + TextScoreTeam1: TThemeText; + TextScoreTeam2: TThemeText; + TextScoreTeam3: TThemeText; + TextNameTeam1: TThemeText; + TextNameTeam2: TThemeText; + TextNameTeam3: TThemeText; + TextTeam1Players: TThemeText; + TextTeam2Players: TThemeText; + TextTeam3Players: TThemeText; + + StaticTeam1: TThemeStatic; + StaticTeam2: TThemeStatic; + StaticTeam3: TThemeStatic; + StaticNextPlayer1: TThemeStatic; + StaticNextPlayer2: TThemeStatic; + StaticNextPlayer3: TThemeStatic; + end; + + TThemePartyScore = class(TThemeBasic) + TextScoreTeam1: TThemeText; + TextScoreTeam2: TThemeText; + TextScoreTeam3: TThemeText; + TextNameTeam1: TThemeText; + TextNameTeam2: TThemeText; + TextNameTeam3: TThemeText; + StaticTeam1: TThemeStatic; + StaticTeam1BG: TThemeStatic; + StaticTeam1Deco: TThemeStatic; + StaticTeam2: TThemeStatic; + StaticTeam2BG: TThemeStatic; + StaticTeam2Deco: TThemeStatic; + StaticTeam3: TThemeStatic; + StaticTeam3BG: TThemeStatic; + StaticTeam3Deco: TThemeStatic; + + DecoTextures: record + ChangeTextures: Boolean; + + FirstTexture: String; + FirstTyp: String; + FirstColor: String; + + SecondTexture: String; + SecondTyp: String; + SecondColor: String; + + ThirdTexture: String; + ThirdTyp: String; + ThirdColor: String; + end; + + + TextWinner: TThemeText; + end; + + TThemePartyWin = class(TThemeBasic) + TextScoreTeam1: TThemeText; + TextScoreTeam2: TThemeText; + TextScoreTeam3: TThemeText; + TextNameTeam1: TThemeText; + TextNameTeam2: TThemeText; + TextNameTeam3: TThemeText; + StaticTeam1: TThemeStatic; + StaticTeam1BG: TThemeStatic; + StaticTeam1Deco: TThemeStatic; + StaticTeam2: TThemeStatic; + StaticTeam2BG: TThemeStatic; + StaticTeam2Deco: TThemeStatic; + StaticTeam3: TThemeStatic; + StaticTeam3BG: TThemeStatic; + StaticTeam3Deco: TThemeStatic; + + TextWinner: TThemeText; + end; + + TThemePartyOptions = class(TThemeBasic) + SelectLevel: TThemeSelectSlide; + SelectPlayList: TThemeSelectSlide; + SelectPlayList2: TThemeSelectSlide; + SelectRounds: TThemeSelectSlide; + SelectTeams: TThemeSelectSlide; + SelectPlayers1: TThemeSelectSlide; + SelectPlayers2: TThemeSelectSlide; + SelectPlayers3: TThemeSelectSlide; + + {ButtonNext: TThemeButton; + ButtonPrev: TThemeButton;} + end; + + TThemePartyPlayer = class(TThemeBasic) + Team1Name: TThemeButton; + Player1Name: TThemeButton; + Player2Name: TThemeButton; + Player3Name: TThemeButton; + Player4Name: TThemeButton; + + Team2Name: TThemeButton; + Player5Name: TThemeButton; + Player6Name: TThemeButton; + Player7Name: TThemeButton; + Player8Name: TThemeButton; + + Team3Name: TThemeButton; + Player9Name: TThemeButton; + Player10Name: TThemeButton; + Player11Name: TThemeButton; + Player12Name: TThemeButton; + + {ButtonNext: TThemeButton; + ButtonPrev: TThemeButton;} + end; + + //Stats Screens + TThemeStatMain = class(TThemeBasic) + ButtonScores: TThemeButton; + ButtonSingers: TThemeButton; + ButtonSongs: TThemeButton; + ButtonBands: TThemeButton; + ButtonExit: TThemeButton; + + TextOverview: TThemeText; + end; + + TThemeStatDetail = class(TThemeBasic) + ButtonNext: TThemeButton; + ButtonPrev: TThemeButton; + ButtonReverse: TThemeButton; + ButtonExit: TThemeButton; + + TextDescription: TThemeText; + TextPage: TThemeText; + TextList: AThemeText; + + Description: array[0..3] of string; + DescriptionR: array[0..3] of string; + FormatStr: array[0..3] of string; + PageStr: String; + end; + + //Playlist Translations + TThemePlaylist = record + CatText: string; + end; + + TTheme = class + private + {$IFDEF THEMESAVE} + ThemeIni: TIniFile; + {$ELSE} + ThemeIni: TMemIniFile; + {$ENDIF} + + LastThemeBasic: TThemeBasic; + public + + Loading: TThemeLoading; + Main: TThemeMain; + Name: TThemeName; + Level: TThemeLevel; + Song: TThemeSong; + Sing: TThemeSing; + Score: TThemeScore; + Top5: TThemeTop5; + Options: TThemeOptions; + OptionsGame: TThemeOptionsGame; + OptionsGraphics: TThemeOptionsGraphics; + OptionsSound: TThemeOptionsSound; + OptionsLyrics: TThemeOptionsLyrics; + OptionsThemes: TThemeOptionsThemes; + OptionsRecord: TThemeOptionsRecord; + OptionsAdvanced: TThemeOptionsAdvanced; + //error and check popup + ErrorPopup: TThemeError; + CheckPopup: TThemeCheck; + //ScreenSong extensions + SongMenu: TThemeSongMenu; + SongJumpto: TThemeSongJumpTo; + //Party Screens: + PartyNewRound: TThemePartyNewRound; + PartyScore: TThemePartyScore; + PartyWin: TThemePartyWin; + PartyOptions: TThemePartyOptions; + PartyPlayer: TThemePartyPlayer; + + //Stats Screens: + StatMain: TThemeStatMain; + StatDetail: TThemeStatDetail; + + Playlist: TThemePlaylist; + + ILevel: array[0..2] of String; + + constructor Create(FileName: string); overload; // Initialize theme system + constructor Create(FileName: string; Color: integer); overload; // Initialize theme system with color + function LoadTheme(FileName: string; sColor: integer): boolean; // Load some theme settings from file + + procedure LoadColors; + + procedure ThemeLoadBasic(Theme: TThemeBasic; Name: string); + procedure ThemeLoadBackground(var ThemeBackground: TThemeBackground; Name: string); + procedure ThemeLoadText(var ThemeText: TThemeText; Name: string); + procedure ThemeLoadTexts(var ThemeText: AThemeText; Name: string); + procedure ThemeLoadStatic(var ThemeStatic: TThemeStatic; Name: string); + procedure ThemeLoadStatics(var ThemeStatic: AThemeStatic; Name: string); + procedure ThemeLoadButton(var ThemeButton: TThemeButton; Name: string; const Collections: PAThemeButtonCollection = nil); + procedure ThemeLoadButtonCollection(var Collection: TThemeButtonCollection; Name: string); + procedure ThemeLoadButtonCollections(var Collections: AThemeButtonCollection; Name: string); + procedure ThemeLoadSelect(var ThemeSelect: TThemeSelect; Name: string); + procedure ThemeLoadSelectSlide(var ThemeSelectS: TThemeSelectSlide; Name: string); + + procedure ThemeSave(FileName: string); + procedure ThemeSaveBasic(Theme: TThemeBasic; Name: string); + procedure ThemeSaveBackground(ThemeBackground: TThemeBackground; Name: string); + procedure ThemeSaveStatic(ThemeStatic: TThemeStatic; Name: string); + procedure ThemeSaveStatics(ThemeStatic: AThemeStatic; Name: string); + procedure ThemeSaveText(ThemeText: TThemeText; Name: string); + procedure ThemeSaveTexts(ThemeText: AThemeText; Name: string); + procedure ThemeSaveButton(ThemeButton: TThemeButton; Name: string); + + end; + + TColor = record + Name: string; + RGB: TRGB; + end; + +function ColorExists(Name: string): integer; +procedure LoadColor(var R, G, B: real; ColorName: string); +function GetSystemColor(Color: integer): TRGB; +function ColorSqrt(RGB: TRGB): TRGB; + +var + //Skin: TSkin; + Theme: TTheme; + Color: array of TColor; + +implementation + +uses + UCommon, + ULanguage, + USkins, + UIni; + +constructor TTheme.Create(FileName: string); +begin + Create(FileName, 0); +end; + +constructor TTheme.Create(FileName: string; Color: integer); +begin + Loading := TThemeLoading.Create; + Main := TThemeMain.Create; + Name := TThemeName.Create; + Level := TThemeLevel.Create; + Song := TThemeSong.Create; + Sing := TThemeSing.Create; + Score := TThemeScore.Create; + Top5 := TThemeTop5.Create; + Options := TThemeOptions.Create; + OptionsGame := TThemeOptionsGame.Create; + OptionsGraphics := TThemeOptionsGraphics.Create; + OptionsSound := TThemeOptionsSound.Create; + OptionsLyrics := TThemeOptionsLyrics.Create; + OptionsThemes := TThemeOptionsThemes.Create; + OptionsRecord := TThemeOptionsRecord.Create; + OptionsAdvanced := TThemeOptionsAdvanced.Create; + + ErrorPopup := TThemeError.Create; + CheckPopup := TThemeCheck.Create; + + SongMenu := TThemeSongMenu.Create; + SongJumpto := TThemeSongJumpto.Create; + //Party Screens + PartyNewRound := TThemePartyNewRound.Create; + PartyWin := TThemePartyWin.Create; + PartyScore := TThemePartyScore.Create; + PartyOptions := TThemePartyOptions.Create; + PartyPlayer := TThemePartyPlayer.Create; + + //Stats Screens: + StatMain := TThemeStatMain.Create; + StatDetail := TThemeStatDetail.Create; + + LoadTheme(FileName, Color); + +end; + + +function TTheme.LoadTheme(FileName: string; sColor: integer): boolean; +var + I: integer; + Path: string; +begin + Result := false; + + FileName := AdaptFilePaths( FileName ); + + if not FileExists(FileName) then + begin + {$ifndef win32} + writeln( 'ERROR !!! Theme does not exist ('+ FileName +')' ); + {$endif} + + Log.LogStatus( 'ERROR !!! Theme does not exist ('+ FileName +')' , 'TTheme.LoadTheme'); + end; + + if FileExists(FileName) then + begin + Result := true; + + {$IFDEF THEMESAVE} + ThemeIni := TIniFile.Create(FileName); + {$ELSE} + ThemeIni := TMemIniFile.Create(FileName); + {$ENDIF} + + if ThemeIni.ReadString('Theme', 'Name', '') <> '' then begin + + {Skin.SkinName := ThemeIni.ReadString('Theme', 'Name', 'Singstar'); + Skin.SkinPath := 'Skins\' + Skin.SkinName + '\'; + Skin.SkinReg := false; } + Skin.Color := sColor; + + Skin.LoadSkin(ISkin[Ini.SkinNo]); + + LoadColors; + +// ThemeIni.Free; +// ThemeIni := TIniFile.Create('Themes\Singstar\Main.ini'); + + // Loading + ThemeLoadBasic(Loading, 'Loading'); + ThemeLoadText(Loading.TextLoading, 'LoadingTextLoading'); + ThemeLoadStatic(Loading.StaticAnimation, 'LoadingStaticAnimation'); + + // Main + ThemeLoadBasic(Main, 'Main'); + + ThemeLoadText(Main.TextDescription, 'MainTextDescription'); + ThemeLoadText(Main.TextDescriptionLong, 'MainTextDescriptionLong'); + ThemeLoadButton(Main.ButtonSolo, 'MainButtonSolo'); + ThemeLoadButton(Main.ButtonMulti, 'MainButtonMulti'); + ThemeLoadButton(Main.ButtonStat, 'MainButtonStats'); + ThemeLoadButton(Main.ButtonEditor, 'MainButtonEditor'); + ThemeLoadButton(Main.ButtonOptions, 'MainButtonOptions'); + ThemeLoadButton(Main.ButtonExit, 'MainButtonExit'); + + //Main Desc Text Translation Start + + //{$IFDEF TRANSLATE} + Main.Description[0] := Language.Translate('SING_SING'); + Main.DescriptionLong[0] := Language.Translate('SING_SING_DESC'); + Main.Description[1] := Language.Translate('SING_MULTI'); + Main.DescriptionLong[1] := Language.Translate('SING_MULTI_DESC'); + Main.Description[2] := Language.Translate('SING_STATS'); + Main.DescriptionLong[2] := Language.Translate('SING_STATS_DESC'); + Main.Description[3] := Language.Translate('SING_EDITOR'); + Main.DescriptionLong[3] := Language.Translate('SING_EDITOR_DESC'); + Main.Description[4] := Language.Translate('SING_GAME_OPTIONS'); + Main.DescriptionLong[4] := Language.Translate('SING_GAME_OPTIONS_DESC'); + Main.Description[5] := Language.Translate('SING_EXIT'); + Main.DescriptionLong[5] := Language.Translate('SING_EXIT_DESC'); + //{$ENDIF} + + //Main Desc Text Translation End + + Main.TextDescription.Text := Main.Description[0]; + Main.TextDescriptionLong.Text := Main.DescriptionLong[0]; + + // Name + ThemeLoadBasic(Name, 'Name'); + + for I := 1 to 6 do + ThemeLoadButton(Name.ButtonPlayer[I], 'NameButtonPlayer'+IntToStr(I)); + + // Level + ThemeLoadBasic(Level, 'Level'); + + ThemeLoadButton(Level.ButtonEasy, 'LevelButtonEasy'); + ThemeLoadButton(Level.ButtonMedium, 'LevelButtonMedium'); + ThemeLoadButton(Level.ButtonHard, 'LevelButtonHard'); + + + // Song + ThemeLoadBasic(Song, 'Song'); + + ThemeLoadText(Song.TextArtist, 'SongTextArtist'); + ThemeLoadText(Song.TextTitle, 'SongTextTitle'); + ThemeLoadText(Song.TextNumber, 'SongTextNumber'); + + //Video Icon Mod + ThemeLoadStatic(Song.VideoIcon, 'SongVideoIcon'); + + //Show Cat in TopLeft Mod + ThemeLoadStatic(Song.StaticCat, 'SongStaticCat'); + ThemeLoadText(Song.TextCat, 'SongTextCat'); + + //Load Cover Pos and Size from Theme Mod + Song.Cover.X := ThemeIni.ReadInteger('SongCover', 'X', 300); + Song.Cover.Y := ThemeIni.ReadInteger('SongCover', 'Y', 190); + Song.Cover.W := ThemeIni.ReadInteger('SongCover', 'W', 300); + Song.Cover.H := ThemeIni.ReadInteger('SongCover', 'H', 200); + Song.Cover.Style := ThemeIni.ReadInteger('SongCover', 'Style', 4); + Song.Cover.Reflections := (ThemeIni.ReadInteger('SongCover', 'Reflections', 0) = 1); + //Load Cover Pos and Size from Theme Mod End + + //Load Equalizer Pos and Size from Theme Mod + Song.Equalizer.Visible := (ThemeIni.ReadInteger('SongEqualizer', 'Visible', 0) = 1); + Song.Equalizer.Direction := (ThemeIni.ReadInteger('SongEqualizer', 'Direction', 0) = 1); + Song.Equalizer.Alpha := ThemeIni.ReadInteger('SongEqualizer', 'Alpha', 1); + Song.Equalizer.Space := ThemeIni.ReadInteger('SongEqualizer', 'Space', 1); + Song.Equalizer.X := ThemeIni.ReadInteger('SongEqualizer', 'X', 0); + Song.Equalizer.Y := ThemeIni.ReadInteger('SongEqualizer', 'Y', 0); + Song.Equalizer.Z := ThemeIni.ReadInteger('SongEqualizer', 'Z', 1); + Song.Equalizer.W := ThemeIni.ReadInteger('SongEqualizer', 'PieceW', 8); + Song.Equalizer.H := ThemeIni.ReadInteger('SongEqualizer', 'PieceH', 8); + Song.Equalizer.Bands := ThemeIni.ReadInteger('SongEqualizer', 'Bands', 5); + Song.Equalizer.Length := ThemeIni.ReadInteger('SongEqualizer', 'Length', 12); + + //Color + I := ColorExists(ThemeIni.ReadString('SongEqualizer', 'Color', 'Black')); + if I >= 0 then begin + Song.Equalizer.ColR := Color[I].RGB.R; + Song.Equalizer.ColG := Color[I].RGB.G; + Song.Equalizer.ColB := Color[I].RGB.B; + end + else begin + Song.Equalizer.ColR := 0; + Song.Equalizer.ColG := 0; + Song.Equalizer.ColB := 0; + end; + //Load Equalizer Pos and Size from Theme Mod End + + //Party and Non Party specific Statics and Texts + ThemeLoadStatics (Song.StaticParty, 'SongStaticParty'); + ThemeLoadTexts (Song.TextParty, 'SongTextParty'); + + ThemeLoadStatics (Song.StaticNonParty, 'SongStaticNonParty'); + ThemeLoadTexts (Song.TextNonParty, 'SongTextNonParty'); + + //Party Mode + ThemeLoadStatic(Song.StaticTeam1Joker1, 'SongStaticTeam1Joker1'); + ThemeLoadStatic(Song.StaticTeam1Joker2, 'SongStaticTeam1Joker2'); + ThemeLoadStatic(Song.StaticTeam1Joker3, 'SongStaticTeam1Joker3'); + ThemeLoadStatic(Song.StaticTeam1Joker4, 'SongStaticTeam1Joker4'); + ThemeLoadStatic(Song.StaticTeam1Joker5, 'SongStaticTeam1Joker5'); + + ThemeLoadStatic(Song.StaticTeam2Joker1, 'SongStaticTeam2Joker1'); + ThemeLoadStatic(Song.StaticTeam2Joker2, 'SongStaticTeam2Joker2'); + ThemeLoadStatic(Song.StaticTeam2Joker3, 'SongStaticTeam2Joker3'); + ThemeLoadStatic(Song.StaticTeam2Joker4, 'SongStaticTeam2Joker4'); + ThemeLoadStatic(Song.StaticTeam2Joker5, 'SongStaticTeam2Joker5'); + + ThemeLoadStatic(Song.StaticTeam3Joker1, 'SongStaticTeam3Joker1'); + ThemeLoadStatic(Song.StaticTeam3Joker2, 'SongStaticTeam3Joker2'); + ThemeLoadStatic(Song.StaticTeam3Joker3, 'SongStaticTeam3Joker3'); + ThemeLoadStatic(Song.StaticTeam3Joker4, 'SongStaticTeam3Joker4'); + ThemeLoadStatic(Song.StaticTeam3Joker5, 'SongStaticTeam3Joker5'); + + + // Sing + ThemeLoadBasic(Sing, 'Sing'); + + //TimeBar mod + ThemeLoadStatic(Sing.StaticTimeProgress, 'SingTimeProgress'); + ThemeLoadText(Sing.TextTimeText, 'SingTimeText'); + //eoa TimeBar mod + + //moveable singbar mod + ThemeLoadStatic(Sing.StaticP1SingBar, 'SingP1SingBar'); + ThemeLoadStatic(Sing.StaticP1TwoPSingBar, 'SingP1TwoPSingBar'); + ThemeLoadStatic(Sing.StaticP1ThreePSingBar, 'SingP1ThreePSingBar'); + ThemeLoadStatic(Sing.StaticP2RSingBar, 'SingP2RSingBar'); + ThemeLoadStatic(Sing.StaticP2MSingBar, 'SingP2MSingBar'); + ThemeLoadStatic(Sing.StaticP3SingBar, 'SingP3SingBar'); + //eoa moveable singbar + + ThemeLoadStatic(Sing.StaticP1, 'SingP1Static'); + ThemeLoadText(Sing.TextP1, 'SingP1Text'); + ThemeLoadStatic(Sing.StaticP1ScoreBG, 'SingP1Static2'); + ThemeLoadText(Sing.TextP1Score, 'SingP1TextScore'); + //Added for ps3 skin + //This one is shown in 2/4P mode + //if it exists, otherwise the one Player equivaltents are used + if (ThemeIni.SectionExists('SingP1TwoPTextScore')) then + begin + ThemeLoadStatic(Sing.StaticP1TwoP, 'SingP1TwoPStatic'); + ThemeLoadText(Sing.TextP1TwoP, 'SingP1TwoPText'); + ThemeLoadStatic(Sing.StaticP1TwoPScoreBG, 'SingP1TwoPStatic2'); + ThemeLoadText(Sing.TextP1TwoPScore, 'SingP1TwoPTextScore'); + end + else + begin + Sing.StaticP1TwoP := Sing.StaticP1; + Sing.TextP1TwoP := Sing.TextP1; + Sing.StaticP1TwoPScoreBG := Sing.StaticP1ScoreBG; + Sing.TextP1TwoPScore := Sing.TextP1Score; + end; + + //This one is shown in 3/6P mode + //if it exists, otherwise the one Player equivaltents are used + if (ThemeIni.SectionExists('SingP1TwoPTextScore')) then + begin + ThemeLoadStatic(Sing.StaticP1ThreeP, 'SingP1ThreePStatic'); + ThemeLoadText(Sing.TextP1ThreeP, 'SingP1ThreePText'); + ThemeLoadStatic(Sing.StaticP1ThreePScoreBG, 'SingP1ThreePStatic2'); + ThemeLoadText(Sing.TextP1ThreePScore, 'SingP1ThreePTextScore'); + end + else + begin + Sing.StaticP1ThreeP := Sing.StaticP1; + Sing.TextP1ThreeP := Sing.TextP1; + Sing.StaticP1ThreePScoreBG := Sing.StaticP1ScoreBG; + Sing.TextP1ThreePScore := Sing.TextP1Score; + end; + //eoa + ThemeLoadStatic(Sing.StaticP2R, 'SingP2RStatic'); + ThemeLoadText(Sing.TextP2R, 'SingP2RText'); + ThemeLoadStatic(Sing.StaticP2RScoreBG, 'SingP2RStatic2'); + ThemeLoadText(Sing.TextP2RScore, 'SingP2RTextScore'); + + ThemeLoadStatic(Sing.StaticP2M, 'SingP2MStatic'); + ThemeLoadText(Sing.TextP2M, 'SingP2MText'); + ThemeLoadStatic(Sing.StaticP2MScoreBG, 'SingP2MStatic2'); + ThemeLoadText(Sing.TextP2MScore, 'SingP2MTextScore'); + + ThemeLoadStatic(Sing.StaticP3R, 'SingP3RStatic'); + ThemeLoadText(Sing.TextP3R, 'SingP3RText'); + ThemeLoadStatic(Sing.StaticP3RScoreBG, 'SingP3RStatic2'); + ThemeLoadText(Sing.TextP3RScore, 'SingP3RTextScore'); + + //Line Bonus Texts + Sing.LineBonusText[0] := Language.Translate('POPUP_AWFUL'); + Sing.LineBonusText[1] := Sing.LineBonusText[0]; + Sing.LineBonusText[2] := Language.Translate('POPUP_POOR'); + Sing.LineBonusText[3] := Language.Translate('POPUP_BAD'); + Sing.LineBonusText[4] := Language.Translate('POPUP_NOTBAD'); + Sing.LineBonusText[5] := Language.Translate('POPUP_GOOD'); + Sing.LineBonusText[6] := Language.Translate('POPUP_GREAT'); + Sing.LineBonusText[7] := Language.Translate('POPUP_AWESOME'); + Sing.LineBonusText[8] := Language.Translate('POPUP_PERFECT'); + + // Score + ThemeLoadBasic(Score, 'Score'); + + ThemeLoadText(Score.TextArtist, 'ScoreTextArtist'); + ThemeLoadText(Score.TextTitle, 'ScoreTextTitle'); + ThemeLoadText(Score.TextArtistTitle, 'ScoreTextArtistTitle'); + + for I := 1 to 6 do begin + ThemeLoadStatics(Score.PlayerStatic[I], 'ScorePlayer' + IntToStr(I) + 'Static'); + ThemeLoadTexts(Score.PlayerTexts[I], 'ScorePlayer' + IntToStr(I) + 'Text'); + + ThemeLoadText(Score.TextName[I], 'ScoreTextName' + IntToStr(I)); + ThemeLoadText(Score.TextScore[I], 'ScoreTextScore' + IntToStr(I)); + ThemeLoadText(Score.TextNotes[I], 'ScoreTextNotes' + IntToStr(I)); + ThemeLoadText(Score.TextNotesScore[I], 'ScoreTextNotesScore' + IntToStr(I)); + ThemeLoadText(Score.TextLineBonus[I], 'ScoreTextLineBonus' + IntToStr(I)); + ThemeLoadText(Score.TextLineBonusScore[I], 'ScoreTextLineBonusScore' + IntToStr(I)); + ThemeLoadText(Score.TextGoldenNotes[I], 'ScoreTextGoldenNotes' + IntToStr(I)); + ThemeLoadText(Score.TextGoldenNotesScore[I], 'ScoreTextGoldenNotesScore' + IntToStr(I)); + ThemeLoadText(Score.TextTotal[I], 'ScoreTextTotal' + IntToStr(I)); + ThemeLoadText(Score.TextTotalScore[I], 'ScoreTextTotalScore' + IntToStr(I)); + + ThemeLoadStatic(Score.StaticBoxLightest[I], 'ScoreStaticBoxLightest' + IntToStr(I)); + ThemeLoadStatic(Score.StaticBoxLight[I], 'ScoreStaticBoxLight' + IntToStr(I)); + ThemeLoadStatic(Score.StaticBoxDark[I], 'ScoreStaticBoxDark' + IntToStr(I)); + + ThemeLoadStatic(Score.StaticBackLevel[I], 'ScoreStaticBackLevel' + IntToStr(I)); + ThemeLoadStatic(Score.StaticBackLevelRound[I], 'ScoreStaticBackLevelRound' + IntToStr(I)); + ThemeLoadStatic(Score.StaticLevel[I], 'ScoreStaticLevel' + IntToStr(I)); + ThemeLoadStatic(Score.StaticLevelRound[I], 'ScoreStaticLevelRound' + IntToStr(I)); + end; + + // Top5 + ThemeLoadBasic(Top5, 'Top5'); + + ThemeLoadText(Top5.TextLevel, 'Top5TextLevel'); + ThemeLoadText(Top5.TextArtistTitle, 'Top5TextArtistTitle'); + ThemeLoadStatics(Top5.StaticNumber, 'Top5StaticNumber'); + ThemeLoadTexts(Top5.TextNumber, 'Top5TextNumber'); + ThemeLoadTexts(Top5.TextName, 'Top5TextName'); + ThemeLoadTexts(Top5.TextScore, 'Top5TextScore'); + + // Options + ThemeLoadBasic(Options, 'Options'); + + ThemeLoadButton(Options.ButtonGame, 'OptionsButtonGame'); + ThemeLoadButton(Options.ButtonGraphics, 'OptionsButtonGraphics'); + ThemeLoadButton(Options.ButtonSound, 'OptionsButtonSound'); + ThemeLoadButton(Options.ButtonLyrics, 'OptionsButtonLyrics'); + ThemeLoadButton(Options.ButtonThemes, 'OptionsButtonThemes'); + ThemeLoadButton(Options.ButtonRecord, 'OptionsButtonRecord'); + ThemeLoadButton(Options.ButtonAdvanced, 'OptionsButtonAdvanced'); + ThemeLoadButton(Options.ButtonExit, 'OptionsButtonExit'); + + //{$IFDEF TRANSLATE} + Options.Description[0] := Language.Translate('SING_OPTIONS_GAME'); + Options.Description[1] := Language.Translate('SING_OPTIONS_GRAPHICS'); + Options.Description[2] := Language.Translate('SING_OPTIONS_SOUND'); + Options.Description[3] := Language.Translate('SING_OPTIONS_LYRICS'); + Options.Description[4] := Language.Translate('SING_OPTIONS_THEMES'); + Options.Description[5] := Language.Translate('SING_OPTIONS_RECORD'); + Options.Description[6] := Language.Translate('SING_OPTIONS_ADVANCED'); + Options.Description[7] := Language.Translate('SING_OPTIONS_EXIT'); + //{$ENDIF} + + ThemeLoadText(Options.TextDescription, 'OptionsTextDescription'); + Options.TextDescription.Text := Options.Description[0]; + + // Options Game + ThemeLoadBasic(OptionsGame, 'OptionsGame'); + + ThemeLoadSelect(OptionsGame.SelectPlayers, 'OptionsGameSelectPlayers'); + ThemeLoadSelect(OptionsGame.SelectDifficulty, 'OptionsGameSelectDifficulty'); + ThemeLoadSelectSlide(OptionsGame.SelectLanguage, 'OptionsGameSelectSlideLanguage'); + ThemeLoadSelect(OptionsGame.SelectTabs, 'OptionsGameSelectTabs'); + ThemeLoadSelectSlide(OptionsGame.SelectSorting, 'OptionsGameSelectSlideSorting'); + ThemeLoadSelect(OptionsGame.SelectDebug, 'OptionsGameSelectDebug'); + ThemeLoadButton(OptionsGame.ButtonExit, 'OptionsGameButtonExit'); + + // Options Graphics + ThemeLoadBasic(OptionsGraphics, 'OptionsGraphics'); + + ThemeLoadSelect(OptionsGraphics.SelectFullscreen, 'OptionsGraphicsSelectFullscreen'); + ThemeLoadSelectSlide(OptionsGraphics.SelectSlideResolution, 'OptionsGraphicsSelectSlideResolution'); + ThemeLoadSelect(OptionsGraphics.SelectDepth, 'OptionsGraphicsSelectDepth'); + ThemeLoadSelect(OptionsGraphics.SelectOscilloscope, 'OptionsGraphicsSelectOscilloscope'); + ThemeLoadSelect(OptionsGraphics.SelectLineBonus, 'OptionsGraphicsSelectLineBonus'); + ThemeLoadSelect(OptionsGraphics.SelectMovieSize, 'OptionsGraphicsSelectMovieSize'); + ThemeLoadButton(OptionsGraphics.ButtonExit, 'OptionsGraphicsButtonExit'); + + // Options Sound + ThemeLoadBasic(OptionsSound, 'OptionsSound'); + + ThemeLoadSelect(OptionsSound.SelectMicBoost, 'OptionsSoundSelectMicBoost'); + ThemeLoadSelect(OptionsSound.SelectClickAssist, 'OptionsSoundSelectClickAssist'); + ThemeLoadSelect(OptionsSound.SelectBeatClick, 'OptionsSoundSelectBeatClick'); + ThemeLoadSelect(OptionsSound.SelectThreshold, 'OptionsSoundSelectThreshold'); + //Song Preview + ThemeLoadSelectSlide(OptionsSound.SelectSlidePreviewVolume, 'OptionsSoundSelectSlidePreviewVolume'); + ThemeLoadSelectSlide(OptionsSound.SelectSlidePreviewFading, 'OptionsSoundSelectSlidePreviewFading'); + + ThemeLoadButton(OptionsSound.ButtonExit, 'OptionsSoundButtonExit'); + + // Options Lyrics + ThemeLoadBasic(OptionsLyrics, 'OptionsLyrics'); + + ThemeLoadSelect(OptionsLyrics.SelectLyricsFont, 'OptionsLyricsSelectLyricsFont'); + ThemeLoadSelect(OptionsLyrics.SelectLyricsEffect, 'OptionsLyricsSelectLyricsEffect'); + ThemeLoadSelect(OptionsLyrics.SelectSolmization, 'OptionsLyricsSelectSolmization'); + ThemeLoadButton(OptionsLyrics.ButtonExit, 'OptionsLyricsButtonExit'); + + // Options Themes + ThemeLoadBasic(OptionsThemes, 'OptionsThemes'); + + ThemeLoadSelectSlide(OptionsThemes.SelectTheme, 'OptionsThemesSelectTheme'); + ThemeLoadSelectSlide(OptionsThemes.SelectSkin, 'OptionsThemesSelectSkin'); + ThemeLoadSelectSlide(OptionsThemes.SelectColor, 'OptionsThemesSelectColor'); + ThemeLoadButton(OptionsThemes.ButtonExit, 'OptionsThemesButtonExit'); + + // Options Record + ThemeLoadBasic(OptionsRecord, 'OptionsRecord'); + + ThemeLoadSelectSlide(OptionsRecord.SelectSlideCard, 'OptionsRecordSelectSlideCard'); + ThemeLoadSelectSlide(OptionsRecord.SelectSlideInput, 'OptionsRecordSelectSlideInput'); + ThemeLoadSelectSlide(OptionsRecord.SelectSlideChannelL, 'OptionsRecordSelectSlideChannelL'); + ThemeLoadSelectSlide(OptionsRecord.SelectSlideChannelR, 'OptionsRecordSelectSlideChannelR'); + ThemeLoadButton(OptionsRecord.ButtonExit, 'OptionsRecordButtonExit'); + + //Options Advanced + ThemeLoadBasic(OptionsAdvanced, 'OptionsAdvanced'); + + ThemeLoadSelect (OptionsAdvanced.SelectLoadAnimation, 'OptionsAdvancedSelectLoadAnimation'); + ThemeLoadSelect (OptionsAdvanced.SelectScreenFade, 'OptionsAdvancedSelectScreenFade'); + ThemeLoadSelect (OptionsAdvanced.SelectEffectSing, 'OptionsAdvancedSelectEffectSing'); + ThemeLoadSelect (OptionsAdvanced.SelectLineBonus, 'OptionsAdvancedSelectLineBonus'); + ThemeLoadSelectSlide (OptionsAdvanced.SelectOnSongClick, 'OptionsAdvancedSelectSlideOnSongClick'); + ThemeLoadSelect (OptionsAdvanced.SelectAskbeforeDel, 'OptionsAdvancedSelectAskbeforeDel'); + ThemeLoadSelect (OptionsAdvanced.SelectPartyPopup, 'OptionsAdvancedSelectPartyPopup'); + ThemeLoadButton (OptionsAdvanced.ButtonExit, 'OptionsAdvancedButtonExit'); + + //error and check popup + ThemeLoadBasic (ErrorPopup, 'ErrorPopup'); + ThemeLoadButton(ErrorPopup.Button1, 'ErrorPopupButton1'); + ThemeLoadText (ErrorPopup.TextError,'ErrorPopupText'); + ThemeLoadBasic (CheckPopup, 'CheckPopup'); + ThemeLoadButton(CheckPopup.Button1, 'CheckPopupButton1'); + ThemeLoadButton(CheckPopup.Button2, 'CheckPopupButton2'); + ThemeLoadText(CheckPopup.TextCheck , 'CheckPopupText'); + + //Song Menu + ThemeLoadBasic (SongMenu, 'SongMenu'); + ThemeLoadButton(SongMenu.Button1, 'SongMenuButton1'); + ThemeLoadButton(SongMenu.Button2, 'SongMenuButton2'); + ThemeLoadButton(SongMenu.Button3, 'SongMenuButton3'); + ThemeLoadButton(SongMenu.Button4, 'SongMenuButton4'); + ThemeLoadSelectSlide(SongMenu.SelectSlide3, 'SongMenuSelectSlide3'); + + ThemeLoadText(SongMenu.TextMenu, 'SongMenuTextMenu'); + + //Song Jumpto + ThemeLoadBasic (SongJumpto, 'SongJumpto'); + ThemeLoadButton(SongJumpto.ButtonSearchText, 'SongJumptoButtonSearchText'); + ThemeLoadSelectSlide(SongJumpto.SelectSlideType, 'SongJumptoSelectSlideType'); + ThemeLoadText(SongJumpto.TextFound, 'SongJumptoTextFound'); + //Translations + SongJumpto.IType[0] := Language.Translate('SONG_JUMPTO_TYPE1'); + SongJumpto.IType[1] := Language.Translate('SONG_JUMPTO_TYPE2'); + SongJumpto.IType[2] := Language.Translate('SONG_JUMPTO_TYPE3'); + SongJumpto.SongsFound := Language.Translate('SONG_JUMPTO_SONGSFOUND'); + SongJumpto.NoSongsFound := Language.Translate('SONG_JUMPTO_NOSONGSFOUND'); + SongJumpto.CatText := Language.Translate('SONG_JUMPTO_CATTEXT'); + + //Party Screens: + //Party NewRound + ThemeLoadBasic(PartyNewRound, 'PartyNewRound'); + + ThemeLoadText (PartyNewRound.TextRound1, 'PartyNewRoundTextRound1'); + ThemeLoadText (PartyNewRound.TextRound2, 'PartyNewRoundTextRound2'); + ThemeLoadText (PartyNewRound.TextRound3, 'PartyNewRoundTextRound3'); + ThemeLoadText (PartyNewRound.TextRound4, 'PartyNewRoundTextRound4'); + ThemeLoadText (PartyNewRound.TextRound5, 'PartyNewRoundTextRound5'); + ThemeLoadText (PartyNewRound.TextRound6, 'PartyNewRoundTextRound6'); + ThemeLoadText (PartyNewRound.TextRound7, 'PartyNewRoundTextRound7'); + ThemeLoadText (PartyNewRound.TextWinner1, 'PartyNewRoundTextWinner1'); + ThemeLoadText (PartyNewRound.TextWinner2, 'PartyNewRoundTextWinner2'); + ThemeLoadText (PartyNewRound.TextWinner3, 'PartyNewRoundTextWinner3'); + ThemeLoadText (PartyNewRound.TextWinner4, 'PartyNewRoundTextWinner4'); + ThemeLoadText (PartyNewRound.TextWinner5, 'PartyNewRoundTextWinner5'); + ThemeLoadText (PartyNewRound.TextWinner6, 'PartyNewRoundTextWinner6'); + ThemeLoadText (PartyNewRound.TextWinner7, 'PartyNewRoundTextWinner7'); + ThemeLoadText (PartyNewRound.TextNextRound, 'PartyNewRoundTextNextRound'); + ThemeLoadText (PartyNewRound.TextNextRoundNo, 'PartyNewRoundTextNextRoundNo'); + ThemeLoadText (PartyNewRound.TextNextPlayer1, 'PartyNewRoundTextNextPlayer1'); + ThemeLoadText (PartyNewRound.TextNextPlayer2, 'PartyNewRoundTextNextPlayer2'); + ThemeLoadText (PartyNewRound.TextNextPlayer3, 'PartyNewRoundTextNextPlayer3'); + + ThemeLoadStatic (PartyNewRound.StaticRound1, 'PartyNewRoundStaticRound1'); + ThemeLoadStatic (PartyNewRound.StaticRound2, 'PartyNewRoundStaticRound2'); + ThemeLoadStatic (PartyNewRound.StaticRound3, 'PartyNewRoundStaticRound3'); + ThemeLoadStatic (PartyNewRound.StaticRound4, 'PartyNewRoundStaticRound4'); + ThemeLoadStatic (PartyNewRound.StaticRound5, 'PartyNewRoundStaticRound5'); + ThemeLoadStatic (PartyNewRound.StaticRound6, 'PartyNewRoundStaticRound6'); + ThemeLoadStatic (PartyNewRound.StaticRound7, 'PartyNewRoundStaticRound7'); + + ThemeLoadText (PartyNewRound.TextScoreTeam1, 'PartyNewRoundTextScoreTeam1'); + ThemeLoadText (PartyNewRound.TextScoreTeam2, 'PartyNewRoundTextScoreTeam2'); + ThemeLoadText (PartyNewRound.TextScoreTeam3, 'PartyNewRoundTextScoreTeam3'); + ThemeLoadText (PartyNewRound.TextNameTeam1, 'PartyNewRoundTextNameTeam1'); + ThemeLoadText (PartyNewRound.TextNameTeam2, 'PartyNewRoundTextNameTeam2'); + ThemeLoadText (PartyNewRound.TextNameTeam3, 'PartyNewRoundTextNameTeam3'); + + ThemeLoadText (PartyNewRound.TextTeam1Players, 'PartyNewRoundTextTeam1Players'); + ThemeLoadText (PartyNewRound.TextTeam2Players, 'PartyNewRoundTextTeam2Players'); + ThemeLoadText (PartyNewRound.TextTeam3Players, 'PartyNewRoundTextTeam3Players'); + + ThemeLoadStatic (PartyNewRound.StaticTeam1, 'PartyNewRoundStaticTeam1'); + ThemeLoadStatic (PartyNewRound.StaticTeam2, 'PartyNewRoundStaticTeam2'); + ThemeLoadStatic (PartyNewRound.StaticTeam3, 'PartyNewRoundStaticTeam3'); + ThemeLoadStatic (PartyNewRound.StaticNextPlayer1, 'PartyNewRoundStaticNextPlayer1'); + ThemeLoadStatic (PartyNewRound.StaticNextPlayer2, 'PartyNewRoundStaticNextPlayer2'); + ThemeLoadStatic (PartyNewRound.StaticNextPlayer3, 'PartyNewRoundStaticNextPlayer3'); + + //Party Score + ThemeLoadBasic(PartyScore, 'PartyScore'); + + ThemeLoadText (PartyScore.TextScoreTeam1, 'PartyScoreTextScoreTeam1'); + ThemeLoadText (PartyScore.TextScoreTeam2, 'PartyScoreTextScoreTeam2'); + ThemeLoadText (PartyScore.TextScoreTeam3, 'PartyScoreTextScoreTeam3'); + ThemeLoadText (PartyScore.TextNameTeam1, 'PartyScoreTextNameTeam1'); + ThemeLoadText (PartyScore.TextNameTeam2, 'PartyScoreTextNameTeam2'); + ThemeLoadText (PartyScore.TextNameTeam3, 'PartyScoreTextNameTeam3'); + + ThemeLoadStatic (PartyScore.StaticTeam1, 'PartyScoreStaticTeam1'); + ThemeLoadStatic (PartyScore.StaticTeam1BG, 'PartyScoreStaticTeam1BG'); + ThemeLoadStatic (PartyScore.StaticTeam1Deco, 'PartyScoreStaticTeam1Deco'); + ThemeLoadStatic (PartyScore.StaticTeam2, 'PartyScoreStaticTeam2'); + ThemeLoadStatic (PartyScore.StaticTeam2BG, 'PartyScoreStaticTeam2BG'); + ThemeLoadStatic (PartyScore.StaticTeam2Deco, 'PartyScoreStaticTeam2Deco'); + ThemeLoadStatic (PartyScore.StaticTeam3, 'PartyScoreStaticTeam3'); + ThemeLoadStatic (PartyScore.StaticTeam3BG, 'PartyScoreStaticTeam3BG'); + ThemeLoadStatic (PartyScore.StaticTeam3Deco, 'PartyScoreStaticTeam3Deco'); + + //Load Party Score DecoTextures Object + PartyScore.DecoTextures.ChangeTextures := (ThemeIni.ReadInteger('PartyScoreDecoTextures', 'ChangeTextures', 0) = 1); + + PartyScore.DecoTextures.FirstTexture := ThemeIni.ReadString('PartyScoreDecoTextures', 'FirstTexture', ''); + PartyScore.DecoTextures.FirstTyp := ThemeIni.ReadString('PartyScoreDecoTextures', 'FirstTyp', 'Note Black'); + PartyScore.DecoTextures.FirstColor := ThemeIni.ReadString('PartyScoreDecoTextures', 'FirstColor', 'Black'); + + PartyScore.DecoTextures.SecondTexture := ThemeIni.ReadString('PartyScoreDecoTextures', 'SecondTexture', ''); + PartyScore.DecoTextures.SecondTyp := ThemeIni.ReadString('PartyScoreDecoTextures', 'SecondTyp', 'Note Black'); + PartyScore.DecoTextures.SecondColor := ThemeIni.ReadString('PartyScoreDecoTextures', 'SecondColor', 'Black'); + + PartyScore.DecoTextures.ThirdTexture := ThemeIni.ReadString('PartyScoreDecoTextures', 'ThirdTexture', ''); + PartyScore.DecoTextures.ThirdTyp := ThemeIni.ReadString('PartyScoreDecoTextures', 'ThirdTyp', 'Note Black'); + PartyScore.DecoTextures.ThirdColor := ThemeIni.ReadString('PartyScoreDecoTextures', 'ThirdColor', 'Black'); + + ThemeLoadText (PartyScore.TextWinner, 'PartyScoreTextWinner'); + + //Party Win + ThemeLoadBasic(PartyWin, 'PartyWin'); + + ThemeLoadText (PartyWin.TextScoreTeam1, 'PartyWinTextScoreTeam1'); + ThemeLoadText (PartyWin.TextScoreTeam2, 'PartyWinTextScoreTeam2'); + ThemeLoadText (PartyWin.TextScoreTeam3, 'PartyWinTextScoreTeam3'); + ThemeLoadText (PartyWin.TextNameTeam1, 'PartyWinTextNameTeam1'); + ThemeLoadText (PartyWin.TextNameTeam2, 'PartyWinTextNameTeam2'); + ThemeLoadText (PartyWin.TextNameTeam3, 'PartyWinTextNameTeam3'); + + ThemeLoadStatic (PartyWin.StaticTeam1, 'PartyWinStaticTeam1'); + ThemeLoadStatic (PartyWin.StaticTeam1BG, 'PartyWinStaticTeam1BG'); + ThemeLoadStatic (PartyWin.StaticTeam1Deco, 'PartyWinStaticTeam1Deco'); + ThemeLoadStatic (PartyWin.StaticTeam2, 'PartyWinStaticTeam2'); + ThemeLoadStatic (PartyWin.StaticTeam2BG, 'PartyWinStaticTeam2BG'); + ThemeLoadStatic (PartyWin.StaticTeam2Deco, 'PartyWinStaticTeam2Deco'); + ThemeLoadStatic (PartyWin.StaticTeam3, 'PartyWinStaticTeam3'); + ThemeLoadStatic (PartyWin.StaticTeam3BG, 'PartyWinStaticTeam3BG'); + ThemeLoadStatic (PartyWin.StaticTeam3Deco, 'PartyWinStaticTeam3Deco'); + + ThemeLoadText (PartyWin.TextWinner, 'PartyWinTextWinner'); + + //Party Options + ThemeLoadBasic(PartyOptions, 'PartyOptions'); + ThemeLoadSelectSlide(PartyOptions.SelectLevel, 'PartyOptionsSelectLevel'); + ThemeLoadSelectSlide(PartyOptions.SelectPlayList, 'PartyOptionsSelectPlayList'); + ThemeLoadSelectSlide(PartyOptions.SelectPlayList2, 'PartyOptionsSelectPlayList2'); + ThemeLoadSelectSlide(PartyOptions.SelectRounds, 'PartyOptionsSelectRounds'); + ThemeLoadSelectSlide(PartyOptions.SelectTeams, 'PartyOptionsSelectTeams'); + ThemeLoadSelectSlide(PartyOptions.SelectPlayers1, 'PartyOptionsSelectPlayers1'); + ThemeLoadSelectSlide(PartyOptions.SelectPlayers2, 'PartyOptionsSelectPlayers2'); + ThemeLoadSelectSlide(PartyOptions.SelectPlayers3, 'PartyOptionsSelectPlayers3'); + + {ThemeLoadButton (ButtonNext, 'ButtonNext'); + ThemeLoadButton (ButtonPrev, 'ButtonPrev');} + + //Party Player + ThemeLoadBasic(PartyPlayer, 'PartyPlayer'); + ThemeLoadButton(PartyPlayer.Team1Name, 'PartyPlayerTeam1Name'); + ThemeLoadButton(PartyPlayer.Player1Name, 'PartyPlayerPlayer1Name'); + ThemeLoadButton(PartyPlayer.Player2Name, 'PartyPlayerPlayer2Name'); + ThemeLoadButton(PartyPlayer.Player3Name, 'PartyPlayerPlayer3Name'); + ThemeLoadButton(PartyPlayer.Player4Name, 'PartyPlayerPlayer4Name'); + + ThemeLoadButton(PartyPlayer.Team2Name, 'PartyPlayerTeam2Name'); + ThemeLoadButton(PartyPlayer.Player5Name, 'PartyPlayerPlayer5Name'); + ThemeLoadButton(PartyPlayer.Player6Name, 'PartyPlayerPlayer6Name'); + ThemeLoadButton(PartyPlayer.Player7Name, 'PartyPlayerPlayer7Name'); + ThemeLoadButton(PartyPlayer.Player8Name, 'PartyPlayerPlayer8Name'); + + ThemeLoadButton(PartyPlayer.Team3Name, 'PartyPlayerTeam3Name'); + ThemeLoadButton(PartyPlayer.Player9Name, 'PartyPlayerPlayer9Name'); + ThemeLoadButton(PartyPlayer.Player10Name, 'PartyPlayerPlayer10Name'); + ThemeLoadButton(PartyPlayer.Player11Name, 'PartyPlayerPlayer11Name'); + ThemeLoadButton(PartyPlayer.Player12Name, 'PartyPlayerPlayer12Name'); + + {ThemeLoadButton(ButtonNext, 'PartyPlayerButtonNext'); + ThemeLoadButton(ButtonPrev, 'PartyPlayerButtonPrev');} + + ThemeLoadBasic(StatMain, 'StatMain'); + + ThemeLoadButton(StatMain.ButtonScores, 'StatMainButtonScores'); + ThemeLoadButton(StatMain.ButtonSingers, 'StatMainButtonSingers'); + ThemeLoadButton(StatMain.ButtonSongs, 'StatMainButtonSongs'); + ThemeLoadButton(StatMain.ButtonBands, 'StatMainButtonBands'); + ThemeLoadButton(StatMain.ButtonExit, 'StatMainButtonExit'); + + ThemeLoadText (StatMain.TextOverview, 'StatMainTextOverview'); + + + ThemeLoadBasic(StatDetail, 'StatDetail'); + + ThemeLoadButton(StatDetail.ButtonNext, 'StatDetailButtonNext'); + ThemeLoadButton(StatDetail.ButtonPrev, 'StatDetailButtonPrev'); + ThemeLoadButton(StatDetail.ButtonReverse, 'StatDetailButtonReverse'); + ThemeLoadButton(StatDetail.ButtonExit, 'StatDetailButtonExit'); + + ThemeLoadText (StatDetail.TextDescription, 'StatDetailTextDescription'); + ThemeLoadText (StatDetail.TextPage, 'StatDetailTextPage'); + ThemeLoadTexts(StatDetail.TextList, 'StatDetailTextList'); + + //Translate Texts + StatDetail.Description[0] := Language.Translate('STAT_DESC_SCORES'); + StatDetail.Description[1] := Language.Translate('STAT_DESC_SINGERS'); + StatDetail.Description[2] := Language.Translate('STAT_DESC_SONGS'); + StatDetail.Description[3] := Language.Translate('STAT_DESC_BANDS'); + + StatDetail.DescriptionR[0] := Language.Translate('STAT_DESC_SCORES_REVERSED'); + StatDetail.DescriptionR[1] := Language.Translate('STAT_DESC_SINGERS_REVERSED'); + StatDetail.DescriptionR[2] := Language.Translate('STAT_DESC_SONGS_REVERSED'); + StatDetail.DescriptionR[3] := Language.Translate('STAT_DESC_BANDS_REVERSED'); + + StatDetail.FormatStr[0] := Language.Translate('STAT_FORMAT_SCORES'); + StatDetail.FormatStr[1] := Language.Translate('STAT_FORMAT_SINGERS'); + StatDetail.FormatStr[2] := Language.Translate('STAT_FORMAT_SONGS'); + StatDetail.FormatStr[3] := Language.Translate('STAT_FORMAT_BANDS'); + + StatDetail.PageStr := Language.Translate('STAT_PAGE'); + + //Playlist Translations + Playlist.CatText := Language.Translate('PLAYLIST_CATTEXT'); + + //Level Translations + //Fill ILevel + ILevel[0] := Language.Translate('SING_EASY'); + ILevel[1] := Language.Translate('SING_MEDIUM'); + ILevel[2] := Language.Translate('SING_HARD'); + end; + + ThemeIni.Free; + end; +end; + +procedure TTheme.ThemeLoadBasic(Theme: TThemeBasic; Name: string); +begin + ThemeLoadBackground(Theme.Background, Name); + ThemeLoadTexts(Theme.Text, Name + 'Text'); + ThemeLoadStatics(Theme.Static, Name + 'Static'); + ThemeLoadButtonCollections(Theme.ButtonCollection, Name + 'ButtonCollection'); + + LastThemeBasic := Theme; +end; + +procedure TTheme.ThemeLoadBackground(var ThemeBackground: TThemeBackground; Name: string); +begin + ThemeBackground.Tex := ThemeIni.ReadString(Name + 'Background', 'Tex', ''); +end; + +procedure TTheme.ThemeLoadText(var ThemeText: TThemeText; Name: string); +var + C: integer; +begin + DecimalSeparator := '.'; + + ThemeText.X := ThemeIni.ReadInteger(Name, 'X', 0); + ThemeText.Y := ThemeIni.ReadInteger(Name, 'Y', 0); + ThemeText.W := ThemeIni.ReadInteger(Name, 'W', 0); + + ThemeText.ColR := ThemeIni.ReadFloat(Name, 'ColR', 0); + ThemeText.ColG := ThemeIni.ReadFloat(Name, 'ColG', 0); + ThemeText.ColB := ThemeIni.ReadFloat(Name, 'ColB', 0); + + ThemeText.Font := ThemeIni.ReadInteger(Name, 'Font', 0); + ThemeText.Size := ThemeIni.ReadInteger(Name, 'Size', 0); + ThemeText.Align := ThemeIni.ReadInteger(Name, 'Align', 0); + + ThemeText.Text := Language.Translate(ThemeIni.ReadString(Name, 'Text', '')); + ThemeText.Color := ThemeIni.ReadString(Name, 'Color', ''); + + C := ColorExists(ThemeText.Color); + if C >= 0 then begin + ThemeText.ColR := Color[C].RGB.R; + ThemeText.ColG := Color[C].RGB.G; + ThemeText.ColB := Color[C].RGB.B; + end; + + DecimalSeparator := ','; +end; + +procedure TTheme.ThemeLoadTexts(var ThemeText: AThemeText; Name: string); +var + T: integer; +begin + T := 1; + while ThemeIni.SectionExists(Name + IntToStr(T)) do begin + SetLength(ThemeText, T); + ThemeLoadText(ThemeText[T-1], Name + IntToStr(T)); + Inc(T); + end; +end; + +procedure TTheme.ThemeLoadStatic(var ThemeStatic: TThemeStatic; Name: string); +var + C: integer; +begin + DecimalSeparator := '.'; + + ThemeStatic.Tex := ThemeIni.ReadString(Name, 'Tex', ''); + + ThemeStatic.X := ThemeIni.ReadInteger(Name, 'X', 0); + ThemeStatic.Y := ThemeIni.ReadInteger(Name, 'Y', 0); + ThemeStatic.Z := ThemeIni.ReadFloat (Name, 'Z', 0); + ThemeStatic.W := ThemeIni.ReadInteger(Name, 'W', 0); + ThemeStatic.H := ThemeIni.ReadInteger(Name, 'H', 0); + + ThemeStatic.Typ := ThemeIni.ReadString(Name, 'Type', ''); + ThemeStatic.Color := ThemeIni.ReadString(Name, 'Color', ''); + + C := ColorExists(ThemeStatic.Color); + if C >= 0 then begin + ThemeStatic.ColR := Color[C].RGB.R; + ThemeStatic.ColG := Color[C].RGB.G; + ThemeStatic.ColB := Color[C].RGB.B; + end; + + ThemeStatic.TexX1 := ThemeIni.ReadFloat(Name, 'TexX1', 0); + ThemeStatic.TexY1 := ThemeIni.ReadFloat(Name, 'TexY1', 0); + ThemeStatic.TexX2 := ThemeIni.ReadFloat(Name, 'TexX2', 1); + ThemeStatic.TexY2 := ThemeIni.ReadFloat(Name, 'TexY2', 1); + + //Reflection Mod + ThemeStatic.Reflection := (ThemeIni.ReadInteger(Name, 'Reflection', 0) = 1); + ThemeStatic.ReflectionSpacing := ThemeIni.ReadFloat(Name, 'ReflectionSpacing', 15); + + DecimalSeparator := ','; +end; + +procedure TTheme.ThemeLoadStatics(var ThemeStatic: AThemeStatic; Name: string); +var + S: integer; +begin + S := 1; + while ThemeIni.SectionExists(Name + IntToStr(S)) do begin + SetLength(ThemeStatic, S); + ThemeLoadStatic(ThemeStatic[S-1], Name + IntToStr(S)); + Inc(S); + end; +end; + +//Button Collection Mod +procedure TTheme.ThemeLoadButtonCollection(var Collection: TThemeButtonCollection; Name: string); +var T: Integer; +begin + //Load Collection Style + ThemeLoadButton(Collection.Style, Name); + + //Load Other Attributes + T := ThemeIni.ReadInteger (Name, 'FirstChild', 0); + if (T > 0) And (T < 256) then + Collection.FirstChild := T + else + Collection.FirstChild := 0; +end; + +procedure TTheme.ThemeLoadButtonCollections(var Collections: AThemeButtonCollection; Name: string); +var + I: integer; +begin + I := 1; + while ThemeIni.SectionExists(Name + IntToStr(I)) do begin + SetLength(Collections, I); + ThemeLoadButtonCollection(Collections[I-1], Name + IntToStr(I)); + Inc(I); + end; +end; +//End Button Collection Mod + +procedure TTheme.ThemeLoadButton(var ThemeButton: TThemeButton; Name: string; const Collections: PAThemeButtonCollection); +var + C: integer; + TLen: integer; + T: integer; + Collections2: PAThemeButtonCollection; +begin + if not ThemeIni.SectionExists(Name) then + begin + ThemeButton.Visible := False; + exit; + end; + DecimalSeparator := '.'; + ThemeButton.Tex := ThemeIni.ReadString(Name, 'Tex', ''); + ThemeButton.X := ThemeIni.ReadInteger (Name, 'X', 0); + ThemeButton.Y := ThemeIni.ReadInteger (Name, 'Y', 0); + ThemeButton.Z := ThemeIni.ReadFloat (Name, 'Z', 0); + ThemeButton.W := ThemeIni.ReadInteger (Name, 'W', 0); + ThemeButton.H := ThemeIni.ReadInteger (Name, 'H', 0); + + ThemeButton.Typ := ThemeIni.ReadString(Name, 'Type', ''); + + //Reflection Mod + ThemeButton.Reflection := (ThemeIni.ReadInteger(Name, 'Reflection', 0) = 1); + ThemeButton.ReflectionSpacing := ThemeIni.ReadFloat(Name, 'ReflectionSpacing', 15); + + ThemeButton.ColR := ThemeIni.ReadFloat(Name, 'ColR', 1); + ThemeButton.ColG := ThemeIni.ReadFloat(Name, 'ColG', 1); + ThemeButton.ColB := ThemeIni.ReadFloat(Name, 'ColB', 1); + ThemeButton.Int := ThemeIni.ReadFloat(Name, 'Int', 1); + ThemeButton.DColR := ThemeIni.ReadFloat(Name, 'DColR', 1); + ThemeButton.DColG := ThemeIni.ReadFloat(Name, 'DColG', 1); + ThemeButton.DColB := ThemeIni.ReadFloat(Name, 'DColB', 1); + ThemeButton.DInt := ThemeIni.ReadFloat(Name, 'DInt', 1); + + ThemeButton.Color := ThemeIni.ReadString(Name, 'Color', ''); + C := ColorExists(ThemeButton.Color); + if C >= 0 then begin + ThemeButton.ColR := Color[C].RGB.R; + ThemeButton.ColG := Color[C].RGB.G; + ThemeButton.ColB := Color[C].RGB.B; + end; + + ThemeButton.DColor := ThemeIni.ReadString(Name, 'DColor', ''); + C := ColorExists(ThemeButton.DColor); + if C >= 0 then begin + ThemeButton.DColR := Color[C].RGB.R; + ThemeButton.DColG := Color[C].RGB.G; + ThemeButton.DColB := Color[C].RGB.B; + end; + + ThemeButton.Visible := (ThemeIni.ReadInteger(Name, 'Visible', 1) = 1); + + //Fade Mod + ThemeButton.SelectH := ThemeIni.ReadInteger (Name, 'SelectH', ThemeButton.H); + ThemeButton.SelectW := ThemeIni.ReadInteger (Name, 'SelectW', ThemeButton.W); + + ThemeButton.DeSelectReflectionspacing := ThemeIni.ReadFloat(Name, 'DeSelectReflectionSpacing', ThemeButton.Reflectionspacing); + + ThemeButton.Fade := (ThemeIni.ReadInteger(Name, 'Fade', 0) = 1); + ThemeButton.FadeText := (ThemeIni.ReadInteger(Name, 'FadeText', 0) = 1); + + + ThemeButton.FadeTex := ThemeIni.ReadString(Name, 'FadeTex', ''); + ThemeButton.FadeTexPos:= ThemeIni.ReadInteger(Name, 'FadeTexPos', 0); + if (ThemeButton.FadeTexPos > 4) Or (ThemeButton.FadeTexPos < 0) then + ThemeButton.FadeTexPos := 0; + + //Button Collection Mod + T := ThemeIni.ReadInteger(Name, 'Parent', 0); + + //Set Collections to Last Basic Collections if no valid Value + if (Collections = nil) then + Collections2 := @LastThemeBasic.ButtonCollection + else + Collections2 := Collections; + //Test for valid Value + if (Collections2 <> nil) AND (T > 0) AND (T <= Length(Collections2^)) then + begin + Inc(Collections2^[T-1].ChildCount); + ThemeButton.Parent := T; + end + else + ThemeButton.Parent := 0; + + //Read ButtonTexts + TLen := ThemeIni.ReadInteger(Name, 'Texts', 0); + SetLength(ThemeButton.Text, TLen); + for T := 1 to TLen do + ThemeLoadText(ThemeButton.Text[T-1], Name + 'Text' + IntToStr(T)); + + DecimalSeparator := ','; +end; + +procedure TTheme.ThemeLoadSelect(var ThemeSelect: TThemeSelect; Name: string); +var + C: integer; +begin + DecimalSeparator := '.'; + + //{$IFDEF TRANSLATE} + ThemeSelect.Text := Language.Translate(ThemeIni.ReadString(Name, 'Text', '')); + //{$ELSE}{ + //ThemeSelect.Text := ThemeIni.ReadString(Name, 'Text', ''); + //{$ENDIF} + + ThemeSelect.Tex := {Skin.SkinPath + }ThemeIni.ReadString(Name, 'Tex', ''); + ThemeSelect.TexSBG := {Skin.SkinPath + }ThemeIni.ReadString(Name, 'TexSBG', ''); + + ThemeSelect.X := ThemeIni.ReadInteger(Name, 'X', 0); + ThemeSelect.Y := ThemeIni.ReadInteger(Name, 'Y', 0); + ThemeSelect.W := ThemeIni.ReadInteger(Name, 'W', 0); + ThemeSelect.H := ThemeIni.ReadInteger(Name, 'H', 0); + ThemeSelect.SkipX := ThemeIni.ReadInteger(Name, 'SkipX', 0); + + + LoadColor(ThemeSelect.ColR, ThemeSelect.ColG, ThemeSelect.ColB, ThemeIni.ReadString(Name, 'Color', '')); + ThemeSelect.Int := ThemeIni.ReadFloat(Name, 'Int', 1); + LoadColor(ThemeSelect.DColR, ThemeSelect.DColG, ThemeSelect.DColB, ThemeIni.ReadString(Name, 'DColor', '')); + ThemeSelect.DInt := ThemeIni.ReadFloat(Name, 'DInt', 1); + + LoadColor(ThemeSelect.TColR, ThemeSelect.TColG, ThemeSelect.TColB, ThemeIni.ReadString(Name, 'TColor', '')); + ThemeSelect.TInt := ThemeIni.ReadFloat(Name, 'TInt', 1); + LoadColor(ThemeSelect.TDColR, ThemeSelect.TDColG, ThemeSelect.TDColB, ThemeIni.ReadString(Name, 'TDColor', '')); + ThemeSelect.TDInt := ThemeIni.ReadFloat(Name, 'TDInt', 1); + + LoadColor(ThemeSelect.SBGColR, ThemeSelect.SBGColG, ThemeSelect.SBGColB, ThemeIni.ReadString(Name, 'SBGColor', '')); + ThemeSelect.SBGInt := ThemeIni.ReadFloat(Name, 'SBGInt', 1); + LoadColor(ThemeSelect.SBGDColR, ThemeSelect.SBGDColG, ThemeSelect.SBGDColB, ThemeIni.ReadString(Name, 'SBGDColor', '')); + ThemeSelect.SBGDInt := ThemeIni.ReadFloat(Name, 'SBGDInt', 1); + + LoadColor(ThemeSelect.STColR, ThemeSelect.STColG, ThemeSelect.STColB, ThemeIni.ReadString(Name, 'STColor', '')); + ThemeSelect.STInt := ThemeIni.ReadFloat(Name, 'STInt', 1); + LoadColor(ThemeSelect.STDColR, ThemeSelect.STDColG, ThemeSelect.STDColB, ThemeIni.ReadString(Name, 'STDColor', '')); + ThemeSelect.STDInt := ThemeIni.ReadFloat(Name, 'STDInt', 1); + + + DecimalSeparator := ','; +end; + +procedure TTheme.ThemeLoadSelectSlide(var ThemeSelectS: TThemeSelectSlide; Name: string); +var + C: integer; +begin + DecimalSeparator := '.'; + + //{{$IFDEF TRANSLATE} + ThemeSelectS.Text := Language.Translate(ThemeIni.ReadString(Name, 'Text', '')); + //{{$ELSE}{ + //ThemeSelectS.Text := ThemeIni.ReadString(Name, 'Text', ''); + //{$ENDIF} + + ThemeSelectS.Tex := {Skin.SkinPath + }ThemeIni.ReadString(Name, 'Tex', ''); + ThemeSelectS.TexSBG := {Skin.SkinPath + }ThemeIni.ReadString(Name, 'TexSBG', ''); + + ThemeSelectS.X := ThemeIni.ReadInteger(Name, 'X', 0); + ThemeSelectS.Y := ThemeIni.ReadInteger(Name, 'Y', 0); + ThemeSelectS.W := ThemeIni.ReadInteger(Name, 'W', 0); + ThemeSelectS.H := ThemeIni.ReadInteger(Name, 'H', 0); + + ThemeSelectS.Z := ThemeIni.ReadFloat(Name, 'Z', 0); + + ThemeSelectS.TextSize := ThemeIni.ReadInteger(Name, 'TextSize', 10); + + ThemeSelectS.SkipX := ThemeIni.ReadInteger(Name, 'SkipX', 0); + + ThemeSelectS.SBGW := ThemeIni.ReadInteger(Name, 'SBGW', 450); + + LoadColor(ThemeSelectS.ColR, ThemeSelectS.ColG, ThemeSelectS.ColB, ThemeIni.ReadString(Name, 'Color', '')); + ThemeSelectS.Int := ThemeIni.ReadFloat(Name, 'Int', 1); + LoadColor(ThemeSelectS.DColR, ThemeSelectS.DColG, ThemeSelectS.DColB, ThemeIni.ReadString(Name, 'DColor', '')); + ThemeSelectS.DInt := ThemeIni.ReadFloat(Name, 'DInt', 1); + + LoadColor(ThemeSelectS.TColR, ThemeSelectS.TColG, ThemeSelectS.TColB, ThemeIni.ReadString(Name, 'TColor', '')); + ThemeSelectS.TInt := ThemeIni.ReadFloat(Name, 'TInt', 1); + LoadColor(ThemeSelectS.TDColR, ThemeSelectS.TDColG, ThemeSelectS.TDColB, ThemeIni.ReadString(Name, 'TDColor', '')); + ThemeSelectS.TDInt := ThemeIni.ReadFloat(Name, 'TDInt', 1); + + LoadColor(ThemeSelectS.SBGColR, ThemeSelectS.SBGColG, ThemeSelectS.SBGColB, ThemeIni.ReadString(Name, 'SBGColor', '')); + ThemeSelectS.SBGInt := ThemeIni.ReadFloat(Name, 'SBGInt', 1); + LoadColor(ThemeSelectS.SBGDColR, ThemeSelectS.SBGDColG, ThemeSelectS.SBGDColB, ThemeIni.ReadString(Name, 'SBGDColor', '')); + ThemeSelectS.SBGDInt := ThemeIni.ReadFloat(Name, 'SBGDInt', 1); + + LoadColor(ThemeSelectS.STColR, ThemeSelectS.STColG, ThemeSelectS.STColB, ThemeIni.ReadString(Name, 'STColor', '')); + ThemeSelectS.STInt := ThemeIni.ReadFloat(Name, 'STInt', 1); + LoadColor(ThemeSelectS.STDColR, ThemeSelectS.STDColG, ThemeSelectS.STDColB, ThemeIni.ReadString(Name, 'STDColor', '')); + ThemeSelectS.STDInt := ThemeIni.ReadFloat(Name, 'STDInt', 1); + + + DecimalSeparator := ','; +end; + +procedure TTheme.LoadColors; +var + SL: TStringList; + C: integer; + S: string; + Col: integer; + RGB: TRGB; +begin + SL := TStringList.Create; + ThemeIni.ReadSection('Colors', SL); + + // normal colors + SetLength(Color, SL.Count); + for C := 0 to SL.Count-1 do begin + Color[C].Name := SL.Strings[C]; + + S := ThemeIni.ReadString('Colors', SL.Strings[C], ''); + + Color[C].RGB.R := StrToInt(Copy(S, 1, Pos(' ' , S)-1))/255; + Delete(S, 1, Pos(' ', S)); + + Color[C].RGB.G := StrToInt(Copy(S, 1, Pos(' ' , S)-1))/255; + Delete(S, 1, Pos(' ', S)); + + Color[C].RGB.B := StrToInt(S)/255; + end; + + // skin color + SetLength(Color, SL.Count + 3); + C := SL.Count; + Color[C].Name := 'ColorDark'; + Color[C].RGB := GetSystemColor(Skin.Color); //Ini.Color); + + C := C+1; + Color[C].Name := 'ColorLight'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + C := C+1; + Color[C].Name := 'ColorLightest'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + // players colors + SetLength(Color, Length(Color)+18); + + // P1 + C := C+1; + Color[C].Name := 'P1Dark'; + Color[C].RGB := GetSystemColor(0); // 0 - blue + + C := C+1; + Color[C].Name := 'P1Light'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + C := C+1; + Color[C].Name := 'P1Lightest'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + // P2 + C := C+1; + Color[C].Name := 'P2Dark'; + Color[C].RGB := GetSystemColor(3); // 3 - red + + C := C+1; + Color[C].Name := 'P2Light'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + C := C+1; + Color[C].Name := 'P2Lightest'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + // P3 + C := C+1; + Color[C].Name := 'P3Dark'; + Color[C].RGB := GetSystemColor(1); // 1 - green + + C := C+1; + Color[C].Name := 'P3Light'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + C := C+1; + Color[C].Name := 'P3Lightest'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + // P4 + C := C+1; + Color[C].Name := 'P4Dark'; + Color[C].RGB := GetSystemColor(4); // 4 - brown + + C := C+1; + Color[C].Name := 'P4Light'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + C := C+1; + Color[C].Name := 'P4Lightest'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + // P5 + C := C+1; + Color[C].Name := 'P5Dark'; + Color[C].RGB := GetSystemColor(5); // 5 - yellow + + C := C+1; + Color[C].Name := 'P5Light'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + C := C+1; + Color[C].Name := 'P5Lightest'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + // P6 + C := C+1; + Color[C].Name := 'P6Dark'; + Color[C].RGB := GetSystemColor(6); // 6 - violet + + C := C+1; + Color[C].Name := 'P6Light'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + C := C+1; + Color[C].Name := 'P6Lightest'; + Color[C].RGB := ColorSqrt(Color[C-1].RGB); + + + SL.Free; +end; + +function ColorExists(Name: string): integer; +var + C: integer; +begin + Result := -1; + for C := 0 to High(Color) do + if Color[C].Name = Name then Result := C; +end; + +procedure LoadColor(var R, G, B: real; ColorName: string); +var + C: integer; +begin + C := ColorExists(ColorName); + if C >= 0 then begin + R := Color[C].RGB.R; + G := Color[C].RGB.G; + B := Color[C].RGB.B; + end; +end; + +function GetSystemColor(Color: integer): TRGB; +begin + case Color of + 0: begin + // blue + Result.R := 71/255; + Result.G := 175/255; + Result.B := 247/255; + end; + 1: begin + // green + Result.R := 63/255; + Result.G := 191/255; + Result.B := 63/255; + end; + 2: begin + // pink + Result.R := 255/255; +{ Result.G := 63/255; + Result.B := 192/255;} + Result.G := 175/255; + Result.B := 247/255; + end; + 3: begin + // red + Result.R := 247/255; + Result.G := 71/255; + Result.B := 71/255; + end; + //'Violet', 'Orange', 'Yellow', 'Brown', 'Black' + //New Theme-Color Patch + 4: begin + // violet + Result.R := 230/255; + Result.G := 63/255; + Result.B := 230/255; + end; + 5: begin + // orange + Result.R := 255/255; + Result.G := 144/255; + Result.B := 0; + end; + 6: begin + // yellow + Result.R := 230/255; + Result.G := 230/255; + Result.B := 95/255; + end; + 7: begin + // brown + Result.R := 192/255; + Result.G := 127/255; + Result.B := 31/255; + end; + 8: begin + // black + Result.R := 0; + Result.G := 0; + Result.B := 0; + end; + //New Theme-Color Patch End + + end; +end; + +function ColorSqrt(RGB: TRGB): TRGB; +begin + Result.R := sqrt(RGB.R); + Result.G := sqrt(RGB.G); + Result.B := sqrt(RGB.B); +end; + +procedure TTheme.ThemeSave(FileName: string); +var + I: integer; +begin + {$IFDEF THEMESAVE} + ThemeIni := TIniFile.Create(FileName); + {$ELSE} + ThemeIni := TMemIniFile.Create(FileName); + {$ENDIF} + + ThemeSaveBasic(Loading, 'Loading'); + + ThemeSaveBasic(Main, 'Main'); + ThemeSaveText(Main.TextDescription, 'MainTextDescription'); + ThemeSaveText(Main.TextDescriptionLong, 'MainTextDescriptionLong'); + ThemeSaveButton(Main.ButtonSolo, 'MainButtonSolo'); + ThemeSaveButton(Main.ButtonEditor, 'MainButtonEditor'); + ThemeSaveButton(Main.ButtonOptions, 'MainButtonOptions'); + ThemeSaveButton(Main.ButtonExit, 'MainButtonExit'); + + ThemeSaveBasic(Name, 'Name'); + for I := 1 to 6 do + ThemeSaveButton(Name.ButtonPlayer[I], 'NameButtonPlayer' + IntToStr(I)); + + ThemeSaveBasic(Level, 'Level'); + ThemeSaveButton(Level.ButtonEasy, 'LevelButtonEasy'); + ThemeSaveButton(Level.ButtonMedium, 'LevelButtonMedium'); + ThemeSaveButton(Level.ButtonHard, 'LevelButtonHard'); + + ThemeSaveBasic(Song, 'Song'); + ThemeSaveText(Song.TextArtist, 'SongTextArtist'); + ThemeSaveText(Song.TextTitle, 'SongTextTitle'); + ThemeSaveText(Song.TextNumber, 'SongTextNumber'); + + //Show CAt in Top Left Mod + ThemeSaveText(Song.TextCat, 'SongTextCat'); + ThemeSaveStatic(Song.StaticCat, 'SongStaticCat'); + + ThemeSaveBasic(Sing, 'Sing'); + + //TimeBar mod + ThemeSaveStatic(Sing.StaticTimeProgress, 'SingTimeProgress'); + ThemeSaveText(Sing.TextTimeText, 'SingTimeText'); + //eoa TimeBar mod + + ThemeSaveStatic(Sing.StaticP1, 'SingP1Static'); + ThemeSaveText(Sing.TextP1, 'SingP1Text'); + ThemeSaveStatic(Sing.StaticP1ScoreBG, 'SingP1Static2'); + ThemeSaveText(Sing.TextP1Score, 'SingP1TextScore'); + + //moveable singbar mod + ThemeSaveStatic(Sing.StaticP1SingBar, 'SingP1SingBar'); + ThemeSaveStatic(Sing.StaticP1TwoPSingBar, 'SingP1TwoPSingBar'); + ThemeSaveStatic(Sing.StaticP1ThreePSingBar, 'SingP1ThreePSingBar'); + ThemeSaveStatic(Sing.StaticP2RSingBar, 'SingP2RSingBar'); + ThemeSaveStatic(Sing.StaticP2MSingBar, 'SingP2MSingBar'); + ThemeSaveStatic(Sing.StaticP3SingBar, 'SingP3SingBar'); + //eoa moveable singbar + + //Added for ps3 skin + //This one is shown in 2/4P mode + ThemeSaveStatic(Sing.StaticP1TwoP, 'SingP1TwoPStatic'); + ThemeSaveText(Sing.TextP1TwoP, 'SingP1TwoPText'); + ThemeSaveStatic(Sing.StaticP1TwoPScoreBG, 'SingP1TwoPStatic2'); + ThemeSaveText(Sing.TextP1TwoPScore, 'SingP1TwoPTextScore'); + + //This one is shown in 3/6P mode + ThemeSaveStatic(Sing.StaticP1ThreeP, 'SingP1ThreePStatic'); + ThemeSaveText(Sing.TextP1ThreeP, 'SingP1ThreePText'); + ThemeSaveStatic(Sing.StaticP1ThreePScoreBG, 'SingP1ThreePStatic2'); + ThemeSaveText(Sing.TextP1ThreePScore, 'SingP1ThreePTextScore'); + //eoa + + ThemeSaveStatic(Sing.StaticP2R, 'SingP2RStatic'); + ThemeSaveText(Sing.TextP2R, 'SingP2RText'); + ThemeSaveStatic(Sing.StaticP2RScoreBG, 'SingP2RStatic2'); + ThemeSaveText(Sing.TextP2RScore, 'SingP2RTextScore'); + + ThemeSaveStatic(Sing.StaticP2M, 'SingP2MStatic'); + ThemeSaveText(Sing.TextP2M, 'SingP2MText'); + ThemeSaveStatic(Sing.StaticP2MScoreBG, 'SingP2MStatic2'); + ThemeSaveText(Sing.TextP2MScore, 'SingP2MTextScore'); + + ThemeSaveStatic(Sing.StaticP3R, 'SingP3RStatic'); + ThemeSaveText(Sing.TextP3R, 'SingP3RText'); + ThemeSaveStatic(Sing.StaticP3RScoreBG, 'SingP3RStatic2'); + ThemeSaveText(Sing.TextP3RScore, 'SingP3RTextScore'); + + ThemeSaveBasic(Score, 'Score'); + ThemeSaveText(Score.TextArtist, 'ScoreTextArtist'); + ThemeSaveText(Score.TextTitle, 'ScoreTextTitle'); + + for I := 1 to 6 do begin + ThemeSaveStatics(Score.PlayerStatic[I], 'ScorePlayer' + IntToStr(I) + 'Static'); + + ThemeSaveText(Score.TextName[I], 'ScoreTextName' + IntToStr(I)); + ThemeSaveText(Score.TextScore[I], 'ScoreTextScore' + IntToStr(I)); + ThemeSaveText(Score.TextNotes[I], 'ScoreTextNotes' + IntToStr(I)); + ThemeSaveText(Score.TextNotesScore[I], 'ScoreTextNotesScore' + IntToStr(I)); + ThemeSaveText(Score.TextLineBonus[I], 'ScoreTextLineBonus' + IntToStr(I)); + ThemeSaveText(Score.TextLineBonusScore[I], 'ScoreTextLineBonusScore' + IntToStr(I)); + ThemeSaveText(Score.TextGoldenNotes[I], 'ScoreTextGoldenNotes' + IntToStr(I)); + ThemeSaveText(Score.TextGoldenNotesScore[I], 'ScoreTextGoldenNotesScore' + IntToStr(I)); + ThemeSaveText(Score.TextTotal[I], 'ScoreTextTotal' + IntToStr(I)); + ThemeSaveText(Score.TextTotalScore[I], 'ScoreTextTotalScore' + IntToStr(I)); + + ThemeSaveStatic(Score.StaticBackLevel[I], 'ScoreStaticBackLevel' + IntToStr(I)); + ThemeSaveStatic(Score.StaticBackLevelRound[I], 'ScoreStaticBackLevelRound' + IntToStr(I)); + ThemeSaveStatic(Score.StaticLevel[I], 'ScoreStaticLevel' + IntToStr(I)); + ThemeSaveStatic(Score.StaticLevelRound[I], 'ScoreStaticLevelRound' + IntToStr(I)); + end; + + ThemeSaveBasic(Top5, 'Top5'); + ThemeSaveText(Top5.TextLevel, 'Top5TextLevel'); + ThemeSaveText(Top5.TextArtistTitle, 'Top5TextArtistTitle'); + ThemeSaveStatics(Top5.StaticNumber, 'Top5StaticNumber'); + ThemeSaveTexts(Top5.TextNumber, 'Top5TextNumber'); + ThemeSaveTexts(Top5.TextName, 'Top5TextName'); + ThemeSaveTexts(Top5.TextScore, 'Top5TextScore'); + + + ThemeIni.Free; +end; + +procedure TTheme.ThemeSaveBasic(Theme: TThemeBasic; Name: string); +begin + ThemeIni.WriteInteger(Name, 'Texts', Length(Theme.Text)); + + ThemeSaveBackground(Theme.Background, Name + 'Background'); + ThemeSaveStatics(Theme.Static, Name + 'Static'); + ThemeSaveTexts(Theme.Text, Name + 'Text'); +end; + +procedure TTheme.ThemeSaveBackground(ThemeBackground: TThemeBackground; Name: string); +begin + if ThemeBackground.Tex <> '' then + ThemeIni.WriteString(Name, 'Tex', ThemeBackground.Tex) + else begin + ThemeIni.EraseSection(Name); + end; +end; + +procedure TTheme.ThemeSaveStatic(ThemeStatic: TThemeStatic; Name: string); +begin + DecimalSeparator := '.'; + ThemeIni.WriteInteger(Name, 'X', ThemeStatic.X); + ThemeIni.WriteInteger(Name, 'Y', ThemeStatic.Y); + ThemeIni.WriteInteger(Name, 'W', ThemeStatic.W); + ThemeIni.WriteInteger(Name, 'H', ThemeStatic.H); + + ThemeIni.WriteString(Name, 'Tex', ThemeStatic.Tex); + ThemeIni.WriteString(Name, 'Type', ThemeStatic.Typ); + ThemeIni.WriteString(Name, 'Color', ThemeStatic.Color); + + ThemeIni.WriteFloat(Name, 'TexX1', ThemeStatic.TexX1); + ThemeIni.WriteFloat(Name, 'TexY1', ThemeStatic.TexY1); + ThemeIni.WriteFloat(Name, 'TexX2', ThemeStatic.TexX2); + ThemeIni.WriteFloat(Name, 'TexY2', ThemeStatic.TexY2); + + DecimalSeparator := ','; +end; + +procedure TTheme.ThemeSaveStatics(ThemeStatic: AThemeStatic; Name: string); +var + S: integer; +begin + for S := 0 to Length(ThemeStatic)-1 do + ThemeSaveStatic(ThemeStatic[S], Name + {'Static' +} IntToStr(S+1)); + + ThemeIni.EraseSection(Name + {'Static' + }IntToStr(S+1)); +end; + +procedure TTheme.ThemeSaveText(ThemeText: TThemeText; Name: string); +begin + DecimalSeparator := '.'; + ThemeIni.WriteInteger(Name, 'X', ThemeText.X); + ThemeIni.WriteInteger(Name, 'Y', ThemeText.Y); + + ThemeIni.WriteInteger(Name, 'Font', ThemeText.Font); + ThemeIni.WriteInteger(Name, 'Size', ThemeText.Size); + ThemeIni.WriteInteger(Name, 'Align', ThemeText.Align); + + ThemeIni.WriteString(Name, 'Text', ThemeText.Text); + ThemeIni.WriteString(Name, 'Color', ThemeText.Color); + + DecimalSeparator := ','; +end; + +procedure TTheme.ThemeSaveTexts(ThemeText: AThemeText; Name: string); +var + T: integer; +begin + for T := 0 to Length(ThemeText)-1 do + ThemeSaveText(ThemeText[T], Name + {'Text' + }IntToStr(T+1)); + + ThemeIni.EraseSection(Name + {'Text' + }IntToStr(T+1)); +end; + +procedure TTheme.ThemeSaveButton(ThemeButton: TThemeButton; Name: string); +var + T: integer; +begin + DecimalSeparator := '.'; + ThemeIni.WriteString(Name, 'Tex', ThemeButton.Tex); + ThemeIni.WriteInteger(Name, 'X', ThemeButton.X); + ThemeIni.WriteInteger(Name, 'Y', ThemeButton.Y); + ThemeIni.WriteInteger(Name, 'W', ThemeButton.W); + ThemeIni.WriteInteger(Name, 'H', ThemeButton.H); + + ThemeIni.WriteString(Name, 'Type', ThemeButton.Typ); + ThemeIni.WriteInteger(Name, 'Texts', Length(ThemeButton.Text)); + + ThemeIni.WriteString(Name, 'Color', ThemeButton.Color); + +{ ThemeButton.ColR := ThemeIni.ReadFloat(Name, 'ColR', 1); + ThemeButton.ColG := ThemeIni.ReadFloat(Name, 'ColG', 1); + ThemeButton.ColB := ThemeIni.ReadFloat(Name, 'ColB', 1); + ThemeButton.Int := ThemeIni.ReadFloat(Name, 'Int', 1); + ThemeButton.DColR := ThemeIni.ReadFloat(Name, 'DColR', 1); + ThemeButton.DColG := ThemeIni.ReadFloat(Name, 'DColG', 1); + ThemeButton.DColB := ThemeIni.ReadFloat(Name, 'DColB', 1); + ThemeButton.DInt := ThemeIni.ReadFloat(Name, 'DInt', 1);} + +{ C := ColorExists(ThemeIni.ReadString(Name, 'Color', '')); + if C >= 0 then begin + ThemeButton.ColR := Color[C].RGB.R; + ThemeButton.ColG := Color[C].RGB.G; + ThemeButton.ColB := Color[C].RGB.B; + end; + + C := ColorExists(ThemeIni.ReadString(Name, 'DColor', '')); + if C >= 0 then begin + ThemeButton.DColR := Color[C].RGB.R; + ThemeButton.DColG := Color[C].RGB.G; + ThemeButton.DColB := Color[C].RGB.B; + end;} + + for T := 0 to High(ThemeButton.Text) do + ThemeSaveText(ThemeButton.Text[T], Name + 'Text' + IntToStr(T+1)); + + DecimalSeparator := ','; +end; + + +end. diff --git a/Game/Code/Classes/UTime.pas b/Game/Code/Classes/UTime.pas index 87d4f922..d06628cc 100644 --- a/Game/Code/Classes/UTime.pas +++ b/Game/Code/Classes/UTime.pas @@ -69,7 +69,11 @@ begin TimeNew := CurrentSec100OfDay(); // TODO - JB_Linux will prob need looking at {$ENDIF} - TimeSkip := (TimeNew-TimeOld)/TimeFreq; + if ( TimeNew-TimeOld > 0 ) AND + ( TimeFreq > 0 ) THEN + begin + TimeSkip := (TimeNew-TimeOld)/TimeFreq; + end; end; procedure CountMidTime; diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index 077342d3..c83d3c37 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -19,45 +19,41 @@ uses {$IFDEF win32} type TDisplay = class - ActualScreen: PMenu; - NextScreen: PMenu; + ActualScreen : PMenu; + NextScreen : PMenu; //fade-to-black-hack BlackScreen: Boolean; + //popup hack NextScreenWithCheck: Pmenu; - CheckOK: Boolean; + CheckOK : Boolean; - h_DC: HDC; - h_RC: HGLRC; + h_DC : HDC; + h_RC : HGLRC; - Fade: Real; - // fade-mod - doFade: Boolean; - canFade: Boolean; - myFade: integer; - lastTime: Cardinal; + Fade : Real; + doFade : Boolean; + canFade : Boolean; + myFade : integer; + lastTime : Cardinal; pTexData : Pointer; - pTex : array[1..2] of glUInt; - // end + pTex : array[1..2] of glUInt; - //FPS Counter - FPSCounter: Cardinal; - LastFPS: Cardinal; - NextFPSSwap:Cardinal; + FPSCounter : Cardinal; + LastFPS : Cardinal; + NextFPSSwap : Cardinal; - //For Debug OSD - OSD_LastError: String; + OSD_LastError : String; + public + constructor Create; + destructor Destroy; override; - function Draw: Boolean; procedure PrintScreen; - constructor Create; - // fade mod - destructor Destroy; override; - // end procedure ScreenShot; - procedure DrawDebugInformation; + + function Draw: Boolean; end; var @@ -76,7 +72,7 @@ uses {$ENDIF} graphics, TextGL, - // UFiles, +// ULog, UMain, UTexture, UIni, @@ -85,15 +81,17 @@ uses UCommandLine; constructor TDisplay.Create; -var i: integer; +var + i: integer; + begin inherited Create; //popup hack - CheckOK:=False; - NextScreen:=NIL; - NextScreenWithCheck:=NIL; - BlackScreen:=False; + CheckOK := False; + NextScreen := NIL; + NextScreenWithCheck := NIL; + BlackScreen := False; // fade mod myfade:=0; @@ -106,24 +104,37 @@ begin canFade:=True; // generate texture for fading between screens GetMem(pTexData, 512*512*4); + if pTexData <> NIL then for i:= 1 to 2 do begin - glGenTextures(1, pTex[i]); - if glGetError <> GL_NO_ERROR then canFade := False; + + glGenTextures(1, @pTex[i] ); + + if glGetError <> GL_NO_ERROR then + canFade := False; + glBindTexture(GL_TEXTURE_2D, pTex[i]); - if glGetError <> GL_NO_ERROR then canFade := False; + if glGetError <> GL_NO_ERROR then + canFade := False; + glTexImage2D(GL_TEXTURE_2D, 0, 4, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, pTexData); - if glGetError <> GL_NO_ERROR then canFade := False; + if glGetError <> GL_NO_ERROR then + canFade := False; + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - if glGetError <> GL_NO_ERROR then canFade := False; + if glGetError <> GL_NO_ERROR then + canFade := False; + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - if glGetError <> GL_NO_ERROR then canFade := False; + if glGetError <> GL_NO_ERROR then + canFade := False; end else begin canFade:=False; end; + FreeMem(pTexData); // end @@ -131,25 +142,22 @@ begin OSD_LastError := 'No Errors'; end; -// fade mod destructor TDisplay.Destroy; begin if canFade then glDeleteTextures(1,@pTex); + inherited Destroy; end; -// end function TDisplay.Draw: Boolean; var S: integer; Col: Real; - // fade mod myFade2: Real; currentTime: Cardinal; glError: glEnum; glErrorStr: String; - // end begin Result := True; diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 291dc201..2efae5e4 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -1,1529 +1,1544 @@ -unit UMenu; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -uses OpenGL12, SysUtils, UTexture, UMenuStatic, UMenuText, UMenuButton, UMenuSelect, UMenuSelectSlide, - UMenuInteract, UThemes, UMenuButtonCollection, Math; - -type -{ Int16 = SmallInt;} - - PMenu = ^TMenu; - TMenu = class - protected - ButtonPos: Integer; - - Interactions: array of TInteract; - SelInteraction: integer; - Button: array of TButton; - Selects: array of TSelect; - SelectsS: array of TSelectSlide; - ButtonCollection: Array of TButtonCollection; - BackImg: TTexture; - BackW: integer; - BackH: integer; - public - Text: array of TText; - Static: array of TStatic; - mX: integer; // mouse X - mY: integer; // mouse Y - - Fade: integer; // fade type - ShowFinish: boolean; // true if there is no fade - - - destructor Destroy; override; - constructor Create; overload; virtual; - //constructor Create(Back: string); overload; virtual; // Back is a JPG resource name for background - //constructor Create(Back: string; W, H: integer); overload; virtual; // W and H are the number of overlaps - - // interaction - procedure AddInteraction(Typ, Num: integer); - procedure SetInteraction(Num: integer); - property Interaction: integer read SelInteraction write SetInteraction; - - //Procedure Load BG, Texts, Statics and Button Collections from ThemeBasic - procedure LoadFromTheme(const ThemeBasic: TThemeBasic); - - procedure PrepareButtonCollections(const Collections: AThemeButtonCollection); - procedure AddButtonCollection(const ThemeCollection: TThemeButtonCollection; Const Num: Byte); - - // background - procedure AddBackground(Name: string); - - // static - function AddStatic(ThemeStatic: TThemeStatic): integer; overload; - function AddStatic(X, Y, W, H: real; Name: string): integer; overload; - function AddStatic(X, Y, W, H: real; Name, Format, Typ: string): integer; overload; - function AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; Name, Format, Typ: string): integer; overload; - function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string): integer; overload; - function AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; overload; - function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; overload; - function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; Name, Format, Typ: string; Color: integer; Reflection: Boolean; ReflectionSpacing: Real): integer; overload; - - // text - function AddText(ThemeText: TThemeText): integer; overload; - function AddText(X, Y: real; Tekst: string): integer; overload; - function AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; Tekst: string): integer; overload; - function AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; Tekst: string): integer; overload; - - // button - Procedure SetButtonLength(Length: Cardinal); //Function that Set Length of Button Array in one Step instead of register new Memory for every Button - function AddButton(ThemeButton: TThemeButton): integer; overload; - function AddButton(X, Y, W, H: real; Name: String): integer; overload; - function AddButton(X, Y, W, H: real; Name, Format, Typ: String; Reflection: Boolean): integer; overload; - function AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean; ReflectionSpacing, DeSelectReflectionSpacing: Real): integer; overload; - procedure ClearButtons; - procedure AddButtonText(AddX, AddY: real; AddText: string); overload; - procedure AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; AddText: string); overload; - procedure AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; AddText: string); overload; - procedure AddButtonText(CustomButton: TButton; AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; AddText: string); overload; - - // select - function AddSelect(ThemeSelect: TThemeSelect; var Data: integer; Values: array of string): integer; overload; - function AddSelect(X, Y, W, H, SkipX, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt, - TColR, TColG, TColB, TInt, TDColR, TDColG, TDColB, TDInt, - SBGColR, SBGColG, SBGColB, SBGInt, SBGDColR, SBGDColG, SBGDColB, SBGDInt, - STColR, STColG, STColB, STInt, STDColR, STDColG, STDColB, STDInt: real; - Name, Typ: String; SBGName, SBGTyp: String; - Caption: string; var Data: integer): integer; overload; - procedure AddSelectOption(AddX, AddY: real; AddText: string); overload; - procedure AddSelectOption(SelectNo: Cardinal; AddX, AddY: real; AddText: string); overload; - procedure UpdateSelectOptions(ThemeSelect: TThemeSelect; SelectNum: integer; Values: array of string; var Data: integer); - - // select slide - function AddSelectSlide(ThemeSelectS: TThemeSelectSlide; var Data: integer; Values: array of string): integer; overload; - function AddSelectSlide(X, Y, W, H, SkipX, SBGW, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt, - TColR, TColG, TColB, TInt, TDColR, TDColG, TDColB, TDInt, - SBGColR, SBGColG, SBGColB, SBGInt, SBGDColR, SBGDColG, SBGDColB, SBGDInt, - STColR, STColG, STColB, STInt, STDColR, STDColG, STDColB, STDInt: real; - Name, Typ: String; SBGName, SBGTyp: String; - Caption: string; var Data: integer): integer; overload; - procedure AddSelectSlideOption(AddText: string); overload; - procedure AddSelectSlideOption(SelectNo: Cardinal; AddText: string); overload; - procedure UpdateSelectSlideOptions(ThemeSelectSlide: TThemeSelectSlide; SelectNum: integer; Values: array of string; var Data: integer); - - -// function AddWidget(X, Y : UInt16; WidgetSrc : PSDL_Surface): Int16; -// procedure ClearWidgets(MinNumber : Int16); - procedure FadeTo(Screen: PMenu); - //popup hack - procedure CheckFadeTo(Screen: PMenu; msg: String); - - function DrawBG: boolean; virtual; - function DrawFG: boolean; virtual; - function Draw: boolean; virtual; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown : Boolean): Boolean; virtual; - function ParseMouse(Typ: integer; X: integer; Y: integer): Boolean; virtual; abstract; - function InRegion(X1, Y1, X2, Y2, X, Y: real): Boolean; - function InStaticRegion(StaticNr: integer; X, Y: integer): Boolean; - procedure onShow; virtual; - procedure onShowFinish; virtual; - procedure onHide; virtual; - - procedure SetAnimationProgress(Progress: real); virtual; - - function IsSelectable(Int: Cardinal): Boolean; - - procedure InteractNext; virtual; - procedure InteractCustom(CustomSwitch: integer); virtual; - procedure InteractPrev; virtual; - procedure InteractInc; virtual; - procedure InteractDec; virtual; - - procedure AddBox(X, Y, W, H: real); - end; - -const - pmMove = 1; - pmClick = 2; - pmUnClick = 3; - - iButton = 0; // interaction type - iSelect = 1; - iText = 2; - iSelectS = 3; - iBCollectionChild = 5; - -// fBlack = 0; // fade type -// fWhite = 1; - -implementation - -uses UMain, - UDrawTexture, - UGraphic, - UDisplay, - UCovers, - USkins; - -destructor TMenu.Destroy; -begin - inherited; -end; - -constructor TMenu.Create; -begin - Fade := 0;//fWhite; - - SetLength(Static, 0); - SetLength(Button, 0); - - BackImg.TexNum := -1; - - //Set ButtonPos to Autoset Length - ButtonPos := -1; -end; -{ -constructor TMenu.Create(Back: String); -begin - inherited Create; - - if Back <> '' then begin -// BackImg := Texture.LoadTexture(true, PChar(Back), 'JPG', 'Plain', 0); - BackImg := Texture.LoadTexture(PChar(Back), 'JPG', 'Plain', 0); // new theme system - BackImg.W := 800;//640; - BackImg.H := 600;//480; - BackW := 1; - BackH := 1; - end else - BackImg.TexNum := -1; - - //Set ButtonPos to Autoset Length - ButtonPos := -1; -end; - -constructor TMenu.Create(Back: string; W, H: integer); -begin - Create(Back); - BackImg.W := BackImg.W / W; - BackImg.H := BackImg.H / H; - BackW := W; - BackH := H; -end; } - -procedure TMenu.AddInteraction(Typ, Num: integer); -var - IntNum: integer; -begin - IntNum := Length(Interactions); - SetLength(Interactions, IntNum+1); - Interactions[IntNum].Typ := Typ; - Interactions[IntNum].Num := Num; - Interaction := 0; -end; - -procedure TMenu.SetInteraction(Num: integer); -var - OldNum, OldTyp: integer; - NewNum, NewTyp: integer; -begin - // set inactive - OldNum := Interactions[Interaction].Num; - OldTyp := Interactions[Interaction].Typ; - - NewNum := Interactions[Num].Num; - NewTyp := Interactions[Num].Typ; - - case OldTyp of - iButton: Button[OldNum].Selected := False; - iSelect: Selects[OldNum].Selected := False; - iText: Text[OldNum].Selected := False; - iSelectS: SelectsS[OldNum].Selected := False; - //Button Collection Mod - iBCollectionChild: - begin - Button[OldNum].Selected := False; - - //Deselect Collection if Next Button is Not from Collection - if (NewTyp <> iButton) Or (Button[NewNum].Parent <> Button[OldNum].Parent) then - ButtonCollection[Button[OldNum].Parent-1].Selected := False; - end; - end; - - // set active - SelInteraction := Num; - case NewTyp of - iButton: Button[NewNum].Selected := True; - iSelect: Selects[NewNum].Selected := True; - iText: Text[NewNum].Selected := True; - iSelectS: SelectsS[NewNum].Selected := True; - - //Button Collection Mod - iBCollectionChild: - begin - Button[NewNum].Selected := True; - ButtonCollection[Button[NewNum].Parent-1].Selected := True; - end; - end; -end; - -//---------------------- -//LoadFromTheme - Load BG, Texts, Statics and -//Button Collections from ThemeBasic -//---------------------- -procedure TMenu.LoadFromTheme(const ThemeBasic: TThemeBasic); -var - I: Integer; -begin - //Add Button Collections (Set Button CollectionsLength) - //Button Collections are Created when the first ChildButton is Created - PrepareButtonCollections(ThemeBasic.ButtonCollection); - - - //Add Background - AddBackground(ThemeBasic.Background.Tex); - - //Add Statics and Texts - for I := 0 to High(ThemeBasic.Static) do - AddStatic(ThemeBasic.Static[I]); - - for I := 0 to High(ThemeBasic.Text) do - AddText(ThemeBasic.Text[I]); -end; - -procedure TMenu.AddBackground(Name: string); -var - lFileName : string; -begin - if Name <> '' then - begin -// BackImg := Texture.LoadTexture(false, PChar(Skin.SkinPath + FileName), 'JPG', 'Plain', 0); // new theme system - lFileName := Skin.GetTextureFileName(Name); - - if lFileName <> '' then - begin - BackImg := Texture.GetTexture( lFileName , 'Plain'); - - BackImg.W := 800; - BackImg.H := 600; - BackW := 1; - BackH := 1; - end; - end; -end; - -//---------------------- -//PrepareButtonCollections: -//Add Button Collections (Set Button CollectionsLength) -//---------------------- -procedure TMenu.PrepareButtonCollections(const Collections: AThemeButtonCollection); -var - I: Integer; -begin - SetLength(ButtonCollection, Length(Collections)); - For I := 0 to High(ButtonCollection) do - AddButtonCollection(Collections[I], I); -end; - -//---------------------- -//AddButtonCollection: -//Create a Button Collection; -//---------------------- -procedure TMenu.AddButtonCollection(const ThemeCollection: TThemeButtonCollection; Const Num: Byte); -var - BT, BTLen: Integer; - TempR, TempG, TempB, TempR2, TempG2, TempB2: Cardinal; - -begin - if (Num > High(ButtonCollection)) then - exit; - -// colorize hack -if ThemeCollection.Style.Typ='Colorized' then -begin - TempR:=floor(255*ThemeCollection.Style.ColR); - TempG:=floor(255*ThemeCollection.Style.ColG); - TempB:=floor(255*ThemeCollection.Style.ColB); - TempR2:=floor(255*ThemeCollection.Style.DColR); - TempG2:=floor(255*ThemeCollection.Style.DColG); - TempB2:=floor(255*ThemeCollection.Style.DColB); - // give encoded color to loadtexture - ButtonCollection[Num] := TButtonCollection.Create(Texture.LoadTexture(PChar(Skin.GetTextureFileName(ThemeCollection.Style.Tex)), 'JPG', 'Colorized', ((((TempR shl 8) or TempG) shl 8)or TempB)), - Texture.LoadTexture(PChar(Skin.GetTextureFileName(ThemeCollection.Style.Tex)), 'JPG', 'Colorized', ((((TempR2 shl 8) or TempG2) shl 8)or TempB2))); - -// Button[Result] := TButton.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR2 shl 8) or TempG2) shl 8)or TempB2))); // use cache texture -end -else - ButtonCollection[Num] := TButtonCollection.Create(Texture.GetTexture(Skin.GetTextureFileName(ThemeCollection.Style.Tex), ThemeCollection.Style.Typ, true)); // use cache texture - - //Set Parent menu - ButtonCollection[Num].ScreenButton := @Self.Button; - - //Set Attributes - ButtonCollection[Num].FirstChild := ThemeCollection.FirstChild; - ButtonCollection[Num].CountChilds := ThemeCollection.ChildCount; - ButtonCollection[Num].Parent := Num + 1; - - //Set Style - ButtonCollection[Num].X := ThemeCollection.Style.X; - ButtonCollection[Num].Y := ThemeCollection.Style.Y; - ButtonCollection[Num].W := ThemeCollection.Style.W; - ButtonCollection[Num].H := ThemeCollection.Style.H; - if ThemeCollection.Style.Typ <> 'Colorized' then begin - ButtonCollection[Num].SelectColR := ThemeCollection.Style.ColR; - ButtonCollection[Num].SelectColG := ThemeCollection.Style.ColG; - ButtonCollection[Num].SelectColB := ThemeCollection.Style.ColB; - ButtonCollection[Num].DeselectColR := ThemeCollection.Style.DColR; - ButtonCollection[Num].DeselectColG := ThemeCollection.Style.DColG; - ButtonCollection[Num].DeselectColB := ThemeCollection.Style.DColB; - end; - ButtonCollection[Num].SelectInt := ThemeCollection.Style.Int; - ButtonCollection[Num].DeselectInt := ThemeCollection.Style.DInt; - ButtonCollection[Num].Texture.TexX1 := 0; - ButtonCollection[Num].Texture.TexY1 := 0; - ButtonCollection[Num].Texture.TexX2 := 1; - ButtonCollection[Num].Texture.TexY2 := 1; - ButtonCollection[Num].SetSelect(false); - - ButtonCollection[Num].Reflection := ThemeCollection.Style.Reflection; - ButtonCollection[Num].Reflectionspacing := ThemeCollection.Style.ReflectionSpacing; - ButtonCollection[Num].DeSelectReflectionspacing := ThemeCollection.Style.DeSelectReflectionSpacing; - - ButtonCollection[Num].Z := ThemeCollection.Style.Z; - - //Some Things from ButtonFading - ButtonCollection[Num].SelectH := ThemeCollection.Style.SelectH; - ButtonCollection[Num].SelectW := ThemeCollection.Style.SelectW; - - ButtonCollection[Num].Fade := ThemeCollection.Style.Fade; - ButtonCollection[Num].FadeText := ThemeCollection.Style.FadeText; - if ThemeCollection.Style.Typ='Colorized' then - ButtonCollection[Num].FadeTex := Texture.LoadTexture(PChar(Skin.GetTextureFileName(ThemeCollection.Style.FadeTex)), 'JPG', 'Colorized', ((((TempR shl 8) or TempG) shl 8)or TempB)) - else - ButtonCollection[Num].FadeTex := Texture.GetTexture(Skin.GetTextureFileName(ThemeCollection.Style.FadeTex), ThemeCollection.Style.Typ, true); - ButtonCollection[Num].FadeTexPos := ThemeCollection.Style.FadeTexPos; - - - BTLen := Length(ThemeCollection.Style.Text); - for BT := 0 to BTLen-1 do begin - AddButtonText(ButtonCollection[Num], ThemeCollection.Style.Text[BT].X, ThemeCollection.Style.Text[BT].Y, - ThemeCollection.Style.Text[BT].ColR, ThemeCollection.Style.Text[BT].ColG, ThemeCollection.Style.Text[BT].ColB, - ThemeCollection.Style.Text[BT].Font, ThemeCollection.Style.Text[BT].Size, ThemeCollection.Style.Text[BT].Align, - ThemeCollection.Style.Text[BT].Text); - end; -end; - -function TMenu.AddStatic(ThemeStatic: TThemeStatic): integer; -begin - Result := AddStatic(ThemeStatic.X, ThemeStatic.Y, ThemeStatic.W, ThemeStatic.H, ThemeStatic.Z, - ThemeStatic.ColR, ThemeStatic.ColG, ThemeStatic.ColB, - ThemeStatic.TexX1, ThemeStatic.TexY1, ThemeStatic.TexX2, ThemeStatic.TexY2, - {<0.5.1: Skin.SkinPath + ThemeStatic.Tex, 0.5.1:} Skin.GetTextureFileName(ThemeStatic.Tex), - 'JPG', ThemeStatic.Typ, $FFFFFF, ThemeStatic.Reflection, ThemeStatic.Reflectionspacing); - //'Font Black'); -end; - -function TMenu.AddStatic(X, Y, W, H: real; Name: string): integer; -begin - Result := AddStatic(X, Y, W, H, Name, 'JPG', 'Plain'); -end; - -function TMenu.AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; Name, Format, Typ: string): integer; -var - StatNum: integer; -begin - Result := AddStatic(X, Y, W, H, ColR, ColG, ColB, Name, Format, Typ, $FFFFFF); -end; - -function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string): integer; -var - StatNum: integer; -begin - Result := AddStatic(X, Y, W, H, Z, ColR, ColG, ColB, Name, Format, Typ, $FFFFFF); -end; - -function TMenu.AddStatic(X, Y, W, H: real; Name, Format, Typ: string): integer; -var - StatNum: integer; -begin - // adds static - StatNum := Length(Static); - SetLength(Static, StatNum + 1); -// Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), $FF00FF)); // $FFFFFF -// Static[StatNum] := TStatic.Create(Texture.LoadTexture(Skin.SkinReg, PChar(Name), PChar(Format), PChar(Typ), $FF00FF)); // new skin system - Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), $FF00FF)); // new skin - - // configures static - Static[StatNum].Texture.X := X; - Static[StatNum].Texture.Y := Y; - Static[StatNum].Texture.W := W; - Static[StatNum].Texture.H := H; - Static[StatNum].Visible := true; - Result := StatNum; -end; - -function TMenu.AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; -var - StatNum: integer; -begin - Result := AddStatic(X, Y, W, H, 0, ColR, ColG, ColB, Name, Format, Typ, Color); -end; - -function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; -begin - Result := AddStatic(X, Y, W, H, Z, ColR, ColG, ColB, 0, 0, 1, 1, Name, Format, Typ, Color, False, 0); -// -end; - -function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; Name, Format, Typ: string; Color: integer; Reflection: Boolean; ReflectionSpacing: Real): integer; -var - StatNum: integer; - TempR, TempG, TempB: Cardinal; - TempCol: Cardinal; -begin - // adds static - StatNum := Length(Static); - SetLength(Static, StatNum + 1); -// Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), Color)); -// Static[StatNum] := TStatic.Create(Texture.LoadTexture(Skin.SkinReg, PChar(Name), PChar(Format), PChar(Typ), Color)); // new skin system - -// colorize hack -if Typ='Colorized' then -begin - TempR:=floor(255*ColR); - TempG:=floor(255*ColG); - TempB:=floor(255*ColB); - // give encoded color to loadtexture - Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR shl 8) or TempG) shl 8)or TempB))); -end -else - Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), Color)); // new skin -// Static[StatNum] := TStatic.Create(Texture.GetTexture(Name, Typ)); - - // configures static - Static[StatNum].Texture.X := X; - Static[StatNum].Texture.Y := Y; - Static[StatNum].Texture.W := W; - Static[StatNum].Texture.H := H; - Static[StatNum].Texture.Z := Z; - if Typ <> 'Colorized' then begin - Static[StatNum].Texture.ColR := ColR; - Static[StatNum].Texture.ColG := ColG; - Static[StatNum].Texture.ColB := ColB; - end; - Static[StatNum].Texture.TexX1 := TexX1; - Static[StatNum].Texture.TexY1 := TexY1; - Static[StatNum].Texture.TexX2 := TexX2; - Static[StatNum].Texture.TexY2 := TexY2; - Static[StatNum].Texture.Alpha := 1; - Static[StatNum].Visible := true; - - //ReflectionMod - Static[StatNum].Reflection := Reflection; - Static[StatNum].ReflectionSpacing := ReflectionSpacing; - - Result := StatNum; -end; - -function TMenu.AddText(ThemeText: TThemeText): integer; -begin - Result := AddText(ThemeText.X, ThemeText.Y, ThemeText.W, ThemeText.Font, ThemeText.Size, - ThemeText.ColR, ThemeText.ColG, ThemeText.ColB, ThemeText.Align, ThemeText.Text); -end; - -function TMenu.AddText(X, Y: real; Tekst: string): integer; -var - TextNum: integer; -begin - // adds text - TextNum := Length(Text); - SetLength(Text, TextNum + 1); - Text[TextNum] := TText.Create(X, Y, Tekst); - Result := TextNum; -end; - -function TMenu.AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; Tekst: string): integer; -begin - Result := AddText(X, Y, 0, Style, Size, ColR, ColG, ColB, 0, Tekst); -end; - -function TMenu.AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; Tekst: string): integer; -var - TextNum: integer; -begin - // adds text - TextNum := Length(Text); - SetLength(Text, TextNum + 1); - Text[TextNum] := TText.Create(X, Y, W, Style, Size, ColR, ColG, ColB, Align, Tekst); - Result := TextNum; -end; - -//Function that Set Length of Button Array in one Step instead of register new Memory for every Button -Procedure TMenu.SetButtonLength(Length: Cardinal); -begin - if (ButtonPos = -1) AND (Length > 0) then - begin - //Set Length of Button - SetLength(Button, Length); - - //Set ButtonPos to start with 0 - ButtonPos := 0; - end; -end; - - -// Method to add a button in our TMenu. It returns the assigned ButtonNumber -function TMenu.AddButton(ThemeButton: TThemeButton): integer; -var - BT: integer; - BTLen: integer; - temp: integer; - TempR, TempG, TempB, TempR2, TempG2, TempB2: Cardinal; -begin -{ Result := AddButton(ThemeButton.X, ThemeButton.Y, ThemeButton.W, ThemeButton.H, - ThemeButton.ColR, ThemeButton.ColG, ThemeButton.ColB, ThemeButton.Int, - ThemeButton.DColR, ThemeButton.DColG, ThemeButton.DColB, ThemeButton.DInt, - ThemeButton.Tex, 'JPG', 'Font Black');} - - Result := AddButton(ThemeButton.X, ThemeButton.Y, ThemeButton.W, ThemeButton.H, - ThemeButton.ColR, ThemeButton.ColG, ThemeButton.ColB, ThemeButton.Int, - ThemeButton.DColR, ThemeButton.DColG, ThemeButton.DColB, ThemeButton.DInt, - Skin.GetTextureFileName(ThemeButton.Tex), 'JPG', ThemeButton.Typ, ThemeButton.Reflection, ThemeButton.Reflectionspacing, ThemeButton.DeSelectReflectionspacing); - - Button[Result].Z := ThemeButton.Z; - - //Button Visibility - Button[Result].Visible := ThemeButton.Visible; - - //Some Things from ButtonFading - Button[Result].SelectH := ThemeButton.SelectH; - Button[Result].SelectW := ThemeButton.SelectW; - - Button[Result].Fade := ThemeButton.Fade; - Button[Result].FadeText := ThemeButton.FadeText; - if ThemeButton.Typ='Colorized' then begin - TempR:=floor(255*ThemeButton.ColR); - TempG:=floor(255*ThemeButton.ColG); - TempB:=floor(255*ThemeButton.ColB); - Button[Result].FadeTex := Texture.LoadTexture(PChar(Skin.GetTextureFileName(ThemeButton.FadeTex)), 'JPG', 'Colorized', ((((TempR shl 8) or TempG) shl 8)or TempB)); - end - else - Button[Result].FadeTex := Texture.GetTexture(Skin.GetTextureFileName(ThemeButton.FadeTex), ThemeButton.Typ, true); - Button[Result].FadeTexPos := ThemeButton.FadeTexPos; - - - BTLen := Length(ThemeButton.Text); - for BT := 0 to BTLen-1 do begin - AddButtonText(ThemeButton.Text[BT].X, ThemeButton.Text[BT].Y, - ThemeButton.Text[BT].ColR, ThemeButton.Text[BT].ColG, ThemeButton.Text[BT].ColB, - ThemeButton.Text[BT].Font, ThemeButton.Text[BT].Size, ThemeButton.Text[BT].Align, - ThemeButton.Text[BT].Text); - end; - - //BAutton Collection Mod - if (ThemeButton.Parent <> 0) then - begin - //If Collection Exists then Change Interaction to Child Button - if (@ButtonCollection[ThemeButton.Parent-1] <> nil) then - begin - Interactions[High(Interactions)].Typ := iBCollectionChild; - Button[Result].Visible := False; - - for BT := 0 to BTLen-1 do - Button[Result].Text[BT].Alpha := 0; - - Button[Result].Parent := ThemeButton.Parent; - if (ButtonCollection[ThemeButton.Parent-1].Fade) then - Button[Result].Texture.Alpha := 0; - end; - end; -end; - -function TMenu.AddButton(X, Y, W, H: real; Name: String): integer; -begin - Result := AddButton(X, Y, W, H, Name, 'JPG', 'Plain', False); -end; - -function TMenu.AddButton(X, Y, W, H: real; Name, Format, Typ: String; Reflection: Boolean): integer; -begin - Result := AddButton(X, Y, W, H, 1, 1, 1, 1, 1, 1, 1, 0.5, Name, 'JPG', 'Plain', Reflection, 15, 15); -end; - -function TMenu.AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean; ReflectionSpacing, DeSelectReflectionSpacing: Real): integer; -var TempR, TempG, TempB, TempR2, TempG2, TempB2: Cardinal; -begin - // adds button - //SetLength is used once to reduce Memory usement - if (ButtonPos <> -1) then - begin - Result := ButtonPos; - Inc(ButtonPos) - end - else //Old Method -> Reserve new Memory for every Button - begin - Result := Length(Button); - SetLength(Button, Result + 1); - end; -// Button[Result] := TButton.Create(Texture.GetTexture(Name, Typ)); - - // check here for cache -// Texture.GetTexture(Name, Typ, false); // preloads textures and creates cahce mipmap when needed -// if Covers.CoverExists(Name) then -// colorize hack -if Typ='Colorized' then -begin - TempR:=floor(255*ColR); - TempG:=floor(255*ColG); - TempB:=floor(255*ColB); - TempR2:=floor(255*DColR); - TempG2:=floor(255*DColG); - TempB2:=floor(255*DColB); - // give encoded color to loadtexture - Button[Result] := TButton.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR shl 8) or TempG) shl 8)or TempB)), - Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR2 shl 8) or TempG2) shl 8)or TempB2))); - -// Button[Result] := TButton.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR2 shl 8) or TempG2) shl 8)or TempB2))); // use cache texture -end -else - - Button[Result] := TButton.Create(Texture.GetTexture(Name, Typ, true)); // use cache texture -// else -// Button[Result] := TButton.Create(Texture.GetTexture(Name, Typ, false)); // don't use cache texture} - - // configures button - Button[Result].X := X; - Button[Result].Y := Y; - Button[Result].W := W; - Button[Result].H := H; - if Typ <> 'Colorized' then begin - Button[Result].SelectColR := ColR; - Button[Result].SelectColG := ColG; - Button[Result].SelectColB := ColB; - Button[Result].DeselectColR := DColR; - Button[Result].DeselectColG := DColG; - Button[Result].DeselectColB := DColB; - end; - Button[Result].SelectInt := Int; - Button[Result].DeselectInt := DInt; - Button[Result].Texture.TexX1 := 0; - Button[Result].Texture.TexY1 := 0; - Button[Result].Texture.TexX2 := 1; - Button[Result].Texture.TexY2 := 1; - Button[Result].SetSelect(false); - - Button[Result].Reflection := Reflection; - Button[Result].Reflectionspacing := ReflectionSpacing; - Button[Result].DeSelectReflectionspacing := DeSelectReflectionSpacing; - - //Button Collection Mod - Button[Result].Parent := 0; - - - // adds interaction - AddInteraction(iButton, Result); - Interaction := 0; -end; - -procedure TMenu.ClearButtons; -begin - Setlength(Button, 0); -end; - -// Method to draw our TMenu and all his child buttons -function TMenu.DrawBG: boolean; -var - PetX: integer; - PetY: integer; -begin - BackImg.ColR := 1; - BackImg.ColG := 1; - BackImg.ColB := 1; - BackImg.TexX1 := 0; - BackImg.TexY1 := 0; - BackImg.TexX2 := 1; - BackImg.TexY2 := 1; - if (BackImg.TexNum <> -1) then begin - // does anyone know what these loops were for? -{ // draw texture with overlapping - for PetY := 1 to BackH do - for PetX := 1 to BackW do begin - BackImg.X := (PetX-1)/BackW * 800; //640 - BackImg.Y := (PetY-1)/BackH * 600; //480 - DrawTexture(BackImg); - end; // for PetX} - BackImg.X:=BackW; - BackImg.Y:=BackW; - DrawTexture(BackImg); - end; // if -end; - -function TMenu.DrawFG: boolean; -var - J: Integer; -begin - // We don't forget about newly implemented static for nice skin ... - for J := 0 to Length(Static) - 1 do - Static[J].Draw; - - // ... and slightly implemented menutext unit - for J := 0 to Length(Text) - 1 do - Text[J].Draw; - - - // Draw all ButtonCollections - For J := 0 to High(ButtonCollection) do - ButtonCollection[J].Draw; - - // Second, we draw all of our buttons - for J := 0 to Length(Button) - 1 do - Button[J].Draw; - - // Third, we draw all of our selects - for J := 0 to Length(Selects) - 1 do - Selects[J].Draw(1); - - for J := 0 to Length(SelectsS) - 1 do - SelectsS[J].Draw; - - // Third, we draw all our widgets -// for J := 0 to Length(WidgetsSrc) - 1 do -// SDL_BlitSurface(WidgetsSrc[J], nil, ParentBackBuf, WidgetsRect[J]); - Result := True; -end; - -function TMenu.Draw: boolean; -begin - DrawBG; - DrawFG; - Result := True; -end; - -{function TMenu.GetNextScreen(): PMenu; -begin - Result := NextScreen; -end;} - -{function TMenu.AddWidget(X, Y : UInt16; WidgetSrc : PSDL_Surface): Int16; -var - WidgetNum : Int16; - -begin - If (Assigned(WidgetSrc)) Then - begin - WidgetNum := Length(WidgetsSrc); - - SetLength(WidgetsSrc, WidgetNum + 1); - SetLength(WidgetsRect, WidgetNum + 1); - - WidgetsSrc[WidgetNum] := WidgetSrc; - WidgetsRect[WidgetNum] := new(PSDL_Rect); - WidgetsRect[WidgetNum]^.x := X; - WidgetsRect[WidgetNum]^.y := Y; - WidgetsRect[WidgetNum]^.w := WidgetSrc^.w; - WidgetsRect[WidgetNum]^.h := WidgetSrc^.h; - - Result := WidgetNum; - end - else - Result := -1; -end;} - -{procedure TMenu.ClearWidgets(MinNumber : Int16); -var - J : Int16; -begin - For J := MinNumber to (Length(WidgetsSrc) - 1) do - begin - SDL_FreeSurface(WidgetsSrc[J]); - dispose(WidgetsRect[J]); - end; - - SetLength(WidgetsSrc, MinNumber); - SetLength(WidgetsRect, MinNumber); -end;} - -function TMenu.IsSelectable(Int: Cardinal): Boolean; -begin - Result := True; - Case Interactions[Int].Typ of - //Button - iButton: Result := Button[Interactions[Int].Num].Visible and Button[Interactions[Int].Num].Selectable; - //Select - iSelect: Result := True; - //Select Slide - iSelectS: Result := SelectsS[Interactions[Int].Num].Visible; - - //ButtonCollection Child - iBCollectionChild: - Result := (ButtonCollection[Button[Interactions[Int].Num].Parent - 1].FirstChild - 1 = Int) AND ((Interactions[Interaction].Typ <> iBCollectionChild) OR (Button[Interactions[Interaction].Num].Parent <> Button[Interactions[Int].Num].Parent)); - end; -end; - -procedure TMenu.InteractNext; -var - Int: Integer; -begin - Int := Interaction; - - // change interaction as long as it's needed - repeat - Int := (Int + 1) Mod Length(Interactions); - - //If no Interaction is Selectable Simply Select Next - if (Int = Interaction) then - begin - Int := (Int + 1) Mod Length(Interactions); - Break; - end; - Until IsSelectable(Int); - - //Set Interaction - Interaction := Int; -end; - - -procedure TMenu.InteractPrev; -var - Int: Integer; -begin - Int := Interaction; - - // change interaction as long as it's needed - repeat - Int := Int - 1; - if Int = -1 then Int := High(Interactions); - - //If no Interaction is Selectable Simply Select Next - if (Int = Interaction) then - begin - Int := SelInteraction - 1; - if Int = -1 then Int := High(Interactions); - Break; - end; - Until IsSelectable(Int); - - //Set Interaction - Interaction := Int -end; - - -procedure TMenu.InteractCustom(CustomSwitch: integer); -var - Num: integer; - Typ: integer; - Again: boolean; -begin - //Code Commented atm, because it needs to be Rewritten - //it doesn't work with Button Collections - {then begin - CustomSwitch:= CustomSwitch*(-1); - Again := true; - // change interaction as long as it's needed - while (Again = true) do begin - Num := SelInteraction - CustomSwitch; - if Num = -1 then Num := High(Interactions); - Interaction := Num; - Again := false; // reset, default to accept changing interaction - - // checking newly interacted element - Num := Interactions[Interaction].Num; - Typ := Interactions[Interaction].Typ; - case Typ of - iButton: - begin - if Button[Num].Selectable = false then Again := True; - end; - end; // case - end; // while - end - else if num>0 then begin - Again := true; - // change interaction as long as it's needed - while (Again = true) do begin - Num := (Interaction + CustomSwitch) Mod Length(Interactions); - Interaction := Num; - Again := false; // reset, default to accept changing interaction - - - // checking newly interacted element - Num := Interactions[Interaction].Num; - Typ := Interactions[Interaction].Typ; - case Typ of - iButton: - begin - if Button[Num].Selectable = false then Again := True; - end; - end; // case - end; // while - end } -end; - - -procedure TMenu.FadeTo(Screen: PMenu); -begin - Display.Fade := 0; - Display.NextScreen := Screen; -end; - -//popup hack -procedure TMenu.CheckFadeTo(Screen: PMenu; msg: String); -begin - Display.Fade := 0; - Display.NextScreenWithCheck := Screen; - Display.CheckOK:=False; - ScreenPopupCheck.ShowPopup(msg); -end; - -procedure TMenu.AddButtonText(AddX, AddY: real; AddText: string); -begin - AddButtonText(AddX, AddY, 1, 1, 1, AddText); -end; - -procedure TMenu.AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; AddText: string); -var - Il: integer; -begin - with Button[High(Button)] do begin - Il := Length(Text); - SetLength(Text, Il+1); - Text[Il] := TText.Create(X + AddX, Y + AddY, AddText); - Text[Il].ColR := ColR; - Text[Il].ColG := ColG; - Text[Il].ColB := ColB; - Text[Il].Int := 1;//0.5; - end; -end; - -procedure TMenu.AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; AddText: string); -var - Il: integer; -begin - with Button[High(Button)] do begin - Il := Length(Text); - SetLength(Text, Il+1); - Text[Il] := TText.Create(X + AddX, Y + AddY, AddText); - Text[Il].ColR := ColR; - Text[Il].ColG := ColG; - Text[Il].ColB := ColB; - Text[Il].Int := 1;//0.5; - Text[Il].Style := Font; - Text[Il].Size := Size; - Text[Il].Align := Align; - end; -end; - -procedure TMenu.AddButtonText(CustomButton: TButton; AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; AddText: string); -var - Il: integer; -begin - with CustomButton do begin - Il := Length(Text); - SetLength(Text, Il+1); - Text[Il] := TText.Create(X + AddX, Y + AddY, AddText); - Text[Il].ColR := ColR; - Text[Il].ColG := ColG; - Text[Il].ColB := ColB; - Text[Il].Int := 1;//0.5; - Text[Il].Style := Font; - Text[Il].Size := Size; - Text[Il].Align := Align; - end; -end; - -function TMenu.AddSelect(ThemeSelect: TThemeSelect; var Data: integer; Values: array of string): integer; -var - SO: integer; -begin - Result := AddSelect(ThemeSelect.X, ThemeSelect.Y, ThemeSelect.W, ThemeSelect.H, ThemeSelect.SkipX, - ThemeSelect.ColR, ThemeSelect.ColG, ThemeSelect.ColB, ThemeSelect.Int, - ThemeSelect.DColR, ThemeSelect.DColG, ThemeSelect.DColB, ThemeSelect.DInt, - ThemeSelect.TColR, ThemeSelect.TColG, ThemeSelect.TColB, ThemeSelect.TInt, - ThemeSelect.TDColR, ThemeSelect.TDColG, ThemeSelect.TDColB, ThemeSelect.TDInt, - ThemeSelect.SBGColR, ThemeSelect.SBGColG, ThemeSelect.SBGColB, ThemeSelect.SBGInt, - ThemeSelect.SBGDColR, ThemeSelect.SBGDColG, ThemeSelect.SBGDColB, ThemeSelect.SBGDInt, - ThemeSelect.STColR, ThemeSelect.STColG, ThemeSelect.STColB, ThemeSelect.STInt, - ThemeSelect.STDColR, ThemeSelect.STDColG, ThemeSelect.STDColB, ThemeSelect.STDInt, - Skin.GetTextureFileName(ThemeSelect.Tex), 'Font Black', - Skin.GetTextureFileName(ThemeSelect.TexSBG), 'Font Black', - ThemeSelect.Text, Data); - for SO := 0 to High(Values) do - AddSelectOption(ThemeSelect.X + ThemeSelect.W + ThemeSelect.SkipX + SO * 100 + 20, ThemeSelect.Y + 20, Values[SO]); -end; - -function TMenu.AddSelect(X, Y, W, H, SkipX, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt, - TColR, TColG, TColB, TInt, TDColR, TDColG, TDColB, TDInt, - SBGColR, SBGColG, SBGColB, SBGInt, SBGDColR, SBGDColG, SBGDColB, SBGDInt, - STColR, STColG, STColB, STInt, STDColR, STDColG, STDColB, STDInt: real; - Name, Typ: String; SBGName, SBGTyp: String; - Caption: string; var Data: integer): integer; -var - S: integer; -begin - S := Length(Selects); - SetLength(Selects, S + 1); - Selects[S] := TSelect.Create; - - Selects[S].Texture := Texture.GetTexture(Name, Typ); - Selects[S].X := X; - Selects[S].Y := Y; - Selects[S].W := W; - Selects[S].H := H; - Selects[S].ColR := ColR; - Selects[S].ColG := ColG; - Selects[S].ColB := ColB; - Selects[S].Int := Int; - Selects[S].DColR := DColR; - Selects[S].DColG := DColG; - Selects[S].DColB := DColB; - Selects[S].DInt := DInt; - - Selects[S].TextureSBG := Texture.GetTexture(SBGName, SBGTyp); - Selects[S].TextureSBG.X := X + W + SkipX; - Selects[S].TextureSBG.Y := Y; - Selects[S].TextureSBG.W := 450; - Selects[S].TextureSBG.H := H; - Selects[S].SBGColR := SBGColR; - Selects[S].SBGColG := SBGColG; - Selects[S].SBGColB := SBGColB; - Selects[S].SBGInt := SBGInt; - Selects[S].SBGDColR := SBGDColR; - Selects[S].SBGDColG := SBGDColG; - Selects[S].SBGDColB := SBGDColB; - Selects[S].SBGDInt := SBGDInt; - - Selects[S].Text.X := X + 20; - Selects[S].Text.Y := Y + 20; - Selects[S].Text.Text := Caption; - Selects[S].Text.Size := 10; - Selects[S].Text.Visible := true; - Selects[S].TColR := TColR; - Selects[S].TColG := TColG; - Selects[S].TColB := TColB; - Selects[S].TInt := TInt; - Selects[S].TDColR := TDColR; - Selects[S].TDColG := TDColG; - Selects[S].TDColB := TDColB; - Selects[S].TDInt := TDInt; - - Selects[S].STColR := STColR; - Selects[S].STColG := STColG; - Selects[S].STColB := STColB; - Selects[S].STInt := STInt; - Selects[S].STDColR := STDColR; - Selects[S].STDColG := STDColG; - Selects[S].STDColB := STDColB; - Selects[S].STDInt := STDInt; - - // new - Selects[S].Texture.TexX1 := 0; - Selects[S].Texture.TexY1 := 0; - Selects[S].Texture.TexX2 := 1; - Selects[S].Texture.TexY2 := 1; - Selects[S].TextureSBG.TexX1 := 0; - Selects[S].TextureSBG.TexY1 := 0; - Selects[S].TextureSBG.TexX2 := 1; - Selects[S].TextureSBG.TexY2 := 1; - - // Sets Data to copy the value of selectops to global value; - Selects[S].PData := @Data; - - // Sets default value of selectopt from Data; - Selects[S].SelectedOption := Data; - - // Disables default selection - Selects[S].SetSelect(false); - - // adds interaction - AddInteraction(iSelect, S); -end; - -procedure TMenu.AddSelectOption(AddX, AddY: real; AddText: string); -begin - AddSelectOption (High(Selects), AddX, AddY, AddText); -end; - -procedure TMenu.AddSelectOption(SelectNo: Cardinal; AddX, AddY: real; AddText: string); -var - SO: integer; -begin - SO := Length(Selects[SelectNo].TextOpt); - SetLength(Selects[SelectNo].TextOpt, SO + 1); - - Selects[SelectNo].TextOpt[SO] := TText.Create; - - Selects[SelectNo].TextOpt[SO].X := AddX; - Selects[SelectNo].TextOpt[SO].Y := AddY; - Selects[SelectNo].TextOpt[SO].Text := AddText; - Selects[SelectNo].TextOpt[SO].Size := 10; - Selects[SelectNo].TextOpt[SO].ColR := Selects[SelectNo].STDColR; - Selects[SelectNo].TextOpt[SO].ColG := Selects[SelectNo].STDColG; - Selects[SelectNo].TextOpt[SO].ColB := Selects[SelectNo].STDColB; - Selects[SelectNo].TextOpt[SO].Int := Selects[SelectNo].STDInt; - Selects[SelectNo].TextOpt[SO].Visible := true; - - if SO = Selects[SelectNo].PData^ then Selects[SelectNo].SelectedOption := SO; -end; - -procedure TMenu.UpdateSelectOptions(ThemeSelect: TThemeSelect; SelectNum: integer; Values: array of string; var Data: integer); -var - SO: integer; -begin - SetLength(Selects[SelectNum].TextOpt, 0); - for SO := 0 to High(Values) do - AddSelectOption(SelectNum, ThemeSelect.X + ThemeSelect.W + ThemeSelect.SkipX + SO * 100 + 20, ThemeSelect.Y + 20, Values[SO]); -end; - -function TMenu.AddSelectSlide(ThemeSelectS: TThemeSelectSlide; var Data: integer; Values: array of string): integer; -var - SO: integer; -begin - Result := AddSelectSlide(ThemeSelectS.X, ThemeSelectS.Y, ThemeSelectS.W, ThemeSelectS.H, ThemeSelectS.SkipX, ThemeSelectS.SBGW, - ThemeSelectS.ColR, ThemeSelectS.ColG, ThemeSelectS.ColB, ThemeSelectS.Int, - ThemeSelectS.DColR, ThemeSelectS.DColG, ThemeSelectS.DColB, ThemeSelectS.DInt, - ThemeSelectS.TColR, ThemeSelectS.TColG, ThemeSelectS.TColB, ThemeSelectS.TInt, - ThemeSelectS.TDColR, ThemeSelectS.TDColG, ThemeSelectS.TDColB, ThemeSelectS.TDInt, - ThemeSelectS.SBGColR, ThemeSelectS.SBGColG, ThemeSelectS.SBGColB, ThemeSelectS.SBGInt, - ThemeSelectS.SBGDColR, ThemeSelectS.SBGDColG, ThemeSelectS.SBGDColB, ThemeSelectS.SBGDInt, - ThemeSelectS.STColR, ThemeSelectS.STColG, ThemeSelectS.STColB, ThemeSelectS.STInt, - ThemeSelectS.STDColR, ThemeSelectS.STDColG, ThemeSelectS.STDColB, ThemeSelectS.STDInt, - Skin.GetTextureFileName(ThemeSelectS.Tex), 'Font Black', - Skin.GetTextureFileName(ThemeSelectS.TexSBG), 'Font Black', - ThemeSelectS.Text, Data); - for SO := 0 to High(Values) do - AddSelectSlideOption(Values[SO]); - - SelectsS[High(SelectsS)].Text.Size := ThemeSelectS.TextSize; - - SelectsS[High(SelectsS)].Texture.Z := ThemeSelectS.Z; - SelectsS[High(SelectsS)].TextureSBG.Z := ThemeSelectS.Z; - - //Generate Lines - SelectsS[High(SelectsS)].GenLines; - - SelectsS[High(SelectsS)].SelectedOption := SelectsS[High(SelectsS)].SelectOptInt; // refresh -end; - -function TMenu.AddSelectSlide(X, Y, W, H, SkipX, SBGW, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt, - TColR, TColG, TColB, TInt, TDColR, TDColG, TDColB, TDInt, - SBGColR, SBGColG, SBGColB, SBGInt, SBGDColR, SBGDColG, SBGDColB, SBGDInt, - STColR, STColG, STColB, STInt, STDColR, STDColG, STDColB, STDInt: real; - Name, Typ: String; SBGName, SBGTyp: String; - Caption: string; var Data: integer): integer; -var - S: integer; - I: integer; -begin - S := Length(SelectsS); - SetLength(SelectsS, S + 1); - SelectsS[S] := TSelectSlide.Create; - - SelectsS[S].Texture := Texture.GetTexture(Name, Typ); - SelectsS[S].X := X; - SelectsS[S].Y := Y; - SelectsS[S].W := W; - SelectsS[S].H := H; - - SelectsS[S].ColR := ColR; - SelectsS[S].ColG := ColG; - SelectsS[S].ColB := ColB; - SelectsS[S].Int := Int; - SelectsS[S].DColR := DColR; - SelectsS[S].DColG := DColG; - SelectsS[S].DColB := DColB; - SelectsS[S].DInt := DInt; - - SelectsS[S].TextureSBG := Texture.GetTexture(SBGName, SBGTyp); - SelectsS[S].TextureSBG.X := X + W + SkipX; - SelectsS[S].TextureSBG.Y := Y; - //SelectsS[S].TextureSBG.W := 450; - SelectsS[S].SBGW := SBGW; - SelectsS[S].TextureSBG.H := H; - SelectsS[S].SBGColR := SBGColR; - SelectsS[S].SBGColG := SBGColG; - SelectsS[S].SBGColB := SBGColB; - SelectsS[S].SBGInt := SBGInt; - SelectsS[S].SBGDColR := SBGDColR; - SelectsS[S].SBGDColG := SBGDColG; - SelectsS[S].SBGDColB := SBGDColB; - SelectsS[S].SBGDInt := SBGDInt; - - SelectsS[S].Text.X := X + 20; - SelectsS[S].Text.Y := Y + (SelectsS[S].TextureSBG.H / 2) - 15; - SelectsS[S].Text.Text := Caption; - SelectsS[S].Text.Size := 10; - SelectsS[S].Text.Visible := true; - SelectsS[S].TColR := TColR; - SelectsS[S].TColG := TColG; - SelectsS[S].TColB := TColB; - SelectsS[S].TInt := TInt; - SelectsS[S].TDColR := TDColR; - SelectsS[S].TDColG := TDColG; - SelectsS[S].TDColB := TDColB; - SelectsS[S].TDInt := TDInt; - - SelectsS[S].STColR := STColR; - SelectsS[S].STColG := STColG; - SelectsS[S].STColB := STColB; - SelectsS[S].STInt := STInt; - SelectsS[S].STDColR := STDColR; - SelectsS[S].STDColG := STDColG; - SelectsS[S].STDColB := STDColB; - SelectsS[S].STDInt := STDInt; - - // new - SelectsS[S].Texture.TexX1 := 0; - SelectsS[S].Texture.TexY1 := 0; - SelectsS[S].Texture.TexX2 := 1; - SelectsS[S].Texture.TexY2 := 1; - SelectsS[S].TextureSBG.TexX1 := 0; - SelectsS[S].TextureSBG.TexY1 := 0; - SelectsS[S].TextureSBG.TexX2 := 1; - SelectsS[S].TextureSBG.TexY2 := 1; - - // Sets Data to copy the value of selectops to global value; - SelectsS[S].PData := @Data; - // Configures Select options - {//SelectsS[S].TextOpt[0].Text := IntToStr(I+1); - SelectsS[S].TextOpt[0].Size := 10; - SelectsS[S].TextOpt[0].Align := 1; - - SelectsS[S].TextOpt[0].ColR := SelectsS[S].STDColR; - SelectsS[S].TextOpt[0].ColG := SelectsS[S].STDColG; - SelectsS[S].TextOpt[0].ColB := SelectsS[S].STDColB; - SelectsS[S].TextOpt[0].Int := SelectsS[S].STDInt; - SelectsS[S].TextOpt[0].Visible := true; } - - // Sets default value of selectopt from Data; - SelectsS[S].SelectedOption := Data; - - // Disables default selection - SelectsS[S].SetSelect(false); - - {// Configures 3 select options - for I := 0 to 2 do begin - SelectsS[S].TextOpt[I].X := SelectsS[S].TextureSBG.X + 20 + (50 + 20) + (150 - 20) * I; - SelectsS[S].TextOpt[I].Y := SelectsS[S].TextureSBG.Y + 20; - SelectsS[S].TextOpt[I].Text := IntToStr(I+1); - SelectsS[S].TextOpt[I].Size := 10; - SelectsS[S].TextOpt[I].Align := 1; - - - SelectsS[S].TextOpt[I].ColR := SelectsS[S].STDColR; - SelectsS[S].TextOpt[I].ColG := SelectsS[S].STDColG; - SelectsS[S].TextOpt[I].ColB := SelectsS[S].STDColB; - SelectsS[S].TextOpt[I].Int := SelectsS[S].STDInt; - SelectsS[S].TextOpt[I].Visible := true; - end;} - - - // adds interaction - AddInteraction(iSelectS, S); - Result := S; -end; - -procedure TMenu.AddSelectSlideOption(AddText: string); -begin - AddSelectSlideOption(High(SelectsS), AddText); -end; - -procedure TMenu.AddSelectSlideOption(SelectNo: Cardinal; AddText: string); -var - SO: integer; -begin - SO := Length(SelectsS[SelectNo].TextOptT); - - SetLength(SelectsS[SelectNo].TextOptT, SO + 1); - SelectsS[SelectNo].TextOptT[SO] := AddText; - - //SelectsS[S].SelectedOption := SelectsS[S].SelectOptInt; // refresh - - //if SO = Selects[S].PData^ then Selects[S].SelectedOption := SO; -end; - -procedure TMenu.UpdateSelectSlideOptions(ThemeSelectSlide: TThemeSelectSlide; SelectNum: integer; Values: array of string; var Data: integer); -var - SO: integer; -begin - SetLength(SelectsS[SelectNum].TextOptT, 0); - for SO := 0 to High(Values) do - AddSelectSlideOption(SelectNum, Values[SO]); - - SelectsS[SelectNum].GenLines; - -// SelectsS[SelectNum].SelectedOption := SelectsS[SelectNum].SelectOptInt; // refresh -// SelectS[SelectNum].SetSelectOpt(Data); -// SelectS[SelectNum].SelectedOption := 0;//Data; - -// Log.LogError(IntToStr(High(SelectsS[SelectNum].TextOptT))); -// if 0 <= High(SelectsS[SelectNum].TextOptT) then - - SelectsS[SelectNum].PData := @Data; - SelectsS[SelectNum].SelectedOption := Data; -end; - -function TMenu.InRegion(X1, Y1, X2, Y2, X, Y: real): Boolean; -begin - Result := false; - X1 := X1 * RenderW/640; - X2 := X2 * RenderW/640; - Y1 := Y1 * RenderH/480; - Y2 := Y2 * RenderH/480; - if (X >= X1) and (X <= X2) and (Y >= Y1) and (Y <= Y2) then - Result := true; -end; - -function TMenu.InStaticRegion(StaticNr: integer; X, Y: integer): Boolean; -begin - Result := InRegion(Static[StaticNr].Texture.X, - Static[StaticNr].Texture.Y, - Static[StaticNr].Texture.X + Static[StaticNr].Texture.W - 1, - Static[StaticNr].Texture.Y + Static[StaticNr].Texture.H - 1, - X, Y); -end; - -procedure TMenu.InteractInc; -var - Num: integer; - Value: integer; -begin - case Interactions[Interaction].Typ of - iSelect: begin - Num := Interactions[Interaction].Num; - Value := Selects[Num].SelectedOption; - Value := (Value + 1) Mod (Length(Selects[Num].TextOpt)); - Selects[Num].SelectedOption := Value; - end; - iSelectS: begin - Num := Interactions[Interaction].Num; - Value := SelectsS[Num].SelectedOption; -// Value := (Value + 1) Mod (Length(SelectsS[Num].TextOptT)); - - // limit - Value := Value + 1; - if Value <= High(SelectsS[Num].TextOptT) then - SelectsS[Num].SelectedOption := Value; - end; - //Button Collection Mod - iBCollectionChild: - begin - - //Select Next Button in Collection - For Num := 1 to High(Button) do - begin - Value := (Interaction + Num) Mod Length(Button); - if Value = 0 then - begin - InteractNext; - Break; - end; - if (Button[Value].Parent = Button[Interaction].Parent) then - begin - Interaction := Value; - Break; - end; - end; - end; - //interact Next if there is Nothing to Change - else InteractNext; - end; -end; - -procedure TMenu.InteractDec; -var - Num: integer; - Value: integer; -begin - case Interactions[Interaction].Typ of - iSelect: begin - Num := Interactions[Interaction].Num; - Value := Selects[Num].SelectedOption; - Value := Value - 1; - if Value = -1 then - Value := High(Selects[Num].TextOpt); - Selects[Num].SelectedOption := Value; - end; - iSelectS: begin - Num := Interactions[Interaction].Num; - Value := SelectsS[Num].SelectedOption; - Value := Value - 1; -// if Value = -1 then -// Value := High(SelectsS[Num].TextOptT); - - if Value >= 0 then - SelectsS[Num].SelectedOption := Value; - end; - //Button Collection Mod - iBCollectionChild: - begin - //Select Prev Button in Collection - For Num := High(Button) downto 1 do - begin - Value := (Interaction + Num) Mod Length(Button); - if Value = High(Button) then - begin - InteractPrev; - Break; - end; - if (Button[Value].Parent = Button[Interaction].Parent) then - begin - Interaction := Value; - Break; - end; - end; - end; - //interact Prev if there is Nothing to Change - else - begin - InteractPrev; - //If ButtonCollection with more than 1 Entry then Select Last Entry - if (Button[Interactions[Interaction].Num].Parent <> 0) AND (ButtonCollection[Button[Interactions[Interaction].Num].Parent-1].CountChilds > 1) then - begin - //Select Last Child - For Num := High(Button) downto 1 do - begin - Value := (Interaction + Num) Mod Length(Button); - if (Button[Value].Parent = Button[Interaction].Parent) then - begin - Interaction := Value; - Break; - end; - end; - end; - end; - end; -end; - -procedure TMenu.AddBox(X, Y, W, H: real); -begin - AddStatic(X, Y, W, H, 0, 0, 0, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); - AddStatic(X+2, Y+2, W-4, H-4, 1, 1, 1, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); -end; - -procedure TMenu.onShow; -begin -// nothing -// beep; -end; - -procedure TMenu.onShowFinish; -begin -// nothing -// beep; -end; - -procedure TMenu.onHide; -begin -// nothing -// beep; -end; - -function TMenu.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin -// nothing -// Beep; - Result := true; -end; - -procedure TMenu.SetAnimationProgress(Progress: real); -begin -// nothing -//beep; -end; - -end. - +unit UMenu; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses OpenGL12, SysUtils, UTexture, UMenuStatic, UMenuText, UMenuButton, UMenuSelect, UMenuSelectSlide, + UMenuInteract, UThemes, UMenuButtonCollection, Math; + +type +{ Int16 = SmallInt;} + + PMenu = ^TMenu; + TMenu = class + protected + ButtonPos: Integer; + + Interactions: array of TInteract; + SelInteraction: integer; + Button: array of TButton; + Selects: array of TSelect; + SelectsS: array of TSelectSlide; + ButtonCollection: Array of TButtonCollection; + BackImg: TTexture; + BackW: integer; + BackH: integer; + public + Text: array of TText; + Static: array of TStatic; + mX: integer; // mouse X + mY: integer; // mouse Y + + Fade: integer; // fade type + ShowFinish: boolean; // true if there is no fade + + + destructor Destroy; override; + constructor Create; overload; virtual; + //constructor Create(Back: string); overload; virtual; // Back is a JPG resource name for background + //constructor Create(Back: string; W, H: integer); overload; virtual; // W and H are the number of overlaps + + // interaction + procedure AddInteraction(Typ, Num: integer); + procedure SetInteraction(Num: integer); + property Interaction: integer read SelInteraction write SetInteraction; + + //Procedure Load BG, Texts, Statics and Button Collections from ThemeBasic + procedure LoadFromTheme(const ThemeBasic: TThemeBasic); + + procedure PrepareButtonCollections(const Collections: AThemeButtonCollection); + procedure AddButtonCollection(const ThemeCollection: TThemeButtonCollection; Const Num: Byte); + + // background + procedure AddBackground(Name: string); + + // static + function AddStatic(ThemeStatic: TThemeStatic): integer; overload; + function AddStatic(X, Y, W, H: real; Name: string): integer; overload; + function AddStatic(X, Y, W, H: real; Name, Format, Typ: string): integer; overload; + function AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; Name, Format, Typ: string): integer; overload; + function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string): integer; overload; + function AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; overload; + function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; overload; + function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; Name, Format, Typ: string; Color: integer; Reflection: Boolean; ReflectionSpacing: Real): integer; overload; + + // text + function AddText(ThemeText: TThemeText): integer; overload; + function AddText(X, Y: real; Tekst: string): integer; overload; + function AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; Tekst: string): integer; overload; + function AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; Tekst: string): integer; overload; + + // button + Procedure SetButtonLength(Length: Cardinal); //Function that Set Length of Button Array in one Step instead of register new Memory for every Button + function AddButton(ThemeButton: TThemeButton): integer; overload; + function AddButton(X, Y, W, H: real; Name: String): integer; overload; + function AddButton(X, Y, W, H: real; Name, Format, Typ: String; Reflection: Boolean): integer; overload; + function AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean; ReflectionSpacing, DeSelectReflectionSpacing: Real): integer; overload; + procedure ClearButtons; + procedure AddButtonText(AddX, AddY: real; AddText: string); overload; + procedure AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; AddText: string); overload; + procedure AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; AddText: string); overload; + procedure AddButtonText(CustomButton: TButton; AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; AddText: string); overload; + + // select + function AddSelect(ThemeSelect: TThemeSelect; var Data: integer; Values: array of string): integer; overload; + function AddSelect(X, Y, W, H, SkipX, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt, + TColR, TColG, TColB, TInt, TDColR, TDColG, TDColB, TDInt, + SBGColR, SBGColG, SBGColB, SBGInt, SBGDColR, SBGDColG, SBGDColB, SBGDInt, + STColR, STColG, STColB, STInt, STDColR, STDColG, STDColB, STDInt: real; + Name, Typ: String; SBGName, SBGTyp: String; + Caption: string; var Data: integer): integer; overload; + procedure AddSelectOption(AddX, AddY: real; AddText: string); overload; + procedure AddSelectOption(SelectNo: Cardinal; AddX, AddY: real; AddText: string); overload; + procedure UpdateSelectOptions(ThemeSelect: TThemeSelect; SelectNum: integer; Values: array of string; var Data: integer); + + // select slide + function AddSelectSlide(ThemeSelectS: TThemeSelectSlide; var Data: integer; Values: array of string): integer; overload; + function AddSelectSlide(X, Y, W, H, SkipX, SBGW, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt, + TColR, TColG, TColB, TInt, TDColR, TDColG, TDColB, TDInt, + SBGColR, SBGColG, SBGColB, SBGInt, SBGDColR, SBGDColG, SBGDColB, SBGDInt, + STColR, STColG, STColB, STInt, STDColR, STDColG, STDColB, STDInt: real; + Name, Typ: String; SBGName, SBGTyp: String; + Caption: string; var Data: integer): integer; overload; + procedure AddSelectSlideOption(AddText: string); overload; + procedure AddSelectSlideOption(SelectNo: Cardinal; AddText: string); overload; + procedure UpdateSelectSlideOptions(ThemeSelectSlide: TThemeSelectSlide; SelectNum: integer; Values: array of string; var Data: integer); + + +// function AddWidget(X, Y : UInt16; WidgetSrc : PSDL_Surface): Int16; +// procedure ClearWidgets(MinNumber : Int16); + procedure FadeTo(Screen: PMenu); + //popup hack + procedure CheckFadeTo(Screen: PMenu; msg: String); + + function DrawBG: boolean; virtual; + function DrawFG: boolean; virtual; + function Draw: boolean; virtual; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown : Boolean): Boolean; virtual; + function ParseMouse(Typ: integer; X: integer; Y: integer): Boolean; virtual; abstract; + function InRegion(X1, Y1, X2, Y2, X, Y: real): Boolean; + function InStaticRegion(StaticNr: integer; X, Y: integer): Boolean; + procedure onShow; virtual; + procedure onShowFinish; virtual; + procedure onHide; virtual; + + procedure SetAnimationProgress(Progress: real); virtual; + + function IsSelectable(Int: Cardinal): Boolean; + + procedure InteractNext; virtual; + procedure InteractCustom(CustomSwitch: integer); virtual; + procedure InteractPrev; virtual; + procedure InteractInc; virtual; + procedure InteractDec; virtual; + + procedure AddBox(X, Y, W, H: real); + end; + +const + pmMove = 1; + pmClick = 2; + pmUnClick = 3; + + iButton = 0; // interaction type + iSelect = 1; + iText = 2; + iSelectS = 3; + iBCollectionChild = 5; + +// fBlack = 0; // fade type +// fWhite = 1; + +implementation + +uses UCommon, + UMain, + UDrawTexture, + UGraphic, + UDisplay, + UCovers, + USkins; + +destructor TMenu.Destroy; +begin + inherited; +end; + +constructor TMenu.Create; +begin + Fade := 0;//fWhite; + + SetLength(Static, 0); + SetLength(Button, 0); + + BackImg.TexNum := -1; + + //Set ButtonPos to Autoset Length + ButtonPos := -1; +end; +{ +constructor TMenu.Create(Back: String); +begin + inherited Create; + + if Back <> '' then begin +// BackImg := Texture.LoadTexture(true, PChar(Back), 'JPG', 'Plain', 0); + BackImg := Texture.LoadTexture(PChar(Back), 'JPG', 'Plain', 0); // new theme system + BackImg.W := 800;//640; + BackImg.H := 600;//480; + BackW := 1; + BackH := 1; + end else + BackImg.TexNum := -1; + + //Set ButtonPos to Autoset Length + ButtonPos := -1; +end; + +constructor TMenu.Create(Back: string; W, H: integer); +begin + Create(Back); + BackImg.W := BackImg.W / W; + BackImg.H := BackImg.H / H; + BackW := W; + BackH := H; +end; } + +procedure TMenu.AddInteraction(Typ, Num: integer); +var + IntNum: integer; +begin + IntNum := Length(Interactions); + SetLength(Interactions, IntNum+1); + Interactions[IntNum].Typ := Typ; + Interactions[IntNum].Num := Num; + Interaction := 0; +end; + +procedure TMenu.SetInteraction(Num: integer); +var + OldNum, OldTyp: integer; + NewNum, NewTyp: integer; +begin + // set inactive + OldNum := Interactions[Interaction].Num; + OldTyp := Interactions[Interaction].Typ; + + NewNum := Interactions[Num].Num; + NewTyp := Interactions[Num].Typ; + + case OldTyp of + iButton: Button[OldNum].Selected := False; + iSelect: Selects[OldNum].Selected := False; + iText: Text[OldNum].Selected := False; + iSelectS: SelectsS[OldNum].Selected := False; + //Button Collection Mod + iBCollectionChild: + begin + Button[OldNum].Selected := False; + + //Deselect Collection if Next Button is Not from Collection + if (NewTyp <> iButton) Or (Button[NewNum].Parent <> Button[OldNum].Parent) then + ButtonCollection[Button[OldNum].Parent-1].Selected := False; + end; + end; + + // set active + SelInteraction := Num; + case NewTyp of + iButton: Button[NewNum].Selected := True; + iSelect: Selects[NewNum].Selected := True; + iText: Text[NewNum].Selected := True; + iSelectS: SelectsS[NewNum].Selected := True; + + //Button Collection Mod + iBCollectionChild: + begin + Button[NewNum].Selected := True; + ButtonCollection[Button[NewNum].Parent-1].Selected := True; + end; + end; +end; + +//---------------------- +//LoadFromTheme - Load BG, Texts, Statics and +//Button Collections from ThemeBasic +//---------------------- +procedure TMenu.LoadFromTheme(const ThemeBasic: TThemeBasic); +var + I: Integer; +begin + //Add Button Collections (Set Button CollectionsLength) + //Button Collections are Created when the first ChildButton is Created + PrepareButtonCollections(ThemeBasic.ButtonCollection); + + {$ifdef fpc} + writeln(' TMenu.LoadFromThem : '+ThemeBasic.Background.Tex ); + {$endif} + + //Add Background + AddBackground(ThemeBasic.Background.Tex); + + //Add Statics and Texts + for I := 0 to High(ThemeBasic.Static) do + AddStatic(ThemeBasic.Static[I]); + + for I := 0 to High(ThemeBasic.Text) do + AddText(ThemeBasic.Text[I]); +end; + +procedure TMenu.AddBackground(Name: string); +var + lFileName : string; +begin + if Name <> '' then + begin +// BackImg := Texture.LoadTexture(false, PChar(Skin.SkinPath + FileName), 'JPG', 'Plain', 0); // new theme system + lFileName := Skin.GetTextureFileName(Name); + lFileName := AdaptFilePaths( lFileName ); + + {$ifdef fpc} + writeln(' TMenu.AddBackground : '+Name+ ' - '+ lFileName ); + {$endif} + +// if lFileName <> '' then + if fileexists( lFileName ) then + begin + BackImg := Texture.GetTexture( lFileName , 'Plain'); + + {$ifdef fpc} + writeln(' TMenu.AddBackground : '+ lFileName +' - LOADED'); + {$endif} + + + BackImg.W := 800; + BackImg.H := 600; + BackW := 1; + BackH := 1; + end; + end; +end; + +//---------------------- +//PrepareButtonCollections: +//Add Button Collections (Set Button CollectionsLength) +//---------------------- +procedure TMenu.PrepareButtonCollections(const Collections: AThemeButtonCollection); +var + I: Integer; +begin + SetLength(ButtonCollection, Length(Collections)); + For I := 0 to High(ButtonCollection) do + AddButtonCollection(Collections[I], I); +end; + +//---------------------- +//AddButtonCollection: +//Create a Button Collection; +//---------------------- +procedure TMenu.AddButtonCollection(const ThemeCollection: TThemeButtonCollection; Const Num: Byte); +var + BT, BTLen: Integer; + TempR, TempG, TempB, TempR2, TempG2, TempB2: Cardinal; + +begin + if (Num > High(ButtonCollection)) then + exit; + +// colorize hack +if ThemeCollection.Style.Typ='Colorized' then +begin + TempR:=floor(255*ThemeCollection.Style.ColR); + TempG:=floor(255*ThemeCollection.Style.ColG); + TempB:=floor(255*ThemeCollection.Style.ColB); + TempR2:=floor(255*ThemeCollection.Style.DColR); + TempG2:=floor(255*ThemeCollection.Style.DColG); + TempB2:=floor(255*ThemeCollection.Style.DColB); + // give encoded color to loadtexture + ButtonCollection[Num] := TButtonCollection.Create(Texture.LoadTexture(PChar(Skin.GetTextureFileName(ThemeCollection.Style.Tex)), 'JPG', 'Colorized', ((((TempR shl 8) or TempG) shl 8)or TempB)), + Texture.LoadTexture(PChar(Skin.GetTextureFileName(ThemeCollection.Style.Tex)), 'JPG', 'Colorized', ((((TempR2 shl 8) or TempG2) shl 8)or TempB2))); + +// Button[Result] := TButton.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR2 shl 8) or TempG2) shl 8)or TempB2))); // use cache texture +end +else + ButtonCollection[Num] := TButtonCollection.Create(Texture.GetTexture(Skin.GetTextureFileName(ThemeCollection.Style.Tex), ThemeCollection.Style.Typ, true)); // use cache texture + + //Set Parent menu + ButtonCollection[Num].ScreenButton := @Self.Button; + + //Set Attributes + ButtonCollection[Num].FirstChild := ThemeCollection.FirstChild; + ButtonCollection[Num].CountChilds := ThemeCollection.ChildCount; + ButtonCollection[Num].Parent := Num + 1; + + //Set Style + ButtonCollection[Num].X := ThemeCollection.Style.X; + ButtonCollection[Num].Y := ThemeCollection.Style.Y; + ButtonCollection[Num].W := ThemeCollection.Style.W; + ButtonCollection[Num].H := ThemeCollection.Style.H; + if ThemeCollection.Style.Typ <> 'Colorized' then begin + ButtonCollection[Num].SelectColR := ThemeCollection.Style.ColR; + ButtonCollection[Num].SelectColG := ThemeCollection.Style.ColG; + ButtonCollection[Num].SelectColB := ThemeCollection.Style.ColB; + ButtonCollection[Num].DeselectColR := ThemeCollection.Style.DColR; + ButtonCollection[Num].DeselectColG := ThemeCollection.Style.DColG; + ButtonCollection[Num].DeselectColB := ThemeCollection.Style.DColB; + end; + ButtonCollection[Num].SelectInt := ThemeCollection.Style.Int; + ButtonCollection[Num].DeselectInt := ThemeCollection.Style.DInt; + ButtonCollection[Num].Texture.TexX1 := 0; + ButtonCollection[Num].Texture.TexY1 := 0; + ButtonCollection[Num].Texture.TexX2 := 1; + ButtonCollection[Num].Texture.TexY2 := 1; + ButtonCollection[Num].SetSelect(false); + + ButtonCollection[Num].Reflection := ThemeCollection.Style.Reflection; + ButtonCollection[Num].Reflectionspacing := ThemeCollection.Style.ReflectionSpacing; + ButtonCollection[Num].DeSelectReflectionspacing := ThemeCollection.Style.DeSelectReflectionSpacing; + + ButtonCollection[Num].Z := ThemeCollection.Style.Z; + + //Some Things from ButtonFading + ButtonCollection[Num].SelectH := ThemeCollection.Style.SelectH; + ButtonCollection[Num].SelectW := ThemeCollection.Style.SelectW; + + ButtonCollection[Num].Fade := ThemeCollection.Style.Fade; + ButtonCollection[Num].FadeText := ThemeCollection.Style.FadeText; + if ThemeCollection.Style.Typ='Colorized' then + ButtonCollection[Num].FadeTex := Texture.LoadTexture(PChar(Skin.GetTextureFileName(ThemeCollection.Style.FadeTex)), 'JPG', 'Colorized', ((((TempR shl 8) or TempG) shl 8)or TempB)) + else + ButtonCollection[Num].FadeTex := Texture.GetTexture(Skin.GetTextureFileName(ThemeCollection.Style.FadeTex), ThemeCollection.Style.Typ, true); + ButtonCollection[Num].FadeTexPos := ThemeCollection.Style.FadeTexPos; + + + BTLen := Length(ThemeCollection.Style.Text); + for BT := 0 to BTLen-1 do begin + AddButtonText(ButtonCollection[Num], ThemeCollection.Style.Text[BT].X, ThemeCollection.Style.Text[BT].Y, + ThemeCollection.Style.Text[BT].ColR, ThemeCollection.Style.Text[BT].ColG, ThemeCollection.Style.Text[BT].ColB, + ThemeCollection.Style.Text[BT].Font, ThemeCollection.Style.Text[BT].Size, ThemeCollection.Style.Text[BT].Align, + ThemeCollection.Style.Text[BT].Text); + end; +end; + +function TMenu.AddStatic(ThemeStatic: TThemeStatic): integer; +begin + Result := AddStatic(ThemeStatic.X, ThemeStatic.Y, ThemeStatic.W, ThemeStatic.H, ThemeStatic.Z, + ThemeStatic.ColR, ThemeStatic.ColG, ThemeStatic.ColB, + ThemeStatic.TexX1, ThemeStatic.TexY1, ThemeStatic.TexX2, ThemeStatic.TexY2, + {<0.5.1: Skin.SkinPath + ThemeStatic.Tex, 0.5.1:} Skin.GetTextureFileName(ThemeStatic.Tex), + 'JPG', ThemeStatic.Typ, $FFFFFF, ThemeStatic.Reflection, ThemeStatic.Reflectionspacing); + //'Font Black'); +end; + +function TMenu.AddStatic(X, Y, W, H: real; Name: string): integer; +begin + Result := AddStatic(X, Y, W, H, Name, 'JPG', 'Plain'); +end; + +function TMenu.AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; Name, Format, Typ: string): integer; +var + StatNum: integer; +begin + Result := AddStatic(X, Y, W, H, ColR, ColG, ColB, Name, Format, Typ, $FFFFFF); +end; + +function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string): integer; +var + StatNum: integer; +begin + Result := AddStatic(X, Y, W, H, Z, ColR, ColG, ColB, Name, Format, Typ, $FFFFFF); +end; + +function TMenu.AddStatic(X, Y, W, H: real; Name, Format, Typ: string): integer; +var + StatNum: integer; +begin + // adds static + StatNum := Length(Static); + SetLength(Static, StatNum + 1); +// Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), $FF00FF)); // $FFFFFF +// Static[StatNum] := TStatic.Create(Texture.LoadTexture(Skin.SkinReg, PChar(Name), PChar(Format), PChar(Typ), $FF00FF)); // new skin system + Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), $FF00FF)); // new skin + + // configures static + Static[StatNum].Texture.X := X; + Static[StatNum].Texture.Y := Y; + Static[StatNum].Texture.W := W; + Static[StatNum].Texture.H := H; + Static[StatNum].Visible := true; + Result := StatNum; +end; + +function TMenu.AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; +var + StatNum: integer; +begin + Result := AddStatic(X, Y, W, H, 0, ColR, ColG, ColB, Name, Format, Typ, Color); +end; + +function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; +begin + Result := AddStatic(X, Y, W, H, Z, ColR, ColG, ColB, 0, 0, 1, 1, Name, Format, Typ, Color, False, 0); +// +end; + +function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; Name, Format, Typ: string; Color: integer; Reflection: Boolean; ReflectionSpacing: Real): integer; +var + StatNum: integer; + TempR, TempG, TempB: Cardinal; + TempCol: Cardinal; +begin + // adds static + StatNum := Length(Static); + SetLength(Static, StatNum + 1); +// Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), Color)); +// Static[StatNum] := TStatic.Create(Texture.LoadTexture(Skin.SkinReg, PChar(Name), PChar(Format), PChar(Typ), Color)); // new skin system + +// colorize hack +if Typ='Colorized' then +begin + TempR:=floor(255*ColR); + TempG:=floor(255*ColG); + TempB:=floor(255*ColB); + // give encoded color to loadtexture + Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR shl 8) or TempG) shl 8)or TempB))); +end +else + Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), Color)); // new skin +// Static[StatNum] := TStatic.Create(Texture.GetTexture(Name, Typ)); + + // configures static + Static[StatNum].Texture.X := X; + Static[StatNum].Texture.Y := Y; + Static[StatNum].Texture.W := W; + Static[StatNum].Texture.H := H; + Static[StatNum].Texture.Z := Z; + if Typ <> 'Colorized' then begin + Static[StatNum].Texture.ColR := ColR; + Static[StatNum].Texture.ColG := ColG; + Static[StatNum].Texture.ColB := ColB; + end; + Static[StatNum].Texture.TexX1 := TexX1; + Static[StatNum].Texture.TexY1 := TexY1; + Static[StatNum].Texture.TexX2 := TexX2; + Static[StatNum].Texture.TexY2 := TexY2; + Static[StatNum].Texture.Alpha := 1; + Static[StatNum].Visible := true; + + //ReflectionMod + Static[StatNum].Reflection := Reflection; + Static[StatNum].ReflectionSpacing := ReflectionSpacing; + + Result := StatNum; +end; + +function TMenu.AddText(ThemeText: TThemeText): integer; +begin + Result := AddText(ThemeText.X, ThemeText.Y, ThemeText.W, ThemeText.Font, ThemeText.Size, + ThemeText.ColR, ThemeText.ColG, ThemeText.ColB, ThemeText.Align, ThemeText.Text); +end; + +function TMenu.AddText(X, Y: real; Tekst: string): integer; +var + TextNum: integer; +begin + // adds text + TextNum := Length(Text); + SetLength(Text, TextNum + 1); + Text[TextNum] := TText.Create(X, Y, Tekst); + Result := TextNum; +end; + +function TMenu.AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; Tekst: string): integer; +begin + Result := AddText(X, Y, 0, Style, Size, ColR, ColG, ColB, 0, Tekst); +end; + +function TMenu.AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; Tekst: string): integer; +var + TextNum: integer; +begin + // adds text + TextNum := Length(Text); + SetLength(Text, TextNum + 1); + Text[TextNum] := TText.Create(X, Y, W, Style, Size, ColR, ColG, ColB, Align, Tekst); + Result := TextNum; +end; + +//Function that Set Length of Button Array in one Step instead of register new Memory for every Button +Procedure TMenu.SetButtonLength(Length: Cardinal); +begin + if (ButtonPos = -1) AND (Length > 0) then + begin + //Set Length of Button + SetLength(Button, Length); + + //Set ButtonPos to start with 0 + ButtonPos := 0; + end; +end; + + +// Method to add a button in our TMenu. It returns the assigned ButtonNumber +function TMenu.AddButton(ThemeButton: TThemeButton): integer; +var + BT: integer; + BTLen: integer; + temp: integer; + TempR, TempG, TempB, TempR2, TempG2, TempB2: Cardinal; +begin +{ Result := AddButton(ThemeButton.X, ThemeButton.Y, ThemeButton.W, ThemeButton.H, + ThemeButton.ColR, ThemeButton.ColG, ThemeButton.ColB, ThemeButton.Int, + ThemeButton.DColR, ThemeButton.DColG, ThemeButton.DColB, ThemeButton.DInt, + ThemeButton.Tex, 'JPG', 'Font Black');} + + Result := AddButton(ThemeButton.X, ThemeButton.Y, ThemeButton.W, ThemeButton.H, + ThemeButton.ColR, ThemeButton.ColG, ThemeButton.ColB, ThemeButton.Int, + ThemeButton.DColR, ThemeButton.DColG, ThemeButton.DColB, ThemeButton.DInt, + Skin.GetTextureFileName(ThemeButton.Tex), 'JPG', ThemeButton.Typ, ThemeButton.Reflection, ThemeButton.Reflectionspacing, ThemeButton.DeSelectReflectionspacing); + + Button[Result].Z := ThemeButton.Z; + + //Button Visibility + Button[Result].Visible := ThemeButton.Visible; + + //Some Things from ButtonFading + Button[Result].SelectH := ThemeButton.SelectH; + Button[Result].SelectW := ThemeButton.SelectW; + + Button[Result].Fade := ThemeButton.Fade; + Button[Result].FadeText := ThemeButton.FadeText; + if ThemeButton.Typ='Colorized' then begin + TempR:=floor(255*ThemeButton.ColR); + TempG:=floor(255*ThemeButton.ColG); + TempB:=floor(255*ThemeButton.ColB); + Button[Result].FadeTex := Texture.LoadTexture(PChar(Skin.GetTextureFileName(ThemeButton.FadeTex)), 'JPG', 'Colorized', ((((TempR shl 8) or TempG) shl 8)or TempB)); + end + else + Button[Result].FadeTex := Texture.GetTexture(Skin.GetTextureFileName(ThemeButton.FadeTex), ThemeButton.Typ, true); + Button[Result].FadeTexPos := ThemeButton.FadeTexPos; + + + BTLen := Length(ThemeButton.Text); + for BT := 0 to BTLen-1 do begin + AddButtonText(ThemeButton.Text[BT].X, ThemeButton.Text[BT].Y, + ThemeButton.Text[BT].ColR, ThemeButton.Text[BT].ColG, ThemeButton.Text[BT].ColB, + ThemeButton.Text[BT].Font, ThemeButton.Text[BT].Size, ThemeButton.Text[BT].Align, + ThemeButton.Text[BT].Text); + end; + + //BAutton Collection Mod + if (ThemeButton.Parent <> 0) then + begin + //If Collection Exists then Change Interaction to Child Button + if (@ButtonCollection[ThemeButton.Parent-1] <> nil) then + begin + Interactions[High(Interactions)].Typ := iBCollectionChild; + Button[Result].Visible := False; + + for BT := 0 to BTLen-1 do + Button[Result].Text[BT].Alpha := 0; + + Button[Result].Parent := ThemeButton.Parent; + if (ButtonCollection[ThemeButton.Parent-1].Fade) then + Button[Result].Texture.Alpha := 0; + end; + end; +end; + +function TMenu.AddButton(X, Y, W, H: real; Name: String): integer; +begin + Result := AddButton(X, Y, W, H, Name, 'JPG', 'Plain', False); +end; + +function TMenu.AddButton(X, Y, W, H: real; Name, Format, Typ: String; Reflection: Boolean): integer; +begin + Result := AddButton(X, Y, W, H, 1, 1, 1, 1, 1, 1, 1, 0.5, Name, 'JPG', 'Plain', Reflection, 15, 15); +end; + +function TMenu.AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean; ReflectionSpacing, DeSelectReflectionSpacing: Real): integer; +var TempR, TempG, TempB, TempR2, TempG2, TempB2: Cardinal; +begin + // adds button + //SetLength is used once to reduce Memory usement + if (ButtonPos <> -1) then + begin + Result := ButtonPos; + Inc(ButtonPos) + end + else //Old Method -> Reserve new Memory for every Button + begin + Result := Length(Button); + SetLength(Button, Result + 1); + end; +// Button[Result] := TButton.Create(Texture.GetTexture(Name, Typ)); + + // check here for cache +// Texture.GetTexture(Name, Typ, false); // preloads textures and creates cahce mipmap when needed +// if Covers.CoverExists(Name) then +// colorize hack +if Typ='Colorized' then +begin + TempR:=floor(255*ColR); + TempG:=floor(255*ColG); + TempB:=floor(255*ColB); + TempR2:=floor(255*DColR); + TempG2:=floor(255*DColG); + TempB2:=floor(255*DColB); + // give encoded color to loadtexture + Button[Result] := TButton.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR shl 8) or TempG) shl 8)or TempB)), + Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR2 shl 8) or TempG2) shl 8)or TempB2))); + +// Button[Result] := TButton.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR2 shl 8) or TempG2) shl 8)or TempB2))); // use cache texture +end +else + + Button[Result] := TButton.Create(Texture.GetTexture(Name, Typ, true)); // use cache texture +// else +// Button[Result] := TButton.Create(Texture.GetTexture(Name, Typ, false)); // don't use cache texture} + + // configures button + Button[Result].X := X; + Button[Result].Y := Y; + Button[Result].W := W; + Button[Result].H := H; + if Typ <> 'Colorized' then begin + Button[Result].SelectColR := ColR; + Button[Result].SelectColG := ColG; + Button[Result].SelectColB := ColB; + Button[Result].DeselectColR := DColR; + Button[Result].DeselectColG := DColG; + Button[Result].DeselectColB := DColB; + end; + Button[Result].SelectInt := Int; + Button[Result].DeselectInt := DInt; + Button[Result].Texture.TexX1 := 0; + Button[Result].Texture.TexY1 := 0; + Button[Result].Texture.TexX2 := 1; + Button[Result].Texture.TexY2 := 1; + Button[Result].SetSelect(false); + + Button[Result].Reflection := Reflection; + Button[Result].Reflectionspacing := ReflectionSpacing; + Button[Result].DeSelectReflectionspacing := DeSelectReflectionSpacing; + + //Button Collection Mod + Button[Result].Parent := 0; + + + // adds interaction + AddInteraction(iButton, Result); + Interaction := 0; +end; + +procedure TMenu.ClearButtons; +begin + Setlength(Button, 0); +end; + +// Method to draw our TMenu and all his child buttons +function TMenu.DrawBG: boolean; +var + PetX: integer; + PetY: integer; +begin + BackImg.ColR := 1; + BackImg.ColG := 1; + BackImg.ColB := 1; + BackImg.TexX1 := 0; + BackImg.TexY1 := 0; + BackImg.TexX2 := 1; + BackImg.TexY2 := 1; + if (BackImg.TexNum <> -1) then begin + // does anyone know what these loops were for? +{ // draw texture with overlapping + for PetY := 1 to BackH do + for PetX := 1 to BackW do begin + BackImg.X := (PetX-1)/BackW * 800; //640 + BackImg.Y := (PetY-1)/BackH * 600; //480 + DrawTexture(BackImg); + end; // for PetX} + BackImg.X:=BackW; + BackImg.Y:=BackW; + DrawTexture(BackImg); + end; // if +end; + +function TMenu.DrawFG: boolean; +var + J: Integer; +begin + // We don't forget about newly implemented static for nice skin ... + for J := 0 to Length(Static) - 1 do + Static[J].Draw; + + // ... and slightly implemented menutext unit + for J := 0 to Length(Text) - 1 do + Text[J].Draw; + + + // Draw all ButtonCollections + For J := 0 to High(ButtonCollection) do + ButtonCollection[J].Draw; + + // Second, we draw all of our buttons + for J := 0 to Length(Button) - 1 do + Button[J].Draw; + + // Third, we draw all of our selects + for J := 0 to Length(Selects) - 1 do + Selects[J].Draw(1); + + for J := 0 to Length(SelectsS) - 1 do + SelectsS[J].Draw; + + // Third, we draw all our widgets +// for J := 0 to Length(WidgetsSrc) - 1 do +// SDL_BlitSurface(WidgetsSrc[J], nil, ParentBackBuf, WidgetsRect[J]); + Result := True; +end; + +function TMenu.Draw: boolean; +begin + DrawBG; + DrawFG; + Result := True; +end; + +{function TMenu.GetNextScreen(): PMenu; +begin + Result := NextScreen; +end;} + +{function TMenu.AddWidget(X, Y : UInt16; WidgetSrc : PSDL_Surface): Int16; +var + WidgetNum : Int16; + +begin + If (Assigned(WidgetSrc)) Then + begin + WidgetNum := Length(WidgetsSrc); + + SetLength(WidgetsSrc, WidgetNum + 1); + SetLength(WidgetsRect, WidgetNum + 1); + + WidgetsSrc[WidgetNum] := WidgetSrc; + WidgetsRect[WidgetNum] := new(PSDL_Rect); + WidgetsRect[WidgetNum]^.x := X; + WidgetsRect[WidgetNum]^.y := Y; + WidgetsRect[WidgetNum]^.w := WidgetSrc^.w; + WidgetsRect[WidgetNum]^.h := WidgetSrc^.h; + + Result := WidgetNum; + end + else + Result := -1; +end;} + +{procedure TMenu.ClearWidgets(MinNumber : Int16); +var + J : Int16; +begin + For J := MinNumber to (Length(WidgetsSrc) - 1) do + begin + SDL_FreeSurface(WidgetsSrc[J]); + dispose(WidgetsRect[J]); + end; + + SetLength(WidgetsSrc, MinNumber); + SetLength(WidgetsRect, MinNumber); +end;} + +function TMenu.IsSelectable(Int: Cardinal): Boolean; +begin + Result := True; + Case Interactions[Int].Typ of + //Button + iButton: Result := Button[Interactions[Int].Num].Visible and Button[Interactions[Int].Num].Selectable; + //Select + iSelect: Result := True; + //Select Slide + iSelectS: Result := SelectsS[Interactions[Int].Num].Visible; + + //ButtonCollection Child + iBCollectionChild: + Result := (ButtonCollection[Button[Interactions[Int].Num].Parent - 1].FirstChild - 1 = Int) AND ((Interactions[Interaction].Typ <> iBCollectionChild) OR (Button[Interactions[Interaction].Num].Parent <> Button[Interactions[Int].Num].Parent)); + end; +end; + +procedure TMenu.InteractNext; +var + Int: Integer; +begin + Int := Interaction; + + // change interaction as long as it's needed + repeat + Int := (Int + 1) Mod Length(Interactions); + + //If no Interaction is Selectable Simply Select Next + if (Int = Interaction) then + begin + Int := (Int + 1) Mod Length(Interactions); + Break; + end; + Until IsSelectable(Int); + + //Set Interaction + Interaction := Int; +end; + + +procedure TMenu.InteractPrev; +var + Int: Integer; +begin + Int := Interaction; + + // change interaction as long as it's needed + repeat + Int := Int - 1; + if Int = -1 then Int := High(Interactions); + + //If no Interaction is Selectable Simply Select Next + if (Int = Interaction) then + begin + Int := SelInteraction - 1; + if Int = -1 then Int := High(Interactions); + Break; + end; + Until IsSelectable(Int); + + //Set Interaction + Interaction := Int +end; + + +procedure TMenu.InteractCustom(CustomSwitch: integer); +var + Num: integer; + Typ: integer; + Again: boolean; +begin + //Code Commented atm, because it needs to be Rewritten + //it doesn't work with Button Collections + {then begin + CustomSwitch:= CustomSwitch*(-1); + Again := true; + // change interaction as long as it's needed + while (Again = true) do begin + Num := SelInteraction - CustomSwitch; + if Num = -1 then Num := High(Interactions); + Interaction := Num; + Again := false; // reset, default to accept changing interaction + + // checking newly interacted element + Num := Interactions[Interaction].Num; + Typ := Interactions[Interaction].Typ; + case Typ of + iButton: + begin + if Button[Num].Selectable = false then Again := True; + end; + end; // case + end; // while + end + else if num>0 then begin + Again := true; + // change interaction as long as it's needed + while (Again = true) do begin + Num := (Interaction + CustomSwitch) Mod Length(Interactions); + Interaction := Num; + Again := false; // reset, default to accept changing interaction + + + // checking newly interacted element + Num := Interactions[Interaction].Num; + Typ := Interactions[Interaction].Typ; + case Typ of + iButton: + begin + if Button[Num].Selectable = false then Again := True; + end; + end; // case + end; // while + end } +end; + + +procedure TMenu.FadeTo(Screen: PMenu); +begin + Display.Fade := 0; + Display.NextScreen := Screen; +end; + +//popup hack +procedure TMenu.CheckFadeTo(Screen: PMenu; msg: String); +begin + Display.Fade := 0; + Display.NextScreenWithCheck := Screen; + Display.CheckOK:=False; + ScreenPopupCheck.ShowPopup(msg); +end; + +procedure TMenu.AddButtonText(AddX, AddY: real; AddText: string); +begin + AddButtonText(AddX, AddY, 1, 1, 1, AddText); +end; + +procedure TMenu.AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; AddText: string); +var + Il: integer; +begin + with Button[High(Button)] do begin + Il := Length(Text); + SetLength(Text, Il+1); + Text[Il] := TText.Create(X + AddX, Y + AddY, AddText); + Text[Il].ColR := ColR; + Text[Il].ColG := ColG; + Text[Il].ColB := ColB; + Text[Il].Int := 1;//0.5; + end; +end; + +procedure TMenu.AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; AddText: string); +var + Il: integer; +begin + with Button[High(Button)] do begin + Il := Length(Text); + SetLength(Text, Il+1); + Text[Il] := TText.Create(X + AddX, Y + AddY, AddText); + Text[Il].ColR := ColR; + Text[Il].ColG := ColG; + Text[Il].ColB := ColB; + Text[Il].Int := 1;//0.5; + Text[Il].Style := Font; + Text[Il].Size := Size; + Text[Il].Align := Align; + end; +end; + +procedure TMenu.AddButtonText(CustomButton: TButton; AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; AddText: string); +var + Il: integer; +begin + with CustomButton do begin + Il := Length(Text); + SetLength(Text, Il+1); + Text[Il] := TText.Create(X + AddX, Y + AddY, AddText); + Text[Il].ColR := ColR; + Text[Il].ColG := ColG; + Text[Il].ColB := ColB; + Text[Il].Int := 1;//0.5; + Text[Il].Style := Font; + Text[Il].Size := Size; + Text[Il].Align := Align; + end; +end; + +function TMenu.AddSelect(ThemeSelect: TThemeSelect; var Data: integer; Values: array of string): integer; +var + SO: integer; +begin + Result := AddSelect(ThemeSelect.X, ThemeSelect.Y, ThemeSelect.W, ThemeSelect.H, ThemeSelect.SkipX, + ThemeSelect.ColR, ThemeSelect.ColG, ThemeSelect.ColB, ThemeSelect.Int, + ThemeSelect.DColR, ThemeSelect.DColG, ThemeSelect.DColB, ThemeSelect.DInt, + ThemeSelect.TColR, ThemeSelect.TColG, ThemeSelect.TColB, ThemeSelect.TInt, + ThemeSelect.TDColR, ThemeSelect.TDColG, ThemeSelect.TDColB, ThemeSelect.TDInt, + ThemeSelect.SBGColR, ThemeSelect.SBGColG, ThemeSelect.SBGColB, ThemeSelect.SBGInt, + ThemeSelect.SBGDColR, ThemeSelect.SBGDColG, ThemeSelect.SBGDColB, ThemeSelect.SBGDInt, + ThemeSelect.STColR, ThemeSelect.STColG, ThemeSelect.STColB, ThemeSelect.STInt, + ThemeSelect.STDColR, ThemeSelect.STDColG, ThemeSelect.STDColB, ThemeSelect.STDInt, + Skin.GetTextureFileName(ThemeSelect.Tex), 'Font Black', + Skin.GetTextureFileName(ThemeSelect.TexSBG), 'Font Black', + ThemeSelect.Text, Data); + for SO := 0 to High(Values) do + AddSelectOption(ThemeSelect.X + ThemeSelect.W + ThemeSelect.SkipX + SO * 100 + 20, ThemeSelect.Y + 20, Values[SO]); +end; + +function TMenu.AddSelect(X, Y, W, H, SkipX, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt, + TColR, TColG, TColB, TInt, TDColR, TDColG, TDColB, TDInt, + SBGColR, SBGColG, SBGColB, SBGInt, SBGDColR, SBGDColG, SBGDColB, SBGDInt, + STColR, STColG, STColB, STInt, STDColR, STDColG, STDColB, STDInt: real; + Name, Typ: String; SBGName, SBGTyp: String; + Caption: string; var Data: integer): integer; +var + S: integer; +begin + S := Length(Selects); + SetLength(Selects, S + 1); + Selects[S] := TSelect.Create; + + Selects[S].Texture := Texture.GetTexture(Name, Typ); + Selects[S].X := X; + Selects[S].Y := Y; + Selects[S].W := W; + Selects[S].H := H; + Selects[S].ColR := ColR; + Selects[S].ColG := ColG; + Selects[S].ColB := ColB; + Selects[S].Int := Int; + Selects[S].DColR := DColR; + Selects[S].DColG := DColG; + Selects[S].DColB := DColB; + Selects[S].DInt := DInt; + + Selects[S].TextureSBG := Texture.GetTexture(SBGName, SBGTyp); + Selects[S].TextureSBG.X := X + W + SkipX; + Selects[S].TextureSBG.Y := Y; + Selects[S].TextureSBG.W := 450; + Selects[S].TextureSBG.H := H; + Selects[S].SBGColR := SBGColR; + Selects[S].SBGColG := SBGColG; + Selects[S].SBGColB := SBGColB; + Selects[S].SBGInt := SBGInt; + Selects[S].SBGDColR := SBGDColR; + Selects[S].SBGDColG := SBGDColG; + Selects[S].SBGDColB := SBGDColB; + Selects[S].SBGDInt := SBGDInt; + + Selects[S].Text.X := X + 20; + Selects[S].Text.Y := Y + 20; + Selects[S].Text.Text := Caption; + Selects[S].Text.Size := 10; + Selects[S].Text.Visible := true; + Selects[S].TColR := TColR; + Selects[S].TColG := TColG; + Selects[S].TColB := TColB; + Selects[S].TInt := TInt; + Selects[S].TDColR := TDColR; + Selects[S].TDColG := TDColG; + Selects[S].TDColB := TDColB; + Selects[S].TDInt := TDInt; + + Selects[S].STColR := STColR; + Selects[S].STColG := STColG; + Selects[S].STColB := STColB; + Selects[S].STInt := STInt; + Selects[S].STDColR := STDColR; + Selects[S].STDColG := STDColG; + Selects[S].STDColB := STDColB; + Selects[S].STDInt := STDInt; + + // new + Selects[S].Texture.TexX1 := 0; + Selects[S].Texture.TexY1 := 0; + Selects[S].Texture.TexX2 := 1; + Selects[S].Texture.TexY2 := 1; + Selects[S].TextureSBG.TexX1 := 0; + Selects[S].TextureSBG.TexY1 := 0; + Selects[S].TextureSBG.TexX2 := 1; + Selects[S].TextureSBG.TexY2 := 1; + + // Sets Data to copy the value of selectops to global value; + Selects[S].PData := @Data; + + // Sets default value of selectopt from Data; + Selects[S].SelectedOption := Data; + + // Disables default selection + Selects[S].SetSelect(false); + + // adds interaction + AddInteraction(iSelect, S); +end; + +procedure TMenu.AddSelectOption(AddX, AddY: real; AddText: string); +begin + AddSelectOption (High(Selects), AddX, AddY, AddText); +end; + +procedure TMenu.AddSelectOption(SelectNo: Cardinal; AddX, AddY: real; AddText: string); +var + SO: integer; +begin + SO := Length(Selects[SelectNo].TextOpt); + SetLength(Selects[SelectNo].TextOpt, SO + 1); + + Selects[SelectNo].TextOpt[SO] := TText.Create; + + Selects[SelectNo].TextOpt[SO].X := AddX; + Selects[SelectNo].TextOpt[SO].Y := AddY; + Selects[SelectNo].TextOpt[SO].Text := AddText; + Selects[SelectNo].TextOpt[SO].Size := 10; + Selects[SelectNo].TextOpt[SO].ColR := Selects[SelectNo].STDColR; + Selects[SelectNo].TextOpt[SO].ColG := Selects[SelectNo].STDColG; + Selects[SelectNo].TextOpt[SO].ColB := Selects[SelectNo].STDColB; + Selects[SelectNo].TextOpt[SO].Int := Selects[SelectNo].STDInt; + Selects[SelectNo].TextOpt[SO].Visible := true; + + if SO = Selects[SelectNo].PData^ then Selects[SelectNo].SelectedOption := SO; +end; + +procedure TMenu.UpdateSelectOptions(ThemeSelect: TThemeSelect; SelectNum: integer; Values: array of string; var Data: integer); +var + SO: integer; +begin + SetLength(Selects[SelectNum].TextOpt, 0); + for SO := 0 to High(Values) do + AddSelectOption(SelectNum, ThemeSelect.X + ThemeSelect.W + ThemeSelect.SkipX + SO * 100 + 20, ThemeSelect.Y + 20, Values[SO]); +end; + +function TMenu.AddSelectSlide(ThemeSelectS: TThemeSelectSlide; var Data: integer; Values: array of string): integer; +var + SO: integer; +begin + Result := AddSelectSlide(ThemeSelectS.X, ThemeSelectS.Y, ThemeSelectS.W, ThemeSelectS.H, ThemeSelectS.SkipX, ThemeSelectS.SBGW, + ThemeSelectS.ColR, ThemeSelectS.ColG, ThemeSelectS.ColB, ThemeSelectS.Int, + ThemeSelectS.DColR, ThemeSelectS.DColG, ThemeSelectS.DColB, ThemeSelectS.DInt, + ThemeSelectS.TColR, ThemeSelectS.TColG, ThemeSelectS.TColB, ThemeSelectS.TInt, + ThemeSelectS.TDColR, ThemeSelectS.TDColG, ThemeSelectS.TDColB, ThemeSelectS.TDInt, + ThemeSelectS.SBGColR, ThemeSelectS.SBGColG, ThemeSelectS.SBGColB, ThemeSelectS.SBGInt, + ThemeSelectS.SBGDColR, ThemeSelectS.SBGDColG, ThemeSelectS.SBGDColB, ThemeSelectS.SBGDInt, + ThemeSelectS.STColR, ThemeSelectS.STColG, ThemeSelectS.STColB, ThemeSelectS.STInt, + ThemeSelectS.STDColR, ThemeSelectS.STDColG, ThemeSelectS.STDColB, ThemeSelectS.STDInt, + Skin.GetTextureFileName(ThemeSelectS.Tex), 'Font Black', + Skin.GetTextureFileName(ThemeSelectS.TexSBG), 'Font Black', + ThemeSelectS.Text, Data); + for SO := 0 to High(Values) do + AddSelectSlideOption(Values[SO]); + + SelectsS[High(SelectsS)].Text.Size := ThemeSelectS.TextSize; + + SelectsS[High(SelectsS)].Texture.Z := ThemeSelectS.Z; + SelectsS[High(SelectsS)].TextureSBG.Z := ThemeSelectS.Z; + + //Generate Lines + SelectsS[High(SelectsS)].GenLines; + + SelectsS[High(SelectsS)].SelectedOption := SelectsS[High(SelectsS)].SelectOptInt; // refresh +end; + +function TMenu.AddSelectSlide(X, Y, W, H, SkipX, SBGW, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt, + TColR, TColG, TColB, TInt, TDColR, TDColG, TDColB, TDInt, + SBGColR, SBGColG, SBGColB, SBGInt, SBGDColR, SBGDColG, SBGDColB, SBGDInt, + STColR, STColG, STColB, STInt, STDColR, STDColG, STDColB, STDInt: real; + Name, Typ: String; SBGName, SBGTyp: String; + Caption: string; var Data: integer): integer; +var + S: integer; + I: integer; +begin + S := Length(SelectsS); + SetLength(SelectsS, S + 1); + SelectsS[S] := TSelectSlide.Create; + + SelectsS[S].Texture := Texture.GetTexture(Name, Typ); + SelectsS[S].X := X; + SelectsS[S].Y := Y; + SelectsS[S].W := W; + SelectsS[S].H := H; + + SelectsS[S].ColR := ColR; + SelectsS[S].ColG := ColG; + SelectsS[S].ColB := ColB; + SelectsS[S].Int := Int; + SelectsS[S].DColR := DColR; + SelectsS[S].DColG := DColG; + SelectsS[S].DColB := DColB; + SelectsS[S].DInt := DInt; + + SelectsS[S].TextureSBG := Texture.GetTexture(SBGName, SBGTyp); + SelectsS[S].TextureSBG.X := X + W + SkipX; + SelectsS[S].TextureSBG.Y := Y; + //SelectsS[S].TextureSBG.W := 450; + SelectsS[S].SBGW := SBGW; + SelectsS[S].TextureSBG.H := H; + SelectsS[S].SBGColR := SBGColR; + SelectsS[S].SBGColG := SBGColG; + SelectsS[S].SBGColB := SBGColB; + SelectsS[S].SBGInt := SBGInt; + SelectsS[S].SBGDColR := SBGDColR; + SelectsS[S].SBGDColG := SBGDColG; + SelectsS[S].SBGDColB := SBGDColB; + SelectsS[S].SBGDInt := SBGDInt; + + SelectsS[S].Text.X := X + 20; + SelectsS[S].Text.Y := Y + (SelectsS[S].TextureSBG.H / 2) - 15; + SelectsS[S].Text.Text := Caption; + SelectsS[S].Text.Size := 10; + SelectsS[S].Text.Visible := true; + SelectsS[S].TColR := TColR; + SelectsS[S].TColG := TColG; + SelectsS[S].TColB := TColB; + SelectsS[S].TInt := TInt; + SelectsS[S].TDColR := TDColR; + SelectsS[S].TDColG := TDColG; + SelectsS[S].TDColB := TDColB; + SelectsS[S].TDInt := TDInt; + + SelectsS[S].STColR := STColR; + SelectsS[S].STColG := STColG; + SelectsS[S].STColB := STColB; + SelectsS[S].STInt := STInt; + SelectsS[S].STDColR := STDColR; + SelectsS[S].STDColG := STDColG; + SelectsS[S].STDColB := STDColB; + SelectsS[S].STDInt := STDInt; + + // new + SelectsS[S].Texture.TexX1 := 0; + SelectsS[S].Texture.TexY1 := 0; + SelectsS[S].Texture.TexX2 := 1; + SelectsS[S].Texture.TexY2 := 1; + SelectsS[S].TextureSBG.TexX1 := 0; + SelectsS[S].TextureSBG.TexY1 := 0; + SelectsS[S].TextureSBG.TexX2 := 1; + SelectsS[S].TextureSBG.TexY2 := 1; + + // Sets Data to copy the value of selectops to global value; + SelectsS[S].PData := @Data; + // Configures Select options + {//SelectsS[S].TextOpt[0].Text := IntToStr(I+1); + SelectsS[S].TextOpt[0].Size := 10; + SelectsS[S].TextOpt[0].Align := 1; + + SelectsS[S].TextOpt[0].ColR := SelectsS[S].STDColR; + SelectsS[S].TextOpt[0].ColG := SelectsS[S].STDColG; + SelectsS[S].TextOpt[0].ColB := SelectsS[S].STDColB; + SelectsS[S].TextOpt[0].Int := SelectsS[S].STDInt; + SelectsS[S].TextOpt[0].Visible := true; } + + // Sets default value of selectopt from Data; + SelectsS[S].SelectedOption := Data; + + // Disables default selection + SelectsS[S].SetSelect(false); + + {// Configures 3 select options + for I := 0 to 2 do begin + SelectsS[S].TextOpt[I].X := SelectsS[S].TextureSBG.X + 20 + (50 + 20) + (150 - 20) * I; + SelectsS[S].TextOpt[I].Y := SelectsS[S].TextureSBG.Y + 20; + SelectsS[S].TextOpt[I].Text := IntToStr(I+1); + SelectsS[S].TextOpt[I].Size := 10; + SelectsS[S].TextOpt[I].Align := 1; + + + SelectsS[S].TextOpt[I].ColR := SelectsS[S].STDColR; + SelectsS[S].TextOpt[I].ColG := SelectsS[S].STDColG; + SelectsS[S].TextOpt[I].ColB := SelectsS[S].STDColB; + SelectsS[S].TextOpt[I].Int := SelectsS[S].STDInt; + SelectsS[S].TextOpt[I].Visible := true; + end;} + + + // adds interaction + AddInteraction(iSelectS, S); + Result := S; +end; + +procedure TMenu.AddSelectSlideOption(AddText: string); +begin + AddSelectSlideOption(High(SelectsS), AddText); +end; + +procedure TMenu.AddSelectSlideOption(SelectNo: Cardinal; AddText: string); +var + SO: integer; +begin + SO := Length(SelectsS[SelectNo].TextOptT); + + SetLength(SelectsS[SelectNo].TextOptT, SO + 1); + SelectsS[SelectNo].TextOptT[SO] := AddText; + + //SelectsS[S].SelectedOption := SelectsS[S].SelectOptInt; // refresh + + //if SO = Selects[S].PData^ then Selects[S].SelectedOption := SO; +end; + +procedure TMenu.UpdateSelectSlideOptions(ThemeSelectSlide: TThemeSelectSlide; SelectNum: integer; Values: array of string; var Data: integer); +var + SO: integer; +begin + SetLength(SelectsS[SelectNum].TextOptT, 0); + for SO := 0 to High(Values) do + AddSelectSlideOption(SelectNum, Values[SO]); + + SelectsS[SelectNum].GenLines; + +// SelectsS[SelectNum].SelectedOption := SelectsS[SelectNum].SelectOptInt; // refresh +// SelectS[SelectNum].SetSelectOpt(Data); +// SelectS[SelectNum].SelectedOption := 0;//Data; + +// Log.LogError(IntToStr(High(SelectsS[SelectNum].TextOptT))); +// if 0 <= High(SelectsS[SelectNum].TextOptT) then + + SelectsS[SelectNum].PData := @Data; + SelectsS[SelectNum].SelectedOption := Data; +end; + +function TMenu.InRegion(X1, Y1, X2, Y2, X, Y: real): Boolean; +begin + Result := false; + X1 := X1 * RenderW/640; + X2 := X2 * RenderW/640; + Y1 := Y1 * RenderH/480; + Y2 := Y2 * RenderH/480; + if (X >= X1) and (X <= X2) and (Y >= Y1) and (Y <= Y2) then + Result := true; +end; + +function TMenu.InStaticRegion(StaticNr: integer; X, Y: integer): Boolean; +begin + Result := InRegion(Static[StaticNr].Texture.X, + Static[StaticNr].Texture.Y, + Static[StaticNr].Texture.X + Static[StaticNr].Texture.W - 1, + Static[StaticNr].Texture.Y + Static[StaticNr].Texture.H - 1, + X, Y); +end; + +procedure TMenu.InteractInc; +var + Num: integer; + Value: integer; +begin + case Interactions[Interaction].Typ of + iSelect: begin + Num := Interactions[Interaction].Num; + Value := Selects[Num].SelectedOption; + Value := (Value + 1) Mod (Length(Selects[Num].TextOpt)); + Selects[Num].SelectedOption := Value; + end; + iSelectS: begin + Num := Interactions[Interaction].Num; + Value := SelectsS[Num].SelectedOption; +// Value := (Value + 1) Mod (Length(SelectsS[Num].TextOptT)); + + // limit + Value := Value + 1; + if Value <= High(SelectsS[Num].TextOptT) then + SelectsS[Num].SelectedOption := Value; + end; + //Button Collection Mod + iBCollectionChild: + begin + + //Select Next Button in Collection + For Num := 1 to High(Button) do + begin + Value := (Interaction + Num) Mod Length(Button); + if Value = 0 then + begin + InteractNext; + Break; + end; + if (Button[Value].Parent = Button[Interaction].Parent) then + begin + Interaction := Value; + Break; + end; + end; + end; + //interact Next if there is Nothing to Change + else InteractNext; + end; +end; + +procedure TMenu.InteractDec; +var + Num: integer; + Value: integer; +begin + case Interactions[Interaction].Typ of + iSelect: begin + Num := Interactions[Interaction].Num; + Value := Selects[Num].SelectedOption; + Value := Value - 1; + if Value = -1 then + Value := High(Selects[Num].TextOpt); + Selects[Num].SelectedOption := Value; + end; + iSelectS: begin + Num := Interactions[Interaction].Num; + Value := SelectsS[Num].SelectedOption; + Value := Value - 1; +// if Value = -1 then +// Value := High(SelectsS[Num].TextOptT); + + if Value >= 0 then + SelectsS[Num].SelectedOption := Value; + end; + //Button Collection Mod + iBCollectionChild: + begin + //Select Prev Button in Collection + For Num := High(Button) downto 1 do + begin + Value := (Interaction + Num) Mod Length(Button); + if Value = High(Button) then + begin + InteractPrev; + Break; + end; + if (Button[Value].Parent = Button[Interaction].Parent) then + begin + Interaction := Value; + Break; + end; + end; + end; + //interact Prev if there is Nothing to Change + else + begin + InteractPrev; + //If ButtonCollection with more than 1 Entry then Select Last Entry + if (Button[Interactions[Interaction].Num].Parent <> 0) AND (ButtonCollection[Button[Interactions[Interaction].Num].Parent-1].CountChilds > 1) then + begin + //Select Last Child + For Num := High(Button) downto 1 do + begin + Value := (Interaction + Num) Mod Length(Button); + if (Button[Value].Parent = Button[Interaction].Parent) then + begin + Interaction := Value; + Break; + end; + end; + end; + end; + end; +end; + +procedure TMenu.AddBox(X, Y, W, H: real); +begin + AddStatic(X, Y, W, H, 0, 0, 0, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); + AddStatic(X+2, Y+2, W-4, H-4, 1, 1, 1, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); +end; + +procedure TMenu.onShow; +begin +// nothing +// beep; +end; + +procedure TMenu.onShowFinish; +begin +// nothing +// beep; +end; + +procedure TMenu.onHide; +begin +// nothing +// beep; +end; + +function TMenu.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin +// nothing +// Beep; + Result := true; +end; + +procedure TMenu.SetAnimationProgress(Progress: real); +begin +// nothing +//beep; +end; + +end. + diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index 2ff989fa..ef8b31d1 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -1,132 +1,138 @@ -unit UScreenOptionsRecord; - -interface - -uses - UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; - -type - TScreenOptionsRecord = class(TMenu) - private - SelectSlideInput: integer; - SelectSlideChannelL: integer; - SelectSlideChannelR: integer; - public - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - procedure onShow; override; - procedure UpdateCard; - end; - -implementation - -uses SysUtils, UGraphic, URecord, ULog; - -function TScreenOptionsRecord.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(@ScreenOptions); - end; - SDLK_RETURN: - begin - if SelInteraction = 4 then begin - Ini.Save; - Music.PlayBack; - FadeTo(@ScreenOptions); - end; - end; - SDLK_DOWN: - InteractNext; - SDLK_UP : - InteractPrev; - SDLK_RIGHT: - begin - if (SelInteraction >= 0) and (SelInteraction <= 3) then begin - Music.PlayOption; - InteractInc; - end; - if SelInteraction = 0 then UpdateCard; - end; - SDLK_LEFT: - begin - if (SelInteraction >= 0) and (SelInteraction <= 3) then begin - Music.PlayOption; - InteractDec; - end; - if SelInteraction = 0 then UpdateCard; - end; - end; - end; -end; - -constructor TScreenOptionsRecord.Create; -var - I: integer; - SC: integer; - SCI: integer; -begin - inherited Create; - - LoadFromTheme(Theme.OptionsRecord); - - SetLength(ICard, Length(Recording.SoundCard)); - for SC := 0 to High(Recording.SoundCard) do - ICard[SC] := Recording.SoundCard[SC].Description; -// end; - -// if Length(Recording.SoundCard[Ini.Card].Input) > 0 then begin - SetLength(IInput, Length(Recording.SoundCard[Ini.Card].Input)); - for SCI := 0 to High(Recording.SoundCard[Ini.Card].Input) do - IInput[SCI] := Recording.SoundCard[Ini.Card].Input[SCI].Name; -// end; - - - AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, Ini.Card, ICard); - SelectSlideInput := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, Ini.CardList[0].Input, IInput); - SelectSlideChannelL := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelL, Ini.CardList[0].ChannelL, IChannel); - SelectSlideChannelR := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelR, Ini.CardList[0].ChannelR, IChannel); - - AddButton(Theme.OptionsRecord.ButtonExit); - if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[7]); - - Interaction := 0; -end; - -procedure TScreenOptionsRecord.onShow; -begin - Interaction := 0; -end; - -procedure TScreenOptionsRecord.UpdateCard; -var - SC: integer; - SCI: integer; -begin - SC := Ini.Card; -// if SC = 1 then beep; - - SetLength(IInput, Length(Recording.SoundCard[SC].Input)); - for SCI := 0 to High(Recording.SoundCard[SC].Input) do begin - IInput[SCI] := Recording.SoundCard[SC].Input[SCI].Name; -// Log.LogError(IInput[SCI]); - end; - - UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideInput, SelectSlideInput, IInput, Ini.CardList[SC].Input); - UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelL, SelectSlideChannelL, IChannel, Ini.CardList[SC].ChannelL); - UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelR, SelectSlideChannelR, IChannel, Ini.CardList[SC].ChannelR); -end; - -end. \ No newline at end of file +unit UScreenOptionsRecord; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; + +type + TScreenOptionsRecord = class(TMenu) + private + SelectSlideInput: integer; + SelectSlideChannelL: integer; + SelectSlideChannelR: integer; + public + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure UpdateCard; + end; + +implementation + +uses SysUtils, UGraphic, URecord, ULog; + +function TScreenOptionsRecord.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(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 4 then begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + Music.PlayOption; + InteractInc; + end; + if SelInteraction = 0 then UpdateCard; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + Music.PlayOption; + InteractDec; + end; + if SelInteraction = 0 then UpdateCard; + end; + end; + end; +end; + +constructor TScreenOptionsRecord.Create; +var + I: integer; + SC: integer; + SCI: integer; +begin + inherited Create; + + LoadFromTheme(Theme.OptionsRecord); + + SetLength(ICard, Length(Recording.SoundCard)); + for SC := 0 to High(Recording.SoundCard) do + ICard[SC] := Recording.SoundCard[SC].Description; +// end; + +// if Length(Recording.SoundCard[Ini.Card].Input) > 0 then begin + + {$IFDEF win32} + // TODO : JB_Linux .... Audio Input ... had to remove to get it to run ??? + + SetLength(IInput, Length(Recording.SoundCard[Ini.Card].Input)); + for SCI := 0 to High(Recording.SoundCard[Ini.Card].Input) do + IInput[SCI] := Recording.SoundCard[Ini.Card].Input[SCI].Name; +// end; + + AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, Ini.Card, ICard); + SelectSlideInput := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, Ini.CardList[0].Input, IInput); + SelectSlideChannelL := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelL, Ini.CardList[0].ChannelL, IChannel); + SelectSlideChannelR := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelR, Ini.CardList[0].ChannelR, IChannel); + + {$ENDIF} + + + AddButton(Theme.OptionsRecord.ButtonExit); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[7]); + + Interaction := 0; +end; + +procedure TScreenOptionsRecord.onShow; +begin + Interaction := 0; +end; + +procedure TScreenOptionsRecord.UpdateCard; +var + SC: integer; + SCI: integer; +begin + SC := Ini.Card; +// if SC = 1 then beep; + + SetLength(IInput, Length(Recording.SoundCard[SC].Input)); + for SCI := 0 to High(Recording.SoundCard[SC].Input) do begin + IInput[SCI] := Recording.SoundCard[SC].Input[SCI].Name; +// Log.LogError(IInput[SCI]); + end; + + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideInput, SelectSlideInput, IInput, Ini.CardList[SC].Input); + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelL, SelectSlideChannelL, IChannel, Ini.CardList[SC].ChannelL); + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelR, SelectSlideChannelR, IChannel, Ini.CardList[SC].ChannelR); +end; + +end. diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 0182bbd2..c53e8b32 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -1,663 +1,672 @@ -unit UScreenScore; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -uses - UMenu, - SDL, - SysUtils, - UDisplay, - UMusic, - USongs, - UThemes, - OpenGL12, - Windows, - math, - ULCD; - -// OpenGL; - -type - TScreenScore = class(TMenu) - public - TextArtist: integer; - TextTitle: integer; - - TextArtistTitle : integer; - - TextName: array[1..6] of integer; - TextScore: array[1..6] of integer; - - TextNotes: array[1..6] of integer; - TextNotesScore: array[1..6] of integer; - TextLineBonus: array[1..6] of integer; - TextLineBonusScore: array[1..6] of integer; - TextGoldenNotes: array[1..6] of integer; - TextGoldenNotesScore: array[1..6] of integer; - TextTotal: array[1..6] of integer; - TextTotalScore: array[1..6] of integer; - - PlayerStatic: array[1..6] of array of integer; - PlayerTexts : array[1..6] of array of integer; - - - StaticBoxLightest: array[1..6] of integer; - StaticBoxLight: array[1..6] of integer; - StaticBoxDark: array[1..6] of integer; - - StaticBackLevel: array[1..6] of integer; - StaticBackLevelRound: array[1..6] of integer; - StaticLevel: array[1..6] of integer; - StaticLevelRound: array[1..6] of integer; - - Animation: real; - Fadeout: boolean; - - BarScore_ActualHeight : array[1..6] of real; - BarPhrase_ActualHeight : array[1..6] of real; - BarGolden_ActualHeight : array[1..6] of real; - - BarScore_EaseOut_Step : real; - BarPhrase_EaseOut_Step : real; - BarGolden_EaseOut_Step : real; - - TextScore_ActualValue : array[1..6] of integer; - TextPhrase_ActualValue : array[1..6] of integer; - TextGolden_ActualValue : array[1..6] of integer; - - EaseOut_MaxSteps : real; - - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - procedure onShow; override; - procedure onShowFinish; override; - function Draw: boolean; override; - procedure FillPlayer(Item, P: integer); - - function RaiseBar(PlayerNumber: integer; BarStartPosY: Single; ActualHeight: real; Score: integer; ColorBrightness : String; EaseOut_Step: Real) : real; - function IncrementScore(PlayerNumber: integer; ActualScoreValue: Integer; ScoreReached: integer; EaseOut_Step: Real) : integer; - end; - -implementation - -//{$IFDEF TRANSLATE} -uses UGraphic, UScreenSong, UMenuStatic, UTime, UMain, UIni, ULanguage; -//{$ELSE} -//uses UGraphic, UScreenSong, UMenuStatic, UTime, UMain, UIni; -//{$ENDIF} -function TScreenScore.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then begin - case PressedKey of - SDLK_Q: - begin - Result := false; - end; - - SDLK_ESCAPE, - SDLK_BACKSPACE : - - begin - if (not Fadeout) then begin -// Music.StopShuffle; - FadeTo(@ScreenTop5); - Fadeout := true; - end; - end; - SDLK_RETURN: - begin - if (not Fadeout) then begin -// Music.StopShuffle; - FadeTo(@ScreenTop5); - Fadeout := true; - end; - end; -{ SDLK_SYSREQ: - begin - beep; - end;} - SDLK_SYSREQ: - begin - Display.PrintScreen; - end; - end; - end; -end; - -constructor TScreenScore.Create; -var - P: integer; - I, C: integer; -begin - inherited Create; - - LoadFromTheme(Theme.Score); - - TextArtist := AddText(Theme.Score.TextArtist); - TextTitle := AddText(Theme.Score.TextTitle); - - TextArtistTitle := AddText(Theme.Score.TextArtistTitle); - - for P := 1 to 6 do begin - TextName[P] := AddText(Theme.Score.TextName[P]); - TextScore[P] := AddText(Theme.Score.TextScore[P]); - - TextNotes[P] := AddText(Theme.Score.TextNotes[P]); - TextNotesScore[P] := AddText(Theme.Score.TextNotesScore[P]); - TextLineBonus[P] := AddText(Theme.Score.TextLineBonus[P]); - TextLineBonusScore[P] := AddText(Theme.Score.TextLineBonusScore[P]); - TextGoldenNotes[P] := AddText(Theme.Score.TextGoldenNotes[P]); - TextGoldenNotesScore[P] := AddText(Theme.Score.TextGoldenNotesScore[P]); - TextTotal[P] := AddText(Theme.Score.TextTotal[P]); - TextTotalScore[P] := AddText(Theme.Score.TextTotalScore[P]); - - SetLength(PlayerStatic[P], Length(Theme.Score.PlayerStatic[P])); - - SetLength(PlayerTexts[P], Length(Theme.Score.PlayerTexts[P])); - - for I := 0 to High(Theme.Score.PlayerStatic[P]) do - PlayerStatic[P, I] := AddStatic(Theme.Score.PlayerStatic[P, I]); - - - //added by mog - for C := 0 to High(Theme.Score.PlayerTexts[P]) do - PlayerTexts[P, C] := AddText(Theme.Score.PlayerTexts[P, C]); - // more skinable now - - StaticBoxLightest[P] := AddStatic(Theme.Score.StaticBoxLightest[P]); - StaticBoxLight[P] := AddStatic(Theme.Score.StaticBoxLight[P]); - StaticBoxDark[P] := AddStatic(Theme.Score.StaticBoxDark[P]); - - StaticBackLevel[P] := AddStatic(Theme.Score.StaticBackLevel[P]); - StaticBackLevelRound[P] := AddStatic(Theme.Score.StaticBackLevelRound[P]); - StaticLevel[P] := AddStatic(Theme.Score.StaticLevel[P]); - StaticLevelRound[P] := AddStatic(Theme.Score.StaticLevelRound[P]); - end; -end; - -procedure TScreenScore.onShow; -var - P: integer; // player - PP: integer; // another player variable - S: string; - I: integer; - Lev: real; - Skip: integer; - V: array[1..6] of boolean; // visibility array - MaxH: real; // maximum height of score bar - Wsp: real; -begin -{* - CountSkipTimeSet; - - Animation := 0; - Fadeout := false; - - Text[1].Text := AktSong.Artist + ' - ' + AktSong.Title; - Text[2].Text := ' ' + IntToStr((Round(Gracz[0].Punkty) div 10) * 10) + ' points'; - - Static[0].Texture.X := -2000; - Static[1].Texture.X := -2000; - Static[2].Texture.X := -2000; - Static[3].Texture.X := -2000; - Static[4].Texture.X := -2000; - Static[5].Texture.X := -2000; - Static[6].Texture.X := -2000; - Static[7].Texture.X := -2000; - - Text[0].X := -2000; - Text[1].X := -2000; - Text[2].X := -2000; - Text[3].X := -2000; - - - case (Round(Gracz[0].Punkty) div 10) * 10 of - 0..1000: Text[3].Text := ' Tone Deaf'; - 2010..4000: Text[3].Text := ' Amateur'; - 4010..6000: Text[3].Text := ' Rising Star'; - 6010..8000: Text[3].Text := ' Lead Singer'; - 8010..9000: Text[3].Text := ' Hit Artist'; - 9010..10000: Text[3].Text := ' Superstar'; - end; - - Music.PlayShuffle; -*} - - // Singstar - Fadeout := false; - - Text[TextArtist].Text := AktSong.Artist; - Text[TextTitle].Text := AktSong.Title; - Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; - - // set visibility - case PlayersPlay of - 1: begin - V[1] := true; - V[2] := false; - V[3] := false; - V[4] := false; - V[5] := false; - V[6] := false; - end; - 2, 4: begin - V[1] := false; - V[2] := true; - V[3] := true; - V[4] := false; - V[5] := false; - V[6] := false; - end; - 3, 6: begin - V[1] := false; - V[2] := false; - V[3] := false; - V[4] := true; - V[5] := true; - V[6] := true; - end; - end; - - for P := 1 to 6 do begin - Text[TextName[P]].Visible := V[P]; - Text[TextScore[P]].Visible := V[P]; - - // We set alpha to 0 , so we can nicely blend them in when we need them - Text[TextScore[P]].Alpha := 0; - Text[TextNotesScore[P]].Alpha := 0; - Text[TextNotes[P]].Alpha := 0; - Text[TextLineBonus[P]].Alpha := 0; - Text[TextLineBonusScore[P]].Alpha := 0; - Text[TextGoldenNotes[P]].Alpha := 0; - Text[TextGoldenNotesScore[P]].Alpha := 0; - Text[TextTotal[P]].Alpha := 0; - Text[TextTotalScore[P]].Alpha := 0; - - Text[TextNotes[P]].Visible := V[P]; - Text[TextNotesScore[P]].Visible := V[P]; - Text[TextLineBonus[P]].Visible := V[P]; - Text[TextLineBonusScore[P]].Visible := V[P]; - Text[TextGoldenNotes[P]].Visible := V[P]; - Text[TextGoldenNotesScore[P]].Visible := V[P]; - Text[TextTotal[P]].Visible := V[P]; - Text[TextTotalScore[P]].Visible := V[P]; - - for I := 0 to high(PlayerStatic[P]) do - Static[PlayerStatic[P, I]].Visible := V[P]; - - for I := 0 to high(PlayerTexts[P]) do - Text[PlayerTexts[P, I]].Visible := V[P]; - - Static[StaticBoxLightest[P]].Visible := V[P]; - Static[StaticBoxLight[P]].Visible := V[P]; - Static[StaticBoxDark[P]].Visible := V[P]; - - Static[StaticBackLevel[P]].Visible := false; //V[P]; - Static[StaticBackLevelRound[P]].Visible := false; //V[P]; - Static[StaticLevel[P]].Visible := false; //V[P]; - Static[StaticLevelRound[P]].Visible := false; //V[P]; - end; - -end; - -procedure TScreenScore.onShowFinish; -var - index : integer; -begin -for index := 1 to 2 do - begin - BarScore_ActualHeight[index] := 0; - BarPhrase_ActualHeight[index] := 0; - BarGolden_ActualHeight[index] := 0; - - TextScore_ActualValue[index] := 0; - TextPhrase_ActualValue[index] := 0; - TextGolden_ActualValue[index] := 0; - end; - - - BarScore_EaseOut_Step := 1; - BarPhrase_EaseOut_Step := 1; - BarGolden_EaseOut_Step := 1; - - EaseOut_MaxSteps := 100; -end; - -function TScreenScore.Draw: boolean; -var -{ Min: real; - Max: real; - Wsp: real; - Wsp2: real; - Pet: integer;} - - ActualTime, OldTime : Integer; - - Item: integer; - P: integer; - C: integer; - - katze : integer; -begin - - // 0.5.0: try also use 4 players screen with nicks - if PlayersPlay = 4 then begin - for Item := 2 to 3 do begin - if ScreenAct = 1 then P := Item-2; - if ScreenAct = 2 then P := Item; - - FillPlayer(Item, P); - end; - end; - - - // Singstar - let it be...... with 6 statics - if PlayersPlay = 6 then begin - for Item := 4 to 6 do begin - if ScreenAct = 1 then P := Item-4; - if ScreenAct = 2 then P := Item-1; - - FillPlayer(Item, P); - -{ if ScreenAct = 1 then begin - LoadColor( - Static[StaticBoxLightest[Item]].Texture.ColR, - Static[StaticBoxLightest[Item]].Texture.ColG, - Static[StaticBoxLightest[Item]].Texture.ColB, - 'P1Dark'); - end; - - if ScreenAct = 2 then begin - LoadColor( - Static[StaticBoxLightest[Item]].Texture.ColR, - Static[StaticBoxLightest[Item]].Texture.ColG, - Static[StaticBoxLightest[Item]].Texture.ColB, - 'P4Dark'); - end;} - - end; - end; - - inherited Draw; -{ - player[1].ScoreI := 7000; - player[1].ScoreLineI := 2000; - player[1].ScoreGoldenI := 1000; - - player[2].ScoreI := 2500; - player[2].ScoreLineI := 1100; - player[2].ScoreGoldenI := 900; - } -// Let's arise the bars - ActualTime := GetTickCount div 33; - if ((ActualTime <> OldTime) and ShowFinish )then - begin - OldTime := ActualTime; - - For katze:= 0 to 5 do - begin - - // We actually araise them in the right order, but we have to draw them in reverse order (golden -> phrase -> mainscore) - Case BarScore_EaseOut_Step < EaseOut_MaxSteps * 10 of - true : BarScore_EaseOut_Step := BarScore_EaseOut_Step + 1; - end; - - // PhrasenBonus - if (BarScore_EaseOut_Step >= (EaseOut_MaxSteps * 10)) then - begin - Case BarPhrase_EaseOut_Step < EaseOut_MaxSteps * 10 of - true : BarPhrase_EaseOut_Step := BarPhrase_EaseOut_Step + 1; - end; - - // GoldenNotebonus - if (BarPhrase_EaseOut_Step >= (EaseOut_MaxSteps * 10)) then - begin - Case BarGolden_EaseOut_Step < EaseOut_MaxSteps * 10 of - true : BarGolden_EaseOut_Step := BarGolden_EaseOut_Step + 1; - end; - - //######################## - // Draw golden score bar # - //######################## - - BarGolden_ActualHeight[katze] := RaiseBar(katze, - Static[StaticBackLevel[katze+1]].Texture.y - BarScore_ActualHeight[katze] - BarPhrase_ActualHeight[katze], - BarGolden_ActualHeight[katze], - player[katze+1].ScoreGoldenI, - 'Lightest', - BarGolden_EaseOut_Step); - - // Increment and show total score and plain score - TextGolden_ActualValue[katze] := IncrementScore(katze, - TextGolden_ActualValue[katze], - Player[katze+1].ScoreGoldenI, - BarGolden_EaseOut_Step); - Text[TextGoldenNotesScore[katze+1]].Text := IntToStr(TextGolden_ActualValue[katze]); - - // Blend in - Text[TextGoldenNotesScore[katze+1]].Alpha := (BarGolden_EaseOut_Step / 100); - Text[TextGoldenNotes[katze+1]].Alpha := (BarGolden_EaseOut_Step / 100); - - end; - //######################## - // Draw phrase score bar # - //######################## - BarPhrase_ActualHeight[katze] := RaiseBar(katze, - Static[StaticBackLevel[katze+1]].Texture.y - BarScore_ActualHeight[katze], - BarPhrase_ActualHeight[katze], - Player[katze+1].ScoreLineI, - 'Light', - BarPhrase_EaseOut_Step); - - // Increment and show total score and plain score - TextPhrase_ActualValue[katze] := IncrementScore(katze, - TextPhrase_ActualValue[katze], - Player[katze+1].ScoreLineI, - BarPhrase_EaseOut_Step); - Text[TextLineBonusScore[katze+1]].Text := IntToStr(TextPhrase_ActualValue[katze]); - - //Blend in - Text[TextLineBonusScore[katze+1]].Alpha := (BarPhrase_EaseOut_Step / 100); - Text[TextLineBonus[katze+1]].Alpha := (BarPhrase_EaseOut_Step / 100); - - - end; - //####################### - // Draw plain score bar # - //####################### - BarScore_ActualHeight[katze] := RaiseBar(katze, - Static[StaticBackLevel[katze+1]].Texture.y, - BarScore_ActualHeight[katze], - Player[katze+1].ScoreI, - 'Dark', - BarScore_EaseOut_Step); - // Increment and show total score and plain score - TextScore_ActualValue[katze] := IncrementScore(katze, - TextScore_ActualValue[katze], - Player[katze+1].ScoreI, - BarScore_EaseOut_Step); - Text[TextNotesScore[katze+1]].Text := IntToStr(TextScore_ActualValue[katze]); - - Text[TextTotalScore[katze+1]].Text := IntToStr(TextScore_ActualValue[katze] + TextPhrase_ActualValue[katze] + TextGolden_ActualValue[katze]); - - //Blend em in - Text[TextTotalScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextTotal[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextNotesScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextNotes[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); - - end; // me loop - end; -end; - - -function TscreenScore.RaiseBar(PlayerNumber: integer; BarStartPosY: Single; ActualHeight: real; Score: integer; ColorBrightness : String; EaseOut_Step: Real) : real; -const - RaiseSmoothness : integer = 100; -var - MaxHeight : real; - NewHeight : real; - Width : real; - - Height2Reach : real; - - RaiseStep : real; - - BarStartPosX : Single; - - R,G,B : real; -begin - - MaxHeight := Static[StaticBackLevel[PlayerNumber + 1]].Texture.H; - Width := Static[StaticBackLevel[PlayerNumber + 1]].Texture.W; - - BarStartPosX := Static[StaticBackLevel[PlayerNumber + 1]].Texture.X; - - BarStartPosY := BarStartPosY + MaxHeight; // The texture starts in the upper left corner, so let's subtract the height - so we can arise it - - // the height dependend of the score - Height2Reach := (Score / 10000) * MaxHeight; - - // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps - RaiseStep := EaseOut_Step; - - if (ActualHeight < Height2Reach) then - begin - // Check http://proto.layer51.com/d.aspx?f=400 for more info on easing functions - // Calculate the actual step according to the maxsteps - RaiseStep := RaiseStep / EaseOut_MaxSteps; - - // quadratic easing out - decelerating to zero velocity - // -end_position * current_time * ( current_time - 2 ) + start_postion - NewHeight := (-Height2Reach * RaiseStep * (RaiseStep - 20) + BarStartPosY) / RaiseSmoothness; - end - else - begin - NewHeight := Height2Reach; - end; - //+1 - LoadColor(R, G, B, 'P' + inttostr(PlayerNumber+1) + ColorBrightness); //dark, light, lightest - glColor4f(R, G, B, 1); - - //the actual bar - glBindTexture(GL_TEXTURE_2D, Static[StaticLevel[PlayerNumber + 1]].Texture.TexNum); - - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(BarStartPosX, BarStartPosY - NewHeight); - glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, BarStartPosY - NewHeight); - glTexCoord2f(1, 1); glVertex2f(BarStartPosX + Width, BarStartPosY); - glTexCoord2f(0, 1); glVertex2f(BarStartPosX, BarStartPosY); - glEnd; - - //the round thing on top - glBindTexture(GL_TEXTURE_2D, Static[StaticLevelRound[PlayerNumber + 1]].Texture.TexNum); - - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(BarStartPosX, (BarStartPosY - Static[StaticLevelRound[PlayerNumber + 1]].Texture.h) - NewHeight); - glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, (BarStartPosY - Static[StaticLevelRound[PlayerNumber + 1]].Texture.h) - NewHeight); - glTexCoord2f(1, 1); glVertex2f(BarStartPosX + Width, BarStartPosY - NewHeight); - glTexCoord2f(0, 1); glVertex2f(BarStartPosX, BarStartPosY - NewHeight); - glEnd; - - Result := NewHeight; -end; - -function TScreenScore.IncrementScore(PlayerNumber: integer; ActualScoreValue: Integer; ScoreReached: integer; EaseOut_Step: Real) : integer; -const - RaiseSmoothness : integer = 100; -var - RaiseStep : Real; - lTmpA : Real; -begin - // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps - RaiseStep := EaseOut_Step; - - if (ActualScoreValue < ScoreReached) then - begin - // Calculate the actual step according to the maxsteps - RaiseStep := RaiseStep / EaseOut_MaxSteps; - - // quadratic easing out - decelerating to zero velocity - // -end_position * current_time * ( current_time - 2 ) + start_postion - lTmpA := (-ScoreReached * RaiseStep * (RaiseStep - 20)); - if ( lTmpA > 0 ) AND - ( RaiseSmoothness > 0 ) THEN - begin - Result := floor( lTmpA / RaiseSmoothness); - end; - end - else - begin - Result := ScoreReached; - end; - -end; - -procedure TScreenScore.FillPlayer(Item, P: integer); -var - S: string; -begin - Text[TextName[Item]].Text := Ini.Name[P]; - - S := IntToStr((Round(Player[P].Score) div 10) * 10); - while (Length(S)<4) do S := '0' + S; - Text[TextNotesScore[Item]].Text := S; - -// while (Length(S)<5) do S := '0' + S; -// Text[TextTotalScore[Item]].Text := S; - -//fixed: line bonus and golden notes don't show up, -// another bug: total score was shown without added golden-, linebonus - S := IntToStr(Player[P].ScoreTotalI); - while (Length(S)<5) do S := '0' + S; - Text[TextTotalScore[Item]].Text := S; - - S := IntToStr(Player[P].ScoreLineI); - while (Length(S)<4) do S := '0' + S; - Text[TextLineBonusScore[Item]].Text := S; - - S := IntToStr(Player[P].ScoreGoldenI); - while (Length(S)<4) do S := '0' + S; - Text[TextGoldenNotesScore[Item]].Text := S; -//end of fix - - LoadColor( - Text[TextName[Item]].ColR, - Text[TextName[Item]].ColG, - Text[TextName[Item]].ColB, - 'P' + IntToStr(P+1) + 'Dark'); - - LoadColor( - Static[StaticBoxLightest[Item]].Texture.ColR, - Static[StaticBoxLightest[Item]].Texture.ColG, - Static[StaticBoxLightest[Item]].Texture.ColB, - 'P' + IntToStr(P+1) + 'Lightest'); - - LoadColor( - Static[StaticBoxLight[Item]].Texture.ColR, - Static[StaticBoxLight[Item]].Texture.ColG, - Static[StaticBoxLight[Item]].Texture.ColB, - 'P' + IntToStr(P+1) + 'Light'); - - LoadColor( - Static[StaticBoxDark[Item]].Texture.ColR, - Static[StaticBoxDark[Item]].Texture.ColG, - Static[StaticBoxDark[Item]].Texture.ColB, - 'P' + IntToStr(P+1) + 'Dark'); -end; - -end. +unit UScreenScore; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses + UMenu, + SDL, + SysUtils, + UDisplay, + UMusic, + USongs, + UThemes, + OpenGL12, + {$ifdef win32} + Windows, + {$endif} + math, + ULCD; + +// OpenGL; + +type + TScreenScore = class(TMenu) + public + TextArtist: integer; + TextTitle: integer; + + TextArtistTitle : integer; + + TextName: array[1..6] of integer; + TextScore: array[1..6] of integer; + + TextNotes: array[1..6] of integer; + TextNotesScore: array[1..6] of integer; + TextLineBonus: array[1..6] of integer; + TextLineBonusScore: array[1..6] of integer; + TextGoldenNotes: array[1..6] of integer; + TextGoldenNotesScore: array[1..6] of integer; + TextTotal: array[1..6] of integer; + TextTotalScore: array[1..6] of integer; + + PlayerStatic: array[1..6] of array of integer; + PlayerTexts : array[1..6] of array of integer; + + + StaticBoxLightest: array[1..6] of integer; + StaticBoxLight: array[1..6] of integer; + StaticBoxDark: array[1..6] of integer; + + StaticBackLevel: array[1..6] of integer; + StaticBackLevelRound: array[1..6] of integer; + StaticLevel: array[1..6] of integer; + StaticLevelRound: array[1..6] of integer; + + Animation: real; + Fadeout: boolean; + + BarScore_ActualHeight : array[1..6] of real; + BarPhrase_ActualHeight : array[1..6] of real; + BarGolden_ActualHeight : array[1..6] of real; + + BarScore_EaseOut_Step : real; + BarPhrase_EaseOut_Step : real; + BarGolden_EaseOut_Step : real; + + TextScore_ActualValue : array[1..6] of integer; + TextPhrase_ActualValue : array[1..6] of integer; + TextGolden_ActualValue : array[1..6] of integer; + + EaseOut_MaxSteps : real; + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure onShowFinish; override; + function Draw: boolean; override; + procedure FillPlayer(Item, P: integer); + + function RaiseBar(PlayerNumber: integer; BarStartPosY: Single; ActualHeight: real; Score: integer; ColorBrightness : String; EaseOut_Step: Real) : real; + function IncrementScore(PlayerNumber: integer; ActualScoreValue: Integer; ScoreReached: integer; EaseOut_Step: Real) : integer; + end; + +implementation + + +uses UGraphic, + UScreenSong, + UMenuStatic, + UTime, + UMain, + UIni, + {$IFNDEF win32} + lclintf, + {$ENDIF} + ULanguage; + +function TScreenScore.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then begin + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE, + SDLK_BACKSPACE : + + begin + if (not Fadeout) then begin +// Music.StopShuffle; + FadeTo(@ScreenTop5); + Fadeout := true; + end; + end; + SDLK_RETURN: + begin + if (not Fadeout) then begin +// Music.StopShuffle; + FadeTo(@ScreenTop5); + Fadeout := true; + end; + end; +{ SDLK_SYSREQ: + begin + beep; + end;} + SDLK_SYSREQ: + begin + Display.PrintScreen; + end; + end; + end; +end; + +constructor TScreenScore.Create; +var + P: integer; + I, C: integer; +begin + inherited Create; + + LoadFromTheme(Theme.Score); + + TextArtist := AddText(Theme.Score.TextArtist); + TextTitle := AddText(Theme.Score.TextTitle); + + TextArtistTitle := AddText(Theme.Score.TextArtistTitle); + + for P := 1 to 6 do begin + TextName[P] := AddText(Theme.Score.TextName[P]); + TextScore[P] := AddText(Theme.Score.TextScore[P]); + + TextNotes[P] := AddText(Theme.Score.TextNotes[P]); + TextNotesScore[P] := AddText(Theme.Score.TextNotesScore[P]); + TextLineBonus[P] := AddText(Theme.Score.TextLineBonus[P]); + TextLineBonusScore[P] := AddText(Theme.Score.TextLineBonusScore[P]); + TextGoldenNotes[P] := AddText(Theme.Score.TextGoldenNotes[P]); + TextGoldenNotesScore[P] := AddText(Theme.Score.TextGoldenNotesScore[P]); + TextTotal[P] := AddText(Theme.Score.TextTotal[P]); + TextTotalScore[P] := AddText(Theme.Score.TextTotalScore[P]); + + SetLength(PlayerStatic[P], Length(Theme.Score.PlayerStatic[P])); + + SetLength(PlayerTexts[P], Length(Theme.Score.PlayerTexts[P])); + + for I := 0 to High(Theme.Score.PlayerStatic[P]) do + PlayerStatic[P, I] := AddStatic(Theme.Score.PlayerStatic[P, I]); + + + //added by mog + for C := 0 to High(Theme.Score.PlayerTexts[P]) do + PlayerTexts[P, C] := AddText(Theme.Score.PlayerTexts[P, C]); + // more skinable now + + StaticBoxLightest[P] := AddStatic(Theme.Score.StaticBoxLightest[P]); + StaticBoxLight[P] := AddStatic(Theme.Score.StaticBoxLight[P]); + StaticBoxDark[P] := AddStatic(Theme.Score.StaticBoxDark[P]); + + StaticBackLevel[P] := AddStatic(Theme.Score.StaticBackLevel[P]); + StaticBackLevelRound[P] := AddStatic(Theme.Score.StaticBackLevelRound[P]); + StaticLevel[P] := AddStatic(Theme.Score.StaticLevel[P]); + StaticLevelRound[P] := AddStatic(Theme.Score.StaticLevelRound[P]); + end; +end; + +procedure TScreenScore.onShow; +var + P: integer; // player + PP: integer; // another player variable + S: string; + I: integer; + Lev: real; + Skip: integer; + V: array[1..6] of boolean; // visibility array + MaxH: real; // maximum height of score bar + Wsp: real; +begin +{* + CountSkipTimeSet; + + Animation := 0; + Fadeout := false; + + Text[1].Text := AktSong.Artist + ' - ' + AktSong.Title; + Text[2].Text := ' ' + IntToStr((Round(Gracz[0].Punkty) div 10) * 10) + ' points'; + + Static[0].Texture.X := -2000; + Static[1].Texture.X := -2000; + Static[2].Texture.X := -2000; + Static[3].Texture.X := -2000; + Static[4].Texture.X := -2000; + Static[5].Texture.X := -2000; + Static[6].Texture.X := -2000; + Static[7].Texture.X := -2000; + + Text[0].X := -2000; + Text[1].X := -2000; + Text[2].X := -2000; + Text[3].X := -2000; + + + case (Round(Gracz[0].Punkty) div 10) * 10 of + 0..1000: Text[3].Text := ' Tone Deaf'; + 2010..4000: Text[3].Text := ' Amateur'; + 4010..6000: Text[3].Text := ' Rising Star'; + 6010..8000: Text[3].Text := ' Lead Singer'; + 8010..9000: Text[3].Text := ' Hit Artist'; + 9010..10000: Text[3].Text := ' Superstar'; + end; + + Music.PlayShuffle; +*} + + // Singstar + Fadeout := false; + + Text[TextArtist].Text := AktSong.Artist; + Text[TextTitle].Text := AktSong.Title; + Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; + + // set visibility + case PlayersPlay of + 1: begin + V[1] := true; + V[2] := false; + V[3] := false; + V[4] := false; + V[5] := false; + V[6] := false; + end; + 2, 4: begin + V[1] := false; + V[2] := true; + V[3] := true; + V[4] := false; + V[5] := false; + V[6] := false; + end; + 3, 6: begin + V[1] := false; + V[2] := false; + V[3] := false; + V[4] := true; + V[5] := true; + V[6] := true; + end; + end; + + for P := 1 to 6 do begin + Text[TextName[P]].Visible := V[P]; + Text[TextScore[P]].Visible := V[P]; + + // We set alpha to 0 , so we can nicely blend them in when we need them + Text[TextScore[P]].Alpha := 0; + Text[TextNotesScore[P]].Alpha := 0; + Text[TextNotes[P]].Alpha := 0; + Text[TextLineBonus[P]].Alpha := 0; + Text[TextLineBonusScore[P]].Alpha := 0; + Text[TextGoldenNotes[P]].Alpha := 0; + Text[TextGoldenNotesScore[P]].Alpha := 0; + Text[TextTotal[P]].Alpha := 0; + Text[TextTotalScore[P]].Alpha := 0; + + Text[TextNotes[P]].Visible := V[P]; + Text[TextNotesScore[P]].Visible := V[P]; + Text[TextLineBonus[P]].Visible := V[P]; + Text[TextLineBonusScore[P]].Visible := V[P]; + Text[TextGoldenNotes[P]].Visible := V[P]; + Text[TextGoldenNotesScore[P]].Visible := V[P]; + Text[TextTotal[P]].Visible := V[P]; + Text[TextTotalScore[P]].Visible := V[P]; + + for I := 0 to high(PlayerStatic[P]) do + Static[PlayerStatic[P, I]].Visible := V[P]; + + for I := 0 to high(PlayerTexts[P]) do + Text[PlayerTexts[P, I]].Visible := V[P]; + + Static[StaticBoxLightest[P]].Visible := V[P]; + Static[StaticBoxLight[P]].Visible := V[P]; + Static[StaticBoxDark[P]].Visible := V[P]; + + Static[StaticBackLevel[P]].Visible := false; //V[P]; + Static[StaticBackLevelRound[P]].Visible := false; //V[P]; + Static[StaticLevel[P]].Visible := false; //V[P]; + Static[StaticLevelRound[P]].Visible := false; //V[P]; + end; + +end; + +procedure TScreenScore.onShowFinish; +var + index : integer; +begin +for index := 1 to 2 do + begin + BarScore_ActualHeight[index] := 0; + BarPhrase_ActualHeight[index] := 0; + BarGolden_ActualHeight[index] := 0; + + TextScore_ActualValue[index] := 0; + TextPhrase_ActualValue[index] := 0; + TextGolden_ActualValue[index] := 0; + end; + + + BarScore_EaseOut_Step := 1; + BarPhrase_EaseOut_Step := 1; + BarGolden_EaseOut_Step := 1; + + EaseOut_MaxSteps := 100; +end; + +function TScreenScore.Draw: boolean; +var +{ Min: real; + Max: real; + Wsp: real; + Wsp2: real; + Pet: integer;} + + ActualTime, OldTime : Integer; + + Item: integer; + P: integer; + C: integer; + + katze : integer; +begin + + // 0.5.0: try also use 4 players screen with nicks + if PlayersPlay = 4 then begin + for Item := 2 to 3 do begin + if ScreenAct = 1 then P := Item-2; + if ScreenAct = 2 then P := Item; + + FillPlayer(Item, P); + end; + end; + + + // Singstar - let it be...... with 6 statics + if PlayersPlay = 6 then begin + for Item := 4 to 6 do begin + if ScreenAct = 1 then P := Item-4; + if ScreenAct = 2 then P := Item-1; + + FillPlayer(Item, P); + +{ if ScreenAct = 1 then begin + LoadColor( + Static[StaticBoxLightest[Item]].Texture.ColR, + Static[StaticBoxLightest[Item]].Texture.ColG, + Static[StaticBoxLightest[Item]].Texture.ColB, + 'P1Dark'); + end; + + if ScreenAct = 2 then begin + LoadColor( + Static[StaticBoxLightest[Item]].Texture.ColR, + Static[StaticBoxLightest[Item]].Texture.ColG, + Static[StaticBoxLightest[Item]].Texture.ColB, + 'P4Dark'); + end;} + + end; + end; + + inherited Draw; +{ + player[1].ScoreI := 7000; + player[1].ScoreLineI := 2000; + player[1].ScoreGoldenI := 1000; + + player[2].ScoreI := 2500; + player[2].ScoreLineI := 1100; + player[2].ScoreGoldenI := 900; + } +// Let's arise the bars + ActualTime := GetTickCount div 33; + if ((ActualTime <> OldTime) and ShowFinish )then + begin + OldTime := ActualTime; + + For katze:= 0 to 5 do + begin + + // We actually araise them in the right order, but we have to draw them in reverse order (golden -> phrase -> mainscore) + Case BarScore_EaseOut_Step < EaseOut_MaxSteps * 10 of + true : BarScore_EaseOut_Step := BarScore_EaseOut_Step + 1; + end; + + // PhrasenBonus + if (BarScore_EaseOut_Step >= (EaseOut_MaxSteps * 10)) then + begin + Case BarPhrase_EaseOut_Step < EaseOut_MaxSteps * 10 of + true : BarPhrase_EaseOut_Step := BarPhrase_EaseOut_Step + 1; + end; + + // GoldenNotebonus + if (BarPhrase_EaseOut_Step >= (EaseOut_MaxSteps * 10)) then + begin + Case BarGolden_EaseOut_Step < EaseOut_MaxSteps * 10 of + true : BarGolden_EaseOut_Step := BarGolden_EaseOut_Step + 1; + end; + + //######################## + // Draw golden score bar # + //######################## + + BarGolden_ActualHeight[katze] := RaiseBar(katze, + Static[StaticBackLevel[katze+1]].Texture.y - BarScore_ActualHeight[katze] - BarPhrase_ActualHeight[katze], + BarGolden_ActualHeight[katze], + player[katze+1].ScoreGoldenI, + 'Lightest', + BarGolden_EaseOut_Step); + + // Increment and show total score and plain score + TextGolden_ActualValue[katze] := IncrementScore(katze, + TextGolden_ActualValue[katze], + Player[katze+1].ScoreGoldenI, + BarGolden_EaseOut_Step); + Text[TextGoldenNotesScore[katze+1]].Text := IntToStr(TextGolden_ActualValue[katze]); + + // Blend in + Text[TextGoldenNotesScore[katze+1]].Alpha := (BarGolden_EaseOut_Step / 100); + Text[TextGoldenNotes[katze+1]].Alpha := (BarGolden_EaseOut_Step / 100); + + end; + //######################## + // Draw phrase score bar # + //######################## + BarPhrase_ActualHeight[katze] := RaiseBar(katze, + Static[StaticBackLevel[katze+1]].Texture.y - BarScore_ActualHeight[katze], + BarPhrase_ActualHeight[katze], + Player[katze+1].ScoreLineI, + 'Light', + BarPhrase_EaseOut_Step); + + // Increment and show total score and plain score + TextPhrase_ActualValue[katze] := IncrementScore(katze, + TextPhrase_ActualValue[katze], + Player[katze+1].ScoreLineI, + BarPhrase_EaseOut_Step); + Text[TextLineBonusScore[katze+1]].Text := IntToStr(TextPhrase_ActualValue[katze]); + + //Blend in + Text[TextLineBonusScore[katze+1]].Alpha := (BarPhrase_EaseOut_Step / 100); + Text[TextLineBonus[katze+1]].Alpha := (BarPhrase_EaseOut_Step / 100); + + + end; + //####################### + // Draw plain score bar # + //####################### + BarScore_ActualHeight[katze] := RaiseBar(katze, + Static[StaticBackLevel[katze+1]].Texture.y, + BarScore_ActualHeight[katze], + Player[katze+1].ScoreI, + 'Dark', + BarScore_EaseOut_Step); + // Increment and show total score and plain score + TextScore_ActualValue[katze] := IncrementScore(katze, + TextScore_ActualValue[katze], + Player[katze+1].ScoreI, + BarScore_EaseOut_Step); + Text[TextNotesScore[katze+1]].Text := IntToStr(TextScore_ActualValue[katze]); + + Text[TextTotalScore[katze+1]].Text := IntToStr(TextScore_ActualValue[katze] + TextPhrase_ActualValue[katze] + TextGolden_ActualValue[katze]); + + //Blend em in + Text[TextTotalScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextTotal[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextNotesScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextNotes[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + + end; // me loop + end; +end; + + +function TscreenScore.RaiseBar(PlayerNumber: integer; BarStartPosY: Single; ActualHeight: real; Score: integer; ColorBrightness : String; EaseOut_Step: Real) : real; +const + RaiseSmoothness : integer = 100; +var + MaxHeight : real; + NewHeight : real; + Width : real; + + Height2Reach : real; + + RaiseStep : real; + + BarStartPosX : Single; + + R,G,B : real; +begin + + MaxHeight := Static[StaticBackLevel[PlayerNumber + 1]].Texture.H; + Width := Static[StaticBackLevel[PlayerNumber + 1]].Texture.W; + + BarStartPosX := Static[StaticBackLevel[PlayerNumber + 1]].Texture.X; + + BarStartPosY := BarStartPosY + MaxHeight; // The texture starts in the upper left corner, so let's subtract the height - so we can arise it + + // the height dependend of the score + Height2Reach := (Score / 10000) * MaxHeight; + + // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps + RaiseStep := EaseOut_Step; + + if (ActualHeight < Height2Reach) then + begin + // Check http://proto.layer51.com/d.aspx?f=400 for more info on easing functions + // Calculate the actual step according to the maxsteps + RaiseStep := RaiseStep / EaseOut_MaxSteps; + + // quadratic easing out - decelerating to zero velocity + // -end_position * current_time * ( current_time - 2 ) + start_postion + NewHeight := (-Height2Reach * RaiseStep * (RaiseStep - 20) + BarStartPosY) / RaiseSmoothness; + end + else + begin + NewHeight := Height2Reach; + end; + //+1 + LoadColor(R, G, B, 'P' + inttostr(PlayerNumber+1) + ColorBrightness); //dark, light, lightest + glColor4f(R, G, B, 1); + + //the actual bar + glBindTexture(GL_TEXTURE_2D, Static[StaticLevel[PlayerNumber + 1]].Texture.TexNum); + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(BarStartPosX, BarStartPosY - NewHeight); + glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, BarStartPosY - NewHeight); + glTexCoord2f(1, 1); glVertex2f(BarStartPosX + Width, BarStartPosY); + glTexCoord2f(0, 1); glVertex2f(BarStartPosX, BarStartPosY); + glEnd; + + //the round thing on top + glBindTexture(GL_TEXTURE_2D, Static[StaticLevelRound[PlayerNumber + 1]].Texture.TexNum); + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(BarStartPosX, (BarStartPosY - Static[StaticLevelRound[PlayerNumber + 1]].Texture.h) - NewHeight); + glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, (BarStartPosY - Static[StaticLevelRound[PlayerNumber + 1]].Texture.h) - NewHeight); + glTexCoord2f(1, 1); glVertex2f(BarStartPosX + Width, BarStartPosY - NewHeight); + glTexCoord2f(0, 1); glVertex2f(BarStartPosX, BarStartPosY - NewHeight); + glEnd; + + Result := NewHeight; +end; + +function TScreenScore.IncrementScore(PlayerNumber: integer; ActualScoreValue: Integer; ScoreReached: integer; EaseOut_Step: Real) : integer; +const + RaiseSmoothness : integer = 100; +var + RaiseStep : Real; + lTmpA : Real; +begin + // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps + RaiseStep := EaseOut_Step; + + if (ActualScoreValue < ScoreReached) then + begin + // Calculate the actual step according to the maxsteps + RaiseStep := RaiseStep / EaseOut_MaxSteps; + + // quadratic easing out - decelerating to zero velocity + // -end_position * current_time * ( current_time - 2 ) + start_postion + lTmpA := (-ScoreReached * RaiseStep * (RaiseStep - 20)); + if ( lTmpA > 0 ) AND + ( RaiseSmoothness > 0 ) THEN + begin + Result := floor( lTmpA / RaiseSmoothness); + end; + end + else + begin + Result := ScoreReached; + end; + +end; + +procedure TScreenScore.FillPlayer(Item, P: integer); +var + S: string; +begin + Text[TextName[Item]].Text := Ini.Name[P]; + + S := IntToStr((Round(Player[P].Score) div 10) * 10); + while (Length(S)<4) do S := '0' + S; + Text[TextNotesScore[Item]].Text := S; + +// while (Length(S)<5) do S := '0' + S; +// Text[TextTotalScore[Item]].Text := S; + +//fixed: line bonus and golden notes don't show up, +// another bug: total score was shown without added golden-, linebonus + S := IntToStr(Player[P].ScoreTotalI); + while (Length(S)<5) do S := '0' + S; + Text[TextTotalScore[Item]].Text := S; + + S := IntToStr(Player[P].ScoreLineI); + while (Length(S)<4) do S := '0' + S; + Text[TextLineBonusScore[Item]].Text := S; + + S := IntToStr(Player[P].ScoreGoldenI); + while (Length(S)<4) do S := '0' + S; + Text[TextGoldenNotesScore[Item]].Text := S; +//end of fix + + LoadColor( + Text[TextName[Item]].ColR, + Text[TextName[Item]].ColG, + Text[TextName[Item]].ColB, + 'P' + IntToStr(P+1) + 'Dark'); + + LoadColor( + Static[StaticBoxLightest[Item]].Texture.ColR, + Static[StaticBoxLightest[Item]].Texture.ColG, + Static[StaticBoxLightest[Item]].Texture.ColB, + 'P' + IntToStr(P+1) + 'Lightest'); + + LoadColor( + Static[StaticBoxLight[Item]].Texture.ColR, + Static[StaticBoxLight[Item]].Texture.ColG, + Static[StaticBoxLight[Item]].Texture.ColB, + 'P' + IntToStr(P+1) + 'Light'); + + LoadColor( + Static[StaticBoxDark[Item]].Texture.ColR, + Static[StaticBoxDark[Item]].Texture.ColG, + Static[StaticBoxDark[Item]].Texture.ColB, + 'P' + IntToStr(P+1) + 'Dark'); +end; + +end. diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas index 4971d12a..d0fe15c8 100644 --- a/Game/Code/Screens/UScreenTop5.pas +++ b/Game/Code/Screens/UScreenTop5.pas @@ -1,168 +1,168 @@ -unit UScreenTop5; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - -uses - UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes, ULCD; - -type - TScreenTop5 = class(TMenu) - public - TextLevel: integer; - TextArtistTitle: integer; - - StaticNumber: array[1..5] of integer; - TextNumber: array[1..5] of integer; - TextName: array[1..5] of integer; - TextScore: array[1..5] of integer; - - Fadeout: boolean; - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - procedure onShow; override; - function Draw: boolean; override; - end; - -implementation - -uses UGraphic, UDataBase, UMain, UIni; - -function TScreenTop5.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then begin - case PressedKey of - SDLK_Q: - begin - Result := false; - end; - - - SDLK_ESCAPE, - SDLK_BACKSPACE, - SDLK_RETURN: - begin - if (not Fadeout) then begin - FadeTo(@ScreenSong); - Fadeout := true; - end; - end; - SDLK_SYSREQ: - begin - Display.PrintScreen; - end; - end; - end; -end; - -constructor TScreenTop5.Create; -var - I: integer; -begin - inherited Create; - - LoadFromTheme(Theme.Top5); - - - TextLevel := AddText(Theme.Top5.TextLevel); - TextArtistTitle := AddText(Theme.Top5.TextArtistTitle); - - for I := 0 to 4 do - StaticNumber[I+1] := AddStatic(Theme.Top5.StaticNumber[I]); - - for I := 0 to 4 do - TextNumber[I+1] := AddText(Theme.Top5.TextNumber[I]); - for I := 0 to 4 do - TextName[I+1] := AddText(Theme.Top5.TextName[I]); - for I := 0 to 4 do - TextScore[I+1] := AddText(Theme.Top5.TextScore[I]); - -end; - -procedure TScreenTop5.onShow; -var - I: integer; - PMax: integer; -begin - Fadeout := false; - - //ReadScore(AktSong); - - PMax := Ini.Players; - if Ini.Players = 4 then Ini.Players := 5; - for I := 0 to PMax do - DataBase.AddScore(AktSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalI)); - - DataBase.WriteScore(AktSong); - DataBase.ReadScore(AktSong); - - Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; - - for I := 1 to Length(AktSong.Score[Ini.Difficulty]) do begin - Static[StaticNumber[I]].Visible := true; - Text[TextNumber[I]].Visible := true; - Text[TextName[I]].Visible := true; - Text[TextScore[I]].Visible := true; - - Text[TextName[I]].Text := AktSong.Score[Ini.Difficulty, I-1].Name; - Text[TextScore[I]].Text := IntToStr(AktSong.Score[Ini.Difficulty, I-1].Score); - end; - - for I := Length(AktSong.Score[Ini.Difficulty])+1 to 5 do begin - Static[StaticNumber[I]].Visible := false; - Text[TextNumber[I]].Visible := false; - Text[TextName[I]].Visible := false; - Text[TextScore[I]].Visible := false; - end; - - Text[TextLevel].Text := IDifficulty[Ini.Difficulty]; -end; - -function TScreenTop5.Draw: boolean; -//var -{ Min: real; - Max: real; - Wsp: real; - Wsp2: real; - Pet: integer;} - -{ Item: integer; - P: integer; - C: integer;} -begin - // Singstar - let it be...... with 6 statics -(* if PlayersPlay = 6 then begin - for Item := 4 to 6 do begin - if ScreenAct = 1 then P := Item-4; - if ScreenAct = 2 then P := Item-1; - - FillPlayer(Item, P); - -{ if ScreenAct = 1 then begin - LoadColor( - Static[StaticBoxLightest[Item]].Texture.ColR, - Static[StaticBoxLightest[Item]].Texture.ColG, - Static[StaticBoxLightest[Item]].Texture.ColB, - 'P1Dark'); - end; - - if ScreenAct = 2 then begin - LoadColor( - Static[StaticBoxLightest[Item]].Texture.ColR, - Static[StaticBoxLightest[Item]].Texture.ColG, - Static[StaticBoxLightest[Item]].Texture.ColB, - 'P4Dark'); - end; } - - end; - end; *) - - inherited Draw; -end; - -end. +unit UScreenTop5; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +uses + UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes, ULCD; + +type + TScreenTop5 = class(TMenu) + public + TextLevel: integer; + TextArtistTitle: integer; + + StaticNumber: array[1..5] of integer; + TextNumber: array[1..5] of integer; + TextName: array[1..5] of integer; + TextScore: array[1..5] of integer; + + Fadeout: boolean; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + function Draw: boolean; override; + end; + +implementation + +uses UGraphic, UDataBase, UMain, UIni; + +function TScreenTop5.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then begin + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + + SDLK_ESCAPE, + SDLK_BACKSPACE, + SDLK_RETURN: + begin + if (not Fadeout) then begin + FadeTo(@ScreenSong); + Fadeout := true; + end; + end; + SDLK_SYSREQ: + begin + Display.PrintScreen; + end; + end; + end; +end; + +constructor TScreenTop5.Create; +var + I: integer; +begin + inherited Create; + + LoadFromTheme(Theme.Top5); + + + TextLevel := AddText(Theme.Top5.TextLevel); + TextArtistTitle := AddText(Theme.Top5.TextArtistTitle); + + for I := 0 to 4 do + StaticNumber[I+1] := AddStatic( Theme.Top5.StaticNumber[I] ); + + for I := 0 to 4 do + TextNumber[I+1] := AddText(Theme.Top5.TextNumber[I]); + for I := 0 to 4 do + TextName[I+1] := AddText(Theme.Top5.TextName[I]); + for I := 0 to 4 do + TextScore[I+1] := AddText(Theme.Top5.TextScore[I]); + +end; + +procedure TScreenTop5.onShow; +var + I: integer; + PMax: integer; +begin + Fadeout := false; + + //ReadScore(AktSong); + + PMax := Ini.Players; + if Ini.Players = 4 then Ini.Players := 5; + for I := 0 to PMax do + DataBase.AddScore(AktSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalI)); + + DataBase.WriteScore(AktSong); + DataBase.ReadScore(AktSong); + + Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; + + for I := 1 to Length(AktSong.Score[Ini.Difficulty]) do begin + Static[StaticNumber[I]].Visible := true; + Text[TextNumber[I]].Visible := true; + Text[TextName[I]].Visible := true; + Text[TextScore[I]].Visible := true; + + Text[TextName[I]].Text := AktSong.Score[Ini.Difficulty, I-1].Name; + Text[TextScore[I]].Text := IntToStr(AktSong.Score[Ini.Difficulty, I-1].Score); + end; + + for I := Length(AktSong.Score[Ini.Difficulty])+1 to 5 do begin + Static[StaticNumber[I]].Visible := false; + Text[TextNumber[I]].Visible := false; + Text[TextName[I]].Visible := false; + Text[TextScore[I]].Visible := false; + end; + + Text[TextLevel].Text := IDifficulty[Ini.Difficulty]; +end; + +function TScreenTop5.Draw: boolean; +//var +{ Min: real; + Max: real; + Wsp: real; + Wsp2: real; + Pet: integer;} + +{ Item: integer; + P: integer; + C: integer;} +begin + // Singstar - let it be...... with 6 statics +(* if PlayersPlay = 6 then begin + for Item := 4 to 6 do begin + if ScreenAct = 1 then P := Item-4; + if ScreenAct = 2 then P := Item-1; + + FillPlayer(Item, P); + +{ if ScreenAct = 1 then begin + LoadColor( + Static[StaticBoxLightest[Item]].Texture.ColR, + Static[StaticBoxLightest[Item]].Texture.ColG, + Static[StaticBoxLightest[Item]].Texture.ColB, + 'P1Dark'); + end; + + if ScreenAct = 2 then begin + LoadColor( + Static[StaticBoxLightest[Item]].Texture.ColR, + Static[StaticBoxLightest[Item]].Texture.ColG, + Static[StaticBoxLightest[Item]].Texture.ColB, + 'P4Dark'); + end; } + + end; + end; *) + + inherited Draw; +end; + +end. diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index 026d0d69..ce006d54 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -1,428 +1,428 @@ -program UltraStar; - -{$DEFINE TRANSLATE} - -{$IFDEF FPC} - {$MODE DELPHI} -{$ELSE} - {$R 'UltraStar.res' 'UltraStar.rc'} -{$ENDIF} - -{$I switches.inc} - -uses - - // *************************************************************************** - // - // Developers PLEASE NOTE !!!!!!! - // - // As of september 2007, I am working towards porting Ultrastar-DX to run - // on Linux. I will be modifiying the source to make it compile in lazarus - // on windows & linux and I will make sure that it compiles in delphi still - // To help me in this endevour, please can you make a point of remembering - // that linux is CASE SENSATIVE, and file / unit names must be as per - // the filename exactly. - // - // EG : opengl12.pas must not be OpenGL in the uses cluase. - // - // thanks for your help... - // - // *************************************************************************** - - // Interesting stuff... :) - // http://burningsmell.org/sdl_audioin/ - - - //------------------------------ - //Includes - 3rd Party Libraries - //------------------------------ - - // SDL / OpenGL - moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', - opengl12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\opengl12.pas', - sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', - sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', - sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', - sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', - - - // Bass - {$IFDEF UseBASS} - bass in 'lib\bass\delphi\bass.pas', - {$ENDIF} - - // Midi Units - {$IFDEF UseMIDIPort} - Circbuf in 'lib\midi\CIRCBUF.PAS', - Delphmcb in 'lib\midi\Delphmcb.PAS', - MidiCons in 'lib\midi\MidiCons.PAS', - MidiDefs in 'lib\midi\MidiDefs.PAS', - MidiFile in 'lib\midi\MidiFile.PAS', - midiin in 'lib\midi\midiin.pas', - midiout in 'lib\midi\midiout.pas', - MidiType in 'lib\midi\MidiType.PAS', - {$ENDIF} - - // FFMpeg units - avcodec in 'lib\ffmpeg\avcodec.pas', - avformat in 'lib\ffmpeg\avformat.pas', - avio in 'lib\ffmpeg\avio.pas', - avutil in 'lib\ffmpeg\avutil.pas', - opt in 'lib\ffmpeg\opt.pas', - rational in 'lib\ffmpeg\rational.pas', - - - // Sql Lite - SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', - SQLite3 in 'lib\SQLite\SQLite3.pas', - - - //------------------------------ - //Includes - Menu System - //------------------------------ - - UDisplay in 'Menu\UDisplay.pas', - UDrawTexture in 'Menu\UDrawTexture.pas', - UMenu in 'Menu\UMenu.pas', - UMenuButton in 'Menu\UMenuButton.pas', - UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', - UMenuInteract in 'Menu\UMenuInteract.pas', - UMenuSelect in 'Menu\UMenuSelect.pas', - UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', - UMenuStatic in 'Menu\UMenuStatic.pas', - UMenuText in 'Menu\UMenuText.pas', - - //------------------------------ - //Includes - Classes - //------------------------------ - - {$IFDEF FPC} - ulazjpeg in 'Classes\ulazjpeg.pas', - {$ENDIF} - - TextGL in 'Classes\TextGL.pas', - UCatCovers in 'Classes\UCatCovers.pas', - UCommandLine in 'Classes\UCommandLine.pas', - UCommon in 'Classes\UCommon.pas', - UCovers in 'Classes\UCovers.pas', - UDataBase in 'Classes\UDataBase.pas', - UDLLManager in 'Classes\UDLLManager.pas', - UDraw in 'Classes\UDraw.pas', - UFiles in 'Classes\UFiles.pas', - UGraphic in 'Classes\UGraphic.pas', - UGraphicClasses in 'Classes\UGraphicClasses.pas', - UIni in 'Classes\UIni.pas', - UJoystick in 'Classes\UJoystick.pas', - ULanguage in 'Classes\ULanguage.pas', - ULCD in 'Classes\ULCD.pas', - ULight in 'Classes\ULight.pas', - ULog in 'Classes\ULog.pas', - ULyrics in 'Classes\ULyrics.pas', - ULyrics_bak in 'Classes\ULyrics_bak.pas', - UMain in 'Classes\UMain.pas', - UMusic in 'Classes\UMusic.pas', - UParty in 'Classes\UParty.pas', - UPlaylist in 'Classes\UPlaylist.pas', - URecord in 'Classes\URecord.pas', - USkins in 'Classes\USkins.pas', - USingScores in 'Classes\USingScores.pas', - USongs in 'Classes\USongs.pas', - UTexture in 'Classes\UTexture.pas', - UThemes in 'Classes\UThemes.pas', - UTime in 'Classes\UTime.pas', - USingNotes in 'Classes\USingNotes.pas', - - - //------------------------------ - //Includes - Video Support - //------------------------------ - UVideo in 'Classes\UVideo.pas', - - - //------------------------------ - //Includes - Screens - //------------------------------ - UScreenCredits in 'Screens\UScreenCredits.pas', - UScreenEdit in 'Screens\UScreenEdit.pas', - UScreenEditConvert in 'Screens\UScreenEditConvert.pas', - UScreenEditHeader in 'Screens\UScreenEditHeader.pas', - UScreenEditSub in 'Screens\UScreenEditSub.pas', - UScreenLevel in 'Screens\UScreenLevel.pas', - UScreenLoading in 'Screens\UScreenLoading.pas', - UScreenMain in 'Screens\UScreenMain.pas', - UScreenName in 'Screens\UScreenName.pas', - UScreenOpen in 'Screens\UScreenOpen.pas', - UScreenOptions in 'Screens\UScreenOptions.pas', - UScreenOptionsAdvanced in 'Screens\UScreenOptionsAdvanced.pas', - UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', - UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', - UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', - UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', - UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', - UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', - UScreenPopup in 'Screens\UScreenPopup.pas', - UScreenScore in 'Screens\UScreenScore.pas', - UScreenSing in 'Screens\UScreenSing.pas', - UScreenSong in 'Screens\UScreenSong.pas', - UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', - UScreenSongMenu in 'Screens\UScreenSongMenu.pas', - UScreenStatDetail in 'Screens\UScreenStatDetail.pas', - UScreenStatMain in 'Screens\UScreenStatMain.pas', - UScreenTop5 in 'Screens\UScreenTop5.pas', - UScreenWelcome in 'Screens\UScreenWelcome.pas', - - //------------------------------ - //Includes - Screens PartyMode - //------------------------------ - UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', - UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', - UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', - UScreenPartyScore in 'Screens\UScreenPartyScore.pas', - UScreenPartyWin in 'Screens\UScreenPartyWin.pas', - UScreenSingModi in 'Screens\UScreenSingModi.pas', - - //------------------------------ - //Includes - Modi SDK - //------------------------------ - ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', - - - //------------------------------ - //Includes - Delphi - //------------------------------ - {$IFDEF win32} - Windows, - {$ENDIF} - SysUtils; - -const - Version = 'UltraStar Deluxe V 1.10 Alpha Build'; - -var - WndTitle: string; - hWnd: THandle; - I: Integer; - -begin - WndTitle := Version; - - - {$ifdef Win32} - //------------------------------ - //Start more than One Time Prevention - //------------------------------ - hWnd:= FindWindow(nil, PChar(WndTitle)); - //Programm already started - if (hWnd <> 0) then - begin - I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Contìnue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); - if (I = IDYes) then - begin - I := 1; - repeat - Inc(I); - hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); - until (hWnd = 0); - - WndTitle := WndTitle + ' Instance ' + InttoStr(I); - end - else - Exit; - end; - {$endif} - - //------------------------------ - //StartUp - Create Classes and Load Files - //------------------------------ - USTime := TTime.Create; - - // Commandline Parameter Parser - Params := TCMDParams.Create; - - // Log + Benchmark - Log := TLog.Create; - Log.Title := WndTitle; - Log.Enabled := Not Params.NoLog; - Log.BenchmarkStart(0); - - // Language - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Paths', 'Initialization'); InitializePaths; - Log.LogStatus('Load Language', 'Initialization'); Language := TLanguage.Create; - //Add Const Values: - Language.AddConst('US_VERSION', Version); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Language', 1); - - // SDL - Log.BenchmarkStart(1); - Log.LogStatus('Initialize SDL', 'Initialization'); - SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing SDL', 1); - - // Skin - Log.BenchmarkStart(1); - Log.LogStatus('Loading Skin List', 'Initialization'); Skin := TSkin.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Skin List', 1); - - // Sound Card List - Log.BenchmarkStart(1); - Log.LogStatus('Loading Soundcard list', 'Initialization'); - Recording := TRecord.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Soundcard list', 1); - - // Ini + Paths - Log.BenchmarkStart(1); - Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; - Ini.Load; - - //Load Languagefile - if (Params.Language <> -1) then - Language.ChangeLanguage(ILanguage[Params.Language]) - else - Language.ChangeLanguage(ILanguage[Ini.Language]); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Ini', 1); - - // LCD - Log.BenchmarkStart(1); - Log.LogStatus('Load LCD', 'Initialization'); LCD := TLCD.Create; - if Ini.LPT = 1 then begin -// LCD.HalfInterface := true; - LCD.Enable; - LCD.Clear; - LCD.WriteText(1, ' UltraStar '); - LCD.WriteText(2, ' Loading... '); - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading LCD', 1); - - // Light - Log.BenchmarkStart(1); - Log.LogStatus('Load Light', 'Initialization'); Light := TLight.Create; - if Ini.LPT = 2 then begin - Light.Enable; - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Light', 1); - - // Theme - Log.BenchmarkStart(1); - Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Themes', 1); - - // Covers Cache - Log.BenchmarkStart(1); - Log.LogStatus('Creating Covers Cache', 'Initialization'); Covers := TCovers.Create; - Log.LogBenchmark('Loading Covers Cache Array', 1); - Log.BenchmarkStart(1); - - // Category Covers - Log.BenchmarkStart(1); - Log.LogStatus('Creating Category Covers Array', 'Initialization'); - CatCovers:= TCatCovers.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Category Covers Array', 1); - - // Songs - //Log.BenchmarkStart(1); - Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; - Songs.LoadSongList; - Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Songs', 1); - - // PluginManager - Log.BenchmarkStart(1); - Log.LogStatus('PluginManager', 'Initialization'); - DLLMan := TDLLMan.Create; //Load PluginList - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PluginManager', 1); - - // Party Mode Manager - Log.BenchmarkStart(1); - Log.LogStatus('PartySession Manager', 'Initialization'); - PartySession := TParty_Session.Create; //Load PartySession - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PartySession Manager', 1); - - // Graphics - Log.BenchmarkStart(1); - Log.LogStatus('Initialize 3D', 'Initialization'); Initialize3D(WndTitle); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing 3D', 1); - - // Sound - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Sound', 'Initialization'); - Log.LogStatus('Creating Music', 'InitializeSound'); Music := TMusic.Create; - InitializeSound; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Sound', 1); - - // Score Saving System - Log.BenchmarkStart(1); - Log.LogStatus('DataBase System', 'Initialization'); - DataBase := TDataBaseSystem.Create; - - if (Params.ScoreFile = '') then - DataBase.Init ('Ultrastar.db') - else - DataBase.Init (Params.ScoreFile); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading DataBase System', 1); - - //Playlist Manager - Log.BenchmarkStart(1); - Log.LogStatus('Playlist Manager', 'Initialization'); - PlaylistMan := TPlaylistManager.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Playlist Manager', 1); - - //GoldenStarsTwinkleMod - Log.BenchmarkStart(1); - Log.LogStatus('Effect Manager', 'Initialization'); - GoldenRec := TEffectManager.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Particel System', 1); - - // Joypad - if (Ini.Joypad = 1) OR (Params.Joypad) then begin - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Joystick', 'Initialization'); Joy := TJoy.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Joystick', 1); - end; - - Log.BenchmarkEnd(0); - Log.LogBenchmark('Loading Time', 0); - - - //------------------------------ - //Start- Mainloop - //------------------------------ - //Music.SetLoop(true); - //Music.SetVolume(50); - //Music.Open(SkinPath + 'Menu Music 3.mp3'); - //Music.Play; - Log.LogStatus('Main Loop', 'Initialization'); MainLoop; - - Log.LogStatus('Cleanup', 'Done'); - - //------------------------------ - //Finish Application - //------------------------------ - if Ini.LPT = 1 then LCD.Clear; - if Ini.LPT = 2 then Light.TurnOff; - - // Insignificant change.. - - Log.Free; -end. +program UltraStar; + +{$DEFINE TRANSLATE} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ELSE} + {$R 'UltraStar.res' 'UltraStar.rc'} +{$ENDIF} + +{$I switches.inc} + +uses + + // *************************************************************************** + // + // Developers PLEASE NOTE !!!!!!! + // + // As of september 2007, I am working towards porting Ultrastar-DX to run + // on Linux. I will be modifiying the source to make it compile in lazarus + // on windows & linux and I will make sure that it compiles in delphi still + // To help me in this endevour, please can you make a point of remembering + // that linux is CASE SENSATIVE, and file / unit names must be as per + // the filename exactly. + // + // EG : opengl12.pas must not be OpenGL in the uses cluase. + // + // thanks for your help... + // + // *************************************************************************** + + // Interesting stuff... :) + // http://burningsmell.org/sdl_audioin/ + + + //------------------------------ + //Includes - 3rd Party Libraries + //------------------------------ + + // SDL / OpenGL + moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', + opengl12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\opengl12.pas', + sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', + sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', + sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', + sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', + + + // Bass + {$IFDEF UseBASS} + bass in 'lib\bass\delphi\bass.pas', + {$ENDIF} + + // Midi Units + {$IFDEF UseMIDIPort} + Circbuf in 'lib\midi\CIRCBUF.PAS', + Delphmcb in 'lib\midi\Delphmcb.PAS', + MidiCons in 'lib\midi\MidiCons.PAS', + MidiDefs in 'lib\midi\MidiDefs.PAS', + MidiFile in 'lib\midi\MidiFile.PAS', + midiin in 'lib\midi\midiin.pas', + midiout in 'lib\midi\midiout.pas', + MidiType in 'lib\midi\MidiType.PAS', + {$ENDIF} + + // FFMpeg units + avcodec in 'lib\ffmpeg\avcodec.pas', + avformat in 'lib\ffmpeg\avformat.pas', + avio in 'lib\ffmpeg\avio.pas', + avutil in 'lib\ffmpeg\avutil.pas', + opt in 'lib\ffmpeg\opt.pas', + rational in 'lib\ffmpeg\rational.pas', + + + // Sql Lite + SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', + SQLite3 in 'lib\SQLite\SQLite3.pas', + + + //------------------------------ + //Includes - Menu System + //------------------------------ + + UDisplay in 'Menu\UDisplay.pas', + UDrawTexture in 'Menu\UDrawTexture.pas', + UMenu in 'Menu\UMenu.pas', + UMenuButton in 'Menu\UMenuButton.pas', + UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', + UMenuInteract in 'Menu\UMenuInteract.pas', + UMenuSelect in 'Menu\UMenuSelect.pas', + UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', + UMenuStatic in 'Menu\UMenuStatic.pas', + UMenuText in 'Menu\UMenuText.pas', + + //------------------------------ + //Includes - Classes + //------------------------------ + + {$IFDEF FPC} + ulazjpeg in 'Classes\ulazjpeg.pas', + {$ENDIF} + + TextGL in 'Classes\TextGL.pas', + UCatCovers in 'Classes\UCatCovers.pas', + UCommandLine in 'Classes\UCommandLine.pas', + UCommon in 'Classes\UCommon.pas', + UCovers in 'Classes\UCovers.pas', + UDataBase in 'Classes\UDataBase.pas', + UDLLManager in 'Classes\UDLLManager.pas', + UDraw in 'Classes\UDraw.pas', + UFiles in 'Classes\UFiles.pas', + UGraphic in 'Classes\UGraphic.pas', + UGraphicClasses in 'Classes\UGraphicClasses.pas', + UIni in 'Classes\UIni.pas', + UJoystick in 'Classes\UJoystick.pas', + ULanguage in 'Classes\ULanguage.pas', + ULCD in 'Classes\ULCD.pas', + ULight in 'Classes\ULight.pas', + ULog in 'Classes\ULog.pas', + ULyrics in 'Classes\ULyrics.pas', + ULyrics_bak in 'Classes\ULyrics_bak.pas', + UMain in 'Classes\UMain.pas', + UMusic in 'Classes\UMusic.pas', + UParty in 'Classes\UParty.pas', + UPlaylist in 'Classes\UPlaylist.pas', + URecord in 'Classes\URecord.pas', + USkins in 'Classes\USkins.pas', + USingScores in 'Classes\USingScores.pas', + USongs in 'Classes\USongs.pas', + UTexture in 'Classes\UTexture.pas', + UThemes in 'Classes\UThemes.pas', + UTime in 'Classes\UTime.pas', + USingNotes in 'Classes\USingNotes.pas', + + + //------------------------------ + //Includes - Video Support + //------------------------------ + UVideo in 'Classes\UVideo.pas', + + + //------------------------------ + //Includes - Screens + //------------------------------ + UScreenCredits in 'Screens\UScreenCredits.pas', + UScreenEdit in 'Screens\UScreenEdit.pas', + UScreenEditConvert in 'Screens\UScreenEditConvert.pas', + UScreenEditHeader in 'Screens\UScreenEditHeader.pas', + UScreenEditSub in 'Screens\UScreenEditSub.pas', + UScreenLevel in 'Screens\UScreenLevel.pas', + UScreenLoading in 'Screens\UScreenLoading.pas', + UScreenMain in 'Screens\UScreenMain.pas', + UScreenName in 'Screens\UScreenName.pas', + UScreenOpen in 'Screens\UScreenOpen.pas', + UScreenOptions in 'Screens\UScreenOptions.pas', + UScreenOptionsAdvanced in 'Screens\UScreenOptionsAdvanced.pas', + UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', + UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', + UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', + UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', + UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', + UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', + UScreenPopup in 'Screens\UScreenPopup.pas', + UScreenScore in 'Screens\UScreenScore.pas', + UScreenSing in 'Screens\UScreenSing.pas', + UScreenSong in 'Screens\UScreenSong.pas', + UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', + UScreenSongMenu in 'Screens\UScreenSongMenu.pas', + UScreenStatDetail in 'Screens\UScreenStatDetail.pas', + UScreenStatMain in 'Screens\UScreenStatMain.pas', + UScreenTop5 in 'Screens\UScreenTop5.pas', + UScreenWelcome in 'Screens\UScreenWelcome.pas', + + //------------------------------ + //Includes - Screens PartyMode + //------------------------------ + UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', + UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', + UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', + UScreenPartyScore in 'Screens\UScreenPartyScore.pas', + UScreenPartyWin in 'Screens\UScreenPartyWin.pas', + UScreenSingModi in 'Screens\UScreenSingModi.pas', + + //------------------------------ + //Includes - Modi SDK + //------------------------------ + ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', + + + //------------------------------ + //Includes - Delphi + //------------------------------ + {$IFDEF win32} + Windows, + {$ENDIF} + SysUtils; + +const + Version = 'UltraStar Deluxe V 1.10 Alpha Build'; + +var + WndTitle: string; + hWnd: THandle; + I: Integer; + +begin + WndTitle := Version; + + + {$ifdef Win32} + //------------------------------ + //Start more than One Time Prevention + //------------------------------ + hWnd:= FindWindow(nil, PChar(WndTitle)); + //Programm already started + if (hWnd <> 0) then + begin + I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Contìnue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); + if (I = IDYes) then + begin + I := 1; + repeat + Inc(I); + hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); + until (hWnd = 0); + + WndTitle := WndTitle + ' Instance ' + InttoStr(I); + end + else + Exit; + end; + {$endif} + + //------------------------------ + //StartUp - Create Classes and Load Files + //------------------------------ + USTime := TTime.Create; + + // Commandline Parameter Parser + Params := TCMDParams.Create; + + // Log + Benchmark + Log := TLog.Create; + Log.Title := WndTitle; + Log.Enabled := Not Params.NoLog; + Log.BenchmarkStart(0); + + // Language + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Paths', 'Initialization'); InitializePaths; + Log.LogStatus('Load Language', 'Initialization'); Language := TLanguage.Create; + //Add Const Values: + Language.AddConst('US_VERSION', Version); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Language', 1); + + // SDL + Log.BenchmarkStart(1); + Log.LogStatus('Initialize SDL', 'Initialization'); + SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing SDL', 1); + + // Skin + Log.BenchmarkStart(1); + Log.LogStatus('Loading Skin List', 'Initialization'); Skin := TSkin.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Skin List', 1); + + // Sound Card List + Log.BenchmarkStart(1); + Log.LogStatus('Loading Soundcard list', 'Initialization'); + Recording := TRecord.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Soundcard list', 1); + + // Ini + Paths + Log.BenchmarkStart(1); + Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; + Ini.Load; + + //Load Languagefile + if (Params.Language <> -1) then + Language.ChangeLanguage(ILanguage[Params.Language]) + else + Language.ChangeLanguage(ILanguage[Ini.Language]); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Ini', 1); + + // LCD + Log.BenchmarkStart(1); + Log.LogStatus('Load LCD', 'Initialization'); LCD := TLCD.Create; + if Ini.LPT = 1 then begin +// LCD.HalfInterface := true; + LCD.Enable; + LCD.Clear; + LCD.WriteText(1, ' UltraStar '); + LCD.WriteText(2, ' Loading... '); + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading LCD', 1); + + // Light + Log.BenchmarkStart(1); + Log.LogStatus('Load Light', 'Initialization'); Light := TLight.Create; + if Ini.LPT = 2 then begin + Light.Enable; + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Light', 1); + + // Theme + Log.BenchmarkStart(1); + Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Themes', 1); + + // Covers Cache + Log.BenchmarkStart(1); + Log.LogStatus('Creating Covers Cache', 'Initialization'); Covers := TCovers.Create; + Log.LogBenchmark('Loading Covers Cache Array', 1); + Log.BenchmarkStart(1); + + // Category Covers + Log.BenchmarkStart(1); + Log.LogStatus('Creating Category Covers Array', 'Initialization'); + CatCovers:= TCatCovers.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Category Covers Array', 1); + + // Songs + //Log.BenchmarkStart(1); + Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; + Songs.LoadSongList; + Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Songs', 1); + + // PluginManager + Log.BenchmarkStart(1); + Log.LogStatus('PluginManager', 'Initialization'); + DLLMan := TDLLMan.Create; //Load PluginList + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PluginManager', 1); + + // Party Mode Manager + Log.BenchmarkStart(1); + Log.LogStatus('PartySession Manager', 'Initialization'); + PartySession := TParty_Session.Create; //Load PartySession + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PartySession Manager', 1); + + // Graphics + Log.BenchmarkStart(1); + Log.LogStatus('Initialize 3D', 'Initialization'); Initialize3D(WndTitle); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing 3D', 1); + + // Sound + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Sound', 'Initialization'); + Log.LogStatus('Creating Music', 'InitializeSound'); Music := TMusic.Create; + InitializeSound; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Sound', 1); + + // Score Saving System + Log.BenchmarkStart(1); + Log.LogStatus('DataBase System', 'Initialization'); + DataBase := TDataBaseSystem.Create; + + if (Params.ScoreFile = '') then + DataBase.Init ('Ultrastar.db') + else + DataBase.Init (Params.ScoreFile); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading DataBase System', 1); + + //Playlist Manager + Log.BenchmarkStart(1); + Log.LogStatus('Playlist Manager', 'Initialization'); + PlaylistMan := TPlaylistManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Playlist Manager', 1); + + //GoldenStarsTwinkleMod + Log.BenchmarkStart(1); + Log.LogStatus('Effect Manager', 'Initialization'); + GoldenRec := TEffectManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Particel System', 1); + + // Joypad + if (Ini.Joypad = 1) OR (Params.Joypad) then begin + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Joystick', 'Initialization'); Joy := TJoy.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Joystick', 1); + end; + + Log.BenchmarkEnd(0); + Log.LogBenchmark('Loading Time', 0); + + + //------------------------------ + //Start- Mainloop + //------------------------------ + //Music.SetLoop(true); + //Music.SetVolume(50); + //Music.Open(SkinPath + 'Menu Music 3.mp3'); + //Music.Play; + Log.LogStatus('Main Loop', 'Initialization'); MainLoop; + + Log.LogStatus('Cleanup', 'Done'); + + //------------------------------ + //Finish Application + //------------------------------ + if Ini.LPT = 1 then LCD.Clear; + if Ini.LPT = 2 then Light.TurnOff; + + // Insignificant change.. + + Log.Free; +end. diff --git a/Game/Code/UltraStar.rc b/Game/Code/UltraStar.rc index cc12eb51..4bd9145d 100644 --- a/Game/Code/UltraStar.rc +++ b/Game/Code/UltraStar.rc @@ -1,17 +1,17 @@ -Font TEX "..\Fonts\Normal\eurostar_regular.png" -Font FNT "..\Fonts\Normal\eurostar_regular.dat" +Font TEX "..\Fonts\Normal\eurostar_regular.png" +Font FNT "..\Fonts\Normal\eurostar_regular.dat" -FontB TEX "..\Fonts\Bold\eurostar_regular_bold.png" -FontB FNT "..\Fonts\Bold\eurostar_regular_bold.dat" +FontB TEX "..\Fonts\Bold\eurostar_regular_bold.png" +FontB FNT "..\Fonts\Bold\eurostar_regular_bold.dat" -FontO TEX "..\Fonts\Outline 1\Outline 1.png" -FontO FNT "..\Fonts\Outline 1\Outline 1.dat" +FontO TEX "..\Fonts\Outline 1\Outline 1.png" +FontO FNT "..\Fonts\Outline 1\Outline 1.dat" -FontO2 TEX "..\Fonts\Outline 2\Outline 2.png" -FontO2 FNT "..\Fonts\Outline 2\Outline 2.dat" +FontO2 TEX "..\Fonts\Outline 2\Outline 2.png" +FontO2 FNT "..\Fonts\Outline 2\Outline 2.dat" -MAINICON ICON "..\Graphics\ustar-icon_v01.ico" -//MAINICON ICON "..\Graphics\us.ico" +MAINICON ICON "..\Graphics\ustar-icon_v01.ico" +//MAINICON ICON "..\Graphics\us.ico" CRDTS_BG TEX "..\Graphics\credits_v5_bg.png" CRDTS_OVL TEX "..\Graphics\credits_v5_overlay.png" @@ -35,4 +35,4 @@ INTRO_L08 TEX "..\Graphics\intro-l-08.png" INTRO_L09 TEX "..\Graphics\intro-l-09.png" OUTRO_BG TEX "..\Graphics\outro-bg.png" OUTRO_ESC TEX "..\Graphics\outro-esc.png" -OUTRO_EXD TEX "..\Graphics\outro-exit-dark.png" \ No newline at end of file +OUTRO_EXD TEX "..\Graphics\outro-exit-dark.png" diff --git a/Game/Code/lib/requirements.txt b/Game/Code/lib/requirements.txt index 49aad6ba..e4b14060 100644 --- a/Game/Code/lib/requirements.txt +++ b/Game/Code/lib/requirements.txt @@ -37,3 +37,7 @@ ffmpeg : sqlite : sudo apt-get install libsqlite3-dev + +sdl development libraries : + sudo apt-get install libsdl-ttf2.0-dev + THERE WILL be more of them... oops I forgot to list them :P -- cgit v1.2.3 From ad7420f5a6d81e43bd098ea7c972fd4bc2ca1f26 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 2 Oct 2007 04:48:42 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@461 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 173fbd4c..b18724bf 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -39,7 +39,7 @@ uses OpenGL12, {$IFDEF Win32} - procedure glGenTextures(n: GLsizei; var textures: GLuint); stdcall; external opengl32; +// procedure glGenTextures(n: GLsizei; var textures: GLuint); stdcall; external opengl32; (* {$ELSE} -- cgit v1.2.3 From b50f5d910e081bc1dd6925e84874d97b7de46d9c Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 2 Oct 2007 05:00:37 +0000 Subject: oops AdaptFilePaths was meant to be available to any compiler. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@462 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCommon.pas | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UCommon.pas b/Game/Code/Classes/UCommon.pas index 7337751a..5b911da0 100644 --- a/Game/Code/Classes/UCommon.pas +++ b/Game/Code/Classes/UCommon.pas @@ -32,9 +32,6 @@ type type TWndMethod = procedure(var Message: TMessage) of object; -function StringReplaceW(text, search, rep: WideString):WideString; -function AdaptFilePaths( const aPath : widestring ): widestring; - function LazFindResource( const aName, aType : String ): TLResource; function RandomRange(aMin: Integer; aMax: Integer) : Integer; @@ -45,9 +42,13 @@ function MinValue(const Data: array of Double): Double; {$IFDEF Win32} function AllocateHWnd(Method: TWndMethod): HWND; procedure DeallocateHWnd(Wnd: HWND); -{$ENDIF} +{$ENDIF} // Win32 + +{$ENDIF} // FPC Only + +function StringReplaceW(text, search, rep: WideString):WideString; +function AdaptFilePaths( const aPath : widestring ): widestring; -{$ENDIF} {$IFNDEF win32} (* -- cgit v1.2.3 From 52c0cd1ee199b9ee30adafaa7e034d9e02055278 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 2 Oct 2007 10:18:25 +0000 Subject: fixed bug in StringReplaceW... oops :) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@463 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCommon.pas | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UCommon.pas b/Game/Code/Classes/UCommon.pas index 5b911da0..af9ae82d 100644 --- a/Game/Code/Classes/UCommon.pas +++ b/Game/Code/Classes/UCommon.pas @@ -46,7 +46,7 @@ procedure DeallocateHWnd(Wnd: HWND); {$ENDIF} // FPC Only -function StringReplaceW(text, search, rep: WideString):WideString; +function StringReplaceW(text : WideString; search, rep: WideChar):WideString; function AdaptFilePaths( const aPath : widestring ): widestring; @@ -60,18 +60,30 @@ function AdaptFilePaths( const aPath : widestring ): widestring; implementation -function StringReplaceW(text, search, rep: WideString):WideString; +function StringReplaceW(text : WideString; search, rep: WideChar):WideString; var iPos : integer; - sTemp : WideString; +// sTemp : WideString; begin +(* result := text; iPos := Pos(search, result); while (iPos > 0) do begin - sTEmp := copy(result, iPos + length(search), length(result)); + sTemp := copy(result, iPos + length(search), length(result)); result := copy(result, 1, iPos - 1) + rep + sTEmp; - iPos := Pos(search, result); + iPos := Pos(search, result); + end; +*) + result := text; + + if search = rep then + exit; + + for iPos := 0 to length( result ) - 1 do + begin + if result[ iPos ] = search then + result[ iPos ] := rep; end; end; -- cgit v1.2.3 From f1f9e98eb09722bc8f8b6370331d3bb76fbdda2d Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 3 Oct 2007 11:51:44 +0000 Subject: some cleanup after mogs last commit ;) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@464 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.dpr | 97 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 69 insertions(+), 28 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index cdd4aca4..901bb57b 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -6,32 +6,49 @@ program UltraStar; {$I switches.inc} uses - SDL in 'lib\JEDI-SDLv1.0\SDL\Pas\SDL.pas', + //------------------------------ + //Includes - 3rd Party Libraries + //------------------------------ + SDL in 'lib\JEDI-SDLv1.0\SDL\Pas\SDL.pas', moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', - sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', - sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', - OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas', - sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', - bass in 'lib\bass\delphi\bass.pas', - PNGImage in 'lib\PNGImage\PNGImage.pas', - PNGzLib in 'lib\PNGImage\PNGzLib.pas', - pnglang in 'lib\PNGImage\pnglang.pas', - midiout in 'lib\midi\midiout.pas', - midiin in 'lib\midi\midiin.pas', - CIRCBUF in 'lib\midi\CIRCBUF.PAS', - MidiType in 'lib\midi\MidiType.PAS', - MidiDefs in 'lib\midi\MidiDefs.PAS', - MidiCons in 'lib\midi\MidiCons.PAS', - MidiFile in 'lib\midi\MidiFile.PAS', - Delphmcb in 'lib\midi\Delphmcb.PAS', - avcodec in 'lib\ffmpeg\avcodec.pas', - avformat in 'lib\ffmpeg\avformat.pas', - avutil in 'lib\ffmpeg\avutil.pas', - rational in 'lib\ffmpeg\rational.pas', - opt in 'lib\ffmpeg\opt.pas', - avio in 'lib\ffmpeg\avio.pas', + sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', + SDL_Image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', + OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas', + + bass in 'lib\bass\delphi\bass.pas', + + PNGImage in 'lib\PNGImage\PNGImage.pas', + PNGzLib in 'lib\PNGImage\PNGzLib.pas', + pnglang in 'lib\PNGImage\pnglang.pas', + + midiout in 'lib\midi\midiout.pas', + midiin in 'lib\midi\midiin.pas', + Circbuf in 'lib\midi\CIRCBUF.PAS', + MidiType in 'lib\midi\MidiType.PAS', + MidiDefs in 'lib\midi\MidiDefs.PAS', + MidiCons in 'lib\midi\MidiCons.PAS', + MidiFile in 'lib\midi\MidiFile.PAS', + Delphmcb in 'lib\midi\Delphmcb.PAS', + + {$IFDEF UseSerialPort} + zlportio in 'lib\zlportio\zlportio.pas', + ddkint in 'lib\zlportio\ddkint.pas', + {$ENDIF} + + avcodec in 'lib\ffmpeg\avcodec.pas', + avformat in 'lib\ffmpeg\avformat.pas', + avutil in 'lib\ffmpeg\avutil.pas', + rational in 'lib\ffmpeg\rational.pas', + opt in 'lib\ffmpeg\opt.pas', + avio in 'lib\ffmpeg\avio.pas', + SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', - SQLite3 in 'lib\SQLite\SQLite3.pas', + SQLite3 in 'lib\SQLite\SQLite3.pas', + + + //------------------------------ + //Includes - Menu System + //------------------------------ UDisplay in 'Menu\UDisplay.pas', UMenu in 'Menu\UMenu.pas', UMenuStatic in 'Menu\UMenuStatic.pas', @@ -42,6 +59,10 @@ uses UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', UDrawTexture in 'Menu\UDrawTexture.pas', UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', + + //------------------------------ + //Includes - Classes + //------------------------------ UCommon in 'Classes\UCommon.pas', UGraphic in 'Classes\UGraphic.pas', UTexture in 'Classes\UTexture.pas', @@ -70,10 +91,19 @@ uses UDLLManager in 'Classes\UDLLManager.pas', UParty in 'Classes\UParty.pas', UPlaylist in 'Classes\UPlaylist.pas', - UCommandLine in 'Classes\UCommandLine.pas', + UCommandLine in 'Classes\UCommandLine.pas', + UTextClasses in 'Classes\UTextClasses.pas', USingScores in 'Classes\USingScores.pas', USingNotes in 'Classes\USingNotes.pas', + + //------------------------------ + //Includes - Video Support + //------------------------------ UVideo in 'Classes\UVideo.pas', + + //------------------------------ + //Includes - Screens + //------------------------------ UScreenLoading in 'Screens\UScreenLoading.pas', UScreenWelcome in 'Screens\UScreenWelcome.pas', UScreenMain in 'Screens\UScreenMain.pas', @@ -102,16 +132,27 @@ uses UScreenStatDetail in 'Screens\UScreenStatDetail.pas', UScreenCredits in 'Screens\UScreenCredits.pas', UScreenPopup in 'Screens\UScreenPopup.pas', + + //------------------------------ + //Includes - Screens PartyMode + //------------------------------ UScreenSingModi in 'Screens\UScreenSingModi.pas', UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', UScreenPartyScore in 'Screens\UScreenPartyScore.pas', UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', UScreenPartyWin in 'Screens\UScreenPartyWin.pas', + + //------------------------------ + //Includes - Modi SDK + //------------------------------ ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', + + //------------------------------ + //Includes - Delphi + //------------------------------ Windows, - SysUtils, - UTextClasses in 'Classes\UTextClasses.pas'; + SysUtils; const Version = 'UltraStar Deluxe V 1.10 Alpha Build'; @@ -350,4 +391,4 @@ begin Log.Free; -end. +end. \ No newline at end of file -- cgit v1.2.3 From 2e7eca65cf05d8090ef58381d576d5218edd9654 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 3 Oct 2007 12:00:09 +0000 Subject: Some more clean up because of my last commit 0o git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@465 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.dpr | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 901bb57b..ea1ccdf4 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -12,8 +12,9 @@ uses SDL in 'lib\JEDI-SDLv1.0\SDL\Pas\SDL.pas', moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', - SDL_Image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', + sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas', + sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', bass in 'lib\bass\delphi\bass.pas', -- cgit v1.2.3 From fdb75fa47dd72522b705e94be5a201c4e1a731cb Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 3 Oct 2007 12:43:01 +0000 Subject: New plugin SDK added Some more debug information for windows builds (Does this work in lazarus?) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@466 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/ULog.pas | 16 ++- Game/Code/Classes/UPluginInterface.pas | 179 +++++++++++++++++++++++++++++++++ Game/Code/UltraStar.dpr | 10 ++ Game/Code/switches.inc | 29 +++--- 4 files changed, 217 insertions(+), 17 deletions(-) create mode 100644 Game/Code/Classes/UPluginInterface.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index 7c93c6e9..7e464b57 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -188,6 +188,11 @@ begin FileErrorO := false; end; end; + {$DEFINE DEBUG} //How can i check if this is set in *.dpr file o0 + //If Debug => Write to Console Output + {$IFDEF DEBUG} + WriteLn('Error: ' + Text); + {$ENDIF} end; procedure TLog.LogVoice(SoundNr: integer); @@ -219,10 +224,13 @@ end; procedure TLog.LogStatus(Log1, Log2: string); begin //Just for Debugging - //Comment for Release - //LogAnalyze (Log2 + ': ' + Log1); - - LogError(Log2 + ': ' + Log1); + //Comment for Release + //LogError(Log2 + ': ' + Log1); + + //If Debug => Write to Console Output + {$IFDEF DEBUG} + WriteLn(Log2 + ': ' + Log1); + {$ENDIF} end; procedure TLog.LogError(Log1, Log2: string); diff --git a/Game/Code/Classes/UPluginInterface.pas b/Game/Code/Classes/UPluginInterface.pas new file mode 100644 index 00000000..6d17d51d --- /dev/null +++ b/Game/Code/Classes/UPluginInterface.pas @@ -0,0 +1,179 @@ +unit uPluginInterface; +{********************* + uPluginInterface + Unit fills a TPluginInterface Structur with Method Pointers + Unit Contains all Functions called directly by Plugins +*********************} + +interface +uses uPluginDefs; + +//--------------- +// Procedure that Sets the PluginInterface Record +//--------------- + Procedure Init_PluginInterface; + +//--------------- +// Methods for Plugin +//--------------- + {******** Hook specific Methods ********} + {Function Creates a new Hookable Event and Returns the Handle + or 0 on Failure. (Name already exists)} + Function CreateHookableEvent (EventName: PChar): THandle; stdcall; + + {Function Destroys an Event and Unhooks all Hooks to this Event. + 0 on success, not 0 on Failure} + Function DestroyHookableEvent (hEvent: THandle): integer; stdcall; + + {Function start calling the Hook Chain + 0 if Chain is called until the End, -1 if Event Handle is not valid + otherwise Return Value of the Hook that breaks the Chain} + Function NotivyEventHooks (hEvent: THandle; wParam, lParam: dWord): integer; stdcall; + + {Function Hooks an Event by Name. + Returns Hook Handle on Success, otherwise 0} + Function HookEvent (EventName: PChar; HookProc: TUS_Hook): THandle; stdcall; + + {Function Removes the Hook from the Chain + Returns 0 on Success} + Function UnHookEvent (hHook: THandle): Integer; stdcall; + + {Function Returns Non Zero if a Event with the given Name Exists, + otherwise 0} + Function EventExists (EventName: PChar): Integer; stdcall; + + {******** Service specific Methods ********} + {Function Creates a new Service and Returns the Services Handle + or 0 on Failure. (Name already exists)} + Function CreateService (ServiceName: PChar; ServiceProc: TUS_Service): THandle; stdcall; + + {Function Destroys a Service. + 0 on success, not 0 on Failure} + Function DestroyService (hService: THandle): integer; stdcall; + + {Function Calls a Services Proc + Returns Services Return Value or SERVICE_NOT_FOUND on Failure} + Function CallService (ServiceName: PChar; wParam, lParam: dWord): integer; stdcall; + + {Function Returns Non Zero if a Service with the given Name Exists, + otherwise 0} + Function ServiceExists (ServiceName: PChar): Integer; stdcall; + +var + PluginInterface: TUS_PluginInterface; + +implementation + +//--------------- +// Procedure that Sets the PluginInterface Record +//--------------- +Procedure Init_PluginInterface; +begin + PluginInterface.CreateHookableEvent := CreateHookableEvent; + PluginInterface.DestroyHookableEvent := DestroyHookableEvent; + PluginInterface.NotivyEventHooks := NotivyEventHooks; + PluginInterface.HookEvent := HookEvent; + PluginInterface.UnHookEvent := UnHookEvent; + PluginInterface.EventExists := EventExists; + + PluginInterface.CreateService := CreateService; + PluginInterface.DestroyService := DestroyService; + PluginInterface.CallService := CallService; + PluginInterface.ServiceExists := ServiceExists; +end; + + +{******** Hook specific Methods ********} +//--------------- +// Function Creates a new Hookable Event and Returns the Handle +// or 0 on Failure. (Name already exists) +//--------------- +Function CreateHookableEvent (EventName: PChar): THandle; stdcall; +begin + +end; + +//--------------- +// Function Destroys an Event and Unhooks all Hooks to this Event. +// 0 on success, not 0 on Failure +//--------------- +Function DestroyHookableEvent (hEvent: THandle): integer; stdcall; +begin + +end; + +//--------------- +// Function start calling the Hook Chain +// 0 if Chain is called until the End, -1 if Event Handle is not valid +// otherwise Return Value of the Hook that breaks the Chain +//--------------- +Function NotivyEventHooks (hEvent: THandle; wParam, lParam: dWord): integer; stdcall; +begin + +end; + +//--------------- +// Function Hooks an Event by Name. +// Returns Hook Handle on Success, otherwise 0 +//--------------- +Function HookEvent (EventName: PChar; HookProc: TUS_Hook): THandle; stdcall; +begin + +end; + +//--------------- +// Function Removes the Hook from the Chain +// Returns 0 on Success +//--------------- +Function UnHookEvent (hHook: THandle): Integer; stdcall; +begin + +end; + +//--------------- +// Function Returns Non Zero if a Event with the given Name Exists, +// otherwise 0 +//--------------- +Function EventExists (EventName: PChar): Integer; stdcall; +begin + +end; + + {******** Service specific Methods ********} +//--------------- +// Function Creates a new Service and Returns the Services Handle +// or 0 on Failure. (Name already exists) +//--------------- +Function CreateService (ServiceName: PChar; ServiceProc: TUS_Service): THandle; stdcall; +begin + +end; + +//--------------- +// Function Destroys a Service. +// 0 on success, not 0 on Failure +//--------------- +Function DestroyService (hService: THandle): integer; stdcall; +begin + +end; + +//--------------- +// Function Calls a Services Proc +// Returns Services Return Value or SERVICE_NOT_FOUND on Failure +//--------------- +Function CallService (ServiceName: PChar; wParam, lParam: dWord): integer; stdcall; +begin + +end; + +//--------------- +// Function Returns Non Zero if a Service with the given Name Exists, +// otherwise 0 +//--------------- +Function ServiceExists (ServiceName: PChar): Integer; stdcall; +begin + +end; + +end. diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index ea1ccdf4..b9fa0530 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -1,6 +1,7 @@ program UltraStar; {$DEFINE TRANSLATE} +{$DEFINE DEBUG} //Remove b4 release {$R 'UltraStar.res' 'UltraStar.rc'} {$I switches.inc} @@ -97,6 +98,14 @@ uses USingScores in 'Classes\USingScores.pas', USingNotes in 'Classes\USingNotes.pas', + //New Plugin and Core Management + {ULists in 'Classes\ULists.pas', //maybe drop this + UHooks in 'Classes\UHooks.pas', //80 % - Whiteshark is about to work on this + UServices in 'Classes\UServices.pas', //20 % - Whiteshark is about to work on this + UCore in 'Classes\UCore.pas', + UCoreModule in 'Classes\UCoreModule.pas', } + UPluginInterface in 'Classes\UPluginInterface.pas', //Some changes to work with unwriten classes, need to be done + //------------------------------ //Includes - Video Support //------------------------------ @@ -148,6 +157,7 @@ uses //Includes - Modi SDK //------------------------------ ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', + UPluginDefs in '..\..\Modis\SDK\UPluginDefs.pas', //New Plugin SDK //------------------------------ //Includes - Delphi diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index a895712a..fda3cd75 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -1,13 +1,16 @@ -{$IFDEF FPC} - {$UNDEF UseSerialPort} - {$UNDEF UseMIDIPort} -{$ELSE} - {$UNDEF UseSerialPort} - {$DEFINE UseMIDIPort} -{$ENDIF} - -{$IFDEF win32} - {$DEFINE UseBASS} -{$ELSE} - {$UNDEF UseBASS} -{$ENDIF} +{$IFDEF FPC} + {$UNDEF UseSerialPort} + {$UNDEF UseMIDIPort} +{$ELSE} + {$DEFINE UseSerialPort} + {$DEFINE UseMIDIPort} +{$ENDIF} + +{$IFDEF win32} + {$DEFINE UseBASS} + {$IFDEF DEBUG} + {$APPTYPE CONSOLE} + {$ENDIF} +{$ELSE} + {$UNDEF UseBASS} +{$ENDIF} \ No newline at end of file -- cgit v1.2.3 From b9263037c17ed6caa573478d4bf86dcc83026660 Mon Sep 17 00:00:00 2001 From: mogguh Date: Wed, 3 Oct 2007 15:17:19 +0000 Subject: Actually just a test if the new CIA filtering works git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@467 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTextClasses.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTextClasses.pas b/Game/Code/Classes/UTextClasses.pas index 5f66d0e8..5a0655e5 100644 --- a/Game/Code/Classes/UTextClasses.pas +++ b/Game/Code/Classes/UTextClasses.pas @@ -25,7 +25,7 @@ type deconstructor procedure ReleaseTextures(); end; -// okay, we now need the stuff that's even beneath this glyph - we're right at the birth of text in here :P +// (2) okay, we now need the stuff that's even beneath this glyph - we're right at the birth of text in here :P GlyphTexture = record textureID : GLuint; // we need this for caching the letters, if the texture wasn't created before create it, should be very fast because of this one -- cgit v1.2.3 From 979d59410f1625a4943a8a84e0f204465800453f Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 8 Oct 2007 00:19:58 +0000 Subject: fixed some stuff for linux build... now its getting close to the look of the windows build... YAY ! see http://www.flickr.com/photos/31428768@N00/sets/72157602234125005/ git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@468 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 36 +- Game/Code/Classes/UVideo.pas | 866 +++++------ Game/Code/Screens/UScreenCredits.pas | 2659 ++++++++++++++++++---------------- Game/Code/lib/ffmpeg/avformat.pas | 2 +- 4 files changed, 1879 insertions(+), 1684 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index b18724bf..5ef29316 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -37,22 +37,6 @@ uses OpenGL12, sdlutils, SDL_Image; - - {$IFDEF Win32} -// procedure glGenTextures(n: GLsizei; var textures: GLuint); stdcall; external opengl32; - -(* - {$ELSE} - {$ifdef darwin} - const opengl32 = '/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib'; - {$ELSE} - const opengl32 = 'libGL.so' ; // YES Capital GL - {$ENDIF} - - procedure glGenTextures(n: GLsizei; var textures: PGLuint); stdcall; external opengl32; -*) - {$ENDIF} - type TTexture = record TexNum: integer; @@ -525,6 +509,7 @@ begin // load texture data into memory {$ifdef blindydebug} + Log.LogStatus('',' ----------------------------------------------------'); Log.LogStatus('',' LoadImage('''+Identifier+''') (called by '+Format+')'); {$endif} TexSurface := LoadImage(Identifier); @@ -537,6 +522,7 @@ begin beep; Exit; end; + // convert pixel format as needed {$ifdef blindydebug} Log.LogStatus('',' AdjustPixelFormat'); @@ -567,7 +553,7 @@ begin end; {$ifdef blindydebug} - Log.LogStatus('',' JB-1'); + Log.LogStatus('',' JB-1 : typ='+Typ); {$endif} @@ -577,6 +563,10 @@ begin // cover cache stuff if (CreateCacheMipmap) and (Typ='Plain') then begin + {$ifdef blindydebug} + Log.LogStatus('',' JB-1 : Minimap'); + {$endif} + if (Covers.W <= 256) and (Covers.H <= 256) then begin {$ifdef blindydebug} @@ -645,10 +635,10 @@ begin // prepare OpenGL texture // JB_linux : this is causing AV's on linux... ActText seems to be nil ! - {$IFnDEF win32} - if pointer(ActTex) = nil then - exit; - {$endif} +// {$IFnDEF win32} +// if pointer(ActTex) = nil then +// exit; +// {$endif} glGenTextures(1, @ActTex); @@ -658,7 +648,9 @@ begin glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); // load data into gl texture - if (Typ = 'Transparent') or (Typ='Colorized') then begin + if (Typ = 'Transparent') or + (Typ='Colorized') then + begin glTexImage2D(GL_TEXTURE_2D, 0, 4, newWidth, newHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, TexSurface.pixels); end {if Typ = 'Plain' then} else diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index 290db271..b2ba01dc 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -1,404 +1,462 @@ -{############################################################################ -# FFmpeg support for UltraStar deluxe # -# # -# Created by b1indy # -# based on 'An ffmpeg and SDL Tutorial' (http://www.dranger.com/ffmpeg/) # -#############################################################################} - -//{$define DebugDisplay} // uncomment if u want to see the debug stuff -//{$define DebugFrames} -//{$define Info} - - -unit UVideo; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - -uses SDL, - UGraphicClasses, - textgl, - avcodec, - avformat, - avutil, - math, - OpenGL12, - SysUtils, - {$ifdef DebugDisplay} - dialogs, - {$ENDIF} - UIni; - -procedure Init; -procedure FFmpegOpenFile(FileName: pAnsiChar); -procedure FFmpegClose; -procedure FFmpegGetFrame(Time: Extended); -procedure FFmpegDrawGL(Screen: integer); -procedure FFmpegTogglePause; -procedure FFmpegSkip(Time: Single); - -var - VideoOpened, VideoPaused: Boolean; - VideoFormatContext: PAVFormatContext; - VideoStreamIndex: Integer; - VideoCodecContext: PAVCodecContext; - VideoCodec: PAVCodec; - AVFrame: PAVFrame; - AVFrameRGB: PAVFrame; - myBuffer: pByte; - VideoTex: glUint; - TexX, TexY, dataX, dataY: Cardinal; - TexData: array of Byte; - ScaledVideoWidth, ScaledVideoHeight: Real; - VideoAspect: Real; - VideoTextureU, VideoTextureV: Real; - VideoTimeBase, VideoTime, LastFrameTime, TimeDifference: Extended; - VideoSkipTime: Single; - -implementation - -procedure Init; -begin - av_register_all; - VideoOpened:=False; - VideoPaused:=False; - glGenTextures(1, PglUint(@VideoTex)); - SetLength(TexData,0); -end; - -procedure FFmpegOpenFile(FileName: pAnsiChar); -var errnum, i, x,y: Integer; -begin - VideoOpened:=False; - VideoPaused:=False; - VideoTimeBase:=0; - VideoTime:=0; - LastFrameTime:=0; - TimeDifference:=0; - errnum:=av_open_input_file(VideoFormatContext, FileName, Nil, 0, Nil); - if(errnum <> 0) - then begin -{$ifdef DebugDisplay} - case errnum of - AVERROR_UNKNOWN: showmessage('failed to open file '+Filename+#13#10+'AVERROR_UNKNOWN'); - AVERROR_IO: showmessage('failed to open file '+Filename+#13#10+'AVERROR_IO'); - AVERROR_NUMEXPECTED: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NUMEXPECTED'); - AVERROR_INVALIDDATA: showmessage('failed to open file '+Filename+#13#10+'AVERROR_INVALIDDATA'); - AVERROR_NOMEM: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NOMEM'); - AVERROR_NOFMT: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NOFMT'); - AVERROR_NOTSUPP: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NOTSUPP'); - else showmessage('failed to open file '+Filename+#13#10+'Error number: '+inttostr(Errnum)); - end; -{$ENDIF} - Exit; - end - else begin - VideoStreamIndex:=-1; - if(av_find_stream_info(VideoFormatContext)>=0) then - begin - for i:=0 to VideoFormatContext^.nb_streams-1 do - if(VideoFormatContext^.streams[i]^.codec^.codec_type=CODEC_TYPE_VIDEO) then begin - VideoStreamIndex:=i; - end else - end; - if(VideoStreamIndex >= 0) then - begin - VideoCodecContext:=VideoFormatContext^.streams[VideoStreamIndex]^.codec; - VideoCodec:=avcodec_find_decoder(VideoCodecContext^.codec_id); - end else begin -{$ifdef DebugDisplay} - showmessage('found no video stream'); -{$ENDIF} - av_close_input_file(VideoFormatContext); - Exit; - end; - if(VideoCodec<>Nil) then - begin - errnum:=avcodec_open(VideoCodecContext, VideoCodec); - end else begin -{$ifdef DebugDisplay} - showmessage('no matching codec found'); -{$ENDIF} - avcodec_close(VideoCodecContext); - av_close_input_file(VideoFormatContext); - Exit; - end; - if(errnum >=0) then - begin -{$ifdef DebugDisplay} - showmessage('Found a matching Codec:'+#13#10#13#10+ - 'Width='+inttostr(VideoCodecContext^.width)+ - ', Height='+inttostr(VideoCodecContext^.height)+#13#10+ - 'Aspect: '+inttostr(VideoCodecContext^.sample_aspect_ratio.num)+'/'+inttostr(VideoCodecContext^.sample_aspect_ratio.den)+#13#10+ - 'Framerate: '+inttostr(VideoCodecContext^.time_base.num)+'/'+inttostr(VideoCodecContext^.time_base.den)); -{$endif} - // allocate space for decoded frame and rgb frame - AVFrame:=avcodec_alloc_frame; - AVFrameRGB:=avcodec_alloc_frame; - end; - myBuffer:=Nil; - if(AVFrame <> Nil) and (AVFrameRGB <> Nil) then - begin - myBuffer:=av_malloc(avpicture_get_size(PIX_FMT_RGB24, VideoCodecContext^.width, - VideoCodecContext^.height)); - end; - if myBuffer <> Nil then errnum:=avpicture_fill(PAVPicture(AVFrameRGB), myBuffer, PIX_FMT_RGB24, - VideoCodecContext^.width, VideoCodecContext^.height) - else begin -{$ifdef DebugDisplay} - showmessage('failed to allocate video buffer'); -{$endif} - av_free(AVFrameRGB); - av_free(AVFrame); - avcodec_close(VideoCodecContext); - av_close_input_file(VideoFormatContext); - Exit; - end; - if errnum >=0 then - begin - VideoOpened:=True; - - TexX := VideoCodecContext^.width; - TexY := VideoCodecContext^.height; - dataX := Round(Power(2, Ceil(Log2(TexX)))); - dataY := Round(Power(2, Ceil(Log2(TexY)))); - SetLength(TexData,dataX*dataY*3); - // calculate some information for video display - VideoAspect:=VideoCodecContext^.sample_aspect_ratio.num/VideoCodecContext^.sample_aspect_ratio.den; - if (VideoAspect = 0) then - VideoAspect:=VideoCodecContext^.width/VideoCodecContext^.height - else - VideoAspect:=VideoAspect*VideoCodecContext^.width/VideoCodecContext^.height; - if VideoAspect >= 4/3 then - begin - ScaledVideoWidth:=800.0; - ScaledVideoHeight:=800.0/VideoAspect; - end else - begin - ScaledVideoHeight:=600.0; - ScaledVideoWidth:=600.0*VideoAspect; - end; - VideoTimeBase:=VideoCodecContext^.time_base.num/VideoCodecContext^.time_base.den; - // hack to get reasonable timebase for divx -{$ifdef DebugDisplay} - showmessage('framerate: '+inttostr(floor(1/videotimebase))+'fps'); -{$endif} - if VideoTimeBase < 0.02 then // 0.02 <-> 50 fps - begin - VideoTimeBase:=VideoCodecContext^.time_base.den/VideoCodecContext^.time_base.num; - while VideoTimeBase > 50 do VideoTimeBase:=VideoTimeBase/10; - VideoTimeBase:=1/VideoTimeBase; - end; -{$ifdef DebugDisplay} - showmessage('corrected framerate: '+inttostr(floor(1/videotimebase))+'fps'); - if ((VideoAspect*VideoCodecContext^.width*VideoCodecContext^.height)>200000) then - showmessage('you are trying to play a rather large video'+#13#10+ - 'be prepared to experience some timing problems'); -{$endif} - end; - end; -end; - -procedure FFmpegClose; -begin - if VideoOpened then begin - av_free(myBuffer); - av_free(AVFrameRGB); - av_free(AVFrame); - avcodec_close(VideoCodecContext); - av_close_input_file(VideoFormatContext); - SetLength(TexData,0); - VideoOpened:=False; - end; -end; - -procedure FFmpegTogglePause; -begin - if VideoPaused then VideoPaused:=False - else VideoPaused:=True; -end; - -procedure FFmpegSkip(Time: Single); -begin - VideoSkiptime:=Time; - if VideoSkipTime > 0 then begin - av_seek_frame(VideoFormatContext,-1,Floor((VideoSkipTime)*1500000),0); - VideoTime:=VideoSkipTime; - end; -end; - -procedure FFmpegGetFrame(Time: Extended); -var - FrameFinished: Integer; - AVPacket: TAVPacket; - errnum, x, y: Integer; - FrameDataPtr: PByteArray; - linesize: integer; - myTime: Extended; - DropFrame: Boolean; - droppedFrames: Integer; -const - FRAMEDROPCOUNT=3; -begin - if not VideoOpened then Exit; - if VideoPaused then Exit; - myTime:=Time+VideoSkipTime; - TimeDifference:=myTime-VideoTime; - DropFrame:=False; -{ showmessage('Time: '+inttostr(floor(Time*1000))+#13#10+ - 'VideoTime: '+inttostr(floor(VideoTime*1000))+#13#10+ - 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ - 'TimeDiff: '+inttostr(floor(TimeDifference*1000))); -} - if (VideoTime <> 0) and (TimeDifference <= VideoTimeBase) then begin -{$ifdef DebugFrames} - // frame delay debug display - GoldenRec.Spawn(200,15,1,16,0,-1,ColoredStar,$00ff00); -{$endif} -{ showmessage('not getting new frame'+#13#10+ - 'Time: '+inttostr(floor(Time*1000))+#13#10+ - 'VideoTime: '+inttostr(floor(VideoTime*1000))+#13#10+ - 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ - 'TimeDiff: '+inttostr(floor(TimeDifference*1000))); -} - Exit;// we don't need a new frame now - end; - VideoTime:=VideoTime+VideoTimeBase; - TimeDifference:=myTime-VideoTime; - if TimeDifference >= (FRAMEDROPCOUNT-1)*VideoTimeBase then begin // skip frames -{$ifdef DebugFrames} - //frame drop debug display - GoldenRec.Spawn(200,55,1,16,0,-1,ColoredStar,$ff0000); -{$endif} -// showmessage('skipping frames'+#13#10+ -// 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ -// 'TimeDiff: '+inttostr(floor(TimeDifference*1000))+#13#10+ -// 'Time2Skip: '+inttostr(floor((Time-LastFrameTime)*1000))); -// av_seek_frame(VideoFormatContext,VideoStreamIndex,Floor(Time*VideoTimeBase),0); -{ av_seek_frame(VideoFormatContext,-1,Floor((myTime+VideoTimeBase)*1500000),0); - VideoTime:=floor(myTime/VideoTimeBase)*VideoTimeBase;} - VideoTime:=VideoTime+FRAMEDROPCOUNT*VideoTimeBase; - DropFrame:=True; - end; - - av_init_packet(@AVPacket); - FrameFinished:=0; - // read packets until we have a finished frame (or there are no more packets) - while (FrameFinished=0) and (av_read_frame(VideoFormatContext, @AVPacket)>=0) do - begin - // if we got a packet from the video stream, then decode it - if (AVPacket.stream_index=VideoStreamIndex) then - errnum:=avcodec_decode_video(VideoCodecContext, AVFrame, @frameFinished, - AVPacket.data, AVPacket.size); - // release internal packet structure created by av_read_frame - av_free_packet(PAVPacket(@AVPacket)); - end; - if DropFrame then - for droppedFrames:=1 to FRAMEDROPCOUNT do begin - FrameFinished:=0; - // read packets until we have a finished frame (or there are no more packets) - while (FrameFinished=0) and (av_read_frame(VideoFormatContext, @AVPacket)>=0) do - begin - // if we got a packet from the video stream, then decode it - if (AVPacket.stream_index=VideoStreamIndex) then - errnum:=avcodec_decode_video(VideoCodecContext, AVFrame, @frameFinished, - AVPacket.data, AVPacket.size); - // release internal packet structure created by av_read_frame - av_free_packet(PAVPacket(@AVPacket)); - end; - end; - - // if we did not get an new frame, there's nothing more to do - if Framefinished=0 then begin - GoldenRec.Spawn(220,15,1,16,0,-1,ColoredStar,$0000ff); - Exit; - end; - // otherwise we convert the pixeldata from YUV to RGB - errnum:=img_convert(PAVPicture(AVFrameRGB), PIX_FMT_RGB24, - PAVPicture(AVFrame), VideoCodecContext^.pix_fmt, - VideoCodecContext^.width, VideoCodecContext^.height); -//errnum:=1; - if errnum >=0 then begin - // copy RGB pixeldata to our TextureBuffer - // (line by line) - FrameDataPtr:=AVFrameRGB^.data[0]; - linesize:=AVFrameRGB^.linesize[0]; - for y:=0 to TexY-1 do begin - System.Move(FrameDataPtr[y*linesize],TexData[3*y*dataX],linesize); - end; - - // generate opengl texture out of whatever we got - glBindTexture(GL_TEXTURE_2D, VideoTex); - glTexImage2D(GL_TEXTURE_2D, 0, 3, dataX, dataY, 0, GL_RGB, GL_UNSIGNED_BYTE, TexData); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); -{$ifdef DebugFrames} - //frame decode debug display - GoldenRec.Spawn(200,35,1,16,0,-1,ColoredStar,$ffff00); -{$endif} - - end; -end; - -procedure FFmpegDrawGL(Screen: integer); -begin - // have a nice black background to draw on (even if there were errors opening the vid) - if Screen=1 then begin - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - end; - // exit if there's nothing to draw - if not VideoOpened then Exit; - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, VideoTex); - glbegin(gl_quads); - glTexCoord2f( 0, 0); glVertex2f(400-ScaledVideoWidth/2, 300-ScaledVideoHeight/2); - glTexCoord2f( 0, TexY/dataY); glVertex2f(400-ScaledVideoWidth/2, 300+ScaledVideoHeight/2); - glTexCoord2f(TexX/dataX, TexY/dataY); glVertex2f(400+ScaledVideoWidth/2, 300+ScaledVideoHeight/2); - glTexCoord2f(TexX/dataX, 0); glVertex2f(400+ScaledVideoWidth/2, 300-ScaledVideoHeight/2); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - -{$ifdef Info} - if VideoSkipTime+VideoTime+VideoTimeBase < 0 then begin - glColor4f(0.7, 1, 0.3, 1); - SetFontStyle (1); - SetFontItalic(False); - SetFontSize(9); - SetFontPos (300, 0); - glPrint('Delay due to negative VideoGap'); - glColor4f(1, 1, 1, 1); - end; -{$endif} - -{$ifdef DebugFrames} - glColor4f(0, 0, 0, 0.2); - glbegin(gl_quads); - glVertex2f(0, 0); - glVertex2f(0, 70); - glVertex2f(250, 70); - glVertex2f(250, 0); - glEnd; - - glColor4f(1,1,1,1); - SetFontStyle (1); - SetFontItalic(False); - SetFontSize(9); - SetFontPos (5, 0); - glPrint('delaying frame'); - SetFontPos (5, 20); - glPrint('fetching frame'); - SetFontPos (5, 40); - glPrint('dropping frame'); -{$endif} -end; - -end. +{############################################################################ +# FFmpeg support for UltraStar deluxe # +# # +# Created by b1indy # +# based on 'An ffmpeg and SDL Tutorial' (http://www.dranger.com/ffmpeg/) # +#############################################################################} + +//{$define DebugDisplay} // uncomment if u want to see the debug stuff +//{$define DebugFrames} +//{$define Info} + + +unit UVideo; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +uses SDL, + UGraphicClasses, + textgl, + avcodec, + avformat, + avutil, + math, + OpenGL12, + SysUtils, + {$ifdef DebugDisplay} + {$ifdef win32} + dialogs, + {$endif} + {$ENDIF} + UIni; + +procedure Init; +procedure FFmpegOpenFile(FileName: pAnsiChar); +procedure FFmpegClose; +procedure FFmpegGetFrame(Time: Extended); +procedure FFmpegDrawGL(Screen: integer); +procedure FFmpegTogglePause; +procedure FFmpegSkip(Time: Single); + +var + VideoOpened, VideoPaused: Boolean; + VideoFormatContext: PAVFormatContext; + VideoStreamIndex: Integer; + VideoCodecContext: PAVCodecContext; + VideoCodec: PAVCodec; + AVFrame: PAVFrame; + AVFrameRGB: PAVFrame; + myBuffer: pByte; + VideoTex: glUint; + TexX, TexY, dataX, dataY: Cardinal; + TexData: array of Byte; + ScaledVideoWidth, ScaledVideoHeight: Real; + VideoAspect: Real; + VideoTextureU, VideoTextureV: Real; + VideoTimeBase, VideoTime, LastFrameTime, TimeDifference: Extended; + VideoSkipTime: Single; + +implementation + +{$ifdef DebugDisplay} +{$ifNdef win32} + +procedure showmessage( aMessage : String ); +begin + writeln( aMessage ); +end; + +{$endif} +{$ENDIF} + +procedure Init; +begin + av_register_all; + {$ifdef DebugDisplay} + showmessage( 'AV_Register_ALL' ); + {$endif} + + VideoOpened:=False; + VideoPaused:=False; + + glGenTextures(1, PglUint(@VideoTex)); + SetLength(TexData,0); +end; + +procedure FFmpegOpenFile(FileName: pAnsiChar); +var errnum, i, x,y: Integer; + lStreamsCount : Integer; +begin + VideoOpened := False; + VideoPaused := False; + VideoTimeBase := 0; + VideoTime := 0; + LastFrameTime := 0; + TimeDifference := 0; + + errnum := av_open_input_file(VideoFormatContext, FileName, Nil, 0, Nil); + + if(errnum <> 0) then + begin +{$ifdef DebugDisplay} + case errnum of + AVERROR_UNKNOWN: showmessage('failed to open file '+Filename+#13#10+'AVERROR_UNKNOWN'); + AVERROR_IO: showmessage('failed to open file '+Filename+#13#10+'AVERROR_IO'); + AVERROR_NUMEXPECTED: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NUMEXPECTED'); + AVERROR_INVALIDDATA: showmessage('failed to open file '+Filename+#13#10+'AVERROR_INVALIDDATA'); + AVERROR_NOMEM: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NOMEM'); + AVERROR_NOFMT: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NOFMT'); + AVERROR_NOTSUPP: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NOTSUPP'); + else showmessage('failed to open file '+Filename+#13#10+'Error number: '+inttostr(Errnum)); + end; +{$ENDIF} + Exit; + end + else + begin + VideoStreamIndex:=-1; + + // Find which stream contains the video + if(av_find_stream_info(VideoFormatContext) >= 0) then + begin + {$ifdef DebugDisplay} + writeln( 'FFMPEG debug... VideoFormatContext^.nb_streams : '+ inttostr( VideoFormatContext^.nb_streams ) ); + {$endif} + for i:= 0 to MAX_STREAMS-1 do + begin + {$ifdef DebugDisplay} + writeln( 'FFMPEG debug... found stream '+ inttostr(i) + ' stream val ' + inttostr( integer(VideoFormatContext^.streams[i] ) ) ); + {$endif} + try + if assigned( VideoFormatContext ) AND + assigned( VideoFormatContext^.streams[i] ) AND + assigned( VideoFormatContext^.streams[i]^.codec ) THEN + begin + {$ifdef DebugDisplay} + writeln( 'FFMPEG debug... found stream '+ inttostr(i) + ' code val ' + inttostr( integer(VideoFormatContext^.streams[i].codec ) ) ); + writeln( 'FFMPEG debug... found stream '+ inttostr(i) + ' code Type ' + inttostr( integer(VideoFormatContext^.streams[i].codec^.codec_type ) ) ); + {$endif} + if(VideoFormatContext^.streams[i]^.codec^.codec_type=CODEC_TYPE_VIDEO) then + begin + {$ifdef DebugDisplay} + writeln( 'FFMPEG debug, found CODEC_TYPE_VIDEO stream' ); + {$endif} + VideoStreamIndex:=i; + end + else + end; + except + // TODO : JB_Linux ... this is excepting at line 108... ( Was 111 previously.. so its prob todo with streams[i]^.codec .. + {$ifdef DebugDisplay} + writeln( 'FFMPEG error, finding video stream' ); + {$endif} + end; + + end; + end; + + if(VideoStreamIndex >= 0) then + begin + VideoCodecContext:=VideoFormatContext^.streams[VideoStreamIndex]^.codec; + VideoCodec:=avcodec_find_decoder(VideoCodecContext^.codec_id); + end + else + begin +{$ifdef DebugDisplay} + showmessage('found no video stream'); +{$ENDIF} + av_close_input_file(VideoFormatContext); + Exit; + end; + + if(VideoCodec<>Nil) then + begin + errnum:=avcodec_open(VideoCodecContext, VideoCodec); + end else begin +{$ifdef DebugDisplay} + showmessage('no matching codec found'); +{$ENDIF} + avcodec_close(VideoCodecContext); + av_close_input_file(VideoFormatContext); + Exit; + end; + if(errnum >=0) then + begin +{$ifdef DebugDisplay} + showmessage('Found a matching Codec:'+#13#10#13#10+ + 'Width='+inttostr(VideoCodecContext^.width)+ + ', Height='+inttostr(VideoCodecContext^.height)+#13#10+ + 'Aspect: '+inttostr(VideoCodecContext^.sample_aspect_ratio.num)+'/'+inttostr(VideoCodecContext^.sample_aspect_ratio.den)+#13#10+ + 'Framerate: '+inttostr(VideoCodecContext^.time_base.num)+'/'+inttostr(VideoCodecContext^.time_base.den)); +{$endif} + // allocate space for decoded frame and rgb frame + AVFrame:=avcodec_alloc_frame; + AVFrameRGB:=avcodec_alloc_frame; + end; + myBuffer:=Nil; + if(AVFrame <> Nil) and (AVFrameRGB <> Nil) then + begin + myBuffer:=av_malloc(avpicture_get_size(PIX_FMT_RGB24, VideoCodecContext^.width, + VideoCodecContext^.height)); + end; + if myBuffer <> Nil then errnum:=avpicture_fill(PAVPicture(AVFrameRGB), myBuffer, PIX_FMT_RGB24, + VideoCodecContext^.width, VideoCodecContext^.height) + else begin +{$ifdef DebugDisplay} + showmessage('failed to allocate video buffer'); +{$endif} + av_free(AVFrameRGB); + av_free(AVFrame); + avcodec_close(VideoCodecContext); + av_close_input_file(VideoFormatContext); + Exit; + end; + if errnum >=0 then + begin + VideoOpened:=True; + + TexX := VideoCodecContext^.width; + TexY := VideoCodecContext^.height; + dataX := Round(Power(2, Ceil(Log2(TexX)))); + dataY := Round(Power(2, Ceil(Log2(TexY)))); + SetLength(TexData,dataX*dataY*3); + // calculate some information for video display + VideoAspect:=VideoCodecContext^.sample_aspect_ratio.num/VideoCodecContext^.sample_aspect_ratio.den; + if (VideoAspect = 0) then + VideoAspect:=VideoCodecContext^.width/VideoCodecContext^.height + else + VideoAspect:=VideoAspect*VideoCodecContext^.width/VideoCodecContext^.height; + if VideoAspect >= 4/3 then + begin + ScaledVideoWidth:=800.0; + ScaledVideoHeight:=800.0/VideoAspect; + end else + begin + ScaledVideoHeight:=600.0; + ScaledVideoWidth:=600.0*VideoAspect; + end; + VideoTimeBase:=VideoCodecContext^.time_base.num/VideoCodecContext^.time_base.den; + // hack to get reasonable timebase for divx +{$ifdef DebugDisplay} + showmessage('framerate: '+inttostr(floor(1/videotimebase))+'fps'); +{$endif} + if VideoTimeBase < 0.02 then // 0.02 <-> 50 fps + begin + VideoTimeBase:=VideoCodecContext^.time_base.den/VideoCodecContext^.time_base.num; + while VideoTimeBase > 50 do VideoTimeBase:=VideoTimeBase/10; + VideoTimeBase:=1/VideoTimeBase; + end; +{$ifdef DebugDisplay} + showmessage('corrected framerate: '+inttostr(floor(1/videotimebase))+'fps'); + if ((VideoAspect*VideoCodecContext^.width*VideoCodecContext^.height)>200000) then + showmessage('you are trying to play a rather large video'+#13#10+ + 'be prepared to experience some timing problems'); +{$endif} + end; + end; +end; + +procedure FFmpegClose; +begin + if VideoOpened then begin + av_free(myBuffer); + av_free(AVFrameRGB); + av_free(AVFrame); + avcodec_close(VideoCodecContext); + av_close_input_file(VideoFormatContext); + SetLength(TexData,0); + VideoOpened:=False; + end; +end; + +procedure FFmpegTogglePause; +begin + if VideoPaused then VideoPaused:=False + else VideoPaused:=True; +end; + +procedure FFmpegSkip(Time: Single); +begin + VideoSkiptime:=Time; + if VideoSkipTime > 0 then begin + av_seek_frame(VideoFormatContext,-1,Floor((VideoSkipTime)*1500000),0); + VideoTime:=VideoSkipTime; + end; +end; + +procedure FFmpegGetFrame(Time: Extended); +var + FrameFinished: Integer; + AVPacket: TAVPacket; + errnum, x, y: Integer; + FrameDataPtr: PByteArray; + linesize: integer; + myTime: Extended; + DropFrame: Boolean; + droppedFrames: Integer; +const + FRAMEDROPCOUNT=3; +begin + if not VideoOpened then Exit; + if VideoPaused then Exit; + myTime:=Time+VideoSkipTime; + TimeDifference:=myTime-VideoTime; + DropFrame:=False; +{ showmessage('Time: '+inttostr(floor(Time*1000))+#13#10+ + 'VideoTime: '+inttostr(floor(VideoTime*1000))+#13#10+ + 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ + 'TimeDiff: '+inttostr(floor(TimeDifference*1000))); +} + if (VideoTime <> 0) and (TimeDifference <= VideoTimeBase) then begin +{$ifdef DebugFrames} + // frame delay debug display + GoldenRec.Spawn(200,15,1,16,0,-1,ColoredStar,$00ff00); +{$endif} +{ showmessage('not getting new frame'+#13#10+ + 'Time: '+inttostr(floor(Time*1000))+#13#10+ + 'VideoTime: '+inttostr(floor(VideoTime*1000))+#13#10+ + 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ + 'TimeDiff: '+inttostr(floor(TimeDifference*1000))); +} + Exit;// we don't need a new frame now + end; + VideoTime:=VideoTime+VideoTimeBase; + TimeDifference:=myTime-VideoTime; + if TimeDifference >= (FRAMEDROPCOUNT-1)*VideoTimeBase then begin // skip frames +{$ifdef DebugFrames} + //frame drop debug display + GoldenRec.Spawn(200,55,1,16,0,-1,ColoredStar,$ff0000); +{$endif} +// showmessage('skipping frames'+#13#10+ +// 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ +// 'TimeDiff: '+inttostr(floor(TimeDifference*1000))+#13#10+ +// 'Time2Skip: '+inttostr(floor((Time-LastFrameTime)*1000))); +// av_seek_frame(VideoFormatContext,VideoStreamIndex,Floor(Time*VideoTimeBase),0); +{ av_seek_frame(VideoFormatContext,-1,Floor((myTime+VideoTimeBase)*1500000),0); + VideoTime:=floor(myTime/VideoTimeBase)*VideoTimeBase;} + VideoTime:=VideoTime+FRAMEDROPCOUNT*VideoTimeBase; + DropFrame:=True; + end; + + av_init_packet(@AVPacket); + FrameFinished:=0; + // read packets until we have a finished frame (or there are no more packets) + while (FrameFinished=0) and (av_read_frame(VideoFormatContext, @AVPacket)>=0) do + begin + // if we got a packet from the video stream, then decode it + if (AVPacket.stream_index=VideoStreamIndex) then + errnum:=avcodec_decode_video(VideoCodecContext, AVFrame, @frameFinished, + AVPacket.data, AVPacket.size); + // release internal packet structure created by av_read_frame + av_free_packet(PAVPacket(@AVPacket)); + end; + if DropFrame then + for droppedFrames:=1 to FRAMEDROPCOUNT do begin + FrameFinished:=0; + // read packets until we have a finished frame (or there are no more packets) + while (FrameFinished=0) and (av_read_frame(VideoFormatContext, @AVPacket)>=0) do + begin + // if we got a packet from the video stream, then decode it + if (AVPacket.stream_index=VideoStreamIndex) then + errnum:=avcodec_decode_video(VideoCodecContext, AVFrame, @frameFinished, + AVPacket.data, AVPacket.size); + // release internal packet structure created by av_read_frame + av_free_packet(PAVPacket(@AVPacket)); + end; + end; + + // if we did not get an new frame, there's nothing more to do + if Framefinished=0 then begin + GoldenRec.Spawn(220,15,1,16,0,-1,ColoredStar,$0000ff); + Exit; + end; + // otherwise we convert the pixeldata from YUV to RGB + errnum:=img_convert(PAVPicture(AVFrameRGB), PIX_FMT_RGB24, + PAVPicture(AVFrame), VideoCodecContext^.pix_fmt, + VideoCodecContext^.width, VideoCodecContext^.height); +//errnum:=1; + if errnum >=0 then begin + // copy RGB pixeldata to our TextureBuffer + // (line by line) + FrameDataPtr:=AVFrameRGB^.data[0]; + linesize:=AVFrameRGB^.linesize[0]; + for y:=0 to TexY-1 do begin + System.Move(FrameDataPtr[y*linesize],TexData[3*y*dataX],linesize); + end; + + // generate opengl texture out of whatever we got + glBindTexture(GL_TEXTURE_2D, VideoTex); + glTexImage2D(GL_TEXTURE_2D, 0, 3, dataX, dataY, 0, GL_RGB, GL_UNSIGNED_BYTE, TexData); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); +{$ifdef DebugFrames} + //frame decode debug display + GoldenRec.Spawn(200,35,1,16,0,-1,ColoredStar,$ffff00); +{$endif} + + end; +end; + +procedure FFmpegDrawGL(Screen: integer); +begin + // have a nice black background to draw on (even if there were errors opening the vid) + if Screen=1 then begin + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end; + // exit if there's nothing to draw + if not VideoOpened then Exit; + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, VideoTex); + glbegin(gl_quads); + glTexCoord2f( 0, 0); glVertex2f(400-ScaledVideoWidth/2, 300-ScaledVideoHeight/2); + glTexCoord2f( 0, TexY/dataY); glVertex2f(400-ScaledVideoWidth/2, 300+ScaledVideoHeight/2); + glTexCoord2f(TexX/dataX, TexY/dataY); glVertex2f(400+ScaledVideoWidth/2, 300+ScaledVideoHeight/2); + glTexCoord2f(TexX/dataX, 0); glVertex2f(400+ScaledVideoWidth/2, 300-ScaledVideoHeight/2); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + +{$ifdef Info} + if VideoSkipTime+VideoTime+VideoTimeBase < 0 then begin + glColor4f(0.7, 1, 0.3, 1); + SetFontStyle (1); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (300, 0); + glPrint('Delay due to negative VideoGap'); + glColor4f(1, 1, 1, 1); + end; +{$endif} + +{$ifdef DebugFrames} + glColor4f(0, 0, 0, 0.2); + glbegin(gl_quads); + glVertex2f(0, 0); + glVertex2f(0, 70); + glVertex2f(250, 70); + glVertex2f(250, 0); + glEnd; + + glColor4f(1,1,1,1); + SetFontStyle (1); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (5, 0); + glPrint('delaying frame'); + SetFontPos (5, 20); + glPrint('fetching frame'); + SetFontPos (5, 40); + glPrint('dropping frame'); +{$endif} +end; + +end. diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 9c571b2b..2bd0156a 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -1,1257 +1,1402 @@ -unit UScreenCredits; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -{$I switches.inc} - - -uses - UMenu, - SDL, - SDL_Image, - UDisplay, - UTexture, - OpenGL12, - UMusic, - UFiles, - SysUtils, - UThemes, - ULCD, - ULight, - UGraphicClasses; - -type - TCreditsStages=(InitialDelay,Intro,MainPart,Outro); - - TScreenCredits = class(TMenu) - public - - Credits_X: Real; - Credits_Time: Cardinal; - Credits_Alpha: Cardinal; - CTime: Cardinal; - CTime_hold: Cardinal; - ESC_Alpha: Integer; - - credits_entry_tex: TTexture; - credits_entry_dx_tex: TTexture; - credits_bg_tex: TTexture; - credits_bg_ovl: TTexture; -// credits_bg_logo: TTexture; - credits_bg_scrollbox_left: TTexture; - credits_blindguard: TTexture; - credits_blindy: TTexture; - credits_canni: TTexture; - credits_commandio: TTexture; - credits_lazyjoker: TTexture; - credits_mog: TTexture; - credits_mota: TTexture; - credits_skillmaster: TTexture; - credits_whiteshark: TTexture; - intro_layer01: TTexture; - intro_layer02: TTexture; - intro_layer03: TTexture; - intro_layer04: TTexture; - intro_layer05: TTexture; - intro_layer06: TTexture; - intro_layer07: TTexture; - intro_layer08: TTexture; - intro_layer09: TTexture; - outro_bg: TTexture; - outro_esc: TTexture; - outro_exd: TTexture; - - deluxe_slidein: cardinal; - - CurrentScrollText: String; - NextScrollUpdate: Real; - EndofLastScrollingPart: Cardinal; - CurrentScrollStart, CurrentScrollEnd: Integer; - - CRDTS_Stage: TCreditsStages; - - myTex: glUint; - mysdlimage,myconvertedsdlimage: PSDL_Surface; - - Fadeout: boolean; - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure onShow; override; - procedure onHide; override; - procedure DrawCredits; - procedure Draw_FunkyText; - end; - -const - Funky_Text: AnsiString = - 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+ - 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+ - 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+ - 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..'; - - - Timings: array[0..21] of Cardinal=( - 20, // 0 Delay vor Start - - 149, // 1 Ende erster Intro Zoom - 155, // 2 Start 2. Action im Intro - 170, // 3 Ende Separation im Intro - 271, // 4 Anfang Zoomout im Intro - 0, // 5 unused - 261, // 6 Start fade-to-white im Intro - - 271, // 7 Start Main Part - 280, // 8 Start On-Beat-Sternchen Main Part - - 396, // 9 Start BlindGuard - 666, // 10 Start blindy - 936, // 11 Start Canni - 1206, // 12 Start Commandio - 1476, // 13 Start LazyJoker - 1746, // 14 Start Mog - 2016, // 15 Start Mota - 2286, // 16 Start SkillMaster - 2556, // 17 Start WhiteShark - 2826, // 18 Ende Whiteshark - 3096, // 19 Start FadeOut Mainscreen - 3366, // 20 Ende Credits Tune - 60); // 21 start flare im intro - - - sdl32bpprgba: TSDL_Pixelformat=(palette: nil; - BitsPerPixel: 32; - BytesPerPixel: 4; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 24; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $ff000000; - colorkey: 0; - alpha: 255 ); - - -implementation - -uses {$IFDEF win32} - windows, - {$ELSE} - lclintf, - {$ENDIF} - UGraphic, - UMain, - UIni, - USongs, - Textgl, - ULanguage, - UCommon, - Math, - dialogs; - - -function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then - begin // Key Down - case PressedKey of - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - FadeTo(@ScreenMain); - Music.PlayBack; - end; -{ SDLK_SPACE: - begin - setlength(CTime_hold,length(CTime_hold)+1); - CTime_hold[high(CTime_hold)]:=CTime; - end; -} - end;//esac - end; //fi -end; - -constructor TScreenCredits.Create; -begin - inherited Create; - - credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0); - credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0); - - credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', 'PNG', 'Font Black', 0); - credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0); - credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0); - credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', 'PNG', 'Font Black', 0); - credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', 'PNG', 'Font Black', 0); - credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', 'Font Black', 0); - credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', 'PNG', 'Font Black', 0); - credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', 'PNG', 'Font Black', 0); - credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', 'PNG', 'Font Black', 0); - - intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', 'PNG', 'Transparent', 0); - intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', 'PNG', 'Transparent', 0); - intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', 'PNG', 'Transparent', 0); - intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', 'PNG', 'Transparent', 0); - intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', 'PNG', 'Transparent', 0); - intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', 'PNG', 'Transparent', 0); - intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', 'PNG', 'Transparent', 0); - intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', 'PNG', 'Transparent', 0); - intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', 'PNG', 'Transparent', 0); - - outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0); - outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0); - outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Transparent', 0); - - CRDTS_Stage:=InitialDelay; -end; - -function TScreenCredits.Draw: boolean; -begin - DrawCredits; - Draw:=true; -end; - -function pixfmt_eq(fmt1,fmt2: TSDL_Pixelformat): boolean; -begin - if (fmt1.BitsPerPixel = fmt2.BitsPerPixel) and - (fmt1.BytesPerPixel = fmt2.BytesPerPixel) and - (fmt1.Rloss = fmt2.Rloss) and - (fmt1.Gloss = fmt2.Gloss) and - (fmt1.Bloss = fmt2.Bloss) and - (fmt1.Rmask = fmt2.Rmask) and - (fmt1.Gmask = fmt2.Gmask) and - (fmt1.Bmask = fmt2.Bmask) and - (fmt1.Rshift = fmt2.Rshift) and - (fmt1.Gshift = fmt2.Gshift) and - (fmt1.Bshift = fmt2.Bshift) - then - pixfmt_eq:=True - else - pixfmt_eq:=False; -end; - -function inttohexstr(i: cardinal):pchar; -var helper, i2, c:cardinal; - tmpstr: string; -begin - helper:=0; - i2:=i; - tmpstr:=''; - for c:=1 to 8 do - begin - helper:=(helper shl 4) or (i2 and $f); - i2:=i2 shr 4; - end; - for c:=1 to 8 do - begin - i2:=helper and $f; - helper := helper shr 4; - case i2 of - 0: tmpstr:=tmpstr+'0'; - 1: tmpstr:=tmpstr+'1'; - 2: tmpstr:=tmpstr+'2'; - 3: tmpstr:=tmpstr+'3'; - 4: tmpstr:=tmpstr+'4'; - 5: tmpstr:=tmpstr+'5'; - 6: tmpstr:=tmpstr+'6'; - 7: tmpstr:=tmpstr+'7'; - 8: tmpstr:=tmpstr+'8'; - 9: tmpstr:=tmpstr+'9'; - 10: tmpstr:=tmpstr+'a'; - 11: tmpstr:=tmpstr+'b'; - 12: tmpstr:=tmpstr+'c'; - 13: tmpstr:=tmpstr+'d'; - 14: tmpstr:=tmpstr+'e'; - 15: tmpstr:=tmpstr+'f'; - end; - end; - inttohexstr:=pchar(tmpstr); -end; - -procedure TScreenCredits.onShow; -begin - CRDTS_Stage:=InitialDelay; - Credits_X := 580; - deluxe_slidein := 0; - Credits_Alpha := 0; - //Music.SetLoop(true); Loop looped ned, so ne scheisse - Music.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! -// Music.Play; - CTime:=0; -// setlength(CTime_hold,0); - - mysdlimage:=IMG_Load('test.png'); - if assigned(mysdlimage) then - begin - {$IFNDEF FPC} - showmessage('opened image via SDL_Image'+#13#10+ - 'Width: '+inttostr(mysdlimage^.w)+#13#10+ - 'Height: '+inttostr(mysdlimage^.h)+#13#10+ - 'BitsPP: '+inttostr(mysdlimage^.format.BitsPerPixel)+#13#10+ - 'BytesPP: '+inttostr(mysdlimage^.format.BytesPerPixel)+#13#10+ - 'Rloss: '+inttostr(mysdlimage^.format.Rloss)+#13#10+ - 'Gloss: '+inttostr(mysdlimage^.format.Gloss)+#13#10+ - 'Bloss: '+inttostr(mysdlimage^.format.Bloss)+#13#10+ - 'Aloss: '+inttostr(mysdlimage^.format.Aloss)+#13#10+ - 'Rshift: '+inttostr(mysdlimage^.format.Rshift)+#13#10+ - 'Gshift: '+inttostr(mysdlimage^.format.Gshift)+#13#10+ - 'Bshift: '+inttostr(mysdlimage^.format.Bshift)+#13#10+ - 'Ashift: '+inttostr(mysdlimage^.format.Ashift)+#13#10+ - 'Rmask: '+inttohexstr(mysdlimage^.format.Rmask)+#13#10+ - 'Gmask: '+inttohexstr(mysdlimage^.format.Gmask)+#13#10+ - 'Bmask: '+inttohexstr(mysdlimage^.format.Bmask)+#13#10+ - 'Amask: '+inttohexstr(mysdlimage^.format.Amask)+#13#10+ - 'ColKey: '+inttostr(mysdlimage^.format.Colorkey)+#13#10+ - 'Alpha: '+inttostr(mysdlimage^.format.Alpha)); - - if pixfmt_eq(mysdlimage^.format^,sdl32bpprgba) then - showmessage('equal pixelformats') - else - showmessage('different pixelformats'); - {$ENDIF} - - myconvertedsdlimage:=SDL_ConvertSurface(mysdlimage,@sdl32bpprgba,SDL_SWSURFACE); - glGenTextures(1,@myTex); - glBindTexture(GL_TEXTURE_2D, myTex); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - glTexImage2D( GL_TEXTURE_2D, 0, 4, myconvertedsdlimage^.w, myconvertedsdlimage^.h, 0, - GL_RGBA, GL_UNSIGNED_BYTE, myconvertedsdlimage^.pixels ); - SDL_FreeSurface(mysdlimage); - SDL_FreeSurface(myconvertedsdlimage); - end - else - {$IFDEF FPC} - writeln( 'could not open file - test.png'); - {$ELSE} - showmessage('could not open file - test.png'); - {$ENDIF} - -end; - -procedure TScreenCredits.onHide; -begin - Music.Stop; -end; - -Procedure TScreenCredits.Draw_FunkyText; -var - S: Integer; - X,Y,A: Real; - visibleText: PChar; -begin - SetFontSize(10); - //Init ScrollingText - if (CTime = Timings[7]) then - begin - //Set Position of Text - Credits_X := 600; - CurrentScrollStart:=1; - CurrentScrollEnd:=1; - end; - - if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then - begin - X:=0; - visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); - for S := 0 to length(visibleText)-1 do begin - Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); - SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); - A:=0; - if (Credits_X+X < 15) then A:=0; - if (Credits_X+X >=15) then A:=Credits_X+X-15; - if Credits_X+X > 32 then A:=17; - glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17); - glPrintLetter(visibleText[S]); - X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; - end; - if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin - Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; - inc(CurrentScrollStart); - end; - visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); - if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin - inc(CurrentScrollEnd); - end; - end; -{ // timing hack - X:=5; - SetFontStyle (2); - SetFontItalic(False); - SetFontSize(9); - glColor4f(1, 1, 1, 1); - for S:=0 to high(CTime_hold) do begin - visibleText:=pchar(inttostr(CTime_hold[S])); - SetFontPos (500, X); - glPrint (Addr(visibleText[0])); - X:=X+20; - end;} -end; - -procedure Start3D; -begin - glMatrixMode(GL_PROJECTION); - glPushMatrix; - glLoadIdentity; - glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity; -end; -procedure End3D; -begin - glMatrixMode(GL_PROJECTION); - glPopMatrix; - glMatrixMode(GL_MODELVIEW); -end; - -procedure TScreenCredits.DrawCredits; -var - T,I: Cardinal; - X: Real; - Ver: PChar; - RuntimeStr: AnsiString; - Data: TFFTData; - j,k,l:cardinal; - f,g,h: Real; - STime:cardinal; - Delay:cardinal; - - myPixel: longword; - myColor: Cardinal; - myScale: Real; - myAngle: Real; - - -const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24), - (154,31),(156,58),(168,32),(203,36), - (258,34),(251,50),(274,93),(294,84), - (232,54),(278,62),(319,34),(336,92), - (347,23),(374,32),(377,58),(361,83), - (385,91),(405,91),(429,35),(423,51), - (450,32),(485,34),(444,91),(486,93)); - -begin - //dis does teh muiwk y0r - Data := Music.GetFFTData; - - T := GetTickCount div 33; - if T <> Credits_Time then - begin - Credits_Time := T; - inc(CTime); - inc(CTime_hold); - Credits_X := Credits_X-2; - if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then - begin -// CTime:=Timings[20]; -// CRDTS_Stage:=Outro; - - CRDTS_Stage:=Intro; - CTime:=0; - Music.Play; - - end; - if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then - begin - CRDTS_Stage:=MainPart; - end; - if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then - begin - CRDTS_Stage:=Outro; - end; - end; - - //draw background - if CRDTS_Stage=InitialDelay then - begin - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - end - else - if CRDTS_Stage=Intro then - begin - Start3D; - glPushMatrix; - - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - if CTime < Timings[1] then begin - myScale:= 0.5+0.5*(Timings[1]-CTime)/(Timings[1]); // slowly move layers together - myAngle:=cos((CTime)*pi/((Timings[1])*2)); // and make logo face towards camera - end else begin // this is the part when the logo stands still - myScale:=0.5; - myAngle:=0; - end; - if CTime > Timings[2] then begin - myScale:= 0.5+0.5*(CTime-Timings[2])/(Timings[3]-Timings[2]); // get some space between layers - myAngle:=0; - end; -// if CTime > Timings[3] then myScale:=1; // keep the space between layers - glTranslatef(0,0,-5+0.5*myScale); - if CTime > Timings[3] then myScale:=1; // keep the space between layers - if CTime > Timings[3] then begin // make logo rotate left and grow -// myScale:=(CTime-Timings[4])/(Timings[7]-Timings[4]); - glRotatef(20*sqr(CTime-Timings[3])/sqr((Timings[7]-Timings[3])/2),0,0,1); - glScalef(1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1); - end; - if CTime < Timings[2] then - glRotatef(30*myAngle,0.5*myScale+myScale,1+myScale,0); -// glScalef(0.5,0.5,0.5); - glScalef(4/3,-1,1); - glColor4f(1, 1, 1, 1); - - glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.4 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.4 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.4 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.4 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.3 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.3 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.3 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.3 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.2 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.2 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.2 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.2 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.1 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.1 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.1 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.1 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.1 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.1 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.1 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.1 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.2 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.2 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.2 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.2 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.3 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.3 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.3 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.3 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.22 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.22 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.22 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.22 * myScale); - glEnd; - gldisable(gl_texture_2d); - glDisable(GL_BLEND); - - glPopMatrix; - End3D; - - // do some sparkling effects - if (CTime < Timings[1]) and (CTime > Timings[21]) then - begin - for k:=1 to 3 do begin - l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5); - j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301); - GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0); - end; - end; - - // fade to white at end - if Ctime > Timings[6] then - begin - glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6])); - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glVertex2f(0,0); - glVertex2f(0,600); - glVertex2f(800,600); - glVertex2f(800,0); - glEnd; - glDisable(GL_BLEND); - end; - - end; - if (CRDTS_Stage=MainPart) then - // main credits screen background, scroller, logo and girl - begin - - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,600/1024);glVertex2f(0, 600); - glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); - glTexCoord2f(800/1024,0);glVertex2f(800, 0); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - // draw scroller - Draw_FunkyText; - -//######################################################################### -// draw credits names - -// BlindGuard (von links oben reindrehen, nach rechts unten rausdrehen) - STime:=Timings[9]-10; - Delay:=Timings[10]-Timings[9]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(0,329,0); - if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end; - gltranslatef(223,0,0); - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - gltranslatef(223,0,0); - glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1); - gltranslatef(-223,0,0); - end; - glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Blindy (zoom von 0 auf volle grösse und drehung, zoom auf doppelte grösse und nach rechts oben schieben) - STime:=Timings[10]-10; - Delay:=Timings[11]-Timings[10]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+20) and (CTime<=STime+22) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+20 then begin - j:=CTime-Stime; - glscalef(j*j/400,j*j/400,j*j/400); - glrotatef(j*18.0,0,0,1); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - f:=j*10.0; - gltranslatef(f*3,-f,0); - glscalef(1+j/10,1+j/10,1+j/10); - glrotatef(j*9.0,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Canni (von links reinschieben, nach rechts oben rausschieben) - STime:=Timings[11]-10; - Delay:=Timings[12]-Timings[11]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - gltranslatef(((CTime-STime)*21.0)-210,0,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=(CTime-(STime+Delay-10))*21; - gltranslatef(j,-j/2,0); - end; - glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Commandio (von unten reinklappen, nach rechts oben rausklappen) - STime:=Timings[12]-10; - Delay:=Timings[13]-Timings[12]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=258.0-25.8*(CTime-STime) - else - f:=0; - g:=0; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end; - glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163+g-f*1.5, -129+f*1.5-g/2); - glTexCoord2f(0,1);glVertex2f(-163+g*1.5, 129-(g*1.5*258/326)); - glTexCoord2f(1,1); glVertex2f(163+g, 129+g/4); - glTexCoord2f(1,0);glVertex2f(163+f*1.5+g/4, -129+f*1.5-g/4); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing) - STime:=Timings[13]-35; - Delay:=Timings[14]-Timings[13]+5; - if CTime > STime then - begin - k:=0; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20; - ESC_Alpha:=10; - f:=CTime-STime; - if CTime <=STime+40 then j:=CTime-STime else j:=40; - if (CTime >=STime+Delay-40) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j*j/1600); - - glPushMatrix; - gltranslatef(180+(f-70),329,0); - glBindTexture(GL_TEXTURE_2D, credits_lazyjoker.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Mog (von links reinklappen, nach rechts unten rausklappen) - STime:=Timings[14]-10; - Delay:=Timings[15]-Timings[14]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=326.0-32.6*(CTime-STime) - else - f:=0; - - g:=0; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end; - glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163+g*1.5, -129+g*1.5); - glTexCoord2f(0,1);glVertex2f(-163+g*1.2, 129+g); - glTexCoord2f(1,1); glVertex2f(163-f+g/2, 129+f*1.5+g/4); - glTexCoord2f(1,0);glVertex2f(163-f+g*1.5, -129-f*1.5); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Mota (von rechts oben reindrehen, nach links unten rausschieben und verkleinern und dabei drehen) - STime:=Timings[15]-10; - Delay:=Timings[16]-Timings[15]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - gltranslatef(223,0,0); - glrotatef((10-(CTime-STime))*9,0,0,1); - gltranslatef(-223,0,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - f:=j*10.0; - gltranslatef(-f*2,-f,0); - glscalef(1-j/10,1-j/10,1-j/10); - glrotatef(-j*9.0,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Skillmaster (von rechts unten reinschieben, nach rechts oben rausdrehen) - STime:=Timings[16]-10; - Delay:=Timings[17]-Timings[16]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - j:=STime+10-CTime; - f:=j*10.0; - gltranslatef(+f*2,+f/2,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - gltranslatef(0,-223,0); - glrotatef(integer(j)*-9,0,0,1); - gltranslatef(0,223,0); - glrotatef(j*9,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// WhiteShark (von links unten reinklappen, nach rechts oben rausklappen) - STime:=Timings[17]-10; - Delay:=Timings[18]-Timings[17]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=326.0-32.6*(CTime-STime) - else - f:=0; - - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end else - g:=0; - glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2); - glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4); - glTexCoord2f(1,1); glVertex2f(163-f*1.2+g/4, 129+f/2-g/4); - glTexCoord2f(1,0);glVertex2f(163-f*1.5+g/4, -129+f*1.5+g/4); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - - -// #################################################################### -// do some twinkle stuff (kinda on beat) - if (CTime>Timings[8]) and (CTime < Timings[19]) then begin - k:=0; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.2 then begin - l:=RandomRange(6,16); - j:=RandomRange(0,27); - GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); - end; - end; - -//################################################# -// draw the rest of the main screen (girl and logo - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(800-393, 0); - glTexCoord2f(0,600/1024);glVertex2f(800-393, 600); - glTexCoord2f(393/512,600/1024); glVertex2f(800, 600); - glTexCoord2f(393/512,0);glVertex2f(800, 0); - glEnd; -{ glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,112/128);glVertex2f(0, 112); - glTexCoord2f(497/512,112/128); glVertex2f(497, 112); - glTexCoord2f(497/512,0);glVertex2f(497, 0); - glEnd; -} - gldisable(gl_texture_2d); - glDisable(GL_BLEND); - - // fade out at end of main part - if Ctime > Timings[19] then - begin - glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19])); - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glVertex2f(0,0); - glVertex2f(0,600); - glVertex2f(800,600); - glVertex2f(800,0); - glEnd; - glDisable(GL_BLEND); - end; - end - else - if (CRDTS_Stage=Outro) then - begin - if CTime=Timings[20] then begin - CTime_hold:=0; - Music.Stop; - Music.Open(soundpath + 'credits-outro-tune.mp3'); - Music.Play; - Music.SetVolume(20); - Music.SetLoop(True); - end; - if CTime_hold > 231 then begin - Music.Play; - Ctime_hold:=0; - end; - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - - // do something useful - // outro background - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,600/1024);glVertex2f(0, 600); - glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); - glTexCoord2f(800/1024,0);glVertex2f(800, 0); - glEnd; - - //outro overlays - glColor4f(1, 1, 1, (1+sin(CTime/15))/3+1/3); - glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,223/256);glVertex2f(0, 223); - glTexCoord2f(487/512,223/256); glVertex2f(487, 223); - glTexCoord2f(487/512,0);glVertex2f(487, 0); - glEnd; - - ESC_Alpha:=20; - if (RandomRange(0,20) > 18) and (ESC_Alpha=20) then - ESC_Alpha:=0 - else inc(ESC_Alpha); - if ESC_Alpha > 20 then ESC_Alpha:=20; - glColor4f(1, 1, 1, ESC_Alpha/20); - glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(800-310, 600-247); - glTexCoord2f(0,247/256);glVertex2f(800-310, 600); - glTexCoord2f(310/512,247/256); glVertex2f(800, 600); - glTexCoord2f(310/512,0);glVertex2f(800, 600-247); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - // outro scrollers? - // ... - end; - -{ // draw credits runtime counter - SetFontStyle (2); - SetFontItalic(False); - SetFontSize(9); - SetFontPos (5, 5); - glColor4f(1, 1, 1, 1); -// RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10); - RuntimeStr:='CTime: '+inttostr(CTime); - glPrint (Addr(RuntimeStr[1])); -} - - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, myTex); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(100, 100); - glTexCoord2f(0,1);glVertex2f(100, 200); - glTexCoord2f(1,1); glVertex2f(200, 200); - glTexCoord2f(1,0);glVertex2f(200, 100); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - - // make the stars shine - GoldenRec.Draw; -end; - -end. +unit UScreenCredits; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +{$I switches.inc} + + +uses + UMenu, + SDL, + SDL_Image, + UDisplay, + UTexture, + OpenGL12, + UMusic, + UFiles, + SysUtils, + UThemes, + ULCD, + ULight, + UGraphicClasses; + +type + TCreditsStages=(InitialDelay,Intro,MainPart,Outro); + + TScreenCredits = class(TMenu) + public + + Credits_X: Real; + Credits_Time: Cardinal; + Credits_Alpha: Cardinal; + CTime: Cardinal; + CTime_hold: Cardinal; + ESC_Alpha: Integer; + + credits_entry_tex: TTexture; + credits_entry_dx_tex: TTexture; + credits_bg_tex: TTexture; + credits_bg_ovl: TTexture; +// credits_bg_logo: TTexture; + credits_bg_scrollbox_left: TTexture; + credits_blindguard: TTexture; + credits_blindy: TTexture; + credits_canni: TTexture; + credits_commandio: TTexture; + credits_lazyjoker: TTexture; + credits_mog: TTexture; + credits_mota: TTexture; + credits_skillmaster: TTexture; + credits_whiteshark: TTexture; + intro_layer01: TTexture; + intro_layer02: TTexture; + intro_layer03: TTexture; + intro_layer04: TTexture; + intro_layer05: TTexture; + intro_layer06: TTexture; + intro_layer07: TTexture; + intro_layer08: TTexture; + intro_layer09: TTexture; + outro_bg: TTexture; + outro_esc: TTexture; + outro_exd: TTexture; + + deluxe_slidein: cardinal; + + CurrentScrollText: String; + NextScrollUpdate: Real; + EndofLastScrollingPart: Cardinal; + CurrentScrollStart, CurrentScrollEnd: Integer; + + CRDTS_Stage: TCreditsStages; + + myTex: glUint; + mysdlimage,myconvertedsdlimage: PSDL_Surface; + + Fadeout: boolean; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure DrawCredits; + procedure Draw_FunkyText; + end; + +const + Funky_Text: AnsiString = + 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+ + 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+ + 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+ + 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..'; + + + Timings: array[0..21] of Cardinal=( + 20, // 0 Delay vor Start + + 149, // 1 Ende erster Intro Zoom + 155, // 2 Start 2. Action im Intro + 170, // 3 Ende Separation im Intro + 271, // 4 Anfang Zoomout im Intro + 0, // 5 unused + 261, // 6 Start fade-to-white im Intro + + 271, // 7 Start Main Part + 280, // 8 Start On-Beat-Sternchen Main Part + + 396, // 9 Start BlindGuard + 666, // 10 Start blindy + 936, // 11 Start Canni + 1206, // 12 Start Commandio + 1476, // 13 Start LazyJoker + 1746, // 14 Start Mog + 2016, // 15 Start Mota + 2286, // 16 Start SkillMaster + 2556, // 17 Start WhiteShark + 2826, // 18 Ende Whiteshark + 3096, // 19 Start FadeOut Mainscreen + 3366, // 20 Ende Credits Tune + 60); // 21 start flare im intro + + + sdl32bpprgba: TSDL_Pixelformat=(palette: nil; + BitsPerPixel: 32; + BytesPerPixel: 4; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 24; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $ff000000; + colorkey: 0; + alpha: 255 ); + + +implementation + +uses {$IFDEF win32} + windows, + {$ELSE} + lclintf, + {$ENDIF} + ULog, + UGraphic, + UMain, + UIni, + USongs, + Textgl, + ULanguage, + UCommon, + Math, + dialogs; + + +function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + FadeTo(@ScreenMain); + Music.PlayBack; + end; +{ SDLK_SPACE: + begin + setlength(CTime_hold,length(CTime_hold)+1); + CTime_hold[high(CTime_hold)]:=CTime; + end; +} + end;//esac + end; //fi +end; + +constructor TScreenCredits.Create; +begin + inherited Create; + + credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0); + credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0); + + credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', 'PNG', 'Font Black', 0); + credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0); + credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0); + credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', 'PNG', 'Font Black', 0); + credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', 'PNG', 'Font Black', 0); + credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', 'Font Black', 0); + credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', 'PNG', 'Font Black', 0); + credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', 'PNG', 'Font Black', 0); + credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', 'PNG', 'Font Black', 0); + + intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', 'PNG', 'Transparent', 0); + intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', 'PNG', 'Transparent', 0); + intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', 'PNG', 'Transparent', 0); + intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', 'PNG', 'Transparent', 0); + intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', 'PNG', 'Transparent', 0); + intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', 'PNG', 'Transparent', 0); + intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', 'PNG', 'Transparent', 0); + intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', 'PNG', 'Transparent', 0); + intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', 'PNG', 'Transparent', 0); + + outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0); + outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0); + outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Transparent', 0); + + CRDTS_Stage:=InitialDelay; +end; + +function TScreenCredits.Draw: boolean; +begin + DrawCredits; + Draw:=true; +end; + +function pixfmt_eq(fmt1,fmt2: TSDL_Pixelformat): boolean; +begin + if (fmt1.BitsPerPixel = fmt2.BitsPerPixel) and + (fmt1.BytesPerPixel = fmt2.BytesPerPixel) and + (fmt1.Rloss = fmt2.Rloss) and + (fmt1.Gloss = fmt2.Gloss) and + (fmt1.Bloss = fmt2.Bloss) and + (fmt1.Rmask = fmt2.Rmask) and + (fmt1.Gmask = fmt2.Gmask) and + (fmt1.Bmask = fmt2.Bmask) and + (fmt1.Rshift = fmt2.Rshift) and + (fmt1.Gshift = fmt2.Gshift) and + (fmt1.Bshift = fmt2.Bshift) + then + pixfmt_eq:=True + else + pixfmt_eq:=False; +end; + +function inttohexstr(i: cardinal):pchar; +var helper, i2, c:cardinal; + tmpstr: string; +begin + helper:=0; + i2:=i; + tmpstr:=''; + for c:=1 to 8 do + begin + helper:=(helper shl 4) or (i2 and $f); + i2:=i2 shr 4; + end; + for c:=1 to 8 do + begin + i2:=helper and $f; + helper := helper shr 4; + case i2 of + 0: tmpstr:=tmpstr+'0'; + 1: tmpstr:=tmpstr+'1'; + 2: tmpstr:=tmpstr+'2'; + 3: tmpstr:=tmpstr+'3'; + 4: tmpstr:=tmpstr+'4'; + 5: tmpstr:=tmpstr+'5'; + 6: tmpstr:=tmpstr+'6'; + 7: tmpstr:=tmpstr+'7'; + 8: tmpstr:=tmpstr+'8'; + 9: tmpstr:=tmpstr+'9'; + 10: tmpstr:=tmpstr+'a'; + 11: tmpstr:=tmpstr+'b'; + 12: tmpstr:=tmpstr+'c'; + 13: tmpstr:=tmpstr+'d'; + 14: tmpstr:=tmpstr+'e'; + 15: tmpstr:=tmpstr+'f'; + end; + end; + inttohexstr:=pchar(tmpstr); +end; + +procedure TScreenCredits.onShow; +begin + CRDTS_Stage:=InitialDelay; + Credits_X := 580; + deluxe_slidein := 0; + Credits_Alpha := 0; + //Music.SetLoop(true); Loop looped ned, so ne scheisse + Music.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! +// Music.Play; + CTime:=0; +// setlength(CTime_hold,0); + + mysdlimage:=IMG_Load('test.png'); + if assigned(mysdlimage) then + begin + {$IFNDEF FPC} + showmessage('opened image via SDL_Image'+#13#10+ + 'Width: '+inttostr(mysdlimage^.w)+#13#10+ + 'Height: '+inttostr(mysdlimage^.h)+#13#10+ + 'BitsPP: '+inttostr(mysdlimage^.format.BitsPerPixel)+#13#10+ + 'BytesPP: '+inttostr(mysdlimage^.format.BytesPerPixel)+#13#10+ + 'Rloss: '+inttostr(mysdlimage^.format.Rloss)+#13#10+ + 'Gloss: '+inttostr(mysdlimage^.format.Gloss)+#13#10+ + 'Bloss: '+inttostr(mysdlimage^.format.Bloss)+#13#10+ + 'Aloss: '+inttostr(mysdlimage^.format.Aloss)+#13#10+ + 'Rshift: '+inttostr(mysdlimage^.format.Rshift)+#13#10+ + 'Gshift: '+inttostr(mysdlimage^.format.Gshift)+#13#10+ + 'Bshift: '+inttostr(mysdlimage^.format.Bshift)+#13#10+ + 'Ashift: '+inttostr(mysdlimage^.format.Ashift)+#13#10+ + 'Rmask: '+inttohexstr(mysdlimage^.format.Rmask)+#13#10+ + 'Gmask: '+inttohexstr(mysdlimage^.format.Gmask)+#13#10+ + 'Bmask: '+inttohexstr(mysdlimage^.format.Bmask)+#13#10+ + 'Amask: '+inttohexstr(mysdlimage^.format.Amask)+#13#10+ + 'ColKey: '+inttostr(mysdlimage^.format.Colorkey)+#13#10+ + 'Alpha: '+inttostr(mysdlimage^.format.Alpha)); + + if pixfmt_eq(mysdlimage^.format^,sdl32bpprgba) then + showmessage('equal pixelformats') + else + showmessage('different pixelformats'); + {$ENDIF} + + myconvertedsdlimage:=SDL_ConvertSurface(mysdlimage,@sdl32bpprgba,SDL_SWSURFACE); + glGenTextures(1,@myTex); + glBindTexture(GL_TEXTURE_2D, myTex); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + glTexImage2D( GL_TEXTURE_2D, 0, 4, myconvertedsdlimage^.w, myconvertedsdlimage^.h, 0, + GL_RGBA, GL_UNSIGNED_BYTE, myconvertedsdlimage^.pixels ); + SDL_FreeSurface(mysdlimage); + SDL_FreeSurface(myconvertedsdlimage); + end + else + {$IFDEF FPC} + writeln( 'could not open file - test.png'); + {$ELSE} + showmessage('could not open file - test.png'); + {$ENDIF} + +end; + +procedure TScreenCredits.onHide; +begin + Music.Stop; +end; + +Procedure TScreenCredits.Draw_FunkyText; +var + S: Integer; + X,Y,A: Real; + visibleText: PChar; +begin + SetFontSize(10); + //Init ScrollingText + if (CTime = Timings[7]) then + begin + //Set Position of Text + Credits_X := 600; + CurrentScrollStart:=1; + CurrentScrollEnd:=1; + end; + + if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then + begin + X:=0; + visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); + for S := 0 to length(visibleText)-1 do begin + Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); + SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); + A:=0; + if (Credits_X+X < 15) then A:=0; + if (Credits_X+X >=15) then A:=Credits_X+X-15; + if Credits_X+X > 32 then A:=17; + glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17); + glPrintLetter(visibleText[S]); + X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + end; + if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin + Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + inc(CurrentScrollStart); + end; + visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); + if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin + inc(CurrentScrollEnd); + end; + end; +{ // timing hack + X:=5; + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + glColor4f(1, 1, 1, 1); + for S:=0 to high(CTime_hold) do begin + visibleText:=pchar(inttostr(CTime_hold[S])); + SetFontPos (500, X); + glPrint (Addr(visibleText[0])); + X:=X+20; + end;} +end; + +procedure Start3D; +begin + glMatrixMode(GL_PROJECTION); + glPushMatrix; + glLoadIdentity; + glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity; +end; +procedure End3D; +begin + glMatrixMode(GL_PROJECTION); + glPopMatrix; + glMatrixMode(GL_MODELVIEW); +end; + +procedure TScreenCredits.DrawCredits; +var + T,I: Cardinal; + X: Real; + Ver: PChar; + RuntimeStr: AnsiString; + Data: TFFTData; + j,k,l:cardinal; + f,g,h: Real; + STime:cardinal; + Delay:cardinal; + + myPixel: longword; + myColor: Cardinal; + myScale: Real; + myAngle: Real; + + +const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24), + (154,31),(156,58),(168,32),(203,36), + (258,34),(251,50),(274,93),(294,84), + (232,54),(278,62),(319,34),(336,92), + (347,23),(374,32),(377,58),(361,83), + (385,91),(405,91),(429,35),(423,51), + (450,32),(485,34),(444,91),(486,93)); + +begin + //dis does teh muiwk y0r + Data := Music.GetFFTData; + + Log.LogStatus('',' JB-1'); + + T := GetTickCount div 33; + if T <> Credits_Time then + begin + Credits_Time := T; + inc(CTime); + inc(CTime_hold); + Credits_X := Credits_X-2; + + Log.LogStatus('',' JB-2'); + if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then + begin +// CTime:=Timings[20]; +// CRDTS_Stage:=Outro; + + CRDTS_Stage:=Intro; + CTime:=0; + Music.Play; + + end; + if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then + begin + CRDTS_Stage:=MainPart; + end; + if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then + begin + CRDTS_Stage:=Outro; + end; + end; + + Log.LogStatus('',' JB-3'); + + //draw background + if CRDTS_Stage=InitialDelay then + begin + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end + else + if CRDTS_Stage=Intro then + begin + Start3D; + glPushMatrix; + + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + if CTime < Timings[1] then begin + myScale:= 0.5+0.5*(Timings[1]-CTime)/(Timings[1]); // slowly move layers together + myAngle:=cos((CTime)*pi/((Timings[1])*2)); // and make logo face towards camera + end else begin // this is the part when the logo stands still + myScale:=0.5; + myAngle:=0; + end; + if CTime > Timings[2] then begin + myScale:= 0.5+0.5*(CTime-Timings[2])/(Timings[3]-Timings[2]); // get some space between layers + myAngle:=0; + end; +// if CTime > Timings[3] then myScale:=1; // keep the space between layers + glTranslatef(0,0,-5+0.5*myScale); + if CTime > Timings[3] then myScale:=1; // keep the space between layers + if CTime > Timings[3] then begin // make logo rotate left and grow +// myScale:=(CTime-Timings[4])/(Timings[7]-Timings[4]); + glRotatef(20*sqr(CTime-Timings[3])/sqr((Timings[7]-Timings[3])/2),0,0,1); + glScalef(1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1); + end; + if CTime < Timings[2] then + glRotatef(30*myAngle,0.5*myScale+myScale,1+myScale,0); +// glScalef(0.5,0.5,0.5); + glScalef(4/3,-1,1); + glColor4f(1, 1, 1, 1); + + glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.4 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.4 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.4 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.4 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.22 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.22 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.22 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.22 * myScale); + glEnd; + gldisable(gl_texture_2d); + glDisable(GL_BLEND); + + glPopMatrix; + End3D; + + // do some sparkling effects + if (CTime < Timings[1]) and (CTime > Timings[21]) then + begin + for k:=1 to 3 do begin + l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5); + j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301); + GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0); + end; + end; + + // fade to white at end + if Ctime > Timings[6] then + begin + glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + + end; + if (CRDTS_Stage=MainPart) then + // main credits screen background, scroller, logo and girl + begin + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // draw scroller + Draw_FunkyText; + +//######################################################################### +// draw credits names + + +Log.LogStatus('',' JB-4'); + +// BlindGuard (von links oben reindrehen, nach rechts unten rausdrehen) + STime:=Timings[9]-10; + Delay:=Timings[10]-Timings[9]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(0,329,0); + if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end; + gltranslatef(223,0,0); + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + gltranslatef(223,0,0); + glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1); + gltranslatef(-223,0,0); + end; + glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Blindy (zoom von 0 auf volle grösse und drehung, zoom auf doppelte grösse und nach rechts oben schieben) + STime:=Timings[10]-10; + Delay:=Timings[11]-Timings[10]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+20) and (CTime<=STime+22) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+20 then begin + j:=CTime-Stime; + glscalef(j*j/400,j*j/400,j*j/400); + glrotatef(j*18.0,0,0,1); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(f*3,-f,0); + glscalef(1+j/10,1+j/10,1+j/10); + glrotatef(j*9.0,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Canni (von links reinschieben, nach rechts oben rausschieben) + STime:=Timings[11]-10; + Delay:=Timings[12]-Timings[11]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(((CTime-STime)*21.0)-210,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=(CTime-(STime+Delay-10))*21; + gltranslatef(j,-j/2,0); + end; + glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Commandio (von unten reinklappen, nach rechts oben rausklappen) + STime:=Timings[12]-10; + Delay:=Timings[13]-Timings[12]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=258.0-25.8*(CTime-STime) + else + f:=0; + g:=0; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end; + glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163+g-f*1.5, -129+f*1.5-g/2); + glTexCoord2f(0,1);glVertex2f(-163+g*1.5, 129-(g*1.5*258/326)); + glTexCoord2f(1,1); glVertex2f(163+g, 129+g/4); + glTexCoord2f(1,0);glVertex2f(163+f*1.5+g/4, -129+f*1.5-g/4); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing) + STime:=Timings[13]-35; + Delay:=Timings[14]-Timings[13]+5; + if CTime > STime then + begin + k:=0; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20; + ESC_Alpha:=10; + f:=CTime-STime; + if CTime <=STime+40 then j:=CTime-STime else j:=40; + if (CTime >=STime+Delay-40) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j*j/1600); + + glPushMatrix; + gltranslatef(180+(f-70),329,0); + glBindTexture(GL_TEXTURE_2D, credits_lazyjoker.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Mog (von links reinklappen, nach rechts unten rausklappen) + STime:=Timings[14]-10; + Delay:=Timings[15]-Timings[14]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) + else + f:=0; + + g:=0; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end; + glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163+g*1.5, -129+g*1.5); + glTexCoord2f(0,1);glVertex2f(-163+g*1.2, 129+g); + glTexCoord2f(1,1); glVertex2f(163-f+g/2, 129+f*1.5+g/4); + glTexCoord2f(1,0);glVertex2f(163-f+g*1.5, -129-f*1.5); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Mota (von rechts oben reindrehen, nach links unten rausschieben und verkleinern und dabei drehen) + STime:=Timings[15]-10; + Delay:=Timings[16]-Timings[15]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(223,0,0); + glrotatef((10-(CTime-STime))*9,0,0,1); + gltranslatef(-223,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(-f*2,-f,0); + glscalef(1-j/10,1-j/10,1-j/10); + glrotatef(-j*9.0,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Skillmaster (von rechts unten reinschieben, nach rechts oben rausdrehen) + STime:=Timings[16]-10; + Delay:=Timings[17]-Timings[16]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + j:=STime+10-CTime; + f:=j*10.0; + gltranslatef(+f*2,+f/2,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + gltranslatef(0,-223,0); + glrotatef(integer(j)*-9,0,0,1); + gltranslatef(0,223,0); + glrotatef(j*9,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// WhiteShark (von links unten reinklappen, nach rechts oben rausklappen) + STime:=Timings[17]-10; + Delay:=Timings[18]-Timings[17]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) + else + f:=0; + + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end else + g:=0; + glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2); + glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4); + glTexCoord2f(1,1); glVertex2f(163-f*1.2+g/4, 129+f/2-g/4); + glTexCoord2f(1,0);glVertex2f(163-f*1.5+g/4, -129+f*1.5+g/4); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + + + Log.LogStatus('',' JB-103'); + +// #################################################################### +// do some twinkle stuff (kinda on beat) + if (CTime > Timings[8] ) and + (CTime < Timings[19] ) then + begin + k := 0; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + if Data[k]>0.2 then + begin + l := RandomRange(6,16); + j := RandomRange(0,27); + + GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); + end; + end; + +//################################################# +// draw the rest of the main screen (girl and logo + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(800-393, 0); + glTexCoord2f(0,600/1024);glVertex2f(800-393, 600); + glTexCoord2f(393/512,600/1024); glVertex2f(800, 600); + glTexCoord2f(393/512,0);glVertex2f(800, 0); + glEnd; +{ glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,112/128);glVertex2f(0, 112); + glTexCoord2f(497/512,112/128); glVertex2f(497, 112); + glTexCoord2f(497/512,0);glVertex2f(497, 0); + glEnd; +} + gldisable(gl_texture_2d); + glDisable(GL_BLEND); + + // fade out at end of main part + if Ctime > Timings[19] then + begin + glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + end + else + if (CRDTS_Stage=Outro) then + begin + if CTime=Timings[20] then begin + CTime_hold:=0; + Music.Stop; + Music.Open(soundpath + 'credits-outro-tune.mp3'); + Music.Play; + Music.SetVolume(20); + Music.SetLoop(True); + end; + if CTime_hold > 231 then begin + Music.Play; + Ctime_hold:=0; + end; + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + // do something useful + // outro background + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); + glEnd; + + //outro overlays + glColor4f(1, 1, 1, (1+sin(CTime/15))/3+1/3); + glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,223/256);glVertex2f(0, 223); + glTexCoord2f(487/512,223/256); glVertex2f(487, 223); + glTexCoord2f(487/512,0);glVertex2f(487, 0); + glEnd; + + ESC_Alpha:=20; + if (RandomRange(0,20) > 18) and (ESC_Alpha=20) then + ESC_Alpha:=0 + else inc(ESC_Alpha); + if ESC_Alpha > 20 then ESC_Alpha:=20; + glColor4f(1, 1, 1, ESC_Alpha/20); + glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(800-310, 600-247); + glTexCoord2f(0,247/256);glVertex2f(800-310, 600); + glTexCoord2f(310/512,247/256); glVertex2f(800, 600); + glTexCoord2f(310/512,0);glVertex2f(800, 600-247); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // outro scrollers? + // ... + end; + +{ // draw credits runtime counter + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (5, 5); + glColor4f(1, 1, 1, 1); +// RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10); + RuntimeStr:='CTime: '+inttostr(CTime); + glPrint (Addr(RuntimeStr[1])); +} + + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, myTex); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(100, 100); + glTexCoord2f(0,1);glVertex2f(100, 200); + glTexCoord2f(1,1); glVertex2f(200, 200); + glTexCoord2f(1,0);glVertex2f(200, 100); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + + // make the stars shine + GoldenRec.Draw; +end; + +end. diff --git a/Game/Code/lib/ffmpeg/avformat.pas b/Game/Code/lib/ffmpeg/avformat.pas index 6e9c5934..312fb67d 100644 --- a/Game/Code/lib/ffmpeg/avformat.pas +++ b/Game/Code/lib/ffmpeg/avformat.pas @@ -259,7 +259,7 @@ type oformat: PAVOutputFormat; priv_data: pointer; pb: TByteIOContext; - nb_streams: integer; + nb_streams: cardinal;// integer; streams: array [0..MAX_STREAMS - 1] of PAVStream; filename: array [0..1023] of char; (* input or output filename *) (* stream info *) -- cgit v1.2.3 From 4d693075a4b5078a9e08430d003e2bdb918b68c2 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 8 Oct 2007 02:02:07 +0000 Subject: trying to fix linux runtime errors with database ( Stats screen ) and Song Selection screen ( now back to kina working ) Testing Fisheye Links (please ignore): jira#USDX-1 sf#1790165 build#USDX-DELPHI-26 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@469 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDataBase.pas | 175 +- Game/Code/Screens/UScreenSong.pas | 4108 +++++++++++++++++++------------------ 2 files changed, 2186 insertions(+), 2097 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDataBase.pas b/Game/Code/Classes/UDataBase.pas index deee85c0..bacb0d98 100644 --- a/Game/Code/Classes/UDataBase.pas +++ b/Game/Code/Classes/UDataBase.pas @@ -7,7 +7,8 @@ interface {$ENDIF} -uses USongs, SQLiteTable3; +uses USongs, + SQLiteTable3; //-------------------- //DataBaseSystem - Class including all DB Methods @@ -37,6 +38,7 @@ type private ScoreDB: TSqliteDatabase; sFilename: string; + public @@ -60,29 +62,44 @@ implementation uses IniFiles, SysUtils; +const + cUS_Scores = 'us_scores'; + cUS_Songs = 'us_songs'; + //-------------------- //Create - Opens Database and Create Tables if not Exist //-------------------- Procedure TDataBaseSystem.Init(const Filename: string); begin + writeln( 'TDataBaseSystem.Init' ); + //Open Database - ScoreDB := TSqliteDatabase.Create(Filename); + ScoreDB := TSqliteDatabase.Create( Filename ); sFilename := Filename; try - //Look for Tables => When not exist Create them - if not ScoreDB.TableExists('US_Scores') then - ScoreDB.execsql('CREATE TABLE `US_Scores` (`SongID` INT( 11 ) NOT NULL , `Difficulty` INT( 1 ) NOT NULL , `Player` VARCHAR( 150 ) NOT NULL , `Score` INT( 5 ) NOT NULL );'); + //Look for Tables => When not exist Create them + if not ScoreDB.TableExists( cUS_Scores ) then + begin + ScoreDB.execsql('CREATE TABLE `'+cUS_Scores+'` (`SongID` INT( 11 ) NOT NULL , `Difficulty` INT( 1 ) NOT NULL , `Player` VARCHAR( 150 ) NOT NULL , `Score` INT( 5 ) NOT NULL );'); + writeln( 'TDataBaseSystem.Init - CREATED US_Scores' ); + end; - if not ScoreDB.TableExists('US_Songs') then - ScoreDB.execsql('CREATE TABLE `US_Songs` (`ID` INTEGER PRIMARY KEY, `Artist` VARCHAR( 255 ) NOT NULL , `Title` VARCHAR( 255 ) NOT NULL , `TimesPlayed` int(5) NOT NULL );'); - //Not possible because of String Limitation to 255 Chars //Need to rewrite Wrapper - {if not ScoreDB.TableExists('US_SongCache') then - ScoreDB.ExecSQL('CREATE TABLE `US_SongCache` (`Path` VARCHAR( 255 ) NOT NULL , `Filename` VARCHAR( 255 ) NOT NULL , `Title` VARCHAR( 255 ) NOT NULL , `Artist` VARCHAR( 255 ) NOT NULL , `Folder` VARCHAR( 255 ) NOT NULL , `Genre` VARCHAR( 255 ) NOT NULL , `Edition` VARCHAR( 255 ) NOT NULL , `Language` VARCHAR( 255 ) NOT NULL , `Creator` VARCHAR( 255 ) NOT NULL , `Cover` VARCHAR( 255 ) NOT NULL , `Background` VARCHAR( 255 ) NOT NULL , `Video` VARCHAR( 255 ) NOT NULL , `VideoGap` FLOAT NOT NULL , `Gap` FLOAT NOT NULL , `Start` FLOAT NOT NULL , `Finish` INT( 11 ) NOT NULL , `BPM` INT( 5 ) NOT NULL , `Relative` BOOLEAN NOT NULL , `NotesGap` INT( 11 ) NOT NULL);');} + if not ScoreDB.TableExists( cUS_Songs ) then + begin + ScoreDB.execsql('CREATE TABLE `'+cUS_Songs+'` (`ID` INTEGER PRIMARY KEY, `Artist` VARCHAR( 255 ) NOT NULL , `Title` VARCHAR( 255 ) NOT NULL , `TimesPlayed` int(5) NOT NULL );'); + writeln( 'TDataBaseSystem.Init - CREATED US_Songs' ); + end; + + //Not possible because of String Limitation to 255 Chars //Need to rewrite Wrapper + {if not ScoreDB.TableExists('US_SongCache') then + ScoreDB.ExecSQL('CREATE TABLE `US_SongCache` (`Path` VARCHAR( 255 ) NOT NULL , `Filename` VARCHAR( 255 ) NOT NULL , `Title` VARCHAR( 255 ) NOT NULL , `Artist` VARCHAR( 255 ) NOT NULL , `Folder` VARCHAR( 255 ) NOT NULL , `Genre` VARCHAR( 255 ) NOT NULL , `Edition` VARCHAR( 255 ) NOT NULL , `Language` VARCHAR( 255 ) NOT NULL , `Creator` VARCHAR( 255 ) NOT NULL , `Cover` VARCHAR( 255 ) NOT NULL , `Background` VARCHAR( 255 ) NOT NULL , `Video` VARCHAR( 255 ) NOT NULL , `VideoGap` FLOAT NOT NULL , `Gap` FLOAT NOT NULL , `Start` FLOAT NOT NULL , `Finish` INT( 11 ) NOT NULL , `BPM` INT( 5 ) NOT NULL , `Relative` BOOLEAN NOT NULL , `NotesGap` INT( 11 ) NOT NULL);');} finally + writeln( cUS_Songs +' Exist : ' + inttostr( integer(ScoreDB.TableExists( cUS_Songs )) ) ); + writeln( cUS_Scores +' Exist : ' + inttostr( integer(ScoreDB.TableExists( cUS_Scores )) ) ); //ScoreDB.Free; end; @@ -93,7 +110,9 @@ end; //-------------------- Destructor TDataBaseSystem.Free; begin - ScoreDB.Free; + writeln( 'TDataBaseSystem.Free' ); + + freeandnil( ScoreDB ); end; //-------------------- @@ -104,37 +123,44 @@ var TableData: TSqliteTable; Dif: Byte; begin + if not assigned( ScoreDB ) then + exit; + + //ScoreDB := TSqliteDatabase.Create(sFilename); try - try - //Search Song in DB - TableData := ScoreDB.GetTable('SELECT `Difficulty`, `Player`, `Score` FROM `us_scores` WHERE `SongID` = (SELECT `ID` FROM `us_songs` WHERE `Artist` = "' + Song.Artist + '" AND `Title` = "' + Song.Title + '" LIMIT 1) ORDER BY `Score` DESC LIMIT 15'); - //Empty Old Scores - SetLength (Song.Score[0], 0); - SetLength (Song.Score[1], 0); - SetLength (Song.Score[2], 0); - - while not TableData.Eof do//Go through all Entrys - begin//Add one Entry to Array - Dif := StrtoInt(TableData.FieldAsString(TableData.FieldIndex['Difficulty'])); - if (Dif>=0) AND (Dif<=2) then - begin - SetLength(Song.Score[Dif], Length(Song.Score[Dif]) + 1); - - Song.Score[Dif, high(Song.Score[Dif])].Name := TableData.FieldAsString(TableData.FieldIndex['Player']); - Song.Score[Dif, high(Song.Score[Dif])].Score:= StrtoInt(TableData.FieldAsString(TableData.FieldIndex['Score'])); + try + //Search Song in DB + TableData := ScoreDB.GetTable('SELECT `Difficulty`, `Player`, `Score` FROM `'+cUS_Scores+'` WHERE `SongID` = (SELECT `ID` FROM `us_songs` WHERE `Artist` = "' + Song.Artist + '" AND `Title` = "' + Song.Title + '" LIMIT 1) ORDER BY `Score` DESC LIMIT 15'); + + //Empty Old Scores + SetLength (Song.Score[0], 0); + SetLength (Song.Score[1], 0); + SetLength (Song.Score[2], 0); + + while not TableData.Eof do//Go through all Entrys + begin//Add one Entry to Array + Dif := StrtoInt(TableData.FieldAsString(TableData.FieldIndex['Difficulty'])); + if (Dif>=0) AND (Dif<=2) then + begin + SetLength(Song.Score[Dif], Length(Song.Score[Dif]) + 1); + + Song.Score[Dif, high(Song.Score[Dif])].Name := TableData.FieldAsString(TableData.FieldIndex['Player']); + Song.Score[Dif, high(Song.Score[Dif])].Score := StrtoInt(TableData.FieldAsString(TableData.FieldIndex['Score'])); + end; + TableData.Next; + + end; // While not TableData.EOF + + except //Im Fehlerfall + for Dif := 0 to 2 do + begin + SetLength(Song.Score[Dif], 1); + Song.Score[Dif, 1].Name := 'Error Reading ScoreDB'; + end; end; - TableData.Next; - end; - - except //Im Fehlerfall - for Dif := 0 to 2 do - begin - SetLength(Song.Score[Dif], 1); - Song.Score[Dif, 1].Name := 'Error Reading ScoreDB'; - end; - end; - finally + + finally // Try Finally //ScoreDb.Free; end; end; @@ -147,27 +173,30 @@ var ID: Integer; TableData: TSqliteTable; begin + if not assigned( ScoreDB ) then + exit; + //ScoreDB := TSqliteDatabase.Create(sFilename); try //Prevent 0 Scores from being added if (Score > 0) then begin - ID := ScoreDB.GetTableValue('SELECT `ID` FROM `US_Songs` WHERE `Artist` = "' + Song.Artist + '" AND `Title` = "' + Song.Title + '"'); + ID := ScoreDB.GetTableValue('SELECT `ID` FROM `'+cUS_Songs+'` WHERE `Artist` = "' + Song.Artist + '" AND `Title` = "' + Song.Title + '"'); if ID = 0 then //Song doesn't exist -> Create begin - ScoreDB.ExecSQL ('INSERT INTO `US_Songs` ( `ID` , `Artist` , `Title` , `TimesPlayed` ) VALUES (NULL , "' + Song.Artist + '", "' + Song.Title + '", "0");'); + ScoreDB.ExecSQL ('INSERT INTO `'+cUS_Songs+'` ( `ID` , `Artist` , `Title` , `TimesPlayed` ) VALUES (NULL , "' + Song.Artist + '", "' + Song.Title + '", "0");'); ID := ScoreDB.GetTableValue('SELECT `ID` FROM `US_Songs` WHERE `Artist` = "' + Song.Artist + '" AND `Title` = "' + Song.Title + '"'); if ID = 0 then //Could not Create Table exit; end; //Create new Entry - ScoreDB.ExecSQL('INSERT INTO `US_Scores` ( `SongID` , `Difficulty` , `Player` , `Score` ) VALUES ("' + InttoStr(ID) + '", "' + InttoStr(Level) + '", "' + Name + '", "' + InttoStr(Score) + '");'); + ScoreDB.ExecSQL('INSERT INTO `'+cUS_Scores+'` ( `SongID` , `Difficulty` , `Player` , `Score` ) VALUES ("' + InttoStr(ID) + '", "' + InttoStr(Level) + '", "' + Name + '", "' + InttoStr(Score) + '");'); //Delete Last Position when there are more than 5 Entrys - if ScoreDB.GetTableValue('SELECT COUNT(`SongID`) FROM `US_Scores` WHERE `SongID` = "' + InttoStr(ID) + '" AND `Difficulty` = "' + InttoStr(Level) +'"') > 5 then + if ScoreDB.GetTableValue('SELECT COUNT(`SongID`) FROM `'+cUS_Scores+'` WHERE `SongID` = "' + InttoStr(ID) + '" AND `Difficulty` = "' + InttoStr(Level) +'"') > 5 then begin - TableData := ScoreDB.GetTable('SELECT `Player`, `Score` FROM `US_Scores` WHERE SongID = "' + InttoStr(ID) + '" AND `Difficulty` = "' + InttoStr(Level) +'" ORDER BY `Score` ASC LIMIT 1'); + TableData := ScoreDB.GetTable('SELECT `Player`, `Score` FROM `'+cUS_Scores+'` WHERE SongID = "' + InttoStr(ID) + '" AND `Difficulty` = "' + InttoStr(Level) +'" ORDER BY `Score` ASC LIMIT 1'); ScoreDB.ExecSQL('DELETE FROM `US_Scores` WHERE SongID = "' + InttoStr(ID) + '" AND `Difficulty` = "' + InttoStr(Level) +'" AND `Player` = "' + TableData.FieldAsString(TableData.FieldIndex['Player']) + '" AND `Score` = "' + TableData.FieldAsString(TableData.FieldIndex['Score']) + '"'); end; @@ -182,9 +211,12 @@ end; //-------------------- procedure TDataBaseSystem.WriteScore(var Song: TSong); begin + if not assigned( ScoreDB ) then + exit; + try //Increase TimesPlayed - ScoreDB.ExecSQL ('UPDATE `us_songs` SET `TimesPlayed` = `TimesPlayed` + "1" WHERE `Title` = "' + Song.Title + '" AND `Artist` = "' + Song.Artist + '";'); + ScoreDB.ExecSQL ('UPDATE `'+cUS_Songs+'` SET `TimesPlayed` = `TimesPlayed` + "1" WHERE `Title` = "' + Song.Title + '" AND `Artist` = "' + Song.Artist + '";'); except end; @@ -205,6 +237,9 @@ var begin Result := False; + if not assigned( ScoreDB ) then + exit; + if (Length(Stats) < Count) then Exit; @@ -212,10 +247,10 @@ begin //Create Query Case Typ of - 0: Query := 'SELECT `Player` , `Difficulty` , `Score` , `Artist` , `Title` FROM `US_Scores` INNER JOIN `US_Songs` ON (`SongID` = `ID`) ORDER BY `Score`'; - 1: Query := 'SELECT `Player` , ROUND (Sum(`Score`) / COUNT(`Score`)) FROM `US_Scores` GROUP BY `Player` ORDER BY (Sum(`Score`) / COUNT(`Score`))'; - 2: Query := 'SELECT `Artist` , `Title` , `TimesPlayed` FROM `US_Songs` ORDER BY `TimesPlayed`'; - 3: Query := 'SELECT `Artist` , Sum(`TimesPlayed`) FROM `US_Songs` GROUP BY `Artist` ORDER BY Sum(`TimesPlayed`)'; + 0: Query := 'SELECT `Player` , `Difficulty` , `Score` , `Artist` , `Title` FROM `'+cUS_Scores+'` INNER JOIN `US_Songs` ON (`SongID` = `ID`) ORDER BY `Score`'; + 1: Query := 'SELECT `Player` , ROUND (Sum(`Score`) / COUNT(`Score`)) FROM `'+cUS_Scores+'` GROUP BY `Player` ORDER BY (Sum(`Score`) / COUNT(`Score`))'; + 2: Query := 'SELECT `Artist` , `Title` , `TimesPlayed` FROM `'+cUS_Scores+'` ORDER BY `TimesPlayed`'; + 3: Query := 'SELECT `Artist` , Sum(`TimesPlayed`) FROM `'+cUS_Scores+'` GROUP BY `Artist` ORDER BY Sum(`TimesPlayed`)'; end; //Add Order Direction @@ -284,15 +319,43 @@ end; Function TDataBaseSystem.GetTotalEntrys(const Typ: Byte): Cardinal; var Query: String; begin - //Create Query - Case Typ of - 0: Query := 'SELECT COUNT(`SongID`) FROM `US_Scores`;'; - 1: Query := 'SELECT COUNT(DISTINCT `Player`) FROM `US_Scores`;'; - 2: Query := 'SELECT COUNT(`ID`) FROM `US_Songs`;'; - 3: Query := 'SELECT COUNT(DISTINCT `Artist`) FROM `US_Songs`;'; + if not assigned( ScoreDB ) then + exit; + try + //Create Query + Case Typ of + 0: begin + Query := 'SELECT COUNT(`SongID`) FROM `'+cUS_Scores+'`;'; + if not ScoreDB.TableExists( cUS_Scores ) then + exit; + end; + 1: begin + Query := 'SELECT COUNT(DISTINCT `Player`) FROM `'+cUS_Scores+'`;'; + if not ScoreDB.TableExists( cUS_Scores ) then + exit; + end; + 2: begin + Query := 'SELECT COUNT(`ID`) FROM `'+cUS_Scores+'`;'; + if not ScoreDB.TableExists( cUS_Songs ) then + exit; + end; + 3: begin + Query := 'SELECT COUNT(DISTINCT `Artist`) FROM `'+cUS_Songs+'`;'; + if not ScoreDB.TableExists( cUS_Songs ) then + exit; + end; + end; + + Result := ScoreDB.GetTableValue(Query); + except + // TODO : JB_Linux - Why do we get these exceptions on linux !! + on E:ESQLiteException DO // used to handle : Could not retrieve data "SELECT COUNT(`ID`) FROM `US_Songs`;" : SQL logic error or missing database + // however, we should pre-empt this error... and make sure the database DOES exist. + begin + result := 0; + end; end; - Result := ScoreDB.GetTableValue(Query); end; end. diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 0a3c1d02..859d5026 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1,2041 +1,2067 @@ -unit UScreenSong; - -interface -{$I switches.inc} - -uses - UMenu, - SDL, - UMusic, - UFiles, - UTime, - UDisplay, - USongs, - SysUtils, - ULog, - UThemes, - UTexture, - ULanguage, - ULCD, - ULight, - UIni; - -type - TScreenSong = class(TMenu) - public - TextArtist: integer; - TextTitle: integer; - TextNumber: integer; - - //Video Icon Mod - VideoIcon: Cardinal; - - TextCat: integer; - StaticCat: integer; - - SongCurrent: real; - SongTarget: real; - - HighSpeed: boolean; - CoverFull: boolean; - CoverTime: real; - CoverX: integer; - CoverY: integer; - CoverW: integer; - is_jump: boolean; // Jump to Song Mod - is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title - - EqualizerBands: array of Byte; - EqualizerTime: Cardinal; - EqualizerTime2: Byte; - - //Party Mod - Mode: Byte; //0 = Standard, 1= Go to PartyMode after Selection + Change to Random Song at Show - //party Statics (Joker) - StaticTeam1Joker1: Cardinal; - StaticTeam1Joker2: Cardinal; - StaticTeam1Joker3: Cardinal; - StaticTeam1Joker4: Cardinal; - StaticTeam1Joker5: Cardinal; - - StaticTeam2Joker1: Cardinal; - StaticTeam2Joker2: Cardinal; - StaticTeam2Joker3: Cardinal; - StaticTeam2Joker4: Cardinal; - StaticTeam2Joker5: Cardinal; - - StaticTeam3Joker1: Cardinal; - StaticTeam3Joker2: Cardinal; - StaticTeam3Joker3: Cardinal; - StaticTeam3Joker4: Cardinal; - StaticTeam3Joker5: Cardinal; - - StaticParty: Array of Cardinal; - TextParty: Array of Cardinal; - StaticNonParty: Array of Cardinal; - TextNonParty: Array of Cardinal; - - - constructor Create; override; - procedure SetScroll; - procedure SetScroll1; - procedure SetScroll2; - procedure SetScroll3; - procedure SetScroll4; - procedure SetScroll5; - procedure SetScroll6; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure onShow; override; - procedure onHide; override; - procedure SelectNext; - procedure SelectPrev; - procedure UpdateLCD; - procedure SkipTo(Target: Cardinal); - procedure FixSelected; //Show Wrong Song when Tabs on Fix - procedure FixSelected2; //Show Wrong Song when Tabs on Fix - procedure ShowCatTL(Cat: Integer);// Show Cat in Top left - procedure ShowCatTLCustom(Caption: String);// Show Custom Text in Top left - procedure HideCatTL;// Show Cat in Tob left - procedure Refresh; //Refresh Song Sorting - procedure DrawEqualizer; - procedure ChangeMusic; - //Party Mode - procedure SelectRandomSong; - procedure SetJoker; - procedure SetStatics; - //procedures for Menu - procedure StartSong; - procedure OpenEditor; - procedure DoJoker(Team: Byte); - procedure SelectPlayers; - - procedure UnLoadDetailedCover; - - //Extensions - procedure DrawExtensions; - end; - -implementation -uses UGraphic, - UMain, - UCovers, - math, - OpenGL12, - {$IFDEF win32} - windows, - {$ELSE} - lclintf, - {$ENDIF} - USkins, - UDLLManager, - UParty, - UPlaylist, - UScreenSongMenu; - -// ***** Public methods ****** // - -//Show Wrong Song when Tabs on Fix -procedure TScreenSong.FixSelected; -var I, I2: Integer; - begin - if CatSongs.VisibleSongs > 0 then - begin - I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do - begin - if CatSongs.Song[I].Visible then - inc(I2); - - if I = Interaction - 1 then - break; - end; - - SongCurrent := I2; - SongTarget := I2; - end; - end; - -procedure TScreenSong.FixSelected2; -var I, I2: Integer; - begin - if CatSongs.VisibleSongs > 0 then - begin - I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do - begin - if CatSongs.Song[I].Visible then - inc(I2); - - if I = Interaction - 1 then - break; - end; - - SongTarget := I2; - end; - end; -//Show Wrong Song when Tabs on Fix End - - procedure TScreenSong.ShowCatTLCustom(Caption: String);// Show Custom Text in Top left - begin - Text[TextCat].Text := Caption; - Text[TextCat].Visible := true; - Static[StaticCat].Visible := False; - end; - - //Show Cat in Top Left Mod - procedure TScreenSong.ShowCatTL(Cat: Integer); - begin - //Change - Text[TextCat].Text := CatSongs.Song[Cat].Artist; - //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover); - //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); - - Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); - //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false); - //Button[Cat]. - //Cover - - - //Show - Text[TextCat].Visible := true; - Static[StaticCat].Visible := True; - end; - - procedure TScreenSong.HideCatTL; - begin - //Hide - //Text[TextCat].Visible := false; - Static[StaticCat].Visible := false; - //New -> Show Text specified in Theme - Text[TextCat].Visible := True; - Text[TextCat].Text := Theme.Song.TextCat.Text; - end; - //Show Cat in Top Left Mod End - - -// Method for input parsing. If False is returned, GetNextWindow -// should be checked to know the next window to load; -function TScreenSong.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -var - I: integer; - I2: integer; - HS: integer; - SDL_ModState: Word; - Letter: Char; -begin - Result := true; - - //Song Screen Extensions (Jumpto + Menu) - if (ScreenSongMenu.Visible) then - begin - Result := ScreenSongMenu.ParseInput(PressedKey, ScanCode, PressedDown); - Exit; - end - else if (ScreenSongJumpto.Visible) then - begin - Result := ScreenSongJumpto.ParseInput(PressedKey, ScanCode, PressedDown); - Exit; - end; - - If (PressedDown) Then - begin // Key Down - - SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT - + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); - - //Jump to Artist/Titel - if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then - begin - Letter := UpCase(Chr(ScanCode)); - I2 := Length(CatSongs.Song); - - //Jump To Titel - if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then - begin - For I := 1 to high(CatSongs.Song) do - begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then - begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - - Music.PlayChange; - - ChangeMusic; - SetScroll4; - UpdateLCD; - //Break and Exit - Exit; - end; - end; - end - //Jump to Artist - else if (SDL_ModState = KMOD_LALT) then - begin - For I := 1 to high(CatSongs.Song) do - begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Artist[1]) = Letter) then - begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - - Music.PlayChange; - - ChangeMusic; - SetScroll4; - UpdateLCD; - - //Break and Exit - Exit; - end; - end; - end; - Exit; - end; - - case PressedKey of - SDLK_Q: - begin - Result := false; - end; - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - if (Mode = 0) then - begin - //On Escape goto Cat-List Hack - if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then - begin - //Find Category - I := Interaction; - while not catsongs.Song[I].Main do - begin - Dec (I); - if (I < low(catsongs.Song)) then - break; - end; - if (I<= 1) then - Interaction := high(catsongs.Song) - else - Interaction := I - 1; - - //Stop Music - Music.Stop; - - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - HideCatTL; - - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - //SelectPrev; - //CatSongs.Song[0].Visible := False; - end - else - begin - //On Escape goto Cat-List Hack End - //Tabs off and in Search or Playlist -> Go back to Song view - if (CatSongs.CatNumShow < -1) then - begin - //Atm: Set Empty Filter - CatSongs.SetFilter('', 0); - - //Show Cat in Top Left Mod - HideCatTL; - Interaction := 0; - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - - ChangeMusic; - end - else - begin - Music.Stop; - Music.PlayBack; - - FadeTo(@ScreenMain); - end; - - end; - end - //When in party Mode then Ask before Close - else if (Mode = 1) then - begin - Music.PlayBack; - CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); - end; - end; - SDLK_RETURN: - begin - if Length(Songs.Song) > 0 then - begin - {$IFDEF UseSerialPort} - // PortWriteB($378, 0); - {$ENDIF} - if CatSongs.Song[Interaction].Main then - begin // clicked on Category Button - - //Show Cat in Top Left Mod - ShowCatTL (Interaction); - - //I := CatSongs.VisibleIndex(Interaction); - CatSongs.ClickCategoryButton(Interaction); - {I2 := CatSongs.VisibleIndex(Interaction); - SongCurrent := SongCurrent - I + I2; - SongTarget := SongTarget - I + I2; } - -// if I<>I2 then beep; - // SetScroll4; - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - - //Play Music: - ChangeMusic; - - end else begin // clicked on song - if (Mode = 0) then //Normal Mode -> Start Song - begin - //Do the Action that is specified in Ini - case Ini.OnSongClick of - 0: StartSong; - 1: SelectPlayers; - 2:begin - If (CatSongs.CatNumShow = -3) then - ScreenSongMenu.MenuShow(SM_Playlist) - else - ScreenSongMenu.MenuShow(SM_Main); - end; - end; - end - else if (Mode = 1) then //PartyMode -> Show Menu - begin - if (Ini.PartyPopup = 1) then - ScreenSongMenu.MenuShow(SM_Party_Main) - else - ScreenSong.StartSong; - end; - end; - end; - end; - - SDLK_M: //Show SongMenu - begin - if (Length(Songs.Song) > 0) then begin - if (Mode = 0) then begin - if not CatSongs.Song[Interaction].Main then begin // clicked on Song - if CatSongs.CatNumShow = -3 then - ScreenSongMenu.MenuShow(SM_Playlist) - else - ScreenSongMenu.MenuShow(SM_Main); - end - else - begin - ScreenSongMenu.MenuShow(SM_Playlist_Load); - end; - end //Party Mode -> Show Party Menu - else ScreenSongMenu.MenuShow(SM_Party_Main); - end; - end; - - SDLK_P: //Show Playlist Menu - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin - ScreenSongMenu.MenuShow(SM_Playlist_Load); - end; - end; - - SDLK_J: //Show Jumpto Menu - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then - begin - ScreenSongJumpto.Visible := True; - end; - end; - - SDLK_DOWN: - begin - if (Mode = 0) then - begin - //Only Change Cat when not in Playlist or Search Mode - if (CatSongs.CatNumShow > -2) then - begin - //Cat Change Hack - if Ini.Tabs_at_startup = 1 then - begin - I := Interaction; - if I <= 0 then I := 1; - - while not catsongs.Song[I].Main do - begin - Inc (I); - if (I > high(catsongs.Song)) then - I := low(catsongs.Song); - end; - - Interaction := I; - - //Show Cat in Top Left Mod - ShowCatTL (Interaction); - - CatSongs.ClickCategoryButton(Interaction); - SelectNext; - FixSelected; - - //Play Music: - Music.PlayChange; - ChangeMusic; - - end; - - // - //Cat Change Hack End} - end; - end; - end; - SDLK_UP: - begin - if (Mode = 0) then - begin - //Only Change Cat when not in Playlist or Search Mode - if (CatSongs.CatNumShow > -2) then - begin - //Cat Change Hack - if Ini.Tabs_at_startup = 1 then - begin - I := Interaction; - I2 := 0; - if I <= 0 then I := 1; - - while not catsongs.Song[I].Main or (I2 = 0) do - begin - if catsongs.Song[I].Main then - Inc(I2); - Dec (I); - if (I < low(catsongs.Song)) then - I := high(catsongs.Song); - end; - - Interaction := I; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - FixSelected; - - //Play Music: - Music.PlayChange; - ChangeMusic; - end; - end; - //Cat Change Hack End} - end; - end; - - SDLK_RIGHT: - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin - Music.PlayChange; - SelectNext; -// InteractNext; -// SongTarget := Interaction; - ChangeMusic; - SetScroll4; - UpdateLCD; - Light.LightOne(1, 200); - end; - end; - - SDLK_LEFT: - begin - if (Length(Songs.Song) > 0)AND (Mode = 0) then begin - Music.PlayChange; - SelectPrev; - ChangeMusic; - SetScroll4; - UpdateLCD; - Light.LightOne(0, 200); - end; - end; - - SDLK_E: - begin - OpenEditor; - end; - - SDLK_R: - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin - - if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category - begin - I2 := 0; //Count Cats - for I:= low(CatSongs.Song) to high (CatSongs.Song) do - if CatSongs.Song[I].Main then Inc(I2); - - I2 := Random (I2)+1; //Zufall - - //Find Cat: - for I:= low(CatSongs.Song) to high (CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - Dec(I2); - if (I2<=0) then - begin - //Show Cat in Top Left Mod - ShowCatTL (I); - - Interaction := I; - - CatSongs.ShowCategoryList; - CatSongs.ClickCategoryButton(I); - SelectNext; - FixSelected; - break; - end; - end; - - - end - else if (SDL_ModState = KMOD_LCTRL) AND (Ini.Tabs_at_startup = 1) then //random in All Categorys - begin - repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; - - //Search Cat - for I := I2 downto low(CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - break; - end; - //In I ist jetzt die Kategorie in I2 der Song - - //Choose Cat - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - - //Fix: Not Existing Song selected: - //if (I+1=I2) then Inc(I2); - - //Choose Song - SkipTo(I2-I); - - end - else //Random in one Category - begin - SkipTo(Random(CatSongs.VisibleSongs)); - end; - Music.PlayChange; - - ChangeMusic; - SetScroll4; - UpdateLCD; - end; - end; - - SDLK_1: - begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[0].Joker); - SelectRandomSong; - SetJoker; - end; - end; - - SDLK_2: - begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[1].Joker); - SelectRandomSong; - SetJoker; - end; - end; - - SDLK_3: - begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[2].Joker); - SelectRandomSong; - SetJoker; - end; - end; - end; - end; -end; - -constructor TScreenSong.Create; -var - Pet: integer; - I: integer; -Label CreateSongButtons; -begin - inherited Create; - - LoadFromTheme(Theme.Song); - - TextArtist := AddText(Theme.Song.TextArtist); - TextTitle := AddText(Theme.Song.TextTitle); - TextNumber := AddText(Theme.Song.TextNumber); - - //Show Cat in Top Left mod - TextCat := AddText(Theme.Song.TextCat); - StaticCat := AddStatic(Theme.Song.StaticCat); - - //Show Video Icon Mod - VideoIcon := AddStatic(Theme.Song.VideoIcon); - - //Party Mode - StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1); - StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2); - StaticTeam1Joker3 := AddStatic(Theme.Song.StaticTeam1Joker3); - StaticTeam1Joker4 := AddStatic(Theme.Song.StaticTeam1Joker4); - StaticTeam1Joker5 := AddStatic(Theme.Song.StaticTeam1Joker5); - - StaticTeam2Joker1 := AddStatic(Theme.Song.StaticTeam2Joker1); - StaticTeam2Joker2 := AddStatic(Theme.Song.StaticTeam2Joker2); - StaticTeam2Joker3 := AddStatic(Theme.Song.StaticTeam2Joker3); - StaticTeam2Joker4 := AddStatic(Theme.Song.StaticTeam2Joker4); - StaticTeam2Joker5 := AddStatic(Theme.Song.StaticTeam2Joker5); - - StaticTeam3Joker1 := AddStatic(Theme.Song.StaticTeam3Joker1); - StaticTeam3Joker2 := AddStatic(Theme.Song.StaticTeam3Joker2); - StaticTeam3Joker3 := AddStatic(Theme.Song.StaticTeam3Joker3); - StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); - StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); - - //Load Party or NonParty specific Statics and Texts - SetLength(StaticParty, Length(Theme.Song.StaticParty)); - for I := 0 to High(Theme.Song.StaticParty) do - StaticParty[I] := AddStatic(Theme.Song.StaticParty[I]); - - SetLength(TextParty, Length(Theme.Song.TextParty)); - for I := 0 to High(Theme.Song.TextParty) do - TextParty[I] := AddText(Theme.Song.TextParty[I]); - - SetLength(StaticNonParty, Length(Theme.Song.StaticNonParty)); - for I := 0 to High(Theme.Song.StaticNonParty) do - StaticNonParty[I] := AddStatic(Theme.Song.StaticNonParty[I]); - - SetLength(TextNonParty, Length(Theme.Song.TextNonParty)); - for I := 0 to High(Theme.Song.TextNonParty) do - TextNonParty[I] := AddText(Theme.Song.TextNonParty[I]); - - // Song List -// Songs.LoadSongList; // moved to the UltraStar unit - CatSongs.Refresh; - - if (length(CatSongs.Song) > 0) then - begin - //Set Length of Button Array one Time Instead of one time for every Song - SetButtonLength(Length(CatSongs.Song)); - - I := 0; - CreateSongButtons: - - try - for Pet := I to High(CatSongs.Song) do begin // creating all buttons - // new - Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 - - if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then - CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' - - if CatSongs.Song[Pet].Cover = '' then - AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) - else begin - // cache texture if there is a need to this - if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then - begin - Texture.CreateCacheMipmap := true; - Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap - Texture.CreateCacheMipmap := false; - - // puts this texture to the cache file - Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); - - // unload full size texture - Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); - - // we should also add mipmap texture by calling createtexture and use mipmap cache as data source - end; - - // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) - AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); - end; - Texture.Limit := 1024*1024; - I := -1; - end; - except - //When Error is reported the First time for this Song - if (I <> Pet) then - begin - //Some Error reporting: - Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); - - //Change Cover to NoCover and Continue Loading - CatSongs.Song[Pet].Cover := ''; - I := Pet; - end - else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song - begin - Log.LogError('NoCover Cover is damaged!'); - try - AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); - except - {$IFDEF win32} - Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); - {$ELSE} - // TODO : JB_linux - better handle this message and display to user.. - writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'); - Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' ); - {$ENDIF} - Halt; - end; - I := Pet + 1; - end; - end; - - if (I <> -1) then - GoTo CreateSongButtons; - - end; - - // Randomize Patch - Randomize; - //Equalizer - SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); - //ClearArray - For I := low(EqualizerBands) to high(EqualizerBands) do - EqualizerBands[I] := 3; - - if (Length(CatSongs.Song) > 0) then - Interaction := 0; -end; - -procedure TScreenSong.SetScroll; -var - VS, B: Integer; -begin - VS := CatSongs.VisibleSongs; - if VS > 0 then - begin - //Set Positions - Case Theme.Song.Cover.Style of - 3: SetScroll3; - 5:begin - if VS > 5 then - SetScroll5 - else - SetScroll4; - end; - 6: SetScroll6; - else SetScroll4; - end; - //Set Visibility of Video Icon - Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> ''); - - //Set Texts: - Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; - Text[TextTitle].Text := CatSongs.Song[Interaction].Title; - if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then - begin - Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); - Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; - end - else if (CatSongs.CatNumShow = -2) then - Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) - else if (CatSongs.CatNumShow = -3) then - Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) - else if (Ini.Tabs_at_startup = 1) then - Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) - else - Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); - end - else - begin - Text[TextNumber].Text := '0/0'; - Text[TextArtist].Text := ''; - Text[TextTitle].Text := ''; - for B := 0 to High(Button) do - Button[B].Visible := False; - - end; -end; - -procedure TScreenSong.SetScroll1; -var - B: integer; // button - BMin: integer; // button min - BMax: integer; // button max - Src: integer; -// Dst: integer; - Count: integer; // Dst is not used. Count is used. - Ready: boolean; - - VisCount: integer; // count of visible (or selectable) buttons - VisInt: integer; // visible position of interacted button - Typ: integer; // 0 when all songs fits the screen - Placed: integer; // number of placed visible buttons -begin -// Src := 0; -// Dst := -1; - Count := 1; - Typ := 0; - Ready := false; - Placed := 0; - - VisCount := 0; - for B := 0 to High(Button) do - if CatSongs.Song[B].Visible then Inc(VisCount); - - VisInt := 0; - for B := 0 to Interaction-1 do - if CatSongs.Song[B].Visible then Inc(VisInt); - - - if VisCount <= 6 then begin - Typ := 0; - end else begin - if VisInt <= 3 then begin - Typ := 1; - Count := 7; - Ready := true; - end; - - if (VisCount - VisInt) <= 3 then begin - Typ := 2; - Count := 7; - Ready := true; - end; - - if not Ready then begin - Typ := 3; - Src := Interaction; - end; - end; - - - - // hide all buttons - for B := 0 to High(Button) do begin - Button[B].Visible := false; - Button[B].Selectable := CatSongs.Song[B].Visible; - end; - -{ for B := Src to Dst do begin -// Button[B].Visible := true; - Button[B].Visible := CatSongs.Song[B].Visible; - Button[B].Selectable := Button[B].Visible; - Button[B].Y := 140 + (B-Src) * 60; - end;} - - - if Typ = 0 then begin - for B := 0 to High(Button) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (Placed) * 60; - Inc(Placed); - end; - end; - end; - - if Typ = 1 then begin - B := 0; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Inc(B); - end; - end; - - if Typ = 2 then begin - B := High(Button); - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (6-Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Dec(B); - end; - end; - - if Typ = 3 then begin - B := Src; - Count := 4; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (3+Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Inc(B); - end; - - B := Src-1; - Placed := 0; - Count := 3; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (2-Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Dec(B); - end; - - end; - - if Length(Button) > 0 then - Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture -end; - -procedure TScreenSong.SetScroll2; -var - B: integer; - Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu - Wsp2: real; -begin - // liniowe - for B := 0 to High(Button) do - Button[B].X := 300 + (B - Interaction) * 260; - - if Length(Button) >= 3 then begin - if Interaction = 0 then - Button[High(Button)].X := 300 - 260; - - if Interaction = High(Button) then - Button[0].X := 300 + 260; - end; - - // kolowe -{ for B := 0 to High(Button) do begin - Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. - Wsp2 := Wsp / Length(Button); - Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); -// Button[B].Y := 140 + 50 * ; - end;} -end; - -procedure TScreenSong.SetScroll3; // with slide -var - B: integer; - Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu - Wsp2: real; -begin - SongTarget := Interaction; - - // liniowe - for B := 0 to High(Button) do - begin - Button[B].X := 300 + (B - SongCurrent) * 260; - if (Button[B].X < -Button[B].W) OR (Button[B].X > 800) then - Button[B].Visible := False - else - Button[B].Visible := True; - end; - -{ if Length(Button) >= 3 then begin - if Interaction = 0 then - Button[High(Button)].X := 300 - 260; - - if Interaction = High(Button) then - Button[0].X := 300 + 260; - end;} - - // kolowe -{ for B := 0 to High(Button) do begin - Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. - Wsp2 := Wsp / Length(Button); - Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); -// Button[B].Y := 140 + 50 * ; - end;} -end; - -procedure TScreenSong.SetScroll4; // rotate -var - B: integer; - Wsp: real; - Z, Z2: real; - VS: integer; -begin - VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important - - // kolowe - for B := 0 to High(Button) do begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2; - Z2 := (1 + 2*Z) / 3; - - - Button[B].X := Theme.Song.Cover.X + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - Button[B].Z := Z / 2 + 0.3; - - Button[B].W := Theme.Song.Cover.H * Z2; - -// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; - Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; - Button[B].H := Button[B].W; - end; - end; -end; - -(* -procedure TScreenSong.SetScroll4; // rotate -var - B: integer; - Wsp: real; - Z: real; - Z2, Z3: real; - VS: integer; - function modreal (const X, Y: real):real; - begin - Result := Frac(x / y) * y; - if Result < -3 then - Result := Result + Y - else if Result > 3 then - Result := Result - Y; - end; -begin - VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important - Z3 := 1; - if VS < 12 then - Z2 := VS - else - Z2 := 12; - - // kolowe - for B := 0 to High(Button) do begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - if ((ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)>-3) AND (ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)<3)) then - begin - if CatSongs.VisibleIndex(B)> SongCurrent then - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2 - else - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2; - - Z3 := 2; - Z := (1 + cos(Wsp)) / 2; - //Z2 := (1 + 2*Z) / 3; - //Z2 := (0.5 + Z/2); - //Z2 := sin(Wsp); - - //Z2 := Power (Z2,Z3); - - Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); - - //Button[B].X := Theme.Song.CoverX + ({Theme.Song.CoverX + Theme.Song.CoverW/2 + Theme.Song.CoverW*0.18 * VS {CatSongs.VisibleSongs {Length(Button) * sin(Wsp) {- Theme.Song.CoverX - Theme.Song.CoverW) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - if (sin(Wsp)<0) then - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W - else //*Theme.Song.CoverW*0.004*Z3 - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; - Button[B].Z := Z-0.00001; - -// Button[B].Y := {50 + 140 + 50 - 50 * Z2; - // Button[B].Y := (Theme.Song.CoverY + 40 + 50 - 50 * Z2); - Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); - Button[B].H := Button[B].W; - Button[B].Visible := True; - end - {else if (((CatSongs.VisibleIndex(B) - SongCurrent)>-3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) OR ((round (CatSongs.VisibleIndex(B) - SongCurrent) mod VS > -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) then - begin - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / 12 ;// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2 -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); - - if (sin(Wsp)<0) then - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W - else - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; - - Button[B].Z := Z; - - Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); - - Button[B].H := Button[B].W; - Button[B].Visible := True; - end - else Button[B].Visible := False; - end; - end; -end; *) - -procedure TScreenSong.SetScroll5; // rotate -var - B: integer; - Angle: real; - Pos: Real; - VS: integer; - diff: real; - X: Real; - helper: real; -begin - VS := CatSongs.VisibleSongs; // cache Visible Songs - {Vars - Theme.Song.CoverW: Radius des Kreises - Theme.Song.CoverX: X Pos Linke Kante des gewählten Covers - Theme.Song.CoverX: Y Pos Obere Kante des gewählten Covers - Theme.Song.CoverH: Höhe der Cover - - (CatSongs.VisibleIndex(B) - SongCurrent)/VS = Abstand zum MIttleren Cover in % - } - - //Change Pos of all Buttons - for B := low(Button) to high(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility - if Button[B].Visible then //Only Change Pos for Visible Buttons - begin - Pos := (CatSongs.VisibleIndex(B) - SongCurrent); - if (Pos < -VS/2) then - Pos := Pos + VS - else if (Pos > VS/2) then - Pos := Pos - VS; - - if (Abs(Pos) < 2.5) then {fixed Positions} - begin - Angle := Pi * (Pos / 5); -// Button[B].Visible := False; - - Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); - -// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Z := 0.95 - Abs(Pos) * 0.01; - - Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); - - Button[B].W := Button[B].H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - - X := Sin(Angle*1.3)*0.9; - - Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Diff; - - end - else - begin {Behind the Front Covers} - - // limit-bg-covers hack - if (abs(abs(Pos)-VS/2)>10) then Button[B].Visible:=False; - // end of limit-bg-covers hack - - if Pos < 0 then - Pos := (Pos - VS/2)/VS - else - Pos := (Pos + VS/2)/VS; - - Angle := pi * Pos*2; - if VS > 24 then - begin - if Angle < 0 then helper:=-1 else helper:=1; - Angle:=2*pi-abs(Angle); - Angle:=Angle*(VS/24); - Angle:=(2*pi-Angle)*helper; - end; - - Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); - - Button[B].W := Button[B].H; - - Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; - -// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*((Theme.Song.Cover.H)*sin(Angle/2)*1.52); - - end; - - //Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field -// Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); - - end; - end; -end; - -procedure TScreenSong.SetScroll6; // rotate (slotmachine style) -var - B: integer; - Angle: real; - Pos: Real; - VS: integer; - diff: real; - X: Real; - Wsp: real; - Z, Z2: real; -begin - VS := CatSongs.VisibleSongs; // cache Visible Songs - if VS <=5 then begin - // kolowe - for B := 0 to High(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2; - Z2 := (1 + 2*Z) / 3; - - - Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - Button[B].Z := Z / 2 + 0.3; - - Button[B].W := Theme.Song.Cover.H * Z2; - -// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; - Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; - Button[B].H := Button[B].W; - end; - end; - end - else begin - - //Change Pos of all Buttons - for B := low(Button) to high(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility - if Button[B].Visible then //Only Change Pos for Visible Buttons - begin - Pos := (CatSongs.VisibleIndex(B) - SongCurrent); - if (Pos < -VS/2) then - Pos := Pos + VS - else if (Pos > VS/2) then - Pos := Pos - VS; - - if (Abs(Pos) < 2.5) then {fixed Positions} - begin - Angle := Pi * (Pos / 5); -// Button[B].Visible := False; - - Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); - - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Z := 0.95 - Abs(Pos) * 0.01; - - Button[B].X := (Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); - - Button[B].W := Button[B].H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - - X := Sin(Angle*1.3)*0.9; - - Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff; - end - else - begin {Behind the Front Covers} - - // limit-bg-covers hack - if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; - if VS > 25 then VS:=25; - // end of limit-bg-covers hack - - if Pos < 0 then - Pos := (Pos - VS/2)/VS - else - Pos := (Pos + VS/2)/VS; - - Angle := pi * Pos*2; - - Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); - - Button[B].W := Button[B].H; - - Button[B].X := Theme.Song.Cover.X - (Button[B].H - Theme.Song.Cover.H)*0.5; - - - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Y := Theme.Song.Cover.Y+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*(Theme.Song.Cover.H*sin(Angle/2)*1.52); - end; - end; - end; - end; -end; - - -procedure TScreenSong.onShow; -begin - Music.Stop; - - if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; - if Ini.Players = 4 then PlayersPlay := 6; - - //Cat Mod etc - if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then - begin - CatSongs.ShowCategoryList; - FixSelected; - //Show Cat in Top Left Mod - HideCatTL; - end; - - - if Length(CatSongs.Song) > 0 then begin - //Load Music only when Song Preview is activated - if (Ini.PreviewVolume <> 0) then - begin - Music.SetLoop(false); - Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); - Music.MoveTo(Music.Length / 4); - Music.Play; - - //Set Preview Volume - Music.SetMusicVolume (Ini.PreviewVolume * 10); - {//if Music Fade is activated, Set Volume to 0 % - if (Ini.PreviewFading <> 0) then - Music.SetMusicVolume(0);} - end; - - SetScroll; - UpdateLCD; - end; - - //Playlist Mode - if (Mode = 0) then - begin - //If Playlist Shown -> Select Next automatically - if (CatSongs.CatNumShow = -3) then - begin - SelectNext; - ChangeMusic; - end; - end - //Party Mode - else if (Mode = 1) then - begin - - SelectRandomSong; - //Show Menu directly in PartyMode - //But only if selected in Options - if (Ini.PartyPopup = 1) then - begin - ScreenSongMenu.MenuShow(SM_Party_Main); - end; - - - end; - - SetJoker; - SetStatics; -end; - -procedure TScreenSong.onHide; -begin - //When Music Fading is activated, Turn Music to 100 % - If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then - Music.SetMusicVolume(100); - - //If Preview is deactivated: Load MUsicfile now - If (Ini.PreviewVolume = 0) then - Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); - - //When hide then Stop Music (For Party Mode Popup on Exit) - if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then - Music.Stop; -end; - -procedure TScreenSong.DrawExtensions; -begin - //Draw Song Menu - if (ScreenSongMenu.Visible) then - begin - ScreenSongMenu.Draw; - end - else if (ScreenSongJumpto.Visible) then - begin - ScreenSongJumpto.Draw; - end -end; - -function TScreenSong.Draw: boolean; -var - dx: real; - dt: real; - I: Integer; -begin - dx := SongTarget-SongCurrent; - dt := TimeSkip*7; - if dt > 1 then dt := 1; - SongCurrent := SongCurrent + dx*dt; - -{ if SongCurrent > Catsongs.VisibleSongs then begin - SongCurrent := SongCurrent - Catsongs.VisibleSongs; - SongTarget := SongTarget - Catsongs.VisibleSongs; - end;} - -// Log.BenchmarkStart(5); - SetScroll; -// Log.BenchmarkEnd(5); -// Log.LogBenchmark('SetScroll4', 5); - - //Fading Functions, Only if Covertime is under 5 Seconds - If (CoverTime < 5) then - begin - // 0.5.0: cover fade - if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin - // load new texture - Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); - Button[Interaction].Texture.Alpha := 1; - Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); - Button[Interaction].Texture2.Alpha := 1; - end; - - //Song Fade - if (CatSongs.VisibleSongs > 0) AND (Ini.PreviewVolume <> 0) AND (Not CatSongs.Song[Interaction].Main) AND (Ini.PreviewFading <> 0) then - begin - //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling - if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then - Music.Play; - - //Update Song Volume - if (CoverTime < Ini.PreviewFading) then - Music.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) - else - Music.SetMusicVolume(Ini.PreviewVolume * 10); - - end; - - - //Update Fading Time - CoverTime := CoverTime + TimeSkip; - - //Update Fading Texture - Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; - if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; - - end; - - //inherited Draw; - //heres a little Hack, that causes the Statics - //are Drawn after the Buttons because of some Blending Problems. - //This should cause no Problems because all Buttons on this screen - //Has Z Position. - //Draw BG - DrawBG; - - //Instead of Draw FG Procedure: - //We draw Buttons for our own - for I := 0 to Length(Button) - 1 do - Button[I].Draw; - - // Statics - for I := 0 to Length(Static) - 1 do - Static[I].Draw; - - // and texts - for I := 0 to Length(Text) - 1 do - Text[I].Draw; - - - //Draw Equalizer - if Theme.Song.Equalizer.Visible then - DrawEqualizer; - - DrawExtensions; - -end; - -procedure TScreenSong.SelectNext; -var - Skip: integer; - I: integer; - VS: Integer; -begin - VS := CatSongs.VisibleSongs; - - if VS > 0 then - begin - UnLoadDetailedCover; - - Skip := 1; - - // this 1 could be changed by CatSongs.FindNextVisible - while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); - - SongTarget := SongTarget + 1;//Skip; - - Interaction := (Interaction + Skip) mod Length(Interactions); - - // try to keep all at the beginning - if SongTarget > VS-1 then begin - SongTarget := SongTarget - VS; - SongCurrent := SongCurrent - VS; - end; - - end; - // Interaction -> Button, ktorego okladke przeczytamy - // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture -end; - -procedure TScreenSong.SelectPrev; -var - Skip: integer; - I: integer; - VS: Integer; -begin - VS := CatSongs.VisibleSongs; - - if VS > 0 then - begin - UnLoadDetailedCover; - - Skip := 1; - - while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); - SongTarget := SongTarget - 1;//Skip; - - Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); - - // try to keep all at the beginning - if SongTarget < 0 then begin - SongTarget := SongTarget + CatSongs.VisibleSongs; - SongCurrent := SongCurrent + CatSongs.VisibleSongs; - end; - - // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture - end; -end; - -procedure TScreenSong.UpdateLCD; -begin - LCD.HideCursor; - LCD.Clear; - LCD.WriteText(1, Text[TextArtist].Text); - LCD.WriteText(2, Text[TextTitle].Text); -end; - -//Procedure Change current played Preview -procedure TScreenSong.ChangeMusic; -begin - //When Music Preview is avtivated -> then Change Music - if (Ini.PreviewVolume <> 0) then - begin - if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then - begin - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); - //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal - if (Ini.PreviewFading = 0) then - Music.Play - else - Music.SetMusicVolume(0); - end; - end - else - Music.Stop; - end; -end; - -procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0 -var - Skip: integer; - I: integer; -begin - UnLoadDetailedCover; - - Interaction := High(CatSongs.Song); - SongTarget := 0; - - for I := 1 to Target+1 do - SelectNext; - - FixSelected2; -end; - -procedure TScreenSong.DrawEqualizer; -var - Data: TFFTData; //Audio Data - I, J: Integer; - Res: byte; - A, B: Integer; - PosX, PosY: Integer; - Pos: Real; -begin -if (not Music.Finished) AND (Theme.Song.Equalizer.Length > 0) then -begin - - - A := GetTickCount div 44; - - if (A <> EqualizerTime) then - begin - EqualizerTime := A; - Data := Music.GetFFTData; - - B:=0; - Pos := 0; - Res := ceil(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band - - //Change Lengths - for I := 0 to (Res * Theme.Song.Equalizer.Bands - 1) do - begin - A := floor(I/Res); - - if (A<>B) then //Band changed - begin - if (Pos <= Theme.Song.Equalizer.Length) then - begin - if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then - EqualizerBands[B] := EqualizerBands[B] - 1 - else - EqualizerBands[B] := floor(Pos); - end - else - EqualizerBands[B] := 1; - - B := A; - Pos := 0; - end; - - if I > 35 then - Data[i] := Data[i] * 8 - else if I > 11 then - Data[i] := Data[i] * 4.5 - else - Data[i] := Data[i] * 1.1; - - if (Data[i] >= 1) then - Data[i] := 0.9999999999999; - - if Data[i]*Theme.Song.Equalizer.Length > Pos then - Pos := Data[i]*Theme.Song.Equalizer.Length; - end; - - //Change Last Band - if (EqualizerBands[B] <= Theme.Song.Equalizer.Length) then - begin - if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then - EqualizerBands[B] := EqualizerBands[B] - 1 - else - EqualizerBands[B] := floor(Pos) - end - else - EqualizerBands[B] := 1; - end; - - //Draw every Channel - glColor4f(Theme.Song.Equalizer.ColR, Theme.Song.Equalizer.ColG, Theme.Song.Equalizer.ColB, Theme.Song.Equalizer.Alpha); //Set Color - glDisable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - - PosY := Theme.Song.Equalizer.Y; - PosX := Theme.Song.Equalizer.X; - - For I := 0 to Theme.Song.Equalizer.Bands-1 do - begin - if Theme.Song.Equalizer.Direction then - PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length - else - PosX := Theme.Song.Equalizer.X; - //Draw for every visible quad - for J := 1 to EqualizerBands[I] do - begin - glBegin(GL_QUADS); - glVertex3f(PosX, PosY, Theme.Song.Equalizer.Z); - glVertex3f(PosX, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); - glVertex3f(PosX+Theme.Song.Equalizer.W, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); - glVertex3f(PosX+Theme.Song.Equalizer.W, PosY, Theme.Song.Equalizer.Z); - glEnd; - - if Theme.Song.Equalizer.Direction then //Vertically - PosY := PosY - Theme.Song.Equalizer.H - Theme.Song.Equalizer.Space - else //Horizontally - PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space; - end; - if Theme.Song.Equalizer.Direction then //Horizontally - PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space - else //Vertically - PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space; - end; -end; -end; - -Procedure TScreenSong.SelectRandomSong; -var - I, I2: Integer; -begin - Case PlaylistMan.Mode of - 0: //All Songs Just Select Random Song - begin - //When Tabs are activated then use Tab Method - if (Ini.Tabs_at_startup = 1) then - begin - repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; - - //Search Cat - for I := I2 downto low(CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - break; - end; - //In I ist jetzt die Kategorie in I2 der Song - //I is the CatNum, I2 is the No of the Song within this Cat - - //Choose Cat - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - - //Choose Song - SkipTo(I2-I); - end - //When Tabs are deactivated use easy Method - else - SkipTo(Random(CatSongs.VisibleSongs)); - end; - 1: //One Category Select Category and Select Random Song - begin - CatSongs.ShowCategoryList; - CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); - ShowCatTL(PlaylistMan.CurPlayList); - - SelectNext; - FixSelected2; - - SkipTo(Random(CatSongs.VisibleSongs)); - end; - 2: //Playlist: Select Playlist and Select Random Song - begin - PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); - - SkipTo(Random(CatSongs.VisibleSongs)); - FixSelected2; - end; - end; - - Music.PlayChange; - ChangeMusic; - SetScroll; - UpdateLCD; -end; - -procedure TScreenSong.SetJoker; -begin - //If Party Mode - if Mode = 1 then //Show Joker that are available - begin - if (PartySession.Teams.NumTeams >= 1) then - begin - Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1); - Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2); - Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3); - Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4); - Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5); - end - else - begin - Static[StaticTeam1Joker1].Visible := False; - Static[StaticTeam1Joker2].Visible := False; - Static[StaticTeam1Joker3].Visible := False; - Static[StaticTeam1Joker4].Visible := False; - Static[StaticTeam1Joker5].Visible := False; - end; - - if (PartySession.Teams.NumTeams >= 2) then - begin - Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1); - Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2); - Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3); - Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4); - Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5); - end - else - begin - Static[StaticTeam2Joker1].Visible := False; - Static[StaticTeam2Joker2].Visible := False; - Static[StaticTeam2Joker3].Visible := False; - Static[StaticTeam2Joker4].Visible := False; - Static[StaticTeam2Joker5].Visible := False; - end; - - if (PartySession.Teams.NumTeams >= 3) then - begin - Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1); - Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2); - Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3); - Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4); - Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5); - end - else - begin - Static[StaticTeam3Joker1].Visible := False; - Static[StaticTeam3Joker2].Visible := False; - Static[StaticTeam3Joker3].Visible := False; - Static[StaticTeam3Joker4].Visible := False; - Static[StaticTeam3Joker5].Visible := False; - end; - end - else - begin //Hide all - Static[StaticTeam1Joker1].Visible := False; - Static[StaticTeam1Joker2].Visible := False; - Static[StaticTeam1Joker3].Visible := False; - Static[StaticTeam1Joker4].Visible := False; - Static[StaticTeam1Joker5].Visible := False; - - Static[StaticTeam2Joker1].Visible := False; - Static[StaticTeam2Joker2].Visible := False; - Static[StaticTeam2Joker3].Visible := False; - Static[StaticTeam2Joker4].Visible := False; - Static[StaticTeam2Joker5].Visible := False; - - Static[StaticTeam3Joker1].Visible := False; - Static[StaticTeam3Joker2].Visible := False; - Static[StaticTeam3Joker3].Visible := False; - Static[StaticTeam3Joker4].Visible := False; - Static[StaticTeam3Joker5].Visible := False; - end; -end; - -procedure TScreenSong.SetStatics; -var - I: Integer; - Visible: Boolean; -begin - //Set Visibility of Party Statics and Text - Visible := (Mode = 1); - - For I := 0 to high(StaticParty) do - Static[StaticParty[I]].Visible := Visible; - - For I := 0 to high(TextParty) do - Text[TextParty[I]].Visible := Visible; - - //Set Visibility of Non Party Statics and Text - Visible := not Visible; - - For I := 0 to high(StaticNonParty) do - Static[StaticNonParty[I]].Visible := Visible; - - For I := 0 to high(TextNonParty) do - Text[TextNonParty[I]].Visible := Visible; -end; - -//Procedures for Menu - -procedure TScreenSong.StartSong; -begin - CatSongs.Selected := Interaction; - Music.Stop; - //Party Mode - if (Mode = 1) then - begin - FadeTo(@ScreenSingModi); - end - else - begin - FadeTo(@ScreenSing); - end; -end; - -procedure TScreenSong.SelectPlayers; -begin - CatSongs.Selected := Interaction; - Music.Stop; - - ScreenName.Goto_SingScreen := True; - FadeTo(@ScreenName); -end; - -procedure TScreenSong.OpenEditor; -begin - if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin - Music.Stop; - Music.PlayStart; - ScreenEditSub.Path := CatSongs.Song[Interaction].Path; - ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName; - FadeTo(@ScreenEditSub); - end; -end; - -//Team No of Team (0-5) -procedure TScreenSong.DoJoker (Team: Byte); -begin - if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[Team].Joker); - SelectRandomSong; - SetJoker; - end; -end; - -//Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song -procedure TScreenSong.UnLoadDetailedCover; -begin - CoverTime := 0; - - Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture - Button[Interaction].Texture2.Alpha := 0; - - if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then - Texture.UnloadTexture(Button[Interaction].Texture.Name, false); -end; - -procedure TScreenSong.Refresh; -begin { -CatSongs.Refresh; -CatSongs.ShowCategoryList; -Interaction := 0; -SelectNext; -FixSelected; } - -end; - -end. +unit UScreenSong; + +interface +{$I switches.inc} + + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +uses + UMenu, + SDL, + UMusic, + UFiles, + UTime, + UDisplay, + USongs, + SysUtils, + ULog, + UThemes, + UTexture, + ULanguage, + ULCD, + ULight, + UIni; + +type + TScreenSong = class(TMenu) + public + TextArtist: integer; + TextTitle: integer; + TextNumber: integer; + + //Video Icon Mod + VideoIcon: Cardinal; + + TextCat: integer; + StaticCat: integer; + + SongCurrent: real; + SongTarget: real; + + HighSpeed: boolean; + CoverFull: boolean; + CoverTime: real; + CoverX: integer; + CoverY: integer; + CoverW: integer; + is_jump: boolean; // Jump to Song Mod + is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title + + EqualizerBands: array of Byte; + EqualizerTime: Cardinal; + EqualizerTime2: Byte; + + //Party Mod + Mode: Byte; //0 = Standard, 1= Go to PartyMode after Selection + Change to Random Song at Show + //party Statics (Joker) + StaticTeam1Joker1: Cardinal; + StaticTeam1Joker2: Cardinal; + StaticTeam1Joker3: Cardinal; + StaticTeam1Joker4: Cardinal; + StaticTeam1Joker5: Cardinal; + + StaticTeam2Joker1: Cardinal; + StaticTeam2Joker2: Cardinal; + StaticTeam2Joker3: Cardinal; + StaticTeam2Joker4: Cardinal; + StaticTeam2Joker5: Cardinal; + + StaticTeam3Joker1: Cardinal; + StaticTeam3Joker2: Cardinal; + StaticTeam3Joker3: Cardinal; + StaticTeam3Joker4: Cardinal; + StaticTeam3Joker5: Cardinal; + + StaticParty: Array of Cardinal; + TextParty: Array of Cardinal; + StaticNonParty: Array of Cardinal; + TextNonParty: Array of Cardinal; + + + constructor Create; override; + procedure SetScroll; + procedure SetScroll1; + procedure SetScroll2; + procedure SetScroll3; + procedure SetScroll4; + procedure SetScroll5; + procedure SetScroll6; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure SelectNext; + procedure SelectPrev; + procedure UpdateLCD; + procedure SkipTo(Target: Cardinal); + procedure FixSelected; //Show Wrong Song when Tabs on Fix + procedure FixSelected2; //Show Wrong Song when Tabs on Fix + procedure ShowCatTL(Cat: Integer);// Show Cat in Top left + procedure ShowCatTLCustom(Caption: String);// Show Custom Text in Top left + procedure HideCatTL;// Show Cat in Tob left + procedure Refresh; //Refresh Song Sorting + procedure DrawEqualizer; + procedure ChangeMusic; + //Party Mode + procedure SelectRandomSong; + procedure SetJoker; + procedure SetStatics; + //procedures for Menu + procedure StartSong; + procedure OpenEditor; + procedure DoJoker(Team: Byte); + procedure SelectPlayers; + + procedure UnLoadDetailedCover; + + //Extensions + procedure DrawExtensions; + end; + +implementation +uses UGraphic, + UMain, + UCovers, + math, + OpenGL12, + {$IFDEF win32} + windows, + {$ELSE} + lclintf, + {$ENDIF} + USkins, + UDLLManager, + UParty, + UPlaylist, + UScreenSongMenu; + +// ***** Public methods ****** // + +//Show Wrong Song when Tabs on Fix +procedure TScreenSong.FixSelected; +var I, I2: Integer; + begin + if CatSongs.VisibleSongs > 0 then + begin + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); + + if I = Interaction - 1 then + break; + end; + + SongCurrent := I2; + SongTarget := I2; + end; + end; + +procedure TScreenSong.FixSelected2; +var I, I2: Integer; + begin + if CatSongs.VisibleSongs > 0 then + begin + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); + + if I = Interaction - 1 then + break; + end; + + SongTarget := I2; + end; + end; +//Show Wrong Song when Tabs on Fix End + + procedure TScreenSong.ShowCatTLCustom(Caption: String);// Show Custom Text in Top left + begin + Text[TextCat].Text := Caption; + Text[TextCat].Visible := true; + Static[StaticCat].Visible := False; + end; + + //Show Cat in Top Left Mod + procedure TScreenSong.ShowCatTL(Cat: Integer); + begin + //Change + Text[TextCat].Text := CatSongs.Song[Cat].Artist; + //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover); + //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); + + Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); + //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false); + //Button[Cat]. + //Cover + + + //Show + Text[TextCat].Visible := true; + Static[StaticCat].Visible := True; + end; + + procedure TScreenSong.HideCatTL; + begin + //Hide + //Text[TextCat].Visible := false; + Static[StaticCat].Visible := false; + //New -> Show Text specified in Theme + Text[TextCat].Visible := True; + Text[TextCat].Text := Theme.Song.TextCat.Text; + end; + //Show Cat in Top Left Mod End + + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenSong.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var + I: integer; + I2: integer; + HS: integer; + SDL_ModState: Word; + Letter: Char; +begin + Result := true; + + //Song Screen Extensions (Jumpto + Menu) + if (ScreenSongMenu.Visible) then + begin + Result := ScreenSongMenu.ParseInput(PressedKey, ScanCode, PressedDown); + Exit; + end + else if (ScreenSongJumpto.Visible) then + begin + Result := ScreenSongJumpto.ParseInput(PressedKey, ScanCode, PressedDown); + Exit; + end; + + If (PressedDown) Then + begin // Key Down + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + + //Jump to Artist/Titel + if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then + begin + Letter := UpCase(Chr(ScanCode)); + I2 := Length(CatSongs.Song); + + //Jump To Titel + if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then + begin + For I := 1 to high(CatSongs.Song) do + begin + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + + Music.PlayChange; + + ChangeMusic; + SetScroll4; + UpdateLCD; + //Break and Exit + Exit; + end; + end; + end + //Jump to Artist + else if (SDL_ModState = KMOD_LALT) then + begin + For I := 1 to high(CatSongs.Song) do + begin + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Artist[1]) = Letter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + + Music.PlayChange; + + ChangeMusic; + SetScroll4; + UpdateLCD; + + //Break and Exit + Exit; + end; + end; + end; + Exit; + end; + + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + if (Mode = 0) then + begin + //On Escape goto Cat-List Hack + if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then + begin + //Find Category + I := Interaction; + while not catsongs.Song[I].Main do + begin + Dec (I); + if (I < low(catsongs.Song)) then + break; + end; + if (I<= 1) then + Interaction := high(catsongs.Song) + else + Interaction := I - 1; + + //Stop Music + Music.Stop; + + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + HideCatTL; + + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + //SelectPrev; + //CatSongs.Song[0].Visible := False; + end + else + begin + //On Escape goto Cat-List Hack End + //Tabs off and in Search or Playlist -> Go back to Song view + if (CatSongs.CatNumShow < -1) then + begin + //Atm: Set Empty Filter + CatSongs.SetFilter('', 0); + + //Show Cat in Top Left Mod + HideCatTL; + Interaction := 0; + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + + ChangeMusic; + end + else + begin + Music.Stop; + Music.PlayBack; + + FadeTo(@ScreenMain); + end; + + end; + end + //When in party Mode then Ask before Close + else if (Mode = 1) then + begin + Music.PlayBack; + CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); + end; + end; + SDLK_RETURN: + begin + if Length(Songs.Song) > 0 then + begin + {$IFDEF UseSerialPort} + // PortWriteB($378, 0); + {$ENDIF} + if CatSongs.Song[Interaction].Main then + begin // clicked on Category Button + + //Show Cat in Top Left Mod + ShowCatTL (Interaction); + + //I := CatSongs.VisibleIndex(Interaction); + CatSongs.ClickCategoryButton(Interaction); + {I2 := CatSongs.VisibleIndex(Interaction); + SongCurrent := SongCurrent - I + I2; + SongTarget := SongTarget - I + I2; } + +// if I<>I2 then beep; + // SetScroll4; + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + + //Play Music: + ChangeMusic; + + end else begin // clicked on song + if (Mode = 0) then //Normal Mode -> Start Song + begin + //Do the Action that is specified in Ini + case Ini.OnSongClick of + 0: StartSong; + 1: SelectPlayers; + 2:begin + If (CatSongs.CatNumShow = -3) then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end; + end; + end + else if (Mode = 1) then //PartyMode -> Show Menu + begin + if (Ini.PartyPopup = 1) then + ScreenSongMenu.MenuShow(SM_Party_Main) + else + ScreenSong.StartSong; + end; + end; + end; + end; + + SDLK_M: //Show SongMenu + begin + if (Length(Songs.Song) > 0) then begin + if (Mode = 0) then begin + if not CatSongs.Song[Interaction].Main then begin // clicked on Song + if CatSongs.CatNumShow = -3 then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end + else + begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); + end; + end //Party Mode -> Show Party Menu + else ScreenSongMenu.MenuShow(SM_Party_Main); + end; + end; + + SDLK_P: //Show Playlist Menu + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); + end; + end; + + SDLK_J: //Show Jumpto Menu + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then + begin + ScreenSongJumpto.Visible := True; + end; + end; + + SDLK_DOWN: + begin + if (Mode = 0) then + begin + //Only Change Cat when not in Playlist or Search Mode + if (CatSongs.CatNumShow > -2) then + begin + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then + begin + I := Interaction; + if I <= 0 then I := 1; + + while not catsongs.Song[I].Main do + begin + Inc (I); + if (I > high(catsongs.Song)) then + I := low(catsongs.Song); + end; + + Interaction := I; + + //Show Cat in Top Left Mod + ShowCatTL (Interaction); + + CatSongs.ClickCategoryButton(Interaction); + SelectNext; + FixSelected; + + //Play Music: + Music.PlayChange; + ChangeMusic; + + end; + + // + //Cat Change Hack End} + end; + end; + end; + SDLK_UP: + begin + if (Mode = 0) then + begin + //Only Change Cat when not in Playlist or Search Mode + if (CatSongs.CatNumShow > -2) then + begin + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then + begin + I := Interaction; + I2 := 0; + if I <= 0 then I := 1; + + while not catsongs.Song[I].Main or (I2 = 0) do + begin + if catsongs.Song[I].Main then + Inc(I2); + Dec (I); + if (I < low(catsongs.Song)) then + I := high(catsongs.Song); + end; + + Interaction := I; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + + //Play Music: + Music.PlayChange; + ChangeMusic; + end; + end; + //Cat Change Hack End} + end; + end; + + SDLK_RIGHT: + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + Music.PlayChange; + SelectNext; +// InteractNext; +// SongTarget := Interaction; + ChangeMusic; + SetScroll4; + UpdateLCD; + Light.LightOne(1, 200); + end; + end; + + SDLK_LEFT: + begin + if (Length(Songs.Song) > 0)AND (Mode = 0) then begin + Music.PlayChange; + SelectPrev; + ChangeMusic; + SetScroll4; + UpdateLCD; + Light.LightOne(0, 200); + end; + end; + + SDLK_E: + begin + OpenEditor; + end; + + SDLK_R: + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + + if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category + begin + I2 := 0; //Count Cats + for I:= low(CatSongs.Song) to high (CatSongs.Song) do + if CatSongs.Song[I].Main then Inc(I2); + + I2 := Random (I2)+1; //Zufall + + //Find Cat: + for I:= low(CatSongs.Song) to high (CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + Dec(I2); + if (I2<=0) then + begin + //Show Cat in Top Left Mod + ShowCatTL (I); + + Interaction := I; + + CatSongs.ShowCategoryList; + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + break; + end; + end; + + + end + else if (SDL_ModState = KMOD_LCTRL) AND (Ini.Tabs_at_startup = 1) then //random in All Categorys + begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; + + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + + //Choose Cat + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Fix: Not Existing Song selected: + //if (I+1=I2) then Inc(I2); + + //Choose Song + SkipTo(I2-I); + + end + else //Random in one Category + begin + SkipTo(Random(CatSongs.VisibleSongs)); + end; + Music.PlayChange; + + ChangeMusic; + SetScroll4; + UpdateLCD; + end; + end; + + SDLK_1: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[0].Joker); + SelectRandomSong; + SetJoker; + end; + end; + + SDLK_2: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[1].Joker); + SelectRandomSong; + SetJoker; + end; + end; + + SDLK_3: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[2].Joker); + SelectRandomSong; + SetJoker; + end; + end; + end; + end; +end; + +constructor TScreenSong.Create; +var + Pet: integer; + I: integer; +Label CreateSongButtons; +begin + inherited Create; + + LoadFromTheme(Theme.Song); + + TextArtist := AddText(Theme.Song.TextArtist); + TextTitle := AddText(Theme.Song.TextTitle); + TextNumber := AddText(Theme.Song.TextNumber); + + //Show Cat in Top Left mod + TextCat := AddText(Theme.Song.TextCat); + StaticCat := AddStatic(Theme.Song.StaticCat); + + //Show Video Icon Mod + VideoIcon := AddStatic(Theme.Song.VideoIcon); + + //Party Mode + StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1); + StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2); + StaticTeam1Joker3 := AddStatic(Theme.Song.StaticTeam1Joker3); + StaticTeam1Joker4 := AddStatic(Theme.Song.StaticTeam1Joker4); + StaticTeam1Joker5 := AddStatic(Theme.Song.StaticTeam1Joker5); + + StaticTeam2Joker1 := AddStatic(Theme.Song.StaticTeam2Joker1); + StaticTeam2Joker2 := AddStatic(Theme.Song.StaticTeam2Joker2); + StaticTeam2Joker3 := AddStatic(Theme.Song.StaticTeam2Joker3); + StaticTeam2Joker4 := AddStatic(Theme.Song.StaticTeam2Joker4); + StaticTeam2Joker5 := AddStatic(Theme.Song.StaticTeam2Joker5); + + StaticTeam3Joker1 := AddStatic(Theme.Song.StaticTeam3Joker1); + StaticTeam3Joker2 := AddStatic(Theme.Song.StaticTeam3Joker2); + StaticTeam3Joker3 := AddStatic(Theme.Song.StaticTeam3Joker3); + StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); + StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); + + //Load Party or NonParty specific Statics and Texts + SetLength(StaticParty, Length(Theme.Song.StaticParty)); + for I := 0 to High(Theme.Song.StaticParty) do + StaticParty[I] := AddStatic(Theme.Song.StaticParty[I]); + + SetLength(TextParty, Length(Theme.Song.TextParty)); + for I := 0 to High(Theme.Song.TextParty) do + TextParty[I] := AddText(Theme.Song.TextParty[I]); + + SetLength(StaticNonParty, Length(Theme.Song.StaticNonParty)); + for I := 0 to High(Theme.Song.StaticNonParty) do + StaticNonParty[I] := AddStatic(Theme.Song.StaticNonParty[I]); + + SetLength(TextNonParty, Length(Theme.Song.TextNonParty)); + for I := 0 to High(Theme.Song.TextNonParty) do + TextNonParty[I] := AddText(Theme.Song.TextNonParty[I]); + + // Song List +// Songs.LoadSongList; // moved to the UltraStar unit + CatSongs.Refresh; + + if (length(CatSongs.Song) > 0) then + begin + //Set Length of Button Array one Time Instead of one time for every Song + SetButtonLength(Length(CatSongs.Song)); + + I := 0; + CreateSongButtons: + + try + for Pet := I to High(CatSongs.Song) do begin // creating all buttons + // new + Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 + + if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' + + if CatSongs.Song[Pet].Cover = '' then + AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) + else begin + // cache texture if there is a need to this + if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + begin + Texture.CreateCacheMipmap := true; + Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap + Texture.CreateCacheMipmap := false; + + // puts this texture to the cache file + Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + + // unload full size texture + Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); + + // we should also add mipmap texture by calling createtexture and use mipmap cache as data source + end; + + // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) + AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + end; + Texture.Limit := 1024*1024; + I := -1; + end; + except + //When Error is reported the First time for this Song + if (I <> Pet) then + begin + //Some Error reporting: + Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); + + //Change Cover to NoCover and Continue Loading + CatSongs.Song[Pet].Cover := ''; + I := Pet; + end + else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song + begin + Log.LogError('NoCover Cover is damaged!'); + try + AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); + except + {$IFDEF win32} + Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); + {$ELSE} + // TODO : JB_linux - better handle this message and display to user.. + writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'); + Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' ); + {$ENDIF} + Halt; + end; + I := Pet + 1; + end; + end; + + if (I <> -1) then + GoTo CreateSongButtons; + + end; + + // Randomize Patch + Randomize; + //Equalizer + SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); + //ClearArray + For I := low(EqualizerBands) to high(EqualizerBands) do + EqualizerBands[I] := 3; + + if (Length(CatSongs.Song) > 0) then + Interaction := 0; +end; + +procedure TScreenSong.SetScroll; +var + VS, B: Integer; +begin + VS := CatSongs.VisibleSongs; + if VS > 0 then + begin + //Set Positions + Case Theme.Song.Cover.Style of + 3: SetScroll3; + 5:begin + if VS > 5 then + SetScroll5 + else + SetScroll4; + end; + 6: SetScroll6; + else SetScroll4; + end; + //Set Visibility of Video Icon + Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> ''); + + //Set Texts: + Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; + Text[TextTitle].Text := CatSongs.Song[Interaction].Title; + if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then + begin + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); + Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; + end + else if (CatSongs.CatNumShow = -2) then + Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) + else if (CatSongs.CatNumShow = -3) then + Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) + else if (Ini.Tabs_at_startup = 1) then + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) + else + Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); + end + else + begin + Text[TextNumber].Text := '0/0'; + Text[TextArtist].Text := ''; + Text[TextTitle].Text := ''; + for B := 0 to High(Button) do + Button[B].Visible := False; + + end; +end; + +procedure TScreenSong.SetScroll1; +var + B: integer; // button + BMin: integer; // button min + BMax: integer; // button max + Src: integer; +// Dst: integer; + Count: integer; // Dst is not used. Count is used. + Ready: boolean; + + VisCount: integer; // count of visible (or selectable) buttons + VisInt: integer; // visible position of interacted button + Typ: integer; // 0 when all songs fits the screen + Placed: integer; // number of placed visible buttons +begin +// Src := 0; +// Dst := -1; + Count := 1; + Typ := 0; + Ready := false; + Placed := 0; + + VisCount := 0; + for B := 0 to High(Button) do + if CatSongs.Song[B].Visible then Inc(VisCount); + + VisInt := 0; + for B := 0 to Interaction-1 do + if CatSongs.Song[B].Visible then Inc(VisInt); + + + if VisCount <= 6 then begin + Typ := 0; + end else begin + if VisInt <= 3 then begin + Typ := 1; + Count := 7; + Ready := true; + end; + + if (VisCount - VisInt) <= 3 then begin + Typ := 2; + Count := 7; + Ready := true; + end; + + if not Ready then begin + Typ := 3; + Src := Interaction; + end; + end; + + + + // hide all buttons + for B := 0 to High(Button) do begin + Button[B].Visible := false; + Button[B].Selectable := CatSongs.Song[B].Visible; + end; + +{ for B := Src to Dst do begin +// Button[B].Visible := true; + Button[B].Visible := CatSongs.Song[B].Visible; + Button[B].Selectable := Button[B].Visible; + Button[B].Y := 140 + (B-Src) * 60; + end;} + + + if Typ = 0 then begin + for B := 0 to High(Button) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (Placed) * 60; + Inc(Placed); + end; + end; + end; + + if Typ = 1 then begin + B := 0; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Inc(B); + end; + end; + + if Typ = 2 then begin + B := High(Button); + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (6-Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Dec(B); + end; + end; + + if Typ = 3 then begin + B := Src; + Count := 4; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (3+Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Inc(B); + end; + + B := Src-1; + Placed := 0; + Count := 3; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (2-Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Dec(B); + end; + + end; + + if Length(Button) > 0 then + Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture +end; + +procedure TScreenSong.SetScroll2; +var + B: integer; + Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu + Wsp2: real; +begin + // liniowe + for B := 0 to High(Button) do + Button[B].X := 300 + (B - Interaction) * 260; + + if Length(Button) >= 3 then begin + if Interaction = 0 then + Button[High(Button)].X := 300 - 260; + + if Interaction = High(Button) then + Button[0].X := 300 + 260; + end; + + // kolowe +{ for B := 0 to High(Button) do begin + Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. + Wsp2 := Wsp / Length(Button); + Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); +// Button[B].Y := 140 + 50 * ; + end;} +end; + +procedure TScreenSong.SetScroll3; // with slide +var + B: integer; + Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu + Wsp2: real; +begin + SongTarget := Interaction; + + // liniowe + for B := 0 to High(Button) do + begin + Button[B].X := 300 + (B - SongCurrent) * 260; + if (Button[B].X < -Button[B].W) OR (Button[B].X > 800) then + Button[B].Visible := False + else + Button[B].Visible := True; + end; + +{ if Length(Button) >= 3 then begin + if Interaction = 0 then + Button[High(Button)].X := 300 - 260; + + if Interaction = High(Button) then + Button[0].X := 300 + 260; + end;} + + // kolowe +{ for B := 0 to High(Button) do begin + Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. + Wsp2 := Wsp / Length(Button); + Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); +// Button[B].Y := 140 + 50 * ; + end;} +end; + +procedure TScreenSong.SetScroll4; // rotate +var + B: integer; + Wsp: real; + Z, Z2: real; + VS: integer; +begin + VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important + + // kolowe + for B := 0 to High(Button) do begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2; + Z2 := (1 + 2*Z) / 3; + + + Button[B].X := Theme.Song.Cover.X + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z / 2 + 0.3; + + Button[B].W := Theme.Song.Cover.H * Z2; + +// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; + Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; + Button[B].H := Button[B].W; + end; + end; +end; + +(* +procedure TScreenSong.SetScroll4; // rotate +var + B: integer; + Wsp: real; + Z: real; + Z2, Z3: real; + VS: integer; + function modreal (const X, Y: real):real; + begin + Result := Frac(x / y) * y; + if Result < -3 then + Result := Result + Y + else if Result > 3 then + Result := Result - Y; + end; +begin + VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important + Z3 := 1; + if VS < 12 then + Z2 := VS + else + Z2 := 12; + + // kolowe + for B := 0 to High(Button) do begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + if ((ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)>-3) AND (ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)<3)) then + begin + if CatSongs.VisibleIndex(B)> SongCurrent then + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2 + else + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2; + + Z3 := 2; + Z := (1 + cos(Wsp)) / 2; + //Z2 := (1 + 2*Z) / 3; + //Z2 := (0.5 + Z/2); + //Z2 := sin(Wsp); + + //Z2 := Power (Z2,Z3); + + Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); + + //Button[B].X := Theme.Song.CoverX + ({Theme.Song.CoverX + Theme.Song.CoverW/2 + Theme.Song.CoverW*0.18 * VS {CatSongs.VisibleSongs {Length(Button) * sin(Wsp) {- Theme.Song.CoverX - Theme.Song.CoverW) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + if (sin(Wsp)<0) then + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W + else //*Theme.Song.CoverW*0.004*Z3 + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; + Button[B].Z := Z-0.00001; + +// Button[B].Y := {50 + 140 + 50 - 50 * Z2; + // Button[B].Y := (Theme.Song.CoverY + 40 + 50 - 50 * Z2); + Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); + Button[B].H := Button[B].W; + Button[B].Visible := True; + end + {else if (((CatSongs.VisibleIndex(B) - SongCurrent)>-3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) OR ((round (CatSongs.VisibleIndex(B) - SongCurrent) mod VS > -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) then + begin + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / 12 ;// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2 -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); + + if (sin(Wsp)<0) then + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W + else + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; + + Button[B].Z := Z; + + Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); + + Button[B].H := Button[B].W; + Button[B].Visible := True; + end + else Button[B].Visible := False; + end; + end; +end; *) + +procedure TScreenSong.SetScroll5; // rotate +var + B: integer; + Angle: real; + Pos: Real; + VS: integer; + diff: real; + X: Real; + helper: real; +begin + VS := CatSongs.VisibleSongs; // cache Visible Songs + {Vars + Theme.Song.CoverW: Radius des Kreises + Theme.Song.CoverX: X Pos Linke Kante des gewählten Covers + Theme.Song.CoverX: Y Pos Obere Kante des gewählten Covers + Theme.Song.CoverH: Höhe der Cover + + (CatSongs.VisibleIndex(B) - SongCurrent)/VS = Abstand zum MIttleren Cover in % + } + + //Change Pos of all Buttons + for B := low(Button) to high(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility + if Button[B].Visible then //Only Change Pos for Visible Buttons + begin + Pos := (CatSongs.VisibleIndex(B) - SongCurrent); + if (Pos < -VS/2) then + Pos := Pos + VS + else if (Pos > VS/2) then + Pos := Pos - VS; + + if (Abs(Pos) < 2.5) then {fixed Positions} + begin + Angle := Pi * (Pos / 5); +// Button[B].Visible := False; + + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); + +// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Z := 0.95 - Abs(Pos) * 0.01; + + Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); + + Button[B].W := Button[B].H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + + X := Sin(Angle*1.3)*0.9; + + Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Diff; + + end + else + begin {Behind the Front Covers} + + // limit-bg-covers hack + if (abs(abs(Pos)-VS/2)>10) then Button[B].Visible:=False; + // end of limit-bg-covers hack + + if Pos < 0 then + Pos := (Pos - VS/2)/VS + else + Pos := (Pos + VS/2)/VS; + + Angle := pi * Pos*2; + if VS > 24 then + begin + if Angle < 0 then helper:=-1 else helper:=1; + Angle:=2*pi-abs(Angle); + Angle:=Angle*(VS/24); + Angle:=(2*pi-Angle)*helper; + end; + + Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); + + Button[B].W := Button[B].H; + + Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; + +// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*((Theme.Song.Cover.H)*sin(Angle/2)*1.52); + + end; + + //Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field +// Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); + + end; + end; +end; + +procedure TScreenSong.SetScroll6; // rotate (slotmachine style) +var + B: integer; + Angle: real; + Pos: Real; + VS: integer; + diff: real; + X: Real; + Wsp: real; + Z, Z2: real; +begin + VS := CatSongs.VisibleSongs; // cache Visible Songs + if VS <=5 then begin + // kolowe + for B := 0 to High(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2; + Z2 := (1 + 2*Z) / 3; + + + Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z / 2 + 0.3; + + Button[B].W := Theme.Song.Cover.H * Z2; + +// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; + Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; + Button[B].H := Button[B].W; + end; + end; + end + else begin + + //Change Pos of all Buttons + for B := low(Button) to high(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility + if Button[B].Visible then //Only Change Pos for Visible Buttons + begin + Pos := (CatSongs.VisibleIndex(B) - SongCurrent); + if (Pos < -VS/2) then + Pos := Pos + VS + else if (Pos > VS/2) then + Pos := Pos - VS; + + if (Abs(Pos) < 2.5) then {fixed Positions} + begin + Angle := Pi * (Pos / 5); +// Button[B].Visible := False; + + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); + + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Z := 0.95 - Abs(Pos) * 0.01; + + Button[B].X := (Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); + + Button[B].W := Button[B].H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + + X := Sin(Angle*1.3)*0.9; + + Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff; + end + else + begin {Behind the Front Covers} + + // limit-bg-covers hack + if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; + if VS > 25 then VS:=25; + // end of limit-bg-covers hack + + if Pos < 0 then + Pos := (Pos - VS/2)/VS + else + Pos := (Pos + VS/2)/VS; + + Angle := pi * Pos*2; + + Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); + + Button[B].W := Button[B].H; + + Button[B].X := Theme.Song.Cover.X - (Button[B].H - Theme.Song.Cover.H)*0.5; + + + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Y := Theme.Song.Cover.Y+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*(Theme.Song.Cover.H*sin(Angle/2)*1.52); + end; + end; + end; + end; +end; + + +procedure TScreenSong.onShow; +begin + Music.Stop; + + if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; + if Ini.Players = 4 then PlayersPlay := 6; + + //Cat Mod etc + if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then + begin + CatSongs.ShowCategoryList; + FixSelected; + //Show Cat in Top Left Mod + HideCatTL; + end; + + + if Length(CatSongs.Song) > 0 then begin + //Load Music only when Song Preview is activated + if (Ini.PreviewVolume <> 0) then + begin + Music.SetLoop(false); + Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + Music.MoveTo(Music.Length / 4); + Music.Play; + + //Set Preview Volume + Music.SetMusicVolume (Ini.PreviewVolume * 10); + {//if Music Fade is activated, Set Volume to 0 % + if (Ini.PreviewFading <> 0) then + Music.SetMusicVolume(0);} + end; + + SetScroll; + UpdateLCD; + end; + + //Playlist Mode + if (Mode = 0) then + begin + //If Playlist Shown -> Select Next automatically + if (CatSongs.CatNumShow = -3) then + begin + SelectNext; + ChangeMusic; + end; + end + //Party Mode + else if (Mode = 1) then + begin + + SelectRandomSong; + //Show Menu directly in PartyMode + //But only if selected in Options + if (Ini.PartyPopup = 1) then + begin + ScreenSongMenu.MenuShow(SM_Party_Main); + end; + + + end; + + SetJoker; + SetStatics; +end; + +procedure TScreenSong.onHide; +begin + //When Music Fading is activated, Turn Music to 100 % + If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then + Music.SetMusicVolume(100); + + //If Preview is deactivated: Load MUsicfile now + If (Ini.PreviewVolume = 0) then + Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + + //When hide then Stop Music (For Party Mode Popup on Exit) + if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then + Music.Stop; +end; + +procedure TScreenSong.DrawExtensions; +begin + //Draw Song Menu + if (ScreenSongMenu.Visible) then + begin + ScreenSongMenu.Draw; + end + else if (ScreenSongJumpto.Visible) then + begin + ScreenSongJumpto.Draw; + end +end; + +function TScreenSong.Draw: boolean; +var + dx: real; + dt: real; + I: Integer; +begin + dx := SongTarget-SongCurrent; + dt := TimeSkip*7; + if dt > 1 then dt := 1; + SongCurrent := SongCurrent + dx*dt; + +{ if SongCurrent > Catsongs.VisibleSongs then begin + SongCurrent := SongCurrent - Catsongs.VisibleSongs; + SongTarget := SongTarget - Catsongs.VisibleSongs; + end;} + +// Log.BenchmarkStart(5); + SetScroll; +// Log.BenchmarkEnd(5); +// Log.LogBenchmark('SetScroll4', 5); + + //Fading Functions, Only if Covertime is under 5 Seconds + If (CoverTime < 5) then + begin + // 0.5.0: cover fade + if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin + // load new texture + Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture.Alpha := 1; + Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture2.Alpha := 1; + end; + + //Song Fade + if (CatSongs.VisibleSongs > 0) AND (Ini.PreviewVolume <> 0) AND (Not CatSongs.Song[Interaction].Main) AND (Ini.PreviewFading <> 0) then + begin + //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling + if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then + Music.Play; + + //Update Song Volume + if (CoverTime < Ini.PreviewFading) then + Music.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) + else + Music.SetMusicVolume(Ini.PreviewVolume * 10); + + end; + + + //Update Fading Time + CoverTime := CoverTime + TimeSkip; + + //Update Fading Texture + Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; + if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; + + end; + + //inherited Draw; + //heres a little Hack, that causes the Statics + //are Drawn after the Buttons because of some Blending Problems. + //This should cause no Problems because all Buttons on this screen + //Has Z Position. + //Draw BG + DrawBG; + + //Instead of Draw FG Procedure: + //We draw Buttons for our own + for I := 0 to Length(Button) - 1 do + Button[I].Draw; + + // Statics + for I := 0 to Length(Static) - 1 do + Static[I].Draw; + + // and texts + for I := 0 to Length(Text) - 1 do + Text[I].Draw; + + + //Draw Equalizer + if Theme.Song.Equalizer.Visible then + DrawEqualizer; + + DrawExtensions; + +end; + +procedure TScreenSong.SelectNext; +var + Skip: integer; + I: integer; + VS: Integer; +begin + VS := CatSongs.VisibleSongs; + + if VS > 0 then + begin + UnLoadDetailedCover; + + Skip := 1; + + // this 1 could be changed by CatSongs.FindNextVisible + while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); + + SongTarget := SongTarget + 1;//Skip; + + Interaction := (Interaction + Skip) mod Length(Interactions); + + // try to keep all at the beginning + if SongTarget > VS-1 then begin + SongTarget := SongTarget - VS; + SongCurrent := SongCurrent - VS; + end; + + end; + // Interaction -> Button, ktorego okladke przeczytamy + // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture +end; + +procedure TScreenSong.SelectPrev; +var + Skip: integer; + I: integer; + VS: Integer; +begin + VS := CatSongs.VisibleSongs; + + if VS > 0 then + begin + UnLoadDetailedCover; + + Skip := 1; + + while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); + SongTarget := SongTarget - 1;//Skip; + + Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); + + // try to keep all at the beginning + if SongTarget < 0 then begin + SongTarget := SongTarget + CatSongs.VisibleSongs; + SongCurrent := SongCurrent + CatSongs.VisibleSongs; + end; + + // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture + end; +end; + +procedure TScreenSong.UpdateLCD; +begin + LCD.HideCursor; + LCD.Clear; + LCD.WriteText(1, Text[TextArtist].Text); + LCD.WriteText(2, Text[TextTitle].Text); +end; + +//Procedure Change current played Preview +procedure TScreenSong.ChangeMusic; +begin + //When Music Preview is avtivated -> then Change Music + if (Ini.PreviewVolume <> 0) then + begin + if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then + begin + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal + if (Ini.PreviewFading = 0) then + Music.Play + else + Music.SetMusicVolume(0); + end; + end + else + Music.Stop; + end; +end; + +procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0 +var + Skip: integer; + I: integer; +begin + UnLoadDetailedCover; + + Interaction := High(CatSongs.Song); + SongTarget := 0; + + for I := 1 to Target+1 do + SelectNext; + + FixSelected2; +end; + +procedure TScreenSong.DrawEqualizer; +var + Data: TFFTData; //Audio Data + I, J: Integer; + Res: byte; + A, B: Integer; + PosX, PosY: Integer; + Pos: Real; + lTmp : double; +begin + +if (not Music.Finished) AND (Theme.Song.Equalizer.Length > 0) then +begin + + + A := GetTickCount div 44; + + if (A <> EqualizerTime) then + begin + EqualizerTime := A; + Data := Music.GetFFTData; + + B:=0; + Pos := 0; + Res := ceil(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band + + //Change Lengths + for I := 0 to (Res * Theme.Song.Equalizer.Bands - 1) do + begin + A := floor(I/Res); + + if (A<>B) then //Band changed + begin + if (Pos <= Theme.Song.Equalizer.Length) then + begin + if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then + EqualizerBands[B] := EqualizerBands[B] - 1 + else + EqualizerBands[B] := floor(Pos); + end + else + EqualizerBands[B] := 1; + + B := A; + Pos := 0; + end; + + if I > 35 then + Data[i] := Data[i] * 8 + else if I > 11 then + Data[i] := Data[i] * 4.5 + else + Data[i] := Data[i] * 1.1; + + if (Data[i] >= 1) then + Data[i] := 0.9999999999999; + + try + if ( assigned( Theme ) ) AND + ( assigned( Theme.Song ) ) AND + ( i < length( Data ) ) THEN + begin + writeln( '!!!!!!!!! - '+ inttostr( i ) + ' - ' + inttostr( Theme.Song.Equalizer.Length ) ); + + if Single(Data[i]) > 0 then + begin + lTmp := Single(Data[i]) * Theme.Song.Equalizer.Length; + if lTmp > Pos then + Pos := lTmp; + end; + end; + except + // TODO: JB_Linux..... why does this happen ! + on E:EInvalidOp do + writeln( 'UScreenSong - DOH !!!!' ); + end + + end; + + //Change Last Band + if (EqualizerBands[B] <= Theme.Song.Equalizer.Length) then + begin + if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then + EqualizerBands[B] := EqualizerBands[B] - 1 + else + EqualizerBands[B] := floor(Pos) + end + else + EqualizerBands[B] := 1; + end; + + //Draw every Channel + glColor4f(Theme.Song.Equalizer.ColR, Theme.Song.Equalizer.ColG, Theme.Song.Equalizer.ColB, Theme.Song.Equalizer.Alpha); //Set Color + glDisable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + + PosY := Theme.Song.Equalizer.Y; + PosX := Theme.Song.Equalizer.X; + + For I := 0 to Theme.Song.Equalizer.Bands-1 do + begin + if Theme.Song.Equalizer.Direction then + PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length + else + PosX := Theme.Song.Equalizer.X; + //Draw for every visible quad + for J := 1 to EqualizerBands[I] do + begin + glBegin(GL_QUADS); + glVertex3f(PosX, PosY, Theme.Song.Equalizer.Z); + glVertex3f(PosX, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); + glVertex3f(PosX+Theme.Song.Equalizer.W, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); + glVertex3f(PosX+Theme.Song.Equalizer.W, PosY, Theme.Song.Equalizer.Z); + glEnd; + + if Theme.Song.Equalizer.Direction then //Vertically + PosY := PosY - Theme.Song.Equalizer.H - Theme.Song.Equalizer.Space + else //Horizontally + PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space; + end; + if Theme.Song.Equalizer.Direction then //Horizontally + PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space + else //Vertically + PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space; + end; +end; +end; + +Procedure TScreenSong.SelectRandomSong; +var + I, I2: Integer; +begin + Case PlaylistMan.Mode of + 0: //All Songs Just Select Random Song + begin + //When Tabs are activated then use Tab Method + if (Ini.Tabs_at_startup = 1) then + begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; + + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + //I is the CatNum, I2 is the No of the Song within this Cat + + //Choose Cat + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Choose Song + SkipTo(I2-I); + end + //When Tabs are deactivated use easy Method + else + SkipTo(Random(CatSongs.VisibleSongs)); + end; + 1: //One Category Select Category and Select Random Song + begin + CatSongs.ShowCategoryList; + CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); + ShowCatTL(PlaylistMan.CurPlayList); + + SelectNext; + FixSelected2; + + SkipTo(Random(CatSongs.VisibleSongs)); + end; + 2: //Playlist: Select Playlist and Select Random Song + begin + PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); + + SkipTo(Random(CatSongs.VisibleSongs)); + FixSelected2; + end; + end; + + Music.PlayChange; + ChangeMusic; + SetScroll; + UpdateLCD; +end; + +procedure TScreenSong.SetJoker; +begin + //If Party Mode + if Mode = 1 then //Show Joker that are available + begin + if (PartySession.Teams.NumTeams >= 1) then + begin + Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1); + Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2); + Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3); + Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4); + Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5); + end + else + begin + Static[StaticTeam1Joker1].Visible := False; + Static[StaticTeam1Joker2].Visible := False; + Static[StaticTeam1Joker3].Visible := False; + Static[StaticTeam1Joker4].Visible := False; + Static[StaticTeam1Joker5].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 2) then + begin + Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1); + Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2); + Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3); + Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4); + Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5); + end + else + begin + Static[StaticTeam2Joker1].Visible := False; + Static[StaticTeam2Joker2].Visible := False; + Static[StaticTeam2Joker3].Visible := False; + Static[StaticTeam2Joker4].Visible := False; + Static[StaticTeam2Joker5].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 3) then + begin + Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1); + Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2); + Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3); + Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4); + Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5); + end + else + begin + Static[StaticTeam3Joker1].Visible := False; + Static[StaticTeam3Joker2].Visible := False; + Static[StaticTeam3Joker3].Visible := False; + Static[StaticTeam3Joker4].Visible := False; + Static[StaticTeam3Joker5].Visible := False; + end; + end + else + begin //Hide all + Static[StaticTeam1Joker1].Visible := False; + Static[StaticTeam1Joker2].Visible := False; + Static[StaticTeam1Joker3].Visible := False; + Static[StaticTeam1Joker4].Visible := False; + Static[StaticTeam1Joker5].Visible := False; + + Static[StaticTeam2Joker1].Visible := False; + Static[StaticTeam2Joker2].Visible := False; + Static[StaticTeam2Joker3].Visible := False; + Static[StaticTeam2Joker4].Visible := False; + Static[StaticTeam2Joker5].Visible := False; + + Static[StaticTeam3Joker1].Visible := False; + Static[StaticTeam3Joker2].Visible := False; + Static[StaticTeam3Joker3].Visible := False; + Static[StaticTeam3Joker4].Visible := False; + Static[StaticTeam3Joker5].Visible := False; + end; +end; + +procedure TScreenSong.SetStatics; +var + I: Integer; + Visible: Boolean; +begin + //Set Visibility of Party Statics and Text + Visible := (Mode = 1); + + For I := 0 to high(StaticParty) do + Static[StaticParty[I]].Visible := Visible; + + For I := 0 to high(TextParty) do + Text[TextParty[I]].Visible := Visible; + + //Set Visibility of Non Party Statics and Text + Visible := not Visible; + + For I := 0 to high(StaticNonParty) do + Static[StaticNonParty[I]].Visible := Visible; + + For I := 0 to high(TextNonParty) do + Text[TextNonParty[I]].Visible := Visible; +end; + +//Procedures for Menu + +procedure TScreenSong.StartSong; +begin + CatSongs.Selected := Interaction; + Music.Stop; + //Party Mode + if (Mode = 1) then + begin + FadeTo(@ScreenSingModi); + end + else + begin + FadeTo(@ScreenSing); + end; +end; + +procedure TScreenSong.SelectPlayers; +begin + CatSongs.Selected := Interaction; + Music.Stop; + + ScreenName.Goto_SingScreen := True; + FadeTo(@ScreenName); +end; + +procedure TScreenSong.OpenEditor; +begin + if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin + Music.Stop; + Music.PlayStart; + ScreenEditSub.Path := CatSongs.Song[Interaction].Path; + ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName; + FadeTo(@ScreenEditSub); + end; +end; + +//Team No of Team (0-5) +procedure TScreenSong.DoJoker (Team: Byte); +begin + if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[Team].Joker); + SelectRandomSong; + SetJoker; + end; +end; + +//Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song +procedure TScreenSong.UnLoadDetailedCover; +begin + CoverTime := 0; + + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture + Button[Interaction].Texture2.Alpha := 0; + + if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then + Texture.UnloadTexture(Button[Interaction].Texture.Name, false); +end; + +procedure TScreenSong.Refresh; +begin { +CatSongs.Refresh; +CatSongs.ShowCategoryList; +Interaction := 0; +SelectNext; +FixSelected; } + +end; + +end. -- cgit v1.2.3 From ef07574805b0fb247cfa91f0e6bbb234c0dbd22a Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 8 Oct 2007 06:45:19 +0000 Subject: minor changes to faciliate ffmpeg audio playback jira#USDX-123 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@470 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMusic.pas | 107 +++++++++++++++++++++++++++++++++++++++++-- Game/Code/Classes/UTime.pas | 11 +++++ 2 files changed, 113 insertions(+), 5 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index b3729e69..bdd0be83 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -41,8 +41,48 @@ type Handle : hStream; end; + IAudioPlayback = Interface + procedure InitializePlayback; + + procedure SetVolume(Volume: integer); + procedure SetMusicVolume(Volume: integer); + procedure SetLoop(Enabled: boolean); + + function Open(Name: string): boolean; // true if succeed + + procedure Play; + procedure Pause; //Pause Mod + procedure Stop; - TMusic = class + procedure Rewind; + procedure MoveTo(Time: real); + procedure Close; + + function Finished: boolean; + function Length: real; + function Position: real; + + procedure PlayStart; + procedure PlayBack; + procedure PlaySwoosh; + procedure PlayChange; + procedure PlayOption; + procedure PlayClick; + procedure PlayDrum; + procedure PlayHihat; + procedure PlayClap; + procedure PlayShuffle; + procedure StopShuffle; + + function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; + + //Custom Sounds + function LoadCustomSound(const Filename: String): Cardinal; + procedure PlayCustomSound(const Index: Cardinal); + end; + + + TMusic = class( TInterfacedObject, IAudioPlayback ) private BassStart: hStream; // Wait, I've replaced this with BASS BassBack: hStream; // It has almost all features we need @@ -59,6 +99,8 @@ type CustomSounds: array of TCustomSoundEntry; + function FFMPeg_StreamCreateFile(abool : boolean; aFileName : pchar ): THandle; + Loaded: boolean; Loop: boolean; public @@ -101,7 +143,6 @@ type //Custom Sounds function LoadCustomSound(const Filename: String): Cardinal; procedure PlayCustomSound(const Index: Cardinal); - end; const @@ -202,6 +243,11 @@ uses {$IFDEF FPC} lclintf, {$ENDIF} + + avcodec, + avformat, + avutil, + UGraphic, URecord, UFiles, @@ -265,7 +311,8 @@ begin // LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3'); - Log.BenchmarkEnd(4); Log.LogBenchmark('--> Loading Sounds', 4); + Log.BenchmarkEnd(4); + Log.LogBenchmark('--> Loading Sounds', 4); end; procedure TMusic.InitializeRecord; @@ -663,14 +710,19 @@ function TMusic.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; var L: Integer; begin - if FileExists(Name) then begin + if FileExists(Name) then + begin Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); try {$IFDEF useBASS} // TODO : jb_linux replace with something other than bass hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); + {$ELSE} + hStream := FFMPeg_StreamCreateFile(False, pchar(Name) ); {$ENDIF} + + //Add CustomSound L := High(CustomSounds) + 1; SetLength (CustomSounds, L + 1); @@ -679,7 +731,9 @@ begin except Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); end; - end else begin + end + else + begin Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); exit; end; @@ -735,4 +789,47 @@ begin end; +{* + +Sorry guys... this is my mess :( +Im going to try and get ffmpeg to handle audio playback ( at least for linux ) +and Im going to implement it nicly along side BASS, in TMusic ( where I can ) + +http://www.dranger.com/ffmpeg/ffmpeg.html +http://www.dranger.com/ffmpeg/ffmpegtutorial_all.html + +http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html + +*} +function TMusic.FFMPeg_StreamCreateFile(abool : boolean; aFileName : pchar ): THandle; +var + lFormatCtx : PAVFormatContext; +begin + +(* + if(SDL_OpenAudio(&wanted_spec, &spec) < 0) + begin + fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError()); + writeln( 'SDL_OpenAudio' ); + exit; + end; +*) + +(* + if ( av_open_input_file( lFormatCtx, aFileName, NULL, 0, NULL ) <> 0 ) + begin + writeln( 'Unable to open file '+ aFileName ); + exit; + end; + + // Retrieve stream information + if ( av_find_stream_info(pFormatCtx) < 0 ) + begin + writeln( 'Unable to Retrieve stream information' ); + exit; + end; +*) + +end; + end. diff --git a/Game/Code/Classes/UTime.pas b/Game/Code/Classes/UTime.pas index d06628cc..c197a70f 100644 --- a/Game/Code/Classes/UTime.pas +++ b/Game/Code/Classes/UTime.pas @@ -43,6 +43,17 @@ uses // who knows how fast or slow that function is ! // but this gets a compile for now .. :) +(* +msec( ) +{ + struct timeval tv; + gettimeofday( &tv, NULL ); + return (int64_t)tv.tv_sec * (int64_t)1000000 + (int64_t)tv.tv_usec; +} + +*) + + constructor TTime.Create; begin CountSkipTimeSet; -- cgit v1.2.3 From 05a70d011814281bb21ea217e5768a8c299ffe34 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 8 Oct 2007 08:59:57 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@471 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.lpr | 2 +- Game/Code/bamboo-build-lin-laz.bat | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 Game/Code/bamboo-build-lin-laz.bat (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index ce006d54..e0b1e95a 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -97,7 +97,7 @@ uses //------------------------------ {$IFDEF FPC} - ulazjpeg in 'Classes\ulazjpeg.pas', + ulazjpeg in 'Classes\Ulazjpeg.pas', {$ENDIF} TextGL in 'Classes\TextGL.pas', diff --git a/Game/Code/bamboo-build-lin-laz.bat b/Game/Code/bamboo-build-lin-laz.bat new file mode 100644 index 00000000..bcaca539 --- /dev/null +++ b/Game/Code/bamboo-build-lin-laz.bat @@ -0,0 +1,4 @@ +clear +fpc -S2cgi -OG1 -gl -vewnhi -l -Filib/JEDI-SDLv1.0/SDL/Pas/ -Fu/usr/lib/lazarus/components/images/lib/i386-linux/ -Fu/usr/lib/lazarus/lcl/units/i386-linux/ -Fu/usr/lib/lazarus/lcl/units/i386-linux/gtk2/ -Fu/usr/lib/lazarus/packager/units/i386-linux/ -Fu. -oUltraStar -dLCL -dLCLgtk2 UltraStar.lpr + +#mv ./UltraStar /home/jay/src/ultrastardx/output/ -- cgit v1.2.3 From e32eda08cb91c82afc568a406d2444e075eda5dd Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 8 Oct 2007 09:00:47 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@472 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/bamboo-build-lin-laz.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Game/Code/bamboo-build-lin-laz.sh (limited to 'Game/Code') diff --git a/Game/Code/bamboo-build-lin-laz.sh b/Game/Code/bamboo-build-lin-laz.sh new file mode 100644 index 00000000..bcaca539 --- /dev/null +++ b/Game/Code/bamboo-build-lin-laz.sh @@ -0,0 +1,4 @@ +clear +fpc -S2cgi -OG1 -gl -vewnhi -l -Filib/JEDI-SDLv1.0/SDL/Pas/ -Fu/usr/lib/lazarus/components/images/lib/i386-linux/ -Fu/usr/lib/lazarus/lcl/units/i386-linux/ -Fu/usr/lib/lazarus/lcl/units/i386-linux/gtk2/ -Fu/usr/lib/lazarus/packager/units/i386-linux/ -Fu. -oUltraStar -dLCL -dLCLgtk2 UltraStar.lpr + +#mv ./UltraStar /home/jay/src/ultrastardx/output/ -- cgit v1.2.3 From 174244a5ddf10da145779f6fe0ad1c5bc398fa6a Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 8 Oct 2007 09:08:17 +0000 Subject: fixed bad build build#USDX-DELPHI-31 oops... git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@473 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMusic.pas | 7 ++++--- Game/Code/Classes/URecord.pas | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index bdd0be83..3c43615b 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -97,12 +97,12 @@ type //Custom Sounds CustomSounds: array of TCustomSoundEntry; + Loaded: boolean; + Loop: boolean; function FFMPeg_StreamCreateFile(abool : boolean; aFileName : pchar ): THandle; - Loaded: boolean; - Loop: boolean; public Bass: hStream; procedure InitializePlayback; @@ -670,7 +670,8 @@ begin {$IFDEF useBASS} // TODO : jb_linux replace with something other than bass - if not BASS_RecordInit(RecordI) then begin + if not BASS_RecordInit(RecordI) then + begin Error := BASS_ErrorGetCode; ErrorMsg := IntToStr(Error); diff --git a/Game/Code/Classes/URecord.pas b/Game/Code/Classes/URecord.pas index d22e20d3..b553504d 100644 --- a/Game/Code/Classes/URecord.pas +++ b/Game/Code/Classes/URecord.pas @@ -76,6 +76,7 @@ var Recording: TRecord; implementation + uses UMain; procedure TSound.ProcessNewBuffer; @@ -308,7 +309,7 @@ begin Repeat Inc(No) Until not IsDuplicate(Descr + ' (' + InttoStr(No) + ')'); - + //Set Description Descr := Descr + ' (' + InttoStr(No) + ')'; end; -- cgit v1.2.3 From da7211d7a0ab373679399710b8581aab7e9cfeb2 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 8 Oct 2007 21:44:00 +0000 Subject: fixed bambo build script for linux. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@474 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/bamboo-build-lin-laz.sh | 2 ++ Game/Code/lib/JEDI-SDLv1.0/placeholder.txt | 6 +++--- Game/Code/linux-build.sh | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/bamboo-build-lin-laz.sh b/Game/Code/bamboo-build-lin-laz.sh index bcaca539..ad8ef19f 100644 --- a/Game/Code/bamboo-build-lin-laz.sh +++ b/Game/Code/bamboo-build-lin-laz.sh @@ -1,3 +1,5 @@ +svn update + clear fpc -S2cgi -OG1 -gl -vewnhi -l -Filib/JEDI-SDLv1.0/SDL/Pas/ -Fu/usr/lib/lazarus/components/images/lib/i386-linux/ -Fu/usr/lib/lazarus/lcl/units/i386-linux/ -Fu/usr/lib/lazarus/lcl/units/i386-linux/gtk2/ -Fu/usr/lib/lazarus/packager/units/i386-linux/ -Fu. -oUltraStar -dLCL -dLCLgtk2 UltraStar.lpr diff --git a/Game/Code/lib/JEDI-SDLv1.0/placeholder.txt b/Game/Code/lib/JEDI-SDLv1.0/placeholder.txt index 8a577497..d4073d15 100644 --- a/Game/Code/lib/JEDI-SDLv1.0/placeholder.txt +++ b/Game/Code/lib/JEDI-SDLv1.0/placeholder.txt @@ -1,4 +1,4 @@ -grab Jedi-sdl from : - http://sourceforge.net/projects/jedi-sdl - +grab Jedi-sdl from : + http://sourceforge.net/projects/jedi-sdl + and extract in this directory !! \ No newline at end of file diff --git a/Game/Code/linux-build.sh b/Game/Code/linux-build.sh index ebf73542..bcaca539 100755 --- a/Game/Code/linux-build.sh +++ b/Game/Code/linux-build.sh @@ -1,4 +1,4 @@ clear -fpc -S2cgi -OG1 -gl -vewnhi -l -Filib/JEDI-SDLv1.0/SDL/Pas/ -Fu/usr/bin/lazarus/components/images/lib/i386-linux/ -Fu/usr/bin/lazarus/lcl/units/i386-linux/ -Fu/usr/bin/lazarus/lcl/units/i386-linux/gtk2/ -Fu/usr/bin/lazarus/packager/units/i386-linux/ -Fu. -oUltraStar -dLCL -dLCLgtk2 UltraStar.lpr +fpc -S2cgi -OG1 -gl -vewnhi -l -Filib/JEDI-SDLv1.0/SDL/Pas/ -Fu/usr/lib/lazarus/components/images/lib/i386-linux/ -Fu/usr/lib/lazarus/lcl/units/i386-linux/ -Fu/usr/lib/lazarus/lcl/units/i386-linux/gtk2/ -Fu/usr/lib/lazarus/packager/units/i386-linux/ -Fu. -oUltraStar -dLCL -dLCLgtk2 UltraStar.lpr -mv ./UltraStar /home/jay/src/ultrastardx/output/ +#mv ./UltraStar /home/jay/src/ultrastardx/output/ -- cgit v1.2.3 From 621bfb05407a169f6511f5b115d0622e5ec8bdd5 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 10 Oct 2007 17:50:05 +0000 Subject: Added Hook and Service Class for new Plugin System to Trunc Added Core and CoreModule. That maybe will be used for new Core management. Core needs many code to write Some Info to Plugin SDK added git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@497 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCore.pas | 278 ++++++++++++++++++++++++++++ Game/Code/Classes/UCoreModule.pas | 105 +++++++++++ Game/Code/Classes/UHooks.pas | 375 ++++++++++++++++++++++++++++++++++++++ Game/Code/Classes/UModules.pas | 20 ++ Game/Code/Classes/UServices.pas | 312 +++++++++++++++++++++++++++++++ Game/Code/Classes/USingScores.pas | 1 - Game/Code/UltraStar.dpr | 15 +- Game/Code/switches.inc | 2 + 8 files changed, 1098 insertions(+), 10 deletions(-) create mode 100644 Game/Code/Classes/UCore.pas create mode 100644 Game/Code/Classes/UCoreModule.pas create mode 100644 Game/Code/Classes/UHooks.pas create mode 100644 Game/Code/Classes/UModules.pas create mode 100644 Game/Code/Classes/UServices.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UCore.pas b/Game/Code/Classes/UCore.pas new file mode 100644 index 00000000..744fabe2 --- /dev/null +++ b/Game/Code/Classes/UCore.pas @@ -0,0 +1,278 @@ +unit UCore; + +interface +uses uPluginDefs, uCoreModule, UHooks, UServices, uModules; +{********************* + TCore + Class manages all CoreModules, teh StartUp, teh MainLoop and the shutdown process + Also it does some Error Handling, and maybe sometime multithreaded Loading ;) +*********************} + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +type + TModuleListItem = record + Module: TCoreModule; //Instance of the Modules Class + Info: TModuleInfo; //ModuleInfo returned by Modules Modulinfo Proc + NeedsDeInit: Boolean; //True if Module was succesful inited + end; + + TCore = class + private + //Some Hook Handles. See Plugin SDKs Hooks.txt for Infos + hLoadingFinished: THandle; + hMainLoop: THandle; + hLoadTextures: THandle; + hExitQuery: THandle; + hExit: THandle; + hDebug: THandle; + hError: THandle; + sgiveError: THandle; + sgiveDebug: THandle; + + Modules: Array [0..High(CORE_MODULES_TO_LOAD)] of TModuleListItem; + + //Function Get all Modules and Creates them + Function GetModules: Boolean; + + //Loads Core and all Modules + Function Load: Boolean; + + //Inits Core and all Modules + Function Init: Boolean; + + //DeInits Core and all Modules + Function DeInit: Boolean; + + //Load the Core + Function LoadCore: Boolean; + + //Init the Core + Function InitCore: Boolean; + + //DeInit the Core + Function DeInitCore: Boolean; + + //Called one Time per Frame + Function MainLoop: Boolean; + + public + Hooks: THookManager; //Teh Hook Manager ;) + Services: TServiceManager;//The Service Manager + + CurExecuted: Integer; //ID of Plugin or Module curently Executed + + Name: String; //Name of this Application + Version: LongWord; //Version of this ". For Info Look PluginDefs Functions + + //--------------- + //Main Methods to control the Core: + //--------------- + Constructor Create(const cName: String; const cVersion: LongWord); + + //Starts Loading and Init Process. Then Runs MainLoop. DeInits on Shutdown + Procedure Run; + + //-------------- + // Hook and Service Procs: + //-------------- + Function ShowMessage(wParam, lParam: DWord): integer; //Shows a Message (lParam: PChar Text, wParam: Symbol) + Function ShowMessage(wParam, lParam: DWord): integer; //Shows a Message (lParam: PChar Text, wParam: Symbol) + Function ShowMessage(wParam, lParam: DWord): integer; //Shows a Message (lParam: PChar Text, wParam: Symbol) + end; + +var + Core: TCore; + +implementation +{$IFDEF win32} +uses Windows; +{$ENDIF} + +//------------- +// Create - Creates Class + Hook and Service Manager +//------------- +Constructor TCore.Create(const cName: String; const cVersion: LongWord); +begin + Name := cName; + Version := cVersion; + CurExecuted := 0; + + Hooks := THookManager.Create(50); + Services := TServiceManager.Create; +end; + +//------------- +//Starts Loading and Init Process. Then Runs MainLoop. DeInits on Shutdown +//------------- +Procedure TCore.Run; +var + noError: Boolean; +begin + //Get Modules + Try + noError := GetModules; + Except + noError := False; + end; + + //Loading + if (noError) then + begin + Try + noError := Load; + Except + noError := False; + end; + end + else + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar(''))); +end; + +//------------- +//Called one Time per Frame +//------------- +Function TCore.MainLoop: Boolean; +begin + Result := True; + +end; + +//------------- +//Function Get all Modules and Creates them +//------------- +Function TCore.GetModules: Boolean; +var + I: Integer; +begin + For I := 0 to high(Modules) do + begin + Modules[I].NeedsDeInit := False; + Modules[I].Module := CORE_MODULES_TO_LOAD[I].Create; + Modules[I].Module.Info(@Modules[I].Info); + end; +end; + +//------------- +//Loads Core and all Modules +//------------- +Function TCore.Load: Boolean; +var + I: Integer; +begin + Result := LoadCore; + + I := 0; + While ((Result = True) AND (I <= High(CORE_MODULES_TO_LOAD))) do + begin + Result := Modules[I].Module.Load; + Inc(I); + end; +end; + +//------------- +//Inits Core and all Modules +//------------- +Function TCore.Init: Boolean; +begin + Result := InitCore; + + I := 0; + While ((Result = True) AND (I <= High(CORE_MODULES_TO_LOAD))) do + begin + Result := Modules[I].Module.Init; + Inc(I); + end; +end; + +//------------- +//DeInits Core and all Modules +//------------- +Function TCore.DeInit: Boolean; + + label Continue; +begin + I := High(CORE_MODULES_TO_LOAD); + + Continue: + Try + While (I >= 0) do + begin + If (Modules[I].NeedsDeInit) then + Modules[I].Module.DeInit; + + Dec(I); + end; + Except + + GoTo Continue; + end; + + DeInitCore; +end; + +//------------- +//Load the Core +//------------- +Function TCore.LoadCore: Boolean; +begin + hLoadingFinished := Hooks.AddEvent('Core/LoadingFinished'); + hMainLoop := Hooks.AddEvent('Core/MainLoop'); + hLoadTextures := Hooks.AddEvent('Core/LoadTextures'); + hExitQuery := Hooks.AddEvent('Core/ExitQuery'); + hExit := Hooks.AddEvent('Core/Exit'); + hDebug := Hooks.AddEvent('Core/NewDebugInfo'); + hError := Hooks.AddEvent('Core/NewError'); + sReportError := Services.AddService('Core/ReportError'); + sReportDebug := Services.AddService('Core/ReportDebug'); +end; + +//------------- +//Init the Core +//------------- +Function TCore.InitCore: Boolean; +begin + //Dont Init s.th. atm. +end; + +//------------- +//DeInit the Core +//------------- +Function TCore.DeInitCore: Boolean; +begin + + + // to-do : write TService-/HookManager.Free and call it here +end; + +//------------- +//Shows a MessageDialog (lParam: PChar Text, wParam: Symbol) +//------------- +Function TCore.ShowMessage(wParam, lParam: DWord): integer; +var Params: Cardinal; +begin + Result := -1; + + {$IFDEF win32} + If (ptr(lParam)<>nil) then + begin + Params := MB_OK; + Case wParam of + CORE_SM_ERROR: Params := Params or MB_ICONERROR; + CORE_SM_WARNING: Params := Params or MB_ICONWARNING; + CORE_SM_INFO: Params := Params or MB_ICONINFORMATION; + end; + + //Anzeigen: + Result := Messagebox(0, ptr(lParam), PChar(Name), Params); + end; + {$ENDIF} + + // to-do : write ShowMessage for other OSes +end; + +end. \ No newline at end of file diff --git a/Game/Code/Classes/UCoreModule.pas b/Game/Code/Classes/UCoreModule.pas new file mode 100644 index 00000000..4d36f925 --- /dev/null +++ b/Game/Code/Classes/UCoreModule.pas @@ -0,0 +1,105 @@ +unit UCoreModule; + +interface +{********************* + TCoreModule + Dummy Class that has Methods that will be called from Core + In the Best case every Piece of this Software is a Module +*********************} + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +type + PModuleInfo = ^TModuleInfo; + TModuleInfo = record + Name: String; + Version: LongWord; + Description: String; + end; + + TCoreModule = class + public + //Function that gives some Infos about the Module to the Core + Procedure Info(const pInfo: PModuleInfo); + + //Is Called on Loading. + //In this Method only Events and Services should be created + //to offer them to other Modules or Plugins during the Init process + //If False is Returned this will cause a Forced Exit + Function Load: Boolean; virtual; + + //Is Called on Init Process + //In this Method you can Hook some Events and Create + Init + //your Classes, Variables etc. + //If False is Returned this will cause a Forced Exit + Function Init: Boolean; virtual; + + //Is Called during Mainloop before 'Core/MainLoop' Hook and Drawing + //If False is Returned this will cause a Forced Exit + Function MainLoop: Boolean; virtual; + + //Is Called if this Module has been Inited and there is a Exit. + //Deinit is in backwards Initing Order + //If False is Returned this will cause a Forced Exit + Procedure DeInit; virtual; + end; + cCoreModule = class of TCoreModule; + +implementation + +//------------- +// Function that gives some Infos about the Module to the Core +//------------- +Procedure TCoreModule.Info(const pInfo: PModuleInfo); +begin + pInfo^.Name := 'Not Set'; + pInfo^.Version := 0; + pInfo^.Description := 'Not Set'; +end; + +//------------- +//Is Called on Loading. +//In this Method only Events and Services should be created +//to offer them to other Modules or Plugins during the Init process +//If False is Returned this will cause a Forced Exit +//------------- +Function TCoreModule.Load: Boolean; +begin + //Dummy ftw!! + Result := True; +end; + +//------------- +//Is Called on Init Process +//In this Method you can Hook some Events and Create + Init +//your Classes, Variables etc. +//If False is Returned this will cause a Forced Exit +//------------- +Function TCoreModule.Init: Boolean; +begin + //Dummy ftw!! + Result := True; +end; + +//------------- +//Is Called during Mainloop before 'Core/MainLoop' Hook and Drawing +//If False is Returned this will cause a Forced Exit +//------------- +Function TCoreModule.MainLoop: Boolean; +begin + //Dummy ftw!! + Result := True; +end; + +//------------- +//Is Called if this Module has been Inited and there is a Exit. +//Deinit is in backwards Initing Order +//------------- +Procedure TCoreModule.DeInit; +begin + //Dummy ftw!! +end; + +end. \ No newline at end of file diff --git a/Game/Code/Classes/UHooks.pas b/Game/Code/Classes/UHooks.pas new file mode 100644 index 00000000..c73ccbbb --- /dev/null +++ b/Game/Code/Classes/UHooks.pas @@ -0,0 +1,375 @@ +unit UHooks; + +{********************* + THookManager + Class for saving, managing and calling of Hooks. + Saves all hookable events and their subscribers +*********************} +interface +uses uPluginDefs, SysUtils, WINDOWS; + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +type + //Record that saves info from Subscriber + PSubscriberInfo = ^TSubscriberInfo; + TSubscriberInfo = record + Self: THandle; //ID of this Subscription (First Word: ID of Subscription; 2nd Word: ID of Hook) + Next: PSubscriberInfo; //Pointer to next Item in HookChain + + //Here is s/t tricky + //To avoid writing of Wrapping Functions to Hook an Event with a Class + //We save a Normal Proc or a Method of a Class + Case isClass: boolean of + False: (Proc: TUS_Hook); //Proc that will be called on Event + True: (ProcOfClass: TUS_Hook_of_Object); + end; + + TEventInfo = record + Name: String[60]; //Name of Event + FirstSubscriber: PSubscriberInfo; //First subscriber in chain + LastSubscriber: PSubscriberInfo; //Last " (for easier subscriber adding + end; + + THookManager = class + private + Events: array of TEventInfo; + SpaceinEvents: Word; //Number of empty Items in Events Array. (e.g. Deleted Items) + public + constructor Create(const SpacetoAllocate: Word); + + Function AddEvent (const EventName: PChar): THandle; + Function DelEvent (hEvent: THandle): Integer; + + Function AddSubscriber (const EventName: PChar; const Proc: TUS_Hook = nil; const ProcOfClass: TUS_Hook_of_Object = nil): THandle; + Function DelSubscriber (const hSubscriber: THandle): Integer; + + Function CallEventChain (const hEvent: THandle; const wParam, lParam: LongWord): Integer; + Function EventExists (const EventName: PChar): Integer; + end; + +function HookTest(wParam, lParam: DWord): integer; stdcall; +function HookTest2(wParam, lParam: DWord): integer; stdcall; + +var + HookManager: THookManager; + +implementation + +//------------ +// Create - Creates Class and Set Standard Values +//------------ +constructor THookManager.Create(const SpacetoAllocate: Word); +var I: Integer; +begin + //Get the Space and "Zero" it + SetLength (Events, SpacetoAllocate); + For I := 0 to SpacetoAllocate do + Events[I].Name[1] := chr(0); + + SpaceinEvents := SpacetoAllocate; + + {$IFDEF DEBUG} + WriteLn('HookManager: Succesful Created.'); + {$ENDIF} +end; + +//------------ +// AddEvent - Adds an Event and return the Events Handle or 0 on Failure +//------------ +Function THookManager.AddEvent (const EventName: PChar): THandle; +var I: Integer; +begin + Result := 0; + + if (EventExists(EventName) = 0) then + begin + If (SpaceinEvents > 0) then + begin + //There is already Space available + //Go Search it! + For I := 0 to High(Events) do + If (Events[I].Name[1] = chr(0)) then + begin //Found Space + Result := I; + Dec(SpaceinEvents); + Break; + end; + + {$IFDEF DEBUG} + WriteLn('HookManager: Found Space for Event at Handle: ''' + InttoStr(Result+1) + ''); + {$ENDIF} + end + else + begin //There is no Space => Go make some! + Result := Length(Events); + SetLength(Events, Result + 1); + end; + + //Set Events Data + Events[Result].Name := EventName; + Events[Result].FirstSubscriber := nil; + Events[Result].LastSubscriber := nil; + + //Handle is Index + 1 + Inc(Result); + + {$IFDEF DEBUG} + WriteLn('HookManager: Add Event succesful: ''' + EventName + ''); + {$ENDIF} + end + {$IFDEF DEBUG} + else + WriteLn('HookManager: Trying to ReAdd Event: ''' + EventName + ''); + {$ENDIF} +end; + +//------------ +// DelEvent - Deletes an Event by Handle Returns False on Failure +//------------ +Function THookManager.DelEvent (hEvent: THandle): Integer; +var + Cur, Last: PSubscriberInfo; +begin + hEvent := hEvent - 1; //Arrayindex is Handle - 1 + Result := -1; + + + If (Length(Events) > hEvent) AND (Events[hEvent].Name[1] <> chr(0)) then + begin //Event exists + //Free the Space for all Subscribers + Cur := Events[hEvent].FirstSubscriber; + + While (Cur <> nil) do + begin + Last := Cur; + Cur := Cur.Next; + FreeMem(Last, SizeOf(TSubscriberInfo)); + end; + + {$IFDEF DEBUG} + WriteLn('HookManager: Removed Event succesful: ''' + Events[hEvent].Name + ''); + {$ENDIF} + + //Free the Event + Events[hEvent].Name[1] := chr(0); + Inc(SpaceinEvents); //There is one more space for new events + end + + {$IFDEF DEBUG} + else + WriteLn('HookManager: Try to Remove not Existing Event. Handle: ''' + InttoStr(hEvent) + ''); + {$ENDIF} +end; + +//------------ +// AddSubscriber - Adds an Subscriber to the Event by Name +// Returns Handle of the Subscribtion or 0 on Failure +//------------ +Function THookManager.AddSubscriber (const EventName: PChar; const Proc: TUS_Hook; const ProcOfClass: TUS_Hook_of_Object): THandle; +var + EventHandle: THandle; + EventIndex: Cardinal; + Cur: PSubscriberInfo; +begin + Result := 0; + + If (@Proc <> nil) or (@ProcOfClass <> nil) then + begin + EventHandle := EventExists(EventName); + + If (EventHandle <> 0) then + begin + EventIndex := EventHandle - 1; + + //Get Memory + GetMem(Cur, SizeOf(TSubscriberInfo)); + + //Fill it with Data + Cur.Next := nil; + + If (@Proc = nil) then + begin //Use the ProcofClass Method + Cur.isClass := True; + Cur.ProcOfClass := ProcofClass; + end + else //Use the normal Proc + begin + Cur.isClass := False; + Cur.Proc := Proc; + end; + + //Create Handle (1st Word: Handle of Event; 2nd Word: unique ID + If (Events[EventIndex].LastSubscriber = nil) then + begin + If (Events[EventIndex].FirstSubscriber = nil) then + begin + Result := (EventHandle SHL 16); + Events[EventIndex].FirstSubscriber := Cur; + end + Else + begin + Result := Events[EventIndex].FirstSubscriber.Self + 1; + end; + end + Else + begin + Result := Events[EventIndex].LastSubscriber.Self + 1; + Events[EventIndex].LastSubscriber.Next := Cur; + end; + + Cur.Self := Result; + + //Add to Chain + Events[EventIndex].LastSubscriber := Cur; + + {$IFDEF DEBUG} + WriteLn('HookManager: Add Subscriber to Event ''' + Events[EventIndex].Name + ''' succesful. Handle: ''' + InttoStr(Result) + ''); + {$ENDIF} + end; + end; +end; + +//------------ +// DelSubscriber - Deletes a Subscribtion by Handle, return non Zero on Failure +//------------ +Function THookManager.DelSubscriber (const hSubscriber: THandle): Integer; +var + EventIndex: Cardinal; + Cur, Last: PSubscriberInfo; +begin + Result := -1; + EventIndex := ((hSubscriber AND (High(THandle) xor High(Word))) SHR 16) - 1; + + //Existing Event ? + If (EventIndex < Length(Events)) AND (Events[EventIndex].Name[1] <> chr(0)) then + begin + Result := -2; //Return -1 on not existing Event, -2 on not existing Subscription + + //Search for Subscription + Cur := Events[EventIndex].FirstSubscriber; + Last := nil; + + //go through the chain ... + While (Cur <> nil) do + begin + If (Cur.Self = hSubscriber) then + begin //Found Subscription we searched for + //Delete from Chain + If (Last <> nil) then + begin + Last.Next := Cur.Next; + end + else //Was first Popup + begin + Events[EventIndex].FirstSubscriber := Cur.Next; + end; + + //Was this Last subscription ? + If (Cur = Events[EventIndex].LastSubscriber) then + begin //Change Last Subscriber + Events[EventIndex].LastSubscriber := Last; + end; + + //Free Space: + FreeMem(Cur, SizeOf(TSubscriberInfo)); + + {$IFDEF DEBUG} + WriteLn('HookManager: Del Subscriber from Event ''' + Events[EventIndex].Name + ''' succesful. Handle: ''' + InttoStr(hSubscriber) + ''); + {$ENDIF} + + //Set Result and Break the Loop + Result := 0; + Break; + end; + + Last := Cur; + Cur := Cur.Next; + end; + + end; +end; + + +//------------ +// CallEventChain - Calls the Chain of a specified EventHandle +// Returns: -1: Handle doesn't Exist, 0 Chain is called until the End +//------------ +Function THookManager.CallEventChain (const hEvent: THandle; const wParam, lParam: LongWord): Integer; +var + EventIndex: Cardinal; + Cur: PSubscriberInfo; +begin + Result := -1; + EventIndex := hEvent - 1; + + If ((EventIndex <= High(Events)) AND (Events[EventIndex].Name[1] <> chr(0))) then + begin //Existing Event + //Start calling the Chain !!!11 + Cur := Events[EventIndex].FirstSubscriber; + Result := 0; + //Call Hooks until the Chain is at the End or breaked + While ((Cur <> nil) AND (Result = 0)) do + begin + if (Cur.isClass) then + Result := Cur.ProcOfClass(wParam, lParam) + else + Result := Cur.Proc(wParam, lParam); + + Cur := Cur.Next; + end; + end; + + {$IFDEF DEBUG} + WriteLn('HookManager: Called Chain from Event ''' + Events[EventIndex].Name + ''' succesful. Result: ''' + InttoStr(Result) + ''); + {$ENDIF} +end; + +//------------ +// EventExists - Returns non Zero if an Event with the given Name exists +//------------ +Function THookManager.EventExists (const EventName: PChar): Integer; +var + I: Integer; + Name: String[60]; +begin + Result := 0; + //If (Length(EventName) < + Name := String(EventName); + + //Sure not to search for empty space + If (Name[1] <> chr(0)) then + begin + //Search for Event + For I := 0 to High(Events) do + If (Events[I].Name = Name) then + begin //Event found + Result := I + 1; + Break; + end; + end; +end; + + +function HookTest(wParam, lParam: DWord): integer; stdcall; +var Test: String[60]; +var T2: String; +begin + Messagebox(0, 'Test', 'test', MB_ICONWARNING or MB_OK); + + Result := 0; //Don't break the chain +end; + +function HookTest2(wParam, lParam: DWord): integer; stdcall; +begin + //Showmessage(String(PCHAR(Ptr(lParam))); + Messagebox(0, Ptr(lParam), 'test', MB_ICONWARNING or MB_OK); + + Result := 0; //Don't break the chain +end; + +end. diff --git a/Game/Code/Classes/UModules.pas b/Game/Code/Classes/UModules.pas new file mode 100644 index 00000000..e8e759ff --- /dev/null +++ b/Game/Code/Classes/UModules.pas @@ -0,0 +1,20 @@ +unit UModules; + +interface +{********************* + UModules + Unit Contains all used Modules in its uses clausel + and a const with an array of all Modules to load +*********************} + +uses + UCoreModule; + +const + CORE_MODULES_TO_LOAD: Array[0..0] of cCoreModule = ( + TCoreModule //Remove this later, just a dummy + ); + +implementation + +end. \ No newline at end of file diff --git a/Game/Code/Classes/UServices.pas b/Game/Code/Classes/UServices.pas new file mode 100644 index 00000000..fce81bd8 --- /dev/null +++ b/Game/Code/Classes/UServices.pas @@ -0,0 +1,312 @@ +unit UServices; + +interface +uses uPluginDefs, SysUtils; +{********************* + TServiceManager + Class for saving, managing and calling of Services. + Saves all Services and their Procs +*********************} + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +type + TServiceName = String[60]; + PServiceInfo = ^TServiceInfo; + TServiceInfo = record + Self: THandle; //Handle of this Service + Hash: Integer; //4 Bit Hash of the Services Name + Name: TServiceName; //Name of this Service + + Owner: Integer; //If > 0 [DLLMan Pluginindex + 1]; 0 - undefined, On Error Full shutdown, If < 0 [ModuleIndex - 1] + + Next: PServiceInfo; //Pointer to the Next Service in teh list + + //Here is s/t tricky + //To avoid writing of Wrapping Functions to offer a Service from a Class + //We save a Normal Proc or a Method of a Class + Case isClass: boolean of + False: (Proc: TUS_Service); //Proc that will be called on Event + True: (ProcOfClass: TUS_Service_of_Object); + end; + + TServiceManager = class + private + //Managing Service List + FirstService: PServiceInfo; + LastService: PServiceInfo; + + //Some Speed improvement by caching the last 4 called Services + //Most of the time a Service is called multiple times + ServiceCache: Array[0..3] of PServiceInfo; + NextCacheItem: Byte; + + //Next Service added gets this Handle: + NextHandle: THandle; + public + Constructor Create; + + Function AddService(const ServiceName: PChar; const Proc: TUS_Service = nil; const ProcofClass: TUS_Service_of_Object = nil): THandle; + Function DelService(const hService: THandle): integer; + + Function CallService(const ServiceName: PChar; const wParam, lParam: dWord): integer; + + Function NametoHash(const ServiceName: TServiceName): Integer; + Function ServiceExists(const ServiceName: PChar): Integer; + end; + +var + ServiceManager: TServiceManager; + +implementation + +//------------ +// Create - Creates Class and Set Standard Values +//------------ +Constructor TServiceManager.Create; +begin + FirstService := nil; + LastService := nil; + + ServiceCache[0] := nil; + ServiceCache[1] := nil; + ServiceCache[2] := nil; + ServiceCache[3] := nil; + + NextCacheItem := 0; + + NextHandle := 1; + + {$IFDEF DEBUG} + WriteLn('ServiceManager: Succesful created!'); + {$ENDIF} +end; + +//------------ +// Function Creates a new Service and Returns the Services Handle, +// 0 on Failure. (Name already exists) +//------------ +Function TServiceManager.AddService(const ServiceName: PChar; const Proc: TUS_Service; const ProcofClass: TUS_Service_of_Object): THandle; +var + Cur: PServiceInfo; +begin + Result := 0; + + If (@Proc <> nil) or (@ProcOfClass <> nil) then + begin + If (ServiceExists(ServiceName) = 0) then + begin //There is a Proc and the Service does not already exist + //Ok Add it! + + //Get Memory + GetMem(Cur, SizeOf(TServiceInfo)); + + //Fill it with Data + Cur.Next := nil; + + If (@Proc = nil) then + begin //Use the ProcofClass Method + Cur.isClass := True; + Cur.ProcOfClass := ProcofClass; + end + else //Use the normal Proc + begin + Cur.isClass := False; + Cur.Proc := Proc; + end; + + Cur.Self := NextHandle; + //Zero Name + Cur.Name := #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0; + Cur.Name := String(ServiceName); + Cur.Hash := NametoHash(Cur.Name); + + //Add Service to the List + If (FirstService = nil) then + FirstService := Cur; + + If (LastService <> nil) then + LastService.Next := Cur; + + LastService := Cur; + + {$IFDEF DEBUG} + WriteLn('ServiceManager: Service added: ''' + ServiceName + ''', Handle: ' + InttoStr(Cur.Self)); + {$ENDIF} + + //Inc Next Handle + Inc(NextHandle); + end + {$IFDEF DEBUG} + else WriteLn('ServiceManager: Try to readd Service: ' + ServiceName); + {$ENDIF} + end; +end; + +//------------ +// Function Destroys a Service, 0 on success, not 0 on Failure +//------------ +Function TServiceManager.DelService(const hService: THandle): integer; +var + Last, Cur: PServiceInfo; + I: Integer; +begin + Result := -1; + + Last := nil; + Cur := FirstService; + + //Search for Service to Delete + While (Cur <> nil) do + begin + If (Cur.Self = hService) then + begin //Found Service => Delete it + + //Delete from List + If (Last = nil) then //Found first Service + FirstService := Cur.Next + Else //Service behind the first + Last.Next := Cur.Next; + + //IF this is the LastService, correct LastService + If (Cur = LastService) then + LastService := Last; + + //Search for Service in Cache and delete it if found + For I := 0 to High(ServiceCache) do + If (ServiceCache[I] = Cur) then + begin + ServiceCache[I] := nil; + end; + + {$IFDEF DEBUG} + WriteLn('ServiceManager: Removed Service succesful: ' + Cur.Name); + {$ENDIF} + + //Free Memory + Freemem(Cur, SizeOf(TServiceInfo)); + + //Break the Loop + Break; + end; + + //Go to Next Service + Last := Cur; + Cur := Cur.Next; + end; +end; + +//------------ +// Function Calls a Services Proc +// Returns Services Return Value or SERVICE_NOT_FOUND on Failure +//------------ +Function TServiceManager.CallService(const ServiceName: PChar; const wParam, lParam: dWord): integer; +var + SExists: Integer; + Service: PServiceInfo; +begin + Result := SERVICE_NOT_FOUND; + SExists := ServiceExists(ServiceName); + If (SExists <> 0) then + begin + Service := ptr(SExists); + If (Service.isClass) then + //Use Proc of Class + Result := Service.ProcOfClass(wParam, lParam) + Else + //Use normal Proc + Result := Service.Proc(wParam, lParam); + end; + + {$IFDEF DEBUG} + WriteLn('ServiceManager: Service ''' + ServiceName + ''' called. Result: ' + InttoStr(Result)); + {$ENDIF} +end; + +//------------ +// Generates the Hash for the given Name +//------------ +Function TServiceManager.NametoHash(const ServiceName: TServiceName): Integer; +asm + { CL: Counter; EAX: Result; EDX: Current Memory Address } + Mov CL, 14 {Init Counter, Fold 14 Times to became 4 Bytes out of 60} + + Mov EDX, ServiceName {Save Address of String that should be "Hashed"} + + Mov EAX, [EDX] + + @FoldLoop: ADD EDX, 4 {jump 4 Byte(32 Bit) to the next tile } + ADD EAX, [EDX] {Add the Value of the next 4 Byte of the String to the Hash} + + LOOP @FoldLoop {Fold again if there are Chars Left} +end; + + +//------------ +// Function Returns Non Zero if a Service with the given Name Exists, otherwise 0 +//------------ +Function TServiceManager.ServiceExists(const ServiceName: PChar): Integer; +var + Name: TServiceName; + Hash: Integer; + Cur: PServiceInfo; + I: Byte; +begin + Result := 0; + // to-do : Write a Metbod (in ASM) to Zero and Add in one turn (faster then this dirty hack ;) + //Zero Name: + Name := #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0; + //Add Service Name + Name := String(ServiceName); + Hash := NametoHash(Name); + + //First of all Look for the Service in Cache + For I := 0 to High(ServiceCache) do + begin + If (ServiceCache[I] <> nil) AND (ServiceCache[I].Hash = Hash) then + begin + If (ServiceCache[I].Name = Name) then + begin //Found Service in Cache + Result := Integer(ServiceCache[I]); + + {$IFDEF DEBUG} + WriteLn('ServiceManager: Found Service in Cache: ''' + ServiceName + ''''); + {$ENDIF} + + Break; + end; + end; + end; + + If (Result = 0) then + begin + Cur := FirstService; + While (Cur <> nil) do + begin + If (Cur.Hash = Hash) then + begin + If (Cur.Name = Name) then + begin //Found the Service + Result := Integer(Cur); + + {$IFDEF DEBUG} + WriteLn('ServiceManager: Found Service in List: ''' + ServiceName + ''''); + {$ENDIF} + + //Add to Cache + ServiceCache[NextCacheItem] := Cur; + NextCacheItem := (NextCacheItem + 1) AND 3; + Break; + end; + end; + + Cur := Cur.Next; + end; + end; +end; + +end. \ No newline at end of file diff --git a/Game/Code/Classes/USingScores.pas b/Game/Code/Classes/USingScores.pas index 7625c17c..11f1f07d 100644 --- a/Game/Code/Classes/USingScores.pas +++ b/Game/Code/Classes/USingScores.pas @@ -374,7 +374,6 @@ end; Procedure TSingScores.SpawnPopUp(const PlayerIndex: Byte; const Rating: Byte; const Score: Word); var Cur: PScorePopUp; begin - Log.LogError('Spawn PopUp: Score: ' + InttoStr(Score)); if (PlayerIndex < PlayerCount) then begin //Get Memory and Add Data diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index b9fa0530..b154c653 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -1,8 +1,5 @@ program UltraStar; -{$DEFINE TRANSLATE} -{$DEFINE DEBUG} //Remove b4 release - {$R 'UltraStar.res' 'UltraStar.rc'} {$I switches.inc} @@ -99,11 +96,11 @@ uses USingNotes in 'Classes\USingNotes.pas', //New Plugin and Core Management - {ULists in 'Classes\ULists.pas', //maybe drop this - UHooks in 'Classes\UHooks.pas', //80 % - Whiteshark is about to work on this - UServices in 'Classes\UServices.pas', //20 % - Whiteshark is about to work on this - UCore in 'Classes\UCore.pas', - UCoreModule in 'Classes\UCoreModule.pas', } + UModules in 'Classes\UModules.pas', //This Unit contains a const with the Modules to Load + UHooks in 'Classes\UHooks.pas', //Class for Hook Management //Write Freeing Methods for Both + UServices in 'Classes\UServices.pas', //95% - One Hack to remove ;) + UCore in 'Classes\UCore.pas', //30 % - Many Classes needs Rewriting or Manipulation + UCoreModule in 'Classes\UCoreModule.pas', UPluginInterface in 'Classes\UPluginInterface.pas', //Some changes to work with unwriten classes, need to be done //------------------------------ @@ -191,7 +188,7 @@ begin Inc(I); hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); until (hWnd = 0); - + MessageBox( WndTitle := WndTitle + ' Instance ' + InttoStr(I); end else diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index fda3cd75..4e5deb2d 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -1,3 +1,5 @@ +{$DEFINE DEBUG} // to-do : Remove b4 release + {$IFDEF FPC} {$UNDEF UseSerialPort} {$UNDEF UseMIDIPort} -- cgit v1.2.3 From 2f80e3be339f528bd0c7ef54db8ff7cc641883e3 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 10 Oct 2007 18:07:01 +0000 Subject: Fixed some Bugs from Previous Commit git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@498 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCore.pas | 19 ++++++++++++------- Game/Code/UltraStar.dpr | 1 - 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UCore.pas b/Game/Code/Classes/UCore.pas index 744fabe2..990ee7ab 100644 --- a/Game/Code/Classes/UCore.pas +++ b/Game/Code/Classes/UCore.pas @@ -31,8 +31,8 @@ type hExit: THandle; hDebug: THandle; hError: THandle; - sgiveError: THandle; - sgiveDebug: THandle; + sReportError: THandle; + sReportDebug: THandle; Modules: Array [0..High(CORE_MODULES_TO_LOAD)] of TModuleListItem; @@ -81,8 +81,8 @@ type // Hook and Service Procs: //-------------- Function ShowMessage(wParam, lParam: DWord): integer; //Shows a Message (lParam: PChar Text, wParam: Symbol) - Function ShowMessage(wParam, lParam: DWord): integer; //Shows a Message (lParam: PChar Text, wParam: Symbol) - Function ShowMessage(wParam, lParam: DWord): integer; //Shows a Message (lParam: PChar Text, wParam: Symbol) + {Function ShowMessage(wParam, lParam: DWord): integer; //Shows a Message (lParam: PChar Text, wParam: Symbol) + Function ShowMessage(wParam, lParam: DWord): integer; //Shows a Message (lParam: PChar Text, wParam: Symbol)} end; var @@ -178,6 +178,8 @@ end; //Inits Core and all Modules //------------- Function TCore.Init: Boolean; +var + I: Integer; begin Result := InitCore; @@ -193,8 +195,9 @@ end; //DeInits Core and all Modules //------------- Function TCore.DeInit: Boolean; - - label Continue; +var + I: Integer; +label Continue; begin I := High(CORE_MODULES_TO_LOAD); @@ -209,8 +212,10 @@ begin end; Except - GoTo Continue; + end; + If (I >= 0) then + GoTo Continue; DeInitCore; end; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index b154c653..ed58e97f 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -188,7 +188,6 @@ begin Inc(I); hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); until (hWnd = 0); - MessageBox( WndTitle := WndTitle + ' Instance ' + InttoStr(I); end else -- cgit v1.2.3 From 48676faa6c0da1eb77999512322896840ea13cb1 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 11 Oct 2007 08:03:12 +0000 Subject: major changes to FFMPEG Headers so they now support linux. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@500 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/ffmpeg/MATHEMATICS.pas | 124 ++++++++++-------- Game/Code/lib/ffmpeg/avcodec.pas | 132 +++++++++++++------ Game/Code/lib/ffmpeg/avformat.pas | 248 +++++++++++++++++++++-------------- Game/Code/lib/ffmpeg/avio.pas | 24 ++-- Game/Code/lib/ffmpeg/avutil.pas | 20 +-- Game/Code/lib/ffmpeg/opt.pas | 19 +-- Game/Code/lib/ffmpeg/rational.pas | 29 ++-- 7 files changed, 355 insertions(+), 241 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/lib/ffmpeg/MATHEMATICS.pas b/Game/Code/lib/ffmpeg/MATHEMATICS.pas index 9570d343..83121899 100644 --- a/Game/Code/lib/ffmpeg/MATHEMATICS.pas +++ b/Game/Code/lib/ffmpeg/MATHEMATICS.pas @@ -1,58 +1,66 @@ -unit MATHEMATICS; - -interface - -(* - * copyright (c) 2005 Michael Niedermayer - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) - -uses - windows, rational; - -const - av__util = 'avutil-49.dll'; - -type - TAVRounding = ( - AV_ROUND_ZERO = 0, ///< round toward zero - AV_ROUND_INF = 1, ///< round away from zero - AV_ROUND_DOWN = 2, ///< round toward -infinity - AV_ROUND_UP = 3, ///< round toward +infinity - AV_ROUND_NEAR_INF = 5, ///< round to nearest and halfway cases away from zero - AV_ROUND_FUCKING = $FFFFFF - ); - -(** * rescale a 64bit integer with rounding to nearest. - * a simple a*b/c isn't possible as it can overflow *) -function av_rescale (a, b, c: int64): int64; - cdecl; external av__util; - -(** - * rescale a 64bit integer with specified rounding. - * a simple a*b/c isn't possible as it can overflow *) -function av_rescale_rnd (a, b, c: int64; enum: TAVRounding): int64; - cdecl; external av__util; - -(** - * rescale a 64bit integer by 2 rational numbers. *) -function av_rescale_q (a: int64; bq, cq: TAVRational): int64; - cdecl; external av__util; - -implementation - -end. - \ No newline at end of file +unit MATHEMATICS; + +interface + +(* + * copyright (c) 2005 Michael Niedermayer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +(* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. +For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT +in the source codes *) + +{$MODE DELPHI} (* CAT *) +{$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) +{$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) + +uses + rational; (* CAT *) + +const + av__util = 'libavutil.49'; (* CAT *) + +type + TAVRounding = ( + AV_ROUND_ZERO = 0, ///< round toward zero + AV_ROUND_INF = 1, ///< round away from zero + AV_ROUND_DOWN = 2, ///< round toward -infinity + AV_ROUND_UP = 3, ///< round toward +infinity + AV_ROUND_NEAR_INF = 5, ///< round to nearest and halfway cases away from zero + AV_ROUND_FUCKING = $FFFFFF + ); + +(** * rescale a 64bit integer with rounding to nearest. + * a simple a*b/c isn't possible as it can overflow *) +function av_rescale (a, b, c: int64): int64; + cdecl; external av__util; + +(** + * rescale a 64bit integer with specified rounding. + * a simple a*b/c isn't possible as it can overflow *) +function av_rescale_rnd (a, b, c: int64; enum: TAVRounding): int64; + cdecl; external av__util; + +(** + * rescale a 64bit integer by 2 rational numbers. *) +function av_rescale_q (a: int64; bq, cq: TAVRational): int64; + cdecl; external av__util; + +implementation + +end. + diff --git a/Game/Code/lib/ffmpeg/avcodec.pas b/Game/Code/lib/ffmpeg/avcodec.pas index bef5f687..c82bc329 100644 --- a/Game/Code/lib/ffmpeg/avcodec.pas +++ b/Game/Code/lib/ffmpeg/avcodec.pas @@ -15,32 +15,35 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) + +(* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. +For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT +in the source codes *) + unit avcodec; +{$LINKLIB libavutil} +{$LINKLIB libavcodec} +{$MODE DELPHI } (* CAT *) +{$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) +{$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) + interface uses - {$IFDEF win32} - windows, - {$ENDIF} - avutil, - rational, - opt; + avutil, rational, opt; // CAT const - {$IFDEF win32} - av__format = 'avformat-50.dll'; - {$ELSE} - av__format = 'libavformat.so'; // .0d - {$ENDIF} +(* version numbers are changed by The Creative CAT *) + av__format = 'libavformat.51'; - - LIBAVUTIL_VERSION_INT = ((51 shl 16) + (16 shl 8) + 0); - LIBAVUTIL_VERSION = '51.16.0'; + LIBAVUTIL_VERSION_INT = ((51 shl 16) + (12 shl 8) + 1); + LIBAVUTIL_VERSION = '51.12.1'; LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; AV_NOPTS_VALUE: int64 = $8000000000000000; AV_TIME_BASE = 1000000; + AV_TIME_BASE_Q : TAVRational = (num:1; den:AV_TIME_BASE); (* added by CAT *) type TCodecID = ( @@ -119,7 +122,8 @@ type CODEC_TYPE_VIDEO, CODEC_TYPE_AUDIO, CODEC_TYPE_DATA, - CODEC_TYPE_SUBTITLE + CODEC_TYPE_SUBTITLE, + CODEC_TYPE_NB (* CAT#3 *) ); //* currently unused, may be used if 24/32 bits samples ever supported */ @@ -347,11 +351,11 @@ type TAVFrame = record {200} (*** pointer to the picture planes. * this might be different from the first allocated byte *) - data: array [0..3] of pointer; + data: array [0..3] of pbyte; linesize: array [0..3] of integer; (*** pointer to the first allocated byte of the picture. can be used in get_buffer/release_buffer * this isn't used by lavc unless the default get/release_buffer() is used*) - base: array [0..3] of pchar; + base: array [0..3] of pbyte; (*** 1 -> keyframe, 0-> not *) key_frame: integer; (*** picture type of the frame, see ?_TYPE below.*) @@ -374,7 +378,7 @@ type (*** QP store stride*) qstride: integer; (*** mbskip_table[mb]>=1 if MB didnt change*) - mbskip_table: pchar; + mbskip_table: pbyte; (** * Motion vector table. * @code @@ -403,9 +407,9 @@ type (*** when decoding, this signal how much the picture must be delayed. * extra_delay = repeat_pict / (2*fps)*) repeat_pict: integer; - qscale_type: Integer; + qscale_type: integer; (*** The content of the picture is interlaced.*) - interlaced_frame: Integer; + interlaced_frame: integer; (*** if the content is interlaced, is top field displayed first.*) top_field_first: integer; (*** Pan scan.*) @@ -416,9 +420,9 @@ type * - decoding: set by lavc (before get_buffer() call))*) buffer_hints: integer; (*** DCT coeffitients*) - dct_coeff: PSmallInt; + dct_coeff: PsmallInt; (*** Motion referece frame index*) - ref_index: array [0..1] of pchar; + ref_index: array [0..1] of pshortint; end; const @@ -573,12 +577,12 @@ const X264_PART_B8X8 = $100; (* Analyse b16x8, b8x16 and b8x8 *) type - PAVCLASS = ^TAVCLASS; + PAVClass = ^TAVClass; PAVCodecContext = ^TAVCodecContext; PAVCodec = ^TAVCodec; PAVPaletteControl = ^TAVPaletteControl; - TAVCLASS = record {12} + TAVclass = record {12} class_name: pchar; (* actually passing a pointer to an AVCodecContext or AVFormatContext, which begin with an AVClass. @@ -629,7 +633,7 @@ type * - encoding: set/allocated/freed by lavc. * - decoding: set/allocated/freed by user. *) - extradata: pointer; + extradata: pbyte; extradata_size: integer; (** @@ -787,8 +791,8 @@ type * this is used to workaround some encoder bugs * - encoding: set by user, if not then the default based on codec_id will be used * - decoding: set by user, will be converted to upper case by lavc during init *) -// codec_tag: cardinal; // ìîæíî array [0..3] of char - òîãäà âèäíî FOURCC - codec_tag: array [0..3] of char; + codec_tag: cardinal; // ìîæíî array [0..3] of char - òîãäà âèäíî FOURCC +// codec_tag: array [0..3] of char; (*** workaround bugs in encoders which sometimes cannot be detected automatically. * - encoding: set by user @@ -966,7 +970,7 @@ type (*** slice offsets in the frame in bytes. * - encoding: set/allocated by lavc * - decoding: set/allocated by user (or NULL) *) - slice_offset: PInteger; + slice_offset: Pinteger; (*** error concealment flags. * - encoding: unused @@ -1517,7 +1521,7 @@ type _type: TCodecType; id: TCodecID; priv_data_size: integer; - init: function (avctx: pAVCodecContext): integer; cdecl; + init: function (avctx: PAVCodecContext): integer; cdecl; (* typo corretion by the Creative CAT *) encode: function (avctx: PAVCodecContext; buf: pchar; buf_size: integer; data: pointer): integer; cdecl; close: function (avctx: PAVCodecContext): integer; cdecl; decode: function (avctx: PAVCodecContext; outdata: pointer; outdata_size: PInteger; @@ -1731,12 +1735,18 @@ procedure av_resample_close (c: PAVResampleContext); procedure avcodec_get_context_defaults (s: PAVCodecContext); cdecl; external av__codec; - function avcodec_alloc_context (): PAVCodecContext; + function avcodec_alloc_context : PAVCodecContext; cdecl; external av__codec; +(* favourite of The Creative CAT + function avcodec_alloc_context (): PAVCodecContext; + cdecl; external av__codec; *) procedure avcodec_get_frame_defaults (pic: PAVFrame); cdecl; external av__codec; - function avcodec_alloc_frame (): PAVFrame; + function avcodec_alloc_frame : PAVFrame; cdecl; external av__codec; +(* favourite of The Creative CAT + function avcodec_alloc_frame (): PAVFrame; + cdecl; external av__codec; *) function avcodec_default_get_buffer (s: PAVCodecContext; pic: PAVFrame): integer; cdecl; external av__codec; @@ -1782,9 +1792,15 @@ procedure av_resample_close (c: PAVResampleContext); * @return 0 if successful, -1 if not. *) +(** This comment was added by the Creative CAT. frame_size_ptr was changed to + variable refference. + + * @deprecated Use avcodec_decode_audio2() instead. + *) + function avcodec_decode_audio (avctx: PAVCodecContext; samples: Pword; - frame_size_ptr: pinteger; - buf: pchar; buf_size: integer): integer; + var frame_size_ptr: integer; + buf: pchar; buf_size: integer): integer; cdecl; external av__codec; (* decode a frame. * @param buf bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE larger then the actual read bytes @@ -1793,8 +1809,47 @@ procedure av_resample_close (c: PAVResampleContext); * @param got_picture_ptr zero if no frame could be decompressed, Otherwise, it is non zero * @return -1 if error, otherwise return the number of * bytes used. *) + + function avcodec_decode_audio2(avctx : PAVCodecContext; samples : PWord; + var frame_size_ptr : integer; + buf: pchar; buf_size: integer): integer; + cdecl; external av__codec; +(* Added by The Creative CAT +/** + * Decodes a video frame from \p buf into \p picture. + * The avcodec_decode_video() function decodes a video frame from the input + * buffer \p buf of size \p buf_size. To decode it, it makes use of the + * video codec which was coupled with \p avctx using avcodec_open(). The + * resulting decoded frame is stored in \p picture. + * + * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than + * the actual read bytes because some optimized bitstream readers read 32 or 64 + * bits at once and could read over the end. + * + * @warning The end of the input buffer \p buf should be set to 0 to ensure that + * no overreading happens for damaged MPEG streams. + * + * @note You might have to align the input buffer \p buf and output buffer \p + * samples. The alignment requirements depend on the CPU: on some CPUs it isn't + * necessary at all, on others it won't work at all if not aligned and on others + * it will work but it will have an impact on performance. In practice, the + * bitstream should have 4 byte alignment at minimum and all sample data should + * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If + * the linesize is not a multiple of 16 then there's no sense in aligning the + * start of the buffer to 16. + * + * @param avctx the codec context + * @param[out] picture The AVFrame in which the decoded video frame will be stored. + * @param[in] buf the input buffer + * @param[in] buf_size the size of the input buffer in bytes + * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. + * @return On error a negative value is returned, otherwise the number of bytes + * used or zero if no frame could be decompressed. + */ +*) + function avcodec_decode_video (avctx: PAVCodecContext; picture: PAVFrame; - got_picture_ptr: pinteger; + var got_picture_ptr: integer; (* favour of The Creative CAT *) buf: PByte; buf_size: integer): integer; cdecl; external av__codec; @@ -1802,19 +1857,18 @@ procedure av_resample_close (c: PAVResampleContext); got_sub_ptr: pinteger; const buf: pchar; buf_size: integer): integer; cdecl; external av__codec; - - {$IFNDEF FPC} function avcodec_parse_frame (avctx: PAVCodecContext; pdata: PPointer; data_size_ptr: pinteger; buf: pchar; buf_size: integer): integer; cdecl; external av__codec; - {$ENDIF} + function avcodec_encode_audio (avctx: PAVCodecContext; buf: PByte; - buf_size: integer; const samples: Pword): integer; + buf_size: integer; const samples: PWord): integer; cdecl; external av__codec; (* avcodec_encode_video: -1 if error *) - function avcodec_encode_video (avctx: PAVCodecContext; buf: pointer; + (* type of the second argument is changed by The Creative CAT *) + function avcodec_encode_video (avctx: PAVCodecContext; buf: PByte; buf_size: integer; pict: PAVFrame): integer; cdecl; external av__codec; function avcodec_encode_subtitle (avctx: PAVCodecContext; buf: pchar; diff --git a/Game/Code/lib/ffmpeg/avformat.pas b/Game/Code/lib/ffmpeg/avformat.pas index 312fb67d..7fd009e9 100644 --- a/Game/Code/lib/ffmpeg/avformat.pas +++ b/Game/Code/lib/ffmpeg/avformat.pas @@ -15,33 +15,29 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) + +(* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. +For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT +in the source codes *) + unit avformat; -interface +{$LINKLIB libavutil} +{$LINKLIB libavformat} +{$MODE DELPHI } (* CAT *) +{$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) +{$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} +interface uses - {$IFDEF win32} - windows, - {$ENDIF} - avcodec, - avio, - rational, - avutil; + avcodec, avio, rational, avutil; (* CAT *) const - {$IFDEF win32} - av__format = 'avformat-50.dll'; - {$ELSE} - av__format = 'libavformat.so'; // .0d - av__codec = 'libavcodec.so'; - {$ENDIF} - - LIBAVUTIL_VERSION_INT = ((49 shl 16) + (0 shl 8) + 1); - LIBAVUTIL_VERSION = '49.0.1'; + av__format = 'libavformat.51'; (* CAT *) + + LIBAVUTIL_VERSION_INT = ((51 shl 16) + (12 shl 8) + 1); + LIBAVUTIL_VERSION = '51.12.1'; LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; MAXINT64 = $7fffffffffffffff; @@ -49,10 +45,37 @@ const PKT_FLAG_KEY = $0001; - (* AVImageFormat.flags field constants *) - AVIMAGE_INTERLEAVED = $0001; (* image format support interleaved output *) - MAX_STREAMS = 20; +(*************************************************) +(* input/output formats *) + + AVPROBE_SCORE_MAX = 100; ///< max score, half of that is used for file extension based detection + AVPROBE_PADDING_SIZE = 32; ///< extra allocated bytes at the end of the probe buffer + +//! demuxer will use url_fopen, no opened file should be provided by the caller + AVFMT_NOFILE = $0001; + AVFMT_NEEDNUMBER = $0002; (**< needs '%d' in filename *) + AVFMT_SHOW_IDS = $0008; (**< show format stream IDs numbers *) + AVFMT_RAWPICTURE = $0020; (**< format wants AVPicture structure for + raw picture data *) + AVFMT_GLOBALHEADER = $0040; (**< format wants global header *) + AVFMT_NOTIMESTAMPS = $0080; (**< format does not need / have any timestamps *) + AVFMT_GENERIC_INDEX = $0100; (**< use generic index building code *) + + AVINDEX_KEYFRAME = $0001; + + MAX_REORDER_DELAY = 4; + + AVFMTCTX_NOHEADER = $0001; (**< signal that no header is present + (streams are added dynamically) *) + MAX_STREAMS = 20; + AVFMT_NOOUTPUTLOOP = -1; + AVFMT_INFINITEOUTPUTLOOP = 0; + AVFMT_FLAG_GENPTS = $0001; ///< generate pts if missing even if it requires parsing future frames + AVFMT_FLAG_IGNIDX = $0002; ///< ignore index + AVFMT_FLAG_NONBLOCK = $0004; ///< do not block when reading packets from input + type + HFILE = THandle; /// (* CAT *) int = integer; PAVPacket = ^TAVPacket; @@ -75,9 +98,10 @@ type stream_index: integer; flags: integer; duration: integer; ///< presentation duration in time_base units (0 if not available) - destruct: procedure (p: PAVPacket); + destruct: procedure (p: PAVPacket); (* This cannot be var : TAVPacket. + because TAVPacket is not completely defined yet *) priv: pointer; - pos: int64; ///< byte position in stream, -1 if unknown + pos: int64 ///< byte position in stream, -1 if unknown end; (*************************************************) @@ -90,9 +114,6 @@ type val, num, den: int64; end; -(*************************************************) -(* input/output formats *) - (* this structure contains the data a format has to probe a file *) TAVProbeData = record {12} filename: pchar; @@ -107,9 +128,9 @@ type width: integer; height: integer; pix_fmt: TAVPixelFormat; - image_format: PAVImageFormat; (* 4 bytes *) +{ image_format: PAVImageFormat; (* 4 bytes *)} (* CAT#3 *) channel: integer; (* used to select dv channel *) - device: pchar; (* video, audio or DV device *) + device: pchar; (* video, audio or DV device, if LIBAVFORMAT_VERSION_INT < (52<<16) *) standard: pchar; (* tv standard, NTSC, PAL, SECAM *) // int mpeg2ts_raw:1; (* force raw MPEG2 transport stream output, if possible *) // int mpeg2ts_compute_pcr:1; (* compute exact PCR for each transport @@ -117,6 +138,7 @@ type // mpeg2ts_raw is TRUE *) // int initial_pause:1; (* do not begin to play the stream // immediately (RTSP only) *) +// int prealloced_context:1; dummy: byte; video_codec_id: TCodecID; audio_codec_id: TCodecID; @@ -133,13 +155,20 @@ type audio_codec: TCodecID; (* default audio codec *) video_codec: TCodecID; (* default video codec *) write_header: function (c: PAVFormatContext): integer; cdecl; - write_packet: function (c: PAVFormatContext; pkt: PAVPacket): integer; cdecl; + write_packet: function (c: PAVFormatContext; var pkt: TAVPacket): integer; cdecl; (* CAT#2 *) write_trailer: function (c: PAVFormatContext): integer; cdecl; (* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER *) flags: integer; (* currently only used to set pixel format if not YUV420P *) set_parameters: function (c: PAVFormatContext; f: PAVFormatParameters): integer; cdecl; interleave_packet: function (s: PAVFormatContext; _out: PAVPacket; _in: PAVPacket; flush: integer): integer; cdecl; + + (** + * list of supported codec_id-codec_tag pairs, ordered by "better choice first" + * the arrays are all CODEC_ID_NONE terminated + *) + //const struct AVCodecTag **codec_tag; + (* private fields *) next: PAVOutputFormat; end; @@ -159,7 +188,7 @@ type (* read one packet and put it in 'pkt'. pts and flags are also set. 'av_new_stream' can be called only if the flag AVFMTCTX_NOHEADER is used. *) - read_packet: function (c: PAVFormatContext; pkt: PAVPacket): integer; cdecl; + read_packet: function (c: PAVFormatContext; var pkt: TAVPacket): integer; cdecl; (* close the stream. The AVFormatContext and AVStreams are not freed by this function *) read_close: function (c: PAVFormatContext): integer; cdecl; @@ -188,55 +217,66 @@ type (* pause playing - only meaningful if using a network based format (RTSP) *) read_pause: function (c: PAVFormatContext): integer; cdecl; + //const struct AVCodecTag **codec_tag; + (* private fields *) next: PAVInputFormat; end; + TAVStreamParseType = ( + AVSTREAM_PARSE_NONE, + AVSTREAM_PARSE_FULL, (**< full parsing and repack *) + AVSTREAM_PARSE_HEADERS, (**< only parse headers, don't repack *) + AVSTREAM_PARSE_TIMESTAMPS (**< full parsing and interpolation of timestamps for frames not starting on packet boundary *) + ); + TAVIndexEntry = record {24} pos: int64; timestamp: int64; (* the following 2 flags indicate that the next/prev keyframe is known, and scaning for it isnt needed *) flags: integer; +// int flags:2; +// int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs 32 byte due to possible 8byte align). min_distance: integer; (* min distance between this and the previous keyframe, used to avoid unneeded searching *) end; TAVStream = record {168} - index: integer; (* stream index in AVFormatContext *) - id: integer; (* format specific stream id *) - codec: PAVCodecContext; (* codec context *) + index: integer; (* stream index in AVFormatContext *) {4-4} + id: integer; (* format specific stream id *) {4-8} + codec: PAVCodecContext; (* codec context *) {4-12} (*** real base frame rate of the stream. * for example if the timebase is 1/90000 and all frames have either * approximately 3600 or 1800 timer ticks then r_frame_rate will be 50/1 *) - r_frame_rate: TAVRational; - priv_data: pointer; + r_frame_rate: TAVRational; {4*2=8-20} + priv_data: pointer; {4-24} (* internal data used in av_find_stream_info() *) - codec_info_duration: int64; - codec_info_nb_frames: integer; + codec_info_duration: int64; (* #if LIBAVFORMAT_VERSION_INT < (52<<16) *) {8-32} + codec_info_nb_frames: integer; (* #if LIBAVFORMAT_VERSION_INT < (52<<16) *) {4-38} (* encoding: PTS generation when outputing stream *) - pts: TAVFrac; + pts: TAVFrac; {8*3=24-62} (*** this is the fundamental unit of time (in seconds) in terms * of which frame timestamps are represented. for fixed-fps content, * timebase should be 1/framerate and timestamp increments should be * identically 1. *) - time_base: TAVRational; - pts_wrap_bits: integer; (* number of bits in pts (used for wrapping control) *) + time_base: TAVRational; {4*2=8-70} + pts_wrap_bits: integer; (* number of bits in pts (used for wrapping control) *) {4-74} (* ffmpeg.c private use *) - stream_copy: integer; (* if TRUE, just copy stream *) - discard: TAVDiscard; ///< selects which packets can be discarded at will and dont need to be demuxed + stream_copy: integer; (* if TRUE, just copy stream *) {4-78} + discard: TAVDiscard; ///< selects which packets can be discarded at will and dont need to be demuxed {4-82} //FIXME move stuff to a flags field? (* quality, as it has been removed from AVCodecContext and put in AVVideoFrame * MN:dunno if thats the right place, for it *) - quality: single; + quality: single; {4-86} (* decoding: position of the first frame of the component, in AV_TIME_BASE fractional seconds. *) - start_time: int64; - (* decoding: duration of the stream, in AV_TIME_BASE fractional seconds. *) - duration: int64; + start_time: int64; {8-92} + (* decoding: duration of the stream, in stream time base. *) + duration: int64; {8-100} - language: array [0..3] of char; (* ISO 639 3-letter language code (empty string if undefined) *) + language: array [0..3] of char; (* ISO 639 3-letter language code (empty string if undefined) *)(* 101 th byte - 1 base *) {4-104} (* av_read_frame() support *) - need_parsing: integer; ///< 1->full parsing needed, 2->only parse headers dont repack + need_parsing: TAVStreamParseType;//CAT#3 ///< 1->full parsing needed, 2->only parse headers dont repack parser: PAVCodecParserContext; cur_dts: int64; @@ -245,10 +285,10 @@ type (* av_seek_frame() support *) index_entries: PAVIndexEntry; (* only used if the format does not support seeking natively *) nb_index_entries: integer; - index_entries_allocated_size: integer; + index_entries_allocated_size: cardinal; (* CAT#3 *) nb_frames: int64; ///< number of frames in this stream if known or 0 - pts_buffer: array [0..4] of int64; + pts_buffer: array [0..MAX_REORDER_DELAY] of int64 end; (* format I/O context *) @@ -259,7 +299,7 @@ type oformat: PAVOutputFormat; priv_data: pointer; pb: TByteIOContext; - nb_streams: cardinal;// integer; + nb_streams: cardinal; (* CAT#3 *) streams: array [0..MAX_STREAMS - 1] of PAVStream; filename: array [0..1023] of char; (* input or output filename *) (* stream info *) @@ -297,7 +337,7 @@ type (* av_read_frame() support *) cur_st: PAVStream; - cur_ptr: pchar; + cur_ptr: pbyte; cur_len: integer; cur_pkt: TAVPacket; @@ -317,6 +357,14 @@ type loop_input: integer; (* decoding: size of data to probe; encoding unused *) probesize: cardinal; + + (** + * maximum duration in AV_TIME_BASE units over which the input should be analyzed in av_find_stream_info() + *) + max_analyze_duration: integer; + + key: pbyte; + keylen : integer end; TAVPacketList = record {64} @@ -353,23 +401,19 @@ type flags: integer; next: PAVImageFormat; end; - - {$IFNDEF win32} - HFILE = THandle; - {$ENDIF} -procedure av_destruct_packet_nofree (pkt: PAVPacket); +procedure av_destruct_packet_nofree (var pkt: TAVPacket); (* CAT#2 *) cdecl; external av__format; -procedure av_destruct_packet (pkt: PAVPacket); +procedure av_destruct_packet (var pkt: TAVPacket); (* CAT#2 *) cdecl; external av__format; (* initialize optional fields of a packet *) -procedure av_init_packet (pkt: PAVPacket); +procedure av_init_packet (var pkt: TAVPacket); (* CAT#2 *) -function av_new_packet(pkt: PAVPacket; size: integer): integer; +function av_new_packet(var pkt: TAVPacket; size: integer): integer; (* CAT#2 *) cdecl; external av__format; -function av_get_packet (s: PByteIOContext; pkt: PAVPacket; size: integer): integer; +function av_get_packet (s: PByteIOContext; var pkt: TAVPacket; size: integer): integer; (* CAT#2 *) cdecl; external av__format; function av_dup_packet (pkt: PAVPacket): integer; @@ -378,7 +422,7 @@ function av_dup_packet (pkt: PAVPacket): integer; (** * Free a packet * * @param pkt packet to free *) -procedure av_free_packet (pkt: PAVPacket); +procedure av_free_packet (var pkt: TAVPacket); (* CAT#2 *) procedure av_register_image_format (img_fmt: PAVImageFormat); cdecl; external av__format; @@ -408,15 +452,29 @@ function av_write_image(pb: PByteIOContext; fmt: PAVImageFormat; img: PAVImageIn //#include "rtsp.h" (* utils.c *) - procedure av_register_input_format (format: PAVInputFormat); cdecl; external av__format; - procedure av_register_output_format (format: PAVOutputFormat); cdecl; external av__format; - function guess_stream_format (short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; cdecl; external av__format; - function guess_format(short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; cdecl; external av__format; + procedure av_register_input_format (format: PAVInputFormat); + cdecl; external av__format; + + procedure av_register_output_format (format: PAVOutputFormat); + cdecl; external av__format; + + function guess_stream_format (short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; + cdecl; external av__format; + + function guess_format(short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; + cdecl; external av__format; + function av_guess_codec(fmt: PAVOutputFormat; short_name: pchar; - filename: pchar; mime_type: pchar; _type: TCodecType): TCodecID; cdecl; external av__format; - procedure av_hex_dump (f: HFILE; buf: pchar; size: integer); cdecl; external av__format; - procedure av_pkt_dump(f: HFILE; pkt: pAVPacket; dump_payload: integer); cdecl; external av__format; - procedure av_register_all (); cdecl; external av__format; + filename: pchar; mime_type: pchar; _type: TCodecType): TCodecID; + cdecl; external av__format; + + procedure av_hex_dump (f: HFILE; buf: pchar; size: integer); + cdecl; external av__format; + procedure av_pkt_dump(f: HFILE; var pkt: TAVPacket; dump_payload: integer); (* CAT#2 *) + cdecl; external av__format; + + procedure av_register_all (); + cdecl; external av__format; (* media file input *) @@ -467,7 +525,7 @@ const function av_find_stream_info (ic: PAVFormatContext): integer; cdecl; external av__format; - function av_read_packet (s: PAVFormatContext; pkt: PAVPacket): integer; + function av_read_packet (s: PAVFormatContext; var pkt: TAVPacket): integer; (* CAT#2 *) cdecl; external av__format; (*** Return the next frame of a stream. * @@ -487,7 +545,7 @@ const * * @return 0 if OK, < 0 if error or end of file. *) - function av_read_frame (s: PAVFormatContext; pkt: PAVPacket): integer; + function av_read_frame (s: PAVFormatContext; var pkt: TAVPacket): integer; (* CAT#2 *) cdecl; external av__format; function av_seek_frame (s: PAVFormatContext; stream_index: integer; timestamp: int64; flags: integer): integer; cdecl; external av__format; @@ -530,11 +588,11 @@ const function av_write_header (s: PAVFormatContext): integer; cdecl; external av__format; - function av_write_frame(s: PAVFormatContext; pkt: PAVPacket): integer; - cdecl; external av__format; + function av_write_frame(s: PAVFormatContext; var pkt: TAVPacket): integer; + cdecl; external av__format; (* CAT#2 *) - function av_interleaved_write_frame (s: PAVFormatContext; pkt: PAVPacket): integer; - cdecl; external av__format; + function av_interleaved_write_frame (s: PAVFormatContext; var pkt: TAVPacket): integer; + cdecl; external av__format; (* CAT#2 *) function av_interleave_packet_per_dts(s: PAVFormatContext; _out: PAVPacket; pkt: PAVPacket; flush: integer): integer; @@ -559,7 +617,6 @@ const const FFM_PACKET_SIZE = 4096; - {$IFNDEF FPC} function ffm_read_write_index (fd: integer): int64; cdecl; external av__format; @@ -568,23 +625,20 @@ const procedure ffm_set_write_index (s: PAVFormatContext; pos: int64; file_size: int64); cdecl; external av__format; - {$ENDIF} - + function find_info_tag (arg: pchar; arg_size: integer; tag1: pchar; info: pchar): integer; cdecl; external av__format; - {$IFNDEF FPC} function get_frame_filename(buf: pchar; buf_size: integer; path: pchar; number: integer): integer; cdecl; external av__format; - function filename_number_test (filename: pchar): integer; cdecl; external av__format; + (* grab specific *) function video_grab_init (): integer; cdecl; external av__format; - function audio_init (): integer; cdecl; external av__format; @@ -593,7 +647,6 @@ const cdecl; external av__format; function dc1394_init (): integer; cdecl; external av__format; - {$ENDIF} function strstart(str: pchar; val: pchar; ptr: PPointer): integer; cdecl; external av__format; @@ -610,21 +663,24 @@ const implementation -procedure av_init_packet (pkt: PAVPacket); +procedure av_init_packet (var pkt: TAVPacket); (* CAT#2 + bug fix *) begin - pkt.pts := AV_NOPTS_VALUE; - pkt.dts := AV_NOPTS_VALUE; - pkt.pos := -1; - pkt.duration := 0; - pkt.flags := 0; - pkt.stream_index := 0; - pkt.destruct := @av_destruct_packet_nofree; + with pkt do begin + pts := AV_NOPTS_VALUE; + dts := AV_NOPTS_VALUE; + pos := -1; + duration := 0; + flags := 0; + stream_index := 0; + destruct := @av_destruct_packet_nofree + end end; -procedure av_free_packet (pkt: PAVPacket); +procedure av_free_packet (var pkt: TAVPacket); (* CAT#2 *) begin - if (pkt <> nil) and (@pkt^.destruct <> nil) then - pkt^.destruct (pkt); + if @pkt.destruct <> nil then pkt.destruct (@pkt) +{ if (pkt <> nil) and (@pkt^.destruct <> nil) then + pkt^.destruct (pkt)} end; end. diff --git a/Game/Code/lib/ffmpeg/avio.pas b/Game/Code/lib/ffmpeg/avio.pas index 84622f0d..f1abea3e 100644 --- a/Game/Code/lib/ffmpeg/avio.pas +++ b/Game/Code/lib/ffmpeg/avio.pas @@ -16,21 +16,21 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) -unit avio; -interface +(* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. +For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT +in the source codes *) + +unit avio; +{$MODE DELPHI } (* CAT *) +{$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) +{$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) -{$IFDEF win32} -uses - windows; -{$ENDIF} +interface (* Widows unit is deleted by CAT *) const - {$IFDEF win32} - av__format = 'avformat-50.dll'; - {$ELSE} - av__format = 'libavformat.so'; // .0d - {$ENDIF} +(* version numbers are changed by The Creative CAT *) + av__format = 'libavformat.51'; URL_RDONLY = 0; URL_WRONLY = 1; @@ -230,14 +230,12 @@ type procedure init_checksum (s: PByteIOContext; update_checksum: pointer; checksum: cardinal); cdecl; external av__format; - {$IFNDEF FPC} function udp_set_remote_url(h: PURLContext; const uri: pchar): integer; cdecl; external av__format; function udp_get_local_port(h: PURLContext): integer; cdecl; external av__format; function udp_get_file_handle(h: PURLContext): integer; cdecl; external av__format; - {$ENDIF} implementation diff --git a/Game/Code/lib/ffmpeg/avutil.pas b/Game/Code/lib/ffmpeg/avutil.pas index 7c5926ab..5b5d6762 100644 --- a/Game/Code/lib/ffmpeg/avutil.pas +++ b/Game/Code/lib/ffmpeg/avutil.pas @@ -15,21 +15,23 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) +(* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. +For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT +in the source codes *) unit avutil; +{$MODE DELPHI} +{$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) +{$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) interface - const - {$IFDEF win32} - av__util = 'avutil-49.dll'; - {$ELSE} - av__util = 'libavutil.so'; // .0d - {$ENDIF} - - LIBAVUTIL_VERSION_INT = ((49 shl 16) + (0 shl 8) + 1); - LIBAVUTIL_VERSION = '49.0.1'; +(* version numbers are changed by The Creative CAT *) + av__util = 'libavutil.49'; + + LIBAVUTIL_VERSION_INT = ((49 shl 16) + (4 shl 8) + 1); + LIBAVUTIL_VERSION = '49.4.1'; LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; type diff --git a/Game/Code/lib/ffmpeg/opt.pas b/Game/Code/lib/ffmpeg/opt.pas index c8b72479..0acead1f 100644 --- a/Game/Code/lib/ffmpeg/opt.pas +++ b/Game/Code/lib/ffmpeg/opt.pas @@ -16,15 +16,19 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) +(* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. +For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT +in the source codes *) + unit opt; +{$MODE DELPHI} (* CAT *) +{$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) +{$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) interface uses - {$IFDEF win32} - windows, - {$ENDIF} - rational; + rational; (* CAT *) type TAVOptionType = ( @@ -39,12 +43,9 @@ type ); const +(* version numbers are changed by The Creative CAT *) + av__codec = 'libavcodec.51'; - {$IFDEF win32} - av__codec = 'avcodec-51.dll'; - {$ELSE} - av__codec = 'avcodec.so'; // .0d - {$ENDIF} AV_OPT_FLAG_ENCODING_PARAM = 1; ///< a generic parameter which can be set by the user for muxing or encoding AV_OPT_FLAG_DECODING_PARAM = 2; ///< a generic parameter which can be set by the user for demuxing or decoding diff --git a/Game/Code/lib/ffmpeg/rational.pas b/Game/Code/lib/ffmpeg/rational.pas index 40d1f093..bd2cc94f 100644 --- a/Game/Code/lib/ffmpeg/rational.pas +++ b/Game/Code/lib/ffmpeg/rational.pas @@ -16,23 +16,20 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) -unit rational; +(* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. +For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT +in the source codes *) -interface +unit rational; +{$MODE DELPHI} (* CAT *) +{$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) +{$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) -{$IFDEF win32} -uses - windows; -{$endif} +interface (* unit windows is deleted by CAT *) const - - {$IFDEF win32} - av__util = 'avutil-49.dll'; - {$ELSE} - av__util = 'libavutil.so'; // .0d - {$ENDIF} - +(* version numbers are changed by The Creative CAT *) + av__util = 'libavutil.49'; type @@ -82,10 +79,8 @@ var begin tmp := a.num * b.den - b.num * a.den; - if tmp = 0 then - Result := (tmp shr 63) or 1 - else - Result := 0; + if tmp <> 0 then Result := (tmp shr 63) or 1 (* fixed by CAT *) + else Result := 0 end; function av_q2d(a: TAVRational): double; -- cgit v1.2.3 From d123263213fba448d5695df35660f7de4cbed433 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 11 Oct 2007 08:11:47 +0000 Subject: modified UTime to utilise SDL timer... this allows for reliable cross platform timers. Tested working on linux. Modified UVideo and screens to get Video playback working on linux currently only video stream... no audio.. but I Will be working towards this, for all audio playback ( at least for linux ) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@501 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMain.pas | 16 +- Game/Code/Classes/UTime.pas | 142 +- Game/Code/Classes/UVideo.pas | 258 ++-- Game/Code/Screens/UScreenSing.pas | 2615 +++++++++++++++++++------------------ Game/Code/Screens/UScreenSong.pas | 37 +- Game/Code/UltraStar.lpr | 53 + 6 files changed, 1661 insertions(+), 1460 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index aa4bc639..41676bf3 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -139,7 +139,11 @@ procedure MainLoop; var Delay: integer; begin + Delay := 0; SDL_EnableKeyRepeat(125, 125); + + + CountSkipTime(); // JB - for some reason this seems to be needed when we use the SDL Timer functions. While not Done do Begin // joypad @@ -158,16 +162,26 @@ begin // delay CountMidTime; + + {$IFDEF DebugDisplay} + Writeln( 'TimeMid : '+ inttostr(trunc(TimeMid)) ); + {$ENDIF} + // if 1000*TimeMid > 100 then beep; Delay := Floor(1000 / 100 - 1000 * TimeMid); + {$IFDEF DebugDisplay} + Writeln( 'Delay ms : '+ inttostr(Delay) ); + {$ENDIF} + if Delay >= 1 then SDL_Delay(Delay); // dynamic, maximum is 100 fps CountSkipTime; // reinitialization of graphics - if Restart then begin + if Restart then + begin Reinitialize3D; Restart := false; end; diff --git a/Game/Code/Classes/UTime.pas b/Game/Code/Classes/UTime.pas index c197a70f..edd65b7e 100644 --- a/Game/Code/Classes/UTime.pas +++ b/Game/Code/Classes/UTime.pas @@ -6,6 +6,9 @@ interface {$MODE Delphi} {$ENDIF} +{$DEFINE SDLTimer} +{$UNDEF DebugDisplay} + type TTime = class constructor Create; @@ -15,7 +18,6 @@ type procedure CountSkipTimeSet; procedure CountSkipTime; procedure CountMidTime; -procedure TimeSleep(ms: real); var USTime: TTime; @@ -36,21 +38,22 @@ uses libc, time, {$ENDIF} + sysutils, + {$IFDEF SDLTimer} + sdl, + {$ENDIF} ucommon; - - -// -- ON Linux it MAY Be better to use ... clock_gettime() instead of CurrentSec100OfDay -// who knows how fast or slow that function is ! -// but this gets a compile for now .. :) + +const + cSDLCorrectionRatio = 1000; (* -msec( ) -{ - struct timeval tv; - gettimeofday( &tv, NULL ); - return (int64_t)tv.tv_sec * (int64_t)1000000 + (int64_t)tv.tv_usec; -} +BEST Option now ( after discussion with whiteshark ) seems to be to use SDL +timer functions... +SDL_delay +SDL_GetTicks +http://www.gamedev.net/community/forums/topic.asp?topic_id=466145&whichpage=1%EE%8D%B7 *) @@ -59,86 +62,99 @@ begin CountSkipTimeSet; end; + procedure CountSkipTimeSet; begin - {$IFDEF win32} - QueryPerformanceFrequency(TimeFreq); - QueryPerformanceCounter(TimeNew); + {$IFDEF SDLTimer} + TimeNew := SDL_GetTicks(); // / cSDLCorrectionRatio + TimeFreq := 0; {$ELSE} - TimeNew := CurrentSec100OfDay(); // TODO - JB_Linux will prob need looking at - TimeFreq := 0; + {$IFDEF win32} + QueryPerformanceFrequency(TimeFreq); + QueryPerformanceCounter(TimeNew); + {$ELSE} + TimeNew := CurrentSec100OfDay(); // TODO - JB_Linux will prob need looking at + TimeFreq := 0; + {$ENDIF} + {$ENDIF} + + {$IFDEF DebugDisplay} + Writeln( 'CountSkipTimeSet : ' + inttostr(trunc(TimeNew)) ); {$ENDIF} end; + procedure CountSkipTime; begin TimeOld := TimeNew; - {$IFDEF win32} - QueryPerformanceCounter(TimeNew); + {$IFDEF SDLTimer} + TimeNew := SDL_GetTicks(); + TimeSkip := (TimeNew-TimeOld) / cSDLCorrectionRatio; {$ELSE} - TimeNew := CurrentSec100OfDay(); // TODO - JB_Linux will prob need looking at + {$IFDEF win32} + QueryPerformanceCounter(TimeNew); + + if ( TimeNew-TimeOld > 0 ) AND + ( TimeFreq > 0 ) THEN + begin + TimeSkip := (TimeNew-TimeOld)/TimeFreq; + end; + + {$ELSE} + TimeNew := CurrentSec100OfDay(); // TODO - JB_Linux will prob need looking at + TimeSkip := (TimeNew-TimeOld); + {$ENDIF} {$ENDIF} - - if ( TimeNew-TimeOld > 0 ) AND - ( TimeFreq > 0 ) THEN - begin - TimeSkip := (TimeNew-TimeOld)/TimeFreq; - end; -end; -procedure CountMidTime; -begin - {$IFDEF win32} - QueryPerformanceCounter(TimeMidTemp); - TimeMid := (TimeMidTemp-TimeNew)/TimeFreq; - {$ELSE} - TimeMidTemp := CurrentSec100OfDay(); - TimeMid := (TimeMidTemp-TimeNew); // TODO - JB_Linux will prob need looking at + {$IFDEF DebugDisplay} + Writeln( 'TimeNew : ' + inttostr(trunc(TimeNew)) ); + Writeln( 'CountSkipTime : ' + inttostr(trunc(TimeSkip)) ); {$ENDIF} end; -procedure TimeSleep(ms: real); -var - TimeStart: int64; - TimeHalf: int64; - Time: real; - Stop: boolean; + +procedure CountMidTime; begin - {$IFDEF win32} - QueryPerformanceCounter(TimeStart); + {$IFDEF SDLTimer} + TimeMidTemp := SDL_GetTicks(); + TimeMid := (TimeMidTemp - TimeNew) / cSDLCorrectionRatio; {$ELSE} - TimeStart := CurrentSec100OfDay(); // TODO - JB_Linux will prob need looking at - {$ENDIF} - - - Stop := false; - while (not Stop) do - begin {$IFDEF win32} - QueryPerformanceCounter(TimeHalf); - Time := 1000 * (TimeHalf-TimeStart)/TimeFreq; + QueryPerformanceCounter(TimeMidTemp); + TimeMid := (TimeMidTemp-TimeNew)/TimeFreq; {$ELSE} - TimeHalf := CurrentSec100OfDay(); - Time := 1000 * (TimeHalf-TimeStart); // TODO - JB_Linux will prob need looking at + TimeMidTemp := CurrentSec100OfDay(); + TimeMid := (TimeMidTemp-TimeNew); // TODO - JB_Linux will prob need looking at {$ENDIF} + {$ENDIF} - if Time > ms then - Stop := true; - end; - + {$IFDEF DebugDisplay} + Writeln( 'TimeNew : ' + inttostr(trunc(TimeNew)) ); + Writeln( 'CountMidTime : ' + inttostr(trunc(TimeMid)) ); + {$ENDIF} end; + function TTime.GetTime: real; var TimeTemp: int64; begin - {$IFDEF win32} - QueryPerformanceCounter(TimeTemp); - Result := TimeTemp / TimeFreq; + {$IFDEF SDLTimer} + TimeTemp := SDL_GetTicks(); + Result := TimeTemp / cSDLCorrectionRatio; // TODO - JB_Linux will prob need looking at {$ELSE} - TimeTemp := CurrentSec100OfDay(); - Result := TimeTemp; // TODO - JB_Linux will prob need looking at + {$IFDEF win32} + QueryPerformanceCounter(TimeTemp); + Result := TimeTemp / TimeFreq; + {$ELSE} + TimeTemp := CurrentSec100OfDay(); + Result := TimeTemp; // TODO - JB_Linux will prob need looking at + {$ENDIF} + {$ENDIF} + + {$IFDEF DebugDisplay} + Writeln( 'GetTime : ' + inttostr(trunc(Result)) ); {$ENDIF} end; diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index b2ba01dc..d3cd4ac7 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -1,17 +1,21 @@ -{############################################################################ -# FFmpeg support for UltraStar deluxe # -# # -# Created by b1indy # -# based on 'An ffmpeg and SDL Tutorial' (http://www.dranger.com/ffmpeg/) # -#############################################################################} - -//{$define DebugDisplay} // uncomment if u want to see the debug stuff +unit UVideo; +{< ############################################################################# +# FFmpeg support for UltraStar deluxe # +# # +# Created by b1indy # +# based on 'An ffmpeg and SDL Tutorial' (http://www.dranger.com/ffmpeg/) # +# # +# http://www.mail-archive.com/fpc-pascal@lists.freepascal.org/msg09949.html # +# http://www.nabble.com/file/p11795857/mpegpas01.zip # +# # +############################################################################## } + +{$define DebugDisplay} // uncomment if u want to see the debug stuff //{$define DebugFrames} //{$define Info} +{} -unit UVideo; - interface {$IFDEF FPC} @@ -43,10 +47,26 @@ procedure FFmpegDrawGL(Screen: integer); procedure FFmpegTogglePause; procedure FFmpegSkip(Time: Single); +{ + @author(Jay Binks ) + @created(2007-10-09) + @lastmod(2007-10-09) + + @param(aFormatCtx is a PAVFormatContext returned from av_open_input_file ) + @param(aFirstVideoStream is an OUT value of type integer, this is the index of the video stream) + @param(aFirstAudioStream is an OUT value of type integer, this is the index of the audio stream) + @returns(@true on success, @false otherwise) + + translated from "Setting Up the Audio" section at + http://www.dranger.com/ffmpeg/ffmpegtutorial_all.html + } +function find_stream_ids( const aFormatCtx : PAVFormatContext; Out aFirstVideoStream, aFirstAudioStream : integer ): boolean; + var VideoOpened, VideoPaused: Boolean; VideoFormatContext: PAVFormatContext; - VideoStreamIndex: Integer; + VideoStreamIndex , + AudioStreamIndex : Integer; VideoCodecContext: PAVCodecContext; VideoCodec: PAVCodec; AVFrame: PAVFrame; @@ -61,6 +81,11 @@ var VideoTimeBase, VideoTime, LastFrameTime, TimeDifference: Extended; VideoSkipTime: Single; + + WantedAudioCodecContext, + AudioCodecContext : PSDL_AudioSpec; + aCodecCtx : PAVCodecContext; + implementation {$ifdef DebugDisplay} @@ -74,13 +99,13 @@ end; {$endif} {$ENDIF} +{ ------------------------------------------------------------------------------ +asdf +------------------------------------------------------------------------------ } procedure Init; begin av_register_all; - {$ifdef DebugDisplay} - showmessage( 'AV_Register_ALL' ); - {$endif} - + VideoOpened:=False; VideoPaused:=False; @@ -88,9 +113,61 @@ begin SetLength(TexData,0); end; +{ + @author(Jay Binks ) + @created(2007-10-09) + @lastmod(2007-10-09) + + @param(aFormatCtx is a PAVFormatContext returned from av_open_input_file ) + @param(aFirstVideoStream is an OUT value of type integer, this is the index of the video stream) + @param(aFirstAudioStream is an OUT value of type integer, this is the index of the audio stream) + @returns(@true on success, @false otherwise) + + translated from "Setting Up the Audio" section at + http://www.dranger.com/ffmpeg/ffmpegtutorial_all.html +} +function find_stream_ids( const aFormatCtx : PAVFormatContext; Out aFirstVideoStream, aFirstAudioStream : integer ): boolean; +var + i : integer; + st : pAVStream; +begin + // Find the first video stream + aFirstAudioStream := -1; + aFirstVideoStream := -1; + + writeln( ' aFormatCtx.nb_streams : ' + inttostr( aFormatCtx.nb_streams ) ); + writeln( ' length( aFormatCtx.streams ) : ' + inttostr( length(aFormatCtx.streams) ) ); + + i := 0; + while ( i < aFormatCtx.nb_streams ) do +// while ( i < length(aFormatCtx.streams)-1 ) do + begin + writeln( ' aFormatCtx.streams[i] : ' + inttostr( i ) ); + st := aFormatCtx.streams[i]; + + if(st.codec.codec_type = CODEC_TYPE_VIDEO ) AND + (aFirstVideoStream < 0) THEN + begin + aFirstVideoStream := i; + end; + + if ( st.codec.codec_type = CODEC_TYPE_AUDIO ) AND + ( aFirstAudioStream < 0) THEN + begin + aFirstAudioStream := i; + end; + + inc( i ); + end; // while + + result := (aFirstAudioStream > -1) OR + (aFirstVideoStream > -1) ; // Didn't find a video stream +end; + procedure FFmpegOpenFile(FileName: pAnsiChar); var errnum, i, x,y: Integer; lStreamsCount : Integer; + begin VideoOpened := False; VideoPaused := False; @@ -98,9 +175,12 @@ begin VideoTime := 0; LastFrameTime := 0; TimeDifference := 0; + VideoFormatContext := 0; + + writeln( Filename ); errnum := av_open_input_file(VideoFormatContext, FileName, Nil, 0, Nil); - + writeln( 'Errnum : ' +inttostr( errnum )); if(errnum <> 0) then begin {$ifdef DebugDisplay} @@ -119,46 +199,36 @@ begin end else begin - VideoStreamIndex:=-1; + VideoStreamIndex := -1; + AudioStreamIndex := -1; // Find which stream contains the video - if(av_find_stream_info(VideoFormatContext) >= 0) then + if( av_find_stream_info(VideoFormatContext) >= 0 ) then begin - {$ifdef DebugDisplay} - writeln( 'FFMPEG debug... VideoFormatContext^.nb_streams : '+ inttostr( VideoFormatContext^.nb_streams ) ); - {$endif} - for i:= 0 to MAX_STREAMS-1 do - begin - {$ifdef DebugDisplay} - writeln( 'FFMPEG debug... found stream '+ inttostr(i) + ' stream val ' + inttostr( integer(VideoFormatContext^.streams[i] ) ) ); - {$endif} - try - if assigned( VideoFormatContext ) AND - assigned( VideoFormatContext^.streams[i] ) AND - assigned( VideoFormatContext^.streams[i]^.codec ) THEN - begin - {$ifdef DebugDisplay} - writeln( 'FFMPEG debug... found stream '+ inttostr(i) + ' code val ' + inttostr( integer(VideoFormatContext^.streams[i].codec ) ) ); - writeln( 'FFMPEG debug... found stream '+ inttostr(i) + ' code Type ' + inttostr( integer(VideoFormatContext^.streams[i].codec^.codec_type ) ) ); - {$endif} - if(VideoFormatContext^.streams[i]^.codec^.codec_type=CODEC_TYPE_VIDEO) then - begin - {$ifdef DebugDisplay} - writeln( 'FFMPEG debug, found CODEC_TYPE_VIDEO stream' ); - {$endif} - VideoStreamIndex:=i; - end - else - end; - except - // TODO : JB_Linux ... this is excepting at line 108... ( Was 111 previously.. so its prob todo with streams[i]^.codec .. - {$ifdef DebugDisplay} - writeln( 'FFMPEG error, finding video stream' ); - {$endif} - end; + find_stream_ids( VideoFormatContext, VideoStreamIndex, AudioStreamIndex ); + + writeln( 'VideoStreamIndex : ' + inttostr(VideoStreamIndex) ); + writeln( 'AudioStreamIndex : ' + inttostr(AudioStreamIndex) ); + end; +(* + aCodecCtx := VideoFormatContext.streams[ AudioStreamIndex ].codec; - end; + WantedAudioCodecContext.freq := aCodecCtx^.sample_rate; + WantedAudioCodecContext.format := AUDIO_S16SYS; + WantedAudioCodecContext.channels := aCodecCtx^.channels; + WantedAudioCodecContext.silence := 0; + WantedAudioCodecContext.samples := 1024;//SDL_AUDIO_BUFFER_SIZE; +// WantedAudioCodecContext.callback := audio_callback; + WantedAudioCodecContext.userdata := aCodecCtx; + + + + if(SDL_OpenAudio(WantedAudioCodecContext, AudioCodecContext) < 0) then + begin + writeln( 'Could not do SDL_OpenAudio' ); + exit; end; +*) if(VideoStreamIndex >= 0) then begin @@ -173,6 +243,7 @@ begin av_close_input_file(VideoFormatContext); Exit; end; + if(VideoCodec<>Nil) then begin @@ -188,11 +259,10 @@ begin if(errnum >=0) then begin {$ifdef DebugDisplay} - showmessage('Found a matching Codec:'+#13#10#13#10+ - 'Width='+inttostr(VideoCodecContext^.width)+ - ', Height='+inttostr(VideoCodecContext^.height)+#13#10+ - 'Aspect: '+inttostr(VideoCodecContext^.sample_aspect_ratio.num)+'/'+inttostr(VideoCodecContext^.sample_aspect_ratio.den)+#13#10+ - 'Framerate: '+inttostr(VideoCodecContext^.time_base.num)+'/'+inttostr(VideoCodecContext^.time_base.den)); + showmessage('Found a matching Codec: '+ VideoCodecContext^.Codec.Name +#13#10#13#10+ + ' Width = '+inttostr(VideoCodecContext^.width)+ ', Height='+inttostr(VideoCodecContext^.height)+#13#10+ + ' Aspect : '+inttostr(VideoCodecContext^.sample_aspect_ratio.num)+'/'+inttostr(VideoCodecContext^.sample_aspect_ratio.den)+#13#10+ + ' Framerate : '+inttostr(VideoCodecContext^.time_base.num)+'/'+inttostr(VideoCodecContext^.time_base.den)); {$endif} // allocate space for decoded frame and rgb frame AVFrame:=avcodec_alloc_frame; @@ -253,6 +323,7 @@ begin end; {$ifdef DebugDisplay} showmessage('corrected framerate: '+inttostr(floor(1/videotimebase))+'fps'); + if ((VideoAspect*VideoCodecContext^.width*VideoCodecContext^.height)>200000) then showmessage('you are trying to play a rather large video'+#13#10+ 'be prepared to experience some timing problems'); @@ -303,39 +374,53 @@ const FRAMEDROPCOUNT=3; begin if not VideoOpened then Exit; + if VideoPaused then Exit; + myTime:=Time+VideoSkipTime; TimeDifference:=myTime-VideoTime; DropFrame:=False; -{ showmessage('Time: '+inttostr(floor(Time*1000))+#13#10+ + +{$IFDEF DebugDisplay} + showmessage('Time: '+inttostr(floor(Time*1000))+#13#10+ 'VideoTime: '+inttostr(floor(VideoTime*1000))+#13#10+ 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ 'TimeDiff: '+inttostr(floor(TimeDifference*1000))); -} - if (VideoTime <> 0) and (TimeDifference <= VideoTimeBase) then begin +{$endif} + + if (VideoTime <> 0) and (TimeDifference <= VideoTimeBase) then + begin {$ifdef DebugFrames} // frame delay debug display GoldenRec.Spawn(200,15,1,16,0,-1,ColoredStar,$00ff00); {$endif} -{ showmessage('not getting new frame'+#13#10+ + +{$IFDEF DebugDisplay} + showmessage('not getting new frame'+#13#10+ 'Time: '+inttostr(floor(Time*1000))+#13#10+ 'VideoTime: '+inttostr(floor(VideoTime*1000))+#13#10+ 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ 'TimeDiff: '+inttostr(floor(TimeDifference*1000))); -} +{$endif} + Exit;// we don't need a new frame now end; + VideoTime:=VideoTime+VideoTimeBase; TimeDifference:=myTime-VideoTime; - if TimeDifference >= (FRAMEDROPCOUNT-1)*VideoTimeBase then begin // skip frames + if TimeDifference >= (FRAMEDROPCOUNT-1)*VideoTimeBase then // skip frames + begin {$ifdef DebugFrames} //frame drop debug display GoldenRec.Spawn(200,55,1,16,0,-1,ColoredStar,$ff0000); {$endif} -// showmessage('skipping frames'+#13#10+ -// 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ -// 'TimeDiff: '+inttostr(floor(TimeDifference*1000))+#13#10+ -// 'Time2Skip: '+inttostr(floor((Time-LastFrameTime)*1000))); + +{$IFDEF DebugDisplay} + showmessage('skipping frames'+#13#10+ + 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ + 'TimeDiff: '+inttostr(floor(TimeDifference*1000))+#13#10+ + 'Time2Skip: '+inttostr(floor((Time-LastFrameTime)*1000))); +{$endif} // av_seek_frame(VideoFormatContext,VideoStreamIndex,Floor(Time*VideoTimeBase),0); { av_seek_frame(VideoFormatContext,-1,Floor((myTime+VideoTimeBase)*1500000),0); VideoTime:=floor(myTime/VideoTimeBase)*VideoTimeBase;} @@ -343,30 +428,41 @@ begin DropFrame:=True; end; - av_init_packet(@AVPacket); +// av_init_packet(@AVPacket); + av_init_packet( AVPacket ); // JB-ffmpeg + FrameFinished:=0; // read packets until we have a finished frame (or there are no more packets) - while (FrameFinished=0) and (av_read_frame(VideoFormatContext, @AVPacket)>=0) do +// while (FrameFinished=0) and (av_read_frame(VideoFormatContext, @AVPacket)>=0) do + while (FrameFinished=0) and (av_read_frame(VideoFormatContext, AVPacket)>=0) do // JB-ffmpeg begin // if we got a packet from the video stream, then decode it if (AVPacket.stream_index=VideoStreamIndex) then - errnum:=avcodec_decode_video(VideoCodecContext, AVFrame, @frameFinished, - AVPacket.data, AVPacket.size); +// errnum:=avcodec_decode_video(VideoCodecContext, AVFrame, @frameFinished , AVPacket.data, AVPacket.size); + errnum := avcodec_decode_video(VideoCodecContext, AVFrame, frameFinished , AVPacket.data, AVPacket.size); // JB-ffmpeg + + // release internal packet structure created by av_read_frame - av_free_packet(PAVPacket(@AVPacket)); +// av_free_packet(PAVPacket(@AVPacket)); + av_free_packet( AVPacket ); // JB-ffmpeg end; + if DropFrame then for droppedFrames:=1 to FRAMEDROPCOUNT do begin FrameFinished:=0; // read packets until we have a finished frame (or there are no more packets) - while (FrameFinished=0) and (av_read_frame(VideoFormatContext, @AVPacket)>=0) do +// while (FrameFinished=0) and (av_read_frame(VideoFormatContext, @AVPacket)>=0) do + while (FrameFinished=0) and (av_read_frame(VideoFormatContext, AVPacket)>=0) do // JB-ffmpeg begin // if we got a packet from the video stream, then decode it if (AVPacket.stream_index=VideoStreamIndex) then - errnum:=avcodec_decode_video(VideoCodecContext, AVFrame, @frameFinished, - AVPacket.data, AVPacket.size); +// errnum:=avcodec_decode_video(VideoCodecContext, AVFrame, @frameFinished, AVPacket.data, AVPacket.size); + errnum:=avcodec_decode_video(VideoCodecContext, AVFrame, frameFinished , AVPacket.data, AVPacket.size); // JB-ffmpeg + + // release internal packet structure created by av_read_frame - av_free_packet(PAVPacket(@AVPacket)); +// av_free_packet(PAVPacket(@AVPacket)); // JB-ffmpeg + av_free_packet( AVPacket ); end; end; @@ -380,12 +476,16 @@ begin PAVPicture(AVFrame), VideoCodecContext^.pix_fmt, VideoCodecContext^.width, VideoCodecContext^.height); //errnum:=1; - if errnum >=0 then begin + + if errnum >=0 then + begin // copy RGB pixeldata to our TextureBuffer // (line by line) - FrameDataPtr:=AVFrameRGB^.data[0]; - linesize:=AVFrameRGB^.linesize[0]; - for y:=0 to TexY-1 do begin + + FrameDataPtr := pointer( AVFrameRGB^.data[0] ); + linesize := AVFrameRGB^.linesize[0]; + for y:=0 to TexY-1 do + begin System.Move(FrameDataPtr[y*linesize],TexData[3*y*dataX],linesize); end; diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 391fdccf..9e43f31f 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1,1300 +1,1315 @@ -unit UScreenSing; - -interface - -{$I switches.inc} - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - -uses UMenu, - UMusic, - SDL, - SysUtils, - UFiles, - UTime, - USongs, - UIni, - ULog, - UTexture, - ULyrics, - TextGL, - OpenGL12, - {$IFDEF useBASS} - bass, - {$ENDIF} - UThemes, - ULCD, - UGraphicClasses, - UVideo, - USingScores; - -type - TScreenSing = class(TMenu) - protected - paused: boolean; //Pause Mod - PauseTime: Real; - NumEmptySentences: integer; - public - //TextTime: integer; - - //TimeBar mod - StaticTimeProgress: integer; - TextTimeText: integer; - //eoa TimeBar mod - - StaticP1: integer; - TextP1: integer; - {StaticP1ScoreBG: integer; - TextP1Score: integer;} - - {//moveable singbar mod - StaticP1SingBar: integer; - StaticP1ThreePSingBar: integer; - StaticP1TwoPSingBar: integer; - StaticP2RSingBar: integer; - StaticP2MSingBar: integer; - StaticP3SingBar: integer; - //eoa moveable singbar } - - //Added for ps3 skin - //shown when game is in 2/4 player modus - StaticP1TwoP: integer; - TextP1TwoP: integer; - - {StaticP1TwoPScoreBG: integer; - TextP1TwoPScore: integer;} - //shown when game is in 3/6 player modus - StaticP1ThreeP: integer; - TextP1ThreeP: integer; - - {TextP1ThreePScore: integer; - StaticP1ThreePScoreBG: integer; } - //eoa - - StaticP2R: integer; - TextP2R: integer; - - {StaticP2RScoreBG: integer; - TextP2RScore: integer;} - - StaticP2M: integer; - TextP2M: integer; - - {StaticP2MScoreBG: integer; - TextP2MScore: integer; } - - StaticP3R: integer; - TextP3R: integer; - - {StaticP3RScoreBG: integer; - TextP3RScore: integer;} - - Tex_Background: TTexture; - FadeOut: boolean; -// LyricMain: TLyric; -// LyricSub: TLyric; - Lyrics: TLyricEngine; - - //Score Manager: - Scores: TSingScores; - - constructor Create; override; - procedure onShow; override; - procedure onShowFinish; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure Finish; virtual; - procedure UpdateLCD; - procedure Pause; //Pause Mod(Toggles Pause) - - //OnSentenceEnd for LineBonus + Singbar - procedure onSentenceEnd(S: Cardinal); - //OnSentenceChange (for Golden Notes) - procedure onSentenceChange(S: Cardinal); - end; - -implementation -uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math; - -// Method for input parsing. If False is returned, GetNextWindow -// should be checked to know the next window to load; -function TScreenSing.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then - begin // Key Down - case PressedKey of - SDLK_Q: - begin - //When not ask before Exit then Finish now - if (Ini.AskbeforeDel <> 1) then - Finish - //else just Pause and let the Popup make the Work - else if not paused then - Pause; - - Result := false; - end; - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - //Record Sound Hack: - //Sound[0].BufferLong - - Finish; - Music.PlayBack; - FadeTo(@ScreenScore); - end; - - SDLK_P://Pause Mod - begin - Pause; - end; - - SDLK_RETURN: - begin - end; - - // Up and Down could be done at the same time, - // but I don't want to declare variables inside - // functions like this one, called so many times - SDLK_DOWN : - begin - end; - SDLK_UP : - begin - end; - end; - end; -end; - -//Pause Mod -procedure TScreenSing.Pause; -begin - if not paused then //Pause einschalten - begin - // pause Time - PauseTime := Czas.Teraz; - Paused := true; - - // pause Music - Music.Pause; - - // pause Video - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then - FFmpegTogglePause; - end - else //Pause ausschalten - begin - Czas.Teraz := PauseTime; //Position of Notes - - // Position of Music - Music.MoveTo (PauseTime); - // Play Music - Music.Play; - - // Video - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then - FFmpegTogglePause; - //SkipSmpeg(PauseTime); - - Paused := false; - end; -end; -//Pause Mod End - -constructor TScreenSing.Create; -var - I: integer; - P: integer; -begin - inherited Create; - - //Create Score Class - Scores := TSingScores.Create; - Scores.LoadfromTheme; - - LoadFromTheme(Theme.Sing); - - //TimeBar - StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); - TextTimeText := AddText(Theme.Sing.TextTimeText); - -// 1 player | P1 - StaticP1 := AddStatic(Theme.Sing.StaticP1); - TextP1 := AddText(Theme.Sing.TextP1); - - {StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); - TextP1Score := AddText(Theme.Sing.TextP1Score); - StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar);} - -// 2 or 4 players | P1 - StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); - TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); - - {StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG); - TextP1TwoPScore := AddText(Theme.Sing.TextP1TwoPScore); - StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar);} - - // | P2 - StaticP2R := AddStatic(Theme.Sing.StaticP2R); - TextP2R := AddText(Theme.Sing.TextP2R); - - {StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); - TextP2RScore := AddText(Theme.Sing.TextP2RScore); - StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); } - -// 3 or 6 players | P1 - StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); - TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); - - {StaticP1ThreePScoreBG := AddStatic(Theme.Sing.StaticP1ThreePScoreBG); - TextP1ThreePScore := AddText(Theme.Sing.TextP1ThreePScore); - StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar);} - - // | P2 - StaticP2M := AddStatic(Theme.Sing.StaticP2M); - TextP2M := AddText(Theme.Sing.TextP2M); - - {StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG); - TextP2MScore := AddText(Theme.Sing.TextP2MScore); - StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar);} - - // | P3 - StaticP3R := AddStatic(Theme.Sing.StaticP3R); - TextP3R := AddText(Theme.Sing.TextP3R); - - {StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG); - TextP3RScore := AddText(Theme.Sing.TextP3RScore); - StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar);} - - if ScreenAct = 2 then begin - // katze und affe - - end; - - Lyrics := TLyricEngine.Create(80,Skin_LyricsT,640,12,80,Skin_LyricsT+36,640,12); - - UVideo.Init; -end; - -procedure TScreenSing.onShow; -var - P: integer; - V1: boolean; - V1TwoP: boolean; //added for ps3 skin - V1ThreeP: boolean; //added for ps3 skin - V2R: boolean; - V2M: boolean; - V3R: boolean; - NR: TRecR; //Line Bonus Mod - - Color: TRGB; -begin - Log.LogStatus('Begin', 'onShow'); - FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented - - //SetUp Score Manager - Scores.ClearPlayers; //Clear Old Player Values - Color.R := 0; Color.G := 0; Color.B := 0; //Dummy atm - For P := 0 to PlayersPlay -1 do //Add new Ones - begin - Scores.AddPlayer(Tex_ScoreBG[P], Color); - end; - - Scores.Init; //Get Positions for Players - - - - // prepare players - SetLength(Player, PlayersPlay); -// Player[0].ScoreTotalI := 0; - - case PlayersPlay of - 1: begin - V1 := true; - V1TwoP := false; - V1ThreeP := false; - V2R := false; - V2M := false; - V3R := false; - end; - 2: begin - V1 := false; - V1TwoP := true; - V1ThreeP := false; - V2R := true; - V2M := false; - V3R := false; - end; - 3: begin - V1 := false; - V1TwoP := false; - V1ThreeP := true; - V2R := false; - V2M := true; - V3R := true; - end; - 4: begin // double screen - V1 := false; - V1TwoP := true; - V1ThreeP := false; - V2R := true; - V2M := false; - V3R := false; - end; - 6: begin // double screen - V1 := false; - V1TwoP := false; - V1ThreeP := true; - V2R := false; - V2M := true; - V3R := true; - end; - - end; - - //This one is shown in 1P mode - Static[StaticP1].Visible := V1; - Text[TextP1].Visible := V1; - - {Static[StaticP1ScoreBG].Visible := V1; - Text[TextP1Score].Visible := V1;} - - - //This one is shown in 2/4P mode - Static[StaticP1TwoP].Visible := V1TwoP; - Text[TextP1TwoP].Visible := V1TwoP; - - {Static[StaticP1TwoPScoreBG].Visible := V1TwoP; - Text[TextP1TwoPScore].Visible := V1TwoP;} - - Static[StaticP2R].Visible := V2R; - Text[TextP2R].Visible := V2R; - - {Static[StaticP2RScoreBG].Visible := V2R; - Text[TextP2RScore].Visible := V2R; } - - - //This one is shown in 3/6P mode - Static[StaticP1ThreeP].Visible := V1ThreeP; - Text[TextP1ThreeP].Visible := V1ThreeP; - - {Static[StaticP1ThreePScoreBG].Visible := V1ThreeP; - Text[TextP1ThreePScore].Visible := V1ThreeP; } - - Static[StaticP2M].Visible := V2M; - Text[TextP2M].Visible := V2M; - - {Static[StaticP2MScoreBG].Visible := V2M; - Text[TextP2MScore].Visible := V2M; } - - Static[StaticP3R].Visible := V3R; - Text[TextP3R].Visible := V3R; - - {Static[StaticP3RScoreBG].Visible := V3R; - Text[TextP3RScore].Visible := V3R; } - - // load notes - ResetSingTemp; -// Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); - AktSong := CatSongs.Song[CatSongs.Selected]; - try - if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName) then - begin - //Error Loading Song -> Go back to Song Screen and Show some Error Message - FadeTo(@ScreenSong); - //Select New Song in Party Mode - if ScreenSong.Mode = 1 then - ScreenSong.SelectRandomSong; - ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); - Exit; - end; - except - //Error Loading Song -> Go back to Song Screen and Show some Error Message - FadeTo(@ScreenSong); - //Select New Song in Party Mode - if ScreenSong.Mode = 1 then - ScreenSong.SelectRandomSong; - ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); - Exit; - end; - AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; -// AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed - - // set movie - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin -(* OpenSmpeg(AktSong.Path + AktSong.Video); - SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*) - - // todo: VideoGap and Start time verwursten - FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); - FFmpegSkip(AktSong.VideoGAP + AktSong.Start); - AktSong.VideoLoaded := true; - end; - - // set background - if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then - try - Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background); - except - log.LogError('Background could not be loaded: ' + AktSong.Path + AktSong.Background); - Tex_Background.TexNum := -1; - end - else - Tex_Background.TexNum := -1; - - - - // play music (I) - Music.CaptureStart; - Music.MoveTo(AktSong.Start); -// Music.Play; - - // prepare timer (I) -// CountSkipTimeSet; - Czas.Teraz := AktSong.Start; - Czas.Razem := Music.Length; - if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000; - Czas.OldBeat := -1; - for P := 0 to High(Player) do - ClearScores(P); - - // main text - Lyrics.Clear (AktSong.BPM[0].BPM, AktSong.Resolution); - - // set custom options - case Ini.LyricsFont of - 0: - begin - Lyrics.UpperLineSize := 14; - Lyrics.LowerLineSize := 14; - Lyrics.FontStyle := 0; - - Lyrics.LineColor_en.R := Skin_FontR; - Lyrics.LineColor_en.G := Skin_FontG; - Lyrics.LineColor_en.B := Skin_FontB; - Lyrics.LineColor_en.A := 1; - - Lyrics.LineColor_dis.R := 0.4; - Lyrics.LineColor_dis.G := 0.4; - Lyrics.LineColor_dis.B := 0.4; - Lyrics.LineColor_dis.A := 1; - - Lyrics.LineColor_akt.R := 5/256; - Lyrics.LineColor_akt.G := 163/256; - Lyrics.LineColor_akt.B := 210/256; - Lyrics.LineColor_akt.A := 1; - -{ LyricSub.FontStyle := 0; - LyricMain.Size := 14; // 13 - LyricSub.Size := 14; // 13 - LyricMain.ColR := Skin_FontR; - LyricMain.ColG := Skin_FontG; - LyricMain.ColB := Skin_FontB; //Change für Crazy Joker - {LyricMain.ColSR := Skin_FontHighlightR; - LyricMain.ColSG := Skin_FontHighlightG; - LyricMain.ColSB := Skin_FontHighlightB;1aa5dc}{ - LyricMain.ColSR := 5/255; //26 - LyricMain.ColSG := 163/255; //165 - LyricMain.ColSB := 210/255; //220 - - LyricSub.ColR := 0.4; //0.6 - LyricSub.ColG := 0.4; //0.6 - LyricSub.ColB := 0.4; //0.6 } - end; - 1: - begin - { LyricMain.FontStyle := 2; - LyricSub.FontStyle := 2; - LyricMain.Size := 14; - LyricSub.Size := 14; - LyricMain.ColR := 0.75; - LyricMain.ColG := 0.75; - LyricMain.ColB := 1; - LyricMain.ColSR := 0.5; - LyricMain.ColSG := 0.5; - LyricMain.ColSB := 1; - LyricSub.ColR := 0.8; - LyricSub.ColG := 0.8; - LyricSub.ColB := 0.8; } - - Lyrics.UpperLineSize := 14; - Lyrics.LowerLineSize := 14; - Lyrics.FontStyle := 2; - - Lyrics.LineColor_en.R := 0.75; - Lyrics.LineColor_en.G := 0.75; - Lyrics.LineColor_en.B := 1; - Lyrics.LineColor_en.A := 1; - - Lyrics.LineColor_dis.R := 0.8; - Lyrics.LineColor_dis.G := 0.8; - Lyrics.LineColor_dis.B := 0.8; - Lyrics.LineColor_dis.A := 1; - - Lyrics.LineColor_akt.R := 0.5; - Lyrics.LineColor_akt.G := 0.5; - Lyrics.LineColor_akt.B := 1; - Lyrics.LineColor_akt.A := 1; - end; - 2: - begin - Lyrics.UpperLineSize := 12; - Lyrics.LowerLineSize := 12; - Lyrics.FontStyle := 3; - - Lyrics.LineColor_en.R := 0.75; - Lyrics.LineColor_en.G := 0.75; - Lyrics.LineColor_en.B := 1; - Lyrics.LineColor_en.A := 1; - - Lyrics.LineColor_dis.R := 0.8; - Lyrics.LineColor_dis.G := 0.8; - Lyrics.LineColor_dis.B := 0.8; - Lyrics.LineColor_dis.A := 1; - - Lyrics.LineColor_akt.R := 0.5; - Lyrics.LineColor_akt.G := 0.5; - Lyrics.LineColor_akt.B := 1; - Lyrics.LineColor_akt.A := 1; -{ LyricSub.FontStyle := 3; - LyricMain.Size := 12; - LyricSub.Size := 12; - LyricMain.ColR := 0.75; - LyricMain.ColG := 0.75; - LyricMain.ColB := 1; - LyricMain.ColSR := 0.5; - LyricMain.ColSG := 0.5; - LyricMain.ColSB := 1; - LyricSub.ColR := 0.8; - LyricSub.ColG := 0.8; - LyricSub.ColB := 0.8;} - end; - end; // case - - case Ini.LyricsEffect of - 0: Lyrics.HoverEffekt := 1; // 0 - one selected, 1 - selected all to the current - 1: Lyrics.HoverEffekt := 2; - 2: Lyrics.HoverEffekt := 3; - 3: Lyrics.HoverEffekt := 4; - end; // case - - // Add Lines to Lyrics - While (not Lyrics.LineinQueue) AND (Lyrics.LineCounter <= High(Czesci[0].Czesc)) do - Lyrics.AddLine(@Czesci[0].Czesc[Lyrics.LineCounter]); - - UpdateLCD; - - //Deactivate Pause - Paused := False; - - //Kill all Stars not Killed yet - //GoldenStarsTwinkle Mod - GoldenRec.SentenceChange; - //GoldenStarsTwinkle Mod End - - {//Set Position of Line Bonus - PhrasenBonus - if (Ini.LineBonus = 1) then //Show Line Bonus at Scores - begin - Case PlayersPlay of - 1: begin - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; - end; - - 2: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.X; - Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.X; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.X; - Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - end; - - 3: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - end; - - 4: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; - - //P4 - Player[3].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; - Player[3].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[3].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; - Player[3].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - end; - - 6: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - - //P4 - Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[3].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; - Player[3].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[3].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; - - //P5 - Player[4].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[4].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[4].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[4].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P6 - Player[5].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[5].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[5].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[5].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - end; - end; - end - else if (Ini.LineBonus = 2) then //Show Line Bonus at Notes - begin - - // positions - if Ini.SingWindow = 0 then begin - NR.Left := 120; - end else begin - NR.Left := 20; - end; - NR.Right := 780; - - NR.Width := NR.Right - NR.Left; - NR.WMid := NR.Width / 2; - NR.Mid := NR.Left + NR.WMid; - - Case PlayersPlay of - 1: begin - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := Skin_P2_NotesB - 105; - end; - - 2: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - end; - - 3: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := 120 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := 120 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := 245 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := 245 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_TargetY := 370 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_StartY := 370 + 28; - end; - - 4: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P4 - Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - end; - - 6: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := 120 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := 120 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := 245 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := 245 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_TargetY := 370 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_StartY := 370 + 28; - - //P4 - Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_TargetY := 120 - 65 + 28; - Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_StartY := 120 + 28; - - //P5 - Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[4].LineBonus_TargetY := 245 - 65 + 28; - Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[4].LineBonus_StartY := 245 + 28; - - //P6 - Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[5].LineBonus_TargetY := 370 - 65 + 28; - Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[5].LineBonus_StartY := 370 + 28; - end; - end; - end; } - - //Set Position of Line Bonus - PhrasenBonus End - //Set Num of Empty Sentences for Phrasen Bonus - NumEmptySentences := 0; - for P := low(Czesci[0].Czesc) to high(Czesci[0].Czesc) do - if Czesci[0].Czesc[P].TotalNotes = 0 then Inc(NumEmptySentences); - - Log.LogStatus('End', 'onShow'); -end; - -procedure TScreenSing.onShowFinish; -begin - // play movie (II) - - if AktSong.VideoLoaded then - begin - try - FFmpegGetFrame(Czas.Teraz); - FFmpegDrawGL(ScreenAct); -// PlaySmpeg; - except - //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video - AktSong.VideoLoaded := False; - Log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); - Log.LogError('Corrupted File: ' + AktSong.Video); - try -// CloseSmpeg; - FFmpegClose; - except - - end; - end; - end; - - // play music (II) - Music.Play; - - // prepare timer (II) - CountSkipTimeSet; -end; - -function TScreenSing.Draw: boolean; -var - Min: integer; - Sec: integer; - Tekst: string; - Flash: real; - S: integer; - T: integer; -begin - - - - //ScoreBG Mod | den wirren Scheiss hier brauch mer nimmer, wir haben colorized png's - no need for wirrness also - // set player colors - macht nichts weiter als die farben des statics zu wechseln, was zu unschönen effekten bei colorized png führt -{ if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - end; - if ScreenAct = 2 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P4Dark'); - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P3Dark'); - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); - end; - if ScreenAct = 2 then begin - - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P6Dark'); - - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); - end; - end; - } - - // set player names (for 2 screens and only Singstar skin) - if ScreenAct = 1 then begin - Text[TextP1].Text := 'P1'; - Text[TextP1TwoP].Text := 'P1'; - Text[TextP1ThreeP].Text := 'P1'; - Text[TextP2R].Text := 'P2'; - Text[TextP2M].Text := 'P2'; - Text[TextP3R].Text := 'P3'; - end; - - if ScreenAct = 2 then begin - case PlayersPlay of -{ 1: begin - Text[TextP1].Text := 'P2'; - end; - 2: begin - Text[TextP1].Text := 'P3'; - Text[TextP2R].Text := 'P4'; - end; - 3: begin - Text[TextP1].Text := 'P4'; - Text[TextP2M].Text := 'P5'; - Text[TextP3R].Text := 'P6'; - end;} - - 4: begin - Text[TextP1TwoP].Text := 'P3'; - Text[TextP2R].Text := 'P4'; - end; - 6: begin - Text[TextP1ThreeP].Text := 'P4'; - Text[TextP2M].Text := 'P5'; - Text[TextP3R].Text := 'P6'; - end; - end; // case - end; // if - - // stereo - -// weird stuff, maybe this is for "dual screen?", but where is player three then? | okay, i commented the stuff out the other day - nothing was missing on screen w/ 6 players - so do we even need this stuff? -// okay this stuff appears again some lines beneath this one, I commented it out for testing what it does - seems like it's doing nothing -// but I might be wrong, so what is this stuff here doing? O.o - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; - - Text[TextP1].X := Text[TextP1].X + 10*ScreenX; - - {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} - - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; - - Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; - - {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} -// end of weird stuff - - for S := 1 to 1 do //wtf? - Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X + 10*ScreenX; - - // update static menu with time ... - Min := Round(Czas.Teraz) div 60; - Sec := Round(Czas.Teraz) mod 60; - 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); - - {// .. and scores - if PlayersPlay = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; - end; - - if PlayersPlay = 2 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - - if PlayersPlay = 3 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[4].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[5].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - end; } - - // draw static menu (BG) - DrawBG; - //Draw Background - SingDrawBackground; - // update and draw movie - if ShowFinish and AktSong.VideoLoaded then begin - try -// UpdateSmpeg; // this only draws - // todo: find a way to determine, when a new frame is needed - // toto: same for the need to skip frames - FFmpegGetFrame(Czas.Teraz); - FFmpegDrawGL(ScreenAct); - except - //If an Error occurs drawing: prevent Video from being Drawn again and Close Video - AktSong.VideoLoaded := False; - log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); - Log.LogError('Corrupted File: ' + AktSong.Video); - try -// CloseSmpeg; - FFmpegClose; - except - - end; - end; - end; - - // draw static menu (FG) - DrawFG; - - // check for music finish -// Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(AktSong.Finish)); - if ShowFinish then begin - if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin - //Pause Mod: - if not Paused then - Sing(Self); // analyze song - end else begin -// Log.LogError('End'); - if not FadeOut then begin -// Log.LogError('End2'); - Finish; - FadeOut := true; - FadeTo(@ScreenScore); - end; - end; - end; - - // draw custom items - SingDraw; // always draw - -//GoldenNoteStarsTwinkle Mod - GoldenRec.SpawnRec; -//GoldenNoteStarsTwinkle Mod - - //Draw Scores - Scores.Draw; - - // back stereo - -// weird stuff, maybe this is for "dual screen?", but where is player three then? -// okay this stuff appears again some lines above this one, I commented it out for testing what it does - seems like it's doing nothing -// but I might be wrong, so what is this stuff here doing? O.o - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; - Text[TextP1].X := Text[TextP1].X - 10*ScreenX; - - {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX;} - - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; - Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; - - {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX;} -//weird end - - for S := 1 to 1 do // wtf? - Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X - 10*ScreenX; - -end; - -procedure TScreenSing.Finish; -begin - Music.CaptureStop; - Music.Stop; - - if Ini.SavePlayback = 1 then begin - Log.BenchmarkStart(0); - Log.LogVoice(0); - Log.LogVoice(1); - Log.LogVoice(2); - Log.BenchmarkEnd(0); - Log.LogBenchmark('Creating files', 0); - end; - - if AktSong.VideoLoaded then begin -// CloseSmpeg; - FFmpegClose; - AktSong.VideoLoaded := false; // to prevent drawing closed video - end; - - SetFontItalic (False); -end; - -procedure TScreenSing.UpdateLCD; -var - T: string; -begin - //Todo: Lyrics -{ LCD.HideCursor; - LCD.Clear; - - T := LyricMain.Text; - if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; - LCD.AddTextBR(T); - - T := LyricSub.Text; - if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; - LCD.AddTextBR(T);} -end; - -procedure TScreenSing.onSentenceEnd(S: Cardinal); -var -I: Integer; -A: Real; -B: integer; //Max Points for Notes -begin - - //Check for Empty Sentence - if (Czesci[0].Czesc[S].TotalNotes<=0) then - exit; - - //Set Max Note Points - if (Ini.LineBonus > 0) then - B := 9000 - else - B := 10000; - - for I := 0 to High(Player) do begin - A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2; - - - //PhrasenBonus - Line Bonus Mod - - //Generate Steps 0 to 8 - A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); - - If (Ini.LineBonus > 0) then - begin - //PhrasenBonus give Points - Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8); - Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10; - //Update Total Score - Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; - - //Spawn PopUp - If (A >= 8) then - A := 8 - else IF A < 0 then - A := 0; - - Scores.SpawnPopUp(I, Floor(A), Player[I].ScoreTotalI); - end; - //PhrasenBonus - Line Bonus Mod End// } - - //PerfectLineTwinkle Mod (effect) Pt.1 - If (Ini.EffectSing=1) then - begin - if A >= 8 then Player[I].LastSentencePerfect := True - else Player[I].LastSentencePerfect := False; - end; - //PerfectLineTwinkle Mod end - - //Refresh LastScore - Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; - - end; - - //PerfectLineTwinkle Mod (effect) Pt.2 - if Ini.EffectSing=1 then - GoldenRec.SpawnPerfectLineTwinkle; - //PerfectLineTwinkle Mod end -end; - -//Called on Sentence Change S= New Current Sentence -procedure TScreenSing.onSentenceChange(S: Cardinal); -begin - //GoldenStarsTwinkle Mod - GoldenRec.SentenceChange; - if (Lyrics.LineCounter <= High(Czesci[0].Czesc)) then - Lyrics.AddLine(@Czesci[0].Czesc[Lyrics.LineCounter]); - //GoldenStarsTwinkle Mod End -end; - -end. +unit UScreenSing; + +interface + +{$I switches.inc} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +uses UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + UIni, + ULog, + UTexture, + ULyrics, + TextGL, + OpenGL12, + {$IFDEF useBASS} + bass, + {$ENDIF} + UThemes, + ULCD, + UGraphicClasses, + UVideo, + USingScores; + +type + TScreenSing = class(TMenu) + protected + paused: boolean; //Pause Mod + PauseTime: Real; + NumEmptySentences: integer; + public + //TextTime: integer; + + //TimeBar mod + StaticTimeProgress: integer; + TextTimeText: integer; + //eoa TimeBar mod + + StaticP1: integer; + TextP1: integer; + {StaticP1ScoreBG: integer; + TextP1Score: integer;} + + {//moveable singbar mod + StaticP1SingBar: integer; + StaticP1ThreePSingBar: integer; + StaticP1TwoPSingBar: integer; + StaticP2RSingBar: integer; + StaticP2MSingBar: integer; + StaticP3SingBar: integer; + //eoa moveable singbar } + + //Added for ps3 skin + //shown when game is in 2/4 player modus + StaticP1TwoP: integer; + TextP1TwoP: integer; + + {StaticP1TwoPScoreBG: integer; + TextP1TwoPScore: integer;} + //shown when game is in 3/6 player modus + StaticP1ThreeP: integer; + TextP1ThreeP: integer; + + {TextP1ThreePScore: integer; + StaticP1ThreePScoreBG: integer; } + //eoa + + StaticP2R: integer; + TextP2R: integer; + + {StaticP2RScoreBG: integer; + TextP2RScore: integer;} + + StaticP2M: integer; + TextP2M: integer; + + {StaticP2MScoreBG: integer; + TextP2MScore: integer; } + + StaticP3R: integer; + TextP3R: integer; + + {StaticP3RScoreBG: integer; + TextP3RScore: integer;} + + Tex_Background: TTexture; + FadeOut: boolean; +// LyricMain: TLyric; +// LyricSub: TLyric; + Lyrics: TLyricEngine; + + //Score Manager: + Scores: TSingScores; + + constructor Create; override; + procedure onShow; override; + procedure onShowFinish; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure Finish; virtual; + procedure UpdateLCD; + procedure Pause; //Pause Mod(Toggles Pause) + + //OnSentenceEnd for LineBonus + Singbar + procedure onSentenceEnd(S: Cardinal); + //OnSentenceChange (for Golden Notes) + procedure onSentenceChange(S: Cardinal); + end; + +implementation +uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math; + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenSing.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_Q: + begin + //When not ask before Exit then Finish now + if (Ini.AskbeforeDel <> 1) then + Finish + //else just Pause and let the Popup make the Work + else if not paused then + Pause; + + Result := false; + end; + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + //Record Sound Hack: + //Sound[0].BufferLong + + Finish; + Music.PlayBack; + FadeTo(@ScreenScore); + end; + + SDLK_P://Pause Mod + begin + Pause; + end; + + SDLK_RETURN: + begin + end; + + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN : + begin + end; + SDLK_UP : + begin + end; + end; + end; +end; + +//Pause Mod +procedure TScreenSing.Pause; +begin + if not paused then //Pause einschalten + begin + // pause Time + PauseTime := Czas.Teraz; + Paused := true; + + // pause Music + Music.Pause; + + // pause Video + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + FFmpegTogglePause; + end + else //Pause ausschalten + begin + Czas.Teraz := PauseTime; //Position of Notes + + // Position of Music + Music.MoveTo (PauseTime); + // Play Music + Music.Play; + + // Video + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + FFmpegTogglePause; + //SkipSmpeg(PauseTime); + + Paused := false; + end; +end; +//Pause Mod End + +constructor TScreenSing.Create; +var + I: integer; + P: integer; +begin + inherited Create; + + //Create Score Class + Scores := TSingScores.Create; + Scores.LoadfromTheme; + + LoadFromTheme(Theme.Sing); + + //TimeBar + StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); + TextTimeText := AddText(Theme.Sing.TextTimeText); + +// 1 player | P1 + StaticP1 := AddStatic(Theme.Sing.StaticP1); + TextP1 := AddText(Theme.Sing.TextP1); + + {StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); + TextP1Score := AddText(Theme.Sing.TextP1Score); + StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar);} + +// 2 or 4 players | P1 + StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); + TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); + + {StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG); + TextP1TwoPScore := AddText(Theme.Sing.TextP1TwoPScore); + StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar);} + + // | P2 + StaticP2R := AddStatic(Theme.Sing.StaticP2R); + TextP2R := AddText(Theme.Sing.TextP2R); + + {StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); + TextP2RScore := AddText(Theme.Sing.TextP2RScore); + StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); } + +// 3 or 6 players | P1 + StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); + TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); + + {StaticP1ThreePScoreBG := AddStatic(Theme.Sing.StaticP1ThreePScoreBG); + TextP1ThreePScore := AddText(Theme.Sing.TextP1ThreePScore); + StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar);} + + // | P2 + StaticP2M := AddStatic(Theme.Sing.StaticP2M); + TextP2M := AddText(Theme.Sing.TextP2M); + + {StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG); + TextP2MScore := AddText(Theme.Sing.TextP2MScore); + StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar);} + + // | P3 + StaticP3R := AddStatic(Theme.Sing.StaticP3R); + TextP3R := AddText(Theme.Sing.TextP3R); + + {StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG); + TextP3RScore := AddText(Theme.Sing.TextP3RScore); + StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar);} + + if ScreenAct = 2 then begin + // katze und affe + + end; + + Lyrics := TLyricEngine.Create(80,Skin_LyricsT,640,12,80,Skin_LyricsT+36,640,12); + + UVideo.Init; +end; + +procedure TScreenSing.onShow; +var + P: integer; + V1: boolean; + V1TwoP: boolean; //added for ps3 skin + V1ThreeP: boolean; //added for ps3 skin + V2R: boolean; + V2M: boolean; + V3R: boolean; + NR: TRecR; //Line Bonus Mod + + Color: TRGB; +begin + Log.LogStatus('Begin', 'onShow'); + FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented + + //SetUp Score Manager + Scores.ClearPlayers; //Clear Old Player Values + Color.R := 0; Color.G := 0; Color.B := 0; //Dummy atm + For P := 0 to PlayersPlay -1 do //Add new Ones + begin + Scores.AddPlayer(Tex_ScoreBG[P], Color); + end; + + Scores.Init; //Get Positions for Players + + + + // prepare players + SetLength(Player, PlayersPlay); +// Player[0].ScoreTotalI := 0; + + case PlayersPlay of + 1: begin + V1 := true; + V1TwoP := false; + V1ThreeP := false; + V2R := false; + V2M := false; + V3R := false; + end; + 2: begin + V1 := false; + V1TwoP := true; + V1ThreeP := false; + V2R := true; + V2M := false; + V3R := false; + end; + 3: begin + V1 := false; + V1TwoP := false; + V1ThreeP := true; + V2R := false; + V2M := true; + V3R := true; + end; + 4: begin // double screen + V1 := false; + V1TwoP := true; + V1ThreeP := false; + V2R := true; + V2M := false; + V3R := false; + end; + 6: begin // double screen + V1 := false; + V1TwoP := false; + V1ThreeP := true; + V2R := false; + V2M := true; + V3R := true; + end; + + end; + + //This one is shown in 1P mode + Static[StaticP1].Visible := V1; + Text[TextP1].Visible := V1; + + {Static[StaticP1ScoreBG].Visible := V1; + Text[TextP1Score].Visible := V1;} + + + //This one is shown in 2/4P mode + Static[StaticP1TwoP].Visible := V1TwoP; + Text[TextP1TwoP].Visible := V1TwoP; + + {Static[StaticP1TwoPScoreBG].Visible := V1TwoP; + Text[TextP1TwoPScore].Visible := V1TwoP;} + + Static[StaticP2R].Visible := V2R; + Text[TextP2R].Visible := V2R; + + {Static[StaticP2RScoreBG].Visible := V2R; + Text[TextP2RScore].Visible := V2R; } + + + //This one is shown in 3/6P mode + Static[StaticP1ThreeP].Visible := V1ThreeP; + Text[TextP1ThreeP].Visible := V1ThreeP; + + {Static[StaticP1ThreePScoreBG].Visible := V1ThreeP; + Text[TextP1ThreePScore].Visible := V1ThreeP; } + + Static[StaticP2M].Visible := V2M; + Text[TextP2M].Visible := V2M; + + {Static[StaticP2MScoreBG].Visible := V2M; + Text[TextP2MScore].Visible := V2M; } + + Static[StaticP3R].Visible := V3R; + Text[TextP3R].Visible := V3R; + + {Static[StaticP3RScoreBG].Visible := V3R; + Text[TextP3RScore].Visible := V3R; } + + // load notes + ResetSingTemp; +// Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); + AktSong := CatSongs.Song[CatSongs.Selected]; + try + if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName) then + begin + //Error Loading Song -> Go back to Song Screen and Show some Error Message + FadeTo(@ScreenSong); + //Select New Song in Party Mode + if ScreenSong.Mode = 1 then + ScreenSong.SelectRandomSong; + ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); + Exit; + end; + except + //Error Loading Song -> Go back to Song Screen and Show some Error Message + FadeTo(@ScreenSong); + //Select New Song in Party Mode + if ScreenSong.Mode = 1 then + ScreenSong.SelectRandomSong; + ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); + Exit; + end; + AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; +// AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed + + // set movie + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin +(* OpenSmpeg(AktSong.Path + AktSong.Video); + SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*) + + // todo: VideoGap and Start time verwursten + FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); + FFmpegSkip(AktSong.VideoGAP + AktSong.Start); + AktSong.VideoLoaded := true; + end; + + // set background + if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then + try + Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background); + except + log.LogError('Background could not be loaded: ' + AktSong.Path + AktSong.Background); + Tex_Background.TexNum := -1; + end + else + Tex_Background.TexNum := -1; + + + + // play music (I) + Music.CaptureStart; + Music.MoveTo(AktSong.Start); +// Music.Play; + + // prepare timer (I) +// CountSkipTimeSet; + Czas.Teraz := AktSong.Start; + Czas.Razem := Music.Length; + if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000; + Czas.OldBeat := -1; + for P := 0 to High(Player) do + ClearScores(P); + + // main text + Lyrics.Clear (AktSong.BPM[0].BPM, AktSong.Resolution); + + // set custom options + case Ini.LyricsFont of + 0: + begin + Lyrics.UpperLineSize := 14; + Lyrics.LowerLineSize := 14; + Lyrics.FontStyle := 0; + + Lyrics.LineColor_en.R := Skin_FontR; + Lyrics.LineColor_en.G := Skin_FontG; + Lyrics.LineColor_en.B := Skin_FontB; + Lyrics.LineColor_en.A := 1; + + Lyrics.LineColor_dis.R := 0.4; + Lyrics.LineColor_dis.G := 0.4; + Lyrics.LineColor_dis.B := 0.4; + Lyrics.LineColor_dis.A := 1; + + Lyrics.LineColor_akt.R := 5/256; + Lyrics.LineColor_akt.G := 163/256; + Lyrics.LineColor_akt.B := 210/256; + Lyrics.LineColor_akt.A := 1; + +{ LyricSub.FontStyle := 0; + LyricMain.Size := 14; // 13 + LyricSub.Size := 14; // 13 + LyricMain.ColR := Skin_FontR; + LyricMain.ColG := Skin_FontG; + LyricMain.ColB := Skin_FontB; //Change für Crazy Joker + {LyricMain.ColSR := Skin_FontHighlightR; + LyricMain.ColSG := Skin_FontHighlightG; + LyricMain.ColSB := Skin_FontHighlightB;1aa5dc}{ + LyricMain.ColSR := 5/255; //26 + LyricMain.ColSG := 163/255; //165 + LyricMain.ColSB := 210/255; //220 + + LyricSub.ColR := 0.4; //0.6 + LyricSub.ColG := 0.4; //0.6 + LyricSub.ColB := 0.4; //0.6 } + end; + 1: + begin + { LyricMain.FontStyle := 2; + LyricSub.FontStyle := 2; + LyricMain.Size := 14; + LyricSub.Size := 14; + LyricMain.ColR := 0.75; + LyricMain.ColG := 0.75; + LyricMain.ColB := 1; + LyricMain.ColSR := 0.5; + LyricMain.ColSG := 0.5; + LyricMain.ColSB := 1; + LyricSub.ColR := 0.8; + LyricSub.ColG := 0.8; + LyricSub.ColB := 0.8; } + + Lyrics.UpperLineSize := 14; + Lyrics.LowerLineSize := 14; + Lyrics.FontStyle := 2; + + Lyrics.LineColor_en.R := 0.75; + Lyrics.LineColor_en.G := 0.75; + Lyrics.LineColor_en.B := 1; + Lyrics.LineColor_en.A := 1; + + Lyrics.LineColor_dis.R := 0.8; + Lyrics.LineColor_dis.G := 0.8; + Lyrics.LineColor_dis.B := 0.8; + Lyrics.LineColor_dis.A := 1; + + Lyrics.LineColor_akt.R := 0.5; + Lyrics.LineColor_akt.G := 0.5; + Lyrics.LineColor_akt.B := 1; + Lyrics.LineColor_akt.A := 1; + end; + 2: + begin + Lyrics.UpperLineSize := 12; + Lyrics.LowerLineSize := 12; + Lyrics.FontStyle := 3; + + Lyrics.LineColor_en.R := 0.75; + Lyrics.LineColor_en.G := 0.75; + Lyrics.LineColor_en.B := 1; + Lyrics.LineColor_en.A := 1; + + Lyrics.LineColor_dis.R := 0.8; + Lyrics.LineColor_dis.G := 0.8; + Lyrics.LineColor_dis.B := 0.8; + Lyrics.LineColor_dis.A := 1; + + Lyrics.LineColor_akt.R := 0.5; + Lyrics.LineColor_akt.G := 0.5; + Lyrics.LineColor_akt.B := 1; + Lyrics.LineColor_akt.A := 1; +{ LyricSub.FontStyle := 3; + LyricMain.Size := 12; + LyricSub.Size := 12; + LyricMain.ColR := 0.75; + LyricMain.ColG := 0.75; + LyricMain.ColB := 1; + LyricMain.ColSR := 0.5; + LyricMain.ColSG := 0.5; + LyricMain.ColSB := 1; + LyricSub.ColR := 0.8; + LyricSub.ColG := 0.8; + LyricSub.ColB := 0.8;} + end; + end; // case + + case Ini.LyricsEffect of + 0: Lyrics.HoverEffekt := 1; // 0 - one selected, 1 - selected all to the current + 1: Lyrics.HoverEffekt := 2; + 2: Lyrics.HoverEffekt := 3; + 3: Lyrics.HoverEffekt := 4; + end; // case + + // Add Lines to Lyrics + While (not Lyrics.LineinQueue) AND (Lyrics.LineCounter <= High(Czesci[0].Czesc)) do + Lyrics.AddLine(@Czesci[0].Czesc[Lyrics.LineCounter]); + + UpdateLCD; + + //Deactivate Pause + Paused := False; + + //Kill all Stars not Killed yet + //GoldenStarsTwinkle Mod + GoldenRec.SentenceChange; + //GoldenStarsTwinkle Mod End + + {//Set Position of Line Bonus - PhrasenBonus + if (Ini.LineBonus = 1) then //Show Line Bonus at Scores + begin + Case PlayersPlay of + 1: begin + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + end; + + 2: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.X; + Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.X; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.X; + Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + end; + + 3: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + end; + + 4: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; + + //P4 + Player[3].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; + Player[3].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[3].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; + Player[3].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + end; + + 6: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + + //P4 + Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[3].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[3].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[3].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; + + //P5 + Player[4].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[4].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[4].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[4].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P6 + Player[5].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[5].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[5].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[5].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + end; + end; + end + else if (Ini.LineBonus = 2) then //Show Line Bonus at Notes + begin + + // positions + if Ini.SingWindow = 0 then begin + NR.Left := 120; + end else begin + NR.Left := 20; + end; + NR.Right := 780; + + NR.Width := NR.Right - NR.Left; + NR.WMid := NR.Width / 2; + NR.Mid := NR.Left + NR.WMid; + + Case PlayersPlay of + 1: begin + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := Skin_P2_NotesB - 105; + end; + + 2: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + end; + + 3: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := 120 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := 120 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := 245 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := 245 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_TargetY := 370 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_StartY := 370 + 28; + end; + + 4: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P4 + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + end; + + 6: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := 120 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := 120 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := 245 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := 245 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_TargetY := 370 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_StartY := 370 + 28; + + //P4 + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_TargetY := 120 - 65 + 28; + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_StartY := 120 + 28; + + //P5 + Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[4].LineBonus_TargetY := 245 - 65 + 28; + Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[4].LineBonus_StartY := 245 + 28; + + //P6 + Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[5].LineBonus_TargetY := 370 - 65 + 28; + Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[5].LineBonus_StartY := 370 + 28; + end; + end; + end; } + + //Set Position of Line Bonus - PhrasenBonus End + //Set Num of Empty Sentences for Phrasen Bonus + NumEmptySentences := 0; + for P := low(Czesci[0].Czesc) to high(Czesci[0].Czesc) do + if Czesci[0].Czesc[P].TotalNotes = 0 then Inc(NumEmptySentences); + + Log.LogStatus('End', 'onShow'); +end; + +procedure TScreenSing.onShowFinish; +begin + // play movie (II) + + if AktSong.VideoLoaded then + begin + try + FFmpegGetFrame(Czas.Teraz); + FFmpegDrawGL(ScreenAct); +// PlaySmpeg; + except + + on E : Exception do + begin + //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video + AktSong.VideoLoaded := False; + Log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); + Log.LogError('Error Message : '+ E.message ); + Log.LogError(' In : '+ E.ClassName +' (TScreenSing.onShowFinish)' ); + Log.LogError('Corrupted File: ' + AktSong.Video); + try +// CloseSmpeg; + FFmpegClose; + except + + end; + end; + end; + end; + + // play music (II) + Music.Play; + + // prepare timer (II) + CountSkipTimeSet; +end; + +function TScreenSing.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + Flash: real; + S: integer; + T: integer; +begin + + + + //ScoreBG Mod | den wirren Scheiss hier brauch mer nimmer, wir haben colorized png's - no need for wirrness also + // set player colors - macht nichts weiter als die farben des statics zu wechseln, was zu unschönen effekten bei colorized png führt +{ if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P4Dark'); + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P3Dark'); + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); + end; + if ScreenAct = 2 then begin + + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P6Dark'); + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); + end; + end; + } + + // set player names (for 2 screens and only Singstar skin) + if ScreenAct = 1 then begin + Text[TextP1].Text := 'P1'; + Text[TextP1TwoP].Text := 'P1'; + Text[TextP1ThreeP].Text := 'P1'; + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; + end; + + if ScreenAct = 2 then begin + case PlayersPlay of +{ 1: begin + Text[TextP1].Text := 'P2'; + end; + 2: begin + Text[TextP1].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 3: begin + Text[TextP1].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end;} + + 4: begin + Text[TextP1TwoP].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 6: begin + Text[TextP1ThreeP].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end; + end; // case + end; // if + + // stereo + +// weird stuff, maybe this is for "dual screen?", but where is player three then? | okay, i commented the stuff out the other day - nothing was missing on screen w/ 6 players - so do we even need this stuff? +// okay this stuff appears again some lines beneath this one, I commented it out for testing what it does - seems like it's doing nothing +// but I might be wrong, so what is this stuff here doing? O.o + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; + + Text[TextP1].X := Text[TextP1].X + 10*ScreenX; + + {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} + + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; + + Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; + + {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} +// end of weird stuff + + for S := 1 to 1 do //wtf? + Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X + 10*ScreenX; + + // update static menu with time ... + Min := Round(Czas.Teraz) div 60; + Sec := Round(Czas.Teraz) mod 60; + 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); + + {// .. and scores + if PlayersPlay = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + end; + + if PlayersPlay = 2 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + + if PlayersPlay = 3 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[4].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[5].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + end; } + + // draw static menu (BG) + DrawBG; + //Draw Background + SingDrawBackground; + // update and draw movie + + if ShowFinish and AktSong.VideoLoaded then begin + try +// UpdateSmpeg; // this only draws + // todo: find a way to determine, when a new frame is needed + // toto: same for the need to skip frames + + FFmpegGetFrame(Czas.Teraz); + FFmpegDrawGL(ScreenAct); + except + on E : Exception do + begin + + //If an Error occurs drawing: prevent Video from being Drawn again and Close Video + AktSong.VideoLoaded := False; + log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); + Log.LogError('Error Message : '+ E.message ); + Log.LogError(' In : '+ E.ClassName +' (TScreenSing.Draw)' ); + + Log.LogError('Corrupted File: ' + AktSong.Video); + try +// CloseSmpeg; + FFmpegClose; + except + + end; + end; + end; + end; + + // draw static menu (FG) + DrawFG; + + // check for music finish +// Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(AktSong.Finish)); + if ShowFinish then begin + if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + //Pause Mod: + if not Paused then + Sing(Self); // analyze song + end else begin +// Log.LogError('End'); + if not FadeOut then begin +// Log.LogError('End2'); + Finish; + FadeOut := true; + FadeTo(@ScreenScore); + end; + end; + end; + + // draw custom items + SingDraw; // always draw + +//GoldenNoteStarsTwinkle Mod + GoldenRec.SpawnRec; +//GoldenNoteStarsTwinkle Mod + + //Draw Scores + Scores.Draw; + + // back stereo + +// weird stuff, maybe this is for "dual screen?", but where is player three then? +// okay this stuff appears again some lines above this one, I commented it out for testing what it does - seems like it's doing nothing +// but I might be wrong, so what is this stuff here doing? O.o + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; + Text[TextP1].X := Text[TextP1].X - 10*ScreenX; + + {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX;} + + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; + Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; + + {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX;} +//weird end + + for S := 1 to 1 do // wtf? + Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X - 10*ScreenX; + +end; + +procedure TScreenSing.Finish; +begin + Music.CaptureStop; + Music.Stop; + + if Ini.SavePlayback = 1 then begin + Log.BenchmarkStart(0); + Log.LogVoice(0); + Log.LogVoice(1); + Log.LogVoice(2); + Log.BenchmarkEnd(0); + Log.LogBenchmark('Creating files', 0); + end; + + if AktSong.VideoLoaded then begin +// CloseSmpeg; + FFmpegClose; + AktSong.VideoLoaded := false; // to prevent drawing closed video + end; + + SetFontItalic (False); +end; + +procedure TScreenSing.UpdateLCD; +var + T: string; +begin + //Todo: Lyrics +{ LCD.HideCursor; + LCD.Clear; + + T := LyricMain.Text; + if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; + LCD.AddTextBR(T); + + T := LyricSub.Text; + if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; + LCD.AddTextBR(T);} +end; + +procedure TScreenSing.onSentenceEnd(S: Cardinal); +var +I: Integer; +A: Real; +B: integer; //Max Points for Notes +begin + + //Check for Empty Sentence + if (Czesci[0].Czesc[S].TotalNotes<=0) then + exit; + + //Set Max Note Points + if (Ini.LineBonus > 0) then + B := 9000 + else + B := 10000; + + for I := 0 to High(Player) do begin + A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2; + + + //PhrasenBonus - Line Bonus Mod + + //Generate Steps 0 to 8 + A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); + + If (Ini.LineBonus > 0) then + begin + //PhrasenBonus give Points + Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8); + Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10; + //Update Total Score + Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; + + //Spawn PopUp + If (A >= 8) then + A := 8 + else IF A < 0 then + A := 0; + + Scores.SpawnPopUp(I, Floor(A), Player[I].ScoreTotalI); + end; + //PhrasenBonus - Line Bonus Mod End// } + + //PerfectLineTwinkle Mod (effect) Pt.1 + If (Ini.EffectSing=1) then + begin + if A >= 8 then Player[I].LastSentencePerfect := True + else Player[I].LastSentencePerfect := False; + end; + //PerfectLineTwinkle Mod end + + //Refresh LastScore + Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; + + end; + + //PerfectLineTwinkle Mod (effect) Pt.2 + if Ini.EffectSing=1 then + GoldenRec.SpawnPerfectLineTwinkle; + //PerfectLineTwinkle Mod end +end; + +//Called on Sentence Change S= New Current Sentence +procedure TScreenSing.onSentenceChange(S: Cardinal); +begin + //GoldenStarsTwinkle Mod + GoldenRec.SentenceChange; + if (Lyrics.LineCounter <= High(Czesci[0].Czesc)) then + Lyrics.AddLine(@Czesci[0].Czesc[Lyrics.LineCounter]); + //GoldenStarsTwinkle Mod End +end; + +end. diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 859d5026..b5a34f46 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1509,8 +1509,13 @@ var I: Integer; begin dx := SongTarget-SongCurrent; - dt := TimeSkip*7; - if dt > 1 then dt := 1; + dt := TimeSkip * 7; + +// writeln( 'TScreenSong.Draw '+ inttostr(trunc(TimeSkip)) ); + + if dt > 1 then + dt := 1; + SongCurrent := SongCurrent + dx*dt; { if SongCurrent > Catsongs.VisibleSongs then begin @@ -1527,7 +1532,8 @@ begin If (CoverTime < 5) then begin // 0.5.0: cover fade - if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin + if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then + begin // load new texture Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); Button[Interaction].Texture.Alpha := 1; @@ -1756,27 +1762,24 @@ begin Data[i] := 0.9999999999999; try - if ( assigned( Theme ) ) AND - ( assigned( Theme.Song ) ) AND - ( i < length( Data ) ) THEN - begin - writeln( '!!!!!!!!! - '+ inttostr( i ) + ' - ' + inttostr( Theme.Song.Equalizer.Length ) ); - - if Single(Data[i]) > 0 then + if ( assigned( Theme ) ) AND + ( assigned( Theme.Song ) ) AND + ( i < length( Data ) ) THEN begin - lTmp := Single(Data[i]) * Theme.Song.Equalizer.Length; - if lTmp > Pos then - Pos := lTmp; + if single( Data[i] ) > single( 1 ) then + begin + lTmp := Single(Data[i]) * Theme.Song.Equalizer.Length; + if lTmp > Pos then + Pos := lTmp; + end; end; - end; except - // TODO: JB_Linux..... why does this happen ! on E:EInvalidOp do - writeln( 'UScreenSong - DOH !!!!' ); + writeln( 'UScreenSong - DOH !!!! ('+inttostr(i)+' '+ inttostr( integer( single( Data[i] ) ) )+' * '+ ')' ); end end; - + //Change Last Band if (EqualizerBands[B] <= Theme.Song.Equalizer.Length) then begin diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index e0b1e95a..b9430a82 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -202,8 +202,61 @@ var WndTitle: string; hWnd: THandle; I: Integer; + + aFormatCtx : PAVFormatContext;//PAVCodecContext; + aCodecCtx : PAVCodecContext; + VideoStreamIndex, + AudioStreamIndex : integer; begin + + + +(* + +av_register_all; +aFormatCtx := av_alloc_format_context(); +if av_open_input_file( aFormatCtx, pchar( Paramstr(1) ), NIL, 0, NIL) = 0 then +begin + if av_find_stream_info( aFormatCtx ) >= 0 then + begin + writeln(''); + dump_format(aFormatCtx, 0, pchar( Paramstr(1) ), 0); + writeln(''); + +// writeln( pchar( filename ) ); + +// av_read_play( aFormatCtx ); + find_stream_ids( aFormatCtx , VideoStreamIndex , AudioStreamIndex ); + + writeln( 'VideoStreamIndex : ' + inttostr(VideoStreamIndex) ); + writeln( 'AudioStreamIndex : ' + inttostr(AudioStreamIndex) ); + + aCodecCtx := aFormatCtx.streams[ AudioStreamIndex ].codec; + writeln( 'Audio Codec Channels: '+ inttostr( integer( aCodecCtx.channels ) ) ); + writeln( 'Audio Codec freq: '+ inttostr( integer( aCodecCtx.sample_rate ) ) ); + + wanted_spec.freq = aCodecCtx->sample_rate; + wanted_spec.format = AUDIO_S16SYS; + wanted_spec.channels = aCodecCtx->channels; + wanted_spec.silence = 0; + wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE; + wanted_spec.callback = audio_callback; + wanted_spec.userdata = aCodecCtx; + + if(SDL_OpenAudio(&wanted_spec, aCodecCtx) < 0) then + begin + writeln( 'Could not do SDL_OpenAudio' ); + exit; + end; + + + end; +end; + +exit; +*) + WndTitle := Version; -- cgit v1.2.3 From 97a179d3ac5ce99d5e43406f2f66285576eefaf9 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 11 Oct 2007 10:33:32 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@502 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/requirements.txt | 45 +++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 20 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/lib/requirements.txt b/Game/Code/lib/requirements.txt index e4b14060..ebaffea7 100644 --- a/Game/Code/lib/requirements.txt +++ b/Game/Code/lib/requirements.txt @@ -2,8 +2,8 @@ Not Included in SVN ( to many potential updates ) --------------------------------------------------------------------------- Jedi-sdl - http://sourceforge.net/projects/jedi-sdl - Make sure to download VERSION 1, beta... + http://sourceforge.net/projects/jedi-sdl + Make sure to download VERSION 1, beta... not version 0.5 @@ -23,21 +23,26 @@ ffmpeg http://www.iversenit.dk/dev/ffmpeg-headers/ SQLLite Wrapper - http://www.itwriting.com/sqlitesimple.php - -====================================== -For LINUX build -====================================== -On top of the above pas files, you will need development libraries for them. - -here are the instructions needed to compile on ubunty ( 7.04 ) - -ffmpeg : - sudo apt-get install libavcodec-dev libavformat-dev - -sqlite : - sudo apt-get install libsqlite3-dev - -sdl development libraries : - sudo apt-get install libsdl-ttf2.0-dev - THERE WILL be more of them... oops I forgot to list them :P + http://www.itwriting.com/sqlitesimple.php + +====================================== +For LINUX build +====================================== +On top of the above pas files, you will need development libraries for them. + +here are the instructions needed to compile on ubunty ( 7.04 ) + +ffmpeg : + sudo apt-get install libavcodec-dev libavformat-dev + +sqlite : + sudo apt-get install libsqlite3-dev + +sdl development libraries : + sudo apt-get install libsdl-ttf2.0-dev libsdl-image1.2-dev + THERE WILL be more of them... oops I forgot to list them :P + +For the Lazy... who use Debian or Ubuntu.... here is a single line + sudo apt-get install libavcodec-dev libavformat-dev libsqlite3-dev libsdl-ttf2.0-dev libsdl-image1.2-dev + + \ No newline at end of file -- cgit v1.2.3 From 0d997f8433e982584a0ab67a6d630d12f4314759 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 11 Oct 2007 10:50:01 +0000 Subject: fixes so codebase builds in delphi now, after major FFMpeg changse for linux. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@503 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/ULCD.pas | 16 ++++++++++------ Game/Code/Classes/UVideo.pas | 4 ++-- Game/Code/Screens/UScreenSong.pas | 6 ++++-- Game/Code/lib/ffmpeg/avcodec.pas | 21 ++++++++++++++------- Game/Code/lib/ffmpeg/avformat.pas | 26 +++++++++++++++++++------- Game/Code/lib/ffmpeg/avio.pas | 17 +++++++++++++---- Game/Code/lib/ffmpeg/avutil.pas | 17 ++++++++++++----- Game/Code/lib/ffmpeg/opt.pas | 17 ++++++++++++----- Game/Code/lib/ffmpeg/rational.pas | 17 +++++++++++------ 9 files changed, 97 insertions(+), 44 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/ULCD.pas b/Game/Code/Classes/ULCD.pas index 52b0f96a..50214ad0 100644 --- a/Game/Code/Classes/ULCD.pas +++ b/Game/Code/Classes/ULCD.pas @@ -46,6 +46,7 @@ uses {$IFDEF UseSerialPort} zlportio, {$ENDIF} + SDL, UTime; procedure TLCD.WriteCommand(B: Byte); @@ -64,7 +65,7 @@ begin zlioportwrite(Data, 0, B and $F0); zlioportwrite(Control, 0, $03); - TimeSleep(0.1); + SDL_Delay( 100 ); zlioportwrite(Control, 0, $02); zlioportwrite(Data, 0, (B * 16) and $F0); @@ -74,7 +75,7 @@ begin if (B=1) or (B=2) then Sleep(2) else - TimeSleep(0.1); + SDL_Delay( 100 ); {$ENDIF} end; @@ -82,23 +83,26 @@ procedure TLCD.WriteData(B: Byte); // Wysylanie danych begin {$IFDEF UseSerialPort} - if not HalfInterface then begin + if not HalfInterface then + begin zlioportwrite(Control, 0, $06); zlioportwrite(Data, 0, B); zlioportwrite(Control, 0, $07); - end else begin + end + else + begin zlioportwrite(Control, 0, $06); zlioportwrite(Data, 0, B and $F0); zlioportwrite(Control, 0, $07); - TimeSleep(0.1); + SDL_Delay( 100 ); zlioportwrite(Control, 0, $06); zlioportwrite(Data, 0, (B * 16) and $F0); zlioportwrite(Control, 0, $07); end; - TimeSleep(0.1); + SDL_Delay( 100 ); Inc(Position); {$ENDIF} end; diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index d3cd4ac7..2dd745fd 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -89,14 +89,14 @@ var implementation {$ifdef DebugDisplay} -{$ifNdef win32} +//{$ifNdef win32} procedure showmessage( aMessage : String ); begin writeln( aMessage ); end; -{$endif} +//{$endif} {$ENDIF} { ------------------------------------------------------------------------------ diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index b5a34f46..0bf411c1 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1766,7 +1766,7 @@ begin ( assigned( Theme.Song ) ) AND ( i < length( Data ) ) THEN begin - if single( Data[i] ) > single( 1 ) then + if single( Data[i] ) > 1 then begin lTmp := Single(Data[i]) * Theme.Song.Equalizer.Length; if lTmp > Pos then @@ -1774,8 +1774,10 @@ begin end; end; except + {$IFDEF FPC} on E:EInvalidOp do - writeln( 'UScreenSong - DOH !!!! ('+inttostr(i)+' '+ inttostr( integer( single( Data[i] ) ) )+' * '+ ')' ); + writeln( 'UScreenSong - DOH !!!! ('+inttostr(i)+' '+ inttostr( integer( Data[i] ) )+' * '+ ')' ); + {$ENDIF} end end; diff --git a/Game/Code/lib/ffmpeg/avcodec.pas b/Game/Code/lib/ffmpeg/avcodec.pas index c82bc329..9c232fff 100644 --- a/Game/Code/lib/ffmpeg/avcodec.pas +++ b/Game/Code/lib/ffmpeg/avcodec.pas @@ -22,11 +22,13 @@ in the source codes *) unit avcodec; -{$LINKLIB libavutil} -{$LINKLIB libavcodec} -{$MODE DELPHI } (* CAT *) -{$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) -{$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) +{$IFDEF FPC} + {$LINKLIB libavutil} + {$LINKLIB libavcodec} + {$MODE DELPHI } (* CAT *) + {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) + {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) +{$ENDIF} interface @@ -34,8 +36,13 @@ uses avutil, rational, opt; // CAT const -(* version numbers are changed by The Creative CAT *) - av__format = 'libavformat.51'; +{$IFDEF win32} + av__format = 'avformat-50.dll'; +{$ELSE} + av__format = 'libavformat.so'; // .0d +// av__format = 'libavformat.51'; +{$ENDIF} + LIBAVUTIL_VERSION_INT = ((51 shl 16) + (12 shl 8) + 1); LIBAVUTIL_VERSION = '51.12.1'; diff --git a/Game/Code/lib/ffmpeg/avformat.pas b/Game/Code/lib/ffmpeg/avformat.pas index 7fd009e9..26ff0d9b 100644 --- a/Game/Code/lib/ffmpeg/avformat.pas +++ b/Game/Code/lib/ffmpeg/avformat.pas @@ -22,19 +22,31 @@ in the source codes *) unit avformat; -{$LINKLIB libavutil} -{$LINKLIB libavformat} -{$MODE DELPHI } (* CAT *) -{$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) -{$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) +{$IFDEF FPC} + {$LINKLIB libavutil} + {$LINKLIB libavformat} + {$MODE DELPHI } (* CAT *) + {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) + {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) +{$ENDIF} interface uses - avcodec, avio, rational, avutil; (* CAT *) + avcodec, + avio, + rational, + avutil; (* CAT *) const - av__format = 'libavformat.51'; (* CAT *) + + +{$IFDEF win32} + av__format = 'avformat-50.dll'; +{$ELSE} + av__format = 'libavformat.so'; // .0d + //av__format = 'libavformat.51'; (* CAT *) +{$ENDIF} LIBAVUTIL_VERSION_INT = ((51 shl 16) + (12 shl 8) + 1); LIBAVUTIL_VERSION = '51.12.1'; diff --git a/Game/Code/lib/ffmpeg/avio.pas b/Game/Code/lib/ffmpeg/avio.pas index f1abea3e..5e40bd4e 100644 --- a/Game/Code/lib/ffmpeg/avio.pas +++ b/Game/Code/lib/ffmpeg/avio.pas @@ -22,15 +22,24 @@ For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT in the source codes *) unit avio; -{$MODE DELPHI } (* CAT *) -{$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) -{$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) +{$IFDEF FPC} + {$MODE DELPHI } (* CAT *) + {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) + {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) +{$ENDIF} interface (* Widows unit is deleted by CAT *) const (* version numbers are changed by The Creative CAT *) - av__format = 'libavformat.51'; + +{$IFDEF win32} + av__format = 'avformat-50.dll'; +{$ELSE} + av__format = 'libavformat.so'; // .0d +//av__format = 'libavformat.51'; +{$ENDIF} + URL_RDONLY = 0; URL_WRONLY = 1; diff --git a/Game/Code/lib/ffmpeg/avutil.pas b/Game/Code/lib/ffmpeg/avutil.pas index 5b5d6762..8d4fe2f7 100644 --- a/Game/Code/lib/ffmpeg/avutil.pas +++ b/Game/Code/lib/ffmpeg/avutil.pas @@ -20,15 +20,22 @@ For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT in the source codes *) unit avutil; -{$MODE DELPHI} -{$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) -{$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) +{$IFDEF FPC} + {$MODE DELPHI} + {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) + {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) +{$ENDIF} interface const -(* version numbers are changed by The Creative CAT *) - av__util = 'libavutil.49'; +{$IFDEF win32} + av__util = 'avutil-49.dll'; +{$ELSE} + av__util = 'libavutil.so'; // .0d +// av__util = 'libavutil.49'; +{$ENDIF} + LIBAVUTIL_VERSION_INT = ((49 shl 16) + (4 shl 8) + 1); LIBAVUTIL_VERSION = '49.4.1'; diff --git a/Game/Code/lib/ffmpeg/opt.pas b/Game/Code/lib/ffmpeg/opt.pas index 0acead1f..e70d77ad 100644 --- a/Game/Code/lib/ffmpeg/opt.pas +++ b/Game/Code/lib/ffmpeg/opt.pas @@ -21,9 +21,11 @@ For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT in the source codes *) unit opt; -{$MODE DELPHI} (* CAT *) -{$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) -{$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) +{$IFDEF FPC} + {$MODE DELPHI} (* CAT *) + {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) + {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) +{$ENDIF} interface @@ -43,8 +45,13 @@ type ); const -(* version numbers are changed by The Creative CAT *) - av__codec = 'libavcodec.51'; + +{$IFDEF win32} + av__codec = 'avcodec-51.dll'; +{$ELSE} + av__codec = 'avcodec.so'; // .0d + // av__codec = 'libavcodec.51'; +{$ENDIF} AV_OPT_FLAG_ENCODING_PARAM = 1; ///< a generic parameter which can be set by the user for muxing or encoding diff --git a/Game/Code/lib/ffmpeg/rational.pas b/Game/Code/lib/ffmpeg/rational.pas index bd2cc94f..8fb3cbd8 100644 --- a/Game/Code/lib/ffmpeg/rational.pas +++ b/Game/Code/lib/ffmpeg/rational.pas @@ -21,16 +21,21 @@ For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT in the source codes *) unit rational; -{$MODE DELPHI} (* CAT *) -{$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) -{$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) +{$IFDEF FPC} + {$MODE DELPHI} (* CAT *) + {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) + {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) +{$ENDIF} interface (* unit windows is deleted by CAT *) const -(* version numbers are changed by The Creative CAT *) - av__util = 'libavutil.49'; - + {$IFDEF win32} + av__util = 'avutil-49.dll'; + {$ELSE} + av__util = 'libavutil.so'; // .0d +// av__util = 'libavutil.49'; + {$ENDIF} type (* -- 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/Classes/UDraw.pas | 2 +- Game/Code/Classes/ULyrics.pas | 5 +- Game/Code/Classes/UMain.pas | 4 +- Game/Code/Classes/UMusic.pas | 802 +++------------------------ Game/Code/Classes/UMusic_BASS.pas | 703 +++++++++++++++++++++++ Game/Code/Classes/UTime.pas | 81 +-- Game/Code/Classes/UVideo.pas | 3 +- Game/Code/Screens/UScreenCredits.pas | 22 +- Game/Code/Screens/UScreenEdit.pas | 12 +- Game/Code/Screens/UScreenEditConvert.pas | 10 +- Game/Code/Screens/UScreenEditSub.pas | 38 +- Game/Code/Screens/UScreenLevel.pas | 4 +- Game/Code/Screens/UScreenMain.pas | 30 +- Game/Code/Screens/UScreenName.pas | 4 +- Game/Code/Screens/UScreenOpen.pas | 6 +- Game/Code/Screens/UScreenOptions.pas | 42 +- Game/Code/Screens/UScreenOptionsAdvanced.pas | 8 +- Game/Code/Screens/UScreenOptionsGame.pas | 14 +- Game/Code/Screens/UScreenOptionsGraphics.pas | 8 +- Game/Code/Screens/UScreenOptionsLyrics.pas | 8 +- Game/Code/Screens/UScreenOptionsRecord.pas | 8 +- Game/Code/Screens/UScreenOptionsSound.pas | 8 +- Game/Code/Screens/UScreenOptionsThemes.pas | 8 +- Game/Code/Screens/UScreenPartyNewRound.pas | 4 +- Game/Code/Screens/UScreenPartyOptions.pas | 8 +- Game/Code/Screens/UScreenPartyPlayer.pas | 4 +- Game/Code/Screens/UScreenPartyScore.pas | 4 +- Game/Code/Screens/UScreenPartyWin.pas | 4 +- Game/Code/Screens/UScreenSing.pas | 22 +- Game/Code/Screens/UScreenSingModi.pas | 10 +- Game/Code/Screens/UScreenSong.pas | 82 +-- Game/Code/Screens/UScreenSongJumpto.pas | 2 +- Game/Code/Screens/UScreenSongMenu.pas | 2 +- Game/Code/Screens/UScreenStatDetail.pas | 4 +- Game/Code/Screens/UScreenStatMain.pas | 9 +- Game/Code/USDXResCompiler.exe | Bin 401920 -> 1698394 bytes Game/Code/UltraStar.dpr | 110 ++-- Game/Code/switches.inc | 5 +- 38 files changed, 1035 insertions(+), 1065 deletions(-) create mode 100644 Game/Code/Classes/UMusic_BASS.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index a8404355..473e9017 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -470,7 +470,7 @@ var lTmpB : real; begin if (Player[NrGracza].ScoreTotalI >= 0) then begin - glColor4f(1, 1, 1, sqrt((1+sin(Music.Position * 3))/4)/ 2 + 0.5 ); + glColor4f(1, 1, 1, sqrt((1+sin( AudioPlayback.Position * 3))/4)/ 2 + 0.5 ); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); diff --git a/Game/Code/Classes/ULyrics.pas b/Game/Code/Classes/ULyrics.pas index 4fd360b7..e4ac2024 100644 --- a/Game/Code/Classes/ULyrics.pas +++ b/Game/Code/Classes/ULyrics.pas @@ -8,7 +8,10 @@ interface {$I switches.inc} -uses OpenGL12, UTexture, UThemes, UMusic; +uses OpenGL12, + UTexture, + UThemes, + UMusic; type TLyricWord = record diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 41676bf3..40b91be7 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -520,7 +520,7 @@ begin // beat click if (Ini.BeatClick = 1) and ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then - Music.PlayClick; + AudioPlayback.PlayClick; // debug system on LPT if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then begin @@ -542,7 +542,7 @@ begin if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeatC) then begin // click assist if Ini.ClickAssist = 1 then - Music.PlayClick; + AudioPlayback.PlayClick; //LPT_2 := 0; if ParamStr(1) <> '-doublelights' then diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index 3c43615b..934e14e3 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -8,145 +8,8 @@ interface {$MODE Delphi} {$ENDIF} - -uses Classes, - {$IFDEF win32} - windows, - {$ENDIF} - UCommon, - Messages, - SysUtils, - {$IFNDEF FPC} - Forms, - {$ENDIF} - {$IFDEF useBASS} - bass, - {$ENDIF} - ULog, - USongs; - - -procedure InitializeSound; - -type - TSoundCard = record - Name: string; - Source: array of string; - end; - - TFFTData = array [0..256] of Single; - - TCustomSoundEntry = record - Filename : String; - Handle : hStream; - end; - - IAudioPlayback = Interface - procedure InitializePlayback; - - procedure SetVolume(Volume: integer); - procedure SetMusicVolume(Volume: integer); - procedure SetLoop(Enabled: boolean); - - function Open(Name: string): boolean; // true if succeed - - procedure Play; - procedure Pause; //Pause Mod - procedure Stop; - - procedure Rewind; - procedure MoveTo(Time: real); - procedure Close; - - function Finished: boolean; - function Length: real; - function Position: real; - - procedure PlayStart; - procedure PlayBack; - procedure PlaySwoosh; - procedure PlayChange; - procedure PlayOption; - procedure PlayClick; - procedure PlayDrum; - procedure PlayHihat; - procedure PlayClap; - procedure PlayShuffle; - procedure StopShuffle; - - function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; - - //Custom Sounds - function LoadCustomSound(const Filename: String): Cardinal; - procedure PlayCustomSound(const Index: Cardinal); - end; - - - TMusic = class( TInterfacedObject, IAudioPlayback ) - private - BassStart: hStream; // Wait, I've replaced this with BASS - BassBack: hStream; // It has almost all features we need - BassSwoosh: hStream; - BassChange: hStream; // Almost? It aleady has them all :) - BassOption: hStream; - BassClick: hStream; - BassDrum: hStream; - BassHihat: hStream; - BassClap: hStream; - BassShuffle: hStream; - - //Custom Sounds - CustomSounds: array of TCustomSoundEntry; - Loaded: boolean; - Loop: boolean; - - - function FFMPeg_StreamCreateFile(abool : boolean; aFileName : pchar ): THandle; - - public - Bass: hStream; - procedure InitializePlayback; - procedure InitializeRecord; - procedure SetVolume(Volume: integer); - procedure SetMusicVolume(Volume: integer); - procedure SetLoop(Enabled: boolean); - function Open(Name: string): boolean; // true if succeed - procedure Rewind; - procedure MoveTo(Time: real); - procedure Play; - procedure Pause; //Pause Mod - procedure Stop; - procedure Close; - function Finished: boolean; - function Length: real; - function Position: real; - procedure PlayStart; - procedure PlayBack; - procedure PlaySwoosh; - procedure PlayChange; - procedure PlayOption; - procedure PlayClick; - procedure PlayDrum; - procedure PlayHihat; - procedure PlayClap; - procedure PlayShuffle; - procedure StopShuffle; - procedure CaptureStart; - procedure CaptureStop; - procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); - procedure StopCard(Card: byte); - function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; - - //Equalizer - function GetFFTData: TFFTData; - - //Custom Sounds - function LoadCustomSound(const Filename: String): Cardinal; - procedure PlayCustomSound(const Index: Cardinal); -end; - -const - RecordSystem = 1; +uses Classes // UCommon + ; type TMuzyka = record @@ -216,621 +79,104 @@ type Razem: real; // caly czas utworu end; -var - Music: TMusic; - - // muzyka - Muzyka: TMuzyka; - - // czesci z nutami; - Czesci: array of TCzesci; - - // czas - Czas: TCzas; - - fHWND: Thandle; - -type - TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, - mpPaused, mpOpen); - -const - ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); - -implementation - -uses - {$IFDEF FPC} - lclintf, - {$ENDIF} - - avcodec, - avformat, - avutil, - - UGraphic, - URecord, - UFiles, - UIni, - UMain, - UThemes; - -procedure InitializeSound; -begin - Log.LogStatus('Initializing Playback', 'InitializeSound'); Music.InitializePlayback; - Log.LogStatus('Initializing Record', 'InitializeSound'); Music.InitializeRecord; -end; - -procedure TMusic.InitializePlayback; -var - Pet: integer; - S: integer; -begin - Log.BenchmarkStart(4); - Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); - - Loaded := false; - Loop := false; - - {$ifdef win32} - // TODO : JB_Linux ... is this needed ? :) - fHWND := AllocateHWND( nil); // TODO : JB_lazarus - can we do something different here ?? lazarus didnt like this function - {$ENDIF} - - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - if not BASS_Init(1, 44100, 0, fHWND, nil) then - begin - {$IFNDEF FPC} - // TODO : JB_linux find a way to do this nice.. - Application.MessageBox ('Could not initialize BASS', 'Error'); - {$ENDIF} - Exit; - end; - {$ENDIF} - - Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); - - // config playing buffer -// BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); -// BASS_SetConfig(BASS_CONFIG_BUFFER, 100); - - Log.LogStatus('Loading Sounds', 'Music Initialize'); - - Log.BenchmarkStart(4); - LoadSoundFromFile(BassStart, SoundPath + 'Common Start.mp3'); - LoadSoundFromFile(BassBack, SoundPath + 'Common Back.mp3'); - LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3'); - LoadSoundFromFile(BassChange, SoundPath + 'select music change music 50.mp3'); - LoadSoundFromFile(BassOption, SoundPath + 'option change col.mp3'); - LoadSoundFromFile(BassClick, SoundPath + 'rimshot022b.mp3'); - -// LoadSoundFromFile(BassDrum, SoundPath + 'bassdrumhard076b.mp3'); -// LoadSoundFromFile(BassHihat, SoundPath + 'hihatclosed068b.mp3'); -// LoadSoundFromFile(BassClap, SoundPath + 'claps050b.mp3'); - -// LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3'); - - Log.BenchmarkEnd(4); - Log.LogBenchmark('--> Loading Sounds', 4); -end; - -procedure TMusic.InitializeRecord; -var - S: integer; - device: integer; - descr: string; - input: integer; - input2: integer; - flags: integer; - mic: array[0..15] of integer; - SC: integer; // soundcard - SCI: integer; // soundcard input -begin - if RecordSystem = 1 then begin - SetLength(Sound, 6 {max players});//Ini.Players+1); - for S := 0 to High(Sound) do begin //Ini.Players do begin - Sound[S] := TSound.Create; - Sound[S].Num := S; - Sound[S].BufferNew := TMemoryStream.Create; - SetLength(Sound[S].BufferLong, 1); - Sound[S].BufferLong[0] := TMemoryStream.Create; - Sound[S].n := 4*1024; - end; - - - // check for recording devices; - {device := 0; - descr := BASS_RecordGetDeviceDescription(device); - - SetLength(SoundCard, 0); - while (descr <> '') do begin - SC := High(SoundCard) + 1; - SetLength(SoundCard, SC+1); - - Log.LogAnalyze('Device #'+IntToStr(device)+': '+ descr); - SoundCard[SC].Description := Descr; - - // check for recording inputs - mic[device] := -1; // default to no change - input := 0; - BASS_RecordInit(device); - Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); - flags := BASS_RecordGetInput(input); - - SetLength(SoundCard[SC].Input, 0); - while (flags <> -1) do begin - SCI := High(SoundCard[SC].Input) + 1; - SetLength(SoundCard[SC].Input, SCI+1); - - Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); - SoundCard[SC].Input[SCI].Name := BASS_RecordGetInputName(Input); - - if (flags and BASS_INPUT_TYPE_MASK) = BASS_INPUT_TYPE_MIC then begin - mic[device] := input; // auto set microphone - end; - Inc(Input); - flags := BASS_RecordGetInput(input); - end; - - if mic[device] <> -1 then begin - Log.LogAnalyze('Found the mic at input ' + IntToStr(Mic[device])) - end else begin - Log.LogAnalyze('Mic not found'); - mic[device] := 0; // setting to the first one (for kxproject) - end; - SoundCard[SC].InputSeleceted := Mic[Device]; - - - BASS_RecordFree; - - inc(Device); - descr := BASS_RecordGetDeviceDescription(Device); - end; // while} - end; // if -end; - -procedure TMusic.SetVolume(Volume: integer); -begin - //Old Sets Wave Volume - //BASS_SetVolume(Volume); - //New: Sets Volume only for this Application - - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); - {$ENDIF} -end; - -procedure TMusic.SetMusicVolume(Volume: Integer); -begin - //Max Volume Prevention - if Volume > 100 then - Volume := 100; - - //Set Volume - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelSetAttributes (Bass, -1, Volume, -101); - {$ENDIF} -end; - -procedure TMusic.SetLoop(Enabled: boolean); -begin - Loop := Enabled; -end; - -function TMusic.Open(Name: string): boolean; -begin - Loaded := false; - if FileExists(Name) then - begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); - {$ENDIF} - - Loaded := true; - //Set Max Volume - SetMusicVolume (100); - end; - - Result := Loaded; -end; - -procedure TMusic.Rewind; -begin - if Loaded then begin - end; -end; - -procedure TMusic.MoveTo(Time: real); -var - bytes: integer; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - bytes := BASS_ChannelSeconds2Bytes(Bass, Time); - BASS_ChannelSetPosition(Bass, bytes); - {$ENDIF} -end; - -procedure TMusic.Play; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - if Loaded then - begin - if Loop then - BASS_ChannelPlay(Bass, True); // start from beginning... actually bass itself does not loop, nor does this TMusic Class - - BASS_ChannelPlay(Bass, False); // for setting position before playing + TSoundCard = record + Name: string; + Source: array of string; end; - {$ENDIF} -end; -procedure TMusic.Pause; //Pause Mod -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - if Loaded then begin - BASS_ChannelPause(Bass); // Pauses Song - end; - {$ENDIF} -end; - -procedure TMusic.Stop; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - Bass_ChannelStop(Bass); - {$ENDIF} -end; - -procedure TMusic.Close; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - Bass_StreamFree(Bass); - {$ENDIF} -end; - -function TMusic.Length: real; -var - bytes: integer; -begin - Result := 60; - - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - bytes := BASS_ChannelGetLength(Bass); - Result := BASS_ChannelBytes2Seconds(Bass, bytes); - {$ENDIF} -end; - -function TMusic.Position: real; -var - bytes: integer; -begin - Result := 0; - - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - bytes := BASS_ChannelGetPosition(BASS); - Result := BASS_ChannelBytes2Seconds(BASS, bytes); - {$ENDIF} -end; + TFFTData = array [0..256] of Single; -function TMusic.Finished: boolean; -begin - Result := false; + hStream = Cardinal; - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then - begin - Result := true; + TCustomSoundEntry = record + Filename : String; + Handle : hStream; end; - {$ENDIF} -end; - -procedure TMusic.PlayStart; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassStart, True); - {$ENDIF} -end; - -procedure TMusic.PlayBack; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassBack, True);// then - {$ENDIF} -end; - -procedure TMusic.PlaySwoosh; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassSwoosh, True); - {$ENDIF} -end; - -procedure TMusic.PlayChange; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassChange, True); - {$ENDIF} -end; - -procedure TMusic.PlayOption; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassOption, True); - {$ENDIF} -end; - -procedure TMusic.PlayClick; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassClick, True); - {$ENDIF} -end; -procedure TMusic.PlayDrum; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassDrum, True); - {$ENDIF} -end; - -procedure TMusic.PlayHihat; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassHihat, True); - {$ENDIF} -end; - -procedure TMusic.PlayClap; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassClap, True); - {$ENDIF} -end; - -procedure TMusic.PlayShuffle; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassShuffle, True); - {$ENDIF} -end; +type + IAudioPlayback = Interface + procedure InitializePlayback; + procedure InitializeRecord; + procedure SetVolume(Volume: integer); + procedure SetMusicVolume(Volume: integer); + procedure SetLoop(Enabled: boolean); + function Open(Name: string): boolean; // true if succeed + procedure Rewind; + procedure MoveTo(Time: real); + procedure Play; + procedure Pause; //Pause Mod + procedure Stop; + procedure Close; + function Finished: boolean; + function Length: real; + function Position: real; + procedure PlayStart; + procedure PlayBack; + procedure PlaySwoosh; + procedure PlayChange; + procedure PlayOption; + procedure PlayClick; + procedure PlayDrum; + procedure PlayHihat; + procedure PlayClap; + procedure PlayShuffle; + procedure StopShuffle; + procedure CaptureStart; + procedure CaptureStop; + procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); + procedure StopCard(Card: byte); + function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; -procedure TMusic.StopShuffle; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelStop(BassShuffle); - {$ENDIF} -end; + //Equalizer + function GetFFTData: TFFTData; -procedure TMusic.CaptureStart; -var - S: integer; - SC: integer; - P1: integer; - P2: integer; -begin - for S := 0 to High(Sound) do - Sound[S].BufferLong[0].Clear; - - for SC := 0 to High(Ini.CardList) do begin - P1 := Ini.CardList[SC].ChannelL; - P2 := Ini.CardList[SC].ChannelR; - if P1 > PlayersPlay then P1 := 0; - if P2 > PlayersPlay then P2 := 0; - if (P1 > 0) or (P2 > 0) then - CaptureCard(SC, P1, P2); + //Custom Sounds + function LoadCustomSound(const Filename: String): Cardinal; + procedure PlayCustomSound(const Index: Cardinal ); end; -end; -procedure TMusic.CaptureStop; -var - SC: integer; - P1: integer; - P2: integer; -begin - for SC := 0 to High(Ini.CardList) do begin - P1 := Ini.CardList[SC].ChannelL; - P2 := Ini.CardList[SC].ChannelR; - if P1 > PlayersPlay then P1 := 0; - if P2 > PlayersPlay then P2 := 0; - if (P1 > 0) or (P2 > 0) then StopCard(SC); - end; +var // TODO : JB --- THESE SHOULD NOT BE GLOBAL + // muzyka + Muzyka: TMuzyka; -end; + // czesci z nutami; + Czesci: array of TCzesci; -//procedure TMusic.CaptureCard(RecordI, SoundNum, PlayerLeft, PlayerRight: byte); -procedure TMusic.CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); -var - Error: integer; - ErrorMsg: string; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - - if not BASS_RecordInit(RecordI) then - begin - Error := BASS_ErrorGetCode; - - ErrorMsg := IntToStr(Error); - if Error = BASS_ERROR_DX then ErrorMsg := 'No DX5'; - if Error = BASS_ERROR_ALREADY then ErrorMsg := 'The device has already been initialized'; - if Error = BASS_ERROR_DEVICE then ErrorMsg := 'The device number specified is invalid'; - if Error = BASS_ERROR_DRIVER then ErrorMsg := 'There is no available device driver'; - - {Log.LogAnalyze('Error initializing record [' + IntToStr(RecordI) + ', ' - + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' - + ErrorMsg);} - Log.LogError('Error initializing record [' + IntToStr(RecordI) + ', ' - + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' - + ErrorMsg); - Log.LogError('Music -> CaptureCard: Error initializing record: ' + ErrorMsg); - - - end - else - begin - Recording.SoundCard[RecordI].BassRecordStream := BASS_RecordStart(44100, 2, MakeLong(0, 20) , @GetMicrophone, PlayerLeft + PlayerRight*256); - end; + // czas + Czas: TCzas; - {$ENDIF} -end; - -procedure TMusic.StopCard(Card: byte); -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_RecordSetDevice(Card); - BASS_RecordFree; - {$ENDIF} -end; -function TMusic.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; -var - L: Integer; -begin - if FileExists(Name) then - begin - Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); - try - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); - {$ELSE} - hStream := FFMPeg_StreamCreateFile(False, pchar(Name) ); - {$ENDIF} - - - - //Add CustomSound - L := High(CustomSounds) + 1; - SetLength (CustomSounds, L + 1); - CustomSounds[L].Filename := Name; - CustomSounds[L].Handle := hStream; - except - Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); - end; - end - else - begin - Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); - exit; - end; -end; +procedure InitializeSound; +function AudioPlayback(): IAudioPlayback; -//Equalizer -function TMusic.GetFFTData: TFFTData; -var -Data: TFFTData; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass +implementation - //Get Channel Data Mono and 256 Values - BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); - //Result := Data; - - {$ENDIF} -end; +uses + uLog, + UMusic_BASS; -function TMusic.LoadCustomSound(const Filename: String): Cardinal; var - S: hStream; - I: Integer; - F: String; -begin - //Search for Sound in already loaded Sounds - F := UpperCase(SoundPath + FileName); - For I := 0 to High(CustomSounds) do - begin - if (UpperCase(CustomSounds[I].Filename) = F) then - begin - Result := I; - Exit; - end; - end; - - if LoadSoundFromFile(S, SoundPath + Filename) then - Result := High(CustomSounds) - else - Result := 0; -end; + singleton_AudioPlayback : IAudioPlayback; -procedure TMusic.PlayCustomSound(const Index: Cardinal); +function AudioPlayback(): IAudioPlayback; begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass + if singleton_AudioPlayback = nil then + begin + writeln( 'Created AudioPlayback' ); + singleton_AudioPlayback := TMusic_bass.create(); + end; - if Index <= High(CustomSounds) then - BASS_ChannelPlay(CustomSounds[Index].Handle, True); - - {$ENDIF} + result := singleton_AudioPlayback; end; - -{* - -Sorry guys... this is my mess :( -Im going to try and get ffmpeg to handle audio playback ( at least for linux ) -and Im going to implement it nicly along side BASS, in TMusic ( where I can ) - -http://www.dranger.com/ffmpeg/ffmpeg.html -http://www.dranger.com/ffmpeg/ffmpegtutorial_all.html - -http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html - -*} -function TMusic.FFMPeg_StreamCreateFile(abool : boolean; aFileName : pchar ): THandle; -var - lFormatCtx : PAVFormatContext; +procedure InitializeSound; begin + Log.LogStatus('Initializing Playback', 'InitializeSound'); + AudioPlayback.InitializePlayback; -(* - if(SDL_OpenAudio(&wanted_spec, &spec) < 0) - begin - fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError()); - writeln( 'SDL_OpenAudio' ); - exit; - end; -*) - -(* - if ( av_open_input_file( lFormatCtx, aFileName, NULL, 0, NULL ) <> 0 ) - begin - writeln( 'Unable to open file '+ aFileName ); - exit; - end; - - // Retrieve stream information - if ( av_find_stream_info(pFormatCtx) < 0 ) - begin - writeln( 'Unable to Retrieve stream information' ); - exit; - end; -*) - + Log.LogStatus('Initializing Record', 'InitializeSound'); + AudioPlayback.InitializeRecord; end; end. diff --git a/Game/Code/Classes/UMusic_BASS.pas b/Game/Code/Classes/UMusic_BASS.pas new file mode 100644 index 00000000..dfb6f79c --- /dev/null +++ b/Game/Code/Classes/UMusic_BASS.pas @@ -0,0 +1,703 @@ +unit UMusic_BASS; + +interface + +{$I switches.inc} + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + + +uses Classes, + + {$IFDEF win32} + windows, + {$ENDIF} + +// UCommon, + Messages, + SysUtils, + {$IFNDEF FPC} + Forms, + {$ENDIF} + + bass, + ULog, + UMusic; +// USongs; +// Classes; + + + +type + + TMusic_bass = class( TInterfacedObject, IAudioPlayback ) + private + BassStart: hStream; // Wait, I've replaced this with BASS + BassBack: hStream; // It has almost all features we need + BassSwoosh: hStream; + BassChange: hStream; // Almost? It aleady has them all :) + BassOption: hStream; + BassClick: hStream; + BassDrum: hStream; + BassHihat: hStream; + BassClap: hStream; + BassShuffle: hStream; + + //Custom Sounds + CustomSounds: array of TCustomSoundEntry; + Loaded: boolean; + Loop: boolean; + fHWND: THandle; + + public + Bass: hStream; + procedure InitializePlayback; + procedure InitializeRecord; + procedure SetVolume(Volume: integer); + procedure SetMusicVolume(Volume: integer); + procedure SetLoop(Enabled: boolean); + function Open(Name: string): boolean; // true if succeed + procedure Rewind; + procedure MoveTo(Time: real); + procedure Play; + procedure Pause; //Pause Mod + procedure Stop; + procedure Close; + function Finished: boolean; + function Length: real; + function Position: real; + procedure PlayStart; + procedure PlayBack; + procedure PlaySwoosh; + procedure PlayChange; + procedure PlayOption; + procedure PlayClick; + procedure PlayDrum; + procedure PlayHihat; + procedure PlayClap; + procedure PlayShuffle; + procedure StopShuffle; + procedure CaptureStart; + procedure CaptureStop; + procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); + procedure StopCard(Card: byte); + function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; + + //Equalizer + function GetFFTData: TFFTData; + + //Custom Sounds + function LoadCustomSound(const Filename: String): Cardinal; + procedure PlayCustomSound(const Index: Cardinal ); +end; + +const + RecordSystem = 1; + +type + TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, + mpPaused, mpOpen); + +const + ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); + +implementation + +uses + {$IFDEF FPC} + lclintf, + {$ENDIF} + +// avcodec, +// avformat, +// avutil, + +// UGraphic, + URecord, +// UFiles, + UIni, + UMain, + UThemes; + + + +procedure TMusic_bass.InitializePlayback; +var + Pet: integer; + S: integer; +begin + Log.BenchmarkStart(4); + Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); + + Loaded := false; + Loop := false; + + {$ifdef win32} + // TODO : JB_Linux ... is this needed ? :) + fHWND := AllocateHWND( nil); // TODO : JB_lazarus - can we do something different here ?? lazarus didnt like this function + {$ENDIF} + + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + if not BASS_Init(1, 44100, 0, fHWND, nil) then + begin + {$IFNDEF FPC} + // TODO : JB_linux find a way to do this nice.. + Application.MessageBox ('Could not initialize BASS', 'Error'); + {$ENDIF} + Exit; + end; + {$ENDIF} + + Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); + + // config playing buffer +// BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); +// BASS_SetConfig(BASS_CONFIG_BUFFER, 100); + + Log.LogStatus('Loading Sounds', 'Music Initialize'); + + Log.BenchmarkStart(4); + LoadSoundFromFile(BassStart, SoundPath + 'Common Start.mp3'); + LoadSoundFromFile(BassBack, SoundPath + 'Common Back.mp3'); + LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3'); + LoadSoundFromFile(BassChange, SoundPath + 'select music change music 50.mp3'); + LoadSoundFromFile(BassOption, SoundPath + 'option change col.mp3'); + LoadSoundFromFile(BassClick, SoundPath + 'rimshot022b.mp3'); + +// LoadSoundFromFile(BassDrum, SoundPath + 'bassdrumhard076b.mp3'); +// LoadSoundFromFile(BassHihat, SoundPath + 'hihatclosed068b.mp3'); +// LoadSoundFromFile(BassClap, SoundPath + 'claps050b.mp3'); + +// LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3'); + + Log.BenchmarkEnd(4); + Log.LogBenchmark('--> Loading Sounds', 4); +end; + +procedure TMusic_bass.InitializeRecord; +var + S: integer; + device: integer; + descr: string; + input: integer; + input2: integer; + flags: integer; + mic: array[0..15] of integer; + SC: integer; // soundcard + SCI: integer; // soundcard input +begin + if RecordSystem = 1 then begin + SetLength(Sound, 6 {max players});//Ini.Players+1); + for S := 0 to High(Sound) do begin //Ini.Players do begin + Sound[S] := TSound.Create; + Sound[S].Num := S; + Sound[S].BufferNew := TMemoryStream.Create; + SetLength(Sound[S].BufferLong, 1); + Sound[S].BufferLong[0] := TMemoryStream.Create; + Sound[S].n := 4*1024; + end; + + + // check for recording devices; + {device := 0; + descr := BASS_RecordGetDeviceDescription(device); + + SetLength(SoundCard, 0); + while (descr <> '') do begin + SC := High(SoundCard) + 1; + SetLength(SoundCard, SC+1); + + Log.LogAnalyze('Device #'+IntToStr(device)+': '+ descr); + SoundCard[SC].Description := Descr; + + // check for recording inputs + mic[device] := -1; // default to no change + input := 0; + BASS_RecordInit(device); + Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); + flags := BASS_RecordGetInput(input); + + SetLength(SoundCard[SC].Input, 0); + while (flags <> -1) do begin + SCI := High(SoundCard[SC].Input) + 1; + SetLength(SoundCard[SC].Input, SCI+1); + + Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); + SoundCard[SC].Input[SCI].Name := BASS_RecordGetInputName(Input); + + if (flags and BASS_INPUT_TYPE_MASK) = BASS_INPUT_TYPE_MIC then begin + mic[device] := input; // auto set microphone + end; + Inc(Input); + flags := BASS_RecordGetInput(input); + end; + + if mic[device] <> -1 then begin + Log.LogAnalyze('Found the mic at input ' + IntToStr(Mic[device])) + end else begin + Log.LogAnalyze('Mic not found'); + mic[device] := 0; // setting to the first one (for kxproject) + end; + SoundCard[SC].InputSeleceted := Mic[Device]; + + + BASS_RecordFree; + + inc(Device); + descr := BASS_RecordGetDeviceDescription(Device); + end; // while} + end; // if +end; + +procedure TMusic_bass.SetVolume(Volume: integer); +begin + //Old Sets Wave Volume + //BASS_SetVolume(Volume); + //New: Sets Volume only for this Application + + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); + {$ENDIF} +end; + +procedure TMusic_bass.SetMusicVolume(Volume: Integer); +begin + //Max Volume Prevention + if Volume > 100 then + Volume := 100; + + if Volume < 0 then + Volume := 0; + + + //Set Volume + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelSetAttributes (Bass, -1, Volume, -101); + {$ENDIF} +end; + +procedure TMusic_bass.SetLoop(Enabled: boolean); +begin + Loop := Enabled; +end; + +function TMusic_bass.Open(Name: string): boolean; +begin + Loaded := false; + if FileExists(Name) then + begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); + {$ENDIF} + + Loaded := true; + //Set Max Volume + SetMusicVolume (100); + end; + + Result := Loaded; +end; + +procedure TMusic_bass.Rewind; +begin + if Loaded then begin + end; +end; + +procedure TMusic_bass.MoveTo(Time: real); +var + bytes: integer; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + bytes := BASS_ChannelSeconds2Bytes(Bass, Time); + BASS_ChannelSetPosition(Bass, bytes); + {$ENDIF} +end; + +procedure TMusic_bass.Play; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + if Loaded then + begin + if Loop then + BASS_ChannelPlay(Bass, True); // start from beginning... actually bass itself does not loop, nor does this TMusic_bass Class + + BASS_ChannelPlay(Bass, False); // for setting position before playing + end; + {$ENDIF} +end; + +procedure TMusic_bass.Pause; //Pause Mod +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + if Loaded then begin + BASS_ChannelPause(Bass); // Pauses Song + end; + {$ENDIF} +end; + +procedure TMusic_bass.Stop; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + Bass_ChannelStop(Bass); + {$ENDIF} +end; + +procedure TMusic_bass.Close; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + Bass_StreamFree(Bass); + {$ENDIF} +end; + +function TMusic_bass.Length: real; +var + bytes: integer; +begin + Result := 60; + + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + bytes := BASS_ChannelGetLength(Bass); + Result := BASS_ChannelBytes2Seconds(Bass, bytes); + {$ENDIF} +end; + +function TMusic_bass.Position: real; +var + bytes: integer; +begin + Result := 0; + + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + bytes := BASS_ChannelGetPosition(BASS); + Result := BASS_ChannelBytes2Seconds(BASS, bytes); + {$ENDIF} +end; + +function TMusic_bass.Finished: boolean; +begin + Result := false; + + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then + begin + Result := true; + end; + {$ENDIF} +end; + +procedure TMusic_bass.PlayStart; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassStart, True); + {$ENDIF} +end; + +procedure TMusic_bass.PlayBack; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassBack, True);// then + {$ENDIF} +end; + +procedure TMusic_bass.PlaySwoosh; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassSwoosh, True); + {$ENDIF} +end; + +procedure TMusic_bass.PlayChange; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassChange, True); + {$ENDIF} +end; + +procedure TMusic_bass.PlayOption; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassOption, True); + {$ENDIF} +end; + +procedure TMusic_bass.PlayClick; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassClick, True); + {$ENDIF} +end; + +procedure TMusic_bass.PlayDrum; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassDrum, True); + {$ENDIF} +end; + +procedure TMusic_bass.PlayHihat; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassHihat, True); + {$ENDIF} +end; + +procedure TMusic_bass.PlayClap; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassClap, True); + {$ENDIF} +end; + +procedure TMusic_bass.PlayShuffle; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassShuffle, True); + {$ENDIF} +end; + +procedure TMusic_bass.StopShuffle; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_ChannelStop(BassShuffle); + {$ENDIF} +end; + +procedure TMusic_bass.CaptureStart; +var + S: integer; + SC: integer; + P1: integer; + P2: integer; +begin + for S := 0 to High(Sound) do + Sound[S].BufferLong[0].Clear; + + for SC := 0 to High(Ini.CardList) do begin + P1 := Ini.CardList[SC].ChannelL; + P2 := Ini.CardList[SC].ChannelR; + if P1 > PlayersPlay then P1 := 0; + if P2 > PlayersPlay then P2 := 0; + if (P1 > 0) or (P2 > 0) then + CaptureCard(SC, P1, P2); + end; +end; + +procedure TMusic_bass.CaptureStop; +var + SC: integer; + P1: integer; + P2: integer; +begin + + for SC := 0 to High(Ini.CardList) do begin + P1 := Ini.CardList[SC].ChannelL; + P2 := Ini.CardList[SC].ChannelR; + if P1 > PlayersPlay then P1 := 0; + if P2 > PlayersPlay then P2 := 0; + if (P1 > 0) or (P2 > 0) then StopCard(SC); + end; + +end; + +//procedure TMusic_bass.CaptureCard(RecordI, SoundNum, PlayerLeft, PlayerRight: byte); +procedure TMusic_bass.CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); +var + Error: integer; + ErrorMsg: string; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + + if not BASS_RecordInit(RecordI) then + begin + Error := BASS_ErrorGetCode; + + ErrorMsg := IntToStr(Error); + if Error = BASS_ERROR_DX then ErrorMsg := 'No DX5'; + if Error = BASS_ERROR_ALREADY then ErrorMsg := 'The device has already been initialized'; + if Error = BASS_ERROR_DEVICE then ErrorMsg := 'The device number specified is invalid'; + if Error = BASS_ERROR_DRIVER then ErrorMsg := 'There is no available device driver'; + + {Log.LogAnalyze('Error initializing record [' + IntToStr(RecordI) + ', ' + + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' + + ErrorMsg);} + Log.LogError('Error initializing record [' + IntToStr(RecordI) + ', ' + + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' + + ErrorMsg); + Log.LogError('Music -> CaptureCard: Error initializing record: ' + ErrorMsg); + + + end + else + begin + Recording.SoundCard[RecordI].BassRecordStream := BASS_RecordStart(44100, 2, MakeLong(0, 20) , @GetMicrophone, PlayerLeft + PlayerRight*256); + end; + + {$ENDIF} +end; + +procedure TMusic_bass.StopCard(Card: byte); +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + BASS_RecordSetDevice(Card); + BASS_RecordFree; + {$ENDIF} +end; + +function TMusic_bass.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; +var + L: Integer; +begin + if FileExists(Name) then + begin + Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); + try + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); + {$ELSE} + hStream := FFMPeg_StreamCreateFile(False, pchar(Name) ); + {$ENDIF} + + + + //Add CustomSound + L := High(CustomSounds) + 1; + SetLength (CustomSounds, L + 1); + CustomSounds[L].Filename := Name; + CustomSounds[L].Handle := hStream; + except + Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); + end; + end + else + begin + Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); + exit; + end; +end; + +//Equalizer +function TMusic_bass.GetFFTData: TFFTData; +var +Data: TFFTData; +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + + //Get Channel Data Mono and 256 Values + BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); + //Result := Data; + + {$ENDIF} +end; + +function TMusic_bass.LoadCustomSound(const Filename: String): Cardinal; +var + S: hStream; + I: Integer; + F: String; +begin + //Search for Sound in already loaded Sounds + F := UpperCase(SoundPath + FileName); + For I := 0 to High(CustomSounds) do + begin + if (UpperCase(CustomSounds[I].Filename) = F) then + begin + Result := I; + Exit; + end; + end; + + if LoadSoundFromFile(S, SoundPath + Filename) then + Result := High(CustomSounds) + else + Result := 0; +end; + +procedure TMusic_bass.PlayCustomSound(const Index: Cardinal ); +begin + {$IFDEF useBASS} + // TODO : jb_linux replace with something other than bass + + if Index <= High(CustomSounds) then + BASS_ChannelPlay(CustomSounds[Index].Handle, True); + + {$ENDIF} +end; + + +{* + +Sorry guys... this is my mess :( +Im going to try and get ffmpeg to handle audio playback ( at least for linux ) +and Im going to implement it nicly along side BASS, in TMusic_bass ( where I can ) + +http://www.dranger.com/ffmpeg/ffmpeg.html +http://www.dranger.com/ffmpeg/ffmpegtutorial_all.html + +http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html + +*} +{* +function TMusic_bass.FFMPeg_StreamCreateFile(abool : boolean; aFileName : pchar ): THandle; +var + lFormatCtx : PAVFormatContext; +begin + +(* + if(SDL_OpenAudio(&wanted_spec, &spec) < 0) + begin + fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError()); + writeln( 'SDL_OpenAudio' ); + exit; + end; +*) + +(* + if ( av_open_input_file( lFormatCtx, aFileName, NULL, 0, NULL ) <> 0 ) + begin + writeln( 'Unable to open file '+ aFileName ); + exit; + end; + + // Retrieve stream information + if ( av_find_stream_info(pFormatCtx) < 0 ) + begin + writeln( 'Unable to Retrieve stream information' ); + exit; + end; +*) + +end; *} + +end. diff --git a/Game/Code/Classes/UTime.pas b/Game/Code/Classes/UTime.pas index edd65b7e..87d17ee5 100644 --- a/Game/Code/Classes/UTime.pas +++ b/Game/Code/Classes/UTime.pas @@ -6,7 +6,6 @@ interface {$MODE Delphi} {$ENDIF} -{$DEFINE SDLTimer} {$UNDEF DebugDisplay} type @@ -22,7 +21,6 @@ procedure CountMidTime; var USTime: TTime; - TimeFreq: int64; TimeNew: int64; TimeOld: int64; TimeSkip: real; @@ -32,16 +30,8 @@ var implementation uses - {$IFDEF win32} - windows, - {$ELSE} - libc, - time, - {$ENDIF} - sysutils, - {$IFDEF SDLTimer} +// sysutils, sdl, - {$ENDIF} ucommon; const @@ -65,18 +55,7 @@ end; procedure CountSkipTimeSet; begin - {$IFDEF SDLTimer} - TimeNew := SDL_GetTicks(); // / cSDLCorrectionRatio - TimeFreq := 0; - {$ELSE} - {$IFDEF win32} - QueryPerformanceFrequency(TimeFreq); - QueryPerformanceCounter(TimeNew); - {$ELSE} - TimeNew := CurrentSec100OfDay(); // TODO - JB_Linux will prob need looking at - TimeFreq := 0; - {$ENDIF} - {$ENDIF} + TimeNew := SDL_GetTicks(); {$IFDEF DebugDisplay} Writeln( 'CountSkipTimeSet : ' + inttostr(trunc(TimeNew)) ); @@ -86,26 +65,9 @@ end; procedure CountSkipTime; begin - TimeOld := TimeNew; - - {$IFDEF SDLTimer} - TimeNew := SDL_GetTicks(); - TimeSkip := (TimeNew-TimeOld) / cSDLCorrectionRatio; - {$ELSE} - {$IFDEF win32} - QueryPerformanceCounter(TimeNew); - - if ( TimeNew-TimeOld > 0 ) AND - ( TimeFreq > 0 ) THEN - begin - TimeSkip := (TimeNew-TimeOld)/TimeFreq; - end; - - {$ELSE} - TimeNew := CurrentSec100OfDay(); // TODO - JB_Linux will prob need looking at - TimeSkip := (TimeNew-TimeOld); - {$ENDIF} - {$ENDIF} + TimeOld := TimeNew; + TimeNew := SDL_GetTicks(); + TimeSkip := (TimeNew-TimeOld) / cSDLCorrectionRatio; {$IFDEF DebugDisplay} Writeln( 'TimeNew : ' + inttostr(trunc(TimeNew)) ); @@ -116,43 +78,20 @@ end; procedure CountMidTime; begin - {$IFDEF SDLTimer} - TimeMidTemp := SDL_GetTicks(); - TimeMid := (TimeMidTemp - TimeNew) / cSDLCorrectionRatio; - {$ELSE} - {$IFDEF win32} - QueryPerformanceCounter(TimeMidTemp); - TimeMid := (TimeMidTemp-TimeNew)/TimeFreq; - {$ELSE} - TimeMidTemp := CurrentSec100OfDay(); - TimeMid := (TimeMidTemp-TimeNew); // TODO - JB_Linux will prob need looking at - {$ENDIF} - {$ENDIF} + TimeMidTemp := SDL_GetTicks(); + TimeMid := (TimeMidTemp - TimeNew) / cSDLCorrectionRatio; {$IFDEF DebugDisplay} - Writeln( 'TimeNew : ' + inttostr(trunc(TimeNew)) ); + Writeln( 'TimeNew : ' + inttostr(trunc(TimeNew)) ); Writeln( 'CountMidTime : ' + inttostr(trunc(TimeMid)) ); {$ENDIF} end; function TTime.GetTime: real; -var - TimeTemp: int64; begin - {$IFDEF SDLTimer} - TimeTemp := SDL_GetTicks(); - Result := TimeTemp / cSDLCorrectionRatio; // TODO - JB_Linux will prob need looking at - {$ELSE} - {$IFDEF win32} - QueryPerformanceCounter(TimeTemp); - Result := TimeTemp / TimeFreq; - {$ELSE} - TimeTemp := CurrentSec100OfDay(); - Result := TimeTemp; // TODO - JB_Linux will prob need looking at - {$ENDIF} - {$ENDIF} - + Result := SDL_GetTicks() / cSDLCorrectionRatio; + {$IFDEF DebugDisplay} Writeln( 'GetTime : ' + inttostr(trunc(Result)) ); {$ENDIF} diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index 2dd745fd..ed1e5fe3 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -210,7 +210,6 @@ begin writeln( 'VideoStreamIndex : ' + inttostr(VideoStreamIndex) ); writeln( 'AudioStreamIndex : ' + inttostr(AudioStreamIndex) ); end; -(* aCodecCtx := VideoFormatContext.streams[ AudioStreamIndex ].codec; WantedAudioCodecContext.freq := aCodecCtx^.sample_rate; @@ -222,7 +221,7 @@ begin WantedAudioCodecContext.userdata := aCodecCtx; - +(* if(SDL_OpenAudio(WantedAudioCodecContext, AudioCodecContext) < 0) then begin writeln( 'Could not do SDL_OpenAudio' ); diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 2bd0156a..b7d6d3e7 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -172,7 +172,7 @@ begin SDLK_BACKSPACE : begin FadeTo(@ScreenMain); - Music.PlayBack; + AudioPlayback.PlayBack; end; { SDLK_SPACE: begin @@ -288,7 +288,7 @@ begin deluxe_slidein := 0; Credits_Alpha := 0; //Music.SetLoop(true); Loop looped ned, so ne scheisse - Music.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! + AudioPlayback.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! // Music.Play; CTime:=0; // setlength(CTime_hold,0); @@ -344,7 +344,7 @@ end; procedure TScreenCredits.onHide; begin - Music.Stop; + AudioPlayback.Stop; end; Procedure TScreenCredits.Draw_FunkyText; @@ -445,7 +445,7 @@ const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),( begin //dis does teh muiwk y0r - Data := Music.GetFFTData; + Data := AudioPlayback.GetFFTData; Log.LogStatus('',' JB-1'); @@ -465,7 +465,7 @@ begin CRDTS_Stage:=Intro; CTime:=0; - Music.Play; + AudioPlayback.Play; end; if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then @@ -1311,14 +1311,14 @@ Log.LogStatus('',' JB-4'); begin if CTime=Timings[20] then begin CTime_hold:=0; - Music.Stop; - Music.Open(soundpath + 'credits-outro-tune.mp3'); - Music.Play; - Music.SetVolume(20); - Music.SetLoop(True); + AudioPlayback.Stop; + AudioPlayback.Open(soundpath + 'credits-outro-tune.mp3'); + AudioPlayback.Play; + AudioPlayback.SetVolume(20); + AudioPlayback.SetLoop(True); end; if CTime_hold > 231 then begin - Music.Play; + AudioPlayback.Play; Ctime_hold:=0; end; glClearColor(0,0,0,0); diff --git a/Game/Code/Screens/UScreenEdit.pas b/Game/Code/Screens/UScreenEdit.pas index 93c2a5b4..a58756e6 100644 --- a/Game/Code/Screens/UScreenEdit.pas +++ b/Game/Code/Screens/UScreenEdit.pas @@ -36,14 +36,15 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenMain); // Result := false; end; SDLK_RETURN: begin - if Interaction = 0 then begin - Music.PlayStart; + if Interaction = 0 then + begin + AudioPlayback.PlayStart; FadeTo(@ScreenEditConvert); end; // if Interaction = 1 then begin @@ -51,8 +52,9 @@ begin // FadeTo(@ScreenEditHeader); // end; - if Interaction = 1 then begin - Music.PlayBack; + if Interaction = 1 then + begin + AudioPlayback.PlayBack; FadeTo(@ScreenMain); end; end; diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index 762f84c2..1878337b 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -120,19 +120,21 @@ begin {$IFDEF UseMIDIPort} MidiFile.StopPlaying; {$ENDIF} - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenEdit); end; SDLK_RETURN: begin - if Interaction = 0 then begin - Music.PlayStart; + if Interaction = 0 then + begin + AudioPlayback.PlayStart; ScreenOpen.BackScreen := @ScreenEditConvert; FadeTo(@ScreenOpen); end; - if Interaction = 1 then begin + if Interaction = 1 then + begin Selected := false; {$IFDEF UseMIDIPort} MidiFile.OnMidiEvent := MidiFile1MidiEvent; diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 22420b26..1dd3fb24 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -320,13 +320,13 @@ begin if SDL_ModState = 0 then begin // Play Sentence Click := true; - Music.Stop; + AudioPlayback.Stop; R := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote); - if R <= Music.Length then begin - Music.MoveTo(R); + if R <= AudioPlayback.Length then begin + AudioPlayback.MoveTo(R); PlayStopTime := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec); PlaySentence := true; - Music.Play; + AudioPlayback.Play; LastClick := -100; end; end; @@ -349,10 +349,10 @@ begin PlaySentence := true; Click := true; - Music.Stop; - Music.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote)+0{-0.10}); + AudioPlayback.Stop; + AudioPlayback.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote)+0{-0.10}); PlayStopTime := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec)+0; - Music.Play; + AudioPlayback.Play; LastClick := -100; end; end; @@ -363,12 +363,12 @@ begin PlaySentenceMidi := false; // stop midi PlaySentence := true; Click := false; - Music.Stop; - Music.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start)); + AudioPlayback.Stop; + AudioPlayback.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start)); PlayStopTime := (GetTimeFromBeat( Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc)); - Music.Play; + AudioPlayback.Play; LastClick := -100; end; @@ -510,7 +510,7 @@ begin Lyric.AddCzesc(Czesci[0].Akt); Lyric.Selected := 0; - Music.Stop; + AudioPlayback.Stop; PlaySentence := false; end; @@ -538,7 +538,7 @@ begin Lyric.AddCzesc(Czesci[0].Akt); Lyric.Selected := 0; - Music.Stop; + AudioPlayback.Stop; PlaySentence := false; end; @@ -1188,7 +1188,7 @@ begin AktNuta := 0; Czesci[0].Czesc[0].Nuta[0].Color := 1; - Music.Open(Path + AktSong.Mp3); + AudioPlayback.Open(Path + AktSong.Mp3); //Set Down Music Volume for Better hearability of Midi Sounds //Music.SetVolume(40); @@ -1262,20 +1262,22 @@ begin // mp3 music if PlaySentence then begin // stop the music - if (Music.Position > PlayStopTime) then begin - Music.Stop; + if (AudioPlayback.Position > PlayStopTime) then + begin + AudioPlayback.Stop; PlaySentence := false; end; // click if (Click) and (PlaySentence) then begin // AktBeat := Floor(AktSong.BPM[0].BPM * (Music.Position - AktSong.GAP / 1000) / 60); - AktBeat := Floor(GetMidBeat(Music.Position - AktSong.GAP / 1000)); + AktBeat := Floor(GetMidBeat(AudioPlayback.Position - AktSong.GAP / 1000)); Text[TextDebug].Text := IntToStr(AktBeat); if AktBeat <> LastClick then begin for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do - if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then begin - Music.PlayClick; + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then + begin + AudioPlayback.PlayClick; LastClick := AktBeat; end; end; diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas index 34fc87af..df23d340 100644 --- a/Game/Code/Screens/UScreenLevel.pas +++ b/Game/Code/Screens/UScreenLevel.pas @@ -32,7 +32,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenName); end; @@ -40,7 +40,7 @@ begin begin Ini.Difficulty := Interaction; Ini.SaveLevel; - Music.PlayStart; + AudioPlayback.PlayStart; //Set Standard Mode ScreenSong.Mode := 0; FadeTo(@ScreenSong); diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index aecc40bb..cb7390cc 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -92,7 +92,7 @@ begin //Credits_Y := 600; //Credits_Alpha := 0; //Credits_Visible := True; - Music.PlayStart; + AudioPlayback.PlayStart; FadeTo(@ScreenCredits); end; end; @@ -100,20 +100,20 @@ begin begin if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then begin - Music.PlayStart; + AudioPlayback.PlayStart; FadeTo(@ScreenPartyOptions); end; end; SDLK_S: begin - Music.PlayStart; + AudioPlayback.PlayStart; FadeTo(@ScreenStatMain); end; SDLK_E: begin - Music.PlayStart; + AudioPlayback.PlayStart; FadeTo(@ScreenEdit); end; @@ -124,7 +124,7 @@ begin begin if (Length(Songs.Song) >= 1) then begin - Music.PlayStart; + AudioPlayback.PlayStart; if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1; if (Ini.Players = 4) then PlayersPlay := 6; @@ -141,7 +141,7 @@ begin begin if (Length(DLLMan.Plugins)>=1) then begin - Music.PlayStart; + AudioPlayback.PlayStart; FadeTo(@ScreenPartyOptions); end else //show error message, No Plugins Loaded @@ -152,25 +152,29 @@ begin end; //Stats - if Interaction = 2 then begin - Music.PlayStart; + if Interaction = 2 then + begin + AudioPlayback.PlayStart; FadeTo(@ScreenStatMain); end; //Editor - if Interaction = 3 then begin - Music.PlayStart; + if Interaction = 3 then + begin + AudioPlayback.PlayStart; FadeTo(@ScreenEdit); end; //Options - if Interaction = 4 then begin - Music.PlayStart; + if Interaction = 4 then + begin + AudioPlayback.PlayStart; FadeTo(@ScreenOptions); end; //Exit - if Interaction = 5 then begin + if Interaction = 5 then + begin Result := false; end; end; diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index 0d98e944..5363d2a2 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -156,7 +156,7 @@ begin SDLK_ESCAPE : begin Ini.SaveNames; - Music.PlayBack; + AudioPlayback.PlayBack; if GoTo_SingScreen then FadeTo(@ScreenSong) else @@ -168,7 +168,7 @@ begin for I := 1 to 6 do Ini.Name[I-1] := Button[I-1].Text[0].Text; Ini.SaveNames; - Music.PlayStart; + AudioPlayback.PlayStart; if GoTo_SingScreen then FadeTo(@ScreenSing) diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index c27ee762..edf684db 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -57,7 +57,7 @@ begin begin //Empty Filename and go to last Screen FileName := ''; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(BackScreen); end; @@ -66,14 +66,14 @@ begin if (Interaction = 2) then begin //Update Filename and go to last Screen FileName := Text[TextN].Text; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(BackScreen); end else if (Interaction = 1) then begin //Empty Filename and go to last Screen FileName := ''; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(BackScreen); end; end; diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas index a1f64659..1867d03b 100644 --- a/Game/Code/Screens/UScreenOptions.pas +++ b/Game/Code/Screens/UScreenOptions.pas @@ -36,49 +36,57 @@ begin SDLK_BACKSPACE : begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenMain); end; SDLK_RETURN: begin - if SelInteraction = 0 then begin - Music.PlayStart; + if SelInteraction = 0 then + begin + AudioPlayback.PlayStart; FadeTo(@ScreenOptionsGame); end; - if SelInteraction = 1 then begin - Music.PlayStart; + if SelInteraction = 1 then + begin + AudioPlayback.PlayStart; FadeTo(@ScreenOptionsGraphics); end; - if SelInteraction = 2 then begin - Music.PlayStart; + if SelInteraction = 2 then + begin + AudioPlayback.PlayStart; FadeTo(@ScreenOptionsSound); end; - if SelInteraction = 3 then begin - Music.PlayStart; + if SelInteraction = 3 then + begin + AudioPlayback.PlayStart; FadeTo(@ScreenOptionsLyrics); end; - if SelInteraction = 4 then begin - Music.PlayStart; + if SelInteraction = 4 then + begin + AudioPlayback.PlayStart; FadeTo(@ScreenOptionsThemes); end; - if SelInteraction = 5 then begin - Music.PlayStart; + if SelInteraction = 5 then + begin + AudioPlayback.PlayStart; FadeTo(@ScreenOptionsRecord); end; - if SelInteraction = 6 then begin - Music.PlayStart; + if SelInteraction = 6 then + begin + AudioPlayback.PlayStart; FadeTo(@ScreenOptionsAdvanced); end; - if SelInteraction = 7 then begin + if SelInteraction = 7 then + begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenMain); end; end; diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index 63c3aa7a..271ff972 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -32,7 +32,7 @@ begin SDLK_BACKSPACE : begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; SDLK_RETURN: @@ -41,7 +41,7 @@ begin //if SelInteraction = 7 then begin if SelInteraction = 6 then begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; end; @@ -54,7 +54,7 @@ begin //SelectLoadAnimation Hidden because it is useless atm //if (SelInteraction >= 0) and (SelInteraction <= 6) then begin if (SelInteraction >= 0) and (SelInteraction <= 5) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractInc; end; end; @@ -63,7 +63,7 @@ begin //SelectLoadAnimation Hidden because it is useless atm //if (SelInteraction >= 0) and (SelInteraction <= 6) then begin if (SelInteraction >= 0) and (SelInteraction <= 5) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index 0f69f326..1d94ffa6 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -33,14 +33,14 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - Music.PlayBack; + AudioPlayback.PlayBack; RefreshSongs; FadeTo(@ScreenOptions); end; SDLK_RETURN: begin if SelInteraction = 6 then begin - Music.PlayBack; + AudioPlayback.PlayBack; RefreshSongs; FadeTo(@ScreenOptions); end; @@ -51,15 +51,17 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin - Music.PlayOption; + if (SelInteraction >= 0) and (SelInteraction <= 5) then + begin + AudioPlayback.PlayOption; InteractInc; end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin - Music.PlayOption; + if (SelInteraction >= 0) and (SelInteraction <= 5) then + begin + AudioPlayback.PlayOption; InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index d4be6974..c0ea90ff 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -32,7 +32,7 @@ begin SDLK_BACKSPACE : begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; SDLK_RETURN: @@ -42,7 +42,7 @@ begin end;} if SelInteraction = 5 then begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; end; @@ -53,14 +53,14 @@ begin SDLK_RIGHT: begin if (SelInteraction >= 0) and (SelInteraction <= 4) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractInc; end; end; SDLK_LEFT: begin if (SelInteraction >= 0) and (SelInteraction <= 4) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas index 5cadc5b9..7ef7c207 100644 --- a/Game/Code/Screens/UScreenOptionsLyrics.pas +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -32,14 +32,14 @@ begin SDLK_BACKSPACE : begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; SDLK_RETURN: begin if SelInteraction = 3 then begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; end; @@ -50,14 +50,14 @@ begin SDLK_RIGHT: begin if (SelInteraction >= 0) and (SelInteraction <= 2) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractInc; end; end; SDLK_LEFT: begin if (SelInteraction >= 0) and (SelInteraction <= 2) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index ef8b31d1..d497c637 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -36,14 +36,14 @@ begin SDLK_BACKSPACE: begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; SDLK_RETURN: begin if SelInteraction = 4 then begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; end; @@ -54,7 +54,7 @@ begin SDLK_RIGHT: begin if (SelInteraction >= 0) and (SelInteraction <= 3) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractInc; end; if SelInteraction = 0 then UpdateCard; @@ -62,7 +62,7 @@ begin SDLK_LEFT: begin if (SelInteraction >= 0) and (SelInteraction <= 3) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractDec; end; if SelInteraction = 0 then UpdateCard; diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index 3c3e28e4..1777228b 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -32,14 +32,14 @@ begin SDLK_BACKSPACE : begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; SDLK_RETURN: begin if SelInteraction = 6 then begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; end; @@ -50,14 +50,14 @@ begin SDLK_RIGHT: begin if (SelInteraction >= 0) and (SelInteraction <= 5) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractInc; end; end; SDLK_LEFT: begin if (SelInteraction >= 0) and (SelInteraction <= 5) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index 5b5f8877..cf89ac3f 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -35,14 +35,14 @@ begin SDLK_BACKSPACE : begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; SDLK_RETURN: begin if SelInteraction = 3 then begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; end; @@ -53,14 +53,14 @@ begin SDLK_RIGHT: begin if (SelInteraction >= 0) and (SelInteraction <= 2) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractInc; end; end; SDLK_LEFT: begin if (SelInteraction >= 0) and (SelInteraction <= 2) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 30a1f8f0..ee534781 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -92,13 +92,13 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - Music.PlayBack; + AudioPlayback.PlayBack; CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); end; SDLK_RETURN: begin - Music.PlayStart; + AudioPlayback.PlayStart; if DLLMan.Selected.LoadSong then begin //Select PartyMode ScreenSong diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index ab6bd733..714e0d99 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -63,7 +63,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenMain); end; @@ -113,7 +113,7 @@ begin //Start Party PartySession.StartNewParty(Rounds + 2); - Music.PlayStart; + AudioPlayback.PlayStart; //Go to Player Screen FadeTo(@ScreenPartyPlayer); end; @@ -125,7 +125,7 @@ begin SDLK_UP: InteractPrev; SDLK_RIGHT: begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractInc; //Change Playlist2 if Playlist is Changed @@ -140,7 +140,7 @@ begin end; SDLK_LEFT: begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractDec; //Change Playlist2 if Playlist is Changed diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index e6830ee6..24534599 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -184,7 +184,7 @@ begin SDLK_ESCAPE: begin Ini.SaveNames; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenPartyOptions); end; @@ -202,7 +202,7 @@ begin end; end; - Music.PlayStart; + AudioPlayback.PlayStart; FadeTo(@ScreenPartyNewRound); end; diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index 6333896c..6af835f2 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -57,7 +57,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - Music.PlayStart; + AudioPlayback.PlayStart; if (PartySession.CurRound < High(PartySession.Rounds)) then FadeTo(@ScreenPartyNewRound) else @@ -69,7 +69,7 @@ begin SDLK_RETURN: begin - Music.PlayStart; + AudioPlayback.PlayStart; if (PartySession.CurRound < High(PartySession.Rounds)) then FadeTo(@ScreenPartyNewRound) else diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas index fecca3d1..3c7ad921 100644 --- a/Game/Code/Screens/UScreenPartyWin.pas +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -50,13 +50,13 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - Music.PlayStart; + AudioPlayback.PlayStart; FadeTo(@ScreenMain); end; SDLK_RETURN: begin - Music.PlayStart; + AudioPlayback.PlayStart; FadeTo(@ScreenMain); end; end; diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 9e43f31f..e0c80297 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -146,7 +146,7 @@ begin //Sound[0].BufferLong Finish; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenScore); end; @@ -182,7 +182,7 @@ begin Paused := true; // pause Music - Music.Pause; + AudioPlayback.Pause; // pause Video if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then @@ -193,9 +193,9 @@ begin Czas.Teraz := PauseTime; //Position of Notes // Position of Music - Music.MoveTo (PauseTime); + AudioPlayback.MoveTo (PauseTime); // Play Music - Music.Play; + AudioPlayback.Play; // Video if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then @@ -451,14 +451,14 @@ begin // play music (I) - Music.CaptureStart; - Music.MoveTo(AktSong.Start); + AudioPlayback.CaptureStart; + AudioPlayback.MoveTo(AktSong.Start); // Music.Play; // prepare timer (I) // CountSkipTimeSet; Czas.Teraz := AktSong.Start; - Czas.Razem := Music.Length; + Czas.Razem := AudioPlayback.Length; if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000; Czas.OldBeat := -1; for P := 0 to High(Player) do @@ -871,7 +871,7 @@ begin end; // play music (II) - Music.Play; + AudioPlayback.Play; // prepare timer (II) CountSkipTimeSet; @@ -1147,7 +1147,7 @@ begin // check for music finish // Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(AktSong.Finish)); if ShowFinish then begin - if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + if (not AudioPlayback.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin //Pause Mod: if not Paused then Sing(Self); // analyze song @@ -1201,8 +1201,8 @@ end; procedure TScreenSing.Finish; begin - Music.CaptureStop; - Music.Stop; + AudioPlayback.CaptureStop; + AudioPlayback.Stop; if Ini.SavePlayback = 1 then begin Log.BenchmarkStart(0); diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index d18dd5bc..a05c6d4b 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -102,7 +102,7 @@ begin SDLK_BACKSPACE : begin Finish; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenPartyScore); end; @@ -170,7 +170,7 @@ begin end else //Start Without Song begin - Music.CaptureStart; + AudioPlayback.CaptureStart; end; //Set Playerinfo @@ -531,7 +531,7 @@ end; if ShowFinish then begin if DllMan.Selected.LoadSong then begin - if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + if (not AudioPlayback.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin //Pause Mod: if not Paused then Sing(Self); // analyze song @@ -658,12 +658,12 @@ end; function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound begin - Result := Music.LoadCustomSound(String(Name)); + Result := AudioPlayback.LoadCustomSound(String(Name)); end; procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound begin - Music.PlayCustomSound(Index); + AudioPlayback.PlayCustomSound(Index); end; end. diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 0bf411c1..df4ec87a 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -265,7 +265,7 @@ begin begin SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - Music.PlayChange; + AudioPlayback.PlayChange; ChangeMusic; SetScroll4; @@ -284,7 +284,7 @@ begin begin SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - Music.PlayChange; + AudioPlayback.PlayChange; ChangeMusic; SetScroll4; @@ -326,7 +326,7 @@ begin Interaction := I - 1; //Stop Music - Music.Stop; + AudioPlayback.Stop; CatSongs.ShowCategoryList; @@ -361,8 +361,8 @@ begin end else begin - Music.Stop; - Music.PlayBack; + AudioPlayback.Stop; + AudioPlayback.PlayBack; FadeTo(@ScreenMain); end; @@ -372,7 +372,7 @@ begin //When in party Mode then Ask before Close else if (Mode = 1) then begin - Music.PlayBack; + AudioPlayback.PlayBack; CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); end; end; @@ -495,7 +495,7 @@ begin FixSelected; //Play Music: - Music.PlayChange; + AudioPlayback.PlayChange; ChangeMusic; end; @@ -538,7 +538,7 @@ begin FixSelected; //Play Music: - Music.PlayChange; + AudioPlayback.PlayChange; ChangeMusic; end; end; @@ -548,8 +548,9 @@ begin SDLK_RIGHT: begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin - Music.PlayChange; + if (Length(Songs.Song) > 0) AND (Mode = 0) then + begin + AudioPlayback.PlayChange; SelectNext; // InteractNext; // SongTarget := Interaction; @@ -563,7 +564,7 @@ begin SDLK_LEFT: begin if (Length(Songs.Song) > 0)AND (Mode = 0) then begin - Music.PlayChange; + AudioPlayback.PlayChange; SelectPrev; ChangeMusic; SetScroll4; @@ -643,9 +644,9 @@ begin end else //Random in one Category begin - SkipTo(Random(CatSongs.VisibleSongs)); + SkipTo(Random(CatSongs.VisibleSongs)); end; - Music.PlayChange; + AudioPlayback.PlayChange; ChangeMusic; SetScroll4; @@ -1410,7 +1411,7 @@ end; procedure TScreenSong.onShow; begin - Music.Stop; + AudioPlayback.Stop; if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; if Ini.Players = 4 then PlayersPlay := 6; @@ -1429,13 +1430,13 @@ begin //Load Music only when Song Preview is activated if (Ini.PreviewVolume <> 0) then begin - Music.SetLoop(false); - Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); - Music.MoveTo(Music.Length / 4); - Music.Play; + AudioPlayback.SetLoop(false); + AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + AudioPlayback.MoveTo(AudioPlayback.Length / 4); + AudioPlayback.Play; //Set Preview Volume - Music.SetMusicVolume (Ini.PreviewVolume * 10); + AudioPlayback.SetMusicVolume (Ini.PreviewVolume * 10); {//if Music Fade is activated, Set Volume to 0 % if (Ini.PreviewFading <> 0) then Music.SetMusicVolume(0);} @@ -1478,15 +1479,15 @@ procedure TScreenSong.onHide; begin //When Music Fading is activated, Turn Music to 100 % If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then - Music.SetMusicVolume(100); + AudioPlayback.SetMusicVolume(100); //If Preview is deactivated: Load MUsicfile now If (Ini.PreviewVolume = 0) then - Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); //When hide then Stop Music (For Party Mode Popup on Exit) - if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then - Music.Stop; + if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (AudioPlayback <> nil) then + AudioPlayback.Stop; end; procedure TScreenSong.DrawExtensions; @@ -1546,13 +1547,13 @@ begin begin //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then - Music.Play; + AudioPlayback.Play; //Update Song Volume if (CoverTime < Ini.PreviewFading) then - Music.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) + AudioPlayback.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) else - Music.SetMusicVolume(Ini.PreviewVolume * 10); + AudioPlayback.SetMusicVolume(Ini.PreviewVolume * 10); end; @@ -1673,18 +1674,18 @@ begin begin if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then begin - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); + AudioPlayback.Close; + if AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + AudioPlayback.MoveTo(AudioPlayback.Length / 4); //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal if (Ini.PreviewFading = 0) then - Music.Play + AudioPlayback.Play else - Music.SetMusicVolume(0); + AudioPlayback.SetMusicVolume(0); end; end else - Music.Stop; + AudioPlayback.Stop; end; end; @@ -1715,7 +1716,7 @@ var lTmp : double; begin -if (not Music.Finished) AND (Theme.Song.Equalizer.Length > 0) then +if (not AudioPlayback.Finished) AND (Theme.Song.Equalizer.Length > 0) then begin @@ -1724,7 +1725,7 @@ begin if (A <> EqualizerTime) then begin EqualizerTime := A; - Data := Music.GetFFTData; + Data := AudioPlayback.GetFFTData; B:=0; Pos := 0; @@ -1890,7 +1891,7 @@ begin end; end; - Music.PlayChange; + AudioPlayback.PlayChange; ChangeMusic; SetScroll; UpdateLCD; @@ -2003,7 +2004,7 @@ end; procedure TScreenSong.StartSong; begin CatSongs.Selected := Interaction; - Music.Stop; + AudioPlayback.Stop; //Party Mode if (Mode = 1) then begin @@ -2018,7 +2019,7 @@ end; procedure TScreenSong.SelectPlayers; begin CatSongs.Selected := Interaction; - Music.Stop; + AudioPlayback.Stop; ScreenName.Goto_SingScreen := True; FadeTo(@ScreenName); @@ -2026,9 +2027,10 @@ end; procedure TScreenSong.OpenEditor; begin - if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin - Music.Stop; - Music.PlayStart; + if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then + begin + AudioPlayback.Stop; + AudioPlayback.PlayStart; ScreenEditSub.Path := CatSongs.Song[Interaction].Path; ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName; FadeTo(@ScreenEditSub); diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 48d23468..de78665e 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -65,7 +65,7 @@ begin SDLK_ESCAPE: begin Visible := False; - Music.PlayBack; + AudioPlayback.PlayBack; if (VisSongs = 0) AND (Length(Button[0].Text[0].Text) > 0) then begin ScreenSong.UnLoadDetailedCover; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index ce331e2f..c6e16f60 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -94,7 +94,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - Music.PlayBack; + AudioPlayback.PlayBack; Visible := False; end; diff --git a/Game/Code/Screens/UScreenStatDetail.pas b/Game/Code/Screens/UScreenStatDetail.pas index 9dc6c525..1310b127 100644 --- a/Game/Code/Screens/UScreenStatDetail.pas +++ b/Game/Code/Screens/UScreenStatDetail.pas @@ -51,7 +51,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenStatMain); end; SDLK_RETURN: @@ -74,7 +74,7 @@ begin end; if Interaction = 3 then begin - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenStatMain); end; end; 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; diff --git a/Game/Code/USDXResCompiler.exe b/Game/Code/USDXResCompiler.exe index 6b0137be..b18e11a9 100644 Binary files a/Game/Code/USDXResCompiler.exe and b/Game/Code/USDXResCompiler.exe differ diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index ed58e97f..239984b5 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -4,50 +4,32 @@ program UltraStar; {$I switches.inc} uses - //------------------------------ - //Includes - 3rd Party Libraries - //------------------------------ - SDL in 'lib\JEDI-SDLv1.0\SDL\Pas\SDL.pas', + SDL in 'lib\JEDI-SDLv1.0\SDL\Pas\SDL.pas', moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', - sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', - sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', - OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas', - sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', - - bass in 'lib\bass\delphi\bass.pas', - - PNGImage in 'lib\PNGImage\PNGImage.pas', - PNGzLib in 'lib\PNGImage\PNGzLib.pas', - pnglang in 'lib\PNGImage\pnglang.pas', - - midiout in 'lib\midi\midiout.pas', - midiin in 'lib\midi\midiin.pas', - Circbuf in 'lib\midi\CIRCBUF.PAS', - MidiType in 'lib\midi\MidiType.PAS', - MidiDefs in 'lib\midi\MidiDefs.PAS', - MidiCons in 'lib\midi\MidiCons.PAS', - MidiFile in 'lib\midi\MidiFile.PAS', - Delphmcb in 'lib\midi\Delphmcb.PAS', - - {$IFDEF UseSerialPort} - zlportio in 'lib\zlportio\zlportio.pas', - ddkint in 'lib\zlportio\ddkint.pas', - {$ENDIF} - - avcodec in 'lib\ffmpeg\avcodec.pas', - avformat in 'lib\ffmpeg\avformat.pas', - avutil in 'lib\ffmpeg\avutil.pas', - rational in 'lib\ffmpeg\rational.pas', - opt in 'lib\ffmpeg\opt.pas', - avio in 'lib\ffmpeg\avio.pas', - + sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', + sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', + OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas', + sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', + bass in 'lib\bass\delphi\bass.pas', + PNGImage in 'lib\PNGImage\PNGImage.pas', + PNGzLib in 'lib\PNGImage\PNGzLib.pas', + pnglang in 'lib\PNGImage\pnglang.pas', + midiout in 'lib\midi\midiout.pas', + midiin in 'lib\midi\midiin.pas', + CIRCBUF in 'lib\midi\CIRCBUF.PAS', + MidiType in 'lib\midi\MidiType.PAS', + MidiDefs in 'lib\midi\MidiDefs.PAS', + MidiCons in 'lib\midi\MidiCons.PAS', + MidiFile in 'lib\midi\MidiFile.PAS', + Delphmcb in 'lib\midi\Delphmcb.PAS', + avcodec in 'lib\ffmpeg\avcodec.pas', + avformat in 'lib\ffmpeg\avformat.pas', + avutil in 'lib\ffmpeg\avutil.pas', + rational in 'lib\ffmpeg\rational.pas', + opt in 'lib\ffmpeg\opt.pas', + avio in 'lib\ffmpeg\avio.pas', SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', - SQLite3 in 'lib\SQLite\SQLite3.pas', - - - //------------------------------ - //Includes - Menu System - //------------------------------ + SQLite3 in 'lib\SQLite\SQLite3.pas', UDisplay in 'Menu\UDisplay.pas', UMenu in 'Menu\UMenu.pas', UMenuStatic in 'Menu\UMenuStatic.pas', @@ -58,14 +40,11 @@ uses UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', UDrawTexture in 'Menu\UDrawTexture.pas', UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', - - //------------------------------ - //Includes - Classes - //------------------------------ UCommon in 'Classes\UCommon.pas', UGraphic in 'Classes\UGraphic.pas', UTexture in 'Classes\UTexture.pas', UMusic in 'Classes\UMusic.pas', + UMusic_BASS in 'Classes\UMusic_BASS.pas', ULanguage in 'Classes\ULanguage.pas', UMain in 'Classes\UMain.pas', UDraw in 'Classes\UDraw.pas', @@ -90,27 +69,17 @@ uses UDLLManager in 'Classes\UDLLManager.pas', UParty in 'Classes\UParty.pas', UPlaylist in 'Classes\UPlaylist.pas', - UCommandLine in 'Classes\UCommandLine.pas', + UCommandLine in 'Classes\UCommandLine.pas', UTextClasses in 'Classes\UTextClasses.pas', USingScores in 'Classes\USingScores.pas', USingNotes in 'Classes\USingNotes.pas', - - //New Plugin and Core Management - UModules in 'Classes\UModules.pas', //This Unit contains a const with the Modules to Load - UHooks in 'Classes\UHooks.pas', //Class for Hook Management //Write Freeing Methods for Both - UServices in 'Classes\UServices.pas', //95% - One Hack to remove ;) - UCore in 'Classes\UCore.pas', //30 % - Many Classes needs Rewriting or Manipulation + UModules in 'Classes\UModules.pas', + UHooks in 'Classes\UHooks.pas', + UServices in 'Classes\UServices.pas', + UCore in 'Classes\UCore.pas', UCoreModule in 'Classes\UCoreModule.pas', - UPluginInterface in 'Classes\UPluginInterface.pas', //Some changes to work with unwriten classes, need to be done - - //------------------------------ - //Includes - Video Support - //------------------------------ + UPluginInterface in 'Classes\UPluginInterface.pas', UVideo in 'Classes\UVideo.pas', - - //------------------------------ - //Includes - Screens - //------------------------------ UScreenLoading in 'Screens\UScreenLoading.pas', UScreenWelcome in 'Screens\UScreenWelcome.pas', UScreenMain in 'Screens\UScreenMain.pas', @@ -139,26 +108,14 @@ uses UScreenStatDetail in 'Screens\UScreenStatDetail.pas', UScreenCredits in 'Screens\UScreenCredits.pas', UScreenPopup in 'Screens\UScreenPopup.pas', - - //------------------------------ - //Includes - Screens PartyMode - //------------------------------ UScreenSingModi in 'Screens\UScreenSingModi.pas', UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', UScreenPartyScore in 'Screens\UScreenPartyScore.pas', UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', UScreenPartyWin in 'Screens\UScreenPartyWin.pas', - - //------------------------------ - //Includes - Modi SDK - //------------------------------ ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', - UPluginDefs in '..\..\Modis\SDK\UPluginDefs.pas', //New Plugin SDK - - //------------------------------ - //Includes - Delphi - //------------------------------ + UPluginDefs in '..\..\Modis\SDK\UPluginDefs.pas', Windows, SysUtils; @@ -335,8 +292,7 @@ begin // Sound Log.BenchmarkStart(1); Log.LogStatus('Initialize Sound', 'Initialization'); - Log.LogStatus('Creating Music', 'InitializeSound'); Music := TMusic.Create; - InitializeSound; + Log.LogStatus('Creating Music', 'InitializeSound'); InitializeSound(); Log.BenchmarkEnd(1); Log.LogBenchmark('Initializing Sound', 1); diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index 4e5deb2d..578271c0 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -4,7 +4,7 @@ {$UNDEF UseSerialPort} {$UNDEF UseMIDIPort} {$ELSE} - {$DEFINE UseSerialPort} + {$UNDEF UseSerialPort} {$DEFINE UseMIDIPort} {$ENDIF} @@ -15,4 +15,5 @@ {$ENDIF} {$ELSE} {$UNDEF UseBASS} -{$ENDIF} \ No newline at end of file +{$ENDIF} + -- cgit v1.2.3 From 6292440f6da3c11e85bb9fc3a741a26540e429be Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 11 Oct 2007 12:12:37 +0000 Subject: separated IAudioPlayback in to separate "Playback" and "Input" Interfaces ( both interfaces provided by same TMusic_Bass class... git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@505 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMusic.pas | 39 +++++++++++++++++++++++++++-------- Game/Code/Classes/UMusic_BASS.pas | 2 +- Game/Code/Screens/UScreenCredits.pas | 2 +- Game/Code/Screens/UScreenSing.pas | 4 ++-- Game/Code/Screens/UScreenSingModi.pas | 2 +- Game/Code/Screens/UScreenSong.pas | 2 +- 6 files changed, 36 insertions(+), 15 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index 934e14e3..a2620607 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -96,7 +96,6 @@ type type IAudioPlayback = Interface procedure InitializePlayback; - procedure InitializeRecord; procedure SetVolume(Volume: integer); procedure SetMusicVolume(Volume: integer); procedure SetLoop(Enabled: boolean); @@ -121,18 +120,25 @@ type procedure PlayClap; procedure PlayShuffle; procedure StopShuffle; + + function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; + + //Custom Sounds + function LoadCustomSound(const Filename: String): Cardinal; + procedure PlayCustomSound(const Index: Cardinal ); + end; + + IAudioInput = Interface + procedure InitializeRecord; + procedure CaptureStart; procedure CaptureStop; + procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); procedure StopCard(Card: byte); - function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; //Equalizer function GetFFTData: TFFTData; - - //Custom Sounds - function LoadCustomSound(const Filename: String): Cardinal; - procedure PlayCustomSound(const Index: Cardinal ); end; @@ -147,8 +153,11 @@ var // TODO : JB --- THESE SHOULD NOT BE GLOBAL Czas: TCzas; -procedure InitializeSound; +procedure InitializeSound; + function AudioPlayback(): IAudioPlayback; +function AudioInput(): IAudioInput; + implementation @@ -158,25 +167,37 @@ uses var singleton_AudioPlayback : IAudioPlayback; + singleton_AudioInput : IAudioInput; function AudioPlayback(): IAudioPlayback; begin if singleton_AudioPlayback = nil then begin writeln( 'Created AudioPlayback' ); - singleton_AudioPlayback := TMusic_bass.create(); + singleton_AudioPlayback := TMusic_bass.create(); // Yes we could do this with one instance of TMusic_Bass... but I cant be bothered at this point:P end; result := singleton_AudioPlayback; end; +function AudioInput(): IAudioInput; +begin + if singleton_AudioInput = nil then + begin + writeln( 'Created AudioInput' ); + singleton_AudioInput := TMusic_bass.create(); // Yes we could do this with one instance of TMusic_Bass... but I cant be bothered at this point:P + end; + + result := singleton_AudioInput; +end; + procedure InitializeSound; begin Log.LogStatus('Initializing Playback', 'InitializeSound'); AudioPlayback.InitializePlayback; Log.LogStatus('Initializing Record', 'InitializeSound'); - AudioPlayback.InitializeRecord; + AudioInput.InitializeRecord; end; end. diff --git a/Game/Code/Classes/UMusic_BASS.pas b/Game/Code/Classes/UMusic_BASS.pas index dfb6f79c..7de2d781 100644 --- a/Game/Code/Classes/UMusic_BASS.pas +++ b/Game/Code/Classes/UMusic_BASS.pas @@ -32,7 +32,7 @@ uses Classes, type - TMusic_bass = class( TInterfacedObject, IAudioPlayback ) + TMusic_bass = class( TInterfacedObject, IAudioPlayback, IAudioInput ) private BassStart: hStream; // Wait, I've replaced this with BASS BassBack: hStream; // It has almost all features we need diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index b7d6d3e7..a24997d4 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -445,7 +445,7 @@ const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),( begin //dis does teh muiwk y0r - Data := AudioPlayback.GetFFTData; + Data := AudioInput.GetFFTData; Log.LogStatus('',' JB-1'); diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index e0c80297..abb2726e 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -451,7 +451,7 @@ begin // play music (I) - AudioPlayback.CaptureStart; + AudioInput.CaptureStart; AudioPlayback.MoveTo(AktSong.Start); // Music.Play; @@ -1201,7 +1201,7 @@ end; procedure TScreenSing.Finish; begin - AudioPlayback.CaptureStop; + AudioInput.CaptureStop; AudioPlayback.Stop; if Ini.SavePlayback = 1 then begin diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index a05c6d4b..b6989c76 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -170,7 +170,7 @@ begin end else //Start Without Song begin - AudioPlayback.CaptureStart; + AudioInput.CaptureStart; end; //Set Playerinfo diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index df4ec87a..ea1dd8a5 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1725,7 +1725,7 @@ begin if (A <> EqualizerTime) then begin EqualizerTime := A; - Data := AudioPlayback.GetFFTData; + Data := AudioInput.GetFFTData; B:=0; Pos := 0; -- cgit v1.2.3 From df37a6a52ea5b1856e9e0e4d924a859f3fa472e1 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 11 Oct 2007 13:32:43 +0000 Subject: added UAudio_FFMpeg.pas as placeholder... ( Still has bass code in it.. needs to be replaced with ffmpeg code ) UMusic ( And UAudio* ) files, now have proper IAudioPlayback and IAudioInput Interface enumeration. simply having the unit in the uses clause will make it available. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@506 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudio_FFMpeg.pas | 634 ++++++++++++++++++++++++++++++++ Game/Code/Classes/UAudio_bass.pas | 637 ++++++++++++++++++++++++++++++++ Game/Code/Classes/UMusic.pas | 87 ++++- Game/Code/Classes/UMusic_BASS.pas | 703 ------------------------------------ Game/Code/UltraStar.dpr | 11 +- 5 files changed, 1345 insertions(+), 727 deletions(-) create mode 100644 Game/Code/Classes/UAudio_FFMpeg.pas create mode 100644 Game/Code/Classes/UAudio_bass.pas delete mode 100644 Game/Code/Classes/UMusic_BASS.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudio_FFMpeg.pas b/Game/Code/Classes/UAudio_FFMpeg.pas new file mode 100644 index 00000000..2a3c5cb5 --- /dev/null +++ b/Game/Code/Classes/UAudio_FFMpeg.pas @@ -0,0 +1,634 @@ +unit UAudio_FFMpeg; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + + +uses Classes, + {$IFDEF win32} + windows, + {$ENDIF} + Messages, + SysUtils, + {$IFNDEF FPC} + Forms, + {$ENDIF} + + bass, + ULog, + UMusic; + +implementation + +uses + {$IFDEF FPC} + lclintf, + {$ENDIF} + URecord, + UIni, + UMain, + UThemes; + +const + RecordSystem = 1; + +type + TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, + mpPaused, mpOpen); + +const + ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); + +type + TAudio_ffMpeg = class( TInterfacedObject, IAudioPlayback ) + private + BassStart: hStream; // Wait, I've replaced this with BASS + BassBack: hStream; // It has almost all features we need + BassSwoosh: hStream; + BassChange: hStream; // Almost? It aleady has them all :) + BassOption: hStream; + BassClick: hStream; + BassDrum: hStream; + BassHihat: hStream; + BassClap: hStream; + BassShuffle: hStream; + + //Custom Sounds + CustomSounds: array of TCustomSoundEntry; + Loaded: boolean; + Loop: boolean; + fHWND: THandle; + + public + Bass: hStream; + function GetName: String; + procedure InitializePlayback; + procedure InitializeRecord; + procedure SetVolume(Volume: integer); + procedure SetMusicVolume(Volume: integer); + procedure SetLoop(Enabled: boolean); + function Open(Name: string): boolean; // true if succeed + procedure Rewind; + procedure MoveTo(Time: real); + procedure Play; + procedure Pause; //Pause Mod + procedure Stop; + procedure Close; + function Finished: boolean; + function Length: real; + function Position: real; + procedure PlayStart; + procedure PlayBack; + procedure PlaySwoosh; + procedure PlayChange; + procedure PlayOption; + procedure PlayClick; + procedure PlayDrum; + procedure PlayHihat; + procedure PlayClap; + procedure PlayShuffle; + procedure StopShuffle; + procedure CaptureStart; + procedure CaptureStop; + procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); + procedure StopCard(Card: byte); + function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; + + //Equalizer + function GetFFTData: TFFTData; + + //Custom Sounds + function LoadCustomSound(const Filename: String): Cardinal; + procedure PlayCustomSound(const Index: Cardinal ); +end; + +var + singleton_MusicFFMpeg : IAudioPlayback; + +function TAudio_ffMpeg.GetName: String; +begin + result := 'FFMpeg'; +end; + +procedure TAudio_ffMpeg.InitializePlayback; +var + Pet: integer; + S: integer; +begin + Log.BenchmarkStart(4); + Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); + + Loaded := false; + Loop := false; + + {$ifdef win32} + // TODO : JB_Linux ... is this needed ? :) + fHWND := AllocateHWND( nil); // TODO : JB_lazarus - can we do something different here ?? lazarus didnt like this function + {$ENDIF} + + // TODO : jb_linux replace with something other than bass + if not BASS_Init(1, 44100, 0, fHWND, nil) then + begin + {$IFNDEF FPC} + // TODO : JB_linux find a way to do this nice.. + Application.MessageBox ('Could not initialize BASS', 'Error'); + {$ENDIF} + Exit; + end; + + Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); + + // config playing buffer +// BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); +// BASS_SetConfig(BASS_CONFIG_BUFFER, 100); + + Log.LogStatus('Loading Sounds', 'Music Initialize'); + + Log.BenchmarkStart(4); + LoadSoundFromFile(BassStart, SoundPath + 'Common Start.mp3'); + LoadSoundFromFile(BassBack, SoundPath + 'Common Back.mp3'); + LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3'); + LoadSoundFromFile(BassChange, SoundPath + 'select music change music 50.mp3'); + LoadSoundFromFile(BassOption, SoundPath + 'option change col.mp3'); + LoadSoundFromFile(BassClick, SoundPath + 'rimshot022b.mp3'); + +// LoadSoundFromFile(BassDrum, SoundPath + 'bassdrumhard076b.mp3'); +// LoadSoundFromFile(BassHihat, SoundPath + 'hihatclosed068b.mp3'); +// LoadSoundFromFile(BassClap, SoundPath + 'claps050b.mp3'); + +// LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3'); + + Log.BenchmarkEnd(4); + Log.LogBenchmark('--> Loading Sounds', 4); +end; + +procedure TAudio_ffMpeg.InitializeRecord; +var + S: integer; + device: integer; + descr: string; + input: integer; + input2: integer; + flags: integer; + mic: array[0..15] of integer; + SC: integer; // soundcard + SCI: integer; // soundcard input +begin + if RecordSystem = 1 then begin + SetLength(Sound, 6 {max players});//Ini.Players+1); + for S := 0 to High(Sound) do begin //Ini.Players do begin + Sound[S] := TSound.Create; + Sound[S].Num := S; + Sound[S].BufferNew := TMemoryStream.Create; + SetLength(Sound[S].BufferLong, 1); + Sound[S].BufferLong[0] := TMemoryStream.Create; + Sound[S].n := 4*1024; + end; + + + // check for recording devices; + {device := 0; + descr := BASS_RecordGetDeviceDescription(device); + + SetLength(SoundCard, 0); + while (descr <> '') do begin + SC := High(SoundCard) + 1; + SetLength(SoundCard, SC+1); + + Log.LogAnalyze('Device #'+IntToStr(device)+': '+ descr); + SoundCard[SC].Description := Descr; + + // check for recording inputs + mic[device] := -1; // default to no change + input := 0; + BASS_RecordInit(device); + Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); + flags := BASS_RecordGetInput(input); + + SetLength(SoundCard[SC].Input, 0); + while (flags <> -1) do begin + SCI := High(SoundCard[SC].Input) + 1; + SetLength(SoundCard[SC].Input, SCI+1); + + Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); + SoundCard[SC].Input[SCI].Name := BASS_RecordGetInputName(Input); + + if (flags and BASS_INPUT_TYPE_MASK) = BASS_INPUT_TYPE_MIC then begin + mic[device] := input; // auto set microphone + end; + Inc(Input); + flags := BASS_RecordGetInput(input); + end; + + if mic[device] <> -1 then begin + Log.LogAnalyze('Found the mic at input ' + IntToStr(Mic[device])) + end else begin + Log.LogAnalyze('Mic not found'); + mic[device] := 0; // setting to the first one (for kxproject) + end; + SoundCard[SC].InputSeleceted := Mic[Device]; + + + BASS_RecordFree; + + inc(Device); + descr := BASS_RecordGetDeviceDescription(Device); + end; // while} + end; // if +end; + +procedure TAudio_ffMpeg.SetVolume(Volume: integer); +begin + //Old Sets Wave Volume + //BASS_SetVolume(Volume); + //New: Sets Volume only for this Application + + + // TODO : jb_linux replace with something other than bass + BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); +end; + +procedure TAudio_ffMpeg.SetMusicVolume(Volume: Integer); +begin + //Max Volume Prevention + if Volume > 100 then + Volume := 100; + + if Volume < 0 then + Volume := 0; + + + //Set Volume + // TODO : jb_linux replace with something other than bass + BASS_ChannelSetAttributes (Bass, -1, Volume, -101); +end; + +procedure TAudio_ffMpeg.SetLoop(Enabled: boolean); +begin + Loop := Enabled; +end; + +function TAudio_ffMpeg.Open(Name: string): boolean; +begin + Loaded := false; + if FileExists(Name) then + begin + // TODO : jb_linux replace with something other than bass + Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); + + Loaded := true; + //Set Max Volume + SetMusicVolume (100); + end; + + Result := Loaded; +end; + +procedure TAudio_ffMpeg.Rewind; +begin + if Loaded then begin + end; +end; + +procedure TAudio_ffMpeg.MoveTo(Time: real); +var + bytes: integer; +begin + // TODO : jb_linux replace with something other than bass + bytes := BASS_ChannelSeconds2Bytes(Bass, Time); + BASS_ChannelSetPosition(Bass, bytes); +end; + +procedure TAudio_ffMpeg.Play; +begin + // TODO : jb_linux replace with something other than bass + if Loaded then + begin + if Loop then + BASS_ChannelPlay(Bass, True); // start from beginning... actually bass itself does not loop, nor does this TAudio_ffMpeg Class + + BASS_ChannelPlay(Bass, False); // for setting position before playing + end; +end; + +procedure TAudio_ffMpeg.Pause; //Pause Mod +begin + // TODO : jb_linux replace with something other than bass + if Loaded then begin + BASS_ChannelPause(Bass); // Pauses Song + end; +end; + +procedure TAudio_ffMpeg.Stop; +begin + // TODO : jb_linux replace with something other than bass + Bass_ChannelStop(Bass); +end; + +procedure TAudio_ffMpeg.Close; +begin + // TODO : jb_linux replace with something other than bass + Bass_StreamFree(Bass); +end; + +function TAudio_ffMpeg.Length: real; +var + bytes: integer; +begin + Result := 60; + + // TODO : jb_linux replace with something other than bass + bytes := BASS_ChannelGetLength(Bass); + Result := BASS_ChannelBytes2Seconds(Bass, bytes); +end; + +function TAudio_ffMpeg.Position: real; +var + bytes: integer; +begin + Result := 0; + + // TODO : jb_linux replace with something other than bass + bytes := BASS_ChannelGetPosition(BASS); + Result := BASS_ChannelBytes2Seconds(BASS, bytes); +end; + +function TAudio_ffMpeg.Finished: boolean; +begin + Result := false; + + // TODO : jb_linux replace with something other than bass + if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then + begin + Result := true; + end; +end; + +procedure TAudio_ffMpeg.PlayStart; +begin + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassStart, True); +end; + +procedure TAudio_ffMpeg.PlayBack; +begin + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassBack, True);// then +end; + +procedure TAudio_ffMpeg.PlaySwoosh; +begin + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassSwoosh, True); +end; + +procedure TAudio_ffMpeg.PlayChange; +begin + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassChange, True); +end; + +procedure TAudio_ffMpeg.PlayOption; +begin + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassOption, True); +end; + +procedure TAudio_ffMpeg.PlayClick; +begin + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassClick, True); +end; + +procedure TAudio_ffMpeg.PlayDrum; +begin + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassDrum, True); +end; + +procedure TAudio_ffMpeg.PlayHihat; +begin + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassHihat, True); +end; + +procedure TAudio_ffMpeg.PlayClap; +begin + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassClap, True); +end; + +procedure TAudio_ffMpeg.PlayShuffle; +begin + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassShuffle, True); +end; + +procedure TAudio_ffMpeg.StopShuffle; +begin + // TODO : jb_linux replace with something other than bass + BASS_ChannelStop(BassShuffle); +end; + +procedure TAudio_ffMpeg.CaptureStart; +var + S: integer; + SC: integer; + P1: integer; + P2: integer; +begin + for S := 0 to High(Sound) do + Sound[S].BufferLong[0].Clear; + + for SC := 0 to High(Ini.CardList) do begin + P1 := Ini.CardList[SC].ChannelL; + P2 := Ini.CardList[SC].ChannelR; + if P1 > PlayersPlay then P1 := 0; + if P2 > PlayersPlay then P2 := 0; + if (P1 > 0) or (P2 > 0) then + CaptureCard(SC, P1, P2); + end; +end; + +procedure TAudio_ffMpeg.CaptureStop; +var + SC: integer; + P1: integer; + P2: integer; +begin + + for SC := 0 to High(Ini.CardList) do begin + P1 := Ini.CardList[SC].ChannelL; + P2 := Ini.CardList[SC].ChannelR; + if P1 > PlayersPlay then P1 := 0; + if P2 > PlayersPlay then P2 := 0; + if (P1 > 0) or (P2 > 0) then StopCard(SC); + end; + +end; + +//procedure TAudio_ffMpeg.CaptureCard(RecordI, SoundNum, PlayerLeft, PlayerRight: byte); +procedure TAudio_ffMpeg.CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); +var + Error: integer; + ErrorMsg: string; +begin + if not BASS_RecordInit(RecordI) then + begin + Error := BASS_ErrorGetCode; + + ErrorMsg := IntToStr(Error); + if Error = BASS_ERROR_DX then ErrorMsg := 'No DX5'; + if Error = BASS_ERROR_ALREADY then ErrorMsg := 'The device has already been initialized'; + if Error = BASS_ERROR_DEVICE then ErrorMsg := 'The device number specified is invalid'; + if Error = BASS_ERROR_DRIVER then ErrorMsg := 'There is no available device driver'; + + {Log.LogAnalyze('Error initializing record [' + IntToStr(RecordI) + ', ' + + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' + + ErrorMsg);} + Log.LogError('Error initializing record [' + IntToStr(RecordI) + ', ' + + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' + + ErrorMsg); + Log.LogError('Music -> CaptureCard: Error initializing record: ' + ErrorMsg); + + + end + else + begin + Recording.SoundCard[RecordI].BassRecordStream := BASS_RecordStart(44100, 2, MakeLong(0, 20) , @GetMicrophone, PlayerLeft + PlayerRight*256); + end; +end; + +procedure TAudio_ffMpeg.StopCard(Card: byte); +begin + // TODO : jb_linux replace with something other than bass + BASS_RecordSetDevice(Card); + BASS_RecordFree; +end; + +function TAudio_ffMpeg.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; +var + L: Integer; +begin + if FileExists(Name) then + begin + Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); + try + // TODO : jb_linux replace with something other than bass + hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); + + //Add CustomSound + L := High(CustomSounds) + 1; + SetLength (CustomSounds, L + 1); + CustomSounds[L].Filename := Name; + CustomSounds[L].Handle := hStream; + except + Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); + end; + end + else + begin + Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); + exit; + end; +end; + +//Equalizer +function TAudio_ffMpeg.GetFFTData: TFFTData; +var + Data: TFFTData; +begin + //Get Channel Data Mono and 256 Values + BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); +end; + +function TAudio_ffMpeg.LoadCustomSound(const Filename: String): Cardinal; +var + S: hStream; + I: Integer; + F: String; +begin + //Search for Sound in already loaded Sounds + F := UpperCase(SoundPath + FileName); + For I := 0 to High(CustomSounds) do + begin + if (UpperCase(CustomSounds[I].Filename) = F) then + begin + Result := I; + Exit; + end; + end; + + if LoadSoundFromFile(S, SoundPath + Filename) then + Result := High(CustomSounds) + else + Result := 0; +end; + +procedure TAudio_ffMpeg.PlayCustomSound(const Index: Cardinal ); +begin + if Index <= High(CustomSounds) then + BASS_ChannelPlay(CustomSounds[Index].Handle, True); +end; + + +{* + +Sorry guys... this is my mess :( +Im going to try and get ffmpeg to handle audio playback ( at least for linux ) +and Im going to implement it nicly along side BASS, in TAudio_ffMpeg ( where I can ) + +http://www.dranger.com/ffmpeg/ffmpeg.html +http://www.dranger.com/ffmpeg/ffmpegtutorial_all.html + +http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html + +*} +{* +function TAudio_ffMpeg.FFMPeg_StreamCreateFile(abool : boolean; aFileName : pchar ): THandle; +var + lFormatCtx : PAVFormatContext; +begin + +(* + if(SDL_OpenAudio(&wanted_spec, &spec) < 0) + begin + fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError()); + writeln( 'SDL_OpenAudio' ); + exit; + end; +*) + +(* + if ( av_open_input_file( lFormatCtx, aFileName, NULL, 0, NULL ) <> 0 ) + begin + writeln( 'Unable to open file '+ aFileName ); + exit; + end; + + // Retrieve stream information + if ( av_find_stream_info(pFormatCtx) < 0 ) + begin + writeln( 'Unable to Retrieve stream information' ); + exit; + end; +*) + +end; *} + +initialization + singleton_MusicFFMpeg := TAudio_ffMpeg.create(); + + writeln( 'UAudio_Bass - Register Playback' ); + AudioManager.add( IAudioPlayback( singleton_MusicFFMpeg ) ); + +finalization + AudioManager.Remove( IAudioPlayback( singleton_MusicFFMpeg ) ); + + +end. diff --git a/Game/Code/Classes/UAudio_bass.pas b/Game/Code/Classes/UAudio_bass.pas new file mode 100644 index 00000000..cbeadc47 --- /dev/null +++ b/Game/Code/Classes/UAudio_bass.pas @@ -0,0 +1,637 @@ +unit UAudio_bass; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + + +uses Classes, + {$IFDEF win32} + windows, + {$ENDIF} + Messages, + SysUtils, + {$IFNDEF FPC} + Forms, + {$ENDIF} + + bass, + ULog, + UMusic; + +implementation + +uses + {$IFDEF FPC} + lclintf, + {$ENDIF} + URecord, + UIni, + UMain, + UThemes; + +const + RecordSystem = 1; + +type + TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, + mpPaused, mpOpen); + +const + ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); + +type + TAudio_bass = class( TInterfacedObject, IAudioPlayback, IAudioInput ) + private + BassStart: hStream; // Wait, I've replaced this with BASS + BassBack: hStream; // It has almost all features we need + BassSwoosh: hStream; + BassChange: hStream; // Almost? It aleady has them all :) + BassOption: hStream; + BassClick: hStream; + BassDrum: hStream; + BassHihat: hStream; + BassClap: hStream; + BassShuffle: hStream; + + //Custom Sounds + CustomSounds: array of TCustomSoundEntry; + Loaded: boolean; + Loop: boolean; + fHWND: THandle; + + public + Bass: hStream; + function GetName: String; + procedure InitializePlayback; + procedure InitializeRecord; + procedure SetVolume(Volume: integer); + procedure SetMusicVolume(Volume: integer); + procedure SetLoop(Enabled: boolean); + function Open(Name: string): boolean; // true if succeed + procedure Rewind; + procedure MoveTo(Time: real); + procedure Play; + procedure Pause; //Pause Mod + procedure Stop; + procedure Close; + function Finished: boolean; + function Length: real; + function Position: real; + procedure PlayStart; + procedure PlayBack; + procedure PlaySwoosh; + procedure PlayChange; + procedure PlayOption; + procedure PlayClick; + procedure PlayDrum; + procedure PlayHihat; + procedure PlayClap; + procedure PlayShuffle; + procedure StopShuffle; + procedure CaptureStart; + procedure CaptureStop; + procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); + procedure StopCard(Card: byte); + function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; + + //Equalizer + function GetFFTData: TFFTData; + + //Custom Sounds + function LoadCustomSound(const Filename: String): Cardinal; + procedure PlayCustomSound(const Index: Cardinal ); +end; + +var + singleton_MusicBass : IAudioPlayback; + +function TAudio_bass.GetName: String; +begin + result := 'BASS'; +end; + +procedure TAudio_bass.InitializePlayback; +var + Pet: integer; + S: integer; +begin + Log.BenchmarkStart(4); + Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); + + Loaded := false; + Loop := false; + + {$ifdef win32} + // TODO : JB_Linux ... is this needed ? :) + fHWND := AllocateHWND( nil); // TODO : JB_lazarus - can we do something different here ?? lazarus didnt like this function + {$ENDIF} + + // TODO : jb_linux replace with something other than bass + if not BASS_Init(1, 44100, 0, fHWND, nil) then + begin + {$IFNDEF FPC} + // TODO : JB_linux find a way to do this nice.. + Application.MessageBox ('Could not initialize BASS', 'Error'); + {$ENDIF} + Exit; + end; + + Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); + + // config playing buffer +// BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); +// BASS_SetConfig(BASS_CONFIG_BUFFER, 100); + + Log.LogStatus('Loading Sounds', 'Music Initialize'); + + Log.BenchmarkStart(4); + LoadSoundFromFile(BassStart, SoundPath + 'Common Start.mp3'); + LoadSoundFromFile(BassBack, SoundPath + 'Common Back.mp3'); + LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3'); + LoadSoundFromFile(BassChange, SoundPath + 'select music change music 50.mp3'); + LoadSoundFromFile(BassOption, SoundPath + 'option change col.mp3'); + LoadSoundFromFile(BassClick, SoundPath + 'rimshot022b.mp3'); + +// LoadSoundFromFile(BassDrum, SoundPath + 'bassdrumhard076b.mp3'); +// LoadSoundFromFile(BassHihat, SoundPath + 'hihatclosed068b.mp3'); +// LoadSoundFromFile(BassClap, SoundPath + 'claps050b.mp3'); + +// LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3'); + + Log.BenchmarkEnd(4); + Log.LogBenchmark('--> Loading Sounds', 4); +end; + +procedure TAudio_bass.InitializeRecord; +var + S: integer; + device: integer; + descr: string; + input: integer; + input2: integer; + flags: integer; + mic: array[0..15] of integer; + SC: integer; // soundcard + SCI: integer; // soundcard input +begin + if RecordSystem = 1 then begin + SetLength(Sound, 6 {max players});//Ini.Players+1); + for S := 0 to High(Sound) do begin //Ini.Players do begin + Sound[S] := TSound.Create; + Sound[S].Num := S; + Sound[S].BufferNew := TMemoryStream.Create; + SetLength(Sound[S].BufferLong, 1); + Sound[S].BufferLong[0] := TMemoryStream.Create; + Sound[S].n := 4*1024; + end; + + + // check for recording devices; + {device := 0; + descr := BASS_RecordGetDeviceDescription(device); + + SetLength(SoundCard, 0); + while (descr <> '') do begin + SC := High(SoundCard) + 1; + SetLength(SoundCard, SC+1); + + Log.LogAnalyze('Device #'+IntToStr(device)+': '+ descr); + SoundCard[SC].Description := Descr; + + // check for recording inputs + mic[device] := -1; // default to no change + input := 0; + BASS_RecordInit(device); + Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); + flags := BASS_RecordGetInput(input); + + SetLength(SoundCard[SC].Input, 0); + while (flags <> -1) do begin + SCI := High(SoundCard[SC].Input) + 1; + SetLength(SoundCard[SC].Input, SCI+1); + + Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); + SoundCard[SC].Input[SCI].Name := BASS_RecordGetInputName(Input); + + if (flags and BASS_INPUT_TYPE_MASK) = BASS_INPUT_TYPE_MIC then begin + mic[device] := input; // auto set microphone + end; + Inc(Input); + flags := BASS_RecordGetInput(input); + end; + + if mic[device] <> -1 then begin + Log.LogAnalyze('Found the mic at input ' + IntToStr(Mic[device])) + end else begin + Log.LogAnalyze('Mic not found'); + mic[device] := 0; // setting to the first one (for kxproject) + end; + SoundCard[SC].InputSeleceted := Mic[Device]; + + + BASS_RecordFree; + + inc(Device); + descr := BASS_RecordGetDeviceDescription(Device); + end; // while} + end; // if +end; + +procedure TAudio_bass.SetVolume(Volume: integer); +begin + //Old Sets Wave Volume + //BASS_SetVolume(Volume); + //New: Sets Volume only for this Application + + + // TODO : jb_linux replace with something other than bass + BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); +end; + +procedure TAudio_bass.SetMusicVolume(Volume: Integer); +begin + //Max Volume Prevention + if Volume > 100 then + Volume := 100; + + if Volume < 0 then + Volume := 0; + + + //Set Volume + // TODO : jb_linux replace with something other than bass + BASS_ChannelSetAttributes (Bass, -1, Volume, -101); +end; + +procedure TAudio_bass.SetLoop(Enabled: boolean); +begin + Loop := Enabled; +end; + +function TAudio_bass.Open(Name: string): boolean; +begin + Loaded := false; + if FileExists(Name) then + begin + // TODO : jb_linux replace with something other than bass + Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); + + Loaded := true; + //Set Max Volume + SetMusicVolume (100); + end; + + Result := Loaded; +end; + +procedure TAudio_bass.Rewind; +begin + if Loaded then begin + end; +end; + +procedure TAudio_bass.MoveTo(Time: real); +var + bytes: integer; +begin + // TODO : jb_linux replace with something other than bass + bytes := BASS_ChannelSeconds2Bytes(Bass, Time); + BASS_ChannelSetPosition(Bass, bytes); +end; + +procedure TAudio_bass.Play; +begin + // TODO : jb_linux replace with something other than bass + if Loaded then + begin + if Loop then + BASS_ChannelPlay(Bass, True); // start from beginning... actually bass itself does not loop, nor does this TAudio_bass Class + + BASS_ChannelPlay(Bass, False); // for setting position before playing + end; +end; + +procedure TAudio_bass.Pause; //Pause Mod +begin + // TODO : jb_linux replace with something other than bass + if Loaded then begin + BASS_ChannelPause(Bass); // Pauses Song + end; +end; + +procedure TAudio_bass.Stop; +begin + // TODO : jb_linux replace with something other than bass + Bass_ChannelStop(Bass); +end; + +procedure TAudio_bass.Close; +begin + // TODO : jb_linux replace with something other than bass + Bass_StreamFree(Bass); +end; + +function TAudio_bass.Length: real; +var + bytes: integer; +begin + Result := 60; + + // TODO : jb_linux replace with something other than bass + bytes := BASS_ChannelGetLength(Bass); + Result := BASS_ChannelBytes2Seconds(Bass, bytes); +end; + +function TAudio_bass.Position: real; +var + bytes: integer; +begin + Result := 0; + + // TODO : jb_linux replace with something other than bass + bytes := BASS_ChannelGetPosition(BASS); + Result := BASS_ChannelBytes2Seconds(BASS, bytes); +end; + +function TAudio_bass.Finished: boolean; +begin + Result := false; + + // TODO : jb_linux replace with something other than bass + if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then + begin + Result := true; + end; +end; + +procedure TAudio_bass.PlayStart; +begin + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassStart, True); +end; + +procedure TAudio_bass.PlayBack; +begin + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassBack, True);// then +end; + +procedure TAudio_bass.PlaySwoosh; +begin + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassSwoosh, True); +end; + +procedure TAudio_bass.PlayChange; +begin + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassChange, True); +end; + +procedure TAudio_bass.PlayOption; +begin + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassOption, True); +end; + +procedure TAudio_bass.PlayClick; +begin + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassClick, True); +end; + +procedure TAudio_bass.PlayDrum; +begin + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassDrum, True); +end; + +procedure TAudio_bass.PlayHihat; +begin + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassHihat, True); +end; + +procedure TAudio_bass.PlayClap; +begin + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassClap, True); +end; + +procedure TAudio_bass.PlayShuffle; +begin + // TODO : jb_linux replace with something other than bass + BASS_ChannelPlay(BassShuffle, True); +end; + +procedure TAudio_bass.StopShuffle; +begin + // TODO : jb_linux replace with something other than bass + BASS_ChannelStop(BassShuffle); +end; + +procedure TAudio_bass.CaptureStart; +var + S: integer; + SC: integer; + P1: integer; + P2: integer; +begin + for S := 0 to High(Sound) do + Sound[S].BufferLong[0].Clear; + + for SC := 0 to High(Ini.CardList) do begin + P1 := Ini.CardList[SC].ChannelL; + P2 := Ini.CardList[SC].ChannelR; + if P1 > PlayersPlay then P1 := 0; + if P2 > PlayersPlay then P2 := 0; + if (P1 > 0) or (P2 > 0) then + CaptureCard(SC, P1, P2); + end; +end; + +procedure TAudio_bass.CaptureStop; +var + SC: integer; + P1: integer; + P2: integer; +begin + + for SC := 0 to High(Ini.CardList) do begin + P1 := Ini.CardList[SC].ChannelL; + P2 := Ini.CardList[SC].ChannelR; + if P1 > PlayersPlay then P1 := 0; + if P2 > PlayersPlay then P2 := 0; + if (P1 > 0) or (P2 > 0) then StopCard(SC); + end; + +end; + +//procedure TAudio_bass.CaptureCard(RecordI, SoundNum, PlayerLeft, PlayerRight: byte); +procedure TAudio_bass.CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); +var + Error: integer; + ErrorMsg: string; +begin + if not BASS_RecordInit(RecordI) then + begin + Error := BASS_ErrorGetCode; + + ErrorMsg := IntToStr(Error); + if Error = BASS_ERROR_DX then ErrorMsg := 'No DX5'; + if Error = BASS_ERROR_ALREADY then ErrorMsg := 'The device has already been initialized'; + if Error = BASS_ERROR_DEVICE then ErrorMsg := 'The device number specified is invalid'; + if Error = BASS_ERROR_DRIVER then ErrorMsg := 'There is no available device driver'; + + {Log.LogAnalyze('Error initializing record [' + IntToStr(RecordI) + ', ' + + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' + + ErrorMsg);} + Log.LogError('Error initializing record [' + IntToStr(RecordI) + ', ' + + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' + + ErrorMsg); + Log.LogError('Music -> CaptureCard: Error initializing record: ' + ErrorMsg); + + + end + else + begin + Recording.SoundCard[RecordI].BassRecordStream := BASS_RecordStart(44100, 2, MakeLong(0, 20) , @GetMicrophone, PlayerLeft + PlayerRight*256); + end; +end; + +procedure TAudio_bass.StopCard(Card: byte); +begin + // TODO : jb_linux replace with something other than bass + BASS_RecordSetDevice(Card); + BASS_RecordFree; +end; + +function TAudio_bass.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; +var + L: Integer; +begin + if FileExists(Name) then + begin + Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); + try + // TODO : jb_linux replace with something other than bass + hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); + + //Add CustomSound + L := High(CustomSounds) + 1; + SetLength (CustomSounds, L + 1); + CustomSounds[L].Filename := Name; + CustomSounds[L].Handle := hStream; + except + Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); + end; + end + else + begin + Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); + exit; + end; +end; + +//Equalizer +function TAudio_bass.GetFFTData: TFFTData; +var + Data: TFFTData; +begin + //Get Channel Data Mono and 256 Values + BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); +end; + +function TAudio_bass.LoadCustomSound(const Filename: String): Cardinal; +var + S: hStream; + I: Integer; + F: String; +begin + //Search for Sound in already loaded Sounds + F := UpperCase(SoundPath + FileName); + For I := 0 to High(CustomSounds) do + begin + if (UpperCase(CustomSounds[I].Filename) = F) then + begin + Result := I; + Exit; + end; + end; + + if LoadSoundFromFile(S, SoundPath + Filename) then + Result := High(CustomSounds) + else + Result := 0; +end; + +procedure TAudio_bass.PlayCustomSound(const Index: Cardinal ); +begin + if Index <= High(CustomSounds) then + BASS_ChannelPlay(CustomSounds[Index].Handle, True); +end; + + +{* + +Sorry guys... this is my mess :( +Im going to try and get ffmpeg to handle audio playback ( at least for linux ) +and Im going to implement it nicly along side BASS, in TAudio_bass ( where I can ) + +http://www.dranger.com/ffmpeg/ffmpeg.html +http://www.dranger.com/ffmpeg/ffmpegtutorial_all.html + +http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html + +*} +{* +function TAudio_bass.FFMPeg_StreamCreateFile(abool : boolean; aFileName : pchar ): THandle; +var + lFormatCtx : PAVFormatContext; +begin + +(* + if(SDL_OpenAudio(&wanted_spec, &spec) < 0) + begin + fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError()); + writeln( 'SDL_OpenAudio' ); + exit; + end; +*) + +(* + if ( av_open_input_file( lFormatCtx, aFileName, NULL, 0, NULL ) <> 0 ) + begin + writeln( 'Unable to open file '+ aFileName ); + exit; + end; + + // Retrieve stream information + if ( av_find_stream_info(pFormatCtx) < 0 ) + begin + writeln( 'Unable to Retrieve stream information' ); + exit; + end; +*) + +end; *} + +initialization + singleton_MusicBass := TAudio_bass.create(); + + writeln( 'UAudio_Bass - Register Playback' ); + AudioManager.add( IAudioPlayback( singleton_MusicBass ) ); + + writeln( 'UAudio_Bass - Register Input' ); + AudioManager.add( IAudioInput( singleton_MusicBass ) ); + +finalization + AudioManager.Remove( IAudioPlayback( singleton_MusicBass ) ); + AudioManager.Remove( IAudioInput( singleton_MusicBass ) ); + +end. diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index a2620607..8aa59d41 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -95,6 +95,8 @@ type type IAudioPlayback = Interface + ['{E4AE0B40-3C21-4DC5-847C-20A87E0DFB96}'] + function GetName: String; procedure InitializePlayback; procedure SetVolume(Volume: integer); procedure SetMusicVolume(Volume: integer); @@ -129,6 +131,8 @@ type end; IAudioInput = Interface + ['{A5C8DA92-2A0C-4AB2-849B-2F7448C6003A}'] + function GetName: String; procedure InitializeRecord; procedure CaptureStart; @@ -158,46 +162,89 @@ procedure InitializeSound; function AudioPlayback(): IAudioPlayback; function AudioInput(): IAudioInput; +function AudioManager: TInterfaceList; + implementation uses - uLog, - UMusic_BASS; + sysutils, + uLog; var singleton_AudioPlayback : IAudioPlayback; singleton_AudioInput : IAudioInput; + singleton_AudioManager : TInterfaceList; + + +function AudioManager: TInterfaceList; +begin + Result := singleton_AudioManager; +end; //CompressionPluginManager + function AudioPlayback(): IAudioPlayback; begin - if singleton_AudioPlayback = nil then - begin - writeln( 'Created AudioPlayback' ); - singleton_AudioPlayback := TMusic_bass.create(); // Yes we could do this with one instance of TMusic_Bass... but I cant be bothered at this point:P - end; - - result := singleton_AudioPlayback; + result := singleton_AudioPlayback; end; function AudioInput(): IAudioInput; begin - if singleton_AudioInput = nil then - begin - writeln( 'Created AudioInput' ); - singleton_AudioInput := TMusic_bass.create(); // Yes we could do this with one instance of TMusic_Bass... but I cant be bothered at this point:P - end; - result := singleton_AudioInput; end; procedure InitializeSound; +var + lTmpPlayBack : IAudioPlayback; + lTmpInput : IAudioInput; + iCount : Integer; begin - Log.LogStatus('Initializing Playback', 'InitializeSound'); - AudioPlayback.InitializePlayback; - - Log.LogStatus('Initializing Record', 'InitializeSound'); - AudioInput.InitializeRecord; + lTmpPlayBack := nil; + lTmpInput := nil; + + writeln( 'InitializeSound , Enumerate Registered Audio Interfaces' ); + for iCount := 0 to singleton_AudioManager.Count - 1 do + begin + if assigned( AudioManager[iCount] ) then + begin + // if this interface is a Playback, then set it as the default used + if ( AudioManager[iCount].QueryInterface( IAudioPlayback, lTmpPlayBack ) = 0 ) AND + ( not assigned( singleton_AudioPlayback ) ) then + begin + singleton_AudioPlayback := lTmpPlayBack; + end; + + // if this interface is a Input, then set it as the default used + if ( AudioManager[iCount].QueryInterface( IAudioInput, lTmpInput ) = 0 ) AND + ( not assigned( singleton_AudioInput ) ) then + begin + singleton_AudioInput := lTmpInput; + end; + end; + end; + + + writeln( 'Registered Audio Playback Interface : ' + AudioPlayback.GetName ); + writeln( 'Registered Audio Input Interface : ' + AudioInput.GetName ); + + // Initialize Playback + Log.LogStatus('Initializing Playback ('+AudioPlayback.GetName+')', 'InitializeSound'); + AudioPlayback.InitializePlayback; + + // Initialize Input + Log.LogStatus('Initializing Record ('+AudioPlayback.GetName+')', 'InitializeSound'); + AudioInput.InitializeRecord; end; +initialization +begin + writeln('Init AudioManager'); + singleton_AudioManager := TInterfaceList.Create(); +end; + +finalization + writeln('Finalize AudioManager'); + singleton_AudioManager.clear; + FreeAndNil( singleton_AudioManager ); + end. diff --git a/Game/Code/Classes/UMusic_BASS.pas b/Game/Code/Classes/UMusic_BASS.pas deleted file mode 100644 index 7de2d781..00000000 --- a/Game/Code/Classes/UMusic_BASS.pas +++ /dev/null @@ -1,703 +0,0 @@ -unit UMusic_BASS; - -interface - -{$I switches.inc} - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - - -uses Classes, - - {$IFDEF win32} - windows, - {$ENDIF} - -// UCommon, - Messages, - SysUtils, - {$IFNDEF FPC} - Forms, - {$ENDIF} - - bass, - ULog, - UMusic; -// USongs; -// Classes; - - - -type - - TMusic_bass = class( TInterfacedObject, IAudioPlayback, IAudioInput ) - private - BassStart: hStream; // Wait, I've replaced this with BASS - BassBack: hStream; // It has almost all features we need - BassSwoosh: hStream; - BassChange: hStream; // Almost? It aleady has them all :) - BassOption: hStream; - BassClick: hStream; - BassDrum: hStream; - BassHihat: hStream; - BassClap: hStream; - BassShuffle: hStream; - - //Custom Sounds - CustomSounds: array of TCustomSoundEntry; - Loaded: boolean; - Loop: boolean; - fHWND: THandle; - - public - Bass: hStream; - procedure InitializePlayback; - procedure InitializeRecord; - procedure SetVolume(Volume: integer); - procedure SetMusicVolume(Volume: integer); - procedure SetLoop(Enabled: boolean); - function Open(Name: string): boolean; // true if succeed - procedure Rewind; - procedure MoveTo(Time: real); - procedure Play; - procedure Pause; //Pause Mod - procedure Stop; - procedure Close; - function Finished: boolean; - function Length: real; - function Position: real; - procedure PlayStart; - procedure PlayBack; - procedure PlaySwoosh; - procedure PlayChange; - procedure PlayOption; - procedure PlayClick; - procedure PlayDrum; - procedure PlayHihat; - procedure PlayClap; - procedure PlayShuffle; - procedure StopShuffle; - procedure CaptureStart; - procedure CaptureStop; - procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); - procedure StopCard(Card: byte); - function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; - - //Equalizer - function GetFFTData: TFFTData; - - //Custom Sounds - function LoadCustomSound(const Filename: String): Cardinal; - procedure PlayCustomSound(const Index: Cardinal ); -end; - -const - RecordSystem = 1; - -type - TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, - mpPaused, mpOpen); - -const - ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); - -implementation - -uses - {$IFDEF FPC} - lclintf, - {$ENDIF} - -// avcodec, -// avformat, -// avutil, - -// UGraphic, - URecord, -// UFiles, - UIni, - UMain, - UThemes; - - - -procedure TMusic_bass.InitializePlayback; -var - Pet: integer; - S: integer; -begin - Log.BenchmarkStart(4); - Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); - - Loaded := false; - Loop := false; - - {$ifdef win32} - // TODO : JB_Linux ... is this needed ? :) - fHWND := AllocateHWND( nil); // TODO : JB_lazarus - can we do something different here ?? lazarus didnt like this function - {$ENDIF} - - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - if not BASS_Init(1, 44100, 0, fHWND, nil) then - begin - {$IFNDEF FPC} - // TODO : JB_linux find a way to do this nice.. - Application.MessageBox ('Could not initialize BASS', 'Error'); - {$ENDIF} - Exit; - end; - {$ENDIF} - - Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); - - // config playing buffer -// BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); -// BASS_SetConfig(BASS_CONFIG_BUFFER, 100); - - Log.LogStatus('Loading Sounds', 'Music Initialize'); - - Log.BenchmarkStart(4); - LoadSoundFromFile(BassStart, SoundPath + 'Common Start.mp3'); - LoadSoundFromFile(BassBack, SoundPath + 'Common Back.mp3'); - LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3'); - LoadSoundFromFile(BassChange, SoundPath + 'select music change music 50.mp3'); - LoadSoundFromFile(BassOption, SoundPath + 'option change col.mp3'); - LoadSoundFromFile(BassClick, SoundPath + 'rimshot022b.mp3'); - -// LoadSoundFromFile(BassDrum, SoundPath + 'bassdrumhard076b.mp3'); -// LoadSoundFromFile(BassHihat, SoundPath + 'hihatclosed068b.mp3'); -// LoadSoundFromFile(BassClap, SoundPath + 'claps050b.mp3'); - -// LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3'); - - Log.BenchmarkEnd(4); - Log.LogBenchmark('--> Loading Sounds', 4); -end; - -procedure TMusic_bass.InitializeRecord; -var - S: integer; - device: integer; - descr: string; - input: integer; - input2: integer; - flags: integer; - mic: array[0..15] of integer; - SC: integer; // soundcard - SCI: integer; // soundcard input -begin - if RecordSystem = 1 then begin - SetLength(Sound, 6 {max players});//Ini.Players+1); - for S := 0 to High(Sound) do begin //Ini.Players do begin - Sound[S] := TSound.Create; - Sound[S].Num := S; - Sound[S].BufferNew := TMemoryStream.Create; - SetLength(Sound[S].BufferLong, 1); - Sound[S].BufferLong[0] := TMemoryStream.Create; - Sound[S].n := 4*1024; - end; - - - // check for recording devices; - {device := 0; - descr := BASS_RecordGetDeviceDescription(device); - - SetLength(SoundCard, 0); - while (descr <> '') do begin - SC := High(SoundCard) + 1; - SetLength(SoundCard, SC+1); - - Log.LogAnalyze('Device #'+IntToStr(device)+': '+ descr); - SoundCard[SC].Description := Descr; - - // check for recording inputs - mic[device] := -1; // default to no change - input := 0; - BASS_RecordInit(device); - Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); - flags := BASS_RecordGetInput(input); - - SetLength(SoundCard[SC].Input, 0); - while (flags <> -1) do begin - SCI := High(SoundCard[SC].Input) + 1; - SetLength(SoundCard[SC].Input, SCI+1); - - Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); - SoundCard[SC].Input[SCI].Name := BASS_RecordGetInputName(Input); - - if (flags and BASS_INPUT_TYPE_MASK) = BASS_INPUT_TYPE_MIC then begin - mic[device] := input; // auto set microphone - end; - Inc(Input); - flags := BASS_RecordGetInput(input); - end; - - if mic[device] <> -1 then begin - Log.LogAnalyze('Found the mic at input ' + IntToStr(Mic[device])) - end else begin - Log.LogAnalyze('Mic not found'); - mic[device] := 0; // setting to the first one (for kxproject) - end; - SoundCard[SC].InputSeleceted := Mic[Device]; - - - BASS_RecordFree; - - inc(Device); - descr := BASS_RecordGetDeviceDescription(Device); - end; // while} - end; // if -end; - -procedure TMusic_bass.SetVolume(Volume: integer); -begin - //Old Sets Wave Volume - //BASS_SetVolume(Volume); - //New: Sets Volume only for this Application - - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); - {$ENDIF} -end; - -procedure TMusic_bass.SetMusicVolume(Volume: Integer); -begin - //Max Volume Prevention - if Volume > 100 then - Volume := 100; - - if Volume < 0 then - Volume := 0; - - - //Set Volume - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelSetAttributes (Bass, -1, Volume, -101); - {$ENDIF} -end; - -procedure TMusic_bass.SetLoop(Enabled: boolean); -begin - Loop := Enabled; -end; - -function TMusic_bass.Open(Name: string): boolean; -begin - Loaded := false; - if FileExists(Name) then - begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); - {$ENDIF} - - Loaded := true; - //Set Max Volume - SetMusicVolume (100); - end; - - Result := Loaded; -end; - -procedure TMusic_bass.Rewind; -begin - if Loaded then begin - end; -end; - -procedure TMusic_bass.MoveTo(Time: real); -var - bytes: integer; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - bytes := BASS_ChannelSeconds2Bytes(Bass, Time); - BASS_ChannelSetPosition(Bass, bytes); - {$ENDIF} -end; - -procedure TMusic_bass.Play; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - if Loaded then - begin - if Loop then - BASS_ChannelPlay(Bass, True); // start from beginning... actually bass itself does not loop, nor does this TMusic_bass Class - - BASS_ChannelPlay(Bass, False); // for setting position before playing - end; - {$ENDIF} -end; - -procedure TMusic_bass.Pause; //Pause Mod -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - if Loaded then begin - BASS_ChannelPause(Bass); // Pauses Song - end; - {$ENDIF} -end; - -procedure TMusic_bass.Stop; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - Bass_ChannelStop(Bass); - {$ENDIF} -end; - -procedure TMusic_bass.Close; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - Bass_StreamFree(Bass); - {$ENDIF} -end; - -function TMusic_bass.Length: real; -var - bytes: integer; -begin - Result := 60; - - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - bytes := BASS_ChannelGetLength(Bass); - Result := BASS_ChannelBytes2Seconds(Bass, bytes); - {$ENDIF} -end; - -function TMusic_bass.Position: real; -var - bytes: integer; -begin - Result := 0; - - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - bytes := BASS_ChannelGetPosition(BASS); - Result := BASS_ChannelBytes2Seconds(BASS, bytes); - {$ENDIF} -end; - -function TMusic_bass.Finished: boolean; -begin - Result := false; - - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then - begin - Result := true; - end; - {$ENDIF} -end; - -procedure TMusic_bass.PlayStart; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassStart, True); - {$ENDIF} -end; - -procedure TMusic_bass.PlayBack; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassBack, True);// then - {$ENDIF} -end; - -procedure TMusic_bass.PlaySwoosh; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassSwoosh, True); - {$ENDIF} -end; - -procedure TMusic_bass.PlayChange; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassChange, True); - {$ENDIF} -end; - -procedure TMusic_bass.PlayOption; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassOption, True); - {$ENDIF} -end; - -procedure TMusic_bass.PlayClick; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassClick, True); - {$ENDIF} -end; - -procedure TMusic_bass.PlayDrum; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassDrum, True); - {$ENDIF} -end; - -procedure TMusic_bass.PlayHihat; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassHihat, True); - {$ENDIF} -end; - -procedure TMusic_bass.PlayClap; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassClap, True); - {$ENDIF} -end; - -procedure TMusic_bass.PlayShuffle; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassShuffle, True); - {$ENDIF} -end; - -procedure TMusic_bass.StopShuffle; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_ChannelStop(BassShuffle); - {$ENDIF} -end; - -procedure TMusic_bass.CaptureStart; -var - S: integer; - SC: integer; - P1: integer; - P2: integer; -begin - for S := 0 to High(Sound) do - Sound[S].BufferLong[0].Clear; - - for SC := 0 to High(Ini.CardList) do begin - P1 := Ini.CardList[SC].ChannelL; - P2 := Ini.CardList[SC].ChannelR; - if P1 > PlayersPlay then P1 := 0; - if P2 > PlayersPlay then P2 := 0; - if (P1 > 0) or (P2 > 0) then - CaptureCard(SC, P1, P2); - end; -end; - -procedure TMusic_bass.CaptureStop; -var - SC: integer; - P1: integer; - P2: integer; -begin - - for SC := 0 to High(Ini.CardList) do begin - P1 := Ini.CardList[SC].ChannelL; - P2 := Ini.CardList[SC].ChannelR; - if P1 > PlayersPlay then P1 := 0; - if P2 > PlayersPlay then P2 := 0; - if (P1 > 0) or (P2 > 0) then StopCard(SC); - end; - -end; - -//procedure TMusic_bass.CaptureCard(RecordI, SoundNum, PlayerLeft, PlayerRight: byte); -procedure TMusic_bass.CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); -var - Error: integer; - ErrorMsg: string; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - - if not BASS_RecordInit(RecordI) then - begin - Error := BASS_ErrorGetCode; - - ErrorMsg := IntToStr(Error); - if Error = BASS_ERROR_DX then ErrorMsg := 'No DX5'; - if Error = BASS_ERROR_ALREADY then ErrorMsg := 'The device has already been initialized'; - if Error = BASS_ERROR_DEVICE then ErrorMsg := 'The device number specified is invalid'; - if Error = BASS_ERROR_DRIVER then ErrorMsg := 'There is no available device driver'; - - {Log.LogAnalyze('Error initializing record [' + IntToStr(RecordI) + ', ' - + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' - + ErrorMsg);} - Log.LogError('Error initializing record [' + IntToStr(RecordI) + ', ' - + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' - + ErrorMsg); - Log.LogError('Music -> CaptureCard: Error initializing record: ' + ErrorMsg); - - - end - else - begin - Recording.SoundCard[RecordI].BassRecordStream := BASS_RecordStart(44100, 2, MakeLong(0, 20) , @GetMicrophone, PlayerLeft + PlayerRight*256); - end; - - {$ENDIF} -end; - -procedure TMusic_bass.StopCard(Card: byte); -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - BASS_RecordSetDevice(Card); - BASS_RecordFree; - {$ENDIF} -end; - -function TMusic_bass.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; -var - L: Integer; -begin - if FileExists(Name) then - begin - Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); - try - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); - {$ELSE} - hStream := FFMPeg_StreamCreateFile(False, pchar(Name) ); - {$ENDIF} - - - - //Add CustomSound - L := High(CustomSounds) + 1; - SetLength (CustomSounds, L + 1); - CustomSounds[L].Filename := Name; - CustomSounds[L].Handle := hStream; - except - Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); - end; - end - else - begin - Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); - exit; - end; -end; - -//Equalizer -function TMusic_bass.GetFFTData: TFFTData; -var -Data: TFFTData; -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - - //Get Channel Data Mono and 256 Values - BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); - //Result := Data; - - {$ENDIF} -end; - -function TMusic_bass.LoadCustomSound(const Filename: String): Cardinal; -var - S: hStream; - I: Integer; - F: String; -begin - //Search for Sound in already loaded Sounds - F := UpperCase(SoundPath + FileName); - For I := 0 to High(CustomSounds) do - begin - if (UpperCase(CustomSounds[I].Filename) = F) then - begin - Result := I; - Exit; - end; - end; - - if LoadSoundFromFile(S, SoundPath + Filename) then - Result := High(CustomSounds) - else - Result := 0; -end; - -procedure TMusic_bass.PlayCustomSound(const Index: Cardinal ); -begin - {$IFDEF useBASS} - // TODO : jb_linux replace with something other than bass - - if Index <= High(CustomSounds) then - BASS_ChannelPlay(CustomSounds[Index].Handle, True); - - {$ENDIF} -end; - - -{* - -Sorry guys... this is my mess :( -Im going to try and get ffmpeg to handle audio playback ( at least for linux ) -and Im going to implement it nicly along side BASS, in TMusic_bass ( where I can ) - -http://www.dranger.com/ffmpeg/ffmpeg.html -http://www.dranger.com/ffmpeg/ffmpegtutorial_all.html - -http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html - -*} -{* -function TMusic_bass.FFMPeg_StreamCreateFile(abool : boolean; aFileName : pchar ): THandle; -var - lFormatCtx : PAVFormatContext; -begin - -(* - if(SDL_OpenAudio(&wanted_spec, &spec) < 0) - begin - fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError()); - writeln( 'SDL_OpenAudio' ); - exit; - end; -*) - -(* - if ( av_open_input_file( lFormatCtx, aFileName, NULL, 0, NULL ) <> 0 ) - begin - writeln( 'Unable to open file '+ aFileName ); - exit; - end; - - // Retrieve stream information - if ( av_find_stream_info(pFormatCtx) < 0 ) - begin - writeln( 'Unable to Retrieve stream information' ); - exit; - end; -*) - -end; *} - -end. diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 239984b5..de34aa52 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -43,8 +43,12 @@ uses UCommon in 'Classes\UCommon.pas', UGraphic in 'Classes\UGraphic.pas', UTexture in 'Classes\UTexture.pas', - UMusic in 'Classes\UMusic.pas', - UMusic_BASS in 'Classes\UMusic_BASS.pas', + + UMusic in 'Classes\UMusic.pas', + UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', + UAudio_Bass in 'Classes\UAudio_Bass.pas', + + ULanguage in 'Classes\ULanguage.pas', UMain in 'Classes\UMain.pas', UDraw in 'Classes\UDraw.pas', @@ -291,8 +295,7 @@ begin // Sound Log.BenchmarkStart(1); - Log.LogStatus('Initialize Sound', 'Initialization'); - Log.LogStatus('Creating Music', 'InitializeSound'); InitializeSound(); + Log.LogStatus('Initialize Sound', 'Initialization'); InitializeSound(); Log.BenchmarkEnd(1); Log.LogBenchmark('Initializing Sound', 1); -- cgit v1.2.3 From 9d712ccfef0fc32e5216d3d9f0bf4472341a6c77 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 11 Oct 2007 13:41:38 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@507 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/bamboo-build-win-delphi.bat | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/bamboo-build-win-delphi.bat b/Game/Code/bamboo-build-win-delphi.bat index 794f385f..6430ae2b 100644 --- a/Game/Code/bamboo-build-win-delphi.bat +++ b/Game/Code/bamboo-build-win-delphi.bat @@ -1 +1,7 @@ "C:\Program Files\Borland\BDS\4.0\Bin\dcc32.exe" -U"lib\JEDI-SDLv1.0\SDL\Pas" -O"lib\JEDI-SDLv1.0\SDL\Pas" -I"lib\JEDI-SDLv1.0\SDL\Pas" -R"lib\JEDI-SDLv1.0\SDL\Pas" UltraStar.dpr +cp UltraStar.exe ..\..\ + +cd ..\..\Installer +"C:\Program Files\NSIS\makeNSIS.exe" UltraStarDeluxe.nsi + +cd ..\Game\Code \ No newline at end of file -- cgit v1.2.3 From 2753f403020088265be36d7656c4dbf4c2f3e343 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 11 Oct 2007 13:43:56 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@508 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.lpr | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index b9430a82..faa09088 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -121,6 +121,9 @@ uses ULyrics_bak in 'Classes\ULyrics_bak.pas', UMain in 'Classes\UMain.pas', UMusic in 'Classes\UMusic.pas', + UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', + UAudio_Bass in 'Classes\UAudio_Bass.pas', + UParty in 'Classes\UParty.pas', UPlaylist in 'Classes\UPlaylist.pas', URecord in 'Classes\URecord.pas', -- cgit v1.2.3 From 471beb7a5989fe6dbdc450354a2b64d528d0b7a1 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 11 Oct 2007 13:45:29 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@509 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.lpr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index faa09088..59e6b2ef 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -121,7 +121,7 @@ uses ULyrics_bak in 'Classes\ULyrics_bak.pas', UMain in 'Classes\UMain.pas', UMusic in 'Classes\UMusic.pas', - UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', +// UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', UAudio_Bass in 'Classes\UAudio_Bass.pas', UParty in 'Classes\UParty.pas', -- cgit v1.2.3 From 8ee7ea3da21b01a83a048f8b710b7b7b6dcf7c1f Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 11 Oct 2007 22:17:00 +0000 Subject: modifications to make new UMusic work correctly in linux. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@511 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.lpr | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index 59e6b2ef..56c1ef92 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -122,8 +122,10 @@ uses UMain in 'Classes\UMain.pas', UMusic in 'Classes\UMusic.pas', // UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', - UAudio_Bass in 'Classes\UAudio_Bass.pas', - +{$ifdef win32} + UAudio_bass in 'Classes\UAudio_bass.pas', +{$endif} + UParty in 'Classes\UParty.pas', UPlaylist in 'Classes\UPlaylist.pas', URecord in 'Classes\URecord.pas', @@ -416,9 +418,7 @@ exit; // Sound Log.BenchmarkStart(1); - Log.LogStatus('Initialize Sound', 'Initialization'); - Log.LogStatus('Creating Music', 'InitializeSound'); Music := TMusic.Create; - InitializeSound; + Log.LogStatus('Initialize Sound', 'Initialization'); InitializeSound(); Log.BenchmarkEnd(1); Log.LogBenchmark('Initializing Sound', 1); -- cgit v1.2.3 From 8c923b5b76bb17e00132a0b2b2b96de34265fc63 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 16 Oct 2007 11:27:23 +0000 Subject: modified ffmpeg usage, to use interface same as bass... still needs some tidy up, but its working. :) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@515 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudio_FFMpeg.pas | 2 - Game/Code/Classes/UAudio_bass.pas | 27 +- Game/Code/Classes/UMedia_dummy.pas | 276 ++++++++++++++++ Game/Code/Classes/UMusic.pas | 142 +++++--- Game/Code/Classes/UVideo.pas | 625 +++++++++++++++++++++--------------- Game/Code/Screens/UScreenSing.pas | 43 ++- Game/Code/UltraStar.dpr | 29 +- Game/Code/UltraStar.lpr | 1 + 8 files changed, 806 insertions(+), 339 deletions(-) create mode 100644 Game/Code/Classes/UMedia_dummy.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudio_FFMpeg.pas b/Game/Code/Classes/UAudio_FFMpeg.pas index 2a3c5cb5..959d904a 100644 --- a/Game/Code/Classes/UAudio_FFMpeg.pas +++ b/Game/Code/Classes/UAudio_FFMpeg.pas @@ -16,8 +16,6 @@ uses Classes, {$IFNDEF FPC} Forms, {$ENDIF} - - bass, ULog, UMusic; diff --git a/Game/Code/Classes/UAudio_bass.pas b/Game/Code/Classes/UAudio_bass.pas index cbeadc47..5aecfc89 100644 --- a/Game/Code/Classes/UAudio_bass.pas +++ b/Game/Code/Classes/UAudio_bass.pas @@ -79,7 +79,7 @@ type procedure Close; function Finished: boolean; function Length: real; - function Position: real; + function getPosition: real; procedure PlayStart; procedure PlayBack; procedure PlaySwoosh; @@ -118,17 +118,22 @@ var Pet: integer; S: integer; begin - Log.BenchmarkStart(4); - Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); + writeln( 'TAudio_bass.InitializePlayback' ); +// Log.BenchmarkStart(4); +// Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); Loaded := false; Loop := false; + + writeln( 'TAudio_bass AllocateHWND' ); {$ifdef win32} // TODO : JB_Linux ... is this needed ? :) fHWND := AllocateHWND( nil); // TODO : JB_lazarus - can we do something different here ?? lazarus didnt like this function {$ENDIF} + + writeln( 'TAudio_bass BASS_Init' ); // TODO : jb_linux replace with something other than bass if not BASS_Init(1, 44100, 0, fHWND, nil) then begin @@ -139,15 +144,16 @@ begin Exit; end; - Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); +// Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); // config playing buffer // BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); // BASS_SetConfig(BASS_CONFIG_BUFFER, 100); - Log.LogStatus('Loading Sounds', 'Music Initialize'); +// Log.LogStatus('Loading Sounds', 'Music Initialize'); - Log.BenchmarkStart(4); + writeln( 'TAudio_bass LoadSoundFromFile' ); +// Log.BenchmarkStart(4); LoadSoundFromFile(BassStart, SoundPath + 'Common Start.mp3'); LoadSoundFromFile(BassBack, SoundPath + 'Common Back.mp3'); LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3'); @@ -161,8 +167,8 @@ begin // LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3'); - Log.BenchmarkEnd(4); - Log.LogBenchmark('--> Loading Sounds', 4); +// Log.BenchmarkEnd(4); +// Log.LogBenchmark('--> Loading Sounds', 4); end; procedure TAudio_bass.InitializeRecord; @@ -347,7 +353,7 @@ begin Result := BASS_ChannelBytes2Seconds(Bass, bytes); end; -function TAudio_bass.Position: real; +function TAudio_bass.getPosition: real; var bytes: integer; begin @@ -631,7 +637,10 @@ initialization AudioManager.add( IAudioInput( singleton_MusicBass ) ); finalization + writeln( 'UAudio_Bass - UnRegister Playback' ); AudioManager.Remove( IAudioPlayback( singleton_MusicBass ) ); + + writeln( 'UAudio_Bass - UnRegister Input' ); AudioManager.Remove( IAudioInput( singleton_MusicBass ) ); end. diff --git a/Game/Code/Classes/UMedia_dummy.pas b/Game/Code/Classes/UMedia_dummy.pas new file mode 100644 index 00000000..0752ab64 --- /dev/null +++ b/Game/Code/Classes/UMedia_dummy.pas @@ -0,0 +1,276 @@ +unit UMedia_dummy; +{< ############################################################################# +# FFmpeg support for UltraStar deluxe # +# # +# Created by b1indy # +# based on 'An ffmpeg and SDL Tutorial' (http://www.dranger.com/ffmpeg/) # +# # +# http://www.mail-archive.com/fpc-pascal@lists.freepascal.org/msg09949.html # +# http://www.nabble.com/file/p11795857/mpegpas01.zip # +# # +############################################################################## } + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +implementation + +uses + SysUtils, + UMusic; + + +var + singleton_dummy : IVideoPlayback; + +type + Tmedia_dummy = class( TInterfacedObject, IVideoPlayback, IAudioPlayback, IAudioInput ) + private + public + constructor create(); + function GetName: String; + + procedure init(); + + function Open( aFileName : string): boolean; // true if succeed + procedure Close; + + procedure Play; + procedure Pause; + procedure Stop; + + procedure MoveTo(Time: real); + function getPosition: real; + + procedure FFmpegGetFrame(Time: Extended); + procedure FFmpegDrawGL(Screen: integer); + + // IAudioInput + procedure InitializeRecord; + procedure CaptureStart; + procedure CaptureStop; + procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); + procedure StopCard(Card: byte); + function GetFFTData: TFFTData; + + // IAudioPlayback + procedure InitializePlayback; + procedure SetVolume(Volume: integer); + procedure SetMusicVolume(Volume: integer); + procedure SetLoop(Enabled: boolean); + procedure Rewind; + + function Finished: boolean; + function Length: real; + + procedure PlayStart; + procedure PlayBack; + procedure PlaySwoosh; + procedure PlayChange; + procedure PlayOption; + procedure PlayClick; + procedure PlayDrum; + procedure PlayHihat; + procedure PlayClap; + procedure PlayShuffle; + procedure StopShuffle; + + function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; + + function LoadCustomSound(const Filename: String): Cardinal; + procedure PlayCustomSound(const Index: Cardinal ); + + end; + + + +function Tmedia_dummy.GetName: String; +begin + result := 'dummy'; +end; + + +procedure Tmedia_dummy.FFmpegGetFrame(Time: Extended); +begin +end; + +procedure Tmedia_dummy.FFmpegDrawGL(Screen: integer); +begin +end; + +constructor Tmedia_dummy.create(); +begin +end; + +procedure Tmedia_dummy.init(); +begin +end; + + +function Tmedia_dummy.Open( aFileName : string): boolean; // true if succeed +begin + result := false; +end; + +procedure Tmedia_dummy.Close; +begin +end; + +procedure Tmedia_dummy.Play; +begin +end; + +procedure Tmedia_dummy.Pause; +begin +end; + +procedure Tmedia_dummy.Stop; +begin +end; + +procedure Tmedia_dummy.MoveTo(Time: real); +begin +end; + +function Tmedia_dummy.getPosition: real; +begin + result := 0; +end; + +// IAudioInput +procedure Tmedia_dummy.InitializeRecord; +begin +end; + +procedure Tmedia_dummy.CaptureStart; +begin +end; + +procedure Tmedia_dummy.CaptureStop; +begin +end; + +procedure Tmedia_dummy.CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); +begin +end; + +procedure Tmedia_dummy.StopCard(Card: byte); +begin +end; + +function Tmedia_dummy.GetFFTData: TFFTData; +begin +end; + +// IAudioPlayback +procedure Tmedia_dummy.InitializePlayback; +begin +end; + +procedure Tmedia_dummy.SetVolume(Volume: integer); +begin +end; + +procedure Tmedia_dummy.SetMusicVolume(Volume: integer); +begin +end; + +procedure Tmedia_dummy.SetLoop(Enabled: boolean); +begin +end; + +procedure Tmedia_dummy.Rewind; +begin +end; + +function Tmedia_dummy.Finished: boolean; +begin +end; + +function Tmedia_dummy.Length: real; +begin +end; + +procedure Tmedia_dummy.PlayStart; +begin +end; + +procedure Tmedia_dummy.PlayBack; +begin +end; + +procedure Tmedia_dummy.PlaySwoosh; +begin +end; + +procedure Tmedia_dummy.PlayChange; +begin +end; + +procedure Tmedia_dummy.PlayOption; +begin +end; + +procedure Tmedia_dummy.PlayClick; +begin +end; + +procedure Tmedia_dummy.PlayDrum; +begin +end; + +procedure Tmedia_dummy.PlayHihat; +begin +end; + +procedure Tmedia_dummy.PlayClap; +begin +end; + +procedure Tmedia_dummy.PlayShuffle; +begin +end; + +procedure Tmedia_dummy.StopShuffle; +begin +end; + +function Tmedia_dummy.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; +begin + result := false; +end; + +function Tmedia_dummy.LoadCustomSound(const Filename: String): Cardinal; +begin + result := 0; +end; + +procedure Tmedia_dummy.PlayCustomSound(const Index: Cardinal ); +begin +end; + + + +initialization + singleton_dummy := Tmedia_dummy.create(); + + writeln( 'UMedia_dummy - Register dummy Video_Playback' ); + AudioManager.add( IVideoPlayback( singleton_dummy ) ); + + writeln( 'UMedia_dummy - Register dummy Video_Playback' ); + AudioManager.add( IAudioPlayback( singleton_dummy ) ); + + writeln( 'UMedia_dummy - Register dummy Video_Playback' ); + AudioManager.add( IAudioInput( singleton_dummy ) ); + +finalization + AudioManager.Remove( IVideoPlayback( singleton_dummy ) ); + AudioManager.Remove( IAudioPlayback( singleton_dummy ) ); + AudioManager.Remove( IAudioInput( singleton_dummy ) ); + + +end. diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index 8aa59d41..88d845f7 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -8,8 +8,7 @@ interface {$MODE Delphi} {$ENDIF} -uses Classes // UCommon - ; +uses Classes ; type TMuzyka = record @@ -94,23 +93,58 @@ type end; type - IAudioPlayback = Interface + IGenericPlayback = Interface + ['{63A5EBC3-3F4D-4F23-8DFB-B5165FCE33DD}'] + function GetName: String; + + function Open(Name: string): boolean; // true if succeed + procedure Close; + + procedure Play; + procedure Pause; + procedure Stop; + + procedure MoveTo(Time: real); + function getPosition: real; + + property position : real READ getPosition WRITE MoveTo; + end; + + IVideoPlayback = Interface( IGenericPlayback ) + ['{3574C40C-28AE-4201-B3D1-3D1F0759B131}'] +(* + procedure FFmpegOpenFile(FileName: pAnsiChar); + procedure FFmpegClose; + + procedure FFmpegGetFrame(Time: Extended); + procedure FFmpegDrawGL(Screen: integer); + procedure FFmpegTogglePause; + procedure FFmpegSkip(Time: Single); +*) + procedure init(); + + procedure FFmpegGetFrame(Time: Extended); // WANT TO RENAME THESE TO BE MORE GENERIC + procedure FFmpegDrawGL(Screen: integer); // WANT TO RENAME THESE TO BE MORE GENERIC + + end; + + IAudioPlayback = Interface( IGenericPlayback ) ['{E4AE0B40-3C21-4DC5-847C-20A87E0DFB96}'] - function GetName: String; procedure InitializePlayback; procedure SetVolume(Volume: integer); procedure SetMusicVolume(Volume: integer); procedure SetLoop(Enabled: boolean); - function Open(Name: string): boolean; // true if succeed +// function Open(Name: string): boolean; // true if succeed procedure Rewind; - procedure MoveTo(Time: real); - procedure Play; - procedure Pause; //Pause Mod - procedure Stop; - procedure Close; +// procedure MoveTo(Time: real); +// procedure Play; +// procedure Pause; +// procedure Stop; +// procedure Close; function Finished: boolean; function Length: real; - function Position: real; +// function getPosition: real; + procedure PlayStart; procedure PlayBack; procedure PlaySwoosh; @@ -159,6 +193,7 @@ var // TODO : JB --- THESE SHOULD NOT BE GLOBAL procedure InitializeSound; +function VideoPlayback(): IVideoPlayback; function AudioPlayback(): IAudioPlayback; function AudioInput(): IAudioInput; @@ -168,21 +203,30 @@ function AudioManager: TInterfaceList; implementation uses - sysutils, - uLog; + sysutils; +// uLog; var - singleton_AudioPlayback : IAudioPlayback; - singleton_AudioInput : IAudioInput; - singleton_AudioManager : TInterfaceList; + singleton_VideoPlayback : IVideoPlayback = nil; + singleton_AudioPlayback : IAudioPlayback = nil; + singleton_AudioInput : IAudioInput = nil; + singleton_AudioManager : TInterfaceList = nil; function AudioManager: TInterfaceList; begin + if singleton_AudioManager = nil then + singleton_AudioManager := TInterfaceList.Create(); + Result := singleton_AudioManager; end; //CompressionPluginManager +function VideoPlayback(): IVideoPlayback; +begin + result := singleton_VideoPlayback; +end; + function AudioPlayback(): IAudioPlayback; begin result := singleton_AudioPlayback; @@ -195,45 +239,71 @@ end; procedure InitializeSound; var - lTmpPlayBack : IAudioPlayback; - lTmpInput : IAudioInput; - iCount : Integer; + lTmpInterface : IInterface; + iCount : Integer; begin - lTmpPlayBack := nil; - lTmpInput := nil; + lTmpInterface := nil; + + singleton_AudioPlayback := nil; + singleton_AudioInput := nil; + singleton_VideoPlayback := nil; writeln( 'InitializeSound , Enumerate Registered Audio Interfaces' ); - for iCount := 0 to singleton_AudioManager.Count - 1 do + for iCount := 0 to AudioManager.Count - 1 do begin if assigned( AudioManager[iCount] ) then begin // if this interface is a Playback, then set it as the default used - if ( AudioManager[iCount].QueryInterface( IAudioPlayback, lTmpPlayBack ) = 0 ) AND - ( not assigned( singleton_AudioPlayback ) ) then + + if ( AudioManager[iCount].QueryInterface( IAudioPlayback, lTmpInterface ) = 0 ) AND + ( true ) then +// ( not assigned( singleton_AudioPlayback ) ) then begin - singleton_AudioPlayback := lTmpPlayBack; + singleton_AudioPlayback := IAudioPlayback( lTmpInterface ); end; // if this interface is a Input, then set it as the default used - if ( AudioManager[iCount].QueryInterface( IAudioInput, lTmpInput ) = 0 ) AND - ( not assigned( singleton_AudioInput ) ) then + if ( AudioManager[iCount].QueryInterface( IAudioInput, lTmpInterface ) = 0 ) AND + ( true ) then +// ( not assigned( singleton_AudioInput ) ) then begin - singleton_AudioInput := lTmpInput; + singleton_AudioInput := IAudioInput( lTmpInterface ); end; + + // if this interface is a Input, then set it as the default used + if ( AudioManager[iCount].QueryInterface( IVideoPlayback, lTmpInterface ) = 0 ) AND + ( true ) then +// ( not assigned( singleton_VideoPlayback ) ) then + begin + singleton_VideoPlayback := IVideoPlayback( lTmpInterface ); + end; + end; end; - writeln( 'Registered Audio Playback Interface : ' + AudioPlayback.GetName ); - writeln( 'Registered Audio Input Interface : ' + AudioInput.GetName ); + if VideoPlayback <> nil then + begin + writeln( 'Registered Video Playback Interface : ' + VideoPlayback.GetName ); + end; + + if AudioPlayback <> nil then + begin + writeln( 'Registered Audio Playback Interface : ' + AudioPlayback.GetName ); + // Log.LogStatus('Initializing Playback ('+AudioPlayback.GetName+')', 'InitializeSound'); + AudioPlayback.InitializePlayback; + end; + + if AudioInput <> nil then + begin + writeln( 'Registered Audio Input Interface : ' + AudioInput.GetName ); + +// Log.LogStatus('Initializing Record ('+AudioPlayback.GetName+')', 'InitializeSound'); + AudioInput.InitializeRecord; + end; - // Initialize Playback - Log.LogStatus('Initializing Playback ('+AudioPlayback.GetName+')', 'InitializeSound'); - AudioPlayback.InitializePlayback; + writeln( 'InitializeSound DONE' ); - // Initialize Input - Log.LogStatus('Initializing Record ('+AudioPlayback.GetName+')', 'InitializeSound'); - AudioInput.InitializeRecord; end; initialization diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index ed1e5fe3..6e16a7a3 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -22,6 +22,14 @@ interface {$MODE DELPHI} {$ENDIF} +(* + + look into + av_read_play + +*) + +implementation uses SDL, UGraphicClasses, @@ -37,56 +45,69 @@ uses SDL, dialogs, {$endif} {$ENDIF} - UIni; + UIni, + UMusic; -procedure Init; -procedure FFmpegOpenFile(FileName: pAnsiChar); -procedure FFmpegClose; -procedure FFmpegGetFrame(Time: Extended); -procedure FFmpegDrawGL(Screen: integer); -procedure FFmpegTogglePause; -procedure FFmpegSkip(Time: Single); -{ - @author(Jay Binks ) - @created(2007-10-09) - @lastmod(2007-10-09) +var + singleton_VideoFFMpeg : IVideoPlayback; - @param(aFormatCtx is a PAVFormatContext returned from av_open_input_file ) - @param(aFirstVideoStream is an OUT value of type integer, this is the index of the video stream) - @param(aFirstAudioStream is an OUT value of type integer, this is the index of the audio stream) - @returns(@true on success, @false otherwise) +type + TVideoPlayback_ffmpeg = class( TInterfacedObject, IVideoPlayback ) + private + fVideoOpened , + fVideoPaused : Boolean; - translated from "Setting Up the Audio" section at - http://www.dranger.com/ffmpeg/ffmpegtutorial_all.html - } -function find_stream_ids( const aFormatCtx : PAVFormatContext; Out aFirstVideoStream, aFirstAudioStream : integer ): boolean; + fVideoTex : glUint; + fVideoSkipTime : Single; + + fTexData : array of Byte; + + VideoFormatContext: PAVFormatContext; + + VideoStreamIndex , + AudioStreamIndex : Integer; + VideoCodecContext: PAVCodecContext; + VideoCodec: PAVCodec; + AVFrame: PAVFrame; + AVFrameRGB: PAVFrame; + myBuffer: pByte; + + TexX, TexY, dataX, dataY: Cardinal; + + ScaledVideoWidth, ScaledVideoHeight: Real; + VideoAspect: Real; + VideoTextureU, VideoTextureV: Real; + VideoTimeBase, VideoTime, LastFrameTime, TimeDifference: Extended; + + + WantedAudioCodecContext, + AudioCodecContext : PSDL_AudioSpec; + aCodecCtx : PAVCodecContext; + + + function find_stream_ids( const aFormatCtx : PAVFormatContext; Out aFirstVideoStream, aFirstAudioStream : integer ): boolean; + public + constructor create(); + function GetName: String; + + procedure init(); + + function Open( aFileName : string): boolean; // true if succeed + procedure Close; + + procedure Play; + procedure Pause; + procedure Stop; + + procedure MoveTo(Time: real); + function getPosition: real; + + procedure FFmpegGetFrame(Time: Extended); // WANT TO RENAME THESE TO BE MORE GENERIC + procedure FFmpegDrawGL(Screen: integer); // WANT TO RENAME THESE TO BE MORE GENERIC + + end; -var - VideoOpened, VideoPaused: Boolean; - VideoFormatContext: PAVFormatContext; - VideoStreamIndex , - AudioStreamIndex : Integer; - VideoCodecContext: PAVCodecContext; - VideoCodec: PAVCodec; - AVFrame: PAVFrame; - AVFrameRGB: PAVFrame; - myBuffer: pByte; - VideoTex: glUint; - TexX, TexY, dataX, dataY: Cardinal; - TexData: array of Byte; - ScaledVideoWidth, ScaledVideoHeight: Real; - VideoAspect: Real; - VideoTextureU, VideoTextureV: Real; - VideoTimeBase, VideoTime, LastFrameTime, TimeDifference: Extended; - VideoSkipTime: Single; - - - WantedAudioCodecContext, - AudioCodecContext : PSDL_AudioSpec; - aCodecCtx : PAVCodecContext; - -implementation {$ifdef DebugDisplay} //{$ifNdef win32} @@ -102,15 +123,10 @@ end; { ------------------------------------------------------------------------------ asdf ------------------------------------------------------------------------------ } -procedure Init; -begin - av_register_all; - VideoOpened:=False; - VideoPaused:=False; - - glGenTextures(1, PglUint(@VideoTex)); - SetLength(TexData,0); +function TVideoPlayback_ffmpeg.GetName: String; +begin + result := 'FFMpeg'; end; { @@ -126,7 +142,7 @@ end; translated from "Setting Up the Audio" section at http://www.dranger.com/ffmpeg/ffmpegtutorial_all.html } -function find_stream_ids( const aFormatCtx : PAVFormatContext; Out aFirstVideoStream, aFirstAudioStream : integer ): boolean; +function TVideoPlayback_ffmpeg.find_stream_ids( const aFormatCtx : PAVFormatContext; Out aFirstVideoStream, aFirstAudioStream : integer ): boolean; var i : integer; st : pAVStream; @@ -164,202 +180,10 @@ begin (aFirstVideoStream > -1) ; // Didn't find a video stream end; -procedure FFmpegOpenFile(FileName: pAnsiChar); -var errnum, i, x,y: Integer; - lStreamsCount : Integer; - -begin - VideoOpened := False; - VideoPaused := False; - VideoTimeBase := 0; - VideoTime := 0; - LastFrameTime := 0; - TimeDifference := 0; - VideoFormatContext := 0; - - writeln( Filename ); - - errnum := av_open_input_file(VideoFormatContext, FileName, Nil, 0, Nil); - writeln( 'Errnum : ' +inttostr( errnum )); - if(errnum <> 0) then - begin -{$ifdef DebugDisplay} - case errnum of - AVERROR_UNKNOWN: showmessage('failed to open file '+Filename+#13#10+'AVERROR_UNKNOWN'); - AVERROR_IO: showmessage('failed to open file '+Filename+#13#10+'AVERROR_IO'); - AVERROR_NUMEXPECTED: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NUMEXPECTED'); - AVERROR_INVALIDDATA: showmessage('failed to open file '+Filename+#13#10+'AVERROR_INVALIDDATA'); - AVERROR_NOMEM: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NOMEM'); - AVERROR_NOFMT: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NOFMT'); - AVERROR_NOTSUPP: showmessage('failed to open file '+Filename+#13#10+'AVERROR_NOTSUPP'); - else showmessage('failed to open file '+Filename+#13#10+'Error number: '+inttostr(Errnum)); - end; -{$ENDIF} - Exit; - end - else - begin - VideoStreamIndex := -1; - AudioStreamIndex := -1; - - // Find which stream contains the video - if( av_find_stream_info(VideoFormatContext) >= 0 ) then - begin - find_stream_ids( VideoFormatContext, VideoStreamIndex, AudioStreamIndex ); - - writeln( 'VideoStreamIndex : ' + inttostr(VideoStreamIndex) ); - writeln( 'AudioStreamIndex : ' + inttostr(AudioStreamIndex) ); - end; - aCodecCtx := VideoFormatContext.streams[ AudioStreamIndex ].codec; - - WantedAudioCodecContext.freq := aCodecCtx^.sample_rate; - WantedAudioCodecContext.format := AUDIO_S16SYS; - WantedAudioCodecContext.channels := aCodecCtx^.channels; - WantedAudioCodecContext.silence := 0; - WantedAudioCodecContext.samples := 1024;//SDL_AUDIO_BUFFER_SIZE; -// WantedAudioCodecContext.callback := audio_callback; - WantedAudioCodecContext.userdata := aCodecCtx; - - -(* - if(SDL_OpenAudio(WantedAudioCodecContext, AudioCodecContext) < 0) then - begin - writeln( 'Could not do SDL_OpenAudio' ); - exit; - end; -*) - - if(VideoStreamIndex >= 0) then - begin - VideoCodecContext:=VideoFormatContext^.streams[VideoStreamIndex]^.codec; - VideoCodec:=avcodec_find_decoder(VideoCodecContext^.codec_id); - end - else - begin -{$ifdef DebugDisplay} - showmessage('found no video stream'); -{$ENDIF} - av_close_input_file(VideoFormatContext); - Exit; - end; - - - if(VideoCodec<>Nil) then - begin - errnum:=avcodec_open(VideoCodecContext, VideoCodec); - end else begin -{$ifdef DebugDisplay} - showmessage('no matching codec found'); -{$ENDIF} - avcodec_close(VideoCodecContext); - av_close_input_file(VideoFormatContext); - Exit; - end; - if(errnum >=0) then - begin -{$ifdef DebugDisplay} - showmessage('Found a matching Codec: '+ VideoCodecContext^.Codec.Name +#13#10#13#10+ - ' Width = '+inttostr(VideoCodecContext^.width)+ ', Height='+inttostr(VideoCodecContext^.height)+#13#10+ - ' Aspect : '+inttostr(VideoCodecContext^.sample_aspect_ratio.num)+'/'+inttostr(VideoCodecContext^.sample_aspect_ratio.den)+#13#10+ - ' Framerate : '+inttostr(VideoCodecContext^.time_base.num)+'/'+inttostr(VideoCodecContext^.time_base.den)); -{$endif} - // allocate space for decoded frame and rgb frame - AVFrame:=avcodec_alloc_frame; - AVFrameRGB:=avcodec_alloc_frame; - end; - myBuffer:=Nil; - if(AVFrame <> Nil) and (AVFrameRGB <> Nil) then - begin - myBuffer:=av_malloc(avpicture_get_size(PIX_FMT_RGB24, VideoCodecContext^.width, - VideoCodecContext^.height)); - end; - if myBuffer <> Nil then errnum:=avpicture_fill(PAVPicture(AVFrameRGB), myBuffer, PIX_FMT_RGB24, - VideoCodecContext^.width, VideoCodecContext^.height) - else begin -{$ifdef DebugDisplay} - showmessage('failed to allocate video buffer'); -{$endif} - av_free(AVFrameRGB); - av_free(AVFrame); - avcodec_close(VideoCodecContext); - av_close_input_file(VideoFormatContext); - Exit; - end; - if errnum >=0 then - begin - VideoOpened:=True; - - TexX := VideoCodecContext^.width; - TexY := VideoCodecContext^.height; - dataX := Round(Power(2, Ceil(Log2(TexX)))); - dataY := Round(Power(2, Ceil(Log2(TexY)))); - SetLength(TexData,dataX*dataY*3); - // calculate some information for video display - VideoAspect:=VideoCodecContext^.sample_aspect_ratio.num/VideoCodecContext^.sample_aspect_ratio.den; - if (VideoAspect = 0) then - VideoAspect:=VideoCodecContext^.width/VideoCodecContext^.height - else - VideoAspect:=VideoAspect*VideoCodecContext^.width/VideoCodecContext^.height; - if VideoAspect >= 4/3 then - begin - ScaledVideoWidth:=800.0; - ScaledVideoHeight:=800.0/VideoAspect; - end else - begin - ScaledVideoHeight:=600.0; - ScaledVideoWidth:=600.0*VideoAspect; - end; - VideoTimeBase:=VideoCodecContext^.time_base.num/VideoCodecContext^.time_base.den; - // hack to get reasonable timebase for divx -{$ifdef DebugDisplay} - showmessage('framerate: '+inttostr(floor(1/videotimebase))+'fps'); -{$endif} - if VideoTimeBase < 0.02 then // 0.02 <-> 50 fps - begin - VideoTimeBase:=VideoCodecContext^.time_base.den/VideoCodecContext^.time_base.num; - while VideoTimeBase > 50 do VideoTimeBase:=VideoTimeBase/10; - VideoTimeBase:=1/VideoTimeBase; - end; -{$ifdef DebugDisplay} - showmessage('corrected framerate: '+inttostr(floor(1/videotimebase))+'fps'); - - if ((VideoAspect*VideoCodecContext^.width*VideoCodecContext^.height)>200000) then - showmessage('you are trying to play a rather large video'+#13#10+ - 'be prepared to experience some timing problems'); -{$endif} - end; - end; -end; - -procedure FFmpegClose; -begin - if VideoOpened then begin - av_free(myBuffer); - av_free(AVFrameRGB); - av_free(AVFrame); - avcodec_close(VideoCodecContext); - av_close_input_file(VideoFormatContext); - SetLength(TexData,0); - VideoOpened:=False; - end; -end; -procedure FFmpegTogglePause; -begin - if VideoPaused then VideoPaused:=False - else VideoPaused:=True; -end; -procedure FFmpegSkip(Time: Single); -begin - VideoSkiptime:=Time; - if VideoSkipTime > 0 then begin - av_seek_frame(VideoFormatContext,-1,Floor((VideoSkipTime)*1500000),0); - VideoTime:=VideoSkipTime; - end; -end; -procedure FFmpegGetFrame(Time: Extended); +procedure TVideoPlayback_ffmpeg.FFmpegGetFrame(Time: Extended); var FrameFinished: Integer; AVPacket: TAVPacket; @@ -372,13 +196,13 @@ var const FRAMEDROPCOUNT=3; begin - if not VideoOpened then Exit; + if not fVideoOpened then Exit; - if VideoPaused then Exit; - - myTime:=Time+VideoSkipTime; - TimeDifference:=myTime-VideoTime; - DropFrame:=False; + if fVideoPaused then Exit; + + myTime := Time + fVideoSkipTime; + TimeDifference := myTime - VideoTime; + DropFrame := False; {$IFDEF DebugDisplay} showmessage('Time: '+inttostr(floor(Time*1000))+#13#10+ @@ -404,7 +228,8 @@ begin Exit;// we don't need a new frame now end; - + + VideoTime:=VideoTime+VideoTimeBase; TimeDifference:=myTime-VideoTime; if TimeDifference >= (FRAMEDROPCOUNT-1)*VideoTimeBase then // skip frames @@ -415,37 +240,52 @@ begin {$endif} {$IFDEF DebugDisplay} + showmessage('skipping frames'+#13#10+ 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ 'TimeDiff: '+inttostr(floor(TimeDifference*1000))+#13#10+ 'Time2Skip: '+inttostr(floor((Time-LastFrameTime)*1000))); + {$endif} -// av_seek_frame(VideoFormatContext,VideoStreamIndex,Floor(Time*VideoTimeBase),0); +// av_seek_frame(VideoFormatContext.,VideoStreamIndex,Floor(Time*VideoTimeBase),0); { av_seek_frame(VideoFormatContext,-1,Floor((myTime+VideoTimeBase)*1500000),0); VideoTime:=floor(myTime/VideoTimeBase)*VideoTimeBase;} VideoTime:=VideoTime+FRAMEDROPCOUNT*VideoTimeBase; DropFrame:=True; end; + // av_init_packet(@AVPacket); + AVPacket.data := nil; av_init_packet( AVPacket ); // JB-ffmpeg - + + FrameFinished:=0; // read packets until we have a finished frame (or there are no more packets) // while (FrameFinished=0) and (av_read_frame(VideoFormatContext, @AVPacket)>=0) do while (FrameFinished=0) and (av_read_frame(VideoFormatContext, AVPacket)>=0) do // JB-ffmpeg begin + + // if we got a packet from the video stream, then decode it if (AVPacket.stream_index=VideoStreamIndex) then // errnum:=avcodec_decode_video(VideoCodecContext, AVFrame, @frameFinished , AVPacket.data, AVPacket.size); errnum := avcodec_decode_video(VideoCodecContext, AVFrame, frameFinished , AVPacket.data, AVPacket.size); // JB-ffmpeg - + // release internal packet structure created by av_read_frame // av_free_packet(PAVPacket(@AVPacket)); - av_free_packet( AVPacket ); // JB-ffmpeg + + try + if AVPacket.data <> nil then + av_free_packet( AVPacket ); // JB-ffmpeg + except + // TODO : JB_FFMpeg ... why does this now AV sometimes ( or always !! ) + end; + end; - + + if DropFrame then for droppedFrames:=1 to FRAMEDROPCOUNT do begin FrameFinished:=0; @@ -485,12 +325,12 @@ begin linesize := AVFrameRGB^.linesize[0]; for y:=0 to TexY-1 do begin - System.Move(FrameDataPtr[y*linesize],TexData[3*y*dataX],linesize); + System.Move(FrameDataPtr[y*linesize],fTexData[3*y*dataX],linesize); end; // generate opengl texture out of whatever we got - glBindTexture(GL_TEXTURE_2D, VideoTex); - glTexImage2D(GL_TEXTURE_2D, 0, 3, dataX, dataY, 0, GL_RGB, GL_UNSIGNED_BYTE, TexData); + glBindTexture(GL_TEXTURE_2D, fVideoTex); + glTexImage2D(GL_TEXTURE_2D, 0, 3, dataX, dataY, 0, GL_RGB, GL_UNSIGNED_BYTE, fTexData); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); {$ifdef DebugFrames} @@ -501,20 +341,21 @@ begin end; end; -procedure FFmpegDrawGL(Screen: integer); +procedure TVideoPlayback_ffmpeg.FFmpegDrawGL(Screen: integer); begin // have a nice black background to draw on (even if there were errors opening the vid) - if Screen=1 then begin + if Screen=1 then + begin glClearColor(0,0,0,0); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); end; // exit if there's nothing to draw - if not VideoOpened then Exit; + if not fVideoOpened then Exit; glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, VideoTex); + glBindTexture(GL_TEXTURE_2D, fVideoTex); glbegin(gl_quads); glTexCoord2f( 0, 0); glVertex2f(400-ScaledVideoWidth/2, 300-ScaledVideoHeight/2); glTexCoord2f( 0, TexY/dataY); glVertex2f(400-ScaledVideoWidth/2, 300+ScaledVideoHeight/2); @@ -525,7 +366,8 @@ begin glDisable(GL_BLEND); {$ifdef Info} - if VideoSkipTime+VideoTime+VideoTimeBase < 0 then begin + if VideoSkipTime+VideoTime+VideoTimeBase < 0 then + begin glColor4f(0.7, 1, 0.3, 1); SetFontStyle (1); SetFontItalic(False); @@ -558,4 +400,253 @@ begin {$endif} end; +constructor TVideoPlayback_ffmpeg.create(); +begin + writeln( 'UVideo_FFMpeg - TVideoPlayback_ffmpeg.create()' ); + + writeln( 'UVideo_FFMpeg - av_register_all' ); + av_register_all; + + fVideoOpened := False; + fVideoPaused := False; + +end; + +procedure TVideoPlayback_ffmpeg.init(); +begin + writeln( 'UVideo_FFMpeg - glGenTextures(1, PglUint(@fVideoTex))' ); + glGenTextures(1, PglUint(@fVideoTex)); + + writeln( 'UVideo_FFMpeg - SetLength(fTexData,0)' ); + SetLength(fTexData,0); +end; + + +function TVideoPlayback_ffmpeg.Open( aFileName : string): boolean; // true if succeed +var + errnum, i, x,y: Integer; + lStreamsCount : Integer; + +begin + fVideoOpened := False; + fVideoPaused := False; + VideoTimeBase := 0; + VideoTime := 0; + LastFrameTime := 0; + TimeDifference := 0; + VideoFormatContext := 0; + + writeln( aFileName ); + + errnum := av_open_input_file(VideoFormatContext, pchar( aFileName ), Nil, 0, Nil); + writeln( 'Errnum : ' +inttostr( errnum )); + if(errnum <> 0) then + begin +{$ifdef DebugDisplay} + case errnum of + AVERROR_UNKNOWN: showmessage('failed to open file '+aFileName+#13#10+'AVERROR_UNKNOWN'); + AVERROR_IO: showmessage('failed to open file '+aFileName+#13#10+'AVERROR_IO'); + AVERROR_NUMEXPECTED: showmessage('failed to open file '+aFileName+#13#10+'AVERROR_NUMEXPECTED'); + AVERROR_INVALIDDATA: showmessage('failed to open file '+aFileName+#13#10+'AVERROR_INVALIDDATA'); + AVERROR_NOMEM: showmessage('failed to open file '+aFileName+#13#10+'AVERROR_NOMEM'); + AVERROR_NOFMT: showmessage('failed to open file '+aFileName+#13#10+'AVERROR_NOFMT'); + AVERROR_NOTSUPP: showmessage('failed to open file '+aFileName+#13#10+'AVERROR_NOTSUPP'); + else showmessage('failed to open file '+aFileName+#13#10+'Error number: '+inttostr(Errnum)); + end; +{$ENDIF} + Exit; + end + else + begin + VideoStreamIndex := -1; + AudioStreamIndex := -1; + + // Find which stream contains the video + if( av_find_stream_info(VideoFormatContext) >= 0 ) then + begin + find_stream_ids( VideoFormatContext, VideoStreamIndex, AudioStreamIndex ); + + writeln( 'VideoStreamIndex : ' + inttostr(VideoStreamIndex) ); + writeln( 'AudioStreamIndex : ' + inttostr(AudioStreamIndex) ); + end; + aCodecCtx := VideoFormatContext.streams[ AudioStreamIndex ].codec; + +(* + WantedAudioCodecContext.freq := aCodecCtx^.sample_rate; + WantedAudioCodecContext.format := AUDIO_S16SYS; + WantedAudioCodecContext.channels := aCodecCtx^.channels; + WantedAudioCodecContext.silence := 0; + WantedAudioCodecContext.samples := 1024;//SDL_AUDIO_BUFFER_SIZE; +// WantedAudioCodecContext.callback := audio_callback; + WantedAudioCodecContext.userdata := aCodecCtx; +*) + +(* + if(SDL_OpenAudio(WantedAudioCodecContext, AudioCodecContext) < 0) then + begin + writeln( 'Could not do SDL_OpenAudio' ); + exit; + end; +*) + + if(VideoStreamIndex >= 0) then + begin + VideoCodecContext:=VideoFormatContext^.streams[VideoStreamIndex]^.codec; + VideoCodec:=avcodec_find_decoder(VideoCodecContext^.codec_id); + end + else + begin +{$ifdef DebugDisplay} + showmessage('found no video stream'); +{$ENDIF} + av_close_input_file(VideoFormatContext); + Exit; + end; + + + if(VideoCodec<>Nil) then + begin + errnum:=avcodec_open(VideoCodecContext, VideoCodec); + end else begin +{$ifdef DebugDisplay} + showmessage('no matching codec found'); +{$ENDIF} + avcodec_close(VideoCodecContext); + av_close_input_file(VideoFormatContext); + Exit; + end; + if(errnum >=0) then + begin +{$ifdef DebugDisplay} + showmessage('Found a matching Codec: '+ VideoCodecContext^.Codec.Name +#13#10#13#10+ + ' Width = '+inttostr(VideoCodecContext^.width)+ ', Height='+inttostr(VideoCodecContext^.height)+#13#10+ + ' Aspect : '+inttostr(VideoCodecContext^.sample_aspect_ratio.num)+'/'+inttostr(VideoCodecContext^.sample_aspect_ratio.den)+#13#10+ + ' Framerate : '+inttostr(VideoCodecContext^.time_base.num)+'/'+inttostr(VideoCodecContext^.time_base.den)); +{$endif} + // allocate space for decoded frame and rgb frame + AVFrame:=avcodec_alloc_frame; + AVFrameRGB:=avcodec_alloc_frame; + end; + myBuffer:=Nil; + if(AVFrame <> Nil) and (AVFrameRGB <> Nil) then + begin + myBuffer:=av_malloc(avpicture_get_size(PIX_FMT_RGB24, VideoCodecContext^.width, + VideoCodecContext^.height)); + end; + if myBuffer <> Nil then errnum:=avpicture_fill(PAVPicture(AVFrameRGB), myBuffer, PIX_FMT_RGB24, + VideoCodecContext^.width, VideoCodecContext^.height) + else begin +{$ifdef DebugDisplay} + showmessage('failed to allocate video buffer'); +{$endif} + av_free(AVFrameRGB); + av_free(AVFrame); + avcodec_close(VideoCodecContext); + av_close_input_file(VideoFormatContext); + Exit; + end; + if errnum >=0 then + begin + fVideoOpened:=True; + + TexX := VideoCodecContext^.width; + TexY := VideoCodecContext^.height; + dataX := Round(Power(2, Ceil(Log2(TexX)))); + dataY := Round(Power(2, Ceil(Log2(TexY)))); + SetLength(fTexData,dataX*dataY*3); + // calculate some information for video display + VideoAspect:=VideoCodecContext^.sample_aspect_ratio.num/VideoCodecContext^.sample_aspect_ratio.den; + if (VideoAspect = 0) then + VideoAspect:=VideoCodecContext^.width/VideoCodecContext^.height + else + VideoAspect:=VideoAspect*VideoCodecContext^.width/VideoCodecContext^.height; + if VideoAspect >= 4/3 then + begin + ScaledVideoWidth:=800.0; + ScaledVideoHeight:=800.0/VideoAspect; + end else + begin + ScaledVideoHeight:=600.0; + ScaledVideoWidth:=600.0*VideoAspect; + end; + VideoTimeBase:=VideoCodecContext^.time_base.num/VideoCodecContext^.time_base.den; + // hack to get reasonable timebase for divx +{$ifdef DebugDisplay} + showmessage('framerate: '+inttostr(floor(1/videotimebase))+'fps'); +{$endif} + if VideoTimeBase < 0.02 then // 0.02 <-> 50 fps + begin + VideoTimeBase:=VideoCodecContext^.time_base.den/VideoCodecContext^.time_base.num; + while VideoTimeBase > 50 do VideoTimeBase:=VideoTimeBase/10; + VideoTimeBase:=1/VideoTimeBase; + end; +{$ifdef DebugDisplay} + showmessage('corrected framerate: '+inttostr(floor(1/videotimebase))+'fps'); + + if ((VideoAspect*VideoCodecContext^.width*VideoCodecContext^.height)>200000) then + showmessage('you are trying to play a rather large video'+#13#10+ + 'be prepared to experience some timing problems'); +{$endif} + end; + end; +end; + +procedure TVideoPlayback_ffmpeg.Close; +begin + if fVideoOpened then + begin + av_free(myBuffer); + av_free(AVFrameRGB); + av_free(AVFrame); + + avcodec_close(VideoCodecContext); + av_close_input_file(VideoFormatContext); + + SetLength(fTexData,0); + + fVideoOpened:=False; + end; +end; + +procedure TVideoPlayback_ffmpeg.Play; +begin +end; + +procedure TVideoPlayback_ffmpeg.Pause; +begin + fVideoPaused := not fVideoPaused; +end; + +procedure TVideoPlayback_ffmpeg.Stop; +begin +end; + +procedure TVideoPlayback_ffmpeg.MoveTo(Time: real); +begin + fVideoSkipTime := Time; + + if fVideoSkipTime > 0 then + begin + av_seek_frame(VideoFormatContext,-1,Floor((fVideoSkipTime)*1500000),0); + + VideoTime := fVideoSkipTime; + end; +end; + +function TVideoPlayback_ffmpeg.getPosition: real; +begin + result := 0; +end; + +initialization + singleton_VideoFFMpeg := TVideoPlayback_ffmpeg.create(); + + writeln( 'UVideo_FFMpeg - Register Playback' ); + AudioManager.add( IVideoPlayback( singleton_VideoFFMpeg ) ); + + +finalization + AudioManager.Remove( IVideoPlayback( singleton_VideoFFMpeg ) ); + + end. diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index abb2726e..c32b29e0 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -22,13 +22,15 @@ uses UMenu, ULyrics, TextGL, OpenGL12, +(* {$IFDEF useBASS} bass, {$ENDIF} +*) UThemes, ULCD, UGraphicClasses, - UVideo, +// UVideo, USingScores; type @@ -186,7 +188,8 @@ begin // pause Video if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then - FFmpegTogglePause; + VideoPlayback.Pause; +// FFmpegTogglePause; end else //Pause ausschalten begin @@ -199,7 +202,8 @@ begin // Video if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then - FFmpegTogglePause; + VideoPlayback.Pause; +// FFmpegTogglePause; //SkipSmpeg(PauseTime); Paused := false; @@ -279,7 +283,7 @@ begin Lyrics := TLyricEngine.Create(80,Skin_LyricsT,640,12,80,Skin_LyricsT+36,640,12); - UVideo.Init; + VideoPlayback.Init(); end; procedure TScreenSing.onShow; @@ -432,8 +436,12 @@ begin SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*) // todo: VideoGap and Start time verwursten - FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); - FFmpegSkip(AktSong.VideoGAP + AktSong.Start); +// FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); + VideoPlayback.Open( AktSong.Path + AktSong.Video ); + +// FFmpegSkip(AktSong.VideoGAP + AktSong.Start); + VideoPlayback.position := AktSong.VideoGAP + AktSong.Start; + AktSong.VideoLoaded := true; end; @@ -847,8 +855,11 @@ begin if AktSong.VideoLoaded then begin try - FFmpegGetFrame(Czas.Teraz); - FFmpegDrawGL(ScreenAct); + writeln( 'VideoPlayback.FFmpegGetFrame' ); + VideoPlayback.FFmpegGetFrame(Czas.Teraz); + + writeln( 'VideoPlayback.FFmpegDrawGL' ); + VideoPlayback.FFmpegDrawGL(ScreenAct); // PlaySmpeg; except @@ -862,7 +873,7 @@ begin Log.LogError('Corrupted File: ' + AktSong.Video); try // CloseSmpeg; - FFmpegClose; + VideoPlayback.Close; except end; @@ -1112,14 +1123,15 @@ begin SingDrawBackground; // update and draw movie - if ShowFinish and AktSong.VideoLoaded then begin + if ShowFinish and AktSong.VideoLoaded then + begin try // UpdateSmpeg; // this only draws // todo: find a way to determine, when a new frame is needed // toto: same for the need to skip frames - FFmpegGetFrame(Czas.Teraz); - FFmpegDrawGL(ScreenAct); + VideoPlayback.FFmpegGetFrame(Czas.Teraz); + VideoPlayback.FFmpegDrawGL(ScreenAct); except on E : Exception do begin @@ -1133,7 +1145,7 @@ begin Log.LogError('Corrupted File: ' + AktSong.Video); try // CloseSmpeg; - FFmpegClose; + VideoPlayback.Close; except end; @@ -1213,9 +1225,10 @@ begin Log.LogBenchmark('Creating files', 0); end; - if AktSong.VideoLoaded then begin + if AktSong.VideoLoaded then + begin // CloseSmpeg; - FFmpegClose; + VideoPlayback.Close; AktSong.VideoLoaded := false; // to prevent drawing closed video end; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index de34aa52..44f48f12 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -45,8 +45,12 @@ uses UTexture in 'Classes\UTexture.pas', UMusic in 'Classes\UMusic.pas', - UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', + UMedia_dummy in 'Classes\UMedia_dummy.pas', + + // UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', UAudio_Bass in 'Classes\UAudio_Bass.pas', + UVideo in 'Classes\UVideo.pas', + ULanguage in 'Classes\ULanguage.pas', @@ -83,7 +87,7 @@ uses UCore in 'Classes\UCore.pas', UCoreModule in 'Classes\UCoreModule.pas', UPluginInterface in 'Classes\UPluginInterface.pas', - UVideo in 'Classes\UVideo.pas', + UScreenLoading in 'Screens\UScreenLoading.pas', UScreenWelcome in 'Screens\UScreenWelcome.pas', UScreenMain in 'Screens\UScreenMain.pas', @@ -134,6 +138,11 @@ var begin WndTitle := Version; +// InitializeSound(); +// writeln( 'DONE' ); +// exit; + + //------------------------------ //Start more than One Time Prevention //------------------------------ @@ -243,6 +252,7 @@ begin Log.LogBenchmark('Loading Light', 1); + // Theme Log.BenchmarkStart(1); Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); @@ -262,8 +272,6 @@ begin Log.BenchmarkEnd(1); Log.LogBenchmark('Loading Category Covers Array', 1); - - // Songs //Log.BenchmarkStart(1); Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; @@ -287,18 +295,19 @@ begin Log.BenchmarkEnd(1); Log.LogBenchmark('Loading PartySession Manager', 1); - // Graphics - Log.BenchmarkStart(1); - Log.LogStatus('Initialize 3D', 'Initialization'); Initialize3D(WndTitle); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing 3D', 1); - // Sound Log.BenchmarkStart(1); Log.LogStatus('Initialize Sound', 'Initialization'); InitializeSound(); Log.BenchmarkEnd(1); Log.LogBenchmark('Initializing Sound', 1); + + // Graphics + Log.BenchmarkStart(1); + Log.LogStatus('Initialize 3D', 'Initialization'); Initialize3D(WndTitle); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing 3D', 1); + // Score Saving System Log.BenchmarkStart(1); Log.LogStatus('DataBase System', 'Initialization'); diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index 56c1ef92..e74caf81 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -121,6 +121,7 @@ uses ULyrics_bak in 'Classes\ULyrics_bak.pas', UMain in 'Classes\UMain.pas', UMusic in 'Classes\UMusic.pas', + UMedia_dummy in 'Classes\UMedia_dummy.pas', // UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', {$ifdef win32} UAudio_bass in 'Classes\UAudio_bass.pas', -- cgit v1.2.3 From 659f88b3328ab25380777d2f04124ff5e5c444ba Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 16 Oct 2007 11:36:18 +0000 Subject: tidy up un-needed uses clauses.. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@516 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 6 ------ Game/Code/Screens/UScreenSingModi.pas | 4 +--- Game/Code/UltraStar.dpr | 2 +- 3 files changed, 2 insertions(+), 10 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index c32b29e0..542326d2 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -22,15 +22,9 @@ uses UMenu, ULyrics, TextGL, OpenGL12, -(* - {$IFDEF useBASS} - bass, - {$ENDIF} -*) UThemes, ULCD, UGraphicClasses, -// UVideo, USingScores; type diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index b6989c76..e2d53f0a 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -21,9 +21,7 @@ uses UMenu, ULyrics, TextGL, OpenGL12, - {$IFDEF useBASS} - bass, - {$ENDIF} + UThemes, ULCD, UScreenSing, diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 44f48f12..9cdbca50 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -49,7 +49,7 @@ uses // UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', UAudio_Bass in 'Classes\UAudio_Bass.pas', - UVideo in 'Classes\UVideo.pas', + UVideo in 'Classes\UVideo.pas', -- cgit v1.2.3 From f392b84c00dbcefa6f0d0d50b208f748d3dc940b Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 16 Oct 2007 11:44:55 +0000 Subject: fixed WinLaz build.. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@517 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudio_bass.pas | 1 + 1 file changed, 1 insertion(+) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudio_bass.pas b/Game/Code/Classes/UAudio_bass.pas index 5aecfc89..985eede5 100644 --- a/Game/Code/Classes/UAudio_bass.pas +++ b/Game/Code/Classes/UAudio_bass.pas @@ -30,6 +30,7 @@ uses URecord, UIni, UMain, + UCommon, UThemes; const -- cgit v1.2.3 From 7b2b341341c0434a6b39d0f0f36fda9b7d23d0ef Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 16 Oct 2007 11:57:37 +0000 Subject: fixed the modified ffmpeg headers to compile in lazarus on windows. this NOW should fix LazWin build. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@518 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.lpr | 970 ++++----- Game/Code/lib/ffmpeg/avcodec.pas | 4076 +++++++++++++++++++------------------ Game/Code/lib/ffmpeg/avformat.pas | 5 +- Game/Code/lib/ffmpeg/avutil.pas | 284 +-- 4 files changed, 2670 insertions(+), 2665 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index e74caf81..0399c389 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -1,485 +1,485 @@ -program UltraStar; - -{$DEFINE TRANSLATE} - -{$IFDEF FPC} - {$MODE DELPHI} -{$ELSE} - {$R 'UltraStar.res' 'UltraStar.rc'} -{$ENDIF} - -{$I switches.inc} - -uses - - // *************************************************************************** - // - // Developers PLEASE NOTE !!!!!!! - // - // As of september 2007, I am working towards porting Ultrastar-DX to run - // on Linux. I will be modifiying the source to make it compile in lazarus - // on windows & linux and I will make sure that it compiles in delphi still - // To help me in this endevour, please can you make a point of remembering - // that linux is CASE SENSATIVE, and file / unit names must be as per - // the filename exactly. - // - // EG : opengl12.pas must not be OpenGL in the uses cluase. - // - // thanks for your help... - // - // *************************************************************************** - - // Interesting stuff... :) - // http://burningsmell.org/sdl_audioin/ - - - //------------------------------ - //Includes - 3rd Party Libraries - //------------------------------ - - // SDL / OpenGL - moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', - opengl12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\opengl12.pas', - sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', - sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', - sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', - sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', - - - // Bass - {$IFDEF UseBASS} - bass in 'lib\bass\delphi\bass.pas', - {$ENDIF} - - // Midi Units - {$IFDEF UseMIDIPort} - Circbuf in 'lib\midi\CIRCBUF.PAS', - Delphmcb in 'lib\midi\Delphmcb.PAS', - MidiCons in 'lib\midi\MidiCons.PAS', - MidiDefs in 'lib\midi\MidiDefs.PAS', - MidiFile in 'lib\midi\MidiFile.PAS', - midiin in 'lib\midi\midiin.pas', - midiout in 'lib\midi\midiout.pas', - MidiType in 'lib\midi\MidiType.PAS', - {$ENDIF} - - // FFMpeg units - avcodec in 'lib\ffmpeg\avcodec.pas', - avformat in 'lib\ffmpeg\avformat.pas', - avio in 'lib\ffmpeg\avio.pas', - avutil in 'lib\ffmpeg\avutil.pas', - opt in 'lib\ffmpeg\opt.pas', - rational in 'lib\ffmpeg\rational.pas', - - - // Sql Lite - SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', - SQLite3 in 'lib\SQLite\SQLite3.pas', - - - //------------------------------ - //Includes - Menu System - //------------------------------ - - UDisplay in 'Menu\UDisplay.pas', - UDrawTexture in 'Menu\UDrawTexture.pas', - UMenu in 'Menu\UMenu.pas', - UMenuButton in 'Menu\UMenuButton.pas', - UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', - UMenuInteract in 'Menu\UMenuInteract.pas', - UMenuSelect in 'Menu\UMenuSelect.pas', - UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', - UMenuStatic in 'Menu\UMenuStatic.pas', - UMenuText in 'Menu\UMenuText.pas', - - //------------------------------ - //Includes - Classes - //------------------------------ - - {$IFDEF FPC} - ulazjpeg in 'Classes\Ulazjpeg.pas', - {$ENDIF} - - TextGL in 'Classes\TextGL.pas', - UCatCovers in 'Classes\UCatCovers.pas', - UCommandLine in 'Classes\UCommandLine.pas', - UCommon in 'Classes\UCommon.pas', - UCovers in 'Classes\UCovers.pas', - UDataBase in 'Classes\UDataBase.pas', - UDLLManager in 'Classes\UDLLManager.pas', - UDraw in 'Classes\UDraw.pas', - UFiles in 'Classes\UFiles.pas', - UGraphic in 'Classes\UGraphic.pas', - UGraphicClasses in 'Classes\UGraphicClasses.pas', - UIni in 'Classes\UIni.pas', - UJoystick in 'Classes\UJoystick.pas', - ULanguage in 'Classes\ULanguage.pas', - ULCD in 'Classes\ULCD.pas', - ULight in 'Classes\ULight.pas', - ULog in 'Classes\ULog.pas', - ULyrics in 'Classes\ULyrics.pas', - ULyrics_bak in 'Classes\ULyrics_bak.pas', - UMain in 'Classes\UMain.pas', - UMusic in 'Classes\UMusic.pas', - UMedia_dummy in 'Classes\UMedia_dummy.pas', -// UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', -{$ifdef win32} - UAudio_bass in 'Classes\UAudio_bass.pas', -{$endif} - - UParty in 'Classes\UParty.pas', - UPlaylist in 'Classes\UPlaylist.pas', - URecord in 'Classes\URecord.pas', - USkins in 'Classes\USkins.pas', - USingScores in 'Classes\USingScores.pas', - USongs in 'Classes\USongs.pas', - UTexture in 'Classes\UTexture.pas', - UThemes in 'Classes\UThemes.pas', - UTime in 'Classes\UTime.pas', - USingNotes in 'Classes\USingNotes.pas', - - - //------------------------------ - //Includes - Video Support - //------------------------------ - UVideo in 'Classes\UVideo.pas', - - - //------------------------------ - //Includes - Screens - //------------------------------ - UScreenCredits in 'Screens\UScreenCredits.pas', - UScreenEdit in 'Screens\UScreenEdit.pas', - UScreenEditConvert in 'Screens\UScreenEditConvert.pas', - UScreenEditHeader in 'Screens\UScreenEditHeader.pas', - UScreenEditSub in 'Screens\UScreenEditSub.pas', - UScreenLevel in 'Screens\UScreenLevel.pas', - UScreenLoading in 'Screens\UScreenLoading.pas', - UScreenMain in 'Screens\UScreenMain.pas', - UScreenName in 'Screens\UScreenName.pas', - UScreenOpen in 'Screens\UScreenOpen.pas', - UScreenOptions in 'Screens\UScreenOptions.pas', - UScreenOptionsAdvanced in 'Screens\UScreenOptionsAdvanced.pas', - UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', - UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', - UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', - UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', - UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', - UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', - UScreenPopup in 'Screens\UScreenPopup.pas', - UScreenScore in 'Screens\UScreenScore.pas', - UScreenSing in 'Screens\UScreenSing.pas', - UScreenSong in 'Screens\UScreenSong.pas', - UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', - UScreenSongMenu in 'Screens\UScreenSongMenu.pas', - UScreenStatDetail in 'Screens\UScreenStatDetail.pas', - UScreenStatMain in 'Screens\UScreenStatMain.pas', - UScreenTop5 in 'Screens\UScreenTop5.pas', - UScreenWelcome in 'Screens\UScreenWelcome.pas', - - //------------------------------ - //Includes - Screens PartyMode - //------------------------------ - UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', - UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', - UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', - UScreenPartyScore in 'Screens\UScreenPartyScore.pas', - UScreenPartyWin in 'Screens\UScreenPartyWin.pas', - UScreenSingModi in 'Screens\UScreenSingModi.pas', - - //------------------------------ - //Includes - Modi SDK - //------------------------------ - ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', - - - //------------------------------ - //Includes - Delphi - //------------------------------ - {$IFDEF win32} - Windows, - {$ENDIF} - SysUtils; - -const - Version = 'UltraStar Deluxe V 1.10 Alpha Build'; - -var - WndTitle: string; - hWnd: THandle; - I: Integer; - - aFormatCtx : PAVFormatContext;//PAVCodecContext; - aCodecCtx : PAVCodecContext; - VideoStreamIndex, - AudioStreamIndex : integer; - -begin - - - -(* - -av_register_all; -aFormatCtx := av_alloc_format_context(); -if av_open_input_file( aFormatCtx, pchar( Paramstr(1) ), NIL, 0, NIL) = 0 then -begin - if av_find_stream_info( aFormatCtx ) >= 0 then - begin - writeln(''); - dump_format(aFormatCtx, 0, pchar( Paramstr(1) ), 0); - writeln(''); - -// writeln( pchar( filename ) ); - -// av_read_play( aFormatCtx ); - find_stream_ids( aFormatCtx , VideoStreamIndex , AudioStreamIndex ); - - writeln( 'VideoStreamIndex : ' + inttostr(VideoStreamIndex) ); - writeln( 'AudioStreamIndex : ' + inttostr(AudioStreamIndex) ); - - aCodecCtx := aFormatCtx.streams[ AudioStreamIndex ].codec; - writeln( 'Audio Codec Channels: '+ inttostr( integer( aCodecCtx.channels ) ) ); - writeln( 'Audio Codec freq: '+ inttostr( integer( aCodecCtx.sample_rate ) ) ); - - wanted_spec.freq = aCodecCtx->sample_rate; - wanted_spec.format = AUDIO_S16SYS; - wanted_spec.channels = aCodecCtx->channels; - wanted_spec.silence = 0; - wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE; - wanted_spec.callback = audio_callback; - wanted_spec.userdata = aCodecCtx; - - if(SDL_OpenAudio(&wanted_spec, aCodecCtx) < 0) then - begin - writeln( 'Could not do SDL_OpenAudio' ); - exit; - end; - - - end; -end; - -exit; -*) - - WndTitle := Version; - - - {$ifdef Win32} - //------------------------------ - //Start more than One Time Prevention - //------------------------------ - hWnd:= FindWindow(nil, PChar(WndTitle)); - //Programm already started - if (hWnd <> 0) then - begin - I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Contìnue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); - if (I = IDYes) then - begin - I := 1; - repeat - Inc(I); - hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); - until (hWnd = 0); - - WndTitle := WndTitle + ' Instance ' + InttoStr(I); - end - else - Exit; - end; - {$endif} - - //------------------------------ - //StartUp - Create Classes and Load Files - //------------------------------ - USTime := TTime.Create; - - // Commandline Parameter Parser - Params := TCMDParams.Create; - - // Log + Benchmark - Log := TLog.Create; - Log.Title := WndTitle; - Log.Enabled := Not Params.NoLog; - Log.BenchmarkStart(0); - - // Language - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Paths', 'Initialization'); InitializePaths; - Log.LogStatus('Load Language', 'Initialization'); Language := TLanguage.Create; - //Add Const Values: - Language.AddConst('US_VERSION', Version); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Language', 1); - - // SDL - Log.BenchmarkStart(1); - Log.LogStatus('Initialize SDL', 'Initialization'); - SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing SDL', 1); - - // Skin - Log.BenchmarkStart(1); - Log.LogStatus('Loading Skin List', 'Initialization'); Skin := TSkin.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Skin List', 1); - - // Sound Card List - Log.BenchmarkStart(1); - Log.LogStatus('Loading Soundcard list', 'Initialization'); - Recording := TRecord.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Soundcard list', 1); - - // Ini + Paths - Log.BenchmarkStart(1); - Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; - Ini.Load; - - //Load Languagefile - if (Params.Language <> -1) then - Language.ChangeLanguage(ILanguage[Params.Language]) - else - Language.ChangeLanguage(ILanguage[Ini.Language]); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Ini', 1); - - // LCD - Log.BenchmarkStart(1); - Log.LogStatus('Load LCD', 'Initialization'); LCD := TLCD.Create; - if Ini.LPT = 1 then begin -// LCD.HalfInterface := true; - LCD.Enable; - LCD.Clear; - LCD.WriteText(1, ' UltraStar '); - LCD.WriteText(2, ' Loading... '); - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading LCD', 1); - - // Light - Log.BenchmarkStart(1); - Log.LogStatus('Load Light', 'Initialization'); Light := TLight.Create; - if Ini.LPT = 2 then begin - Light.Enable; - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Light', 1); - - // Theme - Log.BenchmarkStart(1); - Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Themes', 1); - - // Covers Cache - Log.BenchmarkStart(1); - Log.LogStatus('Creating Covers Cache', 'Initialization'); Covers := TCovers.Create; - Log.LogBenchmark('Loading Covers Cache Array', 1); - Log.BenchmarkStart(1); - - // Category Covers - Log.BenchmarkStart(1); - Log.LogStatus('Creating Category Covers Array', 'Initialization'); - CatCovers:= TCatCovers.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Category Covers Array', 1); - - // Songs - //Log.BenchmarkStart(1); - Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; - Songs.LoadSongList; - Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Songs', 1); - - // PluginManager - Log.BenchmarkStart(1); - Log.LogStatus('PluginManager', 'Initialization'); - DLLMan := TDLLMan.Create; //Load PluginList - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PluginManager', 1); - - // Party Mode Manager - Log.BenchmarkStart(1); - Log.LogStatus('PartySession Manager', 'Initialization'); - PartySession := TParty_Session.Create; //Load PartySession - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PartySession Manager', 1); - - // Graphics - Log.BenchmarkStart(1); - Log.LogStatus('Initialize 3D', 'Initialization'); Initialize3D(WndTitle); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing 3D', 1); - - // Sound - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Sound', 'Initialization'); InitializeSound(); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Sound', 1); - - // Score Saving System - Log.BenchmarkStart(1); - Log.LogStatus('DataBase System', 'Initialization'); - DataBase := TDataBaseSystem.Create; - - if (Params.ScoreFile = '') then - DataBase.Init ('Ultrastar.db') - else - DataBase.Init (Params.ScoreFile); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading DataBase System', 1); - - //Playlist Manager - Log.BenchmarkStart(1); - Log.LogStatus('Playlist Manager', 'Initialization'); - PlaylistMan := TPlaylistManager.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Playlist Manager', 1); - - //GoldenStarsTwinkleMod - Log.BenchmarkStart(1); - Log.LogStatus('Effect Manager', 'Initialization'); - GoldenRec := TEffectManager.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Particel System', 1); - - // Joypad - if (Ini.Joypad = 1) OR (Params.Joypad) then begin - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Joystick', 'Initialization'); Joy := TJoy.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Joystick', 1); - end; - - Log.BenchmarkEnd(0); - Log.LogBenchmark('Loading Time', 0); - - - //------------------------------ - //Start- Mainloop - //------------------------------ - //Music.SetLoop(true); - //Music.SetVolume(50); - //Music.Open(SkinPath + 'Menu Music 3.mp3'); - //Music.Play; - Log.LogStatus('Main Loop', 'Initialization'); MainLoop; - - Log.LogStatus('Cleanup', 'Done'); - - //------------------------------ - //Finish Application - //------------------------------ - if Ini.LPT = 1 then LCD.Clear; - if Ini.LPT = 2 then Light.TurnOff; - - // Insignificant change.. - - Log.Free; -end. +program UltraStar; + +{$DEFINE TRANSLATE} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ELSE} + {$R 'UltraStar.res' 'UltraStar.rc'} +{$ENDIF} + +{$I switches.inc} + +uses + + // *************************************************************************** + // + // Developers PLEASE NOTE !!!!!!! + // + // As of september 2007, I am working towards porting Ultrastar-DX to run + // on Linux. I will be modifiying the source to make it compile in lazarus + // on windows & linux and I will make sure that it compiles in delphi still + // To help me in this endevour, please can you make a point of remembering + // that linux is CASE SENSATIVE, and file / unit names must be as per + // the filename exactly. + // + // EG : opengl12.pas must not be OpenGL in the uses cluase. + // + // thanks for your help... + // + // *************************************************************************** + + // Interesting stuff... :) + // http://burningsmell.org/sdl_audioin/ + + + //------------------------------ + //Includes - 3rd Party Libraries + //------------------------------ + + // SDL / OpenGL + moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', + opengl12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\opengl12.pas', + sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', + sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', + sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', + sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', + + + // Bass + {$IFDEF UseBASS} + bass in 'lib\bass\delphi\bass.pas', + {$ENDIF} + + // Midi Units + {$IFDEF UseMIDIPort} + Circbuf in 'lib\midi\CIRCBUF.PAS', + Delphmcb in 'lib\midi\Delphmcb.PAS', + MidiCons in 'lib\midi\MidiCons.PAS', + MidiDefs in 'lib\midi\MidiDefs.PAS', + MidiFile in 'lib\midi\MidiFile.PAS', + midiin in 'lib\midi\midiin.pas', + midiout in 'lib\midi\midiout.pas', + MidiType in 'lib\midi\MidiType.PAS', + {$ENDIF} + + // FFMpeg units + avcodec in 'lib\ffmpeg\avcodec.pas', + avformat in 'lib\ffmpeg\avformat.pas', + avio in 'lib\ffmpeg\avio.pas', + avutil in 'lib\ffmpeg\avutil.pas', + opt in 'lib\ffmpeg\opt.pas', + rational in 'lib\ffmpeg\rational.pas', + + + // Sql Lite + SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', + SQLite3 in 'lib\SQLite\SQLite3.pas', + + + //------------------------------ + //Includes - Menu System + //------------------------------ + + UDisplay in 'Menu\UDisplay.pas', + UDrawTexture in 'Menu\UDrawTexture.pas', + UMenu in 'Menu\UMenu.pas', + UMenuButton in 'Menu\UMenuButton.pas', + UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', + UMenuInteract in 'Menu\UMenuInteract.pas', + UMenuSelect in 'Menu\UMenuSelect.pas', + UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', + UMenuStatic in 'Menu\UMenuStatic.pas', + UMenuText in 'Menu\UMenuText.pas', + + //------------------------------ + //Includes - Classes + //------------------------------ + + {$IFDEF FPC} + ulazjpeg in 'Classes\Ulazjpeg.pas', + {$ENDIF} + + TextGL in 'Classes\TextGL.pas', + UCatCovers in 'Classes\UCatCovers.pas', + UCommandLine in 'Classes\UCommandLine.pas', + UCommon in 'Classes\UCommon.pas', + UCovers in 'Classes\UCovers.pas', + UDataBase in 'Classes\UDataBase.pas', + UDLLManager in 'Classes\UDLLManager.pas', + UDraw in 'Classes\UDraw.pas', + UFiles in 'Classes\UFiles.pas', + UGraphic in 'Classes\UGraphic.pas', + UGraphicClasses in 'Classes\UGraphicClasses.pas', + UIni in 'Classes\UIni.pas', + UJoystick in 'Classes\UJoystick.pas', + ULanguage in 'Classes\ULanguage.pas', + ULCD in 'Classes\ULCD.pas', + ULight in 'Classes\ULight.pas', + ULog in 'Classes\ULog.pas', + ULyrics in 'Classes\ULyrics.pas', + ULyrics_bak in 'Classes\ULyrics_bak.pas', + UMain in 'Classes\UMain.pas', + UMusic in 'Classes\UMusic.pas', + UMedia_dummy in 'Classes\UMedia_dummy.pas', +// UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', +{$ifdef win32} + UAudio_bass in 'Classes\UAudio_bass.pas', +{$endif} + + UParty in 'Classes\UParty.pas', + UPlaylist in 'Classes\UPlaylist.pas', + URecord in 'Classes\URecord.pas', + USkins in 'Classes\USkins.pas', + USingScores in 'Classes\USingScores.pas', + USongs in 'Classes\USongs.pas', + UTexture in 'Classes\UTexture.pas', + UThemes in 'Classes\UThemes.pas', + UTime in 'Classes\UTime.pas', + USingNotes in 'Classes\USingNotes.pas', + + + //------------------------------ + //Includes - Video Support + //------------------------------ + UVideo in 'Classes\UVideo.pas', + + + //------------------------------ + //Includes - Screens + //------------------------------ + UScreenCredits in 'Screens\UScreenCredits.pas', + UScreenEdit in 'Screens\UScreenEdit.pas', + UScreenEditConvert in 'Screens\UScreenEditConvert.pas', + UScreenEditHeader in 'Screens\UScreenEditHeader.pas', + UScreenEditSub in 'Screens\UScreenEditSub.pas', + UScreenLevel in 'Screens\UScreenLevel.pas', + UScreenLoading in 'Screens\UScreenLoading.pas', + UScreenMain in 'Screens\UScreenMain.pas', + UScreenName in 'Screens\UScreenName.pas', + UScreenOpen in 'Screens\UScreenOpen.pas', + UScreenOptions in 'Screens\UScreenOptions.pas', + UScreenOptionsAdvanced in 'Screens\UScreenOptionsAdvanced.pas', + UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', + UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', + UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', + UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', + UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', + UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', + UScreenPopup in 'Screens\UScreenPopup.pas', + UScreenScore in 'Screens\UScreenScore.pas', + UScreenSing in 'Screens\UScreenSing.pas', + UScreenSong in 'Screens\UScreenSong.pas', + UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', + UScreenSongMenu in 'Screens\UScreenSongMenu.pas', + UScreenStatDetail in 'Screens\UScreenStatDetail.pas', + UScreenStatMain in 'Screens\UScreenStatMain.pas', + UScreenTop5 in 'Screens\UScreenTop5.pas', + UScreenWelcome in 'Screens\UScreenWelcome.pas', + + //------------------------------ + //Includes - Screens PartyMode + //------------------------------ + UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', + UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', + UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', + UScreenPartyScore in 'Screens\UScreenPartyScore.pas', + UScreenPartyWin in 'Screens\UScreenPartyWin.pas', + UScreenSingModi in 'Screens\UScreenSingModi.pas', + + //------------------------------ + //Includes - Modi SDK + //------------------------------ + ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', + + + //------------------------------ + //Includes - Delphi + //------------------------------ + {$IFDEF win32} + Windows, + {$ENDIF} + SysUtils; + +const + Version = 'UltraStar Deluxe V 1.10 Alpha Build'; + +var + WndTitle: string; + hWnd: THandle; + I: Integer; + + aFormatCtx : PAVFormatContext;//PAVCodecContext; + aCodecCtx : PAVCodecContext; + VideoStreamIndex, + AudioStreamIndex : integer; + +begin + + + +(* + +av_register_all; +aFormatCtx := av_alloc_format_context(); +if av_open_input_file( aFormatCtx, pchar( Paramstr(1) ), NIL, 0, NIL) = 0 then +begin + if av_find_stream_info( aFormatCtx ) >= 0 then + begin + writeln(''); + dump_format(aFormatCtx, 0, pchar( Paramstr(1) ), 0); + writeln(''); + +// writeln( pchar( filename ) ); + +// av_read_play( aFormatCtx ); + find_stream_ids( aFormatCtx , VideoStreamIndex , AudioStreamIndex ); + + writeln( 'VideoStreamIndex : ' + inttostr(VideoStreamIndex) ); + writeln( 'AudioStreamIndex : ' + inttostr(AudioStreamIndex) ); + + aCodecCtx := aFormatCtx.streams[ AudioStreamIndex ].codec; + writeln( 'Audio Codec Channels: '+ inttostr( integer( aCodecCtx.channels ) ) ); + writeln( 'Audio Codec freq: '+ inttostr( integer( aCodecCtx.sample_rate ) ) ); + + wanted_spec.freq = aCodecCtx->sample_rate; + wanted_spec.format = AUDIO_S16SYS; + wanted_spec.channels = aCodecCtx->channels; + wanted_spec.silence = 0; + wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE; + wanted_spec.callback = audio_callback; + wanted_spec.userdata = aCodecCtx; + + if(SDL_OpenAudio(&wanted_spec, aCodecCtx) < 0) then + begin + writeln( 'Could not do SDL_OpenAudio' ); + exit; + end; + + + end; +end; + +exit; +*) + + WndTitle := Version; + + + {$ifdef Win32} + //------------------------------ + //Start more than One Time Prevention + //------------------------------ + hWnd:= FindWindow(nil, PChar(WndTitle)); + //Programm already started + if (hWnd <> 0) then + begin + I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Contìnue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); + if (I = IDYes) then + begin + I := 1; + repeat + Inc(I); + hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); + until (hWnd = 0); + + WndTitle := WndTitle + ' Instance ' + InttoStr(I); + end + else + Exit; + end; + {$endif} + + //------------------------------ + //StartUp - Create Classes and Load Files + //------------------------------ + USTime := TTime.Create; + + // Commandline Parameter Parser + Params := TCMDParams.Create; + + // Log + Benchmark + Log := TLog.Create; + Log.Title := WndTitle; + Log.Enabled := Not Params.NoLog; + Log.BenchmarkStart(0); + + // Language + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Paths', 'Initialization'); InitializePaths; + Log.LogStatus('Load Language', 'Initialization'); Language := TLanguage.Create; + //Add Const Values: + Language.AddConst('US_VERSION', Version); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Language', 1); + + // SDL + Log.BenchmarkStart(1); + Log.LogStatus('Initialize SDL', 'Initialization'); + SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing SDL', 1); + + // Skin + Log.BenchmarkStart(1); + Log.LogStatus('Loading Skin List', 'Initialization'); Skin := TSkin.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Skin List', 1); + + // Sound Card List + Log.BenchmarkStart(1); + Log.LogStatus('Loading Soundcard list', 'Initialization'); + Recording := TRecord.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Soundcard list', 1); + + // Ini + Paths + Log.BenchmarkStart(1); + Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; + Ini.Load; + + //Load Languagefile + if (Params.Language <> -1) then + Language.ChangeLanguage(ILanguage[Params.Language]) + else + Language.ChangeLanguage(ILanguage[Ini.Language]); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Ini', 1); + + // LCD + Log.BenchmarkStart(1); + Log.LogStatus('Load LCD', 'Initialization'); LCD := TLCD.Create; + if Ini.LPT = 1 then begin +// LCD.HalfInterface := true; + LCD.Enable; + LCD.Clear; + LCD.WriteText(1, ' UltraStar '); + LCD.WriteText(2, ' Loading... '); + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading LCD', 1); + + // Light + Log.BenchmarkStart(1); + Log.LogStatus('Load Light', 'Initialization'); Light := TLight.Create; + if Ini.LPT = 2 then begin + Light.Enable; + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Light', 1); + + // Theme + Log.BenchmarkStart(1); + Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Themes', 1); + + // Covers Cache + Log.BenchmarkStart(1); + Log.LogStatus('Creating Covers Cache', 'Initialization'); Covers := TCovers.Create; + Log.LogBenchmark('Loading Covers Cache Array', 1); + Log.BenchmarkStart(1); + + // Category Covers + Log.BenchmarkStart(1); + Log.LogStatus('Creating Category Covers Array', 'Initialization'); + CatCovers:= TCatCovers.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Category Covers Array', 1); + + // Songs + //Log.BenchmarkStart(1); + Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; + Songs.LoadSongList; + Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Songs', 1); + + // PluginManager + Log.BenchmarkStart(1); + Log.LogStatus('PluginManager', 'Initialization'); + DLLMan := TDLLMan.Create; //Load PluginList + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PluginManager', 1); + + // Party Mode Manager + Log.BenchmarkStart(1); + Log.LogStatus('PartySession Manager', 'Initialization'); + PartySession := TParty_Session.Create; //Load PartySession + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PartySession Manager', 1); + + // Graphics + Log.BenchmarkStart(1); + Log.LogStatus('Initialize 3D', 'Initialization'); Initialize3D(WndTitle); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing 3D', 1); + + // Sound + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Sound', 'Initialization'); InitializeSound(); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Sound', 1); + + // Score Saving System + Log.BenchmarkStart(1); + Log.LogStatus('DataBase System', 'Initialization'); + DataBase := TDataBaseSystem.Create; + + if (Params.ScoreFile = '') then + DataBase.Init ('Ultrastar.db') + else + DataBase.Init (Params.ScoreFile); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading DataBase System', 1); + + //Playlist Manager + Log.BenchmarkStart(1); + Log.LogStatus('Playlist Manager', 'Initialization'); + PlaylistMan := TPlaylistManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Playlist Manager', 1); + + //GoldenStarsTwinkleMod + Log.BenchmarkStart(1); + Log.LogStatus('Effect Manager', 'Initialization'); + GoldenRec := TEffectManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Particel System', 1); + + // Joypad + if (Ini.Joypad = 1) OR (Params.Joypad) then begin + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Joystick', 'Initialization'); Joy := TJoy.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Joystick', 1); + end; + + Log.BenchmarkEnd(0); + Log.LogBenchmark('Loading Time', 0); + + + //------------------------------ + //Start- Mainloop + //------------------------------ + //Music.SetLoop(true); + //Music.SetVolume(50); + //Music.Open(SkinPath + 'Menu Music 3.mp3'); + //Music.Play; + Log.LogStatus('Main Loop', 'Initialization'); MainLoop; + + Log.LogStatus('Cleanup', 'Done'); + + //------------------------------ + //Finish Application + //------------------------------ + if Ini.LPT = 1 then LCD.Clear; + if Ini.LPT = 2 then Light.TurnOff; + + // Insignificant change.. + + Log.Free; +end. diff --git a/Game/Code/lib/ffmpeg/avcodec.pas b/Game/Code/lib/ffmpeg/avcodec.pas index 9c232fff..bcfe9809 100644 --- a/Game/Code/lib/ffmpeg/avcodec.pas +++ b/Game/Code/lib/ffmpeg/avcodec.pas @@ -1,2041 +1,2043 @@ - (* - * copyright (c) 2001 Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - *) - -(* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. -For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT -in the source codes *) - -unit avcodec; - -{$IFDEF FPC} - {$LINKLIB libavutil} - {$LINKLIB libavcodec} - {$MODE DELPHI } (* CAT *) - {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) - {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) -{$ENDIF} - -interface - -uses - avutil, rational, opt; // CAT - -const -{$IFDEF win32} + (* + * copyright (c) 2001 Fabrice Bellard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *) + +(* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. +For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT +in the source codes *) + +unit avcodec; + +{$IFDEF FPC} + {$IFNDEF win32} + {$LINKLIB libavutil} + {$LINKLIB libavcodec} + {$ENDIF} + {$MODE DELPHI } (* CAT *) + {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) + {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) +{$ENDIF} + +interface + +uses + avutil, rational, opt; // CAT + +const +{$IFDEF win32} av__format = 'avformat-50.dll'; {$ELSE} av__format = 'libavformat.so'; // .0d // av__format = 'libavformat.51'; -{$ENDIF} - - - LIBAVUTIL_VERSION_INT = ((51 shl 16) + (12 shl 8) + 1); - LIBAVUTIL_VERSION = '51.12.1'; - LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; - - AV_NOPTS_VALUE: int64 = $8000000000000000; - AV_TIME_BASE = 1000000; - AV_TIME_BASE_Q : TAVRational = (num:1; den:AV_TIME_BASE); (* added by CAT *) - -type - TCodecID = ( - CODEC_ID_NONE, CODEC_ID_MPEG1VIDEO, - CODEC_ID_MPEG2VIDEO, //* prefered ID for MPEG Video 1 or 2 decoding */ - CODEC_ID_MPEG2VIDEO_XVMC, CODEC_ID_H261, CODEC_ID_H263, CODEC_ID_RV10, - CODEC_ID_RV20, CODEC_ID_MJPEG, CODEC_ID_MJPEGB, CODEC_ID_LJPEG, - CODEC_ID_SP5X, CODEC_ID_JPEGLS, CODEC_ID_MPEG4, CODEC_ID_RAWVIDEO, - CODEC_ID_MSMPEG4V1, CODEC_ID_MSMPEG4V2, CODEC_ID_MSMPEG4V3, - CODEC_ID_WMV1, CODEC_ID_WMV2, CODEC_ID_H263P, - CODEC_ID_H263I, CODEC_ID_FLV1, CODEC_ID_SVQ1, CODEC_ID_SVQ3, - CODEC_ID_DVVIDEO, CODEC_ID_HUFFYUV, CODEC_ID_CYUV, CODEC_ID_H264, - CODEC_ID_INDEO3, CODEC_ID_VP3, CODEC_ID_THEORA, CODEC_ID_ASV1, - CODEC_ID_ASV2, CODEC_ID_FFV1, CODEC_ID_4XM, CODEC_ID_VCR1, - CODEC_ID_CLJR, CODEC_ID_MDEC, CODEC_ID_ROQ, CODEC_ID_INTERPLAY_VIDEO, - CODEC_ID_XAN_WC3, CODEC_ID_XAN_WC4, CODEC_ID_RPZA, CODEC_ID_CINEPAK, - CODEC_ID_WS_VQA, CODEC_ID_MSRLE, CODEC_ID_MSVIDEO1, CODEC_ID_IDCIN, - CODEC_ID_8BPS, CODEC_ID_SMC, CODEC_ID_FLIC, CODEC_ID_TRUEMOTION1, - CODEC_ID_VMDVIDEO, CODEC_ID_MSZH, CODEC_ID_ZLIB, CODEC_ID_QTRLE, - CODEC_ID_SNOW, CODEC_ID_TSCC, CODEC_ID_ULTI, CODEC_ID_QDRAW, - CODEC_ID_VIXL, CODEC_ID_QPEG, CODEC_ID_XVID, CODEC_ID_PNG, - CODEC_ID_PPM, CODEC_ID_PBM, CODEC_ID_PGM, CODEC_ID_PGMYUV, - CODEC_ID_PAM, CODEC_ID_FFVHUFF, CODEC_ID_RV30, CODEC_ID_RV40, - CODEC_ID_VC1, CODEC_ID_WMV3, CODEC_ID_LOCO, CODEC_ID_WNV1, - CODEC_ID_AASC, CODEC_ID_INDEO2, CODEC_ID_FRAPS, CODEC_ID_TRUEMOTION2, - CODEC_ID_BMP, CODEC_ID_CSCD, CODEC_ID_MMVIDEO, CODEC_ID_ZMBV, - CODEC_ID_AVS, CODEC_ID_SMACKVIDEO, CODEC_ID_NUV, CODEC_ID_KMVC, - CODEC_ID_FLASHSV, CODEC_ID_CAVS, CODEC_ID_JPEG2000, CODEC_ID_VMNC, - CODEC_ID_VP5, CODEC_ID_VP6, CODEC_ID_VP6F, - - //* various pcm "codecs" */ - CODEC_ID_PCM_S16LE= $10000, CODEC_ID_PCM_S16BE, CODEC_ID_PCM_U16LE, - CODEC_ID_PCM_U16BE, CODEC_ID_PCM_S8, CODEC_ID_PCM_U8, CODEC_ID_PCM_MULAW, - CODEC_ID_PCM_ALAW, CODEC_ID_PCM_S32LE, CODEC_ID_PCM_S32BE, CODEC_ID_PCM_U32LE, - CODEC_ID_PCM_U32BE, CODEC_ID_PCM_S24LE, CODEC_ID_PCM_S24BE, CODEC_ID_PCM_U24LE, - CODEC_ID_PCM_U24BE, CODEC_ID_PCM_S24DAUD, - //* various adpcm codecs */ - CODEC_ID_ADPCM_IMA_QT= $11000, CODEC_ID_ADPCM_IMA_WAV, CODEC_ID_ADPCM_IMA_DK3, - CODEC_ID_ADPCM_IMA_DK4, CODEC_ID_ADPCM_IMA_WS, CODEC_ID_ADPCM_IMA_SMJPEG, - CODEC_ID_ADPCM_MS, CODEC_ID_ADPCM_4XM, CODEC_ID_ADPCM_XA, CODEC_ID_ADPCM_ADX, - CODEC_ID_ADPCM_EA, CODEC_ID_ADPCM_G726, CODEC_ID_ADPCM_CT, CODEC_ID_ADPCM_SWF, - CODEC_ID_ADPCM_YAMAHA, CODEC_ID_ADPCM_SBPRO_4, CODEC_ID_ADPCM_SBPRO_3, - CODEC_ID_ADPCM_SBPRO_2, - //* AMR */ - CODEC_ID_AMR_NB= $12000, CODEC_ID_AMR_WB, - //* RealAudio codecs*/ - CODEC_ID_RA_144= $13000, CODEC_ID_RA_288, - //* various DPCM codecs */ - CODEC_ID_ROQ_DPCM= $14000, CODEC_ID_INTERPLAY_DPCM, CODEC_ID_XAN_DPCM, - CODEC_ID_SOL_DPCM, CODEC_ID_MP2= $15000, - CODEC_ID_MP3, //* prefered ID for MPEG Audio layer 1, 2 or3 decoding */ - CODEC_ID_AAC, CODEC_ID_MPEG4AAC, CODEC_ID_AC3, CODEC_ID_DTS, CODEC_ID_VORBIS, - CODEC_ID_DVAUDIO, CODEC_ID_WMAV1, CODEC_ID_WMAV2, CODEC_ID_MACE3, - CODEC_ID_MACE6, CODEC_ID_VMDAUDIO, CODEC_ID_SONIC, CODEC_ID_SONIC_LS, - CODEC_ID_FLAC, CODEC_ID_MP3ADU, CODEC_ID_MP3ON4, CODEC_ID_SHORTEN, - CODEC_ID_ALAC, CODEC_ID_WESTWOOD_SND1, CODEC_ID_GSM, CODEC_ID_QDM2, - CODEC_ID_COOK, CODEC_ID_TRUESPEECH, CODEC_ID_TTA, CODEC_ID_SMACKAUDIO, - CODEC_ID_QCELP, CODEC_ID_WAVPACK, - //* subtitle codecs */ - CODEC_ID_DVD_SUBTITLE= $17000, CODEC_ID_DVB_SUBTITLE, - - CODEC_ID_MPEG2TS= $20000 //* _FAKE_ codec to indicate a raw MPEG2 transport - // stream (only used by libavformat) */ - ); - -//* CODEC_ID_MP3LAME is absolete */ -const - CODEC_ID_MP3LAME = CODEC_ID_MP3; - - AVPALETTE_SIZE = 1024; - AVPALETTE_COUNT = 256; - -type - TCodecType = ( - CODEC_TYPE_UNKNOWN = -1, - CODEC_TYPE_VIDEO, - CODEC_TYPE_AUDIO, - CODEC_TYPE_DATA, - CODEC_TYPE_SUBTITLE, - CODEC_TYPE_NB (* CAT#3 *) - ); - -//* currently unused, may be used if 24/32 bits samples ever supported */ -//* all in native endian */ - TSampleFormat = ( - SAMPLE_FMT_NONE = -1, - SAMPLE_FMT_U8, ///< unsigned 8 bits - SAMPLE_FMT_S16, ///< signed 16 bits - SAMPLE_FMT_S24, ///< signed 24 bits - SAMPLE_FMT_S32, ///< signed 32 bits - SAMPLE_FMT_FLT ///< float - ); - -const -//* in bytes */ - AVCODEC_MAX_AUDIO_FRAME_SIZE = 192000; // 1 second of 48khz 32bit audio - -(** - * Required number of additionally allocated bytes at the end of the input bitstream for decoding. - * this is mainly needed because some optimized bitstream readers read - * 32 or 64 bit at once and could read over the end
- * Note, if the first 23 bits of the additional bytes are not 0 then damaged - * MPEG bitstreams could cause overread and segfault - *) - FF_INPUT_BUFFER_PADDING_SIZE = 8; - -(** - * minimum encoding buffer size. - * used to avoid some checks during header writing - *) - FF_MIN_BUFFER_SIZE = 16384; - -type -//* motion estimation type, EPZS by default */ - TMotion_Est_ID = ( - ME_ZERO = 1, - ME_FULL, - ME_LOG, - ME_PHODS, - ME_EPZS, - ME_X1, - ME_HEX, - ME_UMH, - ME_ITER - ); - - TAVDiscard = ( -//we leave some space between them for extensions (drop some keyframes for intra only or drop just some bidir frames) - AVDISCARD_NONE = -16, ///< discard nothing - AVDISCARD_DEFAULT= 0, ///< discard useless packets like 0 size packets in avi - AVDISCARD_NONREF = 8, ///< discard all non reference - AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames - AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes - AVDISCARD_ALL = 48, ///< discard all - AVDISCARD_FUCK = $FFFFFF - ); - - PRcOverride = ^TRcOverride; - TRcOverride = record {16} - start_frame: integer; - end_frame: integer; - qscale: integer; // if this is 0 then quality_factor will be used instead - quality_factor: single; - end; - -const - FF_MAX_B_FRAMES = 16; - -(* encoding support - these flags can be passed in AVCodecContext.flags before initing - Note: not everything is supported yet. -*) - - CODEC_FLAG_QSCALE = $0002; ///< use fixed qscale - CODEC_FLAG_4MV = $0004; ///< 4 MV per MB allowed / Advanced prediction for H263 - CODEC_FLAG_QPEL = $0010; ///< use qpel MC - CODEC_FLAG_GMC = $0020; ///< use GMC - CODEC_FLAG_MV0 = $0040; ///< always try a MB with MV=<0,0> - CODEC_FLAG_PART = $0080; ///< use data partitioning -//* parent program gurantees that the input for b-frame containing streams is not written to -// for at least s->max_b_frames+1 frames, if this is not set than the input will be copied */ - CODEC_FLAG_INPUT_PRESERVED = $0100; - CODEC_FLAG_PASS1 = $0200; ///< use internal 2pass ratecontrol in first pass mode - CODEC_FLAG_PASS2 = $0400; ///< use internal 2pass ratecontrol in second pass mode - CODEC_FLAG_EXTERN_HUFF = $1000; ///< use external huffman table (for mjpeg) - CODEC_FLAG_GRAY = $2000; ///< only decode/encode grayscale - CODEC_FLAG_EMU_EDGE = $4000; ///< don't draw edges - CODEC_FLAG_PSNR = $8000; ///< error[?] variables will be set during encoding - CODEC_FLAG_TRUNCATED = $00010000; //** input bitstream might be truncated at a random location instead - // of only at frame boundaries */ - CODEC_FLAG_NORMALIZE_AQP = $00020000; ///< normalize adaptive quantization - CODEC_FLAG_INTERLACED_DCT = $00040000; ///< use interlaced dct - CODEC_FLAG_LOW_DELAY = $00080000; ///< force low delay - CODEC_FLAG_ALT_SCAN = $00100000; ///< use alternate scan - CODEC_FLAG_TRELLIS_QUANT = $00200000; ///< use trellis quantization - CODEC_FLAG_GLOBAL_HEADER = $00400000; ///< place global headers in extradata instead of every keyframe - CODEC_FLAG_BITEXACT = $00800000; ///< use only bitexact stuff (except (i)dct) -//* Fx : Flag for h263+ extra options */ - CODEC_FLAG_H263P_AIC = $01000000; ///< H263 Advanced intra coding / MPEG4 AC prediction (remove this) - CODEC_FLAG_AC_PRED = $01000000; ///< H263 Advanced intra coding / MPEG4 AC prediction - CODEC_FLAG_H263P_UMV = $02000000; ///< Unlimited motion vector - CODEC_FLAG_CBP_RD = $04000000; ///< use rate distortion optimization for cbp - CODEC_FLAG_QP_RD = $08000000; ///< use rate distortion optimization for qp selectioon - CODEC_FLAG_H263P_AIV = $00000008; ///< H263 Alternative inter vlc - CODEC_FLAG_OBMC = $00000001; ///< OBMC - CODEC_FLAG_LOOP_FILTER = $00000800; ///< loop filter - CODEC_FLAG_H263P_SLICE_STRUCT = $10000000; - CODEC_FLAG_INTERLACED_ME = $20000000; ///< interlaced motion estimation - CODEC_FLAG_SVCD_SCAN_OFFSET = $40000000; ///< will reserve space for SVCD scan offset user data - CODEC_FLAG_CLOSED_GOP = $80000000; - CODEC_FLAG2_FAST = $00000001; ///< allow non spec compliant speedup tricks - CODEC_FLAG2_STRICT_GOP = $00000002; ///< strictly enforce GOP size - CODEC_FLAG2_NO_OUTPUT = $00000004; ///< skip bitstream encoding - CODEC_FLAG2_LOCAL_HEADER = $00000008; ///< place global headers at every keyframe instead of in extradata - CODEC_FLAG2_BPYRAMID = $00000010; ///< H.264 allow b-frames to be used as references - CODEC_FLAG2_WPRED = $00000020; ///< H.264 weighted biprediction for b-frames - CODEC_FLAG2_MIXED_REFS = $00000040; ///< H.264 multiple references per partition - CODEC_FLAG2_8X8DCT = $00000080; ///< H.264 high profile 8x8 transform - CODEC_FLAG2_FASTPSKIP = $00000100; ///< H.264 fast pskip - CODEC_FLAG2_AUD = $00000200; ///< H.264 access unit delimiters - CODEC_FLAG2_BRDO = $00000400; ///< b-frame rate-distortion optimization - CODEC_FLAG2_INTRA_VLC = $00000800; ///< use MPEG-2 intra VLC table - CODEC_FLAG2_MEMC_ONLY = $00001000; ///< only do ME/MC (I frames -> ref, P frame -> ME+MC) - -(* Unsupported options : - * Syntax Arithmetic coding (SAC) - * Reference Picture Selection - * Independant Segment Decoding */ -/* /Fx */ -/* codec capabilities *) - -const - CODEC_CAP_DRAW_HORIZ_BAND = $001; ///< decoder can use draw_horiz_band callback -(** - * Codec uses get_buffer() for allocating buffers. - * direct rendering method 1 *) - CODEC_CAP_DR1 = $002; -(* if 'parse_only' field is true, then avcodec_parse_frame() can be used *) - CODEC_CAP_PARSE_ONLY = $004; - CODEC_CAP_TRUNCATED = $008; -//* codec can export data for HW decoding (XvMC) */ - CODEC_CAP_HWACCEL = $010; - -(** - * codec has a non zero delay and needs to be feeded with NULL at the end to get the delayed data. - * if this is not set, the codec is guranteed to never be feeded with NULL data *) - CODEC_CAP_DELAY = $0020; -(** - * Codec can be fed a final frame with a smaller size. - * This can be used to prevent truncation of the last audio samples. *) - CODEC_CAP_SMALL_LAST_FRAME = $0040; - -//the following defines may change, don't expect compatibility if you use them - MB_TYPE_INTRA4x4 = $001; - MB_TYPE_INTRA16x16 = $002; //FIXME h264 specific - MB_TYPE_INTRA_PCM = $004; //FIXME h264 specific - MB_TYPE_16x16 = $008; - MB_TYPE_16x8 = $010; - MB_TYPE_8x16 = $020; - MB_TYPE_8x8 = $040; - MB_TYPE_INTERLACED = $080; - MB_TYPE_DIRECT2 = $100; //FIXME - MB_TYPE_ACPRED = $200; - MB_TYPE_GMC = $400; - MB_TYPE_SKIP = $800; - MB_TYPE_P0L0 = $1000; - MB_TYPE_P1L0 = $2000; - MB_TYPE_P0L1 = $4000; - MB_TYPE_P1L1 = $8000; - MB_TYPE_L0 = (MB_TYPE_P0L0 or MB_TYPE_P1L0); - MB_TYPE_L1 = (MB_TYPE_P0L1 or MB_TYPE_P1L1); - MB_TYPE_L0L1 = (MB_TYPE_L0 or MB_TYPE_L1); - MB_TYPE_QUANT = $0010000; - MB_TYPE_CBP = $0020000; -//Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...) - -type -(** - * Pan Scan area. - * this specifies the area which should be displayed. Note there may be multiple such areas for one frame *) - PAVPanScan = ^TAVPanScan; - TAVPanScan = record {24} - (*** id. - * - encoding: set by user. - * - decoding: set by lavc *) - id: integer; - - (*** width and height in 1/16 pel - * - encoding: set by user. - * - decoding: set by lavc *) - width: integer; - height: integer; - - (*** position of the top left corner in 1/16 pel for up to 3 fields/frames. - * - encoding: set by user. - * - decoding: set by lavc *) - position: array [0..2] of array [0..1] of smallint; - end; - -const - FF_QSCALE_TYPE_MPEG1 = 0; - FF_QSCALE_TYPE_MPEG2 = 1; - - FF_BUFFER_TYPE_INTERNAL = 1; - FF_BUFFER_TYPE_USER = 2; ///< Direct rendering buffers (image is (de)allocated by user) - FF_BUFFER_TYPE_SHARED = 4; ///< buffer from somewhere else, don't dealloc image (data/base), all other tables are not shared - FF_BUFFER_TYPE_COPY = 8; ///< just a (modified) copy of some other buffer, don't dealloc anything - - - FF_I_TYPE = 1; // Intra - FF_P_TYPE = 2; // Predicted - FF_B_TYPE = 3; // Bi-dir predicted - FF_S_TYPE = 4; // S(GMC)-VOP MPEG4 - FF_SI_TYPE = 5; - FF_SP_TYPE = 6; - - FF_BUFFER_HINTS_VALID = $01; // Buffer hints value is meaningful (if 0 ignore) - FF_BUFFER_HINTS_READABLE = $02; // Codec will read from buffer - FF_BUFFER_HINTS_PRESERVE = $04; // User must not alter buffer content - FF_BUFFER_HINTS_REUSABLE = $08; // Codec will reuse the buffer (update) - -type - (*** Audio Video Frame. *) - PAVFrame = ^TAVFrame; - TAVFrame = record {200} - (*** pointer to the picture planes. - * this might be different from the first allocated byte *) - data: array [0..3] of pbyte; - linesize: array [0..3] of integer; - (*** pointer to the first allocated byte of the picture. can be used in get_buffer/release_buffer - * this isn't used by lavc unless the default get/release_buffer() is used*) - base: array [0..3] of pbyte; - (*** 1 -> keyframe, 0-> not *) - key_frame: integer; - (*** picture type of the frame, see ?_TYPE below.*) - pict_type: integer; - (*** presentation timestamp in time_base units (time when frame should be shown to user) - * if AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed*) - pts: int64; - (*** picture number in bitstream order.*) - coded_picture_number: integer; - (*** picture number in display order.*) - display_picture_number: integer; - (*** quality (between 1 (good) and FF_LAMBDA_MAX (bad)) *) - quality: integer; - (*** buffer age (1->was last buffer and dint change, 2->..., ...).*) - age: integer; - (*** is this picture used as reference*) - reference: integer; - (*** QP table*) - qscale_table: pchar; - (*** QP store stride*) - qstride: integer; - (*** mbskip_table[mb]>=1 if MB didnt change*) - mbskip_table: pbyte; - (** - * Motion vector table. - * @code - * example: - * int mv_sample_log2= 4 - motion_subsample_log2; - * int mb_width= (width+15)>>4; - * int mv_stride= (mb_width << mv_sample_log2) + 1; - * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y]; - * @endcode - * - encoding: set by user - * - decoding: set by lavc *) - motion_val: array [0..1] of pointer; - (*** Macroblock type table - * mb_type_base + mb_width + 2 *) - mb_type: PCardinal; - (*** log2 of the size of the block which a single vector in motion_val represents: - * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)*) - motion_subsample_log2: byte; - (*** for some private data of the user*) - opaque: pointer; - (*** error*) - error: array [0..3] of int64; - (*** type of the buffer (to keep track of who has to dealloc data[*]) - * Note: user allocated (direct rendering) & internal buffers can not coexist currently*) - _type: integer; - (*** when decoding, this signal how much the picture must be delayed. - * extra_delay = repeat_pict / (2*fps)*) - repeat_pict: integer; - qscale_type: integer; - (*** The content of the picture is interlaced.*) - interlaced_frame: integer; - (*** if the content is interlaced, is top field displayed first.*) - top_field_first: integer; - (*** Pan scan.*) - pan_scan: PAVPanScan; - (*** tell user application that palette has changed from previous frame.*) - palette_has_changed: integer; - (*** Codec suggestion on buffer type if != 0 - * - decoding: set by lavc (before get_buffer() call))*) - buffer_hints: integer; - (*** DCT coeffitients*) - dct_coeff: PsmallInt; - (*** Motion referece frame index*) - ref_index: array [0..1] of pshortint; - end; - -const - DEFAULT_FRAME_RATE_BASE = 1001000; - - FF_BUG_AUTODETECT = 1; ///< autodetection - FF_BUG_OLD_MSMPEG4 = 2; - FF_BUG_XVID_ILACE = 4; - FF_BUG_UMP4 = 8; - FF_BUG_NO_PADDING = 16; - FF_BUG_AMV = 32; - FF_BUG_AC_VLC = 0; ///< will be removed, libavcodec can now handle these non compliant files by default - FF_BUG_QPEL_CHROMA = 64; - FF_BUG_STD_QPEL = 128; - FF_BUG_QPEL_CHROMA2 = 256; - FF_BUG_DIRECT_BLOCKSIZE = 512; - FF_BUG_EDGE = 1024; - FF_BUG_HPEL_CHROMA = 2048; - FF_BUG_DC_CLIP = 4096; - FF_BUG_MS = 8192; ///< workaround various bugs in microsofts broken decoders - - FF_COMPLIANCE_VERY_STRICT = 2; ///< strictly conform to a older more strict version of the spec or reference software - FF_COMPLIANCE_STRICT = 1; ///< strictly conform to all the things in the spec no matter what consequences - FF_COMPLIANCE_NORMAL = 0; - FF_COMPLIANCE_INOFFICIAL = -1; ///< allow inofficial extensions - FF_COMPLIANCE_EXPERIMENTAL = -2; ///< allow non standarized experimental things - - FF_ER_CAREFUL = 1; - FF_ER_COMPLIANT = 2; - FF_ER_AGGRESSIVE = 3; - FF_ER_VERY_AGGRESSIVE = 4; - - FF_DCT_AUTO = 0; - FF_DCT_FASTINT = 1; - FF_DCT_INT = 2; - FF_DCT_MMX = 3; - FF_DCT_MLIB = 4; - FF_DCT_ALTIVEC = 5; - FF_DCT_FAAN = 6; - - FF_IDCT_AUTO = 0; - FF_IDCT_INT = 1; - FF_IDCT_SIMPLE = 2; - FF_IDCT_SIMPLEMMX = 3; - FF_IDCT_LIBMPEG2MMX = 4; - FF_IDCT_PS2 = 5; - FF_IDCT_MLIB = 6; - FF_IDCT_ARM = 7; - FF_IDCT_ALTIVEC = 8; - FF_IDCT_SH4 = 9; - FF_IDCT_SIMPLEARM = 10; - FF_IDCT_H264 = 11; - FF_IDCT_VP3 = 12; - FF_IDCT_IPP = 13; - FF_IDCT_XVIDMMX = 14; - - FF_EC_GUESS_MVS = 1; - FF_EC_DEBLOCK = 2; - - FF_MM_FORCE = $80000000; (* force usage of selected flags (OR) *) - (* lower 16 bits - CPU features *) - - FF_MM_MMX = $0001; (* standard MMX *) - FF_MM_3DNOW = $0004; (* AMD 3DNOW *) - FF_MM_MMXEXT = $0002; (* SSE integer functions or AMD MMX ext *) - FF_MM_SSE = $0008; (* SSE functions *) - FF_MM_SSE2 = $0010; (* PIV SSE2 functions *) - FF_MM_3DNOWEXT = $0020; (* AMD 3DNowExt *) - FF_MM_IWMMXT = $0100; (* XScale IWMMXT *) - - FF_PRED_LEFT = 0; - FF_PRED_PLANE = 1; - FF_PRED_MEDIAN = 2; - - FF_DEBUG_PICT_INFO = 1; - FF_DEBUG_RC = 2; - FF_DEBUG_BITSTREAM = 4; - FF_DEBUG_MB_TYPE = 8; - FF_DEBUG_QP = 16; - FF_DEBUG_MV = 32; - FF_DEBUG_DCT_COEFF = $00000040; - FF_DEBUG_SKIP = $00000080; - FF_DEBUG_STARTCODE = $00000100; - FF_DEBUG_PTS = $00000200; - FF_DEBUG_ER = $00000400; - FF_DEBUG_MMCO = $00000800; - FF_DEBUG_BUGS = $00001000; - FF_DEBUG_VIS_QP = $00002000; - FF_DEBUG_VIS_MB_TYPE = $00004000; - - FF_DEBUG_VIS_MV_P_FOR = $00000001; //visualize forward predicted MVs of P frames - FF_DEBUG_VIS_MV_B_FOR = $00000002; //visualize forward predicted MVs of B frames - FF_DEBUG_VIS_MV_B_BACK = $00000004; //visualize backward predicted MVs of B frames - - FF_CMP_SAD = 0; - FF_CMP_SSE = 1; - FF_CMP_SATD = 2; - FF_CMP_DCT = 3; - FF_CMP_PSNR = 4; - FF_CMP_BIT = 5; - FF_CMP_RD = 6; - FF_CMP_ZERO = 7; - FF_CMP_VSAD = 8; - FF_CMP_VSSE = 9; - FF_CMP_NSSE = 10; - FF_CMP_W53 = 11; - FF_CMP_W97 = 12; - FF_CMP_DCTMAX = 13; - FF_CMP_CHROMA = 256; - - FF_DTG_AFD_SAME = 8; - FF_DTG_AFD_4_3 = 9; - FF_DTG_AFD_16_9 = 10; - FF_DTG_AFD_14_9 = 11; - FF_DTG_AFD_4_3_SP_14_9 = 13; - FF_DTG_AFD_16_9_SP_14_9 = 14; - FF_DTG_AFD_SP_4_3 = 15; - - FF_DEFAULT_QUANT_BIAS = 999999; - - FF_LAMBDA_SHIFT = 7; - FF_LAMBDA_SCALE = (1 shl FF_LAMBDA_SHIFT); - FF_QP2LAMBDA = 118; ///< factor to convert from H.263 QP to lambda - FF_LAMBDA_MAX = (256 * 128 - 1); - - FF_QUALITY_SCALE = FF_LAMBDA_SCALE; //FIXME maybe remove - - FF_CODER_TYPE_VLC = 0; - FF_CODER_TYPE_AC = 1; - - SLICE_FLAG_CODED_ORDER = $0001; ///< draw_horiz_band() is called in coded order instead of display - SLICE_FLAG_ALLOW_FIELD = $0002; ///< allow draw_horiz_band() with field slices (MPEG2 field pics) - SLICE_FLAG_ALLOW_PLANE = $0004; ///< allow draw_horiz_band() with 1 component at a time (SVQ1) - - FF_MB_DECISION_SIMPLE = 0; ///< uses mb_cmp - FF_MB_DECISION_BITS = 1; ///< chooses the one which needs the fewest bits - FF_MB_DECISION_RD = 2; ///< rate distoration - - FF_AA_AUTO = 0; - FF_AA_FASTINT = 1; //not implemented yet - FF_AA_INT = 2; - FF_AA_FLOAT = 3; - - FF_PROFILE_UNKNOWN = -99; - - FF_LEVEL_UNKNOWN = -99; - - X264_PART_I4X4 = $001; (* Analyse i4x4 *) - X264_PART_I8X8 = $002; (* Analyse i8x8 (requires 8x8 transform) *) - X264_PART_P8X8 = $010; (* Analyse p16x8, p8x16 and p8x8 *) - X264_PART_P4X4 = $020; (* Analyse p8x4, p4x8, p4x4 *) - X264_PART_B8X8 = $100; (* Analyse b16x8, b8x16 and b8x8 *) - -type - PAVClass = ^TAVClass; - PAVCodecContext = ^TAVCodecContext; - PAVCodec = ^TAVCodec; - PAVPaletteControl = ^TAVPaletteControl; - - TAVclass = record {12} - class_name: pchar; - (* actually passing a pointer to an AVCodecContext - or AVFormatContext, which begin with an AVClass. - Needed because av_log is in libavcodec and has no visibility - of AVIn/OutputFormat *) - item_name: function (): pchar; cdecl; - option: PAVOption; - end; - - TAVCodecContext = record {720} - (*** Info on struct for av_log - * - set by avcodec_alloc_context *) - av_class: PAVClass; - (*** the average bitrate. - * - encoding: set by user. unused for constant quantizer encoding - * - decoding: set by lavc. 0 or some bitrate if this info is available in the stream *) - bit_rate: integer; - (*** number of bits the bitstream is allowed to diverge from the reference. - * the reference can be CBR (for CBR pass1) or VBR (for pass2) - * - encoding: set by user. unused for constant quantizer encoding - * - decoding: unused *) - bit_rate_tolerance: integer; - (*** CODEC_FLAG_*. - * - encoding: set by user. - * - decoding: set by user. *) - flags: integer; - (*** some codecs needs additionnal format info. It is stored here - * - encoding: set by user. - * - decoding: set by lavc. (FIXME is this ok?) *) - sub_id: integer; - - (** - * motion estimation algorithm used for video coding. - * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex), - * 8 (umh), 9 (iter) [7, 8 are x264 specific, 9 is snow specific] - * - encoding: MUST be set by user. - * - decoding: unused *) - me_method: integer; - - (** - * some codecs need / can use extra-data like huffman tables. - * mjpeg: huffman tables - * rv10: additional flags - * mpeg4: global headers (they can be in the bitstream or here) - * the allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger - * then extradata_size to avoid prolems if its read with the bitstream reader - * the bytewise contents of extradata must not depend on the architecture or cpu endianness - * - encoding: set/allocated/freed by lavc. - * - decoding: set/allocated/freed by user. - *) - extradata: pbyte; - extradata_size: integer; - - (** - * this is the fundamental unit of time (in seconds) in terms - * of which frame timestamps are represented. for fixed-fps content, - * timebase should be 1/framerate and timestamp increments should be - * identically 1. - * - encoding: MUST be set by user - * - decoding: set by lavc. *) - time_base: TAVRational; - - (* video only *) - (*** picture width / height. - * - encoding: MUST be set by user. - * - decoding: set by lavc. - * Note, for compatibility its possible to set this instead of - * coded_width/height before decoding *) - width, height: integer; - (*** the number of pictures in a group of pitures, or 0 for intra_only. - * - encoding: set by user. - * - decoding: unused *) - gop_size: integer; - (*** pixel format, see PIX_FMT_xxx. - * - encoding: set by user. - * - decoding: set by lavc. *) - pix_fmt: TAVPixelFormat; - (*** Frame rate emulation. If not zero lower layer (i.e. format handler) - * has to read frames at native frame rate. - * - encoding: set by user. - * - decoding: unused. *) - rate_emu: integer; - (*** if non NULL, 'draw_horiz_band' is called by the libavcodec - * decoder to draw an horizontal band. It improve cache usage. Not - * all codecs can do that. You must check the codec capabilities - * before - * - encoding: unused - * - decoding: set by user. - * @param height the height of the slice - * @param y the y position of the slice - * @param type 1->top field, 2->bottom field, 3->frame - * @param offset offset into the AVFrame.data from which the slice should be read *) - draw_horiz_band: procedure (s: PAVCodecContext; - const src: PAVFrame; offset: PInteger; - y: integer; _type: integer; height: integer); cdecl; - - (* audio only *) - sample_rate: integer; ///< samples per sec - channels: integer; - (*** audio sample format. - * - encoding: set by user. - * - decoding: set by lavc. *) - sample_fmt: TSampleFormat; ///< sample format, currenly unused - - (* the following data should not be initialized *) - (*** samples per packet. initialized when calling 'init' *) - frame_size: integer; - frame_number: integer; ///< audio or video frame number - real_pict_num: integer; ///< returns the real picture number of previous encoded frame - - (*** number of frames the decoded output will be delayed relative to - * the encoded input. - * - encoding: set by lavc. - * - decoding: unused *) - delay: integer; - - (* - encoding parameters *) - qcompress: single; ///< amount of qscale change between easy & hard scenes (0.0-1.0) - qblur: single; ///< amount of qscale smoothing over time (0.0-1.0) - - (*** minimum quantizer. - * - encoding: set by user. - * - decoding: unused *) - qmin: integer; - - (*** maximum quantizer. - * - encoding: set by user. - * - decoding: unused *) - qmax: integer; - - (*** maximum quantizer difference etween frames. - * - encoding: set by user. - * - decoding: unused *) - max_qdiff: integer; - - (*** maximum number of b frames between non b frames. - * note: the output will be delayed by max_b_frames+1 relative to the input - * - encoding: set by user. - * - decoding: unused *) - max_b_frames: integer; - - (*** qscale factor between ip and b frames. - * - encoding: set by user. - * - decoding: unused *) - b_quant_factor: single; - - (** obsolete FIXME remove *) - rc_strategy: integer; - b_frame_strategy: integer; - - (*** hurry up amount. - * deprecated in favor of skip_idct and skip_frame - * - encoding: unused - * - decoding: set by user. 1-> skip b frames, 2-> skip idct/dequant too, 5-> skip everything except header *) - hurry_up: integer; - - codec: PAVCodec; - - priv_data: pointer; - - (* unused, FIXME remove*) - rtp_mode: integer; - - rtp_payload_size: integer; (* The size of the RTP payload: the coder will *) - (* do it's best to deliver a chunk with size *) - (* below rtp_payload_size, the chunk will start *) - (* with a start code on some codecs like H.263 *) - (* This doesn't take account of any particular *) - (* headers inside the transmited RTP payload *) - - - (* The RTP callback: This function is called *) - (* every time the encoder has a packet to send *) - (* Depends on the encoder if the data starts *) - (* with a Start Code (it should) H.263 does. *) - (* mb_nb contains the number of macroblocks *) - (* encoded in the RTP payload *) - rtp_callback: procedure (avctx: PAVCodecContext; data: pointer; - size: integer; mb_nb: integer); cdecl; - - (* statistics, used for 2-pass encoding *) - mv_bits: integer; - header_bits: integer; - i_tex_bits: integer; - p_tex_bits: integer; - i_count: integer; - p_count: integer; - skip_count: integer; - misc_bits: integer; - - (*** number of bits used for the previously encoded frame. - * - encoding: set by lavc - * - decoding: unused *) - frame_bits: integer; - - (*** private data of the user, can be used to carry app specific stuff. - * - encoding: set by user - * - decoding: set by user *) - opaque: pointer; - - codec_name: array [0..31] of char; - codec_type: TCodecType; (* see CODEC_TYPE_xxx *) - codec_id: TCodecID; (* see CODEC_ID_xxx *) - - (*** fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). - * this is used to workaround some encoder bugs - * - encoding: set by user, if not then the default based on codec_id will be used - * - decoding: set by user, will be converted to upper case by lavc during init *) - codec_tag: cardinal; // ìîæíî array [0..3] of char - òîãäà âèäíî FOURCC -// codec_tag: array [0..3] of char; - - (*** workaround bugs in encoders which sometimes cannot be detected automatically. - * - encoding: set by user - * - decoding: set by user *) - workaround_bugs: integer; - - (*** luma single coeff elimination threshold. - * - encoding: set by user - * - decoding: unused *) - luma_elim_threshold: integer; - - (*** chroma single coeff elimination threshold. - * - encoding: set by user - * - decoding: unused *) - chroma_elim_threshold: integer; - - (*** strictly follow the std (MPEG4, ...). - * - encoding: set by user - * - decoding: unused *) - strict_std_compliance: integer; - - (*** qscale offset between ip and b frames. - * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset) - * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset) - * - encoding: set by user. - * - decoding: unused *) - b_quant_offset: single; - - (*** error resilience higher values will detect more errors but may missdetect - * some more or less valid parts as errors. - * - encoding: unused - * - decoding: set by user *) - error_resilience: integer; - - (*** called at the beginning of each frame to get a buffer for it. - * if pic.reference is set then the frame will be read later by lavc - * avcodec_align_dimensions() should be used to find the required width and - * height, as they normally need to be rounded up to the next multiple of 16 - * - encoding: unused - * - decoding: set by lavc, user can override *) - get_buffer: function (c: PAVCodecContext; pic: PAVFrame): integer; cdecl; - - (*** called to release buffers which where allocated with get_buffer. - * a released buffer can be reused in get_buffer() - * pic.data[*] must be set to NULL - * - encoding: unused - * - decoding: set by lavc, user can override *) - release_buffer: procedure (c: PAVCodecContext; pic: PAVFrame); cdecl; - - (*** if 1 the stream has a 1 frame delay during decoding. - * - encoding: set by lavc - * - decoding: set by lavc *) - has_b_frames: integer; - - (*** number of bytes per packet if constant and known or 0 - * used by some WAV based audio codecs *) - block_align: integer; - - parse_only: integer; (* - decoding only: if true, only parsing is done - (function avcodec_parse_frame()). The frame - data is returned. Only MPEG codecs support this now. *) - - (*** 0-> h263 quant 1-> mpeg quant. - * - encoding: set by user. - * - decoding: unused *) - mpeg_quant: integer; - - (*** pass1 encoding statistics output buffer. - * - encoding: set by lavc - * - decoding: unused *) - stats_out: pchar; - - (*** pass2 encoding statistics input buffer. - * concatenated stuff from stats_out of pass1 should be placed here - * - encoding: allocated/set/freed by user - * - decoding: unused *) - stats_in: pchar; - - (*** ratecontrol qmin qmax limiting method. - * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax - * - encoding: set by user. - * - decoding: unused *) - rc_qsquish: single; - - rc_qmod_amp: single; - rc_qmod_freq: integer; - - (*** ratecontrol override, see RcOverride. - * - encoding: allocated/set/freed by user. - * - decoding: unused *) - rc_override: PRcOverride; - rc_override_count: integer; - - (*** rate control equation. - * - encoding: set by user - * - decoding: unused *) - rc_eq: pchar; - - (*** maximum bitrate. - * - encoding: set by user. - * - decoding: unused *) - rc_max_rate: integer; - - (*** minimum bitrate. - * - encoding: set by user. - * - decoding: unused *) - rc_min_rate: integer; - - (*** decoder bitstream buffer size. - * - encoding: set by user. - * - decoding: unused *) - rc_buffer_size: integer; - rc_buffer_aggressivity: single; - - (*** qscale factor between p and i frames. - * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset) - * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset) - * - encoding: set by user. - * - decoding: unused *) - i_quant_factor: single; - - (*** qscale offset between p and i frames. - * - encoding: set by user. - * - decoding: unused *) - i_quant_offset: single; - - (*** initial complexity for pass1 ratecontrol. - * - encoding: set by user. - * - decoding: unused *) - rc_initial_cplx: single; - - (*** dct algorithm, see FF_DCT_* below. - * - encoding: set by user - * - decoding: unused *) - dct_algo: integer; - - (*** luminance masking (0-> disabled). - * - encoding: set by user - * - decoding: unused *) - lumi_masking: single; - - (*** temporary complexity masking (0-> disabled). - * - encoding: set by user - * - decoding: unused *) - temporal_cplx_masking: single; - - (*** spatial complexity masking (0-> disabled). - * - encoding: set by user - * - decoding: unused *) - spatial_cplx_masking: single; - - (** * p block masking (0-> disabled). - * - encoding: set by user - * - decoding: unused *) - p_masking: single; - - (*** darkness masking (0-> disabled). - * - encoding: set by user - * - decoding: unused *) - dark_masking: single; - - (* for binary compatibility *) - unused: integer; - - (*** idct algorithm, see FF_IDCT_* below. - * - encoding: set by user - * - decoding: set by user *) - idct_algo: integer; - - (*** slice count. - * - encoding: set by lavc - * - decoding: set by user (or 0) *) - slice_count: integer; - - (*** slice offsets in the frame in bytes. - * - encoding: set/allocated by lavc - * - decoding: set/allocated by user (or NULL) *) - slice_offset: Pinteger; - - (*** error concealment flags. - * - encoding: unused - * - decoding: set by user *) - error_concealment: integer; - - (*** dsp_mask could be add used to disable unwanted CPU features - * CPU features (i.e. MMX, SSE. ...) - * - * with FORCE flag you may instead enable given CPU features - * (Dangerous: usable in case of misdetection, improper usage however will - * result into program crash) *) - dsp_mask: cardinal; - - (*** bits per sample/pixel from the demuxer (needed for huffyuv). - * - encoding: set by lavc - * - decoding: set by user *) - bits_per_sample: integer; - - (*** prediction method (needed for huffyuv). - * - encoding: set by user - * - decoding: unused *) - prediction_method: integer; - - (*** sample aspect ratio (0 if unknown). - * numerator and denominator must be relative prime and smaller then 256 for some video standards - * - encoding: set by user. - * - decoding: set by lavc. *) - sample_aspect_ratio: TAVRational; - - (*** the picture in the bitstream. - * - encoding: set by lavc - * - decoding: set by lavc *) - coded_frame: PAVFrame; - - (*** debug. - * - encoding: set by user. - * - decoding: set by user. *) - debug: integer; - - (*** debug. - * - encoding: set by user. - * - decoding: set by user. *) - debug_mv: integer; - - (** error. - * - encoding: set by lavc if flags&CODEC_FLAG_PSNR - * - decoding: unused *) - error: array [0..3] of int64; - - (*** minimum MB quantizer. - * - encoding: unused - * - decoding: unused *) - mb_qmin: integer; - - (*** maximum MB quantizer. - * - encoding: unused - * - decoding: unused *) - mb_qmax: integer; - - (*** motion estimation compare function. - * - encoding: set by user. - * - decoding: unused *) - me_cmp: integer; - - (*** subpixel motion estimation compare function. - * - encoding: set by user. - * - decoding: unused *) - me_sub_cmp: integer; - (*** macroblock compare function (not supported yet). - * - encoding: set by user. - * - decoding: unused *) - mb_cmp: integer; - (*** interlaced dct compare function - * - encoding: set by user. - * - decoding: unused *) - ildct_cmp: integer; - (*** ME diamond size & shape. - * - encoding: set by user. - * - decoding: unused *) - dia_size: integer; - - (*** amount of previous MV predictors (2a+1 x 2a+1 square). - * - encoding: set by user. - * - decoding: unused *) - last_predictor_count: integer; - - (*** pre pass for motion estimation. - * - encoding: set by user. - * - decoding: unused *) - pre_me: integer; - - (*** motion estimation pre pass compare function. - * - encoding: set by user. - * - decoding: unused *) - me_pre_cmp: integer; - - (*** ME pre pass diamond size & shape. - * - encoding: set by user. - * - decoding: unused *) - pre_dia_size: integer; - - (*** subpel ME quality. - * - encoding: set by user. - * - decoding: unused *) - me_subpel_quality: integer; - - (*** callback to negotiate the pixelFormat. - * @param fmt is the list of formats which are supported by the codec, - * its terminated by -1 as 0 is a valid format, the formats are ordered by quality - * the first is allways the native one - * @return the choosen format - * - encoding: unused - * - decoding: set by user, if not set then the native format will always be choosen - *) - get_format: function (s: PAVCodecContext; const fmt: PAVPixelFormat): TAVPixelFormat; cdecl; - - (*** DTG active format information (additionnal aspect ratio - * information only used in DVB MPEG2 transport streams). 0 if - * not set. - * - encoding: unused. - * - decoding: set by decoder *) - dtg_active_format: integer; - - (*** Maximum motion estimation search range in subpel units. - * if 0 then no limit - * - encoding: set by user. - * - decoding: unused. *) - me_range: integer; - - (*** intra quantizer bias. - * - encoding: set by user. - * - decoding: unused *) - intra_quant_bias: integer; - - (*** inter quantizer bias. - * - encoding: set by user. - * - decoding: unused *) - inter_quant_bias: integer; - - (*** color table ID. - * - encoding: unused. - * - decoding: which clrtable should be used for 8bit RGB images - * table have to be stored somewhere FIXME *) - color_table_id: integer; - - (*** internal_buffer count. - * Don't touch, used by lavc default_get_buffer() *) - internal_buffer_count: integer; - - (*** internal_buffers. - * Don't touch, used by lavc default_get_buffer() *) - internal_buffer: pointer; - - (*** global quality for codecs which cannot change it per frame. - * this should be proportional to MPEG1/2/4 qscale. - * - encoding: set by user. - * - decoding: unused *) - global_quality: integer; - - (*** coder type - * - encoding: set by user. - * - decoding: unused *) - coder_type: integer; - - (*** context model - * - encoding: set by user. - * - decoding: unused *) - context_model: integer; - - (*** slice flags - * - encoding: unused - * - decoding: set by user. *) - slice_flags: integer; - - (*** XVideo Motion Acceleration - * - encoding: forbidden - * - decoding: set by decoder *) - xvmc_acceleration: integer; - - (*** macroblock decision mode - * - encoding: set by user. - * - decoding: unused *) - mb_decision: integer; - - (*** custom intra quantization matrix - * - encoding: set by user, can be NULL - * - decoding: set by lavc *) - intra_matrix: Pword; - - (*** custom inter quantization matrix - * - encoding: set by user, can be NULL - * - decoding: set by lavc *) - inter_matrix: Pword; - - (*** fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). - * this is used to workaround some encoder bugs - * - encoding: unused - * - decoding: set by user, will be converted to upper case by lavc during init *) - stream_codec_tag: array [0..3] of char; //cardinal; - - (*** scene change detection threshold. - * 0 is default, larger means fewer detected scene changes - * - encoding: set by user. - * - decoding: unused *) - scenechange_threshold: integer; - - (*** minimum lagrange multipler - * - encoding: set by user. - * - decoding: unused *) - lmin: integer; - - (*** maximum lagrange multipler - * - encoding: set by user. - * - decoding: unused *) - lmax: integer; - - (*** Palette control structure - * - encoding: ??? (no palette-enabled encoder yet) - * - decoding: set by user. *) - palctrl: PAVPaletteControl; - - (*** noise reduction strength - * - encoding: set by user. - * - decoding: unused *) - noise_reduction: integer; - - (*** called at the beginning of a frame to get cr buffer for it. - * buffer type (size, hints) must be the same. lavc won't check it. - * lavc will pass previous buffer in pic, function should return - * same buffer or new buffer with old frame "painted" into it. - * if pic.data[0] == NULL must behave like get_buffer(). - * - encoding: unused - * - decoding: set by lavc, user can override *) - reget_buffer: function (c: PAVCodecContext; pic: PAVFrame): integer; cdecl; - - (*** number of bits which should be loaded into the rc buffer before decoding starts - * - encoding: set by user. - * - decoding: unused *) - rc_initial_buffer_occupancy: integer; - inter_threshold: integer; - - (*** CODEC_FLAG2_*. - * - encoding: set by user. - * - decoding: set by user. *) - flags2: integer; - - (*** simulates errors in the bitstream to test error concealment. - * - encoding: set by user. - * - decoding: unused. *) - error_rate: integer; - - (*** MP3 antialias algorithm, see FF_AA_* below. - * - encoding: unused - * - decoding: set by user *) - antialias_algo: integer; - - (*** Quantizer noise shaping. - * - encoding: set by user - * - decoding: unused *) - quantizer_noise_shaping: integer; - - (*** Thread count. - * is used to decide how many independant tasks should be passed to execute() - * - encoding: set by user - * - decoding: set by user *) - thread_count: integer; - - (*** the codec may call this to execute several independant things. it will return only after - * finishing all tasks, the user may replace this with some multithreaded implementation, the - * default implementation will execute the parts serially - * @param count the number of things to execute - * - encoding: set by lavc, user can override - * - decoding: set by lavc, user can override *) - execute: function (c: PAVCodecContext; func: pointer; arg: PPointer; ret: PInteger; count: integer): integer; cdecl; - - (*** Thread opaque. - * can be used by execute() to store some per AVCodecContext stuff. - * - encoding: set by execute() - * - decoding: set by execute() *) - thread_opaque: pointer; - - (*** Motion estimation threshold. under which no motion estimation is - * performed, but instead the user specified motion vectors are used - * - encoding: set by user - * - decoding: unused *) - me_threshold: integer; - - (*** Macroblock threshold. under which the user specified macroblock types will be used - * - encoding: set by user - * - decoding: unused *) - mb_threshold: integer; - - (*** precision of the intra dc coefficient - 8. - * - encoding: set by user - * - decoding: unused *) - intra_dc_precision: integer; - - (*** noise vs. sse weight for the nsse comparsion function. - * - encoding: set by user - * - decoding: unused *) - nsse_weight: integer; - - (*** number of macroblock rows at the top which are skipped. - * - encoding: unused - * - decoding: set by user *) - skip_top: integer; - - (*** number of macroblock rows at the bottom which are skipped. - * - encoding: unused - * - decoding: set by user *) - skip_bottom: integer; - - (*** profile - * - encoding: set by user - * - decoding: set by lavc *) - profile: integer; - - (*** level - * - encoding: set by user - * - decoding: set by lavc *) - level: integer; - - (*** low resolution decoding. 1-> 1/2 size, 2->1/4 size - * - encoding: unused - * - decoding: set by user *) - lowres: integer; - - (*** bitsream width / height. may be different from width/height if lowres - * or other things are used - * - encoding: unused - * - decoding: set by user before init if known, codec should override / dynamically change if needed *) - coded_width, coded_height: integer; - - (*** frame skip threshold - * - encoding: set by user - * - decoding: unused *) - frame_skip_threshold: integer; - - (*** frame skip factor - * - encoding: set by user - * - decoding: unused *) - frame_skip_factor: integer; - - (*** frame skip exponent - * - encoding: set by user - * - decoding: unused *) - frame_skip_exp: integer; - - (*** frame skip comparission function - * - encoding: set by user. - * - decoding: unused *) - frame_skip_cmp: integer; - - (*** border processing masking. raises the quantizer for mbs on the borders - * of the picture. - * - encoding: set by user - * - decoding: unused *) - border_masking: single; - - (*** minimum MB lagrange multipler. - * - encoding: set by user. - * - decoding: unused *) - mb_lmin: integer; - - (*** maximum MB lagrange multipler. - * - encoding: set by user. - * - decoding: unused *) - mb_lmax: integer; - - (*** - * - encoding: set by user. - * - decoding: unused *) - me_penalty_compensation: integer; - - (*** - * - encoding: unused - * - decoding: set by user. *) - skip_loop_filter: TAVDiscard; - - (** * - * - encoding: unused - * - decoding: set by user. *) - skip_idct: TAVDiscard; - - (** * - * - encoding: unused - * - decoding: set by user. *) - skip_frame: TAVDiscard; - - (** * - * - encoding: set by user. - * - decoding: unused *) - bidir_refine: integer; - - (** * - * - encoding: set by user. - * - decoding: unused *) - brd_scale: integer; - - (** - * constant rate factor - quality-based VBR - values ~correspond to qps - * - encoding: set by user. - * - decoding: unused *) - crf: integer; - - (** - * constant quantization parameter rate control method - * - encoding: set by user. - * - decoding: unused *) - cqp: integer; - - (** - * minimum gop size - * - encoding: set by user. - * - decoding: unused *) - keyint_min: integer; - - (** - * number of reference frames - * - encoding: set by user. - * - decoding: unused *) - refs: integer; - - (** - * chroma qp offset from luma - * - encoding: set by user. - * - decoding: unused *) - chromaoffset: integer; - - (** - * influences how often b-frames are used - * - encoding: set by user. - * - decoding: unused *) - bframebias: integer; - - (** - * trellis RD quantization - * - encoding: set by user. - * - decoding: unused *) - trellis: integer; - - (** - * reduce fluctuations in qp (before curve compression) - * - encoding: set by user. - * - decoding: unused *) - complexityblur: single; - - (** - * in-loop deblocking filter alphac0 parameter - * alpha is in the range -6...6 - * - encoding: set by user. - * - decoding: unused *) - deblockalpha: integer; - - (** - * in-loop deblocking filter beta parameter - * beta is in the range -6...6 - * - encoding: set by user. - * - decoding: unused *) - deblockbeta: integer; - - (** - * macroblock subpartition sizes to consider - p8x8, p4x4, b8x8, i8x8, i4x4 - * - encoding: set by user. - * - decoding: unused *) - partitions: integer; - - (** - * direct mv prediction mode - 0 (none), 1 (spatial), 2 (temporal) - * - encoding: set by user. - * - decoding: unused *) - directpred: integer; - - (** - * audio cutoff bandwidth (0 means "automatic") . Currently used only by FAAC - * - encoding: set by user. - * - decoding: unused *) - cutoff: integer; - - (** - * multiplied by qscale for each frame and added to scene_change_score - * - encoding: set by user. - * - decoding: unused *) - scenechange_factor: integer; - - (** * - * note: value depends upon the compare functin used for fullpel ME - * - encoding: set by user. - * - decoding: unused *) - mv0_threshold: integer; - - (** - * adjusts sensitivity of b_frame_strategy 1 - * - encoding: set by user. - * - decoding: unused *) - b_sensitivity: integer; - - (** - * - encoding: set by user. - * - decoding: unused *) - compression_level: integer; - - (** - * sets whether to use LPC mode - used by FLAC encoder - * - encoding: set by user. - * - decoding: unused. *) - use_lpc: integer; - - (** - * LPC coefficient precision - used by FLAC encoder - * - encoding: set by user. - * - decoding: unused. *) - lpc_coeff_precision: integer; - - (** - * - encoding: set by user. - * - decoding: unused. *) - min_prediction_order: integer; - - (** - * - encoding: set by user. - * - decoding: unused. *) - max_prediction_order: integer; - - (** - * search method for selecting prediction order - * - encoding: set by user. - * - decoding: unused. *) - prediction_order_method: integer; - - (** - * - encoding: set by user. - * - decoding: unused. *) - min_partition_order: integer; - - (** - * - encoding: set by user. - * - decoding: unused. *) - max_partition_order: integer; - end; - -(** - * AVCodec. - *) - TAVCodec = record - name: pchar; - _type: TCodecType; - id: TCodecID; - priv_data_size: integer; - init: function (avctx: PAVCodecContext): integer; cdecl; (* typo corretion by the Creative CAT *) - encode: function (avctx: PAVCodecContext; buf: pchar; buf_size: integer; data: pointer): integer; cdecl; - close: function (avctx: PAVCodecContext): integer; cdecl; - decode: function (avctx: PAVCodecContext; outdata: pointer; outdata_size: PInteger; - buf: pchar; buf_size: integer): integer; cdecl; - capabilities: integer; -// todo: check this -> -// void *dummy; // FIXME remove next time we break binary compatibility - next: PAVCodec; - flush: procedure (avctx: PAVCodecContext); cdecl; - supported_framerates: PAVRational; ///array of supported framerates, or NULL if any, array is terminated by {0,0} - pix_fmts: PAVPixelFormat; ///array of supported pixel formats, or NULL if unknown, array is terminanted by -1 - end; - -(** - * four components are given, that's all. - * the last component is alpha - *) - PAVPicture = ^TAVPicture; - TAVPicture = record - data: array [0..3] of pchar; - linesize: array [0..3] of integer; ///< number of bytes per line - end; - -(** - * AVPaletteControl - * This structure defines a method for communicating palette changes - * between and demuxer and a decoder. - * this is totally broken, palette changes should be sent as AVPackets - *) - TAVPaletteControl = record - (* demuxer sets this to 1 to indicate the palette has changed; - * decoder resets to 0 *) - palette_changed: integer; - - (* 4-byte ARGB palette entries, stored in native byte order; note that - * the individual palette components should be on a 8-bit scale; if - * the palette data comes from a IBM VGA native format, the component - * data is probably 6 bits in size and needs to be scaled *) - palette: array [0..AVPALETTE_COUNT - 1] of cardinal; - end; - - PAVSubtitleRect = ^TAVSubtitleRect; - TAVSubtitleRect = record - x: word; - y: word; - w: word; - h: word; - nb_colors: word; - linesize: integer; - rgba_palette: PCardinal; - bitmap: pchar; - end; - - PAVSubtitle = ^TAVSubtitle; - TAVSubtitle = record {20} - format: word; (* 0 = graphics *) - start_display_time: cardinal; (* relative to packet pts, in ms *) - end_display_time: cardinal; (* relative to packet pts, in ms *) - num_rects: cardinal; - rects: PAVSubtitleRect; - end; - - -(* resample.c *) - - PReSampleContext = pointer; - PAVResampleContext = pointer; - PImgReSampleContext = pointer; - -function audio_resample_init (output_channels: integer; input_channels: integer; - output_rate: integer; input_rate: integer): PReSampleContext; - cdecl; external av__codec; - -function audio_resample (s: PReSampleContext; output: PWord; input: PWord; nb_samples: integer): integer; - cdecl; external av__codec; - -procedure audio_resample_close (s: PReSampleContext); - cdecl; external av__codec; - - -function av_resample_init (out_rate: integer; in_rate: integer; filter_length: integer; - log2_phase_count: integer; linear: integer; cutoff: double): PAVResampleContext; - cdecl; external av__codec; - -function av_resample (c: PAVResampleContext; dst: PWord; src: PWord; consumed: PInteger; - src_size: integer; dst_size: integer; update_ctx: integer): integer; - cdecl; external av__codec; - -procedure av_resample_compensate (c: PAVResampleContext; sample_delta: integer; - compensation_distance: integer); - cdecl; external av__codec; - -procedure av_resample_close (c: PAVResampleContext); - cdecl; external av__codec; - - -(* YUV420 format is assumed ! *) - - function img_resample_init (output_width: integer; output_height: integer; - input_width: integer; input_height: integer): PImgReSampleContext; - cdecl; external av__codec; - - function img_resample_full_init (owidth: integer; oheight: integer; - iwidth: integer; iheight: integer; - topBand: integer; bottomBand: integer; - leftBand: integer; rightBand: integer; - padtop: integer; padbottom: integer; - padleft: integer; padright: integer): PImgReSampleContext; - cdecl; external av__codec; - - procedure img_resample (s: PImgReSampleContext; output: PAVPicture; const input: PAVPicture); - cdecl; external av__codec; - - procedure img_resample_close (s: PImgReSampleContext); - cdecl; external av__codec; - -(** - * Allocate memory for a picture. Call avpicture_free to free it. - * - * @param picture the picture to be filled in. - * @param pix_fmt the format of the picture. - * @param width the width of the picture. - * @param height the height of the picture. - * @return 0 if successful, -1 if not. - *) - function avpicture_alloc (picture: PAVPicture; pix_fmt: TAVPixelFormat; - width: integer; height: integer): integer; - cdecl; external av__codec; - - -(* Free a picture previously allocated by avpicture_alloc. *) - procedure avpicture_free (picture: PAVPicture); - cdecl; external av__codec; - - function avpicture_fill (picture: PAVPicture; ptr: pointer; - pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; - cdecl; external av__codec; - - function avpicture_layout (const src: PAVPicture; pix_fmt: TAVPixelFormat; - width: integer; height: integer; - dest: pchar; dest_size: integer): integer; - cdecl; external av__codec; - - function avpicture_get_size (pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; - cdecl; external av__codec; - - procedure avcodec_get_chroma_sub_sample (pix_fmt: TAVPixelFormat; h_shift: Pinteger; v_shift: pinteger); - cdecl; external av__codec; - - function avcodec_get_pix_fmt_name(pix_fmt: TAVPixelFormat): pchar; - cdecl; external av__codec; - - procedure avcodec_set_dimensions(s: PAVCodecContext; width: integer; height: integer); - cdecl; external av__codec; - - function avcodec_get_pix_fmt(const name: pchar): TAVPixelFormat; - cdecl; external av__codec; - - function avcodec_pix_fmt_to_codec_tag(p: TAVPixelFormat): cardinal; - cdecl; external av__codec; - - function avcodec_get_pix_fmt_loss (dst_pix_fmt: TAVPixelFormat; src_pix_fmt: TAVPixelFormat; - has_alpha: integer): integer; - cdecl; external av__codec; - - function avcodec_find_best_pix_fmt (pix_fmt_mask: integer; src_pix_fmt: TAVPixelFormat; - has_alpha: integer; loss_ptr: pinteger): integer; - cdecl; external av__codec; - - function img_get_alpha_info (const src: PAVPicture; - pix_fmt: TAVPixelFormat; - width: integer; height: integer): integer; - cdecl; external av__codec; - - -(* convert among pixel formats *) - function img_convert (dst: PAVPicture; dst_pix_fmt: TAVPixelFormat; - const src: PAVPicture; pix_fmt: TAVPixelFormat; - width: integer; height: integer): integer; - cdecl; external av__codec; - -(* deinterlace a picture *) - function avpicture_deinterlace (dst: PAVPicture; const src: PAVPicture; - pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; - cdecl; external av__codec; - -(* returns LIBAVCODEC_VERSION_INT constant *) - function avcodec_version (): cardinal; - cdecl; external av__codec; - -(* returns LIBAVCODEC_BUILD constant *) - function avcodec_build (): cardinal; - cdecl; external av__codec; - - procedure avcodec_init (); - cdecl; external av__codec; - - procedure register_avcodec (format: PAVCodec); - cdecl; external av__codec; - - function avcodec_find_encoder (id: TCodecID): PAVCodec; - cdecl; external av__codec; - function avcodec_find_encoder_by_name (name: pchar): PAVCodec; - cdecl; external av__codec; - function avcodec_find_decoder(id: TCodecID): PAVCodec; - cdecl; external av__codec; - function avcodec_find_decoder_by_name (name: pchar): PAVCodec; - cdecl; external av__codec; - procedure avcodec_string(buf: pchar; buf_size: integer; enc: PAVCodecContext; encode: integer); - cdecl; external av__codec; - - procedure avcodec_get_context_defaults (s: PAVCodecContext); - cdecl; external av__codec; - function avcodec_alloc_context : PAVCodecContext; - cdecl; external av__codec; -(* favourite of The Creative CAT - function avcodec_alloc_context (): PAVCodecContext; - cdecl; external av__codec; *) - procedure avcodec_get_frame_defaults (pic: PAVFrame); - cdecl; external av__codec; - function avcodec_alloc_frame : PAVFrame; - cdecl; external av__codec; -(* favourite of The Creative CAT - function avcodec_alloc_frame (): PAVFrame; - cdecl; external av__codec; *) - - function avcodec_default_get_buffer (s: PAVCodecContext; pic: PAVFrame): integer; - cdecl; external av__codec; - procedure avcodec_default_release_buffer (s: PAVCodecContext; pic: PAVFrame); - cdecl; external av__codec; - function avcodec_default_reget_buffer (s: PAVCodecContext; pic: PAVFrame): integer; - cdecl; external av__codec; - procedure avcodec_align_dimensions(s: PAVCodecContext; width: Pinteger; height: PInteger); - cdecl; external av__codec; - function avcodec_check_dimensions (av_log_ctx: pointer; w: cardinal; h: cardinal): integer; - cdecl; external av__codec; - function avcodec_default_get_format(s: PAVCodecContext; const fmt: PAVPixelFormat): TAVPixelFormat; - cdecl; external av__codec; - - function avcodec_thread_init (s: PAVCodecContext; thread_count: integer): integer; - cdecl; external av__codec; - procedure avcodec_thread_free (s: PAVCodecContext); - cdecl; external av__codec; - function avcodec_thread_execute (s: PAVCodecContext; func: pointer; arg: PPointer; ret: Pinteger; count: integer): integer; - cdecl; external av__codec; - function avcodec_default_execute (s: PAVCodecContext; func: pointer; arg: PPointer; ret: Pinteger; count: integer): integer; - cdecl; external av__codec; - - -//FIXME func typedef - -(** - * opens / inits the AVCodecContext. - * not thread save! - *) - function avcodec_open (avctx: PAVCodecContext; codec: PAVCodec): integer; - cdecl; external av__codec; - - -(** - * Decode an audio frame. - * - * @param avctx the codec context. - * @param samples output buffer, 16 byte aligned - * @param frame_size_ptr the output buffer size in bytes, zero if no frame could be compressed - * @param buf input buffer, 16 byte aligned - * @param buf_size the input buffer size - * @return 0 if successful, -1 if not. - *) - -(** This comment was added by the Creative CAT. frame_size_ptr was changed to - variable refference. - - * @deprecated Use avcodec_decode_audio2() instead. - *) - - function avcodec_decode_audio (avctx: PAVCodecContext; samples: Pword; - var frame_size_ptr: integer; - buf: pchar; buf_size: integer): integer; - cdecl; external av__codec; -(* decode a frame. - * @param buf bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE larger then the actual read bytes - * because some optimized bitstream readers read 32 or 64 bit at once and could read over the end - * @param buf_size the size of the buffer in bytes - * @param got_picture_ptr zero if no frame could be decompressed, Otherwise, it is non zero - * @return -1 if error, otherwise return the number of - * bytes used. *) - - function avcodec_decode_audio2(avctx : PAVCodecContext; samples : PWord; - var frame_size_ptr : integer; - buf: pchar; buf_size: integer): integer; - cdecl; external av__codec; -(* Added by The Creative CAT -/** - * Decodes a video frame from \p buf into \p picture. - * The avcodec_decode_video() function decodes a video frame from the input - * buffer \p buf of size \p buf_size. To decode it, it makes use of the - * video codec which was coupled with \p avctx using avcodec_open(). The - * resulting decoded frame is stored in \p picture. - * - * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than - * the actual read bytes because some optimized bitstream readers read 32 or 64 - * bits at once and could read over the end. - * - * @warning The end of the input buffer \p buf should be set to 0 to ensure that - * no overreading happens for damaged MPEG streams. - * - * @note You might have to align the input buffer \p buf and output buffer \p - * samples. The alignment requirements depend on the CPU: on some CPUs it isn't - * necessary at all, on others it won't work at all if not aligned and on others - * it will work but it will have an impact on performance. In practice, the - * bitstream should have 4 byte alignment at minimum and all sample data should - * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If - * the linesize is not a multiple of 16 then there's no sense in aligning the - * start of the buffer to 16. - * - * @param avctx the codec context - * @param[out] picture The AVFrame in which the decoded video frame will be stored. - * @param[in] buf the input buffer - * @param[in] buf_size the size of the input buffer in bytes - * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. - * @return On error a negative value is returned, otherwise the number of bytes - * used or zero if no frame could be decompressed. - */ -*) - - function avcodec_decode_video (avctx: PAVCodecContext; picture: PAVFrame; - var got_picture_ptr: integer; (* favour of The Creative CAT *) - buf: PByte; buf_size: integer): integer; - cdecl; external av__codec; - - function avcodec_decode_subtitle (avctx: PAVCodecContext; sub: PAVSubtitle; - got_sub_ptr: pinteger; - const buf: pchar; buf_size: integer): integer; - cdecl; external av__codec; - function avcodec_parse_frame (avctx: PAVCodecContext; pdata: PPointer; - data_size_ptr: pinteger; - buf: pchar; buf_size: integer): integer; - cdecl; external av__codec; - - function avcodec_encode_audio (avctx: PAVCodecContext; buf: PByte; - buf_size: integer; const samples: PWord): integer; - cdecl; external av__codec; - - (* avcodec_encode_video: -1 if error *) - (* type of the second argument is changed by The Creative CAT *) - function avcodec_encode_video (avctx: PAVCodecContext; buf: PByte; - buf_size: integer; pict: PAVFrame): integer; - cdecl; external av__codec; - function avcodec_encode_subtitle (avctx: PAVCodecContext; buf: pchar; - buf_size: integer; const sub: PAVSubtitle): integer; - cdecl; external av__codec; - function avcodec_close (avctx: PAVCodecContext): integer; - cdecl; external av__codec; - - procedure avcodec_register_all (); - cdecl; external av__codec; - - procedure avcodec_flush_buffers (avctx: PAVCodecContext); - cdecl; external av__codec; - procedure avcodec_default_free_buffers (s: PAVCodecContext); - cdecl; external av__codec; - -(* misc usefull functions *) - -(** - * returns a single letter to describe the picture type - *) - function av_get_pict_type_char (pict_type: integer): char; - cdecl; external av__codec; - - -(** - * returns codec bits per sample - *) -function av_get_bits_per_sample (codec_id: TCodecID): integer; - cdecl; external av__codec; - -const - AV_PARSER_PTS_NB = 4; - PARSER_FLAG_COMPLETE_FRAMES = $0001; - -type - PAVCodecParserContext = ^TAVCodecParserContext; - PAVCodecParser = ^TAVCodecParser; - - TAVCodecParserContext = record - priv_data: pointer; - parser: PAVCodecParser; - frame_offset: int64; (* offset of the current frame *) - cur_offset: int64; (* current offset (incremented by each av_parser_parse()) *) - last_frame_offset: int64; (* offset of the last frame *) - (* video info *) - pict_type: integer; (* XXX: put it back in AVCodecContext *) - repeat_pict: integer; (* XXX: put it back in AVCodecContext *) - pts: int64; (* pts of the current frame *) - dts: int64; (* dts of the current frame *) - - (* private data *) - last_pts: int64; - last_dts: int64; - fetch_timestamp: integer; - - cur_frame_start_index: integer; - cur_frame_offset: array [0..AV_PARSER_PTS_NB - 1] of int64; - cur_frame_pts: array [0..AV_PARSER_PTS_NB - 1] of int64; - cur_frame_dts: array [0..AV_PARSER_PTS_NB - 1] of int64; - - flags: integer; - end; - - TAVCodecParser = record - codec_ids: array [0..4] of integer; (* several codec IDs are permitted *) - priv_data_size: integer; - parser_init: function (s: PAVCodecParserContext): integer; cdecl; - parser_parse: function (s: PAVCodecParserContext; avctx: PAVCodecContext; - poutbuf: PPointer; poutbuf_size: PInteger; - const buf: pchar; buf_size: integer): integer; cdecl; - parser_close: procedure (s: PAVCodecParserContext); cdecl; - split: function (avctx: PAVCodecContext; const buf: pchar; - buf_size: integer): integer; cdecl; - next: PAVCodecParser; - end; - - procedure av_register_codec_parser (parser: PAVCodecParser); cdecl; - cdecl; external av__codec; - - function av_parser_init (codec_id: integer): PAVCodecParserContext; - cdecl; external av__codec; - - function av_parser_parse (s: PAVCodecParserContext; - avctx: PAVCodecContext; - poutbuf: PPointer; poutbuf_size: pinteger; - const buf: pchar; buf_size: integer; - pts: int64; dts: int64): integer; - cdecl; external av__codec; - function av_parser_change (s: PAVCodecParserContext; - avctx: PAVCodecContext; - poutbuf: PPointer; poutbuf_size: PInteger; - const buf: pchar; buf_size: integer; keyframe: integer): integer; - cdecl; external av__codec; - procedure av_parser_close (s: PAVCodecParserContext); - cdecl; external av__codec; - -type - PAVBitStreamFilterContext = ^TAVBitStreamFilterContext; - PAVBitStreamFilter = ^TAVBitStreamFilter; - - TAVBitStreamFilterContext = record - priv_data: pointer; - filter: PAVBitStreamFilter; - parser: PAVCodecParserContext; - next: PAVBitStreamFilterContext; - end; - - TAVBitStreamFilter = record - name: pchar; - priv_data_size: integer; - filter: function (bsfc: PAVBitStreamFilterContext; - avctx: PAVCodecContext; args: pchar; - poutbuf: PPointer; poutbuf_size: PInteger; - buf: PByte; buf_size: integer; keyframe: integer): integer; cdecl; - next: PAVBitStreamFilter; - end; - -procedure av_register_bitstream_filter (bsf: PAVBitStreamFilter); - cdecl; external av__codec; - -function av_bitstream_filter_init (name: pchar): PAVBitStreamFilterContext; - cdecl; external av__codec; - -function av_bitstream_filter_filter (bsfc: PAVBitStreamFilterContext; - avctx: PAVCodecContext; args: pchar; - poutbuf: PPointer; poutbuf_size: PInteger; - buf: PByte; buf_size: integer; keyframe: integer): integer; - cdecl; external av__codec; -procedure av_bitstream_filter_close (bsf: PAVBitStreamFilterContext); - cdecl; external av__codec; - - -(* memory *) - procedure av_fast_realloc (ptr: pointer; size: PCardinal; min_size: Cardinal); - cdecl; external av__codec; -(* for static data only *) -(* call av_free_static to release all staticaly allocated tables *) - procedure av_free_static (); - cdecl; external av__codec; - - procedure av_mallocz_static(size: cardinal); - cdecl; external av__codec; - - procedure av_realloc_static(ptr: pointer; size: Cardinal); - cdecl; external av__codec; - - procedure img_copy (dst: PAVPicture; const src: PAVPicture; - pix_fmt: TAVPixelFormat; width: integer; height: integer); - cdecl; external av__codec; - - function img_crop (dst: PAVPicture; const src: PAVPicture; - pix_fmt: TAVPixelFormat; top_band, left_band: integer): integer; - cdecl; external av__codec; - - function img_pad (dst: PAVPicture; const src: PAVPicture; height, width: integer; - pix_fmt: TAVPixelFormat; padtop, padbottom, padleft, padright: integer; - color: PInteger): integer; - cdecl; external av__codec; - -implementation - -end. +{$ENDIF} + + + LIBAVUTIL_VERSION_INT = ((51 shl 16) + (12 shl 8) + 1); + LIBAVUTIL_VERSION = '51.12.1'; + LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; + + AV_NOPTS_VALUE: int64 = $8000000000000000; + AV_TIME_BASE = 1000000; + AV_TIME_BASE_Q : TAVRational = (num:1; den:AV_TIME_BASE); (* added by CAT *) + +type + TCodecID = ( + CODEC_ID_NONE, CODEC_ID_MPEG1VIDEO, + CODEC_ID_MPEG2VIDEO, //* prefered ID for MPEG Video 1 or 2 decoding */ + CODEC_ID_MPEG2VIDEO_XVMC, CODEC_ID_H261, CODEC_ID_H263, CODEC_ID_RV10, + CODEC_ID_RV20, CODEC_ID_MJPEG, CODEC_ID_MJPEGB, CODEC_ID_LJPEG, + CODEC_ID_SP5X, CODEC_ID_JPEGLS, CODEC_ID_MPEG4, CODEC_ID_RAWVIDEO, + CODEC_ID_MSMPEG4V1, CODEC_ID_MSMPEG4V2, CODEC_ID_MSMPEG4V3, + CODEC_ID_WMV1, CODEC_ID_WMV2, CODEC_ID_H263P, + CODEC_ID_H263I, CODEC_ID_FLV1, CODEC_ID_SVQ1, CODEC_ID_SVQ3, + CODEC_ID_DVVIDEO, CODEC_ID_HUFFYUV, CODEC_ID_CYUV, CODEC_ID_H264, + CODEC_ID_INDEO3, CODEC_ID_VP3, CODEC_ID_THEORA, CODEC_ID_ASV1, + CODEC_ID_ASV2, CODEC_ID_FFV1, CODEC_ID_4XM, CODEC_ID_VCR1, + CODEC_ID_CLJR, CODEC_ID_MDEC, CODEC_ID_ROQ, CODEC_ID_INTERPLAY_VIDEO, + CODEC_ID_XAN_WC3, CODEC_ID_XAN_WC4, CODEC_ID_RPZA, CODEC_ID_CINEPAK, + CODEC_ID_WS_VQA, CODEC_ID_MSRLE, CODEC_ID_MSVIDEO1, CODEC_ID_IDCIN, + CODEC_ID_8BPS, CODEC_ID_SMC, CODEC_ID_FLIC, CODEC_ID_TRUEMOTION1, + CODEC_ID_VMDVIDEO, CODEC_ID_MSZH, CODEC_ID_ZLIB, CODEC_ID_QTRLE, + CODEC_ID_SNOW, CODEC_ID_TSCC, CODEC_ID_ULTI, CODEC_ID_QDRAW, + CODEC_ID_VIXL, CODEC_ID_QPEG, CODEC_ID_XVID, CODEC_ID_PNG, + CODEC_ID_PPM, CODEC_ID_PBM, CODEC_ID_PGM, CODEC_ID_PGMYUV, + CODEC_ID_PAM, CODEC_ID_FFVHUFF, CODEC_ID_RV30, CODEC_ID_RV40, + CODEC_ID_VC1, CODEC_ID_WMV3, CODEC_ID_LOCO, CODEC_ID_WNV1, + CODEC_ID_AASC, CODEC_ID_INDEO2, CODEC_ID_FRAPS, CODEC_ID_TRUEMOTION2, + CODEC_ID_BMP, CODEC_ID_CSCD, CODEC_ID_MMVIDEO, CODEC_ID_ZMBV, + CODEC_ID_AVS, CODEC_ID_SMACKVIDEO, CODEC_ID_NUV, CODEC_ID_KMVC, + CODEC_ID_FLASHSV, CODEC_ID_CAVS, CODEC_ID_JPEG2000, CODEC_ID_VMNC, + CODEC_ID_VP5, CODEC_ID_VP6, CODEC_ID_VP6F, + + //* various pcm "codecs" */ + CODEC_ID_PCM_S16LE= $10000, CODEC_ID_PCM_S16BE, CODEC_ID_PCM_U16LE, + CODEC_ID_PCM_U16BE, CODEC_ID_PCM_S8, CODEC_ID_PCM_U8, CODEC_ID_PCM_MULAW, + CODEC_ID_PCM_ALAW, CODEC_ID_PCM_S32LE, CODEC_ID_PCM_S32BE, CODEC_ID_PCM_U32LE, + CODEC_ID_PCM_U32BE, CODEC_ID_PCM_S24LE, CODEC_ID_PCM_S24BE, CODEC_ID_PCM_U24LE, + CODEC_ID_PCM_U24BE, CODEC_ID_PCM_S24DAUD, + //* various adpcm codecs */ + CODEC_ID_ADPCM_IMA_QT= $11000, CODEC_ID_ADPCM_IMA_WAV, CODEC_ID_ADPCM_IMA_DK3, + CODEC_ID_ADPCM_IMA_DK4, CODEC_ID_ADPCM_IMA_WS, CODEC_ID_ADPCM_IMA_SMJPEG, + CODEC_ID_ADPCM_MS, CODEC_ID_ADPCM_4XM, CODEC_ID_ADPCM_XA, CODEC_ID_ADPCM_ADX, + CODEC_ID_ADPCM_EA, CODEC_ID_ADPCM_G726, CODEC_ID_ADPCM_CT, CODEC_ID_ADPCM_SWF, + CODEC_ID_ADPCM_YAMAHA, CODEC_ID_ADPCM_SBPRO_4, CODEC_ID_ADPCM_SBPRO_3, + CODEC_ID_ADPCM_SBPRO_2, + //* AMR */ + CODEC_ID_AMR_NB= $12000, CODEC_ID_AMR_WB, + //* RealAudio codecs*/ + CODEC_ID_RA_144= $13000, CODEC_ID_RA_288, + //* various DPCM codecs */ + CODEC_ID_ROQ_DPCM= $14000, CODEC_ID_INTERPLAY_DPCM, CODEC_ID_XAN_DPCM, + CODEC_ID_SOL_DPCM, CODEC_ID_MP2= $15000, + CODEC_ID_MP3, //* prefered ID for MPEG Audio layer 1, 2 or3 decoding */ + CODEC_ID_AAC, CODEC_ID_MPEG4AAC, CODEC_ID_AC3, CODEC_ID_DTS, CODEC_ID_VORBIS, + CODEC_ID_DVAUDIO, CODEC_ID_WMAV1, CODEC_ID_WMAV2, CODEC_ID_MACE3, + CODEC_ID_MACE6, CODEC_ID_VMDAUDIO, CODEC_ID_SONIC, CODEC_ID_SONIC_LS, + CODEC_ID_FLAC, CODEC_ID_MP3ADU, CODEC_ID_MP3ON4, CODEC_ID_SHORTEN, + CODEC_ID_ALAC, CODEC_ID_WESTWOOD_SND1, CODEC_ID_GSM, CODEC_ID_QDM2, + CODEC_ID_COOK, CODEC_ID_TRUESPEECH, CODEC_ID_TTA, CODEC_ID_SMACKAUDIO, + CODEC_ID_QCELP, CODEC_ID_WAVPACK, + //* subtitle codecs */ + CODEC_ID_DVD_SUBTITLE= $17000, CODEC_ID_DVB_SUBTITLE, + + CODEC_ID_MPEG2TS= $20000 //* _FAKE_ codec to indicate a raw MPEG2 transport + // stream (only used by libavformat) */ + ); + +//* CODEC_ID_MP3LAME is absolete */ +const + CODEC_ID_MP3LAME = CODEC_ID_MP3; + + AVPALETTE_SIZE = 1024; + AVPALETTE_COUNT = 256; + +type + TCodecType = ( + CODEC_TYPE_UNKNOWN = -1, + CODEC_TYPE_VIDEO, + CODEC_TYPE_AUDIO, + CODEC_TYPE_DATA, + CODEC_TYPE_SUBTITLE, + CODEC_TYPE_NB (* CAT#3 *) + ); + +//* currently unused, may be used if 24/32 bits samples ever supported */ +//* all in native endian */ + TSampleFormat = ( + SAMPLE_FMT_NONE = -1, + SAMPLE_FMT_U8, ///< unsigned 8 bits + SAMPLE_FMT_S16, ///< signed 16 bits + SAMPLE_FMT_S24, ///< signed 24 bits + SAMPLE_FMT_S32, ///< signed 32 bits + SAMPLE_FMT_FLT ///< float + ); + +const +//* in bytes */ + AVCODEC_MAX_AUDIO_FRAME_SIZE = 192000; // 1 second of 48khz 32bit audio + +(** + * Required number of additionally allocated bytes at the end of the input bitstream for decoding. + * this is mainly needed because some optimized bitstream readers read + * 32 or 64 bit at once and could read over the end
+ * Note, if the first 23 bits of the additional bytes are not 0 then damaged + * MPEG bitstreams could cause overread and segfault + *) + FF_INPUT_BUFFER_PADDING_SIZE = 8; + +(** + * minimum encoding buffer size. + * used to avoid some checks during header writing + *) + FF_MIN_BUFFER_SIZE = 16384; + +type +//* motion estimation type, EPZS by default */ + TMotion_Est_ID = ( + ME_ZERO = 1, + ME_FULL, + ME_LOG, + ME_PHODS, + ME_EPZS, + ME_X1, + ME_HEX, + ME_UMH, + ME_ITER + ); + + TAVDiscard = ( +//we leave some space between them for extensions (drop some keyframes for intra only or drop just some bidir frames) + AVDISCARD_NONE = -16, ///< discard nothing + AVDISCARD_DEFAULT= 0, ///< discard useless packets like 0 size packets in avi + AVDISCARD_NONREF = 8, ///< discard all non reference + AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames + AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes + AVDISCARD_ALL = 48, ///< discard all + AVDISCARD_FUCK = $FFFFFF + ); + + PRcOverride = ^TRcOverride; + TRcOverride = record {16} + start_frame: integer; + end_frame: integer; + qscale: integer; // if this is 0 then quality_factor will be used instead + quality_factor: single; + end; + +const + FF_MAX_B_FRAMES = 16; + +(* encoding support + these flags can be passed in AVCodecContext.flags before initing + Note: not everything is supported yet. +*) + + CODEC_FLAG_QSCALE = $0002; ///< use fixed qscale + CODEC_FLAG_4MV = $0004; ///< 4 MV per MB allowed / Advanced prediction for H263 + CODEC_FLAG_QPEL = $0010; ///< use qpel MC + CODEC_FLAG_GMC = $0020; ///< use GMC + CODEC_FLAG_MV0 = $0040; ///< always try a MB with MV=<0,0> + CODEC_FLAG_PART = $0080; ///< use data partitioning +//* parent program gurantees that the input for b-frame containing streams is not written to +// for at least s->max_b_frames+1 frames, if this is not set than the input will be copied */ + CODEC_FLAG_INPUT_PRESERVED = $0100; + CODEC_FLAG_PASS1 = $0200; ///< use internal 2pass ratecontrol in first pass mode + CODEC_FLAG_PASS2 = $0400; ///< use internal 2pass ratecontrol in second pass mode + CODEC_FLAG_EXTERN_HUFF = $1000; ///< use external huffman table (for mjpeg) + CODEC_FLAG_GRAY = $2000; ///< only decode/encode grayscale + CODEC_FLAG_EMU_EDGE = $4000; ///< don't draw edges + CODEC_FLAG_PSNR = $8000; ///< error[?] variables will be set during encoding + CODEC_FLAG_TRUNCATED = $00010000; //** input bitstream might be truncated at a random location instead + // of only at frame boundaries */ + CODEC_FLAG_NORMALIZE_AQP = $00020000; ///< normalize adaptive quantization + CODEC_FLAG_INTERLACED_DCT = $00040000; ///< use interlaced dct + CODEC_FLAG_LOW_DELAY = $00080000; ///< force low delay + CODEC_FLAG_ALT_SCAN = $00100000; ///< use alternate scan + CODEC_FLAG_TRELLIS_QUANT = $00200000; ///< use trellis quantization + CODEC_FLAG_GLOBAL_HEADER = $00400000; ///< place global headers in extradata instead of every keyframe + CODEC_FLAG_BITEXACT = $00800000; ///< use only bitexact stuff (except (i)dct) +//* Fx : Flag for h263+ extra options */ + CODEC_FLAG_H263P_AIC = $01000000; ///< H263 Advanced intra coding / MPEG4 AC prediction (remove this) + CODEC_FLAG_AC_PRED = $01000000; ///< H263 Advanced intra coding / MPEG4 AC prediction + CODEC_FLAG_H263P_UMV = $02000000; ///< Unlimited motion vector + CODEC_FLAG_CBP_RD = $04000000; ///< use rate distortion optimization for cbp + CODEC_FLAG_QP_RD = $08000000; ///< use rate distortion optimization for qp selectioon + CODEC_FLAG_H263P_AIV = $00000008; ///< H263 Alternative inter vlc + CODEC_FLAG_OBMC = $00000001; ///< OBMC + CODEC_FLAG_LOOP_FILTER = $00000800; ///< loop filter + CODEC_FLAG_H263P_SLICE_STRUCT = $10000000; + CODEC_FLAG_INTERLACED_ME = $20000000; ///< interlaced motion estimation + CODEC_FLAG_SVCD_SCAN_OFFSET = $40000000; ///< will reserve space for SVCD scan offset user data + CODEC_FLAG_CLOSED_GOP = $80000000; + CODEC_FLAG2_FAST = $00000001; ///< allow non spec compliant speedup tricks + CODEC_FLAG2_STRICT_GOP = $00000002; ///< strictly enforce GOP size + CODEC_FLAG2_NO_OUTPUT = $00000004; ///< skip bitstream encoding + CODEC_FLAG2_LOCAL_HEADER = $00000008; ///< place global headers at every keyframe instead of in extradata + CODEC_FLAG2_BPYRAMID = $00000010; ///< H.264 allow b-frames to be used as references + CODEC_FLAG2_WPRED = $00000020; ///< H.264 weighted biprediction for b-frames + CODEC_FLAG2_MIXED_REFS = $00000040; ///< H.264 multiple references per partition + CODEC_FLAG2_8X8DCT = $00000080; ///< H.264 high profile 8x8 transform + CODEC_FLAG2_FASTPSKIP = $00000100; ///< H.264 fast pskip + CODEC_FLAG2_AUD = $00000200; ///< H.264 access unit delimiters + CODEC_FLAG2_BRDO = $00000400; ///< b-frame rate-distortion optimization + CODEC_FLAG2_INTRA_VLC = $00000800; ///< use MPEG-2 intra VLC table + CODEC_FLAG2_MEMC_ONLY = $00001000; ///< only do ME/MC (I frames -> ref, P frame -> ME+MC) + +(* Unsupported options : + * Syntax Arithmetic coding (SAC) + * Reference Picture Selection + * Independant Segment Decoding */ +/* /Fx */ +/* codec capabilities *) + +const + CODEC_CAP_DRAW_HORIZ_BAND = $001; ///< decoder can use draw_horiz_band callback +(** + * Codec uses get_buffer() for allocating buffers. + * direct rendering method 1 *) + CODEC_CAP_DR1 = $002; +(* if 'parse_only' field is true, then avcodec_parse_frame() can be used *) + CODEC_CAP_PARSE_ONLY = $004; + CODEC_CAP_TRUNCATED = $008; +//* codec can export data for HW decoding (XvMC) */ + CODEC_CAP_HWACCEL = $010; + +(** + * codec has a non zero delay and needs to be feeded with NULL at the end to get the delayed data. + * if this is not set, the codec is guranteed to never be feeded with NULL data *) + CODEC_CAP_DELAY = $0020; +(** + * Codec can be fed a final frame with a smaller size. + * This can be used to prevent truncation of the last audio samples. *) + CODEC_CAP_SMALL_LAST_FRAME = $0040; + +//the following defines may change, don't expect compatibility if you use them + MB_TYPE_INTRA4x4 = $001; + MB_TYPE_INTRA16x16 = $002; //FIXME h264 specific + MB_TYPE_INTRA_PCM = $004; //FIXME h264 specific + MB_TYPE_16x16 = $008; + MB_TYPE_16x8 = $010; + MB_TYPE_8x16 = $020; + MB_TYPE_8x8 = $040; + MB_TYPE_INTERLACED = $080; + MB_TYPE_DIRECT2 = $100; //FIXME + MB_TYPE_ACPRED = $200; + MB_TYPE_GMC = $400; + MB_TYPE_SKIP = $800; + MB_TYPE_P0L0 = $1000; + MB_TYPE_P1L0 = $2000; + MB_TYPE_P0L1 = $4000; + MB_TYPE_P1L1 = $8000; + MB_TYPE_L0 = (MB_TYPE_P0L0 or MB_TYPE_P1L0); + MB_TYPE_L1 = (MB_TYPE_P0L1 or MB_TYPE_P1L1); + MB_TYPE_L0L1 = (MB_TYPE_L0 or MB_TYPE_L1); + MB_TYPE_QUANT = $0010000; + MB_TYPE_CBP = $0020000; +//Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...) + +type +(** + * Pan Scan area. + * this specifies the area which should be displayed. Note there may be multiple such areas for one frame *) + PAVPanScan = ^TAVPanScan; + TAVPanScan = record {24} + (*** id. + * - encoding: set by user. + * - decoding: set by lavc *) + id: integer; + + (*** width and height in 1/16 pel + * - encoding: set by user. + * - decoding: set by lavc *) + width: integer; + height: integer; + + (*** position of the top left corner in 1/16 pel for up to 3 fields/frames. + * - encoding: set by user. + * - decoding: set by lavc *) + position: array [0..2] of array [0..1] of smallint; + end; + +const + FF_QSCALE_TYPE_MPEG1 = 0; + FF_QSCALE_TYPE_MPEG2 = 1; + + FF_BUFFER_TYPE_INTERNAL = 1; + FF_BUFFER_TYPE_USER = 2; ///< Direct rendering buffers (image is (de)allocated by user) + FF_BUFFER_TYPE_SHARED = 4; ///< buffer from somewhere else, don't dealloc image (data/base), all other tables are not shared + FF_BUFFER_TYPE_COPY = 8; ///< just a (modified) copy of some other buffer, don't dealloc anything + + + FF_I_TYPE = 1; // Intra + FF_P_TYPE = 2; // Predicted + FF_B_TYPE = 3; // Bi-dir predicted + FF_S_TYPE = 4; // S(GMC)-VOP MPEG4 + FF_SI_TYPE = 5; + FF_SP_TYPE = 6; + + FF_BUFFER_HINTS_VALID = $01; // Buffer hints value is meaningful (if 0 ignore) + FF_BUFFER_HINTS_READABLE = $02; // Codec will read from buffer + FF_BUFFER_HINTS_PRESERVE = $04; // User must not alter buffer content + FF_BUFFER_HINTS_REUSABLE = $08; // Codec will reuse the buffer (update) + +type + (*** Audio Video Frame. *) + PAVFrame = ^TAVFrame; + TAVFrame = record {200} + (*** pointer to the picture planes. + * this might be different from the first allocated byte *) + data: array [0..3] of pbyte; + linesize: array [0..3] of integer; + (*** pointer to the first allocated byte of the picture. can be used in get_buffer/release_buffer + * this isn't used by lavc unless the default get/release_buffer() is used*) + base: array [0..3] of pbyte; + (*** 1 -> keyframe, 0-> not *) + key_frame: integer; + (*** picture type of the frame, see ?_TYPE below.*) + pict_type: integer; + (*** presentation timestamp in time_base units (time when frame should be shown to user) + * if AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed*) + pts: int64; + (*** picture number in bitstream order.*) + coded_picture_number: integer; + (*** picture number in display order.*) + display_picture_number: integer; + (*** quality (between 1 (good) and FF_LAMBDA_MAX (bad)) *) + quality: integer; + (*** buffer age (1->was last buffer and dint change, 2->..., ...).*) + age: integer; + (*** is this picture used as reference*) + reference: integer; + (*** QP table*) + qscale_table: pchar; + (*** QP store stride*) + qstride: integer; + (*** mbskip_table[mb]>=1 if MB didnt change*) + mbskip_table: pbyte; + (** + * Motion vector table. + * @code + * example: + * int mv_sample_log2= 4 - motion_subsample_log2; + * int mb_width= (width+15)>>4; + * int mv_stride= (mb_width << mv_sample_log2) + 1; + * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y]; + * @endcode + * - encoding: set by user + * - decoding: set by lavc *) + motion_val: array [0..1] of pointer; + (*** Macroblock type table + * mb_type_base + mb_width + 2 *) + mb_type: PCardinal; + (*** log2 of the size of the block which a single vector in motion_val represents: + * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)*) + motion_subsample_log2: byte; + (*** for some private data of the user*) + opaque: pointer; + (*** error*) + error: array [0..3] of int64; + (*** type of the buffer (to keep track of who has to dealloc data[*]) + * Note: user allocated (direct rendering) & internal buffers can not coexist currently*) + _type: integer; + (*** when decoding, this signal how much the picture must be delayed. + * extra_delay = repeat_pict / (2*fps)*) + repeat_pict: integer; + qscale_type: integer; + (*** The content of the picture is interlaced.*) + interlaced_frame: integer; + (*** if the content is interlaced, is top field displayed first.*) + top_field_first: integer; + (*** Pan scan.*) + pan_scan: PAVPanScan; + (*** tell user application that palette has changed from previous frame.*) + palette_has_changed: integer; + (*** Codec suggestion on buffer type if != 0 + * - decoding: set by lavc (before get_buffer() call))*) + buffer_hints: integer; + (*** DCT coeffitients*) + dct_coeff: PsmallInt; + (*** Motion referece frame index*) + ref_index: array [0..1] of pshortint; + end; + +const + DEFAULT_FRAME_RATE_BASE = 1001000; + + FF_BUG_AUTODETECT = 1; ///< autodetection + FF_BUG_OLD_MSMPEG4 = 2; + FF_BUG_XVID_ILACE = 4; + FF_BUG_UMP4 = 8; + FF_BUG_NO_PADDING = 16; + FF_BUG_AMV = 32; + FF_BUG_AC_VLC = 0; ///< will be removed, libavcodec can now handle these non compliant files by default + FF_BUG_QPEL_CHROMA = 64; + FF_BUG_STD_QPEL = 128; + FF_BUG_QPEL_CHROMA2 = 256; + FF_BUG_DIRECT_BLOCKSIZE = 512; + FF_BUG_EDGE = 1024; + FF_BUG_HPEL_CHROMA = 2048; + FF_BUG_DC_CLIP = 4096; + FF_BUG_MS = 8192; ///< workaround various bugs in microsofts broken decoders + + FF_COMPLIANCE_VERY_STRICT = 2; ///< strictly conform to a older more strict version of the spec or reference software + FF_COMPLIANCE_STRICT = 1; ///< strictly conform to all the things in the spec no matter what consequences + FF_COMPLIANCE_NORMAL = 0; + FF_COMPLIANCE_INOFFICIAL = -1; ///< allow inofficial extensions + FF_COMPLIANCE_EXPERIMENTAL = -2; ///< allow non standarized experimental things + + FF_ER_CAREFUL = 1; + FF_ER_COMPLIANT = 2; + FF_ER_AGGRESSIVE = 3; + FF_ER_VERY_AGGRESSIVE = 4; + + FF_DCT_AUTO = 0; + FF_DCT_FASTINT = 1; + FF_DCT_INT = 2; + FF_DCT_MMX = 3; + FF_DCT_MLIB = 4; + FF_DCT_ALTIVEC = 5; + FF_DCT_FAAN = 6; + + FF_IDCT_AUTO = 0; + FF_IDCT_INT = 1; + FF_IDCT_SIMPLE = 2; + FF_IDCT_SIMPLEMMX = 3; + FF_IDCT_LIBMPEG2MMX = 4; + FF_IDCT_PS2 = 5; + FF_IDCT_MLIB = 6; + FF_IDCT_ARM = 7; + FF_IDCT_ALTIVEC = 8; + FF_IDCT_SH4 = 9; + FF_IDCT_SIMPLEARM = 10; + FF_IDCT_H264 = 11; + FF_IDCT_VP3 = 12; + FF_IDCT_IPP = 13; + FF_IDCT_XVIDMMX = 14; + + FF_EC_GUESS_MVS = 1; + FF_EC_DEBLOCK = 2; + + FF_MM_FORCE = $80000000; (* force usage of selected flags (OR) *) + (* lower 16 bits - CPU features *) + + FF_MM_MMX = $0001; (* standard MMX *) + FF_MM_3DNOW = $0004; (* AMD 3DNOW *) + FF_MM_MMXEXT = $0002; (* SSE integer functions or AMD MMX ext *) + FF_MM_SSE = $0008; (* SSE functions *) + FF_MM_SSE2 = $0010; (* PIV SSE2 functions *) + FF_MM_3DNOWEXT = $0020; (* AMD 3DNowExt *) + FF_MM_IWMMXT = $0100; (* XScale IWMMXT *) + + FF_PRED_LEFT = 0; + FF_PRED_PLANE = 1; + FF_PRED_MEDIAN = 2; + + FF_DEBUG_PICT_INFO = 1; + FF_DEBUG_RC = 2; + FF_DEBUG_BITSTREAM = 4; + FF_DEBUG_MB_TYPE = 8; + FF_DEBUG_QP = 16; + FF_DEBUG_MV = 32; + FF_DEBUG_DCT_COEFF = $00000040; + FF_DEBUG_SKIP = $00000080; + FF_DEBUG_STARTCODE = $00000100; + FF_DEBUG_PTS = $00000200; + FF_DEBUG_ER = $00000400; + FF_DEBUG_MMCO = $00000800; + FF_DEBUG_BUGS = $00001000; + FF_DEBUG_VIS_QP = $00002000; + FF_DEBUG_VIS_MB_TYPE = $00004000; + + FF_DEBUG_VIS_MV_P_FOR = $00000001; //visualize forward predicted MVs of P frames + FF_DEBUG_VIS_MV_B_FOR = $00000002; //visualize forward predicted MVs of B frames + FF_DEBUG_VIS_MV_B_BACK = $00000004; //visualize backward predicted MVs of B frames + + FF_CMP_SAD = 0; + FF_CMP_SSE = 1; + FF_CMP_SATD = 2; + FF_CMP_DCT = 3; + FF_CMP_PSNR = 4; + FF_CMP_BIT = 5; + FF_CMP_RD = 6; + FF_CMP_ZERO = 7; + FF_CMP_VSAD = 8; + FF_CMP_VSSE = 9; + FF_CMP_NSSE = 10; + FF_CMP_W53 = 11; + FF_CMP_W97 = 12; + FF_CMP_DCTMAX = 13; + FF_CMP_CHROMA = 256; + + FF_DTG_AFD_SAME = 8; + FF_DTG_AFD_4_3 = 9; + FF_DTG_AFD_16_9 = 10; + FF_DTG_AFD_14_9 = 11; + FF_DTG_AFD_4_3_SP_14_9 = 13; + FF_DTG_AFD_16_9_SP_14_9 = 14; + FF_DTG_AFD_SP_4_3 = 15; + + FF_DEFAULT_QUANT_BIAS = 999999; + + FF_LAMBDA_SHIFT = 7; + FF_LAMBDA_SCALE = (1 shl FF_LAMBDA_SHIFT); + FF_QP2LAMBDA = 118; ///< factor to convert from H.263 QP to lambda + FF_LAMBDA_MAX = (256 * 128 - 1); + + FF_QUALITY_SCALE = FF_LAMBDA_SCALE; //FIXME maybe remove + + FF_CODER_TYPE_VLC = 0; + FF_CODER_TYPE_AC = 1; + + SLICE_FLAG_CODED_ORDER = $0001; ///< draw_horiz_band() is called in coded order instead of display + SLICE_FLAG_ALLOW_FIELD = $0002; ///< allow draw_horiz_band() with field slices (MPEG2 field pics) + SLICE_FLAG_ALLOW_PLANE = $0004; ///< allow draw_horiz_band() with 1 component at a time (SVQ1) + + FF_MB_DECISION_SIMPLE = 0; ///< uses mb_cmp + FF_MB_DECISION_BITS = 1; ///< chooses the one which needs the fewest bits + FF_MB_DECISION_RD = 2; ///< rate distoration + + FF_AA_AUTO = 0; + FF_AA_FASTINT = 1; //not implemented yet + FF_AA_INT = 2; + FF_AA_FLOAT = 3; + + FF_PROFILE_UNKNOWN = -99; + + FF_LEVEL_UNKNOWN = -99; + + X264_PART_I4X4 = $001; (* Analyse i4x4 *) + X264_PART_I8X8 = $002; (* Analyse i8x8 (requires 8x8 transform) *) + X264_PART_P8X8 = $010; (* Analyse p16x8, p8x16 and p8x8 *) + X264_PART_P4X4 = $020; (* Analyse p8x4, p4x8, p4x4 *) + X264_PART_B8X8 = $100; (* Analyse b16x8, b8x16 and b8x8 *) + +type + PAVClass = ^TAVClass; + PAVCodecContext = ^TAVCodecContext; + PAVCodec = ^TAVCodec; + PAVPaletteControl = ^TAVPaletteControl; + + TAVclass = record {12} + class_name: pchar; + (* actually passing a pointer to an AVCodecContext + or AVFormatContext, which begin with an AVClass. + Needed because av_log is in libavcodec and has no visibility + of AVIn/OutputFormat *) + item_name: function (): pchar; cdecl; + option: PAVOption; + end; + + TAVCodecContext = record {720} + (*** Info on struct for av_log + * - set by avcodec_alloc_context *) + av_class: PAVClass; + (*** the average bitrate. + * - encoding: set by user. unused for constant quantizer encoding + * - decoding: set by lavc. 0 or some bitrate if this info is available in the stream *) + bit_rate: integer; + (*** number of bits the bitstream is allowed to diverge from the reference. + * the reference can be CBR (for CBR pass1) or VBR (for pass2) + * - encoding: set by user. unused for constant quantizer encoding + * - decoding: unused *) + bit_rate_tolerance: integer; + (*** CODEC_FLAG_*. + * - encoding: set by user. + * - decoding: set by user. *) + flags: integer; + (*** some codecs needs additionnal format info. It is stored here + * - encoding: set by user. + * - decoding: set by lavc. (FIXME is this ok?) *) + sub_id: integer; + + (** + * motion estimation algorithm used for video coding. + * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex), + * 8 (umh), 9 (iter) [7, 8 are x264 specific, 9 is snow specific] + * - encoding: MUST be set by user. + * - decoding: unused *) + me_method: integer; + + (** + * some codecs need / can use extra-data like huffman tables. + * mjpeg: huffman tables + * rv10: additional flags + * mpeg4: global headers (they can be in the bitstream or here) + * the allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger + * then extradata_size to avoid prolems if its read with the bitstream reader + * the bytewise contents of extradata must not depend on the architecture or cpu endianness + * - encoding: set/allocated/freed by lavc. + * - decoding: set/allocated/freed by user. + *) + extradata: pbyte; + extradata_size: integer; + + (** + * this is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. for fixed-fps content, + * timebase should be 1/framerate and timestamp increments should be + * identically 1. + * - encoding: MUST be set by user + * - decoding: set by lavc. *) + time_base: TAVRational; + + (* video only *) + (*** picture width / height. + * - encoding: MUST be set by user. + * - decoding: set by lavc. + * Note, for compatibility its possible to set this instead of + * coded_width/height before decoding *) + width, height: integer; + (*** the number of pictures in a group of pitures, or 0 for intra_only. + * - encoding: set by user. + * - decoding: unused *) + gop_size: integer; + (*** pixel format, see PIX_FMT_xxx. + * - encoding: set by user. + * - decoding: set by lavc. *) + pix_fmt: TAVPixelFormat; + (*** Frame rate emulation. If not zero lower layer (i.e. format handler) + * has to read frames at native frame rate. + * - encoding: set by user. + * - decoding: unused. *) + rate_emu: integer; + (*** if non NULL, 'draw_horiz_band' is called by the libavcodec + * decoder to draw an horizontal band. It improve cache usage. Not + * all codecs can do that. You must check the codec capabilities + * before + * - encoding: unused + * - decoding: set by user. + * @param height the height of the slice + * @param y the y position of the slice + * @param type 1->top field, 2->bottom field, 3->frame + * @param offset offset into the AVFrame.data from which the slice should be read *) + draw_horiz_band: procedure (s: PAVCodecContext; + const src: PAVFrame; offset: PInteger; + y: integer; _type: integer; height: integer); cdecl; + + (* audio only *) + sample_rate: integer; ///< samples per sec + channels: integer; + (*** audio sample format. + * - encoding: set by user. + * - decoding: set by lavc. *) + sample_fmt: TSampleFormat; ///< sample format, currenly unused + + (* the following data should not be initialized *) + (*** samples per packet. initialized when calling 'init' *) + frame_size: integer; + frame_number: integer; ///< audio or video frame number + real_pict_num: integer; ///< returns the real picture number of previous encoded frame + + (*** number of frames the decoded output will be delayed relative to + * the encoded input. + * - encoding: set by lavc. + * - decoding: unused *) + delay: integer; + + (* - encoding parameters *) + qcompress: single; ///< amount of qscale change between easy & hard scenes (0.0-1.0) + qblur: single; ///< amount of qscale smoothing over time (0.0-1.0) + + (*** minimum quantizer. + * - encoding: set by user. + * - decoding: unused *) + qmin: integer; + + (*** maximum quantizer. + * - encoding: set by user. + * - decoding: unused *) + qmax: integer; + + (*** maximum quantizer difference etween frames. + * - encoding: set by user. + * - decoding: unused *) + max_qdiff: integer; + + (*** maximum number of b frames between non b frames. + * note: the output will be delayed by max_b_frames+1 relative to the input + * - encoding: set by user. + * - decoding: unused *) + max_b_frames: integer; + + (*** qscale factor between ip and b frames. + * - encoding: set by user. + * - decoding: unused *) + b_quant_factor: single; + + (** obsolete FIXME remove *) + rc_strategy: integer; + b_frame_strategy: integer; + + (*** hurry up amount. + * deprecated in favor of skip_idct and skip_frame + * - encoding: unused + * - decoding: set by user. 1-> skip b frames, 2-> skip idct/dequant too, 5-> skip everything except header *) + hurry_up: integer; + + codec: PAVCodec; + + priv_data: pointer; + + (* unused, FIXME remove*) + rtp_mode: integer; + + rtp_payload_size: integer; (* The size of the RTP payload: the coder will *) + (* do it's best to deliver a chunk with size *) + (* below rtp_payload_size, the chunk will start *) + (* with a start code on some codecs like H.263 *) + (* This doesn't take account of any particular *) + (* headers inside the transmited RTP payload *) + + + (* The RTP callback: This function is called *) + (* every time the encoder has a packet to send *) + (* Depends on the encoder if the data starts *) + (* with a Start Code (it should) H.263 does. *) + (* mb_nb contains the number of macroblocks *) + (* encoded in the RTP payload *) + rtp_callback: procedure (avctx: PAVCodecContext; data: pointer; + size: integer; mb_nb: integer); cdecl; + + (* statistics, used for 2-pass encoding *) + mv_bits: integer; + header_bits: integer; + i_tex_bits: integer; + p_tex_bits: integer; + i_count: integer; + p_count: integer; + skip_count: integer; + misc_bits: integer; + + (*** number of bits used for the previously encoded frame. + * - encoding: set by lavc + * - decoding: unused *) + frame_bits: integer; + + (*** private data of the user, can be used to carry app specific stuff. + * - encoding: set by user + * - decoding: set by user *) + opaque: pointer; + + codec_name: array [0..31] of char; + codec_type: TCodecType; (* see CODEC_TYPE_xxx *) + codec_id: TCodecID; (* see CODEC_ID_xxx *) + + (*** fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). + * this is used to workaround some encoder bugs + * - encoding: set by user, if not then the default based on codec_id will be used + * - decoding: set by user, will be converted to upper case by lavc during init *) + codec_tag: cardinal; // ìîæíî array [0..3] of char - òîãäà âèäíî FOURCC +// codec_tag: array [0..3] of char; + + (*** workaround bugs in encoders which sometimes cannot be detected automatically. + * - encoding: set by user + * - decoding: set by user *) + workaround_bugs: integer; + + (*** luma single coeff elimination threshold. + * - encoding: set by user + * - decoding: unused *) + luma_elim_threshold: integer; + + (*** chroma single coeff elimination threshold. + * - encoding: set by user + * - decoding: unused *) + chroma_elim_threshold: integer; + + (*** strictly follow the std (MPEG4, ...). + * - encoding: set by user + * - decoding: unused *) + strict_std_compliance: integer; + + (*** qscale offset between ip and b frames. + * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset) + * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset) + * - encoding: set by user. + * - decoding: unused *) + b_quant_offset: single; + + (*** error resilience higher values will detect more errors but may missdetect + * some more or less valid parts as errors. + * - encoding: unused + * - decoding: set by user *) + error_resilience: integer; + + (*** called at the beginning of each frame to get a buffer for it. + * if pic.reference is set then the frame will be read later by lavc + * avcodec_align_dimensions() should be used to find the required width and + * height, as they normally need to be rounded up to the next multiple of 16 + * - encoding: unused + * - decoding: set by lavc, user can override *) + get_buffer: function (c: PAVCodecContext; pic: PAVFrame): integer; cdecl; + + (*** called to release buffers which where allocated with get_buffer. + * a released buffer can be reused in get_buffer() + * pic.data[*] must be set to NULL + * - encoding: unused + * - decoding: set by lavc, user can override *) + release_buffer: procedure (c: PAVCodecContext; pic: PAVFrame); cdecl; + + (*** if 1 the stream has a 1 frame delay during decoding. + * - encoding: set by lavc + * - decoding: set by lavc *) + has_b_frames: integer; + + (*** number of bytes per packet if constant and known or 0 + * used by some WAV based audio codecs *) + block_align: integer; + + parse_only: integer; (* - decoding only: if true, only parsing is done + (function avcodec_parse_frame()). The frame + data is returned. Only MPEG codecs support this now. *) + + (*** 0-> h263 quant 1-> mpeg quant. + * - encoding: set by user. + * - decoding: unused *) + mpeg_quant: integer; + + (*** pass1 encoding statistics output buffer. + * - encoding: set by lavc + * - decoding: unused *) + stats_out: pchar; + + (*** pass2 encoding statistics input buffer. + * concatenated stuff from stats_out of pass1 should be placed here + * - encoding: allocated/set/freed by user + * - decoding: unused *) + stats_in: pchar; + + (*** ratecontrol qmin qmax limiting method. + * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax + * - encoding: set by user. + * - decoding: unused *) + rc_qsquish: single; + + rc_qmod_amp: single; + rc_qmod_freq: integer; + + (*** ratecontrol override, see RcOverride. + * - encoding: allocated/set/freed by user. + * - decoding: unused *) + rc_override: PRcOverride; + rc_override_count: integer; + + (*** rate control equation. + * - encoding: set by user + * - decoding: unused *) + rc_eq: pchar; + + (*** maximum bitrate. + * - encoding: set by user. + * - decoding: unused *) + rc_max_rate: integer; + + (*** minimum bitrate. + * - encoding: set by user. + * - decoding: unused *) + rc_min_rate: integer; + + (*** decoder bitstream buffer size. + * - encoding: set by user. + * - decoding: unused *) + rc_buffer_size: integer; + rc_buffer_aggressivity: single; + + (*** qscale factor between p and i frames. + * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset) + * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset) + * - encoding: set by user. + * - decoding: unused *) + i_quant_factor: single; + + (*** qscale offset between p and i frames. + * - encoding: set by user. + * - decoding: unused *) + i_quant_offset: single; + + (*** initial complexity for pass1 ratecontrol. + * - encoding: set by user. + * - decoding: unused *) + rc_initial_cplx: single; + + (*** dct algorithm, see FF_DCT_* below. + * - encoding: set by user + * - decoding: unused *) + dct_algo: integer; + + (*** luminance masking (0-> disabled). + * - encoding: set by user + * - decoding: unused *) + lumi_masking: single; + + (*** temporary complexity masking (0-> disabled). + * - encoding: set by user + * - decoding: unused *) + temporal_cplx_masking: single; + + (*** spatial complexity masking (0-> disabled). + * - encoding: set by user + * - decoding: unused *) + spatial_cplx_masking: single; + + (** * p block masking (0-> disabled). + * - encoding: set by user + * - decoding: unused *) + p_masking: single; + + (*** darkness masking (0-> disabled). + * - encoding: set by user + * - decoding: unused *) + dark_masking: single; + + (* for binary compatibility *) + unused: integer; + + (*** idct algorithm, see FF_IDCT_* below. + * - encoding: set by user + * - decoding: set by user *) + idct_algo: integer; + + (*** slice count. + * - encoding: set by lavc + * - decoding: set by user (or 0) *) + slice_count: integer; + + (*** slice offsets in the frame in bytes. + * - encoding: set/allocated by lavc + * - decoding: set/allocated by user (or NULL) *) + slice_offset: Pinteger; + + (*** error concealment flags. + * - encoding: unused + * - decoding: set by user *) + error_concealment: integer; + + (*** dsp_mask could be add used to disable unwanted CPU features + * CPU features (i.e. MMX, SSE. ...) + * + * with FORCE flag you may instead enable given CPU features + * (Dangerous: usable in case of misdetection, improper usage however will + * result into program crash) *) + dsp_mask: cardinal; + + (*** bits per sample/pixel from the demuxer (needed for huffyuv). + * - encoding: set by lavc + * - decoding: set by user *) + bits_per_sample: integer; + + (*** prediction method (needed for huffyuv). + * - encoding: set by user + * - decoding: unused *) + prediction_method: integer; + + (*** sample aspect ratio (0 if unknown). + * numerator and denominator must be relative prime and smaller then 256 for some video standards + * - encoding: set by user. + * - decoding: set by lavc. *) + sample_aspect_ratio: TAVRational; + + (*** the picture in the bitstream. + * - encoding: set by lavc + * - decoding: set by lavc *) + coded_frame: PAVFrame; + + (*** debug. + * - encoding: set by user. + * - decoding: set by user. *) + debug: integer; + + (*** debug. + * - encoding: set by user. + * - decoding: set by user. *) + debug_mv: integer; + + (** error. + * - encoding: set by lavc if flags&CODEC_FLAG_PSNR + * - decoding: unused *) + error: array [0..3] of int64; + + (*** minimum MB quantizer. + * - encoding: unused + * - decoding: unused *) + mb_qmin: integer; + + (*** maximum MB quantizer. + * - encoding: unused + * - decoding: unused *) + mb_qmax: integer; + + (*** motion estimation compare function. + * - encoding: set by user. + * - decoding: unused *) + me_cmp: integer; + + (*** subpixel motion estimation compare function. + * - encoding: set by user. + * - decoding: unused *) + me_sub_cmp: integer; + (*** macroblock compare function (not supported yet). + * - encoding: set by user. + * - decoding: unused *) + mb_cmp: integer; + (*** interlaced dct compare function + * - encoding: set by user. + * - decoding: unused *) + ildct_cmp: integer; + (*** ME diamond size & shape. + * - encoding: set by user. + * - decoding: unused *) + dia_size: integer; + + (*** amount of previous MV predictors (2a+1 x 2a+1 square). + * - encoding: set by user. + * - decoding: unused *) + last_predictor_count: integer; + + (*** pre pass for motion estimation. + * - encoding: set by user. + * - decoding: unused *) + pre_me: integer; + + (*** motion estimation pre pass compare function. + * - encoding: set by user. + * - decoding: unused *) + me_pre_cmp: integer; + + (*** ME pre pass diamond size & shape. + * - encoding: set by user. + * - decoding: unused *) + pre_dia_size: integer; + + (*** subpel ME quality. + * - encoding: set by user. + * - decoding: unused *) + me_subpel_quality: integer; + + (*** callback to negotiate the pixelFormat. + * @param fmt is the list of formats which are supported by the codec, + * its terminated by -1 as 0 is a valid format, the formats are ordered by quality + * the first is allways the native one + * @return the choosen format + * - encoding: unused + * - decoding: set by user, if not set then the native format will always be choosen + *) + get_format: function (s: PAVCodecContext; const fmt: PAVPixelFormat): TAVPixelFormat; cdecl; + + (*** DTG active format information (additionnal aspect ratio + * information only used in DVB MPEG2 transport streams). 0 if + * not set. + * - encoding: unused. + * - decoding: set by decoder *) + dtg_active_format: integer; + + (*** Maximum motion estimation search range in subpel units. + * if 0 then no limit + * - encoding: set by user. + * - decoding: unused. *) + me_range: integer; + + (*** intra quantizer bias. + * - encoding: set by user. + * - decoding: unused *) + intra_quant_bias: integer; + + (*** inter quantizer bias. + * - encoding: set by user. + * - decoding: unused *) + inter_quant_bias: integer; + + (*** color table ID. + * - encoding: unused. + * - decoding: which clrtable should be used for 8bit RGB images + * table have to be stored somewhere FIXME *) + color_table_id: integer; + + (*** internal_buffer count. + * Don't touch, used by lavc default_get_buffer() *) + internal_buffer_count: integer; + + (*** internal_buffers. + * Don't touch, used by lavc default_get_buffer() *) + internal_buffer: pointer; + + (*** global quality for codecs which cannot change it per frame. + * this should be proportional to MPEG1/2/4 qscale. + * - encoding: set by user. + * - decoding: unused *) + global_quality: integer; + + (*** coder type + * - encoding: set by user. + * - decoding: unused *) + coder_type: integer; + + (*** context model + * - encoding: set by user. + * - decoding: unused *) + context_model: integer; + + (*** slice flags + * - encoding: unused + * - decoding: set by user. *) + slice_flags: integer; + + (*** XVideo Motion Acceleration + * - encoding: forbidden + * - decoding: set by decoder *) + xvmc_acceleration: integer; + + (*** macroblock decision mode + * - encoding: set by user. + * - decoding: unused *) + mb_decision: integer; + + (*** custom intra quantization matrix + * - encoding: set by user, can be NULL + * - decoding: set by lavc *) + intra_matrix: Pword; + + (*** custom inter quantization matrix + * - encoding: set by user, can be NULL + * - decoding: set by lavc *) + inter_matrix: Pword; + + (*** fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). + * this is used to workaround some encoder bugs + * - encoding: unused + * - decoding: set by user, will be converted to upper case by lavc during init *) + stream_codec_tag: array [0..3] of char; //cardinal; + + (*** scene change detection threshold. + * 0 is default, larger means fewer detected scene changes + * - encoding: set by user. + * - decoding: unused *) + scenechange_threshold: integer; + + (*** minimum lagrange multipler + * - encoding: set by user. + * - decoding: unused *) + lmin: integer; + + (*** maximum lagrange multipler + * - encoding: set by user. + * - decoding: unused *) + lmax: integer; + + (*** Palette control structure + * - encoding: ??? (no palette-enabled encoder yet) + * - decoding: set by user. *) + palctrl: PAVPaletteControl; + + (*** noise reduction strength + * - encoding: set by user. + * - decoding: unused *) + noise_reduction: integer; + + (*** called at the beginning of a frame to get cr buffer for it. + * buffer type (size, hints) must be the same. lavc won't check it. + * lavc will pass previous buffer in pic, function should return + * same buffer or new buffer with old frame "painted" into it. + * if pic.data[0] == NULL must behave like get_buffer(). + * - encoding: unused + * - decoding: set by lavc, user can override *) + reget_buffer: function (c: PAVCodecContext; pic: PAVFrame): integer; cdecl; + + (*** number of bits which should be loaded into the rc buffer before decoding starts + * - encoding: set by user. + * - decoding: unused *) + rc_initial_buffer_occupancy: integer; + inter_threshold: integer; + + (*** CODEC_FLAG2_*. + * - encoding: set by user. + * - decoding: set by user. *) + flags2: integer; + + (*** simulates errors in the bitstream to test error concealment. + * - encoding: set by user. + * - decoding: unused. *) + error_rate: integer; + + (*** MP3 antialias algorithm, see FF_AA_* below. + * - encoding: unused + * - decoding: set by user *) + antialias_algo: integer; + + (*** Quantizer noise shaping. + * - encoding: set by user + * - decoding: unused *) + quantizer_noise_shaping: integer; + + (*** Thread count. + * is used to decide how many independant tasks should be passed to execute() + * - encoding: set by user + * - decoding: set by user *) + thread_count: integer; + + (*** the codec may call this to execute several independant things. it will return only after + * finishing all tasks, the user may replace this with some multithreaded implementation, the + * default implementation will execute the parts serially + * @param count the number of things to execute + * - encoding: set by lavc, user can override + * - decoding: set by lavc, user can override *) + execute: function (c: PAVCodecContext; func: pointer; arg: PPointer; ret: PInteger; count: integer): integer; cdecl; + + (*** Thread opaque. + * can be used by execute() to store some per AVCodecContext stuff. + * - encoding: set by execute() + * - decoding: set by execute() *) + thread_opaque: pointer; + + (*** Motion estimation threshold. under which no motion estimation is + * performed, but instead the user specified motion vectors are used + * - encoding: set by user + * - decoding: unused *) + me_threshold: integer; + + (*** Macroblock threshold. under which the user specified macroblock types will be used + * - encoding: set by user + * - decoding: unused *) + mb_threshold: integer; + + (*** precision of the intra dc coefficient - 8. + * - encoding: set by user + * - decoding: unused *) + intra_dc_precision: integer; + + (*** noise vs. sse weight for the nsse comparsion function. + * - encoding: set by user + * - decoding: unused *) + nsse_weight: integer; + + (*** number of macroblock rows at the top which are skipped. + * - encoding: unused + * - decoding: set by user *) + skip_top: integer; + + (*** number of macroblock rows at the bottom which are skipped. + * - encoding: unused + * - decoding: set by user *) + skip_bottom: integer; + + (*** profile + * - encoding: set by user + * - decoding: set by lavc *) + profile: integer; + + (*** level + * - encoding: set by user + * - decoding: set by lavc *) + level: integer; + + (*** low resolution decoding. 1-> 1/2 size, 2->1/4 size + * - encoding: unused + * - decoding: set by user *) + lowres: integer; + + (*** bitsream width / height. may be different from width/height if lowres + * or other things are used + * - encoding: unused + * - decoding: set by user before init if known, codec should override / dynamically change if needed *) + coded_width, coded_height: integer; + + (*** frame skip threshold + * - encoding: set by user + * - decoding: unused *) + frame_skip_threshold: integer; + + (*** frame skip factor + * - encoding: set by user + * - decoding: unused *) + frame_skip_factor: integer; + + (*** frame skip exponent + * - encoding: set by user + * - decoding: unused *) + frame_skip_exp: integer; + + (*** frame skip comparission function + * - encoding: set by user. + * - decoding: unused *) + frame_skip_cmp: integer; + + (*** border processing masking. raises the quantizer for mbs on the borders + * of the picture. + * - encoding: set by user + * - decoding: unused *) + border_masking: single; + + (*** minimum MB lagrange multipler. + * - encoding: set by user. + * - decoding: unused *) + mb_lmin: integer; + + (*** maximum MB lagrange multipler. + * - encoding: set by user. + * - decoding: unused *) + mb_lmax: integer; + + (*** + * - encoding: set by user. + * - decoding: unused *) + me_penalty_compensation: integer; + + (*** + * - encoding: unused + * - decoding: set by user. *) + skip_loop_filter: TAVDiscard; + + (** * + * - encoding: unused + * - decoding: set by user. *) + skip_idct: TAVDiscard; + + (** * + * - encoding: unused + * - decoding: set by user. *) + skip_frame: TAVDiscard; + + (** * + * - encoding: set by user. + * - decoding: unused *) + bidir_refine: integer; + + (** * + * - encoding: set by user. + * - decoding: unused *) + brd_scale: integer; + + (** + * constant rate factor - quality-based VBR - values ~correspond to qps + * - encoding: set by user. + * - decoding: unused *) + crf: integer; + + (** + * constant quantization parameter rate control method + * - encoding: set by user. + * - decoding: unused *) + cqp: integer; + + (** + * minimum gop size + * - encoding: set by user. + * - decoding: unused *) + keyint_min: integer; + + (** + * number of reference frames + * - encoding: set by user. + * - decoding: unused *) + refs: integer; + + (** + * chroma qp offset from luma + * - encoding: set by user. + * - decoding: unused *) + chromaoffset: integer; + + (** + * influences how often b-frames are used + * - encoding: set by user. + * - decoding: unused *) + bframebias: integer; + + (** + * trellis RD quantization + * - encoding: set by user. + * - decoding: unused *) + trellis: integer; + + (** + * reduce fluctuations in qp (before curve compression) + * - encoding: set by user. + * - decoding: unused *) + complexityblur: single; + + (** + * in-loop deblocking filter alphac0 parameter + * alpha is in the range -6...6 + * - encoding: set by user. + * - decoding: unused *) + deblockalpha: integer; + + (** + * in-loop deblocking filter beta parameter + * beta is in the range -6...6 + * - encoding: set by user. + * - decoding: unused *) + deblockbeta: integer; + + (** + * macroblock subpartition sizes to consider - p8x8, p4x4, b8x8, i8x8, i4x4 + * - encoding: set by user. + * - decoding: unused *) + partitions: integer; + + (** + * direct mv prediction mode - 0 (none), 1 (spatial), 2 (temporal) + * - encoding: set by user. + * - decoding: unused *) + directpred: integer; + + (** + * audio cutoff bandwidth (0 means "automatic") . Currently used only by FAAC + * - encoding: set by user. + * - decoding: unused *) + cutoff: integer; + + (** + * multiplied by qscale for each frame and added to scene_change_score + * - encoding: set by user. + * - decoding: unused *) + scenechange_factor: integer; + + (** * + * note: value depends upon the compare functin used for fullpel ME + * - encoding: set by user. + * - decoding: unused *) + mv0_threshold: integer; + + (** + * adjusts sensitivity of b_frame_strategy 1 + * - encoding: set by user. + * - decoding: unused *) + b_sensitivity: integer; + + (** + * - encoding: set by user. + * - decoding: unused *) + compression_level: integer; + + (** + * sets whether to use LPC mode - used by FLAC encoder + * - encoding: set by user. + * - decoding: unused. *) + use_lpc: integer; + + (** + * LPC coefficient precision - used by FLAC encoder + * - encoding: set by user. + * - decoding: unused. *) + lpc_coeff_precision: integer; + + (** + * - encoding: set by user. + * - decoding: unused. *) + min_prediction_order: integer; + + (** + * - encoding: set by user. + * - decoding: unused. *) + max_prediction_order: integer; + + (** + * search method for selecting prediction order + * - encoding: set by user. + * - decoding: unused. *) + prediction_order_method: integer; + + (** + * - encoding: set by user. + * - decoding: unused. *) + min_partition_order: integer; + + (** + * - encoding: set by user. + * - decoding: unused. *) + max_partition_order: integer; + end; + +(** + * AVCodec. + *) + TAVCodec = record + name: pchar; + _type: TCodecType; + id: TCodecID; + priv_data_size: integer; + init: function (avctx: PAVCodecContext): integer; cdecl; (* typo corretion by the Creative CAT *) + encode: function (avctx: PAVCodecContext; buf: pchar; buf_size: integer; data: pointer): integer; cdecl; + close: function (avctx: PAVCodecContext): integer; cdecl; + decode: function (avctx: PAVCodecContext; outdata: pointer; outdata_size: PInteger; + buf: pchar; buf_size: integer): integer; cdecl; + capabilities: integer; +// todo: check this -> +// void *dummy; // FIXME remove next time we break binary compatibility + next: PAVCodec; + flush: procedure (avctx: PAVCodecContext); cdecl; + supported_framerates: PAVRational; ///array of supported framerates, or NULL if any, array is terminated by {0,0} + pix_fmts: PAVPixelFormat; ///array of supported pixel formats, or NULL if unknown, array is terminanted by -1 + end; + +(** + * four components are given, that's all. + * the last component is alpha + *) + PAVPicture = ^TAVPicture; + TAVPicture = record + data: array [0..3] of pchar; + linesize: array [0..3] of integer; ///< number of bytes per line + end; + +(** + * AVPaletteControl + * This structure defines a method for communicating palette changes + * between and demuxer and a decoder. + * this is totally broken, palette changes should be sent as AVPackets + *) + TAVPaletteControl = record + (* demuxer sets this to 1 to indicate the palette has changed; + * decoder resets to 0 *) + palette_changed: integer; + + (* 4-byte ARGB palette entries, stored in native byte order; note that + * the individual palette components should be on a 8-bit scale; if + * the palette data comes from a IBM VGA native format, the component + * data is probably 6 bits in size and needs to be scaled *) + palette: array [0..AVPALETTE_COUNT - 1] of cardinal; + end; + + PAVSubtitleRect = ^TAVSubtitleRect; + TAVSubtitleRect = record + x: word; + y: word; + w: word; + h: word; + nb_colors: word; + linesize: integer; + rgba_palette: PCardinal; + bitmap: pchar; + end; + + PAVSubtitle = ^TAVSubtitle; + TAVSubtitle = record {20} + format: word; (* 0 = graphics *) + start_display_time: cardinal; (* relative to packet pts, in ms *) + end_display_time: cardinal; (* relative to packet pts, in ms *) + num_rects: cardinal; + rects: PAVSubtitleRect; + end; + + +(* resample.c *) + + PReSampleContext = pointer; + PAVResampleContext = pointer; + PImgReSampleContext = pointer; + +function audio_resample_init (output_channels: integer; input_channels: integer; + output_rate: integer; input_rate: integer): PReSampleContext; + cdecl; external av__codec; + +function audio_resample (s: PReSampleContext; output: PWord; input: PWord; nb_samples: integer): integer; + cdecl; external av__codec; + +procedure audio_resample_close (s: PReSampleContext); + cdecl; external av__codec; + + +function av_resample_init (out_rate: integer; in_rate: integer; filter_length: integer; + log2_phase_count: integer; linear: integer; cutoff: double): PAVResampleContext; + cdecl; external av__codec; + +function av_resample (c: PAVResampleContext; dst: PWord; src: PWord; consumed: PInteger; + src_size: integer; dst_size: integer; update_ctx: integer): integer; + cdecl; external av__codec; + +procedure av_resample_compensate (c: PAVResampleContext; sample_delta: integer; + compensation_distance: integer); + cdecl; external av__codec; + +procedure av_resample_close (c: PAVResampleContext); + cdecl; external av__codec; + + +(* YUV420 format is assumed ! *) + + function img_resample_init (output_width: integer; output_height: integer; + input_width: integer; input_height: integer): PImgReSampleContext; + cdecl; external av__codec; + + function img_resample_full_init (owidth: integer; oheight: integer; + iwidth: integer; iheight: integer; + topBand: integer; bottomBand: integer; + leftBand: integer; rightBand: integer; + padtop: integer; padbottom: integer; + padleft: integer; padright: integer): PImgReSampleContext; + cdecl; external av__codec; + + procedure img_resample (s: PImgReSampleContext; output: PAVPicture; const input: PAVPicture); + cdecl; external av__codec; + + procedure img_resample_close (s: PImgReSampleContext); + cdecl; external av__codec; + +(** + * Allocate memory for a picture. Call avpicture_free to free it. + * + * @param picture the picture to be filled in. + * @param pix_fmt the format of the picture. + * @param width the width of the picture. + * @param height the height of the picture. + * @return 0 if successful, -1 if not. + *) + function avpicture_alloc (picture: PAVPicture; pix_fmt: TAVPixelFormat; + width: integer; height: integer): integer; + cdecl; external av__codec; + + +(* Free a picture previously allocated by avpicture_alloc. *) + procedure avpicture_free (picture: PAVPicture); + cdecl; external av__codec; + + function avpicture_fill (picture: PAVPicture; ptr: pointer; + pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; + cdecl; external av__codec; + + function avpicture_layout (const src: PAVPicture; pix_fmt: TAVPixelFormat; + width: integer; height: integer; + dest: pchar; dest_size: integer): integer; + cdecl; external av__codec; + + function avpicture_get_size (pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; + cdecl; external av__codec; + + procedure avcodec_get_chroma_sub_sample (pix_fmt: TAVPixelFormat; h_shift: Pinteger; v_shift: pinteger); + cdecl; external av__codec; + + function avcodec_get_pix_fmt_name(pix_fmt: TAVPixelFormat): pchar; + cdecl; external av__codec; + + procedure avcodec_set_dimensions(s: PAVCodecContext; width: integer; height: integer); + cdecl; external av__codec; + + function avcodec_get_pix_fmt(const name: pchar): TAVPixelFormat; + cdecl; external av__codec; + + function avcodec_pix_fmt_to_codec_tag(p: TAVPixelFormat): cardinal; + cdecl; external av__codec; + + function avcodec_get_pix_fmt_loss (dst_pix_fmt: TAVPixelFormat; src_pix_fmt: TAVPixelFormat; + has_alpha: integer): integer; + cdecl; external av__codec; + + function avcodec_find_best_pix_fmt (pix_fmt_mask: integer; src_pix_fmt: TAVPixelFormat; + has_alpha: integer; loss_ptr: pinteger): integer; + cdecl; external av__codec; + + function img_get_alpha_info (const src: PAVPicture; + pix_fmt: TAVPixelFormat; + width: integer; height: integer): integer; + cdecl; external av__codec; + + +(* convert among pixel formats *) + function img_convert (dst: PAVPicture; dst_pix_fmt: TAVPixelFormat; + const src: PAVPicture; pix_fmt: TAVPixelFormat; + width: integer; height: integer): integer; + cdecl; external av__codec; + +(* deinterlace a picture *) + function avpicture_deinterlace (dst: PAVPicture; const src: PAVPicture; + pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; + cdecl; external av__codec; + +(* returns LIBAVCODEC_VERSION_INT constant *) + function avcodec_version (): cardinal; + cdecl; external av__codec; + +(* returns LIBAVCODEC_BUILD constant *) + function avcodec_build (): cardinal; + cdecl; external av__codec; + + procedure avcodec_init (); + cdecl; external av__codec; + + procedure register_avcodec (format: PAVCodec); + cdecl; external av__codec; + + function avcodec_find_encoder (id: TCodecID): PAVCodec; + cdecl; external av__codec; + function avcodec_find_encoder_by_name (name: pchar): PAVCodec; + cdecl; external av__codec; + function avcodec_find_decoder(id: TCodecID): PAVCodec; + cdecl; external av__codec; + function avcodec_find_decoder_by_name (name: pchar): PAVCodec; + cdecl; external av__codec; + procedure avcodec_string(buf: pchar; buf_size: integer; enc: PAVCodecContext; encode: integer); + cdecl; external av__codec; + + procedure avcodec_get_context_defaults (s: PAVCodecContext); + cdecl; external av__codec; + function avcodec_alloc_context : PAVCodecContext; + cdecl; external av__codec; +(* favourite of The Creative CAT + function avcodec_alloc_context (): PAVCodecContext; + cdecl; external av__codec; *) + procedure avcodec_get_frame_defaults (pic: PAVFrame); + cdecl; external av__codec; + function avcodec_alloc_frame : PAVFrame; + cdecl; external av__codec; +(* favourite of The Creative CAT + function avcodec_alloc_frame (): PAVFrame; + cdecl; external av__codec; *) + + function avcodec_default_get_buffer (s: PAVCodecContext; pic: PAVFrame): integer; + cdecl; external av__codec; + procedure avcodec_default_release_buffer (s: PAVCodecContext; pic: PAVFrame); + cdecl; external av__codec; + function avcodec_default_reget_buffer (s: PAVCodecContext; pic: PAVFrame): integer; + cdecl; external av__codec; + procedure avcodec_align_dimensions(s: PAVCodecContext; width: Pinteger; height: PInteger); + cdecl; external av__codec; + function avcodec_check_dimensions (av_log_ctx: pointer; w: cardinal; h: cardinal): integer; + cdecl; external av__codec; + function avcodec_default_get_format(s: PAVCodecContext; const fmt: PAVPixelFormat): TAVPixelFormat; + cdecl; external av__codec; + + function avcodec_thread_init (s: PAVCodecContext; thread_count: integer): integer; + cdecl; external av__codec; + procedure avcodec_thread_free (s: PAVCodecContext); + cdecl; external av__codec; + function avcodec_thread_execute (s: PAVCodecContext; func: pointer; arg: PPointer; ret: Pinteger; count: integer): integer; + cdecl; external av__codec; + function avcodec_default_execute (s: PAVCodecContext; func: pointer; arg: PPointer; ret: Pinteger; count: integer): integer; + cdecl; external av__codec; + + +//FIXME func typedef + +(** + * opens / inits the AVCodecContext. + * not thread save! + *) + function avcodec_open (avctx: PAVCodecContext; codec: PAVCodec): integer; + cdecl; external av__codec; + + +(** + * Decode an audio frame. + * + * @param avctx the codec context. + * @param samples output buffer, 16 byte aligned + * @param frame_size_ptr the output buffer size in bytes, zero if no frame could be compressed + * @param buf input buffer, 16 byte aligned + * @param buf_size the input buffer size + * @return 0 if successful, -1 if not. + *) + +(** This comment was added by the Creative CAT. frame_size_ptr was changed to + variable refference. + + * @deprecated Use avcodec_decode_audio2() instead. + *) + + function avcodec_decode_audio (avctx: PAVCodecContext; samples: Pword; + var frame_size_ptr: integer; + buf: pchar; buf_size: integer): integer; + cdecl; external av__codec; +(* decode a frame. + * @param buf bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE larger then the actual read bytes + * because some optimized bitstream readers read 32 or 64 bit at once and could read over the end + * @param buf_size the size of the buffer in bytes + * @param got_picture_ptr zero if no frame could be decompressed, Otherwise, it is non zero + * @return -1 if error, otherwise return the number of + * bytes used. *) + + function avcodec_decode_audio2(avctx : PAVCodecContext; samples : PWord; + var frame_size_ptr : integer; + buf: pchar; buf_size: integer): integer; + cdecl; external av__codec; +(* Added by The Creative CAT +/** + * Decodes a video frame from \p buf into \p picture. + * The avcodec_decode_video() function decodes a video frame from the input + * buffer \p buf of size \p buf_size. To decode it, it makes use of the + * video codec which was coupled with \p avctx using avcodec_open(). The + * resulting decoded frame is stored in \p picture. + * + * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than + * the actual read bytes because some optimized bitstream readers read 32 or 64 + * bits at once and could read over the end. + * + * @warning The end of the input buffer \p buf should be set to 0 to ensure that + * no overreading happens for damaged MPEG streams. + * + * @note You might have to align the input buffer \p buf and output buffer \p + * samples. The alignment requirements depend on the CPU: on some CPUs it isn't + * necessary at all, on others it won't work at all if not aligned and on others + * it will work but it will have an impact on performance. In practice, the + * bitstream should have 4 byte alignment at minimum and all sample data should + * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If + * the linesize is not a multiple of 16 then there's no sense in aligning the + * start of the buffer to 16. + * + * @param avctx the codec context + * @param[out] picture The AVFrame in which the decoded video frame will be stored. + * @param[in] buf the input buffer + * @param[in] buf_size the size of the input buffer in bytes + * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. + * @return On error a negative value is returned, otherwise the number of bytes + * used or zero if no frame could be decompressed. + */ +*) + + function avcodec_decode_video (avctx: PAVCodecContext; picture: PAVFrame; + var got_picture_ptr: integer; (* favour of The Creative CAT *) + buf: PByte; buf_size: integer): integer; + cdecl; external av__codec; + + function avcodec_decode_subtitle (avctx: PAVCodecContext; sub: PAVSubtitle; + got_sub_ptr: pinteger; + const buf: pchar; buf_size: integer): integer; + cdecl; external av__codec; + function avcodec_parse_frame (avctx: PAVCodecContext; pdata: PPointer; + data_size_ptr: pinteger; + buf: pchar; buf_size: integer): integer; + cdecl; external av__codec; + + function avcodec_encode_audio (avctx: PAVCodecContext; buf: PByte; + buf_size: integer; const samples: PWord): integer; + cdecl; external av__codec; + + (* avcodec_encode_video: -1 if error *) + (* type of the second argument is changed by The Creative CAT *) + function avcodec_encode_video (avctx: PAVCodecContext; buf: PByte; + buf_size: integer; pict: PAVFrame): integer; + cdecl; external av__codec; + function avcodec_encode_subtitle (avctx: PAVCodecContext; buf: pchar; + buf_size: integer; const sub: PAVSubtitle): integer; + cdecl; external av__codec; + function avcodec_close (avctx: PAVCodecContext): integer; + cdecl; external av__codec; + + procedure avcodec_register_all (); + cdecl; external av__codec; + + procedure avcodec_flush_buffers (avctx: PAVCodecContext); + cdecl; external av__codec; + procedure avcodec_default_free_buffers (s: PAVCodecContext); + cdecl; external av__codec; + +(* misc usefull functions *) + +(** + * returns a single letter to describe the picture type + *) + function av_get_pict_type_char (pict_type: integer): char; + cdecl; external av__codec; + + +(** + * returns codec bits per sample + *) +function av_get_bits_per_sample (codec_id: TCodecID): integer; + cdecl; external av__codec; + +const + AV_PARSER_PTS_NB = 4; + PARSER_FLAG_COMPLETE_FRAMES = $0001; + +type + PAVCodecParserContext = ^TAVCodecParserContext; + PAVCodecParser = ^TAVCodecParser; + + TAVCodecParserContext = record + priv_data: pointer; + parser: PAVCodecParser; + frame_offset: int64; (* offset of the current frame *) + cur_offset: int64; (* current offset (incremented by each av_parser_parse()) *) + last_frame_offset: int64; (* offset of the last frame *) + (* video info *) + pict_type: integer; (* XXX: put it back in AVCodecContext *) + repeat_pict: integer; (* XXX: put it back in AVCodecContext *) + pts: int64; (* pts of the current frame *) + dts: int64; (* dts of the current frame *) + + (* private data *) + last_pts: int64; + last_dts: int64; + fetch_timestamp: integer; + + cur_frame_start_index: integer; + cur_frame_offset: array [0..AV_PARSER_PTS_NB - 1] of int64; + cur_frame_pts: array [0..AV_PARSER_PTS_NB - 1] of int64; + cur_frame_dts: array [0..AV_PARSER_PTS_NB - 1] of int64; + + flags: integer; + end; + + TAVCodecParser = record + codec_ids: array [0..4] of integer; (* several codec IDs are permitted *) + priv_data_size: integer; + parser_init: function (s: PAVCodecParserContext): integer; cdecl; + parser_parse: function (s: PAVCodecParserContext; avctx: PAVCodecContext; + poutbuf: PPointer; poutbuf_size: PInteger; + const buf: pchar; buf_size: integer): integer; cdecl; + parser_close: procedure (s: PAVCodecParserContext); cdecl; + split: function (avctx: PAVCodecContext; const buf: pchar; + buf_size: integer): integer; cdecl; + next: PAVCodecParser; + end; + + procedure av_register_codec_parser (parser: PAVCodecParser); cdecl; + cdecl; external av__codec; + + function av_parser_init (codec_id: integer): PAVCodecParserContext; + cdecl; external av__codec; + + function av_parser_parse (s: PAVCodecParserContext; + avctx: PAVCodecContext; + poutbuf: PPointer; poutbuf_size: pinteger; + const buf: pchar; buf_size: integer; + pts: int64; dts: int64): integer; + cdecl; external av__codec; + function av_parser_change (s: PAVCodecParserContext; + avctx: PAVCodecContext; + poutbuf: PPointer; poutbuf_size: PInteger; + const buf: pchar; buf_size: integer; keyframe: integer): integer; + cdecl; external av__codec; + procedure av_parser_close (s: PAVCodecParserContext); + cdecl; external av__codec; + +type + PAVBitStreamFilterContext = ^TAVBitStreamFilterContext; + PAVBitStreamFilter = ^TAVBitStreamFilter; + + TAVBitStreamFilterContext = record + priv_data: pointer; + filter: PAVBitStreamFilter; + parser: PAVCodecParserContext; + next: PAVBitStreamFilterContext; + end; + + TAVBitStreamFilter = record + name: pchar; + priv_data_size: integer; + filter: function (bsfc: PAVBitStreamFilterContext; + avctx: PAVCodecContext; args: pchar; + poutbuf: PPointer; poutbuf_size: PInteger; + buf: PByte; buf_size: integer; keyframe: integer): integer; cdecl; + next: PAVBitStreamFilter; + end; + +procedure av_register_bitstream_filter (bsf: PAVBitStreamFilter); + cdecl; external av__codec; + +function av_bitstream_filter_init (name: pchar): PAVBitStreamFilterContext; + cdecl; external av__codec; + +function av_bitstream_filter_filter (bsfc: PAVBitStreamFilterContext; + avctx: PAVCodecContext; args: pchar; + poutbuf: PPointer; poutbuf_size: PInteger; + buf: PByte; buf_size: integer; keyframe: integer): integer; + cdecl; external av__codec; +procedure av_bitstream_filter_close (bsf: PAVBitStreamFilterContext); + cdecl; external av__codec; + + +(* memory *) + procedure av_fast_realloc (ptr: pointer; size: PCardinal; min_size: Cardinal); + cdecl; external av__codec; +(* for static data only *) +(* call av_free_static to release all staticaly allocated tables *) + procedure av_free_static (); + cdecl; external av__codec; + + procedure av_mallocz_static(size: cardinal); + cdecl; external av__codec; + + procedure av_realloc_static(ptr: pointer; size: Cardinal); + cdecl; external av__codec; + + procedure img_copy (dst: PAVPicture; const src: PAVPicture; + pix_fmt: TAVPixelFormat; width: integer; height: integer); + cdecl; external av__codec; + + function img_crop (dst: PAVPicture; const src: PAVPicture; + pix_fmt: TAVPixelFormat; top_band, left_band: integer): integer; + cdecl; external av__codec; + + function img_pad (dst: PAVPicture; const src: PAVPicture; height, width: integer; + pix_fmt: TAVPixelFormat; padtop, padbottom, padleft, padright: integer; + color: PInteger): integer; + cdecl; external av__codec; + +implementation + +end. diff --git a/Game/Code/lib/ffmpeg/avformat.pas b/Game/Code/lib/ffmpeg/avformat.pas index 26ff0d9b..aa74043b 100644 --- a/Game/Code/lib/ffmpeg/avformat.pas +++ b/Game/Code/lib/ffmpeg/avformat.pas @@ -23,8 +23,11 @@ in the source codes *) unit avformat; {$IFDEF FPC} - {$LINKLIB libavutil} + {$IFNDEF win32} + {$LINKLIB libavutil} {$LINKLIB libavformat} + {$ENDIF} + {$MODE DELPHI } (* CAT *) {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) diff --git a/Game/Code/lib/ffmpeg/avutil.pas b/Game/Code/lib/ffmpeg/avutil.pas index 8d4fe2f7..0a2078dc 100644 --- a/Game/Code/lib/ffmpeg/avutil.pas +++ b/Game/Code/lib/ffmpeg/avutil.pas @@ -1,146 +1,146 @@ - (* - * copyright (c) 2006 Michael Niedermayer - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) -(* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. -For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT -in the source codes *) - -unit avutil; -{$IFDEF FPC} - {$MODE DELPHI} - {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) - {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) -{$ENDIF} - -interface - -const -{$IFDEF win32} + (* + * copyright (c) 2006 Michael Niedermayer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) +(* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. +For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT +in the source codes *) + +unit avutil; +{$IFDEF FPC} + {$MODE DELPHI} + {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) + {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) +{$ENDIF} + +interface + +const +{$IFDEF win32} av__util = 'avutil-49.dll'; {$ELSE} av__util = 'libavutil.so'; // .0d // av__util = 'libavutil.49'; -{$ENDIF} - - - LIBAVUTIL_VERSION_INT = ((49 shl 16) + (4 shl 8) + 1); - LIBAVUTIL_VERSION = '49.4.1'; - LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; - -type -(** - * Pixel format. Notes: - * - * PIX_FMT_RGB32 is handled in an endian-specific manner. A RGBA - * color is put together as: - * (A << 24) | (R << 16) | (G << 8) | B - * This is stored as BGRA on little endian CPU architectures and ARGB on - * big endian CPUs. - * - * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized - * image data is stored in AVFrame.data[0]. The palette is transported in - * AVFrame.data[1] and, is 1024 bytes long (256 4-byte entries) and is - * formatted the same as in PIX_FMT_RGB32 described above (i.e., it is - * also endian-specific). Note also that the individual RGB palette - * components stored in AVFrame.data[1] should be in the range 0..255. - * This is important as many custom PAL8 video codecs that were designed - * to run on the IBM VGA graphics adapter use 6-bit palette components. - *) - - PAVPixelFormat = ^TAVPixelFormat; - TAVPixelFormat = ( - PIX_FMT_NONE= -1, - PIX_FMT_YUV420P, ///< Planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) - PIX_FMT_YUYV422, ///< Packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr - PIX_FMT_RGB24, ///< Packed RGB 8:8:8, 24bpp, RGBRGB... - PIX_FMT_BGR24, ///< Packed RGB 8:8:8, 24bpp, BGRBGR... - PIX_FMT_YUV422P, ///< Planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) - PIX_FMT_YUV444P, ///< Planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) - PIX_FMT_RGB32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in cpu endianness - PIX_FMT_YUV410P, ///< Planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) - PIX_FMT_YUV411P, ///< Planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) - PIX_FMT_RGB565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in cpu endianness - PIX_FMT_RGB555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in cpu endianness most significant bit to 1 - PIX_FMT_GRAY8, ///< Y , 8bpp - PIX_FMT_MONOWHITE, ///< Y , 1bpp, 1 is white - PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black - PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette - PIX_FMT_YUVJ420P, ///< Planar YUV 4:2:0, 12bpp, full scale (jpeg) - PIX_FMT_YUVJ422P, ///< Planar YUV 4:2:2, 16bpp, full scale (jpeg) - PIX_FMT_YUVJ444P, ///< Planar YUV 4:4:4, 24bpp, full scale (jpeg) - PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h) - PIX_FMT_XVMC_MPEG2_IDCT, - PIX_FMT_UYVY422, ///< Packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 - PIX_FMT_UYYVYY411, ///< Packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 - PIX_FMT_BGR32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in cpu endianness - PIX_FMT_BGR565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in cpu endianness - PIX_FMT_BGR555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in cpu endianness most significant bit to 1 - PIX_FMT_BGR8, ///< Packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) - PIX_FMT_BGR4, ///< Packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb) - PIX_FMT_BGR4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) - PIX_FMT_RGB8, ///< Packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) - PIX_FMT_RGB4, ///< Packed RGB 1:2:1, 4bpp, (msb)2R 3G 3B(lsb) - PIX_FMT_RGB4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)2R 3G 3B(lsb) - PIX_FMT_NV12, ///< Planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV - PIX_FMT_NV21, ///< as above, but U and V bytes are swapped - - PIX_FMT_RGB32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in cpu endianness - PIX_FMT_BGR32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in cpu endianness - - PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions - PIX_FMT_FACKED = $FFFFF - ); - -const -{$ifdef WORDS_BIGENDIAN} - PIX_FMT_RGBA = PIX_FMT_RGB32_1; - PIX_FMT_BGRA = PIX_FMT_BGR32_1; - PIX_FMT_ARGB = PIX_FMT_RGB32; - PIX_FMT_ABGR = PIX_FMT_BGR32; -{$else} - PIX_FMT_RGBA = PIX_FMT_BGR32; - PIX_FMT_BGRA = PIX_FMT_RGB32; - PIX_FMT_ARGB = PIX_FMT_BGR32_1; - PIX_FMT_ABGR = PIX_FMT_RGB32_1; -{$endif} - - PIX_FMT_UYVY411 = PIX_FMT_UYYVYY411; - PIX_FMT_RGBA32 = PIX_FMT_RGB32; - PIX_FMT_YUV422 = PIX_FMT_YUYV422; - -(* memory *) -function av_malloc (size: cardinal): pointer; - cdecl; external av__util; - -function av_realloc (ptr: pointer; size: cardinal): pointer; - cdecl; external av__util; - -procedure av_free (ptr: pointer); - cdecl; external av__util; - -function av_mallocz (size: cardinal): pointer; - cdecl; external av__util; - -function av_strdup(const s: pchar): pchar; - cdecl; external av__util; - -procedure av_freep (ptr: pointer); - cdecl; external av__util; - -implementation - -end. +{$ENDIF} + + + LIBAVUTIL_VERSION_INT = ((49 shl 16) + (4 shl 8) + 1); + LIBAVUTIL_VERSION = '49.4.1'; + LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; + +type +(** + * Pixel format. Notes: + * + * PIX_FMT_RGB32 is handled in an endian-specific manner. A RGBA + * color is put together as: + * (A << 24) | (R << 16) | (G << 8) | B + * This is stored as BGRA on little endian CPU architectures and ARGB on + * big endian CPUs. + * + * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized + * image data is stored in AVFrame.data[0]. The palette is transported in + * AVFrame.data[1] and, is 1024 bytes long (256 4-byte entries) and is + * formatted the same as in PIX_FMT_RGB32 described above (i.e., it is + * also endian-specific). Note also that the individual RGB palette + * components stored in AVFrame.data[1] should be in the range 0..255. + * This is important as many custom PAL8 video codecs that were designed + * to run on the IBM VGA graphics adapter use 6-bit palette components. + *) + + PAVPixelFormat = ^TAVPixelFormat; + TAVPixelFormat = ( + PIX_FMT_NONE= -1, + PIX_FMT_YUV420P, ///< Planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) + PIX_FMT_YUYV422, ///< Packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr + PIX_FMT_RGB24, ///< Packed RGB 8:8:8, 24bpp, RGBRGB... + PIX_FMT_BGR24, ///< Packed RGB 8:8:8, 24bpp, BGRBGR... + PIX_FMT_YUV422P, ///< Planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + PIX_FMT_YUV444P, ///< Planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) + PIX_FMT_RGB32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in cpu endianness + PIX_FMT_YUV410P, ///< Planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) + PIX_FMT_YUV411P, ///< Planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) + PIX_FMT_RGB565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in cpu endianness + PIX_FMT_RGB555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in cpu endianness most significant bit to 1 + PIX_FMT_GRAY8, ///< Y , 8bpp + PIX_FMT_MONOWHITE, ///< Y , 1bpp, 1 is white + PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black + PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette + PIX_FMT_YUVJ420P, ///< Planar YUV 4:2:0, 12bpp, full scale (jpeg) + PIX_FMT_YUVJ422P, ///< Planar YUV 4:2:2, 16bpp, full scale (jpeg) + PIX_FMT_YUVJ444P, ///< Planar YUV 4:4:4, 24bpp, full scale (jpeg) + PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h) + PIX_FMT_XVMC_MPEG2_IDCT, + PIX_FMT_UYVY422, ///< Packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 + PIX_FMT_UYYVYY411, ///< Packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 + PIX_FMT_BGR32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in cpu endianness + PIX_FMT_BGR565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in cpu endianness + PIX_FMT_BGR555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in cpu endianness most significant bit to 1 + PIX_FMT_BGR8, ///< Packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) + PIX_FMT_BGR4, ///< Packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb) + PIX_FMT_BGR4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) + PIX_FMT_RGB8, ///< Packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) + PIX_FMT_RGB4, ///< Packed RGB 1:2:1, 4bpp, (msb)2R 3G 3B(lsb) + PIX_FMT_RGB4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)2R 3G 3B(lsb) + PIX_FMT_NV12, ///< Planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV + PIX_FMT_NV21, ///< as above, but U and V bytes are swapped + + PIX_FMT_RGB32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in cpu endianness + PIX_FMT_BGR32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in cpu endianness + + PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions + PIX_FMT_FACKED = $FFFFF + ); + +const +{$ifdef WORDS_BIGENDIAN} + PIX_FMT_RGBA = PIX_FMT_RGB32_1; + PIX_FMT_BGRA = PIX_FMT_BGR32_1; + PIX_FMT_ARGB = PIX_FMT_RGB32; + PIX_FMT_ABGR = PIX_FMT_BGR32; +{$else} + PIX_FMT_RGBA = PIX_FMT_BGR32; + PIX_FMT_BGRA = PIX_FMT_RGB32; + PIX_FMT_ARGB = PIX_FMT_BGR32_1; + PIX_FMT_ABGR = PIX_FMT_RGB32_1; +{$endif} + + PIX_FMT_UYVY411 = PIX_FMT_UYYVYY411; + PIX_FMT_RGBA32 = PIX_FMT_RGB32; + PIX_FMT_YUV422 = PIX_FMT_YUYV422; + +(* memory *) +function av_malloc (size: cardinal): pointer; + cdecl; external av__util; + +function av_realloc (ptr: pointer; size: cardinal): pointer; + cdecl; external av__util; + +procedure av_free (ptr: pointer); + cdecl; external av__util; + +function av_mallocz (size: cardinal): pointer; + cdecl; external av__util; + +function av_strdup(const s: pchar): pchar; + cdecl; external av__util; + +procedure av_freep (ptr: pointer); + cdecl; external av__util; + +implementation + +end. -- cgit v1.2.3 From 4231c33ad7c7765fd3851c5c7168f8c7d367deef Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 16 Oct 2007 23:19:11 +0000 Subject: nearly finished Cores loading procs Add PluginLoader Unit to implent new PluginLoader Reordered Delphi .dpr uses clausel git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@519 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCore.pas | 216 +++++++++++++++++++++++++++++++++--- Game/Code/Classes/UCoreModule.pas | 21 ++-- Game/Code/Classes/uPluginLoader.pas | 7 ++ Game/Code/UltraStar.dpr | 72 ++++++++---- 4 files changed, 272 insertions(+), 44 deletions(-) create mode 100644 Game/Code/Classes/uPluginLoader.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UCore.pas b/Game/Code/Classes/UCore.pas index 990ee7ab..de44fb3b 100644 --- a/Game/Code/Classes/UCore.pas +++ b/Game/Code/Classes/UCore.pas @@ -26,13 +26,18 @@ type //Some Hook Handles. See Plugin SDKs Hooks.txt for Infos hLoadingFinished: THandle; hMainLoop: THandle; + hTranslate: THandle; hLoadTextures: THandle; hExitQuery: THandle; hExit: THandle; hDebug: THandle; hError: THandle; - sReportError: THandle; - sReportDebug: THandle; + sReportError: THandle; + sReportDebug: THandle; + sShowMessage: THandle; + sRetranslate: THandle; + sReloadTextures: THandle; + sGetModuleInfo: THandle; Modules: Array [0..High(CORE_MODULES_TO_LOAD)] of TModuleListItem; @@ -69,6 +74,10 @@ type Name: String; //Name of this Application Version: LongWord; //Version of this ". For Info Look PluginDefs Functions + LastErrorReporter:String; //Who Reported the Last Error String + LastErrorString: String; //Last Error String reported + + //--------------- //Main Methods to control the Core: //--------------- @@ -81,17 +90,21 @@ type // Hook and Service Procs: //-------------- Function ShowMessage(wParam, lParam: DWord): integer; //Shows a Message (lParam: PChar Text, wParam: Symbol) - {Function ShowMessage(wParam, lParam: DWord): integer; //Shows a Message (lParam: PChar Text, wParam: Symbol) - Function ShowMessage(wParam, lParam: DWord): integer; //Shows a Message (lParam: PChar Text, wParam: Symbol)} + Function ReportError(wParam, lParam: DWord): integer; //Shows a Message (wParam: Pchar(Message), lParam: PChar(Reportername)) + Function ReportDebug(wParam, lParam: DWord): integer; //Shows a Message (wParam: Pchar(Message), lParam: PChar(Reportername)) + Function Retranslate(wParam, lParam: DWord): integer; //Calls Translate hook + Function ReloadTextures(wParam, lParam: DWord): integer; //Calls LoadTextures hook + Function GetModuleInfo(wParam, lParam: DWord): integer; //If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TModuleInfo to address at lparam end; var Core: TCore; implementation +uses SysUtils, {$IFDEF win32} -uses Windows; -{$ENDIF} +Windows +{$ENDIF}; //------------- // Create - Creates Class + Hook and Service Manager @@ -102,6 +115,9 @@ begin Version := cVersion; CurExecuted := 0; + LastErrorReporter := ''; + LastErrorString := ''; + Hooks := THookManager.Create(50); Services := TServiceManager.Create; end; @@ -128,9 +144,88 @@ begin Except noError := False; end; + + if (noError) then + begin //Init + Try + noError := Init; + Except + noError := False; + end; + + If noError then + begin + //Call Translate Hook + noError := (Hooks.CallEventChain(hTranslate, 0, 0) = 0); + + If noError then + begin //Calls LoadTextures Hook + noError := (Hooks.CallEventChain(hLoadTextures, 0, 0) = 0); + + if noError then + begin //Calls Loading Finished Hook + noError := (Hooks.CallEventChain(hLoadingFinished, 0, 0) = 0); + + If noError then + begin + //Start MainLoop + While noError do + begin + noError := MainLoop; + // to-do : Call Display Draw here + end; + end + else + begin + If (LastErrorString <> '') then + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error calling LoadingFinished Hook: ' + LastErrorString))) + else + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error calling LoadingFinished Hook'))); + end; + end + else + begin + If (LastErrorString <> '') then + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading textures: ' + LastErrorString))) + else + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading textures'))); + end; + end + else + begin + If (LastErrorString <> '') then + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error translating: ' + LastErrorString))) + else + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error translating'))); + end; + + end + else + begin + If (LastErrorString <> '') then + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error initing Modules: ' + LastErrorString))) + else + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error initing Modules'))); + end; + end + else + begin + If (LastErrorString <> '') then + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading Modules: ' + LastErrorString))) + else + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading Modules'))); + end; end else - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar(''))); + begin + If (LastErrorString <> '') then + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error Getting Modules: ' + LastErrorString))) + else + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error Getting Modules'))); + end; + + //DeInit + DeInit; end; //------------- @@ -138,7 +233,7 @@ end; //------------- Function TCore.MainLoop: Boolean; begin - Result := True; + Result := False; end; @@ -149,11 +244,17 @@ Function TCore.GetModules: Boolean; var I: Integer; begin - For I := 0 to high(Modules) do - begin - Modules[I].NeedsDeInit := False; - Modules[I].Module := CORE_MODULES_TO_LOAD[I].Create; - Modules[I].Module.Info(@Modules[I].Info); + Result := False; + try + For I := 0 to high(Modules) do + begin + Modules[I].NeedsDeInit := False; + Modules[I].Module := CORE_MODULES_TO_LOAD[I].Create; + Modules[I].Module.Info(@Modules[I].Info); + end; + Result := True; + except + ReportError(Integer(PChar('Can''t get module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), Integer(PChar('Core'))); end; end; @@ -169,7 +270,13 @@ begin I := 0; While ((Result = True) AND (I <= High(CORE_MODULES_TO_LOAD))) do begin - Result := Modules[I].Module.Load; + try + Result := Modules[I].Module.Load; + except + Result := False; + ReportError(Integer(PChar('Error loading module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), Integer(PChar('Core'))); + end; + Inc(I); end; end; @@ -186,7 +293,14 @@ begin I := 0; While ((Result = True) AND (I <= High(CORE_MODULES_TO_LOAD))) do begin - Result := Modules[I].Module.Init; + try + Result := Modules[I].Module.Init; + except + Result := False; + ReportError(Integer(PChar('Error initing module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), Integer(PChar('Core'))); + end; + + Modules[I].NeedsDeInit := Result; Inc(I); end; end; @@ -227,13 +341,19 @@ Function TCore.LoadCore: Boolean; begin hLoadingFinished := Hooks.AddEvent('Core/LoadingFinished'); hMainLoop := Hooks.AddEvent('Core/MainLoop'); + hTranslate := Hooks.AddEvent('Core/Translate'); hLoadTextures := Hooks.AddEvent('Core/LoadTextures'); hExitQuery := Hooks.AddEvent('Core/ExitQuery'); hExit := Hooks.AddEvent('Core/Exit'); hDebug := Hooks.AddEvent('Core/NewDebugInfo'); hError := Hooks.AddEvent('Core/NewError'); - sReportError := Services.AddService('Core/ReportError'); - sReportDebug := Services.AddService('Core/ReportDebug'); + + sReportError := Services.AddService('Core/ReportError', nil, Self.ReportError); + sReportDebug := Services.AddService('Core/ReportDebug', nil, Self.ReportDebug); + sShowMessage := Services.AddService('Core/ShowMessage', nil, Self.ShowMessage); + sRetranslate := Services.AddService('Core/Retranslate', nil, Self.Retranslate); + sReloadTextures := Services.AddService('Core/ReloadTextures', nil, Self.ReloadTextures); + sGetModuleInfo := Services.AddService('Core/GetModuleInfo', nil, Self.GetModuleInfo); end; //------------- @@ -255,7 +375,7 @@ begin end; //------------- -//Shows a MessageDialog (lParam: PChar Text, wParam: Symbol) +// Shows a MessageDialog (lParam: PChar Text, wParam: Symbol) //------------- Function TCore.ShowMessage(wParam, lParam: DWord): integer; var Params: Cardinal; @@ -280,4 +400,64 @@ begin // to-do : write ShowMessage for other OSes end; +//------------- +// Calls NewError HookChain (wParam: Pchar(Message), lParam: PChar(Reportername)) +//------------- +Function TCore.ReportError(wParam, lParam: DWord): integer; +begin + Hooks.CallEventChain(hError, wParam, lParam); + + //Update LastErrorReporter and LastErrorString + LastErrorReporter := String(PChar(Ptr(lParam))); + LastErrorString := String(PChar(Ptr(wParam))); +end; + +//------------- +// Calls NewDebugInfo HookChain (wParam: Pchar(Message), lParam: PChar(Reportername)) +//------------- +Function TCore.ReportDebug(wParam, lParam: DWord): integer; +begin + Hooks.CallEventChain(hDebug, wParam, lParam); +end; + +//------------- +// Calls Translate hook +//------------- +Function TCore.Retranslate(wParam, lParam: DWord): integer; +begin + Hooks.CallEventChain(hTranslate, 0, 1); +end; + +//------------- +// Calls LoadTextures hook +//------------- +Function TCore.ReloadTextures(wParam, lParam: DWord): integer; +begin + Hooks.CallEventChain(hLoadTextures, 0, 1); +end; + +//------------- +// If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TModuleInfo to address at lparam +//------------- +Function TCore.GetModuleInfo(wParam, lParam: DWord): integer; +begin + if (ptr(lParam) = nil) then + begin + Result := Length(Modules); + end + else + begin + Try + For Result := 0 to High(Modules) do + begin + AModuleInfo(ptr(lParam))[Result].Name := Modules[Result].Info.Name; + AModuleInfo(ptr(lParam))[Result].Version := Modules[Result].Info.Version; + AModuleInfo(ptr(lParam))[Result].Description := Modules[Result].Info.Description; + end; + Except + Result := -1; + end; + end; +end; + end. \ No newline at end of file diff --git a/Game/Code/Classes/UCoreModule.pas b/Game/Code/Classes/UCoreModule.pas index 4d36f925..6fca5d37 100644 --- a/Game/Code/Classes/UCoreModule.pas +++ b/Game/Code/Classes/UCoreModule.pas @@ -6,19 +6,13 @@ interface Dummy Class that has Methods that will be called from Core In the Best case every Piece of this Software is a Module *********************} +uses UPluginDefs; {$IFDEF FPC} {$MODE Delphi} {$ENDIF} type - PModuleInfo = ^TModuleInfo; - TModuleInfo = record - Name: String; - Version: LongWord; - Description: String; - end; - TCoreModule = class public //Function that gives some Infos about the Module to the Core @@ -44,6 +38,10 @@ type //Deinit is in backwards Initing Order //If False is Returned this will cause a Forced Exit Procedure DeInit; virtual; + + //Is Called if this Module will be unloaded and has been created + //Should be used to Free Memory + Procedure Free; virtual; end; cCoreModule = class of TCoreModule; @@ -102,4 +100,13 @@ begin //Dummy ftw!! end; +//------------- +//Is Called if this Module will be unloaded and has been created +//Should be used to Free Memory +//------------- +Procedure TCoreModule.Free; +begin + //Dummy ftw!! +end; + end. \ No newline at end of file diff --git a/Game/Code/Classes/uPluginLoader.pas b/Game/Code/Classes/uPluginLoader.pas new file mode 100644 index 00000000..929fd84e --- /dev/null +++ b/Game/Code/Classes/uPluginLoader.pas @@ -0,0 +1,7 @@ +unit uPluginLoader; + +interface + +implementation + +end. diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 9cdbca50..1e418a49 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -4,16 +4,22 @@ program UltraStar; {$I switches.inc} uses + //------------------------------ + //Includes - 3rd Party Libraries + //------------------------------ SDL in 'lib\JEDI-SDLv1.0\SDL\Pas\SDL.pas', moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas', sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', + bass in 'lib\bass\delphi\bass.pas', + PNGImage in 'lib\PNGImage\PNGImage.pas', PNGzLib in 'lib\PNGImage\PNGzLib.pas', pnglang in 'lib\PNGImage\pnglang.pas', + midiout in 'lib\midi\midiout.pas', midiin in 'lib\midi\midiin.pas', CIRCBUF in 'lib\midi\CIRCBUF.PAS', @@ -22,14 +28,20 @@ uses MidiCons in 'lib\midi\MidiCons.PAS', MidiFile in 'lib\midi\MidiFile.PAS', Delphmcb in 'lib\midi\Delphmcb.PAS', + avcodec in 'lib\ffmpeg\avcodec.pas', avformat in 'lib\ffmpeg\avformat.pas', avutil in 'lib\ffmpeg\avutil.pas', rational in 'lib\ffmpeg\rational.pas', opt in 'lib\ffmpeg\opt.pas', avio in 'lib\ffmpeg\avio.pas', + SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', SQLite3 in 'lib\SQLite\SQLite3.pas', + + //------------------------------ + //Includes - Menu System + //------------------------------ UDisplay in 'Menu\UDisplay.pas', UMenu in 'Menu\UMenu.pas', UMenuStatic in 'Menu\UMenuStatic.pas', @@ -40,19 +52,15 @@ uses UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', UDrawTexture in 'Menu\UDrawTexture.pas', UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', + + //------------------------------ + //Includes - Classes + //------------------------------ UCommon in 'Classes\UCommon.pas', UGraphic in 'Classes\UGraphic.pas', UTexture in 'Classes\UTexture.pas', - - UMusic in 'Classes\UMusic.pas', - UMedia_dummy in 'Classes\UMedia_dummy.pas', - - // UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', - UAudio_Bass in 'Classes\UAudio_Bass.pas', - UVideo in 'Classes\UVideo.pas', - - - + UMusic in 'Classes\UMusic.pas', + UAudio_Bass in 'Classes\UAudio_Bass.pas', ULanguage in 'Classes\ULanguage.pas', UMain in 'Classes\UMain.pas', UDraw in 'Classes\UDraw.pas', @@ -75,19 +83,31 @@ uses UFiles in 'Classes\UFiles.pas', UGraphicClasses in 'Classes\UGraphicClasses.pas', UDLLManager in 'Classes\UDLLManager.pas', - UParty in 'Classes\UParty.pas', UPlaylist in 'Classes\UPlaylist.pas', UCommandLine in 'Classes\UCommandLine.pas', UTextClasses in 'Classes\UTextClasses.pas', USingScores in 'Classes\USingScores.pas', USingNotes in 'Classes\USingNotes.pas', - UModules in 'Classes\UModules.pas', - UHooks in 'Classes\UHooks.pas', - UServices in 'Classes\UServices.pas', - UCore in 'Classes\UCore.pas', - UCoreModule in 'Classes\UCoreModule.pas', - UPluginInterface in 'Classes\UPluginInterface.pas', + UModules in 'Classes\UModules.pas', //List of Modules to Load + UHooks in 'Classes\UHooks.pas', //Hook Managing + UServices in 'Classes\UServices.pas',//Service Managing + UCore in 'Classes\UCore.pas', //Core, Maybe remove this + UCoreModule in 'Classes\UCoreModule.pas', //^ + UPluginInterface in 'Classes\UPluginInterface.pas', //Interface offered by Core to Plugins + uPluginLoader in 'Classes\uPluginLoader.pas', //New Plugin Loader Module + + UParty in 'Classes\UParty.pas', // to - do : rewrite Party Manager as Module, reomplent ability to offer party Mody by Plugin + + //------------------------------ + //Includes - Video Support + //------------------------------ + UMedia_dummy in 'Classes\UMedia_dummy.pas', + UVideo in 'Classes\UVideo.pas', + + //------------------------------ + //Includes - Screens + //------------------------------ UScreenLoading in 'Screens\UScreenLoading.pas', UScreenWelcome in 'Screens\UScreenWelcome.pas', UScreenMain in 'Screens\UScreenMain.pas', @@ -116,14 +136,23 @@ uses UScreenStatDetail in 'Screens\UScreenStatDetail.pas', UScreenCredits in 'Screens\UScreenCredits.pas', UScreenPopup in 'Screens\UScreenPopup.pas', + + //------------------------------ + //Includes - Screens PartyMode + //------------------------------ UScreenSingModi in 'Screens\UScreenSingModi.pas', UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', UScreenPartyScore in 'Screens\UScreenPartyScore.pas', UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', UScreenPartyWin in 'Screens\UScreenPartyWin.pas', - ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', - UPluginDefs in '..\..\Modis\SDK\UPluginDefs.pas', + + //------------------------------ + //Includes - Modi SDK + //------------------------------ + ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', //Old SDK, will be deleted soon + UPluginDefs in '..\..\Modis\SDK\UPluginDefs.pas', //New SDK, not only Modis + Windows, SysUtils; @@ -346,6 +375,11 @@ begin Log.BenchmarkEnd(0); Log.LogBenchmark('Loading Time', 0); + Log.LogError('Creating Core'); + Core := TCore.Create('Ultrastar Deluxe Beta', MakeVersion(1,1,0, chr(0))); + + Log.LogError('Running Core'); + Core.Run; //------------------------------ //Start- Mainloop -- cgit v1.2.3 From 59074886c5609310cbafcbae19b0a847a1c2bd0e Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 24 Oct 2007 12:05:05 +0000 Subject: comment this.. oops git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@524 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UVideo.pas | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index 6e16a7a3..05496fbc 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -83,7 +83,7 @@ type WantedAudioCodecContext, AudioCodecContext : PSDL_AudioSpec; - aCodecCtx : PAVCodecContext; + aCodecCtx : PAVCodecContext; function find_stream_ids( const aFormatCtx : PAVFormatContext; Out aFirstVideoStream, aFirstAudioStream : integer ): boolean; @@ -471,16 +471,19 @@ begin end; aCodecCtx := VideoFormatContext.streams[ AudioStreamIndex ].codec; -(* + if aCodecCtx <> nil then + begin + WantedAudioCodecContext.freq := aCodecCtx^.sample_rate; - WantedAudioCodecContext.format := AUDIO_S16SYS; - WantedAudioCodecContext.channels := aCodecCtx^.channels; - WantedAudioCodecContext.silence := 0; +// WantedAudioCodecContext.format := AUDIO_S16SYS; +// WantedAudioCodecContext.channels := aCodecCtx^.channels; +(* WantedAudioCodecContext.silence := 0; WantedAudioCodecContext.samples := 1024;//SDL_AUDIO_BUFFER_SIZE; // WantedAudioCodecContext.callback := audio_callback; WantedAudioCodecContext.userdata := aCodecCtx; *) + end; (* if(SDL_OpenAudio(WantedAudioCodecContext, AudioCodecContext) < 0) then begin -- cgit v1.2.3 From cdf2eb843e60cb4712080430a9f43f8e68e26069 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 24 Oct 2007 12:14:03 +0000 Subject: modifed bitmap fonts to have alpha channel, after conversation with blindy. modified ultrastar.lpr to get linux version running as it should be ( after mods I did in windows ) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@525 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMusic.pas | 110 ++--- Game/Code/UltraStar.lpr | 970 +++++++++++++++++++++---------------------- 2 files changed, 540 insertions(+), 540 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index 88d845f7..f3342625 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -94,13 +94,13 @@ type type IGenericPlayback = Interface - ['{63A5EBC3-3F4D-4F23-8DFB-B5165FCE33DD}'] - function GetName: String; - - function Open(Name: string): boolean; // true if succeed - procedure Close; - - procedure Play; + ['{63A5EBC3-3F4D-4F23-8DFB-B5165FCE33DD}'] + function GetName: String; + + function Open(Name: string): boolean; // true if succeed + procedure Close; + + procedure Play; procedure Pause; procedure Stop; @@ -108,24 +108,24 @@ type function getPosition: real; property position : real READ getPosition WRITE MoveTo; - end; + end; IVideoPlayback = Interface( IGenericPlayback ) - ['{3574C40C-28AE-4201-B3D1-3D1F0759B131}'] -(* - procedure FFmpegOpenFile(FileName: pAnsiChar); + ['{3574C40C-28AE-4201-B3D1-3D1F0759B131}'] +(* + procedure FFmpegOpenFile(FileName: pAnsiChar); procedure FFmpegClose; procedure FFmpegGetFrame(Time: Extended); procedure FFmpegDrawGL(Screen: integer); procedure FFmpegTogglePause; procedure FFmpegSkip(Time: Single); -*) - procedure init(); - - procedure FFmpegGetFrame(Time: Extended); // WANT TO RENAME THESE TO BE MORE GENERIC +*) + procedure init(); + + procedure FFmpegGetFrame(Time: Extended); // WANT TO RENAME THESE TO BE MORE GENERIC procedure FFmpegDrawGL(Screen: integer); // WANT TO RENAME THESE TO BE MORE GENERIC - + end; IAudioPlayback = Interface( IGenericPlayback ) @@ -212,13 +212,13 @@ var singleton_AudioInput : IAudioInput = nil; singleton_AudioManager : TInterfaceList = nil; - -function AudioManager: TInterfaceList; -begin - if singleton_AudioManager = nil then - singleton_AudioManager := TInterfaceList.Create(); - - Result := singleton_AudioManager; + +function AudioManager: TInterfaceList; +begin + if singleton_AudioManager = nil then + singleton_AudioManager := TInterfaceList.Create(); + + Result := singleton_AudioManager; end; //CompressionPluginManager @@ -234,7 +234,7 @@ end; function AudioInput(): IAudioInput; begin - result := singleton_AudioInput; + result := singleton_AudioInput; end; procedure InitializeSound; @@ -253,33 +253,33 @@ begin begin if assigned( AudioManager[iCount] ) then begin - // if this interface is a Playback, then set it as the default used - - if ( AudioManager[iCount].QueryInterface( IAudioPlayback, lTmpInterface ) = 0 ) AND - ( true ) then + // if this interface is a Playback, then set it as the default used + + if ( AudioManager[iCount].QueryInterface( IAudioPlayback, lTmpInterface ) = 0 ) AND + ( true ) then // ( not assigned( singleton_AudioPlayback ) ) then begin - singleton_AudioPlayback := IAudioPlayback( lTmpInterface ); - end; - - // if this interface is a Input, then set it as the default used - if ( AudioManager[iCount].QueryInterface( IAudioInput, lTmpInterface ) = 0 ) AND - ( true ) then -// ( not assigned( singleton_AudioInput ) ) then + singleton_AudioPlayback := IAudioPlayback( lTmpInterface ); + end; + + // if this interface is a Input, then set it as the default used + if ( AudioManager[iCount].QueryInterface( IAudioInput, lTmpInterface ) = 0 ) AND + ( true ) then +// ( not assigned( singleton_AudioInput ) ) then begin - singleton_AudioInput := IAudioInput( lTmpInterface ); - end; - - // if this interface is a Input, then set it as the default used - if ( AudioManager[iCount].QueryInterface( IVideoPlayback, lTmpInterface ) = 0 ) AND - ( true ) then -// ( not assigned( singleton_VideoPlayback ) ) then + singleton_AudioInput := IAudioInput( lTmpInterface ); + end; + + // if this interface is a Input, then set it as the default used + if ( AudioManager[iCount].QueryInterface( IVideoPlayback, lTmpInterface ) = 0 ) AND + ( true ) then +// ( not assigned( singleton_VideoPlayback ) ) then begin - singleton_VideoPlayback := IVideoPlayback( lTmpInterface ); - end; - - end; - end; + singleton_VideoPlayback := IVideoPlayback( lTmpInterface ); + end; + + end; + end; if VideoPlayback <> nil then @@ -307,14 +307,14 @@ begin end; initialization -begin - writeln('Init AudioManager'); - singleton_AudioManager := TInterfaceList.Create(); -end; - -finalization - writeln('Finalize AudioManager'); - singleton_AudioManager.clear; +begin + writeln('Init AudioManager'); + singleton_AudioManager := TInterfaceList.Create(); +end; + +finalization + writeln('Finalize AudioManager'); + singleton_AudioManager.clear; FreeAndNil( singleton_AudioManager ); end. diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index 0399c389..49946f1c 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -1,485 +1,485 @@ -program UltraStar; - -{$DEFINE TRANSLATE} - -{$IFDEF FPC} - {$MODE DELPHI} -{$ELSE} - {$R 'UltraStar.res' 'UltraStar.rc'} -{$ENDIF} - -{$I switches.inc} - -uses - - // *************************************************************************** - // - // Developers PLEASE NOTE !!!!!!! - // - // As of september 2007, I am working towards porting Ultrastar-DX to run - // on Linux. I will be modifiying the source to make it compile in lazarus - // on windows & linux and I will make sure that it compiles in delphi still - // To help me in this endevour, please can you make a point of remembering - // that linux is CASE SENSATIVE, and file / unit names must be as per - // the filename exactly. - // - // EG : opengl12.pas must not be OpenGL in the uses cluase. - // - // thanks for your help... - // - // *************************************************************************** - - // Interesting stuff... :) - // http://burningsmell.org/sdl_audioin/ - - - //------------------------------ - //Includes - 3rd Party Libraries - //------------------------------ - - // SDL / OpenGL - moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', - opengl12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\opengl12.pas', - sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', - sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', - sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', - sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', - - - // Bass - {$IFDEF UseBASS} - bass in 'lib\bass\delphi\bass.pas', - {$ENDIF} - - // Midi Units - {$IFDEF UseMIDIPort} - Circbuf in 'lib\midi\CIRCBUF.PAS', - Delphmcb in 'lib\midi\Delphmcb.PAS', - MidiCons in 'lib\midi\MidiCons.PAS', - MidiDefs in 'lib\midi\MidiDefs.PAS', - MidiFile in 'lib\midi\MidiFile.PAS', - midiin in 'lib\midi\midiin.pas', - midiout in 'lib\midi\midiout.pas', - MidiType in 'lib\midi\MidiType.PAS', - {$ENDIF} - - // FFMpeg units - avcodec in 'lib\ffmpeg\avcodec.pas', - avformat in 'lib\ffmpeg\avformat.pas', - avio in 'lib\ffmpeg\avio.pas', - avutil in 'lib\ffmpeg\avutil.pas', - opt in 'lib\ffmpeg\opt.pas', - rational in 'lib\ffmpeg\rational.pas', - - - // Sql Lite - SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', - SQLite3 in 'lib\SQLite\SQLite3.pas', - - - //------------------------------ - //Includes - Menu System - //------------------------------ - - UDisplay in 'Menu\UDisplay.pas', - UDrawTexture in 'Menu\UDrawTexture.pas', - UMenu in 'Menu\UMenu.pas', - UMenuButton in 'Menu\UMenuButton.pas', - UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', - UMenuInteract in 'Menu\UMenuInteract.pas', - UMenuSelect in 'Menu\UMenuSelect.pas', - UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', - UMenuStatic in 'Menu\UMenuStatic.pas', - UMenuText in 'Menu\UMenuText.pas', - - //------------------------------ - //Includes - Classes - //------------------------------ - - {$IFDEF FPC} - ulazjpeg in 'Classes\Ulazjpeg.pas', - {$ENDIF} - - TextGL in 'Classes\TextGL.pas', - UCatCovers in 'Classes\UCatCovers.pas', - UCommandLine in 'Classes\UCommandLine.pas', - UCommon in 'Classes\UCommon.pas', - UCovers in 'Classes\UCovers.pas', - UDataBase in 'Classes\UDataBase.pas', - UDLLManager in 'Classes\UDLLManager.pas', - UDraw in 'Classes\UDraw.pas', - UFiles in 'Classes\UFiles.pas', - UGraphic in 'Classes\UGraphic.pas', - UGraphicClasses in 'Classes\UGraphicClasses.pas', - UIni in 'Classes\UIni.pas', - UJoystick in 'Classes\UJoystick.pas', - ULanguage in 'Classes\ULanguage.pas', - ULCD in 'Classes\ULCD.pas', - ULight in 'Classes\ULight.pas', - ULog in 'Classes\ULog.pas', - ULyrics in 'Classes\ULyrics.pas', - ULyrics_bak in 'Classes\ULyrics_bak.pas', - UMain in 'Classes\UMain.pas', - UMusic in 'Classes\UMusic.pas', - UMedia_dummy in 'Classes\UMedia_dummy.pas', -// UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', -{$ifdef win32} - UAudio_bass in 'Classes\UAudio_bass.pas', -{$endif} - - UParty in 'Classes\UParty.pas', - UPlaylist in 'Classes\UPlaylist.pas', - URecord in 'Classes\URecord.pas', - USkins in 'Classes\USkins.pas', - USingScores in 'Classes\USingScores.pas', - USongs in 'Classes\USongs.pas', - UTexture in 'Classes\UTexture.pas', - UThemes in 'Classes\UThemes.pas', - UTime in 'Classes\UTime.pas', - USingNotes in 'Classes\USingNotes.pas', - - - //------------------------------ - //Includes - Video Support - //------------------------------ - UVideo in 'Classes\UVideo.pas', - - - //------------------------------ - //Includes - Screens - //------------------------------ - UScreenCredits in 'Screens\UScreenCredits.pas', - UScreenEdit in 'Screens\UScreenEdit.pas', - UScreenEditConvert in 'Screens\UScreenEditConvert.pas', - UScreenEditHeader in 'Screens\UScreenEditHeader.pas', - UScreenEditSub in 'Screens\UScreenEditSub.pas', - UScreenLevel in 'Screens\UScreenLevel.pas', - UScreenLoading in 'Screens\UScreenLoading.pas', - UScreenMain in 'Screens\UScreenMain.pas', - UScreenName in 'Screens\UScreenName.pas', - UScreenOpen in 'Screens\UScreenOpen.pas', - UScreenOptions in 'Screens\UScreenOptions.pas', - UScreenOptionsAdvanced in 'Screens\UScreenOptionsAdvanced.pas', - UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', - UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', - UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', - UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', - UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', - UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', - UScreenPopup in 'Screens\UScreenPopup.pas', - UScreenScore in 'Screens\UScreenScore.pas', - UScreenSing in 'Screens\UScreenSing.pas', - UScreenSong in 'Screens\UScreenSong.pas', - UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', - UScreenSongMenu in 'Screens\UScreenSongMenu.pas', - UScreenStatDetail in 'Screens\UScreenStatDetail.pas', - UScreenStatMain in 'Screens\UScreenStatMain.pas', - UScreenTop5 in 'Screens\UScreenTop5.pas', - UScreenWelcome in 'Screens\UScreenWelcome.pas', - - //------------------------------ - //Includes - Screens PartyMode - //------------------------------ - UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', - UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', - UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', - UScreenPartyScore in 'Screens\UScreenPartyScore.pas', - UScreenPartyWin in 'Screens\UScreenPartyWin.pas', - UScreenSingModi in 'Screens\UScreenSingModi.pas', - - //------------------------------ - //Includes - Modi SDK - //------------------------------ - ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', - - - //------------------------------ - //Includes - Delphi - //------------------------------ - {$IFDEF win32} - Windows, - {$ENDIF} - SysUtils; - -const - Version = 'UltraStar Deluxe V 1.10 Alpha Build'; - -var - WndTitle: string; - hWnd: THandle; - I: Integer; - - aFormatCtx : PAVFormatContext;//PAVCodecContext; - aCodecCtx : PAVCodecContext; - VideoStreamIndex, - AudioStreamIndex : integer; - -begin - - - -(* - -av_register_all; -aFormatCtx := av_alloc_format_context(); -if av_open_input_file( aFormatCtx, pchar( Paramstr(1) ), NIL, 0, NIL) = 0 then -begin - if av_find_stream_info( aFormatCtx ) >= 0 then - begin - writeln(''); - dump_format(aFormatCtx, 0, pchar( Paramstr(1) ), 0); - writeln(''); - -// writeln( pchar( filename ) ); - -// av_read_play( aFormatCtx ); - find_stream_ids( aFormatCtx , VideoStreamIndex , AudioStreamIndex ); - - writeln( 'VideoStreamIndex : ' + inttostr(VideoStreamIndex) ); - writeln( 'AudioStreamIndex : ' + inttostr(AudioStreamIndex) ); - - aCodecCtx := aFormatCtx.streams[ AudioStreamIndex ].codec; - writeln( 'Audio Codec Channels: '+ inttostr( integer( aCodecCtx.channels ) ) ); - writeln( 'Audio Codec freq: '+ inttostr( integer( aCodecCtx.sample_rate ) ) ); - - wanted_spec.freq = aCodecCtx->sample_rate; - wanted_spec.format = AUDIO_S16SYS; - wanted_spec.channels = aCodecCtx->channels; - wanted_spec.silence = 0; - wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE; - wanted_spec.callback = audio_callback; - wanted_spec.userdata = aCodecCtx; - - if(SDL_OpenAudio(&wanted_spec, aCodecCtx) < 0) then - begin - writeln( 'Could not do SDL_OpenAudio' ); - exit; - end; - - - end; -end; - -exit; -*) - - WndTitle := Version; - - - {$ifdef Win32} - //------------------------------ - //Start more than One Time Prevention - //------------------------------ - hWnd:= FindWindow(nil, PChar(WndTitle)); - //Programm already started - if (hWnd <> 0) then - begin - I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Contìnue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); - if (I = IDYes) then - begin - I := 1; - repeat - Inc(I); - hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); - until (hWnd = 0); - - WndTitle := WndTitle + ' Instance ' + InttoStr(I); - end - else - Exit; - end; - {$endif} - - //------------------------------ - //StartUp - Create Classes and Load Files - //------------------------------ - USTime := TTime.Create; - - // Commandline Parameter Parser - Params := TCMDParams.Create; - - // Log + Benchmark - Log := TLog.Create; - Log.Title := WndTitle; - Log.Enabled := Not Params.NoLog; - Log.BenchmarkStart(0); - - // Language - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Paths', 'Initialization'); InitializePaths; - Log.LogStatus('Load Language', 'Initialization'); Language := TLanguage.Create; - //Add Const Values: - Language.AddConst('US_VERSION', Version); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Language', 1); - - // SDL - Log.BenchmarkStart(1); - Log.LogStatus('Initialize SDL', 'Initialization'); - SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing SDL', 1); - - // Skin - Log.BenchmarkStart(1); - Log.LogStatus('Loading Skin List', 'Initialization'); Skin := TSkin.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Skin List', 1); - - // Sound Card List - Log.BenchmarkStart(1); - Log.LogStatus('Loading Soundcard list', 'Initialization'); - Recording := TRecord.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Soundcard list', 1); - - // Ini + Paths - Log.BenchmarkStart(1); - Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; - Ini.Load; - - //Load Languagefile - if (Params.Language <> -1) then - Language.ChangeLanguage(ILanguage[Params.Language]) - else - Language.ChangeLanguage(ILanguage[Ini.Language]); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Ini', 1); - - // LCD - Log.BenchmarkStart(1); - Log.LogStatus('Load LCD', 'Initialization'); LCD := TLCD.Create; - if Ini.LPT = 1 then begin -// LCD.HalfInterface := true; - LCD.Enable; - LCD.Clear; - LCD.WriteText(1, ' UltraStar '); - LCD.WriteText(2, ' Loading... '); - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading LCD', 1); - - // Light - Log.BenchmarkStart(1); - Log.LogStatus('Load Light', 'Initialization'); Light := TLight.Create; - if Ini.LPT = 2 then begin - Light.Enable; - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Light', 1); - - // Theme - Log.BenchmarkStart(1); - Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Themes', 1); - - // Covers Cache - Log.BenchmarkStart(1); - Log.LogStatus('Creating Covers Cache', 'Initialization'); Covers := TCovers.Create; - Log.LogBenchmark('Loading Covers Cache Array', 1); - Log.BenchmarkStart(1); - - // Category Covers - Log.BenchmarkStart(1); - Log.LogStatus('Creating Category Covers Array', 'Initialization'); - CatCovers:= TCatCovers.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Category Covers Array', 1); - - // Songs - //Log.BenchmarkStart(1); - Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; - Songs.LoadSongList; - Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Songs', 1); - - // PluginManager - Log.BenchmarkStart(1); - Log.LogStatus('PluginManager', 'Initialization'); - DLLMan := TDLLMan.Create; //Load PluginList - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PluginManager', 1); - - // Party Mode Manager - Log.BenchmarkStart(1); - Log.LogStatus('PartySession Manager', 'Initialization'); - PartySession := TParty_Session.Create; //Load PartySession - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PartySession Manager', 1); - - // Graphics - Log.BenchmarkStart(1); - Log.LogStatus('Initialize 3D', 'Initialization'); Initialize3D(WndTitle); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing 3D', 1); - - // Sound - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Sound', 'Initialization'); InitializeSound(); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Sound', 1); - - // Score Saving System - Log.BenchmarkStart(1); - Log.LogStatus('DataBase System', 'Initialization'); - DataBase := TDataBaseSystem.Create; - - if (Params.ScoreFile = '') then - DataBase.Init ('Ultrastar.db') - else - DataBase.Init (Params.ScoreFile); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading DataBase System', 1); - - //Playlist Manager - Log.BenchmarkStart(1); - Log.LogStatus('Playlist Manager', 'Initialization'); - PlaylistMan := TPlaylistManager.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Playlist Manager', 1); - - //GoldenStarsTwinkleMod - Log.BenchmarkStart(1); - Log.LogStatus('Effect Manager', 'Initialization'); - GoldenRec := TEffectManager.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Particel System', 1); - - // Joypad - if (Ini.Joypad = 1) OR (Params.Joypad) then begin - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Joystick', 'Initialization'); Joy := TJoy.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Joystick', 1); - end; - - Log.BenchmarkEnd(0); - Log.LogBenchmark('Loading Time', 0); - - - //------------------------------ - //Start- Mainloop - //------------------------------ - //Music.SetLoop(true); - //Music.SetVolume(50); - //Music.Open(SkinPath + 'Menu Music 3.mp3'); - //Music.Play; - Log.LogStatus('Main Loop', 'Initialization'); MainLoop; - - Log.LogStatus('Cleanup', 'Done'); - - //------------------------------ - //Finish Application - //------------------------------ - if Ini.LPT = 1 then LCD.Clear; - if Ini.LPT = 2 then Light.TurnOff; - - // Insignificant change.. - - Log.Free; -end. +program UltraStar; + +{$DEFINE TRANSLATE} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ELSE} + {$R 'UltraStar.res' 'UltraStar.rc'} +{$ENDIF} + +{$I switches.inc} + +uses + + // *************************************************************************** + // + // Developers PLEASE NOTE !!!!!!! + // + // As of september 2007, I am working towards porting Ultrastar-DX to run + // on Linux. I will be modifiying the source to make it compile in lazarus + // on windows & linux and I will make sure that it compiles in delphi still + // To help me in this endevour, please can you make a point of remembering + // that linux is CASE SENSATIVE, and file / unit names must be as per + // the filename exactly. + // + // EG : opengl12.pas must not be OpenGL in the uses cluase. + // + // thanks for your help... + // + // *************************************************************************** + + // Interesting stuff... :) + // http://burningsmell.org/sdl_audioin/ + + + //------------------------------ + //Includes - 3rd Party Libraries + //------------------------------ + + // SDL / OpenGL + moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', + opengl12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\opengl12.pas', + sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', + sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', + sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', + sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', + + + // Bass + {$IFDEF UseBASS} + bass in 'lib\bass\delphi\bass.pas', + {$ENDIF} + + // Midi Units + {$IFDEF UseMIDIPort} + Circbuf in 'lib\midi\CIRCBUF.PAS', + Delphmcb in 'lib\midi\Delphmcb.PAS', + MidiCons in 'lib\midi\MidiCons.PAS', + MidiDefs in 'lib\midi\MidiDefs.PAS', + MidiFile in 'lib\midi\MidiFile.PAS', + midiin in 'lib\midi\midiin.pas', + midiout in 'lib\midi\midiout.pas', + MidiType in 'lib\midi\MidiType.PAS', + {$ENDIF} + + // FFMpeg units + avcodec in 'lib\ffmpeg\avcodec.pas', + avformat in 'lib\ffmpeg\avformat.pas', + avio in 'lib\ffmpeg\avio.pas', + avutil in 'lib\ffmpeg\avutil.pas', + opt in 'lib\ffmpeg\opt.pas', + rational in 'lib\ffmpeg\rational.pas', + + + // Sql Lite + SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', + SQLite3 in 'lib\SQLite\SQLite3.pas', + + + //------------------------------ + //Includes - Menu System + //------------------------------ + + UDisplay in 'Menu\UDisplay.pas', + UDrawTexture in 'Menu\UDrawTexture.pas', + UMenu in 'Menu\UMenu.pas', + UMenuButton in 'Menu\UMenuButton.pas', + UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', + UMenuInteract in 'Menu\UMenuInteract.pas', + UMenuSelect in 'Menu\UMenuSelect.pas', + UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', + UMenuStatic in 'Menu\UMenuStatic.pas', + UMenuText in 'Menu\UMenuText.pas', + + //------------------------------ + //Includes - Classes + //------------------------------ + + {$IFDEF FPC} + ulazjpeg in 'Classes\Ulazjpeg.pas', + {$ENDIF} + + TextGL in 'Classes\TextGL.pas', + UCatCovers in 'Classes\UCatCovers.pas', + UCommandLine in 'Classes\UCommandLine.pas', + UCommon in 'Classes\UCommon.pas', + UCovers in 'Classes\UCovers.pas', + UDataBase in 'Classes\UDataBase.pas', + UDLLManager in 'Classes\UDLLManager.pas', + UDraw in 'Classes\UDraw.pas', + UFiles in 'Classes\UFiles.pas', + UGraphic in 'Classes\UGraphic.pas', + UGraphicClasses in 'Classes\UGraphicClasses.pas', + UIni in 'Classes\UIni.pas', + UJoystick in 'Classes\UJoystick.pas', + ULanguage in 'Classes\ULanguage.pas', + ULCD in 'Classes\ULCD.pas', + ULight in 'Classes\ULight.pas', + ULog in 'Classes\ULog.pas', + ULyrics in 'Classes\ULyrics.pas', + ULyrics_bak in 'Classes\ULyrics_bak.pas', + UMain in 'Classes\UMain.pas', + + + UMusic in 'Classes\UMusic.pas', + UMedia_dummy in 'Classes\UMedia_dummy.pas', +// UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', + UVideo in 'Classes\UVideo.pas', + +{$ifdef win32} + UAudio_bass in 'Classes\UAudio_bass.pas', +{$endif} + + UParty in 'Classes\UParty.pas', + UPlaylist in 'Classes\UPlaylist.pas', + URecord in 'Classes\URecord.pas', + USkins in 'Classes\USkins.pas', + USingScores in 'Classes\USingScores.pas', + USongs in 'Classes\USongs.pas', + UTexture in 'Classes\UTexture.pas', + UThemes in 'Classes\UThemes.pas', + UTime in 'Classes\UTime.pas', + USingNotes in 'Classes\USingNotes.pas', + + + + //------------------------------ + //Includes - Screens + //------------------------------ + UScreenCredits in 'Screens\UScreenCredits.pas', + UScreenEdit in 'Screens\UScreenEdit.pas', + UScreenEditConvert in 'Screens\UScreenEditConvert.pas', + UScreenEditHeader in 'Screens\UScreenEditHeader.pas', + UScreenEditSub in 'Screens\UScreenEditSub.pas', + UScreenLevel in 'Screens\UScreenLevel.pas', + UScreenLoading in 'Screens\UScreenLoading.pas', + UScreenMain in 'Screens\UScreenMain.pas', + UScreenName in 'Screens\UScreenName.pas', + UScreenOpen in 'Screens\UScreenOpen.pas', + UScreenOptions in 'Screens\UScreenOptions.pas', + UScreenOptionsAdvanced in 'Screens\UScreenOptionsAdvanced.pas', + UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', + UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', + UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', + UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', + UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', + UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', + UScreenPopup in 'Screens\UScreenPopup.pas', + UScreenScore in 'Screens\UScreenScore.pas', + UScreenSing in 'Screens\UScreenSing.pas', + UScreenSong in 'Screens\UScreenSong.pas', + UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', + UScreenSongMenu in 'Screens\UScreenSongMenu.pas', + UScreenStatDetail in 'Screens\UScreenStatDetail.pas', + UScreenStatMain in 'Screens\UScreenStatMain.pas', + UScreenTop5 in 'Screens\UScreenTop5.pas', + UScreenWelcome in 'Screens\UScreenWelcome.pas', + + //------------------------------ + //Includes - Screens PartyMode + //------------------------------ + UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', + UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', + UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', + UScreenPartyScore in 'Screens\UScreenPartyScore.pas', + UScreenPartyWin in 'Screens\UScreenPartyWin.pas', + UScreenSingModi in 'Screens\UScreenSingModi.pas', + + //------------------------------ + //Includes - Modi SDK + //------------------------------ + ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', + + + //------------------------------ + //Includes - Delphi + //------------------------------ + {$IFDEF win32} + Windows, + {$ENDIF} + SysUtils; + +const + Version = 'UltraStar Deluxe V 1.10 Alpha Build'; + +var + WndTitle: string; + hWnd: THandle; + I: Integer; + + aFormatCtx : PAVFormatContext;//PAVCodecContext; + aCodecCtx : PAVCodecContext; + VideoStreamIndex, + AudioStreamIndex : integer; + +begin + + + +(* + +av_register_all; +aFormatCtx := av_alloc_format_context(); +if av_open_input_file( aFormatCtx, pchar( Paramstr(1) ), NIL, 0, NIL) = 0 then +begin + if av_find_stream_info( aFormatCtx ) >= 0 then + begin + writeln(''); + dump_format(aFormatCtx, 0, pchar( Paramstr(1) ), 0); + writeln(''); + +// writeln( pchar( filename ) ); + +// av_read_play( aFormatCtx ); + find_stream_ids( aFormatCtx , VideoStreamIndex , AudioStreamIndex ); + + writeln( 'VideoStreamIndex : ' + inttostr(VideoStreamIndex) ); + writeln( 'AudioStreamIndex : ' + inttostr(AudioStreamIndex) ); + + aCodecCtx := aFormatCtx.streams[ AudioStreamIndex ].codec; + writeln( 'Audio Codec Channels: '+ inttostr( integer( aCodecCtx.channels ) ) ); + writeln( 'Audio Codec freq: '+ inttostr( integer( aCodecCtx.sample_rate ) ) ); + + wanted_spec.freq = aCodecCtx->sample_rate; + wanted_spec.format = AUDIO_S16SYS; + wanted_spec.channels = aCodecCtx->channels; + wanted_spec.silence = 0; + wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE; + wanted_spec.callback = audio_callback; + wanted_spec.userdata = aCodecCtx; + + if(SDL_OpenAudio(&wanted_spec, aCodecCtx) < 0) then + begin + writeln( 'Could not do SDL_OpenAudio' ); + exit; + end; + + + end; +end; + +exit; +*) + + WndTitle := Version; + + + {$ifdef Win32} + //------------------------------ + //Start more than One Time Prevention + //------------------------------ + hWnd:= FindWindow(nil, PChar(WndTitle)); + //Programm already started + if (hWnd <> 0) then + begin + I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Contìnue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); + if (I = IDYes) then + begin + I := 1; + repeat + Inc(I); + hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); + until (hWnd = 0); + + WndTitle := WndTitle + ' Instance ' + InttoStr(I); + end + else + Exit; + end; + {$endif} + + //------------------------------ + //StartUp - Create Classes and Load Files + //------------------------------ + USTime := TTime.Create; + + // Commandline Parameter Parser + Params := TCMDParams.Create; + + // Log + Benchmark + Log := TLog.Create; + Log.Title := WndTitle; + Log.Enabled := Not Params.NoLog; + Log.BenchmarkStart(0); + + // Language + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Paths', 'Initialization'); InitializePaths; + Log.LogStatus('Load Language', 'Initialization'); Language := TLanguage.Create; + //Add Const Values: + Language.AddConst('US_VERSION', Version); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Language', 1); + + // SDL + Log.BenchmarkStart(1); + Log.LogStatus('Initialize SDL', 'Initialization'); + SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing SDL', 1); + + // Skin + Log.BenchmarkStart(1); + Log.LogStatus('Loading Skin List', 'Initialization'); Skin := TSkin.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Skin List', 1); + + // Sound Card List + Log.BenchmarkStart(1); + Log.LogStatus('Loading Soundcard list', 'Initialization'); + Recording := TRecord.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Soundcard list', 1); + + // Ini + Paths + Log.BenchmarkStart(1); + Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; + Ini.Load; + + //Load Languagefile + if (Params.Language <> -1) then + Language.ChangeLanguage(ILanguage[Params.Language]) + else + Language.ChangeLanguage(ILanguage[Ini.Language]); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Ini', 1); + + // LCD + Log.BenchmarkStart(1); + Log.LogStatus('Load LCD', 'Initialization'); LCD := TLCD.Create; + if Ini.LPT = 1 then begin +// LCD.HalfInterface := true; + LCD.Enable; + LCD.Clear; + LCD.WriteText(1, ' UltraStar '); + LCD.WriteText(2, ' Loading... '); + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading LCD', 1); + + // Light + Log.BenchmarkStart(1); + Log.LogStatus('Load Light', 'Initialization'); Light := TLight.Create; + if Ini.LPT = 2 then begin + Light.Enable; + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Light', 1); + + // Theme + Log.BenchmarkStart(1); + Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Themes', 1); + + // Covers Cache + Log.BenchmarkStart(1); + Log.LogStatus('Creating Covers Cache', 'Initialization'); Covers := TCovers.Create; + Log.LogBenchmark('Loading Covers Cache Array', 1); + Log.BenchmarkStart(1); + + // Category Covers + Log.BenchmarkStart(1); + Log.LogStatus('Creating Category Covers Array', 'Initialization'); + CatCovers:= TCatCovers.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Category Covers Array', 1); + + // Songs + //Log.BenchmarkStart(1); + Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; + Songs.LoadSongList; + Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Songs', 1); + + // PluginManager + Log.BenchmarkStart(1); + Log.LogStatus('PluginManager', 'Initialization'); + DLLMan := TDLLMan.Create; //Load PluginList + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PluginManager', 1); + + // Party Mode Manager + Log.BenchmarkStart(1); + Log.LogStatus('PartySession Manager', 'Initialization'); + PartySession := TParty_Session.Create; //Load PartySession + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PartySession Manager', 1); + + // Sound + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Sound', 'Initialization'); InitializeSound(); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Sound', 1); + + // Graphics + Log.BenchmarkStart(1); + Log.LogStatus('Initialize 3D', 'Initialization'); Initialize3D(WndTitle); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing 3D', 1); + + + // Score Saving System + Log.BenchmarkStart(1); + Log.LogStatus('DataBase System', 'Initialization'); + DataBase := TDataBaseSystem.Create; + + if (Params.ScoreFile = '') then + DataBase.Init ('Ultrastar.db') + else + DataBase.Init (Params.ScoreFile); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading DataBase System', 1); + + //Playlist Manager + Log.BenchmarkStart(1); + Log.LogStatus('Playlist Manager', 'Initialization'); + PlaylistMan := TPlaylistManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Playlist Manager', 1); + + //GoldenStarsTwinkleMod + Log.BenchmarkStart(1); + Log.LogStatus('Effect Manager', 'Initialization'); + GoldenRec := TEffectManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Particel System', 1); + + // Joypad + if (Ini.Joypad = 1) OR (Params.Joypad) then begin + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Joystick', 'Initialization'); Joy := TJoy.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Joystick', 1); + end; + + Log.BenchmarkEnd(0); + Log.LogBenchmark('Loading Time', 0); + + + //------------------------------ + //Start- Mainloop + //------------------------------ + //Music.SetLoop(true); + //Music.SetVolume(50); + //Music.Open(SkinPath + 'Menu Music 3.mp3'); + //Music.Play; + Log.LogStatus('Main Loop', 'Initialization'); MainLoop; + + Log.LogStatus('Cleanup', 'Done'); + + //------------------------------ + //Finish Application + //------------------------------ + if Ini.LPT = 1 then LCD.Clear; + if Ini.LPT = 2 then Light.TurnOff; + + // Insignificant change.. + + Log.Free; +end. -- cgit v1.2.3 From 9a144f3cc3b9fbed5b07ffc3a05c5449d638d3ae Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 25 Oct 2007 06:59:28 +0000 Subject: minor changes and fixes for USDX on linux. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@526 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 2675 ++++++++++++++++++------------------ Game/Code/Classes/UMain.pas | 7 +- Game/Code/Classes/UMedia_dummy.pas | 50 +- Game/Code/Classes/UVideo.pas | 58 +- Game/Code/Screens/UScreenScore.pas | 8 +- Game/Code/Screens/UScreenSing.pas | 3 +- Game/Code/UltraStar.lpr | 2 + 7 files changed, 1421 insertions(+), 1382 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 473e9017..2a5528b8 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -1,1326 +1,1349 @@ -unit UDraw; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -uses UThemes, - ModiSDK, - UGraphicClasses; - -procedure SingDraw; -procedure SingModiDraw (PlayerInfo: TPlayerInfo); -procedure SingDrawBackground; -procedure SingDrawOscilloscope(X, Y, W, H: real; NrSound: integer); -procedure SingDrawNoteLines(Left, Top, Right: real; Space: integer); -procedure SingDrawBeatDelimeters(Left, Top, Right: real; NrCzesci: integer); -procedure SingDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); -procedure SingDrawPlayerCzesc(X, Y, W: real; NrGracza: integer; Space: integer); -procedure SingDrawPlayerBGCzesc(Left, Top, Right: real; NrCzesci, NrGracza: integer; Space: integer); - -// TimeBar -procedure SingDrawTimeBar(); - -//Draw Editor NoteLines -procedure EditDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); - - -type - TRecR = record - Top: real; - Left: real; - Right: real; - Bottom: real; - - Width: real; - WMid: real; - Height: real; - HMid: real; - - Mid: real; - end; - -var - NotesW: real; - NotesH: real; - Starfr: integer; - StarfrG: integer; - - //SingBar - TickOld: cardinal; - TickOld2:cardinal; - -const - Przedz = 32; - -implementation - -uses {$IFDEF Win32} - windows, - {$ELSE} - lclintf, - {$ENDIF} - OpenGL12, - UGraphic, - SysUtils, - UMusic, - URecord, - ULog, - UScreenSing, - UScreenSingModi, - ULyrics, - UMain, - TextGL, - UTexture, - UDrawTexture, - UIni, - Math, - UDLLManager; - -procedure SingDrawBackground; -var - Rec: TRecR; - TexRec: TRecR; -begin - if ScreenSing.Tex_Background.TexNum >= 1 then begin - - glClearColor (1, 1, 1, 1); - glColor4f (1, 1, 1, 1); - - 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) * ScreenSing.Tex_Background.TexH; - TexRec.Bottom := (Rec.Bottom / 600) * ScreenSing.Tex_Background.TexH; - TexRec.Left := 0; - TexRec.Right := ScreenSing.Tex_Background.TexW; - - glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, ScreenSing.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) * ScreenSing.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) * ScreenSing.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, ScreenSing.Tex_Background.TexNum); - //glEnable(GL_BLEND); - glBegin(GL_QUADS); - - glTexCoord2f(0, 0); glVertex2f(0, 0); - glTexCoord2f(0, ScreenSing.Tex_Background.TexH); glVertex2f(0, 600); - glTexCoord2f( ScreenSing.Tex_Background.TexW, ScreenSing.Tex_Background.TexH); glVertex2f(800, 600); - glTexCoord2f( ScreenSing.Tex_Background.TexW, 0); glVertex2f(800, 0); - - glEnd; - glDisable(GL_TEXTURE_2D); - //glDisable(GL_BLEND); - end; - end; -end; - -procedure SingDrawOscilloscope(X, Y, W, H: real; NrSound: integer); -var - Pet: integer; -begin; -// Log.LogStatus('Oscilloscope', 'SingDraw'); - glColor3f(Skin_OscR, Skin_OscG, Skin_OscB); - {if (ParamStr(1) = '-black') or (ParamStr(1) = '-fsblack') then - glColor3f(1, 1, 1); } - - glBegin(GL_LINE_STRIP); - glVertex2f(X, -Sound[NrSound].BufferArray[1] / $10000 * H + Y + H/2); - for Pet := 2 to Sound[NrSound].n div 1 do begin - glVertex2f(X + (Pet-1) * W / (Sound[NrSound].n - 1), - -Sound[NrSound].BufferArray[Pet] / $10000 * H + Y + H/2); - end; - glEnd; -end; - -procedure SingDrawNoteLines(Left, Top, Right: real; Space: integer); -var - Pet: integer; -begin - glEnable(GL_BLEND); - glColor4f(Skin_P1_LinesR, Skin_P1_LinesG, Skin_P1_LinesB, 0.4); - glBegin(GL_LINES); - for Pet := 0 to 9 do begin - glVertex2f(Left, Top + Pet * Space); - glVertex2f(Right, Top + Pet * Space); - end; - glEnd; - glDisable(GL_BLEND); -end; - -procedure SingDrawBeatDelimeters(Left, Top, Right: real; NrCzesci: integer); -var - Pet: integer; - TempR: real; -begin - TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); - glEnable(GL_BLEND); - glBegin(GL_LINES); - for Pet := Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote to Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec do begin - if (Pet mod Czesci[NrCzesci].Resolution) = Czesci[NrCzesci].NotesGAP then - glColor4f(0, 0, 0, 1) - else - glColor4f(0, 0, 0, 0.3); - glVertex2f(Left + TempR * (Pet - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote), Top); - glVertex2f(Left + TempR * (Pet - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote), Top + 135); - end; - glEnd; - glDisable(GL_BLEND); -end; - -// draw blank Notebars -procedure SingDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); -var - Rec: TRecR; - Pet: integer; - TempR: real; - R,G,B: real; - - PlayerNumber: Integer; - - GoldenStarPos : real; - - lTmpA , - lTmpB : real; -begin -// We actually don't have a playernumber in this procedure, it should reside in NrCzesci - but it's always set to zero -// So we exploit this behavior a bit - we give NrCzesci the playernumber, keep it in playernumber - and then we set NrCzesci to zero -// This could also come quite in handy when we do the duet mode, cause just the notes for the player that has to sing should be drawn then -// BUT this is not implemented yet, all notes are drawn! :D - - PlayerNumber := NrCzesci + 1; // Player 1 is 0 - NrCzesci := 0; - -// exploit done - - glColor3f(1, 1, 1); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - lTmpA := (Right-Left); - lTmpB := (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); - - {$IFDEF FPC} -(* - writeln( 'UDRAW (Right-Left) : ' + floattostr( lTmpA ) ); - writeln( 'UDRAW : ' + floattostr( lTmpB ) ); - writeln( '' ); -*) - {$ENDIF} - - if ( lTmpA > 0 ) AND - ( lTmpB > 0 ) THEN - begin - TempR := lTmpA / lTmpB; - end - else - begin - TempR := 0; - end; - - - with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin - for Pet := 0 to HighNut do begin - with Nuta[Pet] do begin - if not FreeStyle then begin - - - if Ini.EffectSing = 0 then - // If Golden note Effect of then Change not Color - begin - case Wartosc of - 1: glColor4f(1, 1, 1, 1); // We set alpha to 1, cause we can control the transparency through the png itself - 2: glColor4f(1, 1, 0.3, 1); // no stars, paint yellow -> glColor4f(1, 1, 0.3, 0.85); - we could - end; // case - end //Else all Notes same Color - else - glColor4f(1, 1, 1, 1); // We set alpha to 1, cause we can control the transparency through the png itself - // Czesci == teil, element == piece, element | koniec == ende, schluss - // lewa czesc - left part - Rec.Left := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX; - Rec.Right := Rec.Left + NotesW; - Rec.Top := Top - (Ton-BaseNote)*Space/2 - NotesH; - Rec.Bottom := Rec.Top + 2 * NotesH; - glBindTexture(GL_TEXTURE_2D, Tex_plain_Left[PlayerNumber].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - //We keep the postion of the top left corner b4 it's overwritten - GoldenStarPos := Rec.Left; - //done - - // srodkowa czesc - middle part - Rec.Left := Rec.Right; - Rec.Right := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - NotesW - 0.5 + 10*ScreenX; // Dlugosc == länge - - glBindTexture(GL_TEXTURE_2D, Tex_plain_Mid[PlayerNumber].TexNum); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(round((Rec.Right-Rec.Left)/32), 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(round((Rec.Right-Rec.Left)/32), 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - // prawa czesc - right part - Rec.Left := Rec.Right; - Rec.Right := Rec.Right + NotesW; - - glBindTexture(GL_TEXTURE_2D, Tex_plain_Right[PlayerNumber].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - // Golden Star Patch - if (Wartosc = 2) AND (Ini.EffectSing=1) then - begin - GoldenRec.SaveGoldenStarsRec(GoldenStarPos, Rec.Top, Rec.Right, Rec.Bottom); - end; - - end; // if not FreeStyle - end; // with - end; // for - end; // with - - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); -end; - - -// draw sung notes -procedure SingDrawPlayerCzesc(X, Y, W: real; NrGracza: integer; Space: integer); -var - TempR: real; - Rec: TRecR; - N: integer; - R: real; - G: real; - B: real; - A: real; - NotesH2: real; - begin -// Log.LogStatus('Player notes', 'SingDraw'); - -// if NrGracza = 0 then LoadColor(R, G, B, 'P1Light') -// else LoadColor(R, G, B, 'P2Light'); - -// R := 71/255; -// G := 175/255; -// B := 247/255; - - glColor3f(1, 1, 1); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - if Player[NrGracza].IlNut > 0 then - begin - TempR := W / (Czesci[0].Czesc[Czesci[0].Akt].Koniec - Czesci[0].Czesc[Czesci[0].Akt].StartNote); - for N := 0 to Player[NrGracza].HighNut do - begin - with Player[NrGracza].Nuta[N] do - begin - // Left part of note - Rec.Left := X + (Start-Czesci[0].Czesc[Czesci[0].Akt].StartNote) * TempR + 0.5 + 10*ScreenX; - Rec.Right := Rec.Left + NotesW; - - // Draw it in half size, if not hit - if Hit then - begin - NotesH2 := NotesH - end - else - begin - NotesH2 := int(NotesH * 0.65); - end; - - Rec.Top := Y - (Ton-Czesci[0].Czesc[Czesci[0].Akt].BaseNote)*Space/2 - NotesH2; - Rec.Bottom := Rec.Top + 2 *NotesH2; - - // draw the left part - glColor3f(1, 1, 1); - glBindTexture(GL_TEXTURE_2D, Tex_Left[NrGracza+1].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - // Middle part of the note - Rec.Left := Rec.Right; - Rec.Right := X + (Start+Dlugosc-Czesci[0].Czesc[Czesci[0].Akt].StartNote) * TempR - NotesW - 0.5 + 10*ScreenX; - - // (nowe) - dunno - if (Start+Dlugosc-1 = Czas.AktBeatD) then - Rec.Right := Rec.Right - (1-Frac(Czas.MidBeatD)) * TempR; - // the left note is more right than the right note itself, sounds weird - so we fix that xD - if Rec.Right <= Rec.Left then Rec.Right := Rec.Left; - - // draw the middle part - glBindTexture(GL_TEXTURE_2D, Tex_Mid[NrGracza+1].TexNum); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(round((Rec.Right-Rec.Left)/32), 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(round((Rec.Right-Rec.Left)/32), 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - glColor3f(1, 1, 1); - - // the right part of the note - Rec.Left := Rec.Right; - Rec.Right := Rec.Right + NotesW; - - glBindTexture(GL_TEXTURE_2D, Tex_Right[NrGracza+1].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - // Perfect note is stored - if Perfect and (Ini.EffectSing=1) then - begin - A := 1 - 2*(Czas.Teraz - GetTimeFromBeat(Start+Dlugosc)); - if not (Start+Dlugosc-1 = Czas.AktBeatD) then - - //Star animation counter - //inc(Starfr); - //Starfr := Starfr mod 128; - GoldenRec.SavePerfectNotePos(Rec.Left, Rec.Top); - end; - end; // with - end; // for - // eigentlich brauchen wir hier einen vergleich, um festzustellen, ob wir mit - // singen schon weiter wären, als bei Rec.Right, _auch, wenn nicht gesungen wird_ - - // passing on NrGracza... hope this is really something like the player-number, not only - // some kind of weird index into a colour-table - - if (Ini.EffectSing=1) then - GoldenRec.GoldenNoteTwinkle(Rec.Top,Rec.Bottom,Rec.Right, NrGracza); - end; // if -end; - -//draw Note glow -procedure SingDrawPlayerBGCzesc(Left, Top, Right: real; NrCzesci, NrGracza: integer; Space: integer); -var - Rec: TRecR; - Pet: integer; - TempR: real; - R,G,B: real; - X1, X2, X3, X4: real; - W, H: real; - - lTmpA , - lTmpB : real; -begin - if (Player[NrGracza].ScoreTotalI >= 0) then begin - glColor4f(1, 1, 1, sqrt((1+sin( AudioPlayback.Position * 3))/4)/ 2 + 0.5 ); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - - lTmpA := (Right-Left); - lTmpB := (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); - - {$IFDEF FPC} -{* - writeln( 'UDRAW (Right-Left) : ' + floattostr( lTmpA ) ); - writeln( 'UDRAW : ' + floattostr( lTmpB ) ); - writeln( '' ); -*} - {$ENDIF} - - if ( lTmpA > 0 ) AND - ( lTmpB > 0 ) THEN - begin - TempR := lTmpA / lTmpB; - end - else - begin - TempR := 0; - end; - - with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin - for Pet := 0 to HighNut do begin - with Nuta[Pet] do begin - if not FreeStyle then begin - // begin: 14, 20 - // easy: 6, 11 - W := NotesW * 2 + 2; - H := NotesH * 1.5 + 3.5; - - X2 := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX + 4; // wciecie - X1 := X2-W; - - X3 := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - 0.5 + 10*ScreenX - 4; // wciecie - X4 := X3+W; - - // left - Rec.Left := X1; - Rec.Right := X2; - Rec.Top := Top - (Ton-BaseNote)*Space/2 - H; - Rec.Bottom := Rec.Top + 2 * H; - - glBindTexture(GL_TEXTURE_2D, Tex_BG_Left[NrGracza+1].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - - // srodkowa czesc - Rec.Left := X2; - Rec.Right := X3; - - glBindTexture(GL_TEXTURE_2D, Tex_BG_Mid[NrGracza+1].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - // prawa czesc - Rec.Left := X3; - Rec.Right := X4; - - glBindTexture(GL_TEXTURE_2D, Tex_BG_Right[NrGracza+1].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - end; // if not FreeStyle - end; // with - end; // for - end; // with - - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - end; -end; - -procedure SingDraw; -var - Pet: integer; - Pet2: integer; - TempR: real; - Rec: TRecR; - TexRec: TRecR; - NR: TRecR; - FS: real; - BarFrom: integer; - BarAlpha: real; - BarWspol: real; - TempCol: real; - Tekst: string; - PetCz: integer; - -begin - // positions - if Ini.SingWindow = 0 then begin - NR.Left := 120; - end else begin - NR.Left := 20; - end; - NR.Right := 780; - - NR.Width := NR.Right - NR.Left; - NR.WMid := NR.Width / 2; - NR.Mid := NR.Left + NR.WMid; - - // background //BG Fullsize Mod - //SingDrawBackground; - - //TimeBar mod - SingDrawTimeBar(); - //eoa TimeBar mod - - // rysuje paski pod nutami - if PlayersPlay = 1 then - SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); - if (PlayersPlay = 2) or (PlayersPlay = 4) then begin - SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P1_NotesB - 105, Nr.Right + 10*ScreenX, 15); - SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); - end; - - if (PlayersPlay = 3) or (PlayersPlay = 6) then begin - SingDrawNoteLines(Nr.Left + 10*ScreenX, 120, Nr.Right + 10*ScreenX, 12); - SingDrawNoteLines(Nr.Left + 10*ScreenX, 245, Nr.Right + 10*ScreenX, 12); - SingDrawNoteLines(Nr.Left + 10*ScreenX, 370, Nr.Right + 10*ScreenX, 12); - end; - - // Draw Lyrics - ScreenSing.Lyrics.Draw(Czas.MidBeat); - - // todo: Lyrics -{ // rysuje pasek, podpowiadajacy poczatek spiwania w scenie - FS := 1.3; - BarFrom := Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start; - if BarFrom > 40 then BarFrom := 40; - if (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start > 8) and // dluga przerwa //16->12 for more help bars and then 12->8 for even more - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat > 0) and // przed tekstem - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat < 40) then begin // ale nie za wczesnie - BarWspol := (Czas.MidBeat - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - BarFrom)) / BarFrom; - Rec.Left := NR.Left + BarWspol * -// (NR.WMid - Czesci[0].Czesc[Czesci[0].Akt].LyricWidth / 2 * FS - 50); - (ScreenSing.LyricMain.ClientX - NR.Left - 50) + 10*ScreenX; - Rec.Right := Rec.Left + 50; - Rec.Top := Skin_LyricsT + 3; - Rec.Bottom := Rec.Top + 33;//SingScreen.LyricMain.Size * 3; -{ // zapalanie - BarAlpha := (BarWspol*10) * 0.5; - if BarAlpha > 0.5 then BarAlpha := 0.5; - - // gaszenie - if BarWspol > 0.95 then BarAlpha := 0.5 * (1 - (BarWspol - 0.95) * 20);}{ - - //Change fuer Crazy Joker - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, Tex_Lyric_Help_Bar.TexNum); - glBegin(GL_QUADS); - glColor4f(1, 1, 1, 0); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glColor4f(1, 1, 1, 0.5); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - glDisable(GL_BLEND); - - end; } - - // oscilloscope - if Ini.Oscilloscope = 1 then begin - if PlayersPlay = 1 then - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - - if PlayersPlay = 2 then begin - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); - end; - if ScreenAct = 2 then begin - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 2); - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 3); - end; - end; - - if PlayersPlay = 3 then begin - SingDrawOscilloscope(75 + 10*ScreenX, 95, 100, 20, 0); - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 0); - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); - end; - if ScreenAct = 2 then begin - SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 3); - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 4); - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 5); - end; - end; - - end; - -// Set the note heights according to the difficulty level - case Ini.Difficulty of - 0: - begin - NotesH := 11; // 9 - NotesW := 6; // 5 - end; - 1: - begin - NotesH := 8; // 7 - NotesW := 4; // 4 - end; - 2: - begin - NotesH := 5; - NotesW := 3; - end; - end; - -// Draw the Notes - if PlayersPlay = 1 then begin - SingDrawPlayerBGCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 0, 15); // Background glow - colorized in playercolor - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); // Plain unsung notes - colorized in playercolor - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 0, 15); // imho the sung notes - end; - - if (PlayersPlay = 2) then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); - - SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 1, 15); - - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); - end; - - if PlayersPlay = 3 then begin - NotesW := NotesW * 0.8; - NotesH := NotesH * 0.8; - - SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); - - SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); - SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 1, 12); - SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 2, 12); - - SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); - end; - if ScreenAct = 2 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 2, 15); - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 3, 15); - end; - - if ScreenAct = 1 then begin - SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 1, 15); - end; - if ScreenAct = 2 then begin - SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 2, 15); - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 3, 15); - end; - - if ScreenAct = 1 then begin - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); - end; - if ScreenAct = 2 then begin - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 2, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 3, 15); - end; - end; - - if PlayersPlay = 6 then begin - NotesW := NotesW * 0.8; - NotesH := NotesH * 0.8; - - if ScreenAct = 1 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); - end; - if ScreenAct = 2 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 3, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 4, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 5, 12); - end; - - if ScreenAct = 1 then begin - SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); - SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 1, 12); - SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 2, 12); - end; - if ScreenAct = 2 then begin - SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 3, 12); - SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 4, 12); - SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 5, 12); - end; - - if ScreenAct = 1 then begin - SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); - end; - if ScreenAct = 2 then begin - SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 3, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 4, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 5, 12); - end; - end; - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); -end; - -// q'n'd for using the game mode dll's -procedure SingModiDraw (PlayerInfo: TPlayerInfo); -var - Pet: integer; - Pet2: integer; - TempR: real; - Rec: TRecR; - TexRec: TRecR; - NR: TRecR; - FS: real; - BarFrom: integer; - BarAlpha: real; - BarWspol: real; - TempCol: real; - Tekst: string; - PetCz: integer; -begin - // positions - if Ini.SingWindow = 0 then begin - NR.Left := 120; - end else begin - NR.Left := 20; - end; - - NR.Right := 780; - NR.Width := NR.Right - NR.Left; - NR.WMid := NR.Width / 2; - NR.Mid := NR.Left + NR.WMid; - - // time bar - SingDrawTimeBar(); - - if DLLMan.Selected.ShowNotes then - begin - if PlayersPlay = 1 then - SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); - if (PlayersPlay = 2) or (PlayersPlay = 4) then begin - SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P1_NotesB - 105, Nr.Right + 10*ScreenX, 15); - SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); - end; - - if (PlayersPlay = 3) or (PlayersPlay = 6) then begin - SingDrawNoteLines(Nr.Left + 10*ScreenX, 120, Nr.Right + 10*ScreenX, 12); - SingDrawNoteLines(Nr.Left + 10*ScreenX, 245, Nr.Right + 10*ScreenX, 12); - SingDrawNoteLines(Nr.Left + 10*ScreenX, 370, Nr.Right + 10*ScreenX, 12); - end; - end; - - // Draw Lyrics - ScreenSingModi.Lyrics.Draw(Czas.MidBeat); - - // todo: Lyrics -{ // rysuje pasek, podpowiadajacy poczatek spiwania w scenie - FS := 1.3; - BarFrom := Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start; - if BarFrom > 40 then BarFrom := 40; - if (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start > 8) and // dluga przerwa //16->12 for more help bars and then 12->8 for even more - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat > 0) and // przed tekstem - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat < 40) then begin // ale nie za wczesnie - BarWspol := (Czas.MidBeat - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - BarFrom)) / BarFrom; - Rec.Left := NR.Left + BarWspol * (ScreenSingModi.LyricMain.ClientX - NR.Left - 50) + 10*ScreenX; - Rec.Right := Rec.Left + 50; - Rec.Top := Skin_LyricsT + 3; - Rec.Bottom := Rec.Top + 33;//SingScreen.LyricMain.Size * 3; - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, Tex_Lyric_Help_Bar.TexNum); - glBegin(GL_QUADS); - glColor4f(1, 1, 1, 0); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glColor4f(1, 1, 1, 0.5); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - glDisable(GL_BLEND); - end; - } - - // oscilloscope | the thing that moves when you yell into your mic (imho) - if (((Ini.Oscilloscope = 1) AND (DLLMan.Selected.ShowRateBar_O)) AND (NOT DLLMan.Selected.ShowRateBar)) then begin - if PlayersPlay = 1 then - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - - if PlayersPlay = 2 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); - end; - if ScreenAct = 2 then begin - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 2); - if PlayerInfo.Playerinfo[3].Enabled then - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 3); - end; - end; - - if PlayersPlay = 3 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawOscilloscope(75 + 10*ScreenX, 95, 100, 20, 0); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - if PlayerInfo.Playerinfo[0].Enabled then - SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 0); - if PlayerInfo.Playerinfo[1].Enabled then - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); - if PlayerInfo.Playerinfo[2].Enabled then - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); - end; - if ScreenAct = 2 then begin - if PlayerInfo.Playerinfo[3].Enabled then - SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 3); - if PlayerInfo.Playerinfo[4].Enabled then - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 4); - if PlayerInfo.Playerinfo[5].Enabled then - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 5); - end; - end; - - end; - -// resize the notes according to the difficulty level - case Ini.Difficulty of - 0: - begin - NotesH := 11; // 9 - NotesW := 6; // 5 - end; - 1: - begin - NotesH := 8; // 7 - NotesW := 4; // 4 - end; - 2: - begin - NotesH := 5; - NotesW := 3; - end; - end; - - if (DLLMAn.Selected.ShowNotes And DLLMan.Selected.LoadSong) then - begin - if (PlayersPlay = 1) And PlayerInfo.Playerinfo[0].Enabled then begin - SingDrawPlayerBGCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 0, 15); - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 0, 15); - end; - - if (PlayersPlay = 2) then begin - if PlayerInfo.Playerinfo[0].Enabled then - begin - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); - SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); - end; - if PlayerInfo.Playerinfo[1].Enabled then - begin - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); - end; - - end; - - if PlayersPlay = 3 then begin - NotesW := NotesW * 0.8; - NotesH := NotesH * 0.8; - - if PlayerInfo.Playerinfo[0].Enabled then - begin - SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); - SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); - end; - - if PlayerInfo.Playerinfo[1].Enabled then - begin - SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); - SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 0, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); - end; - - if PlayerInfo.Playerinfo[2].Enabled then - begin - SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); - SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 0, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); - end; - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); - end; - if ScreenAct = 2 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 2, 15); - SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 3, 15); - end; - - SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); - SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); - - if ScreenAct = 1 then begin - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); - end; - if ScreenAct = 2 then begin - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 2, 15); - SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 3, 15); - end; - end; - - if PlayersPlay = 6 then begin - NotesW := NotesW * 0.8; - NotesH := NotesH * 0.8; - - if ScreenAct = 1 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); - end; - if ScreenAct = 2 then begin - SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 3, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 4, 12); - SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 5, 12); - end; - - SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); - SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 0, 12); - SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 0, 12); - - if ScreenAct = 1 then begin - SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); - end; - if ScreenAct = 2 then begin - SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 3, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 4, 12); - SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 5, 12); - end; - end; - end; - - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); -end; - - -{//SingBar Mod -procedure SingDrawSingbar(X, Y, W, H: real; Percent: integer); -var - R: Real; - G: Real; - B: Real; - A: cardinal; - I: Integer; - -begin; - - //SingBar Background - glColor4f(1, 1, 1, 0.8); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Back.TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(X, Y); - glTexCoord2f(0, 1); glVertex2f(X, Y+H); - glTexCoord2f(1, 1); glVertex2f(X+W, Y+H); - glTexCoord2f(1, 0); glVertex2f(X+W, Y); - glEnd; - - //SingBar coloured Bar - Case Percent of - 0..22: begin - R := 1; - G := 0; - B := 0; - end; - 23..42: begin - R := 1; - G := ((Percent-23)/100)*5; - B := 0; - end; - 43..57: begin - R := 1; - G := 1; - B := 0; - end; - 58..77: begin - R := 1-(Percent - 58)/100*5; - G := 1; - B := 0; - end; - 78..99: begin - R := 0; - G := 1; - B := 0; - end; - End; //Case - - glColor4f(R, G, B, 1); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Bar.TexNum); - //Size= Player[PlayerNum].ScorePercent of W - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(X, Y); - glTexCoord2f(0, 1); glVertex2f(X, Y+H); - glTexCoord2f(1, 1); glVertex2f(X+(W/100 * (Percent +1)), Y+H); - glTexCoord2f(1, 0); glVertex2f(X+(W/100 * (Percent +1)), Y); - glEnd; - - //SingBar Front - glColor4f(1, 1, 1, 0.6); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Front.TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(X, Y); - glTexCoord2f(0, 1); glVertex2f(X, Y+H); - glTexCoord2f(1, 1); glVertex2f(X+W, Y+H); - glTexCoord2f(1, 0); glVertex2f(X+W, Y); - glEnd; -end; -//end Singbar Mod - -//PhrasenBonus - Line Bonus Pop Up -procedure SingDrawLineBonus( const X, Y: Single; Color: TRGB; Alpha: Single; Text: string; Age: Integer); -var -Length, X2: Real; //Length of Text -Size: Integer; //Size of Popup -begin -if Alpha <> 0 then -begin - -//Set Font Propertys -SetFontStyle(2); //Font: Outlined1 -if Age < 5 then SetFontSize(Age + 1) else SetFontSize(6); -SetFontItalic(False); - -//Check Font Size -Length := glTextWidth ( PChar(Text)) + 3; //Little Space for a Better Look ^^ - -//Text -SetFontPos (X + 50 - (Length / 2), Y + 12); //Position - - -if Age < 5 then Size := Age * 10 else Size := 50; - - //Draw Background - //glColor4f(Color.R, Color.G, Color.B, Alpha); //Set Color - glColor4f(1, 1, 1, Alpha); - - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - - //New Method, Not Variable - glBindTexture(GL_TEXTURE_2D, Tex_SingLineBonusBack[2].TexNum); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(X + 50 - Size, Y + 25 - (Size/2)); - glTexCoord2f(0, 1); glVertex2f(X + 50 - Size, Y + 25 + (Size/2)); - glTexCoord2f(1, 1); glVertex2f(X + 50 + Size, Y + 25 + (Size/2)); - glTexCoord2f(1, 0); glVertex2f(X + 50 + Size, Y + 25 - (Size/2)); - glEnd; - - glColor4f(1, 1, 1, Alpha); //Set Color - //Draw Text - glPrint (PChar(Text)); -end; -end; -//PhrasenBonus - Line Bonus Mod} - -// Draw Note Bars for Editor -//There are 11 Resons for a new Procdedure: -// 1. It don't look good when you Draw the Golden Note Star Effect in the Editor -// 2. You can see the Freestyle Notes in the Editor SemiTransparent -// 3. Its easier and Faster then changing the old Procedure -procedure EditDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); -var - Rec: TRecR; - Pet: integer; - TempR: real; -begin - glColor3f(1, 1, 1); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); - with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin - for Pet := 0 to HighNut do begin - with Nuta[Pet] do begin - - // Golden Note Patch - case Wartosc of - 0: glColor4f(1, 1, 1, 0.35); - 1: glColor4f(1, 1, 1, 0.85); - 2: glColor4f(1, 1, 0.3, 0.85); - end; // case - - - - // lewa czesc - left part - Rec.Left := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX; - Rec.Right := Rec.Left + NotesW; - Rec.Top := Top - (Ton-BaseNote)*Space/2 - NotesH; - Rec.Bottom := Rec.Top + 2 * NotesH; - glBindTexture(GL_TEXTURE_2D, Tex_Left[Color].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - // srodkowa czesc - middle part - Rec.Left := Rec.Right; - Rec.Right := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - NotesW - 0.5 + 10*ScreenX; - - glBindTexture(GL_TEXTURE_2D, Tex_Mid[Color].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - // prawa czesc - right part - Rec.Left := Rec.Right; - Rec.Right := Rec.Right + NotesW; - - glBindTexture(GL_TEXTURE_2D, Tex_Right[Color].TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); - glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); - glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); - glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); - glEnd; - - end; // with - end; // for - end; // with - - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); -end; - -procedure SingDrawTimeBar(); -var x,y: real; - width, height: real; -begin - x := Theme.Sing.StaticTimeProgress.x; - y := Theme.Sing.StaticTimeProgress.y; - width:= Theme.Sing.StaticTimeProgress.w; - height:= Theme.Sing.StaticTimeProgress.h; - - glColor4f(Theme.Sing.StaticTimeProgress.ColR, - Theme.Sing.StaticTimeProgress.ColG, - Theme.Sing.StaticTimeProgress.ColB, 1); //Set Color - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - - glBindTexture(GL_TEXTURE_2D, Tex_TimeProgress.TexNum); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(x,y); - glTexCoord2f((width*(Czas.Teraz/Czas.Razem))/8, 0); glVertex2f(x+width*(Czas.Teraz/Czas.Razem), y); - glTexCoord2f((width*(Czas.Teraz/Czas.Razem))/8, 1); glVertex2f(x+width*(Czas.Teraz/Czas.Razem), y+height); - glTexCoord2f(0, 1); glVertex2f(x, y+height); - glEnd; - - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glcolor4f(1,1,1,1); -end; - -end. - +unit UDraw; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses UThemes, + ModiSDK, + UGraphicClasses; + +procedure SingDraw; +procedure SingModiDraw (PlayerInfo: TPlayerInfo); +procedure SingDrawBackground; +procedure SingDrawOscilloscope(X, Y, W, H: real; NrSound: integer); +procedure SingDrawNoteLines(Left, Top, Right: real; Space: integer); +procedure SingDrawBeatDelimeters(Left, Top, Right: real; NrCzesci: integer); +procedure SingDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); +procedure SingDrawPlayerCzesc(X, Y, W: real; NrGracza: integer; Space: integer); +procedure SingDrawPlayerBGCzesc(Left, Top, Right: real; NrCzesci, NrGracza: integer; Space: integer); + +// TimeBar +procedure SingDrawTimeBar(); + +//Draw Editor NoteLines +procedure EditDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); + + +type + TRecR = record + Top: real; + Left: real; + Right: real; + Bottom: real; + + Width: real; + WMid: real; + Height: real; + HMid: real; + + Mid: real; + end; + +var + NotesW: real; + NotesH: real; + Starfr: integer; + StarfrG: integer; + + //SingBar + TickOld: cardinal; + TickOld2:cardinal; + +const + Przedz = 32; + +implementation + +uses {$IFDEF Win32} + windows, + {$ELSE} + lclintf, + {$ENDIF} + OpenGL12, + UGraphic, + SysUtils, + UMusic, + URecord, + ULog, + UScreenSing, + UScreenSingModi, + ULyrics, + UMain, + TextGL, + UTexture, + UDrawTexture, + UIni, + Math, + UDLLManager; + +procedure SingDrawBackground; +var + Rec: TRecR; + TexRec: TRecR; +begin + if ScreenSing.Tex_Background.TexNum >= 1 then begin + + glClearColor (1, 1, 1, 1); + glColor4f (1, 1, 1, 1); + + 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) * ScreenSing.Tex_Background.TexH; + TexRec.Bottom := (Rec.Bottom / 600) * ScreenSing.Tex_Background.TexH; + TexRec.Left := 0; + TexRec.Right := ScreenSing.Tex_Background.TexW; + + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, ScreenSing.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) * ScreenSing.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) * ScreenSing.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, ScreenSing.Tex_Background.TexNum); + //glEnable(GL_BLEND); + glBegin(GL_QUADS); + + glTexCoord2f(0, 0); glVertex2f(0, 0); + glTexCoord2f(0, ScreenSing.Tex_Background.TexH); glVertex2f(0, 600); + glTexCoord2f( ScreenSing.Tex_Background.TexW, ScreenSing.Tex_Background.TexH); glVertex2f(800, 600); + glTexCoord2f( ScreenSing.Tex_Background.TexW, 0); glVertex2f(800, 0); + + glEnd; + glDisable(GL_TEXTURE_2D); + //glDisable(GL_BLEND); + end; + end; +end; + +procedure SingDrawOscilloscope(X, Y, W, H: real; NrSound: integer); +var + Pet: integer; +begin; +// Log.LogStatus('Oscilloscope', 'SingDraw'); + glColor3f(Skin_OscR, Skin_OscG, Skin_OscB); + {if (ParamStr(1) = '-black') or (ParamStr(1) = '-fsblack') then + glColor3f(1, 1, 1); } + + glBegin(GL_LINE_STRIP); + glVertex2f(X, -Sound[NrSound].BufferArray[1] / $10000 * H + Y + H/2); + for Pet := 2 to Sound[NrSound].n div 1 do begin + glVertex2f(X + (Pet-1) * W / (Sound[NrSound].n - 1), + -Sound[NrSound].BufferArray[Pet] / $10000 * H + Y + H/2); + end; + glEnd; +end; + +procedure SingDrawNoteLines(Left, Top, Right: real; Space: integer); +var + Pet: integer; +begin + glEnable(GL_BLEND); + glColor4f(Skin_P1_LinesR, Skin_P1_LinesG, Skin_P1_LinesB, 0.4); + glBegin(GL_LINES); + for Pet := 0 to 9 do begin + glVertex2f(Left, Top + Pet * Space); + glVertex2f(Right, Top + Pet * Space); + end; + glEnd; + glDisable(GL_BLEND); +end; + +procedure SingDrawBeatDelimeters(Left, Top, Right: real; NrCzesci: integer); +var + Pet: integer; + TempR: real; +begin + TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); + glEnable(GL_BLEND); + glBegin(GL_LINES); + for Pet := Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote to Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec do begin + if (Pet mod Czesci[NrCzesci].Resolution) = Czesci[NrCzesci].NotesGAP then + glColor4f(0, 0, 0, 1) + else + glColor4f(0, 0, 0, 0.3); + glVertex2f(Left + TempR * (Pet - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote), Top); + glVertex2f(Left + TempR * (Pet - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote), Top + 135); + end; + glEnd; + glDisable(GL_BLEND); +end; + +// draw blank Notebars +procedure SingDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); +var + Rec: TRecR; + Pet: integer; + TempR: real; + R,G,B: real; + + PlayerNumber: Integer; + + GoldenStarPos : real; + + lTmpA , + lTmpB : real; +begin +// We actually don't have a playernumber in this procedure, it should reside in NrCzesci - but it's always set to zero +// So we exploit this behavior a bit - we give NrCzesci the playernumber, keep it in playernumber - and then we set NrCzesci to zero +// This could also come quite in handy when we do the duet mode, cause just the notes for the player that has to sing should be drawn then +// BUT this is not implemented yet, all notes are drawn! :D + + PlayerNumber := NrCzesci + 1; // Player 1 is 0 + NrCzesci := 0; + +// exploit done + + glColor3f(1, 1, 1); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + lTmpA := (Right-Left); + lTmpB := (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); + + {$IFDEF FPC} +(* + writeln( 'UDRAW (Right-Left) : ' + floattostr( lTmpA ) ); + writeln( 'UDRAW : ' + floattostr( lTmpB ) ); + writeln( '' ); +*) + {$ENDIF} + + if ( lTmpA > 0 ) AND + ( lTmpB > 0 ) THEN + begin + TempR := lTmpA / lTmpB; + end + else + begin + TempR := 0; + end; + + + with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin + for Pet := 0 to HighNut do begin + with Nuta[Pet] do begin + if not FreeStyle then begin + + + if Ini.EffectSing = 0 then + // If Golden note Effect of then Change not Color + begin + case Wartosc of + 1: glColor4f(1, 1, 1, 1); // We set alpha to 1, cause we can control the transparency through the png itself + 2: glColor4f(1, 1, 0.3, 1); // no stars, paint yellow -> glColor4f(1, 1, 0.3, 0.85); - we could + end; // case + end //Else all Notes same Color + else + glColor4f(1, 1, 1, 1); // We set alpha to 1, cause we can control the transparency through the png itself + // Czesci == teil, element == piece, element | koniec == ende, schluss + // lewa czesc - left part + Rec.Left := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX; + Rec.Right := Rec.Left + NotesW; + Rec.Top := Top - (Ton-BaseNote)*Space/2 - NotesH; + Rec.Bottom := Rec.Top + 2 * NotesH; + glBindTexture(GL_TEXTURE_2D, Tex_plain_Left[PlayerNumber].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + //We keep the postion of the top left corner b4 it's overwritten + GoldenStarPos := Rec.Left; + //done + + // srodkowa czesc - middle part + Rec.Left := Rec.Right; + Rec.Right := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - NotesW - 0.5 + 10*ScreenX; // Dlugosc == länge + + glBindTexture(GL_TEXTURE_2D, Tex_plain_Mid[PlayerNumber].TexNum); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(round((Rec.Right-Rec.Left)/32), 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(round((Rec.Right-Rec.Left)/32), 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // prawa czesc - right part + Rec.Left := Rec.Right; + Rec.Right := Rec.Right + NotesW; + + glBindTexture(GL_TEXTURE_2D, Tex_plain_Right[PlayerNumber].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // Golden Star Patch + if (Wartosc = 2) AND (Ini.EffectSing=1) then + begin + GoldenRec.SaveGoldenStarsRec(GoldenStarPos, Rec.Top, Rec.Right, Rec.Bottom); + end; + + end; // if not FreeStyle + end; // with + end; // for + end; // with + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); +end; + + +// draw sung notes +procedure SingDrawPlayerCzesc(X, Y, W: real; NrGracza: integer; Space: integer); +var + TempR: real; + Rec: TRecR; + N: integer; + R: real; + G: real; + B: real; + A: real; + NotesH2: real; + begin +// Log.LogStatus('Player notes', 'SingDraw'); + +// if NrGracza = 0 then LoadColor(R, G, B, 'P1Light') +// else LoadColor(R, G, B, 'P2Light'); + +// R := 71/255; +// G := 175/255; +// B := 247/255; + + glColor3f(1, 1, 1); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + if Player[NrGracza].IlNut > 0 then + begin + TempR := W / (Czesci[0].Czesc[Czesci[0].Akt].Koniec - Czesci[0].Czesc[Czesci[0].Akt].StartNote); + for N := 0 to Player[NrGracza].HighNut do + begin + with Player[NrGracza].Nuta[N] do + begin + // Left part of note + Rec.Left := X + (Start-Czesci[0].Czesc[Czesci[0].Akt].StartNote) * TempR + 0.5 + 10*ScreenX; + Rec.Right := Rec.Left + NotesW; + + // Draw it in half size, if not hit + if Hit then + begin + NotesH2 := NotesH + end + else + begin + NotesH2 := int(NotesH * 0.65); + end; + + Rec.Top := Y - (Ton-Czesci[0].Czesc[Czesci[0].Akt].BaseNote)*Space/2 - NotesH2; + Rec.Bottom := Rec.Top + 2 *NotesH2; + + // draw the left part + glColor3f(1, 1, 1); + glBindTexture(GL_TEXTURE_2D, Tex_Left[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // Middle part of the note + Rec.Left := Rec.Right; + Rec.Right := X + (Start+Dlugosc-Czesci[0].Czesc[Czesci[0].Akt].StartNote) * TempR - NotesW - 0.5 + 10*ScreenX; + + // (nowe) - dunno + if (Start+Dlugosc-1 = Czas.AktBeatD) then + Rec.Right := Rec.Right - (1-Frac(Czas.MidBeatD)) * TempR; + // the left note is more right than the right note itself, sounds weird - so we fix that xD + if Rec.Right <= Rec.Left then Rec.Right := Rec.Left; + + // draw the middle part + glBindTexture(GL_TEXTURE_2D, Tex_Mid[NrGracza+1].TexNum); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(round((Rec.Right-Rec.Left)/32), 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(round((Rec.Right-Rec.Left)/32), 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + glColor3f(1, 1, 1); + + // the right part of the note + Rec.Left := Rec.Right; + Rec.Right := Rec.Right + NotesW; + + glBindTexture(GL_TEXTURE_2D, Tex_Right[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // Perfect note is stored + if Perfect and (Ini.EffectSing=1) then + begin + A := 1 - 2*(Czas.Teraz - GetTimeFromBeat(Start+Dlugosc)); + if not (Start+Dlugosc-1 = Czas.AktBeatD) then + + //Star animation counter + //inc(Starfr); + //Starfr := Starfr mod 128; + GoldenRec.SavePerfectNotePos(Rec.Left, Rec.Top); + end; + end; // with + end; // for + // eigentlich brauchen wir hier einen vergleich, um festzustellen, ob wir mit + // singen schon weiter wären, als bei Rec.Right, _auch, wenn nicht gesungen wird_ + + // passing on NrGracza... hope this is really something like the player-number, not only + // some kind of weird index into a colour-table + + if (Ini.EffectSing=1) then + GoldenRec.GoldenNoteTwinkle(Rec.Top,Rec.Bottom,Rec.Right, NrGracza); + end; // if +end; + +//draw Note glow +procedure SingDrawPlayerBGCzesc(Left, Top, Right: real; NrCzesci, NrGracza: integer; Space: integer); +var + Rec: TRecR; + Pet: integer; + TempR: real; + R,G,B: real; + X1, X2, X3, X4: real; + W, H: real; + + lTmpA , + lTmpB : real; +begin + if (Player[NrGracza].ScoreTotalI >= 0) then begin + glColor4f(1, 1, 1, sqrt((1+sin( AudioPlayback.Position * 3))/4)/ 2 + 0.5 ); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + + lTmpA := (Right-Left); + lTmpB := (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); + + {$IFDEF FPC} +{* + writeln( 'UDRAW (Right-Left) : ' + floattostr( lTmpA ) ); + writeln( 'UDRAW : ' + floattostr( lTmpB ) ); + writeln( '' ); +*} + {$ENDIF} + + if ( lTmpA > 0 ) AND + ( lTmpB > 0 ) THEN + begin + TempR := lTmpA / lTmpB; + end + else + begin + TempR := 0; + end; + + with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin + for Pet := 0 to HighNut do begin + with Nuta[Pet] do begin + if not FreeStyle then begin + // begin: 14, 20 + // easy: 6, 11 + W := NotesW * 2 + 2; + H := NotesH * 1.5 + 3.5; + + X2 := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX + 4; // wciecie + X1 := X2-W; + + X3 := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - 0.5 + 10*ScreenX - 4; // wciecie + X4 := X3+W; + + // left + Rec.Left := X1; + Rec.Right := X2; + Rec.Top := Top - (Ton-BaseNote)*Space/2 - H; + Rec.Bottom := Rec.Top + 2 * H; + + glBindTexture(GL_TEXTURE_2D, Tex_BG_Left[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + + // srodkowa czesc + Rec.Left := X2; + Rec.Right := X3; + + glBindTexture(GL_TEXTURE_2D, Tex_BG_Mid[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // prawa czesc + Rec.Left := X3; + Rec.Right := X4; + + glBindTexture(GL_TEXTURE_2D, Tex_BG_Right[NrGracza+1].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + end; // if not FreeStyle + end; // with + end; // for + end; // with + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + end; +end; + +procedure SingDraw; +var + Pet: integer; + Pet2: integer; + TempR: real; + Rec: TRecR; + TexRec: TRecR; + NR: TRecR; + FS: real; + BarFrom: integer; + BarAlpha: real; + BarWspol: real; + TempCol: real; + Tekst: string; + PetCz: integer; + +begin + // positions + if Ini.SingWindow = 0 then + begin + NR.Left := 120; + end + else + begin + NR.Left := 20; + end; + + NR.Right := 780; + + NR.Width := NR.Right - NR.Left; + NR.WMid := NR.Width / 2; + NR.Mid := NR.Left + NR.WMid; + + // background //BG Fullsize Mod + //SingDrawBackground; + + //TimeBar mod + SingDrawTimeBar(); + //eoa TimeBar mod + + // rysuje paski pod nutami + if PlayersPlay = 1 then + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); + + if (PlayersPlay = 2) or (PlayersPlay = 4) then + begin + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P1_NotesB - 105, Nr.Right + 10*ScreenX, 15); + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); + end; + + if (PlayersPlay = 3) or (PlayersPlay = 6) then begin + SingDrawNoteLines(Nr.Left + 10*ScreenX, 120, Nr.Right + 10*ScreenX, 12); + SingDrawNoteLines(Nr.Left + 10*ScreenX, 245, Nr.Right + 10*ScreenX, 12); + SingDrawNoteLines(Nr.Left + 10*ScreenX, 370, Nr.Right + 10*ScreenX, 12); + end; + + // Draw Lyrics + ScreenSing.Lyrics.Draw(Czas.MidBeat); + + // todo: Lyrics +{ // rysuje pasek, podpowiadajacy poczatek spiwania w scenie + FS := 1.3; + BarFrom := Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start; + if BarFrom > 40 then BarFrom := 40; + if (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start > 8) and // dluga przerwa //16->12 for more help bars and then 12->8 for even more + (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat > 0) and // przed tekstem + (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat < 40) then begin // ale nie za wczesnie + BarWspol := (Czas.MidBeat - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - BarFrom)) / BarFrom; + Rec.Left := NR.Left + BarWspol * +// (NR.WMid - Czesci[0].Czesc[Czesci[0].Akt].LyricWidth / 2 * FS - 50); + (ScreenSing.LyricMain.ClientX - NR.Left - 50) + 10*ScreenX; + Rec.Right := Rec.Left + 50; + Rec.Top := Skin_LyricsT + 3; + Rec.Bottom := Rec.Top + 33;//SingScreen.LyricMain.Size * 3; +{ // zapalanie + BarAlpha := (BarWspol*10) * 0.5; + if BarAlpha > 0.5 then BarAlpha := 0.5; + + // gaszenie + if BarWspol > 0.95 then BarAlpha := 0.5 * (1 - (BarWspol - 0.95) * 20);}{ + + //Change fuer Crazy Joker + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_Lyric_Help_Bar.TexNum); + glBegin(GL_QUADS); + glColor4f(1, 1, 1, 0); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glColor4f(1, 1, 1, 0.5); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + glDisable(GL_BLEND); + + end; } + + // oscilloscope + if Ini.Oscilloscope = 1 then begin + if PlayersPlay = 1 then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + + if PlayersPlay = 2 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + if ScreenAct = 2 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 2); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 3); + end; + end; + + if PlayersPlay = 3 then begin + SingDrawOscilloscope(75 + 10*ScreenX, 95, 100, 20, 0); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 0); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + if ScreenAct = 2 then begin + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 3); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 4); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 5); + end; + end; + + end; + +// Set the note heights according to the difficulty level + case Ini.Difficulty of + 0: + begin + NotesH := 11; // 9 + NotesW := 6; // 5 + end; + 1: + begin + NotesH := 8; // 7 + NotesW := 4; // 4 + end; + 2: + begin + NotesH := 5; + NotesW := 3; + end; + end; + +// Draw the Notes + if PlayersPlay = 1 then begin + SingDrawPlayerBGCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 0, 15); // Background glow - colorized in playercolor + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); // Plain unsung notes - colorized in playercolor + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 0, 15); // imho the sung notes + end; + + if (PlayersPlay = 2) then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); + + SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 1, 15); + + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); + end; + + if PlayersPlay = 3 then begin + NotesW := NotesW * 0.8; + NotesH := NotesH * 0.8; + + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); + + SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); + SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 1, 12); + SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 2, 12); + + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); + end; + if ScreenAct = 2 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 2, 15); + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 3, 15); + end; + + if ScreenAct = 1 then begin + SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 1, 15); + end; + if ScreenAct = 2 then begin + SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 2, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 3, 15); + end; + + if ScreenAct = 1 then begin + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); + end; + if ScreenAct = 2 then begin + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 2, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 3, 15); + end; + end; + + if PlayersPlay = 6 then begin + NotesW := NotesW * 0.8; + NotesH := NotesH * 0.8; + + if ScreenAct = 1 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); + end; + if ScreenAct = 2 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 3, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 4, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 5, 12); + end; + + if ScreenAct = 1 then begin + SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); + SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 1, 12); + SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 2, 12); + end; + if ScreenAct = 2 then begin + SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 3, 12); + SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 4, 12); + SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 5, 12); + end; + + if ScreenAct = 1 then begin + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); + end; + if ScreenAct = 2 then begin + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 3, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 4, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 5, 12); + end; + end; + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); +end; + +// q'n'd for using the game mode dll's +procedure SingModiDraw (PlayerInfo: TPlayerInfo); +var + Pet: integer; + Pet2: integer; + TempR: real; + Rec: TRecR; + TexRec: TRecR; + NR: TRecR; + FS: real; + BarFrom: integer; + BarAlpha: real; + BarWspol: real; + TempCol: real; + Tekst: string; + PetCz: integer; +begin + // positions + if Ini.SingWindow = 0 then begin + NR.Left := 120; + end else begin + NR.Left := 20; + end; + + NR.Right := 780; + NR.Width := NR.Right - NR.Left; + NR.WMid := NR.Width / 2; + NR.Mid := NR.Left + NR.WMid; + + // time bar + SingDrawTimeBar(); + + if DLLMan.Selected.ShowNotes then + begin + if PlayersPlay = 1 then + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); + if (PlayersPlay = 2) or (PlayersPlay = 4) then begin + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P1_NotesB - 105, Nr.Right + 10*ScreenX, 15); + SingDrawNoteLines(Nr.Left + 10*ScreenX, Skin_P2_NotesB - 105, Nr.Right + 10*ScreenX, 15); + end; + + if (PlayersPlay = 3) or (PlayersPlay = 6) then begin + SingDrawNoteLines(Nr.Left + 10*ScreenX, 120, Nr.Right + 10*ScreenX, 12); + SingDrawNoteLines(Nr.Left + 10*ScreenX, 245, Nr.Right + 10*ScreenX, 12); + SingDrawNoteLines(Nr.Left + 10*ScreenX, 370, Nr.Right + 10*ScreenX, 12); + end; + end; + + // Draw Lyrics + ScreenSingModi.Lyrics.Draw(Czas.MidBeat); + + // todo: Lyrics +{ // rysuje pasek, podpowiadajacy poczatek spiwania w scenie + FS := 1.3; + BarFrom := Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start; + if BarFrom > 40 then BarFrom := 40; + if (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start > 8) and // dluga przerwa //16->12 for more help bars and then 12->8 for even more + (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat > 0) and // przed tekstem + (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czas.MidBeat < 40) then begin // ale nie za wczesnie + BarWspol := (Czas.MidBeat - (Czesci[0].Czesc[Czesci[0].Akt].StartNote - BarFrom)) / BarFrom; + Rec.Left := NR.Left + BarWspol * (ScreenSingModi.LyricMain.ClientX - NR.Left - 50) + 10*ScreenX; + Rec.Right := Rec.Left + 50; + Rec.Top := Skin_LyricsT + 3; + Rec.Bottom := Rec.Top + 33;//SingScreen.LyricMain.Size * 3; + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_Lyric_Help_Bar.TexNum); + glBegin(GL_QUADS); + glColor4f(1, 1, 1, 0); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glColor4f(1, 1, 1, 0.5); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + glDisable(GL_BLEND); + end; + } + + // oscilloscope | the thing that moves when you yell into your mic (imho) + if (((Ini.Oscilloscope = 1) AND (DLLMan.Selected.ShowRateBar_O)) AND (NOT DLLMan.Selected.ShowRateBar)) then begin + if PlayersPlay = 1 then + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + + if PlayersPlay = 2 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + if ScreenAct = 2 then begin + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 2); + if PlayerInfo.Playerinfo[3].Enabled then + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 3); + end; + end; + + if PlayersPlay = 3 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawOscilloscope(75 + 10*ScreenX, 95, 100, 20, 0); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + if PlayerInfo.Playerinfo[0].Enabled then + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 0); + if PlayerInfo.Playerinfo[1].Enabled then + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + if PlayerInfo.Playerinfo[2].Enabled then + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + if ScreenAct = 2 then begin + if PlayerInfo.Playerinfo[3].Enabled then + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 3); + if PlayerInfo.Playerinfo[4].Enabled then + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 4); + if PlayerInfo.Playerinfo[5].Enabled then + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 5); + end; + end; + + end; + +// resize the notes according to the difficulty level + case Ini.Difficulty of + 0: + begin + NotesH := 11; // 9 + NotesW := 6; // 5 + end; + 1: + begin + NotesH := 8; // 7 + NotesW := 4; // 4 + end; + 2: + begin + NotesH := 5; + NotesW := 3; + end; + end; + + if (DLLMAn.Selected.ShowNotes And DLLMan.Selected.LoadSong) then + begin + if (PlayersPlay = 1) And PlayerInfo.Playerinfo[0].Enabled then begin + SingDrawPlayerBGCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 0, 15); + end; + + if (PlayersPlay = 2) then begin + if PlayerInfo.Playerinfo[0].Enabled then + begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); + end; + if PlayerInfo.Playerinfo[1].Enabled then + begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); + end; + + end; + + if PlayersPlay = 3 then begin + NotesW := NotesW * 0.8; + NotesH := NotesH * 0.8; + + if PlayerInfo.Playerinfo[0].Enabled then + begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); + SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); + end; + + if PlayerInfo.Playerinfo[1].Enabled then + begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); + SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); + end; + + if PlayerInfo.Playerinfo[2].Enabled then + begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); + SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); + end; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 0, 15); + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 1, 15); + end; + if ScreenAct = 2 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Right - 20, 0, 2, 15); + SingDrawPlayerBGCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Right - 20, 0, 3, 15); + end; + + SingDrawCzesc(NR.Left + 20, Skin_P1_NotesB, NR.Right - 20, 0, 15); + SingDrawCzesc(NR.Left + 20, Skin_P2_NotesB, NR.Right - 20, 0, 15); + + if ScreenAct = 1 then begin + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 15); + end; + if ScreenAct = 2 then begin + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 2, 15); + SingDrawPlayerCzesc(Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 3, 15); + end; + end; + + if PlayersPlay = 6 then begin + NotesW := NotesW * 0.8; + NotesH := NotesH * 0.8; + + if ScreenAct = 1 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 0, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 1, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 2, 12); + end; + if ScreenAct = 2 then begin + SingDrawPlayerBGCzesc(Nr.Left + 20, 120+95, Nr.Right - 20, 0, 3, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 245+95, Nr.Right - 20, 0, 4, 12); + SingDrawPlayerBGCzesc(Nr.Left + 20, 370+95, Nr.Right - 20, 0, 5, 12); + end; + + SingDrawCzesc(NR.Left + 20, 120+95, NR.Right - 20, 0, 12); + SingDrawCzesc(NR.Left + 20, 245+95, NR.Right - 20, 0, 12); + SingDrawCzesc(NR.Left + 20, 370+95, NR.Right - 20, 0, 12); + + if ScreenAct = 1 then begin + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 0, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 1, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 2, 12); + end; + if ScreenAct = 2 then begin + SingDrawPlayerCzesc(Nr.Left + 20, 120+95, Nr.Width - 40, 3, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 245+95, Nr.Width - 40, 4, 12); + SingDrawPlayerCzesc(Nr.Left + 20, 370+95, Nr.Width - 40, 5, 12); + end; + end; + end; + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); +end; + + +{//SingBar Mod +procedure SingDrawSingbar(X, Y, W, H: real; Percent: integer); +var + R: Real; + G: Real; + B: Real; + A: cardinal; + I: Integer; + +begin; + + //SingBar Background + glColor4f(1, 1, 1, 0.8); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Back.TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(X, Y); + glTexCoord2f(0, 1); glVertex2f(X, Y+H); + glTexCoord2f(1, 1); glVertex2f(X+W, Y+H); + glTexCoord2f(1, 0); glVertex2f(X+W, Y); + glEnd; + + //SingBar coloured Bar + Case Percent of + 0..22: begin + R := 1; + G := 0; + B := 0; + end; + 23..42: begin + R := 1; + G := ((Percent-23)/100)*5; + B := 0; + end; + 43..57: begin + R := 1; + G := 1; + B := 0; + end; + 58..77: begin + R := 1-(Percent - 58)/100*5; + G := 1; + B := 0; + end; + 78..99: begin + R := 0; + G := 1; + B := 0; + end; + End; //Case + + glColor4f(R, G, B, 1); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Bar.TexNum); + //Size= Player[PlayerNum].ScorePercent of W + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(X, Y); + glTexCoord2f(0, 1); glVertex2f(X, Y+H); + glTexCoord2f(1, 1); glVertex2f(X+(W/100 * (Percent +1)), Y+H); + glTexCoord2f(1, 0); glVertex2f(X+(W/100 * (Percent +1)), Y); + glEnd; + + //SingBar Front + glColor4f(1, 1, 1, 0.6); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Tex_SingBar_Front.TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(X, Y); + glTexCoord2f(0, 1); glVertex2f(X, Y+H); + glTexCoord2f(1, 1); glVertex2f(X+W, Y+H); + glTexCoord2f(1, 0); glVertex2f(X+W, Y); + glEnd; +end; +//end Singbar Mod + +//PhrasenBonus - Line Bonus Pop Up +procedure SingDrawLineBonus( const X, Y: Single; Color: TRGB; Alpha: Single; Text: string; Age: Integer); +var +Length, X2: Real; //Length of Text +Size: Integer; //Size of Popup +begin +if Alpha <> 0 then +begin + +//Set Font Propertys +SetFontStyle(2); //Font: Outlined1 +if Age < 5 then SetFontSize(Age + 1) else SetFontSize(6); +SetFontItalic(False); + +//Check Font Size +Length := glTextWidth ( PChar(Text)) + 3; //Little Space for a Better Look ^^ + +//Text +SetFontPos (X + 50 - (Length / 2), Y + 12); //Position + + +if Age < 5 then Size := Age * 10 else Size := 50; + + //Draw Background + //glColor4f(Color.R, Color.G, Color.B, Alpha); //Set Color + glColor4f(1, 1, 1, Alpha); + + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + + //New Method, Not Variable + glBindTexture(GL_TEXTURE_2D, Tex_SingLineBonusBack[2].TexNum); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(X + 50 - Size, Y + 25 - (Size/2)); + glTexCoord2f(0, 1); glVertex2f(X + 50 - Size, Y + 25 + (Size/2)); + glTexCoord2f(1, 1); glVertex2f(X + 50 + Size, Y + 25 + (Size/2)); + glTexCoord2f(1, 0); glVertex2f(X + 50 + Size, Y + 25 - (Size/2)); + glEnd; + + glColor4f(1, 1, 1, Alpha); //Set Color + //Draw Text + glPrint (PChar(Text)); +end; +end; +//PhrasenBonus - Line Bonus Mod} + +// Draw Note Bars for Editor +//There are 11 Resons for a new Procdedure: +// 1. It don't look good when you Draw the Golden Note Star Effect in the Editor +// 2. You can see the Freestyle Notes in the Editor SemiTransparent +// 3. Its easier and Faster then changing the old Procedure +procedure EditDrawCzesc(Left, Top, Right: real; NrCzesci: integer; Space: integer); +var + Rec: TRecR; + Pet: integer; + TempR: real; +begin + glColor3f(1, 1, 1); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); + with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin + for Pet := 0 to HighNut do begin + with Nuta[Pet] do begin + + // Golden Note Patch + case Wartosc of + 0: glColor4f(1, 1, 1, 0.35); + 1: glColor4f(1, 1, 1, 0.85); + 2: glColor4f(1, 1, 0.3, 0.85); + end; // case + + + + // lewa czesc - left part + Rec.Left := (Start-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left + 0.5 + 10*ScreenX; + Rec.Right := Rec.Left + NotesW; + Rec.Top := Top - (Ton-BaseNote)*Space/2 - NotesH; + Rec.Bottom := Rec.Top + 2 * NotesH; + glBindTexture(GL_TEXTURE_2D, Tex_Left[Color].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // srodkowa czesc - middle part + Rec.Left := Rec.Right; + Rec.Right := (Start+Dlugosc-Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote) * TempR + Left - NotesW - 0.5 + 10*ScreenX; + + glBindTexture(GL_TEXTURE_2D, Tex_Mid[Color].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + // prawa czesc - right part + Rec.Left := Rec.Right; + Rec.Right := Rec.Right + NotesW; + + glBindTexture(GL_TEXTURE_2D, Tex_Right[Color].TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top); + glTexCoord2f(0, 1); glVertex2f(Rec.Left, Rec.Bottom); + glTexCoord2f(1, 1); glVertex2f(Rec.Right, Rec.Bottom); + glTexCoord2f(1, 0); glVertex2f(Rec.Right, Rec.Top); + glEnd; + + end; // with + end; // for + end; // with + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); +end; + +procedure SingDrawTimeBar(); +var x,y: real; + width, height: real; + lTmp : real; +begin + x := Theme.Sing.StaticTimeProgress.x; + y := Theme.Sing.StaticTimeProgress.y; + + width := Theme.Sing.StaticTimeProgress.w; + height := Theme.Sing.StaticTimeProgress.h; + + glColor4f(Theme.Sing.StaticTimeProgress.ColR, + Theme.Sing.StaticTimeProgress.ColG, + Theme.Sing.StaticTimeProgress.ColB, 1); //Set Color + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + + glBindTexture(GL_TEXTURE_2D, Tex_TimeProgress.TexNum); + + glBegin(GL_QUADS); + try + glTexCoord2f(0, 0); + glVertex2f(x,y); + + if ( Czas.Teraz > 0 ) AND + ( Czas.Razem > 0 ) THEN + BEGIN + lTmp := Czas.Teraz/Czas.Razem; + glTexCoord2f((width*Czas.Teraz/Czas.Razem)/8, 0); + glVertex2f(x+width*Czas.Teraz/Czas.Razem, y); + + glTexCoord2f((width*Czas.Teraz/Czas.Razem)/8, 1); + glVertex2f(x+width*Czas.Teraz/Czas.Razem, y+height); + END; + + glTexCoord2f(0, 1); + glVertex2f(x, y+height); + finally + glEnd; + end; + + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + glcolor4f(1,1,1,1); +end; + +end. + diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 40b91be7..82fb92e4 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -588,9 +588,14 @@ begin // Log.LogStatus('Beat ' + IntToStr(Czas.AktBeat) + ' HalfBeat ' + IntToStr(Czas.AktHalf), 'NewBeat'); // beep; + // On linux we get an AV @ NEWNOTE, line 600 of Classes/UMain.pas + if not assigned( Sound ) then // TODO : JB_Linux ... why is this now not assigned... it was fine a few hours ago.. + exit; + // analizuje dla obu graczy ten sam sygnal (Sound.OneSrcForBoth) // albo juz lepiej nie - for CP := 0 to PlayersPlay-1 do begin + for CP := 0 to PlayersPlay-1 do + begin // analyze buffer Sound[CP].AnalizujBufor; diff --git a/Game/Code/Classes/UMedia_dummy.pas b/Game/Code/Classes/UMedia_dummy.pas index 0752ab64..bf3ad727 100644 --- a/Game/Code/Classes/UMedia_dummy.pas +++ b/Game/Code/Classes/UMedia_dummy.pas @@ -37,9 +37,9 @@ type procedure init(); function Open( aFileName : string): boolean; // true if succeed - procedure Close; - - procedure Play; + procedure Close; + + procedure Play; procedure Pause; procedure Stop; @@ -90,7 +90,7 @@ type function Tmedia_dummy.GetName: String; begin - result := 'dummy'; + result := 'dummy'; end; @@ -104,23 +104,23 @@ end; constructor Tmedia_dummy.create(); begin -end; - -procedure Tmedia_dummy.init(); +end; + +procedure Tmedia_dummy.init(); +begin +end; + + +function Tmedia_dummy.Open( aFileName : string): boolean; // true if succeed begin -end; - - -function Tmedia_dummy.Open( aFileName : string): boolean; // true if succeed -begin result := false; -end; - -procedure Tmedia_dummy.Close; +end; + +procedure Tmedia_dummy.Close; begin end; -procedure Tmedia_dummy.Play; +procedure Tmedia_dummy.Play; begin end; @@ -138,7 +138,7 @@ end; function Tmedia_dummy.getPosition: real; begin - result := 0; + result := 0; end; // IAudioInput @@ -169,8 +169,8 @@ end; // IAudioPlayback procedure Tmedia_dummy.InitializePlayback; begin -end; - +end; + procedure Tmedia_dummy.SetVolume(Volume: integer); begin end; @@ -189,11 +189,13 @@ end; function Tmedia_dummy.Finished: boolean; begin -end; - + result := false; +end; + function Tmedia_dummy.Length: real; begin -end; + Result := 60; +end; procedure Tmedia_dummy.PlayStart; begin @@ -267,8 +269,8 @@ initialization writeln( 'UMedia_dummy - Register dummy Video_Playback' ); AudioManager.add( IAudioInput( singleton_dummy ) ); -finalization - AudioManager.Remove( IVideoPlayback( singleton_dummy ) ); +finalization + AudioManager.Remove( IVideoPlayback( singleton_dummy ) ); AudioManager.Remove( IAudioPlayback( singleton_dummy ) ); AudioManager.Remove( IAudioInput( singleton_dummy ) ); diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index 05496fbc..4c27867d 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -94,9 +94,9 @@ type procedure init(); function Open( aFileName : string): boolean; // true if succeed - procedure Close; - - procedure Play; + procedure Close; + + procedure Play; procedure Pause; procedure Stop; @@ -126,7 +126,7 @@ asdf function TVideoPlayback_ffmpeg.GetName: String; begin - result := 'FFMpeg'; + result := 'FFMpeg'; end; { @@ -281,7 +281,7 @@ begin av_free_packet( AVPacket ); // JB-ffmpeg except // TODO : JB_FFMpeg ... why does this now AV sometimes ( or always !! ) - end; + end; end; @@ -402,29 +402,29 @@ end; constructor TVideoPlayback_ffmpeg.create(); begin - writeln( 'UVideo_FFMpeg - TVideoPlayback_ffmpeg.create()' ); - - writeln( 'UVideo_FFMpeg - av_register_all' ); - av_register_all; + writeln( 'UVideo_FFMpeg - TVideoPlayback_ffmpeg.create()' ); + + writeln( 'UVideo_FFMpeg - av_register_all' ); + av_register_all; fVideoOpened := False; fVideoPaused := False; -end; - -procedure TVideoPlayback_ffmpeg.init(); +end; + +procedure TVideoPlayback_ffmpeg.init(); begin - writeln( 'UVideo_FFMpeg - glGenTextures(1, PglUint(@fVideoTex))' ); + writeln( 'UVideo_FFMpeg - glGenTextures(1, PglUint(@fVideoTex))' ); glGenTextures(1, PglUint(@fVideoTex)); writeln( 'UVideo_FFMpeg - SetLength(fTexData,0)' ); SetLength(fTexData,0); -end; - - -function TVideoPlayback_ffmpeg.Open( aFileName : string): boolean; // true if succeed -var - errnum, i, x,y: Integer; +end; + + +function TVideoPlayback_ffmpeg.Open( aFileName : string): boolean; // true if succeed +var + errnum, i, x,y: Integer; lStreamsCount : Integer; begin @@ -474,7 +474,7 @@ begin if aCodecCtx <> nil then begin - WantedAudioCodecContext.freq := aCodecCtx^.sample_rate; +// WantedAudioCodecContext.freq := aCodecCtx^.sample_rate; // WantedAudioCodecContext.format := AUDIO_S16SYS; // WantedAudioCodecContext.channels := aCodecCtx^.channels; (* WantedAudioCodecContext.silence := 0; @@ -591,10 +591,10 @@ begin 'be prepared to experience some timing problems'); {$endif} end; - end; -end; - -procedure TVideoPlayback_ffmpeg.Close; + end; +end; + +procedure TVideoPlayback_ffmpeg.Close; begin if fVideoOpened then begin @@ -610,8 +610,8 @@ begin fVideoOpened:=False; end; end; - -procedure TVideoPlayback_ffmpeg.Play; + +procedure TVideoPlayback_ffmpeg.Play; begin end; @@ -638,7 +638,7 @@ end; function TVideoPlayback_ffmpeg.getPosition: real; begin - result := 0; + result := 0; end; initialization @@ -648,8 +648,8 @@ initialization AudioManager.add( IVideoPlayback( singleton_VideoFFMpeg ) ); -finalization - AudioManager.Remove( IVideoPlayback( singleton_VideoFFMpeg ) ); +finalization + AudioManager.Remove( IVideoPlayback( singleton_VideoFFMpeg ) ); end. diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index c53e8b32..97d31541 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -521,6 +521,7 @@ var BarStartPosX : Single; R,G,B : real; + lTmp : real; begin MaxHeight := Static[StaticBackLevel[PlayerNumber + 1]].Texture.H; @@ -544,7 +545,12 @@ begin // quadratic easing out - decelerating to zero velocity // -end_position * current_time * ( current_time - 2 ) + start_postion - NewHeight := (-Height2Reach * RaiseStep * (RaiseStep - 20) + BarStartPosY) / RaiseSmoothness; + lTmp := (-Height2Reach * RaiseStep * (RaiseStep - 20) + BarStartPosY); + if ( RaiseSmoothness > 0 ) AND + ( lTmp > 0 ) then + begin + NewHeight := lTmp / RaiseSmoothness; + end; end else begin diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 542326d2..8cba8f36 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -425,7 +425,8 @@ begin // AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed // set movie - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + begin (* OpenSmpeg(AktSong.Path + AktSong.Video); SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*) diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index 49946f1c..31115dde 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -130,6 +130,8 @@ uses {$ifdef win32} UAudio_bass in 'Classes\UAudio_bass.pas', {$endif} +// UAudio_fmod in 'Classes\UAudio_fmod.pas', // Not ready yet + UParty in 'Classes\UParty.pas', UPlaylist in 'Classes\UPlaylist.pas', -- cgit v1.2.3 From 015dfecd8b6e4e1463509822ca4179ee88add976 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 25 Oct 2007 11:33:44 +0000 Subject: first effort to work towards jira#USDX-60 song directory enumeration is now unicode compliant on linux. still needs doing for windows, with wfindfile ( I think thats the right name ) this still relies on sdl_ttf and lots of other changes, but I had a few min and wanted to play with this :) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@527 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UFiles.pas | 1528 ++++++++++++++++++++--------------------- Game/Code/Classes/USongs.pas | 1533 +++++++++++++++++++++--------------------- 2 files changed, 1541 insertions(+), 1520 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index 9cd3bdc1..7e23b42f 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -1,764 +1,764 @@ -unit UFiles; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -uses SysUtils, - ULog, - UMusic, - USongs; - -//procedure InitializePaths; //Function sets All Absolute Paths eg. for Songs -function ReadTXTHeader(var Song: TSong): boolean; //Reads Standard TXT Header -function AnalyseFile(var Song: TSong): boolean; //Analyse Song File and Read Header -procedure ClearSong(var Song: TSong); //Clears Song Header values - -//Methodes Loading and Saving Songfiles -procedure ResetSingTemp; -procedure ParseNote(NrCzesci: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string); -procedure NewSentence(NrCzesciP: integer; Param1, Param2: integer); -function LoadSong(Name: string): boolean; -function SaveSong(Song: TSong; Czesc: TCzesci; Name: string; Relative: boolean): boolean; - - - -var -{* - //Absolute Paths - GamePath: string; - SoundPath: string; - SongPath: string; - LogPath: string; - ThemePath: string; - ScreenshotsPath: string; - CoversPath: string; - LanguagesPath: string; - PluginPath: string; - PlayListPath: string; -*} - - SongFile: TextFile; // all procedures in this unit operates on this file - FileLineNo: integer; //Line which is readed at Last, for error reporting - - // variables available for all procedures - Base: array[0..1] of integer; - Rel: array[0..1] of integer; - Mult: integer = 1; - MultBPM: integer = 4; - -implementation - -uses TextGL, - UIni, - UMain; - -//-------------------- -// Clears Song Header values -//-------------------- -procedure ClearSong(var Song: TSong); -begin - //Main Information - Song.Title := ''; - Song.Artist := ''; - - //Sortings: - Song.Genre := 'Unknown'; - Song.Edition := 'Unknown'; - Song.Language := 'Unknown'; //Language Patch - - //Required Information - Song.Mp3 := ''; - {$IFDEF FPC} - setlength( Song.BPM, 0 ); - {$ELSE} - Song.BPM := 0; - {$ENDIF} - - Song.GAP := 0; - Song.Start := 0; - Song.Finish := 0; - - //Additional Information - Song.Background := ''; - Song.Cover := ''; - Song.Video := ''; - Song.VideoGAP := 0; - Song.NotesGAP := 0; - Song.Resolution := 4; - Song.Creator := ''; -end; - -//-------------------- -// Reads Standard TXT Header -//-------------------- -function ReadTXTHeader(var Song: TSong): boolean; -var - Line, Identifier, Value: String; - Temp: word; - Done: byte; -begin - Result := true; - Done := 0; - - //Read first Line - ReadLn (SongFile, Line); - - if (Length(Line)<=0) then - begin - Log.LogError('File Starts with Empty Line: ' + Song.FileName); - Result := False; - Exit; - end; - - //Read Lines while Line starts with # - While (Length(Line) = 0) OR (Line[1] = '#') do - begin - //Increase Line Number - Inc (FileLineNo); - Temp := Pos(':', Line); - - //Line has a Seperator-> Headerline - if (Temp <> 0) then - begin - //Read Identifier and Value - Identifier := Uppercase(Trim(Copy(Line, 2, Temp - 2))); //Uppercase is for Case Insensitive Checks - Value := Trim(Copy(Line, Temp + 1,Length(Line) - Temp)); - - Log.LogError('Identifier: '+Identifier+' - '+ Value ); - - //Check the Identifier (If Value is given) - if (Length(Value) <> 0) then - begin - - //----------- - //Required Attributes - //----------- - - //Title - if (Identifier = 'TITLE') then - begin - Song.Title := Value; - - //Add Title Flag to Done - Done := Done or 1; - end - - //Artist - else if (Identifier = 'ARTIST') then - begin - Song.Artist := Value; - - //Add Artist Flag to Done - Done := Done or 2; - end - - //MP3 File //Test if Exists - else if (Identifier = 'MP3') AND (FileExists(Song.Path + Value)) then - begin - Song.Mp3 := Value; - - //Add Mp3 Flag to Done - Done := Done or 4; - end - - //Beats per Minute - else if (Identifier = 'BPM') then - begin - // Replace . with , - if (Pos('.', Value) <> 0) then - Value[Pos('.', Value)] := ','; - - SetLength(Song.BPM, 1); - Song.BPM[0].StartBeat := 0; - - Song.BPM[0].BPM := StrtoFloatDef(Value, 0) * Mult * MultBPM; - - if Song.BPM[0].BPM <> 0 then - begin - //Add BPM Flag to Done - Done := Done or 8; - end; - end - - //--------- - //Additional Header Information - //--------- - - // Video Gap - else if (Identifier = 'GAP') then - begin - // Replace . with , - if (Pos('.', Value) <> 0) then - Value[Pos('.', Value)] := ','; - - Song.GAP := StrtoFloatDef (Value, 0); - end - - //Cover Picture - else if (Identifier = 'COVER') then - begin - Song.Cover := Value; - end - - //Background Picture - else if (Identifier = 'BACKGROUND') then - begin - Song.Background := Value; - end - - // Video File - else if (Identifier = 'VIDEO') then - begin - if (FileExists(Song.Path + Value)) then - Song.Video := Value - else - Log.LogError('Can''t find Video File in Song: ' + Song.Path + Song.FileName); - end - - // Video Gap - else if (Identifier = 'VIDEOGAP') then - begin - // Replace . with , - if (Pos('.', Value) <> 0) then - Value[Pos('.', Value)] := ','; - - Song.VideoGAP := StrtoFloatDef (Value, 0); - end - - //Genre Sorting - else if (Identifier = 'GENRE') then - begin - Song.Genre := Value; - end - - //Edition Sorting - else if (Identifier = 'EDITION') then - begin - Song.Edition := Value; - end - - //Creator Tag - else if (Identifier = 'CREATOR') then - begin - Song.Creator := Value; - end - - //Language Sorting - else if (Identifier = 'LANGUAGE') then - begin - Song.Language := Value; - end - - // Song Start - else if (Identifier = 'START') then - begin - // Replace . with , - if (Pos('.', Value) <> 0) then - Value[Pos('.', Value)] := ','; - - Song.Start := StrtoFloatDef(Value, 0); - end - - // Song Ending - else if (Identifier = 'END') then - begin - TryStrtoInt(Value, Song.Finish); - end - - // Resolution - else if (Identifier = 'RESOLUTION') then - begin - TryStrtoInt(Value, Song.Resolution); - end - - // Notes Gap - else if (Identifier = 'NOTESGAP') then - begin - TryStrtoInt(Value, Song.NotesGAP); - end - - // Relative Notes - else if (Identifier = 'RELATIVE') AND (uppercase(Value) = 'YES') then - begin - Song.Relative := True; - end; - - end; - end; - - if not EOf(SongFile) then - ReadLn (SongFile, Line) - else - begin - Result := False; - Log.LogError('File Incomplete or not Ultrastar TxT (A): ' + Song.FileName); - break; - end; - - {//End on first empty Line - if (Length(Line) = 0) then - break;} - end; - - //Check if all Required Values are given - if (Done <> 15) then - begin - Result := False; - if (Done and 8) = 0 then //No BPM Flag - Log.LogError('BPM Tag Missing: ' + Song.FileName) - else if (Done and 4) = 0 then //No MP3 Flag - Log.LogError('MP3 Tag/File Missing: ' + Song.FileName) - else if (Done and 2) = 0 then //No Artist Flag - Log.LogError('Artist Tag Missing: ' + Song.FileName) - else if (Done and 1) = 0 then //No Title Flag - Log.LogError('Title Tag Missing: ' + Song.FileName) - else //unknown Error - Log.LogError('File Incomplete or not Ultrastar TxT (B - '+ inttostr(Done) +'): ' + Song.FileName); - end; - -end; - -//-------------------- -// Analyse Song File and Read Header -//-------------------- -function AnalyseFile(var Song: TSong): boolean; -begin -Result := False; -{try } - //Reset LineNo - FileLineNo := 0; - - //Open File and set File Pointer to the beginning - AssignFile(SongFile, Song.Path + Song.FileName); - Reset(SongFile); - - //Clear old Song Header - ClearSong(Song); - - //Read Header - Result := ReadTxTHeader(Song); - - //And Close File - CloseFile(SongFile); -{except - CloseFile(SongFile); - - Result := False; - //Error Reporting - Log.LogError('An Error occured reading Line ' + inttostr(FileLineNo) + ' from SongHeader: ' + Song.FileName); -end;} -end; - -//-------------------- -// Resets the temporary Sentence Arrays for each Player and some other Variables -//-------------------- -procedure ResetSingTemp; -var - Pet: integer; -begin - SetLength(Czesci, Length(Player)); - SetLength(AktSong.BPM, 0); - for Pet := 0 to High(Player) do begin - SetLength(Czesci[Pet].Czesc, 1); - SetLength(Czesci[Pet].Czesc[0].Nuta, 0); - Czesci[Pet].Czesc[0].Lyric := ''; - Czesci[Pet].Czesc[0].LyricWidth := 0; - Player[pet].Score := 0; - Player[pet].IlNut := 0; - Player[pet].HighNut := -1; - end; - //Reset Path and Filename Values to Prevent Errors in Editor - AktSong.Path := ''; - AktSong.FileName := ''; -end; - -//-------------------- -// Parses Note Infos and save them to Array -//-------------------- -procedure ParseNote(NrCzesci: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string); -var - Space: boolean; -begin - case Ini.Solmization of - 1: // european - begin - case (NoteP mod 12) of - 0..1: LyricS := ' do '; - 2..3: LyricS := ' re '; - 4: LyricS := ' mi '; - 5..6: LyricS := ' fa '; - 7..8: LyricS := ' sol '; - 9..10: LyricS := ' la '; - 11: LyricS := ' si '; - end; - end; - 2: // japanese - begin - case (NoteP mod 12) of - 0..1: LyricS := ' do '; - 2..3: LyricS := ' re '; - 4: LyricS := ' mi '; - 5..6: LyricS := ' fa '; - 7..8: LyricS := ' so '; - 9..10: LyricS := ' la '; - 11: LyricS := ' shi '; - end; - end; - 3: // american - begin - case (NoteP mod 12) of - 0..1: LyricS := ' do '; - 2..3: LyricS := ' re '; - 4: LyricS := ' mi '; - 5..6: LyricS := ' fa '; - 7..8: LyricS := ' sol '; - 9..10: LyricS := ' la '; - 11: LyricS := ' ti '; - end; - end; - end; // case - - with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].High] do begin - SetLength(Nuta, Length(Nuta) + 1); - IlNut := IlNut + 1; - HighNut := HighNut + 1; - Muzyka.IlNut := Muzyka.IlNut + 1; - - Nuta[HighNut].Start := StartP; - if IlNut = 1 then begin - StartNote := Nuta[HighNut].Start; - if Czesci[NrCzesci].Ilosc = 1 then - Start := -100; -// Start := Nuta[HighNut].Start; - end; - - Nuta[HighNut].Dlugosc := DurationP; - Muzyka.DlugoscNut := Muzyka.DlugoscNut + Nuta[HighNut].Dlugosc; - - // back to the normal system with normal, golden and now freestyle notes - case TypeP of - 'F': Nuta[HighNut].Wartosc := 0; - ':': Nuta[HighNut].Wartosc := 1; - '*': Nuta[HighNut].Wartosc := 2; - end; - - Czesci[NrCzesci].Wartosc := Czesci[NrCzesci].Wartosc + Nuta[HighNut].Dlugosc * Nuta[HighNut].Wartosc; - - Nuta[HighNut].Ton := NoteP; - if Nuta[HighNut].Ton < Base[NrCzesci] then Base[NrCzesci] := Nuta[HighNut].Ton; - Nuta[HighNut].TonGamy := Nuta[HighNut].TonGamy mod 12; - - Nuta[HighNut].Tekst := Copy(LyricS, 2, 100); - Lyric := Lyric + Nuta[HighNut].Tekst; - - if TypeP = 'F' then - Nuta[HighNut].FreeStyle := true; - - Koniec := Nuta[HighNut].Start + Nuta[HighNut].Dlugosc; - end; // with -end; - -//-------------------- -// Called when a new Sentence is found in the TXT File -//-------------------- -procedure NewSentence(NrCzesciP: integer; Param1, Param2: integer); -var -I: Integer; -begin - - // stara czesc //Alter Satz //Update Old Part - Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].BaseNote := Base[NrCzesciP]; - Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].LyricWidth := glTextWidth(PChar(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Lyric)); - - //Total Notes Patch - Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes := 0; - for I := low(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta) to high(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta) do - begin - Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes := Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta[I].Dlugosc * Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta[I].Wartosc; - end; - //Total Notes Patch End - - - // nowa czesc //Neuer Satz //Update New Part - SetLength(Czesci[NrCzesciP].Czesc, Czesci[NrCzesciP].Ilosc + 1); - Czesci[NrCzesciP].High := Czesci[NrCzesciP].High + 1; - Czesci[NrCzesciP].Ilosc := Czesci[NrCzesciP].Ilosc + 1; - Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].HighNut := -1; - - if not AktSong.Relative then - Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Start := Param1; - - if AktSong.Relative then begin - Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Start := Param1; - Rel[NrCzesciP] := Rel[NrCzesciP] + Param2; - end; - - Base[NrCzesciP] := 100; // high number -end; - -//-------------------- -// Load a Song -//-------------------- -function LoadSong(Name: string): boolean; -var - TempC: char; - Tekst: string; - CP: integer; // Current Player (0 or 1) - Pet: integer; - Both: boolean; - Param1: integer; - Param2: integer; - Param3: integer; - ParamS: string; - I: Integer; -begin - Result := false; - - if not FileExists(Name) then begin - Log.LogError('File not found: "' + Name + '"', 'WczytajCzesci'); - exit; - end; - - try - MultBPM := 4; // 4 - mnoznik dla czasu nut - Mult := 1; // 4 - dokladnosc pomiaru nut - Base[0] := 100; // high number -// Base[1] := 100; // high number - Czesci[0].Wartosc := 0; -// Czesci[1].Wartosc := 0; // here was the error in 0.3.2 - AktSong.Relative := false; - - Rel[0] := 0; -// Rel[1] := 0; - CP := 0; - Both := false; - if Length(Player) = 2 then Both := true; - - FileMode := fmOpenRead; - AssignFile(SongFile, Name); - Reset(SongFile); - - //Clear old Song Header - ClearSong(AktSong); - - if (AktSong.Path = '') then - AktSong.Path := ExtractFilePath(Name); - - if (AktSong.FileName = '') then - AktSong.Filename := ExtractFileName(Name); - //Read Header - Result := ReadTxTHeader(AktSong); - if not Result then - begin - CloseFile(SongFile); - Log.LogError('Error Loading SongHeader, abort Song Loading'); - Exit; - end; - - Result := False; - - Reset(SongFile); - FileLineNo := 0; - //Search for Note Begining - repeat - ReadLn(SongFile, Tekst); - Inc(FileLineNo); - - if (EoF(SongFile)) then - begin //Song File Corrupted - No Notes - CloseFile(SongFile); - Log.LogError('Could not load txt File, no Notes found: ' + Name); - Result := False; - Exit; - end; - Read(SongFile, TempC); - until ((TempC = ':') or (TempC = 'F') or (TempC = '*')); - - SetLength(Czesci, 2); - for Pet := 0 to High(Czesci) do begin - SetLength(Czesci[Pet].Czesc, 1); - Czesci[Pet].High := 0; - Czesci[Pet].Ilosc := 1; - Czesci[Pet].Akt := 0; - Czesci[Pet].Resolution := AktSong.Resolution; - Czesci[Pet].NotesGAP := AktSong.NotesGAP; - Czesci[Pet].Czesc[0].IlNut := 0; - Czesci[Pet].Czesc[0].HighNut := -1; - end; - -// TempC := ':'; -// TempC := Tekst[1]; // read from backup variable, don't use default ':' value - - while (TempC <> 'E') AND (not EOF(SongFile)) do begin - if (TempC = ':') or (TempC = '*') or (TempC = 'F') then begin - // wczytuje nute - Read(SongFile, Param1); - Read(SongFile, Param2); - Read(SongFile, Param3); - Read(SongFile, ParamS); - - // dodaje nute - if not Both then - // P1 - ParseNote(0, TempC, (Param1+Rel[0]) * Mult, Param2 * Mult, Param3, ParamS) - else begin - // P1 + P2 - ParseNote(0, TempC, (Param1+Rel[0]) * Mult, Param2 * Mult, Param3, ParamS); - ParseNote(1, TempC, (Param1+Rel[1]) * Mult, Param2 * Mult, Param3, ParamS); - end; - end; // if - if TempC = '-' then begin - // reads sentence - Read(SongFile, Param1); - if AktSong.Relative then Read(SongFile, Param2); // read one more data for relative system - - // new sentence - if not Both then - // P1 - NewSentence(0, (Param1 + Rel[0]) * Mult, Param2) - else begin - // P1 + P2 - NewSentence(0, (Param1 + Rel[0]) * Mult, Param2); - NewSentence(1, (Param1 + Rel[1]) * Mult, Param2); - end; - - end; // if - - if TempC = 'B' then begin - SetLength(AktSong.BPM, Length(AktSong.BPM) + 1); - Read(SongFile, AktSong.BPM[High(AktSong.BPM)].StartBeat); - AktSong.BPM[High(AktSong.BPM)].StartBeat := AktSong.BPM[High(AktSong.BPM)].StartBeat + Rel[0]; - - Read(SongFile, Tekst); - AktSong.BPM[High(AktSong.BPM)].BPM := StrToFloat(Tekst); - AktSong.BPM[High(AktSong.BPM)].BPM := AktSong.BPM[High(AktSong.BPM)].BPM * Mult * MultBPM; - end; - - - if not Both then begin - Czesci[CP].Czesc[Czesci[CP].High].BaseNote := Base[CP]; - Czesci[CP].Czesc[Czesci[CP].High].LyricWidth := glTextWidth(PChar(Czesci[CP].Czesc[Czesci[CP].High].Lyric)); - //Total Notes Patch - Czesci[CP].Czesc[Czesci[CP].High].TotalNotes := 0; - for I := low(Czesci[CP].Czesc[Czesci[CP].High].Nuta) to high(Czesci[CP].Czesc[Czesci[CP].High].Nuta) do - begin - Czesci[CP].Czesc[Czesci[CP].High].TotalNotes := Czesci[CP].Czesc[Czesci[CP].High].TotalNotes + Czesci[CP].Czesc[Czesci[CP].High].Nuta[I].Dlugosc * Czesci[CP].Czesc[Czesci[CP].High].Nuta[I].Wartosc; - end; - //Total Notes Patch End - end else begin - for Pet := 0 to High(Czesci) do begin - Czesci[Pet].Czesc[Czesci[Pet].High].BaseNote := Base[Pet]; - Czesci[Pet].Czesc[Czesci[Pet].High].LyricWidth := glTextWidth(PChar(Czesci[Pet].Czesc[Czesci[Pet].High].Lyric)); - //Total Notes Patch - Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes := 0; - for I := low(Czesci[Pet].Czesc[Czesci[Pet].High].Nuta) to high(Czesci[Pet].Czesc[Czesci[Pet].High].Nuta) do - begin - Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes := Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes + Czesci[Pet].Czesc[Czesci[Pet].High].Nuta[I].Dlugosc * Czesci[Pet].Czesc[Czesci[Pet].High].Nuta[I].Wartosc; - end; - //Total Notes Patch End - end; - end; - - Read(SongFile, TempC); - Inc(FileLineNo); - end; // while} - - CloseFile(SongFile); - except - try - CloseFile(SongFile); - except - - end; - - Log.LogError('Error Loading File: "' + Name + '" in Line ' + inttostr(FileLineNo)); - exit; - end; - - Result := true; -end; - -//-------------------- -// Saves a Song -//-------------------- -function SaveSong(Song: TSong; Czesc: TCzesci; Name: string; Relative: boolean): boolean; -var - C: integer; - N: integer; - S: string; - B: integer; - RelativeSubTime: integer; - NoteState: String; - -begin -// Relative := true; // override (idea - use shift+S to save with relative) - AssignFile(SongFile, Name); - Rewrite(SongFile); - - WriteLn(SongFile, '#TITLE:' + Song.Title + ''); - WriteLn(SongFile, '#ARTIST:' + Song.Artist); - - if Song.Creator <> '' then WriteLn(SongFile, '#CREATOR:' + Song.Creator); - if Song.Edition <> 'Unknown' then WriteLn(SongFile, '#EDITION:' + Song.Edition); - if Song.Genre <> 'Unknown' then WriteLn(SongFile, '#GENRE:' + Song.Genre); - if Song.Language <> 'Unknown' then WriteLn(SongFile, '#LANGUAGE:' + Song.Language); - - WriteLn(SongFile, '#MP3:' + Song.Mp3); - - if Song.Cover <> '' then WriteLn(SongFile, '#COVER:' + Song.Cover); - if Song.Background <> '' then WriteLn(SongFile, '#BACKGROUND:' + Song.Background); - if Song.Video <> '' then WriteLn(SongFile, '#VIDEO:' + Song.Video); - if Song.VideoGAP <> 0 then WriteLn(SongFile, '#VIDEOGAP:' + FloatToStr(Song.VideoGAP)); - if Song.Resolution <> 4 then WriteLn(SongFile, '#RESOLUTION:' + IntToStr(Song.Resolution)); - if Song.NotesGAP <> 0 then WriteLn(SongFile, '#NOTESGAP:' + IntToStr(Song.NotesGAP)); - if Song.Start <> 0 then WriteLn(SongFile, '#START:' + FloatToStr(Song.Start)); - if Song.Finish <> 0 then WriteLn(SongFile, '#END:' + IntToStr(Song.Finish)); - if Relative then WriteLn(SongFile, '#RELATIVE:yes'); - - WriteLn(SongFile, '#BPM:' + FloatToStr(Song.BPM[0].BPM / 4)); - WriteLn(SongFile, '#GAP:' + FloatToStr(Song.GAP)); - - RelativeSubTime := 0; - for B := 1 to High(AktSong.BPM) do - WriteLn(SongFile, 'B ' + FloatToStr(AktSong.BPM[B].StartBeat) + ' ' + FloatToStr(AktSong.BPM[B].BPM/4)); - - for C := 0 to Czesc.High do begin - for N := 0 to Czesc.Czesc[C].HighNut do begin - with Czesc.Czesc[C].Nuta[N] do begin - - - //Golden + Freestyle Note Patch - case Czesc.Czesc[C].Nuta[N].Wartosc of - 0: NoteState := 'F '; - 1: NoteState := ': '; - 2: NoteState := '* '; - end; // case - S := NoteState + IntToStr(Start-RelativeSubTime) + ' ' + IntToStr(Dlugosc) + ' ' + IntToStr(Ton) + ' ' + Tekst; - - - WriteLn(SongFile, S); - end; // with - end; // N - - if C < Czesc.High then begin // don't write end of last sentence - if not Relative then - S := '- ' + IntToStr(Czesc.Czesc[C+1].Start) - else begin - S := '- ' + IntToStr(Czesc.Czesc[C+1].Start - RelativeSubTime) + - ' ' + IntToStr(Czesc.Czesc[C+1].Start - RelativeSubTime); - RelativeSubTime := Czesc.Czesc[C+1].Start; - end; - WriteLn(SongFile, S); - end; - - end; // C - - - WriteLn(SongFile, 'E'); - CloseFile(SongFile); -end; - -end. +unit UFiles; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses SysUtils, + ULog, + UMusic, + USongs; + +//procedure InitializePaths; //Function sets All Absolute Paths eg. for Songs +function ReadTXTHeader(var Song: TSong): boolean; //Reads Standard TXT Header +function AnalyseFile(var Song: TSong): boolean; //Analyse Song File and Read Header +procedure ClearSong(var Song: TSong); //Clears Song Header values + +//Methodes Loading and Saving Songfiles +procedure ResetSingTemp; +procedure ParseNote(NrCzesci: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string); +procedure NewSentence(NrCzesciP: integer; Param1, Param2: integer); +function LoadSong(Name: string): boolean; +function SaveSong(Song: TSong; Czesc: TCzesci; Name: string; Relative: boolean): boolean; + + + +var +{* + //Absolute Paths + GamePath: string; + SoundPath: string; + SongPath: string; + LogPath: string; + ThemePath: string; + ScreenshotsPath: string; + CoversPath: string; + LanguagesPath: string; + PluginPath: string; + PlayListPath: string; +*} + + SongFile: TextFile; // all procedures in this unit operates on this file + FileLineNo: integer; //Line which is readed at Last, for error reporting + + // variables available for all procedures + Base: array[0..1] of integer; + Rel: array[0..1] of integer; + Mult: integer = 1; + MultBPM: integer = 4; + +implementation + +uses TextGL, + UIni, + UMain; + +//-------------------- +// Clears Song Header values +//-------------------- +procedure ClearSong(var Song: TSong); +begin + //Main Information + Song.Title := ''; + Song.Artist := ''; + + //Sortings: + Song.Genre := 'Unknown'; + Song.Edition := 'Unknown'; + Song.Language := 'Unknown'; //Language Patch + + //Required Information + Song.Mp3 := ''; + {$IFDEF FPC} + setlength( Song.BPM, 0 ); + {$ELSE} + Song.BPM := 0; + {$ENDIF} + + Song.GAP := 0; + Song.Start := 0; + Song.Finish := 0; + + //Additional Information + Song.Background := ''; + Song.Cover := ''; + Song.Video := ''; + Song.VideoGAP := 0; + Song.NotesGAP := 0; + Song.Resolution := 4; + Song.Creator := ''; +end; + +//-------------------- +// Reads Standard TXT Header +//-------------------- +function ReadTXTHeader(var Song: TSong): boolean; +var + Line, Identifier, Value: String; + Temp: word; + Done: byte; +begin + Result := true; + Done := 0; + + //Read first Line + ReadLn (SongFile, Line); + + if (Length(Line)<=0) then + begin + Log.LogError('File Starts with Empty Line: ' + Song.FileName); + Result := False; + Exit; + end; + + //Read Lines while Line starts with # + While (Length(Line) = 0) OR (Line[1] = '#') do + begin + //Increase Line Number + Inc (FileLineNo); + Temp := Pos(':', Line); + + //Line has a Seperator-> Headerline + if (Temp <> 0) then + begin + //Read Identifier and Value + Identifier := Uppercase(Trim(Copy(Line, 2, Temp - 2))); //Uppercase is for Case Insensitive Checks + Value := Trim(Copy(Line, Temp + 1,Length(Line) - Temp)); + + Log.LogError('Identifier: '+Identifier+' - '+ Value ); + + //Check the Identifier (If Value is given) + if (Length(Value) <> 0) then + begin + + //----------- + //Required Attributes + //----------- + + //Title + if (Identifier = 'TITLE') then + begin + Song.Title := Value; + + //Add Title Flag to Done + Done := Done or 1; + end + + //Artist + else if (Identifier = 'ARTIST') then + begin + Song.Artist := Value; + + //Add Artist Flag to Done + Done := Done or 2; + end + + //MP3 File //Test if Exists + else if (Identifier = 'MP3') AND (FileExists(Song.Path + Value)) then + begin + Song.Mp3 := Value; + + //Add Mp3 Flag to Done + Done := Done or 4; + end + + //Beats per Minute + else if (Identifier = 'BPM') then + begin + // Replace . with , + if (Pos('.', Value) <> 0) then + Value[Pos('.', Value)] := ','; + + SetLength(Song.BPM, 1); + Song.BPM[0].StartBeat := 0; + + Song.BPM[0].BPM := StrtoFloatDef(Value, 0) * Mult * MultBPM; + + if Song.BPM[0].BPM <> 0 then + begin + //Add BPM Flag to Done + Done := Done or 8; + end; + end + + //--------- + //Additional Header Information + //--------- + + // Video Gap + else if (Identifier = 'GAP') then + begin + // Replace . with , + if (Pos('.', Value) <> 0) then + Value[Pos('.', Value)] := ','; + + Song.GAP := StrtoFloatDef (Value, 0); + end + + //Cover Picture + else if (Identifier = 'COVER') then + begin + Song.Cover := Value; + end + + //Background Picture + else if (Identifier = 'BACKGROUND') then + begin + Song.Background := Value; + end + + // Video File + else if (Identifier = 'VIDEO') then + begin + if (FileExists(Song.Path + Value)) then + Song.Video := Value + else + Log.LogError('Can''t find Video File in Song: ' + Song.Path + Song.FileName); + end + + // Video Gap + else if (Identifier = 'VIDEOGAP') then + begin + // Replace . with , + if (Pos('.', Value) <> 0) then + Value[Pos('.', Value)] := ','; + + Song.VideoGAP := StrtoFloatDef (Value, 0); + end + + //Genre Sorting + else if (Identifier = 'GENRE') then + begin + Song.Genre := Value; + end + + //Edition Sorting + else if (Identifier = 'EDITION') then + begin + Song.Edition := Value; + end + + //Creator Tag + else if (Identifier = 'CREATOR') then + begin + Song.Creator := Value; + end + + //Language Sorting + else if (Identifier = 'LANGUAGE') then + begin + Song.Language := Value; + end + + // Song Start + else if (Identifier = 'START') then + begin + // Replace . with , + if (Pos('.', Value) <> 0) then + Value[Pos('.', Value)] := ','; + + Song.Start := StrtoFloatDef(Value, 0); + end + + // Song Ending + else if (Identifier = 'END') then + begin + TryStrtoInt(Value, Song.Finish); + end + + // Resolution + else if (Identifier = 'RESOLUTION') then + begin + TryStrtoInt(Value, Song.Resolution); + end + + // Notes Gap + else if (Identifier = 'NOTESGAP') then + begin + TryStrtoInt(Value, Song.NotesGAP); + end + + // Relative Notes + else if (Identifier = 'RELATIVE') AND (uppercase(Value) = 'YES') then + begin + Song.Relative := True; + end; + + end; + end; + + if not EOf(SongFile) then + ReadLn (SongFile, Line) + else + begin + Result := False; + Log.LogError('File Incomplete or not Ultrastar TxT (A): ' + Song.FileName); + break; + end; + + {//End on first empty Line + if (Length(Line) = 0) then + break;} + end; + + //Check if all Required Values are given + if (Done <> 15) then + begin + Result := False; + if (Done and 8) = 0 then //No BPM Flag + Log.LogError('BPM Tag Missing: ' + Song.FileName) + else if (Done and 4) = 0 then //No MP3 Flag + Log.LogError('MP3 Tag/File Missing: ' + Song.FileName) + else if (Done and 2) = 0 then //No Artist Flag + Log.LogError('Artist Tag Missing: ' + Song.FileName) + else if (Done and 1) = 0 then //No Title Flag + Log.LogError('Title Tag Missing: ' + Song.FileName) + else //unknown Error + Log.LogError('File Incomplete or not Ultrastar TxT (B - '+ inttostr(Done) +'): ' + Song.FileName); + end; + +end; + +//-------------------- +// Analyse Song File and Read Header +//-------------------- +function AnalyseFile(var Song: TSong): boolean; +begin +Result := False; +{try } + //Reset LineNo + FileLineNo := 0; + + //Open File and set File Pointer to the beginning + AssignFile(SongFile, Song.Path + Song.FileName); + Reset(SongFile); + + //Clear old Song Header + ClearSong(Song); + + //Read Header + Result := ReadTxTHeader(Song); + + //And Close File + CloseFile(SongFile); +{except + CloseFile(SongFile); + + Result := False; + //Error Reporting + Log.LogError('An Error occured reading Line ' + inttostr(FileLineNo) + ' from SongHeader: ' + Song.FileName); +end;} +end; + +//-------------------- +// Resets the temporary Sentence Arrays for each Player and some other Variables +//-------------------- +procedure ResetSingTemp; +var + Pet: integer; +begin + SetLength(Czesci, Length(Player)); + SetLength(AktSong.BPM, 0); + for Pet := 0 to High(Player) do begin + SetLength(Czesci[Pet].Czesc, 1); + SetLength(Czesci[Pet].Czesc[0].Nuta, 0); + Czesci[Pet].Czesc[0].Lyric := ''; + Czesci[Pet].Czesc[0].LyricWidth := 0; + Player[pet].Score := 0; + Player[pet].IlNut := 0; + Player[pet].HighNut := -1; + end; + //Reset Path and Filename Values to Prevent Errors in Editor + AktSong.Path := ''; + AktSong.FileName := ''; +end; + +//-------------------- +// Parses Note Infos and save them to Array +//-------------------- +procedure ParseNote(NrCzesci: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string); +var + Space: boolean; +begin + case Ini.Solmization of + 1: // european + begin + case (NoteP mod 12) of + 0..1: LyricS := ' do '; + 2..3: LyricS := ' re '; + 4: LyricS := ' mi '; + 5..6: LyricS := ' fa '; + 7..8: LyricS := ' sol '; + 9..10: LyricS := ' la '; + 11: LyricS := ' si '; + end; + end; + 2: // japanese + begin + case (NoteP mod 12) of + 0..1: LyricS := ' do '; + 2..3: LyricS := ' re '; + 4: LyricS := ' mi '; + 5..6: LyricS := ' fa '; + 7..8: LyricS := ' so '; + 9..10: LyricS := ' la '; + 11: LyricS := ' shi '; + end; + end; + 3: // american + begin + case (NoteP mod 12) of + 0..1: LyricS := ' do '; + 2..3: LyricS := ' re '; + 4: LyricS := ' mi '; + 5..6: LyricS := ' fa '; + 7..8: LyricS := ' sol '; + 9..10: LyricS := ' la '; + 11: LyricS := ' ti '; + end; + end; + end; // case + + with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].High] do begin + SetLength(Nuta, Length(Nuta) + 1); + IlNut := IlNut + 1; + HighNut := HighNut + 1; + Muzyka.IlNut := Muzyka.IlNut + 1; + + Nuta[HighNut].Start := StartP; + if IlNut = 1 then begin + StartNote := Nuta[HighNut].Start; + if Czesci[NrCzesci].Ilosc = 1 then + Start := -100; +// Start := Nuta[HighNut].Start; + end; + + Nuta[HighNut].Dlugosc := DurationP; + Muzyka.DlugoscNut := Muzyka.DlugoscNut + Nuta[HighNut].Dlugosc; + + // back to the normal system with normal, golden and now freestyle notes + case TypeP of + 'F': Nuta[HighNut].Wartosc := 0; + ':': Nuta[HighNut].Wartosc := 1; + '*': Nuta[HighNut].Wartosc := 2; + end; + + Czesci[NrCzesci].Wartosc := Czesci[NrCzesci].Wartosc + Nuta[HighNut].Dlugosc * Nuta[HighNut].Wartosc; + + Nuta[HighNut].Ton := NoteP; + if Nuta[HighNut].Ton < Base[NrCzesci] then Base[NrCzesci] := Nuta[HighNut].Ton; + Nuta[HighNut].TonGamy := Nuta[HighNut].TonGamy mod 12; + + Nuta[HighNut].Tekst := Copy(LyricS, 2, 100); + Lyric := Lyric + Nuta[HighNut].Tekst; + + if TypeP = 'F' then + Nuta[HighNut].FreeStyle := true; + + Koniec := Nuta[HighNut].Start + Nuta[HighNut].Dlugosc; + end; // with +end; + +//-------------------- +// Called when a new Sentence is found in the TXT File +//-------------------- +procedure NewSentence(NrCzesciP: integer; Param1, Param2: integer); +var +I: Integer; +begin + + // stara czesc //Alter Satz //Update Old Part + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].BaseNote := Base[NrCzesciP]; + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].LyricWidth := glTextWidth(PChar(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Lyric)); + + //Total Notes Patch + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes := 0; + for I := low(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta) to high(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta) do + begin + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes := Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta[I].Dlugosc * Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta[I].Wartosc; + end; + //Total Notes Patch End + + + // nowa czesc //Neuer Satz //Update New Part + SetLength(Czesci[NrCzesciP].Czesc, Czesci[NrCzesciP].Ilosc + 1); + Czesci[NrCzesciP].High := Czesci[NrCzesciP].High + 1; + Czesci[NrCzesciP].Ilosc := Czesci[NrCzesciP].Ilosc + 1; + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].HighNut := -1; + + if not AktSong.Relative then + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Start := Param1; + + if AktSong.Relative then begin + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Start := Param1; + Rel[NrCzesciP] := Rel[NrCzesciP] + Param2; + end; + + Base[NrCzesciP] := 100; // high number +end; + +//-------------------- +// Load a Song +//-------------------- +function LoadSong(Name: string): boolean; +var + TempC: char; + Tekst: string; + CP: integer; // Current Player (0 or 1) + Pet: integer; + Both: boolean; + Param1: integer; + Param2: integer; + Param3: integer; + ParamS: string; + I: Integer; +begin + Result := false; + + if not FileExists(Name) then begin + Log.LogError('File not found: "' + Name + '"', 'WczytajCzesci'); + exit; + end; + + try + MultBPM := 4; // 4 - mnoznik dla czasu nut + Mult := 1; // 4 - dokladnosc pomiaru nut + Base[0] := 100; // high number +// Base[1] := 100; // high number + Czesci[0].Wartosc := 0; +// Czesci[1].Wartosc := 0; // here was the error in 0.3.2 + AktSong.Relative := false; + + Rel[0] := 0; +// Rel[1] := 0; + CP := 0; + Both := false; + if Length(Player) = 2 then Both := true; + + FileMode := fmOpenRead; + AssignFile(SongFile, Name); + Reset(SongFile); + + //Clear old Song Header + ClearSong(AktSong); + + if (AktSong.Path = '') then + AktSong.Path := ExtractFilePath(Name); + + if (AktSong.FileName = '') then + AktSong.Filename := ExtractFileName(Name); + //Read Header + Result := ReadTxTHeader(AktSong); + if not Result then + begin + CloseFile(SongFile); + Log.LogError('Error Loading SongHeader, abort Song Loading'); + Exit; + end; + + Result := False; + + Reset(SongFile); + FileLineNo := 0; + //Search for Note Begining + repeat + ReadLn(SongFile, Tekst); + Inc(FileLineNo); + + if (EoF(SongFile)) then + begin //Song File Corrupted - No Notes + CloseFile(SongFile); + Log.LogError('Could not load txt File, no Notes found: ' + Name); + Result := False; + Exit; + end; + Read(SongFile, TempC); + until ((TempC = ':') or (TempC = 'F') or (TempC = '*')); + + SetLength(Czesci, 2); + for Pet := 0 to High(Czesci) do begin + SetLength(Czesci[Pet].Czesc, 1); + Czesci[Pet].High := 0; + Czesci[Pet].Ilosc := 1; + Czesci[Pet].Akt := 0; + Czesci[Pet].Resolution := AktSong.Resolution; + Czesci[Pet].NotesGAP := AktSong.NotesGAP; + Czesci[Pet].Czesc[0].IlNut := 0; + Czesci[Pet].Czesc[0].HighNut := -1; + end; + +// TempC := ':'; +// TempC := Tekst[1]; // read from backup variable, don't use default ':' value + + while (TempC <> 'E') AND (not EOF(SongFile)) do begin + if (TempC = ':') or (TempC = '*') or (TempC = 'F') then begin + // wczytuje nute + Read(SongFile, Param1); + Read(SongFile, Param2); + Read(SongFile, Param3); + Read(SongFile, ParamS); + + // dodaje nute + if not Both then + // P1 + ParseNote(0, TempC, (Param1+Rel[0]) * Mult, Param2 * Mult, Param3, ParamS) + else begin + // P1 + P2 + ParseNote(0, TempC, (Param1+Rel[0]) * Mult, Param2 * Mult, Param3, ParamS); + ParseNote(1, TempC, (Param1+Rel[1]) * Mult, Param2 * Mult, Param3, ParamS); + end; + end; // if + if TempC = '-' then begin + // reads sentence + Read(SongFile, Param1); + if AktSong.Relative then Read(SongFile, Param2); // read one more data for relative system + + // new sentence + if not Both then + // P1 + NewSentence(0, (Param1 + Rel[0]) * Mult, Param2) + else begin + // P1 + P2 + NewSentence(0, (Param1 + Rel[0]) * Mult, Param2); + NewSentence(1, (Param1 + Rel[1]) * Mult, Param2); + end; + + end; // if + + if TempC = 'B' then begin + SetLength(AktSong.BPM, Length(AktSong.BPM) + 1); + Read(SongFile, AktSong.BPM[High(AktSong.BPM)].StartBeat); + AktSong.BPM[High(AktSong.BPM)].StartBeat := AktSong.BPM[High(AktSong.BPM)].StartBeat + Rel[0]; + + Read(SongFile, Tekst); + AktSong.BPM[High(AktSong.BPM)].BPM := StrToFloat(Tekst); + AktSong.BPM[High(AktSong.BPM)].BPM := AktSong.BPM[High(AktSong.BPM)].BPM * Mult * MultBPM; + end; + + + if not Both then begin + Czesci[CP].Czesc[Czesci[CP].High].BaseNote := Base[CP]; + Czesci[CP].Czesc[Czesci[CP].High].LyricWidth := glTextWidth(PChar(Czesci[CP].Czesc[Czesci[CP].High].Lyric)); + //Total Notes Patch + Czesci[CP].Czesc[Czesci[CP].High].TotalNotes := 0; + for I := low(Czesci[CP].Czesc[Czesci[CP].High].Nuta) to high(Czesci[CP].Czesc[Czesci[CP].High].Nuta) do + begin + Czesci[CP].Czesc[Czesci[CP].High].TotalNotes := Czesci[CP].Czesc[Czesci[CP].High].TotalNotes + Czesci[CP].Czesc[Czesci[CP].High].Nuta[I].Dlugosc * Czesci[CP].Czesc[Czesci[CP].High].Nuta[I].Wartosc; + end; + //Total Notes Patch End + end else begin + for Pet := 0 to High(Czesci) do begin + Czesci[Pet].Czesc[Czesci[Pet].High].BaseNote := Base[Pet]; + Czesci[Pet].Czesc[Czesci[Pet].High].LyricWidth := glTextWidth(PChar(Czesci[Pet].Czesc[Czesci[Pet].High].Lyric)); + //Total Notes Patch + Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes := 0; + for I := low(Czesci[Pet].Czesc[Czesci[Pet].High].Nuta) to high(Czesci[Pet].Czesc[Czesci[Pet].High].Nuta) do + begin + Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes := Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes + Czesci[Pet].Czesc[Czesci[Pet].High].Nuta[I].Dlugosc * Czesci[Pet].Czesc[Czesci[Pet].High].Nuta[I].Wartosc; + end; + //Total Notes Patch End + end; + end; + + Read(SongFile, TempC); + Inc(FileLineNo); + end; // while} + + CloseFile(SongFile); + except + try + CloseFile(SongFile); + except + + end; + + Log.LogError('Error Loading File: "' + Name + '" in Line ' + inttostr(FileLineNo)); + exit; + end; + + Result := true; +end; + +//-------------------- +// Saves a Song +//-------------------- +function SaveSong(Song: TSong; Czesc: TCzesci; Name: string; Relative: boolean): boolean; +var + C: integer; + N: integer; + S: string; + B: integer; + RelativeSubTime: integer; + NoteState: String; + +begin +// Relative := true; // override (idea - use shift+S to save with relative) + AssignFile(SongFile, Name); + Rewrite(SongFile); + + WriteLn(SongFile, '#TITLE:' + Song.Title + ''); + WriteLn(SongFile, '#ARTIST:' + Song.Artist); + + if Song.Creator <> '' then WriteLn(SongFile, '#CREATOR:' + Song.Creator); + if Song.Edition <> 'Unknown' then WriteLn(SongFile, '#EDITION:' + Song.Edition); + if Song.Genre <> 'Unknown' then WriteLn(SongFile, '#GENRE:' + Song.Genre); + if Song.Language <> 'Unknown' then WriteLn(SongFile, '#LANGUAGE:' + Song.Language); + + WriteLn(SongFile, '#MP3:' + Song.Mp3); + + if Song.Cover <> '' then WriteLn(SongFile, '#COVER:' + Song.Cover); + if Song.Background <> '' then WriteLn(SongFile, '#BACKGROUND:' + Song.Background); + if Song.Video <> '' then WriteLn(SongFile, '#VIDEO:' + Song.Video); + if Song.VideoGAP <> 0 then WriteLn(SongFile, '#VIDEOGAP:' + FloatToStr(Song.VideoGAP)); + if Song.Resolution <> 4 then WriteLn(SongFile, '#RESOLUTION:' + IntToStr(Song.Resolution)); + if Song.NotesGAP <> 0 then WriteLn(SongFile, '#NOTESGAP:' + IntToStr(Song.NotesGAP)); + if Song.Start <> 0 then WriteLn(SongFile, '#START:' + FloatToStr(Song.Start)); + if Song.Finish <> 0 then WriteLn(SongFile, '#END:' + IntToStr(Song.Finish)); + if Relative then WriteLn(SongFile, '#RELATIVE:yes'); + + WriteLn(SongFile, '#BPM:' + FloatToStr(Song.BPM[0].BPM / 4)); + WriteLn(SongFile, '#GAP:' + FloatToStr(Song.GAP)); + + RelativeSubTime := 0; + for B := 1 to High(AktSong.BPM) do + WriteLn(SongFile, 'B ' + FloatToStr(AktSong.BPM[B].StartBeat) + ' ' + FloatToStr(AktSong.BPM[B].BPM/4)); + + for C := 0 to Czesc.High do begin + for N := 0 to Czesc.Czesc[C].HighNut do begin + with Czesc.Czesc[C].Nuta[N] do begin + + + //Golden + Freestyle Note Patch + case Czesc.Czesc[C].Nuta[N].Wartosc of + 0: NoteState := 'F '; + 1: NoteState := ': '; + 2: NoteState := '* '; + end; // case + S := NoteState + IntToStr(Start-RelativeSubTime) + ' ' + IntToStr(Dlugosc) + ' ' + IntToStr(Ton) + ' ' + Tekst; + + + WriteLn(SongFile, S); + end; // with + end; // N + + if C < Czesc.High then begin // don't write end of last sentence + if not Relative then + S := '- ' + IntToStr(Czesc.Czesc[C+1].Start) + else begin + S := '- ' + IntToStr(Czesc.Czesc[C+1].Start - RelativeSubTime) + + ' ' + IntToStr(Czesc.Czesc[C+1].Start - RelativeSubTime); + RelativeSubTime := Czesc.Czesc[C+1].Start; + end; + WriteLn(SongFile, S); + end; + + end; // C + + + WriteLn(SongFile, 'E'); + CloseFile(SongFile); +end; + +end. diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index e236abf0..b45e7c2a 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -1,756 +1,777 @@ -unit USongs; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - -uses SysUtils, ULog, UTexture, UCatCovers; - -type - TBPM = record - BPM: real; - StartBeat: real; - end; - - TScore = record - Name: string; - Score: integer; - Length: string; - end; - - TSong = record - Path: string; - Folder: string; // for sorting by folder - FileName: string; - - // sorting methods - Category: array of string; // I think I won't need this - Genre: string; - Edition: string; - Language: string; // 0.5.0: new - - Title: string; - Artist: string; - - Text: string; - Creator: string; - - Cover: string; - CoverTex: TTexture; - Mp3: string; - Background: string; - Video: string; - VideoGAP: real; - VideoLoaded: boolean; // 0.5.0: true if the video has been loaded - NotesGAP: integer; - Start: real; // in seconds - Finish: integer; // in miliseconds - Relative: boolean; - Resolution: integer; - BPM: array of TBPM; - GAP: real; // in miliseconds - - Score: array[0..2] of array of TScore; - - // these are used when sorting is enabled - Visible: boolean; // false if hidden, true if visible - Main: boolean; // false for songs, true for category buttons - OrderNum: integer; // has a number of category for category buttons and songs - OrderTyp: integer; // type of sorting for this button (0=name) - CatNumber: integer; // Count of Songs in Category for Cats and Number of Song in Category for Songs - end; - - TSongs = class - private - BrowsePos: Cardinal; //Actual Pos in Song Array - public - Song: array of TSong; // array of songs - Selected: integer; // selected song index - procedure LoadSongList; // load all songs - procedure BrowseDir(Dir: string); // should return number of songs in the future - procedure Sort(Order: integer); - function FindSongFile(Dir, Mask: string): string; - end; - - TCatSongs = class - Song: array of TSong; // array of categories with songs - Selected: integer; // selected song index - Order: integer; // order type (0=title) - CatNumShow: integer; // Category Number being seen - CatCount: integer; //Number of Categorys - - procedure Refresh; // refreshes arrays by recreating them from Songs array -// procedure Sort(Order: integer); - procedure ShowCategory(Index: integer); // expands all songs in category - procedure HideCategory(Index: integer); // hides all songs in category - procedure ClickCategoryButton(Index: integer); // uses ShowCategory and HideCategory when needed - procedure ShowCategoryList; //Hides all Songs And Show the List of all Categorys - function FindNextVisible(SearchFrom:integer): integer; //Find Next visible Song - function VisibleSongs: integer; // returns number of visible songs (for tabs) - function VisibleIndex(Index: integer): integer; // returns visible song index (skips invisible) - - function SetFilter(FilterStr: String; const fType: Byte): Cardinal; - end; - -var - Songs: TSongs; // all songs - CatSongs: TCatSongs; // categorized songs - AktSong: TSong; // one song *unknown use) - -implementation - -uses StrUtils, - UFiles, - UMain, - UIni; - - -procedure TSongs.LoadSongList; -begin - Log.LogStatus('Initializing', 'LoadSongList'); - - // clear - Setlength(Song, 50); - - BrowsePos := 0; - // browse directories - BrowseDir(SongPath); - - //Set Correct SongArray Length - SetLength(Song, BrowsePos); -// if Ini.Debug = 1 then BrowseDir('D:\Extract\Songs\'); -end; - -procedure TSongs.BrowseDir(Dir: string); -var - SR: TSearchRec; // for parsing Songs Directory - SLen: integer; -begin - if FindFirst(Dir + '*', faDirectory, SR) = 0 then begin - repeat - if (SR.Name <> '.') and (SR.Name <> '..') then - BrowseDir(Dir + Sr.Name + PathDelim); - until FindNext(SR) <> 0; - end; // if - FindClose(SR); - -// Log.LogStatus('Parsing directory: ' + Dir + SR.Name, 'LoadSongList'); - - if FindFirst(Dir + '*.txt', 0, SR) = 0 then - begin - repeat - //New Mod for better Memory Management - -// Log.LogStatus('Parsing file: ' + Dir + SR.Name, 'LoadSongList'); - - - SLen := BrowsePos; - {//Old - SLen := Length(Song); - SetLength(Song, SLen + 1);//} - - Song[SLen].Path := Dir; - Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); - Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); - Song[SLen].FileName := SR.Name; - - if (AnalyseFile(Song[SLen]) = false) then Dec(BrowsePos) - else begin - // scanning complete, file is good - // if there is no cover then try to find it - if Song[SLen].Cover = '' then Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); -// if Song[SLen].Background = '' then begin -// Song[SLen].Background := FindSongFile(Dir, '*[BG].jpg'); -// end; // no needed here} - - // fix by adding path. no, don't fix it. -// if Song[SLen].Cover <> '' then -// Song[SLen].Cover := Song[SLen].Path + Song[SLen].Cover; - end; - - //Change Length Only every 50 Entrys - Inc(BrowsePos); - - if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then - begin - SetLength(Song, Length(Song) + 50); - end; - - until FindNext(SR) <> 0; - end; // if FindFirst - FindClose(SR); -end; - -procedure TSongs.Sort(Order: integer); -var - S: integer; - S2: integer; - TempSong: TSong; -begin - case Order of - sEdition: // by edition - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Edition, Song[S-1].Edition) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sGenre: // by genre - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Genre, Song[S-1].Genre) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sTitle: // by title - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - - end; - sArtist: // by artist - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sFolder: // by folder - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Folder, Song[S-1].Folder) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sTitle2: // by title2 - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - - end; - sArtist2: // by artist2 - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sLanguage: // by Language - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Language, Song[S-1].Language) < 0 then begin - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - - end; // case -end; - -function TSongs.FindSongFile(Dir, Mask: string): string; -var - SR: TSearchRec; // for parsing song directory -begin - Result := ''; - if FindFirst(Dir + Mask, faDirectory, SR) = 0 then begin - Result := SR.Name; - end; // if - FindClose(SR); -end; - -procedure TCatSongs.Refresh; -var - S: integer; // temporary song index - CatLen: integer; // length of CatSongs.Song - Letter: char; // current letter for sorting using letter - SS: string; // current edition for sorting using edition, genre etc. - Order: integer; // number used for ordernum - Letter2: char; // - CatNumber:integer; // Number of Song in Category -begin - CatNumShow := -1; -// Songs.Sort(0); // by title - -case Ini.Sorting of - sEdition: begin - Songs.Sort(sArtist); - Songs.Sort(sEdition); - end; - sGenre: begin - Songs.Sort(sArtist); - Songs.Sort(sGenre); - end; - sLanguage: begin - Songs.Sort(sArtist); - Songs.Sort(sLanguage); - end; - sFolder: begin - Songs.Sort(sArtist); - Songs.Sort(sFolder); - end; - sTitle: Songs.Sort(sTitle); - sArtist: Songs.Sort(sArtist); - sTitle2: Songs.Sort(sTitle2); // by title2 - sArtist2: Songs.Sort(sArtist2); // by artist2 - - end; // case - - - Letter := ' '; - SS := ''; - Order := 0; - CatNumber := 0; - - //Songs leeren - SetLength (Song, 0); - - for S := Low(Songs.Song) to High(Songs.Song) do begin - if (Ini.Tabs = 1) then - if (Ini.Sorting = sEdition) and (CompareText(SS, Songs.Song[S].Edition) <> 0) then begin - // add Category Button - Inc(Order); - SS := Songs.Song[S].Edition; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + SS + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - - - // 0.4.3 - // if SS = 'Singstar' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Part 2' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar German' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Spanish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Italian' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar French' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Party' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Party.jpg'; - // if SS = 'Singstar Popworld' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Popworld.jpg'; - // if SS = 'Singstar 80s' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; - // if SS = 'Singstar 80s Polish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; - // if SS = 'Singstar Rocks' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Rocks.jpg'; - // if SS = 'Singstar Anthems' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Anthems.jpg'; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';//} - - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sGenre) and (CompareText(SS, Songs.Song[S].Genre) <> 0) then begin - // add Genre Button - Inc(Order); - SS := Songs.Song[S].Genre; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sLanguage) and (CompareText(SS, Songs.Song[S].Language) <> 0) then begin - // add Language Button - Inc(Order); - SS := Songs.Song[S].Language; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sTitle) and (Length(Songs.Song[S].Title)>=1) and (Letter <> UpCase(Songs.Song[S].Title[1])) then begin - // add a letter Category Button - Inc(Order); - Letter := UpCase(Songs.Song[S].Title[1]); - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - - {// cover-patch - if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sArtist) and (Length(Songs.Song[S].Artist)>=1) and (Letter <> UpCase(Songs.Song[S].Artist[1])) then begin - // add a letter Category Button - Inc(Order); - Letter := UpCase(Songs.Song[S].Artist[1]); - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sFolder) and (CompareText(SS, Songs.Song[S].Folder) <> 0) then begin - // 0.5.0: add folder tab - Inc(Order); - SS := Songs.Song[S].Folder; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sTitle2) AND (Length(Songs.Song[S].Title)>=1) then begin - if (ord(Songs.Song[S].Title[1]) > 47) and (ord(Songs.Song[S].Title[1]) < 58) then Letter2 := '#' else Letter2 := UpCase(Songs.Song[S].Title[1]); - if (Letter <> Letter2) then begin - // add a letter Category Button - Inc(Order); - Letter := Letter2; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end; - end - - else if (Ini.Sorting = sArtist2) AND (Length(Songs.Song[S].Artist)>=1) then begin - if (ord(Songs.Song[S].Artist[1]) > 47) and (ord(Songs.Song[S].Artist[1]) < 58) then Letter2 := '#' else Letter2 := UpCase(Songs.Song[S].Artist[1]); - if (Letter <> Letter2) then begin - // add a letter Category Button - Inc(Order); - Letter := Letter2; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end; - end; - - - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - - Inc (CatNumber); //Increase Number in Cat - - CatSongs.Song[CatLen] := Songs.Song[S]; - CatSongs.Song[CatLen].OrderNum := Order; // assigns category - CatSongs.Song[CatLen].CatNumber := CatNumber; - - if (Ini.Tabs = 0) then CatSongs.Song[CatLen].Visible := true - else if (Ini.Tabs = 1) then CatSongs.Song[CatLen].Visible := false; -// if (Ini.Tabs = 1) and (Order = 1) then CatSongs.Song[CatLen].Visible := true; // open first tab -//CatSongs.Song[CatLen].Visible := true; - - end; -//CatNumber Patch - Set CatNumber of Last Category -if (ini.Tabs_at_startup = 1) And (high(Song) >=1) then - Song[CatLen - CatNumber].CatNumber := CatNumber;//Set CatNumber of Categroy -//CatCount Patch -CatCount := Order; -end; - -procedure TCatSongs.ShowCategory(Index: integer); -var - S: integer; // song -begin - CatNumShow := Index; - for S := 0 to high(CatSongs.Song) do - begin - if (CatSongs.Song[S].OrderNum = Index) AND (Not CatSongs.Song[S].Main) then - CatSongs.Song[S].Visible := true - else - CatSongs.Song[S].Visible := false; - end; -end; - -procedure TCatSongs.HideCategory(Index: integer); // hides all songs in category -var - S: integer; // song -begin - for S := 0 to high(CatSongs.Song) do begin - if not CatSongs.Song[S].Main then - CatSongs.Song[S].Visible := false // hides all at now - end; -end; - -procedure TCatSongs.ClickCategoryButton(Index: integer); -var - Num, S: integer; -begin - Num := CatSongs.Song[Index].OrderNum; - if Num <> CatNumShow then - begin - ShowCategory(Num); - end - else begin - ShowCategoryList; - end; -end; - -//Hide Categorys when in Category Hack -procedure TCatSongs.ShowCategoryList; -var - Num, S: integer; -begin - //Hide All Songs Show All Cats - for S := 0 to high(CatSongs.Song) do begin - if CatSongs.Song[S].Main then - CatSongs.Song[S].Visible := true - else - CatSongs.Song[S].Visible := false - end; - CatSongs.Selected := CatNumShow; //Show last shown Category - CatNumShow := -1; -end; -//Hide Categorys when in Category Hack End - -//Wrong song selected when tabs on bug -function TCatSongs.FindNextVisible(SearchFrom:integer): integer;//Find next Visible Song -var - I: Integer; - begin - Result := -1; - I := SearchFrom + 1; - while not CatSongs.Song[I].Visible do - begin - Inc (I); - if (I>high(CatSongs.Song)) then - I := low(CatSongs.Song); - if (I = SearchFrom) then //Make One Round and no song found->quit - break; - end; - end; -//Wrong song selected when tabs on bug End - -function TCatSongs.VisibleSongs: integer; -var - S: integer; // song -begin - Result := 0; - for S := 0 to high(CatSongs.Song) do - if CatSongs.Song[S].Visible = true then Inc(Result); -end; - -function TCatSongs.VisibleIndex(Index: integer): integer; -var - S: integer; // song -begin - Result := 0; - for S := 0 to Index-1 do - if CatSongs.Song[S].Visible = true then Inc(Result); -end; - -function TCatSongs.SetFilter(FilterStr: String; const fType: Byte): Cardinal; -var - I, J: Integer; - cString: String; - SearchStr: Array of String; -begin - {fType: 0: All - 1: Title - 2: Artist} - FilterStr := Trim(FilterStr); - if FilterStr<>'' then begin - Result := 0; - //Create Search Array - SetLength(SearchStr, 1); - I := Pos (' ', FilterStr); - While (I <> 0) do - begin - SetLength (SearchStr, Length(SearchStr) + 1); - cString := Copy(FilterStr, 1, I-1); - if (cString <> ' ') AND (cString <> '') then - SearchStr[High(SearchStr)-1] := cString; - Delete (FilterStr, 1, I); - - I := Pos (' ', FilterStr); - end; - //Copy last Word - if (FilterStr <> ' ') AND (FilterStr <> '') then - SearchStr[High(SearchStr)] := FilterStr; - - for I:=0 to High(Song) do begin - if not Song[i].Main then - begin - case fType of - 0: cString := Song[I].Artist + ' ' + Song[i].Title + ' ' + Song[i].Folder; - 1: cString := Song[I].Title; - 2: cString := Song[I].Artist; - end; - Song[i].Visible:=True; - //Look for every Searched Word - For J := 0 to High(SearchStr) do - begin - Song[i].Visible := Song[i].Visible AND AnsiContainsText(cString, SearchStr[J]) - end; - if Song[i].Visible then - Inc(Result); - end - else - Song[i].Visible:=False; - end; - CatNumShow := -2; - end - else begin - for i:=0 to High(Song) do begin - Song[i].Visible:=(Ini.Tabs=1)=Song[i].Main; - CatNumShow := -1; - end; - Result := 0; - end; -end; - -end. +unit USongs; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +uses SysUtils, + oldlinux, + ULog, + UTexture, + UCatCovers; + +type + + TBPM = record + BPM: real; + StartBeat: real; + end; + + TScore = record + Name: string; + Score: integer; + Length: string; + end; + + TSong = record + Path: string; + Folder: string; // for sorting by folder + FileName: string; + + // sorting methods + Category: array of string; // I think I won't need this + Genre: string; + Edition: string; + Language: string; // 0.5.0: new + + Title: string; + Artist: string; + + Text: string; + Creator: string; + + Cover: string; + CoverTex: TTexture; + Mp3: string; + Background: string; + Video: string; + VideoGAP: real; + VideoLoaded: boolean; // 0.5.0: true if the video has been loaded + NotesGAP: integer; + Start: real; // in seconds + Finish: integer; // in miliseconds + Relative: boolean; + Resolution: integer; + BPM: array of TBPM; + GAP: real; // in miliseconds + + Score: array[0..2] of array of TScore; + + // these are used when sorting is enabled + Visible: boolean; // false if hidden, true if visible + Main: boolean; // false for songs, true for category buttons + OrderNum: integer; // has a number of category for category buttons and songs + OrderTyp: integer; // type of sorting for this button (0=name) + CatNumber: integer; // Count of Songs in Category for Cats and Number of Song in Category for Songs + end; + + TSongs = class + private + BrowsePos: Cardinal; //Actual Pos in Song Array + public + Song: array of TSong; // array of songs + Selected: integer; // selected song index + procedure LoadSongList; // load all songs + procedure BrowseDir(Dir: widestring); // should return number of songs in the future + procedure Sort(Order: integer); + function FindSongFile(Dir, Mask: string): string; + end; + + TCatSongs = class + Song: array of TSong; // array of categories with songs + Selected: integer; // selected song index + Order: integer; // order type (0=title) + CatNumShow: integer; // Category Number being seen + CatCount: integer; //Number of Categorys + + procedure Refresh; // refreshes arrays by recreating them from Songs array +// procedure Sort(Order: integer); + procedure ShowCategory(Index: integer); // expands all songs in category + procedure HideCategory(Index: integer); // hides all songs in category + procedure ClickCategoryButton(Index: integer); // uses ShowCategory and HideCategory when needed + procedure ShowCategoryList; //Hides all Songs And Show the List of all Categorys + function FindNextVisible(SearchFrom:integer): integer; //Find Next visible Song + function VisibleSongs: integer; // returns number of visible songs (for tabs) + function VisibleIndex(Index: integer): integer; // returns visible song index (skips invisible) + + function SetFilter(FilterStr: String; const fType: Byte): Cardinal; + end; + +var + Songs: TSongs; // all songs + CatSongs: TCatSongs; // categorized songs + AktSong: TSong; // one song *unknown use) + +implementation + +uses StrUtils, + UFiles, + UMain, + UIni; + + +procedure TSongs.LoadSongList; +begin + Log.LogStatus('Initializing', 'LoadSongList'); + + // clear + Setlength(Song, 50); + + BrowsePos := 0; + // browse directories + BrowseDir(SongPath); + + //Set Correct SongArray Length + SetLength(Song, BrowsePos); +// if Ini.Debug = 1 then BrowseDir('D:\Extract\Songs\'); +end; + +procedure TSongs.BrowseDir(Dir: widestring); +var + SR: TSearchRec; // for parsing Songs Directory + SLen: integer; + + TheDir : pdir; + ADirent :pDirent; + Entry : Longint; + info : stat; +begin + {$ifdef win32} + if FindFirst(Dir + '*', faDirectory, SR) = 0 then // JB_Unicode - windows + begin + repeat + if (SR.Name <> '.') and (SR.Name <> '..') then + begin + BrowseDir(Dir + Sr.Name + PathDelim); + end + until FindNext(SR) <> 0; + end; // if + FindClose(SR); + {$else} + // Itterate the Songs Directory... ( With unicode capable functions for linux ) + TheDir := opendir( Dir ); // JB_Unicode - linux + if TheDir <> nil then + begin + repeat + ADirent := ReadDir(TheDir); + + If ADirent<>Nil then + begin + With ADirent^ do + begin + + if ( name[0] <> '.') then + BrowseDir( Dir + name + pathdelim ); + + end; + end; + Until ADirent=Nil; + end; + {$endif} + +// Log.LogStatus('Parsing directory: ' + Dir + SR.Name, 'LoadSongList'); + + if FindFirst(Dir + '*.txt', 0, SR) = 0 then + begin + repeat + SLen := BrowsePos; + + Song[SLen].Path := Dir; + Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); + Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); + Song[SLen].FileName := SR.Name; + + if (AnalyseFile(Song[SLen]) = false) then + Dec(BrowsePos) + else + begin + if Song[SLen].Cover = '' then + Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); + end; + + //Change Length Only every 50 Entrys + Inc(BrowsePos); + + if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then + begin + SetLength(Song, Length(Song) + 50); + end; + + until FindNext(SR) <> 0; + end; // if FindFirst + FindClose(SR); +end; + +procedure TSongs.Sort(Order: integer); +var + S: integer; + S2: integer; + TempSong: TSong; +begin + case Order of + sEdition: // by edition + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Edition, Song[S-1].Edition) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sGenre: // by genre + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Genre, Song[S-1].Genre) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sTitle: // by title + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + + end; + sArtist: // by artist + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sFolder: // by folder + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Folder, Song[S-1].Folder) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sTitle2: // by title2 + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + + end; + sArtist2: // by artist2 + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sLanguage: // by Language + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Language, Song[S-1].Language) < 0 then begin + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + + end; // case +end; + +function TSongs.FindSongFile(Dir, Mask: string): string; +var + SR: TSearchRec; // for parsing song directory +begin + Result := ''; + if FindFirst(Dir + Mask, faDirectory, SR) = 0 then begin + Result := SR.Name; + end; // if + FindClose(SR); +end; + +procedure TCatSongs.Refresh; +var + S: integer; // temporary song index + CatLen: integer; // length of CatSongs.Song + Letter: char; // current letter for sorting using letter + SS: string; // current edition for sorting using edition, genre etc. + Order: integer; // number used for ordernum + Letter2: char; // + CatNumber:integer; // Number of Song in Category +begin + CatNumShow := -1; +// Songs.Sort(0); // by title + +case Ini.Sorting of + sEdition: begin + Songs.Sort(sArtist); + Songs.Sort(sEdition); + end; + sGenre: begin + Songs.Sort(sArtist); + Songs.Sort(sGenre); + end; + sLanguage: begin + Songs.Sort(sArtist); + Songs.Sort(sLanguage); + end; + sFolder: begin + Songs.Sort(sArtist); + Songs.Sort(sFolder); + end; + sTitle: Songs.Sort(sTitle); + sArtist: Songs.Sort(sArtist); + sTitle2: Songs.Sort(sTitle2); // by title2 + sArtist2: Songs.Sort(sArtist2); // by artist2 + + end; // case + + + Letter := ' '; + SS := ''; + Order := 0; + CatNumber := 0; + + //Songs leeren + SetLength (Song, 0); + + for S := Low(Songs.Song) to High(Songs.Song) do begin + if (Ini.Tabs = 1) then + if (Ini.Sorting = sEdition) and (CompareText(SS, Songs.Song[S].Edition) <> 0) then begin + // add Category Button + Inc(Order); + SS := Songs.Song[S].Edition; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + SS + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + + + // 0.4.3 + // if SS = 'Singstar' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Part 2' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar German' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Spanish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Italian' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar French' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Party' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Party.jpg'; + // if SS = 'Singstar Popworld' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Popworld.jpg'; + // if SS = 'Singstar 80s' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; + // if SS = 'Singstar 80s Polish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; + // if SS = 'Singstar Rocks' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Rocks.jpg'; + // if SS = 'Singstar Anthems' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Anthems.jpg'; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';//} + + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sGenre) and (CompareText(SS, Songs.Song[S].Genre) <> 0) then begin + // add Genre Button + Inc(Order); + SS := Songs.Song[S].Genre; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sLanguage) and (CompareText(SS, Songs.Song[S].Language) <> 0) then begin + // add Language Button + Inc(Order); + SS := Songs.Song[S].Language; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sTitle) and (Length(Songs.Song[S].Title)>=1) and (Letter <> UpCase(Songs.Song[S].Title[1])) then begin + // add a letter Category Button + Inc(Order); + Letter := UpCase(Songs.Song[S].Title[1]); + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + + {// cover-patch + if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sArtist) and (Length(Songs.Song[S].Artist)>=1) and (Letter <> UpCase(Songs.Song[S].Artist[1])) then begin + // add a letter Category Button + Inc(Order); + Letter := UpCase(Songs.Song[S].Artist[1]); + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sFolder) and (CompareText(SS, Songs.Song[S].Folder) <> 0) then begin + // 0.5.0: add folder tab + Inc(Order); + SS := Songs.Song[S].Folder; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sTitle2) AND (Length(Songs.Song[S].Title)>=1) then begin + if (ord(Songs.Song[S].Title[1]) > 47) and (ord(Songs.Song[S].Title[1]) < 58) then Letter2 := '#' else Letter2 := UpCase(Songs.Song[S].Title[1]); + if (Letter <> Letter2) then begin + // add a letter Category Button + Inc(Order); + Letter := Letter2; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end; + end + + else if (Ini.Sorting = sArtist2) AND (Length(Songs.Song[S].Artist)>=1) then begin + if (ord(Songs.Song[S].Artist[1]) > 47) and (ord(Songs.Song[S].Artist[1]) < 58) then Letter2 := '#' else Letter2 := UpCase(Songs.Song[S].Artist[1]); + if (Letter <> Letter2) then begin + // add a letter Category Button + Inc(Order); + Letter := Letter2; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end; + end; + + + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + + Inc (CatNumber); //Increase Number in Cat + + CatSongs.Song[CatLen] := Songs.Song[S]; + CatSongs.Song[CatLen].OrderNum := Order; // assigns category + CatSongs.Song[CatLen].CatNumber := CatNumber; + + if (Ini.Tabs = 0) then CatSongs.Song[CatLen].Visible := true + else if (Ini.Tabs = 1) then CatSongs.Song[CatLen].Visible := false; +// if (Ini.Tabs = 1) and (Order = 1) then CatSongs.Song[CatLen].Visible := true; // open first tab +//CatSongs.Song[CatLen].Visible := true; + + end; +//CatNumber Patch - Set CatNumber of Last Category +if (ini.Tabs_at_startup = 1) And (high(Song) >=1) then + Song[CatLen - CatNumber].CatNumber := CatNumber;//Set CatNumber of Categroy +//CatCount Patch +CatCount := Order; +end; + +procedure TCatSongs.ShowCategory(Index: integer); +var + S: integer; // song +begin + CatNumShow := Index; + for S := 0 to high(CatSongs.Song) do + begin + if (CatSongs.Song[S].OrderNum = Index) AND (Not CatSongs.Song[S].Main) then + CatSongs.Song[S].Visible := true + else + CatSongs.Song[S].Visible := false; + end; +end; + +procedure TCatSongs.HideCategory(Index: integer); // hides all songs in category +var + S: integer; // song +begin + for S := 0 to high(CatSongs.Song) do begin + if not CatSongs.Song[S].Main then + CatSongs.Song[S].Visible := false // hides all at now + end; +end; + +procedure TCatSongs.ClickCategoryButton(Index: integer); +var + Num, S: integer; +begin + Num := CatSongs.Song[Index].OrderNum; + if Num <> CatNumShow then + begin + ShowCategory(Num); + end + else begin + ShowCategoryList; + end; +end; + +//Hide Categorys when in Category Hack +procedure TCatSongs.ShowCategoryList; +var + Num, S: integer; +begin + //Hide All Songs Show All Cats + for S := 0 to high(CatSongs.Song) do begin + if CatSongs.Song[S].Main then + CatSongs.Song[S].Visible := true + else + CatSongs.Song[S].Visible := false + end; + CatSongs.Selected := CatNumShow; //Show last shown Category + CatNumShow := -1; +end; +//Hide Categorys when in Category Hack End + +//Wrong song selected when tabs on bug +function TCatSongs.FindNextVisible(SearchFrom:integer): integer;//Find next Visible Song +var + I: Integer; + begin + Result := -1; + I := SearchFrom + 1; + while not CatSongs.Song[I].Visible do + begin + Inc (I); + if (I>high(CatSongs.Song)) then + I := low(CatSongs.Song); + if (I = SearchFrom) then //Make One Round and no song found->quit + break; + end; + end; +//Wrong song selected when tabs on bug End + +function TCatSongs.VisibleSongs: integer; +var + S: integer; // song +begin + Result := 0; + for S := 0 to high(CatSongs.Song) do + if CatSongs.Song[S].Visible = true then Inc(Result); +end; + +function TCatSongs.VisibleIndex(Index: integer): integer; +var + S: integer; // song +begin + Result := 0; + for S := 0 to Index-1 do + if CatSongs.Song[S].Visible = true then Inc(Result); +end; + +function TCatSongs.SetFilter(FilterStr: String; const fType: Byte): Cardinal; +var + I, J: Integer; + cString: String; + SearchStr: Array of String; +begin + {fType: 0: All + 1: Title + 2: Artist} + FilterStr := Trim(FilterStr); + if FilterStr<>'' then begin + Result := 0; + //Create Search Array + SetLength(SearchStr, 1); + I := Pos (' ', FilterStr); + While (I <> 0) do + begin + SetLength (SearchStr, Length(SearchStr) + 1); + cString := Copy(FilterStr, 1, I-1); + if (cString <> ' ') AND (cString <> '') then + SearchStr[High(SearchStr)-1] := cString; + Delete (FilterStr, 1, I); + + I := Pos (' ', FilterStr); + end; + //Copy last Word + if (FilterStr <> ' ') AND (FilterStr <> '') then + SearchStr[High(SearchStr)] := FilterStr; + + for I:=0 to High(Song) do begin + if not Song[i].Main then + begin + case fType of + 0: cString := Song[I].Artist + ' ' + Song[i].Title + ' ' + Song[i].Folder; + 1: cString := Song[I].Title; + 2: cString := Song[I].Artist; + end; + Song[i].Visible:=True; + //Look for every Searched Word + For J := 0 to High(SearchStr) do + begin + Song[i].Visible := Song[i].Visible AND AnsiContainsText(cString, SearchStr[J]) + end; + if Song[i].Visible then + Inc(Result); + end + else + Song[i].Visible:=False; + end; + CatNumShow := -2; + end + else begin + for i:=0 to High(Song) do begin + Song[i].Visible:=(Ini.Tabs=1)=Song[i].Main; + CatNumShow := -1; + end; + Result := 0; + end; +end; + +end. -- cgit v1.2.3 From 17d2f56fb988150dafcb6fab9dff45cc484e5b0a Mon Sep 17 00:00:00 2001 From: jaybinks Date: Fri, 26 Oct 2007 07:04:58 +0000 Subject: did some major work towards ffmpeg audio playback. still not working 100% needs code to be re-compared to original C Source because I Suspect there are some translation errors. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@529 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudio_FFMpeg.pas | 690 +++++++++++++++++++++++++----------- Game/Code/UltraStar.lpr | 14 +- 2 files changed, 487 insertions(+), 217 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudio_FFMpeg.pas b/Game/Code/Classes/UAudio_FFMpeg.pas index 959d904a..548fb343 100644 --- a/Game/Code/Classes/UAudio_FFMpeg.pas +++ b/Game/Code/Classes/UAudio_FFMpeg.pas @@ -1,5 +1,14 @@ unit UAudio_FFMpeg; +(******************************************************************************* + +This unit is primarily based upon - + http://www.dranger.com/ffmpeg/ffmpegtutorial_all.html + + and tutorial03.c + +*******************************************************************************) + interface {$IFDEF FPC} @@ -16,37 +25,76 @@ uses Classes, {$IFNDEF FPC} Forms, {$ENDIF} + avcodec, // FFMpeg Audio file decoding + avformat, + avutil, + SDL, // Used for Audio output Interface ULog, UMusic; +type + TPacketQueue = record + first_pkt , + last_pkt : pAVPacketList; + nb_packets : integer; + size : integer; + mutex : pSDL_mutex; + cond : pSDL_cond; + end; + pPacketQueue = ^TPacketQueue; + + function packet_queue_put(var aPacketQueue : TPacketQueue; var AVPacket : TAVPacket): integer; + function packet_queue_get(var aPacketQueue : TPacketQueue; var AVPacket : TAVPacket; block : integer ): integer; + procedure packet_queue_init( var aPacketQueue : TPacketQueue ); + procedure audio_callback( userdata: Pointer; stream: PUInt8; len: Integer ); cdecl; + function audio_decode_frame(aCodecCtx : TAVCodecContext; audio_buf : PUInt8; buf_size: integer): integer; + +var + singleton_MusicFFMpeg : IAudioPlayback = nil; + + implementation uses {$IFDEF FPC} lclintf, {$ENDIF} - URecord, + libc, +// URecord, UIni, UMain, UThemes; +//var +// singleton_MusicFFMpeg : IAudioPlayback = nil; + + const RecordSystem = 1; + SDL_AUDIO_BUFFER_SIZE = 1024; + type - TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, - mpPaused, mpOpen); + TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, mpPaused, mpOpen); + + const ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); +var + audioq : TPacketQueue; + quit : integer = 0; + + type TAudio_ffMpeg = class( TInterfacedObject, IAudioPlayback ) private - BassStart: hStream; // Wait, I've replaced this with BASS - BassBack: hStream; // It has almost all features we need + + BassStart: hStream; + BassBack: hStream; BassSwoosh: hStream; - BassChange: hStream; // Almost? It aleady has them all :) + BassChange: hStream; BassOption: hStream; BassClick: hStream; BassDrum: hStream; @@ -60,11 +108,12 @@ type Loop: boolean; fHWND: THandle; + function find_stream_ids( const aFormatCtx : PAVFormatContext; Out aFirstVideoStream, aFirstAudioStream : integer ): boolean; public - Bass: hStream; +// Bass: hStream; + constructor create(); function GetName: String; procedure InitializePlayback; - procedure InitializeRecord; procedure SetVolume(Volume: integer); procedure SetMusicVolume(Volume: integer); procedure SetLoop(Enabled: boolean); @@ -77,7 +126,7 @@ type procedure Close; function Finished: boolean; function Length: real; - function Position: real; + function getPosition: real; procedure PlayStart; procedure PlayBack; procedure PlaySwoosh; @@ -89,9 +138,9 @@ type procedure PlayClap; procedure PlayShuffle; procedure StopShuffle; - procedure CaptureStart; - procedure CaptureStop; - procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); +// procedure CaptureStart; +// procedure CaptureStop; +// procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); procedure StopCard(Card: byte); function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; @@ -103,141 +152,83 @@ type procedure PlayCustomSound(const Index: Cardinal ); end; -var - singleton_MusicFFMpeg : IAudioPlayback; - -function TAudio_ffMpeg.GetName: String; +constructor TAudio_ffMpeg.create(); begin - result := 'FFMpeg'; + writeln( 'UVideo_FFMpeg - av_register_all' ); + av_register_all; end; -procedure TAudio_ffMpeg.InitializePlayback; +function TAudio_ffMpeg.find_stream_ids( const aFormatCtx : PAVFormatContext; Out aFirstVideoStream, aFirstAudioStream : integer ): boolean; var - Pet: integer; - S: integer; + i : integer; + st : pAVStream; begin - Log.BenchmarkStart(4); - Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); - - Loaded := false; - Loop := false; + // Find the first video stream + aFirstAudioStream := -1; + aFirstVideoStream := -1; - {$ifdef win32} - // TODO : JB_Linux ... is this needed ? :) - fHWND := AllocateHWND( nil); // TODO : JB_lazarus - can we do something different here ?? lazarus didnt like this function - {$ENDIF} - - // TODO : jb_linux replace with something other than bass - if not BASS_Init(1, 44100, 0, fHWND, nil) then + i := 0; + while ( i < aFormatCtx.nb_streams ) do begin - {$IFNDEF FPC} - // TODO : JB_linux find a way to do this nice.. - Application.MessageBox ('Could not initialize BASS', 'Error'); - {$ENDIF} - Exit; - end; + writeln( ' aFormatCtx.streams[i] : ' + inttostr( i ) ); + st := aFormatCtx.streams[i]; - Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); + if(st.codec.codec_type = CODEC_TYPE_VIDEO ) AND + (aFirstVideoStream < 0) THEN + begin + writeln( 'Found Video Stream' ); + aFirstVideoStream := i; + end; - // config playing buffer -// BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); -// BASS_SetConfig(BASS_CONFIG_BUFFER, 100); + if ( st.codec.codec_type = CODEC_TYPE_AUDIO ) AND + ( aFirstAudioStream < 0) THEN + begin + writeln( 'Found Audio Stream' ); + aFirstAudioStream := i; + end; - Log.LogStatus('Loading Sounds', 'Music Initialize'); + inc( i ); + end; // while - Log.BenchmarkStart(4); - LoadSoundFromFile(BassStart, SoundPath + 'Common Start.mp3'); - LoadSoundFromFile(BassBack, SoundPath + 'Common Back.mp3'); - LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3'); - LoadSoundFromFile(BassChange, SoundPath + 'select music change music 50.mp3'); - LoadSoundFromFile(BassOption, SoundPath + 'option change col.mp3'); - LoadSoundFromFile(BassClick, SoundPath + 'rimshot022b.mp3'); - -// LoadSoundFromFile(BassDrum, SoundPath + 'bassdrumhard076b.mp3'); -// LoadSoundFromFile(BassHihat, SoundPath + 'hihatclosed068b.mp3'); -// LoadSoundFromFile(BassClap, SoundPath + 'claps050b.mp3'); + result := (aFirstAudioStream > -1) OR + (aFirstVideoStream > -1) ; // Didn't find any streams stream +end; -// LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3'); - Log.BenchmarkEnd(4); - Log.LogBenchmark('--> Loading Sounds', 4); +function TAudio_ffMpeg.GetName: String; +begin + result := 'FFMpeg'; end; -procedure TAudio_ffMpeg.InitializeRecord; +procedure TAudio_ffMpeg.InitializePlayback; var - S: integer; - device: integer; - descr: string; - input: integer; - input2: integer; - flags: integer; - mic: array[0..15] of integer; - SC: integer; // soundcard - SCI: integer; // soundcard input -begin - if RecordSystem = 1 then begin - SetLength(Sound, 6 {max players});//Ini.Players+1); - for S := 0 to High(Sound) do begin //Ini.Players do begin - Sound[S] := TSound.Create; - Sound[S].Num := S; - Sound[S].BufferNew := TMemoryStream.Create; - SetLength(Sound[S].BufferLong, 1); - Sound[S].BufferLong[0] := TMemoryStream.Create; - Sound[S].n := 4*1024; - end; - - - // check for recording devices; - {device := 0; - descr := BASS_RecordGetDeviceDescription(device); - - SetLength(SoundCard, 0); - while (descr <> '') do begin - SC := High(SoundCard) + 1; - SetLength(SoundCard, SC+1); - - Log.LogAnalyze('Device #'+IntToStr(device)+': '+ descr); - SoundCard[SC].Description := Descr; - - // check for recording inputs - mic[device] := -1; // default to no change - input := 0; - BASS_RecordInit(device); - Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); - flags := BASS_RecordGetInput(input); - - SetLength(SoundCard[SC].Input, 0); - while (flags <> -1) do begin - SCI := High(SoundCard[SC].Input) + 1; - SetLength(SoundCard[SC].Input, SCI+1); +// Pet: integer; + S: integer; +begin - Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); - SoundCard[SC].Input[SCI].Name := BASS_RecordGetInputName(Input); + LoadSoundFromFile(BassStart, SoundPath + 'foo fighters - best of you.mp3'); - if (flags and BASS_INPUT_TYPE_MASK) = BASS_INPUT_TYPE_MIC then begin - mic[device] := input; // auto set microphone - end; - Inc(Input); - flags := BASS_RecordGetInput(input); - end; +(* + LoadSoundFromFile(BassStart, SoundPath + 'Common start.mp3'); + LoadSoundFromFile(BassBack, SoundPath + 'Common back.mp3'); + LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3'); + LoadSoundFromFile(BassChange, SoundPath + 'select music change music 50.mp3'); + LoadSoundFromFile(BassOption, SoundPath + 'option change col.mp3'); + LoadSoundFromFile(BassClick, SoundPath + 'rimshot022b.mp3'); - if mic[device] <> -1 then begin - Log.LogAnalyze('Found the mic at input ' + IntToStr(Mic[device])) - end else begin - Log.LogAnalyze('Mic not found'); - mic[device] := 0; // setting to the first one (for kxproject) - end; - SoundCard[SC].InputSeleceted := Mic[Device]; + LoadSoundFromFile(BassDrum, SoundPath + 'bassdrumhard076b.mp3'); + LoadSoundFromFile(BassHihat, SoundPath + 'hihatclosed068b.mp3'); + LoadSoundFromFile(BassClap, SoundPath + 'claps050b.mp3'); +*) +// LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3'); - BASS_RecordFree; +// Log.BenchmarkEnd(4); +// Log.LogBenchmark('--> Loading Sounds', 4); - inc(Device); - descr := BASS_RecordGetDeviceDescription(Device); - end; // while} - end; // if end; + procedure TAudio_ffMpeg.SetVolume(Volume: integer); begin //Old Sets Wave Volume @@ -246,9 +237,11 @@ begin // TODO : jb_linux replace with something other than bass +(* BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); +*) end; procedure TAudio_ffMpeg.SetMusicVolume(Volume: Integer); @@ -263,7 +256,7 @@ begin //Set Volume // TODO : jb_linux replace with something other than bass - BASS_ChannelSetAttributes (Bass, -1, Volume, -101); +// BASS_ChannelSetAttributes (Bass, -1, Volume, -101); end; procedure TAudio_ffMpeg.SetLoop(Enabled: boolean); @@ -277,11 +270,11 @@ begin if FileExists(Name) then begin // TODO : jb_linux replace with something other than bass - Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); +// Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); Loaded := true; //Set Max Volume - SetMusicVolume (100); +// SetMusicVolume (100); end; Result := Loaded; @@ -289,7 +282,8 @@ end; procedure TAudio_ffMpeg.Rewind; begin - if Loaded then begin + if Loaded then + begin end; end; @@ -298,12 +292,13 @@ var bytes: integer; begin // TODO : jb_linux replace with something other than bass - bytes := BASS_ChannelSeconds2Bytes(Bass, Time); - BASS_ChannelSetPosition(Bass, bytes); +// bytes := BASS_ChannelSeconds2Bytes(Bass, Time); +// BASS_ChannelSetPosition(Bass, bytes); end; procedure TAudio_ffMpeg.Play; begin +(* // TODO : jb_linux replace with something other than bass if Loaded then begin @@ -312,26 +307,27 @@ begin BASS_ChannelPlay(Bass, False); // for setting position before playing end; +*) end; procedure TAudio_ffMpeg.Pause; //Pause Mod begin +(* // TODO : jb_linux replace with something other than bass if Loaded then begin BASS_ChannelPause(Bass); // Pauses Song end; +*) end; procedure TAudio_ffMpeg.Stop; begin - // TODO : jb_linux replace with something other than bass - Bass_ChannelStop(Bass); +// Bass_ChannelStop(Bass); end; procedure TAudio_ffMpeg.Close; begin - // TODO : jb_linux replace with something other than bass - Bass_StreamFree(Bass); +// Bass_StreamFree(Bass); end; function TAudio_ffMpeg.Length: real; @@ -339,183 +335,344 @@ var bytes: integer; begin Result := 60; - +(* // TODO : jb_linux replace with something other than bass bytes := BASS_ChannelGetLength(Bass); Result := BASS_ChannelBytes2Seconds(Bass, bytes); +*) end; -function TAudio_ffMpeg.Position: real; +function TAudio_ffMpeg.getPosition: real; var bytes: integer; begin Result := 0; +(* // TODO : jb_linux replace with something other than bass bytes := BASS_ChannelGetPosition(BASS); Result := BASS_ChannelBytes2Seconds(BASS, bytes); +*) end; function TAudio_ffMpeg.Finished: boolean; begin Result := false; +(* // TODO : jb_linux replace with something other than bass if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then begin Result := true; end; +*) end; procedure TAudio_ffMpeg.PlayStart; begin // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassStart, True); +// BASS_ChannelPlay(BassStart, True); end; procedure TAudio_ffMpeg.PlayBack; begin // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassBack, True);// then +// BASS_ChannelPlay(BassBack, True);// then end; procedure TAudio_ffMpeg.PlaySwoosh; begin // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassSwoosh, True); +// BASS_ChannelPlay(BassSwoosh, True); + + end; procedure TAudio_ffMpeg.PlayChange; begin // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassChange, True); +// BASS_ChannelPlay(BassChange, True); end; procedure TAudio_ffMpeg.PlayOption; begin // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassOption, True); +// BASS_ChannelPlay(BassOption, True); end; procedure TAudio_ffMpeg.PlayClick; begin // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassClick, True); +// BASS_ChannelPlay(BassClick, True); end; procedure TAudio_ffMpeg.PlayDrum; begin // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassDrum, True); +// BASS_ChannelPlay(BassDrum, True); end; procedure TAudio_ffMpeg.PlayHihat; begin // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassHihat, True); +// BASS_ChannelPlay(BassHihat, True); end; procedure TAudio_ffMpeg.PlayClap; begin // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassClap, True); +// BASS_ChannelPlay(BassClap, True); end; procedure TAudio_ffMpeg.PlayShuffle; begin // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassShuffle, True); +// BASS_ChannelPlay(BassShuffle, True); end; procedure TAudio_ffMpeg.StopShuffle; begin // TODO : jb_linux replace with something other than bass - BASS_ChannelStop(BassShuffle); +// BASS_ChannelStop(BassShuffle); end; -procedure TAudio_ffMpeg.CaptureStart; -var - S: integer; - SC: integer; - P1: integer; - P2: integer; -begin - for S := 0 to High(Sound) do - Sound[S].BufferLong[0].Clear; - - for SC := 0 to High(Ini.CardList) do begin - P1 := Ini.CardList[SC].ChannelL; - P2 := Ini.CardList[SC].ChannelR; - if P1 > PlayersPlay then P1 := 0; - if P2 > PlayersPlay then P2 := 0; - if (P1 > 0) or (P2 > 0) then - CaptureCard(SC, P1, P2); - end; +procedure TAudio_ffMpeg.StopCard(Card: byte); +begin + // TODO : jb_linux replace with something other than bass +// BASS_RecordSetDevice(Card); +// BASS_RecordFree; end; -procedure TAudio_ffMpeg.CaptureStop; +function audio_decode_frame(aCodecCtx : TAVCodecContext; audio_buf : PUInt8; buf_size: integer): integer; var - SC: integer; - P1: integer; - P2: integer; + pkt : TAVPacket; + audio_pkt_data : pchar;//PUInt8 = nil; + audio_pkt_size : integer; + len1 , + data_size : integer; begin +// result := 1; +// exit; + + while true do + begin + + while ( audio_pkt_size > 0 ) do + begin + writeln( 'got audio packet' ); + data_size := buf_size; + +// len1 := avcodec_decode_audio2(aCodecCtx, (int16_t )audio_buf, &data_size, audio_pkt_data, audio_pkt_size); + len1 := avcodec_decode_audio(@aCodecCtx, PWord( audio_buf ), data_size, audio_pkt_data, audio_pkt_size); // Todo.. should be avcodec_decode_audio2 but this wont link on my ubuntu box. + +// writeln('avcodec_decode_audio'); + + if(len1 < 0) then + begin + //* if error, skip frame */ + audio_pkt_size := 0; + break; + end; + + audio_pkt_data := audio_pkt_data + len1; + audio_pkt_size := audio_pkt_size + len1; + + if (data_size <= 0) then + begin + //* No data yet, get more frames */ + continue; + end; + + //* We have data, return it and come back for more later */ + result := data_size; + exit; + end; + + if ( pkt.data <> nil ) then + av_free_packet( pkt ); + + if ( quit <> 0 ) then + begin + result := -1; + exit; + end; + + if (packet_queue_get(audioq, pkt, 1) < 0) then + begin + result := -1; + exit; + end; - for SC := 0 to High(Ini.CardList) do begin - P1 := Ini.CardList[SC].ChannelL; - P2 := Ini.CardList[SC].ChannelR; - if P1 > PlayersPlay then P1 := 0; - if P2 > PlayersPlay then P2 := 0; - if (P1 > 0) or (P2 > 0) then StopCard(SC); - end; + audio_pkt_data := pchar( pkt.data ); + audio_pkt_size := pkt.size; + writeln( 'Audio Packet Size - ' + inttostr(audio_pkt_size) ); + end; end; -//procedure TAudio_ffMpeg.CaptureCard(RecordI, SoundNum, PlayerLeft, PlayerRight: byte); -procedure TAudio_ffMpeg.CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); +procedure audio_callback( userdata: Pointer; stream: PUInt8; len: Integer ); var - Error: integer; - ErrorMsg: string; + audio_buf_index : cardinal; // static unsigned int audio_buf_index = 0; + audio_buf_size : cardinal; // static unsigned int audio_buf_size = 0; + audio_size , + len1 : integer; + aCodecCtx : TAVCodecContext; + audio_buf : pUInt8 = nil; begin - if not BASS_RecordInit(RecordI) then - begin - Error := BASS_ErrorGetCode; + aCodecCtx := pAVCodecContext(userdata)^; + audio_buf := UInt8( (AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) div 2); // todo : JB + audio_size := -1; - ErrorMsg := IntToStr(Error); - if Error = BASS_ERROR_DX then ErrorMsg := 'No DX5'; - if Error = BASS_ERROR_ALREADY then ErrorMsg := 'The device has already been initialized'; - if Error = BASS_ERROR_DEVICE then ErrorMsg := 'The device number specified is invalid'; - if Error = BASS_ERROR_DRIVER then ErrorMsg := 'There is no available device driver'; +// writeln('----------- audio callback' ); - {Log.LogAnalyze('Error initializing record [' + IntToStr(RecordI) + ', ' - + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' - + ErrorMsg);} - Log.LogError('Error initializing record [' + IntToStr(RecordI) + ', ' - + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' - + ErrorMsg); - Log.LogError('Music -> CaptureCard: Error initializing record: ' + ErrorMsg); + while (len > 0) do + begin + if(audio_buf_index >= audio_buf_size) then + begin + // We have already sent all our data; get more */ + audio_size := audio_decode_frame(aCodecCtx, audio_buf, sizeof(audio_buf)); + + if(audio_size < 0) then + begin + // If error, output silence */ + audio_buf_size := 1024; // arbitrary? + memset(audio_buf, 0, audio_buf_size); // todo : jb memset + end + else + begin + audio_buf_size := audio_size; + end; +// audio_buf_index := 0; // Todo : jb - SegFault ? + end; + + len1 := audio_buf_size - audio_buf_index; - end - else - begin - Recording.SoundCard[RecordI].BassRecordStream := BASS_RecordStart(44100, 2, MakeLong(0, 20) , @GetMicrophone, PlayerLeft + PlayerRight*256); - end; -end; + if (len1 > len) then + len1 := len; + + memcpy(stream, PUInt8( audio_buf ) + audio_buf_index , len1); -procedure TAudio_ffMpeg.StopCard(Card: byte); -begin - // TODO : jb_linux replace with something other than bass - BASS_RecordSetDevice(Card); - BASS_RecordFree; + len := len - len1; + stream := stream + len1; + audio_buf_index := audio_buf_index + len1; + end; end; function TAudio_ffMpeg.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; var L: Integer; -begin + pFormatCtx: PAVFormatContext; + lVidStreamID , + lAudStreamID : Integer; + aCodecCtx : pAVCodecContext; + wanted_spec , + spec : TSDL_AudioSpec; + lAudioStream : pAVStream; + aCodec : pAVCodec; + i : integer; + packet : TAVPacket; + event : TSDL_Event; +begin + result := false; + if FileExists(Name) then begin - Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); + writeln('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); + + // Open video file + if (av_open_input_file(pFormatCtx, pchar(Name), nil, 0, nil) > 0) then + exit; + + // Retrieve stream information + if (av_find_stream_info(pFormatCtx)<0) then + exit; + + dump_format(pFormatCtx, 0, pchar(Name), 0); + + if not find_stream_ids( pFormatCtx, lVidStreamID, lAudStreamID ) then + exit; + + writeln( 'done searching for stream ids' ); + + if lAudStreamID > -1 then + begin + writeln( 'Audio Stream ID is : '+ inttostr( lAudStreamID ) ); + + lAudioStream := pFormatCtx.streams[lAudStreamID]; + aCodecCtx := lAudioStream.codec; + + // Set audio settings from codec info + wanted_spec.freq := aCodecCtx.sample_rate; + wanted_spec.format := AUDIO_S16SYS; + wanted_spec.channels := aCodecCtx.channels; + wanted_spec.silence := 0; + wanted_spec.samples := SDL_AUDIO_BUFFER_SIZE; + wanted_spec.callback := audio_callback; + wanted_spec.userdata := aCodecCtx; + end; + + if (SDL_OpenAudio(@wanted_spec, @spec) < 0) then + begin + writeln('SDL_OpenAudio: '+SDL_GetError()); + exit + end; + + writeln( 'SDL opened audio device' ); + + aCodec := avcodec_find_decoder(aCodecCtx.codec_id); + if (aCodec = nil) then + begin + writeln('Unsupported codec!'); + exit; + end; + + avcodec_open(aCodecCtx, aCodec); + + writeln( 'Opened the codec' ); + + packet_queue_init( audioq ); + SDL_PauseAudio(0); + + writeln( 'SDL_PauseAudio' ); + + i := 0; + while (av_read_frame(pFormatCtx, packet)>=0) do + begin + writeln( 'ffmpeg - av_read_frame' ); + + if (packet.stream_index = lAudStreamID ) then + begin + packet_queue_put(audioq, packet); + end + else + begin + av_free_packet(packet); + end; + + + // Free the packet that was allocated by av_read_frame + SDL_PollEvent(@event); + +(* + if event.type_ = SDL_QUIT the + begin + quit := 1; + SDL_Quit(); + end + else + break; +*) + + end; + + // Close the codec + avcodec_close(aCodecCtx); + + // Close the video file + av_close_input_file(pFormatCtx); + +(* try // TODO : jb_linux replace with something other than bass hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); @@ -528,21 +685,124 @@ begin except Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); end; +*) + end else begin - Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); + writeln('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); + exit; + end; + +end; + +procedure packet_queue_init(var aPacketQueue : TPacketQueue ); +begin + memset(@aPacketQueue, 0, sizeof(TPacketQueue)); + + aPacketQueue.mutex := SDL_CreateMutex(); + aPacketQueue.cond := SDL_CreateCond(); +end; + +function packet_queue_put(var aPacketQueue : TPacketQueue; var AVPacket : TAVPacket): integer; +var + pkt1 : pAVPacketList; +begin + result := -1; + + writeln( 'TAudio_ffMpeg.packet_queue_put' ); + + if av_dup_packet(@AVPacket) < 0 then exit; + + pkt1 := av_malloc(sizeof(TAVPacketList)); + if (pkt1 = nil) then + exit; + + pkt1.pkt := AVPacket; + pkt1.next := nil; + + + SDL_LockMutex( aPacketQueue.mutex ); + try + + if (aPacketQueue.last_pkt = nil) then + aPacketQueue.first_pkt := pkt1 + else + aPacketQueue.last_pkt.next := pkt1; + + aPacketQueue.last_pkt := pkt1; + inc( aPacketQueue.nb_packets ); + + aPacketQueue.size := aPacketQueue.size + pkt1.pkt.size; + SDL_CondSignal(aPacketQueue.cond); + + finally + SDL_UnlockMutex( aPacketQueue.mutex ); end; + + result := 0; end; +function packet_queue_get(var aPacketQueue : TPacketQueue; var AVPacket : TAVPacket; block : integer ): integer; +var + pkt1 : pAVPacketList; +begin + result := -1; +// writeln( 'packet_queue_get' ); + + SDL_LockMutex(aPacketQueue.mutex); + try + while true do + begin + + if (quit <> 0) then + exit; + + pkt1 := aPacketQueue.first_pkt; + + if ( pkt1 <> nil ) then + begin + aPacketQueue.first_pkt := pkt1.next; + + if (aPacketQueue.first_pkt = nil ) then + aPacketQueue.last_pkt := nil; + + dec(aPacketQueue.nb_packets); + + aPacketQueue.size := aPacketQueue.size - pkt1.pkt.size; + + AVPacket := pkt1.pkt; + + av_free(pkt1); + + result := 1; + break; + end + else + if (block = 0) then + begin + result := 0; + break; + end + else + begin + SDL_CondWait(aPacketQueue.cond, aPacketQueue.mutex); + end; + end; + finally + SDL_UnlockMutex(aPacketQueue.mutex); + end; +end; + + //Equalizer function TAudio_ffMpeg.GetFFTData: TFFTData; var Data: TFFTData; begin //Get Channel Data Mono and 256 Values - BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); +// BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); end; function TAudio_ffMpeg.LoadCustomSound(const Filename: String): Cardinal; @@ -551,6 +811,7 @@ var I: Integer; F: String; begin +(* //Search for Sound in already loaded Sounds F := UpperCase(SoundPath + FileName); For I := 0 to High(CustomSounds) do @@ -566,12 +827,13 @@ begin Result := High(CustomSounds) else Result := 0; +*) end; procedure TAudio_ffMpeg.PlayCustomSound(const Index: Cardinal ); begin - if Index <= High(CustomSounds) then - BASS_ChannelPlay(CustomSounds[Index].Handle, True); +// if Index <= High(CustomSounds) then +// BASS_ChannelPlay(CustomSounds[Index].Handle, True); end; @@ -625,8 +887,8 @@ initialization writeln( 'UAudio_Bass - Register Playback' ); AudioManager.add( IAudioPlayback( singleton_MusicFFMpeg ) ); -finalization - AudioManager.Remove( IAudioPlayback( singleton_MusicFFMpeg ) ); - +finalization + AudioManager.Remove( IAudioPlayback( singleton_MusicFFMpeg ) ); + end. diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index 31115dde..1026c04b 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -123,15 +123,15 @@ uses UMusic in 'Classes\UMusic.pas', + UMedia_dummy in 'Classes\UMedia_dummy.pas', -// UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', UVideo in 'Classes\UVideo.pas', - +// UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', {$ifdef win32} UAudio_bass in 'Classes\UAudio_bass.pas', {$endif} -// UAudio_fmod in 'Classes\UAudio_fmod.pas', // Not ready yet +// UAudio_fmod in 'Classes\UAudio_fmod.pas', // this has not yet been developed.. :( UParty in 'Classes\UParty.pas', UPlaylist in 'Classes\UPlaylist.pas', @@ -417,6 +417,14 @@ exit; Log.LogStatus('Initialize Sound', 'Initialization'); InitializeSound(); Log.BenchmarkEnd(1); Log.LogBenchmark('Initializing Sound', 1); + + +(* + // This is jays debugging for FFMpeg audio output.. + singleton_MusicFFMpeg.PlaySwoosh(); + writeln( 'did you hear the sound ?? ' ); + halt(0); +*) // Graphics Log.BenchmarkStart(1); -- cgit v1.2.3 From 64f2c9b369185575d397dccbbcacc7f818874952 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sat, 27 Oct 2007 01:37:00 +0000 Subject: fixed my oops, and have also fixed bamboo build to show this error.. doh git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@532 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/USongs.pas | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index b45e7c2a..99474961 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -8,7 +8,9 @@ interface uses SysUtils, + {$ifndef win32} oldlinux, + {$endif} ULog, UTexture, UCatCovers; @@ -134,10 +136,12 @@ var SR: TSearchRec; // for parsing Songs Directory SLen: integer; - TheDir : pdir; - ADirent :pDirent; - Entry : Longint; + {$ifndef win32} + TheDir : pdir; + ADirent :pDirent; + Entry : Longint; info : stat; + {$endif} begin {$ifdef win32} if FindFirst(Dir + '*', faDirectory, SR) = 0 then // JB_Unicode - windows -- cgit v1.2.3 From 8cca9e3e6f591c35d35d132a9d3f93ffc7cdfee8 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sat, 27 Oct 2007 06:31:04 +0000 Subject: made some major progress with ffmpeg audio playback !!! YAY !!! still a little choppy, so I suspect incorrect buffer sizes or something like that. also made some mods to support Unicode song file iteration on windows, this is no worse than what we had before, but is not complete.. oh this code only supports win 2000 and up .. no Win 98... git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@533 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudio_FFMpeg.pas | 153 ++++++++++++++++++++++++------------ Game/Code/Classes/UCommon.pas | 88 +++++++++++++++++++++ Game/Code/Classes/UFiles.pas | 20 +++-- Game/Code/Classes/USongs.pas | 65 +++++++-------- Game/Code/Classes/UVideo.pas | 85 ++++++++++++++------ Game/Code/Screens/UScreenSong.pas | 8 +- Game/Code/UltraStar.dpr | 13 +-- 7 files changed, 311 insertions(+), 121 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudio_FFMpeg.pas b/Game/Code/Classes/UAudio_FFMpeg.pas index 548fb343..35822a3b 100644 --- a/Game/Code/Classes/UAudio_FFMpeg.pas +++ b/Game/Code/Classes/UAudio_FFMpeg.pas @@ -7,6 +7,8 @@ This unit is primarily based upon - and tutorial03.c + http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html + *******************************************************************************) interface @@ -25,10 +27,10 @@ uses Classes, {$IFNDEF FPC} Forms, {$ENDIF} + SDL, // Used for Audio output Interface avcodec, // FFMpeg Audio file decoding avformat, avutil, - SDL, // Used for Audio output Interface ULog, UMusic; @@ -47,19 +49,28 @@ type function packet_queue_get(var aPacketQueue : TPacketQueue; var AVPacket : TAVPacket; block : integer ): integer; procedure packet_queue_init( var aPacketQueue : TPacketQueue ); procedure audio_callback( userdata: Pointer; stream: PUInt8; len: Integer ); cdecl; - function audio_decode_frame(aCodecCtx : TAVCodecContext; audio_buf : PUInt8; buf_size: integer): integer; + function audio_decode_frame(aCodecCtx : TAVCodecContext; aAudio_buf : PUInt8; buf_size: integer): integer; var singleton_MusicFFMpeg : IAudioPlayback = nil; +var + audioq : TPacketQueue; + quit : integer = 0; +// faudio_buf : array[ 0 .. 0 ] of byte; //pUInt8{$ifndef fpc};{$else} = nil;{$endif} +// audio_buf : array[ 0 .. AVCODEC_MAX_AUDIO_FRAME_SIZE ] of byte; //pUInt8{$ifndef fpc};{$else} = nil;{$endif} + +type + Taudiobuff = array[ 0 .. AVCODEC_MAX_AUDIO_FRAME_SIZE ] of byte; + PAudioBuff = ^Taudiobuff; implementation uses {$IFDEF FPC} lclintf, - {$ENDIF} libc, + {$ENDIF} // URecord, UIni, UMain, @@ -82,9 +93,6 @@ type const ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); -var - audioq : TPacketQueue; - quit : integer = 0; type @@ -154,7 +162,7 @@ end; constructor TAudio_ffMpeg.create(); begin - writeln( 'UVideo_FFMpeg - av_register_all' ); +// writeln( 'UVideo_FFMpeg - av_register_all' ); av_register_all; end; @@ -170,20 +178,20 @@ begin i := 0; while ( i < aFormatCtx.nb_streams ) do begin - writeln( ' aFormatCtx.streams[i] : ' + inttostr( i ) ); +// writeln( ' aFormatCtx.streams[i] : ' + inttostr( i ) ); st := aFormatCtx.streams[i]; if(st.codec.codec_type = CODEC_TYPE_VIDEO ) AND (aFirstVideoStream < 0) THEN begin - writeln( 'Found Video Stream' ); +// writeln( 'Found Video Stream' ); aFirstVideoStream := i; end; if ( st.codec.codec_type = CODEC_TYPE_AUDIO ) AND ( aFirstAudioStream < 0) THEN begin - writeln( 'Found Audio Stream' ); +// writeln( 'Found Audio Stream' ); aFirstAudioStream := i; end; @@ -206,8 +214,8 @@ var S: integer; begin - LoadSoundFromFile(BassStart, SoundPath + 'foo fighters - best of you.mp3'); - +// LoadSoundFromFile(BassStart, SoundPath + 'Green Day - American Idiot.mp3'); + (* LoadSoundFromFile(BassStart, SoundPath + 'Common start.mp3'); LoadSoundFromFile(BassBack, SoundPath + 'Common back.mp3'); @@ -438,12 +446,13 @@ end; procedure TAudio_ffMpeg.StopCard(Card: byte); begin + // TODO : jb_linux replace with something other than bass // BASS_RecordSetDevice(Card); // BASS_RecordFree; end; -function audio_decode_frame(aCodecCtx : TAVCodecContext; audio_buf : PUInt8; buf_size: integer): integer; +function audio_decode_frame(aCodecCtx : TAVCodecContext; aAudio_buf : PUInt8; buf_size: integer): integer; var pkt : TAVPacket; audio_pkt_data : pchar;//PUInt8 = nil; @@ -451,26 +460,44 @@ var len1 , data_size : integer; begin -// result := 1; -// exit; + {$ifdef win32} + FillChar(pkt, sizeof(pkt), #0); + {$else} + memset(@pkt, 0, sizeof(pkt)); // todo : jb memset + {$endif} + + audio_pkt_data := nil; + audio_pkt_size := 0; while true do begin while ( audio_pkt_size > 0 ) do begin - writeln( 'got audio packet' ); +// writeln( 'got audio packet' ); data_size := buf_size; - -// len1 := avcodec_decode_audio2(aCodecCtx, (int16_t )audio_buf, &data_size, audio_pkt_data, audio_pkt_size); - len1 := avcodec_decode_audio(@aCodecCtx, PWord( audio_buf ), data_size, audio_pkt_data, audio_pkt_size); // Todo.. should be avcodec_decode_audio2 but this wont link on my ubuntu box. + + len1 := -1; + + if aAudio_buf <> nil then + begin +// writeln( 'pre avcodec_decode_audio' ); + {$ifdef fpc} + len1 := avcodec_decode_audio(@aCodecCtx, PWord( aAudio_buf ), data_size, audio_pkt_data, audio_pkt_size); // Todo.. should be avcodec_decode_audio2 but this wont link on my ubuntu box. + {$else} + len1 := avcodec_decode_audio(@aCodecCtx, Pointer( aAudio_buf ), data_size, audio_pkt_data, audio_pkt_size); // Todo.. should be avcodec_decode_audio2 but this wont link on my ubuntu box. + {$endif} +// writeln( 'post avcodec_decode_audio' ); + + end; // writeln('avcodec_decode_audio'); if(len1 < 0) then begin //* if error, skip frame */ - audio_pkt_size := 0; +// writeln( 'Skip audio frame' ); + audio_pkt_size := 0; break; end; @@ -506,7 +533,7 @@ begin audio_pkt_data := pchar( pkt.data ); audio_pkt_size := pkt.size; - writeln( 'Audio Packet Size - ' + inttostr(audio_pkt_size) ); +// writeln( 'Audio Packet Size - ' + inttostr(audio_pkt_size) ); end; end; @@ -517,52 +544,69 @@ var audio_size , len1 : integer; aCodecCtx : TAVCodecContext; - audio_buf : pUInt8 = nil; + + lSrc : pointer; + + // this is used to emulate ...... static uint8_t audio_buf[(AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) / 2]; + lAudio_buf_data : Taudiobuff; // This created the memory we need + laudio_buf : PAudioBuff; // this makes it easy to work with.. since its the pointer to that memeory everywhere begin - aCodecCtx := pAVCodecContext(userdata)^; - audio_buf := UInt8( (AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) div 2); // todo : JB - audio_size := -1; + laudio_buf := @lAudio_buf_data ; -// writeln('----------- audio callback' ); + aCodecCtx := pAVCodecContext(userdata)^; + audio_size := -1; + audio_buf_index := 0; + audio_buf_size := 0; while (len > 0) do begin if(audio_buf_index >= audio_buf_size) then begin // We have already sent all our data; get more */ - audio_size := audio_decode_frame(aCodecCtx, audio_buf, sizeof(audio_buf)); + audio_size := audio_decode_frame(aCodecCtx, pUInt8( laudio_buf ), sizeof(laudio_buf)); if(audio_size < 0) then begin // If error, output silence */ audio_buf_size := 1024; // arbitrary? - memset(audio_buf, 0, audio_buf_size); // todo : jb memset + + {$ifdef win32} + FillChar(laudio_buf, audio_buf_size, #0); + {$else} + memset(laudio_buf, 0, audio_buf_size); // todo : jb memset + {$endif} end else begin audio_buf_size := audio_size; end; -// audio_buf_index := 0; // Todo : jb - SegFault ? + audio_buf_index := 0; // Todo : jb - SegFault ? end; len1 := audio_buf_size - audio_buf_index; if (len1 > len) then len1 := len; - - memcpy(stream, PUInt8( audio_buf ) + audio_buf_index , len1); - len := len - len1; - stream := stream + len1; + + {$ifdef win32} + lSrc := PUInt8( integer( laudio_buf ) + audio_buf_index ); + CopyMemory(stream, lSrc , len1); + {$else} + memcpy(stream, PUInt8( laudio_buf ) + audio_buf_index , len1); + {$endif} + + len := len - len1; + stream^ := stream^ + len1; audio_buf_index := audio_buf_index + len1; end; end; function TAudio_ffMpeg.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; var - L: Integer; - pFormatCtx: PAVFormatContext; + L : Integer; + pFormatCtx : PAVFormatContext; lVidStreamID , lAudStreamID : Integer; aCodecCtx : pAVCodecContext; @@ -578,7 +622,7 @@ begin if FileExists(Name) then begin - writeln('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); +// writeln('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); // Open video file if (av_open_input_file(pFormatCtx, pchar(Name), nil, 0, nil) > 0) then @@ -593,11 +637,11 @@ begin if not find_stream_ids( pFormatCtx, lVidStreamID, lAudStreamID ) then exit; - writeln( 'done searching for stream ids' ); +// writeln( 'done searching for stream ids' ); if lAudStreamID > -1 then begin - writeln( 'Audio Stream ID is : '+ inttostr( lAudStreamID ) ); +// writeln( 'Audio Stream ID is : '+ inttostr( lAudStreamID ) ); lAudioStream := pFormatCtx.streams[lAudStreamID]; aCodecCtx := lAudioStream.codec; @@ -617,9 +661,9 @@ begin writeln('SDL_OpenAudio: '+SDL_GetError()); exit end; - - writeln( 'SDL opened audio device' ); - + +// writeln( 'SDL opened audio device' ); + aCodec := avcodec_find_decoder(aCodecCtx.codec_id); if (aCodec = nil) then begin @@ -629,27 +673,28 @@ begin avcodec_open(aCodecCtx, aCodec); - writeln( 'Opened the codec' ); +// writeln( 'Opened the codec' ); packet_queue_init( audioq ); SDL_PauseAudio(0); - writeln( 'SDL_PauseAudio' ); +// writeln( 'SDL_PauseAudio' ); i := 0; - while (av_read_frame(pFormatCtx, packet)>=0) do + while (av_read_frame(pFormatCtx, packet) >= 0) do begin - writeln( 'ffmpeg - av_read_frame' ); +// writeln( 'ffmpeg - av_read_frame' ); if (packet.stream_index = lAudStreamID ) then begin +// writeln( 'packet_queue_put' ); packet_queue_put(audioq, packet); end else begin av_free_packet(packet); end; - + // Free the packet that was allocated by av_read_frame SDL_PollEvent(@event); @@ -665,12 +710,14 @@ begin *) end; - + +// halt(0); + // Close the codec - avcodec_close(aCodecCtx); +// avcodec_close(aCodecCtx); // Close the video file - av_close_input_file(pFormatCtx); +// av_close_input_file(pFormatCtx); (* try @@ -698,7 +745,11 @@ end; procedure packet_queue_init(var aPacketQueue : TPacketQueue ); begin - memset(@aPacketQueue, 0, sizeof(TPacketQueue)); + {$ifdef win32} + FillChar(aPacketQueue, sizeof(TPacketQueue), #0); + {$else} + memset(@aPacketQueue, 0, sizeof(TPacketQueue)); + {$endif} aPacketQueue.mutex := SDL_CreateMutex(); aPacketQueue.cond := SDL_CreateCond(); @@ -710,7 +761,7 @@ var begin result := -1; - writeln( 'TAudio_ffMpeg.packet_queue_put' ); +// writeln( 'TAudio_ffMpeg.packet_queue_put' ); if av_dup_packet(@AVPacket) < 0 then exit; diff --git a/Game/Code/Classes/UCommon.pas b/Game/Code/Classes/UCommon.pas index af9ae82d..44ec6bb3 100644 --- a/Game/Code/Classes/UCommon.pas +++ b/Game/Code/Classes/UCommon.pas @@ -58,6 +58,26 @@ function AdaptFilePaths( const aPath : widestring ): widestring; procedure ZeroMemory( Destination: Pointer; Length: DWORD ); {$ENDIF} +{$IFDEF Win32} + +type + TSearchRecW = record + Time: Integer; + Size: Integer; + Attr: Integer; + Name: WideString; + ExcludeAttr: Integer; + FindHandle: THandle; + FindData: TWin32FindDataW; + end; + + function FindFirstW(const Path: WideString; Attr: Integer; var F: TSearchRecW): Integer; + function FindNextW(var F: TSearchRecW): Integer; + procedure FindCloseW(var F: TSearchRecW); + function FindMatchingFileW(var F: TSearchRecW): Integer; + function DirectoryExistsW(const Directory: widestring): Boolean; +{$endif} + implementation function StringReplaceW(text : WideString; search, rep: WideChar):WideString; @@ -190,7 +210,75 @@ begin end; {$ENDIF} + + + {$ENDIF} +{$ifdef win32} +function FindFirstW(const Path: widestring; Attr: Integer; var F: TSearchRecW): Integer; +const + faSpecial = faHidden or faSysFile or faVolumeID or faDirectory; +begin + F.ExcludeAttr := not Attr and faSpecial; + F.FindHandle := FindFirstFileW(PWideChar(Path), F.FindData); + if F.FindHandle <> INVALID_HANDLE_VALUE then + begin + Result := FindMatchingFileW(F); + if Result <> 0 then FindCloseW(F); + end else + Result := GetLastError; +end; + +function FindNextW(var F: TSearchRecW): Integer; +begin + if FindNextFileW(F.FindHandle, F.FindData) then + Result := FindMatchingFileW(F) + else + Result := GetLastError; +end; + +procedure FindCloseW(var F: TSearchRecW); +begin + if F.FindHandle <> INVALID_HANDLE_VALUE then + begin + Windows.FindClose(F.FindHandle); + F.FindHandle := INVALID_HANDLE_VALUE; + end; +end; + +function FindMatchingFileW(var F: TSearchRecW): Integer; +var + LocalFileTime: TFileTime; +begin + with F do + begin + while FindData.dwFileAttributes and ExcludeAttr <> 0 do + if not FindNextFileW(FindHandle, FindData) then + begin + Result := GetLastError; + Exit; + end; + FileTimeToLocalFileTime(FindData.ftLastWriteTime, LocalFileTime); + FileTimeToDosDateTime(LocalFileTime, LongRec(Time).Hi, LongRec(Time).Lo); + Size := FindData.nFileSizeLow; + Attr := FindData.dwFileAttributes; + Name := FindData.cFileName; + end; + Result := 0; +end; + +function DirectoryExistsW(const Directory: widestring): Boolean; +var + Code: Integer; +begin + Code := GetFileAttributesW(PWideChar(Directory)); + Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0); +end; +{$endif} + + + + end. diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index 7e23b42f..717d20e2 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -333,16 +333,22 @@ Result := False; //Open File and set File Pointer to the beginning AssignFile(SongFile, Song.Path + Song.FileName); - Reset(SongFile); +// if assinged( SongFile ) then + begin + try + Reset(SongFile); - //Clear old Song Header - ClearSong(Song); + //Clear old Song Header + ClearSong(Song); - //Read Header - Result := ReadTxTHeader(Song); + //Read Header + Result := ReadTxTHeader(Song); - //And Close File - CloseFile(SongFile); + //And Close File + finally + CloseFile(SongFile); + end; + end; {except CloseFile(SongFile); diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 99474961..e3c54ac4 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -13,6 +13,7 @@ uses SysUtils, {$endif} ULog, UTexture, + UCommon, UCatCovers; type @@ -23,33 +24,33 @@ type end; TScore = record - Name: string; + Name: widestring; Score: integer; Length: string; end; TSong = record - Path: string; - Folder: string; // for sorting by folder - FileName: string; + Path: widestring; + Folder: widestring; // for sorting by folder + FileName: widestring; // sorting methods - Category: array of string; // I think I won't need this - Genre: string; - Edition: string; - Language: string; // 0.5.0: new + Category: array of widestring; // I think I won't need this + Genre: widestring; + Edition: widestring; + Language: widestring; // 0.5.0: new - Title: string; - Artist: string; + Title: widestring; + Artist: widestring; - Text: string; - Creator: string; + Text: widestring; + Creator: widestring; - Cover: string; + Cover: widestring; CoverTex: TTexture; - Mp3: string; - Background: string; - Video: string; + Mp3: widestring; + Background: widestring; + Video: widestring; VideoGAP: real; VideoLoaded: boolean; // 0.5.0: true if the video has been loaded NotesGAP: integer; @@ -79,7 +80,7 @@ type procedure LoadSongList; // load all songs procedure BrowseDir(Dir: widestring); // should return number of songs in the future procedure Sort(Order: integer); - function FindSongFile(Dir, Mask: string): string; + function FindSongFile(Dir, Mask: widestring): widestring; end; TCatSongs = class @@ -133,7 +134,7 @@ end; procedure TSongs.BrowseDir(Dir: widestring); var - SR: TSearchRec; // for parsing Songs Directory + SR: TSearchRecW; // for parsing Songs Directory SLen: integer; {$ifndef win32} @@ -144,16 +145,16 @@ var {$endif} begin {$ifdef win32} - if FindFirst(Dir + '*', faDirectory, SR) = 0 then // JB_Unicode - windows + if FindFirstW(Dir + '*', faDirectory, SR) = 0 then // JB_Unicode - windows begin repeat if (SR.Name <> '.') and (SR.Name <> '..') then begin BrowseDir(Dir + Sr.Name + PathDelim); end - until FindNext(SR) <> 0; + until FindNextw(SR) <> 0; end; // if - FindClose(SR); + FindClosew(SR); {$else} // Itterate the Songs Directory... ( With unicode capable functions for linux ) TheDir := opendir( Dir ); // JB_Unicode - linux @@ -178,7 +179,7 @@ begin // Log.LogStatus('Parsing directory: ' + Dir + SR.Name, 'LoadSongList'); - if FindFirst(Dir + '*.txt', 0, SR) = 0 then + if FindFirstW(Dir + '*.txt', 0, SR) = 0 then begin repeat SLen := BrowsePos; @@ -204,9 +205,9 @@ begin SetLength(Song, Length(Song) + 50); end; - until FindNext(SR) <> 0; + until FindNextW(SR) <> 0; end; // if FindFirst - FindClose(SR); + FindCloseW(SR); end; procedure TSongs.Sort(Order: integer); @@ -309,7 +310,7 @@ begin end; // case end; -function TSongs.FindSongFile(Dir, Mask: string): string; +function TSongs.FindSongFile(Dir, Mask: widestring): widestring; var SR: TSearchRec; // for parsing song directory begin @@ -463,10 +464,12 @@ case Ini.Sorting of CatSongs.Song[CatLen].Visible := true; end - else if (Ini.Sorting = sTitle) and (Length(Songs.Song[S].Title)>=1) and (Letter <> UpCase(Songs.Song[S].Title[1])) then begin + else if (Ini.Sorting = sTitle) and + (Length(Songs.Song[S].Title)>=1) and + (Letter <> UpperCase(Songs.Song[S].Title)[1]) then begin // add a letter Category Button Inc(Order); - Letter := UpCase(Songs.Song[S].Title[1]); + Letter := Uppercase(Songs.Song[S].Title)[1]; CatLen := Length(CatSongs.Song); SetLength(CatSongs.Song, CatLen+1); CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; @@ -491,10 +494,10 @@ case Ini.Sorting of CatSongs.Song[CatLen].Visible := true; end - else if (Ini.Sorting = sArtist) and (Length(Songs.Song[S].Artist)>=1) and (Letter <> UpCase(Songs.Song[S].Artist[1])) then begin + else if (Ini.Sorting = sArtist) and (Length(Songs.Song[S].Artist)>=1) and (Letter <> UpperCase(Songs.Song[S].Artist)[1]) then begin // add a letter Category Button Inc(Order); - Letter := UpCase(Songs.Song[S].Artist[1]); + Letter := UpperCase(Songs.Song[S].Artist)[1]; CatLen := Length(CatSongs.Song); SetLength(CatSongs.Song, CatLen+1); CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; @@ -545,7 +548,7 @@ case Ini.Sorting of end else if (Ini.Sorting = sTitle2) AND (Length(Songs.Song[S].Title)>=1) then begin - if (ord(Songs.Song[S].Title[1]) > 47) and (ord(Songs.Song[S].Title[1]) < 58) then Letter2 := '#' else Letter2 := UpCase(Songs.Song[S].Title[1]); + if (ord(Songs.Song[S].Title[1]) > 47) and (ord(Songs.Song[S].Title[1]) < 58) then Letter2 := '#' else Letter2 := UpperCase(Songs.Song[S].Title)[1]; if (Letter <> Letter2) then begin // add a letter Category Button Inc(Order); @@ -575,7 +578,7 @@ case Ini.Sorting of end else if (Ini.Sorting = sArtist2) AND (Length(Songs.Song[S].Artist)>=1) then begin - if (ord(Songs.Song[S].Artist[1]) > 47) and (ord(Songs.Song[S].Artist[1]) < 58) then Letter2 := '#' else Letter2 := UpCase(Songs.Song[S].Artist[1]); + if (ord(Songs.Song[S].Artist[1]) > 47) and (ord(Songs.Song[S].Artist[1]) < 58) then Letter2 := '#' else Letter2 := UpperCase(Songs.Song[S].Artist)[1]; if (Letter <> Letter2) then begin // add a letter Category Button Inc(Order); diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index 4c27867d..154cd04c 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -10,9 +10,11 @@ unit UVideo; # # ############################################################################## } -{$define DebugDisplay} // uncomment if u want to see the debug stuff +//{$define DebugDisplay} // uncomment if u want to see the debug stuff //{$define DebugFrames} //{$define Info} + +//{$define FFMpegAudio} {} @@ -45,6 +47,9 @@ uses SDL, dialogs, {$endif} {$ENDIF} + {$ifdef FFMpegAudio} + UAudio_FFMpeg, + {$endif} UIni, UMusic; @@ -108,7 +113,9 @@ type end; - + const + SDL_AUDIO_BUFFER_SIZE = 1024; + {$ifdef DebugDisplay} //{$ifNdef win32} @@ -262,19 +269,23 @@ begin FrameFinished:=0; // read packets until we have a finished frame (or there are no more packets) -// while (FrameFinished=0) and (av_read_frame(VideoFormatContext, @AVPacket)>=0) do - while (FrameFinished=0) and (av_read_frame(VideoFormatContext, AVPacket)>=0) do // JB-ffmpeg + while ( FrameFinished = 0 ) and + ( av_read_frame(VideoFormatContext, AVPacket) >= 0 ) do // JB-ffmpeg begin // if we got a packet from the video stream, then decode it if (AVPacket.stream_index=VideoStreamIndex) then -// errnum:=avcodec_decode_video(VideoCodecContext, AVFrame, @frameFinished , AVPacket.data, AVPacket.size); + begin errnum := avcodec_decode_video(VideoCodecContext, AVFrame, frameFinished , AVPacket.data, AVPacket.size); // JB-ffmpeg - - - // release internal packet structure created by av_read_frame -// av_free_packet(PAVPacket(@AVPacket)); + {$ifdef FFMpegAudio} + end + else + if (AVPacket.stream_index = AudioStreamIndex ) then + begin + UAudio_FFMpeg.packet_queue_put(UAudio_FFMpeg.audioq, AVPacket); + {$endif} + end; try if AVPacket.data <> nil then @@ -427,6 +438,10 @@ var errnum, i, x,y: Integer; lStreamsCount : Integer; + wanted_spec , + spec : TSDL_AudioSpec; + aCodec : pAVCodec; + begin fVideoOpened := False; fVideoPaused := False; @@ -471,27 +486,47 @@ begin end; aCodecCtx := VideoFormatContext.streams[ AudioStreamIndex ].codec; + {$ifdef FFMpegAudio} + // This is the audio ffmpeg audio support Jay is working on. if aCodecCtx <> nil then begin + wanted_spec.freq := aCodecCtx.sample_rate; + wanted_spec.format := AUDIO_S16SYS; + wanted_spec.channels := aCodecCtx.channels; + wanted_spec.silence := 0; + wanted_spec.samples := SDL_AUDIO_BUFFER_SIZE; + wanted_spec.callback := UAudio_FFMpeg.audio_callback; + wanted_spec.userdata := aCodecCtx; -// WantedAudioCodecContext.freq := aCodecCtx^.sample_rate; -// WantedAudioCodecContext.format := AUDIO_S16SYS; -// WantedAudioCodecContext.channels := aCodecCtx^.channels; -(* WantedAudioCodecContext.silence := 0; - WantedAudioCodecContext.samples := 1024;//SDL_AUDIO_BUFFER_SIZE; -// WantedAudioCodecContext.callback := audio_callback; - WantedAudioCodecContext.userdata := aCodecCtx; -*) + + if (SDL_OpenAudio(@wanted_spec, @spec) < 0) then + begin + writeln('SDL_OpenAudio: '+SDL_GetError()); + exit; + end; + + writeln( 'SDL opened audio device' ); + + aCodec := avcodec_find_decoder(aCodecCtx.codec_id); + if (aCodec = nil) then + begin + writeln('Unsupported codec!'); + exit; + end; + + avcodec_open(aCodecCtx, aCodec); + + writeln( 'Opened the codec' ); + + packet_queue_init( audioq ); + SDL_PauseAudio(0); + + writeln( 'SDL_PauseAudio' ); + end; -(* - if(SDL_OpenAudio(WantedAudioCodecContext, AudioCodecContext) < 0) then - begin - writeln( 'Could not do SDL_OpenAudio' ); - exit; - end; -*) - + {$endif} + if(VideoStreamIndex >= 0) then begin VideoCodecContext:=VideoFormatContext^.streams[VideoStreamIndex]^.codec; diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index ea1dd8a5..4d146283 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -261,7 +261,9 @@ begin begin For I := 1 to high(CatSongs.Song) do begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND + (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND + (widechar(UpperCase(CatSongs.Song[(I + Interaction) mod I2].Title)[1]) = widechar(Letter)) then begin SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); @@ -280,7 +282,9 @@ begin begin For I := 1 to high(CatSongs.Song) do begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Artist[1]) = Letter) then + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND + (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND + (widechar(uppercase(CatSongs.Song[(I + Interaction) mod I2].Artist)[1]) = widechar(Letter)) then begin SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 1e418a49..0b7e8449 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -59,8 +59,6 @@ uses UCommon in 'Classes\UCommon.pas', UGraphic in 'Classes\UGraphic.pas', UTexture in 'Classes\UTexture.pas', - UMusic in 'Classes\UMusic.pas', - UAudio_Bass in 'Classes\UAudio_Bass.pas', ULanguage in 'Classes\ULanguage.pas', UMain in 'Classes\UMain.pas', UDraw in 'Classes\UDraw.pas', @@ -100,10 +98,14 @@ uses UParty in 'Classes\UParty.pas', // to - do : rewrite Party Manager as Module, reomplent ability to offer party Mody by Plugin //------------------------------ - //Includes - Video Support + //Includes - Media support classes.... + // Make sure UMedia always first, then UMedia_dummy //------------------------------ - UMedia_dummy in 'Classes\UMedia_dummy.pas', - UVideo in 'Classes\UVideo.pas', + UMusic in 'Classes\UMusic.pas', + UMedia_dummy in 'Classes\UMedia_dummy.pas', + UVideo in 'Classes\UVideo.pas', +// UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', // this is NEARLY to a working point :P + UAudio_Bass in 'Classes\UAudio_Bass.pas', //------------------------------ //Includes - Screens @@ -330,6 +332,7 @@ begin Log.BenchmarkEnd(1); Log.LogBenchmark('Initializing Sound', 1); +// exit; // Graphics Log.BenchmarkStart(1); -- cgit v1.2.3 From 2b83fa1741b6b2d4c7548cd165f2158f9fdb351f Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 27 Oct 2007 09:02:09 +0000 Subject: Fixed "White Line" Bug -> I think so ;) (Bg was not at the right position) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@534 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UMenu.pas | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 2efae5e4..75d6a957 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -761,8 +761,12 @@ begin BackImg.Y := (PetY-1)/BackH * 600; //480 DrawTexture(BackImg); end; // for PetX} - BackImg.X:=BackW; - BackImg.Y:=BackW; + {BackImg.X:=BackW; + BackImg.Y:=BackW; } + BackImg.X := 0; + BackImg.Y := 0; + BackImg.W := 800; + BackImg.H := 600; DrawTexture(BackImg); end; // if end; -- cgit v1.2.3 From e270d3193a2a5b958e6416ce340246e790f7bd86 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 27 Oct 2007 09:10:29 +0000 Subject: Finished pluginloader, plugininterface Some fixes and error management (needs improvement) in Core and Service/Hook classes. "Clean Plugin Unloading on Error" finished Some debuging messages on startup. to Fix this remove old Plugins from Pluginfolder git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@535 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCore.pas | 36 +- Game/Code/Classes/UCoreModule.pas | 13 +- Game/Code/Classes/UHooks.pas | 117 +++-- Game/Code/Classes/UModules.pas | 9 +- Game/Code/Classes/UPluginInterface.pas | 48 +- Game/Code/Classes/UServices.pas | 14 +- Game/Code/Classes/uPluginLoader.pas | 786 +++++++++++++++++++++++++++++++++ 7 files changed, 947 insertions(+), 76 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UCore.pas b/Game/Code/Classes/UCore.pas index de44fb3b..a8a29aeb 100644 --- a/Game/Code/Classes/UCore.pas +++ b/Game/Code/Classes/UCore.pas @@ -38,6 +38,7 @@ type sRetranslate: THandle; sReloadTextures: THandle; sGetModuleInfo: THandle; + sGetApplicationHandle: THandle; Modules: Array [0..High(CORE_MODULES_TO_LOAD)] of TModuleListItem; @@ -86,6 +87,9 @@ type //Starts Loading and Init Process. Then Runs MainLoop. DeInits on Shutdown Procedure Run; + //Method for other Classes to get Pointer to a specific Module + Function GetModulebyName(const Name: String): PCoreModule; + //-------------- // Hook and Service Procs: //-------------- @@ -95,6 +99,7 @@ type Function Retranslate(wParam, lParam: DWord): integer; //Calls Translate hook Function ReloadTextures(wParam, lParam: DWord): integer; //Calls LoadTextures hook Function GetModuleInfo(wParam, lParam: DWord): integer; //If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TModuleInfo to address at lparam + Function GetApplicationHandle(wParam, lParam: DWord): integer; //Returns Application Handle end; var @@ -354,6 +359,10 @@ begin sRetranslate := Services.AddService('Core/Retranslate', nil, Self.Retranslate); sReloadTextures := Services.AddService('Core/ReloadTextures', nil, Self.ReloadTextures); sGetModuleInfo := Services.AddService('Core/GetModuleInfo', nil, Self.GetModuleInfo); + sGetApplicationHandle := Services.AddService('Core/GetApplicationHandle', nil, Self.GetApplicationHandle); + + //A little Test + Hooks.AddSubscriber('Core/NewError', HookTest); end; //------------- @@ -374,6 +383,21 @@ begin // to-do : write TService-/HookManager.Free and call it here end; +//------------- +//Method for other Classes to get Pointer to a specific Module +//------------- +Function TCore.GetModulebyName(const Name: String): PCoreModule; +var I: Integer; +begin + Result := nil; + For I := 0 to high(Modules) do + If (Modules[I].Info.Name = Name) then + begin + Result := @Modules[I].Module; + Break; + end; +end; + //------------- // Shows a MessageDialog (lParam: PChar Text, wParam: Symbol) //------------- @@ -405,11 +429,11 @@ end; //------------- Function TCore.ReportError(wParam, lParam: DWord): integer; begin - Hooks.CallEventChain(hError, wParam, lParam); - //Update LastErrorReporter and LastErrorString LastErrorReporter := String(PChar(Ptr(lParam))); LastErrorString := String(PChar(Ptr(wParam))); + + Hooks.CallEventChain(hError, wParam, lParam); end; //------------- @@ -460,4 +484,12 @@ begin end; end; +//------------- +// Returns Application Handle +//------------- +Function TCore.GetApplicationHandle(wParam, lParam: DWord): integer; +begin + Result := hInstance; +end; + end. \ No newline at end of file diff --git a/Game/Code/Classes/UCoreModule.pas b/Game/Code/Classes/UCoreModule.pas index 6fca5d37..e5a874f0 100644 --- a/Game/Code/Classes/UCoreModule.pas +++ b/Game/Code/Classes/UCoreModule.pas @@ -13,10 +13,13 @@ uses UPluginDefs; {$ENDIF} type + PCoreModule = ^TCoreModule; TCoreModule = class public + Constructor Create; virtual; + //Function that gives some Infos about the Module to the Core - Procedure Info(const pInfo: PModuleInfo); + Procedure Info(const pInfo: PModuleInfo); virtual; //Is Called on Loading. //In this Method only Events and Services should be created @@ -47,6 +50,14 @@ type implementation +//------------- +// Just the Constructor +//------------- +Constructor TCoreModule.Create; +begin + //Dummy maaaan ;) +end; + //------------- // Function that gives some Infos about the Module to the Core //------------- diff --git a/Game/Code/Classes/UHooks.pas b/Game/Code/Classes/UHooks.pas index c73ccbbb..c3684ed1 100644 --- a/Game/Code/Classes/UHooks.pas +++ b/Game/Code/Classes/UHooks.pas @@ -6,7 +6,7 @@ unit UHooks; Saves all hookable events and their subscribers *********************} interface -uses uPluginDefs, SysUtils, WINDOWS; +uses uPluginDefs, SysUtils; {$IFDEF FPC} {$MODE Delphi} @@ -21,6 +21,8 @@ type Self: THandle; //ID of this Subscription (First Word: ID of Subscription; 2nd Word: ID of Hook) Next: PSubscriberInfo; //Pointer to next Item in HookChain + Owner: Integer; //For Error Handling and Plugin Unloading. + //Here is s/t tricky //To avoid writing of Wrapping Functions to Hook an Event with a Class //We save a Normal Proc or a Method of a Class @@ -39,6 +41,8 @@ type private Events: array of TEventInfo; SpaceinEvents: Word; //Number of empty Items in Events Array. (e.g. Deleted Items) + + Procedure FreeSubscriber(const EventIndex: Word; const Last, Cur: PSubscriberInfo); public constructor Create(const SpacetoAllocate: Word); @@ -50,15 +54,17 @@ type Function CallEventChain (const hEvent: THandle; const wParam, lParam: LongWord): Integer; Function EventExists (const EventName: PChar): Integer; + + Procedure DelbyOwner(const Owner: Integer); end; function HookTest(wParam, lParam: DWord): integer; stdcall; -function HookTest2(wParam, lParam: DWord): integer; stdcall; var HookManager: THookManager; implementation +uses UCore; //------------ // Create - Creates Class and Set Standard Values @@ -192,6 +198,9 @@ begin //Fill it with Data Cur.Next := nil; + //Add Owner + Cur.Owner := Core.CurExecuted; + If (@Proc = nil) then begin //Use the ProcofClass Method Cur.isClass := True; @@ -228,12 +237,37 @@ begin Events[EventIndex].LastSubscriber := Cur; {$IFDEF DEBUG} - WriteLn('HookManager: Add Subscriber to Event ''' + Events[EventIndex].Name + ''' succesful. Handle: ''' + InttoStr(Result) + ''); + WriteLn('HookManager: Add Subscriber to Event ''' + Events[EventIndex].Name + ''' succesful. Handle: ''' + InttoStr(Result) + ''' Owner: ' + InttoStr(Cur.Owner)); {$ENDIF} end; end; end; +//------------ +// FreeSubscriber - Helper for DelSubscriber. Prevents Loss of Chain Items. Frees Memory. +//------------ +Procedure THookManager.FreeSubscriber(const EventIndex: Word; const Last, Cur: PSubscriberInfo); +begin + //Delete from Chain + If (Last <> nil) then + begin + Last.Next := Cur.Next; + end + else //Was first Popup + begin + Events[EventIndex].FirstSubscriber := Cur.Next; + end; + + //Was this Last subscription ? + If (Cur = Events[EventIndex].LastSubscriber) then + begin //Change Last Subscriber + Events[EventIndex].LastSubscriber := Last; + end; + + //Free Space: + FreeMem(Cur, SizeOf(TSubscriberInfo)); +end; + //------------ // DelSubscriber - Deletes a Subscribtion by Handle, return non Zero on Failure //------------ @@ -259,24 +293,7 @@ begin begin If (Cur.Self = hSubscriber) then begin //Found Subscription we searched for - //Delete from Chain - If (Last <> nil) then - begin - Last.Next := Cur.Next; - end - else //Was first Popup - begin - Events[EventIndex].FirstSubscriber := Cur.Next; - end; - - //Was this Last subscription ? - If (Cur = Events[EventIndex].LastSubscriber) then - begin //Change Last Subscriber - Events[EventIndex].LastSubscriber := Last; - end; - - //Free Space: - FreeMem(Cur, SizeOf(TSubscriberInfo)); + FreeSubscriber(EventIndex, Last, Cur); {$IFDEF DEBUG} WriteLn('HookManager: Del Subscriber from Event ''' + Events[EventIndex].Name + ''' succesful. Handle: ''' + InttoStr(hSubscriber) + ''); @@ -303,18 +320,24 @@ Function THookManager.CallEventChain (const hEvent: THandle; const wParam, lPara var EventIndex: Cardinal; Cur: PSubscriberInfo; + CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute begin Result := -1; EventIndex := hEvent - 1; If ((EventIndex <= High(Events)) AND (Events[EventIndex].Name[1] <> chr(0))) then begin //Existing Event + //Backup CurExecuted + CurExecutedBackup := Core.CurExecuted; + //Start calling the Chain !!!11 Cur := Events[EventIndex].FirstSubscriber; Result := 0; //Call Hooks until the Chain is at the End or breaked While ((Cur <> nil) AND (Result = 0)) do begin + //Set CurExecuted + Core.CurExecuted := Cur.Owner; if (Cur.isClass) then Result := Cur.ProcOfClass(wParam, lParam) else @@ -322,6 +345,9 @@ begin Cur := Cur.Next; end; + + //Restore CurExecuted + Core.CurExecuted := CurExecutedBackup; end; {$IFDEF DEBUG} @@ -354,22 +380,49 @@ begin end; end; - -function HookTest(wParam, lParam: DWord): integer; stdcall; -var Test: String[60]; -var T2: String; +//------------ +// DelbyOwner - Dels all Subscriptions by a specific Owner. (For Clean Plugin/Module unloading) +//------------ +Procedure THookManager.DelbyOwner(const Owner: Integer); +var + I: Integer; + Cur, Last: PSubscriberInfo; begin - Messagebox(0, 'Test', 'test', MB_ICONWARNING or MB_OK); - - Result := 0; //Don't break the chain + //Search for Owner in all Hooks Chains + For I := 0 to High(Events) do + begin + If (Events[I].Name[1] <> chr(0)) then + begin + + Last := nil; + Cur := Events[I].FirstSubscriber; + //Went Through Chain + While (Cur <> nil) do + begin + If (Cur.Owner = Owner) then + begin //Found Subscription by Owner -> Delete + FreeSubscriber(I, Last, Cur); + If (Last <> nil) then + Cur := Last.Next + else + Cur := Events[I].FirstSubscriber; + end + Else + begin + //Next Item: + Last := Cur; + Cur := Cur.Next; + end; + end; + end; + end; end; -function HookTest2(wParam, lParam: DWord): integer; stdcall; -begin - //Showmessage(String(PCHAR(Ptr(lParam))); - Messagebox(0, Ptr(lParam), 'test', MB_ICONWARNING or MB_OK); +function HookTest(wParam, lParam: DWord): integer; stdcall; +begin Result := 0; //Don't break the chain + Core.ShowMessage(CORE_SM_INFO, Integer(PChar(String(PChar(Ptr(lParam))) + ': ' + String(PChar(Ptr(wParam)))))); end; end. diff --git a/Game/Code/Classes/UModules.pas b/Game/Code/Classes/UModules.pas index e8e759ff..c126e9ee 100644 --- a/Game/Code/Classes/UModules.pas +++ b/Game/Code/Classes/UModules.pas @@ -8,11 +8,14 @@ interface *********************} uses - UCoreModule; + UCoreModule, + uPluginLoader; const - CORE_MODULES_TO_LOAD: Array[0..0] of cCoreModule = ( - TCoreModule //Remove this later, just a dummy + CORE_MODULES_TO_LOAD: Array[0..2] of cCoreModule = ( + TPluginLoader, //First because it has to look if there are Module replacements (Feature o/t Future) + TCoreModule, //Remove this later, just a dummy + TtehPlugins //Represents the Plugins. Last because they may use CoreModules Services etc. ); implementation diff --git a/Game/Code/Classes/UPluginInterface.pas b/Game/Code/Classes/UPluginInterface.pas index 6d17d51d..a9cc7e46 100644 --- a/Game/Code/Classes/UPluginInterface.pas +++ b/Game/Code/Classes/UPluginInterface.pas @@ -8,11 +8,6 @@ unit uPluginInterface; interface uses uPluginDefs; -//--------------- -// Procedure that Sets the PluginInterface Record -//--------------- - Procedure Init_PluginInterface; - //--------------- // Methods for Plugin //--------------- @@ -59,29 +54,8 @@ uses uPluginDefs; otherwise 0} Function ServiceExists (ServiceName: PChar): Integer; stdcall; -var - PluginInterface: TUS_PluginInterface; - implementation - -//--------------- -// Procedure that Sets the PluginInterface Record -//--------------- -Procedure Init_PluginInterface; -begin - PluginInterface.CreateHookableEvent := CreateHookableEvent; - PluginInterface.DestroyHookableEvent := DestroyHookableEvent; - PluginInterface.NotivyEventHooks := NotivyEventHooks; - PluginInterface.HookEvent := HookEvent; - PluginInterface.UnHookEvent := UnHookEvent; - PluginInterface.EventExists := EventExists; - - PluginInterface.CreateService := CreateService; - PluginInterface.DestroyService := DestroyService; - PluginInterface.CallService := CallService; - PluginInterface.ServiceExists := ServiceExists; -end; - +uses UCore; {******** Hook specific Methods ********} //--------------- @@ -90,7 +64,7 @@ end; //--------------- Function CreateHookableEvent (EventName: PChar): THandle; stdcall; begin - + Result := Core.Hooks.AddEvent(EventName); end; //--------------- @@ -99,7 +73,7 @@ end; //--------------- Function DestroyHookableEvent (hEvent: THandle): integer; stdcall; begin - + Result := Core.Hooks.DelEvent(hEvent); end; //--------------- @@ -109,7 +83,7 @@ end; //--------------- Function NotivyEventHooks (hEvent: THandle; wParam, lParam: dWord): integer; stdcall; begin - + Result := Core.Hooks.CallEventChain(hEvent, wParam, lParam); end; //--------------- @@ -118,7 +92,7 @@ end; //--------------- Function HookEvent (EventName: PChar; HookProc: TUS_Hook): THandle; stdcall; begin - + Result := Core.Hooks.AddSubscriber(EventName, HookProc); end; //--------------- @@ -127,7 +101,7 @@ end; //--------------- Function UnHookEvent (hHook: THandle): Integer; stdcall; begin - + Result := Core.Hooks.DelSubscriber(hHook); end; //--------------- @@ -136,7 +110,7 @@ end; //--------------- Function EventExists (EventName: PChar): Integer; stdcall; begin - + Result := Core.Hooks.EventExists(EventName); end; {******** Service specific Methods ********} @@ -146,7 +120,7 @@ end; //--------------- Function CreateService (ServiceName: PChar; ServiceProc: TUS_Service): THandle; stdcall; begin - + Result := Core.Services.AddService(ServiceName, ServiceProc); end; //--------------- @@ -155,7 +129,7 @@ end; //--------------- Function DestroyService (hService: THandle): integer; stdcall; begin - + Result := Core.Services.DelService(hService); end; //--------------- @@ -164,7 +138,7 @@ end; //--------------- Function CallService (ServiceName: PChar; wParam, lParam: dWord): integer; stdcall; begin - + Result := Core.Services.CallService(ServiceName, wParam, lParam); end; //--------------- @@ -173,7 +147,7 @@ end; //--------------- Function ServiceExists (ServiceName: PChar): Integer; stdcall; begin - + Result := Core.Services.ServiceExists(ServiceName); end; end. diff --git a/Game/Code/Classes/UServices.pas b/Game/Code/Classes/UServices.pas index fce81bd8..0028576b 100644 --- a/Game/Code/Classes/UServices.pas +++ b/Game/Code/Classes/UServices.pas @@ -22,7 +22,7 @@ type Hash: Integer; //4 Bit Hash of the Services Name Name: TServiceName; //Name of this Service - Owner: Integer; //If > 0 [DLLMan Pluginindex + 1]; 0 - undefined, On Error Full shutdown, If < 0 [ModuleIndex - 1] + Owner: Integer; //If < 0 [-(DLLMan Pluginindex + 1)]; 0 - undefined, On Error Full shutdown, If < 0 [ModuleIndex - 1] Next: PServiceInfo; //Pointer to the Next Service in teh list @@ -63,6 +63,7 @@ var ServiceManager: TServiceManager; implementation +uses UCore; //------------ // Create - Creates Class and Set Standard Values @@ -125,6 +126,9 @@ begin Cur.Name := String(ServiceName); Cur.Hash := NametoHash(Cur.Name); + //Add Owner to Service + Cur.Owner := Core.CurExecuted; + //Add Service to the List If (FirstService = nil) then FirstService := Cur; @@ -208,18 +212,26 @@ Function TServiceManager.CallService(const ServiceName: PChar; const wParam, lPa var SExists: Integer; Service: PServiceInfo; + CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute begin Result := SERVICE_NOT_FOUND; SExists := ServiceExists(ServiceName); If (SExists <> 0) then begin + //Backup CurExecuted + CurExecutedBackup := Core.CurExecuted; + Service := ptr(SExists); + If (Service.isClass) then //Use Proc of Class Result := Service.ProcOfClass(wParam, lParam) Else //Use normal Proc Result := Service.Proc(wParam, lParam); + + //Restore CurExecuted + Core.CurExecuted := CurExecutedBackup; end; {$IFDEF DEBUG} diff --git a/Game/Code/Classes/uPluginLoader.pas b/Game/Code/Classes/uPluginLoader.pas index 929fd84e..fadea0c6 100644 --- a/Game/Code/Classes/uPluginLoader.pas +++ b/Game/Code/Classes/uPluginLoader.pas @@ -1,7 +1,793 @@ unit uPluginLoader; +{********************* + uPluginLoader + Unit contains to Classes + TPluginLoader: Class Searching for and Loading the Plugins + TtehPlugins: Class that represents the Plugins in Modules chain +*********************} interface +uses UPluginDefs, UCoreModule; +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +type + TPluginListItem = record + Info: TUS_PluginInfo; + State: Byte; //State of this Plugin: 0 - undefined; 1 - Loaded; 2 - Inited / Running; 4 - Unloaded; 254 - Loading aborted by Plugin; 255 - Unloaded because of Error + Path: String; //Path to this Plugin + NeedsDeInit: Boolean; //If this is Inited correctly this should be true + hLib: THandle; //Handle of Loaded Libary + Procs: record //Procs offered by Plugin. Don't call this directly use wrappers of TPluginLoader + Load: Func_Load; + Init: Func_Init; + DeInit: Proc_DeInit; + end; + end; + {********************* + TPluginLoader + Class Searches for Plugins and Manages loading and unloading + *********************} + PPluginLoader = ^TPluginLoader; + TPluginLoader = class (TCoreModule) + private + LoadingProcessFinished: Boolean; + sUnloadPlugin: THandle; + sLoadPlugin: THandle; + sGetPluginInfo: THandle; + sGetPluginState: THandle; + + Procedure FreePlugin(Index: Cardinal); + public + PluginInterface: TUS_PluginInterface; + Plugins: Array of TPluginListItem; + + //TCoreModule methods to inherit + Constructor Create; override; + Procedure Info(const pInfo: PModuleInfo); override; + Function Load: Boolean; override; + Function Init: Boolean; override; + Procedure DeInit; override; + Procedure Free; override; + + //New Methods + Procedure BrowseDir(Path: String); //Browses the Path at _Path_ for Plugins + Function PluginExists(Name: String): Integer; //If Plugin Exists: Index of Plugin, else -1 + Procedure AddPlugin(Filename: String);//Adds Plugin to the Array + + Function CallLoad(Index: Cardinal): Integer; + Function CallInit(Index: Cardinal): Integer; + Procedure CallDeInit(Index: Cardinal); + + //Services offered + Function LoadPlugin(wParam, lParam: DWord): integer; //wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin + Function UnloadPlugin(wParam, lParam: DWord): integer; //wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin + Function GetPluginInfo(wParam, lParam: DWord): integer; //If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Get PluginInfo of Plugin with Index(wParam) to Address at lParam) + Function GetPluginState(wParam, lParam: DWord): integer; //If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Return PluginInfo of Plugin with Index(wParam)) + + end; + + {********************* + TtehPlugins + Class Represents the Plugins in Module Chain. + It Calls the Plugins Procs and Funcs + *********************} + TtehPlugins = class (TCoreModule) + private + PluginLoader: PPluginLoader; + public + //TCoreModule methods to inherit + Constructor Create; override; + + Procedure Info(const pInfo: PModuleInfo); override; + Function Load: Boolean; override; + Function Init: Boolean; override; + Procedure DeInit; override; + end; + +const + {$IFDEF win32} + PluginFileExtension = '.dll'; + {$ELSE} + PluginFileExtension = '.so'; + {$ENDIF} implementation +uses UCore, UPluginInterface, +{$IFDEF win32} + windows, +{$ELSE} + dynlibs, +{$ENDIF} +UMain, SysUtils; + +{********************* + TPluginLoader + Implentation +*********************} + +//------------- +// Function that gives some Infos about the Module to the Core +//------------- +Procedure TPluginLoader.Info(const pInfo: PModuleInfo); +begin + pInfo^.Name := 'TPluginLoader'; + pInfo^.Version := MakeVersion(1,0,0,chr(0)); + pInfo^.Description := 'Searches for Plugins, loads and unloads them'; +end; + +//------------- +// Just the Constructor +//------------- +Constructor TPluginLoader.Create; +begin + //Init PluginInterface + //Using Methods from UPluginInterface + PluginInterface.CreateHookableEvent := CreateHookableEvent; + PluginInterface.DestroyHookableEvent := DestroyHookableEvent; + PluginInterface.NotivyEventHooks := NotivyEventHooks; + PluginInterface.HookEvent := HookEvent; + PluginInterface.UnHookEvent := UnHookEvent; + PluginInterface.EventExists := EventExists; + + PluginInterface.CreateService := CreateService; + PluginInterface.DestroyService := DestroyService; + PluginInterface.CallService := CallService; + PluginInterface.ServiceExists := ServiceExists; + + //UnSet Private Var + LoadingProcessFinished := False; +end; + +//------------- +//Is Called on Loading. +//In this Method only Events and Services should be created +//to offer them to other Modules or Plugins during the Init process +//If False is Returned this will cause a Forced Exit +//------------- +Function TPluginLoader.Load: Boolean; +begin + Result := True; + + Try + //Start Searching for Plugins + BrowseDir(PluginPath); + Except + Result := False; + Core.ReportError(Integer(PChar('Error Browsing and Loading.')), Integer(PChar('TPluginLoader'))); + end; +end; + +//------------- +//Is Called on Init Process +//In this Method you can Hook some Events and Create + Init +//your Classes, Variables etc. +//If False is Returned this will cause a Forced Exit +//------------- +Function TPluginLoader.Init: Boolean; +begin + //Just set Prvate Var to true. + LoadingProcessFinished := True; + Result := True; +end; + +//------------- +//Is Called if this Module has been Inited and there is a Exit. +//Deinit is in backwards Initing Order +//------------- +Procedure TPluginLoader.DeInit; +var + I: Integer; +begin + //Force DeInit + //If some Plugins aren't DeInited for some Reason o0 + For I := 0 to High(Plugins) do + begin + If (Plugins[I].State < 4) then + FreePlugin(I); + end; + + //Nothing to do here. Core will remove the Hooks +end; + +//------------- +//Is Called if this Module will be unloaded and has been created +//Should be used to Free Memory +//------------- +Procedure TPluginLoader.Free; +begin + //Just save some Memory if it wasn't done now.. + SetLength(Plugins, 0); +end; + +//-------------- +// Browses the Path at _Path_ for Plugins +//-------------- +Procedure TPluginLoader.BrowseDir(Path: String); +var + SR: TSearchRec; +begin + //Search for other Dirs to Browse + if FindFirst(Path + '*', faDirectory, SR) = 0 then begin + repeat + if (SR.Name <> '.') and (SR.Name <> '..') then + BrowseDir(Path + Sr.Name + PathDelim); + until FindNext(SR) <> 0; + end; + FindClose(SR); + + //Search for Plugins at Path + if FindFirst(Path + '*' + PluginFileExtension, 0, SR) = 0 then + begin + repeat + AddPlugin(Path + SR.Name); + until FindNext(SR) <> 0; + end; + FindClose(SR); +end; + +//-------------- +// If Plugin Exists: Index of Plugin, else -1 +//-------------- +Function TPluginLoader.PluginExists(Name: String): Integer; +var + I: Integer; +begin + Result := -1; + + If (Length(Name) <= 32 { =>Length(TUS_PluginInfo.Name)}) then + begin + For I := 0 to High(Plugins) do + if (Plugins[I].Info.Name = Name) then + begin //Found the Plugin + Result := I; + Break; + end; + end; +end; + +//-------------- +// Adds Plugin to the Array +//-------------- +Procedure TPluginLoader.AddPlugin(Filename: String); +var + hLib: THandle; + PInfo: Proc_PluginInfo; + Info: TUS_PluginInfo; + PluginID: Integer; +begin + If (FileExists(Filename)) then + begin //Load Libary + hLib := LoadLibrary(PChar(Filename)); + If (hLib <> 0) then + begin //Try to get Address of the Info Proc + PInfo := GetProcAddress (hLib, PChar('USPlugin_Info')); + If (@PInfo <> nil) then + begin + Info.cbSize := SizeOf(TUS_PluginInfo); + + Try //Call Info Proc + PInfo(@Info); + Except + Info.Name := ''; + Core.ReportError(Integer(PChar('Error getting Plugin Info: ' + Filename)), Integer(PChar('TPluginLoader'))); + end; + + //Is Name set ? + If (Trim(Info.Name) <> '') then + begin + PluginID := PluginExists(Info.Name); + + If (PluginID > 0) AND (Plugins[PluginID].State >=4) then + PluginID := -1; + + If (PluginID = -1) then + begin + //Add new item to array + PluginID := Length(Plugins); + SetLength(Plugins, PluginID + 1); + + //Fill with Info: + Plugins[PluginID].Info := Info; + Plugins[PluginID].State := 0; + Plugins[PluginID].Path := Filename; + Plugins[PluginID].NeedsDeInit := False; + Plugins[PluginID].hLib := hLib; + + //Try to get Procs + Plugins[PluginID].Procs.Load := GetProcAddress (hLib, PChar('USPlugin_Load')); + Plugins[PluginID].Procs.Init := GetProcAddress (hLib, PChar('USPlugin_Init')); + Plugins[PluginID].Procs.DeInit := GetProcAddress (hLib, PChar('USPlugin_DeInit')); + + If (@Plugins[PluginID].Procs.Load = nil) OR (@Plugins[PluginID].Procs.Init = nil) OR (@Plugins[PluginID].Procs.DeInit = nil) then + begin + Plugins[PluginID].State := 255; + FreeLibrary(hLib); + Core.ReportError(Integer(PChar('Can''t get Plugin Procs from Libary: "' + Info.Name + '" ' + Filename)), Integer(PChar('TPluginLoader'))); + end; + + //Emulate loading process if this Plugin is loaded to late + If (LoadingProcessFinished) then + begin + CallLoad(PluginID); + CallInit(PluginID); + end; + end + Else If (LoadingProcessFinished = False) then + begin + If (Plugins[PluginID].Info.Version < Info.Version) then + begin //Found newer Version of this Plugin + Core.ReportDebug(Integer(PChar('Found a newer Version of Plugin: ' + Info.Name)), Integer(PChar('TPluginLoader'))); + + //Unload Old Plugin + UnloadPlugin(Integer(nil), PluginID); + + //Fill with new Info + Plugins[PluginID].Info := Info; + Plugins[PluginID].State := 0; + Plugins[PluginID].Path := Filename; + Plugins[PluginID].NeedsDeInit := False; + Plugins[PluginID].hLib := hLib; + + //Try to get Procs + Plugins[PluginID].Procs.Load := GetProcAddress (hLib, PChar('USPlugin_Load')); + Plugins[PluginID].Procs.Init := GetProcAddress (hLib, PChar('USPlugin_Init')); + Plugins[PluginID].Procs.DeInit := GetProcAddress (hLib, PChar('USPlugin_DeInit')); + + If (@Plugins[PluginID].Procs.Load = nil) OR (@Plugins[PluginID].Procs.Init = nil) OR (@Plugins[PluginID].Procs.DeInit = nil) then + begin + FreeLibrary(hLib); + Plugins[PluginID].State := 255; + Core.ReportError(Integer(PChar('Can''t get Plugin Procs from Libary: "' + Info.Name + '" ' + Filename)), Integer(PChar('TPluginLoader'))); + end; + end + else + begin //Newer Version already loaded + FreeLibrary(hLib); + end; + end + else + begin + FreeLibrary(hLib); + Core.ReportError(Integer(PChar('Plugin with this Name already exists: ' + Info.Name)), Integer(PChar('TPluginLoader'))); + end; + end + else + begin + FreeLibrary(hLib); + Core.ReportError(Integer(PChar('No name reported: ' + Filename)), Integer(PChar('TPluginLoader'))); + end; + end + else + begin + FreeLibrary(hLib); + Core.ReportError(Integer(PChar('Can''t find Info Procedure: ' + Filename)), Integer(PChar('TPluginLoader'))); + end; + end + else + Core.ReportError(Integer(PChar('Can''t load Plugin Libary: ' + Filename)), Integer(PChar('TPluginLoader'))); + end; +end; + +//-------------- +// Calls Load Func of Plugin with the given Index +//-------------- +Function TPluginLoader.CallLoad(Index: Cardinal): Integer; +begin + Result := -2; + If(Index < Length(Plugins)) then + begin + If (@Plugins[Index].Procs.Load <> nil) AND (Plugins[Index].State = 0) then + begin + Try + Result := Plugins[Index].Procs.Load(@PluginInterface); + Except + Result := -3; + End; + + If (Result = 0) then + Plugins[Index].State := 1 + Else + begin + FreePlugin(Index); + Plugins[Index].State := 255; + Core.ReportError(Integer(PChar('Error calling Load Function from Plugin: ' + Plugins[Index].Info.Name)), Integer(PChar('TPluginLoader'))); + end; + end; + end; +end; + +//-------------- +// Calls Init Func of Plugin with the given Index +//-------------- +Function TPluginLoader.CallInit(Index: Cardinal): Integer; +begin + Result := -2; + If(Index < Length(Plugins)) then + begin + If (@Plugins[Index].Procs.Init <> nil) AND (Plugins[Index].State = 1) then + begin + Try + Result := Plugins[Index].Procs.Init(@PluginInterface); + Except + Result := -3; + End; + + If (Result = 0) then + begin + Plugins[Index].State := 2; + Plugins[Index].NeedsDeInit := True; + end + Else + begin + FreePlugin(Index); + Plugins[Index].State := 255; + Core.ReportError(Integer(PChar('Error calling Init Function from Plugin: ' + Plugins[Index].Info.Name)), Integer(PChar('TPluginLoader'))); + end; + end; + end; +end; + +//-------------- +// Calls DeInit Proc of Plugin with the given Index +//-------------- +Procedure TPluginLoader.CallDeInit(Index: Cardinal); +begin + If(Index < Length(Plugins)) then + begin + If (Plugins[Index].State < 4) then + begin + If (@Plugins[Index].Procs.DeInit <> nil) and (Plugins[Index].NeedsDeInit) then + Try + Plugins[Index].Procs.DeInit(@PluginInterface); + Except + + End; + + //Don't forget to remove Services and Subscriptions by this Plugin + Core.Hooks.DelbyOwner(-1 - Index); + + FreePlugin(Index); + end; + end; +end; + +//-------------- +// Frees all Plugin Sources (Procs and Handles) - Helper for Deiniting Functions +//-------------- +Procedure TPluginLoader.FreePlugin(Index: Cardinal); +begin + Plugins[Index].State := 4; + Plugins[Index].Procs.Load := nil; + Plugins[Index].Procs.Init := nil; + Plugins[Index].Procs.DeInit := nil; + + If (Plugins[Index].hLib <> 0) then + FreeLibrary(Plugins[Index].hLib); +end; + + + +//-------------- +// wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin +//-------------- +Function TPluginLoader.LoadPlugin(wParam, lParam: DWord): integer; +var + Index: Integer; + sFile: String; +begin + Result := -1; + sFile := ''; + //lParam is ID + If (Ptr(wParam) = nil) then + begin + Index := lParam; + end + else + begin //wParam is PChar + try + sFile := String(PChar(Ptr(wParam))); + Index := PluginExists(sFile); + If (Index < 0) And FileExists(sFile) then + begin //Is Filename + AddPlugin(sFile); + Result := Plugins[High(Plugins)].State; + end; + except + Index := -2; + end; + end; + + + If (Index >= 0) and (Index < Length(Plugins)) then + begin + AddPlugin(Plugins[Index].Path); + Result := Plugins[Index].State; + end; +end; + +//-------------- +// wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin +//-------------- +Function TPluginLoader.UnloadPlugin(wParam, lParam: DWord): integer; +var + Index: Integer; + sName: String; +begin + Result := -1; + //lParam is ID + If (Ptr(wParam) = nil) then + begin + Index := lParam; + end + else + begin //wParam is PChar + try + sName := String(PChar(Ptr(wParam))); + Index := PluginExists(sName); + except + Index := -2; + end; + end; + + + If (Index >= 0) and (Index < Length(Plugins)) then + CallDeInit(Index) +end; + +//-------------- +// If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Get PluginInfo of Plugin with Index(wParam) to Address at lParam) +//-------------- +Function TPluginLoader.GetPluginInfo(wParam, lParam: DWord): integer; +var I: Integer; +begin + Result := 0; + If (wParam < 0) then + begin //Get Info of 1 Plugin + If (Ptr(lParam) <> nil) AND (wParam < Length(Plugins)) then + begin + Try + Result := 1; + PUS_PluginInfo(Ptr(lParam))^ := Plugins[wParam].Info; + Except + + End; + end; + end + Else If (Ptr(lParam) = nil) then + begin //Get Length of Plugin (Info) Array + Result := Length(Plugins); + end + Else //Write PluginInfo Array to Address in lParam + begin + Try + For I := 0 to high(Plugins) do + PAUS_PluginInfo(Ptr(lParam))^[I] := Plugins[I].Info; + Result := Length(Plugins); + Except + Core.ReportError(Integer(PChar('Could not write PluginInfo Array')), Integer(PChar('TPluginLoader'))); + End; + end; + +end; + +//-------------- +// If wParam = -1 then (If lParam = nil then get length of Plugin State Array. If lparam <> nil then write array of Byte to address at lparam) Else (Return State of Plugin with Index(wParam)) +//-------------- +Function TPluginLoader.GetPluginState(wParam, lParam: DWord): integer; +var I: Integer; +begin + Result := -1; + If (wParam < 0) then + begin //Get State of 1 Plugin + If (wParam < Length(Plugins)) then + begin + Result := Plugins[wParam].State; + end; + end + Else If (Ptr(lParam) = nil) then + begin //Get Length of Plugin (Info) Array + Result := Length(Plugins); + end + Else //Write PluginInfo Array to Address in lParam + begin + Try + For I := 0 to high(Plugins) do + Byte(Ptr(lParam + I)^) := Plugins[I].State; + Result := Length(Plugins); + Except + Core.ReportError(Integer(PChar('Could not write PluginState Array')), Integer(PChar('TPluginLoader'))); + End; + end; +end; + + + + + +{********************* + TtehPlugins + Implentation +*********************} + +//------------- +// Function that gives some Infos about the Module to the Core +//------------- +Procedure TtehPlugins.Info(const pInfo: PModuleInfo); +begin + pInfo^.Name := 'TtehPlugins'; + pInfo^.Version := MakeVersion(1,0,0,chr(0)); + pInfo^.Description := 'Module executing the Plugins!'; +end; + +//------------- +// Just the Constructor +//------------- +Constructor TtehPlugins.Create; +begin + PluginLoader := nil; +end; + +//------------- +//Is Called on Loading. +//In this Method only Events and Services should be created +//to offer them to other Modules or Plugins during the Init process +//If False is Returned this will cause a Forced Exit +//------------- +Function TtehPlugins.Load: Boolean; +var + I: Integer; //Counter + CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute +label Continue; +begin + //Get Pointer to PluginLoader + PluginLoader := PPluginLoader(Core.GetModulebyName('TPluginLoader')); + If (PluginLoader = nil) then + begin + Result := False; + Core.ReportError(Integer(PChar('Could not get Pointer to PluginLoader')), Integer(PChar('TtehPlugins'))); + end + else + begin + Result := True; + + //Backup CurExecuted + CurExecutedBackup := Core.CurExecuted; + + //Start Loading the Plugins + I := 0; + Continue: + Try + While (I <= High(PluginLoader.Plugins)) do + begin + Core.CurExecuted := -1 - I; + + //Unload Plugin if not correctly Executed + If (PluginLoader.CallLoad(I) <> 0) then + begin + PluginLoader.CallDeInit(I); + PluginLoader.Plugins[I].State := 254; //Plugin asks for unload + Core.ReportDebug(Integer(PChar('Plugin Selfabort during loading process: ' + PluginLoader.Plugins[I].Info.Name)), Integer(PChar('TtehPlugins'))); + end + else + Core.ReportDebug(Integer(PChar('Plugin loaded succesful: ' + PluginLoader.Plugins[I].Info.Name)), Integer(PChar('TtehPlugins'))); + + Inc(I); + end; + Except + //Plugin could not be loaded. + // => Show Error Message, then ShutDown Plugin + on E: Exception do + begin + PluginLoader.CallDeInit(I); + PluginLoader.Plugins[I].State := 255; //Plugin causes Error + Core.ReportError(Integer(PChar('Plugin causes Error during loading process: ' + PluginLoader.Plugins[I].Info.Name + ', ErrorMsg: "' + E.Message + '"')), Integer(PChar('TtehPlugins'))); + + + //don't forget to increase I + Inc(I); + end; + End; + + If (I <= High(PluginLoader.Plugins)) then + Goto Continue; + + //Reset CurExecuted + Core.CurExecuted := CurExecutedBackup; + end; +end; + +//------------- +//Is Called on Init Process +//In this Method you can Hook some Events and Create + Init +//your Classes, Variables etc. +//If False is Returned this will cause a Forced Exit +//------------- +Function TtehPlugins.Init: Boolean; +var + I: Integer; //Counter + CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute +label Continue; +begin + Result := True; + + //Backup CurExecuted + CurExecutedBackup := Core.CurExecuted; + + //Start Loading the Plugins + I := 0; + Continue: + Try + While (I <= High(PluginLoader.Plugins)) do + begin + Core.CurExecuted := -1 - I; + + //Unload Plugin if not correctly Executed + If (PluginLoader.CallInit(I) <> 0) then + begin + PluginLoader.CallDeInit(I); + PluginLoader.Plugins[I].State := 254; //Plugin asks for unload + Core.ReportDebug(Integer(PChar('Plugin Selfabort during init process: ' + PluginLoader.Plugins[I].Info.Name)), Integer(PChar('TtehPlugins'))); + end + else + Core.ReportDebug(Integer(PChar('Plugin inited succesful: ' + PluginLoader.Plugins[I].Info.Name)), Integer(PChar('TtehPlugins'))); + + //don't forget to increase I + Inc(I); + end; + Except + //Plugin could not be loaded. + // => Show Error Message, then ShutDown Plugin + PluginLoader.CallDeInit(I); + PluginLoader.Plugins[I].State := 255; //Plugin causes Error + Core.ReportError(Integer(PChar('Plugin causes Error during init process: ' + PluginLoader.Plugins[I].Info.Name)), Integer(PChar('TtehPlugins'))); + + //don't forget to increase I + Inc(I); + End; + + If (I <= High(PluginLoader.Plugins)) then + GoTo Continue; + + //Reset CurExecuted + Core.CurExecuted := CurExecutedBackup; +end; + +//------------- +//Is Called if this Module has been Inited and there is a Exit. +//Deinit is in backwards Initing Order +//------------- +Procedure TtehPlugins.DeInit; +var + I: Integer; //Counter + CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute +label Continue; +begin + //Backup CurExecuted + CurExecutedBackup := Core.CurExecuted; + + //Start Loop + I := 0; + + Continue: + Try + While (I <= High(PluginLoader.Plugins)) do + begin + //DeInit Plugin + PluginLoader.CallDeInit(I); + + Inc(I); + end; + Except + Inc(I); + End; + + If I <= High(PluginLoader.Plugins) then + Goto Continue; + + //Reset CurExecuted + Core.CurExecuted := CurExecutedBackup; +end; end. -- cgit v1.2.3 From 5802c7be05f25e5da3a991377942c00ee7d95639 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 27 Oct 2007 09:36:49 +0000 Subject: try to fix build errors git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@537 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCore.pas | 2 +- Game/Code/Classes/UModules.pas | 2 +- Game/Code/Classes/uPluginLoader.pas | 4 ++-- Game/Code/UltraStar.dpr | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UCore.pas b/Game/Code/Classes/UCore.pas index a8a29aeb..9c31e79a 100644 --- a/Game/Code/Classes/UCore.pas +++ b/Game/Code/Classes/UCore.pas @@ -1,7 +1,7 @@ unit UCore; interface -uses uPluginDefs, uCoreModule, UHooks, UServices, uModules; +uses uPluginDefs, uCoreModule, UHooks, UServices, UModules; {********************* TCore Class manages all CoreModules, teh StartUp, teh MainLoop and the shutdown process diff --git a/Game/Code/Classes/UModules.pas b/Game/Code/Classes/UModules.pas index c126e9ee..493fc393 100644 --- a/Game/Code/Classes/UModules.pas +++ b/Game/Code/Classes/UModules.pas @@ -9,7 +9,7 @@ interface uses UCoreModule, - uPluginLoader; + UPluginLoader; const CORE_MODULES_TO_LOAD: Array[0..2] of cCoreModule = ( diff --git a/Game/Code/Classes/uPluginLoader.pas b/Game/Code/Classes/uPluginLoader.pas index fadea0c6..442e76e0 100644 --- a/Game/Code/Classes/uPluginLoader.pas +++ b/Game/Code/Classes/uPluginLoader.pas @@ -1,6 +1,6 @@ -unit uPluginLoader; +unit UPluginLoader; {********************* - uPluginLoader + UPluginLoader Unit contains to Classes TPluginLoader: Class Searching for and Loading the Plugins TtehPlugins: Class that represents the Plugins in Modules chain diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 0b7e8449..81596deb 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -93,7 +93,7 @@ uses UCore in 'Classes\UCore.pas', //Core, Maybe remove this UCoreModule in 'Classes\UCoreModule.pas', //^ UPluginInterface in 'Classes\UPluginInterface.pas', //Interface offered by Core to Plugins - uPluginLoader in 'Classes\uPluginLoader.pas', //New Plugin Loader Module + UPluginLoader in 'Classes\UPluginLoader.pas', //New Plugin Loader Module UParty in 'Classes\UParty.pas', // to - do : rewrite Party Manager as Module, reomplent ability to offer party Mody by Plugin -- cgit v1.2.3 From e779d4f8a8ca13215895338f71e6929dc795cf60 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 29 Oct 2007 15:40:07 +0000 Subject: Add new Party Modi SDK to Trunk git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@539 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.dpr | 1 + 1 file changed, 1 insertion(+) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 81596deb..536ef6be 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -154,6 +154,7 @@ uses //------------------------------ ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', //Old SDK, will be deleted soon UPluginDefs in '..\..\Modis\SDK\UPluginDefs.pas', //New SDK, not only Modis + UPartyDefs in '..\..\Modis\SDK\UPartyDefs.pas', //Headers to register Party Modes Windows, SysUtils; -- cgit v1.2.3 From 52eeec05d021df5334934f50dfafff981cbca33b Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Mon, 29 Oct 2007 21:40:14 +0000 Subject: Just adding first MacOSX version. This does not compile yet. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@540 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/MacOSX/English.lproj/InfoPlist.strings | Bin 0 -> 532 bytes .../MacOSX/English.lproj/SDLMain.nib/classes.nib | 19 + .../Code/MacOSX/English.lproj/SDLMain.nib/info.nib | 21 + .../MacOSX/English.lproj/SDLMain.nib/objects.nib | Bin 0 -> 2590 bytes Game/Code/MacOSX/Info.plist | 28 + Game/Code/MacOSX/Platform.inc | 13 + Game/Code/MacOSX/UltraStarDX.icns | Bin 0 -> 32376 bytes Game/Code/MacOSX/UltraStarDX.pas | 8 + Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 | 1374 ++++++ .../MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser | 456 ++ .../MacOSX/UltraStarDX.xcodeproj/project.pbxproj | 1119 +++++ Game/Code/MacOSX/Wrapper/Graphics.pas | 190 + Game/Code/MacOSX/Wrapper/JPEG.pas | 34 + Game/Code/MacOSX/Wrapper/MacClasses.pas | 57 + Game/Code/MacOSX/Wrapper/MidiFile.pas | 102 + Game/Code/MacOSX/Wrapper/MidiOut.pas | 62 + Game/Code/MacOSX/Wrapper/OpenGL12.pas | 4696 ++++++++++++++++++++ Game/Code/MacOSX/Wrapper/PNGImage.pas | 14 + Game/Code/MacOSX/Wrapper/Windows.pas | 139 + Game/Code/MacOSX/Wrapper/zlportio.pas | 31 + 20 files changed, 8363 insertions(+) create mode 100755 Game/Code/MacOSX/English.lproj/InfoPlist.strings create mode 100644 Game/Code/MacOSX/English.lproj/SDLMain.nib/classes.nib create mode 100644 Game/Code/MacOSX/English.lproj/SDLMain.nib/info.nib create mode 100644 Game/Code/MacOSX/English.lproj/SDLMain.nib/objects.nib create mode 100644 Game/Code/MacOSX/Info.plist create mode 100755 Game/Code/MacOSX/Platform.inc create mode 100644 Game/Code/MacOSX/UltraStarDX.icns create mode 100644 Game/Code/MacOSX/UltraStarDX.pas create mode 100644 Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 create mode 100644 Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser create mode 100644 Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj create mode 100755 Game/Code/MacOSX/Wrapper/Graphics.pas create mode 100755 Game/Code/MacOSX/Wrapper/JPEG.pas create mode 100755 Game/Code/MacOSX/Wrapper/MacClasses.pas create mode 100755 Game/Code/MacOSX/Wrapper/MidiFile.pas create mode 100755 Game/Code/MacOSX/Wrapper/MidiOut.pas create mode 100755 Game/Code/MacOSX/Wrapper/OpenGL12.pas create mode 100755 Game/Code/MacOSX/Wrapper/PNGImage.pas create mode 100755 Game/Code/MacOSX/Wrapper/Windows.pas create mode 100755 Game/Code/MacOSX/Wrapper/zlportio.pas (limited to 'Game/Code') diff --git a/Game/Code/MacOSX/English.lproj/InfoPlist.strings b/Game/Code/MacOSX/English.lproj/InfoPlist.strings new file mode 100755 index 00000000..ce30d99a Binary files /dev/null and b/Game/Code/MacOSX/English.lproj/InfoPlist.strings differ diff --git a/Game/Code/MacOSX/English.lproj/SDLMain.nib/classes.nib b/Game/Code/MacOSX/English.lproj/SDLMain.nib/classes.nib new file mode 100644 index 00000000..799eaadd --- /dev/null +++ b/Game/Code/MacOSX/English.lproj/SDLMain.nib/classes.nib @@ -0,0 +1,19 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = { + help = id; + newGame = id; + openGame = id; + prefsMenu = id; + saveGame = id; + saveGameAs = id; + }; + CLASS = SDLMain; + LANGUAGE = ObjC; + SUPERCLASS = NSObject; + } + ); + IBVersion = 1; +} \ No newline at end of file diff --git a/Game/Code/MacOSX/English.lproj/SDLMain.nib/info.nib b/Game/Code/MacOSX/English.lproj/SDLMain.nib/info.nib new file mode 100644 index 00000000..1d6fb7e0 --- /dev/null +++ b/Game/Code/MacOSX/English.lproj/SDLMain.nib/info.nib @@ -0,0 +1,21 @@ + + + + + IBDocumentLocation + 62 117 356 240 0 0 1152 848 + IBEditorPositions + + 29 + 62 362 195 44 0 0 1152 848 + + IBFramework Version + 291.0 + IBOpenObjects + + 29 + + IBSystem Version + 6L60 + + diff --git a/Game/Code/MacOSX/English.lproj/SDLMain.nib/objects.nib b/Game/Code/MacOSX/English.lproj/SDLMain.nib/objects.nib new file mode 100644 index 00000000..63780152 Binary files /dev/null and b/Game/Code/MacOSX/English.lproj/SDLMain.nib/objects.nib differ diff --git a/Game/Code/MacOSX/Info.plist b/Game/Code/MacOSX/Info.plist new file mode 100644 index 00000000..dd9c079f --- /dev/null +++ b/Game/Code/MacOSX/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${PRODUCT_NAME} + CFBundleIconFile + UltraStar.icns + CFBundleIdentifier + org.ultrastardeluxe.ultrastardeluxe + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + SDLMain + NSPrincipalClass + NSApplication + + diff --git a/Game/Code/MacOSX/Platform.inc b/Game/Code/MacOSX/Platform.inc new file mode 100755 index 00000000..7f028a12 --- /dev/null +++ b/Game/Code/MacOSX/Platform.inc @@ -0,0 +1,13 @@ + +{$IFDEF FPC} + {$MODE DELPHI} + {$H+} + {$R-} + {$DEFINE DLL_CDECL} + {$DEFINE MACOS} + {$DEFINE WIN32} + {$DEFINE TRANSLATE} +{$ELSE} + {$DEFINE DLL_STDCALL} +{$ENDIF} + diff --git a/Game/Code/MacOSX/UltraStarDX.icns b/Game/Code/MacOSX/UltraStarDX.icns new file mode 100644 index 00000000..fd7b8745 Binary files /dev/null and b/Game/Code/MacOSX/UltraStarDX.icns differ diff --git a/Game/Code/MacOSX/UltraStarDX.pas b/Game/Code/MacOSX/UltraStarDX.pas new file mode 100644 index 00000000..da42fb6a --- /dev/null +++ b/Game/Code/MacOSX/UltraStarDX.pas @@ -0,0 +1,8 @@ +program UltraStar; + +uses UMain; + +begin + Main; +end. + diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 new file mode 100644 index 00000000..c93ec352 --- /dev/null +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 @@ -0,0 +1,1374 @@ + + + + + ActivePerspectiveName + Project + AllowedModules + + + BundleLoadPath + + MaxInstances + n + Module + PBXSmartGroupTreeModule + Name + Groups and Files Outline View + + + BundleLoadPath + + MaxInstances + n + Module + PBXNavigatorGroup + Name + Editor + + + BundleLoadPath + + MaxInstances + n + Module + XCTaskListModule + Name + Task List + + + BundleLoadPath + + MaxInstances + n + Module + XCDetailModule + Name + File and Smart Group Detail Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXBuildResultsModule + Name + Detailed Build Results Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXProjectFindModule + Name + Project Batch Find Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXRunSessionModule + Name + Run Log + + + BundleLoadPath + + MaxInstances + n + Module + PBXBookmarksModule + Name + Bookmarks Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXClassBrowserModule + Name + Class Browser + + + BundleLoadPath + + MaxInstances + n + Module + PBXCVSModule + Name + Source Code Control Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXDebugBreakpointsModule + Name + Debug Breakpoints Tool + + + BundleLoadPath + + MaxInstances + n + Module + XCDockableInspector + Name + Inspector + + + BundleLoadPath + + MaxInstances + n + Module + PBXOpenQuicklyModule + Name + Open Quickly Tool + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugSessionModule + Name + Debugger + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugCLIModule + Name + Debug Console + + + Description + DefaultDescriptionKey + DockingSystemVisible + + Extension + mode1 + FavBarConfig + + PBXProjectModuleGUID + 2CDD4B6F0CB935C700549FAC + XCBarModuleItemNames + + XCBarModuleItems + + + FirstTimeWindowDisplayed + + Identifier + com.apple.perspectives.project.mode1 + MajorVersion + 31 + MinorVersion + 1 + Name + Default + Notifications + + OpenEditors + + + Content + + PBXProjectModuleGUID + 2C0B7D300CD683C80062A7C8 + PBXProjectModuleLabel + TextGL.pas + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 2C0B7D310CD683C80062A7C8 + PBXProjectModuleLabel + TextGL.pas + _historyCapacity + 0 + bookmark + 2C0B7D320CD683C80062A7C8 + history + + 2C0B7D280CD6808A0062A7C8 + + + SplitCount + 1 + + StatusBarVisibility + + + Geometry + + Frame + {{0, 20}, {616, 644}} + PBXModuleWindowStatusBarHidden2 + + RubberWindowFrame + 38 317 616 685 0 0 1680 1028 + + + + PerspectiveWidths + + -1 + -1 + + Perspectives + + + ChosenToolbarItems + + active-target-popup + active-buildstyle-popup + action + NSToolbarFlexibleSpaceItem + buildOrClean + build-and-runOrDebug + com.apple.ide.PBXToolbarStopButton + get-info + toggle-editor + NSToolbarFlexibleSpaceItem + com.apple.pbx.toolbar.searchfield + + ControllerClassBaseName + + IconName + WindowOfProjectWithEditor + Identifier + perspective.project + IsVertical + + Layout + + + BecomeActive + + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 1CE0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 266 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + DDC6850D09F5717A004E4BFF + DD7C45450A6E72DE003FA52B + DDC6868A09F571C2004E4BFF + 2CDD8D0B0CC5539900E4169D + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 21 + 19 + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {266, 694}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {283, 712}} + GroupTreeTableConfiguration + + MainColumn + 266 + + RubberWindowFrame + 665 266 817 753 0 0 1680 1028 + + Module + PBXSmartGroupTreeModule + Proportion + 283pt + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20306471E060097A5F4 + PBXProjectModuleLabel + + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1CE0B20406471E060097A5F4 + PBXProjectModuleLabel + + + SplitCount + 1 + + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {529, 0}} + RubberWindowFrame + 665 266 817 753 0 0 1680 1028 + + Module + PBXNavigatorGroup + Proportion + 0pt + + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20506471E060097A5F4 + PBXProjectModuleLabel + Detail + + GeometryConfiguration + + Frame + {{0, 5}, {529, 707}} + RubberWindowFrame + 665 266 817 753 0 0 1680 1028 + + Module + XCDetailModule + Proportion + 707pt + + + Proportion + 529pt + + + Name + Project + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + XCModuleDock + PBXNavigatorGroup + XCDetailModule + + TableOfContents + + 2C0B7D2E0CD683C80062A7C8 + 1CE0B1FE06471DED0097A5F4 + 2C0B7D2F0CD683C80062A7C8 + 1CE0B20306471E060097A5F4 + 1CE0B20506471E060097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default + + + ControllerClassBaseName + + IconName + WindowOfProject + Identifier + perspective.morph + IsVertical + 0 + Layout + + + BecomeActive + 1 + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 11E0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 29B97314FDCFA39411CA2CEA + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {186, 337}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + 1 + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 355}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 373 269 690 397 0 0 1440 878 + + Module + PBXSmartGroupTreeModule + Proportion + 100% + + + Name + Morph + PreferredWidth + 300 + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + + TableOfContents + + 11E0B1FE06471DED0097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default.short + + + PerspectivesBarVisible + + ShelfIsVisible + + SourceDescription + file at '/System/Library/PrivateFrameworks/DevToolsInterface.framework/Versions/A/Resources/XCPerspectivesSpecificationMode1.xcperspec' + StatusbarIsVisible + + TimeStamp + 0.0 + ToolbarDisplayMode + 1 + ToolbarIsVisible + + ToolbarSizeMode + 1 + Type + Perspectives + UpdateMessage + The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'? + WindowJustification + 5 + WindowOrderList + + 2CDD4B730CB935C700549FAC + 2C0B7D270CD680850062A7C8 + 1CD10A99069EF8BA00B06720 + 2C0B7D300CD683C80062A7C8 + /Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj + + WindowString + 665 266 817 753 0 0 1680 1028 + WindowTools + + + FirstTimeWindowDisplayed + + Identifier + windowTool.build + IsVertical + + Layout + + + Dock + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528F0623707200166675 + PBXProjectModuleLabel + UCommon.pas + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {1318, 344}} + RubberWindowFrame + 347 117 1318 626 0 0 1680 1028 + + Module + PBXNavigatorGroup + Proportion + 344pt + + + ContentConfiguration + + PBXProjectModuleGUID + XCMainBuildResultsModuleGUID + PBXProjectModuleLabel + Build + XCBuildResultsTrigger_Collapse + 1021 + XCBuildResultsTrigger_Open + 1011 + + GeometryConfiguration + + Frame + {{0, 349}, {1318, 236}} + RubberWindowFrame + 347 117 1318 626 0 0 1680 1028 + + Module + PBXBuildResultsModule + Proportion + 236pt + + + Proportion + 585pt + + + Name + Build Results + ServiceClasses + + PBXBuildResultsModule + + StatusbarIsVisible + + TableOfContents + + 2CDD4B730CB935C700549FAC + 2C0B7D200CD680850062A7C8 + 1CD0528F0623707200166675 + XCMainBuildResultsModuleGUID + + ToolbarConfiguration + xcode.toolbar.config.build + WindowString + 347 117 1318 626 0 0 1680 1028 + WindowToolGUID + 2CDD4B730CB935C700549FAC + WindowToolIsVisible + + + + FirstTimeWindowDisplayed + + Identifier + windowTool.debugger + IsVertical + + Layout + + + Dock + + + ContentConfiguration + + Debugger + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {368, 414}} + {{368, 0}, {596, 414}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {964, 414}} + {{0, 414}, {964, 374}} + + + + LauncherConfigVersion + 8 + PBXProjectModuleGUID + 1C162984064C10D400B95A72 + PBXProjectModuleLabel + Debug - GLUTExamples (Underwater) + + GeometryConfiguration + + DebugConsoleDrawerSize + {100, 120} + DebugConsoleVisible + None + DebugConsoleWindowFrame + {{200, 200}, {500, 300}} + DebugSTDIOWindowFrame + {{200, 200}, {500, 300}} + Frame + {{0, 0}, {964, 788}} + RubberWindowFrame + 227 161 964 829 0 0 1680 1028 + + Module + PBXDebugSessionModule + Proportion + 788pt + + + Proportion + 788pt + + + Name + Debugger + ServiceClasses + + PBXDebugSessionModule + + StatusbarIsVisible + + TableOfContents + + 1CD10A99069EF8BA00B06720 + 2C0B7D210CD680850062A7C8 + 1C162984064C10D400B95A72 + 2C0B7D220CD680850062A7C8 + 2C0B7D230CD680850062A7C8 + 2C0B7D240CD680850062A7C8 + 2C0B7D250CD680850062A7C8 + 2C0B7D260CD680850062A7C8 + 2C0B7D270CD680850062A7C8 + + ToolbarConfiguration + xcode.toolbar.config.debug + WindowString + 227 161 964 829 0 0 1680 1028 + WindowToolGUID + 1CD10A99069EF8BA00B06720 + WindowToolIsVisible + + + + FirstTimeWindowDisplayed + + Identifier + windowTool.find + IsVertical + + Layout + + + Dock + + + Dock + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CDD528C0622207200134675 + PBXProjectModuleLabel + TextGL.pas + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {790, 502}} + RubberWindowFrame + 688 118 790 888 0 0 1680 1028 + + Module + PBXNavigatorGroup + Proportion + 790pt + + + Proportion + 502pt + + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528E0623707200166675 + PBXProjectModuleLabel + Project Find + + GeometryConfiguration + + Frame + {{0, 507}, {790, 340}} + RubberWindowFrame + 688 118 790 888 0 0 1680 1028 + + Module + PBXProjectFindModule + Proportion + 340pt + + + Proportion + 847pt + + + Name + Project Find + ServiceClasses + + PBXProjectFindModule + + StatusbarIsVisible + + TableOfContents + + 1C530D57069F1CE1000CFCEE + 2CE78DAF0CCBA1C0003B6817 + 2CE78DB00CCBA1C0003B6817 + 1CDD528C0622207200134675 + 1CD0528E0623707200166675 + + WindowString + 688 118 790 888 0 0 1680 1028 + WindowToolGUID + 1C530D57069F1CE1000CFCEE + WindowToolIsVisible + + + + Identifier + MENUSEPARATOR + + + FirstTimeWindowDisplayed + + Identifier + windowTool.debuggerConsole + IsVertical + + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAAC065D492600B07095 + PBXProjectModuleLabel + Debugger Console + + GeometryConfiguration + + Frame + {{0, 0}, {440, 358}} + RubberWindowFrame + 80 556 440 400 0 0 1680 1028 + + Module + PBXDebugCLIModule + Proportion + 358pt + + + Proportion + 359pt + + + Name + Debugger Console + ServiceClasses + + PBXDebugCLIModule + + StatusbarIsVisible + + TableOfContents + + 2CDD4BFC0CB948FC00549FAC + 2CDD8E5D0CC558D500E4169D + 1C78EAAC065D492600B07095 + + WindowString + 80 556 440 400 0 0 1680 1028 + WindowToolGUID + 2CDD4BFC0CB948FC00549FAC + WindowToolIsVisible + + + + FirstTimeWindowDisplayed + + Identifier + windowTool.run + IsVertical + + Layout + + + Dock + + + ContentConfiguration + + LauncherConfigVersion + 3 + PBXProjectModuleGUID + 1CD0528B0623707200166675 + PBXProjectModuleLabel + Run + Runner + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {493, 167}} + {{0, 176}, {493, 267}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {405, 443}} + {{414, 0}, {514, 443}} + + + + + GeometryConfiguration + + Frame + {{0, 0}, {966, 265}} + RubberWindowFrame + 133 636 966 306 0 0 1680 1028 + + Module + PBXRunSessionModule + Proportion + 265pt + + + Proportion + 265pt + + + Name + Run Log + ServiceClasses + + PBXRunSessionModule + + StatusbarIsVisible + + TableOfContents + + 1C0AD2B3069F1EA900FABCE6 + 2C6FEC9A0CC8021800D0C913 + 1CD0528B0623707200166675 + 2C6FEC9B0CC8021800D0C913 + + ToolbarConfiguration + xcode.toolbar.config.run + WindowString + 133 636 966 306 0 0 1680 1028 + WindowToolGUID + 1C0AD2B3069F1EA900FABCE6 + WindowToolIsVisible + + + + FirstTimeWindowDisplayed + + Identifier + windowTool.scm + IsVertical + + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAB2065D492600B07095 + PBXProjectModuleLabel + + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {452, 0}} + RubberWindowFrame + 194 589 452 308 0 0 1680 1028 + + Module + PBXNavigatorGroup + Proportion + 0pt + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CD052920623707200166675 + PBXProjectModuleLabel + SCM Results + + GeometryConfiguration + + Frame + {{0, 5}, {452, 262}} + RubberWindowFrame + 194 589 452 308 0 0 1680 1028 + + Module + PBXCVSModule + Proportion + 262pt + + + Proportion + 267pt + + + Name + SCM + ServiceClasses + + PBXCVSModule + + StatusbarIsVisible + + TableOfContents + + 2CBF1CB30CC566690030C462 + 2CBF1CB40CC566690030C462 + 1C78EAB2065D492600B07095 + 1CD052920623707200166675 + + ToolbarConfiguration + xcode.toolbar.config.scm + WindowString + 194 589 452 308 0 0 1680 1028 + WindowToolGUID + 2CBF1CB30CC566690030C462 + WindowToolIsVisible + + + + Identifier + windowTool.breakpoints + IsVertical + 0 + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C77FABC04509CD000000102 + + PBXProjectModuleGUID + 1CE0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + no + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 168 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 1C77FABC04509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {168, 350}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + 0 + + GeometryConfiguration + + Frame + {{0, 0}, {185, 368}} + GroupTreeTableConfiguration + + MainColumn + 168 + + RubberWindowFrame + 315 424 744 409 0 0 1440 878 + + Module + PBXSmartGroupTreeModule + Proportion + 185pt + + + ContentConfiguration + + PBXProjectModuleGUID + 1CA1AED706398EBD00589147 + PBXProjectModuleLabel + Detail + + GeometryConfiguration + + Frame + {{190, 0}, {554, 368}} + RubberWindowFrame + 315 424 744 409 0 0 1440 878 + + Module + XCDetailModule + Proportion + 554pt + + + Proportion + 368pt + + + MajorVersion + 2 + MinorVersion + 0 + Name + Breakpoints + ServiceClasses + + PBXSmartGroupTreeModule + XCDetailModule + + StatusbarIsVisible + 1 + TableOfContents + + 1CDDB66807F98D9800BB5817 + 1CDDB66907F98D9800BB5817 + 1CE0B1FE06471DED0097A5F4 + 1CA1AED706398EBD00589147 + + ToolbarConfiguration + xcode.toolbar.config.breakpoints + WindowString + 315 424 744 409 0 0 1440 878 + WindowToolGUID + 1CDDB66807F98D9800BB5817 + WindowToolIsVisible + 1 + + + Identifier + windowTool.debugAnimator + Layout + + + Dock + + + Module + PBXNavigatorGroup + Proportion + 100% + + + Proportion + 100% + + + Name + Debug Visualizer + ServiceClasses + + PBXNavigatorGroup + + StatusbarIsVisible + 1 + ToolbarConfiguration + xcode.toolbar.config.debugAnimator + WindowString + 100 100 700 500 0 0 1280 1002 + + + Identifier + windowTool.bookmarks + Layout + + + Dock + + + Module + PBXBookmarksModule + Proportion + 100% + + + Proportion + 100% + + + Name + Bookmarks + ServiceClasses + + PBXBookmarksModule + + StatusbarIsVisible + 0 + WindowString + 538 42 401 187 0 0 1280 1002 + + + Identifier + windowTool.classBrowser + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + OptionsSetName + Hierarchy, all classes + PBXProjectModuleGUID + 1CA6456E063B45B4001379D8 + PBXProjectModuleLabel + Class Browser - NSObject + + GeometryConfiguration + + ClassesFrame + {{0, 0}, {374, 96}} + ClassesTreeTableConfiguration + + PBXClassNameColumnIdentifier + 208 + PBXClassBookColumnIdentifier + 22 + + Frame + {{0, 0}, {630, 331}} + MembersFrame + {{0, 105}, {374, 395}} + MembersTreeTableConfiguration + + PBXMemberTypeIconColumnIdentifier + 22 + PBXMemberNameColumnIdentifier + 216 + PBXMemberTypeColumnIdentifier + 97 + PBXMemberBookColumnIdentifier + 22 + + PBXModuleWindowStatusBarHidden2 + 1 + RubberWindowFrame + 385 179 630 352 0 0 1440 878 + + Module + PBXClassBrowserModule + Proportion + 332pt + + + Proportion + 332pt + + + Name + Class Browser + ServiceClasses + + PBXClassBrowserModule + + StatusbarIsVisible + 0 + TableOfContents + + 1C0AD2AF069F1E9B00FABCE6 + 1C0AD2B0069F1E9B00FABCE6 + 1CA6456E063B45B4001379D8 + + ToolbarConfiguration + xcode.toolbar.config.classbrowser + WindowString + 385 179 630 352 0 0 1440 878 + WindowToolGUID + 1C0AD2AF069F1E9B00FABCE6 + WindowToolIsVisible + 0 + + + + diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser new file mode 100644 index 00000000..e00a7dff --- /dev/null +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser @@ -0,0 +1,456 @@ +// !$*UTF8*$! +{ + 2C0B7D280CD6808A0062A7C8 /* PBXBookmark */ = { + isa = PBXBookmark; + fRef = 2C4D9C620CC9EC8C0031092D /* TextGL.pas */; + }; + 2C0B7D320CD683C80062A7C8 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C620CC9EC8C0031092D /* TextGL.pas */; + name = "TextGL.pas: 11"; + rLen = 0; + rLoc = 92; + rType = 0; + vrLen = 1401; + vrLoc = 0; + }; + 2C4D9C620CC9EC8C0031092D /* TextGL.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {680, 7770}}"; + sepNavSelRange = "{92, 0}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavWindowFrame = "{{38, 261}, {616, 741}}"; + }; + }; + 2C4D9C670CC9EC8C0031092D /* UCommon.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1277, 3990}}"; + sepNavSelRange = "{38, 0}"; + sepNavVisRect = "{{0, 0}, {1277, 312}}"; + sepNavWindowFrame = "{{38, 261}, {616, 741}}"; + }; + }; + 2C4D9C690CC9EC8C0031092D /* UCoreModule.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {577, 1568}}"; + sepNavSelRange = "{278, 0}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavWindowFrame = "{{38, 261}, {616, 741}}"; + }; + }; + 2C4D9C6D0CC9EC8C0031092D /* UDraw.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1046, 18578}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavWindowFrame = "{{61, 240}, {616, 741}}"; + }; + }; + 2C4D9C6E0CC9EC8C0031092D /* UFiles.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1562, 10710}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavWindowFrame = "{{84, 219}, {616, 741}}"; + }; + }; + 2C4D9C760CC9EC8C0031092D /* ULCD.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {577, 4256}}"; + sepNavSelRange = "{320, 0}"; + sepNavVisRect = "{{0, 3483}, {577, 612}}"; + sepNavWindowFrame = "{{176, 135}, {616, 741}}"; + }; + }; + 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1277, 11312}}"; + sepNavSelRange = "{64, 18}"; + sepNavVisRect = "{{0, 0}, {1277, 312}}"; + sepNavWindowFrame = "{{222, 93}, {616, 741}}"; + }; + }; + 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1730, 16016}}"; + sepNavSelRange = "{2035, 0}"; + sepNavVisRect = "{{0, 3332}, {577, 612}}"; + sepNavWindowFrame = "{{15, 282}, {616, 741}}"; + }; + }; + 2C4D9D900CC9ED4F0031092D /* FreeBitmap.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {974, 24374}}"; + sepNavSelRange = "{1396, 0}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavWindowFrame = "{{245, 72}, {616, 741}}"; + }; + }; + 2C4D9D910CC9ED4F0031092D /* FreeImage.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1718, 10472}}"; + sepNavSelRange = "{1135, 0}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavWindowFrame = "{{15, 282}, {616, 741}}"; + }; + }; + 2C4D9DCF0CC9EE6F0031092D /* UMenuButton.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {680, 8022}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavWindowFrame = "{{153, 156}, {616, 741}}"; + }; + }; + 2C4D9DD20CC9EE6F0031092D /* UMenuSelect.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {577, 2786}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavWindowFrame = "{{130, 177}, {616, 741}}"; + }; + }; + 2C4D9DD40CC9EE6F0031092D /* UMenuStatic.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {577, 1162}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavWindowFrame = "{{107, 198}, {616, 741}}"; + }; + }; + 2C4D9DFF0CC9EF840031092D /* MacClasses.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {578, 812}}"; + sepNavSelRange = "{8, 0}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavWindowFrame = "{{15, 282}, {616, 741}}"; + }; + }; + 2C4D9E000CC9EF840031092D /* Graphics.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {620, 2674}}"; + sepNavSelRange = "{90, 0}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavWindowFrame = "{{38, 261}, {616, 741}}"; + }; + }; + 2C4D9E010CC9EF840031092D /* JPEG.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {602, 612}}"; + sepNavSelRange = "{5, 0}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavWindowFrame = "{{61, 240}, {616, 741}}"; + }; + }; + 2C4D9E020CC9EF840031092D /* MidiFile.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {577, 1442}}"; + sepNavSelRange = "{5, 0}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavWindowFrame = "{{84, 219}, {616, 741}}"; + }; + }; + 2C4D9E030CC9EF840031092D /* MidiOut.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {577, 882}}"; + sepNavSelRange = "{5, 0}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavWindowFrame = "{{107, 198}, {616, 741}}"; + }; + }; + 2C4D9E040CC9EF840031092D /* OpenGL12.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1616, 65758}}"; + sepNavSelRange = "{66, 0}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavWindowFrame = "{{130, 177}, {616, 741}}"; + }; + }; + 2C4D9E070CC9EF840031092D /* PNGImage.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {577, 612}}"; + sepNavSelRange = "{5, 0}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavWindowFrame = "{{153, 156}, {616, 741}}"; + }; + }; + 2C4D9E090CC9EF840031092D /* Windows.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {577, 1960}}"; + sepNavSelRange = "{5, 0}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavWindowFrame = "{{176, 135}, {616, 741}}"; + }; + }; + 2C4D9E0A0CC9EF840031092D /* zlportio.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {577, 612}}"; + sepNavSelRange = "{5, 0}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavWindowFrame = "{{199, 114}, {616, 741}}"; + }; + }; + 2C4D9E440CC9F0ED0031092D /* switches.inc */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {577, 612}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavWindowFrame = "{{15, 282}, {616, 741}}"; + }; + }; + 2CDD439C0CBBE92D00F364DE /* UMain.pas */ = { + isa = PBXFileReference; + fileEncoding = 30; + lastKnownFileType = sourcecode.pascal; + name = UMain.pas; + path = /Users/eddie/Projekte/UltraStar/UltraStarSource/Main/UMain.pas; + sourceTree = ""; + }; + 2CDD4B5D0CB9354800549FAC /* UltraStarDX */ = { + isa = PBXExecutable; + activeArgIndex = 2147483647; + activeArgIndices = ( + ); + argumentStrings = ( + ); + autoAttachOnCrash = 1; + configStateDict = { + }; + customDataFormattersEnabled = 1; + debuggerPlugin = GDBDebugging; + disassemblyDisplayState = 0; + dylibVariantSuffix = ""; + enableDebugStr = 1; + environmentEntries = ( + ); + executableSystemSymbolLevel = 0; + executableUserSymbolLevel = 0; + libgmallocEnabled = 0; + name = UltraStarDX; + savedGlobals = { + }; + sourceDirectories = ( + ); + variableFormatDictionary = { + }; + }; + 2CDD4B690CB9357000549FAC /* Source Control */ = { + isa = PBXSourceControlManager; + fallbackIsa = XCSourceControlManager; + isSCMEnabled = 0; + scmConfiguration = { + }; + scmType = ""; + }; + 2CDD4B6A0CB9357000549FAC /* Code sense */ = { + isa = PBXCodeSenseManager; + indexTemplatePath = ""; + }; + 2CDD4B7F0CB9394600549FAC /* XCBreakpointsBucket */ = { + isa = XCBreakpointsBucket; + name = "Project Breakpoints"; + objects = ( + 2CDEA8080CBD7D920096994C /* UMain.pas:293 */, + ); + }; + 2CDEA8080CBD7D920096994C /* UMain.pas:293 */ = { + isa = PBXFileBreakpoint; + actions = ( + ); + breakpointStyle = 0; + continueAfterActions = 0; + delayBeforeContinue = 0; + fileReference = 2CDD439C0CBBE92D00F364DE /* UMain.pas */; + hitCount = 1; + lineNumber = 293; + location = UltraStar; + modificationTime = 214261345.065247; + state = 1; + }; + 9845B6590B1F9B9E0084DD62 /* SDL.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {948, 1330}}"; + sepNavSelRange = "{345, 0}"; + sepNavVisRect = "{{0, 0}, {948, 730}}"; + sepNavWindowFrame = "{{61, 122}, {987, 859}}"; + }; + }; + 98B8BE5C0B1F974F00162019 /* sdl.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1268, 58492}}"; + sepNavSelRange = "{17272, 0}"; + sepNavVisRect = "{{0, 3394}, {948, 730}}"; + sepNavWindowFrame = "{{211, 143}, {987, 859}}"; + }; + }; + 98B8BE750B1F97F800162019 /* SDLMain.m */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {948, 5390}}"; + sepNavSelRange = "{558, 0}"; + sepNavVisRect = "{{0, 0}, {948, 730}}"; + sepNavWindowFrame = "{{15, 164}, {987, 859}}"; + }; + }; + DD37F2420A60255800975B2D /* fpcrtl */ = { + activeExec = 0; + }; + DDC6850F09F5717A004E4BFF /* Project object */ = { + activeBuildConfigurationName = Release; + activeExecutable = 2CDD4B5D0CB9354800549FAC /* UltraStarDX */; + activeTarget = DDC688C709F574E9004E4BFF /* UltraStarDX */; + addToTargets = ( + DDC688C709F574E9004E4BFF /* UltraStarDX */, + DDC688D409F57523004E4BFF /* Put all program sources also in this target */, + ); + breakpoints = ( + 2CDEA8080CBD7D920096994C /* UMain.pas:293 */, + ); + breakpointsGroup = 2CDD4B7F0CB9394600549FAC /* XCBreakpointsBucket */; + codeSenseManager = 2CDD4B6A0CB9357000549FAC /* Code sense */; + executables = ( + 2CDD4B5D0CB9354800549FAC /* UltraStarDX */, + ); + perUserDictionary = { + PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID; + PBXFileTableDataSourceColumnWidthsKey = ( + 22, + 300, + 67, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXExecutablesDataSource_ActiveFlagID, + PBXExecutablesDataSource_NameID, + PBXExecutablesDataSource_CommentsID, + ); + }; + PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 290, + 20, + 48, + 43, + 43, + 20, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + PBXFileDataSource_Target_ColumnID, + ); + }; + PBXConfiguration.PBXFileTableDataSource3.PBXSymbolsDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXSymbolsDataSource_SymbolNameID; + PBXFileTableDataSourceColumnWidthsKey = ( + 16, + 200, + 50, + 119, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXSymbolsDataSource_SymbolTypeIconID, + PBXSymbolsDataSource_SymbolNameID, + PBXSymbolsDataSource_SymbolTypeID, + PBXSymbolsDataSource_ReferenceNameID, + ); + }; + PBXConfiguration.PBXFileTableDataSource3.XCSCMDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 20, + 266, + 20, + 48, + 43, + 43, + 20, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_SCM_ColumnID, + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + PBXFileDataSource_Target_ColumnID, + ); + }; + PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 200, + 110, + 20, + 48, + 43, + 43, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXTargetDataSource_PrimaryAttribute, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + ); + }; + PBXPerProjectTemplateStateSaveDate = 215383733; + PBXWorkspaceStateSaveDate = 215383733; + }; + perUserProjectItems = { + 2C0B7D280CD6808A0062A7C8 /* PBXBookmark */ = 2C0B7D280CD6808A0062A7C8 /* PBXBookmark */; + 2C0B7D320CD683C80062A7C8 /* PBXTextBookmark */ = 2C0B7D320CD683C80062A7C8 /* PBXTextBookmark */; + }; + sourceControlManager = 2CDD4B690CB9357000549FAC /* Source Control */; + userBuildSettings = { + }; + }; + DDC6851B09F57195004E4BFF /* UltraStarDX.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {948, 730}}"; + sepNavSelRange = "{17, 0}"; + sepNavVisRect = "{{0, 0}, {948, 730}}"; + sepNavWindowFrame = "{{189, 86}, {987, 859}}"; + }; + }; + DDC6868B09F571C2004E4BFF /* Info.plist */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {686, 612}}"; + sepNavSelRange = "{337, 0}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavWindowFrame = "{{15, 282}, {616, 741}}"; + }; + }; + DDC688C709F574E9004E4BFF /* UltraStarDX */ = { + activeExec = 0; + executables = ( + 2CDD4B5D0CB9354800549FAC /* UltraStarDX */, + ); + }; + DDC688D409F57523004E4BFF /* Put all program sources also in this target */ = { + activeExec = 0; + }; + DDC689B309F57C69004E4BFF /* InfoPlist.strings */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1385, 731}}"; + sepNavSelRange = "{256, 0}"; + sepNavVisRect = "{{0, 0}, {1385, 731}}"; + sepNavWindowFrame = "{{38, 142}, {1424, 860}}"; + }; + }; +} diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj new file mode 100644 index 00000000..958c7a8a --- /dev/null +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj @@ -0,0 +1,1119 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXBuildFile section */ + 2C4D9C8F0CC9EC8C0031092D /* TextGL.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C620CC9EC8C0031092D /* TextGL.pas */; }; + 2C4D9C900CC9EC8C0031092D /* UAudio_bass.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; }; + 2C4D9C910CC9EC8C0031092D /* UAudio_FFMpeg.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; }; + 2C4D9C920CC9EC8C0031092D /* UCatCovers.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C650CC9EC8C0031092D /* UCatCovers.pas */; }; + 2C4D9C930CC9EC8C0031092D /* UCommandLine.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C660CC9EC8C0031092D /* UCommandLine.pas */; }; + 2C4D9C940CC9EC8C0031092D /* UCommon.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C670CC9EC8C0031092D /* UCommon.pas */; }; + 2C4D9C950CC9EC8C0031092D /* UCore.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C680CC9EC8C0031092D /* UCore.pas */; }; + 2C4D9C960CC9EC8C0031092D /* UCoreModule.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C690CC9EC8C0031092D /* UCoreModule.pas */; }; + 2C4D9C970CC9EC8C0031092D /* UCovers.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C6A0CC9EC8C0031092D /* UCovers.pas */; }; + 2C4D9C980CC9EC8C0031092D /* UDataBase.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C6B0CC9EC8C0031092D /* UDataBase.pas */; }; + 2C4D9C990CC9EC8C0031092D /* UDLLManager.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C6C0CC9EC8C0031092D /* UDLLManager.pas */; }; + 2C4D9C9A0CC9EC8C0031092D /* UDraw.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C6D0CC9EC8C0031092D /* UDraw.pas */; }; + 2C4D9C9B0CC9EC8C0031092D /* UFiles.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C6E0CC9EC8C0031092D /* UFiles.pas */; }; + 2C4D9C9C0CC9EC8C0031092D /* UGraphic.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C6F0CC9EC8C0031092D /* UGraphic.pas */; }; + 2C4D9C9D0CC9EC8C0031092D /* UGraphicClasses.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C700CC9EC8C0031092D /* UGraphicClasses.pas */; }; + 2C4D9C9E0CC9EC8C0031092D /* UHooks.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C710CC9EC8C0031092D /* UHooks.pas */; }; + 2C4D9C9F0CC9EC8C0031092D /* UIni.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C720CC9EC8C0031092D /* UIni.pas */; }; + 2C4D9CA00CC9EC8C0031092D /* UJoystick.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C730CC9EC8C0031092D /* UJoystick.pas */; }; + 2C4D9CA10CC9EC8C0031092D /* ULanguage.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C740CC9EC8C0031092D /* ULanguage.pas */; }; + 2C4D9CA20CC9EC8C0031092D /* Ulazjpeg.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C750CC9EC8C0031092D /* Ulazjpeg.pas */; }; + 2C4D9CA30CC9EC8C0031092D /* ULCD.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C760CC9EC8C0031092D /* ULCD.pas */; }; + 2C4D9CA40CC9EC8C0031092D /* ULight.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C770CC9EC8C0031092D /* ULight.pas */; }; + 2C4D9CA50CC9EC8C0031092D /* ULog.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C780CC9EC8C0031092D /* ULog.pas */; }; + 2C4D9CA60CC9EC8C0031092D /* ULyrics_bak.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C790CC9EC8C0031092D /* ULyrics_bak.pas */; }; + 2C4D9CA70CC9EC8C0031092D /* ULyrics.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C7A0CC9EC8C0031092D /* ULyrics.pas */; }; + 2C4D9CA80CC9EC8C0031092D /* UMain.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; }; + 2C4D9CA90CC9EC8C0031092D /* UMedia_dummy.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C7C0CC9EC8C0031092D /* UMedia_dummy.pas */; }; + 2C4D9CAA0CC9EC8C0031092D /* UModules.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C7D0CC9EC8C0031092D /* UModules.pas */; }; + 2C4D9CAB0CC9EC8C0031092D /* UMusic.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C7E0CC9EC8C0031092D /* UMusic.pas */; }; + 2C4D9CAC0CC9EC8C0031092D /* UParty.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C7F0CC9EC8C0031092D /* UParty.pas */; }; + 2C4D9CAD0CC9EC8C0031092D /* UPlaylist.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C800CC9EC8C0031092D /* UPlaylist.pas */; }; + 2C4D9CAE0CC9EC8C0031092D /* UPliki.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C810CC9EC8C0031092D /* UPliki.pas */; }; + 2C4D9CAF0CC9EC8C0031092D /* UPluginInterface.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C820CC9EC8C0031092D /* UPluginInterface.pas */; }; + 2C4D9CB00CC9EC8C0031092D /* uPluginLoader.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C830CC9EC8C0031092D /* uPluginLoader.pas */; }; + 2C4D9CB10CC9EC8C0031092D /* URecord.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C840CC9EC8C0031092D /* URecord.pas */; }; + 2C4D9CB20CC9EC8C0031092D /* UServices.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C850CC9EC8C0031092D /* UServices.pas */; }; + 2C4D9CB30CC9EC8C0031092D /* USingNotes.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C860CC9EC8C0031092D /* USingNotes.pas */; }; + 2C4D9CB40CC9EC8C0031092D /* USingScores.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C870CC9EC8C0031092D /* USingScores.pas */; }; + 2C4D9CB50CC9EC8C0031092D /* USkins.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C880CC9EC8C0031092D /* USkins.pas */; }; + 2C4D9CB60CC9EC8C0031092D /* USongs.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; }; + 2C4D9CB70CC9EC8C0031092D /* UTextClasses.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C8A0CC9EC8C0031092D /* UTextClasses.pas */; }; + 2C4D9CB80CC9EC8C0031092D /* UTexture.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; }; + 2C4D9CB90CC9EC8C0031092D /* UThemes.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C8C0CC9EC8C0031092D /* UThemes.pas */; }; + 2C4D9CBA0CC9EC8C0031092D /* UTime.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C8D0CC9EC8C0031092D /* UTime.pas */; }; + 2C4D9CBB0CC9EC8C0031092D /* UVideo.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C8E0CC9EC8C0031092D /* UVideo.pas */; }; + 2C4D9CBC0CC9EC8C0031092D /* TextGL.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C620CC9EC8C0031092D /* TextGL.pas */; }; + 2C4D9CBD0CC9EC8C0031092D /* UAudio_bass.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; }; + 2C4D9CBE0CC9EC8C0031092D /* UAudio_FFMpeg.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; }; + 2C4D9CBF0CC9EC8C0031092D /* UCatCovers.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C650CC9EC8C0031092D /* UCatCovers.pas */; }; + 2C4D9CC00CC9EC8C0031092D /* UCommandLine.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C660CC9EC8C0031092D /* UCommandLine.pas */; }; + 2C4D9CC10CC9EC8C0031092D /* UCommon.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C670CC9EC8C0031092D /* UCommon.pas */; }; + 2C4D9CC20CC9EC8C0031092D /* UCore.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C680CC9EC8C0031092D /* UCore.pas */; }; + 2C4D9CC30CC9EC8C0031092D /* UCoreModule.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C690CC9EC8C0031092D /* UCoreModule.pas */; }; + 2C4D9CC40CC9EC8C0031092D /* UCovers.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C6A0CC9EC8C0031092D /* UCovers.pas */; }; + 2C4D9CC50CC9EC8C0031092D /* UDataBase.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C6B0CC9EC8C0031092D /* UDataBase.pas */; }; + 2C4D9CC60CC9EC8C0031092D /* UDLLManager.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C6C0CC9EC8C0031092D /* UDLLManager.pas */; }; + 2C4D9CC70CC9EC8C0031092D /* UDraw.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C6D0CC9EC8C0031092D /* UDraw.pas */; }; + 2C4D9CC80CC9EC8C0031092D /* UFiles.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C6E0CC9EC8C0031092D /* UFiles.pas */; }; + 2C4D9CC90CC9EC8C0031092D /* UGraphic.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C6F0CC9EC8C0031092D /* UGraphic.pas */; }; + 2C4D9CCA0CC9EC8C0031092D /* UGraphicClasses.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C700CC9EC8C0031092D /* UGraphicClasses.pas */; }; + 2C4D9CCB0CC9EC8C0031092D /* UHooks.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C710CC9EC8C0031092D /* UHooks.pas */; }; + 2C4D9CCC0CC9EC8C0031092D /* UIni.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C720CC9EC8C0031092D /* UIni.pas */; }; + 2C4D9CCD0CC9EC8C0031092D /* UJoystick.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C730CC9EC8C0031092D /* UJoystick.pas */; }; + 2C4D9CCE0CC9EC8C0031092D /* ULanguage.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C740CC9EC8C0031092D /* ULanguage.pas */; }; + 2C4D9CCF0CC9EC8C0031092D /* Ulazjpeg.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C750CC9EC8C0031092D /* Ulazjpeg.pas */; }; + 2C4D9CD00CC9EC8C0031092D /* ULCD.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C760CC9EC8C0031092D /* ULCD.pas */; }; + 2C4D9CD10CC9EC8C0031092D /* ULight.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C770CC9EC8C0031092D /* ULight.pas */; }; + 2C4D9CD20CC9EC8C0031092D /* ULog.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C780CC9EC8C0031092D /* ULog.pas */; }; + 2C4D9CD30CC9EC8C0031092D /* ULyrics_bak.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C790CC9EC8C0031092D /* ULyrics_bak.pas */; }; + 2C4D9CD40CC9EC8C0031092D /* ULyrics.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C7A0CC9EC8C0031092D /* ULyrics.pas */; }; + 2C4D9CD50CC9EC8C0031092D /* UMain.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; }; + 2C4D9CD60CC9EC8C0031092D /* UMedia_dummy.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C7C0CC9EC8C0031092D /* UMedia_dummy.pas */; }; + 2C4D9CD70CC9EC8C0031092D /* UModules.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C7D0CC9EC8C0031092D /* UModules.pas */; }; + 2C4D9CD80CC9EC8C0031092D /* UMusic.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C7E0CC9EC8C0031092D /* UMusic.pas */; }; + 2C4D9CD90CC9EC8C0031092D /* UParty.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C7F0CC9EC8C0031092D /* UParty.pas */; }; + 2C4D9CDA0CC9EC8C0031092D /* UPlaylist.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C800CC9EC8C0031092D /* UPlaylist.pas */; }; + 2C4D9CDB0CC9EC8C0031092D /* UPliki.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C810CC9EC8C0031092D /* UPliki.pas */; }; + 2C4D9CDC0CC9EC8C0031092D /* UPluginInterface.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C820CC9EC8C0031092D /* UPluginInterface.pas */; }; + 2C4D9CDD0CC9EC8C0031092D /* uPluginLoader.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C830CC9EC8C0031092D /* uPluginLoader.pas */; }; + 2C4D9CDE0CC9EC8C0031092D /* URecord.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C840CC9EC8C0031092D /* URecord.pas */; }; + 2C4D9CDF0CC9EC8C0031092D /* UServices.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C850CC9EC8C0031092D /* UServices.pas */; }; + 2C4D9CE00CC9EC8C0031092D /* USingNotes.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C860CC9EC8C0031092D /* USingNotes.pas */; }; + 2C4D9CE10CC9EC8C0031092D /* USingScores.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C870CC9EC8C0031092D /* USingScores.pas */; }; + 2C4D9CE20CC9EC8C0031092D /* USkins.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C880CC9EC8C0031092D /* USkins.pas */; }; + 2C4D9CE30CC9EC8C0031092D /* USongs.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; }; + 2C4D9CE40CC9EC8C0031092D /* UTextClasses.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C8A0CC9EC8C0031092D /* UTextClasses.pas */; }; + 2C4D9CE50CC9EC8C0031092D /* UTexture.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; }; + 2C4D9CE60CC9EC8C0031092D /* UThemes.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C8C0CC9EC8C0031092D /* UThemes.pas */; }; + 2C4D9CE70CC9EC8C0031092D /* UTime.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C8D0CC9EC8C0031092D /* UTime.pas */; }; + 2C4D9CE80CC9EC8C0031092D /* UVideo.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C8E0CC9EC8C0031092D /* UVideo.pas */; }; + 2C4D9CEA0CC9ECB50031092D /* libbass.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2C4D9CE90CC9ECB50031092D /* libbass.dylib */; }; + 2C4D9D8E0CC9ED230031092D /* Bass.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9D8D0CC9ED230031092D /* Bass.pas */; }; + 2C4D9D8F0CC9ED230031092D /* Bass.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9D8D0CC9ED230031092D /* Bass.pas */; }; + 2C4D9D920CC9ED4F0031092D /* FreeBitmap.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9D900CC9ED4F0031092D /* FreeBitmap.pas */; }; + 2C4D9D930CC9ED4F0031092D /* FreeImage.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9D910CC9ED4F0031092D /* FreeImage.pas */; }; + 2C4D9D940CC9ED4F0031092D /* FreeBitmap.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9D900CC9ED4F0031092D /* FreeBitmap.pas */; }; + 2C4D9D950CC9ED4F0031092D /* FreeImage.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9D910CC9ED4F0031092D /* FreeImage.pas */; }; + 2C4D9D970CC9EDEB0031092D /* libfreeimage.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2C4D9D960CC9EDEB0031092D /* libfreeimage.dylib */; }; + 2C4D9D9A0CC9EE0B0031092D /* SDL_image.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2C4D9D980CC9EE0B0031092D /* SDL_image.framework */; }; + 2C4D9D9B0CC9EE0B0031092D /* SDL_ttf.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2C4D9D990CC9EE0B0031092D /* SDL_ttf.framework */; }; + 2C4D9DD60CC9EE6F0031092D /* UDisplay.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DCC0CC9EE6F0031092D /* UDisplay.pas */; }; + 2C4D9DD70CC9EE6F0031092D /* UDrawTexture.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DCD0CC9EE6F0031092D /* UDrawTexture.pas */; }; + 2C4D9DD80CC9EE6F0031092D /* UMenu.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DCE0CC9EE6F0031092D /* UMenu.pas */; }; + 2C4D9DD90CC9EE6F0031092D /* UMenuButton.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DCF0CC9EE6F0031092D /* UMenuButton.pas */; }; + 2C4D9DDA0CC9EE6F0031092D /* UMenuButtonCollection.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DD00CC9EE6F0031092D /* UMenuButtonCollection.pas */; }; + 2C4D9DDB0CC9EE6F0031092D /* UMenuInteract.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DD10CC9EE6F0031092D /* UMenuInteract.pas */; }; + 2C4D9DDC0CC9EE6F0031092D /* UMenuSelect.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DD20CC9EE6F0031092D /* UMenuSelect.pas */; }; + 2C4D9DDD0CC9EE6F0031092D /* UMenuSelectSlide.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DD30CC9EE6F0031092D /* UMenuSelectSlide.pas */; }; + 2C4D9DDE0CC9EE6F0031092D /* UMenuStatic.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DD40CC9EE6F0031092D /* UMenuStatic.pas */; }; + 2C4D9DDF0CC9EE6F0031092D /* UMenuText.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DD50CC9EE6F0031092D /* UMenuText.pas */; }; + 2C4D9DE00CC9EE6F0031092D /* UDisplay.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DCC0CC9EE6F0031092D /* UDisplay.pas */; }; + 2C4D9DE10CC9EE6F0031092D /* UDrawTexture.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DCD0CC9EE6F0031092D /* UDrawTexture.pas */; }; + 2C4D9DE20CC9EE6F0031092D /* UMenu.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DCE0CC9EE6F0031092D /* UMenu.pas */; }; + 2C4D9DE30CC9EE6F0031092D /* UMenuButton.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DCF0CC9EE6F0031092D /* UMenuButton.pas */; }; + 2C4D9DE40CC9EE6F0031092D /* UMenuButtonCollection.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DD00CC9EE6F0031092D /* UMenuButtonCollection.pas */; }; + 2C4D9DE50CC9EE6F0031092D /* UMenuInteract.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DD10CC9EE6F0031092D /* UMenuInteract.pas */; }; + 2C4D9DE60CC9EE6F0031092D /* UMenuSelect.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DD20CC9EE6F0031092D /* UMenuSelect.pas */; }; + 2C4D9DE70CC9EE6F0031092D /* UMenuSelectSlide.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DD30CC9EE6F0031092D /* UMenuSelectSlide.pas */; }; + 2C4D9DE80CC9EE6F0031092D /* UMenuStatic.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DD40CC9EE6F0031092D /* UMenuStatic.pas */; }; + 2C4D9DE90CC9EE6F0031092D /* UMenuText.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DD50CC9EE6F0031092D /* UMenuText.pas */; }; + 2C4D9DED0CC9EF0A0031092D /* sdl_image.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; }; + 2C4D9DEE0CC9EF0A0031092D /* sdl_image.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; }; + 2C4D9DF10CC9EF210031092D /* sdl_ttf.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DEF0CC9EF210031092D /* sdl_ttf.pas */; }; + 2C4D9DF20CC9EF210031092D /* sdltruetypefont.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DF00CC9EF210031092D /* sdltruetypefont.pas */; }; + 2C4D9DF30CC9EF210031092D /* sdl_ttf.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DEF0CC9EF210031092D /* sdl_ttf.pas */; }; + 2C4D9DF40CC9EF210031092D /* sdltruetypefont.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DF00CC9EF210031092D /* sdltruetypefont.pas */; }; + 2C4D9E0B0CC9EF840031092D /* MacClasses.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DFF0CC9EF840031092D /* MacClasses.pas */; }; + 2C4D9E0C0CC9EF840031092D /* Graphics.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E000CC9EF840031092D /* Graphics.pas */; }; + 2C4D9E0D0CC9EF840031092D /* JPEG.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E010CC9EF840031092D /* JPEG.pas */; }; + 2C4D9E0E0CC9EF840031092D /* MidiFile.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E020CC9EF840031092D /* MidiFile.pas */; }; + 2C4D9E0F0CC9EF840031092D /* MidiOut.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E030CC9EF840031092D /* MidiOut.pas */; }; + 2C4D9E100CC9EF840031092D /* OpenGL12.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E040CC9EF840031092D /* OpenGL12.pas */; }; + 2C4D9E130CC9EF840031092D /* PNGImage.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E070CC9EF840031092D /* PNGImage.pas */; }; + 2C4D9E150CC9EF840031092D /* Windows.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; }; + 2C4D9E160CC9EF840031092D /* zlportio.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E0A0CC9EF840031092D /* zlportio.pas */; }; + 2C4D9E170CC9EF840031092D /* MacClasses.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DFF0CC9EF840031092D /* MacClasses.pas */; }; + 2C4D9E180CC9EF840031092D /* Graphics.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E000CC9EF840031092D /* Graphics.pas */; }; + 2C4D9E190CC9EF840031092D /* JPEG.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E010CC9EF840031092D /* JPEG.pas */; }; + 2C4D9E1A0CC9EF840031092D /* MidiFile.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E020CC9EF840031092D /* MidiFile.pas */; }; + 2C4D9E1B0CC9EF840031092D /* MidiOut.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E030CC9EF840031092D /* MidiOut.pas */; }; + 2C4D9E1C0CC9EF840031092D /* OpenGL12.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E040CC9EF840031092D /* OpenGL12.pas */; }; + 2C4D9E1F0CC9EF840031092D /* PNGImage.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E070CC9EF840031092D /* PNGImage.pas */; }; + 2C4D9E210CC9EF840031092D /* Windows.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; }; + 2C4D9E220CC9EF840031092D /* zlportio.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E0A0CC9EF840031092D /* zlportio.pas */; }; + 2C4D9E450CC9F0ED0031092D /* switches.inc in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E440CC9F0ED0031092D /* switches.inc */; }; + 2C4D9E460CC9F0ED0031092D /* switches.inc in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E440CC9F0ED0031092D /* switches.inc */; }; + 2CDD4BDE0CB947A400549FAC /* sdl.pas in Sources */ = {isa = PBXBuildFile; fileRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; }; + 2CDD4BE00CB947B100549FAC /* sdl.pas in Sources */ = {isa = PBXBuildFile; fileRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; }; + 2CDD4BE20CB947BE00549FAC /* UltraStarDX.pas in Sources */ = {isa = PBXBuildFile; fileRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; }; + 2CDEA4F70CBD725B0096994C /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CDEA4F60CBD725B0096994C /* OpenGL.framework */; }; + 2CDEC4960CC5264600FFA244 /* SDL.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 98B8BE570B1F972400162019 /* SDL.framework */; }; + 2CDEC4CD0CC52E7F00FFA244 /* UltraStarDX.icns in Resources */ = {isa = PBXBuildFile; fileRef = 2CDEC4CC0CC52E7F00FFA244 /* UltraStarDX.icns */; }; + 98B8BE340B1F947800162019 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 98B8BE330B1F947800162019 /* AppKit.framework */; }; + 98B8BE390B1F949C00162019 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 98B8BE370B1F949C00162019 /* Cocoa.framework */; }; + 98B8BE3A0B1F949C00162019 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 98B8BE380B1F949C00162019 /* Foundation.framework */; }; + 98B8BE580B1F972400162019 /* SDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 98B8BE570B1F972400162019 /* SDL.framework */; }; + 98B8BE760B1F97F800162019 /* SDLMain.m in Sources */ = {isa = PBXBuildFile; fileRef = 98B8BE750B1F97F800162019 /* SDLMain.m */; }; + DD37F23D0A60252800975B2D /* UltraStarDX.pas in Sources */ = {isa = PBXBuildFile; fileRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; }; + DD37F2C70A6037EA00975B2D /* libfpcrtl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DD37F2430A60255800975B2D /* libfpcrtl.a */; }; + DDC689B509F57C69004E4BFF /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = DDC689B309F57C69004E4BFF /* InfoPlist.strings */; }; + DDC689B609F57C69004E4BFF /* SDLMain.nib in Resources */ = {isa = PBXBuildFile; fileRef = DDC689B409F57C69004E4BFF /* SDLMain.nib */; }; +/* End PBXBuildFile section */ + +/* Begin PBXBuildRule section */ + DD7C44CD0A6E5050003FA52B /* PBXBuildRule */ = { + isa = PBXBuildRule; + compilerSpec = com.apple.compilers.proxy.script; + filePatterns = "*.inc"; + fileType = pattern.proxy; + isEditable = 1; + outputFiles = ( + "$(TARGET_TEMP_DIR)/$(INPUT_FILE_NAME).compiled", + ); + script = "echo \\\"-Fi$INPUT_FILE_DIR\\\" >> \"$PROJECT_TEMP_DIR\"/unitpaths\ntouch \"$TARGET_TEMP_DIR\"/\"$INPUT_FILE_NAME\".compiled\n"; + }; + DD7C45710A6E7E36003FA52B /* PBXBuildRule */ = { + isa = PBXBuildRule; + compilerSpec = com.apple.compilers.proxy.script; + filePatterns = "*.inc"; + fileType = pattern.proxy; + isEditable = 1; + outputFiles = ( + ); + script = ""; + }; + DDC688F309F57599004E4BFF /* PBXBuildRule */ = { + isa = PBXBuildRule; + compilerSpec = com.apple.compilers.proxy.script; + fileType = sourcecode.pascal; + isEditable = 1; + outputFiles = ( + "$(TARGET_TEMP_DIR)/$(INPUT_FILE_NAME).compiled", + ); + script = "# set -vx\n\n# if FPC_MAIN_FILE is specified, only use that one\nif test \"x$FPC_MAIN_FILE\" = x ; then\n echo \"$INPUT_FILE_SUFFIX\" \"$INPUT_FILE_PATH\" >> \"$PROJECT_TEMP_DIR\"/files_to_compile\nelif test \"x$INPUT_FILE_NAME\" = \"x$FPC_MAIN_FILE\" || test \"x$INPUT_FILE_PATH\" = \"x$FPC_MAIN_FILE\" ; then\n echo \"$INPUT_FILE_SUFFIX\" \"$INPUT_FILE_PATH\" > \"$PROJECT_TEMP_DIR\"/files_to_compile\n echo \"$INPUT_FILE_SUFFIX\" \"$INPUT_FILE_PATH\" > \"$PROJECT_TEMP_DIR\"/mainfile\nfi\n\necho \\\"-Fu$INPUT_FILE_DIR\\\" >> \"$PROJECT_TEMP_DIR\"/unitpaths\necho \\\"-Fi$INPUT_FILE_DIR\\\" >> \"$PROJECT_TEMP_DIR\"/unitpaths\n\n# if this file was not yet before compiled, it may be a new file -> delete\n# source cache (there might be a new mainfile now, unless FPC_MAIN_FILE is specified)\nif test ! -f \"$TARGET_TEMP_DIR\"/\"$INPUT_FILE_NAME\".compiled && test \"x$FPC_MAIN_FILE\" = x ; then\n cd \"$PROJECT_TEMP_DIR\"\n rm -f mainfile scriptrun > /dev/null 2>&1\nfi\n\ntouch \"$TARGET_TEMP_DIR\"/\"$INPUT_FILE_NAME\".compiled\n"; + }; + DDC6891509F57648004E4BFF /* PBXBuildRule */ = { + isa = PBXBuildRule; + compilerSpec = com.apple.compilers.proxy.script; + fileType = sourcecode.pascal; + isEditable = 1; + outputFiles = ( + "$(PROJECT_DERIVED_FILE_DIR)/$(INPUT_FILE_BASE).s", + ); + script = ""; + }; +/* End PBXBuildRule section */ + +/* Begin PBXContainerItemProxy section */ + DD37F25D0A60268D00975B2D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = DDC6850F09F5717A004E4BFF /* Project object */; + proxyType = 1; + remoteGlobalIDString = DD37F2420A60255800975B2D; + remoteInfo = fpcrtl; + }; + DDC688ED09F57578004E4BFF /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = DDC6850F09F5717A004E4BFF /* Project object */; + proxyType = 1; + remoteGlobalIDString = DDC688D409F57523004E4BFF; + remoteInfo = "Put unit sources in the 'Compile Sources' phase of this target"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 2CDEC44F0CC5255600FFA244 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 6; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2CDEC4940CC5262700FFA244 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 2CDEC4960CC5264600FFA244 /* SDL.framework in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 2C4D9C620CC9EC8C0031092D /* TextGL.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = TextGL.pas; path = ../Classes/TextGL.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UAudio_bass.pas; path = ../Classes/UAudio_bass.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UAudio_FFMpeg.pas; path = ../Classes/UAudio_FFMpeg.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C650CC9EC8C0031092D /* UCatCovers.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UCatCovers.pas; path = ../Classes/UCatCovers.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C660CC9EC8C0031092D /* UCommandLine.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UCommandLine.pas; path = ../Classes/UCommandLine.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C670CC9EC8C0031092D /* UCommon.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UCommon.pas; path = ../Classes/UCommon.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C680CC9EC8C0031092D /* UCore.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UCore.pas; path = ../Classes/UCore.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C690CC9EC8C0031092D /* UCoreModule.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UCoreModule.pas; path = ../Classes/UCoreModule.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C6A0CC9EC8C0031092D /* UCovers.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UCovers.pas; path = ../Classes/UCovers.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C6B0CC9EC8C0031092D /* UDataBase.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UDataBase.pas; path = ../Classes/UDataBase.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C6C0CC9EC8C0031092D /* UDLLManager.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UDLLManager.pas; path = ../Classes/UDLLManager.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C6D0CC9EC8C0031092D /* UDraw.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UDraw.pas; path = ../Classes/UDraw.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C6E0CC9EC8C0031092D /* UFiles.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UFiles.pas; path = ../Classes/UFiles.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C6F0CC9EC8C0031092D /* UGraphic.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UGraphic.pas; path = ../Classes/UGraphic.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C700CC9EC8C0031092D /* UGraphicClasses.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UGraphicClasses.pas; path = ../Classes/UGraphicClasses.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C710CC9EC8C0031092D /* UHooks.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UHooks.pas; path = ../Classes/UHooks.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C720CC9EC8C0031092D /* UIni.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UIni.pas; path = ../Classes/UIni.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C730CC9EC8C0031092D /* UJoystick.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UJoystick.pas; path = ../Classes/UJoystick.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C740CC9EC8C0031092D /* ULanguage.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = ULanguage.pas; path = ../Classes/ULanguage.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C750CC9EC8C0031092D /* Ulazjpeg.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = Ulazjpeg.pas; path = ../Classes/Ulazjpeg.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C760CC9EC8C0031092D /* ULCD.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = ULCD.pas; path = ../Classes/ULCD.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C770CC9EC8C0031092D /* ULight.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = ULight.pas; path = ../Classes/ULight.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C780CC9EC8C0031092D /* ULog.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = ULog.pas; path = ../Classes/ULog.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C790CC9EC8C0031092D /* ULyrics_bak.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = ULyrics_bak.pas; path = ../Classes/ULyrics_bak.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C7A0CC9EC8C0031092D /* ULyrics.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = ULyrics.pas; path = ../Classes/ULyrics.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMain.pas; path = ../Classes/UMain.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C7C0CC9EC8C0031092D /* UMedia_dummy.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMedia_dummy.pas; path = ../Classes/UMedia_dummy.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C7D0CC9EC8C0031092D /* UModules.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UModules.pas; path = ../Classes/UModules.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C7E0CC9EC8C0031092D /* UMusic.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMusic.pas; path = ../Classes/UMusic.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C7F0CC9EC8C0031092D /* UParty.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UParty.pas; path = ../Classes/UParty.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C800CC9EC8C0031092D /* UPlaylist.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UPlaylist.pas; path = ../Classes/UPlaylist.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C810CC9EC8C0031092D /* UPliki.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UPliki.pas; path = ../Classes/UPliki.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C820CC9EC8C0031092D /* UPluginInterface.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UPluginInterface.pas; path = ../Classes/UPluginInterface.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C830CC9EC8C0031092D /* uPluginLoader.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = uPluginLoader.pas; path = ../Classes/uPluginLoader.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C840CC9EC8C0031092D /* URecord.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = URecord.pas; path = ../Classes/URecord.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C850CC9EC8C0031092D /* UServices.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UServices.pas; path = ../Classes/UServices.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C860CC9EC8C0031092D /* USingNotes.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = USingNotes.pas; path = ../Classes/USingNotes.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C870CC9EC8C0031092D /* USingScores.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = USingScores.pas; path = ../Classes/USingScores.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C880CC9EC8C0031092D /* USkins.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = USkins.pas; path = ../Classes/USkins.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C890CC9EC8C0031092D /* USongs.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = USongs.pas; path = ../Classes/USongs.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C8A0CC9EC8C0031092D /* UTextClasses.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UTextClasses.pas; path = ../Classes/UTextClasses.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UTexture.pas; path = ../Classes/UTexture.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C8C0CC9EC8C0031092D /* UThemes.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UThemes.pas; path = ../Classes/UThemes.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C8D0CC9EC8C0031092D /* UTime.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UTime.pas; path = ../Classes/UTime.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C8E0CC9EC8C0031092D /* UVideo.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UVideo.pas; path = ../Classes/UVideo.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9CE90CC9ECB50031092D /* libbass.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbass.dylib; path = ../lib/bass/libbass.dylib; sourceTree = SOURCE_ROOT; }; + 2C4D9D8D0CC9ED230031092D /* Bass.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = Bass.pas; path = ../lib/bass/MacOSX/Bass.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9D900CC9ED4F0031092D /* FreeBitmap.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = FreeBitmap.pas; path = ../lib/FreeImage/FreeBitmap.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9D910CC9ED4F0031092D /* FreeImage.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = FreeImage.pas; path = ../lib/FreeImage/FreeImage.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9D960CC9EDEB0031092D /* libfreeimage.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libfreeimage.dylib; path = ../lib/FreeImage/libfreeimage.dylib; sourceTree = SOURCE_ROOT; }; + 2C4D9D980CC9EE0B0031092D /* SDL_image.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL_image.framework; path = /Library/Frameworks/SDL_image.framework; sourceTree = ""; }; + 2C4D9D990CC9EE0B0031092D /* SDL_ttf.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL_ttf.framework; path = /Library/Frameworks/SDL_ttf.framework; sourceTree = ""; }; + 2C4D9DCC0CC9EE6F0031092D /* UDisplay.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UDisplay.pas; path = ../Menu/UDisplay.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9DCD0CC9EE6F0031092D /* UDrawTexture.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UDrawTexture.pas; path = ../Menu/UDrawTexture.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9DCE0CC9EE6F0031092D /* UMenu.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMenu.pas; path = ../Menu/UMenu.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9DCF0CC9EE6F0031092D /* UMenuButton.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMenuButton.pas; path = ../Menu/UMenuButton.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9DD00CC9EE6F0031092D /* UMenuButtonCollection.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMenuButtonCollection.pas; path = ../Menu/UMenuButtonCollection.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9DD10CC9EE6F0031092D /* UMenuInteract.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMenuInteract.pas; path = ../Menu/UMenuInteract.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9DD20CC9EE6F0031092D /* UMenuSelect.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMenuSelect.pas; path = ../Menu/UMenuSelect.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9DD30CC9EE6F0031092D /* UMenuSelectSlide.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMenuSelectSlide.pas; path = ../Menu/UMenuSelectSlide.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9DD40CC9EE6F0031092D /* UMenuStatic.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMenuStatic.pas; path = ../Menu/UMenuStatic.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9DD50CC9EE6F0031092D /* UMenuText.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMenuText.pas; path = ../Menu/UMenuText.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = sdl_image.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL_image/sdl_image.pas"; sourceTree = ""; }; + 2C4D9DEF0CC9EF210031092D /* sdl_ttf.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = sdl_ttf.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL_ttf/sdl_ttf.pas"; sourceTree = ""; }; + 2C4D9DF00CC9EF210031092D /* sdltruetypefont.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = sdltruetypefont.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL_ttf/sdltruetypefont.pas"; sourceTree = ""; }; + 2C4D9DFF0CC9EF840031092D /* MacClasses.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = MacClasses.pas; path = Wrapper/MacClasses.pas; sourceTree = ""; }; + 2C4D9E000CC9EF840031092D /* Graphics.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = Graphics.pas; path = Wrapper/Graphics.pas; sourceTree = ""; }; + 2C4D9E010CC9EF840031092D /* JPEG.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = JPEG.pas; path = Wrapper/JPEG.pas; sourceTree = ""; }; + 2C4D9E020CC9EF840031092D /* MidiFile.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = MidiFile.pas; path = Wrapper/MidiFile.pas; sourceTree = ""; }; + 2C4D9E030CC9EF840031092D /* MidiOut.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = MidiOut.pas; path = Wrapper/MidiOut.pas; sourceTree = ""; }; + 2C4D9E040CC9EF840031092D /* OpenGL12.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = OpenGL12.pas; path = Wrapper/OpenGL12.pas; sourceTree = ""; }; + 2C4D9E070CC9EF840031092D /* PNGImage.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = PNGImage.pas; path = Wrapper/PNGImage.pas; sourceTree = ""; }; + 2C4D9E090CC9EF840031092D /* Windows.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = Windows.pas; path = Wrapper/Windows.pas; sourceTree = ""; }; + 2C4D9E0A0CC9EF840031092D /* zlportio.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = zlportio.pas; path = Wrapper/zlportio.pas; sourceTree = ""; }; + 2C4D9E440CC9F0ED0031092D /* switches.inc */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = switches.inc; path = ../switches.inc; sourceTree = SOURCE_ROOT; }; + 2CDEA4F60CBD725B0096994C /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; + 2CDEC4CC0CC52E7F00FFA244 /* UltraStarDX.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = UltraStarDX.icns; sourceTree = ""; }; + 9845B6590B1F9B9E0084DD62 /* SDL.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL.h; path = /Library/Frameworks/SDL.framework/Versions/A/Headers/SDL.h; sourceTree = ""; }; + 98B8BE330B1F947800162019 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 98B8BE370B1F949C00162019 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; + 98B8BE380B1F949C00162019 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 98B8BE570B1F972400162019 /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL.framework; path = /Library/Frameworks/SDL.framework; sourceTree = ""; }; + 98B8BE5C0B1F974F00162019 /* sdl.pas */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.pascal; name = sdl.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL/sdl.pas"; sourceTree = ""; }; + 98B8BE750B1F97F800162019 /* SDLMain.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = SDLMain.m; path = "/Library/Frameworks/JEDI-SDL.framework/SDL/SDLMain.m"; sourceTree = ""; }; + DD37F2430A60255800975B2D /* libfpcrtl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libfpcrtl.a; sourceTree = BUILT_PRODUCTS_DIR; }; + DDC6851B09F57195004E4BFF /* UltraStarDX.pas */ = {isa = PBXFileReference; fileEncoding = 12; lastKnownFileType = sourcecode.pascal; path = UltraStarDX.pas; sourceTree = ""; }; + DDC6868B09F571C2004E4BFF /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 12; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; + DDC688C809F574E9004E4BFF /* UltraStar Deluxe.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "UltraStar Deluxe.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + DDC688CA09F574E9004E4BFF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; + DDC689B309F57C69004E4BFF /* InfoPlist.strings */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = InfoPlist.strings; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + DDC689B409F57C69004E4BFF /* SDLMain.nib */ = {isa = PBXFileReference; explicitFileType = wrapper.nib; name = SDLMain.nib; path = English.lproj/SDLMain.nib; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + DDC688C609F574E9004E4BFF /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + DD37F2C70A6037EA00975B2D /* libfpcrtl.a in Frameworks */, + 98B8BE340B1F947800162019 /* AppKit.framework in Frameworks */, + 98B8BE390B1F949C00162019 /* Cocoa.framework in Frameworks */, + 98B8BE3A0B1F949C00162019 /* Foundation.framework in Frameworks */, + 98B8BE580B1F972400162019 /* SDL.framework in Frameworks */, + 2CDEA4F70CBD725B0096994C /* OpenGL.framework in Frameworks */, + 2C4D9CEA0CC9ECB50031092D /* libbass.dylib in Frameworks */, + 2C4D9D970CC9EDEB0031092D /* libfreeimage.dylib in Frameworks */, + 2C4D9D9A0CC9EE0B0031092D /* SDL_image.framework in Frameworks */, + 2C4D9D9B0CC9EE0B0031092D /* SDL_ttf.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 2C4D9DEB0CC9EECC0031092D /* SDL */ = { + isa = PBXGroup; + children = ( + 2C4D9DEF0CC9EF210031092D /* sdl_ttf.pas */, + 2C4D9DF00CC9EF210031092D /* sdltruetypefont.pas */, + 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */, + 9845B6590B1F9B9E0084DD62 /* SDL.h */, + 98B8BE750B1F97F800162019 /* SDLMain.m */, + 98B8BE5C0B1F974F00162019 /* sdl.pas */, + ); + name = SDL; + sourceTree = ""; + }; + 2C4D9DF50CC9EF3A0031092D /* Wrapper */ = { + isa = PBXGroup; + children = ( + 2C4D9DFF0CC9EF840031092D /* MacClasses.pas */, + 2C4D9E000CC9EF840031092D /* Graphics.pas */, + 2C4D9E010CC9EF840031092D /* JPEG.pas */, + 2C4D9E020CC9EF840031092D /* MidiFile.pas */, + 2C4D9E030CC9EF840031092D /* MidiOut.pas */, + 2C4D9E040CC9EF840031092D /* OpenGL12.pas */, + 2C4D9E070CC9EF840031092D /* PNGImage.pas */, + 2C4D9E090CC9EF840031092D /* Windows.pas */, + 2C4D9E0A0CC9EF840031092D /* zlportio.pas */, + ); + name = Wrapper; + sourceTree = ""; + }; + 2CDD43820CBBE8D400F364DE /* Classes */ = { + isa = PBXGroup; + children = ( + 2C4D9C620CC9EC8C0031092D /* TextGL.pas */, + 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */, + 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */, + 2C4D9C650CC9EC8C0031092D /* UCatCovers.pas */, + 2C4D9C660CC9EC8C0031092D /* UCommandLine.pas */, + 2C4D9C670CC9EC8C0031092D /* UCommon.pas */, + 2C4D9C680CC9EC8C0031092D /* UCore.pas */, + 2C4D9C690CC9EC8C0031092D /* UCoreModule.pas */, + 2C4D9C6A0CC9EC8C0031092D /* UCovers.pas */, + 2C4D9C6B0CC9EC8C0031092D /* UDataBase.pas */, + 2C4D9C6C0CC9EC8C0031092D /* UDLLManager.pas */, + 2C4D9C6D0CC9EC8C0031092D /* UDraw.pas */, + 2C4D9C6E0CC9EC8C0031092D /* UFiles.pas */, + 2C4D9C6F0CC9EC8C0031092D /* UGraphic.pas */, + 2C4D9C700CC9EC8C0031092D /* UGraphicClasses.pas */, + 2C4D9C710CC9EC8C0031092D /* UHooks.pas */, + 2C4D9C720CC9EC8C0031092D /* UIni.pas */, + 2C4D9C730CC9EC8C0031092D /* UJoystick.pas */, + 2C4D9C740CC9EC8C0031092D /* ULanguage.pas */, + 2C4D9C750CC9EC8C0031092D /* Ulazjpeg.pas */, + 2C4D9C760CC9EC8C0031092D /* ULCD.pas */, + 2C4D9C770CC9EC8C0031092D /* ULight.pas */, + 2C4D9C780CC9EC8C0031092D /* ULog.pas */, + 2C4D9C790CC9EC8C0031092D /* ULyrics_bak.pas */, + 2C4D9C7A0CC9EC8C0031092D /* ULyrics.pas */, + 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */, + 2C4D9C7C0CC9EC8C0031092D /* UMedia_dummy.pas */, + 2C4D9C7D0CC9EC8C0031092D /* UModules.pas */, + 2C4D9C7E0CC9EC8C0031092D /* UMusic.pas */, + 2C4D9C7F0CC9EC8C0031092D /* UParty.pas */, + 2C4D9C800CC9EC8C0031092D /* UPlaylist.pas */, + 2C4D9C810CC9EC8C0031092D /* UPliki.pas */, + 2C4D9C820CC9EC8C0031092D /* UPluginInterface.pas */, + 2C4D9C830CC9EC8C0031092D /* uPluginLoader.pas */, + 2C4D9C840CC9EC8C0031092D /* URecord.pas */, + 2C4D9C850CC9EC8C0031092D /* UServices.pas */, + 2C4D9C860CC9EC8C0031092D /* USingNotes.pas */, + 2C4D9C870CC9EC8C0031092D /* USingScores.pas */, + 2C4D9C880CC9EC8C0031092D /* USkins.pas */, + 2C4D9C890CC9EC8C0031092D /* USongs.pas */, + 2C4D9C8A0CC9EC8C0031092D /* UTextClasses.pas */, + 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */, + 2C4D9C8C0CC9EC8C0031092D /* UThemes.pas */, + 2C4D9C8D0CC9EC8C0031092D /* UTime.pas */, + 2C4D9C8E0CC9EC8C0031092D /* UVideo.pas */, + ); + name = Classes; + sourceTree = ""; + }; + 2CDD438D0CBBE8F700F364DE /* Menu */ = { + isa = PBXGroup; + children = ( + 2C4D9DCC0CC9EE6F0031092D /* UDisplay.pas */, + 2C4D9DCD0CC9EE6F0031092D /* UDrawTexture.pas */, + 2C4D9DCE0CC9EE6F0031092D /* UMenu.pas */, + 2C4D9DCF0CC9EE6F0031092D /* UMenuButton.pas */, + 2C4D9DD00CC9EE6F0031092D /* UMenuButtonCollection.pas */, + 2C4D9DD10CC9EE6F0031092D /* UMenuInteract.pas */, + 2C4D9DD20CC9EE6F0031092D /* UMenuSelect.pas */, + 2C4D9DD30CC9EE6F0031092D /* UMenuSelectSlide.pas */, + 2C4D9DD40CC9EE6F0031092D /* UMenuStatic.pas */, + 2C4D9DD50CC9EE6F0031092D /* UMenuText.pas */, + ); + name = Menu; + sourceTree = ""; + }; + 2CDD8D0B0CC5539900E4169D /* UltraStarDX Resources */ = { + isa = PBXGroup; + children = ( + ); + name = "UltraStarDX Resources"; + sourceTree = ""; + }; + 2CE1F4080CC3EEA400CD02E5 /* FreeImage */ = { + isa = PBXGroup; + children = ( + 2C4D9D900CC9ED4F0031092D /* FreeBitmap.pas */, + 2C4D9D910CC9ED4F0031092D /* FreeImage.pas */, + ); + name = FreeImage; + sourceTree = ""; + }; + 2CE8C7CE0CBAA47D00E4D835 /* BASS */ = { + isa = PBXGroup; + children = ( + 2C4D9D8D0CC9ED230031092D /* Bass.pas */, + ); + name = BASS; + sourceTree = ""; + }; + DD7C45450A6E72DE003FA52B /* Source */ = { + isa = PBXGroup; + children = ( + 2CDD43820CBBE8D400F364DE /* Classes */, + 2CDD438D0CBBE8F700F364DE /* Menu */, + 2CE1F4080CC3EEA400CD02E5 /* FreeImage */, + 2CE8C7CE0CBAA47D00E4D835 /* BASS */, + 2C4D9DEB0CC9EECC0031092D /* SDL */, + 2C4D9DF50CC9EF3A0031092D /* Wrapper */, + DDC6851B09F57195004E4BFF /* UltraStarDX.pas */, + 2C4D9E440CC9F0ED0031092D /* switches.inc */, + ); + name = Source; + sourceTree = ""; + }; + DDC6850D09F5717A004E4BFF = { + isa = PBXGroup; + children = ( + 98B8BE570B1F972400162019 /* SDL.framework */, + 2C4D9D980CC9EE0B0031092D /* SDL_image.framework */, + 2C4D9D990CC9EE0B0031092D /* SDL_ttf.framework */, + 2CDEA4F60CBD725B0096994C /* OpenGL.framework */, + 98B8BE370B1F949C00162019 /* Cocoa.framework */, + 98B8BE380B1F949C00162019 /* Foundation.framework */, + 98B8BE330B1F947800162019 /* AppKit.framework */, + 2C4D9CE90CC9ECB50031092D /* libbass.dylib */, + 2C4D9D960CC9EDEB0031092D /* libfreeimage.dylib */, + DD7C45450A6E72DE003FA52B /* Source */, + DDC6868A09F571C2004E4BFF /* Resources */, + 2CDD8D0B0CC5539900E4169D /* UltraStarDX Resources */, + DDC6888C09F57243004E4BFF /* Products */, + DDC688CA09F574E9004E4BFF /* Info.plist */, + ); + comments = "(note: \"Main target\" is used below to indicate the target with the same name as your project)\n\nSee the comments for the \"Main target\" under \"Targets\" for detailed information on how this project operates.\n\nIn short:\n\na) add your sources to the target called 'Put all program sources also in this target'\nb) add your sources *EXCEPT FOR INCLUDE FILES* to the Main Target\nd) add all frameworks, resources, libraries etc to the Main target\n\nIf there are errors, the \"Errors and Warnings\" smart group will probably not work properly (e.g. errors may disappear after you double click on them). To work around this Xcode bug, go to the Build Transcript by double clicking on the icon of the \"Errors and Warnings\" smart group. There you can (double) click on the errors to go to the right position in the right source file.\n\nNote that the assembly view of Xcode does not work before Xcode 2.3. And in Xcode 2.3, you will not be able to step over PowerPC Pascal function calls (this should be fixed in the next Xcode release though)."; + sourceTree = ""; + }; + DDC6868A09F571C2004E4BFF /* Resources */ = { + isa = PBXGroup; + children = ( + 2CDEC4CC0CC52E7F00FFA244 /* UltraStarDX.icns */, + DDC689B309F57C69004E4BFF /* InfoPlist.strings */, + DDC689B409F57C69004E4BFF /* SDLMain.nib */, + DDC6868B09F571C2004E4BFF /* Info.plist */, + ); + name = Resources; + sourceTree = ""; + }; + DDC6888C09F57243004E4BFF /* Products */ = { + isa = PBXGroup; + children = ( + DDC688C809F574E9004E4BFF /* UltraStar Deluxe.app */, + DD37F2430A60255800975B2D /* libfpcrtl.a */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + DD37F2420A60255800975B2D /* fpcrtl */ = { + isa = PBXNativeTarget; + buildConfigurationList = DD37F2560A60258300975B2D /* Build configuration list for PBXNativeTarget "fpcrtl" */; + buildPhases = ( + DD37F2460A60257100975B2D /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = fpcrtl; + productName = fpcrtl; + productReference = DD37F2430A60255800975B2D /* libfpcrtl.a */; + productType = "com.apple.product-type.library.static"; + }; + DDC688C709F574E9004E4BFF /* UltraStarDX */ = { + isa = PBXNativeTarget; + buildConfigurationList = DDC688CB09F574E9004E4BFF /* Build configuration list for PBXNativeTarget "UltraStarDX" */; + buildPhases = ( + DDC688C409F574E9004E4BFF /* Resources */, + 2CDEC44F0CC5255600FFA244 /* CopyFiles */, + 2CDEC4940CC5262700FFA244 /* CopyFiles */, + DDC6891B09F576D9004E4BFF /* ShellScript */, + DDC688C509F574E9004E4BFF /* Sources */, + DDC688C609F574E9004E4BFF /* Frameworks */, + DDC6890909F5761D004E4BFF /* Rez */, + 2CDD8E450CC554A000E4169D /* ShellScript */, + ); + buildRules = ( + DD7C45710A6E7E36003FA52B /* PBXBuildRule */, + DDC6891509F57648004E4BFF /* PBXBuildRule */, + ); + comments = "This is the main target that does the actual compilation work. Because of several Xcode bugs and holes in its support for third party compilers, the structure is quite convoluted. There are three targets, but you only have to care about the first two:\n\na) This target (make sure this target is set as the \"Active Target\"!)\n\nThis target does the assembling and linking. It is dependent on the three other targets, so the scripts for those targets are run first. Next, it runs a script which compiles the main program and units (using the previously gathered information) and generate the assembler code. Then its \"Compile Sources\" phase will assemble the code, because if we directly generate the object files then Xcode will not perform any linking.\n\nb) The target called 'Put all program sources also in this target'\n\nAs the name says, you should add your sources to that target. The \"compilation rule\" for the Pascal files in that target will add those source files to a list of files to be compiled.\n\nc) The target called 'fpcrtl'\n\nThis target creates a static library of the FPC run time library. You should not have to change this target (you cannot add sources to it either)\n\n\nThe standard Xcode process is used to link in any necessary frameworks, libraries and resources. Therefore these frameworks, libraries and resources can be added to the project and this (the main) target like in any other Xcode project.\n"; + dependencies = ( + DDC688EE09F57578004E4BFF /* PBXTargetDependency */, + DD37F25E0A60268D00975B2D /* PBXTargetDependency */, + ); + name = UltraStarDX; + productName = "JEDI-SDLCocoa"; + productReference = DDC688C809F574E9004E4BFF /* UltraStar Deluxe.app */; + productType = "com.apple.product-type.application"; + }; + DDC688D409F57523004E4BFF /* Put all program sources also in this target */ = { + isa = PBXNativeTarget; + buildConfigurationList = DDC688DC09F57542004E4BFF /* Build configuration list for PBXNativeTarget "Put all program sources also in this target" */; + buildPhases = ( + DD37F2350A60250900975B2D /* ShellScript */, + DDC688D209F57523004E4BFF /* Sources */, + ); + buildRules = ( + DD7C44CD0A6E5050003FA52B /* PBXBuildRule */, + DDC688F309F57599004E4BFF /* PBXBuildRule */, + ); + comments = "See the comments for the target called the same as your project for details."; + dependencies = ( + ); + name = "Put all program sources also in this target"; + productName = "Put unit sources in the 'Compile Sources' phase of this target"; + productType = "com.apple.product-type.objfile"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + DDC6850F09F5717A004E4BFF /* Project object */ = { + isa = PBXProject; + buildConfigurationList = DDC6851009F5717A004E4BFF /* Build configuration list for PBXProject "UltraStarDX" */; + hasScannedForEncodings = 0; + mainGroup = DDC6850D09F5717A004E4BFF; + productRefGroup = DDC6888C09F57243004E4BFF /* Products */; + projectDirPath = ""; + targets = ( + DDC688C709F574E9004E4BFF /* UltraStarDX */, + DDC688D409F57523004E4BFF /* Put all program sources also in this target */, + DD37F2420A60255800975B2D /* fpcrtl */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + DDC688C409F574E9004E4BFF /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DDC689B509F57C69004E4BFF /* InfoPlist.strings in Resources */, + DDC689B609F57C69004E4BFF /* SDLMain.nib in Resources */, + 2CDEC4CD0CC52E7F00FFA244 /* UltraStarDX.icns in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXRezBuildPhase section */ + DDC6890909F5761D004E4BFF /* Rez */ = { + isa = PBXRezBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXRezBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 2CDD8E450CC554A000E4169D /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\nUS_RESOURCES_SOURCE_DIR=UltraStarResources\nUS_RESOURCES_DEST_DIR=\"$CONFIGURATION_BUILD_DIR\"/\"$PRODUCT_NAME\".app/Contents\n\ncp -Rf $US_RESOURCES_SOURCE_DIR $US_RESOURCES_DEST_DIR"; + }; + DD37F2350A60250900975B2D /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + "$(PROJECT_TEMP_DIR)/cleanscriptrun", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# hack to workaround Xcode bug that $PROJECT_TEMP_DIR isn't cleaned when you clean,\n# and that scripts aren't run when you clean a project\n\nmkdir -p \"$PROJECT_TEMP_DIR\"\n\n# when the \"scripts not run when cleaning\" bug is fixed, this doesn't have be run\n# when cleaning\n\nif [ x\"$ACTION\" = \"xbuild\" ]; then\n # remove unit path and source file cache\n cd \"$PROJECT_TEMP_DIR\"\n rm -f mainfile scriptrun unitpaths files_to_compile > /dev/null 2>&1\nfi\n\n# simple so that the script isn't run every time you compile\ntouch \"$PROJECT_TEMP_DIR\"/cleanscriptrun"; + }; + DD37F2460A60257100975B2D /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + "$(TARGET_BUILD_DIR)/libfpcrtl.a", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# if you activate this to see what the script does, Xcode will take a *VERY LONG* time to process the output of the \"ar\" command line\n# set -vx\n\n\n# put the entire RTL in one static library so we can link it easily (without automatically linking all object files)\n\nif [ x\"$ACTION\" = \"xbuild\" ]; then\n \n rm -f \"$PROJECT_TEMP_DIR\"/rtllibs\n for arch in $ARCHS\n do\n # get the correct compiler name\n case $arch in\n i386)\n FPC_ARCH=386\n RTL_ARCH=i386\n ;;\n ppc)\n FPC_ARCH=ppc\n RTL_ARCH=powerpc\n ;;\n * )\n echo warning: Unsupported target architecture ${arch}, skipping...\n continue\n ;;\n esac\n\n FPC_VERSION=`/usr/local/bin/ppc${FPC_ARCH} -iV`\n if [ $? != 0 ]; then\n echo \"error: Cannot find the FPC binary for $RTL_ARCH (/usr/local/bin/ppc${FPC_ARCH}). Check if you have installed FPC for this architecture.\"\n exit 1\n fi\n MY_OUTPUT_FILE=\"$PROJECT_TEMP_DIR\"/libfpcrtl-${FPC_ARCH}.a\n ar -ru \"$MY_OUTPUT_FILE\" `ls \"$FPC_RTL_UNITS_BASE\"/\"$FPC_VERSION\"/units/${RTL_ARCH}-darwin/*/*.o | grep -v 'darwin/fv/'`\n if [ $? != 0 ]; then\n echo \"error: Problem creating static library for FPC Run Time Library. Check the FPC_RTL_UNITS_BASE setting in the global project configuration.\"\n exit 1\n fi\n echo -n \" \"\\\"\"$MY_OUTPUT_FILE\"\\\" >> \"$PROJECT_TEMP_DIR\"/rtllibs\n done\n /bin/sh -c \"lipo -create `cat \\\"$PROJECT_TEMP_DIR\\\"/rtllibs` -output \\\"$TARGET_BUILD_DIR\\\"/libfpcrtl.a\"\n ranlib \"$TARGET_BUILD_DIR\"/libfpcrtl.a > /dev/null 2>&1\n # delete working files\n rm -f `cat \"$PROJECT_TEMP_DIR\"/rtllibs`\n rm -f \"$PROJECT_TEMP_DIR\"/rtllibs\nfi\n"; + }; + DDC6891B09F576D9004E4BFF /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(PROJECT_TEMP_DIR)/files_to_compile", + ); + outputPaths = ( + "$(PROJECT_TEMP_DIR)/scriptrun", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# set -vx\n\nif [ x\"$ACTION\" = \"xclean\" ]; then\n exit 0\nfi\n\nfunction make_conditional() {\n for arch in $ARCHS\n do\n for file in \"$PROJECT_DERIVED_FILE_DIR\"/\"$arch\"/*.s\n do\n DEST_FILE=\"$PROJECT_DERIVED_FILE_DIR\"/`basename \"$file\"`\n echo \"#ifdef __${arch}__\" >> /\"$DEST_FILE\"\n cat \"$file\" >> \"$DEST_FILE\"\n echo \"#endif\" >> \"$DEST_FILE\"\n done\n done\n}\n\n\nUNIT_PATHS_FILE=\"$PROJECT_TEMP_DIR\"/unitpaths\n\n# remove duplicate unit search paths\nif test -f \"$UNIT_PATHS_FILE\"; then\n sort -u < \"$UNIT_PATHS_FILE\" > \"$UNIT_PATHS_FILE\".tmp\n mv \"$UNIT_PATHS_FILE\".tmp \"$UNIT_PATHS_FILE\"\nelse\n touch \"$UNIT_PATHS_FILE\"\nfi\n\n# Make sure there are some files to compile\nif test ! -f \"$PROJECT_TEMP_DIR\"/files_to_compile; then\n echo error: Add your main program and its units to the \\\"Put all program sources also in this target\\\" target\n exit 1\nfi\n\n\n# support for previous Xcode naming scheme\nif [ \"$BUILD_STYLE\" = Development ]\nthen\n BUILD_STYLE=Debug\nfi\n\nif [ \"$BUILD_STYLE\" = Deployment ]\nthen\n BUILD_STYLE=Release\nfi\n\n# keep track of whether we compiled the main program so that once we did, we can stop\nMAIN_PROGRAM_COMPILED=0\n\n# don't skip the first file, since it may be the main program.\nFIRST_FILE=1\n\nFILES_TO_SKIP=\n\nrm \"$PROJECT_DERIVED_FILE_DIR\"/*.s >/dev/null 2>&1\n\n\nwhile read INPUT_FILE_SUFFIX INPUT_FILE_PATH\ndo\n # skip include files (crude, may miss some)\n if ! egrep -qi 'end\\.' \"$INPUT_FILE_PATH\" >/dev/null 2>&1; then\n FIRST_FILE=0\n echo warning: Skipping compilation of \\\"$INPUT_FILE_PATH\\\", seems to be an include file or not a Pascal file\n FILES_TO_SKIP=`echo -e \"$INPUT_FILE_PATH\"'\\n'\"$FILES_TO_SKIP\"`\n continue\n fi\n\n for variant in $BUILD_VARIANTS\n do\n for arch in $ARCHS\n do\n # get the name of the objects file dir\n####\n #FULL_OBJECT_FILES_DIR=\"$OBJECT_FILE_DIR\"-\"$variant\"/\"$arch\"\n FULL_OBJECT_FILES_DIR=\"$PROJECT_DERIVED_FILE_DIR\"/\"$arch\"\n####\n\n # create the necessary directories (not done by Xcode because we only specify a fake output file)\n mkdir -p \"$PROJECT_TEMP_DIR\" \"$FULL_OBJECT_FILES_DIR\"\n \n # if the file was already compiled (because an earlier compiled unit depended on it), skip it\n if test \"$FULL_OBJECT_FILES_DIR\"/`basename \"$INPUT_FILE_PATH\" $INPUT_FILE_SUFFIX`.o -nt \"$INPUT_FILE_PATH\" -a $FIRST_FILE -ne 1 ; then\n continue 3\n fi\n \n # get the correct compiler name\n if [ \"$arch\" = \"i386\" ]\n then\n FPCARCH=386\n RTLARCH=i386\n else\n FPCARCH=ppc\n RTLARCH=powerpc\n fi\n\n # check if the compiler exists\n if ! test -f /usr/local/bin/ppc${FPCARCH}\n then\n echo \"error: FPC for $arch is not installed on this machine. You can probably solve this problem by setting the architectures to build for to your native target only and rebuilding.\"\n exit 2\n fi\n \n # go into the object files dir so we can use short paths\n cd \"$FULL_OBJECT_FILES_DIR\"\n \n # actually compile (but do not assemble nor link)\n echo -n /usr/local/bin/ppc${FPCARCH} \\\"$INPUT_FILE_PATH\\\" $FPC_SPECIFIC_OPTIONS $FPC_COMMON_OPTIONS -Tdarwin -a -s -FE. -vbr $FPC_OVERRIDE_OPTIONS > docompile.sh\n\n # add unit paths\n while read unitsearchpath\n do\n echo -n \" \" $unitsearchpath >> docompile.sh\n done < \"$UNIT_PATHS_FILE\"\n \n echo ' > \"$PROJECT_TEMP_DIR\"/compiler_output 2>&1' >> docompile.sh\n echo 'compres=$?' >> docompile.sh\n echo 'sed -e \"s/\\([^:]*\\):\\([^:]*\\):\\([^:]*\\):\\([^:]*\\):\\(.*\\)/\\1:\\2:\\3:column \\4 -\\5/\" < \"$PROJECT_TEMP_DIR\"/compiler_output' >> docompile.sh\n echo 'exit $compres' >> docompile.sh\n /bin/sh ./docompile.sh\n \n # Compilation successful?\n if [ $? == 0 ]; then\n \n # if it was a unit, continue with the next file (no need to compile all its variants and archs, that\n # will be done when compiling the main program)\n if test ! -f ./link.res; then\n continue 3\n fi\n \n echo Main file found!\n\n # this is the main program -> next time only compile this file\n # (if units are modified, they will be added after this file, but that doesn't matter\n echo \"$INPUT_FILE_SUFFIX\" \"$INPUT_FILE_PATH\" > \"$PROJECT_TEMP_DIR\"/files_to_compile\n \n # record that the main program was compiled, so we don't have to compile any more units\n MAIN_PROGRAM_COMPILED=1\n \n # delete leftovers\n rm -f ppas.sh link.res\n \n # log the name of the input file so it can be touched if necessary for recompilation\n echo -n \"$INPUT_FILE_PATH\" > \"$PROJECT_TEMP_DIR\"/mainfile\n \n else\n exit 2\n fi\n done\n done\n\n # if the main program was compiled, we can stop\n if test $MAIN_PROGRAM_COMPILED -ne 0; then\n make_conditional\n touch \"$PROJECT_TEMP_DIR\"/scriptrun\n exit 0\n fi\n FIRST_FILE=0\n\ndone < \"$PROJECT_TEMP_DIR\"/files_to_compile\n\necho \"warning: It seems your project only contains units and no main program\"\ngrep -Fv \"$FILES_TO_SKIP\" < \"$PROJECT_TEMP_DIR\"/files_to_compile > \"$PROJECT_TEMP_DIR\"/files_to_compile.tmp\nsort -u < \"$PROJECT_TEMP_DIR\"/files_to_compile.tmp > \"$PROJECT_TEMP_DIR\"/files_to_compile\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + DDC688C509F574E9004E4BFF /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2CDD4BE20CB947BE00549FAC /* UltraStarDX.pas in Sources */, + 2CDD4BE00CB947B100549FAC /* sdl.pas in Sources */, + 98B8BE760B1F97F800162019 /* SDLMain.m in Sources */, + 2C4D9C8F0CC9EC8C0031092D /* TextGL.pas in Sources */, + 2C4D9C900CC9EC8C0031092D /* UAudio_bass.pas in Sources */, + 2C4D9C910CC9EC8C0031092D /* UAudio_FFMpeg.pas in Sources */, + 2C4D9C920CC9EC8C0031092D /* UCatCovers.pas in Sources */, + 2C4D9C930CC9EC8C0031092D /* UCommandLine.pas in Sources */, + 2C4D9C940CC9EC8C0031092D /* UCommon.pas in Sources */, + 2C4D9C950CC9EC8C0031092D /* UCore.pas in Sources */, + 2C4D9C960CC9EC8C0031092D /* UCoreModule.pas in Sources */, + 2C4D9C970CC9EC8C0031092D /* UCovers.pas in Sources */, + 2C4D9C980CC9EC8C0031092D /* UDataBase.pas in Sources */, + 2C4D9C990CC9EC8C0031092D /* UDLLManager.pas in Sources */, + 2C4D9C9A0CC9EC8C0031092D /* UDraw.pas in Sources */, + 2C4D9C9B0CC9EC8C0031092D /* UFiles.pas in Sources */, + 2C4D9C9C0CC9EC8C0031092D /* UGraphic.pas in Sources */, + 2C4D9C9D0CC9EC8C0031092D /* UGraphicClasses.pas in Sources */, + 2C4D9C9E0CC9EC8C0031092D /* UHooks.pas in Sources */, + 2C4D9C9F0CC9EC8C0031092D /* UIni.pas in Sources */, + 2C4D9CA00CC9EC8C0031092D /* UJoystick.pas in Sources */, + 2C4D9CA10CC9EC8C0031092D /* ULanguage.pas in Sources */, + 2C4D9CA20CC9EC8C0031092D /* Ulazjpeg.pas in Sources */, + 2C4D9CA30CC9EC8C0031092D /* ULCD.pas in Sources */, + 2C4D9CA40CC9EC8C0031092D /* ULight.pas in Sources */, + 2C4D9CA50CC9EC8C0031092D /* ULog.pas in Sources */, + 2C4D9CA60CC9EC8C0031092D /* ULyrics_bak.pas in Sources */, + 2C4D9CA70CC9EC8C0031092D /* ULyrics.pas in Sources */, + 2C4D9CA80CC9EC8C0031092D /* UMain.pas in Sources */, + 2C4D9CA90CC9EC8C0031092D /* UMedia_dummy.pas in Sources */, + 2C4D9CAA0CC9EC8C0031092D /* UModules.pas in Sources */, + 2C4D9CAB0CC9EC8C0031092D /* UMusic.pas in Sources */, + 2C4D9CAC0CC9EC8C0031092D /* UParty.pas in Sources */, + 2C4D9CAD0CC9EC8C0031092D /* UPlaylist.pas in Sources */, + 2C4D9CAE0CC9EC8C0031092D /* UPliki.pas in Sources */, + 2C4D9CAF0CC9EC8C0031092D /* UPluginInterface.pas in Sources */, + 2C4D9CB00CC9EC8C0031092D /* uPluginLoader.pas in Sources */, + 2C4D9CB10CC9EC8C0031092D /* URecord.pas in Sources */, + 2C4D9CB20CC9EC8C0031092D /* UServices.pas in Sources */, + 2C4D9CB30CC9EC8C0031092D /* USingNotes.pas in Sources */, + 2C4D9CB40CC9EC8C0031092D /* USingScores.pas in Sources */, + 2C4D9CB50CC9EC8C0031092D /* USkins.pas in Sources */, + 2C4D9CB60CC9EC8C0031092D /* USongs.pas in Sources */, + 2C4D9CB70CC9EC8C0031092D /* UTextClasses.pas in Sources */, + 2C4D9CB80CC9EC8C0031092D /* UTexture.pas in Sources */, + 2C4D9CB90CC9EC8C0031092D /* UThemes.pas in Sources */, + 2C4D9CBA0CC9EC8C0031092D /* UTime.pas in Sources */, + 2C4D9CBB0CC9EC8C0031092D /* UVideo.pas in Sources */, + 2C4D9D8E0CC9ED230031092D /* Bass.pas in Sources */, + 2C4D9D920CC9ED4F0031092D /* FreeBitmap.pas in Sources */, + 2C4D9D930CC9ED4F0031092D /* FreeImage.pas in Sources */, + 2C4D9DD60CC9EE6F0031092D /* UDisplay.pas in Sources */, + 2C4D9DD70CC9EE6F0031092D /* UDrawTexture.pas in Sources */, + 2C4D9DD80CC9EE6F0031092D /* UMenu.pas in Sources */, + 2C4D9DD90CC9EE6F0031092D /* UMenuButton.pas in Sources */, + 2C4D9DDA0CC9EE6F0031092D /* UMenuButtonCollection.pas in Sources */, + 2C4D9DDB0CC9EE6F0031092D /* UMenuInteract.pas in Sources */, + 2C4D9DDC0CC9EE6F0031092D /* UMenuSelect.pas in Sources */, + 2C4D9DDD0CC9EE6F0031092D /* UMenuSelectSlide.pas in Sources */, + 2C4D9DDE0CC9EE6F0031092D /* UMenuStatic.pas in Sources */, + 2C4D9DDF0CC9EE6F0031092D /* UMenuText.pas in Sources */, + 2C4D9DED0CC9EF0A0031092D /* sdl_image.pas in Sources */, + 2C4D9DF10CC9EF210031092D /* sdl_ttf.pas in Sources */, + 2C4D9DF20CC9EF210031092D /* sdltruetypefont.pas in Sources */, + 2C4D9E0B0CC9EF840031092D /* MacClasses.pas in Sources */, + 2C4D9E0C0CC9EF840031092D /* Graphics.pas in Sources */, + 2C4D9E0D0CC9EF840031092D /* JPEG.pas in Sources */, + 2C4D9E0E0CC9EF840031092D /* MidiFile.pas in Sources */, + 2C4D9E0F0CC9EF840031092D /* MidiOut.pas in Sources */, + 2C4D9E100CC9EF840031092D /* OpenGL12.pas in Sources */, + 2C4D9E130CC9EF840031092D /* PNGImage.pas in Sources */, + 2C4D9E150CC9EF840031092D /* Windows.pas in Sources */, + 2C4D9E160CC9EF840031092D /* zlportio.pas in Sources */, + 2C4D9E450CC9F0ED0031092D /* switches.inc in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + DDC688D209F57523004E4BFF /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2CDD4BDE0CB947A400549FAC /* sdl.pas in Sources */, + DD37F23D0A60252800975B2D /* UltraStarDX.pas in Sources */, + 2C4D9CBC0CC9EC8C0031092D /* TextGL.pas in Sources */, + 2C4D9CBD0CC9EC8C0031092D /* UAudio_bass.pas in Sources */, + 2C4D9CBE0CC9EC8C0031092D /* UAudio_FFMpeg.pas in Sources */, + 2C4D9CBF0CC9EC8C0031092D /* UCatCovers.pas in Sources */, + 2C4D9CC00CC9EC8C0031092D /* UCommandLine.pas in Sources */, + 2C4D9CC10CC9EC8C0031092D /* UCommon.pas in Sources */, + 2C4D9CC20CC9EC8C0031092D /* UCore.pas in Sources */, + 2C4D9CC30CC9EC8C0031092D /* UCoreModule.pas in Sources */, + 2C4D9CC40CC9EC8C0031092D /* UCovers.pas in Sources */, + 2C4D9CC50CC9EC8C0031092D /* UDataBase.pas in Sources */, + 2C4D9CC60CC9EC8C0031092D /* UDLLManager.pas in Sources */, + 2C4D9CC70CC9EC8C0031092D /* UDraw.pas in Sources */, + 2C4D9CC80CC9EC8C0031092D /* UFiles.pas in Sources */, + 2C4D9CC90CC9EC8C0031092D /* UGraphic.pas in Sources */, + 2C4D9CCA0CC9EC8C0031092D /* UGraphicClasses.pas in Sources */, + 2C4D9CCB0CC9EC8C0031092D /* UHooks.pas in Sources */, + 2C4D9CCC0CC9EC8C0031092D /* UIni.pas in Sources */, + 2C4D9CCD0CC9EC8C0031092D /* UJoystick.pas in Sources */, + 2C4D9CCE0CC9EC8C0031092D /* ULanguage.pas in Sources */, + 2C4D9CCF0CC9EC8C0031092D /* Ulazjpeg.pas in Sources */, + 2C4D9CD00CC9EC8C0031092D /* ULCD.pas in Sources */, + 2C4D9CD10CC9EC8C0031092D /* ULight.pas in Sources */, + 2C4D9CD20CC9EC8C0031092D /* ULog.pas in Sources */, + 2C4D9CD30CC9EC8C0031092D /* ULyrics_bak.pas in Sources */, + 2C4D9CD40CC9EC8C0031092D /* ULyrics.pas in Sources */, + 2C4D9CD50CC9EC8C0031092D /* UMain.pas in Sources */, + 2C4D9CD60CC9EC8C0031092D /* UMedia_dummy.pas in Sources */, + 2C4D9CD70CC9EC8C0031092D /* UModules.pas in Sources */, + 2C4D9CD80CC9EC8C0031092D /* UMusic.pas in Sources */, + 2C4D9CD90CC9EC8C0031092D /* UParty.pas in Sources */, + 2C4D9CDA0CC9EC8C0031092D /* UPlaylist.pas in Sources */, + 2C4D9CDB0CC9EC8C0031092D /* UPliki.pas in Sources */, + 2C4D9CDC0CC9EC8C0031092D /* UPluginInterface.pas in Sources */, + 2C4D9CDD0CC9EC8C0031092D /* uPluginLoader.pas in Sources */, + 2C4D9CDE0CC9EC8C0031092D /* URecord.pas in Sources */, + 2C4D9CDF0CC9EC8C0031092D /* UServices.pas in Sources */, + 2C4D9CE00CC9EC8C0031092D /* USingNotes.pas in Sources */, + 2C4D9CE10CC9EC8C0031092D /* USingScores.pas in Sources */, + 2C4D9CE20CC9EC8C0031092D /* USkins.pas in Sources */, + 2C4D9CE30CC9EC8C0031092D /* USongs.pas in Sources */, + 2C4D9CE40CC9EC8C0031092D /* UTextClasses.pas in Sources */, + 2C4D9CE50CC9EC8C0031092D /* UTexture.pas in Sources */, + 2C4D9CE60CC9EC8C0031092D /* UThemes.pas in Sources */, + 2C4D9CE70CC9EC8C0031092D /* UTime.pas in Sources */, + 2C4D9CE80CC9EC8C0031092D /* UVideo.pas in Sources */, + 2C4D9D8F0CC9ED230031092D /* Bass.pas in Sources */, + 2C4D9D940CC9ED4F0031092D /* FreeBitmap.pas in Sources */, + 2C4D9D950CC9ED4F0031092D /* FreeImage.pas in Sources */, + 2C4D9DE00CC9EE6F0031092D /* UDisplay.pas in Sources */, + 2C4D9DE10CC9EE6F0031092D /* UDrawTexture.pas in Sources */, + 2C4D9DE20CC9EE6F0031092D /* UMenu.pas in Sources */, + 2C4D9DE30CC9EE6F0031092D /* UMenuButton.pas in Sources */, + 2C4D9DE40CC9EE6F0031092D /* UMenuButtonCollection.pas in Sources */, + 2C4D9DE50CC9EE6F0031092D /* UMenuInteract.pas in Sources */, + 2C4D9DE60CC9EE6F0031092D /* UMenuSelect.pas in Sources */, + 2C4D9DE70CC9EE6F0031092D /* UMenuSelectSlide.pas in Sources */, + 2C4D9DE80CC9EE6F0031092D /* UMenuStatic.pas in Sources */, + 2C4D9DE90CC9EE6F0031092D /* UMenuText.pas in Sources */, + 2C4D9DEE0CC9EF0A0031092D /* sdl_image.pas in Sources */, + 2C4D9DF30CC9EF210031092D /* sdl_ttf.pas in Sources */, + 2C4D9DF40CC9EF210031092D /* sdltruetypefont.pas in Sources */, + 2C4D9E170CC9EF840031092D /* MacClasses.pas in Sources */, + 2C4D9E180CC9EF840031092D /* Graphics.pas in Sources */, + 2C4D9E190CC9EF840031092D /* JPEG.pas in Sources */, + 2C4D9E1A0CC9EF840031092D /* MidiFile.pas in Sources */, + 2C4D9E1B0CC9EF840031092D /* MidiOut.pas in Sources */, + 2C4D9E1C0CC9EF840031092D /* OpenGL12.pas in Sources */, + 2C4D9E1F0CC9EF840031092D /* PNGImage.pas in Sources */, + 2C4D9E210CC9EF840031092D /* Windows.pas in Sources */, + 2C4D9E220CC9EF840031092D /* zlportio.pas in Sources */, + 2C4D9E460CC9F0ED0031092D /* switches.inc in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + DD37F25E0A60268D00975B2D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = DD37F2420A60255800975B2D /* fpcrtl */; + targetProxy = DD37F25D0A60268D00975B2D /* PBXContainerItemProxy */; + }; + DDC688EE09F57578004E4BFF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = DDC688D409F57523004E4BFF /* Put all program sources also in this target */; + targetProxy = DDC688ED09F57578004E4BFF /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + DD37F2570A60258300975B2D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + INSTALL_PATH = /usr/local/lib; + PREBINDING = NO; + PRODUCT_NAME = fpcrtl; + ZERO_LINK = YES; + }; + name = Debug; + }; + DD37F2580A60258300975B2D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + INSTALL_PATH = /usr/local/lib; + PREBINDING = NO; + PRODUCT_NAME = fpcrtl; + ZERO_LINK = NO; + }; + name = Release; + }; + DDC6851109F5717A004E4BFF /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + FPC_COMMON_OPTIONS = "-Sd -XMSDL_main"; + FPC_MAIN_FILE = ""; + FPC_OVERRIDE_OPTIONS = ""; + FPC_RTL_UNITS_BASE = /usr/local/lib/fpc/; + FPC_SPECIFIC_OPTIONS = "-Ci -Cr -Co -gl -O-"; + FRAMEWORK_SEARCH_PATHS = ""; + HEADER_SEARCH_PATHS = ""; + LIBRARY_SEARCH_PATHS = ""; + REZ_SEARCH_PATHS = ""; + USER_HEADER_SEARCH_PATHS = ""; + }; + name = Debug; + }; + DDC6851209F5717A004E4BFF /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + FPC_COMMON_OPTIONS = "-Sd -XMSDL_main"; + FPC_MAIN_FILE = ""; + FPC_OVERRIDE_OPTIONS = ""; + FPC_RTL_UNITS_BASE = /usr/local/lib/fpc/; + FPC_SPECIFIC_OPTIONS = "-Ci- -Cr- -Co- -O3 -Xs "; + }; + name = Release; + }; + DDC688CC09F574E9004E4BFF /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_1 = "\"$(SYSTEM_DEVELOPER_DIR)/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks\""; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_1)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_2)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_3)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_4)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_5)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_6)", + ); + LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/build/Debug\""; + LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)/Bass\""; + LIBRARY_SEARCH_PATHS_QUOTED_3 = "\"$(SRCROOT)/FreeImage\""; + LIBRARY_SEARCH_PATHS_QUOTED_4 = "\"$(SRCROOT)/FreeImage\""; + LIBRARY_SEARCH_PATHS_QUOTED_5 = "\"$(SRCROOT)/../lib/bass\""; + LIBRARY_SEARCH_PATHS_QUOTED_6 = "\"$(SRCROOT)/../lib/FreeImage\""; + LINK_WITH_STANDARD_LIBRARIES = YES; + OTHER_LDFLAGS = ( + "-framework", + Carbon, + ); + PREBINDING = NO; + PRODUCT_NAME = UltraStar; + WRAPPER_EXTENSION = app; + ZERO_LINK = NO; + }; + name = Debug; + }; + DDC688CD09F574E9004E4BFF /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_1 = "\"$(SYSTEM_DEVELOPER_DIR)/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks\""; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_1)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_2)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_3)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_4)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_5)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_6)", + ); + LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/build/Debug\""; + LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)/Bass\""; + LIBRARY_SEARCH_PATHS_QUOTED_3 = "\"$(SRCROOT)/FreeImage\""; + LIBRARY_SEARCH_PATHS_QUOTED_4 = "\"$(SRCROOT)/FreeImage\""; + LIBRARY_SEARCH_PATHS_QUOTED_5 = "\"$(SRCROOT)/../lib/bass\""; + LIBRARY_SEARCH_PATHS_QUOTED_6 = "\"$(SRCROOT)/../lib/FreeImage\""; + LINK_WITH_STANDARD_LIBRARIES = YES; + OTHER_LDFLAGS = ( + "-framework", + Carbon, + ); + PREBINDING = NO; + PRODUCT_NAME = "UltraStar Deluxe"; + WRAPPER_EXTENSION = app; + ZERO_LINK = NO; + }; + name = Release; + }; + DDC688DD09F57542004E4BFF /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h"; + INSTALL_PATH = /usr/local/lib; + OTHER_LDFLAGS = ( + "-framework", + Carbon, + ); + PREBINDING = NO; + PRODUCT_NAME = "Put unit sources in the 'Compile Sources' phase of this target"; + }; + name = Debug; + }; + DDC688DE09F57542004E4BFF /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h"; + INSTALL_PATH = /usr/local/lib; + OTHER_LDFLAGS = ( + "-framework", + Carbon, + ); + PREBINDING = NO; + PRODUCT_NAME = "Put unit sources in the 'Compile Sources' phase of this target"; + ZERO_LINK = NO; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + DD37F2560A60258300975B2D /* Build configuration list for PBXNativeTarget "fpcrtl" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DD37F2570A60258300975B2D /* Debug */, + DD37F2580A60258300975B2D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + DDC6851009F5717A004E4BFF /* Build configuration list for PBXProject "UltraStarDX" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DDC6851109F5717A004E4BFF /* Debug */, + DDC6851209F5717A004E4BFF /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + DDC688CB09F574E9004E4BFF /* Build configuration list for PBXNativeTarget "UltraStarDX" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DDC688CC09F574E9004E4BFF /* Debug */, + DDC688CD09F574E9004E4BFF /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + DDC688DC09F57542004E4BFF /* Build configuration list for PBXNativeTarget "Put all program sources also in this target" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DDC688DD09F57542004E4BFF /* Debug */, + DDC688DE09F57542004E4BFF /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; +/* End XCConfigurationList section */ + }; + rootObject = DDC6850F09F5717A004E4BFF /* Project object */; +} diff --git a/Game/Code/MacOSX/Wrapper/Graphics.pas b/Game/Code/MacOSX/Wrapper/Graphics.pas new file mode 100755 index 00000000..5982bb77 --- /dev/null +++ b/Game/Code/MacOSX/Wrapper/Graphics.pas @@ -0,0 +1,190 @@ +unit Graphics; + +{$INCLUDE ../Platform.inc} + +interface + +uses + Classes, SysUtils, Windows, FreeBitmap, FreeImage; + +type + TPixelFormat = (pfDevice, pf1bit, pf4bit, pf8bit, pf15bit, pf16bit, pf24bit, pf32bit, pfCustom); + TColor = -$7FFFFFFF-1..$7FFFFFFF; + + TCanvas = class + private + FImage : TFreeBitmap; + function GetPixel(x, y: Integer): TColor; + procedure SetPixel(x, y: Integer; const Value: TColor); + public + Constructor Create(const bmp : TFreeBitmap); + property Pixels[x,y : Integer] : TColor read GetPixel write SetPixel; + end; + + TBitmap = class + private + FCanvas : TCanvas; + function GetHeight: Integer; + function GetWidth: Integer; + procedure SetHeight(const Value: Integer); + procedure SetWidth(const Value: Integer); + function GetPixelFormat: TPixelFormat; + procedure SetPixelFormat(const Value: TPixelFormat); + function GetScanLine(Line: Integer): Pointer; + protected + FImage : TFreeBitmap; + public + Constructor Create; + Destructor Destroy; override; + Procedure LoadFromStream(const str : TStream); + Procedure LoadFromFile(const f : String); + Procedure SaveToFile(const f : String); virtual; + Procedure Assign(const src : TBitmap); + property Width : Integer read GetWidth write SetWidth; + property Height : Integer read GetHeight write SetHeight; + property PixelFormat : TPixelFormat read GetPixelFormat write SetPixelFormat; + property ScanLine[Line : Integer] : Pointer read GetScanLine; + property Canvas : TCanvas read FCanvas; + end; + +implementation + +{ TBitmap } + +type + TRealRGB = packed record + rgbRed: Byte; + rgbGreen: Byte; + rgbBlue: Byte; + rgbReserved: Byte; + end; + +procedure TBitmap.Assign(const src: TBitmap); +begin + FImage.Assign(src.FImage); + FCanvas.FImage := FImage; +end; + +constructor TBitmap.Create; +begin + FImage := TFreeBitmap.Create( FIF_BMP, 4, 4, 24); + FCanvas := TCanvas.Create(FImage); +end; + +destructor TBitmap.Destroy; +begin + FCanvas.Free; + FImage.Free; + inherited; +end; + +function TBitmap.GetHeight: Integer; +begin + Result := FImage.GetHeight; +end; + +function TBitmap.GetPixelFormat: TPixelFormat; +begin + Result := pf24bit; + + case FImage.GetBitsPerPixel of + 1 : Result := pf1bit; + 4 : Result := pf4bit; + 8 : Result := pf8bit; + 15 : Result := pf15bit; + 16 : Result := pf16bit; + 24 : Result := pf24bit; + 32 : Result := pf32bit; + end; +end; + +function TBitmap.GetScanLine(Line: Integer): Pointer; +begin + Result := FImage.GetScanLine(Height-1-Line); +end; + +function TBitmap.GetWidth: Integer; +begin + Result := FImage.GetWidth; +end; + +procedure TBitmap.LoadFromFile(const f: String); +begin + FreeAndNil(FCanvas); + FreeAndNil(FImage); + FImage := TFreeBitmap.Create; + FImage.Load(f); + FCanvas := TCanvas.Create(FImage); +end; + +procedure TBitmap.LoadFromStream(const str: TStream); +begin + FreeAndNil(FCanvas); + FreeAndNil(FImage); + FImage := TFreeBitmap.Create; + FImage.LoadFromStream(str); + FCanvas := TCanvas.Create(FImage); +end; + +procedure TBitmap.SaveToFile(const f: String); +begin + FImage.Save(f); +end; + +procedure TBitmap.SetHeight(const Value: Integer); +begin + if Value <> Height then begin + FImage.Rescale( Width, Value, FILTER_BILINEAR); + end; +end; + +procedure TBitmap.SetPixelFormat(const Value: TPixelFormat); +begin + if Value <> PixelFormat then begin + case Value of + pf4bit : FImage.ConvertTo4Bits; + pf8bit : FImage.ConvertTo8Bits; + pf15bit : FImage.ConvertTo16Bits555; + pf16bit : FImage.ConvertTo16Bits565; + pf24bit : FImage.ConvertTo24Bits; + pf32bit : FImage.ConvertTo32Bits; + end; + end; +end; + +procedure TBitmap.SetWidth(const Value: Integer); +begin + if Value <> Width then begin + FImage.Rescale( Value, Height, FILTER_BILINEAR); + end; +end; + +{ TCanvas } + +constructor TCanvas.Create(const bmp: TFreeBitmap); +begin + FImage := bmp; +end; + +function TCanvas.GetPixel(x, y: Integer): TColor; +var + pix : TRGBQuad; +begin + FImage.GetPixelColor( x, FImage.GetHeight-1-y, @pix); + Result := TColor(pix); +end; + +procedure TCanvas.SetPixel(x, y: Integer; const Value: TColor); +var + pixRGB : TRealRGB; + pixBGR : TRGBQuad; +begin + Move( Value, pixRGB, SizeOf(pixRGB)); + pixBGR.rgbRed := pixRGB.rgbRed; + pixBGR.rgbGreen := pixRGB.rgbGreen; + pixBGR.rgbBlue := pixRGB.rgbBlue; + pixBGR.rgbReserved := pixRGB.rgbReserved; + FImage.SetPixelColor( x, FImage.GetHeight-1-y, @pixBGR); +end; + +end. diff --git a/Game/Code/MacOSX/Wrapper/JPEG.pas b/Game/Code/MacOSX/Wrapper/JPEG.pas new file mode 100755 index 00000000..b6a90f00 --- /dev/null +++ b/Game/Code/MacOSX/Wrapper/JPEG.pas @@ -0,0 +1,34 @@ +unit JPEG; + +{$INCLUDE ../Platform.inc} + +interface + +uses GlueGraphics; + +type + TJPEGImage = class(TBitmap) + private + FCompressionQuality : Integer; + public + Procedure SaveToFile(const f : String); override; + property CompressionQuality : Integer read FCompressionQuality write FCompressionQuality; + end; + +implementation + +uses FreeImage; + +{ TJPEGImage } + +procedure TJPEGImage.SaveToFile(const f: String); +begin + if CompressionQuality = 0 then begin + CompressionQuality := 95; + end; + + FImage.Save( f, CompressionQuality); +end; + +end. + diff --git a/Game/Code/MacOSX/Wrapper/MacClasses.pas b/Game/Code/MacOSX/Wrapper/MacClasses.pas new file mode 100755 index 00000000..c494e6df --- /dev/null +++ b/Game/Code/MacOSX/Wrapper/MacClasses.pas @@ -0,0 +1,57 @@ +unit MacClasses; + +{$INCLUDE ../Platform.inc} + +interface + +uses + Classes, GlueWindows, SysUtils; + +type + + TMemoryStream = Classes.TMemoryStream; + + TResourceStream = class(TFileStream) + private + public + constructor Create(Instance: THandle; const ResName: string; ResType: PChar); + end; + +{$IFDEF MACOS} + TWndMethod = procedure of object; +{$ENDIF} + + function AllocateHWnd(Method: TWndMethod): HWND; + +implementation + +uses UPliki; + +{ TResourceStream } + +constructor TResourceStream.Create(Instance: THandle; const ResName: string; ResType: PChar); +var + sFileName : String; +begin + if ResType = 'FNT' then + sFileName := GetResourcesPath + 'Fonts/' + ResName + '.dat' + else + sFileName := GetResourcesPath + 'Fonts/' + ResName + '.' + ResType; + + if FileExists(sFileName) then + inherited Create( sFileName, fmOpenReadWrite) + else + inherited Create( sFileName, fmCreate); +end; + +function AllocateHWnd(Method: TWndMethod): HWND; +begin +{$IFDEF MSWINDOWS} + Result := Classes.AllocateHWnd(Method); +{$ENDIF} +{$IFDEF MACOS} + Result := 0; +{$ENDIF} +end; + +end. diff --git a/Game/Code/MacOSX/Wrapper/MidiFile.pas b/Game/Code/MacOSX/Wrapper/MidiFile.pas new file mode 100755 index 00000000..9ae684f4 --- /dev/null +++ b/Game/Code/MacOSX/Wrapper/MidiFile.pas @@ -0,0 +1,102 @@ +unit MidiFile; + +{$INCLUDE ../Platform.inc} + +interface + +type + + TMidiEvent = record + event: byte; + data1: byte; + data2: byte; + str: string; + dticks: integer; + time: integer; + mtime: integer; + len: integer; + end; + PMidiEvent = ^TMidiEvent; + + TOnMidiEvent = procedure(event: PMidiEvent) of object; + + + TMidiTrack = class + private + public + OnMidiEvent: TOnMidiEvent; + function getEventCount: integer; + function getEvent(index: integer): PMidiEvent; + end; + + TMidiFile = class + private + FOnMidiEvent : TOnMidiEvent; + public + TicksPerQuarter, + NumberOfTracks, + BPM : Integer; + Filename : String; + Constructor Create(AParent : TObject); + procedure StartPlaying; + procedure StopPlaying; + procedure ReadFile; + function GetTrack(index: integer): TMidiTrack; + function getCurrentTime: integer; + function getTrackLength: integer; + property OnMidiEvent: TOnMidiEvent read FOnMidiEvent write FOnMidiEvent; + end; + + +implementation + +{ TMidiFile } + +constructor TMidiFile.Create(AParent: TObject); +begin + +end; + +function TMidiFile.getCurrentTime: integer; +begin + +end; + +function TMidiFile.GetTrack(index: integer): TMidiTrack; +begin + Result := TMidiTrack.Create; +end; + +function TMidiFile.getTrackLength: integer; +begin + +end; + +procedure TMidiFile.ReadFile; +begin + +end; + +procedure TMidiFile.StartPlaying; +begin + +end; + +procedure TMidiFile.StopPlaying; +begin + +end; + +{ TMidiTrack } + +function TMidiTrack.getEvent(index: integer): PMidiEvent; +begin + +end; + +function TMidiTrack.getEventCount: integer; +begin + +end; + +end. diff --git a/Game/Code/MacOSX/Wrapper/MidiOut.pas b/Game/Code/MacOSX/Wrapper/MidiOut.pas new file mode 100755 index 00000000..249cb88b --- /dev/null +++ b/Game/Code/MacOSX/Wrapper/MidiOut.pas @@ -0,0 +1,62 @@ +unit MidiOut; + +{$INCLUDE ../Platform.inc} + +interface + +type + + TMidiOutput = class + public + ProductName : String; + Constructor Create(AParent : TObject); + procedure PutShort(MidiMessage: Byte; Data1: Byte; Data2: Byte); virtual; + function Open: Boolean; virtual; + function Close: Boolean; virtual; + {property MIDIHandle: Hmidiout read FMIDIHandle; + property DriverVersion: Version read FDriverVersion; + property Technology: OutPortTech read FTechnology write SetTechnology default opt_Synth; + property Voices: Word read FVoices; + property Notes: Word read FNotes; + property ChannelMask: Word read FChannelMask; + property Support: DWORD read FSupport; + property Error: Word read FError; + property Numdevs: Word read FNumdevs; + + procedure PutMidiEvent(theEvent: TMyMidiEvent); virtual; + procedure PutLong(TheSysex: Pointer; msgLength: Word); virtual; + procedure SetVolume(Left: Word; Right: Word); + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + + property ProductName: string read FProductName write SetProductName; + + property DeviceID: Integer read FDeviceID write SetDeviceID default 0; + property Onmidioutput: TNotifyEvent read FOnmidioutput write FOnmidioutput;} + end; + +implementation + +{ TMidiOutput } + +function TMidiOutput.Close: Boolean; +begin + +end; + +constructor TMidiOutput.Create(AParent: TObject); +begin + ProductName := 'UltraStar MidiOut Wrapper'; +end; + +function TMidiOutput.Open: Boolean; +begin + +end; + +procedure TMidiOutput.PutShort(MidiMessage, Data1, Data2: Byte); +begin + +end; + +end. diff --git a/Game/Code/MacOSX/Wrapper/OpenGL12.pas b/Game/Code/MacOSX/Wrapper/OpenGL12.pas new file mode 100755 index 00000000..ff704b33 --- /dev/null +++ b/Game/Code/MacOSX/Wrapper/OpenGL12.pas @@ -0,0 +1,4696 @@ +unit OpenGL12; + +{$INCLUDE ../Platform.inc} + +interface + +uses Windows; + +const +{$IFDEF MSWINDOWS} + glu32 = 'glu32.dll'; +{$ENDIF} +{$IFDEF MACOS} + glu32 = 'OpenGL'; +{$ENDIF} + +type + + TRCOptions = set of ( + opDoubleBuffered, + opGDI, + opStereo + ); + + UINT = Cardinal; + + {$EXTERNALSYM GLenum} + GLenum = UINT; + TGLenum = UINT; + PGLenum = ^TGLenum; + + {$EXTERNALSYM GLboolean} + GLboolean = BYTEBOOL; + TGLboolean = BYTEBOOL; + PGLboolean = ^TGLboolean; + + {$EXTERNALSYM GLbitfield} + GLbitfield = UINT; + TGLbitfield = UINT; + PGLbitfield = ^TGLbitfield; + + {$EXTERNALSYM GLbyte} + GLbyte = ShortInt; + TGLbyte = ShortInt; + PGLbyte = ^TGLbyte; + + {$EXTERNALSYM GLshort} + GLshort = SmallInt; + TGLshort = SmallInt; + PGLshort = ^TGLshort; + + {$EXTERNALSYM GLint} + GLint = Integer; + TGLint = Integer; + PGLint = ^TGLint; + + {$EXTERNALSYM GLsizei} + GLsizei = Integer; + TGLsizei = Integer; + PGLsizei = ^TGLsizei; + + {$EXTERNALSYM GLubyte} + UCHAR = Byte; + GLubyte = UCHAR; + TGLubyte = UCHAR; + PGLubyte = ^TGLubyte; + + {$EXTERNALSYM GLushort} + GLushort = Word; + TGLushort = Word; + PGLushort = ^TGLushort; + + {$EXTERNALSYM GLuint} + GLuint = UINT; + TGLuint = UINT; + PGLuint = ^TGLuint; + + {$EXTERNALSYM GLfloat} + GLfloat = Single; + TGLfloat = Single; + PGLfloat = ^TGLfloat; + + {$EXTERNALSYM GLclampf} + GLclampf = Single; + TGLclampf = Single; + PGLclampf = ^TGLclampf; + + {$EXTERNALSYM GLdouble} + GLdouble = Double; + TGLdouble = Double; + PGLdouble = ^TGLdouble; + + {$EXTERNALSYM GLclampd} + GLclampd = Double; + TGLclampd = Double; + PGLclampd = ^TGLclampd; + + TVector3d = array[0..2] of GLdouble; + + TVector4i = array[0..3] of GLint; + TVector4f = array[0..3] of GLfloat; + TVector4p = array[0..3] of Pointer; + + TMatrix4f = array[0..3, 0..3] of GLfloat; + TMatrix4d = array[0..3, 0..3] of GLdouble; + + PPointer = ^Pointer; + +{$ifdef FPC} + var +{$else} + {$ifdef MULTITHREADOPENGL} + threadvar + {$else} + var + {$endif} +{$endif} + + GL_VERSION_1_0, + GL_VERSION_1_1, + GL_VERSION_1_2, + GLU_VERSION_1_1, + GLU_VERSION_1_2, + GLU_VERSION_1_3: Boolean; + + // Extensions (gl) + GL_3DFX_multisample, + GL_3DFX_tbuffer, + GL_3DFX_texture_compression_FXT1, + + GL_APPLE_specular_vector, + GL_APPLE_transform_hint, + + GL_ARB_imaging, + GL_ARB_multisample, + GL_ARB_multitexture, + GL_ARB_texture_compression, + GL_ARB_texture_cube_map, + GL_ARB_transpose_matrix, + GL_ARB_vertex_blend, + + GL_EXT_422_pixels, + GL_EXT_abgr, + GL_EXT_bgra, + GL_EXT_blend_color, + GL_EXT_blend_func_separate, + GL_EXT_blend_logic_op, + GL_EXT_blend_minmax, + GL_EXT_blend_subtract, + GL_EXT_clip_volume_hint, + GL_EXT_cmyka, + GL_EXT_color_subtable, + GL_EXT_compiled_vertex_array, + GL_EXT_convolution, + GL_EXT_coordinate_frame, + GL_EXT_copy_texture, + GL_EXT_cull_vertex, + GL_EXT_draw_range_elements, + GL_EXT_fog_coord, + GL_EXT_histogram, + GL_EXT_index_array_formats, + GL_EXT_index_func, + GL_EXT_index_material, + GL_EXT_index_texture, + GL_EXT_light_max_exponent, + GL_EXT_light_texture, + GL_EXT_misc_attribute, + GL_EXT_multi_draw_arrays, + GL_EXT_multisample, + GL_EXT_packed_pixels, + GL_EXT_paletted_texture, + GL_EXT_pixel_transform, + GL_EXT_point_parameters, + GL_EXT_polygon_offset, + GL_EXT_rescale_normal, + GL_EXT_scene_marker, + GL_EXT_secondary_color, + GL_EXT_separate_specular_color, + GL_EXT_shared_texture_palette, + GL_EXT_stencil_wrap, + GL_EXT_subtexture, + GL_EXT_texture_color_table, + GL_EXT_texture_compression_s3tc, + GL_EXT_texture_cube_map, + GL_EXT_texture_edge_clamp, + GL_EXT_texture_env_add, + GL_EXT_texture_env_combine, + GL_EXT_texture_filter_anisotropic, + GL_EXT_texture_lod_bias, + GL_EXT_texture_object, + GL_EXT_texture_perturb_normal, + GL_EXT_texture3D, + GL_EXT_vertex_array, + GL_EXT_vertex_weighting, + + GL_FfdMaskSGIX, + GL_HP_convolution_border_modes, + GL_HP_image_transform, + GL_HP_occlusion_test, + GL_HP_texture_lighting, + + GL_IBM_cull_vertex, + GL_IBM_multimode_draw_arrays, + GL_IBM_rasterpos_clip, + GL_IBM_vertex_array_lists, + + GL_INGR_color_clamp, + GL_INGR_interlace_read, + + GL_INTEL_parallel_arrays, + + GL_KTX_buffer_region, + + GL_MESA_resize_buffers, + GL_MESA_window_pos, + + GL_NV_blend_square, + GL_NV_fog_distance, + GL_NV_light_max_exponent, + GL_NV_register_combiners, + GL_NV_texgen_emboss, + GL_NV_texgen_reflection, + GL_NV_texture_env_combine4, + GL_NV_vertex_array_range, + GL_NV_vertex_program, + + GL_PGI_misc_hints, + GL_PGI_vertex_hints, + + GL_REND_screen_coordinates, + + GL_SGI_color_matrix, + GL_SGI_color_table, + GL_SGI_depth_pass_instrument, + + GL_SGIS_detail_texture, + GL_SGIS_fog_function, + GL_SGIS_generate_mipmap, + GL_SGIS_multisample, + GL_SGIS_multitexture, + GL_SGIS_pixel_texture, + GL_SGIS_point_line_texgen, + GL_SGIS_point_parameters, + GL_SGIS_sharpen_texture, + GL_SGIS_texture_border_clamp, + GL_SGIS_texture_color_mask, + GL_SGIS_texture_edge_clamp, + GL_SGIS_texture_filter4, + GL_SGIS_texture_lod, + GL_SGIS_texture_select, + GL_SGIS_texture4D, + + GL_SGIX_async, + GL_SGIX_async_histogram, + GL_SGIX_async_pixel, + GL_SGIX_blend_alpha_minmax, + GL_SGIX_calligraphic_fragment, + GL_SGIX_clipmap, + GL_SGIX_convolution_accuracy, + GL_SGIX_depth_texture, + GL_SGIX_flush_raster, + GL_SGIX_fog_offset, + GL_SGIX_fog_scale, + GL_SGIX_fragment_lighting, + GL_SGIX_framezoom, + GL_SGIX_igloo_interface, + GL_SGIX_instruments, + GL_SGIX_interlace, + GL_SGIX_ir_instrument1, + GL_SGIX_list_priority, + GL_SGIX_pixel_texture, + GL_SGIX_pixel_tiles, + GL_SGIX_polynomial_ffd, + GL_SGIX_reference_plane, + GL_SGIX_resample, + GL_SGIX_shadow, + GL_SGIX_shadow_ambient, + GL_SGIX_sprite, + GL_SGIX_subsample, + GL_SGIX_tag_sample_buffer, + GL_SGIX_texture_add_env, + GL_SGIX_texture_lod_bias, + GL_SGIX_texture_multi_buffer, + GL_SGIX_texture_scale_bias, + GL_SGIX_vertex_preclip, + GL_SGIX_ycrcb, + GL_SGIX_ycrcba, + + GL_SUN_convolution_border_modes, + GL_SUN_global_alpha, + GL_SUN_triangle_list, + GL_SUN_vertex, + + GL_SUNX_constant_data, + + GL_WIN_phong_shading, + GL_WIN_specular_fog, + GL_WIN_swap_hint, + + WGL_EXT_swap_control, + WGL_ARB_extensions_string, + WGL_ARB_pixel_format, + + // Extensions (glu) + GLU_EXT_Texture, + GLU_EXT_object_space_tess, + GLU_EXT_nurbs_tessellator: Boolean; + +const + // ********** GL generic constants ********** + + // errors + GL_NO_ERROR = 0; + {$EXTERNALSYM GL_NO_ERROR} + GL_INVALID_ENUM = $0500; + {$EXTERNALSYM GL_INVALID_ENUM} + GL_INVALID_VALUE = $0501; + {$EXTERNALSYM GL_INVALID_VALUE} + GL_INVALID_OPERATION = $0502; + {$EXTERNALSYM GL_INVALID_OPERATION} + GL_STACK_OVERFLOW = $0503; + {$EXTERNALSYM GL_STACK_OVERFLOW} + GL_STACK_UNDERFLOW = $0504; + {$EXTERNALSYM GL_STACK_UNDERFLOW} + GL_OUT_OF_MEMORY = $0505; + {$EXTERNALSYM GL_STACK_UNDERFLOW} + + // attribute bits + GL_CURRENT_BIT = $00000001; + {$EXTERNALSYM GL_CURRENT_BIT} + GL_POINT_BIT = $00000002; + {$EXTERNALSYM GL_POINT_BIT} + GL_LINE_BIT = $00000004; + {$EXTERNALSYM GL_LINE_BIT} + GL_POLYGON_BIT = $00000008; + {$EXTERNALSYM GL_POLYGON_BIT} + GL_POLYGON_STIPPLE_BIT = $00000010; + {$EXTERNALSYM GL_POLYGON_STIPPLE_BIT} + GL_PIXEL_MODE_BIT = $00000020; + {$EXTERNALSYM GL_PIXEL_MODE_BIT} + GL_LIGHTING_BIT = $00000040; + {$EXTERNALSYM GL_LIGHTING_BIT} + GL_FOG_BIT = $00000080; + {$EXTERNALSYM GL_FOG_BIT} + GL_DEPTH_BUFFER_BIT = $00000100; + {$EXTERNALSYM GL_DEPTH_BUFFER_BIT} + GL_ACCUM_BUFFER_BIT = $00000200; + {$EXTERNALSYM GL_ACCUM_BUFFER_BIT} + GL_STENCIL_BUFFER_BIT = $00000400; + {$EXTERNALSYM GL_STENCIL_BUFFER_BIT} + GL_VIEWPORT_BIT = $00000800; + {$EXTERNALSYM GL_VIEWPORT_BIT} + GL_TRANSFORM_BIT = $00001000; + {$EXTERNALSYM GL_TRANSFORM_BIT} + GL_ENABLE_BIT = $00002000; + {$EXTERNALSYM GL_ENABLE_BIT} + GL_COLOR_BUFFER_BIT = $00004000; + {$EXTERNALSYM GL_COLOR_BUFFER_BIT} + GL_HINT_BIT = $00008000; + {$EXTERNALSYM GL_HINT_BIT} + GL_EVAL_BIT = $00010000; + {$EXTERNALSYM GL_EVAL_BIT} + GL_LIST_BIT = $00020000; + {$EXTERNALSYM GL_LIST_BIT} + GL_TEXTURE_BIT = $00040000; + {$EXTERNALSYM GL_TEXTURE_BIT} + GL_SCISSOR_BIT = $00080000; + {$EXTERNALSYM GL_SCISSOR_BIT} + GL_ALL_ATTRIB_BITS = $000FFFFF; + {$EXTERNALSYM GL_ALL_ATTRIB_BITS} + + // client attribute bits + GL_CLIENT_PIXEL_STORE_BIT = $00000001; + {$EXTERNALSYM GL_CLIENT_PIXEL_STORE_BIT} + GL_CLIENT_VERTEX_ARRAY_BIT = $00000002; + {$EXTERNALSYM GL_CLIENT_VERTEX_ARRAY_BIT} + GL_CLIENT_ALL_ATTRIB_BITS = $FFFFFFFF; + {$EXTERNALSYM GL_CLIENT_ALL_ATTRIB_BITS} + + // boolean values + GL_FALSE = Boolean(0); + {$EXTERNALSYM GL_FALSE} + GL_TRUE = Boolean(1); + {$EXTERNALSYM GL_TRUE} + + // primitives + GL_POINTS = $0000; + {$EXTERNALSYM GL_POINTS} + GL_LINES = $0001; + {$EXTERNALSYM GL_LINES} + GL_LINE_LOOP = $0002; + {$EXTERNALSYM GL_LINE_LOOP} + GL_LINE_STRIP = $0003; + {$EXTERNALSYM GL_LINE_STRIP} + GL_TRIANGLES = $0004; + {$EXTERNALSYM GL_TRIANGLES} + GL_TRIANGLE_STRIP = $0005; + {$EXTERNALSYM GL_TRIANGLE_STRIP} + GL_TRIANGLE_FAN = $0006; + {$EXTERNALSYM GL_TRIANGLE_FAN} + GL_QUADS = $0007; + {$EXTERNALSYM GL_QUADS} + GL_QUAD_STRIP = $0008; + {$EXTERNALSYM GL_QUAD_STRIP} + GL_POLYGON = $0009; + {$EXTERNALSYM GL_POLYGON} + + // blending + GL_ZERO = 0; + {$EXTERNALSYM GL_ZERO} + GL_ONE = 1; + {$EXTERNALSYM GL_ONE} + GL_SRC_COLOR = $0300; + {$EXTERNALSYM GL_SRC_COLOR} + GL_ONE_MINUS_SRC_COLOR = $0301; + {$EXTERNALSYM GL_ONE_MINUS_SRC_COLOR} + GL_SRC_ALPHA = $0302; + {$EXTERNALSYM GL_SRC_ALPHA} + GL_ONE_MINUS_SRC_ALPHA = $0303; + {$EXTERNALSYM GL_ONE_MINUS_SRC_ALPHA} + GL_DST_ALPHA = $0304; + {$EXTERNALSYM GL_DST_ALPHA} + GL_ONE_MINUS_DST_ALPHA = $0305; + {$EXTERNALSYM GL_ONE_MINUS_DST_ALPHA} + GL_DST_COLOR = $0306; + {$EXTERNALSYM GL_DST_COLOR} + GL_ONE_MINUS_DST_COLOR = $0307; + {$EXTERNALSYM GL_ONE_MINUS_DST_COLOR} + GL_SRC_ALPHA_SATURATE = $0308; + {$EXTERNALSYM GL_SRC_ALPHA_SATURATE} + GL_BLEND_DST = $0BE0; + {$EXTERNALSYM GL_BLEND_DST} + GL_BLEND_SRC = $0BE1; + {$EXTERNALSYM GL_BLEND_SRC} + GL_BLEND = $0BE2; + {$EXTERNALSYM GL_BLEND} + + // blending (GL 1.2 ARB imaging) + GL_BLEND_COLOR = $8005; + {$EXTERNALSYM GL_BLEND_COLOR} + GL_CONSTANT_COLOR = $8001; + {$EXTERNALSYM GL_CONSTANT_COLOR} + GL_ONE_MINUS_CONSTANT_COLOR = $8002; + {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_COLOR} + GL_CONSTANT_ALPHA = $8003; + {$EXTERNALSYM GL_CONSTANT_ALPHA} + GL_ONE_MINUS_CONSTANT_ALPHA = $8004; + {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_ALPHA} + GL_FUNC_ADD = $8006; + {$EXTERNALSYM GL_FUNC_ADD} + GL_MIN = $8007; + {$EXTERNALSYM GL_MIN} + GL_MAX = $8008; + {$EXTERNALSYM GL_MAX} + GL_FUNC_SUBTRACT = $800A; + {$EXTERNALSYM GL_FUNC_SUBTRACT} + GL_FUNC_REVERSE_SUBTRACT = $800B; + {$EXTERNALSYM GL_FUNC_REVERSE_SUBTRACT} + + // color table GL 1.2 ARB imaging + GL_COLOR_TABLE = $80D0; + {$EXTERNALSYM GL_COLOR_TABLE} + GL_POST_CONVOLUTION_COLOR_TABLE = $80D1; + {$EXTERNALSYM GL_POST_CONVOLUTION_COLOR_TABLE} + GL_POST_COLOR_MATRIX_COLOR_TABLE = $80D2; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_COLOR_TABLE} + GL_PROXY_COLOR_TABLE = $80D3; + {$EXTERNALSYM GL_PROXY_COLOR_TABLE} + GL_PROXY_POST_CONVOLUTION_COLOR_TABLE = $80D4; + {$EXTERNALSYM GL_PROXY_POST_CONVOLUTION_COLOR_TABLE} + GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE = $80D5; + {$EXTERNALSYM GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE} + GL_COLOR_TABLE_SCALE = $80D6; + {$EXTERNALSYM GL_COLOR_TABLE_SCALE} + GL_COLOR_TABLE_BIAS = $80D7; + {$EXTERNALSYM GL_COLOR_TABLE_BIAS} + GL_COLOR_TABLE_FORMAT = $80D8; + {$EXTERNALSYM GL_COLOR_TABLE_FORMAT} + GL_COLOR_TABLE_WIDTH = $80D9; + {$EXTERNALSYM GL_COLOR_TABLE_WIDTH} + GL_COLOR_TABLE_RED_SIZE = $80DA; + {$EXTERNALSYM GL_COLOR_TABLE_RED_SIZE} + GL_COLOR_TABLE_GREEN_SIZE = $80DB; + {$EXTERNALSYM GL_COLOR_TABLE_GREEN_SIZE} + GL_COLOR_TABLE_BLUE_SIZE = $80DC; + {$EXTERNALSYM GL_COLOR_TABLE_BLUE_SIZE} + GL_COLOR_TABLE_ALPHA_SIZE = $80DD; + {$EXTERNALSYM GL_COLOR_TABLE_ALPHA_SIZE} + GL_COLOR_TABLE_LUMINANCE_SIZE = $80DE; + {$EXTERNALSYM GL_COLOR_TABLE_LUMINANCE_SIZE} + GL_COLOR_TABLE_INTENSITY_SIZE = $80DF; + {$EXTERNALSYM GL_COLOR_TABLE_INTENSITY_SIZE} + + // convolutions GL 1.2 ARB imaging + GL_CONVOLUTION_1D = $8010; + {$EXTERNALSYM GL_CONVOLUTION_1D} + GL_CONVOLUTION_2D = $8011; + {$EXTERNALSYM GL_CONVOLUTION_2D} + GL_SEPARABLE_2D = $8012; + {$EXTERNALSYM GL_SEPARABLE_2D} + GL_CONVOLUTION_BORDER_MODE = $8013; + {$EXTERNALSYM GL_CONVOLUTION_BORDER_MODE} + GL_CONVOLUTION_FILTER_SCALE = $8014; + {$EXTERNALSYM GL_CONVOLUTION_FILTER_SCALE} + GL_CONVOLUTION_FILTER_BIAS = $8015; + {$EXTERNALSYM GL_CONVOLUTION_FILTER_BIAS} + GL_REDUCE = $8016; + {$EXTERNALSYM GL_REDUCE} + GL_CONVOLUTION_FORMAT = $8017; + {$EXTERNALSYM GL_CONVOLUTION_FORMAT} + GL_CONVOLUTION_WIDTH = $8018; + {$EXTERNALSYM GL_CONVOLUTION_WIDTH} + GL_CONVOLUTION_HEIGHT = $8019; + {$EXTERNALSYM GL_CONVOLUTION_HEIGHT} + GL_MAX_CONVOLUTION_WIDTH = $801A; + {$EXTERNALSYM GL_MAX_CONVOLUTION_WIDTH} + GL_MAX_CONVOLUTION_HEIGHT = $801B; + {$EXTERNALSYM GL_MAX_CONVOLUTION_HEIGHT} + GL_POST_CONVOLUTION_RED_SCALE = $801C; + {$EXTERNALSYM GL_POST_CONVOLUTION_RED_SCALE} + GL_POST_CONVOLUTION_GREEN_SCALE = $801D; + {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_SCALE} + GL_POST_CONVOLUTION_BLUE_SCALE = $801E; + {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_SCALE} + GL_POST_CONVOLUTION_ALPHA_SCALE = $801F; + {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_SCALE} + GL_POST_CONVOLUTION_RED_BIAS = $8020; + {$EXTERNALSYM GL_POST_CONVOLUTION_RED_BIAS} + GL_POST_CONVOLUTION_GREEN_BIAS = $8021; + {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_BIAS} + GL_POST_CONVOLUTION_BLUE_BIAS = $8022; + {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_BIAS} + GL_POST_CONVOLUTION_ALPHA_BIAS = $8023; + {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_BIAS} + + // histogram GL 1.2 ARB imaging + GL_HISTOGRAM = $8024; + {$EXTERNALSYM GL_HISTOGRAM} + GL_PROXY_HISTOGRAM = $8025; + {$EXTERNALSYM GL_PROXY_HISTOGRAM} + GL_HISTOGRAM_WIDTH = $8026; + {$EXTERNALSYM GL_HISTOGRAM_WIDTH} + GL_HISTOGRAM_FORMAT = $8027; + {$EXTERNALSYM GL_HISTOGRAM_FORMAT} + GL_HISTOGRAM_RED_SIZE = $8028; + {$EXTERNALSYM GL_HISTOGRAM_RED_SIZE} + GL_HISTOGRAM_GREEN_SIZE = $8029; + {$EXTERNALSYM GL_HISTOGRAM_GREEN_SIZE} + GL_HISTOGRAM_BLUE_SIZE = $802A; + {$EXTERNALSYM GL_HISTOGRAM_BLUE_SIZE} + GL_HISTOGRAM_ALPHA_SIZE = $802B; + {$EXTERNALSYM GL_HISTOGRAM_ALPHA_SIZE} + GL_HISTOGRAM_LUMINANCE_SIZE = $802C; + {$EXTERNALSYM GL_HISTOGRAM_LUMINANCE_SIZE} + GL_HISTOGRAM_SINK = $802D; + {$EXTERNALSYM GL_HISTOGRAM_SINK} + GL_MINMAX = $802E; + {$EXTERNALSYM GL_MINMAX} + GL_MINMAX_FORMAT = $802F; + {$EXTERNALSYM GL_MINMAX_FORMAT} + GL_MINMAX_SINK = $8030; + {$EXTERNALSYM GL_MINMAX_SINK} + + // buffers + GL_NONE = 0; + {$EXTERNALSYM GL_NONE} + GL_FRONT_LEFT = $0400; + {$EXTERNALSYM GL_FRONT_LEFT} + GL_FRONT_RIGHT = $0401; + {$EXTERNALSYM GL_FRONT_RIGHT} + GL_BACK_LEFT = $0402; + {$EXTERNALSYM GL_BACK_LEFT} + GL_BACK_RIGHT = $0403; + {$EXTERNALSYM GL_BACK_RIGHT} + GL_FRONT = $0404; + {$EXTERNALSYM GL_FRONT} + GL_BACK = $0405; + {$EXTERNALSYM GL_BACK} + GL_LEFT = $0406; + {$EXTERNALSYM GL_LEFT} + GL_RIGHT = $0407; + {$EXTERNALSYM GL_RIGHT} + GL_FRONT_AND_BACK = $0408; + {$EXTERNALSYM GL_FRONT_AND_BACK} + GL_AUX0 = $0409; + {$EXTERNALSYM GL_AUX0} + GL_AUX1 = $040A; + {$EXTERNALSYM GL_AUX1} + GL_AUX2 = $040B; + {$EXTERNALSYM GL_AUX2} + GL_AUX3 = $040C; + {$EXTERNALSYM GL_AUX3} + GL_AUX_BUFFERS = $0C00; + {$EXTERNALSYM GL_AUX_BUFFERS} + GL_DRAW_BUFFER = $0C01; + {$EXTERNALSYM GL_DRAW_BUFFER} + GL_READ_BUFFER = $0C02; + {$EXTERNALSYM GL_READ_BUFFER} + GL_DOUBLEBUFFER = $0C32; + {$EXTERNALSYM GL_DOUBLEBUFFER} + GL_STEREO = $0C33; + {$EXTERNALSYM GL_STEREO} + + // depth buffer + GL_DEPTH_RANGE = $0B70; + {$EXTERNALSYM GL_DEPTH_RANGE} + GL_DEPTH_TEST = $0B71; + {$EXTERNALSYM GL_DEPTH_TEST} + GL_DEPTH_WRITEMASK = $0B72; + {$EXTERNALSYM GL_DEPTH_WRITEMASK} + GL_DEPTH_CLEAR_VALUE = $0B73; + {$EXTERNALSYM GL_DEPTH_CLEAR_VALUE} + GL_DEPTH_FUNC = $0B74; + {$EXTERNALSYM GL_DEPTH_FUNC} + GL_NEVER = $0200; + {$EXTERNALSYM GL_NEVER} + GL_LESS = $0201; + {$EXTERNALSYM GL_LESS} + GL_EQUAL = $0202; + {$EXTERNALSYM GL_EQUAL} + GL_LEQUAL = $0203; + {$EXTERNALSYM GL_LEQUAL} + GL_GREATER = $0204; + {$EXTERNALSYM GL_GREATER} + GL_NOTEQUAL = $0205; + {$EXTERNALSYM GL_NOTEQUAL} + GL_GEQUAL = $0206; + {$EXTERNALSYM GL_GEQUAL} + GL_ALWAYS = $0207; + {$EXTERNALSYM GL_ALWAYS} + + // accumulation buffer + GL_ACCUM = $0100; + {$EXTERNALSYM GL_ACCUM} + GL_LOAD = $0101; + {$EXTERNALSYM GL_LOAD} + GL_RETURN = $0102; + {$EXTERNALSYM GL_RETURN} + GL_MULT = $0103; + {$EXTERNALSYM GL_MULT} + GL_ADD = $0104; + {$EXTERNALSYM GL_ADD} + GL_ACCUM_CLEAR_VALUE = $0B80; + {$EXTERNALSYM GL_ACCUM_CLEAR_VALUE} + + // feedback buffer + GL_FEEDBACK_BUFFER_POINTER = $0DF0; + {$EXTERNALSYM GL_FEEDBACK_BUFFER_POINTER} + GL_FEEDBACK_BUFFER_SIZE = $0DF1; + {$EXTERNALSYM GL_FEEDBACK_BUFFER_SIZE} + GL_FEEDBACK_BUFFER_TYPE = $0DF2; + {$EXTERNALSYM GL_FEEDBACK_BUFFER_TYPE} + + // feedback types + GL_2D = $0600; + {$EXTERNALSYM GL_2D} + GL_3D = $0601; + {$EXTERNALSYM GL_3D} + GL_3D_COLOR = $0602; + {$EXTERNALSYM GL_3D_COLOR} + GL_3D_COLOR_TEXTURE = $0603; + {$EXTERNALSYM GL_3D_COLOR_TEXTURE} + GL_4D_COLOR_TEXTURE = $0604; + {$EXTERNALSYM GL_4D_COLOR_TEXTURE} + + // feedback tokens + GL_PASS_THROUGH_TOKEN = $0700; + {$EXTERNALSYM GL_PASS_THROUGH_TOKEN} + GL_POINT_TOKEN = $0701; + {$EXTERNALSYM GL_POINT_TOKEN} + GL_LINE_TOKEN = $0702; + {$EXTERNALSYM GL_LINE_TOKEN} + GL_POLYGON_TOKEN = $0703; + {$EXTERNALSYM GL_POLYGON_TOKEN} + GL_BITMAP_TOKEN = $0704; + {$EXTERNALSYM GL_BITMAP_TOKEN} + GL_DRAW_PIXEL_TOKEN = $0705; + {$EXTERNALSYM GL_DRAW_PIXEL_TOKEN} + GL_COPY_PIXEL_TOKEN = $0706; + {$EXTERNALSYM GL_COPY_PIXEL_TOKEN} + GL_LINE_RESET_TOKEN = $0707; + {$EXTERNALSYM GL_LINE_RESET_TOKEN} + + // fog + GL_EXP = $0800; + {$EXTERNALSYM GL_EXP} + GL_EXP2 = $0801; + {$EXTERNALSYM GL_EXP2} + GL_FOG = $0B60; + {$EXTERNALSYM GL_FOG} + GL_FOG_INDEX = $0B61; + {$EXTERNALSYM GL_FOG_INDEX} + GL_FOG_DENSITY = $0B62; + {$EXTERNALSYM GL_FOG_DENSITY} + GL_FOG_START = $0B63; + {$EXTERNALSYM GL_FOG_START} + GL_FOG_END = $0B64; + {$EXTERNALSYM GL_FOG_END} + GL_FOG_MODE = $0B65; + {$EXTERNALSYM GL_FOG_MODE} + GL_FOG_COLOR = $0B66; + {$EXTERNALSYM GL_FOG_COLOR} + + // pixel mode, transfer + GL_PIXEL_MAP_I_TO_I = $0C70; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_I} + GL_PIXEL_MAP_S_TO_S = $0C71; + {$EXTERNALSYM GL_PIXEL_MAP_S_TO_S} + GL_PIXEL_MAP_I_TO_R = $0C72; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_R} + GL_PIXEL_MAP_I_TO_G = $0C73; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_G} + GL_PIXEL_MAP_I_TO_B = $0C74; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_B} + GL_PIXEL_MAP_I_TO_A = $0C75; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_A} + GL_PIXEL_MAP_R_TO_R = $0C76; + {$EXTERNALSYM GL_PIXEL_MAP_R_TO_R} + GL_PIXEL_MAP_G_TO_G = $0C77; + {$EXTERNALSYM GL_PIXEL_MAP_G_TO_G} + GL_PIXEL_MAP_B_TO_B = $0C78; + {$EXTERNALSYM GL_PIXEL_MAP_B_TO_B} + GL_PIXEL_MAP_A_TO_A = $0C79; + {$EXTERNALSYM GL_PIXEL_MAP_A_TO_A} + + // vertex arrays + GL_VERTEX_ARRAY_POINTER = $808E; + {$EXTERNALSYM GL_VERTEX_ARRAY_POINTER} + GL_NORMAL_ARRAY_POINTER = $808F; + {$EXTERNALSYM GL_NORMAL_ARRAY_POINTER} + GL_COLOR_ARRAY_POINTER = $8090; + {$EXTERNALSYM GL_COLOR_ARRAY_POINTER} + GL_INDEX_ARRAY_POINTER = $8091; + {$EXTERNALSYM GL_INDEX_ARRAY_POINTER} + GL_TEXTURE_COORD_ARRAY_POINTER = $8092; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_POINTER} + GL_EDGE_FLAG_ARRAY_POINTER = $8093; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_POINTER} + + // stenciling + GL_STENCIL_TEST = $0B90; + {$EXTERNALSYM GL_STENCIL_TEST} + GL_STENCIL_CLEAR_VALUE = $0B91; + {$EXTERNALSYM GL_STENCIL_CLEAR_VALUE} + GL_STENCIL_FUNC = $0B92; + {$EXTERNALSYM GL_STENCIL_FUNC} + GL_STENCIL_VALUE_MASK = $0B93; + {$EXTERNALSYM GL_STENCIL_VALUE_MASK} + GL_STENCIL_FAIL = $0B94; + {$EXTERNALSYM GL_STENCIL_FAIL} + GL_STENCIL_PASS_DEPTH_FAIL = $0B95; + {$EXTERNALSYM GL_STENCIL_PASS_DEPTH_FAIL} + GL_STENCIL_PASS_DEPTH_PASS = $0B96; + {$EXTERNALSYM GL_STENCIL_PASS_DEPTH_PASS} + GL_STENCIL_REF = $0B97; + {$EXTERNALSYM GL_STENCIL_REF} + GL_STENCIL_WRITEMASK = $0B98; + {$EXTERNALSYM GL_STENCIL_WRITEMASK} + GL_KEEP = $1E00; + {$EXTERNALSYM GL_KEEP} + GL_REPLACE = $1E01; + {$EXTERNALSYM GL_REPLACE} + GL_INCR = $1E02; + {$EXTERNALSYM GL_INCR} + GL_DECR = $1E03; + {$EXTERNALSYM GL_DECR} + + // color material + GL_COLOR_MATERIAL_FACE = $0B55; + {$EXTERNALSYM GL_COLOR_MATERIAL_FACE} + GL_COLOR_MATERIAL_PARAMETER = $0B56; + {$EXTERNALSYM GL_COLOR_MATERIAL_PARAMETER} + GL_COLOR_MATERIAL = $0B57; + {$EXTERNALSYM GL_COLOR_MATERIAL} + + // points + GL_POINT_SMOOTH = $0B10; + {$EXTERNALSYM GL_POINT_SMOOTH} + GL_POINT_SIZE = $0B11; + {$EXTERNALSYM GL_POINT_SIZE} + GL_POINT_SIZE_RANGE = $0B12; + {$EXTERNALSYM GL_POINT_SIZE_RANGE} + GL_POINT_SIZE_GRANULARITY = $0B13; + {$EXTERNALSYM GL_POINT_SIZE_GRANULARITY} + + // lines + GL_LINE_SMOOTH = $0B20; + {$EXTERNALSYM GL_LINE_SMOOTH} + GL_LINE_WIDTH = $0B21; + {$EXTERNALSYM GL_LINE_WIDTH} + GL_LINE_WIDTH_RANGE = $0B22; + {$EXTERNALSYM GL_LINE_WIDTH_RANGE} + GL_LINE_WIDTH_GRANULARITY = $0B23; + {$EXTERNALSYM GL_LINE_WIDTH_GRANULARITY} + GL_LINE_STIPPLE = $0B24; + {$EXTERNALSYM GL_LINE_STIPPLE} + GL_LINE_STIPPLE_PATTERN = $0B25; + {$EXTERNALSYM GL_LINE_STIPPLE_PATTERN} + GL_LINE_STIPPLE_REPEAT = $0B26; + {$EXTERNALSYM GL_LINE_STIPPLE_REPEAT} + + // polygons + GL_POLYGON_MODE = $0B40; + {$EXTERNALSYM GL_POLYGON_MODE} + GL_POLYGON_SMOOTH = $0B41; + {$EXTERNALSYM GL_POLYGON_SMOOTH} + GL_POLYGON_STIPPLE = $0B42; + {$EXTERNALSYM GL_POLYGON_STIPPLE} + GL_EDGE_FLAG = $0B43; + {$EXTERNALSYM GL_EDGE_FLAG} + GL_CULL_FACE = $0B44; + {$EXTERNALSYM GL_CULL_FACE} + GL_CULL_FACE_MODE = $0B45; + {$EXTERNALSYM GL_CULL_FACE_MODE} + GL_FRONT_FACE = $0B46; + {$EXTERNALSYM GL_FRONT_FACE} + GL_CW = $0900; + {$EXTERNALSYM GL_CW} + GL_CCW = $0901; + {$EXTERNALSYM GL_CCW} + GL_POINT = $1B00; + {$EXTERNALSYM GL_POINT} + GL_LINE = $1B01; + {$EXTERNALSYM GL_LINE} + GL_FILL = $1B02; + {$EXTERNALSYM GL_FILL} + + // display lists + GL_LIST_MODE = $0B30; + {$EXTERNALSYM GL_LIST_MODE} + GL_LIST_BASE = $0B32; + {$EXTERNALSYM GL_LIST_BASE} + GL_LIST_INDEX = $0B33; + {$EXTERNALSYM GL_LIST_INDEX} + GL_COMPILE = $1300; + {$EXTERNALSYM GL_COMPILE} + GL_COMPILE_AND_EXECUTE = $1301; + {$EXTERNALSYM GL_COMPILE_AND_EXECUTE} + + // lighting + GL_LIGHTING = $0B50; + {$EXTERNALSYM GL_LIGHTING} + GL_LIGHT_MODEL_LOCAL_VIEWER = $0B51; + {$EXTERNALSYM GL_LIGHT_MODEL_LOCAL_VIEWER} + GL_LIGHT_MODEL_TWO_SIDE = $0B52; + {$EXTERNALSYM GL_LIGHT_MODEL_TWO_SIDE} + GL_LIGHT_MODEL_AMBIENT = $0B53; + {$EXTERNALSYM GL_LIGHT_MODEL_AMBIENT} + GL_LIGHT_MODEL_COLOR_CONTROL = $81F8; // GL 1.2 + {$EXTERNALSYM GL_LIGHT_MODEL_COLOR_CONTROL} + GL_SHADE_MODEL = $0B54; + {$EXTERNALSYM GL_SHADE_MODEL} + GL_NORMALIZE = $0BA1; + {$EXTERNALSYM GL_NORMALIZE} + GL_AMBIENT = $1200; + {$EXTERNALSYM GL_AMBIENT} + GL_DIFFUSE = $1201; + {$EXTERNALSYM GL_DIFFUSE} + GL_SPECULAR = $1202; + {$EXTERNALSYM GL_SPECULAR} + GL_POSITION = $1203; + {$EXTERNALSYM GL_POSITION} + GL_SPOT_DIRECTION = $1204; + {$EXTERNALSYM GL_SPOT_DIRECTION} + GL_SPOT_EXPONENT = $1205; + {$EXTERNALSYM GL_SPOT_EXPONENT} + GL_SPOT_CUTOFF = $1206; + {$EXTERNALSYM GL_SPOT_CUTOFF} + GL_CONSTANT_ATTENUATION = $1207; + {$EXTERNALSYM GL_CONSTANT_ATTENUATION} + GL_LINEAR_ATTENUATION = $1208; + {$EXTERNALSYM GL_LINEAR_ATTENUATION} + GL_QUADRATIC_ATTENUATION = $1209; + {$EXTERNALSYM GL_QUADRATIC_ATTENUATION} + GL_EMISSION = $1600; + {$EXTERNALSYM GL_EMISSION} + GL_SHININESS = $1601; + {$EXTERNALSYM GL_SHININESS} + GL_AMBIENT_AND_DIFFUSE = $1602; + {$EXTERNALSYM GL_AMBIENT_AND_DIFFUSE} + GL_COLOR_INDEXES = $1603; + {$EXTERNALSYM GL_COLOR_INDEXES} + GL_FLAT = $1D00; + {$EXTERNALSYM GL_FLAT} + GL_SMOOTH = $1D01; + {$EXTERNALSYM GL_SMOOTH} + GL_LIGHT0 = $4000; + {$EXTERNALSYM GL_LIGHT0} + GL_LIGHT1 = $4001; + {$EXTERNALSYM GL_LIGHT1} + GL_LIGHT2 = $4002; + {$EXTERNALSYM GL_LIGHT2} + GL_LIGHT3 = $4003; + {$EXTERNALSYM GL_LIGHT3} + GL_LIGHT4 = $4004; + {$EXTERNALSYM GL_LIGHT4} + GL_LIGHT5 = $4005; + {$EXTERNALSYM GL_LIGHT5} + GL_LIGHT6 = $4006; + {$EXTERNALSYM GL_LIGHT6} + GL_LIGHT7 = $4007; + {$EXTERNALSYM GL_LIGHT7} + + // matrix modes + GL_MATRIX_MODE = $0BA0; + {$EXTERNALSYM GL_MATRIX_MODE} + GL_MODELVIEW = $1700; + {$EXTERNALSYM GL_MODELVIEW} + GL_PROJECTION = $1701; + {$EXTERNALSYM GL_PROJECTION} + GL_TEXTURE = $1702; + {$EXTERNALSYM GL_TEXTURE} + + // gets + GL_CURRENT_COLOR = $0B00; + {$EXTERNALSYM GL_CURRENT_COLOR} + GL_CURRENT_INDEX = $0B01; + {$EXTERNALSYM GL_CURRENT_INDEX} + GL_CURRENT_NORMAL = $0B02; + {$EXTERNALSYM GL_CURRENT_NORMAL} + GL_CURRENT_TEXTURE_COORDS = $0B03; + {$EXTERNALSYM GL_CURRENT_TEXTURE_COORDS} + GL_CURRENT_RASTER_COLOR = $0B04; + {$EXTERNALSYM GL_CURRENT_RASTER_COLOR} + GL_CURRENT_RASTER_INDEX = $0B05; + {$EXTERNALSYM GL_CURRENT_RASTER_INDEX} + GL_CURRENT_RASTER_TEXTURE_COORDS = $0B06; + {$EXTERNALSYM GL_CURRENT_RASTER_TEXTURE_COORDS} + GL_CURRENT_RASTER_POSITION = $0B07; + {$EXTERNALSYM GL_CURRENT_RASTER_POSITION} + GL_CURRENT_RASTER_POSITION_VALID = $0B08; + {$EXTERNALSYM GL_CURRENT_RASTER_POSITION_VALID} + GL_CURRENT_RASTER_DISTANCE = $0B09; + {$EXTERNALSYM GL_CURRENT_RASTER_DISTANCE} + GL_MAX_LIST_NESTING = $0B31; + {$EXTERNALSYM GL_MAX_LIST_NESTING} + GL_VIEWPORT = $0BA2; + {$EXTERNALSYM GL_VIEWPORT} + GL_MODELVIEW_STACK_DEPTH = $0BA3; + {$EXTERNALSYM GL_MODELVIEW_STACK_DEPTH} + GL_PROJECTION_STACK_DEPTH = $0BA4; + {$EXTERNALSYM GL_PROJECTION_STACK_DEPTH} + GL_TEXTURE_STACK_DEPTH = $0BA5; + {$EXTERNALSYM GL_TEXTURE_STACK_DEPTH} + GL_MODELVIEW_MATRIX = $0BA6; + {$EXTERNALSYM GL_MODELVIEW_MATRIX} + GL_PROJECTION_MATRIX = $0BA7; + {$EXTERNALSYM GL_PROJECTION_MATRIX} + GL_TEXTURE_MATRIX = $0BA8; + {$EXTERNALSYM GL_TEXTURE_MATRIX} + GL_ATTRIB_STACK_DEPTH = $0BB0; + {$EXTERNALSYM GL_ATTRIB_STACK_DEPTH} + GL_CLIENT_ATTRIB_STACK_DEPTH = $0BB1; + {$EXTERNALSYM GL_CLIENT_ATTRIB_STACK_DEPTH} + + GL_SINGLE_COLOR = $81F9; // GL 1.2 + {$EXTERNALSYM GL_SINGLE_COLOR} + GL_SEPARATE_SPECULAR_COLOR = $81FA; // GL 1.2 + {$EXTERNALSYM GL_SEPARATE_SPECULAR_COLOR} + + // alpha testing + GL_ALPHA_TEST = $0BC0; + {$EXTERNALSYM GL_ALPHA_TEST} + GL_ALPHA_TEST_FUNC = $0BC1; + {$EXTERNALSYM GL_ALPHA_TEST_FUNC} + GL_ALPHA_TEST_REF = $0BC2; + {$EXTERNALSYM GL_ALPHA_TEST_REF} + + GL_LOGIC_OP_MODE = $0BF0; + {$EXTERNALSYM GL_LOGIC_OP_MODE} + GL_INDEX_LOGIC_OP = $0BF1; + {$EXTERNALSYM GL_INDEX_LOGIC_OP} + GL_LOGIC_OP = $0BF1; + {$EXTERNALSYM GL_LOGIC_OP} + GL_COLOR_LOGIC_OP = $0BF2; + {$EXTERNALSYM GL_COLOR_LOGIC_OP} + GL_SCISSOR_BOX = $0C10; + {$EXTERNALSYM GL_SCISSOR_BOX} + GL_SCISSOR_TEST = $0C11; + {$EXTERNALSYM GL_SCISSOR_TEST} + GL_INDEX_CLEAR_VALUE = $0C20; + {$EXTERNALSYM GL_INDEX_CLEAR_VALUE} + GL_INDEX_WRITEMASK = $0C21; + {$EXTERNALSYM GL_INDEX_WRITEMASK} + GL_COLOR_CLEAR_VALUE = $0C22; + {$EXTERNALSYM GL_COLOR_CLEAR_VALUE} + GL_COLOR_WRITEMASK = $0C23; + {$EXTERNALSYM GL_COLOR_WRITEMASK} + GL_INDEX_MODE = $0C30; + {$EXTERNALSYM GL_INDEX_MODE} + GL_RGBA_MODE = $0C31; + {$EXTERNALSYM GL_RGBA_MODE} + GL_RENDER_MODE = $0C40; + {$EXTERNALSYM GL_RENDER_MODE} + GL_PERSPECTIVE_CORRECTION_HINT = $0C50; + {$EXTERNALSYM GL_PERSPECTIVE_CORRECTION_HINT} + GL_POINT_SMOOTH_HINT = $0C51; + {$EXTERNALSYM GL_POINT_SMOOTH_HINT} + GL_LINE_SMOOTH_HINT = $0C52; + {$EXTERNALSYM GL_LINE_SMOOTH_HINT} + GL_POLYGON_SMOOTH_HINT = $0C53; + {$EXTERNALSYM GL_POLYGON_SMOOTH_HINT} + GL_FOG_HINT = $0C54; + {$EXTERNALSYM GL_FOG_HINT} + GL_TEXTURE_GEN_S = $0C60; + {$EXTERNALSYM GL_TEXTURE_GEN_S} + GL_TEXTURE_GEN_T = $0C61; + {$EXTERNALSYM GL_TEXTURE_GEN_T} + GL_TEXTURE_GEN_R = $0C62; + {$EXTERNALSYM GL_TEXTURE_GEN_R} + GL_TEXTURE_GEN_Q = $0C63; + {$EXTERNALSYM GL_TEXTURE_GEN_Q} + GL_PIXEL_MAP_I_TO_I_SIZE = $0CB0; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_I_SIZE} + GL_PIXEL_MAP_S_TO_S_SIZE = $0CB1; + {$EXTERNALSYM GL_PIXEL_MAP_S_TO_S_SIZE} + GL_PIXEL_MAP_I_TO_R_SIZE = $0CB2; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_R_SIZE} + GL_PIXEL_MAP_I_TO_G_SIZE = $0CB3; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_G_SIZE} + GL_PIXEL_MAP_I_TO_B_SIZE = $0CB4; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_B_SIZE} + GL_PIXEL_MAP_I_TO_A_SIZE = $0CB5; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_A_SIZE} + GL_PIXEL_MAP_R_TO_R_SIZE = $0CB6; + {$EXTERNALSYM GL_PIXEL_MAP_R_TO_R_SIZE} + GL_PIXEL_MAP_G_TO_G_SIZE = $0CB7; + {$EXTERNALSYM GL_PIXEL_MAP_G_TO_G_SIZE} + GL_PIXEL_MAP_B_TO_B_SIZE = $0CB8; + {$EXTERNALSYM GL_PIXEL_MAP_B_TO_B_SIZE} + GL_PIXEL_MAP_A_TO_A_SIZE = $0CB9; + {$EXTERNALSYM GL_PIXEL_MAP_A_TO_A_SIZE} + GL_UNPACK_SWAP_BYTES = $0CF0; + {$EXTERNALSYM GL_UNPACK_SWAP_BYTES} + GL_UNPACK_LSB_FIRST = $0CF1; + {$EXTERNALSYM GL_UNPACK_LSB_FIRST} + GL_UNPACK_ROW_LENGTH = $0CF2; + {$EXTERNALSYM GL_UNPACK_ROW_LENGTH} + GL_UNPACK_SKIP_ROWS = $0CF3; + {$EXTERNALSYM GL_UNPACK_SKIP_ROWS} + GL_UNPACK_SKIP_PIXELS = $0CF4; + {$EXTERNALSYM GL_UNPACK_SKIP_PIXELS} + GL_UNPACK_ALIGNMENT = $0CF5; + {$EXTERNALSYM GL_UNPACK_ALIGNMENT} + GL_PACK_SWAP_BYTES = $0D00; + {$EXTERNALSYM GL_PACK_SWAP_BYTES} + GL_PACK_LSB_FIRST = $0D01; + {$EXTERNALSYM GL_PACK_LSB_FIRST} + GL_PACK_ROW_LENGTH = $0D02; + {$EXTERNALSYM GL_PACK_ROW_LENGTH} + GL_PACK_SKIP_ROWS = $0D03; + {$EXTERNALSYM GL_PACK_SKIP_ROWS} + GL_PACK_SKIP_PIXELS = $0D04; + {$EXTERNALSYM GL_PACK_SKIP_PIXELS} + GL_PACK_ALIGNMENT = $0D05; + {$EXTERNALSYM GL_PACK_ALIGNMENT} + GL_PACK_SKIP_IMAGES = $806B; // GL 1.2 + {$EXTERNALSYM GL_PACK_SKIP_IMAGES} + GL_PACK_IMAGE_HEIGHT = $806C; // GL 1.2 + {$EXTERNALSYM GL_PACK_IMAGE_HEIGHT} + GL_UNPACK_SKIP_IMAGES = $806D; // GL 1.2 + {$EXTERNALSYM GL_UNPACK_SKIP_IMAGES} + GL_UNPACK_IMAGE_HEIGHT = $806E; // GL 1.2 + {$EXTERNALSYM GL_UNPACK_IMAGE_HEIGHT} + GL_MAP_COLOR = $0D10; + {$EXTERNALSYM GL_MAP_COLOR} + GL_MAP_STENCIL = $0D11; + {$EXTERNALSYM GL_MAP_STENCIL} + GL_INDEX_SHIFT = $0D12; + {$EXTERNALSYM GL_INDEX_SHIFT} + GL_INDEX_OFFSET = $0D13; + {$EXTERNALSYM GL_INDEX_OFFSET} + GL_RED_SCALE = $0D14; + {$EXTERNALSYM GL_RED_SCALE} + GL_RED_BIAS = $0D15; + {$EXTERNALSYM GL_RED_BIAS} + GL_ZOOM_X = $0D16; + {$EXTERNALSYM GL_ZOOM_X} + GL_ZOOM_Y = $0D17; + {$EXTERNALSYM GL_ZOOM_Y} + GL_GREEN_SCALE = $0D18; + {$EXTERNALSYM GL_GREEN_SCALE} + GL_GREEN_BIAS = $0D19; + {$EXTERNALSYM GL_GREEN_BIAS} + GL_BLUE_SCALE = $0D1A; + {$EXTERNALSYM GL_BLUE_SCALE} + GL_BLUE_BIAS = $0D1B; + {$EXTERNALSYM GL_BLUE_BIAS} + GL_ALPHA_SCALE = $0D1C; + {$EXTERNALSYM GL_ALPHA_SCALE} + GL_ALPHA_BIAS = $0D1D; + {$EXTERNALSYM GL_ALPHA_BIAS} + GL_DEPTH_SCALE = $0D1E; + {$EXTERNALSYM GL_DEPTH_SCALE} + GL_DEPTH_BIAS = $0D1F; + {$EXTERNALSYM GL_DEPTH_BIAS} + GL_MAX_EVAL_ORDER = $0D30; + {$EXTERNALSYM GL_MAX_EVAL_ORDER} + GL_MAX_LIGHTS = $0D31; + {$EXTERNALSYM GL_MAX_LIGHTS} + GL_MAX_CLIP_PLANES = $0D32; + {$EXTERNALSYM GL_MAX_CLIP_PLANES} + GL_MAX_TEXTURE_SIZE = $0D33; + {$EXTERNALSYM GL_MAX_TEXTURE_SIZE} + GL_MAX_3D_TEXTURE_SIZE = $8073; // GL 1.2 + {$EXTERNALSYM GL_MAX_3D_TEXTURE_SIZE} + GL_MAX_PIXEL_MAP_TABLE = $0D34; + {$EXTERNALSYM GL_MAX_PIXEL_MAP_TABLE} + GL_MAX_ATTRIB_STACK_DEPTH = $0D35; + {$EXTERNALSYM GL_MAX_ATTRIB_STACK_DEPTH} + GL_MAX_MODELVIEW_STACK_DEPTH = $0D36; + {$EXTERNALSYM GL_MAX_MODELVIEW_STACK_DEPTH} + GL_MAX_NAME_STACK_DEPTH = $0D37; + {$EXTERNALSYM GL_MAX_NAME_STACK_DEPTH} + GL_MAX_PROJECTION_STACK_DEPTH = $0D38; + {$EXTERNALSYM GL_MAX_PROJECTION_STACK_DEPTH} + GL_MAX_TEXTURE_STACK_DEPTH = $0D39; + {$EXTERNALSYM GL_MAX_TEXTURE_STACK_DEPTH} + GL_MAX_VIEWPORT_DIMS = $0D3A; + {$EXTERNALSYM GL_MAX_VIEWPORT_DIMS} + GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = $0D3B; + {$EXTERNALSYM GL_MAX_CLIENT_ATTRIB_STACK_DEPTH} + GL_MAX_ELEMENTS_VERTICES = $80E8; // GL 1.2 + {$EXTERNALSYM GL_MAX_ELEMENTS_VERTICES} + GL_MAX_ELEMENTS_INDICES = $80E9; // GL 1.2 + {$EXTERNALSYM GL_MAX_ELEMENTS_INDICES} + GL_RESCALE_NORMAL = $803A; // GL 1.2 + {$EXTERNALSYM GL_RESCALE_NORMAL} + GL_SUBPIXEL_BITS = $0D50; + {$EXTERNALSYM GL_SUBPIXEL_BITS} + GL_INDEX_BITS = $0D51; + {$EXTERNALSYM GL_INDEX_BITS} + GL_RED_BITS = $0D52; + {$EXTERNALSYM GL_RED_BITS} + GL_GREEN_BITS = $0D53; + {$EXTERNALSYM GL_GREEN_BITS} + GL_BLUE_BITS = $0D54; + {$EXTERNALSYM GL_BLUE_BITS} + GL_ALPHA_BITS = $0D55; + {$EXTERNALSYM GL_ALPHA_BITS} + GL_DEPTH_BITS = $0D56; + {$EXTERNALSYM GL_DEPTH_BITS} + GL_STENCIL_BITS = $0D57; + {$EXTERNALSYM GL_STENCIL_BITS} + GL_ACCUM_RED_BITS = $0D58; + {$EXTERNALSYM GL_ACCUM_RED_BITS} + GL_ACCUM_GREEN_BITS = $0D59; + {$EXTERNALSYM GL_ACCUM_GREEN_BITS} + GL_ACCUM_BLUE_BITS = $0D5A; + {$EXTERNALSYM GL_ACCUM_BLUE_BITS} + GL_ACCUM_ALPHA_BITS = $0D5B; + {$EXTERNALSYM GL_ACCUM_ALPHA_BITS} + GL_NAME_STACK_DEPTH = $0D70; + {$EXTERNALSYM GL_NAME_STACK_DEPTH} + GL_AUTO_NORMAL = $0D80; + {$EXTERNALSYM GL_AUTO_NORMAL} + GL_MAP1_COLOR_4 = $0D90; + {$EXTERNALSYM GL_MAP1_COLOR_4} + GL_MAP1_INDEX = $0D91; + {$EXTERNALSYM GL_MAP1_INDEX} + GL_MAP1_NORMAL = $0D92; + {$EXTERNALSYM GL_MAP1_NORMAL} + GL_MAP1_TEXTURE_COORD_1 = $0D93; + {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_1} + GL_MAP1_TEXTURE_COORD_2 = $0D94; + {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_2} + GL_MAP1_TEXTURE_COORD_3 = $0D95; + {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_3} + GL_MAP1_TEXTURE_COORD_4 = $0D96; + {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_4} + GL_MAP1_VERTEX_3 = $0D97; + {$EXTERNALSYM GL_MAP1_VERTEX_3} + GL_MAP1_VERTEX_4 = $0D98; + {$EXTERNALSYM GL_MAP1_VERTEX_4} + GL_MAP2_COLOR_4 = $0DB0; + {$EXTERNALSYM GL_MAP2_COLOR_4} + GL_MAP2_INDEX = $0DB1; + {$EXTERNALSYM GL_MAP2_INDEX} + GL_MAP2_NORMAL = $0DB2; + {$EXTERNALSYM GL_MAP2_NORMAL} + GL_MAP2_TEXTURE_COORD_1 = $0DB3; + {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_1} + GL_MAP2_TEXTURE_COORD_2 = $0DB4; + {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_2} + GL_MAP2_TEXTURE_COORD_3 = $0DB5; + {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_3} + GL_MAP2_TEXTURE_COORD_4 = $0DB6; + {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_4} + GL_MAP2_VERTEX_3 = $0DB7; + {$EXTERNALSYM GL_MAP2_VERTEX_3} + GL_MAP2_VERTEX_4 = $0DB8; + {$EXTERNALSYM GL_MAP2_VERTEX_4} + GL_MAP1_GRID_DOMAIN = $0DD0; + {$EXTERNALSYM GL_MAP1_GRID_DOMAIN} + GL_MAP1_GRID_SEGMENTS = $0DD1; + {$EXTERNALSYM GL_MAP1_GRID_SEGMENTS} + GL_MAP2_GRID_DOMAIN = $0DD2; + {$EXTERNALSYM GL_MAP2_GRID_DOMAIN} + GL_MAP2_GRID_SEGMENTS = $0DD3; + {$EXTERNALSYM GL_MAP2_GRID_SEGMENTS} + GL_TEXTURE_1D = $0DE0; + {$EXTERNALSYM GL_TEXTURE_1D} + GL_TEXTURE_2D = $0DE1; + {$EXTERNALSYM GL_TEXTURE_2D} + GL_TEXTURE_3D = $806F; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_3D} + GL_SELECTION_BUFFER_POINTER = $0DF3; + {$EXTERNALSYM GL_SELECTION_BUFFER_POINTER} + GL_SELECTION_BUFFER_SIZE = $0DF4; + {$EXTERNALSYM GL_SELECTION_BUFFER_SIZE} + GL_POLYGON_OFFSET_UNITS = $2A00; + {$EXTERNALSYM GL_POLYGON_OFFSET_UNITS} + GL_POLYGON_OFFSET_POINT = $2A01; + {$EXTERNALSYM GL_POLYGON_OFFSET_POINT} + GL_POLYGON_OFFSET_LINE = $2A02; + {$EXTERNALSYM GL_POLYGON_OFFSET_LINE} + GL_POLYGON_OFFSET_FILL = $8037; + {$EXTERNALSYM GL_POLYGON_OFFSET_FILL} + GL_POLYGON_OFFSET_FACTOR = $8038; + {$EXTERNALSYM GL_POLYGON_OFFSET_FACTOR} + GL_TEXTURE_BINDING_1D = $8068; + {$EXTERNALSYM GL_TEXTURE_BINDING_1D} + GL_TEXTURE_BINDING_2D = $8069; + {$EXTERNALSYM GL_TEXTURE_BINDING_2D} + GL_VERTEX_ARRAY = $8074; + {$EXTERNALSYM GL_VERTEX_ARRAY} + GL_NORMAL_ARRAY = $8075; + {$EXTERNALSYM GL_NORMAL_ARRAY} + GL_COLOR_ARRAY = $8076; + {$EXTERNALSYM GL_COLOR_ARRAY} + GL_INDEX_ARRAY = $8077; + {$EXTERNALSYM GL_INDEX_ARRAY} + GL_TEXTURE_COORD_ARRAY = $8078; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY} + GL_EDGE_FLAG_ARRAY = $8079; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY} + GL_VERTEX_ARRAY_SIZE = $807A; + {$EXTERNALSYM GL_VERTEX_ARRAY_SIZE} + GL_VERTEX_ARRAY_TYPE = $807B; + {$EXTERNALSYM GL_VERTEX_ARRAY_TYPE} + GL_VERTEX_ARRAY_STRIDE = $807C; + {$EXTERNALSYM GL_VERTEX_ARRAY_STRIDE} + GL_NORMAL_ARRAY_TYPE = $807E; + {$EXTERNALSYM GL_NORMAL_ARRAY_TYPE} + GL_NORMAL_ARRAY_STRIDE = $807F; + {$EXTERNALSYM GL_NORMAL_ARRAY_STRIDE} + GL_COLOR_ARRAY_SIZE = $8081; + {$EXTERNALSYM GL_COLOR_ARRAY_SIZE} + GL_COLOR_ARRAY_TYPE = $8082; + {$EXTERNALSYM GL_COLOR_ARRAY_TYPE} + GL_COLOR_ARRAY_STRIDE = $8083; + {$EXTERNALSYM GL_COLOR_ARRAY_STRIDE} + GL_INDEX_ARRAY_TYPE = $8085; + {$EXTERNALSYM GL_INDEX_ARRAY_TYPE} + GL_INDEX_ARRAY_STRIDE = $8086; + {$EXTERNALSYM GL_INDEX_ARRAY_STRIDE} + GL_TEXTURE_COORD_ARRAY_SIZE = $8088; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_SIZE} + GL_TEXTURE_COORD_ARRAY_TYPE = $8089; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_TYPE} + GL_TEXTURE_COORD_ARRAY_STRIDE = $808A; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_STRIDE} + GL_EDGE_FLAG_ARRAY_STRIDE = $808C; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_STRIDE} + GL_COLOR_MATRIX = $80B1; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_COLOR_MATRIX} + GL_COLOR_MATRIX_STACK_DEPTH = $80B2; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_COLOR_MATRIX_STACK_DEPTH} + GL_MAX_COLOR_MATRIX_STACK_DEPTH = $80B3; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_MAX_COLOR_MATRIX_STACK_DEPTH} + GL_POST_COLOR_MATRIX_RED_SCALE = $80B4; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_SCALE} + GL_POST_COLOR_MATRIX_GREEN_SCALE = $80B5; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_SCALE} + GL_POST_COLOR_MATRIX_BLUE_SCALE = $80B6; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_SCALE} + GL_POST_COLOR_MATRIX_ALPHA_SCALE = $80B7; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_SCALE} + GL_POST_COLOR_MATRIX_RED_BIAS = $80B8; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_BIAS} + GL_POST_COLOR_MATRIX_GREEN_BIAS = $80B9; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_BIAS} + GL_POST_COLOR_MATRIX_BLUE_BIAS = $80BA; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_BIAS} + GL_POST_COLOR_MATRIX_ALPHA_BIAS = $80BB; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_BIAS} + + // evaluators + GL_COEFF = $0A00; + {$EXTERNALSYM GL_COEFF} + GL_ORDER = $0A01; + {$EXTERNALSYM GL_ORDER} + GL_DOMAIN = $0A02; + {$EXTERNALSYM GL_DOMAIN} + + // texture mapping + GL_TEXTURE_WIDTH = $1000; + {$EXTERNALSYM GL_TEXTURE_WIDTH} + GL_TEXTURE_HEIGHT = $1001; + {$EXTERNALSYM GL_TEXTURE_HEIGHT} + GL_TEXTURE_INTERNAL_FORMAT = $1003; + {$EXTERNALSYM GL_TEXTURE_INTERNAL_FORMAT} + GL_TEXTURE_COMPONENTS = $1003; + {$EXTERNALSYM GL_TEXTURE_COMPONENTS} + GL_TEXTURE_BORDER_COLOR = $1004; + {$EXTERNALSYM GL_TEXTURE_BORDER_COLOR} + GL_TEXTURE_BORDER = $1005; + {$EXTERNALSYM GL_TEXTURE_BORDER} + GL_TEXTURE_RED_SIZE = $805C; + {$EXTERNALSYM GL_TEXTURE_RED_SIZE} + GL_TEXTURE_GREEN_SIZE = $805D; + {$EXTERNALSYM GL_TEXTURE_GREEN_SIZE} + GL_TEXTURE_BLUE_SIZE = $805E; + {$EXTERNALSYM GL_TEXTURE_BLUE_SIZE} + GL_TEXTURE_ALPHA_SIZE = $805F; + {$EXTERNALSYM GL_TEXTURE_ALPHA_SIZE} + GL_TEXTURE_LUMINANCE_SIZE = $8060; + {$EXTERNALSYM GL_TEXTURE_LUMINANCE_SIZE} + GL_TEXTURE_INTENSITY_SIZE = $8061; + {$EXTERNALSYM GL_TEXTURE_INTENSITY_SIZE} + GL_TEXTURE_PRIORITY = $8066; + {$EXTERNALSYM GL_TEXTURE_PRIORITY} + GL_TEXTURE_RESIDENT = $8067; + {$EXTERNALSYM GL_TEXTURE_RESIDENT} + GL_BGR = $80E0; // v 1.2 + {$EXTERNALSYM GL_BGR} + GL_BGRA = $80E1; // v 1.2 + {$EXTERNALSYM GL_BGRA} + GL_S = $2000; + {$EXTERNALSYM GL_S} + GL_T = $2001; + {$EXTERNALSYM GL_T} + GL_R = $2002; + {$EXTERNALSYM GL_R} + GL_Q = $2003; + {$EXTERNALSYM GL_Q} + GL_MODULATE = $2100; + {$EXTERNALSYM GL_MODULATE} + GL_DECAL = $2101; + {$EXTERNALSYM GL_DECAL} + GL_TEXTURE_ENV_MODE = $2200; + {$EXTERNALSYM GL_TEXTURE_ENV_MODE} + GL_TEXTURE_ENV_COLOR = $2201; + {$EXTERNALSYM GL_TEXTURE_ENV_COLOR} + GL_TEXTURE_ENV = $2300; + {$EXTERNALSYM GL_TEXTURE_ENV} + GL_EYE_LINEAR = $2400; + {$EXTERNALSYM GL_EYE_LINEAR} + GL_OBJECT_LINEAR = $2401; + {$EXTERNALSYM GL_OBJECT_LINEAR} + GL_SPHERE_MAP = $2402; + {$EXTERNALSYM GL_SPHERE_MAP} + GL_TEXTURE_GEN_MODE = $2500; + {$EXTERNALSYM GL_TEXTURE_GEN_MODE} + GL_OBJECT_PLANE = $2501; + {$EXTERNALSYM GL_OBJECT_PLANE} + GL_EYE_PLANE = $2502; + {$EXTERNALSYM GL_EYE_PLANE} + GL_NEAREST = $2600; + {$EXTERNALSYM GL_NEAREST} + GL_LINEAR = $2601; + {$EXTERNALSYM GL_LINEAR} + GL_NEAREST_MIPMAP_NEAREST = $2700; + {$EXTERNALSYM GL_NEAREST_MIPMAP_NEAREST} + GL_LINEAR_MIPMAP_NEAREST = $2701; + {$EXTERNALSYM GL_LINEAR_MIPMAP_NEAREST} + GL_NEAREST_MIPMAP_LINEAR = $2702; + {$EXTERNALSYM GL_NEAREST_MIPMAP_LINEAR} + GL_LINEAR_MIPMAP_LINEAR = $2703; + {$EXTERNALSYM GL_LINEAR_MIPMAP_LINEAR} + GL_TEXTURE_MAG_FILTER = $2800; + {$EXTERNALSYM GL_TEXTURE_MAG_FILTER} + GL_TEXTURE_MIN_FILTER = $2801; + {$EXTERNALSYM GL_TEXTURE_MIN_FILTER} + GL_TEXTURE_WRAP_R = $8072; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_WRAP_R} + GL_TEXTURE_WRAP_S = $2802; + {$EXTERNALSYM GL_TEXTURE_WRAP_S} + GL_TEXTURE_WRAP_T = $2803; + {$EXTERNALSYM GL_TEXTURE_WRAP_T} + GL_CLAMP_TO_EDGE = $812F; // GL 1.2 + {$EXTERNALSYM GL_CLAMP_TO_EDGE} + GL_TEXTURE_MIN_LOD = $813A; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_MIN_LOD} + GL_TEXTURE_MAX_LOD = $813B; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_MAX_LOD} + GL_TEXTURE_BASE_LEVEL = $813C; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_BASE_LEVEL} + GL_TEXTURE_MAX_LEVEL = $813D; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_MAX_LEVEL} + GL_TEXTURE_DEPTH = $8071; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_DEPTH} + GL_PROXY_TEXTURE_1D = $8063; + {$EXTERNALSYM GL_PROXY_TEXTURE_1D} + GL_PROXY_TEXTURE_2D = $8064; + {$EXTERNALSYM GL_PROXY_TEXTURE_2D} + GL_PROXY_TEXTURE_3D = $8070; // GL 1.2 + {$EXTERNALSYM GL_PROXY_TEXTURE_3D} + GL_CLAMP = $2900; + {$EXTERNALSYM GL_CLAMP} + GL_REPEAT = $2901; + {$EXTERNALSYM GL_REPEAT} + + // hints + GL_DONT_CARE = $1100; + {$EXTERNALSYM GL_DONT_CARE} + GL_FASTEST = $1101; + {$EXTERNALSYM GL_FASTEST} + GL_NICEST = $1102; + {$EXTERNALSYM GL_NICEST} + + // data types + GL_BYTE = $1400; + {$EXTERNALSYM GL_BYTE} + GL_UNSIGNED_BYTE = $1401; + {$EXTERNALSYM GL_UNSIGNED_BYTE} + GL_SHORT = $1402; + {$EXTERNALSYM GL_SHORT} + GL_UNSIGNED_SHORT = $1403; + {$EXTERNALSYM GL_UNSIGNED_SHORT} + GL_INT = $1404; + {$EXTERNALSYM GL_INT} + GL_UNSIGNED_INT = $1405; + {$EXTERNALSYM GL_UNSIGNED_INT} + GL_FLOAT = $1406; + {$EXTERNALSYM GL_FLOAT} + GL_2_BYTES = $1407; + {$EXTERNALSYM GL_2_BYTES} + GL_3_BYTES = $1408; + {$EXTERNALSYM GL_3_BYTES} + GL_4_BYTES = $1409; + {$EXTERNALSYM GL_4_BYTES} + GL_DOUBLE = $140A; + {$EXTERNALSYM GL_DOUBLE} + GL_DOUBLE_EXT = $140A; + {$EXTERNALSYM GL_DOUBLE_EXT} + + // logic operations + GL_CLEAR = $1500; + {$EXTERNALSYM GL_CLEAR} + GL_AND = $1501; + {$EXTERNALSYM GL_AND} + GL_AND_REVERSE = $1502; + {$EXTERNALSYM GL_AND_REVERSE} + GL_COPY = $1503; + {$EXTERNALSYM GL_COPY} + GL_AND_INVERTED = $1504; + {$EXTERNALSYM GL_AND_INVERTED} + GL_NOOP = $1505; + {$EXTERNALSYM GL_NOOP} + GL_XOR = $1506; + {$EXTERNALSYM GL_XOR} + GL_OR = $1507; + {$EXTERNALSYM GL_OR} + GL_NOR = $1508; + {$EXTERNALSYM GL_NOR} + GL_EQUIV = $1509; + {$EXTERNALSYM GL_EQUIV} + GL_INVERT = $150A; + {$EXTERNALSYM GL_INVERT} + GL_OR_REVERSE = $150B; + {$EXTERNALSYM GL_OR_REVERSE} + GL_COPY_INVERTED = $150C; + {$EXTERNALSYM GL_COPY_INVERTED} + GL_OR_INVERTED = $150D; + {$EXTERNALSYM GL_OR_INVERTED} + GL_NAND = $150E; + {$EXTERNALSYM GL_NAND} + GL_SET = $150F; + {$EXTERNALSYM GL_SET} + + // PixelCopyType + GL_COLOR = $1800; + {$EXTERNALSYM GL_COLOR} + GL_DEPTH = $1801; + {$EXTERNALSYM GL_DEPTH} + GL_STENCIL = $1802; + {$EXTERNALSYM GL_STENCIL} + + // pixel formats + GL_COLOR_INDEX = $1900; + {$EXTERNALSYM GL_COLOR_INDEX} + GL_STENCIL_INDEX = $1901; + {$EXTERNALSYM GL_STENCIL_INDEX} + GL_DEPTH_COMPONENT = $1902; + {$EXTERNALSYM GL_DEPTH_COMPONENT} + GL_RED = $1903; + {$EXTERNALSYM GL_RED} + GL_GREEN = $1904; + {$EXTERNALSYM GL_GREEN} + GL_BLUE = $1905; + {$EXTERNALSYM GL_BLUE} + GL_ALPHA = $1906; + {$EXTERNALSYM GL_ALPHA} + GL_RGB = $1907; + {$EXTERNALSYM GL_RGB} + GL_RGBA = $1908; + {$EXTERNALSYM GL_RGBA} + GL_LUMINANCE = $1909; + {$EXTERNALSYM GL_LUMINANCE} + GL_LUMINANCE_ALPHA = $190A; + {$EXTERNALSYM GL_LUMINANCE_ALPHA} + + // pixel type + GL_BITMAP = $1A00; + {$EXTERNALSYM GL_BITMAP} + + // rendering modes + GL_RENDER = $1C00; + {$EXTERNALSYM GL_RENDER} + GL_FEEDBACK = $1C01; + {$EXTERNALSYM GL_FEEDBACK} + GL_SELECT = $1C02; + {$EXTERNALSYM GL_SELECT} + + // implementation strings + GL_VENDOR = $1F00; + {$EXTERNALSYM GL_VENDOR} + GL_RENDERER = $1F01; + {$EXTERNALSYM GL_RENDERER} + GL_VERSION = $1F02; + {$EXTERNALSYM GL_VERSION} + GL_EXTENSIONS = $1F03; + {$EXTERNALSYM GL_EXTENSIONS} + + // pixel formats + GL_R3_G3_B2 = $2A10; + {$EXTERNALSYM GL_R3_G3_B2} + GL_ALPHA4 = $803B; + {$EXTERNALSYM GL_ALPHA4} + GL_ALPHA8 = $803C; + {$EXTERNALSYM GL_ALPHA8} + GL_ALPHA12 = $803D; + {$EXTERNALSYM GL_ALPHA12} + GL_ALPHA16 = $803E; + {$EXTERNALSYM GL_ALPHA16} + GL_LUMINANCE4 = $803F; + {$EXTERNALSYM GL_LUMINANCE4} + GL_LUMINANCE8 = $8040; + {$EXTERNALSYM GL_LUMINANCE8} + GL_LUMINANCE12 = $8041; + {$EXTERNALSYM GL_LUMINANCE12} + GL_LUMINANCE16 = $8042; + {$EXTERNALSYM GL_LUMINANCE16} + GL_LUMINANCE4_ALPHA4 = $8043; + {$EXTERNALSYM GL_LUMINANCE4_ALPHA4} + GL_LUMINANCE6_ALPHA2 = $8044; + {$EXTERNALSYM GL_LUMINANCE6_ALPHA2} + GL_LUMINANCE8_ALPHA8 = $8045; + {$EXTERNALSYM GL_LUMINANCE8_ALPHA8} + GL_LUMINANCE12_ALPHA4 = $8046; + {$EXTERNALSYM GL_LUMINANCE12_ALPHA4} + GL_LUMINANCE12_ALPHA12 = $8047; + {$EXTERNALSYM GL_LUMINANCE12_ALPHA12} + GL_LUMINANCE16_ALPHA16 = $8048; + {$EXTERNALSYM GL_LUMINANCE16_ALPHA16} + GL_INTENSITY = $8049; + {$EXTERNALSYM GL_INTENSITY} + GL_INTENSITY4 = $804A; + {$EXTERNALSYM GL_INTENSITY4} + GL_INTENSITY8 = $804B; + {$EXTERNALSYM GL_INTENSITY8} + GL_INTENSITY12 = $804C; + {$EXTERNALSYM GL_INTENSITY12} + GL_INTENSITY16 = $804D; + {$EXTERNALSYM GL_INTENSITY16} + GL_RGB4 = $804F; + {$EXTERNALSYM GL_RGB4} + GL_RGB5 = $8050; + {$EXTERNALSYM GL_RGB5} + GL_RGB8 = $8051; + {$EXTERNALSYM GL_RGB8} + GL_RGB10 = $8052; + {$EXTERNALSYM GL_RGB10} + GL_RGB12 = $8053; + {$EXTERNALSYM GL_RGB12} + GL_RGB16 = $8054; + {$EXTERNALSYM GL_RGB16} + GL_RGBA2 = $8055; + {$EXTERNALSYM GL_RGBA2} + GL_RGBA4 = $8056; + {$EXTERNALSYM GL_RGBA4} + GL_RGB5_A1 = $8057; + {$EXTERNALSYM GL_RGB5_A1} + GL_RGBA8 = $8058; + {$EXTERNALSYM GL_RGBA8} + GL_RGB10_A2 = $8059; + {$EXTERNALSYM GL_RGB10_A2} + GL_RGBA12 = $805A; + {$EXTERNALSYM GL_RGBA12} + GL_RGBA16 = $805B; + {$EXTERNALSYM GL_RGBA16} + UNSIGNED_BYTE_3_3_2 = $8032; // GL 1.2 + {$EXTERNALSYM UNSIGNED_BYTE_3_3_2} + UNSIGNED_BYTE_2_3_3_REV = $8362; // GL 1.2 + {$EXTERNALSYM UNSIGNED_BYTE_2_3_3_REV} + UNSIGNED_SHORT_5_6_5 = $8363; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_5_6_5} + UNSIGNED_SHORT_5_6_5_REV = $8364; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_5_6_5_REV} + UNSIGNED_SHORT_4_4_4_4 = $8033; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_4_4_4_4} + UNSIGNED_SHORT_4_4_4_4_REV = $8365; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_4_4_4_4_REV} + UNSIGNED_SHORT_5_5_5_1 = $8034; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_5_5_5_1} + UNSIGNED_SHORT_1_5_5_5_REV = $8366; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_1_5_5_5_REV} + UNSIGNED_INT_8_8_8_8 = $8035; // GL 1.2 + {$EXTERNALSYM UNSIGNED_INT_8_8_8_8} + UNSIGNED_INT_8_8_8_8_REV = $8367; // GL 1.2 + {$EXTERNALSYM UNSIGNED_INT_8_8_8_8_REV} + UNSIGNED_INT_10_10_10_2 = $8036; // GL 1.2 + {$EXTERNALSYM UNSIGNED_INT_10_10_10_2} + UNSIGNED_INT_2_10_10_10_REV = $8368; // GL 1.2 + {$EXTERNALSYM UNSIGNED_INT_2_10_10_10_REV} + + // interleaved arrays formats + GL_V2F = $2A20; + {$EXTERNALSYM GL_V2F} + GL_V3F = $2A21; + {$EXTERNALSYM GL_V3F} + GL_C4UB_V2F = $2A22; + {$EXTERNALSYM GL_C4UB_V2F} + GL_C4UB_V3F = $2A23; + {$EXTERNALSYM GL_C4UB_V3F} + GL_C3F_V3F = $2A24; + {$EXTERNALSYM GL_C3F_V3F} + GL_N3F_V3F = $2A25; + {$EXTERNALSYM GL_N3F_V3F} + GL_C4F_N3F_V3F = $2A26; + {$EXTERNALSYM GL_C4F_N3F_V3F} + GL_T2F_V3F = $2A27; + {$EXTERNALSYM GL_T2F_V3F} + GL_T4F_V4F = $2A28; + {$EXTERNALSYM GL_T4F_V4F} + GL_T2F_C4UB_V3F = $2A29; + {$EXTERNALSYM GL_T2F_C4UB_V3F} + GL_T2F_C3F_V3F = $2A2A; + {$EXTERNALSYM GL_T2F_C3F_V3F} + GL_T2F_N3F_V3F = $2A2B; + {$EXTERNALSYM GL_T2F_N3F_V3F} + GL_T2F_C4F_N3F_V3F = $2A2C; + {$EXTERNALSYM GL_T2F_C4F_N3F_V3F} + GL_T4F_C4F_N3F_V4F = $2A2D; + {$EXTERNALSYM GL_T4F_C4F_N3F_V4F} + + // clip planes + GL_CLIP_PLANE0 = $3000; + {$EXTERNALSYM GL_CLIP_PLANE0} + GL_CLIP_PLANE1 = $3001; + {$EXTERNALSYM GL_CLIP_PLANE1} + GL_CLIP_PLANE2 = $3002; + {$EXTERNALSYM GL_CLIP_PLANE2} + GL_CLIP_PLANE3 = $3003; + {$EXTERNALSYM GL_CLIP_PLANE3} + GL_CLIP_PLANE4 = $3004; + {$EXTERNALSYM GL_CLIP_PLANE4} + GL_CLIP_PLANE5 = $3005; + {$EXTERNALSYM GL_CLIP_PLANE5} + + // miscellaneous + GL_DITHER = $0BD0; + {$EXTERNALSYM GL_DITHER} + + // ----- extensions enumerants ----- + // EXT_abgr + GL_ABGR_EXT = $8000; + {$EXTERNALSYM GL_ABGR_EXT} + + // EXT_packed_pixels + GL_UNSIGNED_BYTE_3_3_2_EXT = $8032; + {$EXTERNALSYM GL_UNSIGNED_BYTE_3_3_2_EXT} + GL_UNSIGNED_SHORT_4_4_4_4_EXT = $8033; + {$EXTERNALSYM GL_UNSIGNED_SHORT_4_4_4_4_EXT} + GL_UNSIGNED_SHORT_5_5_5_1_EXT = $8034; + {$EXTERNALSYM GL_UNSIGNED_SHORT_5_5_5_1_EXT} + GL_UNSIGNED_INT_8_8_8_8_EXT = $8035; + {$EXTERNALSYM GL_UNSIGNED_INT_8_8_8_8_EXT} + GL_UNSIGNED_INT_10_10_10_2_EXT = $8036; + {$EXTERNALSYM GL_UNSIGNED_INT_10_10_10_2_EXT} + + // EXT_vertex_array + GL_VERTEX_ARRAY_EXT = $8074; + {$EXTERNALSYM GL_VERTEX_ARRAY_EXT} + GL_NORMAL_ARRAY_EXT = $8075; + {$EXTERNALSYM GL_NORMAL_ARRAY_EXT} + GL_COLOR_ARRAY_EXT = $8076; + {$EXTERNALSYM GL_COLOR_ARRAY_EXT} + GL_INDEX_ARRAY_EXT = $8077; + {$EXTERNALSYM GL_INDEX_ARRAY_EXT} + GL_TEXTURE_COORD_ARRAY_EXT = $8078; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_EXT} + GL_EDGE_FLAG_ARRAY_EXT = $8079; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_EXT} + GL_VERTEX_ARRAY_SIZE_EXT = $807A; + {$EXTERNALSYM GL_VERTEX_ARRAY_SIZE_EXT} + GL_VERTEX_ARRAY_TYPE_EXT = $807B; + {$EXTERNALSYM GL_VERTEX_ARRAY_TYPE_EXT} + GL_VERTEX_ARRAY_STRIDE_EXT = $807C; + {$EXTERNALSYM GL_VERTEX_ARRAY_STRIDE_EXT} + GL_VERTEX_ARRAY_COUNT_EXT = $807D; + {$EXTERNALSYM GL_VERTEX_ARRAY_COUNT_EXT} + GL_NORMAL_ARRAY_TYPE_EXT = $807E; + {$EXTERNALSYM GL_NORMAL_ARRAY_TYPE_EXT} + GL_NORMAL_ARRAY_STRIDE_EXT = $807F; + {$EXTERNALSYM GL_NORMAL_ARRAY_STRIDE_EXT} + GL_NORMAL_ARRAY_COUNT_EXT = $8080; + {$EXTERNALSYM GL_NORMAL_ARRAY_COUNT_EXT} + GL_COLOR_ARRAY_SIZE_EXT = $8081; + {$EXTERNALSYM GL_COLOR_ARRAY_SIZE_EXT} + GL_COLOR_ARRAY_TYPE_EXT = $8082; + {$EXTERNALSYM GL_COLOR_ARRAY_TYPE_EXT} + GL_COLOR_ARRAY_STRIDE_EXT = $8083; + {$EXTERNALSYM GL_COLOR_ARRAY_STRIDE_EXT} + GL_COLOR_ARRAY_COUNT_EXT = $8084; + {$EXTERNALSYM GL_COLOR_ARRAY_COUNT_EXT} + GL_INDEX_ARRAY_TYPE_EXT = $8085; + {$EXTERNALSYM GL_INDEX_ARRAY_TYPE_EXT} + GL_INDEX_ARRAY_STRIDE_EXT = $8086; + {$EXTERNALSYM GL_INDEX_ARRAY_STRIDE_EXT} + GL_INDEX_ARRAY_COUNT_EXT = $8087; + {$EXTERNALSYM GL_INDEX_ARRAY_COUNT_EXT} + GL_TEXTURE_COORD_ARRAY_SIZE_EXT = $8088; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_SIZE_EXT} + GL_TEXTURE_COORD_ARRAY_TYPE_EXT = $8089; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_TYPE_EXT} + GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = $808A; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_STRIDE_EXT} + GL_TEXTURE_COORD_ARRAY_COUNT_EXT = $808B; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_COUNT_EXT} + GL_EDGE_FLAG_ARRAY_STRIDE_EXT = $808C; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_STRIDE_EXT} + GL_EDGE_FLAG_ARRAY_COUNT_EXT = $808D; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_COUNT_EXT} + GL_VERTEX_ARRAY_POINTER_EXT = $808E; + {$EXTERNALSYM GL_VERTEX_ARRAY_POINTER_EXT} + GL_NORMAL_ARRAY_POINTER_EXT = $808F; + {$EXTERNALSYM GL_NORMAL_ARRAY_POINTER_EXT} + GL_COLOR_ARRAY_POINTER_EXT = $8090; + {$EXTERNALSYM GL_COLOR_ARRAY_POINTER_EXT} + GL_INDEX_ARRAY_POINTER_EXT = $8091; + {$EXTERNALSYM GL_INDEX_ARRAY_POINTER_EXT} + GL_TEXTURE_COORD_ARRAY_POINTER_EXT = $8092; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_POINTER_EXT} + GL_EDGE_FLAG_ARRAY_POINTER_EXT = $8093; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_POINTER_EXT} + + // EXT_color_table + GL_TABLE_TOO_LARGE_EXT = $8031; + {$EXTERNALSYM GL_TABLE_TOO_LARGE_EXT} + GL_COLOR_TABLE_EXT = $80D0; + {$EXTERNALSYM GL_COLOR_TABLE_EXT} + GL_POST_CONVOLUTION_COLOR_TABLE_EXT = $80D1; + {$EXTERNALSYM GL_POST_CONVOLUTION_COLOR_TABLE_EXT} + GL_POST_COLOR_MATRIX_COLOR_TABLE_EXT = $80D2; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_COLOR_TABLE_EXT} + GL_PROXY_COLOR_TABLE_EXT = $80D3; + {$EXTERNALSYM GL_PROXY_COLOR_TABLE_EXT} + GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_EXT = $80D4; + {$EXTERNALSYM GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_EXT} + GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_EXT = $80D5; + {$EXTERNALSYM GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_EXT} + GL_COLOR_TABLE_SCALE_EXT = $80D6; + {$EXTERNALSYM GL_COLOR_TABLE_SCALE_EXT} + GL_COLOR_TABLE_BIAS_EXT = $80D7; + {$EXTERNALSYM GL_COLOR_TABLE_BIAS_EXT} + GL_COLOR_TABLE_FORMAT_EXT = $80D8; + {$EXTERNALSYM GL_COLOR_TABLE_FORMAT_EXT} + GL_COLOR_TABLE_WIDTH_EXT = $80D9; + {$EXTERNALSYM GL_COLOR_TABLE_WIDTH_EXT} + GL_COLOR_TABLE_RED_SIZE_EXT = $80DA; + {$EXTERNALSYM GL_COLOR_TABLE_RED_SIZE_EXT} + GL_COLOR_TABLE_GREEN_SIZE_EXT = $80DB; + {$EXTERNALSYM GL_COLOR_TABLE_GREEN_SIZE_EXT} + GL_COLOR_TABLE_BLUE_SIZE_EXT = $80DC; + {$EXTERNALSYM GL_COLOR_TABLE_BLUE_SIZE_EXT} + GL_COLOR_TABLE_ALPHA_SIZE_EXT = $80DD; + {$EXTERNALSYM GL_COLOR_TABLE_ALPHA_SIZE_EXT} + GL_COLOR_TABLE_LUMINANCE_SIZE_EXT = $80DE; + {$EXTERNALSYM GL_COLOR_TABLE_LUMINANCE_SIZE_EXT} + GL_COLOR_TABLE_INTENSITY_SIZE_EXT = $80DF; + {$EXTERNALSYM GL_COLOR_TABLE_INTENSITY_SIZE_EXT} + + // EXT_bgra + GL_BGR_EXT = $80E0; + {$EXTERNALSYM GL_BGR_EXT} + GL_BGRA_EXT = $80E1; + {$EXTERNALSYM GL_BGRA_EXT} + + // EXT_paletted_texture + GL_COLOR_INDEX1_EXT = $80E2; + {$EXTERNALSYM GL_COLOR_INDEX1_EXT} + GL_COLOR_INDEX2_EXT = $80E3; + {$EXTERNALSYM GL_COLOR_INDEX2_EXT} + GL_COLOR_INDEX4_EXT = $80E4; + {$EXTERNALSYM GL_COLOR_INDEX4_EXT} + GL_COLOR_INDEX8_EXT = $80E5; + {$EXTERNALSYM GL_COLOR_INDEX8_EXT} + GL_COLOR_INDEX12_EXT = $80E6; + {$EXTERNALSYM GL_COLOR_INDEX12_EXT} + GL_COLOR_INDEX16_EXT = $80E7; + {$EXTERNALSYM GL_COLOR_INDEX16_EXT} + + // EXT_blend_color + GL_CONSTANT_COLOR_EXT = $8001; + {$EXTERNALSYM GL_CONSTANT_COLOR_EXT} + GL_ONE_MINUS_CONSTANT_COLOR_EXT = $8002; + {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_COLOR_EXT} + GL_CONSTANT_ALPHA_EXT = $8003; + {$EXTERNALSYM GL_CONSTANT_ALPHA_EXT} + GL_ONE_MINUS_CONSTANT_ALPHA_EXT = $8004; + {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_ALPHA_EXT} + GL_BLEND_COLOR_EXT = $8005; + {$EXTERNALSYM GL_BLEND_COLOR_EXT} + + // EXT_blend_minmax + GL_FUNC_ADD_EXT = $8006; + {$EXTERNALSYM GL_FUNC_ADD_EXT} + GL_MIN_EXT = $8007; + {$EXTERNALSYM GL_MIN_EXT} + GL_MAX_EXT = $8008; + {$EXTERNALSYM GL_MAX_EXT} + GL_BLEND_EQUATION_EXT = $8009; + {$EXTERNALSYM GL_BLEND_EQUATION_EXT} + + // EXT_blend_subtract + GL_FUNC_SUBTRACT_EXT = $800A; + {$EXTERNALSYM GL_FUNC_SUBTRACT_EXT} + GL_FUNC_REVERSE_SUBTRACT_EXT = $800B; + {$EXTERNALSYM GL_FUNC_REVERSE_SUBTRACT_EXT} + + // EXT_convolution + GL_CONVOLUTION_1D_EXT = $8010; + {$EXTERNALSYM GL_CONVOLUTION_1D_EXT} + GL_CONVOLUTION_2D_EXT = $8011; + {$EXTERNALSYM GL_CONVOLUTION_2D_EXT} + GL_SEPARABLE_2D_EXT = $8012; + {$EXTERNALSYM GL_SEPARABLE_2D_EXT} + GL_CONVOLUTION_BORDER_MODE_EXT = $8013; + {$EXTERNALSYM GL_CONVOLUTION_BORDER_MODE_EXT} + GL_CONVOLUTION_FILTER_SCALE_EXT = $8014; + {$EXTERNALSYM GL_CONVOLUTION_FILTER_SCALE_EXT} + GL_CONVOLUTION_FILTER_BIAS_EXT = $8015; + {$EXTERNALSYM GL_CONVOLUTION_FILTER_BIAS_EXT} + GL_REDUCE_EXT = $8016; + {$EXTERNALSYM GL_REDUCE_EXT} + GL_CONVOLUTION_FORMAT_EXT = $8017; + {$EXTERNALSYM GL_CONVOLUTION_FORMAT_EXT} + GL_CONVOLUTION_WIDTH_EXT = $8018; + {$EXTERNALSYM GL_CONVOLUTION_WIDTH_EXT} + GL_CONVOLUTION_HEIGHT_EXT = $8019; + {$EXTERNALSYM GL_CONVOLUTION_HEIGHT_EXT} + GL_MAX_CONVOLUTION_WIDTH_EXT = $801A; + {$EXTERNALSYM GL_MAX_CONVOLUTION_WIDTH_EXT} + GL_MAX_CONVOLUTION_HEIGHT_EXT = $801B; + {$EXTERNALSYM GL_MAX_CONVOLUTION_HEIGHT_EXT} + GL_POST_CONVOLUTION_RED_SCALE_EXT = $801C; + {$EXTERNALSYM GL_POST_CONVOLUTION_RED_SCALE_EXT} + GL_POST_CONVOLUTION_GREEN_SCALE_EXT = $801D; + {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_SCALE_EXT} + GL_POST_CONVOLUTION_BLUE_SCALE_EXT = $801E; + {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_SCALE_EXT} + GL_POST_CONVOLUTION_ALPHA_SCALE_EXT = $801F; + {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_SCALE_EXT} + GL_POST_CONVOLUTION_RED_BIAS_EXT = $8020; + {$EXTERNALSYM GL_POST_CONVOLUTION_RED_BIAS_EXT} + GL_POST_CONVOLUTION_GREEN_BIAS_EXT = $8021; + {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_BIAS_EXT} + GL_POST_CONVOLUTION_BLUE_BIAS_EXT = $8022; + {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_BIAS_EXT} + GL_POST_CONVOLUTION_ALPHA_BIAS_EXT = $8023; + {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_BIAS_EXT} + + // EXT_histogram + GL_HISTOGRAM_EXT = $8024; + {$EXTERNALSYM GL_HISTOGRAM_EXT} + GL_PROXY_HISTOGRAM_EXT = $8025; + {$EXTERNALSYM GL_PROXY_HISTOGRAM_EXT} + GL_HISTOGRAM_WIDTH_EXT = $8026; + {$EXTERNALSYM GL_HISTOGRAM_WIDTH_EXT} + GL_HISTOGRAM_FORMAT_EXT = $8027; + {$EXTERNALSYM GL_HISTOGRAM_FORMAT_EXT} + GL_HISTOGRAM_RED_SIZE_EXT = $8028; + {$EXTERNALSYM GL_HISTOGRAM_RED_SIZE_EXT} + GL_HISTOGRAM_GREEN_SIZE_EXT = $8029; + {$EXTERNALSYM GL_HISTOGRAM_GREEN_SIZE_EXT} + GL_HISTOGRAM_BLUE_SIZE_EXT = $802A; + {$EXTERNALSYM GL_HISTOGRAM_BLUE_SIZE_EXT} + GL_HISTOGRAM_ALPHA_SIZE_EXT = $802B; + {$EXTERNALSYM GL_HISTOGRAM_ALPHA_SIZE_EXT} + GL_HISTOGRAM_LUMINANCE_SIZE_EXT = $802C; + {$EXTERNALSYM GL_HISTOGRAM_LUMINANCE_SIZE_EXT} + GL_HISTOGRAM_SINK_EXT = $802D; + {$EXTERNALSYM GL_HISTOGRAM_SINK_EXT} + GL_MINMAX_EXT = $802E; + {$EXTERNALSYM GL_MINMAX_EXT} + GL_MINMAX_FORMAT_EXT = $802F; + {$EXTERNALSYM GL_MINMAX_FORMAT_EXT} + GL_MINMAX_SINK_EXT = $8030; + {$EXTERNALSYM GL_MINMAX_SINK_EXT} + + // EXT_polygon_offset + GL_POLYGON_OFFSET_EXT = $8037; + {$EXTERNALSYM GL_POLYGON_OFFSET_EXT} + GL_POLYGON_OFFSET_FACTOR_EXT = $8038; + {$EXTERNALSYM GL_POLYGON_OFFSET_FACTOR_EXT} + GL_POLYGON_OFFSET_BIAS_EXT = $8039; + {$EXTERNALSYM GL_POLYGON_OFFSET_BIAS_EXT} + + // EXT_texture + GL_ALPHA4_EXT = $803B; + {$EXTERNALSYM GL_ALPHA4_EXT} + GL_ALPHA8_EXT = $803C; + {$EXTERNALSYM GL_ALPHA8_EXT} + GL_ALPHA12_EXT = $803D; + {$EXTERNALSYM GL_ALPHA12_EXT} + GL_ALPHA16_EXT = $803E; + {$EXTERNALSYM GL_ALPHA16_EXT} + GL_LUMINANCE4_EXT = $803F; + {$EXTERNALSYM GL_LUMINANCE4_EXT} + GL_LUMINANCE8_EXT = $8040; + {$EXTERNALSYM GL_LUMINANCE8_EXT} + GL_LUMINANCE12_EXT = $8041; + {$EXTERNALSYM GL_LUMINANCE12_EXT} + GL_LUMINANCE16_EXT = $8042; + {$EXTERNALSYM GL_LUMINANCE16_EXT} + GL_LUMINANCE4_ALPHA4_EXT = $8043; + {$EXTERNALSYM GL_LUMINANCE4_ALPHA4_EXT} + GL_LUMINANCE6_ALPHA2_EXT = $8044; + {$EXTERNALSYM GL_LUMINANCE6_ALPHA2_EXT} + GL_LUMINANCE8_ALPHA8_EXT = $8045; + {$EXTERNALSYM GL_LUMINANCE8_ALPHA8_EXT} + GL_LUMINANCE12_ALPHA4_EXT = $8046; + {$EXTERNALSYM GL_LUMINANCE12_ALPHA4_EXT} + GL_LUMINANCE12_ALPHA12_EXT = $8047; + {$EXTERNALSYM GL_LUMINANCE12_ALPHA12_EXT} + GL_LUMINANCE16_ALPHA16_EXT = $8048; + {$EXTERNALSYM GL_LUMINANCE16_ALPHA16_EXT} + GL_INTENSITY_EXT = $8049; + {$EXTERNALSYM GL_INTENSITY_EXT} + GL_INTENSITY4_EXT = $804A; + {$EXTERNALSYM GL_INTENSITY4_EXT} + GL_INTENSITY8_EXT = $804B; + {$EXTERNALSYM GL_INTENSITY8_EXT} + GL_INTENSITY12_EXT = $804C; + {$EXTERNALSYM GL_INTENSITY12_EXT} + GL_INTENSITY16_EXT = $804D; + {$EXTERNALSYM GL_INTENSITY16_EXT} + GL_RGB2_EXT = $804E; + {$EXTERNALSYM GL_RGB2_EXT} + GL_RGB4_EXT = $804F; + {$EXTERNALSYM GL_RGB4_EXT} + GL_RGB5_EXT = $8050; + {$EXTERNALSYM GL_RGB5_EXT} + GL_RGB8_EXT = $8051; + {$EXTERNALSYM GL_RGB8_EXT} + GL_RGB10_EXT = $8052; + {$EXTERNALSYM GL_RGB10_EXT} + GL_RGB12_EXT = $8053; + {$EXTERNALSYM GL_RGB12_EXT} + GL_RGB16_EXT = $8054; + {$EXTERNALSYM GL_RGB16_EXT} + GL_RGBA2_EXT = $8055; + {$EXTERNALSYM GL_RGBA2_EXT} + GL_RGBA4_EXT = $8056; + {$EXTERNALSYM GL_RGBA4_EXT} + GL_RGB5_A1_EXT = $8057; + {$EXTERNALSYM GL_RGB5_A1_EXT} + GL_RGBA8_EXT = $8058; + {$EXTERNALSYM GL_RGBA8_EXT} + GL_RGB10_A2_EXT = $8059; + {$EXTERNALSYM GL_RGB10_A2_EXT} + GL_RGBA12_EXT = $805A; + {$EXTERNALSYM GL_RGBA12_EXT} + GL_RGBA16_EXT = $805B; + {$EXTERNALSYM GL_RGBA16_EXT} + GL_TEXTURE_RED_SIZE_EXT = $805C; + {$EXTERNALSYM GL_TEXTURE_RED_SIZE_EXT} + GL_TEXTURE_GREEN_SIZE_EXT = $805D; + {$EXTERNALSYM GL_TEXTURE_GREEN_SIZE_EXT} + GL_TEXTURE_BLUE_SIZE_EXT = $805E; + {$EXTERNALSYM GL_TEXTURE_BLUE_SIZE_EXT} + GL_TEXTURE_ALPHA_SIZE_EXT = $805F; + {$EXTERNALSYM GL_TEXTURE_ALPHA_SIZE_EXT} + GL_TEXTURE_LUMINANCE_SIZE_EXT = $8060; + {$EXTERNALSYM GL_TEXTURE_LUMINANCE_SIZE_EXT} + GL_TEXTURE_INTENSITY_SIZE_EXT = $8061; + {$EXTERNALSYM GL_TEXTURE_INTENSITY_SIZE_EXT} + GL_REPLACE_EXT = $8062; + {$EXTERNALSYM GL_REPLACE_EXT} + GL_PROXY_TEXTURE_1D_EXT = $8063; + {$EXTERNALSYM GL_PROXY_TEXTURE_1D_EXT} + GL_PROXY_TEXTURE_2D_EXT = $8064; + {$EXTERNALSYM GL_PROXY_TEXTURE_2D_EXT} + GL_TEXTURE_TOO_LARGE_EXT = $8065; + {$EXTERNALSYM GL_TEXTURE_TOO_LARGE_EXT} + + // EXT_texture_object + GL_TEXTURE_PRIORITY_EXT = $8066; + {$EXTERNALSYM GL_TEXTURE_PRIORITY_EXT} + GL_TEXTURE_RESIDENT_EXT = $8067; + {$EXTERNALSYM GL_TEXTURE_RESIDENT_EXT} + GL_TEXTURE_1D_BINDING_EXT = $8068; + {$EXTERNALSYM GL_TEXTURE_1D_BINDING_EXT} + GL_TEXTURE_2D_BINDING_EXT = $8069; + {$EXTERNALSYM GL_TEXTURE_2D_BINDING_EXT} + GL_TEXTURE_3D_BINDING_EXT = $806A; + {$EXTERNALSYM GL_TEXTURE_3D_BINDING_EXT} + + // EXT_texture3D + GL_PACK_SKIP_IMAGES_EXT = $806B; + {$EXTERNALSYM GL_PACK_SKIP_IMAGES_EXT} + GL_PACK_IMAGE_HEIGHT_EXT = $806C; + {$EXTERNALSYM GL_PACK_IMAGE_HEIGHT_EXT} + GL_UNPACK_SKIP_IMAGES_EXT = $806D; + {$EXTERNALSYM GL_UNPACK_SKIP_IMAGES_EXT} + GL_UNPACK_IMAGE_HEIGHT_EXT = $806E; + {$EXTERNALSYM GL_UNPACK_IMAGE_HEIGHT_EXT} + GL_TEXTURE_3D_EXT = $806F; + {$EXTERNALSYM GL_TEXTURE_3D_EXT} + GL_PROXY_TEXTURE_3D_EXT = $8070; + {$EXTERNALSYM GL_PROXY_TEXTURE_3D_EXT} + GL_TEXTURE_DEPTH_EXT = $8071; + {$EXTERNALSYM GL_TEXTURE_DEPTH_EXT} + GL_TEXTURE_WRAP_R_EXT = $8072; + {$EXTERNALSYM GL_TEXTURE_WRAP_R_EXT} + GL_MAX_3D_TEXTURE_SIZE_EXT = $8073; + {$EXTERNALSYM GL_MAX_3D_TEXTURE_SIZE_EXT} + + // SGI_color_matrix + GL_COLOR_MATRIX_SGI = $80B1; + {$EXTERNALSYM GL_COLOR_MATRIX_SGI} + GL_COLOR_MATRIX_STACK_DEPTH_SGI = $80B2; + {$EXTERNALSYM GL_COLOR_MATRIX_STACK_DEPTH_SGI} + GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI = $80B3; + {$EXTERNALSYM GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI} + GL_POST_COLOR_MATRIX_RED_SCALE_SGI = $80B4; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_SCALE_SGI} + GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI = $80B5; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI} + GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI = $80B6; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI} + GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI = $80B7; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI} + GL_POST_COLOR_MATRIX_RED_BIAS_SGI = $80B8; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_BIAS_SGI} + GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI = $80B9; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI} + GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI = $80BA; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI} + GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI = $80BB; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI} + + // SGI_texture_color_table + GL_TEXTURE_COLOR_TABLE_SGI = $80BC; + {$EXTERNALSYM GL_TEXTURE_COLOR_TABLE_SGI} + GL_PROXY_TEXTURE_COLOR_TABLE_SGI = $80BD; + {$EXTERNALSYM GL_PROXY_TEXTURE_COLOR_TABLE_SGI} + GL_TEXTURE_COLOR_TABLE_BIAS_SGI = $80BE; + {$EXTERNALSYM GL_TEXTURE_COLOR_TABLE_BIAS_SGI} + GL_TEXTURE_COLOR_TABLE_SCALE_SGI = $80BF; + {$EXTERNALSYM GL_TEXTURE_COLOR_TABLE_SCALE_SGI} + + // SGI_color_table + GL_COLOR_TABLE_SGI = $80D0; + {$EXTERNALSYM GL_COLOR_TABLE_SGI} + GL_POST_CONVOLUTION_COLOR_TABLE_SGI = $80D1; + {$EXTERNALSYM GL_POST_CONVOLUTION_COLOR_TABLE_SGI} + GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI = $80D2; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI} + GL_PROXY_COLOR_TABLE_SGI = $80D3; + {$EXTERNALSYM GL_PROXY_COLOR_TABLE_SGI} + GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI = $80D4; + {$EXTERNALSYM GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI} + GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI = $80D5; + {$EXTERNALSYM GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI} + GL_COLOR_TABLE_SCALE_SGI = $80D6; + {$EXTERNALSYM GL_COLOR_TABLE_SCALE_SGI} + GL_COLOR_TABLE_BIAS_SGI = $80D7; + {$EXTERNALSYM GL_COLOR_TABLE_BIAS_SGI} + GL_COLOR_TABLE_FORMAT_SGI = $80D8; + {$EXTERNALSYM GL_COLOR_TABLE_FORMAT_SGI} + GL_COLOR_TABLE_WIDTH_SGI = $80D9; + {$EXTERNALSYM GL_COLOR_TABLE_WIDTH_SGI} + GL_COLOR_TABLE_RED_SIZE_SGI = $80DA; + {$EXTERNALSYM GL_COLOR_TABLE_RED_SIZE_SGI} + GL_COLOR_TABLE_GREEN_SIZE_SGI = $80DB; + {$EXTERNALSYM GL_COLOR_TABLE_GREEN_SIZE_SGI} + GL_COLOR_TABLE_BLUE_SIZE_SGI = $80DC; + {$EXTERNALSYM GL_COLOR_TABLE_BLUE_SIZE_SGI} + GL_COLOR_TABLE_ALPHA_SIZE_SGI = $80DD; + {$EXTERNALSYM GL_COLOR_TABLE_ALPHA_SIZE_SGI} + GL_COLOR_TABLE_LUMINANCE_SIZE_SGI = $80DE; + {$EXTERNALSYM GL_COLOR_TABLE_LUMINANCE_SIZE_SGI} + GL_COLOR_TABLE_INTENSITY_SIZE_SGI = $80DF; + {$EXTERNALSYM GL_COLOR_TABLE_INTENSITY_SIZE_SGI} + + // EXT_cmyka + GL_CMYK_EXT = $800C; + {$EXTERNALSYM GL_CMYK_EXT} + GL_CMYKA_EXT = $800D; + {$EXTERNALSYM GL_CMYKA_EXT} + GL_PACK_CMYK_HINT_EXT = $800E; + {$EXTERNALSYM GL_PACK_CMYK_HINT_EXT} + GL_UNPACK_CMYK_HINT_EXT = $800F; + {$EXTERNALSYM GL_UNPACK_CMYK_HINT_EXT} + + // EXT_rescale_normal + GL_RESCALE_NORMAL_EXT = $803A; + {$EXTERNALSYM GL_RESCALE_NORMAL_EXT} + + // EXT_clip_volume_hint + GL_CLIP_VOLUME_CLIPPING_HINT_EXT = $80F0; + {$EXTERNALSYM GL_CLIP_VOLUME_CLIPPING_HINT_EXT} + + // EXT_cull_vertex + GL_CULL_VERTEX_EXT = $81AA; + {$EXTERNALSYM GL_CULL_VERTEX_EXT} + GL_CULL_VERTEX_EYE_POSITION_EXT = $81AB; + {$EXTERNALSYM GL_CULL_VERTEX_EYE_POSITION_EXT} + GL_CULL_VERTEX_OBJECT_POSITION_EXT = $81AC; + {$EXTERNALSYM GL_CULL_VERTEX_OBJECT_POSITION_EXT} + + // EXT_index_array_formats + GL_IUI_V2F_EXT = $81AD; + {$EXTERNALSYM GL_IUI_V2F_EXT} + GL_IUI_V3F_EXT = $81AE; + {$EXTERNALSYM GL_IUI_V3F_EXT} + GL_IUI_N3F_V2F_EXT = $81AF; + {$EXTERNALSYM GL_IUI_N3F_V2F_EXT} + GL_IUI_N3F_V3F_EXT = $81B0; + {$EXTERNALSYM GL_IUI_N3F_V3F_EXT} + GL_T2F_IUI_V2F_EXT = $81B1; + {$EXTERNALSYM GL_T2F_IUI_V2F_EXT} + GL_T2F_IUI_V3F_EXT = $81B2; + {$EXTERNALSYM GL_T2F_IUI_V3F_EXT} + GL_T2F_IUI_N3F_V2F_EXT = $81B3; + {$EXTERNALSYM GL_T2F_IUI_N3F_V2F_EXT} + GL_T2F_IUI_N3F_V3F_EXT = $81B4; + {$EXTERNALSYM GL_T2F_IUI_N3F_V3F_EXT} + + // EXT_index_func + GL_INDEX_TEST_EXT = $81B5; + {$EXTERNALSYM GL_INDEX_TEST_EXT} + GL_INDEX_TEST_FUNC_EXT = $81B6; + {$EXTERNALSYM GL_INDEX_TEST_FUNC_EXT} + GL_INDEX_TEST_REF_EXT = $81B7; + {$EXTERNALSYM GL_INDEX_TEST_REF_EXT} + + // EXT_index_material + GL_INDEX_MATERIAL_EXT = $81B8; + {$EXTERNALSYM GL_INDEX_MATERIAL_EXT} + GL_INDEX_MATERIAL_PARAMETER_EXT = $81B9; + {$EXTERNALSYM GL_INDEX_MATERIAL_PARAMETER_EXT} + GL_INDEX_MATERIAL_FACE_EXT = $81BA; + {$EXTERNALSYM GL_INDEX_MATERIAL_FACE_EXT} + + // EXT_misc_attribute + GL_MISC_BIT_EXT = 0; // not yet defined + {$EXTERNALSYM GL_MISC_BIT_EXT} + + // EXT_scene_marker + GL_SCENE_REQUIRED_EXT = 0; // not yet defined + {$EXTERNALSYM GL_SCENE_REQUIRED_EXT} + + // EXT_shared_texture_palette + GL_SHARED_TEXTURE_PALETTE_EXT = $81FB; + {$EXTERNALSYM GL_SHARED_TEXTURE_PALETTE_EXT} + + // EXT_nurbs_tessellator + GLU_NURBS_MODE_EXT = 100160; + {$EXTERNALSYM GLU_NURBS_MODE_EXT} + GLU_NURBS_TESSELLATOR_EXT = 100161; + {$EXTERNALSYM GLU_NURBS_TESSELLATOR_EXT} + GLU_NURBS_RENDERER_EXT = 100162; + {$EXTERNALSYM GLU_NURBS_RENDERER_EXT} + GLU_NURBS_BEGIN_EXT = 100164; + {$EXTERNALSYM GLU_NURBS_BEGIN_EXT} + GLU_NURBS_VERTEX_EXT = 100165; + {$EXTERNALSYM GLU_NURBS_VERTEX_EXT} + GLU_NURBS_NORMAL_EXT = 100166; + {$EXTERNALSYM GLU_NURBS_NORMAL_EXT} + GLU_NURBS_COLOR_EXT = 100167; + {$EXTERNALSYM GLU_NURBS_COLOR_EXT} + GLU_NURBS_TEX_COORD_EXT = 100168; + {$EXTERNALSYM GLU_NURBS_TEX_COORD_EXT} + GLU_NURBS_END_EXT = 100169; + {$EXTERNALSYM GLU_NURBS_END_EXT} + GLU_NURBS_BEGIN_DATA_EXT = 100170; + {$EXTERNALSYM GLU_NURBS_BEGIN_DATA_EXT} + GLU_NURBS_VERTEX_DATA_EXT = 100171; + {$EXTERNALSYM GLU_NURBS_VERTEX_DATA_EXT} + GLU_NURBS_NORMAL_DATA_EXT = 100172; + {$EXTERNALSYM GLU_NURBS_NORMAL_DATA_EXT} + GLU_NURBS_COLOR_DATA_EXT = 100173; + {$EXTERNALSYM GLU_NURBS_COLOR_DATA_EXT} + GLU_NURBS_TEX_COORD_DATA_EXT = 100174; + {$EXTERNALSYM GLU_NURBS_TEX_COORD_DATA_EXT} + GLU_NURBS_END_DATA_EXT = 100175; + {$EXTERNALSYM GLU_NURBS_END_DATA_EXT} + + // EXT_object_space_tess + GLU_OBJECT_PARAMETRIC_ERROR_EXT = 100208; + {$EXTERNALSYM GLU_OBJECT_PARAMETRIC_ERROR_EXT} + GLU_OBJECT_PATH_LENGTH_EXT = 100209; + {$EXTERNALSYM GLU_OBJECT_PATH_LENGTH_EXT} + + // EXT_point_parameters + GL_POINT_SIZE_MIN_EXT = $8126; + {$EXTERNALSYM GL_POINT_SIZE_MIN_EXT} + GL_POINT_SIZE_MAX_EXT = $8127; + {$EXTERNALSYM GL_POINT_SIZE_MAX_EXT} + GL_POINT_FADE_THRESHOLD_SIZE_EXT = $8128; + {$EXTERNALSYM GL_POINT_FADE_THRESHOLD_SIZE_EXT} + GL_DISTANCE_ATTENUATION_EXT = $8129; + {$EXTERNALSYM GL_DISTANCE_ATTENUATION_EXT} + + // EXT_compiled_vertex_array + GL_ARRAY_ELEMENT_LOCK_FIRST_EXT = $81A8; + {$EXTERNALSYM GL_ARRAY_ELEMENT_LOCK_FIRST_EXT} + GL_ARRAY_ELEMENT_LOCK_COUNT_EXT = $81A9; + {$EXTERNALSYM GL_ARRAY_ELEMENT_LOCK_COUNT_EXT} + + // ARB_multitexture + GL_ACTIVE_TEXTURE_ARB = $84E0; + {$EXTERNALSYM GL_ACTIVE_TEXTURE_ARB} + GL_CLIENT_ACTIVE_TEXTURE_ARB = $84E1; + {$EXTERNALSYM GL_CLIENT_ACTIVE_TEXTURE_ARB} + GL_MAX_TEXTURE_UNITS_ARB = $84E2; + {$EXTERNALSYM GL_MAX_TEXTURE_UNITS_ARB} + GL_TEXTURE0_ARB = $84C0; + {$EXTERNALSYM GL_TEXTURE0_ARB} + GL_TEXTURE1_ARB = $84C1; + {$EXTERNALSYM GL_TEXTURE1_ARB} + GL_TEXTURE2_ARB = $84C2; + {$EXTERNALSYM GL_TEXTURE2_ARB} + GL_TEXTURE3_ARB = $84C3; + {$EXTERNALSYM GL_TEXTURE3_ARB} + GL_TEXTURE4_ARB = $84C4; + {$EXTERNALSYM GL_TEXTURE4_ARB} + GL_TEXTURE5_ARB = $84C5; + {$EXTERNALSYM GL_TEXTURE5_ARB} + GL_TEXTURE6_ARB = $84C6; + {$EXTERNALSYM GL_TEXTURE6_ARB} + GL_TEXTURE7_ARB = $84C7; + {$EXTERNALSYM GL_TEXTURE7_ARB} + GL_TEXTURE8_ARB = $84C8; + {$EXTERNALSYM GL_TEXTURE8_ARB} + GL_TEXTURE9_ARB = $84C9; + {$EXTERNALSYM GL_TEXTURE9_ARB} + GL_TEXTURE10_ARB = $84CA; + {$EXTERNALSYM GL_TEXTURE10_ARB} + GL_TEXTURE11_ARB = $84CB; + {$EXTERNALSYM GL_TEXTURE11_ARB} + GL_TEXTURE12_ARB = $84CC; + {$EXTERNALSYM GL_TEXTURE12_ARB} + GL_TEXTURE13_ARB = $84CD; + {$EXTERNALSYM GL_TEXTURE13_ARB} + GL_TEXTURE14_ARB = $84CE; + {$EXTERNALSYM GL_TEXTURE14_ARB} + GL_TEXTURE15_ARB = $84CF; + {$EXTERNALSYM GL_TEXTURE15_ARB} + GL_TEXTURE16_ARB = $84D0; + {$EXTERNALSYM GL_TEXTURE16_ARB} + GL_TEXTURE17_ARB = $84D1; + {$EXTERNALSYM GL_TEXTURE17_ARB} + GL_TEXTURE18_ARB = $84D2; + {$EXTERNALSYM GL_TEXTURE18_ARB} + GL_TEXTURE19_ARB = $84D3; + {$EXTERNALSYM GL_TEXTURE19_ARB} + GL_TEXTURE20_ARB = $84D4; + {$EXTERNALSYM GL_TEXTURE20_ARB} + GL_TEXTURE21_ARB = $84D5; + {$EXTERNALSYM GL_TEXTURE21_ARB} + GL_TEXTURE22_ARB = $84D6; + {$EXTERNALSYM GL_TEXTURE22_ARB} + GL_TEXTURE23_ARB = $84D7; + {$EXTERNALSYM GL_TEXTURE23_ARB} + GL_TEXTURE24_ARB = $84D8; + {$EXTERNALSYM GL_TEXTURE24_ARB} + GL_TEXTURE25_ARB = $84D9; + {$EXTERNALSYM GL_TEXTURE25_ARB} + GL_TEXTURE26_ARB = $84DA; + {$EXTERNALSYM GL_TEXTURE26_ARB} + GL_TEXTURE27_ARB = $84DB; + {$EXTERNALSYM GL_TEXTURE27_ARB} + GL_TEXTURE28_ARB = $84DC; + {$EXTERNALSYM GL_TEXTURE28_ARB} + GL_TEXTURE29_ARB = $84DD; + {$EXTERNALSYM GL_TEXTURE29_ARB} + GL_TEXTURE30_ARB = $84DE; + {$EXTERNALSYM GL_TEXTURE30_ARB} + GL_TEXTURE31_ARB = $84DF; + {$EXTERNALSYM GL_TEXTURE31_ARB} + + // EXT_stencil_wrap + GL_INCR_WRAP_EXT = $8507; + {$EXTERNALSYM GL_INCR_WRAP_EXT} + GL_DECR_WRAP_EXT = $8508; + {$EXTERNALSYM GL_DECR_WRAP_EXT} + + // NV_texgen_reflection + GL_NORMAL_MAP_NV = $8511; + {$EXTERNALSYM GL_NORMAL_MAP_NV} + GL_REFLECTION_MAP_NV = $8512; + {$EXTERNALSYM GL_REFLECTION_MAP_NV} + + // EXT_texture_env_combine + GL_COMBINE_EXT = $8570; + {$EXTERNALSYM GL_COMBINE_EXT} + GL_COMBINE_RGB_EXT = $8571; + {$EXTERNALSYM GL_COMBINE_RGB_EXT} + GL_COMBINE_ALPHA_EXT = $8572; + {$EXTERNALSYM GL_COMBINE_ALPHA_EXT} + GL_RGB_SCALE_EXT = $8573; + {$EXTERNALSYM GL_RGB_SCALE_EXT} + GL_ADD_SIGNED_EXT = $8574; + {$EXTERNALSYM GL_ADD_SIGNED_EXT} + GL_INTERPOLATE_EXT = $8575; + {$EXTERNALSYM GL_INTERPOLATE_EXT} + GL_CONSTANT_EXT = $8576; + {$EXTERNALSYM GL_CONSTANT_EXT} + GL_PRIMARY_COLOR_EXT = $8577; + {$EXTERNALSYM GL_PRIMARY_COLOR_EXT} + GL_PREVIOUS_EXT = $8578; + {$EXTERNALSYM GL_PREVIOUS_EXT} + GL_SOURCE0_RGB_EXT = $8580; + {$EXTERNALSYM GL_SOURCE0_RGB_EXT} + GL_SOURCE1_RGB_EXT = $8581; + {$EXTERNALSYM GL_SOURCE1_RGB_EXT} + GL_SOURCE2_RGB_EXT = $8582; + {$EXTERNALSYM GL_SOURCE2_RGB_EXT} + GL_SOURCE0_ALPHA_EXT = $8588; + {$EXTERNALSYM GL_SOURCE0_ALPHA_EXT} + GL_SOURCE1_ALPHA_EXT = $8589; + {$EXTERNALSYM GL_SOURCE1_ALPHA_EXT} + GL_SOURCE2_ALPHA_EXT = $858A; + {$EXTERNALSYM GL_SOURCE2_ALPHA_EXT} + GL_OPERAND0_RGB_EXT = $8590; + {$EXTERNALSYM GL_OPERAND0_RGB_EXT} + GL_OPERAND1_RGB_EXT = $8591; + {$EXTERNALSYM GL_OPERAND1_RGB_EXT} + GL_OPERAND2_RGB_EXT = $8592; + {$EXTERNALSYM GL_OPERAND2_RGB_EXT} + GL_OPERAND0_ALPHA_EXT = $8598; + {$EXTERNALSYM GL_OPERAND0_ALPHA_EXT} + GL_OPERAND1_ALPHA_EXT = $8599; + {$EXTERNALSYM GL_OPERAND1_ALPHA_EXT} + GL_OPERAND2_ALPHA_EXT = $859A; + {$EXTERNALSYM GL_OPERAND2_ALPHA_EXT} + + // NV_texture_env_combine4 + GL_COMBINE4_NV = $8503; + {$EXTERNALSYM GL_COMBINE4_NV} + GL_SOURCE3_RGB_NV = $8583; + {$EXTERNALSYM GL_SOURCE3_RGB_NV} + GL_SOURCE3_ALPHA_NV = $858B; + {$EXTERNALSYM GL_SOURCE3_ALPHA_NV} + GL_OPERAND3_RGB_NV = $8593; + {$EXTERNALSYM GL_OPERAND3_RGB_NV} + GL_OPERAND3_ALPHA_NV = $859B; + {$EXTERNALSYM GL_OPERAND3_ALPHA_NV} + + GL_BLEND_EQUATION = $8009; + {$EXTERNALSYM GL_BLEND_EQUATION} + GL_TABLE_TOO_LARGE = $8031; + {$EXTERNALSYM GL_TABLE_TOO_LARGE} + GL_UNSIGNED_BYTE_3_3_2 = $8032; + {$EXTERNALSYM GL_UNSIGNED_BYTE_3_3_2} + GL_UNSIGNED_SHORT_4_4_4_4 = $8033; + {$EXTERNALSYM GL_UNSIGNED_SHORT_4_4_4_4} + GL_UNSIGNED_SHORT_5_5_5_1 = $8034; + {$EXTERNALSYM GL_UNSIGNED_SHORT_5_5_5_1} + GL_UNSIGNED_INT_8_8_8_8 = $8035; + {$EXTERNALSYM GL_UNSIGNED_INT_8_8_8_8} + GL_UNSIGNED_INT_10_10_10_2 = $8036; + {$EXTERNALSYM GL_UNSIGNED_INT_10_10_10_2} + GL_UNSIGNED_BYTE_2_3_3_REV = $8362; + {$EXTERNALSYM GL_UNSIGNED_BYTE_2_3_3_REV} + GL_UNSIGNED_SHORT_5_6_5 = $8363; + {$EXTERNALSYM GL_UNSIGNED_SHORT_5_6_5} + GL_UNSIGNED_SHORT_5_6_5_REV = $8364; + {$EXTERNALSYM GL_UNSIGNED_SHORT_5_6_5_REV} + GL_UNSIGNED_SHORT_4_4_4_4_REV = $8365; + {$EXTERNALSYM GL_UNSIGNED_SHORT_4_4_4_4_REV} + GL_UNSIGNED_SHORT_1_5_5_5_REV = $8366; + {$EXTERNALSYM GL_UNSIGNED_SHORT_1_5_5_5_REV} + GL_UNSIGNED_INT_8_8_8_8_REV = $8367; + {$EXTERNALSYM GL_UNSIGNED_INT_8_8_8_8_REV} + GL_UNSIGNED_INT_2_10_10_10_REV = $8368; + {$EXTERNALSYM GL_UNSIGNED_INT_2_10_10_10_REV} + + // GL_ARB_transpose_matrix + GL_TRANSPOSE_MODELVIEW_MATRIX_ARB = $84E3; + {$EXTERNALSYM GL_TRANSPOSE_MODELVIEW_MATRIX_ARB} + GL_TRANSPOSE_PROJECTION_MATRIX_ARB = $84E4; + {$EXTERNALSYM GL_TRANSPOSE_PROJECTION_MATRIX_ARB} + GL_TRANSPOSE_TEXTURE_MATRIX_ARB = $84E5; + {$EXTERNALSYM GL_TRANSPOSE_TEXTURE_MATRIX_ARB} + GL_TRANSPOSE_COLOR_MATRIX_ARB = $84E6; + {$EXTERNALSYM GL_TRANSPOSE_COLOR_MATRIX_ARB} + + // GL_ARB_multisample + GL_MULTISAMPLE_ARB = $809D; + {$EXTERNALSYM GL_MULTISAMPLE_ARB} + GL_SAMPLE_ALPHA_TO_COVERAGE_ARB = $809E; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_COVERAGE_ARB} + GL_SAMPLE_ALPHA_TO_ONE_ARB = $809F; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_ONE_ARB} + GL_SAMPLE_COVERAGE_ARB = $80A0; + {$EXTERNALSYM GL_SAMPLE_COVERAGE_ARB} + GL_SAMPLE_BUFFERS_ARB = $80A8; + {$EXTERNALSYM GL_SAMPLE_BUFFERS_ARB} + GL_SAMPLES_ARB = $80A9; + {$EXTERNALSYM GL_SAMPLES_ARB} + GL_SAMPLE_COVERAGE_VALUE_ARB = $80AA; + {$EXTERNALSYM GL_SAMPLE_COVERAGE_VALUE_ARB} + GL_SAMPLE_COVERAGE_INVERT_ARB = $80AB; + {$EXTERNALSYM GL_SAMPLE_COVERAGE_INVERT_ARB} + GL_MULTISAMPLE_BIT_ARB = $20000000; + {$EXTERNALSYM GL_MULTISAMPLE_BIT_ARB} + GLX_SAMPLE_BUFFERS_ARB = 100000; + {$EXTERNALSYM GLX_SAMPLE_BUFFERS_ARB} + GLX_SAMPLES_ARB = 100001; + {$EXTERNALSYM GLX_SAMPLES_ARB} + WGL_SAMPLE_BUFFERS_ARB = $2041; + {$EXTERNALSYM WGL_SAMPLE_BUFFERS_ARB} + WGL_SAMPLES_ARB = $2042; + {$EXTERNALSYM WGL_SAMPLES_ARB} + + // GL_ARB_texture_cube_map + GL_NORMAL_MAP_ARB = $8511; + {$EXTERNALSYM GL_NORMAL_MAP_ARB} + GL_REFLECTION_MAP_ARB = $8512; + {$EXTERNALSYM GL_REFLECTION_MAP_ARB} + GL_TEXTURE_CUBE_MAP_ARB = $8513; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_ARB} + GL_TEXTURE_BINDING_CUBE_MAP_ARB = $8514; + {$EXTERNALSYM GL_TEXTURE_BINDING_CUBE_MAP_ARB} + GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = $8515; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB} + GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = $8516; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB} + GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = $8517; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB} + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = $8518; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB} + GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = $8519; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB} + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = $851A; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB} + GL_PROXY_TEXTURE_CUBE_MAP_ARB = $851B; + {$EXTERNALSYM GL_PROXY_TEXTURE_CUBE_MAP_ARB} + GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB = $851C; + {$EXTERNALSYM GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB} + + // GL_ARB_texture_compression + GL_COMPRESSED_ALPHA_ARB = $84E9; + {$EXTERNALSYM GL_COMPRESSED_ALPHA_ARB} + GL_COMPRESSED_LUMINANCE_ARB = $84EA; + {$EXTERNALSYM GL_COMPRESSED_LUMINANCE_ARB} + GL_COMPRESSED_LUMINANCE_ALPHA_ARB = $84EB; + {$EXTERNALSYM GL_COMPRESSED_LUMINANCE_ALPHA_ARB} + GL_COMPRESSED_INTENSITY_ARB = $84EC; + {$EXTERNALSYM GL_COMPRESSED_INTENSITY_ARB} + GL_COMPRESSED_RGB_ARB = $84ED; + {$EXTERNALSYM GL_COMPRESSED_RGB_ARB} + GL_COMPRESSED_RGBA_ARB = $84EE; + {$EXTERNALSYM GL_COMPRESSED_RGBA_ARB} + GL_TEXTURE_COMPRESSION_HINT_ARB = $84EF; + {$EXTERNALSYM GL_TEXTURE_COMPRESSION_HINT_ARB} + GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB = $86A0; + {$EXTERNALSYM GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB} + GL_TEXTURE_COMPRESSED_ARB = $86A1; + {$EXTERNALSYM GL_TEXTURE_COMPRESSED_ARB} + GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB = $86A2; + {$EXTERNALSYM GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB} + GL_COMPRESSED_TEXTURE_FORMATS_ARB = $86A3; + {$EXTERNALSYM GL_COMPRESSED_TEXTURE_FORMATS_ARB} + + // GL_ARB_vertex_blend + GL_MAX_VERTEX_UNITS_ARB = $86A4; + {$EXTERNALSYM GL_MAX_VERTEX_UNITS_ARB} + GL_ACTIVE_VERTEX_UNITS_ARB = $86A5; + {$EXTERNALSYM GL_ACTIVE_VERTEX_UNITS_ARB} + GL_WEIGHT_SUM_UNITY_ARB = $86A6; + {$EXTERNALSYM GL_WEIGHT_SUM_UNITY_ARB} + GL_VERTEX_BLEND_ARB = $86A7; + {$EXTERNALSYM GL_VERTEX_BLEND_ARB} + GL_CURRENT_WEIGHT_ARB = $86A8; + {$EXTERNALSYM GL_CURRENT_WEIGHT_ARB} + GL_WEIGHT_ARRAY_TYPE_ARB = $86A9; + {$EXTERNALSYM GL_WEIGHT_ARRAY_TYPE_ARB} + GL_WEIGHT_ARRAY_STRIDE_ARB = $86AA; + {$EXTERNALSYM GL_WEIGHT_ARRAY_STRIDE_ARB} + GL_WEIGHT_ARRAY_SIZE_ARB = $86AB; + {$EXTERNALSYM GL_WEIGHT_ARRAY_SIZE_ARB} + GL_WEIGHT_ARRAY_POINTER_ARB = $86AC; + {$EXTERNALSYM GL_WEIGHT_ARRAY_POINTER_ARB} + GL_WEIGHT_ARRAY_ARB = $86AD; + {$EXTERNALSYM GL_WEIGHT_ARRAY_ARB} + GL_MODELVIEW0_ARB = $1700; + {$EXTERNALSYM GL_MODELVIEW0_ARB} + GL_MODELVIEW1_ARB = $850A; + {$EXTERNALSYM GL_MODELVIEW1_ARB} + GL_MODELVIEW2_ARB = $8722; + {$EXTERNALSYM GL_MODELVIEW2_ARB} + GL_MODELVIEW3_ARB = $8723; + {$EXTERNALSYM GL_MODELVIEW3_ARB} + GL_MODELVIEW4_ARB = $8724; + {$EXTERNALSYM GL_MODELVIEW4_ARB} + GL_MODELVIEW5_ARB = $8725; + {$EXTERNALSYM GL_MODELVIEW5_ARB} + GL_MODELVIEW6_ARB = $8726; + {$EXTERNALSYM GL_MODELVIEW6_ARB} + GL_MODELVIEW7_ARB = $8727; + {$EXTERNALSYM GL_MODELVIEW7_ARB} + GL_MODELVIEW8_ARB = $8728; + {$EXTERNALSYM GL_MODELVIEW8_ARB} + GL_MODELVIEW9_ARB = $8729; + {$EXTERNALSYM GL_MODELVIEW9_ARB} + GL_MODELVIEW10_ARB = $872A; + {$EXTERNALSYM GL_MODELVIEW10_ARB} + GL_MODELVIEW11_ARB = $872B; + {$EXTERNALSYM GL_MODELVIEW11_ARB} + GL_MODELVIEW12_ARB = $872C; + {$EXTERNALSYM GL_MODELVIEW12_ARB} + GL_MODELVIEW13_ARB = $872D; + {$EXTERNALSYM GL_MODELVIEW13_ARB} + GL_MODELVIEW14_ARB = $872E; + {$EXTERNALSYM GL_MODELVIEW14_ARB} + GL_MODELVIEW15_ARB = $872F; + {$EXTERNALSYM GL_MODELVIEW15_ARB} + GL_MODELVIEW16_ARB = $8730; + {$EXTERNALSYM GL_MODELVIEW16_ARB} + GL_MODELVIEW17_ARB = $8731; + {$EXTERNALSYM GL_MODELVIEW17_ARB} + GL_MODELVIEW18_ARB = $8732; + {$EXTERNALSYM GL_MODELVIEW18_ARB} + GL_MODELVIEW19_ARB = $8733; + {$EXTERNALSYM GL_MODELVIEW19_ARB} + GL_MODELVIEW20_ARB = $8734; + {$EXTERNALSYM GL_MODELVIEW20_ARB} + GL_MODELVIEW21_ARB = $8735; + {$EXTERNALSYM GL_MODELVIEW21_ARB} + GL_MODELVIEW22_ARB = $8736; + {$EXTERNALSYM GL_MODELVIEW22_ARB} + GL_MODELVIEW23_ARB = $8737; + {$EXTERNALSYM GL_MODELVIEW23_ARB} + GL_MODELVIEW24_ARB = $8738; + {$EXTERNALSYM GL_MODELVIEW24_ARB} + GL_MODELVIEW25_ARB = $8739; + {$EXTERNALSYM GL_MODELVIEW25_ARB} + GL_MODELVIEW26_ARB = $873A; + {$EXTERNALSYM GL_MODELVIEW26_ARB} + GL_MODELVIEW27_ARB = $873B; + {$EXTERNALSYM GL_MODELVIEW27_ARB} + GL_MODELVIEW28_ARB = $873C; + {$EXTERNALSYM GL_MODELVIEW28_ARB} + GL_MODELVIEW29_ARB = $873D; + {$EXTERNALSYM GL_MODELVIEW29_ARB} + GL_MODELVIEW30_ARB = $873E; + {$EXTERNALSYM GL_MODELVIEW30_ARB} + GL_MODELVIEW31_ARB = $873F; + {$EXTERNALSYM GL_MODELVIEW31_ARB} + + // GL_SGIS_texture_filter4 + GL_FILTER4_SGIS = $8146; + {$EXTERNALSYM GL_FILTER4_SGIS} + GL_TEXTURE_FILTER4_SIZE_SGIS = $8147; + {$EXTERNALSYM GL_TEXTURE_FILTER4_SIZE_SGIS} + + // GL_SGIS_pixel_texture + GL_PIXEL_TEXTURE_SGIS = $8353; + {$EXTERNALSYM GL_PIXEL_TEXTURE_SGIS} + GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS = $8354; + {$EXTERNALSYM GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS} + GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS = $8355; + {$EXTERNALSYM GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS} + GL_PIXEL_GROUP_COLOR_SGIS = $8356; + {$EXTERNALSYM GL_PIXEL_GROUP_COLOR_SGIS} + + // GL_SGIX_pixel_texture + GL_PIXEL_TEX_GEN_SGIX = $8139; + {$EXTERNALSYM GL_PIXEL_TEX_GEN_SGIX} + GL_PIXEL_TEX_GEN_MODE_SGIX = $832B; + {$EXTERNALSYM GL_PIXEL_TEX_GEN_MODE_SGIX} + + // GL_SGIS_texture4D + GL_PACK_SKIP_VOLUMES_SGIS = $8130; + {$EXTERNALSYM GL_PACK_SKIP_VOLUMES_SGIS} + GL_PACK_IMAGE_DEPTH_SGIS = $8131; + {$EXTERNALSYM GL_PACK_IMAGE_DEPTH_SGIS} + GL_UNPACK_SKIP_VOLUMES_SGIS = $8132; + {$EXTERNALSYM GL_UNPACK_SKIP_VOLUMES_SGIS} + GL_UNPACK_IMAGE_DEPTH_SGIS = $8133; + {$EXTERNALSYM GL_UNPACK_IMAGE_DEPTH_SGIS} + GL_TEXTURE_4D_SGIS = $8134; + {$EXTERNALSYM GL_TEXTURE_4D_SGIS} + GL_PROXY_TEXTURE_4D_SGIS = $8135; + {$EXTERNALSYM GL_PROXY_TEXTURE_4D_SGIS} + GL_TEXTURE_4DSIZE_SGIS = $8136; + {$EXTERNALSYM GL_TEXTURE_4DSIZE_SGIS} + GL_TEXTURE_WRAP_Q_SGIS = $8137; + {$EXTERNALSYM GL_TEXTURE_WRAP_Q_SGIS} + GL_MAX_4D_TEXTURE_SIZE_SGIS = $8138; + {$EXTERNALSYM GL_MAX_4D_TEXTURE_SIZE_SGIS} + GL_TEXTURE_4D_BINDING_SGIS = $814F; + {$EXTERNALSYM GL_TEXTURE_4D_BINDING_SGIS} + + // GL_SGIS_detail_texture + GL_DETAIL_TEXTURE_2D_SGIS = $8095; + {$EXTERNALSYM GL_DETAIL_TEXTURE_2D_SGIS} + GL_DETAIL_TEXTURE_2D_BINDING_SGIS = $8096; + {$EXTERNALSYM GL_DETAIL_TEXTURE_2D_BINDING_SGIS} + GL_LINEAR_DETAIL_SGIS = $8097; + {$EXTERNALSYM GL_LINEAR_DETAIL_SGIS} + GL_LINEAR_DETAIL_ALPHA_SGIS = $8098; + {$EXTERNALSYM GL_LINEAR_DETAIL_ALPHA_SGIS} + GL_LINEAR_DETAIL_COLOR_SGIS = $8099; + {$EXTERNALSYM GL_LINEAR_DETAIL_COLOR_SGIS} + GL_DETAIL_TEXTURE_LEVEL_SGIS = $809A; + {$EXTERNALSYM GL_DETAIL_TEXTURE_LEVEL_SGIS} + GL_DETAIL_TEXTURE_MODE_SGIS = $809B; + {$EXTERNALSYM GL_DETAIL_TEXTURE_MODE_SGIS} + GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS = $809C; + {$EXTERNALSYM GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS} + + // GL_SGIS_sharpen_texture + GL_LINEAR_SHARPEN_SGIS = $80AD; + {$EXTERNALSYM GL_LINEAR_SHARPEN_SGIS} + GL_LINEAR_SHARPEN_ALPHA_SGIS = $80AE; + {$EXTERNALSYM GL_LINEAR_SHARPEN_ALPHA_SGIS} + GL_LINEAR_SHARPEN_COLOR_SGIS = $80AF; + {$EXTERNALSYM GL_LINEAR_SHARPEN_COLOR_SGIS} + GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS = $80B0; + {$EXTERNALSYM GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS} + + // GL_SGIS_texture_lod + GL_TEXTURE_MIN_LOD_SGIS = $813A; + {$EXTERNALSYM GL_TEXTURE_MIN_LOD_SGIS} + GL_TEXTURE_MAX_LOD_SGIS = $813B; + {$EXTERNALSYM GL_TEXTURE_MAX_LOD_SGIS} + GL_TEXTURE_BASE_LEVEL_SGIS = $813C; + {$EXTERNALSYM GL_TEXTURE_BASE_LEVEL_SGIS} + GL_TEXTURE_MAX_LEVEL_SGIS = $813D; + {$EXTERNALSYM GL_TEXTURE_MAX_LEVEL_SGIS} + + // GL_SGIS_multisample + GL_MULTISAMPLE_SGIS = $809D; + {$EXTERNALSYM GL_MULTISAMPLE_SGIS} + GL_SAMPLE_ALPHA_TO_MASK_SGIS = $809E; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_MASK_SGIS} + GL_SAMPLE_ALPHA_TO_ONE_SGIS = $809F; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_ONE_SGIS} + GL_SAMPLE_MASK_SGIS = $80A0; + {$EXTERNALSYM GL_SAMPLE_MASK_SGIS} + GL_1PASS_SGIS = $80A1; + {$EXTERNALSYM GL_1PASS_SGIS} + GL_2PASS_0_SGIS = $80A2; + {$EXTERNALSYM GL_2PASS_0_SGIS} + GL_2PASS_1_SGIS = $80A3; + {$EXTERNALSYM GL_2PASS_1_SGIS} + GL_4PASS_0_SGIS = $80A4; + {$EXTERNALSYM GL_4PASS_0_SGIS} + GL_4PASS_1_SGIS = $80A5; + {$EXTERNALSYM GL_4PASS_1_SGIS} + GL_4PASS_2_SGIS = $80A6; + {$EXTERNALSYM GL_4PASS_2_SGIS} + GL_4PASS_3_SGIS = $80A7; + {$EXTERNALSYM GL_4PASS_3_SGIS} + GL_SAMPLE_BUFFERS_SGIS = $80A8; + {$EXTERNALSYM GL_SAMPLE_BUFFERS_SGIS} + GL_SAMPLES_SGIS = $80A9; + {$EXTERNALSYM GL_SAMPLES_SGIS} + GL_SAMPLE_MASK_VALUE_SGIS = $80AA; + {$EXTERNALSYM GL_SAMPLE_MASK_VALUE_SGIS} + GL_SAMPLE_MASK_INVERT_SGIS = $80AB; + {$EXTERNALSYM GL_SAMPLE_MASK_INVERT_SGIS} + GL_SAMPLE_PATTERN_SGIS = $80AC; + {$EXTERNALSYM GL_SAMPLE_PATTERN_SGIS} + + // GL_SGIS_generate_mipmap + GL_GENERATE_MIPMAP_SGIS = $8191; + {$EXTERNALSYM GL_GENERATE_MIPMAP_SGIS} + GL_GENERATE_MIPMAP_HINT_SGIS = $8192; + {$EXTERNALSYM GL_GENERATE_MIPMAP_HINT_SGIS} + + // GL_SGIX_clipmap + GL_LINEAR_CLIPMAP_LINEAR_SGIX = $8170; + {$EXTERNALSYM GL_LINEAR_CLIPMAP_LINEAR_SGIX} + GL_TEXTURE_CLIPMAP_CENTER_SGIX = $8171; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_CENTER_SGIX} + GL_TEXTURE_CLIPMAP_FRAME_SGIX = $8172; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_FRAME_SGIX} + GL_TEXTURE_CLIPMAP_OFFSET_SGIX = $8173; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_OFFSET_SGIX} + GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX = $8174; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX} + GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX = $8175; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX} + GL_TEXTURE_CLIPMAP_DEPTH_SGIX = $8176; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_DEPTH_SGIX} + GL_MAX_CLIPMAP_DEPTH_SGIX = $8177; + {$EXTERNALSYM GL_MAX_CLIPMAP_DEPTH_SGIX} + GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX = $8178; + {$EXTERNALSYM GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX} + GL_NEAREST_CLIPMAP_NEAREST_SGIX = $844D; + {$EXTERNALSYM GL_NEAREST_CLIPMAP_NEAREST_SGIX} + GL_NEAREST_CLIPMAP_LINEAR_SGIX = $844E; + {$EXTERNALSYM GL_NEAREST_CLIPMAP_LINEAR_SGIX} + GL_LINEAR_CLIPMAP_NEAREST_SGIX = $844F; + {$EXTERNALSYM GL_LINEAR_CLIPMAP_NEAREST_SGIX} + + // GL_SGIX_shadow + GL_TEXTURE_COMPARE_SGIX = $819A; + {$EXTERNALSYM GL_TEXTURE_COMPARE_SGIX} + GL_TEXTURE_COMPARE_OPERATOR_SGIX = $819B; + {$EXTERNALSYM GL_TEXTURE_COMPARE_OPERATOR_SGIX} + GL_TEXTURE_LEQUAL_R_SGIX = $819C; + {$EXTERNALSYM GL_TEXTURE_LEQUAL_R_SGIX} + GL_TEXTURE_GEQUAL_R_SGIX = $819D; + {$EXTERNALSYM GL_TEXTURE_GEQUAL_R_SGIX} + + // GL_SGIS_texture_edge_clamp + GL_CLAMP_TO_EDGE_SGIS = $812F; + {$EXTERNALSYM GL_CLAMP_TO_EDGE_SGIS} + + // GL_SGIS_texture_border_clamp + GL_CLAMP_TO_BORDER_SGIS = $812D; + {$EXTERNALSYM GL_CLAMP_TO_BORDER_SGIS} + + // GL_SGIX_interlace + GL_INTERLACE_SGIX = $8094; + {$EXTERNALSYM GL_INTERLACE_SGIX} + + // GL_SGIX_pixel_tiles + GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX = $813E; + {$EXTERNALSYM GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX} + GL_PIXEL_TILE_CACHE_INCREMENT_SGIX = $813F; + {$EXTERNALSYM GL_PIXEL_TILE_CACHE_INCREMENT_SGIX} + GL_PIXEL_TILE_WIDTH_SGIX = $8140; + {$EXTERNALSYM GL_PIXEL_TILE_WIDTH_SGIX} + GL_PIXEL_TILE_HEIGHT_SGIX = $8141; + {$EXTERNALSYM GL_PIXEL_TILE_HEIGHT_SGIX} + GL_PIXEL_TILE_GRID_WIDTH_SGIX = $8142; + {$EXTERNALSYM GL_PIXEL_TILE_GRID_WIDTH_SGIX} + GL_PIXEL_TILE_GRID_HEIGHT_SGIX = $8143; + {$EXTERNALSYM GL_PIXEL_TILE_GRID_HEIGHT_SGIX} + GL_PIXEL_TILE_GRID_DEPTH_SGIX = $8144; + {$EXTERNALSYM GL_PIXEL_TILE_GRID_DEPTH_SGIX} + GL_PIXEL_TILE_CACHE_SIZE_SGIX = $8145; + {$EXTERNALSYM GL_PIXEL_TILE_CACHE_SIZE_SGIX} + + // GL_SGIS_texture_select + GL_DUAL_ALPHA4_SGIS = $8110; + {$EXTERNALSYM GL_DUAL_ALPHA4_SGIS} + GL_DUAL_ALPHA8_SGIS = $8111; + {$EXTERNALSYM GL_DUAL_ALPHA8_SGIS} + GL_DUAL_ALPHA12_SGIS = $8112; + {$EXTERNALSYM GL_DUAL_ALPHA12_SGIS} + GL_DUAL_ALPHA16_SGIS = $8113; + {$EXTERNALSYM GL_DUAL_ALPHA16_SGIS} + GL_DUAL_LUMINANCE4_SGIS = $8114; + {$EXTERNALSYM GL_DUAL_LUMINANCE4_SGIS} + GL_DUAL_LUMINANCE8_SGIS = $8115; + {$EXTERNALSYM GL_DUAL_LUMINANCE8_SGIS} + GL_DUAL_LUMINANCE12_SGIS = $8116; + {$EXTERNALSYM GL_DUAL_LUMINANCE12_SGIS} + GL_DUAL_LUMINANCE16_SGIS = $8117; + {$EXTERNALSYM GL_DUAL_LUMINANCE16_SGIS} + GL_DUAL_INTENSITY4_SGIS = $8118; + {$EXTERNALSYM GL_DUAL_INTENSITY4_SGIS} + GL_DUAL_INTENSITY8_SGIS = $8119; + {$EXTERNALSYM GL_DUAL_INTENSITY8_SGIS} + GL_DUAL_INTENSITY12_SGIS = $811A; + {$EXTERNALSYM GL_DUAL_INTENSITY12_SGIS} + GL_DUAL_INTENSITY16_SGIS = $811B; + {$EXTERNALSYM GL_DUAL_INTENSITY16_SGIS} + GL_DUAL_LUMINANCE_ALPHA4_SGIS = $811C; + {$EXTERNALSYM GL_DUAL_LUMINANCE_ALPHA4_SGIS} + GL_DUAL_LUMINANCE_ALPHA8_SGIS = $811D; + {$EXTERNALSYM GL_DUAL_LUMINANCE_ALPHA8_SGIS} + GL_QUAD_ALPHA4_SGIS = $811E; + {$EXTERNALSYM GL_QUAD_ALPHA4_SGIS} + GL_QUAD_ALPHA8_SGIS = $811F; + {$EXTERNALSYM GL_QUAD_ALPHA8_SGIS} + GL_QUAD_LUMINANCE4_SGIS = $8120; + {$EXTERNALSYM GL_QUAD_LUMINANCE4_SGIS} + GL_QUAD_LUMINANCE8_SGIS = $8121; + {$EXTERNALSYM GL_QUAD_LUMINANCE8_SGIS} + GL_QUAD_INTENSITY4_SGIS = $8122; + {$EXTERNALSYM GL_QUAD_INTENSITY4_SGIS} + GL_QUAD_INTENSITY8_SGIS = $8123; + {$EXTERNALSYM GL_QUAD_INTENSITY8_SGIS} + GL_DUAL_TEXTURE_SELECT_SGIS = $8124; + {$EXTERNALSYM GL_DUAL_TEXTURE_SELECT_SGIS} + GL_QUAD_TEXTURE_SELECT_SGIS = $8125; + {$EXTERNALSYM GL_QUAD_TEXTURE_SELECT_SGIS} + + // GL_SGIX_sprite + GL_SPRITE_SGIX = $8148; + {$EXTERNALSYM GL_SPRITE_SGIX} + GL_SPRITE_MODE_SGIX = $8149; + {$EXTERNALSYM GL_SPRITE_MODE_SGIX} + GL_SPRITE_AXIS_SGIX = $814A; + {$EXTERNALSYM GL_SPRITE_AXIS_SGIX} + GL_SPRITE_TRANSLATION_SGIX = $814B; + {$EXTERNALSYM GL_SPRITE_TRANSLATION_SGIX} + GL_SPRITE_AXIAL_SGIX = $814C; + {$EXTERNALSYM GL_SPRITE_AXIAL_SGIX} + GL_SPRITE_OBJECT_ALIGNED_SGIX = $814D; + {$EXTERNALSYM GL_SPRITE_OBJECT_ALIGNED_SGIX} + GL_SPRITE_EYE_ALIGNED_SGIX = $814E; + {$EXTERNALSYM GL_SPRITE_EYE_ALIGNED_SGIX} + + // GL_SGIX_texture_multi_buffer + GL_TEXTURE_MULTI_BUFFER_HINT_SGIX = $812E; + {$EXTERNALSYM GL_TEXTURE_MULTI_BUFFER_HINT_SGIX} + + // GL_SGIS_point_parameters + GL_POINT_SIZE_MIN_SGIS = $8126; + {$EXTERNALSYM GL_POINT_SIZE_MIN_SGIS} + GL_POINT_SIZE_MAX_SGIS = $8127; + {$EXTERNALSYM GL_POINT_SIZE_MAX_SGIS} + GL_POINT_FADE_THRESHOLD_SIZE_SGIS = $8128; + {$EXTERNALSYM GL_POINT_FADE_THRESHOLD_SIZE_SGIS} + GL_DISTANCE_ATTENUATION_SGIS = $8129; + {$EXTERNALSYM GL_DISTANCE_ATTENUATION_SGIS} + + // GL_SGIX_instruments + GL_INSTRUMENT_BUFFER_POINTER_SGIX = $8180; + {$EXTERNALSYM GL_INSTRUMENT_BUFFER_POINTER_SGIX} + GL_INSTRUMENT_MEASUREMENTS_SGIX = $8181; + {$EXTERNALSYM GL_INSTRUMENT_MEASUREMENTS_SGIX} + + // GL_SGIX_texture_scale_bias + GL_POST_TEXTURE_FILTER_BIAS_SGIX = $8179; + {$EXTERNALSYM GL_POST_TEXTURE_FILTER_BIAS_SGIX} + GL_POST_TEXTURE_FILTER_SCALE_SGIX = $817A; + {$EXTERNALSYM GL_POST_TEXTURE_FILTER_SCALE_SGIX} + GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX = $817B; + {$EXTERNALSYM GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX} + GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX = $817C; + {$EXTERNALSYM GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX} + + // GL_SGIX_framezoom + GL_FRAMEZOOM_SGIX = $818B; + {$EXTERNALSYM GL_FRAMEZOOM_SGIX} + GL_FRAMEZOOM_FACTOR_SGIX = $818C; + {$EXTERNALSYM GL_FRAMEZOOM_FACTOR_SGIX} + GL_MAX_FRAMEZOOM_FACTOR_SGIX = $818D; + {$EXTERNALSYM GL_MAX_FRAMEZOOM_FACTOR_SGIX} + + // GL_FfdMaskSGIX + GL_TEXTURE_DEFORMATION_BIT_SGIX = $00000001; + {$EXTERNALSYM GL_TEXTURE_DEFORMATION_BIT_SGIX} + GL_GEOMETRY_DEFORMATION_BIT_SGIX = $00000002; + {$EXTERNALSYM GL_GEOMETRY_DEFORMATION_BIT_SGIX} + + // GL_SGIX_polynomial_ffd + GL_GEOMETRY_DEFORMATION_SGIX = $8194; + {$EXTERNALSYM GL_GEOMETRY_DEFORMATION_SGIX} + GL_TEXTURE_DEFORMATION_SGIX = $8195; + {$EXTERNALSYM GL_TEXTURE_DEFORMATION_SGIX} + GL_DEFORMATIONS_MASK_SGIX = $8196; + {$EXTERNALSYM GL_DEFORMATIONS_MASK_SGIX} + GL_MAX_DEFORMATION_ORDER_SGIX = $8197; + {$EXTERNALSYM GL_MAX_DEFORMATION_ORDER_SGIX} + + // GL_SGIX_reference_plane + GL_REFERENCE_PLANE_SGIX = $817D; + {$EXTERNALSYM GL_REFERENCE_PLANE_SGIX} + GL_REFERENCE_PLANE_EQUATION_SGIX = $817E; + {$EXTERNALSYM GL_REFERENCE_PLANE_EQUATION_SGIX} + + // GL_SGIX_depth_texture + GL_DEPTH_COMPONENT16_SGIX = $81A5; + {$EXTERNALSYM GL_DEPTH_COMPONENT16_SGIX} + GL_DEPTH_COMPONENT24_SGIX = $81A6; + {$EXTERNALSYM GL_DEPTH_COMPONENT24_SGIX} + GL_DEPTH_COMPONENT32_SGIX = $81A7; + {$EXTERNALSYM GL_DEPTH_COMPONENT32_SGIX} + + // GL_SGIS_fog_function + GL_FOG_FUNC_SGIS = $812A; + {$EXTERNALSYM GL_FOG_FUNC_SGIS} + GL_FOG_FUNC_POINTS_SGIS = $812B; + {$EXTERNALSYM GL_FOG_FUNC_POINTS_SGIS} + GL_MAX_FOG_FUNC_POINTS_SGIS = $812C; + {$EXTERNALSYM GL_MAX_FOG_FUNC_POINTS_SGIS} + + // GL_SGIX_fog_offset + GL_FOG_OFFSET_SGIX = $8198; + {$EXTERNALSYM GL_FOG_OFFSET_SGIX} + GL_FOG_OFFSET_VALUE_SGIX = $8199; + {$EXTERNALSYM GL_FOG_OFFSET_VALUE_SGIX} + + // GL_HP_image_transform + GL_IMAGE_SCALE_X_HP = $8155; + {$EXTERNALSYM GL_IMAGE_SCALE_X_HP} + GL_IMAGE_SCALE_Y_HP = $8156; + {$EXTERNALSYM GL_IMAGE_SCALE_Y_HP} + GL_IMAGE_TRANSLATE_X_HP = $8157; + {$EXTERNALSYM GL_IMAGE_TRANSLATE_X_HP} + GL_IMAGE_TRANSLATE_Y_HP = $8158; + {$EXTERNALSYM GL_IMAGE_TRANSLATE_Y_HP} + GL_IMAGE_ROTATE_ANGLE_HP = $8159; + {$EXTERNALSYM GL_IMAGE_ROTATE_ANGLE_HP} + GL_IMAGE_ROTATE_ORIGIN_X_HP = $815A; + {$EXTERNALSYM GL_IMAGE_ROTATE_ORIGIN_X_HP} + GL_IMAGE_ROTATE_ORIGIN_Y_HP = $815B; + {$EXTERNALSYM GL_IMAGE_ROTATE_ORIGIN_Y_HP} + GL_IMAGE_MAG_FILTER_HP = $815C; + {$EXTERNALSYM GL_IMAGE_MAG_FILTER_HP} + GL_IMAGE_MIN_FILTER_HP = $815D; + {$EXTERNALSYM GL_IMAGE_MIN_FILTER_HP} + GL_IMAGE_CUBIC_WEIGHT_HP = $815E; + {$EXTERNALSYM GL_IMAGE_CUBIC_WEIGHT_HP} + GL_CUBIC_HP = $815F; + {$EXTERNALSYM GL_CUBIC_HP} + GL_AVERAGE_HP = $8160; + {$EXTERNALSYM GL_AVERAGE_HP} + GL_IMAGE_TRANSFORM_2D_HP = $8161; + {$EXTERNALSYM GL_IMAGE_TRANSFORM_2D_HP} + GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP = $8162; + {$EXTERNALSYM GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP} + GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP = $8163; + {$EXTERNALSYM GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP} + + // GL_HP_convolution_border_modes + GL_IGNORE_BORDER_HP = $8150; + {$EXTERNALSYM GL_IGNORE_BORDER_HP} + GL_CONSTANT_BORDER_HP = $8151; + {$EXTERNALSYM GL_CONSTANT_BORDER_HP} + GL_REPLICATE_BORDER_HP = $8153; + {$EXTERNALSYM GL_REPLICATE_BORDER_HP} + GL_CONVOLUTION_BORDER_COLOR_HP = $8154; + {$EXTERNALSYM GL_CONVOLUTION_BORDER_COLOR_HP} + + // GL_SGIX_texture_add_env + GL_TEXTURE_ENV_BIAS_SGIX = $80BE; + {$EXTERNALSYM GL_TEXTURE_ENV_BIAS_SGIX} + + // GL_PGI_vertex_hints + GL_VERTEX_DATA_HINT_PGI = $1A22A; + {$EXTERNALSYM GL_VERTEX_DATA_HINT_PGI} + GL_VERTEX_CONSISTENT_HINT_PGI = $1A22B; + {$EXTERNALSYM GL_VERTEX_CONSISTENT_HINT_PGI} + GL_MATERIAL_SIDE_HINT_PGI = $1A22C; + {$EXTERNALSYM GL_MATERIAL_SIDE_HINT_PGI} + GL_MAX_VERTEX_HINT_PGI = $1A22D; + {$EXTERNALSYM GL_MAX_VERTEX_HINT_PGI} + GL_COLOR3_BIT_PGI = $00010000; + {$EXTERNALSYM GL_COLOR3_BIT_PGI} + GL_COLOR4_BIT_PGI = $00020000; + {$EXTERNALSYM GL_COLOR4_BIT_PGI} + GL_EDGEFLAG_BIT_PGI = $00040000; + {$EXTERNALSYM GL_EDGEFLAG_BIT_PGI} + GL_INDEX_BIT_PGI = $00080000; + {$EXTERNALSYM GL_INDEX_BIT_PGI} + GL_MAT_AMBIENT_BIT_PGI = $00100000; + {$EXTERNALSYM GL_MAT_AMBIENT_BIT_PGI} + GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI = $00200000; + {$EXTERNALSYM GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI} + GL_MAT_DIFFUSE_BIT_PGI = $00400000; + {$EXTERNALSYM GL_MAT_DIFFUSE_BIT_PGI} + GL_MAT_EMISSION_BIT_PGI = $00800000; + {$EXTERNALSYM GL_MAT_EMISSION_BIT_PGI} + GL_MAT_COLOR_INDEXES_BIT_PGI = $01000000; + {$EXTERNALSYM GL_MAT_COLOR_INDEXES_BIT_PGI} + GL_MAT_SHININESS_BIT_PGI = $02000000; + {$EXTERNALSYM GL_MAT_SHININESS_BIT_PGI} + GL_MAT_SPECULAR_BIT_PGI = $04000000; + {$EXTERNALSYM GL_MAT_SPECULAR_BIT_PGI} + GL_NORMAL_BIT_PGI = $08000000; + {$EXTERNALSYM GL_NORMAL_BIT_PGI} + GL_TEXCOORD1_BIT_PGI = $10000000; + {$EXTERNALSYM GL_TEXCOORD1_BIT_PGI} + GL_TEXCOORD2_BIT_PGI = $20000000; + {$EXTERNALSYM GL_TEXCOORD2_BIT_PGI} + GL_TEXCOORD3_BIT_PGI = $40000000; + {$EXTERNALSYM GL_TEXCOORD3_BIT_PGI} + GL_TEXCOORD4_BIT_PGI = $80000000; + {$EXTERNALSYM GL_TEXCOORD4_BIT_PGI} + GL_VERTEX23_BIT_PGI = $00000004; + {$EXTERNALSYM GL_VERTEX23_BIT_PGI} + GL_VERTEX4_BIT_PGI = $00000008; + {$EXTERNALSYM GL_VERTEX4_BIT_PGI} + + // GL_PGI_misc_hints + GL_PREFER_DOUBLEBUFFER_HINT_PGI = $1A1F8; + {$EXTERNALSYM GL_PREFER_DOUBLEBUFFER_HINT_PGI} + GL_CONSERVE_MEMORY_HINT_PGI = $1A1FD; + {$EXTERNALSYM GL_CONSERVE_MEMORY_HINT_PGI} + GL_RECLAIM_MEMORY_HINT_PGI = $1A1FE; + {$EXTERNALSYM GL_RECLAIM_MEMORY_HINT_PGI} + GL_NATIVE_GRAPHICS_HANDLE_PGI = $1A202; + {$EXTERNALSYM GL_NATIVE_GRAPHICS_HANDLE_PGI} + GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI = $1A203; + {$EXTERNALSYM GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI} + GL_NATIVE_GRAPHICS_END_HINT_PGI = $1A204; + {$EXTERNALSYM GL_NATIVE_GRAPHICS_END_HINT_PGI} + GL_ALWAYS_FAST_HINT_PGI = $1A20C; + {$EXTERNALSYM GL_ALWAYS_FAST_HINT_PGI} + GL_ALWAYS_SOFT_HINT_PGI = $1A20D; + {$EXTERNALSYM GL_ALWAYS_SOFT_HINT_PGI} + GL_ALLOW_DRAW_OBJ_HINT_PGI = $1A20E; + {$EXTERNALSYM GL_ALLOW_DRAW_OBJ_HINT_PGI} + GL_ALLOW_DRAW_WIN_HINT_PGI = $1A20F; + {$EXTERNALSYM GL_ALLOW_DRAW_WIN_HINT_PGI} + GL_ALLOW_DRAW_FRG_HINT_PGI = $1A210; + {$EXTERNALSYM GL_ALLOW_DRAW_FRG_HINT_PGI} + GL_ALLOW_DRAW_MEM_HINT_PGI = $1A211; + {$EXTERNALSYM GL_ALLOW_DRAW_MEM_HINT_PGI} + GL_STRICT_DEPTHFUNC_HINT_PGI = $1A216; + {$EXTERNALSYM GL_STRICT_DEPTHFUNC_HINT_PGI} + GL_STRICT_LIGHTING_HINT_PGI = $1A217; + {$EXTERNALSYM GL_STRICT_LIGHTING_HINT_PGI} + GL_STRICT_SCISSOR_HINT_PGI = $1A218; + {$EXTERNALSYM GL_STRICT_SCISSOR_HINT_PGI} + GL_FULL_STIPPLE_HINT_PGI = $1A219; + {$EXTERNALSYM GL_FULL_STIPPLE_HINT_PGI} + GL_CLIP_NEAR_HINT_PGI = $1A220; + {$EXTERNALSYM GL_CLIP_NEAR_HINT_PGI} + GL_CLIP_FAR_HINT_PGI = $1A221; + {$EXTERNALSYM GL_CLIP_FAR_HINT_PGI} + GL_WIDE_LINE_HINT_PGI = $1A222; + {$EXTERNALSYM GL_WIDE_LINE_HINT_PGI} + GL_BACK_NORMALS_HINT_PGI = $1A223; + {$EXTERNALSYM GL_BACK_NORMALS_HINT_PGI} + + // GL_EXT_paletted_texture + GL_TEXTURE_INDEX_SIZE_EXT = $80ED; + {$EXTERNALSYM GL_TEXTURE_INDEX_SIZE_EXT} + + // GL_SGIX_list_priority + GL_LIST_PRIORITY_SGIX = $8182; + {$EXTERNALSYM GL_LIST_PRIORITY_SGIX} + + // GL_SGIX_ir_instrument1 + GL_IR_INSTRUMENT1_SGIX = $817F; + {$EXTERNALSYM GL_IR_INSTRUMENT1_SGIX} + + // GL_SGIX_calligraphic_fragment + GL_CALLIGRAPHIC_FRAGMENT_SGIX = $8183; + {$EXTERNALSYM GL_CALLIGRAPHIC_FRAGMENT_SGIX} + + // GL_SGIX_texture_lod_bias + GL_TEXTURE_LOD_BIAS_S_SGIX = $818E; + {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_S_SGIX} + GL_TEXTURE_LOD_BIAS_T_SGIX = $818F; + {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_T_SGIX} + GL_TEXTURE_LOD_BIAS_R_SGIX = $8190; + {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_R_SGIX} + + // GL_SGIX_shadow_ambient + GL_SHADOW_AMBIENT_SGIX = $80BF; + {$EXTERNALSYM GL_SHADOW_AMBIENT_SGIX} + + // GL_SGIX_ycrcb + GL_YCRCB_422_SGIX = $81BB; + {$EXTERNALSYM GL_YCRCB_422_SGIX} + GL_YCRCB_444_SGIX = $81BC; + {$EXTERNALSYM GL_YCRCB_444_SGIX} + + // GL_SGIX_fragment_lighting + GL_FRAGMENT_LIGHTING_SGIX = $8400; + {$EXTERNALSYM GL_FRAGMENT_LIGHTING_SGIX} + GL_FRAGMENT_COLOR_MATERIAL_SGIX = $8401; + {$EXTERNALSYM GL_FRAGMENT_COLOR_MATERIAL_SGIX} + GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX = $8402; + {$EXTERNALSYM GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX} + GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX = $8403; + {$EXTERNALSYM GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX} + GL_MAX_FRAGMENT_LIGHTS_SGIX = $8404; + {$EXTERNALSYM GL_MAX_FRAGMENT_LIGHTS_SGIX} + GL_MAX_ACTIVE_LIGHTS_SGIX = $8405; + {$EXTERNALSYM GL_MAX_ACTIVE_LIGHTS_SGIX} + GL_CURRENT_RASTER_NORMAL_SGIX = $8406; + {$EXTERNALSYM GL_CURRENT_RASTER_NORMAL_SGIX} + GL_LIGHT_ENV_MODE_SGIX = $8407; + {$EXTERNALSYM GL_LIGHT_ENV_MODE_SGIX} + GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX = $8408; + {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX} + GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX = $8409; + {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX} + GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX = $840A; + {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX} + GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX = $840B; + {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX} + GL_FRAGMENT_LIGHT0_SGIX = $840C; + {$EXTERNALSYM GL_FRAGMENT_LIGHT0_SGIX} + GL_FRAGMENT_LIGHT1_SGIX = $840D; + {$EXTERNALSYM GL_FRAGMENT_LIGHT1_SGIX} + GL_FRAGMENT_LIGHT2_SGIX = $840E; + {$EXTERNALSYM GL_FRAGMENT_LIGHT2_SGIX} + GL_FRAGMENT_LIGHT3_SGIX = $840F; + {$EXTERNALSYM GL_FRAGMENT_LIGHT3_SGIX} + GL_FRAGMENT_LIGHT4_SGIX = $8410; + {$EXTERNALSYM GL_FRAGMENT_LIGHT4_SGIX} + GL_FRAGMENT_LIGHT5_SGIX = $8411; + {$EXTERNALSYM GL_FRAGMENT_LIGHT5_SGIX} + GL_FRAGMENT_LIGHT6_SGIX = $8412; + {$EXTERNALSYM GL_FRAGMENT_LIGHT6_SGIX} + GL_FRAGMENT_LIGHT7_SGIX = $8413; + {$EXTERNALSYM GL_FRAGMENT_LIGHT7_SGIX} + + // GL_IBM_rasterpos_clip + GL_RASTER_POSITION_UNCLIPPED_IBM = $19262; + {$EXTERNALSYM GL_RASTER_POSITION_UNCLIPPED_IBM} + + // GL_HP_texture_lighting + GL_TEXTURE_LIGHTING_MODE_HP = $8167; + {$EXTERNALSYM GL_TEXTURE_LIGHTING_MODE_HP} + GL_TEXTURE_POST_SPECULAR_HP = $8168; + {$EXTERNALSYM GL_TEXTURE_POST_SPECULAR_HP} + GL_TEXTURE_PRE_SPECULAR_HP = $8169; + {$EXTERNALSYM GL_TEXTURE_PRE_SPECULAR_HP} + + // GL_EXT_draw_range_elements + GL_MAX_ELEMENTS_VERTICES_EXT = $80E8; + {$EXTERNALSYM GL_MAX_ELEMENTS_VERTICES_EXT} + GL_MAX_ELEMENTS_INDICES_EXT = $80E9; + {$EXTERNALSYM GL_MAX_ELEMENTS_INDICES_EXT} + + // GL_WIN_phong_shading + GL_PHONG_WIN = $80EA; + {$EXTERNALSYM GL_PHONG_WIN} + GL_PHONG_HINT_WIN = $80EB; + {$EXTERNALSYM GL_PHONG_HINT_WIN} + + // GL_WIN_specular_fog + GL_FOG_SPECULAR_TEXTURE_WIN = $80EC; + {$EXTERNALSYM GL_FOG_SPECULAR_TEXTURE_WIN} + + // GL_EXT_light_texture + GL_FRAGMENT_MATERIAL_EXT = $8349; + {$EXTERNALSYM GL_FRAGMENT_MATERIAL_EXT} + GL_FRAGMENT_NORMAL_EXT = $834A; + {$EXTERNALSYM GL_FRAGMENT_NORMAL_EXT} + GL_FRAGMENT_COLOR_EXT = $834C; + {$EXTERNALSYM GL_FRAGMENT_COLOR_EXT} + GL_ATTENUATION_EXT = $834D; + {$EXTERNALSYM GL_ATTENUATION_EXT} + GL_SHADOW_ATTENUATION_EXT = $834E; + {$EXTERNALSYM GL_SHADOW_ATTENUATION_EXT} + GL_TEXTURE_APPLICATION_MODE_EXT = $834F; + {$EXTERNALSYM GL_TEXTURE_APPLICATION_MODE_EXT} + GL_TEXTURE_LIGHT_EXT = $8350; + {$EXTERNALSYM GL_TEXTURE_LIGHT_EXT} + GL_TEXTURE_MATERIAL_FACE_EXT = $8351; + {$EXTERNALSYM GL_TEXTURE_MATERIAL_FACE_EXT} + GL_TEXTURE_MATERIAL_PARAMETER_EXT = $8352; + {$EXTERNALSYM GL_TEXTURE_MATERIAL_PARAMETER_EXT} + + // GL_SGIX_blend_alpha_minmax + GL_ALPHA_MIN_SGIX = $8320; + {$EXTERNALSYM GL_ALPHA_MIN_SGIX} + GL_ALPHA_MAX_SGIX = $8321; + {$EXTERNALSYM GL_ALPHA_MAX_SGIX} + + // GL_SGIX_async + GL_ASYNC_MARKER_SGIX = $8329; + {$EXTERNALSYM GL_ASYNC_MARKER_SGIX} + + // GL_SGIX_async_pixel + GL_ASYNC_TEX_IMAGE_SGIX = $835C; + {$EXTERNALSYM GL_ASYNC_TEX_IMAGE_SGIX} + GL_ASYNC_DRAW_PIXELS_SGIX = $835D; + {$EXTERNALSYM GL_ASYNC_DRAW_PIXELS_SGIX} + GL_ASYNC_READ_PIXELS_SGIX = $835E; + {$EXTERNALSYM GL_ASYNC_READ_PIXELS_SGIX} + GL_MAX_ASYNC_TEX_IMAGE_SGIX = $835F; + {$EXTERNALSYM GL_MAX_ASYNC_TEX_IMAGE_SGIX} + GL_MAX_ASYNC_DRAW_PIXELS_SGIX = $8360; + {$EXTERNALSYM GL_MAX_ASYNC_DRAW_PIXELS_SGIX} + GL_MAX_ASYNC_READ_PIXELS_SGIX = $8361; + {$EXTERNALSYM GL_MAX_ASYNC_READ_PIXELS_SGIX} + + // GL_SGIX_async_histogram + GL_ASYNC_HISTOGRAM_SGIX = $832C; + {$EXTERNALSYM GL_ASYNC_HISTOGRAM_SGIX} + GL_MAX_ASYNC_HISTOGRAM_SGIX = $832D; + {$EXTERNALSYM GL_MAX_ASYNC_HISTOGRAM_SGIX} + + // GL_INTEL_parallel_arrays + GL_PARALLEL_ARRAYS_INTEL = $83F4; + {$EXTERNALSYM GL_PARALLEL_ARRAYS_INTEL} + GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL = $83F5; + {$EXTERNALSYM GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL} + GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL = $83F6; + {$EXTERNALSYM GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL} + GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL = $83F7; + {$EXTERNALSYM GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL} + GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL = $83F8; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL} + + // GL_HP_occlusion_test + GL_OCCLUSION_TEST_HP = $8165; + {$EXTERNALSYM GL_OCCLUSION_TEST_HP} + GL_OCCLUSION_TEST_RESULT_HP = $8166; + {$EXTERNALSYM GL_OCCLUSION_TEST_RESULT_HP} + + // GL_EXT_pixel_transform + GL_PIXEL_TRANSFORM_2D_EXT = $8330; + {$EXTERNALSYM GL_PIXEL_TRANSFORM_2D_EXT} + GL_PIXEL_MAG_FILTER_EXT = $8331; + {$EXTERNALSYM GL_PIXEL_MAG_FILTER_EXT} + GL_PIXEL_MIN_FILTER_EXT = $8332; + {$EXTERNALSYM GL_PIXEL_MIN_FILTER_EXT} + GL_PIXEL_CUBIC_WEIGHT_EXT = $8333; + {$EXTERNALSYM GL_PIXEL_CUBIC_WEIGHT_EXT} + GL_CUBIC_EXT = $8334; + {$EXTERNALSYM GL_CUBIC_EXT} + GL_AVERAGE_EXT = $8335; + {$EXTERNALSYM GL_AVERAGE_EXT} + GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT = $8336; + {$EXTERNALSYM GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT} + GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT = $8337; + {$EXTERNALSYM GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT} + GL_PIXEL_TRANSFORM_2D_MATRIX_EXT = $8338; + {$EXTERNALSYM GL_PIXEL_TRANSFORM_2D_MATRIX_EXT} + + // GL_EXT_separate_specular_color + GL_LIGHT_MODEL_COLOR_CONTROL_EXT = $81F8; + {$EXTERNALSYM GL_LIGHT_MODEL_COLOR_CONTROL_EXT} + GL_SINGLE_COLOR_EXT = $81F9; + {$EXTERNALSYM GL_SINGLE_COLOR_EXT} + GL_SEPARATE_SPECULAR_COLOR_EXT = $81FA; + {$EXTERNALSYM GL_SEPARATE_SPECULAR_COLOR_EXT} + + // GL_EXT_secondary_color + GL_COLOR_SUM_EXT = $8458; + {$EXTERNALSYM GL_COLOR_SUM_EXT} + GL_CURRENT_SECONDARY_COLOR_EXT = $8459; + {$EXTERNALSYM GL_CURRENT_SECONDARY_COLOR_EXT} + GL_SECONDARY_COLOR_ARRAY_SIZE_EXT = $845A; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_SIZE_EXT} + GL_SECONDARY_COLOR_ARRAY_TYPE_EXT = $845B; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_TYPE_EXT} + GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT = $845C; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT} + GL_SECONDARY_COLOR_ARRAY_POINTER_EXT = $845D; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_POINTER_EXT} + GL_SECONDARY_COLOR_ARRAY_EXT = $845E; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_EXT} + + // GL_EXT_texture_perturb_normal + GL_PERTURB_EXT = $85AE; + {$EXTERNALSYM GL_PERTURB_EXT} + GL_TEXTURE_NORMAL_EXT = $85AF; + {$EXTERNALSYM GL_TEXTURE_NORMAL_EXT} + + // GL_EXT_fog_coord + GL_FOG_COORDINATE_SOURCE_EXT = $8450; + {$EXTERNALSYM GL_FOG_COORDINATE_SOURCE_EXT} + GL_FOG_COORDINATE_EXT = $8451; + {$EXTERNALSYM GL_FOG_COORDINATE_EXT} + GL_FRAGMENT_DEPTH_EXT = $8452; + {$EXTERNALSYM GL_FRAGMENT_DEPTH_EXT} + GL_CURRENT_FOG_COORDINATE_EXT = $8453; + {$EXTERNALSYM GL_CURRENT_FOG_COORDINATE_EXT} + GL_FOG_COORDINATE_ARRAY_TYPE_EXT = $8454; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_TYPE_EXT} + GL_FOG_COORDINATE_ARRAY_STRIDE_EXT = $8455; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_STRIDE_EXT} + GL_FOG_COORDINATE_ARRAY_POINTER_EXT = $8456; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_POINTER_EXT} + GL_FOG_COORDINATE_ARRAY_EXT = $8457; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_EXT} + + // GL_REND_screen_coordinates + GL_SCREEN_COORDINATES_REND = $8490; + {$EXTERNALSYM GL_SCREEN_COORDINATES_REND} + GL_INVERTED_SCREEN_W_REND = $8491; + {$EXTERNALSYM GL_INVERTED_SCREEN_W_REND} + + // GL_EXT_coordinate_frame + GL_TANGENT_ARRAY_EXT = $8439; + {$EXTERNALSYM GL_TANGENT_ARRAY_EXT} + GL_BINORMAL_ARRAY_EXT = $843A; + {$EXTERNALSYM GL_BINORMAL_ARRAY_EXT} + GL_CURRENT_TANGENT_EXT = $843B; + {$EXTERNALSYM GL_CURRENT_TANGENT_EXT} + GL_CURRENT_BINORMAL_EXT = $843C; + {$EXTERNALSYM GL_CURRENT_BINORMAL_EXT} + GL_TANGENT_ARRAY_TYPE_EXT = $843E; + {$EXTERNALSYM GL_TANGENT_ARRAY_TYPE_EXT} + GL_TANGENT_ARRAY_STRIDE_EXT = $843F; + {$EXTERNALSYM GL_TANGENT_ARRAY_STRIDE_EXT} + GL_BINORMAL_ARRAY_TYPE_EXT = $8440; + {$EXTERNALSYM GL_BINORMAL_ARRAY_TYPE_EXT} + GL_BINORMAL_ARRAY_STRIDE_EXT = $8441; + {$EXTERNALSYM GL_BINORMAL_ARRAY_STRIDE_EXT} + GL_TANGENT_ARRAY_POINTER_EXT = $8442; + {$EXTERNALSYM GL_TANGENT_ARRAY_POINTER_EXT} + GL_BINORMAL_ARRAY_POINTER_EXT = $8443; + {$EXTERNALSYM GL_BINORMAL_ARRAY_POINTER_EXT} + GL_MAP1_TANGENT_EXT = $8444; + {$EXTERNALSYM GL_MAP1_TANGENT_EXT} + GL_MAP2_TANGENT_EXT = $8445; + {$EXTERNALSYM GL_MAP2_TANGENT_EXT} + GL_MAP1_BINORMAL_EXT = $8446; + {$EXTERNALSYM GL_MAP1_BINORMAL_EXT} + GL_MAP2_BINORMAL_EXT = $8447; + {$EXTERNALSYM GL_MAP2_BINORMAL_EXT} + + // GL_EXT_texture_env_combine + GL_SOURCE3_RGB_EXT = $8583; + {$EXTERNALSYM GL_SOURCE3_RGB_EXT} + GL_SOURCE4_RGB_EXT = $8584; + {$EXTERNALSYM GL_SOURCE4_RGB_EXT} + GL_SOURCE5_RGB_EXT = $8585; + {$EXTERNALSYM GL_SOURCE5_RGB_EXT} + GL_SOURCE6_RGB_EXT = $8586; + {$EXTERNALSYM GL_SOURCE6_RGB_EXT} + GL_SOURCE7_RGB_EXT = $8587; + {$EXTERNALSYM GL_SOURCE7_RGB_EXT} + GL_SOURCE3_ALPHA_EXT = $858B; + {$EXTERNALSYM GL_SOURCE3_ALPHA_EXT} + GL_SOURCE4_ALPHA_EXT = $858C; + {$EXTERNALSYM GL_SOURCE4_ALPHA_EXT} + GL_SOURCE5_ALPHA_EXT = $858D; + {$EXTERNALSYM GL_SOURCE5_ALPHA_EXT} + GL_SOURCE6_ALPHA_EXT = $858E; + {$EXTERNALSYM GL_SOURCE6_ALPHA_EXT} + GL_SOURCE7_ALPHA_EXT = $858F; + {$EXTERNALSYM GL_SOURCE7_ALPHA_EXT} + GL_OPERAND3_RGB_EXT = $8593; + {$EXTERNALSYM GL_OPERAND3_RGB_EXT} + GL_OPERAND4_RGB_EXT = $8594; + {$EXTERNALSYM GL_OPERAND4_RGB_EXT} + GL_OPERAND5_RGB_EXT = $8595; + {$EXTERNALSYM GL_OPERAND5_RGB_EXT} + GL_OPERAND6_RGB_EXT = $8596; + {$EXTERNALSYM GL_OPERAND6_RGB_EXT} + GL_OPERAND7_RGB_EXT = $8597; + {$EXTERNALSYM GL_OPERAND7_RGB_EXT} + GL_OPERAND3_ALPHA_EXT = $859B; + {$EXTERNALSYM GL_OPERAND3_ALPHA_EXT} + GL_OPERAND4_ALPHA_EXT = $859C; + {$EXTERNALSYM GL_OPERAND4_ALPHA_EXT} + GL_OPERAND5_ALPHA_EXT = $859D; + {$EXTERNALSYM GL_OPERAND5_ALPHA_EXT} + GL_OPERAND6_ALPHA_EXT = $859E; + {$EXTERNALSYM GL_OPERAND6_ALPHA_EXT} + GL_OPERAND7_ALPHA_EXT = $859F; + {$EXTERNALSYM GL_OPERAND7_ALPHA_EXT} + + // GL_APPLE_specular_vector + GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE = $85B0; + {$EXTERNALSYM GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE} + + // GL_APPLE_transform_hint + GL_TRANSFORM_HINT_APPLE = $85B1; + {$EXTERNALSYM GL_TRANSFORM_HINT_APPLE} + + // GL_SGIX_fog_scale + GL_FOG_SCALE_SGIX = $81FC; + {$EXTERNALSYM GL_FOG_SCALE_SGIX} + GL_FOG_SCALE_VALUE_SGIX = $81FD; + {$EXTERNALSYM GL_FOG_SCALE_VALUE_SGIX} + + // GL_SUNX_constant_data + GL_UNPACK_CONSTANT_DATA_SUNX = $81D5; + {$EXTERNALSYM GL_UNPACK_CONSTANT_DATA_SUNX} + GL_TEXTURE_CONSTANT_DATA_SUNX = $81D6; + {$EXTERNALSYM GL_TEXTURE_CONSTANT_DATA_SUNX} + + // GL_SUN_global_alpha + GL_GLOBAL_ALPHA_SUN = $81D9; + {$EXTERNALSYM GL_GLOBAL_ALPHA_SUN} + GL_GLOBAL_ALPHA_FACTOR_SUN = $81DA; + {$EXTERNALSYM GL_GLOBAL_ALPHA_FACTOR_SUN} + + // GL_SUN_triangle_list + GL_RESTART_SUN = $01; + {$EXTERNALSYM GL_RESTART_SUN} + GL_REPLACE_MIDDLE_SUN = $02; + {$EXTERNALSYM GL_REPLACE_MIDDLE_SUN} + GL_REPLACE_OLDEST_SUN = $03; + {$EXTERNALSYM GL_REPLACE_OLDEST_SUN} + GL_TRIANGLE_LIST_SUN = $81D7; + {$EXTERNALSYM GL_TRIANGLE_LIST_SUN} + GL_REPLACEMENT_CODE_SUN = $81D8; + {$EXTERNALSYM GL_REPLACEMENT_CODE_SUN} + GL_REPLACEMENT_CODE_ARRAY_SUN = $85C0; + {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_SUN} + GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN = $85C1; + {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN} + GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN = $85C2; + {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN} + GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN = $85C3; + {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN} + GL_R1UI_V3F_SUN = $85C4; + {$EXTERNALSYM GL_R1UI_V3F_SUN} + GL_R1UI_C4UB_V3F_SUN = $85C5; + {$EXTERNALSYM GL_R1UI_C4UB_V3F_SUN} + GL_R1UI_C3F_V3F_SUN = $85C6; + {$EXTERNALSYM GL_R1UI_C3F_V3F_SUN} + GL_R1UI_N3F_V3F_SUN = $85C7; + {$EXTERNALSYM GL_R1UI_N3F_V3F_SUN} + GL_R1UI_C4F_N3F_V3F_SUN = $85C8; + {$EXTERNALSYM GL_R1UI_C4F_N3F_V3F_SUN} + GL_R1UI_T2F_V3F_SUN = $85C9; + {$EXTERNALSYM GL_R1UI_T2F_V3F_SUN} + GL_R1UI_T2F_N3F_V3F_SUN = $85CA; + {$EXTERNALSYM GL_R1UI_T2F_N3F_V3F_SUN} + GL_R1UI_T2F_C4F_N3F_V3F_SUN = $85CB; + {$EXTERNALSYM GL_R1UI_T2F_C4F_N3F_V3F_SUN} + + // GL_EXT_blend_func_separate + GL_BLEND_DST_RGB_EXT = $80C8; + {$EXTERNALSYM GL_BLEND_DST_RGB_EXT} + GL_BLEND_SRC_RGB_EXT = $80C9; + {$EXTERNALSYM GL_BLEND_SRC_RGB_EXT} + GL_BLEND_DST_ALPHA_EXT = $80CA; + {$EXTERNALSYM GL_BLEND_DST_ALPHA_EXT} + GL_BLEND_SRC_ALPHA_EXT = $80CB; + {$EXTERNALSYM GL_BLEND_SRC_ALPHA_EXT} + + // GL_INGR_color_clamp + GL_RED_MIN_CLAMP_INGR = $8560; + {$EXTERNALSYM GL_RED_MIN_CLAMP_INGR} + GL_GREEN_MIN_CLAMP_INGR = $8561; + {$EXTERNALSYM GL_GREEN_MIN_CLAMP_INGR} + GL_BLUE_MIN_CLAMP_INGR = $8562; + {$EXTERNALSYM GL_BLUE_MIN_CLAMP_INGR} + GL_ALPHA_MIN_CLAMP_INGR = $8563; + {$EXTERNALSYM GL_ALPHA_MIN_CLAMP_INGR} + GL_RED_MAX_CLAMP_INGR = $8564; + {$EXTERNALSYM GL_RED_MAX_CLAMP_INGR} + GL_GREEN_MAX_CLAMP_INGR = $8565; + {$EXTERNALSYM GL_GREEN_MAX_CLAMP_INGR} + GL_BLUE_MAX_CLAMP_INGR = $8566; + {$EXTERNALSYM GL_BLUE_MAX_CLAMP_INGR} + GL_ALPHA_MAX_CLAMP_INGR = $8567; + {$EXTERNALSYM GL_ALPHA_MAX_CLAMP_INGR} + + // GL_INGR_interlace_read + GL_INTERLACE_READ_INGR = $8568; + {$EXTERNALSYM GL_INTERLACE_READ_INGR} + + // GL_EXT_422_pixels + GL_422_EXT = $80CC; + {$EXTERNALSYM GL_422_EXT} + GL_422_REV_EXT = $80CD; + {$EXTERNALSYM GL_422_REV_EXT} + GL_422_AVERAGE_EXT = $80CE; + {$EXTERNALSYM GL_422_AVERAGE_EXT} + GL_422_REV_AVERAGE_EXT = $80CF; + {$EXTERNALSYM GL_422_REV_AVERAGE_EXT} + + // GL_EXT_texture_cube_map + GL_NORMAL_MAP_EXT = $8511; + {$EXTERNALSYM GL_NORMAL_MAP_EXT} + GL_REFLECTION_MAP_EXT = $8512; + {$EXTERNALSYM GL_REFLECTION_MAP_EXT} + GL_TEXTURE_CUBE_MAP_EXT = $8513; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_EXT} + GL_TEXTURE_BINDING_CUBE_MAP_EXT = $8514; + {$EXTERNALSYM GL_TEXTURE_BINDING_CUBE_MAP_EXT} + GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT = $8515; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT} + GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT = $8516; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT} + GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT = $8517; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT} + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT = $8518; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT} + GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT = $8519; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT} + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT = $851A; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT} + GL_PROXY_TEXTURE_CUBE_MAP_EXT = $851B; + {$EXTERNALSYM GL_PROXY_TEXTURE_CUBE_MAP_EXT} + GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT = $851C; + {$EXTERNALSYM GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT} + + // GL_SUN_convolution_border_modes + GL_WRAP_BORDER_SUN = $81D4; + {$EXTERNALSYM GL_WRAP_BORDER_SUN} + + // GL_EXT_texture_lod_bias + GL_MAX_TEXTURE_LOD_BIAS_EXT = $84FD; + {$EXTERNALSYM GL_MAX_TEXTURE_LOD_BIAS_EXT} + GL_TEXTURE_FILTER_CONTROL_EXT = $8500; + {$EXTERNALSYM GL_TEXTURE_FILTER_CONTROL_EXT} + GL_TEXTURE_LOD_BIAS_EXT = $8501; + {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_EXT} + + // GL_EXT_texture_filter_anisotropic + GL_TEXTURE_MAX_ANISOTROPY_EXT = $84FE; + {$EXTERNALSYM GL_TEXTURE_MAX_ANISOTROPY_EXT} + GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = $84FF; + {$EXTERNALSYM GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT} + + // GL_EXT_vertex_weighting + GL_MODELVIEW0_STACK_DEPTH_EXT = GL_MODELVIEW_STACK_DEPTH; + {$EXTERNALSYM GL_MODELVIEW0_STACK_DEPTH_EXT} + GL_MODELVIEW1_STACK_DEPTH_EXT = $8502; + {$EXTERNALSYM GL_MODELVIEW1_STACK_DEPTH_EXT} + GL_MODELVIEW0_MATRIX_EXT = GL_MODELVIEW_MATRIX; + {$EXTERNALSYM GL_MODELVIEW0_MATRIX_EXT} + GL_MODELVIEW_MATRIX1_EXT = $8506; + {$EXTERNALSYM GL_MODELVIEW_MATRIX1_EXT} + GL_VERTEX_WEIGHTING_EXT = $8509; + {$EXTERNALSYM GL_VERTEX_WEIGHTING_EXT} + GL_MODELVIEW0_EXT = GL_MODELVIEW; + {$EXTERNALSYM GL_MODELVIEW0_EXT} + GL_MODELVIEW1_EXT = $850A; + {$EXTERNALSYM GL_MODELVIEW1_EXT} + GL_CURRENT_VERTEX_WEIGHT_EXT = $850B; + {$EXTERNALSYM GL_CURRENT_VERTEX_WEIGHT_EXT} + GL_VERTEX_WEIGHT_ARRAY_EXT = $850C; + {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_EXT} + GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT = $850D; + {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT} + GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT = $850E; + {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT} + GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT = $850F; + {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT} + GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT = $8510; + {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT} + + // GL_NV_light_max_exponent + GL_MAX_SHININESS_NV = $8504; + {$EXTERNALSYM GL_MAX_SHININESS_NV} + GL_MAX_SPOT_EXPONENT_NV = $8505; + {$EXTERNALSYM GL_MAX_SPOT_EXPONENT_NV} + + // GL_NV_vertex_array_range + GL_VERTEX_ARRAY_RANGE_NV = $851D; + {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_NV} + GL_VERTEX_ARRAY_RANGE_LENGTH_NV = $851E; + {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_LENGTH_NV} + GL_VERTEX_ARRAY_RANGE_VALID_NV = $851F; + {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_VALID_NV} + GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV = $8520; + {$EXTERNALSYM GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV} + GL_VERTEX_ARRAY_RANGE_POINTER_NV = $8521; + {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_POINTER_NV} + + // GL_NV_register_combiners + GL_REGISTER_COMBINERS_NV = $8522; + {$EXTERNALSYM GL_REGISTER_COMBINERS_NV} + GL_VARIABLE_A_NV = $8523; + {$EXTERNALSYM GL_VARIABLE_A_NV} + GL_VARIABLE_B_NV = $8524; + {$EXTERNALSYM GL_VARIABLE_B_NV} + GL_VARIABLE_C_NV = $8525; + {$EXTERNALSYM GL_VARIABLE_C_NV} + GL_VARIABLE_D_NV = $8526; + {$EXTERNALSYM GL_VARIABLE_D_NV} + GL_VARIABLE_E_NV = $8527; + {$EXTERNALSYM GL_VARIABLE_E_NV} + GL_VARIABLE_F_NV = $8528; + {$EXTERNALSYM GL_VARIABLE_F_NV} + GL_VARIABLE_G_NV = $8529; + {$EXTERNALSYM GL_VARIABLE_G_NV} + GL_CONSTANT_COLOR0_NV = $852A; + {$EXTERNALSYM GL_CONSTANT_COLOR0_NV} + GL_CONSTANT_COLOR1_NV = $852B; + {$EXTERNALSYM GL_CONSTANT_COLOR1_NV} + GL_PRIMARY_COLOR_NV = $852C; + {$EXTERNALSYM GL_PRIMARY_COLOR_NV} + GL_SECONDARY_COLOR_NV = $852D; + {$EXTERNALSYM GL_SECONDARY_COLOR_NV} + GL_SPARE0_NV = $852E; + {$EXTERNALSYM GL_SPARE0_NV} + GL_SPARE1_NV = $852F; + {$EXTERNALSYM GL_SPARE1_NV} + GL_DISCARD_NV = $8530; + {$EXTERNALSYM GL_DISCARD_NV} + GL_E_TIMES_F_NV = $8531; + {$EXTERNALSYM GL_E_TIMES_F_NV} + GL_SPARE0_PLUS_SECONDARY_COLOR_NV = $8532; + {$EXTERNALSYM GL_SPARE0_PLUS_SECONDARY_COLOR_NV} + GL_UNSIGNED_IDENTITY_NV = $8536; + {$EXTERNALSYM GL_UNSIGNED_IDENTITY_NV} + GL_UNSIGNED_INVERT_NV = $8537; + {$EXTERNALSYM GL_UNSIGNED_INVERT_NV} + GL_EXPAND_NORMAL_NV = $8538; + {$EXTERNALSYM GL_EXPAND_NORMAL_NV} + GL_EXPAND_NEGATE_NV = $8539; + {$EXTERNALSYM GL_EXPAND_NEGATE_NV} + GL_HALF_BIAS_NORMAL_NV = $853A; + {$EXTERNALSYM GL_HALF_BIAS_NORMAL_NV} + GL_HALF_BIAS_NEGATE_NV = $853B; + {$EXTERNALSYM GL_HALF_BIAS_NEGATE_NV} + GL_SIGNED_IDENTITY_NV = $853C; + {$EXTERNALSYM GL_SIGNED_IDENTITY_NV} + GL_SIGNED_NEGATE_NV = $853D; + {$EXTERNALSYM GL_SIGNED_NEGATE_NV} + GL_SCALE_BY_TWO_NV = $853E; + {$EXTERNALSYM GL_SCALE_BY_TWO_NV} + GL_SCALE_BY_FOUR_NV = $853F; + {$EXTERNALSYM GL_SCALE_BY_FOUR_NV} + GL_SCALE_BY_ONE_HALF_NV = $8540; + {$EXTERNALSYM GL_SCALE_BY_ONE_HALF_NV} + GL_BIAS_BY_NEGATIVE_ONE_HALF_NV = $8541; + {$EXTERNALSYM GL_BIAS_BY_NEGATIVE_ONE_HALF_NV} + GL_COMBINER_INPUT_NV = $8542; + {$EXTERNALSYM GL_COMBINER_INPUT_NV} + GL_COMBINER_MAPPING_NV = $8543; + {$EXTERNALSYM GL_COMBINER_MAPPING_NV} + GL_COMBINER_COMPONENT_USAGE_NV = $8544; + {$EXTERNALSYM GL_COMBINER_COMPONENT_USAGE_NV} + GL_COMBINER_AB_DOT_PRODUCT_NV = $8545; + {$EXTERNALSYM GL_COMBINER_AB_DOT_PRODUCT_NV} + GL_COMBINER_CD_DOT_PRODUCT_NV = $8546; + {$EXTERNALSYM GL_COMBINER_CD_DOT_PRODUCT_NV} + GL_COMBINER_MUX_SUM_NV = $8547; + {$EXTERNALSYM GL_COMBINER_MUX_SUM_NV} + GL_COMBINER_SCALE_NV = $8548; + {$EXTERNALSYM GL_COMBINER_SCALE_NV} + GL_COMBINER_BIAS_NV = $8549; + {$EXTERNALSYM GL_COMBINER_BIAS_NV} + GL_COMBINER_AB_OUTPUT_NV = $854A; + {$EXTERNALSYM GL_COMBINER_AB_OUTPUT_NV} + GL_COMBINER_CD_OUTPUT_NV = $854B; + {$EXTERNALSYM GL_COMBINER_CD_OUTPUT_NV} + GL_COMBINER_SUM_OUTPUT_NV = $854C; + {$EXTERNALSYM GL_COMBINER_SUM_OUTPUT_NV} + GL_MAX_GENERAL_COMBINERS_NV = $854D; + {$EXTERNALSYM GL_MAX_GENERAL_COMBINERS_NV} + GL_NUM_GENERAL_COMBINERS_NV = $854E; + {$EXTERNALSYM GL_NUM_GENERAL_COMBINERS_NV} + GL_COLOR_SUM_CLAMP_NV = $854F; + {$EXTERNALSYM GL_COLOR_SUM_CLAMP_NV} + GL_COMBINER0_NV = $8550; + {$EXTERNALSYM GL_COMBINER0_NV} + GL_COMBINER1_NV = $8551; + {$EXTERNALSYM GL_COMBINER1_NV} + GL_COMBINER2_NV = $8552; + {$EXTERNALSYM GL_COMBINER2_NV} + GL_COMBINER3_NV = $8553; + {$EXTERNALSYM GL_COMBINER3_NV} + GL_COMBINER4_NV = $8554; + {$EXTERNALSYM GL_COMBINER4_NV} + GL_COMBINER5_NV = $8555; + {$EXTERNALSYM GL_COMBINER5_NV} + GL_COMBINER6_NV = $8556; + {$EXTERNALSYM GL_COMBINER6_NV} + GL_COMBINER7_NV = $8557; + {$EXTERNALSYM GL_COMBINER7_NV} + + // GL_NV_fog_distance + GL_FOG_DISTANCE_MODE_NV = $855A; + {$EXTERNALSYM GL_FOG_DISTANCE_MODE_NV} + GL_EYE_RADIAL_NV = $855B; + {$EXTERNALSYM GL_EYE_RADIAL_NV} + GL_EYE_PLANE_ABSOLUTE_NV = $855C; + {$EXTERNALSYM GL_EYE_PLANE_ABSOLUTE_NV} + + // GL_NV_texgen_emboss + GL_EMBOSS_LIGHT_NV = $855D; + {$EXTERNALSYM GL_EMBOSS_LIGHT_NV} + GL_EMBOSS_CONSTANT_NV = $855E; + {$EXTERNALSYM GL_EMBOSS_CONSTANT_NV} + GL_EMBOSS_MAP_NV = $855F; + {$EXTERNALSYM GL_EMBOSS_MAP_NV} + + // GL_EXT_texture_compression_s3tc + GL_COMPRESSED_RGB_S3TC_DXT1_EXT = $83F0; + {$EXTERNALSYM GL_COMPRESSED_RGB_S3TC_DXT1_EXT} + GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = $83F1; + {$EXTERNALSYM GL_COMPRESSED_RGBA_S3TC_DXT1_EXT} + GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = $83F2; + {$EXTERNALSYM GL_COMPRESSED_RGBA_S3TC_DXT3_EXT} + GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = $83F3; + {$EXTERNALSYM GL_COMPRESSED_RGBA_S3TC_DXT5_EXT} + + // GL_IBM_cull_vertex + GL_CULL_VERTEX_IBM = 103050; + {$EXTERNALSYM GL_CULL_VERTEX_IBM} + + // GL_IBM_vertex_array_lists + GL_VERTEX_ARRAY_LIST_IBM = 103070; + {$EXTERNALSYM GL_VERTEX_ARRAY_LIST_IBM} + GL_NORMAL_ARRAY_LIST_IBM = 103071; + {$EXTERNALSYM GL_NORMAL_ARRAY_LIST_IBM} + GL_COLOR_ARRAY_LIST_IBM = 103072; + {$EXTERNALSYM GL_COLOR_ARRAY_LIST_IBM} + GL_INDEX_ARRAY_LIST_IBM = 103073; + {$EXTERNALSYM GL_INDEX_ARRAY_LIST_IBM} + GL_TEXTURE_COORD_ARRAY_LIST_IBM = 103074; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_LIST_IBM} + GL_EDGE_FLAG_ARRAY_LIST_IBM = 103075; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_LIST_IBM} + GL_FOG_COORDINATE_ARRAY_LIST_IBM = 103076; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_LIST_IBM} + GL_SECONDARY_COLOR_ARRAY_LIST_IBM = 103077; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_LIST_IBM} + GL_VERTEX_ARRAY_LIST_STRIDE_IBM = 103080; + {$EXTERNALSYM GL_VERTEX_ARRAY_LIST_STRIDE_IBM} + GL_NORMAL_ARRAY_LIST_STRIDE_IBM = 103081; + {$EXTERNALSYM GL_NORMAL_ARRAY_LIST_STRIDE_IBM} + GL_COLOR_ARRAY_LIST_STRIDE_IBM = 103082; + {$EXTERNALSYM GL_COLOR_ARRAY_LIST_STRIDE_IBM} + GL_INDEX_ARRAY_LIST_STRIDE_IBM = 103083; + {$EXTERNALSYM GL_INDEX_ARRAY_LIST_STRIDE_IBM} + GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM = 103084; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM} + GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM = 103085; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM} + GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM = 103086; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM} + GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM = 103087; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM} + + // GL_SGIX_subsample + GL_PACK_SUBSAMPLE_RATE_SGIX = $85A0; + {$EXTERNALSYM GL_PACK_SUBSAMPLE_RATE_SGIX} + GL_UNPACK_SUBSAMPLE_RATE_SGIX = $85A1; + {$EXTERNALSYM GL_UNPACK_SUBSAMPLE_RATE_SGIX} + GL_PIXEL_SUBSAMPLE_4444_SGIX = $85A2; + {$EXTERNALSYM GL_PIXEL_SUBSAMPLE_4444_SGIX} + GL_PIXEL_SUBSAMPLE_2424_SGIX = $85A3; + {$EXTERNALSYM GL_PIXEL_SUBSAMPLE_2424_SGIX} + GL_PIXEL_SUBSAMPLE_4242_SGIX = $85A4; + {$EXTERNALSYM GL_PIXEL_SUBSAMPLE_4242_SGIX} + + // GL_SGIX_ycrcba + GL_YCRCB_SGIX = $8318; + {$EXTERNALSYM GL_YCRCB_SGIX} + GL_YCRCBA_SGIX = $8319; + {$EXTERNALSYM GL_YCRCBA_SGIX} + + // GL_SGI_depth_pass_instrument + GL_DEPTH_PASS_INSTRUMENT_SGIX = $8310; + {$EXTERNALSYM GL_DEPTH_PASS_INSTRUMENT_SGIX} + GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX = $8311; + {$EXTERNALSYM GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX} + GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX = $8312; + {$EXTERNALSYM GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX} + + // GL_3DFX_texture_compression_FXT1 + GL_COMPRESSED_RGB_FXT1_3DFX = $86B0; + {$EXTERNALSYM GL_COMPRESSED_RGB_FXT1_3DFX} + GL_COMPRESSED_RGBA_FXT1_3DFX = $86B1; + {$EXTERNALSYM GL_COMPRESSED_RGBA_FXT1_3DFX} + + // GL_3DFX_multisample + GL_MULTISAMPLE_3DFX = $86B2; + {$EXTERNALSYM GL_MULTISAMPLE_3DFX} + GL_SAMPLE_BUFFERS_3DFX = $86B3; + {$EXTERNALSYM GL_SAMPLE_BUFFERS_3DFX} + GL_SAMPLES_3DFX = $86B4; + {$EXTERNALSYM GL_SAMPLES_3DFX} + GL_MULTISAMPLE_BIT_3DFX = $20000000; + {$EXTERNALSYM GL_MULTISAMPLE_BIT_3DFX} + + // GL_EXT_multisample + GL_MULTISAMPLE_EXT = $809D; + {$EXTERNALSYM GL_MULTISAMPLE_EXT} + GL_SAMPLE_ALPHA_TO_MASK_EXT = $809E; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_MASK_EXT} + GL_SAMPLE_ALPHA_TO_ONE_EXT = $809F; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_ONE_EXT} + GL_SAMPLE_MASK_EXT = $80A0; + {$EXTERNALSYM GL_SAMPLE_MASK_EXT} + GL_1PASS_EXT = $80A1; + {$EXTERNALSYM GL_1PASS_EXT} + GL_2PASS_0_EXT = $80A2; + {$EXTERNALSYM GL_2PASS_0_EXT} + GL_2PASS_1_EXT = $80A3; + {$EXTERNALSYM GL_2PASS_1_EXT} + GL_4PASS_0_EXT = $80A4; + {$EXTERNALSYM GL_4PASS_0_EXT} + GL_4PASS_1_EXT = $80A5; + {$EXTERNALSYM GL_4PASS_1_EXT} + GL_4PASS_2_EXT = $80A6; + {$EXTERNALSYM GL_4PASS_2_EXT} + GL_4PASS_3_EXT = $80A7; + {$EXTERNALSYM GL_4PASS_3_EXT} + GL_SAMPLE_BUFFERS_EXT = $80A8; + {$EXTERNALSYM GL_SAMPLE_BUFFERS_EXT} + GL_SAMPLES_EXT = $80A9; + {$EXTERNALSYM GL_SAMPLES_EXT} + GL_SAMPLE_MASK_VALUE_EXT = $80AA; + {$EXTERNALSYM GL_SAMPLE_MASK_VALUE_EXT} + GL_SAMPLE_MASK_INVERT_EXT = $80AB; + {$EXTERNALSYM GL_SAMPLE_MASK_INVERT_EXT} + GL_SAMPLE_PATTERN_EXT = $80AC; + {$EXTERNALSYM GL_SAMPLE_PATTERN_EXT} + + // GL_SGIX_vertex_preclip + GL_VERTEX_PRECLIP_SGIX = $83EE; + {$EXTERNALSYM GL_VERTEX_PRECLIP_SGIX} + GL_VERTEX_PRECLIP_HINT_SGIX = $83EF; + {$EXTERNALSYM GL_VERTEX_PRECLIP_HINT_SGIX} + + // GL_SGIX_convolution_accuracy + GL_CONVOLUTION_HINT_SGIX = $8316; + {$EXTERNALSYM GL_CONVOLUTION_HINT_SGIX} + + // GL_SGIX_resample + GL_PACK_RESAMPLE_SGIX = $842C; + {$EXTERNALSYM GL_PACK_RESAMPLE_SGIX} + GL_UNPACK_RESAMPLE_SGIX = $842D; + {$EXTERNALSYM GL_UNPACK_RESAMPLE_SGIX} + GL_RESAMPLE_REPLICATE_SGIX = $842E; + {$EXTERNALSYM GL_RESAMPLE_REPLICATE_SGIX} + GL_RESAMPLE_ZERO_FILL_SGIX = $842F; + {$EXTERNALSYM GL_RESAMPLE_ZERO_FILL_SGIX} + GL_RESAMPLE_DECIMATE_SGIX = $8430; + {$EXTERNALSYM GL_RESAMPLE_DECIMATE_SGIX} + + // GL_SGIS_point_line_texgen + GL_EYE_DISTANCE_TO_POINT_SGIS = $81F0; + {$EXTERNALSYM GL_EYE_DISTANCE_TO_POINT_SGIS} + GL_OBJECT_DISTANCE_TO_POINT_SGIS = $81F1; + {$EXTERNALSYM GL_OBJECT_DISTANCE_TO_POINT_SGIS} + GL_EYE_DISTANCE_TO_LINE_SGIS = $81F2; + {$EXTERNALSYM GL_EYE_DISTANCE_TO_LINE_SGIS} + GL_OBJECT_DISTANCE_TO_LINE_SGIS = $81F3; + {$EXTERNALSYM GL_OBJECT_DISTANCE_TO_LINE_SGIS} + GL_EYE_POINT_SGIS = $81F4; + {$EXTERNALSYM GL_EYE_POINT_SGIS} + GL_OBJECT_POINT_SGIS = $81F5; + {$EXTERNALSYM GL_OBJECT_POINT_SGIS} + GL_EYE_LINE_SGIS = $81F6; + {$EXTERNALSYM GL_EYE_LINE_SGIS} + GL_OBJECT_LINE_SGIS = $81F7; + {$EXTERNALSYM GL_OBJECT_LINE_SGIS} + + // GL_SGIS_texture_color_mask + GL_TEXTURE_COLOR_WRITEMASK_SGIS = $81EF; + {$EXTERNALSYM GL_TEXTURE_COLOR_WRITEMASK_SGIS} + + // GL_NV_vertex_program + GL_VERTEX_PROGRAM_NV = $8620; + {$EXTERNALSYM GL_VERTEX_PROGRAM_NV} + GL_VERTEX_STATE_PROGRAM_NV = $8621; + {$EXTERNALSYM GL_VERTEX_STATE_PROGRAM_NV} + GL_ATTRIB_ARRAY_SIZE_NV = $8623; + {$EXTERNALSYM GL_ATTRIB_ARRAY_SIZE_NV} + GL_ATTRIB_ARRAY_STRIDE_NV = $8624; + {$EXTERNALSYM GL_ATTRIB_ARRAY_STRIDE_NV} + GL_ATTRIB_ARRAY_TYPE_NV = $8625; + {$EXTERNALSYM GL_ATTRIB_ARRAY_TYPE_NV} + GL_CURRENT_ATTRIB_NV = $8626; + {$EXTERNALSYM GL_CURRENT_ATTRIB_NV} + GL_PROGRAM_LENGTH_NV = $8627; + {$EXTERNALSYM GL_PROGRAM_LENGTH_NV} + GL_PROGRAM_STRING_NV = $8628; + {$EXTERNALSYM GL_PROGRAM_STRING_NV} + GL_MODELVIEW_PROJECTION_NV = $8629; + {$EXTERNALSYM GL_MODELVIEW_PROJECTION_NV} + GL_IDENTITY_NV = $862A; + {$EXTERNALSYM GL_IDENTITY_NV} + GL_INVERSE_NV = $862B; + {$EXTERNALSYM GL_INVERSE_NV} + GL_TRANSPOSE_NV = $862C; + {$EXTERNALSYM GL_TRANSPOSE_NV} + GL_INVERSE_TRANSPOSE_NV = $862D; + {$EXTERNALSYM GL_INVERSE_TRANSPOSE_NV} + GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV = $862E; + {$EXTERNALSYM GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV} + GL_MAX_TRACK_MATRICES_NV = $862F; + {$EXTERNALSYM GL_MAX_TRACK_MATRICES_NV} + GL_MATRIX0_NV = $8630; + {$EXTERNALSYM GL_MATRIX0_NV} + GL_MATRIX1_NV = $8631; + {$EXTERNALSYM GL_MATRIX1_NV} + GL_MATRIX2_NV = $8632; + {$EXTERNALSYM GL_MATRIX2_NV} + GL_MATRIX3_NV = $8633; + {$EXTERNALSYM GL_MATRIX3_NV} + GL_MATRIX4_NV = $8634; + {$EXTERNALSYM GL_MATRIX4_NV} + GL_MATRIX5_NV = $8635; + {$EXTERNALSYM GL_MATRIX5_NV} + GL_MATRIX6_NV = $8636; + {$EXTERNALSYM GL_MATRIX6_NV} + GL_MATRIX7_NV = $8637; + {$EXTERNALSYM GL_MATRIX7_NV} + GL_CURRENT_MATRIX_STACK_DEPTH_NV = $8640; + {$EXTERNALSYM GL_CURRENT_MATRIX_STACK_DEPTH_NV} + GL_CURRENT_MATRIX_NV = $8641; + {$EXTERNALSYM GL_CURRENT_MATRIX_NV} + GL_VERTEX_PROGRAM_POINT_SIZE_NV = $8642; + {$EXTERNALSYM GL_VERTEX_PROGRAM_POINT_SIZE_NV} + GL_VERTEX_PROGRAM_TWO_SIDE_NV = $8643; + {$EXTERNALSYM GL_VERTEX_PROGRAM_TWO_SIDE_NV} + GL_PROGRAM_PARAMETER_NV = $8644; + {$EXTERNALSYM GL_PROGRAM_PARAMETER_NV} + GL_ATTRIB_ARRAY_POINTER_NV = $8645; + {$EXTERNALSYM GL_ATTRIB_ARRAY_POINTER_NV} + GL_PROGRAM_TARGET_NV = $8646; + {$EXTERNALSYM GL_PROGRAM_TARGET_NV} + GL_PROGRAM_RESIDENT_NV = $8647; + {$EXTERNALSYM GL_PROGRAM_RESIDENT_NV} + GL_TRACK_MATRIX_NV = $8648; + {$EXTERNALSYM GL_TRACK_MATRIX_NV} + GL_TRACK_MATRIX_TRANSFORM_NV = $8649; + {$EXTERNALSYM GL_TRACK_MATRIX_TRANSFORM_NV} + GL_VERTEX_PROGRAM_BINDING_NV = $864A; + {$EXTERNALSYM GL_VERTEX_PROGRAM_BINDING_NV} + GL_PROGRAM_ERROR_POSITION_NV = $864B; + {$EXTERNALSYM GL_PROGRAM_ERROR_POSITION_NV} + GL_VERTEX_ATTRIB_ARRAY0_NV = $8650; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY0_NV} + GL_VERTEX_ATTRIB_ARRAY1_NV = $8651; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY1_NV} + GL_VERTEX_ATTRIB_ARRAY2_NV = $8652; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY2_NV} + GL_VERTEX_ATTRIB_ARRAY3_NV = $8653; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY3_NV} + GL_VERTEX_ATTRIB_ARRAY4_NV = $8654; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY4_NV} + GL_VERTEX_ATTRIB_ARRAY5_NV = $8655; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY5_NV} + GL_VERTEX_ATTRIB_ARRAY6_NV = $8656; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY6_NV} + GL_VERTEX_ATTRIB_ARRAY7_NV = $8657; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY7_NV} + GL_VERTEX_ATTRIB_ARRAY8_NV = $8658; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY8_NV} + GL_VERTEX_ATTRIB_ARRAY9_NV = $8659; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY9_NV} + GL_VERTEX_ATTRIB_ARRAY10_NV = $865A; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY10_NV} + GL_VERTEX_ATTRIB_ARRAY11_NV = $865B; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY11_NV} + GL_VERTEX_ATTRIB_ARRAY12_NV = $865C; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY12_NV} + GL_VERTEX_ATTRIB_ARRAY13_NV = $865D; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY13_NV} + GL_VERTEX_ATTRIB_ARRAY14_NV = $865E; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY14_NV} + GL_VERTEX_ATTRIB_ARRAY15_NV = $865F; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY15_NV} + GL_MAP1_VERTEX_ATTRIB0_4_NV = $8660; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB0_4_NV} + GL_MAP1_VERTEX_ATTRIB1_4_NV = $8661; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB1_4_NV} + GL_MAP1_VERTEX_ATTRIB2_4_NV = $8662; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB2_4_NV} + GL_MAP1_VERTEX_ATTRIB3_4_NV = $8663; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB3_4_NV} + GL_MAP1_VERTEX_ATTRIB4_4_NV = $8664; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB4_4_NV} + GL_MAP1_VERTEX_ATTRIB5_4_NV = $8665; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB5_4_NV} + GL_MAP1_VERTEX_ATTRIB6_4_NV = $8666; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB6_4_NV} + GL_MAP1_VERTEX_ATTRIB7_4_NV = $8667; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB7_4_NV} + GL_MAP1_VERTEX_ATTRIB8_4_NV = $8668; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB8_4_NV} + GL_MAP1_VERTEX_ATTRIB9_4_NV = $8669; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB9_4_NV} + GL_MAP1_VERTEX_ATTRIB10_4_NV = $866A; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB10_4_NV} + GL_MAP1_VERTEX_ATTRIB11_4_NV = $866B; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB11_4_NV} + GL_MAP1_VERTEX_ATTRIB12_4_NV = $866C; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB12_4_NV} + GL_MAP1_VERTEX_ATTRIB13_4_NV = $866D; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB13_4_NV} + GL_MAP1_VERTEX_ATTRIB14_4_NV = $866E; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB14_4_NV} + GL_MAP1_VERTEX_ATTRIB15_4_NV = $866F; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB15_4_NV} + GL_MAP2_VERTEX_ATTRIB0_4_NV = $8670; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB0_4_NV} + GL_MAP2_VERTEX_ATTRIB1_4_NV = $8671; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB1_4_NV} + GL_MAP2_VERTEX_ATTRIB2_4_NV = $8672; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB2_4_NV} + GL_MAP2_VERTEX_ATTRIB3_4_NV = $8673; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB3_4_NV} + GL_MAP2_VERTEX_ATTRIB4_4_NV = $8674; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB4_4_NV} + GL_MAP2_VERTEX_ATTRIB5_4_NV = $8675; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB5_4_NV} + GL_MAP2_VERTEX_ATTRIB6_4_NV = $8676; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB6_4_NV} + GL_MAP2_VERTEX_ATTRIB7_4_NV = $8677; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB7_4_NV} + GL_MAP2_VERTEX_ATTRIB8_4_NV = $8678; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB8_4_NV} + GL_MAP2_VERTEX_ATTRIB9_4_NV = $8679; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB9_4_NV} + GL_MAP2_VERTEX_ATTRIB10_4_NV = $867A; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB10_4_NV} + GL_MAP2_VERTEX_ATTRIB11_4_NV = $867B; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB11_4_NV} + GL_MAP2_VERTEX_ATTRIB12_4_NV = $867C; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB12_4_NV} + GL_MAP2_VERTEX_ATTRIB13_4_NV = $867D; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB13_4_NV} + GL_MAP2_VERTEX_ATTRIB14_4_NV = $867E; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB14_4_NV} + GL_MAP2_VERTEX_ATTRIB15_4_NV = $867F; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB15_4_NV} + + // WGL_ARB_pixel_format + WGL_NUMBER_PIXEL_FORMATS_ARB = $2000; + {$EXTERNALSYM WGL_NUMBER_PIXEL_FORMATS_ARB} + WGL_DRAW_TO_WINDOW_ARB = $2001; + {$EXTERNALSYM WGL_DRAW_TO_WINDOW_ARB} + WGL_DRAW_TO_BITMAP_ARB = $2002; + {$EXTERNALSYM WGL_DRAW_TO_BITMAP_ARB} + WGL_ACCELERATION_ARB = $2003; + {$EXTERNALSYM WGL_ACCELERATION_ARB} + WGL_NEED_PALETTE_ARB = $2004; + {$EXTERNALSYM WGL_NEED_PALETTE_ARB} + WGL_NEED_SYSTEM_PALETTE_ARB = $2005; + {$EXTERNALSYM WGL_NEED_SYSTEM_PALETTE_ARB} + WGL_SWAP_LAYER_BUFFERS_ARB = $2006; + {$EXTERNALSYM WGL_SWAP_LAYER_BUFFERS_ARB} + WGL_SWAP_METHOD_ARB = $2007; + {$EXTERNALSYM WGL_SWAP_METHOD_ARB} + WGL_NUMBER_OVERLAYS_ARB = $2008; + {$EXTERNALSYM WGL_NUMBER_OVERLAYS_ARB} + WGL_NUMBER_UNDERLAYS_ARB = $2009; + {$EXTERNALSYM WGL_NUMBER_UNDERLAYS_ARB} + WGL_TRANSPARENT_ARB = $200A; + {$EXTERNALSYM WGL_TRANSPARENT_ARB} + WGL_TRANSPARENT_RED_VALUE_ARB = $2037; + {$EXTERNALSYM WGL_TRANSPARENT_RED_VALUE_ARB} + WGL_TRANSPARENT_GREEN_VALUE_ARB = $2038; + {$EXTERNALSYM WGL_TRANSPARENT_GREEN_VALUE_ARB} + WGL_TRANSPARENT_BLUE_VALUE_ARB = $2039; + {$EXTERNALSYM WGL_TRANSPARENT_BLUE_VALUE_ARB} + WGL_TRANSPARENT_ALPHA_VALUE_ARB = $203A; + {$EXTERNALSYM WGL_TRANSPARENT_ALPHA_VALUE_ARB} + WGL_TRANSPARENT_INDEX_VALUE_ARB = $203B; + {$EXTERNALSYM WGL_TRANSPARENT_INDEX_VALUE_ARB} + WGL_SHARE_DEPTH_ARB = $200C; + {$EXTERNALSYM WGL_SHARE_DEPTH_ARB} + WGL_SHARE_STENCIL_ARB = $200D; + {$EXTERNALSYM WGL_SHARE_STENCIL_ARB} + WGL_SHARE_ACCUM_ARB = $200E; + {$EXTERNALSYM WGL_SHARE_ACCUM_ARB} + WGL_SUPPORT_GDI_ARB = $200F; + {$EXTERNALSYM WGL_SUPPORT_GDI_ARB} + WGL_SUPPORT_OPENGL_ARB = $2010; + {$EXTERNALSYM WGL_SUPPORT_OPENGL_ARB} + WGL_DOUBLE_BUFFER_ARB = $2011; + {$EXTERNALSYM WGL_DOUBLE_BUFFER_ARB} + WGL_STEREO_ARB = $2012; + {$EXTERNALSYM WGL_STEREO_ARB} + WGL_PIXEL_TYPE_ARB = $2013; + {$EXTERNALSYM WGL_PIXEL_TYPE_ARB} + WGL_COLOR_BITS_ARB = $2014; + {$EXTERNALSYM WGL_COLOR_BITS_ARB} + WGL_RED_BITS_ARB = $2015; + {$EXTERNALSYM WGL_RED_BITS_ARB} + WGL_RED_SHIFT_ARB = $2016; + {$EXTERNALSYM WGL_RED_SHIFT_ARB} + WGL_GREEN_BITS_ARB = $2017; + {$EXTERNALSYM WGL_GREEN_BITS_ARB} + WGL_GREEN_SHIFT_ARB = $2018; + {$EXTERNALSYM WGL_GREEN_SHIFT_ARB} + WGL_BLUE_BITS_ARB = $2019; + {$EXTERNALSYM WGL_BLUE_BITS_ARB} + WGL_BLUE_SHIFT_ARB = $201A; + {$EXTERNALSYM WGL_BLUE_SHIFT_ARB} + WGL_ALPHA_BITS_ARB = $201B; + {$EXTERNALSYM WGL_ALPHA_BITS_ARB} + WGL_ALPHA_SHIFT_ARB = $201C; + {$EXTERNALSYM WGL_ALPHA_SHIFT_ARB} + WGL_ACCUM_BITS_ARB = $201D; + {$EXTERNALSYM WGL_ACCUM_BITS_ARB} + WGL_ACCUM_RED_BITS_ARB = $201E; + {$EXTERNALSYM WGL_ACCUM_RED_BITS_ARB} + WGL_ACCUM_GREEN_BITS_ARB = $201F; + {$EXTERNALSYM WGL_ACCUM_GREEN_BITS_ARB} + WGL_ACCUM_BLUE_BITS_ARB = $2020; + {$EXTERNALSYM WGL_ACCUM_BLUE_BITS_ARB} + WGL_ACCUM_ALPHA_BITS_ARB = $2021; + {$EXTERNALSYM WGL_ACCUM_ALPHA_BITS_ARB} + WGL_DEPTH_BITS_ARB = $2022; + {$EXTERNALSYM WGL_DEPTH_BITS_ARB} + WGL_STENCIL_BITS_ARB = $2023; + {$EXTERNALSYM WGL_STENCIL_BITS_ARB} + WGL_AUX_BUFFERS_ARB = $2024; + {$EXTERNALSYM WGL_AUX_BUFFERS_ARB} + WGL_NO_ACCELERATION_ARB = $2025; + {$EXTERNALSYM WGL_NO_ACCELERATION_ARB} + WGL_GENERIC_ACCELERATION_ARB = $2026; + {$EXTERNALSYM WGL_GENERIC_ACCELERATION_ARB} + WGL_FULL_ACCELERATION_ARB = $2027; + {$EXTERNALSYM WGL_FULL_ACCELERATION_ARB} + WGL_SWAP_EXCHANGE_ARB = $2028; + {$EXTERNALSYM WGL_SWAP_EXCHANGE_ARB} + WGL_SWAP_COPY_ARB = $2029; + {$EXTERNALSYM WGL_SWAP_COPY_ARB} + WGL_SWAP_UNDEFINED_ARB = $202A; + {$EXTERNALSYM WGL_SWAP_UNDEFINED_ARB} + WGL_TYPE_RGBA_ARB = $202B; + {$EXTERNALSYM WGL_TYPE_RGBA_ARB} + WGL_TYPE_COLORINDEX_ARB = $202C; + {$EXTERNALSYM WGL_TYPE_COLORINDEX_ARB} + + + // ********** GLU generic constants ********** + + // Errors: (return value 0 = no error) + GLU_INVALID_ENUM = 100900; + {$EXTERNALSYM GLU_INVALID_ENUM} + GLU_INVALID_VALUE = 100901; + {$EXTERNALSYM GLU_INVALID_VALUE} + GLU_OUT_OF_MEMORY = 100902; + {$EXTERNALSYM GLU_OUT_OF_MEMORY} + GLU_INCOMPATIBLE_GL_VERSION = 100903; + {$EXTERNALSYM GLU_INCOMPATIBLE_GL_VERSION} + + // StringName + GLU_VERSION = 100800; + {$EXTERNALSYM GLU_VERSION} + GLU_EXTENSIONS = 100801; + {$EXTERNALSYM GLU_EXTENSIONS} + + // Boolean + GLU_TRUE = GL_TRUE; + {$EXTERNALSYM GLU_TRUE} + GLU_FALSE = GL_FALSE; + {$EXTERNALSYM GLU_FALSE} + + // Quadric constants + // QuadricNormal + GLU_SMOOTH = 100000; + {$EXTERNALSYM GLU_SMOOTH} + GLU_FLAT = 100001; + {$EXTERNALSYM GLU_FLAT} + GLU_NONE = 100002; + {$EXTERNALSYM GLU_NONE} + + // QuadricDrawStyle + GLU_POINT = 100010; + {$EXTERNALSYM GLU_POINT} + GLU_LINE = 100011; + {$EXTERNALSYM GLU_LINE} + GLU_FILL = 100012; + {$EXTERNALSYM GLU_FILL} + GLU_SILHOUETTE = 100013; + {$EXTERNALSYM GLU_SILHOUETTE} + + // QuadricOrientation + GLU_OUTSIDE = 100020; + {$EXTERNALSYM GLU_OUTSIDE} + GLU_INSIDE = 100021; + {$EXTERNALSYM GLU_INSIDE} + + // Tesselation constants + GLU_TESS_MAX_COORD = 1.0e150; + {$EXTERNALSYM GLU_TESS_MAX_COORD} + + // TessProperty + GLU_TESS_WINDING_RULE = 100140; + {$EXTERNALSYM GLU_TESS_WINDING_RULE} + GLU_TESS_BOUNDARY_ONLY = 100141; + {$EXTERNALSYM GLU_TESS_BOUNDARY_ONLY} + GLU_TESS_TOLERANCE = 100142; + {$EXTERNALSYM GLU_TESS_TOLERANCE} + + // TessWinding + GLU_TESS_WINDING_ODD = 100130; + {$EXTERNALSYM GLU_TESS_WINDING_ODD} + GLU_TESS_WINDING_NONZERO = 100131; + {$EXTERNALSYM GLU_TESS_WINDING_NONZERO} + GLU_TESS_WINDING_POSITIVE = 100132; + {$EXTERNALSYM GLU_TESS_WINDING_POSITIVE} + GLU_TESS_WINDING_NEGATIVE = 100133; + {$EXTERNALSYM GLU_TESS_WINDING_NEGATIVE} + GLU_TESS_WINDING_ABS_GEQ_TWO = 100134; + {$EXTERNALSYM GLU_TESS_WINDING_ABS_GEQ_TWO} + + // TessCallback + GLU_TESS_BEGIN = 100100; // TGLUTessBeginProc + {$EXTERNALSYM GLU_TESS_BEGIN} + GLU_TESS_VERTEX = 100101; // TGLUTessVertexProc + {$EXTERNALSYM GLU_TESS_VERTEX} + GLU_TESS_END = 100102; // TGLUTessEndProc + {$EXTERNALSYM GLU_TESS_END} + GLU_TESS_ERROR = 100103; // TGLUTessErrorProc + {$EXTERNALSYM GLU_TESS_ERROR} + GLU_TESS_EDGE_FLAG = 100104; // TGLUTessEdgeFlagProc + {$EXTERNALSYM GLU_TESS_EDGE_FLAG} + GLU_TESS_COMBINE = 100105; // TGLUTessCombineProc + {$EXTERNALSYM GLU_TESS_COMBINE} + GLU_TESS_BEGIN_DATA = 100106; // TGLUTessBeginDataProc + {$EXTERNALSYM GLU_TESS_BEGIN_DATA} + GLU_TESS_VERTEX_DATA = 100107; // TGLUTessVertexDataProc + {$EXTERNALSYM GLU_TESS_VERTEX_DATA} + GLU_TESS_END_DATA = 100108; // TGLUTessEndDataProc + {$EXTERNALSYM GLU_TESS_END_DATA} + GLU_TESS_ERROR_DATA = 100109; // TGLUTessErrorDataProc + {$EXTERNALSYM GLU_TESS_ERROR_DATA} + GLU_TESS_EDGE_FLAG_DATA = 100110; // TGLUTessEdgeFlagDataProc + {$EXTERNALSYM GLU_TESS_EDGE_FLAG_DATA} + GLU_TESS_COMBINE_DATA = 100111; // TGLUTessCombineDataProc + {$EXTERNALSYM GLU_TESS_COMBINE_DATA} + + // TessError + GLU_TESS_ERROR1 = 100151; + {$EXTERNALSYM GLU_TESS_ERROR1} + GLU_TESS_ERROR2 = 100152; + {$EXTERNALSYM GLU_TESS_ERROR2} + GLU_TESS_ERROR3 = 100153; + {$EXTERNALSYM GLU_TESS_ERROR3} + GLU_TESS_ERROR4 = 100154; + {$EXTERNALSYM GLU_TESS_ERROR4} + GLU_TESS_ERROR5 = 100155; + {$EXTERNALSYM GLU_TESS_ERROR5} + GLU_TESS_ERROR6 = 100156; + {$EXTERNALSYM GLU_TESS_ERROR6} + GLU_TESS_ERROR7 = 100157; + {$EXTERNALSYM GLU_TESS_ERROR7} + GLU_TESS_ERROR8 = 100158; + {$EXTERNALSYM GLU_TESS_ERROR8} + + GLU_TESS_MISSING_BEGIN_POLYGON = GLU_TESS_ERROR1; + {$EXTERNALSYM GLU_TESS_MISSING_BEGIN_POLYGON} + GLU_TESS_MISSING_BEGIN_CONTOUR = GLU_TESS_ERROR2; + {$EXTERNALSYM GLU_TESS_MISSING_BEGIN_CONTOUR} + GLU_TESS_MISSING_END_POLYGON = GLU_TESS_ERROR3; + {$EXTERNALSYM GLU_TESS_MISSING_END_POLYGON} + GLU_TESS_MISSING_END_CONTOUR = GLU_TESS_ERROR4; + {$EXTERNALSYM GLU_TESS_MISSING_END_CONTOUR} + GLU_TESS_COORD_TOO_LARGE = GLU_TESS_ERROR5; + {$EXTERNALSYM GLU_TESS_COORD_TOO_LARGE} + GLU_TESS_NEED_COMBINE_CALLBACK = GLU_TESS_ERROR6; + {$EXTERNALSYM GLU_TESS_NEED_COMBINE_CALLBACK} + + // NURBS constants + + // NurbsProperty + GLU_AUTO_LOAD_MATRIX = 100200; + {$EXTERNALSYM GLU_AUTO_LOAD_MATRIX} + GLU_CULLING = 100201; + {$EXTERNALSYM GLU_CULLING} + GLU_SAMPLING_TOLERANCE = 100203; + {$EXTERNALSYM GLU_SAMPLING_TOLERANCE} + GLU_DISPLAY_MODE = 100204; + {$EXTERNALSYM GLU_DISPLAY_MODE} + GLU_PARAMETRIC_TOLERANCE = 100202; + {$EXTERNALSYM GLU_PARAMETRIC_TOLERANCE} + GLU_SAMPLING_METHOD = 100205; + {$EXTERNALSYM GLU_SAMPLING_METHOD} + GLU_U_STEP = 100206; + {$EXTERNALSYM GLU_U_STEP} + GLU_V_STEP = 100207; + {$EXTERNALSYM GLU_V_STEP} + + // NurbsSampling + GLU_PATH_LENGTH = 100215; + {$EXTERNALSYM GLU_PATH_LENGTH} + GLU_PARAMETRIC_ERROR = 100216; + {$EXTERNALSYM GLU_PARAMETRIC_ERROR} + GLU_DOMAIN_DISTANCE = 100217; + {$EXTERNALSYM GLU_DOMAIN_DISTANCE} + + // NurbsTrim + GLU_MAP1_TRIM_2 = 100210; + {$EXTERNALSYM GLU_MAP1_TRIM_2} + GLU_MAP1_TRIM_3 = 100211; + {$EXTERNALSYM GLU_MAP1_TRIM_3} + + // NurbsDisplay + GLU_OUTLINE_POLYGON = 100240; + {$EXTERNALSYM GLU_OUTLINE_POLYGON} + GLU_OUTLINE_PATCH = 100241; + {$EXTERNALSYM GLU_OUTLINE_PATCH} + + // NurbsErrors + GLU_NURBS_ERROR1 = 100251; + {$EXTERNALSYM GLU_NURBS_ERROR1} + GLU_NURBS_ERROR2 = 100252; + {$EXTERNALSYM GLU_NURBS_ERROR2} + GLU_NURBS_ERROR3 = 100253; + {$EXTERNALSYM GLU_NURBS_ERROR3} + GLU_NURBS_ERROR4 = 100254; + {$EXTERNALSYM GLU_NURBS_ERROR4} + GLU_NURBS_ERROR5 = 100255; + {$EXTERNALSYM GLU_NURBS_ERROR5} + GLU_NURBS_ERROR6 = 100256; + {$EXTERNALSYM GLU_NURBS_ERROR6} + GLU_NURBS_ERROR7 = 100257; + {$EXTERNALSYM GLU_NURBS_ERROR7} + GLU_NURBS_ERROR8 = 100258; + {$EXTERNALSYM GLU_NURBS_ERROR8} + GLU_NURBS_ERROR9 = 100259; + {$EXTERNALSYM GLU_NURBS_ERROR9} + GLU_NURBS_ERROR10 = 100260; + {$EXTERNALSYM GLU_NURBS_ERROR10} + GLU_NURBS_ERROR11 = 100261; + {$EXTERNALSYM GLU_NURBS_ERROR11} + GLU_NURBS_ERROR12 = 100262; + {$EXTERNALSYM GLU_NURBS_ERROR12} + GLU_NURBS_ERROR13 = 100263; + {$EXTERNALSYM GLU_NURBS_ERROR13} + GLU_NURBS_ERROR14 = 100264; + {$EXTERNALSYM GLU_NURBS_ERROR14} + GLU_NURBS_ERROR15 = 100265; + {$EXTERNALSYM GLU_NURBS_ERROR15} + GLU_NURBS_ERROR16 = 100266; + {$EXTERNALSYM GLU_NURBS_ERROR16} + GLU_NURBS_ERROR17 = 100267; + {$EXTERNALSYM GLU_NURBS_ERROR17} + GLU_NURBS_ERROR18 = 100268; + {$EXTERNALSYM GLU_NURBS_ERROR18} + GLU_NURBS_ERROR19 = 100269; + {$EXTERNALSYM GLU_NURBS_ERROR19} + GLU_NURBS_ERROR20 = 100270; + {$EXTERNALSYM GLU_NURBS_ERROR20} + GLU_NURBS_ERROR21 = 100271; + {$EXTERNALSYM GLU_NURBS_ERROR21} + GLU_NURBS_ERROR22 = 100272; + {$EXTERNALSYM GLU_NURBS_ERROR22} + GLU_NURBS_ERROR23 = 100273; + {$EXTERNALSYM GLU_NURBS_ERROR23} + GLU_NURBS_ERROR24 = 100274; + {$EXTERNALSYM GLU_NURBS_ERROR24} + GLU_NURBS_ERROR25 = 100275; + {$EXTERNALSYM GLU_NURBS_ERROR25} + GLU_NURBS_ERROR26 = 100276; + {$EXTERNALSYM GLU_NURBS_ERROR26} + GLU_NURBS_ERROR27 = 100277; + {$EXTERNALSYM GLU_NURBS_ERROR27} + GLU_NURBS_ERROR28 = 100278; + {$EXTERNALSYM GLU_NURBS_ERROR28} + GLU_NURBS_ERROR29 = 100279; + {$EXTERNALSYM GLU_NURBS_ERROR29} + GLU_NURBS_ERROR30 = 100280; + {$EXTERNALSYM GLU_NURBS_ERROR30} + GLU_NURBS_ERROR31 = 100281; + {$EXTERNALSYM GLU_NURBS_ERROR31} + GLU_NURBS_ERROR32 = 100282; + {$EXTERNALSYM GLU_NURBS_ERROR32} + GLU_NURBS_ERROR33 = 100283; + {$EXTERNALSYM GLU_NURBS_ERROR33} + GLU_NURBS_ERROR34 = 100284; + {$EXTERNALSYM GLU_NURBS_ERROR34} + GLU_NURBS_ERROR35 = 100285; + {$EXTERNALSYM GLU_NURBS_ERROR35} + GLU_NURBS_ERROR36 = 100286; + {$EXTERNALSYM GLU_NURBS_ERROR36} + GLU_NURBS_ERROR37 = 100287; + {$EXTERNALSYM GLU_NURBS_ERROR37} + + // Contours types -- obsolete! + GLU_CW = 100120; + {$EXTERNALSYM GLU_CW} + GLU_CCW = 100121; + {$EXTERNALSYM GLU_CCW} + GLU_INTERIOR = 100122; + {$EXTERNALSYM GLU_INTERIOR} + GLU_EXTERIOR = 100123; + {$EXTERNALSYM GLU_EXTERIOR} + GLU_UNKNOWN = 100124; + {$EXTERNALSYM GLU_UNKNOWN} + + // Names without "TESS_" prefix + GLU_BEGIN = GLU_TESS_BEGIN; + {$EXTERNALSYM GLU_BEGIN} + GLU_VERTEX = GLU_TESS_VERTEX; + {$EXTERNALSYM GLU_VERTEX} + GLU_END = GLU_TESS_END; + {$EXTERNALSYM GLU_END} + GLU_ERROR = GLU_TESS_ERROR; + {$EXTERNALSYM GLU_ERROR} + GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG; + {$EXTERNALSYM GLU_EDGE_FLAG} + + GLX_VERSION_1_1 = 1; + GLX_VERSION_1_2 = 1; + GLX_VERSION_1_3 = 1; + GLX_EXTENSION_NAME = 'GLX'; + {$EXTERNALSYM GLX_EXTENSION_NAME} + GLX_USE_GL = 1; + {$EXTERNALSYM GLX_USE_GL} + GLX_BUFFER_SIZE = 2; + {$EXTERNALSYM GLX_BUFFER_SIZE} + GLX_LEVEL = 3; + {$EXTERNALSYM GLX_LEVEL} + GLX_RGBA = 4; + {$EXTERNALSYM GLX_RGBA} + GLX_DOUBLEBUFFER = 5; + {$EXTERNALSYM GLX_DOUBLEBUFFER} + GLX_STEREO = 6; + {$EXTERNALSYM GLX_STEREO} + GLX_AUX_BUFFERS = 7; + {$EXTERNALSYM GLX_AUX_BUFFERS} + GLX_RED_SIZE = 8; + {$EXTERNALSYM GLX_RED_SIZE} + GLX_GREEN_SIZE = 9; + {$EXTERNALSYM GLX_GREEN_SIZE} + GLX_BLUE_SIZE = 10; + {$EXTERNALSYM GLX_BLUE_SIZE} + GLX_ALPHA_SIZE = 11; + {$EXTERNALSYM GLX_ALPHA_SIZE} + GLX_DEPTH_SIZE = 12; + {$EXTERNALSYM GLX_DEPTH_SIZE} + GLX_STENCIL_SIZE = 13; + {$EXTERNALSYM GLX_STENCIL_SIZE} + GLX_ACCUM_RED_SIZE = 14; + {$EXTERNALSYM GLX_ACCUM_RED_SIZE} + GLX_ACCUM_GREEN_SIZE = 15; + {$EXTERNALSYM GLX_ACCUM_GREEN_SIZE} + GLX_ACCUM_BLUE_SIZE = 16; + {$EXTERNALSYM GLX_ACCUM_BLUE_SIZE} + GLX_ACCUM_ALPHA_SIZE = 17; + {$EXTERNALSYM GLX_ACCUM_ALPHA_SIZE} + + // Error codes returned by glXGetConfig: + GLX_BAD_SCREEN = 1; + {$EXTERNALSYM GLX_BAD_SCREEN} + GLX_BAD_ATTRIBUTE = 2; + {$EXTERNALSYM GLX_BAD_ATTRIBUTE} + GLX_NO_EXTENSION = 3; + {$EXTERNALSYM GLX_NO_EXTENSION} + GLX_BAD_VISUAL = 4; + {$EXTERNALSYM GLX_BAD_VISUAL} + GLX_BAD_CONTEXT = 5; + {$EXTERNALSYM GLX_BAD_CONTEXT} + GLX_BAD_VALUE = 6; + {$EXTERNALSYM GLX_BAD_VALUE} + GLX_BAD_ENUM = 7; + {$EXTERNALSYM GLX_BAD_ENUM} + + // GLX 1.1 and later: + GLX_VENDOR = 1; + {$EXTERNALSYM GLX_VENDOR} + GLX_VERSION = 2; + {$EXTERNALSYM GLX_VERSION} + GLX_EXTENSIONS = 3; + {$EXTERNALSYM GLX_EXTENSIONS} + + // GLX 1.3 and later: + GLX_CONFIG_CAVEAT = $20; + {$EXTERNALSYM GLX_CONFIG_CAVEAT} + GLX_DONT_CARE = $FFFFFFFF; + {$EXTERNALSYM GLX_DONT_CARE} + GLX_SLOW_CONFIG = $8001; + {$EXTERNALSYM GLX_SLOW_CONFIG} + GLX_NON_CONFORMANT_CONFIG = $800D; + {$EXTERNALSYM GLX_NON_CONFORMANT_CONFIG} + GLX_X_VISUAL_TYPE = $22; + {$EXTERNALSYM GLX_X_VISUAL_TYPE} + GLX_TRANSPARENT_TYPE = $23; + {$EXTERNALSYM GLX_TRANSPARENT_TYPE} + GLX_TRANSPARENT_INDEX_VALUE = $24; + {$EXTERNALSYM GLX_TRANSPARENT_INDEX_VALUE} + GLX_TRANSPARENT_RED_VALUE = $25; + {$EXTERNALSYM GLX_TRANSPARENT_RED_VALUE} + GLX_TRANSPARENT_GREEN_VALUE = $26; + {$EXTERNALSYM GLX_TRANSPARENT_GREEN_VALUE} + GLX_TRANSPARENT_BLUE_VALUE = $27; + {$EXTERNALSYM GLX_TRANSPARENT_BLUE_VALUE} + GLX_TRANSPARENT_ALPHA_VALUE = $28; + {$EXTERNALSYM GLX_TRANSPARENT_ALPHA_VALUE} + GLX_MAX_PBUFFER_WIDTH = $8016; + {$EXTERNALSYM GLX_MAX_PBUFFER_WIDTH} + GLX_MAX_PBUFFER_HEIGHT = $8017; + {$EXTERNALSYM GLX_MAX_PBUFFER_HEIGHT} + GLX_MAX_PBUFFER_PIXELS = $8018; + {$EXTERNALSYM GLX_MAX_PBUFFER_PIXELS} + GLX_PRESERVED_CONTENTS = $801B; + {$EXTERNALSYM GLX_PRESERVED_CONTENTS} + GLX_LARGEST_BUFFER = $801C; + {$EXTERNALSYM GLX_LARGEST_BUFFER} + GLX_DRAWABLE_TYPE = $8010; + {$EXTERNALSYM GLX_DRAWABLE_TYPE} + GLX_FBCONFIG_ID = $8013; + {$EXTERNALSYM GLX_FBCONFIG_ID} + GLX_VISUAL_ID = $800B; + {$EXTERNALSYM GLX_VISUAL_ID} + GLX_WINDOW_BIT = $00000001; + {$EXTERNALSYM GLX_WINDOW_BIT} + GLX_PIXMAP_BIT = $00000002; + {$EXTERNALSYM GLX_PIXMAP_BIT} + GLX_PBUFFER_BIT = $00000004; + {$EXTERNALSYM GLX_PBUFFER_BIT} + GLX_AUX_BUFFERS_BIT = $00000010; + {$EXTERNALSYM GLX_AUX_BUFFERS_BIT} + GLX_FRONT_LEFT_BUFFER_BIT = $00000001; + {$EXTERNALSYM GLX_FRONT_LEFT_BUFFER_BIT} + GLX_FRONT_RIGHT_BUFFER_BIT = $00000002; + {$EXTERNALSYM GLX_FRONT_RIGHT_BUFFER_BIT} + GLX_BACK_LEFT_BUFFER_BIT = $00000004; + {$EXTERNALSYM GLX_BACK_LEFT_BUFFER_BIT} + GLX_BACK_RIGHT_BUFFER_BIT = $00000008; + {$EXTERNALSYM GLX_BACK_RIGHT_BUFFER_BIT} + GLX_DEPTH_BUFFER_BIT = $00000020; + {$EXTERNALSYM GLX_DEPTH_BUFFER_BIT} + GLX_STENCIL_BUFFER_BIT = $00000040; + {$EXTERNALSYM GLX_STENCIL_BUFFER_BIT} + GLX_ACCUM_BUFFER_BIT = $00000080; + {$EXTERNALSYM GLX_ACCUM_BUFFER_BIT} + GLX_RENDER_TYPE = $8011; + {$EXTERNALSYM GLX_RENDER_TYPE} + GLX_X_RENDERABLE = $8012; + {$EXTERNALSYM GLX_X_RENDERABLE} + GLX_NONE = $8000; + {$EXTERNALSYM GLX_NONE} + GLX_TRUE_COLOR = $8002; + {$EXTERNALSYM GLX_TRUE_COLOR} + GLX_DIRECT_COLOR = $8003; + {$EXTERNALSYM GLX_DIRECT_COLOR} + GLX_PSEUDO_COLOR = $8004; + {$EXTERNALSYM GLX_PSEUDO_COLOR} + GLX_STATIC_COLOR = $8005; + {$EXTERNALSYM GLX_STATIC_COLOR} + GLX_GRAY_SCALE = $8006; + {$EXTERNALSYM GLX_GRAY_SCALE} + GLX_STATIC_GRAY = $8007; + {$EXTERNALSYM GLX_STATIC_GRAY} + GLX_TRANSPARENT_INDEX = $8009; + {$EXTERNALSYM GLX_TRANSPARENT_INDEX} + GLX_COLOR_INDEX_TYPE = $8015; + {$EXTERNALSYM GLX_COLOR_INDEX_TYPE} + GLX_COLOR_INDEX_BIT = $00000002; + {$EXTERNALSYM GLX_COLOR_INDEX_BIT} + GLX_SCREEN = $800C; + {$EXTERNALSYM GLX_SCREEN} + GLX_PBUFFER_CLOBBER_MASK = $08000000; + {$EXTERNALSYM GLX_PBUFFER_CLOBBER_MASK} + GLX_DAMAGED = $8020; + {$EXTERNALSYM GLX_DAMAGED} + GLX_SAVED = $8021; + {$EXTERNALSYM GLX_SAVED} + GLX_WINDOW = $8022; + {$EXTERNALSYM GLX_WINDOW} + GLX_PBUFFER = $8023; + {$EXTERNALSYM GLX_PBUFFER} + GLX_EXT_visual_info = 1; + {$EXTERNALSYM GLX_EXT_visual_info} + GLX_X_VISUAL_TYPE_EXT = $22; + {$EXTERNALSYM GLX_X_VISUAL_TYPE_EXT} + GLX_TRANSPARENT_TYPE_EXT = $23; + {$EXTERNALSYM GLX_TRANSPARENT_TYPE_EXT} + GLX_TRANSPARENT_INDEX_VALUE_EXT = $24; + {$EXTERNALSYM GLX_TRANSPARENT_INDEX_VALUE_EXT} + GLX_TRANSPARENT_RED_VALUE_EXT = $25; + {$EXTERNALSYM GLX_TRANSPARENT_RED_VALUE_EXT} + GLX_TRANSPARENT_GREEN_VALUE_EXT = $26; + {$EXTERNALSYM GLX_TRANSPARENT_GREEN_VALUE_EXT} + GLX_TRANSPARENT_BLUE_VALUE_EXT = $27; + {$EXTERNALSYM GLX_TRANSPARENT_BLUE_VALUE_EXT} + GLX_TRANSPARENT_ALPHA_VALUE_EXT = $28; + {$EXTERNALSYM GLX_TRANSPARENT_ALPHA_VALUE_EXT} + GLX_TRUE_COLOR_EXT = $8002; + {$EXTERNALSYM GLX_TRUE_COLOR_EXT} + GLX_DIRECT_COLOR_EXT = $8003; + {$EXTERNALSYM GLX_DIRECT_COLOR_EXT} + GLX_PSEUDO_COLOR_EXT = $8004; + {$EXTERNALSYM GLX_PSEUDO_COLOR_EXT} + GLX_STATIC_COLOR_EXT = $8005; + {$EXTERNALSYM GLX_STATIC_COLOR_EXT} + GLX_GRAY_SCALE_EXT = $8006; + {$EXTERNALSYM GLX_GRAY_SCALE_EXT} + GLX_STATIC_GRAY_EXT = $8007; + {$EXTERNALSYM GLX_STATIC_GRAY_EXT} + GLX_NONE_EXT = $8000; + {$EXTERNALSYM GLX_NONE_EXT} + GLX_TRANSPARENT_RGB_EXT = $8008; + {$EXTERNALSYM GLX_TRANSPARENT_RGB_EXT} + GLX_TRANSPARENT_INDEX_EXT = $8009; + {$EXTERNALSYM GLX_TRANSPARENT_INDEX_EXT} + GLX_VISUAL_CAVEAT_EXT = $20; + {$EXTERNALSYM GLX_VISUAL_CAVEAT_EXT} + GLX_SLOW_VISUAL_EXT = $8001; + {$EXTERNALSYM GLX_SLOW_VISUAL_EXT} + GLX_NON_CONFORMANT_VISUAL_EXT = $800D; + {$EXTERNALSYM GLX_NON_CONFORMANT_VISUAL_EXT} + GLX_SHARE_CONTEXT_EXT = $800A; + {$EXTERNALSYM GLX_SHARE_CONTEXT_EXT} + GLX_VISUAL_ID_EXT = $800B; + {$EXTERNALSYM GLX_VISUAL_ID_EXT} + GLX_SCREEN_EXT = $800C; + {$EXTERNALSYM GLX_SCREEN_EXT} + GLX_3DFX_WINDOW_MODE_MESA = $1; + {$EXTERNALSYM GLX_3DFX_WINDOW_MODE_MESA} + GLX_3DFX_FULLSCREEN_MODE_MESA = $2; + {$EXTERNALSYM GLX_3DFX_FULLSCREEN_MODE_MESA} + + +type + // GLU types + TGLUNurbs = record end; + TGLUQuadric = record end; + TGLUTesselator = record end; + + PGLUNurbs = ^TGLUNurbs; + PGLUQuadric = ^TGLUQuadric; + PGLUTesselator = ^TGLUTesselator; + + // backwards compatibility + TGLUNurbsObj = TGLUNurbs; + TGLUQuadricObj = TGLUQuadric; + TGLUTesselatorObj = TGLUTesselator; + TGLUTriangulatorObj = TGLUTesselator; + + PGLUNurbsObj = PGLUNurbs; + PGLUQuadricObj = PGLUQuadric; + PGLUTesselatorObj = PGLUTesselator; + PGLUTriangulatorObj = PGLUTesselator; + + {$ifdef FPC} + PMaxLogPalette = ^TMaxLogPalette; + TMaxLogPalette = packed record + palversion : word; + palnumentries : word; + palpalentry : array[byte] of TPaletteEntry; + end; + {$endif} + + {$ifdef VER100, Delphi 3 compatibility} + PWGLSwap = ^TWGLSwap; + {$EXTERNALSYM _WGLSWAP} + _WGLSWAP = packed record + hdc: HDC; + uiFlags: UINT; + end; + TWGLSwap = _WGLSWAP; + {$EXTERNALSYM WGLSWAP} + WGLSWAP = _WGLSWAP; + {$endif VER100} + + // Callback function prototypes + // GLUQuadricCallback + TGLUQuadricErrorProc = procedure(errorCode: TGLEnum); {$ifdef MSWINDOWS} stdcall; {$endif} {$ifdef LINUX} cdecl; {$endif} + + // GLUTessCallback + TGLUTessBeginProc = procedure(AType: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + TGLUTessEdgeFlagProc = procedure(Flag: TGLboolean); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + TGLUTessVertexProc = procedure(VertexData: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + TGLUTessEndProc = procedure; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + TGLUTessErrorProc = procedure(ErrNo: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + TGLUTessCombineProc = procedure(Coords: TVector3d; VertexData: TVector4p; Weight: TVector4f; OutData: PPointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + TGLUTessBeginDataProc = procedure(AType: TGLEnum; UserData: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + TGLUTessEdgeFlagDataProc = procedure(Flag: TGLboolean; UserData: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + TGLUTessVertexDataProc = procedure(VertexData: Pointer; UserData: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + TGLUTessEndDataProc = procedure(UserData: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + TGLUTessErrorDataProc = procedure(ErrNo: TGLEnum; UserData: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + TGLUTessCombineDataProc = procedure(Coords: TVector3d; VertexData: TVector4p; Weight: TVector4f; OutData: PPointer; UserData: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + + // GLUNurbsCallback + TGLUNurbsErrorProc = procedure(ErrorCode: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + + // GL functions + procedure glBindTexture(target: TGLEnum; texture: TGLuint); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glTexParameteri(target, pname: TGLEnum; param: TGLint); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glTexImage2D(target: TGLEnum; level, internalformat: TGLint; width, height: TGLsizei; border: TGLint; format, atype: TGLEnum; Pixels:Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glDeleteTextures(n: TGLsizei; textures: PGLuint); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glGenTextures(n: GLsizei; var textures: GLuint); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glColor3f(red, green, blue: TGLfloat); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glBegin(mode: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glEnd; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glVertex2f(x, y: TGLfloat); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glColor4f(red, green, blue, alpha: TGLfloat); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glEnable(cap: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glDisable(cap: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glDepthRange(zNear, zFar: TGLclampd); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glDepthFunc(func: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glBlendFunc(sfactor: TGLEnum; dfactor: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glTexCoord2f(s, t: TGLfloat); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glVertex3f(x, y, z: TGLfloat); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glClearColor(red, green, blue, alpha: TGLclampf); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glClear(mask: TGLbitfield); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glMatrixMode(mode: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glLoadIdentity; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glOrtho(left, right, bottom, top, zNear, zFar: TGLdouble); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glViewport(x, y: TGLint; width, height: TGLsizei); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glReadPixels(x, y: TGLint; width, height: TGLsizei; format, atype: TGLEnum; pixels: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glPixelStorei(pname: TGLEnum; param: TGLint); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + function glGetError:TGLuint; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glTexSubImage2D(target: TGLEnum; level, xoffset, yoffset: TGLint; width, height: TGLsizei; format, atype: TGLEnum; pixels: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure gluOrtho2D(left, right, bottom, top: TGLdouble); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + + // GLU functions + function gluBuild2DMipmaps(target: TGLEnum; components, width, height: TGLint; format, atype: TGLEnum; Data: Pointer): TGLint; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external glu32; + function gluScaleImage(format: TGLEnum; widthin, heightin: TGLint; typein: TGLEnum; datain: Pointer; widthout, heightout: TGLint; typeout: TGLEnum; dataout: Pointer): TGLint; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external glu32; + + Procedure LoadOpenGL; + Procedure UnloadOpenGL; + +implementation + +Procedure LoadOpenGL; +begin +end; + +Procedure UnloadOpenGL; +begin +end; + +end. diff --git a/Game/Code/MacOSX/Wrapper/PNGImage.pas b/Game/Code/MacOSX/Wrapper/PNGImage.pas new file mode 100755 index 00000000..9a82e193 --- /dev/null +++ b/Game/Code/MacOSX/Wrapper/PNGImage.pas @@ -0,0 +1,14 @@ +unit PNGImage; + +{$INCLUDE ../Platform.inc} + +interface + +uses GlueGraphics; + +type + TPNGObject = TBitmap; + +implementation + +end. diff --git a/Game/Code/MacOSX/Wrapper/Windows.pas b/Game/Code/MacOSX/Wrapper/Windows.pas new file mode 100755 index 00000000..333b08e7 --- /dev/null +++ b/Game/Code/MacOSX/Wrapper/Windows.pas @@ -0,0 +1,139 @@ +unit Windows; + +{$INCLUDE ../Platform.inc} + +interface + +uses Types; + +const +{$IFDEF MSWINDOWS} + opengl32 = 'opengl32.dll'; +{$ENDIF} +{$IFDEF MACOS} + opengl32 = 'OpenGL'; +{$ENDIF} + +type + + DWORD = Types.DWORD; + {$EXTERNALSYM DWORD} + BOOL = LongBool; + {$EXTERNALSYM BOOL} + PBOOL = ^BOOL; + {$EXTERNALSYM PBOOL} + PByte = Types.PByte; + PINT = ^Integer; + {$EXTERNALSYM PINT} + PSingle = ^Single; + PWORD = ^Word; + {$EXTERNALSYM PWORD} + PDWORD = ^DWORD; + {$EXTERNALSYM PDWORD} + LPDWORD = PDWORD; + {$EXTERNALSYM LPDWORD} + HDC = type LongWord; + {$EXTERNALSYM HDC} + HGLRC = type LongWord; + {$EXTERNALSYM HGLRC} + TLargeInteger = Int64; + HFONT = type LongWord; + {$EXTERNALSYM HFONT} + HWND = type LongWord; + {$EXTERNALSYM HWND} + + PPaletteEntry = ^TPaletteEntry; + {$EXTERNALSYM tagPALETTEENTRY} + tagPALETTEENTRY = packed record + peRed: Byte; + peGreen: Byte; + peBlue: Byte; + peFlags: Byte; + end; + TPaletteEntry = tagPALETTEENTRY; + {$EXTERNALSYM PALETTEENTRY} + PALETTEENTRY = tagPALETTEENTRY; + + PRGBQuad = ^TRGBQuad; + {$EXTERNALSYM tagRGBQUAD} + tagRGBQUAD = packed record + rgbBlue: Byte; + rgbGreen: Byte; + rgbRed: Byte; + rgbReserved: Byte; + end; + TRGBQuad = tagRGBQUAD; + {$EXTERNALSYM RGBQUAD} + RGBQUAD = tagRGBQUAD; + + PBitmapInfoHeader = ^TBitmapInfoHeader; + {$EXTERNALSYM tagBITMAPINFOHEADER} + tagBITMAPINFOHEADER = packed record + biSize: DWORD; + biWidth: Longint; + biHeight: Longint; + biPlanes: Word; + biBitCount: Word; + biCompression: DWORD; + biSizeImage: DWORD; + biXPelsPerMeter: Longint; + biYPelsPerMeter: Longint; + biClrUsed: DWORD; + biClrImportant: DWORD; + end; + TBitmapInfoHeader = tagBITMAPINFOHEADER; + {$EXTERNALSYM BITMAPINFOHEADER} + BITMAPINFOHEADER = tagBITMAPINFOHEADER; + + PBitmapInfo = ^TBitmapInfo; + {$EXTERNALSYM tagBITMAPINFO} + tagBITMAPINFO = packed record + bmiHeader: TBitmapInfoHeader; + bmiColors: array[0..0] of TRGBQuad; + end; + TBitmapInfo = tagBITMAPINFO; + {$EXTERNALSYM BITMAPINFO} + BITMAPINFO = tagBITMAPINFO; + + function MakeLong(a, b: Word): Longint; + procedure ZeroMemory(Destination: Pointer; Length: DWORD); + function QueryPerformanceFrequency(var lpFrequency: TLargeInteger): BOOL; + function QueryPerformanceCounter(var lpPerformanceCount: TLargeInteger): BOOL; + +implementation + +uses SDL {$IFDEF MSWINDOWS}, Windows{$ENDIF}; + +function MakeLong(A, B: Word): Longint; +begin + Result := (LongInt(B) shl 16) + A; +end; + +procedure ZeroMemory(Destination: Pointer; Length: DWORD); +begin + FillChar( Destination^, Length, 0); +end; + +function QueryPerformanceFrequency(var lpFrequency: TLargeInteger): BOOL; +begin +{$IFDEF MSWINDOWS} + Result := Windows.QueryPerformanceFrequency(lpFrequency); +{$ENDIF} +{$IFDEF MACOS} + Result := true; + lpFrequency := 1000; +{$ENDIF} +end; + +function QueryPerformanceCounter(var lpPerformanceCount: TLargeInteger): BOOL; +begin +{$IFDEF MSWINDOWS} + Result := Windows.QueryPerformanceCounter(lpPerformanceCount); +{$ENDIF} +{$IFDEF MACOS} + Result := true; + lpPerformanceCount := SDL_GetTicks; +{$ENDIF} +end; + +end. diff --git a/Game/Code/MacOSX/Wrapper/zlportio.pas b/Game/Code/MacOSX/Wrapper/zlportio.pas new file mode 100755 index 00000000..4e6173bc --- /dev/null +++ b/Game/Code/MacOSX/Wrapper/zlportio.pas @@ -0,0 +1,31 @@ +unit zlportio; + +{$INCLUDE ../Platform.inc} + +interface + +uses GlueWindows; + + procedure zlioportwrite( const Port,DataType,Data:dword ); + procedure portwriteb( const Port:Dword;const Data:byte ); + function GetTime : Real; + +implementation + +uses SysUtils; + +procedure zlioportwrite( const Port,DataType,Data:dword ); +begin +end; + +procedure portwriteb( const Port:Dword;const Data:byte ); +begin +end; + +function GetTime : Real; +begin + Result := Now; +end; + +end. + -- cgit v1.2.3 From 58cbbe9ff83221360f2444bb07630b1c0dda3739 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Mon, 29 Oct 2007 21:50:42 +0000 Subject: BASS Version 2.3 for MacOSX (Universal Binary) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@541 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/bass/libbass.dylib | Bin 0 -> 408684 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100755 Game/Code/lib/bass/libbass.dylib (limited to 'Game/Code') diff --git a/Game/Code/lib/bass/libbass.dylib b/Game/Code/lib/bass/libbass.dylib new file mode 100755 index 00000000..1168bd07 Binary files /dev/null and b/Game/Code/lib/bass/libbass.dylib differ -- cgit v1.2.3 From 2fdee21c44d16fa2a521380672f8868565bb4df5 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 29 Oct 2007 23:09:04 +0000 Subject: fixed build error since build#USDX-LAZLIN-65 doh :( git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@542 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/USongs.pas | 111 ++++++++++++++++++++++++++++++------------- 1 file changed, 77 insertions(+), 34 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index e3c54ac4..5ce35201 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -134,14 +134,15 @@ end; procedure TSongs.BrowseDir(Dir: widestring); var - SR: TSearchRecW; // for parsing Songs Directory SLen: integer; - {$ifndef win32} - TheDir : pdir; - ADirent :pDirent; - Entry : Longint; - info : stat; + {$ifdef win32} + SR: TSearchRecW; // for parsing Songs Directory + {$else} // This should work on all posix systems. + TheDir : pdir; + ADirent : pDirent; + Entry : Longint; + info : stat; {$endif} begin {$ifdef win32} @@ -155,6 +156,37 @@ begin until FindNextw(SR) <> 0; end; // if FindClosew(SR); + + if FindFirstW(Dir + '*.txt', 0, SR) = 0 then + begin + repeat + SLen := BrowsePos; + + Song[SLen].Path := Dir; + Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); + Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); + Song[SLen].FileName := SR.Name; + + if (AnalyseFile(Song[SLen]) = false) then + Dec(BrowsePos) + else + begin + if Song[SLen].Cover = '' then + Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); + end; + + //Change Length Only every 50 Entrys + Inc(BrowsePos); + + if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then + begin + SetLength(Song, Length(Song) + 50); + end; + + until FindNextW(SR) <> 0; + end; // if FindFirst + FindCloseW(SR); + {$else} // Itterate the Songs Directory... ( With unicode capable functions for linux ) TheDir := opendir( Dir ); // JB_Unicode - linux @@ -175,39 +207,50 @@ begin end; Until ADirent=Nil; end; - {$endif} - -// Log.LogStatus('Parsing directory: ' + Dir + SR.Name, 'LoadSongList'); + + - if FindFirstW(Dir + '*.txt', 0, SR) = 0 then - begin - repeat - SLen := BrowsePos; + TheDir := opendir( Dir ); // JB_Unicode - linux + if TheDir <> nil then + begin + repeat + ADirent := ReadDir(TheDir); + + if ( ADirent <> Nil ) AND + ( pos( '.txt', ADirent^.name ) > -1 ) then + begin + SLen := BrowsePos; + + Song[SLen].Path := Dir; + Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); + Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); + Song[SLen].FileName := ADirent^.name; + + if (AnalyseFile(Song[SLen]) = false) then + Dec(BrowsePos) + else + begin + if Song[SLen].Cover = '' then + Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); + end; + + //Change Length Only every 50 Entrys + Inc(BrowsePos); + + if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then + begin + SetLength(Song, Length(Song) + 50); + end; + end; - Song[SLen].Path := Dir; - Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); - Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); - Song[SLen].FileName := SR.Name; + Until ADirent=Nil; + end; // if FindFirst - if (AnalyseFile(Song[SLen]) = false) then - Dec(BrowsePos) - else - begin - if Song[SLen].Cover = '' then - Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); - end; + {$endif} + +// Log.LogStatus('Parsing directory: ' + Dir + SR.Name, 'LoadSongList'); - //Change Length Only every 50 Entrys - Inc(BrowsePos); - - if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then - begin - SetLength(Song, Length(Song) + 50); - end; - until FindNextW(SR) <> 0; - end; // if FindFirst - FindCloseW(SR); end; procedure TSongs.Sort(Order: integer); -- cgit v1.2.3 From 39c1fdef33f512a36334e689e38b90cfe4aceb82 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Tue, 30 Oct 2007 18:29:38 +0000 Subject: Added SQLite 3.5.1 library for Mac OS X (Intel only binary) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@543 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/SQLite/libsqlite3.dylib | Bin 0 -> 1614256 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100755 Game/Code/lib/SQLite/libsqlite3.dylib (limited to 'Game/Code') diff --git a/Game/Code/lib/SQLite/libsqlite3.dylib b/Game/Code/lib/SQLite/libsqlite3.dylib new file mode 100755 index 00000000..303dcb05 Binary files /dev/null and b/Game/Code/lib/SQLite/libsqlite3.dylib differ -- 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/Classes/TextGL.pas | 10 +- Game/Code/Classes/UAudio_FFMpeg.pas | 8 +- Game/Code/Classes/UAudio_bass.pas | 20 +- Game/Code/Classes/UCatCovers.pas | 3 + Game/Code/Classes/UCommandLine.pas | 3 + Game/Code/Classes/UCommon.pas | 196 +- Game/Code/Classes/UCore.pas | 985 +- Game/Code/Classes/UCoreModule.pas | 7 +- Game/Code/Classes/UCovers.pas | 4 +- Game/Code/Classes/UDLLManager.pas | 17 +- Game/Code/Classes/UDataBase.pas | 5 +- Game/Code/Classes/UDraw.pas | 8 +- Game/Code/Classes/UFiles.pas | 4 +- Game/Code/Classes/UGraphic.pas | 4 - Game/Code/Classes/UGraphicClasses.pas | 4 - Game/Code/Classes/UHooks.pas | 9 +- Game/Code/Classes/UIni.pas | 4 +- Game/Code/Classes/ULCD.pas | 1 + Game/Code/Classes/ULanguage.pas | 6 +- Game/Code/Classes/ULight.pas | 8 +- Game/Code/Classes/ULog.pas | 10 +- Game/Code/Classes/ULyrics.pas | 4 - Game/Code/Classes/ULyrics_bak.pas | 4 - Game/Code/Classes/UMain.pas | 275 +- Game/Code/Classes/UMedia_dummy.pas | 5 +- Game/Code/Classes/UModules.pas | 3 + Game/Code/Classes/UMusic.pas | 4 - Game/Code/Classes/UParty.pas | 5 +- Game/Code/Classes/UPlaylist.pas | 6 +- Game/Code/Classes/UPliki.pas | 2 + Game/Code/Classes/UPluginInterface.pas | 3 + Game/Code/Classes/URecord.pas | 4 - Game/Code/Classes/UServices.pas | 11 +- Game/Code/Classes/USingNotes.pas | 3 + Game/Code/Classes/USingScores.pas | 8 +- Game/Code/Classes/USkins.pas | 7 +- Game/Code/Classes/USongs.pas | 88 +- Game/Code/Classes/UTextClasses.pas | 3 + Game/Code/Classes/UTexture.pas | 12 +- Game/Code/Classes/UThemes.pas | 4 +- Game/Code/Classes/UTime.pas | 4 +- Game/Code/Classes/UVideo.pas | 4 +- Game/Code/Classes/uPluginLoader.pas | 1582 ++-- Game/Code/MacOSX/Platform.inc | 13 - Game/Code/MacOSX/UltraStarDX.pas | 7 +- Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 | 423 +- .../MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser | 1083 ++- .../MacOSX/UltraStarDX.xcodeproj/project.pbxproj | 425 +- Game/Code/MacOSX/Wrapper/Graphics.pas | 2 +- Game/Code/MacOSX/Wrapper/JPEG.pas | 4 +- Game/Code/MacOSX/Wrapper/MacClasses.pas | 2 +- Game/Code/MacOSX/Wrapper/Messages.pas | 30 + Game/Code/MacOSX/Wrapper/MidiFile.pas | 2 +- Game/Code/MacOSX/Wrapper/MidiOut.pas | 2 +- Game/Code/MacOSX/Wrapper/OpenGL12.pas | 9397 ++++++++++---------- Game/Code/MacOSX/Wrapper/PNGImage.pas | 2 +- Game/Code/MacOSX/Wrapper/Windows.pas | 306 +- Game/Code/MacOSX/Wrapper/zlportio.pas | 2 +- Game/Code/Menu/UDisplay.pas | 6 +- Game/Code/Menu/UDrawTexture.pas | 3 + Game/Code/Menu/UMenu.pas | 4 +- Game/Code/Menu/UMenuButton.pas | 3 + Game/Code/Menu/UMenuButtonCollection.pas | 3 + Game/Code/Menu/UMenuInteract.pas | 2 + Game/Code/Menu/UMenuSelect.pas | 3 + Game/Code/Menu/UMenuSelectSlide.pas | 4 +- Game/Code/Menu/UMenuStatic.pas | 3 + Game/Code/Menu/UMenuText.pas | 37 +- Game/Code/Screens/UScreenCredits.pas | 4 - Game/Code/Screens/UScreenEdit.pas | 2 + Game/Code/Screens/UScreenEditConvert.pas | 4 - Game/Code/Screens/UScreenEditHeader.pas | 2 + Game/Code/Screens/UScreenEditSub.pas | 4 - Game/Code/Screens/UScreenLevel.pas | 2 + Game/Code/Screens/UScreenLoading.pas | 4 - Game/Code/Screens/UScreenMain.pas | 4 +- Game/Code/Screens/UScreenName.pas | 2 + Game/Code/Screens/UScreenOpen.pas | 2 + Game/Code/Screens/UScreenOptions.pas | 2 + Game/Code/Screens/UScreenOptionsAdvanced.pas | 2 + Game/Code/Screens/UScreenOptionsGame.pas | 2 + Game/Code/Screens/UScreenOptionsGraphics.pas | 2 + Game/Code/Screens/UScreenOptionsLyrics.pas | 2 + Game/Code/Screens/UScreenOptionsRecord.pas | 2 + Game/Code/Screens/UScreenOptionsSound.pas | 2 + Game/Code/Screens/UScreenOptionsThemes.pas | 2 + Game/Code/Screens/UScreenPartyNewRound.pas | 5 +- Game/Code/Screens/UScreenPartyOptions.pas | 4 +- Game/Code/Screens/UScreenPartyPlayer.pas | 2 + Game/Code/Screens/UScreenPartyScore.pas | 2 + Game/Code/Screens/UScreenPartyWin.pas | 2 + Game/Code/Screens/UScreenPopup.pas | 2 + Game/Code/Screens/UScreenScore.pas | 4 +- Game/Code/Screens/UScreenSing.pas | 4 - Game/Code/Screens/UScreenSingModi.pas | 907 +- Game/Code/Screens/UScreenSong.pas | 8 +- Game/Code/Screens/UScreenSongJumpto.pas | 2 + Game/Code/Screens/UScreenSongMenu.pas | 4 +- Game/Code/Screens/UScreenStatDetail.pas | 2 + Game/Code/Screens/UScreenStatMain.pas | 9 +- Game/Code/Screens/UScreenTop5.pas | 5 +- Game/Code/Screens/UScreenWelcome.pas | 2 + Game/Code/UltraStar.dpr | 250 +- Game/Code/lib/FreeImage/FreeBitmap.pas | 1740 ++++ Game/Code/lib/FreeImage/FreeImage.pas | 743 ++ Game/Code/lib/FreeImage/libfreeimage.dylib | Bin 0 -> 3068680 bytes Game/Code/lib/SQLite/SQLite3.pas | 10 + Game/Code/lib/SQLite/SQLiteTable3.pas | 4 +- Game/Code/lib/bass/MacOSX/Bass.pas | 984 ++ Game/Code/switches.inc | 62 +- 110 files changed, 12544 insertions(+), 7384 deletions(-) delete mode 100755 Game/Code/MacOSX/Platform.inc create mode 100644 Game/Code/MacOSX/Wrapper/Messages.pas create mode 100755 Game/Code/lib/FreeImage/FreeBitmap.pas create mode 100755 Game/Code/lib/FreeImage/FreeImage.pas create mode 100755 Game/Code/lib/FreeImage/libfreeimage.dylib create mode 100755 Game/Code/lib/bass/MacOSX/Bass.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index fbe9a050..af60c4ff 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -2,9 +2,7 @@ unit TextGL; interface -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} +{$I switches.inc} uses OpenGL12, @@ -80,7 +78,7 @@ uses UMain, lcltype, {$ENDIF} SysUtils, - {$IFDEF FPC} + {$IFDEF LAZARUS} LResources, {$ENDIF} UGraphic; @@ -88,7 +86,7 @@ uses UMain, procedure BuildFont; // Build Our Bitmap Font procedure loadfont( aID : integer; aType, aResourceName : String); - {$IFDEF FPC} + {$IFDEF LAZARUS} var lLazRes : TLResource; lResData : TStringStream; @@ -541,7 +539,7 @@ begin end; -{$IFDEF FPC} +{$IFDEF LAZARUS} {$IFDEF win32} initialization {$I UltraStar.lrs} diff --git a/Game/Code/Classes/UAudio_FFMpeg.pas b/Game/Code/Classes/UAudio_FFMpeg.pas index 35822a3b..675dfd3c 100644 --- a/Game/Code/Classes/UAudio_FFMpeg.pas +++ b/Game/Code/Classes/UAudio_FFMpeg.pas @@ -13,9 +13,7 @@ This unit is primarily based upon - interface -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} +{$I switches.inc} uses Classes, @@ -67,7 +65,7 @@ type implementation uses - {$IFDEF FPC} + {$IFDEF LAZARUS} lclintf, libc, {$ENDIF} @@ -590,7 +588,7 @@ begin len1 := len; - {$ifdef win32} + {$ifdef WIN32} lSrc := PUInt8( integer( laudio_buf ) + audio_buf_index ); CopyMemory(stream, lSrc , len1); {$else} diff --git a/Game/Code/Classes/UAudio_bass.pas b/Game/Code/Classes/UAudio_bass.pas index 985eede5..463a6c7f 100644 --- a/Game/Code/Classes/UAudio_bass.pas +++ b/Game/Code/Classes/UAudio_bass.pas @@ -2,9 +2,7 @@ unit UAudio_bass; interface -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} +{$I switches.inc} uses Classes, @@ -24,7 +22,7 @@ uses Classes, implementation uses - {$IFDEF FPC} + {$IFDEF LAZARUS} lclintf, {$ENDIF} URecord, @@ -111,7 +109,7 @@ var function TAudio_bass.GetName: String; begin - result := 'BASS'; + result := 'BASS'; end; procedure TAudio_bass.InitializePlayback; @@ -637,11 +635,11 @@ initialization writeln( 'UAudio_Bass - Register Input' ); AudioManager.add( IAudioInput( singleton_MusicBass ) ); -finalization - writeln( 'UAudio_Bass - UnRegister Playback' ); - AudioManager.Remove( IAudioPlayback( singleton_MusicBass ) ); - - writeln( 'UAudio_Bass - UnRegister Input' ); - AudioManager.Remove( IAudioInput( singleton_MusicBass ) ); +finalization + writeln( 'UAudio_Bass - UnRegister Playback' ); + AudioManager.Remove( IAudioPlayback( singleton_MusicBass ) ); + + writeln( 'UAudio_Bass - UnRegister Input' ); + AudioManager.Remove( IAudioInput( singleton_MusicBass ) ); end. diff --git a/Game/Code/Classes/UCatCovers.pas b/Game/Code/Classes/UCatCovers.pas index d40b2564..b1c91e48 100644 --- a/Game/Code/Classes/UCatCovers.pas +++ b/Game/Code/Classes/UCatCovers.pas @@ -5,6 +5,9 @@ unit UCatCovers; ///////////////////////////////////////////////////////////////////////// interface + +{$I switches.inc} + uses UIni; type diff --git a/Game/Code/Classes/UCommandLine.pas b/Game/Code/Classes/UCommandLine.pas index 259c6e16..1539ffaf 100644 --- a/Game/Code/Classes/UCommandLine.pas +++ b/Game/Code/Classes/UCommandLine.pas @@ -2,6 +2,9 @@ unit UCommandLine; interface +{$I switches.inc} + + type //----------- // TCMDParams - Class Reaads Infos from ParamStr and set some easy Interface Variables diff --git a/Game/Code/Classes/UCommon.pas b/Game/Code/Classes/UCommon.pas index 44ec6bb3..b532f775 100644 --- a/Game/Code/Classes/UCommon.pas +++ b/Game/Code/Classes/UCommon.pas @@ -2,16 +2,17 @@ unit UCommon; interface -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} +{$I switches.inc} uses SysUtils, -{$IFDEF FPC} +{$IFDEF LAZARUS} lResources, {$ENDIF} ULog, +{$IFDEF DARWIN} + messages, +{$ENDIF} {$IFDEF win32} windows; {$ELSE} @@ -27,22 +28,23 @@ type TWin32FindData = LongInt; {$ENDIF} -{$IFDEF FPC} - -type - TWndMethod = procedure(var Message: TMessage) of object; +{$IFDEF LAZARUS} + function LazFindResource( const aName, aType : String ): TLResource; +{$ENDIF} -function LazFindResource( const aName, aType : String ): TLResource; +{$IFDEF FPC} function RandomRange(aMin: Integer; aMax: Integer) : Integer; function MaxValue(const Data: array of Double): Double; function MinValue(const Data: array of Double): Double; -{$IFDEF Win32} -function AllocateHWnd(Method: TWndMethod): HWND; -procedure DeallocateHWnd(Wnd: HWND); -{$ENDIF} // Win32 + {$IFDEF WIN32} + type + TWndMethod = procedure(var Message: TMessage) of object; + function AllocateHWnd(Method: TWndMethod): HWND; + procedure DeallocateHWnd(Wnd: HWND); + {$ENDIF} // Win32 {$ENDIF} // FPC Only @@ -58,24 +60,24 @@ function AdaptFilePaths( const aPath : widestring ): widestring; procedure ZeroMemory( Destination: Pointer; Length: DWORD ); {$ENDIF} -{$IFDEF Win32} +{$IFDEF MSWINDOWS} type TSearchRecW = record - Time: Integer; - Size: Integer; - Attr: Integer; - Name: WideString; - ExcludeAttr: Integer; - FindHandle: THandle; - FindData: TWin32FindDataW; - end; - - function FindFirstW(const Path: WideString; Attr: Integer; var F: TSearchRecW): Integer; - function FindNextW(var F: TSearchRecW): Integer; - procedure FindCloseW(var F: TSearchRecW); - function FindMatchingFileW(var F: TSearchRecW): Integer; - function DirectoryExistsW(const Directory: widestring): Boolean; + Time: Integer; + Size: Integer; + Attr: Integer; + Name: WideString; + ExcludeAttr: Integer; + FindHandle: THandle; + FindData: TWin32FindDataW; + end; + + function FindFirstW(const Path: WideString; Attr: Integer; var F: TSearchRecW): Integer; + function FindNextW(var F: TSearchRecW): Integer; + procedure FindCloseW(var F: TSearchRecW); + function FindMatchingFileW(var F: TSearchRecW): Integer; + function DirectoryExistsW(const Directory: widestring): Boolean; {$endif} implementation @@ -143,7 +145,7 @@ end; {$ENDIF} -{$IFDEF FPC} +{$IFDEF LAZARUS} function LazFindResource( const aName, aType : String ): TLResource; var @@ -161,7 +163,9 @@ begin end; end; end; +{$ENDIF} +{$IFDEF FPC} function MaxValue(const Data: array of Double): Double; var I: Integer; @@ -191,7 +195,7 @@ end; // NOTE !!!!!!!!!! // AllocateHWnd is in lclintfh.inc -{$IFDEF Win32} +{$IFDEF MSWINDOWS} // TODO : JB this is dodgey and bad... find a REAL solution ! function AllocateHWnd(Method: TWndMethod): HWND; var @@ -209,72 +213,82 @@ begin DestroyWindow(Wnd); end; {$ENDIF} +{$IFDEF DARWIN} +// TODO : Situation for the mac isn't better ! +function AllocateHWnd(Method: TWndMethod): HWND; +begin +end; + +procedure DeallocateHWnd(Wnd: HWND); +begin +end; +{$ENDIF} + - {$ENDIF} -{$ifdef win32} -function FindFirstW(const Path: widestring; Attr: Integer; var F: TSearchRecW): Integer; -const - faSpecial = faHidden or faSysFile or faVolumeID or faDirectory; -begin - F.ExcludeAttr := not Attr and faSpecial; - F.FindHandle := FindFirstFileW(PWideChar(Path), F.FindData); - if F.FindHandle <> INVALID_HANDLE_VALUE then - begin - Result := FindMatchingFileW(F); - if Result <> 0 then FindCloseW(F); - end else - Result := GetLastError; -end; - -function FindNextW(var F: TSearchRecW): Integer; -begin - if FindNextFileW(F.FindHandle, F.FindData) then - Result := FindMatchingFileW(F) - else - Result := GetLastError; -end; - -procedure FindCloseW(var F: TSearchRecW); -begin - if F.FindHandle <> INVALID_HANDLE_VALUE then - begin - Windows.FindClose(F.FindHandle); - F.FindHandle := INVALID_HANDLE_VALUE; - end; -end; - -function FindMatchingFileW(var F: TSearchRecW): Integer; -var - LocalFileTime: TFileTime; -begin - with F do - begin - while FindData.dwFileAttributes and ExcludeAttr <> 0 do - if not FindNextFileW(FindHandle, FindData) then - begin - Result := GetLastError; - Exit; - end; - FileTimeToLocalFileTime(FindData.ftLastWriteTime, LocalFileTime); - FileTimeToDosDateTime(LocalFileTime, LongRec(Time).Hi, LongRec(Time).Lo); - Size := FindData.nFileSizeLow; - Attr := FindData.dwFileAttributes; - Name := FindData.cFileName; - end; - Result := 0; -end; - -function DirectoryExistsW(const Directory: widestring): Boolean; -var - Code: Integer; -begin - Code := GetFileAttributesW(PWideChar(Directory)); - Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0); -end; +{$ifdef MSWINDOWS} +function FindFirstW(const Path: widestring; Attr: Integer; var F: TSearchRecW): Integer; +const + faSpecial = faHidden or faSysFile or faVolumeID or faDirectory; +begin + F.ExcludeAttr := not Attr and faSpecial; + F.FindHandle := FindFirstFileW(PWideChar(Path), F.FindData); + if F.FindHandle <> INVALID_HANDLE_VALUE then + begin + Result := FindMatchingFileW(F); + if Result <> 0 then FindCloseW(F); + end else + Result := GetLastError; +end; + +function FindNextW(var F: TSearchRecW): Integer; +begin + if FindNextFileW(F.FindHandle, F.FindData) then + Result := FindMatchingFileW(F) + else + Result := GetLastError; +end; + +procedure FindCloseW(var F: TSearchRecW); +begin + if F.FindHandle <> INVALID_HANDLE_VALUE then + begin + Windows.FindClose(F.FindHandle); + F.FindHandle := INVALID_HANDLE_VALUE; + end; +end; + +function FindMatchingFileW(var F: TSearchRecW): Integer; +var + LocalFileTime: TFileTime; +begin + with F do + begin + while FindData.dwFileAttributes and ExcludeAttr <> 0 do + if not FindNextFileW(FindHandle, FindData) then + begin + Result := GetLastError; + Exit; + end; + FileTimeToLocalFileTime(FindData.ftLastWriteTime, LocalFileTime); + FileTimeToDosDateTime(LocalFileTime, LongRec(Time).Hi, LongRec(Time).Lo); + Size := FindData.nFileSizeLow; + Attr := FindData.dwFileAttributes; + Name := FindData.cFileName; + end; + Result := 0; +end; + +function DirectoryExistsW(const Directory: widestring): Boolean; +var + Code: Integer; +begin + Code := GetFileAttributesW(PWideChar(Directory)); + Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0); +end; {$endif} diff --git a/Game/Code/Classes/UCore.pas b/Game/Code/Classes/UCore.pas index 9c31e79a..091868f2 100644 --- a/Game/Code/Classes/UCore.pas +++ b/Game/Code/Classes/UCore.pas @@ -1,495 +1,492 @@ -unit UCore; - -interface -uses uPluginDefs, uCoreModule, UHooks, UServices, UModules; -{********************* - TCore - Class manages all CoreModules, teh StartUp, teh MainLoop and the shutdown process - Also it does some Error Handling, and maybe sometime multithreaded Loading ;) -*********************} - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -type - TModuleListItem = record - Module: TCoreModule; //Instance of the Modules Class - Info: TModuleInfo; //ModuleInfo returned by Modules Modulinfo Proc - NeedsDeInit: Boolean; //True if Module was succesful inited - end; - - TCore = class - private - //Some Hook Handles. See Plugin SDKs Hooks.txt for Infos - hLoadingFinished: THandle; - hMainLoop: THandle; - hTranslate: THandle; - hLoadTextures: THandle; - hExitQuery: THandle; - hExit: THandle; - hDebug: THandle; - hError: THandle; - sReportError: THandle; - sReportDebug: THandle; - sShowMessage: THandle; - sRetranslate: THandle; - sReloadTextures: THandle; - sGetModuleInfo: THandle; - sGetApplicationHandle: THandle; - - Modules: Array [0..High(CORE_MODULES_TO_LOAD)] of TModuleListItem; - - //Function Get all Modules and Creates them - Function GetModules: Boolean; - - //Loads Core and all Modules - Function Load: Boolean; - - //Inits Core and all Modules - Function Init: Boolean; - - //DeInits Core and all Modules - Function DeInit: Boolean; - - //Load the Core - Function LoadCore: Boolean; - - //Init the Core - Function InitCore: Boolean; - - //DeInit the Core - Function DeInitCore: Boolean; - - //Called one Time per Frame - Function MainLoop: Boolean; - - public - Hooks: THookManager; //Teh Hook Manager ;) - Services: TServiceManager;//The Service Manager - - CurExecuted: Integer; //ID of Plugin or Module curently Executed - - Name: String; //Name of this Application - Version: LongWord; //Version of this ". For Info Look PluginDefs Functions - - LastErrorReporter:String; //Who Reported the Last Error String - LastErrorString: String; //Last Error String reported - - - //--------------- - //Main Methods to control the Core: - //--------------- - Constructor Create(const cName: String; const cVersion: LongWord); - - //Starts Loading and Init Process. Then Runs MainLoop. DeInits on Shutdown - Procedure Run; - - //Method for other Classes to get Pointer to a specific Module - Function GetModulebyName(const Name: String): PCoreModule; - - //-------------- - // Hook and Service Procs: - //-------------- - Function ShowMessage(wParam, lParam: DWord): integer; //Shows a Message (lParam: PChar Text, wParam: Symbol) - Function ReportError(wParam, lParam: DWord): integer; //Shows a Message (wParam: Pchar(Message), lParam: PChar(Reportername)) - Function ReportDebug(wParam, lParam: DWord): integer; //Shows a Message (wParam: Pchar(Message), lParam: PChar(Reportername)) - Function Retranslate(wParam, lParam: DWord): integer; //Calls Translate hook - Function ReloadTextures(wParam, lParam: DWord): integer; //Calls LoadTextures hook - Function GetModuleInfo(wParam, lParam: DWord): integer; //If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TModuleInfo to address at lparam - Function GetApplicationHandle(wParam, lParam: DWord): integer; //Returns Application Handle - end; - -var - Core: TCore; - -implementation -uses SysUtils, -{$IFDEF win32} -Windows -{$ENDIF}; - -//------------- -// Create - Creates Class + Hook and Service Manager -//------------- -Constructor TCore.Create(const cName: String; const cVersion: LongWord); -begin - Name := cName; - Version := cVersion; - CurExecuted := 0; - - LastErrorReporter := ''; - LastErrorString := ''; - - Hooks := THookManager.Create(50); - Services := TServiceManager.Create; -end; - -//------------- -//Starts Loading and Init Process. Then Runs MainLoop. DeInits on Shutdown -//------------- -Procedure TCore.Run; -var - noError: Boolean; -begin - //Get Modules - Try - noError := GetModules; - Except - noError := False; - end; - - //Loading - if (noError) then - begin - Try - noError := Load; - Except - noError := False; - end; - - if (noError) then - begin //Init - Try - noError := Init; - Except - noError := False; - end; - - If noError then - begin - //Call Translate Hook - noError := (Hooks.CallEventChain(hTranslate, 0, 0) = 0); - - If noError then - begin //Calls LoadTextures Hook - noError := (Hooks.CallEventChain(hLoadTextures, 0, 0) = 0); - - if noError then - begin //Calls Loading Finished Hook - noError := (Hooks.CallEventChain(hLoadingFinished, 0, 0) = 0); - - If noError then - begin - //Start MainLoop - While noError do - begin - noError := MainLoop; - // to-do : Call Display Draw here - end; - end - else - begin - If (LastErrorString <> '') then - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error calling LoadingFinished Hook: ' + LastErrorString))) - else - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error calling LoadingFinished Hook'))); - end; - end - else - begin - If (LastErrorString <> '') then - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading textures: ' + LastErrorString))) - else - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading textures'))); - end; - end - else - begin - If (LastErrorString <> '') then - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error translating: ' + LastErrorString))) - else - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error translating'))); - end; - - end - else - begin - If (LastErrorString <> '') then - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error initing Modules: ' + LastErrorString))) - else - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error initing Modules'))); - end; - end - else - begin - If (LastErrorString <> '') then - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading Modules: ' + LastErrorString))) - else - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading Modules'))); - end; - end - else - begin - If (LastErrorString <> '') then - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error Getting Modules: ' + LastErrorString))) - else - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error Getting Modules'))); - end; - - //DeInit - DeInit; -end; - -//------------- -//Called one Time per Frame -//------------- -Function TCore.MainLoop: Boolean; -begin - Result := False; - -end; - -//------------- -//Function Get all Modules and Creates them -//------------- -Function TCore.GetModules: Boolean; -var - I: Integer; -begin - Result := False; - try - For I := 0 to high(Modules) do - begin - Modules[I].NeedsDeInit := False; - Modules[I].Module := CORE_MODULES_TO_LOAD[I].Create; - Modules[I].Module.Info(@Modules[I].Info); - end; - Result := True; - except - ReportError(Integer(PChar('Can''t get module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), Integer(PChar('Core'))); - end; -end; - -//------------- -//Loads Core and all Modules -//------------- -Function TCore.Load: Boolean; -var - I: Integer; -begin - Result := LoadCore; - - I := 0; - While ((Result = True) AND (I <= High(CORE_MODULES_TO_LOAD))) do - begin - try - Result := Modules[I].Module.Load; - except - Result := False; - ReportError(Integer(PChar('Error loading module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), Integer(PChar('Core'))); - end; - - Inc(I); - end; -end; - -//------------- -//Inits Core and all Modules -//------------- -Function TCore.Init: Boolean; -var - I: Integer; -begin - Result := InitCore; - - I := 0; - While ((Result = True) AND (I <= High(CORE_MODULES_TO_LOAD))) do - begin - try - Result := Modules[I].Module.Init; - except - Result := False; - ReportError(Integer(PChar('Error initing module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), Integer(PChar('Core'))); - end; - - Modules[I].NeedsDeInit := Result; - Inc(I); - end; -end; - -//------------- -//DeInits Core and all Modules -//------------- -Function TCore.DeInit: Boolean; -var - I: Integer; -label Continue; -begin - I := High(CORE_MODULES_TO_LOAD); - - Continue: - Try - While (I >= 0) do - begin - If (Modules[I].NeedsDeInit) then - Modules[I].Module.DeInit; - - Dec(I); - end; - Except - - - end; - If (I >= 0) then - GoTo Continue; - - DeInitCore; -end; - -//------------- -//Load the Core -//------------- -Function TCore.LoadCore: Boolean; -begin - hLoadingFinished := Hooks.AddEvent('Core/LoadingFinished'); - hMainLoop := Hooks.AddEvent('Core/MainLoop'); - hTranslate := Hooks.AddEvent('Core/Translate'); - hLoadTextures := Hooks.AddEvent('Core/LoadTextures'); - hExitQuery := Hooks.AddEvent('Core/ExitQuery'); - hExit := Hooks.AddEvent('Core/Exit'); - hDebug := Hooks.AddEvent('Core/NewDebugInfo'); - hError := Hooks.AddEvent('Core/NewError'); - - sReportError := Services.AddService('Core/ReportError', nil, Self.ReportError); - sReportDebug := Services.AddService('Core/ReportDebug', nil, Self.ReportDebug); - sShowMessage := Services.AddService('Core/ShowMessage', nil, Self.ShowMessage); - sRetranslate := Services.AddService('Core/Retranslate', nil, Self.Retranslate); - sReloadTextures := Services.AddService('Core/ReloadTextures', nil, Self.ReloadTextures); - sGetModuleInfo := Services.AddService('Core/GetModuleInfo', nil, Self.GetModuleInfo); - sGetApplicationHandle := Services.AddService('Core/GetApplicationHandle', nil, Self.GetApplicationHandle); - - //A little Test - Hooks.AddSubscriber('Core/NewError', HookTest); -end; - -//------------- -//Init the Core -//------------- -Function TCore.InitCore: Boolean; -begin - //Dont Init s.th. atm. -end; - -//------------- -//DeInit the Core -//------------- -Function TCore.DeInitCore: Boolean; -begin - - - // to-do : write TService-/HookManager.Free and call it here -end; - -//------------- -//Method for other Classes to get Pointer to a specific Module -//------------- -Function TCore.GetModulebyName(const Name: String): PCoreModule; -var I: Integer; -begin - Result := nil; - For I := 0 to high(Modules) do - If (Modules[I].Info.Name = Name) then - begin - Result := @Modules[I].Module; - Break; - end; -end; - -//------------- -// Shows a MessageDialog (lParam: PChar Text, wParam: Symbol) -//------------- -Function TCore.ShowMessage(wParam, lParam: DWord): integer; -var Params: Cardinal; -begin - Result := -1; - - {$IFDEF win32} - If (ptr(lParam)<>nil) then - begin - Params := MB_OK; - Case wParam of - CORE_SM_ERROR: Params := Params or MB_ICONERROR; - CORE_SM_WARNING: Params := Params or MB_ICONWARNING; - CORE_SM_INFO: Params := Params or MB_ICONINFORMATION; - end; - - //Anzeigen: - Result := Messagebox(0, ptr(lParam), PChar(Name), Params); - end; - {$ENDIF} - - // to-do : write ShowMessage for other OSes -end; - -//------------- -// Calls NewError HookChain (wParam: Pchar(Message), lParam: PChar(Reportername)) -//------------- -Function TCore.ReportError(wParam, lParam: DWord): integer; -begin - //Update LastErrorReporter and LastErrorString - LastErrorReporter := String(PChar(Ptr(lParam))); - LastErrorString := String(PChar(Ptr(wParam))); - - Hooks.CallEventChain(hError, wParam, lParam); -end; - -//------------- -// Calls NewDebugInfo HookChain (wParam: Pchar(Message), lParam: PChar(Reportername)) -//------------- -Function TCore.ReportDebug(wParam, lParam: DWord): integer; -begin - Hooks.CallEventChain(hDebug, wParam, lParam); -end; - -//------------- -// Calls Translate hook -//------------- -Function TCore.Retranslate(wParam, lParam: DWord): integer; -begin - Hooks.CallEventChain(hTranslate, 0, 1); -end; - -//------------- -// Calls LoadTextures hook -//------------- -Function TCore.ReloadTextures(wParam, lParam: DWord): integer; -begin - Hooks.CallEventChain(hLoadTextures, 0, 1); -end; - -//------------- -// If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TModuleInfo to address at lparam -//------------- -Function TCore.GetModuleInfo(wParam, lParam: DWord): integer; -begin - if (ptr(lParam) = nil) then - begin - Result := Length(Modules); - end - else - begin - Try - For Result := 0 to High(Modules) do - begin - AModuleInfo(ptr(lParam))[Result].Name := Modules[Result].Info.Name; - AModuleInfo(ptr(lParam))[Result].Version := Modules[Result].Info.Version; - AModuleInfo(ptr(lParam))[Result].Description := Modules[Result].Info.Description; - end; - Except - Result := -1; - end; - end; -end; - -//------------- -// Returns Application Handle -//------------- -Function TCore.GetApplicationHandle(wParam, lParam: DWord): integer; -begin - Result := hInstance; -end; - +unit UCore; + +interface + +{$I switches.inc} + +uses uPluginDefs, uCoreModule, UHooks, UServices, UModules; +{********************* + TCore + Class manages all CoreModules, teh StartUp, teh MainLoop and the shutdown process + Also it does some Error Handling, and maybe sometime multithreaded Loading ;) +*********************} + +type + TModuleListItem = record + Module: TCoreModule; //Instance of the Modules Class + Info: TModuleInfo; //ModuleInfo returned by Modules Modulinfo Proc + NeedsDeInit: Boolean; //True if Module was succesful inited + end; + + TCore = class + private + //Some Hook Handles. See Plugin SDKs Hooks.txt for Infos + hLoadingFinished: THandle; + hMainLoop: THandle; + hTranslate: THandle; + hLoadTextures: THandle; + hExitQuery: THandle; + hExit: THandle; + hDebug: THandle; + hError: THandle; + sReportError: THandle; + sReportDebug: THandle; + sShowMessage: THandle; + sRetranslate: THandle; + sReloadTextures: THandle; + sGetModuleInfo: THandle; + sGetApplicationHandle: THandle; + + Modules: Array [0..High(CORE_MODULES_TO_LOAD)] of TModuleListItem; + + //Function Get all Modules and Creates them + Function GetModules: Boolean; + + //Loads Core and all Modules + Function Load: Boolean; + + //Inits Core and all Modules + Function Init: Boolean; + + //DeInits Core and all Modules + Function DeInit: Boolean; + + //Load the Core + Function LoadCore: Boolean; + + //Init the Core + Function InitCore: Boolean; + + //DeInit the Core + Function DeInitCore: Boolean; + + //Called one Time per Frame + Function MainLoop: Boolean; + + public + Hooks: THookManager; //Teh Hook Manager ;) + Services: TServiceManager;//The Service Manager + + CurExecuted: Integer; //ID of Plugin or Module curently Executed + + Name: String; //Name of this Application + Version: LongWord; //Version of this ". For Info Look PluginDefs Functions + + LastErrorReporter:String; //Who Reported the Last Error String + LastErrorString: String; //Last Error String reported + + + //--------------- + //Main Methods to control the Core: + //--------------- + Constructor Create(const cName: String; const cVersion: LongWord); + + //Starts Loading and Init Process. Then Runs MainLoop. DeInits on Shutdown + Procedure Run; + + //Method for other Classes to get Pointer to a specific Module + Function GetModulebyName(const Name: String): PCoreModule; + + //-------------- + // Hook and Service Procs: + //-------------- + Function ShowMessage(wParam, lParam: DWord): integer; //Shows a Message (lParam: PChar Text, wParam: Symbol) + Function ReportError(wParam, lParam: DWord): integer; //Shows a Message (wParam: Pchar(Message), lParam: PChar(Reportername)) + Function ReportDebug(wParam, lParam: DWord): integer; //Shows a Message (wParam: Pchar(Message), lParam: PChar(Reportername)) + Function Retranslate(wParam, lParam: DWord): integer; //Calls Translate hook + Function ReloadTextures(wParam, lParam: DWord): integer; //Calls LoadTextures hook + Function GetModuleInfo(wParam, lParam: DWord): integer; //If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TModuleInfo to address at lparam + Function GetApplicationHandle(wParam, lParam: DWord): integer; //Returns Application Handle + end; + +var + Core: TCore; + +implementation +uses SysUtils, +{$IFDEF win32} +Windows +{$ENDIF}; + +//------------- +// Create - Creates Class + Hook and Service Manager +//------------- +Constructor TCore.Create(const cName: String; const cVersion: LongWord); +begin + Name := cName; + Version := cVersion; + CurExecuted := 0; + + LastErrorReporter := ''; + LastErrorString := ''; + + Hooks := THookManager.Create(50); + Services := TServiceManager.Create; +end; + +//------------- +//Starts Loading and Init Process. Then Runs MainLoop. DeInits on Shutdown +//------------- +Procedure TCore.Run; +var + noError: Boolean; +begin + //Get Modules + Try + noError := GetModules; + Except + noError := False; + end; + + //Loading + if (noError) then + begin + Try + noError := Load; + Except + noError := False; + end; + + if (noError) then + begin //Init + Try + noError := Init; + Except + noError := False; + end; + + If noError then + begin + //Call Translate Hook + noError := (Hooks.CallEventChain(hTranslate, 0, 0) = 0); + + If noError then + begin //Calls LoadTextures Hook + noError := (Hooks.CallEventChain(hLoadTextures, 0, 0) = 0); + + if noError then + begin //Calls Loading Finished Hook + noError := (Hooks.CallEventChain(hLoadingFinished, 0, 0) = 0); + + If noError then + begin + //Start MainLoop + While noError do + begin + noError := MainLoop; + // to-do : Call Display Draw here + end; + end + else + begin + If (LastErrorString <> '') then + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error calling LoadingFinished Hook: ' + LastErrorString))) + else + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error calling LoadingFinished Hook'))); + end; + end + else + begin + If (LastErrorString <> '') then + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading textures: ' + LastErrorString))) + else + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading textures'))); + end; + end + else + begin + If (LastErrorString <> '') then + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error translating: ' + LastErrorString))) + else + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error translating'))); + end; + + end + else + begin + If (LastErrorString <> '') then + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error initing Modules: ' + LastErrorString))) + else + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error initing Modules'))); + end; + end + else + begin + If (LastErrorString <> '') then + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading Modules: ' + LastErrorString))) + else + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading Modules'))); + end; + end + else + begin + If (LastErrorString <> '') then + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error Getting Modules: ' + LastErrorString))) + else + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error Getting Modules'))); + end; + + //DeInit + DeInit; +end; + +//------------- +//Called one Time per Frame +//------------- +Function TCore.MainLoop: Boolean; +begin + Result := False; + +end; + +//------------- +//Function Get all Modules and Creates them +//------------- +Function TCore.GetModules: Boolean; +var + I: Integer; +begin + Result := False; + try + For I := 0 to high(Modules) do + begin + Modules[I].NeedsDeInit := False; + Modules[I].Module := CORE_MODULES_TO_LOAD[I].Create; + Modules[I].Module.Info(@Modules[I].Info); + end; + Result := True; + except + ReportError(Integer(PChar('Can''t get module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), Integer(PChar('Core'))); + end; +end; + +//------------- +//Loads Core and all Modules +//------------- +Function TCore.Load: Boolean; +var + I: Integer; +begin + Result := LoadCore; + + I := 0; + While ((Result = True) AND (I <= High(CORE_MODULES_TO_LOAD))) do + begin + try + Result := Modules[I].Module.Load; + except + Result := False; + ReportError(Integer(PChar('Error loading module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), Integer(PChar('Core'))); + end; + + Inc(I); + end; +end; + +//------------- +//Inits Core and all Modules +//------------- +Function TCore.Init: Boolean; +var + I: Integer; +begin + Result := InitCore; + + I := 0; + While ((Result = True) AND (I <= High(CORE_MODULES_TO_LOAD))) do + begin + try + Result := Modules[I].Module.Init; + except + Result := False; + ReportError(Integer(PChar('Error initing module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), Integer(PChar('Core'))); + end; + + Modules[I].NeedsDeInit := Result; + Inc(I); + end; +end; + +//------------- +//DeInits Core and all Modules +//------------- +Function TCore.DeInit: Boolean; +var + I: Integer; +label Continue; +begin + I := High(CORE_MODULES_TO_LOAD); + + Continue: + Try + While (I >= 0) do + begin + If (Modules[I].NeedsDeInit) then + Modules[I].Module.DeInit; + + Dec(I); + end; + Except + + + end; + If (I >= 0) then + GoTo Continue; + + DeInitCore; +end; + +//------------- +//Load the Core +//------------- +Function TCore.LoadCore: Boolean; +begin + hLoadingFinished := Hooks.AddEvent('Core/LoadingFinished'); + hMainLoop := Hooks.AddEvent('Core/MainLoop'); + hTranslate := Hooks.AddEvent('Core/Translate'); + hLoadTextures := Hooks.AddEvent('Core/LoadTextures'); + hExitQuery := Hooks.AddEvent('Core/ExitQuery'); + hExit := Hooks.AddEvent('Core/Exit'); + hDebug := Hooks.AddEvent('Core/NewDebugInfo'); + hError := Hooks.AddEvent('Core/NewError'); + + sReportError := Services.AddService('Core/ReportError', nil, Self.ReportError); + sReportDebug := Services.AddService('Core/ReportDebug', nil, Self.ReportDebug); + sShowMessage := Services.AddService('Core/ShowMessage', nil, Self.ShowMessage); + sRetranslate := Services.AddService('Core/Retranslate', nil, Self.Retranslate); + sReloadTextures := Services.AddService('Core/ReloadTextures', nil, Self.ReloadTextures); + sGetModuleInfo := Services.AddService('Core/GetModuleInfo', nil, Self.GetModuleInfo); + sGetApplicationHandle := Services.AddService('Core/GetApplicationHandle', nil, Self.GetApplicationHandle); + + //A little Test + Hooks.AddSubscriber('Core/NewError', HookTest); +end; + +//------------- +//Init the Core +//------------- +Function TCore.InitCore: Boolean; +begin + //Dont Init s.th. atm. +end; + +//------------- +//DeInit the Core +//------------- +Function TCore.DeInitCore: Boolean; +begin + + + // to-do : write TService-/HookManager.Free and call it here +end; + +//------------- +//Method for other Classes to get Pointer to a specific Module +//------------- +Function TCore.GetModulebyName(const Name: String): PCoreModule; +var I: Integer; +begin + Result := nil; + For I := 0 to high(Modules) do + If (Modules[I].Info.Name = Name) then + begin + Result := @Modules[I].Module; + Break; + end; +end; + +//------------- +// Shows a MessageDialog (lParam: PChar Text, wParam: Symbol) +//------------- +Function TCore.ShowMessage(wParam, lParam: DWord): integer; +var Params: Cardinal; +begin + Result := -1; + + {$IFDEF MSWINDOWS} + If (ptr(lParam)<>nil) then + begin + Params := MB_OK; + Case wParam of + CORE_SM_ERROR: Params := Params or MB_ICONERROR; + CORE_SM_WARNING: Params := Params or MB_ICONWARNING; + CORE_SM_INFO: Params := Params or MB_ICONINFORMATION; + end; + + //Anzeigen: + Result := Messagebox(0, ptr(lParam), PChar(Name), Params); + end; + {$ENDIF} + + // to-do : write ShowMessage for other OSes +end; + +//------------- +// Calls NewError HookChain (wParam: Pchar(Message), lParam: PChar(Reportername)) +//------------- +Function TCore.ReportError(wParam, lParam: DWord): integer; +begin + //Update LastErrorReporter and LastErrorString + LastErrorReporter := String(PChar(Pointer(lParam))); + LastErrorString := String(PChar(Pointer(wParam))); + + Hooks.CallEventChain(hError, wParam, lParam); +end; + +//------------- +// Calls NewDebugInfo HookChain (wParam: Pchar(Message), lParam: PChar(Reportername)) +//------------- +Function TCore.ReportDebug(wParam, lParam: DWord): integer; +begin + Hooks.CallEventChain(hDebug, wParam, lParam); +end; + +//------------- +// Calls Translate hook +//------------- +Function TCore.Retranslate(wParam, lParam: DWord): integer; +begin + Hooks.CallEventChain(hTranslate, 0, 1); +end; + +//------------- +// Calls LoadTextures hook +//------------- +Function TCore.ReloadTextures(wParam, lParam: DWord): integer; +begin + Hooks.CallEventChain(hLoadTextures, 0, 1); +end; + +//------------- +// If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TModuleInfo to address at lparam +//------------- +Function TCore.GetModuleInfo(wParam, lParam: DWord): integer; +begin + if (Pointer(lParam) = nil) then + begin + Result := Length(Modules); + end + else + begin + Try + For Result := 0 to High(Modules) do + begin + AModuleInfo(Pointer(lParam))[Result].Name := Modules[Result].Info.Name; + AModuleInfo(Pointer(lParam))[Result].Version := Modules[Result].Info.Version; + AModuleInfo(Pointer(lParam))[Result].Description := Modules[Result].Info.Description; + end; + Except + Result := -1; + end; + end; +end; + +//------------- +// Returns Application Handle +//------------- +Function TCore.GetApplicationHandle(wParam, lParam: DWord): integer; +begin + Result := hInstance; +end; + end. \ No newline at end of file diff --git a/Game/Code/Classes/UCoreModule.pas b/Game/Code/Classes/UCoreModule.pas index e5a874f0..b135089c 100644 --- a/Game/Code/Classes/UCoreModule.pas +++ b/Game/Code/Classes/UCoreModule.pas @@ -1,6 +1,9 @@ unit UCoreModule; interface + +{$I switches.inc} + {********************* TCoreModule Dummy Class that has Methods that will be called from Core @@ -8,10 +11,6 @@ interface *********************} uses UPluginDefs; -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - type PCoreModule = ^TCoreModule; TCoreModule = class diff --git a/Game/Code/Classes/UCovers.pas b/Game/Code/Classes/UCovers.pas index 966277cd..f4ede329 100644 --- a/Game/Code/Classes/UCovers.pas +++ b/Game/Code/Classes/UCovers.pas @@ -2,9 +2,7 @@ unit UCovers; interface -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} +{$I switches.inc} uses OpenGL12, {$IFDEF win32} diff --git a/Game/Code/Classes/UDLLManager.pas b/Game/Code/Classes/UDLLManager.pas index ff6c16a4..358be9af 100644 --- a/Game/Code/Classes/UDLLManager.pas +++ b/Game/Code/Classes/UDLLManager.pas @@ -1,12 +1,9 @@ unit UDLLManager; -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - interface +{$I switches.inc} + uses ModiSDK, UFiles; @@ -44,15 +41,19 @@ var const DLLPath = 'Plugins'; - {$IFDEF win32} + {$IFDEF MSWINDOWS} DLLExt = '.dll'; - {$ELSE} + {$ENDIF} + {$IFDEF LINUX} DLLExt = '.so'; {$ENDIF} + {$IFDEF DARWIN} + DLLExt = '.dylib'; + {$ENDIF} implementation -uses {$IFDEF win32} +uses {$IFDEF MSWINDOWS} windows, {$ELSE} dynlibs, diff --git a/Game/Code/Classes/UDataBase.pas b/Game/Code/Classes/UDataBase.pas index bacb0d98..0cafc9fd 100644 --- a/Game/Code/Classes/UDataBase.pas +++ b/Game/Code/Classes/UDataBase.pas @@ -2,10 +2,7 @@ unit UDataBase; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - +{$I switches.inc} uses USongs, SQLiteTable3; diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 2a5528b8..350926d8 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -2,9 +2,7 @@ unit UDraw; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} +{$I switches.inc} uses UThemes, ModiSDK, @@ -243,7 +241,7 @@ begin lTmpA := (Right-Left); lTmpB := (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); - {$IFDEF FPC} + {$IFDEF LAZARUS} (* writeln( 'UDRAW (Right-Left) : ' + floattostr( lTmpA ) ); writeln( 'UDRAW : ' + floattostr( lTmpB ) ); @@ -479,7 +477,7 @@ begin lTmpA := (Right-Left); lTmpB := (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); - {$IFDEF FPC} + {$IFDEF LAZARUS} {* writeln( 'UDRAW (Right-Left) : ' + floattostr( lTmpA ) ); writeln( 'UDRAW : ' + floattostr( lTmpB ) ); diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index 717d20e2..5f168ead 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -2,9 +2,7 @@ unit UFiles; interface -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} +{$I switches.inc} uses SysUtils, ULog, diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 5847e41c..26601f2d 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -4,10 +4,6 @@ interface {$I switches.inc} -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - uses SDL, OpenGL12, diff --git a/Game/Code/Classes/UGraphicClasses.pas b/Game/Code/Classes/UGraphicClasses.pas index c04a0ad8..2acd5530 100644 --- a/Game/Code/Classes/UGraphicClasses.pas +++ b/Game/Code/Classes/UGraphicClasses.pas @@ -5,10 +5,6 @@ interface {$I switches.inc} -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - uses UTexture; const DelayBetweenFrames : Cardinal = 60; diff --git a/Game/Code/Classes/UHooks.pas b/Game/Code/Classes/UHooks.pas index c3684ed1..ea31ec50 100644 --- a/Game/Code/Classes/UHooks.pas +++ b/Game/Code/Classes/UHooks.pas @@ -6,14 +6,11 @@ unit UHooks; Saves all hookable events and their subscribers *********************} interface -uses uPluginDefs, SysUtils; -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - {$I switches.inc} +uses uPluginDefs, SysUtils; + type //Record that saves info from Subscriber PSubscriberInfo = ^TSubscriberInfo; @@ -422,7 +419,7 @@ end; function HookTest(wParam, lParam: DWord): integer; stdcall; begin Result := 0; //Don't break the chain - Core.ShowMessage(CORE_SM_INFO, Integer(PChar(String(PChar(Ptr(lParam))) + ': ' + String(PChar(Ptr(wParam)))))); + Core.ShowMessage(CORE_SM_INFO, Integer(PChar(String(PChar(Pointer(lParam))) + ': ' + String(PChar(Pointer(wParam)))))); end; end. diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index 6b7f3cea..36ba2180 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -2,9 +2,7 @@ unit UIni; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} +{$I switches.inc} uses IniFiles, ULog, SysUtils; diff --git a/Game/Code/Classes/ULCD.pas b/Game/Code/Classes/ULCD.pas index 50214ad0..13736729 100644 --- a/Game/Code/Classes/ULCD.pas +++ b/Game/Code/Classes/ULCD.pas @@ -1,6 +1,7 @@ unit ULCD; interface + {$I switches.inc} type diff --git a/Game/Code/Classes/ULanguage.pas b/Game/Code/Classes/ULanguage.pas index 679f6405..25986263 100644 --- a/Game/Code/Classes/ULanguage.pas +++ b/Game/Code/Classes/ULanguage.pas @@ -2,10 +2,8 @@ unit ULanguage; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - +{$I switches.inc} + type TLanguageEntry = record diff --git a/Game/Code/Classes/ULight.pas b/Game/Code/Classes/ULight.pas index 99edc88c..6621cf59 100644 --- a/Game/Code/Classes/ULight.pas +++ b/Game/Code/Classes/ULight.pas @@ -2,10 +2,6 @@ unit ULight; interface -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - {$I switches.inc} type @@ -55,7 +51,11 @@ uses begin GetLocalTime(SystemTime); with SystemTime do +{$IFDEF DARWIN} + Result := EncodeTime(Hour, Minute, Second, MilliSecond); +{$ELSE} Result := EncodeTime(wHour, wMinute, wSecond, wMilliSeconds); +{$ENDIF} end; {$ELSE} Type diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index 7e464b57..2ce70a11 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -4,10 +4,6 @@ interface {$I switches.inc} -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - uses Classes; type @@ -191,7 +187,7 @@ begin {$DEFINE DEBUG} //How can i check if this is set in *.dpr file o0 //If Debug => Write to Console Output {$IFDEF DEBUG} - WriteLn('Error: ' + Text); + WriteLn('Error: ' + Text); {$ENDIF} end; @@ -229,7 +225,7 @@ begin //If Debug => Write to Console Output {$IFDEF DEBUG} - WriteLn(Log2 + ': ' + Log1); + WriteLn(Log2 + ': ' + Log1); {$ENDIF} end; @@ -243,7 +239,7 @@ begin //Write Error to Logfile: LogError (Text); - {$IFDEF win32} + {$IFDEF MSWINDOWS} //Show Errormessage Messagebox(0, PChar(Text), PChar(Title), MB_ICONERROR or MB_OK); {$ELSE} diff --git a/Game/Code/Classes/ULyrics.pas b/Game/Code/Classes/ULyrics.pas index e4ac2024..96b9d43b 100644 --- a/Game/Code/Classes/ULyrics.pas +++ b/Game/Code/Classes/ULyrics.pas @@ -2,10 +2,6 @@ unit ULyrics; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - {$I switches.inc} uses OpenGL12, diff --git a/Game/Code/Classes/ULyrics_bak.pas b/Game/Code/Classes/ULyrics_bak.pas index 43fa46f5..b5a9d798 100644 --- a/Game/Code/Classes/ULyrics_bak.pas +++ b/Game/Code/Classes/ULyrics_bak.pas @@ -2,10 +2,6 @@ unit ULyrics_bak; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - {$I switches.inc} uses SysUtils, diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 82fb92e4..bbc64f80 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -2,10 +2,6 @@ unit UMain; interface -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - {$I switches.inc} uses @@ -119,6 +115,7 @@ var procedure InitializePaths; +Procedure Main; procedure MainLoop; procedure CheckEvents; procedure Sing(Sender: TScreenSing); @@ -133,7 +130,275 @@ function GetTimeFromBeat(Beat: integer): real; procedure ClearScores(PlayerNum: integer); implementation -uses USongs, UJoystick, math, UCommandLine; + +uses USongs, UJoystick, math, UCommandLine, ULanguage, SDL_ttf, + USkins, UCovers, UCatCovers, UDataBase, UPlaylist, UDLLManager, + UParty, UCore, UGraphicClasses, UPluginDefs; + +const + Version = 'UltraStar Deluxe V 1.10 Alpha Build'; + +{$IFDEF WIN32} +Procedure Main; +var + WndTitle: string; + hWnd: THandle; + I: Integer; +begin + WndTitle := Version; + +// InitializeSound(); +// writeln( 'DONE' ); +// exit; + + + {$IFDEF MSWINDOWS} + //------------------------------ + //Start more than One Time Prevention + //------------------------------ + hWnd:= FindWindow(nil, PChar(WndTitle)); + //Programm already started + if (hWnd <> 0) then + begin + I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Continue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); + if (I = IDYes) then + begin + I := 1; + repeat + Inc(I); + hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); + until (hWnd = 0); + WndTitle := WndTitle + ' Instance ' + InttoStr(I); + end + else + Exit; + end; + {$ENDIF} + + //------------------------------ + //StartUp - Create Classes and Load Files + //------------------------------ + USTime := TTime.Create; + + // Commandline Parameter Parser + Params := TCMDParams.Create; + + // Log + Benchmark + Log := TLog.Create; + Log.Title := WndTitle; + Log.Enabled := Not Params.NoLog; + Log.BenchmarkStart(0); + + // Language + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Paths', 'Initialization'); + InitializePaths; + Log.LogStatus('Load Language', 'Initialization'); + Language := TLanguage.Create; + //Add Const Values: + Language.AddConst('US_VERSION', Version); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Language', 1); + + // SDL + Log.BenchmarkStart(1); + Log.LogStatus('Initialize SDL', 'Initialization'); + SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing SDL', 1); + + // SDL_ttf + Log.BenchmarkStart(1); + Log.LogStatus('Initialize SDL_ttf', 'Initialization'); + TTF_Init(); //ttf_quit(); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing SDL_ttf', 1); + + // Skin + Log.BenchmarkStart(1); + Log.LogStatus('Loading Skin List', 'Initialization'); + Skin := TSkin.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Skin List', 1); + + // Sound Card List + Log.BenchmarkStart(1); + Log.LogStatus('Loading Soundcard list', 'Initialization'); + Recording := TRecord.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Soundcard list', 1); + + // Ini + Paths + Log.BenchmarkStart(1); + Log.LogStatus('Load Ini', 'Initialization'); + Ini := TIni.Create; + Ini.Load; + + //Load Languagefile + if (Params.Language <> -1) then + Language.ChangeLanguage(ILanguage[Params.Language]) + else + Language.ChangeLanguage(ILanguage[Ini.Language]); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Ini', 1); + + + // LCD + Log.BenchmarkStart(1); + Log.LogStatus('Load LCD', 'Initialization'); + LCD := TLCD.Create; + if Ini.LPT = 1 then begin +// LCD.HalfInterface := true; + LCD.Enable; + LCD.Clear; + LCD.WriteText(1, ' UltraStar '); + LCD.WriteText(2, ' Loading... '); + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading LCD', 1); + + // Light + Log.BenchmarkStart(1); + Log.LogStatus('Load Light', 'Initialization'); + Light := TLight.Create; + if Ini.LPT = 2 then begin + Light.Enable; + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Light', 1); + + + + // Theme + Log.BenchmarkStart(1); + Log.LogStatus('Load Themes', 'Initialization'); + Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Themes', 1); + + // Covers Cache + Log.BenchmarkStart(1); + Log.LogStatus('Creating Covers Cache', 'Initialization'); + Covers := TCovers.Create; + Log.LogBenchmark('Loading Covers Cache Array', 1); + Log.BenchmarkStart(1); + + // Category Covers + Log.BenchmarkStart(1); + Log.LogStatus('Creating Category Covers Array', 'Initialization'); + CatCovers:= TCatCovers.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Category Covers Array', 1); + + // Songs + //Log.BenchmarkStart(1); + Log.LogStatus('Creating Song Array', 'Initialization'); + Songs := TSongs.Create; + Songs.LoadSongList; + Log.LogStatus('Creating 2nd Song Array', 'Initialization'); + CatSongs := TCatSongs.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Songs', 1); + + // PluginManager + Log.BenchmarkStart(1); + Log.LogStatus('PluginManager', 'Initialization'); + DLLMan := TDLLMan.Create; //Load PluginList + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PluginManager', 1); + + // Party Mode Manager + Log.BenchmarkStart(1); + Log.LogStatus('PartySession Manager', 'Initialization'); + PartySession := TParty_Session.Create; //Load PartySession + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PartySession Manager', 1); + + // Sound + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Sound', 'Initialization'); + InitializeSound(); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Sound', 1); + +// exit; + + // Graphics + Log.BenchmarkStart(1); + Log.LogStatus('Initialize 3D', 'Initialization'); + Initialize3D(WndTitle); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing 3D', 1); + + // Score Saving System + Log.BenchmarkStart(1); + Log.LogStatus('DataBase System', 'Initialization'); + DataBase := TDataBaseSystem.Create; + + if (Params.ScoreFile = '') then + DataBase.Init ('Ultrastar.db') + else + DataBase.Init (Params.ScoreFile); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading DataBase System', 1); + + //Playlist Manager + Log.BenchmarkStart(1); + Log.LogStatus('Playlist Manager', 'Initialization'); + PlaylistMan := TPlaylistManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Playlist Manager', 1); + + //GoldenStarsTwinkleMod + Log.BenchmarkStart(1); + Log.LogStatus('Effect Manager', 'Initialization'); + GoldenRec := TEffectManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Particel System', 1); + + // Joypad + if (Ini.Joypad = 1) OR (Params.Joypad) then begin + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Joystick', 'Initialization'); + Joy := TJoy.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Joystick', 1); + end; + + Log.BenchmarkEnd(0); + Log.LogBenchmark('Loading Time', 0); + + Log.LogError('Creating Core'); + Core := TCore.Create('Ultrastar Deluxe Beta', MakeVersion(1,1,0, chr(0))); + + Log.LogError('Running Core'); + Core.Run; + + //------------------------------ + //Start- Mainloop + //------------------------------ + //Music.SetLoop(true); + //Music.SetVolume(50); + //Music.Open(SkinPath + 'Menu Music 3.mp3'); + //Music.Play; + Log.LogStatus('Main Loop', 'Initialization'); + MainLoop; + + //------------------------------ + //Finish Application + //------------------------------ + if Ini.LPT = 1 then LCD.Clear; + if Ini.LPT = 2 then Light.TurnOff; + + Log.LogStatus('Main Loop', 'Finished'); + + Log.Free; + +end; +{$ENDIF} procedure MainLoop; var diff --git a/Game/Code/Classes/UMedia_dummy.pas b/Game/Code/Classes/UMedia_dummy.pas index bf3ad727..37e311af 100644 --- a/Game/Code/Classes/UMedia_dummy.pas +++ b/Game/Code/Classes/UMedia_dummy.pas @@ -12,10 +12,7 @@ unit UMedia_dummy; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - +{$I switches.inc} implementation diff --git a/Game/Code/Classes/UModules.pas b/Game/Code/Classes/UModules.pas index 493fc393..fe623343 100644 --- a/Game/Code/Classes/UModules.pas +++ b/Game/Code/Classes/UModules.pas @@ -1,6 +1,9 @@ unit UModules; interface + +{$I switches.inc} + {********************* UModules Unit Contains all used Modules in its uses clausel diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index f3342625..e2d2cc60 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -4,10 +4,6 @@ interface {$I switches.inc} -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - uses Classes ; type diff --git a/Game/Code/Classes/UParty.pas b/Game/Code/Classes/UParty.pas index 9be0df3e..4f351dc5 100644 --- a/Game/Code/Classes/UParty.pas +++ b/Game/Code/Classes/UParty.pas @@ -2,10 +2,7 @@ unit UParty; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - +{$I switches.inc} uses ModiSDK; diff --git a/Game/Code/Classes/UPlaylist.pas b/Game/Code/Classes/UPlaylist.pas index 3f89ffed..b18d4833 100644 --- a/Game/Code/Classes/UPlaylist.pas +++ b/Game/Code/Classes/UPlaylist.pas @@ -2,10 +2,8 @@ unit UPlaylist; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - +{$I switches.inc} + type TPlaylistItem = record diff --git a/Game/Code/Classes/UPliki.pas b/Game/Code/Classes/UPliki.pas index f7692990..f4e8ff97 100644 --- a/Game/Code/Classes/UPliki.pas +++ b/Game/Code/Classes/UPliki.pas @@ -2,6 +2,8 @@ unit UPliki; interface +{$I switches.inc} + uses USongs, SysUtils, ULog, UMusic; procedure InitializePaths; diff --git a/Game/Code/Classes/UPluginInterface.pas b/Game/Code/Classes/UPluginInterface.pas index a9cc7e46..56293848 100644 --- a/Game/Code/Classes/UPluginInterface.pas +++ b/Game/Code/Classes/UPluginInterface.pas @@ -6,6 +6,9 @@ unit uPluginInterface; *********************} interface + +{$I switches.inc} + uses uPluginDefs; //--------------- diff --git a/Game/Code/Classes/URecord.pas b/Game/Code/Classes/URecord.pas index b553504d..8d3fa5f7 100644 --- a/Game/Code/Classes/URecord.pas +++ b/Game/Code/Classes/URecord.pas @@ -4,10 +4,6 @@ interface {$I switches.inc} -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - uses Classes, Math, SysUtils, diff --git a/Game/Code/Classes/UServices.pas b/Game/Code/Classes/UServices.pas index 0028576b..92b61e85 100644 --- a/Game/Code/Classes/UServices.pas +++ b/Game/Code/Classes/UServices.pas @@ -1,6 +1,9 @@ unit UServices; interface + +{$I switches.inc} + uses uPluginDefs, SysUtils; {********************* TServiceManager @@ -8,12 +11,6 @@ uses uPluginDefs, SysUtils; Saves all Services and their Procs *********************} -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - type TServiceName = String[60]; PServiceInfo = ^TServiceInfo; @@ -221,7 +218,7 @@ begin //Backup CurExecuted CurExecutedBackup := Core.CurExecuted; - Service := ptr(SExists); + Service := Pointer(SExists); If (Service.isClass) then //Use Proc of Class diff --git a/Game/Code/Classes/USingNotes.pas b/Game/Code/Classes/USingNotes.pas index e2162bf1..f0754105 100644 --- a/Game/Code/Classes/USingNotes.pas +++ b/Game/Code/Classes/USingNotes.pas @@ -1,6 +1,9 @@ unit USingNotes; interface + +{$I switches.inc} + { Dummy Unit atm For further expantation Placeholder for Class that will handle the Notes Drawing} diff --git a/Game/Code/Classes/USingScores.pas b/Game/Code/Classes/USingScores.pas index 11f1f07d..d5256dc9 100644 --- a/Game/Code/Classes/USingScores.pas +++ b/Game/Code/Classes/USingScores.pas @@ -2,9 +2,7 @@ unit USingScores; interface -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} +{$I switches.inc} uses UThemes, OpenGl12, @@ -425,7 +423,7 @@ begin // TODO : JB_Lazarus - Exception=Invalid floating point operation // AT THIS LINE ! - {$IFDEF FPC} + {$IFDEF LAZARUS} (* writeln( 'USINGSCORES-aPlayers[Cur.Player].RBTarget : ' + floattostr( aPlayers[Cur.Player].RBTarget ) ); writeln( 'USINGSCORES-(Cur.ScoreDiff - Cur.ScoreGiven) : ' + floattostr( (Cur.ScoreDiff - Cur.ScoreGiven) ) ); @@ -438,7 +436,7 @@ begin lTempA := ( aPlayers[Cur.Player].RBTarget + (Cur.ScoreDiff - Cur.ScoreGiven) ); lTempB := ( Cur.ScoreDiff * (Cur.Rating / 20 - 0.26) ); - {$IFDEF FPC} + {$IFDEF LAZARUS} (* writeln( 'USINGSCORES-lTempA : ' + floattostr( lTempA ) ); writeln( 'USINGSCORES-lTempB : ' + floattostr( lTempB ) ); diff --git a/Game/Code/Classes/USkins.pas b/Game/Code/Classes/USkins.pas index c9d7f2fd..5bab885b 100644 --- a/Game/Code/Classes/USkins.pas +++ b/Game/Code/Classes/USkins.pas @@ -1,12 +1,9 @@ unit USkins; -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - interface +{$I switches.inc} + type TSkinTexture = record Name: string; diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 5ce35201..9e0d6ca5 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -2,14 +2,15 @@ unit USongs; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - +{$I switches.inc} uses SysUtils, - {$ifndef win32} - oldlinux, + {$ifndef MSWINDOWS} + {$IFDEF DARWIN} + baseunix, + {$ELSE} + oldlinux, + {$ENDIF} {$endif} ULog, UTexture, @@ -115,6 +116,12 @@ uses StrUtils, UMain, UIni; +{$IFDEF DARWIN} +function AnsiContainsText(const AText, ASubText: string): Boolean; +begin + Result := AnsiPos(AnsiUppercase(ASubText), AnsiUppercase(AText)) > 0; +end; +{$ENDIF} procedure TSongs.LoadSongList; begin @@ -136,7 +143,7 @@ procedure TSongs.BrowseDir(Dir: widestring); var SLen: integer; - {$ifdef win32} + {$ifdef MSWINDOWS} SR: TSearchRecW; // for parsing Songs Directory {$else} // This should work on all posix systems. TheDir : pdir; @@ -145,7 +152,7 @@ var info : stat; {$endif} begin - {$ifdef win32} + {$ifdef MSWINDOWS} if FindFirstW(Dir + '*', faDirectory, SR) = 0 then // JB_Unicode - windows begin repeat @@ -186,8 +193,9 @@ begin until FindNextW(SR) <> 0; end; // if FindFirst FindCloseW(SR); - - {$else} + {$ENDIF} + + {$IFDEF LINUX} // Itterate the Songs Directory... ( With unicode capable functions for linux ) TheDir := opendir( Dir ); // JB_Unicode - linux if TheDir <> nil then @@ -245,6 +253,66 @@ begin Until ADirent=Nil; end; // if FindFirst + {$endif} + + {$IFDEF DARWIN} + // Itterate the Songs Directory... ( With unicode capable functions for linux ) + TheDir := FPOpenDir( Dir ); // JB_Unicode - linux + if TheDir <> nil then + begin + repeat + ADirent := FPReadDir(TheDir); + + If ADirent<>Nil then + begin + With ADirent^ do + begin + + if ( d_name[0] <> '.') then + BrowseDir( Dir + d_name + pathdelim ); + + end; + end; + Until ADirent=Nil; + end; + + + + TheDir := FPOpenDir( Dir ); // JB_Unicode - linux + if TheDir <> nil then + begin + repeat + ADirent := FPReadDir(TheDir); + + if ( ADirent <> Nil ) AND + ( pos( '.txt', ADirent^.d_name ) > -1 ) then + begin + SLen := BrowsePos; + + Song[SLen].Path := Dir; + Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); + Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); + Song[SLen].FileName := ADirent^.d_name; + + if (AnalyseFile(Song[SLen]) = false) then + Dec(BrowsePos) + else + begin + if Song[SLen].Cover = '' then + Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); + end; + + //Change Length Only every 50 Entrys + Inc(BrowsePos); + + if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then + begin + SetLength(Song, Length(Song) + 50); + end; + end; + + Until ADirent=Nil; + end; // if FindFirst {$endif} diff --git a/Game/Code/Classes/UTextClasses.pas b/Game/Code/Classes/UTextClasses.pas index 5a0655e5..a09456b8 100644 --- a/Game/Code/Classes/UTextClasses.pas +++ b/Game/Code/Classes/UTextClasses.pas @@ -1,6 +1,9 @@ unit UTextClasses; interface + +{$I switches.inc} + uses OpenGL12, SDL, UTexture, diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 5ef29316..76d78f5b 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -19,10 +19,6 @@ interface {$I switches.inc} -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - uses OpenGL12, {$IFDEF win32} windows, @@ -131,7 +127,7 @@ implementation uses ULog, DateUtils, UCovers, - {$IFDEF FPC} + {$IFDEF LAZARUS} LResources, {$ENDIF} StrUtils, dialogs; @@ -247,7 +243,7 @@ var TexRWops: PSDL_RWops; dHandle: THandle; - {$IFDEF FPC} + {$IFDEF LAZARUS} lLazRes : TLResource; lResData : TStringStream; {$ELSE} @@ -277,7 +273,7 @@ begin Log.LogStatus( 'IS Resource, because file does not exist.('+Identifier+')', ' LoadImage' ); // load from resource stream - {$IFNDEF FPC} + {$IFDEF WIN32} dHandle := FindResource(hInstance, Identifier, 'TEX'); if dHandle=0 then begin @@ -1134,7 +1130,7 @@ begin end; end; -{$IFDEF FPC} +{$IFDEF LAZARUS} initialization {$I UltraStar.lrs} {$ENDIF} diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 00b763f0..c27f9c9e 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -2,9 +2,7 @@ unit UThemes; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} +{$I switches.inc} uses ULog, diff --git a/Game/Code/Classes/UTime.pas b/Game/Code/Classes/UTime.pas index 87d17ee5..f714fed5 100644 --- a/Game/Code/Classes/UTime.pas +++ b/Game/Code/Classes/UTime.pas @@ -2,9 +2,7 @@ unit UTime; interface -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} +{$I switches.inc} {$UNDEF DebugDisplay} diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index 154cd04c..c18eea6c 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -20,9 +20,7 @@ unit UVideo; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} +{$I switches.inc} (* diff --git a/Game/Code/Classes/uPluginLoader.pas b/Game/Code/Classes/uPluginLoader.pas index 442e76e0..55c89878 100644 --- a/Game/Code/Classes/uPluginLoader.pas +++ b/Game/Code/Classes/uPluginLoader.pas @@ -1,793 +1,797 @@ -unit UPluginLoader; -{********************* - UPluginLoader - Unit contains to Classes - TPluginLoader: Class Searching for and Loading the Plugins - TtehPlugins: Class that represents the Plugins in Modules chain -*********************} - -interface -uses UPluginDefs, UCoreModule; -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -type - TPluginListItem = record - Info: TUS_PluginInfo; - State: Byte; //State of this Plugin: 0 - undefined; 1 - Loaded; 2 - Inited / Running; 4 - Unloaded; 254 - Loading aborted by Plugin; 255 - Unloaded because of Error - Path: String; //Path to this Plugin - NeedsDeInit: Boolean; //If this is Inited correctly this should be true - hLib: THandle; //Handle of Loaded Libary - Procs: record //Procs offered by Plugin. Don't call this directly use wrappers of TPluginLoader - Load: Func_Load; - Init: Func_Init; - DeInit: Proc_DeInit; - end; - end; - {********************* - TPluginLoader - Class Searches for Plugins and Manages loading and unloading - *********************} - PPluginLoader = ^TPluginLoader; - TPluginLoader = class (TCoreModule) - private - LoadingProcessFinished: Boolean; - sUnloadPlugin: THandle; - sLoadPlugin: THandle; - sGetPluginInfo: THandle; - sGetPluginState: THandle; - - Procedure FreePlugin(Index: Cardinal); - public - PluginInterface: TUS_PluginInterface; - Plugins: Array of TPluginListItem; - - //TCoreModule methods to inherit - Constructor Create; override; - Procedure Info(const pInfo: PModuleInfo); override; - Function Load: Boolean; override; - Function Init: Boolean; override; - Procedure DeInit; override; - Procedure Free; override; - - //New Methods - Procedure BrowseDir(Path: String); //Browses the Path at _Path_ for Plugins - Function PluginExists(Name: String): Integer; //If Plugin Exists: Index of Plugin, else -1 - Procedure AddPlugin(Filename: String);//Adds Plugin to the Array - - Function CallLoad(Index: Cardinal): Integer; - Function CallInit(Index: Cardinal): Integer; - Procedure CallDeInit(Index: Cardinal); - - //Services offered - Function LoadPlugin(wParam, lParam: DWord): integer; //wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin - Function UnloadPlugin(wParam, lParam: DWord): integer; //wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin - Function GetPluginInfo(wParam, lParam: DWord): integer; //If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Get PluginInfo of Plugin with Index(wParam) to Address at lParam) - Function GetPluginState(wParam, lParam: DWord): integer; //If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Return PluginInfo of Plugin with Index(wParam)) - - end; - - {********************* - TtehPlugins - Class Represents the Plugins in Module Chain. - It Calls the Plugins Procs and Funcs - *********************} - TtehPlugins = class (TCoreModule) - private - PluginLoader: PPluginLoader; - public - //TCoreModule methods to inherit - Constructor Create; override; - - Procedure Info(const pInfo: PModuleInfo); override; - Function Load: Boolean; override; - Function Init: Boolean; override; - Procedure DeInit; override; - end; - -const - {$IFDEF win32} - PluginFileExtension = '.dll'; - {$ELSE} - PluginFileExtension = '.so'; - {$ENDIF} - -implementation -uses UCore, UPluginInterface, -{$IFDEF win32} +unit UPluginLoader; +{********************* + UPluginLoader + Unit contains to Classes + TPluginLoader: Class Searching for and Loading the Plugins + TtehPlugins: Class that represents the Plugins in Modules chain +*********************} + +interface + +{$I switches.inc} + +uses UPluginDefs, UCoreModule; + +type + TPluginListItem = record + Info: TUS_PluginInfo; + State: Byte; //State of this Plugin: 0 - undefined; 1 - Loaded; 2 - Inited / Running; 4 - Unloaded; 254 - Loading aborted by Plugin; 255 - Unloaded because of Error + Path: String; //Path to this Plugin + NeedsDeInit: Boolean; //If this is Inited correctly this should be true + hLib: THandle; //Handle of Loaded Libary + Procs: record //Procs offered by Plugin. Don't call this directly use wrappers of TPluginLoader + Load: Func_Load; + Init: Func_Init; + DeInit: Proc_DeInit; + end; + end; + {********************* + TPluginLoader + Class Searches for Plugins and Manages loading and unloading + *********************} + PPluginLoader = ^TPluginLoader; + TPluginLoader = class (TCoreModule) + private + LoadingProcessFinished: Boolean; + sUnloadPlugin: THandle; + sLoadPlugin: THandle; + sGetPluginInfo: THandle; + sGetPluginState: THandle; + + Procedure FreePlugin(Index: Cardinal); + public + PluginInterface: TUS_PluginInterface; + Plugins: Array of TPluginListItem; + + //TCoreModule methods to inherit + Constructor Create; override; + Procedure Info(const pInfo: PModuleInfo); override; + Function Load: Boolean; override; + Function Init: Boolean; override; + Procedure DeInit; override; + Procedure Free; override; + + //New Methods + Procedure BrowseDir(Path: String); //Browses the Path at _Path_ for Plugins + Function PluginExists(Name: String): Integer; //If Plugin Exists: Index of Plugin, else -1 + Procedure AddPlugin(Filename: String);//Adds Plugin to the Array + + Function CallLoad(Index: Cardinal): Integer; + Function CallInit(Index: Cardinal): Integer; + Procedure CallDeInit(Index: Cardinal); + + //Services offered + Function LoadPlugin(wParam, lParam: DWord): integer; //wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin + Function UnloadPlugin(wParam, lParam: DWord): integer; //wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin + Function GetPluginInfo(wParam, lParam: DWord): integer; //If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Get PluginInfo of Plugin with Index(wParam) to Address at lParam) + Function GetPluginState(wParam, lParam: DWord): integer; //If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Return PluginInfo of Plugin with Index(wParam)) + + end; + + {********************* + TtehPlugins + Class Represents the Plugins in Module Chain. + It Calls the Plugins Procs and Funcs + *********************} + TtehPlugins = class (TCoreModule) + private + PluginLoader: PPluginLoader; + public + //TCoreModule methods to inherit + Constructor Create; override; + + Procedure Info(const pInfo: PModuleInfo); override; + Function Load: Boolean; override; + Function Init: Boolean; override; + Procedure DeInit; override; + end; + +const + {$IFDEF MSWINDOWS} + PluginFileExtension = '.dll'; + {$ENDIF} + {$IFDEF LINUX} + PluginFileExtension = '.so'; + {$ENDIF} + {$IFDEF DARWIN} + PluginFileExtension = '.dylib'; + {$ENDIF} + +implementation +uses UCore, UPluginInterface, +{$IFDEF MSWINDOWS} windows, {$ELSE} dynlibs, {$ENDIF} -UMain, SysUtils; - -{********************* - TPluginLoader - Implentation -*********************} - -//------------- -// Function that gives some Infos about the Module to the Core -//------------- -Procedure TPluginLoader.Info(const pInfo: PModuleInfo); -begin - pInfo^.Name := 'TPluginLoader'; - pInfo^.Version := MakeVersion(1,0,0,chr(0)); - pInfo^.Description := 'Searches for Plugins, loads and unloads them'; -end; - -//------------- -// Just the Constructor -//------------- -Constructor TPluginLoader.Create; -begin - //Init PluginInterface - //Using Methods from UPluginInterface - PluginInterface.CreateHookableEvent := CreateHookableEvent; - PluginInterface.DestroyHookableEvent := DestroyHookableEvent; - PluginInterface.NotivyEventHooks := NotivyEventHooks; - PluginInterface.HookEvent := HookEvent; - PluginInterface.UnHookEvent := UnHookEvent; - PluginInterface.EventExists := EventExists; - - PluginInterface.CreateService := CreateService; - PluginInterface.DestroyService := DestroyService; - PluginInterface.CallService := CallService; - PluginInterface.ServiceExists := ServiceExists; - - //UnSet Private Var - LoadingProcessFinished := False; -end; - -//------------- -//Is Called on Loading. -//In this Method only Events and Services should be created -//to offer them to other Modules or Plugins during the Init process -//If False is Returned this will cause a Forced Exit -//------------- -Function TPluginLoader.Load: Boolean; -begin - Result := True; - - Try - //Start Searching for Plugins - BrowseDir(PluginPath); - Except - Result := False; - Core.ReportError(Integer(PChar('Error Browsing and Loading.')), Integer(PChar('TPluginLoader'))); - end; -end; - -//------------- -//Is Called on Init Process -//In this Method you can Hook some Events and Create + Init -//your Classes, Variables etc. -//If False is Returned this will cause a Forced Exit -//------------- -Function TPluginLoader.Init: Boolean; -begin - //Just set Prvate Var to true. - LoadingProcessFinished := True; - Result := True; -end; - -//------------- -//Is Called if this Module has been Inited and there is a Exit. -//Deinit is in backwards Initing Order -//------------- -Procedure TPluginLoader.DeInit; -var - I: Integer; -begin - //Force DeInit - //If some Plugins aren't DeInited for some Reason o0 - For I := 0 to High(Plugins) do - begin - If (Plugins[I].State < 4) then - FreePlugin(I); - end; - - //Nothing to do here. Core will remove the Hooks -end; - -//------------- -//Is Called if this Module will be unloaded and has been created -//Should be used to Free Memory -//------------- -Procedure TPluginLoader.Free; -begin - //Just save some Memory if it wasn't done now.. - SetLength(Plugins, 0); -end; - -//-------------- -// Browses the Path at _Path_ for Plugins -//-------------- -Procedure TPluginLoader.BrowseDir(Path: String); -var - SR: TSearchRec; -begin - //Search for other Dirs to Browse - if FindFirst(Path + '*', faDirectory, SR) = 0 then begin - repeat - if (SR.Name <> '.') and (SR.Name <> '..') then - BrowseDir(Path + Sr.Name + PathDelim); - until FindNext(SR) <> 0; - end; - FindClose(SR); - - //Search for Plugins at Path - if FindFirst(Path + '*' + PluginFileExtension, 0, SR) = 0 then - begin - repeat - AddPlugin(Path + SR.Name); - until FindNext(SR) <> 0; - end; - FindClose(SR); -end; - -//-------------- -// If Plugin Exists: Index of Plugin, else -1 -//-------------- -Function TPluginLoader.PluginExists(Name: String): Integer; -var - I: Integer; -begin - Result := -1; - - If (Length(Name) <= 32 { =>Length(TUS_PluginInfo.Name)}) then - begin - For I := 0 to High(Plugins) do - if (Plugins[I].Info.Name = Name) then - begin //Found the Plugin - Result := I; - Break; - end; - end; -end; - -//-------------- -// Adds Plugin to the Array -//-------------- -Procedure TPluginLoader.AddPlugin(Filename: String); -var - hLib: THandle; - PInfo: Proc_PluginInfo; - Info: TUS_PluginInfo; - PluginID: Integer; -begin - If (FileExists(Filename)) then - begin //Load Libary - hLib := LoadLibrary(PChar(Filename)); - If (hLib <> 0) then - begin //Try to get Address of the Info Proc - PInfo := GetProcAddress (hLib, PChar('USPlugin_Info')); - If (@PInfo <> nil) then - begin - Info.cbSize := SizeOf(TUS_PluginInfo); - - Try //Call Info Proc - PInfo(@Info); - Except - Info.Name := ''; - Core.ReportError(Integer(PChar('Error getting Plugin Info: ' + Filename)), Integer(PChar('TPluginLoader'))); - end; - - //Is Name set ? - If (Trim(Info.Name) <> '') then - begin - PluginID := PluginExists(Info.Name); - - If (PluginID > 0) AND (Plugins[PluginID].State >=4) then - PluginID := -1; - - If (PluginID = -1) then - begin - //Add new item to array - PluginID := Length(Plugins); - SetLength(Plugins, PluginID + 1); - - //Fill with Info: - Plugins[PluginID].Info := Info; - Plugins[PluginID].State := 0; - Plugins[PluginID].Path := Filename; - Plugins[PluginID].NeedsDeInit := False; - Plugins[PluginID].hLib := hLib; - - //Try to get Procs - Plugins[PluginID].Procs.Load := GetProcAddress (hLib, PChar('USPlugin_Load')); - Plugins[PluginID].Procs.Init := GetProcAddress (hLib, PChar('USPlugin_Init')); - Plugins[PluginID].Procs.DeInit := GetProcAddress (hLib, PChar('USPlugin_DeInit')); - - If (@Plugins[PluginID].Procs.Load = nil) OR (@Plugins[PluginID].Procs.Init = nil) OR (@Plugins[PluginID].Procs.DeInit = nil) then - begin - Plugins[PluginID].State := 255; - FreeLibrary(hLib); - Core.ReportError(Integer(PChar('Can''t get Plugin Procs from Libary: "' + Info.Name + '" ' + Filename)), Integer(PChar('TPluginLoader'))); - end; - - //Emulate loading process if this Plugin is loaded to late - If (LoadingProcessFinished) then - begin - CallLoad(PluginID); - CallInit(PluginID); - end; - end - Else If (LoadingProcessFinished = False) then - begin - If (Plugins[PluginID].Info.Version < Info.Version) then - begin //Found newer Version of this Plugin - Core.ReportDebug(Integer(PChar('Found a newer Version of Plugin: ' + Info.Name)), Integer(PChar('TPluginLoader'))); - - //Unload Old Plugin - UnloadPlugin(Integer(nil), PluginID); - - //Fill with new Info - Plugins[PluginID].Info := Info; - Plugins[PluginID].State := 0; - Plugins[PluginID].Path := Filename; - Plugins[PluginID].NeedsDeInit := False; - Plugins[PluginID].hLib := hLib; - - //Try to get Procs - Plugins[PluginID].Procs.Load := GetProcAddress (hLib, PChar('USPlugin_Load')); - Plugins[PluginID].Procs.Init := GetProcAddress (hLib, PChar('USPlugin_Init')); - Plugins[PluginID].Procs.DeInit := GetProcAddress (hLib, PChar('USPlugin_DeInit')); - - If (@Plugins[PluginID].Procs.Load = nil) OR (@Plugins[PluginID].Procs.Init = nil) OR (@Plugins[PluginID].Procs.DeInit = nil) then - begin - FreeLibrary(hLib); - Plugins[PluginID].State := 255; - Core.ReportError(Integer(PChar('Can''t get Plugin Procs from Libary: "' + Info.Name + '" ' + Filename)), Integer(PChar('TPluginLoader'))); - end; - end - else - begin //Newer Version already loaded - FreeLibrary(hLib); - end; - end - else - begin - FreeLibrary(hLib); - Core.ReportError(Integer(PChar('Plugin with this Name already exists: ' + Info.Name)), Integer(PChar('TPluginLoader'))); - end; - end - else - begin - FreeLibrary(hLib); - Core.ReportError(Integer(PChar('No name reported: ' + Filename)), Integer(PChar('TPluginLoader'))); - end; - end - else - begin - FreeLibrary(hLib); - Core.ReportError(Integer(PChar('Can''t find Info Procedure: ' + Filename)), Integer(PChar('TPluginLoader'))); - end; - end - else - Core.ReportError(Integer(PChar('Can''t load Plugin Libary: ' + Filename)), Integer(PChar('TPluginLoader'))); - end; -end; - -//-------------- -// Calls Load Func of Plugin with the given Index -//-------------- -Function TPluginLoader.CallLoad(Index: Cardinal): Integer; -begin - Result := -2; - If(Index < Length(Plugins)) then - begin - If (@Plugins[Index].Procs.Load <> nil) AND (Plugins[Index].State = 0) then - begin - Try - Result := Plugins[Index].Procs.Load(@PluginInterface); - Except - Result := -3; - End; - - If (Result = 0) then - Plugins[Index].State := 1 - Else - begin - FreePlugin(Index); - Plugins[Index].State := 255; - Core.ReportError(Integer(PChar('Error calling Load Function from Plugin: ' + Plugins[Index].Info.Name)), Integer(PChar('TPluginLoader'))); - end; - end; - end; -end; - -//-------------- -// Calls Init Func of Plugin with the given Index -//-------------- -Function TPluginLoader.CallInit(Index: Cardinal): Integer; -begin - Result := -2; - If(Index < Length(Plugins)) then - begin - If (@Plugins[Index].Procs.Init <> nil) AND (Plugins[Index].State = 1) then - begin - Try - Result := Plugins[Index].Procs.Init(@PluginInterface); - Except - Result := -3; - End; - - If (Result = 0) then - begin - Plugins[Index].State := 2; - Plugins[Index].NeedsDeInit := True; - end - Else - begin - FreePlugin(Index); - Plugins[Index].State := 255; - Core.ReportError(Integer(PChar('Error calling Init Function from Plugin: ' + Plugins[Index].Info.Name)), Integer(PChar('TPluginLoader'))); - end; - end; - end; -end; - -//-------------- -// Calls DeInit Proc of Plugin with the given Index -//-------------- -Procedure TPluginLoader.CallDeInit(Index: Cardinal); -begin - If(Index < Length(Plugins)) then - begin - If (Plugins[Index].State < 4) then - begin - If (@Plugins[Index].Procs.DeInit <> nil) and (Plugins[Index].NeedsDeInit) then - Try - Plugins[Index].Procs.DeInit(@PluginInterface); - Except - - End; - - //Don't forget to remove Services and Subscriptions by this Plugin - Core.Hooks.DelbyOwner(-1 - Index); - - FreePlugin(Index); - end; - end; -end; - -//-------------- -// Frees all Plugin Sources (Procs and Handles) - Helper for Deiniting Functions -//-------------- -Procedure TPluginLoader.FreePlugin(Index: Cardinal); -begin - Plugins[Index].State := 4; - Plugins[Index].Procs.Load := nil; - Plugins[Index].Procs.Init := nil; - Plugins[Index].Procs.DeInit := nil; - - If (Plugins[Index].hLib <> 0) then - FreeLibrary(Plugins[Index].hLib); -end; - - - -//-------------- -// wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin -//-------------- -Function TPluginLoader.LoadPlugin(wParam, lParam: DWord): integer; -var - Index: Integer; - sFile: String; -begin - Result := -1; - sFile := ''; - //lParam is ID - If (Ptr(wParam) = nil) then - begin - Index := lParam; - end - else - begin //wParam is PChar - try - sFile := String(PChar(Ptr(wParam))); - Index := PluginExists(sFile); - If (Index < 0) And FileExists(sFile) then - begin //Is Filename - AddPlugin(sFile); - Result := Plugins[High(Plugins)].State; - end; - except - Index := -2; - end; - end; - - - If (Index >= 0) and (Index < Length(Plugins)) then - begin - AddPlugin(Plugins[Index].Path); - Result := Plugins[Index].State; - end; -end; - -//-------------- -// wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin -//-------------- -Function TPluginLoader.UnloadPlugin(wParam, lParam: DWord): integer; -var - Index: Integer; - sName: String; -begin - Result := -1; - //lParam is ID - If (Ptr(wParam) = nil) then - begin - Index := lParam; - end - else - begin //wParam is PChar - try - sName := String(PChar(Ptr(wParam))); - Index := PluginExists(sName); - except - Index := -2; - end; - end; - - - If (Index >= 0) and (Index < Length(Plugins)) then - CallDeInit(Index) -end; - -//-------------- -// If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Get PluginInfo of Plugin with Index(wParam) to Address at lParam) -//-------------- -Function TPluginLoader.GetPluginInfo(wParam, lParam: DWord): integer; -var I: Integer; -begin - Result := 0; - If (wParam < 0) then - begin //Get Info of 1 Plugin - If (Ptr(lParam) <> nil) AND (wParam < Length(Plugins)) then - begin - Try - Result := 1; - PUS_PluginInfo(Ptr(lParam))^ := Plugins[wParam].Info; - Except - - End; - end; - end - Else If (Ptr(lParam) = nil) then - begin //Get Length of Plugin (Info) Array - Result := Length(Plugins); - end - Else //Write PluginInfo Array to Address in lParam - begin - Try - For I := 0 to high(Plugins) do - PAUS_PluginInfo(Ptr(lParam))^[I] := Plugins[I].Info; - Result := Length(Plugins); - Except - Core.ReportError(Integer(PChar('Could not write PluginInfo Array')), Integer(PChar('TPluginLoader'))); - End; - end; - -end; - -//-------------- -// If wParam = -1 then (If lParam = nil then get length of Plugin State Array. If lparam <> nil then write array of Byte to address at lparam) Else (Return State of Plugin with Index(wParam)) -//-------------- -Function TPluginLoader.GetPluginState(wParam, lParam: DWord): integer; -var I: Integer; -begin - Result := -1; - If (wParam < 0) then - begin //Get State of 1 Plugin - If (wParam < Length(Plugins)) then - begin - Result := Plugins[wParam].State; - end; - end - Else If (Ptr(lParam) = nil) then - begin //Get Length of Plugin (Info) Array - Result := Length(Plugins); - end - Else //Write PluginInfo Array to Address in lParam - begin - Try - For I := 0 to high(Plugins) do - Byte(Ptr(lParam + I)^) := Plugins[I].State; - Result := Length(Plugins); - Except - Core.ReportError(Integer(PChar('Could not write PluginState Array')), Integer(PChar('TPluginLoader'))); - End; - end; -end; - - - - - -{********************* - TtehPlugins - Implentation -*********************} - -//------------- -// Function that gives some Infos about the Module to the Core -//------------- -Procedure TtehPlugins.Info(const pInfo: PModuleInfo); -begin - pInfo^.Name := 'TtehPlugins'; - pInfo^.Version := MakeVersion(1,0,0,chr(0)); - pInfo^.Description := 'Module executing the Plugins!'; -end; - -//------------- -// Just the Constructor -//------------- -Constructor TtehPlugins.Create; -begin - PluginLoader := nil; -end; - -//------------- -//Is Called on Loading. -//In this Method only Events and Services should be created -//to offer them to other Modules or Plugins during the Init process -//If False is Returned this will cause a Forced Exit -//------------- -Function TtehPlugins.Load: Boolean; -var - I: Integer; //Counter - CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute -label Continue; -begin - //Get Pointer to PluginLoader - PluginLoader := PPluginLoader(Core.GetModulebyName('TPluginLoader')); - If (PluginLoader = nil) then - begin - Result := False; - Core.ReportError(Integer(PChar('Could not get Pointer to PluginLoader')), Integer(PChar('TtehPlugins'))); - end - else - begin - Result := True; - - //Backup CurExecuted - CurExecutedBackup := Core.CurExecuted; - - //Start Loading the Plugins - I := 0; - Continue: - Try - While (I <= High(PluginLoader.Plugins)) do - begin - Core.CurExecuted := -1 - I; - - //Unload Plugin if not correctly Executed - If (PluginLoader.CallLoad(I) <> 0) then - begin - PluginLoader.CallDeInit(I); - PluginLoader.Plugins[I].State := 254; //Plugin asks for unload - Core.ReportDebug(Integer(PChar('Plugin Selfabort during loading process: ' + PluginLoader.Plugins[I].Info.Name)), Integer(PChar('TtehPlugins'))); - end - else - Core.ReportDebug(Integer(PChar('Plugin loaded succesful: ' + PluginLoader.Plugins[I].Info.Name)), Integer(PChar('TtehPlugins'))); - - Inc(I); - end; - Except - //Plugin could not be loaded. - // => Show Error Message, then ShutDown Plugin - on E: Exception do - begin - PluginLoader.CallDeInit(I); - PluginLoader.Plugins[I].State := 255; //Plugin causes Error - Core.ReportError(Integer(PChar('Plugin causes Error during loading process: ' + PluginLoader.Plugins[I].Info.Name + ', ErrorMsg: "' + E.Message + '"')), Integer(PChar('TtehPlugins'))); - - - //don't forget to increase I - Inc(I); - end; - End; - - If (I <= High(PluginLoader.Plugins)) then - Goto Continue; - - //Reset CurExecuted - Core.CurExecuted := CurExecutedBackup; - end; -end; - -//------------- -//Is Called on Init Process -//In this Method you can Hook some Events and Create + Init -//your Classes, Variables etc. -//If False is Returned this will cause a Forced Exit -//------------- -Function TtehPlugins.Init: Boolean; -var - I: Integer; //Counter - CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute -label Continue; -begin - Result := True; - - //Backup CurExecuted - CurExecutedBackup := Core.CurExecuted; - - //Start Loading the Plugins - I := 0; - Continue: - Try - While (I <= High(PluginLoader.Plugins)) do - begin - Core.CurExecuted := -1 - I; - - //Unload Plugin if not correctly Executed - If (PluginLoader.CallInit(I) <> 0) then - begin - PluginLoader.CallDeInit(I); - PluginLoader.Plugins[I].State := 254; //Plugin asks for unload - Core.ReportDebug(Integer(PChar('Plugin Selfabort during init process: ' + PluginLoader.Plugins[I].Info.Name)), Integer(PChar('TtehPlugins'))); - end - else - Core.ReportDebug(Integer(PChar('Plugin inited succesful: ' + PluginLoader.Plugins[I].Info.Name)), Integer(PChar('TtehPlugins'))); - - //don't forget to increase I - Inc(I); - end; - Except - //Plugin could not be loaded. - // => Show Error Message, then ShutDown Plugin - PluginLoader.CallDeInit(I); - PluginLoader.Plugins[I].State := 255; //Plugin causes Error - Core.ReportError(Integer(PChar('Plugin causes Error during init process: ' + PluginLoader.Plugins[I].Info.Name)), Integer(PChar('TtehPlugins'))); - - //don't forget to increase I - Inc(I); - End; - - If (I <= High(PluginLoader.Plugins)) then - GoTo Continue; - - //Reset CurExecuted - Core.CurExecuted := CurExecutedBackup; -end; - -//------------- -//Is Called if this Module has been Inited and there is a Exit. -//Deinit is in backwards Initing Order -//------------- -Procedure TtehPlugins.DeInit; -var - I: Integer; //Counter - CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute -label Continue; -begin - //Backup CurExecuted - CurExecutedBackup := Core.CurExecuted; - - //Start Loop - I := 0; - - Continue: - Try - While (I <= High(PluginLoader.Plugins)) do - begin - //DeInit Plugin - PluginLoader.CallDeInit(I); - - Inc(I); - end; - Except - Inc(I); - End; - - If I <= High(PluginLoader.Plugins) then - Goto Continue; - - //Reset CurExecuted - Core.CurExecuted := CurExecutedBackup; -end; - -end. +UMain, SysUtils; + +{********************* + TPluginLoader + Implentation +*********************} + +//------------- +// Function that gives some Infos about the Module to the Core +//------------- +Procedure TPluginLoader.Info(const pInfo: PModuleInfo); +begin + pInfo^.Name := 'TPluginLoader'; + pInfo^.Version := MakeVersion(1,0,0,chr(0)); + pInfo^.Description := 'Searches for Plugins, loads and unloads them'; +end; + +//------------- +// Just the Constructor +//------------- +Constructor TPluginLoader.Create; +begin + //Init PluginInterface + //Using Methods from UPluginInterface + PluginInterface.CreateHookableEvent := CreateHookableEvent; + PluginInterface.DestroyHookableEvent := DestroyHookableEvent; + PluginInterface.NotivyEventHooks := NotivyEventHooks; + PluginInterface.HookEvent := HookEvent; + PluginInterface.UnHookEvent := UnHookEvent; + PluginInterface.EventExists := EventExists; + + PluginInterface.CreateService := CreateService; + PluginInterface.DestroyService := DestroyService; + PluginInterface.CallService := CallService; + PluginInterface.ServiceExists := ServiceExists; + + //UnSet Private Var + LoadingProcessFinished := False; +end; + +//------------- +//Is Called on Loading. +//In this Method only Events and Services should be created +//to offer them to other Modules or Plugins during the Init process +//If False is Returned this will cause a Forced Exit +//------------- +Function TPluginLoader.Load: Boolean; +begin + Result := True; + + Try + //Start Searching for Plugins + BrowseDir(PluginPath); + Except + Result := False; + Core.ReportError(Integer(PChar('Error Browsing and Loading.')), Integer(PChar('TPluginLoader'))); + end; +end; + +//------------- +//Is Called on Init Process +//In this Method you can Hook some Events and Create + Init +//your Classes, Variables etc. +//If False is Returned this will cause a Forced Exit +//------------- +Function TPluginLoader.Init: Boolean; +begin + //Just set Prvate Var to true. + LoadingProcessFinished := True; + Result := True; +end; + +//------------- +//Is Called if this Module has been Inited and there is a Exit. +//Deinit is in backwards Initing Order +//------------- +Procedure TPluginLoader.DeInit; +var + I: Integer; +begin + //Force DeInit + //If some Plugins aren't DeInited for some Reason o0 + For I := 0 to High(Plugins) do + begin + If (Plugins[I].State < 4) then + FreePlugin(I); + end; + + //Nothing to do here. Core will remove the Hooks +end; + +//------------- +//Is Called if this Module will be unloaded and has been created +//Should be used to Free Memory +//------------- +Procedure TPluginLoader.Free; +begin + //Just save some Memory if it wasn't done now.. + SetLength(Plugins, 0); +end; + +//-------------- +// Browses the Path at _Path_ for Plugins +//-------------- +Procedure TPluginLoader.BrowseDir(Path: String); +var + SR: TSearchRec; +begin + //Search for other Dirs to Browse + if FindFirst(Path + '*', faDirectory, SR) = 0 then begin + repeat + if (SR.Name <> '.') and (SR.Name <> '..') then + BrowseDir(Path + Sr.Name + PathDelim); + until FindNext(SR) <> 0; + end; + FindClose(SR); + + //Search for Plugins at Path + if FindFirst(Path + '*' + PluginFileExtension, 0, SR) = 0 then + begin + repeat + AddPlugin(Path + SR.Name); + until FindNext(SR) <> 0; + end; + FindClose(SR); +end; + +//-------------- +// If Plugin Exists: Index of Plugin, else -1 +//-------------- +Function TPluginLoader.PluginExists(Name: String): Integer; +var + I: Integer; +begin + Result := -1; + + If (Length(Name) <= 32 { =>Length(TUS_PluginInfo.Name)}) then + begin + For I := 0 to High(Plugins) do + if (Plugins[I].Info.Name = Name) then + begin //Found the Plugin + Result := I; + Break; + end; + end; +end; + +//-------------- +// Adds Plugin to the Array +//-------------- +Procedure TPluginLoader.AddPlugin(Filename: String); +var + hLib: THandle; + PInfo: Proc_PluginInfo; + Info: TUS_PluginInfo; + PluginID: Integer; +begin + If (FileExists(Filename)) then + begin //Load Libary + hLib := LoadLibrary(PChar(Filename)); + If (hLib <> 0) then + begin //Try to get Address of the Info Proc + PInfo := GetProcAddress (hLib, PChar('USPlugin_Info')); + If (@PInfo <> nil) then + begin + Info.cbSize := SizeOf(TUS_PluginInfo); + + Try //Call Info Proc + PInfo(@Info); + Except + Info.Name := ''; + Core.ReportError(Integer(PChar('Error getting Plugin Info: ' + Filename)), Integer(PChar('TPluginLoader'))); + end; + + //Is Name set ? + If (Trim(Info.Name) <> '') then + begin + PluginID := PluginExists(Info.Name); + + If (PluginID > 0) AND (Plugins[PluginID].State >=4) then + PluginID := -1; + + If (PluginID = -1) then + begin + //Add new item to array + PluginID := Length(Plugins); + SetLength(Plugins, PluginID + 1); + + //Fill with Info: + Plugins[PluginID].Info := Info; + Plugins[PluginID].State := 0; + Plugins[PluginID].Path := Filename; + Plugins[PluginID].NeedsDeInit := False; + Plugins[PluginID].hLib := hLib; + + //Try to get Procs + Plugins[PluginID].Procs.Load := GetProcAddress (hLib, PChar('USPlugin_Load')); + Plugins[PluginID].Procs.Init := GetProcAddress (hLib, PChar('USPlugin_Init')); + Plugins[PluginID].Procs.DeInit := GetProcAddress (hLib, PChar('USPlugin_DeInit')); + + If (@Plugins[PluginID].Procs.Load = nil) OR (@Plugins[PluginID].Procs.Init = nil) OR (@Plugins[PluginID].Procs.DeInit = nil) then + begin + Plugins[PluginID].State := 255; + FreeLibrary(hLib); + Core.ReportError(Integer(PChar('Can''t get Plugin Procs from Libary: "' + Info.Name + '" ' + Filename)), Integer(PChar('TPluginLoader'))); + end; + + //Emulate loading process if this Plugin is loaded to late + If (LoadingProcessFinished) then + begin + CallLoad(PluginID); + CallInit(PluginID); + end; + end + Else If (LoadingProcessFinished = False) then + begin + If (Plugins[PluginID].Info.Version < Info.Version) then + begin //Found newer Version of this Plugin + Core.ReportDebug(Integer(PChar('Found a newer Version of Plugin: ' + String(Info.Name))), Integer(PChar('TPluginLoader'))); + + //Unload Old Plugin + UnloadPlugin(Integer(nil), PluginID); + + //Fill with new Info + Plugins[PluginID].Info := Info; + Plugins[PluginID].State := 0; + Plugins[PluginID].Path := Filename; + Plugins[PluginID].NeedsDeInit := False; + Plugins[PluginID].hLib := hLib; + + //Try to get Procs + Plugins[PluginID].Procs.Load := GetProcAddress (hLib, PChar('USPlugin_Load')); + Plugins[PluginID].Procs.Init := GetProcAddress (hLib, PChar('USPlugin_Init')); + Plugins[PluginID].Procs.DeInit := GetProcAddress (hLib, PChar('USPlugin_DeInit')); + + If (@Plugins[PluginID].Procs.Load = nil) OR (@Plugins[PluginID].Procs.Init = nil) OR (@Plugins[PluginID].Procs.DeInit = nil) then + begin + FreeLibrary(hLib); + Plugins[PluginID].State := 255; + Core.ReportError(Integer(PChar('Can''t get Plugin Procs from Libary: "' + Info.Name + '" ' + Filename)), Integer(PChar('TPluginLoader'))); + end; + end + else + begin //Newer Version already loaded + FreeLibrary(hLib); + end; + end + else + begin + FreeLibrary(hLib); + Core.ReportError(Integer(PChar('Plugin with this Name already exists: ' + String(Info.Name))), Integer(PChar('TPluginLoader'))); + end; + end + else + begin + FreeLibrary(hLib); + Core.ReportError(Integer(PChar('No name reported: ' + Filename)), Integer(PChar('TPluginLoader'))); + end; + end + else + begin + FreeLibrary(hLib); + Core.ReportError(Integer(PChar('Can''t find Info Procedure: ' + Filename)), Integer(PChar('TPluginLoader'))); + end; + end + else + Core.ReportError(Integer(PChar('Can''t load Plugin Libary: ' + Filename)), Integer(PChar('TPluginLoader'))); + end; +end; + +//-------------- +// Calls Load Func of Plugin with the given Index +//-------------- +Function TPluginLoader.CallLoad(Index: Cardinal): Integer; +begin + Result := -2; + If(Index < Length(Plugins)) then + begin + If (@Plugins[Index].Procs.Load <> nil) AND (Plugins[Index].State = 0) then + begin + Try + Result := Plugins[Index].Procs.Load(@PluginInterface); + Except + Result := -3; + End; + + If (Result = 0) then + Plugins[Index].State := 1 + Else + begin + FreePlugin(Index); + Plugins[Index].State := 255; + Core.ReportError(Integer(PChar('Error calling Load Function from Plugin: ' + String(Plugins[Index].Info.Name))), Integer(PChar('TPluginLoader'))); + end; + end; + end; +end; + +//-------------- +// Calls Init Func of Plugin with the given Index +//-------------- +Function TPluginLoader.CallInit(Index: Cardinal): Integer; +begin + Result := -2; + If(Index < Length(Plugins)) then + begin + If (@Plugins[Index].Procs.Init <> nil) AND (Plugins[Index].State = 1) then + begin + Try + Result := Plugins[Index].Procs.Init(@PluginInterface); + Except + Result := -3; + End; + + If (Result = 0) then + begin + Plugins[Index].State := 2; + Plugins[Index].NeedsDeInit := True; + end + Else + begin + FreePlugin(Index); + Plugins[Index].State := 255; + Core.ReportError(Integer(PChar('Error calling Init Function from Plugin: ' + String(Plugins[Index].Info.Name))), Integer(PChar('TPluginLoader'))); + end; + end; + end; +end; + +//-------------- +// Calls DeInit Proc of Plugin with the given Index +//-------------- +Procedure TPluginLoader.CallDeInit(Index: Cardinal); +begin + If(Index < Length(Plugins)) then + begin + If (Plugins[Index].State < 4) then + begin + If (@Plugins[Index].Procs.DeInit <> nil) and (Plugins[Index].NeedsDeInit) then + Try + Plugins[Index].Procs.DeInit(@PluginInterface); + Except + + End; + + //Don't forget to remove Services and Subscriptions by this Plugin + Core.Hooks.DelbyOwner(-1 - Index); + + FreePlugin(Index); + end; + end; +end; + +//-------------- +// Frees all Plugin Sources (Procs and Handles) - Helper for Deiniting Functions +//-------------- +Procedure TPluginLoader.FreePlugin(Index: Cardinal); +begin + Plugins[Index].State := 4; + Plugins[Index].Procs.Load := nil; + Plugins[Index].Procs.Init := nil; + Plugins[Index].Procs.DeInit := nil; + + If (Plugins[Index].hLib <> 0) then + FreeLibrary(Plugins[Index].hLib); +end; + + + +//-------------- +// wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin +//-------------- +Function TPluginLoader.LoadPlugin(wParam, lParam: DWord): integer; +var + Index: Integer; + sFile: String; +begin + Result := -1; + sFile := ''; + //lParam is ID + If (Pointer(wParam) = nil) then + begin + Index := lParam; + end + else + begin //wParam is PChar + try + sFile := String(PChar(Pointer(wParam))); + Index := PluginExists(sFile); + If (Index < 0) And FileExists(sFile) then + begin //Is Filename + AddPlugin(sFile); + Result := Plugins[High(Plugins)].State; + end; + except + Index := -2; + end; + end; + + + If (Index >= 0) and (Index < Length(Plugins)) then + begin + AddPlugin(Plugins[Index].Path); + Result := Plugins[Index].State; + end; +end; + +//-------------- +// wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin +//-------------- +Function TPluginLoader.UnloadPlugin(wParam, lParam: DWord): integer; +var + Index: Integer; + sName: String; +begin + Result := -1; + //lParam is ID + If (Pointer(wParam) = nil) then + begin + Index := lParam; + end + else + begin //wParam is PChar + try + sName := String(PChar(Pointer(wParam))); + Index := PluginExists(sName); + except + Index := -2; + end; + end; + + + If (Index >= 0) and (Index < Length(Plugins)) then + CallDeInit(Index) +end; + +//-------------- +// If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Get PluginInfo of Plugin with Index(wParam) to Address at lParam) +//-------------- +Function TPluginLoader.GetPluginInfo(wParam, lParam: DWord): integer; +var I: Integer; +begin + Result := 0; + If (wParam < 0) then + begin //Get Info of 1 Plugin + If (Pointer(lParam) <> nil) AND (wParam < Length(Plugins)) then + begin + Try + Result := 1; + PUS_PluginInfo(Pointer(lParam))^ := Plugins[wParam].Info; + Except + + End; + end; + end + Else If (Pointer(lParam) = nil) then + begin //Get Length of Plugin (Info) Array + Result := Length(Plugins); + end + Else //Write PluginInfo Array to Address in lParam + begin + Try + For I := 0 to high(Plugins) do + PAUS_PluginInfo(Pointer(lParam))^[I] := Plugins[I].Info; + Result := Length(Plugins); + Except + Core.ReportError(Integer(PChar('Could not write PluginInfo Array')), Integer(PChar('TPluginLoader'))); + End; + end; + +end; + +//-------------- +// If wParam = -1 then (If lParam = nil then get length of Plugin State Array. If lparam <> nil then write array of Byte to address at lparam) Else (Return State of Plugin with Index(wParam)) +//-------------- +Function TPluginLoader.GetPluginState(wParam, lParam: DWord): integer; +var I: Integer; +begin + Result := -1; + If (wParam < 0) then + begin //Get State of 1 Plugin + If (wParam < Length(Plugins)) then + begin + Result := Plugins[wParam].State; + end; + end + Else If (Pointer(lParam) = nil) then + begin //Get Length of Plugin (Info) Array + Result := Length(Plugins); + end + Else //Write PluginInfo Array to Address in lParam + begin + Try + For I := 0 to high(Plugins) do + Byte(Pointer(lParam + I)^) := Plugins[I].State; + Result := Length(Plugins); + Except + Core.ReportError(Integer(PChar('Could not write PluginState Array')), Integer(PChar('TPluginLoader'))); + End; + end; +end; + + + + + +{********************* + TtehPlugins + Implentation +*********************} + +//------------- +// Function that gives some Infos about the Module to the Core +//------------- +Procedure TtehPlugins.Info(const pInfo: PModuleInfo); +begin + pInfo^.Name := 'TtehPlugins'; + pInfo^.Version := MakeVersion(1,0,0,chr(0)); + pInfo^.Description := 'Module executing the Plugins!'; +end; + +//------------- +// Just the Constructor +//------------- +Constructor TtehPlugins.Create; +begin + PluginLoader := nil; +end; + +//------------- +//Is Called on Loading. +//In this Method only Events and Services should be created +//to offer them to other Modules or Plugins during the Init process +//If False is Returned this will cause a Forced Exit +//------------- +Function TtehPlugins.Load: Boolean; +var + I: Integer; //Counter + CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute +label Continue; +begin + //Get Pointer to PluginLoader + PluginLoader := PPluginLoader(Core.GetModulebyName('TPluginLoader')); + If (PluginLoader = nil) then + begin + Result := False; + Core.ReportError(Integer(PChar('Could not get Pointer to PluginLoader')), Integer(PChar('TtehPlugins'))); + end + else + begin + Result := True; + + //Backup CurExecuted + CurExecutedBackup := Core.CurExecuted; + + //Start Loading the Plugins + I := 0; + Continue: + Try + While (I <= High(PluginLoader.Plugins)) do + begin + Core.CurExecuted := -1 - I; + + //Unload Plugin if not correctly Executed + If (PluginLoader.CallLoad(I) <> 0) then + begin + PluginLoader.CallDeInit(I); + PluginLoader.Plugins[I].State := 254; //Plugin asks for unload + Core.ReportDebug(Integer(PChar('Plugin Selfabort during loading process: ' + String(PluginLoader.Plugins[I].Info.Name))), Integer(PChar('TtehPlugins'))); + end + else + Core.ReportDebug(Integer(PChar('Plugin loaded succesful: ' + String(PluginLoader.Plugins[I].Info.Name))), Integer(PChar('TtehPlugins'))); + + Inc(I); + end; + Except + //Plugin could not be loaded. + // => Show Error Message, then ShutDown Plugin + on E: Exception do + begin + PluginLoader.CallDeInit(I); + PluginLoader.Plugins[I].State := 255; //Plugin causes Error + Core.ReportError(Integer(PChar('Plugin causes Error during loading process: ' + PluginLoader.Plugins[I].Info.Name + ', ErrorMsg: "' + E.Message + '"')), Integer(PChar('TtehPlugins'))); + + + //don't forget to increase I + Inc(I); + end; + End; + + If (I <= High(PluginLoader.Plugins)) then + Goto Continue; + + //Reset CurExecuted + Core.CurExecuted := CurExecutedBackup; + end; +end; + +//------------- +//Is Called on Init Process +//In this Method you can Hook some Events and Create + Init +//your Classes, Variables etc. +//If False is Returned this will cause a Forced Exit +//------------- +Function TtehPlugins.Init: Boolean; +var + I: Integer; //Counter + CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute +label Continue; +begin + Result := True; + + //Backup CurExecuted + CurExecutedBackup := Core.CurExecuted; + + //Start Loading the Plugins + I := 0; + Continue: + Try + While (I <= High(PluginLoader.Plugins)) do + begin + Core.CurExecuted := -1 - I; + + //Unload Plugin if not correctly Executed + If (PluginLoader.CallInit(I) <> 0) then + begin + PluginLoader.CallDeInit(I); + PluginLoader.Plugins[I].State := 254; //Plugin asks for unload + Core.ReportDebug(Integer(PChar('Plugin Selfabort during init process: ' + String(PluginLoader.Plugins[I].Info.Name))), Integer(PChar('TtehPlugins'))); + end + else + Core.ReportDebug(Integer(PChar('Plugin inited succesful: ' + String(PluginLoader.Plugins[I].Info.Name))), Integer(PChar('TtehPlugins'))); + + //don't forget to increase I + Inc(I); + end; + Except + //Plugin could not be loaded. + // => Show Error Message, then ShutDown Plugin + PluginLoader.CallDeInit(I); + PluginLoader.Plugins[I].State := 255; //Plugin causes Error + Core.ReportError(Integer(PChar('Plugin causes Error during init process: ' + String(PluginLoader.Plugins[I].Info.Name))), Integer(PChar('TtehPlugins'))); + + //don't forget to increase I + Inc(I); + End; + + If (I <= High(PluginLoader.Plugins)) then + GoTo Continue; + + //Reset CurExecuted + Core.CurExecuted := CurExecutedBackup; +end; + +//------------- +//Is Called if this Module has been Inited and there is a Exit. +//Deinit is in backwards Initing Order +//------------- +Procedure TtehPlugins.DeInit; +var + I: Integer; //Counter + CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute +label Continue; +begin + //Backup CurExecuted + CurExecutedBackup := Core.CurExecuted; + + //Start Loop + I := 0; + + Continue: + Try + While (I <= High(PluginLoader.Plugins)) do + begin + //DeInit Plugin + PluginLoader.CallDeInit(I); + + Inc(I); + end; + Except + Inc(I); + End; + + If I <= High(PluginLoader.Plugins) then + Goto Continue; + + //Reset CurExecuted + Core.CurExecuted := CurExecutedBackup; +end; + +end. diff --git a/Game/Code/MacOSX/Platform.inc b/Game/Code/MacOSX/Platform.inc deleted file mode 100755 index 7f028a12..00000000 --- a/Game/Code/MacOSX/Platform.inc +++ /dev/null @@ -1,13 +0,0 @@ - -{$IFDEF FPC} - {$MODE DELPHI} - {$H+} - {$R-} - {$DEFINE DLL_CDECL} - {$DEFINE MACOS} - {$DEFINE WIN32} - {$DEFINE TRANSLATE} -{$ELSE} - {$DEFINE DLL_STDCALL} -{$ENDIF} - diff --git a/Game/Code/MacOSX/UltraStarDX.pas b/Game/Code/MacOSX/UltraStarDX.pas index da42fb6a..b531244f 100644 --- a/Game/Code/MacOSX/UltraStarDX.pas +++ b/Game/Code/MacOSX/UltraStarDX.pas @@ -1,8 +1,11 @@ -program UltraStar; +program UltraStarDX; -uses UMain; +uses UMain, UAudio_bass, UAudio_FFMpeg, UMedia_dummy, USingNotes, UTextClasses, UVideo; + +var i : Integer; begin + i := 0; Main; end. diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 index c93ec352..4350b967 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 @@ -190,24 +190,264 @@ Content PBXProjectModuleGUID - 2C0B7D300CD683C80062A7C8 + 2CF552990CDA426600627463 PBXProjectModuleLabel - TextGL.pas + UMain.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2C0B7D310CD683C80062A7C8 + 2CF5529A0CDA426600627463 PBXProjectModuleLabel - TextGL.pas + UMain.pas _historyCapacity 0 bookmark - 2C0B7D320CD683C80062A7C8 + 2CF553BB0CDA5A4D00627463 history - 2C0B7D280CD6808A0062A7C8 + 2CF553B10CDA5A2F00627463 + + + SplitCount + 1 + + StatusBarVisibility + + + Geometry + + Frame + {{0, 20}, {1052, 646}} + PBXModuleWindowStatusBarHidden2 + + RubberWindowFrame + 222 147 1052 687 0 0 1680 1028 + + + + Content + + PBXProjectModuleGUID + 2CF552960CDA426600627463 + PBXProjectModuleLabel + UAudio_FFMpeg.pas + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 2CF552970CDA426600627463 + PBXProjectModuleLabel + UAudio_FFMpeg.pas + _historyCapacity + 0 + bookmark + 2CF553BC0CDA5A4D00627463 + history + + 2CF553940CDA58E900627463 + + + SplitCount + 1 + + StatusBarVisibility + + + Geometry + + Frame + {{0, 20}, {797, 748}} + PBXModuleWindowStatusBarHidden2 + + RubberWindowFrame + 38 213 797 789 0 0 1680 1028 + + + + Content + + PBXProjectModuleGUID + 2CF552930CDA426600627463 + PBXProjectModuleLabel + UAudio_bass.pas + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 2CF552940CDA426600627463 + PBXProjectModuleLabel + UAudio_bass.pas + _historyCapacity + 0 + bookmark + 2CF553BD0CDA5A4D00627463 + history + + 2CF553960CDA58E900627463 + + + SplitCount + 1 + + StatusBarVisibility + + + Geometry + + Frame + {{0, 20}, {797, 748}} + PBXModuleWindowStatusBarHidden2 + + RubberWindowFrame + 15 234 797 789 0 0 1680 1028 + + + + Content + + PBXProjectModuleGUID + 2CF5536C0CDA575B00627463 + PBXProjectModuleLabel + UltraStarDX.pas + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 2CF5536D0CDA575B00627463 + PBXProjectModuleLabel + UltraStarDX.pas + _historyCapacity + 0 + bookmark + 2CF553BE0CDA5A4D00627463 + history + + 2CF553670CDA575100627463 + + + SplitCount + 1 + + StatusBarVisibility + + + Geometry + + Frame + {{0, 20}, {987, 762}} + PBXModuleWindowStatusBarHidden2 + + RubberWindowFrame + 189 142 987 803 0 0 1680 1028 + + + + Content + + PBXProjectModuleGUID + 2CF5536F0CDA575B00627463 + PBXProjectModuleLabel + sdl_image.pas + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 2CF553700CDA575B00627463 + PBXProjectModuleLabel + sdl_image.pas + _historyCapacity + 0 + bookmark + 2CF553BF0CDA5A4D00627463 + history + + 2CF553060CDA514A00627463 + + + SplitCount + 1 + + StatusBarVisibility + + + Geometry + + Frame + {{0, 20}, {1052, 646}} + PBXModuleWindowStatusBarHidden2 + + RubberWindowFrame + 15 336 1052 687 0 0 1680 1028 + + + + Content + + PBXProjectModuleGUID + 2CF553720CDA575B00627463 + PBXProjectModuleLabel + sdl.pas + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 2CF553730CDA575B00627463 + PBXProjectModuleLabel + sdl.pas + _historyCapacity + 0 + bookmark + 2CF553C00CDA5A4D00627463 + history + + 2CF553040CDA513000627463 + + + SplitCount + 1 + + StatusBarVisibility + + + Geometry + + Frame + {{0, 20}, {987, 762}} + PBXModuleWindowStatusBarHidden2 + + RubberWindowFrame + 211 199 987 803 0 0 1680 1028 + + + + Content + + PBXProjectModuleGUID + 2CF553750CDA575B00627463 + PBXProjectModuleLabel + UTexture.pas + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 2CF553760CDA575B00627463 + PBXProjectModuleLabel + UTexture.pas + _historyCapacity + 0 + bookmark + 2CF553C10CDA5A4D00627463 + history + + 2CF552FF0CDA500800627463 SplitCount @@ -223,7 +463,87 @@ PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 38 317 616 685 0 0 1680 1028 + 15 338 616 685 0 0 1680 1028 + + + + Content + + PBXProjectModuleGUID + 2CF5528D0CDA426600627463 + PBXProjectModuleLabel + Windows.pas + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 2CF5528E0CDA426600627463 + PBXProjectModuleLabel + Windows.pas + _historyCapacity + 0 + bookmark + 2CF553C20CDA5A4D00627463 + history + + 2CF553780CDA575B00627463 + + + SplitCount + 1 + + StatusBarVisibility + + + Geometry + + Frame + {{0, 20}, {616, 644}} + PBXModuleWindowStatusBarHidden2 + + RubberWindowFrame + 176 191 616 685 0 0 1680 1028 + + + + Content + + PBXProjectModuleGUID + 2CF5528A0CDA426600627463 + PBXProjectModuleLabel + Messages.pas + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 2CF5528B0CDA426600627463 + PBXProjectModuleLabel + Messages.pas + _historyCapacity + 0 + bookmark + 2CF553C30CDA5A4D00627463 + history + + 2CF552760CDA419B00627463 + + + SplitCount + 1 + + StatusBarVisibility + + + Geometry + + Frame + {{0, 20}, {1052, 646}} + PBXModuleWindowStatusBarHidden2 + + RubberWindowFrame + 102 232 1052 687 0 0 1680 1028 @@ -260,8 +580,6 @@ Layout - BecomeActive - ContentConfiguration PBXBottomSmartGroupGIDs @@ -301,15 +619,18 @@ DD7C45450A6E72DE003FA52B DDC6868A09F571C2004E4BFF 2CDD8D0B0CC5539900E4169D + DDC6888C09F57243004E4BFF + DDC688C809F574E9004E4BFF 1C37FBAC04509CD000000102 + 2CF5536A0CDA575B00627463 + 2CF5536B0CDA575B00627463 1C37FAAC04509CD000000102 - 1C37FABC05509CD000000102 PBXSmartGroupTreeModuleOutlineStateSelectionKey - 21 - 19 + 17 + 15 0 @@ -333,7 +654,7 @@ 266 RubberWindowFrame - 665 266 817 753 0 0 1680 1028 + 775 270 817 753 0 0 1680 1028 Module PBXSmartGroupTreeModule @@ -370,7 +691,7 @@ Frame {{0, 0}, {529, 0}} RubberWindowFrame - 665 266 817 753 0 0 1680 1028 + 775 270 817 753 0 0 1680 1028 Module PBXNavigatorGroup @@ -378,6 +699,8 @@ 0pt + BecomeActive + ContentConfiguration PBXProjectModuleGUID @@ -390,7 +713,7 @@ Frame {{0, 5}, {529, 707}} RubberWindowFrame - 665 266 817 753 0 0 1680 1028 + 775 270 817 753 0 0 1680 1028 Module XCDetailModule @@ -414,9 +737,9 @@ TableOfContents - 2C0B7D2E0CD683C80062A7C8 + 2CF5501B0CDA1CD700627463 1CE0B1FE06471DED0097A5F4 - 2C0B7D2F0CD683C80062A7C8 + 2CF5501C0CDA1CD700627463 1CE0B20306471E060097A5F4 1CE0B20506471E060097A5F4 @@ -550,14 +873,26 @@ 5 WindowOrderList + 2CF5537F0CDA575B00627463 + 2CF553800CDA575B00627463 + 2CDD4BFC0CB948FC00549FAC + 2CF54F210CDA14A100627463 + 2CF5528A0CDA426600627463 + 2CF5528D0CDA426600627463 + 1C530D57069F1CE1000CFCEE + 2CF553750CDA575B00627463 + 2CF553720CDA575B00627463 + 2CF5536F0CDA575B00627463 2CDD4B730CB935C700549FAC - 2C0B7D270CD680850062A7C8 - 1CD10A99069EF8BA00B06720 - 2C0B7D300CD683C80062A7C8 + 2CF5536C0CDA575B00627463 + 2CF552930CDA426600627463 + 2CF552960CDA426600627463 /Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj + 2CF552990CDA426600627463 + 1CD10A99069EF8BA00B06720 WindowString - 665 266 817 753 0 0 1680 1028 + 775 270 817 753 0 0 1680 1028 WindowTools @@ -573,14 +908,12 @@ Dock - BecomeActive - ContentConfiguration PBXProjectModuleGUID 1CD0528F0623707200166675 PBXProjectModuleLabel - UCommon.pas + UAudio_FFMpeg.pas StatusBarVisibility @@ -589,7 +922,7 @@ Frame {{0, 0}, {1318, 344}} RubberWindowFrame - 347 117 1318 626 0 0 1680 1028 + 312 244 1318 626 0 0 1680 1028 Module PBXNavigatorGroup @@ -597,6 +930,8 @@ 344pt + BecomeActive + ContentConfiguration PBXProjectModuleGUID @@ -613,7 +948,7 @@ Frame {{0, 349}, {1318, 236}} RubberWindowFrame - 347 117 1318 626 0 0 1680 1028 + 312 244 1318 626 0 0 1680 1028 Module PBXBuildResultsModule @@ -636,18 +971,18 @@ TableOfContents 2CDD4B730CB935C700549FAC - 2C0B7D200CD680850062A7C8 + 2CF54F1A0CDA14A100627463 1CD0528F0623707200166675 XCMainBuildResultsModuleGUID ToolbarConfiguration xcode.toolbar.config.build WindowString - 347 117 1318 626 0 0 1680 1028 + 312 244 1318 626 0 0 1680 1028 WindowToolGUID 2CDD4B730CB935C700549FAC WindowToolIsVisible - + FirstTimeWindowDisplayed @@ -678,8 +1013,8 @@ yes sizes - {{0, 0}, {368, 414}} - {{368, 0}, {596, 414}} + {{0, 0}, {360, 414}} + {{360, 0}, {604, 414}} VerticalSplitView @@ -742,14 +1077,14 @@ TableOfContents 1CD10A99069EF8BA00B06720 - 2C0B7D210CD680850062A7C8 + 2CF54F1B0CDA14A100627463 1C162984064C10D400B95A72 - 2C0B7D220CD680850062A7C8 - 2C0B7D230CD680850062A7C8 - 2C0B7D240CD680850062A7C8 - 2C0B7D250CD680850062A7C8 - 2C0B7D260CD680850062A7C8 - 2C0B7D270CD680850062A7C8 + 2CF54F1C0CDA14A100627463 + 2CF54F1D0CDA14A100627463 + 2CF54F1E0CDA14A100627463 + 2CF54F1F0CDA14A100627463 + 2CF54F200CDA14A100627463 + 2CF54F210CDA14A100627463 ToolbarConfiguration xcode.toolbar.config.debug @@ -776,14 +1111,12 @@ Dock - BecomeActive - ContentConfiguration PBXProjectModuleGUID 1CDD528C0622207200134675 PBXProjectModuleLabel - TextGL.pas + UCommon.pas StatusBarVisibility @@ -804,6 +1137,8 @@ 502pt + BecomeActive + ContentConfiguration PBXProjectModuleGUID @@ -839,8 +1174,8 @@ TableOfContents 1C530D57069F1CE1000CFCEE - 2CE78DAF0CCBA1C0003B6817 - 2CE78DB00CCBA1C0003B6817 + 2CF54F3B0CDA1AA600627463 + 2CF54F3C0CDA1AA600627463 1CDD528C0622207200134675 1CD0528E0623707200166675 @@ -903,7 +1238,7 @@ TableOfContents 2CDD4BFC0CB948FC00549FAC - 2CDD8E5D0CC558D500E4169D + 2CF5537E0CDA575B00627463 1C78EAAC065D492600B07095 WindowString diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser index e00a7dff..04871a3e 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser @@ -1,199 +1,504 @@ // !$*UTF8*$! { - 2C0B7D280CD6808A0062A7C8 /* PBXBookmark */ = { - isa = PBXBookmark; - fRef = 2C4D9C620CC9EC8C0031092D /* TextGL.pas */; + 2C4D9C620CC9EC8C0031092D /* TextGL.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {758, 7742}}"; + sepNavSelRange = "{12201, 8}"; + sepNavVisRect = "{{0, 6061}, {758, 716}}"; + sepNavWindowFrame = "{{38, 157}, {797, 845}}"; + }; }; - 2C0B7D320CD683C80062A7C8 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C620CC9EC8C0031092D /* TextGL.pas */; - name = "TextGL.pas: 11"; - rLen = 0; - rLoc = 92; - rType = 0; - vrLen = 1401; - vrLoc = 0; + 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {884, 9044}}"; + sepNavSelRange = "{3202, 12}"; + sepNavVisRect = "{{0, 8328}, {758, 716}}"; + sepNavWindowFrame = "{{15, 178}, {797, 845}}"; + }; }; - 2C4D9C620CC9EC8C0031092D /* TextGL.pas */ = { + 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {680, 7770}}"; - sepNavSelRange = "{92, 0}"; - sepNavVisRect = "{{0, 0}, {577, 612}}"; - sepNavWindowFrame = "{{38, 261}, {616, 741}}"; + sepNavIntBoundsRect = "{{0, 0}, {1196, 13216}}"; + sepNavSelRange = "{22728, 0}"; + sepNavVisRect = "{{0, 12500}, {758, 716}}"; + sepNavWindowFrame = "{{38, 157}, {797, 845}}"; + }; + }; + 2C4D9C650CC9EC8C0031092D /* UCatCovers.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {764, 2128}}"; + sepNavSelRange = "{352, 0}"; + sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavWindowFrame = "{{61, 136}, {797, 845}}"; + }; + }; + 2C4D9C660CC9EC8C0031092D /* UCommandLine.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {758, 4074}}"; + sepNavSelRange = "{54, 0}"; + sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavWindowFrame = "{{84, 115}, {797, 845}}"; }; }; 2C4D9C670CC9EC8C0031092D /* UCommon.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1277, 3990}}"; - sepNavSelRange = "{38, 0}"; - sepNavVisRect = "{{0, 0}, {1277, 312}}"; - sepNavWindowFrame = "{{38, 261}, {616, 741}}"; + sepNavIntBoundsRect = "{{0, 0}, {749, 4186}}"; + sepNavSelRange = "{748, 12}"; + sepNavVisRect = "{{0, 234}, {749, 470}}"; + sepNavWindowFrame = "{{38, 58}, {754, 944}}"; + }; + }; + 2C4D9C680CC9EC8C0031092D /* UCore.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1136, 6888}}"; + sepNavSelRange = "{13272, 0}"; + sepNavVisRect = "{{0, 6145}, {758, 716}}"; + sepNavWindowFrame = "{{107, 94}, {797, 845}}"; }; }; 2C4D9C690CC9EC8C0031092D /* UCoreModule.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {577, 1568}}"; - sepNavSelRange = "{278, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {577, 1708}}"; + sepNavSelRange = "{262, 0}"; sepNavVisRect = "{{0, 0}, {577, 612}}"; sepNavWindowFrame = "{{38, 261}, {616, 741}}"; }; }; + 2C4D9C6A0CC9EC8C0031092D /* UCovers.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {758, 3668}}"; + sepNavSelRange = "{49, 0}"; + sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavWindowFrame = "{{130, 73}, {797, 845}}"; + }; + }; + 2C4D9C6B0CC9EC8C0031092D /* UDataBase.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {4058, 5026}}"; + sepNavSelRange = "{60, 19}"; + sepNavVisRect = "{{0, 0}, {1277, 312}}"; + sepNavWindowFrame = "{{153, 52}, {797, 845}}"; + }; + }; + 2C4D9C6C0CC9EC8C0031092D /* UDLLManager.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1436, 3486}}"; + sepNavSelRange = "{1375, 0}"; + sepNavVisRect = "{{0, 456}, {758, 716}}"; + sepNavWindowFrame = "{{15, 178}, {797, 845}}"; + }; + }; 2C4D9C6D0CC9EC8C0031092D /* UDraw.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1046, 18578}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavIntBoundsRect = "{{0, 0}, {1277, 18872}}"; + sepNavSelRange = "{9710, 15}"; + sepNavVisRect = "{{0, 4065}, {1277, 312}}"; sepNavWindowFrame = "{{61, 240}, {616, 741}}"; }; }; 2C4D9C6E0CC9EC8C0031092D /* UFiles.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1562, 10710}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavIntBoundsRect = "{{0, 0}, {1562, 10766}}"; + sepNavSelRange = "{1829, 12}"; + sepNavVisRect = "{{0, 766}, {749, 470}}"; sepNavWindowFrame = "{{84, 219}, {616, 741}}"; }; }; + 2C4D9C6F0CC9EC8C0031092D /* UGraphic.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {830, 9800}}"; + sepNavSelRange = "{872, 16}"; + sepNavVisRect = "{{0, 391}, {758, 716}}"; + sepNavWindowFrame = "{{38, 157}, {797, 845}}"; + }; + }; + 2C4D9C700CC9EC8C0031092D /* UGraphicClasses.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1052, 9450}}"; + sepNavSelRange = "{5863, 11}"; + sepNavVisRect = "{{0, 2572}, {749, 470}}"; + sepNavWindowFrame = "{{61, 136}, {797, 845}}"; + }; + }; + 2C4D9C710CC9EC8C0031092D /* UHooks.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1277, 5964}}"; + sepNavSelRange = "{11810, 0}"; + sepNavVisRect = "{{0, 5652}, {1277, 312}}"; + sepNavWindowFrame = "{{84, 115}, {797, 845}}"; + }; + }; + 2C4D9C720CC9EC8C0031092D /* UIni.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {770, 11102}}"; + sepNavSelRange = "{41, 0}"; + sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavWindowFrame = "{{107, 94}, {797, 845}}"; + }; + }; + 2C4D9C730CC9EC8C0031092D /* UJoystick.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {896, 3962}}"; + sepNavSelRange = "{46, 0}"; + sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavWindowFrame = "{{130, 73}, {797, 845}}"; + }; + }; + 2C4D9C740CC9EC8C0031092D /* ULanguage.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {758, 3290}}"; + sepNavSelRange = "{46, 0}"; + sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavWindowFrame = "{{153, 52}, {797, 845}}"; + }; + }; 2C4D9C760CC9EC8C0031092D /* ULCD.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {577, 4256}}"; - sepNavSelRange = "{320, 0}"; - sepNavVisRect = "{{0, 3483}, {577, 612}}"; + sepNavIntBoundsRect = "{{0, 0}, {577, 4270}}"; + sepNavSelRange = "{25, 0}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; sepNavWindowFrame = "{{176, 135}, {616, 741}}"; }; }; + 2C4D9C770CC9EC8C0031092D /* ULight.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {758, 2282}}"; + sepNavSelRange = "{1017, 0}"; + sepNavVisRect = "{{0, 425}, {758, 716}}"; + sepNavWindowFrame = "{{15, 178}, {797, 845}}"; + }; + }; + 2C4D9C780CC9EC8C0031092D /* ULog.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {758, 3612}}"; + sepNavSelRange = "{6056, 0}"; + sepNavVisRect = "{{0, 2896}, {758, 716}}"; + sepNavWindowFrame = "{{38, 157}, {797, 845}}"; + }; + }; + 2C4D9C790CC9EC8C0031092D /* ULyrics_bak.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1070, 5950}}"; + sepNavSelRange = "{34, 0}"; + sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavWindowFrame = "{{84, 115}, {797, 845}}"; + }; + }; + 2C4D9C7A0CC9EC8C0031092D /* ULyrics.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1220, 7700}}"; + sepNavSelRange = "{11162, 13}"; + sepNavVisRect = "{{0, 4395}, {758, 716}}"; + sepNavWindowFrame = "{{61, 136}, {797, 845}}"; + }; + }; 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1277, 11312}}"; - sepNavSelRange = "{64, 18}"; + sepNavIntBoundsRect = "{{0, 0}, {1013, 15092}}"; + sepNavSelRange = "{3295, 0}"; + sepNavVisRect = "{{0, 1684}, {1013, 614}}"; + sepNavWindowFrame = "{{222, 91}, {1052, 743}}"; + }; + }; + 2C4D9C7C0CC9EC8C0031092D /* UMedia_dummy.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {758, 3864}}"; + sepNavSelRange = "{859, 0}"; + sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavWindowFrame = "{{107, 94}, {797, 845}}"; + }; + }; + 2C4D9C7D0CC9EC8C0031092D /* UModules.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {758, 716}}"; + sepNavSelRange = "{31, 0}"; + sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavWindowFrame = "{{130, 73}, {797, 845}}"; + }; + }; + 2C4D9C7E0CC9EC8C0031092D /* UMusic.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {758, 4438}}"; + sepNavSelRange = "{44, 0}"; + sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavWindowFrame = "{{153, 52}, {797, 845}}"; + }; + }; + 2C4D9C7F0CC9EC8C0031092D /* UParty.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {758, 5278}}"; + sepNavSelRange = "{48, 0}"; + sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavWindowFrame = "{{15, 178}, {797, 845}}"; + }; + }; + 2C4D9C800CC9EC8C0031092D /* UPlaylist.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {824, 6496}}"; + sepNavSelRange = "{51, 0}"; + sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavWindowFrame = "{{38, 157}, {797, 845}}"; + }; + }; + 2C4D9C820CC9EC8C0031092D /* UPluginInterface.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {758, 2198}}"; + sepNavSelRange = "{247, 0}"; + sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavWindowFrame = "{{84, 115}, {797, 845}}"; + }; + }; + 2C4D9C830CC9EC8C0031092D /* uPluginLoader.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1718, 11116}}"; + sepNavSelRange = "{317, 0}"; + sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavWindowFrame = "{{107, 94}, {797, 845}}"; + }; + }; + 2C4D9C840CC9EC8C0031092D /* URecord.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1277, 4998}}"; + sepNavSelRange = "{159, 11}"; sepNavVisRect = "{{0, 0}, {1277, 312}}"; - sepNavWindowFrame = "{{222, 93}, {616, 741}}"; + sepNavWindowFrame = "{{130, 73}, {797, 845}}"; + }; + }; + 2C4D9C850CC9EC8C0031092D /* UServices.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1916, 4494}}"; + sepNavSelRange = "{9160, 4}"; + sepNavVisRect = "{{0, 4182}, {1277, 312}}"; + sepNavWindowFrame = "{{153, 52}, {797, 845}}"; + }; + }; + 2C4D9C860CC9EC8C0031092D /* USingNotes.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {758, 716}}"; + sepNavSelRange = "{52, 0}"; + sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavWindowFrame = "{{15, 178}, {797, 845}}"; + }; + }; + 2C4D9C870CC9EC8C0031092D /* USingScores.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {950, 13818}}"; + sepNavSelRange = "{15011, 16}"; + sepNavVisRect = "{{0, 5904}, {749, 470}}"; + sepNavWindowFrame = "{{38, 157}, {797, 845}}"; + }; + }; + 2C4D9C880CC9EC8C0031092D /* USkins.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {758, 2408}}"; + sepNavSelRange = "{25, 0}"; + sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavWindowFrame = "{{61, 136}, {797, 845}}"; + }; + }; + 2C4D9C890CC9EC8C0031092D /* USongs.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {950, 12544}}"; + sepNavSelRange = "{7215, 0}"; + sepNavVisRect = "{{0, 3298}, {758, 716}}"; + sepNavWindowFrame = "{{84, 115}, {797, 845}}"; + }; + }; + 2C4D9C8A0CC9EC8C0031092D /* UTextClasses.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1010, 854}}"; + sepNavSelRange = "{54, 0}"; + sepNavVisRect = "{{0, 138}, {758, 716}}"; + sepNavWindowFrame = "{{107, 94}, {797, 845}}"; }; }; 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1730, 16016}}"; - sepNavSelRange = "{2035, 0}"; - sepNavVisRect = "{{0, 3332}, {577, 612}}"; + sepNavIntBoundsRect = "{{0, 0}, {1730, 15960}}"; + sepNavSelRange = "{11823, 20}"; + sepNavVisRect = "{{0, 5091}, {577, 612}}"; sepNavWindowFrame = "{{15, 282}, {616, 741}}"; }; }; + 2C4D9C8C0CC9EC8C0031092D /* UThemes.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {788, 30954}}"; + sepNavSelRange = "{44, 0}"; + sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavWindowFrame = "{{130, 73}, {797, 845}}"; + }; + }; + 2C4D9C8D0CC9EC8C0031092D /* UTime.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {758, 1400}}"; + sepNavSelRange = "{42, 0}"; + sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavWindowFrame = "{{153, 52}, {797, 845}}"; + }; + }; + 2C4D9C8E0CC9EC8C0031092D /* UVideo.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {902, 9646}}"; + sepNavSelRange = "{12347, 13}"; + sepNavVisRect = "{{0, 5722}, {749, 470}}"; + sepNavWindowFrame = "{{15, 178}, {797, 845}}"; + }; + }; + 2C4D9D8D0CC9ED230031092D /* Bass.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1358, 13790}}"; + sepNavSelRange = "{51143, 0}"; + sepNavVisRect = "{{0, 10534}, {715, 815}}"; + sepNavWindowFrame = "{{38, 58}, {754, 944}}"; + }; + }; 2C4D9D900CC9ED4F0031092D /* FreeBitmap.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {974, 24374}}"; - sepNavSelRange = "{1396, 0}"; + sepNavSelRange = "{1377, 0}"; sepNavVisRect = "{{0, 0}, {577, 612}}"; sepNavWindowFrame = "{{245, 72}, {616, 741}}"; }; }; 2C4D9D910CC9ED4F0031092D /* FreeImage.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1718, 10472}}"; - sepNavSelRange = "{1135, 0}"; - sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavIntBoundsRect = "{{0, 0}, {1718, 10416}}"; + sepNavSelRange = "{1255, 0}"; + sepNavVisRect = "{{0, 373}, {577, 612}}"; sepNavWindowFrame = "{{15, 282}, {616, 741}}"; }; }; + 2C4D9DCC0CC9EE6F0031092D /* UDisplay.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1277, 6678}}"; + sepNavSelRange = "{9419, 36}"; + sepNavVisRect = "{{0, 4975}, {1277, 312}}"; + sepNavWindowFrame = "{{38, 157}, {797, 845}}"; + }; + }; + 2C4D9DCD0CC9EE6F0031092D /* UDrawTexture.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {758, 1470}}"; + sepNavSelRange = "{54, 0}"; + sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavWindowFrame = "{{61, 136}, {797, 845}}"; + }; + }; + 2C4D9DCE0CC9EE6F0031092D /* UMenu.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1502, 21658}}"; + sepNavSelRange = "{11354, 12}"; + sepNavVisRect = "{{0, 3972}, {749, 470}}"; + sepNavWindowFrame = "{{38, 157}, {797, 845}}"; + }; + }; 2C4D9DCF0CC9EE6F0031092D /* UMenuButton.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {680, 8022}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavIntBoundsRect = "{{0, 0}, {680, 8064}}"; + sepNavSelRange = "{6107, 37}"; + sepNavVisRect = "{{0, 1104}, {577, 612}}"; sepNavWindowFrame = "{{153, 156}, {616, 741}}"; }; }; + 2C4D9DD00CC9EE6F0031092D /* UMenuButtonCollection.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {758, 1008}}"; + sepNavSelRange = "{63, 0}"; + sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavWindowFrame = "{{61, 136}, {797, 845}}"; + }; + }; + 2C4D9DD10CC9EE6F0031092D /* UMenuInteract.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {758, 716}}"; + sepNavSelRange = "{55, 0}"; + sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavWindowFrame = "{{84, 115}, {797, 845}}"; + }; + }; 2C4D9DD20CC9EE6F0031092D /* UMenuSelect.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {577, 2786}}"; - sepNavSelRange = "{0, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {577, 2828}}"; + sepNavSelRange = "{53, 0}"; sepNavVisRect = "{{0, 0}, {577, 612}}"; sepNavWindowFrame = "{{130, 177}, {616, 741}}"; }; }; - 2C4D9DD40CC9EE6F0031092D /* UMenuStatic.pas */ = { + 2C4D9DD30CC9EE6F0031092D /* UMenuSelectSlide.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {577, 1162}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRect = "{{0, 0}, {577, 612}}"; - sepNavWindowFrame = "{{107, 198}, {616, 741}}"; + sepNavIntBoundsRect = "{{0, 0}, {758, 4928}}"; + sepNavSelRange = "{58, 0}"; + sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavWindowFrame = "{{107, 94}, {797, 845}}"; }; }; - 2C4D9DFF0CC9EF840031092D /* MacClasses.pas */ = { + 2C4D9DD40CC9EE6F0031092D /* UMenuStatic.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {578, 812}}"; - sepNavSelRange = "{8, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {577, 1204}}"; + sepNavSelRange = "{53, 0}"; sepNavVisRect = "{{0, 0}, {577, 612}}"; - sepNavWindowFrame = "{{15, 282}, {616, 741}}"; + sepNavWindowFrame = "{{107, 198}, {616, 741}}"; }; }; - 2C4D9E000CC9EF840031092D /* Graphics.pas */ = { + 2C4D9DD50CC9EE6F0031092D /* UMenuText.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {620, 2674}}"; - sepNavSelRange = "{90, 0}"; - sepNavVisRect = "{{0, 0}, {577, 612}}"; - sepNavWindowFrame = "{{38, 261}, {616, 741}}"; + sepNavIntBoundsRect = "{{0, 0}, {962, 5222}}"; + sepNavSelRange = "{2165, 0}"; + sepNavVisRect = "{{0, 707}, {758, 716}}"; + sepNavWindowFrame = "{{130, 73}, {797, 845}}"; }; }; - 2C4D9E010CC9EF840031092D /* JPEG.pas */ = { + 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {602, 612}}"; - sepNavSelRange = "{5, 0}"; - sepNavVisRect = "{{0, 0}, {577, 612}}"; - sepNavWindowFrame = "{{61, 240}, {616, 741}}"; + sepNavIntBoundsRect = "{{0, 0}, {1268, 4788}}"; + sepNavSelRange = "{8020, 0}"; + sepNavVisRect = "{{0, 1745}, {1013, 614}}"; + sepNavWindowFrame = "{{15, 280}, {1052, 743}}"; }; }; - 2C4D9E020CC9EF840031092D /* MidiFile.pas */ = { + 2C4D9DEF0CC9EF210031092D /* sdl_ttf.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {577, 1442}}"; - sepNavSelRange = "{5, 0}"; - sepNavVisRect = "{{0, 0}, {577, 612}}"; - sepNavWindowFrame = "{{84, 219}, {616, 741}}"; + sepNavIntBoundsRect = "{{0, 0}, {1268, 6552}}"; + sepNavSelRange = "{8844, 12}"; + sepNavVisRect = "{{0, 2054}, {749, 470}}"; }; }; - 2C4D9E030CC9EF840031092D /* MidiOut.pas */ = { + 2C4D9E000CC9EF840031092D /* Graphics.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {577, 882}}"; - sepNavSelRange = "{5, 0}"; - sepNavVisRect = "{{0, 0}, {577, 612}}"; - sepNavWindowFrame = "{{107, 198}, {616, 741}}"; + sepNavIntBoundsRect = "{{0, 0}, {1277, 2674}}"; + sepNavSelRange = "{58, 56}"; + sepNavVisRect = "{{0, 0}, {1277, 312}}"; + sepNavWindowFrame = "{{38, 261}, {616, 741}}"; }; }; - 2C4D9E040CC9EF840031092D /* OpenGL12.pas */ = { + 2C4D9E010CC9EF840031092D /* JPEG.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1616, 65758}}"; - sepNavSelRange = "{66, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {602, 612}}"; + sepNavSelRange = "{53, 0}"; sepNavVisRect = "{{0, 0}, {577, 612}}"; - sepNavWindowFrame = "{{130, 177}, {616, 741}}"; + sepNavWindowFrame = "{{61, 240}, {616, 741}}"; }; }; - 2C4D9E070CC9EF840031092D /* PNGImage.pas */ = { + 2C4D9E040CC9EF840031092D /* OpenGL12.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {577, 612}}"; - sepNavSelRange = "{5, 0}"; - sepNavVisRect = "{{0, 0}, {577, 612}}"; - sepNavWindowFrame = "{{153, 156}, {616, 741}}"; + sepNavIntBoundsRect = "{{0, 0}, {1616, 65828}}"; + sepNavSelRange = "{213686, 0}"; + sepNavVisRect = "{{0, 64932}, {1031, 840}}"; + sepNavWindowFrame = "{{1, 53}, {1070, 969}}"; }; }; 2C4D9E090CC9EF840031092D /* Windows.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {577, 1960}}"; - sepNavSelRange = "{5, 0}"; - sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavIntBoundsRect = "{{0, 0}, {577, 2352}}"; + sepNavSelRange = "{2832, 0}"; + sepNavVisRect = "{{0, 1249}, {577, 612}}"; sepNavWindowFrame = "{{176, 135}, {616, 741}}"; }; }; - 2C4D9E0A0CC9EF840031092D /* zlportio.pas */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {577, 612}}"; - sepNavSelRange = "{5, 0}"; - sepNavVisRect = "{{0, 0}, {577, 612}}"; - sepNavWindowFrame = "{{199, 114}, {616, 741}}"; - }; - }; 2C4D9E440CC9F0ED0031092D /* switches.inc */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {577, 612}}"; - sepNavSelRange = "{0, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {577, 616}}"; + sepNavSelRange = "{312, 0}"; sepNavVisRect = "{{0, 0}, {577, 612}}"; sepNavWindowFrame = "{{15, 282}, {616, 741}}"; }; @@ -251,6 +556,8 @@ name = "Project Breakpoints"; objects = ( 2CDEA8080CBD7D920096994C /* UMain.pas:293 */, + 2CF553830CDA578D00627463 /* UMain.pas:148 */, + 2CF553A20CDA59BB00627463 /* UltraStarDX.pas:8 */, ); }; 2CDEA8080CBD7D920096994C /* UMain.pas:293 */ = { @@ -263,14 +570,552 @@ fileReference = 2CDD439C0CBBE92D00F364DE /* UMain.pas */; hitCount = 1; lineNumber = 293; - location = UltraStar; - modificationTime = 214261345.065247; + location = UltraStarDX; + modificationTime = 215636526.320362; + state = 1; + }; + 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1196, 19586}}"; + sepNavSelRange = "{50178, 0}"; + sepNavVisRect = "{{0, 1770}, {715, 815}}"; + sepNavWindowFrame = "{{15, 79}, {754, 944}}"; + }; + }; + 2CF54F440CDA1B2B00627463 /* UScreenEdit.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {715, 1610}}"; + sepNavSelRange = "{34, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{38, 58}, {754, 944}}"; + }; + }; + 2CF54F450CDA1B2B00627463 /* UScreenEditConvert.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1178, 8092}}"; + sepNavSelRange = "{41, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{15, 79}, {754, 944}}"; + }; + }; + 2CF54F460CDA1B2B00627463 /* UScreenEditHeader.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {715, 5180}}"; + sepNavSelRange = "{59, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{38, 58}, {754, 944}}"; + }; + }; + 2CF54F470CDA1B2B00627463 /* UScreenEditSub.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1040, 19236}}"; + sepNavSelRange = "{37, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{15, 79}, {754, 944}}"; + }; + }; + 2CF54F480CDA1B2B00627463 /* UScreenLevel.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {715, 1302}}"; + sepNavSelRange = "{54, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{38, 58}, {754, 944}}"; + }; + }; + 2CF54F490CDA1B2B00627463 /* UScreenLoading.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {715, 815}}"; + sepNavSelRange = "{58, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{15, 79}, {754, 944}}"; + }; + }; + 2CF54F4A0CDA1B2B00627463 /* UScreenMain.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {715, 3990}}"; + sepNavSelRange = "{55, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{38, 58}, {754, 944}}"; + }; + }; + 2CF54F4B0CDA1B2B00627463 /* UScreenName.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {956, 3318}}"; + sepNavSelRange = "{34, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{15, 79}, {754, 944}}"; + }; + }; + 2CF54F4C0CDA1B2B00627463 /* UScreenOpen.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {715, 2366}}"; + sepNavSelRange = "{55, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{38, 58}, {754, 944}}"; + }; + }; + 2CF54F4D0CDA1B2B00627463 /* UScreenOptions.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {715, 2506}}"; + sepNavSelRange = "{311, 0}"; + sepNavVisRect = "{{0, 188}, {715, 815}}"; + sepNavWindowFrame = "{{15, 79}, {754, 944}}"; + }; + }; + 2CF54F4E0CDA1B2B00627463 /* UScreenOptionsAdvanced.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {715, 1484}}"; + sepNavSelRange = "{45, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{38, 58}, {754, 944}}"; + }; + }; + 2CF54F4F0CDA1B2B00627463 /* UScreenOptionsGame.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {715, 1582}}"; + sepNavSelRange = "{60, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{15, 79}, {754, 944}}"; + }; + }; + 2CF54F500CDA1B2B00627463 /* UScreenOptionsGraphics.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {715, 1400}}"; + sepNavSelRange = "{64, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{38, 58}, {754, 944}}"; + }; + }; + 2CF54F510CDA1B2B00627463 /* UScreenOptionsLyrics.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {715, 1330}}"; + sepNavSelRange = "{62, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{15, 79}, {754, 944}}"; + }; + }; + 2CF54F520CDA1B2B00627463 /* UScreenOptionsRecord.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {776, 1974}}"; + sepNavSelRange = "{39, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{38, 58}, {754, 944}}"; + }; + }; + 2CF54F530CDA1B2B00627463 /* UScreenOptionsSound.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {715, 1414}}"; + sepNavSelRange = "{42, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{15, 79}, {754, 944}}"; + }; + }; + 2CF54F540CDA1B2B00627463 /* UScreenOptionsThemes.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {715, 1680}}"; + sepNavSelRange = "{43, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{38, 58}, {754, 944}}"; + }; + }; + 2CF54F550CDA1B2B00627463 /* UScreenPartyNewRound.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {758, 5880}}"; + sepNavSelRange = "{62, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{15, 79}, {754, 944}}"; + }; + }; + 2CF54F560CDA1B2B00627463 /* UScreenPartyOptions.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {715, 3640}}"; + sepNavSelRange = "{61, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{38, 58}, {754, 944}}"; + }; + }; + 2CF54F570CDA1B2B00627463 /* UScreenPartyPlayer.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {956, 4648}}"; + sepNavSelRange = "{62, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{15, 79}, {754, 944}}"; + }; + }; + 2CF54F580CDA1B2B00627463 /* UScreenPartyScore.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1046, 4116}}"; + sepNavSelRange = "{61, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{38, 58}, {754, 944}}"; + }; + }; + 2CF54F590CDA1B2B00627463 /* UScreenPartyWin.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {752, 3640}}"; + sepNavSelRange = "{59, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{15, 79}, {754, 944}}"; + }; + }; + 2CF54F5A0CDA1B2B00627463 /* UScreenPopup.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {715, 3472}}"; + sepNavSelRange = "{56, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{38, 58}, {754, 944}}"; + }; + }; + 2CF54F5B0CDA1B2B00627463 /* UScreenScore.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1016, 9478}}"; + sepNavSelRange = "{49, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{15, 79}, {754, 944}}"; + }; + }; + 2CF54F5C0CDA1B2B00627463 /* UScreenSing.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1262, 18480}}"; + sepNavSelRange = "{49, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{38, 58}, {754, 944}}"; + }; + }; + 2CF54F5D0CDA1B2B00627463 /* UScreenSingModi.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1277, 9324}}"; + sepNavSelRange = "{265, 14}"; + sepNavVisRect = "{{0, 187}, {1277, 312}}"; + sepNavWindowFrame = "{{15, 79}, {754, 944}}"; + }; + }; + 2CF54F5E0CDA1B2B00627463 /* UScreenSong.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1700, 29050}}"; + sepNavSelRange = "{23456, 0}"; + sepNavVisRect = "{{0, 11219}, {1277, 312}}"; + sepNavWindowFrame = "{{38, 58}, {754, 944}}"; + }; + }; + 2CF54F5F0CDA1B2B00627463 /* UScreenSongJumpto.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1160, 2884}}"; + sepNavSelRange = "{61, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{15, 79}, {754, 944}}"; + }; + }; + 2CF54F600CDA1B2B00627463 /* UScreenSongMenu.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {968, 8834}}"; + sepNavSelRange = "{52, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{38, 58}, {754, 944}}"; + }; + }; + 2CF54F610CDA1B2B00627463 /* UScreenStatDetail.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {715, 3514}}"; + sepNavSelRange = "{40, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{15, 79}, {754, 944}}"; + }; + }; + 2CF54F620CDA1B2B00627463 /* UScreenStatMain.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1277, 3976}}"; + sepNavSelRange = "{4341, 26}"; + sepNavVisRect = "{{0, 2749}, {1277, 312}}"; + sepNavWindowFrame = "{{38, 58}, {754, 944}}"; + }; + }; + 2CF54F630CDA1B2B00627463 /* UScreenTop5.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {715, 2324}}"; + sepNavSelRange = "{48, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{15, 79}, {754, 944}}"; + }; + }; + 2CF54F640CDA1B2B00627463 /* UScreenWelcome.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {715, 1694}}"; + sepNavSelRange = "{58, 0}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{38, 58}, {754, 944}}"; + }; + }; + 2CF5508B0CDA22B000627463 /* ModiSDK.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {998, 2072}}"; + sepNavSelRange = "{30, 19}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavWindowFrame = "{{15, 79}, {754, 944}}"; + }; + }; + 2CF5510E0CDA293700627463 /* SQLite3.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1364, 2800}}"; + sepNavSelRange = "{517, 0}"; + sepNavVisRect = "{{0, 0}, {1031, 840}}"; + sepNavWindowFrame = "{{15, 54}, {1070, 969}}"; + }; + }; + 2CF5510F0CDA293700627463 /* SQLiteTable3.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1031, 10766}}"; + sepNavSelRange = "{559, 0}"; + sepNavVisRect = "{{0, 0}, {1031, 840}}"; + sepNavWindowFrame = "{{15, 54}, {1070, 969}}"; + }; + }; + 2CF551A70CDA356800627463 /* UltraStar.dpr */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1031, 2338}}"; + sepNavSelRange = "{6767, 0}"; + sepNavVisRect = "{{0, 1498}, {1031, 840}}"; + sepNavWindowFrame = "{{15, 54}, {1070, 969}}"; + }; + }; + 2CF552110CDA3D1400627463 /* UPluginDefs.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1013, 2506}}"; + sepNavSelRange = "{5, 11}"; + sepNavVisRect = "{{0, 0}, {1013, 614}}"; + sepNavWindowFrame = "{{107, 196}, {1052, 743}}"; + }; + }; + 2CF552660CDA404000627463 /* Messages.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1013, 614}}"; + sepNavSelRange = "{65, 0}"; + sepNavVisRect = "{{0, 0}, {1013, 614}}"; + sepNavWindowFrame = "{{102, 176}, {1052, 743}}"; + }; + }; + 2CF552760CDA419B00627463 /* PBXBookmark */ = { + isa = PBXBookmark; + fRef = 2CF552660CDA404000627463 /* Messages.pas */; + }; + 2CF5529E0CDA42C900627463 /* avcodec.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1013, 28616}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 375}, {1013, 614}}"; + sepNavWindowFrame = "{{176, 133}, {1052, 743}}"; + }; + }; + 2CF5529F0CDA42C900627463 /* avformat.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1013, 9828}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 298}, {1013, 614}}"; + sepNavWindowFrame = "{{245, 70}, {1052, 743}}"; + }; + }; + 2CF552A00CDA42C900627463 /* avio.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1013, 3598}}"; + sepNavSelRange = "{347, 0}"; + sepNavVisRect = "{{0, 190}, {1013, 614}}"; + sepNavWindowFrame = "{{199, 112}, {1052, 743}}"; + }; + }; + 2CF552A10CDA42C900627463 /* avutil.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1022, 2058}}"; + sepNavSelRange = "{674, 0}"; + sepNavVisRect = "{{0, 293}, {1013, 614}}"; + sepNavWindowFrame = "{{222, 91}, {1052, 743}}"; + }; + }; + 2CF552FF0CDA500800627463 /* PBXBookmark */ = { + isa = PBXBookmark; + fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; + }; + 2CF553040CDA513000627463 /* PBXBookmark */ = { + isa = PBXBookmark; + fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; + }; + 2CF553060CDA514A00627463 /* PBXBookmark */ = { + isa = PBXBookmark; + fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; + }; + 2CF553070CDA51B500627463 /* sdlutils.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1013, 61068}}"; + sepNavSelRange = "{8481, 20}"; + sepNavVisRect = "{{0, 1054}, {1013, 614}}"; + sepNavWindowFrame = "{{38, 259}, {1052, 743}}"; + }; + }; + 2CF553670CDA575100627463 /* PBXBookmark */ = { + isa = PBXBookmark; + fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; + }; + 2CF553780CDA575B00627463 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; + name = "function GetTickCount : Cardinal;"; + rLen = 35; + rLoc = 2755; + rType = 0; + vrLen = 1149; + vrLoc = 1974; + }; + 2CF553830CDA578D00627463 /* UMain.pas:148 */ = { + isa = PBXFileBreakpoint; + actions = ( + ); + breakpointStyle = 0; + continueAfterActions = 0; + delayBeforeContinue = 0; + fileReference = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; + hitCount = 1; + lineNumber = 148; + location = UltraStarDX; + modificationTime = 215636536.733827; + state = 1; + }; + 2CF553940CDA58E900627463 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; + name = "{$ifdef fpc}"; + rLen = 12; + rLoc = 11808; + rType = 0; + vrLen = 1465; + vrLoc = 718; + }; + 2CF553960CDA58E900627463 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; + name = AllocateHWND; + rLen = 12; + rLoc = 3202; + rType = 0; + vrLen = 1409; + vrLoc = 2690; + }; + 2CF553A20CDA59BB00627463 /* UltraStarDX.pas:8 */ = { + isa = PBXFileBreakpoint; + actions = ( + ); + breakpointStyle = 0; + continueAfterActions = 0; + delayBeforeContinue = 0; + fileReference = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; + hitCount = 1; + lineNumber = 8; + location = UltraStarDX; + modificationTime = 215636528.021684; state = 1; }; + 2CF553B10CDA5A2F00627463 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; + name = "UMain.pas: 136"; + rLen = 0; + rLoc = 3282; + rType = 0; + vrLen = 1064; + vrLoc = 3295; + }; + 2CF553BB0CDA5A4D00627463 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; + name = "UMain.pas: 138"; + rLen = 0; + rLoc = 3295; + rType = 0; + vrLen = 1415; + vrLoc = 2519; + }; + 2CF553BC0CDA5A4D00627463 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; + name = "UAudio_FFMpeg.pas: 944"; + rLen = 0; + rLoc = 22728; + rType = 0; + vrLen = 1145; + vrLoc = 21583; + }; + 2CF553BD0CDA5A4D00627463 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; + name = AllocateHWND; + rLen = 12; + rLoc = 3202; + rType = 0; + vrLen = 1157; + vrLoc = 15694; + }; + 2CF553BE0CDA5A4D00627463 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; + name = "UltraStarDX.pas: 7"; + rLen = 0; + rLoc = 129; + rType = 0; + vrLen = 159; + vrLoc = 0; + }; + 2CF553BF0CDA5A4D00627463 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; + name = "sdl_image.pas: 130"; + rLen = 0; + rLoc = 8020; + rType = 0; + vrLen = 885; + vrLoc = 7978; + }; + 2CF553C00CDA5A4D00627463 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; + name = "sdl.pas: 250"; + rLen = 0; + rLoc = 16506; + rType = 0; + vrLen = 886; + vrLoc = 16376; + }; + 2CF553C10CDA5A4D00627463 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; + name = SDL_ScaleSurfaceRect; + rLen = 20; + rLoc = 11823; + rType = 0; + vrLen = 1266; + vrLoc = 10980; + }; + 2CF553C20CDA5A4D00627463 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; + name = "Windows.pas: 115"; + rLen = 0; + rLoc = 2832; + rType = 0; + vrLen = 1201; + vrLoc = 2027; + }; + 2CF553C30CDA5A4D00627463 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2CF552660CDA404000627463 /* Messages.pas */; + name = "Messages.pas: 9"; + rLen = 0; + rLoc = 65; + rType = 0; + vrLen = 428; + vrLoc = 0; + }; 9845B6590B1F9B9E0084DD62 /* SDL.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {948, 1330}}"; - sepNavSelRange = "{345, 0}"; + sepNavSelRange = "{273, 0}"; sepNavVisRect = "{{0, 0}, {948, 730}}"; sepNavWindowFrame = "{{61, 122}, {987, 859}}"; }; @@ -278,8 +1123,8 @@ 98B8BE5C0B1F974F00162019 /* sdl.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1268, 58492}}"; - sepNavSelRange = "{17272, 0}"; - sepNavVisRect = "{{0, 3394}, {948, 730}}"; + sepNavSelRange = "{16506, 0}"; + sepNavVisRect = "{{0, 3444}, {948, 730}}"; sepNavWindowFrame = "{{211, 143}, {987, 859}}"; }; }; @@ -287,7 +1132,7 @@ uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {948, 5390}}"; sepNavSelRange = "{558, 0}"; - sepNavVisRect = "{{0, 0}, {948, 730}}"; + sepNavVisRect = "{{0, 21}, {948, 730}}"; sepNavWindowFrame = "{{15, 164}, {987, 859}}"; }; }; @@ -295,7 +1140,7 @@ activeExec = 0; }; DDC6850F09F5717A004E4BFF /* Project object */ = { - activeBuildConfigurationName = Release; + activeBuildConfigurationName = Debug; activeExecutable = 2CDD4B5D0CB9354800549FAC /* UltraStarDX */; activeTarget = DDC688C709F574E9004E4BFF /* UltraStarDX */; addToTargets = ( @@ -304,6 +1149,8 @@ ); breakpoints = ( 2CDEA8080CBD7D920096994C /* UMain.pas:293 */, + 2CF553830CDA578D00627463 /* UMain.pas:148 */, + 2CF553A20CDA59BB00627463 /* UltraStarDX.pas:8 */, ); breakpointsGroup = 2CDD4B7F0CB9394600549FAC /* XCBreakpointsBucket */; codeSenseManager = 2CDD4B6A0CB9357000549FAC /* Code sense */; @@ -409,12 +1256,28 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 215383733; - PBXWorkspaceStateSaveDate = 215383733; + PBXPerProjectTemplateStateSaveDate = 215618698; + PBXWorkspaceStateSaveDate = 215618698; }; perUserProjectItems = { - 2C0B7D280CD6808A0062A7C8 /* PBXBookmark */ = 2C0B7D280CD6808A0062A7C8 /* PBXBookmark */; - 2C0B7D320CD683C80062A7C8 /* PBXTextBookmark */ = 2C0B7D320CD683C80062A7C8 /* PBXTextBookmark */; + 2CF552760CDA419B00627463 /* PBXBookmark */ = 2CF552760CDA419B00627463 /* PBXBookmark */; + 2CF552FF0CDA500800627463 /* PBXBookmark */ = 2CF552FF0CDA500800627463 /* PBXBookmark */; + 2CF553040CDA513000627463 /* PBXBookmark */ = 2CF553040CDA513000627463 /* PBXBookmark */; + 2CF553060CDA514A00627463 /* PBXBookmark */ = 2CF553060CDA514A00627463 /* PBXBookmark */; + 2CF553670CDA575100627463 /* PBXBookmark */ = 2CF553670CDA575100627463 /* PBXBookmark */; + 2CF553780CDA575B00627463 /* PBXTextBookmark */ = 2CF553780CDA575B00627463 /* PBXTextBookmark */; + 2CF553940CDA58E900627463 /* PBXTextBookmark */ = 2CF553940CDA58E900627463 /* PBXTextBookmark */; + 2CF553960CDA58E900627463 /* PBXTextBookmark */ = 2CF553960CDA58E900627463 /* PBXTextBookmark */; + 2CF553B10CDA5A2F00627463 /* PBXTextBookmark */ = 2CF553B10CDA5A2F00627463 /* PBXTextBookmark */; + 2CF553BB0CDA5A4D00627463 /* PBXTextBookmark */ = 2CF553BB0CDA5A4D00627463 /* PBXTextBookmark */; + 2CF553BC0CDA5A4D00627463 /* PBXTextBookmark */ = 2CF553BC0CDA5A4D00627463 /* PBXTextBookmark */; + 2CF553BD0CDA5A4D00627463 /* PBXTextBookmark */ = 2CF553BD0CDA5A4D00627463 /* PBXTextBookmark */; + 2CF553BE0CDA5A4D00627463 /* PBXTextBookmark */ = 2CF553BE0CDA5A4D00627463 /* PBXTextBookmark */; + 2CF553BF0CDA5A4D00627463 /* PBXTextBookmark */ = 2CF553BF0CDA5A4D00627463 /* PBXTextBookmark */; + 2CF553C00CDA5A4D00627463 /* PBXTextBookmark */ = 2CF553C00CDA5A4D00627463 /* PBXTextBookmark */; + 2CF553C10CDA5A4D00627463 /* PBXTextBookmark */ = 2CF553C10CDA5A4D00627463 /* PBXTextBookmark */; + 2CF553C20CDA5A4D00627463 /* PBXTextBookmark */ = 2CF553C20CDA5A4D00627463 /* PBXTextBookmark */; + 2CF553C30CDA5A4D00627463 /* PBXTextBookmark */ = 2CF553C30CDA5A4D00627463 /* PBXTextBookmark */; }; sourceControlManager = 2CDD4B690CB9357000549FAC /* Source Control */; userBuildSettings = { @@ -423,7 +1286,7 @@ DDC6851B09F57195004E4BFF /* UltraStarDX.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {948, 730}}"; - sepNavSelRange = "{17, 0}"; + sepNavSelRange = "{129, 0}"; sepNavVisRect = "{{0, 0}, {948, 730}}"; sepNavWindowFrame = "{{189, 86}, {987, 859}}"; }; diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj index 958c7a8a..f2cf90b5 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj @@ -26,7 +26,6 @@ 2C4D9C9F0CC9EC8C0031092D /* UIni.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C720CC9EC8C0031092D /* UIni.pas */; }; 2C4D9CA00CC9EC8C0031092D /* UJoystick.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C730CC9EC8C0031092D /* UJoystick.pas */; }; 2C4D9CA10CC9EC8C0031092D /* ULanguage.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C740CC9EC8C0031092D /* ULanguage.pas */; }; - 2C4D9CA20CC9EC8C0031092D /* Ulazjpeg.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C750CC9EC8C0031092D /* Ulazjpeg.pas */; }; 2C4D9CA30CC9EC8C0031092D /* ULCD.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C760CC9EC8C0031092D /* ULCD.pas */; }; 2C4D9CA40CC9EC8C0031092D /* ULight.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C770CC9EC8C0031092D /* ULight.pas */; }; 2C4D9CA50CC9EC8C0031092D /* ULog.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C780CC9EC8C0031092D /* ULog.pas */; }; @@ -38,7 +37,6 @@ 2C4D9CAB0CC9EC8C0031092D /* UMusic.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C7E0CC9EC8C0031092D /* UMusic.pas */; }; 2C4D9CAC0CC9EC8C0031092D /* UParty.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C7F0CC9EC8C0031092D /* UParty.pas */; }; 2C4D9CAD0CC9EC8C0031092D /* UPlaylist.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C800CC9EC8C0031092D /* UPlaylist.pas */; }; - 2C4D9CAE0CC9EC8C0031092D /* UPliki.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C810CC9EC8C0031092D /* UPliki.pas */; }; 2C4D9CAF0CC9EC8C0031092D /* UPluginInterface.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C820CC9EC8C0031092D /* UPluginInterface.pas */; }; 2C4D9CB00CC9EC8C0031092D /* uPluginLoader.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C830CC9EC8C0031092D /* uPluginLoader.pas */; }; 2C4D9CB10CC9EC8C0031092D /* URecord.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C840CC9EC8C0031092D /* URecord.pas */; }; @@ -71,7 +69,6 @@ 2C4D9CCC0CC9EC8C0031092D /* UIni.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C720CC9EC8C0031092D /* UIni.pas */; }; 2C4D9CCD0CC9EC8C0031092D /* UJoystick.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C730CC9EC8C0031092D /* UJoystick.pas */; }; 2C4D9CCE0CC9EC8C0031092D /* ULanguage.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C740CC9EC8C0031092D /* ULanguage.pas */; }; - 2C4D9CCF0CC9EC8C0031092D /* Ulazjpeg.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C750CC9EC8C0031092D /* Ulazjpeg.pas */; }; 2C4D9CD00CC9EC8C0031092D /* ULCD.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C760CC9EC8C0031092D /* ULCD.pas */; }; 2C4D9CD10CC9EC8C0031092D /* ULight.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C770CC9EC8C0031092D /* ULight.pas */; }; 2C4D9CD20CC9EC8C0031092D /* ULog.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C780CC9EC8C0031092D /* ULog.pas */; }; @@ -83,7 +80,6 @@ 2C4D9CD80CC9EC8C0031092D /* UMusic.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C7E0CC9EC8C0031092D /* UMusic.pas */; }; 2C4D9CD90CC9EC8C0031092D /* UParty.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C7F0CC9EC8C0031092D /* UParty.pas */; }; 2C4D9CDA0CC9EC8C0031092D /* UPlaylist.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C800CC9EC8C0031092D /* UPlaylist.pas */; }; - 2C4D9CDB0CC9EC8C0031092D /* UPliki.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C810CC9EC8C0031092D /* UPliki.pas */; }; 2C4D9CDC0CC9EC8C0031092D /* UPluginInterface.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C820CC9EC8C0031092D /* UPluginInterface.pas */; }; 2C4D9CDD0CC9EC8C0031092D /* uPluginLoader.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C830CC9EC8C0031092D /* uPluginLoader.pas */; }; 2C4D9CDE0CC9EC8C0031092D /* URecord.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C840CC9EC8C0031092D /* URecord.pas */; }; @@ -133,24 +129,14 @@ 2C4D9DF20CC9EF210031092D /* sdltruetypefont.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DF00CC9EF210031092D /* sdltruetypefont.pas */; }; 2C4D9DF30CC9EF210031092D /* sdl_ttf.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DEF0CC9EF210031092D /* sdl_ttf.pas */; }; 2C4D9DF40CC9EF210031092D /* sdltruetypefont.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DF00CC9EF210031092D /* sdltruetypefont.pas */; }; - 2C4D9E0B0CC9EF840031092D /* MacClasses.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DFF0CC9EF840031092D /* MacClasses.pas */; }; 2C4D9E0C0CC9EF840031092D /* Graphics.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E000CC9EF840031092D /* Graphics.pas */; }; 2C4D9E0D0CC9EF840031092D /* JPEG.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E010CC9EF840031092D /* JPEG.pas */; }; - 2C4D9E0E0CC9EF840031092D /* MidiFile.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E020CC9EF840031092D /* MidiFile.pas */; }; - 2C4D9E0F0CC9EF840031092D /* MidiOut.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E030CC9EF840031092D /* MidiOut.pas */; }; 2C4D9E100CC9EF840031092D /* OpenGL12.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E040CC9EF840031092D /* OpenGL12.pas */; }; - 2C4D9E130CC9EF840031092D /* PNGImage.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E070CC9EF840031092D /* PNGImage.pas */; }; 2C4D9E150CC9EF840031092D /* Windows.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; }; - 2C4D9E160CC9EF840031092D /* zlportio.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E0A0CC9EF840031092D /* zlportio.pas */; }; - 2C4D9E170CC9EF840031092D /* MacClasses.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DFF0CC9EF840031092D /* MacClasses.pas */; }; 2C4D9E180CC9EF840031092D /* Graphics.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E000CC9EF840031092D /* Graphics.pas */; }; 2C4D9E190CC9EF840031092D /* JPEG.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E010CC9EF840031092D /* JPEG.pas */; }; - 2C4D9E1A0CC9EF840031092D /* MidiFile.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E020CC9EF840031092D /* MidiFile.pas */; }; - 2C4D9E1B0CC9EF840031092D /* MidiOut.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E030CC9EF840031092D /* MidiOut.pas */; }; 2C4D9E1C0CC9EF840031092D /* OpenGL12.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E040CC9EF840031092D /* OpenGL12.pas */; }; - 2C4D9E1F0CC9EF840031092D /* PNGImage.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E070CC9EF840031092D /* PNGImage.pas */; }; 2C4D9E210CC9EF840031092D /* Windows.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; }; - 2C4D9E220CC9EF840031092D /* zlportio.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E0A0CC9EF840031092D /* zlportio.pas */; }; 2C4D9E450CC9F0ED0031092D /* switches.inc in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E440CC9F0ED0031092D /* switches.inc */; }; 2C4D9E460CC9F0ED0031092D /* switches.inc in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E440CC9F0ED0031092D /* switches.inc */; }; 2CDD4BDE0CB947A400549FAC /* sdl.pas in Sources */ = {isa = PBXBuildFile; fileRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; }; @@ -159,6 +145,112 @@ 2CDEA4F70CBD725B0096994C /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CDEA4F60CBD725B0096994C /* OpenGL.framework */; }; 2CDEC4960CC5264600FFA244 /* SDL.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 98B8BE570B1F972400162019 /* SDL.framework */; }; 2CDEC4CD0CC52E7F00FFA244 /* UltraStarDX.icns in Resources */ = {isa = PBXBuildFile; fileRef = 2CDEC4CC0CC52E7F00FFA244 /* UltraStarDX.icns */; }; + 2CF54F650CDA1B2B00627463 /* UScreenCredits.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */; }; + 2CF54F660CDA1B2B00627463 /* UScreenEdit.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F440CDA1B2B00627463 /* UScreenEdit.pas */; }; + 2CF54F670CDA1B2B00627463 /* UScreenEditConvert.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F450CDA1B2B00627463 /* UScreenEditConvert.pas */; }; + 2CF54F680CDA1B2B00627463 /* UScreenEditHeader.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F460CDA1B2B00627463 /* UScreenEditHeader.pas */; }; + 2CF54F690CDA1B2B00627463 /* UScreenEditSub.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F470CDA1B2B00627463 /* UScreenEditSub.pas */; }; + 2CF54F6A0CDA1B2B00627463 /* UScreenLevel.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F480CDA1B2B00627463 /* UScreenLevel.pas */; }; + 2CF54F6B0CDA1B2B00627463 /* UScreenLoading.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F490CDA1B2B00627463 /* UScreenLoading.pas */; }; + 2CF54F6C0CDA1B2B00627463 /* UScreenMain.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F4A0CDA1B2B00627463 /* UScreenMain.pas */; }; + 2CF54F6D0CDA1B2B00627463 /* UScreenName.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F4B0CDA1B2B00627463 /* UScreenName.pas */; }; + 2CF54F6E0CDA1B2B00627463 /* UScreenOpen.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F4C0CDA1B2B00627463 /* UScreenOpen.pas */; }; + 2CF54F6F0CDA1B2B00627463 /* UScreenOptions.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F4D0CDA1B2B00627463 /* UScreenOptions.pas */; }; + 2CF54F700CDA1B2B00627463 /* UScreenOptionsAdvanced.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F4E0CDA1B2B00627463 /* UScreenOptionsAdvanced.pas */; }; + 2CF54F710CDA1B2B00627463 /* UScreenOptionsGame.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F4F0CDA1B2B00627463 /* UScreenOptionsGame.pas */; }; + 2CF54F720CDA1B2B00627463 /* UScreenOptionsGraphics.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F500CDA1B2B00627463 /* UScreenOptionsGraphics.pas */; }; + 2CF54F730CDA1B2B00627463 /* UScreenOptionsLyrics.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F510CDA1B2B00627463 /* UScreenOptionsLyrics.pas */; }; + 2CF54F740CDA1B2B00627463 /* UScreenOptionsRecord.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F520CDA1B2B00627463 /* UScreenOptionsRecord.pas */; }; + 2CF54F750CDA1B2B00627463 /* UScreenOptionsSound.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F530CDA1B2B00627463 /* UScreenOptionsSound.pas */; }; + 2CF54F760CDA1B2B00627463 /* UScreenOptionsThemes.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F540CDA1B2B00627463 /* UScreenOptionsThemes.pas */; }; + 2CF54F770CDA1B2B00627463 /* UScreenPartyNewRound.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F550CDA1B2B00627463 /* UScreenPartyNewRound.pas */; }; + 2CF54F780CDA1B2B00627463 /* UScreenPartyOptions.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F560CDA1B2B00627463 /* UScreenPartyOptions.pas */; }; + 2CF54F790CDA1B2B00627463 /* UScreenPartyPlayer.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F570CDA1B2B00627463 /* UScreenPartyPlayer.pas */; }; + 2CF54F7A0CDA1B2B00627463 /* UScreenPartyScore.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F580CDA1B2B00627463 /* UScreenPartyScore.pas */; }; + 2CF54F7B0CDA1B2B00627463 /* UScreenPartyWin.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F590CDA1B2B00627463 /* UScreenPartyWin.pas */; }; + 2CF54F7C0CDA1B2B00627463 /* UScreenPopup.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F5A0CDA1B2B00627463 /* UScreenPopup.pas */; }; + 2CF54F7D0CDA1B2B00627463 /* UScreenScore.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F5B0CDA1B2B00627463 /* UScreenScore.pas */; }; + 2CF54F7E0CDA1B2B00627463 /* UScreenSing.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F5C0CDA1B2B00627463 /* UScreenSing.pas */; }; + 2CF54F7F0CDA1B2B00627463 /* UScreenSingModi.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F5D0CDA1B2B00627463 /* UScreenSingModi.pas */; }; + 2CF54F800CDA1B2B00627463 /* UScreenSong.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F5E0CDA1B2B00627463 /* UScreenSong.pas */; }; + 2CF54F810CDA1B2B00627463 /* UScreenSongJumpto.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F5F0CDA1B2B00627463 /* UScreenSongJumpto.pas */; }; + 2CF54F820CDA1B2B00627463 /* UScreenSongMenu.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F600CDA1B2B00627463 /* UScreenSongMenu.pas */; }; + 2CF54F830CDA1B2B00627463 /* UScreenStatDetail.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F610CDA1B2B00627463 /* UScreenStatDetail.pas */; }; + 2CF54F840CDA1B2B00627463 /* UScreenStatMain.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F620CDA1B2B00627463 /* UScreenStatMain.pas */; }; + 2CF54F850CDA1B2B00627463 /* UScreenTop5.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F630CDA1B2B00627463 /* UScreenTop5.pas */; }; + 2CF54F860CDA1B2B00627463 /* UScreenWelcome.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F640CDA1B2B00627463 /* UScreenWelcome.pas */; }; + 2CF54F870CDA1B2B00627463 /* UScreenCredits.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */; }; + 2CF54F880CDA1B2B00627463 /* UScreenEdit.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F440CDA1B2B00627463 /* UScreenEdit.pas */; }; + 2CF54F890CDA1B2B00627463 /* UScreenEditConvert.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F450CDA1B2B00627463 /* UScreenEditConvert.pas */; }; + 2CF54F8A0CDA1B2B00627463 /* UScreenEditHeader.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F460CDA1B2B00627463 /* UScreenEditHeader.pas */; }; + 2CF54F8B0CDA1B2B00627463 /* UScreenEditSub.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F470CDA1B2B00627463 /* UScreenEditSub.pas */; }; + 2CF54F8C0CDA1B2B00627463 /* UScreenLevel.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F480CDA1B2B00627463 /* UScreenLevel.pas */; }; + 2CF54F8D0CDA1B2B00627463 /* UScreenLoading.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F490CDA1B2B00627463 /* UScreenLoading.pas */; }; + 2CF54F8E0CDA1B2B00627463 /* UScreenMain.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F4A0CDA1B2B00627463 /* UScreenMain.pas */; }; + 2CF54F8F0CDA1B2B00627463 /* UScreenName.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F4B0CDA1B2B00627463 /* UScreenName.pas */; }; + 2CF54F900CDA1B2B00627463 /* UScreenOpen.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F4C0CDA1B2B00627463 /* UScreenOpen.pas */; }; + 2CF54F910CDA1B2B00627463 /* UScreenOptions.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F4D0CDA1B2B00627463 /* UScreenOptions.pas */; }; + 2CF54F920CDA1B2B00627463 /* UScreenOptionsAdvanced.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F4E0CDA1B2B00627463 /* UScreenOptionsAdvanced.pas */; }; + 2CF54F930CDA1B2B00627463 /* UScreenOptionsGame.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F4F0CDA1B2B00627463 /* UScreenOptionsGame.pas */; }; + 2CF54F940CDA1B2B00627463 /* UScreenOptionsGraphics.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F500CDA1B2B00627463 /* UScreenOptionsGraphics.pas */; }; + 2CF54F950CDA1B2B00627463 /* UScreenOptionsLyrics.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F510CDA1B2B00627463 /* UScreenOptionsLyrics.pas */; }; + 2CF54F960CDA1B2B00627463 /* UScreenOptionsRecord.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F520CDA1B2B00627463 /* UScreenOptionsRecord.pas */; }; + 2CF54F970CDA1B2B00627463 /* UScreenOptionsSound.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F530CDA1B2B00627463 /* UScreenOptionsSound.pas */; }; + 2CF54F980CDA1B2B00627463 /* UScreenOptionsThemes.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F540CDA1B2B00627463 /* UScreenOptionsThemes.pas */; }; + 2CF54F990CDA1B2B00627463 /* UScreenPartyNewRound.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F550CDA1B2B00627463 /* UScreenPartyNewRound.pas */; }; + 2CF54F9A0CDA1B2B00627463 /* UScreenPartyOptions.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F560CDA1B2B00627463 /* UScreenPartyOptions.pas */; }; + 2CF54F9B0CDA1B2B00627463 /* UScreenPartyPlayer.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F570CDA1B2B00627463 /* UScreenPartyPlayer.pas */; }; + 2CF54F9C0CDA1B2B00627463 /* UScreenPartyScore.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F580CDA1B2B00627463 /* UScreenPartyScore.pas */; }; + 2CF54F9D0CDA1B2B00627463 /* UScreenPartyWin.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F590CDA1B2B00627463 /* UScreenPartyWin.pas */; }; + 2CF54F9E0CDA1B2B00627463 /* UScreenPopup.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F5A0CDA1B2B00627463 /* UScreenPopup.pas */; }; + 2CF54F9F0CDA1B2B00627463 /* UScreenScore.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F5B0CDA1B2B00627463 /* UScreenScore.pas */; }; + 2CF54FA00CDA1B2B00627463 /* UScreenSing.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F5C0CDA1B2B00627463 /* UScreenSing.pas */; }; + 2CF54FA10CDA1B2B00627463 /* UScreenSingModi.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F5D0CDA1B2B00627463 /* UScreenSingModi.pas */; }; + 2CF54FA20CDA1B2B00627463 /* UScreenSong.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F5E0CDA1B2B00627463 /* UScreenSong.pas */; }; + 2CF54FA30CDA1B2B00627463 /* UScreenSongJumpto.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F5F0CDA1B2B00627463 /* UScreenSongJumpto.pas */; }; + 2CF54FA40CDA1B2B00627463 /* UScreenSongMenu.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F600CDA1B2B00627463 /* UScreenSongMenu.pas */; }; + 2CF54FA50CDA1B2B00627463 /* UScreenStatDetail.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F610CDA1B2B00627463 /* UScreenStatDetail.pas */; }; + 2CF54FA60CDA1B2B00627463 /* UScreenStatMain.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F620CDA1B2B00627463 /* UScreenStatMain.pas */; }; + 2CF54FA70CDA1B2B00627463 /* UScreenTop5.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F630CDA1B2B00627463 /* UScreenTop5.pas */; }; + 2CF54FA80CDA1B2B00627463 /* UScreenWelcome.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F640CDA1B2B00627463 /* UScreenWelcome.pas */; }; + 2CF5508C0CDA22B000627463 /* ModiSDK.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF5508B0CDA22B000627463 /* ModiSDK.pas */; }; + 2CF5508D0CDA22B000627463 /* ModiSDK.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF5508B0CDA22B000627463 /* ModiSDK.pas */; }; + 2CF551100CDA293700627463 /* SQLite3.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF5510E0CDA293700627463 /* SQLite3.pas */; }; + 2CF551110CDA293700627463 /* SQLiteTable3.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF5510F0CDA293700627463 /* SQLiteTable3.pas */; }; + 2CF551120CDA293700627463 /* SQLite3.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF5510E0CDA293700627463 /* SQLite3.pas */; }; + 2CF551130CDA293700627463 /* SQLiteTable3.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF5510F0CDA293700627463 /* SQLiteTable3.pas */; }; + 2CF5512D0CDA29C600627463 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CF5512C0CDA29C600627463 /* libsqlite3.dylib */; }; + 2CF552140CDA3D1400627463 /* UPluginDefs.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552110CDA3D1400627463 /* UPluginDefs.pas */; }; + 2CF552170CDA3D1400627463 /* UPluginDefs.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552110CDA3D1400627463 /* UPluginDefs.pas */; }; + 2CF552670CDA404000627463 /* Messages.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552660CDA404000627463 /* Messages.pas */; }; + 2CF552680CDA404000627463 /* Messages.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552660CDA404000627463 /* Messages.pas */; }; + 2CF552A70CDA42C900627463 /* avcodec.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF5529E0CDA42C900627463 /* avcodec.pas */; }; + 2CF552A80CDA42C900627463 /* avformat.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF5529F0CDA42C900627463 /* avformat.pas */; }; + 2CF552A90CDA42C900627463 /* avio.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552A00CDA42C900627463 /* avio.pas */; }; + 2CF552AA0CDA42C900627463 /* avutil.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552A10CDA42C900627463 /* avutil.pas */; }; + 2CF552AD0CDA42C900627463 /* opt.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552A40CDA42C900627463 /* opt.pas */; }; + 2CF552AE0CDA42C900627463 /* rational.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552A50CDA42C900627463 /* rational.pas */; }; + 2CF552B00CDA42C900627463 /* avcodec.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF5529E0CDA42C900627463 /* avcodec.pas */; }; + 2CF552B10CDA42C900627463 /* avformat.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF5529F0CDA42C900627463 /* avformat.pas */; }; + 2CF552B20CDA42C900627463 /* avio.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552A00CDA42C900627463 /* avio.pas */; }; + 2CF552B30CDA42C900627463 /* avutil.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552A10CDA42C900627463 /* avutil.pas */; }; + 2CF552B60CDA42C900627463 /* opt.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552A40CDA42C900627463 /* opt.pas */; }; + 2CF552B70CDA42C900627463 /* rational.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552A50CDA42C900627463 /* rational.pas */; }; + 2CF552C30CDA4B7B00627463 /* libavcodec.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CF552BF0CDA4B7B00627463 /* libavcodec.dylib */; }; + 2CF552C40CDA4B7B00627463 /* libavformat.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CF552C00CDA4B7B00627463 /* libavformat.dylib */; }; + 2CF552C50CDA4B7B00627463 /* libavutil.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CF552C10CDA4B7B00627463 /* libavutil.dylib */; }; + 2CF552C60CDA4B7B00627463 /* libmp3lame.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CF552C20CDA4B7B00627463 /* libmp3lame.dylib */; }; + 2CF553080CDA51B500627463 /* sdlutils.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF553070CDA51B500627463 /* sdlutils.pas */; }; + 2CF553090CDA51B500627463 /* sdlutils.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF553070CDA51B500627463 /* sdlutils.pas */; }; + 2CF553100CDA52D100627463 /* SDL_image.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2C4D9D980CC9EE0B0031092D /* SDL_image.framework */; }; + 2CF5533B0CDA52E200627463 /* SDL_ttf.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2C4D9D990CC9EE0B0031092D /* SDL_ttf.framework */; }; + 2CF5533E0CDA530300627463 /* libbass.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2C4D9CE90CC9ECB50031092D /* libbass.dylib */; }; + 2CF5533F0CDA531100627463 /* libfreeimage.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2C4D9D960CC9EDEB0031092D /* libfreeimage.dylib */; }; + 2CF553400CDA531100627463 /* libsqlite3.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2CF5512C0CDA29C600627463 /* libsqlite3.dylib */; }; + 2CF553410CDA531100627463 /* libavcodec.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2CF552BF0CDA4B7B00627463 /* libavcodec.dylib */; }; + 2CF553420CDA531100627463 /* libavformat.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2CF552C00CDA4B7B00627463 /* libavformat.dylib */; }; + 2CF553430CDA531100627463 /* libavutil.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2CF552C10CDA4B7B00627463 /* libavutil.dylib */; }; + 2CF553440CDA531100627463 /* libmp3lame.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2CF552C20CDA4B7B00627463 /* libmp3lame.dylib */; }; 98B8BE340B1F947800162019 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 98B8BE330B1F947800162019 /* AppKit.framework */; }; 98B8BE390B1F949C00162019 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 98B8BE370B1F949C00162019 /* Cocoa.framework */; }; 98B8BE3A0B1F949C00162019 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 98B8BE380B1F949C00162019 /* Foundation.framework */; }; @@ -238,6 +330,13 @@ dstPath = ""; dstSubfolderSpec = 6; files = ( + 2CF5533F0CDA531100627463 /* libfreeimage.dylib in CopyFiles */, + 2CF553400CDA531100627463 /* libsqlite3.dylib in CopyFiles */, + 2CF553410CDA531100627463 /* libavcodec.dylib in CopyFiles */, + 2CF553420CDA531100627463 /* libavformat.dylib in CopyFiles */, + 2CF553430CDA531100627463 /* libavutil.dylib in CopyFiles */, + 2CF553440CDA531100627463 /* libmp3lame.dylib in CopyFiles */, + 2CF5533E0CDA530300627463 /* libbass.dylib in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -248,6 +347,8 @@ dstSubfolderSpec = 10; files = ( 2CDEC4960CC5264600FFA244 /* SDL.framework in CopyFiles */, + 2CF553100CDA52D100627463 /* SDL_image.framework in CopyFiles */, + 2CF5533B0CDA52E200627463 /* SDL_ttf.framework in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -273,7 +374,6 @@ 2C4D9C720CC9EC8C0031092D /* UIni.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UIni.pas; path = ../Classes/UIni.pas; sourceTree = SOURCE_ROOT; }; 2C4D9C730CC9EC8C0031092D /* UJoystick.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UJoystick.pas; path = ../Classes/UJoystick.pas; sourceTree = SOURCE_ROOT; }; 2C4D9C740CC9EC8C0031092D /* ULanguage.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = ULanguage.pas; path = ../Classes/ULanguage.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C750CC9EC8C0031092D /* Ulazjpeg.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = Ulazjpeg.pas; path = ../Classes/Ulazjpeg.pas; sourceTree = SOURCE_ROOT; }; 2C4D9C760CC9EC8C0031092D /* ULCD.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = ULCD.pas; path = ../Classes/ULCD.pas; sourceTree = SOURCE_ROOT; }; 2C4D9C770CC9EC8C0031092D /* ULight.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = ULight.pas; path = ../Classes/ULight.pas; sourceTree = SOURCE_ROOT; }; 2C4D9C780CC9EC8C0031092D /* ULog.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = ULog.pas; path = ../Classes/ULog.pas; sourceTree = SOURCE_ROOT; }; @@ -285,7 +385,6 @@ 2C4D9C7E0CC9EC8C0031092D /* UMusic.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMusic.pas; path = ../Classes/UMusic.pas; sourceTree = SOURCE_ROOT; }; 2C4D9C7F0CC9EC8C0031092D /* UParty.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UParty.pas; path = ../Classes/UParty.pas; sourceTree = SOURCE_ROOT; }; 2C4D9C800CC9EC8C0031092D /* UPlaylist.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UPlaylist.pas; path = ../Classes/UPlaylist.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C810CC9EC8C0031092D /* UPliki.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UPliki.pas; path = ../Classes/UPliki.pas; sourceTree = SOURCE_ROOT; }; 2C4D9C820CC9EC8C0031092D /* UPluginInterface.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UPluginInterface.pas; path = ../Classes/UPluginInterface.pas; sourceTree = SOURCE_ROOT; }; 2C4D9C830CC9EC8C0031092D /* uPluginLoader.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = uPluginLoader.pas; path = ../Classes/uPluginLoader.pas; sourceTree = SOURCE_ROOT; }; 2C4D9C840CC9EC8C0031092D /* URecord.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = URecord.pas; path = ../Classes/URecord.pas; sourceTree = SOURCE_ROOT; }; @@ -319,18 +418,65 @@ 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = sdl_image.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL_image/sdl_image.pas"; sourceTree = ""; }; 2C4D9DEF0CC9EF210031092D /* sdl_ttf.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = sdl_ttf.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL_ttf/sdl_ttf.pas"; sourceTree = ""; }; 2C4D9DF00CC9EF210031092D /* sdltruetypefont.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = sdltruetypefont.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL_ttf/sdltruetypefont.pas"; sourceTree = ""; }; - 2C4D9DFF0CC9EF840031092D /* MacClasses.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = MacClasses.pas; path = Wrapper/MacClasses.pas; sourceTree = ""; }; 2C4D9E000CC9EF840031092D /* Graphics.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = Graphics.pas; path = Wrapper/Graphics.pas; sourceTree = ""; }; 2C4D9E010CC9EF840031092D /* JPEG.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = JPEG.pas; path = Wrapper/JPEG.pas; sourceTree = ""; }; - 2C4D9E020CC9EF840031092D /* MidiFile.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = MidiFile.pas; path = Wrapper/MidiFile.pas; sourceTree = ""; }; - 2C4D9E030CC9EF840031092D /* MidiOut.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = MidiOut.pas; path = Wrapper/MidiOut.pas; sourceTree = ""; }; 2C4D9E040CC9EF840031092D /* OpenGL12.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = OpenGL12.pas; path = Wrapper/OpenGL12.pas; sourceTree = ""; }; - 2C4D9E070CC9EF840031092D /* PNGImage.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = PNGImage.pas; path = Wrapper/PNGImage.pas; sourceTree = ""; }; 2C4D9E090CC9EF840031092D /* Windows.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = Windows.pas; path = Wrapper/Windows.pas; sourceTree = ""; }; - 2C4D9E0A0CC9EF840031092D /* zlportio.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = zlportio.pas; path = Wrapper/zlportio.pas; sourceTree = ""; }; 2C4D9E440CC9F0ED0031092D /* switches.inc */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = switches.inc; path = ../switches.inc; sourceTree = SOURCE_ROOT; }; 2CDEA4F60CBD725B0096994C /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; 2CDEC4CC0CC52E7F00FFA244 /* UltraStarDX.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = UltraStarDX.icns; sourceTree = ""; }; + 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenCredits.pas; path = ../Screens/UScreenCredits.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F440CDA1B2B00627463 /* UScreenEdit.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenEdit.pas; path = ../Screens/UScreenEdit.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F450CDA1B2B00627463 /* UScreenEditConvert.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenEditConvert.pas; path = ../Screens/UScreenEditConvert.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F460CDA1B2B00627463 /* UScreenEditHeader.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenEditHeader.pas; path = ../Screens/UScreenEditHeader.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F470CDA1B2B00627463 /* UScreenEditSub.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenEditSub.pas; path = ../Screens/UScreenEditSub.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F480CDA1B2B00627463 /* UScreenLevel.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenLevel.pas; path = ../Screens/UScreenLevel.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F490CDA1B2B00627463 /* UScreenLoading.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenLoading.pas; path = ../Screens/UScreenLoading.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F4A0CDA1B2B00627463 /* UScreenMain.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenMain.pas; path = ../Screens/UScreenMain.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F4B0CDA1B2B00627463 /* UScreenName.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenName.pas; path = ../Screens/UScreenName.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F4C0CDA1B2B00627463 /* UScreenOpen.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenOpen.pas; path = ../Screens/UScreenOpen.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F4D0CDA1B2B00627463 /* UScreenOptions.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenOptions.pas; path = ../Screens/UScreenOptions.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F4E0CDA1B2B00627463 /* UScreenOptionsAdvanced.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenOptionsAdvanced.pas; path = ../Screens/UScreenOptionsAdvanced.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F4F0CDA1B2B00627463 /* UScreenOptionsGame.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenOptionsGame.pas; path = ../Screens/UScreenOptionsGame.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F500CDA1B2B00627463 /* UScreenOptionsGraphics.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenOptionsGraphics.pas; path = ../Screens/UScreenOptionsGraphics.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F510CDA1B2B00627463 /* UScreenOptionsLyrics.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenOptionsLyrics.pas; path = ../Screens/UScreenOptionsLyrics.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F520CDA1B2B00627463 /* UScreenOptionsRecord.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenOptionsRecord.pas; path = ../Screens/UScreenOptionsRecord.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F530CDA1B2B00627463 /* UScreenOptionsSound.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenOptionsSound.pas; path = ../Screens/UScreenOptionsSound.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F540CDA1B2B00627463 /* UScreenOptionsThemes.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenOptionsThemes.pas; path = ../Screens/UScreenOptionsThemes.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F550CDA1B2B00627463 /* UScreenPartyNewRound.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenPartyNewRound.pas; path = ../Screens/UScreenPartyNewRound.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F560CDA1B2B00627463 /* UScreenPartyOptions.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenPartyOptions.pas; path = ../Screens/UScreenPartyOptions.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F570CDA1B2B00627463 /* UScreenPartyPlayer.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenPartyPlayer.pas; path = ../Screens/UScreenPartyPlayer.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F580CDA1B2B00627463 /* UScreenPartyScore.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenPartyScore.pas; path = ../Screens/UScreenPartyScore.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F590CDA1B2B00627463 /* UScreenPartyWin.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenPartyWin.pas; path = ../Screens/UScreenPartyWin.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F5A0CDA1B2B00627463 /* UScreenPopup.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenPopup.pas; path = ../Screens/UScreenPopup.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F5B0CDA1B2B00627463 /* UScreenScore.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenScore.pas; path = ../Screens/UScreenScore.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F5C0CDA1B2B00627463 /* UScreenSing.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenSing.pas; path = ../Screens/UScreenSing.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F5D0CDA1B2B00627463 /* UScreenSingModi.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenSingModi.pas; path = ../Screens/UScreenSingModi.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F5E0CDA1B2B00627463 /* UScreenSong.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenSong.pas; path = ../Screens/UScreenSong.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F5F0CDA1B2B00627463 /* UScreenSongJumpto.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenSongJumpto.pas; path = ../Screens/UScreenSongJumpto.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F600CDA1B2B00627463 /* UScreenSongMenu.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenSongMenu.pas; path = ../Screens/UScreenSongMenu.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F610CDA1B2B00627463 /* UScreenStatDetail.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenStatDetail.pas; path = ../Screens/UScreenStatDetail.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F620CDA1B2B00627463 /* UScreenStatMain.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenStatMain.pas; path = ../Screens/UScreenStatMain.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F630CDA1B2B00627463 /* UScreenTop5.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenTop5.pas; path = ../Screens/UScreenTop5.pas; sourceTree = SOURCE_ROOT; }; + 2CF54F640CDA1B2B00627463 /* UScreenWelcome.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenWelcome.pas; path = ../Screens/UScreenWelcome.pas; sourceTree = SOURCE_ROOT; }; + 2CF5508B0CDA22B000627463 /* ModiSDK.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = ModiSDK.pas; path = ../../../Modis/SDK/ModiSDK.pas; sourceTree = SOURCE_ROOT; }; + 2CF5510E0CDA293700627463 /* SQLite3.pas */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.pascal; name = SQLite3.pas; path = ../lib/SQLite/SQLite3.pas; sourceTree = SOURCE_ROOT; }; + 2CF5510F0CDA293700627463 /* SQLiteTable3.pas */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.pascal; name = SQLiteTable3.pas; path = ../lib/SQLite/SQLiteTable3.pas; sourceTree = SOURCE_ROOT; }; + 2CF5512C0CDA29C600627463 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = ../lib/SQLite/libsqlite3.dylib; sourceTree = SOURCE_ROOT; }; + 2CF551A70CDA356800627463 /* UltraStar.dpr */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; name = UltraStar.dpr; path = ../UltraStar.dpr; sourceTree = SOURCE_ROOT; }; + 2CF552110CDA3D1400627463 /* UPluginDefs.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UPluginDefs.pas; path = ../../../Modis/SDK/UPluginDefs.pas; sourceTree = SOURCE_ROOT; }; + 2CF552660CDA404000627463 /* Messages.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; path = Messages.pas; sourceTree = ""; }; + 2CF5529E0CDA42C900627463 /* avcodec.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = avcodec.pas; path = ../lib/ffmpeg/avcodec.pas; sourceTree = SOURCE_ROOT; }; + 2CF5529F0CDA42C900627463 /* avformat.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = avformat.pas; path = ../lib/ffmpeg/avformat.pas; sourceTree = SOURCE_ROOT; }; + 2CF552A00CDA42C900627463 /* avio.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = avio.pas; path = ../lib/ffmpeg/avio.pas; sourceTree = SOURCE_ROOT; }; + 2CF552A10CDA42C900627463 /* avutil.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = avutil.pas; path = ../lib/ffmpeg/avutil.pas; sourceTree = SOURCE_ROOT; }; + 2CF552A40CDA42C900627463 /* opt.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = opt.pas; path = ../lib/ffmpeg/opt.pas; sourceTree = SOURCE_ROOT; }; + 2CF552A50CDA42C900627463 /* rational.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = rational.pas; path = ../lib/ffmpeg/rational.pas; sourceTree = SOURCE_ROOT; }; + 2CF552BF0CDA4B7B00627463 /* libavcodec.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libavcodec.dylib; path = ../lib/ffmpeg/libavcodec.dylib; sourceTree = SOURCE_ROOT; }; + 2CF552C00CDA4B7B00627463 /* libavformat.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libavformat.dylib; path = ../lib/ffmpeg/libavformat.dylib; sourceTree = SOURCE_ROOT; }; + 2CF552C10CDA4B7B00627463 /* libavutil.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libavutil.dylib; path = ../lib/ffmpeg/libavutil.dylib; sourceTree = SOURCE_ROOT; }; + 2CF552C20CDA4B7B00627463 /* libmp3lame.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libmp3lame.dylib; path = ../lib/ffmpeg/libmp3lame.dylib; sourceTree = SOURCE_ROOT; }; + 2CF553070CDA51B500627463 /* sdlutils.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = sdlutils.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL/sdlutils.pas"; sourceTree = ""; }; 9845B6590B1F9B9E0084DD62 /* SDL.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL.h; path = /Library/Frameworks/SDL.framework/Versions/A/Headers/SDL.h; sourceTree = ""; }; 98B8BE330B1F947800162019 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 98B8BE370B1F949C00162019 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; @@ -341,7 +487,7 @@ DD37F2430A60255800975B2D /* libfpcrtl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libfpcrtl.a; sourceTree = BUILT_PRODUCTS_DIR; }; DDC6851B09F57195004E4BFF /* UltraStarDX.pas */ = {isa = PBXFileReference; fileEncoding = 12; lastKnownFileType = sourcecode.pascal; path = UltraStarDX.pas; sourceTree = ""; }; DDC6868B09F571C2004E4BFF /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 12; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; - DDC688C809F574E9004E4BFF /* UltraStar Deluxe.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "UltraStar Deluxe.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + DDC688C809F574E9004E4BFF /* UltraStarDX.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UltraStarDX.app; sourceTree = BUILT_PRODUCTS_DIR; }; DDC688CA09F574E9004E4BFF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; DDC689B309F57C69004E4BFF /* InfoPlist.strings */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = InfoPlist.strings; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; DDC689B409F57C69004E4BFF /* SDLMain.nib */ = {isa = PBXFileReference; explicitFileType = wrapper.nib; name = SDLMain.nib; path = English.lproj/SDLMain.nib; sourceTree = ""; }; @@ -362,6 +508,11 @@ 2C4D9D970CC9EDEB0031092D /* libfreeimage.dylib in Frameworks */, 2C4D9D9A0CC9EE0B0031092D /* SDL_image.framework in Frameworks */, 2C4D9D9B0CC9EE0B0031092D /* SDL_ttf.framework in Frameworks */, + 2CF5512D0CDA29C600627463 /* libsqlite3.dylib in Frameworks */, + 2CF552C30CDA4B7B00627463 /* libavcodec.dylib in Frameworks */, + 2CF552C40CDA4B7B00627463 /* libavformat.dylib in Frameworks */, + 2CF552C50CDA4B7B00627463 /* libavutil.dylib in Frameworks */, + 2CF552C60CDA4B7B00627463 /* libmp3lame.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -371,6 +522,7 @@ 2C4D9DEB0CC9EECC0031092D /* SDL */ = { isa = PBXGroup; children = ( + 2CF553070CDA51B500627463 /* sdlutils.pas */, 2C4D9DEF0CC9EF210031092D /* sdl_ttf.pas */, 2C4D9DF00CC9EF210031092D /* sdltruetypefont.pas */, 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */, @@ -384,15 +536,11 @@ 2C4D9DF50CC9EF3A0031092D /* Wrapper */ = { isa = PBXGroup; children = ( - 2C4D9DFF0CC9EF840031092D /* MacClasses.pas */, 2C4D9E000CC9EF840031092D /* Graphics.pas */, 2C4D9E010CC9EF840031092D /* JPEG.pas */, - 2C4D9E020CC9EF840031092D /* MidiFile.pas */, - 2C4D9E030CC9EF840031092D /* MidiOut.pas */, 2C4D9E040CC9EF840031092D /* OpenGL12.pas */, - 2C4D9E070CC9EF840031092D /* PNGImage.pas */, 2C4D9E090CC9EF840031092D /* Windows.pas */, - 2C4D9E0A0CC9EF840031092D /* zlportio.pas */, + 2CF552660CDA404000627463 /* Messages.pas */, ); name = Wrapper; sourceTree = ""; @@ -419,7 +567,6 @@ 2C4D9C720CC9EC8C0031092D /* UIni.pas */, 2C4D9C730CC9EC8C0031092D /* UJoystick.pas */, 2C4D9C740CC9EC8C0031092D /* ULanguage.pas */, - 2C4D9C750CC9EC8C0031092D /* Ulazjpeg.pas */, 2C4D9C760CC9EC8C0031092D /* ULCD.pas */, 2C4D9C770CC9EC8C0031092D /* ULight.pas */, 2C4D9C780CC9EC8C0031092D /* ULog.pas */, @@ -431,7 +578,6 @@ 2C4D9C7E0CC9EC8C0031092D /* UMusic.pas */, 2C4D9C7F0CC9EC8C0031092D /* UParty.pas */, 2C4D9C800CC9EC8C0031092D /* UPlaylist.pas */, - 2C4D9C810CC9EC8C0031092D /* UPliki.pas */, 2C4D9C820CC9EC8C0031092D /* UPluginInterface.pas */, 2C4D9C830CC9EC8C0031092D /* uPluginLoader.pas */, 2C4D9C840CC9EC8C0031092D /* URecord.pas */, @@ -490,16 +636,101 @@ name = BASS; sourceTree = ""; }; + 2CF54F420CDA1B0C00627463 /* Screens */ = { + isa = PBXGroup; + children = ( + 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */, + 2CF54F440CDA1B2B00627463 /* UScreenEdit.pas */, + 2CF54F450CDA1B2B00627463 /* UScreenEditConvert.pas */, + 2CF54F460CDA1B2B00627463 /* UScreenEditHeader.pas */, + 2CF54F470CDA1B2B00627463 /* UScreenEditSub.pas */, + 2CF54F480CDA1B2B00627463 /* UScreenLevel.pas */, + 2CF54F490CDA1B2B00627463 /* UScreenLoading.pas */, + 2CF54F4A0CDA1B2B00627463 /* UScreenMain.pas */, + 2CF54F4B0CDA1B2B00627463 /* UScreenName.pas */, + 2CF54F4C0CDA1B2B00627463 /* UScreenOpen.pas */, + 2CF54F4D0CDA1B2B00627463 /* UScreenOptions.pas */, + 2CF54F4E0CDA1B2B00627463 /* UScreenOptionsAdvanced.pas */, + 2CF54F4F0CDA1B2B00627463 /* UScreenOptionsGame.pas */, + 2CF54F500CDA1B2B00627463 /* UScreenOptionsGraphics.pas */, + 2CF54F510CDA1B2B00627463 /* UScreenOptionsLyrics.pas */, + 2CF54F520CDA1B2B00627463 /* UScreenOptionsRecord.pas */, + 2CF54F530CDA1B2B00627463 /* UScreenOptionsSound.pas */, + 2CF54F540CDA1B2B00627463 /* UScreenOptionsThemes.pas */, + 2CF54F550CDA1B2B00627463 /* UScreenPartyNewRound.pas */, + 2CF54F560CDA1B2B00627463 /* UScreenPartyOptions.pas */, + 2CF54F570CDA1B2B00627463 /* UScreenPartyPlayer.pas */, + 2CF54F580CDA1B2B00627463 /* UScreenPartyScore.pas */, + 2CF54F590CDA1B2B00627463 /* UScreenPartyWin.pas */, + 2CF54F5A0CDA1B2B00627463 /* UScreenPopup.pas */, + 2CF54F5B0CDA1B2B00627463 /* UScreenScore.pas */, + 2CF54F5C0CDA1B2B00627463 /* UScreenSing.pas */, + 2CF54F5D0CDA1B2B00627463 /* UScreenSingModi.pas */, + 2CF54F5E0CDA1B2B00627463 /* UScreenSong.pas */, + 2CF54F5F0CDA1B2B00627463 /* UScreenSongJumpto.pas */, + 2CF54F600CDA1B2B00627463 /* UScreenSongMenu.pas */, + 2CF54F610CDA1B2B00627463 /* UScreenStatDetail.pas */, + 2CF54F620CDA1B2B00627463 /* UScreenStatMain.pas */, + 2CF54F630CDA1B2B00627463 /* UScreenTop5.pas */, + 2CF54F640CDA1B2B00627463 /* UScreenWelcome.pas */, + ); + name = Screens; + sourceTree = ""; + }; + 2CF5508A0CDA228800627463 /* SDK */ = { + isa = PBXGroup; + children = ( + 2CF552110CDA3D1400627463 /* UPluginDefs.pas */, + 2CF5508B0CDA22B000627463 /* ModiSDK.pas */, + ); + name = SDK; + sourceTree = ""; + }; + 2CF5510C0CDA28F000627463 /* Lib */ = { + isa = PBXGroup; + children = ( + 2CE8C7CE0CBAA47D00E4D835 /* BASS */, + 2CF5529C0CDA428000627463 /* ffmpeg */, + 2CE1F4080CC3EEA400CD02E5 /* FreeImage */, + 2C4D9DEB0CC9EECC0031092D /* SDL */, + 2CF5510D0CDA291200627463 /* SQLite */, + ); + name = Lib; + sourceTree = ""; + }; + 2CF5510D0CDA291200627463 /* SQLite */ = { + isa = PBXGroup; + children = ( + 2CF5510E0CDA293700627463 /* SQLite3.pas */, + 2CF5510F0CDA293700627463 /* SQLiteTable3.pas */, + ); + name = SQLite; + sourceTree = ""; + }; + 2CF5529C0CDA428000627463 /* ffmpeg */ = { + isa = PBXGroup; + children = ( + 2CF5529E0CDA42C900627463 /* avcodec.pas */, + 2CF5529F0CDA42C900627463 /* avformat.pas */, + 2CF552A00CDA42C900627463 /* avio.pas */, + 2CF552A10CDA42C900627463 /* avutil.pas */, + 2CF552A40CDA42C900627463 /* opt.pas */, + 2CF552A50CDA42C900627463 /* rational.pas */, + ); + name = ffmpeg; + sourceTree = ""; + }; DD7C45450A6E72DE003FA52B /* Source */ = { isa = PBXGroup; children = ( + 2CF5510C0CDA28F000627463 /* Lib */, 2CDD43820CBBE8D400F364DE /* Classes */, + 2CF54F420CDA1B0C00627463 /* Screens */, 2CDD438D0CBBE8F700F364DE /* Menu */, - 2CE1F4080CC3EEA400CD02E5 /* FreeImage */, - 2CE8C7CE0CBAA47D00E4D835 /* BASS */, - 2C4D9DEB0CC9EECC0031092D /* SDL */, + 2CF5508A0CDA228800627463 /* SDK */, 2C4D9DF50CC9EF3A0031092D /* Wrapper */, DDC6851B09F57195004E4BFF /* UltraStarDX.pas */, + 2CF551A70CDA356800627463 /* UltraStar.dpr */, 2C4D9E440CC9F0ED0031092D /* switches.inc */, ); name = Source; @@ -517,6 +748,11 @@ 98B8BE330B1F947800162019 /* AppKit.framework */, 2C4D9CE90CC9ECB50031092D /* libbass.dylib */, 2C4D9D960CC9EDEB0031092D /* libfreeimage.dylib */, + 2CF5512C0CDA29C600627463 /* libsqlite3.dylib */, + 2CF552BF0CDA4B7B00627463 /* libavcodec.dylib */, + 2CF552C00CDA4B7B00627463 /* libavformat.dylib */, + 2CF552C10CDA4B7B00627463 /* libavutil.dylib */, + 2CF552C20CDA4B7B00627463 /* libmp3lame.dylib */, DD7C45450A6E72DE003FA52B /* Source */, DDC6868A09F571C2004E4BFF /* Resources */, 2CDD8D0B0CC5539900E4169D /* UltraStarDX Resources */, @@ -540,7 +776,7 @@ DDC6888C09F57243004E4BFF /* Products */ = { isa = PBXGroup; children = ( - DDC688C809F574E9004E4BFF /* UltraStar Deluxe.app */, + DDC688C809F574E9004E4BFF /* UltraStarDX.app */, DD37F2430A60255800975B2D /* libfpcrtl.a */, ); name = Products; @@ -588,7 +824,7 @@ ); name = UltraStarDX; productName = "JEDI-SDLCocoa"; - productReference = DDC688C809F574E9004E4BFF /* UltraStar Deluxe.app */; + productReference = DDC688C809F574E9004E4BFF /* UltraStarDX.app */; productType = "com.apple.product-type.application"; }; DDC688D409F57523004E4BFF /* Put all program sources also in this target */ = { @@ -662,7 +898,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\nUS_RESOURCES_SOURCE_DIR=UltraStarResources\nUS_RESOURCES_DEST_DIR=\"$CONFIGURATION_BUILD_DIR\"/\"$PRODUCT_NAME\".app/Contents\n\ncp -Rf $US_RESOURCES_SOURCE_DIR $US_RESOURCES_DEST_DIR"; + shellScript = "\nUS_RESOURCES_SOURCE_DIR=UltraStarResources\nUS_RESOURCES_DEST_DIR=\"$CONFIGURATION_BUILD_DIR\"/\"$PRODUCT_NAME\".app/Contents\n\n#cp -Rf $US_RESOURCES_SOURCE_DIR $US_RESOURCES_DEST_DIR"; }; DD37F2350A60250900975B2D /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -736,7 +972,6 @@ 2C4D9C9F0CC9EC8C0031092D /* UIni.pas in Sources */, 2C4D9CA00CC9EC8C0031092D /* UJoystick.pas in Sources */, 2C4D9CA10CC9EC8C0031092D /* ULanguage.pas in Sources */, - 2C4D9CA20CC9EC8C0031092D /* Ulazjpeg.pas in Sources */, 2C4D9CA30CC9EC8C0031092D /* ULCD.pas in Sources */, 2C4D9CA40CC9EC8C0031092D /* ULight.pas in Sources */, 2C4D9CA50CC9EC8C0031092D /* ULog.pas in Sources */, @@ -748,7 +983,6 @@ 2C4D9CAB0CC9EC8C0031092D /* UMusic.pas in Sources */, 2C4D9CAC0CC9EC8C0031092D /* UParty.pas in Sources */, 2C4D9CAD0CC9EC8C0031092D /* UPlaylist.pas in Sources */, - 2C4D9CAE0CC9EC8C0031092D /* UPliki.pas in Sources */, 2C4D9CAF0CC9EC8C0031092D /* UPluginInterface.pas in Sources */, 2C4D9CB00CC9EC8C0031092D /* uPluginLoader.pas in Sources */, 2C4D9CB10CC9EC8C0031092D /* URecord.pas in Sources */, @@ -778,16 +1012,57 @@ 2C4D9DED0CC9EF0A0031092D /* sdl_image.pas in Sources */, 2C4D9DF10CC9EF210031092D /* sdl_ttf.pas in Sources */, 2C4D9DF20CC9EF210031092D /* sdltruetypefont.pas in Sources */, - 2C4D9E0B0CC9EF840031092D /* MacClasses.pas in Sources */, 2C4D9E0C0CC9EF840031092D /* Graphics.pas in Sources */, 2C4D9E0D0CC9EF840031092D /* JPEG.pas in Sources */, - 2C4D9E0E0CC9EF840031092D /* MidiFile.pas in Sources */, - 2C4D9E0F0CC9EF840031092D /* MidiOut.pas in Sources */, 2C4D9E100CC9EF840031092D /* OpenGL12.pas in Sources */, - 2C4D9E130CC9EF840031092D /* PNGImage.pas in Sources */, 2C4D9E150CC9EF840031092D /* Windows.pas in Sources */, - 2C4D9E160CC9EF840031092D /* zlportio.pas in Sources */, 2C4D9E450CC9F0ED0031092D /* switches.inc in Sources */, + 2CF54F650CDA1B2B00627463 /* UScreenCredits.pas in Sources */, + 2CF54F660CDA1B2B00627463 /* UScreenEdit.pas in Sources */, + 2CF54F670CDA1B2B00627463 /* UScreenEditConvert.pas in Sources */, + 2CF54F680CDA1B2B00627463 /* UScreenEditHeader.pas in Sources */, + 2CF54F690CDA1B2B00627463 /* UScreenEditSub.pas in Sources */, + 2CF54F6A0CDA1B2B00627463 /* UScreenLevel.pas in Sources */, + 2CF54F6B0CDA1B2B00627463 /* UScreenLoading.pas in Sources */, + 2CF54F6C0CDA1B2B00627463 /* UScreenMain.pas in Sources */, + 2CF54F6D0CDA1B2B00627463 /* UScreenName.pas in Sources */, + 2CF54F6E0CDA1B2B00627463 /* UScreenOpen.pas in Sources */, + 2CF54F6F0CDA1B2B00627463 /* UScreenOptions.pas in Sources */, + 2CF54F700CDA1B2B00627463 /* UScreenOptionsAdvanced.pas in Sources */, + 2CF54F710CDA1B2B00627463 /* UScreenOptionsGame.pas in Sources */, + 2CF54F720CDA1B2B00627463 /* UScreenOptionsGraphics.pas in Sources */, + 2CF54F730CDA1B2B00627463 /* UScreenOptionsLyrics.pas in Sources */, + 2CF54F740CDA1B2B00627463 /* UScreenOptionsRecord.pas in Sources */, + 2CF54F750CDA1B2B00627463 /* UScreenOptionsSound.pas in Sources */, + 2CF54F760CDA1B2B00627463 /* UScreenOptionsThemes.pas in Sources */, + 2CF54F770CDA1B2B00627463 /* UScreenPartyNewRound.pas in Sources */, + 2CF54F780CDA1B2B00627463 /* UScreenPartyOptions.pas in Sources */, + 2CF54F790CDA1B2B00627463 /* UScreenPartyPlayer.pas in Sources */, + 2CF54F7A0CDA1B2B00627463 /* UScreenPartyScore.pas in Sources */, + 2CF54F7B0CDA1B2B00627463 /* UScreenPartyWin.pas in Sources */, + 2CF54F7C0CDA1B2B00627463 /* UScreenPopup.pas in Sources */, + 2CF54F7D0CDA1B2B00627463 /* UScreenScore.pas in Sources */, + 2CF54F7E0CDA1B2B00627463 /* UScreenSing.pas in Sources */, + 2CF54F7F0CDA1B2B00627463 /* UScreenSingModi.pas in Sources */, + 2CF54F800CDA1B2B00627463 /* UScreenSong.pas in Sources */, + 2CF54F810CDA1B2B00627463 /* UScreenSongJumpto.pas in Sources */, + 2CF54F820CDA1B2B00627463 /* UScreenSongMenu.pas in Sources */, + 2CF54F830CDA1B2B00627463 /* UScreenStatDetail.pas in Sources */, + 2CF54F840CDA1B2B00627463 /* UScreenStatMain.pas in Sources */, + 2CF54F850CDA1B2B00627463 /* UScreenTop5.pas in Sources */, + 2CF54F860CDA1B2B00627463 /* UScreenWelcome.pas in Sources */, + 2CF5508C0CDA22B000627463 /* ModiSDK.pas in Sources */, + 2CF551100CDA293700627463 /* SQLite3.pas in Sources */, + 2CF551110CDA293700627463 /* SQLiteTable3.pas in Sources */, + 2CF552140CDA3D1400627463 /* UPluginDefs.pas in Sources */, + 2CF552680CDA404000627463 /* Messages.pas in Sources */, + 2CF552B00CDA42C900627463 /* avcodec.pas in Sources */, + 2CF552B10CDA42C900627463 /* avformat.pas in Sources */, + 2CF552B20CDA42C900627463 /* avio.pas in Sources */, + 2CF552B30CDA42C900627463 /* avutil.pas in Sources */, + 2CF552B60CDA42C900627463 /* opt.pas in Sources */, + 2CF552B70CDA42C900627463 /* rational.pas in Sources */, + 2CF553080CDA51B500627463 /* sdlutils.pas in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -816,7 +1091,6 @@ 2C4D9CCC0CC9EC8C0031092D /* UIni.pas in Sources */, 2C4D9CCD0CC9EC8C0031092D /* UJoystick.pas in Sources */, 2C4D9CCE0CC9EC8C0031092D /* ULanguage.pas in Sources */, - 2C4D9CCF0CC9EC8C0031092D /* Ulazjpeg.pas in Sources */, 2C4D9CD00CC9EC8C0031092D /* ULCD.pas in Sources */, 2C4D9CD10CC9EC8C0031092D /* ULight.pas in Sources */, 2C4D9CD20CC9EC8C0031092D /* ULog.pas in Sources */, @@ -828,7 +1102,6 @@ 2C4D9CD80CC9EC8C0031092D /* UMusic.pas in Sources */, 2C4D9CD90CC9EC8C0031092D /* UParty.pas in Sources */, 2C4D9CDA0CC9EC8C0031092D /* UPlaylist.pas in Sources */, - 2C4D9CDB0CC9EC8C0031092D /* UPliki.pas in Sources */, 2C4D9CDC0CC9EC8C0031092D /* UPluginInterface.pas in Sources */, 2C4D9CDD0CC9EC8C0031092D /* uPluginLoader.pas in Sources */, 2C4D9CDE0CC9EC8C0031092D /* URecord.pas in Sources */, @@ -858,16 +1131,57 @@ 2C4D9DEE0CC9EF0A0031092D /* sdl_image.pas in Sources */, 2C4D9DF30CC9EF210031092D /* sdl_ttf.pas in Sources */, 2C4D9DF40CC9EF210031092D /* sdltruetypefont.pas in Sources */, - 2C4D9E170CC9EF840031092D /* MacClasses.pas in Sources */, 2C4D9E180CC9EF840031092D /* Graphics.pas in Sources */, 2C4D9E190CC9EF840031092D /* JPEG.pas in Sources */, - 2C4D9E1A0CC9EF840031092D /* MidiFile.pas in Sources */, - 2C4D9E1B0CC9EF840031092D /* MidiOut.pas in Sources */, 2C4D9E1C0CC9EF840031092D /* OpenGL12.pas in Sources */, - 2C4D9E1F0CC9EF840031092D /* PNGImage.pas in Sources */, 2C4D9E210CC9EF840031092D /* Windows.pas in Sources */, - 2C4D9E220CC9EF840031092D /* zlportio.pas in Sources */, 2C4D9E460CC9F0ED0031092D /* switches.inc in Sources */, + 2CF54F870CDA1B2B00627463 /* UScreenCredits.pas in Sources */, + 2CF54F880CDA1B2B00627463 /* UScreenEdit.pas in Sources */, + 2CF54F890CDA1B2B00627463 /* UScreenEditConvert.pas in Sources */, + 2CF54F8A0CDA1B2B00627463 /* UScreenEditHeader.pas in Sources */, + 2CF54F8B0CDA1B2B00627463 /* UScreenEditSub.pas in Sources */, + 2CF54F8C0CDA1B2B00627463 /* UScreenLevel.pas in Sources */, + 2CF54F8D0CDA1B2B00627463 /* UScreenLoading.pas in Sources */, + 2CF54F8E0CDA1B2B00627463 /* UScreenMain.pas in Sources */, + 2CF54F8F0CDA1B2B00627463 /* UScreenName.pas in Sources */, + 2CF54F900CDA1B2B00627463 /* UScreenOpen.pas in Sources */, + 2CF54F910CDA1B2B00627463 /* UScreenOptions.pas in Sources */, + 2CF54F920CDA1B2B00627463 /* UScreenOptionsAdvanced.pas in Sources */, + 2CF54F930CDA1B2B00627463 /* UScreenOptionsGame.pas in Sources */, + 2CF54F940CDA1B2B00627463 /* UScreenOptionsGraphics.pas in Sources */, + 2CF54F950CDA1B2B00627463 /* UScreenOptionsLyrics.pas in Sources */, + 2CF54F960CDA1B2B00627463 /* UScreenOptionsRecord.pas in Sources */, + 2CF54F970CDA1B2B00627463 /* UScreenOptionsSound.pas in Sources */, + 2CF54F980CDA1B2B00627463 /* UScreenOptionsThemes.pas in Sources */, + 2CF54F990CDA1B2B00627463 /* UScreenPartyNewRound.pas in Sources */, + 2CF54F9A0CDA1B2B00627463 /* UScreenPartyOptions.pas in Sources */, + 2CF54F9B0CDA1B2B00627463 /* UScreenPartyPlayer.pas in Sources */, + 2CF54F9C0CDA1B2B00627463 /* UScreenPartyScore.pas in Sources */, + 2CF54F9D0CDA1B2B00627463 /* UScreenPartyWin.pas in Sources */, + 2CF54F9E0CDA1B2B00627463 /* UScreenPopup.pas in Sources */, + 2CF54F9F0CDA1B2B00627463 /* UScreenScore.pas in Sources */, + 2CF54FA00CDA1B2B00627463 /* UScreenSing.pas in Sources */, + 2CF54FA10CDA1B2B00627463 /* UScreenSingModi.pas in Sources */, + 2CF54FA20CDA1B2B00627463 /* UScreenSong.pas in Sources */, + 2CF54FA30CDA1B2B00627463 /* UScreenSongJumpto.pas in Sources */, + 2CF54FA40CDA1B2B00627463 /* UScreenSongMenu.pas in Sources */, + 2CF54FA50CDA1B2B00627463 /* UScreenStatDetail.pas in Sources */, + 2CF54FA60CDA1B2B00627463 /* UScreenStatMain.pas in Sources */, + 2CF54FA70CDA1B2B00627463 /* UScreenTop5.pas in Sources */, + 2CF54FA80CDA1B2B00627463 /* UScreenWelcome.pas in Sources */, + 2CF5508D0CDA22B000627463 /* ModiSDK.pas in Sources */, + 2CF551120CDA293700627463 /* SQLite3.pas in Sources */, + 2CF551130CDA293700627463 /* SQLiteTable3.pas in Sources */, + 2CF552170CDA3D1400627463 /* UPluginDefs.pas in Sources */, + 2CF552670CDA404000627463 /* Messages.pas in Sources */, + 2CF552A70CDA42C900627463 /* avcodec.pas in Sources */, + 2CF552A80CDA42C900627463 /* avformat.pas in Sources */, + 2CF552A90CDA42C900627463 /* avio.pas in Sources */, + 2CF552AA0CDA42C900627463 /* avutil.pas in Sources */, + 2CF552AD0CDA42C900627463 /* opt.pas in Sources */, + 2CF552AE0CDA42C900627463 /* rational.pas in Sources */, + 2CF553090CDA51B500627463 /* sdlutils.pas in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -972,11 +1286,12 @@ "$(LIBRARY_SEARCH_PATHS_QUOTED_4)", "$(LIBRARY_SEARCH_PATHS_QUOTED_5)", "$(LIBRARY_SEARCH_PATHS_QUOTED_6)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_2)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_3)", ); LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/build/Debug\""; - LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)/Bass\""; - LIBRARY_SEARCH_PATHS_QUOTED_3 = "\"$(SRCROOT)/FreeImage\""; - LIBRARY_SEARCH_PATHS_QUOTED_4 = "\"$(SRCROOT)/FreeImage\""; + LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)/../lib/SQLite\""; + LIBRARY_SEARCH_PATHS_QUOTED_3 = "\"$(SRCROOT)/../lib/ffmpeg\""; LIBRARY_SEARCH_PATHS_QUOTED_5 = "\"$(SRCROOT)/../lib/bass\""; LIBRARY_SEARCH_PATHS_QUOTED_6 = "\"$(SRCROOT)/../lib/FreeImage\""; LINK_WITH_STANDARD_LIBRARIES = YES; @@ -985,7 +1300,7 @@ Carbon, ); PREBINDING = NO; - PRODUCT_NAME = UltraStar; + PRODUCT_NAME = UltraStarDX; WRAPPER_EXTENSION = app; ZERO_LINK = NO; }; @@ -1015,6 +1330,8 @@ "$(LIBRARY_SEARCH_PATHS_QUOTED_4)", "$(LIBRARY_SEARCH_PATHS_QUOTED_5)", "$(LIBRARY_SEARCH_PATHS_QUOTED_6)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_7)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_8)", ); LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/build/Debug\""; LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)/Bass\""; @@ -1022,6 +1339,8 @@ LIBRARY_SEARCH_PATHS_QUOTED_4 = "\"$(SRCROOT)/FreeImage\""; LIBRARY_SEARCH_PATHS_QUOTED_5 = "\"$(SRCROOT)/../lib/bass\""; LIBRARY_SEARCH_PATHS_QUOTED_6 = "\"$(SRCROOT)/../lib/FreeImage\""; + LIBRARY_SEARCH_PATHS_QUOTED_7 = "\"$(SRCROOT)/../lib/SQLite\""; + LIBRARY_SEARCH_PATHS_QUOTED_8 = "\"$(SRCROOT)/../lib/ffmpeg\""; LINK_WITH_STANDARD_LIBRARIES = YES; OTHER_LDFLAGS = ( "-framework", diff --git a/Game/Code/MacOSX/Wrapper/Graphics.pas b/Game/Code/MacOSX/Wrapper/Graphics.pas index 5982bb77..11484e21 100755 --- a/Game/Code/MacOSX/Wrapper/Graphics.pas +++ b/Game/Code/MacOSX/Wrapper/Graphics.pas @@ -1,6 +1,6 @@ unit Graphics; -{$INCLUDE ../Platform.inc} +{$I switches.inc} interface diff --git a/Game/Code/MacOSX/Wrapper/JPEG.pas b/Game/Code/MacOSX/Wrapper/JPEG.pas index b6a90f00..7419908b 100755 --- a/Game/Code/MacOSX/Wrapper/JPEG.pas +++ b/Game/Code/MacOSX/Wrapper/JPEG.pas @@ -1,10 +1,10 @@ unit JPEG; -{$INCLUDE ../Platform.inc} +{$I switches.inc} interface -uses GlueGraphics; +uses Graphics; type TJPEGImage = class(TBitmap) diff --git a/Game/Code/MacOSX/Wrapper/MacClasses.pas b/Game/Code/MacOSX/Wrapper/MacClasses.pas index c494e6df..be41ac55 100755 --- a/Game/Code/MacOSX/Wrapper/MacClasses.pas +++ b/Game/Code/MacOSX/Wrapper/MacClasses.pas @@ -1,6 +1,6 @@ unit MacClasses; -{$INCLUDE ../Platform.inc} +{$I switches.inc} interface diff --git a/Game/Code/MacOSX/Wrapper/Messages.pas b/Game/Code/MacOSX/Wrapper/Messages.pas new file mode 100644 index 00000000..e1c8e6aa --- /dev/null +++ b/Game/Code/MacOSX/Wrapper/Messages.pas @@ -0,0 +1,30 @@ +unit Messages; + +{$I switches.inc} + +interface + +uses Windows; + +type + + TMessage = packed record + Msg: Cardinal; + case Integer of + 0: ( + WParam: Longint; + LParam: Longint; + Result: Longint); + 1: ( + WParamLo: Word; + WParamHi: Word; + LParamLo: Word; + LParamHi: Word; + ResultLo: Word; + ResultHi: Word); + end; + PMessage = ^TMessage; + +implementation + +end. \ No newline at end of file diff --git a/Game/Code/MacOSX/Wrapper/MidiFile.pas b/Game/Code/MacOSX/Wrapper/MidiFile.pas index 9ae684f4..c91711cc 100755 --- a/Game/Code/MacOSX/Wrapper/MidiFile.pas +++ b/Game/Code/MacOSX/Wrapper/MidiFile.pas @@ -1,6 +1,6 @@ unit MidiFile; -{$INCLUDE ../Platform.inc} +{$I switches.inc} interface diff --git a/Game/Code/MacOSX/Wrapper/MidiOut.pas b/Game/Code/MacOSX/Wrapper/MidiOut.pas index 249cb88b..e57da9d0 100755 --- a/Game/Code/MacOSX/Wrapper/MidiOut.pas +++ b/Game/Code/MacOSX/Wrapper/MidiOut.pas @@ -1,6 +1,6 @@ unit MidiOut; -{$INCLUDE ../Platform.inc} +{$I switches.inc} interface diff --git a/Game/Code/MacOSX/Wrapper/OpenGL12.pas b/Game/Code/MacOSX/Wrapper/OpenGL12.pas index ff704b33..0efff14e 100755 --- a/Game/Code/MacOSX/Wrapper/OpenGL12.pas +++ b/Game/Code/MacOSX/Wrapper/OpenGL12.pas @@ -1,4696 +1,4701 @@ -unit OpenGL12; - -{$INCLUDE ../Platform.inc} - -interface - -uses Windows; - -const -{$IFDEF MSWINDOWS} - glu32 = 'glu32.dll'; -{$ENDIF} -{$IFDEF MACOS} - glu32 = 'OpenGL'; -{$ENDIF} - -type - - TRCOptions = set of ( - opDoubleBuffered, - opGDI, - opStereo - ); - - UINT = Cardinal; - - {$EXTERNALSYM GLenum} - GLenum = UINT; - TGLenum = UINT; - PGLenum = ^TGLenum; - - {$EXTERNALSYM GLboolean} - GLboolean = BYTEBOOL; - TGLboolean = BYTEBOOL; - PGLboolean = ^TGLboolean; - - {$EXTERNALSYM GLbitfield} - GLbitfield = UINT; - TGLbitfield = UINT; - PGLbitfield = ^TGLbitfield; - - {$EXTERNALSYM GLbyte} - GLbyte = ShortInt; - TGLbyte = ShortInt; - PGLbyte = ^TGLbyte; - - {$EXTERNALSYM GLshort} - GLshort = SmallInt; - TGLshort = SmallInt; - PGLshort = ^TGLshort; - - {$EXTERNALSYM GLint} - GLint = Integer; - TGLint = Integer; - PGLint = ^TGLint; - - {$EXTERNALSYM GLsizei} - GLsizei = Integer; - TGLsizei = Integer; - PGLsizei = ^TGLsizei; - - {$EXTERNALSYM GLubyte} - UCHAR = Byte; - GLubyte = UCHAR; - TGLubyte = UCHAR; - PGLubyte = ^TGLubyte; - - {$EXTERNALSYM GLushort} - GLushort = Word; - TGLushort = Word; - PGLushort = ^TGLushort; - - {$EXTERNALSYM GLuint} - GLuint = UINT; - TGLuint = UINT; - PGLuint = ^TGLuint; - - {$EXTERNALSYM GLfloat} - GLfloat = Single; - TGLfloat = Single; - PGLfloat = ^TGLfloat; - - {$EXTERNALSYM GLclampf} - GLclampf = Single; - TGLclampf = Single; - PGLclampf = ^TGLclampf; - - {$EXTERNALSYM GLdouble} - GLdouble = Double; - TGLdouble = Double; - PGLdouble = ^TGLdouble; - - {$EXTERNALSYM GLclampd} - GLclampd = Double; - TGLclampd = Double; - PGLclampd = ^TGLclampd; - - TVector3d = array[0..2] of GLdouble; - - TVector4i = array[0..3] of GLint; - TVector4f = array[0..3] of GLfloat; - TVector4p = array[0..3] of Pointer; - - TMatrix4f = array[0..3, 0..3] of GLfloat; - TMatrix4d = array[0..3, 0..3] of GLdouble; - - PPointer = ^Pointer; - -{$ifdef FPC} - var -{$else} - {$ifdef MULTITHREADOPENGL} - threadvar - {$else} - var - {$endif} -{$endif} - - GL_VERSION_1_0, - GL_VERSION_1_1, - GL_VERSION_1_2, - GLU_VERSION_1_1, - GLU_VERSION_1_2, - GLU_VERSION_1_3: Boolean; - - // Extensions (gl) - GL_3DFX_multisample, - GL_3DFX_tbuffer, - GL_3DFX_texture_compression_FXT1, - - GL_APPLE_specular_vector, - GL_APPLE_transform_hint, - - GL_ARB_imaging, - GL_ARB_multisample, - GL_ARB_multitexture, - GL_ARB_texture_compression, - GL_ARB_texture_cube_map, - GL_ARB_transpose_matrix, - GL_ARB_vertex_blend, - - GL_EXT_422_pixels, - GL_EXT_abgr, - GL_EXT_bgra, - GL_EXT_blend_color, - GL_EXT_blend_func_separate, - GL_EXT_blend_logic_op, - GL_EXT_blend_minmax, - GL_EXT_blend_subtract, - GL_EXT_clip_volume_hint, - GL_EXT_cmyka, - GL_EXT_color_subtable, - GL_EXT_compiled_vertex_array, - GL_EXT_convolution, - GL_EXT_coordinate_frame, - GL_EXT_copy_texture, - GL_EXT_cull_vertex, - GL_EXT_draw_range_elements, - GL_EXT_fog_coord, - GL_EXT_histogram, - GL_EXT_index_array_formats, - GL_EXT_index_func, - GL_EXT_index_material, - GL_EXT_index_texture, - GL_EXT_light_max_exponent, - GL_EXT_light_texture, - GL_EXT_misc_attribute, - GL_EXT_multi_draw_arrays, - GL_EXT_multisample, - GL_EXT_packed_pixels, - GL_EXT_paletted_texture, - GL_EXT_pixel_transform, - GL_EXT_point_parameters, - GL_EXT_polygon_offset, - GL_EXT_rescale_normal, - GL_EXT_scene_marker, - GL_EXT_secondary_color, - GL_EXT_separate_specular_color, - GL_EXT_shared_texture_palette, - GL_EXT_stencil_wrap, - GL_EXT_subtexture, - GL_EXT_texture_color_table, - GL_EXT_texture_compression_s3tc, - GL_EXT_texture_cube_map, - GL_EXT_texture_edge_clamp, - GL_EXT_texture_env_add, - GL_EXT_texture_env_combine, - GL_EXT_texture_filter_anisotropic, - GL_EXT_texture_lod_bias, - GL_EXT_texture_object, - GL_EXT_texture_perturb_normal, - GL_EXT_texture3D, - GL_EXT_vertex_array, - GL_EXT_vertex_weighting, - - GL_FfdMaskSGIX, - GL_HP_convolution_border_modes, - GL_HP_image_transform, - GL_HP_occlusion_test, - GL_HP_texture_lighting, - - GL_IBM_cull_vertex, - GL_IBM_multimode_draw_arrays, - GL_IBM_rasterpos_clip, - GL_IBM_vertex_array_lists, - - GL_INGR_color_clamp, - GL_INGR_interlace_read, - - GL_INTEL_parallel_arrays, - - GL_KTX_buffer_region, - - GL_MESA_resize_buffers, - GL_MESA_window_pos, - - GL_NV_blend_square, - GL_NV_fog_distance, - GL_NV_light_max_exponent, - GL_NV_register_combiners, - GL_NV_texgen_emboss, - GL_NV_texgen_reflection, - GL_NV_texture_env_combine4, - GL_NV_vertex_array_range, - GL_NV_vertex_program, - - GL_PGI_misc_hints, - GL_PGI_vertex_hints, - - GL_REND_screen_coordinates, - - GL_SGI_color_matrix, - GL_SGI_color_table, - GL_SGI_depth_pass_instrument, - - GL_SGIS_detail_texture, - GL_SGIS_fog_function, - GL_SGIS_generate_mipmap, - GL_SGIS_multisample, - GL_SGIS_multitexture, - GL_SGIS_pixel_texture, - GL_SGIS_point_line_texgen, - GL_SGIS_point_parameters, - GL_SGIS_sharpen_texture, - GL_SGIS_texture_border_clamp, - GL_SGIS_texture_color_mask, - GL_SGIS_texture_edge_clamp, - GL_SGIS_texture_filter4, - GL_SGIS_texture_lod, - GL_SGIS_texture_select, - GL_SGIS_texture4D, - - GL_SGIX_async, - GL_SGIX_async_histogram, - GL_SGIX_async_pixel, - GL_SGIX_blend_alpha_minmax, - GL_SGIX_calligraphic_fragment, - GL_SGIX_clipmap, - GL_SGIX_convolution_accuracy, - GL_SGIX_depth_texture, - GL_SGIX_flush_raster, - GL_SGIX_fog_offset, - GL_SGIX_fog_scale, - GL_SGIX_fragment_lighting, - GL_SGIX_framezoom, - GL_SGIX_igloo_interface, - GL_SGIX_instruments, - GL_SGIX_interlace, - GL_SGIX_ir_instrument1, - GL_SGIX_list_priority, - GL_SGIX_pixel_texture, - GL_SGIX_pixel_tiles, - GL_SGIX_polynomial_ffd, - GL_SGIX_reference_plane, - GL_SGIX_resample, - GL_SGIX_shadow, - GL_SGIX_shadow_ambient, - GL_SGIX_sprite, - GL_SGIX_subsample, - GL_SGIX_tag_sample_buffer, - GL_SGIX_texture_add_env, - GL_SGIX_texture_lod_bias, - GL_SGIX_texture_multi_buffer, - GL_SGIX_texture_scale_bias, - GL_SGIX_vertex_preclip, - GL_SGIX_ycrcb, - GL_SGIX_ycrcba, - - GL_SUN_convolution_border_modes, - GL_SUN_global_alpha, - GL_SUN_triangle_list, - GL_SUN_vertex, - - GL_SUNX_constant_data, - - GL_WIN_phong_shading, - GL_WIN_specular_fog, - GL_WIN_swap_hint, - - WGL_EXT_swap_control, - WGL_ARB_extensions_string, - WGL_ARB_pixel_format, - - // Extensions (glu) - GLU_EXT_Texture, - GLU_EXT_object_space_tess, - GLU_EXT_nurbs_tessellator: Boolean; - -const - // ********** GL generic constants ********** - - // errors - GL_NO_ERROR = 0; - {$EXTERNALSYM GL_NO_ERROR} - GL_INVALID_ENUM = $0500; - {$EXTERNALSYM GL_INVALID_ENUM} - GL_INVALID_VALUE = $0501; - {$EXTERNALSYM GL_INVALID_VALUE} - GL_INVALID_OPERATION = $0502; - {$EXTERNALSYM GL_INVALID_OPERATION} - GL_STACK_OVERFLOW = $0503; - {$EXTERNALSYM GL_STACK_OVERFLOW} - GL_STACK_UNDERFLOW = $0504; - {$EXTERNALSYM GL_STACK_UNDERFLOW} - GL_OUT_OF_MEMORY = $0505; - {$EXTERNALSYM GL_STACK_UNDERFLOW} - - // attribute bits - GL_CURRENT_BIT = $00000001; - {$EXTERNALSYM GL_CURRENT_BIT} - GL_POINT_BIT = $00000002; - {$EXTERNALSYM GL_POINT_BIT} - GL_LINE_BIT = $00000004; - {$EXTERNALSYM GL_LINE_BIT} - GL_POLYGON_BIT = $00000008; - {$EXTERNALSYM GL_POLYGON_BIT} - GL_POLYGON_STIPPLE_BIT = $00000010; - {$EXTERNALSYM GL_POLYGON_STIPPLE_BIT} - GL_PIXEL_MODE_BIT = $00000020; - {$EXTERNALSYM GL_PIXEL_MODE_BIT} - GL_LIGHTING_BIT = $00000040; - {$EXTERNALSYM GL_LIGHTING_BIT} - GL_FOG_BIT = $00000080; - {$EXTERNALSYM GL_FOG_BIT} - GL_DEPTH_BUFFER_BIT = $00000100; - {$EXTERNALSYM GL_DEPTH_BUFFER_BIT} - GL_ACCUM_BUFFER_BIT = $00000200; - {$EXTERNALSYM GL_ACCUM_BUFFER_BIT} - GL_STENCIL_BUFFER_BIT = $00000400; - {$EXTERNALSYM GL_STENCIL_BUFFER_BIT} - GL_VIEWPORT_BIT = $00000800; - {$EXTERNALSYM GL_VIEWPORT_BIT} - GL_TRANSFORM_BIT = $00001000; - {$EXTERNALSYM GL_TRANSFORM_BIT} - GL_ENABLE_BIT = $00002000; - {$EXTERNALSYM GL_ENABLE_BIT} - GL_COLOR_BUFFER_BIT = $00004000; - {$EXTERNALSYM GL_COLOR_BUFFER_BIT} - GL_HINT_BIT = $00008000; - {$EXTERNALSYM GL_HINT_BIT} - GL_EVAL_BIT = $00010000; - {$EXTERNALSYM GL_EVAL_BIT} - GL_LIST_BIT = $00020000; - {$EXTERNALSYM GL_LIST_BIT} - GL_TEXTURE_BIT = $00040000; - {$EXTERNALSYM GL_TEXTURE_BIT} - GL_SCISSOR_BIT = $00080000; - {$EXTERNALSYM GL_SCISSOR_BIT} - GL_ALL_ATTRIB_BITS = $000FFFFF; - {$EXTERNALSYM GL_ALL_ATTRIB_BITS} - - // client attribute bits - GL_CLIENT_PIXEL_STORE_BIT = $00000001; - {$EXTERNALSYM GL_CLIENT_PIXEL_STORE_BIT} - GL_CLIENT_VERTEX_ARRAY_BIT = $00000002; - {$EXTERNALSYM GL_CLIENT_VERTEX_ARRAY_BIT} - GL_CLIENT_ALL_ATTRIB_BITS = $FFFFFFFF; - {$EXTERNALSYM GL_CLIENT_ALL_ATTRIB_BITS} - - // boolean values - GL_FALSE = Boolean(0); - {$EXTERNALSYM GL_FALSE} - GL_TRUE = Boolean(1); - {$EXTERNALSYM GL_TRUE} - - // primitives - GL_POINTS = $0000; - {$EXTERNALSYM GL_POINTS} - GL_LINES = $0001; - {$EXTERNALSYM GL_LINES} - GL_LINE_LOOP = $0002; - {$EXTERNALSYM GL_LINE_LOOP} - GL_LINE_STRIP = $0003; - {$EXTERNALSYM GL_LINE_STRIP} - GL_TRIANGLES = $0004; - {$EXTERNALSYM GL_TRIANGLES} - GL_TRIANGLE_STRIP = $0005; - {$EXTERNALSYM GL_TRIANGLE_STRIP} - GL_TRIANGLE_FAN = $0006; - {$EXTERNALSYM GL_TRIANGLE_FAN} - GL_QUADS = $0007; - {$EXTERNALSYM GL_QUADS} - GL_QUAD_STRIP = $0008; - {$EXTERNALSYM GL_QUAD_STRIP} - GL_POLYGON = $0009; - {$EXTERNALSYM GL_POLYGON} - - // blending - GL_ZERO = 0; - {$EXTERNALSYM GL_ZERO} - GL_ONE = 1; - {$EXTERNALSYM GL_ONE} - GL_SRC_COLOR = $0300; - {$EXTERNALSYM GL_SRC_COLOR} - GL_ONE_MINUS_SRC_COLOR = $0301; - {$EXTERNALSYM GL_ONE_MINUS_SRC_COLOR} - GL_SRC_ALPHA = $0302; - {$EXTERNALSYM GL_SRC_ALPHA} - GL_ONE_MINUS_SRC_ALPHA = $0303; - {$EXTERNALSYM GL_ONE_MINUS_SRC_ALPHA} - GL_DST_ALPHA = $0304; - {$EXTERNALSYM GL_DST_ALPHA} - GL_ONE_MINUS_DST_ALPHA = $0305; - {$EXTERNALSYM GL_ONE_MINUS_DST_ALPHA} - GL_DST_COLOR = $0306; - {$EXTERNALSYM GL_DST_COLOR} - GL_ONE_MINUS_DST_COLOR = $0307; - {$EXTERNALSYM GL_ONE_MINUS_DST_COLOR} - GL_SRC_ALPHA_SATURATE = $0308; - {$EXTERNALSYM GL_SRC_ALPHA_SATURATE} - GL_BLEND_DST = $0BE0; - {$EXTERNALSYM GL_BLEND_DST} - GL_BLEND_SRC = $0BE1; - {$EXTERNALSYM GL_BLEND_SRC} - GL_BLEND = $0BE2; - {$EXTERNALSYM GL_BLEND} - - // blending (GL 1.2 ARB imaging) - GL_BLEND_COLOR = $8005; - {$EXTERNALSYM GL_BLEND_COLOR} - GL_CONSTANT_COLOR = $8001; - {$EXTERNALSYM GL_CONSTANT_COLOR} - GL_ONE_MINUS_CONSTANT_COLOR = $8002; - {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_COLOR} - GL_CONSTANT_ALPHA = $8003; - {$EXTERNALSYM GL_CONSTANT_ALPHA} - GL_ONE_MINUS_CONSTANT_ALPHA = $8004; - {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_ALPHA} - GL_FUNC_ADD = $8006; - {$EXTERNALSYM GL_FUNC_ADD} - GL_MIN = $8007; - {$EXTERNALSYM GL_MIN} - GL_MAX = $8008; - {$EXTERNALSYM GL_MAX} - GL_FUNC_SUBTRACT = $800A; - {$EXTERNALSYM GL_FUNC_SUBTRACT} - GL_FUNC_REVERSE_SUBTRACT = $800B; - {$EXTERNALSYM GL_FUNC_REVERSE_SUBTRACT} - - // color table GL 1.2 ARB imaging - GL_COLOR_TABLE = $80D0; - {$EXTERNALSYM GL_COLOR_TABLE} - GL_POST_CONVOLUTION_COLOR_TABLE = $80D1; - {$EXTERNALSYM GL_POST_CONVOLUTION_COLOR_TABLE} - GL_POST_COLOR_MATRIX_COLOR_TABLE = $80D2; - {$EXTERNALSYM GL_POST_COLOR_MATRIX_COLOR_TABLE} - GL_PROXY_COLOR_TABLE = $80D3; - {$EXTERNALSYM GL_PROXY_COLOR_TABLE} - GL_PROXY_POST_CONVOLUTION_COLOR_TABLE = $80D4; - {$EXTERNALSYM GL_PROXY_POST_CONVOLUTION_COLOR_TABLE} - GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE = $80D5; - {$EXTERNALSYM GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE} - GL_COLOR_TABLE_SCALE = $80D6; - {$EXTERNALSYM GL_COLOR_TABLE_SCALE} - GL_COLOR_TABLE_BIAS = $80D7; - {$EXTERNALSYM GL_COLOR_TABLE_BIAS} - GL_COLOR_TABLE_FORMAT = $80D8; - {$EXTERNALSYM GL_COLOR_TABLE_FORMAT} - GL_COLOR_TABLE_WIDTH = $80D9; - {$EXTERNALSYM GL_COLOR_TABLE_WIDTH} - GL_COLOR_TABLE_RED_SIZE = $80DA; - {$EXTERNALSYM GL_COLOR_TABLE_RED_SIZE} - GL_COLOR_TABLE_GREEN_SIZE = $80DB; - {$EXTERNALSYM GL_COLOR_TABLE_GREEN_SIZE} - GL_COLOR_TABLE_BLUE_SIZE = $80DC; - {$EXTERNALSYM GL_COLOR_TABLE_BLUE_SIZE} - GL_COLOR_TABLE_ALPHA_SIZE = $80DD; - {$EXTERNALSYM GL_COLOR_TABLE_ALPHA_SIZE} - GL_COLOR_TABLE_LUMINANCE_SIZE = $80DE; - {$EXTERNALSYM GL_COLOR_TABLE_LUMINANCE_SIZE} - GL_COLOR_TABLE_INTENSITY_SIZE = $80DF; - {$EXTERNALSYM GL_COLOR_TABLE_INTENSITY_SIZE} - - // convolutions GL 1.2 ARB imaging - GL_CONVOLUTION_1D = $8010; - {$EXTERNALSYM GL_CONVOLUTION_1D} - GL_CONVOLUTION_2D = $8011; - {$EXTERNALSYM GL_CONVOLUTION_2D} - GL_SEPARABLE_2D = $8012; - {$EXTERNALSYM GL_SEPARABLE_2D} - GL_CONVOLUTION_BORDER_MODE = $8013; - {$EXTERNALSYM GL_CONVOLUTION_BORDER_MODE} - GL_CONVOLUTION_FILTER_SCALE = $8014; - {$EXTERNALSYM GL_CONVOLUTION_FILTER_SCALE} - GL_CONVOLUTION_FILTER_BIAS = $8015; - {$EXTERNALSYM GL_CONVOLUTION_FILTER_BIAS} - GL_REDUCE = $8016; - {$EXTERNALSYM GL_REDUCE} - GL_CONVOLUTION_FORMAT = $8017; - {$EXTERNALSYM GL_CONVOLUTION_FORMAT} - GL_CONVOLUTION_WIDTH = $8018; - {$EXTERNALSYM GL_CONVOLUTION_WIDTH} - GL_CONVOLUTION_HEIGHT = $8019; - {$EXTERNALSYM GL_CONVOLUTION_HEIGHT} - GL_MAX_CONVOLUTION_WIDTH = $801A; - {$EXTERNALSYM GL_MAX_CONVOLUTION_WIDTH} - GL_MAX_CONVOLUTION_HEIGHT = $801B; - {$EXTERNALSYM GL_MAX_CONVOLUTION_HEIGHT} - GL_POST_CONVOLUTION_RED_SCALE = $801C; - {$EXTERNALSYM GL_POST_CONVOLUTION_RED_SCALE} - GL_POST_CONVOLUTION_GREEN_SCALE = $801D; - {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_SCALE} - GL_POST_CONVOLUTION_BLUE_SCALE = $801E; - {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_SCALE} - GL_POST_CONVOLUTION_ALPHA_SCALE = $801F; - {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_SCALE} - GL_POST_CONVOLUTION_RED_BIAS = $8020; - {$EXTERNALSYM GL_POST_CONVOLUTION_RED_BIAS} - GL_POST_CONVOLUTION_GREEN_BIAS = $8021; - {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_BIAS} - GL_POST_CONVOLUTION_BLUE_BIAS = $8022; - {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_BIAS} - GL_POST_CONVOLUTION_ALPHA_BIAS = $8023; - {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_BIAS} - - // histogram GL 1.2 ARB imaging - GL_HISTOGRAM = $8024; - {$EXTERNALSYM GL_HISTOGRAM} - GL_PROXY_HISTOGRAM = $8025; - {$EXTERNALSYM GL_PROXY_HISTOGRAM} - GL_HISTOGRAM_WIDTH = $8026; - {$EXTERNALSYM GL_HISTOGRAM_WIDTH} - GL_HISTOGRAM_FORMAT = $8027; - {$EXTERNALSYM GL_HISTOGRAM_FORMAT} - GL_HISTOGRAM_RED_SIZE = $8028; - {$EXTERNALSYM GL_HISTOGRAM_RED_SIZE} - GL_HISTOGRAM_GREEN_SIZE = $8029; - {$EXTERNALSYM GL_HISTOGRAM_GREEN_SIZE} - GL_HISTOGRAM_BLUE_SIZE = $802A; - {$EXTERNALSYM GL_HISTOGRAM_BLUE_SIZE} - GL_HISTOGRAM_ALPHA_SIZE = $802B; - {$EXTERNALSYM GL_HISTOGRAM_ALPHA_SIZE} - GL_HISTOGRAM_LUMINANCE_SIZE = $802C; - {$EXTERNALSYM GL_HISTOGRAM_LUMINANCE_SIZE} - GL_HISTOGRAM_SINK = $802D; - {$EXTERNALSYM GL_HISTOGRAM_SINK} - GL_MINMAX = $802E; - {$EXTERNALSYM GL_MINMAX} - GL_MINMAX_FORMAT = $802F; - {$EXTERNALSYM GL_MINMAX_FORMAT} - GL_MINMAX_SINK = $8030; - {$EXTERNALSYM GL_MINMAX_SINK} - - // buffers - GL_NONE = 0; - {$EXTERNALSYM GL_NONE} - GL_FRONT_LEFT = $0400; - {$EXTERNALSYM GL_FRONT_LEFT} - GL_FRONT_RIGHT = $0401; - {$EXTERNALSYM GL_FRONT_RIGHT} - GL_BACK_LEFT = $0402; - {$EXTERNALSYM GL_BACK_LEFT} - GL_BACK_RIGHT = $0403; - {$EXTERNALSYM GL_BACK_RIGHT} - GL_FRONT = $0404; - {$EXTERNALSYM GL_FRONT} - GL_BACK = $0405; - {$EXTERNALSYM GL_BACK} - GL_LEFT = $0406; - {$EXTERNALSYM GL_LEFT} - GL_RIGHT = $0407; - {$EXTERNALSYM GL_RIGHT} - GL_FRONT_AND_BACK = $0408; - {$EXTERNALSYM GL_FRONT_AND_BACK} - GL_AUX0 = $0409; - {$EXTERNALSYM GL_AUX0} - GL_AUX1 = $040A; - {$EXTERNALSYM GL_AUX1} - GL_AUX2 = $040B; - {$EXTERNALSYM GL_AUX2} - GL_AUX3 = $040C; - {$EXTERNALSYM GL_AUX3} - GL_AUX_BUFFERS = $0C00; - {$EXTERNALSYM GL_AUX_BUFFERS} - GL_DRAW_BUFFER = $0C01; - {$EXTERNALSYM GL_DRAW_BUFFER} - GL_READ_BUFFER = $0C02; - {$EXTERNALSYM GL_READ_BUFFER} - GL_DOUBLEBUFFER = $0C32; - {$EXTERNALSYM GL_DOUBLEBUFFER} - GL_STEREO = $0C33; - {$EXTERNALSYM GL_STEREO} - - // depth buffer - GL_DEPTH_RANGE = $0B70; - {$EXTERNALSYM GL_DEPTH_RANGE} - GL_DEPTH_TEST = $0B71; - {$EXTERNALSYM GL_DEPTH_TEST} - GL_DEPTH_WRITEMASK = $0B72; - {$EXTERNALSYM GL_DEPTH_WRITEMASK} - GL_DEPTH_CLEAR_VALUE = $0B73; - {$EXTERNALSYM GL_DEPTH_CLEAR_VALUE} - GL_DEPTH_FUNC = $0B74; - {$EXTERNALSYM GL_DEPTH_FUNC} - GL_NEVER = $0200; - {$EXTERNALSYM GL_NEVER} - GL_LESS = $0201; - {$EXTERNALSYM GL_LESS} - GL_EQUAL = $0202; - {$EXTERNALSYM GL_EQUAL} - GL_LEQUAL = $0203; - {$EXTERNALSYM GL_LEQUAL} - GL_GREATER = $0204; - {$EXTERNALSYM GL_GREATER} - GL_NOTEQUAL = $0205; - {$EXTERNALSYM GL_NOTEQUAL} - GL_GEQUAL = $0206; - {$EXTERNALSYM GL_GEQUAL} - GL_ALWAYS = $0207; - {$EXTERNALSYM GL_ALWAYS} - - // accumulation buffer - GL_ACCUM = $0100; - {$EXTERNALSYM GL_ACCUM} - GL_LOAD = $0101; - {$EXTERNALSYM GL_LOAD} - GL_RETURN = $0102; - {$EXTERNALSYM GL_RETURN} - GL_MULT = $0103; - {$EXTERNALSYM GL_MULT} - GL_ADD = $0104; - {$EXTERNALSYM GL_ADD} - GL_ACCUM_CLEAR_VALUE = $0B80; - {$EXTERNALSYM GL_ACCUM_CLEAR_VALUE} - - // feedback buffer - GL_FEEDBACK_BUFFER_POINTER = $0DF0; - {$EXTERNALSYM GL_FEEDBACK_BUFFER_POINTER} - GL_FEEDBACK_BUFFER_SIZE = $0DF1; - {$EXTERNALSYM GL_FEEDBACK_BUFFER_SIZE} - GL_FEEDBACK_BUFFER_TYPE = $0DF2; - {$EXTERNALSYM GL_FEEDBACK_BUFFER_TYPE} - - // feedback types - GL_2D = $0600; - {$EXTERNALSYM GL_2D} - GL_3D = $0601; - {$EXTERNALSYM GL_3D} - GL_3D_COLOR = $0602; - {$EXTERNALSYM GL_3D_COLOR} - GL_3D_COLOR_TEXTURE = $0603; - {$EXTERNALSYM GL_3D_COLOR_TEXTURE} - GL_4D_COLOR_TEXTURE = $0604; - {$EXTERNALSYM GL_4D_COLOR_TEXTURE} - - // feedback tokens - GL_PASS_THROUGH_TOKEN = $0700; - {$EXTERNALSYM GL_PASS_THROUGH_TOKEN} - GL_POINT_TOKEN = $0701; - {$EXTERNALSYM GL_POINT_TOKEN} - GL_LINE_TOKEN = $0702; - {$EXTERNALSYM GL_LINE_TOKEN} - GL_POLYGON_TOKEN = $0703; - {$EXTERNALSYM GL_POLYGON_TOKEN} - GL_BITMAP_TOKEN = $0704; - {$EXTERNALSYM GL_BITMAP_TOKEN} - GL_DRAW_PIXEL_TOKEN = $0705; - {$EXTERNALSYM GL_DRAW_PIXEL_TOKEN} - GL_COPY_PIXEL_TOKEN = $0706; - {$EXTERNALSYM GL_COPY_PIXEL_TOKEN} - GL_LINE_RESET_TOKEN = $0707; - {$EXTERNALSYM GL_LINE_RESET_TOKEN} - - // fog - GL_EXP = $0800; - {$EXTERNALSYM GL_EXP} - GL_EXP2 = $0801; - {$EXTERNALSYM GL_EXP2} - GL_FOG = $0B60; - {$EXTERNALSYM GL_FOG} - GL_FOG_INDEX = $0B61; - {$EXTERNALSYM GL_FOG_INDEX} - GL_FOG_DENSITY = $0B62; - {$EXTERNALSYM GL_FOG_DENSITY} - GL_FOG_START = $0B63; - {$EXTERNALSYM GL_FOG_START} - GL_FOG_END = $0B64; - {$EXTERNALSYM GL_FOG_END} - GL_FOG_MODE = $0B65; - {$EXTERNALSYM GL_FOG_MODE} - GL_FOG_COLOR = $0B66; - {$EXTERNALSYM GL_FOG_COLOR} - - // pixel mode, transfer - GL_PIXEL_MAP_I_TO_I = $0C70; - {$EXTERNALSYM GL_PIXEL_MAP_I_TO_I} - GL_PIXEL_MAP_S_TO_S = $0C71; - {$EXTERNALSYM GL_PIXEL_MAP_S_TO_S} - GL_PIXEL_MAP_I_TO_R = $0C72; - {$EXTERNALSYM GL_PIXEL_MAP_I_TO_R} - GL_PIXEL_MAP_I_TO_G = $0C73; - {$EXTERNALSYM GL_PIXEL_MAP_I_TO_G} - GL_PIXEL_MAP_I_TO_B = $0C74; - {$EXTERNALSYM GL_PIXEL_MAP_I_TO_B} - GL_PIXEL_MAP_I_TO_A = $0C75; - {$EXTERNALSYM GL_PIXEL_MAP_I_TO_A} - GL_PIXEL_MAP_R_TO_R = $0C76; - {$EXTERNALSYM GL_PIXEL_MAP_R_TO_R} - GL_PIXEL_MAP_G_TO_G = $0C77; - {$EXTERNALSYM GL_PIXEL_MAP_G_TO_G} - GL_PIXEL_MAP_B_TO_B = $0C78; - {$EXTERNALSYM GL_PIXEL_MAP_B_TO_B} - GL_PIXEL_MAP_A_TO_A = $0C79; - {$EXTERNALSYM GL_PIXEL_MAP_A_TO_A} - - // vertex arrays - GL_VERTEX_ARRAY_POINTER = $808E; - {$EXTERNALSYM GL_VERTEX_ARRAY_POINTER} - GL_NORMAL_ARRAY_POINTER = $808F; - {$EXTERNALSYM GL_NORMAL_ARRAY_POINTER} - GL_COLOR_ARRAY_POINTER = $8090; - {$EXTERNALSYM GL_COLOR_ARRAY_POINTER} - GL_INDEX_ARRAY_POINTER = $8091; - {$EXTERNALSYM GL_INDEX_ARRAY_POINTER} - GL_TEXTURE_COORD_ARRAY_POINTER = $8092; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_POINTER} - GL_EDGE_FLAG_ARRAY_POINTER = $8093; - {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_POINTER} - - // stenciling - GL_STENCIL_TEST = $0B90; - {$EXTERNALSYM GL_STENCIL_TEST} - GL_STENCIL_CLEAR_VALUE = $0B91; - {$EXTERNALSYM GL_STENCIL_CLEAR_VALUE} - GL_STENCIL_FUNC = $0B92; - {$EXTERNALSYM GL_STENCIL_FUNC} - GL_STENCIL_VALUE_MASK = $0B93; - {$EXTERNALSYM GL_STENCIL_VALUE_MASK} - GL_STENCIL_FAIL = $0B94; - {$EXTERNALSYM GL_STENCIL_FAIL} - GL_STENCIL_PASS_DEPTH_FAIL = $0B95; - {$EXTERNALSYM GL_STENCIL_PASS_DEPTH_FAIL} - GL_STENCIL_PASS_DEPTH_PASS = $0B96; - {$EXTERNALSYM GL_STENCIL_PASS_DEPTH_PASS} - GL_STENCIL_REF = $0B97; - {$EXTERNALSYM GL_STENCIL_REF} - GL_STENCIL_WRITEMASK = $0B98; - {$EXTERNALSYM GL_STENCIL_WRITEMASK} - GL_KEEP = $1E00; - {$EXTERNALSYM GL_KEEP} - GL_REPLACE = $1E01; - {$EXTERNALSYM GL_REPLACE} - GL_INCR = $1E02; - {$EXTERNALSYM GL_INCR} - GL_DECR = $1E03; - {$EXTERNALSYM GL_DECR} - - // color material - GL_COLOR_MATERIAL_FACE = $0B55; - {$EXTERNALSYM GL_COLOR_MATERIAL_FACE} - GL_COLOR_MATERIAL_PARAMETER = $0B56; - {$EXTERNALSYM GL_COLOR_MATERIAL_PARAMETER} - GL_COLOR_MATERIAL = $0B57; - {$EXTERNALSYM GL_COLOR_MATERIAL} - - // points - GL_POINT_SMOOTH = $0B10; - {$EXTERNALSYM GL_POINT_SMOOTH} - GL_POINT_SIZE = $0B11; - {$EXTERNALSYM GL_POINT_SIZE} - GL_POINT_SIZE_RANGE = $0B12; - {$EXTERNALSYM GL_POINT_SIZE_RANGE} - GL_POINT_SIZE_GRANULARITY = $0B13; - {$EXTERNALSYM GL_POINT_SIZE_GRANULARITY} - - // lines - GL_LINE_SMOOTH = $0B20; - {$EXTERNALSYM GL_LINE_SMOOTH} - GL_LINE_WIDTH = $0B21; - {$EXTERNALSYM GL_LINE_WIDTH} - GL_LINE_WIDTH_RANGE = $0B22; - {$EXTERNALSYM GL_LINE_WIDTH_RANGE} - GL_LINE_WIDTH_GRANULARITY = $0B23; - {$EXTERNALSYM GL_LINE_WIDTH_GRANULARITY} - GL_LINE_STIPPLE = $0B24; - {$EXTERNALSYM GL_LINE_STIPPLE} - GL_LINE_STIPPLE_PATTERN = $0B25; - {$EXTERNALSYM GL_LINE_STIPPLE_PATTERN} - GL_LINE_STIPPLE_REPEAT = $0B26; - {$EXTERNALSYM GL_LINE_STIPPLE_REPEAT} - - // polygons - GL_POLYGON_MODE = $0B40; - {$EXTERNALSYM GL_POLYGON_MODE} - GL_POLYGON_SMOOTH = $0B41; - {$EXTERNALSYM GL_POLYGON_SMOOTH} - GL_POLYGON_STIPPLE = $0B42; - {$EXTERNALSYM GL_POLYGON_STIPPLE} - GL_EDGE_FLAG = $0B43; - {$EXTERNALSYM GL_EDGE_FLAG} - GL_CULL_FACE = $0B44; - {$EXTERNALSYM GL_CULL_FACE} - GL_CULL_FACE_MODE = $0B45; - {$EXTERNALSYM GL_CULL_FACE_MODE} - GL_FRONT_FACE = $0B46; - {$EXTERNALSYM GL_FRONT_FACE} - GL_CW = $0900; - {$EXTERNALSYM GL_CW} - GL_CCW = $0901; - {$EXTERNALSYM GL_CCW} - GL_POINT = $1B00; - {$EXTERNALSYM GL_POINT} - GL_LINE = $1B01; - {$EXTERNALSYM GL_LINE} - GL_FILL = $1B02; - {$EXTERNALSYM GL_FILL} - - // display lists - GL_LIST_MODE = $0B30; - {$EXTERNALSYM GL_LIST_MODE} - GL_LIST_BASE = $0B32; - {$EXTERNALSYM GL_LIST_BASE} - GL_LIST_INDEX = $0B33; - {$EXTERNALSYM GL_LIST_INDEX} - GL_COMPILE = $1300; - {$EXTERNALSYM GL_COMPILE} - GL_COMPILE_AND_EXECUTE = $1301; - {$EXTERNALSYM GL_COMPILE_AND_EXECUTE} - - // lighting - GL_LIGHTING = $0B50; - {$EXTERNALSYM GL_LIGHTING} - GL_LIGHT_MODEL_LOCAL_VIEWER = $0B51; - {$EXTERNALSYM GL_LIGHT_MODEL_LOCAL_VIEWER} - GL_LIGHT_MODEL_TWO_SIDE = $0B52; - {$EXTERNALSYM GL_LIGHT_MODEL_TWO_SIDE} - GL_LIGHT_MODEL_AMBIENT = $0B53; - {$EXTERNALSYM GL_LIGHT_MODEL_AMBIENT} - GL_LIGHT_MODEL_COLOR_CONTROL = $81F8; // GL 1.2 - {$EXTERNALSYM GL_LIGHT_MODEL_COLOR_CONTROL} - GL_SHADE_MODEL = $0B54; - {$EXTERNALSYM GL_SHADE_MODEL} - GL_NORMALIZE = $0BA1; - {$EXTERNALSYM GL_NORMALIZE} - GL_AMBIENT = $1200; - {$EXTERNALSYM GL_AMBIENT} - GL_DIFFUSE = $1201; - {$EXTERNALSYM GL_DIFFUSE} - GL_SPECULAR = $1202; - {$EXTERNALSYM GL_SPECULAR} - GL_POSITION = $1203; - {$EXTERNALSYM GL_POSITION} - GL_SPOT_DIRECTION = $1204; - {$EXTERNALSYM GL_SPOT_DIRECTION} - GL_SPOT_EXPONENT = $1205; - {$EXTERNALSYM GL_SPOT_EXPONENT} - GL_SPOT_CUTOFF = $1206; - {$EXTERNALSYM GL_SPOT_CUTOFF} - GL_CONSTANT_ATTENUATION = $1207; - {$EXTERNALSYM GL_CONSTANT_ATTENUATION} - GL_LINEAR_ATTENUATION = $1208; - {$EXTERNALSYM GL_LINEAR_ATTENUATION} - GL_QUADRATIC_ATTENUATION = $1209; - {$EXTERNALSYM GL_QUADRATIC_ATTENUATION} - GL_EMISSION = $1600; - {$EXTERNALSYM GL_EMISSION} - GL_SHININESS = $1601; - {$EXTERNALSYM GL_SHININESS} - GL_AMBIENT_AND_DIFFUSE = $1602; - {$EXTERNALSYM GL_AMBIENT_AND_DIFFUSE} - GL_COLOR_INDEXES = $1603; - {$EXTERNALSYM GL_COLOR_INDEXES} - GL_FLAT = $1D00; - {$EXTERNALSYM GL_FLAT} - GL_SMOOTH = $1D01; - {$EXTERNALSYM GL_SMOOTH} - GL_LIGHT0 = $4000; - {$EXTERNALSYM GL_LIGHT0} - GL_LIGHT1 = $4001; - {$EXTERNALSYM GL_LIGHT1} - GL_LIGHT2 = $4002; - {$EXTERNALSYM GL_LIGHT2} - GL_LIGHT3 = $4003; - {$EXTERNALSYM GL_LIGHT3} - GL_LIGHT4 = $4004; - {$EXTERNALSYM GL_LIGHT4} - GL_LIGHT5 = $4005; - {$EXTERNALSYM GL_LIGHT5} - GL_LIGHT6 = $4006; - {$EXTERNALSYM GL_LIGHT6} - GL_LIGHT7 = $4007; - {$EXTERNALSYM GL_LIGHT7} - - // matrix modes - GL_MATRIX_MODE = $0BA0; - {$EXTERNALSYM GL_MATRIX_MODE} - GL_MODELVIEW = $1700; - {$EXTERNALSYM GL_MODELVIEW} - GL_PROJECTION = $1701; - {$EXTERNALSYM GL_PROJECTION} - GL_TEXTURE = $1702; - {$EXTERNALSYM GL_TEXTURE} - - // gets - GL_CURRENT_COLOR = $0B00; - {$EXTERNALSYM GL_CURRENT_COLOR} - GL_CURRENT_INDEX = $0B01; - {$EXTERNALSYM GL_CURRENT_INDEX} - GL_CURRENT_NORMAL = $0B02; - {$EXTERNALSYM GL_CURRENT_NORMAL} - GL_CURRENT_TEXTURE_COORDS = $0B03; - {$EXTERNALSYM GL_CURRENT_TEXTURE_COORDS} - GL_CURRENT_RASTER_COLOR = $0B04; - {$EXTERNALSYM GL_CURRENT_RASTER_COLOR} - GL_CURRENT_RASTER_INDEX = $0B05; - {$EXTERNALSYM GL_CURRENT_RASTER_INDEX} - GL_CURRENT_RASTER_TEXTURE_COORDS = $0B06; - {$EXTERNALSYM GL_CURRENT_RASTER_TEXTURE_COORDS} - GL_CURRENT_RASTER_POSITION = $0B07; - {$EXTERNALSYM GL_CURRENT_RASTER_POSITION} - GL_CURRENT_RASTER_POSITION_VALID = $0B08; - {$EXTERNALSYM GL_CURRENT_RASTER_POSITION_VALID} - GL_CURRENT_RASTER_DISTANCE = $0B09; - {$EXTERNALSYM GL_CURRENT_RASTER_DISTANCE} - GL_MAX_LIST_NESTING = $0B31; - {$EXTERNALSYM GL_MAX_LIST_NESTING} - GL_VIEWPORT = $0BA2; - {$EXTERNALSYM GL_VIEWPORT} - GL_MODELVIEW_STACK_DEPTH = $0BA3; - {$EXTERNALSYM GL_MODELVIEW_STACK_DEPTH} - GL_PROJECTION_STACK_DEPTH = $0BA4; - {$EXTERNALSYM GL_PROJECTION_STACK_DEPTH} - GL_TEXTURE_STACK_DEPTH = $0BA5; - {$EXTERNALSYM GL_TEXTURE_STACK_DEPTH} - GL_MODELVIEW_MATRIX = $0BA6; - {$EXTERNALSYM GL_MODELVIEW_MATRIX} - GL_PROJECTION_MATRIX = $0BA7; - {$EXTERNALSYM GL_PROJECTION_MATRIX} - GL_TEXTURE_MATRIX = $0BA8; - {$EXTERNALSYM GL_TEXTURE_MATRIX} - GL_ATTRIB_STACK_DEPTH = $0BB0; - {$EXTERNALSYM GL_ATTRIB_STACK_DEPTH} - GL_CLIENT_ATTRIB_STACK_DEPTH = $0BB1; - {$EXTERNALSYM GL_CLIENT_ATTRIB_STACK_DEPTH} - - GL_SINGLE_COLOR = $81F9; // GL 1.2 - {$EXTERNALSYM GL_SINGLE_COLOR} - GL_SEPARATE_SPECULAR_COLOR = $81FA; // GL 1.2 - {$EXTERNALSYM GL_SEPARATE_SPECULAR_COLOR} - - // alpha testing - GL_ALPHA_TEST = $0BC0; - {$EXTERNALSYM GL_ALPHA_TEST} - GL_ALPHA_TEST_FUNC = $0BC1; - {$EXTERNALSYM GL_ALPHA_TEST_FUNC} - GL_ALPHA_TEST_REF = $0BC2; - {$EXTERNALSYM GL_ALPHA_TEST_REF} - - GL_LOGIC_OP_MODE = $0BF0; - {$EXTERNALSYM GL_LOGIC_OP_MODE} - GL_INDEX_LOGIC_OP = $0BF1; - {$EXTERNALSYM GL_INDEX_LOGIC_OP} - GL_LOGIC_OP = $0BF1; - {$EXTERNALSYM GL_LOGIC_OP} - GL_COLOR_LOGIC_OP = $0BF2; - {$EXTERNALSYM GL_COLOR_LOGIC_OP} - GL_SCISSOR_BOX = $0C10; - {$EXTERNALSYM GL_SCISSOR_BOX} - GL_SCISSOR_TEST = $0C11; - {$EXTERNALSYM GL_SCISSOR_TEST} - GL_INDEX_CLEAR_VALUE = $0C20; - {$EXTERNALSYM GL_INDEX_CLEAR_VALUE} - GL_INDEX_WRITEMASK = $0C21; - {$EXTERNALSYM GL_INDEX_WRITEMASK} - GL_COLOR_CLEAR_VALUE = $0C22; - {$EXTERNALSYM GL_COLOR_CLEAR_VALUE} - GL_COLOR_WRITEMASK = $0C23; - {$EXTERNALSYM GL_COLOR_WRITEMASK} - GL_INDEX_MODE = $0C30; - {$EXTERNALSYM GL_INDEX_MODE} - GL_RGBA_MODE = $0C31; - {$EXTERNALSYM GL_RGBA_MODE} - GL_RENDER_MODE = $0C40; - {$EXTERNALSYM GL_RENDER_MODE} - GL_PERSPECTIVE_CORRECTION_HINT = $0C50; - {$EXTERNALSYM GL_PERSPECTIVE_CORRECTION_HINT} - GL_POINT_SMOOTH_HINT = $0C51; - {$EXTERNALSYM GL_POINT_SMOOTH_HINT} - GL_LINE_SMOOTH_HINT = $0C52; - {$EXTERNALSYM GL_LINE_SMOOTH_HINT} - GL_POLYGON_SMOOTH_HINT = $0C53; - {$EXTERNALSYM GL_POLYGON_SMOOTH_HINT} - GL_FOG_HINT = $0C54; - {$EXTERNALSYM GL_FOG_HINT} - GL_TEXTURE_GEN_S = $0C60; - {$EXTERNALSYM GL_TEXTURE_GEN_S} - GL_TEXTURE_GEN_T = $0C61; - {$EXTERNALSYM GL_TEXTURE_GEN_T} - GL_TEXTURE_GEN_R = $0C62; - {$EXTERNALSYM GL_TEXTURE_GEN_R} - GL_TEXTURE_GEN_Q = $0C63; - {$EXTERNALSYM GL_TEXTURE_GEN_Q} - GL_PIXEL_MAP_I_TO_I_SIZE = $0CB0; - {$EXTERNALSYM GL_PIXEL_MAP_I_TO_I_SIZE} - GL_PIXEL_MAP_S_TO_S_SIZE = $0CB1; - {$EXTERNALSYM GL_PIXEL_MAP_S_TO_S_SIZE} - GL_PIXEL_MAP_I_TO_R_SIZE = $0CB2; - {$EXTERNALSYM GL_PIXEL_MAP_I_TO_R_SIZE} - GL_PIXEL_MAP_I_TO_G_SIZE = $0CB3; - {$EXTERNALSYM GL_PIXEL_MAP_I_TO_G_SIZE} - GL_PIXEL_MAP_I_TO_B_SIZE = $0CB4; - {$EXTERNALSYM GL_PIXEL_MAP_I_TO_B_SIZE} - GL_PIXEL_MAP_I_TO_A_SIZE = $0CB5; - {$EXTERNALSYM GL_PIXEL_MAP_I_TO_A_SIZE} - GL_PIXEL_MAP_R_TO_R_SIZE = $0CB6; - {$EXTERNALSYM GL_PIXEL_MAP_R_TO_R_SIZE} - GL_PIXEL_MAP_G_TO_G_SIZE = $0CB7; - {$EXTERNALSYM GL_PIXEL_MAP_G_TO_G_SIZE} - GL_PIXEL_MAP_B_TO_B_SIZE = $0CB8; - {$EXTERNALSYM GL_PIXEL_MAP_B_TO_B_SIZE} - GL_PIXEL_MAP_A_TO_A_SIZE = $0CB9; - {$EXTERNALSYM GL_PIXEL_MAP_A_TO_A_SIZE} - GL_UNPACK_SWAP_BYTES = $0CF0; - {$EXTERNALSYM GL_UNPACK_SWAP_BYTES} - GL_UNPACK_LSB_FIRST = $0CF1; - {$EXTERNALSYM GL_UNPACK_LSB_FIRST} - GL_UNPACK_ROW_LENGTH = $0CF2; - {$EXTERNALSYM GL_UNPACK_ROW_LENGTH} - GL_UNPACK_SKIP_ROWS = $0CF3; - {$EXTERNALSYM GL_UNPACK_SKIP_ROWS} - GL_UNPACK_SKIP_PIXELS = $0CF4; - {$EXTERNALSYM GL_UNPACK_SKIP_PIXELS} - GL_UNPACK_ALIGNMENT = $0CF5; - {$EXTERNALSYM GL_UNPACK_ALIGNMENT} - GL_PACK_SWAP_BYTES = $0D00; - {$EXTERNALSYM GL_PACK_SWAP_BYTES} - GL_PACK_LSB_FIRST = $0D01; - {$EXTERNALSYM GL_PACK_LSB_FIRST} - GL_PACK_ROW_LENGTH = $0D02; - {$EXTERNALSYM GL_PACK_ROW_LENGTH} - GL_PACK_SKIP_ROWS = $0D03; - {$EXTERNALSYM GL_PACK_SKIP_ROWS} - GL_PACK_SKIP_PIXELS = $0D04; - {$EXTERNALSYM GL_PACK_SKIP_PIXELS} - GL_PACK_ALIGNMENT = $0D05; - {$EXTERNALSYM GL_PACK_ALIGNMENT} - GL_PACK_SKIP_IMAGES = $806B; // GL 1.2 - {$EXTERNALSYM GL_PACK_SKIP_IMAGES} - GL_PACK_IMAGE_HEIGHT = $806C; // GL 1.2 - {$EXTERNALSYM GL_PACK_IMAGE_HEIGHT} - GL_UNPACK_SKIP_IMAGES = $806D; // GL 1.2 - {$EXTERNALSYM GL_UNPACK_SKIP_IMAGES} - GL_UNPACK_IMAGE_HEIGHT = $806E; // GL 1.2 - {$EXTERNALSYM GL_UNPACK_IMAGE_HEIGHT} - GL_MAP_COLOR = $0D10; - {$EXTERNALSYM GL_MAP_COLOR} - GL_MAP_STENCIL = $0D11; - {$EXTERNALSYM GL_MAP_STENCIL} - GL_INDEX_SHIFT = $0D12; - {$EXTERNALSYM GL_INDEX_SHIFT} - GL_INDEX_OFFSET = $0D13; - {$EXTERNALSYM GL_INDEX_OFFSET} - GL_RED_SCALE = $0D14; - {$EXTERNALSYM GL_RED_SCALE} - GL_RED_BIAS = $0D15; - {$EXTERNALSYM GL_RED_BIAS} - GL_ZOOM_X = $0D16; - {$EXTERNALSYM GL_ZOOM_X} - GL_ZOOM_Y = $0D17; - {$EXTERNALSYM GL_ZOOM_Y} - GL_GREEN_SCALE = $0D18; - {$EXTERNALSYM GL_GREEN_SCALE} - GL_GREEN_BIAS = $0D19; - {$EXTERNALSYM GL_GREEN_BIAS} - GL_BLUE_SCALE = $0D1A; - {$EXTERNALSYM GL_BLUE_SCALE} - GL_BLUE_BIAS = $0D1B; - {$EXTERNALSYM GL_BLUE_BIAS} - GL_ALPHA_SCALE = $0D1C; - {$EXTERNALSYM GL_ALPHA_SCALE} - GL_ALPHA_BIAS = $0D1D; - {$EXTERNALSYM GL_ALPHA_BIAS} - GL_DEPTH_SCALE = $0D1E; - {$EXTERNALSYM GL_DEPTH_SCALE} - GL_DEPTH_BIAS = $0D1F; - {$EXTERNALSYM GL_DEPTH_BIAS} - GL_MAX_EVAL_ORDER = $0D30; - {$EXTERNALSYM GL_MAX_EVAL_ORDER} - GL_MAX_LIGHTS = $0D31; - {$EXTERNALSYM GL_MAX_LIGHTS} - GL_MAX_CLIP_PLANES = $0D32; - {$EXTERNALSYM GL_MAX_CLIP_PLANES} - GL_MAX_TEXTURE_SIZE = $0D33; - {$EXTERNALSYM GL_MAX_TEXTURE_SIZE} - GL_MAX_3D_TEXTURE_SIZE = $8073; // GL 1.2 - {$EXTERNALSYM GL_MAX_3D_TEXTURE_SIZE} - GL_MAX_PIXEL_MAP_TABLE = $0D34; - {$EXTERNALSYM GL_MAX_PIXEL_MAP_TABLE} - GL_MAX_ATTRIB_STACK_DEPTH = $0D35; - {$EXTERNALSYM GL_MAX_ATTRIB_STACK_DEPTH} - GL_MAX_MODELVIEW_STACK_DEPTH = $0D36; - {$EXTERNALSYM GL_MAX_MODELVIEW_STACK_DEPTH} - GL_MAX_NAME_STACK_DEPTH = $0D37; - {$EXTERNALSYM GL_MAX_NAME_STACK_DEPTH} - GL_MAX_PROJECTION_STACK_DEPTH = $0D38; - {$EXTERNALSYM GL_MAX_PROJECTION_STACK_DEPTH} - GL_MAX_TEXTURE_STACK_DEPTH = $0D39; - {$EXTERNALSYM GL_MAX_TEXTURE_STACK_DEPTH} - GL_MAX_VIEWPORT_DIMS = $0D3A; - {$EXTERNALSYM GL_MAX_VIEWPORT_DIMS} - GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = $0D3B; - {$EXTERNALSYM GL_MAX_CLIENT_ATTRIB_STACK_DEPTH} - GL_MAX_ELEMENTS_VERTICES = $80E8; // GL 1.2 - {$EXTERNALSYM GL_MAX_ELEMENTS_VERTICES} - GL_MAX_ELEMENTS_INDICES = $80E9; // GL 1.2 - {$EXTERNALSYM GL_MAX_ELEMENTS_INDICES} - GL_RESCALE_NORMAL = $803A; // GL 1.2 - {$EXTERNALSYM GL_RESCALE_NORMAL} - GL_SUBPIXEL_BITS = $0D50; - {$EXTERNALSYM GL_SUBPIXEL_BITS} - GL_INDEX_BITS = $0D51; - {$EXTERNALSYM GL_INDEX_BITS} - GL_RED_BITS = $0D52; - {$EXTERNALSYM GL_RED_BITS} - GL_GREEN_BITS = $0D53; - {$EXTERNALSYM GL_GREEN_BITS} - GL_BLUE_BITS = $0D54; - {$EXTERNALSYM GL_BLUE_BITS} - GL_ALPHA_BITS = $0D55; - {$EXTERNALSYM GL_ALPHA_BITS} - GL_DEPTH_BITS = $0D56; - {$EXTERNALSYM GL_DEPTH_BITS} - GL_STENCIL_BITS = $0D57; - {$EXTERNALSYM GL_STENCIL_BITS} - GL_ACCUM_RED_BITS = $0D58; - {$EXTERNALSYM GL_ACCUM_RED_BITS} - GL_ACCUM_GREEN_BITS = $0D59; - {$EXTERNALSYM GL_ACCUM_GREEN_BITS} - GL_ACCUM_BLUE_BITS = $0D5A; - {$EXTERNALSYM GL_ACCUM_BLUE_BITS} - GL_ACCUM_ALPHA_BITS = $0D5B; - {$EXTERNALSYM GL_ACCUM_ALPHA_BITS} - GL_NAME_STACK_DEPTH = $0D70; - {$EXTERNALSYM GL_NAME_STACK_DEPTH} - GL_AUTO_NORMAL = $0D80; - {$EXTERNALSYM GL_AUTO_NORMAL} - GL_MAP1_COLOR_4 = $0D90; - {$EXTERNALSYM GL_MAP1_COLOR_4} - GL_MAP1_INDEX = $0D91; - {$EXTERNALSYM GL_MAP1_INDEX} - GL_MAP1_NORMAL = $0D92; - {$EXTERNALSYM GL_MAP1_NORMAL} - GL_MAP1_TEXTURE_COORD_1 = $0D93; - {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_1} - GL_MAP1_TEXTURE_COORD_2 = $0D94; - {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_2} - GL_MAP1_TEXTURE_COORD_3 = $0D95; - {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_3} - GL_MAP1_TEXTURE_COORD_4 = $0D96; - {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_4} - GL_MAP1_VERTEX_3 = $0D97; - {$EXTERNALSYM GL_MAP1_VERTEX_3} - GL_MAP1_VERTEX_4 = $0D98; - {$EXTERNALSYM GL_MAP1_VERTEX_4} - GL_MAP2_COLOR_4 = $0DB0; - {$EXTERNALSYM GL_MAP2_COLOR_4} - GL_MAP2_INDEX = $0DB1; - {$EXTERNALSYM GL_MAP2_INDEX} - GL_MAP2_NORMAL = $0DB2; - {$EXTERNALSYM GL_MAP2_NORMAL} - GL_MAP2_TEXTURE_COORD_1 = $0DB3; - {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_1} - GL_MAP2_TEXTURE_COORD_2 = $0DB4; - {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_2} - GL_MAP2_TEXTURE_COORD_3 = $0DB5; - {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_3} - GL_MAP2_TEXTURE_COORD_4 = $0DB6; - {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_4} - GL_MAP2_VERTEX_3 = $0DB7; - {$EXTERNALSYM GL_MAP2_VERTEX_3} - GL_MAP2_VERTEX_4 = $0DB8; - {$EXTERNALSYM GL_MAP2_VERTEX_4} - GL_MAP1_GRID_DOMAIN = $0DD0; - {$EXTERNALSYM GL_MAP1_GRID_DOMAIN} - GL_MAP1_GRID_SEGMENTS = $0DD1; - {$EXTERNALSYM GL_MAP1_GRID_SEGMENTS} - GL_MAP2_GRID_DOMAIN = $0DD2; - {$EXTERNALSYM GL_MAP2_GRID_DOMAIN} - GL_MAP2_GRID_SEGMENTS = $0DD3; - {$EXTERNALSYM GL_MAP2_GRID_SEGMENTS} - GL_TEXTURE_1D = $0DE0; - {$EXTERNALSYM GL_TEXTURE_1D} - GL_TEXTURE_2D = $0DE1; - {$EXTERNALSYM GL_TEXTURE_2D} - GL_TEXTURE_3D = $806F; // GL 1.2 - {$EXTERNALSYM GL_TEXTURE_3D} - GL_SELECTION_BUFFER_POINTER = $0DF3; - {$EXTERNALSYM GL_SELECTION_BUFFER_POINTER} - GL_SELECTION_BUFFER_SIZE = $0DF4; - {$EXTERNALSYM GL_SELECTION_BUFFER_SIZE} - GL_POLYGON_OFFSET_UNITS = $2A00; - {$EXTERNALSYM GL_POLYGON_OFFSET_UNITS} - GL_POLYGON_OFFSET_POINT = $2A01; - {$EXTERNALSYM GL_POLYGON_OFFSET_POINT} - GL_POLYGON_OFFSET_LINE = $2A02; - {$EXTERNALSYM GL_POLYGON_OFFSET_LINE} - GL_POLYGON_OFFSET_FILL = $8037; - {$EXTERNALSYM GL_POLYGON_OFFSET_FILL} - GL_POLYGON_OFFSET_FACTOR = $8038; - {$EXTERNALSYM GL_POLYGON_OFFSET_FACTOR} - GL_TEXTURE_BINDING_1D = $8068; - {$EXTERNALSYM GL_TEXTURE_BINDING_1D} - GL_TEXTURE_BINDING_2D = $8069; - {$EXTERNALSYM GL_TEXTURE_BINDING_2D} - GL_VERTEX_ARRAY = $8074; - {$EXTERNALSYM GL_VERTEX_ARRAY} - GL_NORMAL_ARRAY = $8075; - {$EXTERNALSYM GL_NORMAL_ARRAY} - GL_COLOR_ARRAY = $8076; - {$EXTERNALSYM GL_COLOR_ARRAY} - GL_INDEX_ARRAY = $8077; - {$EXTERNALSYM GL_INDEX_ARRAY} - GL_TEXTURE_COORD_ARRAY = $8078; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY} - GL_EDGE_FLAG_ARRAY = $8079; - {$EXTERNALSYM GL_EDGE_FLAG_ARRAY} - GL_VERTEX_ARRAY_SIZE = $807A; - {$EXTERNALSYM GL_VERTEX_ARRAY_SIZE} - GL_VERTEX_ARRAY_TYPE = $807B; - {$EXTERNALSYM GL_VERTEX_ARRAY_TYPE} - GL_VERTEX_ARRAY_STRIDE = $807C; - {$EXTERNALSYM GL_VERTEX_ARRAY_STRIDE} - GL_NORMAL_ARRAY_TYPE = $807E; - {$EXTERNALSYM GL_NORMAL_ARRAY_TYPE} - GL_NORMAL_ARRAY_STRIDE = $807F; - {$EXTERNALSYM GL_NORMAL_ARRAY_STRIDE} - GL_COLOR_ARRAY_SIZE = $8081; - {$EXTERNALSYM GL_COLOR_ARRAY_SIZE} - GL_COLOR_ARRAY_TYPE = $8082; - {$EXTERNALSYM GL_COLOR_ARRAY_TYPE} - GL_COLOR_ARRAY_STRIDE = $8083; - {$EXTERNALSYM GL_COLOR_ARRAY_STRIDE} - GL_INDEX_ARRAY_TYPE = $8085; - {$EXTERNALSYM GL_INDEX_ARRAY_TYPE} - GL_INDEX_ARRAY_STRIDE = $8086; - {$EXTERNALSYM GL_INDEX_ARRAY_STRIDE} - GL_TEXTURE_COORD_ARRAY_SIZE = $8088; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_SIZE} - GL_TEXTURE_COORD_ARRAY_TYPE = $8089; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_TYPE} - GL_TEXTURE_COORD_ARRAY_STRIDE = $808A; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_STRIDE} - GL_EDGE_FLAG_ARRAY_STRIDE = $808C; - {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_STRIDE} - GL_COLOR_MATRIX = $80B1; // GL 1.2 ARB imaging - {$EXTERNALSYM GL_COLOR_MATRIX} - GL_COLOR_MATRIX_STACK_DEPTH = $80B2; // GL 1.2 ARB imaging - {$EXTERNALSYM GL_COLOR_MATRIX_STACK_DEPTH} - GL_MAX_COLOR_MATRIX_STACK_DEPTH = $80B3; // GL 1.2 ARB imaging - {$EXTERNALSYM GL_MAX_COLOR_MATRIX_STACK_DEPTH} - GL_POST_COLOR_MATRIX_RED_SCALE = $80B4; // GL 1.2 ARB imaging - {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_SCALE} - GL_POST_COLOR_MATRIX_GREEN_SCALE = $80B5; // GL 1.2 ARB imaging - {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_SCALE} - GL_POST_COLOR_MATRIX_BLUE_SCALE = $80B6; // GL 1.2 ARB imaging - {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_SCALE} - GL_POST_COLOR_MATRIX_ALPHA_SCALE = $80B7; // GL 1.2 ARB imaging - {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_SCALE} - GL_POST_COLOR_MATRIX_RED_BIAS = $80B8; // GL 1.2 ARB imaging - {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_BIAS} - GL_POST_COLOR_MATRIX_GREEN_BIAS = $80B9; // GL 1.2 ARB imaging - {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_BIAS} - GL_POST_COLOR_MATRIX_BLUE_BIAS = $80BA; // GL 1.2 ARB imaging - {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_BIAS} - GL_POST_COLOR_MATRIX_ALPHA_BIAS = $80BB; // GL 1.2 ARB imaging - {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_BIAS} - - // evaluators - GL_COEFF = $0A00; - {$EXTERNALSYM GL_COEFF} - GL_ORDER = $0A01; - {$EXTERNALSYM GL_ORDER} - GL_DOMAIN = $0A02; - {$EXTERNALSYM GL_DOMAIN} - - // texture mapping - GL_TEXTURE_WIDTH = $1000; - {$EXTERNALSYM GL_TEXTURE_WIDTH} - GL_TEXTURE_HEIGHT = $1001; - {$EXTERNALSYM GL_TEXTURE_HEIGHT} - GL_TEXTURE_INTERNAL_FORMAT = $1003; - {$EXTERNALSYM GL_TEXTURE_INTERNAL_FORMAT} - GL_TEXTURE_COMPONENTS = $1003; - {$EXTERNALSYM GL_TEXTURE_COMPONENTS} - GL_TEXTURE_BORDER_COLOR = $1004; - {$EXTERNALSYM GL_TEXTURE_BORDER_COLOR} - GL_TEXTURE_BORDER = $1005; - {$EXTERNALSYM GL_TEXTURE_BORDER} - GL_TEXTURE_RED_SIZE = $805C; - {$EXTERNALSYM GL_TEXTURE_RED_SIZE} - GL_TEXTURE_GREEN_SIZE = $805D; - {$EXTERNALSYM GL_TEXTURE_GREEN_SIZE} - GL_TEXTURE_BLUE_SIZE = $805E; - {$EXTERNALSYM GL_TEXTURE_BLUE_SIZE} - GL_TEXTURE_ALPHA_SIZE = $805F; - {$EXTERNALSYM GL_TEXTURE_ALPHA_SIZE} - GL_TEXTURE_LUMINANCE_SIZE = $8060; - {$EXTERNALSYM GL_TEXTURE_LUMINANCE_SIZE} - GL_TEXTURE_INTENSITY_SIZE = $8061; - {$EXTERNALSYM GL_TEXTURE_INTENSITY_SIZE} - GL_TEXTURE_PRIORITY = $8066; - {$EXTERNALSYM GL_TEXTURE_PRIORITY} - GL_TEXTURE_RESIDENT = $8067; - {$EXTERNALSYM GL_TEXTURE_RESIDENT} - GL_BGR = $80E0; // v 1.2 - {$EXTERNALSYM GL_BGR} - GL_BGRA = $80E1; // v 1.2 - {$EXTERNALSYM GL_BGRA} - GL_S = $2000; - {$EXTERNALSYM GL_S} - GL_T = $2001; - {$EXTERNALSYM GL_T} - GL_R = $2002; - {$EXTERNALSYM GL_R} - GL_Q = $2003; - {$EXTERNALSYM GL_Q} - GL_MODULATE = $2100; - {$EXTERNALSYM GL_MODULATE} - GL_DECAL = $2101; - {$EXTERNALSYM GL_DECAL} - GL_TEXTURE_ENV_MODE = $2200; - {$EXTERNALSYM GL_TEXTURE_ENV_MODE} - GL_TEXTURE_ENV_COLOR = $2201; - {$EXTERNALSYM GL_TEXTURE_ENV_COLOR} - GL_TEXTURE_ENV = $2300; - {$EXTERNALSYM GL_TEXTURE_ENV} - GL_EYE_LINEAR = $2400; - {$EXTERNALSYM GL_EYE_LINEAR} - GL_OBJECT_LINEAR = $2401; - {$EXTERNALSYM GL_OBJECT_LINEAR} - GL_SPHERE_MAP = $2402; - {$EXTERNALSYM GL_SPHERE_MAP} - GL_TEXTURE_GEN_MODE = $2500; - {$EXTERNALSYM GL_TEXTURE_GEN_MODE} - GL_OBJECT_PLANE = $2501; - {$EXTERNALSYM GL_OBJECT_PLANE} - GL_EYE_PLANE = $2502; - {$EXTERNALSYM GL_EYE_PLANE} - GL_NEAREST = $2600; - {$EXTERNALSYM GL_NEAREST} - GL_LINEAR = $2601; - {$EXTERNALSYM GL_LINEAR} - GL_NEAREST_MIPMAP_NEAREST = $2700; - {$EXTERNALSYM GL_NEAREST_MIPMAP_NEAREST} - GL_LINEAR_MIPMAP_NEAREST = $2701; - {$EXTERNALSYM GL_LINEAR_MIPMAP_NEAREST} - GL_NEAREST_MIPMAP_LINEAR = $2702; - {$EXTERNALSYM GL_NEAREST_MIPMAP_LINEAR} - GL_LINEAR_MIPMAP_LINEAR = $2703; - {$EXTERNALSYM GL_LINEAR_MIPMAP_LINEAR} - GL_TEXTURE_MAG_FILTER = $2800; - {$EXTERNALSYM GL_TEXTURE_MAG_FILTER} - GL_TEXTURE_MIN_FILTER = $2801; - {$EXTERNALSYM GL_TEXTURE_MIN_FILTER} - GL_TEXTURE_WRAP_R = $8072; // GL 1.2 - {$EXTERNALSYM GL_TEXTURE_WRAP_R} - GL_TEXTURE_WRAP_S = $2802; - {$EXTERNALSYM GL_TEXTURE_WRAP_S} - GL_TEXTURE_WRAP_T = $2803; - {$EXTERNALSYM GL_TEXTURE_WRAP_T} - GL_CLAMP_TO_EDGE = $812F; // GL 1.2 - {$EXTERNALSYM GL_CLAMP_TO_EDGE} - GL_TEXTURE_MIN_LOD = $813A; // GL 1.2 - {$EXTERNALSYM GL_TEXTURE_MIN_LOD} - GL_TEXTURE_MAX_LOD = $813B; // GL 1.2 - {$EXTERNALSYM GL_TEXTURE_MAX_LOD} - GL_TEXTURE_BASE_LEVEL = $813C; // GL 1.2 - {$EXTERNALSYM GL_TEXTURE_BASE_LEVEL} - GL_TEXTURE_MAX_LEVEL = $813D; // GL 1.2 - {$EXTERNALSYM GL_TEXTURE_MAX_LEVEL} - GL_TEXTURE_DEPTH = $8071; // GL 1.2 - {$EXTERNALSYM GL_TEXTURE_DEPTH} - GL_PROXY_TEXTURE_1D = $8063; - {$EXTERNALSYM GL_PROXY_TEXTURE_1D} - GL_PROXY_TEXTURE_2D = $8064; - {$EXTERNALSYM GL_PROXY_TEXTURE_2D} - GL_PROXY_TEXTURE_3D = $8070; // GL 1.2 - {$EXTERNALSYM GL_PROXY_TEXTURE_3D} - GL_CLAMP = $2900; - {$EXTERNALSYM GL_CLAMP} - GL_REPEAT = $2901; - {$EXTERNALSYM GL_REPEAT} - - // hints - GL_DONT_CARE = $1100; - {$EXTERNALSYM GL_DONT_CARE} - GL_FASTEST = $1101; - {$EXTERNALSYM GL_FASTEST} - GL_NICEST = $1102; - {$EXTERNALSYM GL_NICEST} - - // data types - GL_BYTE = $1400; - {$EXTERNALSYM GL_BYTE} - GL_UNSIGNED_BYTE = $1401; - {$EXTERNALSYM GL_UNSIGNED_BYTE} - GL_SHORT = $1402; - {$EXTERNALSYM GL_SHORT} - GL_UNSIGNED_SHORT = $1403; - {$EXTERNALSYM GL_UNSIGNED_SHORT} - GL_INT = $1404; - {$EXTERNALSYM GL_INT} - GL_UNSIGNED_INT = $1405; - {$EXTERNALSYM GL_UNSIGNED_INT} - GL_FLOAT = $1406; - {$EXTERNALSYM GL_FLOAT} - GL_2_BYTES = $1407; - {$EXTERNALSYM GL_2_BYTES} - GL_3_BYTES = $1408; - {$EXTERNALSYM GL_3_BYTES} - GL_4_BYTES = $1409; - {$EXTERNALSYM GL_4_BYTES} - GL_DOUBLE = $140A; - {$EXTERNALSYM GL_DOUBLE} - GL_DOUBLE_EXT = $140A; - {$EXTERNALSYM GL_DOUBLE_EXT} - - // logic operations - GL_CLEAR = $1500; - {$EXTERNALSYM GL_CLEAR} - GL_AND = $1501; - {$EXTERNALSYM GL_AND} - GL_AND_REVERSE = $1502; - {$EXTERNALSYM GL_AND_REVERSE} - GL_COPY = $1503; - {$EXTERNALSYM GL_COPY} - GL_AND_INVERTED = $1504; - {$EXTERNALSYM GL_AND_INVERTED} - GL_NOOP = $1505; - {$EXTERNALSYM GL_NOOP} - GL_XOR = $1506; - {$EXTERNALSYM GL_XOR} - GL_OR = $1507; - {$EXTERNALSYM GL_OR} - GL_NOR = $1508; - {$EXTERNALSYM GL_NOR} - GL_EQUIV = $1509; - {$EXTERNALSYM GL_EQUIV} - GL_INVERT = $150A; - {$EXTERNALSYM GL_INVERT} - GL_OR_REVERSE = $150B; - {$EXTERNALSYM GL_OR_REVERSE} - GL_COPY_INVERTED = $150C; - {$EXTERNALSYM GL_COPY_INVERTED} - GL_OR_INVERTED = $150D; - {$EXTERNALSYM GL_OR_INVERTED} - GL_NAND = $150E; - {$EXTERNALSYM GL_NAND} - GL_SET = $150F; - {$EXTERNALSYM GL_SET} - - // PixelCopyType - GL_COLOR = $1800; - {$EXTERNALSYM GL_COLOR} - GL_DEPTH = $1801; - {$EXTERNALSYM GL_DEPTH} - GL_STENCIL = $1802; - {$EXTERNALSYM GL_STENCIL} - - // pixel formats - GL_COLOR_INDEX = $1900; - {$EXTERNALSYM GL_COLOR_INDEX} - GL_STENCIL_INDEX = $1901; - {$EXTERNALSYM GL_STENCIL_INDEX} - GL_DEPTH_COMPONENT = $1902; - {$EXTERNALSYM GL_DEPTH_COMPONENT} - GL_RED = $1903; - {$EXTERNALSYM GL_RED} - GL_GREEN = $1904; - {$EXTERNALSYM GL_GREEN} - GL_BLUE = $1905; - {$EXTERNALSYM GL_BLUE} - GL_ALPHA = $1906; - {$EXTERNALSYM GL_ALPHA} - GL_RGB = $1907; - {$EXTERNALSYM GL_RGB} - GL_RGBA = $1908; - {$EXTERNALSYM GL_RGBA} - GL_LUMINANCE = $1909; - {$EXTERNALSYM GL_LUMINANCE} - GL_LUMINANCE_ALPHA = $190A; - {$EXTERNALSYM GL_LUMINANCE_ALPHA} - - // pixel type - GL_BITMAP = $1A00; - {$EXTERNALSYM GL_BITMAP} - - // rendering modes - GL_RENDER = $1C00; - {$EXTERNALSYM GL_RENDER} - GL_FEEDBACK = $1C01; - {$EXTERNALSYM GL_FEEDBACK} - GL_SELECT = $1C02; - {$EXTERNALSYM GL_SELECT} - - // implementation strings - GL_VENDOR = $1F00; - {$EXTERNALSYM GL_VENDOR} - GL_RENDERER = $1F01; - {$EXTERNALSYM GL_RENDERER} - GL_VERSION = $1F02; - {$EXTERNALSYM GL_VERSION} - GL_EXTENSIONS = $1F03; - {$EXTERNALSYM GL_EXTENSIONS} - - // pixel formats - GL_R3_G3_B2 = $2A10; - {$EXTERNALSYM GL_R3_G3_B2} - GL_ALPHA4 = $803B; - {$EXTERNALSYM GL_ALPHA4} - GL_ALPHA8 = $803C; - {$EXTERNALSYM GL_ALPHA8} - GL_ALPHA12 = $803D; - {$EXTERNALSYM GL_ALPHA12} - GL_ALPHA16 = $803E; - {$EXTERNALSYM GL_ALPHA16} - GL_LUMINANCE4 = $803F; - {$EXTERNALSYM GL_LUMINANCE4} - GL_LUMINANCE8 = $8040; - {$EXTERNALSYM GL_LUMINANCE8} - GL_LUMINANCE12 = $8041; - {$EXTERNALSYM GL_LUMINANCE12} - GL_LUMINANCE16 = $8042; - {$EXTERNALSYM GL_LUMINANCE16} - GL_LUMINANCE4_ALPHA4 = $8043; - {$EXTERNALSYM GL_LUMINANCE4_ALPHA4} - GL_LUMINANCE6_ALPHA2 = $8044; - {$EXTERNALSYM GL_LUMINANCE6_ALPHA2} - GL_LUMINANCE8_ALPHA8 = $8045; - {$EXTERNALSYM GL_LUMINANCE8_ALPHA8} - GL_LUMINANCE12_ALPHA4 = $8046; - {$EXTERNALSYM GL_LUMINANCE12_ALPHA4} - GL_LUMINANCE12_ALPHA12 = $8047; - {$EXTERNALSYM GL_LUMINANCE12_ALPHA12} - GL_LUMINANCE16_ALPHA16 = $8048; - {$EXTERNALSYM GL_LUMINANCE16_ALPHA16} - GL_INTENSITY = $8049; - {$EXTERNALSYM GL_INTENSITY} - GL_INTENSITY4 = $804A; - {$EXTERNALSYM GL_INTENSITY4} - GL_INTENSITY8 = $804B; - {$EXTERNALSYM GL_INTENSITY8} - GL_INTENSITY12 = $804C; - {$EXTERNALSYM GL_INTENSITY12} - GL_INTENSITY16 = $804D; - {$EXTERNALSYM GL_INTENSITY16} - GL_RGB4 = $804F; - {$EXTERNALSYM GL_RGB4} - GL_RGB5 = $8050; - {$EXTERNALSYM GL_RGB5} - GL_RGB8 = $8051; - {$EXTERNALSYM GL_RGB8} - GL_RGB10 = $8052; - {$EXTERNALSYM GL_RGB10} - GL_RGB12 = $8053; - {$EXTERNALSYM GL_RGB12} - GL_RGB16 = $8054; - {$EXTERNALSYM GL_RGB16} - GL_RGBA2 = $8055; - {$EXTERNALSYM GL_RGBA2} - GL_RGBA4 = $8056; - {$EXTERNALSYM GL_RGBA4} - GL_RGB5_A1 = $8057; - {$EXTERNALSYM GL_RGB5_A1} - GL_RGBA8 = $8058; - {$EXTERNALSYM GL_RGBA8} - GL_RGB10_A2 = $8059; - {$EXTERNALSYM GL_RGB10_A2} - GL_RGBA12 = $805A; - {$EXTERNALSYM GL_RGBA12} - GL_RGBA16 = $805B; - {$EXTERNALSYM GL_RGBA16} - UNSIGNED_BYTE_3_3_2 = $8032; // GL 1.2 - {$EXTERNALSYM UNSIGNED_BYTE_3_3_2} - UNSIGNED_BYTE_2_3_3_REV = $8362; // GL 1.2 - {$EXTERNALSYM UNSIGNED_BYTE_2_3_3_REV} - UNSIGNED_SHORT_5_6_5 = $8363; // GL 1.2 - {$EXTERNALSYM UNSIGNED_SHORT_5_6_5} - UNSIGNED_SHORT_5_6_5_REV = $8364; // GL 1.2 - {$EXTERNALSYM UNSIGNED_SHORT_5_6_5_REV} - UNSIGNED_SHORT_4_4_4_4 = $8033; // GL 1.2 - {$EXTERNALSYM UNSIGNED_SHORT_4_4_4_4} - UNSIGNED_SHORT_4_4_4_4_REV = $8365; // GL 1.2 - {$EXTERNALSYM UNSIGNED_SHORT_4_4_4_4_REV} - UNSIGNED_SHORT_5_5_5_1 = $8034; // GL 1.2 - {$EXTERNALSYM UNSIGNED_SHORT_5_5_5_1} - UNSIGNED_SHORT_1_5_5_5_REV = $8366; // GL 1.2 - {$EXTERNALSYM UNSIGNED_SHORT_1_5_5_5_REV} - UNSIGNED_INT_8_8_8_8 = $8035; // GL 1.2 - {$EXTERNALSYM UNSIGNED_INT_8_8_8_8} - UNSIGNED_INT_8_8_8_8_REV = $8367; // GL 1.2 - {$EXTERNALSYM UNSIGNED_INT_8_8_8_8_REV} - UNSIGNED_INT_10_10_10_2 = $8036; // GL 1.2 - {$EXTERNALSYM UNSIGNED_INT_10_10_10_2} - UNSIGNED_INT_2_10_10_10_REV = $8368; // GL 1.2 - {$EXTERNALSYM UNSIGNED_INT_2_10_10_10_REV} - - // interleaved arrays formats - GL_V2F = $2A20; - {$EXTERNALSYM GL_V2F} - GL_V3F = $2A21; - {$EXTERNALSYM GL_V3F} - GL_C4UB_V2F = $2A22; - {$EXTERNALSYM GL_C4UB_V2F} - GL_C4UB_V3F = $2A23; - {$EXTERNALSYM GL_C4UB_V3F} - GL_C3F_V3F = $2A24; - {$EXTERNALSYM GL_C3F_V3F} - GL_N3F_V3F = $2A25; - {$EXTERNALSYM GL_N3F_V3F} - GL_C4F_N3F_V3F = $2A26; - {$EXTERNALSYM GL_C4F_N3F_V3F} - GL_T2F_V3F = $2A27; - {$EXTERNALSYM GL_T2F_V3F} - GL_T4F_V4F = $2A28; - {$EXTERNALSYM GL_T4F_V4F} - GL_T2F_C4UB_V3F = $2A29; - {$EXTERNALSYM GL_T2F_C4UB_V3F} - GL_T2F_C3F_V3F = $2A2A; - {$EXTERNALSYM GL_T2F_C3F_V3F} - GL_T2F_N3F_V3F = $2A2B; - {$EXTERNALSYM GL_T2F_N3F_V3F} - GL_T2F_C4F_N3F_V3F = $2A2C; - {$EXTERNALSYM GL_T2F_C4F_N3F_V3F} - GL_T4F_C4F_N3F_V4F = $2A2D; - {$EXTERNALSYM GL_T4F_C4F_N3F_V4F} - - // clip planes - GL_CLIP_PLANE0 = $3000; - {$EXTERNALSYM GL_CLIP_PLANE0} - GL_CLIP_PLANE1 = $3001; - {$EXTERNALSYM GL_CLIP_PLANE1} - GL_CLIP_PLANE2 = $3002; - {$EXTERNALSYM GL_CLIP_PLANE2} - GL_CLIP_PLANE3 = $3003; - {$EXTERNALSYM GL_CLIP_PLANE3} - GL_CLIP_PLANE4 = $3004; - {$EXTERNALSYM GL_CLIP_PLANE4} - GL_CLIP_PLANE5 = $3005; - {$EXTERNALSYM GL_CLIP_PLANE5} - - // miscellaneous - GL_DITHER = $0BD0; - {$EXTERNALSYM GL_DITHER} - - // ----- extensions enumerants ----- - // EXT_abgr - GL_ABGR_EXT = $8000; - {$EXTERNALSYM GL_ABGR_EXT} - - // EXT_packed_pixels - GL_UNSIGNED_BYTE_3_3_2_EXT = $8032; - {$EXTERNALSYM GL_UNSIGNED_BYTE_3_3_2_EXT} - GL_UNSIGNED_SHORT_4_4_4_4_EXT = $8033; - {$EXTERNALSYM GL_UNSIGNED_SHORT_4_4_4_4_EXT} - GL_UNSIGNED_SHORT_5_5_5_1_EXT = $8034; - {$EXTERNALSYM GL_UNSIGNED_SHORT_5_5_5_1_EXT} - GL_UNSIGNED_INT_8_8_8_8_EXT = $8035; - {$EXTERNALSYM GL_UNSIGNED_INT_8_8_8_8_EXT} - GL_UNSIGNED_INT_10_10_10_2_EXT = $8036; - {$EXTERNALSYM GL_UNSIGNED_INT_10_10_10_2_EXT} - - // EXT_vertex_array - GL_VERTEX_ARRAY_EXT = $8074; - {$EXTERNALSYM GL_VERTEX_ARRAY_EXT} - GL_NORMAL_ARRAY_EXT = $8075; - {$EXTERNALSYM GL_NORMAL_ARRAY_EXT} - GL_COLOR_ARRAY_EXT = $8076; - {$EXTERNALSYM GL_COLOR_ARRAY_EXT} - GL_INDEX_ARRAY_EXT = $8077; - {$EXTERNALSYM GL_INDEX_ARRAY_EXT} - GL_TEXTURE_COORD_ARRAY_EXT = $8078; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_EXT} - GL_EDGE_FLAG_ARRAY_EXT = $8079; - {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_EXT} - GL_VERTEX_ARRAY_SIZE_EXT = $807A; - {$EXTERNALSYM GL_VERTEX_ARRAY_SIZE_EXT} - GL_VERTEX_ARRAY_TYPE_EXT = $807B; - {$EXTERNALSYM GL_VERTEX_ARRAY_TYPE_EXT} - GL_VERTEX_ARRAY_STRIDE_EXT = $807C; - {$EXTERNALSYM GL_VERTEX_ARRAY_STRIDE_EXT} - GL_VERTEX_ARRAY_COUNT_EXT = $807D; - {$EXTERNALSYM GL_VERTEX_ARRAY_COUNT_EXT} - GL_NORMAL_ARRAY_TYPE_EXT = $807E; - {$EXTERNALSYM GL_NORMAL_ARRAY_TYPE_EXT} - GL_NORMAL_ARRAY_STRIDE_EXT = $807F; - {$EXTERNALSYM GL_NORMAL_ARRAY_STRIDE_EXT} - GL_NORMAL_ARRAY_COUNT_EXT = $8080; - {$EXTERNALSYM GL_NORMAL_ARRAY_COUNT_EXT} - GL_COLOR_ARRAY_SIZE_EXT = $8081; - {$EXTERNALSYM GL_COLOR_ARRAY_SIZE_EXT} - GL_COLOR_ARRAY_TYPE_EXT = $8082; - {$EXTERNALSYM GL_COLOR_ARRAY_TYPE_EXT} - GL_COLOR_ARRAY_STRIDE_EXT = $8083; - {$EXTERNALSYM GL_COLOR_ARRAY_STRIDE_EXT} - GL_COLOR_ARRAY_COUNT_EXT = $8084; - {$EXTERNALSYM GL_COLOR_ARRAY_COUNT_EXT} - GL_INDEX_ARRAY_TYPE_EXT = $8085; - {$EXTERNALSYM GL_INDEX_ARRAY_TYPE_EXT} - GL_INDEX_ARRAY_STRIDE_EXT = $8086; - {$EXTERNALSYM GL_INDEX_ARRAY_STRIDE_EXT} - GL_INDEX_ARRAY_COUNT_EXT = $8087; - {$EXTERNALSYM GL_INDEX_ARRAY_COUNT_EXT} - GL_TEXTURE_COORD_ARRAY_SIZE_EXT = $8088; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_SIZE_EXT} - GL_TEXTURE_COORD_ARRAY_TYPE_EXT = $8089; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_TYPE_EXT} - GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = $808A; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_STRIDE_EXT} - GL_TEXTURE_COORD_ARRAY_COUNT_EXT = $808B; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_COUNT_EXT} - GL_EDGE_FLAG_ARRAY_STRIDE_EXT = $808C; - {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_STRIDE_EXT} - GL_EDGE_FLAG_ARRAY_COUNT_EXT = $808D; - {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_COUNT_EXT} - GL_VERTEX_ARRAY_POINTER_EXT = $808E; - {$EXTERNALSYM GL_VERTEX_ARRAY_POINTER_EXT} - GL_NORMAL_ARRAY_POINTER_EXT = $808F; - {$EXTERNALSYM GL_NORMAL_ARRAY_POINTER_EXT} - GL_COLOR_ARRAY_POINTER_EXT = $8090; - {$EXTERNALSYM GL_COLOR_ARRAY_POINTER_EXT} - GL_INDEX_ARRAY_POINTER_EXT = $8091; - {$EXTERNALSYM GL_INDEX_ARRAY_POINTER_EXT} - GL_TEXTURE_COORD_ARRAY_POINTER_EXT = $8092; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_POINTER_EXT} - GL_EDGE_FLAG_ARRAY_POINTER_EXT = $8093; - {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_POINTER_EXT} - - // EXT_color_table - GL_TABLE_TOO_LARGE_EXT = $8031; - {$EXTERNALSYM GL_TABLE_TOO_LARGE_EXT} - GL_COLOR_TABLE_EXT = $80D0; - {$EXTERNALSYM GL_COLOR_TABLE_EXT} - GL_POST_CONVOLUTION_COLOR_TABLE_EXT = $80D1; - {$EXTERNALSYM GL_POST_CONVOLUTION_COLOR_TABLE_EXT} - GL_POST_COLOR_MATRIX_COLOR_TABLE_EXT = $80D2; - {$EXTERNALSYM GL_POST_COLOR_MATRIX_COLOR_TABLE_EXT} - GL_PROXY_COLOR_TABLE_EXT = $80D3; - {$EXTERNALSYM GL_PROXY_COLOR_TABLE_EXT} - GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_EXT = $80D4; - {$EXTERNALSYM GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_EXT} - GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_EXT = $80D5; - {$EXTERNALSYM GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_EXT} - GL_COLOR_TABLE_SCALE_EXT = $80D6; - {$EXTERNALSYM GL_COLOR_TABLE_SCALE_EXT} - GL_COLOR_TABLE_BIAS_EXT = $80D7; - {$EXTERNALSYM GL_COLOR_TABLE_BIAS_EXT} - GL_COLOR_TABLE_FORMAT_EXT = $80D8; - {$EXTERNALSYM GL_COLOR_TABLE_FORMAT_EXT} - GL_COLOR_TABLE_WIDTH_EXT = $80D9; - {$EXTERNALSYM GL_COLOR_TABLE_WIDTH_EXT} - GL_COLOR_TABLE_RED_SIZE_EXT = $80DA; - {$EXTERNALSYM GL_COLOR_TABLE_RED_SIZE_EXT} - GL_COLOR_TABLE_GREEN_SIZE_EXT = $80DB; - {$EXTERNALSYM GL_COLOR_TABLE_GREEN_SIZE_EXT} - GL_COLOR_TABLE_BLUE_SIZE_EXT = $80DC; - {$EXTERNALSYM GL_COLOR_TABLE_BLUE_SIZE_EXT} - GL_COLOR_TABLE_ALPHA_SIZE_EXT = $80DD; - {$EXTERNALSYM GL_COLOR_TABLE_ALPHA_SIZE_EXT} - GL_COLOR_TABLE_LUMINANCE_SIZE_EXT = $80DE; - {$EXTERNALSYM GL_COLOR_TABLE_LUMINANCE_SIZE_EXT} - GL_COLOR_TABLE_INTENSITY_SIZE_EXT = $80DF; - {$EXTERNALSYM GL_COLOR_TABLE_INTENSITY_SIZE_EXT} - - // EXT_bgra - GL_BGR_EXT = $80E0; - {$EXTERNALSYM GL_BGR_EXT} - GL_BGRA_EXT = $80E1; - {$EXTERNALSYM GL_BGRA_EXT} - - // EXT_paletted_texture - GL_COLOR_INDEX1_EXT = $80E2; - {$EXTERNALSYM GL_COLOR_INDEX1_EXT} - GL_COLOR_INDEX2_EXT = $80E3; - {$EXTERNALSYM GL_COLOR_INDEX2_EXT} - GL_COLOR_INDEX4_EXT = $80E4; - {$EXTERNALSYM GL_COLOR_INDEX4_EXT} - GL_COLOR_INDEX8_EXT = $80E5; - {$EXTERNALSYM GL_COLOR_INDEX8_EXT} - GL_COLOR_INDEX12_EXT = $80E6; - {$EXTERNALSYM GL_COLOR_INDEX12_EXT} - GL_COLOR_INDEX16_EXT = $80E7; - {$EXTERNALSYM GL_COLOR_INDEX16_EXT} - - // EXT_blend_color - GL_CONSTANT_COLOR_EXT = $8001; - {$EXTERNALSYM GL_CONSTANT_COLOR_EXT} - GL_ONE_MINUS_CONSTANT_COLOR_EXT = $8002; - {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_COLOR_EXT} - GL_CONSTANT_ALPHA_EXT = $8003; - {$EXTERNALSYM GL_CONSTANT_ALPHA_EXT} - GL_ONE_MINUS_CONSTANT_ALPHA_EXT = $8004; - {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_ALPHA_EXT} - GL_BLEND_COLOR_EXT = $8005; - {$EXTERNALSYM GL_BLEND_COLOR_EXT} - - // EXT_blend_minmax - GL_FUNC_ADD_EXT = $8006; - {$EXTERNALSYM GL_FUNC_ADD_EXT} - GL_MIN_EXT = $8007; - {$EXTERNALSYM GL_MIN_EXT} - GL_MAX_EXT = $8008; - {$EXTERNALSYM GL_MAX_EXT} - GL_BLEND_EQUATION_EXT = $8009; - {$EXTERNALSYM GL_BLEND_EQUATION_EXT} - - // EXT_blend_subtract - GL_FUNC_SUBTRACT_EXT = $800A; - {$EXTERNALSYM GL_FUNC_SUBTRACT_EXT} - GL_FUNC_REVERSE_SUBTRACT_EXT = $800B; - {$EXTERNALSYM GL_FUNC_REVERSE_SUBTRACT_EXT} - - // EXT_convolution - GL_CONVOLUTION_1D_EXT = $8010; - {$EXTERNALSYM GL_CONVOLUTION_1D_EXT} - GL_CONVOLUTION_2D_EXT = $8011; - {$EXTERNALSYM GL_CONVOLUTION_2D_EXT} - GL_SEPARABLE_2D_EXT = $8012; - {$EXTERNALSYM GL_SEPARABLE_2D_EXT} - GL_CONVOLUTION_BORDER_MODE_EXT = $8013; - {$EXTERNALSYM GL_CONVOLUTION_BORDER_MODE_EXT} - GL_CONVOLUTION_FILTER_SCALE_EXT = $8014; - {$EXTERNALSYM GL_CONVOLUTION_FILTER_SCALE_EXT} - GL_CONVOLUTION_FILTER_BIAS_EXT = $8015; - {$EXTERNALSYM GL_CONVOLUTION_FILTER_BIAS_EXT} - GL_REDUCE_EXT = $8016; - {$EXTERNALSYM GL_REDUCE_EXT} - GL_CONVOLUTION_FORMAT_EXT = $8017; - {$EXTERNALSYM GL_CONVOLUTION_FORMAT_EXT} - GL_CONVOLUTION_WIDTH_EXT = $8018; - {$EXTERNALSYM GL_CONVOLUTION_WIDTH_EXT} - GL_CONVOLUTION_HEIGHT_EXT = $8019; - {$EXTERNALSYM GL_CONVOLUTION_HEIGHT_EXT} - GL_MAX_CONVOLUTION_WIDTH_EXT = $801A; - {$EXTERNALSYM GL_MAX_CONVOLUTION_WIDTH_EXT} - GL_MAX_CONVOLUTION_HEIGHT_EXT = $801B; - {$EXTERNALSYM GL_MAX_CONVOLUTION_HEIGHT_EXT} - GL_POST_CONVOLUTION_RED_SCALE_EXT = $801C; - {$EXTERNALSYM GL_POST_CONVOLUTION_RED_SCALE_EXT} - GL_POST_CONVOLUTION_GREEN_SCALE_EXT = $801D; - {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_SCALE_EXT} - GL_POST_CONVOLUTION_BLUE_SCALE_EXT = $801E; - {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_SCALE_EXT} - GL_POST_CONVOLUTION_ALPHA_SCALE_EXT = $801F; - {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_SCALE_EXT} - GL_POST_CONVOLUTION_RED_BIAS_EXT = $8020; - {$EXTERNALSYM GL_POST_CONVOLUTION_RED_BIAS_EXT} - GL_POST_CONVOLUTION_GREEN_BIAS_EXT = $8021; - {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_BIAS_EXT} - GL_POST_CONVOLUTION_BLUE_BIAS_EXT = $8022; - {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_BIAS_EXT} - GL_POST_CONVOLUTION_ALPHA_BIAS_EXT = $8023; - {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_BIAS_EXT} - - // EXT_histogram - GL_HISTOGRAM_EXT = $8024; - {$EXTERNALSYM GL_HISTOGRAM_EXT} - GL_PROXY_HISTOGRAM_EXT = $8025; - {$EXTERNALSYM GL_PROXY_HISTOGRAM_EXT} - GL_HISTOGRAM_WIDTH_EXT = $8026; - {$EXTERNALSYM GL_HISTOGRAM_WIDTH_EXT} - GL_HISTOGRAM_FORMAT_EXT = $8027; - {$EXTERNALSYM GL_HISTOGRAM_FORMAT_EXT} - GL_HISTOGRAM_RED_SIZE_EXT = $8028; - {$EXTERNALSYM GL_HISTOGRAM_RED_SIZE_EXT} - GL_HISTOGRAM_GREEN_SIZE_EXT = $8029; - {$EXTERNALSYM GL_HISTOGRAM_GREEN_SIZE_EXT} - GL_HISTOGRAM_BLUE_SIZE_EXT = $802A; - {$EXTERNALSYM GL_HISTOGRAM_BLUE_SIZE_EXT} - GL_HISTOGRAM_ALPHA_SIZE_EXT = $802B; - {$EXTERNALSYM GL_HISTOGRAM_ALPHA_SIZE_EXT} - GL_HISTOGRAM_LUMINANCE_SIZE_EXT = $802C; - {$EXTERNALSYM GL_HISTOGRAM_LUMINANCE_SIZE_EXT} - GL_HISTOGRAM_SINK_EXT = $802D; - {$EXTERNALSYM GL_HISTOGRAM_SINK_EXT} - GL_MINMAX_EXT = $802E; - {$EXTERNALSYM GL_MINMAX_EXT} - GL_MINMAX_FORMAT_EXT = $802F; - {$EXTERNALSYM GL_MINMAX_FORMAT_EXT} - GL_MINMAX_SINK_EXT = $8030; - {$EXTERNALSYM GL_MINMAX_SINK_EXT} - - // EXT_polygon_offset - GL_POLYGON_OFFSET_EXT = $8037; - {$EXTERNALSYM GL_POLYGON_OFFSET_EXT} - GL_POLYGON_OFFSET_FACTOR_EXT = $8038; - {$EXTERNALSYM GL_POLYGON_OFFSET_FACTOR_EXT} - GL_POLYGON_OFFSET_BIAS_EXT = $8039; - {$EXTERNALSYM GL_POLYGON_OFFSET_BIAS_EXT} - - // EXT_texture - GL_ALPHA4_EXT = $803B; - {$EXTERNALSYM GL_ALPHA4_EXT} - GL_ALPHA8_EXT = $803C; - {$EXTERNALSYM GL_ALPHA8_EXT} - GL_ALPHA12_EXT = $803D; - {$EXTERNALSYM GL_ALPHA12_EXT} - GL_ALPHA16_EXT = $803E; - {$EXTERNALSYM GL_ALPHA16_EXT} - GL_LUMINANCE4_EXT = $803F; - {$EXTERNALSYM GL_LUMINANCE4_EXT} - GL_LUMINANCE8_EXT = $8040; - {$EXTERNALSYM GL_LUMINANCE8_EXT} - GL_LUMINANCE12_EXT = $8041; - {$EXTERNALSYM GL_LUMINANCE12_EXT} - GL_LUMINANCE16_EXT = $8042; - {$EXTERNALSYM GL_LUMINANCE16_EXT} - GL_LUMINANCE4_ALPHA4_EXT = $8043; - {$EXTERNALSYM GL_LUMINANCE4_ALPHA4_EXT} - GL_LUMINANCE6_ALPHA2_EXT = $8044; - {$EXTERNALSYM GL_LUMINANCE6_ALPHA2_EXT} - GL_LUMINANCE8_ALPHA8_EXT = $8045; - {$EXTERNALSYM GL_LUMINANCE8_ALPHA8_EXT} - GL_LUMINANCE12_ALPHA4_EXT = $8046; - {$EXTERNALSYM GL_LUMINANCE12_ALPHA4_EXT} - GL_LUMINANCE12_ALPHA12_EXT = $8047; - {$EXTERNALSYM GL_LUMINANCE12_ALPHA12_EXT} - GL_LUMINANCE16_ALPHA16_EXT = $8048; - {$EXTERNALSYM GL_LUMINANCE16_ALPHA16_EXT} - GL_INTENSITY_EXT = $8049; - {$EXTERNALSYM GL_INTENSITY_EXT} - GL_INTENSITY4_EXT = $804A; - {$EXTERNALSYM GL_INTENSITY4_EXT} - GL_INTENSITY8_EXT = $804B; - {$EXTERNALSYM GL_INTENSITY8_EXT} - GL_INTENSITY12_EXT = $804C; - {$EXTERNALSYM GL_INTENSITY12_EXT} - GL_INTENSITY16_EXT = $804D; - {$EXTERNALSYM GL_INTENSITY16_EXT} - GL_RGB2_EXT = $804E; - {$EXTERNALSYM GL_RGB2_EXT} - GL_RGB4_EXT = $804F; - {$EXTERNALSYM GL_RGB4_EXT} - GL_RGB5_EXT = $8050; - {$EXTERNALSYM GL_RGB5_EXT} - GL_RGB8_EXT = $8051; - {$EXTERNALSYM GL_RGB8_EXT} - GL_RGB10_EXT = $8052; - {$EXTERNALSYM GL_RGB10_EXT} - GL_RGB12_EXT = $8053; - {$EXTERNALSYM GL_RGB12_EXT} - GL_RGB16_EXT = $8054; - {$EXTERNALSYM GL_RGB16_EXT} - GL_RGBA2_EXT = $8055; - {$EXTERNALSYM GL_RGBA2_EXT} - GL_RGBA4_EXT = $8056; - {$EXTERNALSYM GL_RGBA4_EXT} - GL_RGB5_A1_EXT = $8057; - {$EXTERNALSYM GL_RGB5_A1_EXT} - GL_RGBA8_EXT = $8058; - {$EXTERNALSYM GL_RGBA8_EXT} - GL_RGB10_A2_EXT = $8059; - {$EXTERNALSYM GL_RGB10_A2_EXT} - GL_RGBA12_EXT = $805A; - {$EXTERNALSYM GL_RGBA12_EXT} - GL_RGBA16_EXT = $805B; - {$EXTERNALSYM GL_RGBA16_EXT} - GL_TEXTURE_RED_SIZE_EXT = $805C; - {$EXTERNALSYM GL_TEXTURE_RED_SIZE_EXT} - GL_TEXTURE_GREEN_SIZE_EXT = $805D; - {$EXTERNALSYM GL_TEXTURE_GREEN_SIZE_EXT} - GL_TEXTURE_BLUE_SIZE_EXT = $805E; - {$EXTERNALSYM GL_TEXTURE_BLUE_SIZE_EXT} - GL_TEXTURE_ALPHA_SIZE_EXT = $805F; - {$EXTERNALSYM GL_TEXTURE_ALPHA_SIZE_EXT} - GL_TEXTURE_LUMINANCE_SIZE_EXT = $8060; - {$EXTERNALSYM GL_TEXTURE_LUMINANCE_SIZE_EXT} - GL_TEXTURE_INTENSITY_SIZE_EXT = $8061; - {$EXTERNALSYM GL_TEXTURE_INTENSITY_SIZE_EXT} - GL_REPLACE_EXT = $8062; - {$EXTERNALSYM GL_REPLACE_EXT} - GL_PROXY_TEXTURE_1D_EXT = $8063; - {$EXTERNALSYM GL_PROXY_TEXTURE_1D_EXT} - GL_PROXY_TEXTURE_2D_EXT = $8064; - {$EXTERNALSYM GL_PROXY_TEXTURE_2D_EXT} - GL_TEXTURE_TOO_LARGE_EXT = $8065; - {$EXTERNALSYM GL_TEXTURE_TOO_LARGE_EXT} - - // EXT_texture_object - GL_TEXTURE_PRIORITY_EXT = $8066; - {$EXTERNALSYM GL_TEXTURE_PRIORITY_EXT} - GL_TEXTURE_RESIDENT_EXT = $8067; - {$EXTERNALSYM GL_TEXTURE_RESIDENT_EXT} - GL_TEXTURE_1D_BINDING_EXT = $8068; - {$EXTERNALSYM GL_TEXTURE_1D_BINDING_EXT} - GL_TEXTURE_2D_BINDING_EXT = $8069; - {$EXTERNALSYM GL_TEXTURE_2D_BINDING_EXT} - GL_TEXTURE_3D_BINDING_EXT = $806A; - {$EXTERNALSYM GL_TEXTURE_3D_BINDING_EXT} - - // EXT_texture3D - GL_PACK_SKIP_IMAGES_EXT = $806B; - {$EXTERNALSYM GL_PACK_SKIP_IMAGES_EXT} - GL_PACK_IMAGE_HEIGHT_EXT = $806C; - {$EXTERNALSYM GL_PACK_IMAGE_HEIGHT_EXT} - GL_UNPACK_SKIP_IMAGES_EXT = $806D; - {$EXTERNALSYM GL_UNPACK_SKIP_IMAGES_EXT} - GL_UNPACK_IMAGE_HEIGHT_EXT = $806E; - {$EXTERNALSYM GL_UNPACK_IMAGE_HEIGHT_EXT} - GL_TEXTURE_3D_EXT = $806F; - {$EXTERNALSYM GL_TEXTURE_3D_EXT} - GL_PROXY_TEXTURE_3D_EXT = $8070; - {$EXTERNALSYM GL_PROXY_TEXTURE_3D_EXT} - GL_TEXTURE_DEPTH_EXT = $8071; - {$EXTERNALSYM GL_TEXTURE_DEPTH_EXT} - GL_TEXTURE_WRAP_R_EXT = $8072; - {$EXTERNALSYM GL_TEXTURE_WRAP_R_EXT} - GL_MAX_3D_TEXTURE_SIZE_EXT = $8073; - {$EXTERNALSYM GL_MAX_3D_TEXTURE_SIZE_EXT} - - // SGI_color_matrix - GL_COLOR_MATRIX_SGI = $80B1; - {$EXTERNALSYM GL_COLOR_MATRIX_SGI} - GL_COLOR_MATRIX_STACK_DEPTH_SGI = $80B2; - {$EXTERNALSYM GL_COLOR_MATRIX_STACK_DEPTH_SGI} - GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI = $80B3; - {$EXTERNALSYM GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI} - GL_POST_COLOR_MATRIX_RED_SCALE_SGI = $80B4; - {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_SCALE_SGI} - GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI = $80B5; - {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI} - GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI = $80B6; - {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI} - GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI = $80B7; - {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI} - GL_POST_COLOR_MATRIX_RED_BIAS_SGI = $80B8; - {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_BIAS_SGI} - GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI = $80B9; - {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI} - GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI = $80BA; - {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI} - GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI = $80BB; - {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI} - - // SGI_texture_color_table - GL_TEXTURE_COLOR_TABLE_SGI = $80BC; - {$EXTERNALSYM GL_TEXTURE_COLOR_TABLE_SGI} - GL_PROXY_TEXTURE_COLOR_TABLE_SGI = $80BD; - {$EXTERNALSYM GL_PROXY_TEXTURE_COLOR_TABLE_SGI} - GL_TEXTURE_COLOR_TABLE_BIAS_SGI = $80BE; - {$EXTERNALSYM GL_TEXTURE_COLOR_TABLE_BIAS_SGI} - GL_TEXTURE_COLOR_TABLE_SCALE_SGI = $80BF; - {$EXTERNALSYM GL_TEXTURE_COLOR_TABLE_SCALE_SGI} - - // SGI_color_table - GL_COLOR_TABLE_SGI = $80D0; - {$EXTERNALSYM GL_COLOR_TABLE_SGI} - GL_POST_CONVOLUTION_COLOR_TABLE_SGI = $80D1; - {$EXTERNALSYM GL_POST_CONVOLUTION_COLOR_TABLE_SGI} - GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI = $80D2; - {$EXTERNALSYM GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI} - GL_PROXY_COLOR_TABLE_SGI = $80D3; - {$EXTERNALSYM GL_PROXY_COLOR_TABLE_SGI} - GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI = $80D4; - {$EXTERNALSYM GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI} - GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI = $80D5; - {$EXTERNALSYM GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI} - GL_COLOR_TABLE_SCALE_SGI = $80D6; - {$EXTERNALSYM GL_COLOR_TABLE_SCALE_SGI} - GL_COLOR_TABLE_BIAS_SGI = $80D7; - {$EXTERNALSYM GL_COLOR_TABLE_BIAS_SGI} - GL_COLOR_TABLE_FORMAT_SGI = $80D8; - {$EXTERNALSYM GL_COLOR_TABLE_FORMAT_SGI} - GL_COLOR_TABLE_WIDTH_SGI = $80D9; - {$EXTERNALSYM GL_COLOR_TABLE_WIDTH_SGI} - GL_COLOR_TABLE_RED_SIZE_SGI = $80DA; - {$EXTERNALSYM GL_COLOR_TABLE_RED_SIZE_SGI} - GL_COLOR_TABLE_GREEN_SIZE_SGI = $80DB; - {$EXTERNALSYM GL_COLOR_TABLE_GREEN_SIZE_SGI} - GL_COLOR_TABLE_BLUE_SIZE_SGI = $80DC; - {$EXTERNALSYM GL_COLOR_TABLE_BLUE_SIZE_SGI} - GL_COLOR_TABLE_ALPHA_SIZE_SGI = $80DD; - {$EXTERNALSYM GL_COLOR_TABLE_ALPHA_SIZE_SGI} - GL_COLOR_TABLE_LUMINANCE_SIZE_SGI = $80DE; - {$EXTERNALSYM GL_COLOR_TABLE_LUMINANCE_SIZE_SGI} - GL_COLOR_TABLE_INTENSITY_SIZE_SGI = $80DF; - {$EXTERNALSYM GL_COLOR_TABLE_INTENSITY_SIZE_SGI} - - // EXT_cmyka - GL_CMYK_EXT = $800C; - {$EXTERNALSYM GL_CMYK_EXT} - GL_CMYKA_EXT = $800D; - {$EXTERNALSYM GL_CMYKA_EXT} - GL_PACK_CMYK_HINT_EXT = $800E; - {$EXTERNALSYM GL_PACK_CMYK_HINT_EXT} - GL_UNPACK_CMYK_HINT_EXT = $800F; - {$EXTERNALSYM GL_UNPACK_CMYK_HINT_EXT} - - // EXT_rescale_normal - GL_RESCALE_NORMAL_EXT = $803A; - {$EXTERNALSYM GL_RESCALE_NORMAL_EXT} - - // EXT_clip_volume_hint - GL_CLIP_VOLUME_CLIPPING_HINT_EXT = $80F0; - {$EXTERNALSYM GL_CLIP_VOLUME_CLIPPING_HINT_EXT} - - // EXT_cull_vertex - GL_CULL_VERTEX_EXT = $81AA; - {$EXTERNALSYM GL_CULL_VERTEX_EXT} - GL_CULL_VERTEX_EYE_POSITION_EXT = $81AB; - {$EXTERNALSYM GL_CULL_VERTEX_EYE_POSITION_EXT} - GL_CULL_VERTEX_OBJECT_POSITION_EXT = $81AC; - {$EXTERNALSYM GL_CULL_VERTEX_OBJECT_POSITION_EXT} - - // EXT_index_array_formats - GL_IUI_V2F_EXT = $81AD; - {$EXTERNALSYM GL_IUI_V2F_EXT} - GL_IUI_V3F_EXT = $81AE; - {$EXTERNALSYM GL_IUI_V3F_EXT} - GL_IUI_N3F_V2F_EXT = $81AF; - {$EXTERNALSYM GL_IUI_N3F_V2F_EXT} - GL_IUI_N3F_V3F_EXT = $81B0; - {$EXTERNALSYM GL_IUI_N3F_V3F_EXT} - GL_T2F_IUI_V2F_EXT = $81B1; - {$EXTERNALSYM GL_T2F_IUI_V2F_EXT} - GL_T2F_IUI_V3F_EXT = $81B2; - {$EXTERNALSYM GL_T2F_IUI_V3F_EXT} - GL_T2F_IUI_N3F_V2F_EXT = $81B3; - {$EXTERNALSYM GL_T2F_IUI_N3F_V2F_EXT} - GL_T2F_IUI_N3F_V3F_EXT = $81B4; - {$EXTERNALSYM GL_T2F_IUI_N3F_V3F_EXT} - - // EXT_index_func - GL_INDEX_TEST_EXT = $81B5; - {$EXTERNALSYM GL_INDEX_TEST_EXT} - GL_INDEX_TEST_FUNC_EXT = $81B6; - {$EXTERNALSYM GL_INDEX_TEST_FUNC_EXT} - GL_INDEX_TEST_REF_EXT = $81B7; - {$EXTERNALSYM GL_INDEX_TEST_REF_EXT} - - // EXT_index_material - GL_INDEX_MATERIAL_EXT = $81B8; - {$EXTERNALSYM GL_INDEX_MATERIAL_EXT} - GL_INDEX_MATERIAL_PARAMETER_EXT = $81B9; - {$EXTERNALSYM GL_INDEX_MATERIAL_PARAMETER_EXT} - GL_INDEX_MATERIAL_FACE_EXT = $81BA; - {$EXTERNALSYM GL_INDEX_MATERIAL_FACE_EXT} - - // EXT_misc_attribute - GL_MISC_BIT_EXT = 0; // not yet defined - {$EXTERNALSYM GL_MISC_BIT_EXT} - - // EXT_scene_marker - GL_SCENE_REQUIRED_EXT = 0; // not yet defined - {$EXTERNALSYM GL_SCENE_REQUIRED_EXT} - - // EXT_shared_texture_palette - GL_SHARED_TEXTURE_PALETTE_EXT = $81FB; - {$EXTERNALSYM GL_SHARED_TEXTURE_PALETTE_EXT} - - // EXT_nurbs_tessellator - GLU_NURBS_MODE_EXT = 100160; - {$EXTERNALSYM GLU_NURBS_MODE_EXT} - GLU_NURBS_TESSELLATOR_EXT = 100161; - {$EXTERNALSYM GLU_NURBS_TESSELLATOR_EXT} - GLU_NURBS_RENDERER_EXT = 100162; - {$EXTERNALSYM GLU_NURBS_RENDERER_EXT} - GLU_NURBS_BEGIN_EXT = 100164; - {$EXTERNALSYM GLU_NURBS_BEGIN_EXT} - GLU_NURBS_VERTEX_EXT = 100165; - {$EXTERNALSYM GLU_NURBS_VERTEX_EXT} - GLU_NURBS_NORMAL_EXT = 100166; - {$EXTERNALSYM GLU_NURBS_NORMAL_EXT} - GLU_NURBS_COLOR_EXT = 100167; - {$EXTERNALSYM GLU_NURBS_COLOR_EXT} - GLU_NURBS_TEX_COORD_EXT = 100168; - {$EXTERNALSYM GLU_NURBS_TEX_COORD_EXT} - GLU_NURBS_END_EXT = 100169; - {$EXTERNALSYM GLU_NURBS_END_EXT} - GLU_NURBS_BEGIN_DATA_EXT = 100170; - {$EXTERNALSYM GLU_NURBS_BEGIN_DATA_EXT} - GLU_NURBS_VERTEX_DATA_EXT = 100171; - {$EXTERNALSYM GLU_NURBS_VERTEX_DATA_EXT} - GLU_NURBS_NORMAL_DATA_EXT = 100172; - {$EXTERNALSYM GLU_NURBS_NORMAL_DATA_EXT} - GLU_NURBS_COLOR_DATA_EXT = 100173; - {$EXTERNALSYM GLU_NURBS_COLOR_DATA_EXT} - GLU_NURBS_TEX_COORD_DATA_EXT = 100174; - {$EXTERNALSYM GLU_NURBS_TEX_COORD_DATA_EXT} - GLU_NURBS_END_DATA_EXT = 100175; - {$EXTERNALSYM GLU_NURBS_END_DATA_EXT} - - // EXT_object_space_tess - GLU_OBJECT_PARAMETRIC_ERROR_EXT = 100208; - {$EXTERNALSYM GLU_OBJECT_PARAMETRIC_ERROR_EXT} - GLU_OBJECT_PATH_LENGTH_EXT = 100209; - {$EXTERNALSYM GLU_OBJECT_PATH_LENGTH_EXT} - - // EXT_point_parameters - GL_POINT_SIZE_MIN_EXT = $8126; - {$EXTERNALSYM GL_POINT_SIZE_MIN_EXT} - GL_POINT_SIZE_MAX_EXT = $8127; - {$EXTERNALSYM GL_POINT_SIZE_MAX_EXT} - GL_POINT_FADE_THRESHOLD_SIZE_EXT = $8128; - {$EXTERNALSYM GL_POINT_FADE_THRESHOLD_SIZE_EXT} - GL_DISTANCE_ATTENUATION_EXT = $8129; - {$EXTERNALSYM GL_DISTANCE_ATTENUATION_EXT} - - // EXT_compiled_vertex_array - GL_ARRAY_ELEMENT_LOCK_FIRST_EXT = $81A8; - {$EXTERNALSYM GL_ARRAY_ELEMENT_LOCK_FIRST_EXT} - GL_ARRAY_ELEMENT_LOCK_COUNT_EXT = $81A9; - {$EXTERNALSYM GL_ARRAY_ELEMENT_LOCK_COUNT_EXT} - - // ARB_multitexture - GL_ACTIVE_TEXTURE_ARB = $84E0; - {$EXTERNALSYM GL_ACTIVE_TEXTURE_ARB} - GL_CLIENT_ACTIVE_TEXTURE_ARB = $84E1; - {$EXTERNALSYM GL_CLIENT_ACTIVE_TEXTURE_ARB} - GL_MAX_TEXTURE_UNITS_ARB = $84E2; - {$EXTERNALSYM GL_MAX_TEXTURE_UNITS_ARB} - GL_TEXTURE0_ARB = $84C0; - {$EXTERNALSYM GL_TEXTURE0_ARB} - GL_TEXTURE1_ARB = $84C1; - {$EXTERNALSYM GL_TEXTURE1_ARB} - GL_TEXTURE2_ARB = $84C2; - {$EXTERNALSYM GL_TEXTURE2_ARB} - GL_TEXTURE3_ARB = $84C3; - {$EXTERNALSYM GL_TEXTURE3_ARB} - GL_TEXTURE4_ARB = $84C4; - {$EXTERNALSYM GL_TEXTURE4_ARB} - GL_TEXTURE5_ARB = $84C5; - {$EXTERNALSYM GL_TEXTURE5_ARB} - GL_TEXTURE6_ARB = $84C6; - {$EXTERNALSYM GL_TEXTURE6_ARB} - GL_TEXTURE7_ARB = $84C7; - {$EXTERNALSYM GL_TEXTURE7_ARB} - GL_TEXTURE8_ARB = $84C8; - {$EXTERNALSYM GL_TEXTURE8_ARB} - GL_TEXTURE9_ARB = $84C9; - {$EXTERNALSYM GL_TEXTURE9_ARB} - GL_TEXTURE10_ARB = $84CA; - {$EXTERNALSYM GL_TEXTURE10_ARB} - GL_TEXTURE11_ARB = $84CB; - {$EXTERNALSYM GL_TEXTURE11_ARB} - GL_TEXTURE12_ARB = $84CC; - {$EXTERNALSYM GL_TEXTURE12_ARB} - GL_TEXTURE13_ARB = $84CD; - {$EXTERNALSYM GL_TEXTURE13_ARB} - GL_TEXTURE14_ARB = $84CE; - {$EXTERNALSYM GL_TEXTURE14_ARB} - GL_TEXTURE15_ARB = $84CF; - {$EXTERNALSYM GL_TEXTURE15_ARB} - GL_TEXTURE16_ARB = $84D0; - {$EXTERNALSYM GL_TEXTURE16_ARB} - GL_TEXTURE17_ARB = $84D1; - {$EXTERNALSYM GL_TEXTURE17_ARB} - GL_TEXTURE18_ARB = $84D2; - {$EXTERNALSYM GL_TEXTURE18_ARB} - GL_TEXTURE19_ARB = $84D3; - {$EXTERNALSYM GL_TEXTURE19_ARB} - GL_TEXTURE20_ARB = $84D4; - {$EXTERNALSYM GL_TEXTURE20_ARB} - GL_TEXTURE21_ARB = $84D5; - {$EXTERNALSYM GL_TEXTURE21_ARB} - GL_TEXTURE22_ARB = $84D6; - {$EXTERNALSYM GL_TEXTURE22_ARB} - GL_TEXTURE23_ARB = $84D7; - {$EXTERNALSYM GL_TEXTURE23_ARB} - GL_TEXTURE24_ARB = $84D8; - {$EXTERNALSYM GL_TEXTURE24_ARB} - GL_TEXTURE25_ARB = $84D9; - {$EXTERNALSYM GL_TEXTURE25_ARB} - GL_TEXTURE26_ARB = $84DA; - {$EXTERNALSYM GL_TEXTURE26_ARB} - GL_TEXTURE27_ARB = $84DB; - {$EXTERNALSYM GL_TEXTURE27_ARB} - GL_TEXTURE28_ARB = $84DC; - {$EXTERNALSYM GL_TEXTURE28_ARB} - GL_TEXTURE29_ARB = $84DD; - {$EXTERNALSYM GL_TEXTURE29_ARB} - GL_TEXTURE30_ARB = $84DE; - {$EXTERNALSYM GL_TEXTURE30_ARB} - GL_TEXTURE31_ARB = $84DF; - {$EXTERNALSYM GL_TEXTURE31_ARB} - - // EXT_stencil_wrap - GL_INCR_WRAP_EXT = $8507; - {$EXTERNALSYM GL_INCR_WRAP_EXT} - GL_DECR_WRAP_EXT = $8508; - {$EXTERNALSYM GL_DECR_WRAP_EXT} - - // NV_texgen_reflection - GL_NORMAL_MAP_NV = $8511; - {$EXTERNALSYM GL_NORMAL_MAP_NV} - GL_REFLECTION_MAP_NV = $8512; - {$EXTERNALSYM GL_REFLECTION_MAP_NV} - - // EXT_texture_env_combine - GL_COMBINE_EXT = $8570; - {$EXTERNALSYM GL_COMBINE_EXT} - GL_COMBINE_RGB_EXT = $8571; - {$EXTERNALSYM GL_COMBINE_RGB_EXT} - GL_COMBINE_ALPHA_EXT = $8572; - {$EXTERNALSYM GL_COMBINE_ALPHA_EXT} - GL_RGB_SCALE_EXT = $8573; - {$EXTERNALSYM GL_RGB_SCALE_EXT} - GL_ADD_SIGNED_EXT = $8574; - {$EXTERNALSYM GL_ADD_SIGNED_EXT} - GL_INTERPOLATE_EXT = $8575; - {$EXTERNALSYM GL_INTERPOLATE_EXT} - GL_CONSTANT_EXT = $8576; - {$EXTERNALSYM GL_CONSTANT_EXT} - GL_PRIMARY_COLOR_EXT = $8577; - {$EXTERNALSYM GL_PRIMARY_COLOR_EXT} - GL_PREVIOUS_EXT = $8578; - {$EXTERNALSYM GL_PREVIOUS_EXT} - GL_SOURCE0_RGB_EXT = $8580; - {$EXTERNALSYM GL_SOURCE0_RGB_EXT} - GL_SOURCE1_RGB_EXT = $8581; - {$EXTERNALSYM GL_SOURCE1_RGB_EXT} - GL_SOURCE2_RGB_EXT = $8582; - {$EXTERNALSYM GL_SOURCE2_RGB_EXT} - GL_SOURCE0_ALPHA_EXT = $8588; - {$EXTERNALSYM GL_SOURCE0_ALPHA_EXT} - GL_SOURCE1_ALPHA_EXT = $8589; - {$EXTERNALSYM GL_SOURCE1_ALPHA_EXT} - GL_SOURCE2_ALPHA_EXT = $858A; - {$EXTERNALSYM GL_SOURCE2_ALPHA_EXT} - GL_OPERAND0_RGB_EXT = $8590; - {$EXTERNALSYM GL_OPERAND0_RGB_EXT} - GL_OPERAND1_RGB_EXT = $8591; - {$EXTERNALSYM GL_OPERAND1_RGB_EXT} - GL_OPERAND2_RGB_EXT = $8592; - {$EXTERNALSYM GL_OPERAND2_RGB_EXT} - GL_OPERAND0_ALPHA_EXT = $8598; - {$EXTERNALSYM GL_OPERAND0_ALPHA_EXT} - GL_OPERAND1_ALPHA_EXT = $8599; - {$EXTERNALSYM GL_OPERAND1_ALPHA_EXT} - GL_OPERAND2_ALPHA_EXT = $859A; - {$EXTERNALSYM GL_OPERAND2_ALPHA_EXT} - - // NV_texture_env_combine4 - GL_COMBINE4_NV = $8503; - {$EXTERNALSYM GL_COMBINE4_NV} - GL_SOURCE3_RGB_NV = $8583; - {$EXTERNALSYM GL_SOURCE3_RGB_NV} - GL_SOURCE3_ALPHA_NV = $858B; - {$EXTERNALSYM GL_SOURCE3_ALPHA_NV} - GL_OPERAND3_RGB_NV = $8593; - {$EXTERNALSYM GL_OPERAND3_RGB_NV} - GL_OPERAND3_ALPHA_NV = $859B; - {$EXTERNALSYM GL_OPERAND3_ALPHA_NV} - - GL_BLEND_EQUATION = $8009; - {$EXTERNALSYM GL_BLEND_EQUATION} - GL_TABLE_TOO_LARGE = $8031; - {$EXTERNALSYM GL_TABLE_TOO_LARGE} - GL_UNSIGNED_BYTE_3_3_2 = $8032; - {$EXTERNALSYM GL_UNSIGNED_BYTE_3_3_2} - GL_UNSIGNED_SHORT_4_4_4_4 = $8033; - {$EXTERNALSYM GL_UNSIGNED_SHORT_4_4_4_4} - GL_UNSIGNED_SHORT_5_5_5_1 = $8034; - {$EXTERNALSYM GL_UNSIGNED_SHORT_5_5_5_1} - GL_UNSIGNED_INT_8_8_8_8 = $8035; - {$EXTERNALSYM GL_UNSIGNED_INT_8_8_8_8} - GL_UNSIGNED_INT_10_10_10_2 = $8036; - {$EXTERNALSYM GL_UNSIGNED_INT_10_10_10_2} - GL_UNSIGNED_BYTE_2_3_3_REV = $8362; - {$EXTERNALSYM GL_UNSIGNED_BYTE_2_3_3_REV} - GL_UNSIGNED_SHORT_5_6_5 = $8363; - {$EXTERNALSYM GL_UNSIGNED_SHORT_5_6_5} - GL_UNSIGNED_SHORT_5_6_5_REV = $8364; - {$EXTERNALSYM GL_UNSIGNED_SHORT_5_6_5_REV} - GL_UNSIGNED_SHORT_4_4_4_4_REV = $8365; - {$EXTERNALSYM GL_UNSIGNED_SHORT_4_4_4_4_REV} - GL_UNSIGNED_SHORT_1_5_5_5_REV = $8366; - {$EXTERNALSYM GL_UNSIGNED_SHORT_1_5_5_5_REV} - GL_UNSIGNED_INT_8_8_8_8_REV = $8367; - {$EXTERNALSYM GL_UNSIGNED_INT_8_8_8_8_REV} - GL_UNSIGNED_INT_2_10_10_10_REV = $8368; - {$EXTERNALSYM GL_UNSIGNED_INT_2_10_10_10_REV} - - // GL_ARB_transpose_matrix - GL_TRANSPOSE_MODELVIEW_MATRIX_ARB = $84E3; - {$EXTERNALSYM GL_TRANSPOSE_MODELVIEW_MATRIX_ARB} - GL_TRANSPOSE_PROJECTION_MATRIX_ARB = $84E4; - {$EXTERNALSYM GL_TRANSPOSE_PROJECTION_MATRIX_ARB} - GL_TRANSPOSE_TEXTURE_MATRIX_ARB = $84E5; - {$EXTERNALSYM GL_TRANSPOSE_TEXTURE_MATRIX_ARB} - GL_TRANSPOSE_COLOR_MATRIX_ARB = $84E6; - {$EXTERNALSYM GL_TRANSPOSE_COLOR_MATRIX_ARB} - - // GL_ARB_multisample - GL_MULTISAMPLE_ARB = $809D; - {$EXTERNALSYM GL_MULTISAMPLE_ARB} - GL_SAMPLE_ALPHA_TO_COVERAGE_ARB = $809E; - {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_COVERAGE_ARB} - GL_SAMPLE_ALPHA_TO_ONE_ARB = $809F; - {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_ONE_ARB} - GL_SAMPLE_COVERAGE_ARB = $80A0; - {$EXTERNALSYM GL_SAMPLE_COVERAGE_ARB} - GL_SAMPLE_BUFFERS_ARB = $80A8; - {$EXTERNALSYM GL_SAMPLE_BUFFERS_ARB} - GL_SAMPLES_ARB = $80A9; - {$EXTERNALSYM GL_SAMPLES_ARB} - GL_SAMPLE_COVERAGE_VALUE_ARB = $80AA; - {$EXTERNALSYM GL_SAMPLE_COVERAGE_VALUE_ARB} - GL_SAMPLE_COVERAGE_INVERT_ARB = $80AB; - {$EXTERNALSYM GL_SAMPLE_COVERAGE_INVERT_ARB} - GL_MULTISAMPLE_BIT_ARB = $20000000; - {$EXTERNALSYM GL_MULTISAMPLE_BIT_ARB} - GLX_SAMPLE_BUFFERS_ARB = 100000; - {$EXTERNALSYM GLX_SAMPLE_BUFFERS_ARB} - GLX_SAMPLES_ARB = 100001; - {$EXTERNALSYM GLX_SAMPLES_ARB} - WGL_SAMPLE_BUFFERS_ARB = $2041; - {$EXTERNALSYM WGL_SAMPLE_BUFFERS_ARB} - WGL_SAMPLES_ARB = $2042; - {$EXTERNALSYM WGL_SAMPLES_ARB} - - // GL_ARB_texture_cube_map - GL_NORMAL_MAP_ARB = $8511; - {$EXTERNALSYM GL_NORMAL_MAP_ARB} - GL_REFLECTION_MAP_ARB = $8512; - {$EXTERNALSYM GL_REFLECTION_MAP_ARB} - GL_TEXTURE_CUBE_MAP_ARB = $8513; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_ARB} - GL_TEXTURE_BINDING_CUBE_MAP_ARB = $8514; - {$EXTERNALSYM GL_TEXTURE_BINDING_CUBE_MAP_ARB} - GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = $8515; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB} - GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = $8516; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB} - GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = $8517; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB} - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = $8518; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB} - GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = $8519; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB} - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = $851A; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB} - GL_PROXY_TEXTURE_CUBE_MAP_ARB = $851B; - {$EXTERNALSYM GL_PROXY_TEXTURE_CUBE_MAP_ARB} - GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB = $851C; - {$EXTERNALSYM GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB} - - // GL_ARB_texture_compression - GL_COMPRESSED_ALPHA_ARB = $84E9; - {$EXTERNALSYM GL_COMPRESSED_ALPHA_ARB} - GL_COMPRESSED_LUMINANCE_ARB = $84EA; - {$EXTERNALSYM GL_COMPRESSED_LUMINANCE_ARB} - GL_COMPRESSED_LUMINANCE_ALPHA_ARB = $84EB; - {$EXTERNALSYM GL_COMPRESSED_LUMINANCE_ALPHA_ARB} - GL_COMPRESSED_INTENSITY_ARB = $84EC; - {$EXTERNALSYM GL_COMPRESSED_INTENSITY_ARB} - GL_COMPRESSED_RGB_ARB = $84ED; - {$EXTERNALSYM GL_COMPRESSED_RGB_ARB} - GL_COMPRESSED_RGBA_ARB = $84EE; - {$EXTERNALSYM GL_COMPRESSED_RGBA_ARB} - GL_TEXTURE_COMPRESSION_HINT_ARB = $84EF; - {$EXTERNALSYM GL_TEXTURE_COMPRESSION_HINT_ARB} - GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB = $86A0; - {$EXTERNALSYM GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB} - GL_TEXTURE_COMPRESSED_ARB = $86A1; - {$EXTERNALSYM GL_TEXTURE_COMPRESSED_ARB} - GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB = $86A2; - {$EXTERNALSYM GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB} - GL_COMPRESSED_TEXTURE_FORMATS_ARB = $86A3; - {$EXTERNALSYM GL_COMPRESSED_TEXTURE_FORMATS_ARB} - - // GL_ARB_vertex_blend - GL_MAX_VERTEX_UNITS_ARB = $86A4; - {$EXTERNALSYM GL_MAX_VERTEX_UNITS_ARB} - GL_ACTIVE_VERTEX_UNITS_ARB = $86A5; - {$EXTERNALSYM GL_ACTIVE_VERTEX_UNITS_ARB} - GL_WEIGHT_SUM_UNITY_ARB = $86A6; - {$EXTERNALSYM GL_WEIGHT_SUM_UNITY_ARB} - GL_VERTEX_BLEND_ARB = $86A7; - {$EXTERNALSYM GL_VERTEX_BLEND_ARB} - GL_CURRENT_WEIGHT_ARB = $86A8; - {$EXTERNALSYM GL_CURRENT_WEIGHT_ARB} - GL_WEIGHT_ARRAY_TYPE_ARB = $86A9; - {$EXTERNALSYM GL_WEIGHT_ARRAY_TYPE_ARB} - GL_WEIGHT_ARRAY_STRIDE_ARB = $86AA; - {$EXTERNALSYM GL_WEIGHT_ARRAY_STRIDE_ARB} - GL_WEIGHT_ARRAY_SIZE_ARB = $86AB; - {$EXTERNALSYM GL_WEIGHT_ARRAY_SIZE_ARB} - GL_WEIGHT_ARRAY_POINTER_ARB = $86AC; - {$EXTERNALSYM GL_WEIGHT_ARRAY_POINTER_ARB} - GL_WEIGHT_ARRAY_ARB = $86AD; - {$EXTERNALSYM GL_WEIGHT_ARRAY_ARB} - GL_MODELVIEW0_ARB = $1700; - {$EXTERNALSYM GL_MODELVIEW0_ARB} - GL_MODELVIEW1_ARB = $850A; - {$EXTERNALSYM GL_MODELVIEW1_ARB} - GL_MODELVIEW2_ARB = $8722; - {$EXTERNALSYM GL_MODELVIEW2_ARB} - GL_MODELVIEW3_ARB = $8723; - {$EXTERNALSYM GL_MODELVIEW3_ARB} - GL_MODELVIEW4_ARB = $8724; - {$EXTERNALSYM GL_MODELVIEW4_ARB} - GL_MODELVIEW5_ARB = $8725; - {$EXTERNALSYM GL_MODELVIEW5_ARB} - GL_MODELVIEW6_ARB = $8726; - {$EXTERNALSYM GL_MODELVIEW6_ARB} - GL_MODELVIEW7_ARB = $8727; - {$EXTERNALSYM GL_MODELVIEW7_ARB} - GL_MODELVIEW8_ARB = $8728; - {$EXTERNALSYM GL_MODELVIEW8_ARB} - GL_MODELVIEW9_ARB = $8729; - {$EXTERNALSYM GL_MODELVIEW9_ARB} - GL_MODELVIEW10_ARB = $872A; - {$EXTERNALSYM GL_MODELVIEW10_ARB} - GL_MODELVIEW11_ARB = $872B; - {$EXTERNALSYM GL_MODELVIEW11_ARB} - GL_MODELVIEW12_ARB = $872C; - {$EXTERNALSYM GL_MODELVIEW12_ARB} - GL_MODELVIEW13_ARB = $872D; - {$EXTERNALSYM GL_MODELVIEW13_ARB} - GL_MODELVIEW14_ARB = $872E; - {$EXTERNALSYM GL_MODELVIEW14_ARB} - GL_MODELVIEW15_ARB = $872F; - {$EXTERNALSYM GL_MODELVIEW15_ARB} - GL_MODELVIEW16_ARB = $8730; - {$EXTERNALSYM GL_MODELVIEW16_ARB} - GL_MODELVIEW17_ARB = $8731; - {$EXTERNALSYM GL_MODELVIEW17_ARB} - GL_MODELVIEW18_ARB = $8732; - {$EXTERNALSYM GL_MODELVIEW18_ARB} - GL_MODELVIEW19_ARB = $8733; - {$EXTERNALSYM GL_MODELVIEW19_ARB} - GL_MODELVIEW20_ARB = $8734; - {$EXTERNALSYM GL_MODELVIEW20_ARB} - GL_MODELVIEW21_ARB = $8735; - {$EXTERNALSYM GL_MODELVIEW21_ARB} - GL_MODELVIEW22_ARB = $8736; - {$EXTERNALSYM GL_MODELVIEW22_ARB} - GL_MODELVIEW23_ARB = $8737; - {$EXTERNALSYM GL_MODELVIEW23_ARB} - GL_MODELVIEW24_ARB = $8738; - {$EXTERNALSYM GL_MODELVIEW24_ARB} - GL_MODELVIEW25_ARB = $8739; - {$EXTERNALSYM GL_MODELVIEW25_ARB} - GL_MODELVIEW26_ARB = $873A; - {$EXTERNALSYM GL_MODELVIEW26_ARB} - GL_MODELVIEW27_ARB = $873B; - {$EXTERNALSYM GL_MODELVIEW27_ARB} - GL_MODELVIEW28_ARB = $873C; - {$EXTERNALSYM GL_MODELVIEW28_ARB} - GL_MODELVIEW29_ARB = $873D; - {$EXTERNALSYM GL_MODELVIEW29_ARB} - GL_MODELVIEW30_ARB = $873E; - {$EXTERNALSYM GL_MODELVIEW30_ARB} - GL_MODELVIEW31_ARB = $873F; - {$EXTERNALSYM GL_MODELVIEW31_ARB} - - // GL_SGIS_texture_filter4 - GL_FILTER4_SGIS = $8146; - {$EXTERNALSYM GL_FILTER4_SGIS} - GL_TEXTURE_FILTER4_SIZE_SGIS = $8147; - {$EXTERNALSYM GL_TEXTURE_FILTER4_SIZE_SGIS} - - // GL_SGIS_pixel_texture - GL_PIXEL_TEXTURE_SGIS = $8353; - {$EXTERNALSYM GL_PIXEL_TEXTURE_SGIS} - GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS = $8354; - {$EXTERNALSYM GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS} - GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS = $8355; - {$EXTERNALSYM GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS} - GL_PIXEL_GROUP_COLOR_SGIS = $8356; - {$EXTERNALSYM GL_PIXEL_GROUP_COLOR_SGIS} - - // GL_SGIX_pixel_texture - GL_PIXEL_TEX_GEN_SGIX = $8139; - {$EXTERNALSYM GL_PIXEL_TEX_GEN_SGIX} - GL_PIXEL_TEX_GEN_MODE_SGIX = $832B; - {$EXTERNALSYM GL_PIXEL_TEX_GEN_MODE_SGIX} - - // GL_SGIS_texture4D - GL_PACK_SKIP_VOLUMES_SGIS = $8130; - {$EXTERNALSYM GL_PACK_SKIP_VOLUMES_SGIS} - GL_PACK_IMAGE_DEPTH_SGIS = $8131; - {$EXTERNALSYM GL_PACK_IMAGE_DEPTH_SGIS} - GL_UNPACK_SKIP_VOLUMES_SGIS = $8132; - {$EXTERNALSYM GL_UNPACK_SKIP_VOLUMES_SGIS} - GL_UNPACK_IMAGE_DEPTH_SGIS = $8133; - {$EXTERNALSYM GL_UNPACK_IMAGE_DEPTH_SGIS} - GL_TEXTURE_4D_SGIS = $8134; - {$EXTERNALSYM GL_TEXTURE_4D_SGIS} - GL_PROXY_TEXTURE_4D_SGIS = $8135; - {$EXTERNALSYM GL_PROXY_TEXTURE_4D_SGIS} - GL_TEXTURE_4DSIZE_SGIS = $8136; - {$EXTERNALSYM GL_TEXTURE_4DSIZE_SGIS} - GL_TEXTURE_WRAP_Q_SGIS = $8137; - {$EXTERNALSYM GL_TEXTURE_WRAP_Q_SGIS} - GL_MAX_4D_TEXTURE_SIZE_SGIS = $8138; - {$EXTERNALSYM GL_MAX_4D_TEXTURE_SIZE_SGIS} - GL_TEXTURE_4D_BINDING_SGIS = $814F; - {$EXTERNALSYM GL_TEXTURE_4D_BINDING_SGIS} - - // GL_SGIS_detail_texture - GL_DETAIL_TEXTURE_2D_SGIS = $8095; - {$EXTERNALSYM GL_DETAIL_TEXTURE_2D_SGIS} - GL_DETAIL_TEXTURE_2D_BINDING_SGIS = $8096; - {$EXTERNALSYM GL_DETAIL_TEXTURE_2D_BINDING_SGIS} - GL_LINEAR_DETAIL_SGIS = $8097; - {$EXTERNALSYM GL_LINEAR_DETAIL_SGIS} - GL_LINEAR_DETAIL_ALPHA_SGIS = $8098; - {$EXTERNALSYM GL_LINEAR_DETAIL_ALPHA_SGIS} - GL_LINEAR_DETAIL_COLOR_SGIS = $8099; - {$EXTERNALSYM GL_LINEAR_DETAIL_COLOR_SGIS} - GL_DETAIL_TEXTURE_LEVEL_SGIS = $809A; - {$EXTERNALSYM GL_DETAIL_TEXTURE_LEVEL_SGIS} - GL_DETAIL_TEXTURE_MODE_SGIS = $809B; - {$EXTERNALSYM GL_DETAIL_TEXTURE_MODE_SGIS} - GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS = $809C; - {$EXTERNALSYM GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS} - - // GL_SGIS_sharpen_texture - GL_LINEAR_SHARPEN_SGIS = $80AD; - {$EXTERNALSYM GL_LINEAR_SHARPEN_SGIS} - GL_LINEAR_SHARPEN_ALPHA_SGIS = $80AE; - {$EXTERNALSYM GL_LINEAR_SHARPEN_ALPHA_SGIS} - GL_LINEAR_SHARPEN_COLOR_SGIS = $80AF; - {$EXTERNALSYM GL_LINEAR_SHARPEN_COLOR_SGIS} - GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS = $80B0; - {$EXTERNALSYM GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS} - - // GL_SGIS_texture_lod - GL_TEXTURE_MIN_LOD_SGIS = $813A; - {$EXTERNALSYM GL_TEXTURE_MIN_LOD_SGIS} - GL_TEXTURE_MAX_LOD_SGIS = $813B; - {$EXTERNALSYM GL_TEXTURE_MAX_LOD_SGIS} - GL_TEXTURE_BASE_LEVEL_SGIS = $813C; - {$EXTERNALSYM GL_TEXTURE_BASE_LEVEL_SGIS} - GL_TEXTURE_MAX_LEVEL_SGIS = $813D; - {$EXTERNALSYM GL_TEXTURE_MAX_LEVEL_SGIS} - - // GL_SGIS_multisample - GL_MULTISAMPLE_SGIS = $809D; - {$EXTERNALSYM GL_MULTISAMPLE_SGIS} - GL_SAMPLE_ALPHA_TO_MASK_SGIS = $809E; - {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_MASK_SGIS} - GL_SAMPLE_ALPHA_TO_ONE_SGIS = $809F; - {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_ONE_SGIS} - GL_SAMPLE_MASK_SGIS = $80A0; - {$EXTERNALSYM GL_SAMPLE_MASK_SGIS} - GL_1PASS_SGIS = $80A1; - {$EXTERNALSYM GL_1PASS_SGIS} - GL_2PASS_0_SGIS = $80A2; - {$EXTERNALSYM GL_2PASS_0_SGIS} - GL_2PASS_1_SGIS = $80A3; - {$EXTERNALSYM GL_2PASS_1_SGIS} - GL_4PASS_0_SGIS = $80A4; - {$EXTERNALSYM GL_4PASS_0_SGIS} - GL_4PASS_1_SGIS = $80A5; - {$EXTERNALSYM GL_4PASS_1_SGIS} - GL_4PASS_2_SGIS = $80A6; - {$EXTERNALSYM GL_4PASS_2_SGIS} - GL_4PASS_3_SGIS = $80A7; - {$EXTERNALSYM GL_4PASS_3_SGIS} - GL_SAMPLE_BUFFERS_SGIS = $80A8; - {$EXTERNALSYM GL_SAMPLE_BUFFERS_SGIS} - GL_SAMPLES_SGIS = $80A9; - {$EXTERNALSYM GL_SAMPLES_SGIS} - GL_SAMPLE_MASK_VALUE_SGIS = $80AA; - {$EXTERNALSYM GL_SAMPLE_MASK_VALUE_SGIS} - GL_SAMPLE_MASK_INVERT_SGIS = $80AB; - {$EXTERNALSYM GL_SAMPLE_MASK_INVERT_SGIS} - GL_SAMPLE_PATTERN_SGIS = $80AC; - {$EXTERNALSYM GL_SAMPLE_PATTERN_SGIS} - - // GL_SGIS_generate_mipmap - GL_GENERATE_MIPMAP_SGIS = $8191; - {$EXTERNALSYM GL_GENERATE_MIPMAP_SGIS} - GL_GENERATE_MIPMAP_HINT_SGIS = $8192; - {$EXTERNALSYM GL_GENERATE_MIPMAP_HINT_SGIS} - - // GL_SGIX_clipmap - GL_LINEAR_CLIPMAP_LINEAR_SGIX = $8170; - {$EXTERNALSYM GL_LINEAR_CLIPMAP_LINEAR_SGIX} - GL_TEXTURE_CLIPMAP_CENTER_SGIX = $8171; - {$EXTERNALSYM GL_TEXTURE_CLIPMAP_CENTER_SGIX} - GL_TEXTURE_CLIPMAP_FRAME_SGIX = $8172; - {$EXTERNALSYM GL_TEXTURE_CLIPMAP_FRAME_SGIX} - GL_TEXTURE_CLIPMAP_OFFSET_SGIX = $8173; - {$EXTERNALSYM GL_TEXTURE_CLIPMAP_OFFSET_SGIX} - GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX = $8174; - {$EXTERNALSYM GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX} - GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX = $8175; - {$EXTERNALSYM GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX} - GL_TEXTURE_CLIPMAP_DEPTH_SGIX = $8176; - {$EXTERNALSYM GL_TEXTURE_CLIPMAP_DEPTH_SGIX} - GL_MAX_CLIPMAP_DEPTH_SGIX = $8177; - {$EXTERNALSYM GL_MAX_CLIPMAP_DEPTH_SGIX} - GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX = $8178; - {$EXTERNALSYM GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX} - GL_NEAREST_CLIPMAP_NEAREST_SGIX = $844D; - {$EXTERNALSYM GL_NEAREST_CLIPMAP_NEAREST_SGIX} - GL_NEAREST_CLIPMAP_LINEAR_SGIX = $844E; - {$EXTERNALSYM GL_NEAREST_CLIPMAP_LINEAR_SGIX} - GL_LINEAR_CLIPMAP_NEAREST_SGIX = $844F; - {$EXTERNALSYM GL_LINEAR_CLIPMAP_NEAREST_SGIX} - - // GL_SGIX_shadow - GL_TEXTURE_COMPARE_SGIX = $819A; - {$EXTERNALSYM GL_TEXTURE_COMPARE_SGIX} - GL_TEXTURE_COMPARE_OPERATOR_SGIX = $819B; - {$EXTERNALSYM GL_TEXTURE_COMPARE_OPERATOR_SGIX} - GL_TEXTURE_LEQUAL_R_SGIX = $819C; - {$EXTERNALSYM GL_TEXTURE_LEQUAL_R_SGIX} - GL_TEXTURE_GEQUAL_R_SGIX = $819D; - {$EXTERNALSYM GL_TEXTURE_GEQUAL_R_SGIX} - - // GL_SGIS_texture_edge_clamp - GL_CLAMP_TO_EDGE_SGIS = $812F; - {$EXTERNALSYM GL_CLAMP_TO_EDGE_SGIS} - - // GL_SGIS_texture_border_clamp - GL_CLAMP_TO_BORDER_SGIS = $812D; - {$EXTERNALSYM GL_CLAMP_TO_BORDER_SGIS} - - // GL_SGIX_interlace - GL_INTERLACE_SGIX = $8094; - {$EXTERNALSYM GL_INTERLACE_SGIX} - - // GL_SGIX_pixel_tiles - GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX = $813E; - {$EXTERNALSYM GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX} - GL_PIXEL_TILE_CACHE_INCREMENT_SGIX = $813F; - {$EXTERNALSYM GL_PIXEL_TILE_CACHE_INCREMENT_SGIX} - GL_PIXEL_TILE_WIDTH_SGIX = $8140; - {$EXTERNALSYM GL_PIXEL_TILE_WIDTH_SGIX} - GL_PIXEL_TILE_HEIGHT_SGIX = $8141; - {$EXTERNALSYM GL_PIXEL_TILE_HEIGHT_SGIX} - GL_PIXEL_TILE_GRID_WIDTH_SGIX = $8142; - {$EXTERNALSYM GL_PIXEL_TILE_GRID_WIDTH_SGIX} - GL_PIXEL_TILE_GRID_HEIGHT_SGIX = $8143; - {$EXTERNALSYM GL_PIXEL_TILE_GRID_HEIGHT_SGIX} - GL_PIXEL_TILE_GRID_DEPTH_SGIX = $8144; - {$EXTERNALSYM GL_PIXEL_TILE_GRID_DEPTH_SGIX} - GL_PIXEL_TILE_CACHE_SIZE_SGIX = $8145; - {$EXTERNALSYM GL_PIXEL_TILE_CACHE_SIZE_SGIX} - - // GL_SGIS_texture_select - GL_DUAL_ALPHA4_SGIS = $8110; - {$EXTERNALSYM GL_DUAL_ALPHA4_SGIS} - GL_DUAL_ALPHA8_SGIS = $8111; - {$EXTERNALSYM GL_DUAL_ALPHA8_SGIS} - GL_DUAL_ALPHA12_SGIS = $8112; - {$EXTERNALSYM GL_DUAL_ALPHA12_SGIS} - GL_DUAL_ALPHA16_SGIS = $8113; - {$EXTERNALSYM GL_DUAL_ALPHA16_SGIS} - GL_DUAL_LUMINANCE4_SGIS = $8114; - {$EXTERNALSYM GL_DUAL_LUMINANCE4_SGIS} - GL_DUAL_LUMINANCE8_SGIS = $8115; - {$EXTERNALSYM GL_DUAL_LUMINANCE8_SGIS} - GL_DUAL_LUMINANCE12_SGIS = $8116; - {$EXTERNALSYM GL_DUAL_LUMINANCE12_SGIS} - GL_DUAL_LUMINANCE16_SGIS = $8117; - {$EXTERNALSYM GL_DUAL_LUMINANCE16_SGIS} - GL_DUAL_INTENSITY4_SGIS = $8118; - {$EXTERNALSYM GL_DUAL_INTENSITY4_SGIS} - GL_DUAL_INTENSITY8_SGIS = $8119; - {$EXTERNALSYM GL_DUAL_INTENSITY8_SGIS} - GL_DUAL_INTENSITY12_SGIS = $811A; - {$EXTERNALSYM GL_DUAL_INTENSITY12_SGIS} - GL_DUAL_INTENSITY16_SGIS = $811B; - {$EXTERNALSYM GL_DUAL_INTENSITY16_SGIS} - GL_DUAL_LUMINANCE_ALPHA4_SGIS = $811C; - {$EXTERNALSYM GL_DUAL_LUMINANCE_ALPHA4_SGIS} - GL_DUAL_LUMINANCE_ALPHA8_SGIS = $811D; - {$EXTERNALSYM GL_DUAL_LUMINANCE_ALPHA8_SGIS} - GL_QUAD_ALPHA4_SGIS = $811E; - {$EXTERNALSYM GL_QUAD_ALPHA4_SGIS} - GL_QUAD_ALPHA8_SGIS = $811F; - {$EXTERNALSYM GL_QUAD_ALPHA8_SGIS} - GL_QUAD_LUMINANCE4_SGIS = $8120; - {$EXTERNALSYM GL_QUAD_LUMINANCE4_SGIS} - GL_QUAD_LUMINANCE8_SGIS = $8121; - {$EXTERNALSYM GL_QUAD_LUMINANCE8_SGIS} - GL_QUAD_INTENSITY4_SGIS = $8122; - {$EXTERNALSYM GL_QUAD_INTENSITY4_SGIS} - GL_QUAD_INTENSITY8_SGIS = $8123; - {$EXTERNALSYM GL_QUAD_INTENSITY8_SGIS} - GL_DUAL_TEXTURE_SELECT_SGIS = $8124; - {$EXTERNALSYM GL_DUAL_TEXTURE_SELECT_SGIS} - GL_QUAD_TEXTURE_SELECT_SGIS = $8125; - {$EXTERNALSYM GL_QUAD_TEXTURE_SELECT_SGIS} - - // GL_SGIX_sprite - GL_SPRITE_SGIX = $8148; - {$EXTERNALSYM GL_SPRITE_SGIX} - GL_SPRITE_MODE_SGIX = $8149; - {$EXTERNALSYM GL_SPRITE_MODE_SGIX} - GL_SPRITE_AXIS_SGIX = $814A; - {$EXTERNALSYM GL_SPRITE_AXIS_SGIX} - GL_SPRITE_TRANSLATION_SGIX = $814B; - {$EXTERNALSYM GL_SPRITE_TRANSLATION_SGIX} - GL_SPRITE_AXIAL_SGIX = $814C; - {$EXTERNALSYM GL_SPRITE_AXIAL_SGIX} - GL_SPRITE_OBJECT_ALIGNED_SGIX = $814D; - {$EXTERNALSYM GL_SPRITE_OBJECT_ALIGNED_SGIX} - GL_SPRITE_EYE_ALIGNED_SGIX = $814E; - {$EXTERNALSYM GL_SPRITE_EYE_ALIGNED_SGIX} - - // GL_SGIX_texture_multi_buffer - GL_TEXTURE_MULTI_BUFFER_HINT_SGIX = $812E; - {$EXTERNALSYM GL_TEXTURE_MULTI_BUFFER_HINT_SGIX} - - // GL_SGIS_point_parameters - GL_POINT_SIZE_MIN_SGIS = $8126; - {$EXTERNALSYM GL_POINT_SIZE_MIN_SGIS} - GL_POINT_SIZE_MAX_SGIS = $8127; - {$EXTERNALSYM GL_POINT_SIZE_MAX_SGIS} - GL_POINT_FADE_THRESHOLD_SIZE_SGIS = $8128; - {$EXTERNALSYM GL_POINT_FADE_THRESHOLD_SIZE_SGIS} - GL_DISTANCE_ATTENUATION_SGIS = $8129; - {$EXTERNALSYM GL_DISTANCE_ATTENUATION_SGIS} - - // GL_SGIX_instruments - GL_INSTRUMENT_BUFFER_POINTER_SGIX = $8180; - {$EXTERNALSYM GL_INSTRUMENT_BUFFER_POINTER_SGIX} - GL_INSTRUMENT_MEASUREMENTS_SGIX = $8181; - {$EXTERNALSYM GL_INSTRUMENT_MEASUREMENTS_SGIX} - - // GL_SGIX_texture_scale_bias - GL_POST_TEXTURE_FILTER_BIAS_SGIX = $8179; - {$EXTERNALSYM GL_POST_TEXTURE_FILTER_BIAS_SGIX} - GL_POST_TEXTURE_FILTER_SCALE_SGIX = $817A; - {$EXTERNALSYM GL_POST_TEXTURE_FILTER_SCALE_SGIX} - GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX = $817B; - {$EXTERNALSYM GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX} - GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX = $817C; - {$EXTERNALSYM GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX} - - // GL_SGIX_framezoom - GL_FRAMEZOOM_SGIX = $818B; - {$EXTERNALSYM GL_FRAMEZOOM_SGIX} - GL_FRAMEZOOM_FACTOR_SGIX = $818C; - {$EXTERNALSYM GL_FRAMEZOOM_FACTOR_SGIX} - GL_MAX_FRAMEZOOM_FACTOR_SGIX = $818D; - {$EXTERNALSYM GL_MAX_FRAMEZOOM_FACTOR_SGIX} - - // GL_FfdMaskSGIX - GL_TEXTURE_DEFORMATION_BIT_SGIX = $00000001; - {$EXTERNALSYM GL_TEXTURE_DEFORMATION_BIT_SGIX} - GL_GEOMETRY_DEFORMATION_BIT_SGIX = $00000002; - {$EXTERNALSYM GL_GEOMETRY_DEFORMATION_BIT_SGIX} - - // GL_SGIX_polynomial_ffd - GL_GEOMETRY_DEFORMATION_SGIX = $8194; - {$EXTERNALSYM GL_GEOMETRY_DEFORMATION_SGIX} - GL_TEXTURE_DEFORMATION_SGIX = $8195; - {$EXTERNALSYM GL_TEXTURE_DEFORMATION_SGIX} - GL_DEFORMATIONS_MASK_SGIX = $8196; - {$EXTERNALSYM GL_DEFORMATIONS_MASK_SGIX} - GL_MAX_DEFORMATION_ORDER_SGIX = $8197; - {$EXTERNALSYM GL_MAX_DEFORMATION_ORDER_SGIX} - - // GL_SGIX_reference_plane - GL_REFERENCE_PLANE_SGIX = $817D; - {$EXTERNALSYM GL_REFERENCE_PLANE_SGIX} - GL_REFERENCE_PLANE_EQUATION_SGIX = $817E; - {$EXTERNALSYM GL_REFERENCE_PLANE_EQUATION_SGIX} - - // GL_SGIX_depth_texture - GL_DEPTH_COMPONENT16_SGIX = $81A5; - {$EXTERNALSYM GL_DEPTH_COMPONENT16_SGIX} - GL_DEPTH_COMPONENT24_SGIX = $81A6; - {$EXTERNALSYM GL_DEPTH_COMPONENT24_SGIX} - GL_DEPTH_COMPONENT32_SGIX = $81A7; - {$EXTERNALSYM GL_DEPTH_COMPONENT32_SGIX} - - // GL_SGIS_fog_function - GL_FOG_FUNC_SGIS = $812A; - {$EXTERNALSYM GL_FOG_FUNC_SGIS} - GL_FOG_FUNC_POINTS_SGIS = $812B; - {$EXTERNALSYM GL_FOG_FUNC_POINTS_SGIS} - GL_MAX_FOG_FUNC_POINTS_SGIS = $812C; - {$EXTERNALSYM GL_MAX_FOG_FUNC_POINTS_SGIS} - - // GL_SGIX_fog_offset - GL_FOG_OFFSET_SGIX = $8198; - {$EXTERNALSYM GL_FOG_OFFSET_SGIX} - GL_FOG_OFFSET_VALUE_SGIX = $8199; - {$EXTERNALSYM GL_FOG_OFFSET_VALUE_SGIX} - - // GL_HP_image_transform - GL_IMAGE_SCALE_X_HP = $8155; - {$EXTERNALSYM GL_IMAGE_SCALE_X_HP} - GL_IMAGE_SCALE_Y_HP = $8156; - {$EXTERNALSYM GL_IMAGE_SCALE_Y_HP} - GL_IMAGE_TRANSLATE_X_HP = $8157; - {$EXTERNALSYM GL_IMAGE_TRANSLATE_X_HP} - GL_IMAGE_TRANSLATE_Y_HP = $8158; - {$EXTERNALSYM GL_IMAGE_TRANSLATE_Y_HP} - GL_IMAGE_ROTATE_ANGLE_HP = $8159; - {$EXTERNALSYM GL_IMAGE_ROTATE_ANGLE_HP} - GL_IMAGE_ROTATE_ORIGIN_X_HP = $815A; - {$EXTERNALSYM GL_IMAGE_ROTATE_ORIGIN_X_HP} - GL_IMAGE_ROTATE_ORIGIN_Y_HP = $815B; - {$EXTERNALSYM GL_IMAGE_ROTATE_ORIGIN_Y_HP} - GL_IMAGE_MAG_FILTER_HP = $815C; - {$EXTERNALSYM GL_IMAGE_MAG_FILTER_HP} - GL_IMAGE_MIN_FILTER_HP = $815D; - {$EXTERNALSYM GL_IMAGE_MIN_FILTER_HP} - GL_IMAGE_CUBIC_WEIGHT_HP = $815E; - {$EXTERNALSYM GL_IMAGE_CUBIC_WEIGHT_HP} - GL_CUBIC_HP = $815F; - {$EXTERNALSYM GL_CUBIC_HP} - GL_AVERAGE_HP = $8160; - {$EXTERNALSYM GL_AVERAGE_HP} - GL_IMAGE_TRANSFORM_2D_HP = $8161; - {$EXTERNALSYM GL_IMAGE_TRANSFORM_2D_HP} - GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP = $8162; - {$EXTERNALSYM GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP} - GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP = $8163; - {$EXTERNALSYM GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP} - - // GL_HP_convolution_border_modes - GL_IGNORE_BORDER_HP = $8150; - {$EXTERNALSYM GL_IGNORE_BORDER_HP} - GL_CONSTANT_BORDER_HP = $8151; - {$EXTERNALSYM GL_CONSTANT_BORDER_HP} - GL_REPLICATE_BORDER_HP = $8153; - {$EXTERNALSYM GL_REPLICATE_BORDER_HP} - GL_CONVOLUTION_BORDER_COLOR_HP = $8154; - {$EXTERNALSYM GL_CONVOLUTION_BORDER_COLOR_HP} - - // GL_SGIX_texture_add_env - GL_TEXTURE_ENV_BIAS_SGIX = $80BE; - {$EXTERNALSYM GL_TEXTURE_ENV_BIAS_SGIX} - - // GL_PGI_vertex_hints - GL_VERTEX_DATA_HINT_PGI = $1A22A; - {$EXTERNALSYM GL_VERTEX_DATA_HINT_PGI} - GL_VERTEX_CONSISTENT_HINT_PGI = $1A22B; - {$EXTERNALSYM GL_VERTEX_CONSISTENT_HINT_PGI} - GL_MATERIAL_SIDE_HINT_PGI = $1A22C; - {$EXTERNALSYM GL_MATERIAL_SIDE_HINT_PGI} - GL_MAX_VERTEX_HINT_PGI = $1A22D; - {$EXTERNALSYM GL_MAX_VERTEX_HINT_PGI} - GL_COLOR3_BIT_PGI = $00010000; - {$EXTERNALSYM GL_COLOR3_BIT_PGI} - GL_COLOR4_BIT_PGI = $00020000; - {$EXTERNALSYM GL_COLOR4_BIT_PGI} - GL_EDGEFLAG_BIT_PGI = $00040000; - {$EXTERNALSYM GL_EDGEFLAG_BIT_PGI} - GL_INDEX_BIT_PGI = $00080000; - {$EXTERNALSYM GL_INDEX_BIT_PGI} - GL_MAT_AMBIENT_BIT_PGI = $00100000; - {$EXTERNALSYM GL_MAT_AMBIENT_BIT_PGI} - GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI = $00200000; - {$EXTERNALSYM GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI} - GL_MAT_DIFFUSE_BIT_PGI = $00400000; - {$EXTERNALSYM GL_MAT_DIFFUSE_BIT_PGI} - GL_MAT_EMISSION_BIT_PGI = $00800000; - {$EXTERNALSYM GL_MAT_EMISSION_BIT_PGI} - GL_MAT_COLOR_INDEXES_BIT_PGI = $01000000; - {$EXTERNALSYM GL_MAT_COLOR_INDEXES_BIT_PGI} - GL_MAT_SHININESS_BIT_PGI = $02000000; - {$EXTERNALSYM GL_MAT_SHININESS_BIT_PGI} - GL_MAT_SPECULAR_BIT_PGI = $04000000; - {$EXTERNALSYM GL_MAT_SPECULAR_BIT_PGI} - GL_NORMAL_BIT_PGI = $08000000; - {$EXTERNALSYM GL_NORMAL_BIT_PGI} - GL_TEXCOORD1_BIT_PGI = $10000000; - {$EXTERNALSYM GL_TEXCOORD1_BIT_PGI} - GL_TEXCOORD2_BIT_PGI = $20000000; - {$EXTERNALSYM GL_TEXCOORD2_BIT_PGI} - GL_TEXCOORD3_BIT_PGI = $40000000; - {$EXTERNALSYM GL_TEXCOORD3_BIT_PGI} - GL_TEXCOORD4_BIT_PGI = $80000000; - {$EXTERNALSYM GL_TEXCOORD4_BIT_PGI} - GL_VERTEX23_BIT_PGI = $00000004; - {$EXTERNALSYM GL_VERTEX23_BIT_PGI} - GL_VERTEX4_BIT_PGI = $00000008; - {$EXTERNALSYM GL_VERTEX4_BIT_PGI} - - // GL_PGI_misc_hints - GL_PREFER_DOUBLEBUFFER_HINT_PGI = $1A1F8; - {$EXTERNALSYM GL_PREFER_DOUBLEBUFFER_HINT_PGI} - GL_CONSERVE_MEMORY_HINT_PGI = $1A1FD; - {$EXTERNALSYM GL_CONSERVE_MEMORY_HINT_PGI} - GL_RECLAIM_MEMORY_HINT_PGI = $1A1FE; - {$EXTERNALSYM GL_RECLAIM_MEMORY_HINT_PGI} - GL_NATIVE_GRAPHICS_HANDLE_PGI = $1A202; - {$EXTERNALSYM GL_NATIVE_GRAPHICS_HANDLE_PGI} - GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI = $1A203; - {$EXTERNALSYM GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI} - GL_NATIVE_GRAPHICS_END_HINT_PGI = $1A204; - {$EXTERNALSYM GL_NATIVE_GRAPHICS_END_HINT_PGI} - GL_ALWAYS_FAST_HINT_PGI = $1A20C; - {$EXTERNALSYM GL_ALWAYS_FAST_HINT_PGI} - GL_ALWAYS_SOFT_HINT_PGI = $1A20D; - {$EXTERNALSYM GL_ALWAYS_SOFT_HINT_PGI} - GL_ALLOW_DRAW_OBJ_HINT_PGI = $1A20E; - {$EXTERNALSYM GL_ALLOW_DRAW_OBJ_HINT_PGI} - GL_ALLOW_DRAW_WIN_HINT_PGI = $1A20F; - {$EXTERNALSYM GL_ALLOW_DRAW_WIN_HINT_PGI} - GL_ALLOW_DRAW_FRG_HINT_PGI = $1A210; - {$EXTERNALSYM GL_ALLOW_DRAW_FRG_HINT_PGI} - GL_ALLOW_DRAW_MEM_HINT_PGI = $1A211; - {$EXTERNALSYM GL_ALLOW_DRAW_MEM_HINT_PGI} - GL_STRICT_DEPTHFUNC_HINT_PGI = $1A216; - {$EXTERNALSYM GL_STRICT_DEPTHFUNC_HINT_PGI} - GL_STRICT_LIGHTING_HINT_PGI = $1A217; - {$EXTERNALSYM GL_STRICT_LIGHTING_HINT_PGI} - GL_STRICT_SCISSOR_HINT_PGI = $1A218; - {$EXTERNALSYM GL_STRICT_SCISSOR_HINT_PGI} - GL_FULL_STIPPLE_HINT_PGI = $1A219; - {$EXTERNALSYM GL_FULL_STIPPLE_HINT_PGI} - GL_CLIP_NEAR_HINT_PGI = $1A220; - {$EXTERNALSYM GL_CLIP_NEAR_HINT_PGI} - GL_CLIP_FAR_HINT_PGI = $1A221; - {$EXTERNALSYM GL_CLIP_FAR_HINT_PGI} - GL_WIDE_LINE_HINT_PGI = $1A222; - {$EXTERNALSYM GL_WIDE_LINE_HINT_PGI} - GL_BACK_NORMALS_HINT_PGI = $1A223; - {$EXTERNALSYM GL_BACK_NORMALS_HINT_PGI} - - // GL_EXT_paletted_texture - GL_TEXTURE_INDEX_SIZE_EXT = $80ED; - {$EXTERNALSYM GL_TEXTURE_INDEX_SIZE_EXT} - - // GL_SGIX_list_priority - GL_LIST_PRIORITY_SGIX = $8182; - {$EXTERNALSYM GL_LIST_PRIORITY_SGIX} - - // GL_SGIX_ir_instrument1 - GL_IR_INSTRUMENT1_SGIX = $817F; - {$EXTERNALSYM GL_IR_INSTRUMENT1_SGIX} - - // GL_SGIX_calligraphic_fragment - GL_CALLIGRAPHIC_FRAGMENT_SGIX = $8183; - {$EXTERNALSYM GL_CALLIGRAPHIC_FRAGMENT_SGIX} - - // GL_SGIX_texture_lod_bias - GL_TEXTURE_LOD_BIAS_S_SGIX = $818E; - {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_S_SGIX} - GL_TEXTURE_LOD_BIAS_T_SGIX = $818F; - {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_T_SGIX} - GL_TEXTURE_LOD_BIAS_R_SGIX = $8190; - {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_R_SGIX} - - // GL_SGIX_shadow_ambient - GL_SHADOW_AMBIENT_SGIX = $80BF; - {$EXTERNALSYM GL_SHADOW_AMBIENT_SGIX} - - // GL_SGIX_ycrcb - GL_YCRCB_422_SGIX = $81BB; - {$EXTERNALSYM GL_YCRCB_422_SGIX} - GL_YCRCB_444_SGIX = $81BC; - {$EXTERNALSYM GL_YCRCB_444_SGIX} - - // GL_SGIX_fragment_lighting - GL_FRAGMENT_LIGHTING_SGIX = $8400; - {$EXTERNALSYM GL_FRAGMENT_LIGHTING_SGIX} - GL_FRAGMENT_COLOR_MATERIAL_SGIX = $8401; - {$EXTERNALSYM GL_FRAGMENT_COLOR_MATERIAL_SGIX} - GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX = $8402; - {$EXTERNALSYM GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX} - GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX = $8403; - {$EXTERNALSYM GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX} - GL_MAX_FRAGMENT_LIGHTS_SGIX = $8404; - {$EXTERNALSYM GL_MAX_FRAGMENT_LIGHTS_SGIX} - GL_MAX_ACTIVE_LIGHTS_SGIX = $8405; - {$EXTERNALSYM GL_MAX_ACTIVE_LIGHTS_SGIX} - GL_CURRENT_RASTER_NORMAL_SGIX = $8406; - {$EXTERNALSYM GL_CURRENT_RASTER_NORMAL_SGIX} - GL_LIGHT_ENV_MODE_SGIX = $8407; - {$EXTERNALSYM GL_LIGHT_ENV_MODE_SGIX} - GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX = $8408; - {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX} - GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX = $8409; - {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX} - GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX = $840A; - {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX} - GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX = $840B; - {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX} - GL_FRAGMENT_LIGHT0_SGIX = $840C; - {$EXTERNALSYM GL_FRAGMENT_LIGHT0_SGIX} - GL_FRAGMENT_LIGHT1_SGIX = $840D; - {$EXTERNALSYM GL_FRAGMENT_LIGHT1_SGIX} - GL_FRAGMENT_LIGHT2_SGIX = $840E; - {$EXTERNALSYM GL_FRAGMENT_LIGHT2_SGIX} - GL_FRAGMENT_LIGHT3_SGIX = $840F; - {$EXTERNALSYM GL_FRAGMENT_LIGHT3_SGIX} - GL_FRAGMENT_LIGHT4_SGIX = $8410; - {$EXTERNALSYM GL_FRAGMENT_LIGHT4_SGIX} - GL_FRAGMENT_LIGHT5_SGIX = $8411; - {$EXTERNALSYM GL_FRAGMENT_LIGHT5_SGIX} - GL_FRAGMENT_LIGHT6_SGIX = $8412; - {$EXTERNALSYM GL_FRAGMENT_LIGHT6_SGIX} - GL_FRAGMENT_LIGHT7_SGIX = $8413; - {$EXTERNALSYM GL_FRAGMENT_LIGHT7_SGIX} - - // GL_IBM_rasterpos_clip - GL_RASTER_POSITION_UNCLIPPED_IBM = $19262; - {$EXTERNALSYM GL_RASTER_POSITION_UNCLIPPED_IBM} - - // GL_HP_texture_lighting - GL_TEXTURE_LIGHTING_MODE_HP = $8167; - {$EXTERNALSYM GL_TEXTURE_LIGHTING_MODE_HP} - GL_TEXTURE_POST_SPECULAR_HP = $8168; - {$EXTERNALSYM GL_TEXTURE_POST_SPECULAR_HP} - GL_TEXTURE_PRE_SPECULAR_HP = $8169; - {$EXTERNALSYM GL_TEXTURE_PRE_SPECULAR_HP} - - // GL_EXT_draw_range_elements - GL_MAX_ELEMENTS_VERTICES_EXT = $80E8; - {$EXTERNALSYM GL_MAX_ELEMENTS_VERTICES_EXT} - GL_MAX_ELEMENTS_INDICES_EXT = $80E9; - {$EXTERNALSYM GL_MAX_ELEMENTS_INDICES_EXT} - - // GL_WIN_phong_shading - GL_PHONG_WIN = $80EA; - {$EXTERNALSYM GL_PHONG_WIN} - GL_PHONG_HINT_WIN = $80EB; - {$EXTERNALSYM GL_PHONG_HINT_WIN} - - // GL_WIN_specular_fog - GL_FOG_SPECULAR_TEXTURE_WIN = $80EC; - {$EXTERNALSYM GL_FOG_SPECULAR_TEXTURE_WIN} - - // GL_EXT_light_texture - GL_FRAGMENT_MATERIAL_EXT = $8349; - {$EXTERNALSYM GL_FRAGMENT_MATERIAL_EXT} - GL_FRAGMENT_NORMAL_EXT = $834A; - {$EXTERNALSYM GL_FRAGMENT_NORMAL_EXT} - GL_FRAGMENT_COLOR_EXT = $834C; - {$EXTERNALSYM GL_FRAGMENT_COLOR_EXT} - GL_ATTENUATION_EXT = $834D; - {$EXTERNALSYM GL_ATTENUATION_EXT} - GL_SHADOW_ATTENUATION_EXT = $834E; - {$EXTERNALSYM GL_SHADOW_ATTENUATION_EXT} - GL_TEXTURE_APPLICATION_MODE_EXT = $834F; - {$EXTERNALSYM GL_TEXTURE_APPLICATION_MODE_EXT} - GL_TEXTURE_LIGHT_EXT = $8350; - {$EXTERNALSYM GL_TEXTURE_LIGHT_EXT} - GL_TEXTURE_MATERIAL_FACE_EXT = $8351; - {$EXTERNALSYM GL_TEXTURE_MATERIAL_FACE_EXT} - GL_TEXTURE_MATERIAL_PARAMETER_EXT = $8352; - {$EXTERNALSYM GL_TEXTURE_MATERIAL_PARAMETER_EXT} - - // GL_SGIX_blend_alpha_minmax - GL_ALPHA_MIN_SGIX = $8320; - {$EXTERNALSYM GL_ALPHA_MIN_SGIX} - GL_ALPHA_MAX_SGIX = $8321; - {$EXTERNALSYM GL_ALPHA_MAX_SGIX} - - // GL_SGIX_async - GL_ASYNC_MARKER_SGIX = $8329; - {$EXTERNALSYM GL_ASYNC_MARKER_SGIX} - - // GL_SGIX_async_pixel - GL_ASYNC_TEX_IMAGE_SGIX = $835C; - {$EXTERNALSYM GL_ASYNC_TEX_IMAGE_SGIX} - GL_ASYNC_DRAW_PIXELS_SGIX = $835D; - {$EXTERNALSYM GL_ASYNC_DRAW_PIXELS_SGIX} - GL_ASYNC_READ_PIXELS_SGIX = $835E; - {$EXTERNALSYM GL_ASYNC_READ_PIXELS_SGIX} - GL_MAX_ASYNC_TEX_IMAGE_SGIX = $835F; - {$EXTERNALSYM GL_MAX_ASYNC_TEX_IMAGE_SGIX} - GL_MAX_ASYNC_DRAW_PIXELS_SGIX = $8360; - {$EXTERNALSYM GL_MAX_ASYNC_DRAW_PIXELS_SGIX} - GL_MAX_ASYNC_READ_PIXELS_SGIX = $8361; - {$EXTERNALSYM GL_MAX_ASYNC_READ_PIXELS_SGIX} - - // GL_SGIX_async_histogram - GL_ASYNC_HISTOGRAM_SGIX = $832C; - {$EXTERNALSYM GL_ASYNC_HISTOGRAM_SGIX} - GL_MAX_ASYNC_HISTOGRAM_SGIX = $832D; - {$EXTERNALSYM GL_MAX_ASYNC_HISTOGRAM_SGIX} - - // GL_INTEL_parallel_arrays - GL_PARALLEL_ARRAYS_INTEL = $83F4; - {$EXTERNALSYM GL_PARALLEL_ARRAYS_INTEL} - GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL = $83F5; - {$EXTERNALSYM GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL} - GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL = $83F6; - {$EXTERNALSYM GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL} - GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL = $83F7; - {$EXTERNALSYM GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL} - GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL = $83F8; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL} - - // GL_HP_occlusion_test - GL_OCCLUSION_TEST_HP = $8165; - {$EXTERNALSYM GL_OCCLUSION_TEST_HP} - GL_OCCLUSION_TEST_RESULT_HP = $8166; - {$EXTERNALSYM GL_OCCLUSION_TEST_RESULT_HP} - - // GL_EXT_pixel_transform - GL_PIXEL_TRANSFORM_2D_EXT = $8330; - {$EXTERNALSYM GL_PIXEL_TRANSFORM_2D_EXT} - GL_PIXEL_MAG_FILTER_EXT = $8331; - {$EXTERNALSYM GL_PIXEL_MAG_FILTER_EXT} - GL_PIXEL_MIN_FILTER_EXT = $8332; - {$EXTERNALSYM GL_PIXEL_MIN_FILTER_EXT} - GL_PIXEL_CUBIC_WEIGHT_EXT = $8333; - {$EXTERNALSYM GL_PIXEL_CUBIC_WEIGHT_EXT} - GL_CUBIC_EXT = $8334; - {$EXTERNALSYM GL_CUBIC_EXT} - GL_AVERAGE_EXT = $8335; - {$EXTERNALSYM GL_AVERAGE_EXT} - GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT = $8336; - {$EXTERNALSYM GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT} - GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT = $8337; - {$EXTERNALSYM GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT} - GL_PIXEL_TRANSFORM_2D_MATRIX_EXT = $8338; - {$EXTERNALSYM GL_PIXEL_TRANSFORM_2D_MATRIX_EXT} - - // GL_EXT_separate_specular_color - GL_LIGHT_MODEL_COLOR_CONTROL_EXT = $81F8; - {$EXTERNALSYM GL_LIGHT_MODEL_COLOR_CONTROL_EXT} - GL_SINGLE_COLOR_EXT = $81F9; - {$EXTERNALSYM GL_SINGLE_COLOR_EXT} - GL_SEPARATE_SPECULAR_COLOR_EXT = $81FA; - {$EXTERNALSYM GL_SEPARATE_SPECULAR_COLOR_EXT} - - // GL_EXT_secondary_color - GL_COLOR_SUM_EXT = $8458; - {$EXTERNALSYM GL_COLOR_SUM_EXT} - GL_CURRENT_SECONDARY_COLOR_EXT = $8459; - {$EXTERNALSYM GL_CURRENT_SECONDARY_COLOR_EXT} - GL_SECONDARY_COLOR_ARRAY_SIZE_EXT = $845A; - {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_SIZE_EXT} - GL_SECONDARY_COLOR_ARRAY_TYPE_EXT = $845B; - {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_TYPE_EXT} - GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT = $845C; - {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT} - GL_SECONDARY_COLOR_ARRAY_POINTER_EXT = $845D; - {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_POINTER_EXT} - GL_SECONDARY_COLOR_ARRAY_EXT = $845E; - {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_EXT} - - // GL_EXT_texture_perturb_normal - GL_PERTURB_EXT = $85AE; - {$EXTERNALSYM GL_PERTURB_EXT} - GL_TEXTURE_NORMAL_EXT = $85AF; - {$EXTERNALSYM GL_TEXTURE_NORMAL_EXT} - - // GL_EXT_fog_coord - GL_FOG_COORDINATE_SOURCE_EXT = $8450; - {$EXTERNALSYM GL_FOG_COORDINATE_SOURCE_EXT} - GL_FOG_COORDINATE_EXT = $8451; - {$EXTERNALSYM GL_FOG_COORDINATE_EXT} - GL_FRAGMENT_DEPTH_EXT = $8452; - {$EXTERNALSYM GL_FRAGMENT_DEPTH_EXT} - GL_CURRENT_FOG_COORDINATE_EXT = $8453; - {$EXTERNALSYM GL_CURRENT_FOG_COORDINATE_EXT} - GL_FOG_COORDINATE_ARRAY_TYPE_EXT = $8454; - {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_TYPE_EXT} - GL_FOG_COORDINATE_ARRAY_STRIDE_EXT = $8455; - {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_STRIDE_EXT} - GL_FOG_COORDINATE_ARRAY_POINTER_EXT = $8456; - {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_POINTER_EXT} - GL_FOG_COORDINATE_ARRAY_EXT = $8457; - {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_EXT} - - // GL_REND_screen_coordinates - GL_SCREEN_COORDINATES_REND = $8490; - {$EXTERNALSYM GL_SCREEN_COORDINATES_REND} - GL_INVERTED_SCREEN_W_REND = $8491; - {$EXTERNALSYM GL_INVERTED_SCREEN_W_REND} - - // GL_EXT_coordinate_frame - GL_TANGENT_ARRAY_EXT = $8439; - {$EXTERNALSYM GL_TANGENT_ARRAY_EXT} - GL_BINORMAL_ARRAY_EXT = $843A; - {$EXTERNALSYM GL_BINORMAL_ARRAY_EXT} - GL_CURRENT_TANGENT_EXT = $843B; - {$EXTERNALSYM GL_CURRENT_TANGENT_EXT} - GL_CURRENT_BINORMAL_EXT = $843C; - {$EXTERNALSYM GL_CURRENT_BINORMAL_EXT} - GL_TANGENT_ARRAY_TYPE_EXT = $843E; - {$EXTERNALSYM GL_TANGENT_ARRAY_TYPE_EXT} - GL_TANGENT_ARRAY_STRIDE_EXT = $843F; - {$EXTERNALSYM GL_TANGENT_ARRAY_STRIDE_EXT} - GL_BINORMAL_ARRAY_TYPE_EXT = $8440; - {$EXTERNALSYM GL_BINORMAL_ARRAY_TYPE_EXT} - GL_BINORMAL_ARRAY_STRIDE_EXT = $8441; - {$EXTERNALSYM GL_BINORMAL_ARRAY_STRIDE_EXT} - GL_TANGENT_ARRAY_POINTER_EXT = $8442; - {$EXTERNALSYM GL_TANGENT_ARRAY_POINTER_EXT} - GL_BINORMAL_ARRAY_POINTER_EXT = $8443; - {$EXTERNALSYM GL_BINORMAL_ARRAY_POINTER_EXT} - GL_MAP1_TANGENT_EXT = $8444; - {$EXTERNALSYM GL_MAP1_TANGENT_EXT} - GL_MAP2_TANGENT_EXT = $8445; - {$EXTERNALSYM GL_MAP2_TANGENT_EXT} - GL_MAP1_BINORMAL_EXT = $8446; - {$EXTERNALSYM GL_MAP1_BINORMAL_EXT} - GL_MAP2_BINORMAL_EXT = $8447; - {$EXTERNALSYM GL_MAP2_BINORMAL_EXT} - - // GL_EXT_texture_env_combine - GL_SOURCE3_RGB_EXT = $8583; - {$EXTERNALSYM GL_SOURCE3_RGB_EXT} - GL_SOURCE4_RGB_EXT = $8584; - {$EXTERNALSYM GL_SOURCE4_RGB_EXT} - GL_SOURCE5_RGB_EXT = $8585; - {$EXTERNALSYM GL_SOURCE5_RGB_EXT} - GL_SOURCE6_RGB_EXT = $8586; - {$EXTERNALSYM GL_SOURCE6_RGB_EXT} - GL_SOURCE7_RGB_EXT = $8587; - {$EXTERNALSYM GL_SOURCE7_RGB_EXT} - GL_SOURCE3_ALPHA_EXT = $858B; - {$EXTERNALSYM GL_SOURCE3_ALPHA_EXT} - GL_SOURCE4_ALPHA_EXT = $858C; - {$EXTERNALSYM GL_SOURCE4_ALPHA_EXT} - GL_SOURCE5_ALPHA_EXT = $858D; - {$EXTERNALSYM GL_SOURCE5_ALPHA_EXT} - GL_SOURCE6_ALPHA_EXT = $858E; - {$EXTERNALSYM GL_SOURCE6_ALPHA_EXT} - GL_SOURCE7_ALPHA_EXT = $858F; - {$EXTERNALSYM GL_SOURCE7_ALPHA_EXT} - GL_OPERAND3_RGB_EXT = $8593; - {$EXTERNALSYM GL_OPERAND3_RGB_EXT} - GL_OPERAND4_RGB_EXT = $8594; - {$EXTERNALSYM GL_OPERAND4_RGB_EXT} - GL_OPERAND5_RGB_EXT = $8595; - {$EXTERNALSYM GL_OPERAND5_RGB_EXT} - GL_OPERAND6_RGB_EXT = $8596; - {$EXTERNALSYM GL_OPERAND6_RGB_EXT} - GL_OPERAND7_RGB_EXT = $8597; - {$EXTERNALSYM GL_OPERAND7_RGB_EXT} - GL_OPERAND3_ALPHA_EXT = $859B; - {$EXTERNALSYM GL_OPERAND3_ALPHA_EXT} - GL_OPERAND4_ALPHA_EXT = $859C; - {$EXTERNALSYM GL_OPERAND4_ALPHA_EXT} - GL_OPERAND5_ALPHA_EXT = $859D; - {$EXTERNALSYM GL_OPERAND5_ALPHA_EXT} - GL_OPERAND6_ALPHA_EXT = $859E; - {$EXTERNALSYM GL_OPERAND6_ALPHA_EXT} - GL_OPERAND7_ALPHA_EXT = $859F; - {$EXTERNALSYM GL_OPERAND7_ALPHA_EXT} - - // GL_APPLE_specular_vector - GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE = $85B0; - {$EXTERNALSYM GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE} - - // GL_APPLE_transform_hint - GL_TRANSFORM_HINT_APPLE = $85B1; - {$EXTERNALSYM GL_TRANSFORM_HINT_APPLE} - - // GL_SGIX_fog_scale - GL_FOG_SCALE_SGIX = $81FC; - {$EXTERNALSYM GL_FOG_SCALE_SGIX} - GL_FOG_SCALE_VALUE_SGIX = $81FD; - {$EXTERNALSYM GL_FOG_SCALE_VALUE_SGIX} - - // GL_SUNX_constant_data - GL_UNPACK_CONSTANT_DATA_SUNX = $81D5; - {$EXTERNALSYM GL_UNPACK_CONSTANT_DATA_SUNX} - GL_TEXTURE_CONSTANT_DATA_SUNX = $81D6; - {$EXTERNALSYM GL_TEXTURE_CONSTANT_DATA_SUNX} - - // GL_SUN_global_alpha - GL_GLOBAL_ALPHA_SUN = $81D9; - {$EXTERNALSYM GL_GLOBAL_ALPHA_SUN} - GL_GLOBAL_ALPHA_FACTOR_SUN = $81DA; - {$EXTERNALSYM GL_GLOBAL_ALPHA_FACTOR_SUN} - - // GL_SUN_triangle_list - GL_RESTART_SUN = $01; - {$EXTERNALSYM GL_RESTART_SUN} - GL_REPLACE_MIDDLE_SUN = $02; - {$EXTERNALSYM GL_REPLACE_MIDDLE_SUN} - GL_REPLACE_OLDEST_SUN = $03; - {$EXTERNALSYM GL_REPLACE_OLDEST_SUN} - GL_TRIANGLE_LIST_SUN = $81D7; - {$EXTERNALSYM GL_TRIANGLE_LIST_SUN} - GL_REPLACEMENT_CODE_SUN = $81D8; - {$EXTERNALSYM GL_REPLACEMENT_CODE_SUN} - GL_REPLACEMENT_CODE_ARRAY_SUN = $85C0; - {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_SUN} - GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN = $85C1; - {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN} - GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN = $85C2; - {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN} - GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN = $85C3; - {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN} - GL_R1UI_V3F_SUN = $85C4; - {$EXTERNALSYM GL_R1UI_V3F_SUN} - GL_R1UI_C4UB_V3F_SUN = $85C5; - {$EXTERNALSYM GL_R1UI_C4UB_V3F_SUN} - GL_R1UI_C3F_V3F_SUN = $85C6; - {$EXTERNALSYM GL_R1UI_C3F_V3F_SUN} - GL_R1UI_N3F_V3F_SUN = $85C7; - {$EXTERNALSYM GL_R1UI_N3F_V3F_SUN} - GL_R1UI_C4F_N3F_V3F_SUN = $85C8; - {$EXTERNALSYM GL_R1UI_C4F_N3F_V3F_SUN} - GL_R1UI_T2F_V3F_SUN = $85C9; - {$EXTERNALSYM GL_R1UI_T2F_V3F_SUN} - GL_R1UI_T2F_N3F_V3F_SUN = $85CA; - {$EXTERNALSYM GL_R1UI_T2F_N3F_V3F_SUN} - GL_R1UI_T2F_C4F_N3F_V3F_SUN = $85CB; - {$EXTERNALSYM GL_R1UI_T2F_C4F_N3F_V3F_SUN} - - // GL_EXT_blend_func_separate - GL_BLEND_DST_RGB_EXT = $80C8; - {$EXTERNALSYM GL_BLEND_DST_RGB_EXT} - GL_BLEND_SRC_RGB_EXT = $80C9; - {$EXTERNALSYM GL_BLEND_SRC_RGB_EXT} - GL_BLEND_DST_ALPHA_EXT = $80CA; - {$EXTERNALSYM GL_BLEND_DST_ALPHA_EXT} - GL_BLEND_SRC_ALPHA_EXT = $80CB; - {$EXTERNALSYM GL_BLEND_SRC_ALPHA_EXT} - - // GL_INGR_color_clamp - GL_RED_MIN_CLAMP_INGR = $8560; - {$EXTERNALSYM GL_RED_MIN_CLAMP_INGR} - GL_GREEN_MIN_CLAMP_INGR = $8561; - {$EXTERNALSYM GL_GREEN_MIN_CLAMP_INGR} - GL_BLUE_MIN_CLAMP_INGR = $8562; - {$EXTERNALSYM GL_BLUE_MIN_CLAMP_INGR} - GL_ALPHA_MIN_CLAMP_INGR = $8563; - {$EXTERNALSYM GL_ALPHA_MIN_CLAMP_INGR} - GL_RED_MAX_CLAMP_INGR = $8564; - {$EXTERNALSYM GL_RED_MAX_CLAMP_INGR} - GL_GREEN_MAX_CLAMP_INGR = $8565; - {$EXTERNALSYM GL_GREEN_MAX_CLAMP_INGR} - GL_BLUE_MAX_CLAMP_INGR = $8566; - {$EXTERNALSYM GL_BLUE_MAX_CLAMP_INGR} - GL_ALPHA_MAX_CLAMP_INGR = $8567; - {$EXTERNALSYM GL_ALPHA_MAX_CLAMP_INGR} - - // GL_INGR_interlace_read - GL_INTERLACE_READ_INGR = $8568; - {$EXTERNALSYM GL_INTERLACE_READ_INGR} - - // GL_EXT_422_pixels - GL_422_EXT = $80CC; - {$EXTERNALSYM GL_422_EXT} - GL_422_REV_EXT = $80CD; - {$EXTERNALSYM GL_422_REV_EXT} - GL_422_AVERAGE_EXT = $80CE; - {$EXTERNALSYM GL_422_AVERAGE_EXT} - GL_422_REV_AVERAGE_EXT = $80CF; - {$EXTERNALSYM GL_422_REV_AVERAGE_EXT} - - // GL_EXT_texture_cube_map - GL_NORMAL_MAP_EXT = $8511; - {$EXTERNALSYM GL_NORMAL_MAP_EXT} - GL_REFLECTION_MAP_EXT = $8512; - {$EXTERNALSYM GL_REFLECTION_MAP_EXT} - GL_TEXTURE_CUBE_MAP_EXT = $8513; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_EXT} - GL_TEXTURE_BINDING_CUBE_MAP_EXT = $8514; - {$EXTERNALSYM GL_TEXTURE_BINDING_CUBE_MAP_EXT} - GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT = $8515; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT} - GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT = $8516; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT} - GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT = $8517; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT} - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT = $8518; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT} - GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT = $8519; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT} - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT = $851A; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT} - GL_PROXY_TEXTURE_CUBE_MAP_EXT = $851B; - {$EXTERNALSYM GL_PROXY_TEXTURE_CUBE_MAP_EXT} - GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT = $851C; - {$EXTERNALSYM GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT} - - // GL_SUN_convolution_border_modes - GL_WRAP_BORDER_SUN = $81D4; - {$EXTERNALSYM GL_WRAP_BORDER_SUN} - - // GL_EXT_texture_lod_bias - GL_MAX_TEXTURE_LOD_BIAS_EXT = $84FD; - {$EXTERNALSYM GL_MAX_TEXTURE_LOD_BIAS_EXT} - GL_TEXTURE_FILTER_CONTROL_EXT = $8500; - {$EXTERNALSYM GL_TEXTURE_FILTER_CONTROL_EXT} - GL_TEXTURE_LOD_BIAS_EXT = $8501; - {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_EXT} - - // GL_EXT_texture_filter_anisotropic - GL_TEXTURE_MAX_ANISOTROPY_EXT = $84FE; - {$EXTERNALSYM GL_TEXTURE_MAX_ANISOTROPY_EXT} - GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = $84FF; - {$EXTERNALSYM GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT} - - // GL_EXT_vertex_weighting - GL_MODELVIEW0_STACK_DEPTH_EXT = GL_MODELVIEW_STACK_DEPTH; - {$EXTERNALSYM GL_MODELVIEW0_STACK_DEPTH_EXT} - GL_MODELVIEW1_STACK_DEPTH_EXT = $8502; - {$EXTERNALSYM GL_MODELVIEW1_STACK_DEPTH_EXT} - GL_MODELVIEW0_MATRIX_EXT = GL_MODELVIEW_MATRIX; - {$EXTERNALSYM GL_MODELVIEW0_MATRIX_EXT} - GL_MODELVIEW_MATRIX1_EXT = $8506; - {$EXTERNALSYM GL_MODELVIEW_MATRIX1_EXT} - GL_VERTEX_WEIGHTING_EXT = $8509; - {$EXTERNALSYM GL_VERTEX_WEIGHTING_EXT} - GL_MODELVIEW0_EXT = GL_MODELVIEW; - {$EXTERNALSYM GL_MODELVIEW0_EXT} - GL_MODELVIEW1_EXT = $850A; - {$EXTERNALSYM GL_MODELVIEW1_EXT} - GL_CURRENT_VERTEX_WEIGHT_EXT = $850B; - {$EXTERNALSYM GL_CURRENT_VERTEX_WEIGHT_EXT} - GL_VERTEX_WEIGHT_ARRAY_EXT = $850C; - {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_EXT} - GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT = $850D; - {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT} - GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT = $850E; - {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT} - GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT = $850F; - {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT} - GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT = $8510; - {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT} - - // GL_NV_light_max_exponent - GL_MAX_SHININESS_NV = $8504; - {$EXTERNALSYM GL_MAX_SHININESS_NV} - GL_MAX_SPOT_EXPONENT_NV = $8505; - {$EXTERNALSYM GL_MAX_SPOT_EXPONENT_NV} - - // GL_NV_vertex_array_range - GL_VERTEX_ARRAY_RANGE_NV = $851D; - {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_NV} - GL_VERTEX_ARRAY_RANGE_LENGTH_NV = $851E; - {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_LENGTH_NV} - GL_VERTEX_ARRAY_RANGE_VALID_NV = $851F; - {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_VALID_NV} - GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV = $8520; - {$EXTERNALSYM GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV} - GL_VERTEX_ARRAY_RANGE_POINTER_NV = $8521; - {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_POINTER_NV} - - // GL_NV_register_combiners - GL_REGISTER_COMBINERS_NV = $8522; - {$EXTERNALSYM GL_REGISTER_COMBINERS_NV} - GL_VARIABLE_A_NV = $8523; - {$EXTERNALSYM GL_VARIABLE_A_NV} - GL_VARIABLE_B_NV = $8524; - {$EXTERNALSYM GL_VARIABLE_B_NV} - GL_VARIABLE_C_NV = $8525; - {$EXTERNALSYM GL_VARIABLE_C_NV} - GL_VARIABLE_D_NV = $8526; - {$EXTERNALSYM GL_VARIABLE_D_NV} - GL_VARIABLE_E_NV = $8527; - {$EXTERNALSYM GL_VARIABLE_E_NV} - GL_VARIABLE_F_NV = $8528; - {$EXTERNALSYM GL_VARIABLE_F_NV} - GL_VARIABLE_G_NV = $8529; - {$EXTERNALSYM GL_VARIABLE_G_NV} - GL_CONSTANT_COLOR0_NV = $852A; - {$EXTERNALSYM GL_CONSTANT_COLOR0_NV} - GL_CONSTANT_COLOR1_NV = $852B; - {$EXTERNALSYM GL_CONSTANT_COLOR1_NV} - GL_PRIMARY_COLOR_NV = $852C; - {$EXTERNALSYM GL_PRIMARY_COLOR_NV} - GL_SECONDARY_COLOR_NV = $852D; - {$EXTERNALSYM GL_SECONDARY_COLOR_NV} - GL_SPARE0_NV = $852E; - {$EXTERNALSYM GL_SPARE0_NV} - GL_SPARE1_NV = $852F; - {$EXTERNALSYM GL_SPARE1_NV} - GL_DISCARD_NV = $8530; - {$EXTERNALSYM GL_DISCARD_NV} - GL_E_TIMES_F_NV = $8531; - {$EXTERNALSYM GL_E_TIMES_F_NV} - GL_SPARE0_PLUS_SECONDARY_COLOR_NV = $8532; - {$EXTERNALSYM GL_SPARE0_PLUS_SECONDARY_COLOR_NV} - GL_UNSIGNED_IDENTITY_NV = $8536; - {$EXTERNALSYM GL_UNSIGNED_IDENTITY_NV} - GL_UNSIGNED_INVERT_NV = $8537; - {$EXTERNALSYM GL_UNSIGNED_INVERT_NV} - GL_EXPAND_NORMAL_NV = $8538; - {$EXTERNALSYM GL_EXPAND_NORMAL_NV} - GL_EXPAND_NEGATE_NV = $8539; - {$EXTERNALSYM GL_EXPAND_NEGATE_NV} - GL_HALF_BIAS_NORMAL_NV = $853A; - {$EXTERNALSYM GL_HALF_BIAS_NORMAL_NV} - GL_HALF_BIAS_NEGATE_NV = $853B; - {$EXTERNALSYM GL_HALF_BIAS_NEGATE_NV} - GL_SIGNED_IDENTITY_NV = $853C; - {$EXTERNALSYM GL_SIGNED_IDENTITY_NV} - GL_SIGNED_NEGATE_NV = $853D; - {$EXTERNALSYM GL_SIGNED_NEGATE_NV} - GL_SCALE_BY_TWO_NV = $853E; - {$EXTERNALSYM GL_SCALE_BY_TWO_NV} - GL_SCALE_BY_FOUR_NV = $853F; - {$EXTERNALSYM GL_SCALE_BY_FOUR_NV} - GL_SCALE_BY_ONE_HALF_NV = $8540; - {$EXTERNALSYM GL_SCALE_BY_ONE_HALF_NV} - GL_BIAS_BY_NEGATIVE_ONE_HALF_NV = $8541; - {$EXTERNALSYM GL_BIAS_BY_NEGATIVE_ONE_HALF_NV} - GL_COMBINER_INPUT_NV = $8542; - {$EXTERNALSYM GL_COMBINER_INPUT_NV} - GL_COMBINER_MAPPING_NV = $8543; - {$EXTERNALSYM GL_COMBINER_MAPPING_NV} - GL_COMBINER_COMPONENT_USAGE_NV = $8544; - {$EXTERNALSYM GL_COMBINER_COMPONENT_USAGE_NV} - GL_COMBINER_AB_DOT_PRODUCT_NV = $8545; - {$EXTERNALSYM GL_COMBINER_AB_DOT_PRODUCT_NV} - GL_COMBINER_CD_DOT_PRODUCT_NV = $8546; - {$EXTERNALSYM GL_COMBINER_CD_DOT_PRODUCT_NV} - GL_COMBINER_MUX_SUM_NV = $8547; - {$EXTERNALSYM GL_COMBINER_MUX_SUM_NV} - GL_COMBINER_SCALE_NV = $8548; - {$EXTERNALSYM GL_COMBINER_SCALE_NV} - GL_COMBINER_BIAS_NV = $8549; - {$EXTERNALSYM GL_COMBINER_BIAS_NV} - GL_COMBINER_AB_OUTPUT_NV = $854A; - {$EXTERNALSYM GL_COMBINER_AB_OUTPUT_NV} - GL_COMBINER_CD_OUTPUT_NV = $854B; - {$EXTERNALSYM GL_COMBINER_CD_OUTPUT_NV} - GL_COMBINER_SUM_OUTPUT_NV = $854C; - {$EXTERNALSYM GL_COMBINER_SUM_OUTPUT_NV} - GL_MAX_GENERAL_COMBINERS_NV = $854D; - {$EXTERNALSYM GL_MAX_GENERAL_COMBINERS_NV} - GL_NUM_GENERAL_COMBINERS_NV = $854E; - {$EXTERNALSYM GL_NUM_GENERAL_COMBINERS_NV} - GL_COLOR_SUM_CLAMP_NV = $854F; - {$EXTERNALSYM GL_COLOR_SUM_CLAMP_NV} - GL_COMBINER0_NV = $8550; - {$EXTERNALSYM GL_COMBINER0_NV} - GL_COMBINER1_NV = $8551; - {$EXTERNALSYM GL_COMBINER1_NV} - GL_COMBINER2_NV = $8552; - {$EXTERNALSYM GL_COMBINER2_NV} - GL_COMBINER3_NV = $8553; - {$EXTERNALSYM GL_COMBINER3_NV} - GL_COMBINER4_NV = $8554; - {$EXTERNALSYM GL_COMBINER4_NV} - GL_COMBINER5_NV = $8555; - {$EXTERNALSYM GL_COMBINER5_NV} - GL_COMBINER6_NV = $8556; - {$EXTERNALSYM GL_COMBINER6_NV} - GL_COMBINER7_NV = $8557; - {$EXTERNALSYM GL_COMBINER7_NV} - - // GL_NV_fog_distance - GL_FOG_DISTANCE_MODE_NV = $855A; - {$EXTERNALSYM GL_FOG_DISTANCE_MODE_NV} - GL_EYE_RADIAL_NV = $855B; - {$EXTERNALSYM GL_EYE_RADIAL_NV} - GL_EYE_PLANE_ABSOLUTE_NV = $855C; - {$EXTERNALSYM GL_EYE_PLANE_ABSOLUTE_NV} - - // GL_NV_texgen_emboss - GL_EMBOSS_LIGHT_NV = $855D; - {$EXTERNALSYM GL_EMBOSS_LIGHT_NV} - GL_EMBOSS_CONSTANT_NV = $855E; - {$EXTERNALSYM GL_EMBOSS_CONSTANT_NV} - GL_EMBOSS_MAP_NV = $855F; - {$EXTERNALSYM GL_EMBOSS_MAP_NV} - - // GL_EXT_texture_compression_s3tc - GL_COMPRESSED_RGB_S3TC_DXT1_EXT = $83F0; - {$EXTERNALSYM GL_COMPRESSED_RGB_S3TC_DXT1_EXT} - GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = $83F1; - {$EXTERNALSYM GL_COMPRESSED_RGBA_S3TC_DXT1_EXT} - GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = $83F2; - {$EXTERNALSYM GL_COMPRESSED_RGBA_S3TC_DXT3_EXT} - GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = $83F3; - {$EXTERNALSYM GL_COMPRESSED_RGBA_S3TC_DXT5_EXT} - - // GL_IBM_cull_vertex - GL_CULL_VERTEX_IBM = 103050; - {$EXTERNALSYM GL_CULL_VERTEX_IBM} - - // GL_IBM_vertex_array_lists - GL_VERTEX_ARRAY_LIST_IBM = 103070; - {$EXTERNALSYM GL_VERTEX_ARRAY_LIST_IBM} - GL_NORMAL_ARRAY_LIST_IBM = 103071; - {$EXTERNALSYM GL_NORMAL_ARRAY_LIST_IBM} - GL_COLOR_ARRAY_LIST_IBM = 103072; - {$EXTERNALSYM GL_COLOR_ARRAY_LIST_IBM} - GL_INDEX_ARRAY_LIST_IBM = 103073; - {$EXTERNALSYM GL_INDEX_ARRAY_LIST_IBM} - GL_TEXTURE_COORD_ARRAY_LIST_IBM = 103074; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_LIST_IBM} - GL_EDGE_FLAG_ARRAY_LIST_IBM = 103075; - {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_LIST_IBM} - GL_FOG_COORDINATE_ARRAY_LIST_IBM = 103076; - {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_LIST_IBM} - GL_SECONDARY_COLOR_ARRAY_LIST_IBM = 103077; - {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_LIST_IBM} - GL_VERTEX_ARRAY_LIST_STRIDE_IBM = 103080; - {$EXTERNALSYM GL_VERTEX_ARRAY_LIST_STRIDE_IBM} - GL_NORMAL_ARRAY_LIST_STRIDE_IBM = 103081; - {$EXTERNALSYM GL_NORMAL_ARRAY_LIST_STRIDE_IBM} - GL_COLOR_ARRAY_LIST_STRIDE_IBM = 103082; - {$EXTERNALSYM GL_COLOR_ARRAY_LIST_STRIDE_IBM} - GL_INDEX_ARRAY_LIST_STRIDE_IBM = 103083; - {$EXTERNALSYM GL_INDEX_ARRAY_LIST_STRIDE_IBM} - GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM = 103084; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM} - GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM = 103085; - {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM} - GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM = 103086; - {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM} - GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM = 103087; - {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM} - - // GL_SGIX_subsample - GL_PACK_SUBSAMPLE_RATE_SGIX = $85A0; - {$EXTERNALSYM GL_PACK_SUBSAMPLE_RATE_SGIX} - GL_UNPACK_SUBSAMPLE_RATE_SGIX = $85A1; - {$EXTERNALSYM GL_UNPACK_SUBSAMPLE_RATE_SGIX} - GL_PIXEL_SUBSAMPLE_4444_SGIX = $85A2; - {$EXTERNALSYM GL_PIXEL_SUBSAMPLE_4444_SGIX} - GL_PIXEL_SUBSAMPLE_2424_SGIX = $85A3; - {$EXTERNALSYM GL_PIXEL_SUBSAMPLE_2424_SGIX} - GL_PIXEL_SUBSAMPLE_4242_SGIX = $85A4; - {$EXTERNALSYM GL_PIXEL_SUBSAMPLE_4242_SGIX} - - // GL_SGIX_ycrcba - GL_YCRCB_SGIX = $8318; - {$EXTERNALSYM GL_YCRCB_SGIX} - GL_YCRCBA_SGIX = $8319; - {$EXTERNALSYM GL_YCRCBA_SGIX} - - // GL_SGI_depth_pass_instrument - GL_DEPTH_PASS_INSTRUMENT_SGIX = $8310; - {$EXTERNALSYM GL_DEPTH_PASS_INSTRUMENT_SGIX} - GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX = $8311; - {$EXTERNALSYM GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX} - GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX = $8312; - {$EXTERNALSYM GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX} - - // GL_3DFX_texture_compression_FXT1 - GL_COMPRESSED_RGB_FXT1_3DFX = $86B0; - {$EXTERNALSYM GL_COMPRESSED_RGB_FXT1_3DFX} - GL_COMPRESSED_RGBA_FXT1_3DFX = $86B1; - {$EXTERNALSYM GL_COMPRESSED_RGBA_FXT1_3DFX} - - // GL_3DFX_multisample - GL_MULTISAMPLE_3DFX = $86B2; - {$EXTERNALSYM GL_MULTISAMPLE_3DFX} - GL_SAMPLE_BUFFERS_3DFX = $86B3; - {$EXTERNALSYM GL_SAMPLE_BUFFERS_3DFX} - GL_SAMPLES_3DFX = $86B4; - {$EXTERNALSYM GL_SAMPLES_3DFX} - GL_MULTISAMPLE_BIT_3DFX = $20000000; - {$EXTERNALSYM GL_MULTISAMPLE_BIT_3DFX} - - // GL_EXT_multisample - GL_MULTISAMPLE_EXT = $809D; - {$EXTERNALSYM GL_MULTISAMPLE_EXT} - GL_SAMPLE_ALPHA_TO_MASK_EXT = $809E; - {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_MASK_EXT} - GL_SAMPLE_ALPHA_TO_ONE_EXT = $809F; - {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_ONE_EXT} - GL_SAMPLE_MASK_EXT = $80A0; - {$EXTERNALSYM GL_SAMPLE_MASK_EXT} - GL_1PASS_EXT = $80A1; - {$EXTERNALSYM GL_1PASS_EXT} - GL_2PASS_0_EXT = $80A2; - {$EXTERNALSYM GL_2PASS_0_EXT} - GL_2PASS_1_EXT = $80A3; - {$EXTERNALSYM GL_2PASS_1_EXT} - GL_4PASS_0_EXT = $80A4; - {$EXTERNALSYM GL_4PASS_0_EXT} - GL_4PASS_1_EXT = $80A5; - {$EXTERNALSYM GL_4PASS_1_EXT} - GL_4PASS_2_EXT = $80A6; - {$EXTERNALSYM GL_4PASS_2_EXT} - GL_4PASS_3_EXT = $80A7; - {$EXTERNALSYM GL_4PASS_3_EXT} - GL_SAMPLE_BUFFERS_EXT = $80A8; - {$EXTERNALSYM GL_SAMPLE_BUFFERS_EXT} - GL_SAMPLES_EXT = $80A9; - {$EXTERNALSYM GL_SAMPLES_EXT} - GL_SAMPLE_MASK_VALUE_EXT = $80AA; - {$EXTERNALSYM GL_SAMPLE_MASK_VALUE_EXT} - GL_SAMPLE_MASK_INVERT_EXT = $80AB; - {$EXTERNALSYM GL_SAMPLE_MASK_INVERT_EXT} - GL_SAMPLE_PATTERN_EXT = $80AC; - {$EXTERNALSYM GL_SAMPLE_PATTERN_EXT} - - // GL_SGIX_vertex_preclip - GL_VERTEX_PRECLIP_SGIX = $83EE; - {$EXTERNALSYM GL_VERTEX_PRECLIP_SGIX} - GL_VERTEX_PRECLIP_HINT_SGIX = $83EF; - {$EXTERNALSYM GL_VERTEX_PRECLIP_HINT_SGIX} - - // GL_SGIX_convolution_accuracy - GL_CONVOLUTION_HINT_SGIX = $8316; - {$EXTERNALSYM GL_CONVOLUTION_HINT_SGIX} - - // GL_SGIX_resample - GL_PACK_RESAMPLE_SGIX = $842C; - {$EXTERNALSYM GL_PACK_RESAMPLE_SGIX} - GL_UNPACK_RESAMPLE_SGIX = $842D; - {$EXTERNALSYM GL_UNPACK_RESAMPLE_SGIX} - GL_RESAMPLE_REPLICATE_SGIX = $842E; - {$EXTERNALSYM GL_RESAMPLE_REPLICATE_SGIX} - GL_RESAMPLE_ZERO_FILL_SGIX = $842F; - {$EXTERNALSYM GL_RESAMPLE_ZERO_FILL_SGIX} - GL_RESAMPLE_DECIMATE_SGIX = $8430; - {$EXTERNALSYM GL_RESAMPLE_DECIMATE_SGIX} - - // GL_SGIS_point_line_texgen - GL_EYE_DISTANCE_TO_POINT_SGIS = $81F0; - {$EXTERNALSYM GL_EYE_DISTANCE_TO_POINT_SGIS} - GL_OBJECT_DISTANCE_TO_POINT_SGIS = $81F1; - {$EXTERNALSYM GL_OBJECT_DISTANCE_TO_POINT_SGIS} - GL_EYE_DISTANCE_TO_LINE_SGIS = $81F2; - {$EXTERNALSYM GL_EYE_DISTANCE_TO_LINE_SGIS} - GL_OBJECT_DISTANCE_TO_LINE_SGIS = $81F3; - {$EXTERNALSYM GL_OBJECT_DISTANCE_TO_LINE_SGIS} - GL_EYE_POINT_SGIS = $81F4; - {$EXTERNALSYM GL_EYE_POINT_SGIS} - GL_OBJECT_POINT_SGIS = $81F5; - {$EXTERNALSYM GL_OBJECT_POINT_SGIS} - GL_EYE_LINE_SGIS = $81F6; - {$EXTERNALSYM GL_EYE_LINE_SGIS} - GL_OBJECT_LINE_SGIS = $81F7; - {$EXTERNALSYM GL_OBJECT_LINE_SGIS} - - // GL_SGIS_texture_color_mask - GL_TEXTURE_COLOR_WRITEMASK_SGIS = $81EF; - {$EXTERNALSYM GL_TEXTURE_COLOR_WRITEMASK_SGIS} - - // GL_NV_vertex_program - GL_VERTEX_PROGRAM_NV = $8620; - {$EXTERNALSYM GL_VERTEX_PROGRAM_NV} - GL_VERTEX_STATE_PROGRAM_NV = $8621; - {$EXTERNALSYM GL_VERTEX_STATE_PROGRAM_NV} - GL_ATTRIB_ARRAY_SIZE_NV = $8623; - {$EXTERNALSYM GL_ATTRIB_ARRAY_SIZE_NV} - GL_ATTRIB_ARRAY_STRIDE_NV = $8624; - {$EXTERNALSYM GL_ATTRIB_ARRAY_STRIDE_NV} - GL_ATTRIB_ARRAY_TYPE_NV = $8625; - {$EXTERNALSYM GL_ATTRIB_ARRAY_TYPE_NV} - GL_CURRENT_ATTRIB_NV = $8626; - {$EXTERNALSYM GL_CURRENT_ATTRIB_NV} - GL_PROGRAM_LENGTH_NV = $8627; - {$EXTERNALSYM GL_PROGRAM_LENGTH_NV} - GL_PROGRAM_STRING_NV = $8628; - {$EXTERNALSYM GL_PROGRAM_STRING_NV} - GL_MODELVIEW_PROJECTION_NV = $8629; - {$EXTERNALSYM GL_MODELVIEW_PROJECTION_NV} - GL_IDENTITY_NV = $862A; - {$EXTERNALSYM GL_IDENTITY_NV} - GL_INVERSE_NV = $862B; - {$EXTERNALSYM GL_INVERSE_NV} - GL_TRANSPOSE_NV = $862C; - {$EXTERNALSYM GL_TRANSPOSE_NV} - GL_INVERSE_TRANSPOSE_NV = $862D; - {$EXTERNALSYM GL_INVERSE_TRANSPOSE_NV} - GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV = $862E; - {$EXTERNALSYM GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV} - GL_MAX_TRACK_MATRICES_NV = $862F; - {$EXTERNALSYM GL_MAX_TRACK_MATRICES_NV} - GL_MATRIX0_NV = $8630; - {$EXTERNALSYM GL_MATRIX0_NV} - GL_MATRIX1_NV = $8631; - {$EXTERNALSYM GL_MATRIX1_NV} - GL_MATRIX2_NV = $8632; - {$EXTERNALSYM GL_MATRIX2_NV} - GL_MATRIX3_NV = $8633; - {$EXTERNALSYM GL_MATRIX3_NV} - GL_MATRIX4_NV = $8634; - {$EXTERNALSYM GL_MATRIX4_NV} - GL_MATRIX5_NV = $8635; - {$EXTERNALSYM GL_MATRIX5_NV} - GL_MATRIX6_NV = $8636; - {$EXTERNALSYM GL_MATRIX6_NV} - GL_MATRIX7_NV = $8637; - {$EXTERNALSYM GL_MATRIX7_NV} - GL_CURRENT_MATRIX_STACK_DEPTH_NV = $8640; - {$EXTERNALSYM GL_CURRENT_MATRIX_STACK_DEPTH_NV} - GL_CURRENT_MATRIX_NV = $8641; - {$EXTERNALSYM GL_CURRENT_MATRIX_NV} - GL_VERTEX_PROGRAM_POINT_SIZE_NV = $8642; - {$EXTERNALSYM GL_VERTEX_PROGRAM_POINT_SIZE_NV} - GL_VERTEX_PROGRAM_TWO_SIDE_NV = $8643; - {$EXTERNALSYM GL_VERTEX_PROGRAM_TWO_SIDE_NV} - GL_PROGRAM_PARAMETER_NV = $8644; - {$EXTERNALSYM GL_PROGRAM_PARAMETER_NV} - GL_ATTRIB_ARRAY_POINTER_NV = $8645; - {$EXTERNALSYM GL_ATTRIB_ARRAY_POINTER_NV} - GL_PROGRAM_TARGET_NV = $8646; - {$EXTERNALSYM GL_PROGRAM_TARGET_NV} - GL_PROGRAM_RESIDENT_NV = $8647; - {$EXTERNALSYM GL_PROGRAM_RESIDENT_NV} - GL_TRACK_MATRIX_NV = $8648; - {$EXTERNALSYM GL_TRACK_MATRIX_NV} - GL_TRACK_MATRIX_TRANSFORM_NV = $8649; - {$EXTERNALSYM GL_TRACK_MATRIX_TRANSFORM_NV} - GL_VERTEX_PROGRAM_BINDING_NV = $864A; - {$EXTERNALSYM GL_VERTEX_PROGRAM_BINDING_NV} - GL_PROGRAM_ERROR_POSITION_NV = $864B; - {$EXTERNALSYM GL_PROGRAM_ERROR_POSITION_NV} - GL_VERTEX_ATTRIB_ARRAY0_NV = $8650; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY0_NV} - GL_VERTEX_ATTRIB_ARRAY1_NV = $8651; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY1_NV} - GL_VERTEX_ATTRIB_ARRAY2_NV = $8652; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY2_NV} - GL_VERTEX_ATTRIB_ARRAY3_NV = $8653; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY3_NV} - GL_VERTEX_ATTRIB_ARRAY4_NV = $8654; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY4_NV} - GL_VERTEX_ATTRIB_ARRAY5_NV = $8655; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY5_NV} - GL_VERTEX_ATTRIB_ARRAY6_NV = $8656; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY6_NV} - GL_VERTEX_ATTRIB_ARRAY7_NV = $8657; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY7_NV} - GL_VERTEX_ATTRIB_ARRAY8_NV = $8658; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY8_NV} - GL_VERTEX_ATTRIB_ARRAY9_NV = $8659; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY9_NV} - GL_VERTEX_ATTRIB_ARRAY10_NV = $865A; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY10_NV} - GL_VERTEX_ATTRIB_ARRAY11_NV = $865B; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY11_NV} - GL_VERTEX_ATTRIB_ARRAY12_NV = $865C; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY12_NV} - GL_VERTEX_ATTRIB_ARRAY13_NV = $865D; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY13_NV} - GL_VERTEX_ATTRIB_ARRAY14_NV = $865E; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY14_NV} - GL_VERTEX_ATTRIB_ARRAY15_NV = $865F; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY15_NV} - GL_MAP1_VERTEX_ATTRIB0_4_NV = $8660; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB0_4_NV} - GL_MAP1_VERTEX_ATTRIB1_4_NV = $8661; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB1_4_NV} - GL_MAP1_VERTEX_ATTRIB2_4_NV = $8662; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB2_4_NV} - GL_MAP1_VERTEX_ATTRIB3_4_NV = $8663; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB3_4_NV} - GL_MAP1_VERTEX_ATTRIB4_4_NV = $8664; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB4_4_NV} - GL_MAP1_VERTEX_ATTRIB5_4_NV = $8665; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB5_4_NV} - GL_MAP1_VERTEX_ATTRIB6_4_NV = $8666; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB6_4_NV} - GL_MAP1_VERTEX_ATTRIB7_4_NV = $8667; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB7_4_NV} - GL_MAP1_VERTEX_ATTRIB8_4_NV = $8668; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB8_4_NV} - GL_MAP1_VERTEX_ATTRIB9_4_NV = $8669; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB9_4_NV} - GL_MAP1_VERTEX_ATTRIB10_4_NV = $866A; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB10_4_NV} - GL_MAP1_VERTEX_ATTRIB11_4_NV = $866B; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB11_4_NV} - GL_MAP1_VERTEX_ATTRIB12_4_NV = $866C; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB12_4_NV} - GL_MAP1_VERTEX_ATTRIB13_4_NV = $866D; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB13_4_NV} - GL_MAP1_VERTEX_ATTRIB14_4_NV = $866E; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB14_4_NV} - GL_MAP1_VERTEX_ATTRIB15_4_NV = $866F; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB15_4_NV} - GL_MAP2_VERTEX_ATTRIB0_4_NV = $8670; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB0_4_NV} - GL_MAP2_VERTEX_ATTRIB1_4_NV = $8671; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB1_4_NV} - GL_MAP2_VERTEX_ATTRIB2_4_NV = $8672; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB2_4_NV} - GL_MAP2_VERTEX_ATTRIB3_4_NV = $8673; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB3_4_NV} - GL_MAP2_VERTEX_ATTRIB4_4_NV = $8674; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB4_4_NV} - GL_MAP2_VERTEX_ATTRIB5_4_NV = $8675; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB5_4_NV} - GL_MAP2_VERTEX_ATTRIB6_4_NV = $8676; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB6_4_NV} - GL_MAP2_VERTEX_ATTRIB7_4_NV = $8677; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB7_4_NV} - GL_MAP2_VERTEX_ATTRIB8_4_NV = $8678; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB8_4_NV} - GL_MAP2_VERTEX_ATTRIB9_4_NV = $8679; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB9_4_NV} - GL_MAP2_VERTEX_ATTRIB10_4_NV = $867A; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB10_4_NV} - GL_MAP2_VERTEX_ATTRIB11_4_NV = $867B; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB11_4_NV} - GL_MAP2_VERTEX_ATTRIB12_4_NV = $867C; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB12_4_NV} - GL_MAP2_VERTEX_ATTRIB13_4_NV = $867D; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB13_4_NV} - GL_MAP2_VERTEX_ATTRIB14_4_NV = $867E; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB14_4_NV} - GL_MAP2_VERTEX_ATTRIB15_4_NV = $867F; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB15_4_NV} - - // WGL_ARB_pixel_format - WGL_NUMBER_PIXEL_FORMATS_ARB = $2000; - {$EXTERNALSYM WGL_NUMBER_PIXEL_FORMATS_ARB} - WGL_DRAW_TO_WINDOW_ARB = $2001; - {$EXTERNALSYM WGL_DRAW_TO_WINDOW_ARB} - WGL_DRAW_TO_BITMAP_ARB = $2002; - {$EXTERNALSYM WGL_DRAW_TO_BITMAP_ARB} - WGL_ACCELERATION_ARB = $2003; - {$EXTERNALSYM WGL_ACCELERATION_ARB} - WGL_NEED_PALETTE_ARB = $2004; - {$EXTERNALSYM WGL_NEED_PALETTE_ARB} - WGL_NEED_SYSTEM_PALETTE_ARB = $2005; - {$EXTERNALSYM WGL_NEED_SYSTEM_PALETTE_ARB} - WGL_SWAP_LAYER_BUFFERS_ARB = $2006; - {$EXTERNALSYM WGL_SWAP_LAYER_BUFFERS_ARB} - WGL_SWAP_METHOD_ARB = $2007; - {$EXTERNALSYM WGL_SWAP_METHOD_ARB} - WGL_NUMBER_OVERLAYS_ARB = $2008; - {$EXTERNALSYM WGL_NUMBER_OVERLAYS_ARB} - WGL_NUMBER_UNDERLAYS_ARB = $2009; - {$EXTERNALSYM WGL_NUMBER_UNDERLAYS_ARB} - WGL_TRANSPARENT_ARB = $200A; - {$EXTERNALSYM WGL_TRANSPARENT_ARB} - WGL_TRANSPARENT_RED_VALUE_ARB = $2037; - {$EXTERNALSYM WGL_TRANSPARENT_RED_VALUE_ARB} - WGL_TRANSPARENT_GREEN_VALUE_ARB = $2038; - {$EXTERNALSYM WGL_TRANSPARENT_GREEN_VALUE_ARB} - WGL_TRANSPARENT_BLUE_VALUE_ARB = $2039; - {$EXTERNALSYM WGL_TRANSPARENT_BLUE_VALUE_ARB} - WGL_TRANSPARENT_ALPHA_VALUE_ARB = $203A; - {$EXTERNALSYM WGL_TRANSPARENT_ALPHA_VALUE_ARB} - WGL_TRANSPARENT_INDEX_VALUE_ARB = $203B; - {$EXTERNALSYM WGL_TRANSPARENT_INDEX_VALUE_ARB} - WGL_SHARE_DEPTH_ARB = $200C; - {$EXTERNALSYM WGL_SHARE_DEPTH_ARB} - WGL_SHARE_STENCIL_ARB = $200D; - {$EXTERNALSYM WGL_SHARE_STENCIL_ARB} - WGL_SHARE_ACCUM_ARB = $200E; - {$EXTERNALSYM WGL_SHARE_ACCUM_ARB} - WGL_SUPPORT_GDI_ARB = $200F; - {$EXTERNALSYM WGL_SUPPORT_GDI_ARB} - WGL_SUPPORT_OPENGL_ARB = $2010; - {$EXTERNALSYM WGL_SUPPORT_OPENGL_ARB} - WGL_DOUBLE_BUFFER_ARB = $2011; - {$EXTERNALSYM WGL_DOUBLE_BUFFER_ARB} - WGL_STEREO_ARB = $2012; - {$EXTERNALSYM WGL_STEREO_ARB} - WGL_PIXEL_TYPE_ARB = $2013; - {$EXTERNALSYM WGL_PIXEL_TYPE_ARB} - WGL_COLOR_BITS_ARB = $2014; - {$EXTERNALSYM WGL_COLOR_BITS_ARB} - WGL_RED_BITS_ARB = $2015; - {$EXTERNALSYM WGL_RED_BITS_ARB} - WGL_RED_SHIFT_ARB = $2016; - {$EXTERNALSYM WGL_RED_SHIFT_ARB} - WGL_GREEN_BITS_ARB = $2017; - {$EXTERNALSYM WGL_GREEN_BITS_ARB} - WGL_GREEN_SHIFT_ARB = $2018; - {$EXTERNALSYM WGL_GREEN_SHIFT_ARB} - WGL_BLUE_BITS_ARB = $2019; - {$EXTERNALSYM WGL_BLUE_BITS_ARB} - WGL_BLUE_SHIFT_ARB = $201A; - {$EXTERNALSYM WGL_BLUE_SHIFT_ARB} - WGL_ALPHA_BITS_ARB = $201B; - {$EXTERNALSYM WGL_ALPHA_BITS_ARB} - WGL_ALPHA_SHIFT_ARB = $201C; - {$EXTERNALSYM WGL_ALPHA_SHIFT_ARB} - WGL_ACCUM_BITS_ARB = $201D; - {$EXTERNALSYM WGL_ACCUM_BITS_ARB} - WGL_ACCUM_RED_BITS_ARB = $201E; - {$EXTERNALSYM WGL_ACCUM_RED_BITS_ARB} - WGL_ACCUM_GREEN_BITS_ARB = $201F; - {$EXTERNALSYM WGL_ACCUM_GREEN_BITS_ARB} - WGL_ACCUM_BLUE_BITS_ARB = $2020; - {$EXTERNALSYM WGL_ACCUM_BLUE_BITS_ARB} - WGL_ACCUM_ALPHA_BITS_ARB = $2021; - {$EXTERNALSYM WGL_ACCUM_ALPHA_BITS_ARB} - WGL_DEPTH_BITS_ARB = $2022; - {$EXTERNALSYM WGL_DEPTH_BITS_ARB} - WGL_STENCIL_BITS_ARB = $2023; - {$EXTERNALSYM WGL_STENCIL_BITS_ARB} - WGL_AUX_BUFFERS_ARB = $2024; - {$EXTERNALSYM WGL_AUX_BUFFERS_ARB} - WGL_NO_ACCELERATION_ARB = $2025; - {$EXTERNALSYM WGL_NO_ACCELERATION_ARB} - WGL_GENERIC_ACCELERATION_ARB = $2026; - {$EXTERNALSYM WGL_GENERIC_ACCELERATION_ARB} - WGL_FULL_ACCELERATION_ARB = $2027; - {$EXTERNALSYM WGL_FULL_ACCELERATION_ARB} - WGL_SWAP_EXCHANGE_ARB = $2028; - {$EXTERNALSYM WGL_SWAP_EXCHANGE_ARB} - WGL_SWAP_COPY_ARB = $2029; - {$EXTERNALSYM WGL_SWAP_COPY_ARB} - WGL_SWAP_UNDEFINED_ARB = $202A; - {$EXTERNALSYM WGL_SWAP_UNDEFINED_ARB} - WGL_TYPE_RGBA_ARB = $202B; - {$EXTERNALSYM WGL_TYPE_RGBA_ARB} - WGL_TYPE_COLORINDEX_ARB = $202C; - {$EXTERNALSYM WGL_TYPE_COLORINDEX_ARB} - - - // ********** GLU generic constants ********** - - // Errors: (return value 0 = no error) - GLU_INVALID_ENUM = 100900; - {$EXTERNALSYM GLU_INVALID_ENUM} - GLU_INVALID_VALUE = 100901; - {$EXTERNALSYM GLU_INVALID_VALUE} - GLU_OUT_OF_MEMORY = 100902; - {$EXTERNALSYM GLU_OUT_OF_MEMORY} - GLU_INCOMPATIBLE_GL_VERSION = 100903; - {$EXTERNALSYM GLU_INCOMPATIBLE_GL_VERSION} - - // StringName - GLU_VERSION = 100800; - {$EXTERNALSYM GLU_VERSION} - GLU_EXTENSIONS = 100801; - {$EXTERNALSYM GLU_EXTENSIONS} - - // Boolean - GLU_TRUE = GL_TRUE; - {$EXTERNALSYM GLU_TRUE} - GLU_FALSE = GL_FALSE; - {$EXTERNALSYM GLU_FALSE} - - // Quadric constants - // QuadricNormal - GLU_SMOOTH = 100000; - {$EXTERNALSYM GLU_SMOOTH} - GLU_FLAT = 100001; - {$EXTERNALSYM GLU_FLAT} - GLU_NONE = 100002; - {$EXTERNALSYM GLU_NONE} - - // QuadricDrawStyle - GLU_POINT = 100010; - {$EXTERNALSYM GLU_POINT} - GLU_LINE = 100011; - {$EXTERNALSYM GLU_LINE} - GLU_FILL = 100012; - {$EXTERNALSYM GLU_FILL} - GLU_SILHOUETTE = 100013; - {$EXTERNALSYM GLU_SILHOUETTE} - - // QuadricOrientation - GLU_OUTSIDE = 100020; - {$EXTERNALSYM GLU_OUTSIDE} - GLU_INSIDE = 100021; - {$EXTERNALSYM GLU_INSIDE} - - // Tesselation constants - GLU_TESS_MAX_COORD = 1.0e150; - {$EXTERNALSYM GLU_TESS_MAX_COORD} - - // TessProperty - GLU_TESS_WINDING_RULE = 100140; - {$EXTERNALSYM GLU_TESS_WINDING_RULE} - GLU_TESS_BOUNDARY_ONLY = 100141; - {$EXTERNALSYM GLU_TESS_BOUNDARY_ONLY} - GLU_TESS_TOLERANCE = 100142; - {$EXTERNALSYM GLU_TESS_TOLERANCE} - - // TessWinding - GLU_TESS_WINDING_ODD = 100130; - {$EXTERNALSYM GLU_TESS_WINDING_ODD} - GLU_TESS_WINDING_NONZERO = 100131; - {$EXTERNALSYM GLU_TESS_WINDING_NONZERO} - GLU_TESS_WINDING_POSITIVE = 100132; - {$EXTERNALSYM GLU_TESS_WINDING_POSITIVE} - GLU_TESS_WINDING_NEGATIVE = 100133; - {$EXTERNALSYM GLU_TESS_WINDING_NEGATIVE} - GLU_TESS_WINDING_ABS_GEQ_TWO = 100134; - {$EXTERNALSYM GLU_TESS_WINDING_ABS_GEQ_TWO} - - // TessCallback - GLU_TESS_BEGIN = 100100; // TGLUTessBeginProc - {$EXTERNALSYM GLU_TESS_BEGIN} - GLU_TESS_VERTEX = 100101; // TGLUTessVertexProc - {$EXTERNALSYM GLU_TESS_VERTEX} - GLU_TESS_END = 100102; // TGLUTessEndProc - {$EXTERNALSYM GLU_TESS_END} - GLU_TESS_ERROR = 100103; // TGLUTessErrorProc - {$EXTERNALSYM GLU_TESS_ERROR} - GLU_TESS_EDGE_FLAG = 100104; // TGLUTessEdgeFlagProc - {$EXTERNALSYM GLU_TESS_EDGE_FLAG} - GLU_TESS_COMBINE = 100105; // TGLUTessCombineProc - {$EXTERNALSYM GLU_TESS_COMBINE} - GLU_TESS_BEGIN_DATA = 100106; // TGLUTessBeginDataProc - {$EXTERNALSYM GLU_TESS_BEGIN_DATA} - GLU_TESS_VERTEX_DATA = 100107; // TGLUTessVertexDataProc - {$EXTERNALSYM GLU_TESS_VERTEX_DATA} - GLU_TESS_END_DATA = 100108; // TGLUTessEndDataProc - {$EXTERNALSYM GLU_TESS_END_DATA} - GLU_TESS_ERROR_DATA = 100109; // TGLUTessErrorDataProc - {$EXTERNALSYM GLU_TESS_ERROR_DATA} - GLU_TESS_EDGE_FLAG_DATA = 100110; // TGLUTessEdgeFlagDataProc - {$EXTERNALSYM GLU_TESS_EDGE_FLAG_DATA} - GLU_TESS_COMBINE_DATA = 100111; // TGLUTessCombineDataProc - {$EXTERNALSYM GLU_TESS_COMBINE_DATA} - - // TessError - GLU_TESS_ERROR1 = 100151; - {$EXTERNALSYM GLU_TESS_ERROR1} - GLU_TESS_ERROR2 = 100152; - {$EXTERNALSYM GLU_TESS_ERROR2} - GLU_TESS_ERROR3 = 100153; - {$EXTERNALSYM GLU_TESS_ERROR3} - GLU_TESS_ERROR4 = 100154; - {$EXTERNALSYM GLU_TESS_ERROR4} - GLU_TESS_ERROR5 = 100155; - {$EXTERNALSYM GLU_TESS_ERROR5} - GLU_TESS_ERROR6 = 100156; - {$EXTERNALSYM GLU_TESS_ERROR6} - GLU_TESS_ERROR7 = 100157; - {$EXTERNALSYM GLU_TESS_ERROR7} - GLU_TESS_ERROR8 = 100158; - {$EXTERNALSYM GLU_TESS_ERROR8} - - GLU_TESS_MISSING_BEGIN_POLYGON = GLU_TESS_ERROR1; - {$EXTERNALSYM GLU_TESS_MISSING_BEGIN_POLYGON} - GLU_TESS_MISSING_BEGIN_CONTOUR = GLU_TESS_ERROR2; - {$EXTERNALSYM GLU_TESS_MISSING_BEGIN_CONTOUR} - GLU_TESS_MISSING_END_POLYGON = GLU_TESS_ERROR3; - {$EXTERNALSYM GLU_TESS_MISSING_END_POLYGON} - GLU_TESS_MISSING_END_CONTOUR = GLU_TESS_ERROR4; - {$EXTERNALSYM GLU_TESS_MISSING_END_CONTOUR} - GLU_TESS_COORD_TOO_LARGE = GLU_TESS_ERROR5; - {$EXTERNALSYM GLU_TESS_COORD_TOO_LARGE} - GLU_TESS_NEED_COMBINE_CALLBACK = GLU_TESS_ERROR6; - {$EXTERNALSYM GLU_TESS_NEED_COMBINE_CALLBACK} - - // NURBS constants - - // NurbsProperty - GLU_AUTO_LOAD_MATRIX = 100200; - {$EXTERNALSYM GLU_AUTO_LOAD_MATRIX} - GLU_CULLING = 100201; - {$EXTERNALSYM GLU_CULLING} - GLU_SAMPLING_TOLERANCE = 100203; - {$EXTERNALSYM GLU_SAMPLING_TOLERANCE} - GLU_DISPLAY_MODE = 100204; - {$EXTERNALSYM GLU_DISPLAY_MODE} - GLU_PARAMETRIC_TOLERANCE = 100202; - {$EXTERNALSYM GLU_PARAMETRIC_TOLERANCE} - GLU_SAMPLING_METHOD = 100205; - {$EXTERNALSYM GLU_SAMPLING_METHOD} - GLU_U_STEP = 100206; - {$EXTERNALSYM GLU_U_STEP} - GLU_V_STEP = 100207; - {$EXTERNALSYM GLU_V_STEP} - - // NurbsSampling - GLU_PATH_LENGTH = 100215; - {$EXTERNALSYM GLU_PATH_LENGTH} - GLU_PARAMETRIC_ERROR = 100216; - {$EXTERNALSYM GLU_PARAMETRIC_ERROR} - GLU_DOMAIN_DISTANCE = 100217; - {$EXTERNALSYM GLU_DOMAIN_DISTANCE} - - // NurbsTrim - GLU_MAP1_TRIM_2 = 100210; - {$EXTERNALSYM GLU_MAP1_TRIM_2} - GLU_MAP1_TRIM_3 = 100211; - {$EXTERNALSYM GLU_MAP1_TRIM_3} - - // NurbsDisplay - GLU_OUTLINE_POLYGON = 100240; - {$EXTERNALSYM GLU_OUTLINE_POLYGON} - GLU_OUTLINE_PATCH = 100241; - {$EXTERNALSYM GLU_OUTLINE_PATCH} - - // NurbsErrors - GLU_NURBS_ERROR1 = 100251; - {$EXTERNALSYM GLU_NURBS_ERROR1} - GLU_NURBS_ERROR2 = 100252; - {$EXTERNALSYM GLU_NURBS_ERROR2} - GLU_NURBS_ERROR3 = 100253; - {$EXTERNALSYM GLU_NURBS_ERROR3} - GLU_NURBS_ERROR4 = 100254; - {$EXTERNALSYM GLU_NURBS_ERROR4} - GLU_NURBS_ERROR5 = 100255; - {$EXTERNALSYM GLU_NURBS_ERROR5} - GLU_NURBS_ERROR6 = 100256; - {$EXTERNALSYM GLU_NURBS_ERROR6} - GLU_NURBS_ERROR7 = 100257; - {$EXTERNALSYM GLU_NURBS_ERROR7} - GLU_NURBS_ERROR8 = 100258; - {$EXTERNALSYM GLU_NURBS_ERROR8} - GLU_NURBS_ERROR9 = 100259; - {$EXTERNALSYM GLU_NURBS_ERROR9} - GLU_NURBS_ERROR10 = 100260; - {$EXTERNALSYM GLU_NURBS_ERROR10} - GLU_NURBS_ERROR11 = 100261; - {$EXTERNALSYM GLU_NURBS_ERROR11} - GLU_NURBS_ERROR12 = 100262; - {$EXTERNALSYM GLU_NURBS_ERROR12} - GLU_NURBS_ERROR13 = 100263; - {$EXTERNALSYM GLU_NURBS_ERROR13} - GLU_NURBS_ERROR14 = 100264; - {$EXTERNALSYM GLU_NURBS_ERROR14} - GLU_NURBS_ERROR15 = 100265; - {$EXTERNALSYM GLU_NURBS_ERROR15} - GLU_NURBS_ERROR16 = 100266; - {$EXTERNALSYM GLU_NURBS_ERROR16} - GLU_NURBS_ERROR17 = 100267; - {$EXTERNALSYM GLU_NURBS_ERROR17} - GLU_NURBS_ERROR18 = 100268; - {$EXTERNALSYM GLU_NURBS_ERROR18} - GLU_NURBS_ERROR19 = 100269; - {$EXTERNALSYM GLU_NURBS_ERROR19} - GLU_NURBS_ERROR20 = 100270; - {$EXTERNALSYM GLU_NURBS_ERROR20} - GLU_NURBS_ERROR21 = 100271; - {$EXTERNALSYM GLU_NURBS_ERROR21} - GLU_NURBS_ERROR22 = 100272; - {$EXTERNALSYM GLU_NURBS_ERROR22} - GLU_NURBS_ERROR23 = 100273; - {$EXTERNALSYM GLU_NURBS_ERROR23} - GLU_NURBS_ERROR24 = 100274; - {$EXTERNALSYM GLU_NURBS_ERROR24} - GLU_NURBS_ERROR25 = 100275; - {$EXTERNALSYM GLU_NURBS_ERROR25} - GLU_NURBS_ERROR26 = 100276; - {$EXTERNALSYM GLU_NURBS_ERROR26} - GLU_NURBS_ERROR27 = 100277; - {$EXTERNALSYM GLU_NURBS_ERROR27} - GLU_NURBS_ERROR28 = 100278; - {$EXTERNALSYM GLU_NURBS_ERROR28} - GLU_NURBS_ERROR29 = 100279; - {$EXTERNALSYM GLU_NURBS_ERROR29} - GLU_NURBS_ERROR30 = 100280; - {$EXTERNALSYM GLU_NURBS_ERROR30} - GLU_NURBS_ERROR31 = 100281; - {$EXTERNALSYM GLU_NURBS_ERROR31} - GLU_NURBS_ERROR32 = 100282; - {$EXTERNALSYM GLU_NURBS_ERROR32} - GLU_NURBS_ERROR33 = 100283; - {$EXTERNALSYM GLU_NURBS_ERROR33} - GLU_NURBS_ERROR34 = 100284; - {$EXTERNALSYM GLU_NURBS_ERROR34} - GLU_NURBS_ERROR35 = 100285; - {$EXTERNALSYM GLU_NURBS_ERROR35} - GLU_NURBS_ERROR36 = 100286; - {$EXTERNALSYM GLU_NURBS_ERROR36} - GLU_NURBS_ERROR37 = 100287; - {$EXTERNALSYM GLU_NURBS_ERROR37} - - // Contours types -- obsolete! - GLU_CW = 100120; - {$EXTERNALSYM GLU_CW} - GLU_CCW = 100121; - {$EXTERNALSYM GLU_CCW} - GLU_INTERIOR = 100122; - {$EXTERNALSYM GLU_INTERIOR} - GLU_EXTERIOR = 100123; - {$EXTERNALSYM GLU_EXTERIOR} - GLU_UNKNOWN = 100124; - {$EXTERNALSYM GLU_UNKNOWN} - - // Names without "TESS_" prefix - GLU_BEGIN = GLU_TESS_BEGIN; - {$EXTERNALSYM GLU_BEGIN} - GLU_VERTEX = GLU_TESS_VERTEX; - {$EXTERNALSYM GLU_VERTEX} - GLU_END = GLU_TESS_END; - {$EXTERNALSYM GLU_END} - GLU_ERROR = GLU_TESS_ERROR; - {$EXTERNALSYM GLU_ERROR} - GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG; - {$EXTERNALSYM GLU_EDGE_FLAG} - - GLX_VERSION_1_1 = 1; - GLX_VERSION_1_2 = 1; - GLX_VERSION_1_3 = 1; - GLX_EXTENSION_NAME = 'GLX'; - {$EXTERNALSYM GLX_EXTENSION_NAME} - GLX_USE_GL = 1; - {$EXTERNALSYM GLX_USE_GL} - GLX_BUFFER_SIZE = 2; - {$EXTERNALSYM GLX_BUFFER_SIZE} - GLX_LEVEL = 3; - {$EXTERNALSYM GLX_LEVEL} - GLX_RGBA = 4; - {$EXTERNALSYM GLX_RGBA} - GLX_DOUBLEBUFFER = 5; - {$EXTERNALSYM GLX_DOUBLEBUFFER} - GLX_STEREO = 6; - {$EXTERNALSYM GLX_STEREO} - GLX_AUX_BUFFERS = 7; - {$EXTERNALSYM GLX_AUX_BUFFERS} - GLX_RED_SIZE = 8; - {$EXTERNALSYM GLX_RED_SIZE} - GLX_GREEN_SIZE = 9; - {$EXTERNALSYM GLX_GREEN_SIZE} - GLX_BLUE_SIZE = 10; - {$EXTERNALSYM GLX_BLUE_SIZE} - GLX_ALPHA_SIZE = 11; - {$EXTERNALSYM GLX_ALPHA_SIZE} - GLX_DEPTH_SIZE = 12; - {$EXTERNALSYM GLX_DEPTH_SIZE} - GLX_STENCIL_SIZE = 13; - {$EXTERNALSYM GLX_STENCIL_SIZE} - GLX_ACCUM_RED_SIZE = 14; - {$EXTERNALSYM GLX_ACCUM_RED_SIZE} - GLX_ACCUM_GREEN_SIZE = 15; - {$EXTERNALSYM GLX_ACCUM_GREEN_SIZE} - GLX_ACCUM_BLUE_SIZE = 16; - {$EXTERNALSYM GLX_ACCUM_BLUE_SIZE} - GLX_ACCUM_ALPHA_SIZE = 17; - {$EXTERNALSYM GLX_ACCUM_ALPHA_SIZE} - - // Error codes returned by glXGetConfig: - GLX_BAD_SCREEN = 1; - {$EXTERNALSYM GLX_BAD_SCREEN} - GLX_BAD_ATTRIBUTE = 2; - {$EXTERNALSYM GLX_BAD_ATTRIBUTE} - GLX_NO_EXTENSION = 3; - {$EXTERNALSYM GLX_NO_EXTENSION} - GLX_BAD_VISUAL = 4; - {$EXTERNALSYM GLX_BAD_VISUAL} - GLX_BAD_CONTEXT = 5; - {$EXTERNALSYM GLX_BAD_CONTEXT} - GLX_BAD_VALUE = 6; - {$EXTERNALSYM GLX_BAD_VALUE} - GLX_BAD_ENUM = 7; - {$EXTERNALSYM GLX_BAD_ENUM} - - // GLX 1.1 and later: - GLX_VENDOR = 1; - {$EXTERNALSYM GLX_VENDOR} - GLX_VERSION = 2; - {$EXTERNALSYM GLX_VERSION} - GLX_EXTENSIONS = 3; - {$EXTERNALSYM GLX_EXTENSIONS} - - // GLX 1.3 and later: - GLX_CONFIG_CAVEAT = $20; - {$EXTERNALSYM GLX_CONFIG_CAVEAT} - GLX_DONT_CARE = $FFFFFFFF; - {$EXTERNALSYM GLX_DONT_CARE} - GLX_SLOW_CONFIG = $8001; - {$EXTERNALSYM GLX_SLOW_CONFIG} - GLX_NON_CONFORMANT_CONFIG = $800D; - {$EXTERNALSYM GLX_NON_CONFORMANT_CONFIG} - GLX_X_VISUAL_TYPE = $22; - {$EXTERNALSYM GLX_X_VISUAL_TYPE} - GLX_TRANSPARENT_TYPE = $23; - {$EXTERNALSYM GLX_TRANSPARENT_TYPE} - GLX_TRANSPARENT_INDEX_VALUE = $24; - {$EXTERNALSYM GLX_TRANSPARENT_INDEX_VALUE} - GLX_TRANSPARENT_RED_VALUE = $25; - {$EXTERNALSYM GLX_TRANSPARENT_RED_VALUE} - GLX_TRANSPARENT_GREEN_VALUE = $26; - {$EXTERNALSYM GLX_TRANSPARENT_GREEN_VALUE} - GLX_TRANSPARENT_BLUE_VALUE = $27; - {$EXTERNALSYM GLX_TRANSPARENT_BLUE_VALUE} - GLX_TRANSPARENT_ALPHA_VALUE = $28; - {$EXTERNALSYM GLX_TRANSPARENT_ALPHA_VALUE} - GLX_MAX_PBUFFER_WIDTH = $8016; - {$EXTERNALSYM GLX_MAX_PBUFFER_WIDTH} - GLX_MAX_PBUFFER_HEIGHT = $8017; - {$EXTERNALSYM GLX_MAX_PBUFFER_HEIGHT} - GLX_MAX_PBUFFER_PIXELS = $8018; - {$EXTERNALSYM GLX_MAX_PBUFFER_PIXELS} - GLX_PRESERVED_CONTENTS = $801B; - {$EXTERNALSYM GLX_PRESERVED_CONTENTS} - GLX_LARGEST_BUFFER = $801C; - {$EXTERNALSYM GLX_LARGEST_BUFFER} - GLX_DRAWABLE_TYPE = $8010; - {$EXTERNALSYM GLX_DRAWABLE_TYPE} - GLX_FBCONFIG_ID = $8013; - {$EXTERNALSYM GLX_FBCONFIG_ID} - GLX_VISUAL_ID = $800B; - {$EXTERNALSYM GLX_VISUAL_ID} - GLX_WINDOW_BIT = $00000001; - {$EXTERNALSYM GLX_WINDOW_BIT} - GLX_PIXMAP_BIT = $00000002; - {$EXTERNALSYM GLX_PIXMAP_BIT} - GLX_PBUFFER_BIT = $00000004; - {$EXTERNALSYM GLX_PBUFFER_BIT} - GLX_AUX_BUFFERS_BIT = $00000010; - {$EXTERNALSYM GLX_AUX_BUFFERS_BIT} - GLX_FRONT_LEFT_BUFFER_BIT = $00000001; - {$EXTERNALSYM GLX_FRONT_LEFT_BUFFER_BIT} - GLX_FRONT_RIGHT_BUFFER_BIT = $00000002; - {$EXTERNALSYM GLX_FRONT_RIGHT_BUFFER_BIT} - GLX_BACK_LEFT_BUFFER_BIT = $00000004; - {$EXTERNALSYM GLX_BACK_LEFT_BUFFER_BIT} - GLX_BACK_RIGHT_BUFFER_BIT = $00000008; - {$EXTERNALSYM GLX_BACK_RIGHT_BUFFER_BIT} - GLX_DEPTH_BUFFER_BIT = $00000020; - {$EXTERNALSYM GLX_DEPTH_BUFFER_BIT} - GLX_STENCIL_BUFFER_BIT = $00000040; - {$EXTERNALSYM GLX_STENCIL_BUFFER_BIT} - GLX_ACCUM_BUFFER_BIT = $00000080; - {$EXTERNALSYM GLX_ACCUM_BUFFER_BIT} - GLX_RENDER_TYPE = $8011; - {$EXTERNALSYM GLX_RENDER_TYPE} - GLX_X_RENDERABLE = $8012; - {$EXTERNALSYM GLX_X_RENDERABLE} - GLX_NONE = $8000; - {$EXTERNALSYM GLX_NONE} - GLX_TRUE_COLOR = $8002; - {$EXTERNALSYM GLX_TRUE_COLOR} - GLX_DIRECT_COLOR = $8003; - {$EXTERNALSYM GLX_DIRECT_COLOR} - GLX_PSEUDO_COLOR = $8004; - {$EXTERNALSYM GLX_PSEUDO_COLOR} - GLX_STATIC_COLOR = $8005; - {$EXTERNALSYM GLX_STATIC_COLOR} - GLX_GRAY_SCALE = $8006; - {$EXTERNALSYM GLX_GRAY_SCALE} - GLX_STATIC_GRAY = $8007; - {$EXTERNALSYM GLX_STATIC_GRAY} - GLX_TRANSPARENT_INDEX = $8009; - {$EXTERNALSYM GLX_TRANSPARENT_INDEX} - GLX_COLOR_INDEX_TYPE = $8015; - {$EXTERNALSYM GLX_COLOR_INDEX_TYPE} - GLX_COLOR_INDEX_BIT = $00000002; - {$EXTERNALSYM GLX_COLOR_INDEX_BIT} - GLX_SCREEN = $800C; - {$EXTERNALSYM GLX_SCREEN} - GLX_PBUFFER_CLOBBER_MASK = $08000000; - {$EXTERNALSYM GLX_PBUFFER_CLOBBER_MASK} - GLX_DAMAGED = $8020; - {$EXTERNALSYM GLX_DAMAGED} - GLX_SAVED = $8021; - {$EXTERNALSYM GLX_SAVED} - GLX_WINDOW = $8022; - {$EXTERNALSYM GLX_WINDOW} - GLX_PBUFFER = $8023; - {$EXTERNALSYM GLX_PBUFFER} - GLX_EXT_visual_info = 1; - {$EXTERNALSYM GLX_EXT_visual_info} - GLX_X_VISUAL_TYPE_EXT = $22; - {$EXTERNALSYM GLX_X_VISUAL_TYPE_EXT} - GLX_TRANSPARENT_TYPE_EXT = $23; - {$EXTERNALSYM GLX_TRANSPARENT_TYPE_EXT} - GLX_TRANSPARENT_INDEX_VALUE_EXT = $24; - {$EXTERNALSYM GLX_TRANSPARENT_INDEX_VALUE_EXT} - GLX_TRANSPARENT_RED_VALUE_EXT = $25; - {$EXTERNALSYM GLX_TRANSPARENT_RED_VALUE_EXT} - GLX_TRANSPARENT_GREEN_VALUE_EXT = $26; - {$EXTERNALSYM GLX_TRANSPARENT_GREEN_VALUE_EXT} - GLX_TRANSPARENT_BLUE_VALUE_EXT = $27; - {$EXTERNALSYM GLX_TRANSPARENT_BLUE_VALUE_EXT} - GLX_TRANSPARENT_ALPHA_VALUE_EXT = $28; - {$EXTERNALSYM GLX_TRANSPARENT_ALPHA_VALUE_EXT} - GLX_TRUE_COLOR_EXT = $8002; - {$EXTERNALSYM GLX_TRUE_COLOR_EXT} - GLX_DIRECT_COLOR_EXT = $8003; - {$EXTERNALSYM GLX_DIRECT_COLOR_EXT} - GLX_PSEUDO_COLOR_EXT = $8004; - {$EXTERNALSYM GLX_PSEUDO_COLOR_EXT} - GLX_STATIC_COLOR_EXT = $8005; - {$EXTERNALSYM GLX_STATIC_COLOR_EXT} - GLX_GRAY_SCALE_EXT = $8006; - {$EXTERNALSYM GLX_GRAY_SCALE_EXT} - GLX_STATIC_GRAY_EXT = $8007; - {$EXTERNALSYM GLX_STATIC_GRAY_EXT} - GLX_NONE_EXT = $8000; - {$EXTERNALSYM GLX_NONE_EXT} - GLX_TRANSPARENT_RGB_EXT = $8008; - {$EXTERNALSYM GLX_TRANSPARENT_RGB_EXT} - GLX_TRANSPARENT_INDEX_EXT = $8009; - {$EXTERNALSYM GLX_TRANSPARENT_INDEX_EXT} - GLX_VISUAL_CAVEAT_EXT = $20; - {$EXTERNALSYM GLX_VISUAL_CAVEAT_EXT} - GLX_SLOW_VISUAL_EXT = $8001; - {$EXTERNALSYM GLX_SLOW_VISUAL_EXT} - GLX_NON_CONFORMANT_VISUAL_EXT = $800D; - {$EXTERNALSYM GLX_NON_CONFORMANT_VISUAL_EXT} - GLX_SHARE_CONTEXT_EXT = $800A; - {$EXTERNALSYM GLX_SHARE_CONTEXT_EXT} - GLX_VISUAL_ID_EXT = $800B; - {$EXTERNALSYM GLX_VISUAL_ID_EXT} - GLX_SCREEN_EXT = $800C; - {$EXTERNALSYM GLX_SCREEN_EXT} - GLX_3DFX_WINDOW_MODE_MESA = $1; - {$EXTERNALSYM GLX_3DFX_WINDOW_MODE_MESA} - GLX_3DFX_FULLSCREEN_MODE_MESA = $2; - {$EXTERNALSYM GLX_3DFX_FULLSCREEN_MODE_MESA} - - -type - // GLU types - TGLUNurbs = record end; - TGLUQuadric = record end; - TGLUTesselator = record end; - - PGLUNurbs = ^TGLUNurbs; - PGLUQuadric = ^TGLUQuadric; - PGLUTesselator = ^TGLUTesselator; - - // backwards compatibility - TGLUNurbsObj = TGLUNurbs; - TGLUQuadricObj = TGLUQuadric; - TGLUTesselatorObj = TGLUTesselator; - TGLUTriangulatorObj = TGLUTesselator; - - PGLUNurbsObj = PGLUNurbs; - PGLUQuadricObj = PGLUQuadric; - PGLUTesselatorObj = PGLUTesselator; - PGLUTriangulatorObj = PGLUTesselator; - - {$ifdef FPC} - PMaxLogPalette = ^TMaxLogPalette; - TMaxLogPalette = packed record - palversion : word; - palnumentries : word; - palpalentry : array[byte] of TPaletteEntry; - end; - {$endif} - - {$ifdef VER100, Delphi 3 compatibility} - PWGLSwap = ^TWGLSwap; - {$EXTERNALSYM _WGLSWAP} - _WGLSWAP = packed record - hdc: HDC; - uiFlags: UINT; - end; - TWGLSwap = _WGLSWAP; - {$EXTERNALSYM WGLSWAP} - WGLSWAP = _WGLSWAP; - {$endif VER100} - - // Callback function prototypes - // GLUQuadricCallback - TGLUQuadricErrorProc = procedure(errorCode: TGLEnum); {$ifdef MSWINDOWS} stdcall; {$endif} {$ifdef LINUX} cdecl; {$endif} - - // GLUTessCallback - TGLUTessBeginProc = procedure(AType: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} - TGLUTessEdgeFlagProc = procedure(Flag: TGLboolean); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} - TGLUTessVertexProc = procedure(VertexData: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} - TGLUTessEndProc = procedure; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} - TGLUTessErrorProc = procedure(ErrNo: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} - TGLUTessCombineProc = procedure(Coords: TVector3d; VertexData: TVector4p; Weight: TVector4f; OutData: PPointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} - TGLUTessBeginDataProc = procedure(AType: TGLEnum; UserData: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} - TGLUTessEdgeFlagDataProc = procedure(Flag: TGLboolean; UserData: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} - TGLUTessVertexDataProc = procedure(VertexData: Pointer; UserData: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} - TGLUTessEndDataProc = procedure(UserData: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} - TGLUTessErrorDataProc = procedure(ErrNo: TGLEnum; UserData: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} - TGLUTessCombineDataProc = procedure(Coords: TVector3d; VertexData: TVector4p; Weight: TVector4f; OutData: PPointer; UserData: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} - - // GLUNurbsCallback - TGLUNurbsErrorProc = procedure(ErrorCode: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} - - // GL functions - procedure glBindTexture(target: TGLEnum; texture: TGLuint); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glTexParameteri(target, pname: TGLEnum; param: TGLint); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glTexImage2D(target: TGLEnum; level, internalformat: TGLint; width, height: TGLsizei; border: TGLint; format, atype: TGLEnum; Pixels:Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glDeleteTextures(n: TGLsizei; textures: PGLuint); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glGenTextures(n: GLsizei; var textures: GLuint); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glColor3f(red, green, blue: TGLfloat); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glBegin(mode: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glEnd; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glVertex2f(x, y: TGLfloat); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glColor4f(red, green, blue, alpha: TGLfloat); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glEnable(cap: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glDisable(cap: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glDepthRange(zNear, zFar: TGLclampd); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glDepthFunc(func: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glBlendFunc(sfactor: TGLEnum; dfactor: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glTexCoord2f(s, t: TGLfloat); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glVertex3f(x, y, z: TGLfloat); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glClearColor(red, green, blue, alpha: TGLclampf); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glClear(mask: TGLbitfield); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glMatrixMode(mode: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glLoadIdentity; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glOrtho(left, right, bottom, top, zNear, zFar: TGLdouble); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glViewport(x, y: TGLint; width, height: TGLsizei); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glReadPixels(x, y: TGLint; width, height: TGLsizei; format, atype: TGLEnum; pixels: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glPixelStorei(pname: TGLEnum; param: TGLint); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - function glGetError:TGLuint; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure glTexSubImage2D(target: TGLEnum; level, xoffset, yoffset: TGLint; width, height: TGLsizei; format, atype: TGLEnum; pixels: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - procedure gluOrtho2D(left, right, bottom, top: TGLdouble); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; - - // GLU functions - function gluBuild2DMipmaps(target: TGLEnum; components, width, height: TGLint; format, atype: TGLEnum; Data: Pointer): TGLint; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external glu32; - function gluScaleImage(format: TGLEnum; widthin, heightin: TGLint; typein: TGLEnum; datain: Pointer; widthout, heightout: TGLint; typeout: TGLEnum; dataout: Pointer): TGLint; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external glu32; - - Procedure LoadOpenGL; - Procedure UnloadOpenGL; - -implementation - -Procedure LoadOpenGL; -begin -end; - -Procedure UnloadOpenGL; -begin -end; - -end. +unit OpenGL12; + +{$I switches.inc} + +interface + +uses Windows; + +const + glu32 = 'OpenGL'; + +type + + TRCOptions = set of ( + opDoubleBuffered, + opGDI, + opStereo + ); + + UINT = Cardinal; + + {$EXTERNALSYM GLenum} + GLenum = UINT; + TGLenum = UINT; + PGLenum = ^TGLenum; + + {$EXTERNALSYM GLboolean} + GLboolean = BYTEBOOL; + TGLboolean = BYTEBOOL; + PGLboolean = ^TGLboolean; + + {$EXTERNALSYM GLbitfield} + GLbitfield = UINT; + TGLbitfield = UINT; + PGLbitfield = ^TGLbitfield; + + {$EXTERNALSYM GLbyte} + GLbyte = ShortInt; + TGLbyte = ShortInt; + PGLbyte = ^TGLbyte; + + {$EXTERNALSYM GLshort} + GLshort = SmallInt; + TGLshort = SmallInt; + PGLshort = ^TGLshort; + + {$EXTERNALSYM GLint} + GLint = Integer; + TGLint = Integer; + PGLint = ^TGLint; + + {$EXTERNALSYM GLsizei} + GLsizei = Integer; + TGLsizei = Integer; + PGLsizei = ^TGLsizei; + + {$EXTERNALSYM GLubyte} + UCHAR = Byte; + GLubyte = UCHAR; + TGLubyte = UCHAR; + PGLubyte = ^TGLubyte; + + {$EXTERNALSYM GLushort} + GLushort = Word; + TGLushort = Word; + PGLushort = ^TGLushort; + + {$EXTERNALSYM GLuint} + GLuint = UINT; + TGLuint = UINT; + PGLuint = ^TGLuint; + + {$EXTERNALSYM GLfloat} + GLfloat = Single; + TGLfloat = Single; + PGLfloat = ^TGLfloat; + + {$EXTERNALSYM GLclampf} + GLclampf = Single; + TGLclampf = Single; + PGLclampf = ^TGLclampf; + + {$EXTERNALSYM GLdouble} + GLdouble = Double; + TGLdouble = Double; + PGLdouble = ^TGLdouble; + + {$EXTERNALSYM GLclampd} + GLclampd = Double; + TGLclampd = Double; + PGLclampd = ^TGLclampd; + + TVector3d = array[0..2] of GLdouble; + + TVector4i = array[0..3] of GLint; + TVector4f = array[0..3] of GLfloat; + TVector4p = array[0..3] of Pointer; + + TMatrix4f = array[0..3, 0..3] of GLfloat; + TMatrix4d = array[0..3, 0..3] of GLdouble; + + PPointer = ^Pointer; + +{$ifdef FPC} + var +{$else} + {$ifdef MULTITHREADOPENGL} + threadvar + {$else} + var + {$endif} +{$endif} + + GL_VERSION_1_0, + GL_VERSION_1_1, + GL_VERSION_1_2, + GLU_VERSION_1_1, + GLU_VERSION_1_2, + GLU_VERSION_1_3: Boolean; + + // Extensions (gl) + GL_3DFX_multisample, + GL_3DFX_tbuffer, + GL_3DFX_texture_compression_FXT1, + + GL_APPLE_specular_vector, + GL_APPLE_transform_hint, + + GL_ARB_imaging, + GL_ARB_multisample, + GL_ARB_multitexture, + GL_ARB_texture_compression, + GL_ARB_texture_cube_map, + GL_ARB_transpose_matrix, + GL_ARB_vertex_blend, + + GL_EXT_422_pixels, + GL_EXT_abgr, + GL_EXT_bgra, + GL_EXT_blend_color, + GL_EXT_blend_func_separate, + GL_EXT_blend_logic_op, + GL_EXT_blend_minmax, + GL_EXT_blend_subtract, + GL_EXT_clip_volume_hint, + GL_EXT_cmyka, + GL_EXT_color_subtable, + GL_EXT_compiled_vertex_array, + GL_EXT_convolution, + GL_EXT_coordinate_frame, + GL_EXT_copy_texture, + GL_EXT_cull_vertex, + GL_EXT_draw_range_elements, + GL_EXT_fog_coord, + GL_EXT_histogram, + GL_EXT_index_array_formats, + GL_EXT_index_func, + GL_EXT_index_material, + GL_EXT_index_texture, + GL_EXT_light_max_exponent, + GL_EXT_light_texture, + GL_EXT_misc_attribute, + GL_EXT_multi_draw_arrays, + GL_EXT_multisample, + GL_EXT_packed_pixels, + GL_EXT_paletted_texture, + GL_EXT_pixel_transform, + GL_EXT_point_parameters, + GL_EXT_polygon_offset, + GL_EXT_rescale_normal, + GL_EXT_scene_marker, + GL_EXT_secondary_color, + GL_EXT_separate_specular_color, + GL_EXT_shared_texture_palette, + GL_EXT_stencil_wrap, + GL_EXT_subtexture, + GL_EXT_texture_color_table, + GL_EXT_texture_compression_s3tc, + GL_EXT_texture_cube_map, + GL_EXT_texture_edge_clamp, + GL_EXT_texture_env_add, + GL_EXT_texture_env_combine, + GL_EXT_texture_filter_anisotropic, + GL_EXT_texture_lod_bias, + GL_EXT_texture_object, + GL_EXT_texture_perturb_normal, + GL_EXT_texture3D, + GL_EXT_vertex_array, + GL_EXT_vertex_weighting, + + GL_FfdMaskSGIX, + GL_HP_convolution_border_modes, + GL_HP_image_transform, + GL_HP_occlusion_test, + GL_HP_texture_lighting, + + GL_IBM_cull_vertex, + GL_IBM_multimode_draw_arrays, + GL_IBM_rasterpos_clip, + GL_IBM_vertex_array_lists, + + GL_INGR_color_clamp, + GL_INGR_interlace_read, + + GL_INTEL_parallel_arrays, + + GL_KTX_buffer_region, + + GL_MESA_resize_buffers, + GL_MESA_window_pos, + + GL_NV_blend_square, + GL_NV_fog_distance, + GL_NV_light_max_exponent, + GL_NV_register_combiners, + GL_NV_texgen_emboss, + GL_NV_texgen_reflection, + GL_NV_texture_env_combine4, + GL_NV_vertex_array_range, + GL_NV_vertex_program, + + GL_PGI_misc_hints, + GL_PGI_vertex_hints, + + GL_REND_screen_coordinates, + + GL_SGI_color_matrix, + GL_SGI_color_table, + GL_SGI_depth_pass_instrument, + + GL_SGIS_detail_texture, + GL_SGIS_fog_function, + GL_SGIS_generate_mipmap, + GL_SGIS_multisample, + GL_SGIS_multitexture, + GL_SGIS_pixel_texture, + GL_SGIS_point_line_texgen, + GL_SGIS_point_parameters, + GL_SGIS_sharpen_texture, + GL_SGIS_texture_border_clamp, + GL_SGIS_texture_color_mask, + GL_SGIS_texture_edge_clamp, + GL_SGIS_texture_filter4, + GL_SGIS_texture_lod, + GL_SGIS_texture_select, + GL_SGIS_texture4D, + + GL_SGIX_async, + GL_SGIX_async_histogram, + GL_SGIX_async_pixel, + GL_SGIX_blend_alpha_minmax, + GL_SGIX_calligraphic_fragment, + GL_SGIX_clipmap, + GL_SGIX_convolution_accuracy, + GL_SGIX_depth_texture, + GL_SGIX_flush_raster, + GL_SGIX_fog_offset, + GL_SGIX_fog_scale, + GL_SGIX_fragment_lighting, + GL_SGIX_framezoom, + GL_SGIX_igloo_interface, + GL_SGIX_instruments, + GL_SGIX_interlace, + GL_SGIX_ir_instrument1, + GL_SGIX_list_priority, + GL_SGIX_pixel_texture, + GL_SGIX_pixel_tiles, + GL_SGIX_polynomial_ffd, + GL_SGIX_reference_plane, + GL_SGIX_resample, + GL_SGIX_shadow, + GL_SGIX_shadow_ambient, + GL_SGIX_sprite, + GL_SGIX_subsample, + GL_SGIX_tag_sample_buffer, + GL_SGIX_texture_add_env, + GL_SGIX_texture_lod_bias, + GL_SGIX_texture_multi_buffer, + GL_SGIX_texture_scale_bias, + GL_SGIX_vertex_preclip, + GL_SGIX_ycrcb, + GL_SGIX_ycrcba, + + GL_SUN_convolution_border_modes, + GL_SUN_global_alpha, + GL_SUN_triangle_list, + GL_SUN_vertex, + + GL_SUNX_constant_data, + + GL_WIN_phong_shading, + GL_WIN_specular_fog, + GL_WIN_swap_hint, + + WGL_EXT_swap_control, + WGL_ARB_extensions_string, + WGL_ARB_pixel_format, + + // Extensions (glu) + GLU_EXT_Texture, + GLU_EXT_object_space_tess, + GLU_EXT_nurbs_tessellator: Boolean; + +const + // ********** GL generic constants ********** + + // errors + GL_NO_ERROR = 0; + {$EXTERNALSYM GL_NO_ERROR} + GL_INVALID_ENUM = $0500; + {$EXTERNALSYM GL_INVALID_ENUM} + GL_INVALID_VALUE = $0501; + {$EXTERNALSYM GL_INVALID_VALUE} + GL_INVALID_OPERATION = $0502; + {$EXTERNALSYM GL_INVALID_OPERATION} + GL_STACK_OVERFLOW = $0503; + {$EXTERNALSYM GL_STACK_OVERFLOW} + GL_STACK_UNDERFLOW = $0504; + {$EXTERNALSYM GL_STACK_UNDERFLOW} + GL_OUT_OF_MEMORY = $0505; + {$EXTERNALSYM GL_STACK_UNDERFLOW} + + // attribute bits + GL_CURRENT_BIT = $00000001; + {$EXTERNALSYM GL_CURRENT_BIT} + GL_POINT_BIT = $00000002; + {$EXTERNALSYM GL_POINT_BIT} + GL_LINE_BIT = $00000004; + {$EXTERNALSYM GL_LINE_BIT} + GL_POLYGON_BIT = $00000008; + {$EXTERNALSYM GL_POLYGON_BIT} + GL_POLYGON_STIPPLE_BIT = $00000010; + {$EXTERNALSYM GL_POLYGON_STIPPLE_BIT} + GL_PIXEL_MODE_BIT = $00000020; + {$EXTERNALSYM GL_PIXEL_MODE_BIT} + GL_LIGHTING_BIT = $00000040; + {$EXTERNALSYM GL_LIGHTING_BIT} + GL_FOG_BIT = $00000080; + {$EXTERNALSYM GL_FOG_BIT} + GL_DEPTH_BUFFER_BIT = $00000100; + {$EXTERNALSYM GL_DEPTH_BUFFER_BIT} + GL_ACCUM_BUFFER_BIT = $00000200; + {$EXTERNALSYM GL_ACCUM_BUFFER_BIT} + GL_STENCIL_BUFFER_BIT = $00000400; + {$EXTERNALSYM GL_STENCIL_BUFFER_BIT} + GL_VIEWPORT_BIT = $00000800; + {$EXTERNALSYM GL_VIEWPORT_BIT} + GL_TRANSFORM_BIT = $00001000; + {$EXTERNALSYM GL_TRANSFORM_BIT} + GL_ENABLE_BIT = $00002000; + {$EXTERNALSYM GL_ENABLE_BIT} + GL_COLOR_BUFFER_BIT = $00004000; + {$EXTERNALSYM GL_COLOR_BUFFER_BIT} + GL_HINT_BIT = $00008000; + {$EXTERNALSYM GL_HINT_BIT} + GL_EVAL_BIT = $00010000; + {$EXTERNALSYM GL_EVAL_BIT} + GL_LIST_BIT = $00020000; + {$EXTERNALSYM GL_LIST_BIT} + GL_TEXTURE_BIT = $00040000; + {$EXTERNALSYM GL_TEXTURE_BIT} + GL_SCISSOR_BIT = $00080000; + {$EXTERNALSYM GL_SCISSOR_BIT} + GL_ALL_ATTRIB_BITS = $000FFFFF; + {$EXTERNALSYM GL_ALL_ATTRIB_BITS} + + // client attribute bits + GL_CLIENT_PIXEL_STORE_BIT = $00000001; + {$EXTERNALSYM GL_CLIENT_PIXEL_STORE_BIT} + GL_CLIENT_VERTEX_ARRAY_BIT = $00000002; + {$EXTERNALSYM GL_CLIENT_VERTEX_ARRAY_BIT} + GL_CLIENT_ALL_ATTRIB_BITS = $FFFFFFFF; + {$EXTERNALSYM GL_CLIENT_ALL_ATTRIB_BITS} + + // boolean values + GL_FALSE = Boolean(0); + {$EXTERNALSYM GL_FALSE} + GL_TRUE = Boolean(1); + {$EXTERNALSYM GL_TRUE} + + // primitives + GL_POINTS = $0000; + {$EXTERNALSYM GL_POINTS} + GL_LINES = $0001; + {$EXTERNALSYM GL_LINES} + GL_LINE_LOOP = $0002; + {$EXTERNALSYM GL_LINE_LOOP} + GL_LINE_STRIP = $0003; + {$EXTERNALSYM GL_LINE_STRIP} + GL_TRIANGLES = $0004; + {$EXTERNALSYM GL_TRIANGLES} + GL_TRIANGLE_STRIP = $0005; + {$EXTERNALSYM GL_TRIANGLE_STRIP} + GL_TRIANGLE_FAN = $0006; + {$EXTERNALSYM GL_TRIANGLE_FAN} + GL_QUADS = $0007; + {$EXTERNALSYM GL_QUADS} + GL_QUAD_STRIP = $0008; + {$EXTERNALSYM GL_QUAD_STRIP} + GL_POLYGON = $0009; + {$EXTERNALSYM GL_POLYGON} + + // blending + GL_ZERO = 0; + {$EXTERNALSYM GL_ZERO} + GL_ONE = 1; + {$EXTERNALSYM GL_ONE} + GL_SRC_COLOR = $0300; + {$EXTERNALSYM GL_SRC_COLOR} + GL_ONE_MINUS_SRC_COLOR = $0301; + {$EXTERNALSYM GL_ONE_MINUS_SRC_COLOR} + GL_SRC_ALPHA = $0302; + {$EXTERNALSYM GL_SRC_ALPHA} + GL_ONE_MINUS_SRC_ALPHA = $0303; + {$EXTERNALSYM GL_ONE_MINUS_SRC_ALPHA} + GL_DST_ALPHA = $0304; + {$EXTERNALSYM GL_DST_ALPHA} + GL_ONE_MINUS_DST_ALPHA = $0305; + {$EXTERNALSYM GL_ONE_MINUS_DST_ALPHA} + GL_DST_COLOR = $0306; + {$EXTERNALSYM GL_DST_COLOR} + GL_ONE_MINUS_DST_COLOR = $0307; + {$EXTERNALSYM GL_ONE_MINUS_DST_COLOR} + GL_SRC_ALPHA_SATURATE = $0308; + {$EXTERNALSYM GL_SRC_ALPHA_SATURATE} + GL_BLEND_DST = $0BE0; + {$EXTERNALSYM GL_BLEND_DST} + GL_BLEND_SRC = $0BE1; + {$EXTERNALSYM GL_BLEND_SRC} + GL_BLEND = $0BE2; + {$EXTERNALSYM GL_BLEND} + + // blending (GL 1.2 ARB imaging) + GL_BLEND_COLOR = $8005; + {$EXTERNALSYM GL_BLEND_COLOR} + GL_CONSTANT_COLOR = $8001; + {$EXTERNALSYM GL_CONSTANT_COLOR} + GL_ONE_MINUS_CONSTANT_COLOR = $8002; + {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_COLOR} + GL_CONSTANT_ALPHA = $8003; + {$EXTERNALSYM GL_CONSTANT_ALPHA} + GL_ONE_MINUS_CONSTANT_ALPHA = $8004; + {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_ALPHA} + GL_FUNC_ADD = $8006; + {$EXTERNALSYM GL_FUNC_ADD} + GL_MIN = $8007; + {$EXTERNALSYM GL_MIN} + GL_MAX = $8008; + {$EXTERNALSYM GL_MAX} + GL_FUNC_SUBTRACT = $800A; + {$EXTERNALSYM GL_FUNC_SUBTRACT} + GL_FUNC_REVERSE_SUBTRACT = $800B; + {$EXTERNALSYM GL_FUNC_REVERSE_SUBTRACT} + + // color table GL 1.2 ARB imaging + GL_COLOR_TABLE = $80D0; + {$EXTERNALSYM GL_COLOR_TABLE} + GL_POST_CONVOLUTION_COLOR_TABLE = $80D1; + {$EXTERNALSYM GL_POST_CONVOLUTION_COLOR_TABLE} + GL_POST_COLOR_MATRIX_COLOR_TABLE = $80D2; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_COLOR_TABLE} + GL_PROXY_COLOR_TABLE = $80D3; + {$EXTERNALSYM GL_PROXY_COLOR_TABLE} + GL_PROXY_POST_CONVOLUTION_COLOR_TABLE = $80D4; + {$EXTERNALSYM GL_PROXY_POST_CONVOLUTION_COLOR_TABLE} + GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE = $80D5; + {$EXTERNALSYM GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE} + GL_COLOR_TABLE_SCALE = $80D6; + {$EXTERNALSYM GL_COLOR_TABLE_SCALE} + GL_COLOR_TABLE_BIAS = $80D7; + {$EXTERNALSYM GL_COLOR_TABLE_BIAS} + GL_COLOR_TABLE_FORMAT = $80D8; + {$EXTERNALSYM GL_COLOR_TABLE_FORMAT} + GL_COLOR_TABLE_WIDTH = $80D9; + {$EXTERNALSYM GL_COLOR_TABLE_WIDTH} + GL_COLOR_TABLE_RED_SIZE = $80DA; + {$EXTERNALSYM GL_COLOR_TABLE_RED_SIZE} + GL_COLOR_TABLE_GREEN_SIZE = $80DB; + {$EXTERNALSYM GL_COLOR_TABLE_GREEN_SIZE} + GL_COLOR_TABLE_BLUE_SIZE = $80DC; + {$EXTERNALSYM GL_COLOR_TABLE_BLUE_SIZE} + GL_COLOR_TABLE_ALPHA_SIZE = $80DD; + {$EXTERNALSYM GL_COLOR_TABLE_ALPHA_SIZE} + GL_COLOR_TABLE_LUMINANCE_SIZE = $80DE; + {$EXTERNALSYM GL_COLOR_TABLE_LUMINANCE_SIZE} + GL_COLOR_TABLE_INTENSITY_SIZE = $80DF; + {$EXTERNALSYM GL_COLOR_TABLE_INTENSITY_SIZE} + + // convolutions GL 1.2 ARB imaging + GL_CONVOLUTION_1D = $8010; + {$EXTERNALSYM GL_CONVOLUTION_1D} + GL_CONVOLUTION_2D = $8011; + {$EXTERNALSYM GL_CONVOLUTION_2D} + GL_SEPARABLE_2D = $8012; + {$EXTERNALSYM GL_SEPARABLE_2D} + GL_CONVOLUTION_BORDER_MODE = $8013; + {$EXTERNALSYM GL_CONVOLUTION_BORDER_MODE} + GL_CONVOLUTION_FILTER_SCALE = $8014; + {$EXTERNALSYM GL_CONVOLUTION_FILTER_SCALE} + GL_CONVOLUTION_FILTER_BIAS = $8015; + {$EXTERNALSYM GL_CONVOLUTION_FILTER_BIAS} + GL_REDUCE = $8016; + {$EXTERNALSYM GL_REDUCE} + GL_CONVOLUTION_FORMAT = $8017; + {$EXTERNALSYM GL_CONVOLUTION_FORMAT} + GL_CONVOLUTION_WIDTH = $8018; + {$EXTERNALSYM GL_CONVOLUTION_WIDTH} + GL_CONVOLUTION_HEIGHT = $8019; + {$EXTERNALSYM GL_CONVOLUTION_HEIGHT} + GL_MAX_CONVOLUTION_WIDTH = $801A; + {$EXTERNALSYM GL_MAX_CONVOLUTION_WIDTH} + GL_MAX_CONVOLUTION_HEIGHT = $801B; + {$EXTERNALSYM GL_MAX_CONVOLUTION_HEIGHT} + GL_POST_CONVOLUTION_RED_SCALE = $801C; + {$EXTERNALSYM GL_POST_CONVOLUTION_RED_SCALE} + GL_POST_CONVOLUTION_GREEN_SCALE = $801D; + {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_SCALE} + GL_POST_CONVOLUTION_BLUE_SCALE = $801E; + {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_SCALE} + GL_POST_CONVOLUTION_ALPHA_SCALE = $801F; + {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_SCALE} + GL_POST_CONVOLUTION_RED_BIAS = $8020; + {$EXTERNALSYM GL_POST_CONVOLUTION_RED_BIAS} + GL_POST_CONVOLUTION_GREEN_BIAS = $8021; + {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_BIAS} + GL_POST_CONVOLUTION_BLUE_BIAS = $8022; + {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_BIAS} + GL_POST_CONVOLUTION_ALPHA_BIAS = $8023; + {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_BIAS} + + // histogram GL 1.2 ARB imaging + GL_HISTOGRAM = $8024; + {$EXTERNALSYM GL_HISTOGRAM} + GL_PROXY_HISTOGRAM = $8025; + {$EXTERNALSYM GL_PROXY_HISTOGRAM} + GL_HISTOGRAM_WIDTH = $8026; + {$EXTERNALSYM GL_HISTOGRAM_WIDTH} + GL_HISTOGRAM_FORMAT = $8027; + {$EXTERNALSYM GL_HISTOGRAM_FORMAT} + GL_HISTOGRAM_RED_SIZE = $8028; + {$EXTERNALSYM GL_HISTOGRAM_RED_SIZE} + GL_HISTOGRAM_GREEN_SIZE = $8029; + {$EXTERNALSYM GL_HISTOGRAM_GREEN_SIZE} + GL_HISTOGRAM_BLUE_SIZE = $802A; + {$EXTERNALSYM GL_HISTOGRAM_BLUE_SIZE} + GL_HISTOGRAM_ALPHA_SIZE = $802B; + {$EXTERNALSYM GL_HISTOGRAM_ALPHA_SIZE} + GL_HISTOGRAM_LUMINANCE_SIZE = $802C; + {$EXTERNALSYM GL_HISTOGRAM_LUMINANCE_SIZE} + GL_HISTOGRAM_SINK = $802D; + {$EXTERNALSYM GL_HISTOGRAM_SINK} + GL_MINMAX = $802E; + {$EXTERNALSYM GL_MINMAX} + GL_MINMAX_FORMAT = $802F; + {$EXTERNALSYM GL_MINMAX_FORMAT} + GL_MINMAX_SINK = $8030; + {$EXTERNALSYM GL_MINMAX_SINK} + + // buffers + GL_NONE = 0; + {$EXTERNALSYM GL_NONE} + GL_FRONT_LEFT = $0400; + {$EXTERNALSYM GL_FRONT_LEFT} + GL_FRONT_RIGHT = $0401; + {$EXTERNALSYM GL_FRONT_RIGHT} + GL_BACK_LEFT = $0402; + {$EXTERNALSYM GL_BACK_LEFT} + GL_BACK_RIGHT = $0403; + {$EXTERNALSYM GL_BACK_RIGHT} + GL_FRONT = $0404; + {$EXTERNALSYM GL_FRONT} + GL_BACK = $0405; + {$EXTERNALSYM GL_BACK} + GL_LEFT = $0406; + {$EXTERNALSYM GL_LEFT} + GL_RIGHT = $0407; + {$EXTERNALSYM GL_RIGHT} + GL_FRONT_AND_BACK = $0408; + {$EXTERNALSYM GL_FRONT_AND_BACK} + GL_AUX0 = $0409; + {$EXTERNALSYM GL_AUX0} + GL_AUX1 = $040A; + {$EXTERNALSYM GL_AUX1} + GL_AUX2 = $040B; + {$EXTERNALSYM GL_AUX2} + GL_AUX3 = $040C; + {$EXTERNALSYM GL_AUX3} + GL_AUX_BUFFERS = $0C00; + {$EXTERNALSYM GL_AUX_BUFFERS} + GL_DRAW_BUFFER = $0C01; + {$EXTERNALSYM GL_DRAW_BUFFER} + GL_READ_BUFFER = $0C02; + {$EXTERNALSYM GL_READ_BUFFER} + GL_DOUBLEBUFFER = $0C32; + {$EXTERNALSYM GL_DOUBLEBUFFER} + GL_STEREO = $0C33; + {$EXTERNALSYM GL_STEREO} + + // depth buffer + GL_DEPTH_RANGE = $0B70; + {$EXTERNALSYM GL_DEPTH_RANGE} + GL_DEPTH_TEST = $0B71; + {$EXTERNALSYM GL_DEPTH_TEST} + GL_DEPTH_WRITEMASK = $0B72; + {$EXTERNALSYM GL_DEPTH_WRITEMASK} + GL_DEPTH_CLEAR_VALUE = $0B73; + {$EXTERNALSYM GL_DEPTH_CLEAR_VALUE} + GL_DEPTH_FUNC = $0B74; + {$EXTERNALSYM GL_DEPTH_FUNC} + GL_NEVER = $0200; + {$EXTERNALSYM GL_NEVER} + GL_LESS = $0201; + {$EXTERNALSYM GL_LESS} + GL_EQUAL = $0202; + {$EXTERNALSYM GL_EQUAL} + GL_LEQUAL = $0203; + {$EXTERNALSYM GL_LEQUAL} + GL_GREATER = $0204; + {$EXTERNALSYM GL_GREATER} + GL_NOTEQUAL = $0205; + {$EXTERNALSYM GL_NOTEQUAL} + GL_GEQUAL = $0206; + {$EXTERNALSYM GL_GEQUAL} + GL_ALWAYS = $0207; + {$EXTERNALSYM GL_ALWAYS} + + // accumulation buffer + GL_ACCUM = $0100; + {$EXTERNALSYM GL_ACCUM} + GL_LOAD = $0101; + {$EXTERNALSYM GL_LOAD} + GL_RETURN = $0102; + {$EXTERNALSYM GL_RETURN} + GL_MULT = $0103; + {$EXTERNALSYM GL_MULT} + GL_ADD = $0104; + {$EXTERNALSYM GL_ADD} + GL_ACCUM_CLEAR_VALUE = $0B80; + {$EXTERNALSYM GL_ACCUM_CLEAR_VALUE} + + // feedback buffer + GL_FEEDBACK_BUFFER_POINTER = $0DF0; + {$EXTERNALSYM GL_FEEDBACK_BUFFER_POINTER} + GL_FEEDBACK_BUFFER_SIZE = $0DF1; + {$EXTERNALSYM GL_FEEDBACK_BUFFER_SIZE} + GL_FEEDBACK_BUFFER_TYPE = $0DF2; + {$EXTERNALSYM GL_FEEDBACK_BUFFER_TYPE} + + // feedback types + GL_2D = $0600; + {$EXTERNALSYM GL_2D} + GL_3D = $0601; + {$EXTERNALSYM GL_3D} + GL_3D_COLOR = $0602; + {$EXTERNALSYM GL_3D_COLOR} + GL_3D_COLOR_TEXTURE = $0603; + {$EXTERNALSYM GL_3D_COLOR_TEXTURE} + GL_4D_COLOR_TEXTURE = $0604; + {$EXTERNALSYM GL_4D_COLOR_TEXTURE} + + // feedback tokens + GL_PASS_THROUGH_TOKEN = $0700; + {$EXTERNALSYM GL_PASS_THROUGH_TOKEN} + GL_POINT_TOKEN = $0701; + {$EXTERNALSYM GL_POINT_TOKEN} + GL_LINE_TOKEN = $0702; + {$EXTERNALSYM GL_LINE_TOKEN} + GL_POLYGON_TOKEN = $0703; + {$EXTERNALSYM GL_POLYGON_TOKEN} + GL_BITMAP_TOKEN = $0704; + {$EXTERNALSYM GL_BITMAP_TOKEN} + GL_DRAW_PIXEL_TOKEN = $0705; + {$EXTERNALSYM GL_DRAW_PIXEL_TOKEN} + GL_COPY_PIXEL_TOKEN = $0706; + {$EXTERNALSYM GL_COPY_PIXEL_TOKEN} + GL_LINE_RESET_TOKEN = $0707; + {$EXTERNALSYM GL_LINE_RESET_TOKEN} + + // fog + GL_EXP = $0800; + {$EXTERNALSYM GL_EXP} + GL_EXP2 = $0801; + {$EXTERNALSYM GL_EXP2} + GL_FOG = $0B60; + {$EXTERNALSYM GL_FOG} + GL_FOG_INDEX = $0B61; + {$EXTERNALSYM GL_FOG_INDEX} + GL_FOG_DENSITY = $0B62; + {$EXTERNALSYM GL_FOG_DENSITY} + GL_FOG_START = $0B63; + {$EXTERNALSYM GL_FOG_START} + GL_FOG_END = $0B64; + {$EXTERNALSYM GL_FOG_END} + GL_FOG_MODE = $0B65; + {$EXTERNALSYM GL_FOG_MODE} + GL_FOG_COLOR = $0B66; + {$EXTERNALSYM GL_FOG_COLOR} + + // pixel mode, transfer + GL_PIXEL_MAP_I_TO_I = $0C70; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_I} + GL_PIXEL_MAP_S_TO_S = $0C71; + {$EXTERNALSYM GL_PIXEL_MAP_S_TO_S} + GL_PIXEL_MAP_I_TO_R = $0C72; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_R} + GL_PIXEL_MAP_I_TO_G = $0C73; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_G} + GL_PIXEL_MAP_I_TO_B = $0C74; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_B} + GL_PIXEL_MAP_I_TO_A = $0C75; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_A} + GL_PIXEL_MAP_R_TO_R = $0C76; + {$EXTERNALSYM GL_PIXEL_MAP_R_TO_R} + GL_PIXEL_MAP_G_TO_G = $0C77; + {$EXTERNALSYM GL_PIXEL_MAP_G_TO_G} + GL_PIXEL_MAP_B_TO_B = $0C78; + {$EXTERNALSYM GL_PIXEL_MAP_B_TO_B} + GL_PIXEL_MAP_A_TO_A = $0C79; + {$EXTERNALSYM GL_PIXEL_MAP_A_TO_A} + + // vertex arrays + GL_VERTEX_ARRAY_POINTER = $808E; + {$EXTERNALSYM GL_VERTEX_ARRAY_POINTER} + GL_NORMAL_ARRAY_POINTER = $808F; + {$EXTERNALSYM GL_NORMAL_ARRAY_POINTER} + GL_COLOR_ARRAY_POINTER = $8090; + {$EXTERNALSYM GL_COLOR_ARRAY_POINTER} + GL_INDEX_ARRAY_POINTER = $8091; + {$EXTERNALSYM GL_INDEX_ARRAY_POINTER} + GL_TEXTURE_COORD_ARRAY_POINTER = $8092; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_POINTER} + GL_EDGE_FLAG_ARRAY_POINTER = $8093; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_POINTER} + + // stenciling + GL_STENCIL_TEST = $0B90; + {$EXTERNALSYM GL_STENCIL_TEST} + GL_STENCIL_CLEAR_VALUE = $0B91; + {$EXTERNALSYM GL_STENCIL_CLEAR_VALUE} + GL_STENCIL_FUNC = $0B92; + {$EXTERNALSYM GL_STENCIL_FUNC} + GL_STENCIL_VALUE_MASK = $0B93; + {$EXTERNALSYM GL_STENCIL_VALUE_MASK} + GL_STENCIL_FAIL = $0B94; + {$EXTERNALSYM GL_STENCIL_FAIL} + GL_STENCIL_PASS_DEPTH_FAIL = $0B95; + {$EXTERNALSYM GL_STENCIL_PASS_DEPTH_FAIL} + GL_STENCIL_PASS_DEPTH_PASS = $0B96; + {$EXTERNALSYM GL_STENCIL_PASS_DEPTH_PASS} + GL_STENCIL_REF = $0B97; + {$EXTERNALSYM GL_STENCIL_REF} + GL_STENCIL_WRITEMASK = $0B98; + {$EXTERNALSYM GL_STENCIL_WRITEMASK} + GL_KEEP = $1E00; + {$EXTERNALSYM GL_KEEP} + GL_REPLACE = $1E01; + {$EXTERNALSYM GL_REPLACE} + GL_INCR = $1E02; + {$EXTERNALSYM GL_INCR} + GL_DECR = $1E03; + {$EXTERNALSYM GL_DECR} + + // color material + GL_COLOR_MATERIAL_FACE = $0B55; + {$EXTERNALSYM GL_COLOR_MATERIAL_FACE} + GL_COLOR_MATERIAL_PARAMETER = $0B56; + {$EXTERNALSYM GL_COLOR_MATERIAL_PARAMETER} + GL_COLOR_MATERIAL = $0B57; + {$EXTERNALSYM GL_COLOR_MATERIAL} + + // points + GL_POINT_SMOOTH = $0B10; + {$EXTERNALSYM GL_POINT_SMOOTH} + GL_POINT_SIZE = $0B11; + {$EXTERNALSYM GL_POINT_SIZE} + GL_POINT_SIZE_RANGE = $0B12; + {$EXTERNALSYM GL_POINT_SIZE_RANGE} + GL_POINT_SIZE_GRANULARITY = $0B13; + {$EXTERNALSYM GL_POINT_SIZE_GRANULARITY} + + // lines + GL_LINE_SMOOTH = $0B20; + {$EXTERNALSYM GL_LINE_SMOOTH} + GL_LINE_WIDTH = $0B21; + {$EXTERNALSYM GL_LINE_WIDTH} + GL_LINE_WIDTH_RANGE = $0B22; + {$EXTERNALSYM GL_LINE_WIDTH_RANGE} + GL_LINE_WIDTH_GRANULARITY = $0B23; + {$EXTERNALSYM GL_LINE_WIDTH_GRANULARITY} + GL_LINE_STIPPLE = $0B24; + {$EXTERNALSYM GL_LINE_STIPPLE} + GL_LINE_STIPPLE_PATTERN = $0B25; + {$EXTERNALSYM GL_LINE_STIPPLE_PATTERN} + GL_LINE_STIPPLE_REPEAT = $0B26; + {$EXTERNALSYM GL_LINE_STIPPLE_REPEAT} + + // polygons + GL_POLYGON_MODE = $0B40; + {$EXTERNALSYM GL_POLYGON_MODE} + GL_POLYGON_SMOOTH = $0B41; + {$EXTERNALSYM GL_POLYGON_SMOOTH} + GL_POLYGON_STIPPLE = $0B42; + {$EXTERNALSYM GL_POLYGON_STIPPLE} + GL_EDGE_FLAG = $0B43; + {$EXTERNALSYM GL_EDGE_FLAG} + GL_CULL_FACE = $0B44; + {$EXTERNALSYM GL_CULL_FACE} + GL_CULL_FACE_MODE = $0B45; + {$EXTERNALSYM GL_CULL_FACE_MODE} + GL_FRONT_FACE = $0B46; + {$EXTERNALSYM GL_FRONT_FACE} + GL_CW = $0900; + {$EXTERNALSYM GL_CW} + GL_CCW = $0901; + {$EXTERNALSYM GL_CCW} + GL_POINT = $1B00; + {$EXTERNALSYM GL_POINT} + GL_LINE = $1B01; + {$EXTERNALSYM GL_LINE} + GL_FILL = $1B02; + {$EXTERNALSYM GL_FILL} + + // display lists + GL_LIST_MODE = $0B30; + {$EXTERNALSYM GL_LIST_MODE} + GL_LIST_BASE = $0B32; + {$EXTERNALSYM GL_LIST_BASE} + GL_LIST_INDEX = $0B33; + {$EXTERNALSYM GL_LIST_INDEX} + GL_COMPILE = $1300; + {$EXTERNALSYM GL_COMPILE} + GL_COMPILE_AND_EXECUTE = $1301; + {$EXTERNALSYM GL_COMPILE_AND_EXECUTE} + + // lighting + GL_LIGHTING = $0B50; + {$EXTERNALSYM GL_LIGHTING} + GL_LIGHT_MODEL_LOCAL_VIEWER = $0B51; + {$EXTERNALSYM GL_LIGHT_MODEL_LOCAL_VIEWER} + GL_LIGHT_MODEL_TWO_SIDE = $0B52; + {$EXTERNALSYM GL_LIGHT_MODEL_TWO_SIDE} + GL_LIGHT_MODEL_AMBIENT = $0B53; + {$EXTERNALSYM GL_LIGHT_MODEL_AMBIENT} + GL_LIGHT_MODEL_COLOR_CONTROL = $81F8; // GL 1.2 + {$EXTERNALSYM GL_LIGHT_MODEL_COLOR_CONTROL} + GL_SHADE_MODEL = $0B54; + {$EXTERNALSYM GL_SHADE_MODEL} + GL_NORMALIZE = $0BA1; + {$EXTERNALSYM GL_NORMALIZE} + GL_AMBIENT = $1200; + {$EXTERNALSYM GL_AMBIENT} + GL_DIFFUSE = $1201; + {$EXTERNALSYM GL_DIFFUSE} + GL_SPECULAR = $1202; + {$EXTERNALSYM GL_SPECULAR} + GL_POSITION = $1203; + {$EXTERNALSYM GL_POSITION} + GL_SPOT_DIRECTION = $1204; + {$EXTERNALSYM GL_SPOT_DIRECTION} + GL_SPOT_EXPONENT = $1205; + {$EXTERNALSYM GL_SPOT_EXPONENT} + GL_SPOT_CUTOFF = $1206; + {$EXTERNALSYM GL_SPOT_CUTOFF} + GL_CONSTANT_ATTENUATION = $1207; + {$EXTERNALSYM GL_CONSTANT_ATTENUATION} + GL_LINEAR_ATTENUATION = $1208; + {$EXTERNALSYM GL_LINEAR_ATTENUATION} + GL_QUADRATIC_ATTENUATION = $1209; + {$EXTERNALSYM GL_QUADRATIC_ATTENUATION} + GL_EMISSION = $1600; + {$EXTERNALSYM GL_EMISSION} + GL_SHININESS = $1601; + {$EXTERNALSYM GL_SHININESS} + GL_AMBIENT_AND_DIFFUSE = $1602; + {$EXTERNALSYM GL_AMBIENT_AND_DIFFUSE} + GL_COLOR_INDEXES = $1603; + {$EXTERNALSYM GL_COLOR_INDEXES} + GL_FLAT = $1D00; + {$EXTERNALSYM GL_FLAT} + GL_SMOOTH = $1D01; + {$EXTERNALSYM GL_SMOOTH} + GL_LIGHT0 = $4000; + {$EXTERNALSYM GL_LIGHT0} + GL_LIGHT1 = $4001; + {$EXTERNALSYM GL_LIGHT1} + GL_LIGHT2 = $4002; + {$EXTERNALSYM GL_LIGHT2} + GL_LIGHT3 = $4003; + {$EXTERNALSYM GL_LIGHT3} + GL_LIGHT4 = $4004; + {$EXTERNALSYM GL_LIGHT4} + GL_LIGHT5 = $4005; + {$EXTERNALSYM GL_LIGHT5} + GL_LIGHT6 = $4006; + {$EXTERNALSYM GL_LIGHT6} + GL_LIGHT7 = $4007; + {$EXTERNALSYM GL_LIGHT7} + + // matrix modes + GL_MATRIX_MODE = $0BA0; + {$EXTERNALSYM GL_MATRIX_MODE} + GL_MODELVIEW = $1700; + {$EXTERNALSYM GL_MODELVIEW} + GL_PROJECTION = $1701; + {$EXTERNALSYM GL_PROJECTION} + GL_TEXTURE = $1702; + {$EXTERNALSYM GL_TEXTURE} + + // gets + GL_CURRENT_COLOR = $0B00; + {$EXTERNALSYM GL_CURRENT_COLOR} + GL_CURRENT_INDEX = $0B01; + {$EXTERNALSYM GL_CURRENT_INDEX} + GL_CURRENT_NORMAL = $0B02; + {$EXTERNALSYM GL_CURRENT_NORMAL} + GL_CURRENT_TEXTURE_COORDS = $0B03; + {$EXTERNALSYM GL_CURRENT_TEXTURE_COORDS} + GL_CURRENT_RASTER_COLOR = $0B04; + {$EXTERNALSYM GL_CURRENT_RASTER_COLOR} + GL_CURRENT_RASTER_INDEX = $0B05; + {$EXTERNALSYM GL_CURRENT_RASTER_INDEX} + GL_CURRENT_RASTER_TEXTURE_COORDS = $0B06; + {$EXTERNALSYM GL_CURRENT_RASTER_TEXTURE_COORDS} + GL_CURRENT_RASTER_POSITION = $0B07; + {$EXTERNALSYM GL_CURRENT_RASTER_POSITION} + GL_CURRENT_RASTER_POSITION_VALID = $0B08; + {$EXTERNALSYM GL_CURRENT_RASTER_POSITION_VALID} + GL_CURRENT_RASTER_DISTANCE = $0B09; + {$EXTERNALSYM GL_CURRENT_RASTER_DISTANCE} + GL_MAX_LIST_NESTING = $0B31; + {$EXTERNALSYM GL_MAX_LIST_NESTING} + GL_VIEWPORT = $0BA2; + {$EXTERNALSYM GL_VIEWPORT} + GL_MODELVIEW_STACK_DEPTH = $0BA3; + {$EXTERNALSYM GL_MODELVIEW_STACK_DEPTH} + GL_PROJECTION_STACK_DEPTH = $0BA4; + {$EXTERNALSYM GL_PROJECTION_STACK_DEPTH} + GL_TEXTURE_STACK_DEPTH = $0BA5; + {$EXTERNALSYM GL_TEXTURE_STACK_DEPTH} + GL_MODELVIEW_MATRIX = $0BA6; + {$EXTERNALSYM GL_MODELVIEW_MATRIX} + GL_PROJECTION_MATRIX = $0BA7; + {$EXTERNALSYM GL_PROJECTION_MATRIX} + GL_TEXTURE_MATRIX = $0BA8; + {$EXTERNALSYM GL_TEXTURE_MATRIX} + GL_ATTRIB_STACK_DEPTH = $0BB0; + {$EXTERNALSYM GL_ATTRIB_STACK_DEPTH} + GL_CLIENT_ATTRIB_STACK_DEPTH = $0BB1; + {$EXTERNALSYM GL_CLIENT_ATTRIB_STACK_DEPTH} + + GL_SINGLE_COLOR = $81F9; // GL 1.2 + {$EXTERNALSYM GL_SINGLE_COLOR} + GL_SEPARATE_SPECULAR_COLOR = $81FA; // GL 1.2 + {$EXTERNALSYM GL_SEPARATE_SPECULAR_COLOR} + + // alpha testing + GL_ALPHA_TEST = $0BC0; + {$EXTERNALSYM GL_ALPHA_TEST} + GL_ALPHA_TEST_FUNC = $0BC1; + {$EXTERNALSYM GL_ALPHA_TEST_FUNC} + GL_ALPHA_TEST_REF = $0BC2; + {$EXTERNALSYM GL_ALPHA_TEST_REF} + + GL_LOGIC_OP_MODE = $0BF0; + {$EXTERNALSYM GL_LOGIC_OP_MODE} + GL_INDEX_LOGIC_OP = $0BF1; + {$EXTERNALSYM GL_INDEX_LOGIC_OP} + GL_LOGIC_OP = $0BF1; + {$EXTERNALSYM GL_LOGIC_OP} + GL_COLOR_LOGIC_OP = $0BF2; + {$EXTERNALSYM GL_COLOR_LOGIC_OP} + GL_SCISSOR_BOX = $0C10; + {$EXTERNALSYM GL_SCISSOR_BOX} + GL_SCISSOR_TEST = $0C11; + {$EXTERNALSYM GL_SCISSOR_TEST} + GL_INDEX_CLEAR_VALUE = $0C20; + {$EXTERNALSYM GL_INDEX_CLEAR_VALUE} + GL_INDEX_WRITEMASK = $0C21; + {$EXTERNALSYM GL_INDEX_WRITEMASK} + GL_COLOR_CLEAR_VALUE = $0C22; + {$EXTERNALSYM GL_COLOR_CLEAR_VALUE} + GL_COLOR_WRITEMASK = $0C23; + {$EXTERNALSYM GL_COLOR_WRITEMASK} + GL_INDEX_MODE = $0C30; + {$EXTERNALSYM GL_INDEX_MODE} + GL_RGBA_MODE = $0C31; + {$EXTERNALSYM GL_RGBA_MODE} + GL_RENDER_MODE = $0C40; + {$EXTERNALSYM GL_RENDER_MODE} + GL_PERSPECTIVE_CORRECTION_HINT = $0C50; + {$EXTERNALSYM GL_PERSPECTIVE_CORRECTION_HINT} + GL_POINT_SMOOTH_HINT = $0C51; + {$EXTERNALSYM GL_POINT_SMOOTH_HINT} + GL_LINE_SMOOTH_HINT = $0C52; + {$EXTERNALSYM GL_LINE_SMOOTH_HINT} + GL_POLYGON_SMOOTH_HINT = $0C53; + {$EXTERNALSYM GL_POLYGON_SMOOTH_HINT} + GL_FOG_HINT = $0C54; + {$EXTERNALSYM GL_FOG_HINT} + GL_TEXTURE_GEN_S = $0C60; + {$EXTERNALSYM GL_TEXTURE_GEN_S} + GL_TEXTURE_GEN_T = $0C61; + {$EXTERNALSYM GL_TEXTURE_GEN_T} + GL_TEXTURE_GEN_R = $0C62; + {$EXTERNALSYM GL_TEXTURE_GEN_R} + GL_TEXTURE_GEN_Q = $0C63; + {$EXTERNALSYM GL_TEXTURE_GEN_Q} + GL_PIXEL_MAP_I_TO_I_SIZE = $0CB0; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_I_SIZE} + GL_PIXEL_MAP_S_TO_S_SIZE = $0CB1; + {$EXTERNALSYM GL_PIXEL_MAP_S_TO_S_SIZE} + GL_PIXEL_MAP_I_TO_R_SIZE = $0CB2; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_R_SIZE} + GL_PIXEL_MAP_I_TO_G_SIZE = $0CB3; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_G_SIZE} + GL_PIXEL_MAP_I_TO_B_SIZE = $0CB4; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_B_SIZE} + GL_PIXEL_MAP_I_TO_A_SIZE = $0CB5; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_A_SIZE} + GL_PIXEL_MAP_R_TO_R_SIZE = $0CB6; + {$EXTERNALSYM GL_PIXEL_MAP_R_TO_R_SIZE} + GL_PIXEL_MAP_G_TO_G_SIZE = $0CB7; + {$EXTERNALSYM GL_PIXEL_MAP_G_TO_G_SIZE} + GL_PIXEL_MAP_B_TO_B_SIZE = $0CB8; + {$EXTERNALSYM GL_PIXEL_MAP_B_TO_B_SIZE} + GL_PIXEL_MAP_A_TO_A_SIZE = $0CB9; + {$EXTERNALSYM GL_PIXEL_MAP_A_TO_A_SIZE} + GL_UNPACK_SWAP_BYTES = $0CF0; + {$EXTERNALSYM GL_UNPACK_SWAP_BYTES} + GL_UNPACK_LSB_FIRST = $0CF1; + {$EXTERNALSYM GL_UNPACK_LSB_FIRST} + GL_UNPACK_ROW_LENGTH = $0CF2; + {$EXTERNALSYM GL_UNPACK_ROW_LENGTH} + GL_UNPACK_SKIP_ROWS = $0CF3; + {$EXTERNALSYM GL_UNPACK_SKIP_ROWS} + GL_UNPACK_SKIP_PIXELS = $0CF4; + {$EXTERNALSYM GL_UNPACK_SKIP_PIXELS} + GL_UNPACK_ALIGNMENT = $0CF5; + {$EXTERNALSYM GL_UNPACK_ALIGNMENT} + GL_PACK_SWAP_BYTES = $0D00; + {$EXTERNALSYM GL_PACK_SWAP_BYTES} + GL_PACK_LSB_FIRST = $0D01; + {$EXTERNALSYM GL_PACK_LSB_FIRST} + GL_PACK_ROW_LENGTH = $0D02; + {$EXTERNALSYM GL_PACK_ROW_LENGTH} + GL_PACK_SKIP_ROWS = $0D03; + {$EXTERNALSYM GL_PACK_SKIP_ROWS} + GL_PACK_SKIP_PIXELS = $0D04; + {$EXTERNALSYM GL_PACK_SKIP_PIXELS} + GL_PACK_ALIGNMENT = $0D05; + {$EXTERNALSYM GL_PACK_ALIGNMENT} + GL_PACK_SKIP_IMAGES = $806B; // GL 1.2 + {$EXTERNALSYM GL_PACK_SKIP_IMAGES} + GL_PACK_IMAGE_HEIGHT = $806C; // GL 1.2 + {$EXTERNALSYM GL_PACK_IMAGE_HEIGHT} + GL_UNPACK_SKIP_IMAGES = $806D; // GL 1.2 + {$EXTERNALSYM GL_UNPACK_SKIP_IMAGES} + GL_UNPACK_IMAGE_HEIGHT = $806E; // GL 1.2 + {$EXTERNALSYM GL_UNPACK_IMAGE_HEIGHT} + GL_MAP_COLOR = $0D10; + {$EXTERNALSYM GL_MAP_COLOR} + GL_MAP_STENCIL = $0D11; + {$EXTERNALSYM GL_MAP_STENCIL} + GL_INDEX_SHIFT = $0D12; + {$EXTERNALSYM GL_INDEX_SHIFT} + GL_INDEX_OFFSET = $0D13; + {$EXTERNALSYM GL_INDEX_OFFSET} + GL_RED_SCALE = $0D14; + {$EXTERNALSYM GL_RED_SCALE} + GL_RED_BIAS = $0D15; + {$EXTERNALSYM GL_RED_BIAS} + GL_ZOOM_X = $0D16; + {$EXTERNALSYM GL_ZOOM_X} + GL_ZOOM_Y = $0D17; + {$EXTERNALSYM GL_ZOOM_Y} + GL_GREEN_SCALE = $0D18; + {$EXTERNALSYM GL_GREEN_SCALE} + GL_GREEN_BIAS = $0D19; + {$EXTERNALSYM GL_GREEN_BIAS} + GL_BLUE_SCALE = $0D1A; + {$EXTERNALSYM GL_BLUE_SCALE} + GL_BLUE_BIAS = $0D1B; + {$EXTERNALSYM GL_BLUE_BIAS} + GL_ALPHA_SCALE = $0D1C; + {$EXTERNALSYM GL_ALPHA_SCALE} + GL_ALPHA_BIAS = $0D1D; + {$EXTERNALSYM GL_ALPHA_BIAS} + GL_DEPTH_SCALE = $0D1E; + {$EXTERNALSYM GL_DEPTH_SCALE} + GL_DEPTH_BIAS = $0D1F; + {$EXTERNALSYM GL_DEPTH_BIAS} + GL_MAX_EVAL_ORDER = $0D30; + {$EXTERNALSYM GL_MAX_EVAL_ORDER} + GL_MAX_LIGHTS = $0D31; + {$EXTERNALSYM GL_MAX_LIGHTS} + GL_MAX_CLIP_PLANES = $0D32; + {$EXTERNALSYM GL_MAX_CLIP_PLANES} + GL_MAX_TEXTURE_SIZE = $0D33; + {$EXTERNALSYM GL_MAX_TEXTURE_SIZE} + GL_MAX_3D_TEXTURE_SIZE = $8073; // GL 1.2 + {$EXTERNALSYM GL_MAX_3D_TEXTURE_SIZE} + GL_MAX_PIXEL_MAP_TABLE = $0D34; + {$EXTERNALSYM GL_MAX_PIXEL_MAP_TABLE} + GL_MAX_ATTRIB_STACK_DEPTH = $0D35; + {$EXTERNALSYM GL_MAX_ATTRIB_STACK_DEPTH} + GL_MAX_MODELVIEW_STACK_DEPTH = $0D36; + {$EXTERNALSYM GL_MAX_MODELVIEW_STACK_DEPTH} + GL_MAX_NAME_STACK_DEPTH = $0D37; + {$EXTERNALSYM GL_MAX_NAME_STACK_DEPTH} + GL_MAX_PROJECTION_STACK_DEPTH = $0D38; + {$EXTERNALSYM GL_MAX_PROJECTION_STACK_DEPTH} + GL_MAX_TEXTURE_STACK_DEPTH = $0D39; + {$EXTERNALSYM GL_MAX_TEXTURE_STACK_DEPTH} + GL_MAX_VIEWPORT_DIMS = $0D3A; + {$EXTERNALSYM GL_MAX_VIEWPORT_DIMS} + GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = $0D3B; + {$EXTERNALSYM GL_MAX_CLIENT_ATTRIB_STACK_DEPTH} + GL_MAX_ELEMENTS_VERTICES = $80E8; // GL 1.2 + {$EXTERNALSYM GL_MAX_ELEMENTS_VERTICES} + GL_MAX_ELEMENTS_INDICES = $80E9; // GL 1.2 + {$EXTERNALSYM GL_MAX_ELEMENTS_INDICES} + GL_RESCALE_NORMAL = $803A; // GL 1.2 + {$EXTERNALSYM GL_RESCALE_NORMAL} + GL_SUBPIXEL_BITS = $0D50; + {$EXTERNALSYM GL_SUBPIXEL_BITS} + GL_INDEX_BITS = $0D51; + {$EXTERNALSYM GL_INDEX_BITS} + GL_RED_BITS = $0D52; + {$EXTERNALSYM GL_RED_BITS} + GL_GREEN_BITS = $0D53; + {$EXTERNALSYM GL_GREEN_BITS} + GL_BLUE_BITS = $0D54; + {$EXTERNALSYM GL_BLUE_BITS} + GL_ALPHA_BITS = $0D55; + {$EXTERNALSYM GL_ALPHA_BITS} + GL_DEPTH_BITS = $0D56; + {$EXTERNALSYM GL_DEPTH_BITS} + GL_STENCIL_BITS = $0D57; + {$EXTERNALSYM GL_STENCIL_BITS} + GL_ACCUM_RED_BITS = $0D58; + {$EXTERNALSYM GL_ACCUM_RED_BITS} + GL_ACCUM_GREEN_BITS = $0D59; + {$EXTERNALSYM GL_ACCUM_GREEN_BITS} + GL_ACCUM_BLUE_BITS = $0D5A; + {$EXTERNALSYM GL_ACCUM_BLUE_BITS} + GL_ACCUM_ALPHA_BITS = $0D5B; + {$EXTERNALSYM GL_ACCUM_ALPHA_BITS} + GL_NAME_STACK_DEPTH = $0D70; + {$EXTERNALSYM GL_NAME_STACK_DEPTH} + GL_AUTO_NORMAL = $0D80; + {$EXTERNALSYM GL_AUTO_NORMAL} + GL_MAP1_COLOR_4 = $0D90; + {$EXTERNALSYM GL_MAP1_COLOR_4} + GL_MAP1_INDEX = $0D91; + {$EXTERNALSYM GL_MAP1_INDEX} + GL_MAP1_NORMAL = $0D92; + {$EXTERNALSYM GL_MAP1_NORMAL} + GL_MAP1_TEXTURE_COORD_1 = $0D93; + {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_1} + GL_MAP1_TEXTURE_COORD_2 = $0D94; + {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_2} + GL_MAP1_TEXTURE_COORD_3 = $0D95; + {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_3} + GL_MAP1_TEXTURE_COORD_4 = $0D96; + {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_4} + GL_MAP1_VERTEX_3 = $0D97; + {$EXTERNALSYM GL_MAP1_VERTEX_3} + GL_MAP1_VERTEX_4 = $0D98; + {$EXTERNALSYM GL_MAP1_VERTEX_4} + GL_MAP2_COLOR_4 = $0DB0; + {$EXTERNALSYM GL_MAP2_COLOR_4} + GL_MAP2_INDEX = $0DB1; + {$EXTERNALSYM GL_MAP2_INDEX} + GL_MAP2_NORMAL = $0DB2; + {$EXTERNALSYM GL_MAP2_NORMAL} + GL_MAP2_TEXTURE_COORD_1 = $0DB3; + {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_1} + GL_MAP2_TEXTURE_COORD_2 = $0DB4; + {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_2} + GL_MAP2_TEXTURE_COORD_3 = $0DB5; + {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_3} + GL_MAP2_TEXTURE_COORD_4 = $0DB6; + {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_4} + GL_MAP2_VERTEX_3 = $0DB7; + {$EXTERNALSYM GL_MAP2_VERTEX_3} + GL_MAP2_VERTEX_4 = $0DB8; + {$EXTERNALSYM GL_MAP2_VERTEX_4} + GL_MAP1_GRID_DOMAIN = $0DD0; + {$EXTERNALSYM GL_MAP1_GRID_DOMAIN} + GL_MAP1_GRID_SEGMENTS = $0DD1; + {$EXTERNALSYM GL_MAP1_GRID_SEGMENTS} + GL_MAP2_GRID_DOMAIN = $0DD2; + {$EXTERNALSYM GL_MAP2_GRID_DOMAIN} + GL_MAP2_GRID_SEGMENTS = $0DD3; + {$EXTERNALSYM GL_MAP2_GRID_SEGMENTS} + GL_TEXTURE_1D = $0DE0; + {$EXTERNALSYM GL_TEXTURE_1D} + GL_TEXTURE_2D = $0DE1; + {$EXTERNALSYM GL_TEXTURE_2D} + GL_TEXTURE_3D = $806F; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_3D} + GL_SELECTION_BUFFER_POINTER = $0DF3; + {$EXTERNALSYM GL_SELECTION_BUFFER_POINTER} + GL_SELECTION_BUFFER_SIZE = $0DF4; + {$EXTERNALSYM GL_SELECTION_BUFFER_SIZE} + GL_POLYGON_OFFSET_UNITS = $2A00; + {$EXTERNALSYM GL_POLYGON_OFFSET_UNITS} + GL_POLYGON_OFFSET_POINT = $2A01; + {$EXTERNALSYM GL_POLYGON_OFFSET_POINT} + GL_POLYGON_OFFSET_LINE = $2A02; + {$EXTERNALSYM GL_POLYGON_OFFSET_LINE} + GL_POLYGON_OFFSET_FILL = $8037; + {$EXTERNALSYM GL_POLYGON_OFFSET_FILL} + GL_POLYGON_OFFSET_FACTOR = $8038; + {$EXTERNALSYM GL_POLYGON_OFFSET_FACTOR} + GL_TEXTURE_BINDING_1D = $8068; + {$EXTERNALSYM GL_TEXTURE_BINDING_1D} + GL_TEXTURE_BINDING_2D = $8069; + {$EXTERNALSYM GL_TEXTURE_BINDING_2D} + GL_VERTEX_ARRAY = $8074; + {$EXTERNALSYM GL_VERTEX_ARRAY} + GL_NORMAL_ARRAY = $8075; + {$EXTERNALSYM GL_NORMAL_ARRAY} + GL_COLOR_ARRAY = $8076; + {$EXTERNALSYM GL_COLOR_ARRAY} + GL_INDEX_ARRAY = $8077; + {$EXTERNALSYM GL_INDEX_ARRAY} + GL_TEXTURE_COORD_ARRAY = $8078; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY} + GL_EDGE_FLAG_ARRAY = $8079; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY} + GL_VERTEX_ARRAY_SIZE = $807A; + {$EXTERNALSYM GL_VERTEX_ARRAY_SIZE} + GL_VERTEX_ARRAY_TYPE = $807B; + {$EXTERNALSYM GL_VERTEX_ARRAY_TYPE} + GL_VERTEX_ARRAY_STRIDE = $807C; + {$EXTERNALSYM GL_VERTEX_ARRAY_STRIDE} + GL_NORMAL_ARRAY_TYPE = $807E; + {$EXTERNALSYM GL_NORMAL_ARRAY_TYPE} + GL_NORMAL_ARRAY_STRIDE = $807F; + {$EXTERNALSYM GL_NORMAL_ARRAY_STRIDE} + GL_COLOR_ARRAY_SIZE = $8081; + {$EXTERNALSYM GL_COLOR_ARRAY_SIZE} + GL_COLOR_ARRAY_TYPE = $8082; + {$EXTERNALSYM GL_COLOR_ARRAY_TYPE} + GL_COLOR_ARRAY_STRIDE = $8083; + {$EXTERNALSYM GL_COLOR_ARRAY_STRIDE} + GL_INDEX_ARRAY_TYPE = $8085; + {$EXTERNALSYM GL_INDEX_ARRAY_TYPE} + GL_INDEX_ARRAY_STRIDE = $8086; + {$EXTERNALSYM GL_INDEX_ARRAY_STRIDE} + GL_TEXTURE_COORD_ARRAY_SIZE = $8088; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_SIZE} + GL_TEXTURE_COORD_ARRAY_TYPE = $8089; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_TYPE} + GL_TEXTURE_COORD_ARRAY_STRIDE = $808A; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_STRIDE} + GL_EDGE_FLAG_ARRAY_STRIDE = $808C; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_STRIDE} + GL_COLOR_MATRIX = $80B1; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_COLOR_MATRIX} + GL_COLOR_MATRIX_STACK_DEPTH = $80B2; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_COLOR_MATRIX_STACK_DEPTH} + GL_MAX_COLOR_MATRIX_STACK_DEPTH = $80B3; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_MAX_COLOR_MATRIX_STACK_DEPTH} + GL_POST_COLOR_MATRIX_RED_SCALE = $80B4; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_SCALE} + GL_POST_COLOR_MATRIX_GREEN_SCALE = $80B5; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_SCALE} + GL_POST_COLOR_MATRIX_BLUE_SCALE = $80B6; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_SCALE} + GL_POST_COLOR_MATRIX_ALPHA_SCALE = $80B7; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_SCALE} + GL_POST_COLOR_MATRIX_RED_BIAS = $80B8; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_BIAS} + GL_POST_COLOR_MATRIX_GREEN_BIAS = $80B9; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_BIAS} + GL_POST_COLOR_MATRIX_BLUE_BIAS = $80BA; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_BIAS} + GL_POST_COLOR_MATRIX_ALPHA_BIAS = $80BB; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_BIAS} + + // evaluators + GL_COEFF = $0A00; + {$EXTERNALSYM GL_COEFF} + GL_ORDER = $0A01; + {$EXTERNALSYM GL_ORDER} + GL_DOMAIN = $0A02; + {$EXTERNALSYM GL_DOMAIN} + + // texture mapping + GL_TEXTURE_WIDTH = $1000; + {$EXTERNALSYM GL_TEXTURE_WIDTH} + GL_TEXTURE_HEIGHT = $1001; + {$EXTERNALSYM GL_TEXTURE_HEIGHT} + GL_TEXTURE_INTERNAL_FORMAT = $1003; + {$EXTERNALSYM GL_TEXTURE_INTERNAL_FORMAT} + GL_TEXTURE_COMPONENTS = $1003; + {$EXTERNALSYM GL_TEXTURE_COMPONENTS} + GL_TEXTURE_BORDER_COLOR = $1004; + {$EXTERNALSYM GL_TEXTURE_BORDER_COLOR} + GL_TEXTURE_BORDER = $1005; + {$EXTERNALSYM GL_TEXTURE_BORDER} + GL_TEXTURE_RED_SIZE = $805C; + {$EXTERNALSYM GL_TEXTURE_RED_SIZE} + GL_TEXTURE_GREEN_SIZE = $805D; + {$EXTERNALSYM GL_TEXTURE_GREEN_SIZE} + GL_TEXTURE_BLUE_SIZE = $805E; + {$EXTERNALSYM GL_TEXTURE_BLUE_SIZE} + GL_TEXTURE_ALPHA_SIZE = $805F; + {$EXTERNALSYM GL_TEXTURE_ALPHA_SIZE} + GL_TEXTURE_LUMINANCE_SIZE = $8060; + {$EXTERNALSYM GL_TEXTURE_LUMINANCE_SIZE} + GL_TEXTURE_INTENSITY_SIZE = $8061; + {$EXTERNALSYM GL_TEXTURE_INTENSITY_SIZE} + GL_TEXTURE_PRIORITY = $8066; + {$EXTERNALSYM GL_TEXTURE_PRIORITY} + GL_TEXTURE_RESIDENT = $8067; + {$EXTERNALSYM GL_TEXTURE_RESIDENT} + GL_BGR = $80E0; // v 1.2 + {$EXTERNALSYM GL_BGR} + GL_BGRA = $80E1; // v 1.2 + {$EXTERNALSYM GL_BGRA} + GL_S = $2000; + {$EXTERNALSYM GL_S} + GL_T = $2001; + {$EXTERNALSYM GL_T} + GL_R = $2002; + {$EXTERNALSYM GL_R} + GL_Q = $2003; + {$EXTERNALSYM GL_Q} + GL_MODULATE = $2100; + {$EXTERNALSYM GL_MODULATE} + GL_DECAL = $2101; + {$EXTERNALSYM GL_DECAL} + GL_TEXTURE_ENV_MODE = $2200; + {$EXTERNALSYM GL_TEXTURE_ENV_MODE} + GL_TEXTURE_ENV_COLOR = $2201; + {$EXTERNALSYM GL_TEXTURE_ENV_COLOR} + GL_TEXTURE_ENV = $2300; + {$EXTERNALSYM GL_TEXTURE_ENV} + GL_EYE_LINEAR = $2400; + {$EXTERNALSYM GL_EYE_LINEAR} + GL_OBJECT_LINEAR = $2401; + {$EXTERNALSYM GL_OBJECT_LINEAR} + GL_SPHERE_MAP = $2402; + {$EXTERNALSYM GL_SPHERE_MAP} + GL_TEXTURE_GEN_MODE = $2500; + {$EXTERNALSYM GL_TEXTURE_GEN_MODE} + GL_OBJECT_PLANE = $2501; + {$EXTERNALSYM GL_OBJECT_PLANE} + GL_EYE_PLANE = $2502; + {$EXTERNALSYM GL_EYE_PLANE} + GL_NEAREST = $2600; + {$EXTERNALSYM GL_NEAREST} + GL_LINEAR = $2601; + {$EXTERNALSYM GL_LINEAR} + GL_NEAREST_MIPMAP_NEAREST = $2700; + {$EXTERNALSYM GL_NEAREST_MIPMAP_NEAREST} + GL_LINEAR_MIPMAP_NEAREST = $2701; + {$EXTERNALSYM GL_LINEAR_MIPMAP_NEAREST} + GL_NEAREST_MIPMAP_LINEAR = $2702; + {$EXTERNALSYM GL_NEAREST_MIPMAP_LINEAR} + GL_LINEAR_MIPMAP_LINEAR = $2703; + {$EXTERNALSYM GL_LINEAR_MIPMAP_LINEAR} + GL_TEXTURE_MAG_FILTER = $2800; + {$EXTERNALSYM GL_TEXTURE_MAG_FILTER} + GL_TEXTURE_MIN_FILTER = $2801; + {$EXTERNALSYM GL_TEXTURE_MIN_FILTER} + GL_TEXTURE_WRAP_R = $8072; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_WRAP_R} + GL_TEXTURE_WRAP_S = $2802; + {$EXTERNALSYM GL_TEXTURE_WRAP_S} + GL_TEXTURE_WRAP_T = $2803; + {$EXTERNALSYM GL_TEXTURE_WRAP_T} + GL_CLAMP_TO_EDGE = $812F; // GL 1.2 + {$EXTERNALSYM GL_CLAMP_TO_EDGE} + GL_TEXTURE_MIN_LOD = $813A; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_MIN_LOD} + GL_TEXTURE_MAX_LOD = $813B; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_MAX_LOD} + GL_TEXTURE_BASE_LEVEL = $813C; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_BASE_LEVEL} + GL_TEXTURE_MAX_LEVEL = $813D; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_MAX_LEVEL} + GL_TEXTURE_DEPTH = $8071; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_DEPTH} + GL_PROXY_TEXTURE_1D = $8063; + {$EXTERNALSYM GL_PROXY_TEXTURE_1D} + GL_PROXY_TEXTURE_2D = $8064; + {$EXTERNALSYM GL_PROXY_TEXTURE_2D} + GL_PROXY_TEXTURE_3D = $8070; // GL 1.2 + {$EXTERNALSYM GL_PROXY_TEXTURE_3D} + GL_CLAMP = $2900; + {$EXTERNALSYM GL_CLAMP} + GL_REPEAT = $2901; + {$EXTERNALSYM GL_REPEAT} + + // hints + GL_DONT_CARE = $1100; + {$EXTERNALSYM GL_DONT_CARE} + GL_FASTEST = $1101; + {$EXTERNALSYM GL_FASTEST} + GL_NICEST = $1102; + {$EXTERNALSYM GL_NICEST} + + // data types + GL_BYTE = $1400; + {$EXTERNALSYM GL_BYTE} + GL_UNSIGNED_BYTE = $1401; + {$EXTERNALSYM GL_UNSIGNED_BYTE} + GL_SHORT = $1402; + {$EXTERNALSYM GL_SHORT} + GL_UNSIGNED_SHORT = $1403; + {$EXTERNALSYM GL_UNSIGNED_SHORT} + GL_INT = $1404; + {$EXTERNALSYM GL_INT} + GL_UNSIGNED_INT = $1405; + {$EXTERNALSYM GL_UNSIGNED_INT} + GL_FLOAT = $1406; + {$EXTERNALSYM GL_FLOAT} + GL_2_BYTES = $1407; + {$EXTERNALSYM GL_2_BYTES} + GL_3_BYTES = $1408; + {$EXTERNALSYM GL_3_BYTES} + GL_4_BYTES = $1409; + {$EXTERNALSYM GL_4_BYTES} + GL_DOUBLE = $140A; + {$EXTERNALSYM GL_DOUBLE} + GL_DOUBLE_EXT = $140A; + {$EXTERNALSYM GL_DOUBLE_EXT} + + // logic operations + GL_CLEAR = $1500; + {$EXTERNALSYM GL_CLEAR} + GL_AND = $1501; + {$EXTERNALSYM GL_AND} + GL_AND_REVERSE = $1502; + {$EXTERNALSYM GL_AND_REVERSE} + GL_COPY = $1503; + {$EXTERNALSYM GL_COPY} + GL_AND_INVERTED = $1504; + {$EXTERNALSYM GL_AND_INVERTED} + GL_NOOP = $1505; + {$EXTERNALSYM GL_NOOP} + GL_XOR = $1506; + {$EXTERNALSYM GL_XOR} + GL_OR = $1507; + {$EXTERNALSYM GL_OR} + GL_NOR = $1508; + {$EXTERNALSYM GL_NOR} + GL_EQUIV = $1509; + {$EXTERNALSYM GL_EQUIV} + GL_INVERT = $150A; + {$EXTERNALSYM GL_INVERT} + GL_OR_REVERSE = $150B; + {$EXTERNALSYM GL_OR_REVERSE} + GL_COPY_INVERTED = $150C; + {$EXTERNALSYM GL_COPY_INVERTED} + GL_OR_INVERTED = $150D; + {$EXTERNALSYM GL_OR_INVERTED} + GL_NAND = $150E; + {$EXTERNALSYM GL_NAND} + GL_SET = $150F; + {$EXTERNALSYM GL_SET} + + // PixelCopyType + GL_COLOR = $1800; + {$EXTERNALSYM GL_COLOR} + GL_DEPTH = $1801; + {$EXTERNALSYM GL_DEPTH} + GL_STENCIL = $1802; + {$EXTERNALSYM GL_STENCIL} + + // pixel formats + GL_COLOR_INDEX = $1900; + {$EXTERNALSYM GL_COLOR_INDEX} + GL_STENCIL_INDEX = $1901; + {$EXTERNALSYM GL_STENCIL_INDEX} + GL_DEPTH_COMPONENT = $1902; + {$EXTERNALSYM GL_DEPTH_COMPONENT} + GL_RED = $1903; + {$EXTERNALSYM GL_RED} + GL_GREEN = $1904; + {$EXTERNALSYM GL_GREEN} + GL_BLUE = $1905; + {$EXTERNALSYM GL_BLUE} + GL_ALPHA = $1906; + {$EXTERNALSYM GL_ALPHA} + GL_RGB = $1907; + {$EXTERNALSYM GL_RGB} + GL_RGBA = $1908; + {$EXTERNALSYM GL_RGBA} + GL_LUMINANCE = $1909; + {$EXTERNALSYM GL_LUMINANCE} + GL_LUMINANCE_ALPHA = $190A; + {$EXTERNALSYM GL_LUMINANCE_ALPHA} + + // pixel type + GL_BITMAP = $1A00; + {$EXTERNALSYM GL_BITMAP} + + // rendering modes + GL_RENDER = $1C00; + {$EXTERNALSYM GL_RENDER} + GL_FEEDBACK = $1C01; + {$EXTERNALSYM GL_FEEDBACK} + GL_SELECT = $1C02; + {$EXTERNALSYM GL_SELECT} + + // implementation strings + GL_VENDOR = $1F00; + {$EXTERNALSYM GL_VENDOR} + GL_RENDERER = $1F01; + {$EXTERNALSYM GL_RENDERER} + GL_VERSION = $1F02; + {$EXTERNALSYM GL_VERSION} + GL_EXTENSIONS = $1F03; + {$EXTERNALSYM GL_EXTENSIONS} + + // pixel formats + GL_R3_G3_B2 = $2A10; + {$EXTERNALSYM GL_R3_G3_B2} + GL_ALPHA4 = $803B; + {$EXTERNALSYM GL_ALPHA4} + GL_ALPHA8 = $803C; + {$EXTERNALSYM GL_ALPHA8} + GL_ALPHA12 = $803D; + {$EXTERNALSYM GL_ALPHA12} + GL_ALPHA16 = $803E; + {$EXTERNALSYM GL_ALPHA16} + GL_LUMINANCE4 = $803F; + {$EXTERNALSYM GL_LUMINANCE4} + GL_LUMINANCE8 = $8040; + {$EXTERNALSYM GL_LUMINANCE8} + GL_LUMINANCE12 = $8041; + {$EXTERNALSYM GL_LUMINANCE12} + GL_LUMINANCE16 = $8042; + {$EXTERNALSYM GL_LUMINANCE16} + GL_LUMINANCE4_ALPHA4 = $8043; + {$EXTERNALSYM GL_LUMINANCE4_ALPHA4} + GL_LUMINANCE6_ALPHA2 = $8044; + {$EXTERNALSYM GL_LUMINANCE6_ALPHA2} + GL_LUMINANCE8_ALPHA8 = $8045; + {$EXTERNALSYM GL_LUMINANCE8_ALPHA8} + GL_LUMINANCE12_ALPHA4 = $8046; + {$EXTERNALSYM GL_LUMINANCE12_ALPHA4} + GL_LUMINANCE12_ALPHA12 = $8047; + {$EXTERNALSYM GL_LUMINANCE12_ALPHA12} + GL_LUMINANCE16_ALPHA16 = $8048; + {$EXTERNALSYM GL_LUMINANCE16_ALPHA16} + GL_INTENSITY = $8049; + {$EXTERNALSYM GL_INTENSITY} + GL_INTENSITY4 = $804A; + {$EXTERNALSYM GL_INTENSITY4} + GL_INTENSITY8 = $804B; + {$EXTERNALSYM GL_INTENSITY8} + GL_INTENSITY12 = $804C; + {$EXTERNALSYM GL_INTENSITY12} + GL_INTENSITY16 = $804D; + {$EXTERNALSYM GL_INTENSITY16} + GL_RGB4 = $804F; + {$EXTERNALSYM GL_RGB4} + GL_RGB5 = $8050; + {$EXTERNALSYM GL_RGB5} + GL_RGB8 = $8051; + {$EXTERNALSYM GL_RGB8} + GL_RGB10 = $8052; + {$EXTERNALSYM GL_RGB10} + GL_RGB12 = $8053; + {$EXTERNALSYM GL_RGB12} + GL_RGB16 = $8054; + {$EXTERNALSYM GL_RGB16} + GL_RGBA2 = $8055; + {$EXTERNALSYM GL_RGBA2} + GL_RGBA4 = $8056; + {$EXTERNALSYM GL_RGBA4} + GL_RGB5_A1 = $8057; + {$EXTERNALSYM GL_RGB5_A1} + GL_RGBA8 = $8058; + {$EXTERNALSYM GL_RGBA8} + GL_RGB10_A2 = $8059; + {$EXTERNALSYM GL_RGB10_A2} + GL_RGBA12 = $805A; + {$EXTERNALSYM GL_RGBA12} + GL_RGBA16 = $805B; + {$EXTERNALSYM GL_RGBA16} + UNSIGNED_BYTE_3_3_2 = $8032; // GL 1.2 + {$EXTERNALSYM UNSIGNED_BYTE_3_3_2} + UNSIGNED_BYTE_2_3_3_REV = $8362; // GL 1.2 + {$EXTERNALSYM UNSIGNED_BYTE_2_3_3_REV} + UNSIGNED_SHORT_5_6_5 = $8363; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_5_6_5} + UNSIGNED_SHORT_5_6_5_REV = $8364; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_5_6_5_REV} + UNSIGNED_SHORT_4_4_4_4 = $8033; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_4_4_4_4} + UNSIGNED_SHORT_4_4_4_4_REV = $8365; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_4_4_4_4_REV} + UNSIGNED_SHORT_5_5_5_1 = $8034; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_5_5_5_1} + UNSIGNED_SHORT_1_5_5_5_REV = $8366; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_1_5_5_5_REV} + UNSIGNED_INT_8_8_8_8 = $8035; // GL 1.2 + {$EXTERNALSYM UNSIGNED_INT_8_8_8_8} + UNSIGNED_INT_8_8_8_8_REV = $8367; // GL 1.2 + {$EXTERNALSYM UNSIGNED_INT_8_8_8_8_REV} + UNSIGNED_INT_10_10_10_2 = $8036; // GL 1.2 + {$EXTERNALSYM UNSIGNED_INT_10_10_10_2} + UNSIGNED_INT_2_10_10_10_REV = $8368; // GL 1.2 + {$EXTERNALSYM UNSIGNED_INT_2_10_10_10_REV} + + // interleaved arrays formats + GL_V2F = $2A20; + {$EXTERNALSYM GL_V2F} + GL_V3F = $2A21; + {$EXTERNALSYM GL_V3F} + GL_C4UB_V2F = $2A22; + {$EXTERNALSYM GL_C4UB_V2F} + GL_C4UB_V3F = $2A23; + {$EXTERNALSYM GL_C4UB_V3F} + GL_C3F_V3F = $2A24; + {$EXTERNALSYM GL_C3F_V3F} + GL_N3F_V3F = $2A25; + {$EXTERNALSYM GL_N3F_V3F} + GL_C4F_N3F_V3F = $2A26; + {$EXTERNALSYM GL_C4F_N3F_V3F} + GL_T2F_V3F = $2A27; + {$EXTERNALSYM GL_T2F_V3F} + GL_T4F_V4F = $2A28; + {$EXTERNALSYM GL_T4F_V4F} + GL_T2F_C4UB_V3F = $2A29; + {$EXTERNALSYM GL_T2F_C4UB_V3F} + GL_T2F_C3F_V3F = $2A2A; + {$EXTERNALSYM GL_T2F_C3F_V3F} + GL_T2F_N3F_V3F = $2A2B; + {$EXTERNALSYM GL_T2F_N3F_V3F} + GL_T2F_C4F_N3F_V3F = $2A2C; + {$EXTERNALSYM GL_T2F_C4F_N3F_V3F} + GL_T4F_C4F_N3F_V4F = $2A2D; + {$EXTERNALSYM GL_T4F_C4F_N3F_V4F} + + // clip planes + GL_CLIP_PLANE0 = $3000; + {$EXTERNALSYM GL_CLIP_PLANE0} + GL_CLIP_PLANE1 = $3001; + {$EXTERNALSYM GL_CLIP_PLANE1} + GL_CLIP_PLANE2 = $3002; + {$EXTERNALSYM GL_CLIP_PLANE2} + GL_CLIP_PLANE3 = $3003; + {$EXTERNALSYM GL_CLIP_PLANE3} + GL_CLIP_PLANE4 = $3004; + {$EXTERNALSYM GL_CLIP_PLANE4} + GL_CLIP_PLANE5 = $3005; + {$EXTERNALSYM GL_CLIP_PLANE5} + + // miscellaneous + GL_DITHER = $0BD0; + {$EXTERNALSYM GL_DITHER} + + // ----- extensions enumerants ----- + // EXT_abgr + GL_ABGR_EXT = $8000; + {$EXTERNALSYM GL_ABGR_EXT} + + // EXT_packed_pixels + GL_UNSIGNED_BYTE_3_3_2_EXT = $8032; + {$EXTERNALSYM GL_UNSIGNED_BYTE_3_3_2_EXT} + GL_UNSIGNED_SHORT_4_4_4_4_EXT = $8033; + {$EXTERNALSYM GL_UNSIGNED_SHORT_4_4_4_4_EXT} + GL_UNSIGNED_SHORT_5_5_5_1_EXT = $8034; + {$EXTERNALSYM GL_UNSIGNED_SHORT_5_5_5_1_EXT} + GL_UNSIGNED_INT_8_8_8_8_EXT = $8035; + {$EXTERNALSYM GL_UNSIGNED_INT_8_8_8_8_EXT} + GL_UNSIGNED_INT_10_10_10_2_EXT = $8036; + {$EXTERNALSYM GL_UNSIGNED_INT_10_10_10_2_EXT} + + // EXT_vertex_array + GL_VERTEX_ARRAY_EXT = $8074; + {$EXTERNALSYM GL_VERTEX_ARRAY_EXT} + GL_NORMAL_ARRAY_EXT = $8075; + {$EXTERNALSYM GL_NORMAL_ARRAY_EXT} + GL_COLOR_ARRAY_EXT = $8076; + {$EXTERNALSYM GL_COLOR_ARRAY_EXT} + GL_INDEX_ARRAY_EXT = $8077; + {$EXTERNALSYM GL_INDEX_ARRAY_EXT} + GL_TEXTURE_COORD_ARRAY_EXT = $8078; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_EXT} + GL_EDGE_FLAG_ARRAY_EXT = $8079; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_EXT} + GL_VERTEX_ARRAY_SIZE_EXT = $807A; + {$EXTERNALSYM GL_VERTEX_ARRAY_SIZE_EXT} + GL_VERTEX_ARRAY_TYPE_EXT = $807B; + {$EXTERNALSYM GL_VERTEX_ARRAY_TYPE_EXT} + GL_VERTEX_ARRAY_STRIDE_EXT = $807C; + {$EXTERNALSYM GL_VERTEX_ARRAY_STRIDE_EXT} + GL_VERTEX_ARRAY_COUNT_EXT = $807D; + {$EXTERNALSYM GL_VERTEX_ARRAY_COUNT_EXT} + GL_NORMAL_ARRAY_TYPE_EXT = $807E; + {$EXTERNALSYM GL_NORMAL_ARRAY_TYPE_EXT} + GL_NORMAL_ARRAY_STRIDE_EXT = $807F; + {$EXTERNALSYM GL_NORMAL_ARRAY_STRIDE_EXT} + GL_NORMAL_ARRAY_COUNT_EXT = $8080; + {$EXTERNALSYM GL_NORMAL_ARRAY_COUNT_EXT} + GL_COLOR_ARRAY_SIZE_EXT = $8081; + {$EXTERNALSYM GL_COLOR_ARRAY_SIZE_EXT} + GL_COLOR_ARRAY_TYPE_EXT = $8082; + {$EXTERNALSYM GL_COLOR_ARRAY_TYPE_EXT} + GL_COLOR_ARRAY_STRIDE_EXT = $8083; + {$EXTERNALSYM GL_COLOR_ARRAY_STRIDE_EXT} + GL_COLOR_ARRAY_COUNT_EXT = $8084; + {$EXTERNALSYM GL_COLOR_ARRAY_COUNT_EXT} + GL_INDEX_ARRAY_TYPE_EXT = $8085; + {$EXTERNALSYM GL_INDEX_ARRAY_TYPE_EXT} + GL_INDEX_ARRAY_STRIDE_EXT = $8086; + {$EXTERNALSYM GL_INDEX_ARRAY_STRIDE_EXT} + GL_INDEX_ARRAY_COUNT_EXT = $8087; + {$EXTERNALSYM GL_INDEX_ARRAY_COUNT_EXT} + GL_TEXTURE_COORD_ARRAY_SIZE_EXT = $8088; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_SIZE_EXT} + GL_TEXTURE_COORD_ARRAY_TYPE_EXT = $8089; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_TYPE_EXT} + GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = $808A; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_STRIDE_EXT} + GL_TEXTURE_COORD_ARRAY_COUNT_EXT = $808B; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_COUNT_EXT} + GL_EDGE_FLAG_ARRAY_STRIDE_EXT = $808C; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_STRIDE_EXT} + GL_EDGE_FLAG_ARRAY_COUNT_EXT = $808D; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_COUNT_EXT} + GL_VERTEX_ARRAY_POINTER_EXT = $808E; + {$EXTERNALSYM GL_VERTEX_ARRAY_POINTER_EXT} + GL_NORMAL_ARRAY_POINTER_EXT = $808F; + {$EXTERNALSYM GL_NORMAL_ARRAY_POINTER_EXT} + GL_COLOR_ARRAY_POINTER_EXT = $8090; + {$EXTERNALSYM GL_COLOR_ARRAY_POINTER_EXT} + GL_INDEX_ARRAY_POINTER_EXT = $8091; + {$EXTERNALSYM GL_INDEX_ARRAY_POINTER_EXT} + GL_TEXTURE_COORD_ARRAY_POINTER_EXT = $8092; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_POINTER_EXT} + GL_EDGE_FLAG_ARRAY_POINTER_EXT = $8093; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_POINTER_EXT} + + // EXT_color_table + GL_TABLE_TOO_LARGE_EXT = $8031; + {$EXTERNALSYM GL_TABLE_TOO_LARGE_EXT} + GL_COLOR_TABLE_EXT = $80D0; + {$EXTERNALSYM GL_COLOR_TABLE_EXT} + GL_POST_CONVOLUTION_COLOR_TABLE_EXT = $80D1; + {$EXTERNALSYM GL_POST_CONVOLUTION_COLOR_TABLE_EXT} + GL_POST_COLOR_MATRIX_COLOR_TABLE_EXT = $80D2; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_COLOR_TABLE_EXT} + GL_PROXY_COLOR_TABLE_EXT = $80D3; + {$EXTERNALSYM GL_PROXY_COLOR_TABLE_EXT} + GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_EXT = $80D4; + {$EXTERNALSYM GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_EXT} + GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_EXT = $80D5; + {$EXTERNALSYM GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_EXT} + GL_COLOR_TABLE_SCALE_EXT = $80D6; + {$EXTERNALSYM GL_COLOR_TABLE_SCALE_EXT} + GL_COLOR_TABLE_BIAS_EXT = $80D7; + {$EXTERNALSYM GL_COLOR_TABLE_BIAS_EXT} + GL_COLOR_TABLE_FORMAT_EXT = $80D8; + {$EXTERNALSYM GL_COLOR_TABLE_FORMAT_EXT} + GL_COLOR_TABLE_WIDTH_EXT = $80D9; + {$EXTERNALSYM GL_COLOR_TABLE_WIDTH_EXT} + GL_COLOR_TABLE_RED_SIZE_EXT = $80DA; + {$EXTERNALSYM GL_COLOR_TABLE_RED_SIZE_EXT} + GL_COLOR_TABLE_GREEN_SIZE_EXT = $80DB; + {$EXTERNALSYM GL_COLOR_TABLE_GREEN_SIZE_EXT} + GL_COLOR_TABLE_BLUE_SIZE_EXT = $80DC; + {$EXTERNALSYM GL_COLOR_TABLE_BLUE_SIZE_EXT} + GL_COLOR_TABLE_ALPHA_SIZE_EXT = $80DD; + {$EXTERNALSYM GL_COLOR_TABLE_ALPHA_SIZE_EXT} + GL_COLOR_TABLE_LUMINANCE_SIZE_EXT = $80DE; + {$EXTERNALSYM GL_COLOR_TABLE_LUMINANCE_SIZE_EXT} + GL_COLOR_TABLE_INTENSITY_SIZE_EXT = $80DF; + {$EXTERNALSYM GL_COLOR_TABLE_INTENSITY_SIZE_EXT} + + // EXT_bgra + GL_BGR_EXT = $80E0; + {$EXTERNALSYM GL_BGR_EXT} + GL_BGRA_EXT = $80E1; + {$EXTERNALSYM GL_BGRA_EXT} + + // EXT_paletted_texture + GL_COLOR_INDEX1_EXT = $80E2; + {$EXTERNALSYM GL_COLOR_INDEX1_EXT} + GL_COLOR_INDEX2_EXT = $80E3; + {$EXTERNALSYM GL_COLOR_INDEX2_EXT} + GL_COLOR_INDEX4_EXT = $80E4; + {$EXTERNALSYM GL_COLOR_INDEX4_EXT} + GL_COLOR_INDEX8_EXT = $80E5; + {$EXTERNALSYM GL_COLOR_INDEX8_EXT} + GL_COLOR_INDEX12_EXT = $80E6; + {$EXTERNALSYM GL_COLOR_INDEX12_EXT} + GL_COLOR_INDEX16_EXT = $80E7; + {$EXTERNALSYM GL_COLOR_INDEX16_EXT} + + // EXT_blend_color + GL_CONSTANT_COLOR_EXT = $8001; + {$EXTERNALSYM GL_CONSTANT_COLOR_EXT} + GL_ONE_MINUS_CONSTANT_COLOR_EXT = $8002; + {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_COLOR_EXT} + GL_CONSTANT_ALPHA_EXT = $8003; + {$EXTERNALSYM GL_CONSTANT_ALPHA_EXT} + GL_ONE_MINUS_CONSTANT_ALPHA_EXT = $8004; + {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_ALPHA_EXT} + GL_BLEND_COLOR_EXT = $8005; + {$EXTERNALSYM GL_BLEND_COLOR_EXT} + + // EXT_blend_minmax + GL_FUNC_ADD_EXT = $8006; + {$EXTERNALSYM GL_FUNC_ADD_EXT} + GL_MIN_EXT = $8007; + {$EXTERNALSYM GL_MIN_EXT} + GL_MAX_EXT = $8008; + {$EXTERNALSYM GL_MAX_EXT} + GL_BLEND_EQUATION_EXT = $8009; + {$EXTERNALSYM GL_BLEND_EQUATION_EXT} + + // EXT_blend_subtract + GL_FUNC_SUBTRACT_EXT = $800A; + {$EXTERNALSYM GL_FUNC_SUBTRACT_EXT} + GL_FUNC_REVERSE_SUBTRACT_EXT = $800B; + {$EXTERNALSYM GL_FUNC_REVERSE_SUBTRACT_EXT} + + // EXT_convolution + GL_CONVOLUTION_1D_EXT = $8010; + {$EXTERNALSYM GL_CONVOLUTION_1D_EXT} + GL_CONVOLUTION_2D_EXT = $8011; + {$EXTERNALSYM GL_CONVOLUTION_2D_EXT} + GL_SEPARABLE_2D_EXT = $8012; + {$EXTERNALSYM GL_SEPARABLE_2D_EXT} + GL_CONVOLUTION_BORDER_MODE_EXT = $8013; + {$EXTERNALSYM GL_CONVOLUTION_BORDER_MODE_EXT} + GL_CONVOLUTION_FILTER_SCALE_EXT = $8014; + {$EXTERNALSYM GL_CONVOLUTION_FILTER_SCALE_EXT} + GL_CONVOLUTION_FILTER_BIAS_EXT = $8015; + {$EXTERNALSYM GL_CONVOLUTION_FILTER_BIAS_EXT} + GL_REDUCE_EXT = $8016; + {$EXTERNALSYM GL_REDUCE_EXT} + GL_CONVOLUTION_FORMAT_EXT = $8017; + {$EXTERNALSYM GL_CONVOLUTION_FORMAT_EXT} + GL_CONVOLUTION_WIDTH_EXT = $8018; + {$EXTERNALSYM GL_CONVOLUTION_WIDTH_EXT} + GL_CONVOLUTION_HEIGHT_EXT = $8019; + {$EXTERNALSYM GL_CONVOLUTION_HEIGHT_EXT} + GL_MAX_CONVOLUTION_WIDTH_EXT = $801A; + {$EXTERNALSYM GL_MAX_CONVOLUTION_WIDTH_EXT} + GL_MAX_CONVOLUTION_HEIGHT_EXT = $801B; + {$EXTERNALSYM GL_MAX_CONVOLUTION_HEIGHT_EXT} + GL_POST_CONVOLUTION_RED_SCALE_EXT = $801C; + {$EXTERNALSYM GL_POST_CONVOLUTION_RED_SCALE_EXT} + GL_POST_CONVOLUTION_GREEN_SCALE_EXT = $801D; + {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_SCALE_EXT} + GL_POST_CONVOLUTION_BLUE_SCALE_EXT = $801E; + {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_SCALE_EXT} + GL_POST_CONVOLUTION_ALPHA_SCALE_EXT = $801F; + {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_SCALE_EXT} + GL_POST_CONVOLUTION_RED_BIAS_EXT = $8020; + {$EXTERNALSYM GL_POST_CONVOLUTION_RED_BIAS_EXT} + GL_POST_CONVOLUTION_GREEN_BIAS_EXT = $8021; + {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_BIAS_EXT} + GL_POST_CONVOLUTION_BLUE_BIAS_EXT = $8022; + {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_BIAS_EXT} + GL_POST_CONVOLUTION_ALPHA_BIAS_EXT = $8023; + {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_BIAS_EXT} + + // EXT_histogram + GL_HISTOGRAM_EXT = $8024; + {$EXTERNALSYM GL_HISTOGRAM_EXT} + GL_PROXY_HISTOGRAM_EXT = $8025; + {$EXTERNALSYM GL_PROXY_HISTOGRAM_EXT} + GL_HISTOGRAM_WIDTH_EXT = $8026; + {$EXTERNALSYM GL_HISTOGRAM_WIDTH_EXT} + GL_HISTOGRAM_FORMAT_EXT = $8027; + {$EXTERNALSYM GL_HISTOGRAM_FORMAT_EXT} + GL_HISTOGRAM_RED_SIZE_EXT = $8028; + {$EXTERNALSYM GL_HISTOGRAM_RED_SIZE_EXT} + GL_HISTOGRAM_GREEN_SIZE_EXT = $8029; + {$EXTERNALSYM GL_HISTOGRAM_GREEN_SIZE_EXT} + GL_HISTOGRAM_BLUE_SIZE_EXT = $802A; + {$EXTERNALSYM GL_HISTOGRAM_BLUE_SIZE_EXT} + GL_HISTOGRAM_ALPHA_SIZE_EXT = $802B; + {$EXTERNALSYM GL_HISTOGRAM_ALPHA_SIZE_EXT} + GL_HISTOGRAM_LUMINANCE_SIZE_EXT = $802C; + {$EXTERNALSYM GL_HISTOGRAM_LUMINANCE_SIZE_EXT} + GL_HISTOGRAM_SINK_EXT = $802D; + {$EXTERNALSYM GL_HISTOGRAM_SINK_EXT} + GL_MINMAX_EXT = $802E; + {$EXTERNALSYM GL_MINMAX_EXT} + GL_MINMAX_FORMAT_EXT = $802F; + {$EXTERNALSYM GL_MINMAX_FORMAT_EXT} + GL_MINMAX_SINK_EXT = $8030; + {$EXTERNALSYM GL_MINMAX_SINK_EXT} + + // EXT_polygon_offset + GL_POLYGON_OFFSET_EXT = $8037; + {$EXTERNALSYM GL_POLYGON_OFFSET_EXT} + GL_POLYGON_OFFSET_FACTOR_EXT = $8038; + {$EXTERNALSYM GL_POLYGON_OFFSET_FACTOR_EXT} + GL_POLYGON_OFFSET_BIAS_EXT = $8039; + {$EXTERNALSYM GL_POLYGON_OFFSET_BIAS_EXT} + + // EXT_texture + GL_ALPHA4_EXT = $803B; + {$EXTERNALSYM GL_ALPHA4_EXT} + GL_ALPHA8_EXT = $803C; + {$EXTERNALSYM GL_ALPHA8_EXT} + GL_ALPHA12_EXT = $803D; + {$EXTERNALSYM GL_ALPHA12_EXT} + GL_ALPHA16_EXT = $803E; + {$EXTERNALSYM GL_ALPHA16_EXT} + GL_LUMINANCE4_EXT = $803F; + {$EXTERNALSYM GL_LUMINANCE4_EXT} + GL_LUMINANCE8_EXT = $8040; + {$EXTERNALSYM GL_LUMINANCE8_EXT} + GL_LUMINANCE12_EXT = $8041; + {$EXTERNALSYM GL_LUMINANCE12_EXT} + GL_LUMINANCE16_EXT = $8042; + {$EXTERNALSYM GL_LUMINANCE16_EXT} + GL_LUMINANCE4_ALPHA4_EXT = $8043; + {$EXTERNALSYM GL_LUMINANCE4_ALPHA4_EXT} + GL_LUMINANCE6_ALPHA2_EXT = $8044; + {$EXTERNALSYM GL_LUMINANCE6_ALPHA2_EXT} + GL_LUMINANCE8_ALPHA8_EXT = $8045; + {$EXTERNALSYM GL_LUMINANCE8_ALPHA8_EXT} + GL_LUMINANCE12_ALPHA4_EXT = $8046; + {$EXTERNALSYM GL_LUMINANCE12_ALPHA4_EXT} + GL_LUMINANCE12_ALPHA12_EXT = $8047; + {$EXTERNALSYM GL_LUMINANCE12_ALPHA12_EXT} + GL_LUMINANCE16_ALPHA16_EXT = $8048; + {$EXTERNALSYM GL_LUMINANCE16_ALPHA16_EXT} + GL_INTENSITY_EXT = $8049; + {$EXTERNALSYM GL_INTENSITY_EXT} + GL_INTENSITY4_EXT = $804A; + {$EXTERNALSYM GL_INTENSITY4_EXT} + GL_INTENSITY8_EXT = $804B; + {$EXTERNALSYM GL_INTENSITY8_EXT} + GL_INTENSITY12_EXT = $804C; + {$EXTERNALSYM GL_INTENSITY12_EXT} + GL_INTENSITY16_EXT = $804D; + {$EXTERNALSYM GL_INTENSITY16_EXT} + GL_RGB2_EXT = $804E; + {$EXTERNALSYM GL_RGB2_EXT} + GL_RGB4_EXT = $804F; + {$EXTERNALSYM GL_RGB4_EXT} + GL_RGB5_EXT = $8050; + {$EXTERNALSYM GL_RGB5_EXT} + GL_RGB8_EXT = $8051; + {$EXTERNALSYM GL_RGB8_EXT} + GL_RGB10_EXT = $8052; + {$EXTERNALSYM GL_RGB10_EXT} + GL_RGB12_EXT = $8053; + {$EXTERNALSYM GL_RGB12_EXT} + GL_RGB16_EXT = $8054; + {$EXTERNALSYM GL_RGB16_EXT} + GL_RGBA2_EXT = $8055; + {$EXTERNALSYM GL_RGBA2_EXT} + GL_RGBA4_EXT = $8056; + {$EXTERNALSYM GL_RGBA4_EXT} + GL_RGB5_A1_EXT = $8057; + {$EXTERNALSYM GL_RGB5_A1_EXT} + GL_RGBA8_EXT = $8058; + {$EXTERNALSYM GL_RGBA8_EXT} + GL_RGB10_A2_EXT = $8059; + {$EXTERNALSYM GL_RGB10_A2_EXT} + GL_RGBA12_EXT = $805A; + {$EXTERNALSYM GL_RGBA12_EXT} + GL_RGBA16_EXT = $805B; + {$EXTERNALSYM GL_RGBA16_EXT} + GL_TEXTURE_RED_SIZE_EXT = $805C; + {$EXTERNALSYM GL_TEXTURE_RED_SIZE_EXT} + GL_TEXTURE_GREEN_SIZE_EXT = $805D; + {$EXTERNALSYM GL_TEXTURE_GREEN_SIZE_EXT} + GL_TEXTURE_BLUE_SIZE_EXT = $805E; + {$EXTERNALSYM GL_TEXTURE_BLUE_SIZE_EXT} + GL_TEXTURE_ALPHA_SIZE_EXT = $805F; + {$EXTERNALSYM GL_TEXTURE_ALPHA_SIZE_EXT} + GL_TEXTURE_LUMINANCE_SIZE_EXT = $8060; + {$EXTERNALSYM GL_TEXTURE_LUMINANCE_SIZE_EXT} + GL_TEXTURE_INTENSITY_SIZE_EXT = $8061; + {$EXTERNALSYM GL_TEXTURE_INTENSITY_SIZE_EXT} + GL_REPLACE_EXT = $8062; + {$EXTERNALSYM GL_REPLACE_EXT} + GL_PROXY_TEXTURE_1D_EXT = $8063; + {$EXTERNALSYM GL_PROXY_TEXTURE_1D_EXT} + GL_PROXY_TEXTURE_2D_EXT = $8064; + {$EXTERNALSYM GL_PROXY_TEXTURE_2D_EXT} + GL_TEXTURE_TOO_LARGE_EXT = $8065; + {$EXTERNALSYM GL_TEXTURE_TOO_LARGE_EXT} + + // EXT_texture_object + GL_TEXTURE_PRIORITY_EXT = $8066; + {$EXTERNALSYM GL_TEXTURE_PRIORITY_EXT} + GL_TEXTURE_RESIDENT_EXT = $8067; + {$EXTERNALSYM GL_TEXTURE_RESIDENT_EXT} + GL_TEXTURE_1D_BINDING_EXT = $8068; + {$EXTERNALSYM GL_TEXTURE_1D_BINDING_EXT} + GL_TEXTURE_2D_BINDING_EXT = $8069; + {$EXTERNALSYM GL_TEXTURE_2D_BINDING_EXT} + GL_TEXTURE_3D_BINDING_EXT = $806A; + {$EXTERNALSYM GL_TEXTURE_3D_BINDING_EXT} + + // EXT_texture3D + GL_PACK_SKIP_IMAGES_EXT = $806B; + {$EXTERNALSYM GL_PACK_SKIP_IMAGES_EXT} + GL_PACK_IMAGE_HEIGHT_EXT = $806C; + {$EXTERNALSYM GL_PACK_IMAGE_HEIGHT_EXT} + GL_UNPACK_SKIP_IMAGES_EXT = $806D; + {$EXTERNALSYM GL_UNPACK_SKIP_IMAGES_EXT} + GL_UNPACK_IMAGE_HEIGHT_EXT = $806E; + {$EXTERNALSYM GL_UNPACK_IMAGE_HEIGHT_EXT} + GL_TEXTURE_3D_EXT = $806F; + {$EXTERNALSYM GL_TEXTURE_3D_EXT} + GL_PROXY_TEXTURE_3D_EXT = $8070; + {$EXTERNALSYM GL_PROXY_TEXTURE_3D_EXT} + GL_TEXTURE_DEPTH_EXT = $8071; + {$EXTERNALSYM GL_TEXTURE_DEPTH_EXT} + GL_TEXTURE_WRAP_R_EXT = $8072; + {$EXTERNALSYM GL_TEXTURE_WRAP_R_EXT} + GL_MAX_3D_TEXTURE_SIZE_EXT = $8073; + {$EXTERNALSYM GL_MAX_3D_TEXTURE_SIZE_EXT} + + // SGI_color_matrix + GL_COLOR_MATRIX_SGI = $80B1; + {$EXTERNALSYM GL_COLOR_MATRIX_SGI} + GL_COLOR_MATRIX_STACK_DEPTH_SGI = $80B2; + {$EXTERNALSYM GL_COLOR_MATRIX_STACK_DEPTH_SGI} + GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI = $80B3; + {$EXTERNALSYM GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI} + GL_POST_COLOR_MATRIX_RED_SCALE_SGI = $80B4; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_SCALE_SGI} + GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI = $80B5; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI} + GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI = $80B6; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI} + GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI = $80B7; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI} + GL_POST_COLOR_MATRIX_RED_BIAS_SGI = $80B8; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_BIAS_SGI} + GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI = $80B9; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI} + GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI = $80BA; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI} + GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI = $80BB; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI} + + // SGI_texture_color_table + GL_TEXTURE_COLOR_TABLE_SGI = $80BC; + {$EXTERNALSYM GL_TEXTURE_COLOR_TABLE_SGI} + GL_PROXY_TEXTURE_COLOR_TABLE_SGI = $80BD; + {$EXTERNALSYM GL_PROXY_TEXTURE_COLOR_TABLE_SGI} + GL_TEXTURE_COLOR_TABLE_BIAS_SGI = $80BE; + {$EXTERNALSYM GL_TEXTURE_COLOR_TABLE_BIAS_SGI} + GL_TEXTURE_COLOR_TABLE_SCALE_SGI = $80BF; + {$EXTERNALSYM GL_TEXTURE_COLOR_TABLE_SCALE_SGI} + + // SGI_color_table + GL_COLOR_TABLE_SGI = $80D0; + {$EXTERNALSYM GL_COLOR_TABLE_SGI} + GL_POST_CONVOLUTION_COLOR_TABLE_SGI = $80D1; + {$EXTERNALSYM GL_POST_CONVOLUTION_COLOR_TABLE_SGI} + GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI = $80D2; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI} + GL_PROXY_COLOR_TABLE_SGI = $80D3; + {$EXTERNALSYM GL_PROXY_COLOR_TABLE_SGI} + GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI = $80D4; + {$EXTERNALSYM GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI} + GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI = $80D5; + {$EXTERNALSYM GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI} + GL_COLOR_TABLE_SCALE_SGI = $80D6; + {$EXTERNALSYM GL_COLOR_TABLE_SCALE_SGI} + GL_COLOR_TABLE_BIAS_SGI = $80D7; + {$EXTERNALSYM GL_COLOR_TABLE_BIAS_SGI} + GL_COLOR_TABLE_FORMAT_SGI = $80D8; + {$EXTERNALSYM GL_COLOR_TABLE_FORMAT_SGI} + GL_COLOR_TABLE_WIDTH_SGI = $80D9; + {$EXTERNALSYM GL_COLOR_TABLE_WIDTH_SGI} + GL_COLOR_TABLE_RED_SIZE_SGI = $80DA; + {$EXTERNALSYM GL_COLOR_TABLE_RED_SIZE_SGI} + GL_COLOR_TABLE_GREEN_SIZE_SGI = $80DB; + {$EXTERNALSYM GL_COLOR_TABLE_GREEN_SIZE_SGI} + GL_COLOR_TABLE_BLUE_SIZE_SGI = $80DC; + {$EXTERNALSYM GL_COLOR_TABLE_BLUE_SIZE_SGI} + GL_COLOR_TABLE_ALPHA_SIZE_SGI = $80DD; + {$EXTERNALSYM GL_COLOR_TABLE_ALPHA_SIZE_SGI} + GL_COLOR_TABLE_LUMINANCE_SIZE_SGI = $80DE; + {$EXTERNALSYM GL_COLOR_TABLE_LUMINANCE_SIZE_SGI} + GL_COLOR_TABLE_INTENSITY_SIZE_SGI = $80DF; + {$EXTERNALSYM GL_COLOR_TABLE_INTENSITY_SIZE_SGI} + + // EXT_cmyka + GL_CMYK_EXT = $800C; + {$EXTERNALSYM GL_CMYK_EXT} + GL_CMYKA_EXT = $800D; + {$EXTERNALSYM GL_CMYKA_EXT} + GL_PACK_CMYK_HINT_EXT = $800E; + {$EXTERNALSYM GL_PACK_CMYK_HINT_EXT} + GL_UNPACK_CMYK_HINT_EXT = $800F; + {$EXTERNALSYM GL_UNPACK_CMYK_HINT_EXT} + + // EXT_rescale_normal + GL_RESCALE_NORMAL_EXT = $803A; + {$EXTERNALSYM GL_RESCALE_NORMAL_EXT} + + // EXT_clip_volume_hint + GL_CLIP_VOLUME_CLIPPING_HINT_EXT = $80F0; + {$EXTERNALSYM GL_CLIP_VOLUME_CLIPPING_HINT_EXT} + + // EXT_cull_vertex + GL_CULL_VERTEX_EXT = $81AA; + {$EXTERNALSYM GL_CULL_VERTEX_EXT} + GL_CULL_VERTEX_EYE_POSITION_EXT = $81AB; + {$EXTERNALSYM GL_CULL_VERTEX_EYE_POSITION_EXT} + GL_CULL_VERTEX_OBJECT_POSITION_EXT = $81AC; + {$EXTERNALSYM GL_CULL_VERTEX_OBJECT_POSITION_EXT} + + // EXT_index_array_formats + GL_IUI_V2F_EXT = $81AD; + {$EXTERNALSYM GL_IUI_V2F_EXT} + GL_IUI_V3F_EXT = $81AE; + {$EXTERNALSYM GL_IUI_V3F_EXT} + GL_IUI_N3F_V2F_EXT = $81AF; + {$EXTERNALSYM GL_IUI_N3F_V2F_EXT} + GL_IUI_N3F_V3F_EXT = $81B0; + {$EXTERNALSYM GL_IUI_N3F_V3F_EXT} + GL_T2F_IUI_V2F_EXT = $81B1; + {$EXTERNALSYM GL_T2F_IUI_V2F_EXT} + GL_T2F_IUI_V3F_EXT = $81B2; + {$EXTERNALSYM GL_T2F_IUI_V3F_EXT} + GL_T2F_IUI_N3F_V2F_EXT = $81B3; + {$EXTERNALSYM GL_T2F_IUI_N3F_V2F_EXT} + GL_T2F_IUI_N3F_V3F_EXT = $81B4; + {$EXTERNALSYM GL_T2F_IUI_N3F_V3F_EXT} + + // EXT_index_func + GL_INDEX_TEST_EXT = $81B5; + {$EXTERNALSYM GL_INDEX_TEST_EXT} + GL_INDEX_TEST_FUNC_EXT = $81B6; + {$EXTERNALSYM GL_INDEX_TEST_FUNC_EXT} + GL_INDEX_TEST_REF_EXT = $81B7; + {$EXTERNALSYM GL_INDEX_TEST_REF_EXT} + + // EXT_index_material + GL_INDEX_MATERIAL_EXT = $81B8; + {$EXTERNALSYM GL_INDEX_MATERIAL_EXT} + GL_INDEX_MATERIAL_PARAMETER_EXT = $81B9; + {$EXTERNALSYM GL_INDEX_MATERIAL_PARAMETER_EXT} + GL_INDEX_MATERIAL_FACE_EXT = $81BA; + {$EXTERNALSYM GL_INDEX_MATERIAL_FACE_EXT} + + // EXT_misc_attribute + GL_MISC_BIT_EXT = 0; // not yet defined + {$EXTERNALSYM GL_MISC_BIT_EXT} + + // EXT_scene_marker + GL_SCENE_REQUIRED_EXT = 0; // not yet defined + {$EXTERNALSYM GL_SCENE_REQUIRED_EXT} + + // EXT_shared_texture_palette + GL_SHARED_TEXTURE_PALETTE_EXT = $81FB; + {$EXTERNALSYM GL_SHARED_TEXTURE_PALETTE_EXT} + + // EXT_nurbs_tessellator + GLU_NURBS_MODE_EXT = 100160; + {$EXTERNALSYM GLU_NURBS_MODE_EXT} + GLU_NURBS_TESSELLATOR_EXT = 100161; + {$EXTERNALSYM GLU_NURBS_TESSELLATOR_EXT} + GLU_NURBS_RENDERER_EXT = 100162; + {$EXTERNALSYM GLU_NURBS_RENDERER_EXT} + GLU_NURBS_BEGIN_EXT = 100164; + {$EXTERNALSYM GLU_NURBS_BEGIN_EXT} + GLU_NURBS_VERTEX_EXT = 100165; + {$EXTERNALSYM GLU_NURBS_VERTEX_EXT} + GLU_NURBS_NORMAL_EXT = 100166; + {$EXTERNALSYM GLU_NURBS_NORMAL_EXT} + GLU_NURBS_COLOR_EXT = 100167; + {$EXTERNALSYM GLU_NURBS_COLOR_EXT} + GLU_NURBS_TEX_COORD_EXT = 100168; + {$EXTERNALSYM GLU_NURBS_TEX_COORD_EXT} + GLU_NURBS_END_EXT = 100169; + {$EXTERNALSYM GLU_NURBS_END_EXT} + GLU_NURBS_BEGIN_DATA_EXT = 100170; + {$EXTERNALSYM GLU_NURBS_BEGIN_DATA_EXT} + GLU_NURBS_VERTEX_DATA_EXT = 100171; + {$EXTERNALSYM GLU_NURBS_VERTEX_DATA_EXT} + GLU_NURBS_NORMAL_DATA_EXT = 100172; + {$EXTERNALSYM GLU_NURBS_NORMAL_DATA_EXT} + GLU_NURBS_COLOR_DATA_EXT = 100173; + {$EXTERNALSYM GLU_NURBS_COLOR_DATA_EXT} + GLU_NURBS_TEX_COORD_DATA_EXT = 100174; + {$EXTERNALSYM GLU_NURBS_TEX_COORD_DATA_EXT} + GLU_NURBS_END_DATA_EXT = 100175; + {$EXTERNALSYM GLU_NURBS_END_DATA_EXT} + + // EXT_object_space_tess + GLU_OBJECT_PARAMETRIC_ERROR_EXT = 100208; + {$EXTERNALSYM GLU_OBJECT_PARAMETRIC_ERROR_EXT} + GLU_OBJECT_PATH_LENGTH_EXT = 100209; + {$EXTERNALSYM GLU_OBJECT_PATH_LENGTH_EXT} + + // EXT_point_parameters + GL_POINT_SIZE_MIN_EXT = $8126; + {$EXTERNALSYM GL_POINT_SIZE_MIN_EXT} + GL_POINT_SIZE_MAX_EXT = $8127; + {$EXTERNALSYM GL_POINT_SIZE_MAX_EXT} + GL_POINT_FADE_THRESHOLD_SIZE_EXT = $8128; + {$EXTERNALSYM GL_POINT_FADE_THRESHOLD_SIZE_EXT} + GL_DISTANCE_ATTENUATION_EXT = $8129; + {$EXTERNALSYM GL_DISTANCE_ATTENUATION_EXT} + + // EXT_compiled_vertex_array + GL_ARRAY_ELEMENT_LOCK_FIRST_EXT = $81A8; + {$EXTERNALSYM GL_ARRAY_ELEMENT_LOCK_FIRST_EXT} + GL_ARRAY_ELEMENT_LOCK_COUNT_EXT = $81A9; + {$EXTERNALSYM GL_ARRAY_ELEMENT_LOCK_COUNT_EXT} + + // ARB_multitexture + GL_ACTIVE_TEXTURE_ARB = $84E0; + {$EXTERNALSYM GL_ACTIVE_TEXTURE_ARB} + GL_CLIENT_ACTIVE_TEXTURE_ARB = $84E1; + {$EXTERNALSYM GL_CLIENT_ACTIVE_TEXTURE_ARB} + GL_MAX_TEXTURE_UNITS_ARB = $84E2; + {$EXTERNALSYM GL_MAX_TEXTURE_UNITS_ARB} + GL_TEXTURE0_ARB = $84C0; + {$EXTERNALSYM GL_TEXTURE0_ARB} + GL_TEXTURE1_ARB = $84C1; + {$EXTERNALSYM GL_TEXTURE1_ARB} + GL_TEXTURE2_ARB = $84C2; + {$EXTERNALSYM GL_TEXTURE2_ARB} + GL_TEXTURE3_ARB = $84C3; + {$EXTERNALSYM GL_TEXTURE3_ARB} + GL_TEXTURE4_ARB = $84C4; + {$EXTERNALSYM GL_TEXTURE4_ARB} + GL_TEXTURE5_ARB = $84C5; + {$EXTERNALSYM GL_TEXTURE5_ARB} + GL_TEXTURE6_ARB = $84C6; + {$EXTERNALSYM GL_TEXTURE6_ARB} + GL_TEXTURE7_ARB = $84C7; + {$EXTERNALSYM GL_TEXTURE7_ARB} + GL_TEXTURE8_ARB = $84C8; + {$EXTERNALSYM GL_TEXTURE8_ARB} + GL_TEXTURE9_ARB = $84C9; + {$EXTERNALSYM GL_TEXTURE9_ARB} + GL_TEXTURE10_ARB = $84CA; + {$EXTERNALSYM GL_TEXTURE10_ARB} + GL_TEXTURE11_ARB = $84CB; + {$EXTERNALSYM GL_TEXTURE11_ARB} + GL_TEXTURE12_ARB = $84CC; + {$EXTERNALSYM GL_TEXTURE12_ARB} + GL_TEXTURE13_ARB = $84CD; + {$EXTERNALSYM GL_TEXTURE13_ARB} + GL_TEXTURE14_ARB = $84CE; + {$EXTERNALSYM GL_TEXTURE14_ARB} + GL_TEXTURE15_ARB = $84CF; + {$EXTERNALSYM GL_TEXTURE15_ARB} + GL_TEXTURE16_ARB = $84D0; + {$EXTERNALSYM GL_TEXTURE16_ARB} + GL_TEXTURE17_ARB = $84D1; + {$EXTERNALSYM GL_TEXTURE17_ARB} + GL_TEXTURE18_ARB = $84D2; + {$EXTERNALSYM GL_TEXTURE18_ARB} + GL_TEXTURE19_ARB = $84D3; + {$EXTERNALSYM GL_TEXTURE19_ARB} + GL_TEXTURE20_ARB = $84D4; + {$EXTERNALSYM GL_TEXTURE20_ARB} + GL_TEXTURE21_ARB = $84D5; + {$EXTERNALSYM GL_TEXTURE21_ARB} + GL_TEXTURE22_ARB = $84D6; + {$EXTERNALSYM GL_TEXTURE22_ARB} + GL_TEXTURE23_ARB = $84D7; + {$EXTERNALSYM GL_TEXTURE23_ARB} + GL_TEXTURE24_ARB = $84D8; + {$EXTERNALSYM GL_TEXTURE24_ARB} + GL_TEXTURE25_ARB = $84D9; + {$EXTERNALSYM GL_TEXTURE25_ARB} + GL_TEXTURE26_ARB = $84DA; + {$EXTERNALSYM GL_TEXTURE26_ARB} + GL_TEXTURE27_ARB = $84DB; + {$EXTERNALSYM GL_TEXTURE27_ARB} + GL_TEXTURE28_ARB = $84DC; + {$EXTERNALSYM GL_TEXTURE28_ARB} + GL_TEXTURE29_ARB = $84DD; + {$EXTERNALSYM GL_TEXTURE29_ARB} + GL_TEXTURE30_ARB = $84DE; + {$EXTERNALSYM GL_TEXTURE30_ARB} + GL_TEXTURE31_ARB = $84DF; + {$EXTERNALSYM GL_TEXTURE31_ARB} + + // EXT_stencil_wrap + GL_INCR_WRAP_EXT = $8507; + {$EXTERNALSYM GL_INCR_WRAP_EXT} + GL_DECR_WRAP_EXT = $8508; + {$EXTERNALSYM GL_DECR_WRAP_EXT} + + // NV_texgen_reflection + GL_NORMAL_MAP_NV = $8511; + {$EXTERNALSYM GL_NORMAL_MAP_NV} + GL_REFLECTION_MAP_NV = $8512; + {$EXTERNALSYM GL_REFLECTION_MAP_NV} + + // EXT_texture_env_combine + GL_COMBINE_EXT = $8570; + {$EXTERNALSYM GL_COMBINE_EXT} + GL_COMBINE_RGB_EXT = $8571; + {$EXTERNALSYM GL_COMBINE_RGB_EXT} + GL_COMBINE_ALPHA_EXT = $8572; + {$EXTERNALSYM GL_COMBINE_ALPHA_EXT} + GL_RGB_SCALE_EXT = $8573; + {$EXTERNALSYM GL_RGB_SCALE_EXT} + GL_ADD_SIGNED_EXT = $8574; + {$EXTERNALSYM GL_ADD_SIGNED_EXT} + GL_INTERPOLATE_EXT = $8575; + {$EXTERNALSYM GL_INTERPOLATE_EXT} + GL_CONSTANT_EXT = $8576; + {$EXTERNALSYM GL_CONSTANT_EXT} + GL_PRIMARY_COLOR_EXT = $8577; + {$EXTERNALSYM GL_PRIMARY_COLOR_EXT} + GL_PREVIOUS_EXT = $8578; + {$EXTERNALSYM GL_PREVIOUS_EXT} + GL_SOURCE0_RGB_EXT = $8580; + {$EXTERNALSYM GL_SOURCE0_RGB_EXT} + GL_SOURCE1_RGB_EXT = $8581; + {$EXTERNALSYM GL_SOURCE1_RGB_EXT} + GL_SOURCE2_RGB_EXT = $8582; + {$EXTERNALSYM GL_SOURCE2_RGB_EXT} + GL_SOURCE0_ALPHA_EXT = $8588; + {$EXTERNALSYM GL_SOURCE0_ALPHA_EXT} + GL_SOURCE1_ALPHA_EXT = $8589; + {$EXTERNALSYM GL_SOURCE1_ALPHA_EXT} + GL_SOURCE2_ALPHA_EXT = $858A; + {$EXTERNALSYM GL_SOURCE2_ALPHA_EXT} + GL_OPERAND0_RGB_EXT = $8590; + {$EXTERNALSYM GL_OPERAND0_RGB_EXT} + GL_OPERAND1_RGB_EXT = $8591; + {$EXTERNALSYM GL_OPERAND1_RGB_EXT} + GL_OPERAND2_RGB_EXT = $8592; + {$EXTERNALSYM GL_OPERAND2_RGB_EXT} + GL_OPERAND0_ALPHA_EXT = $8598; + {$EXTERNALSYM GL_OPERAND0_ALPHA_EXT} + GL_OPERAND1_ALPHA_EXT = $8599; + {$EXTERNALSYM GL_OPERAND1_ALPHA_EXT} + GL_OPERAND2_ALPHA_EXT = $859A; + {$EXTERNALSYM GL_OPERAND2_ALPHA_EXT} + + // NV_texture_env_combine4 + GL_COMBINE4_NV = $8503; + {$EXTERNALSYM GL_COMBINE4_NV} + GL_SOURCE3_RGB_NV = $8583; + {$EXTERNALSYM GL_SOURCE3_RGB_NV} + GL_SOURCE3_ALPHA_NV = $858B; + {$EXTERNALSYM GL_SOURCE3_ALPHA_NV} + GL_OPERAND3_RGB_NV = $8593; + {$EXTERNALSYM GL_OPERAND3_RGB_NV} + GL_OPERAND3_ALPHA_NV = $859B; + {$EXTERNALSYM GL_OPERAND3_ALPHA_NV} + + GL_BLEND_EQUATION = $8009; + {$EXTERNALSYM GL_BLEND_EQUATION} + GL_TABLE_TOO_LARGE = $8031; + {$EXTERNALSYM GL_TABLE_TOO_LARGE} + GL_UNSIGNED_BYTE_3_3_2 = $8032; + {$EXTERNALSYM GL_UNSIGNED_BYTE_3_3_2} + GL_UNSIGNED_SHORT_4_4_4_4 = $8033; + {$EXTERNALSYM GL_UNSIGNED_SHORT_4_4_4_4} + GL_UNSIGNED_SHORT_5_5_5_1 = $8034; + {$EXTERNALSYM GL_UNSIGNED_SHORT_5_5_5_1} + GL_UNSIGNED_INT_8_8_8_8 = $8035; + {$EXTERNALSYM GL_UNSIGNED_INT_8_8_8_8} + GL_UNSIGNED_INT_10_10_10_2 = $8036; + {$EXTERNALSYM GL_UNSIGNED_INT_10_10_10_2} + GL_UNSIGNED_BYTE_2_3_3_REV = $8362; + {$EXTERNALSYM GL_UNSIGNED_BYTE_2_3_3_REV} + GL_UNSIGNED_SHORT_5_6_5 = $8363; + {$EXTERNALSYM GL_UNSIGNED_SHORT_5_6_5} + GL_UNSIGNED_SHORT_5_6_5_REV = $8364; + {$EXTERNALSYM GL_UNSIGNED_SHORT_5_6_5_REV} + GL_UNSIGNED_SHORT_4_4_4_4_REV = $8365; + {$EXTERNALSYM GL_UNSIGNED_SHORT_4_4_4_4_REV} + GL_UNSIGNED_SHORT_1_5_5_5_REV = $8366; + {$EXTERNALSYM GL_UNSIGNED_SHORT_1_5_5_5_REV} + GL_UNSIGNED_INT_8_8_8_8_REV = $8367; + {$EXTERNALSYM GL_UNSIGNED_INT_8_8_8_8_REV} + GL_UNSIGNED_INT_2_10_10_10_REV = $8368; + {$EXTERNALSYM GL_UNSIGNED_INT_2_10_10_10_REV} + + // GL_ARB_transpose_matrix + GL_TRANSPOSE_MODELVIEW_MATRIX_ARB = $84E3; + {$EXTERNALSYM GL_TRANSPOSE_MODELVIEW_MATRIX_ARB} + GL_TRANSPOSE_PROJECTION_MATRIX_ARB = $84E4; + {$EXTERNALSYM GL_TRANSPOSE_PROJECTION_MATRIX_ARB} + GL_TRANSPOSE_TEXTURE_MATRIX_ARB = $84E5; + {$EXTERNALSYM GL_TRANSPOSE_TEXTURE_MATRIX_ARB} + GL_TRANSPOSE_COLOR_MATRIX_ARB = $84E6; + {$EXTERNALSYM GL_TRANSPOSE_COLOR_MATRIX_ARB} + + // GL_ARB_multisample + GL_MULTISAMPLE_ARB = $809D; + {$EXTERNALSYM GL_MULTISAMPLE_ARB} + GL_SAMPLE_ALPHA_TO_COVERAGE_ARB = $809E; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_COVERAGE_ARB} + GL_SAMPLE_ALPHA_TO_ONE_ARB = $809F; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_ONE_ARB} + GL_SAMPLE_COVERAGE_ARB = $80A0; + {$EXTERNALSYM GL_SAMPLE_COVERAGE_ARB} + GL_SAMPLE_BUFFERS_ARB = $80A8; + {$EXTERNALSYM GL_SAMPLE_BUFFERS_ARB} + GL_SAMPLES_ARB = $80A9; + {$EXTERNALSYM GL_SAMPLES_ARB} + GL_SAMPLE_COVERAGE_VALUE_ARB = $80AA; + {$EXTERNALSYM GL_SAMPLE_COVERAGE_VALUE_ARB} + GL_SAMPLE_COVERAGE_INVERT_ARB = $80AB; + {$EXTERNALSYM GL_SAMPLE_COVERAGE_INVERT_ARB} + GL_MULTISAMPLE_BIT_ARB = $20000000; + {$EXTERNALSYM GL_MULTISAMPLE_BIT_ARB} + GLX_SAMPLE_BUFFERS_ARB = 100000; + {$EXTERNALSYM GLX_SAMPLE_BUFFERS_ARB} + GLX_SAMPLES_ARB = 100001; + {$EXTERNALSYM GLX_SAMPLES_ARB} + WGL_SAMPLE_BUFFERS_ARB = $2041; + {$EXTERNALSYM WGL_SAMPLE_BUFFERS_ARB} + WGL_SAMPLES_ARB = $2042; + {$EXTERNALSYM WGL_SAMPLES_ARB} + + // GL_ARB_texture_cube_map + GL_NORMAL_MAP_ARB = $8511; + {$EXTERNALSYM GL_NORMAL_MAP_ARB} + GL_REFLECTION_MAP_ARB = $8512; + {$EXTERNALSYM GL_REFLECTION_MAP_ARB} + GL_TEXTURE_CUBE_MAP_ARB = $8513; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_ARB} + GL_TEXTURE_BINDING_CUBE_MAP_ARB = $8514; + {$EXTERNALSYM GL_TEXTURE_BINDING_CUBE_MAP_ARB} + GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = $8515; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB} + GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = $8516; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB} + GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = $8517; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB} + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = $8518; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB} + GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = $8519; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB} + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = $851A; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB} + GL_PROXY_TEXTURE_CUBE_MAP_ARB = $851B; + {$EXTERNALSYM GL_PROXY_TEXTURE_CUBE_MAP_ARB} + GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB = $851C; + {$EXTERNALSYM GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB} + + // GL_ARB_texture_compression + GL_COMPRESSED_ALPHA_ARB = $84E9; + {$EXTERNALSYM GL_COMPRESSED_ALPHA_ARB} + GL_COMPRESSED_LUMINANCE_ARB = $84EA; + {$EXTERNALSYM GL_COMPRESSED_LUMINANCE_ARB} + GL_COMPRESSED_LUMINANCE_ALPHA_ARB = $84EB; + {$EXTERNALSYM GL_COMPRESSED_LUMINANCE_ALPHA_ARB} + GL_COMPRESSED_INTENSITY_ARB = $84EC; + {$EXTERNALSYM GL_COMPRESSED_INTENSITY_ARB} + GL_COMPRESSED_RGB_ARB = $84ED; + {$EXTERNALSYM GL_COMPRESSED_RGB_ARB} + GL_COMPRESSED_RGBA_ARB = $84EE; + {$EXTERNALSYM GL_COMPRESSED_RGBA_ARB} + GL_TEXTURE_COMPRESSION_HINT_ARB = $84EF; + {$EXTERNALSYM GL_TEXTURE_COMPRESSION_HINT_ARB} + GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB = $86A0; + {$EXTERNALSYM GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB} + GL_TEXTURE_COMPRESSED_ARB = $86A1; + {$EXTERNALSYM GL_TEXTURE_COMPRESSED_ARB} + GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB = $86A2; + {$EXTERNALSYM GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB} + GL_COMPRESSED_TEXTURE_FORMATS_ARB = $86A3; + {$EXTERNALSYM GL_COMPRESSED_TEXTURE_FORMATS_ARB} + + // GL_ARB_vertex_blend + GL_MAX_VERTEX_UNITS_ARB = $86A4; + {$EXTERNALSYM GL_MAX_VERTEX_UNITS_ARB} + GL_ACTIVE_VERTEX_UNITS_ARB = $86A5; + {$EXTERNALSYM GL_ACTIVE_VERTEX_UNITS_ARB} + GL_WEIGHT_SUM_UNITY_ARB = $86A6; + {$EXTERNALSYM GL_WEIGHT_SUM_UNITY_ARB} + GL_VERTEX_BLEND_ARB = $86A7; + {$EXTERNALSYM GL_VERTEX_BLEND_ARB} + GL_CURRENT_WEIGHT_ARB = $86A8; + {$EXTERNALSYM GL_CURRENT_WEIGHT_ARB} + GL_WEIGHT_ARRAY_TYPE_ARB = $86A9; + {$EXTERNALSYM GL_WEIGHT_ARRAY_TYPE_ARB} + GL_WEIGHT_ARRAY_STRIDE_ARB = $86AA; + {$EXTERNALSYM GL_WEIGHT_ARRAY_STRIDE_ARB} + GL_WEIGHT_ARRAY_SIZE_ARB = $86AB; + {$EXTERNALSYM GL_WEIGHT_ARRAY_SIZE_ARB} + GL_WEIGHT_ARRAY_POINTER_ARB = $86AC; + {$EXTERNALSYM GL_WEIGHT_ARRAY_POINTER_ARB} + GL_WEIGHT_ARRAY_ARB = $86AD; + {$EXTERNALSYM GL_WEIGHT_ARRAY_ARB} + GL_MODELVIEW0_ARB = $1700; + {$EXTERNALSYM GL_MODELVIEW0_ARB} + GL_MODELVIEW1_ARB = $850A; + {$EXTERNALSYM GL_MODELVIEW1_ARB} + GL_MODELVIEW2_ARB = $8722; + {$EXTERNALSYM GL_MODELVIEW2_ARB} + GL_MODELVIEW3_ARB = $8723; + {$EXTERNALSYM GL_MODELVIEW3_ARB} + GL_MODELVIEW4_ARB = $8724; + {$EXTERNALSYM GL_MODELVIEW4_ARB} + GL_MODELVIEW5_ARB = $8725; + {$EXTERNALSYM GL_MODELVIEW5_ARB} + GL_MODELVIEW6_ARB = $8726; + {$EXTERNALSYM GL_MODELVIEW6_ARB} + GL_MODELVIEW7_ARB = $8727; + {$EXTERNALSYM GL_MODELVIEW7_ARB} + GL_MODELVIEW8_ARB = $8728; + {$EXTERNALSYM GL_MODELVIEW8_ARB} + GL_MODELVIEW9_ARB = $8729; + {$EXTERNALSYM GL_MODELVIEW9_ARB} + GL_MODELVIEW10_ARB = $872A; + {$EXTERNALSYM GL_MODELVIEW10_ARB} + GL_MODELVIEW11_ARB = $872B; + {$EXTERNALSYM GL_MODELVIEW11_ARB} + GL_MODELVIEW12_ARB = $872C; + {$EXTERNALSYM GL_MODELVIEW12_ARB} + GL_MODELVIEW13_ARB = $872D; + {$EXTERNALSYM GL_MODELVIEW13_ARB} + GL_MODELVIEW14_ARB = $872E; + {$EXTERNALSYM GL_MODELVIEW14_ARB} + GL_MODELVIEW15_ARB = $872F; + {$EXTERNALSYM GL_MODELVIEW15_ARB} + GL_MODELVIEW16_ARB = $8730; + {$EXTERNALSYM GL_MODELVIEW16_ARB} + GL_MODELVIEW17_ARB = $8731; + {$EXTERNALSYM GL_MODELVIEW17_ARB} + GL_MODELVIEW18_ARB = $8732; + {$EXTERNALSYM GL_MODELVIEW18_ARB} + GL_MODELVIEW19_ARB = $8733; + {$EXTERNALSYM GL_MODELVIEW19_ARB} + GL_MODELVIEW20_ARB = $8734; + {$EXTERNALSYM GL_MODELVIEW20_ARB} + GL_MODELVIEW21_ARB = $8735; + {$EXTERNALSYM GL_MODELVIEW21_ARB} + GL_MODELVIEW22_ARB = $8736; + {$EXTERNALSYM GL_MODELVIEW22_ARB} + GL_MODELVIEW23_ARB = $8737; + {$EXTERNALSYM GL_MODELVIEW23_ARB} + GL_MODELVIEW24_ARB = $8738; + {$EXTERNALSYM GL_MODELVIEW24_ARB} + GL_MODELVIEW25_ARB = $8739; + {$EXTERNALSYM GL_MODELVIEW25_ARB} + GL_MODELVIEW26_ARB = $873A; + {$EXTERNALSYM GL_MODELVIEW26_ARB} + GL_MODELVIEW27_ARB = $873B; + {$EXTERNALSYM GL_MODELVIEW27_ARB} + GL_MODELVIEW28_ARB = $873C; + {$EXTERNALSYM GL_MODELVIEW28_ARB} + GL_MODELVIEW29_ARB = $873D; + {$EXTERNALSYM GL_MODELVIEW29_ARB} + GL_MODELVIEW30_ARB = $873E; + {$EXTERNALSYM GL_MODELVIEW30_ARB} + GL_MODELVIEW31_ARB = $873F; + {$EXTERNALSYM GL_MODELVIEW31_ARB} + + // GL_SGIS_texture_filter4 + GL_FILTER4_SGIS = $8146; + {$EXTERNALSYM GL_FILTER4_SGIS} + GL_TEXTURE_FILTER4_SIZE_SGIS = $8147; + {$EXTERNALSYM GL_TEXTURE_FILTER4_SIZE_SGIS} + + // GL_SGIS_pixel_texture + GL_PIXEL_TEXTURE_SGIS = $8353; + {$EXTERNALSYM GL_PIXEL_TEXTURE_SGIS} + GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS = $8354; + {$EXTERNALSYM GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS} + GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS = $8355; + {$EXTERNALSYM GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS} + GL_PIXEL_GROUP_COLOR_SGIS = $8356; + {$EXTERNALSYM GL_PIXEL_GROUP_COLOR_SGIS} + + // GL_SGIX_pixel_texture + GL_PIXEL_TEX_GEN_SGIX = $8139; + {$EXTERNALSYM GL_PIXEL_TEX_GEN_SGIX} + GL_PIXEL_TEX_GEN_MODE_SGIX = $832B; + {$EXTERNALSYM GL_PIXEL_TEX_GEN_MODE_SGIX} + + // GL_SGIS_texture4D + GL_PACK_SKIP_VOLUMES_SGIS = $8130; + {$EXTERNALSYM GL_PACK_SKIP_VOLUMES_SGIS} + GL_PACK_IMAGE_DEPTH_SGIS = $8131; + {$EXTERNALSYM GL_PACK_IMAGE_DEPTH_SGIS} + GL_UNPACK_SKIP_VOLUMES_SGIS = $8132; + {$EXTERNALSYM GL_UNPACK_SKIP_VOLUMES_SGIS} + GL_UNPACK_IMAGE_DEPTH_SGIS = $8133; + {$EXTERNALSYM GL_UNPACK_IMAGE_DEPTH_SGIS} + GL_TEXTURE_4D_SGIS = $8134; + {$EXTERNALSYM GL_TEXTURE_4D_SGIS} + GL_PROXY_TEXTURE_4D_SGIS = $8135; + {$EXTERNALSYM GL_PROXY_TEXTURE_4D_SGIS} + GL_TEXTURE_4DSIZE_SGIS = $8136; + {$EXTERNALSYM GL_TEXTURE_4DSIZE_SGIS} + GL_TEXTURE_WRAP_Q_SGIS = $8137; + {$EXTERNALSYM GL_TEXTURE_WRAP_Q_SGIS} + GL_MAX_4D_TEXTURE_SIZE_SGIS = $8138; + {$EXTERNALSYM GL_MAX_4D_TEXTURE_SIZE_SGIS} + GL_TEXTURE_4D_BINDING_SGIS = $814F; + {$EXTERNALSYM GL_TEXTURE_4D_BINDING_SGIS} + + // GL_SGIS_detail_texture + GL_DETAIL_TEXTURE_2D_SGIS = $8095; + {$EXTERNALSYM GL_DETAIL_TEXTURE_2D_SGIS} + GL_DETAIL_TEXTURE_2D_BINDING_SGIS = $8096; + {$EXTERNALSYM GL_DETAIL_TEXTURE_2D_BINDING_SGIS} + GL_LINEAR_DETAIL_SGIS = $8097; + {$EXTERNALSYM GL_LINEAR_DETAIL_SGIS} + GL_LINEAR_DETAIL_ALPHA_SGIS = $8098; + {$EXTERNALSYM GL_LINEAR_DETAIL_ALPHA_SGIS} + GL_LINEAR_DETAIL_COLOR_SGIS = $8099; + {$EXTERNALSYM GL_LINEAR_DETAIL_COLOR_SGIS} + GL_DETAIL_TEXTURE_LEVEL_SGIS = $809A; + {$EXTERNALSYM GL_DETAIL_TEXTURE_LEVEL_SGIS} + GL_DETAIL_TEXTURE_MODE_SGIS = $809B; + {$EXTERNALSYM GL_DETAIL_TEXTURE_MODE_SGIS} + GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS = $809C; + {$EXTERNALSYM GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS} + + // GL_SGIS_sharpen_texture + GL_LINEAR_SHARPEN_SGIS = $80AD; + {$EXTERNALSYM GL_LINEAR_SHARPEN_SGIS} + GL_LINEAR_SHARPEN_ALPHA_SGIS = $80AE; + {$EXTERNALSYM GL_LINEAR_SHARPEN_ALPHA_SGIS} + GL_LINEAR_SHARPEN_COLOR_SGIS = $80AF; + {$EXTERNALSYM GL_LINEAR_SHARPEN_COLOR_SGIS} + GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS = $80B0; + {$EXTERNALSYM GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS} + + // GL_SGIS_texture_lod + GL_TEXTURE_MIN_LOD_SGIS = $813A; + {$EXTERNALSYM GL_TEXTURE_MIN_LOD_SGIS} + GL_TEXTURE_MAX_LOD_SGIS = $813B; + {$EXTERNALSYM GL_TEXTURE_MAX_LOD_SGIS} + GL_TEXTURE_BASE_LEVEL_SGIS = $813C; + {$EXTERNALSYM GL_TEXTURE_BASE_LEVEL_SGIS} + GL_TEXTURE_MAX_LEVEL_SGIS = $813D; + {$EXTERNALSYM GL_TEXTURE_MAX_LEVEL_SGIS} + + // GL_SGIS_multisample + GL_MULTISAMPLE_SGIS = $809D; + {$EXTERNALSYM GL_MULTISAMPLE_SGIS} + GL_SAMPLE_ALPHA_TO_MASK_SGIS = $809E; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_MASK_SGIS} + GL_SAMPLE_ALPHA_TO_ONE_SGIS = $809F; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_ONE_SGIS} + GL_SAMPLE_MASK_SGIS = $80A0; + {$EXTERNALSYM GL_SAMPLE_MASK_SGIS} + GL_1PASS_SGIS = $80A1; + {$EXTERNALSYM GL_1PASS_SGIS} + GL_2PASS_0_SGIS = $80A2; + {$EXTERNALSYM GL_2PASS_0_SGIS} + GL_2PASS_1_SGIS = $80A3; + {$EXTERNALSYM GL_2PASS_1_SGIS} + GL_4PASS_0_SGIS = $80A4; + {$EXTERNALSYM GL_4PASS_0_SGIS} + GL_4PASS_1_SGIS = $80A5; + {$EXTERNALSYM GL_4PASS_1_SGIS} + GL_4PASS_2_SGIS = $80A6; + {$EXTERNALSYM GL_4PASS_2_SGIS} + GL_4PASS_3_SGIS = $80A7; + {$EXTERNALSYM GL_4PASS_3_SGIS} + GL_SAMPLE_BUFFERS_SGIS = $80A8; + {$EXTERNALSYM GL_SAMPLE_BUFFERS_SGIS} + GL_SAMPLES_SGIS = $80A9; + {$EXTERNALSYM GL_SAMPLES_SGIS} + GL_SAMPLE_MASK_VALUE_SGIS = $80AA; + {$EXTERNALSYM GL_SAMPLE_MASK_VALUE_SGIS} + GL_SAMPLE_MASK_INVERT_SGIS = $80AB; + {$EXTERNALSYM GL_SAMPLE_MASK_INVERT_SGIS} + GL_SAMPLE_PATTERN_SGIS = $80AC; + {$EXTERNALSYM GL_SAMPLE_PATTERN_SGIS} + + // GL_SGIS_generate_mipmap + GL_GENERATE_MIPMAP_SGIS = $8191; + {$EXTERNALSYM GL_GENERATE_MIPMAP_SGIS} + GL_GENERATE_MIPMAP_HINT_SGIS = $8192; + {$EXTERNALSYM GL_GENERATE_MIPMAP_HINT_SGIS} + + // GL_SGIX_clipmap + GL_LINEAR_CLIPMAP_LINEAR_SGIX = $8170; + {$EXTERNALSYM GL_LINEAR_CLIPMAP_LINEAR_SGIX} + GL_TEXTURE_CLIPMAP_CENTER_SGIX = $8171; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_CENTER_SGIX} + GL_TEXTURE_CLIPMAP_FRAME_SGIX = $8172; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_FRAME_SGIX} + GL_TEXTURE_CLIPMAP_OFFSET_SGIX = $8173; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_OFFSET_SGIX} + GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX = $8174; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX} + GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX = $8175; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX} + GL_TEXTURE_CLIPMAP_DEPTH_SGIX = $8176; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_DEPTH_SGIX} + GL_MAX_CLIPMAP_DEPTH_SGIX = $8177; + {$EXTERNALSYM GL_MAX_CLIPMAP_DEPTH_SGIX} + GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX = $8178; + {$EXTERNALSYM GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX} + GL_NEAREST_CLIPMAP_NEAREST_SGIX = $844D; + {$EXTERNALSYM GL_NEAREST_CLIPMAP_NEAREST_SGIX} + GL_NEAREST_CLIPMAP_LINEAR_SGIX = $844E; + {$EXTERNALSYM GL_NEAREST_CLIPMAP_LINEAR_SGIX} + GL_LINEAR_CLIPMAP_NEAREST_SGIX = $844F; + {$EXTERNALSYM GL_LINEAR_CLIPMAP_NEAREST_SGIX} + + // GL_SGIX_shadow + GL_TEXTURE_COMPARE_SGIX = $819A; + {$EXTERNALSYM GL_TEXTURE_COMPARE_SGIX} + GL_TEXTURE_COMPARE_OPERATOR_SGIX = $819B; + {$EXTERNALSYM GL_TEXTURE_COMPARE_OPERATOR_SGIX} + GL_TEXTURE_LEQUAL_R_SGIX = $819C; + {$EXTERNALSYM GL_TEXTURE_LEQUAL_R_SGIX} + GL_TEXTURE_GEQUAL_R_SGIX = $819D; + {$EXTERNALSYM GL_TEXTURE_GEQUAL_R_SGIX} + + // GL_SGIS_texture_edge_clamp + GL_CLAMP_TO_EDGE_SGIS = $812F; + {$EXTERNALSYM GL_CLAMP_TO_EDGE_SGIS} + + // GL_SGIS_texture_border_clamp + GL_CLAMP_TO_BORDER_SGIS = $812D; + {$EXTERNALSYM GL_CLAMP_TO_BORDER_SGIS} + + // GL_SGIX_interlace + GL_INTERLACE_SGIX = $8094; + {$EXTERNALSYM GL_INTERLACE_SGIX} + + // GL_SGIX_pixel_tiles + GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX = $813E; + {$EXTERNALSYM GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX} + GL_PIXEL_TILE_CACHE_INCREMENT_SGIX = $813F; + {$EXTERNALSYM GL_PIXEL_TILE_CACHE_INCREMENT_SGIX} + GL_PIXEL_TILE_WIDTH_SGIX = $8140; + {$EXTERNALSYM GL_PIXEL_TILE_WIDTH_SGIX} + GL_PIXEL_TILE_HEIGHT_SGIX = $8141; + {$EXTERNALSYM GL_PIXEL_TILE_HEIGHT_SGIX} + GL_PIXEL_TILE_GRID_WIDTH_SGIX = $8142; + {$EXTERNALSYM GL_PIXEL_TILE_GRID_WIDTH_SGIX} + GL_PIXEL_TILE_GRID_HEIGHT_SGIX = $8143; + {$EXTERNALSYM GL_PIXEL_TILE_GRID_HEIGHT_SGIX} + GL_PIXEL_TILE_GRID_DEPTH_SGIX = $8144; + {$EXTERNALSYM GL_PIXEL_TILE_GRID_DEPTH_SGIX} + GL_PIXEL_TILE_CACHE_SIZE_SGIX = $8145; + {$EXTERNALSYM GL_PIXEL_TILE_CACHE_SIZE_SGIX} + + // GL_SGIS_texture_select + GL_DUAL_ALPHA4_SGIS = $8110; + {$EXTERNALSYM GL_DUAL_ALPHA4_SGIS} + GL_DUAL_ALPHA8_SGIS = $8111; + {$EXTERNALSYM GL_DUAL_ALPHA8_SGIS} + GL_DUAL_ALPHA12_SGIS = $8112; + {$EXTERNALSYM GL_DUAL_ALPHA12_SGIS} + GL_DUAL_ALPHA16_SGIS = $8113; + {$EXTERNALSYM GL_DUAL_ALPHA16_SGIS} + GL_DUAL_LUMINANCE4_SGIS = $8114; + {$EXTERNALSYM GL_DUAL_LUMINANCE4_SGIS} + GL_DUAL_LUMINANCE8_SGIS = $8115; + {$EXTERNALSYM GL_DUAL_LUMINANCE8_SGIS} + GL_DUAL_LUMINANCE12_SGIS = $8116; + {$EXTERNALSYM GL_DUAL_LUMINANCE12_SGIS} + GL_DUAL_LUMINANCE16_SGIS = $8117; + {$EXTERNALSYM GL_DUAL_LUMINANCE16_SGIS} + GL_DUAL_INTENSITY4_SGIS = $8118; + {$EXTERNALSYM GL_DUAL_INTENSITY4_SGIS} + GL_DUAL_INTENSITY8_SGIS = $8119; + {$EXTERNALSYM GL_DUAL_INTENSITY8_SGIS} + GL_DUAL_INTENSITY12_SGIS = $811A; + {$EXTERNALSYM GL_DUAL_INTENSITY12_SGIS} + GL_DUAL_INTENSITY16_SGIS = $811B; + {$EXTERNALSYM GL_DUAL_INTENSITY16_SGIS} + GL_DUAL_LUMINANCE_ALPHA4_SGIS = $811C; + {$EXTERNALSYM GL_DUAL_LUMINANCE_ALPHA4_SGIS} + GL_DUAL_LUMINANCE_ALPHA8_SGIS = $811D; + {$EXTERNALSYM GL_DUAL_LUMINANCE_ALPHA8_SGIS} + GL_QUAD_ALPHA4_SGIS = $811E; + {$EXTERNALSYM GL_QUAD_ALPHA4_SGIS} + GL_QUAD_ALPHA8_SGIS = $811F; + {$EXTERNALSYM GL_QUAD_ALPHA8_SGIS} + GL_QUAD_LUMINANCE4_SGIS = $8120; + {$EXTERNALSYM GL_QUAD_LUMINANCE4_SGIS} + GL_QUAD_LUMINANCE8_SGIS = $8121; + {$EXTERNALSYM GL_QUAD_LUMINANCE8_SGIS} + GL_QUAD_INTENSITY4_SGIS = $8122; + {$EXTERNALSYM GL_QUAD_INTENSITY4_SGIS} + GL_QUAD_INTENSITY8_SGIS = $8123; + {$EXTERNALSYM GL_QUAD_INTENSITY8_SGIS} + GL_DUAL_TEXTURE_SELECT_SGIS = $8124; + {$EXTERNALSYM GL_DUAL_TEXTURE_SELECT_SGIS} + GL_QUAD_TEXTURE_SELECT_SGIS = $8125; + {$EXTERNALSYM GL_QUAD_TEXTURE_SELECT_SGIS} + + // GL_SGIX_sprite + GL_SPRITE_SGIX = $8148; + {$EXTERNALSYM GL_SPRITE_SGIX} + GL_SPRITE_MODE_SGIX = $8149; + {$EXTERNALSYM GL_SPRITE_MODE_SGIX} + GL_SPRITE_AXIS_SGIX = $814A; + {$EXTERNALSYM GL_SPRITE_AXIS_SGIX} + GL_SPRITE_TRANSLATION_SGIX = $814B; + {$EXTERNALSYM GL_SPRITE_TRANSLATION_SGIX} + GL_SPRITE_AXIAL_SGIX = $814C; + {$EXTERNALSYM GL_SPRITE_AXIAL_SGIX} + GL_SPRITE_OBJECT_ALIGNED_SGIX = $814D; + {$EXTERNALSYM GL_SPRITE_OBJECT_ALIGNED_SGIX} + GL_SPRITE_EYE_ALIGNED_SGIX = $814E; + {$EXTERNALSYM GL_SPRITE_EYE_ALIGNED_SGIX} + + // GL_SGIX_texture_multi_buffer + GL_TEXTURE_MULTI_BUFFER_HINT_SGIX = $812E; + {$EXTERNALSYM GL_TEXTURE_MULTI_BUFFER_HINT_SGIX} + + // GL_SGIS_point_parameters + GL_POINT_SIZE_MIN_SGIS = $8126; + {$EXTERNALSYM GL_POINT_SIZE_MIN_SGIS} + GL_POINT_SIZE_MAX_SGIS = $8127; + {$EXTERNALSYM GL_POINT_SIZE_MAX_SGIS} + GL_POINT_FADE_THRESHOLD_SIZE_SGIS = $8128; + {$EXTERNALSYM GL_POINT_FADE_THRESHOLD_SIZE_SGIS} + GL_DISTANCE_ATTENUATION_SGIS = $8129; + {$EXTERNALSYM GL_DISTANCE_ATTENUATION_SGIS} + + // GL_SGIX_instruments + GL_INSTRUMENT_BUFFER_POINTER_SGIX = $8180; + {$EXTERNALSYM GL_INSTRUMENT_BUFFER_POINTER_SGIX} + GL_INSTRUMENT_MEASUREMENTS_SGIX = $8181; + {$EXTERNALSYM GL_INSTRUMENT_MEASUREMENTS_SGIX} + + // GL_SGIX_texture_scale_bias + GL_POST_TEXTURE_FILTER_BIAS_SGIX = $8179; + {$EXTERNALSYM GL_POST_TEXTURE_FILTER_BIAS_SGIX} + GL_POST_TEXTURE_FILTER_SCALE_SGIX = $817A; + {$EXTERNALSYM GL_POST_TEXTURE_FILTER_SCALE_SGIX} + GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX = $817B; + {$EXTERNALSYM GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX} + GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX = $817C; + {$EXTERNALSYM GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX} + + // GL_SGIX_framezoom + GL_FRAMEZOOM_SGIX = $818B; + {$EXTERNALSYM GL_FRAMEZOOM_SGIX} + GL_FRAMEZOOM_FACTOR_SGIX = $818C; + {$EXTERNALSYM GL_FRAMEZOOM_FACTOR_SGIX} + GL_MAX_FRAMEZOOM_FACTOR_SGIX = $818D; + {$EXTERNALSYM GL_MAX_FRAMEZOOM_FACTOR_SGIX} + + // GL_FfdMaskSGIX + GL_TEXTURE_DEFORMATION_BIT_SGIX = $00000001; + {$EXTERNALSYM GL_TEXTURE_DEFORMATION_BIT_SGIX} + GL_GEOMETRY_DEFORMATION_BIT_SGIX = $00000002; + {$EXTERNALSYM GL_GEOMETRY_DEFORMATION_BIT_SGIX} + + // GL_SGIX_polynomial_ffd + GL_GEOMETRY_DEFORMATION_SGIX = $8194; + {$EXTERNALSYM GL_GEOMETRY_DEFORMATION_SGIX} + GL_TEXTURE_DEFORMATION_SGIX = $8195; + {$EXTERNALSYM GL_TEXTURE_DEFORMATION_SGIX} + GL_DEFORMATIONS_MASK_SGIX = $8196; + {$EXTERNALSYM GL_DEFORMATIONS_MASK_SGIX} + GL_MAX_DEFORMATION_ORDER_SGIX = $8197; + {$EXTERNALSYM GL_MAX_DEFORMATION_ORDER_SGIX} + + // GL_SGIX_reference_plane + GL_REFERENCE_PLANE_SGIX = $817D; + {$EXTERNALSYM GL_REFERENCE_PLANE_SGIX} + GL_REFERENCE_PLANE_EQUATION_SGIX = $817E; + {$EXTERNALSYM GL_REFERENCE_PLANE_EQUATION_SGIX} + + // GL_SGIX_depth_texture + GL_DEPTH_COMPONENT16_SGIX = $81A5; + {$EXTERNALSYM GL_DEPTH_COMPONENT16_SGIX} + GL_DEPTH_COMPONENT24_SGIX = $81A6; + {$EXTERNALSYM GL_DEPTH_COMPONENT24_SGIX} + GL_DEPTH_COMPONENT32_SGIX = $81A7; + {$EXTERNALSYM GL_DEPTH_COMPONENT32_SGIX} + + // GL_SGIS_fog_function + GL_FOG_FUNC_SGIS = $812A; + {$EXTERNALSYM GL_FOG_FUNC_SGIS} + GL_FOG_FUNC_POINTS_SGIS = $812B; + {$EXTERNALSYM GL_FOG_FUNC_POINTS_SGIS} + GL_MAX_FOG_FUNC_POINTS_SGIS = $812C; + {$EXTERNALSYM GL_MAX_FOG_FUNC_POINTS_SGIS} + + // GL_SGIX_fog_offset + GL_FOG_OFFSET_SGIX = $8198; + {$EXTERNALSYM GL_FOG_OFFSET_SGIX} + GL_FOG_OFFSET_VALUE_SGIX = $8199; + {$EXTERNALSYM GL_FOG_OFFSET_VALUE_SGIX} + + // GL_HP_image_transform + GL_IMAGE_SCALE_X_HP = $8155; + {$EXTERNALSYM GL_IMAGE_SCALE_X_HP} + GL_IMAGE_SCALE_Y_HP = $8156; + {$EXTERNALSYM GL_IMAGE_SCALE_Y_HP} + GL_IMAGE_TRANSLATE_X_HP = $8157; + {$EXTERNALSYM GL_IMAGE_TRANSLATE_X_HP} + GL_IMAGE_TRANSLATE_Y_HP = $8158; + {$EXTERNALSYM GL_IMAGE_TRANSLATE_Y_HP} + GL_IMAGE_ROTATE_ANGLE_HP = $8159; + {$EXTERNALSYM GL_IMAGE_ROTATE_ANGLE_HP} + GL_IMAGE_ROTATE_ORIGIN_X_HP = $815A; + {$EXTERNALSYM GL_IMAGE_ROTATE_ORIGIN_X_HP} + GL_IMAGE_ROTATE_ORIGIN_Y_HP = $815B; + {$EXTERNALSYM GL_IMAGE_ROTATE_ORIGIN_Y_HP} + GL_IMAGE_MAG_FILTER_HP = $815C; + {$EXTERNALSYM GL_IMAGE_MAG_FILTER_HP} + GL_IMAGE_MIN_FILTER_HP = $815D; + {$EXTERNALSYM GL_IMAGE_MIN_FILTER_HP} + GL_IMAGE_CUBIC_WEIGHT_HP = $815E; + {$EXTERNALSYM GL_IMAGE_CUBIC_WEIGHT_HP} + GL_CUBIC_HP = $815F; + {$EXTERNALSYM GL_CUBIC_HP} + GL_AVERAGE_HP = $8160; + {$EXTERNALSYM GL_AVERAGE_HP} + GL_IMAGE_TRANSFORM_2D_HP = $8161; + {$EXTERNALSYM GL_IMAGE_TRANSFORM_2D_HP} + GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP = $8162; + {$EXTERNALSYM GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP} + GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP = $8163; + {$EXTERNALSYM GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP} + + // GL_HP_convolution_border_modes + GL_IGNORE_BORDER_HP = $8150; + {$EXTERNALSYM GL_IGNORE_BORDER_HP} + GL_CONSTANT_BORDER_HP = $8151; + {$EXTERNALSYM GL_CONSTANT_BORDER_HP} + GL_REPLICATE_BORDER_HP = $8153; + {$EXTERNALSYM GL_REPLICATE_BORDER_HP} + GL_CONVOLUTION_BORDER_COLOR_HP = $8154; + {$EXTERNALSYM GL_CONVOLUTION_BORDER_COLOR_HP} + + // GL_SGIX_texture_add_env + GL_TEXTURE_ENV_BIAS_SGIX = $80BE; + {$EXTERNALSYM GL_TEXTURE_ENV_BIAS_SGIX} + + // GL_PGI_vertex_hints + GL_VERTEX_DATA_HINT_PGI = $1A22A; + {$EXTERNALSYM GL_VERTEX_DATA_HINT_PGI} + GL_VERTEX_CONSISTENT_HINT_PGI = $1A22B; + {$EXTERNALSYM GL_VERTEX_CONSISTENT_HINT_PGI} + GL_MATERIAL_SIDE_HINT_PGI = $1A22C; + {$EXTERNALSYM GL_MATERIAL_SIDE_HINT_PGI} + GL_MAX_VERTEX_HINT_PGI = $1A22D; + {$EXTERNALSYM GL_MAX_VERTEX_HINT_PGI} + GL_COLOR3_BIT_PGI = $00010000; + {$EXTERNALSYM GL_COLOR3_BIT_PGI} + GL_COLOR4_BIT_PGI = $00020000; + {$EXTERNALSYM GL_COLOR4_BIT_PGI} + GL_EDGEFLAG_BIT_PGI = $00040000; + {$EXTERNALSYM GL_EDGEFLAG_BIT_PGI} + GL_INDEX_BIT_PGI = $00080000; + {$EXTERNALSYM GL_INDEX_BIT_PGI} + GL_MAT_AMBIENT_BIT_PGI = $00100000; + {$EXTERNALSYM GL_MAT_AMBIENT_BIT_PGI} + GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI = $00200000; + {$EXTERNALSYM GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI} + GL_MAT_DIFFUSE_BIT_PGI = $00400000; + {$EXTERNALSYM GL_MAT_DIFFUSE_BIT_PGI} + GL_MAT_EMISSION_BIT_PGI = $00800000; + {$EXTERNALSYM GL_MAT_EMISSION_BIT_PGI} + GL_MAT_COLOR_INDEXES_BIT_PGI = $01000000; + {$EXTERNALSYM GL_MAT_COLOR_INDEXES_BIT_PGI} + GL_MAT_SHININESS_BIT_PGI = $02000000; + {$EXTERNALSYM GL_MAT_SHININESS_BIT_PGI} + GL_MAT_SPECULAR_BIT_PGI = $04000000; + {$EXTERNALSYM GL_MAT_SPECULAR_BIT_PGI} + GL_NORMAL_BIT_PGI = $08000000; + {$EXTERNALSYM GL_NORMAL_BIT_PGI} + GL_TEXCOORD1_BIT_PGI = $10000000; + {$EXTERNALSYM GL_TEXCOORD1_BIT_PGI} + GL_TEXCOORD2_BIT_PGI = $20000000; + {$EXTERNALSYM GL_TEXCOORD2_BIT_PGI} + GL_TEXCOORD3_BIT_PGI = $40000000; + {$EXTERNALSYM GL_TEXCOORD3_BIT_PGI} + GL_TEXCOORD4_BIT_PGI = $80000000; + {$EXTERNALSYM GL_TEXCOORD4_BIT_PGI} + GL_VERTEX23_BIT_PGI = $00000004; + {$EXTERNALSYM GL_VERTEX23_BIT_PGI} + GL_VERTEX4_BIT_PGI = $00000008; + {$EXTERNALSYM GL_VERTEX4_BIT_PGI} + + // GL_PGI_misc_hints + GL_PREFER_DOUBLEBUFFER_HINT_PGI = $1A1F8; + {$EXTERNALSYM GL_PREFER_DOUBLEBUFFER_HINT_PGI} + GL_CONSERVE_MEMORY_HINT_PGI = $1A1FD; + {$EXTERNALSYM GL_CONSERVE_MEMORY_HINT_PGI} + GL_RECLAIM_MEMORY_HINT_PGI = $1A1FE; + {$EXTERNALSYM GL_RECLAIM_MEMORY_HINT_PGI} + GL_NATIVE_GRAPHICS_HANDLE_PGI = $1A202; + {$EXTERNALSYM GL_NATIVE_GRAPHICS_HANDLE_PGI} + GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI = $1A203; + {$EXTERNALSYM GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI} + GL_NATIVE_GRAPHICS_END_HINT_PGI = $1A204; + {$EXTERNALSYM GL_NATIVE_GRAPHICS_END_HINT_PGI} + GL_ALWAYS_FAST_HINT_PGI = $1A20C; + {$EXTERNALSYM GL_ALWAYS_FAST_HINT_PGI} + GL_ALWAYS_SOFT_HINT_PGI = $1A20D; + {$EXTERNALSYM GL_ALWAYS_SOFT_HINT_PGI} + GL_ALLOW_DRAW_OBJ_HINT_PGI = $1A20E; + {$EXTERNALSYM GL_ALLOW_DRAW_OBJ_HINT_PGI} + GL_ALLOW_DRAW_WIN_HINT_PGI = $1A20F; + {$EXTERNALSYM GL_ALLOW_DRAW_WIN_HINT_PGI} + GL_ALLOW_DRAW_FRG_HINT_PGI = $1A210; + {$EXTERNALSYM GL_ALLOW_DRAW_FRG_HINT_PGI} + GL_ALLOW_DRAW_MEM_HINT_PGI = $1A211; + {$EXTERNALSYM GL_ALLOW_DRAW_MEM_HINT_PGI} + GL_STRICT_DEPTHFUNC_HINT_PGI = $1A216; + {$EXTERNALSYM GL_STRICT_DEPTHFUNC_HINT_PGI} + GL_STRICT_LIGHTING_HINT_PGI = $1A217; + {$EXTERNALSYM GL_STRICT_LIGHTING_HINT_PGI} + GL_STRICT_SCISSOR_HINT_PGI = $1A218; + {$EXTERNALSYM GL_STRICT_SCISSOR_HINT_PGI} + GL_FULL_STIPPLE_HINT_PGI = $1A219; + {$EXTERNALSYM GL_FULL_STIPPLE_HINT_PGI} + GL_CLIP_NEAR_HINT_PGI = $1A220; + {$EXTERNALSYM GL_CLIP_NEAR_HINT_PGI} + GL_CLIP_FAR_HINT_PGI = $1A221; + {$EXTERNALSYM GL_CLIP_FAR_HINT_PGI} + GL_WIDE_LINE_HINT_PGI = $1A222; + {$EXTERNALSYM GL_WIDE_LINE_HINT_PGI} + GL_BACK_NORMALS_HINT_PGI = $1A223; + {$EXTERNALSYM GL_BACK_NORMALS_HINT_PGI} + + // GL_EXT_paletted_texture + GL_TEXTURE_INDEX_SIZE_EXT = $80ED; + {$EXTERNALSYM GL_TEXTURE_INDEX_SIZE_EXT} + + // GL_SGIX_list_priority + GL_LIST_PRIORITY_SGIX = $8182; + {$EXTERNALSYM GL_LIST_PRIORITY_SGIX} + + // GL_SGIX_ir_instrument1 + GL_IR_INSTRUMENT1_SGIX = $817F; + {$EXTERNALSYM GL_IR_INSTRUMENT1_SGIX} + + // GL_SGIX_calligraphic_fragment + GL_CALLIGRAPHIC_FRAGMENT_SGIX = $8183; + {$EXTERNALSYM GL_CALLIGRAPHIC_FRAGMENT_SGIX} + + // GL_SGIX_texture_lod_bias + GL_TEXTURE_LOD_BIAS_S_SGIX = $818E; + {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_S_SGIX} + GL_TEXTURE_LOD_BIAS_T_SGIX = $818F; + {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_T_SGIX} + GL_TEXTURE_LOD_BIAS_R_SGIX = $8190; + {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_R_SGIX} + + // GL_SGIX_shadow_ambient + GL_SHADOW_AMBIENT_SGIX = $80BF; + {$EXTERNALSYM GL_SHADOW_AMBIENT_SGIX} + + // GL_SGIX_ycrcb + GL_YCRCB_422_SGIX = $81BB; + {$EXTERNALSYM GL_YCRCB_422_SGIX} + GL_YCRCB_444_SGIX = $81BC; + {$EXTERNALSYM GL_YCRCB_444_SGIX} + + // GL_SGIX_fragment_lighting + GL_FRAGMENT_LIGHTING_SGIX = $8400; + {$EXTERNALSYM GL_FRAGMENT_LIGHTING_SGIX} + GL_FRAGMENT_COLOR_MATERIAL_SGIX = $8401; + {$EXTERNALSYM GL_FRAGMENT_COLOR_MATERIAL_SGIX} + GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX = $8402; + {$EXTERNALSYM GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX} + GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX = $8403; + {$EXTERNALSYM GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX} + GL_MAX_FRAGMENT_LIGHTS_SGIX = $8404; + {$EXTERNALSYM GL_MAX_FRAGMENT_LIGHTS_SGIX} + GL_MAX_ACTIVE_LIGHTS_SGIX = $8405; + {$EXTERNALSYM GL_MAX_ACTIVE_LIGHTS_SGIX} + GL_CURRENT_RASTER_NORMAL_SGIX = $8406; + {$EXTERNALSYM GL_CURRENT_RASTER_NORMAL_SGIX} + GL_LIGHT_ENV_MODE_SGIX = $8407; + {$EXTERNALSYM GL_LIGHT_ENV_MODE_SGIX} + GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX = $8408; + {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX} + GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX = $8409; + {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX} + GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX = $840A; + {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX} + GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX = $840B; + {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX} + GL_FRAGMENT_LIGHT0_SGIX = $840C; + {$EXTERNALSYM GL_FRAGMENT_LIGHT0_SGIX} + GL_FRAGMENT_LIGHT1_SGIX = $840D; + {$EXTERNALSYM GL_FRAGMENT_LIGHT1_SGIX} + GL_FRAGMENT_LIGHT2_SGIX = $840E; + {$EXTERNALSYM GL_FRAGMENT_LIGHT2_SGIX} + GL_FRAGMENT_LIGHT3_SGIX = $840F; + {$EXTERNALSYM GL_FRAGMENT_LIGHT3_SGIX} + GL_FRAGMENT_LIGHT4_SGIX = $8410; + {$EXTERNALSYM GL_FRAGMENT_LIGHT4_SGIX} + GL_FRAGMENT_LIGHT5_SGIX = $8411; + {$EXTERNALSYM GL_FRAGMENT_LIGHT5_SGIX} + GL_FRAGMENT_LIGHT6_SGIX = $8412; + {$EXTERNALSYM GL_FRAGMENT_LIGHT6_SGIX} + GL_FRAGMENT_LIGHT7_SGIX = $8413; + {$EXTERNALSYM GL_FRAGMENT_LIGHT7_SGIX} + + // GL_IBM_rasterpos_clip + GL_RASTER_POSITION_UNCLIPPED_IBM = $19262; + {$EXTERNALSYM GL_RASTER_POSITION_UNCLIPPED_IBM} + + // GL_HP_texture_lighting + GL_TEXTURE_LIGHTING_MODE_HP = $8167; + {$EXTERNALSYM GL_TEXTURE_LIGHTING_MODE_HP} + GL_TEXTURE_POST_SPECULAR_HP = $8168; + {$EXTERNALSYM GL_TEXTURE_POST_SPECULAR_HP} + GL_TEXTURE_PRE_SPECULAR_HP = $8169; + {$EXTERNALSYM GL_TEXTURE_PRE_SPECULAR_HP} + + // GL_EXT_draw_range_elements + GL_MAX_ELEMENTS_VERTICES_EXT = $80E8; + {$EXTERNALSYM GL_MAX_ELEMENTS_VERTICES_EXT} + GL_MAX_ELEMENTS_INDICES_EXT = $80E9; + {$EXTERNALSYM GL_MAX_ELEMENTS_INDICES_EXT} + + // GL_WIN_phong_shading + GL_PHONG_WIN = $80EA; + {$EXTERNALSYM GL_PHONG_WIN} + GL_PHONG_HINT_WIN = $80EB; + {$EXTERNALSYM GL_PHONG_HINT_WIN} + + // GL_WIN_specular_fog + GL_FOG_SPECULAR_TEXTURE_WIN = $80EC; + {$EXTERNALSYM GL_FOG_SPECULAR_TEXTURE_WIN} + + // GL_EXT_light_texture + GL_FRAGMENT_MATERIAL_EXT = $8349; + {$EXTERNALSYM GL_FRAGMENT_MATERIAL_EXT} + GL_FRAGMENT_NORMAL_EXT = $834A; + {$EXTERNALSYM GL_FRAGMENT_NORMAL_EXT} + GL_FRAGMENT_COLOR_EXT = $834C; + {$EXTERNALSYM GL_FRAGMENT_COLOR_EXT} + GL_ATTENUATION_EXT = $834D; + {$EXTERNALSYM GL_ATTENUATION_EXT} + GL_SHADOW_ATTENUATION_EXT = $834E; + {$EXTERNALSYM GL_SHADOW_ATTENUATION_EXT} + GL_TEXTURE_APPLICATION_MODE_EXT = $834F; + {$EXTERNALSYM GL_TEXTURE_APPLICATION_MODE_EXT} + GL_TEXTURE_LIGHT_EXT = $8350; + {$EXTERNALSYM GL_TEXTURE_LIGHT_EXT} + GL_TEXTURE_MATERIAL_FACE_EXT = $8351; + {$EXTERNALSYM GL_TEXTURE_MATERIAL_FACE_EXT} + GL_TEXTURE_MATERIAL_PARAMETER_EXT = $8352; + {$EXTERNALSYM GL_TEXTURE_MATERIAL_PARAMETER_EXT} + + // GL_SGIX_blend_alpha_minmax + GL_ALPHA_MIN_SGIX = $8320; + {$EXTERNALSYM GL_ALPHA_MIN_SGIX} + GL_ALPHA_MAX_SGIX = $8321; + {$EXTERNALSYM GL_ALPHA_MAX_SGIX} + + // GL_SGIX_async + GL_ASYNC_MARKER_SGIX = $8329; + {$EXTERNALSYM GL_ASYNC_MARKER_SGIX} + + // GL_SGIX_async_pixel + GL_ASYNC_TEX_IMAGE_SGIX = $835C; + {$EXTERNALSYM GL_ASYNC_TEX_IMAGE_SGIX} + GL_ASYNC_DRAW_PIXELS_SGIX = $835D; + {$EXTERNALSYM GL_ASYNC_DRAW_PIXELS_SGIX} + GL_ASYNC_READ_PIXELS_SGIX = $835E; + {$EXTERNALSYM GL_ASYNC_READ_PIXELS_SGIX} + GL_MAX_ASYNC_TEX_IMAGE_SGIX = $835F; + {$EXTERNALSYM GL_MAX_ASYNC_TEX_IMAGE_SGIX} + GL_MAX_ASYNC_DRAW_PIXELS_SGIX = $8360; + {$EXTERNALSYM GL_MAX_ASYNC_DRAW_PIXELS_SGIX} + GL_MAX_ASYNC_READ_PIXELS_SGIX = $8361; + {$EXTERNALSYM GL_MAX_ASYNC_READ_PIXELS_SGIX} + + // GL_SGIX_async_histogram + GL_ASYNC_HISTOGRAM_SGIX = $832C; + {$EXTERNALSYM GL_ASYNC_HISTOGRAM_SGIX} + GL_MAX_ASYNC_HISTOGRAM_SGIX = $832D; + {$EXTERNALSYM GL_MAX_ASYNC_HISTOGRAM_SGIX} + + // GL_INTEL_parallel_arrays + GL_PARALLEL_ARRAYS_INTEL = $83F4; + {$EXTERNALSYM GL_PARALLEL_ARRAYS_INTEL} + GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL = $83F5; + {$EXTERNALSYM GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL} + GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL = $83F6; + {$EXTERNALSYM GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL} + GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL = $83F7; + {$EXTERNALSYM GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL} + GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL = $83F8; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL} + + // GL_HP_occlusion_test + GL_OCCLUSION_TEST_HP = $8165; + {$EXTERNALSYM GL_OCCLUSION_TEST_HP} + GL_OCCLUSION_TEST_RESULT_HP = $8166; + {$EXTERNALSYM GL_OCCLUSION_TEST_RESULT_HP} + + // GL_EXT_pixel_transform + GL_PIXEL_TRANSFORM_2D_EXT = $8330; + {$EXTERNALSYM GL_PIXEL_TRANSFORM_2D_EXT} + GL_PIXEL_MAG_FILTER_EXT = $8331; + {$EXTERNALSYM GL_PIXEL_MAG_FILTER_EXT} + GL_PIXEL_MIN_FILTER_EXT = $8332; + {$EXTERNALSYM GL_PIXEL_MIN_FILTER_EXT} + GL_PIXEL_CUBIC_WEIGHT_EXT = $8333; + {$EXTERNALSYM GL_PIXEL_CUBIC_WEIGHT_EXT} + GL_CUBIC_EXT = $8334; + {$EXTERNALSYM GL_CUBIC_EXT} + GL_AVERAGE_EXT = $8335; + {$EXTERNALSYM GL_AVERAGE_EXT} + GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT = $8336; + {$EXTERNALSYM GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT} + GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT = $8337; + {$EXTERNALSYM GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT} + GL_PIXEL_TRANSFORM_2D_MATRIX_EXT = $8338; + {$EXTERNALSYM GL_PIXEL_TRANSFORM_2D_MATRIX_EXT} + + // GL_EXT_separate_specular_color + GL_LIGHT_MODEL_COLOR_CONTROL_EXT = $81F8; + {$EXTERNALSYM GL_LIGHT_MODEL_COLOR_CONTROL_EXT} + GL_SINGLE_COLOR_EXT = $81F9; + {$EXTERNALSYM GL_SINGLE_COLOR_EXT} + GL_SEPARATE_SPECULAR_COLOR_EXT = $81FA; + {$EXTERNALSYM GL_SEPARATE_SPECULAR_COLOR_EXT} + + // GL_EXT_secondary_color + GL_COLOR_SUM_EXT = $8458; + {$EXTERNALSYM GL_COLOR_SUM_EXT} + GL_CURRENT_SECONDARY_COLOR_EXT = $8459; + {$EXTERNALSYM GL_CURRENT_SECONDARY_COLOR_EXT} + GL_SECONDARY_COLOR_ARRAY_SIZE_EXT = $845A; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_SIZE_EXT} + GL_SECONDARY_COLOR_ARRAY_TYPE_EXT = $845B; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_TYPE_EXT} + GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT = $845C; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT} + GL_SECONDARY_COLOR_ARRAY_POINTER_EXT = $845D; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_POINTER_EXT} + GL_SECONDARY_COLOR_ARRAY_EXT = $845E; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_EXT} + + // GL_EXT_texture_perturb_normal + GL_PERTURB_EXT = $85AE; + {$EXTERNALSYM GL_PERTURB_EXT} + GL_TEXTURE_NORMAL_EXT = $85AF; + {$EXTERNALSYM GL_TEXTURE_NORMAL_EXT} + + // GL_EXT_fog_coord + GL_FOG_COORDINATE_SOURCE_EXT = $8450; + {$EXTERNALSYM GL_FOG_COORDINATE_SOURCE_EXT} + GL_FOG_COORDINATE_EXT = $8451; + {$EXTERNALSYM GL_FOG_COORDINATE_EXT} + GL_FRAGMENT_DEPTH_EXT = $8452; + {$EXTERNALSYM GL_FRAGMENT_DEPTH_EXT} + GL_CURRENT_FOG_COORDINATE_EXT = $8453; + {$EXTERNALSYM GL_CURRENT_FOG_COORDINATE_EXT} + GL_FOG_COORDINATE_ARRAY_TYPE_EXT = $8454; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_TYPE_EXT} + GL_FOG_COORDINATE_ARRAY_STRIDE_EXT = $8455; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_STRIDE_EXT} + GL_FOG_COORDINATE_ARRAY_POINTER_EXT = $8456; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_POINTER_EXT} + GL_FOG_COORDINATE_ARRAY_EXT = $8457; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_EXT} + + // GL_REND_screen_coordinates + GL_SCREEN_COORDINATES_REND = $8490; + {$EXTERNALSYM GL_SCREEN_COORDINATES_REND} + GL_INVERTED_SCREEN_W_REND = $8491; + {$EXTERNALSYM GL_INVERTED_SCREEN_W_REND} + + // GL_EXT_coordinate_frame + GL_TANGENT_ARRAY_EXT = $8439; + {$EXTERNALSYM GL_TANGENT_ARRAY_EXT} + GL_BINORMAL_ARRAY_EXT = $843A; + {$EXTERNALSYM GL_BINORMAL_ARRAY_EXT} + GL_CURRENT_TANGENT_EXT = $843B; + {$EXTERNALSYM GL_CURRENT_TANGENT_EXT} + GL_CURRENT_BINORMAL_EXT = $843C; + {$EXTERNALSYM GL_CURRENT_BINORMAL_EXT} + GL_TANGENT_ARRAY_TYPE_EXT = $843E; + {$EXTERNALSYM GL_TANGENT_ARRAY_TYPE_EXT} + GL_TANGENT_ARRAY_STRIDE_EXT = $843F; + {$EXTERNALSYM GL_TANGENT_ARRAY_STRIDE_EXT} + GL_BINORMAL_ARRAY_TYPE_EXT = $8440; + {$EXTERNALSYM GL_BINORMAL_ARRAY_TYPE_EXT} + GL_BINORMAL_ARRAY_STRIDE_EXT = $8441; + {$EXTERNALSYM GL_BINORMAL_ARRAY_STRIDE_EXT} + GL_TANGENT_ARRAY_POINTER_EXT = $8442; + {$EXTERNALSYM GL_TANGENT_ARRAY_POINTER_EXT} + GL_BINORMAL_ARRAY_POINTER_EXT = $8443; + {$EXTERNALSYM GL_BINORMAL_ARRAY_POINTER_EXT} + GL_MAP1_TANGENT_EXT = $8444; + {$EXTERNALSYM GL_MAP1_TANGENT_EXT} + GL_MAP2_TANGENT_EXT = $8445; + {$EXTERNALSYM GL_MAP2_TANGENT_EXT} + GL_MAP1_BINORMAL_EXT = $8446; + {$EXTERNALSYM GL_MAP1_BINORMAL_EXT} + GL_MAP2_BINORMAL_EXT = $8447; + {$EXTERNALSYM GL_MAP2_BINORMAL_EXT} + + // GL_EXT_texture_env_combine + GL_SOURCE3_RGB_EXT = $8583; + {$EXTERNALSYM GL_SOURCE3_RGB_EXT} + GL_SOURCE4_RGB_EXT = $8584; + {$EXTERNALSYM GL_SOURCE4_RGB_EXT} + GL_SOURCE5_RGB_EXT = $8585; + {$EXTERNALSYM GL_SOURCE5_RGB_EXT} + GL_SOURCE6_RGB_EXT = $8586; + {$EXTERNALSYM GL_SOURCE6_RGB_EXT} + GL_SOURCE7_RGB_EXT = $8587; + {$EXTERNALSYM GL_SOURCE7_RGB_EXT} + GL_SOURCE3_ALPHA_EXT = $858B; + {$EXTERNALSYM GL_SOURCE3_ALPHA_EXT} + GL_SOURCE4_ALPHA_EXT = $858C; + {$EXTERNALSYM GL_SOURCE4_ALPHA_EXT} + GL_SOURCE5_ALPHA_EXT = $858D; + {$EXTERNALSYM GL_SOURCE5_ALPHA_EXT} + GL_SOURCE6_ALPHA_EXT = $858E; + {$EXTERNALSYM GL_SOURCE6_ALPHA_EXT} + GL_SOURCE7_ALPHA_EXT = $858F; + {$EXTERNALSYM GL_SOURCE7_ALPHA_EXT} + GL_OPERAND3_RGB_EXT = $8593; + {$EXTERNALSYM GL_OPERAND3_RGB_EXT} + GL_OPERAND4_RGB_EXT = $8594; + {$EXTERNALSYM GL_OPERAND4_RGB_EXT} + GL_OPERAND5_RGB_EXT = $8595; + {$EXTERNALSYM GL_OPERAND5_RGB_EXT} + GL_OPERAND6_RGB_EXT = $8596; + {$EXTERNALSYM GL_OPERAND6_RGB_EXT} + GL_OPERAND7_RGB_EXT = $8597; + {$EXTERNALSYM GL_OPERAND7_RGB_EXT} + GL_OPERAND3_ALPHA_EXT = $859B; + {$EXTERNALSYM GL_OPERAND3_ALPHA_EXT} + GL_OPERAND4_ALPHA_EXT = $859C; + {$EXTERNALSYM GL_OPERAND4_ALPHA_EXT} + GL_OPERAND5_ALPHA_EXT = $859D; + {$EXTERNALSYM GL_OPERAND5_ALPHA_EXT} + GL_OPERAND6_ALPHA_EXT = $859E; + {$EXTERNALSYM GL_OPERAND6_ALPHA_EXT} + GL_OPERAND7_ALPHA_EXT = $859F; + {$EXTERNALSYM GL_OPERAND7_ALPHA_EXT} + + // GL_APPLE_specular_vector + GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE = $85B0; + {$EXTERNALSYM GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE} + + // GL_APPLE_transform_hint + GL_TRANSFORM_HINT_APPLE = $85B1; + {$EXTERNALSYM GL_TRANSFORM_HINT_APPLE} + + // GL_SGIX_fog_scale + GL_FOG_SCALE_SGIX = $81FC; + {$EXTERNALSYM GL_FOG_SCALE_SGIX} + GL_FOG_SCALE_VALUE_SGIX = $81FD; + {$EXTERNALSYM GL_FOG_SCALE_VALUE_SGIX} + + // GL_SUNX_constant_data + GL_UNPACK_CONSTANT_DATA_SUNX = $81D5; + {$EXTERNALSYM GL_UNPACK_CONSTANT_DATA_SUNX} + GL_TEXTURE_CONSTANT_DATA_SUNX = $81D6; + {$EXTERNALSYM GL_TEXTURE_CONSTANT_DATA_SUNX} + + // GL_SUN_global_alpha + GL_GLOBAL_ALPHA_SUN = $81D9; + {$EXTERNALSYM GL_GLOBAL_ALPHA_SUN} + GL_GLOBAL_ALPHA_FACTOR_SUN = $81DA; + {$EXTERNALSYM GL_GLOBAL_ALPHA_FACTOR_SUN} + + // GL_SUN_triangle_list + GL_RESTART_SUN = $01; + {$EXTERNALSYM GL_RESTART_SUN} + GL_REPLACE_MIDDLE_SUN = $02; + {$EXTERNALSYM GL_REPLACE_MIDDLE_SUN} + GL_REPLACE_OLDEST_SUN = $03; + {$EXTERNALSYM GL_REPLACE_OLDEST_SUN} + GL_TRIANGLE_LIST_SUN = $81D7; + {$EXTERNALSYM GL_TRIANGLE_LIST_SUN} + GL_REPLACEMENT_CODE_SUN = $81D8; + {$EXTERNALSYM GL_REPLACEMENT_CODE_SUN} + GL_REPLACEMENT_CODE_ARRAY_SUN = $85C0; + {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_SUN} + GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN = $85C1; + {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN} + GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN = $85C2; + {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN} + GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN = $85C3; + {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN} + GL_R1UI_V3F_SUN = $85C4; + {$EXTERNALSYM GL_R1UI_V3F_SUN} + GL_R1UI_C4UB_V3F_SUN = $85C5; + {$EXTERNALSYM GL_R1UI_C4UB_V3F_SUN} + GL_R1UI_C3F_V3F_SUN = $85C6; + {$EXTERNALSYM GL_R1UI_C3F_V3F_SUN} + GL_R1UI_N3F_V3F_SUN = $85C7; + {$EXTERNALSYM GL_R1UI_N3F_V3F_SUN} + GL_R1UI_C4F_N3F_V3F_SUN = $85C8; + {$EXTERNALSYM GL_R1UI_C4F_N3F_V3F_SUN} + GL_R1UI_T2F_V3F_SUN = $85C9; + {$EXTERNALSYM GL_R1UI_T2F_V3F_SUN} + GL_R1UI_T2F_N3F_V3F_SUN = $85CA; + {$EXTERNALSYM GL_R1UI_T2F_N3F_V3F_SUN} + GL_R1UI_T2F_C4F_N3F_V3F_SUN = $85CB; + {$EXTERNALSYM GL_R1UI_T2F_C4F_N3F_V3F_SUN} + + // GL_EXT_blend_func_separate + GL_BLEND_DST_RGB_EXT = $80C8; + {$EXTERNALSYM GL_BLEND_DST_RGB_EXT} + GL_BLEND_SRC_RGB_EXT = $80C9; + {$EXTERNALSYM GL_BLEND_SRC_RGB_EXT} + GL_BLEND_DST_ALPHA_EXT = $80CA; + {$EXTERNALSYM GL_BLEND_DST_ALPHA_EXT} + GL_BLEND_SRC_ALPHA_EXT = $80CB; + {$EXTERNALSYM GL_BLEND_SRC_ALPHA_EXT} + + // GL_INGR_color_clamp + GL_RED_MIN_CLAMP_INGR = $8560; + {$EXTERNALSYM GL_RED_MIN_CLAMP_INGR} + GL_GREEN_MIN_CLAMP_INGR = $8561; + {$EXTERNALSYM GL_GREEN_MIN_CLAMP_INGR} + GL_BLUE_MIN_CLAMP_INGR = $8562; + {$EXTERNALSYM GL_BLUE_MIN_CLAMP_INGR} + GL_ALPHA_MIN_CLAMP_INGR = $8563; + {$EXTERNALSYM GL_ALPHA_MIN_CLAMP_INGR} + GL_RED_MAX_CLAMP_INGR = $8564; + {$EXTERNALSYM GL_RED_MAX_CLAMP_INGR} + GL_GREEN_MAX_CLAMP_INGR = $8565; + {$EXTERNALSYM GL_GREEN_MAX_CLAMP_INGR} + GL_BLUE_MAX_CLAMP_INGR = $8566; + {$EXTERNALSYM GL_BLUE_MAX_CLAMP_INGR} + GL_ALPHA_MAX_CLAMP_INGR = $8567; + {$EXTERNALSYM GL_ALPHA_MAX_CLAMP_INGR} + + // GL_INGR_interlace_read + GL_INTERLACE_READ_INGR = $8568; + {$EXTERNALSYM GL_INTERLACE_READ_INGR} + + // GL_EXT_422_pixels + GL_422_EXT = $80CC; + {$EXTERNALSYM GL_422_EXT} + GL_422_REV_EXT = $80CD; + {$EXTERNALSYM GL_422_REV_EXT} + GL_422_AVERAGE_EXT = $80CE; + {$EXTERNALSYM GL_422_AVERAGE_EXT} + GL_422_REV_AVERAGE_EXT = $80CF; + {$EXTERNALSYM GL_422_REV_AVERAGE_EXT} + + // GL_EXT_texture_cube_map + GL_NORMAL_MAP_EXT = $8511; + {$EXTERNALSYM GL_NORMAL_MAP_EXT} + GL_REFLECTION_MAP_EXT = $8512; + {$EXTERNALSYM GL_REFLECTION_MAP_EXT} + GL_TEXTURE_CUBE_MAP_EXT = $8513; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_EXT} + GL_TEXTURE_BINDING_CUBE_MAP_EXT = $8514; + {$EXTERNALSYM GL_TEXTURE_BINDING_CUBE_MAP_EXT} + GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT = $8515; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT} + GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT = $8516; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT} + GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT = $8517; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT} + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT = $8518; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT} + GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT = $8519; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT} + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT = $851A; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT} + GL_PROXY_TEXTURE_CUBE_MAP_EXT = $851B; + {$EXTERNALSYM GL_PROXY_TEXTURE_CUBE_MAP_EXT} + GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT = $851C; + {$EXTERNALSYM GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT} + + // GL_SUN_convolution_border_modes + GL_WRAP_BORDER_SUN = $81D4; + {$EXTERNALSYM GL_WRAP_BORDER_SUN} + + // GL_EXT_texture_lod_bias + GL_MAX_TEXTURE_LOD_BIAS_EXT = $84FD; + {$EXTERNALSYM GL_MAX_TEXTURE_LOD_BIAS_EXT} + GL_TEXTURE_FILTER_CONTROL_EXT = $8500; + {$EXTERNALSYM GL_TEXTURE_FILTER_CONTROL_EXT} + GL_TEXTURE_LOD_BIAS_EXT = $8501; + {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_EXT} + + // GL_EXT_texture_filter_anisotropic + GL_TEXTURE_MAX_ANISOTROPY_EXT = $84FE; + {$EXTERNALSYM GL_TEXTURE_MAX_ANISOTROPY_EXT} + GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = $84FF; + {$EXTERNALSYM GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT} + + // GL_EXT_vertex_weighting + GL_MODELVIEW0_STACK_DEPTH_EXT = GL_MODELVIEW_STACK_DEPTH; + {$EXTERNALSYM GL_MODELVIEW0_STACK_DEPTH_EXT} + GL_MODELVIEW1_STACK_DEPTH_EXT = $8502; + {$EXTERNALSYM GL_MODELVIEW1_STACK_DEPTH_EXT} + GL_MODELVIEW0_MATRIX_EXT = GL_MODELVIEW_MATRIX; + {$EXTERNALSYM GL_MODELVIEW0_MATRIX_EXT} + GL_MODELVIEW_MATRIX1_EXT = $8506; + {$EXTERNALSYM GL_MODELVIEW_MATRIX1_EXT} + GL_VERTEX_WEIGHTING_EXT = $8509; + {$EXTERNALSYM GL_VERTEX_WEIGHTING_EXT} + GL_MODELVIEW0_EXT = GL_MODELVIEW; + {$EXTERNALSYM GL_MODELVIEW0_EXT} + GL_MODELVIEW1_EXT = $850A; + {$EXTERNALSYM GL_MODELVIEW1_EXT} + GL_CURRENT_VERTEX_WEIGHT_EXT = $850B; + {$EXTERNALSYM GL_CURRENT_VERTEX_WEIGHT_EXT} + GL_VERTEX_WEIGHT_ARRAY_EXT = $850C; + {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_EXT} + GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT = $850D; + {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT} + GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT = $850E; + {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT} + GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT = $850F; + {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT} + GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT = $8510; + {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT} + + // GL_NV_light_max_exponent + GL_MAX_SHININESS_NV = $8504; + {$EXTERNALSYM GL_MAX_SHININESS_NV} + GL_MAX_SPOT_EXPONENT_NV = $8505; + {$EXTERNALSYM GL_MAX_SPOT_EXPONENT_NV} + + // GL_NV_vertex_array_range + GL_VERTEX_ARRAY_RANGE_NV = $851D; + {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_NV} + GL_VERTEX_ARRAY_RANGE_LENGTH_NV = $851E; + {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_LENGTH_NV} + GL_VERTEX_ARRAY_RANGE_VALID_NV = $851F; + {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_VALID_NV} + GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV = $8520; + {$EXTERNALSYM GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV} + GL_VERTEX_ARRAY_RANGE_POINTER_NV = $8521; + {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_POINTER_NV} + + // GL_NV_register_combiners + GL_REGISTER_COMBINERS_NV = $8522; + {$EXTERNALSYM GL_REGISTER_COMBINERS_NV} + GL_VARIABLE_A_NV = $8523; + {$EXTERNALSYM GL_VARIABLE_A_NV} + GL_VARIABLE_B_NV = $8524; + {$EXTERNALSYM GL_VARIABLE_B_NV} + GL_VARIABLE_C_NV = $8525; + {$EXTERNALSYM GL_VARIABLE_C_NV} + GL_VARIABLE_D_NV = $8526; + {$EXTERNALSYM GL_VARIABLE_D_NV} + GL_VARIABLE_E_NV = $8527; + {$EXTERNALSYM GL_VARIABLE_E_NV} + GL_VARIABLE_F_NV = $8528; + {$EXTERNALSYM GL_VARIABLE_F_NV} + GL_VARIABLE_G_NV = $8529; + {$EXTERNALSYM GL_VARIABLE_G_NV} + GL_CONSTANT_COLOR0_NV = $852A; + {$EXTERNALSYM GL_CONSTANT_COLOR0_NV} + GL_CONSTANT_COLOR1_NV = $852B; + {$EXTERNALSYM GL_CONSTANT_COLOR1_NV} + GL_PRIMARY_COLOR_NV = $852C; + {$EXTERNALSYM GL_PRIMARY_COLOR_NV} + GL_SECONDARY_COLOR_NV = $852D; + {$EXTERNALSYM GL_SECONDARY_COLOR_NV} + GL_SPARE0_NV = $852E; + {$EXTERNALSYM GL_SPARE0_NV} + GL_SPARE1_NV = $852F; + {$EXTERNALSYM GL_SPARE1_NV} + GL_DISCARD_NV = $8530; + {$EXTERNALSYM GL_DISCARD_NV} + GL_E_TIMES_F_NV = $8531; + {$EXTERNALSYM GL_E_TIMES_F_NV} + GL_SPARE0_PLUS_SECONDARY_COLOR_NV = $8532; + {$EXTERNALSYM GL_SPARE0_PLUS_SECONDARY_COLOR_NV} + GL_UNSIGNED_IDENTITY_NV = $8536; + {$EXTERNALSYM GL_UNSIGNED_IDENTITY_NV} + GL_UNSIGNED_INVERT_NV = $8537; + {$EXTERNALSYM GL_UNSIGNED_INVERT_NV} + GL_EXPAND_NORMAL_NV = $8538; + {$EXTERNALSYM GL_EXPAND_NORMAL_NV} + GL_EXPAND_NEGATE_NV = $8539; + {$EXTERNALSYM GL_EXPAND_NEGATE_NV} + GL_HALF_BIAS_NORMAL_NV = $853A; + {$EXTERNALSYM GL_HALF_BIAS_NORMAL_NV} + GL_HALF_BIAS_NEGATE_NV = $853B; + {$EXTERNALSYM GL_HALF_BIAS_NEGATE_NV} + GL_SIGNED_IDENTITY_NV = $853C; + {$EXTERNALSYM GL_SIGNED_IDENTITY_NV} + GL_SIGNED_NEGATE_NV = $853D; + {$EXTERNALSYM GL_SIGNED_NEGATE_NV} + GL_SCALE_BY_TWO_NV = $853E; + {$EXTERNALSYM GL_SCALE_BY_TWO_NV} + GL_SCALE_BY_FOUR_NV = $853F; + {$EXTERNALSYM GL_SCALE_BY_FOUR_NV} + GL_SCALE_BY_ONE_HALF_NV = $8540; + {$EXTERNALSYM GL_SCALE_BY_ONE_HALF_NV} + GL_BIAS_BY_NEGATIVE_ONE_HALF_NV = $8541; + {$EXTERNALSYM GL_BIAS_BY_NEGATIVE_ONE_HALF_NV} + GL_COMBINER_INPUT_NV = $8542; + {$EXTERNALSYM GL_COMBINER_INPUT_NV} + GL_COMBINER_MAPPING_NV = $8543; + {$EXTERNALSYM GL_COMBINER_MAPPING_NV} + GL_COMBINER_COMPONENT_USAGE_NV = $8544; + {$EXTERNALSYM GL_COMBINER_COMPONENT_USAGE_NV} + GL_COMBINER_AB_DOT_PRODUCT_NV = $8545; + {$EXTERNALSYM GL_COMBINER_AB_DOT_PRODUCT_NV} + GL_COMBINER_CD_DOT_PRODUCT_NV = $8546; + {$EXTERNALSYM GL_COMBINER_CD_DOT_PRODUCT_NV} + GL_COMBINER_MUX_SUM_NV = $8547; + {$EXTERNALSYM GL_COMBINER_MUX_SUM_NV} + GL_COMBINER_SCALE_NV = $8548; + {$EXTERNALSYM GL_COMBINER_SCALE_NV} + GL_COMBINER_BIAS_NV = $8549; + {$EXTERNALSYM GL_COMBINER_BIAS_NV} + GL_COMBINER_AB_OUTPUT_NV = $854A; + {$EXTERNALSYM GL_COMBINER_AB_OUTPUT_NV} + GL_COMBINER_CD_OUTPUT_NV = $854B; + {$EXTERNALSYM GL_COMBINER_CD_OUTPUT_NV} + GL_COMBINER_SUM_OUTPUT_NV = $854C; + {$EXTERNALSYM GL_COMBINER_SUM_OUTPUT_NV} + GL_MAX_GENERAL_COMBINERS_NV = $854D; + {$EXTERNALSYM GL_MAX_GENERAL_COMBINERS_NV} + GL_NUM_GENERAL_COMBINERS_NV = $854E; + {$EXTERNALSYM GL_NUM_GENERAL_COMBINERS_NV} + GL_COLOR_SUM_CLAMP_NV = $854F; + {$EXTERNALSYM GL_COLOR_SUM_CLAMP_NV} + GL_COMBINER0_NV = $8550; + {$EXTERNALSYM GL_COMBINER0_NV} + GL_COMBINER1_NV = $8551; + {$EXTERNALSYM GL_COMBINER1_NV} + GL_COMBINER2_NV = $8552; + {$EXTERNALSYM GL_COMBINER2_NV} + GL_COMBINER3_NV = $8553; + {$EXTERNALSYM GL_COMBINER3_NV} + GL_COMBINER4_NV = $8554; + {$EXTERNALSYM GL_COMBINER4_NV} + GL_COMBINER5_NV = $8555; + {$EXTERNALSYM GL_COMBINER5_NV} + GL_COMBINER6_NV = $8556; + {$EXTERNALSYM GL_COMBINER6_NV} + GL_COMBINER7_NV = $8557; + {$EXTERNALSYM GL_COMBINER7_NV} + + // GL_NV_fog_distance + GL_FOG_DISTANCE_MODE_NV = $855A; + {$EXTERNALSYM GL_FOG_DISTANCE_MODE_NV} + GL_EYE_RADIAL_NV = $855B; + {$EXTERNALSYM GL_EYE_RADIAL_NV} + GL_EYE_PLANE_ABSOLUTE_NV = $855C; + {$EXTERNALSYM GL_EYE_PLANE_ABSOLUTE_NV} + + // GL_NV_texgen_emboss + GL_EMBOSS_LIGHT_NV = $855D; + {$EXTERNALSYM GL_EMBOSS_LIGHT_NV} + GL_EMBOSS_CONSTANT_NV = $855E; + {$EXTERNALSYM GL_EMBOSS_CONSTANT_NV} + GL_EMBOSS_MAP_NV = $855F; + {$EXTERNALSYM GL_EMBOSS_MAP_NV} + + // GL_EXT_texture_compression_s3tc + GL_COMPRESSED_RGB_S3TC_DXT1_EXT = $83F0; + {$EXTERNALSYM GL_COMPRESSED_RGB_S3TC_DXT1_EXT} + GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = $83F1; + {$EXTERNALSYM GL_COMPRESSED_RGBA_S3TC_DXT1_EXT} + GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = $83F2; + {$EXTERNALSYM GL_COMPRESSED_RGBA_S3TC_DXT3_EXT} + GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = $83F3; + {$EXTERNALSYM GL_COMPRESSED_RGBA_S3TC_DXT5_EXT} + + // GL_IBM_cull_vertex + GL_CULL_VERTEX_IBM = 103050; + {$EXTERNALSYM GL_CULL_VERTEX_IBM} + + // GL_IBM_vertex_array_lists + GL_VERTEX_ARRAY_LIST_IBM = 103070; + {$EXTERNALSYM GL_VERTEX_ARRAY_LIST_IBM} + GL_NORMAL_ARRAY_LIST_IBM = 103071; + {$EXTERNALSYM GL_NORMAL_ARRAY_LIST_IBM} + GL_COLOR_ARRAY_LIST_IBM = 103072; + {$EXTERNALSYM GL_COLOR_ARRAY_LIST_IBM} + GL_INDEX_ARRAY_LIST_IBM = 103073; + {$EXTERNALSYM GL_INDEX_ARRAY_LIST_IBM} + GL_TEXTURE_COORD_ARRAY_LIST_IBM = 103074; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_LIST_IBM} + GL_EDGE_FLAG_ARRAY_LIST_IBM = 103075; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_LIST_IBM} + GL_FOG_COORDINATE_ARRAY_LIST_IBM = 103076; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_LIST_IBM} + GL_SECONDARY_COLOR_ARRAY_LIST_IBM = 103077; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_LIST_IBM} + GL_VERTEX_ARRAY_LIST_STRIDE_IBM = 103080; + {$EXTERNALSYM GL_VERTEX_ARRAY_LIST_STRIDE_IBM} + GL_NORMAL_ARRAY_LIST_STRIDE_IBM = 103081; + {$EXTERNALSYM GL_NORMAL_ARRAY_LIST_STRIDE_IBM} + GL_COLOR_ARRAY_LIST_STRIDE_IBM = 103082; + {$EXTERNALSYM GL_COLOR_ARRAY_LIST_STRIDE_IBM} + GL_INDEX_ARRAY_LIST_STRIDE_IBM = 103083; + {$EXTERNALSYM GL_INDEX_ARRAY_LIST_STRIDE_IBM} + GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM = 103084; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM} + GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM = 103085; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM} + GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM = 103086; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM} + GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM = 103087; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM} + + // GL_SGIX_subsample + GL_PACK_SUBSAMPLE_RATE_SGIX = $85A0; + {$EXTERNALSYM GL_PACK_SUBSAMPLE_RATE_SGIX} + GL_UNPACK_SUBSAMPLE_RATE_SGIX = $85A1; + {$EXTERNALSYM GL_UNPACK_SUBSAMPLE_RATE_SGIX} + GL_PIXEL_SUBSAMPLE_4444_SGIX = $85A2; + {$EXTERNALSYM GL_PIXEL_SUBSAMPLE_4444_SGIX} + GL_PIXEL_SUBSAMPLE_2424_SGIX = $85A3; + {$EXTERNALSYM GL_PIXEL_SUBSAMPLE_2424_SGIX} + GL_PIXEL_SUBSAMPLE_4242_SGIX = $85A4; + {$EXTERNALSYM GL_PIXEL_SUBSAMPLE_4242_SGIX} + + // GL_SGIX_ycrcba + GL_YCRCB_SGIX = $8318; + {$EXTERNALSYM GL_YCRCB_SGIX} + GL_YCRCBA_SGIX = $8319; + {$EXTERNALSYM GL_YCRCBA_SGIX} + + // GL_SGI_depth_pass_instrument + GL_DEPTH_PASS_INSTRUMENT_SGIX = $8310; + {$EXTERNALSYM GL_DEPTH_PASS_INSTRUMENT_SGIX} + GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX = $8311; + {$EXTERNALSYM GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX} + GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX = $8312; + {$EXTERNALSYM GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX} + + // GL_3DFX_texture_compression_FXT1 + GL_COMPRESSED_RGB_FXT1_3DFX = $86B0; + {$EXTERNALSYM GL_COMPRESSED_RGB_FXT1_3DFX} + GL_COMPRESSED_RGBA_FXT1_3DFX = $86B1; + {$EXTERNALSYM GL_COMPRESSED_RGBA_FXT1_3DFX} + + // GL_3DFX_multisample + GL_MULTISAMPLE_3DFX = $86B2; + {$EXTERNALSYM GL_MULTISAMPLE_3DFX} + GL_SAMPLE_BUFFERS_3DFX = $86B3; + {$EXTERNALSYM GL_SAMPLE_BUFFERS_3DFX} + GL_SAMPLES_3DFX = $86B4; + {$EXTERNALSYM GL_SAMPLES_3DFX} + GL_MULTISAMPLE_BIT_3DFX = $20000000; + {$EXTERNALSYM GL_MULTISAMPLE_BIT_3DFX} + + // GL_EXT_multisample + GL_MULTISAMPLE_EXT = $809D; + {$EXTERNALSYM GL_MULTISAMPLE_EXT} + GL_SAMPLE_ALPHA_TO_MASK_EXT = $809E; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_MASK_EXT} + GL_SAMPLE_ALPHA_TO_ONE_EXT = $809F; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_ONE_EXT} + GL_SAMPLE_MASK_EXT = $80A0; + {$EXTERNALSYM GL_SAMPLE_MASK_EXT} + GL_1PASS_EXT = $80A1; + {$EXTERNALSYM GL_1PASS_EXT} + GL_2PASS_0_EXT = $80A2; + {$EXTERNALSYM GL_2PASS_0_EXT} + GL_2PASS_1_EXT = $80A3; + {$EXTERNALSYM GL_2PASS_1_EXT} + GL_4PASS_0_EXT = $80A4; + {$EXTERNALSYM GL_4PASS_0_EXT} + GL_4PASS_1_EXT = $80A5; + {$EXTERNALSYM GL_4PASS_1_EXT} + GL_4PASS_2_EXT = $80A6; + {$EXTERNALSYM GL_4PASS_2_EXT} + GL_4PASS_3_EXT = $80A7; + {$EXTERNALSYM GL_4PASS_3_EXT} + GL_SAMPLE_BUFFERS_EXT = $80A8; + {$EXTERNALSYM GL_SAMPLE_BUFFERS_EXT} + GL_SAMPLES_EXT = $80A9; + {$EXTERNALSYM GL_SAMPLES_EXT} + GL_SAMPLE_MASK_VALUE_EXT = $80AA; + {$EXTERNALSYM GL_SAMPLE_MASK_VALUE_EXT} + GL_SAMPLE_MASK_INVERT_EXT = $80AB; + {$EXTERNALSYM GL_SAMPLE_MASK_INVERT_EXT} + GL_SAMPLE_PATTERN_EXT = $80AC; + {$EXTERNALSYM GL_SAMPLE_PATTERN_EXT} + + // GL_SGIX_vertex_preclip + GL_VERTEX_PRECLIP_SGIX = $83EE; + {$EXTERNALSYM GL_VERTEX_PRECLIP_SGIX} + GL_VERTEX_PRECLIP_HINT_SGIX = $83EF; + {$EXTERNALSYM GL_VERTEX_PRECLIP_HINT_SGIX} + + // GL_SGIX_convolution_accuracy + GL_CONVOLUTION_HINT_SGIX = $8316; + {$EXTERNALSYM GL_CONVOLUTION_HINT_SGIX} + + // GL_SGIX_resample + GL_PACK_RESAMPLE_SGIX = $842C; + {$EXTERNALSYM GL_PACK_RESAMPLE_SGIX} + GL_UNPACK_RESAMPLE_SGIX = $842D; + {$EXTERNALSYM GL_UNPACK_RESAMPLE_SGIX} + GL_RESAMPLE_REPLICATE_SGIX = $842E; + {$EXTERNALSYM GL_RESAMPLE_REPLICATE_SGIX} + GL_RESAMPLE_ZERO_FILL_SGIX = $842F; + {$EXTERNALSYM GL_RESAMPLE_ZERO_FILL_SGIX} + GL_RESAMPLE_DECIMATE_SGIX = $8430; + {$EXTERNALSYM GL_RESAMPLE_DECIMATE_SGIX} + + // GL_SGIS_point_line_texgen + GL_EYE_DISTANCE_TO_POINT_SGIS = $81F0; + {$EXTERNALSYM GL_EYE_DISTANCE_TO_POINT_SGIS} + GL_OBJECT_DISTANCE_TO_POINT_SGIS = $81F1; + {$EXTERNALSYM GL_OBJECT_DISTANCE_TO_POINT_SGIS} + GL_EYE_DISTANCE_TO_LINE_SGIS = $81F2; + {$EXTERNALSYM GL_EYE_DISTANCE_TO_LINE_SGIS} + GL_OBJECT_DISTANCE_TO_LINE_SGIS = $81F3; + {$EXTERNALSYM GL_OBJECT_DISTANCE_TO_LINE_SGIS} + GL_EYE_POINT_SGIS = $81F4; + {$EXTERNALSYM GL_EYE_POINT_SGIS} + GL_OBJECT_POINT_SGIS = $81F5; + {$EXTERNALSYM GL_OBJECT_POINT_SGIS} + GL_EYE_LINE_SGIS = $81F6; + {$EXTERNALSYM GL_EYE_LINE_SGIS} + GL_OBJECT_LINE_SGIS = $81F7; + {$EXTERNALSYM GL_OBJECT_LINE_SGIS} + + // GL_SGIS_texture_color_mask + GL_TEXTURE_COLOR_WRITEMASK_SGIS = $81EF; + {$EXTERNALSYM GL_TEXTURE_COLOR_WRITEMASK_SGIS} + + // GL_NV_vertex_program + GL_VERTEX_PROGRAM_NV = $8620; + {$EXTERNALSYM GL_VERTEX_PROGRAM_NV} + GL_VERTEX_STATE_PROGRAM_NV = $8621; + {$EXTERNALSYM GL_VERTEX_STATE_PROGRAM_NV} + GL_ATTRIB_ARRAY_SIZE_NV = $8623; + {$EXTERNALSYM GL_ATTRIB_ARRAY_SIZE_NV} + GL_ATTRIB_ARRAY_STRIDE_NV = $8624; + {$EXTERNALSYM GL_ATTRIB_ARRAY_STRIDE_NV} + GL_ATTRIB_ARRAY_TYPE_NV = $8625; + {$EXTERNALSYM GL_ATTRIB_ARRAY_TYPE_NV} + GL_CURRENT_ATTRIB_NV = $8626; + {$EXTERNALSYM GL_CURRENT_ATTRIB_NV} + GL_PROGRAM_LENGTH_NV = $8627; + {$EXTERNALSYM GL_PROGRAM_LENGTH_NV} + GL_PROGRAM_STRING_NV = $8628; + {$EXTERNALSYM GL_PROGRAM_STRING_NV} + GL_MODELVIEW_PROJECTION_NV = $8629; + {$EXTERNALSYM GL_MODELVIEW_PROJECTION_NV} + GL_IDENTITY_NV = $862A; + {$EXTERNALSYM GL_IDENTITY_NV} + GL_INVERSE_NV = $862B; + {$EXTERNALSYM GL_INVERSE_NV} + GL_TRANSPOSE_NV = $862C; + {$EXTERNALSYM GL_TRANSPOSE_NV} + GL_INVERSE_TRANSPOSE_NV = $862D; + {$EXTERNALSYM GL_INVERSE_TRANSPOSE_NV} + GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV = $862E; + {$EXTERNALSYM GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV} + GL_MAX_TRACK_MATRICES_NV = $862F; + {$EXTERNALSYM GL_MAX_TRACK_MATRICES_NV} + GL_MATRIX0_NV = $8630; + {$EXTERNALSYM GL_MATRIX0_NV} + GL_MATRIX1_NV = $8631; + {$EXTERNALSYM GL_MATRIX1_NV} + GL_MATRIX2_NV = $8632; + {$EXTERNALSYM GL_MATRIX2_NV} + GL_MATRIX3_NV = $8633; + {$EXTERNALSYM GL_MATRIX3_NV} + GL_MATRIX4_NV = $8634; + {$EXTERNALSYM GL_MATRIX4_NV} + GL_MATRIX5_NV = $8635; + {$EXTERNALSYM GL_MATRIX5_NV} + GL_MATRIX6_NV = $8636; + {$EXTERNALSYM GL_MATRIX6_NV} + GL_MATRIX7_NV = $8637; + {$EXTERNALSYM GL_MATRIX7_NV} + GL_CURRENT_MATRIX_STACK_DEPTH_NV = $8640; + {$EXTERNALSYM GL_CURRENT_MATRIX_STACK_DEPTH_NV} + GL_CURRENT_MATRIX_NV = $8641; + {$EXTERNALSYM GL_CURRENT_MATRIX_NV} + GL_VERTEX_PROGRAM_POINT_SIZE_NV = $8642; + {$EXTERNALSYM GL_VERTEX_PROGRAM_POINT_SIZE_NV} + GL_VERTEX_PROGRAM_TWO_SIDE_NV = $8643; + {$EXTERNALSYM GL_VERTEX_PROGRAM_TWO_SIDE_NV} + GL_PROGRAM_PARAMETER_NV = $8644; + {$EXTERNALSYM GL_PROGRAM_PARAMETER_NV} + GL_ATTRIB_ARRAY_POINTER_NV = $8645; + {$EXTERNALSYM GL_ATTRIB_ARRAY_POINTER_NV} + GL_PROGRAM_TARGET_NV = $8646; + {$EXTERNALSYM GL_PROGRAM_TARGET_NV} + GL_PROGRAM_RESIDENT_NV = $8647; + {$EXTERNALSYM GL_PROGRAM_RESIDENT_NV} + GL_TRACK_MATRIX_NV = $8648; + {$EXTERNALSYM GL_TRACK_MATRIX_NV} + GL_TRACK_MATRIX_TRANSFORM_NV = $8649; + {$EXTERNALSYM GL_TRACK_MATRIX_TRANSFORM_NV} + GL_VERTEX_PROGRAM_BINDING_NV = $864A; + {$EXTERNALSYM GL_VERTEX_PROGRAM_BINDING_NV} + GL_PROGRAM_ERROR_POSITION_NV = $864B; + {$EXTERNALSYM GL_PROGRAM_ERROR_POSITION_NV} + GL_VERTEX_ATTRIB_ARRAY0_NV = $8650; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY0_NV} + GL_VERTEX_ATTRIB_ARRAY1_NV = $8651; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY1_NV} + GL_VERTEX_ATTRIB_ARRAY2_NV = $8652; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY2_NV} + GL_VERTEX_ATTRIB_ARRAY3_NV = $8653; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY3_NV} + GL_VERTEX_ATTRIB_ARRAY4_NV = $8654; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY4_NV} + GL_VERTEX_ATTRIB_ARRAY5_NV = $8655; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY5_NV} + GL_VERTEX_ATTRIB_ARRAY6_NV = $8656; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY6_NV} + GL_VERTEX_ATTRIB_ARRAY7_NV = $8657; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY7_NV} + GL_VERTEX_ATTRIB_ARRAY8_NV = $8658; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY8_NV} + GL_VERTEX_ATTRIB_ARRAY9_NV = $8659; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY9_NV} + GL_VERTEX_ATTRIB_ARRAY10_NV = $865A; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY10_NV} + GL_VERTEX_ATTRIB_ARRAY11_NV = $865B; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY11_NV} + GL_VERTEX_ATTRIB_ARRAY12_NV = $865C; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY12_NV} + GL_VERTEX_ATTRIB_ARRAY13_NV = $865D; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY13_NV} + GL_VERTEX_ATTRIB_ARRAY14_NV = $865E; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY14_NV} + GL_VERTEX_ATTRIB_ARRAY15_NV = $865F; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY15_NV} + GL_MAP1_VERTEX_ATTRIB0_4_NV = $8660; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB0_4_NV} + GL_MAP1_VERTEX_ATTRIB1_4_NV = $8661; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB1_4_NV} + GL_MAP1_VERTEX_ATTRIB2_4_NV = $8662; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB2_4_NV} + GL_MAP1_VERTEX_ATTRIB3_4_NV = $8663; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB3_4_NV} + GL_MAP1_VERTEX_ATTRIB4_4_NV = $8664; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB4_4_NV} + GL_MAP1_VERTEX_ATTRIB5_4_NV = $8665; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB5_4_NV} + GL_MAP1_VERTEX_ATTRIB6_4_NV = $8666; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB6_4_NV} + GL_MAP1_VERTEX_ATTRIB7_4_NV = $8667; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB7_4_NV} + GL_MAP1_VERTEX_ATTRIB8_4_NV = $8668; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB8_4_NV} + GL_MAP1_VERTEX_ATTRIB9_4_NV = $8669; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB9_4_NV} + GL_MAP1_VERTEX_ATTRIB10_4_NV = $866A; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB10_4_NV} + GL_MAP1_VERTEX_ATTRIB11_4_NV = $866B; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB11_4_NV} + GL_MAP1_VERTEX_ATTRIB12_4_NV = $866C; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB12_4_NV} + GL_MAP1_VERTEX_ATTRIB13_4_NV = $866D; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB13_4_NV} + GL_MAP1_VERTEX_ATTRIB14_4_NV = $866E; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB14_4_NV} + GL_MAP1_VERTEX_ATTRIB15_4_NV = $866F; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB15_4_NV} + GL_MAP2_VERTEX_ATTRIB0_4_NV = $8670; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB0_4_NV} + GL_MAP2_VERTEX_ATTRIB1_4_NV = $8671; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB1_4_NV} + GL_MAP2_VERTEX_ATTRIB2_4_NV = $8672; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB2_4_NV} + GL_MAP2_VERTEX_ATTRIB3_4_NV = $8673; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB3_4_NV} + GL_MAP2_VERTEX_ATTRIB4_4_NV = $8674; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB4_4_NV} + GL_MAP2_VERTEX_ATTRIB5_4_NV = $8675; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB5_4_NV} + GL_MAP2_VERTEX_ATTRIB6_4_NV = $8676; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB6_4_NV} + GL_MAP2_VERTEX_ATTRIB7_4_NV = $8677; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB7_4_NV} + GL_MAP2_VERTEX_ATTRIB8_4_NV = $8678; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB8_4_NV} + GL_MAP2_VERTEX_ATTRIB9_4_NV = $8679; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB9_4_NV} + GL_MAP2_VERTEX_ATTRIB10_4_NV = $867A; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB10_4_NV} + GL_MAP2_VERTEX_ATTRIB11_4_NV = $867B; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB11_4_NV} + GL_MAP2_VERTEX_ATTRIB12_4_NV = $867C; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB12_4_NV} + GL_MAP2_VERTEX_ATTRIB13_4_NV = $867D; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB13_4_NV} + GL_MAP2_VERTEX_ATTRIB14_4_NV = $867E; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB14_4_NV} + GL_MAP2_VERTEX_ATTRIB15_4_NV = $867F; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB15_4_NV} + + // WGL_ARB_pixel_format + WGL_NUMBER_PIXEL_FORMATS_ARB = $2000; + {$EXTERNALSYM WGL_NUMBER_PIXEL_FORMATS_ARB} + WGL_DRAW_TO_WINDOW_ARB = $2001; + {$EXTERNALSYM WGL_DRAW_TO_WINDOW_ARB} + WGL_DRAW_TO_BITMAP_ARB = $2002; + {$EXTERNALSYM WGL_DRAW_TO_BITMAP_ARB} + WGL_ACCELERATION_ARB = $2003; + {$EXTERNALSYM WGL_ACCELERATION_ARB} + WGL_NEED_PALETTE_ARB = $2004; + {$EXTERNALSYM WGL_NEED_PALETTE_ARB} + WGL_NEED_SYSTEM_PALETTE_ARB = $2005; + {$EXTERNALSYM WGL_NEED_SYSTEM_PALETTE_ARB} + WGL_SWAP_LAYER_BUFFERS_ARB = $2006; + {$EXTERNALSYM WGL_SWAP_LAYER_BUFFERS_ARB} + WGL_SWAP_METHOD_ARB = $2007; + {$EXTERNALSYM WGL_SWAP_METHOD_ARB} + WGL_NUMBER_OVERLAYS_ARB = $2008; + {$EXTERNALSYM WGL_NUMBER_OVERLAYS_ARB} + WGL_NUMBER_UNDERLAYS_ARB = $2009; + {$EXTERNALSYM WGL_NUMBER_UNDERLAYS_ARB} + WGL_TRANSPARENT_ARB = $200A; + {$EXTERNALSYM WGL_TRANSPARENT_ARB} + WGL_TRANSPARENT_RED_VALUE_ARB = $2037; + {$EXTERNALSYM WGL_TRANSPARENT_RED_VALUE_ARB} + WGL_TRANSPARENT_GREEN_VALUE_ARB = $2038; + {$EXTERNALSYM WGL_TRANSPARENT_GREEN_VALUE_ARB} + WGL_TRANSPARENT_BLUE_VALUE_ARB = $2039; + {$EXTERNALSYM WGL_TRANSPARENT_BLUE_VALUE_ARB} + WGL_TRANSPARENT_ALPHA_VALUE_ARB = $203A; + {$EXTERNALSYM WGL_TRANSPARENT_ALPHA_VALUE_ARB} + WGL_TRANSPARENT_INDEX_VALUE_ARB = $203B; + {$EXTERNALSYM WGL_TRANSPARENT_INDEX_VALUE_ARB} + WGL_SHARE_DEPTH_ARB = $200C; + {$EXTERNALSYM WGL_SHARE_DEPTH_ARB} + WGL_SHARE_STENCIL_ARB = $200D; + {$EXTERNALSYM WGL_SHARE_STENCIL_ARB} + WGL_SHARE_ACCUM_ARB = $200E; + {$EXTERNALSYM WGL_SHARE_ACCUM_ARB} + WGL_SUPPORT_GDI_ARB = $200F; + {$EXTERNALSYM WGL_SUPPORT_GDI_ARB} + WGL_SUPPORT_OPENGL_ARB = $2010; + {$EXTERNALSYM WGL_SUPPORT_OPENGL_ARB} + WGL_DOUBLE_BUFFER_ARB = $2011; + {$EXTERNALSYM WGL_DOUBLE_BUFFER_ARB} + WGL_STEREO_ARB = $2012; + {$EXTERNALSYM WGL_STEREO_ARB} + WGL_PIXEL_TYPE_ARB = $2013; + {$EXTERNALSYM WGL_PIXEL_TYPE_ARB} + WGL_COLOR_BITS_ARB = $2014; + {$EXTERNALSYM WGL_COLOR_BITS_ARB} + WGL_RED_BITS_ARB = $2015; + {$EXTERNALSYM WGL_RED_BITS_ARB} + WGL_RED_SHIFT_ARB = $2016; + {$EXTERNALSYM WGL_RED_SHIFT_ARB} + WGL_GREEN_BITS_ARB = $2017; + {$EXTERNALSYM WGL_GREEN_BITS_ARB} + WGL_GREEN_SHIFT_ARB = $2018; + {$EXTERNALSYM WGL_GREEN_SHIFT_ARB} + WGL_BLUE_BITS_ARB = $2019; + {$EXTERNALSYM WGL_BLUE_BITS_ARB} + WGL_BLUE_SHIFT_ARB = $201A; + {$EXTERNALSYM WGL_BLUE_SHIFT_ARB} + WGL_ALPHA_BITS_ARB = $201B; + {$EXTERNALSYM WGL_ALPHA_BITS_ARB} + WGL_ALPHA_SHIFT_ARB = $201C; + {$EXTERNALSYM WGL_ALPHA_SHIFT_ARB} + WGL_ACCUM_BITS_ARB = $201D; + {$EXTERNALSYM WGL_ACCUM_BITS_ARB} + WGL_ACCUM_RED_BITS_ARB = $201E; + {$EXTERNALSYM WGL_ACCUM_RED_BITS_ARB} + WGL_ACCUM_GREEN_BITS_ARB = $201F; + {$EXTERNALSYM WGL_ACCUM_GREEN_BITS_ARB} + WGL_ACCUM_BLUE_BITS_ARB = $2020; + {$EXTERNALSYM WGL_ACCUM_BLUE_BITS_ARB} + WGL_ACCUM_ALPHA_BITS_ARB = $2021; + {$EXTERNALSYM WGL_ACCUM_ALPHA_BITS_ARB} + WGL_DEPTH_BITS_ARB = $2022; + {$EXTERNALSYM WGL_DEPTH_BITS_ARB} + WGL_STENCIL_BITS_ARB = $2023; + {$EXTERNALSYM WGL_STENCIL_BITS_ARB} + WGL_AUX_BUFFERS_ARB = $2024; + {$EXTERNALSYM WGL_AUX_BUFFERS_ARB} + WGL_NO_ACCELERATION_ARB = $2025; + {$EXTERNALSYM WGL_NO_ACCELERATION_ARB} + WGL_GENERIC_ACCELERATION_ARB = $2026; + {$EXTERNALSYM WGL_GENERIC_ACCELERATION_ARB} + WGL_FULL_ACCELERATION_ARB = $2027; + {$EXTERNALSYM WGL_FULL_ACCELERATION_ARB} + WGL_SWAP_EXCHANGE_ARB = $2028; + {$EXTERNALSYM WGL_SWAP_EXCHANGE_ARB} + WGL_SWAP_COPY_ARB = $2029; + {$EXTERNALSYM WGL_SWAP_COPY_ARB} + WGL_SWAP_UNDEFINED_ARB = $202A; + {$EXTERNALSYM WGL_SWAP_UNDEFINED_ARB} + WGL_TYPE_RGBA_ARB = $202B; + {$EXTERNALSYM WGL_TYPE_RGBA_ARB} + WGL_TYPE_COLORINDEX_ARB = $202C; + {$EXTERNALSYM WGL_TYPE_COLORINDEX_ARB} + + + // ********** GLU generic constants ********** + + // Errors: (return value 0 = no error) + GLU_INVALID_ENUM = 100900; + {$EXTERNALSYM GLU_INVALID_ENUM} + GLU_INVALID_VALUE = 100901; + {$EXTERNALSYM GLU_INVALID_VALUE} + GLU_OUT_OF_MEMORY = 100902; + {$EXTERNALSYM GLU_OUT_OF_MEMORY} + GLU_INCOMPATIBLE_GL_VERSION = 100903; + {$EXTERNALSYM GLU_INCOMPATIBLE_GL_VERSION} + + // StringName + GLU_VERSION = 100800; + {$EXTERNALSYM GLU_VERSION} + GLU_EXTENSIONS = 100801; + {$EXTERNALSYM GLU_EXTENSIONS} + + // Boolean + GLU_TRUE = GL_TRUE; + {$EXTERNALSYM GLU_TRUE} + GLU_FALSE = GL_FALSE; + {$EXTERNALSYM GLU_FALSE} + + // Quadric constants + // QuadricNormal + GLU_SMOOTH = 100000; + {$EXTERNALSYM GLU_SMOOTH} + GLU_FLAT = 100001; + {$EXTERNALSYM GLU_FLAT} + GLU_NONE = 100002; + {$EXTERNALSYM GLU_NONE} + + // QuadricDrawStyle + GLU_POINT = 100010; + {$EXTERNALSYM GLU_POINT} + GLU_LINE = 100011; + {$EXTERNALSYM GLU_LINE} + GLU_FILL = 100012; + {$EXTERNALSYM GLU_FILL} + GLU_SILHOUETTE = 100013; + {$EXTERNALSYM GLU_SILHOUETTE} + + // QuadricOrientation + GLU_OUTSIDE = 100020; + {$EXTERNALSYM GLU_OUTSIDE} + GLU_INSIDE = 100021; + {$EXTERNALSYM GLU_INSIDE} + + // Tesselation constants + GLU_TESS_MAX_COORD = 1.0e150; + {$EXTERNALSYM GLU_TESS_MAX_COORD} + + // TessProperty + GLU_TESS_WINDING_RULE = 100140; + {$EXTERNALSYM GLU_TESS_WINDING_RULE} + GLU_TESS_BOUNDARY_ONLY = 100141; + {$EXTERNALSYM GLU_TESS_BOUNDARY_ONLY} + GLU_TESS_TOLERANCE = 100142; + {$EXTERNALSYM GLU_TESS_TOLERANCE} + + // TessWinding + GLU_TESS_WINDING_ODD = 100130; + {$EXTERNALSYM GLU_TESS_WINDING_ODD} + GLU_TESS_WINDING_NONZERO = 100131; + {$EXTERNALSYM GLU_TESS_WINDING_NONZERO} + GLU_TESS_WINDING_POSITIVE = 100132; + {$EXTERNALSYM GLU_TESS_WINDING_POSITIVE} + GLU_TESS_WINDING_NEGATIVE = 100133; + {$EXTERNALSYM GLU_TESS_WINDING_NEGATIVE} + GLU_TESS_WINDING_ABS_GEQ_TWO = 100134; + {$EXTERNALSYM GLU_TESS_WINDING_ABS_GEQ_TWO} + + // TessCallback + GLU_TESS_BEGIN = 100100; // TGLUTessBeginProc + {$EXTERNALSYM GLU_TESS_BEGIN} + GLU_TESS_VERTEX = 100101; // TGLUTessVertexProc + {$EXTERNALSYM GLU_TESS_VERTEX} + GLU_TESS_END = 100102; // TGLUTessEndProc + {$EXTERNALSYM GLU_TESS_END} + GLU_TESS_ERROR = 100103; // TGLUTessErrorProc + {$EXTERNALSYM GLU_TESS_ERROR} + GLU_TESS_EDGE_FLAG = 100104; // TGLUTessEdgeFlagProc + {$EXTERNALSYM GLU_TESS_EDGE_FLAG} + GLU_TESS_COMBINE = 100105; // TGLUTessCombineProc + {$EXTERNALSYM GLU_TESS_COMBINE} + GLU_TESS_BEGIN_DATA = 100106; // TGLUTessBeginDataProc + {$EXTERNALSYM GLU_TESS_BEGIN_DATA} + GLU_TESS_VERTEX_DATA = 100107; // TGLUTessVertexDataProc + {$EXTERNALSYM GLU_TESS_VERTEX_DATA} + GLU_TESS_END_DATA = 100108; // TGLUTessEndDataProc + {$EXTERNALSYM GLU_TESS_END_DATA} + GLU_TESS_ERROR_DATA = 100109; // TGLUTessErrorDataProc + {$EXTERNALSYM GLU_TESS_ERROR_DATA} + GLU_TESS_EDGE_FLAG_DATA = 100110; // TGLUTessEdgeFlagDataProc + {$EXTERNALSYM GLU_TESS_EDGE_FLAG_DATA} + GLU_TESS_COMBINE_DATA = 100111; // TGLUTessCombineDataProc + {$EXTERNALSYM GLU_TESS_COMBINE_DATA} + + // TessError + GLU_TESS_ERROR1 = 100151; + {$EXTERNALSYM GLU_TESS_ERROR1} + GLU_TESS_ERROR2 = 100152; + {$EXTERNALSYM GLU_TESS_ERROR2} + GLU_TESS_ERROR3 = 100153; + {$EXTERNALSYM GLU_TESS_ERROR3} + GLU_TESS_ERROR4 = 100154; + {$EXTERNALSYM GLU_TESS_ERROR4} + GLU_TESS_ERROR5 = 100155; + {$EXTERNALSYM GLU_TESS_ERROR5} + GLU_TESS_ERROR6 = 100156; + {$EXTERNALSYM GLU_TESS_ERROR6} + GLU_TESS_ERROR7 = 100157; + {$EXTERNALSYM GLU_TESS_ERROR7} + GLU_TESS_ERROR8 = 100158; + {$EXTERNALSYM GLU_TESS_ERROR8} + + GLU_TESS_MISSING_BEGIN_POLYGON = GLU_TESS_ERROR1; + {$EXTERNALSYM GLU_TESS_MISSING_BEGIN_POLYGON} + GLU_TESS_MISSING_BEGIN_CONTOUR = GLU_TESS_ERROR2; + {$EXTERNALSYM GLU_TESS_MISSING_BEGIN_CONTOUR} + GLU_TESS_MISSING_END_POLYGON = GLU_TESS_ERROR3; + {$EXTERNALSYM GLU_TESS_MISSING_END_POLYGON} + GLU_TESS_MISSING_END_CONTOUR = GLU_TESS_ERROR4; + {$EXTERNALSYM GLU_TESS_MISSING_END_CONTOUR} + GLU_TESS_COORD_TOO_LARGE = GLU_TESS_ERROR5; + {$EXTERNALSYM GLU_TESS_COORD_TOO_LARGE} + GLU_TESS_NEED_COMBINE_CALLBACK = GLU_TESS_ERROR6; + {$EXTERNALSYM GLU_TESS_NEED_COMBINE_CALLBACK} + + // NURBS constants + + // NurbsProperty + GLU_AUTO_LOAD_MATRIX = 100200; + {$EXTERNALSYM GLU_AUTO_LOAD_MATRIX} + GLU_CULLING = 100201; + {$EXTERNALSYM GLU_CULLING} + GLU_SAMPLING_TOLERANCE = 100203; + {$EXTERNALSYM GLU_SAMPLING_TOLERANCE} + GLU_DISPLAY_MODE = 100204; + {$EXTERNALSYM GLU_DISPLAY_MODE} + GLU_PARAMETRIC_TOLERANCE = 100202; + {$EXTERNALSYM GLU_PARAMETRIC_TOLERANCE} + GLU_SAMPLING_METHOD = 100205; + {$EXTERNALSYM GLU_SAMPLING_METHOD} + GLU_U_STEP = 100206; + {$EXTERNALSYM GLU_U_STEP} + GLU_V_STEP = 100207; + {$EXTERNALSYM GLU_V_STEP} + + // NurbsSampling + GLU_PATH_LENGTH = 100215; + {$EXTERNALSYM GLU_PATH_LENGTH} + GLU_PARAMETRIC_ERROR = 100216; + {$EXTERNALSYM GLU_PARAMETRIC_ERROR} + GLU_DOMAIN_DISTANCE = 100217; + {$EXTERNALSYM GLU_DOMAIN_DISTANCE} + + // NurbsTrim + GLU_MAP1_TRIM_2 = 100210; + {$EXTERNALSYM GLU_MAP1_TRIM_2} + GLU_MAP1_TRIM_3 = 100211; + {$EXTERNALSYM GLU_MAP1_TRIM_3} + + // NurbsDisplay + GLU_OUTLINE_POLYGON = 100240; + {$EXTERNALSYM GLU_OUTLINE_POLYGON} + GLU_OUTLINE_PATCH = 100241; + {$EXTERNALSYM GLU_OUTLINE_PATCH} + + // NurbsErrors + GLU_NURBS_ERROR1 = 100251; + {$EXTERNALSYM GLU_NURBS_ERROR1} + GLU_NURBS_ERROR2 = 100252; + {$EXTERNALSYM GLU_NURBS_ERROR2} + GLU_NURBS_ERROR3 = 100253; + {$EXTERNALSYM GLU_NURBS_ERROR3} + GLU_NURBS_ERROR4 = 100254; + {$EXTERNALSYM GLU_NURBS_ERROR4} + GLU_NURBS_ERROR5 = 100255; + {$EXTERNALSYM GLU_NURBS_ERROR5} + GLU_NURBS_ERROR6 = 100256; + {$EXTERNALSYM GLU_NURBS_ERROR6} + GLU_NURBS_ERROR7 = 100257; + {$EXTERNALSYM GLU_NURBS_ERROR7} + GLU_NURBS_ERROR8 = 100258; + {$EXTERNALSYM GLU_NURBS_ERROR8} + GLU_NURBS_ERROR9 = 100259; + {$EXTERNALSYM GLU_NURBS_ERROR9} + GLU_NURBS_ERROR10 = 100260; + {$EXTERNALSYM GLU_NURBS_ERROR10} + GLU_NURBS_ERROR11 = 100261; + {$EXTERNALSYM GLU_NURBS_ERROR11} + GLU_NURBS_ERROR12 = 100262; + {$EXTERNALSYM GLU_NURBS_ERROR12} + GLU_NURBS_ERROR13 = 100263; + {$EXTERNALSYM GLU_NURBS_ERROR13} + GLU_NURBS_ERROR14 = 100264; + {$EXTERNALSYM GLU_NURBS_ERROR14} + GLU_NURBS_ERROR15 = 100265; + {$EXTERNALSYM GLU_NURBS_ERROR15} + GLU_NURBS_ERROR16 = 100266; + {$EXTERNALSYM GLU_NURBS_ERROR16} + GLU_NURBS_ERROR17 = 100267; + {$EXTERNALSYM GLU_NURBS_ERROR17} + GLU_NURBS_ERROR18 = 100268; + {$EXTERNALSYM GLU_NURBS_ERROR18} + GLU_NURBS_ERROR19 = 100269; + {$EXTERNALSYM GLU_NURBS_ERROR19} + GLU_NURBS_ERROR20 = 100270; + {$EXTERNALSYM GLU_NURBS_ERROR20} + GLU_NURBS_ERROR21 = 100271; + {$EXTERNALSYM GLU_NURBS_ERROR21} + GLU_NURBS_ERROR22 = 100272; + {$EXTERNALSYM GLU_NURBS_ERROR22} + GLU_NURBS_ERROR23 = 100273; + {$EXTERNALSYM GLU_NURBS_ERROR23} + GLU_NURBS_ERROR24 = 100274; + {$EXTERNALSYM GLU_NURBS_ERROR24} + GLU_NURBS_ERROR25 = 100275; + {$EXTERNALSYM GLU_NURBS_ERROR25} + GLU_NURBS_ERROR26 = 100276; + {$EXTERNALSYM GLU_NURBS_ERROR26} + GLU_NURBS_ERROR27 = 100277; + {$EXTERNALSYM GLU_NURBS_ERROR27} + GLU_NURBS_ERROR28 = 100278; + {$EXTERNALSYM GLU_NURBS_ERROR28} + GLU_NURBS_ERROR29 = 100279; + {$EXTERNALSYM GLU_NURBS_ERROR29} + GLU_NURBS_ERROR30 = 100280; + {$EXTERNALSYM GLU_NURBS_ERROR30} + GLU_NURBS_ERROR31 = 100281; + {$EXTERNALSYM GLU_NURBS_ERROR31} + GLU_NURBS_ERROR32 = 100282; + {$EXTERNALSYM GLU_NURBS_ERROR32} + GLU_NURBS_ERROR33 = 100283; + {$EXTERNALSYM GLU_NURBS_ERROR33} + GLU_NURBS_ERROR34 = 100284; + {$EXTERNALSYM GLU_NURBS_ERROR34} + GLU_NURBS_ERROR35 = 100285; + {$EXTERNALSYM GLU_NURBS_ERROR35} + GLU_NURBS_ERROR36 = 100286; + {$EXTERNALSYM GLU_NURBS_ERROR36} + GLU_NURBS_ERROR37 = 100287; + {$EXTERNALSYM GLU_NURBS_ERROR37} + + // Contours types -- obsolete! + GLU_CW = 100120; + {$EXTERNALSYM GLU_CW} + GLU_CCW = 100121; + {$EXTERNALSYM GLU_CCW} + GLU_INTERIOR = 100122; + {$EXTERNALSYM GLU_INTERIOR} + GLU_EXTERIOR = 100123; + {$EXTERNALSYM GLU_EXTERIOR} + GLU_UNKNOWN = 100124; + {$EXTERNALSYM GLU_UNKNOWN} + + // Names without "TESS_" prefix + GLU_BEGIN = GLU_TESS_BEGIN; + {$EXTERNALSYM GLU_BEGIN} + GLU_VERTEX = GLU_TESS_VERTEX; + {$EXTERNALSYM GLU_VERTEX} + GLU_END = GLU_TESS_END; + {$EXTERNALSYM GLU_END} + GLU_ERROR = GLU_TESS_ERROR; + {$EXTERNALSYM GLU_ERROR} + GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG; + {$EXTERNALSYM GLU_EDGE_FLAG} + + GLX_VERSION_1_1 = 1; + GLX_VERSION_1_2 = 1; + GLX_VERSION_1_3 = 1; + GLX_EXTENSION_NAME = 'GLX'; + {$EXTERNALSYM GLX_EXTENSION_NAME} + GLX_USE_GL = 1; + {$EXTERNALSYM GLX_USE_GL} + GLX_BUFFER_SIZE = 2; + {$EXTERNALSYM GLX_BUFFER_SIZE} + GLX_LEVEL = 3; + {$EXTERNALSYM GLX_LEVEL} + GLX_RGBA = 4; + {$EXTERNALSYM GLX_RGBA} + GLX_DOUBLEBUFFER = 5; + {$EXTERNALSYM GLX_DOUBLEBUFFER} + GLX_STEREO = 6; + {$EXTERNALSYM GLX_STEREO} + GLX_AUX_BUFFERS = 7; + {$EXTERNALSYM GLX_AUX_BUFFERS} + GLX_RED_SIZE = 8; + {$EXTERNALSYM GLX_RED_SIZE} + GLX_GREEN_SIZE = 9; + {$EXTERNALSYM GLX_GREEN_SIZE} + GLX_BLUE_SIZE = 10; + {$EXTERNALSYM GLX_BLUE_SIZE} + GLX_ALPHA_SIZE = 11; + {$EXTERNALSYM GLX_ALPHA_SIZE} + GLX_DEPTH_SIZE = 12; + {$EXTERNALSYM GLX_DEPTH_SIZE} + GLX_STENCIL_SIZE = 13; + {$EXTERNALSYM GLX_STENCIL_SIZE} + GLX_ACCUM_RED_SIZE = 14; + {$EXTERNALSYM GLX_ACCUM_RED_SIZE} + GLX_ACCUM_GREEN_SIZE = 15; + {$EXTERNALSYM GLX_ACCUM_GREEN_SIZE} + GLX_ACCUM_BLUE_SIZE = 16; + {$EXTERNALSYM GLX_ACCUM_BLUE_SIZE} + GLX_ACCUM_ALPHA_SIZE = 17; + {$EXTERNALSYM GLX_ACCUM_ALPHA_SIZE} + + // Error codes returned by glXGetConfig: + GLX_BAD_SCREEN = 1; + {$EXTERNALSYM GLX_BAD_SCREEN} + GLX_BAD_ATTRIBUTE = 2; + {$EXTERNALSYM GLX_BAD_ATTRIBUTE} + GLX_NO_EXTENSION = 3; + {$EXTERNALSYM GLX_NO_EXTENSION} + GLX_BAD_VISUAL = 4; + {$EXTERNALSYM GLX_BAD_VISUAL} + GLX_BAD_CONTEXT = 5; + {$EXTERNALSYM GLX_BAD_CONTEXT} + GLX_BAD_VALUE = 6; + {$EXTERNALSYM GLX_BAD_VALUE} + GLX_BAD_ENUM = 7; + {$EXTERNALSYM GLX_BAD_ENUM} + + // GLX 1.1 and later: + GLX_VENDOR = 1; + {$EXTERNALSYM GLX_VENDOR} + GLX_VERSION = 2; + {$EXTERNALSYM GLX_VERSION} + GLX_EXTENSIONS = 3; + {$EXTERNALSYM GLX_EXTENSIONS} + + // GLX 1.3 and later: + GLX_CONFIG_CAVEAT = $20; + {$EXTERNALSYM GLX_CONFIG_CAVEAT} + GLX_DONT_CARE = $FFFFFFFF; + {$EXTERNALSYM GLX_DONT_CARE} + GLX_SLOW_CONFIG = $8001; + {$EXTERNALSYM GLX_SLOW_CONFIG} + GLX_NON_CONFORMANT_CONFIG = $800D; + {$EXTERNALSYM GLX_NON_CONFORMANT_CONFIG} + GLX_X_VISUAL_TYPE = $22; + {$EXTERNALSYM GLX_X_VISUAL_TYPE} + GLX_TRANSPARENT_TYPE = $23; + {$EXTERNALSYM GLX_TRANSPARENT_TYPE} + GLX_TRANSPARENT_INDEX_VALUE = $24; + {$EXTERNALSYM GLX_TRANSPARENT_INDEX_VALUE} + GLX_TRANSPARENT_RED_VALUE = $25; + {$EXTERNALSYM GLX_TRANSPARENT_RED_VALUE} + GLX_TRANSPARENT_GREEN_VALUE = $26; + {$EXTERNALSYM GLX_TRANSPARENT_GREEN_VALUE} + GLX_TRANSPARENT_BLUE_VALUE = $27; + {$EXTERNALSYM GLX_TRANSPARENT_BLUE_VALUE} + GLX_TRANSPARENT_ALPHA_VALUE = $28; + {$EXTERNALSYM GLX_TRANSPARENT_ALPHA_VALUE} + GLX_MAX_PBUFFER_WIDTH = $8016; + {$EXTERNALSYM GLX_MAX_PBUFFER_WIDTH} + GLX_MAX_PBUFFER_HEIGHT = $8017; + {$EXTERNALSYM GLX_MAX_PBUFFER_HEIGHT} + GLX_MAX_PBUFFER_PIXELS = $8018; + {$EXTERNALSYM GLX_MAX_PBUFFER_PIXELS} + GLX_PRESERVED_CONTENTS = $801B; + {$EXTERNALSYM GLX_PRESERVED_CONTENTS} + GLX_LARGEST_BUFFER = $801C; + {$EXTERNALSYM GLX_LARGEST_BUFFER} + GLX_DRAWABLE_TYPE = $8010; + {$EXTERNALSYM GLX_DRAWABLE_TYPE} + GLX_FBCONFIG_ID = $8013; + {$EXTERNALSYM GLX_FBCONFIG_ID} + GLX_VISUAL_ID = $800B; + {$EXTERNALSYM GLX_VISUAL_ID} + GLX_WINDOW_BIT = $00000001; + {$EXTERNALSYM GLX_WINDOW_BIT} + GLX_PIXMAP_BIT = $00000002; + {$EXTERNALSYM GLX_PIXMAP_BIT} + GLX_PBUFFER_BIT = $00000004; + {$EXTERNALSYM GLX_PBUFFER_BIT} + GLX_AUX_BUFFERS_BIT = $00000010; + {$EXTERNALSYM GLX_AUX_BUFFERS_BIT} + GLX_FRONT_LEFT_BUFFER_BIT = $00000001; + {$EXTERNALSYM GLX_FRONT_LEFT_BUFFER_BIT} + GLX_FRONT_RIGHT_BUFFER_BIT = $00000002; + {$EXTERNALSYM GLX_FRONT_RIGHT_BUFFER_BIT} + GLX_BACK_LEFT_BUFFER_BIT = $00000004; + {$EXTERNALSYM GLX_BACK_LEFT_BUFFER_BIT} + GLX_BACK_RIGHT_BUFFER_BIT = $00000008; + {$EXTERNALSYM GLX_BACK_RIGHT_BUFFER_BIT} + GLX_DEPTH_BUFFER_BIT = $00000020; + {$EXTERNALSYM GLX_DEPTH_BUFFER_BIT} + GLX_STENCIL_BUFFER_BIT = $00000040; + {$EXTERNALSYM GLX_STENCIL_BUFFER_BIT} + GLX_ACCUM_BUFFER_BIT = $00000080; + {$EXTERNALSYM GLX_ACCUM_BUFFER_BIT} + GLX_RENDER_TYPE = $8011; + {$EXTERNALSYM GLX_RENDER_TYPE} + GLX_X_RENDERABLE = $8012; + {$EXTERNALSYM GLX_X_RENDERABLE} + GLX_NONE = $8000; + {$EXTERNALSYM GLX_NONE} + GLX_TRUE_COLOR = $8002; + {$EXTERNALSYM GLX_TRUE_COLOR} + GLX_DIRECT_COLOR = $8003; + {$EXTERNALSYM GLX_DIRECT_COLOR} + GLX_PSEUDO_COLOR = $8004; + {$EXTERNALSYM GLX_PSEUDO_COLOR} + GLX_STATIC_COLOR = $8005; + {$EXTERNALSYM GLX_STATIC_COLOR} + GLX_GRAY_SCALE = $8006; + {$EXTERNALSYM GLX_GRAY_SCALE} + GLX_STATIC_GRAY = $8007; + {$EXTERNALSYM GLX_STATIC_GRAY} + GLX_TRANSPARENT_INDEX = $8009; + {$EXTERNALSYM GLX_TRANSPARENT_INDEX} + GLX_COLOR_INDEX_TYPE = $8015; + {$EXTERNALSYM GLX_COLOR_INDEX_TYPE} + GLX_COLOR_INDEX_BIT = $00000002; + {$EXTERNALSYM GLX_COLOR_INDEX_BIT} + GLX_SCREEN = $800C; + {$EXTERNALSYM GLX_SCREEN} + GLX_PBUFFER_CLOBBER_MASK = $08000000; + {$EXTERNALSYM GLX_PBUFFER_CLOBBER_MASK} + GLX_DAMAGED = $8020; + {$EXTERNALSYM GLX_DAMAGED} + GLX_SAVED = $8021; + {$EXTERNALSYM GLX_SAVED} + GLX_WINDOW = $8022; + {$EXTERNALSYM GLX_WINDOW} + GLX_PBUFFER = $8023; + {$EXTERNALSYM GLX_PBUFFER} + GLX_EXT_visual_info = 1; + {$EXTERNALSYM GLX_EXT_visual_info} + GLX_X_VISUAL_TYPE_EXT = $22; + {$EXTERNALSYM GLX_X_VISUAL_TYPE_EXT} + GLX_TRANSPARENT_TYPE_EXT = $23; + {$EXTERNALSYM GLX_TRANSPARENT_TYPE_EXT} + GLX_TRANSPARENT_INDEX_VALUE_EXT = $24; + {$EXTERNALSYM GLX_TRANSPARENT_INDEX_VALUE_EXT} + GLX_TRANSPARENT_RED_VALUE_EXT = $25; + {$EXTERNALSYM GLX_TRANSPARENT_RED_VALUE_EXT} + GLX_TRANSPARENT_GREEN_VALUE_EXT = $26; + {$EXTERNALSYM GLX_TRANSPARENT_GREEN_VALUE_EXT} + GLX_TRANSPARENT_BLUE_VALUE_EXT = $27; + {$EXTERNALSYM GLX_TRANSPARENT_BLUE_VALUE_EXT} + GLX_TRANSPARENT_ALPHA_VALUE_EXT = $28; + {$EXTERNALSYM GLX_TRANSPARENT_ALPHA_VALUE_EXT} + GLX_TRUE_COLOR_EXT = $8002; + {$EXTERNALSYM GLX_TRUE_COLOR_EXT} + GLX_DIRECT_COLOR_EXT = $8003; + {$EXTERNALSYM GLX_DIRECT_COLOR_EXT} + GLX_PSEUDO_COLOR_EXT = $8004; + {$EXTERNALSYM GLX_PSEUDO_COLOR_EXT} + GLX_STATIC_COLOR_EXT = $8005; + {$EXTERNALSYM GLX_STATIC_COLOR_EXT} + GLX_GRAY_SCALE_EXT = $8006; + {$EXTERNALSYM GLX_GRAY_SCALE_EXT} + GLX_STATIC_GRAY_EXT = $8007; + {$EXTERNALSYM GLX_STATIC_GRAY_EXT} + GLX_NONE_EXT = $8000; + {$EXTERNALSYM GLX_NONE_EXT} + GLX_TRANSPARENT_RGB_EXT = $8008; + {$EXTERNALSYM GLX_TRANSPARENT_RGB_EXT} + GLX_TRANSPARENT_INDEX_EXT = $8009; + {$EXTERNALSYM GLX_TRANSPARENT_INDEX_EXT} + GLX_VISUAL_CAVEAT_EXT = $20; + {$EXTERNALSYM GLX_VISUAL_CAVEAT_EXT} + GLX_SLOW_VISUAL_EXT = $8001; + {$EXTERNALSYM GLX_SLOW_VISUAL_EXT} + GLX_NON_CONFORMANT_VISUAL_EXT = $800D; + {$EXTERNALSYM GLX_NON_CONFORMANT_VISUAL_EXT} + GLX_SHARE_CONTEXT_EXT = $800A; + {$EXTERNALSYM GLX_SHARE_CONTEXT_EXT} + GLX_VISUAL_ID_EXT = $800B; + {$EXTERNALSYM GLX_VISUAL_ID_EXT} + GLX_SCREEN_EXT = $800C; + {$EXTERNALSYM GLX_SCREEN_EXT} + GLX_3DFX_WINDOW_MODE_MESA = $1; + {$EXTERNALSYM GLX_3DFX_WINDOW_MODE_MESA} + GLX_3DFX_FULLSCREEN_MODE_MESA = $2; + {$EXTERNALSYM GLX_3DFX_FULLSCREEN_MODE_MESA} + + +type + // GLU types + TGLUNurbs = record end; + TGLUQuadric = record end; + TGLUTesselator = record end; + + PGLUNurbs = ^TGLUNurbs; + PGLUQuadric = ^TGLUQuadric; + PGLUTesselator = ^TGLUTesselator; + + // backwards compatibility + TGLUNurbsObj = TGLUNurbs; + TGLUQuadricObj = TGLUQuadric; + TGLUTesselatorObj = TGLUTesselator; + TGLUTriangulatorObj = TGLUTesselator; + + PGLUNurbsObj = PGLUNurbs; + PGLUQuadricObj = PGLUQuadric; + PGLUTesselatorObj = PGLUTesselator; + PGLUTriangulatorObj = PGLUTesselator; + + {$ifdef FPC} + PMaxLogPalette = ^TMaxLogPalette; + TMaxLogPalette = packed record + palversion : word; + palnumentries : word; + palpalentry : array[byte] of TPaletteEntry; + end; + {$endif} + + {$ifdef VER100, Delphi 3 compatibility} + PWGLSwap = ^TWGLSwap; + {$EXTERNALSYM _WGLSWAP} + _WGLSWAP = packed record + hdc: HDC; + uiFlags: UINT; + end; + TWGLSwap = _WGLSWAP; + {$EXTERNALSYM WGLSWAP} + WGLSWAP = _WGLSWAP; + {$endif VER100} + + // Callback function prototypes + // GLUQuadricCallback + TGLUQuadricErrorProc = procedure(errorCode: TGLEnum); {$ifdef MSWINDOWS} stdcall; {$endif} {$ifdef LINUX} cdecl; {$endif} + + // GLUTessCallback + TGLUTessBeginProc = procedure(AType: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + TGLUTessEdgeFlagProc = procedure(Flag: TGLboolean); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + TGLUTessVertexProc = procedure(VertexData: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + TGLUTessEndProc = procedure; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + TGLUTessErrorProc = procedure(ErrNo: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + TGLUTessCombineProc = procedure(Coords: TVector3d; VertexData: TVector4p; Weight: TVector4f; OutData: PPointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + TGLUTessBeginDataProc = procedure(AType: TGLEnum; UserData: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + TGLUTessEdgeFlagDataProc = procedure(Flag: TGLboolean; UserData: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + TGLUTessVertexDataProc = procedure(VertexData: Pointer; UserData: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + TGLUTessEndDataProc = procedure(UserData: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + TGLUTessErrorDataProc = procedure(ErrNo: TGLEnum; UserData: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + TGLUTessCombineDataProc = procedure(Coords: TVector3d; VertexData: TVector4p; Weight: TVector4f; OutData: PPointer; UserData: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + + // GLUNurbsCallback + TGLUNurbsErrorProc = procedure(ErrorCode: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + + // GL functions + procedure glBindTexture(target: TGLEnum; texture: TGLuint); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glTexParameteri(target, pname: TGLEnum; param: TGLint); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glTexImage2D(target: TGLEnum; level, internalformat: TGLint; width, height: TGLsizei; border: TGLint; format, atype: TGLEnum; Pixels:Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glDeleteTextures(n: TGLsizei; textures: PGLuint); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glGenTextures(n: GLsizei; textures: PGLuint); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glColor3f(red, green, blue: TGLfloat); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glBegin(mode: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glEnd; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glVertex2f(x, y: TGLfloat); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glColor4f(red, green, blue, alpha: TGLfloat); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glEnable(cap: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glDisable(cap: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glDepthRange(zNear, zFar: TGLclampd); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glDepthFunc(func: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glBlendFunc(sfactor: TGLEnum; dfactor: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glTexCoord2f(s, t: TGLfloat); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glVertex3f(x, y, z: TGLfloat); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glClearColor(red, green, blue, alpha: TGLclampf); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glClear(mask: TGLbitfield); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glMatrixMode(mode: TGLEnum); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glLoadIdentity; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glOrtho(left, right, bottom, top, zNear, zFar: TGLdouble); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glViewport(x, y: TGLint; width, height: TGLsizei); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glReadPixels(x, y: TGLint; width, height: TGLsizei; format, atype: TGLEnum; pixels: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glPixelStorei(pname: TGLEnum; param: TGLint); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + function glGetError:TGLuint; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glTexSubImage2D(target: TGLEnum; level, xoffset, yoffset: TGLint; width, height: TGLsizei; format, atype: TGLEnum; pixels: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure gluOrtho2D(left, right, bottom, top: TGLdouble); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glPushMatrix; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glPopMatrix; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glFrustum(left, right, bottom, top, zNear, zFar: TGLdouble); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glTranslatef(x, y, z: TGLfloat); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glRotatef(angle, x, y, z: TGLfloat); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glScalef(x, y, z: TGLfloat); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glTexParameterf(target, pname: TGLEnum; param: TGLfloat); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glCopyTexImage2D(target: TGLEnum; level: TGLint; internalFormat: TGLEnum; x, y: TGLint; width, height: TGLsizei; border: TGLint); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glGetIntegerv(pname: TGLEnum; params: PGLint); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + procedure glFinish; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external opengl32; + + // GLU functions + function gluBuild2DMipmaps(target: TGLEnum; components, width, height: TGLint; format, atype: TGLEnum; Data: Pointer): TGLint; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external glu32; + function gluScaleImage(format: TGLEnum; widthin, heightin: TGLint; typein: TGLEnum; datain: Pointer; widthout, heightout: TGLint; typeout: TGLEnum; dataout: Pointer): TGLint; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external glu32; + + Procedure LoadOpenGL; + Procedure UnloadOpenGL; + +implementation + +Procedure LoadOpenGL; +begin +end; + +Procedure UnloadOpenGL; +begin +end; + +end. diff --git a/Game/Code/MacOSX/Wrapper/PNGImage.pas b/Game/Code/MacOSX/Wrapper/PNGImage.pas index 9a82e193..e2454a01 100755 --- a/Game/Code/MacOSX/Wrapper/PNGImage.pas +++ b/Game/Code/MacOSX/Wrapper/PNGImage.pas @@ -1,6 +1,6 @@ unit PNGImage; -{$INCLUDE ../Platform.inc} +{$I switches.inc} interface diff --git a/Game/Code/MacOSX/Wrapper/Windows.pas b/Game/Code/MacOSX/Wrapper/Windows.pas index 333b08e7..cee75591 100755 --- a/Game/Code/MacOSX/Wrapper/Windows.pas +++ b/Game/Code/MacOSX/Wrapper/Windows.pas @@ -1,139 +1,167 @@ -unit Windows; - -{$INCLUDE ../Platform.inc} - -interface - -uses Types; - -const -{$IFDEF MSWINDOWS} - opengl32 = 'opengl32.dll'; -{$ENDIF} -{$IFDEF MACOS} - opengl32 = 'OpenGL'; -{$ENDIF} - -type - - DWORD = Types.DWORD; - {$EXTERNALSYM DWORD} - BOOL = LongBool; - {$EXTERNALSYM BOOL} - PBOOL = ^BOOL; - {$EXTERNALSYM PBOOL} - PByte = Types.PByte; - PINT = ^Integer; - {$EXTERNALSYM PINT} - PSingle = ^Single; - PWORD = ^Word; - {$EXTERNALSYM PWORD} - PDWORD = ^DWORD; - {$EXTERNALSYM PDWORD} - LPDWORD = PDWORD; - {$EXTERNALSYM LPDWORD} - HDC = type LongWord; - {$EXTERNALSYM HDC} - HGLRC = type LongWord; - {$EXTERNALSYM HGLRC} - TLargeInteger = Int64; - HFONT = type LongWord; - {$EXTERNALSYM HFONT} - HWND = type LongWord; - {$EXTERNALSYM HWND} - - PPaletteEntry = ^TPaletteEntry; - {$EXTERNALSYM tagPALETTEENTRY} - tagPALETTEENTRY = packed record - peRed: Byte; - peGreen: Byte; - peBlue: Byte; - peFlags: Byte; - end; - TPaletteEntry = tagPALETTEENTRY; - {$EXTERNALSYM PALETTEENTRY} - PALETTEENTRY = tagPALETTEENTRY; - - PRGBQuad = ^TRGBQuad; - {$EXTERNALSYM tagRGBQUAD} - tagRGBQUAD = packed record - rgbBlue: Byte; - rgbGreen: Byte; - rgbRed: Byte; - rgbReserved: Byte; - end; - TRGBQuad = tagRGBQUAD; - {$EXTERNALSYM RGBQUAD} - RGBQUAD = tagRGBQUAD; - - PBitmapInfoHeader = ^TBitmapInfoHeader; - {$EXTERNALSYM tagBITMAPINFOHEADER} - tagBITMAPINFOHEADER = packed record - biSize: DWORD; - biWidth: Longint; - biHeight: Longint; - biPlanes: Word; - biBitCount: Word; - biCompression: DWORD; - biSizeImage: DWORD; - biXPelsPerMeter: Longint; - biYPelsPerMeter: Longint; - biClrUsed: DWORD; - biClrImportant: DWORD; - end; - TBitmapInfoHeader = tagBITMAPINFOHEADER; - {$EXTERNALSYM BITMAPINFOHEADER} - BITMAPINFOHEADER = tagBITMAPINFOHEADER; - - PBitmapInfo = ^TBitmapInfo; - {$EXTERNALSYM tagBITMAPINFO} - tagBITMAPINFO = packed record - bmiHeader: TBitmapInfoHeader; - bmiColors: array[0..0] of TRGBQuad; - end; - TBitmapInfo = tagBITMAPINFO; - {$EXTERNALSYM BITMAPINFO} - BITMAPINFO = tagBITMAPINFO; - - function MakeLong(a, b: Word): Longint; - procedure ZeroMemory(Destination: Pointer; Length: DWORD); - function QueryPerformanceFrequency(var lpFrequency: TLargeInteger): BOOL; - function QueryPerformanceCounter(var lpPerformanceCount: TLargeInteger): BOOL; - -implementation - -uses SDL {$IFDEF MSWINDOWS}, Windows{$ENDIF}; - -function MakeLong(A, B: Word): Longint; -begin - Result := (LongInt(B) shl 16) + A; -end; - -procedure ZeroMemory(Destination: Pointer; Length: DWORD); -begin - FillChar( Destination^, Length, 0); -end; - -function QueryPerformanceFrequency(var lpFrequency: TLargeInteger): BOOL; -begin -{$IFDEF MSWINDOWS} - Result := Windows.QueryPerformanceFrequency(lpFrequency); -{$ENDIF} -{$IFDEF MACOS} - Result := true; - lpFrequency := 1000; -{$ENDIF} -end; - -function QueryPerformanceCounter(var lpPerformanceCount: TLargeInteger): BOOL; -begin -{$IFDEF MSWINDOWS} - Result := Windows.QueryPerformanceCounter(lpPerformanceCount); -{$ENDIF} -{$IFDEF MACOS} - Result := true; - lpPerformanceCount := SDL_GetTicks; -{$ENDIF} -end; - -end. +unit Windows; + +{$I switches.inc} + +interface + +uses Types; + +const + opengl32 = 'OpenGL'; + MAX_PATH = 260; + +type + + DWORD = Types.DWORD; + {$EXTERNALSYM DWORD} + BOOL = LongBool; + {$EXTERNALSYM BOOL} + PBOOL = ^BOOL; + {$EXTERNALSYM PBOOL} + PByte = Types.PByte; + PINT = ^Integer; + {$EXTERNALSYM PINT} + PSingle = ^Single; + PWORD = ^Word; + {$EXTERNALSYM PWORD} + PDWORD = ^DWORD; + {$EXTERNALSYM PDWORD} + LPDWORD = PDWORD; + {$EXTERNALSYM LPDWORD} + HDC = type LongWord; + {$EXTERNALSYM HDC} + HGLRC = type LongWord; + {$EXTERNALSYM HGLRC} + TLargeInteger = Int64; + HFONT = type LongWord; + {$EXTERNALSYM HFONT} + HWND = type LongWord; + {$EXTERNALSYM HWND} + + PPaletteEntry = ^TPaletteEntry; + {$EXTERNALSYM tagPALETTEENTRY} + tagPALETTEENTRY = packed record + peRed: Byte; + peGreen: Byte; + peBlue: Byte; + peFlags: Byte; + end; + TPaletteEntry = tagPALETTEENTRY; + {$EXTERNALSYM PALETTEENTRY} + PALETTEENTRY = tagPALETTEENTRY; + + PRGBQuad = ^TRGBQuad; + {$EXTERNALSYM tagRGBQUAD} + tagRGBQUAD = packed record + rgbBlue: Byte; + rgbGreen: Byte; + rgbRed: Byte; + rgbReserved: Byte; + end; + TRGBQuad = tagRGBQUAD; + {$EXTERNALSYM RGBQUAD} + RGBQUAD = tagRGBQUAD; + + PBitmapInfoHeader = ^TBitmapInfoHeader; + {$EXTERNALSYM tagBITMAPINFOHEADER} + tagBITMAPINFOHEADER = packed record + biSize: DWORD; + biWidth: Longint; + biHeight: Longint; + biPlanes: Word; + biBitCount: Word; + biCompression: DWORD; + biSizeImage: DWORD; + biXPelsPerMeter: Longint; + biYPelsPerMeter: Longint; + biClrUsed: DWORD; + biClrImportant: DWORD; + end; + TBitmapInfoHeader = tagBITMAPINFOHEADER; + {$EXTERNALSYM BITMAPINFOHEADER} + BITMAPINFOHEADER = tagBITMAPINFOHEADER; + + PBitmapInfo = ^TBitmapInfo; + {$EXTERNALSYM tagBITMAPINFO} + tagBITMAPINFO = packed record + bmiHeader: TBitmapInfoHeader; + bmiColors: array[0..0] of TRGBQuad; + end; + TBitmapInfo = tagBITMAPINFO; + {$EXTERNALSYM BITMAPINFO} + BITMAPINFO = tagBITMAPINFO; + + PBitmapFileHeader = ^TBitmapFileHeader; + {$EXTERNALSYM tagBITMAPFILEHEADER} + tagBITMAPFILEHEADER = packed record + bfType: Word; + bfSize: DWORD; + bfReserved1: Word; + bfReserved2: Word; + bfOffBits: DWORD; + end; + TBitmapFileHeader = tagBITMAPFILEHEADER; + {$EXTERNALSYM BITMAPFILEHEADER} + BITMAPFILEHEADER = tagBITMAPFILEHEADER; + + + function MakeLong(a, b: Word): Longint; + procedure ZeroMemory(Destination: Pointer; Length: DWORD); + function QueryPerformanceFrequency(var lpFrequency: TLargeInteger): BOOL; + function QueryPerformanceCounter(var lpPerformanceCount: TLargeInteger): BOOL; + function GetTickCount : Cardinal; + Procedure ShowMessage(msg : string); + procedure CopyMemory(Destination: Pointer; Source: Pointer; Length: DWORD); + +implementation + +uses SDL; + +procedure CopyMemory(Destination: Pointer; Source: Pointer; Length: DWORD); +begin + Move(Source^, Destination^, Length); +end; + +Procedure ShowMessage(msg : string); +begin + // to be implemented +end; + +function MakeLong(A, B: Word): Longint; +begin + Result := (LongInt(B) shl 16) + A; +end; + +procedure ZeroMemory(Destination: Pointer; Length: DWORD); +begin + FillChar( Destination^, Length, 0); +end; + +function QueryPerformanceFrequency(var lpFrequency: TLargeInteger): BOOL; +begin +{$IFDEF MSWINDOWS} + Result := Windows.QueryPerformanceFrequency(lpFrequency); +{$ENDIF} +{$IFDEF MACOS} + Result := true; + lpFrequency := 1000; +{$ENDIF} +end; + +function QueryPerformanceCounter(var lpPerformanceCount: TLargeInteger): BOOL; +begin +{$IFDEF MSWINDOWS} + Result := Windows.QueryPerformanceCounter(lpPerformanceCount); +{$ENDIF} +{$IFDEF MACOS} + Result := true; + lpPerformanceCount := SDL_GetTicks; +{$ENDIF} +end; + +function GetTickCount : Cardinal; +begin + Result := SDL_GetTicks; +end; + +end. diff --git a/Game/Code/MacOSX/Wrapper/zlportio.pas b/Game/Code/MacOSX/Wrapper/zlportio.pas index 4e6173bc..92b4a505 100755 --- a/Game/Code/MacOSX/Wrapper/zlportio.pas +++ b/Game/Code/MacOSX/Wrapper/zlportio.pas @@ -1,6 +1,6 @@ unit zlportio; -{$INCLUDE ../Platform.inc} +{$I switches.inc} interface diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index c83d3c37..b3529d0a 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -2,9 +2,7 @@ unit UDisplay; interface -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} +{$I switches.inc} uses {$IFDEF win32} windows, @@ -62,7 +60,7 @@ var implementation uses - {$IFDEF FPC} + {$IFDEF LAZARUS} ulazjpeg, {$ELSE} JPEG, diff --git a/Game/Code/Menu/UDrawTexture.pas b/Game/Code/Menu/UDrawTexture.pas index 5a543f33..de20bd4b 100644 --- a/Game/Code/Menu/UDrawTexture.pas +++ b/Game/Code/Menu/UDrawTexture.pas @@ -1,6 +1,9 @@ unit UDrawTexture; interface + +{$I switches.inc} + uses UTexture; procedure DrawLine(X1, Y1, X2, Y2, ColR, ColG, ColB: real); diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 75d6a957..08ba1e4d 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -2,9 +2,7 @@ unit UMenu; interface -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} +{$I switches.inc} uses OpenGL12, SysUtils, UTexture, UMenuStatic, UMenuText, UMenuButton, UMenuSelect, UMenuSelectSlide, UMenuInteract, UThemes, UMenuButtonCollection, Math; diff --git a/Game/Code/Menu/UMenuButton.pas b/Game/Code/Menu/UMenuButton.pas index af4f69ee..93b987b7 100644 --- a/Game/Code/Menu/UMenuButton.pas +++ b/Game/Code/Menu/UMenuButton.pas @@ -1,6 +1,9 @@ unit UMenuButton; interface + +{$I switches.inc} + uses TextGL, UTexture, OpenGL12, UMenuText; type diff --git a/Game/Code/Menu/UMenuButtonCollection.pas b/Game/Code/Menu/UMenuButtonCollection.pas index 5c9045a7..981452b1 100644 --- a/Game/Code/Menu/UMenuButtonCollection.pas +++ b/Game/Code/Menu/UMenuButtonCollection.pas @@ -1,6 +1,9 @@ unit UMenuButtonCollection; interface + +{$I switches.inc} + uses UMenuButton; type diff --git a/Game/Code/Menu/UMenuInteract.pas b/Game/Code/Menu/UMenuInteract.pas index 43249e3e..78f9bd89 100644 --- a/Game/Code/Menu/UMenuInteract.pas +++ b/Game/Code/Menu/UMenuInteract.pas @@ -2,6 +2,8 @@ unit UMenuInteract; interface +{$I switches.inc} + type TInteract = record // for moving thru menu Typ: integer; // 0 - button, 1 - select, 2 - Text, 3 - Select SLide, 5 - ButtonCollection Child diff --git a/Game/Code/Menu/UMenuSelect.pas b/Game/Code/Menu/UMenuSelect.pas index 72141a27..b0ee2b78 100644 --- a/Game/Code/Menu/UMenuSelect.pas +++ b/Game/Code/Menu/UMenuSelect.pas @@ -1,6 +1,9 @@ unit UMenuSelect; interface + +{$I switches.inc} + uses TextGL, UTexture, OpenGL12, UMenuText; type diff --git a/Game/Code/Menu/UMenuSelectSlide.pas b/Game/Code/Menu/UMenuSelectSlide.pas index bb9b5809..e4c5f959 100644 --- a/Game/Code/Menu/UMenuSelectSlide.pas +++ b/Game/Code/Menu/UMenuSelectSlide.pas @@ -2,9 +2,7 @@ unit UMenuSelectSlide; interface -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} +{$I switches.inc} uses TextGL, UTexture, diff --git a/Game/Code/Menu/UMenuStatic.pas b/Game/Code/Menu/UMenuStatic.pas index cfa4a596..a2c709ad 100644 --- a/Game/Code/Menu/UMenuStatic.pas +++ b/Game/Code/Menu/UMenuStatic.pas @@ -1,6 +1,9 @@ unit UMenuStatic; interface + +{$I switches.inc} + uses UTexture, OpenGL12; type diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas index 19adef03..350c28de 100644 --- a/Game/Code/Menu/UMenuText.pas +++ b/Game/Code/Menu/UMenuText.pas @@ -2,9 +2,7 @@ unit UMenuText; interface -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} +{$I switches.inc} uses TextGL, UTexture, @@ -61,6 +59,39 @@ uses UGraphic, {$ENDIF} StrUtils; +{$IFDEF DARWIN} +function PosEx(const SubStr, S: string; Offset: Cardinal = 1): Integer; +var + I,X: Integer; + Len, LenSubStr: Integer; +begin + if Offset = 1 then + Result := Pos(SubStr, S) + else + begin + I := Offset; + LenSubStr := Length(SubStr); + Len := Length(S) - LenSubStr + 1; + while I <= Len do + begin + if S[I] = SubStr[1] then + begin + X := 1; + while (X < LenSubStr) and (S[I + X] = SubStr[X + 1]) do + Inc(X); + if (X = LenSubStr) then + begin + Result := I; + exit; + end; + end; + Inc(I); + end; + Result := 0; + end; +end; +{$ENDIF} + procedure TText.SetSelect(Value: Boolean); begin SelectBool := Value; diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index a24997d4..e60b9fb9 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -2,10 +2,6 @@ unit UScreenCredits; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - {$I switches.inc} diff --git a/Game/Code/Screens/UScreenEdit.pas b/Game/Code/Screens/UScreenEdit.pas index a58756e6..49adb994 100644 --- a/Game/Code/Screens/UScreenEdit.pas +++ b/Game/Code/Screens/UScreenEdit.pas @@ -2,6 +2,8 @@ unit UScreenEdit; interface +{$I switches.inc} + uses UMenu, SDL, UThemes; type diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index 1878337b..0c8244ab 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -2,10 +2,6 @@ unit UScreenEditConvert; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - {$I switches.inc} uses UMenu, diff --git a/Game/Code/Screens/UScreenEditHeader.pas b/Game/Code/Screens/UScreenEditHeader.pas index a7105b0e..7c8b2d56 100644 --- a/Game/Code/Screens/UScreenEditHeader.pas +++ b/Game/Code/Screens/UScreenEditHeader.pas @@ -2,6 +2,8 @@ unit UScreenEditHeader; interface +{$I switches.inc} + uses UMenu, SDL, USongs, UThemes; type diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 1dd3fb24..d24fdede 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -2,10 +2,6 @@ unit UScreenEditSub; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - {$I switches.inc} uses diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas index df23d340..d4b528b5 100644 --- a/Game/Code/Screens/UScreenLevel.pas +++ b/Game/Code/Screens/UScreenLevel.pas @@ -2,6 +2,8 @@ unit UScreenLevel; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; diff --git a/Game/Code/Screens/UScreenLoading.pas b/Game/Code/Screens/UScreenLoading.pas index 2ccc5c79..989461f2 100644 --- a/Game/Code/Screens/UScreenLoading.pas +++ b/Game/Code/Screens/UScreenLoading.pas @@ -4,10 +4,6 @@ interface {$I switches.inc} -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - uses UMenu, SDL, diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index cb7390cc..38f58bf1 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -2,9 +2,7 @@ unit UScreenMain; interface -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} +{$I switches.inc} uses UMenu, diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index 5363d2a2..76e79a3b 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -2,6 +2,8 @@ unit UScreenName; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index edf684db..30404d6e 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -2,6 +2,8 @@ unit UScreenOpen; interface +{$I switches.inc} + uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, UMenuText, ULyrics, Math, OpenGL12, UThemes; diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas index 1867d03b..bcd781cc 100644 --- a/Game/Code/Screens/UScreenOptions.pas +++ b/Game/Code/Screens/UScreenOptions.pas @@ -2,6 +2,8 @@ unit UScreenOptions; interface +{$I switches.inc} + uses UMenu, SDL, SysUtils, UDisplay, UMusic, UFiles, UIni, UThemes; diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index 271ff972..0d40b7ec 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -2,6 +2,8 @@ unit UScreenOptionsAdvanced; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index 1d94ffa6..6cd0a20c 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -2,6 +2,8 @@ unit UScreenOptionsGame; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes, USongs; diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index c0ea90ff..947d506b 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -2,6 +2,8 @@ unit UScreenOptionsGraphics; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas index 7ef7c207..8d70eec9 100644 --- a/Game/Code/Screens/UScreenOptionsLyrics.pas +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -2,6 +2,8 @@ unit UScreenOptionsLyrics; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index d497c637..4be16e70 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -2,6 +2,8 @@ unit UScreenOptionsRecord; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index 1777228b..867a10b6 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -2,6 +2,8 @@ unit UScreenOptionsSound; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index cf89ac3f..750e8859 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -2,6 +2,8 @@ unit UScreenOptionsThemes; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index ee534781..17f3b2b5 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -2,10 +2,7 @@ unit UScreenPartyNewRound; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - +{$I switches.inc} uses UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 714e0d99..7be4d1c0 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -2,9 +2,7 @@ unit UScreenPartyOptions; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} +{$I switches.inc} uses UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index 24534599..4aaa5a3e 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -2,6 +2,8 @@ unit UScreenPartyPlayer; Interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index 6af835f2..ea9b944b 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -2,6 +2,8 @@ unit UScreenPartyScore; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, SysUtils, UThemes; diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas index 3c7ad921..9806159a 100644 --- a/Game/Code/Screens/UScreenPartyWin.pas +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -2,6 +2,8 @@ unit UScreenPartyWin; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, SysUtils, UThemes; diff --git a/Game/Code/Screens/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas index cc1b4492..402857a9 100644 --- a/Game/Code/Screens/UScreenPopup.pas +++ b/Game/Code/Screens/UScreenPopup.pas @@ -2,6 +2,8 @@ unit UScreenPopup; interface +{$I switches.inc} + uses UMenu, SDL, UMusic, UFiles, SysUtils, UThemes; diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 97d31541..36e3b43b 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -2,9 +2,7 @@ unit UScreenScore; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} +{$I switches.inc} uses UMenu, diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 8cba8f36..60cab0a4 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -4,10 +4,6 @@ interface {$I switches.inc} -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - uses UMenu, UMusic, diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index e2d53f0a..7f692af5 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -1,12 +1,9 @@ -unit UScreenSingModi; +unit UScreenSingModi; interface {$I switches.inc} -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} uses UMenu, UMusic, @@ -156,456 +153,456 @@ begin end; procedure TScreenSingModi.onShow; -var - I: Integer; -begin - - PlayersPlay := TeamInfo.NumTeams; - - if DLLMan.Selected.LoadSong then //Start with Song - begin - inherited; - end - else //Start Without Song - begin - AudioInput.CaptureStart; - end; - -//Set Playerinfo - PlayerInfo.NumPlayers := PlayersPlay; - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); - PlayerInfo.Playerinfo[I].Score := 0; - PlayerInfo.Playerinfo[I].Bar := 50; - PlayerInfo.Playerinfo[I].Enabled := True; - end; - - for I := PlayerInfo.NumPlayers to high(PlayerInfo.Playerinfo) do - begin - PlayerInfo.Playerinfo[I].Score:= 0; - PlayerInfo.Playerinfo[I].Bar := 0; - PlayerInfo.Playerinfo[I].Enabled := False; - end; - - {Case PlayersPlay of - 1: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; - end; - 2,4: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1TwoPScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; - PlayerInfo.Playerinfo[2].PosX := Static[StaticP1TwoPScoreBG].Texture.X; - PlayerInfo.Playerinfo[2].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; - PlayerInfo.Playerinfo[1].PosX := Static[StaticP2RScoreBG].Texture.X; - PlayerInfo.Playerinfo[1].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; - PlayerInfo.Playerinfo[3].PosX := Static[StaticP2RScoreBG].Texture.X; - PlayerInfo.Playerinfo[3].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; - end; - 3,6: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ThreePScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; - PlayerInfo.Playerinfo[3].PosX := Static[StaticP1ThreePScoreBG].Texture.X; - PlayerInfo.Playerinfo[3].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; - PlayerInfo.Playerinfo[1].PosX := Static[StaticP2MScoreBG].Texture.X; - PlayerInfo.Playerinfo[1].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; - PlayerInfo.Playerinfo[4].PosX := Static[StaticP2MScoreBG].Texture.X; - PlayerInfo.Playerinfo[4].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; - PlayerInfo.Playerinfo[2].PosX := Static[StaticP3RScoreBG].Texture.X; - PlayerInfo.Playerinfo[2].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; - PlayerInfo.Playerinfo[5].PosX := Static[StaticP3RScoreBG].Texture.X; - PlayerInfo.Playerinfo[5].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; - end; - end; } - - // play music (I) - //Music.CaptureStart; - //Music.MoveTo(AktSong.Start); - - //Init Plugin - if not DLLMan.PluginInit(TeamInfo, PlayerInfo, ToSentences(Czesci[0]), LoadTex, Print, LoadSound, PlaySound) then - begin - //Fehler - Log.LogError('Could not Init Plugin'); - Halt; - end; - - // Set Background (Little Workaround, maybe change sometime) - if (DLLMan.Selected.LoadBack) AND (DLLMan.Selected.LoadSong) then - ScreenSing.Tex_Background := Tex_Background; - - Winner := 0; - - //Set Score Visibility - {if PlayersPlay = 1 then begin - Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; - Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; - end; - - if (PlayersPlay = 2) OR (PlayersPlay = 4) then begin - Text[TextP1TwoPScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP1TwoPScoreBG].Visible := DLLMan.Selected.ShowScore; - - Text[TextP2RScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP2RScoreBG].Visible := DLLMan.Selected.ShowScore; - end; - - if (PlayersPlay = 3) OR (PlayersPlay = 6) then begin - Text[TextP1ThreePScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP1ThreePScoreBG].Visible := DLLMan.Selected.ShowScore; - - Text[TextP2MScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP2MScoreBG].Visible := DLLMan.Selected.ShowScore; - - Text[TextP3RScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP3RScoreBG].Visible := DLLMan.Selected.ShowScore; - end; } -end; - -function TScreenSingModi.Draw: boolean; -var - Min: integer; - Sec: integer; - Tekst: string; - S, I: integer; - T: integer; -begin -//Set Playerinfo - PlayerInfo.NumPlayers := PlayersPlay; - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - PlayerInfo.Playerinfo[I].Name := PChar(Player[I].Name); - if PlayerInfo.Playerinfo[I].Enabled then - begin - if (Player[I].ScoreTotalI<=10000) then - PlayerInfo.Playerinfo[I].Score:= Player[I].ScoreTotalI; - PlayerInfo.Playerinfo[I].Bar := Round(Scores.Players[I].RBPos * 100); - end; - end; - -//Show Score -if DLLMan.Selected.ShowScore then -begin - {//ScoreBG Mod - // set player colors - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - - - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - - - - end; - if ScreenAct = 2 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P4Dark'); - - - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); - - - - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P3Dark'); - - - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); - - - - end; - if ScreenAct = 2 then begin - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P6Dark'); - - - - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); - - - - - end; - end; - //end ScoreBG Mod } - -// set player names (for 2 screens and only Singstar skin) - if ScreenAct = 1 then begin - Text[TextP1].Text := 'P1'; - Text[TextP1TwoP].Text := 'P1'; // added for ps3 skin - Text[TextP1ThreeP].Text := 'P1'; // added for ps3 skin - Text[TextP2R].Text := 'P2'; - Text[TextP2M].Text := 'P2'; - Text[TextP3R].Text := 'P3'; - end; - - if ScreenAct = 2 then begin - case PlayersPlay of - 4: begin - Text[TextP1TwoP].Text := 'P3'; - Text[TextP2R].Text := 'P4'; - end; - 6: begin - Text[TextP1ThreeP].Text := 'P4'; - Text[TextP2M].Text := 'P5'; - Text[TextP3R].Text := 'P6'; - end; - end; // case - end; // if - - - // stereo <- and where iss P2M? or P3? - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; - Text[TextP1].X := Text[TextP1].X + 10*ScreenX; - - {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; - Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; - - {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} - - // .. and scores - {if PlayersPlay = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; - end; - - if PlayersPlay = 2 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - - if PlayersPlay = 3 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[4].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[5].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - end; } - -end; //ShowScore - - for S := 1 to 1 do - Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X + 10*ScreenX; - -if DLLMan.Selected.LoadSong then -begin - // update static menu with time ... - Min := Round(Czas.Teraz) div 60; - Sec := Round(Czas.Teraz) mod 60; - 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); -end; - - // draw static menu (BG) - DrawBG; - - //Draw Background - if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) then - SingDrawBackground; - - // comment by blindy: wo zum henker wird denn in diesem screen ein video abgespielt? - // update and draw movie - // wie wo wadd? also in der selben funktion in der uscreensing kommt des video in der zeile 995, oder was wollteste wissen? :X -{ if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin - UpdateSmpeg; // this only draws - end;} - - // draw static menu (FG) - DrawFG; - - if ShowFinish then begin - if DllMan.Selected.LoadSong then - begin - if (not AudioPlayback.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin - //Pause Mod: - if not Paused then - Sing(Self); // analyze song - end else begin - if not FadeOut then begin - Finish; - FadeOut := true; - FadeTo(@ScreenPartyScore); - end; - end; - end; - end; - - // draw custom items - SingModiDraw(PlayerInfo); // always draw - - //GoldenNoteStarsTwinkle Mod - GoldenRec.SpawnRec; - //GoldenNoteStarsTwinkle Mod - - //Update PlayerInfo - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - if PlayerInfo.Playerinfo[I].Enabled then - begin - //PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; - PlayerInfo.Playerinfo[I].Score := Player[I].ScoreTotalI; - end; - end; - - if ((ShowFinish) AND (NOT Paused)) then - begin - if not DLLMan.PluginDraw(Playerinfo, Czesci[0].Akt) then - begin - if not FadeOut then begin - Finish; - FadeOut := true; - FadeTo(@ScreenPartyScore); - end; - end; - end; - - //Change PlayerInfo/Changeables - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - if (Player[I].ScoreTotalI <> PlayerInfo.Playerinfo[I].Score) then - begin - //Player[I].ScoreTotal := Player[I].ScoreTotal + (PlayerInfo.Playerinfo[I].Score - Player[I].ScoreTotalI); - Player[I].ScoreTotalI := PlayerInfo.Playerinfo[I].Score; - end; - {if (PlayerInfo.Playerinfo[I].Bar <> Player[I].ScorePercent) then - Player[I].ScorePercentTarget := PlayerInfo.Playerinfo[I].Bar; } - end; - - // back stereo - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; - Text[TextP1].X := Text[TextP1].X - 10*ScreenX; - - {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX;} - - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; - Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; - - {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX;} - - - for S := 1 to 1 do - Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X - 10*ScreenX; - - +var + I: Integer; +begin + + PlayersPlay := TeamInfo.NumTeams; + + if DLLMan.Selected.LoadSong then //Start with Song + begin + inherited; + end + else //Start Without Song + begin + AudioInput.CaptureStart; + end; + +//Set Playerinfo + PlayerInfo.NumPlayers := PlayersPlay; + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); + PlayerInfo.Playerinfo[I].Score := 0; + PlayerInfo.Playerinfo[I].Bar := 50; + PlayerInfo.Playerinfo[I].Enabled := True; + end; + + for I := PlayerInfo.NumPlayers to high(PlayerInfo.Playerinfo) do + begin + PlayerInfo.Playerinfo[I].Score:= 0; + PlayerInfo.Playerinfo[I].Bar := 0; + PlayerInfo.Playerinfo[I].Enabled := False; + end; + + {Case PlayersPlay of + 1: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; + end; + 2,4: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1TwoPScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; + PlayerInfo.Playerinfo[2].PosX := Static[StaticP1TwoPScoreBG].Texture.X; + PlayerInfo.Playerinfo[2].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; + PlayerInfo.Playerinfo[1].PosX := Static[StaticP2RScoreBG].Texture.X; + PlayerInfo.Playerinfo[1].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; + PlayerInfo.Playerinfo[3].PosX := Static[StaticP2RScoreBG].Texture.X; + PlayerInfo.Playerinfo[3].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; + end; + 3,6: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ThreePScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; + PlayerInfo.Playerinfo[3].PosX := Static[StaticP1ThreePScoreBG].Texture.X; + PlayerInfo.Playerinfo[3].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; + PlayerInfo.Playerinfo[1].PosX := Static[StaticP2MScoreBG].Texture.X; + PlayerInfo.Playerinfo[1].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; + PlayerInfo.Playerinfo[4].PosX := Static[StaticP2MScoreBG].Texture.X; + PlayerInfo.Playerinfo[4].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; + PlayerInfo.Playerinfo[2].PosX := Static[StaticP3RScoreBG].Texture.X; + PlayerInfo.Playerinfo[2].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; + PlayerInfo.Playerinfo[5].PosX := Static[StaticP3RScoreBG].Texture.X; + PlayerInfo.Playerinfo[5].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; + end; + end; } + + // play music (I) + //Music.CaptureStart; + //Music.MoveTo(AktSong.Start); + + //Init Plugin + if not DLLMan.PluginInit(TeamInfo, PlayerInfo, ToSentences(Czesci[0]), LoadTex, Print, LoadSound, PlaySound) then + begin + //Fehler + Log.LogError('Could not Init Plugin'); + Halt; + end; + + // Set Background (Little Workaround, maybe change sometime) + if (DLLMan.Selected.LoadBack) AND (DLLMan.Selected.LoadSong) then + ScreenSing.Tex_Background := Tex_Background; + + Winner := 0; + + //Set Score Visibility + {if PlayersPlay = 1 then begin + Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; + end; + + if (PlayersPlay = 2) OR (PlayersPlay = 4) then begin + Text[TextP1TwoPScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1TwoPScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP2RScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP2RScoreBG].Visible := DLLMan.Selected.ShowScore; + end; + + if (PlayersPlay = 3) OR (PlayersPlay = 6) then begin + Text[TextP1ThreePScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1ThreePScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP2MScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP2MScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP3RScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP3RScoreBG].Visible := DLLMan.Selected.ShowScore; + end; } +end; + +function TScreenSingModi.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + S, I: integer; + T: integer; +begin +//Set Playerinfo + PlayerInfo.NumPlayers := PlayersPlay; + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + PlayerInfo.Playerinfo[I].Name := PChar(Player[I].Name); + if PlayerInfo.Playerinfo[I].Enabled then + begin + if (Player[I].ScoreTotalI<=10000) then + PlayerInfo.Playerinfo[I].Score:= Player[I].ScoreTotalI; + PlayerInfo.Playerinfo[I].Bar := Round(Scores.Players[I].RBPos * 100); + end; + end; + +//Show Score +if DLLMan.Selected.ShowScore then +begin + {//ScoreBG Mod + // set player colors + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + + + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P4Dark'); + + + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); + + + + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P3Dark'); + + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P6Dark'); + + + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); + + + + + end; + end; + //end ScoreBG Mod } + +// set player names (for 2 screens and only Singstar skin) + if ScreenAct = 1 then begin + Text[TextP1].Text := 'P1'; + Text[TextP1TwoP].Text := 'P1'; // added for ps3 skin + Text[TextP1ThreeP].Text := 'P1'; // added for ps3 skin + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; + end; + + if ScreenAct = 2 then begin + case PlayersPlay of + 4: begin + Text[TextP1TwoP].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 6: begin + Text[TextP1ThreeP].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end; + end; // case + end; // if + + + // stereo <- and where iss P2M? or P3? + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; + Text[TextP1].X := Text[TextP1].X + 10*ScreenX; + + {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; + Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; + + {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} + + // .. and scores + {if PlayersPlay = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + end; + + if PlayersPlay = 2 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + + if PlayersPlay = 3 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[4].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[5].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + end; } + +end; //ShowScore + + for S := 1 to 1 do + Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X + 10*ScreenX; + +if DLLMan.Selected.LoadSong then +begin + // update static menu with time ... + Min := Round(Czas.Teraz) div 60; + Sec := Round(Czas.Teraz) mod 60; + 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); +end; + + // draw static menu (BG) + DrawBG; + + //Draw Background + if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) then + SingDrawBackground; + + // comment by blindy: wo zum henker wird denn in diesem screen ein video abgespielt? + // update and draw movie + // wie wo wadd? also in der selben funktion in der uscreensing kommt des video in der zeile 995, oder was wollteste wissen? :X +{ if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin + UpdateSmpeg; // this only draws + end;} + + // draw static menu (FG) + DrawFG; + + if ShowFinish then begin + if DllMan.Selected.LoadSong then + begin + if (not AudioPlayback.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + //Pause Mod: + if not Paused then + Sing(Self); // analyze song + end else begin + if not FadeOut then begin + Finish; + FadeOut := true; + FadeTo(@ScreenPartyScore); + end; + end; + end; + end; + + // draw custom items + SingModiDraw(PlayerInfo); // always draw + + //GoldenNoteStarsTwinkle Mod + GoldenRec.SpawnRec; + //GoldenNoteStarsTwinkle Mod + + //Update PlayerInfo + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + if PlayerInfo.Playerinfo[I].Enabled then + begin + //PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; + PlayerInfo.Playerinfo[I].Score := Player[I].ScoreTotalI; + end; + end; + + if ((ShowFinish) AND (NOT Paused)) then + begin + if not DLLMan.PluginDraw(Playerinfo, Czesci[0].Akt) then + begin + if not FadeOut then begin + Finish; + FadeOut := true; + FadeTo(@ScreenPartyScore); + end; + end; + end; + + //Change PlayerInfo/Changeables + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + if (Player[I].ScoreTotalI <> PlayerInfo.Playerinfo[I].Score) then + begin + //Player[I].ScoreTotal := Player[I].ScoreTotal + (PlayerInfo.Playerinfo[I].Score - Player[I].ScoreTotalI); + Player[I].ScoreTotalI := PlayerInfo.Playerinfo[I].Score; + end; + {if (PlayerInfo.Playerinfo[I].Bar <> Player[I].ScorePercent) then + Player[I].ScorePercentTarget := PlayerInfo.Playerinfo[I].Bar; } + end; + + // back stereo + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; + Text[TextP1].X := Text[TextP1].X - 10*ScreenX; + + {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX;} + + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; + Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; + + {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX;} + + + for S := 1 to 1 do + Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X - 10*ScreenX; + + end; procedure TScreenSingModi.Finish; @@ -665,4 +662,4 @@ begin end; end. ->>>>>>> .r429 +>>>>>>> .r429 diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 4d146283..3f2f5d58 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1,12 +1,8 @@ unit UScreenSong; interface -{$I switches.inc} - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} +{$I switches.inc} uses @@ -813,7 +809,7 @@ begin try AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); except - {$IFDEF win32} + {$IFDEF MSWINDOWS} Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); {$ELSE} // TODO : JB_linux - better handle this message and display to user.. diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index de78665e..14228964 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -2,6 +2,8 @@ unit UScreenSongJumpto; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index c6e16f60..6f9b0c53 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -2,9 +2,7 @@ unit UScreenSongMenu; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} +{$I switches.inc} uses UMenu, diff --git a/Game/Code/Screens/UScreenStatDetail.pas b/Game/Code/Screens/UScreenStatDetail.pas index 1310b127..414055f9 100644 --- a/Game/Code/Screens/UScreenStatDetail.pas +++ b/Game/Code/Screens/UScreenStatDetail.pas @@ -2,6 +2,8 @@ unit UScreenStatDetail; interface +{$I switches.inc} + uses UMenu, SDL, SysUtils, UDisplay, UMusic, UIni, UThemes; 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; diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas index d0fe15c8..83ba2bb0 100644 --- a/Game/Code/Screens/UScreenTop5.pas +++ b/Game/Code/Screens/UScreenTop5.pas @@ -2,10 +2,7 @@ unit UScreenTop5; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - +{$I switches.inc} uses UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes, ULCD; diff --git a/Game/Code/Screens/UScreenWelcome.pas b/Game/Code/Screens/UScreenWelcome.pas index 35e159f8..fc088458 100644 --- a/Game/Code/Screens/UScreenWelcome.pas +++ b/Game/Code/Screens/UScreenWelcome.pas @@ -2,6 +2,8 @@ unit UScreenWelcome; interface +{$I switches.inc} + uses UMenu, SDL, SysUtils, UThemes; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 536ef6be..80312bd1 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -158,250 +158,10 @@ uses Windows, SysUtils; - -const - Version = 'UltraStar Deluxe V 1.10 Alpha Build'; - -var - WndTitle: string; - hWnd: THandle; - I: Integer; + + // eddie: I had to move the main procedure to UMain.pas, because + // I can't use the dpr file with Xcode on the mac. begin - WndTitle := Version; - -// InitializeSound(); -// writeln( 'DONE' ); -// exit; - - - //------------------------------ - //Start more than One Time Prevention - //------------------------------ - hWnd:= FindWindow(nil, PChar(WndTitle)); - //Programm already started - if (hWnd <> 0) then - begin - I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Continue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); - if (I = IDYes) then - begin - I := 1; - repeat - Inc(I); - hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); - until (hWnd = 0); - WndTitle := WndTitle + ' Instance ' + InttoStr(I); - end - else - Exit; - end; - - //------------------------------ - //StartUp - Create Classes and Load Files - //------------------------------ - USTime := TTime.Create; - - // Commandline Parameter Parser - Params := TCMDParams.Create; - - // Log + Benchmark - Log := TLog.Create; - Log.Title := WndTitle; - Log.Enabled := Not Params.NoLog; - Log.BenchmarkStart(0); - - // Language - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Paths', 'Initialization'); InitializePaths; - Log.LogStatus('Load Language', 'Initialization'); Language := TLanguage.Create; - //Add Const Values: - Language.AddConst('US_VERSION', Version); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Language', 1); - - // SDL - Log.BenchmarkStart(1); - Log.LogStatus('Initialize SDL', 'Initialization'); - SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing SDL', 1); - - // SDL_ttf - Log.BenchmarkStart(1); - Log.LogStatus('Initialize SDL_ttf', 'Initialization'); - TTF_Init(); //ttf_quit(); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing SDL_ttf', 1); - - // Skin - Log.BenchmarkStart(1); - Log.LogStatus('Loading Skin List', 'Initialization'); Skin := TSkin.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Skin List', 1); - - // Sound Card List - Log.BenchmarkStart(1); - Log.LogStatus('Loading Soundcard list', 'Initialization'); - Recording := TRecord.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Soundcard list', 1); - - // Ini + Paths - Log.BenchmarkStart(1); - Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; - Ini.Load; - - //Load Languagefile - if (Params.Language <> -1) then - Language.ChangeLanguage(ILanguage[Params.Language]) - else - Language.ChangeLanguage(ILanguage[Ini.Language]); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Ini', 1); - - - // LCD - Log.BenchmarkStart(1); - Log.LogStatus('Load LCD', 'Initialization'); LCD := TLCD.Create; - if Ini.LPT = 1 then begin -// LCD.HalfInterface := true; - LCD.Enable; - LCD.Clear; - LCD.WriteText(1, ' UltraStar '); - LCD.WriteText(2, ' Loading... '); - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading LCD', 1); - - // Light - Log.BenchmarkStart(1); - Log.LogStatus('Load Light', 'Initialization'); Light := TLight.Create; - if Ini.LPT = 2 then begin - Light.Enable; - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Light', 1); - - - - // Theme - Log.BenchmarkStart(1); - Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Themes', 1); - - // Covers Cache - Log.BenchmarkStart(1); - Log.LogStatus('Creating Covers Cache', 'Initialization'); Covers := TCovers.Create; - Log.LogBenchmark('Loading Covers Cache Array', 1); - Log.BenchmarkStart(1); - - // Category Covers - Log.BenchmarkStart(1); - Log.LogStatus('Creating Category Covers Array', 'Initialization'); - CatCovers:= TCatCovers.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Category Covers Array', 1); - - // Songs - //Log.BenchmarkStart(1); - Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; - Songs.LoadSongList; - Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Songs', 1); - - // PluginManager - Log.BenchmarkStart(1); - Log.LogStatus('PluginManager', 'Initialization'); - DLLMan := TDLLMan.Create; //Load PluginList - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PluginManager', 1); - - // Party Mode Manager - Log.BenchmarkStart(1); - Log.LogStatus('PartySession Manager', 'Initialization'); - PartySession := TParty_Session.Create; //Load PartySession - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PartySession Manager', 1); - - // Sound - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Sound', 'Initialization'); InitializeSound(); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Sound', 1); - -// exit; - - // Graphics - Log.BenchmarkStart(1); - Log.LogStatus('Initialize 3D', 'Initialization'); Initialize3D(WndTitle); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing 3D', 1); - - // Score Saving System - Log.BenchmarkStart(1); - Log.LogStatus('DataBase System', 'Initialization'); - DataBase := TDataBaseSystem.Create; - - if (Params.ScoreFile = '') then - DataBase.Init ('Ultrastar.db') - else - DataBase.Init (Params.ScoreFile); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading DataBase System', 1); - - //Playlist Manager - Log.BenchmarkStart(1); - Log.LogStatus('Playlist Manager', 'Initialization'); - PlaylistMan := TPlaylistManager.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Playlist Manager', 1); - - //GoldenStarsTwinkleMod - Log.BenchmarkStart(1); - Log.LogStatus('Effect Manager', 'Initialization'); - GoldenRec := TEffectManager.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Particel System', 1); - - // Joypad - if (Ini.Joypad = 1) OR (Params.Joypad) then begin - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Joystick', 'Initialization'); Joy := TJoy.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Joystick', 1); - end; - - Log.BenchmarkEnd(0); - Log.LogBenchmark('Loading Time', 0); - - Log.LogError('Creating Core'); - Core := TCore.Create('Ultrastar Deluxe Beta', MakeVersion(1,1,0, chr(0))); - - Log.LogError('Running Core'); - Core.Run; - - //------------------------------ - //Start- Mainloop - //------------------------------ - //Music.SetLoop(true); - //Music.SetVolume(50); - //Music.Open(SkinPath + 'Menu Music 3.mp3'); - //Music.Play; - Log.LogStatus('Main Loop', 'Initialization'); MainLoop; - - //------------------------------ - //Finish Application - //------------------------------ - if Ini.LPT = 1 then LCD.Clear; - if Ini.LPT = 2 then Light.TurnOff; - - Log.LogStatus('Main Loop', 'Finished'); - - Log.Free; - -end. \ No newline at end of file + Main; +end. \ No newline at end of file diff --git a/Game/Code/lib/FreeImage/FreeBitmap.pas b/Game/Code/lib/FreeImage/FreeBitmap.pas new file mode 100755 index 00000000..47be822e --- /dev/null +++ b/Game/Code/lib/FreeImage/FreeBitmap.pas @@ -0,0 +1,1740 @@ +unit FreeBitmap; + +{$I switches.inc} + + +// ========================================================== +// +// Delphi wrapper for FreeImage 3 +// +// Design and implementation by +// - Anatoliy Pulyaevskiy (xvel84@rambler.ru) +// +// Contributors: +// - Enzo Costantini (enzocostantini@libero.it) +// +// This file is part of FreeImage 3 +// +// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY +// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES +// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE +// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED +// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT +// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY +// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL +// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER +// THIS DISCLAIMER. +// +// Use at your own risk! +// +// ========================================================== +// +// From begining all code of this file is based on C++ wrapper to +// FreeImage - FreeImagePlus. +// +// ========================================================== + +interface + +uses + SysUtils, Classes, Windows, FreeImage; + +type + { TFreeObject } + + TFreeObject = class(TObject) + public + function IsValid: Boolean; virtual; + end; + + { TFreeTag } + + TFreeTag = class(TFreeObject) + private + // fields + FTag: PFITAG; + + // getters & setters + function GetCount: Cardinal; + function GetDescription: string; + function GetID: Word; + function GetKey: string; + function GetLength: Cardinal; + function GetTagType: FREE_IMAGE_MDTYPE; + function GetValue: Pointer; + procedure SetCount(const Value: Cardinal); + procedure SetDescription(const Value: string); + procedure SetID(const Value: Word); + procedure SetKey(const Value: string); + procedure SetLength(const Value: Cardinal); + procedure SetTagType(const Value: FREE_IMAGE_MDTYPE); + procedure SetValue(const Value: Pointer); + public + // construction & destruction + constructor Create(ATag: PFITAG = nil); virtual; + destructor Destroy; override; + + // methods + function Clone: TFreeTag; + function IsValid: Boolean; override; + function ToString(Model: FREE_IMAGE_MDMODEL; Make: PChar = nil): string; + + // properties + property Key: string read GetKey write SetKey; + property Description: string read GetDescription write SetDescription; + property ID: Word read GetID write SetID; + property TagType: FREE_IMAGE_MDTYPE read GetTagType write SetTagType; + property Count: Cardinal read GetCount write SetCount; + property Length: Cardinal read GetLength write SetLength; + property Value: Pointer read GetValue write SetValue; + property Tag: PFITAG read FTag; + end; + + { forward declarations } + + TFreeBitmap = class; + TFreeMemoryIO = class; + + { TFreeBitmap } + + TFreeBitmapChangingEvent = procedure(Sender: TFreeBitmap; var OldDib, NewDib: PFIBITMAP; var Handled: Boolean) of object; + + TFreeBitmap = class(TFreeObject) + private + // fields + FDib: PFIBITMAP; + FOnChange: TNotifyEvent; + FOnChanging: TFreeBitmapChangingEvent; + + procedure SetDib(Value: PFIBITMAP); + protected + function DoChanging(var OldDib, NewDib: PFIBITMAP): Boolean; dynamic; + function Replace(NewDib: PFIBITMAP): Boolean; dynamic; + public + constructor Create(ImageType: FREE_IMAGE_TYPE = FIT_BITMAP; Width: Integer = 0; Height: Integer = 0; Bpp: Integer = 0); + destructor Destroy; override; + function SetSize(ImageType: FREE_IMAGE_TYPE; Width, Height, Bpp: Integer; RedMask: Cardinal = 0; GreenMask: Cardinal = 0; BlueMask: Cardinal = 0): Boolean; + procedure Change; dynamic; + procedure Assign(Source: TFreeBitmap); + function CopySubImage(Left, Top, Right, Bottom: Integer; Dest: TFreeBitmap): Boolean; + function PasteSubImage(Src: TFreeBitmap; Left, Top: Integer; Alpha: Integer = 256): Boolean; + procedure Clear; virtual; + function Load(const FileName: string; Flag: Integer = 0): Boolean; + function LoadU(const FileName: WideString; Flag: Integer = 0): Boolean; + function LoadFromHandle(IO: PFreeImageIO; Handle: fi_handle; Flag: Integer = 0): Boolean; + function LoadFromMemory(MemIO: TFreeMemoryIO; Flag: Integer = 0): Boolean; + function LoadFromStream(Stream: TStream; Flag: Integer = 0): Boolean; + // save functions + function CanSave(fif: FREE_IMAGE_FORMAT): Boolean; + function Save(const FileName: string; Flag: Integer = 0): Boolean; + function SaveU(const FileName: WideString; Flag: Integer = 0): Boolean; + function SaveToHandle(fif: FREE_IMAGE_FORMAT; IO: PFreeImageIO; Handle: fi_handle; Flag: Integer = 0): Boolean; + function SaveToMemory(fif: FREE_IMAGE_FORMAT; MemIO: TFreeMemoryIO; Flag: Integer = 0): Boolean; + function SaveToStream(fif: FREE_IMAGE_FORMAT; Stream: TStream; Flag: Integer = 0): Boolean; + // image information + function GetImageType: FREE_IMAGE_TYPE; + function GetWidth: Integer; + function GetHeight: Integer; + function GetScanWidth: Integer; + function IsValid: Boolean; override; + function GetInfo: PBitmapInfo; + function GetInfoHeader: PBitmapInfoHeader; + function GetImageSize: Cardinal; + function GetBitsPerPixel: Integer; + function GetLine: Integer; + function GetHorizontalResolution: Double; + function GetVerticalResolution: Double; + procedure SetHorizontalResolution(Value: Double); + procedure SetVerticalResolution(Value: Double); + // palette operations + function GetPalette: PRGBQUAD; + function GetPaletteSize: Integer; + function GetColorsUsed: Integer; + function GetColorType: FREE_IMAGE_COLOR_TYPE; + function IsGrayScale: Boolean; + // pixels access + function AccessPixels: PByte; + function GetScanLine(ScanLine: Integer): PByte; + function GetPixelIndex(X, Y: Cardinal; var Value: PByte): Boolean; + function GetPixelColor(X, Y: Cardinal; Value: PRGBQUAD): Boolean; + function SetPixelIndex(X, Y: Cardinal; Value: PByte): Boolean; + function SetPixelColor(X, Y: Cardinal; Value: PRGBQUAD): Boolean; + // convertion + function ConvertToStandardType(ScaleLinear: Boolean): Boolean; + function ConvertToType(ImageType: FREE_IMAGE_TYPE; ScaleLinear: Boolean): Boolean; + function Threshold(T: Byte): Boolean; + function ConvertTo4Bits: Boolean; + function ConvertTo8Bits: Boolean; + function ConvertTo16Bits555: Boolean; + function ConvertTo16Bits565: Boolean; + function ConvertTo24Bits: Boolean; + function ConvertTo32Bits: Boolean; + function ConvertToGrayscale: Boolean; + function ColorQuantize(Algorithm: FREE_IMAGE_QUANTIZE): Boolean; + function Dither(Algorithm: FREE_IMAGE_DITHER): Boolean; + function ConvertToRGBF: Boolean; + function ToneMapping(TMO: FREE_IMAGE_TMO; FirstParam, SecondParam: Double): Boolean; + // transparency + function IsTransparent: Boolean; + function GetTransparencyCount: Cardinal; + function GetTransparencyTable: PByte; + procedure SetTransparencyTable(Table: PByte; Count: Integer); + function HasFileBkColor: Boolean; + function GetFileBkColor(var BkColor: PRGBQuad): Boolean; + function SetFileBkColor(BkColor: PRGBQuad): Boolean; + // channel processing routines + function GetChannel(Bitmap: TFreeBitmap; Channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; + function SetChannel(Bitmap: TFreeBitmap; Channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; + function SplitChannels(RedChannel, GreenChannel, BlueChannel: TFreeBitmap): Boolean; + function CombineChannels(Red, Green, Blue: TFreeBitmap): Boolean; + // rotation and flipping + function RotateEx(Angle, XShift, YShift, XOrigin, YOrigin: Double; UseMask: Boolean): Boolean; + function Rotate(Angle: Double): Boolean; + function FlipHorizontal: Boolean; + function FlipVertical: Boolean; + // color manipulation routines + function Invert: Boolean; + function AdjustCurve(Lut: PByte; Channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; + function AdjustGamma(Gamma: Double): Boolean; + function AdjustBrightness(Percentage: Double): Boolean; + function AdjustContrast(Percentage: Double): Boolean; + function GetHistogram(Histo: PDWORD; Channel: FREE_IMAGE_COLOR_CHANNEL = FICC_BLACK): Boolean; + // upsampling / downsampling + procedure MakeThumbnail(const Width, Height: Integer; DestBitmap: TFreeBitmap); + function Rescale(NewWidth, NewHeight: Integer; Filter: FREE_IMAGE_FILTER; Dest: TFreeBitmap = nil): Boolean; + // metadata routines + function FindFirstMetadata(Model: FREE_IMAGE_MDMODEL; var Tag: TFreeTag): PFIMETADATA; + function FindNextMetadata(MDHandle: PFIMETADATA; var Tag: TFreeTag): Boolean; + procedure FindCloseMetadata(MDHandle: PFIMETADATA); + function SetMetadata(Model: FREE_IMAGE_MDMODEL; const Key: string; Tag: TFreeTag): Boolean; + function GetMetadata(Model: FREE_IMAGE_MDMODEL; const Key: string; var Tag: TFreeTag): Boolean; + function GetMetadataCount(Model: FREE_IMAGE_MDMODEL): Cardinal; + + // properties + property Dib: PFIBITMAP read FDib write SetDib; + property OnChange: TNotifyEvent read FOnChange write FOnChange; + property OnChanging: TFreeBitmapChangingEvent read FOnChanging write FOnChanging; + end; + + { TFreeWinBitmap } + + + { TFreeMemoryIO } + + TFreeMemoryIO = class(TFreeObject) + private + FHMem: PFIMEMORY; + public + // construction and destruction + constructor Create(Data: PByte = nil; SizeInBytes: DWORD = 0); + destructor Destroy; override; + + function GetFileType: FREE_IMAGE_FORMAT; + function Read(fif: FREE_IMAGE_FORMAT; Flag: Integer = 0): PFIBITMAP; + function Write(fif: FREE_IMAGE_FORMAT; dib: PFIBITMAP; Flag: Integer = 0): Boolean; + function Tell: Longint; + function Seek(Offset: Longint; Origin: Word): Boolean; + function Acquire(var Data: PByte; var SizeInBytes: DWORD): Boolean; + // overriden methods + function IsValid: Boolean; override; + end; + + { TFreeMultiBitmap } + + TFreeMultiBitmap = class(TFreeObject) + private + FMPage: PFIMULTIBITMAP; + FMemoryCache: Boolean; + public + // constructor and destructor + constructor Create(KeepCacheInMemory: Boolean = False); + destructor Destroy; override; + + // methods + function Open(const FileName: string; CreateNew, ReadOnly: Boolean; Flags: Integer = 0): Boolean; + function Close(Flags: Integer = 0): Boolean; + function GetPageCount: Integer; + procedure AppendPage(Bitmap: TFreeBitmap); + procedure InsertPage(Page: Integer; Bitmap: TFreeBitmap); + procedure DeletePage(Page: Integer); + function MovePage(Target, Source: Integer): Boolean; + procedure LockPage(Page: Integer; DestBitmap: TFreeBitmap); + procedure UnlockPage(Bitmap: TFreeBitmap; Changed: Boolean); + function GetLockedPageNumbers(var Pages: Integer; var Count: Integer): Boolean; + // overriden methods + function IsValid: Boolean; override; + + // properties + // change of this property influences only on the next opening of a file + property MemoryCache: Boolean read FMemoryCache write FMemoryCache; + end; + +implementation + +const + ThumbSize = 150; + +// marker used for clipboard copy / paste + +procedure SetFreeImageMarker(bmih: PBitmapInfoHeader; dib: PFIBITMAP); +begin + // Windows constants goes from 0L to 5L + // Add $FF to avoid conflicts + bmih.biCompression := $FF + FreeImage_GetImageType(dib); +end; + +function GetFreeImageMarker(bmih: PBitmapInfoHeader): FREE_IMAGE_TYPE; +begin + Result := FREE_IMAGE_TYPE(bmih.biCompression - $FF); +end; + +{ TFreePersistent } + +function TFreeObject.IsValid: Boolean; +begin + Result := False +end; + +{ TFreeBitmap } + +function TFreeBitmap.AccessPixels: PByte; +begin + Result := FreeImage_GetBits(FDib) +end; + +function TFreeBitmap.AdjustBrightness(Percentage: Double): Boolean; +begin + if FDib <> nil then + begin + Result := FreeImage_AdjustBrightness(FDib, Percentage); + Change; + end + else + Result := False +end; + +function TFreeBitmap.AdjustContrast(Percentage: Double): Boolean; +begin + if FDib <> nil then + begin + Result := FreeImage_AdjustContrast(FDib, Percentage); + Change; + end + else + Result := False +end; + +function TFreeBitmap.AdjustCurve(Lut: PByte; + Channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; +begin + if FDib <> nil then + begin + Result := FreeImage_AdjustCurve(FDib, Lut, Channel); + Change; + end + else + Result := False +end; + +function TFreeBitmap.AdjustGamma(Gamma: Double): Boolean; +begin + if FDib <> nil then + begin + Result := FreeImage_AdjustGamma(FDib, Gamma); + Change; + end + else + Result := False +end; + +procedure TFreeBitmap.Assign(Source: TFreeBitmap); +var + SourceBmp: TFreeBitmap; + Clone: PFIBITMAP; +begin + if Source = nil then + begin + Clear; + Exit; + end; + + if Source is TFreeBitmap then + begin + SourceBmp := TFreeBitmap(Source); + if SourceBmp <> Self then + begin + if SourceBmp.IsValid then + begin + Clone := FreeImage_Clone(SourceBmp.FDib); + Replace(Clone); + end + else + Clear; + end; + end; +end; + +function TFreeBitmap.CanSave(fif: FREE_IMAGE_FORMAT): Boolean; +var + ImageType: FREE_IMAGE_TYPE; + Bpp: Word; +begin + Result := False; + if not IsValid then Exit; + + if fif <> FIF_UNKNOWN then + begin + // check that the dib can be saved in this format + ImageType := FreeImage_GetImageType(FDib); + if ImageType = FIT_BITMAP then + begin + // standard bitmap type + Bpp := FreeImage_GetBPP(FDib); + Result := FreeImage_FIFSupportsWriting(fif) + and FreeImage_FIFSupportsExportBPP(fif, Bpp); + end + else // special bitmap type + Result := FreeImage_FIFSupportsExportType(fif, ImageType); + end; +end; + +procedure TFreeBitmap.Change; +begin + if Assigned(FOnChange) then FOnChange(Self) +end; + +procedure TFreeBitmap.Clear; +begin + if FDib <> nil then + begin + FreeImage_Unload(FDib); + FDib := nil; + Change; + end; +end; + +function TFreeBitmap.ColorQuantize( + Algorithm: FREE_IMAGE_QUANTIZE): Boolean; +var + dib8: PFIBITMAP; +begin + if FDib <> nil then + begin + dib8 := FreeImage_ColorQuantize(FDib, Algorithm); + Result := Replace(dib8); + end + else + Result := False; +end; + +function TFreeBitmap.CombineChannels(Red, Green, + Blue: TFreeBitmap): Boolean; +var + Width, Height: Integer; +begin + if FDib = nil then + begin + Width := Red.GetWidth; + Height := Red.GetHeight; + FDib := FreeImage_Allocate(Width, Height, 24, FI_RGBA_RED_MASK, + FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK); + end; + + if FDib <> nil then + begin + Result := FreeImage_SetChannel(FDib, Red.FDib, FICC_RED) and + FreeImage_SetChannel(FDib, Green.FDib, FICC_GREEN) and + FreeImage_SetChannel(FDib, Blue.FDib, FICC_BLUE); + + Change + end + else + Result := False; +end; + +function TFreeBitmap.ConvertTo16Bits555: Boolean; +var + dib16_555: PFIBITMAP; +begin + if FDib <> nil then + begin + dib16_555 := FreeImage_ConvertTo16Bits555(FDib); + Result := Replace(dib16_555); + end + else + Result := False +end; + +function TFreeBitmap.ConvertTo16Bits565: Boolean; +var + dib16_565: PFIBITMAP; +begin + if FDib <> nil then + begin + dib16_565 := FreeImage_ConvertTo16Bits565(FDib); + Result := Replace(dib16_565); + end + else + Result := False +end; + +function TFreeBitmap.ConvertTo24Bits: Boolean; +var + dibRGB: PFIBITMAP; +begin + if FDib <> nil then + begin + dibRGB := FreeImage_ConvertTo24Bits(FDib); + Result := Replace(dibRGB); + end + else + Result := False +end; + +function TFreeBitmap.ConvertTo32Bits: Boolean; +var + dib32: PFIBITMAP; +begin + if FDib <> nil then + begin + dib32 := FreeImage_ConvertTo32Bits(FDib); + Result := Replace(dib32); + end + else + Result := False +end; + +function TFreeBitmap.ConvertTo4Bits: Boolean; +var + dib4: PFIBITMAP; +begin + Result := False; + if IsValid then + begin + dib4 := FreeImage_ConvertTo4Bits(FDib); + Result := Replace(dib4); + end; +end; + +function TFreeBitmap.ConvertTo8Bits: Boolean; +var + dib8: PFIBITMAP; +begin + if FDib <> nil then + begin + dib8 := FreeImage_ConvertTo8Bits(FDib); + Result := Replace(dib8); + end + else + Result := False +end; + +function TFreeBitmap.ConvertToGrayscale: Boolean; +var + dib8: PFIBITMAP; +begin + Result := False; + + if IsValid then + begin + dib8 := FreeImage_ConvertToGreyscale(FDib); + Result := Replace(dib8); + end +end; + +function TFreeBitmap.ConvertToRGBF: Boolean; +var + ImageType: FREE_IMAGE_TYPE; + NewDib: PFIBITMAP; +begin + Result := False; + if not IsValid then Exit; + + ImageType := GetImageType; + + if (ImageType = FIT_BITMAP) then + begin + if GetBitsPerPixel < 24 then + if not ConvertTo24Bits then + Exit + end; + NewDib := FreeImage_ConvertToRGBF(FDib); + Result := Replace(NewDib); +end; + +function TFreeBitmap.ConvertToStandardType(ScaleLinear: Boolean): Boolean; +var + dibStandard: PFIBITMAP; +begin + if IsValid then + begin + dibStandard := FreeImage_ConvertToStandardType(FDib, ScaleLinear); + Result := Replace(dibStandard); + end + else + Result := False; +end; + +function TFreeBitmap.ConvertToType(ImageType: FREE_IMAGE_TYPE; + ScaleLinear: Boolean): Boolean; +var + dib: PFIBITMAP; +begin + if FDib <> nil then + begin + dib := FreeImage_ConvertToType(FDib, ImageType, ScaleLinear); + Result := Replace(dib) + end + else + Result := False +end; + +function TFreeBitmap.CopySubImage(Left, Top, Right, Bottom: Integer; + Dest: TFreeBitmap): Boolean; +begin + if FDib <> nil then + begin + Dest.FDib := FreeImage_Copy(FDib, Left, Top, Right, Bottom); + Result := Dest.IsValid; + end else + Result := False; +end; + +constructor TFreeBitmap.Create(ImageType: FREE_IMAGE_TYPE; Width, Height, + Bpp: Integer); +begin + inherited Create; + + FDib := nil; + if (Width > 0) and (Height > 0) and (Bpp > 0) then + SetSize(ImageType, Width, Height, Bpp); +end; + +destructor TFreeBitmap.Destroy; +begin + if FDib <> nil then + FreeImage_Unload(FDib); + inherited; +end; + +function TFreeBitmap.Dither(Algorithm: FREE_IMAGE_DITHER): Boolean; +var + dib: PFIBITMAP; +begin + if FDib <> nil then + begin + dib := FreeImage_Dither(FDib, Algorithm); + Result := Replace(dib); + end + else + Result := False; +end; + +function TFreeBitmap.DoChanging(var OldDib, NewDib: PFIBITMAP): Boolean; +begin + Result := False; + if (OldDib <> NewDib) and Assigned(FOnChanging) then + FOnChanging(Self, OldDib, NewDib, Result); +end; + +procedure TFreeBitmap.FindCloseMetadata(MDHandle: PFIMETADATA); +begin + FreeImage_FindCloseMetadata(MDHandle); +end; + +function TFreeBitmap.FindFirstMetadata(Model: FREE_IMAGE_MDMODEL; + var Tag: TFreeTag): PFIMETADATA; +begin + Result := FreeImage_FindFirstMetadata(Model, FDib, Tag.FTag); +end; + +function TFreeBitmap.FindNextMetadata(MDHandle: PFIMETADATA; + var Tag: TFreeTag): Boolean; +begin + Result := FreeImage_FindNextMetadata(MDHandle, Tag.FTag); +end; + +function TFreeBitmap.FlipHorizontal: Boolean; +begin + if FDib <> nil then + begin + Result := FreeImage_FlipHorizontal(FDib); + Change; + end + else + Result := False +end; + +function TFreeBitmap.FlipVertical: Boolean; +begin + if FDib <> nil then + begin + Result := FreeImage_FlipVertical(FDib); + Change; + end + else + Result := False +end; + +function TFreeBitmap.GetBitsPerPixel: Integer; +begin + Result := FreeImage_GetBPP(FDib) +end; + +function TFreeBitmap.GetChannel(Bitmap: TFreeBitmap; + Channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; +begin + if FDib <> nil then + begin + Bitmap.Dib := FreeImage_GetChannel(FDib, Channel); + Result := Bitmap.IsValid; + end + else + Result := False +end; + +function TFreeBitmap.GetColorsUsed: Integer; +begin + Result := FreeImage_GetColorsUsed(FDib) +end; + +function TFreeBitmap.GetColorType: FREE_IMAGE_COLOR_TYPE; +begin + Result := FreeImage_GetColorType(FDib); +end; + +function TFreeBitmap.GetFileBkColor(var BkColor: PRGBQuad): Boolean; +begin + Result := FreeImage_GetBackgroundColor(FDib, BkColor) +end; + +function TFreeBitmap.GetHeight: Integer; +begin + Result := FreeImage_GetHeight(FDib) +end; + +function TFreeBitmap.GetHistogram(Histo: PDWORD; + Channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; +begin + if FDib <> nil then + Result := FreeImage_GetHistogram(FDib, Histo, Channel) + else + Result := False +end; + +function TFreeBitmap.GetHorizontalResolution: Double; +begin + Result := FreeImage_GetDotsPerMeterX(FDib) / 100 +end; + +function TFreeBitmap.GetImageSize: Cardinal; +begin + Result := FreeImage_GetDIBSize(FDib); +end; + +function TFreeBitmap.GetImageType: FREE_IMAGE_TYPE; +begin + Result := FreeImage_GetImageType(FDib); +end; + +function TFreeBitmap.GetInfo: PBitmapInfo; +begin + Result := FreeImage_GetInfo(FDib^) +end; + +function TFreeBitmap.GetInfoHeader: PBITMAPINFOHEADER; +begin + Result := FreeImage_GetInfoHeader(FDib) +end; + +function TFreeBitmap.GetLine: Integer; +begin + Result := FreeImage_GetLine(FDib) +end; + +function TFreeBitmap.GetMetadata(Model: FREE_IMAGE_MDMODEL; + const Key: string; var Tag: TFreeTag): Boolean; +begin + Result := FreeImage_GetMetaData(Model, FDib, PChar(Key), Tag.FTag); +end; + +function TFreeBitmap.GetMetadataCount(Model: FREE_IMAGE_MDMODEL): Cardinal; +begin + Result := FreeImage_GetMetadataCount(Model, FDib); +end; + +function TFreeBitmap.GetPalette: PRGBQUAD; +begin + Result := FreeImage_GetPalette(FDib) +end; + +function TFreeBitmap.GetPaletteSize: Integer; +begin + Result := FreeImage_GetColorsUsed(FDib) * SizeOf(RGBQUAD) +end; + +function TFreeBitmap.GetPixelColor(X, Y: Cardinal; Value: PRGBQUAD): Boolean; +begin + Result := FreeImage_GetPixelColor(FDib, X, Y, Value) +end; + +function TFreeBitmap.GetPixelIndex(X, Y: Cardinal; + var Value: PByte): Boolean; +begin + Result := FreeImage_GetPixelIndex(FDib, X, Y, Value) +end; + +function TFreeBitmap.GetScanLine(ScanLine: Integer): PByte; +var + H: Integer; +begin + H := FreeImage_GetHeight(FDib); + if ScanLine < H then + Result := FreeImage_GetScanLine(FDib, ScanLine) + else + Result := nil; +end; + +function TFreeBitmap.GetScanWidth: Integer; +begin + Result := FreeImage_GetPitch(FDib) +end; + +function TFreeBitmap.GetTransparencyCount: Cardinal; +begin + Result := FreeImage_GetTransparencyCount(FDib) +end; + +function TFreeBitmap.GetTransparencyTable: PByte; +begin + Result := FreeImage_GetTransparencyTable(FDib) +end; + +function TFreeBitmap.GetVerticalResolution: Double; +begin + Result := FreeImage_GetDotsPerMeterY(Fdib) / 100 +end; + +function TFreeBitmap.GetWidth: Integer; +begin + Result := FreeImage_GetWidth(FDib) +end; + +function TFreeBitmap.HasFileBkColor: Boolean; +begin + Result := FreeImage_HasBackgroundColor(FDib) +end; + +function TFreeBitmap.Invert: Boolean; +begin + if FDib <> nil then + begin + Result := FreeImage_Invert(FDib); + Change; + end + else + Result := False +end; + +function TFreeBitmap.IsGrayScale: Boolean; +begin + Result := (FreeImage_GetBPP(FDib) = 8) + and (FreeImage_GetColorType(FDib) = FIC_PALETTE); +end; + +function TFreeBitmap.IsTransparent: Boolean; +begin + Result := FreeImage_IsTransparent(FDib); +end; + +function TFreeBitmap.IsValid: Boolean; +begin + Result := FDib <> nil +end; + +function TFreeBitmap.Load(const FileName: string; Flag: Integer): Boolean; +var + fif: FREE_IMAGE_FORMAT; +begin + + // check the file signature and get its format + fif := FreeImage_GetFileType(PChar(Filename), 0); + if fif = FIF_UNKNOWN then + // no signature? + // try to guess the file format from the file extention + fif := FreeImage_GetFIFFromFilename(PChar(FileName)); + + // check that the plugin has reading capabilities ... + if (fif <> FIF_UNKNOWN) and FreeImage_FIFSupportsReading(FIF) then + begin + // free the previous dib + if FDib <> nil then + FreeImage_Unload(dib); + + // load the file + FDib := FreeImage_Load(fif, PChar(FileName), Flag); + + Change; + Result := IsValid; + end else + Result := False; +end; + +function TFreeBitmap.LoadFromHandle(IO: PFreeImageIO; Handle: fi_handle; + Flag: Integer): Boolean; +var + fif: FREE_IMAGE_FORMAT; +begin + // check the file signature and get its format + fif := FreeImage_GetFileTypeFromHandle(IO, Handle, 16); + if (fif <> FIF_UNKNOWN) and FreeImage_FIFSupportsReading(fif) then + begin + // free the previous dib + if FDib <> nil then + FreeImage_Unload(FDib); + + // load the file + FDib := FreeImage_LoadFromHandle(fif, IO, Handle, Flag); + + Change; + Result := IsValid; + end else + Result := False; +end; + +function TFreeBitmap.LoadFromMemory(MemIO: TFreeMemoryIO; + Flag: Integer): Boolean; +var + fif: FREE_IMAGE_FORMAT; +begin + + // check the file signature and get its format + fif := MemIO.GetFileType; + if (fif <> FIF_UNKNOWN) and FreeImage_FIFSupportsReading(fif) then + begin + // free the previous dib + if FDib <> nil then + FreeImage_Unload(FDib); + + // load the file + FDib := MemIO.Read(fif, Flag); + + Result := IsValid; + Change; + end else + Result := False; +end; + +function TFreeBitmap.LoadFromStream(Stream: TStream; + Flag: Integer): Boolean; +var + MemIO: TFreeMemoryIO; + Data: PByte; + MemStream: TMemoryStream; + Size: Cardinal; +begin + Size := Stream.Size; + + MemStream := TMemoryStream.Create; + try + MemStream.CopyFrom(Stream, Size); + Data := MemStream.Memory; + + MemIO := TFreeMemoryIO.Create(Data, Size); + try + Result := LoadFromMemory(MemIO); + finally + MemIO.Free; + end; + finally + MemStream.Free; + end; +end; + +function TFreeBitmap.LoadU(const FileName: WideString; + Flag: Integer): Boolean; +var + fif: FREE_IMAGE_FORMAT; +begin + + // check the file signature and get its format + fif := FreeImage_GetFileTypeU(PWideChar(Filename), 0); + if fif = FIF_UNKNOWN then + // no signature? + // try to guess the file format from the file extention + fif := FreeImage_GetFIFFromFilenameU(PWideChar(FileName)); + + // check that the plugin has reading capabilities ... + if (fif <> FIF_UNKNOWN) and FreeImage_FIFSupportsReading(FIF) then + begin + // free the previous dib + if FDib <> nil then + FreeImage_Unload(dib); + + // load the file + FDib := FreeImage_LoadU(fif, PWideChar(FileName), Flag); + + Change; + Result := IsValid; + end else + Result := False; +end; + +procedure TFreeBitmap.MakeThumbnail(const Width, Height: Integer; + DestBitmap: TFreeBitmap); +type + PRGB24 = ^TRGB24; + TRGB24 = packed record + B: Byte; + G: Byte; + R: Byte; + end; +var + x, y, ix, iy: integer; + x1, x2, x3: integer; + + xscale, yscale: single; + iRed, iGrn, iBlu, iRatio: Longword; + p, c1, c2, c3, c4, c5: TRGB24; + pt, pt1: PRGB24; + iSrc, iDst, s1: integer; + i, j, r, g, b, tmpY: integer; + + RowDest, RowSource, RowSourceStart: integer; + w, h: Integer; + dxmin, dymin: integer; + ny1, ny2, ny3: integer; + dx, dy: integer; + lutX, lutY: array of integer; + + SrcBmp, DestBmp: PFIBITMAP; +begin + if not IsValid then Exit; + + if (GetWidth <= ThumbSize) and (GetHeight <= ThumbSize) then + begin + DestBitmap.Assign(Self); + Exit; + end; + + w := Width; + h := Height; + + // prepare bitmaps + if GetBitsPerPixel <> 24 then + SrcBmp := FreeImage_ConvertTo24Bits(FDib) + else + SrcBmp := FDib; + DestBmp := FreeImage_Allocate(w, h, 24); + Assert(DestBmp <> nil, 'TFreeBitmap.MakeThumbnail error'); + +{ iDst := (w * 24 + 31) and not 31; + iDst := iDst div 8; //BytesPerScanline + iSrc := (GetWidth * 24 + 31) and not 31; + iSrc := iSrc div 8; +} + // BytesPerScanline + iDst := FreeImage_GetPitch(DestBmp); + iSrc := FreeImage_GetPitch(SrcBmp); + + xscale := 1 / (w / FreeImage_GetWidth(SrcBmp)); + yscale := 1 / (h / FreeImage_GetHeight(SrcBmp)); + + // X lookup table + SetLength(lutX, w); + x1 := 0; + x2 := trunc(xscale); + for x := 0 to w - 1 do + begin + lutX[x] := x2 - x1; + x1 := x2; + x2 := trunc((x + 2) * xscale); + end; + + // Y lookup table + SetLength(lutY, h); + x1 := 0; + x2 := trunc(yscale); + for x := 0 to h - 1 do + begin + lutY[x] := x2 - x1; + x1 := x2; + x2 := trunc((x + 2) * yscale); + end; + + Dec(w); + Dec(h); + RowDest := integer(FreeImage_GetScanLine(DestBmp, 0)); + RowSourceStart := integer(FreeImage_GetScanLine(SrcBmp, 0)); + RowSource := RowSourceStart; + + for y := 0 to h do + // resampling + begin + dy := lutY[y]; + x1 := 0; + x3 := 0; + for x := 0 to w do // loop through row + begin + dx:= lutX[x]; + iRed:= 0; + iGrn:= 0; + iBlu:= 0; + RowSource := RowSourceStart; + for iy := 1 to dy do + begin + pt := PRGB24(RowSource + x1); + for ix := 1 to dx do + begin + iRed := iRed + pt.R; + iGrn := iGrn + pt.G; + iBlu := iBlu + pt.B; + inc(pt); + end; + RowSource := RowSource + iSrc; + end; + iRatio := 65535 div (dx * dy); + pt1 := PRGB24(RowDest + x3); + pt1.R := (iRed * iRatio) shr 16; + pt1.G := (iGrn * iRatio) shr 16; + pt1.B := (iBlu * iRatio) shr 16; + x1 := x1 + 3 * dx; + inc(x3,3); + end; + RowDest := RowDest + iDst; + RowSourceStart := RowSource; + end; // resampling + + if FreeImage_GetHeight(DestBmp) >= 3 then + // Sharpening... + begin + s1 := integer(FreeImage_GetScanLine(DestBmp, 0)); + iDst := integer(FreeImage_GetScanLine(DestBmp, 1)) - s1; + ny1 := Integer(s1); + ny2 := ny1 + iDst; + ny3 := ny2 + iDst; + for y := 1 to FreeImage_GetHeight(DestBmp) - 2 do + begin + for x := 0 to FreeImage_GetWidth(DestBmp) - 3 do + begin + x1 := x * 3; + x2 := x1 + 3; + x3 := x1 + 6; + + c1 := pRGB24(ny1 + x1)^; + c2 := pRGB24(ny1 + x3)^; + c3 := pRGB24(ny2 + x2)^; + c4 := pRGB24(ny3 + x1)^; + c5 := pRGB24(ny3 + x3)^; + + r := (c1.R + c2.R + (c3.R * -12) + c4.R + c5.R) div -8; + g := (c1.G + c2.G + (c3.G * -12) + c4.G + c5.G) div -8; + b := (c1.B + c2.B + (c3.B * -12) + c4.B + c5.B) div -8; + + if r < 0 then r := 0 else if r > 255 then r := 255; + if g < 0 then g := 0 else if g > 255 then g := 255; + if b < 0 then b := 0 else if b > 255 then b := 255; + + pt1 := pRGB24(ny2 + x2); + pt1.R := r; + pt1.G := g; + pt1.B := b; + end; + inc(ny1, iDst); + inc(ny2, iDst); + inc(ny3, iDst); + end; + end; // sharpening + + if SrcBmp <> FDib then + FreeImage_Unload(SrcBmp); + DestBitmap.Replace(DestBmp); +end; + +function TFreeBitmap.PasteSubImage(Src: TFreeBitmap; Left, Top, + Alpha: Integer): Boolean; +begin + if FDib <> nil then + begin + Result := FreeImage_Paste(FDib, Src.Dib, Left, Top, Alpha); + Change; + end else + Result := False; +end; + +function TFreeBitmap.Replace(NewDib: PFIBITMAP): Boolean; +begin + Result := False; + if NewDib = nil then Exit; + + if not DoChanging(FDib, NewDib) and IsValid then + FreeImage_Unload(FDib); + + FDib := NewDib; + Result := True; + Change; +end; + +function TFreeBitmap.Rescale(NewWidth, NewHeight: Integer; + Filter: FREE_IMAGE_FILTER; Dest: TFreeBitmap): Boolean; +var + Bpp: Integer; + DstDib: PFIBITMAP; +begin + Result := False; + + if FDib <> nil then + begin + Bpp := FreeImage_GetBPP(FDib); + + if Bpp < 8 then + if not ConvertToGrayscale then Exit + else + if Bpp = 16 then + // convert to 24-bit + if not ConvertTo24Bits then Exit; + + // perform upsampling / downsampling + DstDib := FreeImage_Rescale(FDib, NewWidth, NewHeight, Filter); + if Dest = nil then + Result := Replace(DstDib) + else + Result := Dest.Replace(DstDib) + end +end; + +function TFreeBitmap.Rotate(Angle: Double): Boolean; +var + Bpp: Integer; + Rotated: PFIBITMAP; +begin + Result := False; + if IsValid then + begin + Bpp := FreeImage_GetBPP(FDib); + if Bpp in [1, 8, 24, 32] then + begin + Rotated := FreeImage_RotateClassic(FDib, Angle); + Result := Replace(Rotated); + end + end; +end; + +function TFreeBitmap.RotateEx(Angle, XShift, YShift, XOrigin, + YOrigin: Double; UseMask: Boolean): Boolean; +var + Rotated: PFIBITMAP; +begin + Result := False; + if FDib <> nil then + begin + if FreeImage_GetBPP(FDib) >= 8 then + begin + Rotated := FreeImage_RotateEx(FDib, Angle, XShift, YShift, XOrigin, YOrigin, UseMask); + Result := Replace(Rotated); + end + end; +end; + +function TFreeBitmap.Save(const FileName: string; Flag: Integer): Boolean; +var + fif: FREE_IMAGE_FORMAT; +begin + Result := False; + + // try to guess the file format from the file extension + fif := FreeImage_GetFIFFromFilename(PChar(Filename)); + if CanSave(fif) then + Result := FreeImage_Save(fif, FDib, PChar(FileName), Flag); +end; + +function TFreeBitmap.SaveToHandle(fif: FREE_IMAGE_FORMAT; IO: PFreeImageIO; + Handle: fi_handle; Flag: Integer): Boolean; +begin + Result := False; + if CanSave(fif) then + Result := FreeImage_SaveToHandle(fif, FDib, IO, Handle, Flag) +end; + +function TFreeBitmap.SaveToMemory(fif: FREE_IMAGE_FORMAT; + MemIO: TFreeMemoryIO; Flag: Integer): Boolean; +begin + Result := False; + + if CanSave(fif) then + Result := MemIO.Write(fif, FDib, Flag) +end; + +function TFreeBitmap.SaveToStream(fif: FREE_IMAGE_FORMAT; Stream: TStream; + Flag: Integer): Boolean; +var + MemIO: TFreeMemoryIO; + Data: PByte; + Size: Cardinal; +begin + MemIO := TFreeMemoryIO.Create; + try + Result := SaveToMemory(fif, MemIO, Flag); + if Result then + begin + MemIO.Acquire(Data, Size); + Stream.WriteBuffer(Data^, Size); + end; + finally + MemIO.Free; + end; +end; + +function TFreeBitmap.SaveU(const FileName: WideString; + Flag: Integer): Boolean; +var + fif: FREE_IMAGE_FORMAT; +begin + Result := False; + + // try to guess the file format from the file extension + fif := FreeImage_GetFIFFromFilenameU(PWideChar(Filename)); + if CanSave(fif) then + Result := FreeImage_SaveU(fif, FDib, PWideChar(FileName), Flag); +end; + +function TFreeBitmap.SetChannel(Bitmap: TFreeBitmap; + Channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; +begin + if FDib <> nil then + begin + Result := FreeImage_SetChannel(FDib, Bitmap.FDib, Channel); + Change; + end + else + Result := False +end; + +procedure TFreeBitmap.SetDib(Value: PFIBITMAP); +begin + Replace(Value); +end; + +function TFreeBitmap.SetFileBkColor(BkColor: PRGBQuad): Boolean; +begin + Result := FreeImage_SetBackgroundColor(FDib, BkColor); + Change; +end; + +procedure TFreeBitmap.SetHorizontalResolution(Value: Double); +begin + if IsValid then + begin + FreeImage_SetDotsPerMeterX(FDib, Trunc(Value * 100 + 0.5)); + Change; + end; +end; + +function TFreeBitmap.SetMetadata(Model: FREE_IMAGE_MDMODEL; + const Key: string; Tag: TFreeTag): Boolean; +begin + Result := FreeImage_SetMetadata(Model, FDib, PChar(Key), Tag.Tag); +end; + +function TFreeBitmap.SetPixelColor(X, Y: Cardinal; + Value: PRGBQUAD): Boolean; +begin + Result := FreeImage_SetPixelColor(FDib, X, Y, Value); + Change; +end; + +function TFreeBitmap.SetPixelIndex(X, Y: Cardinal; Value: PByte): Boolean; +begin + Result := FreeImage_SetPixelIndex(FDib, X, Y, Value); + Change; +end; + +function TFreeBitmap.SetSize(ImageType: FREE_IMAGE_TYPE; Width, Height, + Bpp: Integer; RedMask, GreenMask, BlueMask: Cardinal): Boolean; +var + Pal: PRGBQuad; + I: Cardinal; +begin + Result := False; + + if FDib <> nil then + FreeImage_Unload(FDib); + + FDib := FreeImage_Allocate(Width, Height, Bpp, RedMask, GreenMask, BlueMask); + if FDib = nil then Exit; + + if ImageType = FIT_BITMAP then + case Bpp of + 1, 4, 8: + begin + Pal := FreeImage_GetPalette(FDib); + for I := 0 to FreeImage_GetColorsUsed(FDib) - 1 do + begin + Pal.rgbBlue := I; + Pal.rgbGreen := I; + Pal.rgbRed := I; + Inc(Pal, SizeOf(RGBQUAD)); + end; + end; + end; + + Result := True; + Change; +end; + +procedure TFreeBitmap.SetTransparencyTable(Table: PByte; Count: Integer); +begin + FreeImage_SetTransparencyTable(FDib, Table, Count); + Change; +end; + +procedure TFreeBitmap.SetVerticalResolution(Value: Double); +begin + if IsValid then + begin + FreeImage_SetDotsPerMeterY(FDib, Trunc(Value * 100 + 0.5)); + Change; + end; +end; + +function TFreeBitmap.SplitChannels(RedChannel, GreenChannel, + BlueChannel: TFreeBitmap): Boolean; +begin + if FDib <> nil then + begin + RedChannel.FDib := FreeImage_GetChannel(FDib, FICC_RED); + GreenChannel.FDib := FreeImage_GetChannel(FDib, FICC_GREEN); + BlueChannel.FDib := FreeImage_GetChannel(FDib, FICC_BLUE); + Result := RedChannel.IsValid and GreenChannel.IsValid and BlueChannel.IsValid; + end + else + Result := False +end; + +function TFreeBitmap.Threshold(T: Byte): Boolean; +var + dib1: PFIBITMAP; +begin + if FDib <> nil then + begin + dib1 := FreeImage_Threshold(FDib, T); + Result := Replace(dib1); + end + else + Result := False +end; + +function TFreeBitmap.ToneMapping(TMO: FREE_IMAGE_TMO; FirstParam, + SecondParam: Double): Boolean; +var + NewDib: PFIBITMAP; +begin + Result := False; + if not IsValid then Exit; + + NewDib := FreeImage_ToneMapping(Fdib, TMO, FirstParam, SecondParam); + Result := Replace(NewDib); +end; + + +{ TFreeMultiBitmap } + +procedure TFreeMultiBitmap.AppendPage(Bitmap: TFreeBitmap); +begin + if IsValid then + FreeImage_AppendPage(FMPage, Bitmap.FDib); +end; + +function TFreeMultiBitmap.Close(Flags: Integer): Boolean; +begin + Result := FreeImage_CloseMultiBitmap(FMPage, Flags); + FMPage := nil; +end; + +constructor TFreeMultiBitmap.Create(KeepCacheInMemory: Boolean); +begin + inherited Create; + FMemoryCache := KeepCacheInMemory; +end; + +procedure TFreeMultiBitmap.DeletePage(Page: Integer); +begin + if IsValid then + FreeImage_DeletePage(FMPage, Page); +end; + +destructor TFreeMultiBitmap.Destroy; +begin + if FMPage <> nil then Close; + inherited; +end; + +function TFreeMultiBitmap.GetLockedPageNumbers(var Pages, + Count: Integer): Boolean; +begin + Result := False; + if not IsValid then Exit; + Result := FreeImage_GetLockedPageNumbers(FMPage, Pages, Count) +end; + +function TFreeMultiBitmap.GetPageCount: Integer; +begin + Result := 0; + if IsValid then + Result := FreeImage_GetPageCount(FMPage) +end; + +procedure TFreeMultiBitmap.InsertPage(Page: Integer; Bitmap: TFreeBitmap); +begin + if IsValid then + FreeImage_InsertPage(FMPage, Page, Bitmap.FDib); +end; + +function TFreeMultiBitmap.IsValid: Boolean; +begin + Result := FMPage <> nil +end; + +procedure TFreeMultiBitmap.LockPage(Page: Integer; DestBitmap: TFreeBitmap); +begin + if not IsValid then Exit; + + if Assigned(DestBitmap) then + begin + DestBitmap.Replace(FreeImage_LockPage(FMPage, Page)); + end; +end; + +function TFreeMultiBitmap.MovePage(Target, Source: Integer): Boolean; +begin + Result := False; + if not IsValid then Exit; + Result := FreeImage_MovePage(FMPage, Target, Source); +end; + +function TFreeMultiBitmap.Open(const FileName: string; CreateNew, + ReadOnly: Boolean; Flags: Integer): Boolean; +var + fif: FREE_IMAGE_FORMAT; +begin + Result := False; + + // try to guess the file format from the filename + fif := FreeImage_GetFIFFromFilename(PChar(FileName)); + + // check for supported file types + if (fif <> FIF_UNKNOWN) and (not fif in [FIF_TIFF, FIF_ICO, FIF_GIF]) then + Exit; + + // open the stream + FMPage := FreeImage_OpenMultiBitmap(fif, PChar(FileName), CreateNew, ReadOnly, FMemoryCache, Flags); + + Result := FMPage <> nil; +end; + +procedure TFreeMultiBitmap.UnlockPage(Bitmap: TFreeBitmap; + Changed: Boolean); +begin + if IsValid then + begin + FreeImage_UnlockPage(FMPage, Bitmap.FDib, Changed); + // clear the image so that it becomes invalid. + // don't use Bitmap.Clear method because it calls FreeImage_Unload + // just clear the pointer + Bitmap.FDib := nil; + Bitmap.Change; + end; +end; + +{ TFreeMemoryIO } + +function TFreeMemoryIO.Acquire(var Data: PByte; + var SizeInBytes: DWORD): Boolean; +begin + Result := FreeImage_AcquireMemory(FHMem, Data, SizeInBytes); +end; + +constructor TFreeMemoryIO.Create(Data: PByte; SizeInBytes: DWORD); +begin + inherited Create; + FHMem := FreeImage_OpenMemory(Data, SizeInBytes); +end; + +destructor TFreeMemoryIO.Destroy; +begin + FreeImage_CloseMemory(FHMem); + inherited; +end; + +function TFreeMemoryIO.GetFileType: FREE_IMAGE_FORMAT; +begin + Result := FreeImage_GetFileTypeFromMemory(FHMem); +end; + +function TFreeMemoryIO.IsValid: Boolean; +begin + Result := FHMem <> nil +end; + +function TFreeMemoryIO.Read(fif: FREE_IMAGE_FORMAT; + Flag: Integer): PFIBITMAP; +begin + Result := FreeImage_LoadFromMemory(fif, FHMem, Flag) +end; + +function TFreeMemoryIO.Seek(Offset: Longint; Origin: Word): Boolean; +begin + Result := FreeImage_SeekMemory(FHMem, Offset, Origin) +end; + +function TFreeMemoryIO.Tell: Longint; +begin + Result := FreeImage_TellMemory(FHMem) +end; + +function TFreeMemoryIO.Write(fif: FREE_IMAGE_FORMAT; dib: PFIBITMAP; + Flag: Integer): Boolean; +begin + Result := FreeImage_SaveToMemory(fif, dib, FHMem, Flag) +end; + +{ TFreeTag } + +function TFreeTag.Clone: TFreeTag; +var + CloneTag: PFITAG; +begin + Result := nil; + if not IsValid then Exit; + + CloneTag := FreeImage_CloneTag(FTag); + Result := TFreeTag.Create(CloneTag); +end; + +constructor TFreeTag.Create(ATag: PFITAG); +begin + inherited Create; + + if ATag <> nil then + FTag := ATag + else + FTag := FreeImage_CreateTag; +end; + +destructor TFreeTag.Destroy; +begin + if IsValid then + FreeImage_DeleteTag(FTag); + + inherited; +end; + +function TFreeTag.GetCount: Cardinal; +begin + Result := 0; + if not IsValid then Exit; + + Result := FreeImage_GetTagCount(FTag); +end; + +function TFreeTag.GetDescription: string; +begin + Result := ''; + if not IsValid then Exit; + + Result := FreeImage_GetTagDescription(FTag); +end; + +function TFreeTag.GetID: Word; +begin + Result := 0; + if not IsValid then Exit; + + Result := FreeImage_GetTagID(FTag); +end; + +function TFreeTag.GetKey: string; +begin + Result := ''; + if not IsValid then Exit; + + Result := FreeImage_GetTagKey(FTag); +end; + +function TFreeTag.GetLength: Cardinal; +begin + Result := 0; + if not IsValid then Exit; + + Result := FreeImage_GetTagLength(FTag); +end; + +function TFreeTag.GetTagType: FREE_IMAGE_MDTYPE; +begin + Result := FIDT_NOTYPE; + if not IsValid then Exit; + + Result := FreeImage_GetTagType(FTag); +end; + +function TFreeTag.GetValue: Pointer; +begin + Result := nil; + if not IsValid then Exit; + + Result := FreeImage_GetTagValue(FTag); +end; + +function TFreeTag.IsValid: Boolean; +begin + Result := FTag <> nil; +end; + +procedure TFreeTag.SetCount(const Value: Cardinal); +begin + if IsValid then + FreeImage_SetTagCount(FTag, Value); +end; + +procedure TFreeTag.SetDescription(const Value: string); +begin + if IsValid then + FreeImage_SetTagDescription(FTag, PChar(Value)); +end; + +procedure TFreeTag.SetID(const Value: Word); +begin + if IsValid then + FreeImage_SetTagID(FTag, Value); +end; + +procedure TFreeTag.SetKey(const Value: string); +begin + if IsValid then + FreeImage_SetTagKey(FTag, PChar(Value)); +end; + +procedure TFreeTag.SetLength(const Value: Cardinal); +begin + if IsValid then + FreeImage_SetTagLength(FTag, Value); +end; + +procedure TFreeTag.SetTagType(const Value: FREE_IMAGE_MDTYPE); +begin + if IsValid then + FreeImage_SetTagType(FTag, Value); +end; + +procedure TFreeTag.SetValue(const Value: Pointer); +begin + if IsValid then + FreeImage_SetTagValue(FTag, Value); +end; + +function TFreeTag.ToString(Model: FREE_IMAGE_MDMODEL; Make: PChar): string; +begin + Result := FreeImage_TagToString(Model, FTag, Make); +end; + +end. diff --git a/Game/Code/lib/FreeImage/FreeImage.pas b/Game/Code/lib/FreeImage/FreeImage.pas new file mode 100755 index 00000000..a1c0e7de --- /dev/null +++ b/Game/Code/lib/FreeImage/FreeImage.pas @@ -0,0 +1,743 @@ +unit FreeImage; + +{$I switches.inc} + + + + +// ========================================================== +// Delphi wrapper for FreeImage 3 +// +// Design and implementation by +// - Simon Beavis +// - Peter Byström +// - Anatoliy Pulyaevskiy (xvel84@rambler.ru) +// +// This file is part of FreeImage 3 +// +// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY +// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES +// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE +// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED +// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT +// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY +// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL +// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER +// THIS DISCLAIMER. +// +// Use at your own risk! +// ========================================================== + +interface + +uses Windows; + +{$MINENUMSIZE 4} // Make sure enums are stored as an integer to be compatible with C/C++ + +const + FIDLL = 'libfreeimage.dylib'; + +// -------------------------------------------------------------------------- +// Bitmap types ------------------------------------------------------------- +// -------------------------------------------------------------------------- + +type + FIBITMAP = record + data : Pointer; + end; + PFIBITMAP = ^FIBITMAP; + + FIMULTIBITMAP = record + data : Pointer; + end; + PFIMULTIBITMAP = ^FIMULTIBITMAP; + +// -------------------------------------------------------------------------- +// Indexes for byte arrays, masks and shifts for treating pixels as words --- +// These coincide with the order of RGBQUAD and RGBTRIPLE ------------------- +// Little Endian (x86 / MS Windows, Linux) : BGR(A) order ------------------- +// -------------------------------------------------------------------------- + +const + FI_RGBA_RED = 2; + FI_RGBA_GREEN = 1; + FI_RGBA_BLUE = 0; + FI_RGBA_ALPHA = 3; + FI_RGBA_RED_MASK = $00FF0000; + FI_RGBA_GREEN_MASK = $0000FF00; + FI_RGBA_BLUE_MASK = $000000FF; + FI_RGBA_ALPHA_MASK = $FF000000; + FI_RGBA_RED_SHIFT = 16; + FI_RGBA_GREEN_SHIFT = 8; + FI_RGBA_BLUE_SHIFT = 0; + FI_RGBA_ALPHA_SHIFT = 24; + +// -------------------------------------------------------------------------- +// The 16bit macros only include masks and shifts, -------------------------- +// since each color element is not byte aligned ----------------------------- +// -------------------------------------------------------------------------- + +const + FI16_555_RED_MASK = $7C00; + FI16_555_GREEN_MASK = $03E0; + FI16_555_BLUE_MASK = $001F; + FI16_555_RED_SHIFT = 10; + FI16_555_GREEN_SHIFT = 5; + FI16_555_BLUE_SHIFT = 0; + FI16_565_RED_MASK = $F800; + FI16_565_GREEN_MASK = $07E0; + FI16_565_BLUE_MASK = $001F; + FI16_565_RED_SHIFT = 11; + FI16_565_GREEN_SHIFT = 5; + FI16_565_BLUE_SHIFT = 0; + +// -------------------------------------------------------------------------- +// ICC profile support ------------------------------------------------------ +// -------------------------------------------------------------------------- + +const + FIICC_DEFAULT = $0; + FIICC_COLOR_IS_CMYK = $1; + +type + FIICCPROFILE = record + flags : WORD; // info flag + size : DWORD; // profile's size measured in bytes + data : Pointer; // points to a block of contiguous memory containing the profile + end; + PFIICCPROFILE = ^FIICCPROFILE; + +// -------------------------------------------------------------------------- +// Important enums ---------------------------------------------------------- +// -------------------------------------------------------------------------- + +type + FREE_IMAGE_FORMAT = type Integer; + FREE_IMAGE_TYPE = type Integer; + FREE_IMAGE_COLOR_TYPE = type Integer; + FREE_IMAGE_QUANTIZE = type Integer; + FREE_IMAGE_DITHER = type Integer; + FREE_IMAGE_FILTER = type Integer; + FREE_IMAGE_COLOR_CHANNEL = type Integer; + FREE_IMAGE_MDTYPE = type Integer; + FREE_IMAGE_MDMODEL = type Integer; + FREE_IMAGE_JPEG_OPERATION = type Integer; + FREE_IMAGE_TMO = type Integer; + +const + // I/O image format identifiers. + FIF_UNKNOWN = FREE_IMAGE_FORMAT(-1); + FIF_BMP = FREE_IMAGE_FORMAT(0); + FIF_ICO = FREE_IMAGE_FORMAT(1); + FIF_JPEG = FREE_IMAGE_FORMAT(2); + FIF_JNG = FREE_IMAGE_FORMAT(3); + FIF_KOALA = FREE_IMAGE_FORMAT(4); + FIF_LBM = FREE_IMAGE_FORMAT(5); + FIF_IFF = FIF_LBM; + FIF_MNG = FREE_IMAGE_FORMAT(6); + FIF_PBM = FREE_IMAGE_FORMAT(7); + FIF_PBMRAW = FREE_IMAGE_FORMAT(8); + FIF_PCD = FREE_IMAGE_FORMAT(9); + FIF_PCX = FREE_IMAGE_FORMAT(10); + FIF_PGM = FREE_IMAGE_FORMAT(11); + FIF_PGMRAW = FREE_IMAGE_FORMAT(12); + FIF_PNG = FREE_IMAGE_FORMAT(13); + FIF_PPM = FREE_IMAGE_FORMAT(14); + FIF_PPMRAW = FREE_IMAGE_FORMAT(15); + FIF_RAS = FREE_IMAGE_FORMAT(16); + FIF_TARGA = FREE_IMAGE_FORMAT(17); + FIF_TIFF = FREE_IMAGE_FORMAT(18); + FIF_WBMP = FREE_IMAGE_FORMAT(19); + FIF_PSD = FREE_IMAGE_FORMAT(20); + FIF_CUT = FREE_IMAGE_FORMAT(21); + FIF_XBM = FREE_IMAGE_FORMAT(22); + FIF_XPM = FREE_IMAGE_FORMAT(23); + FIF_DDS = FREE_IMAGE_FORMAT(24); + FIF_GIF = FREE_IMAGE_FORMAT(25); + FIF_HDR = FREE_IMAGE_FORMAT(26); + FIF_FAXG3 = FREE_IMAGE_FORMAT(27); + FIF_SGI = FREE_IMAGE_FORMAT(28); + + // Image type used in FreeImage. + FIT_UNKNOWN = FREE_IMAGE_TYPE(0); // unknown type + FIT_BITMAP = FREE_IMAGE_TYPE(1); // standard image: 1-, 4-, 8-, 16-, 24-, 32-bit + FIT_UINT16 = FREE_IMAGE_TYPE(2); // array of unsigned short: unsigned 16-bit + FIT_INT16 = FREE_IMAGE_TYPE(3); // array of short: signed 16-bit + FIT_UINT32 = FREE_IMAGE_TYPE(4); // array of unsigned long: unsigned 32-bit + FIT_INT32 = FREE_IMAGE_TYPE(5); // array of long: signed 32-bit + FIT_FLOAT = FREE_IMAGE_TYPE(6); // array of float: 32-bit IEEE floating point + FIT_DOUBLE = FREE_IMAGE_TYPE(7); // array of double: 64-bit IEEE floating point + FIT_COMPLEX = FREE_IMAGE_TYPE(8); // array of FICOMPLEX: 2 x 64-bit IEEE floating point + FIT_RGB16 = FREE_IMAGE_TYPE(9); // 48-bit RGB image: 3 x 16-bit + FIT_RGBA16 = FREE_IMAGE_TYPE(10); // 64-bit RGBA image: 4 x 16-bit + FIT_RGBF = FREE_IMAGE_TYPE(11); // 96-bit RGB float image: 3 x 32-bit IEEE floating point + FIT_RGBAF = FREE_IMAGE_TYPE(12); // 128-bit RGBA float image: 4 x 32-bit IEEE floating point + + // Image color type used in FreeImage. + FIC_MINISWHITE = FREE_IMAGE_COLOR_TYPE(0); // min value is white + FIC_MINISBLACK = FREE_IMAGE_COLOR_TYPE(1); // min value is black + FIC_RGB = FREE_IMAGE_COLOR_TYPE(2); // RGB color model + FIC_PALETTE = FREE_IMAGE_COLOR_TYPE(3); // color map indexed + FIC_RGBALPHA = FREE_IMAGE_COLOR_TYPE(4); // RGB color model with alpha channel + FIC_CMYK = FREE_IMAGE_COLOR_TYPE(5); // CMYK color model + + // Color quantization algorithms. Constants used in FreeImage_ColorQuantize. + FIQ_WUQUANT = FREE_IMAGE_QUANTIZE(0); // Xiaolin Wu color quantization algorithm + FIQ_NNQUANT = FREE_IMAGE_QUANTIZE(1); // NeuQuant neural-net quantization algorithm by Anthony Dekker + + // Dithering algorithms. Constants used FreeImage_Dither. + FID_FS = FREE_IMAGE_DITHER(0); // Floyd & Steinberg error diffusion + FID_BAYER4x4 = FREE_IMAGE_DITHER(1); // Bayer ordered dispersed dot dithering (order 2 dithering matrix) + FID_BAYER8x8 = FREE_IMAGE_DITHER(2); // Bayer ordered dispersed dot dithering (order 3 dithering matrix) + FID_CLUSTER6x6 = FREE_IMAGE_DITHER(3); // Ordered clustered dot dithering (order 3 - 6x6 matrix) + FID_CLUSTER8x8 = FREE_IMAGE_DITHER(4); // Ordered clustered dot dithering (order 4 - 8x8 matrix) + FID_CLUSTER16x16 = FREE_IMAGE_DITHER(5); // Ordered clustered dot dithering (order 8 - 16x16 matrix) + + // Lossless JPEG transformations Constants used in FreeImage_JPEGTransform + FIJPEG_OP_NONE = FREE_IMAGE_JPEG_OPERATION(0); // no transformation + FIJPEG_OP_FLIP_H = FREE_IMAGE_JPEG_OPERATION(1); // horizontal flip + FIJPEG_OP_FLIP_V = FREE_IMAGE_JPEG_OPERATION(2); // vertical flip + FIJPEG_OP_TRANSPOSE = FREE_IMAGE_JPEG_OPERATION(3); // transpose across UL-to-LR axis + FIJPEG_OP_TRANSVERSE = FREE_IMAGE_JPEG_OPERATION(4); // transpose across UR-to-LL axis + FIJPEG_OP_ROTATE_90 = FREE_IMAGE_JPEG_OPERATION(5); // 90-degree clockwise rotation + FIJPEG_OP_ROTATE_180 = FREE_IMAGE_JPEG_OPERATION(6); // 180-degree rotation + FIJPEG_OP_ROTATE_270 = FREE_IMAGE_JPEG_OPERATION(7); // 270-degree clockwise (or 90 ccw) + + // Tone mapping operators. Constants used in FreeImage_ToneMapping. + FITMO_DRAGO03 = FREE_IMAGE_TMO(0); // Adaptive logarithmic mapping (F. Drago, 2003) + FITMO_REINHARD05 = FREE_IMAGE_TMO(1); // Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005) + + // Upsampling / downsampling filters. Constants used in FreeImage_Rescale. + FILTER_BOX = FREE_IMAGE_FILTER(0); // Box, pulse, Fourier window, 1st order (constant) b-spline + FILTER_BICUBIC = FREE_IMAGE_FILTER(1); // Mitchell & Netravali's two-param cubic filter + FILTER_BILINEAR = FREE_IMAGE_FILTER(2); // Bilinear filter + FILTER_BSPLINE = FREE_IMAGE_FILTER(3); // 4th order (cubic) b-spline + FILTER_CATMULLROM = FREE_IMAGE_FILTER(4); // Catmull-Rom spline, Overhauser spline + FILTER_LANCZOS3 = FREE_IMAGE_FILTER(5); // Lanczos3 filter + + // Color channels. Constants used in color manipulation routines. + FICC_RGB = FREE_IMAGE_COLOR_CHANNEL(0); // Use red, green and blue channels + FICC_RED = FREE_IMAGE_COLOR_CHANNEL(1); // Use red channel + FICC_GREEN = FREE_IMAGE_COLOR_CHANNEL(2); // Use green channel + FICC_BLUE = FREE_IMAGE_COLOR_CHANNEL(3); // Use blue channel + FICC_ALPHA = FREE_IMAGE_COLOR_CHANNEL(4); // Use alpha channel + FICC_BLACK = FREE_IMAGE_COLOR_CHANNEL(5); // Use black channel + FICC_REAL = FREE_IMAGE_COLOR_CHANNEL(6); // Complex images: use real part + FICC_IMAG = FREE_IMAGE_COLOR_CHANNEL(7); // Complex images: use imaginary part + FICC_MAG = FREE_IMAGE_COLOR_CHANNEL(8); // Complex images: use magnitude + FICC_PHASE = FREE_IMAGE_COLOR_CHANNEL(9); // Complex images: use phase + + // Tag data type information (based on TIFF specifications) + FIDT_NOTYPE = FREE_IMAGE_MDTYPE(0); // placeholder + FIDT_BYTE = FREE_IMAGE_MDTYPE(1); // 8-bit unsigned integer + FIDT_ASCII = FREE_IMAGE_MDTYPE(2); // 8-bit bytes w/ last byte null + FIDT_SHORT = FREE_IMAGE_MDTYPE(3); // 16-bit unsigned integer + FIDT_LONG = FREE_IMAGE_MDTYPE(4); // 32-bit unsigned integer + FIDT_RATIONAL = FREE_IMAGE_MDTYPE(5); // 64-bit unsigned fraction + FIDT_SBYTE = FREE_IMAGE_MDTYPE(6); // 8-bit signed integer + FIDT_UNDEFINED = FREE_IMAGE_MDTYPE(7); // 8-bit untyped data + FIDT_SSHORT = FREE_IMAGE_MDTYPE(8); // 16-bit signed integer + FIDT_SLONG = FREE_IMAGE_MDTYPE(9); // 32-bit signed integer + FIDT_SRATIONAL = FREE_IMAGE_MDTYPE(10); // 64-bit signed fraction + FIDT_FLOAT = FREE_IMAGE_MDTYPE(11); // 32-bit IEEE floating point + FIDT_DOUBLE = FREE_IMAGE_MDTYPE(12); // 64-bit IEEE floating point + FIDT_IFD = FREE_IMAGE_MDTYPE(13); // 32-bit unsigned integer (offset) + FIDT_PALETTE = FREE_IMAGE_MDTYPE(14); // 32-bit RGBQUAD + + // Metadata models supported by FreeImage + FIMD_NODATA = FREE_IMAGE_MDMODEL(-1); + FIMD_COMMENTS = FREE_IMAGE_MDMODEL(0); // single comment or keywords + FIMD_EXIF_MAIN = FREE_IMAGE_MDMODEL(1); // Exif-TIFF metadata + FIMD_EXIF_EXIF = FREE_IMAGE_MDMODEL(2); // Exif-specific metadata + FIMD_EXIF_GPS = FREE_IMAGE_MDMODEL(3); // Exif GPS metadata + FIMD_EXIF_MAKERNOTE = FREE_IMAGE_MDMODEL(4); // Exif maker note metadata + FIMD_EXIF_INTEROP = FREE_IMAGE_MDMODEL(5); // Exif interoperability metadata + FIMD_IPTC = FREE_IMAGE_MDMODEL(6); // IPTC/NAA metadata + FIMD_XMP = FREE_IMAGE_MDMODEL(7); // Abobe XMP metadata + FIMD_GEOTIFF = FREE_IMAGE_MDMODEL(8); // GeoTIFF metadata (to be implemented) + FIMD_ANIMATION = FREE_IMAGE_MDMODEL(9); // Animation metadata + FIMD_CUSTOM = FREE_IMAGE_MDMODEL(10); // Used to attach other metadata types to a dib + +//{$endif} + +type + // Handle to a metadata model + FIMETADATA = record + data: Pointer; + end; + PFIMETADATA = ^FIMETADATA; + + // Handle to a metadata tag + FITAG = record + data: Pointer; + end; + PFITAG = ^FITAG; + +// -------------------------------------------------------------------------- +// File IO routines --------------------------------------------------------- +// -------------------------------------------------------------------------- + +type + FI_Handle = Pointer; + PCardinal = ^Cardinal; + PInt = ^Integer; + + FI_ReadProc = function(buffer : pointer; size : Cardinal; count : Cardinal; handle : fi_handle) : PCardinal; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + FI_WriteProc = function(buffer : pointer; size, count : Cardinal; handle : FI_Handle) : PCardinal; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + FI_SeekProc = function(handle : fi_handle; offset : longint; origin : integer) : pint; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + FI_TellProc = function(handle : fi_handle) : PCardinal; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + + FreeImageIO = packed record + read_proc : FI_ReadProc; // pointer to the function used to read data + write_proc: FI_WriteProc; // pointer to the function used to write data + seek_proc : FI_SeekProc; // pointer to the function used to seek + tell_proc : FI_TellProc; // pointer to the function used to aquire the current position + end; + PFreeImageIO = ^FreeImageIO; + + // Handle to a memory I/O stream + FIMEMORY = record + data: Pointer; + end; + PFIMEMORY = ^FIMEMORY; + +const + // constants used in FreeImage_Seek for Origin parameter + SEEK_SET = 0; + SEEK_CUR = 1; + SEEK_END = 2; + +// -------------------------------------------------------------------------- +// Plugin routines ---------------------------------------------------------- +// -------------------------------------------------------------------------- + +type + PPluginStruct = ^PluginStruct; + + FI_InitProc = procedure(Plugin: PPluginStruct; Format_ID: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + FI_FormatProc = function: PChar; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + FI_DescriptionProc = function: PChar; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + FI_ExtensionListProc = function: PChar; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + FI_RegExprProc = function: PChar; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + FI_OpenProc = function(IO: PFreeImageIO; Handle: FI_Handle; Read: Boolean): Pointer; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + FI_CloseProc = procedure(IO: PFreeImageIO; Handle: FI_Handle; Data: Pointer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + FI_PageCountProc = function(IO: PFreeImageIO; Handle: FI_Handle; Data: Pointer): Integer; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + FI_PageCapabilityProc = function(IO: PFreeImageIO; Handle: FI_Handle; Data: Pointer): integer; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + FI_LoadProc = function(IO: PFreeImageIO; Handle: FI_Handle; Page, Flags: Integer; data: pointer): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + FI_SaveProc = function(IO: PFreeImageIO; Dib: PFIBITMAP; Handle: FI_Handle; Page, Flags: Integer; Data: Pointer): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + FI_ValidateProc = function(IO: PFreeImageIO; Handle: FI_Handle): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + FI_MimeProc = function: PChar; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + FI_SupportsExportBPPProc = function(Bpp: integer): boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + FI_SupportsExportTypeProc = function(AType: FREE_IMAGE_TYPE): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + FI_SupportsICCProfilesProc = function: Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + + PluginStruct = record + format_proc: FI_FormatProc; + description_proc: FI_DescriptionProc; + extension_proc: FI_ExtensionListProc; + regexpr_proc: FI_RegExprProc; + open_proc: FI_OpenProc; + close_proc: FI_CloseProc; + pagecount_proc: FI_PageCountProc; + pagecapability_proc: FI_PageCapabilityProc; + load_proc: FI_LoadProc; + save_proc: FI_SaveProc; + validate_proc: FI_ValidateProc; + mime_proc: FI_MimeProc; + supports_export_bpp_proc: FI_SupportsExportBPPProc; + supports_export_type_proc: FI_SupportsExportTypeProc; + supports_icc_profiles_proc: FI_SupportsICCProfilesProc; + end; + +// -------------------------------------------------------------------------- +// Load/Save flag constants ------------------------------------------------- +// -------------------------------------------------------------------------- + +const + BMP_DEFAULT = 0; + BMP_SAVE_RLE = 1; + CUT_DEFAULT = 0; + DDS_DEFAULT = 0; + FAXG3_DEFAULT = 0; + GIF_DEFAULT = 0; + ICO_DEFAULT = 0; + ICO_MAKEALPHA = 0; // convert to 32bpp and create an alpha channel from the AND-mask when loading + IFF_DEFAULT = 0; + JPEG_DEFAULT = 0; + JPEG_FAST = 1; + JPEG_ACCURATE = 2; + JPEG_QUALITYSUPERB = $0080; + JPEG_QUALITYGOOD = $0100; + JPEG_QUALITYNORMAL = $0200; + JPEG_QUALITYAVERAGE = $0400; + JPEG_QUALITYBAD = $0800; + JPEG_CMYK = $1000; // load separated CMYK "as is" (use | to combine with other flags) + KOALA_DEFAULT = 0; + LBM_DEFAULT = 0; + MNG_DEFAULT = 0; + PCD_DEFAULT = 0; + PCD_BASE = 1; // load the bitmap sized 768 x 512 + PCD_BASEDIV4 = 2; // load the bitmap sized 384 x 256 + PCD_BASEDIV16 = 3; // load the bitmap sized 192 x 128 + PCX_DEFAULT = 0; + PNG_DEFAULT = 0; + PNG_IGNOREGAMMA = 1; // avoid gamma correction + PNM_DEFAULT = 0; + PNM_SAVE_RAW = 0; // If set the writer saves in RAW format (i.e. P4, P5 or P6) + PNM_SAVE_ASCII = 1; // If set the writer saves in ASCII format (i.e. P1, P2 or P3) + PSD_DEFAULT = 0; + RAS_DEFAULT = 0; + SGI_DEFAULT = 0; + TARGA_DEFAULT = 0; + TARGA_LOAD_RGB888 = 1; // If set the loader converts RGB555 and ARGB8888 -> RGB888. + TIFF_DEFAULT = 0; + TIFF_CMYK = $0001; // reads/stores tags for separated CMYK (use | to combine with compression flags) + TIFF_PACKBITS = $0100; // save using PACKBITS compression + TIFF_DEFLATE = $0200; // save using DEFLATE compression + TIFF_ADOBE_DEFLATE = $0400; // save using ADOBE DEFLATE compression + TIFF_NONE = $0800; // save without any compression + TIFF_CCITTFAX3 = $1000; // save using CCITT Group 3 fax encoding + TIFF_CCITTFAX4 = $2000; // save using CCITT Group 4 fax encoding + TIFF_LZW = $4000; // save using LZW compression + TIFF_JPEG = $8000; // save using JPEG compression + WBMP_DEFAULT = 0; + XBM_DEFAULT = 0; + XPM_DEFAULT = 0; + +// -------------------------------------------------------------------------- +// Init/Error routines ------------------------------------------------------ +// -------------------------------------------------------------------------- + +procedure FreeImage_Initialise(load_local_plugins_only : boolean = False); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_DeInitialise; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// -------------------------------------------------------------------------- +// Version routines --------------------------------------------------------- +// -------------------------------------------------------------------------- + +function FreeImage_GetVersion : PChar; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetCopyrightMessage : PChar; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// -------------------------------------------------------------------------- +// Message output functions ------------------------------------------------- +// -------------------------------------------------------------------------- + +procedure FreeImage_OutPutMessageProc(fif: Integer; fmt: PChar); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +type FreeImage_OutputMessageFunction = function(fif: FREE_IMAGE_FORMAT; msg: PChar): pointer; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} +procedure FreeImage_SetOutputMessage(omf: FreeImage_OutputMessageFunction); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// -------------------------------------------------------------------------- +// Allocate/Unload routines ------------------------------------------------- +// -------------------------------------------------------------------------- + +function FreeImage_Allocate(width, height, bpp: integer; red_mask: Cardinal = 0; green_mask: Cardinal = 0; blue_mask: Cardinal = 0): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_AllocateT(Atype: FREE_IMAGE_TYPE; Width, Height: Integer; bpp: Integer = 8; red_mask: Cardinal = 0; green_mask: Cardinal = 0; blue_mask: Cardinal = 0): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_Clone(dib: PFIBITMAP): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_Unload(dib: PFIBITMAP); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// -------------------------------------------------------------------------- +// Load / Save routines ----------------------------------------------------- +// -------------------------------------------------------------------------- + +function FreeImage_Load(fif: FREE_IMAGE_FORMAT; const filename: PChar; flags: integer = 0): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_LoadU(fif: FREE_IMAGE_FORMAT; const filename: PWideChar; flags: Integer = 0): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_LoadFromHandle(fif: FREE_IMAGE_FORMAT; io: PFreeImageIO; handle: fi_handle; flags: integer = 0): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_Save(fif: FREE_IMAGE_FORMAT; dib: PFIBITMAP; filename: PChar; flags: integer = 0): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_SaveU(fif: FREE_IMAGE_FORMAT; dib: PFIBITMAP; const filename: PWideChar; flags: Integer = 0): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_SaveToHandle(fif: FREE_IMAGE_FORMAT; dib: PFIBITMAP; io : PFreeImageIO; handle : fi_handle; flags : integer = 0) : Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// -------------------------------------------------------------------------- +// Memory I/O stream routines ----------------------------------------------- +// -------------------------------------------------------------------------- + +function FreeImage_OpenMemory(data: PByte = nil; size_in_bytes: DWORD = 0): PFIMEMORY; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_CloseMemory(stream: PFIMEMORY); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_LoadFromMemory(fif: FREE_IMAGE_FORMAT; stream: PFIMEMORY; flags: Integer = 0): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_SaveToMemory(fif: FREE_IMAGE_FORMAT; dib: PFIBITMAP; stream: PFIMEMORY; flags: Integer = 0): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_TellMemory(stream: PFIMEMORY): Longint; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_SeekMemory(stream: PFIMEMORY; offset: Longint; origin: Integer): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_AcquireMemory(stream: PFIMEMORY; var data: PByte; var size_in_bytes: DWORD): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// -------------------------------------------------------------------------- +// Plugin Interface --------------------------------------------------------- +// -------------------------------------------------------------------------- + +function FreeImage_RegisterLocalPlugin(proc_address: FI_InitProc; format, description, extension, regexpr: PChar): FREE_IMAGE_FORMAT; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_RegisterExternalPlugin(path, format, description, extension, regexpr: PChar): FREE_IMAGE_FORMAT; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetFIFCount: Integer; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_SetPluginEnabled(fif: FREE_IMAGE_FORMAT; enable: Boolean); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_IsPluginEnabled(fif: FREE_IMAGE_FORMAT): Integer; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetFIFFromFormat(const format: PChar): FREE_IMAGE_FORMAT; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetFIFFromMime(const format: PChar): FREE_IMAGE_FORMAT; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetFormatFromFIF(fif: FREE_IMAGE_FORMAT): PChar; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetFIFExtensionList(fif: FREE_IMAGE_FORMAT): PChar; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetFIFDescription(fif: FREE_IMAGE_FORMAT): PChar; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetFIFRegExpr(fif: FREE_IMAGE_FORMAT): PChar; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetFIFFromFilename(const fname: PChar): FREE_IMAGE_FORMAT; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetFIFFromFilenameU(const fname:PWideChar): FREE_IMAGE_FORMAT; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_FIFSupportsReading(fif: FREE_IMAGE_FORMAT): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_FIFSupportsWriting(fif: FREE_IMAGE_FORMAT): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_FIFSupportsExportBPP(fif: FREE_IMAGE_FORMAT; bpp: Integer): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_FIFSupportsICCProfiles(fif: FREE_IMAGE_FORMAT): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_FIFSupportsExportType(fif: FREE_IMAGE_FORMAT; image_type: FREE_IMAGE_TYPE): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// -------------------------------------------------------------------------- +// Multipaging interface ---------------------------------------------------- +// -------------------------------------------------------------------------- + +function FreeImage_OpenMultiBitmap(fif: FREE_IMAGE_FORMAT; filename: PChar; create_new, read_only, keep_cache_in_memory: Boolean; flags: integer = 0): PFIMULTIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_CloseMultiBitmap(bitmap: PFIMULTIBITMAP; flags: Integer = 0): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetPageCount(bitmap: PFIMULTIBITMAP): Integer; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_AppendPage(bitmap: PFIMULTIBITMAP; data: PFIBITMAP); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_InsertPage(bitmap: PFIMULTIBITMAP; page: Integer; data: PFIBITMAP); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_DeletePage(bitmap: PFIMULTIBITMAP; page: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_LockPage(bitmap: PFIMULTIBITMAP; page: Integer): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_UnlockPage(bitmap: PFIMULTIBITMAP; page: PFIBITMAP; changed: boolean); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_MovePage(bitmap: PFIMULTIBITMAP; target, source: Integer): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetLockedPageNumbers(bitmap: PFIMULTIBITMAP; var pages: Integer; var count : integer): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// -------------------------------------------------------------------------- +// Filetype request routines ------------------------------------------------ +// -------------------------------------------------------------------------- + +function FreeImage_GetFileType(const filename: PChar; size: Integer): FREE_IMAGE_FORMAT; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetFileTypeU(const filename: PWideChar; size: Integer): FREE_IMAGE_FORMAT; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetFileTypeFromHandle(io: PFreeImageIO; handle: FI_Handle; size: Integer = 0): FREE_IMAGE_FORMAT; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetFileTypeFromMemory(stream: PFIMEMORY; size: Integer = 0): FREE_IMAGE_FORMAT; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// -------------------------------------------------------------------------- +// ImageType request routine ------------------------------------------------ +// -------------------------------------------------------------------------- + +function FreeImage_GetImageType(dib: PFIBITMAP): FREE_IMAGE_TYPE; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// -------------------------------------------------------------------------- +// FreeImage helper routines ------------------------------------------------ +// -------------------------------------------------------------------------- + +function FreeImage_IsLittleEndian: Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_LookupX11Color(const szColor: PChar; var nRed, nGreen, nBlue: PByte): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_LookupSVGColor(const szColor: PChar; var nRed, nGreen, nBlue: PByte): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// -------------------------------------------------------------------------- +// Pixels access routines --------------------------------------------------- +// -------------------------------------------------------------------------- + +function FreeImage_GetBits(dib: PFIBITMAP): PByte; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetScanLine(dib: PFIBITMAP; scanline: Integer): PByte; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +function FreeImage_GetPixelIndex(dib: PFIBITMAP; X, Y: Longint; Value: PByte): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetPixelColor(dib: PFIBITMAP; X, Y: Longint; Value: PRGBQuad): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_SetPixelIndex(dib: PFIBITMAP; X, Y: Longint; Value: PByte): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_SetPixelColor(dib: PFIBITMAP; X, Y: Longint; Value: PRGBQuad): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// -------------------------------------------------------------------------- +// DIB info routines -------------------------------------------------------- +// -------------------------------------------------------------------------- + +function FreeImage_GetColorsUsed(dib: PFIBITMAP): Cardinal; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetBPP(dib: PFIBITMAP): Cardinal; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetWidth(dib: PFIBITMAP): Cardinal; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetHeight(dib: PFIBITMAP): Cardinal; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetLine(dib: PFIBITMAP): Cardinal; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetPitch(dib : PFIBITMAP) : Cardinal; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetDIBSize(dib: PFIBITMAP): Cardinal; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetPalette(dib: PFIBITMAP): PRGBQUAD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +function FreeImage_GetDotsPerMeterX(dib: PFIBITMAP): Cardinal; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetDotsPerMeterY(dib: PFIBITMAP): Cardinal; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_SetDotsPerMeterX(dib: PFIBITMAP; res: Cardinal); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_SetDotsPerMeterY(dib: PFIBITMAP; res: Cardinal); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +function FreeImage_GetInfoHeader(dib: PFIBITMAP): PBITMAPINFOHEADER; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetInfo(var dib: FIBITMAP): PBITMAPINFO; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetColorType(dib: PFIBITMAP): FREE_IMAGE_COLOR_TYPE; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +function FreeImage_GetRedMask(dib: PFIBITMAP): Cardinal; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetGreenMask(dib: PFIBITMAP): Cardinal; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetBlueMask(dib: PFIBITMAP): Cardinal; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +function FreeImage_GetTransparencyCount(dib: PFIBITMAP): Cardinal; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetTransparencyTable(dib: PFIBITMAP): PByte; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_SetTransparent(dib: PFIBITMAP; enabled: boolean); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_SetTransparencyTable(dib: PFIBITMAP; table: PByte; count: integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_IsTransparent(dib: PFIBITMAP): boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +function FreeImage_HasBackgroundColor(dib: PFIBITMAP): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetBackgroundColor(dib: PFIBITMAP; var bkcolor: PRGBQUAD): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_SetBackgroundColor(dib: PFIBITMAP; bkcolor: PRGBQUAD): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// -------------------------------------------------------------------------- +// ICC profile routines ----------------------------------------------------- +// -------------------------------------------------------------------------- + +function FreeImage_GetICCProfile(var dib: FIBITMAP): PFIICCPROFILE; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_CreateICCProfile(var dib: FIBITMAP; data: Pointer; size: Longint): PFIICCPROFILE; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_DestroyICCProfile(var dib : FIBITMAP); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// -------------------------------------------------------------------------- +// Line conversion routines ------------------------------------------------- +// -------------------------------------------------------------------------- + +procedure FreeImage_ConvertLine1To4(target, source: PBYTE; width_in_pixels: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine8To4(target, source: PBYTE; width_in_pixels: Integer; palette: PRGBQuad); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine16To4_555(target, source: PBYTE; width_in_pixels: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine16To4_565(target, source: PBYTE; width_in_pixels: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine24To4(target, source: PBYTE; width_in_pixels: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine32To4(target, source: PBYTE; width_in_pixels: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +procedure FreeImage_ConvertLine1To8(target, source: PBYTE; width_in_pixels: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine4To8(target, source: PBYTE; width_in_pixels: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine16To8_555(target, source: PBYTE; width_in_pixels: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine16To8_565(target, source: PBYTE; width_in_pixels: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine24To8(target, source: PBYTE; width_in_pixels: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine32To8(target, source: PBYTE; width_in_pixels: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +procedure FreeImage_ConvertLine1To16_555(target, source: PBYTE; width_in_pixels: Integer; palette: PRGBQUAD); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine4To16_555(target, source: PBYTE; width_in_pixels: Integer; palette: PRGBQUAD); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine8To16_555(target, source: PBYTE; width_in_pixels: Integer; palette: PRGBQUAD); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine16_565_To16_555(target, source: PBYTE; width_in_pixels: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine24To16_555(target, source: PBYTE; width_in_pixels: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine32To16_555(target, source: PBYTE; width_in_pixels: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +procedure FreeImage_ConvertLine1To16_565(target, source : PBYTE; width_in_pixels: Integer; palette: PRGBQUAD); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine4To16_565(target, source : PBYTE; width_in_pixels : Integer; palette : PRGBQUAD); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine8To16_565(target, source: PBYTE; width_in_pixels: Integer; palette: PRGBQUAD); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine16_555_To16_565(target, source: PBYTE; width_in_pixels: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine24To16_565(target, source: PBYTE; width_in_pixels: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine32To16_565(target, source : PBYTE; width_in_pixels : Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +procedure FreeImage_ConvertLine1To24(target, source: PBYTE; width_in_pixels: Integer; palette: PRGBQUAD); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine4To24(target, source : PBYTE; width_in_pixels: Integer; palette: PRGBQUAD); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine8To24(target, source: PBYTE; width_in_pixels: Integer; palette: PRGBQUAD); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine16To24_555(target, source: PBYTE; width_in_pixels: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine16To24_565(target, source: PBYTE; width_in_pixels: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine32To24(target, source: PBYTE; width_in_pixels: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +procedure FreeImage_ConvertLine1To32(target, source: PBYTE; width_in_pixels: Integer; palette: PRGBQUAD); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine4To32(target, source: PBYTE; width_in_pixels: Integer; palette: PRGBQUAD); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine8To32(target, source: PBYTE; width_in_pixels: Integer; palette: PRGBQUAD); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine16To32_555(target, source: PBYTE; width_in_pixels: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine16To32_565(target, source: PBYTE; width_in_pixels: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertLine24To32(target, source: PBYTE; width_in_pixels: Integer); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// -------------------------------------------------------------------------- +// Smart conversion routines ------------------------------------------------ +// -------------------------------------------------------------------------- + +function FreeImage_ConvertTo4Bits(dib: PFIBITMAP): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_ConvertTo8Bits(dib: PFIBITMAP): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_ConvertToGreyscale(dib: PFIBITMAP): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_ConvertTo16Bits555(dib: PFIBITMAP): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_ConvertTo16Bits565(dib: PFIBITMAP): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_ConvertTo24Bits(dib: PFIBITMAP): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_ConvertTo32Bits(dib: PFIBITMAP): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_ColorQuantize(dib: PFIBITMAP; quantize: FREE_IMAGE_QUANTIZE): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_ColorQuantizeEx(dib: PFIBITMAP; quantize: FREE_IMAGE_QUANTIZE = FIQ_WUQUANT; PaletteSize: Integer = 256; ReserveSize: Integer = 0; ReservePalette: PRGBQuad = nil): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_Threshold(dib: PFIBITMAP; T: Byte): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_Dither(dib: PFIBITMAP; algorithm: FREE_IMAGE_DITHER): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +function FreeImage_ConvertFromRawBits(bits: PBYTE; width, height, pitch: Integer; bpp, red_mask, green_mask, blue_mask: LongWord; topdown: Boolean): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_ConvertToRawBits(bits: PBYTE; dib: PFIBITMAP; pitch: Integer; bpp, red_mask, green_mask, blue_mask: LongWord; topdown: Boolean); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +function FreeImage_ConvertToRGBF(dib: PFIBITMAP): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +function FreeImage_ConvertToStandardType(src: PFIBITMAP; scale_linear: Boolean = True): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_ConvertToType(src: PFIBITMAP; dst_type: FREE_IMAGE_TYPE; scale_linear: Boolean = True): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// tone mapping operators +function FreeImage_ToneMapping(dib: PFIBITMAP; tmo: FREE_IMAGE_TMO; first_param: Double = 0; second_param: Double = 0): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_TmoDrago03(src: PFIBITMAP; gamma: Double = 2.2; exposure: Double = 0): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_TmoReinhard05(src: PFIBITMAP; intensity: Double = 0; contrast: Double = 0): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// -------------------------------------------------------------------------- +// ZLib interface ----------------------------------------------------------- +// -------------------------------------------------------------------------- + +function FreeImage_ZLibCompress(target: PBYTE; target_size: DWORD; source: PBYTE; source_size: DWORD): DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_ZLibUncompress(target: PBYTE; target_size: DWORD; source: PBYTE; source_size: DWORD): DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +function FreeImage_ZLibGZip(target: PBYTE; target_size: DWORD; source: PBYTE; source_size: DWORD): DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_ZLibGUnzip(target: PBYTE; target_size: DWORD; source: PBYTE; source_size: DWORD): DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_ZLibCRC32(crc: DWORD; source: PByte; source_size: DWORD): DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// -------------------------------------------------------------------------- +// Metadata routines -------------------------------------------------------- +// -------------------------------------------------------------------------- + +// tag creation / destruction +function FreeImage_CreateTag: PFITAG; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_DeleteTag(tag: PFITAG); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_CloneTag(tag: PFITAG): PFITAG; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// tag getters and setters +function FreeImage_GetTagKey(tag: PFITAG): PChar; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetTagDescription(tag: PFITAG): PChar; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetTagID(tag: PFITAG): Word; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetTagType(tag: PFITAG): FREE_IMAGE_MDTYPE; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetTagCount(tag: PFITAG): DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetTagLength(tag: PFITAG): DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetTagValue(tag: PFITAG): Pointer; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +function FreeImage_SetTagKey(tag: PFITAG; const key: PChar): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_SetTagDescription(tag: PFITAG; const description: PChar): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_SetTagID(tag: PFITAG; id: Word): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_SetTagType(tag: PFITAG; atype: FREE_IMAGE_MDTYPE): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_SetTagCount(tag: PFITAG; count: DWORD): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_SetTagLength(tag: PFITAG; length: DWORD): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_SetTagValue(tag: PFITAG; const value: Pointer): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// iterator +function FreeImage_FindFirstMetadata(model: FREE_IMAGE_MDMODEL; dib: PFIBITMAP; var tag: PFITAG): PFIMETADATA; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_FindNextMetadata(mdhandle: PFIMETADATA; var tag: PFITAG): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +procedure FreeImage_FindCloseMetadata(mdhandle: PFIMETADATA); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// metadata setter and getter +function FreeImage_SetMetadata(model: FREE_IMAGE_MDMODEL; dib: PFIBITMAP; const key: PChar; tag: PFITAG): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetMetadata(model: FREE_IMAGE_MDMODEL; dib: PFIBITMAP; const key: PChar; var tag: PFITAG): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// helpers +function FreeImage_GetMetadataCount(model: FREE_IMAGE_MDMODEL; dib: PFIBITMAP): Cardinal; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// tag to C string conversion +function FreeImage_TagToString(model: FREE_IMAGE_MDMODEL; tag: PFITAG; Make: PChar = nil): PChar; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// -------------------------------------------------------------------------- +// Image manipulation toolkit ----------------------------------------------- +// -------------------------------------------------------------------------- + +// rotation and flipping +function FreeImage_RotateClassic(dib: PFIBITMAP; angle: Double): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_RotateEx(dib: PFIBITMAP; angle, x_shift, y_shift, x_origin, y_origin: Double; use_mask: Boolean): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_FlipHorizontal(dib: PFIBITMAP): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_FlipVertical(dib: PFIBITMAP): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_JPEGTransform(const src_file: PChar; const dst_file: PChar; operation: FREE_IMAGE_JPEG_OPERATION; perfect: Boolean = False): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// upsampling / downsampling +function FreeImage_Rescale(dib: PFIBITMAP; dst_width, dst_height: Integer; filter: FREE_IMAGE_FILTER): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_MakeThumbnail(dib: PFIBITMAP; max_pixel_size: Integer; convert:boolean = TRUE): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// color manipulation routines (point operations) +function FreeImage_AdjustCurve(dib: PFIBITMAP; LUT: PBYTE; channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_AdjustGamma(dib: PFIBITMAP; gamma: Double): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_AdjustBrightness(dib: PFIBITMAP; percentage: Double): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_AdjustContrast(dib: PFIBITMAP; percentage: Double): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_Invert(dib: PFIBITMAP): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetHistogram(dib: PFIBITMAP; histo: PDWORD; channel: FREE_IMAGE_COLOR_CHANNEL = FICC_BLACK): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// channel processing routines +function FreeImage_GetChannel(dib: PFIBITMAP; channel: FREE_IMAGE_COLOR_CHANNEL): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_SetChannel(dib, dib8: PFIBITMAP; channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_GetComplexChannel(src: PFIBITMAP; channel: FREE_IMAGE_COLOR_CHANNEL): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_SetComplexChannel(src: PFIBITMAP; channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +// copy / paste / composite routines + +function FreeImage_Copy(dib: PFIBITMAP; left, top, right, bottom: Integer): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_Paste(dst, src: PFIBITMAP; left, top, alpha: Integer): Boolean; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; +function FreeImage_Composite(fg: PFIBITMAP; useFileBkg: Boolean = False; appBkColor: PRGBQUAD = nil; bg: PFIBITMAP = nil): PFIBITMAP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external FIDLL; + +{$MINENUMSIZE 1} +implementation + +end. diff --git a/Game/Code/lib/FreeImage/libfreeimage.dylib b/Game/Code/lib/FreeImage/libfreeimage.dylib new file mode 100755 index 00000000..5f9aecce Binary files /dev/null and b/Game/Code/lib/FreeImage/libfreeimage.dylib differ diff --git a/Game/Code/lib/SQLite/SQLite3.pas b/Game/Code/lib/SQLite/SQLite3.pas index b7f9d375..4991fc66 100644 --- a/Game/Code/lib/SQLite/SQLite3.pas +++ b/Game/Code/lib/SQLite/SQLite3.pas @@ -10,9 +10,19 @@ unit SQLite3; interface +{$I switches.inc} + const +{$IFDEF MSWINDOWS} SQLiteDLL = 'sqlite3.dll'; +{$ENDIF} +{$IFDEF LINUX} + SQLiteDLL = 'sqlite3.so'; +{$ENDIF} +{$IFDEF DARWIN} + SQLiteDLL = 'libsqlite3.dylib'; +{$ENDIF} // Return values for sqlite3_exec() and sqlite3_step() diff --git a/Game/Code/lib/SQLite/SQLiteTable3.pas b/Game/Code/lib/SQLite/SQLiteTable3.pas index 05fbd573..18135765 100644 --- a/Game/Code/lib/SQLite/SQLiteTable3.pas +++ b/Game/Code/lib/SQLite/SQLiteTable3.pas @@ -17,9 +17,7 @@ unit SQLiteTable3; interface -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} +{$I switches.inc} uses {$ifdef win32} diff --git a/Game/Code/lib/bass/MacOSX/Bass.pas b/Game/Code/lib/bass/MacOSX/Bass.pas new file mode 100755 index 00000000..d065f027 --- /dev/null +++ b/Game/Code/lib/bass/MacOSX/Bass.pas @@ -0,0 +1,984 @@ +{ + BASS 2.3 Audio Library, (c) 1999-2007 Ian Luck. + Please report bugs/suggestions/etc... to bass@un4seen.com + + See the BASS.CHM file for more complete documentation + + + How to install + ---------------- + Copy BASS.PAS to the \LIB subdirectory of your Delphi path or your project dir +} +unit Bass; + +{$I switches.inc} + +interface + +uses + Windows; + +const + BASSVERSION = $203; // API version + + // Use these to test for error from functions that return a DWORD or QWORD + DW_ERROR = Cardinal(-1); // -1 (DWORD) + QW_ERROR = Int64(-1); // -1 (QWORD) + + // Error codes returned by BASS_GetErrorCode() + BASS_OK = 0; // all is OK + BASS_ERROR_MEM = 1; // memory error + BASS_ERROR_FILEOPEN = 2; // can't open the file + BASS_ERROR_DRIVER = 3; // can't find a free sound driver + BASS_ERROR_BUFLOST = 4; // the sample buffer was lost - please report this! + BASS_ERROR_HANDLE = 5; // invalid handle + BASS_ERROR_FORMAT = 6; // unsupported sample format + BASS_ERROR_POSITION = 7; // invalid playback position + BASS_ERROR_INIT = 8; // BASS_Init has not been successfully called + BASS_ERROR_START = 9; // BASS_Start has not been successfully called + BASS_ERROR_ALREADY = 14; // already initialized/paused/whatever + BASS_ERROR_NOPAUSE = 16; // not paused + BASS_ERROR_NOCHAN = 18; // can't get a free channel + BASS_ERROR_ILLTYPE = 19; // an illegal type was specified + BASS_ERROR_ILLPARAM = 20; // an illegal parameter was specified + BASS_ERROR_NO3D = 21; // no 3D support + BASS_ERROR_NOEAX = 22; // no EAX support + BASS_ERROR_DEVICE = 23; // illegal device number + BASS_ERROR_NOPLAY = 24; // not playing + BASS_ERROR_FREQ = 25; // illegal sample rate + BASS_ERROR_NOTFILE = 27; // the stream is not a file stream + BASS_ERROR_NOHW = 29; // no hardware voices available + BASS_ERROR_EMPTY = 31; // the MOD music has no sequence data + BASS_ERROR_NONET = 32; // no internet connection could be opened + BASS_ERROR_CREATE = 33; // couldn't create the file + BASS_ERROR_NOFX = 34; // effects are not enabled + BASS_ERROR_PLAYING = 35; // the channel is playing + BASS_ERROR_NOTAVAIL = 37; // requested data is not available + BASS_ERROR_DECODE = 38; // the channel is a "decoding channel" + BASS_ERROR_DX = 39; // a sufficient DirectX version is not installed + BASS_ERROR_TIMEOUT = 40; // connection timedout + BASS_ERROR_FILEFORM = 41; // unsupported file format + BASS_ERROR_SPEAKER = 42; // unavailable speaker + BASS_ERROR_VERSION = 43; // invalid BASS version (used by add-ons) + BASS_ERROR_CODEC = 44; // codec is not available/supported + BASS_ERROR_UNKNOWN = -1; // some other mystery error + + // Initialization flags + BASS_DEVICE_8BITS = 1; // use 8 bit resolution, else 16 bit + BASS_DEVICE_MONO = 2; // use mono, else stereo + BASS_DEVICE_3D = 4; // enable 3D functionality + { + If the BASS_DEVICE_3D flag is not specified when + initilizing BASS, then the 3D flags (BASS_SAMPLE_3D + and BASS_MUSIC_3D) are ignored when loading/creating + a sample/stream/music. + } + BASS_DEVICE_LATENCY = 256; // calculate device latency (BASS_INFO struct) + BASS_DEVICE_SPEAKERS = 2048; // force enabling of speaker assignment + BASS_DEVICE_NOSPEAKER = 4096; // ignore speaker arrangement + + // DirectSound interfaces (for use with BASS_GetDSoundObject) + BASS_OBJECT_DS = 1; // IDirectSound + BASS_OBJECT_DS3DL = 2; // IDirectSound3DListener + + // BASS_INFO flags (from DSOUND.H) + DSCAPS_CONTINUOUSRATE = $00000010; + { supports all sample rates between min/maxrate } + DSCAPS_EMULDRIVER = $00000020; + { device does NOT have hardware DirectSound support } + DSCAPS_CERTIFIED = $00000040; + { device driver has been certified by Microsoft } + { + The following flags tell what type of samples are + supported by HARDWARE mixing, all these formats are + supported by SOFTWARE mixing + } + DSCAPS_SECONDARYMONO = $00000100; // mono + DSCAPS_SECONDARYSTEREO = $00000200; // stereo + DSCAPS_SECONDARY8BIT = $00000400; // 8 bit + DSCAPS_SECONDARY16BIT = $00000800; // 16 bit + + // BASS_RECORDINFO flags (from DSOUND.H) + DSCCAPS_EMULDRIVER = DSCAPS_EMULDRIVER; + { device does NOT have hardware DirectSound recording support } + DSCCAPS_CERTIFIED = DSCAPS_CERTIFIED; + { device driver has been certified by Microsoft } + + // defines for formats field of BASS_RECORDINFO (from MMSYSTEM.H) + WAVE_FORMAT_1M08 = $00000001; // 11.025 kHz, Mono, 8-bit + WAVE_FORMAT_1S08 = $00000002; // 11.025 kHz, Stereo, 8-bit + WAVE_FORMAT_1M16 = $00000004; // 11.025 kHz, Mono, 16-bit + WAVE_FORMAT_1S16 = $00000008; // 11.025 kHz, Stereo, 16-bit + WAVE_FORMAT_2M08 = $00000010; // 22.05 kHz, Mono, 8-bit + WAVE_FORMAT_2S08 = $00000020; // 22.05 kHz, Stereo, 8-bit + WAVE_FORMAT_2M16 = $00000040; // 22.05 kHz, Mono, 16-bit + WAVE_FORMAT_2S16 = $00000080; // 22.05 kHz, Stereo, 16-bit + WAVE_FORMAT_4M08 = $00000100; // 44.1 kHz, Mono, 8-bit + WAVE_FORMAT_4S08 = $00000200; // 44.1 kHz, Stereo, 8-bit + WAVE_FORMAT_4M16 = $00000400; // 44.1 kHz, Mono, 16-bit + WAVE_FORMAT_4S16 = $00000800; // 44.1 kHz, Stereo, 16-bit + + // Sample info flags + BASS_SAMPLE_8BITS = 1; // 8 bit + BASS_SAMPLE_FLOAT = 256; // 32-bit floating-point + BASS_SAMPLE_MONO = 2; // mono, else stereo + BASS_SAMPLE_LOOP = 4; // looped + BASS_SAMPLE_3D = 8; // 3D functionality enabled + BASS_SAMPLE_SOFTWARE = 16; // it's NOT using hardware mixing + BASS_SAMPLE_MUTEMAX = 32; // muted at max distance (3D only) + BASS_SAMPLE_VAM = 64; // uses the DX7 voice allocation & management + BASS_SAMPLE_FX = 128; // old implementation of DX8 effects are enabled + BASS_SAMPLE_OVER_VOL = $10000; // override lowest volume + BASS_SAMPLE_OVER_POS = $20000; // override longest playing + BASS_SAMPLE_OVER_DIST = $30000; // override furthest from listener (3D only) + + BASS_STREAM_PRESCAN = $20000; // enable pin-point seeking (MP3/MP2/MP1) + BASS_MP3_SETPOS = BASS_STREAM_PRESCAN; + BASS_STREAM_AUTOFREE = $40000; // automatically free the stream when it stop/ends + BASS_STREAM_RESTRATE = $80000; // restrict the download rate of internet file streams + BASS_STREAM_BLOCK = $100000;// download/play internet file stream in small blocks + BASS_STREAM_DECODE = $200000;// don't play the stream, only decode (BASS_ChannelGetData) + BASS_STREAM_STATUS = $800000;// give server status info (HTTP/ICY tags) in DOWNLOADPROC + + BASS_MUSIC_FLOAT = BASS_SAMPLE_FLOAT; // 32-bit floating-point + BASS_MUSIC_MONO = BASS_SAMPLE_MONO; // force mono mixing (less CPU usage) + BASS_MUSIC_LOOP = BASS_SAMPLE_LOOP; // loop music + BASS_MUSIC_3D = BASS_SAMPLE_3D; // enable 3D functionality + BASS_MUSIC_FX = BASS_SAMPLE_FX; // enable old implementation of DX8 effects + BASS_MUSIC_AUTOFREE = BASS_STREAM_AUTOFREE; // automatically free the music when it stop/ends + BASS_MUSIC_DECODE = BASS_STREAM_DECODE; // don't play the music, only decode (BASS_ChannelGetData) + BASS_MUSIC_PRESCAN = BASS_STREAM_PRESCAN; // calculate playback length + BASS_MUSIC_CALCLEN = BASS_MUSIC_PRESCAN; + BASS_MUSIC_RAMP = $200; // normal ramping + BASS_MUSIC_RAMPS = $400; // sensitive ramping + BASS_MUSIC_SURROUND = $800; // surround sound + BASS_MUSIC_SURROUND2 = $1000; // surround sound (mode 2) + BASS_MUSIC_FT2MOD = $2000; // play .MOD as FastTracker 2 does + BASS_MUSIC_PT1MOD = $4000; // play .MOD as ProTracker 1 does + BASS_MUSIC_NONINTER = $10000; // non-interpolated mixing + BASS_MUSIC_POSRESET = $8000; // stop all notes when moving position + BASS_MUSIC_POSRESETEX = $400000; // stop all notes and reset bmp/etc when moving position + BASS_MUSIC_STOPBACK = $80000; // stop the music on a backwards jump effect + BASS_MUSIC_NOSAMPLE = $100000; // don't load the samples + + // Speaker assignment flags + BASS_SPEAKER_FRONT = $1000000; // front speakers + BASS_SPEAKER_REAR = $2000000; // rear/side speakers + BASS_SPEAKER_CENLFE = $3000000; // center & LFE speakers (5.1) + BASS_SPEAKER_REAR2 = $4000000; // rear center speakers (7.1) + BASS_SPEAKER_LEFT = $10000000; // modifier: left + BASS_SPEAKER_RIGHT = $20000000; // modifier: right + BASS_SPEAKER_FRONTLEFT = BASS_SPEAKER_FRONT or BASS_SPEAKER_LEFT; + BASS_SPEAKER_FRONTRIGHT = BASS_SPEAKER_FRONT or BASS_SPEAKER_RIGHT; + BASS_SPEAKER_REARLEFT = BASS_SPEAKER_REAR or BASS_SPEAKER_LEFT; + BASS_SPEAKER_REARRIGHT = BASS_SPEAKER_REAR or BASS_SPEAKER_RIGHT; + BASS_SPEAKER_CENTER = BASS_SPEAKER_CENLFE or BASS_SPEAKER_LEFT; + BASS_SPEAKER_LFE = BASS_SPEAKER_CENLFE or BASS_SPEAKER_RIGHT; + BASS_SPEAKER_REAR2LEFT = BASS_SPEAKER_REAR2 or BASS_SPEAKER_LEFT; + BASS_SPEAKER_REAR2RIGHT = BASS_SPEAKER_REAR2 or BASS_SPEAKER_RIGHT; + + BASS_UNICODE = $80000000; + + BASS_RECORD_PAUSE = $8000; // start recording paused + + // DX7 voice allocation flags + BASS_VAM_HARDWARE = 1; + { + Play the sample in hardware. If no hardware voices are available then + the "play" call will fail + } + BASS_VAM_SOFTWARE = 2; + { + Play the sample in software (ie. non-accelerated). No other VAM flags + may be used together with this flag. + } + + // DX7 voice management flags + { + These flags enable hardware resource stealing... if the hardware has no + available voices, a currently playing buffer will be stopped to make room + for the new buffer. NOTE: only samples loaded/created with the + BASS_SAMPLE_VAM flag are considered for termination by the DX7 voice + management. + } + BASS_VAM_TERM_TIME = 4; + { + If there are no free hardware voices, the buffer to be terminated will be + the one with the least time left to play. + } + BASS_VAM_TERM_DIST = 8; + { + If there are no free hardware voices, the buffer to be terminated will be + one that was loaded/created with the BASS_SAMPLE_MUTEMAX flag and is + beyond + it's max distance. If there are no buffers that match this criteria, then + the "play" call will fail. + } + BASS_VAM_TERM_PRIO = 16; + { + If there are no free hardware voices, the buffer to be terminated will be + the one with the lowest priority. + } + + // BASS_CHANNELINFO types + BASS_CTYPE_SAMPLE = 1; + BASS_CTYPE_RECORD = 2; + BASS_CTYPE_STREAM = $10000; + BASS_CTYPE_STREAM_OGG = $10002; + BASS_CTYPE_STREAM_MP1 = $10003; + BASS_CTYPE_STREAM_MP2 = $10004; + BASS_CTYPE_STREAM_MP3 = $10005; + BASS_CTYPE_STREAM_AIFF = $10006; + BASS_CTYPE_STREAM_WAV = $40000; // WAVE flag, LOWORD=codec + BASS_CTYPE_STREAM_WAV_PCM = $50001; + BASS_CTYPE_STREAM_WAV_FLOAT = $50003; + BASS_CTYPE_MUSIC_MOD = $20000; + BASS_CTYPE_MUSIC_MTM = $20001; + BASS_CTYPE_MUSIC_S3M = $20002; + BASS_CTYPE_MUSIC_XM = $20003; + BASS_CTYPE_MUSIC_IT = $20004; + BASS_CTYPE_MUSIC_MO3 = $00100; // MO3 flag + + // 3D channel modes + BASS_3DMODE_NORMAL = 0; + { normal 3D processing } + BASS_3DMODE_RELATIVE = 1; + { + The channel's 3D position (position/velocity/ + orientation) are relative to the listener. When the + listener's position/velocity/orientation is changed + with BASS_Set3DPosition, the channel's position + relative to the listener does not change. + } + BASS_3DMODE_OFF = 2; + { + Turn off 3D processing on the channel, the sound will + be played in the center. + } + + // EAX environments, use with BASS_SetEAXParameters + EAX_ENVIRONMENT_GENERIC = 0; + EAX_ENVIRONMENT_PADDEDCELL = 1; + EAX_ENVIRONMENT_ROOM = 2; + EAX_ENVIRONMENT_BATHROOM = 3; + EAX_ENVIRONMENT_LIVINGROOM = 4; + EAX_ENVIRONMENT_STONEROOM = 5; + EAX_ENVIRONMENT_AUDITORIUM = 6; + EAX_ENVIRONMENT_CONCERTHALL = 7; + EAX_ENVIRONMENT_CAVE = 8; + EAX_ENVIRONMENT_ARENA = 9; + EAX_ENVIRONMENT_HANGAR = 10; + EAX_ENVIRONMENT_CARPETEDHALLWAY = 11; + EAX_ENVIRONMENT_HALLWAY = 12; + EAX_ENVIRONMENT_STONECORRIDOR = 13; + EAX_ENVIRONMENT_ALLEY = 14; + EAX_ENVIRONMENT_FOREST = 15; + EAX_ENVIRONMENT_CITY = 16; + EAX_ENVIRONMENT_MOUNTAINS = 17; + EAX_ENVIRONMENT_QUARRY = 18; + EAX_ENVIRONMENT_PLAIN = 19; + EAX_ENVIRONMENT_PARKINGLOT = 20; + EAX_ENVIRONMENT_SEWERPIPE = 21; + EAX_ENVIRONMENT_UNDERWATER = 22; + EAX_ENVIRONMENT_DRUGGED = 23; + EAX_ENVIRONMENT_DIZZY = 24; + EAX_ENVIRONMENT_PSYCHOTIC = 25; + // total number of environments + EAX_ENVIRONMENT_COUNT = 26; + + // software 3D mixing algorithm modes (used with BASS_Set3DAlgorithm) + BASS_3DALG_DEFAULT = 0; + { + default algorithm (currently translates to BASS_3DALG_OFF) + } + BASS_3DALG_OFF = 1; + { + Uses normal left and right panning. The vertical axis is ignored except + for scaling of volume due to distance. Doppler shift and volume scaling + are still applied, but the 3D filtering is not performed. This is the + most CPU efficient software implementation, but provides no virtual 3D + audio effect. Head Related Transfer Function processing will not be done. + Since only normal stereo panning is used, a channel using this algorithm + may be accelerated by a 2D hardware voice if no free 3D hardware voices + are available. + } + BASS_3DALG_FULL = 2; + { + This algorithm gives the highest quality 3D audio effect, but uses more + CPU. Requires Windows 98 2nd Edition or Windows 2000 that uses WDM + drivers, if this mode is not available then BASS_3DALG_OFF will be used + instead. + } + BASS_3DALG_LIGHT = 3; + { + This algorithm gives a good 3D audio effect, and uses less CPU than the + FULL mode. Requires Windows 98 2nd Edition or Windows 2000 that uses WDM + drivers, if this mode is not available then BASS_3DALG_OFF will be used + instead. + } + + { + Sync types (with BASS_ChannelSetSync() "param" and + SYNCPROC "data" definitions) & flags. + } + BASS_SYNC_POS = 0; + { + Sync when a channel reaches a position. + param: position in bytes + data : not used + } + BASS_SYNC_END = 2; + { + Sync when a channel reaches the end. + param: not used + data : not used + } + BASS_SYNC_META = 4; + { + Sync when metadata is received in a stream. + param: not used + data : pointer to the metadata + } + BASS_SYNC_SLIDE = 5; + { + Sync when an attribute slide is completed. + param: not used + data : the type of slide completed (one of the BASS_SLIDE_xxx values) + } + BASS_SYNC_STALL = 6; + { + Sync when playback has stalled. + param: not used + data : 0=stalled, 1=resumed + } + BASS_SYNC_DOWNLOAD = 7; + { + Sync when downloading of an internet (or "buffered" user file) stream has ended. + param: not used + data : not used + } + BASS_SYNC_FREE = 8; + { + Sync when a channel is freed. + param: not used + data : not used + } + BASS_SYNC_SETPOS = 11; + { + Sync when a channel's position is set. + param: not used + data : 0 = playback buffer not flushed, 1 = playback buffer flushed + } + BASS_SYNC_MUSICPOS = 10; + { + Sync when a MOD music reaches an order:row position. + param: LOWORD=order (0=first, -1=all) HIWORD=row (0=first, -1=all) + data : LOWORD=order HIWORD=row + } + BASS_SYNC_MUSICINST = 1; + { + Sync when an instrument (sample for the non-instrument based formats) + is played in a MOD music (not including retrigs). + param: LOWORD=instrument (1=first) HIWORD=note (0=c0...119=b9, -1=all) + data : LOWORD=note HIWORD=volume (0-64) + } + BASS_SYNC_MUSICFX = 3; + { + Sync when the "sync" effect (XM/MTM/MOD: E8x/Wxx, IT/S3M: S2x) is used. + param: 0:data=pos, 1:data="x" value + data : param=0: LOWORD=order HIWORD=row, param=1: "x" value + } + BASS_SYNC_MESSAGE = $20000000; + { FLAG: post a Windows message (instead of callback) + When using a window message "callback", the message to post is given in the "proc" + parameter of BASS_ChannelSetSync, and is posted to the window specified in the BASS_Init + call. The message parameters are: WPARAM = data, LPARAM = user. + } + BASS_SYNC_MIXTIME = $40000000; + { FLAG: sync at mixtime, else at playtime } + BASS_SYNC_ONETIME = $80000000; + { FLAG: sync only once, else continuously } + + // BASS_ChannelIsActive return values + BASS_ACTIVE_STOPPED = 0; + BASS_ACTIVE_PLAYING = 1; + BASS_ACTIVE_STALLED = 2; + BASS_ACTIVE_PAUSED = 3; + + // BASS_ChannelIsSliding return flags + BASS_SLIDE_FREQ = 1; + BASS_SLIDE_VOL = 2; + BASS_SLIDE_PAN = 4; + + // BASS_ChannelGetData flags + BASS_DATA_AVAILABLE = 0; // query how much data is buffered + BASS_DATA_FLOAT = $40000000; // flag: return floating-point sample data + BASS_DATA_FFT512 = $80000000; // 512 sample FFT + BASS_DATA_FFT1024 = $80000001; // 1024 FFT + BASS_DATA_FFT2048 = $80000002; // 2048 FFT + BASS_DATA_FFT4096 = $80000003; // 4096 FFT + BASS_DATA_FFT8192 = $80000004; // 8192 FFT + BASS_DATA_FFT_INDIVIDUAL = $10; // FFT flag: FFT for each channel, else all combined + BASS_DATA_FFT_NOWINDOW = $20; // FFT flag: no Hanning window + + // BASS_ChannelGetTags types : what's returned + BASS_TAG_ID3 = 0; // ID3v1 tags : 128 byte block + BASS_TAG_ID3V2 = 1; // ID3v2 tags : variable length block + BASS_TAG_OGG = 2; // OGG comments : array of null-terminated strings + BASS_TAG_HTTP = 3; // HTTP headers : array of null-terminated strings + BASS_TAG_ICY = 4; // ICY headers : array of null-terminated strings + BASS_TAG_META = 5; // ICY metadata : null-terminated string + BASS_TAG_VENDOR = 9; // OGG encoder : null-terminated string + BASS_TAG_LYRICS3 = 10; // Lyric3v2 tag : ASCII string + BASS_TAG_RIFF_INFO = $100; // RIFF/WAVE tags : array of null-terminated ANSI strings + BASS_TAG_MUSIC_NAME = $10000; // MOD music name : ANSI string + BASS_TAG_MUSIC_MESSAGE = $10001; // MOD message : ANSI string + BASS_TAG_MUSIC_INST = $10100; // + instrument #, MOD instrument name : ANSI string + BASS_TAG_MUSIC_SAMPLE = $10300; // + sample #, MOD sample name : ANSI string + + BASS_FX_CHORUS = 0; // GUID_DSFX_STANDARD_CHORUS + BASS_FX_COMPRESSOR = 1; // GUID_DSFX_STANDARD_COMPRESSOR + BASS_FX_DISTORTION = 2; // GUID_DSFX_STANDARD_DISTORTION + BASS_FX_ECHO = 3; // GUID_DSFX_STANDARD_ECHO + BASS_FX_FLANGER = 4; // GUID_DSFX_STANDARD_FLANGER + BASS_FX_GARGLE = 5; // GUID_DSFX_STANDARD_GARGLE + BASS_FX_I3DL2REVERB = 6; // GUID_DSFX_STANDARD_I3DL2REVERB + BASS_FX_PARAMEQ = 7; // GUID_DSFX_STANDARD_PARAMEQ + BASS_FX_REVERB = 8; // GUID_DSFX_WAVES_REVERB + + BASS_FX_PHASE_NEG_180 = 0; + BASS_FX_PHASE_NEG_90 = 1; + BASS_FX_PHASE_ZERO = 2; + BASS_FX_PHASE_90 = 3; + BASS_FX_PHASE_180 = 4; + + // BASS_RecordSetInput flags + BASS_INPUT_OFF = $10000; + BASS_INPUT_ON = $20000; + BASS_INPUT_LEVEL = $40000; + + BASS_INPUT_TYPE_MASK = $ff000000; + BASS_INPUT_TYPE_UNDEF = $00000000; + BASS_INPUT_TYPE_DIGITAL = $01000000; + BASS_INPUT_TYPE_LINE = $02000000; + BASS_INPUT_TYPE_MIC = $03000000; + BASS_INPUT_TYPE_SYNTH = $04000000; + BASS_INPUT_TYPE_CD = $05000000; + BASS_INPUT_TYPE_PHONE = $06000000; + BASS_INPUT_TYPE_SPEAKER = $07000000; + BASS_INPUT_TYPE_WAVE = $08000000; + BASS_INPUT_TYPE_AUX = $09000000; + BASS_INPUT_TYPE_ANALOG = $0a000000; + + // BASS_SetNetConfig flags + BASS_NET_TIMEOUT = 0; + BASS_NET_BUFFER = 1; + + // BASS_StreamGetFilePosition modes + BASS_FILEPOS_CURRENT = 0; + BASS_FILEPOS_DECODE = BASS_FILEPOS_CURRENT; + BASS_FILEPOS_DOWNLOAD = 1; + BASS_FILEPOS_END = 2; + BASS_FILEPOS_START = 3; + BASS_FILEPOS_CONNECTED = 4; + + // STREAMFILEPROC actions + BASS_FILE_CLOSE = 0; + BASS_FILE_READ = 1; + BASS_FILE_LEN = 3; + BASS_FILE_SEEK = 4; + + BASS_STREAMPROC_END = $80000000; // end of user stream flag + + // BASS_MusicSet/GetAttribute options + BASS_MUSIC_ATTRIB_AMPLIFY = 0; + BASS_MUSIC_ATTRIB_PANSEP = 1; + BASS_MUSIC_ATTRIB_PSCALER = 2; + BASS_MUSIC_ATTRIB_BPM = 3; + BASS_MUSIC_ATTRIB_SPEED = 4; + BASS_MUSIC_ATTRIB_VOL_GLOBAL = 5; + BASS_MUSIC_ATTRIB_VOL_CHAN = $100; // + channel # + BASS_MUSIC_ATTRIB_VOL_INST = $200; // + instrument # + + // BASS_Set/GetConfig options + BASS_CONFIG_BUFFER = 0; + BASS_CONFIG_UPDATEPERIOD = 1; + BASS_CONFIG_MAXVOL = 3; + BASS_CONFIG_GVOL_SAMPLE = 4; + BASS_CONFIG_GVOL_STREAM = 5; + BASS_CONFIG_GVOL_MUSIC = 6; + BASS_CONFIG_CURVE_VOL = 7; + BASS_CONFIG_CURVE_PAN = 8; + BASS_CONFIG_FLOATDSP = 9; + BASS_CONFIG_3DALGORITHM = 10; + BASS_CONFIG_NET_TIMEOUT = 11; + BASS_CONFIG_NET_BUFFER = 12; + BASS_CONFIG_PAUSE_NOPLAY = 13; + BASS_CONFIG_NET_PREBUF = 15; + BASS_CONFIG_NET_AGENT = 16; + BASS_CONFIG_NET_PROXY = 17; + BASS_CONFIG_NET_PASSIVE = 18; + BASS_CONFIG_REC_BUFFER = 19; + BASS_CONFIG_NET_PLAYLIST = 21; + BASS_CONFIG_MUSIC_VIRTUAL = 22; + +type + DWORD = cardinal; + BOOL = LongBool; + FLOAT = Single; + QWORD = int64; // 64-bit (replace "int64" with "comp" if using Delphi 3) + + HMUSIC = DWORD; // MOD music handle + HSAMPLE = DWORD; // sample handle + HCHANNEL = DWORD; // playing sample's channel handle + HSTREAM = DWORD; // sample stream handle + HRECORD = DWORD; // recording handle + HSYNC = DWORD; // synchronizer handle + HDSP = DWORD; // DSP handle + HFX = DWORD; // DX8 effect handle + HPLUGIN = DWORD; // Plugin handle + + BASS_INFO = record + flags: DWORD; // device capabilities (DSCAPS_xxx flags) + hwsize: DWORD; // size of total device hardware memory + hwfree: DWORD; // size of free device hardware memory + freesam: DWORD; // number of free sample slots in the hardware + free3d: DWORD; // number of free 3D sample slots in the hardware + minrate: DWORD; // min sample rate supported by the hardware + maxrate: DWORD; // max sample rate supported by the hardware + eax: BOOL; // device supports EAX? (always FALSE if BASS_DEVICE_3D was not used) + minbuf: DWORD; // recommended minimum buffer length in ms (requires BASS_DEVICE_LATENCY) + dsver: DWORD; // DirectSound version + latency: DWORD; // delay (in ms) before start of playback (requires BASS_DEVICE_LATENCY) + initflags: DWORD; // "flags" parameter of BASS_Init call + speakers: DWORD; // number of speakers available + driver: PChar; // driver + freq: DWORD; // current output rate (OSX only) + end; + + BASS_RECORDINFO = record + flags: DWORD; // device capabilities (DSCCAPS_xxx flags) + formats: DWORD; // supported standard formats (WAVE_FORMAT_xxx flags) + inputs: DWORD; // number of inputs + singlein: BOOL; // only 1 input can be set at a time + driver: PChar; // driver + freq: DWORD; // current input rate (OSX only) + end; + + BASS_CHANNELINFO = record + freq: DWORD; // default playback rate + chans: DWORD; // channels + flags: DWORD; // BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags + ctype: DWORD; // type of channel + origres: DWORD; // original resolution + plugin: HPLUGIN; // plugin + end; + + BASS_PLUGINFORM = record + ctype: DWORD; // channel type + name: PChar; // format description + exts: PChar; // file extension filter ( *.ext1;*.ext2;etc...) + end; + PBASS_PLUGINFORMS = ^TBASS_PLUGINFORMS; + TBASS_PLUGINFORMS = array[0..maxInt div sizeOf(BASS_PLUGINFORM) - 1] of BASS_PLUGINFORM; + + BASS_PLUGININFO = record + version: DWORD; // version (same form as BASS_GetVersion) + formatc: DWORD; // number of formats + formats: PBASS_PLUGINFORMS; // the array of formats + end; + PBASS_PLUGININFO = ^BASS_PLUGININFO; + + // Sample info structure + BASS_SAMPLE = record + freq: DWORD; // default playback rate + volume: DWORD; // default volume (0-100) + pan: Integer; // default pan (-100=left, 0=middle, 100=right) + flags: DWORD; // BASS_SAMPLE_xxx flags + length: DWORD; // length (in samples, not bytes) + max: DWORD; // maximum simultaneous playbacks + origres: DWORD; // original resolution + chans: DWORD; // number of channels + mingap: DWORD; // minimum gap (ms) between creating channels + { + The following are the samples default 3D attributes + (if the sample is 3D, BASS_SAMPLE_3D is in flags) + see BASS_ChannelSet3DAttributes + } + mode3d: DWORD; // BASS_3DMODE_xxx mode + mindist: FLOAT; // minimum distance + maxdist: FLOAT; // maximum distance + iangle: DWORD; // angle of inside projection cone + oangle: DWORD; // angle of outside projection cone + outvol: DWORD; // delta-volume outside the projection cone + { + The following are the defaults used if the sample uses the DirectX 7 + voice allocation/management features. + } + vam: DWORD; // voice allocation/management flags (BASS_VAM_xxx) + priority: DWORD; // priority (0=lowest, $ffffffff=highest) + end; + + // 3D vector (for 3D positions/velocities/orientations) + BASS_3DVECTOR = record + x: FLOAT; // +=right, -=left + y: FLOAT; // +=up, -=down + z: FLOAT; // +=front, -=behind + end; + + BASS_FXCHORUS = record + fWetDryMix: FLOAT; + fDepth: FLOAT; + fFeedback: FLOAT; + fFrequency: FLOAT; + lWaveform: DWORD; // 0=triangle, 1=sine + fDelay: FLOAT; + lPhase: DWORD; // BASS_FX_PHASE_xxx + end; + + BASS_FXCOMPRESSOR = record + fGain: FLOAT; + fAttack: FLOAT; + fRelease: FLOAT; + fThreshold: FLOAT; + fRatio: FLOAT; + fPredelay: FLOAT; + end; + + BASS_FXDISTORTION = record + fGain: FLOAT; + fEdge: FLOAT; + fPostEQCenterFrequency: FLOAT; + fPostEQBandwidth: FLOAT; + fPreLowpassCutoff: FLOAT; + end; + + BASS_FXECHO = record + fWetDryMix: FLOAT; + fFeedback: FLOAT; + fLeftDelay: FLOAT; + fRightDelay: FLOAT; + lPanDelay: BOOL; + end; + + BASS_FXFLANGER = record + fWetDryMix: FLOAT; + fDepth: FLOAT; + fFeedback: FLOAT; + fFrequency: FLOAT; + lWaveform: DWORD; // 0=triangle, 1=sine + fDelay: FLOAT; + lPhase: DWORD; // BASS_FX_PHASE_xxx + end; + + BASS_FXGARGLE = record + dwRateHz: DWORD; // Rate of modulation in hz + dwWaveShape: DWORD; // 0=triangle, 1=square + end; + + BASS_FXI3DL2REVERB = record + lRoom: Longint; // [-10000, 0] default: -1000 mB + lRoomHF: Longint; // [-10000, 0] default: 0 mB + flRoomRolloffFactor: FLOAT; // [0.0, 10.0] default: 0.0 + flDecayTime: FLOAT; // [0.1, 20.0] default: 1.49s + flDecayHFRatio: FLOAT; // [0.1, 2.0] default: 0.83 + lReflections: Longint; // [-10000, 1000] default: -2602 mB + flReflectionsDelay: FLOAT; // [0.0, 0.3] default: 0.007 s + lReverb: Longint; // [-10000, 2000] default: 200 mB + flReverbDelay: FLOAT; // [0.0, 0.1] default: 0.011 s + flDiffusion: FLOAT; // [0.0, 100.0] default: 100.0 % + flDensity: FLOAT; // [0.0, 100.0] default: 100.0 % + flHFReference: FLOAT; // [20.0, 20000.0] default: 5000.0 Hz + end; + + BASS_FXPARAMEQ = record + fCenter: FLOAT; + fBandwidth: FLOAT; + fGain: FLOAT; + end; + + BASS_FXREVERB = record + fInGain: FLOAT; // [-96.0,0.0] default: 0.0 dB + fReverbMix: FLOAT; // [-96.0,0.0] default: 0.0 db + fReverbTime: FLOAT; // [0.001,3000.0] default: 1000.0 ms + fHighFreqRTRatio: FLOAT; // [0.001,0.999] default: 0.001 + end; + + // callback function types + STREAMPROC = function(handle: HSTREAM; buffer: Pointer; length: DWORD; user: DWORD): DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + { + User stream callback function. NOTE: A stream function should obviously be as + quick as possible, other streams (and MOD musics) can't be mixed until + it's finished. + handle : The stream that needs writing + buffer : Buffer to write the samples in + length : Number of bytes to write + user : The 'user' parameter value given when calling BASS_StreamCreate + RETURN : Number of bytes written. Set the BASS_STREAMPROC_END flag to end + the stream. + } + + STREAMFILEPROC = function(action, param1, param2, user: DWORD): DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + { + User file stream callback function. + action : The action to perform, one of BASS_FILE_xxx values. + param1 : Depends on "action" + param2 : Depends on "action" + user : The 'user' parameter value given when calling BASS_StreamCreate + RETURN : Depends on "action" + } + + DOWNLOADPROC = procedure(buffer: Pointer; length: DWORD; user: DWORD); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + { + Internet stream download callback function. + buffer : Buffer containing the downloaded data... NULL=end of download + length : Number of bytes in the buffer + user : The 'user' parameter value given when calling BASS_StreamCreateURL + } + + SYNCPROC = procedure(handle: HSYNC; channel, data: DWORD; user: DWORD); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + { + Sync callback function. NOTE: a sync callback function should be very + quick as other syncs cannot be processed until it has finished. If the + sync is a "mixtime" sync, then other streams and MOD musics can not be + mixed until it's finished either. + handle : The sync that has occured + channel: Channel that the sync occured in + data : Additional data associated with the sync's occurance + user : The 'user' parameter given when calling BASS_ChannelSetSync + } + + DSPPROC = procedure(handle: HDSP; channel: DWORD; buffer: Pointer; length: DWORD; user: DWORD); {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + { + DSP callback function. NOTE: A DSP function should obviously be as quick + as possible... other DSP functions, streams and MOD musics can not be + processed until it's finished. + handle : The DSP handle + channel: Channel that the DSP is being applied to + buffer : Buffer to apply the DSP to + length : Number of bytes in the buffer + user : The 'user' parameter given when calling BASS_ChannelSetDSP + } + + RECORDPROC = function(handle: HRECORD; const buffer: Pointer; length: DWORD; user: DWORD): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} + { + Recording callback function. + handle : The recording handle + buffer : Buffer containing the recorded sample data + length : Number of bytes + user : The 'user' parameter value given when calling BASS_RecordStart + RETURN : TRUE = continue recording, FALSE = stop + } + + +// Functions +const + +{$IFDEF MSWINDOWS} + bassdll = 'bass.dll'; +{$ENDIF} +{$IFDEF DARWIN} + bassdll = 'libbass.dylib'; +{$ENDIF} + +function BASS_SetConfig(option, value: DWORD): DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_GetConfig(option: DWORD): DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_GetVersion: DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_GetDeviceDescription(device: DWORD): PChar; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ErrorGetCode: Integer; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_Init(device: Integer; freq, flags: DWORD; win: HWND; clsid: PGUID): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_SetDevice(device: DWORD): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_GetDevice: DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_Free: BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_GetDSoundObject(obj: DWORD): Pointer; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_GetInfo(var info: BASS_INFO): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_Update: BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_GetCPU: FLOAT; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_Start: BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_Stop: BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_Pause: BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_SetVolume(volume: DWORD): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_GetVolume: Integer; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; + +function BASS_PluginLoad(filename: PChar; flags: DWORD): HPLUGIN; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_PluginFree(handle: HPLUGIN): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_PluginGetInfo(handle: HPLUGIN): PBASS_PLUGININFO; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; + +function BASS_Set3DFactors(distf, rollf, doppf: FLOAT): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_Get3DFactors(var distf, rollf, doppf: FLOAT): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_Set3DPosition(var pos, vel, front, top: BASS_3DVECTOR): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_Get3DPosition(var pos, vel, front, top: BASS_3DVECTOR): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +procedure BASS_Apply3D; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +{$IFDEF MSWINDOWS} +function BASS_SetEAXParameters(env: Integer; vol, decay, damp: FLOAT): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_GetEAXParameters(var env: DWORD; var vol, decay, damp: FLOAT): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +{$ENDIF} + +function BASS_MusicLoad(mem: BOOL; f: Pointer; offset, length, flags, freq: DWORD): HMUSIC; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_MusicFree(handle: HMUSIC): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_MusicSetAttribute(handle: HMUSIC; attrib,value: DWORD): DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_MusicGetAttribute(handle: HMUSIC; attrib: DWORD): DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_MusicGetOrders(handle: HMUSIC): DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_MusicGetOrderPosition(handle: HMUSIC): DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; + +function BASS_SampleLoad(mem: BOOL; f: Pointer; offset, length, max, flags: DWORD): HSAMPLE; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_SampleCreate(length, freq, chans, max, flags: DWORD): Pointer; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_SampleCreateDone: HSAMPLE; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_SampleFree(handle: HSAMPLE): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_SampleGetInfo(handle: HSAMPLE; var info: BASS_SAMPLE): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_SampleSetInfo(handle: HSAMPLE; var info: BASS_SAMPLE): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_SampleGetChannel(handle: HSAMPLE; onlynew: BOOL): HCHANNEL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_SampleGetChannels(handle: HSAMPLE; channels: Pointer): DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_SampleStop(handle: HSAMPLE): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; + +function BASS_StreamCreate(freq, chans, flags: DWORD; proc: Pointer; user: DWORD): HSTREAM; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_StreamCreateFile(mem: BOOL; f: Pointer; offset, length, flags: DWORD): HSTREAM; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_StreamCreateURL(url: PChar; offset: DWORD; flags: DWORD; proc: DOWNLOADPROC; user: DWORD):HSTREAM; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_StreamCreateFileUser(buffered: BOOL; flags: DWORD; proc: STREAMFILEPROC; user: DWORD): HSTREAM; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_StreamFree(handle: HSTREAM): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_StreamGetFilePosition(handle:HSTREAM; mode:DWORD) : DWORD;{$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF}external bassdll; +function BASS_StreamGetLength(handle: DWORD): QWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll name 'BASS_ChannelGetLength'; + +function BASS_RecordGetDeviceDescription(devnum: DWORD):PChar;{$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF}external bassdll; +function BASS_RecordInit(device: Integer):BOOL;{$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF}external bassdll; +function BASS_RecordSetDevice(device: DWORD): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_RecordGetDevice: DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_RecordFree:BOOL;{$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF}external bassdll; +function BASS_RecordGetInfo(var info:BASS_RECORDINFO):BOOL;{$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF}external bassdll; +function BASS_RecordGetInputName(input:Integer):PChar;{$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF}external bassdll; +function BASS_RecordSetInput(input:Integer; setting:DWORD):BOOL;{$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF}external bassdll; +function BASS_RecordGetInput(input:Integer):DWORD;{$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF}external bassdll; +function BASS_RecordStart(freq,chans,flags:DWORD; proc:RECORDPROC; user:DWORD):HRECORD;{$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF}external bassdll; + +function BASS_ChannelBytes2Seconds(handle: DWORD; pos: QWORD): FLOAT; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF}external bassdll; +function BASS_ChannelSeconds2Bytes(handle: DWORD; pos: FLOAT): QWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF}external bassdll; +function BASS_ChannelGetDevice(handle: DWORD): DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelSetDevice(handle, device: DWORD): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelIsActive(handle: DWORD): DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF}external bassdll; +function BASS_ChannelGetInfo(handle: DWORD; var info:BASS_CHANNELINFO):BOOL;{$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF}external bassdll; +function BASS_ChannelGetTags(handle: HSTREAM; tags : DWORD): PChar; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelSetFlags(handle, flags: DWORD): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelPreBuf(handle, length: DWORD): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelPlay(handle: DWORD; restart: BOOL): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelStop(handle: DWORD): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelPause(handle: DWORD): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelSetAttributes(handle: DWORD; freq, volume, pan: Integer): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelGetAttributes(handle: DWORD; var freq, volume: DWORD; var pan: Integer): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelSlideAttributes(handle: DWORD; freq, volume, pan: Integer; time: DWORD): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelIsSliding(handle: DWORD): DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF}external bassdll; +function BASS_ChannelSet3DAttributes(handle: DWORD; mode: Integer; min, max: FLOAT; iangle, oangle, outvol: Integer): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelGet3DAttributes(handle: DWORD; var mode: DWORD; var min, max: FLOAT; var iangle, oangle, outvol: DWORD): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelSet3DPosition(handle: DWORD; var pos, orient, vel: BASS_3DVECTOR): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelGet3DPosition(handle: DWORD; var pos, orient, vel: BASS_3DVECTOR): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelGetLength(handle: DWORD): QWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelSetPosition(handle: DWORD; pos: QWORD): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelGetPosition(handle: DWORD): QWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelGetLevel(handle: DWORD): DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelGetData(handle: DWORD; buffer: Pointer; length: DWORD): DWORD; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelSetSync(handle: DWORD; stype: DWORD; param: QWORD; proc: SYNCPROC; user: DWORD): HSYNC; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelRemoveSync(handle: DWORD; sync: HSYNC): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelSetDSP(handle: DWORD; proc: DSPPROC; user: DWORD; priority: Integer): HDSP; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelRemoveDSP(handle: DWORD; dsp: HDSP): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +{$IFDEF MSWINDOWS} +function BASS_ChannelSetEAXMix(handle: DWORD; mix: FLOAT): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelGetEAXMix(handle: DWORD; var mix: FLOAT): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +{$ENDIF} +function BASS_ChannelSetLink(handle, chan: DWORD): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelRemoveLink(handle, chan: DWORD): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelSetFX(handle, etype: DWORD; priority: Integer): HFX; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_ChannelRemoveFX(handle: DWORD; fx: HFX): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; + +function BASS_FXSetParameters(handle: HFX; par: Pointer): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_FXGetParameters(handle: HFX; par: Pointer): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; +function BASS_FXReset(handle: HFX): BOOL; {$IFDEF DLL_STDCALL} stdcall; {$ENDIF} {$IFDEF DLL_CDECL} cdecl; {$ENDIF} external bassdll; + + +function BASS_SPEAKER_N(n: DWORD): DWORD; +function MAKEMUSICPOS(order,row: DWORD): DWORD; +{$IFDEF MSWINDOWS} +function BASS_SetEAXPreset(env: Integer): BOOL; +{ + This function is defined in the implementation part of this unit. + It is not part of BASS.DLL but an extra function which makes it easier + to set the predefined EAX environments. + env : a EAX_ENVIRONMENT_xxx constant +} +{$ENDIF} + +implementation + +function BASS_SPEAKER_N(n: DWORD): DWORD; +begin + Result := n shl 24; +end; + +function MAKEMUSICPOS(order,row: DWORD): DWORD; +begin + Result := $80000000 or DWORD(MAKELONG(order,row)); +end; + +{$IFDEF MSWINDOWS} +function BASS_SetEAXPreset(env: Integer): BOOL; +begin + case (env) of + EAX_ENVIRONMENT_GENERIC: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_GENERIC, 0.5, 1.493, 0.5); + EAX_ENVIRONMENT_PADDEDCELL: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_PADDEDCELL, 0.25, 0.1, 0); + EAX_ENVIRONMENT_ROOM: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_ROOM, 0.417, 0.4, 0.666); + EAX_ENVIRONMENT_BATHROOM: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_BATHROOM, 0.653, 1.499, 0.166); + EAX_ENVIRONMENT_LIVINGROOM: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_LIVINGROOM, 0.208, 0.478, 0); + EAX_ENVIRONMENT_STONEROOM: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_STONEROOM, 0.5, 2.309, 0.888); + EAX_ENVIRONMENT_AUDITORIUM: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_AUDITORIUM, 0.403, 4.279, 0.5); + EAX_ENVIRONMENT_CONCERTHALL: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_CONCERTHALL, 0.5, 3.961, 0.5); + EAX_ENVIRONMENT_CAVE: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_CAVE, 0.5, 2.886, 1.304); + EAX_ENVIRONMENT_ARENA: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_ARENA, 0.361, 7.284, 0.332); + EAX_ENVIRONMENT_HANGAR: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_HANGAR, 0.5, 10.0, 0.3); + EAX_ENVIRONMENT_CARPETEDHALLWAY: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_CARPETEDHALLWAY, 0.153, 0.259, 2.0); + EAX_ENVIRONMENT_HALLWAY: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_HALLWAY, 0.361, 1.493, 0); + EAX_ENVIRONMENT_STONECORRIDOR: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_STONECORRIDOR, 0.444, 2.697, 0.638); + EAX_ENVIRONMENT_ALLEY: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_ALLEY, 0.25, 1.752, 0.776); + EAX_ENVIRONMENT_FOREST: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_FOREST, 0.111, 3.145, 0.472); + EAX_ENVIRONMENT_CITY: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_CITY, 0.111, 2.767, 0.224); + EAX_ENVIRONMENT_MOUNTAINS: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_MOUNTAINS, 0.194, 7.841, 0.472); + EAX_ENVIRONMENT_QUARRY: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_QUARRY, 1, 1.499, 0.5); + EAX_ENVIRONMENT_PLAIN: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_PLAIN, 0.097, 2.767, 0.224); + EAX_ENVIRONMENT_PARKINGLOT: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_PARKINGLOT, 0.208, 1.652, 1.5); + EAX_ENVIRONMENT_SEWERPIPE: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_SEWERPIPE, 0.652, 2.886, 0.25); + EAX_ENVIRONMENT_UNDERWATER: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_UNDERWATER, 1, 1.499, 0); + EAX_ENVIRONMENT_DRUGGED: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_DRUGGED, 0.875, 8.392, 1.388); + EAX_ENVIRONMENT_DIZZY: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_DIZZY, 0.139, 17.234, 0.666); + EAX_ENVIRONMENT_PSYCHOTIC: + Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_PSYCHOTIC, 0.486, 7.563, 0.806); + else + Result := FALSE; + end; +end; +{$ENDIF} + +end. +// END OF FILE ///////////////////////////////////////////////////////////////// + diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index 578271c0..1e1d4cad 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -1,19 +1,43 @@ -{$DEFINE DEBUG} // to-do : Remove b4 release - -{$IFDEF FPC} - {$UNDEF UseSerialPort} - {$UNDEF UseMIDIPort} -{$ELSE} - {$UNDEF UseSerialPort} - {$DEFINE UseMIDIPort} -{$ENDIF} - -{$IFDEF win32} - {$DEFINE UseBASS} - {$IFDEF DEBUG} - {$APPTYPE CONSOLE} - {$ENDIF} -{$ELSE} - {$UNDEF UseBASS} -{$ENDIF} - +{$DEFINE DEBUG} // to-do : Remove b4 release + +// Comment by eddie: +// The mac port currently also uses the WIN32 define. +// Once I get the beast compiled, linked and running +// I will change this. +// There are some parts where the WIN32 define could not +// be used. I changed the WIN32 to MSWINDOWS. +// So, for Windows-only code use the MSWINDOWS define. + + +{$IFDEF FPC} + {$IFDEF DARWIN} + {$H+} + {$R-} + {$DEFINE WIN32} + {$DEFINE TRANSLATE} + {$ELSE} + {$DEFINE LAZARUS} + {$ENDIF} + + {$MODE DELPHI} + {$DEFINE DLL_CDECL} + {$UNDEF UseSerialPort} + {$UNDEF UseMIDIPort} +{$ELSE} + {$DEFINE DLL_STDCALL} + {$UNDEF UseSerialPort} + {$DEFINE UseMIDIPort} +{$ENDIF} + + +{$IFDEF win32} + {$DEFINE UseBASS} + {$IFDEF DEBUG} + {$IFNDEF DARWIN} + {$APPTYPE CONSOLE} + {$ENDIF} + {$ENDIF} +{$ELSE} + {$UNDEF UseBASS} +{$ENDIF} + -- cgit v1.2.3 From 4df428bedccc51a542f46f3737a5848265d6dc27 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Thu, 1 Nov 2007 19:50:02 +0000 Subject: Windows version now compiles again. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@547 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMain.pas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index bbc64f80..80305b35 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -5,6 +5,9 @@ interface {$I switches.inc} uses + {$IFDEF MSWINDOWS} + Windows, + {$ENDIF} SDL, UGraphic, UMusic, @@ -131,7 +134,7 @@ procedure ClearScores(PlayerNum: integer); implementation -uses USongs, UJoystick, math, UCommandLine, ULanguage, SDL_ttf, +uses USongs, UJoystick, math, UCommandLine, ULanguage, SDL_ttf, USkins, UCovers, UCatCovers, UDataBase, UPlaylist, UDLLManager, UParty, UCore, UGraphicClasses, UPluginDefs; -- 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/Classes/TextGL.pas | 4 + Game/Code/Classes/UAudio_FFMpeg.pas | 77 +- Game/Code/Classes/UAudio_bass.pas | 4 + Game/Code/Classes/UCommon.pas | 4 + Game/Code/Classes/UCore.pas | 21 +- Game/Code/Classes/UCoreModule.pas | 248 +-- Game/Code/Classes/UCovers.pas | 526 +++--- Game/Code/Classes/UDLLManager.pas | 4 + Game/Code/Classes/UDataBase.pas | 4 + Game/Code/Classes/UDraw.pas | 4 + Game/Code/Classes/UFiles.pas | 6 + Game/Code/Classes/UGraphic.pas | 4 + Game/Code/Classes/UGraphicClasses.pas | 4 + Game/Code/Classes/UHooks.pas | 855 ++++----- Game/Code/Classes/UIni.pas | 4 + Game/Code/Classes/ULanguage.pas | 4 + Game/Code/Classes/ULight.pas | 4 + Game/Code/Classes/ULog.pas | 4 + Game/Code/Classes/ULyrics.pas | 4 + Game/Code/Classes/ULyrics_bak.pas | 852 ++++----- Game/Code/Classes/UMain.pas | 8 +- Game/Code/Classes/UMedia_dummy.pas | 4 + Game/Code/Classes/UMusic.pas | 4 + Game/Code/Classes/UParty.pas | 757 ++++---- Game/Code/Classes/UPlaylist.pas | 930 +++++----- Game/Code/Classes/URecord.pas | 4 + Game/Code/Classes/UServices.pas | 647 +++---- Game/Code/Classes/USingScores.pas | 1976 ++++++++++---------- Game/Code/Classes/USkins.pas | 4 + Game/Code/Classes/USongs.pas | 9 +- Game/Code/Classes/UTexture.pas | 4 + Game/Code/Classes/UThemes.pas | 4 + Game/Code/Classes/UTime.pas | 3 + Game/Code/Classes/UVideo.pas | 7 +- Game/Code/Classes/uPluginLoader.pas | 4 + Game/Code/Menu/UDisplay.pas | 4 + Game/Code/Menu/UMenu.pas | 4 + Game/Code/Menu/UMenuSelectSlide.pas | 706 +++---- Game/Code/Menu/UMenuText.pas | 4 + Game/Code/Screens/UScreenCredits.pas | 4 + Game/Code/Screens/UScreenEditConvert.pas | 1158 ++++++------ Game/Code/Screens/UScreenEditSub.pas | 2749 ++++++++++++++-------------- Game/Code/Screens/UScreenLoading.pas | 110 +- Game/Code/Screens/UScreenMain.pas | 572 +++--- Game/Code/Screens/UScreenPartyNewRound.pas | 842 ++++----- Game/Code/Screens/UScreenPartyOptions.pas | 522 +++--- Game/Code/Screens/UScreenScore.pas | 4 + Game/Code/Screens/UScreenSing.pas | 4 + Game/Code/Screens/UScreenSingModi.pas | 4 + Game/Code/Screens/UScreenSong.pas | 7 +- Game/Code/Screens/UScreenSongMenu.pas | 4 + Game/Code/Screens/UScreenStatMain.pas | 4 + Game/Code/Screens/UScreenTop5.pas | 4 + Game/Code/UltraStar.lpr | 296 +-- Game/Code/lib/SQLite/SQLiteTable3.pas | 4 + Game/Code/switches.inc | 3 +- 56 files changed, 6984 insertions(+), 7027 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index af60c4ff..aaee50a0 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -2,6 +2,10 @@ unit TextGL; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} diff --git a/Game/Code/Classes/UAudio_FFMpeg.pas b/Game/Code/Classes/UAudio_FFMpeg.pas index 675dfd3c..afbb23c1 100644 --- a/Game/Code/Classes/UAudio_FFMpeg.pas +++ b/Game/Code/Classes/UAudio_FFMpeg.pas @@ -13,6 +13,10 @@ This unit is primarily based upon - interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} @@ -59,7 +63,7 @@ var // audio_buf : array[ 0 .. AVCODEC_MAX_AUDIO_FRAME_SIZE ] of byte; //pUInt8{$ifndef fpc};{$else} = nil;{$endif} type - Taudiobuff = array[ 0 .. AVCODEC_MAX_AUDIO_FRAME_SIZE ] of byte; + Taudiobuff = array[ 0 .. AVCODEC_MAX_AUDIO_FRAME_SIZE-1 ] of byte; PAudioBuff = ^Taudiobuff; implementation @@ -376,6 +380,9 @@ end; procedure TAudio_ffMpeg.PlayStart; begin + + // LoadSoundFromFile(BassStart, SoundPath + 'foo fighters - best of you.mp3'); + // TODO : jb_linux replace with something other than bass // BASS_ChannelPlay(BassStart, True); end; @@ -458,10 +465,13 @@ var len1 , data_size : integer; begin + result := -1; + +(* {$ifdef win32} - FillChar(pkt, sizeof(pkt), #0); + FillChar(pkt, sizeof(TAVPacket), #0); {$else} - memset(@pkt, 0, sizeof(pkt)); // todo : jb memset + memset(@pkt, 0, sizeof(TAVPacket)); // todo : jb memset {$endif} audio_pkt_data := nil; @@ -469,7 +479,7 @@ begin while true do begin - + while ( audio_pkt_size > 0 ) do begin // writeln( 'got audio packet' ); @@ -479,22 +489,15 @@ begin if aAudio_buf <> nil then begin -// writeln( 'pre avcodec_decode_audio' ); - {$ifdef fpc} - len1 := avcodec_decode_audio(@aCodecCtx, PWord( aAudio_buf ), data_size, audio_pkt_data, audio_pkt_size); // Todo.. should be avcodec_decode_audio2 but this wont link on my ubuntu box. - {$else} - len1 := avcodec_decode_audio(@aCodecCtx, Pointer( aAudio_buf ), data_size, audio_pkt_data, audio_pkt_size); // Todo.. should be avcodec_decode_audio2 but this wont link on my ubuntu box. - {$endif} -// writeln( 'post avcodec_decode_audio' ); - + len1 := avcodec_decode_audio(@aCodecCtx, Pointer( aAudio_buf ), data_size, audio_pkt_data, audio_pkt_size); // Todo.. should be avcodec_decode_audio2 but this wont link on my ubuntu box. end; -// writeln('avcodec_decode_audio'); +// writeln('avcodec_decode_audio : ' + inttostr( len1 )); if(len1 < 0) then begin //* if error, skip frame */ -// writeln( 'Skip audio frame' ); + writeln( 'Skip audio frame' ); audio_pkt_size := 0; break; end; @@ -532,7 +535,7 @@ begin audio_pkt_data := pchar( pkt.data ); audio_pkt_size := pkt.size; // writeln( 'Audio Packet Size - ' + inttostr(audio_pkt_size) ); - end; + end; *) end; procedure audio_callback( userdata: Pointer; stream: PUInt8; len: Integer ); @@ -558,41 +561,45 @@ begin while (len > 0) do begin - if(audio_buf_index >= audio_buf_size) then + + if (audio_buf_index >= audio_buf_size) then begin + // We have already sent all our data; get more */ - audio_size := audio_decode_frame(aCodecCtx, pUInt8( laudio_buf ), sizeof(laudio_buf)); + audio_size := audio_decode_frame(aCodecCtx, pUInt8( laudio_buf ), sizeof(Taudiobuff)); + writeln( 'audio_decode_frame : ' + inttostr( audio_size ) + ' / ' + inttostr( sizeof(Taudiobuff) ) ); - if(audio_size < 0) then + if(audio_size > 0) then begin - // If error, output silence */ - audio_buf_size := 1024; // arbitrary? - - {$ifdef win32} - FillChar(laudio_buf, audio_buf_size, #0); - {$else} - memset(laudio_buf, 0, audio_buf_size); // todo : jb memset - {$endif} + audio_buf_size := audio_size; end else begin - audio_buf_size := audio_size; + // If error, output silence */ + +// audio_buf_size := 1024; // arbitrary? + +// {$ifdef win32} +// FillChar(laudio_buf, audio_buf_size, #0); +// {$else} +// memset(laudio_buf, 0, audio_buf_size); // todo : jb memset +// {$endif} + + writeln( 'Silence' ); end; audio_buf_index := 0; // Todo : jb - SegFault ? end; - - len1 := audio_buf_size - audio_buf_index; + len1 := audio_buf_size - audio_buf_index; if (len1 > len) then len1 := len; - + lSrc := PUInt8( integer( laudio_buf ) + audio_buf_index ); {$ifdef WIN32} - lSrc := PUInt8( integer( laudio_buf ) + audio_buf_index ); CopyMemory(stream, lSrc , len1); {$else} - memcpy(stream, PUInt8( laudio_buf ) + audio_buf_index , len1); + memcpy(stream, lSrc , len1); {$endif} len := len - len1; @@ -620,7 +627,7 @@ begin if FileExists(Name) then begin -// writeln('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); + writeln('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); // Open video file if (av_open_input_file(pFormatCtx, pchar(Name), nil, 0, nil) > 0) then @@ -697,6 +704,7 @@ begin // Free the packet that was allocated by av_read_frame SDL_PollEvent(@event); + (* if event.type_ = SDL_QUIT the begin @@ -706,8 +714,9 @@ begin else break; *) - end; + + writeln( 'Done filling buffer' ); // halt(0); diff --git a/Game/Code/Classes/UAudio_bass.pas b/Game/Code/Classes/UAudio_bass.pas index 463a6c7f..9ef3b789 100644 --- a/Game/Code/Classes/UAudio_bass.pas +++ b/Game/Code/Classes/UAudio_bass.pas @@ -2,6 +2,10 @@ unit UAudio_bass; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} diff --git a/Game/Code/Classes/UCommon.pas b/Game/Code/Classes/UCommon.pas index b532f775..43017aff 100644 --- a/Game/Code/Classes/UCommon.pas +++ b/Game/Code/Classes/UCommon.pas @@ -2,6 +2,10 @@ unit UCommon; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses diff --git a/Game/Code/Classes/UCore.pas b/Game/Code/Classes/UCore.pas index 091868f2..acd9ead7 100644 --- a/Game/Code/Classes/UCore.pas +++ b/Game/Code/Classes/UCore.pas @@ -2,9 +2,17 @@ unit UCore; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} -uses uPluginDefs, uCoreModule, UHooks, UServices, UModules; +uses uPluginDefs, + uCoreModule, + UHooks, + UServices, + UModules; {********************* TCore Class manages all CoreModules, teh StartUp, teh MainLoop and the shutdown process @@ -103,10 +111,11 @@ var Core: TCore; implementation -uses SysUtils, -{$IFDEF win32} -Windows -{$ENDIF}; + +uses {$IFDEF win32} + Windows, + {$ENDIF} + SysUtils; //------------- // Create - Creates Class + Hook and Service Manager @@ -489,4 +498,4 @@ begin Result := hInstance; end; -end. \ No newline at end of file +end. diff --git a/Game/Code/Classes/UCoreModule.pas b/Game/Code/Classes/UCoreModule.pas index b135089c..c8c54161 100644 --- a/Game/Code/Classes/UCoreModule.pas +++ b/Game/Code/Classes/UCoreModule.pas @@ -1,122 +1,126 @@ -unit UCoreModule; - -interface - -{$I switches.inc} - -{********************* - TCoreModule - Dummy Class that has Methods that will be called from Core - In the Best case every Piece of this Software is a Module -*********************} -uses UPluginDefs; - -type - PCoreModule = ^TCoreModule; - TCoreModule = class - public - Constructor Create; virtual; - - //Function that gives some Infos about the Module to the Core - Procedure Info(const pInfo: PModuleInfo); virtual; - - //Is Called on Loading. - //In this Method only Events and Services should be created - //to offer them to other Modules or Plugins during the Init process - //If False is Returned this will cause a Forced Exit - Function Load: Boolean; virtual; - - //Is Called on Init Process - //In this Method you can Hook some Events and Create + Init - //your Classes, Variables etc. - //If False is Returned this will cause a Forced Exit - Function Init: Boolean; virtual; - - //Is Called during Mainloop before 'Core/MainLoop' Hook and Drawing - //If False is Returned this will cause a Forced Exit - Function MainLoop: Boolean; virtual; - - //Is Called if this Module has been Inited and there is a Exit. - //Deinit is in backwards Initing Order - //If False is Returned this will cause a Forced Exit - Procedure DeInit; virtual; - - //Is Called if this Module will be unloaded and has been created - //Should be used to Free Memory - Procedure Free; virtual; - end; - cCoreModule = class of TCoreModule; - -implementation - -//------------- -// Just the Constructor -//------------- -Constructor TCoreModule.Create; -begin - //Dummy maaaan ;) -end; - -//------------- -// Function that gives some Infos about the Module to the Core -//------------- -Procedure TCoreModule.Info(const pInfo: PModuleInfo); -begin - pInfo^.Name := 'Not Set'; - pInfo^.Version := 0; - pInfo^.Description := 'Not Set'; -end; - -//------------- -//Is Called on Loading. -//In this Method only Events and Services should be created -//to offer them to other Modules or Plugins during the Init process -//If False is Returned this will cause a Forced Exit -//------------- -Function TCoreModule.Load: Boolean; -begin - //Dummy ftw!! - Result := True; -end; - -//------------- -//Is Called on Init Process -//In this Method you can Hook some Events and Create + Init -//your Classes, Variables etc. -//If False is Returned this will cause a Forced Exit -//------------- -Function TCoreModule.Init: Boolean; -begin - //Dummy ftw!! - Result := True; -end; - -//------------- -//Is Called during Mainloop before 'Core/MainLoop' Hook and Drawing -//If False is Returned this will cause a Forced Exit -//------------- -Function TCoreModule.MainLoop: Boolean; -begin - //Dummy ftw!! - Result := True; -end; - -//------------- -//Is Called if this Module has been Inited and there is a Exit. -//Deinit is in backwards Initing Order -//------------- -Procedure TCoreModule.DeInit; -begin - //Dummy ftw!! -end; - -//------------- -//Is Called if this Module will be unloaded and has been created -//Should be used to Free Memory -//------------- -Procedure TCoreModule.Free; -begin - //Dummy ftw!! -end; - -end. \ No newline at end of file +unit UCoreModule; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +{********************* + TCoreModule + Dummy Class that has Methods that will be called from Core + In the Best case every Piece of this Software is a Module +*********************} +uses UPluginDefs; + +type + PCoreModule = ^TCoreModule; + TCoreModule = class + public + Constructor Create; virtual; + + //Function that gives some Infos about the Module to the Core + Procedure Info(const pInfo: PModuleInfo); virtual; + + //Is Called on Loading. + //In this Method only Events and Services should be created + //to offer them to other Modules or Plugins during the Init process + //If False is Returned this will cause a Forced Exit + Function Load: Boolean; virtual; + + //Is Called on Init Process + //In this Method you can Hook some Events and Create + Init + //your Classes, Variables etc. + //If False is Returned this will cause a Forced Exit + Function Init: Boolean; virtual; + + //Is Called during Mainloop before 'Core/MainLoop' Hook and Drawing + //If False is Returned this will cause a Forced Exit + Function MainLoop: Boolean; virtual; + + //Is Called if this Module has been Inited and there is a Exit. + //Deinit is in backwards Initing Order + //If False is Returned this will cause a Forced Exit + Procedure DeInit; virtual; + + //Is Called if this Module will be unloaded and has been created + //Should be used to Free Memory + Procedure Free; virtual; + end; + cCoreModule = class of TCoreModule; + +implementation + +//------------- +// Just the Constructor +//------------- +Constructor TCoreModule.Create; +begin + //Dummy maaaan ;) +end; + +//------------- +// Function that gives some Infos about the Module to the Core +//------------- +Procedure TCoreModule.Info(const pInfo: PModuleInfo); +begin + pInfo^.Name := 'Not Set'; + pInfo^.Version := 0; + pInfo^.Description := 'Not Set'; +end; + +//------------- +//Is Called on Loading. +//In this Method only Events and Services should be created +//to offer them to other Modules or Plugins during the Init process +//If False is Returned this will cause a Forced Exit +//------------- +Function TCoreModule.Load: Boolean; +begin + //Dummy ftw!! + Result := True; +end; + +//------------- +//Is Called on Init Process +//In this Method you can Hook some Events and Create + Init +//your Classes, Variables etc. +//If False is Returned this will cause a Forced Exit +//------------- +Function TCoreModule.Init: Boolean; +begin + //Dummy ftw!! + Result := True; +end; + +//------------- +//Is Called during Mainloop before 'Core/MainLoop' Hook and Drawing +//If False is Returned this will cause a Forced Exit +//------------- +Function TCoreModule.MainLoop: Boolean; +begin + //Dummy ftw!! + Result := True; +end; + +//------------- +//Is Called if this Module has been Inited and there is a Exit. +//Deinit is in backwards Initing Order +//------------- +Procedure TCoreModule.DeInit; +begin + //Dummy ftw!! +end; + +//------------- +//Is Called if this Module will be unloaded and has been created +//Should be used to Free Memory +//------------- +Procedure TCoreModule.Free; +begin + //Dummy ftw!! +end; + +end. diff --git a/Game/Code/Classes/UCovers.pas b/Game/Code/Classes/UCovers.pas index f4ede329..9cc2a5e9 100644 --- a/Game/Code/Classes/UCovers.pas +++ b/Game/Code/Classes/UCovers.pas @@ -1,261 +1,265 @@ -unit UCovers; - -interface - -{$I switches.inc} - -uses OpenGL12, - {$IFDEF win32} - windows, - {$ENDIF} - Math, - Classes, - SysUtils, - {$IFNDEF FPC} - Graphics, - {$ENDIF} - UThemes, - UTexture; - -type - TCover = record - Name: string; - W: word; - H: word; - Size: integer; - Position: integer; // position of picture in the cache file -// Data: array of byte; - end; - - TCovers = class - Cover: array of TCover; - W: word; - H: word; - Size: integer; - Data: array of byte; - WritetoFile: Boolean; - - constructor Create; - procedure Load; - procedure Save; - procedure AddCover(Name: string); - function CoverExists(Name: string): boolean; - function CoverNumber(Name: string): integer; - procedure PrepareData(Name: string); - end; - -var - Covers: TCovers; - -implementation - -uses UMain, - // UFiles, - ULog, - DateUtils; - -constructor TCovers.Create; -begin - W := 128; - H := 128; - Size := W*H*3; - Load; - WritetoFile := True; -end; - -procedure TCovers.Load; -var - F: File; - C: integer; // cover number - W: word; - H: word; - Bits: byte; - NLen: word; - Name: string; -// Data: array of byte; -begin - if FileExists(GamePath + 'covers.cache') then - begin - AssignFile(F, GamePath + 'covers.cache'); - Reset(F, 1); - - WritetoFile := not FileIsReadOnly(GamePath + 'covers.cache'); - - SetLength(Cover, 0); - - while not EOF(F) do - begin - SetLength(Cover, Length(Cover)+1); - - BlockRead(F, W, 2); - Cover[High(Cover)].W := W; - - BlockRead(F, H, 2); - Cover[High(Cover)].H := H; - - BlockRead(F, Bits, 1); - - Cover[High(Cover)].Size := W * H * (Bits div 8); - - // test - // W := 128; - // H := 128; - // Bits := 24; - // Seek(F, FilePos(F) + 3); - - BlockRead(F, NLen, 2); - SetLength(Name, NLen); - - BlockRead(F, Name[1], NLen); - Cover[High(Cover)].Name := Name; - - Cover[High(Cover)].Position := FilePos(F); - Seek(F, FilePos(F) + W*H*(Bits div 8)); - - // SetLength(Cover[High(Cover)].Data, W*H*(Bits div 8)); - // BlockRead(F, Cover[High(Cover)].Data[0], W*H*(Bits div 8)); - - end; // While - - CloseFile(F); - end; // fileexists -end; - -procedure TCovers.Save; -var - F: File; - C: integer; // cover number - W: word; - H: word; - NLen: word; - Bits: byte; -begin -{ AssignFile(F, GamePath + 'covers.cache'); - Rewrite(F, 1); - - Bits := 24; - for C := 0 to High(Cover) do begin - W := Cover[C].W; - H := Cover[C].H; - - BlockWrite(F, W, 2); - BlockWrite(F, H, 2); - BlockWrite(F, Bits, 1); - - NLen := Length(Cover[C].Name); - BlockWrite(F, NLen, 2); - BlockWrite(F, Cover[C].Name[1], NLen); - BlockWrite(F, Cover[C].Data[0], W*H*(Bits div 8)); - end; - - CloseFile(F);} -end; - -procedure TCovers.AddCover(Name: string); -var - B: integer; - F: File; - C: integer; // cover number - NLen: word; - Bits: byte; -begin - if not CoverExists(Name) then - begin - SetLength(Cover, Length(Cover)+1); - Cover[High(Cover)].Name := Name; - - Cover[High(Cover)].W := W; - Cover[High(Cover)].H := H; - Cover[High(Cover)].Size := Size; - - // do not copy data. write them directly to file -// SetLength(Cover[High(Cover)].Data, Size); -// for B := 0 to Size-1 do -// Cover[High(Cover)].Data[B] := CacheMipmap[B]; - - if WritetoFile then - begin - AssignFile(F, GamePath + 'covers.cache'); - - if FileExists(GamePath + 'covers.cache') then - begin - Reset(F, 1); - Seek(F, FileSize(F)); - end - else - begin - Rewrite(F, 1); - end; - - Bits := 24; - - BlockWrite(F, W, 2); - BlockWrite(F, H, 2); - BlockWrite(F, Bits, 1); - - NLen := Length(Name); - BlockWrite(F, NLen, 2); - BlockWrite(F, Name[1], NLen); - - Cover[High(Cover)].Position := FilePos(F); - BlockWrite(F, CacheMipmap[0], W*H*(Bits div 8)); - - CloseFile(F); - end; - end - else - Cover[High(Cover)].Position := 0; -end; - -function TCovers.CoverExists(Name: string): boolean; -var - C: integer; // cover -begin - Result := false; - C := 0; - - while (C <= High(Cover)) and (Result = false) do - begin - if Cover[C].Name = Name then - Result := true; - - Inc(C); - end; -end; - -function TCovers.CoverNumber(Name: string): integer; -var - C: integer; -begin - Result := -1; - C := 0; - - while (C <= High(Cover)) and (Result = -1) do - begin - if Cover[C].Name = Name then - Result := C; - - Inc(C); - end; -end; - -procedure TCovers.PrepareData(Name: string); -var - F: File; - C: integer; -begin - if FileExists(GamePath + 'covers.cache') then - begin - AssignFile(F, GamePath + 'covers.cache'); - Reset(F, 1); - - C := CoverNumber(Name); - SetLength(Data, Cover[C].Size); - if Length(Data) < 6 then beep; - Seek(F, Cover[C].Position); - BlockRead(F, Data[0], Cover[C].Size); - CloseFile(F); - end; -end; - -end. +unit UCovers; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses OpenGL12, + {$IFDEF win32} + windows, + {$ENDIF} + Math, + Classes, + SysUtils, + {$IFNDEF FPC} + Graphics, + {$ENDIF} + UThemes, + UTexture; + +type + TCover = record + Name: string; + W: word; + H: word; + Size: integer; + Position: integer; // position of picture in the cache file +// Data: array of byte; + end; + + TCovers = class + Cover: array of TCover; + W: word; + H: word; + Size: integer; + Data: array of byte; + WritetoFile: Boolean; + + constructor Create; + procedure Load; + procedure Save; + procedure AddCover(Name: string); + function CoverExists(Name: string): boolean; + function CoverNumber(Name: string): integer; + procedure PrepareData(Name: string); + end; + +var + Covers: TCovers; + +implementation + +uses UMain, + // UFiles, + ULog, + DateUtils; + +constructor TCovers.Create; +begin + W := 128; + H := 128; + Size := W*H*3; + Load; + WritetoFile := True; +end; + +procedure TCovers.Load; +var + F: File; + C: integer; // cover number + W: word; + H: word; + Bits: byte; + NLen: word; + Name: string; +// Data: array of byte; +begin + if FileExists(GamePath + 'covers.cache') then + begin + AssignFile(F, GamePath + 'covers.cache'); + Reset(F, 1); + + WritetoFile := not FileIsReadOnly(GamePath + 'covers.cache'); + + SetLength(Cover, 0); + + while not EOF(F) do + begin + SetLength(Cover, Length(Cover)+1); + + BlockRead(F, W, 2); + Cover[High(Cover)].W := W; + + BlockRead(F, H, 2); + Cover[High(Cover)].H := H; + + BlockRead(F, Bits, 1); + + Cover[High(Cover)].Size := W * H * (Bits div 8); + + // test + // W := 128; + // H := 128; + // Bits := 24; + // Seek(F, FilePos(F) + 3); + + BlockRead(F, NLen, 2); + SetLength(Name, NLen); + + BlockRead(F, Name[1], NLen); + Cover[High(Cover)].Name := Name; + + Cover[High(Cover)].Position := FilePos(F); + Seek(F, FilePos(F) + W*H*(Bits div 8)); + + // SetLength(Cover[High(Cover)].Data, W*H*(Bits div 8)); + // BlockRead(F, Cover[High(Cover)].Data[0], W*H*(Bits div 8)); + + end; // While + + CloseFile(F); + end; // fileexists +end; + +procedure TCovers.Save; +var + F: File; + C: integer; // cover number + W: word; + H: word; + NLen: word; + Bits: byte; +begin +{ AssignFile(F, GamePath + 'covers.cache'); + Rewrite(F, 1); + + Bits := 24; + for C := 0 to High(Cover) do begin + W := Cover[C].W; + H := Cover[C].H; + + BlockWrite(F, W, 2); + BlockWrite(F, H, 2); + BlockWrite(F, Bits, 1); + + NLen := Length(Cover[C].Name); + BlockWrite(F, NLen, 2); + BlockWrite(F, Cover[C].Name[1], NLen); + BlockWrite(F, Cover[C].Data[0], W*H*(Bits div 8)); + end; + + CloseFile(F);} +end; + +procedure TCovers.AddCover(Name: string); +var + B: integer; + F: File; + C: integer; // cover number + NLen: word; + Bits: byte; +begin + if not CoverExists(Name) then + begin + SetLength(Cover, Length(Cover)+1); + Cover[High(Cover)].Name := Name; + + Cover[High(Cover)].W := W; + Cover[High(Cover)].H := H; + Cover[High(Cover)].Size := Size; + + // do not copy data. write them directly to file +// SetLength(Cover[High(Cover)].Data, Size); +// for B := 0 to Size-1 do +// Cover[High(Cover)].Data[B] := CacheMipmap[B]; + + if WritetoFile then + begin + AssignFile(F, GamePath + 'covers.cache'); + + if FileExists(GamePath + 'covers.cache') then + begin + Reset(F, 1); + Seek(F, FileSize(F)); + end + else + begin + Rewrite(F, 1); + end; + + Bits := 24; + + BlockWrite(F, W, 2); + BlockWrite(F, H, 2); + BlockWrite(F, Bits, 1); + + NLen := Length(Name); + BlockWrite(F, NLen, 2); + BlockWrite(F, Name[1], NLen); + + Cover[High(Cover)].Position := FilePos(F); + BlockWrite(F, CacheMipmap[0], W*H*(Bits div 8)); + + CloseFile(F); + end; + end + else + Cover[High(Cover)].Position := 0; +end; + +function TCovers.CoverExists(Name: string): boolean; +var + C: integer; // cover +begin + Result := false; + C := 0; + + while (C <= High(Cover)) and (Result = false) do + begin + if Cover[C].Name = Name then + Result := true; + + Inc(C); + end; +end; + +function TCovers.CoverNumber(Name: string): integer; +var + C: integer; +begin + Result := -1; + C := 0; + + while (C <= High(Cover)) and (Result = -1) do + begin + if Cover[C].Name = Name then + Result := C; + + Inc(C); + end; +end; + +procedure TCovers.PrepareData(Name: string); +var + F: File; + C: integer; +begin + if FileExists(GamePath + 'covers.cache') then + begin + AssignFile(F, GamePath + 'covers.cache'); + Reset(F, 1); + + C := CoverNumber(Name); + SetLength(Data, Cover[C].Size); + if Length(Data) < 6 then beep; + Seek(F, Cover[C].Position); + BlockRead(F, Data[0], Cover[C].Size); + CloseFile(F); + end; +end; + +end. diff --git a/Game/Code/Classes/UDLLManager.pas b/Game/Code/Classes/UDLLManager.pas index 358be9af..cbe79c3c 100644 --- a/Game/Code/Classes/UDLLManager.pas +++ b/Game/Code/Classes/UDLLManager.pas @@ -2,6 +2,10 @@ unit UDLLManager; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses ModiSDK, diff --git a/Game/Code/Classes/UDataBase.pas b/Game/Code/Classes/UDataBase.pas index 0cafc9fd..e99cb891 100644 --- a/Game/Code/Classes/UDataBase.pas +++ b/Game/Code/Classes/UDataBase.pas @@ -2,6 +2,10 @@ unit UDataBase; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses USongs, diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 350926d8..efc3494b 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -2,6 +2,10 @@ unit UDraw; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses UThemes, diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index 5f168ead..e4f83b7a 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -2,6 +2,9 @@ unit UFiles; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} {$I switches.inc} uses SysUtils, @@ -329,8 +332,11 @@ Result := False; //Reset LineNo FileLineNo := 0; + writeln( 'Assign File : ' + Song.Path + Song.FileName ); + //Open File and set File Pointer to the beginning AssignFile(SongFile, Song.Path + Song.FileName); + // if assinged( SongFile ) then begin try diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 26601f2d..bfad2d73 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -2,6 +2,10 @@ unit UGraphic; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses diff --git a/Game/Code/Classes/UGraphicClasses.pas b/Game/Code/Classes/UGraphicClasses.pas index 2acd5530..4dfc66ce 100644 --- a/Game/Code/Classes/UGraphicClasses.pas +++ b/Game/Code/Classes/UGraphicClasses.pas @@ -3,6 +3,10 @@ unit UGraphicClasses; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses UTexture; diff --git a/Game/Code/Classes/UHooks.pas b/Game/Code/Classes/UHooks.pas index ea31ec50..c30803f7 100644 --- a/Game/Code/Classes/UHooks.pas +++ b/Game/Code/Classes/UHooks.pas @@ -1,425 +1,430 @@ -unit UHooks; - -{********************* - THookManager - Class for saving, managing and calling of Hooks. - Saves all hookable events and their subscribers -*********************} -interface - -{$I switches.inc} - -uses uPluginDefs, SysUtils; - -type - //Record that saves info from Subscriber - PSubscriberInfo = ^TSubscriberInfo; - TSubscriberInfo = record - Self: THandle; //ID of this Subscription (First Word: ID of Subscription; 2nd Word: ID of Hook) - Next: PSubscriberInfo; //Pointer to next Item in HookChain - - Owner: Integer; //For Error Handling and Plugin Unloading. - - //Here is s/t tricky - //To avoid writing of Wrapping Functions to Hook an Event with a Class - //We save a Normal Proc or a Method of a Class - Case isClass: boolean of - False: (Proc: TUS_Hook); //Proc that will be called on Event - True: (ProcOfClass: TUS_Hook_of_Object); - end; - - TEventInfo = record - Name: String[60]; //Name of Event - FirstSubscriber: PSubscriberInfo; //First subscriber in chain - LastSubscriber: PSubscriberInfo; //Last " (for easier subscriber adding - end; - - THookManager = class - private - Events: array of TEventInfo; - SpaceinEvents: Word; //Number of empty Items in Events Array. (e.g. Deleted Items) - - Procedure FreeSubscriber(const EventIndex: Word; const Last, Cur: PSubscriberInfo); - public - constructor Create(const SpacetoAllocate: Word); - - Function AddEvent (const EventName: PChar): THandle; - Function DelEvent (hEvent: THandle): Integer; - - Function AddSubscriber (const EventName: PChar; const Proc: TUS_Hook = nil; const ProcOfClass: TUS_Hook_of_Object = nil): THandle; - Function DelSubscriber (const hSubscriber: THandle): Integer; - - Function CallEventChain (const hEvent: THandle; const wParam, lParam: LongWord): Integer; - Function EventExists (const EventName: PChar): Integer; - - Procedure DelbyOwner(const Owner: Integer); - end; - -function HookTest(wParam, lParam: DWord): integer; stdcall; - -var - HookManager: THookManager; - -implementation -uses UCore; - -//------------ -// Create - Creates Class and Set Standard Values -//------------ -constructor THookManager.Create(const SpacetoAllocate: Word); -var I: Integer; -begin - //Get the Space and "Zero" it - SetLength (Events, SpacetoAllocate); - For I := 0 to SpacetoAllocate do - Events[I].Name[1] := chr(0); - - SpaceinEvents := SpacetoAllocate; - - {$IFDEF DEBUG} - WriteLn('HookManager: Succesful Created.'); - {$ENDIF} -end; - -//------------ -// AddEvent - Adds an Event and return the Events Handle or 0 on Failure -//------------ -Function THookManager.AddEvent (const EventName: PChar): THandle; -var I: Integer; -begin - Result := 0; - - if (EventExists(EventName) = 0) then - begin - If (SpaceinEvents > 0) then - begin - //There is already Space available - //Go Search it! - For I := 0 to High(Events) do - If (Events[I].Name[1] = chr(0)) then - begin //Found Space - Result := I; - Dec(SpaceinEvents); - Break; - end; - - {$IFDEF DEBUG} - WriteLn('HookManager: Found Space for Event at Handle: ''' + InttoStr(Result+1) + ''); - {$ENDIF} - end - else - begin //There is no Space => Go make some! - Result := Length(Events); - SetLength(Events, Result + 1); - end; - - //Set Events Data - Events[Result].Name := EventName; - Events[Result].FirstSubscriber := nil; - Events[Result].LastSubscriber := nil; - - //Handle is Index + 1 - Inc(Result); - - {$IFDEF DEBUG} - WriteLn('HookManager: Add Event succesful: ''' + EventName + ''); - {$ENDIF} - end - {$IFDEF DEBUG} - else - WriteLn('HookManager: Trying to ReAdd Event: ''' + EventName + ''); - {$ENDIF} -end; - -//------------ -// DelEvent - Deletes an Event by Handle Returns False on Failure -//------------ -Function THookManager.DelEvent (hEvent: THandle): Integer; -var - Cur, Last: PSubscriberInfo; -begin - hEvent := hEvent - 1; //Arrayindex is Handle - 1 - Result := -1; - - - If (Length(Events) > hEvent) AND (Events[hEvent].Name[1] <> chr(0)) then - begin //Event exists - //Free the Space for all Subscribers - Cur := Events[hEvent].FirstSubscriber; - - While (Cur <> nil) do - begin - Last := Cur; - Cur := Cur.Next; - FreeMem(Last, SizeOf(TSubscriberInfo)); - end; - - {$IFDEF DEBUG} - WriteLn('HookManager: Removed Event succesful: ''' + Events[hEvent].Name + ''); - {$ENDIF} - - //Free the Event - Events[hEvent].Name[1] := chr(0); - Inc(SpaceinEvents); //There is one more space for new events - end - - {$IFDEF DEBUG} - else - WriteLn('HookManager: Try to Remove not Existing Event. Handle: ''' + InttoStr(hEvent) + ''); - {$ENDIF} -end; - -//------------ -// AddSubscriber - Adds an Subscriber to the Event by Name -// Returns Handle of the Subscribtion or 0 on Failure -//------------ -Function THookManager.AddSubscriber (const EventName: PChar; const Proc: TUS_Hook; const ProcOfClass: TUS_Hook_of_Object): THandle; -var - EventHandle: THandle; - EventIndex: Cardinal; - Cur: PSubscriberInfo; -begin - Result := 0; - - If (@Proc <> nil) or (@ProcOfClass <> nil) then - begin - EventHandle := EventExists(EventName); - - If (EventHandle <> 0) then - begin - EventIndex := EventHandle - 1; - - //Get Memory - GetMem(Cur, SizeOf(TSubscriberInfo)); - - //Fill it with Data - Cur.Next := nil; - - //Add Owner - Cur.Owner := Core.CurExecuted; - - If (@Proc = nil) then - begin //Use the ProcofClass Method - Cur.isClass := True; - Cur.ProcOfClass := ProcofClass; - end - else //Use the normal Proc - begin - Cur.isClass := False; - Cur.Proc := Proc; - end; - - //Create Handle (1st Word: Handle of Event; 2nd Word: unique ID - If (Events[EventIndex].LastSubscriber = nil) then - begin - If (Events[EventIndex].FirstSubscriber = nil) then - begin - Result := (EventHandle SHL 16); - Events[EventIndex].FirstSubscriber := Cur; - end - Else - begin - Result := Events[EventIndex].FirstSubscriber.Self + 1; - end; - end - Else - begin - Result := Events[EventIndex].LastSubscriber.Self + 1; - Events[EventIndex].LastSubscriber.Next := Cur; - end; - - Cur.Self := Result; - - //Add to Chain - Events[EventIndex].LastSubscriber := Cur; - - {$IFDEF DEBUG} - WriteLn('HookManager: Add Subscriber to Event ''' + Events[EventIndex].Name + ''' succesful. Handle: ''' + InttoStr(Result) + ''' Owner: ' + InttoStr(Cur.Owner)); - {$ENDIF} - end; - end; -end; - -//------------ -// FreeSubscriber - Helper for DelSubscriber. Prevents Loss of Chain Items. Frees Memory. -//------------ -Procedure THookManager.FreeSubscriber(const EventIndex: Word; const Last, Cur: PSubscriberInfo); -begin - //Delete from Chain - If (Last <> nil) then - begin - Last.Next := Cur.Next; - end - else //Was first Popup - begin - Events[EventIndex].FirstSubscriber := Cur.Next; - end; - - //Was this Last subscription ? - If (Cur = Events[EventIndex].LastSubscriber) then - begin //Change Last Subscriber - Events[EventIndex].LastSubscriber := Last; - end; - - //Free Space: - FreeMem(Cur, SizeOf(TSubscriberInfo)); -end; - -//------------ -// DelSubscriber - Deletes a Subscribtion by Handle, return non Zero on Failure -//------------ -Function THookManager.DelSubscriber (const hSubscriber: THandle): Integer; -var - EventIndex: Cardinal; - Cur, Last: PSubscriberInfo; -begin - Result := -1; - EventIndex := ((hSubscriber AND (High(THandle) xor High(Word))) SHR 16) - 1; - - //Existing Event ? - If (EventIndex < Length(Events)) AND (Events[EventIndex].Name[1] <> chr(0)) then - begin - Result := -2; //Return -1 on not existing Event, -2 on not existing Subscription - - //Search for Subscription - Cur := Events[EventIndex].FirstSubscriber; - Last := nil; - - //go through the chain ... - While (Cur <> nil) do - begin - If (Cur.Self = hSubscriber) then - begin //Found Subscription we searched for - FreeSubscriber(EventIndex, Last, Cur); - - {$IFDEF DEBUG} - WriteLn('HookManager: Del Subscriber from Event ''' + Events[EventIndex].Name + ''' succesful. Handle: ''' + InttoStr(hSubscriber) + ''); - {$ENDIF} - - //Set Result and Break the Loop - Result := 0; - Break; - end; - - Last := Cur; - Cur := Cur.Next; - end; - - end; -end; - - -//------------ -// CallEventChain - Calls the Chain of a specified EventHandle -// Returns: -1: Handle doesn't Exist, 0 Chain is called until the End -//------------ -Function THookManager.CallEventChain (const hEvent: THandle; const wParam, lParam: LongWord): Integer; -var - EventIndex: Cardinal; - Cur: PSubscriberInfo; - CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute -begin - Result := -1; - EventIndex := hEvent - 1; - - If ((EventIndex <= High(Events)) AND (Events[EventIndex].Name[1] <> chr(0))) then - begin //Existing Event - //Backup CurExecuted - CurExecutedBackup := Core.CurExecuted; - - //Start calling the Chain !!!11 - Cur := Events[EventIndex].FirstSubscriber; - Result := 0; - //Call Hooks until the Chain is at the End or breaked - While ((Cur <> nil) AND (Result = 0)) do - begin - //Set CurExecuted - Core.CurExecuted := Cur.Owner; - if (Cur.isClass) then - Result := Cur.ProcOfClass(wParam, lParam) - else - Result := Cur.Proc(wParam, lParam); - - Cur := Cur.Next; - end; - - //Restore CurExecuted - Core.CurExecuted := CurExecutedBackup; - end; - - {$IFDEF DEBUG} - WriteLn('HookManager: Called Chain from Event ''' + Events[EventIndex].Name + ''' succesful. Result: ''' + InttoStr(Result) + ''); - {$ENDIF} -end; - -//------------ -// EventExists - Returns non Zero if an Event with the given Name exists -//------------ -Function THookManager.EventExists (const EventName: PChar): Integer; -var - I: Integer; - Name: String[60]; -begin - Result := 0; - //If (Length(EventName) < - Name := String(EventName); - - //Sure not to search for empty space - If (Name[1] <> chr(0)) then - begin - //Search for Event - For I := 0 to High(Events) do - If (Events[I].Name = Name) then - begin //Event found - Result := I + 1; - Break; - end; - end; -end; - -//------------ -// DelbyOwner - Dels all Subscriptions by a specific Owner. (For Clean Plugin/Module unloading) -//------------ -Procedure THookManager.DelbyOwner(const Owner: Integer); -var - I: Integer; - Cur, Last: PSubscriberInfo; -begin - //Search for Owner in all Hooks Chains - For I := 0 to High(Events) do - begin - If (Events[I].Name[1] <> chr(0)) then - begin - - Last := nil; - Cur := Events[I].FirstSubscriber; - //Went Through Chain - While (Cur <> nil) do - begin - If (Cur.Owner = Owner) then - begin //Found Subscription by Owner -> Delete - FreeSubscriber(I, Last, Cur); - If (Last <> nil) then - Cur := Last.Next - else - Cur := Events[I].FirstSubscriber; - end - Else - begin - //Next Item: - Last := Cur; - Cur := Cur.Next; - end; - end; - end; - end; -end; - - -function HookTest(wParam, lParam: DWord): integer; stdcall; -begin - Result := 0; //Don't break the chain - Core.ShowMessage(CORE_SM_INFO, Integer(PChar(String(PChar(Pointer(lParam))) + ': ' + String(PChar(Pointer(wParam)))))); -end; - -end. +unit UHooks; + +{********************* + THookManager + Class for saving, managing and calling of Hooks. + Saves all hookable events and their subscribers +*********************} +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses uPluginDefs, + SysUtils; + +type + //Record that saves info from Subscriber + PSubscriberInfo = ^TSubscriberInfo; + TSubscriberInfo = record + Self: THandle; //ID of this Subscription (First Word: ID of Subscription; 2nd Word: ID of Hook) + Next: PSubscriberInfo; //Pointer to next Item in HookChain + + Owner: Integer; //For Error Handling and Plugin Unloading. + + //Here is s/t tricky + //To avoid writing of Wrapping Functions to Hook an Event with a Class + //We save a Normal Proc or a Method of a Class + Case isClass: boolean of + False: (Proc: TUS_Hook); //Proc that will be called on Event + True: (ProcOfClass: TUS_Hook_of_Object); + end; + + TEventInfo = record + Name: String[60]; //Name of Event + FirstSubscriber: PSubscriberInfo; //First subscriber in chain + LastSubscriber: PSubscriberInfo; //Last " (for easier subscriber adding + end; + + THookManager = class + private + Events: array of TEventInfo; + SpaceinEvents: Word; //Number of empty Items in Events Array. (e.g. Deleted Items) + + Procedure FreeSubscriber(const EventIndex: Word; const Last, Cur: PSubscriberInfo); + public + constructor Create(const SpacetoAllocate: Word); + + Function AddEvent (const EventName: PChar): THandle; + Function DelEvent (hEvent: THandle): Integer; + + Function AddSubscriber (const EventName: PChar; const Proc: TUS_Hook = nil; const ProcOfClass: TUS_Hook_of_Object = nil): THandle; + Function DelSubscriber (const hSubscriber: THandle): Integer; + + Function CallEventChain (const hEvent: THandle; const wParam, lParam: LongWord): Integer; + Function EventExists (const EventName: PChar): Integer; + + Procedure DelbyOwner(const Owner: Integer); + end; + +function HookTest(wParam, lParam: DWord): integer; stdcall; + +var + HookManager: THookManager; + +implementation +uses UCore; + +//------------ +// Create - Creates Class and Set Standard Values +//------------ +constructor THookManager.Create(const SpacetoAllocate: Word); +var I: Integer; +begin + //Get the Space and "Zero" it + SetLength (Events, SpacetoAllocate); + For I := 0 to SpacetoAllocate do + Events[I].Name[1] := chr(0); + + SpaceinEvents := SpacetoAllocate; + + {$IFDEF DEBUG} + WriteLn('HookManager: Succesful Created.'); + {$ENDIF} +end; + +//------------ +// AddEvent - Adds an Event and return the Events Handle or 0 on Failure +//------------ +Function THookManager.AddEvent (const EventName: PChar): THandle; +var I: Integer; +begin + Result := 0; + + if (EventExists(EventName) = 0) then + begin + If (SpaceinEvents > 0) then + begin + //There is already Space available + //Go Search it! + For I := 0 to High(Events) do + If (Events[I].Name[1] = chr(0)) then + begin //Found Space + Result := I; + Dec(SpaceinEvents); + Break; + end; + + {$IFDEF DEBUG} + WriteLn('HookManager: Found Space for Event at Handle: ''' + InttoStr(Result+1) + ''); + {$ENDIF} + end + else + begin //There is no Space => Go make some! + Result := Length(Events); + SetLength(Events, Result + 1); + end; + + //Set Events Data + Events[Result].Name := EventName; + Events[Result].FirstSubscriber := nil; + Events[Result].LastSubscriber := nil; + + //Handle is Index + 1 + Inc(Result); + + {$IFDEF DEBUG} + WriteLn('HookManager: Add Event succesful: ''' + EventName + ''); + {$ENDIF} + end + {$IFDEF DEBUG} + else + WriteLn('HookManager: Trying to ReAdd Event: ''' + EventName + ''); + {$ENDIF} +end; + +//------------ +// DelEvent - Deletes an Event by Handle Returns False on Failure +//------------ +Function THookManager.DelEvent (hEvent: THandle): Integer; +var + Cur, Last: PSubscriberInfo; +begin + hEvent := hEvent - 1; //Arrayindex is Handle - 1 + Result := -1; + + + If (Length(Events) > hEvent) AND (Events[hEvent].Name[1] <> chr(0)) then + begin //Event exists + //Free the Space for all Subscribers + Cur := Events[hEvent].FirstSubscriber; + + While (Cur <> nil) do + begin + Last := Cur; + Cur := Cur.Next; + FreeMem(Last, SizeOf(TSubscriberInfo)); + end; + + {$IFDEF DEBUG} + WriteLn('HookManager: Removed Event succesful: ''' + Events[hEvent].Name + ''); + {$ENDIF} + + //Free the Event + Events[hEvent].Name[1] := chr(0); + Inc(SpaceinEvents); //There is one more space for new events + end + + {$IFDEF DEBUG} + else + WriteLn('HookManager: Try to Remove not Existing Event. Handle: ''' + InttoStr(hEvent) + ''); + {$ENDIF} +end; + +//------------ +// AddSubscriber - Adds an Subscriber to the Event by Name +// Returns Handle of the Subscribtion or 0 on Failure +//------------ +Function THookManager.AddSubscriber (const EventName: PChar; const Proc: TUS_Hook; const ProcOfClass: TUS_Hook_of_Object): THandle; +var + EventHandle: THandle; + EventIndex: Cardinal; + Cur: PSubscriberInfo; +begin + Result := 0; + + If (@Proc <> nil) or (@ProcOfClass <> nil) then + begin + EventHandle := EventExists(EventName); + + If (EventHandle <> 0) then + begin + EventIndex := EventHandle - 1; + + //Get Memory + GetMem(Cur, SizeOf(TSubscriberInfo)); + + //Fill it with Data + Cur.Next := nil; + + //Add Owner + Cur.Owner := Core.CurExecuted; + + If (@Proc = nil) then + begin //Use the ProcofClass Method + Cur.isClass := True; + Cur.ProcOfClass := ProcofClass; + end + else //Use the normal Proc + begin + Cur.isClass := False; + Cur.Proc := Proc; + end; + + //Create Handle (1st Word: Handle of Event; 2nd Word: unique ID + If (Events[EventIndex].LastSubscriber = nil) then + begin + If (Events[EventIndex].FirstSubscriber = nil) then + begin + Result := (EventHandle SHL 16); + Events[EventIndex].FirstSubscriber := Cur; + end + Else + begin + Result := Events[EventIndex].FirstSubscriber.Self + 1; + end; + end + Else + begin + Result := Events[EventIndex].LastSubscriber.Self + 1; + Events[EventIndex].LastSubscriber.Next := Cur; + end; + + Cur.Self := Result; + + //Add to Chain + Events[EventIndex].LastSubscriber := Cur; + + {$IFDEF DEBUG} + WriteLn('HookManager: Add Subscriber to Event ''' + Events[EventIndex].Name + ''' succesful. Handle: ''' + InttoStr(Result) + ''' Owner: ' + InttoStr(Cur.Owner)); + {$ENDIF} + end; + end; +end; + +//------------ +// FreeSubscriber - Helper for DelSubscriber. Prevents Loss of Chain Items. Frees Memory. +//------------ +Procedure THookManager.FreeSubscriber(const EventIndex: Word; const Last, Cur: PSubscriberInfo); +begin + //Delete from Chain + If (Last <> nil) then + begin + Last.Next := Cur.Next; + end + else //Was first Popup + begin + Events[EventIndex].FirstSubscriber := Cur.Next; + end; + + //Was this Last subscription ? + If (Cur = Events[EventIndex].LastSubscriber) then + begin //Change Last Subscriber + Events[EventIndex].LastSubscriber := Last; + end; + + //Free Space: + FreeMem(Cur, SizeOf(TSubscriberInfo)); +end; + +//------------ +// DelSubscriber - Deletes a Subscribtion by Handle, return non Zero on Failure +//------------ +Function THookManager.DelSubscriber (const hSubscriber: THandle): Integer; +var + EventIndex: Cardinal; + Cur, Last: PSubscriberInfo; +begin + Result := -1; + EventIndex := ((hSubscriber AND (High(THandle) xor High(Word))) SHR 16) - 1; + + //Existing Event ? + If (EventIndex < Length(Events)) AND (Events[EventIndex].Name[1] <> chr(0)) then + begin + Result := -2; //Return -1 on not existing Event, -2 on not existing Subscription + + //Search for Subscription + Cur := Events[EventIndex].FirstSubscriber; + Last := nil; + + //go through the chain ... + While (Cur <> nil) do + begin + If (Cur.Self = hSubscriber) then + begin //Found Subscription we searched for + FreeSubscriber(EventIndex, Last, Cur); + + {$IFDEF DEBUG} + WriteLn('HookManager: Del Subscriber from Event ''' + Events[EventIndex].Name + ''' succesful. Handle: ''' + InttoStr(hSubscriber) + ''); + {$ENDIF} + + //Set Result and Break the Loop + Result := 0; + Break; + end; + + Last := Cur; + Cur := Cur.Next; + end; + + end; +end; + + +//------------ +// CallEventChain - Calls the Chain of a specified EventHandle +// Returns: -1: Handle doesn't Exist, 0 Chain is called until the End +//------------ +Function THookManager.CallEventChain (const hEvent: THandle; const wParam, lParam: LongWord): Integer; +var + EventIndex: Cardinal; + Cur: PSubscriberInfo; + CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute +begin + Result := -1; + EventIndex := hEvent - 1; + + If ((EventIndex <= High(Events)) AND (Events[EventIndex].Name[1] <> chr(0))) then + begin //Existing Event + //Backup CurExecuted + CurExecutedBackup := Core.CurExecuted; + + //Start calling the Chain !!!11 + Cur := Events[EventIndex].FirstSubscriber; + Result := 0; + //Call Hooks until the Chain is at the End or breaked + While ((Cur <> nil) AND (Result = 0)) do + begin + //Set CurExecuted + Core.CurExecuted := Cur.Owner; + if (Cur.isClass) then + Result := Cur.ProcOfClass(wParam, lParam) + else + Result := Cur.Proc(wParam, lParam); + + Cur := Cur.Next; + end; + + //Restore CurExecuted + Core.CurExecuted := CurExecutedBackup; + end; + + {$IFDEF DEBUG} + WriteLn('HookManager: Called Chain from Event ''' + Events[EventIndex].Name + ''' succesful. Result: ''' + InttoStr(Result) + ''); + {$ENDIF} +end; + +//------------ +// EventExists - Returns non Zero if an Event with the given Name exists +//------------ +Function THookManager.EventExists (const EventName: PChar): Integer; +var + I: Integer; + Name: String[60]; +begin + Result := 0; + //If (Length(EventName) < + Name := String(EventName); + + //Sure not to search for empty space + If (Name[1] <> chr(0)) then + begin + //Search for Event + For I := 0 to High(Events) do + If (Events[I].Name = Name) then + begin //Event found + Result := I + 1; + Break; + end; + end; +end; + +//------------ +// DelbyOwner - Dels all Subscriptions by a specific Owner. (For Clean Plugin/Module unloading) +//------------ +Procedure THookManager.DelbyOwner(const Owner: Integer); +var + I: Integer; + Cur, Last: PSubscriberInfo; +begin + //Search for Owner in all Hooks Chains + For I := 0 to High(Events) do + begin + If (Events[I].Name[1] <> chr(0)) then + begin + + Last := nil; + Cur := Events[I].FirstSubscriber; + //Went Through Chain + While (Cur <> nil) do + begin + If (Cur.Owner = Owner) then + begin //Found Subscription by Owner -> Delete + FreeSubscriber(I, Last, Cur); + If (Last <> nil) then + Cur := Last.Next + else + Cur := Events[I].FirstSubscriber; + end + Else + begin + //Next Item: + Last := Cur; + Cur := Cur.Next; + end; + end; + end; + end; +end; + + +function HookTest(wParam, lParam: DWord): integer; stdcall; +begin + Result := 0; //Don't break the chain + Core.ShowMessage(CORE_SM_INFO, Integer(PChar(String(PChar(Pointer(lParam))) + ': ' + String(PChar(Pointer(wParam)))))); +end; + +end. diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index 36ba2180..998a1d4b 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -2,6 +2,10 @@ unit UIni; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses IniFiles, ULog, SysUtils; diff --git a/Game/Code/Classes/ULanguage.pas b/Game/Code/Classes/ULanguage.pas index 25986263..dc07c298 100644 --- a/Game/Code/Classes/ULanguage.pas +++ b/Game/Code/Classes/ULanguage.pas @@ -2,6 +2,10 @@ unit ULanguage; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} diff --git a/Game/Code/Classes/ULight.pas b/Game/Code/Classes/ULight.pas index 6621cf59..b0ff9d6b 100644 --- a/Game/Code/Classes/ULight.pas +++ b/Game/Code/Classes/ULight.pas @@ -2,6 +2,10 @@ unit ULight; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} type diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index 2ce70a11..7f0b82c4 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -2,6 +2,10 @@ unit ULog; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses Classes; diff --git a/Game/Code/Classes/ULyrics.pas b/Game/Code/Classes/ULyrics.pas index 96b9d43b..8eaa2a5f 100644 --- a/Game/Code/Classes/ULyrics.pas +++ b/Game/Code/Classes/ULyrics.pas @@ -2,6 +2,10 @@ unit ULyrics; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses OpenGL12, diff --git a/Game/Code/Classes/ULyrics_bak.pas b/Game/Code/Classes/ULyrics_bak.pas index b5a9d798..703ee270 100644 --- a/Game/Code/Classes/ULyrics_bak.pas +++ b/Game/Code/Classes/ULyrics_bak.pas @@ -1,424 +1,428 @@ -unit ULyrics_bak; - -interface - -{$I switches.inc} - -uses SysUtils, - OpenGL12, - UMusic, - UTexture; - -type - TWord = record - X: real; - Y: real; - Size: real; - Width: real; - Text: string; - ColR: real; - ColG: real; - ColB: real; - Scale: real; - Done: real; - FontStyle: integer; - Italic: boolean; - Selected: boolean; - end; - - TLyric = class - private - AlignI: integer; - XR: real; - YR: real; - SizeR: real; - SelectedI: integer; - ScaleR: real; - StyleI: integer; // 0 - one selection, 1 - long selection, 2 - one selection with fade to normal text, 3 - long selection with fade with color from left - FontStyleI: integer; // font number - Word: array of TWord; - - //Textures for PlayerIcon Index: Playernum; Index2: Enabled/Disabled - PlayerIconTex: array[0..5] of array [0..1] of TTexture; - - procedure SetX(Value: real); - procedure SetY(Value: real); - function GetClientX: real; - procedure SetAlign(Value: integer); - function GetSize: real; - procedure SetSize(Value: real); - procedure SetSelected(Value: integer); - procedure SetDone(Value: real); - procedure SetScale(Value: real); - procedure SetStyle(Value: integer); - procedure SetFStyle(Value: integer); - procedure Refresh; - - procedure DrawNormal(W: integer); - procedure DrawPlain(W: integer); - procedure DrawScaled(W: integer); - procedure DrawSlide(W: integer); - - procedure DrawPlayerIcons; - public - //Array containing Players Singing the Next Sentence - // 1: Player 1 Active - // 2: Player 2 Active - // 3: Player 3 Active - PlayersActive: Byte; - - //Dark or Light Colors - Enabled: Boolean; - - ColR: real; - ColG: real; - ColB: real; - ColSR: real; - ColSG: real; - ColSB: real; - Italic: boolean; - Text: string; // LCD - - constructor Create; - - procedure AddWord(Text: string); - procedure AddCzesc(NrCzesci: integer); - - function SelectedLetter: integer; // LCD - function SelectedLength: integer; // LCD - - procedure Clear; - procedure Draw; - published - property X: real write SetX; - property Y: real write SetY; - property ClientX: real read GetClientX; - property Align: integer write SetAlign; - property Size: real read GetSize write SetSize; - property Selected: integer read SelectedI write SetSelected; - property Done: real write SetDone; - property Scale: real write SetScale; - property Style: integer write SetStyle; - property FontStyle: integer write SetFStyle; - end; - -var - Lyric: TLyric; - -implementation -uses TextGL, UGraphic, UDrawTexture, Math, USkins; - -Constructor TLyric.Create; -var - I: Integer; -begin - //Only 2 Players for now - For I := 0 to 1 do - begin - PlayerIconTex[I][0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIcon_P' + InttoStr(I+1))), 'PNG', 'Transparent', 0); - PlayerIconTex[I][1] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIconD_P' + InttoStr(I+1))), 'PNG', 'Transparent', 0); - end; - PlayersActive := Trunc(Power(2, 1)) + 1; -end; - -procedure TLyric.SetX(Value: real); -begin - XR := Value; -end; - -procedure TLyric.SetY(Value: real); -begin - YR := Value; -end; - -function TLyric.GetClientX: real; -begin - Result := Word[0].X; -end; - -procedure TLyric.SetAlign(Value: integer); -begin - AlignI := Value; -// if AlignInt = 0 then beep; -end; - -function TLyric.GetSize: real; -begin - Result := SizeR; -end; - -procedure TLyric.SetSize(Value: real); -begin - SizeR := Value; -end; - -procedure TLyric.SetSelected(Value: integer); -var - W: integer; -begin - if (StyleI = 0) or (StyleI = 2) or (StyleI = 4) then begin - if (SelectedI > -1) and (SelectedI <= High(Word)) then begin - Word[SelectedI].Selected := false; - Word[SelectedI].ColR := ColR; - Word[SelectedI].ColG := ColG; - Word[SelectedI].ColB := ColB; - Word[SelectedI].Done := 0; - end; - - SelectedI := Value; - if (Value > -1) and (Value <= High(Word)) then begin - Word[Value].Selected := true; - Word[Value].ColR := ColSR; - Word[Value].ColG := ColSG; - Word[Value].ColB := ColSB; - Word[Value].Scale := ScaleR; - end; - end; - - if (StyleI = 1) or (StyleI = 3) then begin - if (SelectedI > -1) and (SelectedI <= High(Word)) then begin - for W := SelectedI to High(Word) do begin - Word[W].Selected := false; - Word[W].ColR := ColR; - Word[W].ColG := ColG; - Word[W].ColB := ColB; - Word[W].Done := 0; - end; - end; - - SelectedI := Value; - if (Value > -1) and (Value <= High(Word)) then begin - for W := 0 to Value do begin - Word[W].Selected := true; - Word[W].ColR := ColSR; - Word[W].ColG := ColSG; - Word[W].ColB := ColSB; - Word[W].Scale := ScaleR; - Word[W].Done := 1; - end; - end; - end; - - Refresh; -end; - -procedure TLyric.SetDone(Value: real); -var - W: integer; -begin - W := SelectedI; - if W > -1 then - Word[W].Done := Value; -end; - -procedure TLyric.SetScale(Value: real); -begin - ScaleR := Value; -end; - -procedure TLyric.SetStyle(Value: integer); -begin - StyleI := Value; -end; - -procedure TLyric.SetFStyle(Value: integer); -begin - FontStyleI := Value; -end; - -procedure TLyric.AddWord(Text: string); -var - WordNum: integer; -begin - WordNum := Length(Word); - SetLength(Word, WordNum + 1); - if WordNum = 0 then begin - Word[WordNum].X := XR; - end else begin - Word[WordNum].X := Word[WordNum - 1].X + Word[WordNum - 1].Width; - end; - - Word[WordNum].Y := YR; - Word[WordNum].Size := SizeR; - Word[WordNum].FontStyle := FontStyleI; // new - SetFontStyle(FontStyleI); - SetFontSize(SizeR); - Word[WordNum].Width := glTextWidth(pchar(Text)); - Word[WordNum].Text := Text; - Word[WordNum].ColR := ColR; - Word[WordNum].ColG := ColG; - Word[WordNum].ColB := ColB; - Word[WordNum].Scale := 1; - Word[WordNum].Done := 0; - Word[WordNum].Italic := Italic; - - Refresh; -end; - -procedure TLyric.AddCzesc(NrCzesci: integer); -var - N: integer; -begin - Clear; - for N := 0 to Czesci[0].Czesc[NrCzesci].HighNut do begin - Italic := Czesci[0].Czesc[NrCzesci].Nuta[N].FreeStyle; - AddWord(Czesci[0].Czesc[NrCzesci].Nuta[N].Tekst); - Text := Text + Czesci[0].Czesc[NrCzesci].Nuta[N].Tekst; - end; - Selected := -1; -end; - -procedure TLyric.Clear; -begin -{ ColR := Skin_FontR; - ColG := Skin_FontG; - ColB := Skin_FontB;} - SetLength(Word, 0); - Text := ''; - SelectedI := -1; -end; - -procedure TLyric.Refresh; -var - W: integer; - TotWidth: real; -begin - if AlignI = 1 then begin - TotWidth := 0; - for W := 0 to High(Word) do - TotWidth := TotWidth + Word[W].Width; - - Word[0].X := XR - TotWidth / 2; - for W := 1 to High(Word) do - Word[W].X := Word[W - 1].X + Word[W - 1].Width; - end; -end; - -procedure TLyric.DrawPlayerIcons; -begin - -end; - -procedure TLyric.Draw; -var - W: integer; -begin - case StyleI of - 0: - begin - for W := 0 to High(Word) do - DrawNormal(W); - end; - 1: - begin - for W := 0 to High(Word) do - DrawPlain(W); - end; - 2: // zoom - begin - for W := 0 to High(Word) do - if not Word[W].Selected then - DrawNormal(W); - - for W := 0 to High(Word) do - if Word[W].Selected then - DrawScaled(W); - end; - 3: // slide - begin - for W := 0 to High(Word) do begin - if not Word[W].Selected then - DrawNormal(W) - else - DrawSlide(W); - end; - end; - 4: // ball - begin - for W := 0 to High(Word) do - DrawNormal(W); - - for W := 0 to High(Word) do - if Word[W].Selected then begin - Tex_Ball.X := (Word[W].X - 10) + Word[W].Done * Word[W].Width; - Tex_Ball.Y := 480 - 10*sin(Word[W].Done * pi); - Tex_Ball.W := 20; - Tex_Ball.H := 20; - DrawTexture(Tex_Ball); - end; - end; - end; // case -end; - -procedure TLyric.DrawNormal(W: integer); -begin - SetFontStyle(Word[W].FontStyle); - SetFontPos(Word[W].X+ 10*ScreenX, Word[W].Y); - SetFontSize(Word[W].Size); - SetFontItalic(Word[W].Italic); - glColor3f(Word[W].ColR, Word[W].ColG, Word[W].ColB); - glPrint(pchar(Word[W].Text)); -end; - -procedure TLyric.DrawPlain(W: integer); -var - D: real; -begin - D := Word[W].Done; // przyrost - - SetFontStyle(Word[W].FontStyle); - SetFontPos(Word[W].X, Word[W].Y); - SetFontSize(Word[W].Size); - SetFontItalic(Word[W].Italic); - - if D = 0 then - glColor3f(ColR, ColG, ColB) - else - glColor3f(ColSR, ColSG, ColSB); - - glPrint(pchar(Word[W].Text)); -end; - -procedure TLyric.DrawScaled(W: integer); -var - D: real; -begin - // previous plus dynamic scaling effect - D := 1-Word[W].Done; // przyrost - SetFontStyle(Word[W].FontStyle); - SetFontPos(Word[W].X - D * Word[W].Width * (Word[W].Scale - 1) / 2 + (D+1)*10*ScreenX, Word[W].Y - D * 1.5 * Word[W].Size *(Word[W].Scale - 1)); - SetFontSize(Word[W].Size + D * (Word[W].Size * Word[W].Scale - Word[W].Size)); - SetFontItalic(Word[W].Italic); - glColor3f(Word[W].ColR, Word[W].ColG, Word[W].ColB); - glPrint(pchar(Word[W].Text)) -end; - -procedure TLyric.DrawSlide(W: integer); -var - D: real; -begin - D := Word[W].Done; // przyrost - SetFontStyle(Word[W].FontStyle); - SetFontPos(Word[W].X, Word[W].Y); - SetFontSize(Word[W].Size); - SetFontItalic(Word[W].Italic); - glColor3f(Word[W].ColR, Word[W].ColG, Word[W].ColB); - glPrintDone(pchar(Word[W].Text), D, ColR, ColG, ColB); -end; - -function TLyric.SelectedLetter; // LCD -var - W: integer; -begin - Result := 1; - - for W := 0 to SelectedI-1 do - Result := Result + Length(Word[W].Text); -end; - -function TLyric.SelectedLength: integer; // LCD -begin - Result := Length(Word[SelectedI].Text); -end; - -end. +unit ULyrics_bak; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses SysUtils, + OpenGL12, + UMusic, + UTexture; + +type + TWord = record + X: real; + Y: real; + Size: real; + Width: real; + Text: string; + ColR: real; + ColG: real; + ColB: real; + Scale: real; + Done: real; + FontStyle: integer; + Italic: boolean; + Selected: boolean; + end; + + TLyric = class + private + AlignI: integer; + XR: real; + YR: real; + SizeR: real; + SelectedI: integer; + ScaleR: real; + StyleI: integer; // 0 - one selection, 1 - long selection, 2 - one selection with fade to normal text, 3 - long selection with fade with color from left + FontStyleI: integer; // font number + Word: array of TWord; + + //Textures for PlayerIcon Index: Playernum; Index2: Enabled/Disabled + PlayerIconTex: array[0..5] of array [0..1] of TTexture; + + procedure SetX(Value: real); + procedure SetY(Value: real); + function GetClientX: real; + procedure SetAlign(Value: integer); + function GetSize: real; + procedure SetSize(Value: real); + procedure SetSelected(Value: integer); + procedure SetDone(Value: real); + procedure SetScale(Value: real); + procedure SetStyle(Value: integer); + procedure SetFStyle(Value: integer); + procedure Refresh; + + procedure DrawNormal(W: integer); + procedure DrawPlain(W: integer); + procedure DrawScaled(W: integer); + procedure DrawSlide(W: integer); + + procedure DrawPlayerIcons; + public + //Array containing Players Singing the Next Sentence + // 1: Player 1 Active + // 2: Player 2 Active + // 3: Player 3 Active + PlayersActive: Byte; + + //Dark or Light Colors + Enabled: Boolean; + + ColR: real; + ColG: real; + ColB: real; + ColSR: real; + ColSG: real; + ColSB: real; + Italic: boolean; + Text: string; // LCD + + constructor Create; + + procedure AddWord(Text: string); + procedure AddCzesc(NrCzesci: integer); + + function SelectedLetter: integer; // LCD + function SelectedLength: integer; // LCD + + procedure Clear; + procedure Draw; + published + property X: real write SetX; + property Y: real write SetY; + property ClientX: real read GetClientX; + property Align: integer write SetAlign; + property Size: real read GetSize write SetSize; + property Selected: integer read SelectedI write SetSelected; + property Done: real write SetDone; + property Scale: real write SetScale; + property Style: integer write SetStyle; + property FontStyle: integer write SetFStyle; + end; + +var + Lyric: TLyric; + +implementation +uses TextGL, UGraphic, UDrawTexture, Math, USkins; + +Constructor TLyric.Create; +var + I: Integer; +begin + //Only 2 Players for now + For I := 0 to 1 do + begin + PlayerIconTex[I][0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIcon_P' + InttoStr(I+1))), 'PNG', 'Transparent', 0); + PlayerIconTex[I][1] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIconD_P' + InttoStr(I+1))), 'PNG', 'Transparent', 0); + end; + PlayersActive := Trunc(Power(2, 1)) + 1; +end; + +procedure TLyric.SetX(Value: real); +begin + XR := Value; +end; + +procedure TLyric.SetY(Value: real); +begin + YR := Value; +end; + +function TLyric.GetClientX: real; +begin + Result := Word[0].X; +end; + +procedure TLyric.SetAlign(Value: integer); +begin + AlignI := Value; +// if AlignInt = 0 then beep; +end; + +function TLyric.GetSize: real; +begin + Result := SizeR; +end; + +procedure TLyric.SetSize(Value: real); +begin + SizeR := Value; +end; + +procedure TLyric.SetSelected(Value: integer); +var + W: integer; +begin + if (StyleI = 0) or (StyleI = 2) or (StyleI = 4) then begin + if (SelectedI > -1) and (SelectedI <= High(Word)) then begin + Word[SelectedI].Selected := false; + Word[SelectedI].ColR := ColR; + Word[SelectedI].ColG := ColG; + Word[SelectedI].ColB := ColB; + Word[SelectedI].Done := 0; + end; + + SelectedI := Value; + if (Value > -1) and (Value <= High(Word)) then begin + Word[Value].Selected := true; + Word[Value].ColR := ColSR; + Word[Value].ColG := ColSG; + Word[Value].ColB := ColSB; + Word[Value].Scale := ScaleR; + end; + end; + + if (StyleI = 1) or (StyleI = 3) then begin + if (SelectedI > -1) and (SelectedI <= High(Word)) then begin + for W := SelectedI to High(Word) do begin + Word[W].Selected := false; + Word[W].ColR := ColR; + Word[W].ColG := ColG; + Word[W].ColB := ColB; + Word[W].Done := 0; + end; + end; + + SelectedI := Value; + if (Value > -1) and (Value <= High(Word)) then begin + for W := 0 to Value do begin + Word[W].Selected := true; + Word[W].ColR := ColSR; + Word[W].ColG := ColSG; + Word[W].ColB := ColSB; + Word[W].Scale := ScaleR; + Word[W].Done := 1; + end; + end; + end; + + Refresh; +end; + +procedure TLyric.SetDone(Value: real); +var + W: integer; +begin + W := SelectedI; + if W > -1 then + Word[W].Done := Value; +end; + +procedure TLyric.SetScale(Value: real); +begin + ScaleR := Value; +end; + +procedure TLyric.SetStyle(Value: integer); +begin + StyleI := Value; +end; + +procedure TLyric.SetFStyle(Value: integer); +begin + FontStyleI := Value; +end; + +procedure TLyric.AddWord(Text: string); +var + WordNum: integer; +begin + WordNum := Length(Word); + SetLength(Word, WordNum + 1); + if WordNum = 0 then begin + Word[WordNum].X := XR; + end else begin + Word[WordNum].X := Word[WordNum - 1].X + Word[WordNum - 1].Width; + end; + + Word[WordNum].Y := YR; + Word[WordNum].Size := SizeR; + Word[WordNum].FontStyle := FontStyleI; // new + SetFontStyle(FontStyleI); + SetFontSize(SizeR); + Word[WordNum].Width := glTextWidth(pchar(Text)); + Word[WordNum].Text := Text; + Word[WordNum].ColR := ColR; + Word[WordNum].ColG := ColG; + Word[WordNum].ColB := ColB; + Word[WordNum].Scale := 1; + Word[WordNum].Done := 0; + Word[WordNum].Italic := Italic; + + Refresh; +end; + +procedure TLyric.AddCzesc(NrCzesci: integer); +var + N: integer; +begin + Clear; + for N := 0 to Czesci[0].Czesc[NrCzesci].HighNut do begin + Italic := Czesci[0].Czesc[NrCzesci].Nuta[N].FreeStyle; + AddWord(Czesci[0].Czesc[NrCzesci].Nuta[N].Tekst); + Text := Text + Czesci[0].Czesc[NrCzesci].Nuta[N].Tekst; + end; + Selected := -1; +end; + +procedure TLyric.Clear; +begin +{ ColR := Skin_FontR; + ColG := Skin_FontG; + ColB := Skin_FontB;} + SetLength(Word, 0); + Text := ''; + SelectedI := -1; +end; + +procedure TLyric.Refresh; +var + W: integer; + TotWidth: real; +begin + if AlignI = 1 then begin + TotWidth := 0; + for W := 0 to High(Word) do + TotWidth := TotWidth + Word[W].Width; + + Word[0].X := XR - TotWidth / 2; + for W := 1 to High(Word) do + Word[W].X := Word[W - 1].X + Word[W - 1].Width; + end; +end; + +procedure TLyric.DrawPlayerIcons; +begin + +end; + +procedure TLyric.Draw; +var + W: integer; +begin + case StyleI of + 0: + begin + for W := 0 to High(Word) do + DrawNormal(W); + end; + 1: + begin + for W := 0 to High(Word) do + DrawPlain(W); + end; + 2: // zoom + begin + for W := 0 to High(Word) do + if not Word[W].Selected then + DrawNormal(W); + + for W := 0 to High(Word) do + if Word[W].Selected then + DrawScaled(W); + end; + 3: // slide + begin + for W := 0 to High(Word) do begin + if not Word[W].Selected then + DrawNormal(W) + else + DrawSlide(W); + end; + end; + 4: // ball + begin + for W := 0 to High(Word) do + DrawNormal(W); + + for W := 0 to High(Word) do + if Word[W].Selected then begin + Tex_Ball.X := (Word[W].X - 10) + Word[W].Done * Word[W].Width; + Tex_Ball.Y := 480 - 10*sin(Word[W].Done * pi); + Tex_Ball.W := 20; + Tex_Ball.H := 20; + DrawTexture(Tex_Ball); + end; + end; + end; // case +end; + +procedure TLyric.DrawNormal(W: integer); +begin + SetFontStyle(Word[W].FontStyle); + SetFontPos(Word[W].X+ 10*ScreenX, Word[W].Y); + SetFontSize(Word[W].Size); + SetFontItalic(Word[W].Italic); + glColor3f(Word[W].ColR, Word[W].ColG, Word[W].ColB); + glPrint(pchar(Word[W].Text)); +end; + +procedure TLyric.DrawPlain(W: integer); +var + D: real; +begin + D := Word[W].Done; // przyrost + + SetFontStyle(Word[W].FontStyle); + SetFontPos(Word[W].X, Word[W].Y); + SetFontSize(Word[W].Size); + SetFontItalic(Word[W].Italic); + + if D = 0 then + glColor3f(ColR, ColG, ColB) + else + glColor3f(ColSR, ColSG, ColSB); + + glPrint(pchar(Word[W].Text)); +end; + +procedure TLyric.DrawScaled(W: integer); +var + D: real; +begin + // previous plus dynamic scaling effect + D := 1-Word[W].Done; // przyrost + SetFontStyle(Word[W].FontStyle); + SetFontPos(Word[W].X - D * Word[W].Width * (Word[W].Scale - 1) / 2 + (D+1)*10*ScreenX, Word[W].Y - D * 1.5 * Word[W].Size *(Word[W].Scale - 1)); + SetFontSize(Word[W].Size + D * (Word[W].Size * Word[W].Scale - Word[W].Size)); + SetFontItalic(Word[W].Italic); + glColor3f(Word[W].ColR, Word[W].ColG, Word[W].ColB); + glPrint(pchar(Word[W].Text)) +end; + +procedure TLyric.DrawSlide(W: integer); +var + D: real; +begin + D := Word[W].Done; // przyrost + SetFontStyle(Word[W].FontStyle); + SetFontPos(Word[W].X, Word[W].Y); + SetFontSize(Word[W].Size); + SetFontItalic(Word[W].Italic); + glColor3f(Word[W].ColR, Word[W].ColG, Word[W].ColB); + glPrintDone(pchar(Word[W].Text), D, ColR, ColG, ColB); +end; + +function TLyric.SelectedLetter; // LCD +var + W: integer; +begin + Result := 1; + + for W := 0 to SelectedI-1 do + Result := Result + Length(Word[W].Text); +end; + +function TLyric.SelectedLength: integer; // LCD +begin + Result := Length(Word[SelectedI].Text); +end; + +end. diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 80305b35..d3b65e2f 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -2,6 +2,10 @@ unit UMain; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses @@ -141,7 +145,7 @@ uses USongs, UJoystick, math, UCommandLine, ULanguage, SDL_ttf, const Version = 'UltraStar Deluxe V 1.10 Alpha Build'; -{$IFDEF WIN32} +//{$IFDEF WIN32} Procedure Main; var WndTitle: string; @@ -401,7 +405,7 @@ begin Log.Free; end; -{$ENDIF} +//{$ENDIF} procedure MainLoop; var diff --git a/Game/Code/Classes/UMedia_dummy.pas b/Game/Code/Classes/UMedia_dummy.pas index 37e311af..0c788677 100644 --- a/Game/Code/Classes/UMedia_dummy.pas +++ b/Game/Code/Classes/UMedia_dummy.pas @@ -12,6 +12,10 @@ unit UMedia_dummy; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} implementation diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index e2d2cc60..3fc1136b 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -2,6 +2,10 @@ unit UMusic; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses Classes ; diff --git a/Game/Code/Classes/UParty.pas b/Game/Code/Classes/UParty.pas index 4f351dc5..36a40858 100644 --- a/Game/Code/Classes/UParty.pas +++ b/Game/Code/Classes/UParty.pas @@ -1,376 +1,381 @@ -unit UParty; - -interface - -{$I switches.inc} - -uses ModiSDK; - -type - TRoundInfo = record - Plugin: Word; - Winner: Byte; - end; - - TeamOrderEntry = record - Teamnum: Byte; - Score: Byte; - end; - - TeamOrderArray = Array[0..5] of Byte; - - TParty_Session = class - private - function GetRandomPlayer(Team: Byte): Byte; - function IsWinner(Player, Winner: Byte): boolean; - procedure GenScores; - public - Teams: TTeamInfo; - Rounds: array of TRoundInfo; - CurRound: Byte; - - constructor Create; - - procedure StartNewParty(NumRounds: Byte); - procedure StartRound; - procedure EndRound; - function GetTeamOrder: TeamOrderArray; - function GetWinnerString(Round: Byte): String; - end; - -var - PartySession: TParty_Session; - -implementation - -uses UDLLManager, UGraphic, UMain, ULanguage, ULog; - -//---------- -//Constructor - Prepares the Class -//---------- -constructor TParty_Session.Create; -begin -// - Nothing in here atm -end; - -//---------- -//StartNewParty - Clears the Class and Prepares for new Party -//---------- -procedure TParty_Session.StartNewParty(NumRounds: Byte); -var - Plugins: Array of record - ID: Byte; - TimesPlayed: Byte; - end; - TeamMode: Boolean; - Len: Integer; - I, J: Integer; - - function GetRandomPlugin: Byte; - var - LowestTP: Byte; - NumPwithLTP: Word; - I: Integer; - R: Word; - begin - LowestTP := high(Byte); - NumPwithLTP := 0; - - //Search for Plugins not often played yet - For I := 0 to high(Plugins) do - begin - if (Plugins[I].TimesPlayed < lowestTP) then - begin - lowestTP := Plugins[I].TimesPlayed; - NumPwithLTP := 1; - end - else if (Plugins[I].TimesPlayed = lowestTP) then - begin - Inc(NumPwithLTP); - end; - end; - - //Create Random No - R := Random(NumPwithLTP); - - //Search for Random Plugin - For I := 0 to high(Plugins) do - begin - if Plugins[I].TimesPlayed = lowestTP then - begin - //Plugin Found - if (R = 0) then - begin - Result := Plugins[I].ID; - Inc(Plugins[I].TimesPlayed); - Break; - end; - - Dec(R); - end; - end; - end; -begin - //Set cur Round to Round 1 - CurRound := 255; - - PlayersPlay := Teams.NumTeams; - - //Get Teammode and Set Joker, also set TimesPlayed - TeamMode := True; - For I := 0 to Teams.NumTeams-1 do - begin - if Teams.Teaminfo[I].NumPlayers < 2 then - begin - TeamMode := False; - end; - //Set Player Attributes - For J := 0 to Teams.TeamInfo[I].NumPlayers-1 do - begin - Teams.TeamInfo[I].Playerinfo[J].TimesPlayed := 0; - end; - Teams.Teaminfo[I].Joker := Round(NumRounds*0.7); - Teams.Teaminfo[I].Score := 0; - end; - - //Fill Plugin Array - SetLength(Plugins, 0); - For I := 0 to high(DLLMan.Plugins) do - begin - if TeamMode or (Not DLLMan.Plugins[I].TeamModeOnly) then - begin //Add only Plugins Playable with cur. PlayerConfiguration - Len := Length(Plugins); - SetLength(Plugins, Len + 1); - Plugins[Len].ID := I; - Plugins[Len].TimesPlayed := 0; - end; - end; - - //Set Rounds - If (Length(Plugins) >= 1) then - begin - SetLength (Rounds, NumRounds); - For I := 0 to NumRounds-1 do - begin - PartySession.Rounds[I].Plugin := GetRandomPlugin; - PartySession.Rounds[I].Winner := 255; - end; - end - else SetLength (Rounds, 0); -end; - -//---------- -//GetRandomPlayer - Gives back a Random Player to Play next Round -//---------- -function TParty_Session.GetRandomPlayer(Team: Byte): Byte; -var - I, R: Integer; - lowestTP: Byte; - NumPwithLTP: Byte; -begin - LowestTP := high(Byte); - NumPwithLTP := 0; - Result := 0; - - //Search for Players that have not often played yet - For I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do - begin - if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed < lowestTP) then - begin - lowestTP := Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed; - NumPwithLTP := 1; - end - else if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP) then - begin - Inc(NumPwithLTP); - end; - end; - - //Create Random No - R := Random(NumPwithLTP); - - //Search for Random Player - For I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do - begin - if Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP then - begin - //Player Found - if (R = 0) then - begin - Result := I; - Break; - end; - - Dec(R); - end; - end; - {//Get lowest TimesPlayed - lowestTP := high(Byte); - J := -1; - for I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do - begin - if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed < lowestTP) then - begin - lowestTP := Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed; - J := I; - end - else if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP) then - begin - J := -1; - end; - end; - - //If more than one Person has lowestTP then Select Random Player - if (J < 0) then - repeat - Result := Random(Teams.Teaminfo[Team].NumPlayers); - until (Teams.Teaminfo[Team].Playerinfo[Result].TimesPlayed = lowestTP) - else //Else Select the one with lowest TP - Result:= J;} -end; - -//---------- -//StartNextRound - Prepares ScreenSingModi for Next Round And Load Plugin -//---------- -procedure TParty_Session.StartRound; -var - I: Integer; -begin - if ((CurRound < high(Rounds)) OR (CurRound = high(CurRound))) then - begin - //Increase Current Round - Inc (CurRound); - - Rounds[CurRound].Winner := 255; - DllMan.LoadPlugin(Rounds[CurRound].Plugin); - - //Select Players - for I := 0 to Teams.NumTeams-1 do - Teams.Teaminfo[I].CurPlayer := GetRandomPlayer(I); - - //Set ScreenSingModie Variables - ScreenSingModi.TeamInfo := Teams; - - //Set - end; -end; - -//---------- -//IsWinner - Returns True if the Players Bit is set in the Winner Byte -//---------- -function TParty_Session.IsWinner(Player, Winner: Byte): boolean; -var - Bit: Byte; -begin - Case Player of - 0: Bit := 1; - 1: Bit := 2; - 2: Bit := 4; - 3: Bit := 8; - 4: Bit := 16; - 5: Bit := 32; - end; - - Result := ((Winner AND Bit) = Bit); -end; - -//---------- -//GenScores - Inc Scores for Cur. Round -//---------- -procedure TParty_Session.GenScores; -var - I: Byte; -begin - for I := 0 to Teams.NumTeams-1 do - begin - if isWinner(I, Rounds[CurRound].Winner) then - Inc(Teams.Teaminfo[I].Score); - end; -end; - -//---------- -//GetWinnerString - Get String with WinnerTeam Name, when there is more than one Winner than Connect with and or , -//---------- -function TParty_Session.GetWinnerString(Round: Byte): String; -var - Winners: Array of String; - I: Integer; -begin - Result := Language.Translate('PARTY_NOBODY'); - - if (Round > High(Rounds)) then - exit; - - if (Rounds[Round].Winner = 0) then - begin - exit; - end; - - if (Rounds[Round].Winner = 255) then - begin - Result := Language.Translate('PARTY_NOTPLAYEDYET'); - exit; - end; - - SetLength(Winners, 0); - for I := 0 to Teams.NumTeams-1 do - begin - if isWinner(I, Rounds[Round].Winner) then - begin - SetLength(Winners, Length(Winners) + 1); - Winners[high(Winners)] := Teams.TeamInfo[I].Name; - end; - end; - Result := Language.Implode(Winners); -end; - -//---------- -//EndRound - Get Winner from ScreenSingModi and Save Data to RoundArray -//---------- -procedure TParty_Session.EndRound; -var - I: Integer; -begin - //Copy Winner - Rounds[CurRound].Winner := ScreenSingModi.Winner; - //Set Scores - GenScores; - - //Increase TimesPlayed 4 all Players - For I := 0 to Teams.NumTeams-1 do - Inc(Teams.Teaminfo[I].Playerinfo[Teams.Teaminfo[I].CurPlayer].TimesPlayed); - -end; - -//---------- -//GetTeamOrder - Gives back the Placing of eacb Team [First Position of Array is Teamnum of first placed Team, ...] -//---------- -function TParty_Session.GetTeamOrder: TeamOrderArray; -var - I, J: Integer; - ATeams: array [0..5] of TeamOrderEntry; - TempTeam: TeamOrderEntry; -begin - //Fill Team Array - For I := 0 to Teams.NumTeams-1 do - begin - ATeams[I].Teamnum := I; - ATeams[I].Score := Teams.Teaminfo[I].Score; - end; - - //Sort Teams - for J := 0 to Teams.NumTeams-1 do - for I := 1 to Teams.NumTeams-1 do - if ATeams[I].Score > ATeams[I-1].Score then - begin - TempTeam := ATeams[I-1]; - ATeams[I-1] := ATeams[I]; - ATeams[I] := TempTeam; - end; - - //Copy to Result - For I := 0 to Teams.NumTeams-1 do - Result[I] := ATeams[I].TeamNum; -end; - -end. +unit UParty; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + + +{$I switches.inc} + +uses ModiSDK; + +type + TRoundInfo = record + Plugin: Word; + Winner: Byte; + end; + + TeamOrderEntry = record + Teamnum: Byte; + Score: Byte; + end; + + TeamOrderArray = Array[0..5] of Byte; + + TParty_Session = class + private + function GetRandomPlayer(Team: Byte): Byte; + function IsWinner(Player, Winner: Byte): boolean; + procedure GenScores; + public + Teams: TTeamInfo; + Rounds: array of TRoundInfo; + CurRound: Byte; + + constructor Create; + + procedure StartNewParty(NumRounds: Byte); + procedure StartRound; + procedure EndRound; + function GetTeamOrder: TeamOrderArray; + function GetWinnerString(Round: Byte): String; + end; + +var + PartySession: TParty_Session; + +implementation + +uses UDLLManager, UGraphic, UMain, ULanguage, ULog; + +//---------- +//Constructor - Prepares the Class +//---------- +constructor TParty_Session.Create; +begin +// - Nothing in here atm +end; + +//---------- +//StartNewParty - Clears the Class and Prepares for new Party +//---------- +procedure TParty_Session.StartNewParty(NumRounds: Byte); +var + Plugins: Array of record + ID: Byte; + TimesPlayed: Byte; + end; + TeamMode: Boolean; + Len: Integer; + I, J: Integer; + + function GetRandomPlugin: Byte; + var + LowestTP: Byte; + NumPwithLTP: Word; + I: Integer; + R: Word; + begin + LowestTP := high(Byte); + NumPwithLTP := 0; + + //Search for Plugins not often played yet + For I := 0 to high(Plugins) do + begin + if (Plugins[I].TimesPlayed < lowestTP) then + begin + lowestTP := Plugins[I].TimesPlayed; + NumPwithLTP := 1; + end + else if (Plugins[I].TimesPlayed = lowestTP) then + begin + Inc(NumPwithLTP); + end; + end; + + //Create Random No + R := Random(NumPwithLTP); + + //Search for Random Plugin + For I := 0 to high(Plugins) do + begin + if Plugins[I].TimesPlayed = lowestTP then + begin + //Plugin Found + if (R = 0) then + begin + Result := Plugins[I].ID; + Inc(Plugins[I].TimesPlayed); + Break; + end; + + Dec(R); + end; + end; + end; +begin + //Set cur Round to Round 1 + CurRound := 255; + + PlayersPlay := Teams.NumTeams; + + //Get Teammode and Set Joker, also set TimesPlayed + TeamMode := True; + For I := 0 to Teams.NumTeams-1 do + begin + if Teams.Teaminfo[I].NumPlayers < 2 then + begin + TeamMode := False; + end; + //Set Player Attributes + For J := 0 to Teams.TeamInfo[I].NumPlayers-1 do + begin + Teams.TeamInfo[I].Playerinfo[J].TimesPlayed := 0; + end; + Teams.Teaminfo[I].Joker := Round(NumRounds*0.7); + Teams.Teaminfo[I].Score := 0; + end; + + //Fill Plugin Array + SetLength(Plugins, 0); + For I := 0 to high(DLLMan.Plugins) do + begin + if TeamMode or (Not DLLMan.Plugins[I].TeamModeOnly) then + begin //Add only Plugins Playable with cur. PlayerConfiguration + Len := Length(Plugins); + SetLength(Plugins, Len + 1); + Plugins[Len].ID := I; + Plugins[Len].TimesPlayed := 0; + end; + end; + + //Set Rounds + If (Length(Plugins) >= 1) then + begin + SetLength (Rounds, NumRounds); + For I := 0 to NumRounds-1 do + begin + PartySession.Rounds[I].Plugin := GetRandomPlugin; + PartySession.Rounds[I].Winner := 255; + end; + end + else SetLength (Rounds, 0); +end; + +//---------- +//GetRandomPlayer - Gives back a Random Player to Play next Round +//---------- +function TParty_Session.GetRandomPlayer(Team: Byte): Byte; +var + I, R: Integer; + lowestTP: Byte; + NumPwithLTP: Byte; +begin + LowestTP := high(Byte); + NumPwithLTP := 0; + Result := 0; + + //Search for Players that have not often played yet + For I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do + begin + if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed < lowestTP) then + begin + lowestTP := Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed; + NumPwithLTP := 1; + end + else if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP) then + begin + Inc(NumPwithLTP); + end; + end; + + //Create Random No + R := Random(NumPwithLTP); + + //Search for Random Player + For I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do + begin + if Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP then + begin + //Player Found + if (R = 0) then + begin + Result := I; + Break; + end; + + Dec(R); + end; + end; + {//Get lowest TimesPlayed + lowestTP := high(Byte); + J := -1; + for I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do + begin + if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed < lowestTP) then + begin + lowestTP := Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed; + J := I; + end + else if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP) then + begin + J := -1; + end; + end; + + //If more than one Person has lowestTP then Select Random Player + if (J < 0) then + repeat + Result := Random(Teams.Teaminfo[Team].NumPlayers); + until (Teams.Teaminfo[Team].Playerinfo[Result].TimesPlayed = lowestTP) + else //Else Select the one with lowest TP + Result:= J;} +end; + +//---------- +//StartNextRound - Prepares ScreenSingModi for Next Round And Load Plugin +//---------- +procedure TParty_Session.StartRound; +var + I: Integer; +begin + if ((CurRound < high(Rounds)) OR (CurRound = high(CurRound))) then + begin + //Increase Current Round + Inc (CurRound); + + Rounds[CurRound].Winner := 255; + DllMan.LoadPlugin(Rounds[CurRound].Plugin); + + //Select Players + for I := 0 to Teams.NumTeams-1 do + Teams.Teaminfo[I].CurPlayer := GetRandomPlayer(I); + + //Set ScreenSingModie Variables + ScreenSingModi.TeamInfo := Teams; + + //Set + end; +end; + +//---------- +//IsWinner - Returns True if the Players Bit is set in the Winner Byte +//---------- +function TParty_Session.IsWinner(Player, Winner: Byte): boolean; +var + Bit: Byte; +begin + Case Player of + 0: Bit := 1; + 1: Bit := 2; + 2: Bit := 4; + 3: Bit := 8; + 4: Bit := 16; + 5: Bit := 32; + end; + + Result := ((Winner AND Bit) = Bit); +end; + +//---------- +//GenScores - Inc Scores for Cur. Round +//---------- +procedure TParty_Session.GenScores; +var + I: Byte; +begin + for I := 0 to Teams.NumTeams-1 do + begin + if isWinner(I, Rounds[CurRound].Winner) then + Inc(Teams.Teaminfo[I].Score); + end; +end; + +//---------- +//GetWinnerString - Get String with WinnerTeam Name, when there is more than one Winner than Connect with and or , +//---------- +function TParty_Session.GetWinnerString(Round: Byte): String; +var + Winners: Array of String; + I: Integer; +begin + Result := Language.Translate('PARTY_NOBODY'); + + if (Round > High(Rounds)) then + exit; + + if (Rounds[Round].Winner = 0) then + begin + exit; + end; + + if (Rounds[Round].Winner = 255) then + begin + Result := Language.Translate('PARTY_NOTPLAYEDYET'); + exit; + end; + + SetLength(Winners, 0); + for I := 0 to Teams.NumTeams-1 do + begin + if isWinner(I, Rounds[Round].Winner) then + begin + SetLength(Winners, Length(Winners) + 1); + Winners[high(Winners)] := Teams.TeamInfo[I].Name; + end; + end; + Result := Language.Implode(Winners); +end; + +//---------- +//EndRound - Get Winner from ScreenSingModi and Save Data to RoundArray +//---------- +procedure TParty_Session.EndRound; +var + I: Integer; +begin + //Copy Winner + Rounds[CurRound].Winner := ScreenSingModi.Winner; + //Set Scores + GenScores; + + //Increase TimesPlayed 4 all Players + For I := 0 to Teams.NumTeams-1 do + Inc(Teams.Teaminfo[I].Playerinfo[Teams.Teaminfo[I].CurPlayer].TimesPlayed); + +end; + +//---------- +//GetTeamOrder - Gives back the Placing of eacb Team [First Position of Array is Teamnum of first placed Team, ...] +//---------- +function TParty_Session.GetTeamOrder: TeamOrderArray; +var + I, J: Integer; + ATeams: array [0..5] of TeamOrderEntry; + TempTeam: TeamOrderEntry; +begin + //Fill Team Array + For I := 0 to Teams.NumTeams-1 do + begin + ATeams[I].Teamnum := I; + ATeams[I].Score := Teams.Teaminfo[I].Score; + end; + + //Sort Teams + for J := 0 to Teams.NumTeams-1 do + for I := 1 to Teams.NumTeams-1 do + if ATeams[I].Score > ATeams[I-1].Score then + begin + TempTeam := ATeams[I-1]; + ATeams[I-1] := ATeams[I]; + ATeams[I] := TempTeam; + end; + + //Copy to Result + For I := 0 to Teams.NumTeams-1 do + Result[I] := ATeams[I].TeamNum; +end; + +end. diff --git a/Game/Code/Classes/UPlaylist.pas b/Game/Code/Classes/UPlaylist.pas index b18d4833..8d981065 100644 --- a/Game/Code/Classes/UPlaylist.pas +++ b/Game/Code/Classes/UPlaylist.pas @@ -1,463 +1,467 @@ -unit UPlaylist; - -interface - -{$I switches.inc} - - -type - TPlaylistItem = record - Artist: String; - Title: String; - SongID: Integer; - end; - - APlaylistItem = array of TPlaylistItem; - - TPlaylist = record - Name: String; - Filename: String; - Items: APlaylistItem; - end; - - APlaylist = array of TPlaylist; - - //---------- - //TPlaylistManager - Class for Managing Playlists (Loading, Displaying, Saving) - //---------- - TPlaylistManager = class - private - - public - Mode: Byte; //Current Playlist Mode for SongScreen - CurPlayList: Cardinal; - CurItem: Cardinal; - - Playlists: APlaylist; - - constructor Create; - Procedure LoadPlayLists; - Function LoadPlayList(Index: Cardinal; Filename: String): Boolean; - Procedure SavePlayList(Index: Cardinal); - - Procedure SetPlayList(Index: Cardinal); - - Function AddPlaylist(Name: String): Cardinal; - Procedure DelPlaylist(const Index: Cardinal); - - Procedure AddItem(const SongID: Cardinal; const iPlaylist: Integer = -1); - Procedure DelItem(const iItem: Cardinal; const iPlaylist: Integer = -1); - - Procedure GetNames(var PLNames: array of String); - Function GetIndexbySongID(const SongID: Cardinal; const iPlaylist: Integer = -1): Integer; - end; - - {Modes: - 0: Standard Mode - 1: Category Mode - 2: PlayList Mode} - - var - PlayListMan: TPlaylistManager; - - -implementation - -uses USongs, - ULog, - UMain, - //UFiles, - UGraphic, - UThemes, - SysUtils; - -//---------- -//Create - Construct Class - Dummy for now -//---------- -constructor TPlayListManager.Create; -begin - LoadPlayLists; -end; - -//---------- -//LoadPlayLists - Load list of Playlists from PlayList Folder -//---------- -Procedure TPlayListManager.LoadPlayLists; -var - SR: TSearchRec; - Len: Integer; -begin - SetLength(Playlists, 0); - - if FindFirst(PlayListPath + '*.upl', 0, SR) = 0 then - begin - repeat - Len := Length(Playlists); - SetLength(Playlists, Len +1); - - if not LoadPlayList (Len, Sr.Name) then - SetLength(Playlists, Len); - - until FindNext(SR) <> 0; - FindClose(SR); - end; -end; - -//---------- -//LoadPlayList - Load a Playlist in the Array -//---------- -Function TPlayListManager.LoadPlayList(Index: Cardinal; Filename: String): Boolean; - var - F: TextFile; - Line: String; - PosDelimiter: Integer; - SongID: Integer; - Len: Integer; - - Function FindSong(Artist, Title: String): Integer; - var I: Integer; - begin - Result := -1; - - For I := low(CatSongs.Song) to high(CatSongs.Song) do - begin - if (CatSongs.Song[I].Title = Title) AND (CatSongs.Song[I].Artist = Artist) then - begin - Result := I; - Break; - end; - end; - end; -begin - if not FileExists(PlayListPath + Filename) then - begin - Log.LogError('Could not load Playlist: ' + Filename); - Result := False; - Exit; - end; - Result := True; - - //Load File - AssignFile(F, PlayListPath + FileName); - Reset(F); - - //Set Filename - PlayLists[Index].Filename := Filename; - PlayLists[Index].Name := ''; - - //Read Until End of File - While not Eof(F) do - begin - //Read Curent Line - Readln(F, Line); - - if (Length(Line) > 0) then - begin - PosDelimiter := Pos(':', Line); - if (PosDelimiter <> 0) then - begin - //Comment or Name String - if (Line[1] = '#') then - begin - //Found Name Value - if (Uppercase(Trim(copy(Line, 2, PosDelimiter - 2))) = 'NAME') then - PlayLists[Index].Name := Trim(copy(Line, PosDelimiter + 1,Length(Line) - PosDelimiter)) - - end - //Song Entry - else - begin - SongID := FindSong(Trim(copy(Line, 1, PosDelimiter - 1)), Trim(copy(Line, PosDelimiter + 1, Length(Line) - PosDelimiter))); - if (SongID <> -1) then - begin - Len := Length(PlayLists[Index].Items); - SetLength(PlayLists[Index].Items, Len + 1); - - PlayLists[Index].Items[Len].SongID := SongID; - - PlayLists[Index].Items[Len].Artist := Trim(copy(Line, 1, PosDelimiter - 1)); - PlayLists[Index].Items[Len].Title := Trim(copy(Line, PosDelimiter + 1, Length(Line) - PosDelimiter)); - end - else Log.LogError('Could not find Song in Playlist: ' + PlayLists[Index].Filename + ', ' + Line); - end; - end; - end; - end; - - //If no special name is given, use Filename - if PlayLists[Index].Name = '' then - begin - PlayLists[Index].Name := ChangeFileExt(FileName, ''); - end; - - //Finish (Close File) - CloseFile(F); -end; - -//---------- -//SavePlayList - Saves the specified Playlist -//---------- -Procedure TPlayListManager.SavePlayList(Index: Cardinal); -var - F: TextFile; - I: Integer; -begin - if (Not FileExists(PlaylistPath + Playlists[Index].Filename)) OR (Not FileisReadOnly(PlaylistPath + Playlists[Index].Filename)) then - begin - - //open File for Rewriting - AssignFile(F, PlaylistPath + Playlists[Index].Filename); - try - try - Rewrite(F); - - //Write Version (not nessecary but helpful) - WriteLn(F, '######################################'); - WriteLn(F, '#Ultrastar Deluxe Playlist Format v1.0'); - WriteLn(F, '#Playlist "' + Playlists[Index].Name + '" with ' + InttoStr(Length(Playlists[Index].Items)) + ' Songs.'); - WriteLn(F, '######################################'); - - //Write Name Information - WriteLn(F, '#Name: ' + Playlists[Index].Name); - - //Write Song Information - WriteLn(F, '#Songs:'); - - For I := 0 to high(Playlists[Index].Items) do - begin - WriteLn(F, Playlists[Index].Items[I].Artist + ' : ' + Playlists[Index].Items[I].Title); - end; - except - log.LogError('Could not write Playlistfile "' + Playlists[Index].Name + '"'); - end; - finally - CloseFile(F); - end; - end; -end; - -//---------- -//SetPlayList - Display a Playlist in CatSongs -//---------- -Procedure TPlayListManager.SetPlayList(Index: Cardinal); -var - I: Integer; -begin - If (Index > High(PlayLists)) then - exit; - - //Hide all Songs - For I := 0 to high(CatSongs.Song) do - CatSongs.Song[I].Visible := False; - - //Show Songs in PL - For I := 0 to high(PlayLists[Index].Items) do - begin - CatSongs.Song[PlayLists[Index].Items[I].SongID].Visible := True; - end; - - //Set CatSongsMode + Playlist Mode - CatSongs.CatNumShow := -3; - Mode := 2; - - //Set CurPlaylist - CurPlaylist := Index; - - //Show Cat in Topleft: - ScreenSong.ShowCatTLCustom(Format(Theme.Playlist.CatText,[Playlists[Index].Name])); - - //Fix SongSelection - ScreenSong.Interaction := 0; - ScreenSong.SelectNext; - ScreenSong.FixSelected; - - //Play correct Music - ScreenSong.ChangeMusic; -end; - -//---------- -//AddPlaylist - Adds a Playlist and Returns the Index -//---------- -Function TPlayListManager.AddPlaylist(Name: String): Cardinal; -var I: Integer; -begin - Result := Length(Playlists); - SetLength(Playlists, Result + 1); - - Playlists[Result].Name := Name; - - I := 1; - - if (not FileExists(PlaylistPath + Name + '.upl')) then - Playlists[Result].Filename := Name + '.upl' - else - begin - repeat - Inc(I); - until not FileExists(PlaylistPath + Name + InttoStr(I) + '.upl'); - Playlists[Result].Filename := Name + InttoStr(I) + '.upl'; - end; - - //Save new Playlist - SavePlayList(Result); -end; - -//---------- -//DelPlaylist - Deletes a Playlist -//---------- -Procedure TPlayListManager.DelPlaylist(const Index: Cardinal); -var - I: Integer; - Filename: String; -begin - If Index > High(Playlists) then - Exit; - - Filename := PlaylistPath + Playlists[Index].Filename; - - //If not FileExists or File is not Writeable then exit - If (Not FileExists(Filename)) OR (FileisReadOnly(Filename)) then - Exit; - - - //Delete Playlist from FileSystem - if Not DeleteFile(Filename) then - Exit; - - //Delete Playlist from Array - //move all PLs to the Hole - For I := Index to High(Playlists)-1 do - PlayLists[I] := PlayLists[I+1]; - - //Delete last Playlist - SetLength (Playlists, High(Playlists)); - - //If Playlist is Displayed atm - //-> Display Songs - if (CatSongs.CatNumShow = -3) and (Index = CurPlaylist) then - begin - ScreenSong.UnLoadDetailedCover; - ScreenSong.HideCatTL; - CatSongs.SetFilter('', 0); - ScreenSong.Interaction := 0; - ScreenSong.FixSelected; - ScreenSong.ChangeMusic; - end; -end; - -//---------- -//AddItem - Adds an Item to a specific Playlist -//---------- -Procedure TPlayListManager.AddItem(const SongID: Cardinal; const iPlaylist: Integer); -var - P: Cardinal; - Len: Cardinal; -begin - if iPlaylist = -1 then - P := CurPlaylist - else if (iPlaylist >= 0) AND (iPlaylist <= high(Playlists)) then - P := iPlaylist - else - exit; - - if (SongID <= High(CatSongs.Song)) AND (NOT CatSongs.Song[SongID].Main) then - begin - Len := Length(Playlists[P].Items); - SetLength(Playlists[P].Items, Len + 1); - - Playlists[P].Items[Len].SongID := SongID; - Playlists[P].Items[Len].Title := CatSongs.Song[SongID].Title; - Playlists[P].Items[Len].Artist := CatSongs.Song[SongID].Artist; - - //Save Changes - SavePlayList(P); - - //Correct Display when Editing current Playlist - if (CatSongs.CatNumShow = -3) and (P = CurPlaylist) then - SetPlaylist(P); - end; -end; - -//---------- -//DelItem - Deletes an Item from a specific Playlist -//---------- -Procedure TPlayListManager.DelItem(const iItem: Cardinal; const iPlaylist: Integer); -var - I: Integer; - P: Cardinal; -begin - if iPlaylist = -1 then - P := CurPlaylist - else if (iPlaylist >= 0) AND (iPlaylist <= high(Playlists)) then - P := iPlaylist - else - exit; - - if (iItem <= high(Playlists[P].Items)) then - begin - //Move all entrys behind deleted one to Front - For I := iItem to High(Playlists[P].Items) - 1 do - Playlists[P].Items[I] := Playlists[P].Items[I + 1]; - - //Delete Last Entry - SetLength(PlayLists[P].Items, Length(PlayLists[P].Items) - 1); - - //Save Changes - SavePlayList(P); - end; - - //Delete Playlist if Last Song is deleted - if (Length(PlayLists[P].Items) = 0) then - begin - DelPlaylist(P); - end - //Correct Display when Editing current Playlist - else if (CatSongs.CatNumShow = -3) and (P = CurPlaylist) then - SetPlaylist(P); -end; - -//---------- -//GetNames - Writes Playlist Names in a Array -//---------- -Procedure TPlayListManager.GetNames(var PLNames: array of String); -var - I: Integer; - Len: Integer; -begin - Len := High(Playlists); - - if (Length(PLNames) <> Len + 1) then - exit; - - For I := 0 to Len do - PLNames[I] := Playlists[I].Name; -end; - -//---------- -//GetIndexbySongID - Returns Index in the specified Playlist of the given Song -//---------- -Function TPlayListManager.GetIndexbySongID(const SongID: Cardinal; const iPlaylist: Integer): Integer; -var - P: Integer; - I: Integer; -begin - if iPlaylist = -1 then - P := CurPlaylist - else if (iPlaylist >= 0) AND (iPlaylist <= high(Playlists)) then - P := iPlaylist - else - exit; - - Result := -1; - - For I := 0 to high(Playlists[P].Items) do - begin - if (Playlists[P].Items[I].SongID = SongID) then - begin - Result := I; - Break; - end; - end; -end; - -end. +unit UPlaylist; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +type + TPlaylistItem = record + Artist: String; + Title: String; + SongID: Integer; + end; + + APlaylistItem = array of TPlaylistItem; + + TPlaylist = record + Name: String; + Filename: String; + Items: APlaylistItem; + end; + + APlaylist = array of TPlaylist; + + //---------- + //TPlaylistManager - Class for Managing Playlists (Loading, Displaying, Saving) + //---------- + TPlaylistManager = class + private + + public + Mode: Byte; //Current Playlist Mode for SongScreen + CurPlayList: Cardinal; + CurItem: Cardinal; + + Playlists: APlaylist; + + constructor Create; + Procedure LoadPlayLists; + Function LoadPlayList(Index: Cardinal; Filename: String): Boolean; + Procedure SavePlayList(Index: Cardinal); + + Procedure SetPlayList(Index: Cardinal); + + Function AddPlaylist(Name: String): Cardinal; + Procedure DelPlaylist(const Index: Cardinal); + + Procedure AddItem(const SongID: Cardinal; const iPlaylist: Integer = -1); + Procedure DelItem(const iItem: Cardinal; const iPlaylist: Integer = -1); + + Procedure GetNames(var PLNames: array of String); + Function GetIndexbySongID(const SongID: Cardinal; const iPlaylist: Integer = -1): Integer; + end; + + {Modes: + 0: Standard Mode + 1: Category Mode + 2: PlayList Mode} + + var + PlayListMan: TPlaylistManager; + + +implementation + +uses USongs, + ULog, + UMain, + //UFiles, + UGraphic, + UThemes, + SysUtils; + +//---------- +//Create - Construct Class - Dummy for now +//---------- +constructor TPlayListManager.Create; +begin + LoadPlayLists; +end; + +//---------- +//LoadPlayLists - Load list of Playlists from PlayList Folder +//---------- +Procedure TPlayListManager.LoadPlayLists; +var + SR: TSearchRec; + Len: Integer; +begin + SetLength(Playlists, 0); + + if FindFirst(PlayListPath + '*.upl', 0, SR) = 0 then + begin + repeat + Len := Length(Playlists); + SetLength(Playlists, Len +1); + + if not LoadPlayList (Len, Sr.Name) then + SetLength(Playlists, Len); + + until FindNext(SR) <> 0; + FindClose(SR); + end; +end; + +//---------- +//LoadPlayList - Load a Playlist in the Array +//---------- +Function TPlayListManager.LoadPlayList(Index: Cardinal; Filename: String): Boolean; + var + F: TextFile; + Line: String; + PosDelimiter: Integer; + SongID: Integer; + Len: Integer; + + Function FindSong(Artist, Title: String): Integer; + var I: Integer; + begin + Result := -1; + + For I := low(CatSongs.Song) to high(CatSongs.Song) do + begin + if (CatSongs.Song[I].Title = Title) AND (CatSongs.Song[I].Artist = Artist) then + begin + Result := I; + Break; + end; + end; + end; +begin + if not FileExists(PlayListPath + Filename) then + begin + Log.LogError('Could not load Playlist: ' + Filename); + Result := False; + Exit; + end; + Result := True; + + //Load File + AssignFile(F, PlayListPath + FileName); + Reset(F); + + //Set Filename + PlayLists[Index].Filename := Filename; + PlayLists[Index].Name := ''; + + //Read Until End of File + While not Eof(F) do + begin + //Read Curent Line + Readln(F, Line); + + if (Length(Line) > 0) then + begin + PosDelimiter := Pos(':', Line); + if (PosDelimiter <> 0) then + begin + //Comment or Name String + if (Line[1] = '#') then + begin + //Found Name Value + if (Uppercase(Trim(copy(Line, 2, PosDelimiter - 2))) = 'NAME') then + PlayLists[Index].Name := Trim(copy(Line, PosDelimiter + 1,Length(Line) - PosDelimiter)) + + end + //Song Entry + else + begin + SongID := FindSong(Trim(copy(Line, 1, PosDelimiter - 1)), Trim(copy(Line, PosDelimiter + 1, Length(Line) - PosDelimiter))); + if (SongID <> -1) then + begin + Len := Length(PlayLists[Index].Items); + SetLength(PlayLists[Index].Items, Len + 1); + + PlayLists[Index].Items[Len].SongID := SongID; + + PlayLists[Index].Items[Len].Artist := Trim(copy(Line, 1, PosDelimiter - 1)); + PlayLists[Index].Items[Len].Title := Trim(copy(Line, PosDelimiter + 1, Length(Line) - PosDelimiter)); + end + else Log.LogError('Could not find Song in Playlist: ' + PlayLists[Index].Filename + ', ' + Line); + end; + end; + end; + end; + + //If no special name is given, use Filename + if PlayLists[Index].Name = '' then + begin + PlayLists[Index].Name := ChangeFileExt(FileName, ''); + end; + + //Finish (Close File) + CloseFile(F); +end; + +//---------- +//SavePlayList - Saves the specified Playlist +//---------- +Procedure TPlayListManager.SavePlayList(Index: Cardinal); +var + F: TextFile; + I: Integer; +begin + if (Not FileExists(PlaylistPath + Playlists[Index].Filename)) OR (Not FileisReadOnly(PlaylistPath + Playlists[Index].Filename)) then + begin + + //open File for Rewriting + AssignFile(F, PlaylistPath + Playlists[Index].Filename); + try + try + Rewrite(F); + + //Write Version (not nessecary but helpful) + WriteLn(F, '######################################'); + WriteLn(F, '#Ultrastar Deluxe Playlist Format v1.0'); + WriteLn(F, '#Playlist "' + Playlists[Index].Name + '" with ' + InttoStr(Length(Playlists[Index].Items)) + ' Songs.'); + WriteLn(F, '######################################'); + + //Write Name Information + WriteLn(F, '#Name: ' + Playlists[Index].Name); + + //Write Song Information + WriteLn(F, '#Songs:'); + + For I := 0 to high(Playlists[Index].Items) do + begin + WriteLn(F, Playlists[Index].Items[I].Artist + ' : ' + Playlists[Index].Items[I].Title); + end; + except + log.LogError('Could not write Playlistfile "' + Playlists[Index].Name + '"'); + end; + finally + CloseFile(F); + end; + end; +end; + +//---------- +//SetPlayList - Display a Playlist in CatSongs +//---------- +Procedure TPlayListManager.SetPlayList(Index: Cardinal); +var + I: Integer; +begin + If (Index > High(PlayLists)) then + exit; + + //Hide all Songs + For I := 0 to high(CatSongs.Song) do + CatSongs.Song[I].Visible := False; + + //Show Songs in PL + For I := 0 to high(PlayLists[Index].Items) do + begin + CatSongs.Song[PlayLists[Index].Items[I].SongID].Visible := True; + end; + + //Set CatSongsMode + Playlist Mode + CatSongs.CatNumShow := -3; + Mode := 2; + + //Set CurPlaylist + CurPlaylist := Index; + + //Show Cat in Topleft: + ScreenSong.ShowCatTLCustom(Format(Theme.Playlist.CatText,[Playlists[Index].Name])); + + //Fix SongSelection + ScreenSong.Interaction := 0; + ScreenSong.SelectNext; + ScreenSong.FixSelected; + + //Play correct Music + ScreenSong.ChangeMusic; +end; + +//---------- +//AddPlaylist - Adds a Playlist and Returns the Index +//---------- +Function TPlayListManager.AddPlaylist(Name: String): Cardinal; +var I: Integer; +begin + Result := Length(Playlists); + SetLength(Playlists, Result + 1); + + Playlists[Result].Name := Name; + + I := 1; + + if (not FileExists(PlaylistPath + Name + '.upl')) then + Playlists[Result].Filename := Name + '.upl' + else + begin + repeat + Inc(I); + until not FileExists(PlaylistPath + Name + InttoStr(I) + '.upl'); + Playlists[Result].Filename := Name + InttoStr(I) + '.upl'; + end; + + //Save new Playlist + SavePlayList(Result); +end; + +//---------- +//DelPlaylist - Deletes a Playlist +//---------- +Procedure TPlayListManager.DelPlaylist(const Index: Cardinal); +var + I: Integer; + Filename: String; +begin + If Index > High(Playlists) then + Exit; + + Filename := PlaylistPath + Playlists[Index].Filename; + + //If not FileExists or File is not Writeable then exit + If (Not FileExists(Filename)) OR (FileisReadOnly(Filename)) then + Exit; + + + //Delete Playlist from FileSystem + if Not DeleteFile(Filename) then + Exit; + + //Delete Playlist from Array + //move all PLs to the Hole + For I := Index to High(Playlists)-1 do + PlayLists[I] := PlayLists[I+1]; + + //Delete last Playlist + SetLength (Playlists, High(Playlists)); + + //If Playlist is Displayed atm + //-> Display Songs + if (CatSongs.CatNumShow = -3) and (Index = CurPlaylist) then + begin + ScreenSong.UnLoadDetailedCover; + ScreenSong.HideCatTL; + CatSongs.SetFilter('', 0); + ScreenSong.Interaction := 0; + ScreenSong.FixSelected; + ScreenSong.ChangeMusic; + end; +end; + +//---------- +//AddItem - Adds an Item to a specific Playlist +//---------- +Procedure TPlayListManager.AddItem(const SongID: Cardinal; const iPlaylist: Integer); +var + P: Cardinal; + Len: Cardinal; +begin + if iPlaylist = -1 then + P := CurPlaylist + else if (iPlaylist >= 0) AND (iPlaylist <= high(Playlists)) then + P := iPlaylist + else + exit; + + if (SongID <= High(CatSongs.Song)) AND (NOT CatSongs.Song[SongID].Main) then + begin + Len := Length(Playlists[P].Items); + SetLength(Playlists[P].Items, Len + 1); + + Playlists[P].Items[Len].SongID := SongID; + Playlists[P].Items[Len].Title := CatSongs.Song[SongID].Title; + Playlists[P].Items[Len].Artist := CatSongs.Song[SongID].Artist; + + //Save Changes + SavePlayList(P); + + //Correct Display when Editing current Playlist + if (CatSongs.CatNumShow = -3) and (P = CurPlaylist) then + SetPlaylist(P); + end; +end; + +//---------- +//DelItem - Deletes an Item from a specific Playlist +//---------- +Procedure TPlayListManager.DelItem(const iItem: Cardinal; const iPlaylist: Integer); +var + I: Integer; + P: Cardinal; +begin + if iPlaylist = -1 then + P := CurPlaylist + else if (iPlaylist >= 0) AND (iPlaylist <= high(Playlists)) then + P := iPlaylist + else + exit; + + if (iItem <= high(Playlists[P].Items)) then + begin + //Move all entrys behind deleted one to Front + For I := iItem to High(Playlists[P].Items) - 1 do + Playlists[P].Items[I] := Playlists[P].Items[I + 1]; + + //Delete Last Entry + SetLength(PlayLists[P].Items, Length(PlayLists[P].Items) - 1); + + //Save Changes + SavePlayList(P); + end; + + //Delete Playlist if Last Song is deleted + if (Length(PlayLists[P].Items) = 0) then + begin + DelPlaylist(P); + end + //Correct Display when Editing current Playlist + else if (CatSongs.CatNumShow = -3) and (P = CurPlaylist) then + SetPlaylist(P); +end; + +//---------- +//GetNames - Writes Playlist Names in a Array +//---------- +Procedure TPlayListManager.GetNames(var PLNames: array of String); +var + I: Integer; + Len: Integer; +begin + Len := High(Playlists); + + if (Length(PLNames) <> Len + 1) then + exit; + + For I := 0 to Len do + PLNames[I] := Playlists[I].Name; +end; + +//---------- +//GetIndexbySongID - Returns Index in the specified Playlist of the given Song +//---------- +Function TPlayListManager.GetIndexbySongID(const SongID: Cardinal; const iPlaylist: Integer): Integer; +var + P: Integer; + I: Integer; +begin + if iPlaylist = -1 then + P := CurPlaylist + else if (iPlaylist >= 0) AND (iPlaylist <= high(Playlists)) then + P := iPlaylist + else + exit; + + Result := -1; + + For I := 0 to high(Playlists[P].Items) do + begin + if (Playlists[P].Items[I].SongID = SongID) then + begin + Result := I; + Break; + end; + end; +end; + +end. diff --git a/Game/Code/Classes/URecord.pas b/Game/Code/Classes/URecord.pas index 8d3fa5f7..87c35cd8 100644 --- a/Game/Code/Classes/URecord.pas +++ b/Game/Code/Classes/URecord.pas @@ -2,6 +2,10 @@ unit URecord; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses Classes, diff --git a/Game/Code/Classes/UServices.pas b/Game/Code/Classes/UServices.pas index 92b61e85..c8761df0 100644 --- a/Game/Code/Classes/UServices.pas +++ b/Game/Code/Classes/UServices.pas @@ -1,321 +1,326 @@ -unit UServices; - -interface - -{$I switches.inc} - -uses uPluginDefs, SysUtils; -{********************* - TServiceManager - Class for saving, managing and calling of Services. - Saves all Services and their Procs -*********************} - -type - TServiceName = String[60]; - PServiceInfo = ^TServiceInfo; - TServiceInfo = record - Self: THandle; //Handle of this Service - Hash: Integer; //4 Bit Hash of the Services Name - Name: TServiceName; //Name of this Service - - Owner: Integer; //If < 0 [-(DLLMan Pluginindex + 1)]; 0 - undefined, On Error Full shutdown, If < 0 [ModuleIndex - 1] - - Next: PServiceInfo; //Pointer to the Next Service in teh list - - //Here is s/t tricky - //To avoid writing of Wrapping Functions to offer a Service from a Class - //We save a Normal Proc or a Method of a Class - Case isClass: boolean of - False: (Proc: TUS_Service); //Proc that will be called on Event - True: (ProcOfClass: TUS_Service_of_Object); - end; - - TServiceManager = class - private - //Managing Service List - FirstService: PServiceInfo; - LastService: PServiceInfo; - - //Some Speed improvement by caching the last 4 called Services - //Most of the time a Service is called multiple times - ServiceCache: Array[0..3] of PServiceInfo; - NextCacheItem: Byte; - - //Next Service added gets this Handle: - NextHandle: THandle; - public - Constructor Create; - - Function AddService(const ServiceName: PChar; const Proc: TUS_Service = nil; const ProcofClass: TUS_Service_of_Object = nil): THandle; - Function DelService(const hService: THandle): integer; - - Function CallService(const ServiceName: PChar; const wParam, lParam: dWord): integer; - - Function NametoHash(const ServiceName: TServiceName): Integer; - Function ServiceExists(const ServiceName: PChar): Integer; - end; - -var - ServiceManager: TServiceManager; - -implementation -uses UCore; - -//------------ -// Create - Creates Class and Set Standard Values -//------------ -Constructor TServiceManager.Create; -begin - FirstService := nil; - LastService := nil; - - ServiceCache[0] := nil; - ServiceCache[1] := nil; - ServiceCache[2] := nil; - ServiceCache[3] := nil; - - NextCacheItem := 0; - - NextHandle := 1; - - {$IFDEF DEBUG} - WriteLn('ServiceManager: Succesful created!'); - {$ENDIF} -end; - -//------------ -// Function Creates a new Service and Returns the Services Handle, -// 0 on Failure. (Name already exists) -//------------ -Function TServiceManager.AddService(const ServiceName: PChar; const Proc: TUS_Service; const ProcofClass: TUS_Service_of_Object): THandle; -var - Cur: PServiceInfo; -begin - Result := 0; - - If (@Proc <> nil) or (@ProcOfClass <> nil) then - begin - If (ServiceExists(ServiceName) = 0) then - begin //There is a Proc and the Service does not already exist - //Ok Add it! - - //Get Memory - GetMem(Cur, SizeOf(TServiceInfo)); - - //Fill it with Data - Cur.Next := nil; - - If (@Proc = nil) then - begin //Use the ProcofClass Method - Cur.isClass := True; - Cur.ProcOfClass := ProcofClass; - end - else //Use the normal Proc - begin - Cur.isClass := False; - Cur.Proc := Proc; - end; - - Cur.Self := NextHandle; - //Zero Name - Cur.Name := #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0; - Cur.Name := String(ServiceName); - Cur.Hash := NametoHash(Cur.Name); - - //Add Owner to Service - Cur.Owner := Core.CurExecuted; - - //Add Service to the List - If (FirstService = nil) then - FirstService := Cur; - - If (LastService <> nil) then - LastService.Next := Cur; - - LastService := Cur; - - {$IFDEF DEBUG} - WriteLn('ServiceManager: Service added: ''' + ServiceName + ''', Handle: ' + InttoStr(Cur.Self)); - {$ENDIF} - - //Inc Next Handle - Inc(NextHandle); - end - {$IFDEF DEBUG} - else WriteLn('ServiceManager: Try to readd Service: ' + ServiceName); - {$ENDIF} - end; -end; - -//------------ -// Function Destroys a Service, 0 on success, not 0 on Failure -//------------ -Function TServiceManager.DelService(const hService: THandle): integer; -var - Last, Cur: PServiceInfo; - I: Integer; -begin - Result := -1; - - Last := nil; - Cur := FirstService; - - //Search for Service to Delete - While (Cur <> nil) do - begin - If (Cur.Self = hService) then - begin //Found Service => Delete it - - //Delete from List - If (Last = nil) then //Found first Service - FirstService := Cur.Next - Else //Service behind the first - Last.Next := Cur.Next; - - //IF this is the LastService, correct LastService - If (Cur = LastService) then - LastService := Last; - - //Search for Service in Cache and delete it if found - For I := 0 to High(ServiceCache) do - If (ServiceCache[I] = Cur) then - begin - ServiceCache[I] := nil; - end; - - {$IFDEF DEBUG} - WriteLn('ServiceManager: Removed Service succesful: ' + Cur.Name); - {$ENDIF} - - //Free Memory - Freemem(Cur, SizeOf(TServiceInfo)); - - //Break the Loop - Break; - end; - - //Go to Next Service - Last := Cur; - Cur := Cur.Next; - end; -end; - -//------------ -// Function Calls a Services Proc -// Returns Services Return Value or SERVICE_NOT_FOUND on Failure -//------------ -Function TServiceManager.CallService(const ServiceName: PChar; const wParam, lParam: dWord): integer; -var - SExists: Integer; - Service: PServiceInfo; - CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute -begin - Result := SERVICE_NOT_FOUND; - SExists := ServiceExists(ServiceName); - If (SExists <> 0) then - begin - //Backup CurExecuted - CurExecutedBackup := Core.CurExecuted; - - Service := Pointer(SExists); - - If (Service.isClass) then - //Use Proc of Class - Result := Service.ProcOfClass(wParam, lParam) - Else - //Use normal Proc - Result := Service.Proc(wParam, lParam); - - //Restore CurExecuted - Core.CurExecuted := CurExecutedBackup; - end; - - {$IFDEF DEBUG} - WriteLn('ServiceManager: Service ''' + ServiceName + ''' called. Result: ' + InttoStr(Result)); - {$ENDIF} -end; - -//------------ -// Generates the Hash for the given Name -//------------ -Function TServiceManager.NametoHash(const ServiceName: TServiceName): Integer; -asm - { CL: Counter; EAX: Result; EDX: Current Memory Address } - Mov CL, 14 {Init Counter, Fold 14 Times to became 4 Bytes out of 60} - - Mov EDX, ServiceName {Save Address of String that should be "Hashed"} - - Mov EAX, [EDX] - - @FoldLoop: ADD EDX, 4 {jump 4 Byte(32 Bit) to the next tile } - ADD EAX, [EDX] {Add the Value of the next 4 Byte of the String to the Hash} - - LOOP @FoldLoop {Fold again if there are Chars Left} -end; - - -//------------ -// Function Returns Non Zero if a Service with the given Name Exists, otherwise 0 -//------------ -Function TServiceManager.ServiceExists(const ServiceName: PChar): Integer; -var - Name: TServiceName; - Hash: Integer; - Cur: PServiceInfo; - I: Byte; -begin - Result := 0; - // to-do : Write a Metbod (in ASM) to Zero and Add in one turn (faster then this dirty hack ;) - //Zero Name: - Name := #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0; - //Add Service Name - Name := String(ServiceName); - Hash := NametoHash(Name); - - //First of all Look for the Service in Cache - For I := 0 to High(ServiceCache) do - begin - If (ServiceCache[I] <> nil) AND (ServiceCache[I].Hash = Hash) then - begin - If (ServiceCache[I].Name = Name) then - begin //Found Service in Cache - Result := Integer(ServiceCache[I]); - - {$IFDEF DEBUG} - WriteLn('ServiceManager: Found Service in Cache: ''' + ServiceName + ''''); - {$ENDIF} - - Break; - end; - end; - end; - - If (Result = 0) then - begin - Cur := FirstService; - While (Cur <> nil) do - begin - If (Cur.Hash = Hash) then - begin - If (Cur.Name = Name) then - begin //Found the Service - Result := Integer(Cur); - - {$IFDEF DEBUG} - WriteLn('ServiceManager: Found Service in List: ''' + ServiceName + ''''); - {$ENDIF} - - //Add to Cache - ServiceCache[NextCacheItem] := Cur; - NextCacheItem := (NextCacheItem + 1) AND 3; - Break; - end; - end; - - Cur := Cur.Next; - end; - end; -end; - -end. \ No newline at end of file +unit UServices; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses uPluginDefs, + SysUtils; +{********************* + TServiceManager + Class for saving, managing and calling of Services. + Saves all Services and their Procs +*********************} + +type + TServiceName = String[60]; + PServiceInfo = ^TServiceInfo; + TServiceInfo = record + Self: THandle; //Handle of this Service + Hash: Integer; //4 Bit Hash of the Services Name + Name: TServiceName; //Name of this Service + + Owner: Integer; //If < 0 [-(DLLMan Pluginindex + 1)]; 0 - undefined, On Error Full shutdown, If < 0 [ModuleIndex - 1] + + Next: PServiceInfo; //Pointer to the Next Service in teh list + + //Here is s/t tricky + //To avoid writing of Wrapping Functions to offer a Service from a Class + //We save a Normal Proc or a Method of a Class + Case isClass: boolean of + False: (Proc: TUS_Service); //Proc that will be called on Event + True: (ProcOfClass: TUS_Service_of_Object); + end; + + TServiceManager = class + private + //Managing Service List + FirstService: PServiceInfo; + LastService: PServiceInfo; + + //Some Speed improvement by caching the last 4 called Services + //Most of the time a Service is called multiple times + ServiceCache: Array[0..3] of PServiceInfo; + NextCacheItem: Byte; + + //Next Service added gets this Handle: + NextHandle: THandle; + public + Constructor Create; + + Function AddService(const ServiceName: PChar; const Proc: TUS_Service = nil; const ProcofClass: TUS_Service_of_Object = nil): THandle; + Function DelService(const hService: THandle): integer; + + Function CallService(const ServiceName: PChar; const wParam, lParam: dWord): integer; + + Function NametoHash(const ServiceName: TServiceName): Integer; + Function ServiceExists(const ServiceName: PChar): Integer; + end; + +var + ServiceManager: TServiceManager; + +implementation +uses UCore; + +//------------ +// Create - Creates Class and Set Standard Values +//------------ +Constructor TServiceManager.Create; +begin + FirstService := nil; + LastService := nil; + + ServiceCache[0] := nil; + ServiceCache[1] := nil; + ServiceCache[2] := nil; + ServiceCache[3] := nil; + + NextCacheItem := 0; + + NextHandle := 1; + + {$IFDEF DEBUG} + WriteLn('ServiceManager: Succesful created!'); + {$ENDIF} +end; + +//------------ +// Function Creates a new Service and Returns the Services Handle, +// 0 on Failure. (Name already exists) +//------------ +Function TServiceManager.AddService(const ServiceName: PChar; const Proc: TUS_Service; const ProcofClass: TUS_Service_of_Object): THandle; +var + Cur: PServiceInfo; +begin + Result := 0; + + If (@Proc <> nil) or (@ProcOfClass <> nil) then + begin + If (ServiceExists(ServiceName) = 0) then + begin //There is a Proc and the Service does not already exist + //Ok Add it! + + //Get Memory + GetMem(Cur, SizeOf(TServiceInfo)); + + //Fill it with Data + Cur.Next := nil; + + If (@Proc = nil) then + begin //Use the ProcofClass Method + Cur.isClass := True; + Cur.ProcOfClass := ProcofClass; + end + else //Use the normal Proc + begin + Cur.isClass := False; + Cur.Proc := Proc; + end; + + Cur.Self := NextHandle; + //Zero Name + Cur.Name := #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0; + Cur.Name := String(ServiceName); + Cur.Hash := NametoHash(Cur.Name); + + //Add Owner to Service + Cur.Owner := Core.CurExecuted; + + //Add Service to the List + If (FirstService = nil) then + FirstService := Cur; + + If (LastService <> nil) then + LastService.Next := Cur; + + LastService := Cur; + + {$IFDEF DEBUG} + WriteLn('ServiceManager: Service added: ''' + ServiceName + ''', Handle: ' + InttoStr(Cur.Self)); + {$ENDIF} + + //Inc Next Handle + Inc(NextHandle); + end + {$IFDEF DEBUG} + else WriteLn('ServiceManager: Try to readd Service: ' + ServiceName); + {$ENDIF} + end; +end; + +//------------ +// Function Destroys a Service, 0 on success, not 0 on Failure +//------------ +Function TServiceManager.DelService(const hService: THandle): integer; +var + Last, Cur: PServiceInfo; + I: Integer; +begin + Result := -1; + + Last := nil; + Cur := FirstService; + + //Search for Service to Delete + While (Cur <> nil) do + begin + If (Cur.Self = hService) then + begin //Found Service => Delete it + + //Delete from List + If (Last = nil) then //Found first Service + FirstService := Cur.Next + Else //Service behind the first + Last.Next := Cur.Next; + + //IF this is the LastService, correct LastService + If (Cur = LastService) then + LastService := Last; + + //Search for Service in Cache and delete it if found + For I := 0 to High(ServiceCache) do + If (ServiceCache[I] = Cur) then + begin + ServiceCache[I] := nil; + end; + + {$IFDEF DEBUG} + WriteLn('ServiceManager: Removed Service succesful: ' + Cur.Name); + {$ENDIF} + + //Free Memory + Freemem(Cur, SizeOf(TServiceInfo)); + + //Break the Loop + Break; + end; + + //Go to Next Service + Last := Cur; + Cur := Cur.Next; + end; +end; + +//------------ +// Function Calls a Services Proc +// Returns Services Return Value or SERVICE_NOT_FOUND on Failure +//------------ +Function TServiceManager.CallService(const ServiceName: PChar; const wParam, lParam: dWord): integer; +var + SExists: Integer; + Service: PServiceInfo; + CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute +begin + Result := SERVICE_NOT_FOUND; + SExists := ServiceExists(ServiceName); + If (SExists <> 0) then + begin + //Backup CurExecuted + CurExecutedBackup := Core.CurExecuted; + + Service := Pointer(SExists); + + If (Service.isClass) then + //Use Proc of Class + Result := Service.ProcOfClass(wParam, lParam) + Else + //Use normal Proc + Result := Service.Proc(wParam, lParam); + + //Restore CurExecuted + Core.CurExecuted := CurExecutedBackup; + end; + + {$IFDEF DEBUG} + WriteLn('ServiceManager: Service ''' + ServiceName + ''' called. Result: ' + InttoStr(Result)); + {$ENDIF} +end; + +//------------ +// Generates the Hash for the given Name +//------------ +Function TServiceManager.NametoHash(const ServiceName: TServiceName): Integer; +asm + { CL: Counter; EAX: Result; EDX: Current Memory Address } + Mov CL, 14 {Init Counter, Fold 14 Times to became 4 Bytes out of 60} + + Mov EDX, ServiceName {Save Address of String that should be "Hashed"} + + Mov EAX, [EDX] + + @FoldLoop: ADD EDX, 4 {jump 4 Byte(32 Bit) to the next tile } + ADD EAX, [EDX] {Add the Value of the next 4 Byte of the String to the Hash} + + LOOP @FoldLoop {Fold again if there are Chars Left} +end; + + +//------------ +// Function Returns Non Zero if a Service with the given Name Exists, otherwise 0 +//------------ +Function TServiceManager.ServiceExists(const ServiceName: PChar): Integer; +var + Name: TServiceName; + Hash: Integer; + Cur: PServiceInfo; + I: Byte; +begin + Result := 0; + // to-do : Write a Metbod (in ASM) to Zero and Add in one turn (faster then this dirty hack ;) + //Zero Name: + Name := #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0; + //Add Service Name + Name := String(ServiceName); + Hash := NametoHash(Name); + + //First of all Look for the Service in Cache + For I := 0 to High(ServiceCache) do + begin + If (ServiceCache[I] <> nil) AND (ServiceCache[I].Hash = Hash) then + begin + If (ServiceCache[I].Name = Name) then + begin //Found Service in Cache + Result := Integer(ServiceCache[I]); + + {$IFDEF DEBUG} + WriteLn('ServiceManager: Found Service in Cache: ''' + ServiceName + ''''); + {$ENDIF} + + Break; + end; + end; + end; + + If (Result = 0) then + begin + Cur := FirstService; + While (Cur <> nil) do + begin + If (Cur.Hash = Hash) then + begin + If (Cur.Name = Name) then + begin //Found the Service + Result := Integer(Cur); + + {$IFDEF DEBUG} + WriteLn('ServiceManager: Found Service in List: ''' + ServiceName + ''''); + {$ENDIF} + + //Add to Cache + ServiceCache[NextCacheItem] := Cur; + NextCacheItem := (NextCacheItem + 1) AND 3; + Break; + end; + end; + + Cur := Cur.Next; + end; + end; +end; + +end. diff --git a/Game/Code/Classes/USingScores.pas b/Game/Code/Classes/USingScores.pas index d5256dc9..c7213180 100644 --- a/Game/Code/Classes/USingScores.pas +++ b/Game/Code/Classes/USingScores.pas @@ -1,986 +1,990 @@ -unit USingScores; - -interface - -{$I switches.inc} - -uses UThemes, - OpenGl12, - UTexture; - -////////////////////////////////////////////////////////////// -// ATTENTION: // -// Enabled Flag does not Work atm. This should cause Popups // -// Not to Move and Scores to stay until Renenabling. // -// To use e.g. in Pause Mode // -// Also InVisible Flag causes Attributes not to change. // -// This should be fixed after next Draw when Visible = True,// -// but not testet yet // -////////////////////////////////////////////////////////////// - -//Some Constances containing Options that could change by time -const - MaxPlayers = 6; //Maximum of Players that could be added - MaxPositions = 6; //Maximum of Score Positions that could be added - -type - //----------- - // TScorePlayer - Record Containing Information about a Players Score - //----------- - TScorePlayer = record - Position: Byte; //Index of the Position where the Player should be Drawn - Enabled: Boolean; //Is the Score Display Enabled - Visible: Boolean; //Is the Score Display Visible - Score: Word; //Current Score of the Player - ScoreDisplayed: Word; //Score cur. Displayed(for counting up) - ScoreBG: TTexture;//Texture of the Players Scores BG - Color: TRGB; //Teh Players Color - RBPos: Real; //Cur. Percentille of the Rating Bar - RBTarget: Real; //Target Position of Rating Bar - RBVisible:Boolean; //Is Rating bar Drawn - end; - aScorePlayer = array[0..MaxPlayers-1] of TScorePlayer; - - //----------- - // TScorePosition - Record Containing Information about a Score Position, that can be used - //----------- - PScorePosition = ^TScorePosition; - TScorePosition = record - //The Position is Used for Which Playercount - PlayerCount: Byte; - // 1 - One Player per Screen - // 2 - 2 Players per Screen - // 4 - 3 Players per Screen - // 6 would be 2 and 3 Players per Screen - - BGX: Real; //X Position of the Score BG - BGY: Real; //Y Position of the Score BG - BGW: Real; //Width of the Score BG - BGH: Real; //Height of the Score BG - - RBX: Real; //X Position of the Rating Bar - RBY: Real; //Y Position of the Rating Bar - RBW: Real; //Width of the Rating Bar - RBH: Real; //Height of the Rating Bar - - TextX: Real; //X Position of the Score Text - TextY: Real; //Y Position of the Score Text - TextFont: Byte; //Font of the Score Text - TextSize: Byte; //Size of the Score Text - - PUW: Real; //Width of the LineBonus Popup - PUH: Real; //Height of the LineBonus Popup - PUFont: Byte; //Font for the PopUps - PUFontSize: Byte; //FontSize for the PopUps - PUStartX: Real; //X Start Position of the LineBonus Popup - PUStartY: Real; //Y Start Position of the LineBonus Popup - PUTargetX: Real; //X Target Position of the LineBonus Popup - PUTargetY: Real; //Y Target Position of the LineBonus Popup - end; - aScorePosition = array[0..MaxPositions-1] of TScorePosition; - - //----------- - // TScorePopUp - Record Containing Information about a LineBonus Popup - // List, Next Item is Saved in Next attribute - //----------- - PScorePopUp = ^TScorePopUp; - TScorePopUp = record - Player: Byte; //Index of the PopUps Player - TimeStamp: Cardinal; //Timestamp of Popups Spawn - Rating: Byte; //0 to 8, Type of Rating (Cool, bad, etc.) - ScoreGiven:Word; //Score that has already been given to the Player - ScoreDiff: Word; //Difference Between Cur Score at Spawn and Old Score - Next: PScorePopUp; //Next Item in List - end; - aScorePopUp = array of TScorePopUp; - - //----------- - // TSingScores - Class containing Scores Positions and Drawing Scores, Rating Bar + Popups - //----------- - TSingScores = class - private - Positions: aScorePosition; - aPlayers: aScorePlayer; - oPositionCount: Byte; - oPlayerCount: Byte; - - //Saves the First and Last Popup of the List - FirstPopUp: PScorePopUp; - LastPopUp: PScorePopUp; - - //Procedure Draws a Popup by Pointer - Procedure DrawPopUp(const PopUp: PScorePopUp); - - //Procedure Draws a Score by Playerindex - Procedure DrawScore(const Index: Integer); - - //Procedure Draws the RatingBar by Playerindex - Procedure DrawRatingBar(const Index: Integer); - - //Procedure Removes a PopUp w/o destroying the List - Procedure KillPopUp(const last, cur: PScorePopUp); - public - Settings: record //Record containing some Displaying Options - Phase1Time: Real; //time for Phase 1 to complete (in msecs) - //The Plop Up of the PopUp - Phase2Time: Real; //time for Phase 2 to complete (in msecs) - //The Moving (mainly Upwards) of the Popup - Phase3Time: Real; //time for Phase 3 to complete (in msecs) - //The Fade out and Score adding - - PopUpTex: Array [0..8] of TTexture; //Textures for every Popup Rating - - RatingBar_BG_Tex: TTexture; //Rating Bar Texs - RatingBar_FG_Tex: TTexture; - RatingBar_Bar_Tex: TTexture; - - end; - - Visible: Boolean; //Visibility of all Scores - Enabled: Boolean; //Scores are changed, PopUps are Moved etc. - RBVisible: Boolean; //Visibility of all Rating Bars - - //Propertys for Reading Position and Playercount - Property PositionCount: Byte read oPositionCount; - Property PlayerCount: Byte read oPlayerCount; - Property Players: aScorePlayer read aPlayers; - - //Constructor just sets some standard Settings - Constructor Create; - - //Procedure Adds a Position to Array and Increases Position Count - Procedure AddPosition(const pPosition: PScorePosition); - - //Procedure Adds a Player to Array and Increases Player Count - Procedure AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: Word = 0; const Enabled: Boolean = True; const Visible: Boolean = True); - - //Change a Players Visibility, Enable - Procedure ChangePlayerVisibility(const Index: Byte; const pVisible: Boolean); - Procedure ChangePlayerEnabled(const Index: Byte; const pEnabled: Boolean); - - //Procedure Deletes all Player Information - Procedure ClearPlayers; - - //Procedure Deletes Positions and Playerinformation - Procedure Clear; - - //Procedure Loads some Settings and the Positions from Theme - Procedure LoadfromTheme; - - //Procedure has to be called after Positions and Players have been added, before first call of Draw - //It gives every Player a Score Position - Procedure Init; - - //Spawns a new Line Bonus PopUp for the Player - Procedure SpawnPopUp(const PlayerIndex: Byte; const Rating: Byte; const Score: Word); - - //Removes all PopUps from Mem - Procedure KillAllPopUps; - - //Procedure Draws Scores and Linebonus PopUps - Procedure Draw; - end; - - -implementation - -uses SDL, - SysUtils, - ULog, - UGraphic, - TextGL; - -//----------- -//Constructor just sets some standard Settings -//----------- -Constructor TSingScores.Create; -begin - //Clear PopupList Pointers - FirstPopUp := nil; - LastPopUp := nil; - - //Clear Variables - Visible := True; - Enabled := True; - RBVisible := True; - - //Clear Position Index - oPositionCount := 0; - oPlayerCount := 0; - - Settings.Phase1Time := 1000; - Settings.Phase2Time := 2000; - Settings.Phase3Time := 2000; - - Settings.PopUpTex[0].TexNum := High(gluInt); - Settings.PopUpTex[1].TexNum := High(gluInt); - Settings.PopUpTex[2].TexNum := High(gluInt); - Settings.PopUpTex[3].TexNum := High(gluInt); - Settings.PopUpTex[4].TexNum := High(gluInt); - Settings.PopUpTex[5].TexNum := High(gluInt); - Settings.PopUpTex[6].TexNum := High(gluInt); - Settings.PopUpTex[7].TexNum := High(gluInt); - Settings.PopUpTex[8].TexNum := High(gluInt); - - Settings.RatingBar_BG_Tex.TexNum := High(gluInt); - Settings.RatingBar_FG_Tex.TexNum := High(gluInt); - Settings.RatingBar_Bar_Tex.TexNum := High(gluInt); -end; - -//----------- -//Procedure Adds a Position to Array and Increases Position Count -//----------- -Procedure TSingScores.AddPosition(const pPosition: PScorePosition); -begin - if (PositionCount < MaxPositions) then - begin - Positions[PositionCount] := pPosition^; - - Inc(oPositionCount); - end; -end; - -//----------- -//Procedure Adds a Player to Array and Increases Player Count -//----------- -Procedure TSingScores.AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: Word; const Enabled: Boolean; const Visible: Boolean); -begin - if (PlayerCount < MaxPlayers) then - begin - aPlayers[PlayerCount].Position := High(byte); - aPlayers[PlayerCount].Enabled := Enabled; - aPlayers[PlayerCount].Visible := Visible; - aPlayers[PlayerCount].Score := Score; - aPlayers[PlayerCount].ScoreDisplayed := Score; - aPlayers[PlayerCount].ScoreBG := ScoreBG; - aPlayers[PlayerCount].Color := Color; - aPlayers[PlayerCount].RBPos := 0.5; - aPlayers[PlayerCount].RBTarget := 0.5; - aPlayers[PlayerCount].RBVisible := True; - - Inc(oPlayerCount); - end; -end; - -//----------- -//Change a Players Visibility -//----------- -Procedure TSingScores.ChangePlayerVisibility(const Index: Byte; const pVisible: Boolean); -begin - if (Index < MaxPlayers) then - aPlayers[Index].Visible := pVisible; -end; - -//----------- -//Change Player Enabled -//----------- -Procedure TSingScores.ChangePlayerEnabled(const Index: Byte; const pEnabled: Boolean); -begin - if (Index < MaxPlayers) then - aPlayers[Index].Enabled := pEnabled; -end; - -//----------- -//Procedure Deletes all Player Information -//----------- -Procedure TSingScores.ClearPlayers; -begin - KillAllPopUps; - oPlayerCount := 0; -end; - -//----------- -//Procedure Deletes Positions and Playerinformation -//----------- -Procedure TSingScores.Clear; -begin - KillAllPopUps; - oPlayerCount := 0; - oPositionCount := 0; -end; - -//----------- -//Procedure Loads some Settings and the Positions from Theme -//----------- -Procedure TSingScores.LoadfromTheme; -var I: Integer; - Procedure AddbyStatics(const PC: Byte; const ScoreStatic, SingBarStatic: TThemeStatic; ScoreText: TThemeText); - var nPosition: TScorePosition; - begin - nPosition.PlayerCount := PC; //Only for one Player Playing - - nPosition.BGX := ScoreStatic.X; - nPosition.BGY := ScoreStatic.Y; - nPosition.BGW := ScoreStatic.W; - nPosition.BGH := ScoreStatic.H; - - nPosition.TextX := ScoreText.X; - nPosition.TextY := ScoreText.Y; - nPosition.TextFont := ScoreText.Font; - nPosition.TextSize := ScoreText.Size; - - nPosition.RBX := SingBarStatic.X; - nPosition.RBY := SingBarStatic.Y; - nPosition.RBW := SingBarStatic.W; - nPosition.RBH := SingBarStatic.H; - - nPosition.PUW := nPosition.BGW; - nPosition.PUH := nPosition.BGH; - - nPosition.PUFont := 2; - nPosition.PUFontSize := 6; - - nPosition.PUStartX := nPosition.BGX; - nPosition.PUStartY := nPosition.TextY + 65; - - nPosition.PUTargetX := nPosition.BGX; - nPosition.PUTargetY := nPosition.TextY; - - AddPosition(@nPosition); - end; -begin - Clear; - - //Set Textures - //Popup Tex - For I := 0 to 8 do - Settings.PopUpTex[I] := Tex_SingLineBonusBack[I]; - - //Rating Bar Tex - Settings.RatingBar_BG_Tex := Tex_SingBar_Back; - Settings.RatingBar_FG_Tex := Tex_SingBar_Front; - Settings.RatingBar_Bar_Tex := Tex_SingBar_Bar; - - //Load Positions from Theme - - // Player1: - AddByStatics(1, Theme.Sing.StaticP1ScoreBG, Theme.Sing.StaticP1SingBar, Theme.Sing.TextP1Score); - AddByStatics(2, Theme.Sing.StaticP1TwoPScoreBG, Theme.Sing.StaticP1TwoPSingBar, Theme.Sing.TextP1TwoPScore); - AddByStatics(4, Theme.Sing.StaticP1ThreePScoreBG, Theme.Sing.StaticP1ThreePSingBar, Theme.Sing.TextP1ThreePScore); - - // Player2: - AddByStatics(2, Theme.Sing.StaticP2RScoreBG, Theme.Sing.StaticP2RSingBar, Theme.Sing.TextP2RScore); - AddByStatics(4, Theme.Sing.StaticP2MScoreBG, Theme.Sing.StaticP2MSingBar, Theme.Sing.TextP2MScore); - - // Player3: - AddByStatics(4, Theme.Sing.StaticP3RScoreBG, Theme.Sing.StaticP3RScoreBG, Theme.Sing.TextP3RScore); -end; - -//----------- -//Spawns a new Line Bonus PopUp for the Player -//----------- -Procedure TSingScores.SpawnPopUp(const PlayerIndex: Byte; const Rating: Byte; const Score: Word); -var Cur: PScorePopUp; -begin - if (PlayerIndex < PlayerCount) then - begin - //Get Memory and Add Data - GetMem(Cur, SizeOf(TScorePopUp)); - - Cur.Player := PlayerIndex; - Cur.TimeStamp := SDL_GetTicks; - Cur.Rating := Rating; - Cur.ScoreGiven:= 0; - If (Players[PlayerIndex].Score < Score) then - begin - Cur.ScoreDiff := Score - Players[PlayerIndex].Score; - aPlayers[PlayerIndex].Score := Score; - end - else - Cur.ScoreDiff := 0; - Cur.Next := nil; - - //Log.LogError('TSingScores.SpawnPopUp| Player: ' + InttoStr(PlayerIndex) + ', Score: ' + InttoStr(Score) + ', ScoreDiff: ' + InttoStr(Cur.ScoreDiff)); - - //Add it to the Chain - if (FirstPopUp = nil) then - //the first PopUp in the List - FirstPopUp := Cur - else - //second or earlier popup - LastPopUp.Next := Cur; - - //Set new Popup to Last PopUp in the List - LastPopUp := Cur; - end - else - Log.LogError('TSingScores: Try to add PopUp for not existing player'); -end; - -//----------- -// Removes a PopUp w/o destroying the List -//----------- -Procedure TSingScores.KillPopUp(const last, cur: PScorePopUp); -var - lTempA , - lTempB : real; -begin - //Give Player the Last Points that missing till now - aPlayers[Cur.Player].ScoreDisplayed := aPlayers[Cur.Player].ScoreDisplayed + Cur.ScoreDiff - Cur.ScoreGiven; - - //Change Bars Position - - // TODO : JB_Lazarus - Exception=Invalid floating point operation - // AT THIS LINE ! - - {$IFDEF LAZARUS} -(* - writeln( 'USINGSCORES-aPlayers[Cur.Player].RBTarget : ' + floattostr( aPlayers[Cur.Player].RBTarget ) ); - writeln( 'USINGSCORES-(Cur.ScoreDiff - Cur.ScoreGiven) : ' + floattostr( (Cur.ScoreDiff - Cur.ScoreGiven) ) ); - writeln( 'USINGSCORES-Cur.ScoreDiff : ' + floattostr( Cur.ScoreDiff ) ); - writeln( 'USINGSCORES-(Cur.Rating / 20 - 0.26) : ' + floattostr( (Cur.Rating / 20 - 0.26) ) ); - writeln( '' ); -*) - {$ENDIF} - - lTempA := ( aPlayers[Cur.Player].RBTarget + (Cur.ScoreDiff - Cur.ScoreGiven) ); - lTempB := ( Cur.ScoreDiff * (Cur.Rating / 20 - 0.26) ); - - {$IFDEF LAZARUS} -(* - writeln( 'USINGSCORES-lTempA : ' + floattostr( lTempA ) ); - writeln( 'USINGSCORES-lTempB : ' + floattostr( lTempB ) ); - writeln( '----------------------------------------------------------' ); -*) - {$ENDIF} - - if ( lTempA > 0 ) AND - ( lTempB > 0 ) THEN - begin - aPlayers[Cur.Player].RBTarget := lTempA / lTempB; - end; - - If (aPlayers[Cur.Player].RBTarget > 1) then - aPlayers[Cur.Player].RBTarget := 1 - else - If (aPlayers[Cur.Player].RBTarget < 0) then - aPlayers[Cur.Player].RBTarget := 0; - - //If this is the First PopUp => Make Next PopUp the First - If (Cur = FirstPopUp) then - FirstPopUp := Cur.Next - //Else => Remove Curent Popup from Chain - else - Last.Next := Cur.Next; - - //If this is the Last PopUp, Make PopUp before the Last - If (Cur = LastPopUp) then - LastPopUp := Last; - - //Free the Memory - FreeMem(Cur, SizeOf(TScorePopUp)); -end; - -//----------- -//Removes all PopUps from Mem -//----------- -Procedure TSingScores.KillAllPopUps; -var - Cur: PScorePopUp; - Last: PScorePopUp; -begin - Cur := FirstPopUp; - - //Remove all PopUps: - While (Cur <> nil) do - begin - Last := Cur; - Cur := Cur.Next; - FreeMem(Last, SizeOf(TScorePopUp)); - end; - - FirstPopUp := nil; - LastPopUp := nil; -end; - -//----------- -//Init - has to be called after Positions and Players have been added, before first call of Draw -//It gives every Player a Score Position -//----------- -Procedure TSingScores.Init; -var - PlC: Array [0..1] of Byte; //Playercount First Screen and Second Screen - I, J: Integer; - MaxPlayersperScreen: Byte; - CurPlayer: Byte; - - Function GetPositionCountbyPlayerCount(bPlayerCount: Byte): Byte; - var I: Integer; - begin - Result := 0; - bPlayerCount := 1 shl (bPlayerCount - 1); - - For I := 0 to PositionCount-1 do - begin - If ((Positions[I].PlayerCount AND bPlayerCount) <> 0) then - Inc(Result); - end; - end; - - Function GetPositionbyPlayernum(bPlayerCount, bPlayer: Byte): Byte; - var I: Integer; - begin - bPlayerCount := 1 shl (bPlayerCount - 1); - Result := High(Byte); - - For I := 0 to PositionCount-1 do - begin - If ((Positions[I].PlayerCount AND bPlayerCount) <> 0) then - begin - If (bPlayer = 0) then - begin - Result := I; - Break; - end - else - Dec(bPlayer); - end; - end; - end; - -begin - - For I := 1 to 6 do - begin - //If there are enough Positions -> Write to MaxPlayers - If (GetPositionCountbyPlayerCount(I) = I) then - MaxPlayersperScreen := I - else - Break; - end; - - - //Split Players to both Screen or Display on One Screen - if (Screens = 2) and (MaxPlayersperScreen < PlayerCount) then - begin - PlC[0] := PlayerCount div 2 + PlayerCount mod 2; - PlC[1] := PlayerCount div 2; - end - else - begin - PlC[0] := PlayerCount; - PlC[1] := 0; - end; - - - //Check if there are enough Positions for all Players - For I := 0 to Screens - 1 do - begin - if (PlC[I] > MaxPlayersperScreen) then - begin - PlC[I] := MaxPlayersperScreen; - Log.LogError('More Players than available Positions, TSingScores'); - end; - end; - - CurPlayer := 0; - //Give every Player a Position - For I := 0 to Screens - 1 do - For J := 0 to PlC[I]-1 do - begin - aPlayers[CurPlayer].Position := GetPositionbyPlayernum(PlC[I], J) OR (I shl 7); - //Log.LogError('Player ' + InttoStr(CurPlayer) + ' gets Position: ' + InttoStr(aPlayers[CurPlayer].Position)); - Inc(CurPlayer); - end; -end; - -//----------- -//Procedure Draws Scores and Linebonus PopUps -//----------- -Procedure TSingScores.Draw; -var - I: Integer; - CurTime: Cardinal; - CurPopUp, LastPopUp: PScorePopUp; -begin - CurTime := SDL_GetTicks; - - If Visible then - begin - //Draw Popups - LastPopUp := nil; - CurPopUp := FirstPopUp; - - While (CurPopUp <> nil) do - begin - if (CurTime - CurPopUp.TimeStamp > Settings.Phase1Time + Settings.Phase2Time + Settings.Phase3Time) then - begin - KillPopUp(LastPopUp, CurPopUp); - if (LastPopUp = nil) then - CurPopUp := FirstPopUp - else - CurPopUp := LastPopUp.Next; - end - else - begin - DrawPopUp(CurPopUp); - LastPopUp := CurPopUp; - CurPopUp := LastPopUp.Next; - end; - end; - - - IF (RBVisible) then - //Draw Players w/ Rating Bar - For I := 0 to PlayerCount-1 do - begin - DrawScore(I); - DrawRatingBar(I); - end - else - //Draw Players w/o Rating Bar - For I := 0 to PlayerCount-1 do - begin - DrawScore(I); - end; - - end; //eo Visible -end; - -//----------- -//Procedure Draws a Popup by Pointer -//----------- -Procedure TSingScores.DrawPopUp(const PopUp: PScorePopUp); -var - Progress: Real; - CurTime: Cardinal; - X, Y, W, H, Alpha: Real; - FontSize: Byte; - TimeDiff: Cardinal; - PIndex: Byte; - TextLen: Real; - ScoretoAdd: Word; - PosDiff: Real; -begin - if (PopUp <> nil) then - begin - //Only Draw if Player has a Position - PIndex := Players[PopUp.Player].Position; - If PIndex <> high(byte) then - begin - //Only Draw if Player is on Cur Screen - If ((Players[PopUp.Player].Position AND 128) = 0) = (ScreenAct = 1) then - begin - CurTime := SDL_GetTicks; - If Not (Enabled AND Players[PopUp.Player].Enabled) then - //Increase Timestamp with TIem where there is no Movement ... - begin - //Inc(PopUp.TimeStamp, LastRender); - end; - TimeDiff := CurTime - PopUp.TimeStamp; - - //Get Position of PopUp - PIndex := PIndex AND 127; - - - //Check for Phase ... - If (TimeDiff <= Settings.Phase1Time) then - begin - //Phase 1 - The Ploping up - Progress := TimeDiff / Settings.Phase1Time; - - - W := Positions[PIndex].PUW * Sin(Progress/2*Pi); - H := Positions[PIndex].PUH * Sin(Progress/2*Pi); - - X := Positions[PIndex].PUStartX + (Positions[PIndex].PUW - W)/2; - Y := Positions[PIndex].PUStartY + (Positions[PIndex].PUH - H)/2; - - FontSize := Round(Progress * Positions[PIndex].PUFontSize); - Alpha := 1; - end - - Else If (TimeDiff <= Settings.Phase2Time + Settings.Phase1Time) then - begin - //Phase 2 - The Moving - Progress := (TimeDiff - Settings.Phase1Time) / Settings.Phase2Time; - - W := Positions[PIndex].PUW; - H := Positions[PIndex].PUH; - - PosDiff := Positions[PIndex].PUTargetX - Positions[PIndex].PUStartX; - If PosDiff > 0 then - PosDiff := PosDiff + W; - X := Positions[PIndex].PUStartX + PosDiff * sqr(Progress); - - PosDiff := Positions[PIndex].PUTargetY - Positions[PIndex].PUStartY; - If PosDiff < 0 then - PosDiff := PosDiff + Positions[PIndex].BGH; - Y := Positions[PIndex].PUStartY + PosDiff * sqr(Progress); - - FontSize := Positions[PIndex].PUFontSize; - Alpha := 1 - 0.3 * Progress; - end - - else - begin - //Phase 3 - The Fading out + Score adding - Progress := (TimeDiff - Settings.Phase1Time - Settings.Phase2Time) / Settings.Phase3Time; - - If (PopUp.Rating > 0) then - begin - //Add Scores if Player Enabled - If (Enabled AND Players[PopUp.Player].Enabled) then - begin - ScoreToAdd := Round(PopUp.ScoreDiff * Progress) - PopUp.ScoreGiven; - Inc(PopUp.ScoreGiven, ScoreToAdd); - aPlayers[PopUp.Player].ScoreDisplayed := Players[PopUp.Player].ScoreDisplayed + ScoreToAdd; - - //Change Bars Position - aPlayers[PopUp.Player].RBTarget := aPlayers[PopUp.Player].RBTarget + ScoreToAdd/PopUp.ScoreDiff * (PopUp.Rating / 20 - 0.26); - If (aPlayers[PopUp.Player].RBTarget > 1) then - aPlayers[PopUp.Player].RBTarget := 1 - else If (aPlayers[PopUp.Player].RBTarget < 0) then - aPlayers[PopUp.Player].RBTarget := 0; - end; - - //Set Positions etc. - Alpha := 0.7 - 0.7 * Progress; - - W := Positions[PIndex].PUW; - H := Positions[PIndex].PUH; - - PosDiff := Positions[PIndex].PUTargetX - Positions[PIndex].PUStartX; - If (PosDiff > 0) then - PosDiff := W - else - PosDiff := 0; - X := Positions[PIndex].PUTargetX + PosDiff * Progress; - - PosDiff := Positions[PIndex].PUTargetY - Positions[PIndex].PUStartY; - If (PosDiff < 0) then - PosDiff := -Positions[PIndex].BGH - else - PosDiff := 0; - Y := Positions[PIndex].PUTargetY - PosDiff * (1-Progress); - - FontSize := Positions[PIndex].PUFontSize; - end - else - begin - //Here the Effect that Should be shown if a PopUp without Score is Drawn - //And or Spawn with the GraphicObjects etc. - //Some Work for Blindy to do :P - - //ATM: Just Let it Slide in the Scores just like the Normal PopUp - Alpha := 0; - end; - end; - - //Draw PopUp - - if (Alpha > 0) AND (Players[PopUp.Player].Visible) then - begin - //Draw BG: - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - glColor4f(1,1,1, Alpha); - glBindTexture(GL_TEXTURE_2D, Settings.PopUpTex[PopUp.Rating].TexNum); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(X, Y); - glTexCoord2f(0, Settings.PopUpTex[PopUp.Rating].TexH); glVertex2f(X, Y + H); - glTexCoord2f(Settings.PopUpTex[PopUp.Rating].TexW, Settings.PopUpTex[PopUp.Rating].TexH); glVertex2f(X + W, Y + H); - glTexCoord2f(Settings.PopUpTex[PopUp.Rating].TexW, 0); glVertex2f(X + W, Y); - glEnd; - - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - //Set FontStyle and Size - SetFontStyle(Positions[PIndex].PUFont); - SetFontItalic(False); - SetFontSize(FontSize); - - //Draw Text - TextLen := glTextWidth(PChar(Theme.Sing.LineBonusText[PopUp.Rating])); - - //Color and Pos - SetFontPos (X + (W - TextLen) / 2, Y + 12); - glColor4f(1, 1, 1, Alpha); - - //Draw - glPrint(PChar(Theme.Sing.LineBonusText[PopUp.Rating])); - end; //eo Alpha check - end; //eo Right Screen - end; //eo Player has Position - end - else - Log.LogError('TSingScores: Try to Draw a not existing PopUp'); -end; - -//----------- -//Procedure Draws a Score by Playerindex -//----------- -Procedure TSingScores.DrawScore(const Index: Integer); -var - Position: PScorePosition; - ScoreStr: String; -begin - //Only Draw if Player has a Position - If Players[Index].Position <> high(byte) then - begin - //Only Draw if Player is on Cur Screen - If (((Players[Index].Position AND 128) = 0) = (ScreenAct = 1)) AND Players[Index].Visible then - begin - Position := @Positions[Players[Index].Position and 127]; - - //Draw ScoreBG - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - glColor4f(1,1,1, 1); - glBindTexture(GL_TEXTURE_2D, Players[Index].ScoreBG.TexNum); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(Position.BGX, Position.BGY); - glTexCoord2f(0, Players[Index].ScoreBG.TexH); glVertex2f(Position.BGX, Position.BGY + Position.BGH); - glTexCoord2f(Players[Index].ScoreBG.TexW, Players[Index].ScoreBG.TexH); glVertex2f(Position.BGX + Position.BGW, Position.BGY + Position.BGH); - glTexCoord2f(Players[Index].ScoreBG.TexW, 0); glVertex2f(Position.BGX + Position.BGW, Position.BGY); - glEnd; - - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - //Draw Score Text - SetFontStyle(Position.TextFont); - SetFontItalic(False); - SetFontSize(Position.TextSize); - SetFontPos(Position.TextX, Position.TextY); - - ScoreStr := InttoStr(Players[Index].ScoreDisplayed div 10) + '0'; - While (Length(ScoreStr) < 5) do - ScoreStr := '0' + ScoreStr; - - glPrint(PChar(ScoreStr)); - - end; //eo Right Screen - end; //eo Player has Position -end; - - -Procedure TSingScores.DrawRatingBar(const Index: Integer); -var - Position: PScorePosition; - R,G,B, Size: Real; - Diff: Real; -begin - //Only Draw if Player has a Position - If Players[Index].Position <> high(byte) then - begin - //Only Draw if Player is on Cur Screen - If ((Players[Index].Position AND 128) = 0) = (ScreenAct = 1) AND (Players[index].RBVisible AND Players[index].Visible) then - begin - Position := @Positions[Players[Index].Position and 127]; - - If (Enabled AND Players[Index].Enabled) then - begin - //Move Position if Enabled - Diff := Players[Index].RBTarget - Players[Index].RBPos; - If(Abs(Diff) < 0.02) then - aPlayers[Index].RBPos := aPlayers[Index].RBTarget - else - aPlayers[Index].RBPos := aPlayers[Index].RBPos + Diff*0.1; - end; - - //Get Colors for RatingBar - If Players[index].RBPos <=0.22 then - begin - R := 1; - G := 0; - B := 0; - end - Else If Players[index].RBPos <=0.42 then - begin - R := 1; - G := Players[index].RBPos*5; - B := 0; - end - Else If Players[index].RBPos <=0.57 then - begin - R := 1; - G := 1; - B := 0; - end - Else If Players[index].RBPos <=0.77 then - begin - R := 1-(Players[index].RBPos-0.57)*5; - G := 1; - B := 0; - end - else - begin - R := 0; - G := 1; - B := 0; - end; - - //Enable all glFuncs Needed - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - //Draw RatingBar BG - glColor4f(1, 1, 1, 0.8); - glBindTexture(GL_TEXTURE_2D, Settings.RatingBar_BG_Tex.TexNum); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(Position.RBX, Position.RBY); - - glTexCoord2f(0, Settings.RatingBar_BG_Tex.TexH); - glVertex2f(Position.RBX, Position.RBY+Position.RBH); - - glTexCoord2f(Settings.RatingBar_BG_Tex.TexW, Settings.RatingBar_BG_Tex.TexH); - glVertex2f(Position.RBX+Position.RBW, Position.RBY+Position.RBH); - - glTexCoord2f(Settings.RatingBar_BG_Tex.TexW, 0); - glVertex2f(Position.RBX+Position.RBW, Position.RBY); - glEnd; - - //Draw Rating bar itself - Size := Position.RBX + Position.RBW * Players[Index].RBPos; - glColor4f(R, G, B, 1); - glBindTexture(GL_TEXTURE_2D, Settings.RatingBar_Bar_Tex.TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(Position.RBX, Position.RBY); - - glTexCoord2f(0, Settings.RatingBar_Bar_Tex.TexH); - glVertex2f(Position.RBX, Position.RBY + Position.RBH); - - glTexCoord2f(Settings.RatingBar_Bar_Tex.TexW, Settings.RatingBar_Bar_Tex.TexH); - glVertex2f(Size, Position.RBY + Position.RBH); - - glTexCoord2f(Settings.RatingBar_Bar_Tex.TexW, 0); - glVertex2f(Size, Position.RBY); - glEnd; - - //Draw Ratingbar FG (Teh thing with the 3 lines to get better readability) - glColor4f(1, 1, 1, 0.6); - glBindTexture(GL_TEXTURE_2D, Settings.RatingBar_FG_Tex.TexNum); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(Position.RBX, Position.RBY); - - glTexCoord2f(0, Settings.RatingBar_FG_Tex.TexH); - glVertex2f(Position.RBX, Position.RBY + Position.RBH); - - glTexCoord2f(Settings.RatingBar_FG_Tex.TexW, Settings.RatingBar_FG_Tex.TexH); - glVertex2f(Position.RBX + Position.RBW, Position.RBY + Position.RBH); - - glTexCoord2f(Settings.RatingBar_FG_Tex.TexW, 0); - glVertex2f(Position.RBX + Position.RBW, Position.RBY); - glEnd; - - //Disable all Enabled glFuncs - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - end; //eo Right Screen - end; //eo Player has Position -end; - -end. +unit USingScores; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses UThemes, + OpenGl12, + UTexture; + +////////////////////////////////////////////////////////////// +// ATTENTION: // +// Enabled Flag does not Work atm. This should cause Popups // +// Not to Move and Scores to stay until Renenabling. // +// To use e.g. in Pause Mode // +// Also InVisible Flag causes Attributes not to change. // +// This should be fixed after next Draw when Visible = True,// +// but not testet yet // +////////////////////////////////////////////////////////////// + +//Some Constances containing Options that could change by time +const + MaxPlayers = 6; //Maximum of Players that could be added + MaxPositions = 6; //Maximum of Score Positions that could be added + +type + //----------- + // TScorePlayer - Record Containing Information about a Players Score + //----------- + TScorePlayer = record + Position: Byte; //Index of the Position where the Player should be Drawn + Enabled: Boolean; //Is the Score Display Enabled + Visible: Boolean; //Is the Score Display Visible + Score: Word; //Current Score of the Player + ScoreDisplayed: Word; //Score cur. Displayed(for counting up) + ScoreBG: TTexture;//Texture of the Players Scores BG + Color: TRGB; //Teh Players Color + RBPos: Real; //Cur. Percentille of the Rating Bar + RBTarget: Real; //Target Position of Rating Bar + RBVisible:Boolean; //Is Rating bar Drawn + end; + aScorePlayer = array[0..MaxPlayers-1] of TScorePlayer; + + //----------- + // TScorePosition - Record Containing Information about a Score Position, that can be used + //----------- + PScorePosition = ^TScorePosition; + TScorePosition = record + //The Position is Used for Which Playercount + PlayerCount: Byte; + // 1 - One Player per Screen + // 2 - 2 Players per Screen + // 4 - 3 Players per Screen + // 6 would be 2 and 3 Players per Screen + + BGX: Real; //X Position of the Score BG + BGY: Real; //Y Position of the Score BG + BGW: Real; //Width of the Score BG + BGH: Real; //Height of the Score BG + + RBX: Real; //X Position of the Rating Bar + RBY: Real; //Y Position of the Rating Bar + RBW: Real; //Width of the Rating Bar + RBH: Real; //Height of the Rating Bar + + TextX: Real; //X Position of the Score Text + TextY: Real; //Y Position of the Score Text + TextFont: Byte; //Font of the Score Text + TextSize: Byte; //Size of the Score Text + + PUW: Real; //Width of the LineBonus Popup + PUH: Real; //Height of the LineBonus Popup + PUFont: Byte; //Font for the PopUps + PUFontSize: Byte; //FontSize for the PopUps + PUStartX: Real; //X Start Position of the LineBonus Popup + PUStartY: Real; //Y Start Position of the LineBonus Popup + PUTargetX: Real; //X Target Position of the LineBonus Popup + PUTargetY: Real; //Y Target Position of the LineBonus Popup + end; + aScorePosition = array[0..MaxPositions-1] of TScorePosition; + + //----------- + // TScorePopUp - Record Containing Information about a LineBonus Popup + // List, Next Item is Saved in Next attribute + //----------- + PScorePopUp = ^TScorePopUp; + TScorePopUp = record + Player: Byte; //Index of the PopUps Player + TimeStamp: Cardinal; //Timestamp of Popups Spawn + Rating: Byte; //0 to 8, Type of Rating (Cool, bad, etc.) + ScoreGiven:Word; //Score that has already been given to the Player + ScoreDiff: Word; //Difference Between Cur Score at Spawn and Old Score + Next: PScorePopUp; //Next Item in List + end; + aScorePopUp = array of TScorePopUp; + + //----------- + // TSingScores - Class containing Scores Positions and Drawing Scores, Rating Bar + Popups + //----------- + TSingScores = class + private + Positions: aScorePosition; + aPlayers: aScorePlayer; + oPositionCount: Byte; + oPlayerCount: Byte; + + //Saves the First and Last Popup of the List + FirstPopUp: PScorePopUp; + LastPopUp: PScorePopUp; + + //Procedure Draws a Popup by Pointer + Procedure DrawPopUp(const PopUp: PScorePopUp); + + //Procedure Draws a Score by Playerindex + Procedure DrawScore(const Index: Integer); + + //Procedure Draws the RatingBar by Playerindex + Procedure DrawRatingBar(const Index: Integer); + + //Procedure Removes a PopUp w/o destroying the List + Procedure KillPopUp(const last, cur: PScorePopUp); + public + Settings: record //Record containing some Displaying Options + Phase1Time: Real; //time for Phase 1 to complete (in msecs) + //The Plop Up of the PopUp + Phase2Time: Real; //time for Phase 2 to complete (in msecs) + //The Moving (mainly Upwards) of the Popup + Phase3Time: Real; //time for Phase 3 to complete (in msecs) + //The Fade out and Score adding + + PopUpTex: Array [0..8] of TTexture; //Textures for every Popup Rating + + RatingBar_BG_Tex: TTexture; //Rating Bar Texs + RatingBar_FG_Tex: TTexture; + RatingBar_Bar_Tex: TTexture; + + end; + + Visible: Boolean; //Visibility of all Scores + Enabled: Boolean; //Scores are changed, PopUps are Moved etc. + RBVisible: Boolean; //Visibility of all Rating Bars + + //Propertys for Reading Position and Playercount + Property PositionCount: Byte read oPositionCount; + Property PlayerCount: Byte read oPlayerCount; + Property Players: aScorePlayer read aPlayers; + + //Constructor just sets some standard Settings + Constructor Create; + + //Procedure Adds a Position to Array and Increases Position Count + Procedure AddPosition(const pPosition: PScorePosition); + + //Procedure Adds a Player to Array and Increases Player Count + Procedure AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: Word = 0; const Enabled: Boolean = True; const Visible: Boolean = True); + + //Change a Players Visibility, Enable + Procedure ChangePlayerVisibility(const Index: Byte; const pVisible: Boolean); + Procedure ChangePlayerEnabled(const Index: Byte; const pEnabled: Boolean); + + //Procedure Deletes all Player Information + Procedure ClearPlayers; + + //Procedure Deletes Positions and Playerinformation + Procedure Clear; + + //Procedure Loads some Settings and the Positions from Theme + Procedure LoadfromTheme; + + //Procedure has to be called after Positions and Players have been added, before first call of Draw + //It gives every Player a Score Position + Procedure Init; + + //Spawns a new Line Bonus PopUp for the Player + Procedure SpawnPopUp(const PlayerIndex: Byte; const Rating: Byte; const Score: Word); + + //Removes all PopUps from Mem + Procedure KillAllPopUps; + + //Procedure Draws Scores and Linebonus PopUps + Procedure Draw; + end; + + +implementation + +uses SDL, + SysUtils, + ULog, + UGraphic, + TextGL; + +//----------- +//Constructor just sets some standard Settings +//----------- +Constructor TSingScores.Create; +begin + //Clear PopupList Pointers + FirstPopUp := nil; + LastPopUp := nil; + + //Clear Variables + Visible := True; + Enabled := True; + RBVisible := True; + + //Clear Position Index + oPositionCount := 0; + oPlayerCount := 0; + + Settings.Phase1Time := 1000; + Settings.Phase2Time := 2000; + Settings.Phase3Time := 2000; + + Settings.PopUpTex[0].TexNum := High(gluInt); + Settings.PopUpTex[1].TexNum := High(gluInt); + Settings.PopUpTex[2].TexNum := High(gluInt); + Settings.PopUpTex[3].TexNum := High(gluInt); + Settings.PopUpTex[4].TexNum := High(gluInt); + Settings.PopUpTex[5].TexNum := High(gluInt); + Settings.PopUpTex[6].TexNum := High(gluInt); + Settings.PopUpTex[7].TexNum := High(gluInt); + Settings.PopUpTex[8].TexNum := High(gluInt); + + Settings.RatingBar_BG_Tex.TexNum := High(gluInt); + Settings.RatingBar_FG_Tex.TexNum := High(gluInt); + Settings.RatingBar_Bar_Tex.TexNum := High(gluInt); +end; + +//----------- +//Procedure Adds a Position to Array and Increases Position Count +//----------- +Procedure TSingScores.AddPosition(const pPosition: PScorePosition); +begin + if (PositionCount < MaxPositions) then + begin + Positions[PositionCount] := pPosition^; + + Inc(oPositionCount); + end; +end; + +//----------- +//Procedure Adds a Player to Array and Increases Player Count +//----------- +Procedure TSingScores.AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: Word; const Enabled: Boolean; const Visible: Boolean); +begin + if (PlayerCount < MaxPlayers) then + begin + aPlayers[PlayerCount].Position := High(byte); + aPlayers[PlayerCount].Enabled := Enabled; + aPlayers[PlayerCount].Visible := Visible; + aPlayers[PlayerCount].Score := Score; + aPlayers[PlayerCount].ScoreDisplayed := Score; + aPlayers[PlayerCount].ScoreBG := ScoreBG; + aPlayers[PlayerCount].Color := Color; + aPlayers[PlayerCount].RBPos := 0.5; + aPlayers[PlayerCount].RBTarget := 0.5; + aPlayers[PlayerCount].RBVisible := True; + + Inc(oPlayerCount); + end; +end; + +//----------- +//Change a Players Visibility +//----------- +Procedure TSingScores.ChangePlayerVisibility(const Index: Byte; const pVisible: Boolean); +begin + if (Index < MaxPlayers) then + aPlayers[Index].Visible := pVisible; +end; + +//----------- +//Change Player Enabled +//----------- +Procedure TSingScores.ChangePlayerEnabled(const Index: Byte; const pEnabled: Boolean); +begin + if (Index < MaxPlayers) then + aPlayers[Index].Enabled := pEnabled; +end; + +//----------- +//Procedure Deletes all Player Information +//----------- +Procedure TSingScores.ClearPlayers; +begin + KillAllPopUps; + oPlayerCount := 0; +end; + +//----------- +//Procedure Deletes Positions and Playerinformation +//----------- +Procedure TSingScores.Clear; +begin + KillAllPopUps; + oPlayerCount := 0; + oPositionCount := 0; +end; + +//----------- +//Procedure Loads some Settings and the Positions from Theme +//----------- +Procedure TSingScores.LoadfromTheme; +var I: Integer; + Procedure AddbyStatics(const PC: Byte; const ScoreStatic, SingBarStatic: TThemeStatic; ScoreText: TThemeText); + var nPosition: TScorePosition; + begin + nPosition.PlayerCount := PC; //Only for one Player Playing + + nPosition.BGX := ScoreStatic.X; + nPosition.BGY := ScoreStatic.Y; + nPosition.BGW := ScoreStatic.W; + nPosition.BGH := ScoreStatic.H; + + nPosition.TextX := ScoreText.X; + nPosition.TextY := ScoreText.Y; + nPosition.TextFont := ScoreText.Font; + nPosition.TextSize := ScoreText.Size; + + nPosition.RBX := SingBarStatic.X; + nPosition.RBY := SingBarStatic.Y; + nPosition.RBW := SingBarStatic.W; + nPosition.RBH := SingBarStatic.H; + + nPosition.PUW := nPosition.BGW; + nPosition.PUH := nPosition.BGH; + + nPosition.PUFont := 2; + nPosition.PUFontSize := 6; + + nPosition.PUStartX := nPosition.BGX; + nPosition.PUStartY := nPosition.TextY + 65; + + nPosition.PUTargetX := nPosition.BGX; + nPosition.PUTargetY := nPosition.TextY; + + AddPosition(@nPosition); + end; +begin + Clear; + + //Set Textures + //Popup Tex + For I := 0 to 8 do + Settings.PopUpTex[I] := Tex_SingLineBonusBack[I]; + + //Rating Bar Tex + Settings.RatingBar_BG_Tex := Tex_SingBar_Back; + Settings.RatingBar_FG_Tex := Tex_SingBar_Front; + Settings.RatingBar_Bar_Tex := Tex_SingBar_Bar; + + //Load Positions from Theme + + // Player1: + AddByStatics(1, Theme.Sing.StaticP1ScoreBG, Theme.Sing.StaticP1SingBar, Theme.Sing.TextP1Score); + AddByStatics(2, Theme.Sing.StaticP1TwoPScoreBG, Theme.Sing.StaticP1TwoPSingBar, Theme.Sing.TextP1TwoPScore); + AddByStatics(4, Theme.Sing.StaticP1ThreePScoreBG, Theme.Sing.StaticP1ThreePSingBar, Theme.Sing.TextP1ThreePScore); + + // Player2: + AddByStatics(2, Theme.Sing.StaticP2RScoreBG, Theme.Sing.StaticP2RSingBar, Theme.Sing.TextP2RScore); + AddByStatics(4, Theme.Sing.StaticP2MScoreBG, Theme.Sing.StaticP2MSingBar, Theme.Sing.TextP2MScore); + + // Player3: + AddByStatics(4, Theme.Sing.StaticP3RScoreBG, Theme.Sing.StaticP3RScoreBG, Theme.Sing.TextP3RScore); +end; + +//----------- +//Spawns a new Line Bonus PopUp for the Player +//----------- +Procedure TSingScores.SpawnPopUp(const PlayerIndex: Byte; const Rating: Byte; const Score: Word); +var Cur: PScorePopUp; +begin + if (PlayerIndex < PlayerCount) then + begin + //Get Memory and Add Data + GetMem(Cur, SizeOf(TScorePopUp)); + + Cur.Player := PlayerIndex; + Cur.TimeStamp := SDL_GetTicks; + Cur.Rating := Rating; + Cur.ScoreGiven:= 0; + If (Players[PlayerIndex].Score < Score) then + begin + Cur.ScoreDiff := Score - Players[PlayerIndex].Score; + aPlayers[PlayerIndex].Score := Score; + end + else + Cur.ScoreDiff := 0; + Cur.Next := nil; + + //Log.LogError('TSingScores.SpawnPopUp| Player: ' + InttoStr(PlayerIndex) + ', Score: ' + InttoStr(Score) + ', ScoreDiff: ' + InttoStr(Cur.ScoreDiff)); + + //Add it to the Chain + if (FirstPopUp = nil) then + //the first PopUp in the List + FirstPopUp := Cur + else + //second or earlier popup + LastPopUp.Next := Cur; + + //Set new Popup to Last PopUp in the List + LastPopUp := Cur; + end + else + Log.LogError('TSingScores: Try to add PopUp for not existing player'); +end; + +//----------- +// Removes a PopUp w/o destroying the List +//----------- +Procedure TSingScores.KillPopUp(const last, cur: PScorePopUp); +var + lTempA , + lTempB : real; +begin + //Give Player the Last Points that missing till now + aPlayers[Cur.Player].ScoreDisplayed := aPlayers[Cur.Player].ScoreDisplayed + Cur.ScoreDiff - Cur.ScoreGiven; + + //Change Bars Position + + // TODO : JB_Lazarus - Exception=Invalid floating point operation + // AT THIS LINE ! + + {$IFDEF LAZARUS} +(* + writeln( 'USINGSCORES-aPlayers[Cur.Player].RBTarget : ' + floattostr( aPlayers[Cur.Player].RBTarget ) ); + writeln( 'USINGSCORES-(Cur.ScoreDiff - Cur.ScoreGiven) : ' + floattostr( (Cur.ScoreDiff - Cur.ScoreGiven) ) ); + writeln( 'USINGSCORES-Cur.ScoreDiff : ' + floattostr( Cur.ScoreDiff ) ); + writeln( 'USINGSCORES-(Cur.Rating / 20 - 0.26) : ' + floattostr( (Cur.Rating / 20 - 0.26) ) ); + writeln( '' ); +*) + {$ENDIF} + + lTempA := ( aPlayers[Cur.Player].RBTarget + (Cur.ScoreDiff - Cur.ScoreGiven) ); + lTempB := ( Cur.ScoreDiff * (Cur.Rating / 20 - 0.26) ); + + {$IFDEF LAZARUS} +(* + writeln( 'USINGSCORES-lTempA : ' + floattostr( lTempA ) ); + writeln( 'USINGSCORES-lTempB : ' + floattostr( lTempB ) ); + writeln( '----------------------------------------------------------' ); +*) + {$ENDIF} + + if ( lTempA > 0 ) AND + ( lTempB > 0 ) THEN + begin + aPlayers[Cur.Player].RBTarget := lTempA / lTempB; + end; + + If (aPlayers[Cur.Player].RBTarget > 1) then + aPlayers[Cur.Player].RBTarget := 1 + else + If (aPlayers[Cur.Player].RBTarget < 0) then + aPlayers[Cur.Player].RBTarget := 0; + + //If this is the First PopUp => Make Next PopUp the First + If (Cur = FirstPopUp) then + FirstPopUp := Cur.Next + //Else => Remove Curent Popup from Chain + else + Last.Next := Cur.Next; + + //If this is the Last PopUp, Make PopUp before the Last + If (Cur = LastPopUp) then + LastPopUp := Last; + + //Free the Memory + FreeMem(Cur, SizeOf(TScorePopUp)); +end; + +//----------- +//Removes all PopUps from Mem +//----------- +Procedure TSingScores.KillAllPopUps; +var + Cur: PScorePopUp; + Last: PScorePopUp; +begin + Cur := FirstPopUp; + + //Remove all PopUps: + While (Cur <> nil) do + begin + Last := Cur; + Cur := Cur.Next; + FreeMem(Last, SizeOf(TScorePopUp)); + end; + + FirstPopUp := nil; + LastPopUp := nil; +end; + +//----------- +//Init - has to be called after Positions and Players have been added, before first call of Draw +//It gives every Player a Score Position +//----------- +Procedure TSingScores.Init; +var + PlC: Array [0..1] of Byte; //Playercount First Screen and Second Screen + I, J: Integer; + MaxPlayersperScreen: Byte; + CurPlayer: Byte; + + Function GetPositionCountbyPlayerCount(bPlayerCount: Byte): Byte; + var I: Integer; + begin + Result := 0; + bPlayerCount := 1 shl (bPlayerCount - 1); + + For I := 0 to PositionCount-1 do + begin + If ((Positions[I].PlayerCount AND bPlayerCount) <> 0) then + Inc(Result); + end; + end; + + Function GetPositionbyPlayernum(bPlayerCount, bPlayer: Byte): Byte; + var I: Integer; + begin + bPlayerCount := 1 shl (bPlayerCount - 1); + Result := High(Byte); + + For I := 0 to PositionCount-1 do + begin + If ((Positions[I].PlayerCount AND bPlayerCount) <> 0) then + begin + If (bPlayer = 0) then + begin + Result := I; + Break; + end + else + Dec(bPlayer); + end; + end; + end; + +begin + + For I := 1 to 6 do + begin + //If there are enough Positions -> Write to MaxPlayers + If (GetPositionCountbyPlayerCount(I) = I) then + MaxPlayersperScreen := I + else + Break; + end; + + + //Split Players to both Screen or Display on One Screen + if (Screens = 2) and (MaxPlayersperScreen < PlayerCount) then + begin + PlC[0] := PlayerCount div 2 + PlayerCount mod 2; + PlC[1] := PlayerCount div 2; + end + else + begin + PlC[0] := PlayerCount; + PlC[1] := 0; + end; + + + //Check if there are enough Positions for all Players + For I := 0 to Screens - 1 do + begin + if (PlC[I] > MaxPlayersperScreen) then + begin + PlC[I] := MaxPlayersperScreen; + Log.LogError('More Players than available Positions, TSingScores'); + end; + end; + + CurPlayer := 0; + //Give every Player a Position + For I := 0 to Screens - 1 do + For J := 0 to PlC[I]-1 do + begin + aPlayers[CurPlayer].Position := GetPositionbyPlayernum(PlC[I], J) OR (I shl 7); + //Log.LogError('Player ' + InttoStr(CurPlayer) + ' gets Position: ' + InttoStr(aPlayers[CurPlayer].Position)); + Inc(CurPlayer); + end; +end; + +//----------- +//Procedure Draws Scores and Linebonus PopUps +//----------- +Procedure TSingScores.Draw; +var + I: Integer; + CurTime: Cardinal; + CurPopUp, LastPopUp: PScorePopUp; +begin + CurTime := SDL_GetTicks; + + If Visible then + begin + //Draw Popups + LastPopUp := nil; + CurPopUp := FirstPopUp; + + While (CurPopUp <> nil) do + begin + if (CurTime - CurPopUp.TimeStamp > Settings.Phase1Time + Settings.Phase2Time + Settings.Phase3Time) then + begin + KillPopUp(LastPopUp, CurPopUp); + if (LastPopUp = nil) then + CurPopUp := FirstPopUp + else + CurPopUp := LastPopUp.Next; + end + else + begin + DrawPopUp(CurPopUp); + LastPopUp := CurPopUp; + CurPopUp := LastPopUp.Next; + end; + end; + + + IF (RBVisible) then + //Draw Players w/ Rating Bar + For I := 0 to PlayerCount-1 do + begin + DrawScore(I); + DrawRatingBar(I); + end + else + //Draw Players w/o Rating Bar + For I := 0 to PlayerCount-1 do + begin + DrawScore(I); + end; + + end; //eo Visible +end; + +//----------- +//Procedure Draws a Popup by Pointer +//----------- +Procedure TSingScores.DrawPopUp(const PopUp: PScorePopUp); +var + Progress: Real; + CurTime: Cardinal; + X, Y, W, H, Alpha: Real; + FontSize: Byte; + TimeDiff: Cardinal; + PIndex: Byte; + TextLen: Real; + ScoretoAdd: Word; + PosDiff: Real; +begin + if (PopUp <> nil) then + begin + //Only Draw if Player has a Position + PIndex := Players[PopUp.Player].Position; + If PIndex <> high(byte) then + begin + //Only Draw if Player is on Cur Screen + If ((Players[PopUp.Player].Position AND 128) = 0) = (ScreenAct = 1) then + begin + CurTime := SDL_GetTicks; + If Not (Enabled AND Players[PopUp.Player].Enabled) then + //Increase Timestamp with TIem where there is no Movement ... + begin + //Inc(PopUp.TimeStamp, LastRender); + end; + TimeDiff := CurTime - PopUp.TimeStamp; + + //Get Position of PopUp + PIndex := PIndex AND 127; + + + //Check for Phase ... + If (TimeDiff <= Settings.Phase1Time) then + begin + //Phase 1 - The Ploping up + Progress := TimeDiff / Settings.Phase1Time; + + + W := Positions[PIndex].PUW * Sin(Progress/2*Pi); + H := Positions[PIndex].PUH * Sin(Progress/2*Pi); + + X := Positions[PIndex].PUStartX + (Positions[PIndex].PUW - W)/2; + Y := Positions[PIndex].PUStartY + (Positions[PIndex].PUH - H)/2; + + FontSize := Round(Progress * Positions[PIndex].PUFontSize); + Alpha := 1; + end + + Else If (TimeDiff <= Settings.Phase2Time + Settings.Phase1Time) then + begin + //Phase 2 - The Moving + Progress := (TimeDiff - Settings.Phase1Time) / Settings.Phase2Time; + + W := Positions[PIndex].PUW; + H := Positions[PIndex].PUH; + + PosDiff := Positions[PIndex].PUTargetX - Positions[PIndex].PUStartX; + If PosDiff > 0 then + PosDiff := PosDiff + W; + X := Positions[PIndex].PUStartX + PosDiff * sqr(Progress); + + PosDiff := Positions[PIndex].PUTargetY - Positions[PIndex].PUStartY; + If PosDiff < 0 then + PosDiff := PosDiff + Positions[PIndex].BGH; + Y := Positions[PIndex].PUStartY + PosDiff * sqr(Progress); + + FontSize := Positions[PIndex].PUFontSize; + Alpha := 1 - 0.3 * Progress; + end + + else + begin + //Phase 3 - The Fading out + Score adding + Progress := (TimeDiff - Settings.Phase1Time - Settings.Phase2Time) / Settings.Phase3Time; + + If (PopUp.Rating > 0) then + begin + //Add Scores if Player Enabled + If (Enabled AND Players[PopUp.Player].Enabled) then + begin + ScoreToAdd := Round(PopUp.ScoreDiff * Progress) - PopUp.ScoreGiven; + Inc(PopUp.ScoreGiven, ScoreToAdd); + aPlayers[PopUp.Player].ScoreDisplayed := Players[PopUp.Player].ScoreDisplayed + ScoreToAdd; + + //Change Bars Position + aPlayers[PopUp.Player].RBTarget := aPlayers[PopUp.Player].RBTarget + ScoreToAdd/PopUp.ScoreDiff * (PopUp.Rating / 20 - 0.26); + If (aPlayers[PopUp.Player].RBTarget > 1) then + aPlayers[PopUp.Player].RBTarget := 1 + else If (aPlayers[PopUp.Player].RBTarget < 0) then + aPlayers[PopUp.Player].RBTarget := 0; + end; + + //Set Positions etc. + Alpha := 0.7 - 0.7 * Progress; + + W := Positions[PIndex].PUW; + H := Positions[PIndex].PUH; + + PosDiff := Positions[PIndex].PUTargetX - Positions[PIndex].PUStartX; + If (PosDiff > 0) then + PosDiff := W + else + PosDiff := 0; + X := Positions[PIndex].PUTargetX + PosDiff * Progress; + + PosDiff := Positions[PIndex].PUTargetY - Positions[PIndex].PUStartY; + If (PosDiff < 0) then + PosDiff := -Positions[PIndex].BGH + else + PosDiff := 0; + Y := Positions[PIndex].PUTargetY - PosDiff * (1-Progress); + + FontSize := Positions[PIndex].PUFontSize; + end + else + begin + //Here the Effect that Should be shown if a PopUp without Score is Drawn + //And or Spawn with the GraphicObjects etc. + //Some Work for Blindy to do :P + + //ATM: Just Let it Slide in the Scores just like the Normal PopUp + Alpha := 0; + end; + end; + + //Draw PopUp + + if (Alpha > 0) AND (Players[PopUp.Player].Visible) then + begin + //Draw BG: + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glColor4f(1,1,1, Alpha); + glBindTexture(GL_TEXTURE_2D, Settings.PopUpTex[PopUp.Rating].TexNum); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(X, Y); + glTexCoord2f(0, Settings.PopUpTex[PopUp.Rating].TexH); glVertex2f(X, Y + H); + glTexCoord2f(Settings.PopUpTex[PopUp.Rating].TexW, Settings.PopUpTex[PopUp.Rating].TexH); glVertex2f(X + W, Y + H); + glTexCoord2f(Settings.PopUpTex[PopUp.Rating].TexW, 0); glVertex2f(X + W, Y); + glEnd; + + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + //Set FontStyle and Size + SetFontStyle(Positions[PIndex].PUFont); + SetFontItalic(False); + SetFontSize(FontSize); + + //Draw Text + TextLen := glTextWidth(PChar(Theme.Sing.LineBonusText[PopUp.Rating])); + + //Color and Pos + SetFontPos (X + (W - TextLen) / 2, Y + 12); + glColor4f(1, 1, 1, Alpha); + + //Draw + glPrint(PChar(Theme.Sing.LineBonusText[PopUp.Rating])); + end; //eo Alpha check + end; //eo Right Screen + end; //eo Player has Position + end + else + Log.LogError('TSingScores: Try to Draw a not existing PopUp'); +end; + +//----------- +//Procedure Draws a Score by Playerindex +//----------- +Procedure TSingScores.DrawScore(const Index: Integer); +var + Position: PScorePosition; + ScoreStr: String; +begin + //Only Draw if Player has a Position + If Players[Index].Position <> high(byte) then + begin + //Only Draw if Player is on Cur Screen + If (((Players[Index].Position AND 128) = 0) = (ScreenAct = 1)) AND Players[Index].Visible then + begin + Position := @Positions[Players[Index].Position and 127]; + + //Draw ScoreBG + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glColor4f(1,1,1, 1); + glBindTexture(GL_TEXTURE_2D, Players[Index].ScoreBG.TexNum); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(Position.BGX, Position.BGY); + glTexCoord2f(0, Players[Index].ScoreBG.TexH); glVertex2f(Position.BGX, Position.BGY + Position.BGH); + glTexCoord2f(Players[Index].ScoreBG.TexW, Players[Index].ScoreBG.TexH); glVertex2f(Position.BGX + Position.BGW, Position.BGY + Position.BGH); + glTexCoord2f(Players[Index].ScoreBG.TexW, 0); glVertex2f(Position.BGX + Position.BGW, Position.BGY); + glEnd; + + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + //Draw Score Text + SetFontStyle(Position.TextFont); + SetFontItalic(False); + SetFontSize(Position.TextSize); + SetFontPos(Position.TextX, Position.TextY); + + ScoreStr := InttoStr(Players[Index].ScoreDisplayed div 10) + '0'; + While (Length(ScoreStr) < 5) do + ScoreStr := '0' + ScoreStr; + + glPrint(PChar(ScoreStr)); + + end; //eo Right Screen + end; //eo Player has Position +end; + + +Procedure TSingScores.DrawRatingBar(const Index: Integer); +var + Position: PScorePosition; + R,G,B, Size: Real; + Diff: Real; +begin + //Only Draw if Player has a Position + If Players[Index].Position <> high(byte) then + begin + //Only Draw if Player is on Cur Screen + If ((Players[Index].Position AND 128) = 0) = (ScreenAct = 1) AND (Players[index].RBVisible AND Players[index].Visible) then + begin + Position := @Positions[Players[Index].Position and 127]; + + If (Enabled AND Players[Index].Enabled) then + begin + //Move Position if Enabled + Diff := Players[Index].RBTarget - Players[Index].RBPos; + If(Abs(Diff) < 0.02) then + aPlayers[Index].RBPos := aPlayers[Index].RBTarget + else + aPlayers[Index].RBPos := aPlayers[Index].RBPos + Diff*0.1; + end; + + //Get Colors for RatingBar + If Players[index].RBPos <=0.22 then + begin + R := 1; + G := 0; + B := 0; + end + Else If Players[index].RBPos <=0.42 then + begin + R := 1; + G := Players[index].RBPos*5; + B := 0; + end + Else If Players[index].RBPos <=0.57 then + begin + R := 1; + G := 1; + B := 0; + end + Else If Players[index].RBPos <=0.77 then + begin + R := 1-(Players[index].RBPos-0.57)*5; + G := 1; + B := 0; + end + else + begin + R := 0; + G := 1; + B := 0; + end; + + //Enable all glFuncs Needed + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + //Draw RatingBar BG + glColor4f(1, 1, 1, 0.8); + glBindTexture(GL_TEXTURE_2D, Settings.RatingBar_BG_Tex.TexNum); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex2f(Position.RBX, Position.RBY); + + glTexCoord2f(0, Settings.RatingBar_BG_Tex.TexH); + glVertex2f(Position.RBX, Position.RBY+Position.RBH); + + glTexCoord2f(Settings.RatingBar_BG_Tex.TexW, Settings.RatingBar_BG_Tex.TexH); + glVertex2f(Position.RBX+Position.RBW, Position.RBY+Position.RBH); + + glTexCoord2f(Settings.RatingBar_BG_Tex.TexW, 0); + glVertex2f(Position.RBX+Position.RBW, Position.RBY); + glEnd; + + //Draw Rating bar itself + Size := Position.RBX + Position.RBW * Players[Index].RBPos; + glColor4f(R, G, B, 1); + glBindTexture(GL_TEXTURE_2D, Settings.RatingBar_Bar_Tex.TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex2f(Position.RBX, Position.RBY); + + glTexCoord2f(0, Settings.RatingBar_Bar_Tex.TexH); + glVertex2f(Position.RBX, Position.RBY + Position.RBH); + + glTexCoord2f(Settings.RatingBar_Bar_Tex.TexW, Settings.RatingBar_Bar_Tex.TexH); + glVertex2f(Size, Position.RBY + Position.RBH); + + glTexCoord2f(Settings.RatingBar_Bar_Tex.TexW, 0); + glVertex2f(Size, Position.RBY); + glEnd; + + //Draw Ratingbar FG (Teh thing with the 3 lines to get better readability) + glColor4f(1, 1, 1, 0.6); + glBindTexture(GL_TEXTURE_2D, Settings.RatingBar_FG_Tex.TexNum); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex2f(Position.RBX, Position.RBY); + + glTexCoord2f(0, Settings.RatingBar_FG_Tex.TexH); + glVertex2f(Position.RBX, Position.RBY + Position.RBH); + + glTexCoord2f(Settings.RatingBar_FG_Tex.TexW, Settings.RatingBar_FG_Tex.TexH); + glVertex2f(Position.RBX + Position.RBW, Position.RBY + Position.RBH); + + glTexCoord2f(Settings.RatingBar_FG_Tex.TexW, 0); + glVertex2f(Position.RBX + Position.RBW, Position.RBY); + glEnd; + + //Disable all Enabled glFuncs + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + end; //eo Right Screen + end; //eo Player has Position +end; + +end. diff --git a/Game/Code/Classes/USkins.pas b/Game/Code/Classes/USkins.pas index 5bab885b..2237c22a 100644 --- a/Game/Code/Classes/USkins.pas +++ b/Game/Code/Classes/USkins.pas @@ -2,6 +2,10 @@ unit USkins; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} type diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 9e0d6ca5..614363c8 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -2,6 +2,10 @@ unit USongs; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses SysUtils, @@ -225,8 +229,10 @@ begin ADirent := ReadDir(TheDir); if ( ADirent <> Nil ) AND - ( pos( '.txt', ADirent^.name ) > -1 ) then + ( pos( '.txt', ADirent^.name ) > 0 ) then begin + writeln ('***** FOUND TXT' + ADirent^.name ); + SLen := BrowsePos; Song[SLen].Path := Dir; @@ -244,7 +250,6 @@ begin //Change Length Only every 50 Entrys Inc(BrowsePos); - if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then begin SetLength(Song, Length(Song) + 50); diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 76d78f5b..f1f7fe47 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -17,6 +17,10 @@ unit UTexture; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses OpenGL12, diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index c27f9c9e..c212e7cb 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -2,6 +2,10 @@ unit UThemes; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses diff --git a/Game/Code/Classes/UTime.pas b/Game/Code/Classes/UTime.pas index f714fed5..3b7749a2 100644 --- a/Game/Code/Classes/UTime.pas +++ b/Game/Code/Classes/UTime.pas @@ -2,6 +2,9 @@ unit UTime; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} {$I switches.inc} {$UNDEF DebugDisplay} diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index c18eea6c..65dbc0a2 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -14,12 +14,16 @@ unit UVideo; //{$define DebugFrames} //{$define Info} -//{$define FFMpegAudio} +// {$define FFMpegAudio} {} interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} (* @@ -281,6 +285,7 @@ begin else if (AVPacket.stream_index = AudioStreamIndex ) then begin + writeln('Encue Audio packet'); UAudio_FFMpeg.packet_queue_put(UAudio_FFMpeg.audioq, AVPacket); {$endif} end; diff --git a/Game/Code/Classes/uPluginLoader.pas b/Game/Code/Classes/uPluginLoader.pas index 55c89878..0fe5d51a 100644 --- a/Game/Code/Classes/uPluginLoader.pas +++ b/Game/Code/Classes/uPluginLoader.pas @@ -8,6 +8,10 @@ unit UPluginLoader; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses UPluginDefs, UCoreModule; diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index b3529d0a..c8a0aaf2 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -2,6 +2,10 @@ unit UDisplay; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses {$IFDEF win32} diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 08ba1e4d..84cbe8a3 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -2,6 +2,10 @@ unit UMenu; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses OpenGL12, SysUtils, UTexture, UMenuStatic, UMenuText, UMenuButton, UMenuSelect, UMenuSelectSlide, diff --git a/Game/Code/Menu/UMenuSelectSlide.pas b/Game/Code/Menu/UMenuSelectSlide.pas index e4c5f959..d52474e6 100644 --- a/Game/Code/Menu/UMenuSelectSlide.pas +++ b/Game/Code/Menu/UMenuSelectSlide.pas @@ -1,351 +1,355 @@ -unit UMenuSelectSlide; - -interface - -{$I switches.inc} - -uses TextGL, - UTexture, - OpenGL12, - UMenuText; - -type - PSelectSlide = ^TSelectSlide; - TSelectSlide = class - private - SelectBool: boolean; - public - // objects - Text: TText; // Main text describing option - TextOpt: array of TText; // 3 texts in the position of possible options - TextOptT: array of string; // array of names for possible options - - Texture: TTexture; // Select Texture - TextureSBG: TTexture; // Background Selections Texture -// TextureS: array of TTexture; // Selections Texture (not used) - -// TextureArrowL: TTexture; // Texture for left arrow (not used yet) -// TextureArrowR: TTexture; // Texture for right arrow (not used yet) - - SelectOptInt: integer; - PData: ^integer; - - //For automatically Setting LineCount - Lines: Byte; - - //Visibility - Visible: Boolean; - - // for selection and deselection - // main static - ColR: real; - ColG: real; - ColB: real; - Int: real; - DColR: real; - DColG: real; - DColB: real; - DInt: real; - - // main text - TColR: real; - TColG: real; - TColB: real; - TInt: real; - TDColR: real; - TDColG: real; - TDColB: real; - TDInt: real; - - // selection background static - SBGColR: real; - SBGColG: real; - SBGColB: real; - SBGInt: real; - SBGDColR: real; - SBGDColG: real; - SBGDColB: real; - SBGDInt: real; - - // selection text - STColR: real; - STColG: real; - STColB: real; - STInt: real; - STDColR: real; - STDColG: real; - STDColB: real; - STDInt: real; - - // position and size - property X: real read Texture.x write Texture.x; - property Y: real read Texture.y write Texture.y; - property W: real read Texture.w write Texture.w; - property H: real read Texture.h write Texture.h; -// property X2: real read Texture2.x write Texture2.x; -// property Y2: real read Texture2.y write Texture2.y; -// property W2: real read Texture2.w write Texture2.w; -// property H2: real read Texture2.h write Texture2.h; - - property SBGW: real read TextureSBG.w write TextureSBG.w; - - // procedures - procedure SetSelect(Value: boolean); - property Selected: Boolean read SelectBool write SetSelect; - procedure SetSelectOpt(Value: integer); - property SelectedOption: integer read SelectOptInt write SetSelectOpt; - procedure Draw; - constructor Create; - - //Automatically Generate Lines (Texts) - procedure genLines; - end; - -implementation -uses UDrawTexture, math, ULog, SysUtils; - -// ------------ Select -constructor TSelectSlide.Create; -begin - inherited Create; - Text := TText.Create; - SetLength(TextOpt, 1); - TextOpt[0] := TText.Create; - - //Set Standard Width for Selections Background - SBGW := 450; - - Visible := True; - {SetLength(TextOpt, 3); - TextOpt[0] := TText.Create; - TextOpt[1] := TText.Create; - TextOpt[2] := TText.Create;} -end; - -procedure TSelectSlide.SetSelect(Value: boolean); -{var - SO: integer; - I: integer;} -begin - SelectBool := Value; - if Value then begin - Texture.ColR := ColR; - Texture.ColG := ColG; - Texture.ColB := ColB; - Texture.Int := Int; - - Text.ColR := TColR; - Text.ColG := TColG; - Text.ColB := TColB; - Text.Int := TInt; - - TextureSBG.ColR := SBGColR; - TextureSBG.ColG := SBGColG; - TextureSBG.ColB := SBGColB; - TextureSBG.Int := SBGInt; - -{ for I := 0 to High(TextOpt) do begin - TextOpt[I].ColR := STColR; - TextOpt[I].ColG := STColG; - TextOpt[I].ColB := STColB; - TextOpt[I].Int := STInt; - end;} - - end else begin - Texture.ColR := DColR; - Texture.ColG := DColG; - Texture.ColB := DColB; - Texture.Int := DInt; - - Text.ColR := TDColR; - Text.ColG := TDColG; - Text.ColB := TDColB; - Text.Int := TDInt; - - TextureSBG.ColR := SBGDColR; - TextureSBG.ColG := SBGDColG; - TextureSBG.ColB := SBGDColB; - TextureSBG.Int := SBGDInt; - -{ for I := 0 to High(TextOpt) do begin - TextOpt[I].ColR := STDColR; - TextOpt[I].ColG := STDColG; - TextOpt[I].ColB := STDColB; - TextOpt[I].Int := STDInt; - end;} - end; -end; - -procedure TSelectSlide.SetSelectOpt(Value: integer); -var - SO: integer; - Sel: integer; - HalfL: integer; - HalfR: integer; - -procedure DoSelection(Sel: Cardinal); - var I: Integer; - begin - for I := low(TextOpt) to high(TextOpt) do - begin - TextOpt[I].ColR := STDColR; - TextOpt[I].ColG := STDColG; - TextOpt[I].ColB := STDColB; - TextOpt[I].Int := STDInt; - end; - if (integer(Sel) <= high(TextOpt)) then - begin - TextOpt[Sel].ColR := STColR; - TextOpt[Sel].ColG := STColG; - TextOpt[Sel].ColB := STColB; - TextOpt[Sel].Int := STInt; - end; - end; -begin - SelectOptInt := Value; - PData^ := Value; -// SetSelect(true); // reset all colors - - if (Length(TextOpt)>0) AND (Length(TextOptT)>0) then - begin - - if (Value <= 0) then - begin //First Option Selected - Value := 0; - - for SO := low (TextOpt) to high(TextOpt) do - begin - TextOpt[SO].Text := TextOptT[SO]; - end; - - DoSelection(0); - end - else if (Value >= high(TextOptT)) then - begin //Last Option Selected - Value := high(TextOptT); - - for SO := high(TextOpt) downto low (TextOpt) do - begin - TextOpt[SO].Text := TextOptT[high(TextOptT)-(Lines-SO-1)]; - end; - DoSelection(Lines-1); - end - else - begin - HalfL := Ceil((Lines-1)/2); - HalfR := Lines-1-HalfL; - - if (Value <= HalfL) then - begin //Selected Option is near to the left side - {HalfL := Value; - HalfR := Lines-1-HalfL;} - //Change Texts - for SO := low (TextOpt) to high(TextOpt) do - begin - TextOpt[SO].Text := TextOptT[SO]; - end; - - DoSelection(Value); - end - else if (Value > High(TextOptT)-HalfR) then - begin //Selected is too near to the right border - HalfR := high(TextOptT) - Value; - HalfL := Lines-1-HalfR; - //Change Texts - for SO := high(TextOpt) downto low (TextOpt) do - begin - TextOpt[SO].Text := TextOptT[high(TextOptT)-(Lines-SO-1)]; - end; - - DoSelection (HalfL); - end - else - begin - //Change Texts - for SO := low (TextOpt) to high(TextOpt) do - begin - TextOpt[SO].Text := TextOptT[Value - HalfL + SO]; - end; - - DoSelection(HalfL); - end; - - end; - - end; - -end; - -procedure TSelectSlide.Draw; -var - SO: integer; -begin - if Visible then - begin - DrawTexture(Texture); - DrawTexture(TextureSBG); - - Text.Draw; - - for SO := low(TextOpt) to high(TextOpt) do - TextOpt[SO].Draw; - end; -end; - -procedure TSelectSlide.GenLines; -var -maxlength: Real; -I: Integer; -begin - SetFontStyle(0{Text.Style}); - SetFontSize(Text.Size); - maxlength := 0; - - for I := low(TextOptT) to high (TextOptT) do - begin - if (glTextWidth(PChar(TextOptT[I])) > maxlength) then - maxlength := glTextWidth(PChar(TextOptT[I])); - end; - - Lines := floor((TextureSBG.W-40) / (maxlength+7)); - if (Lines > Length(TextOptT)) then - Lines := Length(TextOptT); - - if (Lines <= 0) then - Lines := 1; - - //Free old Space used by Texts - For I := low(TextOpt) to high(TextOpt) do - TextOpt[I].Free; - - setLength (TextOpt, Lines); - - for I := low(TextOpt) to high(TextOpt) do - begin - TextOpt[I] := TText.Create; - TextOpt[I].Size := Text.Size; - //TextOpt[I].Align := 1; - TextOpt[I].Align := 0; - TextOpt[I].Visible := True; - - TextOpt[I].ColR := STDColR; - TextOpt[I].ColG := STDColG; - TextOpt[I].ColB := STDColB; - TextOpt[I].Int := STDInt; - - //Generate Positions - //TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * (I + 0.5); - if (I <> High(TextOpt)) OR (High(TextOpt) = 0) OR (Length(TextOptT) = Lines) then - TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * I - else - TextOpt[I].X := TextureSBG.X + TextureSBG.W - maxlength; - - TextOpt[I].Y := TextureSBG.Y + (TextureSBG.H / 2) - 1.5 * Text.Size{20}; - - //Better Look with 2 Options - if (Lines=2) AND (Length(TextOptT)= 2) then - TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W -40 - glTextWidth(PChar(TextOptT[1]))) * I; - end; -end; - -end. +unit UMenuSelectSlide; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses TextGL, + UTexture, + OpenGL12, + UMenuText; + +type + PSelectSlide = ^TSelectSlide; + TSelectSlide = class + private + SelectBool: boolean; + public + // objects + Text: TText; // Main text describing option + TextOpt: array of TText; // 3 texts in the position of possible options + TextOptT: array of string; // array of names for possible options + + Texture: TTexture; // Select Texture + TextureSBG: TTexture; // Background Selections Texture +// TextureS: array of TTexture; // Selections Texture (not used) + +// TextureArrowL: TTexture; // Texture for left arrow (not used yet) +// TextureArrowR: TTexture; // Texture for right arrow (not used yet) + + SelectOptInt: integer; + PData: ^integer; + + //For automatically Setting LineCount + Lines: Byte; + + //Visibility + Visible: Boolean; + + // for selection and deselection + // main static + ColR: real; + ColG: real; + ColB: real; + Int: real; + DColR: real; + DColG: real; + DColB: real; + DInt: real; + + // main text + TColR: real; + TColG: real; + TColB: real; + TInt: real; + TDColR: real; + TDColG: real; + TDColB: real; + TDInt: real; + + // selection background static + SBGColR: real; + SBGColG: real; + SBGColB: real; + SBGInt: real; + SBGDColR: real; + SBGDColG: real; + SBGDColB: real; + SBGDInt: real; + + // selection text + STColR: real; + STColG: real; + STColB: real; + STInt: real; + STDColR: real; + STDColG: real; + STDColB: real; + STDInt: real; + + // position and size + property X: real read Texture.x write Texture.x; + property Y: real read Texture.y write Texture.y; + property W: real read Texture.w write Texture.w; + property H: real read Texture.h write Texture.h; +// property X2: real read Texture2.x write Texture2.x; +// property Y2: real read Texture2.y write Texture2.y; +// property W2: real read Texture2.w write Texture2.w; +// property H2: real read Texture2.h write Texture2.h; + + property SBGW: real read TextureSBG.w write TextureSBG.w; + + // procedures + procedure SetSelect(Value: boolean); + property Selected: Boolean read SelectBool write SetSelect; + procedure SetSelectOpt(Value: integer); + property SelectedOption: integer read SelectOptInt write SetSelectOpt; + procedure Draw; + constructor Create; + + //Automatically Generate Lines (Texts) + procedure genLines; + end; + +implementation +uses UDrawTexture, math, ULog, SysUtils; + +// ------------ Select +constructor TSelectSlide.Create; +begin + inherited Create; + Text := TText.Create; + SetLength(TextOpt, 1); + TextOpt[0] := TText.Create; + + //Set Standard Width for Selections Background + SBGW := 450; + + Visible := True; + {SetLength(TextOpt, 3); + TextOpt[0] := TText.Create; + TextOpt[1] := TText.Create; + TextOpt[2] := TText.Create;} +end; + +procedure TSelectSlide.SetSelect(Value: boolean); +{var + SO: integer; + I: integer;} +begin + SelectBool := Value; + if Value then begin + Texture.ColR := ColR; + Texture.ColG := ColG; + Texture.ColB := ColB; + Texture.Int := Int; + + Text.ColR := TColR; + Text.ColG := TColG; + Text.ColB := TColB; + Text.Int := TInt; + + TextureSBG.ColR := SBGColR; + TextureSBG.ColG := SBGColG; + TextureSBG.ColB := SBGColB; + TextureSBG.Int := SBGInt; + +{ for I := 0 to High(TextOpt) do begin + TextOpt[I].ColR := STColR; + TextOpt[I].ColG := STColG; + TextOpt[I].ColB := STColB; + TextOpt[I].Int := STInt; + end;} + + end else begin + Texture.ColR := DColR; + Texture.ColG := DColG; + Texture.ColB := DColB; + Texture.Int := DInt; + + Text.ColR := TDColR; + Text.ColG := TDColG; + Text.ColB := TDColB; + Text.Int := TDInt; + + TextureSBG.ColR := SBGDColR; + TextureSBG.ColG := SBGDColG; + TextureSBG.ColB := SBGDColB; + TextureSBG.Int := SBGDInt; + +{ for I := 0 to High(TextOpt) do begin + TextOpt[I].ColR := STDColR; + TextOpt[I].ColG := STDColG; + TextOpt[I].ColB := STDColB; + TextOpt[I].Int := STDInt; + end;} + end; +end; + +procedure TSelectSlide.SetSelectOpt(Value: integer); +var + SO: integer; + Sel: integer; + HalfL: integer; + HalfR: integer; + +procedure DoSelection(Sel: Cardinal); + var I: Integer; + begin + for I := low(TextOpt) to high(TextOpt) do + begin + TextOpt[I].ColR := STDColR; + TextOpt[I].ColG := STDColG; + TextOpt[I].ColB := STDColB; + TextOpt[I].Int := STDInt; + end; + if (integer(Sel) <= high(TextOpt)) then + begin + TextOpt[Sel].ColR := STColR; + TextOpt[Sel].ColG := STColG; + TextOpt[Sel].ColB := STColB; + TextOpt[Sel].Int := STInt; + end; + end; +begin + SelectOptInt := Value; + PData^ := Value; +// SetSelect(true); // reset all colors + + if (Length(TextOpt)>0) AND (Length(TextOptT)>0) then + begin + + if (Value <= 0) then + begin //First Option Selected + Value := 0; + + for SO := low (TextOpt) to high(TextOpt) do + begin + TextOpt[SO].Text := TextOptT[SO]; + end; + + DoSelection(0); + end + else if (Value >= high(TextOptT)) then + begin //Last Option Selected + Value := high(TextOptT); + + for SO := high(TextOpt) downto low (TextOpt) do + begin + TextOpt[SO].Text := TextOptT[high(TextOptT)-(Lines-SO-1)]; + end; + DoSelection(Lines-1); + end + else + begin + HalfL := Ceil((Lines-1)/2); + HalfR := Lines-1-HalfL; + + if (Value <= HalfL) then + begin //Selected Option is near to the left side + {HalfL := Value; + HalfR := Lines-1-HalfL;} + //Change Texts + for SO := low (TextOpt) to high(TextOpt) do + begin + TextOpt[SO].Text := TextOptT[SO]; + end; + + DoSelection(Value); + end + else if (Value > High(TextOptT)-HalfR) then + begin //Selected is too near to the right border + HalfR := high(TextOptT) - Value; + HalfL := Lines-1-HalfR; + //Change Texts + for SO := high(TextOpt) downto low (TextOpt) do + begin + TextOpt[SO].Text := TextOptT[high(TextOptT)-(Lines-SO-1)]; + end; + + DoSelection (HalfL); + end + else + begin + //Change Texts + for SO := low (TextOpt) to high(TextOpt) do + begin + TextOpt[SO].Text := TextOptT[Value - HalfL + SO]; + end; + + DoSelection(HalfL); + end; + + end; + + end; + +end; + +procedure TSelectSlide.Draw; +var + SO: integer; +begin + if Visible then + begin + DrawTexture(Texture); + DrawTexture(TextureSBG); + + Text.Draw; + + for SO := low(TextOpt) to high(TextOpt) do + TextOpt[SO].Draw; + end; +end; + +procedure TSelectSlide.GenLines; +var +maxlength: Real; +I: Integer; +begin + SetFontStyle(0{Text.Style}); + SetFontSize(Text.Size); + maxlength := 0; + + for I := low(TextOptT) to high (TextOptT) do + begin + if (glTextWidth(PChar(TextOptT[I])) > maxlength) then + maxlength := glTextWidth(PChar(TextOptT[I])); + end; + + Lines := floor((TextureSBG.W-40) / (maxlength+7)); + if (Lines > Length(TextOptT)) then + Lines := Length(TextOptT); + + if (Lines <= 0) then + Lines := 1; + + //Free old Space used by Texts + For I := low(TextOpt) to high(TextOpt) do + TextOpt[I].Free; + + setLength (TextOpt, Lines); + + for I := low(TextOpt) to high(TextOpt) do + begin + TextOpt[I] := TText.Create; + TextOpt[I].Size := Text.Size; + //TextOpt[I].Align := 1; + TextOpt[I].Align := 0; + TextOpt[I].Visible := True; + + TextOpt[I].ColR := STDColR; + TextOpt[I].ColG := STDColG; + TextOpt[I].ColB := STDColB; + TextOpt[I].Int := STDInt; + + //Generate Positions + //TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * (I + 0.5); + if (I <> High(TextOpt)) OR (High(TextOpt) = 0) OR (Length(TextOptT) = Lines) then + TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * I + else + TextOpt[I].X := TextureSBG.X + TextureSBG.W - maxlength; + + TextOpt[I].Y := TextureSBG.Y + (TextureSBG.H / 2) - 1.5 * Text.Size{20}; + + //Better Look with 2 Options + if (Lines=2) AND (Length(TextOptT)= 2) then + TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W -40 - glTextWidth(PChar(TextOptT[1]))) * I; + end; +end; + +end. diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas index 350c28de..f180a41b 100644 --- a/Game/Code/Menu/UMenuText.pas +++ b/Game/Code/Menu/UMenuText.pas @@ -2,6 +2,10 @@ unit UMenuText; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses TextGL, diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index e60b9fb9..7147be2e 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -2,6 +2,10 @@ unit UScreenCredits; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index 0c8244ab..e370ad67 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -1,577 +1,581 @@ -unit UScreenEditConvert; - -interface - -{$I switches.inc} - -uses UMenu, - SDL, - {$IFDEF UseMIDIPort} - MidiFile, - MidiOut, - {$ENDIF} - ULog, - USongs, - UMusic, - UThemes; - -type - TNote = record - Event: integer; - EventType: integer; - Channel: integer; - Start: real; - Len: real; - Data1: integer; - Data2: integer; - Str: string; - end; - - TTrack = record - Note: array of TNote; - Name: string; - Hear: boolean; - Status: byte; // 0 - none, 1 - notes, 2 - lyrics, 3 - notes + lyrics - end; - - TNuta = record - Start: integer; - Len: integer; - Tone: integer; - Lyric: string; - NewSentence: boolean; - end; - - TArrayTrack = array of TTrack; - - TScreenEditConvert = class(TMenu) - public - ATrack: TArrayTrack; // actual track -// Track: TArrayTrack; - Channel: TArrayTrack; - ColR: array[0..100] of real; - ColG: array[0..100] of real; - ColB: array[0..100] of real; - Len: real; - Sel: integer; - Selected: boolean; -// FileName: string; - - {$IFDEF UseMIDIPort} - MidiFile: TMidiFile; - MidiTrack: TMidiTrack; - MidiEvent: pMidiEvent; - MidiOut: TMidiOutput; - {$ENDIF} - - Song: TSong; - Czesc: TCzesci; - BPM: real; - Ticks: real; - Nuta: array of TNuta; - - procedure AddLyric(Start: integer; Tekst: string); - procedure Extract; - - {$IFDEF UseMIDIPort} - procedure MidiFile1MidiEvent(event: PMidiEvent); - {$ENDIF} - - function SelectedNumber: integer; - constructor Create; override; - procedure onShow; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure onHide; override; - end; - -implementation -uses UGraphic, - SysUtils, - UDrawTexture, - TextGL, - UFiles, - UMain, - UIni, - OpenGL12, - USkins; - -function TScreenEditConvert.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -var - T: integer; -begin - Result := true; - If (PressedDown) Then - begin // Key Down - case PressedKey of - SDLK_Q: - begin - Result := false; - end; - - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - {$IFDEF UseMIDIPort} - MidiFile.StopPlaying; - {$ENDIF} - AudioPlayback.PlayBack; - FadeTo(@ScreenEdit); - end; - - SDLK_RETURN: - begin - if Interaction = 0 then - begin - AudioPlayback.PlayStart; - ScreenOpen.BackScreen := @ScreenEditConvert; - FadeTo(@ScreenOpen); - end; - - if Interaction = 1 then - begin - Selected := false; - {$IFDEF UseMIDIPort} - MidiFile.OnMidiEvent := MidiFile1MidiEvent; -// MidiFile.GoToTime(MidiFile.GetTrackLength div 2); - MidiFile.StartPlaying; - {$ENDIF} - end; - - if Interaction = 2 then begin - Selected := true; - {$IFDEF UseMIDIPort} - MidiFile.OnMidiEvent := nil; - {$ENDIF} - {for T := 0 to High(ATrack) do begin - if ATrack[T].Hear then begin - MidiTrack := MidiFile.GetTrack(T); - MidiTrack.OnMidiEvent := MidiFile1MidiEvent; - end; - end; - MidiFile.StartPlaying;//} - end; - - if Interaction = 3 then begin - if SelectedNumber > 0 then begin - Extract; - SaveSong(Song, Czesc, ChangeFileExt(FileName, '.txt'), false); - end; - end; - - end; - - SDLK_SPACE: - begin -// ATrack[Sel].Hear := not ATrack[Sel].Hear; - ATrack[Sel].Status := (ATrack[Sel].Status + 1) mod 4; - -{ if Selected then begin - MidiTrack := MidiFile.GetTrack(Sel); - if Track[Sel].Hear then - MidiTrack.OnMidiEvent := MidiFile1MidiEvent - else - MidiTrack.OnMidiEvent := nil; - end;} - end; - - SDLK_RIGHT: - begin - InteractNext; - end; - - SDLK_LEFT: - begin - InteractPrev; - end; - - SDLK_DOWN: - begin - Inc(Sel); - if Sel > High(ATrack) then Sel := 0; - end; - SDLK_UP: - begin - Dec(Sel); - if Sel < 0 then Sel := High(ATrack); - end; - end; - end; -end; - -procedure TScreenEditConvert.AddLyric(Start: integer; Tekst: string); -var - N: integer; -begin - for N := 0 to High(Nuta) do begin - if Nuta[N].Start = Start then begin - // check for new sentece - if Copy(Tekst, 1, 1) = '\' then Delete(Tekst, 1, 1); - if Copy(Tekst, 1, 1) = '/' then begin - Delete(Tekst, 1, 1); - Nuta[N].NewSentence := true; - end; - - // overwrite lyric od append - if Nuta[N].Lyric = '-' then - Nuta[N].Lyric := Tekst - else - Nuta[N].Lyric := Nuta[N].Lyric + Tekst; - end; - end; -end; - -procedure TScreenEditConvert.Extract; -var - T: integer; - C: integer; - N: integer; - Nu: integer; - NutaTemp: TNuta; - Move: integer; - Max, Min: integer; -begin - // song info - Song.Title := ''; - Song.Artist := ''; - Song.Mp3 := ''; - Song.Resolution := 4; - SetLength(Song.BPM, 1); - Song.BPM[0].BPM := BPM*4; - - SetLength(Nuta, 0); - - // extract notes - for T := 0 to High(ATrack) do begin -// if ATrack[T].Hear then begin - if ((ATrack[T].Status div 1) and 1) = 1 then begin - for N := 0 to High(ATrack[T].Note) do begin - if (ATrack[T].Note[N].EventType = 9) and (ATrack[T].Note[N].Data2 > 0) then begin - Nu := Length(Nuta); - SetLength(Nuta, Nu + 1); - Nuta[Nu].Start := Round(ATrack[T].Note[N].Start / Ticks); - Nuta[Nu].Len := Round(ATrack[T].Note[N].Len / Ticks); - Nuta[Nu].Tone := ATrack[T].Note[N].Data1 - 12*5; - Nuta[Nu].Lyric := '-'; - end; - end; - end; - end; - - // extract lyrics - for T := 0 to High(ATrack) do begin -// if ATrack[T].Hear then begin - if ((ATrack[T].Status div 2) and 1) = 1 then begin - for N := 0 to High(ATrack[T].Note) do begin - if (ATrack[T].Note[N].EventType = 15) then begin -// Log.LogStatus('<' + Track[T].Note[N].Str + '>', 'MIDI'); - AddLyric(Round(ATrack[T].Note[N].Start / Ticks), ATrack[T].Note[N].Str); - end; - end; - end; - end; - - // sort notes - for N := 0 to High(Nuta) do - for Nu := 0 to High(Nuta)-1 do - if Nuta[Nu].Start > Nuta[Nu+1].Start then begin - NutaTemp := Nuta[Nu]; - Nuta[Nu] := Nuta[Nu+1]; - Nuta[Nu+1] := NutaTemp; - end; - - // move to 0 at beginning - Move := Nuta[0].Start; - for N := 0 to High(Nuta) do - Nuta[N].Start := Nuta[N].Start - Move; - - // copy notes - SetLength(Czesc.Czesc, 1); - Czesc.Ilosc := 1; - Czesc.High := 0; - - C := 0; - N := 0; - Czesc.Czesc[C].IlNut := 0; - Czesc.Czesc[C].HighNut := -1; - - for Nu := 0 to High(Nuta) do begin - if Nuta[Nu].NewSentence then begin // nowa linijka - SetLength(Czesc.Czesc, Length(Czesc.Czesc)+1); - Czesc.Ilosc := Czesc.Ilosc + 1; - Czesc.High := Czesc.High + 1; - C := C + 1; - N := 0; - SetLength(Czesc.Czesc[C].Nuta, 0); - Czesc.Czesc[C].IlNut := 0; - Czesc.Czesc[C].HighNut := -1; - - //Calculate Start of the Last Sentence - if (C > 0) and (Nu > 0) then - begin - Max := Nuta[Nu].Start; - Min := Nuta[Nu-1].Start + Nuta[Nu-1].Len; - - case (Max - Min) of - 0: Czesc.Czesc[C].Start := Max; - 1: Czesc.Czesc[C].Start := Max; - 2: Czesc.Czesc[C].Start := Max - 1; - 3: Czesc.Czesc[C].Start := Max - 2; - else - if ((Max - Min) > 4) then - Czesc.Czesc[C].Start := Min + 2 - else - Czesc.Czesc[C].Start := Max; - - end; // case - - end; - end; - - // tworzy miejsce na nowa nute - SetLength(Czesc.Czesc[C].Nuta, Length(Czesc.Czesc[C].Nuta)+1); - Czesc.Czesc[C].IlNut := Czesc.Czesc[C].IlNut + 1; - Czesc.Czesc[C].HighNut := Czesc.Czesc[C].HighNut + 1; - - // dopisuje - Czesc.Czesc[C].Nuta[N].Start := Nuta[Nu].Start; - Czesc.Czesc[C].Nuta[N].Dlugosc := Nuta[Nu].Len; - Czesc.Czesc[C].Nuta[N].Ton := Nuta[Nu].Tone; - Czesc.Czesc[C].Nuta[N].Tekst := Nuta[Nu].Lyric; - //All Notes are Freestyle when Converted Fix: - Czesc.Czesc[C].Nuta[N].Wartosc := 1; - Inc(N); - end; -end; - -function TScreenEditConvert.SelectedNumber: integer; -var - T: integer; // track -begin - Result := 0; - for T := 0 to High(ATrack) do -// if ATrack[T].Hear then Inc(Result); - if ((ATrack[T].Status div 1) and 1) = 1 then Inc(Result); -end; - -{$IFDEF UseMIDIPort} -procedure TScreenEditConvert.MidiFile1MidiEvent(event: PMidiEvent); -begin -// Log.LogStatus(IntToStr(event.event), 'MIDI'); - MidiOut.PutShort(event.event, event.data1, event.data2); -end; -{$ENDIF} - -constructor TScreenEditConvert.Create; -var - P: integer; -begin - inherited Create; - AddButton(40, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); - AddButtonText(15, 5, 0, 0, 0, 'Open'); -// Button[High(Button)].Text[0].Size := 11; - - AddButton(160, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); - AddButtonText(25, 5, 0, 0, 0, 'Play'); - - AddButton(280, 20, 200, 40, Skin.GetTextureFileName('ButtonF')); - AddButtonText(25, 5, 0, 0, 0, 'Play Selected'); - - AddButton(500, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); - AddButtonText(20, 5, 0, 0, 0, 'Save'); - - -{ MidiOut := TMidiOutput.Create(nil); -// MidiOut.Close; -// MidiOut.DeviceID := 0; - if Ini.Debug = 1 then - MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table - Log.LogStatus(MidiOut.ProductName, 'MIDI'); - MidiOut.Open; -// MidiOut.SetVolume(100, 100); // temporary} - - FileName := GamePath + 'file.mid'; - {$IFDEF UseMIDIPort} - MidiFile := TMidiFile.Create(nil); - {$ENDIF} - - for P := 0 to 100 do begin - ColR[P] := Random(10)/10; - ColG[P] := Random(10)/10; - ColB[P] := Random(10)/10; - end; - -end; - -procedure TScreenEditConvert.onShow; -var - T: integer; // track - N: integer; // note - C: integer; // channel - CN: integer; // channel note -begin -{$IFDEF UseMIDIPort} - MidiOut := TMidiOutput.Create(nil); - if Ini.Debug = 1 then - MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table - Log.LogStatus(MidiOut.ProductName, 'MIDI'); - MidiOut.Open; - - - if FileExists(FileName) then - begin - MidiFile.Filename := FileName; - MidiFile.ReadFile; - - - Len := 0; - Sel := 0; - BPM := MidiFile.Bpm; - Ticks := MidiFile.TicksPerQuarter / 4; - -{ for T := 0 to MidiFile.NumberOfTracks-1 do begin - SetLength(Track, Length(Track)+1); - MidiTrack := MidiFile.GetTrack(T); - MidiTrack.OnMidiEvent := MidiFile1MidiEvent; - Track[T].Name := MidiTrack.getName; - - for N := 0 to MidiTrack.getEventCount-1 do begin - SetLength(Track[T].Note, Length(Track[T].Note)+1); - MidiEvent := MidiTrack.GetEvent(N); - Track[T].Note[N].Start := MidiEvent.time; - Track[T].Note[N].Len := MidiEvent.len; - Track[T].Note[N].Event := MidiEvent.event; - Track[T].Note[N].EventType := MidiEvent.event div 16; - Track[T].Note[N].Channel := MidiEvent.event and 15; - Track[T].Note[N].Data1 := MidiEvent.data1; - Track[T].Note[N].Data2 := MidiEvent.data2; - Track[T].Note[N].Str := MidiEvent.str; - - if Track[T].Note[N].Start + Track[T].Note[N].Len > Len then - Len := Track[T].Note[N].Start + Track[T].Note[N].Len; - end; - end;} - - - SetLength(Channel, 16); - for T := 0 to 15 do - begin - Channel[T].Name := IntToStr(T+1); - SetLength(Channel[T].Note, 0); - Channel[T].Status := 0; - end; - - for T := 0 to MidiFile.NumberOfTracks-1 do begin - MidiTrack := MidiFile.GetTrack(T); - MidiTrack.OnMidiEvent := MidiFile1MidiEvent; - - for N := 0 to MidiTrack.getEventCount-1 do begin - MidiEvent := MidiTrack.GetEvent(N); - C := MidiEvent.event and 15; - - CN := Length(Channel[C].Note); - SetLength(Channel[C].Note, CN+1); - - Channel[C].Note[CN].Start := MidiEvent.time; - Channel[C].Note[CN].Len := MidiEvent.len; - Channel[C].Note[CN].Event := MidiEvent.event; - Channel[C].Note[CN].EventType := MidiEvent.event div 16; - Channel[C].Note[CN].Channel := MidiEvent.event and 15; - Channel[C].Note[CN].Data1 := MidiEvent.data1; - Channel[C].Note[CN].Data2 := MidiEvent.data2; - Channel[C].Note[CN].Str := MidiEvent.str; - - if Channel[C].Note[CN].Start + Channel[C].Note[CN].Len > Len then - Len := Channel[C].Note[CN].Start + Channel[C].Note[CN].Len; - end; - end; - ATrack := Channel; - - end; - - Interaction := 0; -{$ENDIF} -end; - -function TScreenEditConvert.Draw: boolean; -var - Pet: integer; - Pet2: integer; - Bottom: real; - X: real; - Y: real; - H: real; - YSkip: real; -begin - // draw static menu - inherited Draw; - - Y := 100; - - H := Length(ATrack)*40; - if H > 480 then H := 480; - Bottom := Y + H; - - YSkip := H / Length(ATrack); - - // select - DrawQuad(10, Y+Sel*YSkip, 780, YSkip, 0.8, 0.8, 0.8); - - // selected - now me use Status System - for Pet := 0 to High(ATrack) do - if ATrack[Pet].Hear then - DrawQuad(10, Y+Pet*YSkip, 50, YSkip, 0.8, 0.3, 0.3); - glColor3f(0, 0, 0); - for Pet := 0 to High(ATrack) do begin - if ((ATrack[Pet].Status div 1) and 1) = 1 then begin - SetFontPos(25, Y + Pet*YSkip + 10); - SetFontSize(5); - glPrint('N'); - end; - if ((ATrack[Pet].Status div 2) and 1) = 1 then begin - SetFontPos(40, Y + Pet*YSkip + 10); - SetFontSize(5); - glPrint('L'); - end; - end; - - DrawLine(10, Y, 10, Bottom, 0, 0, 0); - DrawLine(60, Y, 60, Bottom, 0, 0, 0); - DrawLine(790, Y, 790, Bottom, 0, 0, 0); - - for Pet := 0 to Length(ATrack) do - DrawLine(10, Y+Pet*YSkip, 790, Y+Pet*YSkip, 0, 0, 0); - - for Pet := 0 to High(ATrack) do begin - SetFontPos(11, Y + 10 + Pet*YSkip); - SetFontSize(5); - glPrint(pchar(ATrack[Pet].Name)); - end; - - for Pet := 0 to High(ATrack) do - for Pet2 := 0 to High(ATrack[Pet].Note) do begin - if ATrack[Pet].Note[Pet2].EventType = 9 then - DrawQuad(60 + ATrack[Pet].Note[Pet2].Start/Len * 725, Y + (Pet+1)*YSkip - ATrack[Pet].Note[Pet2].Data1*35/127, 3, 3, ColR[Pet], ColG[Pet], ColB[Pet]); - if ATrack[Pet].Note[Pet2].EventType = 15 then - DrawLine(60 + ATrack[Pet].Note[Pet2].Start/Len * 725, Y + 0.75 * YSkip + Pet*YSkip, 60 + ATrack[Pet].Note[Pet2].Start/Len * 725, Y + YSkip + Pet*YSkip, ColR[Pet], ColG[Pet], ColB[Pet]); - end; - - // playing line - {$IFDEF UseMIDIPort} - X := 60 + MidiFile.GetCurrentTime/MidiFile.GetTrackLength*730; - {$ENDIF} - DrawLine(X, Y, X, Bottom, 0.3, 0.3, 0.3); - - -end; - -procedure TScreenEditConvert.onHide; -begin -{$IFDEF UseMIDIPort} - MidiOut.Close; - MidiOut.Free; -{$ENDIF} -end; - -end. +unit UScreenEditConvert; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses UMenu, + SDL, + {$IFDEF UseMIDIPort} + MidiFile, + MidiOut, + {$ENDIF} + ULog, + USongs, + UMusic, + UThemes; + +type + TNote = record + Event: integer; + EventType: integer; + Channel: integer; + Start: real; + Len: real; + Data1: integer; + Data2: integer; + Str: string; + end; + + TTrack = record + Note: array of TNote; + Name: string; + Hear: boolean; + Status: byte; // 0 - none, 1 - notes, 2 - lyrics, 3 - notes + lyrics + end; + + TNuta = record + Start: integer; + Len: integer; + Tone: integer; + Lyric: string; + NewSentence: boolean; + end; + + TArrayTrack = array of TTrack; + + TScreenEditConvert = class(TMenu) + public + ATrack: TArrayTrack; // actual track +// Track: TArrayTrack; + Channel: TArrayTrack; + ColR: array[0..100] of real; + ColG: array[0..100] of real; + ColB: array[0..100] of real; + Len: real; + Sel: integer; + Selected: boolean; +// FileName: string; + + {$IFDEF UseMIDIPort} + MidiFile: TMidiFile; + MidiTrack: TMidiTrack; + MidiEvent: pMidiEvent; + MidiOut: TMidiOutput; + {$ENDIF} + + Song: TSong; + Czesc: TCzesci; + BPM: real; + Ticks: real; + Nuta: array of TNuta; + + procedure AddLyric(Start: integer; Tekst: string); + procedure Extract; + + {$IFDEF UseMIDIPort} + procedure MidiFile1MidiEvent(event: PMidiEvent); + {$ENDIF} + + function SelectedNumber: integer; + constructor Create; override; + procedure onShow; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onHide; override; + end; + +implementation +uses UGraphic, + SysUtils, + UDrawTexture, + TextGL, + UFiles, + UMain, + UIni, + OpenGL12, + USkins; + +function TScreenEditConvert.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var + T: integer; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + {$IFDEF UseMIDIPort} + MidiFile.StopPlaying; + {$ENDIF} + AudioPlayback.PlayBack; + FadeTo(@ScreenEdit); + end; + + SDLK_RETURN: + begin + if Interaction = 0 then + begin + AudioPlayback.PlayStart; + ScreenOpen.BackScreen := @ScreenEditConvert; + FadeTo(@ScreenOpen); + end; + + if Interaction = 1 then + begin + Selected := false; + {$IFDEF UseMIDIPort} + MidiFile.OnMidiEvent := MidiFile1MidiEvent; +// MidiFile.GoToTime(MidiFile.GetTrackLength div 2); + MidiFile.StartPlaying; + {$ENDIF} + end; + + if Interaction = 2 then begin + Selected := true; + {$IFDEF UseMIDIPort} + MidiFile.OnMidiEvent := nil; + {$ENDIF} + {for T := 0 to High(ATrack) do begin + if ATrack[T].Hear then begin + MidiTrack := MidiFile.GetTrack(T); + MidiTrack.OnMidiEvent := MidiFile1MidiEvent; + end; + end; + MidiFile.StartPlaying;//} + end; + + if Interaction = 3 then begin + if SelectedNumber > 0 then begin + Extract; + SaveSong(Song, Czesc, ChangeFileExt(FileName, '.txt'), false); + end; + end; + + end; + + SDLK_SPACE: + begin +// ATrack[Sel].Hear := not ATrack[Sel].Hear; + ATrack[Sel].Status := (ATrack[Sel].Status + 1) mod 4; + +{ if Selected then begin + MidiTrack := MidiFile.GetTrack(Sel); + if Track[Sel].Hear then + MidiTrack.OnMidiEvent := MidiFile1MidiEvent + else + MidiTrack.OnMidiEvent := nil; + end;} + end; + + SDLK_RIGHT: + begin + InteractNext; + end; + + SDLK_LEFT: + begin + InteractPrev; + end; + + SDLK_DOWN: + begin + Inc(Sel); + if Sel > High(ATrack) then Sel := 0; + end; + SDLK_UP: + begin + Dec(Sel); + if Sel < 0 then Sel := High(ATrack); + end; + end; + end; +end; + +procedure TScreenEditConvert.AddLyric(Start: integer; Tekst: string); +var + N: integer; +begin + for N := 0 to High(Nuta) do begin + if Nuta[N].Start = Start then begin + // check for new sentece + if Copy(Tekst, 1, 1) = '\' then Delete(Tekst, 1, 1); + if Copy(Tekst, 1, 1) = '/' then begin + Delete(Tekst, 1, 1); + Nuta[N].NewSentence := true; + end; + + // overwrite lyric od append + if Nuta[N].Lyric = '-' then + Nuta[N].Lyric := Tekst + else + Nuta[N].Lyric := Nuta[N].Lyric + Tekst; + end; + end; +end; + +procedure TScreenEditConvert.Extract; +var + T: integer; + C: integer; + N: integer; + Nu: integer; + NutaTemp: TNuta; + Move: integer; + Max, Min: integer; +begin + // song info + Song.Title := ''; + Song.Artist := ''; + Song.Mp3 := ''; + Song.Resolution := 4; + SetLength(Song.BPM, 1); + Song.BPM[0].BPM := BPM*4; + + SetLength(Nuta, 0); + + // extract notes + for T := 0 to High(ATrack) do begin +// if ATrack[T].Hear then begin + if ((ATrack[T].Status div 1) and 1) = 1 then begin + for N := 0 to High(ATrack[T].Note) do begin + if (ATrack[T].Note[N].EventType = 9) and (ATrack[T].Note[N].Data2 > 0) then begin + Nu := Length(Nuta); + SetLength(Nuta, Nu + 1); + Nuta[Nu].Start := Round(ATrack[T].Note[N].Start / Ticks); + Nuta[Nu].Len := Round(ATrack[T].Note[N].Len / Ticks); + Nuta[Nu].Tone := ATrack[T].Note[N].Data1 - 12*5; + Nuta[Nu].Lyric := '-'; + end; + end; + end; + end; + + // extract lyrics + for T := 0 to High(ATrack) do begin +// if ATrack[T].Hear then begin + if ((ATrack[T].Status div 2) and 1) = 1 then begin + for N := 0 to High(ATrack[T].Note) do begin + if (ATrack[T].Note[N].EventType = 15) then begin +// Log.LogStatus('<' + Track[T].Note[N].Str + '>', 'MIDI'); + AddLyric(Round(ATrack[T].Note[N].Start / Ticks), ATrack[T].Note[N].Str); + end; + end; + end; + end; + + // sort notes + for N := 0 to High(Nuta) do + for Nu := 0 to High(Nuta)-1 do + if Nuta[Nu].Start > Nuta[Nu+1].Start then begin + NutaTemp := Nuta[Nu]; + Nuta[Nu] := Nuta[Nu+1]; + Nuta[Nu+1] := NutaTemp; + end; + + // move to 0 at beginning + Move := Nuta[0].Start; + for N := 0 to High(Nuta) do + Nuta[N].Start := Nuta[N].Start - Move; + + // copy notes + SetLength(Czesc.Czesc, 1); + Czesc.Ilosc := 1; + Czesc.High := 0; + + C := 0; + N := 0; + Czesc.Czesc[C].IlNut := 0; + Czesc.Czesc[C].HighNut := -1; + + for Nu := 0 to High(Nuta) do begin + if Nuta[Nu].NewSentence then begin // nowa linijka + SetLength(Czesc.Czesc, Length(Czesc.Czesc)+1); + Czesc.Ilosc := Czesc.Ilosc + 1; + Czesc.High := Czesc.High + 1; + C := C + 1; + N := 0; + SetLength(Czesc.Czesc[C].Nuta, 0); + Czesc.Czesc[C].IlNut := 0; + Czesc.Czesc[C].HighNut := -1; + + //Calculate Start of the Last Sentence + if (C > 0) and (Nu > 0) then + begin + Max := Nuta[Nu].Start; + Min := Nuta[Nu-1].Start + Nuta[Nu-1].Len; + + case (Max - Min) of + 0: Czesc.Czesc[C].Start := Max; + 1: Czesc.Czesc[C].Start := Max; + 2: Czesc.Czesc[C].Start := Max - 1; + 3: Czesc.Czesc[C].Start := Max - 2; + else + if ((Max - Min) > 4) then + Czesc.Czesc[C].Start := Min + 2 + else + Czesc.Czesc[C].Start := Max; + + end; // case + + end; + end; + + // tworzy miejsce na nowa nute + SetLength(Czesc.Czesc[C].Nuta, Length(Czesc.Czesc[C].Nuta)+1); + Czesc.Czesc[C].IlNut := Czesc.Czesc[C].IlNut + 1; + Czesc.Czesc[C].HighNut := Czesc.Czesc[C].HighNut + 1; + + // dopisuje + Czesc.Czesc[C].Nuta[N].Start := Nuta[Nu].Start; + Czesc.Czesc[C].Nuta[N].Dlugosc := Nuta[Nu].Len; + Czesc.Czesc[C].Nuta[N].Ton := Nuta[Nu].Tone; + Czesc.Czesc[C].Nuta[N].Tekst := Nuta[Nu].Lyric; + //All Notes are Freestyle when Converted Fix: + Czesc.Czesc[C].Nuta[N].Wartosc := 1; + Inc(N); + end; +end; + +function TScreenEditConvert.SelectedNumber: integer; +var + T: integer; // track +begin + Result := 0; + for T := 0 to High(ATrack) do +// if ATrack[T].Hear then Inc(Result); + if ((ATrack[T].Status div 1) and 1) = 1 then Inc(Result); +end; + +{$IFDEF UseMIDIPort} +procedure TScreenEditConvert.MidiFile1MidiEvent(event: PMidiEvent); +begin +// Log.LogStatus(IntToStr(event.event), 'MIDI'); + MidiOut.PutShort(event.event, event.data1, event.data2); +end; +{$ENDIF} + +constructor TScreenEditConvert.Create; +var + P: integer; +begin + inherited Create; + AddButton(40, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(15, 5, 0, 0, 0, 'Open'); +// Button[High(Button)].Text[0].Size := 11; + + AddButton(160, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(25, 5, 0, 0, 0, 'Play'); + + AddButton(280, 20, 200, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(25, 5, 0, 0, 0, 'Play Selected'); + + AddButton(500, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(20, 5, 0, 0, 0, 'Save'); + + +{ MidiOut := TMidiOutput.Create(nil); +// MidiOut.Close; +// MidiOut.DeviceID := 0; + if Ini.Debug = 1 then + MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table + Log.LogStatus(MidiOut.ProductName, 'MIDI'); + MidiOut.Open; +// MidiOut.SetVolume(100, 100); // temporary} + + FileName := GamePath + 'file.mid'; + {$IFDEF UseMIDIPort} + MidiFile := TMidiFile.Create(nil); + {$ENDIF} + + for P := 0 to 100 do begin + ColR[P] := Random(10)/10; + ColG[P] := Random(10)/10; + ColB[P] := Random(10)/10; + end; + +end; + +procedure TScreenEditConvert.onShow; +var + T: integer; // track + N: integer; // note + C: integer; // channel + CN: integer; // channel note +begin +{$IFDEF UseMIDIPort} + MidiOut := TMidiOutput.Create(nil); + if Ini.Debug = 1 then + MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table + Log.LogStatus(MidiOut.ProductName, 'MIDI'); + MidiOut.Open; + + + if FileExists(FileName) then + begin + MidiFile.Filename := FileName; + MidiFile.ReadFile; + + + Len := 0; + Sel := 0; + BPM := MidiFile.Bpm; + Ticks := MidiFile.TicksPerQuarter / 4; + +{ for T := 0 to MidiFile.NumberOfTracks-1 do begin + SetLength(Track, Length(Track)+1); + MidiTrack := MidiFile.GetTrack(T); + MidiTrack.OnMidiEvent := MidiFile1MidiEvent; + Track[T].Name := MidiTrack.getName; + + for N := 0 to MidiTrack.getEventCount-1 do begin + SetLength(Track[T].Note, Length(Track[T].Note)+1); + MidiEvent := MidiTrack.GetEvent(N); + Track[T].Note[N].Start := MidiEvent.time; + Track[T].Note[N].Len := MidiEvent.len; + Track[T].Note[N].Event := MidiEvent.event; + Track[T].Note[N].EventType := MidiEvent.event div 16; + Track[T].Note[N].Channel := MidiEvent.event and 15; + Track[T].Note[N].Data1 := MidiEvent.data1; + Track[T].Note[N].Data2 := MidiEvent.data2; + Track[T].Note[N].Str := MidiEvent.str; + + if Track[T].Note[N].Start + Track[T].Note[N].Len > Len then + Len := Track[T].Note[N].Start + Track[T].Note[N].Len; + end; + end;} + + + SetLength(Channel, 16); + for T := 0 to 15 do + begin + Channel[T].Name := IntToStr(T+1); + SetLength(Channel[T].Note, 0); + Channel[T].Status := 0; + end; + + for T := 0 to MidiFile.NumberOfTracks-1 do begin + MidiTrack := MidiFile.GetTrack(T); + MidiTrack.OnMidiEvent := MidiFile1MidiEvent; + + for N := 0 to MidiTrack.getEventCount-1 do begin + MidiEvent := MidiTrack.GetEvent(N); + C := MidiEvent.event and 15; + + CN := Length(Channel[C].Note); + SetLength(Channel[C].Note, CN+1); + + Channel[C].Note[CN].Start := MidiEvent.time; + Channel[C].Note[CN].Len := MidiEvent.len; + Channel[C].Note[CN].Event := MidiEvent.event; + Channel[C].Note[CN].EventType := MidiEvent.event div 16; + Channel[C].Note[CN].Channel := MidiEvent.event and 15; + Channel[C].Note[CN].Data1 := MidiEvent.data1; + Channel[C].Note[CN].Data2 := MidiEvent.data2; + Channel[C].Note[CN].Str := MidiEvent.str; + + if Channel[C].Note[CN].Start + Channel[C].Note[CN].Len > Len then + Len := Channel[C].Note[CN].Start + Channel[C].Note[CN].Len; + end; + end; + ATrack := Channel; + + end; + + Interaction := 0; +{$ENDIF} +end; + +function TScreenEditConvert.Draw: boolean; +var + Pet: integer; + Pet2: integer; + Bottom: real; + X: real; + Y: real; + H: real; + YSkip: real; +begin + // draw static menu + inherited Draw; + + Y := 100; + + H := Length(ATrack)*40; + if H > 480 then H := 480; + Bottom := Y + H; + + YSkip := H / Length(ATrack); + + // select + DrawQuad(10, Y+Sel*YSkip, 780, YSkip, 0.8, 0.8, 0.8); + + // selected - now me use Status System + for Pet := 0 to High(ATrack) do + if ATrack[Pet].Hear then + DrawQuad(10, Y+Pet*YSkip, 50, YSkip, 0.8, 0.3, 0.3); + glColor3f(0, 0, 0); + for Pet := 0 to High(ATrack) do begin + if ((ATrack[Pet].Status div 1) and 1) = 1 then begin + SetFontPos(25, Y + Pet*YSkip + 10); + SetFontSize(5); + glPrint('N'); + end; + if ((ATrack[Pet].Status div 2) and 1) = 1 then begin + SetFontPos(40, Y + Pet*YSkip + 10); + SetFontSize(5); + glPrint('L'); + end; + end; + + DrawLine(10, Y, 10, Bottom, 0, 0, 0); + DrawLine(60, Y, 60, Bottom, 0, 0, 0); + DrawLine(790, Y, 790, Bottom, 0, 0, 0); + + for Pet := 0 to Length(ATrack) do + DrawLine(10, Y+Pet*YSkip, 790, Y+Pet*YSkip, 0, 0, 0); + + for Pet := 0 to High(ATrack) do begin + SetFontPos(11, Y + 10 + Pet*YSkip); + SetFontSize(5); + glPrint(pchar(ATrack[Pet].Name)); + end; + + for Pet := 0 to High(ATrack) do + for Pet2 := 0 to High(ATrack[Pet].Note) do begin + if ATrack[Pet].Note[Pet2].EventType = 9 then + DrawQuad(60 + ATrack[Pet].Note[Pet2].Start/Len * 725, Y + (Pet+1)*YSkip - ATrack[Pet].Note[Pet2].Data1*35/127, 3, 3, ColR[Pet], ColG[Pet], ColB[Pet]); + if ATrack[Pet].Note[Pet2].EventType = 15 then + DrawLine(60 + ATrack[Pet].Note[Pet2].Start/Len * 725, Y + 0.75 * YSkip + Pet*YSkip, 60 + ATrack[Pet].Note[Pet2].Start/Len * 725, Y + YSkip + Pet*YSkip, ColR[Pet], ColG[Pet], ColB[Pet]); + end; + + // playing line + {$IFDEF UseMIDIPort} + X := 60 + MidiFile.GetCurrentTime/MidiFile.GetTrackLength*730; + {$ENDIF} + DrawLine(X, Y, X, Bottom, 0.3, 0.3, 0.3); + + +end; + +procedure TScreenEditConvert.onHide; +begin +{$IFDEF UseMIDIPort} + MidiOut.Close; + MidiOut.Free; +{$ENDIF} +end; + +end. diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index d24fdede..6dcb1f5f 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -1,1373 +1,1376 @@ -unit UScreenEditSub; - -interface - -{$I switches.inc} - -uses - UMenu, - UMusic, - SDL, - SysUtils, - UFiles, - UTime, - USongs, - UIni, - ULog, - UTexture, - UMenuText, - ULyrics_bak, - Math, - OpenGL12, - {$IFDEF UseMIDIPort} - MidiOut, - {$ENDIF} - UThemes; - -type - TScreenEditSub = class(TMenu) - private - //Variable is True if no SOng is loaded - Error: Boolean; - - TextNote: integer; - TextSentence: integer; - TextTitle: integer; - TextArtist: integer; - TextMp3: integer; - TextBPM: integer; - TextGAP: integer; - TextDebug: integer; - TextNStart: integer; - TextNDlugosc: integer; - TextNTon: integer; - TextNText: integer; - AktNuta: integer; - PlaySentence: boolean; - PlaySentenceMidi: boolean; - PlayStopTime: real; - LastClick: integer; - Click: boolean; - CopySrc: integer; - - {$IFDEF UseMIDIPort} - MidiOut: TMidiOutput; - {$endif} - - MidiStart: real; - MidiStop: real; - MidiTime: real; - MidiPos: real; - MidiLastNote: integer; - - TextEditMode: boolean; - - procedure NewBeat; - procedure CzesciDivide; - procedure CzesciMultiply; - procedure LyricsCapitalize; - procedure LyricsCorrectSpaces; - procedure FixTimings; - procedure DivideSentence; - procedure JoinSentence; - procedure DivideNote; - procedure DeleteNote; - procedure TransposeNote(Transpose: integer); - procedure ChangeWholeTone(Tone: integer); - procedure MoveAllToEnd(Move: integer); - procedure MoveTextToRight; - procedure MarkSrc; - procedure PasteText; - procedure CopySentence(Src, Dst: integer); - procedure CopySentences(Src, Dst, Num: integer); - //Note Name Mod - function GetNoteName(Note: Integer): String; - public - Tex_Background: TTexture; - FadeOut: boolean; - Path: string; - FileName: string; - constructor Create; override; - procedure onShow; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function ParseInputEditText(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; - function Draw: boolean; override; - procedure onHide; override; - end; - -implementation -uses UGraphic, UDraw, UMain, USkins, ULanguage; - -// Method for input parsing. If False is returned, GetNextWindow -// should be checked to know the next window to load; -function TScreenEditSub.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -var - SDL_ModState: Word; - R: real; -begin - Result := true; - - if TextEditMode then begin - Result := ParseInputEditText(PressedKey, ScanCode, PressedDown); - end else begin - - SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT - + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT {+ KMOD_CAPS}); - - If (PressedDown) then begin // Key Down - case PressedKey of - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - FadeTo(@ScreenSong); - end; - - SDLK_Q: - begin - Result := false; - end; - - SDLK_BACKQUOTE: - begin - // Increase Note Length (same as Alt + Right) - Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); - if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then - Inc(Czesci[0].Czesc[Czesci[0].Akt].Koniec); - end; - - SDLK_EQUALS: - begin - // Increase BPM - if SDL_ModState = 0 then - AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 5) + 1) / 5; // (1/20) - if SDL_ModState = KMOD_LSHIFT then - AktSong.BPM[0].BPM := AktSong.BPM[0].BPM + 4; // (1/1) - if SDL_ModState = KMOD_LCTRL then - AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 25) + 1) / 25; // (1/100) - end; - - SDLK_MINUS: - begin - // Decrease BPM - if SDL_ModState = 0 then - AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 5) - 1) / 5; - if SDL_ModState = KMOD_LSHIFT then - AktSong.BPM[0].BPM := AktSong.BPM[0].BPM - 4; - if SDL_ModState = KMOD_LCTRL then - AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 25) - 1) / 25; - end; - - SDLK_0: - begin - // Increase GAP - if SDL_ModState = 0 then - AktSong.GAP := AktSong.GAP + 10; - if SDL_ModState = KMOD_LSHIFT then - AktSong.GAP := AktSong.GAP + 1000; - end; - - SDLK_9: - begin - // Decrease GAP - if SDL_ModState = 0 then - AktSong.GAP := AktSong.GAP - 10; - if SDL_ModState = KMOD_LSHIFT then - AktSong.GAP := AktSong.GAP - 1000; - end; - - SDLK_KP_PLUS: - begin - // Increase tone of all notes - if SDL_ModState = 0 then - ChangeWholeTone(1); - if SDL_ModState = KMOD_LSHIFT then - ChangeWholeTone(12); - end; - - SDLK_KP_MINUS: - begin - // Decrease tone of all notes - if SDL_ModState = 0 then - ChangeWholeTone(-1); - if SDL_ModState = KMOD_LSHIFT then - ChangeWholeTone(-12); - end; - - SDLK_SLASH: - begin - if SDL_ModState = 0 then begin - // Insert start of sentece - if AktNuta > 0 then - DivideSentence; - end; - - if SDL_ModState = KMOD_LSHIFT then begin - // Join next sentence with current - if Czesci[0].Akt < Czesci[0].High then - JoinSentence; - end; - - if SDL_ModState = KMOD_LCTRL then begin - // divide note - DivideNote; - end; - - end; - - SDLK_S: - begin - // Save Song - if SDL_ModState = KMOD_LSHIFT then - SaveSong(AktSong, Czesci[0], Path + FileName, true) - else - SaveSong(AktSong, Czesci[0], Path + FileName, false); - - {if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL + KMOD_LALT then - // Save Song - SaveSongDebug(AktSong, Czesci[0], 'C:\song.asm', false);} - - end; - - SDLK_D: - begin - // Divide lengths by 2 - CzesciDivide; - end; - - SDLK_M: - begin - // Multiply lengths by 2 - CzesciMultiply; - end; - - SDLK_C: - begin - // Capitalize letter at the beginning of line - if SDL_ModState = 0 then - LyricsCapitalize; - - // Correct spaces - if SDL_ModState = KMOD_LSHIFT then - LyricsCorrectSpaces; - - // Copy sentence - if SDL_ModState = KMOD_LCTRL then - MarkSrc; - end; - - SDLK_V: - begin - // Paste text - if SDL_ModState = KMOD_LCTRL then begin - if Czesci[0].Czesc[Czesci[0].Akt].IlNut >= Czesci[0].Czesc[CopySrc].IlNut then - PasteText - else - beep; - end; - - if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then begin - CopySentence(CopySrc, Czesci[0].Akt); - end; - end; - - SDLK_4: - begin - if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then begin - CopySentence(CopySrc, Czesci[0].Akt); - CopySentence(CopySrc+1, Czesci[0].Akt+1); - CopySentence(CopySrc+2, Czesci[0].Akt+2); - CopySentence(CopySrc+3, Czesci[0].Akt+3); - end; - - if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT + KMOD_LALT then begin - CopySentences(CopySrc, Czesci[0].Akt, 4); - end; - end; - SDLK_5: - begin - if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then begin - CopySentence(CopySrc, Czesci[0].Akt); - CopySentence(CopySrc+1, Czesci[0].Akt+1); - CopySentence(CopySrc+2, Czesci[0].Akt+2); - CopySentence(CopySrc+3, Czesci[0].Akt+3); - CopySentence(CopySrc+4, Czesci[0].Akt+4); - end; - - if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT + KMOD_LALT then begin - CopySentences(CopySrc, Czesci[0].Akt, 5); - end; - end; - - SDLK_T: - begin - // Fixes timings between sentences - FixTimings; - end; - - SDLK_F4: - begin - // Enter Text Edit Mode - TextEditMode := true; - end; - - SDLK_P: - begin - if SDL_ModState = 0 then begin - // Play Sentence - Click := true; - AudioPlayback.Stop; - R := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote); - if R <= AudioPlayback.Length then begin - AudioPlayback.MoveTo(R); - PlayStopTime := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec); - PlaySentence := true; - AudioPlayback.Play; - LastClick := -100; - end; - end; - - if SDL_ModState = KMOD_LSHIFT then begin - PlaySentenceMidi := true; - - MidiTime := USTime.GetTime; - MidiStart := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote); - MidiStop := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec); - - LastClick := -100; - end; - if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL then begin - PlaySentenceMidi := true; - MidiTime := USTime.GetTime; - MidiStart := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote); - MidiStop := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec); - LastClick := -100; - - PlaySentence := true; - Click := true; - AudioPlayback.Stop; - AudioPlayback.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote)+0{-0.10}); - PlayStopTime := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec)+0; - AudioPlayback.Play; - LastClick := -100; - end; - end; - - SDLK_SPACE: - begin - // Play Sentence - PlaySentenceMidi := false; // stop midi - PlaySentence := true; - Click := false; - AudioPlayback.Stop; - AudioPlayback.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start)); - PlayStopTime := (GetTimeFromBeat( - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start + - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc)); - AudioPlayback.Play; - LastClick := -100; - end; - - SDLK_RETURN: - begin - end; - - SDLK_LCTRL: - begin - end; - - SDLK_DELETE: - begin - if SDL_ModState = KMOD_LCTRL then begin - // moves text to right in current sentence - DeleteNote; - end; - end; - - SDLK_PERIOD: - begin - // moves text to right in current sentence - MoveTextToRight; - end; - - SDLK_RIGHT: - begin - // right - if SDL_ModState = 0 then begin - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0; - Inc(AktNuta); - if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].IlNut then AktNuta := 0; - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; - Lyric.Selected := AktNuta; - end; - - // ctrl + right - if SDL_ModState = KMOD_LCTRL then begin - if Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc > 1 then begin - Dec(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); - Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start); - if AktNuta = 0 then begin - Inc(Czesci[0].Czesc[Czesci[0].Akt].Start); - Inc(Czesci[0].Czesc[Czesci[0].Akt].StartNote); - end; - end; - end; - - // shift + right - if SDL_ModState = KMOD_LSHIFT then begin - Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start); - if AktNuta = 0 then begin - Inc(Czesci[0].Czesc[Czesci[0].Akt].Start); - Inc(Czesci[0].Czesc[Czesci[0].Akt].StartNote); - end; - if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then - Inc(Czesci[0].Czesc[Czesci[0].Akt].Koniec); - end; - - // alt + right - if SDL_ModState = KMOD_LALT then begin - Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); - if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then - Inc(Czesci[0].Czesc[Czesci[0].Akt].Koniec); - end; - - // alt + ctrl + shift + right = move all from cursor to right - if SDL_ModState = KMOD_LALT + KMOD_LCTRL + KMOD_LSHIFT then begin - MoveAllToEnd(1); - end; - - end; - - SDLK_LEFT: - begin - // left - if SDL_ModState = 0 then begin - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0; - Dec(AktNuta); - if AktNuta = -1 then AktNuta := Czesci[0].Czesc[Czesci[0].Akt].HighNut; - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; - Lyric.Selected := AktNuta; - end; - - // ctrl + left - if SDL_ModState = KMOD_LCTRL then begin - Dec(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start); - Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); - if AktNuta = 0 then begin - Dec(Czesci[0].Czesc[Czesci[0].Akt].Start); - Dec(Czesci[0].Czesc[Czesci[0].Akt].StartNote); - end; - end; - - // shift + left - if SDL_ModState = KMOD_LSHIFT then begin - Dec(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start); - - // resizing sentences - if AktNuta = 0 then begin - Dec(Czesci[0].Czesc[Czesci[0].Akt].Start); - Dec(Czesci[0].Czesc[Czesci[0].Akt].StartNote); - end; - - if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then - Dec(Czesci[0].Czesc[Czesci[0].Akt].Koniec); - - end; - - // alt + left - if SDL_ModState = KMOD_LALT then begin - if Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc > 1 then begin - Dec(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); - if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then - Dec(Czesci[0].Czesc[Czesci[0].Akt].Koniec); - end; - end; - - // alt + ctrl + shift + right = move all from cursor to left - if SDL_ModState = KMOD_LALT + KMOD_LCTRL + KMOD_LSHIFT then begin - MoveAllToEnd(-1); - end; - - end; - - SDLK_DOWN: - begin - {$IFDEF UseMIDIPort} - // skip to next sentence - if SDL_ModState = 0 then begin - MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127); - PlaySentenceMidi := false; - - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0; - Inc(Czesci[0].Akt); - AktNuta := 0; - if Czesci[0].Akt > Czesci[0].High then Czesci[0].Akt := 0; - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; - - Lyric.AddCzesc(Czesci[0].Akt); - Lyric.Selected := 0; - AudioPlayback.Stop; - PlaySentence := false; - end; - - // decrease tone - if SDL_ModState = KMOD_LCTRL then begin - TransposeNote(-1); - end; - {$endif} - - end; - - SDLK_UP: - begin - {$IFDEF UseMIDIPort} - // skip to previous sentence - if SDL_ModState = 0 then begin - MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127); - PlaySentenceMidi := false; - - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0; - Dec(Czesci[0].Akt); - AktNuta := 0; - if Czesci[0].Akt = -1 then Czesci[0].Akt := Czesci[0].High; - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; - - Lyric.AddCzesc(Czesci[0].Akt); - Lyric.Selected := 0; - AudioPlayback.Stop; - PlaySentence := false; - end; - - // increase tone - if SDL_ModState = KMOD_LCTRL then begin - TransposeNote(1); - end; - {$endif} - end; - - // Golden Note Patch - SDLK_G: - begin - case Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc of - 0: Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 2; - 1: Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 2; - 2: Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 1; - end; // case - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Freestyle := False; - end; - - // Freestyle Note Patch - SDLK_F: - begin - case Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc of - 0: - begin; - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 1; - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Freestyle := False; - end; - 1,2: - begin; - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 0; - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Freestyle := True; - end; - end; // case - - end; - - - end; - end; - end; // if -end; - -function TScreenEditSub.ParseInputEditText(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -var - SDL_ModState: Word; -begin - // used when in Text Edit Mode - Result := true; - - SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT - + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT {+ KMOD_CAPS}); - - If (PressedDown) Then - begin // Key Down - case PressedKey of - - SDLK_ESCAPE: - begin - FadeTo(@ScreenSong); - end; - SDLK_F4, SDLK_RETURN: - begin - // Exit Text Edit Mode - TextEditMode := false; - end; - SDLK_0..SDLK_9, SDLK_A..SDLK_Z, SDLK_SPACE, SDLK_MINUS, SDLK_EXCLAIM, SDLK_COMMA, SDLK_SLASH, SDLK_ASTERISK, SDLK_QUESTION, SDLK_QUOTE, SDLK_QUOTEDBL: - begin - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst := - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst + chr(ScanCode); - end; - SDLK_BACKSPACE: - begin - Delete(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst, - Length(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst), 1); - end; - SDLK_RIGHT: - begin - // right - if SDL_ModState = 0 then begin - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0; - Inc(AktNuta); - if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].IlNut then AktNuta := 0; - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; - Lyric.Selected := AktNuta; - end; - end; - SDLK_LEFT: - begin - // left - if SDL_ModState = 0 then begin - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0; - Dec(AktNuta); - if AktNuta = -1 then AktNuta := Czesci[0].Czesc[Czesci[0].Akt].HighNut; - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; - Lyric.Selected := AktNuta; - end; - end; - end; - end; -end; - -procedure TScreenEditSub.NewBeat; -begin - // click -{ for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do - if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeat) then begin - // old} -// Music.PlayClick; -end; - -procedure TScreenEditSub.CzesciDivide; -var - C: integer; - N: integer; -begin - AktSong.BPM[0].BPM := AktSong.BPM[0].BPM / 2; - for C := 0 to Czesci[0].High do begin - Czesci[0].Czesc[C].Start := Czesci[0].Czesc[C].Start div 2; - Czesci[0].Czesc[C].StartNote := Czesci[0].Czesc[C].StartNote div 2; - Czesci[0].Czesc[C].Koniec := Czesci[0].Czesc[C].Koniec div 2; - for N := 0 to Czesci[0].Czesc[C].HighNut do begin - Czesci[0].Czesc[C].Nuta[N].Start := Czesci[0].Czesc[C].Nuta[N].Start div 2; - Czesci[0].Czesc[C].Nuta[N].Dlugosc := Round(Czesci[0].Czesc[C].Nuta[N].Dlugosc / 2); - end; // N - end; // C -end; - -procedure TScreenEditSub.CzesciMultiply; -var - C: integer; - N: integer; -begin - AktSong.BPM[0].BPM := AktSong.BPM[0].BPM * 2; - for C := 0 to Czesci[0].High do begin - Czesci[0].Czesc[C].Start := Czesci[0].Czesc[C].Start * 2; - Czesci[0].Czesc[C].StartNote := Czesci[0].Czesc[C].StartNote * 2; - Czesci[0].Czesc[C].Koniec := Czesci[0].Czesc[C].Koniec * 2; - for N := 0 to Czesci[0].Czesc[C].HighNut do begin - Czesci[0].Czesc[C].Nuta[N].Start := Czesci[0].Czesc[C].Nuta[N].Start * 2; - Czesci[0].Czesc[C].Nuta[N].Dlugosc := Czesci[0].Czesc[C].Nuta[N].Dlugosc * 2; - end; // N - end; // C -end; - -procedure TScreenEditSub.LyricsCapitalize; -var - C: integer; - N: integer; // temporary - S: string; -begin - // temporary -{ for C := 0 to Czesci[0].High do - for N := 0 to Czesci[0].Czesc[C].HighNut do - Czesci[0].Czesc[C].Nuta[N].Tekst := AnsiLowerCase(Czesci[0].Czesc[C].Nuta[N].Tekst);} - - for C := 0 to Czesci[0].High do begin - S := AnsiUpperCase(Copy(Czesci[0].Czesc[C].Nuta[0].Tekst, 1, 1)); - S := S + Copy(Czesci[0].Czesc[C].Nuta[0].Tekst, 2, Length(Czesci[0].Czesc[C].Nuta[0].Tekst)-1); - Czesci[0].Czesc[C].Nuta[0].Tekst := S; - end; // C -end; - -procedure TScreenEditSub.LyricsCorrectSpaces; -var - C: integer; - N: integer; -begin - for C := 0 to Czesci[0].High do begin - // correct starting spaces in the first word - while Copy(Czesci[0].Czesc[C].Nuta[0].Tekst, 1, 1) = ' ' do - Czesci[0].Czesc[C].Nuta[0].Tekst := Copy(Czesci[0].Czesc[C].Nuta[0].Tekst, 2, 100); - - // move spaces on the start to the end of the previous note - for N := 1 to Czesci[0].Czesc[C].HighNut do begin - while (Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, 1, 1) = ' ') do begin - Czesci[0].Czesc[C].Nuta[N].Tekst := Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, 2, 100); - Czesci[0].Czesc[C].Nuta[N-1].Tekst := Czesci[0].Czesc[C].Nuta[N-1].Tekst + ' '; - end; - end; // N - - // correct '-' to '- ' - for N := 0 to Czesci[0].Czesc[C].HighNut do begin - if Czesci[0].Czesc[C].Nuta[N].Tekst = '-' then - Czesci[0].Czesc[C].Nuta[N].Tekst := '- '; - end; // N - - // add space to the previous note when the current word is '- ' - for N := 1 to Czesci[0].Czesc[C].HighNut do begin - if Czesci[0].Czesc[C].Nuta[N].Tekst = '- ' then - Czesci[0].Czesc[C].Nuta[N-1].Tekst := Czesci[0].Czesc[C].Nuta[N-1].Tekst + ' '; - end; // N - - // correct too many spaces at the end of note - for N := 0 to Czesci[0].Czesc[C].HighNut do begin - while Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, Length(Czesci[0].Czesc[C].Nuta[N].Tekst)-1, 2) = ' ' do - Czesci[0].Czesc[C].Nuta[N].Tekst := Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, 1, Length(Czesci[0].Czesc[C].Nuta[N].Tekst)-1); - end; // N - - // and correct if there is no space at the end of sentence - N := Czesci[0].Czesc[C].HighNut; - if Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, Length(Czesci[0].Czesc[C].Nuta[N].Tekst), 1) <> ' ' then - Czesci[0].Czesc[C].Nuta[N].Tekst := Czesci[0].Czesc[C].Nuta[N].Tekst + ' '; - - end; // C -end; - -procedure TScreenEditSub.FixTimings; -var - C: integer; - S: integer; - Min: integer; - Max: integer; -begin - for C := 1 to Czesci[0].High do begin - with Czesci[0].Czesc[C-1] do begin - Min := Nuta[HighNut].Start + Nuta[HighNut].Dlugosc; - Max := Czesci[0].Czesc[C].StartNote; - case (Max - Min) of - 0: S := Max; - 1: S := Max; - 2: S := Max - 1; - 3: S := Max - 2; - else - if ((Max - Min) > 4) then - S := Min + 2 - else - S := Max; - end; // case - - Czesci[0].Czesc[C].Start := S; - end; // with - end; // for -end; - -procedure TScreenEditSub.DivideSentence; -var - C: integer; - CStart: integer; - CNew: integer; - CLen: integer; - N: integer; - NStart: integer; - NHigh: integer; - NNewL: integer; -begin - // increase sentence length by 1 - CLen := Length(Czesci[0].Czesc); - SetLength(Czesci[0].Czesc, CLen + 1); - Inc(Czesci[0].Ilosc); - Inc(Czesci[0].High); - - // move needed sentences to one forward. newly has the copy of divided sentence - CStart := Czesci[0].Akt; - for C := CLen-1 downto CStart do - Czesci[0].Czesc[C+1] := Czesci[0].Czesc[C]; - - // clear and set new sentence - CNew := CStart + 1; - NStart := AktNuta; - Czesci[0].Czesc[CNew].Start := Czesci[0].Czesc[CStart].Nuta[NStart].Start; - Czesci[0].Czesc[CNew].StartNote := Czesci[0].Czesc[CStart].Nuta[NStart].Start; - Czesci[0].Czesc[CNew].Lyric := ''; - Czesci[0].Czesc[CNew].LyricWidth := 0; - Czesci[0].Czesc[CNew].Koniec := 0; - Czesci[0].Czesc[CNew].BaseNote := 0; // 0.5.0: we modify it later in this procedure - Czesci[0].Czesc[CNew].IlNut := 0; - Czesci[0].Czesc[CNew].HighNut := -1; - SetLength(Czesci[0].Czesc[CNew].Nuta, 0); - - // move right notes to new sentences - NHigh := Czesci[0].Czesc[CStart].HighNut; - for N := NStart to NHigh do begin - NNewL := Czesci[0].Czesc[CNew].IlNut; - SetLength(Czesci[0].Czesc[CNew].Nuta, NNewL + 1); - Czesci[0].Czesc[CNew].Nuta[NNewL] := Czesci[0].Czesc[CStart].Nuta[N]; - - // increase sentence counters - Inc(Czesci[0].Czesc[CNew].IlNut); - Inc(Czesci[0].Czesc[CNew].HighNut); - Czesci[0].Czesc[CNew].Koniec := Czesci[0].Czesc[CNew].Nuta[NNewL].Start + - Czesci[0].Czesc[CNew].Nuta[NNewL].Dlugosc; - end; - - // clear old notes and set sentence counters - Czesci[0].Czesc[CStart].HighNut := NStart - 1; - Czesci[0].Czesc[CStart].IlNut := Czesci[0].Czesc[CStart].HighNut + 1; - Czesci[0].Czesc[CStart].Koniec := Czesci[0].Czesc[CStart].Nuta[NStart-1].Start + - Czesci[0].Czesc[CStart].Nuta[NStart-1].Dlugosc; - SetLength(Czesci[0].Czesc[CStart].Nuta, Czesci[0].Czesc[CStart].IlNut); - - // 0.5.0: modify BaseNote - Czesci[0].Czesc[CNew].BaseNote := 120; - for N := 0 to Czesci[0].Czesc[CNew].IlNut do - if Czesci[0].Czesc[CNew].Nuta[N].Ton < Czesci[0].Czesc[CNew].BaseNote then - Czesci[0].Czesc[CNew].BaseNote := Czesci[0].Czesc[CNew].Nuta[N].Ton; - - Czesci[0].Akt := Czesci[0].Akt + 1; - AktNuta := 0; - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; - Lyric.AddCzesc(Czesci[0].Akt); - -end; - -procedure TScreenEditSub.JoinSentence; -var - C: integer; - N: integer; - NStart: integer; - NDst: integer; -begin - C := Czesci[0].Akt; - - // set new sentence - NStart := Czesci[0].Czesc[C].IlNut; - Czesci[0].Czesc[C].IlNut := Czesci[0].Czesc[C].IlNut + Czesci[0].Czesc[C+1].IlNut; - Czesci[0].Czesc[C].HighNut := Czesci[0].Czesc[C].HighNut + Czesci[0].Czesc[C+1].IlNut; - SetLength(Czesci[0].Czesc[C].Nuta, Czesci[0].Czesc[C].IlNut); - - // move right notes to new sentences - for N := 0 to Czesci[0].Czesc[C+1].HighNut do begin - NDst := NStart + N; - Czesci[0].Czesc[C].Nuta[NDst] := Czesci[0].Czesc[C+1].Nuta[N]; - end; - - // increase sentence counters - NDst := Czesci[0].Czesc[C].HighNut; - Czesci[0].Czesc[C].Koniec := Czesci[0].Czesc[C].Nuta[NDst].Start + - Czesci[0].Czesc[C].Nuta[NDst].Dlugosc; - - // move needed sentences to one backward. - for C := Czesci[0].Akt + 1 to Czesci[0].High - 1 do - Czesci[0].Czesc[C] := Czesci[0].Czesc[C+1]; - - // increase sentence length by 1 - SetLength(Czesci[0].Czesc, Length(Czesci[0].Czesc) - 1); - Dec(Czesci[0].Ilosc); - Dec(Czesci[0].High); -end; - -procedure TScreenEditSub.DivideNote; -var - C: integer; - N: integer; - NLen: integer; -begin - C := Czesci[0].Akt; - - NLen := Czesci[0].Czesc[C].IlNut + 1; - SetLength(Czesci[0].Czesc[C].Nuta, NLen); - Inc(Czesci[0].Czesc[C].HighNut); - Inc(Czesci[0].Czesc[C].IlNut); - - // we copy all notes including selected one - for N := Czesci[0].Czesc[C].HighNut downto AktNuta+1 do begin - Czesci[0].Czesc[C].Nuta[N] := Czesci[0].Czesc[C].Nuta[N-1]; - end; - - // me slightly modify new note - Czesci[0].Czesc[C].Nuta[AktNuta].Dlugosc := 1; - Inc(Czesci[0].Czesc[C].Nuta[AktNuta+1].Start); - Dec(Czesci[0].Czesc[C].Nuta[AktNuta+1].Dlugosc); - Czesci[0].Czesc[C].Nuta[AktNuta+1].Tekst := '- '; - Czesci[0].Czesc[C].Nuta[AktNuta+1].Color := 0; -end; - -procedure TScreenEditSub.DeleteNote; -var - C: integer; - N: integer; - NLen: integer; -begin - C := Czesci[0].Akt; - - //Do Not delete Last Note - if (Czesci[0].High > 0) OR (Czesci[0].Czesc[C].HighNut > 0) then - begin - - // we copy all notes from the next to the selected one - for N := AktNuta+1 to Czesci[0].Czesc[C].HighNut do begin - Czesci[0].Czesc[C].Nuta[N-1] := Czesci[0].Czesc[C].Nuta[N]; - end; - - NLen := Czesci[0].Czesc[C].IlNut - 1; - - if (NLen > 0) then - begin - SetLength(Czesci[0].Czesc[C].Nuta, NLen); - Dec(Czesci[0].Czesc[C].HighNut); - Dec(Czesci[0].Czesc[C].IlNut); - - - // me slightly modify new note - if AktNuta > Czesci[0].Czesc[C].HighNut then Dec(AktNuta); - Czesci[0].Czesc[C].Nuta[AktNuta].Color := 1; - end - //Last Note of current Sentence Deleted - > Delete Sentence - else - begin - //Move all Sentences after the current to the Left - for N := C+1 to Czesci[0].High do - Czesci[0].Czesc[N-1] := Czesci[0].Czesc[N]; - - //Delete Last Sentence - SetLength(Czesci[0].Czesc, Czesci[0].High); - Czesci[0].High := High(Czesci[0].Czesc); - Czesci[0].Ilosc := Length(Czesci[0].Czesc); - - AktNuta := 0; - if (C > 0) then - Czesci[0].Akt := C - 1 - else - Czesci[0].Akt := 0; - - Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; - end; - end; -end; - -procedure TScreenEditSub.TransposeNote(Transpose: integer); -begin - Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton, Transpose); -end; - -procedure TScreenEditSub.ChangeWholeTone(Tone: integer); -var - C: integer; - N: integer; -begin - for C := 0 to Czesci[0].High do begin - Czesci[0].Czesc[C].BaseNote := Czesci[0].Czesc[C].BaseNote + Tone; - for N := 0 to Czesci[0].Czesc[C].HighNut do - Czesci[0].Czesc[C].Nuta[N].Ton := Czesci[0].Czesc[C].Nuta[N].Ton + Tone; - end; -end; - -procedure TScreenEditSub.MoveAllToEnd(Move: integer); -var - C: integer; - N: integer; - NStart: integer; -begin - for C := Czesci[0].Akt to Czesci[0].High do begin - NStart := 0; - if C = Czesci[0].Akt then NStart := AktNuta; - for N := NStart to Czesci[0].Czesc[C].HighNut do begin - Inc(Czesci[0].Czesc[C].Nuta[N].Start, Move); // move note start - - if N = 0 then begin // fix beginning - Inc(Czesci[0].Czesc[C].Start, Move); - Inc(Czesci[0].Czesc[C].StartNote, Move); - end; - - if N = Czesci[0].Czesc[C].HighNut then // fix ending - Inc(Czesci[0].Czesc[C].Koniec, Move); - - end; // for - end; // for -end; - -procedure TScreenEditSub.MoveTextToRight; -var - C: integer; - N: integer; - NHigh: integer; -begin -{ C := Czesci[0].Akt; - - for N := Czesci[0].Czesc[C].HighNut downto 1 do begin - Czesci[0].Czesc[C].Nuta[N].Tekst := Czesci[0].Czesc[C].Nuta[N-1].Tekst; - end; // for - - Czesci[0].Czesc[C].Nuta[0].Tekst := '- ';} - - C := Czesci[0].Akt; - NHigh := Czesci[0].Czesc[C].HighNut; - - // last word - Czesci[0].Czesc[C].Nuta[NHigh].Tekst := Czesci[0].Czesc[C].Nuta[NHigh-1].Tekst + Czesci[0].Czesc[C].Nuta[NHigh].Tekst; - - // other words - for N := NHigh - 1 downto AktNuta + 1 do begin - Czesci[0].Czesc[C].Nuta[N].Tekst := Czesci[0].Czesc[C].Nuta[N-1].Tekst; - end; // for - Czesci[0].Czesc[C].Nuta[AktNuta].Tekst := '- '; -end; - -procedure TScreenEditSub.MarkSrc; -begin - CopySrc := Czesci[0].Akt; -end; - -procedure TScreenEditSub.PasteText; -var - C: integer; - N: integer; -begin - C := Czesci[0].Akt; - - for N := 0 to Czesci[0].Czesc[CopySrc].HighNut do - Czesci[0].Czesc[C].Nuta[N].Tekst := Czesci[0].Czesc[CopySrc].Nuta[N].Tekst; -end; - -procedure TScreenEditSub.CopySentence(Src, Dst: integer); -var - N: integer; - Time1: integer; - Time2: integer; - TD: integer; -begin - Time1 := Czesci[0].Czesc[Src].Nuta[0].Start; - Time2 := Czesci[0].Czesc[Dst].Nuta[0].Start; - TD := Time2-Time1; - - SetLength(Czesci[0].Czesc[Dst].Nuta, Czesci[0].Czesc[Src].IlNut); - Czesci[0].Czesc[Dst].IlNut := Czesci[0].Czesc[Src].IlNut; - Czesci[0].Czesc[Dst].HighNut := Czesci[0].Czesc[Src].HighNut; - for N := 0 to Czesci[0].Czesc[Src].HighNut do begin - Czesci[0].Czesc[Dst].Nuta[N].Tekst := Czesci[0].Czesc[Src].Nuta[N].Tekst; - Czesci[0].Czesc[Dst].Nuta[N].Dlugosc := Czesci[0].Czesc[Src].Nuta[N].Dlugosc; - Czesci[0].Czesc[Dst].Nuta[N].Ton := Czesci[0].Czesc[Src].Nuta[N].Ton; - Czesci[0].Czesc[Dst].Nuta[N].Start := Czesci[0].Czesc[Src].Nuta[N].Start + TD; - end; - N := Czesci[0].Czesc[Src].HighNut; - Czesci[0].Czesc[Dst].Koniec := Czesci[0].Czesc[Dst].Nuta[N].Start + Czesci[0].Czesc[Dst].Nuta[N].Dlugosc; -end; - -procedure TScreenEditSub.CopySentences(Src, Dst, Num: integer); -var - C: integer; -begin - Lyric := TLyric.Create; - // create place for new sentences - SetLength(Czesci[0].Czesc, Czesci[0].Ilosc + Num - 1); - - // moves sentences next to the destination - for C := Czesci[0].High downto Dst + 1 do begin - Czesci[0].Czesc[C + Num - 1] := Czesci[0].Czesc[C]; - end; - - // prepares new sentences: sets sentence start and create first note - for C := 1 to Num-1 do begin - Czesci[0].Czesc[Dst + C].Start := Czesci[0].Czesc[Dst + C - 1].StartNote + - (Czesci[0].Czesc[Src + C].StartNote - Czesci[0].Czesc[Src + C - 1].StartNote); - SetLength(Czesci[0].Czesc[Dst + C].Nuta, 1); - Czesci[0].Czesc[Dst + C].IlNut := 1; - Czesci[0].Czesc[Dst + C].HighNut := 0; - Czesci[0].Czesc[Dst + C].Nuta[0].Start := Czesci[0].Czesc[Dst + C].Start; - Czesci[0].Czesc[Dst + C].Nuta[0].Dlugosc := 1; - Czesci[0].Czesc[Dst + C].StartNote := Czesci[0].Czesc[Dst + C].Start; - Czesci[0].Czesc[Dst + C].Koniec := Czesci[0].Czesc[Dst + C].Start + 1; - end; - - // increase counters - Czesci[0].Ilosc := Czesci[0].Ilosc + Num - 1; - Czesci[0].High := Czesci[0].High + Num - 1; - - for C := 0 to Num-1 do - CopySentence(Src + C, Dst + C); -end; - - -constructor TScreenEditSub.Create; -begin - inherited Create; - SetLength(Player, 1); - - // linijka - AddStatic(20, 10, 80, 30, 0, 0, 0, Skin.GetTextureFileName('ButtonF'), 'JPG', 'Font Black'); - AddText(40, 17, 1, 6, 1, 1, 1, 'Line'); - TextSentence := AddText(120, 14, 1, 8, 0, 0, 0, '0 / 0'); - - // nuta - AddStatic(220, 10, 80, 30, 0, 0, 0, Skin.GetTextureFileName('ButtonF'), 'JPG', 'Font Black'); - AddText(242, 17, 1, 6, 1, 1, 1, 'Note'); - TextNote := AddText(320, 14, 1, 8, 0, 0, 0, '0 / 0'); - - // file info - AddStatic(150, 50, 500, 150, 0, 0, 0, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); - AddStatic(151, 52, 498, 146, 1, 1, 1, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); - AddText(180, 65, 0, 8, 0, 0, 0, 'Title:'); - AddText(180, 90, 0, 8, 0, 0, 0, 'Artist:'); - AddText(180, 115, 0, 8, 0, 0, 0, 'Mp3:'); - AddText(180, 140, 0, 8, 0, 0, 0, 'BPM:'); - AddText(180, 165, 0, 8, 0, 0, 0, 'GAP:'); - - TextTitle := AddText(250, 65, 0, 8, 0, 0, 0, 'a'); - TextArtist := AddText(250, 90, 0, 8, 0, 0, 0, 'b'); - TextMp3 := AddText(250, 115, 0, 8, 0, 0, 0, 'c'); - TextBPM := AddText(250, 140, 0, 8, 0, 0, 0, 'd'); - TextGAP := AddText(250, 165, 0, 8, 0, 0, 0, 'e'); - -{ AddInteraction(2, TextTitle); - AddInteraction(2, TextArtist); - AddInteraction(2, TextMp3); - AddInteraction(2, TextBPM); - AddInteraction(2, TextGAP);} - - // note info - AddText(20, 190, 0, 8, 0, 0, 0, 'Start:'); - AddText(20, 215, 0, 8, 0, 0, 0, 'Duration:'); - AddText(20, 240, 0, 8, 0, 0, 0, 'Tone:'); - AddText(20, 265, 0, 8, 0, 0, 0, 'Text:'); - - TextNStart := AddText(120, 190, 0, 8, 0, 0, 0, 'a'); - TextNDlugosc := AddText(120, 215, 0, 8, 0, 0, 0, 'b'); - TextNTon := AddText(120, 240, 0, 8, 0, 0, 0, 'c'); - TextNText := AddText(120, 265, 0, 8, 0, 0, 0, 'd'); - - // debug - TextDebug := AddText(30, 550, 0, 8, 0, 0, 0, ''); - -end; - -procedure TScreenEditSub.onShow; -begin - Log.LogStatus('Initializing', 'TEditScreen.onShow'); - - try - ResetSingTemp; - Error := not LoadSong(Path + FileName); - except - Error := True; - end; - - if Error then - begin - //Error Loading Song -> Go back to Song Screen and Show some Error Message - FadeTo(@ScreenSong); - ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); - Exit; - end - else begin - {$IFDEF UseMIDIPort} - MidiOut := TMidiOutput.Create(nil); - if Ini.Debug = 1 then - MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table - MidiOut.Open; - {$ENDIF} - Text[TextTitle].Text := AktSong.Title; - Text[TextArtist].Text := AktSong.Artist; - Text[TextMp3].Text := AktSong.Mp3; - - Czesci[0].Akt := 0; - AktNuta := 0; - Czesci[0].Czesc[0].Nuta[0].Color := 1; - - AudioPlayback.Open(Path + AktSong.Mp3); - //Set Down Music Volume for Better hearability of Midi Sounds - //Music.SetVolume(40); - - Lyric.Clear; - Lyric.X := 400; - Lyric.Y := 500; - Lyric.Align := 1; - Lyric.Size := 14; - Lyric.ColR := 0; - Lyric.ColG := 0; - Lyric.ColB := 0; - Lyric.ColSR := Skin_FontHighlightR; - Lyric.ColSG := Skin_FontHighlightG; - Lyric.ColSB := Skin_FontHighlightB; - Lyric.Style := 0; - Lyric.AddCzesc(0); - Lyric.Selected := 0; - - NotesH := 7; - NotesW := 4; - - end; - -// Interaction := 0; - TextEditMode := false; -end; - -function TScreenEditSub.Draw: boolean; -var - Min: integer; - Sec: integer; - Tekst: string; - Pet: integer; - AktBeat: integer; -begin - glClearColor(1,1,1,1); - - // midi music - if PlaySentenceMidi then begin - MidiPos := USTime.GetTime - MidiTime + MidiStart; - - {$IFDEF UseMIDIPort} - // stop the music - if (MidiPos > MidiStop) then begin - MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127); - PlaySentenceMidi := false; - end; - {$ENDIF} - - // click - AktBeat := Floor(GetMidBeat(MidiPos - AktSong.GAP / 1000)); - Text[TextDebug].Text := IntToStr(AktBeat); - - if AktBeat <> LastClick then begin - for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do - if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then - begin - - {$IFDEF UseMIDIPort} - LastClick := AktBeat; - if Pet > 0 then - MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet-1].Ton + 60, 127); - MidiOut.PutShort($91, Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Ton + 60, 127); - MidiLastNote := Pet; - {$ENDIF} - - end; - end; - end; // if PlaySentenceMidi - - // mp3 music - if PlaySentence then begin - // stop the music - if (AudioPlayback.Position > PlayStopTime) then - begin - AudioPlayback.Stop; - PlaySentence := false; - end; - - // click - if (Click) and (PlaySentence) then begin -// AktBeat := Floor(AktSong.BPM[0].BPM * (Music.Position - AktSong.GAP / 1000) / 60); - AktBeat := Floor(GetMidBeat(AudioPlayback.Position - AktSong.GAP / 1000)); - Text[TextDebug].Text := IntToStr(AktBeat); - if AktBeat <> LastClick then begin - for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do - if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then - begin - AudioPlayback.PlayClick; - LastClick := AktBeat; - end; - end; - end; // click - end; // if PlaySentence - - - Text[TextSentence].Text := IntToStr(Czesci[0].Akt + 1) + ' / ' + IntToStr(Czesci[0].Ilosc); - Text[TextNote].Text := IntToStr(AktNuta + 1) + ' / ' + IntToStr(Czesci[0].Czesc[Czesci[0].Akt].IlNut); - - // Song info - Text[TextBPM].Text := FloatToStr(AktSong.BPM[0].BPM / 4); - Text[TextGAP].Text := FloatToStr(AktSong.GAP); - - //Error reading Variables when no Song is loaded - if not Error then - begin - // Note info - Text[TextNStart].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start); - Text[TextNDlugosc].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); - Text[TextNTon].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton) + ' ( ' + GetNoteName(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton) + ' )'; - Text[TextNText].Text := Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst; - end; - - // Text Edit Mode - if TextEditMode then - Text[TextNText].Text := Text[TextNText].Text + '|'; - - // draw static menu - inherited Draw; - - // draw notes - SingDrawNoteLines(20, 300, 780, 15); - //Error Drawing when no Song is loaded - if not Error then - begin - SingDrawBeatDelimeters(40, 300, 760, 0); - EditDrawCzesc(40, 405, 760, 0, 15); - end; - - // draw text - Lyric.Draw; - -end; - -procedure TScreenEditSub.onHide; -begin - {$IFDEF UseMIDIPort} - MidiOut.Close; - MidiOut.Free; - {$ENDIF} - //Music.SetVolume(100); -end; - -function TScreenEditSub.GetNoteName(Note: Integer): String; -var N1, N2: Integer; -begin - if (Note > 0) then - begin - N1 := Note mod 12; - N2 := Note div 12; - end - else - begin - N1 := (Note + (-Trunc(Note/12)+1)*12) mod 12; - N2 := -1; - end; - - - - case N1 of - 0: Result := 'c'; - 1: Result := 'c#'; - 2: Result := 'd'; - 3: Result := 'd#'; - 4: Result := 'e'; - 5: Result := 'f'; - 6: Result := 'f#'; - 7: Result := 'g'; - 8: Result := 'g#'; - 9: Result := 'a'; - 10: Result := 'b'; - 11: Result := 'h'; - end; - - case N2 of - 0: Result := UpperCase(Result); //Normal Uppercase Note, 1: Normal lowercase Note - 2: Result := Result + ''''; //One Striped - 3: Result := Result + ''''''; //Two Striped - 4: Result := Result + ''''''''; //etc. - 5: Result := Result + ''''''''''; - 6: Result := Result + ''''''''''''; - 7: Result := Result + ''''''''''''''; - end; -end; - -end. +unit UScreenEditSub; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} +{$I switches.inc} + +uses + UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + UIni, + ULog, + UTexture, + UMenuText, + ULyrics_bak, + Math, + OpenGL12, + {$IFDEF UseMIDIPort} + MidiOut, + {$ENDIF} + UThemes; + +type + TScreenEditSub = class(TMenu) + private + //Variable is True if no SOng is loaded + Error: Boolean; + + TextNote: integer; + TextSentence: integer; + TextTitle: integer; + TextArtist: integer; + TextMp3: integer; + TextBPM: integer; + TextGAP: integer; + TextDebug: integer; + TextNStart: integer; + TextNDlugosc: integer; + TextNTon: integer; + TextNText: integer; + AktNuta: integer; + PlaySentence: boolean; + PlaySentenceMidi: boolean; + PlayStopTime: real; + LastClick: integer; + Click: boolean; + CopySrc: integer; + + {$IFDEF UseMIDIPort} + MidiOut: TMidiOutput; + {$endif} + + MidiStart: real; + MidiStop: real; + MidiTime: real; + MidiPos: real; + MidiLastNote: integer; + + TextEditMode: boolean; + + procedure NewBeat; + procedure CzesciDivide; + procedure CzesciMultiply; + procedure LyricsCapitalize; + procedure LyricsCorrectSpaces; + procedure FixTimings; + procedure DivideSentence; + procedure JoinSentence; + procedure DivideNote; + procedure DeleteNote; + procedure TransposeNote(Transpose: integer); + procedure ChangeWholeTone(Tone: integer); + procedure MoveAllToEnd(Move: integer); + procedure MoveTextToRight; + procedure MarkSrc; + procedure PasteText; + procedure CopySentence(Src, Dst: integer); + procedure CopySentences(Src, Dst, Num: integer); + //Note Name Mod + function GetNoteName(Note: Integer): String; + public + Tex_Background: TTexture; + FadeOut: boolean; + Path: string; + FileName: string; + constructor Create; override; + procedure onShow; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function ParseInputEditText(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; + function Draw: boolean; override; + procedure onHide; override; + end; + +implementation +uses UGraphic, UDraw, UMain, USkins, ULanguage; + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenEditSub.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var + SDL_ModState: Word; + R: real; +begin + Result := true; + + if TextEditMode then begin + Result := ParseInputEditText(PressedKey, ScanCode, PressedDown); + end else begin + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT {+ KMOD_CAPS}); + + If (PressedDown) then begin // Key Down + case PressedKey of + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + FadeTo(@ScreenSong); + end; + + SDLK_Q: + begin + Result := false; + end; + + SDLK_BACKQUOTE: + begin + // Increase Note Length (same as Alt + Right) + Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); + if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then + Inc(Czesci[0].Czesc[Czesci[0].Akt].Koniec); + end; + + SDLK_EQUALS: + begin + // Increase BPM + if SDL_ModState = 0 then + AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 5) + 1) / 5; // (1/20) + if SDL_ModState = KMOD_LSHIFT then + AktSong.BPM[0].BPM := AktSong.BPM[0].BPM + 4; // (1/1) + if SDL_ModState = KMOD_LCTRL then + AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 25) + 1) / 25; // (1/100) + end; + + SDLK_MINUS: + begin + // Decrease BPM + if SDL_ModState = 0 then + AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 5) - 1) / 5; + if SDL_ModState = KMOD_LSHIFT then + AktSong.BPM[0].BPM := AktSong.BPM[0].BPM - 4; + if SDL_ModState = KMOD_LCTRL then + AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 25) - 1) / 25; + end; + + SDLK_0: + begin + // Increase GAP + if SDL_ModState = 0 then + AktSong.GAP := AktSong.GAP + 10; + if SDL_ModState = KMOD_LSHIFT then + AktSong.GAP := AktSong.GAP + 1000; + end; + + SDLK_9: + begin + // Decrease GAP + if SDL_ModState = 0 then + AktSong.GAP := AktSong.GAP - 10; + if SDL_ModState = KMOD_LSHIFT then + AktSong.GAP := AktSong.GAP - 1000; + end; + + SDLK_KP_PLUS: + begin + // Increase tone of all notes + if SDL_ModState = 0 then + ChangeWholeTone(1); + if SDL_ModState = KMOD_LSHIFT then + ChangeWholeTone(12); + end; + + SDLK_KP_MINUS: + begin + // Decrease tone of all notes + if SDL_ModState = 0 then + ChangeWholeTone(-1); + if SDL_ModState = KMOD_LSHIFT then + ChangeWholeTone(-12); + end; + + SDLK_SLASH: + begin + if SDL_ModState = 0 then begin + // Insert start of sentece + if AktNuta > 0 then + DivideSentence; + end; + + if SDL_ModState = KMOD_LSHIFT then begin + // Join next sentence with current + if Czesci[0].Akt < Czesci[0].High then + JoinSentence; + end; + + if SDL_ModState = KMOD_LCTRL then begin + // divide note + DivideNote; + end; + + end; + + SDLK_S: + begin + // Save Song + if SDL_ModState = KMOD_LSHIFT then + SaveSong(AktSong, Czesci[0], Path + FileName, true) + else + SaveSong(AktSong, Czesci[0], Path + FileName, false); + + {if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL + KMOD_LALT then + // Save Song + SaveSongDebug(AktSong, Czesci[0], 'C:\song.asm', false);} + + end; + + SDLK_D: + begin + // Divide lengths by 2 + CzesciDivide; + end; + + SDLK_M: + begin + // Multiply lengths by 2 + CzesciMultiply; + end; + + SDLK_C: + begin + // Capitalize letter at the beginning of line + if SDL_ModState = 0 then + LyricsCapitalize; + + // Correct spaces + if SDL_ModState = KMOD_LSHIFT then + LyricsCorrectSpaces; + + // Copy sentence + if SDL_ModState = KMOD_LCTRL then + MarkSrc; + end; + + SDLK_V: + begin + // Paste text + if SDL_ModState = KMOD_LCTRL then begin + if Czesci[0].Czesc[Czesci[0].Akt].IlNut >= Czesci[0].Czesc[CopySrc].IlNut then + PasteText + else + beep; + end; + + if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then begin + CopySentence(CopySrc, Czesci[0].Akt); + end; + end; + + SDLK_4: + begin + if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then begin + CopySentence(CopySrc, Czesci[0].Akt); + CopySentence(CopySrc+1, Czesci[0].Akt+1); + CopySentence(CopySrc+2, Czesci[0].Akt+2); + CopySentence(CopySrc+3, Czesci[0].Akt+3); + end; + + if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT + KMOD_LALT then begin + CopySentences(CopySrc, Czesci[0].Akt, 4); + end; + end; + SDLK_5: + begin + if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then begin + CopySentence(CopySrc, Czesci[0].Akt); + CopySentence(CopySrc+1, Czesci[0].Akt+1); + CopySentence(CopySrc+2, Czesci[0].Akt+2); + CopySentence(CopySrc+3, Czesci[0].Akt+3); + CopySentence(CopySrc+4, Czesci[0].Akt+4); + end; + + if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT + KMOD_LALT then begin + CopySentences(CopySrc, Czesci[0].Akt, 5); + end; + end; + + SDLK_T: + begin + // Fixes timings between sentences + FixTimings; + end; + + SDLK_F4: + begin + // Enter Text Edit Mode + TextEditMode := true; + end; + + SDLK_P: + begin + if SDL_ModState = 0 then begin + // Play Sentence + Click := true; + AudioPlayback.Stop; + R := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote); + if R <= AudioPlayback.Length then begin + AudioPlayback.MoveTo(R); + PlayStopTime := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec); + PlaySentence := true; + AudioPlayback.Play; + LastClick := -100; + end; + end; + + if SDL_ModState = KMOD_LSHIFT then begin + PlaySentenceMidi := true; + + MidiTime := USTime.GetTime; + MidiStart := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote); + MidiStop := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec); + + LastClick := -100; + end; + if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL then begin + PlaySentenceMidi := true; + MidiTime := USTime.GetTime; + MidiStart := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote); + MidiStop := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec); + LastClick := -100; + + PlaySentence := true; + Click := true; + AudioPlayback.Stop; + AudioPlayback.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote)+0{-0.10}); + PlayStopTime := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec)+0; + AudioPlayback.Play; + LastClick := -100; + end; + end; + + SDLK_SPACE: + begin + // Play Sentence + PlaySentenceMidi := false; // stop midi + PlaySentence := true; + Click := false; + AudioPlayback.Stop; + AudioPlayback.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start)); + PlayStopTime := (GetTimeFromBeat( + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start + + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc)); + AudioPlayback.Play; + LastClick := -100; + end; + + SDLK_RETURN: + begin + end; + + SDLK_LCTRL: + begin + end; + + SDLK_DELETE: + begin + if SDL_ModState = KMOD_LCTRL then begin + // moves text to right in current sentence + DeleteNote; + end; + end; + + SDLK_PERIOD: + begin + // moves text to right in current sentence + MoveTextToRight; + end; + + SDLK_RIGHT: + begin + // right + if SDL_ModState = 0 then begin + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0; + Inc(AktNuta); + if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].IlNut then AktNuta := 0; + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; + Lyric.Selected := AktNuta; + end; + + // ctrl + right + if SDL_ModState = KMOD_LCTRL then begin + if Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc > 1 then begin + Dec(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); + Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start); + if AktNuta = 0 then begin + Inc(Czesci[0].Czesc[Czesci[0].Akt].Start); + Inc(Czesci[0].Czesc[Czesci[0].Akt].StartNote); + end; + end; + end; + + // shift + right + if SDL_ModState = KMOD_LSHIFT then begin + Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start); + if AktNuta = 0 then begin + Inc(Czesci[0].Czesc[Czesci[0].Akt].Start); + Inc(Czesci[0].Czesc[Czesci[0].Akt].StartNote); + end; + if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then + Inc(Czesci[0].Czesc[Czesci[0].Akt].Koniec); + end; + + // alt + right + if SDL_ModState = KMOD_LALT then begin + Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); + if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then + Inc(Czesci[0].Czesc[Czesci[0].Akt].Koniec); + end; + + // alt + ctrl + shift + right = move all from cursor to right + if SDL_ModState = KMOD_LALT + KMOD_LCTRL + KMOD_LSHIFT then begin + MoveAllToEnd(1); + end; + + end; + + SDLK_LEFT: + begin + // left + if SDL_ModState = 0 then begin + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0; + Dec(AktNuta); + if AktNuta = -1 then AktNuta := Czesci[0].Czesc[Czesci[0].Akt].HighNut; + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; + Lyric.Selected := AktNuta; + end; + + // ctrl + left + if SDL_ModState = KMOD_LCTRL then begin + Dec(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start); + Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); + if AktNuta = 0 then begin + Dec(Czesci[0].Czesc[Czesci[0].Akt].Start); + Dec(Czesci[0].Czesc[Czesci[0].Akt].StartNote); + end; + end; + + // shift + left + if SDL_ModState = KMOD_LSHIFT then begin + Dec(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start); + + // resizing sentences + if AktNuta = 0 then begin + Dec(Czesci[0].Czesc[Czesci[0].Akt].Start); + Dec(Czesci[0].Czesc[Czesci[0].Akt].StartNote); + end; + + if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then + Dec(Czesci[0].Czesc[Czesci[0].Akt].Koniec); + + end; + + // alt + left + if SDL_ModState = KMOD_LALT then begin + if Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc > 1 then begin + Dec(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); + if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then + Dec(Czesci[0].Czesc[Czesci[0].Akt].Koniec); + end; + end; + + // alt + ctrl + shift + right = move all from cursor to left + if SDL_ModState = KMOD_LALT + KMOD_LCTRL + KMOD_LSHIFT then begin + MoveAllToEnd(-1); + end; + + end; + + SDLK_DOWN: + begin + {$IFDEF UseMIDIPort} + // skip to next sentence + if SDL_ModState = 0 then begin + MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127); + PlaySentenceMidi := false; + + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0; + Inc(Czesci[0].Akt); + AktNuta := 0; + if Czesci[0].Akt > Czesci[0].High then Czesci[0].Akt := 0; + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; + + Lyric.AddCzesc(Czesci[0].Akt); + Lyric.Selected := 0; + AudioPlayback.Stop; + PlaySentence := false; + end; + + // decrease tone + if SDL_ModState = KMOD_LCTRL then begin + TransposeNote(-1); + end; + {$endif} + + end; + + SDLK_UP: + begin + {$IFDEF UseMIDIPort} + // skip to previous sentence + if SDL_ModState = 0 then begin + MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127); + PlaySentenceMidi := false; + + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0; + Dec(Czesci[0].Akt); + AktNuta := 0; + if Czesci[0].Akt = -1 then Czesci[0].Akt := Czesci[0].High; + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; + + Lyric.AddCzesc(Czesci[0].Akt); + Lyric.Selected := 0; + AudioPlayback.Stop; + PlaySentence := false; + end; + + // increase tone + if SDL_ModState = KMOD_LCTRL then begin + TransposeNote(1); + end; + {$endif} + end; + + // Golden Note Patch + SDLK_G: + begin + case Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc of + 0: Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 2; + 1: Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 2; + 2: Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 1; + end; // case + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Freestyle := False; + end; + + // Freestyle Note Patch + SDLK_F: + begin + case Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc of + 0: + begin; + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 1; + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Freestyle := False; + end; + 1,2: + begin; + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 0; + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Freestyle := True; + end; + end; // case + + end; + + + end; + end; + end; // if +end; + +function TScreenEditSub.ParseInputEditText(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var + SDL_ModState: Word; +begin + // used when in Text Edit Mode + Result := true; + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT {+ KMOD_CAPS}); + + If (PressedDown) Then + begin // Key Down + case PressedKey of + + SDLK_ESCAPE: + begin + FadeTo(@ScreenSong); + end; + SDLK_F4, SDLK_RETURN: + begin + // Exit Text Edit Mode + TextEditMode := false; + end; + SDLK_0..SDLK_9, SDLK_A..SDLK_Z, SDLK_SPACE, SDLK_MINUS, SDLK_EXCLAIM, SDLK_COMMA, SDLK_SLASH, SDLK_ASTERISK, SDLK_QUESTION, SDLK_QUOTE, SDLK_QUOTEDBL: + begin + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst := + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst + chr(ScanCode); + end; + SDLK_BACKSPACE: + begin + Delete(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst, + Length(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst), 1); + end; + SDLK_RIGHT: + begin + // right + if SDL_ModState = 0 then begin + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0; + Inc(AktNuta); + if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].IlNut then AktNuta := 0; + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; + Lyric.Selected := AktNuta; + end; + end; + SDLK_LEFT: + begin + // left + if SDL_ModState = 0 then begin + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0; + Dec(AktNuta); + if AktNuta = -1 then AktNuta := Czesci[0].Czesc[Czesci[0].Akt].HighNut; + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; + Lyric.Selected := AktNuta; + end; + end; + end; + end; +end; + +procedure TScreenEditSub.NewBeat; +begin + // click +{ for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeat) then begin + // old} +// Music.PlayClick; +end; + +procedure TScreenEditSub.CzesciDivide; +var + C: integer; + N: integer; +begin + AktSong.BPM[0].BPM := AktSong.BPM[0].BPM / 2; + for C := 0 to Czesci[0].High do begin + Czesci[0].Czesc[C].Start := Czesci[0].Czesc[C].Start div 2; + Czesci[0].Czesc[C].StartNote := Czesci[0].Czesc[C].StartNote div 2; + Czesci[0].Czesc[C].Koniec := Czesci[0].Czesc[C].Koniec div 2; + for N := 0 to Czesci[0].Czesc[C].HighNut do begin + Czesci[0].Czesc[C].Nuta[N].Start := Czesci[0].Czesc[C].Nuta[N].Start div 2; + Czesci[0].Czesc[C].Nuta[N].Dlugosc := Round(Czesci[0].Czesc[C].Nuta[N].Dlugosc / 2); + end; // N + end; // C +end; + +procedure TScreenEditSub.CzesciMultiply; +var + C: integer; + N: integer; +begin + AktSong.BPM[0].BPM := AktSong.BPM[0].BPM * 2; + for C := 0 to Czesci[0].High do begin + Czesci[0].Czesc[C].Start := Czesci[0].Czesc[C].Start * 2; + Czesci[0].Czesc[C].StartNote := Czesci[0].Czesc[C].StartNote * 2; + Czesci[0].Czesc[C].Koniec := Czesci[0].Czesc[C].Koniec * 2; + for N := 0 to Czesci[0].Czesc[C].HighNut do begin + Czesci[0].Czesc[C].Nuta[N].Start := Czesci[0].Czesc[C].Nuta[N].Start * 2; + Czesci[0].Czesc[C].Nuta[N].Dlugosc := Czesci[0].Czesc[C].Nuta[N].Dlugosc * 2; + end; // N + end; // C +end; + +procedure TScreenEditSub.LyricsCapitalize; +var + C: integer; + N: integer; // temporary + S: string; +begin + // temporary +{ for C := 0 to Czesci[0].High do + for N := 0 to Czesci[0].Czesc[C].HighNut do + Czesci[0].Czesc[C].Nuta[N].Tekst := AnsiLowerCase(Czesci[0].Czesc[C].Nuta[N].Tekst);} + + for C := 0 to Czesci[0].High do begin + S := AnsiUpperCase(Copy(Czesci[0].Czesc[C].Nuta[0].Tekst, 1, 1)); + S := S + Copy(Czesci[0].Czesc[C].Nuta[0].Tekst, 2, Length(Czesci[0].Czesc[C].Nuta[0].Tekst)-1); + Czesci[0].Czesc[C].Nuta[0].Tekst := S; + end; // C +end; + +procedure TScreenEditSub.LyricsCorrectSpaces; +var + C: integer; + N: integer; +begin + for C := 0 to Czesci[0].High do begin + // correct starting spaces in the first word + while Copy(Czesci[0].Czesc[C].Nuta[0].Tekst, 1, 1) = ' ' do + Czesci[0].Czesc[C].Nuta[0].Tekst := Copy(Czesci[0].Czesc[C].Nuta[0].Tekst, 2, 100); + + // move spaces on the start to the end of the previous note + for N := 1 to Czesci[0].Czesc[C].HighNut do begin + while (Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, 1, 1) = ' ') do begin + Czesci[0].Czesc[C].Nuta[N].Tekst := Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, 2, 100); + Czesci[0].Czesc[C].Nuta[N-1].Tekst := Czesci[0].Czesc[C].Nuta[N-1].Tekst + ' '; + end; + end; // N + + // correct '-' to '- ' + for N := 0 to Czesci[0].Czesc[C].HighNut do begin + if Czesci[0].Czesc[C].Nuta[N].Tekst = '-' then + Czesci[0].Czesc[C].Nuta[N].Tekst := '- '; + end; // N + + // add space to the previous note when the current word is '- ' + for N := 1 to Czesci[0].Czesc[C].HighNut do begin + if Czesci[0].Czesc[C].Nuta[N].Tekst = '- ' then + Czesci[0].Czesc[C].Nuta[N-1].Tekst := Czesci[0].Czesc[C].Nuta[N-1].Tekst + ' '; + end; // N + + // correct too many spaces at the end of note + for N := 0 to Czesci[0].Czesc[C].HighNut do begin + while Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, Length(Czesci[0].Czesc[C].Nuta[N].Tekst)-1, 2) = ' ' do + Czesci[0].Czesc[C].Nuta[N].Tekst := Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, 1, Length(Czesci[0].Czesc[C].Nuta[N].Tekst)-1); + end; // N + + // and correct if there is no space at the end of sentence + N := Czesci[0].Czesc[C].HighNut; + if Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, Length(Czesci[0].Czesc[C].Nuta[N].Tekst), 1) <> ' ' then + Czesci[0].Czesc[C].Nuta[N].Tekst := Czesci[0].Czesc[C].Nuta[N].Tekst + ' '; + + end; // C +end; + +procedure TScreenEditSub.FixTimings; +var + C: integer; + S: integer; + Min: integer; + Max: integer; +begin + for C := 1 to Czesci[0].High do begin + with Czesci[0].Czesc[C-1] do begin + Min := Nuta[HighNut].Start + Nuta[HighNut].Dlugosc; + Max := Czesci[0].Czesc[C].StartNote; + case (Max - Min) of + 0: S := Max; + 1: S := Max; + 2: S := Max - 1; + 3: S := Max - 2; + else + if ((Max - Min) > 4) then + S := Min + 2 + else + S := Max; + end; // case + + Czesci[0].Czesc[C].Start := S; + end; // with + end; // for +end; + +procedure TScreenEditSub.DivideSentence; +var + C: integer; + CStart: integer; + CNew: integer; + CLen: integer; + N: integer; + NStart: integer; + NHigh: integer; + NNewL: integer; +begin + // increase sentence length by 1 + CLen := Length(Czesci[0].Czesc); + SetLength(Czesci[0].Czesc, CLen + 1); + Inc(Czesci[0].Ilosc); + Inc(Czesci[0].High); + + // move needed sentences to one forward. newly has the copy of divided sentence + CStart := Czesci[0].Akt; + for C := CLen-1 downto CStart do + Czesci[0].Czesc[C+1] := Czesci[0].Czesc[C]; + + // clear and set new sentence + CNew := CStart + 1; + NStart := AktNuta; + Czesci[0].Czesc[CNew].Start := Czesci[0].Czesc[CStart].Nuta[NStart].Start; + Czesci[0].Czesc[CNew].StartNote := Czesci[0].Czesc[CStart].Nuta[NStart].Start; + Czesci[0].Czesc[CNew].Lyric := ''; + Czesci[0].Czesc[CNew].LyricWidth := 0; + Czesci[0].Czesc[CNew].Koniec := 0; + Czesci[0].Czesc[CNew].BaseNote := 0; // 0.5.0: we modify it later in this procedure + Czesci[0].Czesc[CNew].IlNut := 0; + Czesci[0].Czesc[CNew].HighNut := -1; + SetLength(Czesci[0].Czesc[CNew].Nuta, 0); + + // move right notes to new sentences + NHigh := Czesci[0].Czesc[CStart].HighNut; + for N := NStart to NHigh do begin + NNewL := Czesci[0].Czesc[CNew].IlNut; + SetLength(Czesci[0].Czesc[CNew].Nuta, NNewL + 1); + Czesci[0].Czesc[CNew].Nuta[NNewL] := Czesci[0].Czesc[CStart].Nuta[N]; + + // increase sentence counters + Inc(Czesci[0].Czesc[CNew].IlNut); + Inc(Czesci[0].Czesc[CNew].HighNut); + Czesci[0].Czesc[CNew].Koniec := Czesci[0].Czesc[CNew].Nuta[NNewL].Start + + Czesci[0].Czesc[CNew].Nuta[NNewL].Dlugosc; + end; + + // clear old notes and set sentence counters + Czesci[0].Czesc[CStart].HighNut := NStart - 1; + Czesci[0].Czesc[CStart].IlNut := Czesci[0].Czesc[CStart].HighNut + 1; + Czesci[0].Czesc[CStart].Koniec := Czesci[0].Czesc[CStart].Nuta[NStart-1].Start + + Czesci[0].Czesc[CStart].Nuta[NStart-1].Dlugosc; + SetLength(Czesci[0].Czesc[CStart].Nuta, Czesci[0].Czesc[CStart].IlNut); + + // 0.5.0: modify BaseNote + Czesci[0].Czesc[CNew].BaseNote := 120; + for N := 0 to Czesci[0].Czesc[CNew].IlNut do + if Czesci[0].Czesc[CNew].Nuta[N].Ton < Czesci[0].Czesc[CNew].BaseNote then + Czesci[0].Czesc[CNew].BaseNote := Czesci[0].Czesc[CNew].Nuta[N].Ton; + + Czesci[0].Akt := Czesci[0].Akt + 1; + AktNuta := 0; + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; + Lyric.AddCzesc(Czesci[0].Akt); + +end; + +procedure TScreenEditSub.JoinSentence; +var + C: integer; + N: integer; + NStart: integer; + NDst: integer; +begin + C := Czesci[0].Akt; + + // set new sentence + NStart := Czesci[0].Czesc[C].IlNut; + Czesci[0].Czesc[C].IlNut := Czesci[0].Czesc[C].IlNut + Czesci[0].Czesc[C+1].IlNut; + Czesci[0].Czesc[C].HighNut := Czesci[0].Czesc[C].HighNut + Czesci[0].Czesc[C+1].IlNut; + SetLength(Czesci[0].Czesc[C].Nuta, Czesci[0].Czesc[C].IlNut); + + // move right notes to new sentences + for N := 0 to Czesci[0].Czesc[C+1].HighNut do begin + NDst := NStart + N; + Czesci[0].Czesc[C].Nuta[NDst] := Czesci[0].Czesc[C+1].Nuta[N]; + end; + + // increase sentence counters + NDst := Czesci[0].Czesc[C].HighNut; + Czesci[0].Czesc[C].Koniec := Czesci[0].Czesc[C].Nuta[NDst].Start + + Czesci[0].Czesc[C].Nuta[NDst].Dlugosc; + + // move needed sentences to one backward. + for C := Czesci[0].Akt + 1 to Czesci[0].High - 1 do + Czesci[0].Czesc[C] := Czesci[0].Czesc[C+1]; + + // increase sentence length by 1 + SetLength(Czesci[0].Czesc, Length(Czesci[0].Czesc) - 1); + Dec(Czesci[0].Ilosc); + Dec(Czesci[0].High); +end; + +procedure TScreenEditSub.DivideNote; +var + C: integer; + N: integer; + NLen: integer; +begin + C := Czesci[0].Akt; + + NLen := Czesci[0].Czesc[C].IlNut + 1; + SetLength(Czesci[0].Czesc[C].Nuta, NLen); + Inc(Czesci[0].Czesc[C].HighNut); + Inc(Czesci[0].Czesc[C].IlNut); + + // we copy all notes including selected one + for N := Czesci[0].Czesc[C].HighNut downto AktNuta+1 do begin + Czesci[0].Czesc[C].Nuta[N] := Czesci[0].Czesc[C].Nuta[N-1]; + end; + + // me slightly modify new note + Czesci[0].Czesc[C].Nuta[AktNuta].Dlugosc := 1; + Inc(Czesci[0].Czesc[C].Nuta[AktNuta+1].Start); + Dec(Czesci[0].Czesc[C].Nuta[AktNuta+1].Dlugosc); + Czesci[0].Czesc[C].Nuta[AktNuta+1].Tekst := '- '; + Czesci[0].Czesc[C].Nuta[AktNuta+1].Color := 0; +end; + +procedure TScreenEditSub.DeleteNote; +var + C: integer; + N: integer; + NLen: integer; +begin + C := Czesci[0].Akt; + + //Do Not delete Last Note + if (Czesci[0].High > 0) OR (Czesci[0].Czesc[C].HighNut > 0) then + begin + + // we copy all notes from the next to the selected one + for N := AktNuta+1 to Czesci[0].Czesc[C].HighNut do begin + Czesci[0].Czesc[C].Nuta[N-1] := Czesci[0].Czesc[C].Nuta[N]; + end; + + NLen := Czesci[0].Czesc[C].IlNut - 1; + + if (NLen > 0) then + begin + SetLength(Czesci[0].Czesc[C].Nuta, NLen); + Dec(Czesci[0].Czesc[C].HighNut); + Dec(Czesci[0].Czesc[C].IlNut); + + + // me slightly modify new note + if AktNuta > Czesci[0].Czesc[C].HighNut then Dec(AktNuta); + Czesci[0].Czesc[C].Nuta[AktNuta].Color := 1; + end + //Last Note of current Sentence Deleted - > Delete Sentence + else + begin + //Move all Sentences after the current to the Left + for N := C+1 to Czesci[0].High do + Czesci[0].Czesc[N-1] := Czesci[0].Czesc[N]; + + //Delete Last Sentence + SetLength(Czesci[0].Czesc, Czesci[0].High); + Czesci[0].High := High(Czesci[0].Czesc); + Czesci[0].Ilosc := Length(Czesci[0].Czesc); + + AktNuta := 0; + if (C > 0) then + Czesci[0].Akt := C - 1 + else + Czesci[0].Akt := 0; + + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1; + end; + end; +end; + +procedure TScreenEditSub.TransposeNote(Transpose: integer); +begin + Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton, Transpose); +end; + +procedure TScreenEditSub.ChangeWholeTone(Tone: integer); +var + C: integer; + N: integer; +begin + for C := 0 to Czesci[0].High do begin + Czesci[0].Czesc[C].BaseNote := Czesci[0].Czesc[C].BaseNote + Tone; + for N := 0 to Czesci[0].Czesc[C].HighNut do + Czesci[0].Czesc[C].Nuta[N].Ton := Czesci[0].Czesc[C].Nuta[N].Ton + Tone; + end; +end; + +procedure TScreenEditSub.MoveAllToEnd(Move: integer); +var + C: integer; + N: integer; + NStart: integer; +begin + for C := Czesci[0].Akt to Czesci[0].High do begin + NStart := 0; + if C = Czesci[0].Akt then NStart := AktNuta; + for N := NStart to Czesci[0].Czesc[C].HighNut do begin + Inc(Czesci[0].Czesc[C].Nuta[N].Start, Move); // move note start + + if N = 0 then begin // fix beginning + Inc(Czesci[0].Czesc[C].Start, Move); + Inc(Czesci[0].Czesc[C].StartNote, Move); + end; + + if N = Czesci[0].Czesc[C].HighNut then // fix ending + Inc(Czesci[0].Czesc[C].Koniec, Move); + + end; // for + end; // for +end; + +procedure TScreenEditSub.MoveTextToRight; +var + C: integer; + N: integer; + NHigh: integer; +begin +{ C := Czesci[0].Akt; + + for N := Czesci[0].Czesc[C].HighNut downto 1 do begin + Czesci[0].Czesc[C].Nuta[N].Tekst := Czesci[0].Czesc[C].Nuta[N-1].Tekst; + end; // for + + Czesci[0].Czesc[C].Nuta[0].Tekst := '- ';} + + C := Czesci[0].Akt; + NHigh := Czesci[0].Czesc[C].HighNut; + + // last word + Czesci[0].Czesc[C].Nuta[NHigh].Tekst := Czesci[0].Czesc[C].Nuta[NHigh-1].Tekst + Czesci[0].Czesc[C].Nuta[NHigh].Tekst; + + // other words + for N := NHigh - 1 downto AktNuta + 1 do begin + Czesci[0].Czesc[C].Nuta[N].Tekst := Czesci[0].Czesc[C].Nuta[N-1].Tekst; + end; // for + Czesci[0].Czesc[C].Nuta[AktNuta].Tekst := '- '; +end; + +procedure TScreenEditSub.MarkSrc; +begin + CopySrc := Czesci[0].Akt; +end; + +procedure TScreenEditSub.PasteText; +var + C: integer; + N: integer; +begin + C := Czesci[0].Akt; + + for N := 0 to Czesci[0].Czesc[CopySrc].HighNut do + Czesci[0].Czesc[C].Nuta[N].Tekst := Czesci[0].Czesc[CopySrc].Nuta[N].Tekst; +end; + +procedure TScreenEditSub.CopySentence(Src, Dst: integer); +var + N: integer; + Time1: integer; + Time2: integer; + TD: integer; +begin + Time1 := Czesci[0].Czesc[Src].Nuta[0].Start; + Time2 := Czesci[0].Czesc[Dst].Nuta[0].Start; + TD := Time2-Time1; + + SetLength(Czesci[0].Czesc[Dst].Nuta, Czesci[0].Czesc[Src].IlNut); + Czesci[0].Czesc[Dst].IlNut := Czesci[0].Czesc[Src].IlNut; + Czesci[0].Czesc[Dst].HighNut := Czesci[0].Czesc[Src].HighNut; + for N := 0 to Czesci[0].Czesc[Src].HighNut do begin + Czesci[0].Czesc[Dst].Nuta[N].Tekst := Czesci[0].Czesc[Src].Nuta[N].Tekst; + Czesci[0].Czesc[Dst].Nuta[N].Dlugosc := Czesci[0].Czesc[Src].Nuta[N].Dlugosc; + Czesci[0].Czesc[Dst].Nuta[N].Ton := Czesci[0].Czesc[Src].Nuta[N].Ton; + Czesci[0].Czesc[Dst].Nuta[N].Start := Czesci[0].Czesc[Src].Nuta[N].Start + TD; + end; + N := Czesci[0].Czesc[Src].HighNut; + Czesci[0].Czesc[Dst].Koniec := Czesci[0].Czesc[Dst].Nuta[N].Start + Czesci[0].Czesc[Dst].Nuta[N].Dlugosc; +end; + +procedure TScreenEditSub.CopySentences(Src, Dst, Num: integer); +var + C: integer; +begin + Lyric := TLyric.Create; + // create place for new sentences + SetLength(Czesci[0].Czesc, Czesci[0].Ilosc + Num - 1); + + // moves sentences next to the destination + for C := Czesci[0].High downto Dst + 1 do begin + Czesci[0].Czesc[C + Num - 1] := Czesci[0].Czesc[C]; + end; + + // prepares new sentences: sets sentence start and create first note + for C := 1 to Num-1 do begin + Czesci[0].Czesc[Dst + C].Start := Czesci[0].Czesc[Dst + C - 1].StartNote + + (Czesci[0].Czesc[Src + C].StartNote - Czesci[0].Czesc[Src + C - 1].StartNote); + SetLength(Czesci[0].Czesc[Dst + C].Nuta, 1); + Czesci[0].Czesc[Dst + C].IlNut := 1; + Czesci[0].Czesc[Dst + C].HighNut := 0; + Czesci[0].Czesc[Dst + C].Nuta[0].Start := Czesci[0].Czesc[Dst + C].Start; + Czesci[0].Czesc[Dst + C].Nuta[0].Dlugosc := 1; + Czesci[0].Czesc[Dst + C].StartNote := Czesci[0].Czesc[Dst + C].Start; + Czesci[0].Czesc[Dst + C].Koniec := Czesci[0].Czesc[Dst + C].Start + 1; + end; + + // increase counters + Czesci[0].Ilosc := Czesci[0].Ilosc + Num - 1; + Czesci[0].High := Czesci[0].High + Num - 1; + + for C := 0 to Num-1 do + CopySentence(Src + C, Dst + C); +end; + + +constructor TScreenEditSub.Create; +begin + inherited Create; + SetLength(Player, 1); + + // linijka + AddStatic(20, 10, 80, 30, 0, 0, 0, Skin.GetTextureFileName('ButtonF'), 'JPG', 'Font Black'); + AddText(40, 17, 1, 6, 1, 1, 1, 'Line'); + TextSentence := AddText(120, 14, 1, 8, 0, 0, 0, '0 / 0'); + + // nuta + AddStatic(220, 10, 80, 30, 0, 0, 0, Skin.GetTextureFileName('ButtonF'), 'JPG', 'Font Black'); + AddText(242, 17, 1, 6, 1, 1, 1, 'Note'); + TextNote := AddText(320, 14, 1, 8, 0, 0, 0, '0 / 0'); + + // file info + AddStatic(150, 50, 500, 150, 0, 0, 0, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); + AddStatic(151, 52, 498, 146, 1, 1, 1, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); + AddText(180, 65, 0, 8, 0, 0, 0, 'Title:'); + AddText(180, 90, 0, 8, 0, 0, 0, 'Artist:'); + AddText(180, 115, 0, 8, 0, 0, 0, 'Mp3:'); + AddText(180, 140, 0, 8, 0, 0, 0, 'BPM:'); + AddText(180, 165, 0, 8, 0, 0, 0, 'GAP:'); + + TextTitle := AddText(250, 65, 0, 8, 0, 0, 0, 'a'); + TextArtist := AddText(250, 90, 0, 8, 0, 0, 0, 'b'); + TextMp3 := AddText(250, 115, 0, 8, 0, 0, 0, 'c'); + TextBPM := AddText(250, 140, 0, 8, 0, 0, 0, 'd'); + TextGAP := AddText(250, 165, 0, 8, 0, 0, 0, 'e'); + +{ AddInteraction(2, TextTitle); + AddInteraction(2, TextArtist); + AddInteraction(2, TextMp3); + AddInteraction(2, TextBPM); + AddInteraction(2, TextGAP);} + + // note info + AddText(20, 190, 0, 8, 0, 0, 0, 'Start:'); + AddText(20, 215, 0, 8, 0, 0, 0, 'Duration:'); + AddText(20, 240, 0, 8, 0, 0, 0, 'Tone:'); + AddText(20, 265, 0, 8, 0, 0, 0, 'Text:'); + + TextNStart := AddText(120, 190, 0, 8, 0, 0, 0, 'a'); + TextNDlugosc := AddText(120, 215, 0, 8, 0, 0, 0, 'b'); + TextNTon := AddText(120, 240, 0, 8, 0, 0, 0, 'c'); + TextNText := AddText(120, 265, 0, 8, 0, 0, 0, 'd'); + + // debug + TextDebug := AddText(30, 550, 0, 8, 0, 0, 0, ''); + +end; + +procedure TScreenEditSub.onShow; +begin + Log.LogStatus('Initializing', 'TEditScreen.onShow'); + + try + ResetSingTemp; + Error := not LoadSong(Path + FileName); + except + Error := True; + end; + + if Error then + begin + //Error Loading Song -> Go back to Song Screen and Show some Error Message + FadeTo(@ScreenSong); + ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); + Exit; + end + else begin + {$IFDEF UseMIDIPort} + MidiOut := TMidiOutput.Create(nil); + if Ini.Debug = 1 then + MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table + MidiOut.Open; + {$ENDIF} + Text[TextTitle].Text := AktSong.Title; + Text[TextArtist].Text := AktSong.Artist; + Text[TextMp3].Text := AktSong.Mp3; + + Czesci[0].Akt := 0; + AktNuta := 0; + Czesci[0].Czesc[0].Nuta[0].Color := 1; + + AudioPlayback.Open(Path + AktSong.Mp3); + //Set Down Music Volume for Better hearability of Midi Sounds + //Music.SetVolume(40); + + Lyric.Clear; + Lyric.X := 400; + Lyric.Y := 500; + Lyric.Align := 1; + Lyric.Size := 14; + Lyric.ColR := 0; + Lyric.ColG := 0; + Lyric.ColB := 0; + Lyric.ColSR := Skin_FontHighlightR; + Lyric.ColSG := Skin_FontHighlightG; + Lyric.ColSB := Skin_FontHighlightB; + Lyric.Style := 0; + Lyric.AddCzesc(0); + Lyric.Selected := 0; + + NotesH := 7; + NotesW := 4; + + end; + +// Interaction := 0; + TextEditMode := false; +end; + +function TScreenEditSub.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + Pet: integer; + AktBeat: integer; +begin + glClearColor(1,1,1,1); + + // midi music + if PlaySentenceMidi then begin + MidiPos := USTime.GetTime - MidiTime + MidiStart; + + {$IFDEF UseMIDIPort} + // stop the music + if (MidiPos > MidiStop) then begin + MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127); + PlaySentenceMidi := false; + end; + {$ENDIF} + + // click + AktBeat := Floor(GetMidBeat(MidiPos - AktSong.GAP / 1000)); + Text[TextDebug].Text := IntToStr(AktBeat); + + if AktBeat <> LastClick then begin + for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then + begin + + {$IFDEF UseMIDIPort} + LastClick := AktBeat; + if Pet > 0 then + MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet-1].Ton + 60, 127); + MidiOut.PutShort($91, Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Ton + 60, 127); + MidiLastNote := Pet; + {$ENDIF} + + end; + end; + end; // if PlaySentenceMidi + + // mp3 music + if PlaySentence then begin + // stop the music + if (AudioPlayback.Position > PlayStopTime) then + begin + AudioPlayback.Stop; + PlaySentence := false; + end; + + // click + if (Click) and (PlaySentence) then begin +// AktBeat := Floor(AktSong.BPM[0].BPM * (Music.Position - AktSong.GAP / 1000) / 60); + AktBeat := Floor(GetMidBeat(AudioPlayback.Position - AktSong.GAP / 1000)); + Text[TextDebug].Text := IntToStr(AktBeat); + if AktBeat <> LastClick then begin + for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then + begin + AudioPlayback.PlayClick; + LastClick := AktBeat; + end; + end; + end; // click + end; // if PlaySentence + + + Text[TextSentence].Text := IntToStr(Czesci[0].Akt + 1) + ' / ' + IntToStr(Czesci[0].Ilosc); + Text[TextNote].Text := IntToStr(AktNuta + 1) + ' / ' + IntToStr(Czesci[0].Czesc[Czesci[0].Akt].IlNut); + + // Song info + Text[TextBPM].Text := FloatToStr(AktSong.BPM[0].BPM / 4); + Text[TextGAP].Text := FloatToStr(AktSong.GAP); + + //Error reading Variables when no Song is loaded + if not Error then + begin + // Note info + Text[TextNStart].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start); + Text[TextNDlugosc].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); + Text[TextNTon].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton) + ' ( ' + GetNoteName(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton) + ' )'; + Text[TextNText].Text := Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst; + end; + + // Text Edit Mode + if TextEditMode then + Text[TextNText].Text := Text[TextNText].Text + '|'; + + // draw static menu + inherited Draw; + + // draw notes + SingDrawNoteLines(20, 300, 780, 15); + //Error Drawing when no Song is loaded + if not Error then + begin + SingDrawBeatDelimeters(40, 300, 760, 0); + EditDrawCzesc(40, 405, 760, 0, 15); + end; + + // draw text + Lyric.Draw; + +end; + +procedure TScreenEditSub.onHide; +begin + {$IFDEF UseMIDIPort} + MidiOut.Close; + MidiOut.Free; + {$ENDIF} + //Music.SetVolume(100); +end; + +function TScreenEditSub.GetNoteName(Note: Integer): String; +var N1, N2: Integer; +begin + if (Note > 0) then + begin + N1 := Note mod 12; + N2 := Note div 12; + end + else + begin + N1 := (Note + (-Trunc(Note/12)+1)*12) mod 12; + N2 := -1; + end; + + + + case N1 of + 0: Result := 'c'; + 1: Result := 'c#'; + 2: Result := 'd'; + 3: Result := 'd#'; + 4: Result := 'e'; + 5: Result := 'f'; + 6: Result := 'f#'; + 7: Result := 'g'; + 8: Result := 'g#'; + 9: Result := 'a'; + 10: Result := 'b'; + 11: Result := 'h'; + end; + + case N2 of + 0: Result := UpperCase(Result); //Normal Uppercase Note, 1: Normal lowercase Note + 2: Result := Result + ''''; //One Striped + 3: Result := Result + ''''''; //Two Striped + 4: Result := Result + ''''''''; //etc. + 5: Result := Result + ''''''''''; + 6: Result := Result + ''''''''''''; + 7: Result := Result + ''''''''''''''; + end; +end; + +end. diff --git a/Game/Code/Screens/UScreenLoading.pas b/Game/Code/Screens/UScreenLoading.pas index 989461f2..63b25d2c 100644 --- a/Game/Code/Screens/UScreenLoading.pas +++ b/Game/Code/Screens/UScreenLoading.pas @@ -1,53 +1,57 @@ -unit UScreenLoading; - -interface - -{$I switches.inc} - -uses - UMenu, - SDL, - SysUtils, - UThemes, - OpenGL12; - -type - TScreenLoading = class(TMenu) - public - Fadeout: boolean; - constructor Create; override; - procedure onShow; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function GetBGTexNum: GLUInt; - end; - -implementation - -uses UGraphic, - UTime; - -function TScreenLoading.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; -end; - -constructor TScreenLoading.Create; -begin - inherited Create; - - LoadFromTheme(Theme.Loading); - - Fadeout := false; -end; - -procedure TScreenLoading.onShow; -begin -// nothing -end; - -function TScreenLoading.GetBGTexNum: GLUInt; -begin - Result := Self.BackImg.TexNum; -end; - -end. +unit UScreenLoading; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + UMenu, + SDL, + SysUtils, + UThemes, + OpenGL12; + +type + TScreenLoading = class(TMenu) + public + Fadeout: boolean; + constructor Create; override; + procedure onShow; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function GetBGTexNum: GLUInt; + end; + +implementation + +uses UGraphic, + UTime; + +function TScreenLoading.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; +end; + +constructor TScreenLoading.Create; +begin + inherited Create; + + LoadFromTheme(Theme.Loading); + + Fadeout := false; +end; + +procedure TScreenLoading.onShow; +begin +// nothing +end; + +function TScreenLoading.GetBGTexNum: GLUInt; +begin + Result := Self.BackImg.TexNum; +end; + +end. diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 38f58bf1..5f7a0461 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -1,284 +1,288 @@ -unit UScreenMain; - -interface - -{$I switches.inc} - -uses - UMenu, - SDL, - UDisplay, - UMusic, - UFiles, - SysUtils, - UThemes, - ULCD, - ULight; - -type - TScreenMain = class(TMenu) - public - TextDescription: integer; - TextDescriptionLong: integer; - - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - procedure onShow; override; - procedure InteractNext; override; - procedure InteractPrev; override; - procedure InteractInc; override; - procedure InteractDec; override; - procedure UpdateLCD; - procedure SetAnimationProgress(Progress: real); override; - //function Draw: boolean; override; - end; - -implementation - -uses {$IFDEF win32} - windows, - {$ENDIF} - UGraphic, - UMain, - UIni, - UTexture, - USongs, - Textgl, -// opengl, - ULanguage, - UParty, - UDLLManager, - UScreenCredits, - USkins; - - -function TScreenMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -var -I: Integer; -SDL_ModState: Word; -begin - Result := true; - - SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT - + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); - - //Deactivate Credits when Key is pressed -// if Credits_Visible then -// begin -// Credits_Visible := False; -// exit; -// end; - - If (PressedDown) Then - begin // Key Down - case PressedKey of - SDLK_Q: - begin - Result := false; - end; - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - Result := False; - end; - - SDLK_C: - begin - if (SDL_ModState = KMOD_LALT) then - begin - //Credits_Y := 600; - //Credits_Alpha := 0; - //Credits_Visible := True; - AudioPlayback.PlayStart; - FadeTo(@ScreenCredits); - end; - end; - SDLK_M: - begin - if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then - begin - AudioPlayback.PlayStart; - FadeTo(@ScreenPartyOptions); - end; - end; - - SDLK_S: - begin - AudioPlayback.PlayStart; - FadeTo(@ScreenStatMain); - end; - - SDLK_E: - begin - AudioPlayback.PlayStart; - FadeTo(@ScreenEdit); - end; - - SDLK_RETURN: - begin - //Solo - if (Interaction = 0) then - begin - if (Length(Songs.Song) >= 1) then - begin - AudioPlayback.PlayStart; - if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1; - if (Ini.Players = 4) then PlayersPlay := 6; - - ScreenName.Goto_SingScreen := False; - FadeTo(@ScreenName); - end - else //show error message - ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); - end; - - //Multi - if Interaction = 1 then begin - if (Length(Songs.Song) >= 1) then - begin - if (Length(DLLMan.Plugins)>=1) then - begin - AudioPlayback.PlayStart; - FadeTo(@ScreenPartyOptions); - end - else //show error message, No Plugins Loaded - ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS')); - end - else //show error message, No Songs Loaded - ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); - end; - - //Stats - if Interaction = 2 then - begin - AudioPlayback.PlayStart; - FadeTo(@ScreenStatMain); - end; - - //Editor - if Interaction = 3 then - begin - AudioPlayback.PlayStart; - FadeTo(@ScreenEdit); - end; - - //Options - if Interaction = 4 then - begin - AudioPlayback.PlayStart; - FadeTo(@ScreenOptions); - end; - - //Exit - if Interaction = 5 then - begin - Result := false; - end; - end; - // Up and Down could be done at the same time, - // but I don't want to declare variables inside - // functions like this one, called so many times - SDLK_DOWN: InteractInc; - SDLK_UP: InteractDec; - SDLK_RIGHT: InteractNext; - SDLK_LEFT: InteractPrev; - end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; - end; -end; - -constructor TScreenMain.Create; -var - I: integer; -begin - inherited Create; - - //---------------- - //Attention ^^: - //New Creation Order needed because of LoadFromTheme - //and Button Collections. - //At First Custom Texts and Statics - //Then LoadFromTheme - //after LoadFromTheme the Buttons and Selects - //---------------- - - - TextDescription := AddText(Theme.Main.TextDescription); - TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong); - - LoadFromTheme(Theme.Main); - - AddButton(Theme.Main.ButtonSolo); - AddButton(Theme.Main.ButtonMulti); - AddButton(Theme.Main.ButtonStat); - AddButton(Theme.Main.ButtonEditor); - AddButton(Theme.Main.ButtonOptions); - AddButton(Theme.Main.ButtonExit); - - Interaction := 0; -end; - -procedure TScreenMain.onShow; -begin - LCD.WriteText(1, ' Choose mode: '); - UpdateLCD; -end; - -procedure TScreenMain.InteractNext; -begin - inherited InteractNext; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; - Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; - UpdateLCD; - Light.LightOne(1, 200); -end; - -procedure TScreenMain.InteractPrev; -begin - inherited InteractPrev; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; - Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; - UpdateLCD; - Light.LightOne(0, 200); -end; - -procedure TScreenMain.InteractDec; -begin - inherited InteractDec; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; - Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; - UpdateLCD; - Light.LightOne(0, 200); -end; - -procedure TScreenMain.InteractInc; -begin - inherited InteractInc; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; - Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; - UpdateLCD; - Light.LightOne(1, 200); -end; - -procedure TScreenMain.UpdateLCD; -begin - case Interaction of - 0: LCD.WriteText(2, ' sing '); - 1: LCD.WriteText(2, ' editor '); - 2: LCD.WriteText(2, ' options '); - 3: LCD.WriteText(2, ' exit '); - end -end; - -procedure TScreenMain.SetAnimationProgress(Progress: real); -begin - Static[0].Texture.ScaleW := Progress; - Static[0].Texture.ScaleH := Progress; -end; -end. +unit UScreenMain; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + UMenu, + SDL, + UDisplay, + UMusic, + UFiles, + SysUtils, + UThemes, + ULCD, + ULight; + +type + TScreenMain = class(TMenu) + public + TextDescription: integer; + TextDescriptionLong: integer; + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure InteractNext; override; + procedure InteractPrev; override; + procedure InteractInc; override; + procedure InteractDec; override; + procedure UpdateLCD; + procedure SetAnimationProgress(Progress: real); override; + //function Draw: boolean; override; + end; + +implementation + +uses {$IFDEF win32} + windows, + {$ENDIF} + UGraphic, + UMain, + UIni, + UTexture, + USongs, + Textgl, +// opengl, + ULanguage, + UParty, + UDLLManager, + UScreenCredits, + USkins; + + +function TScreenMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var +I: Integer; +SDL_ModState: Word; +begin + Result := true; + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + + //Deactivate Credits when Key is pressed +// if Credits_Visible then +// begin +// Credits_Visible := False; +// exit; +// end; + + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + Result := False; + end; + + SDLK_C: + begin + if (SDL_ModState = KMOD_LALT) then + begin + //Credits_Y := 600; + //Credits_Alpha := 0; + //Credits_Visible := True; + AudioPlayback.PlayStart; + FadeTo(@ScreenCredits); + end; + end; + SDLK_M: + begin + if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then + begin + AudioPlayback.PlayStart; + FadeTo(@ScreenPartyOptions); + end; + end; + + SDLK_S: + begin + AudioPlayback.PlayStart; + FadeTo(@ScreenStatMain); + end; + + SDLK_E: + begin + AudioPlayback.PlayStart; + FadeTo(@ScreenEdit); + end; + + SDLK_RETURN: + begin + //Solo + if (Interaction = 0) then + begin + if (Length(Songs.Song) >= 1) then + begin + AudioPlayback.PlayStart; + if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1; + if (Ini.Players = 4) then PlayersPlay := 6; + + ScreenName.Goto_SingScreen := False; + FadeTo(@ScreenName); + end + else //show error message + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); + end; + + //Multi + if Interaction = 1 then begin + if (Length(Songs.Song) >= 1) then + begin + if (Length(DLLMan.Plugins)>=1) then + begin + AudioPlayback.PlayStart; + FadeTo(@ScreenPartyOptions); + end + else //show error message, No Plugins Loaded + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS')); + end + else //show error message, No Songs Loaded + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); + end; + + //Stats + if Interaction = 2 then + begin + AudioPlayback.PlayStart; + FadeTo(@ScreenStatMain); + end; + + //Editor + if Interaction = 3 then + begin + AudioPlayback.PlayStart; + FadeTo(@ScreenEdit); + end; + + //Options + if Interaction = 4 then + begin + AudioPlayback.PlayStart; + FadeTo(@ScreenOptions); + end; + + //Exit + if Interaction = 5 then + begin + Result := false; + end; + end; + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN: InteractInc; + SDLK_UP: InteractDec; + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN : + begin + end; + end; +end; + +constructor TScreenMain.Create; +var + I: integer; +begin + inherited Create; + + //---------------- + //Attention ^^: + //New Creation Order needed because of LoadFromTheme + //and Button Collections. + //At First Custom Texts and Statics + //Then LoadFromTheme + //after LoadFromTheme the Buttons and Selects + //---------------- + + + TextDescription := AddText(Theme.Main.TextDescription); + TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong); + + LoadFromTheme(Theme.Main); + + AddButton(Theme.Main.ButtonSolo); + AddButton(Theme.Main.ButtonMulti); + AddButton(Theme.Main.ButtonStat); + AddButton(Theme.Main.ButtonEditor); + AddButton(Theme.Main.ButtonOptions); + AddButton(Theme.Main.ButtonExit); + + Interaction := 0; +end; + +procedure TScreenMain.onShow; +begin + LCD.WriteText(1, ' Choose mode: '); + UpdateLCD; +end; + +procedure TScreenMain.InteractNext; +begin + inherited InteractNext; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; + UpdateLCD; + Light.LightOne(1, 200); +end; + +procedure TScreenMain.InteractPrev; +begin + inherited InteractPrev; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; + UpdateLCD; + Light.LightOne(0, 200); +end; + +procedure TScreenMain.InteractDec; +begin + inherited InteractDec; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; + UpdateLCD; + Light.LightOne(0, 200); +end; + +procedure TScreenMain.InteractInc; +begin + inherited InteractInc; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; + UpdateLCD; + Light.LightOne(1, 200); +end; + +procedure TScreenMain.UpdateLCD; +begin + case Interaction of + 0: LCD.WriteText(2, ' sing '); + 1: LCD.WriteText(2, ' editor '); + 2: LCD.WriteText(2, ' options '); + 3: LCD.WriteText(2, ' exit '); + end +end; + +procedure TScreenMain.SetAnimationProgress(Progress: real); +begin + Static[0].Texture.ScaleW := Progress; + Static[0].Texture.ScaleH := Progress; +end; +end. diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 17f3b2b5..33543211 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -1,419 +1,423 @@ -unit UScreenPartyNewRound; - -interface - -{$I switches.inc} - -uses - UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; - -type - TScreenPartyNewRound = class(TMenu) - public - //Texts: - TextRound1: Cardinal; - TextRound2: Cardinal; - TextRound3: Cardinal; - TextRound4: Cardinal; - TextRound5: Cardinal; - TextRound6: Cardinal; - TextRound7: Cardinal; - - TextWinner1: Cardinal; - TextWinner2: Cardinal; - TextWinner3: Cardinal; - TextWinner4: Cardinal; - TextWinner5: Cardinal; - TextWinner6: Cardinal; - TextWinner7: Cardinal; - - TextNextRound: Cardinal; - TextNextRoundNo: Cardinal; - TextNextPlayer1: Cardinal; - TextNextPlayer2: Cardinal; - TextNextPlayer3: Cardinal; - - //Statics - StaticRound1: Cardinal; - StaticRound2: Cardinal; - StaticRound3: Cardinal; - StaticRound4: Cardinal; - StaticRound5: Cardinal; - StaticRound6: Cardinal; - StaticRound7: Cardinal; - - //Scores - TextScoreTeam1: Cardinal; - TextScoreTeam2: Cardinal; - TextScoreTeam3: Cardinal; - TextNameTeam1: Cardinal; - TextNameTeam2: Cardinal; - TextNameTeam3: Cardinal; - - TextTeam1Players: Cardinal; - TextTeam2Players: Cardinal; - TextTeam3Players: Cardinal; - - StaticTeam1: Cardinal; - StaticTeam2: Cardinal; - StaticTeam3: Cardinal; - StaticNextPlayer1: Cardinal; - StaticNextPlayer2: Cardinal; - StaticNextPlayer3: Cardinal; - - - - - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - procedure onShow; override; - procedure SetAnimationProgress(Progress: real); override; - end; - -implementation - -uses UGraphic, UMain, UIni, UTexture, UParty, UDLLManager, ULanguage, ULog; - -function TScreenPartyNewRound.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 - AudioPlayback.PlayBack; - CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); - end; - - SDLK_RETURN: - begin - AudioPlayback.PlayStart; - if DLLMan.Selected.LoadSong then - begin - //Select PartyMode ScreenSong - ScreenSong.Mode := 1; - FadeTo(@ScreenSong); - end - else - begin - FadeTo(@ScreenSingModi); - end; - end; - end; - end; -end; - -constructor TScreenPartyNewRound.Create; -var - I: integer; -begin - inherited Create; - - TextRound1 := AddText (Theme.PartyNewRound.TextRound1); - TextRound2 := AddText (Theme.PartyNewRound.TextRound2); - TextRound3 := AddText (Theme.PartyNewRound.TextRound3); - TextRound4 := AddText (Theme.PartyNewRound.TextRound4); - TextRound5 := AddText (Theme.PartyNewRound.TextRound5); - TextRound6 := AddText (Theme.PartyNewRound.TextRound6); - TextRound7 := AddText (Theme.PartyNewRound.TextRound7); - - TextWinner1 := AddText (Theme.PartyNewRound.TextWinner1); - TextWinner2 := AddText (Theme.PartyNewRound.TextWinner2); - TextWinner3 := AddText (Theme.PartyNewRound.TextWinner3); - TextWinner4 := AddText (Theme.PartyNewRound.TextWinner4); - TextWinner5 := AddText (Theme.PartyNewRound.TextWinner5); - TextWinner6 := AddText (Theme.PartyNewRound.TextWinner6); - TextWinner7 := AddText (Theme.PartyNewRound.TextWinner7); - - TextNextRound := AddText (Theme.PartyNewRound.TextNextRound); - TextNextRoundNo := AddText (Theme.PartyNewRound.TextNextRoundNo); - TextNextPlayer1 := AddText (Theme.PartyNewRound.TextNextPlayer1); - TextNextPlayer2 := AddText (Theme.PartyNewRound.TextNextPlayer2); - TextNextPlayer3 := AddText (Theme.PartyNewRound.TextNextPlayer3); - - StaticRound1 := AddStatic (Theme.PartyNewRound.StaticRound1); - StaticRound2 := AddStatic (Theme.PartyNewRound.StaticRound2); - StaticRound3 := AddStatic (Theme.PartyNewRound.StaticRound3); - StaticRound4 := AddStatic (Theme.PartyNewRound.StaticRound4); - StaticRound5 := AddStatic (Theme.PartyNewRound.StaticRound5); - StaticRound6 := AddStatic (Theme.PartyNewRound.StaticRound6); - StaticRound7 := AddStatic (Theme.PartyNewRound.StaticRound7); - - //Scores - TextScoreTeam1 := AddText (Theme.PartyNewRound.TextScoreTeam1); - TextScoreTeam2 := AddText (Theme.PartyNewRound.TextScoreTeam2); - TextScoreTeam3 := AddText (Theme.PartyNewRound.TextScoreTeam3); - TextNameTeam1 := AddText (Theme.PartyNewRound.TextNameTeam1); - TextNameTeam2 := AddText (Theme.PartyNewRound.TextNameTeam2); - TextNameTeam3 := AddText (Theme.PartyNewRound.TextNameTeam3); - - //Players - TextTeam1Players := AddText (Theme.PartyNewRound.TextTeam1Players); - TextTeam2Players := AddText (Theme.PartyNewRound.TextTeam2Players); - TextTeam3Players := AddText (Theme.PartyNewRound.TextTeam3Players); - - StaticTeam1 := AddStatic (Theme.PartyNewRound.StaticTeam1); - StaticTeam2 := AddStatic (Theme.PartyNewRound.StaticTeam2); - StaticTeam3 := AddStatic (Theme.PartyNewRound.StaticTeam3); - StaticNextPlayer1 := AddStatic (Theme.PartyNewRound.StaticNextPlayer1); - StaticNextPlayer2 := AddStatic (Theme.PartyNewRound.StaticNextPlayer2); - StaticNextPlayer3 := AddStatic (Theme.PartyNewRound.StaticNextPlayer3); - - LoadFromTheme(Theme.PartyNewRound); -end; - -procedure TScreenPartyNewRound.onShow; -var - I: Integer; - function GetTeamPlayers(const Num: Byte): String; - var - Players: Array of String; - J: Byte; - begin - if (Num-1 >= PartySession.Teams.NumTeams) then - exit; - - //Create Players Array - SetLength(Players, PartySession.Teams.TeamInfo[Num-1].NumPlayers); - For J := 0 to PartySession.Teams.TeamInfo[Num-1].NumPlayers-1 do - Players[J] := String(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name); - - //Implode and Return - Result := Language.Implode(Players); - end; -begin - PartySession.StartRound; - - //Set Visibility of Round Infos - I := Length(PartySession.Rounds); - if (I >= 1) then - begin - Static[StaticRound1].Visible := True; - Text[TextRound1].Visible := True; - Text[TextWinner1].Visible := True; - - //Texts: - Text[TextRound1].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[0].Plugin].Name); - Text[TextWinner1].Text := PartySession.GetWinnerString(0); - end - else - begin - Static[StaticRound1].Visible := False; - Text[TextRound1].Visible := False; - Text[TextWinner1].Visible := False; - end; - - if (I >= 2) then - begin - Static[StaticRound2].Visible := True; - Text[TextRound2].Visible := True; - Text[TextWinner2].Visible := True; - - //Texts: - Text[TextRound2].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[1].Plugin].Name); - Text[TextWinner2].Text := PartySession.GetWinnerString(1); - end - else - begin - Static[StaticRound2].Visible := False; - Text[TextRound2].Visible := False; - Text[TextWinner2].Visible := False; - end; - - if (I >= 3) then - begin - Static[StaticRound3].Visible := True; - Text[TextRound3].Visible := True; - Text[TextWinner3].Visible := True; - - //Texts: - Text[TextRound3].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[2].Plugin].Name); - Text[TextWinner3].Text := PartySession.GetWinnerString(2); - end - else - begin - Static[StaticRound3].Visible := False; - Text[TextRound3].Visible := False; - Text[TextWinner3].Visible := False; - end; - - if (I >= 4) then - begin - Static[StaticRound4].Visible := True; - Text[TextRound4].Visible := True; - Text[TextWinner4].Visible := True; - - //Texts: - Text[TextRound4].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[3].Plugin].Name); - Text[TextWinner4].Text := PartySession.GetWinnerString(3); - end - else - begin - Static[StaticRound4].Visible := False; - Text[TextRound4].Visible := False; - Text[TextWinner4].Visible := False; - end; - - if (I >= 5) then - begin - Static[StaticRound5].Visible := True; - Text[TextRound5].Visible := True; - Text[TextWinner5].Visible := True; - - //Texts: - Text[TextRound5].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[4].Plugin].Name); - Text[TextWinner5].Text := PartySession.GetWinnerString(4); - end - else - begin - Static[StaticRound5].Visible := False; - Text[TextRound5].Visible := False; - Text[TextWinner5].Visible := False; - end; - - if (I >= 6) then - begin - Static[StaticRound6].Visible := True; - Text[TextRound6].Visible := True; - Text[TextWinner6].Visible := True; - - //Texts: - Text[TextRound6].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[5].Plugin].Name); - Text[TextWinner6].Text := PartySession.GetWinnerString(5); - end - else - begin - Static[StaticRound6].Visible := False; - Text[TextRound6].Visible := False; - Text[TextWinner6].Visible := False; - end; - - if (I >= 7) then - begin - Static[StaticRound7].Visible := True; - Text[TextRound7].Visible := True; - Text[TextWinner7].Visible := True; - - //Texts: - Text[TextRound7].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[6].Plugin].Name); - Text[TextWinner7].Text := PartySession.GetWinnerString(6); - end - else - begin - Static[StaticRound7].Visible := False; - Text[TextRound7].Visible := False; - Text[TextWinner7].Visible := False; - end; - - //Display Scores - if (PartySession.Teams.NumTeams >= 1) then - begin - Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[0].Score); - Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[0].Name); - Text[TextTeam1Players].Text := GetTeamPlayers(1); - - Text[TextScoreTeam1].Visible := True; - Text[TextNameTeam1].Visible := True; - Text[TextTeam1Players].Visible := True; - Static[StaticTeam1].Visible := True; - Static[StaticNextPlayer1].Visible := True; - end - else - begin - Text[TextScoreTeam1].Visible := False; - Text[TextNameTeam1].Visible := False; - Text[TextTeam1Players].Visible := False; - Static[StaticTeam1].Visible := False; - Static[StaticNextPlayer1].Visible := False; - end; - - if (PartySession.Teams.NumTeams >= 2) then - begin - Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[1].Score); - Text[TextNameTeam2].Text := String(PartySession.Teams.TeamInfo[1].Name); - Text[TextTeam2Players].Text := GetTeamPlayers(2); - - Text[TextScoreTeam2].Visible := True; - Text[TextNameTeam2].Visible := True; - Text[TextTeam2Players].Visible := True; - Static[StaticTeam2].Visible := True; - Static[StaticNextPlayer2].Visible := True; - end - else - begin - Text[TextScoreTeam2].Visible := False; - Text[TextNameTeam2].Visible := False; - Text[TextTeam2Players].Visible := False; - Static[StaticTeam2].Visible := False; - Static[StaticNextPlayer2].Visible := False; - end; - - if (PartySession.Teams.NumTeams >= 3) then - begin - Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[2].Score); - Text[TextNameTeam3].Text := String(PartySession.Teams.TeamInfo[2].Name); - Text[TextTeam3Players].Text := GetTeamPlayers(3); - - Text[TextScoreTeam3].Visible := True; - Text[TextNameTeam3].Visible := True; - Text[TextTeam3Players].Visible := True; - Static[StaticTeam3].Visible := True; - Static[StaticNextPlayer3].Visible := True; - end - else - begin - Text[TextScoreTeam3].Visible := False; - Text[TextNameTeam3].Visible := False; - Text[TextTeam3Players].Visible := False; - Static[StaticTeam3].Visible := False; - Static[StaticNextPlayer3].Visible := False; - end; - - //nextRound Texts - Text[TextNextRound].Text := Language.Translate(DllMan.Selected.PluginDesc); - Text[TextNextRoundNo].Text := InttoStr(PartySession.CurRound + 1); - if (PartySession.Teams.NumTeams >= 1) then - begin - Text[TextNextPlayer1].Text := PartySession.Teams.Teaminfo[0].Playerinfo[PartySession.Teams.Teaminfo[0].CurPlayer].Name; - Text[TextNextPlayer1].Visible := True; - end - else - Text[TextNextPlayer1].Visible := False; - - if (PartySession.Teams.NumTeams >= 2) then - begin - Text[TextNextPlayer2].Text := PartySession.Teams.Teaminfo[1].Playerinfo[PartySession.Teams.Teaminfo[1].CurPlayer].Name; - Text[TextNextPlayer2].Visible := True; - end - else - Text[TextNextPlayer2].Visible := False; - - if (PartySession.Teams.NumTeams >= 3) then - begin - Text[TextNextPlayer3].Text := PartySession.Teams.Teaminfo[2].Playerinfo[PartySession.Teams.Teaminfo[2].CurPlayer].Name; - Text[TextNextPlayer3].Visible := True; - end - else - Text[TextNextPlayer3].Visible := False; - - -// LCD.WriteText(1, ' Choose mode: '); -// UpdateLCD; -end; - -procedure TScreenPartyNewRound.SetAnimationProgress(Progress: real); -begin - {Button[0].Texture.ScaleW := Progress; - Button[1].Texture.ScaleW := Progress; - Button[2].Texture.ScaleW := Progress; } -end; - -end. +unit UScreenPartyNewRound; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; + +type + TScreenPartyNewRound = class(TMenu) + public + //Texts: + TextRound1: Cardinal; + TextRound2: Cardinal; + TextRound3: Cardinal; + TextRound4: Cardinal; + TextRound5: Cardinal; + TextRound6: Cardinal; + TextRound7: Cardinal; + + TextWinner1: Cardinal; + TextWinner2: Cardinal; + TextWinner3: Cardinal; + TextWinner4: Cardinal; + TextWinner5: Cardinal; + TextWinner6: Cardinal; + TextWinner7: Cardinal; + + TextNextRound: Cardinal; + TextNextRoundNo: Cardinal; + TextNextPlayer1: Cardinal; + TextNextPlayer2: Cardinal; + TextNextPlayer3: Cardinal; + + //Statics + StaticRound1: Cardinal; + StaticRound2: Cardinal; + StaticRound3: Cardinal; + StaticRound4: Cardinal; + StaticRound5: Cardinal; + StaticRound6: Cardinal; + StaticRound7: Cardinal; + + //Scores + TextScoreTeam1: Cardinal; + TextScoreTeam2: Cardinal; + TextScoreTeam3: Cardinal; + TextNameTeam1: Cardinal; + TextNameTeam2: Cardinal; + TextNameTeam3: Cardinal; + + TextTeam1Players: Cardinal; + TextTeam2Players: Cardinal; + TextTeam3Players: Cardinal; + + StaticTeam1: Cardinal; + StaticTeam2: Cardinal; + StaticTeam3: Cardinal; + StaticNextPlayer1: Cardinal; + StaticNextPlayer2: Cardinal; + StaticNextPlayer3: Cardinal; + + + + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + end; + +implementation + +uses UGraphic, UMain, UIni, UTexture, UParty, UDLLManager, ULanguage, ULog; + +function TScreenPartyNewRound.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 + AudioPlayback.PlayBack; + CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); + end; + + SDLK_RETURN: + begin + AudioPlayback.PlayStart; + if DLLMan.Selected.LoadSong then + begin + //Select PartyMode ScreenSong + ScreenSong.Mode := 1; + FadeTo(@ScreenSong); + end + else + begin + FadeTo(@ScreenSingModi); + end; + end; + end; + end; +end; + +constructor TScreenPartyNewRound.Create; +var + I: integer; +begin + inherited Create; + + TextRound1 := AddText (Theme.PartyNewRound.TextRound1); + TextRound2 := AddText (Theme.PartyNewRound.TextRound2); + TextRound3 := AddText (Theme.PartyNewRound.TextRound3); + TextRound4 := AddText (Theme.PartyNewRound.TextRound4); + TextRound5 := AddText (Theme.PartyNewRound.TextRound5); + TextRound6 := AddText (Theme.PartyNewRound.TextRound6); + TextRound7 := AddText (Theme.PartyNewRound.TextRound7); + + TextWinner1 := AddText (Theme.PartyNewRound.TextWinner1); + TextWinner2 := AddText (Theme.PartyNewRound.TextWinner2); + TextWinner3 := AddText (Theme.PartyNewRound.TextWinner3); + TextWinner4 := AddText (Theme.PartyNewRound.TextWinner4); + TextWinner5 := AddText (Theme.PartyNewRound.TextWinner5); + TextWinner6 := AddText (Theme.PartyNewRound.TextWinner6); + TextWinner7 := AddText (Theme.PartyNewRound.TextWinner7); + + TextNextRound := AddText (Theme.PartyNewRound.TextNextRound); + TextNextRoundNo := AddText (Theme.PartyNewRound.TextNextRoundNo); + TextNextPlayer1 := AddText (Theme.PartyNewRound.TextNextPlayer1); + TextNextPlayer2 := AddText (Theme.PartyNewRound.TextNextPlayer2); + TextNextPlayer3 := AddText (Theme.PartyNewRound.TextNextPlayer3); + + StaticRound1 := AddStatic (Theme.PartyNewRound.StaticRound1); + StaticRound2 := AddStatic (Theme.PartyNewRound.StaticRound2); + StaticRound3 := AddStatic (Theme.PartyNewRound.StaticRound3); + StaticRound4 := AddStatic (Theme.PartyNewRound.StaticRound4); + StaticRound5 := AddStatic (Theme.PartyNewRound.StaticRound5); + StaticRound6 := AddStatic (Theme.PartyNewRound.StaticRound6); + StaticRound7 := AddStatic (Theme.PartyNewRound.StaticRound7); + + //Scores + TextScoreTeam1 := AddText (Theme.PartyNewRound.TextScoreTeam1); + TextScoreTeam2 := AddText (Theme.PartyNewRound.TextScoreTeam2); + TextScoreTeam3 := AddText (Theme.PartyNewRound.TextScoreTeam3); + TextNameTeam1 := AddText (Theme.PartyNewRound.TextNameTeam1); + TextNameTeam2 := AddText (Theme.PartyNewRound.TextNameTeam2); + TextNameTeam3 := AddText (Theme.PartyNewRound.TextNameTeam3); + + //Players + TextTeam1Players := AddText (Theme.PartyNewRound.TextTeam1Players); + TextTeam2Players := AddText (Theme.PartyNewRound.TextTeam2Players); + TextTeam3Players := AddText (Theme.PartyNewRound.TextTeam3Players); + + StaticTeam1 := AddStatic (Theme.PartyNewRound.StaticTeam1); + StaticTeam2 := AddStatic (Theme.PartyNewRound.StaticTeam2); + StaticTeam3 := AddStatic (Theme.PartyNewRound.StaticTeam3); + StaticNextPlayer1 := AddStatic (Theme.PartyNewRound.StaticNextPlayer1); + StaticNextPlayer2 := AddStatic (Theme.PartyNewRound.StaticNextPlayer2); + StaticNextPlayer3 := AddStatic (Theme.PartyNewRound.StaticNextPlayer3); + + LoadFromTheme(Theme.PartyNewRound); +end; + +procedure TScreenPartyNewRound.onShow; +var + I: Integer; + function GetTeamPlayers(const Num: Byte): String; + var + Players: Array of String; + J: Byte; + begin + if (Num-1 >= PartySession.Teams.NumTeams) then + exit; + + //Create Players Array + SetLength(Players, PartySession.Teams.TeamInfo[Num-1].NumPlayers); + For J := 0 to PartySession.Teams.TeamInfo[Num-1].NumPlayers-1 do + Players[J] := String(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name); + + //Implode and Return + Result := Language.Implode(Players); + end; +begin + PartySession.StartRound; + + //Set Visibility of Round Infos + I := Length(PartySession.Rounds); + if (I >= 1) then + begin + Static[StaticRound1].Visible := True; + Text[TextRound1].Visible := True; + Text[TextWinner1].Visible := True; + + //Texts: + Text[TextRound1].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[0].Plugin].Name); + Text[TextWinner1].Text := PartySession.GetWinnerString(0); + end + else + begin + Static[StaticRound1].Visible := False; + Text[TextRound1].Visible := False; + Text[TextWinner1].Visible := False; + end; + + if (I >= 2) then + begin + Static[StaticRound2].Visible := True; + Text[TextRound2].Visible := True; + Text[TextWinner2].Visible := True; + + //Texts: + Text[TextRound2].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[1].Plugin].Name); + Text[TextWinner2].Text := PartySession.GetWinnerString(1); + end + else + begin + Static[StaticRound2].Visible := False; + Text[TextRound2].Visible := False; + Text[TextWinner2].Visible := False; + end; + + if (I >= 3) then + begin + Static[StaticRound3].Visible := True; + Text[TextRound3].Visible := True; + Text[TextWinner3].Visible := True; + + //Texts: + Text[TextRound3].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[2].Plugin].Name); + Text[TextWinner3].Text := PartySession.GetWinnerString(2); + end + else + begin + Static[StaticRound3].Visible := False; + Text[TextRound3].Visible := False; + Text[TextWinner3].Visible := False; + end; + + if (I >= 4) then + begin + Static[StaticRound4].Visible := True; + Text[TextRound4].Visible := True; + Text[TextWinner4].Visible := True; + + //Texts: + Text[TextRound4].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[3].Plugin].Name); + Text[TextWinner4].Text := PartySession.GetWinnerString(3); + end + else + begin + Static[StaticRound4].Visible := False; + Text[TextRound4].Visible := False; + Text[TextWinner4].Visible := False; + end; + + if (I >= 5) then + begin + Static[StaticRound5].Visible := True; + Text[TextRound5].Visible := True; + Text[TextWinner5].Visible := True; + + //Texts: + Text[TextRound5].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[4].Plugin].Name); + Text[TextWinner5].Text := PartySession.GetWinnerString(4); + end + else + begin + Static[StaticRound5].Visible := False; + Text[TextRound5].Visible := False; + Text[TextWinner5].Visible := False; + end; + + if (I >= 6) then + begin + Static[StaticRound6].Visible := True; + Text[TextRound6].Visible := True; + Text[TextWinner6].Visible := True; + + //Texts: + Text[TextRound6].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[5].Plugin].Name); + Text[TextWinner6].Text := PartySession.GetWinnerString(5); + end + else + begin + Static[StaticRound6].Visible := False; + Text[TextRound6].Visible := False; + Text[TextWinner6].Visible := False; + end; + + if (I >= 7) then + begin + Static[StaticRound7].Visible := True; + Text[TextRound7].Visible := True; + Text[TextWinner7].Visible := True; + + //Texts: + Text[TextRound7].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[6].Plugin].Name); + Text[TextWinner7].Text := PartySession.GetWinnerString(6); + end + else + begin + Static[StaticRound7].Visible := False; + Text[TextRound7].Visible := False; + Text[TextWinner7].Visible := False; + end; + + //Display Scores + if (PartySession.Teams.NumTeams >= 1) then + begin + Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[0].Score); + Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[0].Name); + Text[TextTeam1Players].Text := GetTeamPlayers(1); + + Text[TextScoreTeam1].Visible := True; + Text[TextNameTeam1].Visible := True; + Text[TextTeam1Players].Visible := True; + Static[StaticTeam1].Visible := True; + Static[StaticNextPlayer1].Visible := True; + end + else + begin + Text[TextScoreTeam1].Visible := False; + Text[TextNameTeam1].Visible := False; + Text[TextTeam1Players].Visible := False; + Static[StaticTeam1].Visible := False; + Static[StaticNextPlayer1].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 2) then + begin + Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[1].Score); + Text[TextNameTeam2].Text := String(PartySession.Teams.TeamInfo[1].Name); + Text[TextTeam2Players].Text := GetTeamPlayers(2); + + Text[TextScoreTeam2].Visible := True; + Text[TextNameTeam2].Visible := True; + Text[TextTeam2Players].Visible := True; + Static[StaticTeam2].Visible := True; + Static[StaticNextPlayer2].Visible := True; + end + else + begin + Text[TextScoreTeam2].Visible := False; + Text[TextNameTeam2].Visible := False; + Text[TextTeam2Players].Visible := False; + Static[StaticTeam2].Visible := False; + Static[StaticNextPlayer2].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 3) then + begin + Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[2].Score); + Text[TextNameTeam3].Text := String(PartySession.Teams.TeamInfo[2].Name); + Text[TextTeam3Players].Text := GetTeamPlayers(3); + + Text[TextScoreTeam3].Visible := True; + Text[TextNameTeam3].Visible := True; + Text[TextTeam3Players].Visible := True; + Static[StaticTeam3].Visible := True; + Static[StaticNextPlayer3].Visible := True; + end + else + begin + Text[TextScoreTeam3].Visible := False; + Text[TextNameTeam3].Visible := False; + Text[TextTeam3Players].Visible := False; + Static[StaticTeam3].Visible := False; + Static[StaticNextPlayer3].Visible := False; + end; + + //nextRound Texts + Text[TextNextRound].Text := Language.Translate(DllMan.Selected.PluginDesc); + Text[TextNextRoundNo].Text := InttoStr(PartySession.CurRound + 1); + if (PartySession.Teams.NumTeams >= 1) then + begin + Text[TextNextPlayer1].Text := PartySession.Teams.Teaminfo[0].Playerinfo[PartySession.Teams.Teaminfo[0].CurPlayer].Name; + Text[TextNextPlayer1].Visible := True; + end + else + Text[TextNextPlayer1].Visible := False; + + if (PartySession.Teams.NumTeams >= 2) then + begin + Text[TextNextPlayer2].Text := PartySession.Teams.Teaminfo[1].Playerinfo[PartySession.Teams.Teaminfo[1].CurPlayer].Name; + Text[TextNextPlayer2].Visible := True; + end + else + Text[TextNextPlayer2].Visible := False; + + if (PartySession.Teams.NumTeams >= 3) then + begin + Text[TextNextPlayer3].Text := PartySession.Teams.Teaminfo[2].Playerinfo[PartySession.Teams.Teaminfo[2].CurPlayer].Name; + Text[TextNextPlayer3].Visible := True; + end + else + Text[TextNextPlayer3].Visible := False; + + +// LCD.WriteText(1, ' Choose mode: '); +// UpdateLCD; +end; + +procedure TScreenPartyNewRound.SetAnimationProgress(Progress: real); +begin + {Button[0].Texture.ScaleW := Progress; + Button[1].Texture.ScaleW := Progress; + Button[2].Texture.ScaleW := Progress; } +end; + +end. diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 7be4d1c0..1c5e8461 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -1,259 +1,263 @@ -unit UScreenPartyOptions; - -interface - -{$I switches.inc} - -uses - UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; - -type - TScreenPartyOptions = class(TMenu) - public - SelectLevel: Cardinal; - SelectPlayList: Cardinal; - SelectPlayList2: Cardinal; - SelectRounds: Cardinal; - SelectTeams: Cardinal; - SelectPlayers1: Cardinal; - SelectPlayers2: Cardinal; - SelectPlayers3: Cardinal; - - PlayList: Integer; - PlayList2: Integer; - Rounds: Integer; - NumTeams: Integer; - NumPlayer1, NumPlayer2, NumPlayer3: Integer; - - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - procedure onShow; override; - procedure SetAnimationProgress(Progress: real); override; - procedure SetPlaylist2; - end; - -var - IPlaylist: array[0..2] of String; - IPlaylist2: array of String; -const - ITeams: array[0..1] of String =('2', '3'); - IPlayers: array[0..3] of String =('1', '2', '3', '4'); - IRounds: array[0..5] of String = ('2', '3', '4', '5', '6', '7'); - -implementation - -uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UDLLManager, UPlaylist, USongs; - -function TScreenPartyOptions.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; - var - I, J: Integer; -begin - Result := true; - If (PressedDown) Then - begin // Key Down - case PressedKey of - SDLK_Q: - begin - Result := false; - end; - - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - AudioPlayback.PlayBack; - FadeTo(@ScreenMain); - end; - - SDLK_RETURN: - begin - //Don'T start when Playlist is Selected and there are no Playlists - If (Playlist = 2) and (Length(PlaylistMan.Playlists) = 0) then - Exit; - - //Save Difficulty - Ini.Difficulty := SelectsS[SelectLevel].SelectedOption; - Ini.SaveLevel; - - - //Save Num Teams: - PartySession.Teams.NumTeams := NumTeams + 2; - PartySession.Teams.Teaminfo[0].NumPlayers := NumPlayer1+1; - PartySession.Teams.Teaminfo[1].NumPlayers := NumPlayer2+1; - PartySession.Teams.Teaminfo[2].NumPlayers := NumPlayer3+1; - - //Save Playlist - PlaylistMan.Mode := Playlist; - PlaylistMan.CurPlayList := High(Cardinal); - //If Category Selected Search Category ID - if Playlist = 1 then - begin - J := -1; - For I := 0 to high(CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - Inc(J); - - if J = Playlist2 then - begin - PlaylistMan.CurPlayList := I; - Break; - end; - end; - - //No Categorys or Invalid Entry - If PlaylistMan.CurPlayList = High(Cardinal) then - Exit; - end - else - PlaylistMan.CurPlayList := Playlist2; - - //Start Party - PartySession.StartNewParty(Rounds + 2); - - AudioPlayback.PlayStart; - //Go to Player Screen - FadeTo(@ScreenPartyPlayer); - end; - - // Up and Down could be done at the same time, - // but I don't want to declare variables inside - // functions like this one, called so many times - SDLK_DOWN: InteractNext; - SDLK_UP: InteractPrev; - SDLK_RIGHT: - begin - AudioPlayback.PlayOption; - InteractInc; - - //Change Playlist2 if Playlist is Changed - If (Interaction = 1) then - begin - SetPlaylist2; - end //Change Team3 Players visibility - Else If (Interaction = 4) then - begin - SelectsS[7].Visible := (NumTeams = 1); - end; - end; - SDLK_LEFT: - begin - AudioPlayback.PlayOption; - InteractDec; - - //Change Playlist2 if Playlist is Changed - If (Interaction = 1) then - begin - SetPlaylist2; - end //Change Team3 Players visibility - Else If (Interaction = 4) then - begin - SelectsS[7].Visible := (NumTeams = 1); - end; - end; - end; - end; -end; - -constructor TScreenPartyOptions.Create; -var - I: integer; -begin - inherited Create; - //Fill IPlaylist - IPlaylist[0] := Language.Translate('PARTY_PLAYLIST_ALL'); - IPlaylist[1] := Language.Translate('PARTY_PLAYLIST_CATEGORY'); - IPlaylist[2] := Language.Translate('PARTY_PLAYLIST_PLAYLIST'); - - //Fill IPlaylist2 - SetLength(IPlaylist2, 1); - IPlaylist2[0] := '---'; - - //Clear all Selects - NumTeams := 0; - NumPlayer1 := 0; - NumPlayer2 := 0; - NumPlayer3 := 0; - Rounds := 5; - PlayList := 0; - PlayList2 := 0; - - //Load Screen From Theme - LoadFromTheme(Theme.PartyOptions); - - SelectLevel := AddSelectSlide (Theme.PartyOptions.SelectLevel, Ini.Difficulty, Theme.ILevel); - SelectPlayList := AddSelectSlide (Theme.PartyOptions.SelectPlayList, PlayList, IPlaylist); - SelectPlayList2 := AddSelectSlide (Theme.PartyOptions.SelectPlayList2, PlayList2, IPlaylist2); - SelectRounds := AddSelectSlide (Theme.PartyOptions.SelectRounds, Rounds, IRounds); - SelectTeams := AddSelectSlide (Theme.PartyOptions.SelectTeams, NumTeams, ITeams); - SelectPlayers1 := AddSelectSlide (Theme.PartyOptions.SelectPlayers1, NumPlayer1, IPlayers); - SelectPlayers2 := AddSelectSlide (Theme.PartyOptions.SelectPlayers2, NumPlayer2, IPlayers); - SelectPlayers3 := AddSelectSlide (Theme.PartyOptions.SelectPlayers3, NumPlayer3, IPlayers); - - Interaction := 0; - - //Hide Team3 Players - SelectsS[7].Visible := False; -end; - -procedure TScreenPartyOptions.SetPlaylist2; -var I: Integer; -begin - Case Playlist of - 0: - begin - SetLength(IPlaylist2, 1); - IPlaylist2[0] := '---'; - end; - 1: - begin - SetLength(IPlaylist2, 0); - For I := 0 to high(CatSongs.Song) do - begin - If (CatSongs.Song[I].Main) then - begin - SetLength(IPlaylist2, Length(IPlaylist2) + 1); - IPlaylist2[high(IPlaylist2)] := CatSongs.Song[I].Artist; - end; - end; - - If (Length(IPlaylist2) = 0) then - begin - SetLength(IPlaylist2, 1); - IPlaylist2[0] := 'No Categories found'; - end; - end; - 2: - begin - if (Length(PlaylistMan.Playlists) > 0) then - begin - SetLength(IPlaylist2, Length(PlaylistMan.Playlists)); - PlaylistMan.GetNames(IPlaylist2); - end - else - begin - SetLength(IPlaylist2, 1); - IPlaylist2[0] := 'No Playlists found'; - end; - end; - end; - - Playlist2 := 0; - UpdateSelectSlideOptions(Theme.PartyOptions.SelectPlayList2, 2, IPlaylist2, Playlist2); -end; - -procedure TScreenPartyOptions.onShow; -begin - Randomize; - -// LCD.WriteText(1, ' Choose mode: '); -// UpdateLCD; -end; - -procedure TScreenPartyOptions.SetAnimationProgress(Progress: real); -begin - {for I := 0 to 6 do - SelectS[I].Texture.ScaleW := Progress;} -end; - -end. +unit UScreenPartyOptions; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; + +type + TScreenPartyOptions = class(TMenu) + public + SelectLevel: Cardinal; + SelectPlayList: Cardinal; + SelectPlayList2: Cardinal; + SelectRounds: Cardinal; + SelectTeams: Cardinal; + SelectPlayers1: Cardinal; + SelectPlayers2: Cardinal; + SelectPlayers3: Cardinal; + + PlayList: Integer; + PlayList2: Integer; + Rounds: Integer; + NumTeams: Integer; + NumPlayer1, NumPlayer2, NumPlayer3: Integer; + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + procedure SetPlaylist2; + end; + +var + IPlaylist: array[0..2] of String; + IPlaylist2: array of String; +const + ITeams: array[0..1] of String =('2', '3'); + IPlayers: array[0..3] of String =('1', '2', '3', '4'); + IRounds: array[0..5] of String = ('2', '3', '4', '5', '6', '7'); + +implementation + +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UDLLManager, UPlaylist, USongs; + +function TScreenPartyOptions.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; + var + I, J: Integer; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + AudioPlayback.PlayBack; + FadeTo(@ScreenMain); + end; + + SDLK_RETURN: + begin + //Don'T start when Playlist is Selected and there are no Playlists + If (Playlist = 2) and (Length(PlaylistMan.Playlists) = 0) then + Exit; + + //Save Difficulty + Ini.Difficulty := SelectsS[SelectLevel].SelectedOption; + Ini.SaveLevel; + + + //Save Num Teams: + PartySession.Teams.NumTeams := NumTeams + 2; + PartySession.Teams.Teaminfo[0].NumPlayers := NumPlayer1+1; + PartySession.Teams.Teaminfo[1].NumPlayers := NumPlayer2+1; + PartySession.Teams.Teaminfo[2].NumPlayers := NumPlayer3+1; + + //Save Playlist + PlaylistMan.Mode := Playlist; + PlaylistMan.CurPlayList := High(Cardinal); + //If Category Selected Search Category ID + if Playlist = 1 then + begin + J := -1; + For I := 0 to high(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + Inc(J); + + if J = Playlist2 then + begin + PlaylistMan.CurPlayList := I; + Break; + end; + end; + + //No Categorys or Invalid Entry + If PlaylistMan.CurPlayList = High(Cardinal) then + Exit; + end + else + PlaylistMan.CurPlayList := Playlist2; + + //Start Party + PartySession.StartNewParty(Rounds + 2); + + AudioPlayback.PlayStart; + //Go to Player Screen + FadeTo(@ScreenPartyPlayer); + end; + + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; + SDLK_RIGHT: + begin + AudioPlayback.PlayOption; + InteractInc; + + //Change Playlist2 if Playlist is Changed + If (Interaction = 1) then + begin + SetPlaylist2; + end //Change Team3 Players visibility + Else If (Interaction = 4) then + begin + SelectsS[7].Visible := (NumTeams = 1); + end; + end; + SDLK_LEFT: + begin + AudioPlayback.PlayOption; + InteractDec; + + //Change Playlist2 if Playlist is Changed + If (Interaction = 1) then + begin + SetPlaylist2; + end //Change Team3 Players visibility + Else If (Interaction = 4) then + begin + SelectsS[7].Visible := (NumTeams = 1); + end; + end; + end; + end; +end; + +constructor TScreenPartyOptions.Create; +var + I: integer; +begin + inherited Create; + //Fill IPlaylist + IPlaylist[0] := Language.Translate('PARTY_PLAYLIST_ALL'); + IPlaylist[1] := Language.Translate('PARTY_PLAYLIST_CATEGORY'); + IPlaylist[2] := Language.Translate('PARTY_PLAYLIST_PLAYLIST'); + + //Fill IPlaylist2 + SetLength(IPlaylist2, 1); + IPlaylist2[0] := '---'; + + //Clear all Selects + NumTeams := 0; + NumPlayer1 := 0; + NumPlayer2 := 0; + NumPlayer3 := 0; + Rounds := 5; + PlayList := 0; + PlayList2 := 0; + + //Load Screen From Theme + LoadFromTheme(Theme.PartyOptions); + + SelectLevel := AddSelectSlide (Theme.PartyOptions.SelectLevel, Ini.Difficulty, Theme.ILevel); + SelectPlayList := AddSelectSlide (Theme.PartyOptions.SelectPlayList, PlayList, IPlaylist); + SelectPlayList2 := AddSelectSlide (Theme.PartyOptions.SelectPlayList2, PlayList2, IPlaylist2); + SelectRounds := AddSelectSlide (Theme.PartyOptions.SelectRounds, Rounds, IRounds); + SelectTeams := AddSelectSlide (Theme.PartyOptions.SelectTeams, NumTeams, ITeams); + SelectPlayers1 := AddSelectSlide (Theme.PartyOptions.SelectPlayers1, NumPlayer1, IPlayers); + SelectPlayers2 := AddSelectSlide (Theme.PartyOptions.SelectPlayers2, NumPlayer2, IPlayers); + SelectPlayers3 := AddSelectSlide (Theme.PartyOptions.SelectPlayers3, NumPlayer3, IPlayers); + + Interaction := 0; + + //Hide Team3 Players + SelectsS[7].Visible := False; +end; + +procedure TScreenPartyOptions.SetPlaylist2; +var I: Integer; +begin + Case Playlist of + 0: + begin + SetLength(IPlaylist2, 1); + IPlaylist2[0] := '---'; + end; + 1: + begin + SetLength(IPlaylist2, 0); + For I := 0 to high(CatSongs.Song) do + begin + If (CatSongs.Song[I].Main) then + begin + SetLength(IPlaylist2, Length(IPlaylist2) + 1); + IPlaylist2[high(IPlaylist2)] := CatSongs.Song[I].Artist; + end; + end; + + If (Length(IPlaylist2) = 0) then + begin + SetLength(IPlaylist2, 1); + IPlaylist2[0] := 'No Categories found'; + end; + end; + 2: + begin + if (Length(PlaylistMan.Playlists) > 0) then + begin + SetLength(IPlaylist2, Length(PlaylistMan.Playlists)); + PlaylistMan.GetNames(IPlaylist2); + end + else + begin + SetLength(IPlaylist2, 1); + IPlaylist2[0] := 'No Playlists found'; + end; + end; + end; + + Playlist2 := 0; + UpdateSelectSlideOptions(Theme.PartyOptions.SelectPlayList2, 2, IPlaylist2, Playlist2); +end; + +procedure TScreenPartyOptions.onShow; +begin + Randomize; + +// LCD.WriteText(1, ' Choose mode: '); +// UpdateLCD; +end; + +procedure TScreenPartyOptions.SetAnimationProgress(Progress: real); +begin + {for I := 0 to 6 do + SelectS[I].Texture.ScaleW := Progress;} +end; + +end. diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 36e3b43b..3537a26d 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -2,6 +2,10 @@ unit UScreenScore; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 60cab0a4..dd11ee07 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -2,6 +2,10 @@ unit UScreenSing; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 7f692af5..5e9d94ec 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -2,6 +2,10 @@ unit UScreenSingModi; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 3f2f5d58..85c38c26 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -2,6 +2,10 @@ unit UScreenSong; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} @@ -1719,7 +1723,7 @@ begin if (not AudioPlayback.Finished) AND (Theme.Song.Equalizer.Length > 0) then begin - + {$ifdef win32} A := GetTickCount div 44; if (A <> EqualizerTime) then @@ -1794,6 +1798,7 @@ begin else EqualizerBands[B] := 1; end; + {$endif} //Draw every Channel glColor4f(Theme.Song.Equalizer.ColR, Theme.Song.Equalizer.ColG, Theme.Song.Equalizer.ColB, Theme.Song.Equalizer.Alpha); //Set Color diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 6f9b0c53..90e56a54 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -2,6 +2,10 @@ unit UScreenSongMenu; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses 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 diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas index 83ba2bb0..bf19fed2 100644 --- a/Game/Code/Screens/UScreenTop5.pas +++ b/Game/Code/Screens/UScreenTop5.pas @@ -2,6 +2,10 @@ unit UScreenTop5; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index 1026c04b..630c0873 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -126,7 +126,7 @@ uses UMedia_dummy in 'Classes\UMedia_dummy.pas', UVideo in 'Classes\UVideo.pas', -// UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', + UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', {$ifdef win32} UAudio_bass in 'Classes\UAudio_bass.pas', {$endif} @@ -143,7 +143,13 @@ uses UThemes in 'Classes\UThemes.pas', UTime in 'Classes\UTime.pas', USingNotes in 'Classes\USingNotes.pas', - + + uPluginLoader in 'Classes\uPluginLoader.pas', + UCoreModule in 'Classes\UCoreModule.pas', + UServices in 'Classes\UServices.pas', + UCore in 'Classes\UCore.pas', + UHooks in 'Classes\UHooks.pas', + //------------------------------ @@ -192,7 +198,7 @@ uses //Includes - Modi SDK //------------------------------ ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', - + UPluginDefs in '..\..\Modis\SDK\UPluginDefs.pas', //------------------------------ //Includes - Delphi @@ -205,291 +211,9 @@ uses const Version = 'UltraStar Deluxe V 1.10 Alpha Build'; -var - WndTitle: string; - hWnd: THandle; - I: Integer; - - aFormatCtx : PAVFormatContext;//PAVCodecContext; - aCodecCtx : PAVCodecContext; - VideoStreamIndex, - AudioStreamIndex : integer; - begin + main(); -(* - -av_register_all; -aFormatCtx := av_alloc_format_context(); -if av_open_input_file( aFormatCtx, pchar( Paramstr(1) ), NIL, 0, NIL) = 0 then -begin - if av_find_stream_info( aFormatCtx ) >= 0 then - begin - writeln(''); - dump_format(aFormatCtx, 0, pchar( Paramstr(1) ), 0); - writeln(''); - -// writeln( pchar( filename ) ); - -// av_read_play( aFormatCtx ); - find_stream_ids( aFormatCtx , VideoStreamIndex , AudioStreamIndex ); - - writeln( 'VideoStreamIndex : ' + inttostr(VideoStreamIndex) ); - writeln( 'AudioStreamIndex : ' + inttostr(AudioStreamIndex) ); - - aCodecCtx := aFormatCtx.streams[ AudioStreamIndex ].codec; - writeln( 'Audio Codec Channels: '+ inttostr( integer( aCodecCtx.channels ) ) ); - writeln( 'Audio Codec freq: '+ inttostr( integer( aCodecCtx.sample_rate ) ) ); - - wanted_spec.freq = aCodecCtx->sample_rate; - wanted_spec.format = AUDIO_S16SYS; - wanted_spec.channels = aCodecCtx->channels; - wanted_spec.silence = 0; - wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE; - wanted_spec.callback = audio_callback; - wanted_spec.userdata = aCodecCtx; - - if(SDL_OpenAudio(&wanted_spec, aCodecCtx) < 0) then - begin - writeln( 'Could not do SDL_OpenAudio' ); - exit; - end; - - - end; -end; - -exit; -*) - - WndTitle := Version; - - - {$ifdef Win32} - //------------------------------ - //Start more than One Time Prevention - //------------------------------ - hWnd:= FindWindow(nil, PChar(WndTitle)); - //Programm already started - if (hWnd <> 0) then - begin - I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Contìnue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); - if (I = IDYes) then - begin - I := 1; - repeat - Inc(I); - hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); - until (hWnd = 0); - - WndTitle := WndTitle + ' Instance ' + InttoStr(I); - end - else - Exit; - end; - {$endif} - - //------------------------------ - //StartUp - Create Classes and Load Files - //------------------------------ - USTime := TTime.Create; - - // Commandline Parameter Parser - Params := TCMDParams.Create; - - // Log + Benchmark - Log := TLog.Create; - Log.Title := WndTitle; - Log.Enabled := Not Params.NoLog; - Log.BenchmarkStart(0); - - // Language - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Paths', 'Initialization'); InitializePaths; - Log.LogStatus('Load Language', 'Initialization'); Language := TLanguage.Create; - //Add Const Values: - Language.AddConst('US_VERSION', Version); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Language', 1); - - // SDL - Log.BenchmarkStart(1); - Log.LogStatus('Initialize SDL', 'Initialization'); - SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing SDL', 1); - - // Skin - Log.BenchmarkStart(1); - Log.LogStatus('Loading Skin List', 'Initialization'); Skin := TSkin.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Skin List', 1); - - // Sound Card List - Log.BenchmarkStart(1); - Log.LogStatus('Loading Soundcard list', 'Initialization'); - Recording := TRecord.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Soundcard list', 1); - - // Ini + Paths - Log.BenchmarkStart(1); - Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; - Ini.Load; - - //Load Languagefile - if (Params.Language <> -1) then - Language.ChangeLanguage(ILanguage[Params.Language]) - else - Language.ChangeLanguage(ILanguage[Ini.Language]); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Ini', 1); - - // LCD - Log.BenchmarkStart(1); - Log.LogStatus('Load LCD', 'Initialization'); LCD := TLCD.Create; - if Ini.LPT = 1 then begin -// LCD.HalfInterface := true; - LCD.Enable; - LCD.Clear; - LCD.WriteText(1, ' UltraStar '); - LCD.WriteText(2, ' Loading... '); - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading LCD', 1); - - // Light - Log.BenchmarkStart(1); - Log.LogStatus('Load Light', 'Initialization'); Light := TLight.Create; - if Ini.LPT = 2 then begin - Light.Enable; - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Light', 1); - - // Theme - Log.BenchmarkStart(1); - Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Themes', 1); - - // Covers Cache - Log.BenchmarkStart(1); - Log.LogStatus('Creating Covers Cache', 'Initialization'); Covers := TCovers.Create; - Log.LogBenchmark('Loading Covers Cache Array', 1); - Log.BenchmarkStart(1); - - // Category Covers - Log.BenchmarkStart(1); - Log.LogStatus('Creating Category Covers Array', 'Initialization'); - CatCovers:= TCatCovers.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Category Covers Array', 1); - - // Songs - //Log.BenchmarkStart(1); - Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; - Songs.LoadSongList; - Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Songs', 1); - - // PluginManager - Log.BenchmarkStart(1); - Log.LogStatus('PluginManager', 'Initialization'); - DLLMan := TDLLMan.Create; //Load PluginList - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PluginManager', 1); - - // Party Mode Manager - Log.BenchmarkStart(1); - Log.LogStatus('PartySession Manager', 'Initialization'); - PartySession := TParty_Session.Create; //Load PartySession - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PartySession Manager', 1); - - // Sound - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Sound', 'Initialization'); InitializeSound(); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Sound', 1); - - -(* - // This is jays debugging for FFMpeg audio output.. - singleton_MusicFFMpeg.PlaySwoosh(); - writeln( 'did you hear the sound ?? ' ); - halt(0); -*) - - // Graphics - Log.BenchmarkStart(1); - Log.LogStatus('Initialize 3D', 'Initialization'); Initialize3D(WndTitle); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing 3D', 1); - - - // Score Saving System - Log.BenchmarkStart(1); - Log.LogStatus('DataBase System', 'Initialization'); - DataBase := TDataBaseSystem.Create; - - if (Params.ScoreFile = '') then - DataBase.Init ('Ultrastar.db') - else - DataBase.Init (Params.ScoreFile); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading DataBase System', 1); - - //Playlist Manager - Log.BenchmarkStart(1); - Log.LogStatus('Playlist Manager', 'Initialization'); - PlaylistMan := TPlaylistManager.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Playlist Manager', 1); - - //GoldenStarsTwinkleMod - Log.BenchmarkStart(1); - Log.LogStatus('Effect Manager', 'Initialization'); - GoldenRec := TEffectManager.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Particel System', 1); - - // Joypad - if (Ini.Joypad = 1) OR (Params.Joypad) then begin - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Joystick', 'Initialization'); Joy := TJoy.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Joystick', 1); - end; - - Log.BenchmarkEnd(0); - Log.LogBenchmark('Loading Time', 0); - - - //------------------------------ - //Start- Mainloop - //------------------------------ - //Music.SetLoop(true); - //Music.SetVolume(50); - //Music.Open(SkinPath + 'Menu Music 3.mp3'); - //Music.Play; - Log.LogStatus('Main Loop', 'Initialization'); MainLoop; - - Log.LogStatus('Cleanup', 'Done'); - - //------------------------------ - //Finish Application - //------------------------------ - if Ini.LPT = 1 then LCD.Clear; - if Ini.LPT = 2 then Light.TurnOff; - - // Insignificant change.. - - Log.Free; end. diff --git a/Game/Code/lib/SQLite/SQLiteTable3.pas b/Game/Code/lib/SQLite/SQLiteTable3.pas index 18135765..fc958d23 100644 --- a/Game/Code/lib/SQLite/SQLiteTable3.pas +++ b/Game/Code/lib/SQLite/SQLiteTable3.pas @@ -17,6 +17,10 @@ unit SQLiteTable3; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index 1e1d4cad..1958471b 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -19,7 +19,8 @@ {$DEFINE LAZARUS} {$ENDIF} - {$MODE DELPHI} +// {$MODE DELPHI} // JB - This is not allowed by the free pascal compiler for some reason ( At least on linux ) + {$DEFINE DLL_CDECL} {$UNDEF UseSerialPort} {$UNDEF UseMIDIPort} -- cgit v1.2.3 From 9d7f4c06634799c4582b2908673b55ea9fe96e61 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Fri, 2 Nov 2007 07:08:07 +0000 Subject: basic threading of song loading.. with some stubs for event based song list reloading. so songs can be added while the game is being played, potentially. and startup isnt slowed down by loading all the songs, as its done in the background. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@549 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMain.pas | 548 +++++++++++++++++++++---------------------- Game/Code/Classes/USongs.pas | 153 +++++++++--- Game/Code/UltraStar.lpr | 8 +- 3 files changed, 401 insertions(+), 308 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index d3b65e2f..d7ae51f4 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -152,314 +152,306 @@ var hWnd: THandle; I: Integer; begin - WndTitle := Version; + try -// InitializeSound(); -// writeln( 'DONE' ); -// exit; + WndTitle := Version; - - {$IFDEF MSWINDOWS} - //------------------------------ - //Start more than One Time Prevention - //------------------------------ - hWnd:= FindWindow(nil, PChar(WndTitle)); - //Programm already started - if (hWnd <> 0) then - begin - I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Continue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); - if (I = IDYes) then + {$IFDEF MSWINDOWS} + //------------------------------ + //Start more than One Time Prevention + //------------------------------ + hWnd:= FindWindow(nil, PChar(WndTitle)); + //Programm already started + if (hWnd <> 0) then begin - I := 1; - repeat - Inc(I); - hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); - until (hWnd = 0); - WndTitle := WndTitle + ' Instance ' + InttoStr(I); - end + I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Continue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); + if (I = IDYes) then + begin + I := 1; + repeat + Inc(I); + hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); + until (hWnd = 0); + WndTitle := WndTitle + ' Instance ' + InttoStr(I); + end + else + Exit; + end; + {$ENDIF} + + //------------------------------ + //StartUp - Create Classes and Load Files + //------------------------------ + USTime := TTime.Create; + + // Commandline Parameter Parser + Params := TCMDParams.Create; + + // Log + Benchmark + Log := TLog.Create; + Log.Title := WndTitle; + Log.Enabled := Not Params.NoLog; + Log.BenchmarkStart(0); + + // Language + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Paths', 'Initialization'); + InitializePaths; + Log.LogStatus('Load Language', 'Initialization'); + Language := TLanguage.Create; + //Add Const Values: + Language.AddConst('US_VERSION', Version); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Language', 1); + + // SDL + Log.BenchmarkStart(1); + Log.LogStatus('Initialize SDL', 'Initialization'); + SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing SDL', 1); + + // SDL_ttf + Log.BenchmarkStart(1); + Log.LogStatus('Initialize SDL_ttf', 'Initialization'); + TTF_Init(); //ttf_quit(); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing SDL_ttf', 1); + + // Skin + Log.BenchmarkStart(1); + Log.LogStatus('Loading Skin List', 'Initialization'); + Skin := TSkin.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Skin List', 1); + + // Sound Card List + Log.BenchmarkStart(1); + Log.LogStatus('Loading Soundcard list', 'Initialization'); + Recording := TRecord.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Soundcard list', 1); + + // Ini + Paths + Log.BenchmarkStart(1); + Log.LogStatus('Load Ini', 'Initialization'); + Ini := TIni.Create; + Ini.Load; + + //Load Languagefile + if (Params.Language <> -1) then + Language.ChangeLanguage(ILanguage[Params.Language]) else - Exit; - end; - {$ENDIF} - - //------------------------------ - //StartUp - Create Classes and Load Files - //------------------------------ - USTime := TTime.Create; - - // Commandline Parameter Parser - Params := TCMDParams.Create; - - // Log + Benchmark - Log := TLog.Create; - Log.Title := WndTitle; - Log.Enabled := Not Params.NoLog; - Log.BenchmarkStart(0); - - // Language - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Paths', 'Initialization'); - InitializePaths; - Log.LogStatus('Load Language', 'Initialization'); - Language := TLanguage.Create; - //Add Const Values: - Language.AddConst('US_VERSION', Version); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Language', 1); - - // SDL - Log.BenchmarkStart(1); - Log.LogStatus('Initialize SDL', 'Initialization'); - SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing SDL', 1); - - // SDL_ttf - Log.BenchmarkStart(1); - Log.LogStatus('Initialize SDL_ttf', 'Initialization'); - TTF_Init(); //ttf_quit(); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing SDL_ttf', 1); - - // Skin - Log.BenchmarkStart(1); - Log.LogStatus('Loading Skin List', 'Initialization'); - Skin := TSkin.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Skin List', 1); - - // Sound Card List - Log.BenchmarkStart(1); - Log.LogStatus('Loading Soundcard list', 'Initialization'); - Recording := TRecord.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Soundcard list', 1); - - // Ini + Paths - Log.BenchmarkStart(1); - Log.LogStatus('Load Ini', 'Initialization'); - Ini := TIni.Create; - Ini.Load; - - //Load Languagefile - if (Params.Language <> -1) then - Language.ChangeLanguage(ILanguage[Params.Language]) - else - Language.ChangeLanguage(ILanguage[Ini.Language]); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Ini', 1); - - - // LCD - Log.BenchmarkStart(1); - Log.LogStatus('Load LCD', 'Initialization'); - LCD := TLCD.Create; - if Ini.LPT = 1 then begin -// LCD.HalfInterface := true; - LCD.Enable; - LCD.Clear; - LCD.WriteText(1, ' UltraStar '); - LCD.WriteText(2, ' Loading... '); - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading LCD', 1); - - // Light - Log.BenchmarkStart(1); - Log.LogStatus('Load Light', 'Initialization'); - Light := TLight.Create; - if Ini.LPT = 2 then begin - Light.Enable; - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Light', 1); - - - - // Theme - Log.BenchmarkStart(1); - Log.LogStatus('Load Themes', 'Initialization'); - Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Themes', 1); - - // Covers Cache - Log.BenchmarkStart(1); - Log.LogStatus('Creating Covers Cache', 'Initialization'); - Covers := TCovers.Create; - Log.LogBenchmark('Loading Covers Cache Array', 1); - Log.BenchmarkStart(1); - - // Category Covers - Log.BenchmarkStart(1); - Log.LogStatus('Creating Category Covers Array', 'Initialization'); - CatCovers:= TCatCovers.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Category Covers Array', 1); - - // Songs - //Log.BenchmarkStart(1); - Log.LogStatus('Creating Song Array', 'Initialization'); - Songs := TSongs.Create; - Songs.LoadSongList; - Log.LogStatus('Creating 2nd Song Array', 'Initialization'); - CatSongs := TCatSongs.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Songs', 1); - - // PluginManager - Log.BenchmarkStart(1); - Log.LogStatus('PluginManager', 'Initialization'); - DLLMan := TDLLMan.Create; //Load PluginList - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PluginManager', 1); - - // Party Mode Manager - Log.BenchmarkStart(1); - Log.LogStatus('PartySession Manager', 'Initialization'); - PartySession := TParty_Session.Create; //Load PartySession - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PartySession Manager', 1); - - // Sound - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Sound', 'Initialization'); - InitializeSound(); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Sound', 1); - -// exit; - - // Graphics - Log.BenchmarkStart(1); - Log.LogStatus('Initialize 3D', 'Initialization'); - Initialize3D(WndTitle); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing 3D', 1); - - // Score Saving System - Log.BenchmarkStart(1); - Log.LogStatus('DataBase System', 'Initialization'); - DataBase := TDataBaseSystem.Create; - - if (Params.ScoreFile = '') then - DataBase.Init ('Ultrastar.db') - else - DataBase.Init (Params.ScoreFile); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading DataBase System', 1); - - //Playlist Manager - Log.BenchmarkStart(1); - Log.LogStatus('Playlist Manager', 'Initialization'); - PlaylistMan := TPlaylistManager.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Playlist Manager', 1); - - //GoldenStarsTwinkleMod - Log.BenchmarkStart(1); - Log.LogStatus('Effect Manager', 'Initialization'); - GoldenRec := TEffectManager.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Particel System', 1); - - // Joypad - if (Ini.Joypad = 1) OR (Params.Joypad) then begin + Language.ChangeLanguage(ILanguage[Ini.Language]); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Ini', 1); + + + // LCD Log.BenchmarkStart(1); - Log.LogStatus('Initialize Joystick', 'Initialization'); - Joy := TJoy.Create; + Log.LogStatus('Load LCD', 'Initialization'); + LCD := TLCD.Create; + if Ini.LPT = 1 then begin + // LCD.HalfInterface := true; + LCD.Enable; + LCD.Clear; + LCD.WriteText(1, ' UltraStar '); + LCD.WriteText(2, ' Loading... '); + end; Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Joystick', 1); - end; + Log.LogBenchmark('Loading LCD', 1); - Log.BenchmarkEnd(0); - Log.LogBenchmark('Loading Time', 0); + // Light + Log.BenchmarkStart(1); + Log.LogStatus('Load Light', 'Initialization'); + Light := TLight.Create; + if Ini.LPT = 2 then begin + Light.Enable; + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Light', 1); - Log.LogError('Creating Core'); - Core := TCore.Create('Ultrastar Deluxe Beta', MakeVersion(1,1,0, chr(0))); - Log.LogError('Running Core'); - Core.Run; - //------------------------------ - //Start- Mainloop - //------------------------------ - //Music.SetLoop(true); - //Music.SetVolume(50); - //Music.Open(SkinPath + 'Menu Music 3.mp3'); - //Music.Play; - Log.LogStatus('Main Loop', 'Initialization'); - MainLoop; + // Theme + Log.BenchmarkStart(1); + Log.LogStatus('Load Themes', 'Initialization'); + Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Themes', 1); - //------------------------------ - //Finish Application - //------------------------------ - if Ini.LPT = 1 then LCD.Clear; - if Ini.LPT = 2 then Light.TurnOff; + // Covers Cache + Log.BenchmarkStart(1); + Log.LogStatus('Creating Covers Cache', 'Initialization'); + Covers := TCovers.Create; + Log.LogBenchmark('Loading Covers Cache Array', 1); + Log.BenchmarkStart(1); - Log.LogStatus('Main Loop', 'Finished'); + // Category Covers + Log.BenchmarkStart(1); + Log.LogStatus('Creating Category Covers Array', 'Initialization'); + CatCovers:= TCatCovers.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Category Covers Array', 1); - Log.Free; + // Songs + //Log.BenchmarkStart(1); + Log.LogStatus('Creating Song Array', 'Initialization'); + Songs := TSongs.Create; +// Songs.LoadSongList; + Log.LogStatus('Creating 2nd Song Array', 'Initialization'); + CatSongs := TCatSongs.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Songs', 1); + + // PluginManager + Log.BenchmarkStart(1); + Log.LogStatus('PluginManager', 'Initialization'); + DLLMan := TDLLMan.Create; //Load PluginList + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PluginManager', 1); + + // Party Mode Manager + Log.BenchmarkStart(1); + Log.LogStatus('PartySession Manager', 'Initialization'); + PartySession := TParty_Session.Create; //Load PartySession + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PartySession Manager', 1); + + // Sound + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Sound', 'Initialization'); + InitializeSound(); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Sound', 1); + + // exit; + + // Graphics + Log.BenchmarkStart(1); + Log.LogStatus('Initialize 3D', 'Initialization'); + Initialize3D(WndTitle); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing 3D', 1); + + // Score Saving System + Log.BenchmarkStart(1); + Log.LogStatus('DataBase System', 'Initialization'); + DataBase := TDataBaseSystem.Create; + + if (Params.ScoreFile = '') then + DataBase.Init ('Ultrastar.db') + else + DataBase.Init (Params.ScoreFile); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading DataBase System', 1); + + //Playlist Manager + Log.BenchmarkStart(1); + Log.LogStatus('Playlist Manager', 'Initialization'); + PlaylistMan := TPlaylistManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Playlist Manager', 1); + + //GoldenStarsTwinkleMod + Log.BenchmarkStart(1); + Log.LogStatus('Effect Manager', 'Initialization'); + GoldenRec := TEffectManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Particel System', 1); + + // Joypad + if (Ini.Joypad = 1) OR (Params.Joypad) then + begin + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Joystick', 'Initialization'); + Joy := TJoy.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Joystick', 1); + end; + + Log.BenchmarkEnd(0); + Log.LogBenchmark('Loading Time', 0); + + Log.LogError('Creating Core'); + Core := TCore.Create('Ultrastar Deluxe Beta', MakeVersion(1,1,0, chr(0))); + + Log.LogError('Running Core'); + Core.Run; + + //------------------------------ + //Start- Mainloop + //------------------------------ + //Music.SetLoop(true); + //Music.SetVolume(50); + //Music.Open(SkinPath + 'Menu Music 3.mp3'); + //Music.Play; + Log.LogStatus('Main Loop', 'Initialization'); + MainLoop; + + finally + //------------------------------ + //Finish Application + //------------------------------ + if Ini.LPT = 1 then LCD.Clear; + if Ini.LPT = 2 then Light.TurnOff; + + Log.LogStatus('Main Loop', 'Finished'); + Log.Free; + end; end; -//{$ENDIF} procedure MainLoop; var Delay: integer; begin - Delay := 0; - SDL_EnableKeyRepeat(125, 125); - - - CountSkipTime(); // JB - for some reason this seems to be needed when we use the SDL Timer functions. - While not Done do - Begin - // joypad - if (Ini.Joypad = 1) OR (Params.Joypad) then - Joy.Update; + try + Delay := 0; + SDL_EnableKeyRepeat(125, 125); - // keyboard events - CheckEvents; + CountSkipTime(); // JB - for some reason this seems to be needed when we use the SDL Timer functions. + While not Done do + Begin + // joypad + if (Ini.Joypad = 1) OR (Params.Joypad) then + Joy.Update; - // display - done := not Display.Draw; - SwapBuffers; + // keyboard events + CheckEvents; - // light - Light.Refresh; + // display + done := not Display.Draw; + SwapBuffers; - // delay - CountMidTime; - - {$IFDEF DebugDisplay} - Writeln( 'TimeMid : '+ inttostr(trunc(TimeMid)) ); - {$ENDIF} + // light + Light.Refresh; -// if 1000*TimeMid > 100 then beep; - Delay := Floor(1000 / 100 - 1000 * TimeMid); + // delay + CountMidTime; - {$IFDEF DebugDisplay} - Writeln( 'Delay ms : '+ inttostr(Delay) ); - {$ENDIF} + Delay := Floor(1000 / 100 - 1000 * TimeMid); - if Delay >= 1 then - SDL_Delay(Delay); // dynamic, maximum is 100 fps + if Delay >= 1 then + SDL_Delay(Delay); // dynamic, maximum is 100 fps - CountSkipTime; + CountSkipTime; - // reinitialization of graphics - if Restart then - begin - Reinitialize3D; - Restart := false; - end; + // reinitialization of graphics + if Restart then + begin + Reinitialize3D; + Restart := false; + end; - End; - UnloadOpenGL; + End; + + finally + UnloadOpenGL; + end; End; Procedure CheckEvents; diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 614363c8..e3b2f3b2 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -10,12 +10,16 @@ interface uses SysUtils, {$ifndef MSWINDOWS} - {$IFDEF DARWIN} + {$IFDEF DARWIN} baseunix, {$ELSE} - oldlinux, - {$ENDIF} + oldlinux, + {$ENDIF} + baseunix, + UnixType, + syscall, {$endif} + Classes, ULog, UTexture, UCommon, @@ -57,7 +61,7 @@ type Background: widestring; Video: widestring; VideoGAP: real; - VideoLoaded: boolean; // 0.5.0: true if the video has been loaded + VideoLoaded: boolean; // 0.5.0: true if the video has been loaded NotesGAP: integer; Start: real; // in seconds Finish: integer; // in miliseconds @@ -76,16 +80,25 @@ type CatNumber: integer; // Count of Songs in Category for Cats and Number of Song in Category for Songs end; - TSongs = class + TSongs = class( TThread ) private - BrowsePos: Cardinal; //Actual Pos in Song Array + BrowsePos : Cardinal; //Actual Pos in Song Array + fNotify , + fWatch : longint; + fParseSongDirectory : boolean; + fProcessing : boolean; + procedure int_LoadSongList; + protected + procedure Execute; override; public - Song: array of TSong; // array of songs - Selected: integer; // selected song index - procedure LoadSongList; // load all songs + Song : array of TSong; // array of songs + Selected : integer; // selected song index + constructor create(); + procedure LoadSongList; // load all songs procedure BrowseDir(Dir: widestring); // should return number of songs in the future procedure Sort(Order: integer); - function FindSongFile(Dir, Mask: widestring): widestring; + function FindSongFile(Dir, Mask: widestring): widestring; + property Processing : boolean read fProcessing; end; TCatSongs = class @@ -113,6 +126,20 @@ var CatSongs: TCatSongs; // categorized songs AktSong: TSong; // one song *unknown use) +const + IN_ACCESS = $00000001; //* File was accessed */ + IN_MODIFY = $00000002; //* File was modified */ + IN_ATTRIB = $00000004; //* Metadata changed */ + IN_CLOSE_WRITE = $00000008; //* Writtable file was closed */ + IN_CLOSE_NOWRITE = $00000010; //* Unwrittable file closed */ + IN_OPEN = $00000020; //* File was opened */ + IN_MOVED_FROM = $00000040; //* File was moved from X */ + IN_MOVED_TO = $00000080; //* File was moved to Y */ + IN_CREATE = $00000100; //* Subfile was created */ + IN_DELETE = $00000200; //* Subfile was deleted */ + IN_DELETE_SELF = $00000400; //* Self was deleted */ + + implementation uses StrUtils, @@ -127,22 +154,94 @@ begin end; {$ENDIF} -procedure TSongs.LoadSongList; +constructor TSongs.create(); begin - Log.LogStatus('Initializing', 'LoadSongList'); + inherited create( false ); + self.freeonterminate := true; + + {$IFDEF linux} + (* + Thankyou to : http://www.linuxjournal.com/article/8478 + http://www.tin.org/bin/man.cgi?section=2&topic=inotify_add_watch + *) +(* + fNotify := -1; + fWatch := -1; + + writeln( 'Calling inotify_init' ); + fNotify := Do_SysCall( syscall_nr_inotify_init ); + if ( fNotify < 0 ) then + writeln( 'Filesystem change notification - disabled' ); + writeln( 'Calling inotify_init : '+ inttostr(fNotify) ); + + writeln( 'Calling syscall_nr_inotify_init ('+SongPath+')' ); + fWatch := Do_SysCall( syscall_nr_inotify_init , TSysParam( fNotify ), longint( pchar( SongPath ) ) , IN_MODIFY AND IN_CREATE AND IN_DELETE ); + + if (fWatch < 0) then + writeln ('inotify_add_watch'); + writeln( 'Calling syscall_nr_inotify_init : '+ inttostr(fWatch) ); +*) + {$endif} + + Setlength(Song, 0); +end; - // clear - Setlength(Song, 50); +procedure TSongs.Execute(); +var - BrowsePos := 0; - // browse directories - BrowseDir(SongPath); + lrfds : fdSet; + time : Ttimeval; + res : integer; + buf : pchar; + len, bufflen : longint; + str : String; +begin + fParseSongDirectory := true; - //Set Correct SongArray Length - SetLength(Song, BrowsePos); -// if Ini.Debug = 1 then BrowseDir('D:\Extract\Songs\'); + while not self.terminated do + begin + +// if fParseSongDirectory then + begin + writeln( 'int_LoadSongList' ); + int_LoadSongList(); + end; + + self.suspend; + end; + +end; + +procedure TSongs.int_LoadSongList; +begin + try + fProcessing := true; + + Log.LogError('SongList', 'Searching For Songs'); + Setlength(Song, 50); + + BrowsePos := 0; + // browse directories + BrowseDir(SongPath); + + //Set Correct SongArray Length + SetLength(Song, BrowsePos); + finally + Log.LogError('SongList', 'Search Complete'); + + fParseSongDirectory := false; + fProcessing := false; + end; +end; + + +procedure TSongs.LoadSongList; +begin + fParseSongDirectory := true; + self.resume; end; +// TODO : JB - THis whole function SUX ! and needs refactoring ! :P procedure TSongs.BrowseDir(Dir: widestring); var SLen: integer; @@ -150,10 +249,10 @@ var {$ifdef MSWINDOWS} SR: TSearchRecW; // for parsing Songs Directory {$else} // This should work on all posix systems. - TheDir : pdir; - ADirent : pDirent; + TheDir : oldlinux.pdir; + ADirent : oldlinux.pDirent; Entry : Longint; - info : stat; + info : oldlinux.stat; {$endif} begin {$ifdef MSWINDOWS} @@ -201,11 +300,11 @@ begin {$IFDEF LINUX} // Itterate the Songs Directory... ( With unicode capable functions for linux ) - TheDir := opendir( Dir ); // JB_Unicode - linux + TheDir := oldlinux.opendir( Dir ); // JB_Unicode - linux if TheDir <> nil then begin repeat - ADirent := ReadDir(TheDir); + ADirent := oldlinux.ReadDir(TheDir); If ADirent<>Nil then begin @@ -222,11 +321,11 @@ begin - TheDir := opendir( Dir ); // JB_Unicode - linux + TheDir := oldlinux.opendir( Dir ); // JB_Unicode - linux if TheDir <> nil then begin repeat - ADirent := ReadDir(TheDir); + ADirent := oldlinux.ReadDir(TheDir); if ( ADirent <> Nil ) AND ( pos( '.txt', ADirent^.name ) > 0 ) then diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index 630c0873..dc8fb781 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -11,6 +11,11 @@ program UltraStar; {$I switches.inc} uses + {$ifdef unix} // http://wiki.lazarus.freepascal.org/Multithreaded_Application_Tutorial + cthreads, // THIS MUST be the first used unit !! + {$endif} + + syscall, // *************************************************************************** // @@ -212,8 +217,5 @@ const Version = 'UltraStar Deluxe V 1.10 Alpha Build'; begin - main(); - - end. -- cgit v1.2.3 From fd6d416f75bc316dca4356b5b8e5c7e317d1f156 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Fri, 2 Nov 2007 07:15:11 +0000 Subject: fix bad build#USDX-DELPHI-99 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@550 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/USongs.pas | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index e3b2f3b2..6a58a8dd 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -187,14 +187,15 @@ begin end; procedure TSongs.Execute(); +(* var - lrfds : fdSet; time : Ttimeval; res : integer; buf : pchar; len, bufflen : longint; str : String; +*) begin fParseSongDirectory := true; @@ -218,6 +219,7 @@ begin fProcessing := true; Log.LogError('SongList', 'Searching For Songs'); + Setlength(Song, 50); BrowsePos := 0; -- cgit v1.2.3 From 35b7a40253bd38d1e1df8469d4151e99f9978850 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Fri, 2 Nov 2007 11:14:33 +0000 Subject: Runtime theme changing - jira#USDX-156 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@552 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphic.pas | 39 ++++++++++++++++++++++- Game/Code/Screens/UScreenOptionsThemes.pas | 51 ++++++++++++++++++++++++++++-- 2 files changed, 86 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index bfad2d73..e13fdf43 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -230,6 +230,7 @@ procedure LoadTextures; procedure InitializeScreen; procedure LoadLoadingScreen; procedure LoadScreens; +procedure UnLoadScreens; function LoadingThreadFunction: integer; @@ -692,7 +693,7 @@ begin ScreenCredits := TScreenCredits.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Credits', 3); Log.BenchmarkStart(3); - end; +end; function LoadingThreadFunction: integer; begin @@ -700,4 +701,40 @@ begin Result:= 1; end; +procedure UnLoadScreens; +begin + freeandnil( ScreenMain ); + freeandnil( ScreenName ); + freeandnil( ScreenLevel); + freeandnil( ScreenSong ); + freeandnil( ScreenSongMenu ); + freeandnil( ScreenSing ); + freeandnil( ScreenScore); + freeandnil( ScreenTop5 ); + freeandnil( ScreenOptions ); + freeandnil( ScreenOptionsGame ); + freeandnil( ScreenOptionsGraphics ); + freeandnil( ScreenOptionsSound ); + freeandnil( ScreenOptionsLyrics ); +// freeandnil( ScreenOptionsThemes ); + freeandnil( ScreenOptionsRecord ); + freeandnil( ScreenOptionsAdvanced ); + freeandnil( ScreenEditSub ); + freeandnil( ScreenEdit ); + freeandnil( ScreenEditConvert ); + freeandnil( ScreenOpen ); + freeandnil( ScreenSingModi ); + freeandnil( ScreenSongMenu ); + freeandnil( ScreenSongJumpto); + freeandnil( ScreenPopupCheck ); + freeandnil( ScreenPopupError ); + freeandnil( ScreenPartyNewRound ); + freeandnil( ScreenPartyScore ); + freeandnil( ScreenPartyWin ); + freeandnil( ScreenPartyOptions ); + freeandnil( ScreenPartyPlayer ); + freeandnil( ScreenStatMain ); + freeandnil( ScreenStatDetail ); +end; + end. diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index 750e8859..5b7e4d43 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -37,13 +37,28 @@ begin SDLK_BACKSPACE : begin Ini.Save; + + // Reload all screens, after Theme changed + // Todo : JB - Check if theme was actually changed + UGraphic.UnLoadScreens(); + UGraphic.LoadScreens(); + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; SDLK_RETURN: begin - if SelInteraction = 3 then begin + if SelInteraction = 3 then + begin Ini.Save; + + // Reload all screens, after Theme changed + // Todo : JB - Check if theme was actually changed + UGraphic.UnLoadScreens(); + UGraphic.LoadScreens(); + + UGraphic.LoadScreens(); + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; @@ -54,14 +69,16 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 2) then begin + if (SelInteraction >= 0) and (SelInteraction <= 2) then + begin AudioPlayback.PlayOption; InteractInc; end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 2) then begin + if (SelInteraction >= 0) and (SelInteraction <= 2) then + begin AudioPlayback.PlayOption; InteractDec; end; @@ -78,6 +95,20 @@ begin begin Skin.OnThemeChange; UpdateSelectSlideOptions (Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); + + Theme.LoadTheme('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + + ScreenOptionsThemes := TScreenOptionsThemes.create(); + ScreenOptionsThemes.onshow; + Display.ActualScreen := @ScreenOptionsThemes; + ScreenOptionsThemes.Draw; + + + Display.Draw; + SwapBuffers; + + freeandnil( self ); + end; end; @@ -89,6 +120,20 @@ begin begin Skin.OnThemeChange; UpdateSelectSlideOptions (Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); + + Theme.LoadTheme('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + + ScreenOptionsThemes := TScreenOptionsThemes.create(); + ScreenOptionsThemes.onshow; + Display.ActualScreen := @ScreenOptionsThemes; + ScreenOptionsThemes.Draw; + + + Display.Draw; + SwapBuffers; + + freeandnil( self ); + end; end; -- cgit v1.2.3 From ae057627ff135d55891e9f04f399608fbc47e9ee Mon Sep 17 00:00:00 2001 From: jaybinks Date: Fri, 2 Nov 2007 12:16:50 +0000 Subject: Runtime Song Addition jira:USDX-157 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@553 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudio_FFMpeg.pas | 1 - Game/Code/Classes/UCatCovers.pas | 2 +- Game/Code/Classes/UMain.pas | 1 + Game/Code/Classes/USongs.pas | 66 +++++++++++++++++++------- Game/Code/Screens/UScreenSong.pas | 95 +++++++++++++++++++++++++++++++++++-- Game/Code/UltraStar.dpr | 2 + 6 files changed, 145 insertions(+), 22 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudio_FFMpeg.pas b/Game/Code/Classes/UAudio_FFMpeg.pas index afbb23c1..b89fa00f 100644 --- a/Game/Code/Classes/UAudio_FFMpeg.pas +++ b/Game/Code/Classes/UAudio_FFMpeg.pas @@ -380,7 +380,6 @@ end; procedure TAudio_ffMpeg.PlayStart; begin - // LoadSoundFromFile(BassStart, SoundPath + 'foo fighters - best of you.mp3'); // TODO : jb_linux replace with something other than bass diff --git a/Game/Code/Classes/UCatCovers.pas b/Game/Code/Classes/UCatCovers.pas index b1c91e48..516544be 100644 --- a/Game/Code/Classes/UCatCovers.pas +++ b/Game/Code/Classes/UCatCovers.pas @@ -49,7 +49,7 @@ var Name, Filename, Temp: string; begin try - Ini := TMemIniFile.Create(CoversPath + 'covers.ini'); + Ini := TMemIniFile.Create(CoversPath + 'covers.ini'); List := TStringlist.Create; //Add every Cover in Covers Ini for Every Sorting option diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index d7ae51f4..fa4c45b5 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -303,6 +303,7 @@ begin Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; + Log.BenchmarkEnd(1); Log.LogBenchmark('Loading Songs', 1); diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 6a58a8dd..2eeeec87 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -8,17 +8,21 @@ interface {$I switches.inc} -uses SysUtils, +uses {$ifndef MSWINDOWS} - {$IFDEF DARWIN} - baseunix, - {$ELSE} - oldlinux, - {$ENDIF} + {$IFDEF DARWIN} + baseunix, + {$ELSE} + oldlinux, + {$ENDIF} baseunix, UnixType, syscall, + {$else} + windows, + DirWatch, {$endif} + SysUtils, Classes, ULog, UTexture, @@ -87,7 +91,11 @@ type fWatch : longint; fParseSongDirectory : boolean; fProcessing : boolean; + {$ifdef win32} + fDirWatch : TDirectoryWatch; + {$endif} procedure int_LoadSongList; + procedure DoDirChanged(Sender: TObject); protected procedure Execute; override; public @@ -143,6 +151,8 @@ const implementation uses StrUtils, + UGraphic, + UCovers, UFiles, UMain, UIni; @@ -159,6 +169,14 @@ begin inherited create( false ); self.freeonterminate := true; + {$IFDEF Win32} + fDirWatch := TDirectoryWatch.create(nil); + fDirWatch.OnChange := DoDirChanged; + fDirWatch.Directory := SongPath; + fDirWatch.WatchSubDirs := true; + fDirWatch.active := true; + {$ENDIF} + {$IFDEF linux} (* Thankyou to : http://www.linuxjournal.com/article/8478 @@ -186,23 +204,21 @@ begin Setlength(Song, 0); end; +procedure TSongs.DoDirChanged(Sender: TObject); +begin + LoadSongList(); +end; + procedure TSongs.Execute(); -(* var - lrfds : fdSet; - time : Ttimeval; - res : integer; - buf : pchar; - len, bufflen : longint; - str : String; -*) + fChangeNotify : THandle; begin fParseSongDirectory := true; while not self.terminated do begin -// if fParseSongDirectory then + if fParseSongDirectory then begin writeln( 'int_LoadSongList' ); int_LoadSongList(); @@ -217,7 +233,8 @@ procedure TSongs.int_LoadSongList; begin try fProcessing := true; - + Setlength(Song, 0); + Log.LogError('SongList', 'Searching For Songs'); Setlength(Song, 50); @@ -228,6 +245,23 @@ begin //Set Correct SongArray Length SetLength(Song, BrowsePos); + + if assigned( CatSongs ) then + CatSongs.Refresh; + + if assigned( CatCovers ) then + CatCovers.Load; + + if assigned( Covers ) then + Covers.Load; + + if assigned(ScreenSong) then + begin + ScreenSong.GenerateThumbnails(); + ScreenSong.OnShow; // refresh ScreenSong + end; + + finally Log.LogError('SongList', 'Search Complete'); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 85c38c26..bd9e5e67 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -92,6 +92,7 @@ type procedure SetScroll6; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; function Draw: boolean; override; + procedure GenerateThumbnails(); procedure onShow; override; procedure onHide; override; procedure SelectNext; @@ -696,9 +697,9 @@ end; constructor TScreenSong.Create; var - Pet: integer; +// Pet: integer; I: integer; -Label CreateSongButtons; +//Label CreateSongButtons; begin inherited Create; @@ -755,6 +756,8 @@ begin // Songs.LoadSongList; // moved to the UltraStar unit CatSongs.Refresh; + GenerateThumbnails(); +(* if (length(CatSongs.Song) > 0) then begin //Set Length of Button Array one Time Instead of one time for every Song @@ -830,6 +833,7 @@ begin GoTo CreateSongButtons; end; +*) // Randomize Patch Randomize; @@ -843,6 +847,89 @@ begin Interaction := 0; end; +procedure TScreenSong.GenerateThumbnails(); +var + I : Integer; + Pet: integer; +Label CreateSongButtons; +begin + if (length(CatSongs.Song) > 0) then + begin + //Set Length of Button Array one Time Instead of one time for every Song + SetButtonLength(Length(CatSongs.Song)); + + I := 0; + CreateSongButtons: + + try + for Pet := I to High(CatSongs.Song) do begin // creating all buttons + // new + Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 + + if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' + + if CatSongs.Song[Pet].Cover = '' then + AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) + else begin + // cache texture if there is a need to this + if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + begin + Texture.CreateCacheMipmap := true; + Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap + Texture.CreateCacheMipmap := false; + + // puts this texture to the cache file + Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + + // unload full size texture + Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); + + // we should also add mipmap texture by calling createtexture and use mipmap cache as data source + end; + + // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) + AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + end; + Texture.Limit := 1024*1024; + I := -1; + end; + except + //When Error is reported the First time for this Song + if (I <> Pet) then + begin + //Some Error reporting: + Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); + + //Change Cover to NoCover and Continue Loading + CatSongs.Song[Pet].Cover := ''; + I := Pet; + end + else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song + begin + Log.LogError('NoCover Cover is damaged!'); + try + AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); + except + {$IFDEF MSWINDOWS} + Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); + {$ELSE} + // TODO : JB_linux - better handle this message and display to user.. + writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'); + Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' ); + {$ENDIF} + Halt; + end; + I := Pet + 1; + end; + end; + + if (I <> -1) then + GoTo CreateSongButtons; + + end; +end; + procedure TScreenSong.SetScroll; var VS, B: Integer; @@ -1418,7 +1505,7 @@ begin AudioPlayback.Stop; if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; - if Ini.Players = 4 then PlayersPlay := 6; + if Ini.Players = 4 then PlayersPlay := 6; //Cat Mod etc if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then @@ -1701,7 +1788,7 @@ begin UnLoadDetailedCover; Interaction := High(CatSongs.Song); - SongTarget := 0; + SongTarget := 0; for I := 1 to Target+1 do SelectNext; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 80312bd1..2e04df9f 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -36,6 +36,8 @@ uses opt in 'lib\ffmpeg\opt.pas', avio in 'lib\ffmpeg\avio.pas', + DirWatch in 'lib\other\DirWatch.pas', + SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', SQLite3 in 'lib\SQLite\SQLite3.pas', -- cgit v1.2.3 From bb1af96ecfcb42631137136f8f90b6780039e15f Mon Sep 17 00:00:00 2001 From: jaybinks Date: Fri, 2 Nov 2007 12:19:23 +0000 Subject: oops git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@554 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/other/DirWatch.dcu | Bin 0 -> 9101 bytes Game/Code/lib/other/DirWatch.pas | 334 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 334 insertions(+) create mode 100644 Game/Code/lib/other/DirWatch.dcu create mode 100644 Game/Code/lib/other/DirWatch.pas (limited to 'Game/Code') diff --git a/Game/Code/lib/other/DirWatch.dcu b/Game/Code/lib/other/DirWatch.dcu new file mode 100644 index 00000000..e82e738b Binary files /dev/null and b/Game/Code/lib/other/DirWatch.dcu differ diff --git a/Game/Code/lib/other/DirWatch.pas b/Game/Code/lib/other/DirWatch.pas new file mode 100644 index 00000000..88c3489e --- /dev/null +++ b/Game/Code/lib/other/DirWatch.pas @@ -0,0 +1,334 @@ +unit DirWatch; + +// ----------------------------------------------------------------------------- +// Component Name: TDirectoryWatch . +// Module: DirWatch . +// Description: Implements watching for file changes in a designated . +// directory (or directories). . +// Version: 1.4 . +// Date: 10-MAR-2003 . +// Target: Win32, Delphi 3 - Delphi 7 . +// Author: Angus Johnson, angusj-AT-myrealbox-DOT-com . +// A portion of code has been copied from the Drag & Drop . +// Component Suite which I co-authored with Anders Melander. . +// Copyright: © 2003 Angus Johnson . +// . +// Usage: 1. Add a TDirectoryWatch component to your form. . +// 2. Set its Directory property . +// 3. If you wish to watch its subdirectories too then set . +// the WatchSubDir property to true . +// 4. Assign the OnChange event . +// 5. Set Active to true . +// ----------------------------------------------------------------------------- + +interface + +uses + Windows, Messages, SysUtils, Forms, Classes; + +type + TNotifyFilters = set of (nfFilename, nfDirname, nfAttrib, + nfSize, nfLastWrite, nfSecurity); + + TWatchThread = class; //forward declaration + + TDirectoryWatch = class(TComponent) + private + fWindowHandle: THandle; + fWatchThread: TWatchThread; + fWatchSubDirs: boolean; + fDirectory: string; + fActive: boolean; + fNotifyFilters: TNotifyFilters; //see FindFirstChangeNotification in winAPI + fOnChangeEvent: TNotifyEvent; + procedure SetActive(aActive: boolean); + procedure SetDirectory(aDir: string); + procedure SetWatchSubDirs(aWatchSubDirs: boolean); + procedure SetNotifyFilters(aNotifyFilters: TNotifyFilters); + procedure WndProc(var aMsg: TMessage); + public + constructor Create(aOwner: TComponent); override; + destructor Destroy; override; + published + property Directory: string read fDirectory write SetDirectory; + property NotifyFilters: TNotifyFilters + read fNotifyFilters write SetNotifyFilters; + property WatchSubDirs: boolean read fWatchSubDirs write SetWatchSubDirs; + property Active: boolean read fActive write SetActive; + property OnChange: TNotifyEvent read fOnChangeEvent write fOnChangeEvent; + end; + + TWatchThread = class(TThread) + private + fOwnerHdl: Thandle; + fChangeNotify : THandle; //Signals whenever Windows detects a change in . + //the watched directory . + fBreakEvent: THandle; //Signals when either the Directory property . + //changes or when the thread terminates . + fDirectory: string; + fWatchSubDirs: longbool; + fNotifyFilters: dword; + fFinished: boolean; + protected + procedure SetDirectory(const Value: string); + procedure ProcessFilenameChanges; + procedure Execute; override; + public + constructor Create( OwnerHdl: THandle; + const InitialDir: string; WatchSubDirs: boolean; NotifyFilters: dword); + destructor Destroy; override; + procedure Terminate; + property Directory: string write SetDirectory; + end; + +procedure Register; + +implementation + +const + NOTIFYCHANGE_MESSAGE = WM_USER + 1; + +resourcestring + sInvalidDir = 'Invalid Directory: '; + +//---------------------------------------------------------------------------- +// Miscellaneous functions ... +//---------------------------------------------------------------------------- + +procedure Register; +begin + RegisterComponents('Samples', [TDirectoryWatch]); +end; +//---------------------------------------------------------------------------- + +function DirectoryExists(const Name: string): Boolean; +var + Code: Integer; +begin + Code := GetFileAttributes(PChar(Name)); + Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0); +end; + +//---------------------------------------------------------------------------- +// TDirectoryWatch methods ... +//---------------------------------------------------------------------------- + +constructor TDirectoryWatch.Create(aOwner: TComponent); +begin + inherited Create(aOwner); + //default Notify values - notify if either a file name or a directory name + //changes or if a file is modified ... + fNotifyFilters := [nfFilename, nfDirname, nfLastWrite]; + fDirectory := 'C:\'; + //this non-visual control needs to handle messages, so ... + if not (csDesigning in ComponentState) then + fWindowHandle := AllocateHWnd(WndProc); +end; +//---------------------------------------------------------------------------- + +destructor TDirectoryWatch.Destroy; +begin + Active := false; + if not (csDesigning in ComponentState) then + DeallocateHWnd(fWindowHandle); + inherited Destroy; +end; +//---------------------------------------------------------------------------- + +procedure TDirectoryWatch.WndProc(var aMsg: TMessage); +begin + with aMsg do + if Msg = NOTIFYCHANGE_MESSAGE then + begin + if assigned(OnChange) then OnChange(self); + end else + Result := DefWindowProc(FWindowHandle, Msg, wParam, lParam); +end; +//------------------------------------------------------------------------------ + +procedure TDirectoryWatch.SetNotifyFilters(aNotifyFilters: TNotifyFilters); +begin + if aNotifyFilters = fNotifyFilters then exit; + fNotifyFilters := aNotifyFilters; + if assigned(fWatchThread) then + begin + Active := false; + Active := true; + end; +end; +//------------------------------------------------------------------------------ + +procedure TDirectoryWatch.SetWatchSubDirs(aWatchSubDirs: boolean); +begin + if aWatchSubDirs = fWatchSubDirs then exit; + fWatchSubDirs := aWatchSubDirs; + if assigned(fWatchThread) then + begin + Active := false; + Active := true; + end; +end; +//------------------------------------------------------------------------------ + +procedure TDirectoryWatch.SetDirectory(aDir: string); +begin + if aDir = '' then + begin + Active := false; + fDirectory := ''; + exit; + end; + if (aDir[length(aDir)] <> '\') then aDir := aDir + '\'; + if aDir = fDirectory then exit; + if not (csDesigning in ComponentState) and not DirectoryExists(aDir) then + raise Exception.Create( sInvalidDir + aDir); + fDirectory := aDir; + if assigned(fWatchThread) then + fWatchThread.Directory := fDirectory; +end; +//------------------------------------------------------------------------------ + +procedure TDirectoryWatch.SetActive(aActive: boolean); +var + nf: dword; +begin + if aActive = fActive then exit; + fActive := aActive; + if csDesigning in ComponentState then exit; + if fActive then + begin + if not DirectoryExists(fDirectory) then + begin + fActive := false; + raise Exception.Create(sInvalidDir + fDirectory); + end; + nf := 0; + if nfFilename in fNotifyFilters then + nf := nf or FILE_NOTIFY_CHANGE_FILE_NAME; + if nfDirname in fNotifyFilters then + nf := nf or FILE_NOTIFY_CHANGE_DIR_NAME; + if nfAttrib in fNotifyFilters then + nf := nf or FILE_NOTIFY_CHANGE_ATTRIBUTES; + if nfSize in fNotifyFilters then + nf := nf or FILE_NOTIFY_CHANGE_SIZE; + if nfLastWrite in fNotifyFilters then + nf := nf or FILE_NOTIFY_CHANGE_LAST_WRITE; + if nfSecurity in fNotifyFilters then + nf := nf or FILE_NOTIFY_CHANGE_SECURITY; + fWatchThread := TWatchThread.Create( + fWindowHandle, fDirectory, fWatchSubDirs, nf); + end else + begin + fWatchThread.Terminate; + fWatchThread := nil; + end; +end; + +//---------------------------------------------------------------------------- +// TWatchThread methods ... +//---------------------------------------------------------------------------- + +constructor TWatchThread.Create(OwnerHdl: THandle; + const InitialDir: string; WatchSubDirs: boolean; NotifyFilters: dword); +begin + inherited Create(True); + fOwnerHdl := OwnerHdl; + if WatchSubDirs then + cardinal(fWatchSubDirs) := 1 //workaround a Win9x OS issue + else + fWatchSubDirs := false; + FreeOnTerminate := true; + Priority := tpLowest; + fDirectory := InitialDir; + fNotifyFilters := NotifyFilters; + fBreakEvent := windows.CreateEvent(nil, False, False, nil); + Resume; +end; +//------------------------------------------------------------------------------ + +destructor TWatchThread.Destroy; +begin + CloseHandle(fBreakEvent); + inherited Destroy; +end; +//------------------------------------------------------------------------------ + +procedure TWatchThread.SetDirectory(const Value: string); +begin + if (Value = FDirectory) then exit; + FDirectory := Value; + SetEvent(fBreakEvent); +end; +//------------------------------------------------------------------------------ + +procedure TWatchThread.Terminate; +begin + inherited Terminate; + SetEvent(fBreakEvent); + while not fFinished do sleep(10); //avoids a reported resource leak + //if called while closing the application. +end; +//------------------------------------------------------------------------------ + +procedure TWatchThread.Execute; +begin + //OUTER LOOP - manages Directory property reassignments + while (not Terminated) do + begin + fChangeNotify := FindFirstChangeNotification(pchar(fDirectory), + fWatchSubDirs, fNotifyFilters); + if (fChangeNotify = INVALID_HANDLE_VALUE) then + //Can't monitor the specified directory so we'll just wait for + //a new Directory assignment or the thread terminating ... + WaitForSingleObject(fBreakEvent, INFINITE) + else + try + //Now do the INNER loop... + ProcessFilenameChanges; + finally + FindCloseChangeNotification(fChangeNotify); + end; + end; + fFinished := true; +end; +//------------------------------------------------------------------------------ + +procedure TWatchThread.ProcessFilenameChanges; +var + WaitResult : DWORD; + HandleArray : array[0..1] of THandle; +const + TEN_MSECS = 10; + HUNDRED_MSECS = 100; +begin + HandleArray[0] := fBreakEvent; + HandleArray[1] := fChangeNotify; + //INNER LOOP - exits only when fBreakEvent signaled + while (not Terminated) do + begin + //waits for either fChangeNotify or fBreakEvent ... + WaitResult := WaitForMultipleObjects(2, @HandleArray, False, INFINITE); + if (WaitResult = WAIT_OBJECT_0 + 1) then //fChangeNotify + begin + repeat //ie: if a number of files are changing in a block + //just post the one notification message ... + FindNextChangeNotification(fChangeNotify); + until Terminated or + (WaitForSingleObject(fChangeNotify, TEN_MSECS) <> WAIT_OBJECT_0); + if Terminated then break; + //OK, now notify the main thread (before restarting inner loop)... + PostMessage(fOwnerHdl, NOTIFYCHANGE_MESSAGE, 0, 0); + end else //fBreakEvent ... + begin + //If the Directory property is undergoing multiple rapid reassignments + //wait 'til this stops before restarting monitoring of a new directory ... + while (not Terminated) and + (WaitForSingleObject(fBreakEvent, HUNDRED_MSECS) = WAIT_OBJECT_0) do; + break; //EXIT LOOP HERE + end; + end; +end; +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ + +end. \ No newline at end of file -- cgit v1.2.3 From 7707816349d4bd2a14e9140e85c65f0bfd713718 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Fri, 2 Nov 2007 18:40:41 +0000 Subject: Fixed MacOSX version. Can we use baseunix on linux? We could drop oldlinux then (not available on the mac). git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@555 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMain.pas | 1 - Game/Code/Classes/USongs.pas | 36 +- Game/Code/MacOSX/UltraStarDX.pas | 3 - Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 | 198 +++++---- .../MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser | 450 +++++++++++---------- .../MacOSX/UltraStarDX.xcodeproj/project.pbxproj | 6 + 6 files changed, 368 insertions(+), 326 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index fa4c45b5..e4acf4aa 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -145,7 +145,6 @@ uses USongs, UJoystick, math, UCommandLine, ULanguage, SDL_ttf, const Version = 'UltraStar Deluxe V 1.10 Alpha Build'; -//{$IFDEF WIN32} Procedure Main; var WndTitle: string; diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 2eeeec87..7fd58034 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -9,19 +9,17 @@ interface {$I switches.inc} uses - {$ifndef MSWINDOWS} - {$IFDEF DARWIN} - baseunix, - {$ELSE} + {$IFDEF MSWINDOWS} + Windows, + DirWatch, + {$ELSE} + {$IFNDEF DARWIN} oldlinux, + syscall, {$ENDIF} baseunix, UnixType, - syscall, - {$else} - windows, - DirWatch, - {$endif} + {$ENDIF} SysUtils, Classes, ULog, @@ -91,7 +89,7 @@ type fWatch : longint; fParseSongDirectory : boolean; fProcessing : boolean; - {$ifdef win32} + {$ifdef MSWINDOWS} fDirWatch : TDirectoryWatch; {$endif} procedure int_LoadSongList; @@ -169,7 +167,7 @@ begin inherited create( false ); self.freeonterminate := true; - {$IFDEF Win32} + {$IFDEF MSWINDOWS} fDirWatch := TDirectoryWatch.create(nil); fDirWatch.OnChange := DoDirChanged; fDirWatch.Directory := SongPath; @@ -206,7 +204,7 @@ end; procedure TSongs.DoDirChanged(Sender: TObject); begin - LoadSongList(); + LoadSongList(); end; procedure TSongs.Execute(); @@ -284,12 +282,22 @@ var {$ifdef MSWINDOWS} SR: TSearchRecW; // for parsing Songs Directory - {$else} // This should work on all posix systems. + {$ENDIF} + + // eddie: can we merge that? is baseunix working on linux? oldlinux is + // not available on mac os x. + {$IFDEF LINUX} TheDir : oldlinux.pdir; ADirent : oldlinux.pDirent; Entry : Longint; info : oldlinux.stat; - {$endif} + {$ENDIF} + {$IFDEF DARWIN} + TheDir : pdir; + ADirent : pDirent; + Entry : Longint; + info : stat; + {$ENDIF} begin {$ifdef MSWINDOWS} if FindFirstW(Dir + '*', faDirectory, SR) = 0 then // JB_Unicode - windows diff --git a/Game/Code/MacOSX/UltraStarDX.pas b/Game/Code/MacOSX/UltraStarDX.pas index b531244f..6c5d4e2b 100644 --- a/Game/Code/MacOSX/UltraStarDX.pas +++ b/Game/Code/MacOSX/UltraStarDX.pas @@ -2,10 +2,7 @@ program UltraStarDX; uses UMain, UAudio_bass, UAudio_FFMpeg, UMedia_dummy, USingNotes, UTextClasses, UVideo; -var i : Integer; - begin - i := 0; Main; end. diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 index 4350b967..12cc23e0 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 @@ -190,24 +190,24 @@ Content PBXProjectModuleGUID - 2CF552990CDA426600627463 + 2CDC71470CDB9AAB0018F966 PBXProjectModuleLabel - UMain.pas + USongs.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2CF5529A0CDA426600627463 + 2CDC71480CDB9AAB0018F966 PBXProjectModuleLabel - UMain.pas + USongs.pas _historyCapacity 0 bookmark - 2CF553BB0CDA5A4D00627463 + 2CDC71AB0CDBA6300018F966 history - 2CF553B10CDA5A2F00627463 + 2CDC71650CDB9BCE0018F966 SplitCount @@ -219,35 +219,35 @@ Geometry Frame - {{0, 20}, {1052, 646}} + {{0, 20}, {797, 748}} PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 222 147 1052 687 0 0 1680 1028 + 84 171 797 789 0 0 1680 1028 Content PBXProjectModuleGUID - 2CF552960CDA426600627463 + 2CF5536C0CDA575B00627463 PBXProjectModuleLabel - UAudio_FFMpeg.pas + UltraStarDX.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2CF552970CDA426600627463 + 2CF5536D0CDA575B00627463 PBXProjectModuleLabel - UAudio_FFMpeg.pas + UltraStarDX.pas _historyCapacity 0 bookmark - 2CF553BC0CDA5A4D00627463 + 2CDC71AC0CDBA6300018F966 history - 2CF553940CDA58E900627463 + 2CDC717C0CDB9D150018F966 SplitCount @@ -259,35 +259,35 @@ Geometry Frame - {{0, 20}, {797, 748}} + {{0, 20}, {987, 762}} PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 38 213 797 789 0 0 1680 1028 + 189 142 987 803 0 0 1680 1028 Content PBXProjectModuleGUID - 2CF552930CDA426600627463 + 2CF552990CDA426600627463 PBXProjectModuleLabel - UAudio_bass.pas + UMain.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2CF552940CDA426600627463 + 2CF5529A0CDA426600627463 PBXProjectModuleLabel - UAudio_bass.pas + UMain.pas _historyCapacity 0 bookmark - 2CF553BD0CDA5A4D00627463 + 2CDC71AD0CDBA6300018F966 history - 2CF553960CDA58E900627463 + 2CDE61980CDB99D400E8B3D1 SplitCount @@ -299,35 +299,35 @@ Geometry Frame - {{0, 20}, {797, 748}} + {{0, 20}, {1052, 646}} PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 15 234 797 789 0 0 1680 1028 + 222 147 1052 687 0 0 1680 1028 Content PBXProjectModuleGUID - 2CF5536C0CDA575B00627463 + 2CF552960CDA426600627463 PBXProjectModuleLabel - UltraStarDX.pas + UAudio_FFMpeg.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2CF5536D0CDA575B00627463 + 2CF552970CDA426600627463 PBXProjectModuleLabel - UltraStarDX.pas + UAudio_FFMpeg.pas _historyCapacity 0 bookmark - 2CF553BE0CDA5A4D00627463 + 2CDC71AE0CDBA6300018F966 history - 2CF553670CDA575100627463 + 2CDE61990CDB99D400E8B3D1 SplitCount @@ -339,35 +339,35 @@ Geometry Frame - {{0, 20}, {987, 762}} + {{0, 20}, {797, 748}} PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 189 142 987 803 0 0 1680 1028 + 38 213 797 789 0 0 1680 1028 Content PBXProjectModuleGUID - 2CF5536F0CDA575B00627463 + 2CF552930CDA426600627463 PBXProjectModuleLabel - sdl_image.pas + UAudio_bass.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2CF553700CDA575B00627463 + 2CF552940CDA426600627463 PBXProjectModuleLabel - sdl_image.pas + UAudio_bass.pas _historyCapacity 0 bookmark - 2CF553BF0CDA5A4D00627463 + 2CDC71AF0CDBA6300018F966 history - 2CF553060CDA514A00627463 + 2CDE619A0CDB99D400E8B3D1 SplitCount @@ -379,35 +379,35 @@ Geometry Frame - {{0, 20}, {1052, 646}} + {{0, 20}, {797, 748}} PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 15 336 1052 687 0 0 1680 1028 + 15 234 797 789 0 0 1680 1028 Content PBXProjectModuleGUID - 2CF553720CDA575B00627463 + 2CF5536F0CDA575B00627463 PBXProjectModuleLabel - sdl.pas + sdl_image.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2CF553730CDA575B00627463 + 2CF553700CDA575B00627463 PBXProjectModuleLabel - sdl.pas + sdl_image.pas _historyCapacity 0 bookmark - 2CF553C00CDA5A4D00627463 + 2CDC71B00CDBA6300018F966 history - 2CF553040CDA513000627463 + 2CDE619C0CDB99D400E8B3D1 SplitCount @@ -419,35 +419,35 @@ Geometry Frame - {{0, 20}, {987, 762}} + {{0, 20}, {1052, 646}} PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 211 199 987 803 0 0 1680 1028 + 15 336 1052 687 0 0 1680 1028 Content PBXProjectModuleGUID - 2CF553750CDA575B00627463 + 2CF553720CDA575B00627463 PBXProjectModuleLabel - UTexture.pas + sdl.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2CF553760CDA575B00627463 + 2CF553730CDA575B00627463 PBXProjectModuleLabel - UTexture.pas + sdl.pas _historyCapacity 0 bookmark - 2CF553C10CDA5A4D00627463 + 2CDC71B10CDBA6300018F966 history - 2CF552FF0CDA500800627463 + 2CDE619D0CDB99D400E8B3D1 SplitCount @@ -459,35 +459,35 @@ Geometry Frame - {{0, 20}, {616, 644}} + {{0, 20}, {987, 762}} PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 15 338 616 685 0 0 1680 1028 + 211 199 987 803 0 0 1680 1028 Content PBXProjectModuleGUID - 2CF5528D0CDA426600627463 + 2CF553750CDA575B00627463 PBXProjectModuleLabel - Windows.pas + UTexture.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2CF5528E0CDA426600627463 + 2CF553760CDA575B00627463 PBXProjectModuleLabel - Windows.pas + UTexture.pas _historyCapacity 0 bookmark - 2CF553C20CDA5A4D00627463 + 2CDC71B20CDBA6300018F966 history - 2CF553780CDA575B00627463 + 2CDE619E0CDB99D400E8B3D1 SplitCount @@ -503,31 +503,31 @@ PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 176 191 616 685 0 0 1680 1028 + 15 338 616 685 0 0 1680 1028 Content PBXProjectModuleGUID - 2CF5528A0CDA426600627463 + 2CF5528D0CDA426600627463 PBXProjectModuleLabel - Messages.pas + Windows.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2CF5528B0CDA426600627463 + 2CF5528E0CDA426600627463 PBXProjectModuleLabel - Messages.pas + Windows.pas _historyCapacity 0 bookmark - 2CF553C30CDA5A4D00627463 + 2CDC71B30CDBA6300018F966 history - 2CF552760CDA419B00627463 + 2CDE619F0CDB99D400E8B3D1 SplitCount @@ -539,11 +539,11 @@ Geometry Frame - {{0, 20}, {1052, 646}} + {{0, 20}, {616, 644}} PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 102 232 1052 687 0 0 1680 1028 + 176 191 616 685 0 0 1680 1028 @@ -617,19 +617,18 @@ DDC6850D09F5717A004E4BFF DD7C45450A6E72DE003FA52B + 2CF5510C0CDA28F000627463 DDC6868A09F571C2004E4BFF 2CDD8D0B0CC5539900E4169D DDC6888C09F57243004E4BFF DDC688C809F574E9004E4BFF 1C37FBAC04509CD000000102 - 2CF5536A0CDA575B00627463 - 2CF5536B0CDA575B00627463 1C37FAAC04509CD000000102 PBXSmartGroupTreeModuleOutlineStateSelectionKey - 17 + 25 15 0 @@ -654,7 +653,7 @@ 266 RubberWindowFrame - 775 270 817 753 0 0 1680 1028 + 773 270 817 753 0 0 1680 1028 Module PBXSmartGroupTreeModule @@ -691,7 +690,7 @@ Frame {{0, 0}, {529, 0}} RubberWindowFrame - 775 270 817 753 0 0 1680 1028 + 773 270 817 753 0 0 1680 1028 Module PBXNavigatorGroup @@ -713,7 +712,7 @@ Frame {{0, 5}, {529, 707}} RubberWindowFrame - 775 270 817 753 0 0 1680 1028 + 773 270 817 753 0 0 1680 1028 Module XCDetailModule @@ -737,9 +736,9 @@ TableOfContents - 2CF5501B0CDA1CD700627463 + 2CDC71380CDB9A4A0018F966 1CE0B1FE06471DED0097A5F4 - 2CF5501C0CDA1CD700627463 + 2CDC71390CDB9A4A0018F966 1CE0B20306471E060097A5F4 1CE0B20506471E060097A5F4 @@ -873,26 +872,25 @@ 5 WindowOrderList - 2CF5537F0CDA575B00627463 - 2CF553800CDA575B00627463 + 2CDC71910CDB9D2D0018F966 + 2CDC71920CDB9D2D0018F966 2CDD4BFC0CB948FC00549FAC - 2CF54F210CDA14A100627463 - 2CF5528A0CDA426600627463 + 2CDC718F0CDB9D2D0018F966 2CF5528D0CDA426600627463 - 1C530D57069F1CE1000CFCEE 2CF553750CDA575B00627463 2CF553720CDA575B00627463 2CF5536F0CDA575B00627463 - 2CDD4B730CB935C700549FAC - 2CF5536C0CDA575B00627463 2CF552930CDA426600627463 2CF552960CDA426600627463 - /Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj 2CF552990CDA426600627463 + /Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj + 2CDD4B730CB935C700549FAC + 2CF5536C0CDA575B00627463 1CD10A99069EF8BA00B06720 + 2CDC71470CDB9AAB0018F966 WindowString - 775 270 817 753 0 0 1680 1028 + 773 270 817 753 0 0 1680 1028 WindowTools @@ -913,7 +911,7 @@ PBXProjectModuleGUID 1CD0528F0623707200166675 PBXProjectModuleLabel - UAudio_FFMpeg.pas + UltraStarDX.pas StatusBarVisibility @@ -971,7 +969,7 @@ TableOfContents 2CDD4B730CB935C700549FAC - 2CF54F1A0CDA14A100627463 + 2CDC71520CDB9AAB0018F966 1CD0528F0623707200166675 XCMainBuildResultsModuleGUID @@ -1013,8 +1011,8 @@ yes sizes - {{0, 0}, {360, 414}} - {{360, 0}, {604, 414}} + {{0, 0}, {356, 414}} + {{356, 0}, {608, 414}} VerticalSplitView @@ -1077,14 +1075,14 @@ TableOfContents 1CD10A99069EF8BA00B06720 - 2CF54F1B0CDA14A100627463 + 2CDC71890CDB9D2D0018F966 1C162984064C10D400B95A72 - 2CF54F1C0CDA14A100627463 - 2CF54F1D0CDA14A100627463 - 2CF54F1E0CDA14A100627463 - 2CF54F1F0CDA14A100627463 - 2CF54F200CDA14A100627463 - 2CF54F210CDA14A100627463 + 2CDC718A0CDB9D2D0018F966 + 2CDC718B0CDB9D2D0018F966 + 2CDC718C0CDB9D2D0018F966 + 2CDC718D0CDB9D2D0018F966 + 2CDC718E0CDB9D2D0018F966 + 2CDC718F0CDB9D2D0018F966 ToolbarConfiguration xcode.toolbar.config.debug @@ -1238,7 +1236,7 @@ TableOfContents 2CDD4BFC0CB948FC00549FAC - 2CF5537E0CDA575B00627463 + 2CDC71900CDB9D2D0018F966 1C78EAAC065D492600B07095 WindowString diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser index 04871a3e..545200c9 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser @@ -10,17 +10,17 @@ }; 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {884, 9044}}"; + sepNavIntBoundsRect = "{{0, 0}, {884, 9100}}"; sepNavSelRange = "{3202, 12}"; - sepNavVisRect = "{{0, 8328}, {758, 716}}"; + sepNavVisRect = "{{0, 8330}, {758, 716}}"; sepNavWindowFrame = "{{15, 178}, {797, 845}}"; }; }; 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1196, 13216}}"; - sepNavSelRange = "{22728, 0}"; - sepNavVisRect = "{{0, 12500}, {758, 716}}"; + sepNavIntBoundsRect = "{{0, 0}, {1184, 13328}}"; + sepNavSelRange = "{22697, 0}"; + sepNavVisRect = "{{0, 12598}, {758, 716}}"; sepNavWindowFrame = "{{38, 157}, {797, 845}}"; }; }; @@ -194,9 +194,9 @@ }; 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1013, 15092}}"; - sepNavSelRange = "{3295, 0}"; - sepNavVisRect = "{{0, 1684}, {1013, 614}}"; + sepNavIntBoundsRect = "{{0, 0}, {1013, 15078}}"; + sepNavSelRange = "{3441, 0}"; + sepNavVisRect = "{{0, 1680}, {1013, 614}}"; sepNavWindowFrame = "{{222, 91}, {1052, 743}}"; }; }; @@ -298,9 +298,9 @@ }; 2C4D9C890CC9EC8C0031092D /* USongs.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {950, 12544}}"; - sepNavSelRange = "{7215, 0}"; - sepNavVisRect = "{{0, 3298}, {758, 716}}"; + sepNavIntBoundsRect = "{{0, 0}, {950, 14616}}"; + sepNavSelRange = "{7664, 0}"; + sepNavVisRect = "{{0, 3743}, {758, 716}}"; sepNavWindowFrame = "{{84, 115}, {797, 845}}"; }; }; @@ -314,9 +314,9 @@ }; 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1730, 15960}}"; + sepNavIntBoundsRect = "{{0, 0}, {1730, 16016}}"; sepNavSelRange = "{11823, 20}"; - sepNavVisRect = "{{0, 5091}, {577, 612}}"; + sepNavVisRect = "{{0, 5156}, {577, 612}}"; sepNavWindowFrame = "{{15, 282}, {616, 741}}"; }; }; @@ -452,7 +452,7 @@ uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1268, 4788}}"; sepNavSelRange = "{8020, 0}"; - sepNavVisRect = "{{0, 1745}, {1013, 614}}"; + sepNavVisRect = "{{0, 1736}, {1013, 614}}"; sepNavWindowFrame = "{{15, 280}, {1052, 743}}"; }; }; @@ -491,7 +491,7 @@ uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {577, 2352}}"; sepNavSelRange = "{2832, 0}"; - sepNavVisRect = "{{0, 1249}, {577, 612}}"; + sepNavVisRect = "{{0, 1278}, {577, 612}}"; sepNavWindowFrame = "{{176, 135}, {616, 741}}"; }; }; @@ -503,6 +503,134 @@ sepNavWindowFrame = "{{15, 282}, {616, 741}}"; }; }; + 2CDC71650CDB9BCE0018F966 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + comments = "error:column 23 - Identifier not found \"oldlinux\""; + fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; + rLen = 0; + rLoc = 289; + rType = 1; + }; + 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1013, 1022}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {1013, 614}}"; + sepNavWindowFrame = "{{38, 259}, {1052, 743}}"; + }; + }; + 2CDC717C0CDB9D150018F966 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + comments = "warning:column 5 - Local variable \"i\" is assigned but never used"; + fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; + rLen = 1; + rLoc = 4; + rType = 1; + }; + 2CDC71950CDB9D430018F966 /* UMain.pas:156 */ = { + isa = PBXFileBreakpoint; + actions = ( + ); + breakpointStyle = 0; + continueAfterActions = 0; + delayBeforeContinue = 0; + fileReference = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; + hitCount = 1; + lineNumber = 156; + location = UltraStarDX; + modificationTime = 215719249.543694; + state = 1; + }; + 2CDC71AB0CDBA6300018F966 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; + name = "USongs.pas: 288"; + rLen = 0; + rLoc = 7664; + rType = 0; + vrLen = 1174; + vrLoc = 7219; + }; + 2CDC71AC0CDBA6300018F966 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; + name = "UltraStarDX.pas: 6"; + rLen = 0; + rLoc = 117; + rType = 0; + vrLen = 131; + vrLoc = 0; + }; + 2CDC71AD0CDBA6300018F966 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; + name = "UMain.pas: 148"; + rLen = 0; + rLoc = 3441; + rType = 0; + vrLen = 1295; + vrLoc = 2495; + }; + 2CDC71AE0CDBA6300018F966 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; + name = "UAudio_FFMpeg.pas: 952"; + rLen = 0; + rLoc = 22697; + rType = 0; + vrLen = 1224; + vrLoc = 21473; + }; + 2CDC71AF0CDBA6300018F966 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; + name = "nux ... is t"; + rLen = 12; + rLoc = 3202; + rType = 0; + vrLen = 1266; + vrLoc = 15619; + }; + 2CDC71B00CDBA6300018F966 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; + name = "sdl_image.pas: 130"; + rLen = 0; + rLoc = 8020; + rType = 0; + vrLen = 832; + vrLoc = 7978; + }; + 2CDC71B10CDBA6300018F966 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; + name = "sdl.pas: 250"; + rLen = 0; + rLoc = 16506; + rType = 0; + vrLen = 886; + vrLoc = 16376; + }; + 2CDC71B20CDBA6300018F966 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; + name = "TempSurface:=TexSur"; + rLen = 20; + rLoc = 11823; + rType = 0; + vrLen = 1220; + vrLoc = 11066; + }; + 2CDC71B30CDBA6300018F966 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; + name = "Windows.pas: 114"; + rLen = 0; + rLoc = 2832; + rType = 0; + vrLen = 1182; + vrLoc = 2090; + }; 2CDD439C0CBBE92D00F364DE /* UMain.pas */ = { isa = PBXFileReference; fileEncoding = 30; @@ -556,10 +684,80 @@ name = "Project Breakpoints"; objects = ( 2CDEA8080CBD7D920096994C /* UMain.pas:293 */, - 2CF553830CDA578D00627463 /* UMain.pas:148 */, - 2CF553A20CDA59BB00627463 /* UltraStarDX.pas:8 */, + 2CF553A20CDA59BB00627463 /* UltraStarDX.pas:6 */, + 2CDC71950CDB9D430018F966 /* UMain.pas:156 */, ); }; + 2CDE61980CDB99D400E8B3D1 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; + name = "UMain.pas: 142"; + rLen = 0; + rLoc = 3295; + rType = 0; + vrLen = 1288; + vrLoc = 2495; + }; + 2CDE61990CDB99D400E8B3D1 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; + name = "UAudio_FFMpeg.pas: 952"; + rLen = 0; + rLoc = 22697; + rType = 0; + vrLen = 1224; + vrLoc = 21473; + }; + 2CDE619A0CDB99D400E8B3D1 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; + name = "nux ... is t"; + rLen = 12; + rLoc = 3202; + rType = 0; + vrLen = 1266; + vrLoc = 15619; + }; + 2CDE619C0CDB99D400E8B3D1 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; + name = "sdl_image.pas: 130"; + rLen = 0; + rLoc = 8020; + rType = 0; + vrLen = 832; + vrLoc = 7978; + }; + 2CDE619D0CDB99D400E8B3D1 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; + name = "sdl.pas: 250"; + rLen = 0; + rLoc = 16506; + rType = 0; + vrLen = 886; + vrLoc = 16376; + }; + 2CDE619E0CDB99D400E8B3D1 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; + name = "TempSurface:=TexSur"; + rLen = 20; + rLoc = 11823; + rType = 0; + vrLen = 1220; + vrLoc = 11066; + }; + 2CDE619F0CDB99D400E8B3D1 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; + name = "Windows.pas: 114"; + rLen = 0; + rLoc = 2832; + rType = 0; + vrLen = 1182; + vrLoc = 2090; + }; 2CDEA8080CBD7D920096994C /* UMain.pas:293 */ = { isa = PBXFileBreakpoint; actions = ( @@ -571,7 +769,7 @@ hitCount = 1; lineNumber = 293; location = UltraStarDX; - modificationTime = 215636526.320362; + modificationTime = 215719244.976517; state = 1; }; 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */ = { @@ -894,10 +1092,6 @@ sepNavWindowFrame = "{{102, 176}, {1052, 743}}"; }; }; - 2CF552760CDA419B00627463 /* PBXBookmark */ = { - isa = PBXBookmark; - fRef = 2CF552660CDA404000627463 /* Messages.pas */; - }; 2CF5529E0CDA42C900627463 /* avcodec.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1013, 28616}}"; @@ -930,18 +1124,6 @@ sepNavWindowFrame = "{{222, 91}, {1052, 743}}"; }; }; - 2CF552FF0CDA500800627463 /* PBXBookmark */ = { - isa = PBXBookmark; - fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; - }; - 2CF553040CDA513000627463 /* PBXBookmark */ = { - isa = PBXBookmark; - fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; - }; - 2CF553060CDA514A00627463 /* PBXBookmark */ = { - isa = PBXBookmark; - fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; - }; 2CF553070CDA51B500627463 /* sdlutils.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1013, 61068}}"; @@ -950,55 +1132,7 @@ sepNavWindowFrame = "{{38, 259}, {1052, 743}}"; }; }; - 2CF553670CDA575100627463 /* PBXBookmark */ = { - isa = PBXBookmark; - fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; - }; - 2CF553780CDA575B00627463 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; - name = "function GetTickCount : Cardinal;"; - rLen = 35; - rLoc = 2755; - rType = 0; - vrLen = 1149; - vrLoc = 1974; - }; - 2CF553830CDA578D00627463 /* UMain.pas:148 */ = { - isa = PBXFileBreakpoint; - actions = ( - ); - breakpointStyle = 0; - continueAfterActions = 0; - delayBeforeContinue = 0; - fileReference = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; - hitCount = 1; - lineNumber = 148; - location = UltraStarDX; - modificationTime = 215636536.733827; - state = 1; - }; - 2CF553940CDA58E900627463 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; - name = "{$ifdef fpc}"; - rLen = 12; - rLoc = 11808; - rType = 0; - vrLen = 1465; - vrLoc = 718; - }; - 2CF553960CDA58E900627463 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; - name = AllocateHWND; - rLen = 12; - rLoc = 3202; - rType = 0; - vrLen = 1409; - vrLoc = 2690; - }; - 2CF553A20CDA59BB00627463 /* UltraStarDX.pas:8 */ = { + 2CF553A20CDA59BB00627463 /* UltraStarDX.pas:6 */ = { isa = PBXFileBreakpoint; actions = ( ); @@ -1007,111 +1141,11 @@ delayBeforeContinue = 0; fileReference = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; hitCount = 1; - lineNumber = 8; + lineNumber = 6; location = UltraStarDX; - modificationTime = 215636528.021684; + modificationTime = 215719246.517251; state = 1; }; - 2CF553B10CDA5A2F00627463 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; - name = "UMain.pas: 136"; - rLen = 0; - rLoc = 3282; - rType = 0; - vrLen = 1064; - vrLoc = 3295; - }; - 2CF553BB0CDA5A4D00627463 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; - name = "UMain.pas: 138"; - rLen = 0; - rLoc = 3295; - rType = 0; - vrLen = 1415; - vrLoc = 2519; - }; - 2CF553BC0CDA5A4D00627463 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; - name = "UAudio_FFMpeg.pas: 944"; - rLen = 0; - rLoc = 22728; - rType = 0; - vrLen = 1145; - vrLoc = 21583; - }; - 2CF553BD0CDA5A4D00627463 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; - name = AllocateHWND; - rLen = 12; - rLoc = 3202; - rType = 0; - vrLen = 1157; - vrLoc = 15694; - }; - 2CF553BE0CDA5A4D00627463 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; - name = "UltraStarDX.pas: 7"; - rLen = 0; - rLoc = 129; - rType = 0; - vrLen = 159; - vrLoc = 0; - }; - 2CF553BF0CDA5A4D00627463 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; - name = "sdl_image.pas: 130"; - rLen = 0; - rLoc = 8020; - rType = 0; - vrLen = 885; - vrLoc = 7978; - }; - 2CF553C00CDA5A4D00627463 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; - name = "sdl.pas: 250"; - rLen = 0; - rLoc = 16506; - rType = 0; - vrLen = 886; - vrLoc = 16376; - }; - 2CF553C10CDA5A4D00627463 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; - name = SDL_ScaleSurfaceRect; - rLen = 20; - rLoc = 11823; - rType = 0; - vrLen = 1266; - vrLoc = 10980; - }; - 2CF553C20CDA5A4D00627463 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; - name = "Windows.pas: 115"; - rLen = 0; - rLoc = 2832; - rType = 0; - vrLen = 1201; - vrLoc = 2027; - }; - 2CF553C30CDA5A4D00627463 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2CF552660CDA404000627463 /* Messages.pas */; - name = "Messages.pas: 9"; - rLen = 0; - rLoc = 65; - rType = 0; - vrLen = 428; - vrLoc = 0; - }; 9845B6590B1F9B9E0084DD62 /* SDL.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {948, 1330}}"; @@ -1149,8 +1183,8 @@ ); breakpoints = ( 2CDEA8080CBD7D920096994C /* UMain.pas:293 */, - 2CF553830CDA578D00627463 /* UMain.pas:148 */, - 2CF553A20CDA59BB00627463 /* UltraStarDX.pas:8 */, + 2CF553A20CDA59BB00627463 /* UltraStarDX.pas:6 */, + 2CDC71950CDB9D430018F966 /* UMain.pas:156 */, ); breakpointsGroup = 2CDD4B7F0CB9394600549FAC /* XCBreakpointsBucket */; codeSenseManager = 2CDD4B6A0CB9357000549FAC /* Code sense */; @@ -1256,28 +1290,28 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 215618698; - PBXWorkspaceStateSaveDate = 215618698; + PBXPerProjectTemplateStateSaveDate = 215718463; + PBXWorkspaceStateSaveDate = 215718463; }; perUserProjectItems = { - 2CF552760CDA419B00627463 /* PBXBookmark */ = 2CF552760CDA419B00627463 /* PBXBookmark */; - 2CF552FF0CDA500800627463 /* PBXBookmark */ = 2CF552FF0CDA500800627463 /* PBXBookmark */; - 2CF553040CDA513000627463 /* PBXBookmark */ = 2CF553040CDA513000627463 /* PBXBookmark */; - 2CF553060CDA514A00627463 /* PBXBookmark */ = 2CF553060CDA514A00627463 /* PBXBookmark */; - 2CF553670CDA575100627463 /* PBXBookmark */ = 2CF553670CDA575100627463 /* PBXBookmark */; - 2CF553780CDA575B00627463 /* PBXTextBookmark */ = 2CF553780CDA575B00627463 /* PBXTextBookmark */; - 2CF553940CDA58E900627463 /* PBXTextBookmark */ = 2CF553940CDA58E900627463 /* PBXTextBookmark */; - 2CF553960CDA58E900627463 /* PBXTextBookmark */ = 2CF553960CDA58E900627463 /* PBXTextBookmark */; - 2CF553B10CDA5A2F00627463 /* PBXTextBookmark */ = 2CF553B10CDA5A2F00627463 /* PBXTextBookmark */; - 2CF553BB0CDA5A4D00627463 /* PBXTextBookmark */ = 2CF553BB0CDA5A4D00627463 /* PBXTextBookmark */; - 2CF553BC0CDA5A4D00627463 /* PBXTextBookmark */ = 2CF553BC0CDA5A4D00627463 /* PBXTextBookmark */; - 2CF553BD0CDA5A4D00627463 /* PBXTextBookmark */ = 2CF553BD0CDA5A4D00627463 /* PBXTextBookmark */; - 2CF553BE0CDA5A4D00627463 /* PBXTextBookmark */ = 2CF553BE0CDA5A4D00627463 /* PBXTextBookmark */; - 2CF553BF0CDA5A4D00627463 /* PBXTextBookmark */ = 2CF553BF0CDA5A4D00627463 /* PBXTextBookmark */; - 2CF553C00CDA5A4D00627463 /* PBXTextBookmark */ = 2CF553C00CDA5A4D00627463 /* PBXTextBookmark */; - 2CF553C10CDA5A4D00627463 /* PBXTextBookmark */ = 2CF553C10CDA5A4D00627463 /* PBXTextBookmark */; - 2CF553C20CDA5A4D00627463 /* PBXTextBookmark */ = 2CF553C20CDA5A4D00627463 /* PBXTextBookmark */; - 2CF553C30CDA5A4D00627463 /* PBXTextBookmark */ = 2CF553C30CDA5A4D00627463 /* PBXTextBookmark */; + 2CDC71650CDB9BCE0018F966 /* PBXTextBookmark */ = 2CDC71650CDB9BCE0018F966 /* PBXTextBookmark */; + 2CDC717C0CDB9D150018F966 /* PBXTextBookmark */ = 2CDC717C0CDB9D150018F966 /* PBXTextBookmark */; + 2CDC71AB0CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71AB0CDBA6300018F966 /* PBXTextBookmark */; + 2CDC71AC0CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71AC0CDBA6300018F966 /* PBXTextBookmark */; + 2CDC71AD0CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71AD0CDBA6300018F966 /* PBXTextBookmark */; + 2CDC71AE0CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71AE0CDBA6300018F966 /* PBXTextBookmark */; + 2CDC71AF0CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71AF0CDBA6300018F966 /* PBXTextBookmark */; + 2CDC71B00CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71B00CDBA6300018F966 /* PBXTextBookmark */; + 2CDC71B10CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71B10CDBA6300018F966 /* PBXTextBookmark */; + 2CDC71B20CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71B20CDBA6300018F966 /* PBXTextBookmark */; + 2CDC71B30CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71B30CDBA6300018F966 /* PBXTextBookmark */; + 2CDE61980CDB99D400E8B3D1 /* PBXTextBookmark */ = 2CDE61980CDB99D400E8B3D1 /* PBXTextBookmark */; + 2CDE61990CDB99D400E8B3D1 /* PBXTextBookmark */ = 2CDE61990CDB99D400E8B3D1 /* PBXTextBookmark */; + 2CDE619A0CDB99D400E8B3D1 /* PBXTextBookmark */ = 2CDE619A0CDB99D400E8B3D1 /* PBXTextBookmark */; + 2CDE619C0CDB99D400E8B3D1 /* PBXTextBookmark */ = 2CDE619C0CDB99D400E8B3D1 /* PBXTextBookmark */; + 2CDE619D0CDB99D400E8B3D1 /* PBXTextBookmark */ = 2CDE619D0CDB99D400E8B3D1 /* PBXTextBookmark */; + 2CDE619E0CDB99D400E8B3D1 /* PBXTextBookmark */ = 2CDE619E0CDB99D400E8B3D1 /* PBXTextBookmark */; + 2CDE619F0CDB99D400E8B3D1 /* PBXTextBookmark */ = 2CDE619F0CDB99D400E8B3D1 /* PBXTextBookmark */; }; sourceControlManager = 2CDD4B690CB9357000549FAC /* Source Control */; userBuildSettings = { @@ -1286,7 +1320,7 @@ DDC6851B09F57195004E4BFF /* UltraStarDX.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {948, 730}}"; - sepNavSelRange = "{129, 0}"; + sepNavSelRange = "{117, 0}"; sepNavVisRect = "{{0, 0}, {948, 730}}"; sepNavWindowFrame = "{{189, 86}, {987, 859}}"; }; diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj index f2cf90b5..8caca2d2 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj @@ -139,6 +139,8 @@ 2C4D9E210CC9EF840031092D /* Windows.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; }; 2C4D9E450CC9F0ED0031092D /* switches.inc in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E440CC9F0ED0031092D /* switches.inc */; }; 2C4D9E460CC9F0ED0031092D /* switches.inc in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E440CC9F0ED0031092D /* switches.inc */; }; + 2CDC716C0CDB9CB70018F966 /* StrUtils.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */; }; + 2CDC716D0CDB9CB70018F966 /* StrUtils.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */; }; 2CDD4BDE0CB947A400549FAC /* sdl.pas in Sources */ = {isa = PBXBuildFile; fileRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; }; 2CDD4BE00CB947B100549FAC /* sdl.pas in Sources */ = {isa = PBXBuildFile; fileRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; }; 2CDD4BE20CB947BE00549FAC /* UltraStarDX.pas in Sources */ = {isa = PBXBuildFile; fileRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; }; @@ -423,6 +425,7 @@ 2C4D9E040CC9EF840031092D /* OpenGL12.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = OpenGL12.pas; path = Wrapper/OpenGL12.pas; sourceTree = ""; }; 2C4D9E090CC9EF840031092D /* Windows.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = Windows.pas; path = Wrapper/Windows.pas; sourceTree = ""; }; 2C4D9E440CC9F0ED0031092D /* switches.inc */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = switches.inc; path = ../switches.inc; sourceTree = SOURCE_ROOT; }; + 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = StrUtils.pas; path = ../../../Modis/SDK/StrUtils.pas; sourceTree = SOURCE_ROOT; }; 2CDEA4F60CBD725B0096994C /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; 2CDEC4CC0CC52E7F00FFA244 /* UltraStarDX.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = UltraStarDX.icns; sourceTree = ""; }; 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenCredits.pas; path = ../Screens/UScreenCredits.pas; sourceTree = SOURCE_ROOT; }; @@ -680,6 +683,7 @@ 2CF5508A0CDA228800627463 /* SDK */ = { isa = PBXGroup; children = ( + 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */, 2CF552110CDA3D1400627463 /* UPluginDefs.pas */, 2CF5508B0CDA22B000627463 /* ModiSDK.pas */, ); @@ -1063,6 +1067,7 @@ 2CF552B60CDA42C900627463 /* opt.pas in Sources */, 2CF552B70CDA42C900627463 /* rational.pas in Sources */, 2CF553080CDA51B500627463 /* sdlutils.pas in Sources */, + 2CDC716C0CDB9CB70018F966 /* StrUtils.pas in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1182,6 +1187,7 @@ 2CF552AD0CDA42C900627463 /* opt.pas in Sources */, 2CF552AE0CDA42C900627463 /* rational.pas in Sources */, 2CF553090CDA51B500627463 /* sdlutils.pas in Sources */, + 2CDC716D0CDB9CB70018F966 /* StrUtils.pas in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; -- cgit v1.2.3 From 1107103fe87e01705094826991b205787ecc765f Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Fri, 2 Nov 2007 19:27:21 +0000 Subject: Added icns file for mac os x. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@557 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/MacOSX/Info.plist | 2 +- Game/Code/MacOSX/UltraStarDX.icns | Bin 32376 -> 0 bytes Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 | 143 +++++-------- .../MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser | 229 ++++++++++----------- .../MacOSX/UltraStarDX.xcodeproj/project.pbxproj | 8 +- 5 files changed, 156 insertions(+), 226 deletions(-) delete mode 100644 Game/Code/MacOSX/UltraStarDX.icns (limited to 'Game/Code') diff --git a/Game/Code/MacOSX/Info.plist b/Game/Code/MacOSX/Info.plist index dd9c079f..fab56642 100644 --- a/Game/Code/MacOSX/Info.plist +++ b/Game/Code/MacOSX/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable ${PRODUCT_NAME} CFBundleIconFile - UltraStar.icns + ustar-icon_v01.icns CFBundleIdentifier org.ultrastardeluxe.ultrastardeluxe CFBundleInfoDictionaryVersion diff --git a/Game/Code/MacOSX/UltraStarDX.icns b/Game/Code/MacOSX/UltraStarDX.icns deleted file mode 100644 index fd7b8745..00000000 Binary files a/Game/Code/MacOSX/UltraStarDX.icns and /dev/null differ diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 index 12cc23e0..b8f1379d 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 @@ -190,24 +190,24 @@ Content PBXProjectModuleGUID - 2CDC71470CDB9AAB0018F966 + 2CF552990CDA426600627463 PBXProjectModuleLabel - USongs.pas + UMain.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2CDC71480CDB9AAB0018F966 + 2CF5529A0CDA426600627463 PBXProjectModuleLabel - USongs.pas + UMain.pas _historyCapacity 0 bookmark - 2CDC71AB0CDBA6300018F966 + 2C4FA2BB0CDBB0F2002CC3B0 history - 2CDC71650CDB9BCE0018F966 + 2C4FA2B10CDBB0CF002CC3B0 SplitCount @@ -219,11 +219,11 @@ Geometry Frame - {{0, 20}, {797, 748}} + {{0, 20}, {1052, 646}} PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 84 171 797 789 0 0 1680 1028 + 222 147 1052 687 0 0 1680 1028 @@ -244,10 +244,10 @@ _historyCapacity 0 bookmark - 2CDC71AC0CDBA6300018F966 + 2C4FA2BC0CDBB0F2002CC3B0 history - 2CDC717C0CDB9D150018F966 + 2CDC71AC0CDBA6300018F966 SplitCount @@ -266,46 +266,6 @@ 189 142 987 803 0 0 1680 1028 - - Content - - PBXProjectModuleGUID - 2CF552990CDA426600627463 - PBXProjectModuleLabel - UMain.pas - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 2CF5529A0CDA426600627463 - PBXProjectModuleLabel - UMain.pas - _historyCapacity - 0 - bookmark - 2CDC71AD0CDBA6300018F966 - history - - 2CDE61980CDB99D400E8B3D1 - - - SplitCount - 1 - - StatusBarVisibility - - - Geometry - - Frame - {{0, 20}, {1052, 646}} - PBXModuleWindowStatusBarHidden2 - - RubberWindowFrame - 222 147 1052 687 0 0 1680 1028 - - Content @@ -324,10 +284,10 @@ _historyCapacity 0 bookmark - 2CDC71AE0CDBA6300018F966 + 2C4FA2BD0CDBB0F2002CC3B0 history - 2CDE61990CDB99D400E8B3D1 + 2CDC71AE0CDBA6300018F966 SplitCount @@ -364,10 +324,10 @@ _historyCapacity 0 bookmark - 2CDC71AF0CDBA6300018F966 + 2C4FA2BE0CDBB0F2002CC3B0 history - 2CDE619A0CDB99D400E8B3D1 + 2CDC71AF0CDBA6300018F966 SplitCount @@ -404,10 +364,10 @@ _historyCapacity 0 bookmark - 2CDC71B00CDBA6300018F966 + 2C4FA2BF0CDBB0F2002CC3B0 history - 2CDE619C0CDB99D400E8B3D1 + 2CDC71B00CDBA6300018F966 SplitCount @@ -444,10 +404,10 @@ _historyCapacity 0 bookmark - 2CDC71B10CDBA6300018F966 + 2C4FA2C00CDBB0F2002CC3B0 history - 2CDE619D0CDB99D400E8B3D1 + 2CDC71B10CDBA6300018F966 SplitCount @@ -484,10 +444,10 @@ _historyCapacity 0 bookmark - 2CDC71B20CDBA6300018F966 + 2C4FA2C10CDBB0F2002CC3B0 history - 2CDE619E0CDB99D400E8B3D1 + 2CDC71B20CDBA6300018F966 SplitCount @@ -524,10 +484,10 @@ _historyCapacity 0 bookmark - 2CDC71B30CDBA6300018F966 + 2C4FA2C20CDBB0F2002CC3B0 history - 2CDE619F0CDB99D400E8B3D1 + 2CDC71B30CDBA6300018F966 SplitCount @@ -617,24 +577,19 @@ DDC6850D09F5717A004E4BFF DD7C45450A6E72DE003FA52B - 2CF5510C0CDA28F000627463 - DDC6868A09F571C2004E4BFF - 2CDD8D0B0CC5539900E4169D - DDC6888C09F57243004E4BFF - DDC688C809F574E9004E4BFF 1C37FBAC04509CD000000102 1C37FAAC04509CD000000102 PBXSmartGroupTreeModuleOutlineStateSelectionKey - 25 + 17 15 0 PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 0}, {266, 694}} + {{0, 20}, {266, 694}} PBXTopSmartGroupGIDs @@ -653,7 +608,7 @@ 266 RubberWindowFrame - 773 270 817 753 0 0 1680 1028 + 772 270 817 753 0 0 1680 1028 Module PBXSmartGroupTreeModule @@ -690,7 +645,7 @@ Frame {{0, 0}, {529, 0}} RubberWindowFrame - 773 270 817 753 0 0 1680 1028 + 772 270 817 753 0 0 1680 1028 Module PBXNavigatorGroup @@ -712,7 +667,7 @@ Frame {{0, 5}, {529, 707}} RubberWindowFrame - 773 270 817 753 0 0 1680 1028 + 772 270 817 753 0 0 1680 1028 Module XCDetailModule @@ -736,9 +691,9 @@ TableOfContents - 2CDC71380CDB9A4A0018F966 + 2C4FA2940CDBAB21002CC3B0 1CE0B1FE06471DED0097A5F4 - 2CDC71390CDB9A4A0018F966 + 2C4FA2950CDBAB21002CC3B0 1CE0B20306471E060097A5F4 1CE0B20506471E060097A5F4 @@ -872,25 +827,21 @@ 5 WindowOrderList - 2CDC71910CDB9D2D0018F966 - 2CDC71920CDB9D2D0018F966 - 2CDD4BFC0CB948FC00549FAC - 2CDC718F0CDB9D2D0018F966 + 2CDD4B730CB935C700549FAC + 2C4FA2A50CDBAB21002CC3B0 2CF5528D0CDA426600627463 2CF553750CDA575B00627463 2CF553720CDA575B00627463 2CF5536F0CDA575B00627463 2CF552930CDA426600627463 2CF552960CDA426600627463 - 2CF552990CDA426600627463 - /Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj - 2CDD4B730CB935C700549FAC 2CF5536C0CDA575B00627463 1CD10A99069EF8BA00B06720 - 2CDC71470CDB9AAB0018F966 + 2CF552990CDA426600627463 + /Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj WindowString - 773 270 817 753 0 0 1680 1028 + 772 270 817 753 0 0 1680 1028 WindowTools @@ -911,7 +862,7 @@ PBXProjectModuleGUID 1CD0528F0623707200166675 PBXProjectModuleLabel - UltraStarDX.pas + StatusBarVisibility @@ -928,8 +879,6 @@ 344pt - BecomeActive - ContentConfiguration PBXProjectModuleGUID @@ -969,7 +918,7 @@ TableOfContents 2CDD4B730CB935C700549FAC - 2CDC71520CDB9AAB0018F966 + 2C4FA2BA0CDBB0CF002CC3B0 1CD0528F0623707200166675 XCMainBuildResultsModuleGUID @@ -980,7 +929,7 @@ WindowToolGUID 2CDD4B730CB935C700549FAC WindowToolIsVisible - + FirstTimeWindowDisplayed @@ -1011,8 +960,8 @@ yes sizes - {{0, 0}, {356, 414}} - {{356, 0}, {608, 414}} + {{0, 0}, {354, 414}} + {{354, 0}, {610, 414}} VerticalSplitView @@ -1075,14 +1024,14 @@ TableOfContents 1CD10A99069EF8BA00B06720 - 2CDC71890CDB9D2D0018F966 + 2C4FA29F0CDBAB21002CC3B0 1C162984064C10D400B95A72 - 2CDC718A0CDB9D2D0018F966 - 2CDC718B0CDB9D2D0018F966 - 2CDC718C0CDB9D2D0018F966 - 2CDC718D0CDB9D2D0018F966 - 2CDC718E0CDB9D2D0018F966 - 2CDC718F0CDB9D2D0018F966 + 2C4FA2A00CDBAB21002CC3B0 + 2C4FA2A10CDBAB21002CC3B0 + 2C4FA2A20CDBAB21002CC3B0 + 2C4FA2A30CDBAB21002CC3B0 + 2C4FA2A40CDBAB21002CC3B0 + 2C4FA2A50CDBAB21002CC3B0 ToolbarConfiguration xcode.toolbar.config.debug diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser index 545200c9..3bb5dffc 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser @@ -196,7 +196,7 @@ uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1013, 15078}}"; sepNavSelRange = "{3441, 0}"; - sepNavVisRect = "{{0, 1680}, {1013, 614}}"; + sepNavVisRect = "{{0, 1682}, {1013, 614}}"; sepNavWindowFrame = "{{222, 91}, {1052, 743}}"; }; }; @@ -300,7 +300,7 @@ uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {950, 14616}}"; sepNavSelRange = "{7664, 0}"; - sepNavVisRect = "{{0, 3743}, {758, 716}}"; + sepNavVisRect = "{{0, 3738}, {758, 716}}"; sepNavWindowFrame = "{{84, 115}, {797, 845}}"; }; }; @@ -503,13 +503,95 @@ sepNavWindowFrame = "{{15, 282}, {616, 741}}"; }; }; - 2CDC71650CDB9BCE0018F966 /* PBXTextBookmark */ = { + 2C4FA2B10CDBB0CF002CC3B0 /* PBXTextBookmark */ = { isa = PBXTextBookmark; - comments = "error:column 23 - Identifier not found \"oldlinux\""; - fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; + fRef = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; + name = "UMain.pas: 148"; + rLen = 0; + rLoc = 3441; + rType = 0; + vrLen = 1295; + vrLoc = 2495; + }; + 2C4FA2BB0CDBB0F2002CC3B0 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; + name = "UMain.pas: 148"; + rLen = 0; + rLoc = 3441; + rType = 0; + vrLen = 1295; + vrLoc = 2495; + }; + 2C4FA2BC0CDBB0F2002CC3B0 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; + name = "UltraStarDX.pas: 6"; + rLen = 0; + rLoc = 117; + rType = 0; + vrLen = 131; + vrLoc = 0; + }; + 2C4FA2BD0CDBB0F2002CC3B0 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; + name = "UAudio_FFMpeg.pas: 952"; + rLen = 0; + rLoc = 22697; + rType = 0; + vrLen = 1224; + vrLoc = 21473; + }; + 2C4FA2BE0CDBB0F2002CC3B0 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; + name = "nux ... is t"; + rLen = 12; + rLoc = 3202; + rType = 0; + vrLen = 1266; + vrLoc = 15619; + }; + 2C4FA2BF0CDBB0F2002CC3B0 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; + name = "sdl_image.pas: 130"; + rLen = 0; + rLoc = 8020; + rType = 0; + vrLen = 832; + vrLoc = 7978; + }; + 2C4FA2C00CDBB0F2002CC3B0 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; + name = "sdl.pas: 250"; + rLen = 0; + rLoc = 16506; + rType = 0; + vrLen = 886; + vrLoc = 16376; + }; + 2C4FA2C10CDBB0F2002CC3B0 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; + name = "TempSurface:=TexSur"; + rLen = 20; + rLoc = 11823; + rType = 0; + vrLen = 1220; + vrLoc = 11066; + }; + 2C4FA2C20CDBB0F2002CC3B0 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; + name = "Windows.pas: 114"; rLen = 0; - rLoc = 289; - rType = 1; + rLoc = 2832; + rType = 0; + vrLen = 1182; + vrLoc = 2090; }; 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = { uiCtxt = { @@ -519,14 +601,6 @@ sepNavWindowFrame = "{{38, 259}, {1052, 743}}"; }; }; - 2CDC717C0CDB9D150018F966 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - comments = "warning:column 5 - Local variable \"i\" is assigned but never used"; - fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; - rLen = 1; - rLoc = 4; - rType = 1; - }; 2CDC71950CDB9D430018F966 /* UMain.pas:156 */ = { isa = PBXFileBreakpoint; actions = ( @@ -541,16 +615,6 @@ modificationTime = 215719249.543694; state = 1; }; - 2CDC71AB0CDBA6300018F966 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; - name = "USongs.pas: 288"; - rLen = 0; - rLoc = 7664; - rType = 0; - vrLen = 1174; - vrLoc = 7219; - }; 2CDC71AC0CDBA6300018F966 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; @@ -561,16 +625,6 @@ vrLen = 131; vrLoc = 0; }; - 2CDC71AD0CDBA6300018F966 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; - name = "UMain.pas: 148"; - rLen = 0; - rLoc = 3441; - rType = 0; - vrLen = 1295; - vrLoc = 2495; - }; 2CDC71AE0CDBA6300018F966 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; @@ -688,76 +742,6 @@ 2CDC71950CDB9D430018F966 /* UMain.pas:156 */, ); }; - 2CDE61980CDB99D400E8B3D1 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; - name = "UMain.pas: 142"; - rLen = 0; - rLoc = 3295; - rType = 0; - vrLen = 1288; - vrLoc = 2495; - }; - 2CDE61990CDB99D400E8B3D1 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; - name = "UAudio_FFMpeg.pas: 952"; - rLen = 0; - rLoc = 22697; - rType = 0; - vrLen = 1224; - vrLoc = 21473; - }; - 2CDE619A0CDB99D400E8B3D1 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; - name = "nux ... is t"; - rLen = 12; - rLoc = 3202; - rType = 0; - vrLen = 1266; - vrLoc = 15619; - }; - 2CDE619C0CDB99D400E8B3D1 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; - name = "sdl_image.pas: 130"; - rLen = 0; - rLoc = 8020; - rType = 0; - vrLen = 832; - vrLoc = 7978; - }; - 2CDE619D0CDB99D400E8B3D1 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; - name = "sdl.pas: 250"; - rLen = 0; - rLoc = 16506; - rType = 0; - vrLen = 886; - vrLoc = 16376; - }; - 2CDE619E0CDB99D400E8B3D1 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; - name = "TempSurface:=TexSur"; - rLen = 20; - rLoc = 11823; - rType = 0; - vrLen = 1220; - vrLoc = 11066; - }; - 2CDE619F0CDB99D400E8B3D1 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; - name = "Windows.pas: 114"; - rLen = 0; - rLoc = 2832; - rType = 0; - vrLen = 1182; - vrLoc = 2090; - }; 2CDEA8080CBD7D920096994C /* UMain.pas:293 */ = { isa = PBXFileBreakpoint; actions = ( @@ -1143,7 +1127,7 @@ hitCount = 1; lineNumber = 6; location = UltraStarDX; - modificationTime = 215719246.517251; + modificationTime = 215719246.5172511; state = 1; }; 9845B6590B1F9B9E0084DD62 /* SDL.h */ = { @@ -1179,7 +1163,6 @@ activeTarget = DDC688C709F574E9004E4BFF /* UltraStarDX */; addToTargets = ( DDC688C709F574E9004E4BFF /* UltraStarDX */, - DDC688D409F57523004E4BFF /* Put all program sources also in this target */, ); breakpoints = ( 2CDEA8080CBD7D920096994C /* UMain.pas:293 */, @@ -1290,28 +1273,26 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 215718463; - PBXWorkspaceStateSaveDate = 215718463; + PBXPerProjectTemplateStateSaveDate = 215722768; + PBXWorkspaceStateSaveDate = 215722768; }; perUserProjectItems = { - 2CDC71650CDB9BCE0018F966 /* PBXTextBookmark */ = 2CDC71650CDB9BCE0018F966 /* PBXTextBookmark */; - 2CDC717C0CDB9D150018F966 /* PBXTextBookmark */ = 2CDC717C0CDB9D150018F966 /* PBXTextBookmark */; - 2CDC71AB0CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71AB0CDBA6300018F966 /* PBXTextBookmark */; + 2C4FA2B10CDBB0CF002CC3B0 /* PBXTextBookmark */ = 2C4FA2B10CDBB0CF002CC3B0 /* PBXTextBookmark */; + 2C4FA2BB0CDBB0F2002CC3B0 /* PBXTextBookmark */ = 2C4FA2BB0CDBB0F2002CC3B0 /* PBXTextBookmark */; + 2C4FA2BC0CDBB0F2002CC3B0 /* PBXTextBookmark */ = 2C4FA2BC0CDBB0F2002CC3B0 /* PBXTextBookmark */; + 2C4FA2BD0CDBB0F2002CC3B0 /* PBXTextBookmark */ = 2C4FA2BD0CDBB0F2002CC3B0 /* PBXTextBookmark */; + 2C4FA2BE0CDBB0F2002CC3B0 /* PBXTextBookmark */ = 2C4FA2BE0CDBB0F2002CC3B0 /* PBXTextBookmark */; + 2C4FA2BF0CDBB0F2002CC3B0 /* PBXTextBookmark */ = 2C4FA2BF0CDBB0F2002CC3B0 /* PBXTextBookmark */; + 2C4FA2C00CDBB0F2002CC3B0 /* PBXTextBookmark */ = 2C4FA2C00CDBB0F2002CC3B0 /* PBXTextBookmark */; + 2C4FA2C10CDBB0F2002CC3B0 /* PBXTextBookmark */ = 2C4FA2C10CDBB0F2002CC3B0 /* PBXTextBookmark */; + 2C4FA2C20CDBB0F2002CC3B0 /* PBXTextBookmark */ = 2C4FA2C20CDBB0F2002CC3B0 /* PBXTextBookmark */; 2CDC71AC0CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71AC0CDBA6300018F966 /* PBXTextBookmark */; - 2CDC71AD0CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71AD0CDBA6300018F966 /* PBXTextBookmark */; 2CDC71AE0CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71AE0CDBA6300018F966 /* PBXTextBookmark */; 2CDC71AF0CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71AF0CDBA6300018F966 /* PBXTextBookmark */; 2CDC71B00CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71B00CDBA6300018F966 /* PBXTextBookmark */; 2CDC71B10CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71B10CDBA6300018F966 /* PBXTextBookmark */; 2CDC71B20CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71B20CDBA6300018F966 /* PBXTextBookmark */; 2CDC71B30CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71B30CDBA6300018F966 /* PBXTextBookmark */; - 2CDE61980CDB99D400E8B3D1 /* PBXTextBookmark */ = 2CDE61980CDB99D400E8B3D1 /* PBXTextBookmark */; - 2CDE61990CDB99D400E8B3D1 /* PBXTextBookmark */ = 2CDE61990CDB99D400E8B3D1 /* PBXTextBookmark */; - 2CDE619A0CDB99D400E8B3D1 /* PBXTextBookmark */ = 2CDE619A0CDB99D400E8B3D1 /* PBXTextBookmark */; - 2CDE619C0CDB99D400E8B3D1 /* PBXTextBookmark */ = 2CDE619C0CDB99D400E8B3D1 /* PBXTextBookmark */; - 2CDE619D0CDB99D400E8B3D1 /* PBXTextBookmark */ = 2CDE619D0CDB99D400E8B3D1 /* PBXTextBookmark */; - 2CDE619E0CDB99D400E8B3D1 /* PBXTextBookmark */ = 2CDE619E0CDB99D400E8B3D1 /* PBXTextBookmark */; - 2CDE619F0CDB99D400E8B3D1 /* PBXTextBookmark */ = 2CDE619F0CDB99D400E8B3D1 /* PBXTextBookmark */; }; sourceControlManager = 2CDD4B690CB9357000549FAC /* Source Control */; userBuildSettings = { @@ -1327,10 +1308,10 @@ }; DDC6868B09F571C2004E4BFF /* Info.plist */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {686, 612}}"; - sepNavSelRange = "{337, 0}"; - sepNavVisRect = "{{0, 0}, {577, 612}}"; - sepNavWindowFrame = "{{15, 282}, {616, 741}}"; + sepNavIntBoundsRect = "{{0, 0}, {1013, 614}}"; + sepNavSelRange = "{366, 0}"; + sepNavVisRect = "{{0, 0}, {1013, 614}}"; + sepNavWindowFrame = "{{15, 280}, {1052, 743}}"; }; }; DDC688C709F574E9004E4BFF /* UltraStarDX */ = { diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj index 8caca2d2..f8cd06e7 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj @@ -139,6 +139,7 @@ 2C4D9E210CC9EF840031092D /* Windows.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; }; 2C4D9E450CC9F0ED0031092D /* switches.inc in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E440CC9F0ED0031092D /* switches.inc */; }; 2C4D9E460CC9F0ED0031092D /* switches.inc in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E440CC9F0ED0031092D /* switches.inc */; }; + 2C4FA2A80CDBAD1E002CC3B0 /* ustar-icon_v01.icns in Resources */ = {isa = PBXBuildFile; fileRef = 2C4FA2A70CDBAD1E002CC3B0 /* ustar-icon_v01.icns */; }; 2CDC716C0CDB9CB70018F966 /* StrUtils.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */; }; 2CDC716D0CDB9CB70018F966 /* StrUtils.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */; }; 2CDD4BDE0CB947A400549FAC /* sdl.pas in Sources */ = {isa = PBXBuildFile; fileRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; }; @@ -146,7 +147,6 @@ 2CDD4BE20CB947BE00549FAC /* UltraStarDX.pas in Sources */ = {isa = PBXBuildFile; fileRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; }; 2CDEA4F70CBD725B0096994C /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CDEA4F60CBD725B0096994C /* OpenGL.framework */; }; 2CDEC4960CC5264600FFA244 /* SDL.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 98B8BE570B1F972400162019 /* SDL.framework */; }; - 2CDEC4CD0CC52E7F00FFA244 /* UltraStarDX.icns in Resources */ = {isa = PBXBuildFile; fileRef = 2CDEC4CC0CC52E7F00FFA244 /* UltraStarDX.icns */; }; 2CF54F650CDA1B2B00627463 /* UScreenCredits.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */; }; 2CF54F660CDA1B2B00627463 /* UScreenEdit.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F440CDA1B2B00627463 /* UScreenEdit.pas */; }; 2CF54F670CDA1B2B00627463 /* UScreenEditConvert.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F450CDA1B2B00627463 /* UScreenEditConvert.pas */; }; @@ -425,9 +425,9 @@ 2C4D9E040CC9EF840031092D /* OpenGL12.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = OpenGL12.pas; path = Wrapper/OpenGL12.pas; sourceTree = ""; }; 2C4D9E090CC9EF840031092D /* Windows.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = Windows.pas; path = Wrapper/Windows.pas; sourceTree = ""; }; 2C4D9E440CC9F0ED0031092D /* switches.inc */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = switches.inc; path = ../switches.inc; sourceTree = SOURCE_ROOT; }; + 2C4FA2A70CDBAD1E002CC3B0 /* ustar-icon_v01.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = "ustar-icon_v01.icns"; path = "../../Graphics/ustar-icon_v01.icns"; sourceTree = SOURCE_ROOT; }; 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = StrUtils.pas; path = ../../../Modis/SDK/StrUtils.pas; sourceTree = SOURCE_ROOT; }; 2CDEA4F60CBD725B0096994C /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; - 2CDEC4CC0CC52E7F00FFA244 /* UltraStarDX.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = UltraStarDX.icns; sourceTree = ""; }; 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenCredits.pas; path = ../Screens/UScreenCredits.pas; sourceTree = SOURCE_ROOT; }; 2CF54F440CDA1B2B00627463 /* UScreenEdit.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenEdit.pas; path = ../Screens/UScreenEdit.pas; sourceTree = SOURCE_ROOT; }; 2CF54F450CDA1B2B00627463 /* UScreenEditConvert.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenEditConvert.pas; path = ../Screens/UScreenEditConvert.pas; sourceTree = SOURCE_ROOT; }; @@ -769,7 +769,7 @@ DDC6868A09F571C2004E4BFF /* Resources */ = { isa = PBXGroup; children = ( - 2CDEC4CC0CC52E7F00FFA244 /* UltraStarDX.icns */, + 2C4FA2A70CDBAD1E002CC3B0 /* ustar-icon_v01.icns */, DDC689B309F57C69004E4BFF /* InfoPlist.strings */, DDC689B409F57C69004E4BFF /* SDLMain.nib */, DDC6868B09F571C2004E4BFF /* Info.plist */, @@ -874,7 +874,7 @@ files = ( DDC689B509F57C69004E4BFF /* InfoPlist.strings in Resources */, DDC689B609F57C69004E4BFF /* SDLMain.nib in Resources */, - 2CDEC4CD0CC52E7F00FFA244 /* UltraStarDX.icns in Resources */, + 2C4FA2A80CDBAD1E002CC3B0 /* ustar-icon_v01.icns in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; -- cgit v1.2.3 From 2a1be1865f68633a2385d8e55a6bd815616ec23f Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Fri, 2 Nov 2007 19:49:23 +0000 Subject: Fixed GamePath for Mac OS X. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@558 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMain.pas | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index e4acf4aa..1be4b463 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -1023,6 +1023,26 @@ begin Player[PlayerNum].ScoreTotalI := 0; end; +{$IFDEF DARWIN} +// Mac applications are packaged in directories. +// We have to cut the last two directories +// to get the application directory. +Function GetGamePath : String; +var + x, + i : integer; +begin + Result := ExtractFilePath(ParamStr(0)); + for x := 0 to 2 do begin + i := Length(Result); + repeat + Delete( Result, i, 1); + i := Length(Result); + until (i = 0) or (Result[i] = '/'); + end; +end; +{$ENDIF} + //-------------------- // Function sets all Absolute Paths e.g. Song Path and makes sure the Directorys exist //-------------------- @@ -1057,7 +1077,11 @@ procedure InitializePaths; begin +{$IFDEF DARWIN} + GamePath := GetGamePath; +{$ELSE} GamePath := ExtractFilePath(ParamStr(0)); +{$ENDIF} initialize_path( LogPath , GamePath ); initialize_path( SoundPath , GamePath + 'Sounds' + PathDelim ); -- cgit v1.2.3 From 8c9c787a1326b90490543bd50b56fce9b89d9807 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sat, 3 Nov 2007 02:31:06 +0000 Subject: Windows Lazarus Build working again... Lazarus Project file includes the DPR, so that we have a unified Uses Clause ( keep this in mind please ) added "Delphi" to switches git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@560 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCommon.pas | 603 +++++---- Game/Code/Classes/UCore.pas | 1002 +++++++-------- Game/Code/Classes/USongs.pas | 2088 ++++++++++++++++---------------- Game/Code/Classes/UTexture.pas | 2286 +++++++++++++++++------------------ Game/Code/Classes/uPluginLoader.pas | 1602 ++++++++++++------------ Game/Code/UltraStar.dpr | 291 ++--- Game/Code/UltraStar.lpr | 257 +--- Game/Code/switches.inc | 89 +- 8 files changed, 4024 insertions(+), 4194 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UCommon.pas b/Game/Code/Classes/UCommon.pas index 43017aff..65d98e30 100644 --- a/Game/Code/Classes/UCommon.pas +++ b/Game/Code/Classes/UCommon.pas @@ -1,302 +1,301 @@ -unit UCommon; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses - SysUtils, -{$IFDEF LAZARUS} - lResources, -{$ENDIF} - ULog, -{$IFDEF DARWIN} - messages, -{$ENDIF} -{$IFDEF win32} - windows; -{$ELSE} - lcltype, - messages; -{$ENDIF} - -{$IFNDEF win32} -type - hStream = THandle; - HGLRC = THandle; - TLargeInteger = Int64; - TWin32FindData = LongInt; -{$ENDIF} - -{$IFDEF LAZARUS} - function LazFindResource( const aName, aType : String ): TLResource; -{$ENDIF} - -{$IFDEF FPC} - -function RandomRange(aMin: Integer; aMax: Integer) : Integer; - -function MaxValue(const Data: array of Double): Double; -function MinValue(const Data: array of Double): Double; - - {$IFDEF WIN32} - type - TWndMethod = procedure(var Message: TMessage) of object; - function AllocateHWnd(Method: TWndMethod): HWND; - procedure DeallocateHWnd(Wnd: HWND); - {$ENDIF} // Win32 - -{$ENDIF} // FPC Only - -function StringReplaceW(text : WideString; search, rep: WideChar):WideString; -function AdaptFilePaths( const aPath : widestring ): widestring; - - -{$IFNDEF win32} -(* - function QueryPerformanceCounter(lpPerformanceCount:TLARGEINTEGER):Bool; - function QueryPerformanceFrequency(lpFrequency:TLARGEINTEGER):Bool; -*) - procedure ZeroMemory( Destination: Pointer; Length: DWORD ); -{$ENDIF} - -{$IFDEF MSWINDOWS} - -type - TSearchRecW = record - Time: Integer; - Size: Integer; - Attr: Integer; - Name: WideString; - ExcludeAttr: Integer; - FindHandle: THandle; - FindData: TWin32FindDataW; - end; - - function FindFirstW(const Path: WideString; Attr: Integer; var F: TSearchRecW): Integer; - function FindNextW(var F: TSearchRecW): Integer; - procedure FindCloseW(var F: TSearchRecW); - function FindMatchingFileW(var F: TSearchRecW): Integer; - function DirectoryExistsW(const Directory: widestring): Boolean; -{$endif} - -implementation - -function StringReplaceW(text : WideString; search, rep: WideChar):WideString; -var - iPos : integer; -// sTemp : WideString; -begin -(* - result := text; - iPos := Pos(search, result); - while (iPos > 0) do - begin - sTemp := copy(result, iPos + length(search), length(result)); - result := copy(result, 1, iPos - 1) + rep + sTEmp; - iPos := Pos(search, result); - end; -*) - result := text; - - if search = rep then - exit; - - for iPos := 0 to length( result ) - 1 do - begin - if result[ iPos ] = search then - result[ iPos ] := rep; - end; -end; - -function AdaptFilePaths( const aPath : widestring ): widestring; -begin - result := StringReplaceW( aPath, '\', PathDelim );//, [rfReplaceAll] ); -end; - - -{$IFNDEF win32} -procedure ZeroMemory( Destination: Pointer; Length: DWORD ); -begin - FillChar( Destination^, Length, 0 ); -end; //ZeroMemory - -(* -function QueryPerformanceCounter(lpPerformanceCount:TLARGEINTEGER):Bool; - - // From http://en.wikipedia.org/wiki/RDTSC - function RDTSC: Int64; register; - asm - rdtsc - end; - -begin - // Use clock_gettime here maybe ... from libc - lpPerformanceCount := RDTSC(); - result := true; -end; - -function QueryPerformanceFrequency(lpFrequency:TLARGEINTEGER):Bool; -begin - lpFrequency := 0; - result := true; -end; -*) -{$ENDIF} - - -{$IFDEF LAZARUS} - -function LazFindResource( const aName, aType : String ): TLResource; -var - iCount : Integer; -begin - result := nil; - - for iCount := 0 to LazarusResources.count -1 do - begin - if ( LazarusResources.items[ iCount ].Name = aName ) AND - ( LazarusResources.items[ iCount ].ValueType = aType ) THEN - begin - result := LazarusResources.items[ iCount ]; - exit; - end; - end; -end; -{$ENDIF} - -{$IFDEF FPC} -function MaxValue(const Data: array of Double): Double; -var - I: Integer; -begin - Result := Data[Low(Data)]; - for I := Low(Data) + 1 to High(Data) do - if Result < Data[I] then - Result := Data[I]; -end; - -function MinValue(const Data: array of Double): Double; -var - I: Integer; -begin - Result := Data[Low(Data)]; - for I := Low(Data) + 1 to High(Data) do - if Result > Data[I] then - Result := Data[I]; -end; - -function RandomRange(aMin: Integer; aMax: Integer) : Integer; -begin -RandomRange := Random(aMax-aMin) + aMin ; -end; - - -// NOTE !!!!!!!!!! -// AllocateHWnd is in lclintfh.inc - -{$IFDEF MSWINDOWS} -// TODO : JB this is dodgey and bad... find a REAL solution ! -function AllocateHWnd(Method: TWndMethod): HWND; -var - TempClass: TWndClass; - ClassRegistered: Boolean; -begin - Result := CreateWindowEx(WS_EX_TOOLWINDOW, '', '', WS_POPUP , 0, 0, 0, 0, 0, 0, HInstance, nil); -end; - -procedure DeallocateHWnd(Wnd: HWND); -var - Instance: Pointer; -begin - Instance := Pointer(GetWindowLong(Wnd, GWL_WNDPROC)); - DestroyWindow(Wnd); -end; -{$ENDIF} -{$IFDEF DARWIN} -// TODO : Situation for the mac isn't better ! -function AllocateHWnd(Method: TWndMethod): HWND; -begin -end; - -procedure DeallocateHWnd(Wnd: HWND); -begin -end; -{$ENDIF} - - - - -{$ENDIF} - -{$ifdef MSWINDOWS} -function FindFirstW(const Path: widestring; Attr: Integer; var F: TSearchRecW): Integer; -const - faSpecial = faHidden or faSysFile or faVolumeID or faDirectory; -begin - F.ExcludeAttr := not Attr and faSpecial; - F.FindHandle := FindFirstFileW(PWideChar(Path), F.FindData); - if F.FindHandle <> INVALID_HANDLE_VALUE then - begin - Result := FindMatchingFileW(F); - if Result <> 0 then FindCloseW(F); - end else - Result := GetLastError; -end; - -function FindNextW(var F: TSearchRecW): Integer; -begin - if FindNextFileW(F.FindHandle, F.FindData) then - Result := FindMatchingFileW(F) - else - Result := GetLastError; -end; - -procedure FindCloseW(var F: TSearchRecW); -begin - if F.FindHandle <> INVALID_HANDLE_VALUE then - begin - Windows.FindClose(F.FindHandle); - F.FindHandle := INVALID_HANDLE_VALUE; - end; -end; - -function FindMatchingFileW(var F: TSearchRecW): Integer; -var - LocalFileTime: TFileTime; -begin - with F do - begin - while FindData.dwFileAttributes and ExcludeAttr <> 0 do - if not FindNextFileW(FindHandle, FindData) then - begin - Result := GetLastError; - Exit; - end; - FileTimeToLocalFileTime(FindData.ftLastWriteTime, LocalFileTime); - FileTimeToDosDateTime(LocalFileTime, LongRec(Time).Hi, LongRec(Time).Lo); - Size := FindData.nFileSizeLow; - Attr := FindData.dwFileAttributes; - Name := FindData.cFileName; - end; - Result := 0; -end; - -function DirectoryExistsW(const Directory: widestring): Boolean; -var - Code: Integer; -begin - Code := GetFileAttributesW(PWideChar(Directory)); - Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0); -end; -{$endif} - - - - - -end. +unit UCommon; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + SysUtils, +{$IFDEF LAZARUS} + lResources, +{$ENDIF} + ULog, +{$IFDEF DARWIN} + messages, +{$ENDIF} +{$IFDEF win32} + windows; +{$ELSE} + lcltype, + messages; +{$ENDIF} + +{$IFNDEF win32} +type + hStream = THandle; + HGLRC = THandle; + TLargeInteger = Int64; + TWin32FindData = LongInt; +{$ENDIF} + +{$IFDEF LAZARUS} + function LazFindResource( const aName, aType : String ): TLResource; +{$ENDIF} + +{$IFDEF FPC} + +function RandomRange(aMin: Integer; aMax: Integer) : Integer; + +function MaxValue(const Data: array of Double): Double; +function MinValue(const Data: array of Double): Double; + + {$IFDEF WIN32} + type + TWndMethod = procedure(var Message: TMessage) of object; + function AllocateHWnd(Method: TWndMethod): HWND; + procedure DeallocateHWnd(Wnd: HWND); + {$ENDIF} // Win32 + +{$ENDIF} // FPC Only + +function StringReplaceW(text : WideString; search, rep: WideChar):WideString; +function AdaptFilePaths( const aPath : widestring ): widestring; + + +{$IFNDEF win32} +(* + function QueryPerformanceCounter(lpPerformanceCount:TLARGEINTEGER):Bool; + function QueryPerformanceFrequency(lpFrequency:TLARGEINTEGER):Bool; +*) + procedure ZeroMemory( Destination: Pointer; Length: DWORD ); +{$ENDIF} + +{$IFNDEF FPC} +type + TSearchRecW = record + Time: Integer; + Size: Integer; + Attr: Integer; + Name: WideString; + ExcludeAttr: Integer; + FindHandle: THandle; + FindData: TWin32FindDataW; + end; + + function FindFirstW(const Path: WideString; Attr: Integer; var F: TSearchRecW): Integer; + function FindNextW(var F: TSearchRecW): Integer; + procedure FindCloseW(var F: TSearchRecW); + function FindMatchingFileW(var F: TSearchRecW): Integer; + function DirectoryExistsW(const Directory: widestring): Boolean; +{$endif} + +implementation + +function StringReplaceW(text : WideString; search, rep: WideChar):WideString; +var + iPos : integer; +// sTemp : WideString; +begin +(* + result := text; + iPos := Pos(search, result); + while (iPos > 0) do + begin + sTemp := copy(result, iPos + length(search), length(result)); + result := copy(result, 1, iPos - 1) + rep + sTEmp; + iPos := Pos(search, result); + end; +*) + result := text; + + if search = rep then + exit; + + for iPos := 0 to length( result ) - 1 do + begin + if result[ iPos ] = search then + result[ iPos ] := rep; + end; +end; + +function AdaptFilePaths( const aPath : widestring ): widestring; +begin + result := StringReplaceW( aPath, '\', PathDelim );//, [rfReplaceAll] ); +end; + + +{$IFNDEF win32} +procedure ZeroMemory( Destination: Pointer; Length: DWORD ); +begin + FillChar( Destination^, Length, 0 ); +end; //ZeroMemory + +(* +function QueryPerformanceCounter(lpPerformanceCount:TLARGEINTEGER):Bool; + + // From http://en.wikipedia.org/wiki/RDTSC + function RDTSC: Int64; register; + asm + rdtsc + end; + +begin + // Use clock_gettime here maybe ... from libc + lpPerformanceCount := RDTSC(); + result := true; +end; + +function QueryPerformanceFrequency(lpFrequency:TLARGEINTEGER):Bool; +begin + lpFrequency := 0; + result := true; +end; +*) +{$ENDIF} + + +{$IFDEF LAZARUS} + +function LazFindResource( const aName, aType : String ): TLResource; +var + iCount : Integer; +begin + result := nil; + + for iCount := 0 to LazarusResources.count -1 do + begin + if ( LazarusResources.items[ iCount ].Name = aName ) AND + ( LazarusResources.items[ iCount ].ValueType = aType ) THEN + begin + result := LazarusResources.items[ iCount ]; + exit; + end; + end; +end; +{$ENDIF} + +{$IFDEF FPC} +function MaxValue(const Data: array of Double): Double; +var + I: Integer; +begin + Result := Data[Low(Data)]; + for I := Low(Data) + 1 to High(Data) do + if Result < Data[I] then + Result := Data[I]; +end; + +function MinValue(const Data: array of Double): Double; +var + I: Integer; +begin + Result := Data[Low(Data)]; + for I := Low(Data) + 1 to High(Data) do + if Result > Data[I] then + Result := Data[I]; +end; + +function RandomRange(aMin: Integer; aMax: Integer) : Integer; +begin +RandomRange := Random(aMax-aMin) + aMin ; +end; + + +// NOTE !!!!!!!!!! +// AllocateHWnd is in lclintfh.inc + +{$IFDEF MSWINDOWS} +// TODO : JB this is dodgey and bad... find a REAL solution ! +function AllocateHWnd(Method: TWndMethod): HWND; +var + TempClass: TWndClass; + ClassRegistered: Boolean; +begin + Result := CreateWindowEx(WS_EX_TOOLWINDOW, '', '', WS_POPUP , 0, 0, 0, 0, 0, 0, HInstance, nil); +end; + +procedure DeallocateHWnd(Wnd: HWND); +var + Instance: Pointer; +begin + Instance := Pointer(GetWindowLong(Wnd, GWL_WNDPROC)); + DestroyWindow(Wnd); +end; +{$ENDIF} +{$IFDEF DARWIN} +// TODO : Situation for the mac isn't better ! +function AllocateHWnd(Method: TWndMethod): HWND; +begin +end; + +procedure DeallocateHWnd(Wnd: HWND); +begin +end; +{$ENDIF} + + + + +{$ENDIF} + +{$ifNdef FPC} +function FindFirstW(const Path: widestring; Attr: Integer; var F: TSearchRecW): Integer; +const + faSpecial = faHidden or faSysFile or faVolumeID or faDirectory; +begin + F.ExcludeAttr := not Attr and faSpecial; + F.FindHandle := FindFirstFileW(PWideChar(Path), F.FindData); + if F.FindHandle <> INVALID_HANDLE_VALUE then + begin + Result := FindMatchingFileW(F); + if Result <> 0 then FindCloseW(F); + end else + Result := GetLastError; +end; + +function FindNextW(var F: TSearchRecW): Integer; +begin + if FindNextFileW(F.FindHandle, F.FindData) then + Result := FindMatchingFileW(F) + else + Result := GetLastError; +end; + +procedure FindCloseW(var F: TSearchRecW); +begin + if F.FindHandle <> INVALID_HANDLE_VALUE then + begin + Windows.FindClose(F.FindHandle); + F.FindHandle := INVALID_HANDLE_VALUE; + end; +end; + +function FindMatchingFileW(var F: TSearchRecW): Integer; +var + LocalFileTime: TFileTime; +begin + with F do + begin + while FindData.dwFileAttributes and ExcludeAttr <> 0 do + if not FindNextFileW(FindHandle, FindData) then + begin + Result := GetLastError; + Exit; + end; + FileTimeToLocalFileTime(FindData.ftLastWriteTime, LocalFileTime); + FileTimeToDosDateTime(LocalFileTime, LongRec(Time).Hi, LongRec(Time).Lo); + Size := FindData.nFileSizeLow; + Attr := FindData.dwFileAttributes; + Name := FindData.cFileName; + end; + Result := 0; +end; + +function DirectoryExistsW(const Directory: widestring): Boolean; +var + Code: Integer; +begin + Code := GetFileAttributesW(PWideChar(Directory)); + Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0); +end; +{$endif} + + + + + +end. diff --git a/Game/Code/Classes/UCore.pas b/Game/Code/Classes/UCore.pas index acd9ead7..e0f9fec2 100644 --- a/Game/Code/Classes/UCore.pas +++ b/Game/Code/Classes/UCore.pas @@ -1,501 +1,501 @@ -unit UCore; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses uPluginDefs, - uCoreModule, - UHooks, - UServices, - UModules; -{********************* - TCore - Class manages all CoreModules, teh StartUp, teh MainLoop and the shutdown process - Also it does some Error Handling, and maybe sometime multithreaded Loading ;) -*********************} - -type - TModuleListItem = record - Module: TCoreModule; //Instance of the Modules Class - Info: TModuleInfo; //ModuleInfo returned by Modules Modulinfo Proc - NeedsDeInit: Boolean; //True if Module was succesful inited - end; - - TCore = class - private - //Some Hook Handles. See Plugin SDKs Hooks.txt for Infos - hLoadingFinished: THandle; - hMainLoop: THandle; - hTranslate: THandle; - hLoadTextures: THandle; - hExitQuery: THandle; - hExit: THandle; - hDebug: THandle; - hError: THandle; - sReportError: THandle; - sReportDebug: THandle; - sShowMessage: THandle; - sRetranslate: THandle; - sReloadTextures: THandle; - sGetModuleInfo: THandle; - sGetApplicationHandle: THandle; - - Modules: Array [0..High(CORE_MODULES_TO_LOAD)] of TModuleListItem; - - //Function Get all Modules and Creates them - Function GetModules: Boolean; - - //Loads Core and all Modules - Function Load: Boolean; - - //Inits Core and all Modules - Function Init: Boolean; - - //DeInits Core and all Modules - Function DeInit: Boolean; - - //Load the Core - Function LoadCore: Boolean; - - //Init the Core - Function InitCore: Boolean; - - //DeInit the Core - Function DeInitCore: Boolean; - - //Called one Time per Frame - Function MainLoop: Boolean; - - public - Hooks: THookManager; //Teh Hook Manager ;) - Services: TServiceManager;//The Service Manager - - CurExecuted: Integer; //ID of Plugin or Module curently Executed - - Name: String; //Name of this Application - Version: LongWord; //Version of this ". For Info Look PluginDefs Functions - - LastErrorReporter:String; //Who Reported the Last Error String - LastErrorString: String; //Last Error String reported - - - //--------------- - //Main Methods to control the Core: - //--------------- - Constructor Create(const cName: String; const cVersion: LongWord); - - //Starts Loading and Init Process. Then Runs MainLoop. DeInits on Shutdown - Procedure Run; - - //Method for other Classes to get Pointer to a specific Module - Function GetModulebyName(const Name: String): PCoreModule; - - //-------------- - // Hook and Service Procs: - //-------------- - Function ShowMessage(wParam, lParam: DWord): integer; //Shows a Message (lParam: PChar Text, wParam: Symbol) - Function ReportError(wParam, lParam: DWord): integer; //Shows a Message (wParam: Pchar(Message), lParam: PChar(Reportername)) - Function ReportDebug(wParam, lParam: DWord): integer; //Shows a Message (wParam: Pchar(Message), lParam: PChar(Reportername)) - Function Retranslate(wParam, lParam: DWord): integer; //Calls Translate hook - Function ReloadTextures(wParam, lParam: DWord): integer; //Calls LoadTextures hook - Function GetModuleInfo(wParam, lParam: DWord): integer; //If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TModuleInfo to address at lparam - Function GetApplicationHandle(wParam, lParam: DWord): integer; //Returns Application Handle - end; - -var - Core: TCore; - -implementation - -uses {$IFDEF win32} - Windows, - {$ENDIF} - SysUtils; - -//------------- -// Create - Creates Class + Hook and Service Manager -//------------- -Constructor TCore.Create(const cName: String; const cVersion: LongWord); -begin - Name := cName; - Version := cVersion; - CurExecuted := 0; - - LastErrorReporter := ''; - LastErrorString := ''; - - Hooks := THookManager.Create(50); - Services := TServiceManager.Create; -end; - -//------------- -//Starts Loading and Init Process. Then Runs MainLoop. DeInits on Shutdown -//------------- -Procedure TCore.Run; -var - noError: Boolean; -begin - //Get Modules - Try - noError := GetModules; - Except - noError := False; - end; - - //Loading - if (noError) then - begin - Try - noError := Load; - Except - noError := False; - end; - - if (noError) then - begin //Init - Try - noError := Init; - Except - noError := False; - end; - - If noError then - begin - //Call Translate Hook - noError := (Hooks.CallEventChain(hTranslate, 0, 0) = 0); - - If noError then - begin //Calls LoadTextures Hook - noError := (Hooks.CallEventChain(hLoadTextures, 0, 0) = 0); - - if noError then - begin //Calls Loading Finished Hook - noError := (Hooks.CallEventChain(hLoadingFinished, 0, 0) = 0); - - If noError then - begin - //Start MainLoop - While noError do - begin - noError := MainLoop; - // to-do : Call Display Draw here - end; - end - else - begin - If (LastErrorString <> '') then - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error calling LoadingFinished Hook: ' + LastErrorString))) - else - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error calling LoadingFinished Hook'))); - end; - end - else - begin - If (LastErrorString <> '') then - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading textures: ' + LastErrorString))) - else - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading textures'))); - end; - end - else - begin - If (LastErrorString <> '') then - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error translating: ' + LastErrorString))) - else - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error translating'))); - end; - - end - else - begin - If (LastErrorString <> '') then - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error initing Modules: ' + LastErrorString))) - else - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error initing Modules'))); - end; - end - else - begin - If (LastErrorString <> '') then - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading Modules: ' + LastErrorString))) - else - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading Modules'))); - end; - end - else - begin - If (LastErrorString <> '') then - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error Getting Modules: ' + LastErrorString))) - else - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error Getting Modules'))); - end; - - //DeInit - DeInit; -end; - -//------------- -//Called one Time per Frame -//------------- -Function TCore.MainLoop: Boolean; -begin - Result := False; - -end; - -//------------- -//Function Get all Modules and Creates them -//------------- -Function TCore.GetModules: Boolean; -var - I: Integer; -begin - Result := False; - try - For I := 0 to high(Modules) do - begin - Modules[I].NeedsDeInit := False; - Modules[I].Module := CORE_MODULES_TO_LOAD[I].Create; - Modules[I].Module.Info(@Modules[I].Info); - end; - Result := True; - except - ReportError(Integer(PChar('Can''t get module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), Integer(PChar('Core'))); - end; -end; - -//------------- -//Loads Core and all Modules -//------------- -Function TCore.Load: Boolean; -var - I: Integer; -begin - Result := LoadCore; - - I := 0; - While ((Result = True) AND (I <= High(CORE_MODULES_TO_LOAD))) do - begin - try - Result := Modules[I].Module.Load; - except - Result := False; - ReportError(Integer(PChar('Error loading module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), Integer(PChar('Core'))); - end; - - Inc(I); - end; -end; - -//------------- -//Inits Core and all Modules -//------------- -Function TCore.Init: Boolean; -var - I: Integer; -begin - Result := InitCore; - - I := 0; - While ((Result = True) AND (I <= High(CORE_MODULES_TO_LOAD))) do - begin - try - Result := Modules[I].Module.Init; - except - Result := False; - ReportError(Integer(PChar('Error initing module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), Integer(PChar('Core'))); - end; - - Modules[I].NeedsDeInit := Result; - Inc(I); - end; -end; - -//------------- -//DeInits Core and all Modules -//------------- -Function TCore.DeInit: Boolean; -var - I: Integer; -label Continue; -begin - I := High(CORE_MODULES_TO_LOAD); - - Continue: - Try - While (I >= 0) do - begin - If (Modules[I].NeedsDeInit) then - Modules[I].Module.DeInit; - - Dec(I); - end; - Except - - - end; - If (I >= 0) then - GoTo Continue; - - DeInitCore; -end; - -//------------- -//Load the Core -//------------- -Function TCore.LoadCore: Boolean; -begin - hLoadingFinished := Hooks.AddEvent('Core/LoadingFinished'); - hMainLoop := Hooks.AddEvent('Core/MainLoop'); - hTranslate := Hooks.AddEvent('Core/Translate'); - hLoadTextures := Hooks.AddEvent('Core/LoadTextures'); - hExitQuery := Hooks.AddEvent('Core/ExitQuery'); - hExit := Hooks.AddEvent('Core/Exit'); - hDebug := Hooks.AddEvent('Core/NewDebugInfo'); - hError := Hooks.AddEvent('Core/NewError'); - - sReportError := Services.AddService('Core/ReportError', nil, Self.ReportError); - sReportDebug := Services.AddService('Core/ReportDebug', nil, Self.ReportDebug); - sShowMessage := Services.AddService('Core/ShowMessage', nil, Self.ShowMessage); - sRetranslate := Services.AddService('Core/Retranslate', nil, Self.Retranslate); - sReloadTextures := Services.AddService('Core/ReloadTextures', nil, Self.ReloadTextures); - sGetModuleInfo := Services.AddService('Core/GetModuleInfo', nil, Self.GetModuleInfo); - sGetApplicationHandle := Services.AddService('Core/GetApplicationHandle', nil, Self.GetApplicationHandle); - - //A little Test - Hooks.AddSubscriber('Core/NewError', HookTest); -end; - -//------------- -//Init the Core -//------------- -Function TCore.InitCore: Boolean; -begin - //Dont Init s.th. atm. -end; - -//------------- -//DeInit the Core -//------------- -Function TCore.DeInitCore: Boolean; -begin - - - // to-do : write TService-/HookManager.Free and call it here -end; - -//------------- -//Method for other Classes to get Pointer to a specific Module -//------------- -Function TCore.GetModulebyName(const Name: String): PCoreModule; -var I: Integer; -begin - Result := nil; - For I := 0 to high(Modules) do - If (Modules[I].Info.Name = Name) then - begin - Result := @Modules[I].Module; - Break; - end; -end; - -//------------- -// Shows a MessageDialog (lParam: PChar Text, wParam: Symbol) -//------------- -Function TCore.ShowMessage(wParam, lParam: DWord): integer; -var Params: Cardinal; -begin - Result := -1; - - {$IFDEF MSWINDOWS} - If (ptr(lParam)<>nil) then - begin - Params := MB_OK; - Case wParam of - CORE_SM_ERROR: Params := Params or MB_ICONERROR; - CORE_SM_WARNING: Params := Params or MB_ICONWARNING; - CORE_SM_INFO: Params := Params or MB_ICONINFORMATION; - end; - - //Anzeigen: - Result := Messagebox(0, ptr(lParam), PChar(Name), Params); - end; - {$ENDIF} - - // to-do : write ShowMessage for other OSes -end; - -//------------- -// Calls NewError HookChain (wParam: Pchar(Message), lParam: PChar(Reportername)) -//------------- -Function TCore.ReportError(wParam, lParam: DWord): integer; -begin - //Update LastErrorReporter and LastErrorString - LastErrorReporter := String(PChar(Pointer(lParam))); - LastErrorString := String(PChar(Pointer(wParam))); - - Hooks.CallEventChain(hError, wParam, lParam); -end; - -//------------- -// Calls NewDebugInfo HookChain (wParam: Pchar(Message), lParam: PChar(Reportername)) -//------------- -Function TCore.ReportDebug(wParam, lParam: DWord): integer; -begin - Hooks.CallEventChain(hDebug, wParam, lParam); -end; - -//------------- -// Calls Translate hook -//------------- -Function TCore.Retranslate(wParam, lParam: DWord): integer; -begin - Hooks.CallEventChain(hTranslate, 0, 1); -end; - -//------------- -// Calls LoadTextures hook -//------------- -Function TCore.ReloadTextures(wParam, lParam: DWord): integer; -begin - Hooks.CallEventChain(hLoadTextures, 0, 1); -end; - -//------------- -// If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TModuleInfo to address at lparam -//------------- -Function TCore.GetModuleInfo(wParam, lParam: DWord): integer; -begin - if (Pointer(lParam) = nil) then - begin - Result := Length(Modules); - end - else - begin - Try - For Result := 0 to High(Modules) do - begin - AModuleInfo(Pointer(lParam))[Result].Name := Modules[Result].Info.Name; - AModuleInfo(Pointer(lParam))[Result].Version := Modules[Result].Info.Version; - AModuleInfo(Pointer(lParam))[Result].Description := Modules[Result].Info.Description; - end; - Except - Result := -1; - end; - end; -end; - -//------------- -// Returns Application Handle -//------------- -Function TCore.GetApplicationHandle(wParam, lParam: DWord): integer; -begin - Result := hInstance; -end; - -end. +unit UCore; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses uPluginDefs, + uCoreModule, + UHooks, + UServices, + UModules; +{********************* + TCore + Class manages all CoreModules, teh StartUp, teh MainLoop and the shutdown process + Also it does some Error Handling, and maybe sometime multithreaded Loading ;) +*********************} + +type + TModuleListItem = record + Module: TCoreModule; //Instance of the Modules Class + Info: TModuleInfo; //ModuleInfo returned by Modules Modulinfo Proc + NeedsDeInit: Boolean; //True if Module was succesful inited + end; + + TCore = class + private + //Some Hook Handles. See Plugin SDKs Hooks.txt for Infos + hLoadingFinished: THandle; + hMainLoop: THandle; + hTranslate: THandle; + hLoadTextures: THandle; + hExitQuery: THandle; + hExit: THandle; + hDebug: THandle; + hError: THandle; + sReportError: THandle; + sReportDebug: THandle; + sShowMessage: THandle; + sRetranslate: THandle; + sReloadTextures: THandle; + sGetModuleInfo: THandle; + sGetApplicationHandle: THandle; + + Modules: Array [0..High(CORE_MODULES_TO_LOAD)] of TModuleListItem; + + //Function Get all Modules and Creates them + Function GetModules: Boolean; + + //Loads Core and all Modules + Function Load: Boolean; + + //Inits Core and all Modules + Function Init: Boolean; + + //DeInits Core and all Modules + Function DeInit: Boolean; + + //Load the Core + Function LoadCore: Boolean; + + //Init the Core + Function InitCore: Boolean; + + //DeInit the Core + Function DeInitCore: Boolean; + + //Called one Time per Frame + Function MainLoop: Boolean; + + public + Hooks: THookManager; //Teh Hook Manager ;) + Services: TServiceManager;//The Service Manager + + CurExecuted: Integer; //ID of Plugin or Module curently Executed + + Name: String; //Name of this Application + Version: LongWord; //Version of this ". For Info Look PluginDefs Functions + + LastErrorReporter:String; //Who Reported the Last Error String + LastErrorString: String; //Last Error String reported + + + //--------------- + //Main Methods to control the Core: + //--------------- + Constructor Create(const cName: String; const cVersion: LongWord); + + //Starts Loading and Init Process. Then Runs MainLoop. DeInits on Shutdown + Procedure Run; + + //Method for other Classes to get Pointer to a specific Module + Function GetModulebyName(const Name: String): PCoreModule; + + //-------------- + // Hook and Service Procs: + //-------------- + Function ShowMessage(wParam, lParam: DWord): integer; //Shows a Message (lParam: PChar Text, wParam: Symbol) + Function ReportError(wParam, lParam: DWord): integer; //Shows a Message (wParam: Pchar(Message), lParam: PChar(Reportername)) + Function ReportDebug(wParam, lParam: DWord): integer; //Shows a Message (wParam: Pchar(Message), lParam: PChar(Reportername)) + Function Retranslate(wParam, lParam: DWord): integer; //Calls Translate hook + Function ReloadTextures(wParam, lParam: DWord): integer; //Calls LoadTextures hook + Function GetModuleInfo(wParam, lParam: DWord): integer; //If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TModuleInfo to address at lparam + Function GetApplicationHandle(wParam, lParam: DWord): integer; //Returns Application Handle + end; + +var + Core: TCore; + +implementation + +uses {$IFDEF win32} + Windows, + {$ENDIF} + SysUtils; + +//------------- +// Create - Creates Class + Hook and Service Manager +//------------- +Constructor TCore.Create(const cName: String; const cVersion: LongWord); +begin + Name := cName; + Version := cVersion; + CurExecuted := 0; + + LastErrorReporter := ''; + LastErrorString := ''; + + Hooks := THookManager.Create(50); + Services := TServiceManager.Create; +end; + +//------------- +//Starts Loading and Init Process. Then Runs MainLoop. DeInits on Shutdown +//------------- +Procedure TCore.Run; +var + noError: Boolean; +begin + //Get Modules + Try + noError := GetModules; + Except + noError := False; + end; + + //Loading + if (noError) then + begin + Try + noError := Load; + Except + noError := False; + end; + + if (noError) then + begin //Init + Try + noError := Init; + Except + noError := False; + end; + + If noError then + begin + //Call Translate Hook + noError := (Hooks.CallEventChain(hTranslate, 0, 0) = 0); + + If noError then + begin //Calls LoadTextures Hook + noError := (Hooks.CallEventChain(hLoadTextures, 0, 0) = 0); + + if noError then + begin //Calls Loading Finished Hook + noError := (Hooks.CallEventChain(hLoadingFinished, 0, 0) = 0); + + If noError then + begin + //Start MainLoop + While noError do + begin + noError := MainLoop; + // to-do : Call Display Draw here + end; + end + else + begin + If (LastErrorString <> '') then + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error calling LoadingFinished Hook: ' + LastErrorString))) + else + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error calling LoadingFinished Hook'))); + end; + end + else + begin + If (LastErrorString <> '') then + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading textures: ' + LastErrorString))) + else + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading textures'))); + end; + end + else + begin + If (LastErrorString <> '') then + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error translating: ' + LastErrorString))) + else + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error translating'))); + end; + + end + else + begin + If (LastErrorString <> '') then + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error initing Modules: ' + LastErrorString))) + else + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error initing Modules'))); + end; + end + else + begin + If (LastErrorString <> '') then + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading Modules: ' + LastErrorString))) + else + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading Modules'))); + end; + end + else + begin + If (LastErrorString <> '') then + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error Getting Modules: ' + LastErrorString))) + else + Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error Getting Modules'))); + end; + + //DeInit + DeInit; +end; + +//------------- +//Called one Time per Frame +//------------- +Function TCore.MainLoop: Boolean; +begin + Result := False; + +end; + +//------------- +//Function Get all Modules and Creates them +//------------- +Function TCore.GetModules: Boolean; +var + I: Integer; +begin + Result := False; + try + For I := 0 to high(Modules) do + begin + Modules[I].NeedsDeInit := False; + Modules[I].Module := CORE_MODULES_TO_LOAD[I].Create; + Modules[I].Module.Info(@Modules[I].Info); + end; + Result := True; + except + ReportError(Integer(PChar('Can''t get module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), Integer(PChar('Core'))); + end; +end; + +//------------- +//Loads Core and all Modules +//------------- +Function TCore.Load: Boolean; +var + I: Integer; +begin + Result := LoadCore; + + I := 0; + While ((Result = True) AND (I <= High(CORE_MODULES_TO_LOAD))) do + begin + try + Result := Modules[I].Module.Load; + except + Result := False; + ReportError(Integer(PChar('Error loading module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), Integer(PChar('Core'))); + end; + + Inc(I); + end; +end; + +//------------- +//Inits Core and all Modules +//------------- +Function TCore.Init: Boolean; +var + I: Integer; +begin + Result := InitCore; + + I := 0; + While ((Result = True) AND (I <= High(CORE_MODULES_TO_LOAD))) do + begin + try + Result := Modules[I].Module.Init; + except + Result := False; + ReportError(Integer(PChar('Error initing module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), Integer(PChar('Core'))); + end; + + Modules[I].NeedsDeInit := Result; + Inc(I); + end; +end; + +//------------- +//DeInits Core and all Modules +//------------- +Function TCore.DeInit: Boolean; +var + I: Integer; +label Continue; +begin + I := High(CORE_MODULES_TO_LOAD); + + Continue: + Try + While (I >= 0) do + begin + If (Modules[I].NeedsDeInit) then + Modules[I].Module.DeInit; + + Dec(I); + end; + Except + + + end; + If (I >= 0) then + GoTo Continue; + + DeInitCore; +end; + +//------------- +//Load the Core +//------------- +Function TCore.LoadCore: Boolean; +begin + hLoadingFinished := Hooks.AddEvent('Core/LoadingFinished'); + hMainLoop := Hooks.AddEvent('Core/MainLoop'); + hTranslate := Hooks.AddEvent('Core/Translate'); + hLoadTextures := Hooks.AddEvent('Core/LoadTextures'); + hExitQuery := Hooks.AddEvent('Core/ExitQuery'); + hExit := Hooks.AddEvent('Core/Exit'); + hDebug := Hooks.AddEvent('Core/NewDebugInfo'); + hError := Hooks.AddEvent('Core/NewError'); + + sReportError := Services.AddService('Core/ReportError', nil, Self.ReportError); + sReportDebug := Services.AddService('Core/ReportDebug', nil, Self.ReportDebug); + sShowMessage := Services.AddService('Core/ShowMessage', nil, Self.ShowMessage); + sRetranslate := Services.AddService('Core/Retranslate', nil, Self.Retranslate); + sReloadTextures := Services.AddService('Core/ReloadTextures', nil, Self.ReloadTextures); + sGetModuleInfo := Services.AddService('Core/GetModuleInfo', nil, Self.GetModuleInfo); + sGetApplicationHandle := Services.AddService('Core/GetApplicationHandle', nil, Self.GetApplicationHandle); + + //A little Test + Hooks.AddSubscriber('Core/NewError', HookTest); +end; + +//------------- +//Init the Core +//------------- +Function TCore.InitCore: Boolean; +begin + //Dont Init s.th. atm. +end; + +//------------- +//DeInit the Core +//------------- +Function TCore.DeInitCore: Boolean; +begin + + + // to-do : write TService-/HookManager.Free and call it here +end; + +//------------- +//Method for other Classes to get Pointer to a specific Module +//------------- +Function TCore.GetModulebyName(const Name: String): PCoreModule; +var I: Integer; +begin + Result := nil; + For I := 0 to high(Modules) do + If (Modules[I].Info.Name = Name) then + begin + Result := @Modules[I].Module; + Break; + end; +end; + +//------------- +// Shows a MessageDialog (lParam: PChar Text, wParam: Symbol) +//------------- +Function TCore.ShowMessage(wParam, lParam: DWord): integer; +var Params: Cardinal; +begin + Result := -1; + + {$IFDEF Delphi} + If (ptr(lParam)<>nil) then + begin + Params := MB_OK; + Case wParam of + CORE_SM_ERROR: Params := Params or MB_ICONERROR; + CORE_SM_WARNING: Params := Params or MB_ICONWARNING; + CORE_SM_INFO: Params := Params or MB_ICONINFORMATION; + end; + + //Anzeigen: + Result := Messagebox(0, ptr(lParam), PChar(Name), Params); + end; + {$ENDIF} + + // to-do : write ShowMessage for other OSes +end; + +//------------- +// Calls NewError HookChain (wParam: Pchar(Message), lParam: PChar(Reportername)) +//------------- +Function TCore.ReportError(wParam, lParam: DWord): integer; +begin + //Update LastErrorReporter and LastErrorString + LastErrorReporter := String(PChar(Pointer(lParam))); + LastErrorString := String(PChar(Pointer(wParam))); + + Hooks.CallEventChain(hError, wParam, lParam); +end; + +//------------- +// Calls NewDebugInfo HookChain (wParam: Pchar(Message), lParam: PChar(Reportername)) +//------------- +Function TCore.ReportDebug(wParam, lParam: DWord): integer; +begin + Hooks.CallEventChain(hDebug, wParam, lParam); +end; + +//------------- +// Calls Translate hook +//------------- +Function TCore.Retranslate(wParam, lParam: DWord): integer; +begin + Hooks.CallEventChain(hTranslate, 0, 1); +end; + +//------------- +// Calls LoadTextures hook +//------------- +Function TCore.ReloadTextures(wParam, lParam: DWord): integer; +begin + Hooks.CallEventChain(hLoadTextures, 0, 1); +end; + +//------------- +// If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TModuleInfo to address at lparam +//------------- +Function TCore.GetModuleInfo(wParam, lParam: DWord): integer; +begin + if (Pointer(lParam) = nil) then + begin + Result := Length(Modules); + end + else + begin + Try + For Result := 0 to High(Modules) do + begin + AModuleInfo(Pointer(lParam))[Result].Name := Modules[Result].Info.Name; + AModuleInfo(Pointer(lParam))[Result].Version := Modules[Result].Info.Version; + AModuleInfo(Pointer(lParam))[Result].Description := Modules[Result].Info.Description; + end; + Except + Result := -1; + end; + end; +end; + +//------------- +// Returns Application Handle +//------------- +Function TCore.GetApplicationHandle(wParam, lParam: DWord): integer; +begin + Result := hInstance; +end; + +end. diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 7fd58034..2fa3ea4a 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -1,1043 +1,1045 @@ -unit USongs; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses - {$IFDEF MSWINDOWS} - Windows, - DirWatch, - {$ELSE} - {$IFNDEF DARWIN} - oldlinux, - syscall, - {$ENDIF} - baseunix, - UnixType, - {$ENDIF} - SysUtils, - Classes, - ULog, - UTexture, - UCommon, - UCatCovers; - -type - - TBPM = record - BPM: real; - StartBeat: real; - end; - - TScore = record - Name: widestring; - Score: integer; - Length: string; - end; - - TSong = record - Path: widestring; - Folder: widestring; // for sorting by folder - FileName: widestring; - - // sorting methods - Category: array of widestring; // I think I won't need this - Genre: widestring; - Edition: widestring; - Language: widestring; // 0.5.0: new - - Title: widestring; - Artist: widestring; - - Text: widestring; - Creator: widestring; - - Cover: widestring; - CoverTex: TTexture; - Mp3: widestring; - Background: widestring; - Video: widestring; - VideoGAP: real; - VideoLoaded: boolean; // 0.5.0: true if the video has been loaded - NotesGAP: integer; - Start: real; // in seconds - Finish: integer; // in miliseconds - Relative: boolean; - Resolution: integer; - BPM: array of TBPM; - GAP: real; // in miliseconds - - Score: array[0..2] of array of TScore; - - // these are used when sorting is enabled - Visible: boolean; // false if hidden, true if visible - Main: boolean; // false for songs, true for category buttons - OrderNum: integer; // has a number of category for category buttons and songs - OrderTyp: integer; // type of sorting for this button (0=name) - CatNumber: integer; // Count of Songs in Category for Cats and Number of Song in Category for Songs - end; - - TSongs = class( TThread ) - private - BrowsePos : Cardinal; //Actual Pos in Song Array - fNotify , - fWatch : longint; - fParseSongDirectory : boolean; - fProcessing : boolean; - {$ifdef MSWINDOWS} - fDirWatch : TDirectoryWatch; - {$endif} - procedure int_LoadSongList; - procedure DoDirChanged(Sender: TObject); - protected - procedure Execute; override; - public - Song : array of TSong; // array of songs - Selected : integer; // selected song index - constructor create(); - procedure LoadSongList; // load all songs - procedure BrowseDir(Dir: widestring); // should return number of songs in the future - procedure Sort(Order: integer); - function FindSongFile(Dir, Mask: widestring): widestring; - property Processing : boolean read fProcessing; - end; - - TCatSongs = class - Song: array of TSong; // array of categories with songs - Selected: integer; // selected song index - Order: integer; // order type (0=title) - CatNumShow: integer; // Category Number being seen - CatCount: integer; //Number of Categorys - - procedure Refresh; // refreshes arrays by recreating them from Songs array -// procedure Sort(Order: integer); - procedure ShowCategory(Index: integer); // expands all songs in category - procedure HideCategory(Index: integer); // hides all songs in category - procedure ClickCategoryButton(Index: integer); // uses ShowCategory and HideCategory when needed - procedure ShowCategoryList; //Hides all Songs And Show the List of all Categorys - function FindNextVisible(SearchFrom:integer): integer; //Find Next visible Song - function VisibleSongs: integer; // returns number of visible songs (for tabs) - function VisibleIndex(Index: integer): integer; // returns visible song index (skips invisible) - - function SetFilter(FilterStr: String; const fType: Byte): Cardinal; - end; - -var - Songs: TSongs; // all songs - CatSongs: TCatSongs; // categorized songs - AktSong: TSong; // one song *unknown use) - -const - IN_ACCESS = $00000001; //* File was accessed */ - IN_MODIFY = $00000002; //* File was modified */ - IN_ATTRIB = $00000004; //* Metadata changed */ - IN_CLOSE_WRITE = $00000008; //* Writtable file was closed */ - IN_CLOSE_NOWRITE = $00000010; //* Unwrittable file closed */ - IN_OPEN = $00000020; //* File was opened */ - IN_MOVED_FROM = $00000040; //* File was moved from X */ - IN_MOVED_TO = $00000080; //* File was moved to Y */ - IN_CREATE = $00000100; //* Subfile was created */ - IN_DELETE = $00000200; //* Subfile was deleted */ - IN_DELETE_SELF = $00000400; //* Self was deleted */ - - -implementation - -uses StrUtils, - UGraphic, - UCovers, - UFiles, - UMain, - UIni; - -{$IFDEF DARWIN} -function AnsiContainsText(const AText, ASubText: string): Boolean; -begin - Result := AnsiPos(AnsiUppercase(ASubText), AnsiUppercase(AText)) > 0; -end; -{$ENDIF} - -constructor TSongs.create(); -begin - inherited create( false ); - self.freeonterminate := true; - - {$IFDEF MSWINDOWS} - fDirWatch := TDirectoryWatch.create(nil); - fDirWatch.OnChange := DoDirChanged; - fDirWatch.Directory := SongPath; - fDirWatch.WatchSubDirs := true; - fDirWatch.active := true; - {$ENDIF} - - {$IFDEF linux} - (* - Thankyou to : http://www.linuxjournal.com/article/8478 - http://www.tin.org/bin/man.cgi?section=2&topic=inotify_add_watch - *) -(* - fNotify := -1; - fWatch := -1; - - writeln( 'Calling inotify_init' ); - fNotify := Do_SysCall( syscall_nr_inotify_init ); - if ( fNotify < 0 ) then - writeln( 'Filesystem change notification - disabled' ); - writeln( 'Calling inotify_init : '+ inttostr(fNotify) ); - - writeln( 'Calling syscall_nr_inotify_init ('+SongPath+')' ); - fWatch := Do_SysCall( syscall_nr_inotify_init , TSysParam( fNotify ), longint( pchar( SongPath ) ) , IN_MODIFY AND IN_CREATE AND IN_DELETE ); - - if (fWatch < 0) then - writeln ('inotify_add_watch'); - writeln( 'Calling syscall_nr_inotify_init : '+ inttostr(fWatch) ); -*) - {$endif} - - Setlength(Song, 0); -end; - -procedure TSongs.DoDirChanged(Sender: TObject); -begin - LoadSongList(); -end; - -procedure TSongs.Execute(); -var - fChangeNotify : THandle; -begin - fParseSongDirectory := true; - - while not self.terminated do - begin - - if fParseSongDirectory then - begin - writeln( 'int_LoadSongList' ); - int_LoadSongList(); - end; - - self.suspend; - end; - -end; - -procedure TSongs.int_LoadSongList; -begin - try - fProcessing := true; - Setlength(Song, 0); - - Log.LogError('SongList', 'Searching For Songs'); - - Setlength(Song, 50); - - BrowsePos := 0; - // browse directories - BrowseDir(SongPath); - - //Set Correct SongArray Length - SetLength(Song, BrowsePos); - - if assigned( CatSongs ) then - CatSongs.Refresh; - - if assigned( CatCovers ) then - CatCovers.Load; - - if assigned( Covers ) then - Covers.Load; - - if assigned(ScreenSong) then - begin - ScreenSong.GenerateThumbnails(); - ScreenSong.OnShow; // refresh ScreenSong - end; - - - finally - Log.LogError('SongList', 'Search Complete'); - - fParseSongDirectory := false; - fProcessing := false; - end; -end; - - -procedure TSongs.LoadSongList; -begin - fParseSongDirectory := true; - self.resume; -end; - -// TODO : JB - THis whole function SUX ! and needs refactoring ! :P -procedure TSongs.BrowseDir(Dir: widestring); -var - SLen: integer; - - {$ifdef MSWINDOWS} - SR: TSearchRecW; // for parsing Songs Directory - {$ENDIF} - - // eddie: can we merge that? is baseunix working on linux? oldlinux is - // not available on mac os x. - {$IFDEF LINUX} - TheDir : oldlinux.pdir; - ADirent : oldlinux.pDirent; - Entry : Longint; - info : oldlinux.stat; - {$ENDIF} - {$IFDEF DARWIN} - TheDir : pdir; - ADirent : pDirent; - Entry : Longint; - info : stat; - {$ENDIF} -begin - {$ifdef MSWINDOWS} - if FindFirstW(Dir + '*', faDirectory, SR) = 0 then // JB_Unicode - windows - begin - repeat - if (SR.Name <> '.') and (SR.Name <> '..') then - begin - BrowseDir(Dir + Sr.Name + PathDelim); - end - until FindNextw(SR) <> 0; - end; // if - FindClosew(SR); - - if FindFirstW(Dir + '*.txt', 0, SR) = 0 then - begin - repeat - SLen := BrowsePos; - - Song[SLen].Path := Dir; - Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); - Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); - Song[SLen].FileName := SR.Name; - - if (AnalyseFile(Song[SLen]) = false) then - Dec(BrowsePos) - else - begin - if Song[SLen].Cover = '' then - Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); - end; - - //Change Length Only every 50 Entrys - Inc(BrowsePos); - - if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then - begin - SetLength(Song, Length(Song) + 50); - end; - - until FindNextW(SR) <> 0; - end; // if FindFirst - FindCloseW(SR); - {$ENDIF} - - {$IFDEF LINUX} - // Itterate the Songs Directory... ( With unicode capable functions for linux ) - TheDir := oldlinux.opendir( Dir ); // JB_Unicode - linux - if TheDir <> nil then - begin - repeat - ADirent := oldlinux.ReadDir(TheDir); - - If ADirent<>Nil then - begin - With ADirent^ do - begin - - if ( name[0] <> '.') then - BrowseDir( Dir + name + pathdelim ); - - end; - end; - Until ADirent=Nil; - end; - - - - TheDir := oldlinux.opendir( Dir ); // JB_Unicode - linux - if TheDir <> nil then - begin - repeat - ADirent := oldlinux.ReadDir(TheDir); - - if ( ADirent <> Nil ) AND - ( pos( '.txt', ADirent^.name ) > 0 ) then - begin - writeln ('***** FOUND TXT' + ADirent^.name ); - - SLen := BrowsePos; - - Song[SLen].Path := Dir; - Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); - Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); - Song[SLen].FileName := ADirent^.name; - - if (AnalyseFile(Song[SLen]) = false) then - Dec(BrowsePos) - else - begin - if Song[SLen].Cover = '' then - Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); - end; - - //Change Length Only every 50 Entrys - Inc(BrowsePos); - if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then - begin - SetLength(Song, Length(Song) + 50); - end; - end; - - Until ADirent=Nil; - end; // if FindFirst - {$endif} - - {$IFDEF DARWIN} - // Itterate the Songs Directory... ( With unicode capable functions for linux ) - TheDir := FPOpenDir( Dir ); // JB_Unicode - linux - if TheDir <> nil then - begin - repeat - ADirent := FPReadDir(TheDir); - - If ADirent<>Nil then - begin - With ADirent^ do - begin - - if ( d_name[0] <> '.') then - BrowseDir( Dir + d_name + pathdelim ); - - end; - end; - Until ADirent=Nil; - end; - - - - TheDir := FPOpenDir( Dir ); // JB_Unicode - linux - if TheDir <> nil then - begin - repeat - ADirent := FPReadDir(TheDir); - - if ( ADirent <> Nil ) AND - ( pos( '.txt', ADirent^.d_name ) > -1 ) then - begin - SLen := BrowsePos; - - Song[SLen].Path := Dir; - Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); - Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); - Song[SLen].FileName := ADirent^.d_name; - - if (AnalyseFile(Song[SLen]) = false) then - Dec(BrowsePos) - else - begin - if Song[SLen].Cover = '' then - Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); - end; - - //Change Length Only every 50 Entrys - Inc(BrowsePos); - - if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then - begin - SetLength(Song, Length(Song) + 50); - end; - end; - - Until ADirent=Nil; - end; // if FindFirst - - {$endif} - -// Log.LogStatus('Parsing directory: ' + Dir + SR.Name, 'LoadSongList'); - - -end; - -procedure TSongs.Sort(Order: integer); -var - S: integer; - S2: integer; - TempSong: TSong; -begin - case Order of - sEdition: // by edition - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Edition, Song[S-1].Edition) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sGenre: // by genre - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Genre, Song[S-1].Genre) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sTitle: // by title - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - - end; - sArtist: // by artist - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sFolder: // by folder - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Folder, Song[S-1].Folder) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sTitle2: // by title2 - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - - end; - sArtist2: // by artist2 - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sLanguage: // by Language - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Language, Song[S-1].Language) < 0 then begin - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - - end; // case -end; - -function TSongs.FindSongFile(Dir, Mask: widestring): widestring; -var - SR: TSearchRec; // for parsing song directory -begin - Result := ''; - if FindFirst(Dir + Mask, faDirectory, SR) = 0 then begin - Result := SR.Name; - end; // if - FindClose(SR); -end; - -procedure TCatSongs.Refresh; -var - S: integer; // temporary song index - CatLen: integer; // length of CatSongs.Song - Letter: char; // current letter for sorting using letter - SS: string; // current edition for sorting using edition, genre etc. - Order: integer; // number used for ordernum - Letter2: char; // - CatNumber:integer; // Number of Song in Category -begin - CatNumShow := -1; -// Songs.Sort(0); // by title - -case Ini.Sorting of - sEdition: begin - Songs.Sort(sArtist); - Songs.Sort(sEdition); - end; - sGenre: begin - Songs.Sort(sArtist); - Songs.Sort(sGenre); - end; - sLanguage: begin - Songs.Sort(sArtist); - Songs.Sort(sLanguage); - end; - sFolder: begin - Songs.Sort(sArtist); - Songs.Sort(sFolder); - end; - sTitle: Songs.Sort(sTitle); - sArtist: Songs.Sort(sArtist); - sTitle2: Songs.Sort(sTitle2); // by title2 - sArtist2: Songs.Sort(sArtist2); // by artist2 - - end; // case - - - Letter := ' '; - SS := ''; - Order := 0; - CatNumber := 0; - - //Songs leeren - SetLength (Song, 0); - - for S := Low(Songs.Song) to High(Songs.Song) do begin - if (Ini.Tabs = 1) then - if (Ini.Sorting = sEdition) and (CompareText(SS, Songs.Song[S].Edition) <> 0) then begin - // add Category Button - Inc(Order); - SS := Songs.Song[S].Edition; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + SS + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - - - // 0.4.3 - // if SS = 'Singstar' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Part 2' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar German' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Spanish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Italian' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar French' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Party' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Party.jpg'; - // if SS = 'Singstar Popworld' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Popworld.jpg'; - // if SS = 'Singstar 80s' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; - // if SS = 'Singstar 80s Polish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; - // if SS = 'Singstar Rocks' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Rocks.jpg'; - // if SS = 'Singstar Anthems' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Anthems.jpg'; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';//} - - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sGenre) and (CompareText(SS, Songs.Song[S].Genre) <> 0) then begin - // add Genre Button - Inc(Order); - SS := Songs.Song[S].Genre; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sLanguage) and (CompareText(SS, Songs.Song[S].Language) <> 0) then begin - // add Language Button - Inc(Order); - SS := Songs.Song[S].Language; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sTitle) and - (Length(Songs.Song[S].Title)>=1) and - (Letter <> UpperCase(Songs.Song[S].Title)[1]) then begin - // add a letter Category Button - Inc(Order); - Letter := Uppercase(Songs.Song[S].Title)[1]; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - - {// cover-patch - if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sArtist) and (Length(Songs.Song[S].Artist)>=1) and (Letter <> UpperCase(Songs.Song[S].Artist)[1]) then begin - // add a letter Category Button - Inc(Order); - Letter := UpperCase(Songs.Song[S].Artist)[1]; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sFolder) and (CompareText(SS, Songs.Song[S].Folder) <> 0) then begin - // 0.5.0: add folder tab - Inc(Order); - SS := Songs.Song[S].Folder; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sTitle2) AND (Length(Songs.Song[S].Title)>=1) then begin - if (ord(Songs.Song[S].Title[1]) > 47) and (ord(Songs.Song[S].Title[1]) < 58) then Letter2 := '#' else Letter2 := UpperCase(Songs.Song[S].Title)[1]; - if (Letter <> Letter2) then begin - // add a letter Category Button - Inc(Order); - Letter := Letter2; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end; - end - - else if (Ini.Sorting = sArtist2) AND (Length(Songs.Song[S].Artist)>=1) then begin - if (ord(Songs.Song[S].Artist[1]) > 47) and (ord(Songs.Song[S].Artist[1]) < 58) then Letter2 := '#' else Letter2 := UpperCase(Songs.Song[S].Artist)[1]; - if (Letter <> Letter2) then begin - // add a letter Category Button - Inc(Order); - Letter := Letter2; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end; - end; - - - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - - Inc (CatNumber); //Increase Number in Cat - - CatSongs.Song[CatLen] := Songs.Song[S]; - CatSongs.Song[CatLen].OrderNum := Order; // assigns category - CatSongs.Song[CatLen].CatNumber := CatNumber; - - if (Ini.Tabs = 0) then CatSongs.Song[CatLen].Visible := true - else if (Ini.Tabs = 1) then CatSongs.Song[CatLen].Visible := false; -// if (Ini.Tabs = 1) and (Order = 1) then CatSongs.Song[CatLen].Visible := true; // open first tab -//CatSongs.Song[CatLen].Visible := true; - - end; -//CatNumber Patch - Set CatNumber of Last Category -if (ini.Tabs_at_startup = 1) And (high(Song) >=1) then - Song[CatLen - CatNumber].CatNumber := CatNumber;//Set CatNumber of Categroy -//CatCount Patch -CatCount := Order; -end; - -procedure TCatSongs.ShowCategory(Index: integer); -var - S: integer; // song -begin - CatNumShow := Index; - for S := 0 to high(CatSongs.Song) do - begin - if (CatSongs.Song[S].OrderNum = Index) AND (Not CatSongs.Song[S].Main) then - CatSongs.Song[S].Visible := true - else - CatSongs.Song[S].Visible := false; - end; -end; - -procedure TCatSongs.HideCategory(Index: integer); // hides all songs in category -var - S: integer; // song -begin - for S := 0 to high(CatSongs.Song) do begin - if not CatSongs.Song[S].Main then - CatSongs.Song[S].Visible := false // hides all at now - end; -end; - -procedure TCatSongs.ClickCategoryButton(Index: integer); -var - Num, S: integer; -begin - Num := CatSongs.Song[Index].OrderNum; - if Num <> CatNumShow then - begin - ShowCategory(Num); - end - else begin - ShowCategoryList; - end; -end; - -//Hide Categorys when in Category Hack -procedure TCatSongs.ShowCategoryList; -var - Num, S: integer; -begin - //Hide All Songs Show All Cats - for S := 0 to high(CatSongs.Song) do begin - if CatSongs.Song[S].Main then - CatSongs.Song[S].Visible := true - else - CatSongs.Song[S].Visible := false - end; - CatSongs.Selected := CatNumShow; //Show last shown Category - CatNumShow := -1; -end; -//Hide Categorys when in Category Hack End - -//Wrong song selected when tabs on bug -function TCatSongs.FindNextVisible(SearchFrom:integer): integer;//Find next Visible Song -var - I: Integer; - begin - Result := -1; - I := SearchFrom + 1; - while not CatSongs.Song[I].Visible do - begin - Inc (I); - if (I>high(CatSongs.Song)) then - I := low(CatSongs.Song); - if (I = SearchFrom) then //Make One Round and no song found->quit - break; - end; - end; -//Wrong song selected when tabs on bug End - -function TCatSongs.VisibleSongs: integer; -var - S: integer; // song -begin - Result := 0; - for S := 0 to high(CatSongs.Song) do - if CatSongs.Song[S].Visible = true then Inc(Result); -end; - -function TCatSongs.VisibleIndex(Index: integer): integer; -var - S: integer; // song -begin - Result := 0; - for S := 0 to Index-1 do - if CatSongs.Song[S].Visible = true then Inc(Result); -end; - -function TCatSongs.SetFilter(FilterStr: String; const fType: Byte): Cardinal; -var - I, J: Integer; - cString: String; - SearchStr: Array of String; -begin - {fType: 0: All - 1: Title - 2: Artist} - FilterStr := Trim(FilterStr); - if FilterStr<>'' then begin - Result := 0; - //Create Search Array - SetLength(SearchStr, 1); - I := Pos (' ', FilterStr); - While (I <> 0) do - begin - SetLength (SearchStr, Length(SearchStr) + 1); - cString := Copy(FilterStr, 1, I-1); - if (cString <> ' ') AND (cString <> '') then - SearchStr[High(SearchStr)-1] := cString; - Delete (FilterStr, 1, I); - - I := Pos (' ', FilterStr); - end; - //Copy last Word - if (FilterStr <> ' ') AND (FilterStr <> '') then - SearchStr[High(SearchStr)] := FilterStr; - - for I:=0 to High(Song) do begin - if not Song[i].Main then - begin - case fType of - 0: cString := Song[I].Artist + ' ' + Song[i].Title + ' ' + Song[i].Folder; - 1: cString := Song[I].Title; - 2: cString := Song[I].Artist; - end; - Song[i].Visible:=True; - //Look for every Searched Word - For J := 0 to High(SearchStr) do - begin - Song[i].Visible := Song[i].Visible AND AnsiContainsText(cString, SearchStr[J]) - end; - if Song[i].Visible then - Inc(Result); - end - else - Song[i].Visible:=False; - end; - CatNumShow := -2; - end - else begin - for i:=0 to High(Song) do begin - Song[i].Visible:=(Ini.Tabs=1)=Song[i].Main; - CatNumShow := -1; - end; - Result := 0; - end; -end; - -end. +unit USongs; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + {$IFDEF MSWINDOWS} + Windows, + {$ifdef Delphi} + DirWatch, + {$endif} + {$ELSE} + {$IFNDEF DARWIN} + oldlinux, + syscall, + {$ENDIF} + baseunix, + UnixType, + {$ENDIF} + SysUtils, + Classes, + ULog, + UTexture, + UCommon, + UCatCovers; + +type + + TBPM = record + BPM: real; + StartBeat: real; + end; + + TScore = record + Name: widestring; + Score: integer; + Length: string; + end; + + TSong = record + Path: widestring; + Folder: widestring; // for sorting by folder + FileName: widestring; + + // sorting methods + Category: array of widestring; // I think I won't need this + Genre: widestring; + Edition: widestring; + Language: widestring; // 0.5.0: new + + Title: widestring; + Artist: widestring; + + Text: widestring; + Creator: widestring; + + Cover: widestring; + CoverTex: TTexture; + Mp3: widestring; + Background: widestring; + Video: widestring; + VideoGAP: real; + VideoLoaded: boolean; // 0.5.0: true if the video has been loaded + NotesGAP: integer; + Start: real; // in seconds + Finish: integer; // in miliseconds + Relative: boolean; + Resolution: integer; + BPM: array of TBPM; + GAP: real; // in miliseconds + + Score: array[0..2] of array of TScore; + + // these are used when sorting is enabled + Visible: boolean; // false if hidden, true if visible + Main: boolean; // false for songs, true for category buttons + OrderNum: integer; // has a number of category for category buttons and songs + OrderTyp: integer; // type of sorting for this button (0=name) + CatNumber: integer; // Count of Songs in Category for Cats and Number of Song in Category for Songs + end; + + TSongs = class( TThread ) + private + BrowsePos : Cardinal; //Actual Pos in Song Array + fNotify , + fWatch : longint; + fParseSongDirectory : boolean; + fProcessing : boolean; + {$ifdef Delphi} + fDirWatch : TDirectoryWatch; + {$endif} + procedure int_LoadSongList; + procedure DoDirChanged(Sender: TObject); + protected + procedure Execute; override; + public + Song : array of TSong; // array of songs + Selected : integer; // selected song index + constructor create(); + procedure LoadSongList; // load all songs + procedure BrowseDir(Dir: widestring); // should return number of songs in the future + procedure Sort(Order: integer); + function FindSongFile(Dir, Mask: widestring): widestring; + property Processing : boolean read fProcessing; + end; + + TCatSongs = class + Song: array of TSong; // array of categories with songs + Selected: integer; // selected song index + Order: integer; // order type (0=title) + CatNumShow: integer; // Category Number being seen + CatCount: integer; //Number of Categorys + + procedure Refresh; // refreshes arrays by recreating them from Songs array +// procedure Sort(Order: integer); + procedure ShowCategory(Index: integer); // expands all songs in category + procedure HideCategory(Index: integer); // hides all songs in category + procedure ClickCategoryButton(Index: integer); // uses ShowCategory and HideCategory when needed + procedure ShowCategoryList; //Hides all Songs And Show the List of all Categorys + function FindNextVisible(SearchFrom:integer): integer; //Find Next visible Song + function VisibleSongs: integer; // returns number of visible songs (for tabs) + function VisibleIndex(Index: integer): integer; // returns visible song index (skips invisible) + + function SetFilter(FilterStr: String; const fType: Byte): Cardinal; + end; + +var + Songs: TSongs; // all songs + CatSongs: TCatSongs; // categorized songs + AktSong: TSong; // one song *unknown use) + +const + IN_ACCESS = $00000001; //* File was accessed */ + IN_MODIFY = $00000002; //* File was modified */ + IN_ATTRIB = $00000004; //* Metadata changed */ + IN_CLOSE_WRITE = $00000008; //* Writtable file was closed */ + IN_CLOSE_NOWRITE = $00000010; //* Unwrittable file closed */ + IN_OPEN = $00000020; //* File was opened */ + IN_MOVED_FROM = $00000040; //* File was moved from X */ + IN_MOVED_TO = $00000080; //* File was moved to Y */ + IN_CREATE = $00000100; //* Subfile was created */ + IN_DELETE = $00000200; //* Subfile was deleted */ + IN_DELETE_SELF = $00000400; //* Self was deleted */ + + +implementation + +uses StrUtils, + UGraphic, + UCovers, + UFiles, + UMain, + UIni; + +{$IFDEF DARWIN} +function AnsiContainsText(const AText, ASubText: string): Boolean; +begin + Result := AnsiPos(AnsiUppercase(ASubText), AnsiUppercase(AText)) > 0; +end; +{$ENDIF} + +constructor TSongs.create(); +begin + inherited create( false ); + self.freeonterminate := true; + + {$ifdef Delphi} + fDirWatch := TDirectoryWatch.create(nil); + fDirWatch.OnChange := DoDirChanged; + fDirWatch.Directory := SongPath; + fDirWatch.WatchSubDirs := true; + fDirWatch.active := true; + {$ENDIF} + + {$IFDEF linux} + (* + Thankyou to : http://www.linuxjournal.com/article/8478 + http://www.tin.org/bin/man.cgi?section=2&topic=inotify_add_watch + *) +(* + fNotify := -1; + fWatch := -1; + + writeln( 'Calling inotify_init' ); + fNotify := Do_SysCall( syscall_nr_inotify_init ); + if ( fNotify < 0 ) then + writeln( 'Filesystem change notification - disabled' ); + writeln( 'Calling inotify_init : '+ inttostr(fNotify) ); + + writeln( 'Calling syscall_nr_inotify_init ('+SongPath+')' ); + fWatch := Do_SysCall( syscall_nr_inotify_init , TSysParam( fNotify ), longint( pchar( SongPath ) ) , IN_MODIFY AND IN_CREATE AND IN_DELETE ); + + if (fWatch < 0) then + writeln ('inotify_add_watch'); + writeln( 'Calling syscall_nr_inotify_init : '+ inttostr(fWatch) ); +*) + {$endif} + + Setlength(Song, 0); +end; + +procedure TSongs.DoDirChanged(Sender: TObject); +begin + LoadSongList(); +end; + +procedure TSongs.Execute(); +var + fChangeNotify : THandle; +begin + fParseSongDirectory := true; + + while not self.terminated do + begin + + if fParseSongDirectory then + begin + writeln( 'int_LoadSongList' ); + int_LoadSongList(); + end; + + self.suspend; + end; + +end; + +procedure TSongs.int_LoadSongList; +begin + try + fProcessing := true; + Setlength(Song, 0); + + Log.LogError('SongList', 'Searching For Songs'); + + Setlength(Song, 50); + + BrowsePos := 0; + // browse directories + BrowseDir(SongPath); + + //Set Correct SongArray Length + SetLength(Song, BrowsePos); + + if assigned( CatSongs ) then + CatSongs.Refresh; + + if assigned( CatCovers ) then + CatCovers.Load; + + if assigned( Covers ) then + Covers.Load; + + if assigned(ScreenSong) then + begin + ScreenSong.GenerateThumbnails(); + ScreenSong.OnShow; // refresh ScreenSong + end; + + + finally + Log.LogError('SongList', 'Search Complete'); + + fParseSongDirectory := false; + fProcessing := false; + end; +end; + + +procedure TSongs.LoadSongList; +begin + fParseSongDirectory := true; + self.resume; +end; + +// TODO : JB - THis whole function SUX ! and needs refactoring ! :P +procedure TSongs.BrowseDir(Dir: widestring); +var + SLen: integer; + + {$ifdef Delphi} + SR: TSearchRecW; // for parsing Songs Directory + {$ENDIF} + + // eddie: can we merge that? is baseunix working on linux? oldlinux is + // not available on mac os x. + {$IFDEF LINUX} + TheDir : oldlinux.pdir; + ADirent : oldlinux.pDirent; + Entry : Longint; + info : oldlinux.stat; + {$ENDIF} + {$IFDEF DARWIN} + TheDir : pdir; + ADirent : pDirent; + Entry : Longint; + info : stat; + {$ENDIF} +begin + {$ifdef Delphi} + if FindFirstW(Dir + '*', faDirectory, SR) = 0 then // JB_Unicode - windows + begin + repeat + if (SR.Name <> '.') and (SR.Name <> '..') then + begin + BrowseDir(Dir + Sr.Name + PathDelim); + end + until FindNextw(SR) <> 0; + end; // if + FindClosew(SR); + + if FindFirstW(Dir + '*.txt', 0, SR) = 0 then + begin + repeat + SLen := BrowsePos; + + Song[SLen].Path := Dir; + Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); + Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); + Song[SLen].FileName := SR.Name; + + if (AnalyseFile(Song[SLen]) = false) then + Dec(BrowsePos) + else + begin + if Song[SLen].Cover = '' then + Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); + end; + + //Change Length Only every 50 Entrys + Inc(BrowsePos); + + if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then + begin + SetLength(Song, Length(Song) + 50); + end; + + until FindNextW(SR) <> 0; + end; // if FindFirst + FindCloseW(SR); + {$ENDIF} + + {$IFDEF LINUX} + // Itterate the Songs Directory... ( With unicode capable functions for linux ) + TheDir := oldlinux.opendir( Dir ); // JB_Unicode - linux + if TheDir <> nil then + begin + repeat + ADirent := oldlinux.ReadDir(TheDir); + + If ADirent<>Nil then + begin + With ADirent^ do + begin + + if ( name[0] <> '.') then + BrowseDir( Dir + name + pathdelim ); + + end; + end; + Until ADirent=Nil; + end; + + + + TheDir := oldlinux.opendir( Dir ); // JB_Unicode - linux + if TheDir <> nil then + begin + repeat + ADirent := oldlinux.ReadDir(TheDir); + + if ( ADirent <> Nil ) AND + ( pos( '.txt', ADirent^.name ) > 0 ) then + begin + writeln ('***** FOUND TXT' + ADirent^.name ); + + SLen := BrowsePos; + + Song[SLen].Path := Dir; + Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); + Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); + Song[SLen].FileName := ADirent^.name; + + if (AnalyseFile(Song[SLen]) = false) then + Dec(BrowsePos) + else + begin + if Song[SLen].Cover = '' then + Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); + end; + + //Change Length Only every 50 Entrys + Inc(BrowsePos); + if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then + begin + SetLength(Song, Length(Song) + 50); + end; + end; + + Until ADirent=Nil; + end; // if FindFirst + {$endif} + + {$IFDEF DARWIN} + // Itterate the Songs Directory... ( With unicode capable functions for linux ) + TheDir := FPOpenDir( Dir ); // JB_Unicode - linux + if TheDir <> nil then + begin + repeat + ADirent := FPReadDir(TheDir); + + If ADirent<>Nil then + begin + With ADirent^ do + begin + + if ( d_name[0] <> '.') then + BrowseDir( Dir + d_name + pathdelim ); + + end; + end; + Until ADirent=Nil; + end; + + + + TheDir := FPOpenDir( Dir ); // JB_Unicode - linux + if TheDir <> nil then + begin + repeat + ADirent := FPReadDir(TheDir); + + if ( ADirent <> Nil ) AND + ( pos( '.txt', ADirent^.d_name ) > -1 ) then + begin + SLen := BrowsePos; + + Song[SLen].Path := Dir; + Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); + Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); + Song[SLen].FileName := ADirent^.d_name; + + if (AnalyseFile(Song[SLen]) = false) then + Dec(BrowsePos) + else + begin + if Song[SLen].Cover = '' then + Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); + end; + + //Change Length Only every 50 Entrys + Inc(BrowsePos); + + if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then + begin + SetLength(Song, Length(Song) + 50); + end; + end; + + Until ADirent=Nil; + end; // if FindFirst + + {$endif} + +// Log.LogStatus('Parsing directory: ' + Dir + SR.Name, 'LoadSongList'); + + +end; + +procedure TSongs.Sort(Order: integer); +var + S: integer; + S2: integer; + TempSong: TSong; +begin + case Order of + sEdition: // by edition + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Edition, Song[S-1].Edition) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sGenre: // by genre + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Genre, Song[S-1].Genre) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sTitle: // by title + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + + end; + sArtist: // by artist + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sFolder: // by folder + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Folder, Song[S-1].Folder) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sTitle2: // by title2 + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + + end; + sArtist2: // by artist2 + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sLanguage: // by Language + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Language, Song[S-1].Language) < 0 then begin + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + + end; // case +end; + +function TSongs.FindSongFile(Dir, Mask: widestring): widestring; +var + SR: TSearchRec; // for parsing song directory +begin + Result := ''; + if FindFirst(Dir + Mask, faDirectory, SR) = 0 then begin + Result := SR.Name; + end; // if + FindClose(SR); +end; + +procedure TCatSongs.Refresh; +var + S: integer; // temporary song index + CatLen: integer; // length of CatSongs.Song + Letter: char; // current letter for sorting using letter + SS: string; // current edition for sorting using edition, genre etc. + Order: integer; // number used for ordernum + Letter2: char; // + CatNumber:integer; // Number of Song in Category +begin + CatNumShow := -1; +// Songs.Sort(0); // by title + +case Ini.Sorting of + sEdition: begin + Songs.Sort(sArtist); + Songs.Sort(sEdition); + end; + sGenre: begin + Songs.Sort(sArtist); + Songs.Sort(sGenre); + end; + sLanguage: begin + Songs.Sort(sArtist); + Songs.Sort(sLanguage); + end; + sFolder: begin + Songs.Sort(sArtist); + Songs.Sort(sFolder); + end; + sTitle: Songs.Sort(sTitle); + sArtist: Songs.Sort(sArtist); + sTitle2: Songs.Sort(sTitle2); // by title2 + sArtist2: Songs.Sort(sArtist2); // by artist2 + + end; // case + + + Letter := ' '; + SS := ''; + Order := 0; + CatNumber := 0; + + //Songs leeren + SetLength (Song, 0); + + for S := Low(Songs.Song) to High(Songs.Song) do begin + if (Ini.Tabs = 1) then + if (Ini.Sorting = sEdition) and (CompareText(SS, Songs.Song[S].Edition) <> 0) then begin + // add Category Button + Inc(Order); + SS := Songs.Song[S].Edition; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + SS + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + + + // 0.4.3 + // if SS = 'Singstar' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Part 2' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar German' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Spanish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Italian' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar French' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Party' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Party.jpg'; + // if SS = 'Singstar Popworld' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Popworld.jpg'; + // if SS = 'Singstar 80s' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; + // if SS = 'Singstar 80s Polish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; + // if SS = 'Singstar Rocks' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Rocks.jpg'; + // if SS = 'Singstar Anthems' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Anthems.jpg'; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';//} + + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sGenre) and (CompareText(SS, Songs.Song[S].Genre) <> 0) then begin + // add Genre Button + Inc(Order); + SS := Songs.Song[S].Genre; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sLanguage) and (CompareText(SS, Songs.Song[S].Language) <> 0) then begin + // add Language Button + Inc(Order); + SS := Songs.Song[S].Language; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sTitle) and + (Length(Songs.Song[S].Title)>=1) and + (Letter <> UpperCase(Songs.Song[S].Title)[1]) then begin + // add a letter Category Button + Inc(Order); + Letter := Uppercase(Songs.Song[S].Title)[1]; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + + {// cover-patch + if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sArtist) and (Length(Songs.Song[S].Artist)>=1) and (Letter <> UpperCase(Songs.Song[S].Artist)[1]) then begin + // add a letter Category Button + Inc(Order); + Letter := UpperCase(Songs.Song[S].Artist)[1]; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sFolder) and (CompareText(SS, Songs.Song[S].Folder) <> 0) then begin + // 0.5.0: add folder tab + Inc(Order); + SS := Songs.Song[S].Folder; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sTitle2) AND (Length(Songs.Song[S].Title)>=1) then begin + if (ord(Songs.Song[S].Title[1]) > 47) and (ord(Songs.Song[S].Title[1]) < 58) then Letter2 := '#' else Letter2 := UpperCase(Songs.Song[S].Title)[1]; + if (Letter <> Letter2) then begin + // add a letter Category Button + Inc(Order); + Letter := Letter2; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end; + end + + else if (Ini.Sorting = sArtist2) AND (Length(Songs.Song[S].Artist)>=1) then begin + if (ord(Songs.Song[S].Artist[1]) > 47) and (ord(Songs.Song[S].Artist[1]) < 58) then Letter2 := '#' else Letter2 := UpperCase(Songs.Song[S].Artist)[1]; + if (Letter <> Letter2) then begin + // add a letter Category Button + Inc(Order); + Letter := Letter2; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end; + end; + + + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + + Inc (CatNumber); //Increase Number in Cat + + CatSongs.Song[CatLen] := Songs.Song[S]; + CatSongs.Song[CatLen].OrderNum := Order; // assigns category + CatSongs.Song[CatLen].CatNumber := CatNumber; + + if (Ini.Tabs = 0) then CatSongs.Song[CatLen].Visible := true + else if (Ini.Tabs = 1) then CatSongs.Song[CatLen].Visible := false; +// if (Ini.Tabs = 1) and (Order = 1) then CatSongs.Song[CatLen].Visible := true; // open first tab +//CatSongs.Song[CatLen].Visible := true; + + end; +//CatNumber Patch - Set CatNumber of Last Category +if (ini.Tabs_at_startup = 1) And (high(Song) >=1) then + Song[CatLen - CatNumber].CatNumber := CatNumber;//Set CatNumber of Categroy +//CatCount Patch +CatCount := Order; +end; + +procedure TCatSongs.ShowCategory(Index: integer); +var + S: integer; // song +begin + CatNumShow := Index; + for S := 0 to high(CatSongs.Song) do + begin + if (CatSongs.Song[S].OrderNum = Index) AND (Not CatSongs.Song[S].Main) then + CatSongs.Song[S].Visible := true + else + CatSongs.Song[S].Visible := false; + end; +end; + +procedure TCatSongs.HideCategory(Index: integer); // hides all songs in category +var + S: integer; // song +begin + for S := 0 to high(CatSongs.Song) do begin + if not CatSongs.Song[S].Main then + CatSongs.Song[S].Visible := false // hides all at now + end; +end; + +procedure TCatSongs.ClickCategoryButton(Index: integer); +var + Num, S: integer; +begin + Num := CatSongs.Song[Index].OrderNum; + if Num <> CatNumShow then + begin + ShowCategory(Num); + end + else begin + ShowCategoryList; + end; +end; + +//Hide Categorys when in Category Hack +procedure TCatSongs.ShowCategoryList; +var + Num, S: integer; +begin + //Hide All Songs Show All Cats + for S := 0 to high(CatSongs.Song) do begin + if CatSongs.Song[S].Main then + CatSongs.Song[S].Visible := true + else + CatSongs.Song[S].Visible := false + end; + CatSongs.Selected := CatNumShow; //Show last shown Category + CatNumShow := -1; +end; +//Hide Categorys when in Category Hack End + +//Wrong song selected when tabs on bug +function TCatSongs.FindNextVisible(SearchFrom:integer): integer;//Find next Visible Song +var + I: Integer; + begin + Result := -1; + I := SearchFrom + 1; + while not CatSongs.Song[I].Visible do + begin + Inc (I); + if (I>high(CatSongs.Song)) then + I := low(CatSongs.Song); + if (I = SearchFrom) then //Make One Round and no song found->quit + break; + end; + end; +//Wrong song selected when tabs on bug End + +function TCatSongs.VisibleSongs: integer; +var + S: integer; // song +begin + Result := 0; + for S := 0 to high(CatSongs.Song) do + if CatSongs.Song[S].Visible = true then Inc(Result); +end; + +function TCatSongs.VisibleIndex(Index: integer): integer; +var + S: integer; // song +begin + Result := 0; + for S := 0 to Index-1 do + if CatSongs.Song[S].Visible = true then Inc(Result); +end; + +function TCatSongs.SetFilter(FilterStr: String; const fType: Byte): Cardinal; +var + I, J: Integer; + cString: String; + SearchStr: Array of String; +begin + {fType: 0: All + 1: Title + 2: Artist} + FilterStr := Trim(FilterStr); + if FilterStr<>'' then begin + Result := 0; + //Create Search Array + SetLength(SearchStr, 1); + I := Pos (' ', FilterStr); + While (I <> 0) do + begin + SetLength (SearchStr, Length(SearchStr) + 1); + cString := Copy(FilterStr, 1, I-1); + if (cString <> ' ') AND (cString <> '') then + SearchStr[High(SearchStr)-1] := cString; + Delete (FilterStr, 1, I); + + I := Pos (' ', FilterStr); + end; + //Copy last Word + if (FilterStr <> ' ') AND (FilterStr <> '') then + SearchStr[High(SearchStr)] := FilterStr; + + for I:=0 to High(Song) do begin + if not Song[i].Main then + begin + case fType of + 0: cString := Song[I].Artist + ' ' + Song[i].Title + ' ' + Song[i].Folder; + 1: cString := Song[I].Title; + 2: cString := Song[I].Artist; + end; + Song[i].Visible:=True; + //Look for every Searched Word + For J := 0 to High(SearchStr) do + begin + Song[i].Visible := Song[i].Visible AND AnsiContainsText(cString, SearchStr[J]) + end; + if Song[i].Visible then + Inc(Result); + end + else + Song[i].Visible:=False; + end; + CatNumShow := -2; + end + else begin + for i:=0 to High(Song) do begin + Song[i].Visible:=(Ini.Tabs=1)=Song[i].Main; + CatNumShow := -1; + end; + Result := 0; + end; +end; + +end. diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index f1f7fe47..ac3aa7d6 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -1,1143 +1,1143 @@ -unit UTexture; -// added for easier debug disabling -{$define blindydebug} - -// Plain (alpha = 1) -// Transparent -// Colorized - -// obsolete? -// Transparent Range -// Font (white is drawn, black is transparent) -// Font Outline (Font with darker outline) -// Font Outline 2 (Font with darker outline) -// Font Black (black is drawn, white is transparent) -// Font Gray (gray is drawn, white is transparent) -// Arrow (for arrows, white is white, gray has color, black is transparent); - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses OpenGL12, - {$IFDEF win32} - windows, - {$ENDIF} - Math, - Classes, - SysUtils, - Graphics, - UCommon, - UThemes, - SDL, - sdlutils, - SDL_Image; - -type - TTexture = record - TexNum: integer; - X: real; - Y: real; - Z: real; // new - W: real; - H: real; - ScaleW: real; // for dynamic scalling while leaving width constant - ScaleH: real; // for dynamic scalling while leaving height constant - Rot: real; // 0 - 2*pi - Int: real; // intensity - ColR: real; - ColG: real; - ColB: real; - TexW: real; // used? - TexH: real; // used? - TexX1: real; - TexY1: real; - TexX2: real; - TexY2: real; - Alpha: real; - Name: string; // 0.5.0: experimental for handling cache images. maybe it's useful for dynamic skins - end; - - TTextureEntry = record - Name: string; - Typ: string; - - // we use normal TTexture, it's easier to implement and if needed - we copy ready data - Texture: TTexture; - TextureCache: TTexture; // 0.5.0 - end; - - TTextureDatabase = record - Texture: array of TTextureEntry; - end; - - TTextureUnit = class - - private - function LoadImage(Identifier: PChar): PSDL_Surface; - function pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; - procedure AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); - function GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; - procedure ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); - procedure FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); - procedure ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); - - public - Limit: integer; - CreateCacheMipmap: boolean; - -// function GetNumberFor - function GetTexture(Name, Typ: string): TTexture; overload; - function GetTexture(Name, Typ: string; FromCache: boolean): TTexture; overload; - function FindTexture(Name: string): integer; - function LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; - function LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; - function LoadTexture(Identifier: string): TTexture; overload; - function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; - procedure UnloadTexture(Name: string; FromCache: boolean); - Constructor Create; - Destructor Destroy; - end; - -var - Texture: TTextureUnit; - TextureDatabase: TTextureDatabase; - - // this should be in UDisplay?! - PrintScreenData: array[0..1024*768-1] of longword; - - ActTex: GLuint;//integer; - -// TextureD8: array[1..1024*1024] of byte; // 1MB - TextureD16: array[1..1024*1024, 1..2] of byte; // luminance/alpha tex (2MB) -// TextureD24: array[1..1024*1024, 1..3] of byte; // normal 24-bit tex (3MB) -// TextureD242: array[1..512*512, 1..3] of byte; // normal 24-bit tex (0,75MB) -// TextureD32: array[1..1024*1024, 1..4] of byte; // transparent 32-bit tex (4MB) - // total 40MB at 2048*2048 - // total 10MB at 1024*1024 - - Mipmapping: Boolean; - - CacheMipmap: array[0..256*256*3-1] of byte; // 3KB - CacheMipmapSurface: PSDL_Surface; - - -implementation - -uses ULog, - DateUtils, - UCovers, - {$IFDEF LAZARUS} - LResources, - {$ENDIF} - StrUtils, dialogs; - -const - fmt_rgba: TSDL_Pixelformat=(palette: nil; - BitsPerPixel: 32; - BytesPerPixel: 4; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 24; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $ff000000; - ColorKey: 0; - Alpha: 255); - fmt_rgb: TSDL_Pixelformat=( palette: nil; - BitsPerPixel: 24; - BytesPerPixel: 3; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 0; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $00000000; - ColorKey: 0; - Alpha: 255); - - -Constructor TTextureUnit.Create; -begin - inherited Create; -end; - -Destructor TTextureUnit.Destroy; -begin - inherited Destroy; -end; - -function TTextureUnit.pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; -begin - if (fmt1^.BitsPerPixel = fmt2^.BitsPerPixel) and - (fmt1^.BytesPerPixel = fmt2^.BytesPerPixel) and - (fmt1^.Rloss = fmt2^.Rloss) and (fmt1^.Gloss = fmt2^.Gloss) and - (fmt1^.Bloss = fmt2^.Bloss) and (fmt1^.Rmask = fmt2^.Rmask) and - (fmt1^.Gmask = fmt2^.Gmask) and (fmt1^.Bmask = fmt2^.Bmask) and - (fmt1^.Rshift = fmt2^.Rshift) and (fmt1^.Gshift = fmt2^.Gshift) and - (fmt1^.Bshift = fmt2^.Bshift) - then - Result:=True - else - Result:=False; -end; - -// +++++++++++++++++++++ helpers for loadimage +++++++++++++++ - function SdlStreamSeek( context : PSDL_RWops; offset : Integer; whence : Integer ) : integer; cdecl; - var - stream : TStream; - origin : Word; - begin - stream := TStream( context.unknown ); - if ( stream = nil ) then - raise EInvalidContainer.Create( 'SDLStreamSeek on nil' ); - case whence of - 0 : origin := soFromBeginning; // Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0. - 1 : origin := soFromCurrent; // Offset is from the current position in the resource. Seek moves to Position + Offset. - 2 : origin := soFromEnd; - else - origin := soFromBeginning; // just in case - end; - Result := stream.Seek( offset, origin ); - end; - function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : Integer; maxnum: Integer ) : Integer; cdecl; - var - stream : TStream; - begin - stream := TStream( context.unknown ); - if ( stream = nil ) then - raise EInvalidContainer.Create( 'SDLStreamRead on nil' ); - try - Result := stream.read( Ptr^, Size * maxnum ) div size; - except - Result := -1; - end; - end; - function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl; - var - stream : TStream; - begin - stream := TStream( context.unknown ); - if ( stream = nil ) then - raise EInvalidContainer.Create( 'SDLStreamClose on nil' ); - stream.Free; - Result := 1; - end; -// ----------------------------------------------- - -function TTextureUnit.LoadImage(Identifier: PChar): PSDL_Surface; -var - - TexRWops: PSDL_RWops; - dHandle: THandle; - - {$IFDEF LAZARUS} - lLazRes : TLResource; - lResData : TStringStream; - {$ELSE} - TexStream: TStream; - {$ENDIF} - -begin - Result := nil; - TexRWops := nil; - -// Log.LogStatus( Identifier, 'LoadImage' ); - - if ( FileExists(Identifier) ) then - begin - // load from file - Log.LogStatus( 'Is File', ' LoadImage' ); - try - Result:=IMG_Load(Identifier); - except - Log.LogStatus( 'ERROR Could not load from file' , Identifier); - beep; - Exit; - end; - end - else - begin - Log.LogStatus( 'IS Resource, because file does not exist.('+Identifier+')', ' LoadImage' ); - - // load from resource stream - {$IFDEF WIN32} - dHandle := FindResource(hInstance, Identifier, 'TEX'); - if dHandle=0 then - begin - Log.LogStatus( 'ERROR Could not find resource' , ' '+ Identifier); - beep; - Exit; - end; - - - TexStream := nil; - try - TexStream := TResourceStream.Create(HInstance, Identifier, 'TEX'); - except - Log.LogStatus( 'ERROR Could not load from resource' , Identifier); - beep; - Exit; - end; - - try - TexStream.position := 0; - try - TexRWops := SDL_AllocRW; - TexRWops.unknown := TUnknown(TexStream); - TexRWops.seek := SDLStreamSeek; - TexRWops.read := SDLStreamRead; - TexRWops.write := nil; - TexRWops.close := SDLStreamClose; - TexRWops.type_ := 2; - except - Log.LogStatus( 'ERROR Could not assign resource' , Identifier); - beep; - Exit; - end; - - Log.LogStatus( 'resource Assigned....' , Identifier); - Result:=IMG_Load_RW(TexRWops,0); - SDL_FreeRW(TexRWops); - - finally - if assigned( TexStream ) then - freeandnil( TexStream ); - end; - - - {$ELSE} - lLazRes := LazFindResource( Identifier, 'TEX' ); - if lLazRes <> nil then - begin - lResData := TStringStream.create( lLazRes.value ); - try - lResData.position := 0; - try - TexRWops := SDL_AllocRW; - TexRWops.unknown := TUnknown( lResData ); - TexRWops.seek := SDLStreamSeek; - TexRWops.read := SDLStreamRead; - TexRWops.write := nil; - TexRWops.close := SDLStreamClose; - TexRWops.type_ := 2; - except - Log.LogStatus( 'ERROR Could not assign resource ('+Identifier+')' , Identifier); - beep; - Exit; - end; - - Result := IMG_Load_RW(TexRWops,0); - SDL_FreeRW(TexRWops); - finally - freeandnil( lResData ); - end; - end - else - begin - Log.LogStatus( 'NOT found in Resource ('+Identifier+')', ' LoadImage' ); - end; - {$ENDIF} - - - end; -end; - -procedure TTextureUnit.AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); -var - TempSurface: PSDL_Surface; - NeededPixFmt: PSDL_Pixelformat; -begin - NeededPixFmt:=@fmt_rgba; - if Typ= 'Plain' then NeededPixFmt:=@fmt_rgb - else - if (Typ='Transparent') or - (Typ='Colorized') - then NeededPixFmt:=@fmt_rgba - else - NeededPixFmt:=@fmt_rgb; - - - if not pixfmt_eq(TexSurface^.format, NeededPixFmt) then - begin - TempSurface:=TexSurface; - TexSurface:=SDL_ConvertSurface(TempSurface,NeededPixFmt,SDL_SWSURFACE); - SDL_FreeSurface(TempSurface); - end; -end; - -function TTextureUnit.GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; -var - TempSurface: PSDL_Surface; -begin - TempSurface:=TexSurface; - Result:=SDL_ScaleSurfaceRect(TempSurface, - 0,0,TempSurface^.W,TempSurface^.H, - W,H); -end; - -procedure TTextureUnit.ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); -var - TempSurface: PSDL_Surface; -begin - TempSurface:=TexSurface; - TexSurface:=SDL_ScaleSurfaceRect(TempSurface, - 0,0,TempSurface^.W,TempSurface^.H, - W,H); - SDL_FreeSurface(TempSurface); -end; - -procedure TTextureUnit.FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); -var - TempSurface: PSDL_Surface; -begin - TempSurface:=TexSurface; - with TempSurface^.format^ do - TexSurface:=SDL_CreateRGBSurface(SDL_SWSURFACE,W,H,BitsPerPixel,RMask, GMask, BMask, AMask); - SDL_SetAlpha(TexSurface, 0, 255); - SDL_SetAlpha(TempSurface, 0, 255); - SDL_BlitSurface(TempSurface,nil,TexSurface,nil); - SDL_FreeSurface(TempSurface); -end; - -procedure TTextureUnit.ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); - //returns hue within range [0.0-6.0) - function col2h(Color:Cardinal):double; - var - clr,hls: array[0..2] of double; - delta: double; - begin - clr[0]:=((Color and $ff0000) shr 16)/255; - clr[1]:=((Color and $ff00) shr 8)/255; - clr[2]:=(Color and $ff)/255; - hls[1]:=maxvalue(clr); - delta:=hls[1]-minvalue(clr); - if clr[0]=hls[1] then hls[0]:=(clr[1]-clr[2])/delta - else if clr[1]=hls[1] then hls[0]:=2.0+(clr[2]-clr[0])/delta - else if clr[2]=hls[1] then hls[0]:=4.0+(clr[0]-clr[1])/delta; - if hls[0]<0.0 then hls[0]:=hls[0]+6.0; - if hls[0]=6.0 then hls[0]:=0.0; - col2h:=hls[0]; - end; - procedure ColorizePixel(Pix: PByteArray; hue: Double); - var - i,j,k: Cardinal; - clr, hls: array[0..2] of Double; - delta, f, p, q, t: Double; - begin - hls[0]:=hue; - - clr[0] := Pix[0]/255; - clr[1] := Pix[1]/255; - clr[2] := Pix[2]/255; - - //calculate luminance and saturation from rgb - hls[1] := maxvalue(clr); //l:=... - delta := hls[1] - minvalue(clr); - - if hls[1] = 0.0 then - hls[2] := 0.0 - else - hls[2] := delta/hls[1]; //v:=... - - // calc new rgb from our hls (h from color, l ans s from pixel) - // if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense - begin - k:=trunc(hls[0]); - f:=hls[0]-k; - p:=hls[1]*(1.0-hls[2]); - q:=hls[1]*(1.0-(hls[2]*f)); - t:=hls[1]*(1.0-(hls[2]*(1.0-f))); - case k of - 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end; - 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end; - 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end; - 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end; - 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end; - 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; - end; - // and store new rgb back into the image - Pix[0]:=floor(255*clr[0]); - Pix[1]:=floor(255*clr[1]); - Pix[2]:=floor(255*clr[2]); - end; - end; - -var - DestinationHue: Double; - PixelIndex: Cardinal; -begin - DestinationHue:=col2h(Col); - for PixelIndex:=0 to (TexSurface^.W*TexSurface^.H -1) do - ColorizePixel(@(PByteArray(TexSurface^.Pixels)[PixelIndex*TexSurface^.format.BytesPerPixel]),DestinationHue); -end; - -function TTextureUnit.LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; -var - TexSurface: PSDL_Surface; - MipmapSurface: PSDL_Surface; - newWidth, newHeight: Cardinal; - oldWidth, oldHeight: Cardinal; - kopierindex: Cardinal; -begin - Log.BenchmarkStart(4); - Mipmapping := true; -(* - Log.LogStatus( '', '' ); - - if Identifier = nil then - Log.LogStatus(' ERROR unknown Identifier', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+'''') - else - Log.LogStatus(' should be ok - trying to load', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+''''); -*) - - // load texture data into memory - {$ifdef blindydebug} - Log.LogStatus('',' ----------------------------------------------------'); - Log.LogStatus('',' LoadImage('''+Identifier+''') (called by '+Format+')'); - {$endif} - TexSurface := LoadImage(Identifier); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - {$endif} - if not assigned(TexSurface) then - begin - Log.LogStatus( 'ERROR Could not load texture' , Identifier +' '+ Format +' '+ Typ ); - beep; - Exit; - end; - - // convert pixel format as needed - {$ifdef blindydebug} - Log.LogStatus('',' AdjustPixelFormat'); - {$endif} - AdjustPixelFormat(TexSurface, Typ); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - {$endif} - // adjust texture size (scale down, if necessary) - newWidth := TexSurface.W; - newHeight := TexSurface.H; - - if (newWidth > Limit) then - newWidth := Limit; - - if (newHeight > Limit) then - newHeight := Limit; - - if (TexSurface.W > newWidth) or (TexSurface.H > newHeight) then - begin - {$ifdef blindydebug} - Log.LogStatus('',' ScaleTexture'); - {$endif} - ScaleTexture(TexSurface,newWidth,newHeight); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - {$endif} - end; - - {$ifdef blindydebug} - Log.LogStatus('',' JB-1 : typ='+Typ); - {$endif} - - - - // don't actually understand, if this is needed... - // this should definately be changed... together with all this - // cover cache stuff - if (CreateCacheMipmap) and (Typ='Plain') then - begin - {$ifdef blindydebug} - Log.LogStatus('',' JB-1 : Minimap'); - {$endif} - - if (Covers.W <= 256) and (Covers.H <= 256) then - begin - {$ifdef blindydebug} - Log.LogStatus('',' GetScaledTexture('''+inttostr(Covers.W)+''','''+inttostr(Covers.H)+''') (for CacheMipmap)'); - {$endif} - MipmapSurface:=GetScaledTexture(TexSurface,Covers.W, Covers.H); - if assigned(MipmapSurface) then - begin - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - Log.LogStatus('',' BlitSurface Stuff'); - {$endif} - // creating and freeing the surface could be done once, if Cover.W and Cover.H don't change - CacheMipmapSurface:=SDL_CreateRGBSurfaceFrom(@CacheMipmap[0], Covers.W, Covers.H, 24, Covers.W*3, $000000ff, $0000ff00, $00ff0000, 0); - SDL_BlitSurface(MipMapSurface,nil,CacheMipmapSurface,nil); - SDL_FreeSurface(CacheMipmapSurface); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - Log.LogStatus('',' SDL_FreeSurface (CacheMipmap)'); - {$endif} - SDL_FreeSurface(MipmapSurface); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - {$endif} - end - else - begin - Log.LogStatus(' Error creating CacheMipmap',' LoadTexture('''+Identifier+''')'); - end; - end; - // should i create a cache texture, if Covers.W/H are larger? - end; - - {$ifdef blindydebug} - Log.LogStatus('',' JB-2'); - {$endif} - - - // now we might colorize the whole thing - if Typ='Colorized' then - ColorizeTexture(TexSurface,Col); - - // save actual dimensions of our texture - oldWidth:=newWidth; - oldHeight:=newHeight; - // make texture dimensions be powers of 2 - newWidth:=Round(Power(2, Ceil(Log2(newWidth)))); - newHeight:=Round(Power(2, Ceil(Log2(newHeight)))); - if (newHeight <> oldHeight) or (newWidth <> oldWidth) then - FitTexture(TexSurface,newWidth,newHeight); - - // at this point we have the image in memory... - // scaled to be at most 1024x1024 pixels large - // scaled so that dimensions are powers of 2 - // and converted to either RGB or RGBA - - {$ifdef blindydebug} - Log.LogStatus('',' JB-3'); - {$endif} - - - // if we got a Texture of Type Plain, Transparent or Colorized, - // then we're done manipulating it - // and could now create our openGL texture from it - - // prepare OpenGL texture - - // JB_linux : this is causing AV's on linux... ActText seems to be nil ! -// {$IFnDEF win32} -// if pointer(ActTex) = nil then -// exit; -// {$endif} - - glGenTextures(1, @ActTex); - - glBindTexture(GL_TEXTURE_2D, ActTex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - // load data into gl texture - if (Typ = 'Transparent') or - (Typ='Colorized') then - begin - glTexImage2D(GL_TEXTURE_2D, 0, 4, newWidth, newHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, TexSurface.pixels); - end - {if Typ = 'Plain' then} else - begin - glTexImage2D(GL_TEXTURE_2D, 0, 3, newWidth, newHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, TexSurface.pixels); - end; - - {$ifdef blindydebug} - Log.LogStatus('',' JB-4'); - {$endif} - -{ - if Typ = 'Transparent Range' then - // set alpha to 256-green-component (not sure) - Pix := TextureB.Canvas.Pixels[Position2, Position]; - TextureD32[Position*TexNewW + Position2+1, 1] := Pix; - TextureD32[Position*TexNewW + Position2+1, 2] := Pix div 256; - TextureD32[Position*TexNewW + Position2+1, 3] := Pix div (256*256); - TextureD32[Position*TexNewW + Position2+1, 4] := 256 - Pix div 256; -} -{ - if Typ = 'Font' then - // either create luminance-alpha texture - // or use transparency from differently saved file - // or do something totally different (text engine with ttf) - Pix := PPix[Position2 * 3]; - TextureD16[Position*TextureB.Width + Position2 + 1, 1] := 255; - TextureD16[Position*TextureB.Width + Position2 + 1, 2] := Pix; - glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); -} -{ - if Typ = 'Font Outline' then - // no idea... - begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - - Col := Pix; - if Col < 127 then Col := 127; - - TempA := Pix; - if TempA >= 95 then TempA := 255; - if TempA >= 31 then TempA := 255; - if Pix < 95 then TempA := (Pix * 256) div 96; - - - TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; - TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - end; -} -{ - if Typ = 'Font Outline 2' then - // same as above - begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - - Col := Pix; - if Col < 31 then Col := 31; - - TempA := Pix; - if TempA >= 31 then TempA := 255; - if Pix < 31 then TempA := Pix * (256 div 32); - - TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; - TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - if Error > 0 then beep; - end; - end; - - if Typ = 'Font Black' then - // and so on - begin - // normalnie 0,125s bez niczego 0,015s - 0,030s z pix 0,125s <-- ??? - // dimensions - TextureB.PixelFormat := pf24bit; - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2*3]; - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; - - if Typ = 'Alpha Black Colored' then - // ... hope, noone needs this - begin - TextureB.PixelFormat := pf24bit; - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2*3]; - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := (Col div $10000) and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Col div $100) and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Col and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; - - if Typ = 'Font Gray' then - begin - // dimensions - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TextureB.Height-1 do begin - for Position2 := 0 to TextureB.Width-1 do begin - Pix := TextureB.Canvas.Pixels[Position2, Position]; - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 127; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 127; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 127; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; - - if Typ = 'Arrow' then - begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - - // transparency - if Pix >= 127 then TempA := 255; - if Pix < 127 then TempA := Pix * 2; - - // ColInt = color intensity - if Pix < 127 then ColInt := 1; - if Pix >= 127 then ColInt := 2 - Pix / 128; - //0.75, 0.6, 0.25 - - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Round(ColInt * 0.75 * 255 + (1 - ColInt) * 255); - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := Round(ColInt * 0.6 * 255 + (1 - ColInt) * 255); - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Round(ColInt * 0.25 * 255 + (1 - ColInt) * 255); - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - - if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - if Error > 0 then beep; - end; - end; - - if Typ = 'Note Plain' then - begin - for Position := 0 to TextureB.Height-1 do - begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do - begin - - - - // Skin Patch - // 0-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White - case PPix[Position2*3] of - 0..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); - 192: Pix := Col; - 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); - 255: Pix := $FFFFFF; - end; -// 0.5.0. Original -// case PPix[Position2*3] of -// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; -// 192: Pix := Col; -// 255: Pix := $FFFFFF; -// end; - - - - - - TextureD24[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; - TextureD24[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; - TextureD24[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureB.Width, TextureB.Height, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); - end; - - if Typ = 'Note Transparent' then - begin - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - TempA := 255; - - - - //Skin Patch - // 0= Transparent, 1-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White - case PPix[Position2*3] of - 0: TempA := 0; - 1..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); - 192: Pix := Col; - 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); - 255: Pix := $FFFFFF; - end; -// 0.5.0 Original -// case PPix[Position2*3] of -// 0: TempA := 0; -// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; -// 192: Pix := Col; -// 255: Pix := $FFFFFF; -// end; - - - - - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; -} - - {$ifdef blindydebug} - Log.LogStatus('',' JB-5'); - {$endif} - - - Result.X := 0; - Result.Y := 0; - Result.W := 0; - Result.H := 0; - Result.ScaleW := 1; - Result.ScaleH := 1; - Result.Rot := 0; - Result.TexNum := ActTex; - Result.TexW := oldWidth / newWidth; - Result.TexH := oldHeight / newHeight; - - Result.Int := 1; - Result.ColR := 1; - Result.ColG := 1; - Result.ColB := 1; - Result.Alpha := 1; - - // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these - Result.TexX1 := 0; - Result.TexY1 := 0; - Result.TexX2 := 1; - Result.TexY2 := 1; - - {$ifdef blindydebug} - Log.LogStatus('',' JB-6'); - {$endif} - - - // 0.5.0 - Result.Name := Identifier; - - SDL_FreeSurface(TexSurface); - - {$ifdef blindydebug} - Log.LogStatus('',' JB-7'); - {$endif} - - - Log.BenchmarkEnd(4); - if Log.BenchmarkTimeLength[4] >= 1 then - Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4); - - {$ifdef blindydebug} - Log.LogStatus('',' JB-8'); - {$endif} - -end; - - -function TTextureUnit.GetTexture(Name, Typ: string): TTexture; -begin - Result := GetTexture(Name, Typ, true); -end; - -function TTextureUnit.GetTexture(Name, Typ: string; FromCache: boolean): TTexture; -var - T: integer; // texture - C: integer; // cover - Data: array of byte; -begin - - if Name = '' then - exit; - - // find texture entry - T := FindTexture(Name); - - if T = -1 then - begin - // create texture entry - T := Length(TextureDatabase.Texture); - SetLength(TextureDatabase.Texture, T+1); - - TextureDatabase.Texture[T].Name := Name; - TextureDatabase.Texture[T].Typ := Typ; - - // inform database that no textures have been loaded into memory - TextureDatabase.Texture[T].Texture.TexNum := -1; - TextureDatabase.Texture[T].TextureCache.TexNum := -1; - end; - - // use preloaded texture - if (not FromCache) or (FromCache and not Covers.CoverExists(Name)) then - begin - // use full texture - if TextureDatabase.Texture[T].Texture.TexNum = -1 then - begin - // load texture - {$ifdef blindydebug} - Log.LogStatus('...', 'GetTexture('''+Name+''','''+Typ+''')'); - {$endif} - TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', pchar(Typ), $0); - {$ifdef blindydebug} - Log.LogStatus('done',' '); - {$endif} - end; - - // use texture - Result := TextureDatabase.Texture[T].Texture; - end; - - if FromCache and Covers.CoverExists(Name) then - begin - // use cache texture - C := Covers.CoverNumber(Name); - - if TextureDatabase.Texture[T].TextureCache.TexNum = -1 then - begin - // load texture - Covers.PrepareData(Name); - TextureDatabase.Texture[T].TextureCache := CreateTexture(Covers.Data, Name, Covers.Cover[C].W, Covers.Cover[C].H, 24); - end; - - // use texture - Result := TextureDatabase.Texture[T].TextureCache; - end; -end; - -function TTextureUnit.FindTexture(Name: string): integer; -var - T: integer; // texture -begin - Result := -1; - for T := 0 to high(TextureDatabase.Texture) do - if TextureDatabase.Texture[T].Name = Name then - Result := T; -end; - -function TTextureUnit.LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; -begin - Result := LoadTexture(false, Identifier, Format, Typ, Col); -end; - -function TTextureUnit.LoadTexture(Identifier: string): TTexture; -begin - Result := LoadTexture(false, pchar(Identifier), 'JPG', 'Plain', 0); -end; - -function TTextureUnit.CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; -var - Position: integer; - Position2: integer; - Pix: integer; - ColInt: real; - PPix: PByteArray; - TempA: integer; - Error: integer; -begin - Mipmapping := false; - - glGenTextures(1, @ActTex); // ActText = new texture number - glBindTexture(GL_TEXTURE_2D, ActTex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - glTexImage2D(GL_TEXTURE_2D, 0, 3, W, H, 0, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, W, H, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); - if Error > 0 then beep; - end; - - Result.X := 0; - Result.Y := 0; - Result.W := 0; - Result.H := 0; - Result.ScaleW := 1; - Result.ScaleH := 1; - Result.Rot := 0; - Result.TexNum := ActTex; - Result.TexW := 1; - Result.TexH := 1; - - Result.Int := 1; - Result.ColR := 1; - Result.ColG := 1; - Result.ColB := 1; - Result.Alpha := 1; - - // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these - Result.TexX1 := 0; - Result.TexY1 := 0; - Result.TexX2 := 1; - Result.TexY2 := 1; - - // 0.5.0 - Result.Name := Name; -end; - -procedure TTextureUnit.UnloadTexture(Name: string; FromCache: boolean); -var - T: integer; - TexNum: GLuint; -begin - T := FindTexture(Name); - - if not FromCache then begin - TexNum := TextureDatabase.Texture[T].Texture.TexNum; - if TexNum >= 0 then begin - glDeleteTextures(1, @TexNum); - TextureDatabase.Texture[T].Texture.TexNum := -1; -// Log.LogError('Unload texture no '+IntToStr(TexNum)); - end; - end else begin - TexNum := TextureDatabase.Texture[T].TextureCache.TexNum; - if TexNum >= 0 then begin - glDeleteTextures(1, @TexNum); - TextureDatabase.Texture[T].TextureCache.TexNum := -1; -// Log.LogError('Unload texture cache no '+IntToStr(TexNum)); - end; - end; -end; - -{$IFDEF LAZARUS} -initialization - {$I UltraStar.lrs} -{$ENDIF} - - -end. +unit UTexture; +// added for easier debug disabling +{$define blindydebug} + +// Plain (alpha = 1) +// Transparent +// Colorized + +// obsolete? +// Transparent Range +// Font (white is drawn, black is transparent) +// Font Outline (Font with darker outline) +// Font Outline 2 (Font with darker outline) +// Font Black (black is drawn, white is transparent) +// Font Gray (gray is drawn, white is transparent) +// Arrow (for arrows, white is white, gray has color, black is transparent); + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses OpenGL12, + {$IFDEF win32} + windows, + {$ENDIF} + Math, + Classes, + SysUtils, + Graphics, + UCommon, + UThemes, + SDL, + sdlutils, + SDL_Image; + +type + TTexture = record + TexNum: integer; + X: real; + Y: real; + Z: real; // new + W: real; + H: real; + ScaleW: real; // for dynamic scalling while leaving width constant + ScaleH: real; // for dynamic scalling while leaving height constant + Rot: real; // 0 - 2*pi + Int: real; // intensity + ColR: real; + ColG: real; + ColB: real; + TexW: real; // used? + TexH: real; // used? + TexX1: real; + TexY1: real; + TexX2: real; + TexY2: real; + Alpha: real; + Name: string; // 0.5.0: experimental for handling cache images. maybe it's useful for dynamic skins + end; + + TTextureEntry = record + Name: string; + Typ: string; + + // we use normal TTexture, it's easier to implement and if needed - we copy ready data + Texture: TTexture; + TextureCache: TTexture; // 0.5.0 + end; + + TTextureDatabase = record + Texture: array of TTextureEntry; + end; + + TTextureUnit = class + + private + function LoadImage(Identifier: PChar): PSDL_Surface; + function pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; + procedure AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); + function GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; + procedure ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); + procedure FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); + procedure ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); + + public + Limit: integer; + CreateCacheMipmap: boolean; + +// function GetNumberFor + function GetTexture(Name, Typ: string): TTexture; overload; + function GetTexture(Name, Typ: string; FromCache: boolean): TTexture; overload; + function FindTexture(Name: string): integer; + function LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; + function LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; + function LoadTexture(Identifier: string): TTexture; overload; + function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; + procedure UnloadTexture(Name: string; FromCache: boolean); + Constructor Create; + Destructor Destroy; + end; + +var + Texture: TTextureUnit; + TextureDatabase: TTextureDatabase; + + // this should be in UDisplay?! + PrintScreenData: array[0..1024*768-1] of longword; + + ActTex: GLuint;//integer; + +// TextureD8: array[1..1024*1024] of byte; // 1MB + TextureD16: array[1..1024*1024, 1..2] of byte; // luminance/alpha tex (2MB) +// TextureD24: array[1..1024*1024, 1..3] of byte; // normal 24-bit tex (3MB) +// TextureD242: array[1..512*512, 1..3] of byte; // normal 24-bit tex (0,75MB) +// TextureD32: array[1..1024*1024, 1..4] of byte; // transparent 32-bit tex (4MB) + // total 40MB at 2048*2048 + // total 10MB at 1024*1024 + + Mipmapping: Boolean; + + CacheMipmap: array[0..256*256*3-1] of byte; // 3KB + CacheMipmapSurface: PSDL_Surface; + + +implementation + +uses ULog, + DateUtils, + UCovers, + {$IFDEF LAZARUS} + LResources, + {$ENDIF} + StrUtils, dialogs; + +const + fmt_rgba: TSDL_Pixelformat=(palette: nil; + BitsPerPixel: 32; + BytesPerPixel: 4; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 24; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $ff000000; + ColorKey: 0; + Alpha: 255); + fmt_rgb: TSDL_Pixelformat=( palette: nil; + BitsPerPixel: 24; + BytesPerPixel: 3; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 0; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $00000000; + ColorKey: 0; + Alpha: 255); + + +Constructor TTextureUnit.Create; +begin + inherited Create; +end; + +Destructor TTextureUnit.Destroy; +begin + inherited Destroy; +end; + +function TTextureUnit.pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; +begin + if (fmt1^.BitsPerPixel = fmt2^.BitsPerPixel) and + (fmt1^.BytesPerPixel = fmt2^.BytesPerPixel) and + (fmt1^.Rloss = fmt2^.Rloss) and (fmt1^.Gloss = fmt2^.Gloss) and + (fmt1^.Bloss = fmt2^.Bloss) and (fmt1^.Rmask = fmt2^.Rmask) and + (fmt1^.Gmask = fmt2^.Gmask) and (fmt1^.Bmask = fmt2^.Bmask) and + (fmt1^.Rshift = fmt2^.Rshift) and (fmt1^.Gshift = fmt2^.Gshift) and + (fmt1^.Bshift = fmt2^.Bshift) + then + Result:=True + else + Result:=False; +end; + +// +++++++++++++++++++++ helpers for loadimage +++++++++++++++ + function SdlStreamSeek( context : PSDL_RWops; offset : Integer; whence : Integer ) : integer; cdecl; + var + stream : TStream; + origin : Word; + begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamSeek on nil' ); + case whence of + 0 : origin := soFromBeginning; // Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0. + 1 : origin := soFromCurrent; // Offset is from the current position in the resource. Seek moves to Position + Offset. + 2 : origin := soFromEnd; + else + origin := soFromBeginning; // just in case + end; + Result := stream.Seek( offset, origin ); + end; + function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : Integer; maxnum: Integer ) : Integer; cdecl; + var + stream : TStream; + begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamRead on nil' ); + try + Result := stream.read( Ptr^, Size * maxnum ) div size; + except + Result := -1; + end; + end; + function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl; + var + stream : TStream; + begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamClose on nil' ); + stream.Free; + Result := 1; + end; +// ----------------------------------------------- + +function TTextureUnit.LoadImage(Identifier: PChar): PSDL_Surface; +var + + TexRWops: PSDL_RWops; + dHandle: THandle; + + {$IFDEF LAZARUS} + lLazRes : TLResource; + lResData : TStringStream; + {$ELSE} + TexStream: TStream; + {$ENDIF} + +begin + Result := nil; + TexRWops := nil; + +// Log.LogStatus( Identifier, 'LoadImage' ); + + if ( FileExists(Identifier) ) then + begin + // load from file + Log.LogStatus( 'Is File', ' LoadImage' ); + try + Result:=IMG_Load(Identifier); + except + Log.LogStatus( 'ERROR Could not load from file' , Identifier); + beep; + Exit; + end; + end + else + begin + Log.LogStatus( 'IS Resource, because file does not exist.('+Identifier+')', ' LoadImage' ); + + // load from resource stream + {$IFDEF DELPHI} + dHandle := FindResource(hInstance, Identifier, 'TEX'); + if dHandle=0 then + begin + Log.LogStatus( 'ERROR Could not find resource' , ' '+ Identifier); + beep; + Exit; + end; + + + TexStream := nil; + try + TexStream := TResourceStream.Create(HInstance, Identifier, 'TEX'); + except + Log.LogStatus( 'ERROR Could not load from resource' , Identifier); + beep; + Exit; + end; + + try + TexStream.position := 0; + try + TexRWops := SDL_AllocRW; + TexRWops.unknown := TUnknown(TexStream); + TexRWops.seek := SDLStreamSeek; + TexRWops.read := SDLStreamRead; + TexRWops.write := nil; + TexRWops.close := SDLStreamClose; + TexRWops.type_ := 2; + except + Log.LogStatus( 'ERROR Could not assign resource' , Identifier); + beep; + Exit; + end; + + Log.LogStatus( 'resource Assigned....' , Identifier); + Result:=IMG_Load_RW(TexRWops,0); + SDL_FreeRW(TexRWops); + + finally + if assigned( TexStream ) then + freeandnil( TexStream ); + end; + + + {$ELSE} + lLazRes := LazFindResource( Identifier, 'TEX' ); + if lLazRes <> nil then + begin + lResData := TStringStream.create( lLazRes.value ); + try + lResData.position := 0; + try + TexRWops := SDL_AllocRW; + TexRWops.unknown := TUnknown( lResData ); + TexRWops.seek := SDLStreamSeek; + TexRWops.read := SDLStreamRead; + TexRWops.write := nil; + TexRWops.close := SDLStreamClose; + TexRWops.type_ := 2; + except + Log.LogStatus( 'ERROR Could not assign resource ('+Identifier+')' , Identifier); + beep; + Exit; + end; + + Result := IMG_Load_RW(TexRWops,0); + SDL_FreeRW(TexRWops); + finally + freeandnil( lResData ); + end; + end + else + begin + Log.LogStatus( 'NOT found in Resource ('+Identifier+')', ' LoadImage' ); + end; + {$ENDIF} + + + end; +end; + +procedure TTextureUnit.AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); +var + TempSurface: PSDL_Surface; + NeededPixFmt: PSDL_Pixelformat; +begin + NeededPixFmt:=@fmt_rgba; + if Typ= 'Plain' then NeededPixFmt:=@fmt_rgb + else + if (Typ='Transparent') or + (Typ='Colorized') + then NeededPixFmt:=@fmt_rgba + else + NeededPixFmt:=@fmt_rgb; + + + if not pixfmt_eq(TexSurface^.format, NeededPixFmt) then + begin + TempSurface:=TexSurface; + TexSurface:=SDL_ConvertSurface(TempSurface,NeededPixFmt,SDL_SWSURFACE); + SDL_FreeSurface(TempSurface); + end; +end; + +function TTextureUnit.GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; +var + TempSurface: PSDL_Surface; +begin + TempSurface:=TexSurface; + Result:=SDL_ScaleSurfaceRect(TempSurface, + 0,0,TempSurface^.W,TempSurface^.H, + W,H); +end; + +procedure TTextureUnit.ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); +var + TempSurface: PSDL_Surface; +begin + TempSurface:=TexSurface; + TexSurface:=SDL_ScaleSurfaceRect(TempSurface, + 0,0,TempSurface^.W,TempSurface^.H, + W,H); + SDL_FreeSurface(TempSurface); +end; + +procedure TTextureUnit.FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); +var + TempSurface: PSDL_Surface; +begin + TempSurface:=TexSurface; + with TempSurface^.format^ do + TexSurface:=SDL_CreateRGBSurface(SDL_SWSURFACE,W,H,BitsPerPixel,RMask, GMask, BMask, AMask); + SDL_SetAlpha(TexSurface, 0, 255); + SDL_SetAlpha(TempSurface, 0, 255); + SDL_BlitSurface(TempSurface,nil,TexSurface,nil); + SDL_FreeSurface(TempSurface); +end; + +procedure TTextureUnit.ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); + //returns hue within range [0.0-6.0) + function col2h(Color:Cardinal):double; + var + clr,hls: array[0..2] of double; + delta: double; + begin + clr[0]:=((Color and $ff0000) shr 16)/255; + clr[1]:=((Color and $ff00) shr 8)/255; + clr[2]:=(Color and $ff)/255; + hls[1]:=maxvalue(clr); + delta:=hls[1]-minvalue(clr); + if clr[0]=hls[1] then hls[0]:=(clr[1]-clr[2])/delta + else if clr[1]=hls[1] then hls[0]:=2.0+(clr[2]-clr[0])/delta + else if clr[2]=hls[1] then hls[0]:=4.0+(clr[0]-clr[1])/delta; + if hls[0]<0.0 then hls[0]:=hls[0]+6.0; + if hls[0]=6.0 then hls[0]:=0.0; + col2h:=hls[0]; + end; + procedure ColorizePixel(Pix: PByteArray; hue: Double); + var + i,j,k: Cardinal; + clr, hls: array[0..2] of Double; + delta, f, p, q, t: Double; + begin + hls[0]:=hue; + + clr[0] := Pix[0]/255; + clr[1] := Pix[1]/255; + clr[2] := Pix[2]/255; + + //calculate luminance and saturation from rgb + hls[1] := maxvalue(clr); //l:=... + delta := hls[1] - minvalue(clr); + + if hls[1] = 0.0 then + hls[2] := 0.0 + else + hls[2] := delta/hls[1]; //v:=... + + // calc new rgb from our hls (h from color, l ans s from pixel) + // if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense + begin + k:=trunc(hls[0]); + f:=hls[0]-k; + p:=hls[1]*(1.0-hls[2]); + q:=hls[1]*(1.0-(hls[2]*f)); + t:=hls[1]*(1.0-(hls[2]*(1.0-f))); + case k of + 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end; + 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end; + 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end; + 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end; + 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end; + 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; + end; + // and store new rgb back into the image + Pix[0]:=floor(255*clr[0]); + Pix[1]:=floor(255*clr[1]); + Pix[2]:=floor(255*clr[2]); + end; + end; + +var + DestinationHue: Double; + PixelIndex: Cardinal; +begin + DestinationHue:=col2h(Col); + for PixelIndex:=0 to (TexSurface^.W*TexSurface^.H -1) do + ColorizePixel(@(PByteArray(TexSurface^.Pixels)[PixelIndex*TexSurface^.format.BytesPerPixel]),DestinationHue); +end; + +function TTextureUnit.LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; +var + TexSurface: PSDL_Surface; + MipmapSurface: PSDL_Surface; + newWidth, newHeight: Cardinal; + oldWidth, oldHeight: Cardinal; + kopierindex: Cardinal; +begin + Log.BenchmarkStart(4); + Mipmapping := true; +(* + Log.LogStatus( '', '' ); + + if Identifier = nil then + Log.LogStatus(' ERROR unknown Identifier', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+'''') + else + Log.LogStatus(' should be ok - trying to load', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+''''); +*) + + // load texture data into memory + {$ifdef blindydebug} + Log.LogStatus('',' ----------------------------------------------------'); + Log.LogStatus('',' LoadImage('''+Identifier+''') (called by '+Format+')'); + {$endif} + TexSurface := LoadImage(Identifier); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + if not assigned(TexSurface) then + begin + Log.LogStatus( 'ERROR Could not load texture' , Identifier +' '+ Format +' '+ Typ ); + beep; + Exit; + end; + + // convert pixel format as needed + {$ifdef blindydebug} + Log.LogStatus('',' AdjustPixelFormat'); + {$endif} + AdjustPixelFormat(TexSurface, Typ); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + // adjust texture size (scale down, if necessary) + newWidth := TexSurface.W; + newHeight := TexSurface.H; + + if (newWidth > Limit) then + newWidth := Limit; + + if (newHeight > Limit) then + newHeight := Limit; + + if (TexSurface.W > newWidth) or (TexSurface.H > newHeight) then + begin + {$ifdef blindydebug} + Log.LogStatus('',' ScaleTexture'); + {$endif} + ScaleTexture(TexSurface,newWidth,newHeight); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + end; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-1 : typ='+Typ); + {$endif} + + + + // don't actually understand, if this is needed... + // this should definately be changed... together with all this + // cover cache stuff + if (CreateCacheMipmap) and (Typ='Plain') then + begin + {$ifdef blindydebug} + Log.LogStatus('',' JB-1 : Minimap'); + {$endif} + + if (Covers.W <= 256) and (Covers.H <= 256) then + begin + {$ifdef blindydebug} + Log.LogStatus('',' GetScaledTexture('''+inttostr(Covers.W)+''','''+inttostr(Covers.H)+''') (for CacheMipmap)'); + {$endif} + MipmapSurface:=GetScaledTexture(TexSurface,Covers.W, Covers.H); + if assigned(MipmapSurface) then + begin + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + Log.LogStatus('',' BlitSurface Stuff'); + {$endif} + // creating and freeing the surface could be done once, if Cover.W and Cover.H don't change + CacheMipmapSurface:=SDL_CreateRGBSurfaceFrom(@CacheMipmap[0], Covers.W, Covers.H, 24, Covers.W*3, $000000ff, $0000ff00, $00ff0000, 0); + SDL_BlitSurface(MipMapSurface,nil,CacheMipmapSurface,nil); + SDL_FreeSurface(CacheMipmapSurface); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + Log.LogStatus('',' SDL_FreeSurface (CacheMipmap)'); + {$endif} + SDL_FreeSurface(MipmapSurface); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + end + else + begin + Log.LogStatus(' Error creating CacheMipmap',' LoadTexture('''+Identifier+''')'); + end; + end; + // should i create a cache texture, if Covers.W/H are larger? + end; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-2'); + {$endif} + + + // now we might colorize the whole thing + if Typ='Colorized' then + ColorizeTexture(TexSurface,Col); + + // save actual dimensions of our texture + oldWidth:=newWidth; + oldHeight:=newHeight; + // make texture dimensions be powers of 2 + newWidth:=Round(Power(2, Ceil(Log2(newWidth)))); + newHeight:=Round(Power(2, Ceil(Log2(newHeight)))); + if (newHeight <> oldHeight) or (newWidth <> oldWidth) then + FitTexture(TexSurface,newWidth,newHeight); + + // at this point we have the image in memory... + // scaled to be at most 1024x1024 pixels large + // scaled so that dimensions are powers of 2 + // and converted to either RGB or RGBA + + {$ifdef blindydebug} + Log.LogStatus('',' JB-3'); + {$endif} + + + // if we got a Texture of Type Plain, Transparent or Colorized, + // then we're done manipulating it + // and could now create our openGL texture from it + + // prepare OpenGL texture + + // JB_linux : this is causing AV's on linux... ActText seems to be nil ! +// {$IFnDEF win32} +// if pointer(ActTex) = nil then +// exit; +// {$endif} + + glGenTextures(1, @ActTex); + + glBindTexture(GL_TEXTURE_2D, ActTex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + // load data into gl texture + if (Typ = 'Transparent') or + (Typ='Colorized') then + begin + glTexImage2D(GL_TEXTURE_2D, 0, 4, newWidth, newHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, TexSurface.pixels); + end + {if Typ = 'Plain' then} else + begin + glTexImage2D(GL_TEXTURE_2D, 0, 3, newWidth, newHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, TexSurface.pixels); + end; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-4'); + {$endif} + +{ + if Typ = 'Transparent Range' then + // set alpha to 256-green-component (not sure) + Pix := TextureB.Canvas.Pixels[Position2, Position]; + TextureD32[Position*TexNewW + Position2+1, 1] := Pix; + TextureD32[Position*TexNewW + Position2+1, 2] := Pix div 256; + TextureD32[Position*TexNewW + Position2+1, 3] := Pix div (256*256); + TextureD32[Position*TexNewW + Position2+1, 4] := 256 - Pix div 256; +} +{ + if Typ = 'Font' then + // either create luminance-alpha texture + // or use transparency from differently saved file + // or do something totally different (text engine with ttf) + Pix := PPix[Position2 * 3]; + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := 255; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := Pix; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); +} +{ + if Typ = 'Font Outline' then + // no idea... + begin + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + Col := Pix; + if Col < 127 then Col := 127; + + TempA := Pix; + if TempA >= 95 then TempA := 255; + if TempA >= 31 then TempA := 255; + if Pix < 95 then TempA := (Pix * 256) div 96; + + + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + end; +} +{ + if Typ = 'Font Outline 2' then + // same as above + begin + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + Col := Pix; + if Col < 31 then Col := 31; + + TempA := Pix; + if TempA >= 31 then TempA := 255; + if Pix < 31 then TempA := Pix * (256 div 32); + + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + if Error > 0 then beep; + end; + end; + + if Typ = 'Font Black' then + // and so on + begin + // normalnie 0,125s bez niczego 0,015s - 0,030s z pix 0,125s <-- ??? + // dimensions + TextureB.PixelFormat := pf24bit; + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2*3]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + if Typ = 'Alpha Black Colored' then + // ... hope, noone needs this + begin + TextureB.PixelFormat := pf24bit; + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2*3]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := (Col div $10000) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Col div $100) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Col and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + if Typ = 'Font Gray' then + begin + // dimensions + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + for Position2 := 0 to TextureB.Width-1 do begin + Pix := TextureB.Canvas.Pixels[Position2, Position]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + if Typ = 'Arrow' then + begin + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + // transparency + if Pix >= 127 then TempA := 255; + if Pix < 127 then TempA := Pix * 2; + + // ColInt = color intensity + if Pix < 127 then ColInt := 1; + if Pix >= 127 then ColInt := 2 - Pix / 128; + //0.75, 0.6, 0.25 + + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Round(ColInt * 0.75 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := Round(ColInt * 0.6 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Round(ColInt * 0.25 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + if Error > 0 then beep; + end; + end; + + if Typ = 'Note Plain' then + begin + for Position := 0 to TextureB.Height-1 do + begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do + begin + + + + // Skin Patch + // 0-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White + case PPix[Position2*3] of + 0..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); + 192: Pix := Col; + 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); + 255: Pix := $FFFFFF; + end; +// 0.5.0. Original +// case PPix[Position2*3] of +// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; +// 192: Pix := Col; +// 255: Pix := $FFFFFF; +// end; + + + + + + TextureD24[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; + TextureD24[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; + TextureD24[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureB.Width, TextureB.Height, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); + end; + + if Typ = 'Note Transparent' then + begin + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + TempA := 255; + + + + //Skin Patch + // 0= Transparent, 1-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White + case PPix[Position2*3] of + 0: TempA := 0; + 1..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); + 192: Pix := Col; + 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); + 255: Pix := $FFFFFF; + end; +// 0.5.0 Original +// case PPix[Position2*3] of +// 0: TempA := 0; +// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; +// 192: Pix := Col; +// 255: Pix := $FFFFFF; +// end; + + + + + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; +} + + {$ifdef blindydebug} + Log.LogStatus('',' JB-5'); + {$endif} + + + Result.X := 0; + Result.Y := 0; + Result.W := 0; + Result.H := 0; + Result.ScaleW := 1; + Result.ScaleH := 1; + Result.Rot := 0; + Result.TexNum := ActTex; + Result.TexW := oldWidth / newWidth; + Result.TexH := oldHeight / newHeight; + + Result.Int := 1; + Result.ColR := 1; + Result.ColG := 1; + Result.ColB := 1; + Result.Alpha := 1; + + // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these + Result.TexX1 := 0; + Result.TexY1 := 0; + Result.TexX2 := 1; + Result.TexY2 := 1; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-6'); + {$endif} + + + // 0.5.0 + Result.Name := Identifier; + + SDL_FreeSurface(TexSurface); + + {$ifdef blindydebug} + Log.LogStatus('',' JB-7'); + {$endif} + + + Log.BenchmarkEnd(4); + if Log.BenchmarkTimeLength[4] >= 1 then + Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4); + + {$ifdef blindydebug} + Log.LogStatus('',' JB-8'); + {$endif} + +end; + + +function TTextureUnit.GetTexture(Name, Typ: string): TTexture; +begin + Result := GetTexture(Name, Typ, true); +end; + +function TTextureUnit.GetTexture(Name, Typ: string; FromCache: boolean): TTexture; +var + T: integer; // texture + C: integer; // cover + Data: array of byte; +begin + + if Name = '' then + exit; + + // find texture entry + T := FindTexture(Name); + + if T = -1 then + begin + // create texture entry + T := Length(TextureDatabase.Texture); + SetLength(TextureDatabase.Texture, T+1); + + TextureDatabase.Texture[T].Name := Name; + TextureDatabase.Texture[T].Typ := Typ; + + // inform database that no textures have been loaded into memory + TextureDatabase.Texture[T].Texture.TexNum := -1; + TextureDatabase.Texture[T].TextureCache.TexNum := -1; + end; + + // use preloaded texture + if (not FromCache) or (FromCache and not Covers.CoverExists(Name)) then + begin + // use full texture + if TextureDatabase.Texture[T].Texture.TexNum = -1 then + begin + // load texture + {$ifdef blindydebug} + Log.LogStatus('...', 'GetTexture('''+Name+''','''+Typ+''')'); + {$endif} + TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', pchar(Typ), $0); + {$ifdef blindydebug} + Log.LogStatus('done',' '); + {$endif} + end; + + // use texture + Result := TextureDatabase.Texture[T].Texture; + end; + + if FromCache and Covers.CoverExists(Name) then + begin + // use cache texture + C := Covers.CoverNumber(Name); + + if TextureDatabase.Texture[T].TextureCache.TexNum = -1 then + begin + // load texture + Covers.PrepareData(Name); + TextureDatabase.Texture[T].TextureCache := CreateTexture(Covers.Data, Name, Covers.Cover[C].W, Covers.Cover[C].H, 24); + end; + + // use texture + Result := TextureDatabase.Texture[T].TextureCache; + end; +end; + +function TTextureUnit.FindTexture(Name: string): integer; +var + T: integer; // texture +begin + Result := -1; + for T := 0 to high(TextureDatabase.Texture) do + if TextureDatabase.Texture[T].Name = Name then + Result := T; +end; + +function TTextureUnit.LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; +begin + Result := LoadTexture(false, Identifier, Format, Typ, Col); +end; + +function TTextureUnit.LoadTexture(Identifier: string): TTexture; +begin + Result := LoadTexture(false, pchar(Identifier), 'JPG', 'Plain', 0); +end; + +function TTextureUnit.CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; +var + Position: integer; + Position2: integer; + Pix: integer; + ColInt: real; + PPix: PByteArray; + TempA: integer; + Error: integer; +begin + Mipmapping := false; + + glGenTextures(1, @ActTex); // ActText = new texture number + glBindTexture(GL_TEXTURE_2D, ActTex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + glTexImage2D(GL_TEXTURE_2D, 0, 3, W, H, 0, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, W, H, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); + if Error > 0 then beep; + end; + + Result.X := 0; + Result.Y := 0; + Result.W := 0; + Result.H := 0; + Result.ScaleW := 1; + Result.ScaleH := 1; + Result.Rot := 0; + Result.TexNum := ActTex; + Result.TexW := 1; + Result.TexH := 1; + + Result.Int := 1; + Result.ColR := 1; + Result.ColG := 1; + Result.ColB := 1; + Result.Alpha := 1; + + // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these + Result.TexX1 := 0; + Result.TexY1 := 0; + Result.TexX2 := 1; + Result.TexY2 := 1; + + // 0.5.0 + Result.Name := Name; +end; + +procedure TTextureUnit.UnloadTexture(Name: string; FromCache: boolean); +var + T: integer; + TexNum: GLuint; +begin + T := FindTexture(Name); + + if not FromCache then begin + TexNum := TextureDatabase.Texture[T].Texture.TexNum; + if TexNum >= 0 then begin + glDeleteTextures(1, @TexNum); + TextureDatabase.Texture[T].Texture.TexNum := -1; +// Log.LogError('Unload texture no '+IntToStr(TexNum)); + end; + end else begin + TexNum := TextureDatabase.Texture[T].TextureCache.TexNum; + if TexNum >= 0 then begin + glDeleteTextures(1, @TexNum); + TextureDatabase.Texture[T].TextureCache.TexNum := -1; +// Log.LogError('Unload texture cache no '+IntToStr(TexNum)); + end; + end; +end; + +{$IFDEF LAZARUS} +initialization + {$I UltraStar.lrs} +{$ENDIF} + + +end. diff --git a/Game/Code/Classes/uPluginLoader.pas b/Game/Code/Classes/uPluginLoader.pas index 0fe5d51a..87951fed 100644 --- a/Game/Code/Classes/uPluginLoader.pas +++ b/Game/Code/Classes/uPluginLoader.pas @@ -1,801 +1,801 @@ -unit UPluginLoader; -{********************* - UPluginLoader - Unit contains to Classes - TPluginLoader: Class Searching for and Loading the Plugins - TtehPlugins: Class that represents the Plugins in Modules chain -*********************} - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses UPluginDefs, UCoreModule; - -type - TPluginListItem = record - Info: TUS_PluginInfo; - State: Byte; //State of this Plugin: 0 - undefined; 1 - Loaded; 2 - Inited / Running; 4 - Unloaded; 254 - Loading aborted by Plugin; 255 - Unloaded because of Error - Path: String; //Path to this Plugin - NeedsDeInit: Boolean; //If this is Inited correctly this should be true - hLib: THandle; //Handle of Loaded Libary - Procs: record //Procs offered by Plugin. Don't call this directly use wrappers of TPluginLoader - Load: Func_Load; - Init: Func_Init; - DeInit: Proc_DeInit; - end; - end; - {********************* - TPluginLoader - Class Searches for Plugins and Manages loading and unloading - *********************} - PPluginLoader = ^TPluginLoader; - TPluginLoader = class (TCoreModule) - private - LoadingProcessFinished: Boolean; - sUnloadPlugin: THandle; - sLoadPlugin: THandle; - sGetPluginInfo: THandle; - sGetPluginState: THandle; - - Procedure FreePlugin(Index: Cardinal); - public - PluginInterface: TUS_PluginInterface; - Plugins: Array of TPluginListItem; - - //TCoreModule methods to inherit - Constructor Create; override; - Procedure Info(const pInfo: PModuleInfo); override; - Function Load: Boolean; override; - Function Init: Boolean; override; - Procedure DeInit; override; - Procedure Free; override; - - //New Methods - Procedure BrowseDir(Path: String); //Browses the Path at _Path_ for Plugins - Function PluginExists(Name: String): Integer; //If Plugin Exists: Index of Plugin, else -1 - Procedure AddPlugin(Filename: String);//Adds Plugin to the Array - - Function CallLoad(Index: Cardinal): Integer; - Function CallInit(Index: Cardinal): Integer; - Procedure CallDeInit(Index: Cardinal); - - //Services offered - Function LoadPlugin(wParam, lParam: DWord): integer; //wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin - Function UnloadPlugin(wParam, lParam: DWord): integer; //wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin - Function GetPluginInfo(wParam, lParam: DWord): integer; //If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Get PluginInfo of Plugin with Index(wParam) to Address at lParam) - Function GetPluginState(wParam, lParam: DWord): integer; //If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Return PluginInfo of Plugin with Index(wParam)) - - end; - - {********************* - TtehPlugins - Class Represents the Plugins in Module Chain. - It Calls the Plugins Procs and Funcs - *********************} - TtehPlugins = class (TCoreModule) - private - PluginLoader: PPluginLoader; - public - //TCoreModule methods to inherit - Constructor Create; override; - - Procedure Info(const pInfo: PModuleInfo); override; - Function Load: Boolean; override; - Function Init: Boolean; override; - Procedure DeInit; override; - end; - -const - {$IFDEF MSWINDOWS} - PluginFileExtension = '.dll'; - {$ENDIF} - {$IFDEF LINUX} - PluginFileExtension = '.so'; - {$ENDIF} - {$IFDEF DARWIN} - PluginFileExtension = '.dylib'; - {$ENDIF} - -implementation -uses UCore, UPluginInterface, -{$IFDEF MSWINDOWS} - windows, -{$ELSE} - dynlibs, -{$ENDIF} -UMain, SysUtils; - -{********************* - TPluginLoader - Implentation -*********************} - -//------------- -// Function that gives some Infos about the Module to the Core -//------------- -Procedure TPluginLoader.Info(const pInfo: PModuleInfo); -begin - pInfo^.Name := 'TPluginLoader'; - pInfo^.Version := MakeVersion(1,0,0,chr(0)); - pInfo^.Description := 'Searches for Plugins, loads and unloads them'; -end; - -//------------- -// Just the Constructor -//------------- -Constructor TPluginLoader.Create; -begin - //Init PluginInterface - //Using Methods from UPluginInterface - PluginInterface.CreateHookableEvent := CreateHookableEvent; - PluginInterface.DestroyHookableEvent := DestroyHookableEvent; - PluginInterface.NotivyEventHooks := NotivyEventHooks; - PluginInterface.HookEvent := HookEvent; - PluginInterface.UnHookEvent := UnHookEvent; - PluginInterface.EventExists := EventExists; - - PluginInterface.CreateService := CreateService; - PluginInterface.DestroyService := DestroyService; - PluginInterface.CallService := CallService; - PluginInterface.ServiceExists := ServiceExists; - - //UnSet Private Var - LoadingProcessFinished := False; -end; - -//------------- -//Is Called on Loading. -//In this Method only Events and Services should be created -//to offer them to other Modules or Plugins during the Init process -//If False is Returned this will cause a Forced Exit -//------------- -Function TPluginLoader.Load: Boolean; -begin - Result := True; - - Try - //Start Searching for Plugins - BrowseDir(PluginPath); - Except - Result := False; - Core.ReportError(Integer(PChar('Error Browsing and Loading.')), Integer(PChar('TPluginLoader'))); - end; -end; - -//------------- -//Is Called on Init Process -//In this Method you can Hook some Events and Create + Init -//your Classes, Variables etc. -//If False is Returned this will cause a Forced Exit -//------------- -Function TPluginLoader.Init: Boolean; -begin - //Just set Prvate Var to true. - LoadingProcessFinished := True; - Result := True; -end; - -//------------- -//Is Called if this Module has been Inited and there is a Exit. -//Deinit is in backwards Initing Order -//------------- -Procedure TPluginLoader.DeInit; -var - I: Integer; -begin - //Force DeInit - //If some Plugins aren't DeInited for some Reason o0 - For I := 0 to High(Plugins) do - begin - If (Plugins[I].State < 4) then - FreePlugin(I); - end; - - //Nothing to do here. Core will remove the Hooks -end; - -//------------- -//Is Called if this Module will be unloaded and has been created -//Should be used to Free Memory -//------------- -Procedure TPluginLoader.Free; -begin - //Just save some Memory if it wasn't done now.. - SetLength(Plugins, 0); -end; - -//-------------- -// Browses the Path at _Path_ for Plugins -//-------------- -Procedure TPluginLoader.BrowseDir(Path: String); -var - SR: TSearchRec; -begin - //Search for other Dirs to Browse - if FindFirst(Path + '*', faDirectory, SR) = 0 then begin - repeat - if (SR.Name <> '.') and (SR.Name <> '..') then - BrowseDir(Path + Sr.Name + PathDelim); - until FindNext(SR) <> 0; - end; - FindClose(SR); - - //Search for Plugins at Path - if FindFirst(Path + '*' + PluginFileExtension, 0, SR) = 0 then - begin - repeat - AddPlugin(Path + SR.Name); - until FindNext(SR) <> 0; - end; - FindClose(SR); -end; - -//-------------- -// If Plugin Exists: Index of Plugin, else -1 -//-------------- -Function TPluginLoader.PluginExists(Name: String): Integer; -var - I: Integer; -begin - Result := -1; - - If (Length(Name) <= 32 { =>Length(TUS_PluginInfo.Name)}) then - begin - For I := 0 to High(Plugins) do - if (Plugins[I].Info.Name = Name) then - begin //Found the Plugin - Result := I; - Break; - end; - end; -end; - -//-------------- -// Adds Plugin to the Array -//-------------- -Procedure TPluginLoader.AddPlugin(Filename: String); -var - hLib: THandle; - PInfo: Proc_PluginInfo; - Info: TUS_PluginInfo; - PluginID: Integer; -begin - If (FileExists(Filename)) then - begin //Load Libary - hLib := LoadLibrary(PChar(Filename)); - If (hLib <> 0) then - begin //Try to get Address of the Info Proc - PInfo := GetProcAddress (hLib, PChar('USPlugin_Info')); - If (@PInfo <> nil) then - begin - Info.cbSize := SizeOf(TUS_PluginInfo); - - Try //Call Info Proc - PInfo(@Info); - Except - Info.Name := ''; - Core.ReportError(Integer(PChar('Error getting Plugin Info: ' + Filename)), Integer(PChar('TPluginLoader'))); - end; - - //Is Name set ? - If (Trim(Info.Name) <> '') then - begin - PluginID := PluginExists(Info.Name); - - If (PluginID > 0) AND (Plugins[PluginID].State >=4) then - PluginID := -1; - - If (PluginID = -1) then - begin - //Add new item to array - PluginID := Length(Plugins); - SetLength(Plugins, PluginID + 1); - - //Fill with Info: - Plugins[PluginID].Info := Info; - Plugins[PluginID].State := 0; - Plugins[PluginID].Path := Filename; - Plugins[PluginID].NeedsDeInit := False; - Plugins[PluginID].hLib := hLib; - - //Try to get Procs - Plugins[PluginID].Procs.Load := GetProcAddress (hLib, PChar('USPlugin_Load')); - Plugins[PluginID].Procs.Init := GetProcAddress (hLib, PChar('USPlugin_Init')); - Plugins[PluginID].Procs.DeInit := GetProcAddress (hLib, PChar('USPlugin_DeInit')); - - If (@Plugins[PluginID].Procs.Load = nil) OR (@Plugins[PluginID].Procs.Init = nil) OR (@Plugins[PluginID].Procs.DeInit = nil) then - begin - Plugins[PluginID].State := 255; - FreeLibrary(hLib); - Core.ReportError(Integer(PChar('Can''t get Plugin Procs from Libary: "' + Info.Name + '" ' + Filename)), Integer(PChar('TPluginLoader'))); - end; - - //Emulate loading process if this Plugin is loaded to late - If (LoadingProcessFinished) then - begin - CallLoad(PluginID); - CallInit(PluginID); - end; - end - Else If (LoadingProcessFinished = False) then - begin - If (Plugins[PluginID].Info.Version < Info.Version) then - begin //Found newer Version of this Plugin - Core.ReportDebug(Integer(PChar('Found a newer Version of Plugin: ' + String(Info.Name))), Integer(PChar('TPluginLoader'))); - - //Unload Old Plugin - UnloadPlugin(Integer(nil), PluginID); - - //Fill with new Info - Plugins[PluginID].Info := Info; - Plugins[PluginID].State := 0; - Plugins[PluginID].Path := Filename; - Plugins[PluginID].NeedsDeInit := False; - Plugins[PluginID].hLib := hLib; - - //Try to get Procs - Plugins[PluginID].Procs.Load := GetProcAddress (hLib, PChar('USPlugin_Load')); - Plugins[PluginID].Procs.Init := GetProcAddress (hLib, PChar('USPlugin_Init')); - Plugins[PluginID].Procs.DeInit := GetProcAddress (hLib, PChar('USPlugin_DeInit')); - - If (@Plugins[PluginID].Procs.Load = nil) OR (@Plugins[PluginID].Procs.Init = nil) OR (@Plugins[PluginID].Procs.DeInit = nil) then - begin - FreeLibrary(hLib); - Plugins[PluginID].State := 255; - Core.ReportError(Integer(PChar('Can''t get Plugin Procs from Libary: "' + Info.Name + '" ' + Filename)), Integer(PChar('TPluginLoader'))); - end; - end - else - begin //Newer Version already loaded - FreeLibrary(hLib); - end; - end - else - begin - FreeLibrary(hLib); - Core.ReportError(Integer(PChar('Plugin with this Name already exists: ' + String(Info.Name))), Integer(PChar('TPluginLoader'))); - end; - end - else - begin - FreeLibrary(hLib); - Core.ReportError(Integer(PChar('No name reported: ' + Filename)), Integer(PChar('TPluginLoader'))); - end; - end - else - begin - FreeLibrary(hLib); - Core.ReportError(Integer(PChar('Can''t find Info Procedure: ' + Filename)), Integer(PChar('TPluginLoader'))); - end; - end - else - Core.ReportError(Integer(PChar('Can''t load Plugin Libary: ' + Filename)), Integer(PChar('TPluginLoader'))); - end; -end; - -//-------------- -// Calls Load Func of Plugin with the given Index -//-------------- -Function TPluginLoader.CallLoad(Index: Cardinal): Integer; -begin - Result := -2; - If(Index < Length(Plugins)) then - begin - If (@Plugins[Index].Procs.Load <> nil) AND (Plugins[Index].State = 0) then - begin - Try - Result := Plugins[Index].Procs.Load(@PluginInterface); - Except - Result := -3; - End; - - If (Result = 0) then - Plugins[Index].State := 1 - Else - begin - FreePlugin(Index); - Plugins[Index].State := 255; - Core.ReportError(Integer(PChar('Error calling Load Function from Plugin: ' + String(Plugins[Index].Info.Name))), Integer(PChar('TPluginLoader'))); - end; - end; - end; -end; - -//-------------- -// Calls Init Func of Plugin with the given Index -//-------------- -Function TPluginLoader.CallInit(Index: Cardinal): Integer; -begin - Result := -2; - If(Index < Length(Plugins)) then - begin - If (@Plugins[Index].Procs.Init <> nil) AND (Plugins[Index].State = 1) then - begin - Try - Result := Plugins[Index].Procs.Init(@PluginInterface); - Except - Result := -3; - End; - - If (Result = 0) then - begin - Plugins[Index].State := 2; - Plugins[Index].NeedsDeInit := True; - end - Else - begin - FreePlugin(Index); - Plugins[Index].State := 255; - Core.ReportError(Integer(PChar('Error calling Init Function from Plugin: ' + String(Plugins[Index].Info.Name))), Integer(PChar('TPluginLoader'))); - end; - end; - end; -end; - -//-------------- -// Calls DeInit Proc of Plugin with the given Index -//-------------- -Procedure TPluginLoader.CallDeInit(Index: Cardinal); -begin - If(Index < Length(Plugins)) then - begin - If (Plugins[Index].State < 4) then - begin - If (@Plugins[Index].Procs.DeInit <> nil) and (Plugins[Index].NeedsDeInit) then - Try - Plugins[Index].Procs.DeInit(@PluginInterface); - Except - - End; - - //Don't forget to remove Services and Subscriptions by this Plugin - Core.Hooks.DelbyOwner(-1 - Index); - - FreePlugin(Index); - end; - end; -end; - -//-------------- -// Frees all Plugin Sources (Procs and Handles) - Helper for Deiniting Functions -//-------------- -Procedure TPluginLoader.FreePlugin(Index: Cardinal); -begin - Plugins[Index].State := 4; - Plugins[Index].Procs.Load := nil; - Plugins[Index].Procs.Init := nil; - Plugins[Index].Procs.DeInit := nil; - - If (Plugins[Index].hLib <> 0) then - FreeLibrary(Plugins[Index].hLib); -end; - - - -//-------------- -// wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin -//-------------- -Function TPluginLoader.LoadPlugin(wParam, lParam: DWord): integer; -var - Index: Integer; - sFile: String; -begin - Result := -1; - sFile := ''; - //lParam is ID - If (Pointer(wParam) = nil) then - begin - Index := lParam; - end - else - begin //wParam is PChar - try - sFile := String(PChar(Pointer(wParam))); - Index := PluginExists(sFile); - If (Index < 0) And FileExists(sFile) then - begin //Is Filename - AddPlugin(sFile); - Result := Plugins[High(Plugins)].State; - end; - except - Index := -2; - end; - end; - - - If (Index >= 0) and (Index < Length(Plugins)) then - begin - AddPlugin(Plugins[Index].Path); - Result := Plugins[Index].State; - end; -end; - -//-------------- -// wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin -//-------------- -Function TPluginLoader.UnloadPlugin(wParam, lParam: DWord): integer; -var - Index: Integer; - sName: String; -begin - Result := -1; - //lParam is ID - If (Pointer(wParam) = nil) then - begin - Index := lParam; - end - else - begin //wParam is PChar - try - sName := String(PChar(Pointer(wParam))); - Index := PluginExists(sName); - except - Index := -2; - end; - end; - - - If (Index >= 0) and (Index < Length(Plugins)) then - CallDeInit(Index) -end; - -//-------------- -// If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Get PluginInfo of Plugin with Index(wParam) to Address at lParam) -//-------------- -Function TPluginLoader.GetPluginInfo(wParam, lParam: DWord): integer; -var I: Integer; -begin - Result := 0; - If (wParam < 0) then - begin //Get Info of 1 Plugin - If (Pointer(lParam) <> nil) AND (wParam < Length(Plugins)) then - begin - Try - Result := 1; - PUS_PluginInfo(Pointer(lParam))^ := Plugins[wParam].Info; - Except - - End; - end; - end - Else If (Pointer(lParam) = nil) then - begin //Get Length of Plugin (Info) Array - Result := Length(Plugins); - end - Else //Write PluginInfo Array to Address in lParam - begin - Try - For I := 0 to high(Plugins) do - PAUS_PluginInfo(Pointer(lParam))^[I] := Plugins[I].Info; - Result := Length(Plugins); - Except - Core.ReportError(Integer(PChar('Could not write PluginInfo Array')), Integer(PChar('TPluginLoader'))); - End; - end; - -end; - -//-------------- -// If wParam = -1 then (If lParam = nil then get length of Plugin State Array. If lparam <> nil then write array of Byte to address at lparam) Else (Return State of Plugin with Index(wParam)) -//-------------- -Function TPluginLoader.GetPluginState(wParam, lParam: DWord): integer; -var I: Integer; -begin - Result := -1; - If (wParam < 0) then - begin //Get State of 1 Plugin - If (wParam < Length(Plugins)) then - begin - Result := Plugins[wParam].State; - end; - end - Else If (Pointer(lParam) = nil) then - begin //Get Length of Plugin (Info) Array - Result := Length(Plugins); - end - Else //Write PluginInfo Array to Address in lParam - begin - Try - For I := 0 to high(Plugins) do - Byte(Pointer(lParam + I)^) := Plugins[I].State; - Result := Length(Plugins); - Except - Core.ReportError(Integer(PChar('Could not write PluginState Array')), Integer(PChar('TPluginLoader'))); - End; - end; -end; - - - - - -{********************* - TtehPlugins - Implentation -*********************} - -//------------- -// Function that gives some Infos about the Module to the Core -//------------- -Procedure TtehPlugins.Info(const pInfo: PModuleInfo); -begin - pInfo^.Name := 'TtehPlugins'; - pInfo^.Version := MakeVersion(1,0,0,chr(0)); - pInfo^.Description := 'Module executing the Plugins!'; -end; - -//------------- -// Just the Constructor -//------------- -Constructor TtehPlugins.Create; -begin - PluginLoader := nil; -end; - -//------------- -//Is Called on Loading. -//In this Method only Events and Services should be created -//to offer them to other Modules or Plugins during the Init process -//If False is Returned this will cause a Forced Exit -//------------- -Function TtehPlugins.Load: Boolean; -var - I: Integer; //Counter - CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute -label Continue; -begin - //Get Pointer to PluginLoader - PluginLoader := PPluginLoader(Core.GetModulebyName('TPluginLoader')); - If (PluginLoader = nil) then - begin - Result := False; - Core.ReportError(Integer(PChar('Could not get Pointer to PluginLoader')), Integer(PChar('TtehPlugins'))); - end - else - begin - Result := True; - - //Backup CurExecuted - CurExecutedBackup := Core.CurExecuted; - - //Start Loading the Plugins - I := 0; - Continue: - Try - While (I <= High(PluginLoader.Plugins)) do - begin - Core.CurExecuted := -1 - I; - - //Unload Plugin if not correctly Executed - If (PluginLoader.CallLoad(I) <> 0) then - begin - PluginLoader.CallDeInit(I); - PluginLoader.Plugins[I].State := 254; //Plugin asks for unload - Core.ReportDebug(Integer(PChar('Plugin Selfabort during loading process: ' + String(PluginLoader.Plugins[I].Info.Name))), Integer(PChar('TtehPlugins'))); - end - else - Core.ReportDebug(Integer(PChar('Plugin loaded succesful: ' + String(PluginLoader.Plugins[I].Info.Name))), Integer(PChar('TtehPlugins'))); - - Inc(I); - end; - Except - //Plugin could not be loaded. - // => Show Error Message, then ShutDown Plugin - on E: Exception do - begin - PluginLoader.CallDeInit(I); - PluginLoader.Plugins[I].State := 255; //Plugin causes Error - Core.ReportError(Integer(PChar('Plugin causes Error during loading process: ' + PluginLoader.Plugins[I].Info.Name + ', ErrorMsg: "' + E.Message + '"')), Integer(PChar('TtehPlugins'))); - - - //don't forget to increase I - Inc(I); - end; - End; - - If (I <= High(PluginLoader.Plugins)) then - Goto Continue; - - //Reset CurExecuted - Core.CurExecuted := CurExecutedBackup; - end; -end; - -//------------- -//Is Called on Init Process -//In this Method you can Hook some Events and Create + Init -//your Classes, Variables etc. -//If False is Returned this will cause a Forced Exit -//------------- -Function TtehPlugins.Init: Boolean; -var - I: Integer; //Counter - CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute -label Continue; -begin - Result := True; - - //Backup CurExecuted - CurExecutedBackup := Core.CurExecuted; - - //Start Loading the Plugins - I := 0; - Continue: - Try - While (I <= High(PluginLoader.Plugins)) do - begin - Core.CurExecuted := -1 - I; - - //Unload Plugin if not correctly Executed - If (PluginLoader.CallInit(I) <> 0) then - begin - PluginLoader.CallDeInit(I); - PluginLoader.Plugins[I].State := 254; //Plugin asks for unload - Core.ReportDebug(Integer(PChar('Plugin Selfabort during init process: ' + String(PluginLoader.Plugins[I].Info.Name))), Integer(PChar('TtehPlugins'))); - end - else - Core.ReportDebug(Integer(PChar('Plugin inited succesful: ' + String(PluginLoader.Plugins[I].Info.Name))), Integer(PChar('TtehPlugins'))); - - //don't forget to increase I - Inc(I); - end; - Except - //Plugin could not be loaded. - // => Show Error Message, then ShutDown Plugin - PluginLoader.CallDeInit(I); - PluginLoader.Plugins[I].State := 255; //Plugin causes Error - Core.ReportError(Integer(PChar('Plugin causes Error during init process: ' + String(PluginLoader.Plugins[I].Info.Name))), Integer(PChar('TtehPlugins'))); - - //don't forget to increase I - Inc(I); - End; - - If (I <= High(PluginLoader.Plugins)) then - GoTo Continue; - - //Reset CurExecuted - Core.CurExecuted := CurExecutedBackup; -end; - -//------------- -//Is Called if this Module has been Inited and there is a Exit. -//Deinit is in backwards Initing Order -//------------- -Procedure TtehPlugins.DeInit; -var - I: Integer; //Counter - CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute -label Continue; -begin - //Backup CurExecuted - CurExecutedBackup := Core.CurExecuted; - - //Start Loop - I := 0; - - Continue: - Try - While (I <= High(PluginLoader.Plugins)) do - begin - //DeInit Plugin - PluginLoader.CallDeInit(I); - - Inc(I); - end; - Except - Inc(I); - End; - - If I <= High(PluginLoader.Plugins) then - Goto Continue; - - //Reset CurExecuted - Core.CurExecuted := CurExecutedBackup; -end; - -end. +unit UPluginLoader; +{********************* + UPluginLoader + Unit contains to Classes + TPluginLoader: Class Searching for and Loading the Plugins + TtehPlugins: Class that represents the Plugins in Modules chain +*********************} + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses UPluginDefs, UCoreModule; + +type + TPluginListItem = record + Info: TUS_PluginInfo; + State: Byte; //State of this Plugin: 0 - undefined; 1 - Loaded; 2 - Inited / Running; 4 - Unloaded; 254 - Loading aborted by Plugin; 255 - Unloaded because of Error + Path: String; //Path to this Plugin + NeedsDeInit: Boolean; //If this is Inited correctly this should be true + hLib: THandle; //Handle of Loaded Libary + Procs: record //Procs offered by Plugin. Don't call this directly use wrappers of TPluginLoader + Load: Func_Load; + Init: Func_Init; + DeInit: Proc_DeInit; + end; + end; + {********************* + TPluginLoader + Class Searches for Plugins and Manages loading and unloading + *********************} + PPluginLoader = ^TPluginLoader; + TPluginLoader = class (TCoreModule) + private + LoadingProcessFinished: Boolean; + sUnloadPlugin: THandle; + sLoadPlugin: THandle; + sGetPluginInfo: THandle; + sGetPluginState: THandle; + + Procedure FreePlugin(Index: Cardinal); + public + PluginInterface: TUS_PluginInterface; + Plugins: Array of TPluginListItem; + + //TCoreModule methods to inherit + Constructor Create; override; + Procedure Info(const pInfo: PModuleInfo); override; + Function Load: Boolean; override; + Function Init: Boolean; override; + Procedure DeInit; override; + Procedure Free; override; + + //New Methods + Procedure BrowseDir(Path: String); //Browses the Path at _Path_ for Plugins + Function PluginExists(Name: String): Integer; //If Plugin Exists: Index of Plugin, else -1 + Procedure AddPlugin(Filename: String);//Adds Plugin to the Array + + Function CallLoad(Index: Cardinal): Integer; + Function CallInit(Index: Cardinal): Integer; + Procedure CallDeInit(Index: Cardinal); + + //Services offered + Function LoadPlugin(wParam, lParam: DWord): integer; //wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin + Function UnloadPlugin(wParam, lParam: DWord): integer; //wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin + Function GetPluginInfo(wParam, lParam: DWord): integer; //If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Get PluginInfo of Plugin with Index(wParam) to Address at lParam) + Function GetPluginState(wParam, lParam: DWord): integer; //If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Return PluginInfo of Plugin with Index(wParam)) + + end; + + {********************* + TtehPlugins + Class Represents the Plugins in Module Chain. + It Calls the Plugins Procs and Funcs + *********************} + TtehPlugins = class (TCoreModule) + private + PluginLoader: PPluginLoader; + public + //TCoreModule methods to inherit + Constructor Create; override; + + Procedure Info(const pInfo: PModuleInfo); override; + Function Load: Boolean; override; + Function Init: Boolean; override; + Procedure DeInit; override; + end; + +const + {$IFDEF MSWINDOWS} + PluginFileExtension = '.dll'; + {$ENDIF} + {$IFDEF LINUX} + PluginFileExtension = '.so'; + {$ENDIF} + {$IFDEF DARWIN} + PluginFileExtension = '.dylib'; + {$ENDIF} + +implementation +uses UCore, UPluginInterface, +{$IFDEF MSWINDOWS} + windows, +{$ELSE} + dynlibs, +{$ENDIF} +UMain, SysUtils; + +{********************* + TPluginLoader + Implentation +*********************} + +//------------- +// Function that gives some Infos about the Module to the Core +//------------- +Procedure TPluginLoader.Info(const pInfo: PModuleInfo); +begin + pInfo^.Name := 'TPluginLoader'; + pInfo^.Version := MakeVersion(1,0,0,chr(0)); + pInfo^.Description := 'Searches for Plugins, loads and unloads them'; +end; + +//------------- +// Just the Constructor +//------------- +Constructor TPluginLoader.Create; +begin + //Init PluginInterface + //Using Methods from UPluginInterface + PluginInterface.CreateHookableEvent := CreateHookableEvent; + PluginInterface.DestroyHookableEvent := DestroyHookableEvent; + PluginInterface.NotivyEventHooks := NotivyEventHooks; + PluginInterface.HookEvent := HookEvent; + PluginInterface.UnHookEvent := UnHookEvent; + PluginInterface.EventExists := EventExists; + + PluginInterface.CreateService := @CreateService; + PluginInterface.DestroyService := DestroyService; + PluginInterface.CallService := CallService; + PluginInterface.ServiceExists := ServiceExists; + + //UnSet Private Var + LoadingProcessFinished := False; +end; + +//------------- +//Is Called on Loading. +//In this Method only Events and Services should be created +//to offer them to other Modules or Plugins during the Init process +//If False is Returned this will cause a Forced Exit +//------------- +Function TPluginLoader.Load: Boolean; +begin + Result := True; + + Try + //Start Searching for Plugins + BrowseDir(PluginPath); + Except + Result := False; + Core.ReportError(Integer(PChar('Error Browsing and Loading.')), Integer(PChar('TPluginLoader'))); + end; +end; + +//------------- +//Is Called on Init Process +//In this Method you can Hook some Events and Create + Init +//your Classes, Variables etc. +//If False is Returned this will cause a Forced Exit +//------------- +Function TPluginLoader.Init: Boolean; +begin + //Just set Prvate Var to true. + LoadingProcessFinished := True; + Result := True; +end; + +//------------- +//Is Called if this Module has been Inited and there is a Exit. +//Deinit is in backwards Initing Order +//------------- +Procedure TPluginLoader.DeInit; +var + I: Integer; +begin + //Force DeInit + //If some Plugins aren't DeInited for some Reason o0 + For I := 0 to High(Plugins) do + begin + If (Plugins[I].State < 4) then + FreePlugin(I); + end; + + //Nothing to do here. Core will remove the Hooks +end; + +//------------- +//Is Called if this Module will be unloaded and has been created +//Should be used to Free Memory +//------------- +Procedure TPluginLoader.Free; +begin + //Just save some Memory if it wasn't done now.. + SetLength(Plugins, 0); +end; + +//-------------- +// Browses the Path at _Path_ for Plugins +//-------------- +Procedure TPluginLoader.BrowseDir(Path: String); +var + SR: TSearchRec; +begin + //Search for other Dirs to Browse + if FindFirst(Path + '*', faDirectory, SR) = 0 then begin + repeat + if (SR.Name <> '.') and (SR.Name <> '..') then + BrowseDir(Path + Sr.Name + PathDelim); + until FindNext(SR) <> 0; + end; + FindClose(SR); + + //Search for Plugins at Path + if FindFirst(Path + '*' + PluginFileExtension, 0, SR) = 0 then + begin + repeat + AddPlugin(Path + SR.Name); + until FindNext(SR) <> 0; + end; + FindClose(SR); +end; + +//-------------- +// If Plugin Exists: Index of Plugin, else -1 +//-------------- +Function TPluginLoader.PluginExists(Name: String): Integer; +var + I: Integer; +begin + Result := -1; + + If (Length(Name) <= 32 { =>Length(TUS_PluginInfo.Name)}) then + begin + For I := 0 to High(Plugins) do + if (Plugins[I].Info.Name = Name) then + begin //Found the Plugin + Result := I; + Break; + end; + end; +end; + +//-------------- +// Adds Plugin to the Array +//-------------- +Procedure TPluginLoader.AddPlugin(Filename: String); +var + hLib: THandle; + PInfo: Proc_PluginInfo; + Info: TUS_PluginInfo; + PluginID: Integer; +begin + If (FileExists(Filename)) then + begin //Load Libary + hLib := LoadLibrary(PChar(Filename)); + If (hLib <> 0) then + begin //Try to get Address of the Info Proc + PInfo := GetProcAddress (hLib, PChar('USPlugin_Info')); + If (@PInfo <> nil) then + begin + Info.cbSize := SizeOf(TUS_PluginInfo); + + Try //Call Info Proc + PInfo(@Info); + Except + Info.Name := ''; + Core.ReportError(Integer(PChar('Error getting Plugin Info: ' + Filename)), Integer(PChar('TPluginLoader'))); + end; + + //Is Name set ? + If (Trim(Info.Name) <> '') then + begin + PluginID := PluginExists(Info.Name); + + If (PluginID > 0) AND (Plugins[PluginID].State >=4) then + PluginID := -1; + + If (PluginID = -1) then + begin + //Add new item to array + PluginID := Length(Plugins); + SetLength(Plugins, PluginID + 1); + + //Fill with Info: + Plugins[PluginID].Info := Info; + Plugins[PluginID].State := 0; + Plugins[PluginID].Path := Filename; + Plugins[PluginID].NeedsDeInit := False; + Plugins[PluginID].hLib := hLib; + + //Try to get Procs + Plugins[PluginID].Procs.Load := GetProcAddress (hLib, PChar('USPlugin_Load')); + Plugins[PluginID].Procs.Init := GetProcAddress (hLib, PChar('USPlugin_Init')); + Plugins[PluginID].Procs.DeInit := GetProcAddress (hLib, PChar('USPlugin_DeInit')); + + If (@Plugins[PluginID].Procs.Load = nil) OR (@Plugins[PluginID].Procs.Init = nil) OR (@Plugins[PluginID].Procs.DeInit = nil) then + begin + Plugins[PluginID].State := 255; + FreeLibrary(hLib); + Core.ReportError(Integer(PChar('Can''t get Plugin Procs from Libary: "' + Info.Name + '" ' + Filename)), Integer(PChar('TPluginLoader'))); + end; + + //Emulate loading process if this Plugin is loaded to late + If (LoadingProcessFinished) then + begin + CallLoad(PluginID); + CallInit(PluginID); + end; + end + Else If (LoadingProcessFinished = False) then + begin + If (Plugins[PluginID].Info.Version < Info.Version) then + begin //Found newer Version of this Plugin + Core.ReportDebug(Integer(PChar('Found a newer Version of Plugin: ' + String(Info.Name))), Integer(PChar('TPluginLoader'))); + + //Unload Old Plugin + UnloadPlugin(Integer(nil), PluginID); + + //Fill with new Info + Plugins[PluginID].Info := Info; + Plugins[PluginID].State := 0; + Plugins[PluginID].Path := Filename; + Plugins[PluginID].NeedsDeInit := False; + Plugins[PluginID].hLib := hLib; + + //Try to get Procs + Plugins[PluginID].Procs.Load := GetProcAddress (hLib, PChar('USPlugin_Load')); + Plugins[PluginID].Procs.Init := GetProcAddress (hLib, PChar('USPlugin_Init')); + Plugins[PluginID].Procs.DeInit := GetProcAddress (hLib, PChar('USPlugin_DeInit')); + + If (@Plugins[PluginID].Procs.Load = nil) OR (@Plugins[PluginID].Procs.Init = nil) OR (@Plugins[PluginID].Procs.DeInit = nil) then + begin + FreeLibrary(hLib); + Plugins[PluginID].State := 255; + Core.ReportError(Integer(PChar('Can''t get Plugin Procs from Libary: "' + Info.Name + '" ' + Filename)), Integer(PChar('TPluginLoader'))); + end; + end + else + begin //Newer Version already loaded + FreeLibrary(hLib); + end; + end + else + begin + FreeLibrary(hLib); + Core.ReportError(Integer(PChar('Plugin with this Name already exists: ' + String(Info.Name))), Integer(PChar('TPluginLoader'))); + end; + end + else + begin + FreeLibrary(hLib); + Core.ReportError(Integer(PChar('No name reported: ' + Filename)), Integer(PChar('TPluginLoader'))); + end; + end + else + begin + FreeLibrary(hLib); + Core.ReportError(Integer(PChar('Can''t find Info Procedure: ' + Filename)), Integer(PChar('TPluginLoader'))); + end; + end + else + Core.ReportError(Integer(PChar('Can''t load Plugin Libary: ' + Filename)), Integer(PChar('TPluginLoader'))); + end; +end; + +//-------------- +// Calls Load Func of Plugin with the given Index +//-------------- +Function TPluginLoader.CallLoad(Index: Cardinal): Integer; +begin + Result := -2; + If(Index < Length(Plugins)) then + begin + If (@Plugins[Index].Procs.Load <> nil) AND (Plugins[Index].State = 0) then + begin + Try + Result := Plugins[Index].Procs.Load(@PluginInterface); + Except + Result := -3; + End; + + If (Result = 0) then + Plugins[Index].State := 1 + Else + begin + FreePlugin(Index); + Plugins[Index].State := 255; + Core.ReportError(Integer(PChar('Error calling Load Function from Plugin: ' + String(Plugins[Index].Info.Name))), Integer(PChar('TPluginLoader'))); + end; + end; + end; +end; + +//-------------- +// Calls Init Func of Plugin with the given Index +//-------------- +Function TPluginLoader.CallInit(Index: Cardinal): Integer; +begin + Result := -2; + If(Index < Length(Plugins)) then + begin + If (@Plugins[Index].Procs.Init <> nil) AND (Plugins[Index].State = 1) then + begin + Try + Result := Plugins[Index].Procs.Init(@PluginInterface); + Except + Result := -3; + End; + + If (Result = 0) then + begin + Plugins[Index].State := 2; + Plugins[Index].NeedsDeInit := True; + end + Else + begin + FreePlugin(Index); + Plugins[Index].State := 255; + Core.ReportError(Integer(PChar('Error calling Init Function from Plugin: ' + String(Plugins[Index].Info.Name))), Integer(PChar('TPluginLoader'))); + end; + end; + end; +end; + +//-------------- +// Calls DeInit Proc of Plugin with the given Index +//-------------- +Procedure TPluginLoader.CallDeInit(Index: Cardinal); +begin + If(Index < Length(Plugins)) then + begin + If (Plugins[Index].State < 4) then + begin + If (@Plugins[Index].Procs.DeInit <> nil) and (Plugins[Index].NeedsDeInit) then + Try + Plugins[Index].Procs.DeInit(@PluginInterface); + Except + + End; + + //Don't forget to remove Services and Subscriptions by this Plugin + Core.Hooks.DelbyOwner(-1 - Index); + + FreePlugin(Index); + end; + end; +end; + +//-------------- +// Frees all Plugin Sources (Procs and Handles) - Helper for Deiniting Functions +//-------------- +Procedure TPluginLoader.FreePlugin(Index: Cardinal); +begin + Plugins[Index].State := 4; + Plugins[Index].Procs.Load := nil; + Plugins[Index].Procs.Init := nil; + Plugins[Index].Procs.DeInit := nil; + + If (Plugins[Index].hLib <> 0) then + FreeLibrary(Plugins[Index].hLib); +end; + + + +//-------------- +// wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin +//-------------- +Function TPluginLoader.LoadPlugin(wParam, lParam: DWord): integer; +var + Index: Integer; + sFile: String; +begin + Result := -1; + sFile := ''; + //lParam is ID + If (Pointer(wParam) = nil) then + begin + Index := lParam; + end + else + begin //wParam is PChar + try + sFile := String(PChar(Pointer(wParam))); + Index := PluginExists(sFile); + If (Index < 0) And FileExists(sFile) then + begin //Is Filename + AddPlugin(sFile); + Result := Plugins[High(Plugins)].State; + end; + except + Index := -2; + end; + end; + + + If (Index >= 0) and (Index < Length(Plugins)) then + begin + AddPlugin(Plugins[Index].Path); + Result := Plugins[Index].State; + end; +end; + +//-------------- +// wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin +//-------------- +Function TPluginLoader.UnloadPlugin(wParam, lParam: DWord): integer; +var + Index: Integer; + sName: String; +begin + Result := -1; + //lParam is ID + If (Pointer(wParam) = nil) then + begin + Index := lParam; + end + else + begin //wParam is PChar + try + sName := String(PChar(Pointer(wParam))); + Index := PluginExists(sName); + except + Index := -2; + end; + end; + + + If (Index >= 0) and (Index < Length(Plugins)) then + CallDeInit(Index) +end; + +//-------------- +// If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Get PluginInfo of Plugin with Index(wParam) to Address at lParam) +//-------------- +Function TPluginLoader.GetPluginInfo(wParam, lParam: DWord): integer; +var I: Integer; +begin + Result := 0; + If (wParam < 0) then + begin //Get Info of 1 Plugin + If (Pointer(lParam) <> nil) AND (wParam < Length(Plugins)) then + begin + Try + Result := 1; + PUS_PluginInfo(Pointer(lParam))^ := Plugins[wParam].Info; + Except + + End; + end; + end + Else If (Pointer(lParam) = nil) then + begin //Get Length of Plugin (Info) Array + Result := Length(Plugins); + end + Else //Write PluginInfo Array to Address in lParam + begin + Try + For I := 0 to high(Plugins) do + PAUS_PluginInfo(Pointer(lParam))^[I] := Plugins[I].Info; + Result := Length(Plugins); + Except + Core.ReportError(Integer(PChar('Could not write PluginInfo Array')), Integer(PChar('TPluginLoader'))); + End; + end; + +end; + +//-------------- +// If wParam = -1 then (If lParam = nil then get length of Plugin State Array. If lparam <> nil then write array of Byte to address at lparam) Else (Return State of Plugin with Index(wParam)) +//-------------- +Function TPluginLoader.GetPluginState(wParam, lParam: DWord): integer; +var I: Integer; +begin + Result := -1; + If (wParam < 0) then + begin //Get State of 1 Plugin + If (wParam < Length(Plugins)) then + begin + Result := Plugins[wParam].State; + end; + end + Else If (Pointer(lParam) = nil) then + begin //Get Length of Plugin (Info) Array + Result := Length(Plugins); + end + Else //Write PluginInfo Array to Address in lParam + begin + Try + For I := 0 to high(Plugins) do + Byte(Pointer(lParam + I)^) := Plugins[I].State; + Result := Length(Plugins); + Except + Core.ReportError(Integer(PChar('Could not write PluginState Array')), Integer(PChar('TPluginLoader'))); + End; + end; +end; + + + + + +{********************* + TtehPlugins + Implentation +*********************} + +//------------- +// Function that gives some Infos about the Module to the Core +//------------- +Procedure TtehPlugins.Info(const pInfo: PModuleInfo); +begin + pInfo^.Name := 'TtehPlugins'; + pInfo^.Version := MakeVersion(1,0,0,chr(0)); + pInfo^.Description := 'Module executing the Plugins!'; +end; + +//------------- +// Just the Constructor +//------------- +Constructor TtehPlugins.Create; +begin + PluginLoader := nil; +end; + +//------------- +//Is Called on Loading. +//In this Method only Events and Services should be created +//to offer them to other Modules or Plugins during the Init process +//If False is Returned this will cause a Forced Exit +//------------- +Function TtehPlugins.Load: Boolean; +var + I: Integer; //Counter + CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute +label Continue; +begin + //Get Pointer to PluginLoader + PluginLoader := PPluginLoader(Core.GetModulebyName('TPluginLoader')); + If (PluginLoader = nil) then + begin + Result := False; + Core.ReportError(Integer(PChar('Could not get Pointer to PluginLoader')), Integer(PChar('TtehPlugins'))); + end + else + begin + Result := True; + + //Backup CurExecuted + CurExecutedBackup := Core.CurExecuted; + + //Start Loading the Plugins + I := 0; + Continue: + Try + While (I <= High(PluginLoader.Plugins)) do + begin + Core.CurExecuted := -1 - I; + + //Unload Plugin if not correctly Executed + If (PluginLoader.CallLoad(I) <> 0) then + begin + PluginLoader.CallDeInit(I); + PluginLoader.Plugins[I].State := 254; //Plugin asks for unload + Core.ReportDebug(Integer(PChar('Plugin Selfabort during loading process: ' + String(PluginLoader.Plugins[I].Info.Name))), Integer(PChar('TtehPlugins'))); + end + else + Core.ReportDebug(Integer(PChar('Plugin loaded succesful: ' + String(PluginLoader.Plugins[I].Info.Name))), Integer(PChar('TtehPlugins'))); + + Inc(I); + end; + Except + //Plugin could not be loaded. + // => Show Error Message, then ShutDown Plugin + on E: Exception do + begin + PluginLoader.CallDeInit(I); + PluginLoader.Plugins[I].State := 255; //Plugin causes Error + Core.ReportError(Integer(PChar('Plugin causes Error during loading process: ' + PluginLoader.Plugins[I].Info.Name + ', ErrorMsg: "' + E.Message + '"')), Integer(PChar('TtehPlugins'))); + + + //don't forget to increase I + Inc(I); + end; + End; + + If (I <= High(PluginLoader.Plugins)) then + Goto Continue; + + //Reset CurExecuted + Core.CurExecuted := CurExecutedBackup; + end; +end; + +//------------- +//Is Called on Init Process +//In this Method you can Hook some Events and Create + Init +//your Classes, Variables etc. +//If False is Returned this will cause a Forced Exit +//------------- +Function TtehPlugins.Init: Boolean; +var + I: Integer; //Counter + CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute +label Continue; +begin + Result := True; + + //Backup CurExecuted + CurExecutedBackup := Core.CurExecuted; + + //Start Loading the Plugins + I := 0; + Continue: + Try + While (I <= High(PluginLoader.Plugins)) do + begin + Core.CurExecuted := -1 - I; + + //Unload Plugin if not correctly Executed + If (PluginLoader.CallInit(I) <> 0) then + begin + PluginLoader.CallDeInit(I); + PluginLoader.Plugins[I].State := 254; //Plugin asks for unload + Core.ReportDebug(Integer(PChar('Plugin Selfabort during init process: ' + String(PluginLoader.Plugins[I].Info.Name))), Integer(PChar('TtehPlugins'))); + end + else + Core.ReportDebug(Integer(PChar('Plugin inited succesful: ' + String(PluginLoader.Plugins[I].Info.Name))), Integer(PChar('TtehPlugins'))); + + //don't forget to increase I + Inc(I); + end; + Except + //Plugin could not be loaded. + // => Show Error Message, then ShutDown Plugin + PluginLoader.CallDeInit(I); + PluginLoader.Plugins[I].State := 255; //Plugin causes Error + Core.ReportError(Integer(PChar('Plugin causes Error during init process: ' + String(PluginLoader.Plugins[I].Info.Name))), Integer(PChar('TtehPlugins'))); + + //don't forget to increase I + Inc(I); + End; + + If (I <= High(PluginLoader.Plugins)) then + GoTo Continue; + + //Reset CurExecuted + Core.CurExecuted := CurExecutedBackup; +end; + +//------------- +//Is Called if this Module has been Inited and there is a Exit. +//Deinit is in backwards Initing Order +//------------- +Procedure TtehPlugins.DeInit; +var + I: Integer; //Counter + CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute +label Continue; +begin + //Backup CurExecuted + CurExecutedBackup := Core.CurExecuted; + + //Start Loop + I := 0; + + Continue: + Try + While (I <= High(PluginLoader.Plugins)) do + begin + //DeInit Plugin + PluginLoader.CallDeInit(I); + + Inc(I); + end; + Except + Inc(I); + End; + + If I <= High(PluginLoader.Plugins) then + Goto Continue; + + //Reset CurExecuted + Core.CurExecuted := CurExecutedBackup; +end; + +end. diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 2e04df9f..6d50fff4 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -1,169 +1,182 @@ +{$IFNDEF FPC} // This is here, so linux & MacOS X Versions can simply include the uses + // from the dpr. Saves dupicating the uses clause. program UltraStar; -{$R 'UltraStar.res' 'UltraStar.rc'} -{$I switches.inc} + {$R 'UltraStar.res' 'UltraStar.rc'} + {$I switches.inc} uses - //------------------------------ +{$ENDIF} + + //------------------------------ //Includes - 3rd Party Libraries //------------------------------ - SDL in 'lib\JEDI-SDLv1.0\SDL\Pas\SDL.pas', - moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', - sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', - sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', - OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas', - sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', - - bass in 'lib\bass\delphi\bass.pas', - - PNGImage in 'lib\PNGImage\PNGImage.pas', - PNGzLib in 'lib\PNGImage\PNGzLib.pas', - pnglang in 'lib\PNGImage\pnglang.pas', - - midiout in 'lib\midi\midiout.pas', - midiin in 'lib\midi\midiin.pas', - CIRCBUF in 'lib\midi\CIRCBUF.PAS', - MidiType in 'lib\midi\MidiType.PAS', - MidiDefs in 'lib\midi\MidiDefs.PAS', - MidiCons in 'lib\midi\MidiCons.PAS', - MidiFile in 'lib\midi\MidiFile.PAS', - Delphmcb in 'lib\midi\Delphmcb.PAS', - - avcodec in 'lib\ffmpeg\avcodec.pas', - avformat in 'lib\ffmpeg\avformat.pas', - avutil in 'lib\ffmpeg\avutil.pas', - rational in 'lib\ffmpeg\rational.pas', - opt in 'lib\ffmpeg\opt.pas', - avio in 'lib\ffmpeg\avio.pas', - - DirWatch in 'lib\other\DirWatch.pas', - - SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', - SQLite3 in 'lib\SQLite\SQLite3.pas', + SDL in 'lib\JEDI-SDLv1.0\SDL\Pas\SDL.pas', + moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', + sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', + sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', + OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas', + sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', + + bass in 'lib\bass\delphi\bass.pas', + + {$ifdef delphi} + midiout in 'lib\midi\midiout.pas', + midiin in 'lib\midi\midiin.pas', + CIRCBUF in 'lib\midi\CIRCBUF.PAS', + MidiType in 'lib\midi\MidiType.PAS', + MidiDefs in 'lib\midi\MidiDefs.PAS', + MidiCons in 'lib\midi\MidiCons.PAS', + MidiFile in 'lib\midi\MidiFile.PAS', + Delphmcb in 'lib\midi\Delphmcb.PAS', + + DirWatch in 'lib\other\DirWatch.pas', + {$endif} + + avcodec in 'lib\ffmpeg\avcodec.pas', + avformat in 'lib\ffmpeg\avformat.pas', + avutil in 'lib\ffmpeg\avutil.pas', + rational in 'lib\ffmpeg\rational.pas', + opt in 'lib\ffmpeg\opt.pas', + avio in 'lib\ffmpeg\avio.pas', + + + SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', + SQLite3 in 'lib\SQLite\SQLite3.pas', - //------------------------------ + //------------------------------ //Includes - Menu System //------------------------------ - UDisplay in 'Menu\UDisplay.pas', - UMenu in 'Menu\UMenu.pas', - UMenuStatic in 'Menu\UMenuStatic.pas', - UMenuText in 'Menu\UMenuText.pas', - UMenuButton in 'Menu\UMenuButton.pas', - UMenuInteract in 'Menu\UMenuInteract.pas', - UMenuSelect in 'Menu\UMenuSelect.pas', - UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', - UDrawTexture in 'Menu\UDrawTexture.pas', - UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', + UDisplay in 'Menu\UDisplay.pas', + UMenu in 'Menu\UMenu.pas', + UMenuStatic in 'Menu\UMenuStatic.pas', + UMenuText in 'Menu\UMenuText.pas', + UMenuButton in 'Menu\UMenuButton.pas', + UMenuInteract in 'Menu\UMenuInteract.pas', + UMenuSelect in 'Menu\UMenuSelect.pas', + UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', + UDrawTexture in 'Menu\UDrawTexture.pas', + UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', - //------------------------------ - //Includes - Classes //------------------------------ - UCommon in 'Classes\UCommon.pas', - UGraphic in 'Classes\UGraphic.pas', - UTexture in 'Classes\UTexture.pas', - ULanguage in 'Classes\ULanguage.pas', - UMain in 'Classes\UMain.pas', - UDraw in 'Classes\UDraw.pas', - URecord in 'Classes\URecord.pas', - UTime in 'Classes\UTime.pas', - TextGL in 'Classes\TextGL.pas', - USongs in 'Classes\USongs.pas', - UIni in 'Classes\UIni.pas', - ULyrics in 'Classes\ULyrics.pas', - ULyrics_bak in 'Classes\ULyrics_bak.pas', - USkins in 'Classes\USkins.pas', - UThemes in 'Classes\UThemes.pas', - ULog in 'Classes\ULog.pas', - UJoystick in 'Classes\UJoystick.pas', - ULCD in 'Classes\ULCD.pas', - ULight in 'Classes\ULight.pas', - UDataBase in 'Classes\UDataBase.pas', - UCovers in 'Classes\UCovers.pas', - UCatCovers in 'Classes\UCatCovers.pas', - UFiles in 'Classes\UFiles.pas', - UGraphicClasses in 'Classes\UGraphicClasses.pas', - UDLLManager in 'Classes\UDLLManager.pas', - UPlaylist in 'Classes\UPlaylist.pas', - UCommandLine in 'Classes\UCommandLine.pas', - UTextClasses in 'Classes\UTextClasses.pas', - USingScores in 'Classes\USingScores.pas', - USingNotes in 'Classes\USingNotes.pas', - - UModules in 'Classes\UModules.pas', //List of Modules to Load - UHooks in 'Classes\UHooks.pas', //Hook Managing - UServices in 'Classes\UServices.pas',//Service Managing - UCore in 'Classes\UCore.pas', //Core, Maybe remove this - UCoreModule in 'Classes\UCoreModule.pas', //^ - UPluginInterface in 'Classes\UPluginInterface.pas', //Interface offered by Core to Plugins - UPluginLoader in 'Classes\UPluginLoader.pas', //New Plugin Loader Module - - UParty in 'Classes\UParty.pas', // to - do : rewrite Party Manager as Module, reomplent ability to offer party Mody by Plugin + //Includes - Classes + //------------------------------ + UCommon in 'Classes\UCommon.pas', + UGraphic in 'Classes\UGraphic.pas', + UTexture in 'Classes\UTexture.pas', + ULanguage in 'Classes\ULanguage.pas', + UMain in 'Classes\UMain.pas', + UDraw in 'Classes\UDraw.pas', + URecord in 'Classes\URecord.pas', + UTime in 'Classes\UTime.pas', + TextGL in 'Classes\TextGL.pas', + USongs in 'Classes\USongs.pas', + UIni in 'Classes\UIni.pas', + ULyrics in 'Classes\ULyrics.pas', + ULyrics_bak in 'Classes\ULyrics_bak.pas', + USkins in 'Classes\USkins.pas', + UThemes in 'Classes\UThemes.pas', + ULog in 'Classes\ULog.pas', + UJoystick in 'Classes\UJoystick.pas', + ULCD in 'Classes\ULCD.pas', + ULight in 'Classes\ULight.pas', + UDataBase in 'Classes\UDataBase.pas', + UCovers in 'Classes\UCovers.pas', + UCatCovers in 'Classes\UCatCovers.pas', + UFiles in 'Classes\UFiles.pas', + UGraphicClasses in 'Classes\UGraphicClasses.pas', + UDLLManager in 'Classes\UDLLManager.pas', + UPlaylist in 'Classes\UPlaylist.pas', + UCommandLine in 'Classes\UCommandLine.pas', + UTextClasses in 'Classes\UTextClasses.pas', + USingScores in 'Classes\USingScores.pas', + USingNotes in 'Classes\USingNotes.pas', + + UModules in 'Classes\UModules.pas', //List of Modules to Load + UHooks in 'Classes\UHooks.pas', //Hook Managing + UServices in 'Classes\UServices.pas', //Service Managing + UCore in 'Classes\UCore.pas', //Core, Maybe remove this + UCoreModule in 'Classes\UCoreModule.pas', //^ + UPluginInterface in 'Classes\UPluginInterface.pas', //Interface offered by Core to Plugins + UPluginLoader in 'Classes\UPluginLoader.pas', //New Plugin Loader Module + + UParty in 'Classes\UParty.pas', // to - do : rewrite Party Manager as Module, reomplent ability to offer party Mody by Plugin + +{$IFDEF FPC} + ulazjpeg in 'Classes\Ulazjpeg.pas', +{$ENDIF} + //------------------------------ //Includes - Media support classes.... // Make sure UMedia always first, then UMedia_dummy //------------------------------ - UMusic in 'Classes\UMusic.pas', - UMedia_dummy in 'Classes\UMedia_dummy.pas', - UVideo in 'Classes\UVideo.pas', -// UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', // this is NEARLY to a working point :P - UAudio_Bass in 'Classes\UAudio_Bass.pas', + UMusic in 'Classes\UMusic.pas', + UMedia_dummy in 'Classes\UMedia_dummy.pas', + UVideo in 'Classes\UVideo.pas', +{$ifdef linux} + UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', +{$endif} +{$ifdef win32} + UAudio_bass in 'Classes\UAudio_bass.pas', +{$endif} - //------------------------------ - //Includes - Screens //------------------------------ - UScreenLoading in 'Screens\UScreenLoading.pas', - UScreenWelcome in 'Screens\UScreenWelcome.pas', - UScreenMain in 'Screens\UScreenMain.pas', - UScreenName in 'Screens\UScreenName.pas', - UScreenLevel in 'Screens\UScreenLevel.pas', - UScreenSong in 'Screens\UScreenSong.pas', - UScreenSing in 'Screens\UScreenSing.pas', - UScreenScore in 'Screens\UScreenScore.pas', - UScreenOptions in 'Screens\UScreenOptions.pas', - UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', - UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', - UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', - UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', - UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', - UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', - UScreenOptionsAdvanced in 'Screens\UScreenOptionsAdvanced.pas', - UScreenEditSub in 'Screens\UScreenEditSub.pas', - UScreenEdit in 'Screens\UScreenEdit.pas', - UScreenEditConvert in 'Screens\UScreenEditConvert.pas', - UScreenEditHeader in 'Screens\UScreenEditHeader.pas', - UScreenOpen in 'Screens\UScreenOpen.pas', - UScreenTop5 in 'Screens\UScreenTop5.pas', - UScreenSongMenu in 'Screens\UScreenSongMenu.pas', - UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', - UScreenStatMain in 'Screens\UScreenStatMain.pas', - UScreenStatDetail in 'Screens\UScreenStatDetail.pas', - UScreenCredits in 'Screens\UScreenCredits.pas', - UScreenPopup in 'Screens\UScreenPopup.pas', + //Includes - Screens + //------------------------------ + UScreenLoading in 'Screens\UScreenLoading.pas', + UScreenWelcome in 'Screens\UScreenWelcome.pas', + UScreenMain in 'Screens\UScreenMain.pas', + UScreenName in 'Screens\UScreenName.pas', + UScreenLevel in 'Screens\UScreenLevel.pas', + UScreenSong in 'Screens\UScreenSong.pas', + UScreenSing in 'Screens\UScreenSing.pas', + UScreenScore in 'Screens\UScreenScore.pas', + UScreenOptions in 'Screens\UScreenOptions.pas', + UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', + UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', + UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', + UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', + UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', + UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', + UScreenOptionsAdvanced in 'Screens\UScreenOptionsAdvanced.pas', + UScreenEditSub in 'Screens\UScreenEditSub.pas', + UScreenEdit in 'Screens\UScreenEdit.pas', + UScreenEditConvert in 'Screens\UScreenEditConvert.pas', + UScreenEditHeader in 'Screens\UScreenEditHeader.pas', + UScreenOpen in 'Screens\UScreenOpen.pas', + UScreenTop5 in 'Screens\UScreenTop5.pas', + UScreenSongMenu in 'Screens\UScreenSongMenu.pas', + UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', + UScreenStatMain in 'Screens\UScreenStatMain.pas', + UScreenStatDetail in 'Screens\UScreenStatDetail.pas', + UScreenCredits in 'Screens\UScreenCredits.pas', + UScreenPopup in 'Screens\UScreenPopup.pas', - //------------------------------ //Includes - Screens PartyMode - //------------------------------ - UScreenSingModi in 'Screens\UScreenSingModi.pas', - UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', - UScreenPartyScore in 'Screens\UScreenPartyScore.pas', - UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', - UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', - UScreenPartyWin in 'Screens\UScreenPartyWin.pas', + UScreenSingModi in 'Screens\UScreenSingModi.pas', + UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', + UScreenPartyScore in 'Screens\UScreenPartyScore.pas', + UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', + UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', + UScreenPartyWin in 'Screens\UScreenPartyWin.pas', + //------------------------------ //Includes - Modi SDK //------------------------------ - ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', //Old SDK, will be deleted soon - UPluginDefs in '..\..\Modis\SDK\UPluginDefs.pas', //New SDK, not only Modis - UPartyDefs in '..\..\Modis\SDK\UPartyDefs.pas', //Headers to register Party Modes + ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', //Old SDK, will be deleted soon + UPluginDefs in '..\..\Modis\SDK\UPluginDefs.pas', //New SDK, not only Modis + UPartyDefs in '..\..\Modis\SDK\UPartyDefs.pas', //Headers to register Party Modes Windows, SysUtils; - - // eddie: I had to move the main procedure to UMain.pas, because - // I can't use the dpr file with Xcode on the mac. +const + Version = 'UltraStar Deluxe V 1.10 Alpha Build'; + +{$IFNDEF FPC} begin Main; -end. \ No newline at end of file +end. +{$ENDIF} \ No newline at end of file diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index dc8fb781..01cd7f87 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -1,221 +1,36 @@ -program UltraStar; - -{$DEFINE TRANSLATE} - -{$IFDEF FPC} - {$MODE DELPHI} -{$ELSE} - {$R 'UltraStar.res' 'UltraStar.rc'} -{$ENDIF} - -{$I switches.inc} - -uses - {$ifdef unix} // http://wiki.lazarus.freepascal.org/Multithreaded_Application_Tutorial - cthreads, // THIS MUST be the first used unit !! - {$endif} - - syscall, - - // *************************************************************************** - // - // Developers PLEASE NOTE !!!!!!! - // - // As of september 2007, I am working towards porting Ultrastar-DX to run - // on Linux. I will be modifiying the source to make it compile in lazarus - // on windows & linux and I will make sure that it compiles in delphi still - // To help me in this endevour, please can you make a point of remembering - // that linux is CASE SENSATIVE, and file / unit names must be as per - // the filename exactly. - // - // EG : opengl12.pas must not be OpenGL in the uses cluase. - // - // thanks for your help... - // - // *************************************************************************** - - // Interesting stuff... :) - // http://burningsmell.org/sdl_audioin/ - - - //------------------------------ - //Includes - 3rd Party Libraries - //------------------------------ - - // SDL / OpenGL - moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', - opengl12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\opengl12.pas', - sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', - sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', - sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', - sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', - - - // Bass - {$IFDEF UseBASS} - bass in 'lib\bass\delphi\bass.pas', - {$ENDIF} - - // Midi Units - {$IFDEF UseMIDIPort} - Circbuf in 'lib\midi\CIRCBUF.PAS', - Delphmcb in 'lib\midi\Delphmcb.PAS', - MidiCons in 'lib\midi\MidiCons.PAS', - MidiDefs in 'lib\midi\MidiDefs.PAS', - MidiFile in 'lib\midi\MidiFile.PAS', - midiin in 'lib\midi\midiin.pas', - midiout in 'lib\midi\midiout.pas', - MidiType in 'lib\midi\MidiType.PAS', - {$ENDIF} - - // FFMpeg units - avcodec in 'lib\ffmpeg\avcodec.pas', - avformat in 'lib\ffmpeg\avformat.pas', - avio in 'lib\ffmpeg\avio.pas', - avutil in 'lib\ffmpeg\avutil.pas', - opt in 'lib\ffmpeg\opt.pas', - rational in 'lib\ffmpeg\rational.pas', - - - // Sql Lite - SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', - SQLite3 in 'lib\SQLite\SQLite3.pas', - - - //------------------------------ - //Includes - Menu System - //------------------------------ - - UDisplay in 'Menu\UDisplay.pas', - UDrawTexture in 'Menu\UDrawTexture.pas', - UMenu in 'Menu\UMenu.pas', - UMenuButton in 'Menu\UMenuButton.pas', - UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', - UMenuInteract in 'Menu\UMenuInteract.pas', - UMenuSelect in 'Menu\UMenuSelect.pas', - UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', - UMenuStatic in 'Menu\UMenuStatic.pas', - UMenuText in 'Menu\UMenuText.pas', - - //------------------------------ - //Includes - Classes - //------------------------------ - - {$IFDEF FPC} - ulazjpeg in 'Classes\Ulazjpeg.pas', - {$ENDIF} - - TextGL in 'Classes\TextGL.pas', - UCatCovers in 'Classes\UCatCovers.pas', - UCommandLine in 'Classes\UCommandLine.pas', - UCommon in 'Classes\UCommon.pas', - UCovers in 'Classes\UCovers.pas', - UDataBase in 'Classes\UDataBase.pas', - UDLLManager in 'Classes\UDLLManager.pas', - UDraw in 'Classes\UDraw.pas', - UFiles in 'Classes\UFiles.pas', - UGraphic in 'Classes\UGraphic.pas', - UGraphicClasses in 'Classes\UGraphicClasses.pas', - UIni in 'Classes\UIni.pas', - UJoystick in 'Classes\UJoystick.pas', - ULanguage in 'Classes\ULanguage.pas', - ULCD in 'Classes\ULCD.pas', - ULight in 'Classes\ULight.pas', - ULog in 'Classes\ULog.pas', - ULyrics in 'Classes\ULyrics.pas', - ULyrics_bak in 'Classes\ULyrics_bak.pas', - UMain in 'Classes\UMain.pas', - - - UMusic in 'Classes\UMusic.pas', - - UMedia_dummy in 'Classes\UMedia_dummy.pas', - UVideo in 'Classes\UVideo.pas', - UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', -{$ifdef win32} - UAudio_bass in 'Classes\UAudio_bass.pas', -{$endif} - -// UAudio_fmod in 'Classes\UAudio_fmod.pas', // this has not yet been developed.. :( - - UParty in 'Classes\UParty.pas', - UPlaylist in 'Classes\UPlaylist.pas', - URecord in 'Classes\URecord.pas', - USkins in 'Classes\USkins.pas', - USingScores in 'Classes\USingScores.pas', - USongs in 'Classes\USongs.pas', - UTexture in 'Classes\UTexture.pas', - UThemes in 'Classes\UThemes.pas', - UTime in 'Classes\UTime.pas', - USingNotes in 'Classes\USingNotes.pas', - - uPluginLoader in 'Classes\uPluginLoader.pas', - UCoreModule in 'Classes\UCoreModule.pas', - UServices in 'Classes\UServices.pas', - UCore in 'Classes\UCore.pas', - UHooks in 'Classes\UHooks.pas', - - - - //------------------------------ - //Includes - Screens - //------------------------------ - UScreenCredits in 'Screens\UScreenCredits.pas', - UScreenEdit in 'Screens\UScreenEdit.pas', - UScreenEditConvert in 'Screens\UScreenEditConvert.pas', - UScreenEditHeader in 'Screens\UScreenEditHeader.pas', - UScreenEditSub in 'Screens\UScreenEditSub.pas', - UScreenLevel in 'Screens\UScreenLevel.pas', - UScreenLoading in 'Screens\UScreenLoading.pas', - UScreenMain in 'Screens\UScreenMain.pas', - UScreenName in 'Screens\UScreenName.pas', - UScreenOpen in 'Screens\UScreenOpen.pas', - UScreenOptions in 'Screens\UScreenOptions.pas', - UScreenOptionsAdvanced in 'Screens\UScreenOptionsAdvanced.pas', - UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', - UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', - UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', - UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', - UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', - UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', - UScreenPopup in 'Screens\UScreenPopup.pas', - UScreenScore in 'Screens\UScreenScore.pas', - UScreenSing in 'Screens\UScreenSing.pas', - UScreenSong in 'Screens\UScreenSong.pas', - UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', - UScreenSongMenu in 'Screens\UScreenSongMenu.pas', - UScreenStatDetail in 'Screens\UScreenStatDetail.pas', - UScreenStatMain in 'Screens\UScreenStatMain.pas', - UScreenTop5 in 'Screens\UScreenTop5.pas', - UScreenWelcome in 'Screens\UScreenWelcome.pas', - - //------------------------------ - //Includes - Screens PartyMode - //------------------------------ - UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', - UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', - UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', - UScreenPartyScore in 'Screens\UScreenPartyScore.pas', - UScreenPartyWin in 'Screens\UScreenPartyWin.pas', - UScreenSingModi in 'Screens\UScreenSingModi.pas', - - //------------------------------ - //Includes - Modi SDK - //------------------------------ - ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', - UPluginDefs in '..\..\Modis\SDK\UPluginDefs.pas', - - //------------------------------ - //Includes - Delphi - //------------------------------ - {$IFDEF win32} - Windows, - {$ENDIF} - SysUtils; - -const - Version = 'UltraStar Deluxe V 1.10 Alpha Build'; - -begin - main(); -end. +program UltraStar; + +{$DEFINE TRANSLATE} +{$MODE DELPHI} +{$I switches.inc} + +uses + {$ifdef unix} // http://wiki.lazarus.freepascal.org/Multithreaded_Application_Tutorial + cthreads, // THIS MUST be the first used unit !! + {$endif} + + // *************************************************************************** + // + // Developers PLEASE NOTE !!!!!!! + // + // As of september 2007, I am working towards porting Ultrastar-DX to run + // on Linux. I will be modifiying the source to make it compile in lazarus + // on windows & linux and I will make sure that it compiles in delphi still + // To help me in this endevour, please can you make a point of remembering + // that linux is CASE SENSATIVE, and file / unit names must be as per + // the filename exactly. + // + // EG : opengl12.pas must not be OpenGL in the uses cluase. + // + // thanks for your help... + // + // *************************************************************************** + + // Interesting stuff... :) + // http://burningsmell.org/sdl_audioin/ + + {$I UltraStar.dpr} + +begin + main(); +end. diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index 1958471b..a5ec9994 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -1,44 +1,45 @@ -{$DEFINE DEBUG} // to-do : Remove b4 release - -// Comment by eddie: -// The mac port currently also uses the WIN32 define. -// Once I get the beast compiled, linked and running -// I will change this. -// There are some parts where the WIN32 define could not -// be used. I changed the WIN32 to MSWINDOWS. -// So, for Windows-only code use the MSWINDOWS define. - - -{$IFDEF FPC} - {$IFDEF DARWIN} - {$H+} - {$R-} - {$DEFINE WIN32} - {$DEFINE TRANSLATE} - {$ELSE} - {$DEFINE LAZARUS} - {$ENDIF} - -// {$MODE DELPHI} // JB - This is not allowed by the free pascal compiler for some reason ( At least on linux ) - - {$DEFINE DLL_CDECL} - {$UNDEF UseSerialPort} - {$UNDEF UseMIDIPort} -{$ELSE} - {$DEFINE DLL_STDCALL} - {$UNDEF UseSerialPort} - {$DEFINE UseMIDIPort} -{$ENDIF} - - -{$IFDEF win32} - {$DEFINE UseBASS} - {$IFDEF DEBUG} - {$IFNDEF DARWIN} - {$APPTYPE CONSOLE} - {$ENDIF} - {$ENDIF} -{$ELSE} - {$UNDEF UseBASS} -{$ENDIF} - +{$DEFINE DEBUG} // to-do : Remove b4 release + +// Comment by eddie: +// The mac port currently also uses the WIN32 define. +// Once I get the beast compiled, linked and running +// I will change this. +// There are some parts where the WIN32 define could not +// be used. I changed the WIN32 to MSWINDOWS. +// So, for Windows-only code use the MSWINDOWS define. + + +{$IFDEF FPC} + {$IFDEF DARWIN} + {$H+} + {$R-} + {$DEFINE WIN32} + {$DEFINE TRANSLATE} + {$ELSE} + {$DEFINE LAZARUS} + {$ENDIF} + +// {$MODE DELPHI} // JB - This is not allowed by the free pascal compiler for some reason ( At least on linux ) + + {$DEFINE DLL_CDECL} + {$UNDEF UseSerialPort} + {$UNDEF UseMIDIPort} +{$ELSE} + {$DEFINE Delphi} + {$DEFINE DLL_STDCALL} + {$UNDEF UseSerialPort} + {$DEFINE UseMIDIPort} +{$ENDIF} + + +{$IFDEF win32} + {$DEFINE UseBASS} + {$IFDEF DEBUG} + {$IFNDEF DARWIN} + {$APPTYPE CONSOLE} + {$ENDIF} + {$ENDIF} +{$ELSE} + {$UNDEF UseBASS} +{$ENDIF} + -- cgit v1.2.3 From cd4710574dd911e9f82586b093c10758693bfc3e Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sat, 3 Nov 2007 03:11:24 +0000 Subject: attempt to fix linux build. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@561 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.dpr | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 6d50fff4..3ece5395 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -11,12 +11,12 @@ uses //------------------------------ //Includes - 3rd Party Libraries //------------------------------ - SDL in 'lib\JEDI-SDLv1.0\SDL\Pas\SDL.pas', - moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', - sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', - sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', - OpenGL12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\OpenGL12.pas', - sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', + moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', + opengl12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\opengl12.pas', + sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', + sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', + sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', + sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', bass in 'lib\bass\delphi\bass.pas', -- cgit v1.2.3 From 85313ec4dcc1591dbf1ecf6fa76294080354ed2a Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sat, 3 Nov 2007 03:13:44 +0000 Subject: another attempt.. ( me to lazy to boot my linux dev box .. ) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@562 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/USDXResCompiler.exe | Bin 1698394 -> 1698394 bytes Game/Code/UltraStar.dpr | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/USDXResCompiler.exe b/Game/Code/USDXResCompiler.exe index b18e11a9..43e7fc8a 100644 Binary files a/Game/Code/USDXResCompiler.exe and b/Game/Code/USDXResCompiler.exe differ diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 3ece5395..4695ae4e 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -18,9 +18,9 @@ uses sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', + {$ifdef delphi} bass in 'lib\bass\delphi\bass.pas', - {$ifdef delphi} midiout in 'lib\midi\midiout.pas', midiin in 'lib\midi\midiin.pas', CIRCBUF in 'lib\midi\CIRCBUF.PAS', -- cgit v1.2.3 From 8d021ba9197cc31408c4a9da1948422bcb7a3d43 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sat, 3 Nov 2007 03:30:35 +0000 Subject: 1 more try. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@563 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.dpr | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 4695ae4e..0ab28cb6 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -98,7 +98,7 @@ uses UCore in 'Classes\UCore.pas', //Core, Maybe remove this UCoreModule in 'Classes\UCoreModule.pas', //^ UPluginInterface in 'Classes\UPluginInterface.pas', //Interface offered by Core to Plugins - UPluginLoader in 'Classes\UPluginLoader.pas', //New Plugin Loader Module + uPluginLoader in 'Classes\uPluginLoader.pas', //New Plugin Loader Module UParty in 'Classes\UParty.pas', // to - do : rewrite Party Manager as Module, reomplent ability to offer party Mody by Plugin @@ -169,7 +169,9 @@ uses UPluginDefs in '..\..\Modis\SDK\UPluginDefs.pas', //New SDK, not only Modis UPartyDefs in '..\..\Modis\SDK\UPartyDefs.pas', //Headers to register Party Modes + {$IFDEF win32} Windows, + {$ENDIF} SysUtils; const -- cgit v1.2.3 From 84a799853df75973fe4560576d9257f20b5bef85 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Sat, 3 Nov 2007 08:47:56 +0000 Subject: Changed DELPHI define to IFDEF LAZARUS ... ELSE ... ENDIF. This should work on all Platforms now (I hope). git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@564 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 68 ++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 36 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index ac3aa7d6..c3ab0d41 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -277,7 +277,38 @@ begin Log.LogStatus( 'IS Resource, because file does not exist.('+Identifier+')', ' LoadImage' ); // load from resource stream - {$IFDEF DELPHI} + {$IFDEF LAZARUS} + lLazRes := LazFindResource( Identifier, 'TEX' ); + if lLazRes <> nil then + begin + lResData := TStringStream.create( lLazRes.value ); + try + lResData.position := 0; + try + TexRWops := SDL_AllocRW; + TexRWops.unknown := TUnknown( lResData ); + TexRWops.seek := SDLStreamSeek; + TexRWops.read := SDLStreamRead; + TexRWops.write := nil; + TexRWops.close := SDLStreamClose; + TexRWops.type_ := 2; + except + Log.LogStatus( 'ERROR Could not assign resource ('+Identifier+')' , Identifier); + beep; + Exit; + end; + + Result := IMG_Load_RW(TexRWops,0); + SDL_FreeRW(TexRWops); + finally + freeandnil( lResData ); + end; + end + else + begin + Log.LogStatus( 'NOT found in Resource ('+Identifier+')', ' LoadImage' ); + end; + {$ELSE} dHandle := FindResource(hInstance, Identifier, 'TEX'); if dHandle=0 then begin @@ -320,42 +351,7 @@ begin if assigned( TexStream ) then freeandnil( TexStream ); end; - - - {$ELSE} - lLazRes := LazFindResource( Identifier, 'TEX' ); - if lLazRes <> nil then - begin - lResData := TStringStream.create( lLazRes.value ); - try - lResData.position := 0; - try - TexRWops := SDL_AllocRW; - TexRWops.unknown := TUnknown( lResData ); - TexRWops.seek := SDLStreamSeek; - TexRWops.read := SDLStreamRead; - TexRWops.write := nil; - TexRWops.close := SDLStreamClose; - TexRWops.type_ := 2; - except - Log.LogStatus( 'ERROR Could not assign resource ('+Identifier+')' , Identifier); - beep; - Exit; - end; - - Result := IMG_Load_RW(TexRWops,0); - SDL_FreeRW(TexRWops); - finally - freeandnil( lResData ); - end; - end - else - begin - Log.LogStatus( 'NOT found in Resource ('+Identifier+')', ' LoadImage' ); - end; {$ENDIF} - - end; end; -- cgit v1.2.3 From d29ff5bed651115af3c63b6fe4768690fb46a916 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Sat, 3 Nov 2007 09:33:35 +0000 Subject: Mac OS X: Added unit cthreads. USDX now runs on OS X! But you can't do anything :-) Fonts are not working, but you can quit the program cleanly by pressing ESC and ENTER (MainLoop works). git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@565 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphic.pas | 71 +- Game/Code/Classes/UMain.pas | 3 + Game/Code/Classes/USongs.pas | 2093 ++++++++++---------- Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 | 127 +- .../MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser | 326 ++- 5 files changed, 1333 insertions(+), 1287 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index e13fdf43..02c06002 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -566,6 +566,11 @@ begin W := 800; H := 600; {$endif} + + {$IFDEF DARWIN} + // Todo : eddie: remove before realease + Ini.FullScreen := 0; + {$ENDIF} if (Ini.FullScreen = 0) and (Not Params.FullScreen) then begin @@ -702,39 +707,39 @@ begin end; procedure UnLoadScreens; -begin - freeandnil( ScreenMain ); - freeandnil( ScreenName ); - freeandnil( ScreenLevel); - freeandnil( ScreenSong ); - freeandnil( ScreenSongMenu ); - freeandnil( ScreenSing ); - freeandnil( ScreenScore); - freeandnil( ScreenTop5 ); - freeandnil( ScreenOptions ); - freeandnil( ScreenOptionsGame ); - freeandnil( ScreenOptionsGraphics ); - freeandnil( ScreenOptionsSound ); - freeandnil( ScreenOptionsLyrics ); -// freeandnil( ScreenOptionsThemes ); - freeandnil( ScreenOptionsRecord ); - freeandnil( ScreenOptionsAdvanced ); - freeandnil( ScreenEditSub ); - freeandnil( ScreenEdit ); - freeandnil( ScreenEditConvert ); - freeandnil( ScreenOpen ); - freeandnil( ScreenSingModi ); - freeandnil( ScreenSongMenu ); - freeandnil( ScreenSongJumpto); - freeandnil( ScreenPopupCheck ); - freeandnil( ScreenPopupError ); - freeandnil( ScreenPartyNewRound ); - freeandnil( ScreenPartyScore ); - freeandnil( ScreenPartyWin ); - freeandnil( ScreenPartyOptions ); - freeandnil( ScreenPartyPlayer ); - freeandnil( ScreenStatMain ); - freeandnil( ScreenStatDetail ); +begin + freeandnil( ScreenMain ); + freeandnil( ScreenName ); + freeandnil( ScreenLevel); + freeandnil( ScreenSong ); + freeandnil( ScreenSongMenu ); + freeandnil( ScreenSing ); + freeandnil( ScreenScore); + freeandnil( ScreenTop5 ); + freeandnil( ScreenOptions ); + freeandnil( ScreenOptionsGame ); + freeandnil( ScreenOptionsGraphics ); + freeandnil( ScreenOptionsSound ); + freeandnil( ScreenOptionsLyrics ); +// freeandnil( ScreenOptionsThemes ); + freeandnil( ScreenOptionsRecord ); + freeandnil( ScreenOptionsAdvanced ); + freeandnil( ScreenEditSub ); + freeandnil( ScreenEdit ); + freeandnil( ScreenEditConvert ); + freeandnil( ScreenOpen ); + freeandnil( ScreenSingModi ); + freeandnil( ScreenSongMenu ); + freeandnil( ScreenSongJumpto); + freeandnil( ScreenPopupCheck ); + freeandnil( ScreenPopupError ); + freeandnil( ScreenPartyNewRound ); + freeandnil( ScreenPartyScore ); + freeandnil( ScreenPartyWin ); + freeandnil( ScreenPartyOptions ); + freeandnil( ScreenPartyPlayer ); + freeandnil( ScreenStatMain ); + freeandnil( ScreenStatDetail ); end; end. diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 1be4b463..48928cbd 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -12,6 +12,9 @@ uses {$IFDEF MSWINDOWS} Windows, {$ENDIF} + {$IFDEF DARWIN} // needed for initialization of cthreads + cthreads, + {$ENDIF} SDL, UGraphic, UMusic, diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 2fa3ea4a..96d9ad2e 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -1,1045 +1,1048 @@ -unit USongs; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses - {$IFDEF MSWINDOWS} - Windows, - {$ifdef Delphi} - DirWatch, - {$endif} - {$ELSE} - {$IFNDEF DARWIN} - oldlinux, - syscall, - {$ENDIF} - baseunix, - UnixType, - {$ENDIF} - SysUtils, - Classes, - ULog, - UTexture, - UCommon, - UCatCovers; - -type - - TBPM = record - BPM: real; - StartBeat: real; - end; - - TScore = record - Name: widestring; - Score: integer; - Length: string; - end; - - TSong = record - Path: widestring; - Folder: widestring; // for sorting by folder - FileName: widestring; - - // sorting methods - Category: array of widestring; // I think I won't need this - Genre: widestring; - Edition: widestring; - Language: widestring; // 0.5.0: new - - Title: widestring; - Artist: widestring; - - Text: widestring; - Creator: widestring; - - Cover: widestring; - CoverTex: TTexture; - Mp3: widestring; - Background: widestring; - Video: widestring; - VideoGAP: real; - VideoLoaded: boolean; // 0.5.0: true if the video has been loaded - NotesGAP: integer; - Start: real; // in seconds - Finish: integer; // in miliseconds - Relative: boolean; - Resolution: integer; - BPM: array of TBPM; - GAP: real; // in miliseconds - - Score: array[0..2] of array of TScore; - - // these are used when sorting is enabled - Visible: boolean; // false if hidden, true if visible - Main: boolean; // false for songs, true for category buttons - OrderNum: integer; // has a number of category for category buttons and songs - OrderTyp: integer; // type of sorting for this button (0=name) - CatNumber: integer; // Count of Songs in Category for Cats and Number of Song in Category for Songs - end; - - TSongs = class( TThread ) - private - BrowsePos : Cardinal; //Actual Pos in Song Array - fNotify , - fWatch : longint; - fParseSongDirectory : boolean; - fProcessing : boolean; - {$ifdef Delphi} - fDirWatch : TDirectoryWatch; - {$endif} - procedure int_LoadSongList; - procedure DoDirChanged(Sender: TObject); - protected - procedure Execute; override; - public - Song : array of TSong; // array of songs - Selected : integer; // selected song index - constructor create(); - procedure LoadSongList; // load all songs - procedure BrowseDir(Dir: widestring); // should return number of songs in the future - procedure Sort(Order: integer); - function FindSongFile(Dir, Mask: widestring): widestring; - property Processing : boolean read fProcessing; - end; - - TCatSongs = class - Song: array of TSong; // array of categories with songs - Selected: integer; // selected song index - Order: integer; // order type (0=title) - CatNumShow: integer; // Category Number being seen - CatCount: integer; //Number of Categorys - - procedure Refresh; // refreshes arrays by recreating them from Songs array -// procedure Sort(Order: integer); - procedure ShowCategory(Index: integer); // expands all songs in category - procedure HideCategory(Index: integer); // hides all songs in category - procedure ClickCategoryButton(Index: integer); // uses ShowCategory and HideCategory when needed - procedure ShowCategoryList; //Hides all Songs And Show the List of all Categorys - function FindNextVisible(SearchFrom:integer): integer; //Find Next visible Song - function VisibleSongs: integer; // returns number of visible songs (for tabs) - function VisibleIndex(Index: integer): integer; // returns visible song index (skips invisible) - - function SetFilter(FilterStr: String; const fType: Byte): Cardinal; - end; - -var - Songs: TSongs; // all songs - CatSongs: TCatSongs; // categorized songs - AktSong: TSong; // one song *unknown use) - -const - IN_ACCESS = $00000001; //* File was accessed */ - IN_MODIFY = $00000002; //* File was modified */ - IN_ATTRIB = $00000004; //* Metadata changed */ - IN_CLOSE_WRITE = $00000008; //* Writtable file was closed */ - IN_CLOSE_NOWRITE = $00000010; //* Unwrittable file closed */ - IN_OPEN = $00000020; //* File was opened */ - IN_MOVED_FROM = $00000040; //* File was moved from X */ - IN_MOVED_TO = $00000080; //* File was moved to Y */ - IN_CREATE = $00000100; //* Subfile was created */ - IN_DELETE = $00000200; //* Subfile was deleted */ - IN_DELETE_SELF = $00000400; //* Self was deleted */ - - -implementation - -uses StrUtils, - UGraphic, - UCovers, - UFiles, - UMain, - UIni; - -{$IFDEF DARWIN} -function AnsiContainsText(const AText, ASubText: string): Boolean; -begin - Result := AnsiPos(AnsiUppercase(ASubText), AnsiUppercase(AText)) > 0; -end; -{$ENDIF} - -constructor TSongs.create(); -begin - inherited create( false ); - self.freeonterminate := true; - - {$ifdef Delphi} - fDirWatch := TDirectoryWatch.create(nil); - fDirWatch.OnChange := DoDirChanged; - fDirWatch.Directory := SongPath; - fDirWatch.WatchSubDirs := true; - fDirWatch.active := true; - {$ENDIF} - - {$IFDEF linux} - (* - Thankyou to : http://www.linuxjournal.com/article/8478 - http://www.tin.org/bin/man.cgi?section=2&topic=inotify_add_watch - *) -(* - fNotify := -1; - fWatch := -1; - - writeln( 'Calling inotify_init' ); - fNotify := Do_SysCall( syscall_nr_inotify_init ); - if ( fNotify < 0 ) then - writeln( 'Filesystem change notification - disabled' ); - writeln( 'Calling inotify_init : '+ inttostr(fNotify) ); - - writeln( 'Calling syscall_nr_inotify_init ('+SongPath+')' ); - fWatch := Do_SysCall( syscall_nr_inotify_init , TSysParam( fNotify ), longint( pchar( SongPath ) ) , IN_MODIFY AND IN_CREATE AND IN_DELETE ); - - if (fWatch < 0) then - writeln ('inotify_add_watch'); - writeln( 'Calling syscall_nr_inotify_init : '+ inttostr(fWatch) ); -*) - {$endif} - - Setlength(Song, 0); -end; - -procedure TSongs.DoDirChanged(Sender: TObject); -begin - LoadSongList(); -end; - -procedure TSongs.Execute(); -var - fChangeNotify : THandle; -begin - fParseSongDirectory := true; - - while not self.terminated do - begin - - if fParseSongDirectory then - begin - writeln( 'int_LoadSongList' ); - int_LoadSongList(); - end; - - self.suspend; - end; - -end; - -procedure TSongs.int_LoadSongList; -begin - try - fProcessing := true; - Setlength(Song, 0); - - Log.LogError('SongList', 'Searching For Songs'); - - Setlength(Song, 50); - - BrowsePos := 0; - // browse directories - BrowseDir(SongPath); - - //Set Correct SongArray Length - SetLength(Song, BrowsePos); - - if assigned( CatSongs ) then - CatSongs.Refresh; - - if assigned( CatCovers ) then - CatCovers.Load; - - if assigned( Covers ) then - Covers.Load; - - if assigned(ScreenSong) then - begin - ScreenSong.GenerateThumbnails(); - ScreenSong.OnShow; // refresh ScreenSong - end; - - - finally - Log.LogError('SongList', 'Search Complete'); - - fParseSongDirectory := false; - fProcessing := false; - end; -end; - - -procedure TSongs.LoadSongList; -begin - fParseSongDirectory := true; - self.resume; -end; - -// TODO : JB - THis whole function SUX ! and needs refactoring ! :P -procedure TSongs.BrowseDir(Dir: widestring); -var - SLen: integer; - - {$ifdef Delphi} - SR: TSearchRecW; // for parsing Songs Directory - {$ENDIF} - - // eddie: can we merge that? is baseunix working on linux? oldlinux is - // not available on mac os x. - {$IFDEF LINUX} - TheDir : oldlinux.pdir; - ADirent : oldlinux.pDirent; - Entry : Longint; - info : oldlinux.stat; - {$ENDIF} - {$IFDEF DARWIN} - TheDir : pdir; - ADirent : pDirent; - Entry : Longint; - info : stat; - {$ENDIF} -begin - {$ifdef Delphi} - if FindFirstW(Dir + '*', faDirectory, SR) = 0 then // JB_Unicode - windows - begin - repeat - if (SR.Name <> '.') and (SR.Name <> '..') then - begin - BrowseDir(Dir + Sr.Name + PathDelim); - end - until FindNextw(SR) <> 0; - end; // if - FindClosew(SR); - - if FindFirstW(Dir + '*.txt', 0, SR) = 0 then - begin - repeat - SLen := BrowsePos; - - Song[SLen].Path := Dir; - Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); - Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); - Song[SLen].FileName := SR.Name; - - if (AnalyseFile(Song[SLen]) = false) then - Dec(BrowsePos) - else - begin - if Song[SLen].Cover = '' then - Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); - end; - - //Change Length Only every 50 Entrys - Inc(BrowsePos); - - if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then - begin - SetLength(Song, Length(Song) + 50); - end; - - until FindNextW(SR) <> 0; - end; // if FindFirst - FindCloseW(SR); - {$ENDIF} - - {$IFDEF LINUX} - // Itterate the Songs Directory... ( With unicode capable functions for linux ) - TheDir := oldlinux.opendir( Dir ); // JB_Unicode - linux - if TheDir <> nil then - begin - repeat - ADirent := oldlinux.ReadDir(TheDir); - - If ADirent<>Nil then - begin - With ADirent^ do - begin - - if ( name[0] <> '.') then - BrowseDir( Dir + name + pathdelim ); - - end; - end; - Until ADirent=Nil; - end; - - - - TheDir := oldlinux.opendir( Dir ); // JB_Unicode - linux - if TheDir <> nil then - begin - repeat - ADirent := oldlinux.ReadDir(TheDir); - - if ( ADirent <> Nil ) AND - ( pos( '.txt', ADirent^.name ) > 0 ) then - begin - writeln ('***** FOUND TXT' + ADirent^.name ); - - SLen := BrowsePos; - - Song[SLen].Path := Dir; - Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); - Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); - Song[SLen].FileName := ADirent^.name; - - if (AnalyseFile(Song[SLen]) = false) then - Dec(BrowsePos) - else - begin - if Song[SLen].Cover = '' then - Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); - end; - - //Change Length Only every 50 Entrys - Inc(BrowsePos); - if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then - begin - SetLength(Song, Length(Song) + 50); - end; - end; - - Until ADirent=Nil; - end; // if FindFirst - {$endif} - - {$IFDEF DARWIN} - // Itterate the Songs Directory... ( With unicode capable functions for linux ) - TheDir := FPOpenDir( Dir ); // JB_Unicode - linux - if TheDir <> nil then - begin - repeat - ADirent := FPReadDir(TheDir); - - If ADirent<>Nil then - begin - With ADirent^ do - begin - - if ( d_name[0] <> '.') then - BrowseDir( Dir + d_name + pathdelim ); - - end; - end; - Until ADirent=Nil; - end; - - - - TheDir := FPOpenDir( Dir ); // JB_Unicode - linux - if TheDir <> nil then - begin - repeat - ADirent := FPReadDir(TheDir); - - if ( ADirent <> Nil ) AND - ( pos( '.txt', ADirent^.d_name ) > -1 ) then - begin - SLen := BrowsePos; - - Song[SLen].Path := Dir; - Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); - Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); - Song[SLen].FileName := ADirent^.d_name; - - if (AnalyseFile(Song[SLen]) = false) then - Dec(BrowsePos) - else - begin - if Song[SLen].Cover = '' then - Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); - end; - - //Change Length Only every 50 Entrys - Inc(BrowsePos); - - if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then - begin - SetLength(Song, Length(Song) + 50); - end; - end; - - Until ADirent=Nil; - end; // if FindFirst - - {$endif} - -// Log.LogStatus('Parsing directory: ' + Dir + SR.Name, 'LoadSongList'); - - -end; - -procedure TSongs.Sort(Order: integer); -var - S: integer; - S2: integer; - TempSong: TSong; -begin - case Order of - sEdition: // by edition - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Edition, Song[S-1].Edition) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sGenre: // by genre - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Genre, Song[S-1].Genre) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sTitle: // by title - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - - end; - sArtist: // by artist - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sFolder: // by folder - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Folder, Song[S-1].Folder) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sTitle2: // by title2 - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - - end; - sArtist2: // by artist2 - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin - // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - sLanguage: // by Language - begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Language, Song[S-1].Language) < 0 then begin - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; - end; - end; - - end; // case -end; - -function TSongs.FindSongFile(Dir, Mask: widestring): widestring; -var - SR: TSearchRec; // for parsing song directory -begin - Result := ''; - if FindFirst(Dir + Mask, faDirectory, SR) = 0 then begin - Result := SR.Name; - end; // if - FindClose(SR); -end; - -procedure TCatSongs.Refresh; -var - S: integer; // temporary song index - CatLen: integer; // length of CatSongs.Song - Letter: char; // current letter for sorting using letter - SS: string; // current edition for sorting using edition, genre etc. - Order: integer; // number used for ordernum - Letter2: char; // - CatNumber:integer; // Number of Song in Category -begin - CatNumShow := -1; -// Songs.Sort(0); // by title - -case Ini.Sorting of - sEdition: begin - Songs.Sort(sArtist); - Songs.Sort(sEdition); - end; - sGenre: begin - Songs.Sort(sArtist); - Songs.Sort(sGenre); - end; - sLanguage: begin - Songs.Sort(sArtist); - Songs.Sort(sLanguage); - end; - sFolder: begin - Songs.Sort(sArtist); - Songs.Sort(sFolder); - end; - sTitle: Songs.Sort(sTitle); - sArtist: Songs.Sort(sArtist); - sTitle2: Songs.Sort(sTitle2); // by title2 - sArtist2: Songs.Sort(sArtist2); // by artist2 - - end; // case - - - Letter := ' '; - SS := ''; - Order := 0; - CatNumber := 0; - - //Songs leeren - SetLength (Song, 0); - - for S := Low(Songs.Song) to High(Songs.Song) do begin - if (Ini.Tabs = 1) then - if (Ini.Sorting = sEdition) and (CompareText(SS, Songs.Song[S].Edition) <> 0) then begin - // add Category Button - Inc(Order); - SS := Songs.Song[S].Edition; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + SS + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - - - // 0.4.3 - // if SS = 'Singstar' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Part 2' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar German' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Spanish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Italian' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar French' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Party' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Party.jpg'; - // if SS = 'Singstar Popworld' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Popworld.jpg'; - // if SS = 'Singstar 80s' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; - // if SS = 'Singstar 80s Polish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; - // if SS = 'Singstar Rocks' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Rocks.jpg'; - // if SS = 'Singstar Anthems' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Anthems.jpg'; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';//} - - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sGenre) and (CompareText(SS, Songs.Song[S].Genre) <> 0) then begin - // add Genre Button - Inc(Order); - SS := Songs.Song[S].Genre; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sLanguage) and (CompareText(SS, Songs.Song[S].Language) <> 0) then begin - // add Language Button - Inc(Order); - SS := Songs.Song[S].Language; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sTitle) and - (Length(Songs.Song[S].Title)>=1) and - (Letter <> UpperCase(Songs.Song[S].Title)[1]) then begin - // add a letter Category Button - Inc(Order); - Letter := Uppercase(Songs.Song[S].Title)[1]; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - - {// cover-patch - if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sArtist) and (Length(Songs.Song[S].Artist)>=1) and (Letter <> UpperCase(Songs.Song[S].Artist)[1]) then begin - // add a letter Category Button - Inc(Order); - Letter := UpperCase(Songs.Song[S].Artist)[1]; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sFolder) and (CompareText(SS, Songs.Song[S].Folder) <> 0) then begin - // 0.5.0: add folder tab - Inc(Order); - SS := Songs.Song[S].Folder; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sTitle2) AND (Length(Songs.Song[S].Title)>=1) then begin - if (ord(Songs.Song[S].Title[1]) > 47) and (ord(Songs.Song[S].Title[1]) < 58) then Letter2 := '#' else Letter2 := UpperCase(Songs.Song[S].Title)[1]; - if (Letter <> Letter2) then begin - // add a letter Category Button - Inc(Order); - Letter := Letter2; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end; - end - - else if (Ini.Sorting = sArtist2) AND (Length(Songs.Song[S].Artist)>=1) then begin - if (ord(Songs.Song[S].Artist[1]) > 47) and (ord(Songs.Song[S].Artist[1]) < 58) then Letter2 := '#' else Letter2 := UpperCase(Songs.Song[S].Artist)[1]; - if (Letter <> Letter2) then begin - // add a letter Category Button - Inc(Order); - Letter := Letter2; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end; - end; - - - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - - Inc (CatNumber); //Increase Number in Cat - - CatSongs.Song[CatLen] := Songs.Song[S]; - CatSongs.Song[CatLen].OrderNum := Order; // assigns category - CatSongs.Song[CatLen].CatNumber := CatNumber; - - if (Ini.Tabs = 0) then CatSongs.Song[CatLen].Visible := true - else if (Ini.Tabs = 1) then CatSongs.Song[CatLen].Visible := false; -// if (Ini.Tabs = 1) and (Order = 1) then CatSongs.Song[CatLen].Visible := true; // open first tab -//CatSongs.Song[CatLen].Visible := true; - - end; -//CatNumber Patch - Set CatNumber of Last Category -if (ini.Tabs_at_startup = 1) And (high(Song) >=1) then - Song[CatLen - CatNumber].CatNumber := CatNumber;//Set CatNumber of Categroy -//CatCount Patch -CatCount := Order; -end; - -procedure TCatSongs.ShowCategory(Index: integer); -var - S: integer; // song -begin - CatNumShow := Index; - for S := 0 to high(CatSongs.Song) do - begin - if (CatSongs.Song[S].OrderNum = Index) AND (Not CatSongs.Song[S].Main) then - CatSongs.Song[S].Visible := true - else - CatSongs.Song[S].Visible := false; - end; -end; - -procedure TCatSongs.HideCategory(Index: integer); // hides all songs in category -var - S: integer; // song -begin - for S := 0 to high(CatSongs.Song) do begin - if not CatSongs.Song[S].Main then - CatSongs.Song[S].Visible := false // hides all at now - end; -end; - -procedure TCatSongs.ClickCategoryButton(Index: integer); -var - Num, S: integer; -begin - Num := CatSongs.Song[Index].OrderNum; - if Num <> CatNumShow then - begin - ShowCategory(Num); - end - else begin - ShowCategoryList; - end; -end; - -//Hide Categorys when in Category Hack -procedure TCatSongs.ShowCategoryList; -var - Num, S: integer; -begin - //Hide All Songs Show All Cats - for S := 0 to high(CatSongs.Song) do begin - if CatSongs.Song[S].Main then - CatSongs.Song[S].Visible := true - else - CatSongs.Song[S].Visible := false - end; - CatSongs.Selected := CatNumShow; //Show last shown Category - CatNumShow := -1; -end; -//Hide Categorys when in Category Hack End - -//Wrong song selected when tabs on bug -function TCatSongs.FindNextVisible(SearchFrom:integer): integer;//Find next Visible Song -var - I: Integer; - begin - Result := -1; - I := SearchFrom + 1; - while not CatSongs.Song[I].Visible do - begin - Inc (I); - if (I>high(CatSongs.Song)) then - I := low(CatSongs.Song); - if (I = SearchFrom) then //Make One Round and no song found->quit - break; - end; - end; -//Wrong song selected when tabs on bug End - -function TCatSongs.VisibleSongs: integer; -var - S: integer; // song -begin - Result := 0; - for S := 0 to high(CatSongs.Song) do - if CatSongs.Song[S].Visible = true then Inc(Result); -end; - -function TCatSongs.VisibleIndex(Index: integer): integer; -var - S: integer; // song -begin - Result := 0; - for S := 0 to Index-1 do - if CatSongs.Song[S].Visible = true then Inc(Result); -end; - -function TCatSongs.SetFilter(FilterStr: String; const fType: Byte): Cardinal; -var - I, J: Integer; - cString: String; - SearchStr: Array of String; -begin - {fType: 0: All - 1: Title - 2: Artist} - FilterStr := Trim(FilterStr); - if FilterStr<>'' then begin - Result := 0; - //Create Search Array - SetLength(SearchStr, 1); - I := Pos (' ', FilterStr); - While (I <> 0) do - begin - SetLength (SearchStr, Length(SearchStr) + 1); - cString := Copy(FilterStr, 1, I-1); - if (cString <> ' ') AND (cString <> '') then - SearchStr[High(SearchStr)-1] := cString; - Delete (FilterStr, 1, I); - - I := Pos (' ', FilterStr); - end; - //Copy last Word - if (FilterStr <> ' ') AND (FilterStr <> '') then - SearchStr[High(SearchStr)] := FilterStr; - - for I:=0 to High(Song) do begin - if not Song[i].Main then - begin - case fType of - 0: cString := Song[I].Artist + ' ' + Song[i].Title + ' ' + Song[i].Folder; - 1: cString := Song[I].Title; - 2: cString := Song[I].Artist; - end; - Song[i].Visible:=True; - //Look for every Searched Word - For J := 0 to High(SearchStr) do - begin - Song[i].Visible := Song[i].Visible AND AnsiContainsText(cString, SearchStr[J]) - end; - if Song[i].Visible then - Inc(Result); - end - else - Song[i].Visible:=False; - end; - CatNumShow := -2; - end - else begin - for i:=0 to High(Song) do begin - Song[i].Visible:=(Ini.Tabs=1)=Song[i].Main; - CatNumShow := -1; - end; - Result := 0; - end; -end; - -end. +unit USongs; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + {$IFDEF MSWINDOWS} + Windows, + {$ifdef Delphi} + DirWatch, + {$endif} + {$ELSE} + {$IFNDEF DARWIN} + oldlinux, + syscall, + {$ENDIF} + baseunix, + UnixType, + {$ENDIF} + SysUtils, + Classes, + ULog, + UTexture, + UCommon, + {$IFDEF DARWIN} + cthreads, + {$ENDIF} + UCatCovers; + +type + + TBPM = record + BPM: real; + StartBeat: real; + end; + + TScore = record + Name: widestring; + Score: integer; + Length: string; + end; + + TSong = record + Path: widestring; + Folder: widestring; // for sorting by folder + FileName: widestring; + + // sorting methods + Category: array of widestring; // I think I won't need this + Genre: widestring; + Edition: widestring; + Language: widestring; // 0.5.0: new + + Title: widestring; + Artist: widestring; + + Text: widestring; + Creator: widestring; + + Cover: widestring; + CoverTex: TTexture; + Mp3: widestring; + Background: widestring; + Video: widestring; + VideoGAP: real; + VideoLoaded: boolean; // 0.5.0: true if the video has been loaded + NotesGAP: integer; + Start: real; // in seconds + Finish: integer; // in miliseconds + Relative: boolean; + Resolution: integer; + BPM: array of TBPM; + GAP: real; // in miliseconds + + Score: array[0..2] of array of TScore; + + // these are used when sorting is enabled + Visible: boolean; // false if hidden, true if visible + Main: boolean; // false for songs, true for category buttons + OrderNum: integer; // has a number of category for category buttons and songs + OrderTyp: integer; // type of sorting for this button (0=name) + CatNumber: integer; // Count of Songs in Category for Cats and Number of Song in Category for Songs + end; + + TSongs = class( TThread ) + private + BrowsePos : Cardinal; //Actual Pos in Song Array + fNotify , + fWatch : longint; + fParseSongDirectory : boolean; + fProcessing : boolean; + {$ifdef Delphi} + fDirWatch : TDirectoryWatch; + {$endif} + procedure int_LoadSongList; + procedure DoDirChanged(Sender: TObject); + protected + procedure Execute; override; + public + Song : array of TSong; // array of songs + Selected : integer; // selected song index + constructor create(); + procedure LoadSongList; // load all songs + procedure BrowseDir(Dir: widestring); // should return number of songs in the future + procedure Sort(Order: integer); + function FindSongFile(Dir, Mask: widestring): widestring; + property Processing : boolean read fProcessing; + end; + + TCatSongs = class + Song: array of TSong; // array of categories with songs + Selected: integer; // selected song index + Order: integer; // order type (0=title) + CatNumShow: integer; // Category Number being seen + CatCount: integer; //Number of Categorys + + procedure Refresh; // refreshes arrays by recreating them from Songs array +// procedure Sort(Order: integer); + procedure ShowCategory(Index: integer); // expands all songs in category + procedure HideCategory(Index: integer); // hides all songs in category + procedure ClickCategoryButton(Index: integer); // uses ShowCategory and HideCategory when needed + procedure ShowCategoryList; //Hides all Songs And Show the List of all Categorys + function FindNextVisible(SearchFrom:integer): integer; //Find Next visible Song + function VisibleSongs: integer; // returns number of visible songs (for tabs) + function VisibleIndex(Index: integer): integer; // returns visible song index (skips invisible) + + function SetFilter(FilterStr: String; const fType: Byte): Cardinal; + end; + +var + Songs: TSongs; // all songs + CatSongs: TCatSongs; // categorized songs + AktSong: TSong; // one song *unknown use) + +const + IN_ACCESS = $00000001; //* File was accessed */ + IN_MODIFY = $00000002; //* File was modified */ + IN_ATTRIB = $00000004; //* Metadata changed */ + IN_CLOSE_WRITE = $00000008; //* Writtable file was closed */ + IN_CLOSE_NOWRITE = $00000010; //* Unwrittable file closed */ + IN_OPEN = $00000020; //* File was opened */ + IN_MOVED_FROM = $00000040; //* File was moved from X */ + IN_MOVED_TO = $00000080; //* File was moved to Y */ + IN_CREATE = $00000100; //* Subfile was created */ + IN_DELETE = $00000200; //* Subfile was deleted */ + IN_DELETE_SELF = $00000400; //* Self was deleted */ + + +implementation + +uses StrUtils, + UGraphic, + UCovers, + UFiles, + UMain, + UIni; + +{$IFDEF DARWIN} +function AnsiContainsText(const AText, ASubText: string): Boolean; +begin + Result := AnsiPos(AnsiUppercase(ASubText), AnsiUppercase(AText)) > 0; +end; +{$ENDIF} + +constructor TSongs.create(); +begin + inherited create( false ); + self.freeonterminate := true; + + {$ifdef Delphi} + fDirWatch := TDirectoryWatch.create(nil); + fDirWatch.OnChange := DoDirChanged; + fDirWatch.Directory := SongPath; + fDirWatch.WatchSubDirs := true; + fDirWatch.active := true; + {$ENDIF} + + {$IFDEF linux} + (* + Thankyou to : http://www.linuxjournal.com/article/8478 + http://www.tin.org/bin/man.cgi?section=2&topic=inotify_add_watch + *) +(* + fNotify := -1; + fWatch := -1; + + writeln( 'Calling inotify_init' ); + fNotify := Do_SysCall( syscall_nr_inotify_init ); + if ( fNotify < 0 ) then + writeln( 'Filesystem change notification - disabled' ); + writeln( 'Calling inotify_init : '+ inttostr(fNotify) ); + + writeln( 'Calling syscall_nr_inotify_init ('+SongPath+')' ); + fWatch := Do_SysCall( syscall_nr_inotify_init , TSysParam( fNotify ), longint( pchar( SongPath ) ) , IN_MODIFY AND IN_CREATE AND IN_DELETE ); + + if (fWatch < 0) then + writeln ('inotify_add_watch'); + writeln( 'Calling syscall_nr_inotify_init : '+ inttostr(fWatch) ); +*) + {$endif} + + Setlength(Song, 0); +end; + +procedure TSongs.DoDirChanged(Sender: TObject); +begin + LoadSongList(); +end; + +procedure TSongs.Execute(); +var + fChangeNotify : THandle; +begin + fParseSongDirectory := true; + + while not self.terminated do + begin + + if fParseSongDirectory then + begin + writeln( 'int_LoadSongList' ); + int_LoadSongList(); + end; + + self.suspend; + end; + +end; + +procedure TSongs.int_LoadSongList; +begin + try + fProcessing := true; + Setlength(Song, 0); + + Log.LogError('SongList', 'Searching For Songs'); + + Setlength(Song, 50); + + BrowsePos := 0; + // browse directories + BrowseDir(SongPath); + + //Set Correct SongArray Length + SetLength(Song, BrowsePos); + + if assigned( CatSongs ) then + CatSongs.Refresh; + + if assigned( CatCovers ) then + CatCovers.Load; + + if assigned( Covers ) then + Covers.Load; + + if assigned(ScreenSong) then + begin + ScreenSong.GenerateThumbnails(); + ScreenSong.OnShow; // refresh ScreenSong + end; + + + finally + Log.LogError('SongList', 'Search Complete'); + + fParseSongDirectory := false; + fProcessing := false; + end; +end; + + +procedure TSongs.LoadSongList; +begin + fParseSongDirectory := true; + self.resume; +end; + +// TODO : JB - THis whole function SUX ! and needs refactoring ! :P +procedure TSongs.BrowseDir(Dir: widestring); +var + SLen: integer; + + {$ifdef Delphi} + SR: TSearchRecW; // for parsing Songs Directory + {$ENDIF} + + // eddie: can we merge that? is baseunix working on linux? oldlinux is + // not available on mac os x. + {$IFDEF LINUX} + TheDir : oldlinux.pdir; + ADirent : oldlinux.pDirent; + Entry : Longint; + info : oldlinux.stat; + {$ENDIF} + {$IFDEF DARWIN} + TheDir : pdir; + ADirent : pDirent; + Entry : Longint; + info : stat; + {$ENDIF} +begin + {$ifdef Delphi} + if FindFirstW(Dir + '*', faDirectory, SR) = 0 then // JB_Unicode - windows + begin + repeat + if (SR.Name <> '.') and (SR.Name <> '..') then + begin + BrowseDir(Dir + Sr.Name + PathDelim); + end + until FindNextw(SR) <> 0; + end; // if + FindClosew(SR); + + if FindFirstW(Dir + '*.txt', 0, SR) = 0 then + begin + repeat + SLen := BrowsePos; + + Song[SLen].Path := Dir; + Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); + Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); + Song[SLen].FileName := SR.Name; + + if (AnalyseFile(Song[SLen]) = false) then + Dec(BrowsePos) + else + begin + if Song[SLen].Cover = '' then + Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); + end; + + //Change Length Only every 50 Entrys + Inc(BrowsePos); + + if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then + begin + SetLength(Song, Length(Song) + 50); + end; + + until FindNextW(SR) <> 0; + end; // if FindFirst + FindCloseW(SR); + {$ENDIF} + + {$IFDEF LINUX} + // Itterate the Songs Directory... ( With unicode capable functions for linux ) + TheDir := oldlinux.opendir( Dir ); // JB_Unicode - linux + if TheDir <> nil then + begin + repeat + ADirent := oldlinux.ReadDir(TheDir); + + If ADirent<>Nil then + begin + With ADirent^ do + begin + + if ( name[0] <> '.') then + BrowseDir( Dir + name + pathdelim ); + + end; + end; + Until ADirent=Nil; + end; + + + + TheDir := oldlinux.opendir( Dir ); // JB_Unicode - linux + if TheDir <> nil then + begin + repeat + ADirent := oldlinux.ReadDir(TheDir); + + if ( ADirent <> Nil ) AND + ( pos( '.txt', ADirent^.name ) > 0 ) then + begin + writeln ('***** FOUND TXT' + ADirent^.name ); + + SLen := BrowsePos; + + Song[SLen].Path := Dir; + Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); + Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); + Song[SLen].FileName := ADirent^.name; + + if (AnalyseFile(Song[SLen]) = false) then + Dec(BrowsePos) + else + begin + if Song[SLen].Cover = '' then + Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); + end; + + //Change Length Only every 50 Entrys + Inc(BrowsePos); + if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then + begin + SetLength(Song, Length(Song) + 50); + end; + end; + + Until ADirent=Nil; + end; // if FindFirst + {$endif} + + {$IFDEF DARWIN} + // Itterate the Songs Directory... ( With unicode capable functions for linux ) + TheDir := FPOpenDir( Dir ); // JB_Unicode - linux + if TheDir <> nil then + begin + repeat + ADirent := FPReadDir(TheDir); + + If ADirent<>Nil then + begin + With ADirent^ do + begin + + if ( d_name[0] <> '.') then + BrowseDir( Dir + d_name + pathdelim ); + + end; + end; + Until ADirent=Nil; + end; + + + + TheDir := FPOpenDir( Dir ); // JB_Unicode - linux + if TheDir <> nil then + begin + repeat + ADirent := FPReadDir(TheDir); + + if ( ADirent <> Nil ) AND + ( pos( '.txt', ADirent^.d_name ) > -1 ) then + begin + SLen := BrowsePos; + + Song[SLen].Path := Dir; + Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); + Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); + Song[SLen].FileName := ADirent^.d_name; + + if (AnalyseFile(Song[SLen]) = false) then + Dec(BrowsePos) + else + begin + if Song[SLen].Cover = '' then + Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); + end; + + //Change Length Only every 50 Entrys + Inc(BrowsePos); + + if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then + begin + SetLength(Song, Length(Song) + 50); + end; + end; + + Until ADirent=Nil; + end; // if FindFirst + + {$endif} + +// Log.LogStatus('Parsing directory: ' + Dir + SR.Name, 'LoadSongList'); + + +end; + +procedure TSongs.Sort(Order: integer); +var + S: integer; + S2: integer; + TempSong: TSong; +begin + case Order of + sEdition: // by edition + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Edition, Song[S-1].Edition) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sGenre: // by genre + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Genre, Song[S-1].Genre) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sTitle: // by title + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + + end; + sArtist: // by artist + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sFolder: // by folder + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Folder, Song[S-1].Folder) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sTitle2: // by title2 + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + + end; + sArtist2: // by artist2 + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin + // zamiana miejscami + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + sLanguage: // by Language + begin + for S2 := 0 to Length(Song)-1 do + for S := 1 to Length(Song)-1 do + if CompareText(Song[S].Language, Song[S-1].Language) < 0 then begin + TempSong := Song[S-1]; + Song[S-1] := Song[S]; + Song[S] := TempSong; + end; + end; + + end; // case +end; + +function TSongs.FindSongFile(Dir, Mask: widestring): widestring; +var + SR: TSearchRec; // for parsing song directory +begin + Result := ''; + if FindFirst(Dir + Mask, faDirectory, SR) = 0 then begin + Result := SR.Name; + end; // if + FindClose(SR); +end; + +procedure TCatSongs.Refresh; +var + S: integer; // temporary song index + CatLen: integer; // length of CatSongs.Song + Letter: char; // current letter for sorting using letter + SS: string; // current edition for sorting using edition, genre etc. + Order: integer; // number used for ordernum + Letter2: char; // + CatNumber:integer; // Number of Song in Category +begin + CatNumShow := -1; +// Songs.Sort(0); // by title + +case Ini.Sorting of + sEdition: begin + Songs.Sort(sArtist); + Songs.Sort(sEdition); + end; + sGenre: begin + Songs.Sort(sArtist); + Songs.Sort(sGenre); + end; + sLanguage: begin + Songs.Sort(sArtist); + Songs.Sort(sLanguage); + end; + sFolder: begin + Songs.Sort(sArtist); + Songs.Sort(sFolder); + end; + sTitle: Songs.Sort(sTitle); + sArtist: Songs.Sort(sArtist); + sTitle2: Songs.Sort(sTitle2); // by title2 + sArtist2: Songs.Sort(sArtist2); // by artist2 + + end; // case + + + Letter := ' '; + SS := ''; + Order := 0; + CatNumber := 0; + + //Songs leeren + SetLength (Song, 0); + + for S := Low(Songs.Song) to High(Songs.Song) do begin + if (Ini.Tabs = 1) then + if (Ini.Sorting = sEdition) and (CompareText(SS, Songs.Song[S].Edition) <> 0) then begin + // add Category Button + Inc(Order); + SS := Songs.Song[S].Edition; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + SS + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + + + // 0.4.3 + // if SS = 'Singstar' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Part 2' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar German' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Spanish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Italian' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar French' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Party' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Party.jpg'; + // if SS = 'Singstar Popworld' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Popworld.jpg'; + // if SS = 'Singstar 80s' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; + // if SS = 'Singstar 80s Polish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; + // if SS = 'Singstar Rocks' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Rocks.jpg'; + // if SS = 'Singstar Anthems' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Anthems.jpg'; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';//} + + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sGenre) and (CompareText(SS, Songs.Song[S].Genre) <> 0) then begin + // add Genre Button + Inc(Order); + SS := Songs.Song[S].Genre; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sLanguage) and (CompareText(SS, Songs.Song[S].Language) <> 0) then begin + // add Language Button + Inc(Order); + SS := Songs.Song[S].Language; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sTitle) and + (Length(Songs.Song[S].Title)>=1) and + (Letter <> UpperCase(Songs.Song[S].Title)[1]) then begin + // add a letter Category Button + Inc(Order); + Letter := Uppercase(Songs.Song[S].Title)[1]; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + + {// cover-patch + if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sArtist) and (Length(Songs.Song[S].Artist)>=1) and (Letter <> UpperCase(Songs.Song[S].Artist)[1]) then begin + // add a letter Category Button + Inc(Order); + Letter := UpperCase(Songs.Song[S].Artist)[1]; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sFolder) and (CompareText(SS, Songs.Song[S].Folder) <> 0) then begin + // 0.5.0: add folder tab + Inc(Order); + SS := Songs.Song[S].Folder; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sTitle2) AND (Length(Songs.Song[S].Title)>=1) then begin + if (ord(Songs.Song[S].Title[1]) > 47) and (ord(Songs.Song[S].Title[1]) < 58) then Letter2 := '#' else Letter2 := UpperCase(Songs.Song[S].Title)[1]; + if (Letter <> Letter2) then begin + // add a letter Category Button + Inc(Order); + Letter := Letter2; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end; + end + + else if (Ini.Sorting = sArtist2) AND (Length(Songs.Song[S].Artist)>=1) then begin + if (ord(Songs.Song[S].Artist[1]) > 47) and (ord(Songs.Song[S].Artist[1]) < 58) then Letter2 := '#' else Letter2 := UpperCase(Songs.Song[S].Artist)[1]; + if (Letter <> Letter2) then begin + // add a letter Category Button + Inc(Order); + Letter := Letter2; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end; + end; + + + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + + Inc (CatNumber); //Increase Number in Cat + + CatSongs.Song[CatLen] := Songs.Song[S]; + CatSongs.Song[CatLen].OrderNum := Order; // assigns category + CatSongs.Song[CatLen].CatNumber := CatNumber; + + if (Ini.Tabs = 0) then CatSongs.Song[CatLen].Visible := true + else if (Ini.Tabs = 1) then CatSongs.Song[CatLen].Visible := false; +// if (Ini.Tabs = 1) and (Order = 1) then CatSongs.Song[CatLen].Visible := true; // open first tab +//CatSongs.Song[CatLen].Visible := true; + + end; +//CatNumber Patch - Set CatNumber of Last Category +if (ini.Tabs_at_startup = 1) And (high(Song) >=1) then + Song[CatLen - CatNumber].CatNumber := CatNumber;//Set CatNumber of Categroy +//CatCount Patch +CatCount := Order; +end; + +procedure TCatSongs.ShowCategory(Index: integer); +var + S: integer; // song +begin + CatNumShow := Index; + for S := 0 to high(CatSongs.Song) do + begin + if (CatSongs.Song[S].OrderNum = Index) AND (Not CatSongs.Song[S].Main) then + CatSongs.Song[S].Visible := true + else + CatSongs.Song[S].Visible := false; + end; +end; + +procedure TCatSongs.HideCategory(Index: integer); // hides all songs in category +var + S: integer; // song +begin + for S := 0 to high(CatSongs.Song) do begin + if not CatSongs.Song[S].Main then + CatSongs.Song[S].Visible := false // hides all at now + end; +end; + +procedure TCatSongs.ClickCategoryButton(Index: integer); +var + Num, S: integer; +begin + Num := CatSongs.Song[Index].OrderNum; + if Num <> CatNumShow then + begin + ShowCategory(Num); + end + else begin + ShowCategoryList; + end; +end; + +//Hide Categorys when in Category Hack +procedure TCatSongs.ShowCategoryList; +var + Num, S: integer; +begin + //Hide All Songs Show All Cats + for S := 0 to high(CatSongs.Song) do begin + if CatSongs.Song[S].Main then + CatSongs.Song[S].Visible := true + else + CatSongs.Song[S].Visible := false + end; + CatSongs.Selected := CatNumShow; //Show last shown Category + CatNumShow := -1; +end; +//Hide Categorys when in Category Hack End + +//Wrong song selected when tabs on bug +function TCatSongs.FindNextVisible(SearchFrom:integer): integer;//Find next Visible Song +var + I: Integer; + begin + Result := -1; + I := SearchFrom + 1; + while not CatSongs.Song[I].Visible do + begin + Inc (I); + if (I>high(CatSongs.Song)) then + I := low(CatSongs.Song); + if (I = SearchFrom) then //Make One Round and no song found->quit + break; + end; + end; +//Wrong song selected when tabs on bug End + +function TCatSongs.VisibleSongs: integer; +var + S: integer; // song +begin + Result := 0; + for S := 0 to high(CatSongs.Song) do + if CatSongs.Song[S].Visible = true then Inc(Result); +end; + +function TCatSongs.VisibleIndex(Index: integer): integer; +var + S: integer; // song +begin + Result := 0; + for S := 0 to Index-1 do + if CatSongs.Song[S].Visible = true then Inc(Result); +end; + +function TCatSongs.SetFilter(FilterStr: String; const fType: Byte): Cardinal; +var + I, J: Integer; + cString: String; + SearchStr: Array of String; +begin + {fType: 0: All + 1: Title + 2: Artist} + FilterStr := Trim(FilterStr); + if FilterStr<>'' then begin + Result := 0; + //Create Search Array + SetLength(SearchStr, 1); + I := Pos (' ', FilterStr); + While (I <> 0) do + begin + SetLength (SearchStr, Length(SearchStr) + 1); + cString := Copy(FilterStr, 1, I-1); + if (cString <> ' ') AND (cString <> '') then + SearchStr[High(SearchStr)-1] := cString; + Delete (FilterStr, 1, I); + + I := Pos (' ', FilterStr); + end; + //Copy last Word + if (FilterStr <> ' ') AND (FilterStr <> '') then + SearchStr[High(SearchStr)] := FilterStr; + + for I:=0 to High(Song) do begin + if not Song[i].Main then + begin + case fType of + 0: cString := Song[I].Artist + ' ' + Song[i].Title + ' ' + Song[i].Folder; + 1: cString := Song[I].Title; + 2: cString := Song[I].Artist; + end; + Song[i].Visible:=True; + //Look for every Searched Word + For J := 0 to High(SearchStr) do + begin + Song[i].Visible := Song[i].Visible AND AnsiContainsText(cString, SearchStr[J]) + end; + if Song[i].Visible then + Inc(Result); + end + else + Song[i].Visible:=False; + end; + CatNumShow := -2; + end + else begin + for i:=0 to High(Song) do begin + Song[i].Visible:=(Ini.Tabs=1)=Song[i].Main; + CatNumShow := -1; + end; + Result := 0; + end; +end; + +end. diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 index b8f1379d..3dd9e158 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 @@ -186,6 +186,46 @@ OpenEditors + + Content + + PBXProjectModuleGUID + 2C0C2C180CDC7312004A651F + PBXProjectModuleLabel + USongs.pas + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 2C0C2C190CDC7312004A651F + PBXProjectModuleLabel + USongs.pas + _historyCapacity + 0 + bookmark + 2CD3B28C0CDC76B6001F1030 + history + + 2CD3B2550CDC7564001F1030 + + + SplitCount + 1 + + StatusBarVisibility + + + Geometry + + Frame + {{0, 20}, {797, 748}} + PBXModuleWindowStatusBarHidden2 + + RubberWindowFrame + 84 171 797 789 0 0 1680 1028 + + Content @@ -204,10 +244,10 @@ _historyCapacity 0 bookmark - 2C4FA2BB0CDBB0F2002CC3B0 + 2CD3B28D0CDC76B6001F1030 history - 2C4FA2B10CDBB0CF002CC3B0 + 2C0C2C430CDC73BE004A651F SplitCount @@ -244,10 +284,10 @@ _historyCapacity 0 bookmark - 2C4FA2BC0CDBB0F2002CC3B0 + 2CD3B28E0CDC76B6001F1030 history - 2CDC71AC0CDBA6300018F966 + 2C0C2C450CDC73BE004A651F SplitCount @@ -284,10 +324,10 @@ _historyCapacity 0 bookmark - 2C4FA2BD0CDBB0F2002CC3B0 + 2CD3B28F0CDC76B6001F1030 history - 2CDC71AE0CDBA6300018F966 + 2C0C2C460CDC73BE004A651F SplitCount @@ -324,10 +364,10 @@ _historyCapacity 0 bookmark - 2C4FA2BE0CDBB0F2002CC3B0 + 2CD3B2900CDC76B6001F1030 history - 2CDC71AF0CDBA6300018F966 + 2C0C2C470CDC73BE004A651F SplitCount @@ -364,10 +404,10 @@ _historyCapacity 0 bookmark - 2C4FA2BF0CDBB0F2002CC3B0 + 2CD3B2910CDC76B6001F1030 history - 2CDC71B00CDBA6300018F966 + 2C0C2C480CDC73BE004A651F SplitCount @@ -404,10 +444,10 @@ _historyCapacity 0 bookmark - 2C4FA2C00CDBB0F2002CC3B0 + 2CD3B2920CDC76B6001F1030 history - 2CDC71B10CDBA6300018F966 + 2C0C2C490CDC73BE004A651F SplitCount @@ -444,10 +484,10 @@ _historyCapacity 0 bookmark - 2C4FA2C10CDBB0F2002CC3B0 + 2CD3B2930CDC76B6001F1030 history - 2CDC71B20CDBA6300018F966 + 2C0C2C4A0CDC73BE004A651F SplitCount @@ -484,10 +524,10 @@ _historyCapacity 0 bookmark - 2C4FA2C20CDBB0F2002CC3B0 + 2CD3B2940CDC76B6001F1030 history - 2CDC71B30CDBA6300018F966 + 2C0C2C4B0CDC73BE004A651F SplitCount @@ -691,9 +731,9 @@ TableOfContents - 2C4FA2940CDBAB21002CC3B0 + 2CD3B23F0CDC7545001F1030 1CE0B1FE06471DED0097A5F4 - 2C4FA2950CDBAB21002CC3B0 + 2CD3B2400CDC7545001F1030 1CE0B20306471E060097A5F4 1CE0B20506471E060097A5F4 @@ -827,8 +867,11 @@ 5 WindowOrderList + 2CD3B2610CDC7564001F1030 + 2CD3B2620CDC7564001F1030 + 2CDD4BFC0CB948FC00549FAC 2CDD4B730CB935C700549FAC - 2C4FA2A50CDBAB21002CC3B0 + 2CD3B2500CDC7545001F1030 2CF5528D0CDA426600627463 2CF553750CDA575B00627463 2CF553720CDA575B00627463 @@ -836,9 +879,11 @@ 2CF552930CDA426600627463 2CF552960CDA426600627463 2CF5536C0CDA575B00627463 - 1CD10A99069EF8BA00B06720 2CF552990CDA426600627463 + 1C0AD2B3069F1EA900FABCE6 /Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj + 2C0C2C180CDC7312004A651F + 1CD10A99069EF8BA00B06720 WindowString 772 270 817 753 0 0 1680 1028 @@ -869,14 +914,14 @@ GeometryConfiguration Frame - {{0, 0}, {1318, 344}} + {{0, 0}, {1346, 566}} RubberWindowFrame - 312 244 1318 626 0 0 1680 1028 + 106 169 1346 848 0 0 1680 1028 Module PBXNavigatorGroup Proportion - 344pt + 566pt ContentConfiguration @@ -893,9 +938,9 @@ GeometryConfiguration Frame - {{0, 349}, {1318, 236}} + {{0, 571}, {1346, 236}} RubberWindowFrame - 312 244 1318 626 0 0 1680 1028 + 106 169 1346 848 0 0 1680 1028 Module PBXBuildResultsModule @@ -904,7 +949,7 @@ Proportion - 585pt + 807pt Name @@ -918,14 +963,14 @@ TableOfContents 2CDD4B730CB935C700549FAC - 2C4FA2BA0CDBB0CF002CC3B0 + 2CD3B25F0CDC7564001F1030 1CD0528F0623707200166675 XCMainBuildResultsModuleGUID ToolbarConfiguration xcode.toolbar.config.build WindowString - 312 244 1318 626 0 0 1680 1028 + 106 169 1346 848 0 0 1680 1028 WindowToolGUID 2CDD4B730CB935C700549FAC WindowToolIsVisible @@ -960,8 +1005,8 @@ yes sizes - {{0, 0}, {354, 414}} - {{354, 0}, {610, 414}} + {{0, 0}, {347, 414}} + {{347, 0}, {617, 414}} VerticalSplitView @@ -1024,14 +1069,14 @@ TableOfContents 1CD10A99069EF8BA00B06720 - 2C4FA29F0CDBAB21002CC3B0 + 2CD3B24A0CDC7545001F1030 1C162984064C10D400B95A72 - 2C4FA2A00CDBAB21002CC3B0 - 2C4FA2A10CDBAB21002CC3B0 - 2C4FA2A20CDBAB21002CC3B0 - 2C4FA2A30CDBAB21002CC3B0 - 2C4FA2A40CDBAB21002CC3B0 - 2C4FA2A50CDBAB21002CC3B0 + 2CD3B24B0CDC7545001F1030 + 2CD3B24C0CDC7545001F1030 + 2CD3B24D0CDC7545001F1030 + 2CD3B24E0CDC7545001F1030 + 2CD3B24F0CDC7545001F1030 + 2CD3B2500CDC7545001F1030 ToolbarConfiguration xcode.toolbar.config.debug @@ -1185,7 +1230,7 @@ TableOfContents 2CDD4BFC0CB948FC00549FAC - 2CDC71900CDB9D2D0018F966 + 2CD3B2600CDC7564001F1030 1C78EAAC065D492600B07095 WindowString @@ -1280,9 +1325,9 @@ TableOfContents 1C0AD2B3069F1EA900FABCE6 - 2C6FEC9A0CC8021800D0C913 + 2CD3B2510CDC7545001F1030 1CD0528B0623707200166675 - 2C6FEC9B0CC8021800D0C913 + 2CD3B2520CDC7545001F1030 ToolbarConfiguration xcode.toolbar.config.run @@ -1291,7 +1336,7 @@ WindowToolGUID 1C0AD2B3069F1EA900FABCE6 WindowToolIsVisible - + FirstTimeWindowDisplayed diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser index 3bb5dffc..af8b639d 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser @@ -1,5 +1,85 @@ // !$*UTF8*$! { + 2C0C2C430CDC73BE004A651F /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; + name = "UMain.pas: 15"; + rLen = 0; + rLoc = 198; + rType = 0; + vrLen = 637; + vrLoc = 0; + }; + 2C0C2C450CDC73BE004A651F /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; + name = "UltraStarDX.pas: 6"; + rLen = 0; + rLoc = 117; + rType = 0; + vrLen = 131; + vrLoc = 0; + }; + 2C0C2C460CDC73BE004A651F /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; + name = "UAudio_FFMpeg.pas: 952"; + rLen = 0; + rLoc = 22697; + rType = 0; + vrLen = 1224; + vrLoc = 21473; + }; + 2C0C2C470CDC73BE004A651F /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; + name = "nux ... is t"; + rLen = 12; + rLoc = 3202; + rType = 0; + vrLen = 1266; + vrLoc = 15619; + }; + 2C0C2C480CDC73BE004A651F /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; + name = "sdl_image.pas: 130"; + rLen = 0; + rLoc = 8020; + rType = 0; + vrLen = 832; + vrLoc = 7978; + }; + 2C0C2C490CDC73BE004A651F /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; + name = "sdl.pas: 250"; + rLen = 0; + rLoc = 16506; + rType = 0; + vrLen = 886; + vrLoc = 16376; + }; + 2C0C2C4A0CDC73BE004A651F /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; + name = "ScaledTexture(TexSur"; + rLen = 20; + rLoc = 11816; + rType = 0; + vrLen = 1220; + vrLoc = 11189; + }; + 2C0C2C4B0CDC73BE004A651F /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; + name = "Windows.pas: 114"; + rLen = 0; + rLoc = 2832; + rType = 0; + vrLen = 1182; + vrLoc = 2090; + }; 2C4D9C620CC9EC8C0031092D /* TextGL.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {758, 7742}}"; @@ -26,9 +106,9 @@ }; 2C4D9C650CC9EC8C0031092D /* UCatCovers.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {764, 2128}}"; - sepNavSelRange = "{352, 0}"; - sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavIntBoundsRect = "{{0, 0}, {923, 2128}}"; + sepNavSelRange = "{1154, 0}"; + sepNavVisRect = "{{0, 354}, {923, 342}}"; sepNavWindowFrame = "{{61, 136}, {797, 845}}"; }; }; @@ -50,9 +130,9 @@ }; 2C4D9C680CC9EC8C0031092D /* UCore.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1136, 6888}}"; - sepNavSelRange = "{13272, 0}"; - sepNavVisRect = "{{0, 6145}, {758, 716}}"; + sepNavIntBoundsRect = "{{0, 0}, {1305, 7028}}"; + sepNavSelRange = "{12989, 64}"; + sepNavVisRect = "{{0, 6320}, {1305, 534}}"; sepNavWindowFrame = "{{107, 94}, {797, 845}}"; }; }; @@ -74,9 +154,9 @@ }; 2C4D9C6B0CC9EC8C0031092D /* UDataBase.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {4058, 5026}}"; - sepNavSelRange = "{60, 19}"; - sepNavVisRect = "{{0, 0}, {1277, 312}}"; + sepNavIntBoundsRect = "{{0, 0}, {4058, 5082}}"; + sepNavSelRange = "{1600, 0}"; + sepNavVisRect = "{{0, 1250}, {923, 342}}"; sepNavWindowFrame = "{{153, 52}, {797, 845}}"; }; }; @@ -106,9 +186,9 @@ }; 2C4D9C6F0CC9EC8C0031092D /* UGraphic.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {830, 9800}}"; - sepNavSelRange = "{872, 16}"; - sepNavVisRect = "{{0, 391}, {758, 716}}"; + sepNavIntBoundsRect = "{{0, 0}, {923, 10444}}"; + sepNavSelRange = "{15582, 0}"; + sepNavVisRect = "{{0, 6612}, {923, 342}}"; sepNavWindowFrame = "{{38, 157}, {797, 845}}"; }; }; @@ -146,9 +226,9 @@ }; 2C4D9C740CC9EC8C0031092D /* ULanguage.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {758, 3290}}"; - sepNavSelRange = "{46, 0}"; - sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavIntBoundsRect = "{{0, 0}, {923, 3346}}"; + sepNavSelRange = "{1257, 0}"; + sepNavVisRect = "{{0, 914}, {923, 342}}"; sepNavWindowFrame = "{{153, 52}, {797, 845}}"; }; }; @@ -194,9 +274,9 @@ }; 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1013, 15078}}"; - sepNavSelRange = "{3441, 0}"; - sepNavVisRect = "{{0, 1682}, {1013, 614}}"; + sepNavIntBoundsRect = "{{0, 0}, {1013, 15456}}"; + sepNavSelRange = "{198, 0}"; + sepNavVisRect = "{{0, 0}, {1013, 614}}"; sepNavWindowFrame = "{{222, 91}, {1052, 743}}"; }; }; @@ -298,9 +378,9 @@ }; 2C4D9C890CC9EC8C0031092D /* USongs.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {950, 14616}}"; - sepNavSelRange = "{7664, 0}"; - sepNavVisRect = "{{0, 3738}, {758, 716}}"; + sepNavIntBoundsRect = "{{0, 0}, {950, 14686}}"; + sepNavSelRange = "{503, 0}"; + sepNavVisRect = "{{0, 2095}, {758, 716}}"; sepNavWindowFrame = "{{84, 115}, {797, 845}}"; }; }; @@ -314,9 +394,9 @@ }; 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1730, 16016}}"; - sepNavSelRange = "{11823, 20}"; - sepNavVisRect = "{{0, 5156}, {577, 612}}"; + sepNavIntBoundsRect = "{{0, 0}, {1730, 15960}}"; + sepNavSelRange = "{11816, 20}"; + sepNavVisRect = "{{0, 4988}, {577, 612}}"; sepNavWindowFrame = "{{15, 282}, {616, 741}}"; }; }; @@ -503,27 +583,37 @@ sepNavWindowFrame = "{{15, 282}, {616, 741}}"; }; }; - 2C4FA2B10CDBB0CF002CC3B0 /* PBXTextBookmark */ = { + 2CD3B2550CDC7564001F1030 /* PBXTextBookmark */ = { isa = PBXTextBookmark; - fRef = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; - name = "UMain.pas: 148"; + fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; + name = "USongs.pas: 39"; rLen = 0; - rLoc = 3441; + rLoc = 503; rType = 0; - vrLen = 1295; - vrLoc = 2495; + vrLen = 753; + vrLoc = 0; }; - 2C4FA2BB0CDBB0F2002CC3B0 /* PBXTextBookmark */ = { + 2CD3B28C0CDC76B6001F1030 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; + name = "USongs.pas: 39"; + rLen = 0; + rLoc = 503; + rType = 0; + vrLen = 1403; + vrLoc = 4615; + }; + 2CD3B28D0CDC76B6001F1030 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; - name = "UMain.pas: 148"; + name = "UMain.pas: 15"; rLen = 0; - rLoc = 3441; + rLoc = 198; rType = 0; - vrLen = 1295; - vrLoc = 2495; + vrLen = 637; + vrLoc = 0; }; - 2C4FA2BC0CDBB0F2002CC3B0 /* PBXTextBookmark */ = { + 2CD3B28E0CDC76B6001F1030 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; name = "UltraStarDX.pas: 6"; @@ -533,7 +623,7 @@ vrLen = 131; vrLoc = 0; }; - 2C4FA2BD0CDBB0F2002CC3B0 /* PBXTextBookmark */ = { + 2CD3B28F0CDC76B6001F1030 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; name = "UAudio_FFMpeg.pas: 952"; @@ -543,7 +633,7 @@ vrLen = 1224; vrLoc = 21473; }; - 2C4FA2BE0CDBB0F2002CC3B0 /* PBXTextBookmark */ = { + 2CD3B2900CDC76B6001F1030 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; name = "nux ... is t"; @@ -553,7 +643,7 @@ vrLen = 1266; vrLoc = 15619; }; - 2C4FA2BF0CDBB0F2002CC3B0 /* PBXTextBookmark */ = { + 2CD3B2910CDC76B6001F1030 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; name = "sdl_image.pas: 130"; @@ -563,7 +653,7 @@ vrLen = 832; vrLoc = 7978; }; - 2C4FA2C00CDBB0F2002CC3B0 /* PBXTextBookmark */ = { + 2CD3B2920CDC76B6001F1030 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; name = "sdl.pas: 250"; @@ -573,17 +663,17 @@ vrLen = 886; vrLoc = 16376; }; - 2C4FA2C10CDBB0F2002CC3B0 /* PBXTextBookmark */ = { + 2CD3B2930CDC76B6001F1030 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; - name = "TempSurface:=TexSur"; + name = "ScaledTexture(TexSur"; rLen = 20; - rLoc = 11823; + rLoc = 11816; rType = 0; vrLen = 1220; - vrLoc = 11066; + vrLoc = 11189; }; - 2C4FA2C20CDBB0F2002CC3B0 /* PBXTextBookmark */ = { + 2CD3B2940CDC76B6001F1030 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; name = "Windows.pas: 114"; @@ -601,90 +691,6 @@ sepNavWindowFrame = "{{38, 259}, {1052, 743}}"; }; }; - 2CDC71950CDB9D430018F966 /* UMain.pas:156 */ = { - isa = PBXFileBreakpoint; - actions = ( - ); - breakpointStyle = 0; - continueAfterActions = 0; - delayBeforeContinue = 0; - fileReference = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; - hitCount = 1; - lineNumber = 156; - location = UltraStarDX; - modificationTime = 215719249.543694; - state = 1; - }; - 2CDC71AC0CDBA6300018F966 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; - name = "UltraStarDX.pas: 6"; - rLen = 0; - rLoc = 117; - rType = 0; - vrLen = 131; - vrLoc = 0; - }; - 2CDC71AE0CDBA6300018F966 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; - name = "UAudio_FFMpeg.pas: 952"; - rLen = 0; - rLoc = 22697; - rType = 0; - vrLen = 1224; - vrLoc = 21473; - }; - 2CDC71AF0CDBA6300018F966 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; - name = "nux ... is t"; - rLen = 12; - rLoc = 3202; - rType = 0; - vrLen = 1266; - vrLoc = 15619; - }; - 2CDC71B00CDBA6300018F966 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; - name = "sdl_image.pas: 130"; - rLen = 0; - rLoc = 8020; - rType = 0; - vrLen = 832; - vrLoc = 7978; - }; - 2CDC71B10CDBA6300018F966 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; - name = "sdl.pas: 250"; - rLen = 0; - rLoc = 16506; - rType = 0; - vrLen = 886; - vrLoc = 16376; - }; - 2CDC71B20CDBA6300018F966 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; - name = "TempSurface:=TexSur"; - rLen = 20; - rLoc = 11823; - rType = 0; - vrLen = 1220; - vrLoc = 11066; - }; - 2CDC71B30CDBA6300018F966 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; - name = "Windows.pas: 114"; - rLen = 0; - rLoc = 2832; - rType = 0; - vrLen = 1182; - vrLoc = 2090; - }; 2CDD439C0CBBE92D00F364DE /* UMain.pas */ = { isa = PBXFileReference; fileEncoding = 30; @@ -738,8 +744,6 @@ name = "Project Breakpoints"; objects = ( 2CDEA8080CBD7D920096994C /* UMain.pas:293 */, - 2CF553A20CDA59BB00627463 /* UltraStarDX.pas:6 */, - 2CDC71950CDB9D430018F966 /* UMain.pas:156 */, ); }; 2CDEA8080CBD7D920096994C /* UMain.pas:293 */ = { @@ -753,7 +757,7 @@ hitCount = 1; lineNumber = 293; location = UltraStarDX; - modificationTime = 215719244.976517; + modificationTime = 215774704.034014; state = 1; }; 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */ = { @@ -1116,20 +1120,6 @@ sepNavWindowFrame = "{{38, 259}, {1052, 743}}"; }; }; - 2CF553A20CDA59BB00627463 /* UltraStarDX.pas:6 */ = { - isa = PBXFileBreakpoint; - actions = ( - ); - breakpointStyle = 0; - continueAfterActions = 0; - delayBeforeContinue = 0; - fileReference = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; - hitCount = 1; - lineNumber = 6; - location = UltraStarDX; - modificationTime = 215719246.5172511; - state = 1; - }; 9845B6590B1F9B9E0084DD62 /* SDL.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {948, 1330}}"; @@ -1149,8 +1139,8 @@ 98B8BE750B1F97F800162019 /* SDLMain.m */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {948, 5390}}"; - sepNavSelRange = "{558, 0}"; - sepNavVisRect = "{{0, 21}, {948, 730}}"; + sepNavSelRange = "{6150, 21}"; + sepNavVisRect = "{{0, 2650}, {948, 730}}"; sepNavWindowFrame = "{{15, 164}, {987, 859}}"; }; }; @@ -1166,8 +1156,6 @@ ); breakpoints = ( 2CDEA8080CBD7D920096994C /* UMain.pas:293 */, - 2CF553A20CDA59BB00627463 /* UltraStarDX.pas:6 */, - 2CDC71950CDB9D430018F966 /* UMain.pas:156 */, ); breakpointsGroup = 2CDD4B7F0CB9394600549FAC /* XCBreakpointsBucket */; codeSenseManager = 2CDD4B6A0CB9357000549FAC /* Code sense */; @@ -1273,26 +1261,28 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 215722768; - PBXWorkspaceStateSaveDate = 215722768; + PBXPerProjectTemplateStateSaveDate = 215774521; + PBXWorkspaceStateSaveDate = 215774521; }; perUserProjectItems = { - 2C4FA2B10CDBB0CF002CC3B0 /* PBXTextBookmark */ = 2C4FA2B10CDBB0CF002CC3B0 /* PBXTextBookmark */; - 2C4FA2BB0CDBB0F2002CC3B0 /* PBXTextBookmark */ = 2C4FA2BB0CDBB0F2002CC3B0 /* PBXTextBookmark */; - 2C4FA2BC0CDBB0F2002CC3B0 /* PBXTextBookmark */ = 2C4FA2BC0CDBB0F2002CC3B0 /* PBXTextBookmark */; - 2C4FA2BD0CDBB0F2002CC3B0 /* PBXTextBookmark */ = 2C4FA2BD0CDBB0F2002CC3B0 /* PBXTextBookmark */; - 2C4FA2BE0CDBB0F2002CC3B0 /* PBXTextBookmark */ = 2C4FA2BE0CDBB0F2002CC3B0 /* PBXTextBookmark */; - 2C4FA2BF0CDBB0F2002CC3B0 /* PBXTextBookmark */ = 2C4FA2BF0CDBB0F2002CC3B0 /* PBXTextBookmark */; - 2C4FA2C00CDBB0F2002CC3B0 /* PBXTextBookmark */ = 2C4FA2C00CDBB0F2002CC3B0 /* PBXTextBookmark */; - 2C4FA2C10CDBB0F2002CC3B0 /* PBXTextBookmark */ = 2C4FA2C10CDBB0F2002CC3B0 /* PBXTextBookmark */; - 2C4FA2C20CDBB0F2002CC3B0 /* PBXTextBookmark */ = 2C4FA2C20CDBB0F2002CC3B0 /* PBXTextBookmark */; - 2CDC71AC0CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71AC0CDBA6300018F966 /* PBXTextBookmark */; - 2CDC71AE0CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71AE0CDBA6300018F966 /* PBXTextBookmark */; - 2CDC71AF0CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71AF0CDBA6300018F966 /* PBXTextBookmark */; - 2CDC71B00CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71B00CDBA6300018F966 /* PBXTextBookmark */; - 2CDC71B10CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71B10CDBA6300018F966 /* PBXTextBookmark */; - 2CDC71B20CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71B20CDBA6300018F966 /* PBXTextBookmark */; - 2CDC71B30CDBA6300018F966 /* PBXTextBookmark */ = 2CDC71B30CDBA6300018F966 /* PBXTextBookmark */; + 2C0C2C430CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C430CDC73BE004A651F /* PBXTextBookmark */; + 2C0C2C450CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C450CDC73BE004A651F /* PBXTextBookmark */; + 2C0C2C460CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C460CDC73BE004A651F /* PBXTextBookmark */; + 2C0C2C470CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C470CDC73BE004A651F /* PBXTextBookmark */; + 2C0C2C480CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C480CDC73BE004A651F /* PBXTextBookmark */; + 2C0C2C490CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C490CDC73BE004A651F /* PBXTextBookmark */; + 2C0C2C4A0CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C4A0CDC73BE004A651F /* PBXTextBookmark */; + 2C0C2C4B0CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C4B0CDC73BE004A651F /* PBXTextBookmark */; + 2CD3B2550CDC7564001F1030 /* PBXTextBookmark */ = 2CD3B2550CDC7564001F1030 /* PBXTextBookmark */; + 2CD3B28C0CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B28C0CDC76B6001F1030 /* PBXTextBookmark */; + 2CD3B28D0CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B28D0CDC76B6001F1030 /* PBXTextBookmark */; + 2CD3B28E0CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B28E0CDC76B6001F1030 /* PBXTextBookmark */; + 2CD3B28F0CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B28F0CDC76B6001F1030 /* PBXTextBookmark */; + 2CD3B2900CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B2900CDC76B6001F1030 /* PBXTextBookmark */; + 2CD3B2910CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B2910CDC76B6001F1030 /* PBXTextBookmark */; + 2CD3B2920CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B2920CDC76B6001F1030 /* PBXTextBookmark */; + 2CD3B2930CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B2930CDC76B6001F1030 /* PBXTextBookmark */; + 2CD3B2940CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B2940CDC76B6001F1030 /* PBXTextBookmark */; }; sourceControlManager = 2CDD4B690CB9357000549FAC /* Source Control */; userBuildSettings = { -- cgit v1.2.3 From 9edc9535e5570807990e39703dca7c05e6758256 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Sun, 4 Nov 2007 15:23:42 +0000 Subject: Added MacResources.pas. Fixed some resource loading issues on OS X. The main screen is still not loading. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@581 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 2281 ++++++++++---------- Game/Code/MacOSX/UltraStarDX.pas | 2 +- Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 | 231 +- .../MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser | 448 ++-- .../MacOSX/UltraStarDX.xcodeproj/project.pbxproj | 18 +- Game/Code/MacOSX/Wrapper/MacClasses.pas | 57 - Game/Code/MacOSX/Wrapper/MacResources.pas | 72 + 7 files changed, 1510 insertions(+), 1599 deletions(-) delete mode 100755 Game/Code/MacOSX/Wrapper/MacClasses.pas create mode 100755 Game/Code/MacOSX/Wrapper/MacResources.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index c3ab0d41..7b537840 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -1,1139 +1,1142 @@ -unit UTexture; -// added for easier debug disabling -{$define blindydebug} - -// Plain (alpha = 1) -// Transparent -// Colorized - -// obsolete? -// Transparent Range -// Font (white is drawn, black is transparent) -// Font Outline (Font with darker outline) -// Font Outline 2 (Font with darker outline) -// Font Black (black is drawn, white is transparent) -// Font Gray (gray is drawn, white is transparent) -// Arrow (for arrows, white is white, gray has color, black is transparent); - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses OpenGL12, - {$IFDEF win32} - windows, - {$ENDIF} - Math, - Classes, - SysUtils, - Graphics, - UCommon, - UThemes, - SDL, - sdlutils, - SDL_Image; - -type - TTexture = record - TexNum: integer; - X: real; - Y: real; - Z: real; // new - W: real; - H: real; - ScaleW: real; // for dynamic scalling while leaving width constant - ScaleH: real; // for dynamic scalling while leaving height constant - Rot: real; // 0 - 2*pi - Int: real; // intensity - ColR: real; - ColG: real; - ColB: real; - TexW: real; // used? - TexH: real; // used? - TexX1: real; - TexY1: real; - TexX2: real; - TexY2: real; - Alpha: real; - Name: string; // 0.5.0: experimental for handling cache images. maybe it's useful for dynamic skins - end; - - TTextureEntry = record - Name: string; - Typ: string; - - // we use normal TTexture, it's easier to implement and if needed - we copy ready data - Texture: TTexture; - TextureCache: TTexture; // 0.5.0 - end; - - TTextureDatabase = record - Texture: array of TTextureEntry; - end; - - TTextureUnit = class - - private - function LoadImage(Identifier: PChar): PSDL_Surface; - function pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; - procedure AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); - function GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; - procedure ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); - procedure FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); - procedure ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); - - public - Limit: integer; - CreateCacheMipmap: boolean; - -// function GetNumberFor - function GetTexture(Name, Typ: string): TTexture; overload; - function GetTexture(Name, Typ: string; FromCache: boolean): TTexture; overload; - function FindTexture(Name: string): integer; - function LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; - function LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; - function LoadTexture(Identifier: string): TTexture; overload; - function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; - procedure UnloadTexture(Name: string; FromCache: boolean); - Constructor Create; - Destructor Destroy; - end; - -var - Texture: TTextureUnit; - TextureDatabase: TTextureDatabase; - - // this should be in UDisplay?! - PrintScreenData: array[0..1024*768-1] of longword; - - ActTex: GLuint;//integer; - -// TextureD8: array[1..1024*1024] of byte; // 1MB - TextureD16: array[1..1024*1024, 1..2] of byte; // luminance/alpha tex (2MB) -// TextureD24: array[1..1024*1024, 1..3] of byte; // normal 24-bit tex (3MB) -// TextureD242: array[1..512*512, 1..3] of byte; // normal 24-bit tex (0,75MB) -// TextureD32: array[1..1024*1024, 1..4] of byte; // transparent 32-bit tex (4MB) - // total 40MB at 2048*2048 - // total 10MB at 1024*1024 - - Mipmapping: Boolean; - - CacheMipmap: array[0..256*256*3-1] of byte; // 3KB - CacheMipmapSurface: PSDL_Surface; - - -implementation - -uses ULog, - DateUtils, - UCovers, - {$IFDEF LAZARUS} - LResources, - {$ENDIF} - StrUtils, dialogs; - -const - fmt_rgba: TSDL_Pixelformat=(palette: nil; - BitsPerPixel: 32; - BytesPerPixel: 4; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 24; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $ff000000; - ColorKey: 0; - Alpha: 255); - fmt_rgb: TSDL_Pixelformat=( palette: nil; - BitsPerPixel: 24; - BytesPerPixel: 3; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 0; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $00000000; - ColorKey: 0; - Alpha: 255); - - -Constructor TTextureUnit.Create; -begin - inherited Create; -end; - -Destructor TTextureUnit.Destroy; -begin - inherited Destroy; -end; - -function TTextureUnit.pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; -begin - if (fmt1^.BitsPerPixel = fmt2^.BitsPerPixel) and - (fmt1^.BytesPerPixel = fmt2^.BytesPerPixel) and - (fmt1^.Rloss = fmt2^.Rloss) and (fmt1^.Gloss = fmt2^.Gloss) and - (fmt1^.Bloss = fmt2^.Bloss) and (fmt1^.Rmask = fmt2^.Rmask) and - (fmt1^.Gmask = fmt2^.Gmask) and (fmt1^.Bmask = fmt2^.Bmask) and - (fmt1^.Rshift = fmt2^.Rshift) and (fmt1^.Gshift = fmt2^.Gshift) and - (fmt1^.Bshift = fmt2^.Bshift) - then - Result:=True - else - Result:=False; -end; - -// +++++++++++++++++++++ helpers for loadimage +++++++++++++++ - function SdlStreamSeek( context : PSDL_RWops; offset : Integer; whence : Integer ) : integer; cdecl; - var - stream : TStream; - origin : Word; - begin - stream := TStream( context.unknown ); - if ( stream = nil ) then - raise EInvalidContainer.Create( 'SDLStreamSeek on nil' ); - case whence of - 0 : origin := soFromBeginning; // Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0. - 1 : origin := soFromCurrent; // Offset is from the current position in the resource. Seek moves to Position + Offset. - 2 : origin := soFromEnd; - else - origin := soFromBeginning; // just in case - end; - Result := stream.Seek( offset, origin ); - end; - function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : Integer; maxnum: Integer ) : Integer; cdecl; - var - stream : TStream; - begin - stream := TStream( context.unknown ); - if ( stream = nil ) then - raise EInvalidContainer.Create( 'SDLStreamRead on nil' ); - try - Result := stream.read( Ptr^, Size * maxnum ) div size; - except - Result := -1; - end; - end; - function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl; - var - stream : TStream; - begin - stream := TStream( context.unknown ); - if ( stream = nil ) then - raise EInvalidContainer.Create( 'SDLStreamClose on nil' ); - stream.Free; - Result := 1; - end; -// ----------------------------------------------- - -function TTextureUnit.LoadImage(Identifier: PChar): PSDL_Surface; -var - - TexRWops: PSDL_RWops; - dHandle: THandle; - - {$IFDEF LAZARUS} - lLazRes : TLResource; - lResData : TStringStream; - {$ELSE} - TexStream: TStream; - {$ENDIF} - -begin - Result := nil; - TexRWops := nil; - -// Log.LogStatus( Identifier, 'LoadImage' ); - - if ( FileExists(Identifier) ) then - begin - // load from file - Log.LogStatus( 'Is File', ' LoadImage' ); - try - Result:=IMG_Load(Identifier); - except - Log.LogStatus( 'ERROR Could not load from file' , Identifier); - beep; - Exit; - end; - end - else - begin - Log.LogStatus( 'IS Resource, because file does not exist.('+Identifier+')', ' LoadImage' ); - - // load from resource stream - {$IFDEF LAZARUS} - lLazRes := LazFindResource( Identifier, 'TEX' ); - if lLazRes <> nil then - begin - lResData := TStringStream.create( lLazRes.value ); - try - lResData.position := 0; - try - TexRWops := SDL_AllocRW; - TexRWops.unknown := TUnknown( lResData ); - TexRWops.seek := SDLStreamSeek; - TexRWops.read := SDLStreamRead; - TexRWops.write := nil; - TexRWops.close := SDLStreamClose; - TexRWops.type_ := 2; - except - Log.LogStatus( 'ERROR Could not assign resource ('+Identifier+')' , Identifier); - beep; - Exit; - end; - - Result := IMG_Load_RW(TexRWops,0); - SDL_FreeRW(TexRWops); - finally - freeandnil( lResData ); - end; - end - else - begin - Log.LogStatus( 'NOT found in Resource ('+Identifier+')', ' LoadImage' ); - end; - {$ELSE} - dHandle := FindResource(hInstance, Identifier, 'TEX'); - if dHandle=0 then - begin - Log.LogStatus( 'ERROR Could not find resource' , ' '+ Identifier); - beep; - Exit; - end; - - - TexStream := nil; - try - TexStream := TResourceStream.Create(HInstance, Identifier, 'TEX'); - except - Log.LogStatus( 'ERROR Could not load from resource' , Identifier); - beep; - Exit; - end; - - try - TexStream.position := 0; - try - TexRWops := SDL_AllocRW; - TexRWops.unknown := TUnknown(TexStream); - TexRWops.seek := SDLStreamSeek; - TexRWops.read := SDLStreamRead; - TexRWops.write := nil; - TexRWops.close := SDLStreamClose; - TexRWops.type_ := 2; - except - Log.LogStatus( 'ERROR Could not assign resource' , Identifier); - beep; - Exit; - end; - - Log.LogStatus( 'resource Assigned....' , Identifier); - Result:=IMG_Load_RW(TexRWops,0); - SDL_FreeRW(TexRWops); - - finally - if assigned( TexStream ) then - freeandnil( TexStream ); - end; - {$ENDIF} - end; -end; - -procedure TTextureUnit.AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); -var - TempSurface: PSDL_Surface; - NeededPixFmt: PSDL_Pixelformat; -begin - NeededPixFmt:=@fmt_rgba; - if Typ= 'Plain' then NeededPixFmt:=@fmt_rgb - else - if (Typ='Transparent') or - (Typ='Colorized') - then NeededPixFmt:=@fmt_rgba - else - NeededPixFmt:=@fmt_rgb; - - - if not pixfmt_eq(TexSurface^.format, NeededPixFmt) then - begin - TempSurface:=TexSurface; - TexSurface:=SDL_ConvertSurface(TempSurface,NeededPixFmt,SDL_SWSURFACE); - SDL_FreeSurface(TempSurface); - end; -end; - -function TTextureUnit.GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; -var - TempSurface: PSDL_Surface; -begin - TempSurface:=TexSurface; - Result:=SDL_ScaleSurfaceRect(TempSurface, - 0,0,TempSurface^.W,TempSurface^.H, - W,H); -end; - -procedure TTextureUnit.ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); -var - TempSurface: PSDL_Surface; -begin - TempSurface:=TexSurface; - TexSurface:=SDL_ScaleSurfaceRect(TempSurface, - 0,0,TempSurface^.W,TempSurface^.H, - W,H); - SDL_FreeSurface(TempSurface); -end; - -procedure TTextureUnit.FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); -var - TempSurface: PSDL_Surface; -begin - TempSurface:=TexSurface; - with TempSurface^.format^ do - TexSurface:=SDL_CreateRGBSurface(SDL_SWSURFACE,W,H,BitsPerPixel,RMask, GMask, BMask, AMask); - SDL_SetAlpha(TexSurface, 0, 255); - SDL_SetAlpha(TempSurface, 0, 255); - SDL_BlitSurface(TempSurface,nil,TexSurface,nil); - SDL_FreeSurface(TempSurface); -end; - -procedure TTextureUnit.ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); - //returns hue within range [0.0-6.0) - function col2h(Color:Cardinal):double; - var - clr,hls: array[0..2] of double; - delta: double; - begin - clr[0]:=((Color and $ff0000) shr 16)/255; - clr[1]:=((Color and $ff00) shr 8)/255; - clr[2]:=(Color and $ff)/255; - hls[1]:=maxvalue(clr); - delta:=hls[1]-minvalue(clr); - if clr[0]=hls[1] then hls[0]:=(clr[1]-clr[2])/delta - else if clr[1]=hls[1] then hls[0]:=2.0+(clr[2]-clr[0])/delta - else if clr[2]=hls[1] then hls[0]:=4.0+(clr[0]-clr[1])/delta; - if hls[0]<0.0 then hls[0]:=hls[0]+6.0; - if hls[0]=6.0 then hls[0]:=0.0; - col2h:=hls[0]; - end; - procedure ColorizePixel(Pix: PByteArray; hue: Double); - var - i,j,k: Cardinal; - clr, hls: array[0..2] of Double; - delta, f, p, q, t: Double; - begin - hls[0]:=hue; - - clr[0] := Pix[0]/255; - clr[1] := Pix[1]/255; - clr[2] := Pix[2]/255; - - //calculate luminance and saturation from rgb - hls[1] := maxvalue(clr); //l:=... - delta := hls[1] - minvalue(clr); - - if hls[1] = 0.0 then - hls[2] := 0.0 - else - hls[2] := delta/hls[1]; //v:=... - - // calc new rgb from our hls (h from color, l ans s from pixel) - // if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense - begin - k:=trunc(hls[0]); - f:=hls[0]-k; - p:=hls[1]*(1.0-hls[2]); - q:=hls[1]*(1.0-(hls[2]*f)); - t:=hls[1]*(1.0-(hls[2]*(1.0-f))); - case k of - 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end; - 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end; - 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end; - 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end; - 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end; - 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; - end; - // and store new rgb back into the image - Pix[0]:=floor(255*clr[0]); - Pix[1]:=floor(255*clr[1]); - Pix[2]:=floor(255*clr[2]); - end; - end; - -var - DestinationHue: Double; - PixelIndex: Cardinal; -begin - DestinationHue:=col2h(Col); - for PixelIndex:=0 to (TexSurface^.W*TexSurface^.H -1) do - ColorizePixel(@(PByteArray(TexSurface^.Pixels)[PixelIndex*TexSurface^.format.BytesPerPixel]),DestinationHue); -end; - -function TTextureUnit.LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; -var - TexSurface: PSDL_Surface; - MipmapSurface: PSDL_Surface; - newWidth, newHeight: Cardinal; - oldWidth, oldHeight: Cardinal; - kopierindex: Cardinal; -begin - Log.BenchmarkStart(4); - Mipmapping := true; -(* - Log.LogStatus( '', '' ); - - if Identifier = nil then - Log.LogStatus(' ERROR unknown Identifier', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+'''') - else - Log.LogStatus(' should be ok - trying to load', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+''''); -*) - - // load texture data into memory - {$ifdef blindydebug} - Log.LogStatus('',' ----------------------------------------------------'); - Log.LogStatus('',' LoadImage('''+Identifier+''') (called by '+Format+')'); - {$endif} - TexSurface := LoadImage(Identifier); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - {$endif} - if not assigned(TexSurface) then - begin - Log.LogStatus( 'ERROR Could not load texture' , Identifier +' '+ Format +' '+ Typ ); - beep; - Exit; - end; - - // convert pixel format as needed - {$ifdef blindydebug} - Log.LogStatus('',' AdjustPixelFormat'); - {$endif} - AdjustPixelFormat(TexSurface, Typ); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - {$endif} - // adjust texture size (scale down, if necessary) - newWidth := TexSurface.W; - newHeight := TexSurface.H; - - if (newWidth > Limit) then - newWidth := Limit; - - if (newHeight > Limit) then - newHeight := Limit; - - if (TexSurface.W > newWidth) or (TexSurface.H > newHeight) then - begin - {$ifdef blindydebug} - Log.LogStatus('',' ScaleTexture'); - {$endif} - ScaleTexture(TexSurface,newWidth,newHeight); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - {$endif} - end; - - {$ifdef blindydebug} - Log.LogStatus('',' JB-1 : typ='+Typ); - {$endif} - - - - // don't actually understand, if this is needed... - // this should definately be changed... together with all this - // cover cache stuff - if (CreateCacheMipmap) and (Typ='Plain') then - begin - {$ifdef blindydebug} - Log.LogStatus('',' JB-1 : Minimap'); - {$endif} - - if (Covers.W <= 256) and (Covers.H <= 256) then - begin - {$ifdef blindydebug} - Log.LogStatus('',' GetScaledTexture('''+inttostr(Covers.W)+''','''+inttostr(Covers.H)+''') (for CacheMipmap)'); - {$endif} - MipmapSurface:=GetScaledTexture(TexSurface,Covers.W, Covers.H); - if assigned(MipmapSurface) then - begin - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - Log.LogStatus('',' BlitSurface Stuff'); - {$endif} - // creating and freeing the surface could be done once, if Cover.W and Cover.H don't change - CacheMipmapSurface:=SDL_CreateRGBSurfaceFrom(@CacheMipmap[0], Covers.W, Covers.H, 24, Covers.W*3, $000000ff, $0000ff00, $00ff0000, 0); - SDL_BlitSurface(MipMapSurface,nil,CacheMipmapSurface,nil); - SDL_FreeSurface(CacheMipmapSurface); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - Log.LogStatus('',' SDL_FreeSurface (CacheMipmap)'); - {$endif} - SDL_FreeSurface(MipmapSurface); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - {$endif} - end - else - begin - Log.LogStatus(' Error creating CacheMipmap',' LoadTexture('''+Identifier+''')'); - end; - end; - // should i create a cache texture, if Covers.W/H are larger? - end; - - {$ifdef blindydebug} - Log.LogStatus('',' JB-2'); - {$endif} - - - // now we might colorize the whole thing - if Typ='Colorized' then - ColorizeTexture(TexSurface,Col); - - // save actual dimensions of our texture - oldWidth:=newWidth; - oldHeight:=newHeight; - // make texture dimensions be powers of 2 - newWidth:=Round(Power(2, Ceil(Log2(newWidth)))); - newHeight:=Round(Power(2, Ceil(Log2(newHeight)))); - if (newHeight <> oldHeight) or (newWidth <> oldWidth) then - FitTexture(TexSurface,newWidth,newHeight); - - // at this point we have the image in memory... - // scaled to be at most 1024x1024 pixels large - // scaled so that dimensions are powers of 2 - // and converted to either RGB or RGBA - - {$ifdef blindydebug} - Log.LogStatus('',' JB-3'); - {$endif} - - - // if we got a Texture of Type Plain, Transparent or Colorized, - // then we're done manipulating it - // and could now create our openGL texture from it - - // prepare OpenGL texture - - // JB_linux : this is causing AV's on linux... ActText seems to be nil ! -// {$IFnDEF win32} -// if pointer(ActTex) = nil then -// exit; -// {$endif} - - glGenTextures(1, @ActTex); - - glBindTexture(GL_TEXTURE_2D, ActTex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - // load data into gl texture - if (Typ = 'Transparent') or - (Typ='Colorized') then - begin - glTexImage2D(GL_TEXTURE_2D, 0, 4, newWidth, newHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, TexSurface.pixels); - end - {if Typ = 'Plain' then} else - begin - glTexImage2D(GL_TEXTURE_2D, 0, 3, newWidth, newHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, TexSurface.pixels); - end; - - {$ifdef blindydebug} - Log.LogStatus('',' JB-4'); - {$endif} - -{ - if Typ = 'Transparent Range' then - // set alpha to 256-green-component (not sure) - Pix := TextureB.Canvas.Pixels[Position2, Position]; - TextureD32[Position*TexNewW + Position2+1, 1] := Pix; - TextureD32[Position*TexNewW + Position2+1, 2] := Pix div 256; - TextureD32[Position*TexNewW + Position2+1, 3] := Pix div (256*256); - TextureD32[Position*TexNewW + Position2+1, 4] := 256 - Pix div 256; -} -{ - if Typ = 'Font' then - // either create luminance-alpha texture - // or use transparency from differently saved file - // or do something totally different (text engine with ttf) - Pix := PPix[Position2 * 3]; - TextureD16[Position*TextureB.Width + Position2 + 1, 1] := 255; - TextureD16[Position*TextureB.Width + Position2 + 1, 2] := Pix; - glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); -} -{ - if Typ = 'Font Outline' then - // no idea... - begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - - Col := Pix; - if Col < 127 then Col := 127; - - TempA := Pix; - if TempA >= 95 then TempA := 255; - if TempA >= 31 then TempA := 255; - if Pix < 95 then TempA := (Pix * 256) div 96; - - - TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; - TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - end; -} -{ - if Typ = 'Font Outline 2' then - // same as above - begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - - Col := Pix; - if Col < 31 then Col := 31; - - TempA := Pix; - if TempA >= 31 then TempA := 255; - if Pix < 31 then TempA := Pix * (256 div 32); - - TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; - TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - if Error > 0 then beep; - end; - end; - - if Typ = 'Font Black' then - // and so on - begin - // normalnie 0,125s bez niczego 0,015s - 0,030s z pix 0,125s <-- ??? - // dimensions - TextureB.PixelFormat := pf24bit; - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2*3]; - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; - - if Typ = 'Alpha Black Colored' then - // ... hope, noone needs this - begin - TextureB.PixelFormat := pf24bit; - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2*3]; - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := (Col div $10000) and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Col div $100) and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Col and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; - - if Typ = 'Font Gray' then - begin - // dimensions - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TextureB.Height-1 do begin - for Position2 := 0 to TextureB.Width-1 do begin - Pix := TextureB.Canvas.Pixels[Position2, Position]; - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 127; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 127; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 127; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; - - if Typ = 'Arrow' then - begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - - // transparency - if Pix >= 127 then TempA := 255; - if Pix < 127 then TempA := Pix * 2; - - // ColInt = color intensity - if Pix < 127 then ColInt := 1; - if Pix >= 127 then ColInt := 2 - Pix / 128; - //0.75, 0.6, 0.25 - - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Round(ColInt * 0.75 * 255 + (1 - ColInt) * 255); - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := Round(ColInt * 0.6 * 255 + (1 - ColInt) * 255); - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Round(ColInt * 0.25 * 255 + (1 - ColInt) * 255); - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - - if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - if Error > 0 then beep; - end; - end; - - if Typ = 'Note Plain' then - begin - for Position := 0 to TextureB.Height-1 do - begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do - begin - - - - // Skin Patch - // 0-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White - case PPix[Position2*3] of - 0..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); - 192: Pix := Col; - 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); - 255: Pix := $FFFFFF; - end; -// 0.5.0. Original -// case PPix[Position2*3] of -// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; -// 192: Pix := Col; -// 255: Pix := $FFFFFF; -// end; - - - - - - TextureD24[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; - TextureD24[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; - TextureD24[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureB.Width, TextureB.Height, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); - end; - - if Typ = 'Note Transparent' then - begin - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - TempA := 255; - - - - //Skin Patch - // 0= Transparent, 1-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White - case PPix[Position2*3] of - 0: TempA := 0; - 1..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); - 192: Pix := Col; - 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); - 255: Pix := $FFFFFF; - end; -// 0.5.0 Original -// case PPix[Position2*3] of -// 0: TempA := 0; -// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; -// 192: Pix := Col; -// 255: Pix := $FFFFFF; -// end; - - - - - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; -} - - {$ifdef blindydebug} - Log.LogStatus('',' JB-5'); - {$endif} - - - Result.X := 0; - Result.Y := 0; - Result.W := 0; - Result.H := 0; - Result.ScaleW := 1; - Result.ScaleH := 1; - Result.Rot := 0; - Result.TexNum := ActTex; - Result.TexW := oldWidth / newWidth; - Result.TexH := oldHeight / newHeight; - - Result.Int := 1; - Result.ColR := 1; - Result.ColG := 1; - Result.ColB := 1; - Result.Alpha := 1; - - // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these - Result.TexX1 := 0; - Result.TexY1 := 0; - Result.TexX2 := 1; - Result.TexY2 := 1; - - {$ifdef blindydebug} - Log.LogStatus('',' JB-6'); - {$endif} - - - // 0.5.0 - Result.Name := Identifier; - - SDL_FreeSurface(TexSurface); - - {$ifdef blindydebug} - Log.LogStatus('',' JB-7'); - {$endif} - - - Log.BenchmarkEnd(4); - if Log.BenchmarkTimeLength[4] >= 1 then - Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4); - - {$ifdef blindydebug} - Log.LogStatus('',' JB-8'); - {$endif} - -end; - - -function TTextureUnit.GetTexture(Name, Typ: string): TTexture; -begin - Result := GetTexture(Name, Typ, true); -end; - -function TTextureUnit.GetTexture(Name, Typ: string; FromCache: boolean): TTexture; -var - T: integer; // texture - C: integer; // cover - Data: array of byte; -begin - - if Name = '' then - exit; - - // find texture entry - T := FindTexture(Name); - - if T = -1 then - begin - // create texture entry - T := Length(TextureDatabase.Texture); - SetLength(TextureDatabase.Texture, T+1); - - TextureDatabase.Texture[T].Name := Name; - TextureDatabase.Texture[T].Typ := Typ; - - // inform database that no textures have been loaded into memory - TextureDatabase.Texture[T].Texture.TexNum := -1; - TextureDatabase.Texture[T].TextureCache.TexNum := -1; - end; - - // use preloaded texture - if (not FromCache) or (FromCache and not Covers.CoverExists(Name)) then - begin - // use full texture - if TextureDatabase.Texture[T].Texture.TexNum = -1 then - begin - // load texture - {$ifdef blindydebug} - Log.LogStatus('...', 'GetTexture('''+Name+''','''+Typ+''')'); - {$endif} - TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', pchar(Typ), $0); - {$ifdef blindydebug} - Log.LogStatus('done',' '); - {$endif} - end; - - // use texture - Result := TextureDatabase.Texture[T].Texture; - end; - - if FromCache and Covers.CoverExists(Name) then - begin - // use cache texture - C := Covers.CoverNumber(Name); - - if TextureDatabase.Texture[T].TextureCache.TexNum = -1 then - begin - // load texture - Covers.PrepareData(Name); - TextureDatabase.Texture[T].TextureCache := CreateTexture(Covers.Data, Name, Covers.Cover[C].W, Covers.Cover[C].H, 24); - end; - - // use texture - Result := TextureDatabase.Texture[T].TextureCache; - end; -end; - -function TTextureUnit.FindTexture(Name: string): integer; -var - T: integer; // texture -begin - Result := -1; - for T := 0 to high(TextureDatabase.Texture) do - if TextureDatabase.Texture[T].Name = Name then - Result := T; -end; - -function TTextureUnit.LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; -begin - Result := LoadTexture(false, Identifier, Format, Typ, Col); -end; - -function TTextureUnit.LoadTexture(Identifier: string): TTexture; -begin - Result := LoadTexture(false, pchar(Identifier), 'JPG', 'Plain', 0); -end; - -function TTextureUnit.CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; -var - Position: integer; - Position2: integer; - Pix: integer; - ColInt: real; - PPix: PByteArray; - TempA: integer; - Error: integer; -begin - Mipmapping := false; - - glGenTextures(1, @ActTex); // ActText = new texture number - glBindTexture(GL_TEXTURE_2D, ActTex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - glTexImage2D(GL_TEXTURE_2D, 0, 3, W, H, 0, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, W, H, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); - if Error > 0 then beep; - end; - - Result.X := 0; - Result.Y := 0; - Result.W := 0; - Result.H := 0; - Result.ScaleW := 1; - Result.ScaleH := 1; - Result.Rot := 0; - Result.TexNum := ActTex; - Result.TexW := 1; - Result.TexH := 1; - - Result.Int := 1; - Result.ColR := 1; - Result.ColG := 1; - Result.ColB := 1; - Result.Alpha := 1; - - // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these - Result.TexX1 := 0; - Result.TexY1 := 0; - Result.TexX2 := 1; - Result.TexY2 := 1; - - // 0.5.0 - Result.Name := Name; -end; - -procedure TTextureUnit.UnloadTexture(Name: string; FromCache: boolean); -var - T: integer; - TexNum: GLuint; -begin - T := FindTexture(Name); - - if not FromCache then begin - TexNum := TextureDatabase.Texture[T].Texture.TexNum; - if TexNum >= 0 then begin - glDeleteTextures(1, @TexNum); - TextureDatabase.Texture[T].Texture.TexNum := -1; -// Log.LogError('Unload texture no '+IntToStr(TexNum)); - end; - end else begin - TexNum := TextureDatabase.Texture[T].TextureCache.TexNum; - if TexNum >= 0 then begin - glDeleteTextures(1, @TexNum); - TextureDatabase.Texture[T].TextureCache.TexNum := -1; -// Log.LogError('Unload texture cache no '+IntToStr(TexNum)); - end; - end; -end; - -{$IFDEF LAZARUS} -initialization - {$I UltraStar.lrs} -{$ENDIF} - - -end. +unit UTexture; +// added for easier debug disabling +{$define blindydebug} + +// Plain (alpha = 1) +// Transparent +// Colorized + +// obsolete? +// Transparent Range +// Font (white is drawn, black is transparent) +// Font Outline (Font with darker outline) +// Font Outline 2 (Font with darker outline) +// Font Black (black is drawn, white is transparent) +// Font Gray (gray is drawn, white is transparent) +// Arrow (for arrows, white is white, gray has color, black is transparent); + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses OpenGL12, + {$IFDEF win32} + windows, + {$ENDIF} + Math, + Classes, + SysUtils, + Graphics, + UCommon, + UThemes, + SDL, + sdlutils, + SDL_Image; + +type + TTexture = record + TexNum: integer; + X: real; + Y: real; + Z: real; // new + W: real; + H: real; + ScaleW: real; // for dynamic scalling while leaving width constant + ScaleH: real; // for dynamic scalling while leaving height constant + Rot: real; // 0 - 2*pi + Int: real; // intensity + ColR: real; + ColG: real; + ColB: real; + TexW: real; // used? + TexH: real; // used? + TexX1: real; + TexY1: real; + TexX2: real; + TexY2: real; + Alpha: real; + Name: string; // 0.5.0: experimental for handling cache images. maybe it's useful for dynamic skins + end; + + TTextureEntry = record + Name: string; + Typ: string; + + // we use normal TTexture, it's easier to implement and if needed - we copy ready data + Texture: TTexture; + TextureCache: TTexture; // 0.5.0 + end; + + TTextureDatabase = record + Texture: array of TTextureEntry; + end; + + TTextureUnit = class + + private + function LoadImage(Identifier: PChar): PSDL_Surface; + function pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; + procedure AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); + function GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; + procedure ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); + procedure FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); + procedure ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); + + public + Limit: integer; + CreateCacheMipmap: boolean; + +// function GetNumberFor + function GetTexture(Name, Typ: string): TTexture; overload; + function GetTexture(Name, Typ: string; FromCache: boolean): TTexture; overload; + function FindTexture(Name: string): integer; + function LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; + function LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; + function LoadTexture(Identifier: string): TTexture; overload; + function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; + procedure UnloadTexture(Name: string; FromCache: boolean); + Constructor Create; + Destructor Destroy; + end; + +var + Texture: TTextureUnit; + TextureDatabase: TTextureDatabase; + + // this should be in UDisplay?! + PrintScreenData: array[0..1024*768-1] of longword; + + ActTex: GLuint;//integer; + +// TextureD8: array[1..1024*1024] of byte; // 1MB + TextureD16: array[1..1024*1024, 1..2] of byte; // luminance/alpha tex (2MB) +// TextureD24: array[1..1024*1024, 1..3] of byte; // normal 24-bit tex (3MB) +// TextureD242: array[1..512*512, 1..3] of byte; // normal 24-bit tex (0,75MB) +// TextureD32: array[1..1024*1024, 1..4] of byte; // transparent 32-bit tex (4MB) + // total 40MB at 2048*2048 + // total 10MB at 1024*1024 + + Mipmapping: Boolean; + + CacheMipmap: array[0..256*256*3-1] of byte; // 3KB + CacheMipmapSurface: PSDL_Surface; + + +implementation + +uses ULog, + DateUtils, + UCovers, + {$IFDEF LAZARUS} + LResources, + {$ENDIF} + {$IFDEF DARWIN} + MacResources, + {$ENDIF} + StrUtils, dialogs; + +const + fmt_rgba: TSDL_Pixelformat=(palette: nil; + BitsPerPixel: 32; + BytesPerPixel: 4; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 24; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $ff000000; + ColorKey: 0; + Alpha: 255); + fmt_rgb: TSDL_Pixelformat=( palette: nil; + BitsPerPixel: 24; + BytesPerPixel: 3; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 0; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $00000000; + ColorKey: 0; + Alpha: 255); + + +Constructor TTextureUnit.Create; +begin + inherited Create; +end; + +Destructor TTextureUnit.Destroy; +begin + inherited Destroy; +end; + +function TTextureUnit.pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; +begin + if (fmt1^.BitsPerPixel = fmt2^.BitsPerPixel) and + (fmt1^.BytesPerPixel = fmt2^.BytesPerPixel) and + (fmt1^.Rloss = fmt2^.Rloss) and (fmt1^.Gloss = fmt2^.Gloss) and + (fmt1^.Bloss = fmt2^.Bloss) and (fmt1^.Rmask = fmt2^.Rmask) and + (fmt1^.Gmask = fmt2^.Gmask) and (fmt1^.Bmask = fmt2^.Bmask) and + (fmt1^.Rshift = fmt2^.Rshift) and (fmt1^.Gshift = fmt2^.Gshift) and + (fmt1^.Bshift = fmt2^.Bshift) + then + Result:=True + else + Result:=False; +end; + +// +++++++++++++++++++++ helpers for loadimage +++++++++++++++ + function SdlStreamSeek( context : PSDL_RWops; offset : Integer; whence : Integer ) : integer; cdecl; + var + stream : TStream; + origin : Word; + begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamSeek on nil' ); + case whence of + 0 : origin := soFromBeginning; // Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0. + 1 : origin := soFromCurrent; // Offset is from the current position in the resource. Seek moves to Position + Offset. + 2 : origin := soFromEnd; + else + origin := soFromBeginning; // just in case + end; + Result := stream.Seek( offset, origin ); + end; + function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : Integer; maxnum: Integer ) : Integer; cdecl; + var + stream : TStream; + begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamRead on nil' ); + try + Result := stream.read( Ptr^, Size * maxnum ) div size; + except + Result := -1; + end; + end; + function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl; + var + stream : TStream; + begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamClose on nil' ); + stream.Free; + Result := 1; + end; +// ----------------------------------------------- + +function TTextureUnit.LoadImage(Identifier: PChar): PSDL_Surface; +var + + TexRWops: PSDL_RWops; + dHandle: THandle; + + {$IFDEF LAZARUS} + lLazRes : TLResource; + lResData : TStringStream; + {$ELSE} + TexStream: TStream; + {$ENDIF} + +begin + Result := nil; + TexRWops := nil; + +// Log.LogStatus( Identifier, 'LoadImage' ); + + if ( FileExists(Identifier) ) then + begin + // load from file + Log.LogStatus( 'Is File', ' LoadImage' ); + try + Result:=IMG_Load(Identifier); + except + Log.LogStatus( 'ERROR Could not load from file' , Identifier); + beep; + Exit; + end; + end + else + begin + Log.LogStatus( 'IS Resource, because file does not exist.('+Identifier+')', ' LoadImage' ); + + // load from resource stream + {$IFDEF LAZARUS} + lLazRes := LazFindResource( Identifier, 'TEX' ); + if lLazRes <> nil then + begin + lResData := TStringStream.create( lLazRes.value ); + try + lResData.position := 0; + try + TexRWops := SDL_AllocRW; + TexRWops.unknown := TUnknown( lResData ); + TexRWops.seek := SDLStreamSeek; + TexRWops.read := SDLStreamRead; + TexRWops.write := nil; + TexRWops.close := SDLStreamClose; + TexRWops.type_ := 2; + except + Log.LogStatus( 'ERROR Could not assign resource ('+Identifier+')' , Identifier); + beep; + Exit; + end; + + Result := IMG_Load_RW(TexRWops,0); + SDL_FreeRW(TexRWops); + finally + freeandnil( lResData ); + end; + end + else + begin + Log.LogStatus( 'NOT found in Resource ('+Identifier+')', ' LoadImage' ); + end; + {$ELSE} + dHandle := FindResource(hInstance, Identifier, 'TEX'); + if dHandle=0 then + begin + Log.LogStatus( 'ERROR Could not find resource' , ' '+ Identifier); + beep; + Exit; + end; + + + TexStream := nil; + try + TexStream := TResourceStream.Create(HInstance, Identifier, 'TEX'); + except + Log.LogStatus( 'ERROR Could not load from resource' , Identifier); + beep; + Exit; + end; + + try + TexStream.position := 0; + try + TexRWops := SDL_AllocRW; + TexRWops.unknown := TUnknown(TexStream); + TexRWops.seek := SDLStreamSeek; + TexRWops.read := SDLStreamRead; + TexRWops.write := nil; + TexRWops.close := SDLStreamClose; + TexRWops.type_ := 2; + except + Log.LogStatus( 'ERROR Could not assign resource' , Identifier); + beep; + Exit; + end; + + Log.LogStatus( 'resource Assigned....' , Identifier); + Result:=IMG_Load_RW(TexRWops,0); + SDL_FreeRW(TexRWops); + + finally + if assigned( TexStream ) then + freeandnil( TexStream ); + end; + {$ENDIF} + end; +end; + +procedure TTextureUnit.AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); +var + TempSurface: PSDL_Surface; + NeededPixFmt: PSDL_Pixelformat; +begin + NeededPixFmt:=@fmt_rgba; + if Typ= 'Plain' then NeededPixFmt:=@fmt_rgb + else + if (Typ='Transparent') or + (Typ='Colorized') + then NeededPixFmt:=@fmt_rgba + else + NeededPixFmt:=@fmt_rgb; + + + if not pixfmt_eq(TexSurface^.format, NeededPixFmt) then + begin + TempSurface:=TexSurface; + TexSurface:=SDL_ConvertSurface(TempSurface,NeededPixFmt,SDL_SWSURFACE); + SDL_FreeSurface(TempSurface); + end; +end; + +function TTextureUnit.GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; +var + TempSurface: PSDL_Surface; +begin + TempSurface:=TexSurface; + Result:=SDL_ScaleSurfaceRect(TempSurface, + 0,0,TempSurface^.W,TempSurface^.H, + W,H); +end; + +procedure TTextureUnit.ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); +var + TempSurface: PSDL_Surface; +begin + TempSurface:=TexSurface; + TexSurface:=SDL_ScaleSurfaceRect(TempSurface, + 0,0,TempSurface^.W,TempSurface^.H, + W,H); + SDL_FreeSurface(TempSurface); +end; + +procedure TTextureUnit.FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); +var + TempSurface: PSDL_Surface; +begin + TempSurface:=TexSurface; + with TempSurface^.format^ do + TexSurface:=SDL_CreateRGBSurface(SDL_SWSURFACE,W,H,BitsPerPixel,RMask, GMask, BMask, AMask); + SDL_SetAlpha(TexSurface, 0, 255); + SDL_SetAlpha(TempSurface, 0, 255); + SDL_BlitSurface(TempSurface,nil,TexSurface,nil); + SDL_FreeSurface(TempSurface); +end; + +procedure TTextureUnit.ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); + //returns hue within range [0.0-6.0) + function col2h(Color:Cardinal):double; + var + clr,hls: array[0..2] of double; + delta: double; + begin + clr[0]:=((Color and $ff0000) shr 16)/255; + clr[1]:=((Color and $ff00) shr 8)/255; + clr[2]:=(Color and $ff)/255; + hls[1]:=maxvalue(clr); + delta:=hls[1]-minvalue(clr); + if clr[0]=hls[1] then hls[0]:=(clr[1]-clr[2])/delta + else if clr[1]=hls[1] then hls[0]:=2.0+(clr[2]-clr[0])/delta + else if clr[2]=hls[1] then hls[0]:=4.0+(clr[0]-clr[1])/delta; + if hls[0]<0.0 then hls[0]:=hls[0]+6.0; + if hls[0]=6.0 then hls[0]:=0.0; + col2h:=hls[0]; + end; + procedure ColorizePixel(Pix: PByteArray; hue: Double); + var + i,j,k: Cardinal; + clr, hls: array[0..2] of Double; + delta, f, p, q, t: Double; + begin + hls[0]:=hue; + + clr[0] := Pix[0]/255; + clr[1] := Pix[1]/255; + clr[2] := Pix[2]/255; + + //calculate luminance and saturation from rgb + hls[1] := maxvalue(clr); //l:=... + delta := hls[1] - minvalue(clr); + + if hls[1] = 0.0 then + hls[2] := 0.0 + else + hls[2] := delta/hls[1]; //v:=... + + // calc new rgb from our hls (h from color, l ans s from pixel) + // if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense + begin + k:=trunc(hls[0]); + f:=hls[0]-k; + p:=hls[1]*(1.0-hls[2]); + q:=hls[1]*(1.0-(hls[2]*f)); + t:=hls[1]*(1.0-(hls[2]*(1.0-f))); + case k of + 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end; + 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end; + 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end; + 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end; + 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end; + 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; + end; + // and store new rgb back into the image + Pix[0]:=floor(255*clr[0]); + Pix[1]:=floor(255*clr[1]); + Pix[2]:=floor(255*clr[2]); + end; + end; + +var + DestinationHue: Double; + PixelIndex: Cardinal; +begin + DestinationHue:=col2h(Col); + for PixelIndex:=0 to (TexSurface^.W*TexSurface^.H -1) do + ColorizePixel(@(PByteArray(TexSurface^.Pixels)[PixelIndex*TexSurface^.format.BytesPerPixel]),DestinationHue); +end; + +function TTextureUnit.LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; +var + TexSurface: PSDL_Surface; + MipmapSurface: PSDL_Surface; + newWidth, newHeight: Cardinal; + oldWidth, oldHeight: Cardinal; + kopierindex: Cardinal; +begin + Log.BenchmarkStart(4); + Mipmapping := true; +(* + Log.LogStatus( '', '' ); + + if Identifier = nil then + Log.LogStatus(' ERROR unknown Identifier', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+'''') + else + Log.LogStatus(' should be ok - trying to load', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+''''); +*) + + // load texture data into memory + {$ifdef blindydebug} + Log.LogStatus('',' ----------------------------------------------------'); + Log.LogStatus('',' LoadImage('''+Identifier+''') (called by '+Format+')'); + {$endif} + TexSurface := LoadImage(Identifier); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + if not assigned(TexSurface) then + begin + Log.LogStatus( 'ERROR Could not load texture' , Identifier +' '+ Format +' '+ Typ ); + beep; + Exit; + end; + + // convert pixel format as needed + {$ifdef blindydebug} + Log.LogStatus('',' AdjustPixelFormat'); + {$endif} + AdjustPixelFormat(TexSurface, Typ); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + // adjust texture size (scale down, if necessary) + newWidth := TexSurface.W; + newHeight := TexSurface.H; + + if (newWidth > Limit) then + newWidth := Limit; + + if (newHeight > Limit) then + newHeight := Limit; + + if (TexSurface.W > newWidth) or (TexSurface.H > newHeight) then + begin + {$ifdef blindydebug} + Log.LogStatus('',' ScaleTexture'); + {$endif} + ScaleTexture(TexSurface,newWidth,newHeight); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + end; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-1 : typ='+Typ); + {$endif} + + + + // don't actually understand, if this is needed... + // this should definately be changed... together with all this + // cover cache stuff + if (CreateCacheMipmap) and (Typ='Plain') then + begin + {$ifdef blindydebug} + Log.LogStatus('',' JB-1 : Minimap'); + {$endif} + + if (Covers.W <= 256) and (Covers.H <= 256) then + begin + {$ifdef blindydebug} + Log.LogStatus('',' GetScaledTexture('''+inttostr(Covers.W)+''','''+inttostr(Covers.H)+''') (for CacheMipmap)'); + {$endif} + MipmapSurface:=GetScaledTexture(TexSurface,Covers.W, Covers.H); + if assigned(MipmapSurface) then + begin + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + Log.LogStatus('',' BlitSurface Stuff'); + {$endif} + // creating and freeing the surface could be done once, if Cover.W and Cover.H don't change + CacheMipmapSurface:=SDL_CreateRGBSurfaceFrom(@CacheMipmap[0], Covers.W, Covers.H, 24, Covers.W*3, $000000ff, $0000ff00, $00ff0000, 0); + SDL_BlitSurface(MipMapSurface,nil,CacheMipmapSurface,nil); + SDL_FreeSurface(CacheMipmapSurface); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + Log.LogStatus('',' SDL_FreeSurface (CacheMipmap)'); + {$endif} + SDL_FreeSurface(MipmapSurface); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + end + else + begin + Log.LogStatus(' Error creating CacheMipmap',' LoadTexture('''+Identifier+''')'); + end; + end; + // should i create a cache texture, if Covers.W/H are larger? + end; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-2'); + {$endif} + + + // now we might colorize the whole thing + if Typ='Colorized' then + ColorizeTexture(TexSurface,Col); + + // save actual dimensions of our texture + oldWidth:=newWidth; + oldHeight:=newHeight; + // make texture dimensions be powers of 2 + newWidth:=Round(Power(2, Ceil(Log2(newWidth)))); + newHeight:=Round(Power(2, Ceil(Log2(newHeight)))); + if (newHeight <> oldHeight) or (newWidth <> oldWidth) then + FitTexture(TexSurface,newWidth,newHeight); + + // at this point we have the image in memory... + // scaled to be at most 1024x1024 pixels large + // scaled so that dimensions are powers of 2 + // and converted to either RGB or RGBA + + {$ifdef blindydebug} + Log.LogStatus('',' JB-3'); + {$endif} + + + // if we got a Texture of Type Plain, Transparent or Colorized, + // then we're done manipulating it + // and could now create our openGL texture from it + + // prepare OpenGL texture + + // JB_linux : this is causing AV's on linux... ActText seems to be nil ! +// {$IFnDEF win32} +// if pointer(ActTex) = nil then +// exit; +// {$endif} + + glGenTextures(1, @ActTex); + + glBindTexture(GL_TEXTURE_2D, ActTex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + // load data into gl texture + if (Typ = 'Transparent') or + (Typ='Colorized') then + begin + glTexImage2D(GL_TEXTURE_2D, 0, 4, newWidth, newHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, TexSurface.pixels); + end + {if Typ = 'Plain' then} else + begin + glTexImage2D(GL_TEXTURE_2D, 0, 3, newWidth, newHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, TexSurface.pixels); + end; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-4'); + {$endif} + +{ + if Typ = 'Transparent Range' then + // set alpha to 256-green-component (not sure) + Pix := TextureB.Canvas.Pixels[Position2, Position]; + TextureD32[Position*TexNewW + Position2+1, 1] := Pix; + TextureD32[Position*TexNewW + Position2+1, 2] := Pix div 256; + TextureD32[Position*TexNewW + Position2+1, 3] := Pix div (256*256); + TextureD32[Position*TexNewW + Position2+1, 4] := 256 - Pix div 256; +} +{ + if Typ = 'Font' then + // either create luminance-alpha texture + // or use transparency from differently saved file + // or do something totally different (text engine with ttf) + Pix := PPix[Position2 * 3]; + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := 255; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := Pix; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); +} +{ + if Typ = 'Font Outline' then + // no idea... + begin + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + Col := Pix; + if Col < 127 then Col := 127; + + TempA := Pix; + if TempA >= 95 then TempA := 255; + if TempA >= 31 then TempA := 255; + if Pix < 95 then TempA := (Pix * 256) div 96; + + + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + end; +} +{ + if Typ = 'Font Outline 2' then + // same as above + begin + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + Col := Pix; + if Col < 31 then Col := 31; + + TempA := Pix; + if TempA >= 31 then TempA := 255; + if Pix < 31 then TempA := Pix * (256 div 32); + + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + if Error > 0 then beep; + end; + end; + + if Typ = 'Font Black' then + // and so on + begin + // normalnie 0,125s bez niczego 0,015s - 0,030s z pix 0,125s <-- ??? + // dimensions + TextureB.PixelFormat := pf24bit; + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2*3]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + if Typ = 'Alpha Black Colored' then + // ... hope, noone needs this + begin + TextureB.PixelFormat := pf24bit; + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2*3]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := (Col div $10000) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Col div $100) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Col and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + if Typ = 'Font Gray' then + begin + // dimensions + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + for Position2 := 0 to TextureB.Width-1 do begin + Pix := TextureB.Canvas.Pixels[Position2, Position]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + if Typ = 'Arrow' then + begin + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + // transparency + if Pix >= 127 then TempA := 255; + if Pix < 127 then TempA := Pix * 2; + + // ColInt = color intensity + if Pix < 127 then ColInt := 1; + if Pix >= 127 then ColInt := 2 - Pix / 128; + //0.75, 0.6, 0.25 + + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Round(ColInt * 0.75 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := Round(ColInt * 0.6 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Round(ColInt * 0.25 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + if Error > 0 then beep; + end; + end; + + if Typ = 'Note Plain' then + begin + for Position := 0 to TextureB.Height-1 do + begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do + begin + + + + // Skin Patch + // 0-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White + case PPix[Position2*3] of + 0..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); + 192: Pix := Col; + 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); + 255: Pix := $FFFFFF; + end; +// 0.5.0. Original +// case PPix[Position2*3] of +// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; +// 192: Pix := Col; +// 255: Pix := $FFFFFF; +// end; + + + + + + TextureD24[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; + TextureD24[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; + TextureD24[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureB.Width, TextureB.Height, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); + end; + + if Typ = 'Note Transparent' then + begin + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + TempA := 255; + + + + //Skin Patch + // 0= Transparent, 1-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White + case PPix[Position2*3] of + 0: TempA := 0; + 1..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); + 192: Pix := Col; + 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); + 255: Pix := $FFFFFF; + end; +// 0.5.0 Original +// case PPix[Position2*3] of +// 0: TempA := 0; +// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; +// 192: Pix := Col; +// 255: Pix := $FFFFFF; +// end; + + + + + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; +} + + {$ifdef blindydebug} + Log.LogStatus('',' JB-5'); + {$endif} + + + Result.X := 0; + Result.Y := 0; + Result.W := 0; + Result.H := 0; + Result.ScaleW := 1; + Result.ScaleH := 1; + Result.Rot := 0; + Result.TexNum := ActTex; + Result.TexW := oldWidth / newWidth; + Result.TexH := oldHeight / newHeight; + + Result.Int := 1; + Result.ColR := 1; + Result.ColG := 1; + Result.ColB := 1; + Result.Alpha := 1; + + // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these + Result.TexX1 := 0; + Result.TexY1 := 0; + Result.TexX2 := 1; + Result.TexY2 := 1; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-6'); + {$endif} + + + // 0.5.0 + Result.Name := Identifier; + + SDL_FreeSurface(TexSurface); + + {$ifdef blindydebug} + Log.LogStatus('',' JB-7'); + {$endif} + + + Log.BenchmarkEnd(4); + if Log.BenchmarkTimeLength[4] >= 1 then + Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4); + + {$ifdef blindydebug} + Log.LogStatus('',' JB-8'); + {$endif} + +end; + + +function TTextureUnit.GetTexture(Name, Typ: string): TTexture; +begin + Result := GetTexture(Name, Typ, true); +end; + +function TTextureUnit.GetTexture(Name, Typ: string; FromCache: boolean): TTexture; +var + T: integer; // texture + C: integer; // cover + Data: array of byte; +begin + + if Name = '' then + exit; + + // find texture entry + T := FindTexture(Name); + + if T = -1 then + begin + // create texture entry + T := Length(TextureDatabase.Texture); + SetLength(TextureDatabase.Texture, T+1); + + TextureDatabase.Texture[T].Name := Name; + TextureDatabase.Texture[T].Typ := Typ; + + // inform database that no textures have been loaded into memory + TextureDatabase.Texture[T].Texture.TexNum := -1; + TextureDatabase.Texture[T].TextureCache.TexNum := -1; + end; + + // use preloaded texture + if (not FromCache) or (FromCache and not Covers.CoverExists(Name)) then + begin + // use full texture + if TextureDatabase.Texture[T].Texture.TexNum = -1 then + begin + // load texture + {$ifdef blindydebug} + Log.LogStatus('...', 'GetTexture('''+Name+''','''+Typ+''')'); + {$endif} + TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', pchar(Typ), $0); + {$ifdef blindydebug} + Log.LogStatus('done',' '); + {$endif} + end; + + // use texture + Result := TextureDatabase.Texture[T].Texture; + end; + + if FromCache and Covers.CoverExists(Name) then + begin + // use cache texture + C := Covers.CoverNumber(Name); + + if TextureDatabase.Texture[T].TextureCache.TexNum = -1 then + begin + // load texture + Covers.PrepareData(Name); + TextureDatabase.Texture[T].TextureCache := CreateTexture(Covers.Data, Name, Covers.Cover[C].W, Covers.Cover[C].H, 24); + end; + + // use texture + Result := TextureDatabase.Texture[T].TextureCache; + end; +end; + +function TTextureUnit.FindTexture(Name: string): integer; +var + T: integer; // texture +begin + Result := -1; + for T := 0 to high(TextureDatabase.Texture) do + if TextureDatabase.Texture[T].Name = Name then + Result := T; +end; + +function TTextureUnit.LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; +begin + Result := LoadTexture(false, Identifier, Format, Typ, Col); +end; + +function TTextureUnit.LoadTexture(Identifier: string): TTexture; +begin + Result := LoadTexture(false, pchar(Identifier), 'JPG', 'Plain', 0); +end; + +function TTextureUnit.CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; +var + Position: integer; + Position2: integer; + Pix: integer; + ColInt: real; + PPix: PByteArray; + TempA: integer; + Error: integer; +begin + Mipmapping := false; + + glGenTextures(1, @ActTex); // ActText = new texture number + glBindTexture(GL_TEXTURE_2D, ActTex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + glTexImage2D(GL_TEXTURE_2D, 0, 3, W, H, 0, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, W, H, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); + if Error > 0 then beep; + end; + + Result.X := 0; + Result.Y := 0; + Result.W := 0; + Result.H := 0; + Result.ScaleW := 1; + Result.ScaleH := 1; + Result.Rot := 0; + Result.TexNum := ActTex; + Result.TexW := 1; + Result.TexH := 1; + + Result.Int := 1; + Result.ColR := 1; + Result.ColG := 1; + Result.ColB := 1; + Result.Alpha := 1; + + // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these + Result.TexX1 := 0; + Result.TexY1 := 0; + Result.TexX2 := 1; + Result.TexY2 := 1; + + // 0.5.0 + Result.Name := Name; +end; + +procedure TTextureUnit.UnloadTexture(Name: string; FromCache: boolean); +var + T: integer; + TexNum: GLuint; +begin + T := FindTexture(Name); + + if not FromCache then begin + TexNum := TextureDatabase.Texture[T].Texture.TexNum; + if TexNum >= 0 then begin + glDeleteTextures(1, @TexNum); + TextureDatabase.Texture[T].Texture.TexNum := -1; +// Log.LogError('Unload texture no '+IntToStr(TexNum)); + end; + end else begin + TexNum := TextureDatabase.Texture[T].TextureCache.TexNum; + if TexNum >= 0 then begin + glDeleteTextures(1, @TexNum); + TextureDatabase.Texture[T].TextureCache.TexNum := -1; +// Log.LogError('Unload texture cache no '+IntToStr(TexNum)); + end; + end; +end; + +{$IFDEF LAZARUS} +initialization + {$I UltraStar.lrs} +{$ENDIF} + + +end. diff --git a/Game/Code/MacOSX/UltraStarDX.pas b/Game/Code/MacOSX/UltraStarDX.pas index 6c5d4e2b..1b8a3b63 100644 --- a/Game/Code/MacOSX/UltraStarDX.pas +++ b/Game/Code/MacOSX/UltraStarDX.pas @@ -1,6 +1,6 @@ program UltraStarDX; -uses UMain, UAudio_bass, UAudio_FFMpeg, UMedia_dummy, USingNotes, UTextClasses, UVideo; +uses UMain, UMedia_dummy, UAudio_FFMpeg, UAudio_bass, USingNotes, UTextClasses, UVideo; begin Main; diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 index 3dd9e158..b56265f4 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 @@ -190,64 +190,24 @@ Content PBXProjectModuleGUID - 2C0C2C180CDC7312004A651F + 2CF3EF8A0CDE1898004F5956 PBXProjectModuleLabel - USongs.pas + MacResources.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2C0C2C190CDC7312004A651F + 2CF3EF8B0CDE1898004F5956 PBXProjectModuleLabel - USongs.pas + MacResources.pas _historyCapacity 0 bookmark - 2CD3B28C0CDC76B6001F1030 + 2CF3EFEC0CDE1AB6004F5956 history - 2CD3B2550CDC7564001F1030 - - - SplitCount - 1 - - StatusBarVisibility - - - Geometry - - Frame - {{0, 20}, {797, 748}} - PBXModuleWindowStatusBarHidden2 - - RubberWindowFrame - 84 171 797 789 0 0 1680 1028 - - - - Content - - PBXProjectModuleGUID - 2CF552990CDA426600627463 - PBXProjectModuleLabel - UMain.pas - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 2CF5529A0CDA426600627463 - PBXProjectModuleLabel - UMain.pas - _historyCapacity - 0 - bookmark - 2CD3B28D0CDC76B6001F1030 - history - - 2C0C2C430CDC73BE004A651F + 2CF3EFA30CDE1A19004F5956 SplitCount @@ -263,31 +223,31 @@ PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 222 147 1052 687 0 0 1680 1028 + 515 276 1052 687 0 0 1680 1028 Content PBXProjectModuleGUID - 2CF5536C0CDA575B00627463 + 2C0C2C180CDC7312004A651F PBXProjectModuleLabel - UltraStarDX.pas + USongs.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2CF5536D0CDA575B00627463 + 2C0C2C190CDC7312004A651F PBXProjectModuleLabel - UltraStarDX.pas + USongs.pas _historyCapacity 0 bookmark - 2CD3B28E0CDC76B6001F1030 + 2CF3EFED0CDE1AB6004F5956 history - 2C0C2C450CDC73BE004A651F + 2CE7D8F70CDCA55E0027F7CD SplitCount @@ -299,11 +259,11 @@ Geometry Frame - {{0, 20}, {987, 762}} + {{0, 20}, {797, 748}} PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 189 142 987 803 0 0 1680 1028 + 84 171 797 789 0 0 1680 1028 @@ -324,10 +284,10 @@ _historyCapacity 0 bookmark - 2CD3B28F0CDC76B6001F1030 + 2CF3EFEE0CDE1AB6004F5956 history - 2C0C2C460CDC73BE004A651F + 2CE7D8F90CDCA55E0027F7CD SplitCount @@ -364,10 +324,10 @@ _historyCapacity 0 bookmark - 2CD3B2900CDC76B6001F1030 + 2CF3EFEF0CDE1AB6004F5956 history - 2C0C2C470CDC73BE004A651F + 2CE7D8FA0CDCA55E0027F7CD SplitCount @@ -404,10 +364,10 @@ _historyCapacity 0 bookmark - 2CD3B2910CDC76B6001F1030 + 2CF3EFF00CDE1AB6004F5956 history - 2C0C2C480CDC73BE004A651F + 2CE7D8FB0CDCA55E0027F7CD SplitCount @@ -444,10 +404,10 @@ _historyCapacity 0 bookmark - 2CD3B2920CDC76B6001F1030 + 2CF3EFF10CDE1AB6004F5956 history - 2C0C2C490CDC73BE004A651F + 2CE7D8FC0CDCA55E0027F7CD SplitCount @@ -484,10 +444,10 @@ _historyCapacity 0 bookmark - 2CD3B2930CDC76B6001F1030 + 2CF3EFF20CDE1AB6004F5956 history - 2C0C2C4A0CDC73BE004A651F + 2CE7D8FD0CDCA55E0027F7CD SplitCount @@ -506,46 +466,6 @@ 15 338 616 685 0 0 1680 1028 - - Content - - PBXProjectModuleGUID - 2CF5528D0CDA426600627463 - PBXProjectModuleLabel - Windows.pas - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 2CF5528E0CDA426600627463 - PBXProjectModuleLabel - Windows.pas - _historyCapacity - 0 - bookmark - 2CD3B2940CDC76B6001F1030 - history - - 2C0C2C4B0CDC73BE004A651F - - - SplitCount - 1 - - StatusBarVisibility - - - Geometry - - Frame - {{0, 20}, {616, 644}} - PBXModuleWindowStatusBarHidden2 - - RubberWindowFrame - 176 191 616 685 0 0 1680 1028 - - PerspectiveWidths @@ -623,13 +543,13 @@ PBXSmartGroupTreeModuleOutlineStateSelectionKey - 17 + 21 15 0 PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 20}, {266, 694}} + {{0, 0}, {266, 694}} PBXTopSmartGroupGIDs @@ -648,7 +568,7 @@ 266 RubberWindowFrame - 772 270 817 753 0 0 1680 1028 + 767 271 817 753 0 0 1680 1028 Module PBXSmartGroupTreeModule @@ -685,7 +605,7 @@ Frame {{0, 0}, {529, 0}} RubberWindowFrame - 772 270 817 753 0 0 1680 1028 + 767 271 817 753 0 0 1680 1028 Module PBXNavigatorGroup @@ -707,7 +627,7 @@ Frame {{0, 5}, {529, 707}} RubberWindowFrame - 772 270 817 753 0 0 1680 1028 + 767 271 817 753 0 0 1680 1028 Module XCDetailModule @@ -731,9 +651,9 @@ TableOfContents - 2CD3B23F0CDC7545001F1030 + 2CF3EE840CDE0AAA004F5956 1CE0B1FE06471DED0097A5F4 - 2CD3B2400CDC7545001F1030 + 2CF3EE850CDE0AAA004F5956 1CE0B20306471E060097A5F4 1CE0B20506471E060097A5F4 @@ -867,26 +787,25 @@ 5 WindowOrderList - 2CD3B2610CDC7564001F1030 - 2CD3B2620CDC7564001F1030 - 2CDD4BFC0CB948FC00549FAC 2CDD4B730CB935C700549FAC - 2CD3B2500CDC7545001F1030 - 2CF5528D0CDA426600627463 + 1C530D57069F1CE1000CFCEE + 2CF3EE990CDE0AAA004F5956 + 2CF3EE9A0CDE0AAA004F5956 + 2CDD4BFC0CB948FC00549FAC + 2CF3EE950CDE0AAA004F5956 + 1C0AD2B3069F1EA900FABCE6 2CF553750CDA575B00627463 2CF553720CDA575B00627463 2CF5536F0CDA575B00627463 2CF552930CDA426600627463 2CF552960CDA426600627463 - 2CF5536C0CDA575B00627463 - 2CF552990CDA426600627463 - 1C0AD2B3069F1EA900FABCE6 - /Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj 2C0C2C180CDC7312004A651F + /Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj + 2CF3EF8A0CDE1898004F5956 1CD10A99069EF8BA00B06720 WindowString - 772 270 817 753 0 0 1680 1028 + 767 271 817 753 0 0 1680 1028 WindowTools @@ -902,12 +821,14 @@ Dock + BecomeActive + ContentConfiguration PBXProjectModuleGUID 1CD0528F0623707200166675 PBXProjectModuleLabel - + MacResources.pas StatusBarVisibility @@ -963,7 +884,7 @@ TableOfContents 2CDD4B730CB935C700549FAC - 2CD3B25F0CDC7564001F1030 + 2CF3EEAC0CDE0C76004F5956 1CD0528F0623707200166675 XCMainBuildResultsModuleGUID @@ -1005,8 +926,8 @@ yes sizes - {{0, 0}, {347, 414}} - {{347, 0}, {617, 414}} + {{0, 0}, {341, 414}} + {{341, 0}, {623, 414}} VerticalSplitView @@ -1069,14 +990,14 @@ TableOfContents 1CD10A99069EF8BA00B06720 - 2CD3B24A0CDC7545001F1030 + 2CF3EE8F0CDE0AAA004F5956 1C162984064C10D400B95A72 - 2CD3B24B0CDC7545001F1030 - 2CD3B24C0CDC7545001F1030 - 2CD3B24D0CDC7545001F1030 - 2CD3B24E0CDC7545001F1030 - 2CD3B24F0CDC7545001F1030 - 2CD3B2500CDC7545001F1030 + 2CF3EE900CDE0AAA004F5956 + 2CF3EE910CDE0AAA004F5956 + 2CF3EE920CDE0AAA004F5956 + 2CF3EE930CDE0AAA004F5956 + 2CF3EE940CDE0AAA004F5956 + 2CF3EE950CDE0AAA004F5956 ToolbarConfiguration xcode.toolbar.config.debug @@ -1108,7 +1029,7 @@ PBXProjectModuleGUID 1CDD528C0622207200134675 PBXProjectModuleLabel - UCommon.pas + UAudio_bass.pas StatusBarVisibility @@ -1117,7 +1038,7 @@ Frame {{0, 0}, {790, 502}} RubberWindowFrame - 688 118 790 888 0 0 1680 1028 + 890 81 790 888 0 0 1680 1028 Module PBXNavigatorGroup @@ -1143,7 +1064,7 @@ Frame {{0, 507}, {790, 340}} RubberWindowFrame - 688 118 790 888 0 0 1680 1028 + 890 81 790 888 0 0 1680 1028 Module PBXProjectFindModule @@ -1166,17 +1087,17 @@ TableOfContents 1C530D57069F1CE1000CFCEE - 2CF54F3B0CDA1AA600627463 - 2CF54F3C0CDA1AA600627463 + 2CF3EEA70CDE0C55004F5956 + 2CF3EEA80CDE0C55004F5956 1CDD528C0622207200134675 1CD0528E0623707200166675 WindowString - 688 118 790 888 0 0 1680 1028 + 890 81 790 888 0 0 1680 1028 WindowToolGUID 1C530D57069F1CE1000CFCEE WindowToolIsVisible - + Identifier @@ -1195,6 +1116,8 @@ Dock + BecomeActive + ContentConfiguration PBXProjectModuleGUID @@ -1205,18 +1128,18 @@ GeometryConfiguration Frame - {{0, 0}, {440, 358}} + {{0, 0}, {1248, 416}} RubberWindowFrame - 80 556 440 400 0 0 1680 1028 + 426 66 1248 457 0 0 1680 1028 Module PBXDebugCLIModule Proportion - 358pt + 416pt Proportion - 359pt + 416pt Name @@ -1230,11 +1153,11 @@ TableOfContents 2CDD4BFC0CB948FC00549FAC - 2CD3B2600CDC7564001F1030 + 2CF3EE960CDE0AAA004F5956 1C78EAAC065D492600B07095 WindowString - 80 556 440 400 0 0 1680 1028 + 426 66 1248 457 0 0 1680 1028 WindowToolGUID 2CDD4BFC0CB948FC00549FAC WindowToolIsVisible @@ -1300,18 +1223,18 @@ GeometryConfiguration Frame - {{0, 0}, {966, 265}} + {{0, 0}, {1092, 660}} RubberWindowFrame - 133 636 966 306 0 0 1680 1028 + 133 241 1092 701 0 0 1680 1028 Module PBXRunSessionModule Proportion - 265pt + 660pt Proportion - 265pt + 660pt Name @@ -1325,18 +1248,18 @@ TableOfContents 1C0AD2B3069F1EA900FABCE6 - 2CD3B2510CDC7545001F1030 + 2CF3EE970CDE0AAA004F5956 1CD0528B0623707200166675 - 2CD3B2520CDC7545001F1030 + 2CF3EE980CDE0AAA004F5956 ToolbarConfiguration xcode.toolbar.config.run WindowString - 133 636 966 306 0 0 1680 1028 + 133 241 1092 701 0 0 1680 1028 WindowToolGUID 1C0AD2B3069F1EA900FABCE6 WindowToolIsVisible - + FirstTimeWindowDisplayed diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser index af8b639d..0a358f1e 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser @@ -1,90 +1,10 @@ // !$*UTF8*$! { - 2C0C2C430CDC73BE004A651F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; - name = "UMain.pas: 15"; - rLen = 0; - rLoc = 198; - rType = 0; - vrLen = 637; - vrLoc = 0; - }; - 2C0C2C450CDC73BE004A651F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; - name = "UltraStarDX.pas: 6"; - rLen = 0; - rLoc = 117; - rType = 0; - vrLen = 131; - vrLoc = 0; - }; - 2C0C2C460CDC73BE004A651F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; - name = "UAudio_FFMpeg.pas: 952"; - rLen = 0; - rLoc = 22697; - rType = 0; - vrLen = 1224; - vrLoc = 21473; - }; - 2C0C2C470CDC73BE004A651F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; - name = "nux ... is t"; - rLen = 12; - rLoc = 3202; - rType = 0; - vrLen = 1266; - vrLoc = 15619; - }; - 2C0C2C480CDC73BE004A651F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; - name = "sdl_image.pas: 130"; - rLen = 0; - rLoc = 8020; - rType = 0; - vrLen = 832; - vrLoc = 7978; - }; - 2C0C2C490CDC73BE004A651F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; - name = "sdl.pas: 250"; - rLen = 0; - rLoc = 16506; - rType = 0; - vrLen = 886; - vrLoc = 16376; - }; - 2C0C2C4A0CDC73BE004A651F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; - name = "ScaledTexture(TexSur"; - rLen = 20; - rLoc = 11816; - rType = 0; - vrLen = 1220; - vrLoc = 11189; - }; - 2C0C2C4B0CDC73BE004A651F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; - name = "Windows.pas: 114"; - rLen = 0; - rLoc = 2832; - rType = 0; - vrLen = 1182; - vrLoc = 2090; - }; 2C4D9C620CC9EC8C0031092D /* TextGL.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {758, 7742}}"; - sepNavSelRange = "{12201, 8}"; - sepNavVisRect = "{{0, 6061}, {758, 716}}"; + sepNavIntBoundsRect = "{{0, 0}, {923, 7798}}"; + sepNavSelRange = "{3311, 0}"; + sepNavVisRect = "{{0, 1726}, {923, 342}}"; sepNavWindowFrame = "{{38, 157}, {797, 845}}"; }; }; @@ -187,8 +107,8 @@ 2C4D9C6F0CC9EC8C0031092D /* UGraphic.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {923, 10444}}"; - sepNavSelRange = "{15582, 0}"; - sepNavVisRect = "{{0, 6612}, {923, 342}}"; + sepNavSelRange = "{5900, 0}"; + sepNavVisRect = "{{0, 3588}, {923, 342}}"; sepNavWindowFrame = "{{38, 157}, {797, 845}}"; }; }; @@ -274,17 +194,17 @@ }; 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1013, 15456}}"; - sepNavSelRange = "{198, 0}"; - sepNavVisRect = "{{0, 0}, {1013, 614}}"; + sepNavIntBoundsRect = "{{0, 0}, {998, 15456}}"; + sepNavSelRange = "{7398, 0}"; + sepNavVisRect = "{{0, 3938}, {923, 342}}"; sepNavWindowFrame = "{{222, 91}, {1052, 743}}"; }; }; 2C4D9C7C0CC9EC8C0031092D /* UMedia_dummy.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {758, 3864}}"; + sepNavIntBoundsRect = "{{0, 0}, {758, 3920}}"; sepNavSelRange = "{859, 0}"; - sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavVisRect = "{{0, 3204}, {758, 716}}"; sepNavWindowFrame = "{{107, 94}, {797, 845}}"; }; }; @@ -298,9 +218,9 @@ }; 2C4D9C7E0CC9EC8C0031092D /* UMusic.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {758, 4438}}"; - sepNavSelRange = "{44, 0}"; - sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavIntBoundsRect = "{{0, 0}, {749, 4494}}"; + sepNavSelRange = "{5162, 12}"; + sepNavVisRect = "{{0, 2580}, {749, 470}}"; sepNavWindowFrame = "{{153, 52}, {797, 845}}"; }; }; @@ -338,9 +258,9 @@ }; 2C4D9C840CC9EC8C0031092D /* URecord.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1277, 4998}}"; - sepNavSelRange = "{159, 11}"; - sepNavVisRect = "{{0, 0}, {1277, 312}}"; + sepNavIntBoundsRect = "{{0, 0}, {749, 5054}}"; + sepNavSelRange = "{152, 4}"; + sepNavVisRect = "{{0, 0}, {749, 470}}"; sepNavWindowFrame = "{{130, 73}, {797, 845}}"; }; }; @@ -370,9 +290,9 @@ }; 2C4D9C880CC9EC8C0031092D /* USkins.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {758, 2408}}"; - sepNavSelRange = "{25, 0}"; - sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavIntBoundsRect = "{{0, 0}, {923, 2464}}"; + sepNavSelRange = "{1178, 0}"; + sepNavVisRect = "{{0, 550}, {923, 342}}"; sepNavWindowFrame = "{{61, 136}, {797, 845}}"; }; }; @@ -380,7 +300,7 @@ uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {950, 14686}}"; sepNavSelRange = "{503, 0}"; - sepNavVisRect = "{{0, 2095}, {758, 716}}"; + sepNavVisRect = "{{0, 2086}, {758, 716}}"; sepNavWindowFrame = "{{84, 115}, {797, 845}}"; }; }; @@ -394,17 +314,17 @@ }; 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1730, 15960}}"; - sepNavSelRange = "{11816, 20}"; + sepNavIntBoundsRect = "{{0, 0}, {1730, 16002}}"; + sepNavSelRange = "{11873, 20}"; sepNavVisRect = "{{0, 4988}, {577, 612}}"; sepNavWindowFrame = "{{15, 282}, {616, 741}}"; }; }; 2C4D9C8C0CC9EC8C0031092D /* UThemes.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {788, 30954}}"; - sepNavSelRange = "{44, 0}"; - sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavIntBoundsRect = "{{0, 0}, {923, 31010}}"; + sepNavSelRange = "{21229, 0}"; + sepNavVisRect = "{{0, 19678}, {923, 342}}"; sepNavWindowFrame = "{{130, 73}, {797, 845}}"; }; }; @@ -545,9 +465,9 @@ }; 2C4D9E000CC9EF840031092D /* Graphics.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1277, 2674}}"; + sepNavIntBoundsRect = "{{0, 0}, {620, 2674}}"; sepNavSelRange = "{58, 56}"; - sepNavVisRect = "{{0, 0}, {1277, 312}}"; + sepNavVisRect = "{{0, 0}, {577, 612}}"; sepNavWindowFrame = "{{38, 261}, {616, 741}}"; }; }; @@ -570,119 +490,19 @@ 2C4D9E090CC9EF840031092D /* Windows.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {577, 2352}}"; - sepNavSelRange = "{2832, 0}"; + sepNavSelRange = "{2345, 0}"; sepNavVisRect = "{{0, 1278}, {577, 612}}"; sepNavWindowFrame = "{{176, 135}, {616, 741}}"; }; }; 2C4D9E440CC9F0ED0031092D /* switches.inc */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {577, 616}}"; + sepNavIntBoundsRect = "{{0, 0}, {698, 644}}"; sepNavSelRange = "{312, 0}"; - sepNavVisRect = "{{0, 0}, {577, 612}}"; + sepNavVisRect = "{{0, 7}, {577, 612}}"; sepNavWindowFrame = "{{15, 282}, {616, 741}}"; }; }; - 2CD3B2550CDC7564001F1030 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; - name = "USongs.pas: 39"; - rLen = 0; - rLoc = 503; - rType = 0; - vrLen = 753; - vrLoc = 0; - }; - 2CD3B28C0CDC76B6001F1030 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; - name = "USongs.pas: 39"; - rLen = 0; - rLoc = 503; - rType = 0; - vrLen = 1403; - vrLoc = 4615; - }; - 2CD3B28D0CDC76B6001F1030 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */; - name = "UMain.pas: 15"; - rLen = 0; - rLoc = 198; - rType = 0; - vrLen = 637; - vrLoc = 0; - }; - 2CD3B28E0CDC76B6001F1030 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; - name = "UltraStarDX.pas: 6"; - rLen = 0; - rLoc = 117; - rType = 0; - vrLen = 131; - vrLoc = 0; - }; - 2CD3B28F0CDC76B6001F1030 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; - name = "UAudio_FFMpeg.pas: 952"; - rLen = 0; - rLoc = 22697; - rType = 0; - vrLen = 1224; - vrLoc = 21473; - }; - 2CD3B2900CDC76B6001F1030 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; - name = "nux ... is t"; - rLen = 12; - rLoc = 3202; - rType = 0; - vrLen = 1266; - vrLoc = 15619; - }; - 2CD3B2910CDC76B6001F1030 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; - name = "sdl_image.pas: 130"; - rLen = 0; - rLoc = 8020; - rType = 0; - vrLen = 832; - vrLoc = 7978; - }; - 2CD3B2920CDC76B6001F1030 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; - name = "sdl.pas: 250"; - rLen = 0; - rLoc = 16506; - rType = 0; - vrLen = 886; - vrLoc = 16376; - }; - 2CD3B2930CDC76B6001F1030 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; - name = "ScaledTexture(TexSur"; - rLen = 20; - rLoc = 11816; - rType = 0; - vrLen = 1220; - vrLoc = 11189; - }; - 2CD3B2940CDC76B6001F1030 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; - name = "Windows.pas: 114"; - rLen = 0; - rLoc = 2832; - rType = 0; - vrLen = 1182; - vrLoc = 2090; - }; 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1013, 1022}}"; @@ -756,10 +576,165 @@ fileReference = 2CDD439C0CBBE92D00F364DE /* UMain.pas */; hitCount = 1; lineNumber = 293; - location = UltraStarDX; - modificationTime = 215774704.034014; + modificationTime = 215882409.953114; state = 1; }; + 2CE7D8F70CDCA55E0027F7CD /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; + name = "USongs.pas: 39"; + rLen = 0; + rLoc = 503; + rType = 0; + vrLen = 1403; + vrLoc = 4615; + }; + 2CE7D8F90CDCA55E0027F7CD /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; + name = "UAudio_FFMpeg.pas: 952"; + rLen = 0; + rLoc = 22697; + rType = 0; + vrLen = 1224; + vrLoc = 21473; + }; + 2CE7D8FA0CDCA55E0027F7CD /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; + name = "nux ... is t"; + rLen = 12; + rLoc = 3202; + rType = 0; + vrLen = 1266; + vrLoc = 15619; + }; + 2CE7D8FB0CDCA55E0027F7CD /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; + name = "sdl_image.pas: 130"; + rLen = 0; + rLoc = 8020; + rType = 0; + vrLen = 832; + vrLoc = 7978; + }; + 2CE7D8FC0CDCA55E0027F7CD /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; + name = "sdl.pas: 250"; + rLen = 0; + rLoc = 16506; + rType = 0; + vrLen = 886; + vrLoc = 16376; + }; + 2CE7D8FD0CDCA55E0027F7CD /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; + name = "ScaledTexture(TexSur"; + rLen = 20; + rLoc = 11873; + rType = 0; + vrLen = 1220; + vrLoc = 11189; + }; + 2CF3EF210CDE13A0004F5956 /* Messages.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1013, 614}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {1013, 614}}"; + sepNavWindowFrame = "{{38, 259}, {1052, 743}}"; + }; + }; + 2CF3EF260CDE13BA004F5956 /* MacResources.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1013, 1022}}"; + sepNavSelRange = "{1521, 0}"; + sepNavVisRect = "{{0, 310}, {1013, 614}}"; + sepNavWindowFrame = "{{515, 220}, {1052, 743}}"; + }; + }; + 2CF3EFA30CDE1A19004F5956 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2CF3EF260CDE13BA004F5956 /* MacResources.pas */; + name = "MacResources.pas: 63"; + rLen = 0; + rLoc = 1896; + rType = 0; + vrLen = 1181; + vrLoc = 455; + }; + 2CF3EFEC0CDE1AB6004F5956 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2CF3EF260CDE13BA004F5956 /* MacResources.pas */; + name = "MacResources.pas: 60"; + rLen = 0; + rLoc = 1521; + rType = 0; + vrLen = 1339; + vrLoc = 455; + }; + 2CF3EFED0CDE1AB6004F5956 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; + name = "USongs.pas: 39"; + rLen = 0; + rLoc = 503; + rType = 0; + vrLen = 1403; + vrLoc = 4615; + }; + 2CF3EFEE0CDE1AB6004F5956 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; + name = "UAudio_FFMpeg.pas: 952"; + rLen = 0; + rLoc = 22697; + rType = 0; + vrLen = 1224; + vrLoc = 21473; + }; + 2CF3EFEF0CDE1AB6004F5956 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; + name = "nux ... is t"; + rLen = 12; + rLoc = 3202; + rType = 0; + vrLen = 1266; + vrLoc = 15619; + }; + 2CF3EFF00CDE1AB6004F5956 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; + name = "sdl_image.pas: 130"; + rLen = 0; + rLoc = 8020; + rType = 0; + vrLen = 832; + vrLoc = 7978; + }; + 2CF3EFF10CDE1AB6004F5956 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; + name = "sdl.pas: 250"; + rLen = 0; + rLoc = 16506; + rType = 0; + vrLen = 886; + vrLoc = 16376; + }; + 2CF3EFF20CDE1AB6004F5956 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; + name = "ScaledTexture(TexSur"; + rLen = 20; + rLoc = 11873; + rType = 0; + vrLen = 1184; + vrLoc = 11218; + }; 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1196, 19586}}"; @@ -1072,14 +1047,6 @@ sepNavWindowFrame = "{{107, 196}, {1052, 743}}"; }; }; - 2CF552660CDA404000627463 /* Messages.pas */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1013, 614}}"; - sepNavSelRange = "{65, 0}"; - sepNavVisRect = "{{0, 0}, {1013, 614}}"; - sepNavWindowFrame = "{{102, 176}, {1052, 743}}"; - }; - }; 2CF5529E0CDA42C900627463 /* avcodec.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1013, 28616}}"; @@ -1153,6 +1120,7 @@ activeTarget = DDC688C709F574E9004E4BFF /* UltraStarDX */; addToTargets = ( DDC688C709F574E9004E4BFF /* UltraStarDX */, + DDC688D409F57523004E4BFF /* Put all program sources also in this target */, ); breakpoints = ( 2CDEA8080CBD7D920096994C /* UMain.pas:293 */, @@ -1261,28 +1229,24 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 215774521; - PBXWorkspaceStateSaveDate = 215774521; + PBXPerProjectTemplateStateSaveDate = 215878288; + PBXWorkspaceStateSaveDate = 215878288; }; perUserProjectItems = { - 2C0C2C430CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C430CDC73BE004A651F /* PBXTextBookmark */; - 2C0C2C450CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C450CDC73BE004A651F /* PBXTextBookmark */; - 2C0C2C460CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C460CDC73BE004A651F /* PBXTextBookmark */; - 2C0C2C470CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C470CDC73BE004A651F /* PBXTextBookmark */; - 2C0C2C480CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C480CDC73BE004A651F /* PBXTextBookmark */; - 2C0C2C490CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C490CDC73BE004A651F /* PBXTextBookmark */; - 2C0C2C4A0CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C4A0CDC73BE004A651F /* PBXTextBookmark */; - 2C0C2C4B0CDC73BE004A651F /* PBXTextBookmark */ = 2C0C2C4B0CDC73BE004A651F /* PBXTextBookmark */; - 2CD3B2550CDC7564001F1030 /* PBXTextBookmark */ = 2CD3B2550CDC7564001F1030 /* PBXTextBookmark */; - 2CD3B28C0CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B28C0CDC76B6001F1030 /* PBXTextBookmark */; - 2CD3B28D0CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B28D0CDC76B6001F1030 /* PBXTextBookmark */; - 2CD3B28E0CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B28E0CDC76B6001F1030 /* PBXTextBookmark */; - 2CD3B28F0CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B28F0CDC76B6001F1030 /* PBXTextBookmark */; - 2CD3B2900CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B2900CDC76B6001F1030 /* PBXTextBookmark */; - 2CD3B2910CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B2910CDC76B6001F1030 /* PBXTextBookmark */; - 2CD3B2920CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B2920CDC76B6001F1030 /* PBXTextBookmark */; - 2CD3B2930CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B2930CDC76B6001F1030 /* PBXTextBookmark */; - 2CD3B2940CDC76B6001F1030 /* PBXTextBookmark */ = 2CD3B2940CDC76B6001F1030 /* PBXTextBookmark */; + 2CE7D8F70CDCA55E0027F7CD /* PBXTextBookmark */ = 2CE7D8F70CDCA55E0027F7CD /* PBXTextBookmark */; + 2CE7D8F90CDCA55E0027F7CD /* PBXTextBookmark */ = 2CE7D8F90CDCA55E0027F7CD /* PBXTextBookmark */; + 2CE7D8FA0CDCA55E0027F7CD /* PBXTextBookmark */ = 2CE7D8FA0CDCA55E0027F7CD /* PBXTextBookmark */; + 2CE7D8FB0CDCA55E0027F7CD /* PBXTextBookmark */ = 2CE7D8FB0CDCA55E0027F7CD /* PBXTextBookmark */; + 2CE7D8FC0CDCA55E0027F7CD /* PBXTextBookmark */ = 2CE7D8FC0CDCA55E0027F7CD /* PBXTextBookmark */; + 2CE7D8FD0CDCA55E0027F7CD /* PBXTextBookmark */ = 2CE7D8FD0CDCA55E0027F7CD /* PBXTextBookmark */; + 2CF3EFA30CDE1A19004F5956 /* PBXTextBookmark */ = 2CF3EFA30CDE1A19004F5956 /* PBXTextBookmark */; + 2CF3EFEC0CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFEC0CDE1AB6004F5956 /* PBXTextBookmark */; + 2CF3EFED0CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFED0CDE1AB6004F5956 /* PBXTextBookmark */; + 2CF3EFEE0CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFEE0CDE1AB6004F5956 /* PBXTextBookmark */; + 2CF3EFEF0CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFEF0CDE1AB6004F5956 /* PBXTextBookmark */; + 2CF3EFF00CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFF00CDE1AB6004F5956 /* PBXTextBookmark */; + 2CF3EFF10CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFF10CDE1AB6004F5956 /* PBXTextBookmark */; + 2CF3EFF20CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFF20CDE1AB6004F5956 /* PBXTextBookmark */; }; sourceControlManager = 2CDD4B690CB9357000549FAC /* Source Control */; userBuildSettings = { @@ -1290,9 +1254,9 @@ }; DDC6851B09F57195004E4BFF /* UltraStarDX.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {948, 730}}"; + sepNavIntBoundsRect = "{{0, 0}, {923, 342}}"; sepNavSelRange = "{117, 0}"; - sepNavVisRect = "{{0, 0}, {948, 730}}"; + sepNavVisRect = "{{0, 0}, {923, 342}}"; sepNavWindowFrame = "{{189, 86}, {987, 859}}"; }; }; diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj index f8cd06e7..6d8eb133 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj @@ -147,6 +147,10 @@ 2CDD4BE20CB947BE00549FAC /* UltraStarDX.pas in Sources */ = {isa = PBXBuildFile; fileRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; }; 2CDEA4F70CBD725B0096994C /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CDEA4F60CBD725B0096994C /* OpenGL.framework */; }; 2CDEC4960CC5264600FFA244 /* SDL.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 98B8BE570B1F972400162019 /* SDL.framework */; }; + 2CF3EF220CDE13A0004F5956 /* Messages.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF3EF210CDE13A0004F5956 /* Messages.pas */; }; + 2CF3EF230CDE13A0004F5956 /* Messages.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF3EF210CDE13A0004F5956 /* Messages.pas */; }; + 2CF3EF270CDE13BA004F5956 /* MacResources.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF3EF260CDE13BA004F5956 /* MacResources.pas */; }; + 2CF3EF280CDE13BA004F5956 /* MacResources.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF3EF260CDE13BA004F5956 /* MacResources.pas */; }; 2CF54F650CDA1B2B00627463 /* UScreenCredits.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */; }; 2CF54F660CDA1B2B00627463 /* UScreenEdit.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F440CDA1B2B00627463 /* UScreenEdit.pas */; }; 2CF54F670CDA1B2B00627463 /* UScreenEditConvert.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF54F450CDA1B2B00627463 /* UScreenEditConvert.pas */; }; @@ -224,8 +228,6 @@ 2CF5512D0CDA29C600627463 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CF5512C0CDA29C600627463 /* libsqlite3.dylib */; }; 2CF552140CDA3D1400627463 /* UPluginDefs.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552110CDA3D1400627463 /* UPluginDefs.pas */; }; 2CF552170CDA3D1400627463 /* UPluginDefs.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552110CDA3D1400627463 /* UPluginDefs.pas */; }; - 2CF552670CDA404000627463 /* Messages.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552660CDA404000627463 /* Messages.pas */; }; - 2CF552680CDA404000627463 /* Messages.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552660CDA404000627463 /* Messages.pas */; }; 2CF552A70CDA42C900627463 /* avcodec.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF5529E0CDA42C900627463 /* avcodec.pas */; }; 2CF552A80CDA42C900627463 /* avformat.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF5529F0CDA42C900627463 /* avformat.pas */; }; 2CF552A90CDA42C900627463 /* avio.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552A00CDA42C900627463 /* avio.pas */; }; @@ -428,6 +430,8 @@ 2C4FA2A70CDBAD1E002CC3B0 /* ustar-icon_v01.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = "ustar-icon_v01.icns"; path = "../../Graphics/ustar-icon_v01.icns"; sourceTree = SOURCE_ROOT; }; 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = StrUtils.pas; path = ../../../Modis/SDK/StrUtils.pas; sourceTree = SOURCE_ROOT; }; 2CDEA4F60CBD725B0096994C /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; + 2CF3EF210CDE13A0004F5956 /* Messages.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = Messages.pas; path = Wrapper/Messages.pas; sourceTree = ""; }; + 2CF3EF260CDE13BA004F5956 /* MacResources.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = MacResources.pas; path = Wrapper/MacResources.pas; sourceTree = ""; }; 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenCredits.pas; path = ../Screens/UScreenCredits.pas; sourceTree = SOURCE_ROOT; }; 2CF54F440CDA1B2B00627463 /* UScreenEdit.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenEdit.pas; path = ../Screens/UScreenEdit.pas; sourceTree = SOURCE_ROOT; }; 2CF54F450CDA1B2B00627463 /* UScreenEditConvert.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenEditConvert.pas; path = ../Screens/UScreenEditConvert.pas; sourceTree = SOURCE_ROOT; }; @@ -468,7 +472,6 @@ 2CF5512C0CDA29C600627463 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = ../lib/SQLite/libsqlite3.dylib; sourceTree = SOURCE_ROOT; }; 2CF551A70CDA356800627463 /* UltraStar.dpr */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; name = UltraStar.dpr; path = ../UltraStar.dpr; sourceTree = SOURCE_ROOT; }; 2CF552110CDA3D1400627463 /* UPluginDefs.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UPluginDefs.pas; path = ../../../Modis/SDK/UPluginDefs.pas; sourceTree = SOURCE_ROOT; }; - 2CF552660CDA404000627463 /* Messages.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; path = Messages.pas; sourceTree = ""; }; 2CF5529E0CDA42C900627463 /* avcodec.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = avcodec.pas; path = ../lib/ffmpeg/avcodec.pas; sourceTree = SOURCE_ROOT; }; 2CF5529F0CDA42C900627463 /* avformat.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = avformat.pas; path = ../lib/ffmpeg/avformat.pas; sourceTree = SOURCE_ROOT; }; 2CF552A00CDA42C900627463 /* avio.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = avio.pas; path = ../lib/ffmpeg/avio.pas; sourceTree = SOURCE_ROOT; }; @@ -539,11 +542,12 @@ 2C4D9DF50CC9EF3A0031092D /* Wrapper */ = { isa = PBXGroup; children = ( + 2CF3EF260CDE13BA004F5956 /* MacResources.pas */, + 2CF3EF210CDE13A0004F5956 /* Messages.pas */, 2C4D9E000CC9EF840031092D /* Graphics.pas */, 2C4D9E010CC9EF840031092D /* JPEG.pas */, 2C4D9E040CC9EF840031092D /* OpenGL12.pas */, 2C4D9E090CC9EF840031092D /* Windows.pas */, - 2CF552660CDA404000627463 /* Messages.pas */, ); name = Wrapper; sourceTree = ""; @@ -1059,7 +1063,6 @@ 2CF551100CDA293700627463 /* SQLite3.pas in Sources */, 2CF551110CDA293700627463 /* SQLiteTable3.pas in Sources */, 2CF552140CDA3D1400627463 /* UPluginDefs.pas in Sources */, - 2CF552680CDA404000627463 /* Messages.pas in Sources */, 2CF552B00CDA42C900627463 /* avcodec.pas in Sources */, 2CF552B10CDA42C900627463 /* avformat.pas in Sources */, 2CF552B20CDA42C900627463 /* avio.pas in Sources */, @@ -1068,6 +1071,8 @@ 2CF552B70CDA42C900627463 /* rational.pas in Sources */, 2CF553080CDA51B500627463 /* sdlutils.pas in Sources */, 2CDC716C0CDB9CB70018F966 /* StrUtils.pas in Sources */, + 2CF3EF220CDE13A0004F5956 /* Messages.pas in Sources */, + 2CF3EF270CDE13BA004F5956 /* MacResources.pas in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1179,7 +1184,6 @@ 2CF551120CDA293700627463 /* SQLite3.pas in Sources */, 2CF551130CDA293700627463 /* SQLiteTable3.pas in Sources */, 2CF552170CDA3D1400627463 /* UPluginDefs.pas in Sources */, - 2CF552670CDA404000627463 /* Messages.pas in Sources */, 2CF552A70CDA42C900627463 /* avcodec.pas in Sources */, 2CF552A80CDA42C900627463 /* avformat.pas in Sources */, 2CF552A90CDA42C900627463 /* avio.pas in Sources */, @@ -1188,6 +1192,8 @@ 2CF552AE0CDA42C900627463 /* rational.pas in Sources */, 2CF553090CDA51B500627463 /* sdlutils.pas in Sources */, 2CDC716D0CDB9CB70018F966 /* StrUtils.pas in Sources */, + 2CF3EF230CDE13A0004F5956 /* Messages.pas in Sources */, + 2CF3EF280CDE13BA004F5956 /* MacResources.pas in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Game/Code/MacOSX/Wrapper/MacClasses.pas b/Game/Code/MacOSX/Wrapper/MacClasses.pas deleted file mode 100755 index be41ac55..00000000 --- a/Game/Code/MacOSX/Wrapper/MacClasses.pas +++ /dev/null @@ -1,57 +0,0 @@ -unit MacClasses; - -{$I switches.inc} - -interface - -uses - Classes, GlueWindows, SysUtils; - -type - - TMemoryStream = Classes.TMemoryStream; - - TResourceStream = class(TFileStream) - private - public - constructor Create(Instance: THandle; const ResName: string; ResType: PChar); - end; - -{$IFDEF MACOS} - TWndMethod = procedure of object; -{$ENDIF} - - function AllocateHWnd(Method: TWndMethod): HWND; - -implementation - -uses UPliki; - -{ TResourceStream } - -constructor TResourceStream.Create(Instance: THandle; const ResName: string; ResType: PChar); -var - sFileName : String; -begin - if ResType = 'FNT' then - sFileName := GetResourcesPath + 'Fonts/' + ResName + '.dat' - else - sFileName := GetResourcesPath + 'Fonts/' + ResName + '.' + ResType; - - if FileExists(sFileName) then - inherited Create( sFileName, fmOpenReadWrite) - else - inherited Create( sFileName, fmCreate); -end; - -function AllocateHWnd(Method: TWndMethod): HWND; -begin -{$IFDEF MSWINDOWS} - Result := Classes.AllocateHWnd(Method); -{$ENDIF} -{$IFDEF MACOS} - Result := 0; -{$ENDIF} -end; - -end. diff --git a/Game/Code/MacOSX/Wrapper/MacResources.pas b/Game/Code/MacOSX/Wrapper/MacResources.pas new file mode 100755 index 00000000..d408a432 --- /dev/null +++ b/Game/Code/MacOSX/Wrapper/MacResources.pas @@ -0,0 +1,72 @@ +unit MacResources; + +{$I switches.inc} + +interface + +uses + Classes, Windows, SysUtils; + +type + + TResourceStream = class(TFileStream) + private + public + constructor Create(Instance: THandle; const ResName: string; ResType: PChar); + end; + + Function FindResource( hInstance : THandle; pcIdentifier : PChar; pcResType : PChar) : THandle; + +implementation + +Function FindResource( hInstance : THandle; pcIdentifier : PChar; pcResType : PChar) : THandle; +begin + Result := 1; +end; + +Function GetResourcesPath : String; +var + x, + i : integer; +begin + Result := ExtractFilePath(ParamStr(0)); + for x := 0 to 2 do begin + i := Length(Result); + repeat + Delete( Result, i, 1); + i := Length(Result); + until (i = 0) or (Result[i] = '/'); + end; +end; + +{ TResourceStream } + +constructor TResourceStream.Create(Instance: THandle; const ResName: string; ResType: PChar); +var + sResNameLower : string; + sFileName : String; +begin + sResNameLower := LowerCase(string(ResName)); + + if sResNameLower = 'font' then + sFileName := GetResourcesPath + 'Fonts/Normal/Font Normal 16.png' + else if sResNameLower = 'fontb' then + sFileName := GetResourcesPath + 'Fonts/Bold/Font 1024 Bold 16.png' + else if sResNameLower = 'fonto' then + sFileName := GetResourcesPath + 'Fonts/Outline 1/Outline 1.png' + else if sResNameLower = 'outro_bg' then + sFileName := GetResourcesPath + 'Graphics/outro-bg.png' + else if sResNameLower = 'outro_esc' then + sFileName := GetResourcesPath + 'Graphics/outro-esc.png' + else if sResNameLower = 'outro_exd' then + sFileName := GetResourcesPath + 'Graphics/outro-exit-dark.png' + else if sResNameLower = 'fonto2' then + sFileName := GetResourcesPath + 'Fonts/Outline 2/Outline 2.png'; + + if FileExists(sFileName) then + inherited Create( sFileName, fmOpenReadWrite) + else + raise Exception.Create('MacResources.TResourceStream.Create: File "' + sFileName + '" not found.'); +end; + +end. -- cgit v1.2.3 From 5e733f7e9cb2118651df90171db1892c9155e089 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 4 Nov 2007 21:00:20 +0000 Subject: Partymodule finished. All PartyScreens and SingScreen needs some adapting. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@583 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCore.pas | 25 +- Game/Code/Classes/UMain.pas | 31 +- Game/Code/Classes/UParty.pas | 994 ++++++++++++++++++----------- Game/Code/Classes/UServices.pas | 2 +- Game/Code/Screens/UScreenPartyNewRound.pas | 46 +- Game/Code/Screens/UScreenPartyOptions.pas | 7 +- Game/Code/Screens/UScreenPartyPlayer.pas | 8 +- Game/Code/Screens/UScreenPartyScore.pas | 19 +- Game/Code/Screens/UScreenPartyWin.pas | 14 +- Game/Code/Screens/UScreenSong.pas | 23 +- Game/Code/Screens/UScreenSongMenu.pas | 10 +- 11 files changed, 710 insertions(+), 469 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UCore.pas b/Game/Code/Classes/UCore.pas index e0f9fec2..5b144b45 100644 --- a/Game/Code/Classes/UCore.pas +++ b/Game/Code/Classes/UCore.pas @@ -47,6 +47,12 @@ type Modules: Array [0..High(CORE_MODULES_TO_LOAD)] of TModuleListItem; + //Cur + Last Executed Setting and Getting ;) + iCurExecuted: Integer; + iLastExecuted: Integer; + + Procedure SetCurExecuted(Value: Integer); + //Function Get all Modules and Creates them Function GetModules: Boolean; @@ -75,14 +81,14 @@ type Hooks: THookManager; //Teh Hook Manager ;) Services: TServiceManager;//The Service Manager - CurExecuted: Integer; //ID of Plugin or Module curently Executed - Name: String; //Name of this Application Version: LongWord; //Version of this ". For Info Look PluginDefs Functions LastErrorReporter:String; //Who Reported the Last Error String LastErrorString: String; //Last Error String reported + property CurExecuted: Integer read iCurExecuted write SetCurExecuted; //ID of Plugin or Module curently Executed + property LastExecuted: Integer read iLastExecuted; //--------------- //Main Methods to control the Core: @@ -124,7 +130,8 @@ Constructor TCore.Create(const cName: String; const cVersion: LongWord); begin Name := cName; Version := cVersion; - CurExecuted := 0; + iLastExecuted := 0; + iCurExecuted := 0; LastErrorReporter := ''; LastErrorString := ''; @@ -498,4 +505,16 @@ begin Result := hInstance; end; +//------------- +// Called when setting CurExecuted +//------------- +Procedure TCore.SetCurExecuted(Value: Integer); +begin + //Set Last Executed + iLastExecuted := iCurExecuted; + + //Set Cur Executed + iCurExecuted := Value; +end; + end. diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 48928cbd..b1469f00 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -38,6 +38,11 @@ type TPlayer = record Name: string; + //Index in Teaminfo record + TeamID: Byte; + PlayerID: Byte; + + //Scores Score: real; ScoreLine: real; ScoreGolden: real; @@ -51,26 +56,6 @@ type //LineBonus Mod ScoreLast: Real;//Last Line Score - {ScorePercent: integer;//Aktual Fillstate of the SingBar - ScorePercentTarget: integer;//Target Fillstate of the SingBar - //end Singbar Mod - - //PhrasenBonus - Line Bonus Mod - LineBonus_PosX: Single; - LineBonus_PosY: Single; - LineBonus_Alpha: Single; - LineBonus_Visible: boolean; - LineBonus_Text: string; - LineBonus_Color: TRGB; - LineBonus_Age: Integer; - LineBonus_Rating: Integer; - //Variable vor Positioning -> Set on ScreenShow, different when Playercount Changes - LineBonus_TargetX: integer; - LineBonus_TargetY: integer; - LineBonus_StartX: integer; - LineBonus_StartY: integer; - //PhrasenBonus - Line Bonus Mod End } - //PerfectLineTwinkle Mod (effect) LastSentencePerfect: Boolean; @@ -316,13 +301,13 @@ begin Log.BenchmarkEnd(1); Log.LogBenchmark('Loading PluginManager', 1); - // Party Mode Manager + {// Party Mode Manager Log.BenchmarkStart(1); Log.LogStatus('PartySession Manager', 'Initialization'); - PartySession := TParty_Session.Create; //Load PartySession + PartySession := TPartySession.Create; //Load PartySession Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PartySession Manager', 1); + Log.LogBenchmark('Loading PartySession Manager', 1); } // Sound Log.BenchmarkStart(1); diff --git a/Game/Code/Classes/UParty.pas b/Game/Code/Classes/UParty.pas index 36a40858..1db8f3e1 100644 --- a/Game/Code/Classes/UParty.pas +++ b/Game/Code/Classes/UParty.pas @@ -1,381 +1,613 @@ -unit UParty; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - - -{$I switches.inc} - -uses ModiSDK; - -type - TRoundInfo = record - Plugin: Word; - Winner: Byte; - end; - - TeamOrderEntry = record - Teamnum: Byte; - Score: Byte; - end; - - TeamOrderArray = Array[0..5] of Byte; - - TParty_Session = class - private - function GetRandomPlayer(Team: Byte): Byte; - function IsWinner(Player, Winner: Byte): boolean; - procedure GenScores; - public - Teams: TTeamInfo; - Rounds: array of TRoundInfo; - CurRound: Byte; - - constructor Create; - - procedure StartNewParty(NumRounds: Byte); - procedure StartRound; - procedure EndRound; - function GetTeamOrder: TeamOrderArray; - function GetWinnerString(Round: Byte): String; - end; - -var - PartySession: TParty_Session; - -implementation - -uses UDLLManager, UGraphic, UMain, ULanguage, ULog; - -//---------- -//Constructor - Prepares the Class -//---------- -constructor TParty_Session.Create; -begin -// - Nothing in here atm -end; - -//---------- -//StartNewParty - Clears the Class and Prepares for new Party -//---------- -procedure TParty_Session.StartNewParty(NumRounds: Byte); -var - Plugins: Array of record - ID: Byte; - TimesPlayed: Byte; - end; - TeamMode: Boolean; - Len: Integer; - I, J: Integer; - - function GetRandomPlugin: Byte; - var - LowestTP: Byte; - NumPwithLTP: Word; - I: Integer; - R: Word; - begin - LowestTP := high(Byte); - NumPwithLTP := 0; - - //Search for Plugins not often played yet - For I := 0 to high(Plugins) do - begin - if (Plugins[I].TimesPlayed < lowestTP) then - begin - lowestTP := Plugins[I].TimesPlayed; - NumPwithLTP := 1; - end - else if (Plugins[I].TimesPlayed = lowestTP) then - begin - Inc(NumPwithLTP); - end; - end; - - //Create Random No - R := Random(NumPwithLTP); - - //Search for Random Plugin - For I := 0 to high(Plugins) do - begin - if Plugins[I].TimesPlayed = lowestTP then - begin - //Plugin Found - if (R = 0) then - begin - Result := Plugins[I].ID; - Inc(Plugins[I].TimesPlayed); - Break; - end; - - Dec(R); - end; - end; - end; -begin - //Set cur Round to Round 1 - CurRound := 255; - - PlayersPlay := Teams.NumTeams; - - //Get Teammode and Set Joker, also set TimesPlayed - TeamMode := True; - For I := 0 to Teams.NumTeams-1 do - begin - if Teams.Teaminfo[I].NumPlayers < 2 then - begin - TeamMode := False; - end; - //Set Player Attributes - For J := 0 to Teams.TeamInfo[I].NumPlayers-1 do - begin - Teams.TeamInfo[I].Playerinfo[J].TimesPlayed := 0; - end; - Teams.Teaminfo[I].Joker := Round(NumRounds*0.7); - Teams.Teaminfo[I].Score := 0; - end; - - //Fill Plugin Array - SetLength(Plugins, 0); - For I := 0 to high(DLLMan.Plugins) do - begin - if TeamMode or (Not DLLMan.Plugins[I].TeamModeOnly) then - begin //Add only Plugins Playable with cur. PlayerConfiguration - Len := Length(Plugins); - SetLength(Plugins, Len + 1); - Plugins[Len].ID := I; - Plugins[Len].TimesPlayed := 0; - end; - end; - - //Set Rounds - If (Length(Plugins) >= 1) then - begin - SetLength (Rounds, NumRounds); - For I := 0 to NumRounds-1 do - begin - PartySession.Rounds[I].Plugin := GetRandomPlugin; - PartySession.Rounds[I].Winner := 255; - end; - end - else SetLength (Rounds, 0); -end; - -//---------- -//GetRandomPlayer - Gives back a Random Player to Play next Round -//---------- -function TParty_Session.GetRandomPlayer(Team: Byte): Byte; -var - I, R: Integer; - lowestTP: Byte; - NumPwithLTP: Byte; -begin - LowestTP := high(Byte); - NumPwithLTP := 0; - Result := 0; - - //Search for Players that have not often played yet - For I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do - begin - if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed < lowestTP) then - begin - lowestTP := Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed; - NumPwithLTP := 1; - end - else if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP) then - begin - Inc(NumPwithLTP); - end; - end; - - //Create Random No - R := Random(NumPwithLTP); - - //Search for Random Player - For I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do - begin - if Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP then - begin - //Player Found - if (R = 0) then - begin - Result := I; - Break; - end; - - Dec(R); - end; - end; - {//Get lowest TimesPlayed - lowestTP := high(Byte); - J := -1; - for I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do - begin - if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed < lowestTP) then - begin - lowestTP := Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed; - J := I; - end - else if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP) then - begin - J := -1; - end; - end; - - //If more than one Person has lowestTP then Select Random Player - if (J < 0) then - repeat - Result := Random(Teams.Teaminfo[Team].NumPlayers); - until (Teams.Teaminfo[Team].Playerinfo[Result].TimesPlayed = lowestTP) - else //Else Select the one with lowest TP - Result:= J;} -end; - -//---------- -//StartNextRound - Prepares ScreenSingModi for Next Round And Load Plugin -//---------- -procedure TParty_Session.StartRound; -var - I: Integer; -begin - if ((CurRound < high(Rounds)) OR (CurRound = high(CurRound))) then - begin - //Increase Current Round - Inc (CurRound); - - Rounds[CurRound].Winner := 255; - DllMan.LoadPlugin(Rounds[CurRound].Plugin); - - //Select Players - for I := 0 to Teams.NumTeams-1 do - Teams.Teaminfo[I].CurPlayer := GetRandomPlayer(I); - - //Set ScreenSingModie Variables - ScreenSingModi.TeamInfo := Teams; - - //Set - end; -end; - -//---------- -//IsWinner - Returns True if the Players Bit is set in the Winner Byte -//---------- -function TParty_Session.IsWinner(Player, Winner: Byte): boolean; -var - Bit: Byte; -begin - Case Player of - 0: Bit := 1; - 1: Bit := 2; - 2: Bit := 4; - 3: Bit := 8; - 4: Bit := 16; - 5: Bit := 32; - end; - - Result := ((Winner AND Bit) = Bit); -end; - -//---------- -//GenScores - Inc Scores for Cur. Round -//---------- -procedure TParty_Session.GenScores; -var - I: Byte; -begin - for I := 0 to Teams.NumTeams-1 do - begin - if isWinner(I, Rounds[CurRound].Winner) then - Inc(Teams.Teaminfo[I].Score); - end; -end; - -//---------- -//GetWinnerString - Get String with WinnerTeam Name, when there is more than one Winner than Connect with and or , -//---------- -function TParty_Session.GetWinnerString(Round: Byte): String; -var - Winners: Array of String; - I: Integer; -begin - Result := Language.Translate('PARTY_NOBODY'); - - if (Round > High(Rounds)) then - exit; - - if (Rounds[Round].Winner = 0) then - begin - exit; - end; - - if (Rounds[Round].Winner = 255) then - begin - Result := Language.Translate('PARTY_NOTPLAYEDYET'); - exit; - end; - - SetLength(Winners, 0); - for I := 0 to Teams.NumTeams-1 do - begin - if isWinner(I, Rounds[Round].Winner) then - begin - SetLength(Winners, Length(Winners) + 1); - Winners[high(Winners)] := Teams.TeamInfo[I].Name; - end; - end; - Result := Language.Implode(Winners); -end; - -//---------- -//EndRound - Get Winner from ScreenSingModi and Save Data to RoundArray -//---------- -procedure TParty_Session.EndRound; -var - I: Integer; -begin - //Copy Winner - Rounds[CurRound].Winner := ScreenSingModi.Winner; - //Set Scores - GenScores; - - //Increase TimesPlayed 4 all Players - For I := 0 to Teams.NumTeams-1 do - Inc(Teams.Teaminfo[I].Playerinfo[Teams.Teaminfo[I].CurPlayer].TimesPlayed); - -end; - -//---------- -//GetTeamOrder - Gives back the Placing of eacb Team [First Position of Array is Teamnum of first placed Team, ...] -//---------- -function TParty_Session.GetTeamOrder: TeamOrderArray; -var - I, J: Integer; - ATeams: array [0..5] of TeamOrderEntry; - TempTeam: TeamOrderEntry; -begin - //Fill Team Array - For I := 0 to Teams.NumTeams-1 do - begin - ATeams[I].Teamnum := I; - ATeams[I].Score := Teams.Teaminfo[I].Score; - end; - - //Sort Teams - for J := 0 to Teams.NumTeams-1 do - for I := 1 to Teams.NumTeams-1 do - if ATeams[I].Score > ATeams[I-1].Score then - begin - TempTeam := ATeams[I-1]; - ATeams[I-1] := ATeams[I]; - ATeams[I] := TempTeam; - end; - - //Copy to Result - For I := 0 to Teams.NumTeams-1 do - Result[I] := ATeams[I].TeamNum; -end; - -end. +unit UParty; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +{$I switches.inc} + +uses UPartyDefs, UCoreModule, UPluginDefs; + +type + ARounds = Array [0..252] of Integer; //0..252 needed for + PARounds = ^ARounds; + + TRoundInfo = record + Modi: Cardinal; + Winner: Byte; + end; + + TeamOrderEntry = record + Teamnum: Byte; + Score: Byte; + end; + + TeamOrderArray = Array[0..5] of Byte; + + TUS_ModiInfoEx = record + Info: TUS_ModiInfo; + Owner: Integer; + TimesPlayed: Byte; //Helper for setting Round Plugins + end; + + TPartySession = class (TCoreModule) + private + bPartyMode: Boolean; //Is this Party or Singleplayer + CurRound: Byte; + + Modis: Array of TUS_ModiInfoEx; + Teams: TTeamInfo; + + function IsWinner(Player, Winner: Byte): boolean; + procedure GenScores; + function GetRandomPlugin(TeamMode: Boolean): Cardinal; + function GetRandomPlayer(Team: Byte): Byte; + public + //Teams: TTeamInfo; + Rounds: array of TRoundInfo; + + //TCoreModule methods to inherit + Constructor Create; override; + Procedure Info(const pInfo: PModuleInfo); override; + Function Load: Boolean; override; + Function Init: Boolean; override; + Procedure DeInit; override; + Procedure Free; override; + + //Register Modi Service + Function RegisterModi(pModiInfo, nothin: DWord): integer; //Registers a new Modi. wParam: Pointer to TUS_ModiInfo + + //Start new Party + Function StartParty(NumRounds, PAofIRounds: DWord): integer; //Starts new Party Mode. Returns Non Zero on Success + Function GetCurModi(wParam, lParam: DWord): integer; //Returns Pointer to Cur. Modis TUS_ModiInfo (to Use with Singscreen) + Function StopParty(wParam, lParam: DWord): integer; //Stops Party Mode. Returns 1 If Partymode was enabled before. + Function NextRound(wParam, lParam: DWord): integer; //Increases CurRound by 1; Returns num of Round or -1 if last Round is already played + + Function CallModiInit(wParam, lParam: DWord): integer; //Calls CurModis Init Proc. If an Error occurs, Returns Nonzero. In this Case a New Plugin was Selected. Please renew Loading + Function CallModiDeInit(wParam, lParam: DWord): integer; //Calls DeInitProc and does the RoundEnding + + Function GetTeamInfo(wParam, pTeamInfo: DWord): integer; //Writes TTeamInfo Record to Pointer at lParam. Returns Zero on Success + Function SetTeamInfo(wParam, pTeamInfo: DWord): integer; //Read TTeamInfo Record from Pointer at lParam. Returns Zero on Success + + Function GetTeamOrder(wParam, lParam: DWord): integer; //Returns Team Order. Structure: Bits 1..3: Team at Place1; Bits 4..6: Team at Place2 ... + Function GetWinnerString(wParam, lParam: DWord): integer; //wParam is Roundnum. If (Pointer = nil) then Return Length of the String. Otherwise Write the String to Address at lParam + end; + +const + StandardModi = 0; //Modi ID that will be played in non party Mode + +implementation + +uses UCore, UGraphic, UMain, ULanguage, ULog, SysUtils; + +{********************* + TPluginLoader + Implentation +*********************} + +//------------- +// Function that gives some Infos about the Module to the Core +//------------- +Procedure TPartySession.Info(const pInfo: PModuleInfo); +begin + pInfo^.Name := 'TPartySession'; + pInfo^.Version := MakeVersion(1,0,0,chr(0)); + pInfo^.Description := 'Manages Party Modi and Party Game'; +end; + +//------------- +// Just the Constructor +//------------- +Constructor TPartySession.Create; +begin + //UnSet PartyMode + bPartyMode := False; +end; + +//------------- +//Is Called on Loading. +//In this Method only Events and Services should be created +//to offer them to other Modules or Plugins during the Init process +//If False is Returned this will cause a Forced Exit +//------------- +Function TPartySession.Load: Boolean; +begin + //Add Register Party Modi Service + Result := True; + Core.Services.AddService('Party/RegisterModi', nil, Self.RegisterModi); + Core.Services.AddService('Party/StartParty', nil, Self.StartParty); + Core.Services.AddService('Party/GetCurModi', nil, Self.GetCurModi); +end; + +//------------- +//Is Called on Init Process +//In this Method you can Hook some Events and Create + Init +//your Classes, Variables etc. +//If False is Returned this will cause a Forced Exit +//------------- +Function TPartySession.Init: Boolean; +begin + //Just set Prvate Var to true. + Result := true; +end; + +//------------- +//Is Called if this Module has been Inited and there is a Exit. +//Deinit is in backwards Initing Order +//------------- +Procedure TPartySession.DeInit; +begin + //Force DeInit + +end; + +//------------- +//Is Called if this Module will be unloaded and has been created +//Should be used to Free Memory +//------------- +Procedure TPartySession.Free; +begin + //Just save some Memory if it wasn't done now.. + SetLength(Modis, 0); +end; + +//------------- +// Registers a new Modi. wParam: Pointer to TUS_ModiInfo +// Service for Plugins +//------------- +Function TPartySession.RegisterModi(pModiInfo, nothin: DWord): integer; +var + Len: Integer; + Info: PUS_ModiInfo; +begin + Info := ptr(PModiInfo); + //Copy Info if cbSize is correct + If (Info.cbSize = SizeOf(TUS_ModiInfo)) then + begin + Len := Length(Modis); + SetLength(Modis, Len + 1); + + Modis[Len].Info := Info^; + end + else + Core.ReportError(Integer(PChar('Plugins try to Register Modi with wrong Pointer, or wrong TUS_ModiInfo Record.')), Integer(PChar('TPartySession'))); +end; + +//---------- +// Returns a Number of a Random Plugin +//---------- +Function TPartySession.GetRandomPlugin(TeamMode: Boolean): Cardinal; +var + LowestTP: Byte; + NumPwithLTP: Word; + I: Integer; + R: Word; +begin + Result := StandardModi; //If there are no matching Modis, Play StandardModi + LowestTP := high(Byte); + NumPwithLTP := 0; + + //Search for Plugins not often played yet + For I := 0 to high(Modis) do + begin + if (Modis[I].TimesPlayed < lowestTP) And (((Modis[I].Info.LoadingSettings AND MLS_TeamOnly) <> 0) = TeamMode) then + begin + lowestTP := Modis[I].TimesPlayed; + NumPwithLTP := 1; + end + else if (Modis[I].TimesPlayed = lowestTP) And (((Modis[I].Info.LoadingSettings AND MLS_TeamOnly) <> 0) = TeamMode) then + begin + Inc(NumPwithLTP); + end; + end; + + //Create Random No + R := Random(NumPwithLTP); + + //Search for Random Plugin + For I := 0 to high(Modis) do + begin + if (Modis[I].TimesPlayed = lowestTP) And (((Modis[I].Info.LoadingSettings AND MLS_TeamOnly) <> 0) = TeamMode) then + begin + //Plugin Found + if (R = 0) then + begin + Result := I; + Inc(Modis[I].TimesPlayed); + Break; + end; + + Dec(R); + end; + end; +end; + +//---------- +// Starts new Party Mode. Returns Non Zero on Success +//---------- +Function TPartySession.StartParty(NumRounds, PAofIRounds: DWord): integer; +var + I: Integer; + aiRounds: PARounds; + TeamMode: Boolean; +begin + Result := 0; + If (Teams.NumTeams >= 1) AND (NumRounds < High(Byte)-1) then + begin + bPartyMode := false; + aiRounds := Ptr(PAofIRounds); + + Try + //Is this Teammode(More then one Player per Team) ? + TeamMode := True; + For I := 0 to Teams.NumTeams-1 do + TeamMode := TeamMode AND (Teams.Teaminfo[I].NumPlayers > 1); + + For I := 0 to High(NumRounds) do + begin //Set Plugins + If (aiRounds[I] = -1) then + Rounds[I].Modi := GetRandomPlugin(TeamMode) + Else If (aiRounds[I] >= 0) AND (aiRounds[I] <= High(Modis)) AND (TeamMode OR ((Modis[aiRounds[I]].Info.LoadingSettings AND MLS_TeamOnly) = 0)) then + Rounds[I].Modi := aiRounds[I] + Else + Rounds[I].Modi := StandardModi; + + Rounds[I].Winner := High(Byte); //Set Winner to Not Played + end; + + CurRound := High(Byte); //Set CurRound to not defined + + //Return teh true and Set PartyMode + bPartyMode := True; + Result := 1; + + Except + Core.ReportError(Integer(PChar('Can''t start PartyMode.')), Integer(PChar('TPartySession'))); + end; + end; +end; + +//---------- +// Returns Pointer to Cur. ModiInfoEx (to Use with Singscreen) +//---------- +Function TPartySession.GetCurModi(wParam, lParam: DWord): integer; +begin + If (bPartyMode) AND (CurRound <= High(Rounds)) then + begin //If PartyMode is enabled: + //Return the Plugin of the Cur Round + Result := Integer(@Modis[Rounds[CurRound].Modi]); + end + else + begin //Return StandardModi + Result := Integer(@Modis[StandardModi]); + end; +end; + +//---------- +// Stops Party Mode. Returns 1 If Partymode was enabled before. And -1 if Change was not possible +//---------- +Function TPartySession.StopParty(wParam, lParam: DWord): integer; +begin + Result := -1; + If (bPartyMode) then + begin + // to-do : Whitü: Check here if SingScreen is not Shown atm. + bPartyMode := False; + Result := 1; + end + else + Result := 0; +end; + +//---------- +//GetRandomPlayer - Gives back a Random Player to Play next Round +//---------- +function TPartySession.GetRandomPlayer(Team: Byte): Byte; +var + I, R: Integer; + lowestTP: Byte; + NumPwithLTP: Byte; +begin + LowestTP := high(Byte); + NumPwithLTP := 0; + Result := 0; + + //Search for Players that have not often played yet + For I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do + begin + if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed < lowestTP) then + begin + lowestTP := Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed; + NumPwithLTP := 1; + end + else if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP) then + begin + Inc(NumPwithLTP); + end; + end; + + //Create Random No + R := Random(NumPwithLTP); + + //Search for Random Player + For I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do + begin + if Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP then + begin + //Player Found + if (R = 0) then + begin + Result := I; + Break; + end; + + Dec(R); + end; + end; +end; + +//---------- +// NextRound - Increases CurRound by 1; Returns num of Round or -1 if last Round is already played +//---------- +Function TPartySession.NextRound(wParam, lParam: DWord): integer; +var I: Integer; +begin + If ((CurRound < high(Rounds)) OR (CurRound = high(CurRound))) then + begin //everythings OK! -> Start the Round, maaaaan + Inc(CurRound); + + //Set Players to play this Round + for I := 0 to Teams.NumTeams-1 do + Teams.Teaminfo[I].CurPlayer := GetRandomPlayer(I); + end + else + Result := -1; +end; + +//---------- +//IsWinner - Returns True if the Players Bit is set in the Winner Byte +//---------- +function TPartySession.IsWinner(Player, Winner: Byte): boolean; +var + Bit: Byte; +begin + Bit := 1 shl Player; + + Result := ((Winner AND Bit) = Bit); +end; + +//---------- +//GenScores - Inc Scores for Cur. Round +//---------- +procedure TPartySession.GenScores; +var + I: Byte; +begin + for I := 0 to Teams.NumTeams-1 do + begin + if isWinner(I, Rounds[CurRound].Winner) then + Inc(Teams.Teaminfo[I].Score); + end; +end; + +//---------- +// CallModiInit - Calls CurModis Init Proc. If an Error occurs, Returns Nonzero. In this Case a New Plugin was Selected. Please renew Loading +//---------- +Function TPartySession.CallModiInit(wParam, lParam: DWord): integer; +begin + If (not bPartyMode) then + begin //Set Rounds if not in PartyMode + SetLength(Rounds, 1); + Rounds[0].Modi := StandardModi; + Rounds[0].Winner := High(Byte); + CurRound := 0; + end; + + Try + //Core. + Except + on E : Exception do + begin + Core.ReportError(Integer(PChar('Error starting Modi: ' + Modis[Rounds[CurRound].Modi].Info.Name + ' ErrorStr: ' + E.Message)), Integer(PChar('TPartySession'))); + If (Rounds[CurRound].Modi = StandardModi) then + begin + Core.ReportError(Integer(PChar('Can''t start StandardModi, will exit now!')), Integer(PChar('TPartySession'))); + Halt; + end + Else //Select StandardModi + begin + Rounds[CurRound].Modi := StandardModi + end; + end; + End; +end; + +//---------- +// CallModiDeInit - Calls DeInitProc and does the RoundEnding +//---------- +Function TPartySession.CallModiDeInit(wParam, lParam: DWord): integer; +var + I: Integer; + MaxScore: Word; +begin + If (bPartyMode) then + begin + //Get Winner Byte! + if (@Modis[Rounds[CurRound].Modi].Info.ModiDeInit <> nil) then //get Winners from Plugin + Rounds[CurRound].Winner := Modis[Rounds[CurRound].Modi].Info.ModiDeInit(Modis[Rounds[CurRound].Modi].Info.ID) + else + begin //Create winners by Score :/ + Rounds[CurRound].Winner := 0; + MaxScore := 0; + for I := 0 to Teams.NumTeams-1 do + begin + // to-do : recode Percentage stuff + //PlayerInfo.Playerinfo[I].Percentage := PlayerInfo.Playerinfo[I].Score div 9999; + if (Player[I].ScoreTotalI > MaxScore) then + begin + MaxScore := Player[I].ScoreTotalI; + Rounds[CurRound].Winner := 1 shl I; + end + else if (Player[I].ScoreTotalI = MaxScore) AND (Player[I].ScoreTotalI <> 0) then + begin + Rounds[CurRound].Winner := Rounds[CurRound].Winner or (1 shl I); + end; + end; + + + //When nobody has Points -> Everybody loose + if (MaxScore = 0) then + Rounds[CurRound].Winner := 0; + + end; + + //Generate teh Scores + GenScores; + + //Inc Players TimesPlayed + If ((Modis[Rounds[CurRound-1].Modi].Info.LoadingSettings AND MLS_IncTP) = MLS_IncTP) then + begin + For I := 0 to Teams.NumTeams-1 do + Inc(Teams.TeamInfo[I].Playerinfo[Teams.TeamInfo[I].CurPlayer].TimesPlayed); + end; + end + else if (@Modis[Rounds[CurRound].Modi].Info.ModiDeInit <> nil) then + Modis[Rounds[CurRound].Modi].Info.ModiDeInit(Modis[Rounds[CurRound].Modi].Info.ID); +end; + +//---------- +// GetTeamInfo - Writes TTeamInfo Record to Pointer at lParam. Returns Zero on Success +//---------- +Function TPartySession.GetTeamInfo(wParam, pTeamInfo: DWord): integer; +var Info: ^TTeamInfo; +begin + Result := -1; + Info := ptr(pTeamInfo); + If (Info <> nil) then + begin + Try + // to - do : Check Delphi memory management in this case + //Not sure if i had to copy PChars to a new address or if delphi manages this o0 + Info^ := Teams; + Result := 0; + Except + Result := -2; + End; + end; +end; + +//---------- +// SetTeamInfo - Read TTeamInfo Record from Pointer at lParam. Returns Zero on Success +//---------- +Function TPartySession.SetTeamInfo(wParam, pTeamInfo: DWord): integer; +var + TeamInfobackup: TTeamInfo; + Info: ^TTeamInfo; +begin + Result := -1; + Info := ptr(pTeamInfo); + If (Info <> nil) then + begin + Try + TeamInfoBackup := Teams; + // to - do : Check Delphi memory management in this case + //Not sure if i had to copy PChars to a new address or if delphi manages this o0 + Teams := Info^; + Result := 0; + Except + Teams := TeamInfoBackup; + Result := -2; + End; + end; +end; + +//---------- +// GetTeamOrder - Returns Team Order. Structure: Bits 1..3: Team at Place1; Bits 4..6: Team at Place2 ... +//---------- +Function TPartySession.GetTeamOrder(wParam, lParam: DWord): integer; +var + I, J: Integer; + ATeams: array [0..5] of TeamOrderEntry; + TempTeam: TeamOrderEntry; +begin + // to-do : PartyMode: Write this in another way, so that teams with the same scire get the same Placing + //Fill Team Array + For I := 0 to Teams.NumTeams-1 do + begin + ATeams[I].Teamnum := I; + ATeams[I].Score := Teams.Teaminfo[I].Score; + end; + + //Sort Teams + for J := 0 to Teams.NumTeams-1 do + for I := 1 to Teams.NumTeams-1 do + if ATeams[I].Score > ATeams[I-1].Score then + begin + TempTeam := ATeams[I-1]; + ATeams[I-1] := ATeams[I]; + ATeams[I] := TempTeam; + end; + + //Copy to Result + Result := 0; + For I := 0 to Teams.NumTeams-1 do + Result := Result or (ATeams[I].TeamNum Shl I*3); +end; + +//---------- +// GetWinnerString - wParam is Roundnum. If (Pointer = nil) then Return Length of the String. Otherwise Write the String to Address at lParam +//---------- +Function TPartySession.GetWinnerString(wParam, lParam: DWord): integer; +var + Winners: Array of String; + I: Integer; + ResultStr: String; + S: ^String; +begin + ResultStr := Language.Translate('PARTY_NOBODY'); + + if (wParam <= High(Rounds)) then + begin + if (Rounds[wParam].Winner <> 0) then + begin + if (Rounds[wParam].Winner = 255) then + begin + ResultStr := Language.Translate('PARTY_NOTPLAYEDYET'); + end + else + begin + SetLength(Winners, 0); + for I := 0 to Teams.NumTeams-1 do + begin + if isWinner(I, Rounds[wParam].Winner) then + begin + SetLength(Winners, Length(Winners) + 1); + Winners[high(Winners)] := Teams.TeamInfo[I].Name; + end; + end; + ResultStr := Language.Implode(Winners); + end; + end; + end; + + //Now Return what we have got + If (ptr(lParam) = nil) then + begin //ReturnString Length + Result := Length(ResultStr); + end + Else + begin //Return String + Try + S := Ptr(lParam); + S^ := ResultStr; + Result := 0; + Except + Result := -1; + + End; + end; +end; + +end. diff --git a/Game/Code/Classes/UServices.pas b/Game/Code/Classes/UServices.pas index c8761df0..094c3fed 100644 --- a/Game/Code/Classes/UServices.pas +++ b/Game/Code/Classes/UServices.pas @@ -247,7 +247,7 @@ end; Function TServiceManager.NametoHash(const ServiceName: TServiceName): Integer; asm { CL: Counter; EAX: Result; EDX: Current Memory Address } - Mov CL, 14 {Init Counter, Fold 14 Times to became 4 Bytes out of 60} + Mov ECX, 14 {Init Counter, Fold 14 Times to get 4 Bytes out of 60} Mov EDX, ServiceName {Save Address of String that should be "Hashed"} diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 33543211..6f039080 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -181,23 +181,25 @@ var var Players: Array of String; J: Byte; - begin - if (Num-1 >= PartySession.Teams.NumTeams) then + begin // to-do : Party + if (Num-1 >= {PartySession.Teams.NumTeams}0) then exit; - //Create Players Array + {//Create Players Array SetLength(Players, PartySession.Teams.TeamInfo[Num-1].NumPlayers); For J := 0 to PartySession.Teams.TeamInfo[Num-1].NumPlayers-1 do - Players[J] := String(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name); + Players[J] := String(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name);} //Implode and Return Result := Language.Implode(Players); end; begin - PartySession.StartRound; + // to-do : Party + //PartySession.StartRound; //Set Visibility of Round Infos - I := Length(PartySession.Rounds); + // to-do : Party + I := {Length(PartySession.Rounds)}0; if (I >= 1) then begin Static[StaticRound1].Visible := True; @@ -205,8 +207,8 @@ begin Text[TextWinner1].Visible := True; //Texts: - Text[TextRound1].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[0].Plugin].Name); - Text[TextWinner1].Text := PartySession.GetWinnerString(0); + //Text[TextRound1].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[0].Plugin].Name); + //Text[TextWinner1].Text := PartySession.GetWinnerString(0); end else begin @@ -222,8 +224,8 @@ begin Text[TextWinner2].Visible := True; //Texts: - Text[TextRound2].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[1].Plugin].Name); - Text[TextWinner2].Text := PartySession.GetWinnerString(1); + //Text[TextRound2].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[1].Plugin].Name); + //Text[TextWinner2].Text := PartySession.GetWinnerString(1); end else begin @@ -239,8 +241,8 @@ begin Text[TextWinner3].Visible := True; //Texts: - Text[TextRound3].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[2].Plugin].Name); - Text[TextWinner3].Text := PartySession.GetWinnerString(2); + //Text[TextRound3].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[2].Plugin].Name); + //Text[TextWinner3].Text := PartySession.GetWinnerString(2); end else begin @@ -256,8 +258,8 @@ begin Text[TextWinner4].Visible := True; //Texts: - Text[TextRound4].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[3].Plugin].Name); - Text[TextWinner4].Text := PartySession.GetWinnerString(3); + //Text[TextRound4].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[3].Plugin].Name); + //Text[TextWinner4].Text := PartySession.GetWinnerString(3); end else begin @@ -273,8 +275,8 @@ begin Text[TextWinner5].Visible := True; //Texts: - Text[TextRound5].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[4].Plugin].Name); - Text[TextWinner5].Text := PartySession.GetWinnerString(4); + //Text[TextRound5].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[4].Plugin].Name); + //Text[TextWinner5].Text := PartySession.GetWinnerString(4); end else begin @@ -290,8 +292,8 @@ begin Text[TextWinner6].Visible := True; //Texts: - Text[TextRound6].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[5].Plugin].Name); - Text[TextWinner6].Text := PartySession.GetWinnerString(5); + //Text[TextRound6].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[5].Plugin].Name); + //Text[TextWinner6].Text := PartySession.GetWinnerString(5); end else begin @@ -307,8 +309,8 @@ begin Text[TextWinner7].Visible := True; //Texts: - Text[TextRound7].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[6].Plugin].Name); - Text[TextWinner7].Text := PartySession.GetWinnerString(6); + //Text[TextRound7].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[6].Plugin].Name); + //Text[TextWinner7].Text := PartySession.GetWinnerString(6); end else begin @@ -318,7 +320,7 @@ begin end; //Display Scores - if (PartySession.Teams.NumTeams >= 1) then + {if (PartySession.Teams.NumTeams >= 1) then begin Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[0].Score); Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[0].Name); @@ -406,7 +408,7 @@ begin Text[TextNextPlayer3].Visible := True; end else - Text[TextNextPlayer3].Visible := False; + Text[TextNextPlayer3].Visible := False; } // LCD.WriteText(1, ' Choose mode: '); diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 1c5e8461..85ee65bc 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -81,10 +81,10 @@ begin //Save Num Teams: - PartySession.Teams.NumTeams := NumTeams + 2; + {PartySession.Teams.NumTeams := NumTeams + 2; PartySession.Teams.Teaminfo[0].NumPlayers := NumPlayer1+1; PartySession.Teams.Teaminfo[1].NumPlayers := NumPlayer2+1; - PartySession.Teams.Teaminfo[2].NumPlayers := NumPlayer3+1; + PartySession.Teams.Teaminfo[2].NumPlayers := NumPlayer3+1;} //Save Playlist PlaylistMan.Mode := Playlist; @@ -113,7 +113,8 @@ begin PlaylistMan.CurPlayList := Playlist2; //Start Party - PartySession.StartNewParty(Rounds + 2); + // to-do : Party + //PartySession.StartNewParty(Rounds + 2); AudioPlayback.PlayStart; //Go to Player Screen diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index 4aaa5a3e..3bd33a5c 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -193,7 +193,7 @@ begin SDLK_RETURN: begin - //Save PlayerNames + {//Save PlayerNames for I := 0 to PartySession.Teams.NumTeams-1 do begin PartySession.Teams.Teaminfo[I].Name := PChar(Button[I*5].Text[0].Text); @@ -205,7 +205,7 @@ begin end; AudioPlayback.PlayStart; - FadeTo(@ScreenPartyNewRound); + FadeTo(@ScreenPartyNewRound);} end; // Up and Down could be done at the same time, @@ -267,7 +267,7 @@ begin Button[10].Text[0].Text := Ini.NameTeam[2]; // Templates for Names Mod end - If (PartySession.Teams.NumTeams>=1) then + {If (PartySession.Teams.NumTeams>=1) then begin Button[0].Visible := True; Button[1].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=1); @@ -316,7 +316,7 @@ begin Button[12].Visible := False; Button[13].Visible := False; Button[14].Visible := False; - end; + end; } end; diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index ea9b944b..6215e65a 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -60,21 +60,22 @@ begin SDLK_BACKSPACE : begin AudioPlayback.PlayStart; - if (PartySession.CurRound < High(PartySession.Rounds)) then + {if (PartySession.CurRound < High(PartySession.Rounds)) then FadeTo(@ScreenPartyNewRound) - else + else // to-do : Party begin - PartySession.EndRound; + PartySession.EndRound; } FadeTo(@ScreenPartyWin); - end; + //end; end; SDLK_RETURN: begin AudioPlayback.PlayStart; - if (PartySession.CurRound < High(PartySession.Rounds)) then + // to-do : Party + {if (PartySession.CurRound < High(PartySession.Rounds)) then FadeTo(@ScreenPartyNewRound) - else + else } FadeTo(@ScreenPartyWin); end; end; @@ -182,11 +183,11 @@ begin if Static[StaticTeam2].Texture.ScaleW > 99 then Static[StaticTeam2].Texture.ScaleW := 99; if Static[StaticTeam3].Texture.ScaleW > 99 then Static[StaticTeam3].Texture.ScaleW := 99; - //End Last Round - PartySession.EndRound; + //End Last Round // to-do : Party + //PartySession.EndRound; //Set Winnertext - Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.GetWinnerString(PartySession.CurRound)]); + //Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.GetWinnerString(PartySession.CurRound)]); if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then begin diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas index 9806159a..d8a3bd71 100644 --- a/Game/Code/Screens/UScreenPartyWin.pas +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -96,7 +96,7 @@ end; procedure TScreenPartyWin.onShow; var I: Integer; - Placing: TeamOrderArray; + Placing: Integer; Function GetTeamColor(Team: Byte): Cardinal; var NameString: String; @@ -106,13 +106,13 @@ var Result := ColorExists(NameString); end; begin + // to-do : Party //Get Team Placing - Placing := PartySession.GetTeamOrder; - - //Set Winnertext - Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.Teams.Teaminfo[Placing[0]].Name]); + //Placing := PartySession.GetTeamOrder; - if (PartySession.Teams.NumTeams >= 1) then + //Set Winnertext + //Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.Teams.Teaminfo[Placing[0]].Name]); + {if (PartySession.Teams.NumTeams >= 1) then begin Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[0]].Score); Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[Placing[0]].Name); @@ -239,7 +239,7 @@ begin Static[StaticTeam3].Visible := False; Static[StaticTeam3BG].Visible := False; Static[StaticTeam3Deco].Visible := False; - end; + end; } // LCD.WriteText(1, ' Choose mode: '); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index bd9e5e67..8123ef03 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -660,36 +660,36 @@ begin end; SDLK_1: - begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then + begin //Jocker // to-do : Party + {if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then begin //Joker spielen Dec(PartySession.Teams.Teaminfo[0].Joker); SelectRandomSong; SetJoker; - end; + end; } end; SDLK_2: begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then + {if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then begin //Joker spielen Dec(PartySession.Teams.Teaminfo[1].Joker); SelectRandomSong; SetJoker; - end; + end; } end; SDLK_3: begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then + {if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then begin //Joker spielen Dec(PartySession.Teams.Teaminfo[2].Joker); SelectRandomSong; SetJoker; - end; + end; } end; end; end; @@ -1991,7 +1991,8 @@ end; procedure TScreenSong.SetJoker; begin - //If Party Mode + {//If Party Mode + // to-do : Party if Mode = 1 then //Show Joker that are available begin if (PartySession.Teams.NumTeams >= 1) then @@ -2064,7 +2065,7 @@ begin Static[StaticTeam3Joker3].Visible := False; Static[StaticTeam3Joker4].Visible := False; Static[StaticTeam3Joker5].Visible := False; - end; + end; } end; procedure TScreenSong.SetStatics; @@ -2132,13 +2133,13 @@ end; //Team No of Team (0-5) procedure TScreenSong.DoJoker (Team: Byte); begin - if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then + {if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then begin //Joker spielen Dec(PartySession.Teams.Teaminfo[Team].Joker); SelectRandomSong; SetJoker; - end; + end; } end; //Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 90e56a54..88b0de32 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -373,16 +373,16 @@ begin begin CurMenu := sMenu; Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_JOKER'); - - Button[0].Visible := (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0); + // to-do : Party + {Button[0].Visible := (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0); Button[1].Visible := (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0); - Button[2].Visible := (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0); + Button[2].Visible := (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0);} Button[3].Visible := True; SelectsS[0].Visible := False; - Button[0].Text[0].Text := String(PartySession.Teams.Teaminfo[0].Name); + {Button[0].Text[0].Text := String(PartySession.Teams.Teaminfo[0].Name); Button[1].Text[0].Text := String(PartySession.Teams.Teaminfo[1].Name); - Button[2].Text[0].Text := String(PartySession.Teams.Teaminfo[2].Name); + Button[2].Text[0].Text := String(PartySession.Teams.Teaminfo[2].Name);} Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); //Set right Interaction -- cgit v1.2.3 From 47da0a4d8f298bc3bc32e19242aa2d714e2c5ebc Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Mon, 5 Nov 2007 19:49:10 +0000 Subject: Fixed compilation on the mac: Function Ptr() does not exist. Please use the Pointer() cast. Changed function StartParty. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@588 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UParty.pas | 1227 ++++++++++---------- Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 | 92 +- .../MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser | 166 +-- .../MacOSX/UltraStarDX.xcodeproj/project.pbxproj | 6 + 4 files changed, 747 insertions(+), 744 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UParty.pas b/Game/Code/Classes/UParty.pas index 1db8f3e1..3fc52b8e 100644 --- a/Game/Code/Classes/UParty.pas +++ b/Game/Code/Classes/UParty.pas @@ -1,613 +1,614 @@ -unit UParty; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -{$I switches.inc} - -uses UPartyDefs, UCoreModule, UPluginDefs; - -type - ARounds = Array [0..252] of Integer; //0..252 needed for - PARounds = ^ARounds; - - TRoundInfo = record - Modi: Cardinal; - Winner: Byte; - end; - - TeamOrderEntry = record - Teamnum: Byte; - Score: Byte; - end; - - TeamOrderArray = Array[0..5] of Byte; - - TUS_ModiInfoEx = record - Info: TUS_ModiInfo; - Owner: Integer; - TimesPlayed: Byte; //Helper for setting Round Plugins - end; - - TPartySession = class (TCoreModule) - private - bPartyMode: Boolean; //Is this Party or Singleplayer - CurRound: Byte; - - Modis: Array of TUS_ModiInfoEx; - Teams: TTeamInfo; - - function IsWinner(Player, Winner: Byte): boolean; - procedure GenScores; - function GetRandomPlugin(TeamMode: Boolean): Cardinal; - function GetRandomPlayer(Team: Byte): Byte; - public - //Teams: TTeamInfo; - Rounds: array of TRoundInfo; - - //TCoreModule methods to inherit - Constructor Create; override; - Procedure Info(const pInfo: PModuleInfo); override; - Function Load: Boolean; override; - Function Init: Boolean; override; - Procedure DeInit; override; - Procedure Free; override; - - //Register Modi Service - Function RegisterModi(pModiInfo, nothin: DWord): integer; //Registers a new Modi. wParam: Pointer to TUS_ModiInfo - - //Start new Party - Function StartParty(NumRounds, PAofIRounds: DWord): integer; //Starts new Party Mode. Returns Non Zero on Success - Function GetCurModi(wParam, lParam: DWord): integer; //Returns Pointer to Cur. Modis TUS_ModiInfo (to Use with Singscreen) - Function StopParty(wParam, lParam: DWord): integer; //Stops Party Mode. Returns 1 If Partymode was enabled before. - Function NextRound(wParam, lParam: DWord): integer; //Increases CurRound by 1; Returns num of Round or -1 if last Round is already played - - Function CallModiInit(wParam, lParam: DWord): integer; //Calls CurModis Init Proc. If an Error occurs, Returns Nonzero. In this Case a New Plugin was Selected. Please renew Loading - Function CallModiDeInit(wParam, lParam: DWord): integer; //Calls DeInitProc and does the RoundEnding - - Function GetTeamInfo(wParam, pTeamInfo: DWord): integer; //Writes TTeamInfo Record to Pointer at lParam. Returns Zero on Success - Function SetTeamInfo(wParam, pTeamInfo: DWord): integer; //Read TTeamInfo Record from Pointer at lParam. Returns Zero on Success - - Function GetTeamOrder(wParam, lParam: DWord): integer; //Returns Team Order. Structure: Bits 1..3: Team at Place1; Bits 4..6: Team at Place2 ... - Function GetWinnerString(wParam, lParam: DWord): integer; //wParam is Roundnum. If (Pointer = nil) then Return Length of the String. Otherwise Write the String to Address at lParam - end; - -const - StandardModi = 0; //Modi ID that will be played in non party Mode - -implementation - -uses UCore, UGraphic, UMain, ULanguage, ULog, SysUtils; - -{********************* - TPluginLoader - Implentation -*********************} - -//------------- -// Function that gives some Infos about the Module to the Core -//------------- -Procedure TPartySession.Info(const pInfo: PModuleInfo); -begin - pInfo^.Name := 'TPartySession'; - pInfo^.Version := MakeVersion(1,0,0,chr(0)); - pInfo^.Description := 'Manages Party Modi and Party Game'; -end; - -//------------- -// Just the Constructor -//------------- -Constructor TPartySession.Create; -begin - //UnSet PartyMode - bPartyMode := False; -end; - -//------------- -//Is Called on Loading. -//In this Method only Events and Services should be created -//to offer them to other Modules or Plugins during the Init process -//If False is Returned this will cause a Forced Exit -//------------- -Function TPartySession.Load: Boolean; -begin - //Add Register Party Modi Service - Result := True; - Core.Services.AddService('Party/RegisterModi', nil, Self.RegisterModi); - Core.Services.AddService('Party/StartParty', nil, Self.StartParty); - Core.Services.AddService('Party/GetCurModi', nil, Self.GetCurModi); -end; - -//------------- -//Is Called on Init Process -//In this Method you can Hook some Events and Create + Init -//your Classes, Variables etc. -//If False is Returned this will cause a Forced Exit -//------------- -Function TPartySession.Init: Boolean; -begin - //Just set Prvate Var to true. - Result := true; -end; - -//------------- -//Is Called if this Module has been Inited and there is a Exit. -//Deinit is in backwards Initing Order -//------------- -Procedure TPartySession.DeInit; -begin - //Force DeInit - -end; - -//------------- -//Is Called if this Module will be unloaded and has been created -//Should be used to Free Memory -//------------- -Procedure TPartySession.Free; -begin - //Just save some Memory if it wasn't done now.. - SetLength(Modis, 0); -end; - -//------------- -// Registers a new Modi. wParam: Pointer to TUS_ModiInfo -// Service for Plugins -//------------- -Function TPartySession.RegisterModi(pModiInfo, nothin: DWord): integer; -var - Len: Integer; - Info: PUS_ModiInfo; -begin - Info := ptr(PModiInfo); - //Copy Info if cbSize is correct - If (Info.cbSize = SizeOf(TUS_ModiInfo)) then - begin - Len := Length(Modis); - SetLength(Modis, Len + 1); - - Modis[Len].Info := Info^; - end - else - Core.ReportError(Integer(PChar('Plugins try to Register Modi with wrong Pointer, or wrong TUS_ModiInfo Record.')), Integer(PChar('TPartySession'))); -end; - -//---------- -// Returns a Number of a Random Plugin -//---------- -Function TPartySession.GetRandomPlugin(TeamMode: Boolean): Cardinal; -var - LowestTP: Byte; - NumPwithLTP: Word; - I: Integer; - R: Word; -begin - Result := StandardModi; //If there are no matching Modis, Play StandardModi - LowestTP := high(Byte); - NumPwithLTP := 0; - - //Search for Plugins not often played yet - For I := 0 to high(Modis) do - begin - if (Modis[I].TimesPlayed < lowestTP) And (((Modis[I].Info.LoadingSettings AND MLS_TeamOnly) <> 0) = TeamMode) then - begin - lowestTP := Modis[I].TimesPlayed; - NumPwithLTP := 1; - end - else if (Modis[I].TimesPlayed = lowestTP) And (((Modis[I].Info.LoadingSettings AND MLS_TeamOnly) <> 0) = TeamMode) then - begin - Inc(NumPwithLTP); - end; - end; - - //Create Random No - R := Random(NumPwithLTP); - - //Search for Random Plugin - For I := 0 to high(Modis) do - begin - if (Modis[I].TimesPlayed = lowestTP) And (((Modis[I].Info.LoadingSettings AND MLS_TeamOnly) <> 0) = TeamMode) then - begin - //Plugin Found - if (R = 0) then - begin - Result := I; - Inc(Modis[I].TimesPlayed); - Break; - end; - - Dec(R); - end; - end; -end; - -//---------- -// Starts new Party Mode. Returns Non Zero on Success -//---------- -Function TPartySession.StartParty(NumRounds, PAofIRounds: DWord): integer; -var - I: Integer; - aiRounds: PARounds; - TeamMode: Boolean; -begin - Result := 0; - If (Teams.NumTeams >= 1) AND (NumRounds < High(Byte)-1) then - begin - bPartyMode := false; - aiRounds := Ptr(PAofIRounds); - - Try - //Is this Teammode(More then one Player per Team) ? - TeamMode := True; - For I := 0 to Teams.NumTeams-1 do - TeamMode := TeamMode AND (Teams.Teaminfo[I].NumPlayers > 1); - - For I := 0 to High(NumRounds) do - begin //Set Plugins - If (aiRounds[I] = -1) then - Rounds[I].Modi := GetRandomPlugin(TeamMode) - Else If (aiRounds[I] >= 0) AND (aiRounds[I] <= High(Modis)) AND (TeamMode OR ((Modis[aiRounds[I]].Info.LoadingSettings AND MLS_TeamOnly) = 0)) then - Rounds[I].Modi := aiRounds[I] - Else - Rounds[I].Modi := StandardModi; - - Rounds[I].Winner := High(Byte); //Set Winner to Not Played - end; - - CurRound := High(Byte); //Set CurRound to not defined - - //Return teh true and Set PartyMode - bPartyMode := True; - Result := 1; - - Except - Core.ReportError(Integer(PChar('Can''t start PartyMode.')), Integer(PChar('TPartySession'))); - end; - end; -end; - -//---------- -// Returns Pointer to Cur. ModiInfoEx (to Use with Singscreen) -//---------- -Function TPartySession.GetCurModi(wParam, lParam: DWord): integer; -begin - If (bPartyMode) AND (CurRound <= High(Rounds)) then - begin //If PartyMode is enabled: - //Return the Plugin of the Cur Round - Result := Integer(@Modis[Rounds[CurRound].Modi]); - end - else - begin //Return StandardModi - Result := Integer(@Modis[StandardModi]); - end; -end; - -//---------- -// Stops Party Mode. Returns 1 If Partymode was enabled before. And -1 if Change was not possible -//---------- -Function TPartySession.StopParty(wParam, lParam: DWord): integer; -begin - Result := -1; - If (bPartyMode) then - begin - // to-do : Whitü: Check here if SingScreen is not Shown atm. - bPartyMode := False; - Result := 1; - end - else - Result := 0; -end; - -//---------- -//GetRandomPlayer - Gives back a Random Player to Play next Round -//---------- -function TPartySession.GetRandomPlayer(Team: Byte): Byte; -var - I, R: Integer; - lowestTP: Byte; - NumPwithLTP: Byte; -begin - LowestTP := high(Byte); - NumPwithLTP := 0; - Result := 0; - - //Search for Players that have not often played yet - For I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do - begin - if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed < lowestTP) then - begin - lowestTP := Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed; - NumPwithLTP := 1; - end - else if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP) then - begin - Inc(NumPwithLTP); - end; - end; - - //Create Random No - R := Random(NumPwithLTP); - - //Search for Random Player - For I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do - begin - if Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP then - begin - //Player Found - if (R = 0) then - begin - Result := I; - Break; - end; - - Dec(R); - end; - end; -end; - -//---------- -// NextRound - Increases CurRound by 1; Returns num of Round or -1 if last Round is already played -//---------- -Function TPartySession.NextRound(wParam, lParam: DWord): integer; -var I: Integer; -begin - If ((CurRound < high(Rounds)) OR (CurRound = high(CurRound))) then - begin //everythings OK! -> Start the Round, maaaaan - Inc(CurRound); - - //Set Players to play this Round - for I := 0 to Teams.NumTeams-1 do - Teams.Teaminfo[I].CurPlayer := GetRandomPlayer(I); - end - else - Result := -1; -end; - -//---------- -//IsWinner - Returns True if the Players Bit is set in the Winner Byte -//---------- -function TPartySession.IsWinner(Player, Winner: Byte): boolean; -var - Bit: Byte; -begin - Bit := 1 shl Player; - - Result := ((Winner AND Bit) = Bit); -end; - -//---------- -//GenScores - Inc Scores for Cur. Round -//---------- -procedure TPartySession.GenScores; -var - I: Byte; -begin - for I := 0 to Teams.NumTeams-1 do - begin - if isWinner(I, Rounds[CurRound].Winner) then - Inc(Teams.Teaminfo[I].Score); - end; -end; - -//---------- -// CallModiInit - Calls CurModis Init Proc. If an Error occurs, Returns Nonzero. In this Case a New Plugin was Selected. Please renew Loading -//---------- -Function TPartySession.CallModiInit(wParam, lParam: DWord): integer; -begin - If (not bPartyMode) then - begin //Set Rounds if not in PartyMode - SetLength(Rounds, 1); - Rounds[0].Modi := StandardModi; - Rounds[0].Winner := High(Byte); - CurRound := 0; - end; - - Try - //Core. - Except - on E : Exception do - begin - Core.ReportError(Integer(PChar('Error starting Modi: ' + Modis[Rounds[CurRound].Modi].Info.Name + ' ErrorStr: ' + E.Message)), Integer(PChar('TPartySession'))); - If (Rounds[CurRound].Modi = StandardModi) then - begin - Core.ReportError(Integer(PChar('Can''t start StandardModi, will exit now!')), Integer(PChar('TPartySession'))); - Halt; - end - Else //Select StandardModi - begin - Rounds[CurRound].Modi := StandardModi - end; - end; - End; -end; - -//---------- -// CallModiDeInit - Calls DeInitProc and does the RoundEnding -//---------- -Function TPartySession.CallModiDeInit(wParam, lParam: DWord): integer; -var - I: Integer; - MaxScore: Word; -begin - If (bPartyMode) then - begin - //Get Winner Byte! - if (@Modis[Rounds[CurRound].Modi].Info.ModiDeInit <> nil) then //get Winners from Plugin - Rounds[CurRound].Winner := Modis[Rounds[CurRound].Modi].Info.ModiDeInit(Modis[Rounds[CurRound].Modi].Info.ID) - else - begin //Create winners by Score :/ - Rounds[CurRound].Winner := 0; - MaxScore := 0; - for I := 0 to Teams.NumTeams-1 do - begin - // to-do : recode Percentage stuff - //PlayerInfo.Playerinfo[I].Percentage := PlayerInfo.Playerinfo[I].Score div 9999; - if (Player[I].ScoreTotalI > MaxScore) then - begin - MaxScore := Player[I].ScoreTotalI; - Rounds[CurRound].Winner := 1 shl I; - end - else if (Player[I].ScoreTotalI = MaxScore) AND (Player[I].ScoreTotalI <> 0) then - begin - Rounds[CurRound].Winner := Rounds[CurRound].Winner or (1 shl I); - end; - end; - - - //When nobody has Points -> Everybody loose - if (MaxScore = 0) then - Rounds[CurRound].Winner := 0; - - end; - - //Generate teh Scores - GenScores; - - //Inc Players TimesPlayed - If ((Modis[Rounds[CurRound-1].Modi].Info.LoadingSettings AND MLS_IncTP) = MLS_IncTP) then - begin - For I := 0 to Teams.NumTeams-1 do - Inc(Teams.TeamInfo[I].Playerinfo[Teams.TeamInfo[I].CurPlayer].TimesPlayed); - end; - end - else if (@Modis[Rounds[CurRound].Modi].Info.ModiDeInit <> nil) then - Modis[Rounds[CurRound].Modi].Info.ModiDeInit(Modis[Rounds[CurRound].Modi].Info.ID); -end; - -//---------- -// GetTeamInfo - Writes TTeamInfo Record to Pointer at lParam. Returns Zero on Success -//---------- -Function TPartySession.GetTeamInfo(wParam, pTeamInfo: DWord): integer; -var Info: ^TTeamInfo; -begin - Result := -1; - Info := ptr(pTeamInfo); - If (Info <> nil) then - begin - Try - // to - do : Check Delphi memory management in this case - //Not sure if i had to copy PChars to a new address or if delphi manages this o0 - Info^ := Teams; - Result := 0; - Except - Result := -2; - End; - end; -end; - -//---------- -// SetTeamInfo - Read TTeamInfo Record from Pointer at lParam. Returns Zero on Success -//---------- -Function TPartySession.SetTeamInfo(wParam, pTeamInfo: DWord): integer; -var - TeamInfobackup: TTeamInfo; - Info: ^TTeamInfo; -begin - Result := -1; - Info := ptr(pTeamInfo); - If (Info <> nil) then - begin - Try - TeamInfoBackup := Teams; - // to - do : Check Delphi memory management in this case - //Not sure if i had to copy PChars to a new address or if delphi manages this o0 - Teams := Info^; - Result := 0; - Except - Teams := TeamInfoBackup; - Result := -2; - End; - end; -end; - -//---------- -// GetTeamOrder - Returns Team Order. Structure: Bits 1..3: Team at Place1; Bits 4..6: Team at Place2 ... -//---------- -Function TPartySession.GetTeamOrder(wParam, lParam: DWord): integer; -var - I, J: Integer; - ATeams: array [0..5] of TeamOrderEntry; - TempTeam: TeamOrderEntry; -begin - // to-do : PartyMode: Write this in another way, so that teams with the same scire get the same Placing - //Fill Team Array - For I := 0 to Teams.NumTeams-1 do - begin - ATeams[I].Teamnum := I; - ATeams[I].Score := Teams.Teaminfo[I].Score; - end; - - //Sort Teams - for J := 0 to Teams.NumTeams-1 do - for I := 1 to Teams.NumTeams-1 do - if ATeams[I].Score > ATeams[I-1].Score then - begin - TempTeam := ATeams[I-1]; - ATeams[I-1] := ATeams[I]; - ATeams[I] := TempTeam; - end; - - //Copy to Result - Result := 0; - For I := 0 to Teams.NumTeams-1 do - Result := Result or (ATeams[I].TeamNum Shl I*3); -end; - -//---------- -// GetWinnerString - wParam is Roundnum. If (Pointer = nil) then Return Length of the String. Otherwise Write the String to Address at lParam -//---------- -Function TPartySession.GetWinnerString(wParam, lParam: DWord): integer; -var - Winners: Array of String; - I: Integer; - ResultStr: String; - S: ^String; -begin - ResultStr := Language.Translate('PARTY_NOBODY'); - - if (wParam <= High(Rounds)) then - begin - if (Rounds[wParam].Winner <> 0) then - begin - if (Rounds[wParam].Winner = 255) then - begin - ResultStr := Language.Translate('PARTY_NOTPLAYEDYET'); - end - else - begin - SetLength(Winners, 0); - for I := 0 to Teams.NumTeams-1 do - begin - if isWinner(I, Rounds[wParam].Winner) then - begin - SetLength(Winners, Length(Winners) + 1); - Winners[high(Winners)] := Teams.TeamInfo[I].Name; - end; - end; - ResultStr := Language.Implode(Winners); - end; - end; - end; - - //Now Return what we have got - If (ptr(lParam) = nil) then - begin //ReturnString Length - Result := Length(ResultStr); - end - Else - begin //Return String - Try - S := Ptr(lParam); - S^ := ResultStr; - Result := 0; - Except - Result := -1; - - End; - end; -end; - -end. +unit UParty; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +{$I switches.inc} + +uses UPartyDefs, UCoreModule, UPluginDefs; + +type + ARounds = Array [0..252] of Integer; //0..252 needed for + PARounds = ^ARounds; + + TRoundInfo = record + Modi: Cardinal; + Winner: Byte; + end; + + TeamOrderEntry = record + Teamnum: Byte; + Score: Byte; + end; + + TeamOrderArray = Array[0..5] of Byte; + + TUS_ModiInfoEx = record + Info: TUS_ModiInfo; + Owner: Integer; + TimesPlayed: Byte; //Helper for setting Round Plugins + end; + + TPartySession = class (TCoreModule) + private + bPartyMode: Boolean; //Is this Party or Singleplayer + CurRound: Byte; + + Modis: Array of TUS_ModiInfoEx; + Teams: TTeamInfo; + + function IsWinner(Player, Winner: Byte): boolean; + procedure GenScores; + function GetRandomPlugin(TeamMode: Boolean): Cardinal; + function GetRandomPlayer(Team: Byte): Byte; + public + //Teams: TTeamInfo; + Rounds: array of TRoundInfo; + + //TCoreModule methods to inherit + Constructor Create; override; + Procedure Info(const pInfo: PModuleInfo); override; + Function Load: Boolean; override; + Function Init: Boolean; override; + Procedure DeInit; override; + Procedure Free; override; + + //Register Modi Service + Function RegisterModi(pModiInfo, nothin: DWord): integer; //Registers a new Modi. wParam: Pointer to TUS_ModiInfo + + //Start new Party + Function StartParty(NumRounds, PAofIRounds: DWord): integer; //Starts new Party Mode. Returns Non Zero on Success + Function GetCurModi(wParam, lParam: DWord): integer; //Returns Pointer to Cur. Modis TUS_ModiInfo (to Use with Singscreen) + Function StopParty(wParam, lParam: DWord): integer; //Stops Party Mode. Returns 1 If Partymode was enabled before. + Function NextRound(wParam, lParam: DWord): integer; //Increases CurRound by 1; Returns num of Round or -1 if last Round is already played + + Function CallModiInit(wParam, lParam: DWord): integer; //Calls CurModis Init Proc. If an Error occurs, Returns Nonzero. In this Case a New Plugin was Selected. Please renew Loading + Function CallModiDeInit(wParam, lParam: DWord): integer; //Calls DeInitProc and does the RoundEnding + + Function GetTeamInfo(wParam, pTeamInfo: DWord): integer; //Writes TTeamInfo Record to Pointer at lParam. Returns Zero on Success + Function SetTeamInfo(wParam, pTeamInfo: DWord): integer; //Read TTeamInfo Record from Pointer at lParam. Returns Zero on Success + + Function GetTeamOrder(wParam, lParam: DWord): integer; //Returns Team Order. Structure: Bits 1..3: Team at Place1; Bits 4..6: Team at Place2 ... + Function GetWinnerString(wParam, lParam: DWord): integer; //wParam is Roundnum. If (Pointer = nil) then Return Length of the String. Otherwise Write the String to Address at lParam + end; + +const + StandardModi = 0; //Modi ID that will be played in non party Mode + +implementation + +uses UCore, UGraphic, UMain, ULanguage, ULog, SysUtils; + +{********************* + TPluginLoader + Implentation +*********************} + +//------------- +// Function that gives some Infos about the Module to the Core +//------------- +Procedure TPartySession.Info(const pInfo: PModuleInfo); +begin + pInfo^.Name := 'TPartySession'; + pInfo^.Version := MakeVersion(1,0,0,chr(0)); + pInfo^.Description := 'Manages Party Modi and Party Game'; +end; + +//------------- +// Just the Constructor +//------------- +Constructor TPartySession.Create; +begin + //UnSet PartyMode + bPartyMode := False; +end; + +//------------- +//Is Called on Loading. +//In this Method only Events and Services should be created +//to offer them to other Modules or Plugins during the Init process +//If False is Returned this will cause a Forced Exit +//------------- +Function TPartySession.Load: Boolean; +begin + //Add Register Party Modi Service + Result := True; + Core.Services.AddService('Party/RegisterModi', nil, Self.RegisterModi); + Core.Services.AddService('Party/StartParty', nil, Self.StartParty); + Core.Services.AddService('Party/GetCurModi', nil, Self.GetCurModi); +end; + +//------------- +//Is Called on Init Process +//In this Method you can Hook some Events and Create + Init +//your Classes, Variables etc. +//If False is Returned this will cause a Forced Exit +//------------- +Function TPartySession.Init: Boolean; +begin + //Just set Prvate Var to true. + Result := true; +end; + +//------------- +//Is Called if this Module has been Inited and there is a Exit. +//Deinit is in backwards Initing Order +//------------- +Procedure TPartySession.DeInit; +begin + //Force DeInit + +end; + +//------------- +//Is Called if this Module will be unloaded and has been created +//Should be used to Free Memory +//------------- +Procedure TPartySession.Free; +begin + //Just save some Memory if it wasn't done now.. + SetLength(Modis, 0); +end; + +//------------- +// Registers a new Modi. wParam: Pointer to TUS_ModiInfo +// Service for Plugins +//------------- +Function TPartySession.RegisterModi(pModiInfo, nothin: DWord): integer; +var + Len: Integer; + Info: PUS_ModiInfo; +begin + Info := Pointer(PModiInfo); + //Copy Info if cbSize is correct + If (Info.cbSize = SizeOf(TUS_ModiInfo)) then + begin + Len := Length(Modis); + SetLength(Modis, Len + 1); + + Modis[Len].Info := Info^; + end + else + Core.ReportError(Integer(PChar('Plugins try to Register Modi with wrong Pointer, or wrong TUS_ModiInfo Record.')), Integer(PChar('TPartySession'))); +end; + +//---------- +// Returns a Number of a Random Plugin +//---------- +Function TPartySession.GetRandomPlugin(TeamMode: Boolean): Cardinal; +var + LowestTP: Byte; + NumPwithLTP: Word; + I: Integer; + R: Word; +begin + Result := StandardModi; //If there are no matching Modis, Play StandardModi + LowestTP := high(Byte); + NumPwithLTP := 0; + + //Search for Plugins not often played yet + For I := 0 to high(Modis) do + begin + if (Modis[I].TimesPlayed < lowestTP) And (((Modis[I].Info.LoadingSettings AND MLS_TeamOnly) <> 0) = TeamMode) then + begin + lowestTP := Modis[I].TimesPlayed; + NumPwithLTP := 1; + end + else if (Modis[I].TimesPlayed = lowestTP) And (((Modis[I].Info.LoadingSettings AND MLS_TeamOnly) <> 0) = TeamMode) then + begin + Inc(NumPwithLTP); + end; + end; + + //Create Random No + R := Random(NumPwithLTP); + + //Search for Random Plugin + For I := 0 to high(Modis) do + begin + if (Modis[I].TimesPlayed = lowestTP) And (((Modis[I].Info.LoadingSettings AND MLS_TeamOnly) <> 0) = TeamMode) then + begin + //Plugin Found + if (R = 0) then + begin + Result := I; + Inc(Modis[I].TimesPlayed); + Break; + end; + + Dec(R); + end; + end; +end; + +//---------- +// Starts new Party Mode. Returns Non Zero on Success +//---------- +Function TPartySession.StartParty(NumRounds, PAofIRounds: DWord): integer; +var + I: Integer; + aiRounds: PARounds; + TeamMode: Boolean; +begin + Result := 0; + If (Teams.NumTeams >= 1) AND (NumRounds < High(Byte)-1) then + begin + bPartyMode := false; + aiRounds := Pointer(PAofIRounds); + + Try + //Is this Teammode(More then one Player per Team) ? + TeamMode := True; + For I := 0 to Teams.NumTeams-1 do + TeamMode := TeamMode AND (Teams.Teaminfo[I].NumPlayers > 1); + + // For I := 0 to High(NumRounds) do // eddie: changed NumRounds to Rounds - is this correct ??? I get compile errors on the mac otherwise... + For I := 0 to High(Rounds) do + begin //Set Plugins + If (aiRounds[I] = -1) then + Rounds[I].Modi := GetRandomPlugin(TeamMode) + Else If (aiRounds[I] >= 0) AND (aiRounds[I] <= High(Modis)) AND (TeamMode OR ((Modis[aiRounds[I]].Info.LoadingSettings AND MLS_TeamOnly) = 0)) then + Rounds[I].Modi := aiRounds[I] + Else + Rounds[I].Modi := StandardModi; + + Rounds[I].Winner := High(Byte); //Set Winner to Not Played + end; + + CurRound := High(Byte); //Set CurRound to not defined + + //Return teh true and Set PartyMode + bPartyMode := True; + Result := 1; + + Except + Core.ReportError(Integer(PChar('Can''t start PartyMode.')), Integer(PChar('TPartySession'))); + end; + end; +end; + +//---------- +// Returns Pointer to Cur. ModiInfoEx (to Use with Singscreen) +//---------- +Function TPartySession.GetCurModi(wParam, lParam: DWord): integer; +begin + If (bPartyMode) AND (CurRound <= High(Rounds)) then + begin //If PartyMode is enabled: + //Return the Plugin of the Cur Round + Result := Integer(@Modis[Rounds[CurRound].Modi]); + end + else + begin //Return StandardModi + Result := Integer(@Modis[StandardModi]); + end; +end; + +//---------- +// Stops Party Mode. Returns 1 If Partymode was enabled before. And -1 if Change was not possible +//---------- +Function TPartySession.StopParty(wParam, lParam: DWord): integer; +begin + Result := -1; + If (bPartyMode) then + begin + // to-do : Whitü: Check here if SingScreen is not Shown atm. + bPartyMode := False; + Result := 1; + end + else + Result := 0; +end; + +//---------- +//GetRandomPlayer - Gives back a Random Player to Play next Round +//---------- +function TPartySession.GetRandomPlayer(Team: Byte): Byte; +var + I, R: Integer; + lowestTP: Byte; + NumPwithLTP: Byte; +begin + LowestTP := high(Byte); + NumPwithLTP := 0; + Result := 0; + + //Search for Players that have not often played yet + For I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do + begin + if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed < lowestTP) then + begin + lowestTP := Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed; + NumPwithLTP := 1; + end + else if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP) then + begin + Inc(NumPwithLTP); + end; + end; + + //Create Random No + R := Random(NumPwithLTP); + + //Search for Random Player + For I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do + begin + if Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP then + begin + //Player Found + if (R = 0) then + begin + Result := I; + Break; + end; + + Dec(R); + end; + end; +end; + +//---------- +// NextRound - Increases CurRound by 1; Returns num of Round or -1 if last Round is already played +//---------- +Function TPartySession.NextRound(wParam, lParam: DWord): integer; +var I: Integer; +begin + If ((CurRound < high(Rounds)) OR (CurRound = high(CurRound))) then + begin //everythings OK! -> Start the Round, maaaaan + Inc(CurRound); + + //Set Players to play this Round + for I := 0 to Teams.NumTeams-1 do + Teams.Teaminfo[I].CurPlayer := GetRandomPlayer(I); + end + else + Result := -1; +end; + +//---------- +//IsWinner - Returns True if the Players Bit is set in the Winner Byte +//---------- +function TPartySession.IsWinner(Player, Winner: Byte): boolean; +var + Bit: Byte; +begin + Bit := 1 shl Player; + + Result := ((Winner AND Bit) = Bit); +end; + +//---------- +//GenScores - Inc Scores for Cur. Round +//---------- +procedure TPartySession.GenScores; +var + I: Byte; +begin + for I := 0 to Teams.NumTeams-1 do + begin + if isWinner(I, Rounds[CurRound].Winner) then + Inc(Teams.Teaminfo[I].Score); + end; +end; + +//---------- +// CallModiInit - Calls CurModis Init Proc. If an Error occurs, Returns Nonzero. In this Case a New Plugin was Selected. Please renew Loading +//---------- +Function TPartySession.CallModiInit(wParam, lParam: DWord): integer; +begin + If (not bPartyMode) then + begin //Set Rounds if not in PartyMode + SetLength(Rounds, 1); + Rounds[0].Modi := StandardModi; + Rounds[0].Winner := High(Byte); + CurRound := 0; + end; + + Try + //Core. + Except + on E : Exception do + begin + Core.ReportError(Integer(PChar('Error starting Modi: ' + Modis[Rounds[CurRound].Modi].Info.Name + ' ErrorStr: ' + E.Message)), Integer(PChar('TPartySession'))); + If (Rounds[CurRound].Modi = StandardModi) then + begin + Core.ReportError(Integer(PChar('Can''t start StandardModi, will exit now!')), Integer(PChar('TPartySession'))); + Halt; + end + Else //Select StandardModi + begin + Rounds[CurRound].Modi := StandardModi + end; + end; + End; +end; + +//---------- +// CallModiDeInit - Calls DeInitProc and does the RoundEnding +//---------- +Function TPartySession.CallModiDeInit(wParam, lParam: DWord): integer; +var + I: Integer; + MaxScore: Word; +begin + If (bPartyMode) then + begin + //Get Winner Byte! + if (@Modis[Rounds[CurRound].Modi].Info.ModiDeInit <> nil) then //get Winners from Plugin + Rounds[CurRound].Winner := Modis[Rounds[CurRound].Modi].Info.ModiDeInit(Modis[Rounds[CurRound].Modi].Info.ID) + else + begin //Create winners by Score :/ + Rounds[CurRound].Winner := 0; + MaxScore := 0; + for I := 0 to Teams.NumTeams-1 do + begin + // to-do : recode Percentage stuff + //PlayerInfo.Playerinfo[I].Percentage := PlayerInfo.Playerinfo[I].Score div 9999; + if (Player[I].ScoreTotalI > MaxScore) then + begin + MaxScore := Player[I].ScoreTotalI; + Rounds[CurRound].Winner := 1 shl I; + end + else if (Player[I].ScoreTotalI = MaxScore) AND (Player[I].ScoreTotalI <> 0) then + begin + Rounds[CurRound].Winner := Rounds[CurRound].Winner or (1 shl I); + end; + end; + + + //When nobody has Points -> Everybody loose + if (MaxScore = 0) then + Rounds[CurRound].Winner := 0; + + end; + + //Generate teh Scores + GenScores; + + //Inc Players TimesPlayed + If ((Modis[Rounds[CurRound-1].Modi].Info.LoadingSettings AND MLS_IncTP) = MLS_IncTP) then + begin + For I := 0 to Teams.NumTeams-1 do + Inc(Teams.TeamInfo[I].Playerinfo[Teams.TeamInfo[I].CurPlayer].TimesPlayed); + end; + end + else if (@Modis[Rounds[CurRound].Modi].Info.ModiDeInit <> nil) then + Modis[Rounds[CurRound].Modi].Info.ModiDeInit(Modis[Rounds[CurRound].Modi].Info.ID); +end; + +//---------- +// GetTeamInfo - Writes TTeamInfo Record to Pointer at lParam. Returns Zero on Success +//---------- +Function TPartySession.GetTeamInfo(wParam, pTeamInfo: DWord): integer; +var Info: ^TTeamInfo; +begin + Result := -1; + Info := Pointer(pTeamInfo); + If (Info <> nil) then + begin + Try + // to - do : Check Delphi memory management in this case + //Not sure if i had to copy PChars to a new address or if delphi manages this o0 + Info^ := Teams; + Result := 0; + Except + Result := -2; + End; + end; +end; + +//---------- +// SetTeamInfo - Read TTeamInfo Record from Pointer at lParam. Returns Zero on Success +//---------- +Function TPartySession.SetTeamInfo(wParam, pTeamInfo: DWord): integer; +var + TeamInfobackup: TTeamInfo; + Info: ^TTeamInfo; +begin + Result := -1; + Info := Pointer(pTeamInfo); + If (Info <> nil) then + begin + Try + TeamInfoBackup := Teams; + // to - do : Check Delphi memory management in this case + //Not sure if i had to copy PChars to a new address or if delphi manages this o0 + Teams := Info^; + Result := 0; + Except + Teams := TeamInfoBackup; + Result := -2; + End; + end; +end; + +//---------- +// GetTeamOrder - Returns Team Order. Structure: Bits 1..3: Team at Place1; Bits 4..6: Team at Place2 ... +//---------- +Function TPartySession.GetTeamOrder(wParam, lParam: DWord): integer; +var + I, J: Integer; + ATeams: array [0..5] of TeamOrderEntry; + TempTeam: TeamOrderEntry; +begin + // to-do : PartyMode: Write this in another way, so that teams with the same scire get the same Placing + //Fill Team Array + For I := 0 to Teams.NumTeams-1 do + begin + ATeams[I].Teamnum := I; + ATeams[I].Score := Teams.Teaminfo[I].Score; + end; + + //Sort Teams + for J := 0 to Teams.NumTeams-1 do + for I := 1 to Teams.NumTeams-1 do + if ATeams[I].Score > ATeams[I-1].Score then + begin + TempTeam := ATeams[I-1]; + ATeams[I-1] := ATeams[I]; + ATeams[I] := TempTeam; + end; + + //Copy to Result + Result := 0; + For I := 0 to Teams.NumTeams-1 do + Result := Result or (ATeams[I].TeamNum Shl I*3); +end; + +//---------- +// GetWinnerString - wParam is Roundnum. If (Pointer = nil) then Return Length of the String. Otherwise Write the String to Address at lParam +//---------- +Function TPartySession.GetWinnerString(wParam, lParam: DWord): integer; +var + Winners: Array of String; + I: Integer; + ResultStr: String; + S: ^String; +begin + ResultStr := Language.Translate('PARTY_NOBODY'); + + if (wParam <= High(Rounds)) then + begin + if (Rounds[wParam].Winner <> 0) then + begin + if (Rounds[wParam].Winner = 255) then + begin + ResultStr := Language.Translate('PARTY_NOTPLAYEDYET'); + end + else + begin + SetLength(Winners, 0); + for I := 0 to Teams.NumTeams-1 do + begin + if isWinner(I, Rounds[wParam].Winner) then + begin + SetLength(Winners, Length(Winners) + 1); + Winners[high(Winners)] := Teams.TeamInfo[I].Name; + end; + end; + ResultStr := Language.Implode(Winners); + end; + end; + end; + + //Now Return what we have got + If (Pointer(lParam) = nil) then + begin //ReturnString Length + Result := Length(ResultStr); + end + Else + begin //Return String + Try + S := Pointer(lParam); + S^ := ResultStr; + Result := 0; + Except + Result := -1; + + End; + end; +end; + +end. diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 index b56265f4..897a4860 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 @@ -204,10 +204,10 @@ _historyCapacity 0 bookmark - 2CF3EFEC0CDE1AB6004F5956 + 2CF8E6C70CDFAAAB0053A996 history - 2CF3EFA30CDE1A19004F5956 + 2CF3EFEC0CDE1AB6004F5956 SplitCount @@ -244,10 +244,10 @@ _historyCapacity 0 bookmark - 2CF3EFED0CDE1AB6004F5956 + 2CF8E6C80CDFAAAB0053A996 history - 2CE7D8F70CDCA55E0027F7CD + 2CF3EFED0CDE1AB6004F5956 SplitCount @@ -284,10 +284,10 @@ _historyCapacity 0 bookmark - 2CF3EFEE0CDE1AB6004F5956 + 2CF8E6C90CDFAAAB0053A996 history - 2CE7D8F90CDCA55E0027F7CD + 2CF3EFEE0CDE1AB6004F5956 SplitCount @@ -324,10 +324,10 @@ _historyCapacity 0 bookmark - 2CF3EFEF0CDE1AB6004F5956 + 2CF8E6CA0CDFAAAB0053A996 history - 2CE7D8FA0CDCA55E0027F7CD + 2CF3EFEF0CDE1AB6004F5956 SplitCount @@ -364,10 +364,10 @@ _historyCapacity 0 bookmark - 2CF3EFF00CDE1AB6004F5956 + 2CF8E6CB0CDFAAAB0053A996 history - 2CE7D8FB0CDCA55E0027F7CD + 2CF3EFF00CDE1AB6004F5956 SplitCount @@ -404,10 +404,10 @@ _historyCapacity 0 bookmark - 2CF3EFF10CDE1AB6004F5956 + 2CF8E6CC0CDFAAAB0053A996 history - 2CE7D8FC0CDCA55E0027F7CD + 2CF3EFF10CDE1AB6004F5956 SplitCount @@ -444,10 +444,10 @@ _historyCapacity 0 bookmark - 2CF3EFF20CDE1AB6004F5956 + 2CF8E6CD0CDFAAAB0053A996 history - 2CE7D8FD0CDCA55E0027F7CD + 2CF3EFF20CDE1AB6004F5956 SplitCount @@ -500,6 +500,8 @@ Layout + BecomeActive + ContentConfiguration PBXBottomSmartGroupGIDs @@ -543,7 +545,7 @@ PBXSmartGroupTreeModuleOutlineStateSelectionKey - 21 + 20 15 0 @@ -568,7 +570,7 @@ 266 RubberWindowFrame - 767 271 817 753 0 0 1680 1028 + 765 271 817 753 0 0 1680 1028 Module PBXSmartGroupTreeModule @@ -605,7 +607,7 @@ Frame {{0, 0}, {529, 0}} RubberWindowFrame - 767 271 817 753 0 0 1680 1028 + 765 271 817 753 0 0 1680 1028 Module PBXNavigatorGroup @@ -613,8 +615,6 @@ 0pt - BecomeActive - ContentConfiguration PBXProjectModuleGUID @@ -627,7 +627,7 @@ Frame {{0, 5}, {529, 707}} RubberWindowFrame - 767 271 817 753 0 0 1680 1028 + 765 271 817 753 0 0 1680 1028 Module XCDetailModule @@ -651,9 +651,9 @@ TableOfContents - 2CF3EE840CDE0AAA004F5956 + 2CF8E6C50CDFAAAB0053A996 1CE0B1FE06471DED0097A5F4 - 2CF3EE850CDE0AAA004F5956 + 2CF8E6C60CDFAAAB0053A996 1CE0B20306471E060097A5F4 1CE0B20506471E060097A5F4 @@ -787,25 +787,21 @@ 5 WindowOrderList - 2CDD4B730CB935C700549FAC - 1C530D57069F1CE1000CFCEE - 2CF3EE990CDE0AAA004F5956 - 2CF3EE9A0CDE0AAA004F5956 - 2CDD4BFC0CB948FC00549FAC - 2CF3EE950CDE0AAA004F5956 - 1C0AD2B3069F1EA900FABCE6 + 2CF8E6D50CDFAAAB0053A996 2CF553750CDA575B00627463 2CF553720CDA575B00627463 2CF5536F0CDA575B00627463 2CF552930CDA426600627463 2CF552960CDA426600627463 2C0C2C180CDC7312004A651F - /Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj 2CF3EF8A0CDE1898004F5956 1CD10A99069EF8BA00B06720 + /Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj + 2CDD4B730CB935C700549FAC + 1C0AD2B3069F1EA900FABCE6 WindowString - 767 271 817 753 0 0 1680 1028 + 765 271 817 753 0 0 1680 1028 WindowTools @@ -821,14 +817,12 @@ Dock - BecomeActive - ContentConfiguration PBXProjectModuleGUID 1CD0528F0623707200166675 PBXProjectModuleLabel - MacResources.pas + UParty.pas StatusBarVisibility @@ -845,6 +839,8 @@ 566pt + BecomeActive + ContentConfiguration PBXProjectModuleGUID @@ -884,7 +880,7 @@ TableOfContents 2CDD4B730CB935C700549FAC - 2CF3EEAC0CDE0C76004F5956 + 2CF8E6CE0CDFAAAB0053A996 1CD0528F0623707200166675 XCMainBuildResultsModuleGUID @@ -895,7 +891,7 @@ WindowToolGUID 2CDD4B730CB935C700549FAC WindowToolIsVisible - + FirstTimeWindowDisplayed @@ -926,8 +922,8 @@ yes sizes - {{0, 0}, {341, 414}} - {{341, 0}, {623, 414}} + {{0, 0}, {339, 414}} + {{339, 0}, {625, 414}} VerticalSplitView @@ -990,14 +986,14 @@ TableOfContents 1CD10A99069EF8BA00B06720 - 2CF3EE8F0CDE0AAA004F5956 + 2CF8E6CF0CDFAAAB0053A996 1C162984064C10D400B95A72 - 2CF3EE900CDE0AAA004F5956 - 2CF3EE910CDE0AAA004F5956 - 2CF3EE920CDE0AAA004F5956 - 2CF3EE930CDE0AAA004F5956 - 2CF3EE940CDE0AAA004F5956 - 2CF3EE950CDE0AAA004F5956 + 2CF8E6D00CDFAAAB0053A996 + 2CF8E6D10CDFAAAB0053A996 + 2CF8E6D20CDFAAAB0053A996 + 2CF8E6D30CDFAAAB0053A996 + 2CF8E6D40CDFAAAB0053A996 + 2CF8E6D50CDFAAAB0053A996 ToolbarConfiguration xcode.toolbar.config.debug @@ -1248,9 +1244,9 @@ TableOfContents 1C0AD2B3069F1EA900FABCE6 - 2CF3EE970CDE0AAA004F5956 + 2CF8E6D60CDFAAAB0053A996 1CD0528B0623707200166675 - 2CF3EE980CDE0AAA004F5956 + 2CF8E6D70CDFAAAB0053A996 ToolbarConfiguration xcode.toolbar.config.run @@ -1259,7 +1255,7 @@ WindowToolGUID 1C0AD2B3069F1EA900FABCE6 WindowToolIsVisible - + FirstTimeWindowDisplayed diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser index 0a358f1e..36d98df6 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser @@ -226,9 +226,9 @@ }; 2C4D9C7F0CC9EC8C0031092D /* UParty.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {758, 5278}}"; - sepNavSelRange = "{48, 0}"; - sepNavVisRect = "{{0, 0}, {758, 716}}"; + sepNavIntBoundsRect = "{{0, 0}, {1305, 8610}}"; + sepNavSelRange = "{7616, 0}"; + sepNavVisRect = "{{0, 3141}, {1305, 534}}"; sepNavWindowFrame = "{{15, 178}, {797, 845}}"; }; }; @@ -316,7 +316,7 @@ uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1730, 16002}}"; sepNavSelRange = "{11873, 20}"; - sepNavVisRect = "{{0, 4988}, {577, 612}}"; + sepNavVisRect = "{{0, 5189}, {577, 612}}"; sepNavWindowFrame = "{{15, 282}, {616, 741}}"; }; }; @@ -579,66 +579,6 @@ modificationTime = 215882409.953114; state = 1; }; - 2CE7D8F70CDCA55E0027F7CD /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; - name = "USongs.pas: 39"; - rLen = 0; - rLoc = 503; - rType = 0; - vrLen = 1403; - vrLoc = 4615; - }; - 2CE7D8F90CDCA55E0027F7CD /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; - name = "UAudio_FFMpeg.pas: 952"; - rLen = 0; - rLoc = 22697; - rType = 0; - vrLen = 1224; - vrLoc = 21473; - }; - 2CE7D8FA0CDCA55E0027F7CD /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; - name = "nux ... is t"; - rLen = 12; - rLoc = 3202; - rType = 0; - vrLen = 1266; - vrLoc = 15619; - }; - 2CE7D8FB0CDCA55E0027F7CD /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; - name = "sdl_image.pas: 130"; - rLen = 0; - rLoc = 8020; - rType = 0; - vrLen = 832; - vrLoc = 7978; - }; - 2CE7D8FC0CDCA55E0027F7CD /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; - name = "sdl.pas: 250"; - rLen = 0; - rLoc = 16506; - rType = 0; - vrLen = 886; - vrLoc = 16376; - }; - 2CE7D8FD0CDCA55E0027F7CD /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; - name = "ScaledTexture(TexSur"; - rLen = 20; - rLoc = 11873; - rType = 0; - vrLen = 1220; - vrLoc = 11189; - }; 2CF3EF210CDE13A0004F5956 /* Messages.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1013, 614}}"; @@ -655,16 +595,6 @@ sepNavWindowFrame = "{{515, 220}, {1052, 743}}"; }; }; - 2CF3EFA30CDE1A19004F5956 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2CF3EF260CDE13BA004F5956 /* MacResources.pas */; - name = "MacResources.pas: 63"; - rLen = 0; - rLoc = 1896; - rType = 0; - vrLen = 1181; - vrLoc = 455; - }; 2CF3EFEC0CDE1AB6004F5956 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 2CF3EF260CDE13BA004F5956 /* MacResources.pas */; @@ -1087,6 +1017,76 @@ sepNavWindowFrame = "{{38, 259}, {1052, 743}}"; }; }; + 2CF8E6C70CDFAAAB0053A996 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2CF3EF260CDE13BA004F5956 /* MacResources.pas */; + name = "MacResources.pas: 60"; + rLen = 0; + rLoc = 1521; + rType = 0; + vrLen = 1339; + vrLoc = 455; + }; + 2CF8E6C80CDFAAAB0053A996 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; + name = "USongs.pas: 39"; + rLen = 0; + rLoc = 503; + rType = 0; + vrLen = 1403; + vrLoc = 4615; + }; + 2CF8E6C90CDFAAAB0053A996 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; + name = "UAudio_FFMpeg.pas: 952"; + rLen = 0; + rLoc = 22697; + rType = 0; + vrLen = 1224; + vrLoc = 21473; + }; + 2CF8E6CA0CDFAAAB0053A996 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; + name = "nux ... is t"; + rLen = 12; + rLoc = 3202; + rType = 0; + vrLen = 1266; + vrLoc = 15619; + }; + 2CF8E6CB0CDFAAAB0053A996 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; + name = "sdl_image.pas: 130"; + rLen = 0; + rLoc = 8020; + rType = 0; + vrLen = 832; + vrLoc = 7978; + }; + 2CF8E6CC0CDFAAAB0053A996 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; + name = "sdl.pas: 250"; + rLen = 0; + rLoc = 16506; + rType = 0; + vrLen = 886; + vrLoc = 16376; + }; + 2CF8E6CD0CDFAAAB0053A996 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; + name = "TempSurface:=TexS"; + rLen = 20; + rLoc = 11873; + rType = 0; + vrLen = 1318; + vrLoc = 11176; + }; 9845B6590B1F9B9E0084DD62 /* SDL.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {948, 1330}}"; @@ -1229,17 +1229,10 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 215878288; - PBXWorkspaceStateSaveDate = 215878288; + PBXPerProjectTemplateStateSaveDate = 215983788; + PBXWorkspaceStateSaveDate = 215983788; }; perUserProjectItems = { - 2CE7D8F70CDCA55E0027F7CD /* PBXTextBookmark */ = 2CE7D8F70CDCA55E0027F7CD /* PBXTextBookmark */; - 2CE7D8F90CDCA55E0027F7CD /* PBXTextBookmark */ = 2CE7D8F90CDCA55E0027F7CD /* PBXTextBookmark */; - 2CE7D8FA0CDCA55E0027F7CD /* PBXTextBookmark */ = 2CE7D8FA0CDCA55E0027F7CD /* PBXTextBookmark */; - 2CE7D8FB0CDCA55E0027F7CD /* PBXTextBookmark */ = 2CE7D8FB0CDCA55E0027F7CD /* PBXTextBookmark */; - 2CE7D8FC0CDCA55E0027F7CD /* PBXTextBookmark */ = 2CE7D8FC0CDCA55E0027F7CD /* PBXTextBookmark */; - 2CE7D8FD0CDCA55E0027F7CD /* PBXTextBookmark */ = 2CE7D8FD0CDCA55E0027F7CD /* PBXTextBookmark */; - 2CF3EFA30CDE1A19004F5956 /* PBXTextBookmark */ = 2CF3EFA30CDE1A19004F5956 /* PBXTextBookmark */; 2CF3EFEC0CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFEC0CDE1AB6004F5956 /* PBXTextBookmark */; 2CF3EFED0CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFED0CDE1AB6004F5956 /* PBXTextBookmark */; 2CF3EFEE0CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFEE0CDE1AB6004F5956 /* PBXTextBookmark */; @@ -1247,6 +1240,13 @@ 2CF3EFF00CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFF00CDE1AB6004F5956 /* PBXTextBookmark */; 2CF3EFF10CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFF10CDE1AB6004F5956 /* PBXTextBookmark */; 2CF3EFF20CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFF20CDE1AB6004F5956 /* PBXTextBookmark */; + 2CF8E6C70CDFAAAB0053A996 /* PBXTextBookmark */ = 2CF8E6C70CDFAAAB0053A996 /* PBXTextBookmark */; + 2CF8E6C80CDFAAAB0053A996 /* PBXTextBookmark */ = 2CF8E6C80CDFAAAB0053A996 /* PBXTextBookmark */; + 2CF8E6C90CDFAAAB0053A996 /* PBXTextBookmark */ = 2CF8E6C90CDFAAAB0053A996 /* PBXTextBookmark */; + 2CF8E6CA0CDFAAAB0053A996 /* PBXTextBookmark */ = 2CF8E6CA0CDFAAAB0053A996 /* PBXTextBookmark */; + 2CF8E6CB0CDFAAAB0053A996 /* PBXTextBookmark */ = 2CF8E6CB0CDFAAAB0053A996 /* PBXTextBookmark */; + 2CF8E6CC0CDFAAAB0053A996 /* PBXTextBookmark */ = 2CF8E6CC0CDFAAAB0053A996 /* PBXTextBookmark */; + 2CF8E6CD0CDFAAAB0053A996 /* PBXTextBookmark */ = 2CF8E6CD0CDFAAAB0053A996 /* PBXTextBookmark */; }; sourceControlManager = 2CDD4B690CB9357000549FAC /* Source Control */; userBuildSettings = { diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj index 6d8eb133..38736234 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj @@ -255,6 +255,8 @@ 2CF553420CDA531100627463 /* libavformat.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2CF552C00CDA4B7B00627463 /* libavformat.dylib */; }; 2CF553430CDA531100627463 /* libavutil.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2CF552C10CDA4B7B00627463 /* libavutil.dylib */; }; 2CF553440CDA531100627463 /* libmp3lame.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2CF552C20CDA4B7B00627463 /* libmp3lame.dylib */; }; + 2CF8E6BE0CDFA8E80053A996 /* UPartyDefs.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF8E6BD0CDFA8E80053A996 /* UPartyDefs.pas */; }; + 2CF8E6BF0CDFA8E80053A996 /* UPartyDefs.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF8E6BD0CDFA8E80053A996 /* UPartyDefs.pas */; }; 98B8BE340B1F947800162019 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 98B8BE330B1F947800162019 /* AppKit.framework */; }; 98B8BE390B1F949C00162019 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 98B8BE370B1F949C00162019 /* Cocoa.framework */; }; 98B8BE3A0B1F949C00162019 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 98B8BE380B1F949C00162019 /* Foundation.framework */; }; @@ -483,6 +485,7 @@ 2CF552C10CDA4B7B00627463 /* libavutil.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libavutil.dylib; path = ../lib/ffmpeg/libavutil.dylib; sourceTree = SOURCE_ROOT; }; 2CF552C20CDA4B7B00627463 /* libmp3lame.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libmp3lame.dylib; path = ../lib/ffmpeg/libmp3lame.dylib; sourceTree = SOURCE_ROOT; }; 2CF553070CDA51B500627463 /* sdlutils.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = sdlutils.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL/sdlutils.pas"; sourceTree = ""; }; + 2CF8E6BD0CDFA8E80053A996 /* UPartyDefs.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UPartyDefs.pas; path = ../../../Modis/SDK/UPartyDefs.pas; sourceTree = SOURCE_ROOT; }; 9845B6590B1F9B9E0084DD62 /* SDL.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL.h; path = /Library/Frameworks/SDL.framework/Versions/A/Headers/SDL.h; sourceTree = ""; }; 98B8BE330B1F947800162019 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 98B8BE370B1F949C00162019 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; @@ -687,6 +690,7 @@ 2CF5508A0CDA228800627463 /* SDK */ = { isa = PBXGroup; children = ( + 2CF8E6BD0CDFA8E80053A996 /* UPartyDefs.pas */, 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */, 2CF552110CDA3D1400627463 /* UPluginDefs.pas */, 2CF5508B0CDA22B000627463 /* ModiSDK.pas */, @@ -1073,6 +1077,7 @@ 2CDC716C0CDB9CB70018F966 /* StrUtils.pas in Sources */, 2CF3EF220CDE13A0004F5956 /* Messages.pas in Sources */, 2CF3EF270CDE13BA004F5956 /* MacResources.pas in Sources */, + 2CF8E6BE0CDFA8E80053A996 /* UPartyDefs.pas in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1194,6 +1199,7 @@ 2CDC716D0CDB9CB70018F966 /* StrUtils.pas in Sources */, 2CF3EF230CDE13A0004F5956 /* Messages.pas in Sources */, 2CF3EF280CDE13BA004F5956 /* MacResources.pas in Sources */, + 2CF8E6BF0CDFA8E80053A996 /* UPartyDefs.pas in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; -- cgit v1.2.3 From eee3f173ec616e89dea23d4aa192e68587eea148 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Mon, 5 Nov 2007 23:38:15 +0000 Subject: Mac OS X: We're getting closer! Songs get loaded. Sound is playing on the SingScreen. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@591 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.pas | 3 + Game/Code/Classes/UMain.pas | 2 +- Game/Code/Classes/USongs.pas | 94 +++---- Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 | 288 +++++--------------- .../MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser | 297 ++++++++------------- .../MacOSX/UltraStarDX.xcodeproj/project.pbxproj | 232 ++++++++-------- Game/Code/MacOSX/Wrapper/MacResources.pas | 90 +++++-- 7 files changed, 411 insertions(+), 595 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index aaee50a0..7475da7a 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -85,6 +85,9 @@ uses UMain, {$IFDEF LAZARUS} LResources, {$ENDIF} + {$IFDEF DARWIN} + MacResources, + {$ENDIF} UGraphic; procedure BuildFont; // Build Our Bitmap Font diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index b1469f00..f25eaa87 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -1051,7 +1051,7 @@ procedure InitializePaths; If DirectoryExists(aPathVar) then begin - lAttrib := fileGetAttr('C:Temp'); + lAttrib := fileGetAttr(aPathVar); lWriteable := ( lAttrib and faDirectory <> 0 ) AND NOT ( lAttrib and faReadOnly <> 0 ) diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 96d9ad2e..a04c1032 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -302,6 +302,7 @@ var ADirent : pDirent; Entry : Longint; info : stat; + lAttrib : integer; {$ENDIF} begin {$ifdef Delphi} @@ -410,62 +411,61 @@ begin {$IFDEF DARWIN} // Itterate the Songs Directory... ( With unicode capable functions for linux ) - TheDir := FPOpenDir( Dir ); // JB_Unicode - linux + TheDir := FPOpenDir(Dir); // JB_Unicode - linux if TheDir <> nil then begin repeat ADirent := FPReadDir(TheDir); - If ADirent<>Nil then + If assigned(ADirent) and (ADirent^.d_name <> '.') and (ADirent^.d_name <> '..') then begin - With ADirent^ do - begin - - if ( d_name[0] <> '.') then - BrowseDir( Dir + d_name + pathdelim ); - - end; + lAttrib := FileGetAttr(Dir + ADirent^.d_name); + if (lAttrib and faDirectory) <> 0 then + begin + //Log.LogError('Entering dir "' + Dir + ADirent^.d_name + PathDelim + '" now.'); + BrowseDir(Dir + ADirent^.d_name + PathDelim); + end + else if Pos( '.txt', LowerCase(ADirent^.d_name)) > 0 then + begin + SLen := BrowsePos; + + try + Song[SLen].Path := Dir; + Song[SLen].Folder := Copy(String(Dir), Length(String(SongPath))+1, 10000); + Song[SLen].Folder := Copy(String(Song[SLen].Folder), 1, Pos( PathDelim , Song[SLen].Folder)-1); + Song[SLen].FileName := ADirent^.d_name; + //Log.LogError( 'Song: ' + ADirent^.d_name + ', Length(Song) = ' + inttostr(Length(Song)) + ', BrowsePos = ' + IntToStr(BrowsePos) + ', Dir = "' + Dir + '"'); + + if (AnalyseFile(Song[SLen]) = false) then + begin + Log.LogError('AnalyseFile failed for "' + ADirent^.d_name + '".'); + Dec(BrowsePos); + end + else + begin + if Song[SLen].Cover = '' then + Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); + end; + except + end; + + //Change Length Only every 50 Entrys + Inc(BrowsePos); + + if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then + begin + SetLength(Song, Length(Song) + 50); + end; + end; end; + Until ADirent=Nil; + + if (FPCloseDir(TheDir) <> 0) then + begin + Log.LogError('TSongs.BrowseDir: Exception: Error closing dir: "' + Dir + '".') + end; end; - - - - TheDir := FPOpenDir( Dir ); // JB_Unicode - linux - if TheDir <> nil then - begin - repeat - ADirent := FPReadDir(TheDir); - - if ( ADirent <> Nil ) AND - ( pos( '.txt', ADirent^.d_name ) > -1 ) then - begin - SLen := BrowsePos; - - Song[SLen].Path := Dir; - Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); - Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); - Song[SLen].FileName := ADirent^.d_name; - - if (AnalyseFile(Song[SLen]) = false) then - Dec(BrowsePos) - else - begin - if Song[SLen].Cover = '' then - Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); - end; - - //Change Length Only every 50 Entrys - Inc(BrowsePos); - - if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then - begin - SetLength(Song, Length(Song) + 50); - end; - end; - - Until ADirent=Nil; - end; // if FindFirst {$endif} diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 index 897a4860..bd9923d0 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 @@ -190,47 +190,7 @@ Content PBXProjectModuleGUID - 2CF3EF8A0CDE1898004F5956 - PBXProjectModuleLabel - MacResources.pas - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 2CF3EF8B0CDE1898004F5956 - PBXProjectModuleLabel - MacResources.pas - _historyCapacity - 0 - bookmark - 2CF8E6C70CDFAAAB0053A996 - history - - 2CF3EFEC0CDE1AB6004F5956 - - - SplitCount - 1 - - StatusBarVisibility - - - Geometry - - Frame - {{0, 20}, {1052, 646}} - PBXModuleWindowStatusBarHidden2 - - RubberWindowFrame - 515 276 1052 687 0 0 1680 1028 - - - - Content - - PBXProjectModuleGUID - 2C0C2C180CDC7312004A651F + 2C82EFB60CDFC4BA00A79F26 PBXProjectModuleLabel USongs.pas PBXSplitModuleInNavigatorKey @@ -238,16 +198,16 @@ Split0 PBXProjectModuleGUID - 2C0C2C190CDC7312004A651F + 2C82EFB70CDFC4BA00A79F26 PBXProjectModuleLabel USongs.pas _historyCapacity 0 bookmark - 2CF8E6C80CDFAAAB0053A996 + 2CD986A80CDFDF790007B9C6 history - 2CF3EFED0CDE1AB6004F5956 + 2C82F12E0CDFDEA300A79F26 SplitCount @@ -270,24 +230,24 @@ Content PBXProjectModuleGUID - 2CF552960CDA426600627463 + 2C82EFB90CDFC4BA00A79F26 PBXProjectModuleLabel - UAudio_FFMpeg.pas + TextGL.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2CF552970CDA426600627463 + 2C82EFBA0CDFC4BA00A79F26 PBXProjectModuleLabel - UAudio_FFMpeg.pas + TextGL.pas _historyCapacity 0 bookmark - 2CF8E6C90CDFAAAB0053A996 + 2CD986A90CDFDF790007B9C6 history - 2CF3EFEE0CDE1AB6004F5956 + 2C82F12F0CDFDEA300A79F26 SplitCount @@ -310,144 +270,24 @@ Content PBXProjectModuleGUID - 2CF552930CDA426600627463 - PBXProjectModuleLabel - UAudio_bass.pas - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 2CF552940CDA426600627463 - PBXProjectModuleLabel - UAudio_bass.pas - _historyCapacity - 0 - bookmark - 2CF8E6CA0CDFAAAB0053A996 - history - - 2CF3EFEF0CDE1AB6004F5956 - - - SplitCount - 1 - - StatusBarVisibility - - - Geometry - - Frame - {{0, 20}, {797, 748}} - PBXModuleWindowStatusBarHidden2 - - RubberWindowFrame - 15 234 797 789 0 0 1680 1028 - - - - Content - - PBXProjectModuleGUID - 2CF5536F0CDA575B00627463 - PBXProjectModuleLabel - sdl_image.pas - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 2CF553700CDA575B00627463 - PBXProjectModuleLabel - sdl_image.pas - _historyCapacity - 0 - bookmark - 2CF8E6CB0CDFAAAB0053A996 - history - - 2CF3EFF00CDE1AB6004F5956 - - - SplitCount - 1 - - StatusBarVisibility - - - Geometry - - Frame - {{0, 20}, {1052, 646}} - PBXModuleWindowStatusBarHidden2 - - RubberWindowFrame - 15 336 1052 687 0 0 1680 1028 - - - - Content - - PBXProjectModuleGUID - 2CF553720CDA575B00627463 + 2C82EF8B0CDFB9B300A79F26 PBXProjectModuleLabel - sdl.pas - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 2CF553730CDA575B00627463 - PBXProjectModuleLabel - sdl.pas - _historyCapacity - 0 - bookmark - 2CF8E6CC0CDFAAAB0053A996 - history - - 2CF3EFF10CDE1AB6004F5956 - - - SplitCount - 1 - - StatusBarVisibility - - - Geometry - - Frame - {{0, 20}, {987, 762}} - PBXModuleWindowStatusBarHidden2 - - RubberWindowFrame - 211 199 987 803 0 0 1680 1028 - - - - Content - - PBXProjectModuleGUID - 2CF553750CDA575B00627463 - PBXProjectModuleLabel - UTexture.pas + MacResources.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2CF553760CDA575B00627463 + 2C82EF8C0CDFB9B300A79F26 PBXProjectModuleLabel - UTexture.pas + MacResources.pas _historyCapacity 0 bookmark - 2CF8E6CD0CDFAAAB0053A996 + 2CD986AA0CDFDF790007B9C6 history - 2CF3EFF20CDE1AB6004F5956 + 2C82F1300CDFDEA300A79F26 SplitCount @@ -459,11 +299,11 @@ Geometry Frame - {{0, 20}, {616, 644}} + {{0, 20}, {873, 642}} PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 15 338 616 685 0 0 1680 1028 + 200 304 873 683 0 0 1680 1028 @@ -545,7 +385,7 @@ PBXSmartGroupTreeModuleOutlineStateSelectionKey - 20 + 17 15 0 @@ -570,7 +410,7 @@ 266 RubberWindowFrame - 765 271 817 753 0 0 1680 1028 + 764 270 817 753 0 0 1680 1028 Module PBXSmartGroupTreeModule @@ -607,7 +447,7 @@ Frame {{0, 0}, {529, 0}} RubberWindowFrame - 765 271 817 753 0 0 1680 1028 + 764 270 817 753 0 0 1680 1028 Module PBXNavigatorGroup @@ -627,7 +467,7 @@ Frame {{0, 5}, {529, 707}} RubberWindowFrame - 765 271 817 753 0 0 1680 1028 + 764 270 817 753 0 0 1680 1028 Module XCDetailModule @@ -651,9 +491,9 @@ TableOfContents - 2CF8E6C50CDFAAAB0053A996 + 2CD9869C0CDFDEE60007B9C6 1CE0B1FE06471DED0097A5F4 - 2CF8E6C60CDFAAAB0053A996 + 2CD9869D0CDFDEE60007B9C6 1CE0B20306471E060097A5F4 1CE0B20506471E060097A5F4 @@ -787,21 +627,15 @@ 5 WindowOrderList - 2CF8E6D50CDFAAAB0053A996 - 2CF553750CDA575B00627463 - 2CF553720CDA575B00627463 - 2CF5536F0CDA575B00627463 - 2CF552930CDA426600627463 - 2CF552960CDA426600627463 - 2C0C2C180CDC7312004A651F - 2CF3EF8A0CDE1898004F5956 - 1CD10A99069EF8BA00B06720 - /Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj 2CDD4B730CB935C700549FAC + 2C82EF8B0CDFB9B300A79F26 + 2C82EFB90CDFC4BA00A79F26 + /Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj + 2C82EFB60CDFC4BA00A79F26 1C0AD2B3069F1EA900FABCE6 WindowString - 765 271 817 753 0 0 1680 1028 + 764 270 817 753 0 0 1680 1028 WindowTools @@ -822,7 +656,7 @@ PBXProjectModuleGUID 1CD0528F0623707200166675 PBXProjectModuleLabel - UParty.pas + StatusBarVisibility @@ -839,8 +673,6 @@ 566pt - BecomeActive - ContentConfiguration PBXProjectModuleGUID @@ -880,7 +712,7 @@ TableOfContents 2CDD4B730CB935C700549FAC - 2CF8E6CE0CDFAAAB0053A996 + 2CD986A70CDFDF660007B9C6 1CD0528F0623707200166675 XCMainBuildResultsModuleGUID @@ -891,7 +723,7 @@ WindowToolGUID 2CDD4B730CB935C700549FAC WindowToolIsVisible - + FirstTimeWindowDisplayed @@ -922,8 +754,8 @@ yes sizes - {{0, 0}, {339, 414}} - {{339, 0}, {625, 414}} + {{0, 0}, {337, 414}} + {{337, 0}, {627, 414}} VerticalSplitView @@ -986,14 +818,14 @@ TableOfContents 1CD10A99069EF8BA00B06720 - 2CF8E6CF0CDFAAAB0053A996 + 2C82EF2D0CDFAB5700A79F26 1C162984064C10D400B95A72 - 2CF8E6D00CDFAAAB0053A996 - 2CF8E6D10CDFAAAB0053A996 - 2CF8E6D20CDFAAAB0053A996 - 2CF8E6D30CDFAAAB0053A996 - 2CF8E6D40CDFAAAB0053A996 - 2CF8E6D50CDFAAAB0053A996 + 2C82EF2E0CDFAB5700A79F26 + 2C82EF2F0CDFAB5700A79F26 + 2C82EF300CDFAB5700A79F26 + 2C82EF310CDFAB5700A79F26 + 2C82EF320CDFAB5700A79F26 + 2C82EF330CDFAB5700A79F26 ToolbarConfiguration xcode.toolbar.config.debug @@ -1002,7 +834,7 @@ WindowToolGUID 1CD10A99069EF8BA00B06720 WindowToolIsVisible - + FirstTimeWindowDisplayed @@ -1025,7 +857,7 @@ PBXProjectModuleGUID 1CDD528C0622207200134675 PBXProjectModuleLabel - UAudio_bass.pas + USongs.pas StatusBarVisibility @@ -1034,7 +866,7 @@ Frame {{0, 0}, {790, 502}} RubberWindowFrame - 890 81 790 888 0 0 1680 1028 + 821 68 790 888 0 0 1680 1028 Module PBXNavigatorGroup @@ -1060,7 +892,7 @@ Frame {{0, 507}, {790, 340}} RubberWindowFrame - 890 81 790 888 0 0 1680 1028 + 821 68 790 888 0 0 1680 1028 Module PBXProjectFindModule @@ -1083,17 +915,17 @@ TableOfContents 1C530D57069F1CE1000CFCEE - 2CF3EEA70CDE0C55004F5956 - 2CF3EEA80CDE0C55004F5956 + 2C82EF7C0CDFB8FA00A79F26 + 2C82EF7D0CDFB8FA00A79F26 1CDD528C0622207200134675 1CD0528E0623707200166675 WindowString - 890 81 790 888 0 0 1680 1028 + 821 68 790 888 0 0 1680 1028 WindowToolGUID 1C530D57069F1CE1000CFCEE WindowToolIsVisible - + Identifier @@ -1124,18 +956,18 @@ GeometryConfiguration Frame - {{0, 0}, {1248, 416}} + {{0, 0}, {1245, 708}} RubberWindowFrame - 426 66 1248 457 0 0 1680 1028 + 410 84 1245 749 0 0 1680 1028 Module PBXDebugCLIModule Proportion - 416pt + 708pt Proportion - 416pt + 708pt Name @@ -1149,15 +981,15 @@ TableOfContents 2CDD4BFC0CB948FC00549FAC - 2CF3EE960CDE0AAA004F5956 + 2C82EF600CDFB7E100A79F26 1C78EAAC065D492600B07095 WindowString - 426 66 1248 457 0 0 1680 1028 + 410 84 1245 749 0 0 1680 1028 WindowToolGUID 2CDD4BFC0CB948FC00549FAC WindowToolIsVisible - + FirstTimeWindowDisplayed @@ -1221,7 +1053,7 @@ Frame {{0, 0}, {1092, 660}} RubberWindowFrame - 133 241 1092 701 0 0 1680 1028 + 568 148 1092 701 0 0 1680 1028 Module PBXRunSessionModule @@ -1244,14 +1076,14 @@ TableOfContents 1C0AD2B3069F1EA900FABCE6 - 2CF8E6D60CDFAAAB0053A996 + 2CD986A10CDFDEE60007B9C6 1CD0528B0623707200166675 - 2CF8E6D70CDFAAAB0053A996 + 2CD986A20CDFDEE60007B9C6 ToolbarConfiguration xcode.toolbar.config.run WindowString - 133 241 1092 701 0 0 1680 1028 + 568 148 1092 701 0 0 1680 1028 WindowToolGUID 1C0AD2B3069F1EA900FABCE6 WindowToolIsVisible diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser index 36d98df6..89340e56 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser @@ -2,16 +2,16 @@ { 2C4D9C620CC9EC8C0031092D /* TextGL.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {923, 7798}}"; - sepNavSelRange = "{3311, 0}"; - sepNavVisRect = "{{0, 1726}, {923, 342}}"; + sepNavIntBoundsRect = "{{0, 0}, {758, 7840}}"; + sepNavSelRange = "{2871, 0}"; + sepNavVisRect = "{{0, 5908}, {758, 716}}"; sepNavWindowFrame = "{{38, 157}, {797, 845}}"; }; }; 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {884, 9100}}"; - sepNavSelRange = "{3202, 12}"; + sepNavSelRange = "{16891, 0}"; sepNavVisRect = "{{0, 8330}, {758, 716}}"; sepNavWindowFrame = "{{15, 178}, {797, 845}}"; }; @@ -98,17 +98,17 @@ }; 2C4D9C6E0CC9EC8C0031092D /* UFiles.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1562, 10766}}"; - sepNavSelRange = "{1829, 12}"; - sepNavVisRect = "{{0, 766}, {749, 470}}"; + sepNavIntBoundsRect = "{{0, 0}, {1562, 10850}}"; + sepNavSelRange = "{8099, 0}"; + sepNavVisRect = "{{0, 4494}, {923, 342}}"; sepNavWindowFrame = "{{84, 219}, {616, 741}}"; }; }; 2C4D9C6F0CC9EC8C0031092D /* UGraphic.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {923, 10444}}"; - sepNavSelRange = "{5900, 0}"; - sepNavVisRect = "{{0, 3588}, {923, 342}}"; + sepNavIntBoundsRect = "{{0, 0}, {830, 10444}}"; + sepNavSelRange = "{7232, 12}"; + sepNavVisRect = "{{0, 3790}, {749, 470}}"; sepNavWindowFrame = "{{38, 157}, {797, 845}}"; }; }; @@ -170,9 +170,9 @@ }; 2C4D9C780CC9EC8C0031092D /* ULog.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {758, 3612}}"; + sepNavIntBoundsRect = "{{0, 0}, {758, 3668}}"; sepNavSelRange = "{6056, 0}"; - sepNavVisRect = "{{0, 2896}, {758, 716}}"; + sepNavVisRect = "{{0, 147}, {758, 716}}"; sepNavWindowFrame = "{{38, 157}, {797, 845}}"; }; }; @@ -194,9 +194,9 @@ }; 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {998, 15456}}"; - sepNavSelRange = "{7398, 0}"; - sepNavVisRect = "{{0, 3938}, {923, 342}}"; + sepNavIntBoundsRect = "{{0, 0}, {998, 15246}}"; + sepNavSelRange = "{7062, 8}"; + sepNavVisRect = "{{0, 3832}, {749, 470}}"; sepNavWindowFrame = "{{222, 91}, {1052, 743}}"; }; }; @@ -298,9 +298,9 @@ }; 2C4D9C890CC9EC8C0031092D /* USongs.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {950, 14686}}"; - sepNavSelRange = "{503, 0}"; - sepNavVisRect = "{{0, 2086}, {758, 716}}"; + sepNavIntBoundsRect = "{{0, 0}, {1052, 14686}}"; + sepNavSelRange = "{12734, 0}"; + sepNavVisRect = "{{0, 5934}, {758, 716}}"; sepNavWindowFrame = "{{84, 115}, {797, 845}}"; }; }; @@ -315,9 +315,9 @@ 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1730, 16002}}"; - sepNavSelRange = "{11873, 20}"; - sepNavVisRect = "{{0, 5189}, {577, 612}}"; - sepNavWindowFrame = "{{15, 282}, {616, 741}}"; + sepNavSelRange = "{36398, 0}"; + sepNavVisRect = "{{0, 3420}, {737, 826}}"; + sepNavWindowFrame = "{{15, 68}, {776, 955}}"; }; }; 2C4D9C8C0CC9EC8C0031092D /* UThemes.pas */ = { @@ -451,7 +451,7 @@ 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1268, 4788}}"; - sepNavSelRange = "{8020, 0}"; + sepNavSelRange = "{15613, 0}"; sepNavVisRect = "{{0, 1736}, {1013, 614}}"; sepNavWindowFrame = "{{15, 280}, {1052, 743}}"; }; @@ -503,6 +503,80 @@ sepNavWindowFrame = "{{15, 282}, {616, 741}}"; }; }; + 2C82F0E60CDFDBA000A79F26 /* USongs.pas:430 */ = { + isa = PBXFileBreakpoint; + actions = ( + ); + breakpointStyle = 0; + continueAfterActions = 0; + delayBeforeContinue = 0; + fileReference = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; + hitCount = 1; + lineNumber = 430; + location = UltraStarDX; + modificationTime = 215998015.652328; + state = 1; + }; + 2C82F12E0CDFDEA300A79F26 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; + name = "USongs.pas: 466"; + rLen = 0; + rLoc = 12734; + rType = 0; + vrLen = 1568; + vrLoc = 11360; + }; + 2C82F12F0CDFDEA300A79F26 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C620CC9EC8C0031092D /* TextGL.pas */; + name = "TextGL.pas: 116"; + rLen = 0; + rLoc = 2871; + rType = 0; + vrLen = 1468; + vrLoc = 10961; + }; + 2C82F1300CDFDEA300A79F26 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2CF3EF260CDE13BA004F5956 /* MacResources.pas */; + name = "MacResources.pas: 55"; + rLen = 0; + rLoc = 1218; + rType = 0; + vrLen = 2000; + vrLoc = 2591; + }; + 2CD986A80CDFDF790007B9C6 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; + name = "USongs.pas: 466"; + rLen = 0; + rLoc = 12734; + rType = 0; + vrLen = 1566; + vrLoc = 11360; + }; + 2CD986A90CDFDF790007B9C6 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C620CC9EC8C0031092D /* TextGL.pas */; + name = "TextGL.pas: 116"; + rLen = 0; + rLoc = 2871; + rType = 0; + vrLen = 1468; + vrLoc = 10961; + }; + 2CD986AA0CDFDF790007B9C6 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2CF3EF260CDE13BA004F5956 /* MacResources.pas */; + name = "MacResources.pas: 55"; + rLen = 0; + rLoc = 1218; + rType = 0; + vrLen = 2000; + vrLoc = 2591; + }; 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1013, 1022}}"; @@ -564,6 +638,7 @@ name = "Project Breakpoints"; objects = ( 2CDEA8080CBD7D920096994C /* UMain.pas:293 */, + 2C82F0E60CDFDBA000A79F26 /* USongs.pas:430 */, ); }; 2CDEA8080CBD7D920096994C /* UMain.pas:293 */ = { @@ -576,7 +651,8 @@ fileReference = 2CDD439C0CBBE92D00F364DE /* UMain.pas */; hitCount = 1; lineNumber = 293; - modificationTime = 215882409.953114; + location = UltraStarDX; + modificationTime = 215998014.007265; state = 1; }; 2CF3EF210CDE13A0004F5956 /* Messages.pas */ = { @@ -589,82 +665,12 @@ }; 2CF3EF260CDE13BA004F5956 /* MacResources.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1013, 1022}}"; - sepNavSelRange = "{1521, 0}"; - sepNavVisRect = "{{0, 310}, {1013, 614}}"; - sepNavWindowFrame = "{{515, 220}, {1052, 743}}"; + sepNavIntBoundsRect = "{{0, 0}, {834, 1750}}"; + sepNavSelRange = "{1218, 0}"; + sepNavVisRect = "{{0, 1120}, {834, 610}}"; + sepNavWindowFrame = "{{200, 248}, {873, 739}}"; }; }; - 2CF3EFEC0CDE1AB6004F5956 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2CF3EF260CDE13BA004F5956 /* MacResources.pas */; - name = "MacResources.pas: 60"; - rLen = 0; - rLoc = 1521; - rType = 0; - vrLen = 1339; - vrLoc = 455; - }; - 2CF3EFED0CDE1AB6004F5956 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; - name = "USongs.pas: 39"; - rLen = 0; - rLoc = 503; - rType = 0; - vrLen = 1403; - vrLoc = 4615; - }; - 2CF3EFEE0CDE1AB6004F5956 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; - name = "UAudio_FFMpeg.pas: 952"; - rLen = 0; - rLoc = 22697; - rType = 0; - vrLen = 1224; - vrLoc = 21473; - }; - 2CF3EFEF0CDE1AB6004F5956 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; - name = "nux ... is t"; - rLen = 12; - rLoc = 3202; - rType = 0; - vrLen = 1266; - vrLoc = 15619; - }; - 2CF3EFF00CDE1AB6004F5956 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; - name = "sdl_image.pas: 130"; - rLen = 0; - rLoc = 8020; - rType = 0; - vrLen = 832; - vrLoc = 7978; - }; - 2CF3EFF10CDE1AB6004F5956 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; - name = "sdl.pas: 250"; - rLen = 0; - rLoc = 16506; - rType = 0; - vrLen = 886; - vrLoc = 16376; - }; - 2CF3EFF20CDE1AB6004F5956 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; - name = "ScaledTexture(TexSur"; - rLen = 20; - rLoc = 11873; - rType = 0; - vrLen = 1184; - vrLoc = 11218; - }; 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1196, 19586}}"; @@ -1017,76 +1023,6 @@ sepNavWindowFrame = "{{38, 259}, {1052, 743}}"; }; }; - 2CF8E6C70CDFAAAB0053A996 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2CF3EF260CDE13BA004F5956 /* MacResources.pas */; - name = "MacResources.pas: 60"; - rLen = 0; - rLoc = 1521; - rType = 0; - vrLen = 1339; - vrLoc = 455; - }; - 2CF8E6C80CDFAAAB0053A996 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; - name = "USongs.pas: 39"; - rLen = 0; - rLoc = 503; - rType = 0; - vrLen = 1403; - vrLoc = 4615; - }; - 2CF8E6C90CDFAAAB0053A996 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; - name = "UAudio_FFMpeg.pas: 952"; - rLen = 0; - rLoc = 22697; - rType = 0; - vrLen = 1224; - vrLoc = 21473; - }; - 2CF8E6CA0CDFAAAB0053A996 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; - name = "nux ... is t"; - rLen = 12; - rLoc = 3202; - rType = 0; - vrLen = 1266; - vrLoc = 15619; - }; - 2CF8E6CB0CDFAAAB0053A996 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; - name = "sdl_image.pas: 130"; - rLen = 0; - rLoc = 8020; - rType = 0; - vrLen = 832; - vrLoc = 7978; - }; - 2CF8E6CC0CDFAAAB0053A996 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; - name = "sdl.pas: 250"; - rLen = 0; - rLoc = 16506; - rType = 0; - vrLen = 886; - vrLoc = 16376; - }; - 2CF8E6CD0CDFAAAB0053A996 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; - name = "TempSurface:=TexS"; - rLen = 20; - rLoc = 11873; - rType = 0; - vrLen = 1318; - vrLoc = 11176; - }; 9845B6590B1F9B9E0084DD62 /* SDL.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {948, 1330}}"; @@ -1098,7 +1034,7 @@ 98B8BE5C0B1F974F00162019 /* sdl.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1268, 58492}}"; - sepNavSelRange = "{16506, 0}"; + sepNavSelRange = "{157855, 0}"; sepNavVisRect = "{{0, 3444}, {948, 730}}"; sepNavWindowFrame = "{{211, 143}, {987, 859}}"; }; @@ -1124,6 +1060,7 @@ ); breakpoints = ( 2CDEA8080CBD7D920096994C /* UMain.pas:293 */, + 2C82F0E60CDFDBA000A79F26 /* USongs.pas:430 */, ); breakpointsGroup = 2CDD4B7F0CB9394600549FAC /* XCBreakpointsBucket */; codeSenseManager = 2CDD4B6A0CB9357000549FAC /* Code sense */; @@ -1229,24 +1166,16 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 215983788; - PBXWorkspaceStateSaveDate = 215983788; + PBXPerProjectTemplateStateSaveDate = 215998180; + PBXWorkspaceStateSaveDate = 215998180; }; perUserProjectItems = { - 2CF3EFEC0CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFEC0CDE1AB6004F5956 /* PBXTextBookmark */; - 2CF3EFED0CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFED0CDE1AB6004F5956 /* PBXTextBookmark */; - 2CF3EFEE0CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFEE0CDE1AB6004F5956 /* PBXTextBookmark */; - 2CF3EFEF0CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFEF0CDE1AB6004F5956 /* PBXTextBookmark */; - 2CF3EFF00CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFF00CDE1AB6004F5956 /* PBXTextBookmark */; - 2CF3EFF10CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFF10CDE1AB6004F5956 /* PBXTextBookmark */; - 2CF3EFF20CDE1AB6004F5956 /* PBXTextBookmark */ = 2CF3EFF20CDE1AB6004F5956 /* PBXTextBookmark */; - 2CF8E6C70CDFAAAB0053A996 /* PBXTextBookmark */ = 2CF8E6C70CDFAAAB0053A996 /* PBXTextBookmark */; - 2CF8E6C80CDFAAAB0053A996 /* PBXTextBookmark */ = 2CF8E6C80CDFAAAB0053A996 /* PBXTextBookmark */; - 2CF8E6C90CDFAAAB0053A996 /* PBXTextBookmark */ = 2CF8E6C90CDFAAAB0053A996 /* PBXTextBookmark */; - 2CF8E6CA0CDFAAAB0053A996 /* PBXTextBookmark */ = 2CF8E6CA0CDFAAAB0053A996 /* PBXTextBookmark */; - 2CF8E6CB0CDFAAAB0053A996 /* PBXTextBookmark */ = 2CF8E6CB0CDFAAAB0053A996 /* PBXTextBookmark */; - 2CF8E6CC0CDFAAAB0053A996 /* PBXTextBookmark */ = 2CF8E6CC0CDFAAAB0053A996 /* PBXTextBookmark */; - 2CF8E6CD0CDFAAAB0053A996 /* PBXTextBookmark */ = 2CF8E6CD0CDFAAAB0053A996 /* PBXTextBookmark */; + 2C82F12E0CDFDEA300A79F26 /* PBXTextBookmark */ = 2C82F12E0CDFDEA300A79F26 /* PBXTextBookmark */; + 2C82F12F0CDFDEA300A79F26 /* PBXTextBookmark */ = 2C82F12F0CDFDEA300A79F26 /* PBXTextBookmark */; + 2C82F1300CDFDEA300A79F26 /* PBXTextBookmark */ = 2C82F1300CDFDEA300A79F26 /* PBXTextBookmark */; + 2CD986A80CDFDF790007B9C6 /* PBXTextBookmark */ = 2CD986A80CDFDF790007B9C6 /* PBXTextBookmark */; + 2CD986A90CDFDF790007B9C6 /* PBXTextBookmark */ = 2CD986A90CDFDF790007B9C6 /* PBXTextBookmark */; + 2CD986AA0CDFDF790007B9C6 /* PBXTextBookmark */ = 2CD986AA0CDFDF790007B9C6 /* PBXTextBookmark */; }; sourceControlManager = 2CDD4B690CB9357000549FAC /* Source Control */; userBuildSettings = { diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj index 38736234..8495963a 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj @@ -361,140 +361,140 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 2C4D9C620CC9EC8C0031092D /* TextGL.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = TextGL.pas; path = ../Classes/TextGL.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UAudio_bass.pas; path = ../Classes/UAudio_bass.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UAudio_FFMpeg.pas; path = ../Classes/UAudio_FFMpeg.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C650CC9EC8C0031092D /* UCatCovers.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UCatCovers.pas; path = ../Classes/UCatCovers.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C660CC9EC8C0031092D /* UCommandLine.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UCommandLine.pas; path = ../Classes/UCommandLine.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C670CC9EC8C0031092D /* UCommon.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UCommon.pas; path = ../Classes/UCommon.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C680CC9EC8C0031092D /* UCore.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UCore.pas; path = ../Classes/UCore.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C690CC9EC8C0031092D /* UCoreModule.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UCoreModule.pas; path = ../Classes/UCoreModule.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C6A0CC9EC8C0031092D /* UCovers.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UCovers.pas; path = ../Classes/UCovers.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C6B0CC9EC8C0031092D /* UDataBase.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UDataBase.pas; path = ../Classes/UDataBase.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C6C0CC9EC8C0031092D /* UDLLManager.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UDLLManager.pas; path = ../Classes/UDLLManager.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C6D0CC9EC8C0031092D /* UDraw.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UDraw.pas; path = ../Classes/UDraw.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C6E0CC9EC8C0031092D /* UFiles.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UFiles.pas; path = ../Classes/UFiles.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C6F0CC9EC8C0031092D /* UGraphic.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UGraphic.pas; path = ../Classes/UGraphic.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C700CC9EC8C0031092D /* UGraphicClasses.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UGraphicClasses.pas; path = ../Classes/UGraphicClasses.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C710CC9EC8C0031092D /* UHooks.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UHooks.pas; path = ../Classes/UHooks.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C720CC9EC8C0031092D /* UIni.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UIni.pas; path = ../Classes/UIni.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C730CC9EC8C0031092D /* UJoystick.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UJoystick.pas; path = ../Classes/UJoystick.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C740CC9EC8C0031092D /* ULanguage.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = ULanguage.pas; path = ../Classes/ULanguage.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C760CC9EC8C0031092D /* ULCD.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = ULCD.pas; path = ../Classes/ULCD.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C770CC9EC8C0031092D /* ULight.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = ULight.pas; path = ../Classes/ULight.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C780CC9EC8C0031092D /* ULog.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = ULog.pas; path = ../Classes/ULog.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C790CC9EC8C0031092D /* ULyrics_bak.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = ULyrics_bak.pas; path = ../Classes/ULyrics_bak.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C7A0CC9EC8C0031092D /* ULyrics.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = ULyrics.pas; path = ../Classes/ULyrics.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMain.pas; path = ../Classes/UMain.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C7C0CC9EC8C0031092D /* UMedia_dummy.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMedia_dummy.pas; path = ../Classes/UMedia_dummy.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C7D0CC9EC8C0031092D /* UModules.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UModules.pas; path = ../Classes/UModules.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C7E0CC9EC8C0031092D /* UMusic.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMusic.pas; path = ../Classes/UMusic.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C7F0CC9EC8C0031092D /* UParty.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UParty.pas; path = ../Classes/UParty.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C800CC9EC8C0031092D /* UPlaylist.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UPlaylist.pas; path = ../Classes/UPlaylist.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C820CC9EC8C0031092D /* UPluginInterface.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UPluginInterface.pas; path = ../Classes/UPluginInterface.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C830CC9EC8C0031092D /* uPluginLoader.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = uPluginLoader.pas; path = ../Classes/uPluginLoader.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C840CC9EC8C0031092D /* URecord.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = URecord.pas; path = ../Classes/URecord.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C850CC9EC8C0031092D /* UServices.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UServices.pas; path = ../Classes/UServices.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C860CC9EC8C0031092D /* USingNotes.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = USingNotes.pas; path = ../Classes/USingNotes.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C870CC9EC8C0031092D /* USingScores.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = USingScores.pas; path = ../Classes/USingScores.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C880CC9EC8C0031092D /* USkins.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = USkins.pas; path = ../Classes/USkins.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C890CC9EC8C0031092D /* USongs.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = USongs.pas; path = ../Classes/USongs.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C8A0CC9EC8C0031092D /* UTextClasses.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UTextClasses.pas; path = ../Classes/UTextClasses.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UTexture.pas; path = ../Classes/UTexture.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C8C0CC9EC8C0031092D /* UThemes.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UThemes.pas; path = ../Classes/UThemes.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C8D0CC9EC8C0031092D /* UTime.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UTime.pas; path = ../Classes/UTime.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9C8E0CC9EC8C0031092D /* UVideo.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UVideo.pas; path = ../Classes/UVideo.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9C620CC9EC8C0031092D /* TextGL.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = TextGL.pas; path = ../Classes/TextGL.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UAudio_bass.pas; path = ../Classes/UAudio_bass.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UAudio_FFMpeg.pas; path = ../Classes/UAudio_FFMpeg.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C650CC9EC8C0031092D /* UCatCovers.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UCatCovers.pas; path = ../Classes/UCatCovers.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C660CC9EC8C0031092D /* UCommandLine.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UCommandLine.pas; path = ../Classes/UCommandLine.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C670CC9EC8C0031092D /* UCommon.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UCommon.pas; path = ../Classes/UCommon.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C680CC9EC8C0031092D /* UCore.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UCore.pas; path = ../Classes/UCore.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C690CC9EC8C0031092D /* UCoreModule.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UCoreModule.pas; path = ../Classes/UCoreModule.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C6A0CC9EC8C0031092D /* UCovers.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UCovers.pas; path = ../Classes/UCovers.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C6B0CC9EC8C0031092D /* UDataBase.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UDataBase.pas; path = ../Classes/UDataBase.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C6C0CC9EC8C0031092D /* UDLLManager.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UDLLManager.pas; path = ../Classes/UDLLManager.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C6D0CC9EC8C0031092D /* UDraw.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UDraw.pas; path = ../Classes/UDraw.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C6E0CC9EC8C0031092D /* UFiles.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UFiles.pas; path = ../Classes/UFiles.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C6F0CC9EC8C0031092D /* UGraphic.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UGraphic.pas; path = ../Classes/UGraphic.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C700CC9EC8C0031092D /* UGraphicClasses.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UGraphicClasses.pas; path = ../Classes/UGraphicClasses.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C710CC9EC8C0031092D /* UHooks.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UHooks.pas; path = ../Classes/UHooks.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C720CC9EC8C0031092D /* UIni.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UIni.pas; path = ../Classes/UIni.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C730CC9EC8C0031092D /* UJoystick.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UJoystick.pas; path = ../Classes/UJoystick.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C740CC9EC8C0031092D /* ULanguage.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = ULanguage.pas; path = ../Classes/ULanguage.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C760CC9EC8C0031092D /* ULCD.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = ULCD.pas; path = ../Classes/ULCD.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C770CC9EC8C0031092D /* ULight.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = ULight.pas; path = ../Classes/ULight.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C780CC9EC8C0031092D /* ULog.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = ULog.pas; path = ../Classes/ULog.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C790CC9EC8C0031092D /* ULyrics_bak.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = ULyrics_bak.pas; path = ../Classes/ULyrics_bak.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C7A0CC9EC8C0031092D /* ULyrics.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = ULyrics.pas; path = ../Classes/ULyrics.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UMain.pas; path = ../Classes/UMain.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C7C0CC9EC8C0031092D /* UMedia_dummy.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UMedia_dummy.pas; path = ../Classes/UMedia_dummy.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C7D0CC9EC8C0031092D /* UModules.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UModules.pas; path = ../Classes/UModules.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C7E0CC9EC8C0031092D /* UMusic.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UMusic.pas; path = ../Classes/UMusic.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C7F0CC9EC8C0031092D /* UParty.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UParty.pas; path = ../Classes/UParty.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C800CC9EC8C0031092D /* UPlaylist.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UPlaylist.pas; path = ../Classes/UPlaylist.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C820CC9EC8C0031092D /* UPluginInterface.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UPluginInterface.pas; path = ../Classes/UPluginInterface.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C830CC9EC8C0031092D /* uPluginLoader.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = uPluginLoader.pas; path = ../Classes/uPluginLoader.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C840CC9EC8C0031092D /* URecord.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = URecord.pas; path = ../Classes/URecord.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C850CC9EC8C0031092D /* UServices.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UServices.pas; path = ../Classes/UServices.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C860CC9EC8C0031092D /* USingNotes.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = USingNotes.pas; path = ../Classes/USingNotes.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C870CC9EC8C0031092D /* USingScores.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = USingScores.pas; path = ../Classes/USingScores.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C880CC9EC8C0031092D /* USkins.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = USkins.pas; path = ../Classes/USkins.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C890CC9EC8C0031092D /* USongs.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = USongs.pas; path = ../Classes/USongs.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C8A0CC9EC8C0031092D /* UTextClasses.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UTextClasses.pas; path = ../Classes/UTextClasses.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UTexture.pas; path = ../Classes/UTexture.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C8C0CC9EC8C0031092D /* UThemes.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UThemes.pas; path = ../Classes/UThemes.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C8D0CC9EC8C0031092D /* UTime.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UTime.pas; path = ../Classes/UTime.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C8E0CC9EC8C0031092D /* UVideo.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UVideo.pas; path = ../Classes/UVideo.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4D9CE90CC9ECB50031092D /* libbass.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbass.dylib; path = ../lib/bass/libbass.dylib; sourceTree = SOURCE_ROOT; }; - 2C4D9D8D0CC9ED230031092D /* Bass.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = Bass.pas; path = ../lib/bass/MacOSX/Bass.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9D900CC9ED4F0031092D /* FreeBitmap.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = FreeBitmap.pas; path = ../lib/FreeImage/FreeBitmap.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9D910CC9ED4F0031092D /* FreeImage.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = FreeImage.pas; path = ../lib/FreeImage/FreeImage.pas; sourceTree = SOURCE_ROOT; }; + 2C4D9D8D0CC9ED230031092D /* Bass.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = Bass.pas; path = ../lib/bass/MacOSX/Bass.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9D900CC9ED4F0031092D /* FreeBitmap.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = FreeBitmap.pas; path = ../lib/FreeImage/FreeBitmap.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9D910CC9ED4F0031092D /* FreeImage.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = FreeImage.pas; path = ../lib/FreeImage/FreeImage.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4D9D960CC9EDEB0031092D /* libfreeimage.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libfreeimage.dylib; path = ../lib/FreeImage/libfreeimage.dylib; sourceTree = SOURCE_ROOT; }; 2C4D9D980CC9EE0B0031092D /* SDL_image.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL_image.framework; path = /Library/Frameworks/SDL_image.framework; sourceTree = ""; }; 2C4D9D990CC9EE0B0031092D /* SDL_ttf.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL_ttf.framework; path = /Library/Frameworks/SDL_ttf.framework; sourceTree = ""; }; - 2C4D9DCC0CC9EE6F0031092D /* UDisplay.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UDisplay.pas; path = ../Menu/UDisplay.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9DCD0CC9EE6F0031092D /* UDrawTexture.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UDrawTexture.pas; path = ../Menu/UDrawTexture.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9DCE0CC9EE6F0031092D /* UMenu.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMenu.pas; path = ../Menu/UMenu.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9DCF0CC9EE6F0031092D /* UMenuButton.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMenuButton.pas; path = ../Menu/UMenuButton.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9DD00CC9EE6F0031092D /* UMenuButtonCollection.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMenuButtonCollection.pas; path = ../Menu/UMenuButtonCollection.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9DD10CC9EE6F0031092D /* UMenuInteract.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMenuInteract.pas; path = ../Menu/UMenuInteract.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9DD20CC9EE6F0031092D /* UMenuSelect.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMenuSelect.pas; path = ../Menu/UMenuSelect.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9DD30CC9EE6F0031092D /* UMenuSelectSlide.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMenuSelectSlide.pas; path = ../Menu/UMenuSelectSlide.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9DD40CC9EE6F0031092D /* UMenuStatic.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMenuStatic.pas; path = ../Menu/UMenuStatic.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9DD50CC9EE6F0031092D /* UMenuText.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UMenuText.pas; path = ../Menu/UMenuText.pas; sourceTree = SOURCE_ROOT; }; - 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = sdl_image.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL_image/sdl_image.pas"; sourceTree = ""; }; - 2C4D9DEF0CC9EF210031092D /* sdl_ttf.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = sdl_ttf.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL_ttf/sdl_ttf.pas"; sourceTree = ""; }; - 2C4D9DF00CC9EF210031092D /* sdltruetypefont.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = sdltruetypefont.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL_ttf/sdltruetypefont.pas"; sourceTree = ""; }; - 2C4D9E000CC9EF840031092D /* Graphics.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = Graphics.pas; path = Wrapper/Graphics.pas; sourceTree = ""; }; - 2C4D9E010CC9EF840031092D /* JPEG.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = JPEG.pas; path = Wrapper/JPEG.pas; sourceTree = ""; }; - 2C4D9E040CC9EF840031092D /* OpenGL12.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = OpenGL12.pas; path = Wrapper/OpenGL12.pas; sourceTree = ""; }; - 2C4D9E090CC9EF840031092D /* Windows.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = Windows.pas; path = Wrapper/Windows.pas; sourceTree = ""; }; - 2C4D9E440CC9F0ED0031092D /* switches.inc */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = switches.inc; path = ../switches.inc; sourceTree = SOURCE_ROOT; }; + 2C4D9DCC0CC9EE6F0031092D /* UDisplay.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UDisplay.pas; path = ../Menu/UDisplay.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9DCD0CC9EE6F0031092D /* UDrawTexture.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UDrawTexture.pas; path = ../Menu/UDrawTexture.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9DCE0CC9EE6F0031092D /* UMenu.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UMenu.pas; path = ../Menu/UMenu.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9DCF0CC9EE6F0031092D /* UMenuButton.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UMenuButton.pas; path = ../Menu/UMenuButton.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9DD00CC9EE6F0031092D /* UMenuButtonCollection.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UMenuButtonCollection.pas; path = ../Menu/UMenuButtonCollection.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9DD10CC9EE6F0031092D /* UMenuInteract.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UMenuInteract.pas; path = ../Menu/UMenuInteract.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9DD20CC9EE6F0031092D /* UMenuSelect.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UMenuSelect.pas; path = ../Menu/UMenuSelect.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9DD30CC9EE6F0031092D /* UMenuSelectSlide.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UMenuSelectSlide.pas; path = ../Menu/UMenuSelectSlide.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9DD40CC9EE6F0031092D /* UMenuStatic.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UMenuStatic.pas; path = ../Menu/UMenuStatic.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9DD50CC9EE6F0031092D /* UMenuText.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UMenuText.pas; path = ../Menu/UMenuText.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = sdl_image.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL_image/sdl_image.pas"; sourceTree = ""; tabWidth = 2; }; + 2C4D9DEF0CC9EF210031092D /* sdl_ttf.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = sdl_ttf.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL_ttf/sdl_ttf.pas"; sourceTree = ""; tabWidth = 2; }; + 2C4D9DF00CC9EF210031092D /* sdltruetypefont.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = sdltruetypefont.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL_ttf/sdltruetypefont.pas"; sourceTree = ""; tabWidth = 2; }; + 2C4D9E000CC9EF840031092D /* Graphics.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = Graphics.pas; path = Wrapper/Graphics.pas; sourceTree = ""; tabWidth = 2; }; + 2C4D9E010CC9EF840031092D /* JPEG.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = JPEG.pas; path = Wrapper/JPEG.pas; sourceTree = ""; tabWidth = 2; }; + 2C4D9E040CC9EF840031092D /* OpenGL12.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = OpenGL12.pas; path = Wrapper/OpenGL12.pas; sourceTree = ""; tabWidth = 2; }; + 2C4D9E090CC9EF840031092D /* Windows.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = Windows.pas; path = Wrapper/Windows.pas; sourceTree = ""; tabWidth = 2; }; + 2C4D9E440CC9F0ED0031092D /* switches.inc */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = switches.inc; path = ../switches.inc; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4FA2A70CDBAD1E002CC3B0 /* ustar-icon_v01.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = "ustar-icon_v01.icns"; path = "../../Graphics/ustar-icon_v01.icns"; sourceTree = SOURCE_ROOT; }; - 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = StrUtils.pas; path = ../../../Modis/SDK/StrUtils.pas; sourceTree = SOURCE_ROOT; }; + 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = StrUtils.pas; path = ../../../Modis/SDK/StrUtils.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2CDEA4F60CBD725B0096994C /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; - 2CF3EF210CDE13A0004F5956 /* Messages.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = Messages.pas; path = Wrapper/Messages.pas; sourceTree = ""; }; - 2CF3EF260CDE13BA004F5956 /* MacResources.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = MacResources.pas; path = Wrapper/MacResources.pas; sourceTree = ""; }; - 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenCredits.pas; path = ../Screens/UScreenCredits.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F440CDA1B2B00627463 /* UScreenEdit.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenEdit.pas; path = ../Screens/UScreenEdit.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F450CDA1B2B00627463 /* UScreenEditConvert.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenEditConvert.pas; path = ../Screens/UScreenEditConvert.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F460CDA1B2B00627463 /* UScreenEditHeader.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenEditHeader.pas; path = ../Screens/UScreenEditHeader.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F470CDA1B2B00627463 /* UScreenEditSub.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenEditSub.pas; path = ../Screens/UScreenEditSub.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F480CDA1B2B00627463 /* UScreenLevel.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenLevel.pas; path = ../Screens/UScreenLevel.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F490CDA1B2B00627463 /* UScreenLoading.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenLoading.pas; path = ../Screens/UScreenLoading.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F4A0CDA1B2B00627463 /* UScreenMain.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenMain.pas; path = ../Screens/UScreenMain.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F4B0CDA1B2B00627463 /* UScreenName.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenName.pas; path = ../Screens/UScreenName.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F4C0CDA1B2B00627463 /* UScreenOpen.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenOpen.pas; path = ../Screens/UScreenOpen.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F4D0CDA1B2B00627463 /* UScreenOptions.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenOptions.pas; path = ../Screens/UScreenOptions.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F4E0CDA1B2B00627463 /* UScreenOptionsAdvanced.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenOptionsAdvanced.pas; path = ../Screens/UScreenOptionsAdvanced.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F4F0CDA1B2B00627463 /* UScreenOptionsGame.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenOptionsGame.pas; path = ../Screens/UScreenOptionsGame.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F500CDA1B2B00627463 /* UScreenOptionsGraphics.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenOptionsGraphics.pas; path = ../Screens/UScreenOptionsGraphics.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F510CDA1B2B00627463 /* UScreenOptionsLyrics.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenOptionsLyrics.pas; path = ../Screens/UScreenOptionsLyrics.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F520CDA1B2B00627463 /* UScreenOptionsRecord.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenOptionsRecord.pas; path = ../Screens/UScreenOptionsRecord.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F530CDA1B2B00627463 /* UScreenOptionsSound.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenOptionsSound.pas; path = ../Screens/UScreenOptionsSound.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F540CDA1B2B00627463 /* UScreenOptionsThemes.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenOptionsThemes.pas; path = ../Screens/UScreenOptionsThemes.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F550CDA1B2B00627463 /* UScreenPartyNewRound.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenPartyNewRound.pas; path = ../Screens/UScreenPartyNewRound.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F560CDA1B2B00627463 /* UScreenPartyOptions.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenPartyOptions.pas; path = ../Screens/UScreenPartyOptions.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F570CDA1B2B00627463 /* UScreenPartyPlayer.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenPartyPlayer.pas; path = ../Screens/UScreenPartyPlayer.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F580CDA1B2B00627463 /* UScreenPartyScore.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenPartyScore.pas; path = ../Screens/UScreenPartyScore.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F590CDA1B2B00627463 /* UScreenPartyWin.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenPartyWin.pas; path = ../Screens/UScreenPartyWin.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F5A0CDA1B2B00627463 /* UScreenPopup.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenPopup.pas; path = ../Screens/UScreenPopup.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F5B0CDA1B2B00627463 /* UScreenScore.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenScore.pas; path = ../Screens/UScreenScore.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F5C0CDA1B2B00627463 /* UScreenSing.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenSing.pas; path = ../Screens/UScreenSing.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F5D0CDA1B2B00627463 /* UScreenSingModi.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenSingModi.pas; path = ../Screens/UScreenSingModi.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F5E0CDA1B2B00627463 /* UScreenSong.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenSong.pas; path = ../Screens/UScreenSong.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F5F0CDA1B2B00627463 /* UScreenSongJumpto.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenSongJumpto.pas; path = ../Screens/UScreenSongJumpto.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F600CDA1B2B00627463 /* UScreenSongMenu.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenSongMenu.pas; path = ../Screens/UScreenSongMenu.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F610CDA1B2B00627463 /* UScreenStatDetail.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenStatDetail.pas; path = ../Screens/UScreenStatDetail.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F620CDA1B2B00627463 /* UScreenStatMain.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenStatMain.pas; path = ../Screens/UScreenStatMain.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F630CDA1B2B00627463 /* UScreenTop5.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenTop5.pas; path = ../Screens/UScreenTop5.pas; sourceTree = SOURCE_ROOT; }; - 2CF54F640CDA1B2B00627463 /* UScreenWelcome.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UScreenWelcome.pas; path = ../Screens/UScreenWelcome.pas; sourceTree = SOURCE_ROOT; }; - 2CF5508B0CDA22B000627463 /* ModiSDK.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = ModiSDK.pas; path = ../../../Modis/SDK/ModiSDK.pas; sourceTree = SOURCE_ROOT; }; - 2CF5510E0CDA293700627463 /* SQLite3.pas */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.pascal; name = SQLite3.pas; path = ../lib/SQLite/SQLite3.pas; sourceTree = SOURCE_ROOT; }; - 2CF5510F0CDA293700627463 /* SQLiteTable3.pas */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.pascal; name = SQLiteTable3.pas; path = ../lib/SQLite/SQLiteTable3.pas; sourceTree = SOURCE_ROOT; }; + 2CF3EF210CDE13A0004F5956 /* Messages.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = Messages.pas; path = Wrapper/Messages.pas; sourceTree = ""; tabWidth = 2; }; + 2CF3EF260CDE13BA004F5956 /* MacResources.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = MacResources.pas; path = Wrapper/MacResources.pas; sourceTree = ""; tabWidth = 2; }; + 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenCredits.pas; path = ../Screens/UScreenCredits.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F440CDA1B2B00627463 /* UScreenEdit.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenEdit.pas; path = ../Screens/UScreenEdit.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F450CDA1B2B00627463 /* UScreenEditConvert.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenEditConvert.pas; path = ../Screens/UScreenEditConvert.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F460CDA1B2B00627463 /* UScreenEditHeader.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenEditHeader.pas; path = ../Screens/UScreenEditHeader.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F470CDA1B2B00627463 /* UScreenEditSub.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenEditSub.pas; path = ../Screens/UScreenEditSub.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F480CDA1B2B00627463 /* UScreenLevel.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenLevel.pas; path = ../Screens/UScreenLevel.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F490CDA1B2B00627463 /* UScreenLoading.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenLoading.pas; path = ../Screens/UScreenLoading.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F4A0CDA1B2B00627463 /* UScreenMain.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenMain.pas; path = ../Screens/UScreenMain.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F4B0CDA1B2B00627463 /* UScreenName.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenName.pas; path = ../Screens/UScreenName.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F4C0CDA1B2B00627463 /* UScreenOpen.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenOpen.pas; path = ../Screens/UScreenOpen.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F4D0CDA1B2B00627463 /* UScreenOptions.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenOptions.pas; path = ../Screens/UScreenOptions.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F4E0CDA1B2B00627463 /* UScreenOptionsAdvanced.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenOptionsAdvanced.pas; path = ../Screens/UScreenOptionsAdvanced.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F4F0CDA1B2B00627463 /* UScreenOptionsGame.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenOptionsGame.pas; path = ../Screens/UScreenOptionsGame.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F500CDA1B2B00627463 /* UScreenOptionsGraphics.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenOptionsGraphics.pas; path = ../Screens/UScreenOptionsGraphics.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F510CDA1B2B00627463 /* UScreenOptionsLyrics.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenOptionsLyrics.pas; path = ../Screens/UScreenOptionsLyrics.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F520CDA1B2B00627463 /* UScreenOptionsRecord.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenOptionsRecord.pas; path = ../Screens/UScreenOptionsRecord.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F530CDA1B2B00627463 /* UScreenOptionsSound.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenOptionsSound.pas; path = ../Screens/UScreenOptionsSound.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F540CDA1B2B00627463 /* UScreenOptionsThemes.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenOptionsThemes.pas; path = ../Screens/UScreenOptionsThemes.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F550CDA1B2B00627463 /* UScreenPartyNewRound.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenPartyNewRound.pas; path = ../Screens/UScreenPartyNewRound.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F560CDA1B2B00627463 /* UScreenPartyOptions.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenPartyOptions.pas; path = ../Screens/UScreenPartyOptions.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F570CDA1B2B00627463 /* UScreenPartyPlayer.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenPartyPlayer.pas; path = ../Screens/UScreenPartyPlayer.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F580CDA1B2B00627463 /* UScreenPartyScore.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenPartyScore.pas; path = ../Screens/UScreenPartyScore.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F590CDA1B2B00627463 /* UScreenPartyWin.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenPartyWin.pas; path = ../Screens/UScreenPartyWin.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F5A0CDA1B2B00627463 /* UScreenPopup.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenPopup.pas; path = ../Screens/UScreenPopup.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F5B0CDA1B2B00627463 /* UScreenScore.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenScore.pas; path = ../Screens/UScreenScore.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F5C0CDA1B2B00627463 /* UScreenSing.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenSing.pas; path = ../Screens/UScreenSing.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F5D0CDA1B2B00627463 /* UScreenSingModi.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenSingModi.pas; path = ../Screens/UScreenSingModi.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F5E0CDA1B2B00627463 /* UScreenSong.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenSong.pas; path = ../Screens/UScreenSong.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F5F0CDA1B2B00627463 /* UScreenSongJumpto.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenSongJumpto.pas; path = ../Screens/UScreenSongJumpto.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F600CDA1B2B00627463 /* UScreenSongMenu.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenSongMenu.pas; path = ../Screens/UScreenSongMenu.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F610CDA1B2B00627463 /* UScreenStatDetail.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenStatDetail.pas; path = ../Screens/UScreenStatDetail.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F620CDA1B2B00627463 /* UScreenStatMain.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenStatMain.pas; path = ../Screens/UScreenStatMain.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F630CDA1B2B00627463 /* UScreenTop5.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenTop5.pas; path = ../Screens/UScreenTop5.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF54F640CDA1B2B00627463 /* UScreenWelcome.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenWelcome.pas; path = ../Screens/UScreenWelcome.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF5508B0CDA22B000627463 /* ModiSDK.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = ModiSDK.pas; path = ../../../Modis/SDK/ModiSDK.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF5510E0CDA293700627463 /* SQLite3.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = SQLite3.pas; path = ../lib/SQLite/SQLite3.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF5510F0CDA293700627463 /* SQLiteTable3.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = SQLiteTable3.pas; path = ../lib/SQLite/SQLiteTable3.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2CF5512C0CDA29C600627463 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = ../lib/SQLite/libsqlite3.dylib; sourceTree = SOURCE_ROOT; }; - 2CF551A70CDA356800627463 /* UltraStar.dpr */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; name = UltraStar.dpr; path = ../UltraStar.dpr; sourceTree = SOURCE_ROOT; }; - 2CF552110CDA3D1400627463 /* UPluginDefs.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UPluginDefs.pas; path = ../../../Modis/SDK/UPluginDefs.pas; sourceTree = SOURCE_ROOT; }; - 2CF5529E0CDA42C900627463 /* avcodec.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = avcodec.pas; path = ../lib/ffmpeg/avcodec.pas; sourceTree = SOURCE_ROOT; }; - 2CF5529F0CDA42C900627463 /* avformat.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = avformat.pas; path = ../lib/ffmpeg/avformat.pas; sourceTree = SOURCE_ROOT; }; - 2CF552A00CDA42C900627463 /* avio.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = avio.pas; path = ../lib/ffmpeg/avio.pas; sourceTree = SOURCE_ROOT; }; - 2CF552A10CDA42C900627463 /* avutil.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = avutil.pas; path = ../lib/ffmpeg/avutil.pas; sourceTree = SOURCE_ROOT; }; - 2CF552A40CDA42C900627463 /* opt.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = opt.pas; path = ../lib/ffmpeg/opt.pas; sourceTree = SOURCE_ROOT; }; - 2CF552A50CDA42C900627463 /* rational.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = rational.pas; path = ../lib/ffmpeg/rational.pas; sourceTree = SOURCE_ROOT; }; + 2CF551A70CDA356800627463 /* UltraStar.dpr */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = text; name = UltraStar.dpr; path = ../UltraStar.dpr; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF552110CDA3D1400627463 /* UPluginDefs.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UPluginDefs.pas; path = ../../../Modis/SDK/UPluginDefs.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF5529E0CDA42C900627463 /* avcodec.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = avcodec.pas; path = ../lib/ffmpeg/avcodec.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF5529F0CDA42C900627463 /* avformat.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = avformat.pas; path = ../lib/ffmpeg/avformat.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF552A00CDA42C900627463 /* avio.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = avio.pas; path = ../lib/ffmpeg/avio.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF552A10CDA42C900627463 /* avutil.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = avutil.pas; path = ../lib/ffmpeg/avutil.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF552A40CDA42C900627463 /* opt.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = opt.pas; path = ../lib/ffmpeg/opt.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CF552A50CDA42C900627463 /* rational.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = rational.pas; path = ../lib/ffmpeg/rational.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2CF552BF0CDA4B7B00627463 /* libavcodec.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libavcodec.dylib; path = ../lib/ffmpeg/libavcodec.dylib; sourceTree = SOURCE_ROOT; }; 2CF552C00CDA4B7B00627463 /* libavformat.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libavformat.dylib; path = ../lib/ffmpeg/libavformat.dylib; sourceTree = SOURCE_ROOT; }; 2CF552C10CDA4B7B00627463 /* libavutil.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libavutil.dylib; path = ../lib/ffmpeg/libavutil.dylib; sourceTree = SOURCE_ROOT; }; 2CF552C20CDA4B7B00627463 /* libmp3lame.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libmp3lame.dylib; path = ../lib/ffmpeg/libmp3lame.dylib; sourceTree = SOURCE_ROOT; }; - 2CF553070CDA51B500627463 /* sdlutils.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = sdlutils.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL/sdlutils.pas"; sourceTree = ""; }; - 2CF8E6BD0CDFA8E80053A996 /* UPartyDefs.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UPartyDefs.pas; path = ../../../Modis/SDK/UPartyDefs.pas; sourceTree = SOURCE_ROOT; }; + 2CF553070CDA51B500627463 /* sdlutils.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = sdlutils.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL/sdlutils.pas"; sourceTree = ""; tabWidth = 2; }; + 2CF8E6BD0CDFA8E80053A996 /* UPartyDefs.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UPartyDefs.pas; path = ../../../Modis/SDK/UPartyDefs.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 9845B6590B1F9B9E0084DD62 /* SDL.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL.h; path = /Library/Frameworks/SDL.framework/Versions/A/Headers/SDL.h; sourceTree = ""; }; 98B8BE330B1F947800162019 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 98B8BE370B1F949C00162019 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 98B8BE380B1F949C00162019 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 98B8BE570B1F972400162019 /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL.framework; path = /Library/Frameworks/SDL.framework; sourceTree = ""; }; - 98B8BE5C0B1F974F00162019 /* sdl.pas */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.pascal; name = sdl.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL/sdl.pas"; sourceTree = ""; }; + 98B8BE5C0B1F974F00162019 /* sdl.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = sdl.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL/sdl.pas"; sourceTree = ""; tabWidth = 2; }; 98B8BE750B1F97F800162019 /* SDLMain.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = SDLMain.m; path = "/Library/Frameworks/JEDI-SDL.framework/SDL/SDLMain.m"; sourceTree = ""; }; DD37F2430A60255800975B2D /* libfpcrtl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libfpcrtl.a; sourceTree = BUILT_PRODUCTS_DIR; }; - DDC6851B09F57195004E4BFF /* UltraStarDX.pas */ = {isa = PBXFileReference; fileEncoding = 12; lastKnownFileType = sourcecode.pascal; path = UltraStarDX.pas; sourceTree = ""; }; + DDC6851B09F57195004E4BFF /* UltraStarDX.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; path = UltraStarDX.pas; sourceTree = ""; tabWidth = 2; }; DDC6868B09F571C2004E4BFF /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 12; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; DDC688C809F574E9004E4BFF /* UltraStarDX.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UltraStarDX.app; sourceTree = BUILT_PRODUCTS_DIR; }; DDC688CA09F574E9004E4BFF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; diff --git a/Game/Code/MacOSX/Wrapper/MacResources.pas b/Game/Code/MacOSX/Wrapper/MacResources.pas index d408a432..a97fb565 100755 --- a/Game/Code/MacOSX/Wrapper/MacResources.pas +++ b/Game/Code/MacOSX/Wrapper/MacResources.pas @@ -47,25 +47,77 @@ var sFileName : String; begin sResNameLower := LowerCase(string(ResName)); - - if sResNameLower = 'font' then - sFileName := GetResourcesPath + 'Fonts/Normal/Font Normal 16.png' - else if sResNameLower = 'fontb' then - sFileName := GetResourcesPath + 'Fonts/Bold/Font 1024 Bold 16.png' - else if sResNameLower = 'fonto' then - sFileName := GetResourcesPath + 'Fonts/Outline 1/Outline 1.png' - else if sResNameLower = 'outro_bg' then - sFileName := GetResourcesPath + 'Graphics/outro-bg.png' - else if sResNameLower = 'outro_esc' then - sFileName := GetResourcesPath + 'Graphics/outro-esc.png' - else if sResNameLower = 'outro_exd' then - sFileName := GetResourcesPath + 'Graphics/outro-exit-dark.png' - else if sResNameLower = 'fonto2' then - sFileName := GetResourcesPath + 'Fonts/Outline 2/Outline 2.png'; - - if FileExists(sFileName) then - inherited Create( sFileName, fmOpenReadWrite) - else + + if ResType = 'TEX' then begin + if sResNameLower = 'font' then + sFileName := GetResourcesPath + 'Fonts/Normal/eurostar_regular.png' + else if sResNameLower = 'fontb' then + sFileName := GetResourcesPath + 'Fonts/Bold/eurostar_regular_bold.png' + else if sResNameLower = 'fonto' then + sFileName := GetResourcesPath + 'Fonts/Outline 1/Outline 1.png' + else if sResNameLower = 'fonto2' then + sFileName := GetResourcesPath + 'Fonts/Outline 2/Outline 2.png' + else if sResNameLower = 'crdts_bg' then + sFileName := GetResourcesPath + 'Graphics/credits_v5_bg.png' + else if sResNameLower = 'crdts_ovl' then + sFileName := GetResourcesPath + 'Graphics/credits_v5_overlay.png' + else if sResNameLower = 'crdts_blindguard' then + sFileName := GetResourcesPath + 'Graphics/names_blindguard.png' + else if sResNameLower = 'crdts_blindy' then + sFileName := GetResourcesPath + 'Graphics/names_blindy.png' + else if sResNameLower = 'crdts_canni' then + sFileName := GetResourcesPath + 'Graphics/names_canni.png' + else if sResNameLower = 'crdts_commandio' then + sFileName := GetResourcesPath + 'Graphics/names_commandio.png' + else if sResNameLower = 'crdts_lazyjoker' then + sFileName := GetResourcesPath + 'Graphics/names_lazyjoker.png' + else if sResNameLower = 'crdts_mog' then + sFileName := GetResourcesPath + 'Graphics/names_mog.png' + else if sResNameLower = 'crdts_mota' then + sFileName := GetResourcesPath + 'Graphics/names_mota.png' + else if sResNameLower = 'crdts_skillmaster' then + sFileName := GetResourcesPath + 'Graphics/names_skillmaster.png' + else if sResNameLower = 'crdts_whiteshark' then + sFileName := GetResourcesPath + 'Graphics/names_whiteshark.png' + else if sResNameLower = 'intro_l01' then + sFileName := GetResourcesPath + 'Graphics/intro-l-01.png' + else if sResNameLower = 'intro_l02' then + sFileName := GetResourcesPath + 'Graphics/intro-l-02.png' + else if sResNameLower = 'intro_l03' then + sFileName := GetResourcesPath + 'Graphics/intro-l-03.png' + else if sResNameLower = 'intro_l04' then + sFileName := GetResourcesPath + 'Graphics/intro-l-04.png' + else if sResNameLower = 'intro_l05' then + sFileName := GetResourcesPath + 'Graphics/intro-l-05.png' + else if sResNameLower = 'intro_l06' then + sFileName := GetResourcesPath + 'Graphics/intro-l-06.png' + else if sResNameLower = 'intro_l07' then + sFileName := GetResourcesPath + 'Graphics/intro-l-07.png' + else if sResNameLower = 'intro_l08' then + sFileName := GetResourcesPath + 'Graphics/intro-l-08.png' + else if sResNameLower = 'intro_l09' then + sFileName := GetResourcesPath + 'Graphics/intro-l-09.png' + else if sResNameLower = 'outro_bg' then + sFileName := GetResourcesPath + 'Graphics/outro-bg.png' + else if sResNameLower = 'outro_esc' then + sFileName := GetResourcesPath + 'Graphics/outro-esc.png' + else if sResNameLower = 'outro_exd' then + sFileName := GetResourcesPath + 'Graphics/outro-exit-dark.png'; + end + else if ResType = 'FNT' then begin + if sResNameLower = 'font' then + sFileName := GetResourcesPath + 'Fonts/Normal/eurostar_regular.dat' + else if sResNameLower = 'fontb' then + sFileName := GetResourcesPath + 'Fonts/Bold/eurostar_regular_bold.dat' + else if sResNameLower = 'fonto' then + sFileName := GetResourcesPath + 'Fonts/Outline 1/Outline 1.dat' + else if sResNameLower = 'fonto2' then + sFileName := GetResourcesPath + 'Fonts/Outline 2/Outline 2.dat'; + end; + + if FileExists(sFileName) then + inherited Create( sFileName, fmOpenReadWrite) + else raise Exception.Create('MacResources.TResourceStream.Create: File "' + sFileName + '" not found.'); end; -- cgit v1.2.3 From a1a9c43dcd6f61610eb3afea542aec5de5dabf30 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 6 Nov 2007 19:40:06 +0000 Subject: Some changes to PluginInterface to fit with 64 Bit Systems. lParam is maily for use as Pointer, therefore standardtype: Pointer. wParam should mainly be used for ordinals. (Integer or Int64 on 64Bit Systems). Don't return addresses. Result is not assured to be Int64 on 64 Bit Systems. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@592 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCore.pas | 68 +- Game/Code/Classes/UHooks.pas | 10 +- Game/Code/Classes/UParty.pas | 1230 ++++++++++++++++---------------- Game/Code/Classes/UPluginInterface.pas | 8 +- Game/Code/Classes/UServices.pas | 4 +- Game/Code/Classes/uPluginLoader.pas | 92 +-- 6 files changed, 707 insertions(+), 705 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UCore.pas b/Game/Code/Classes/UCore.pas index 5b144b45..c150ff34 100644 --- a/Game/Code/Classes/UCore.pas +++ b/Game/Code/Classes/UCore.pas @@ -104,13 +104,13 @@ type //-------------- // Hook and Service Procs: //-------------- - Function ShowMessage(wParam, lParam: DWord): integer; //Shows a Message (lParam: PChar Text, wParam: Symbol) - Function ReportError(wParam, lParam: DWord): integer; //Shows a Message (wParam: Pchar(Message), lParam: PChar(Reportername)) - Function ReportDebug(wParam, lParam: DWord): integer; //Shows a Message (wParam: Pchar(Message), lParam: PChar(Reportername)) - Function Retranslate(wParam, lParam: DWord): integer; //Calls Translate hook - Function ReloadTextures(wParam, lParam: DWord): integer; //Calls LoadTextures hook - Function GetModuleInfo(wParam, lParam: DWord): integer; //If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TModuleInfo to address at lparam - Function GetApplicationHandle(wParam, lParam: DWord): integer; //Returns Application Handle + Function ShowMessage(wParam: TwParam; lParam: TlParam): integer; //Shows a Message (lParam: PChar Text, wParam: Symbol) + Function ReportError(wParam: TwParam; lParam: TlParam): integer; //Shows a Message (wParam: Pchar(Message), lParam: PChar(Reportername)) + Function ReportDebug(wParam: TwParam; lParam: TlParam): integer; //Shows a Message (wParam: Pchar(Message), lParam: PChar(Reportername)) + Function Retranslate(wParam: TwParam; lParam: TlParam): integer; //Calls Translate hook + Function ReloadTextures(wParam: TwParam; lParam: TlParam): integer; //Calls LoadTextures hook + Function GetModuleInfo(wParam: TwParam; lParam: TlParam): integer; //If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TModuleInfo to address at lparam + Function GetApplicationHandle(wParam: TwParam; lParam: TlParam): integer; //Returns Application Handle end; var @@ -196,50 +196,50 @@ begin else begin If (LastErrorString <> '') then - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error calling LoadingFinished Hook: ' + LastErrorString))) + Self.ShowMessage(CORE_SM_ERROR, PChar('Error calling LoadingFinished Hook: ' + LastErrorString)) else - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error calling LoadingFinished Hook'))); + Self.ShowMessage(CORE_SM_ERROR, PChar('Error calling LoadingFinished Hook')); end; end else begin If (LastErrorString <> '') then - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading textures: ' + LastErrorString))) + Self.ShowMessage(CORE_SM_ERROR, PChar('Error loading textures: ' + LastErrorString)) else - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading textures'))); + Self.ShowMessage(CORE_SM_ERROR, PChar('Error loading textures')); end; end else begin If (LastErrorString <> '') then - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error translating: ' + LastErrorString))) + Self.ShowMessage(CORE_SM_ERROR, PChar('Error translating: ' + LastErrorString)) else - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error translating'))); + Self.ShowMessage(CORE_SM_ERROR, PChar('Error translating')); end; end else begin If (LastErrorString <> '') then - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error initing Modules: ' + LastErrorString))) + Self.ShowMessage(CORE_SM_ERROR, PChar('Error initing Modules: ' + LastErrorString)) else - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error initing Modules'))); + Self.ShowMessage(CORE_SM_ERROR, PChar('Error initing Modules')); end; end else begin If (LastErrorString <> '') then - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading Modules: ' + LastErrorString))) + Self.ShowMessage(CORE_SM_ERROR, PChar('Error loading Modules: ' + LastErrorString)) else - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error loading Modules'))); + Self.ShowMessage(CORE_SM_ERROR, PChar('Error loading Modules')); end; end else begin If (LastErrorString <> '') then - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error Getting Modules: ' + LastErrorString))) + Self.ShowMessage(CORE_SM_ERROR, PChar('Error Getting Modules: ' + LastErrorString)) else - Self.ShowMessage(CORE_SM_ERROR, Integer(PChar('Error Getting Modules'))); + Self.ShowMessage(CORE_SM_ERROR, PChar('Error Getting Modules')); end; //DeInit @@ -272,7 +272,7 @@ begin end; Result := True; except - ReportError(Integer(PChar('Can''t get module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), Integer(PChar('Core'))); + ReportError(Integer(PChar('Can''t get module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), PChar('Core')); end; end; @@ -292,7 +292,7 @@ begin Result := Modules[I].Module.Load; except Result := False; - ReportError(Integer(PChar('Error loading module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), Integer(PChar('Core'))); + ReportError(Integer(PChar('Error loading module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), PChar('Core')); end; Inc(I); @@ -315,7 +315,7 @@ begin Result := Modules[I].Module.Init; except Result := False; - ReportError(Integer(PChar('Error initing module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), Integer(PChar('Core'))); + ReportError(Integer(PChar('Error initing module #' + InttoStr(I) + ' "' + Modules[I].Info.Name + '"')), PChar('Core')); end; Modules[I].NeedsDeInit := Result; @@ -414,13 +414,13 @@ end; //------------- // Shows a MessageDialog (lParam: PChar Text, wParam: Symbol) //------------- -Function TCore.ShowMessage(wParam, lParam: DWord): integer; +Function TCore.ShowMessage(wParam: TwParam; lParam: TlParam): integer; var Params: Cardinal; begin Result := -1; {$IFDEF Delphi} - If (ptr(lParam)<>nil) then + If (lParam<>nil) then begin Params := MB_OK; Case wParam of @@ -430,7 +430,7 @@ begin end; //Anzeigen: - Result := Messagebox(0, ptr(lParam), PChar(Name), Params); + Result := Messagebox(0, lParam, PChar(Name), Params); end; {$ENDIF} @@ -440,10 +440,10 @@ end; //------------- // Calls NewError HookChain (wParam: Pchar(Message), lParam: PChar(Reportername)) //------------- -Function TCore.ReportError(wParam, lParam: DWord): integer; +Function TCore.ReportError(wParam: TwParam; lParam: TlParam): integer; begin //Update LastErrorReporter and LastErrorString - LastErrorReporter := String(PChar(Pointer(lParam))); + LastErrorReporter := String(PChar(lParam)); LastErrorString := String(PChar(Pointer(wParam))); Hooks.CallEventChain(hError, wParam, lParam); @@ -452,7 +452,7 @@ end; //------------- // Calls NewDebugInfo HookChain (wParam: Pchar(Message), lParam: PChar(Reportername)) //------------- -Function TCore.ReportDebug(wParam, lParam: DWord): integer; +Function TCore.ReportDebug(wParam: TwParam; lParam: TlParam): integer; begin Hooks.CallEventChain(hDebug, wParam, lParam); end; @@ -460,23 +460,23 @@ end; //------------- // Calls Translate hook //------------- -Function TCore.Retranslate(wParam, lParam: DWord): integer; +Function TCore.Retranslate(wParam: TwParam; lParam: TlParam): integer; begin - Hooks.CallEventChain(hTranslate, 0, 1); + Hooks.CallEventChain(hTranslate, 1, nil); end; //------------- // Calls LoadTextures hook //------------- -Function TCore.ReloadTextures(wParam, lParam: DWord): integer; +Function TCore.ReloadTextures(wParam: TwParam; lParam: TlParam): integer; begin - Hooks.CallEventChain(hLoadTextures, 0, 1); + Hooks.CallEventChain(hLoadTextures, 1, nil); end; //------------- // If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TModuleInfo to address at lparam //------------- -Function TCore.GetModuleInfo(wParam, lParam: DWord): integer; +Function TCore.GetModuleInfo(wParam: TwParam; lParam: TlParam): integer; begin if (Pointer(lParam) = nil) then begin @@ -500,7 +500,7 @@ end; //------------- // Returns Application Handle //------------- -Function TCore.GetApplicationHandle(wParam, lParam: DWord): integer; +Function TCore.GetApplicationHandle(wParam: TwParam; lParam: TlParam): integer; begin Result := hInstance; end; diff --git a/Game/Code/Classes/UHooks.pas b/Game/Code/Classes/UHooks.pas index c30803f7..3e22bc75 100644 --- a/Game/Code/Classes/UHooks.pas +++ b/Game/Code/Classes/UHooks.pas @@ -54,13 +54,13 @@ type Function AddSubscriber (const EventName: PChar; const Proc: TUS_Hook = nil; const ProcOfClass: TUS_Hook_of_Object = nil): THandle; Function DelSubscriber (const hSubscriber: THandle): Integer; - Function CallEventChain (const hEvent: THandle; const wParam, lParam: LongWord): Integer; + Function CallEventChain (const hEvent: THandle; const wParam: TwParam; lParam: TlParam): Integer; Function EventExists (const EventName: PChar): Integer; Procedure DelbyOwner(const Owner: Integer); end; -function HookTest(wParam, lParam: DWord): integer; stdcall; +function HookTest(wParam: TwParam; lParam: TlParam): integer; stdcall; var HookManager: THookManager; @@ -318,7 +318,7 @@ end; // CallEventChain - Calls the Chain of a specified EventHandle // Returns: -1: Handle doesn't Exist, 0 Chain is called until the End //------------ -Function THookManager.CallEventChain (const hEvent: THandle; const wParam, lParam: LongWord): Integer; +Function THookManager.CallEventChain (const hEvent: THandle; const wParam: TwParam; lParam: TlParam): Integer; var EventIndex: Cardinal; Cur: PSubscriberInfo; @@ -421,10 +421,10 @@ begin end; -function HookTest(wParam, lParam: DWord): integer; stdcall; +function HookTest(wParam: TwParam; lParam: TlParam): integer; stdcall; begin Result := 0; //Don't break the chain - Core.ShowMessage(CORE_SM_INFO, Integer(PChar(String(PChar(Pointer(lParam))) + ': ' + String(PChar(Pointer(wParam)))))); + Core.ShowMessage(CORE_SM_INFO, PChar(String(PChar(Pointer(lParam))) + ': ' + String(PChar(Pointer(wParam))))); end; end. diff --git a/Game/Code/Classes/UParty.pas b/Game/Code/Classes/UParty.pas index 3fc52b8e..b0b400db 100644 --- a/Game/Code/Classes/UParty.pas +++ b/Game/Code/Classes/UParty.pas @@ -1,614 +1,616 @@ -unit UParty; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -{$I switches.inc} - -uses UPartyDefs, UCoreModule, UPluginDefs; - -type - ARounds = Array [0..252] of Integer; //0..252 needed for - PARounds = ^ARounds; - - TRoundInfo = record - Modi: Cardinal; - Winner: Byte; - end; - - TeamOrderEntry = record - Teamnum: Byte; - Score: Byte; - end; - - TeamOrderArray = Array[0..5] of Byte; - - TUS_ModiInfoEx = record - Info: TUS_ModiInfo; - Owner: Integer; - TimesPlayed: Byte; //Helper for setting Round Plugins - end; - - TPartySession = class (TCoreModule) - private - bPartyMode: Boolean; //Is this Party or Singleplayer - CurRound: Byte; - - Modis: Array of TUS_ModiInfoEx; - Teams: TTeamInfo; - - function IsWinner(Player, Winner: Byte): boolean; - procedure GenScores; - function GetRandomPlugin(TeamMode: Boolean): Cardinal; - function GetRandomPlayer(Team: Byte): Byte; - public - //Teams: TTeamInfo; - Rounds: array of TRoundInfo; - - //TCoreModule methods to inherit - Constructor Create; override; - Procedure Info(const pInfo: PModuleInfo); override; - Function Load: Boolean; override; - Function Init: Boolean; override; - Procedure DeInit; override; - Procedure Free; override; - - //Register Modi Service - Function RegisterModi(pModiInfo, nothin: DWord): integer; //Registers a new Modi. wParam: Pointer to TUS_ModiInfo - - //Start new Party - Function StartParty(NumRounds, PAofIRounds: DWord): integer; //Starts new Party Mode. Returns Non Zero on Success - Function GetCurModi(wParam, lParam: DWord): integer; //Returns Pointer to Cur. Modis TUS_ModiInfo (to Use with Singscreen) - Function StopParty(wParam, lParam: DWord): integer; //Stops Party Mode. Returns 1 If Partymode was enabled before. - Function NextRound(wParam, lParam: DWord): integer; //Increases CurRound by 1; Returns num of Round or -1 if last Round is already played - - Function CallModiInit(wParam, lParam: DWord): integer; //Calls CurModis Init Proc. If an Error occurs, Returns Nonzero. In this Case a New Plugin was Selected. Please renew Loading - Function CallModiDeInit(wParam, lParam: DWord): integer; //Calls DeInitProc and does the RoundEnding - - Function GetTeamInfo(wParam, pTeamInfo: DWord): integer; //Writes TTeamInfo Record to Pointer at lParam. Returns Zero on Success - Function SetTeamInfo(wParam, pTeamInfo: DWord): integer; //Read TTeamInfo Record from Pointer at lParam. Returns Zero on Success - - Function GetTeamOrder(wParam, lParam: DWord): integer; //Returns Team Order. Structure: Bits 1..3: Team at Place1; Bits 4..6: Team at Place2 ... - Function GetWinnerString(wParam, lParam: DWord): integer; //wParam is Roundnum. If (Pointer = nil) then Return Length of the String. Otherwise Write the String to Address at lParam - end; - -const - StandardModi = 0; //Modi ID that will be played in non party Mode - -implementation - -uses UCore, UGraphic, UMain, ULanguage, ULog, SysUtils; - -{********************* - TPluginLoader - Implentation -*********************} - -//------------- -// Function that gives some Infos about the Module to the Core -//------------- -Procedure TPartySession.Info(const pInfo: PModuleInfo); -begin - pInfo^.Name := 'TPartySession'; - pInfo^.Version := MakeVersion(1,0,0,chr(0)); - pInfo^.Description := 'Manages Party Modi and Party Game'; -end; - -//------------- -// Just the Constructor -//------------- -Constructor TPartySession.Create; -begin - //UnSet PartyMode - bPartyMode := False; -end; - -//------------- -//Is Called on Loading. -//In this Method only Events and Services should be created -//to offer them to other Modules or Plugins during the Init process -//If False is Returned this will cause a Forced Exit -//------------- -Function TPartySession.Load: Boolean; -begin - //Add Register Party Modi Service - Result := True; - Core.Services.AddService('Party/RegisterModi', nil, Self.RegisterModi); - Core.Services.AddService('Party/StartParty', nil, Self.StartParty); - Core.Services.AddService('Party/GetCurModi', nil, Self.GetCurModi); -end; - -//------------- -//Is Called on Init Process -//In this Method you can Hook some Events and Create + Init -//your Classes, Variables etc. -//If False is Returned this will cause a Forced Exit -//------------- -Function TPartySession.Init: Boolean; -begin - //Just set Prvate Var to true. - Result := true; -end; - -//------------- -//Is Called if this Module has been Inited and there is a Exit. -//Deinit is in backwards Initing Order -//------------- -Procedure TPartySession.DeInit; -begin - //Force DeInit - -end; - -//------------- -//Is Called if this Module will be unloaded and has been created -//Should be used to Free Memory -//------------- -Procedure TPartySession.Free; -begin - //Just save some Memory if it wasn't done now.. - SetLength(Modis, 0); -end; - -//------------- -// Registers a new Modi. wParam: Pointer to TUS_ModiInfo -// Service for Plugins -//------------- -Function TPartySession.RegisterModi(pModiInfo, nothin: DWord): integer; -var - Len: Integer; - Info: PUS_ModiInfo; -begin - Info := Pointer(PModiInfo); - //Copy Info if cbSize is correct - If (Info.cbSize = SizeOf(TUS_ModiInfo)) then - begin - Len := Length(Modis); - SetLength(Modis, Len + 1); - - Modis[Len].Info := Info^; - end - else - Core.ReportError(Integer(PChar('Plugins try to Register Modi with wrong Pointer, or wrong TUS_ModiInfo Record.')), Integer(PChar('TPartySession'))); -end; - -//---------- -// Returns a Number of a Random Plugin -//---------- -Function TPartySession.GetRandomPlugin(TeamMode: Boolean): Cardinal; -var - LowestTP: Byte; - NumPwithLTP: Word; - I: Integer; - R: Word; -begin - Result := StandardModi; //If there are no matching Modis, Play StandardModi - LowestTP := high(Byte); - NumPwithLTP := 0; - - //Search for Plugins not often played yet - For I := 0 to high(Modis) do - begin - if (Modis[I].TimesPlayed < lowestTP) And (((Modis[I].Info.LoadingSettings AND MLS_TeamOnly) <> 0) = TeamMode) then - begin - lowestTP := Modis[I].TimesPlayed; - NumPwithLTP := 1; - end - else if (Modis[I].TimesPlayed = lowestTP) And (((Modis[I].Info.LoadingSettings AND MLS_TeamOnly) <> 0) = TeamMode) then - begin - Inc(NumPwithLTP); - end; - end; - - //Create Random No - R := Random(NumPwithLTP); - - //Search for Random Plugin - For I := 0 to high(Modis) do - begin - if (Modis[I].TimesPlayed = lowestTP) And (((Modis[I].Info.LoadingSettings AND MLS_TeamOnly) <> 0) = TeamMode) then - begin - //Plugin Found - if (R = 0) then - begin - Result := I; - Inc(Modis[I].TimesPlayed); - Break; - end; - - Dec(R); - end; - end; -end; - -//---------- -// Starts new Party Mode. Returns Non Zero on Success -//---------- -Function TPartySession.StartParty(NumRounds, PAofIRounds: DWord): integer; -var - I: Integer; - aiRounds: PARounds; - TeamMode: Boolean; -begin - Result := 0; - If (Teams.NumTeams >= 1) AND (NumRounds < High(Byte)-1) then - begin - bPartyMode := false; - aiRounds := Pointer(PAofIRounds); - - Try - //Is this Teammode(More then one Player per Team) ? - TeamMode := True; - For I := 0 to Teams.NumTeams-1 do - TeamMode := TeamMode AND (Teams.Teaminfo[I].NumPlayers > 1); - - // For I := 0 to High(NumRounds) do // eddie: changed NumRounds to Rounds - is this correct ??? I get compile errors on the mac otherwise... - For I := 0 to High(Rounds) do - begin //Set Plugins - If (aiRounds[I] = -1) then - Rounds[I].Modi := GetRandomPlugin(TeamMode) - Else If (aiRounds[I] >= 0) AND (aiRounds[I] <= High(Modis)) AND (TeamMode OR ((Modis[aiRounds[I]].Info.LoadingSettings AND MLS_TeamOnly) = 0)) then - Rounds[I].Modi := aiRounds[I] - Else - Rounds[I].Modi := StandardModi; - - Rounds[I].Winner := High(Byte); //Set Winner to Not Played - end; - - CurRound := High(Byte); //Set CurRound to not defined - - //Return teh true and Set PartyMode - bPartyMode := True; - Result := 1; - - Except - Core.ReportError(Integer(PChar('Can''t start PartyMode.')), Integer(PChar('TPartySession'))); - end; - end; -end; - -//---------- -// Returns Pointer to Cur. ModiInfoEx (to Use with Singscreen) -//---------- -Function TPartySession.GetCurModi(wParam, lParam: DWord): integer; -begin - If (bPartyMode) AND (CurRound <= High(Rounds)) then - begin //If PartyMode is enabled: - //Return the Plugin of the Cur Round - Result := Integer(@Modis[Rounds[CurRound].Modi]); - end - else - begin //Return StandardModi - Result := Integer(@Modis[StandardModi]); - end; -end; - -//---------- -// Stops Party Mode. Returns 1 If Partymode was enabled before. And -1 if Change was not possible -//---------- -Function TPartySession.StopParty(wParam, lParam: DWord): integer; -begin - Result := -1; - If (bPartyMode) then - begin - // to-do : Whitü: Check here if SingScreen is not Shown atm. - bPartyMode := False; - Result := 1; - end - else - Result := 0; -end; - -//---------- -//GetRandomPlayer - Gives back a Random Player to Play next Round -//---------- -function TPartySession.GetRandomPlayer(Team: Byte): Byte; -var - I, R: Integer; - lowestTP: Byte; - NumPwithLTP: Byte; -begin - LowestTP := high(Byte); - NumPwithLTP := 0; - Result := 0; - - //Search for Players that have not often played yet - For I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do - begin - if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed < lowestTP) then - begin - lowestTP := Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed; - NumPwithLTP := 1; - end - else if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP) then - begin - Inc(NumPwithLTP); - end; - end; - - //Create Random No - R := Random(NumPwithLTP); - - //Search for Random Player - For I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do - begin - if Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP then - begin - //Player Found - if (R = 0) then - begin - Result := I; - Break; - end; - - Dec(R); - end; - end; -end; - -//---------- -// NextRound - Increases CurRound by 1; Returns num of Round or -1 if last Round is already played -//---------- -Function TPartySession.NextRound(wParam, lParam: DWord): integer; -var I: Integer; -begin - If ((CurRound < high(Rounds)) OR (CurRound = high(CurRound))) then - begin //everythings OK! -> Start the Round, maaaaan - Inc(CurRound); - - //Set Players to play this Round - for I := 0 to Teams.NumTeams-1 do - Teams.Teaminfo[I].CurPlayer := GetRandomPlayer(I); - end - else - Result := -1; -end; - -//---------- -//IsWinner - Returns True if the Players Bit is set in the Winner Byte -//---------- -function TPartySession.IsWinner(Player, Winner: Byte): boolean; -var - Bit: Byte; -begin - Bit := 1 shl Player; - - Result := ((Winner AND Bit) = Bit); -end; - -//---------- -//GenScores - Inc Scores for Cur. Round -//---------- -procedure TPartySession.GenScores; -var - I: Byte; -begin - for I := 0 to Teams.NumTeams-1 do - begin - if isWinner(I, Rounds[CurRound].Winner) then - Inc(Teams.Teaminfo[I].Score); - end; -end; - -//---------- -// CallModiInit - Calls CurModis Init Proc. If an Error occurs, Returns Nonzero. In this Case a New Plugin was Selected. Please renew Loading -//---------- -Function TPartySession.CallModiInit(wParam, lParam: DWord): integer; -begin - If (not bPartyMode) then - begin //Set Rounds if not in PartyMode - SetLength(Rounds, 1); - Rounds[0].Modi := StandardModi; - Rounds[0].Winner := High(Byte); - CurRound := 0; - end; - - Try - //Core. - Except - on E : Exception do - begin - Core.ReportError(Integer(PChar('Error starting Modi: ' + Modis[Rounds[CurRound].Modi].Info.Name + ' ErrorStr: ' + E.Message)), Integer(PChar('TPartySession'))); - If (Rounds[CurRound].Modi = StandardModi) then - begin - Core.ReportError(Integer(PChar('Can''t start StandardModi, will exit now!')), Integer(PChar('TPartySession'))); - Halt; - end - Else //Select StandardModi - begin - Rounds[CurRound].Modi := StandardModi - end; - end; - End; -end; - -//---------- -// CallModiDeInit - Calls DeInitProc and does the RoundEnding -//---------- -Function TPartySession.CallModiDeInit(wParam, lParam: DWord): integer; -var - I: Integer; - MaxScore: Word; -begin - If (bPartyMode) then - begin - //Get Winner Byte! - if (@Modis[Rounds[CurRound].Modi].Info.ModiDeInit <> nil) then //get Winners from Plugin - Rounds[CurRound].Winner := Modis[Rounds[CurRound].Modi].Info.ModiDeInit(Modis[Rounds[CurRound].Modi].Info.ID) - else - begin //Create winners by Score :/ - Rounds[CurRound].Winner := 0; - MaxScore := 0; - for I := 0 to Teams.NumTeams-1 do - begin - // to-do : recode Percentage stuff - //PlayerInfo.Playerinfo[I].Percentage := PlayerInfo.Playerinfo[I].Score div 9999; - if (Player[I].ScoreTotalI > MaxScore) then - begin - MaxScore := Player[I].ScoreTotalI; - Rounds[CurRound].Winner := 1 shl I; - end - else if (Player[I].ScoreTotalI = MaxScore) AND (Player[I].ScoreTotalI <> 0) then - begin - Rounds[CurRound].Winner := Rounds[CurRound].Winner or (1 shl I); - end; - end; - - - //When nobody has Points -> Everybody loose - if (MaxScore = 0) then - Rounds[CurRound].Winner := 0; - - end; - - //Generate teh Scores - GenScores; - - //Inc Players TimesPlayed - If ((Modis[Rounds[CurRound-1].Modi].Info.LoadingSettings AND MLS_IncTP) = MLS_IncTP) then - begin - For I := 0 to Teams.NumTeams-1 do - Inc(Teams.TeamInfo[I].Playerinfo[Teams.TeamInfo[I].CurPlayer].TimesPlayed); - end; - end - else if (@Modis[Rounds[CurRound].Modi].Info.ModiDeInit <> nil) then - Modis[Rounds[CurRound].Modi].Info.ModiDeInit(Modis[Rounds[CurRound].Modi].Info.ID); -end; - -//---------- -// GetTeamInfo - Writes TTeamInfo Record to Pointer at lParam. Returns Zero on Success -//---------- -Function TPartySession.GetTeamInfo(wParam, pTeamInfo: DWord): integer; -var Info: ^TTeamInfo; -begin - Result := -1; - Info := Pointer(pTeamInfo); - If (Info <> nil) then - begin - Try - // to - do : Check Delphi memory management in this case - //Not sure if i had to copy PChars to a new address or if delphi manages this o0 - Info^ := Teams; - Result := 0; - Except - Result := -2; - End; - end; -end; - -//---------- -// SetTeamInfo - Read TTeamInfo Record from Pointer at lParam. Returns Zero on Success -//---------- -Function TPartySession.SetTeamInfo(wParam, pTeamInfo: DWord): integer; -var - TeamInfobackup: TTeamInfo; - Info: ^TTeamInfo; -begin - Result := -1; - Info := Pointer(pTeamInfo); - If (Info <> nil) then - begin - Try - TeamInfoBackup := Teams; - // to - do : Check Delphi memory management in this case - //Not sure if i had to copy PChars to a new address or if delphi manages this o0 - Teams := Info^; - Result := 0; - Except - Teams := TeamInfoBackup; - Result := -2; - End; - end; -end; - -//---------- -// GetTeamOrder - Returns Team Order. Structure: Bits 1..3: Team at Place1; Bits 4..6: Team at Place2 ... -//---------- -Function TPartySession.GetTeamOrder(wParam, lParam: DWord): integer; -var - I, J: Integer; - ATeams: array [0..5] of TeamOrderEntry; - TempTeam: TeamOrderEntry; -begin - // to-do : PartyMode: Write this in another way, so that teams with the same scire get the same Placing - //Fill Team Array - For I := 0 to Teams.NumTeams-1 do - begin - ATeams[I].Teamnum := I; - ATeams[I].Score := Teams.Teaminfo[I].Score; - end; - - //Sort Teams - for J := 0 to Teams.NumTeams-1 do - for I := 1 to Teams.NumTeams-1 do - if ATeams[I].Score > ATeams[I-1].Score then - begin - TempTeam := ATeams[I-1]; - ATeams[I-1] := ATeams[I]; - ATeams[I] := TempTeam; - end; - - //Copy to Result - Result := 0; - For I := 0 to Teams.NumTeams-1 do - Result := Result or (ATeams[I].TeamNum Shl I*3); -end; - -//---------- -// GetWinnerString - wParam is Roundnum. If (Pointer = nil) then Return Length of the String. Otherwise Write the String to Address at lParam -//---------- -Function TPartySession.GetWinnerString(wParam, lParam: DWord): integer; -var - Winners: Array of String; - I: Integer; - ResultStr: String; - S: ^String; -begin - ResultStr := Language.Translate('PARTY_NOBODY'); - - if (wParam <= High(Rounds)) then - begin - if (Rounds[wParam].Winner <> 0) then - begin - if (Rounds[wParam].Winner = 255) then - begin - ResultStr := Language.Translate('PARTY_NOTPLAYEDYET'); - end - else - begin - SetLength(Winners, 0); - for I := 0 to Teams.NumTeams-1 do - begin - if isWinner(I, Rounds[wParam].Winner) then - begin - SetLength(Winners, Length(Winners) + 1); - Winners[high(Winners)] := Teams.TeamInfo[I].Name; - end; - end; - ResultStr := Language.Implode(Winners); - end; - end; - end; - - //Now Return what we have got - If (Pointer(lParam) = nil) then - begin //ReturnString Length - Result := Length(ResultStr); - end - Else - begin //Return String - Try - S := Pointer(lParam); - S^ := ResultStr; - Result := 0; - Except - Result := -1; - - End; - end; -end; - -end. +unit UParty; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +{$I switches.inc} + +uses UPartyDefs, UCoreModule, UPluginDefs; + +type + ARounds = Array [0..252] of Integer; //0..252 needed for + PARounds = ^ARounds; + + TRoundInfo = record + Modi: Cardinal; + Winner: Byte; + end; + + TeamOrderEntry = record + Teamnum: Byte; + Score: Byte; + end; + + TeamOrderArray = Array[0..5] of Byte; + + TUS_ModiInfoEx = record + Info: TUS_ModiInfo; + Owner: Integer; + TimesPlayed: Byte; //Helper for setting Round Plugins + end; + + TPartySession = class (TCoreModule) + private + bPartyMode: Boolean; //Is this Party or Singleplayer + CurRound: Byte; + + Modis: Array of TUS_ModiInfoEx; + Teams: TTeamInfo; + + function IsWinner(Player, Winner: Byte): boolean; + procedure GenScores; + function GetRandomPlugin(TeamMode: Boolean): Cardinal; + function GetRandomPlayer(Team: Byte): Byte; + public + //Teams: TTeamInfo; + Rounds: array of TRoundInfo; + + //TCoreModule methods to inherit + Constructor Create; override; + Procedure Info(const pInfo: PModuleInfo); override; + Function Load: Boolean; override; + Function Init: Boolean; override; + Procedure DeInit; override; + Procedure Free; override; + + //Register Modi Service + Function RegisterModi(nothin: TwParam; pModiInfo: TlParam): integer; //Registers a new Modi. wParam: Pointer to TUS_ModiInfo + + //Start new Party + Function StartParty(NumRounds: TwParam; PAofIRounds: TlParam): integer; //Starts new Party Mode. Returns Non Zero on Success + Function GetCurModi(wParam: TwParam; lParam: TlParam): integer; //Returns Pointer to Cur. Modis TUS_ModiInfo (to Use with Singscreen) + Function StopParty(wParam: TwParam; lParam: TlParam): integer; //Stops Party Mode. Returns 1 If Partymode was enabled before. + Function NextRound(wParam: TwParam; lParam: TlParam): integer; //Increases CurRound by 1; Returns num of Round or -1 if last Round is already played + + Function CallModiInit(wParam: TwParam; lParam: TlParam): integer; //Calls CurModis Init Proc. If an Error occurs, Returns Nonzero. In this Case a New Plugin was Selected. Please renew Loading + Function CallModiDeInit(wParam: TwParam; lParam: TlParam): integer; //Calls DeInitProc and does the RoundEnding + + Function GetTeamInfo(wParam: TwParam; pTeamInfo: TlParam): integer; //Writes TTeamInfo Record to Pointer at lParam. Returns Zero on Success + Function SetTeamInfo(wParam: TwParam; pTeamInfo: TlParam): integer; //Read TTeamInfo Record from Pointer at lParam. Returns Zero on Success + + Function GetTeamOrder(wParam: TwParam; lParam: TlParam): integer; //Returns Team Order. Structure: Bits 1..3: Team at Place1; Bits 4..6: Team at Place2 ... + Function GetWinnerString(wParam: TwParam; lParam: TlParam): integer; //wParam is Roundnum. If (Pointer = nil) then Return Length of the String. Otherwise Write the String to Address at lParam + end; + +const + StandardModi = 0; //Modi ID that will be played in non party Mode + +implementation + +uses UCore, UGraphic, UMain, ULanguage, ULog, SysUtils; + +{********************* + TPluginLoader + Implentation +*********************} + +//------------- +// Function that gives some Infos about the Module to the Core +//------------- +Procedure TPartySession.Info(const pInfo: PModuleInfo); +begin + pInfo^.Name := 'TPartySession'; + pInfo^.Version := MakeVersion(1,0,0,chr(0)); + pInfo^.Description := 'Manages Party Modi and Party Game'; +end; + +//------------- +// Just the Constructor +//------------- +Constructor TPartySession.Create; +begin + //UnSet PartyMode + bPartyMode := False; +end; + +//------------- +//Is Called on Loading. +//In this Method only Events and Services should be created +//to offer them to other Modules or Plugins during the Init process +//If False is Returned this will cause a Forced Exit +//------------- +Function TPartySession.Load: Boolean; +begin + //Add Register Party Modi Service + Result := True; + Core.Services.AddService('Party/RegisterModi', nil, Self.RegisterModi); + Core.Services.AddService('Party/StartParty', nil, Self.StartParty); + Core.Services.AddService('Party/GetCurModi', nil, Self.GetCurModi); +end; + +//------------- +//Is Called on Init Process +//In this Method you can Hook some Events and Create + Init +//your Classes, Variables etc. +//If False is Returned this will cause a Forced Exit +//------------- +Function TPartySession.Init: Boolean; +begin + //Just set Prvate Var to true. + Result := true; +end; + +//------------- +//Is Called if this Module has been Inited and there is a Exit. +//Deinit is in backwards Initing Order +//------------- +Procedure TPartySession.DeInit; +begin + //Force DeInit + +end; + +//------------- +//Is Called if this Module will be unloaded and has been created +//Should be used to Free Memory +//------------- +Procedure TPartySession.Free; +begin + //Just save some Memory if it wasn't done now.. + SetLength(Modis, 0); +end; + +//------------- +// Registers a new Modi. wParam: Pointer to TUS_ModiInfo +// Service for Plugins +//------------- +Function TPartySession.RegisterModi(nothin: TwParam; pModiInfo: TlParam): integer; +var + Len: Integer; + Info: PUS_ModiInfo; +begin + Info := PModiInfo; + //Copy Info if cbSize is correct + If (Info.cbSize = SizeOf(TUS_ModiInfo)) then + begin + Len := Length(Modis); + SetLength(Modis, Len + 1); + + Modis[Len].Info := Info^; + end + else + Core.ReportError(Integer(PChar('Plugins try to Register Modi with wrong Pointer, or wrong TUS_ModiInfo Record.')), PChar('TPartySession')); +end; + +//---------- +// Returns a Number of a Random Plugin +//---------- +Function TPartySession.GetRandomPlugin(TeamMode: Boolean): Cardinal; +var + LowestTP: Byte; + NumPwithLTP: Word; + I: Integer; + R: Word; +begin + Result := StandardModi; //If there are no matching Modis, Play StandardModi + LowestTP := high(Byte); + NumPwithLTP := 0; + + //Search for Plugins not often played yet + For I := 0 to high(Modis) do + begin + if (Modis[I].TimesPlayed < lowestTP) And (((Modis[I].Info.LoadingSettings AND MLS_TeamOnly) <> 0) = TeamMode) then + begin + lowestTP := Modis[I].TimesPlayed; + NumPwithLTP := 1; + end + else if (Modis[I].TimesPlayed = lowestTP) And (((Modis[I].Info.LoadingSettings AND MLS_TeamOnly) <> 0) = TeamMode) then + begin + Inc(NumPwithLTP); + end; + end; + + //Create Random No + R := Random(NumPwithLTP); + + //Search for Random Plugin + For I := 0 to high(Modis) do + begin + if (Modis[I].TimesPlayed = lowestTP) And (((Modis[I].Info.LoadingSettings AND MLS_TeamOnly) <> 0) = TeamMode) then + begin + //Plugin Found + if (R = 0) then + begin + Result := I; + Inc(Modis[I].TimesPlayed); + Break; + end; + + Dec(R); + end; + end; +end; + +//---------- +// Starts new Party Mode. Returns Non Zero on Success +//---------- +Function TPartySession.StartParty(NumRounds: TwParam; PAofIRounds: TlParam): integer; +var + I: Integer; + aiRounds: PARounds; + TeamMode: Boolean; +begin + Result := 0; + If (Teams.NumTeams >= 1) AND (NumRounds < High(Byte)-1) then + begin + bPartyMode := false; + aiRounds := PAofIRounds; + + Try + //Is this Teammode(More then one Player per Team) ? + TeamMode := True; + For I := 0 to Teams.NumTeams-1 do + TeamMode := TeamMode AND (Teams.Teaminfo[I].NumPlayers > 1); + + //Set Rounds + SetLength(Rounds, NumRounds); + + For I := 0 to High(Rounds) do + begin //Set Plugins + If (aiRounds[I] = -1) then + Rounds[I].Modi := GetRandomPlugin(TeamMode) + Else If (aiRounds[I] >= 0) AND (aiRounds[I] <= High(Modis)) AND (TeamMode OR ((Modis[aiRounds[I]].Info.LoadingSettings AND MLS_TeamOnly) = 0)) then + Rounds[I].Modi := aiRounds[I] + Else + Rounds[I].Modi := StandardModi; + + Rounds[I].Winner := High(Byte); //Set Winner to Not Played + end; + + CurRound := High(Byte); //Set CurRound to not defined + + //Return teh true and Set PartyMode + bPartyMode := True; + Result := 1; + + Except + Core.ReportError(Integer(PChar('Can''t start PartyMode.')), PChar('TPartySession')); + end; + end; +end; + +//---------- +// Returns Pointer to Cur. ModiInfoEx (to Use with Singscreen) +//---------- +Function TPartySession.GetCurModi(wParam: TwParam; lParam: TlParam): integer; +begin + If (bPartyMode) AND (CurRound <= High(Rounds)) then + begin //If PartyMode is enabled: + //Return the Plugin of the Cur Round + Result := Integer(@Modis[Rounds[CurRound].Modi]); + end + else + begin //Return StandardModi + Result := Integer(@Modis[StandardModi]); + end; +end; + +//---------- +// Stops Party Mode. Returns 1 If Partymode was enabled before. And -1 if Change was not possible +//---------- +Function TPartySession.StopParty(wParam: TwParam; lParam: TlParam): integer; +begin + Result := -1; + If (bPartyMode) then + begin + // to-do : Whitü: Check here if SingScreen is not Shown atm. + bPartyMode := False; + Result := 1; + end + else + Result := 0; +end; + +//---------- +//GetRandomPlayer - Gives back a Random Player to Play next Round +//---------- +function TPartySession.GetRandomPlayer(Team: Byte): Byte; +var + I, R: Integer; + lowestTP: Byte; + NumPwithLTP: Byte; +begin + LowestTP := high(Byte); + NumPwithLTP := 0; + Result := 0; + + //Search for Players that have not often played yet + For I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do + begin + if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed < lowestTP) then + begin + lowestTP := Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed; + NumPwithLTP := 1; + end + else if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP) then + begin + Inc(NumPwithLTP); + end; + end; + + //Create Random No + R := Random(NumPwithLTP); + + //Search for Random Player + For I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do + begin + if Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP then + begin + //Player Found + if (R = 0) then + begin + Result := I; + Break; + end; + + Dec(R); + end; + end; +end; + +//---------- +// NextRound - Increases CurRound by 1; Returns num of Round or -1 if last Round is already played +//---------- +Function TPartySession.NextRound(wParam: TwParam; lParam: TlParam): integer; +var I: Integer; +begin + If ((CurRound < high(Rounds)) OR (CurRound = high(CurRound))) then + begin //everythings OK! -> Start the Round, maaaaan + Inc(CurRound); + + //Set Players to play this Round + for I := 0 to Teams.NumTeams-1 do + Teams.Teaminfo[I].CurPlayer := GetRandomPlayer(I); + end + else + Result := -1; +end; + +//---------- +//IsWinner - Returns True if the Players Bit is set in the Winner Byte +//---------- +function TPartySession.IsWinner(Player, Winner: Byte): boolean; +var + Bit: Byte; +begin + Bit := 1 shl Player; + + Result := ((Winner AND Bit) = Bit); +end; + +//---------- +//GenScores - Inc Scores for Cur. Round +//---------- +procedure TPartySession.GenScores; +var + I: Byte; +begin + for I := 0 to Teams.NumTeams-1 do + begin + if isWinner(I, Rounds[CurRound].Winner) then + Inc(Teams.Teaminfo[I].Score); + end; +end; + +//---------- +// CallModiInit - Calls CurModis Init Proc. If an Error occurs, Returns Nonzero. In this Case a New Plugin was Selected. Please renew Loading +//---------- +Function TPartySession.CallModiInit(wParam: TwParam; lParam: TlParam): integer; +begin + If (not bPartyMode) then + begin //Set Rounds if not in PartyMode + SetLength(Rounds, 1); + Rounds[0].Modi := StandardModi; + Rounds[0].Winner := High(Byte); + CurRound := 0; + end; + + Try + //Core. + Except + on E : Exception do + begin + Core.ReportError(Integer(PChar('Error starting Modi: ' + Modis[Rounds[CurRound].Modi].Info.Name + ' ErrorStr: ' + E.Message)), PChar('TPartySession')); + If (Rounds[CurRound].Modi = StandardModi) then + begin + Core.ReportError(Integer(PChar('Can''t start StandardModi, will exit now!')), PChar('TPartySession')); + Halt; + end + Else //Select StandardModi + begin + Rounds[CurRound].Modi := StandardModi + end; + end; + End; +end; + +//---------- +// CallModiDeInit - Calls DeInitProc and does the RoundEnding +//---------- +Function TPartySession.CallModiDeInit(wParam: TwParam; lParam: TlParam): integer; +var + I: Integer; + MaxScore: Word; +begin + If (bPartyMode) then + begin + //Get Winner Byte! + if (@Modis[Rounds[CurRound].Modi].Info.ModiDeInit <> nil) then //get Winners from Plugin + Rounds[CurRound].Winner := Modis[Rounds[CurRound].Modi].Info.ModiDeInit(Modis[Rounds[CurRound].Modi].Info.ID) + else + begin //Create winners by Score :/ + Rounds[CurRound].Winner := 0; + MaxScore := 0; + for I := 0 to Teams.NumTeams-1 do + begin + // to-do : recode Percentage stuff + //PlayerInfo.Playerinfo[I].Percentage := PlayerInfo.Playerinfo[I].Score div 9999; + if (Player[I].ScoreTotalI > MaxScore) then + begin + MaxScore := Player[I].ScoreTotalI; + Rounds[CurRound].Winner := 1 shl I; + end + else if (Player[I].ScoreTotalI = MaxScore) AND (Player[I].ScoreTotalI <> 0) then + begin + Rounds[CurRound].Winner := Rounds[CurRound].Winner or (1 shl I); + end; + end; + + + //When nobody has Points -> Everybody loose + if (MaxScore = 0) then + Rounds[CurRound].Winner := 0; + + end; + + //Generate teh Scores + GenScores; + + //Inc Players TimesPlayed + If ((Modis[Rounds[CurRound-1].Modi].Info.LoadingSettings AND MLS_IncTP) = MLS_IncTP) then + begin + For I := 0 to Teams.NumTeams-1 do + Inc(Teams.TeamInfo[I].Playerinfo[Teams.TeamInfo[I].CurPlayer].TimesPlayed); + end; + end + else if (@Modis[Rounds[CurRound].Modi].Info.ModiDeInit <> nil) then + Modis[Rounds[CurRound].Modi].Info.ModiDeInit(Modis[Rounds[CurRound].Modi].Info.ID); +end; + +//---------- +// GetTeamInfo - Writes TTeamInfo Record to Pointer at lParam. Returns Zero on Success +//---------- +Function TPartySession.GetTeamInfo(wParam: TwParam; pTeamInfo: TlParam): integer; +var Info: ^TTeamInfo; +begin + Result := -1; + Info := pTeamInfo; + If (Info <> nil) then + begin + Try + // to - do : Check Delphi memory management in this case + //Not sure if i had to copy PChars to a new address or if delphi manages this o0 + Info^ := Teams; + Result := 0; + Except + Result := -2; + End; + end; +end; + +//---------- +// SetTeamInfo - Read TTeamInfo Record from Pointer at lParam. Returns Zero on Success +//---------- +Function TPartySession.SetTeamInfo(wParam: TwParam; pTeamInfo: TlParam): integer; +var + TeamInfobackup: TTeamInfo; + Info: ^TTeamInfo; +begin + Result := -1; + Info := pTeamInfo; + If (Info <> nil) then + begin + Try + TeamInfoBackup := Teams; + // to - do : Check Delphi memory management in this case + //Not sure if i had to copy PChars to a new address or if delphi manages this o0 + Teams := Info^; + Result := 0; + Except + Teams := TeamInfoBackup; + Result := -2; + End; + end; +end; + +//---------- +// GetTeamOrder - Returns Team Order. Structure: Bits 1..3: Team at Place1; Bits 4..6: Team at Place2 ... +//---------- +Function TPartySession.GetTeamOrder(wParam: TwParam; lParam: TlParam): integer; +var + I, J: Integer; + ATeams: array [0..5] of TeamOrderEntry; + TempTeam: TeamOrderEntry; +begin + // to-do : PartyMode: Write this in another way, so that teams with the same scire get the same Placing + //Fill Team Array + For I := 0 to Teams.NumTeams-1 do + begin + ATeams[I].Teamnum := I; + ATeams[I].Score := Teams.Teaminfo[I].Score; + end; + + //Sort Teams + for J := 0 to Teams.NumTeams-1 do + for I := 1 to Teams.NumTeams-1 do + if ATeams[I].Score > ATeams[I-1].Score then + begin + TempTeam := ATeams[I-1]; + ATeams[I-1] := ATeams[I]; + ATeams[I] := TempTeam; + end; + + //Copy to Result + Result := 0; + For I := 0 to Teams.NumTeams-1 do + Result := Result or (ATeams[I].TeamNum Shl I*3); +end; + +//---------- +// GetWinnerString - wParam is Roundnum. If (Pointer = nil) then Return Length of the String. Otherwise Write the String to Address at lParam +//---------- +Function TPartySession.GetWinnerString(wParam: TwParam; lParam: TlParam): integer; +var + Winners: Array of String; + I: Integer; + ResultStr: String; + S: ^String; +begin + ResultStr := Language.Translate('PARTY_NOBODY'); + + if (wParam <= High(Rounds)) then + begin + if (Rounds[wParam].Winner <> 0) then + begin + if (Rounds[wParam].Winner = 255) then + begin + ResultStr := Language.Translate('PARTY_NOTPLAYEDYET'); + end + else + begin + SetLength(Winners, 0); + for I := 0 to Teams.NumTeams-1 do + begin + if isWinner(I, Rounds[wParam].Winner) then + begin + SetLength(Winners, Length(Winners) + 1); + Winners[high(Winners)] := Teams.TeamInfo[I].Name; + end; + end; + ResultStr := Language.Implode(Winners); + end; + end; + end; + + //Now Return what we have got + If (lParam = nil) then + begin //ReturnString Length + Result := Length(ResultStr); + end + Else + begin //Return String + Try + S := lParam; + S^ := ResultStr; + Result := 0; + Except + Result := -1; + + End; + end; +end; + +end. diff --git a/Game/Code/Classes/UPluginInterface.pas b/Game/Code/Classes/UPluginInterface.pas index 56293848..6a83d7c3 100644 --- a/Game/Code/Classes/UPluginInterface.pas +++ b/Game/Code/Classes/UPluginInterface.pas @@ -26,7 +26,7 @@ uses uPluginDefs; {Function start calling the Hook Chain 0 if Chain is called until the End, -1 if Event Handle is not valid otherwise Return Value of the Hook that breaks the Chain} - Function NotivyEventHooks (hEvent: THandle; wParam, lParam: dWord): integer; stdcall; + Function NotivyEventHooks (hEvent: THandle; wParam: TwParam; lParam: TlParam): integer; stdcall; {Function Hooks an Event by Name. Returns Hook Handle on Success, otherwise 0} @@ -51,7 +51,7 @@ uses uPluginDefs; {Function Calls a Services Proc Returns Services Return Value or SERVICE_NOT_FOUND on Failure} - Function CallService (ServiceName: PChar; wParam, lParam: dWord): integer; stdcall; + Function CallService (ServiceName: PChar; wParam: TwParam; lParam: TlParam): integer; stdcall; {Function Returns Non Zero if a Service with the given Name Exists, otherwise 0} @@ -84,7 +84,7 @@ end; // 0 if Chain is called until the End, -1 if Event Handle is not valid // otherwise Return Value of the Hook that breaks the Chain //--------------- -Function NotivyEventHooks (hEvent: THandle; wParam, lParam: dWord): integer; stdcall; +Function NotivyEventHooks (hEvent: THandle; wParam: TwParam; lParam: TlParam): integer; stdcall; begin Result := Core.Hooks.CallEventChain(hEvent, wParam, lParam); end; @@ -139,7 +139,7 @@ end; // Function Calls a Services Proc // Returns Services Return Value or SERVICE_NOT_FOUND on Failure //--------------- -Function CallService (ServiceName: PChar; wParam, lParam: dWord): integer; stdcall; +Function CallService (ServiceName: PChar; wParam: TwParam; lParam: TlParam): integer; stdcall; begin Result := Core.Services.CallService(ServiceName, wParam, lParam); end; diff --git a/Game/Code/Classes/UServices.pas b/Game/Code/Classes/UServices.pas index 094c3fed..be1fcf2c 100644 --- a/Game/Code/Classes/UServices.pas +++ b/Game/Code/Classes/UServices.pas @@ -55,7 +55,7 @@ type Function AddService(const ServiceName: PChar; const Proc: TUS_Service = nil; const ProcofClass: TUS_Service_of_Object = nil): THandle; Function DelService(const hService: THandle): integer; - Function CallService(const ServiceName: PChar; const wParam, lParam: dWord): integer; + Function CallService(const ServiceName: PChar; const wParam: TwParam; lParam: TlParam): integer; Function NametoHash(const ServiceName: TServiceName): Integer; Function ServiceExists(const ServiceName: PChar): Integer; @@ -210,7 +210,7 @@ end; // Function Calls a Services Proc // Returns Services Return Value or SERVICE_NOT_FOUND on Failure //------------ -Function TServiceManager.CallService(const ServiceName: PChar; const wParam, lParam: dWord): integer; +Function TServiceManager.CallService(const ServiceName: PChar; const wParam: TwParam; lParam: TlParam): integer; var SExists: Integer; Service: PServiceInfo; diff --git a/Game/Code/Classes/uPluginLoader.pas b/Game/Code/Classes/uPluginLoader.pas index 87951fed..b018ccc2 100644 --- a/Game/Code/Classes/uPluginLoader.pas +++ b/Game/Code/Classes/uPluginLoader.pas @@ -65,10 +65,10 @@ type Procedure CallDeInit(Index: Cardinal); //Services offered - Function LoadPlugin(wParam, lParam: DWord): integer; //wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin - Function UnloadPlugin(wParam, lParam: DWord): integer; //wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin - Function GetPluginInfo(wParam, lParam: DWord): integer; //If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Get PluginInfo of Plugin with Index(wParam) to Address at lParam) - Function GetPluginState(wParam, lParam: DWord): integer; //If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Return PluginInfo of Plugin with Index(wParam)) + Function LoadPlugin(wParam: TwParam; lParam: TlParam): integer; //wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin + Function UnloadPlugin(wParam: TwParam; lParam: TlParam): integer; //wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin + Function GetPluginInfo(wParam: TwParam; lParam: TlParam): integer; //If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Get PluginInfo of Plugin with Index(wParam) to Address at lParam) + Function GetPluginState(wParam: TwParam; lParam: TlParam): integer; //If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Return PluginInfo of Plugin with Index(wParam)) end; @@ -163,7 +163,7 @@ begin BrowseDir(PluginPath); Except Result := False; - Core.ReportError(Integer(PChar('Error Browsing and Loading.')), Integer(PChar('TPluginLoader'))); + Core.ReportError(Integer(PChar('Error Browsing and Loading.')), PChar('TPluginLoader')); end; end; @@ -279,7 +279,7 @@ begin PInfo(@Info); Except Info.Name := ''; - Core.ReportError(Integer(PChar('Error getting Plugin Info: ' + Filename)), Integer(PChar('TPluginLoader'))); + Core.ReportError(Integer(PChar('Error getting Plugin Info: ' + Filename)), PChar('TPluginLoader')); end; //Is Name set ? @@ -312,7 +312,7 @@ begin begin Plugins[PluginID].State := 255; FreeLibrary(hLib); - Core.ReportError(Integer(PChar('Can''t get Plugin Procs from Libary: "' + Info.Name + '" ' + Filename)), Integer(PChar('TPluginLoader'))); + Core.ReportError(Integer(PChar('Can''t get Plugin Procs from Libary: "' + Info.Name + '" ' + Filename)), PChar('TPluginLoader')); end; //Emulate loading process if this Plugin is loaded to late @@ -326,10 +326,10 @@ begin begin If (Plugins[PluginID].Info.Version < Info.Version) then begin //Found newer Version of this Plugin - Core.ReportDebug(Integer(PChar('Found a newer Version of Plugin: ' + String(Info.Name))), Integer(PChar('TPluginLoader'))); + Core.ReportDebug(Integer(PChar('Found a newer Version of Plugin: ' + String(Info.Name))), PChar('TPluginLoader')); //Unload Old Plugin - UnloadPlugin(Integer(nil), PluginID); + UnloadPlugin(PluginID, nil); //Fill with new Info Plugins[PluginID].Info := Info; @@ -347,7 +347,7 @@ begin begin FreeLibrary(hLib); Plugins[PluginID].State := 255; - Core.ReportError(Integer(PChar('Can''t get Plugin Procs from Libary: "' + Info.Name + '" ' + Filename)), Integer(PChar('TPluginLoader'))); + Core.ReportError(Integer(PChar('Can''t get Plugin Procs from Libary: "' + Info.Name + '" ' + Filename)), PChar('TPluginLoader')); end; end else @@ -358,23 +358,23 @@ begin else begin FreeLibrary(hLib); - Core.ReportError(Integer(PChar('Plugin with this Name already exists: ' + String(Info.Name))), Integer(PChar('TPluginLoader'))); + Core.ReportError(Integer(PChar('Plugin with this Name already exists: ' + String(Info.Name))), PChar('TPluginLoader')); end; end else begin FreeLibrary(hLib); - Core.ReportError(Integer(PChar('No name reported: ' + Filename)), Integer(PChar('TPluginLoader'))); + Core.ReportError(Integer(PChar('No name reported: ' + Filename)), PChar('TPluginLoader')); end; end else begin FreeLibrary(hLib); - Core.ReportError(Integer(PChar('Can''t find Info Procedure: ' + Filename)), Integer(PChar('TPluginLoader'))); + Core.ReportError(Integer(PChar('Can''t find Info Procedure: ' + Filename)), PChar('TPluginLoader')); end; end else - Core.ReportError(Integer(PChar('Can''t load Plugin Libary: ' + Filename)), Integer(PChar('TPluginLoader'))); + Core.ReportError(Integer(PChar('Can''t load Plugin Libary: ' + Filename)), PChar('TPluginLoader')); end; end; @@ -400,7 +400,7 @@ begin begin FreePlugin(Index); Plugins[Index].State := 255; - Core.ReportError(Integer(PChar('Error calling Load Function from Plugin: ' + String(Plugins[Index].Info.Name))), Integer(PChar('TPluginLoader'))); + Core.ReportError(Integer(PChar('Error calling Load Function from Plugin: ' + String(Plugins[Index].Info.Name))), PChar('TPluginLoader')); end; end; end; @@ -431,7 +431,7 @@ begin begin FreePlugin(Index); Plugins[Index].State := 255; - Core.ReportError(Integer(PChar('Error calling Init Function from Plugin: ' + String(Plugins[Index].Info.Name))), Integer(PChar('TPluginLoader'))); + Core.ReportError(Integer(PChar('Error calling Init Function from Plugin: ' + String(Plugins[Index].Info.Name))), PChar('TPluginLoader')); end; end; end; @@ -478,9 +478,9 @@ end; //-------------- -// wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin +// wParam PChar(PluginName/PluginPath) | wParam (if lParam = nil) ID of the Plugin //-------------- -Function TPluginLoader.LoadPlugin(wParam, lParam: DWord): integer; +Function TPluginLoader.LoadPlugin(wParam: TwParam; lParam: TlParam): integer; var Index: Integer; sFile: String; @@ -488,14 +488,14 @@ begin Result := -1; sFile := ''; //lParam is ID - If (Pointer(wParam) = nil) then + If (lParam = nil) then begin - Index := lParam; + Index := wParam; end else - begin //wParam is PChar + begin //lParam is PChar try - sFile := String(PChar(Pointer(wParam))); + sFile := String(PChar(lParam)); Index := PluginExists(sFile); If (Index < 0) And FileExists(sFile) then begin //Is Filename @@ -516,23 +516,23 @@ begin end; //-------------- -// wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin +// wParam PChar(PluginName/PluginPath) | wParam (if lParam = nil) ID of the Plugin //-------------- -Function TPluginLoader.UnloadPlugin(wParam, lParam: DWord): integer; +Function TPluginLoader.UnloadPlugin(wParam: TwParam; lParam: TlParam): integer; var Index: Integer; sName: String; begin Result := -1; //lParam is ID - If (Pointer(wParam) = nil) then + If (lParam = nil) then begin - Index := lParam; + Index := wParam; end else begin //wParam is PChar try - sName := String(PChar(Pointer(wParam))); + sName := String(PChar(lParam)); Index := PluginExists(sName); except Index := -2; @@ -547,23 +547,23 @@ end; //-------------- // If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Get PluginInfo of Plugin with Index(wParam) to Address at lParam) //-------------- -Function TPluginLoader.GetPluginInfo(wParam, lParam: DWord): integer; +Function TPluginLoader.GetPluginInfo(wParam: TwParam; lParam: TlParam): integer; var I: Integer; begin Result := 0; - If (wParam < 0) then + If (wParam > 0) then begin //Get Info of 1 Plugin - If (Pointer(lParam) <> nil) AND (wParam < Length(Plugins)) then + If (lParam <> nil) AND (wParam < Length(Plugins)) then begin Try Result := 1; - PUS_PluginInfo(Pointer(lParam))^ := Plugins[wParam].Info; + PUS_PluginInfo(lParam)^ := Plugins[wParam].Info; Except End; end; end - Else If (Pointer(lParam) = nil) then + Else If (lParam = nil) then begin //Get Length of Plugin (Info) Array Result := Length(Plugins); end @@ -571,10 +571,10 @@ begin begin Try For I := 0 to high(Plugins) do - PAUS_PluginInfo(Pointer(lParam))^[I] := Plugins[I].Info; + PAUS_PluginInfo(lParam)^[I] := Plugins[I].Info; Result := Length(Plugins); Except - Core.ReportError(Integer(PChar('Could not write PluginInfo Array')), Integer(PChar('TPluginLoader'))); + Core.ReportError(Integer(PChar('Could not write PluginInfo Array')), PChar('TPluginLoader')); End; end; @@ -583,18 +583,18 @@ end; //-------------- // If wParam = -1 then (If lParam = nil then get length of Plugin State Array. If lparam <> nil then write array of Byte to address at lparam) Else (Return State of Plugin with Index(wParam)) //-------------- -Function TPluginLoader.GetPluginState(wParam, lParam: DWord): integer; +Function TPluginLoader.GetPluginState(wParam: TwParam; lParam: TlParam): integer; var I: Integer; begin Result := -1; - If (wParam < 0) then + If (wParam > 0) then begin //Get State of 1 Plugin If (wParam < Length(Plugins)) then begin Result := Plugins[wParam].State; end; end - Else If (Pointer(lParam) = nil) then + Else If (lParam = nil) then begin //Get Length of Plugin (Info) Array Result := Length(Plugins); end @@ -602,10 +602,10 @@ begin begin Try For I := 0 to high(Plugins) do - Byte(Pointer(lParam + I)^) := Plugins[I].State; + Byte(Pointer(Integer(lParam) + I)^) := Plugins[I].State; Result := Length(Plugins); Except - Core.ReportError(Integer(PChar('Could not write PluginState Array')), Integer(PChar('TPluginLoader'))); + Core.ReportError(Integer(PChar('Could not write PluginState Array')), PChar('TPluginLoader')); End; end; end; @@ -654,7 +654,7 @@ begin If (PluginLoader = nil) then begin Result := False; - Core.ReportError(Integer(PChar('Could not get Pointer to PluginLoader')), Integer(PChar('TtehPlugins'))); + Core.ReportError(Integer(PChar('Could not get Pointer to PluginLoader')), PChar('TtehPlugins')); end else begin @@ -676,10 +676,10 @@ begin begin PluginLoader.CallDeInit(I); PluginLoader.Plugins[I].State := 254; //Plugin asks for unload - Core.ReportDebug(Integer(PChar('Plugin Selfabort during loading process: ' + String(PluginLoader.Plugins[I].Info.Name))), Integer(PChar('TtehPlugins'))); + Core.ReportDebug(Integer(PChar('Plugin Selfabort during loading process: ' + String(PluginLoader.Plugins[I].Info.Name))), PChar('TtehPlugins')); end else - Core.ReportDebug(Integer(PChar('Plugin loaded succesful: ' + String(PluginLoader.Plugins[I].Info.Name))), Integer(PChar('TtehPlugins'))); + Core.ReportDebug(Integer(PChar('Plugin loaded succesful: ' + String(PluginLoader.Plugins[I].Info.Name))), PChar('TtehPlugins')); Inc(I); end; @@ -690,7 +690,7 @@ begin begin PluginLoader.CallDeInit(I); PluginLoader.Plugins[I].State := 255; //Plugin causes Error - Core.ReportError(Integer(PChar('Plugin causes Error during loading process: ' + PluginLoader.Plugins[I].Info.Name + ', ErrorMsg: "' + E.Message + '"')), Integer(PChar('TtehPlugins'))); + Core.ReportError(Integer(PChar('Plugin causes Error during loading process: ' + PluginLoader.Plugins[I].Info.Name + ', ErrorMsg: "' + E.Message + '"')), PChar('TtehPlugins')); //don't forget to increase I @@ -736,10 +736,10 @@ begin begin PluginLoader.CallDeInit(I); PluginLoader.Plugins[I].State := 254; //Plugin asks for unload - Core.ReportDebug(Integer(PChar('Plugin Selfabort during init process: ' + String(PluginLoader.Plugins[I].Info.Name))), Integer(PChar('TtehPlugins'))); + Core.ReportDebug(Integer(PChar('Plugin Selfabort during init process: ' + String(PluginLoader.Plugins[I].Info.Name))), PChar('TtehPlugins')); end else - Core.ReportDebug(Integer(PChar('Plugin inited succesful: ' + String(PluginLoader.Plugins[I].Info.Name))), Integer(PChar('TtehPlugins'))); + Core.ReportDebug(Integer(PChar('Plugin inited succesful: ' + String(PluginLoader.Plugins[I].Info.Name))), PChar('TtehPlugins')); //don't forget to increase I Inc(I); @@ -749,7 +749,7 @@ begin // => Show Error Message, then ShutDown Plugin PluginLoader.CallDeInit(I); PluginLoader.Plugins[I].State := 255; //Plugin causes Error - Core.ReportError(Integer(PChar('Plugin causes Error during init process: ' + String(PluginLoader.Plugins[I].Info.Name))), Integer(PChar('TtehPlugins'))); + Core.ReportError(Integer(PChar('Plugin causes Error during init process: ' + String(PluginLoader.Plugins[I].Info.Name))), PChar('TtehPlugins')); //don't forget to increase I Inc(I); -- cgit v1.2.3 From 6ca1db26350a589b5bcb3e2eac35a7965d5ab448 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Thu, 8 Nov 2007 18:51:40 +0000 Subject: Mac OS X: Added PseudoThread for debugging, because debugging of threaded code causes problems with Xcode and FreePascal. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@594 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCommandLine.pas | 4 + Game/Code/Classes/URecord.pas | 10 + Game/Code/Classes/USongs.pas | 25 ++- Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 | 141 ++++++++----- .../MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser | 231 ++++++++++----------- .../MacOSX/UltraStarDX.xcodeproj/project.pbxproj | 30 +-- Game/Code/MacOSX/Wrapper/MidiFile.pas | 102 --------- Game/Code/MacOSX/Wrapper/MidiOut.pas | 62 ------ Game/Code/MacOSX/Wrapper/PNGImage.pas | 14 -- Game/Code/MacOSX/Wrapper/PseudoThread.pas | 48 +++++ Game/Code/MacOSX/Wrapper/zlportio.pas | 31 --- 11 files changed, 306 insertions(+), 392 deletions(-) delete mode 100755 Game/Code/MacOSX/Wrapper/MidiFile.pas delete mode 100755 Game/Code/MacOSX/Wrapper/MidiOut.pas delete mode 100755 Game/Code/MacOSX/Wrapper/PNGImage.pas create mode 100755 Game/Code/MacOSX/Wrapper/PseudoThread.pas delete mode 100755 Game/Code/MacOSX/Wrapper/zlportio.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UCommandLine.pas b/Game/Code/Classes/UCommandLine.pas index 1539ffaf..01ece795 100644 --- a/Game/Code/Classes/UCommandLine.pas +++ b/Game/Code/Classes/UCommandLine.pas @@ -2,6 +2,10 @@ unit UCommandLine; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} diff --git a/Game/Code/Classes/URecord.pas b/Game/Code/Classes/URecord.pas index 87c35cd8..29a9d7f9 100644 --- a/Game/Code/Classes/URecord.pas +++ b/Game/Code/Classes/URecord.pas @@ -323,6 +323,16 @@ begin BASS_RecordInit(SC); InputName := BASS_RecordGetInputName(SCI); + + {$IFDEF DARWIN} + // Under MacOSX the SingStar Mics have an empty + // InputName. So, we have to add a hard coded + // Workaround for this problem + if (InputName = nil) and (Pos( 'USBMIC Serial#', Descr) > 0) then + begin + InputName := 'Microphone'; + end; + {$ENDIF} SetLength(SoundCard[SC].Input, 1); SoundCard[SC].Input[SCI].Name := InputName; diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index a04c1032..9b9ab7bb 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -8,6 +8,12 @@ interface {$I switches.inc} +{$IFDEF DARWIN} + {$IFDEF DEBUG} + {$DEFINE USE_PSEUDO_THREAD} + {$ENDIF} +{$ENDIF} + uses {$IFDEF MSWINDOWS} Windows, @@ -30,6 +36,9 @@ uses {$IFDEF DARWIN} cthreads, {$ENDIF} + {$IFDEF USE_PSEUDO_THREAD} + PseudoThread, + {$ENDIF} UCatCovers; type @@ -86,8 +95,13 @@ type OrderTyp: integer; // type of sorting for this button (0=name) CatNumber: integer; // Count of Songs in Category for Cats and Number of Song in Category for Songs end; - + + + {$IFDEF USE_PSEUDO_THREAD} + TSongs = class( TPseudoThread ) + {$ELSE} TSongs = class( TThread ) + {$ENDIF} private BrowsePos : Cardinal; //Actual Pos in Song Array fNotify , @@ -204,7 +218,9 @@ begin *) {$endif} - Setlength(Song, 0); +{$IFNDEF USE_PSEUDO_THREAD} + Setlength(Song, 0); +{$ENDIF} end; procedure TSongs.DoDirChanged(Sender: TObject); @@ -216,6 +232,9 @@ procedure TSongs.Execute(); var fChangeNotify : THandle; begin +{$IFDEF USE_PSEUDO_THREAD} + int_LoadSongList(); +{$ELSE} fParseSongDirectory := true; while not self.terminated do @@ -229,7 +248,7 @@ begin self.suspend; end; - +{$ENDIF} end; procedure TSongs.int_LoadSongList; diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 index bd9923d0..a847e918 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 @@ -190,24 +190,24 @@ Content PBXProjectModuleGUID - 2C82EFB60CDFC4BA00A79F26 + 2CEA2B810CE38FB40097A5FF PBXProjectModuleLabel - USongs.pas + URecord.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2C82EFB70CDFC4BA00A79F26 + 2CEA2B820CE38FB40097A5FF PBXProjectModuleLabel - USongs.pas + URecord.pas _historyCapacity 0 bookmark - 2CD986A80CDFDF790007B9C6 + 2CEA2B960CE391870097A5FF history - 2C82F12E0CDFDEA300A79F26 + 2CEA2B800CE38FA50097A5FF SplitCount @@ -223,7 +223,47 @@ PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 84 171 797 789 0 0 1680 1028 + 130 129 797 789 0 0 1680 1028 + + + + Content + + PBXProjectModuleGUID + 2CEA2B1B0CE38A270097A5FF + PBXProjectModuleLabel + PseudoThread.pas + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 2CEA2B1C0CE38A270097A5FF + PBXProjectModuleLabel + PseudoThread.pas + _historyCapacity + 0 + bookmark + 2CEA2B970CE391870097A5FF + history + + 2CEA2B060CE388ED0097A5FF + + + SplitCount + 1 + + StatusBarVisibility + + + Geometry + + Frame + {{0, 20}, {776, 858}} + PBXModuleWindowStatusBarHidden2 + + RubberWindowFrame + 15 124 776 899 0 0 1680 1028 @@ -244,10 +284,10 @@ _historyCapacity 0 bookmark - 2CD986A90CDFDF790007B9C6 + 2CEA2B980CE391870097A5FF history - 2C82F12F0CDFDEA300A79F26 + 2C3366B90CE129A900399210 SplitCount @@ -284,10 +324,10 @@ _historyCapacity 0 bookmark - 2CD986AA0CDFDF790007B9C6 + 2CEA2B990CE391870097A5FF history - 2C82F1300CDFDEA300A79F26 + 2C3366BA0CE129A900399210 SplitCount @@ -340,8 +380,6 @@ Layout - BecomeActive - ContentConfiguration PBXBottomSmartGroupGIDs @@ -410,7 +448,7 @@ 266 RubberWindowFrame - 764 270 817 753 0 0 1680 1028 + 760 270 817 753 0 0 1680 1028 Module PBXSmartGroupTreeModule @@ -447,7 +485,7 @@ Frame {{0, 0}, {529, 0}} RubberWindowFrame - 764 270 817 753 0 0 1680 1028 + 760 270 817 753 0 0 1680 1028 Module PBXNavigatorGroup @@ -455,6 +493,8 @@ 0pt + BecomeActive + ContentConfiguration PBXProjectModuleGUID @@ -467,7 +507,7 @@ Frame {{0, 5}, {529, 707}} RubberWindowFrame - 764 270 817 753 0 0 1680 1028 + 760 270 817 753 0 0 1680 1028 Module XCDetailModule @@ -491,9 +531,9 @@ TableOfContents - 2CD9869C0CDFDEE60007B9C6 + 2CEA2ACE0CE384040097A5FF 1CE0B1FE06471DED0097A5F4 - 2CD9869D0CDFDEE60007B9C6 + 2CEA2ACF0CE384040097A5FF 1CE0B20306471E060097A5F4 1CE0B20506471E060097A5F4 @@ -627,15 +667,22 @@ 5 WindowOrderList + 2CEA2B280CE38A270097A5FF + 2CEA2B290CE38A270097A5FF + 2CDD4BFC0CB948FC00549FAC + 2CEA2B260CE38A270097A5FF 2CDD4B730CB935C700549FAC + 1C0AD2B3069F1EA900FABCE6 2C82EF8B0CDFB9B300A79F26 2C82EFB90CDFC4BA00A79F26 + 2CEA2B1B0CE38A270097A5FF + 1C530D57069F1CE1000CFCEE + 2CEA2B810CE38FB40097A5FF /Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj - 2C82EFB60CDFC4BA00A79F26 - 1C0AD2B3069F1EA900FABCE6 + 1CD10A99069EF8BA00B06720 WindowString - 764 270 817 753 0 0 1680 1028 + 760 270 817 753 0 0 1680 1028 WindowTools @@ -656,7 +703,7 @@ PBXProjectModuleGUID 1CD0528F0623707200166675 PBXProjectModuleLabel - + URecord.pas StatusBarVisibility @@ -673,6 +720,8 @@ 566pt + BecomeActive + ContentConfiguration PBXProjectModuleGUID @@ -712,7 +761,7 @@ TableOfContents 2CDD4B730CB935C700549FAC - 2CD986A70CDFDF660007B9C6 + 2CEA2AD90CE384620097A5FF 1CD0528F0623707200166675 XCMainBuildResultsModuleGUID @@ -754,8 +803,8 @@ yes sizes - {{0, 0}, {337, 414}} - {{337, 0}, {627, 414}} + {{0, 0}, {335, 414}} + {{335, 0}, {629, 414}} VerticalSplitView @@ -818,14 +867,14 @@ TableOfContents 1CD10A99069EF8BA00B06720 - 2C82EF2D0CDFAB5700A79F26 + 2CEA2B200CE38A270097A5FF 1C162984064C10D400B95A72 - 2C82EF2E0CDFAB5700A79F26 - 2C82EF2F0CDFAB5700A79F26 - 2C82EF300CDFAB5700A79F26 - 2C82EF310CDFAB5700A79F26 - 2C82EF320CDFAB5700A79F26 - 2C82EF330CDFAB5700A79F26 + 2CEA2B210CE38A270097A5FF + 2CEA2B220CE38A270097A5FF + 2CEA2B230CE38A270097A5FF + 2CEA2B240CE38A270097A5FF + 2CEA2B250CE38A270097A5FF + 2CEA2B260CE38A270097A5FF ToolbarConfiguration xcode.toolbar.config.debug @@ -834,7 +883,7 @@ WindowToolGUID 1CD10A99069EF8BA00B06720 WindowToolIsVisible - + FirstTimeWindowDisplayed @@ -852,12 +901,14 @@ Dock + BecomeActive + ContentConfiguration PBXProjectModuleGUID 1CDD528C0622207200134675 PBXProjectModuleLabel - USongs.pas + URecord.pas StatusBarVisibility @@ -878,8 +929,6 @@ 502pt - BecomeActive - ContentConfiguration PBXProjectModuleGUID @@ -915,8 +964,8 @@ TableOfContents 1C530D57069F1CE1000CFCEE - 2C82EF7C0CDFB8FA00A79F26 - 2C82EF7D0CDFB8FA00A79F26 + 2CEA2B4B0CE38D340097A5FF + 2CEA2B4C0CE38D340097A5FF 1CDD528C0622207200134675 1CD0528E0623707200166675 @@ -944,8 +993,6 @@ Dock - BecomeActive - ContentConfiguration PBXProjectModuleGUID @@ -981,7 +1028,7 @@ TableOfContents 2CDD4BFC0CB948FC00549FAC - 2C82EF600CDFB7E100A79F26 + 2CEA2B270CE38A270097A5FF 1C78EAAC065D492600B07095 WindowString @@ -989,7 +1036,7 @@ WindowToolGUID 2CDD4BFC0CB948FC00549FAC WindowToolIsVisible - + FirstTimeWindowDisplayed @@ -1053,7 +1100,7 @@ Frame {{0, 0}, {1092, 660}} RubberWindowFrame - 568 148 1092 701 0 0 1680 1028 + 266 221 1092 701 0 0 1680 1028 Module PBXRunSessionModule @@ -1076,18 +1123,18 @@ TableOfContents 1C0AD2B3069F1EA900FABCE6 - 2CD986A10CDFDEE60007B9C6 + 2CEA2AD30CE384040097A5FF 1CD0528B0623707200166675 - 2CD986A20CDFDEE60007B9C6 + 2CEA2AD40CE384040097A5FF ToolbarConfiguration xcode.toolbar.config.run WindowString - 568 148 1092 701 0 0 1680 1028 + 266 221 1092 701 0 0 1680 1028 WindowToolGUID 1C0AD2B3069F1EA900FABCE6 WindowToolIsVisible - + FirstTimeWindowDisplayed diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser index 89340e56..481f2448 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser @@ -1,5 +1,25 @@ // !$*UTF8*$! { + 2C3366B90CE129A900399210 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C620CC9EC8C0031092D /* TextGL.pas */; + name = "TextGL.pas: 116"; + rLen = 0; + rLoc = 2871; + rType = 0; + vrLen = 1468; + vrLoc = 10961; + }; + 2C3366BA0CE129A900399210 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2CF3EF260CDE13BA004F5956 /* MacResources.pas */; + name = "MacResources.pas: 55"; + rLen = 0; + rLoc = 1218; + rType = 0; + vrLen = 2000; + vrLoc = 2591; + }; 2C4D9C620CC9EC8C0031092D /* TextGL.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {758, 7840}}"; @@ -11,8 +31,8 @@ 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {884, 9100}}"; - sepNavSelRange = "{16891, 0}"; - sepNavVisRect = "{{0, 8330}, {758, 716}}"; + sepNavSelRange = "{6579, 19}"; + sepNavVisRect = "{{0, 2661}, {758, 716}}"; sepNavWindowFrame = "{{15, 178}, {797, 845}}"; }; }; @@ -34,17 +54,17 @@ }; 2C4D9C660CC9EC8C0031092D /* UCommandLine.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {758, 4074}}"; - sepNavSelRange = "{54, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {758, 4130}}"; + sepNavSelRange = "{79, 0}"; sepNavVisRect = "{{0, 0}, {758, 716}}"; sepNavWindowFrame = "{{84, 115}, {797, 845}}"; }; }; 2C4D9C670CC9EC8C0031092D /* UCommon.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {749, 4186}}"; - sepNavSelRange = "{748, 12}"; - sepNavVisRect = "{{0, 234}, {749, 470}}"; + sepNavIntBoundsRect = "{{0, 0}, {715, 4228}}"; + sepNavSelRange = "{30, 42}"; + sepNavVisRect = "{{0, 0}, {715, 815}}"; sepNavWindowFrame = "{{38, 58}, {754, 944}}"; }; }; @@ -195,8 +215,8 @@ 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {998, 15246}}"; - sepNavSelRange = "{7062, 8}"; - sepNavVisRect = "{{0, 3832}, {749, 470}}"; + sepNavSelRange = "{7261, 0}"; + sepNavVisRect = "{{0, 3896}, {923, 342}}"; sepNavWindowFrame = "{{222, 91}, {1052, 743}}"; }; }; @@ -258,9 +278,9 @@ }; 2C4D9C840CC9EC8C0031092D /* URecord.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {749, 5054}}"; - sepNavSelRange = "{152, 4}"; - sepNavVisRect = "{{0, 0}, {749, 470}}"; + sepNavIntBoundsRect = "{{0, 0}, {749, 5194}}"; + sepNavSelRange = "{7313, 19}"; + sepNavVisRect = "{{0, 4333}, {749, 470}}"; sepNavWindowFrame = "{{130, 73}, {797, 845}}"; }; }; @@ -298,10 +318,10 @@ }; 2C4D9C890CC9EC8C0031092D /* USongs.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1052, 14686}}"; - sepNavSelRange = "{12734, 0}"; - sepNavVisRect = "{{0, 5934}, {758, 716}}"; - sepNavWindowFrame = "{{84, 115}, {797, 845}}"; + sepNavIntBoundsRect = "{{0, 0}, {1052, 14952}}"; + sepNavSelRange = "{9556, 0}"; + sepNavVisRect = "{{0, 5665}, {758, 716}}"; + sepNavWindowFrame = "{{15, 156}, {797, 845}}"; }; }; 2C4D9C8A0CC9EC8C0031092D /* UTextClasses.pas */ = { @@ -370,9 +390,9 @@ }; 2C4D9DCC0CC9EE6F0031092D /* UDisplay.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1277, 6678}}"; - sepNavSelRange = "{9419, 36}"; - sepNavVisRect = "{{0, 4975}, {1277, 312}}"; + sepNavIntBoundsRect = "{{0, 0}, {794, 6734}}"; + sepNavSelRange = "{9129, 0}"; + sepNavVisRect = "{{0, 4834}, {758, 716}}"; sepNavWindowFrame = "{{38, 157}, {797, 845}}"; }; }; @@ -463,22 +483,6 @@ sepNavVisRect = "{{0, 2054}, {749, 470}}"; }; }; - 2C4D9E000CC9EF840031092D /* Graphics.pas */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {620, 2674}}"; - sepNavSelRange = "{58, 56}"; - sepNavVisRect = "{{0, 0}, {577, 612}}"; - sepNavWindowFrame = "{{38, 261}, {616, 741}}"; - }; - }; - 2C4D9E010CC9EF840031092D /* JPEG.pas */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {602, 612}}"; - sepNavSelRange = "{53, 0}"; - sepNavVisRect = "{{0, 0}, {577, 612}}"; - sepNavWindowFrame = "{{61, 240}, {616, 741}}"; - }; - }; 2C4D9E040CC9EF840031092D /* OpenGL12.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1616, 65828}}"; @@ -503,80 +507,6 @@ sepNavWindowFrame = "{{15, 282}, {616, 741}}"; }; }; - 2C82F0E60CDFDBA000A79F26 /* USongs.pas:430 */ = { - isa = PBXFileBreakpoint; - actions = ( - ); - breakpointStyle = 0; - continueAfterActions = 0; - delayBeforeContinue = 0; - fileReference = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; - hitCount = 1; - lineNumber = 430; - location = UltraStarDX; - modificationTime = 215998015.652328; - state = 1; - }; - 2C82F12E0CDFDEA300A79F26 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; - name = "USongs.pas: 466"; - rLen = 0; - rLoc = 12734; - rType = 0; - vrLen = 1568; - vrLoc = 11360; - }; - 2C82F12F0CDFDEA300A79F26 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C620CC9EC8C0031092D /* TextGL.pas */; - name = "TextGL.pas: 116"; - rLen = 0; - rLoc = 2871; - rType = 0; - vrLen = 1468; - vrLoc = 10961; - }; - 2C82F1300CDFDEA300A79F26 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2CF3EF260CDE13BA004F5956 /* MacResources.pas */; - name = "MacResources.pas: 55"; - rLen = 0; - rLoc = 1218; - rType = 0; - vrLen = 2000; - vrLoc = 2591; - }; - 2CD986A80CDFDF790007B9C6 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; - name = "USongs.pas: 466"; - rLen = 0; - rLoc = 12734; - rType = 0; - vrLen = 1566; - vrLoc = 11360; - }; - 2CD986A90CDFDF790007B9C6 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C620CC9EC8C0031092D /* TextGL.pas */; - name = "TextGL.pas: 116"; - rLen = 0; - rLoc = 2871; - rType = 0; - vrLen = 1468; - vrLoc = 10961; - }; - 2CD986AA0CDFDF790007B9C6 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2CF3EF260CDE13BA004F5956 /* MacResources.pas */; - name = "MacResources.pas: 55"; - rLen = 0; - rLoc = 1218; - rType = 0; - vrLen = 2000; - vrLoc = 2591; - }; 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1013, 1022}}"; @@ -638,7 +568,6 @@ name = "Project Breakpoints"; objects = ( 2CDEA8080CBD7D920096994C /* UMain.pas:293 */, - 2C82F0E60CDFDBA000A79F26 /* USongs.pas:430 */, ); }; 2CDEA8080CBD7D920096994C /* UMain.pas:293 */ = { @@ -651,10 +580,69 @@ fileReference = 2CDD439C0CBBE92D00F364DE /* UMain.pas */; hitCount = 1; lineNumber = 293; - location = UltraStarDX; - modificationTime = 215998014.007265; + modificationTime = 216240504.343527; state = 1; }; + 2CEA2AF00CE3868E0097A5FF /* PseudoThread.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {737, 826}}"; + sepNavSelRange = "{415, 0}"; + sepNavVisRect = "{{0, 0}, {737, 826}}"; + sepNavWindowFrame = "{{15, 68}, {776, 955}}"; + }; + }; + 2CEA2B060CE388ED0097A5FF /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + comments = "error:column 30 - Only virtual methods can be abstract"; + fRef = 2CEA2AF00CE3868E0097A5FF /* PseudoThread.pas */; + rLen = 1; + rLoc = 19; + rType = 1; + }; + 2CEA2B800CE38FA50097A5FF /* PBXBookmark */ = { + isa = PBXBookmark; + fRef = 2C4D9C840CC9EC8C0031092D /* URecord.pas */; + }; + 2CEA2B960CE391870097A5FF /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C840CC9EC8C0031092D /* URecord.pas */; + name = "URecord.pas: 325"; + rLen = 0; + rLoc = 7340; + rType = 0; + vrLen = 1261; + vrLoc = 6977; + }; + 2CEA2B970CE391870097A5FF /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2CEA2AF00CE3868E0097A5FF /* PseudoThread.pas */; + name = "PseudoThread.pas: 23"; + rLen = 0; + rLoc = 415; + rType = 0; + vrLen = 764; + vrLoc = 0; + }; + 2CEA2B980CE391870097A5FF /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C620CC9EC8C0031092D /* TextGL.pas */; + name = "TextGL.pas: 116"; + rLen = 0; + rLoc = 2871; + rType = 0; + vrLen = 1468; + vrLoc = 10961; + }; + 2CEA2B990CE391870097A5FF /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2CF3EF260CDE13BA004F5956 /* MacResources.pas */; + name = "MacResources.pas: 55"; + rLen = 0; + rLoc = 1218; + rType = 0; + vrLen = 2000; + vrLoc = 2591; + }; 2CF3EF210CDE13A0004F5956 /* Messages.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1013, 614}}"; @@ -1060,7 +1048,6 @@ ); breakpoints = ( 2CDEA8080CBD7D920096994C /* UMain.pas:293 */, - 2C82F0E60CDFDBA000A79F26 /* USongs.pas:430 */, ); breakpointsGroup = 2CDD4B7F0CB9394600549FAC /* XCBreakpointsBucket */; codeSenseManager = 2CDD4B6A0CB9357000549FAC /* Code sense */; @@ -1166,16 +1153,18 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 215998180; - PBXWorkspaceStateSaveDate = 215998180; + PBXPerProjectTemplateStateSaveDate = 216237043; + PBXWorkspaceStateSaveDate = 216237043; }; perUserProjectItems = { - 2C82F12E0CDFDEA300A79F26 /* PBXTextBookmark */ = 2C82F12E0CDFDEA300A79F26 /* PBXTextBookmark */; - 2C82F12F0CDFDEA300A79F26 /* PBXTextBookmark */ = 2C82F12F0CDFDEA300A79F26 /* PBXTextBookmark */; - 2C82F1300CDFDEA300A79F26 /* PBXTextBookmark */ = 2C82F1300CDFDEA300A79F26 /* PBXTextBookmark */; - 2CD986A80CDFDF790007B9C6 /* PBXTextBookmark */ = 2CD986A80CDFDF790007B9C6 /* PBXTextBookmark */; - 2CD986A90CDFDF790007B9C6 /* PBXTextBookmark */ = 2CD986A90CDFDF790007B9C6 /* PBXTextBookmark */; - 2CD986AA0CDFDF790007B9C6 /* PBXTextBookmark */ = 2CD986AA0CDFDF790007B9C6 /* PBXTextBookmark */; + 2C3366B90CE129A900399210 /* PBXTextBookmark */ = 2C3366B90CE129A900399210 /* PBXTextBookmark */; + 2C3366BA0CE129A900399210 /* PBXTextBookmark */ = 2C3366BA0CE129A900399210 /* PBXTextBookmark */; + 2CEA2B060CE388ED0097A5FF /* PBXTextBookmark */ = 2CEA2B060CE388ED0097A5FF /* PBXTextBookmark */; + 2CEA2B800CE38FA50097A5FF /* PBXBookmark */ = 2CEA2B800CE38FA50097A5FF /* PBXBookmark */; + 2CEA2B960CE391870097A5FF /* PBXTextBookmark */ = 2CEA2B960CE391870097A5FF /* PBXTextBookmark */; + 2CEA2B970CE391870097A5FF /* PBXTextBookmark */ = 2CEA2B970CE391870097A5FF /* PBXTextBookmark */; + 2CEA2B980CE391870097A5FF /* PBXTextBookmark */ = 2CEA2B980CE391870097A5FF /* PBXTextBookmark */; + 2CEA2B990CE391870097A5FF /* PBXTextBookmark */ = 2CEA2B990CE391870097A5FF /* PBXTextBookmark */; }; sourceControlManager = 2CDD4B690CB9357000549FAC /* Source Control */; userBuildSettings = { diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj index 8495963a..a1515214 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj @@ -129,12 +129,8 @@ 2C4D9DF20CC9EF210031092D /* sdltruetypefont.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DF00CC9EF210031092D /* sdltruetypefont.pas */; }; 2C4D9DF30CC9EF210031092D /* sdl_ttf.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DEF0CC9EF210031092D /* sdl_ttf.pas */; }; 2C4D9DF40CC9EF210031092D /* sdltruetypefont.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DF00CC9EF210031092D /* sdltruetypefont.pas */; }; - 2C4D9E0C0CC9EF840031092D /* Graphics.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E000CC9EF840031092D /* Graphics.pas */; }; - 2C4D9E0D0CC9EF840031092D /* JPEG.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E010CC9EF840031092D /* JPEG.pas */; }; 2C4D9E100CC9EF840031092D /* OpenGL12.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E040CC9EF840031092D /* OpenGL12.pas */; }; 2C4D9E150CC9EF840031092D /* Windows.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; }; - 2C4D9E180CC9EF840031092D /* Graphics.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E000CC9EF840031092D /* Graphics.pas */; }; - 2C4D9E190CC9EF840031092D /* JPEG.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E010CC9EF840031092D /* JPEG.pas */; }; 2C4D9E1C0CC9EF840031092D /* OpenGL12.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E040CC9EF840031092D /* OpenGL12.pas */; }; 2C4D9E210CC9EF840031092D /* Windows.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; }; 2C4D9E450CC9F0ED0031092D /* switches.inc in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E440CC9F0ED0031092D /* switches.inc */; }; @@ -147,6 +143,12 @@ 2CDD4BE20CB947BE00549FAC /* UltraStarDX.pas in Sources */ = {isa = PBXBuildFile; fileRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; }; 2CDEA4F70CBD725B0096994C /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CDEA4F60CBD725B0096994C /* OpenGL.framework */; }; 2CDEC4960CC5264600FFA244 /* SDL.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 98B8BE570B1F972400162019 /* SDL.framework */; }; + 2CEA2AE00CE385190097A5FF /* Graphics.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CEA2ADE0CE385190097A5FF /* Graphics.pas */; }; + 2CEA2AE10CE385190097A5FF /* JPEG.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CEA2ADF0CE385190097A5FF /* JPEG.pas */; }; + 2CEA2AE20CE385190097A5FF /* Graphics.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CEA2ADE0CE385190097A5FF /* Graphics.pas */; }; + 2CEA2AE30CE385190097A5FF /* JPEG.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CEA2ADF0CE385190097A5FF /* JPEG.pas */; }; + 2CEA2AF10CE3868E0097A5FF /* PseudoThread.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CEA2AF00CE3868E0097A5FF /* PseudoThread.pas */; }; + 2CEA2AF20CE3868E0097A5FF /* PseudoThread.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CEA2AF00CE3868E0097A5FF /* PseudoThread.pas */; }; 2CF3EF220CDE13A0004F5956 /* Messages.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF3EF210CDE13A0004F5956 /* Messages.pas */; }; 2CF3EF230CDE13A0004F5956 /* Messages.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF3EF210CDE13A0004F5956 /* Messages.pas */; }; 2CF3EF270CDE13BA004F5956 /* MacResources.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF3EF260CDE13BA004F5956 /* MacResources.pas */; }; @@ -424,14 +426,15 @@ 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = sdl_image.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL_image/sdl_image.pas"; sourceTree = ""; tabWidth = 2; }; 2C4D9DEF0CC9EF210031092D /* sdl_ttf.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = sdl_ttf.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL_ttf/sdl_ttf.pas"; sourceTree = ""; tabWidth = 2; }; 2C4D9DF00CC9EF210031092D /* sdltruetypefont.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = sdltruetypefont.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL_ttf/sdltruetypefont.pas"; sourceTree = ""; tabWidth = 2; }; - 2C4D9E000CC9EF840031092D /* Graphics.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = Graphics.pas; path = Wrapper/Graphics.pas; sourceTree = ""; tabWidth = 2; }; - 2C4D9E010CC9EF840031092D /* JPEG.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = JPEG.pas; path = Wrapper/JPEG.pas; sourceTree = ""; tabWidth = 2; }; 2C4D9E040CC9EF840031092D /* OpenGL12.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = OpenGL12.pas; path = Wrapper/OpenGL12.pas; sourceTree = ""; tabWidth = 2; }; 2C4D9E090CC9EF840031092D /* Windows.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = Windows.pas; path = Wrapper/Windows.pas; sourceTree = ""; tabWidth = 2; }; 2C4D9E440CC9F0ED0031092D /* switches.inc */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = switches.inc; path = ../switches.inc; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4FA2A70CDBAD1E002CC3B0 /* ustar-icon_v01.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = "ustar-icon_v01.icns"; path = "../../Graphics/ustar-icon_v01.icns"; sourceTree = SOURCE_ROOT; }; 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = StrUtils.pas; path = ../../../Modis/SDK/StrUtils.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2CDEA4F60CBD725B0096994C /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; + 2CEA2ADE0CE385190097A5FF /* Graphics.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = Graphics.pas; path = Wrapper/Graphics.pas; sourceTree = ""; }; + 2CEA2ADF0CE385190097A5FF /* JPEG.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = JPEG.pas; path = Wrapper/JPEG.pas; sourceTree = ""; }; + 2CEA2AF00CE3868E0097A5FF /* PseudoThread.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = PseudoThread.pas; path = Wrapper/PseudoThread.pas; sourceTree = ""; }; 2CF3EF210CDE13A0004F5956 /* Messages.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = Messages.pas; path = Wrapper/Messages.pas; sourceTree = ""; tabWidth = 2; }; 2CF3EF260CDE13BA004F5956 /* MacResources.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = MacResources.pas; path = Wrapper/MacResources.pas; sourceTree = ""; tabWidth = 2; }; 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UScreenCredits.pas; path = ../Screens/UScreenCredits.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; @@ -545,10 +548,11 @@ 2C4D9DF50CC9EF3A0031092D /* Wrapper */ = { isa = PBXGroup; children = ( + 2CEA2AF00CE3868E0097A5FF /* PseudoThread.pas */, + 2CEA2ADE0CE385190097A5FF /* Graphics.pas */, + 2CEA2ADF0CE385190097A5FF /* JPEG.pas */, 2CF3EF260CDE13BA004F5956 /* MacResources.pas */, 2CF3EF210CDE13A0004F5956 /* Messages.pas */, - 2C4D9E000CC9EF840031092D /* Graphics.pas */, - 2C4D9E010CC9EF840031092D /* JPEG.pas */, 2C4D9E040CC9EF840031092D /* OpenGL12.pas */, 2C4D9E090CC9EF840031092D /* Windows.pas */, ); @@ -1024,8 +1028,6 @@ 2C4D9DED0CC9EF0A0031092D /* sdl_image.pas in Sources */, 2C4D9DF10CC9EF210031092D /* sdl_ttf.pas in Sources */, 2C4D9DF20CC9EF210031092D /* sdltruetypefont.pas in Sources */, - 2C4D9E0C0CC9EF840031092D /* Graphics.pas in Sources */, - 2C4D9E0D0CC9EF840031092D /* JPEG.pas in Sources */, 2C4D9E100CC9EF840031092D /* OpenGL12.pas in Sources */, 2C4D9E150CC9EF840031092D /* Windows.pas in Sources */, 2C4D9E450CC9F0ED0031092D /* switches.inc in Sources */, @@ -1078,6 +1080,9 @@ 2CF3EF220CDE13A0004F5956 /* Messages.pas in Sources */, 2CF3EF270CDE13BA004F5956 /* MacResources.pas in Sources */, 2CF8E6BE0CDFA8E80053A996 /* UPartyDefs.pas in Sources */, + 2CEA2AE00CE385190097A5FF /* Graphics.pas in Sources */, + 2CEA2AE10CE385190097A5FF /* JPEG.pas in Sources */, + 2CEA2AF10CE3868E0097A5FF /* PseudoThread.pas in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1146,8 +1151,6 @@ 2C4D9DEE0CC9EF0A0031092D /* sdl_image.pas in Sources */, 2C4D9DF30CC9EF210031092D /* sdl_ttf.pas in Sources */, 2C4D9DF40CC9EF210031092D /* sdltruetypefont.pas in Sources */, - 2C4D9E180CC9EF840031092D /* Graphics.pas in Sources */, - 2C4D9E190CC9EF840031092D /* JPEG.pas in Sources */, 2C4D9E1C0CC9EF840031092D /* OpenGL12.pas in Sources */, 2C4D9E210CC9EF840031092D /* Windows.pas in Sources */, 2C4D9E460CC9F0ED0031092D /* switches.inc in Sources */, @@ -1200,6 +1203,9 @@ 2CF3EF230CDE13A0004F5956 /* Messages.pas in Sources */, 2CF3EF280CDE13BA004F5956 /* MacResources.pas in Sources */, 2CF8E6BF0CDFA8E80053A996 /* UPartyDefs.pas in Sources */, + 2CEA2AE20CE385190097A5FF /* Graphics.pas in Sources */, + 2CEA2AE30CE385190097A5FF /* JPEG.pas in Sources */, + 2CEA2AF20CE3868E0097A5FF /* PseudoThread.pas in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Game/Code/MacOSX/Wrapper/MidiFile.pas b/Game/Code/MacOSX/Wrapper/MidiFile.pas deleted file mode 100755 index c91711cc..00000000 --- a/Game/Code/MacOSX/Wrapper/MidiFile.pas +++ /dev/null @@ -1,102 +0,0 @@ -unit MidiFile; - -{$I switches.inc} - -interface - -type - - TMidiEvent = record - event: byte; - data1: byte; - data2: byte; - str: string; - dticks: integer; - time: integer; - mtime: integer; - len: integer; - end; - PMidiEvent = ^TMidiEvent; - - TOnMidiEvent = procedure(event: PMidiEvent) of object; - - - TMidiTrack = class - private - public - OnMidiEvent: TOnMidiEvent; - function getEventCount: integer; - function getEvent(index: integer): PMidiEvent; - end; - - TMidiFile = class - private - FOnMidiEvent : TOnMidiEvent; - public - TicksPerQuarter, - NumberOfTracks, - BPM : Integer; - Filename : String; - Constructor Create(AParent : TObject); - procedure StartPlaying; - procedure StopPlaying; - procedure ReadFile; - function GetTrack(index: integer): TMidiTrack; - function getCurrentTime: integer; - function getTrackLength: integer; - property OnMidiEvent: TOnMidiEvent read FOnMidiEvent write FOnMidiEvent; - end; - - -implementation - -{ TMidiFile } - -constructor TMidiFile.Create(AParent: TObject); -begin - -end; - -function TMidiFile.getCurrentTime: integer; -begin - -end; - -function TMidiFile.GetTrack(index: integer): TMidiTrack; -begin - Result := TMidiTrack.Create; -end; - -function TMidiFile.getTrackLength: integer; -begin - -end; - -procedure TMidiFile.ReadFile; -begin - -end; - -procedure TMidiFile.StartPlaying; -begin - -end; - -procedure TMidiFile.StopPlaying; -begin - -end; - -{ TMidiTrack } - -function TMidiTrack.getEvent(index: integer): PMidiEvent; -begin - -end; - -function TMidiTrack.getEventCount: integer; -begin - -end; - -end. diff --git a/Game/Code/MacOSX/Wrapper/MidiOut.pas b/Game/Code/MacOSX/Wrapper/MidiOut.pas deleted file mode 100755 index e57da9d0..00000000 --- a/Game/Code/MacOSX/Wrapper/MidiOut.pas +++ /dev/null @@ -1,62 +0,0 @@ -unit MidiOut; - -{$I switches.inc} - -interface - -type - - TMidiOutput = class - public - ProductName : String; - Constructor Create(AParent : TObject); - procedure PutShort(MidiMessage: Byte; Data1: Byte; Data2: Byte); virtual; - function Open: Boolean; virtual; - function Close: Boolean; virtual; - {property MIDIHandle: Hmidiout read FMIDIHandle; - property DriverVersion: Version read FDriverVersion; - property Technology: OutPortTech read FTechnology write SetTechnology default opt_Synth; - property Voices: Word read FVoices; - property Notes: Word read FNotes; - property ChannelMask: Word read FChannelMask; - property Support: DWORD read FSupport; - property Error: Word read FError; - property Numdevs: Word read FNumdevs; - - procedure PutMidiEvent(theEvent: TMyMidiEvent); virtual; - procedure PutLong(TheSysex: Pointer; msgLength: Word); virtual; - procedure SetVolume(Left: Word; Right: Word); - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - - property ProductName: string read FProductName write SetProductName; - - property DeviceID: Integer read FDeviceID write SetDeviceID default 0; - property Onmidioutput: TNotifyEvent read FOnmidioutput write FOnmidioutput;} - end; - -implementation - -{ TMidiOutput } - -function TMidiOutput.Close: Boolean; -begin - -end; - -constructor TMidiOutput.Create(AParent: TObject); -begin - ProductName := 'UltraStar MidiOut Wrapper'; -end; - -function TMidiOutput.Open: Boolean; -begin - -end; - -procedure TMidiOutput.PutShort(MidiMessage, Data1, Data2: Byte); -begin - -end; - -end. diff --git a/Game/Code/MacOSX/Wrapper/PNGImage.pas b/Game/Code/MacOSX/Wrapper/PNGImage.pas deleted file mode 100755 index e2454a01..00000000 --- a/Game/Code/MacOSX/Wrapper/PNGImage.pas +++ /dev/null @@ -1,14 +0,0 @@ -unit PNGImage; - -{$I switches.inc} - -interface - -uses GlueGraphics; - -type - TPNGObject = TBitmap; - -implementation - -end. diff --git a/Game/Code/MacOSX/Wrapper/PseudoThread.pas b/Game/Code/MacOSX/Wrapper/PseudoThread.pas new file mode 100755 index 00000000..d81a5cfe --- /dev/null +++ b/Game/Code/MacOSX/Wrapper/PseudoThread.pas @@ -0,0 +1,48 @@ +unit PseudoThread; + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +interface + +type + + // Debugging threads with XCode doesn't seem to work. + // We use PseudoThread in Debug mode to get proper debugging. + TPseudoThread = class(TObject) + private + protected + Terminated, + FreeOnTerminate : Boolean; + procedure Execute; virtual; abstract; + procedure Resume; + procedure Suspend; + public + constructor Create(const suspended : Boolean); + end; + +implementation + +{ TPseudoThread } + +constructor TPseudoThread.Create(const suspended : Boolean); +begin + if not suspended then begin + Execute; + end; +end; + +procedure TPseudoThread.Resume; +begin + Execute; +end; + +procedure TPseudoThread.Suspend; +begin +end; + +end. + diff --git a/Game/Code/MacOSX/Wrapper/zlportio.pas b/Game/Code/MacOSX/Wrapper/zlportio.pas deleted file mode 100755 index 92b4a505..00000000 --- a/Game/Code/MacOSX/Wrapper/zlportio.pas +++ /dev/null @@ -1,31 +0,0 @@ -unit zlportio; - -{$I switches.inc} - -interface - -uses GlueWindows; - - procedure zlioportwrite( const Port,DataType,Data:dword ); - procedure portwriteb( const Port:Dword;const Data:byte ); - function GetTime : Real; - -implementation - -uses SysUtils; - -procedure zlioportwrite( const Port,DataType,Data:dword ); -begin -end; - -procedure portwriteb( const Port:Dword;const Data:byte ); -begin -end; - -function GetTime : Real; -begin - Result := Now; -end; - -end. - -- cgit v1.2.3 From a0ff0b75e3562e04f17f11fc41f2e49040d620c5 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Thu, 8 Nov 2007 21:02:07 +0000 Subject: Added UPlatform.pas. This should be the first step to move the simple platform specific code to one file for each platform to reduce the IFDEFs in the remaining files. The first available function is a unicode capable DirectoryFindFiles. It is now used in the BrowseDir function in file USongs.pas. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@595 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMain.pas | 3 - Game/Code/Classes/UPlatform.pas | 56 ++++++ Game/Code/Classes/UPlatformLinux.pas | 66 ++++++ Game/Code/Classes/UPlatformMacOSX.pas | 66 ++++++ Game/Code/Classes/UPlatformWindows.pas | 58 ++++++ Game/Code/Classes/USongs.pas | 222 ++++----------------- Game/Code/MacOSX/UltraStarDX.pas | 2 +- Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 | 171 ++++++---------- .../MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser | 209 ++++++++++--------- .../MacOSX/UltraStarDX.xcodeproj/project.pbxproj | 12 ++ Game/Code/UltraStar.dpr | 9 +- 11 files changed, 470 insertions(+), 404 deletions(-) create mode 100644 Game/Code/Classes/UPlatform.pas create mode 100644 Game/Code/Classes/UPlatformLinux.pas create mode 100644 Game/Code/Classes/UPlatformMacOSX.pas create mode 100644 Game/Code/Classes/UPlatformWindows.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index f25eaa87..c11b68d9 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -12,9 +12,6 @@ uses {$IFDEF MSWINDOWS} Windows, {$ENDIF} - {$IFDEF DARWIN} // needed for initialization of cthreads - cthreads, - {$ENDIF} SDL, UGraphic, UMusic, diff --git a/Game/Code/Classes/UPlatform.pas b/Game/Code/Classes/UPlatform.pas new file mode 100644 index 00000000..cc971bed --- /dev/null +++ b/Game/Code/Classes/UPlatform.pas @@ -0,0 +1,56 @@ +unit UPlatform; + +// Comment by Eddie: +// This unit defines an interface for platform specific utility functions. +// The Interface is implemented in separate files for each platform: +// UPlatformWindows, UPlatformLinux and UPlatformWindows. + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses Classes; + +type + + TDirectoryEntry = Record + Name : WideString; + IsDirectory : Boolean; + IsFile : Boolean; + end; + + TDirectoryEntryArray = Array of TDirectoryEntry; + + IPlatform = interface + + // DirectoryFindFiles returns all files matching the filter. Do not use '*' in the filter. + // If you set ReturnAllSubDirs = true all directories will be returned, if yout set it to false + // directories are completely ignored. + Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; + end; + +var + Platform : IPlatform; + +implementation + +uses + {$IFDEF MSWINDOWS} + UPlatformWindows; + {$ENDIF} + {$IFDEF LINUX} + UPlatformLinux; + {$ENDIF} + {$IFDEF DARWIN} + UPlatformMacOSX; + {$ENDIF} + +initialization + + Platform := TPlatform.Create; + +end. diff --git a/Game/Code/Classes/UPlatformLinux.pas b/Game/Code/Classes/UPlatformLinux.pas new file mode 100644 index 00000000..1713df1c --- /dev/null +++ b/Game/Code/Classes/UPlatformLinux.pas @@ -0,0 +1,66 @@ +unit UPlatformLinux; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses Classes, UPlatform; + +type + + TPlatform = class(TInterfacedObject, IPlatform) + public + Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; + end; + +implementation + +uses SysUtils, oldlinux; + +Function TPlatform.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; +var + i : Integer; + TheDir : oldlinux.pdir; + ADirent : oldlinux.pDirent; + Entry : Longint; + info : oldlinux.stat; + lAttrib : integer; +begin + i := 0; + Filter := LowerCase(Filter); + + TheDir := oldlinux.opendir( Dir ); + if Assigned(TheDir) then + repeat + ADirent := oldlinux.ReadDir(TheDir); + + If Assigned(ADirent) and (ADirent^.d_name <> '.') and (ADirent^.d_name <> '..') then + begin + lAttrib := FileGetAttr(Dir + ADirent^.d_name); + if ReturnAllSubDirs and ((lAttrib and faDirectory) <> 0) then + begin + SetLength( Result, i + 1); + Result[i].Name := ADirent^.d_name; + Result[i].IsDirectory := true; + Result[i].IsFile := false; + i := i + 1; + end + else if (Length(Filter) = 0) or (Pos( Filter, LowerCase(ADirent^.d_name)) > 0) then + begin + SetLength( Result, i + 1); + Result[i].Name := ADirent^.d_name; + Result[i].IsDirectory := false; + Result[i].IsFile := true; + i := i + 1; + end; + end; + Until ADirent = nil; + + oldlinux.CloseDir(TheDir); +end; + +end. diff --git a/Game/Code/Classes/UPlatformMacOSX.pas b/Game/Code/Classes/UPlatformMacOSX.pas new file mode 100644 index 00000000..56469299 --- /dev/null +++ b/Game/Code/Classes/UPlatformMacOSX.pas @@ -0,0 +1,66 @@ +unit UPlatformMacOSX; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses Classes, UPlatform; + +type + + TPlatform = class(TInterfacedObject, IPlatform) + public + Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; + end; + +implementation + +uses SysUtils, baseunix; + +Function TPlatform.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; +var + i : Integer; + TheDir : pdir; + ADirent : pDirent; + Entry : Longint; + info : stat; + lAttrib : integer; +begin + i := 0; + Filter := LowerCase(Filter); + + TheDir := FPOpenDir(Dir); + if Assigned(TheDir) then + repeat + ADirent := FPReadDir(TheDir); + + If Assigned(ADirent) and (ADirent^.d_name <> '.') and (ADirent^.d_name <> '..') then + begin + lAttrib := FileGetAttr(Dir + ADirent^.d_name); + if ReturnAllSubDirs and ((lAttrib and faDirectory) <> 0) then + begin + SetLength( Result, i + 1); + Result[i].Name := ADirent^.d_name; + Result[i].IsDirectory := true; + Result[i].IsFile := false; + i := i + 1; + end + else if (Length(Filter) = 0) or (Pos( Filter, LowerCase(ADirent^.d_name)) > 0) then + begin + SetLength( Result, i + 1); + Result[i].Name := ADirent^.d_name; + Result[i].IsDirectory := false; + Result[i].IsFile := true; + i := i + 1; + end; + end; + Until ADirent = nil; + + FPCloseDir(TheDir); +end; + +end. diff --git a/Game/Code/Classes/UPlatformWindows.pas b/Game/Code/Classes/UPlatformWindows.pas new file mode 100644 index 00000000..eb432335 --- /dev/null +++ b/Game/Code/Classes/UPlatformWindows.pas @@ -0,0 +1,58 @@ +unit UPlatformWindows; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses Classes, UPlatform; + +type + + TPlatform = class(TInterfacedObject, IPlatform) + public + Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; + end; + +implementation + +uses SysUtils, Windows; + +Function TPlatform.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; +var + i : Integer; + SR : TSearchRecW; +begin + i := 0; + Filter := LowerCase(Filter); + + if ReturnAllSubDirs then begin + if FindFirstW(Dir + '*', faDirectory, SR) = 0 then + repeat + if (SR.Name <> '.') and (SR.Name <> '..') then + begin + SetLength( Result, i + 1); + Result[i].Name := SR.Name; + Result[i].IsDirectory := true; + Result[i].IsFile := false; + i := i + 1; + end; + until FindNextW(SR) <> 0; + FindCloseW(SR); + end; + + if FindFirstW(Dir + '*' + Filter, 0, SR) = 0 then + repeat + SetLength( Result, i + 1); + Result[i].Name := SR.Name; + Result[i].IsDirectory := true; + Result[i].IsFile := false; + i := i + 1; + until FindNextW(SR) <> 0; + FindCloseW(SR); +end; + +end. diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 9b9ab7bb..dcca08bd 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -30,6 +30,7 @@ uses {$ENDIF} SysUtils, Classes, + UPlatform, ULog, UTexture, UCommon, @@ -299,198 +300,51 @@ begin self.resume; end; -// TODO : JB - THis whole function SUX ! and needs refactoring ! :P procedure TSongs.BrowseDir(Dir: widestring); var SLen: integer; - - {$ifdef Delphi} - SR: TSearchRecW; // for parsing Songs Directory - {$ENDIF} - - // eddie: can we merge that? is baseunix working on linux? oldlinux is - // not available on mac os x. - {$IFDEF LINUX} - TheDir : oldlinux.pdir; - ADirent : oldlinux.pDirent; - Entry : Longint; - info : oldlinux.stat; - {$ENDIF} - {$IFDEF DARWIN} - TheDir : pdir; - ADirent : pDirent; - Entry : Longint; - info : stat; - lAttrib : integer; - {$ENDIF} + i : Integer; + Files : TDirectoryEntryArray; begin - {$ifdef Delphi} - if FindFirstW(Dir + '*', faDirectory, SR) = 0 then // JB_Unicode - windows - begin - repeat - if (SR.Name <> '.') and (SR.Name <> '..') then - begin - BrowseDir(Dir + Sr.Name + PathDelim); - end - until FindNextw(SR) <> 0; - end; // if - FindClosew(SR); - - if FindFirstW(Dir + '*.txt', 0, SR) = 0 then - begin - repeat - SLen := BrowsePos; - - Song[SLen].Path := Dir; - Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); - Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); - Song[SLen].FileName := SR.Name; - - if (AnalyseFile(Song[SLen]) = false) then - Dec(BrowsePos) - else - begin - if Song[SLen].Cover = '' then - Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); - end; - - //Change Length Only every 50 Entrys - Inc(BrowsePos); - - if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then - begin - SetLength(Song, Length(Song) + 50); - end; - - until FindNextW(SR) <> 0; - end; // if FindFirst - FindCloseW(SR); - {$ENDIF} - - {$IFDEF LINUX} - // Itterate the Songs Directory... ( With unicode capable functions for linux ) - TheDir := oldlinux.opendir( Dir ); // JB_Unicode - linux - if TheDir <> nil then - begin - repeat - ADirent := oldlinux.ReadDir(TheDir); - - If ADirent<>Nil then - begin - With ADirent^ do - begin - - if ( name[0] <> '.') then - BrowseDir( Dir + name + pathdelim ); - - end; - end; - Until ADirent=Nil; - end; - - - - TheDir := oldlinux.opendir( Dir ); // JB_Unicode - linux - if TheDir <> nil then - begin - repeat - ADirent := oldlinux.ReadDir(TheDir); - - if ( ADirent <> Nil ) AND - ( pos( '.txt', ADirent^.name ) > 0 ) then - begin - writeln ('***** FOUND TXT' + ADirent^.name ); - - SLen := BrowsePos; - - Song[SLen].Path := Dir; - Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); - Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); - Song[SLen].FileName := ADirent^.name; - - if (AnalyseFile(Song[SLen]) = false) then - Dec(BrowsePos) - else - begin - if Song[SLen].Cover = '' then - Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); - end; - - //Change Length Only every 50 Entrys - Inc(BrowsePos); - if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then - begin - SetLength(Song, Length(Song) + 50); - end; - end; - - Until ADirent=Nil; - end; // if FindFirst - {$endif} - - {$IFDEF DARWIN} - // Itterate the Songs Directory... ( With unicode capable functions for linux ) - TheDir := FPOpenDir(Dir); // JB_Unicode - linux - if TheDir <> nil then - begin - repeat - ADirent := FPReadDir(TheDir); - - If assigned(ADirent) and (ADirent^.d_name <> '.') and (ADirent^.d_name <> '..') then - begin - lAttrib := FileGetAttr(Dir + ADirent^.d_name); - if (lAttrib and faDirectory) <> 0 then - begin - //Log.LogError('Entering dir "' + Dir + ADirent^.d_name + PathDelim + '" now.'); - BrowseDir(Dir + ADirent^.d_name + PathDelim); - end - else if Pos( '.txt', LowerCase(ADirent^.d_name)) > 0 then - begin - SLen := BrowsePos; - - try - Song[SLen].Path := Dir; - Song[SLen].Folder := Copy(String(Dir), Length(String(SongPath))+1, 10000); - Song[SLen].Folder := Copy(String(Song[SLen].Folder), 1, Pos( PathDelim , Song[SLen].Folder)-1); - Song[SLen].FileName := ADirent^.d_name; - //Log.LogError( 'Song: ' + ADirent^.d_name + ', Length(Song) = ' + inttostr(Length(Song)) + ', BrowsePos = ' + IntToStr(BrowsePos) + ', Dir = "' + Dir + '"'); - - if (AnalyseFile(Song[SLen]) = false) then - begin - Log.LogError('AnalyseFile failed for "' + ADirent^.d_name + '".'); - Dec(BrowsePos); - end - else - begin - if Song[SLen].Cover = '' then - Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); - end; - except - end; - - //Change Length Only every 50 Entrys - Inc(BrowsePos); - - if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then - begin - SetLength(Song, Length(Song) + 50); - end; - end; - end; - - Until ADirent=Nil; - - if (FPCloseDir(TheDir) <> 0) then + Files := Platform.DirectoryFindFiles( Dir, '.txt', true); + for i := 0 to Length(Files)-1 do + begin + if Files[i].IsDirectory then + begin + BrowseDir( Dir + Files[i].Name + PathDelim ); + end + else begin - Log.LogError('TSongs.BrowseDir: Exception: Error closing dir: "' + Dir + '".') + SLen := BrowsePos; + + Song[SLen].Path := Dir; + Song[SLen].Folder := Copy(String(Dir), Length(String(SongPath))+1, 10000); + Song[SLen].Folder := Copy(String(Song[SLen].Folder), 1, Pos( PathDelim , Song[SLen].Folder)-1); + Song[SLen].FileName := Files[i].Name; + + if (AnalyseFile(Song[SLen]) = false) then + begin + Log.LogError('AnalyseFile failed for "' + Files[i].Name + '".'); + Dec(BrowsePos); + end + else + begin + if Song[SLen].Cover = '' then + Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); + end; + + //Change Length Only every 50 Entrys + Inc(BrowsePos); + + if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then + begin + SetLength(Song, Length(Song) + 50); + end; end; - end; + end; + SetLength( Files, 0); - {$endif} - // Log.LogStatus('Parsing directory: ' + Dir + SR.Name, 'LoadSongList'); - - end; procedure TSongs.Sort(Order: integer); diff --git a/Game/Code/MacOSX/UltraStarDX.pas b/Game/Code/MacOSX/UltraStarDX.pas index 1b8a3b63..cab748c6 100644 --- a/Game/Code/MacOSX/UltraStarDX.pas +++ b/Game/Code/MacOSX/UltraStarDX.pas @@ -1,6 +1,6 @@ program UltraStarDX; -uses UMain, UMedia_dummy, UAudio_FFMpeg, UAudio_bass, USingNotes, UTextClasses, UVideo; +uses cthreads, UMain, UMedia_dummy, UAudio_FFMpeg, UAudio_bass, USingNotes, UTextClasses, UVideo; begin Main; diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 index a847e918..60534b6e 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 @@ -190,24 +190,24 @@ Content PBXProjectModuleGUID - 2CEA2B810CE38FB40097A5FF + 2C89379C0CE3A0CD005D8A87 PBXProjectModuleLabel - URecord.pas + USongs.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2CEA2B820CE38FB40097A5FF + 2C89379D0CE3A0CD005D8A87 PBXProjectModuleLabel - URecord.pas + USongs.pas _historyCapacity 0 bookmark - 2CEA2B960CE391870097A5FF + 2C8938830CE3AFCE005D8A87 history - 2CEA2B800CE38FA50097A5FF + 2C8938610CE3A901005D8A87 SplitCount @@ -223,31 +223,31 @@ PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 130 129 797 789 0 0 1680 1028 + 15 212 797 789 0 0 1680 1028 Content PBXProjectModuleGUID - 2CEA2B1B0CE38A270097A5FF + 2C89386D0CE3AD9B005D8A87 PBXProjectModuleLabel - PseudoThread.pas + UltraStarDX.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2CEA2B1C0CE38A270097A5FF + 2C89386E0CE3AD9B005D8A87 PBXProjectModuleLabel - PseudoThread.pas + UltraStarDX.pas _historyCapacity 0 bookmark - 2CEA2B970CE391870097A5FF + 2C8938840CE3AFCE005D8A87 history - 2CEA2B060CE388ED0097A5FF + 2C8938690CE3AD88005D8A87 SplitCount @@ -259,35 +259,35 @@ Geometry Frame - {{0, 20}, {776, 858}} + {{0, 20}, {987, 762}} PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 15 124 776 899 0 0 1680 1028 + 189 142 987 803 0 0 1680 1028 Content PBXProjectModuleGUID - 2C82EFB90CDFC4BA00A79F26 + 2C8938710CE3AD9B005D8A87 PBXProjectModuleLabel - TextGL.pas + UPlatformMacOSX.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2C82EFBA0CDFC4BA00A79F26 + 2C8938720CE3AD9B005D8A87 PBXProjectModuleLabel - TextGL.pas + UPlatformMacOSX.pas _historyCapacity 0 bookmark - 2CEA2B980CE391870097A5FF + 2C8938850CE3AFCE005D8A87 history - 2C3366B90CE129A900399210 + 2C8938630CE3AA53005D8A87 SplitCount @@ -299,51 +299,11 @@ Geometry Frame - {{0, 20}, {797, 748}} - PBXModuleWindowStatusBarHidden2 - - RubberWindowFrame - 38 213 797 789 0 0 1680 1028 - - - - Content - - PBXProjectModuleGUID - 2C82EF8B0CDFB9B300A79F26 - PBXProjectModuleLabel - MacResources.pas - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 2C82EF8C0CDFB9B300A79F26 - PBXProjectModuleLabel - MacResources.pas - _historyCapacity - 0 - bookmark - 2CEA2B990CE391870097A5FF - history - - 2C3366BA0CE129A900399210 - - - SplitCount - 1 - - StatusBarVisibility - - - Geometry - - Frame - {{0, 20}, {873, 642}} + {{0, 20}, {776, 859}} PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 200 304 873 683 0 0 1680 1028 + 12 87 776 900 0 0 1680 1028 @@ -380,6 +340,8 @@ Layout + BecomeActive + ContentConfiguration PBXBottomSmartGroupGIDs @@ -423,7 +385,7 @@ PBXSmartGroupTreeModuleOutlineStateSelectionKey - 17 + 22 15 0 @@ -448,7 +410,7 @@ 266 RubberWindowFrame - 760 270 817 753 0 0 1680 1028 + 759 271 817 753 0 0 1680 1028 Module PBXSmartGroupTreeModule @@ -485,7 +447,7 @@ Frame {{0, 0}, {529, 0}} RubberWindowFrame - 760 270 817 753 0 0 1680 1028 + 759 271 817 753 0 0 1680 1028 Module PBXNavigatorGroup @@ -493,8 +455,6 @@ 0pt - BecomeActive - ContentConfiguration PBXProjectModuleGUID @@ -507,7 +467,7 @@ Frame {{0, 5}, {529, 707}} RubberWindowFrame - 760 270 817 753 0 0 1680 1028 + 759 271 817 753 0 0 1680 1028 Module XCDetailModule @@ -531,9 +491,9 @@ TableOfContents - 2CEA2ACE0CE384040097A5FF + 2C8937960CE3A0CC005D8A87 1CE0B1FE06471DED0097A5F4 - 2CEA2ACF0CE384040097A5FF + 2C8937970CE3A0CC005D8A87 1CE0B20306471E060097A5F4 1CE0B20506471E060097A5F4 @@ -667,22 +627,21 @@ 5 WindowOrderList - 2CEA2B280CE38A270097A5FF - 2CEA2B290CE38A270097A5FF + 1C530D57069F1CE1000CFCEE + 2C8937D10CE3A1FF005D8A87 + 2C8937D20CE3A1FF005D8A87 2CDD4BFC0CB948FC00549FAC - 2CEA2B260CE38A270097A5FF 2CDD4B730CB935C700549FAC - 1C0AD2B3069F1EA900FABCE6 - 2C82EF8B0CDFB9B300A79F26 - 2C82EFB90CDFC4BA00A79F26 - 2CEA2B1B0CE38A270097A5FF - 1C530D57069F1CE1000CFCEE - 2CEA2B810CE38FB40097A5FF - /Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj 1CD10A99069EF8BA00B06720 + 2C8937230CE3926A005D8A87 + 2C8938710CE3AD9B005D8A87 + 2C89386D0CE3AD9B005D8A87 + 2C89379C0CE3A0CD005D8A87 + /Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj + 1C0AD2B3069F1EA900FABCE6 WindowString - 760 270 817 753 0 0 1680 1028 + 759 271 817 753 0 0 1680 1028 WindowTools @@ -698,12 +657,14 @@ Dock + BecomeActive + ContentConfiguration PBXProjectModuleGUID 1CD0528F0623707200166675 PBXProjectModuleLabel - URecord.pas + UPlatform.pas StatusBarVisibility @@ -720,8 +681,6 @@ 566pt - BecomeActive - ContentConfiguration PBXProjectModuleGUID @@ -761,7 +720,7 @@ TableOfContents 2CDD4B730CB935C700549FAC - 2CEA2AD90CE384620097A5FF + 2C89375C0CE396D8005D8A87 1CD0528F0623707200166675 XCMainBuildResultsModuleGUID @@ -803,8 +762,8 @@ yes sizes - {{0, 0}, {335, 414}} - {{335, 0}, {629, 414}} + {{0, 0}, {333, 414}} + {{333, 0}, {631, 414}} VerticalSplitView @@ -844,7 +803,7 @@ Frame {{0, 0}, {964, 788}} RubberWindowFrame - 227 161 964 829 0 0 1680 1028 + 227 162 964 829 0 0 1680 1028 Module PBXDebugSessionModule @@ -867,23 +826,23 @@ TableOfContents 1CD10A99069EF8BA00B06720 - 2CEA2B200CE38A270097A5FF + 2C89371D0CE3926A005D8A87 1C162984064C10D400B95A72 - 2CEA2B210CE38A270097A5FF - 2CEA2B220CE38A270097A5FF - 2CEA2B230CE38A270097A5FF - 2CEA2B240CE38A270097A5FF - 2CEA2B250CE38A270097A5FF - 2CEA2B260CE38A270097A5FF + 2C89371E0CE3926A005D8A87 + 2C89371F0CE3926A005D8A87 + 2C8937200CE3926A005D8A87 + 2C8937210CE3926A005D8A87 + 2C8937220CE3926A005D8A87 + 2C8937230CE3926A005D8A87 ToolbarConfiguration xcode.toolbar.config.debug WindowString - 227 161 964 829 0 0 1680 1028 + 227 162 964 829 0 0 1680 1028 WindowToolGUID 1CD10A99069EF8BA00B06720 WindowToolIsVisible - + FirstTimeWindowDisplayed @@ -908,7 +867,7 @@ PBXProjectModuleGUID 1CDD528C0622207200134675 PBXProjectModuleLabel - URecord.pas + UMusic.pas StatusBarVisibility @@ -964,8 +923,8 @@ TableOfContents 1C530D57069F1CE1000CFCEE - 2CEA2B4B0CE38D340097A5FF - 2CEA2B4C0CE38D340097A5FF + 2C89383B0CE3A559005D8A87 + 2C89383C0CE3A559005D8A87 1CDD528C0622207200134675 1CD0528E0623707200166675 @@ -974,7 +933,7 @@ WindowToolGUID 1C530D57069F1CE1000CFCEE WindowToolIsVisible - + Identifier @@ -1028,7 +987,7 @@ TableOfContents 2CDD4BFC0CB948FC00549FAC - 2CEA2B270CE38A270097A5FF + 2C8937D00CE3A1FF005D8A87 1C78EAAC065D492600B07095 WindowString @@ -1123,9 +1082,9 @@ TableOfContents 1C0AD2B3069F1EA900FABCE6 - 2CEA2AD30CE384040097A5FF + 2C8937C80CE3A1ED005D8A87 1CD0528B0623707200166675 - 2CEA2AD40CE384040097A5FF + 2C8937C90CE3A1ED005D8A87 ToolbarConfiguration xcode.toolbar.config.run @@ -1134,7 +1093,7 @@ WindowToolGUID 1C0AD2B3069F1EA900FABCE6 WindowToolIsVisible - + FirstTimeWindowDisplayed diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser index 481f2448..d421585b 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser @@ -1,25 +1,5 @@ // !$*UTF8*$! { - 2C3366B90CE129A900399210 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C620CC9EC8C0031092D /* TextGL.pas */; - name = "TextGL.pas: 116"; - rLen = 0; - rLoc = 2871; - rType = 0; - vrLen = 1468; - vrLoc = 10961; - }; - 2C3366BA0CE129A900399210 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2CF3EF260CDE13BA004F5956 /* MacResources.pas */; - name = "MacResources.pas: 55"; - rLen = 0; - rLoc = 1218; - rType = 0; - vrLen = 2000; - vrLoc = 2591; - }; 2C4D9C620CC9EC8C0031092D /* TextGL.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {758, 7840}}"; @@ -31,8 +11,8 @@ 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {884, 9100}}"; - sepNavSelRange = "{6579, 19}"; - sepNavVisRect = "{{0, 2661}, {758, 716}}"; + sepNavSelRange = "{16714, 12}"; + sepNavVisRect = "{{0, 8384}, {758, 716}}"; sepNavWindowFrame = "{{15, 178}, {797, 845}}"; }; }; @@ -70,9 +50,9 @@ }; 2C4D9C680CC9EC8C0031092D /* UCore.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1305, 7028}}"; - sepNavSelRange = "{12989, 64}"; - sepNavVisRect = "{{0, 6320}, {1305, 534}}"; + sepNavIntBoundsRect = "{{0, 0}, {1202, 7294}}"; + sepNavSelRange = "{12520, 0}"; + sepNavVisRect = "{{0, 844}, {758, 716}}"; sepNavWindowFrame = "{{107, 94}, {797, 845}}"; }; }; @@ -214,17 +194,17 @@ }; 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {998, 15246}}"; - sepNavSelRange = "{7261, 0}"; - sepNavVisRect = "{{0, 3896}, {923, 342}}"; + sepNavIntBoundsRect = "{{0, 0}, {1013, 15204}}"; + sepNavSelRange = "{137, 0}"; + sepNavVisRect = "{{0, 0}, {1013, 614}}"; sepNavWindowFrame = "{{222, 91}, {1052, 743}}"; }; }; 2C4D9C7C0CC9EC8C0031092D /* UMedia_dummy.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {758, 3920}}"; - sepNavSelRange = "{859, 0}"; - sepNavVisRect = "{{0, 3204}, {758, 716}}"; + sepNavIntBoundsRect = "{{0, 0}, {749, 3920}}"; + sepNavSelRange = "{4805, 0}"; + sepNavVisRect = "{{0, 1071}, {749, 470}}"; sepNavWindowFrame = "{{107, 94}, {797, 845}}"; }; }; @@ -239,8 +219,8 @@ 2C4D9C7E0CC9EC8C0031092D /* UMusic.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {749, 4494}}"; - sepNavSelRange = "{5162, 12}"; - sepNavVisRect = "{{0, 2580}, {749, 470}}"; + sepNavSelRange = "{4994, 0}"; + sepNavVisRect = "{{0, 4024}, {749, 470}}"; sepNavWindowFrame = "{{153, 52}, {797, 845}}"; }; }; @@ -278,9 +258,9 @@ }; 2C4D9C840CC9EC8C0031092D /* URecord.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {749, 5194}}"; - sepNavSelRange = "{7313, 19}"; - sepNavVisRect = "{{0, 4333}, {749, 470}}"; + sepNavIntBoundsRect = "{{0, 0}, {758, 5194}}"; + sepNavSelRange = "{7340, 0}"; + sepNavVisRect = "{{0, 4312}, {758, 716}}"; sepNavWindowFrame = "{{130, 73}, {797, 845}}"; }; }; @@ -318,9 +298,9 @@ }; 2C4D9C890CC9EC8C0031092D /* USongs.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1052, 14952}}"; - sepNavSelRange = "{9556, 0}"; - sepNavVisRect = "{{0, 5665}, {758, 716}}"; + sepNavIntBoundsRect = "{{0, 0}, {950, 12908}}"; + sepNavSelRange = "{8059, 0}"; + sepNavVisRect = "{{0, 4142}, {758, 716}}"; sepNavWindowFrame = "{{15, 156}, {797, 845}}"; }; }; @@ -507,6 +487,70 @@ sepNavWindowFrame = "{{15, 282}, {616, 741}}"; }; }; + 2C8937290CE393FB005D8A87 /* UPlatform.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {737, 826}}"; + sepNavSelRange = "{654, 0}"; + sepNavVisRect = "{{0, 0}, {737, 826}}"; + sepNavWindowFrame = "{{200, 62}, {776, 955}}"; + }; + }; + 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {737, 938}}"; + sepNavSelRange = "{1158, 0}"; + sepNavVisRect = "{{0, 111}, {737, 827}}"; + sepNavWindowFrame = "{{12, 31}, {776, 956}}"; + }; + }; + 2C8938610CE3A901005D8A87 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; + name = "USongs.pas: 467"; + rLen = 0; + rLoc = 8854; + rType = 0; + vrLen = 1589; + vrLoc = 12291; + }; + 2C8938630CE3AA53005D8A87 /* PBXBookmark */ = { + isa = PBXBookmark; + fRef = 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */; + }; + 2C8938690CE3AD88005D8A87 /* PBXBookmark */ = { + isa = PBXBookmark; + fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; + }; + 2C8938830CE3AFCE005D8A87 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; + name = "USongs.pas: 315"; + rLen = 0; + rLoc = 8059; + rType = 0; + vrLen = 1284; + vrLoc = 7645; + }; + 2C8938840CE3AFCE005D8A87 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; + name = "UltraStarDX.pas: 3"; + rLen = 0; + rLoc = 37; + rType = 0; + vrLen = 141; + vrLoc = 0; + }; + 2C8938850CE3AFCE005D8A87 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */; + name = "UPlatformMacOSX.pas: 52"; + rLen = 0; + rLoc = 1158; + rType = 0; + vrLen = 1411; + vrLoc = 80; + }; 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1013, 1022}}"; @@ -580,7 +624,8 @@ fileReference = 2CDD439C0CBBE92D00F364DE /* UMain.pas */; hitCount = 1; lineNumber = 293; - modificationTime = 216240504.343527; + location = UltraStarDX; + modificationTime = 216245614.79797; state = 1; }; 2CEA2AF00CE3868E0097A5FF /* PseudoThread.pas */ = { @@ -591,58 +636,6 @@ sepNavWindowFrame = "{{15, 68}, {776, 955}}"; }; }; - 2CEA2B060CE388ED0097A5FF /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - comments = "error:column 30 - Only virtual methods can be abstract"; - fRef = 2CEA2AF00CE3868E0097A5FF /* PseudoThread.pas */; - rLen = 1; - rLoc = 19; - rType = 1; - }; - 2CEA2B800CE38FA50097A5FF /* PBXBookmark */ = { - isa = PBXBookmark; - fRef = 2C4D9C840CC9EC8C0031092D /* URecord.pas */; - }; - 2CEA2B960CE391870097A5FF /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C840CC9EC8C0031092D /* URecord.pas */; - name = "URecord.pas: 325"; - rLen = 0; - rLoc = 7340; - rType = 0; - vrLen = 1261; - vrLoc = 6977; - }; - 2CEA2B970CE391870097A5FF /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2CEA2AF00CE3868E0097A5FF /* PseudoThread.pas */; - name = "PseudoThread.pas: 23"; - rLen = 0; - rLoc = 415; - rType = 0; - vrLen = 764; - vrLoc = 0; - }; - 2CEA2B980CE391870097A5FF /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C620CC9EC8C0031092D /* TextGL.pas */; - name = "TextGL.pas: 116"; - rLen = 0; - rLoc = 2871; - rType = 0; - vrLen = 1468; - vrLoc = 10961; - }; - 2CEA2B990CE391870097A5FF /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2CF3EF260CDE13BA004F5956 /* MacResources.pas */; - name = "MacResources.pas: 55"; - rLen = 0; - rLoc = 1218; - rType = 0; - vrLen = 2000; - vrLoc = 2591; - }; 2CF3EF210CDE13A0004F5956 /* Messages.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1013, 614}}"; @@ -957,10 +950,10 @@ }; 2CF551A70CDA356800627463 /* UltraStar.dpr */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1031, 2338}}"; - sepNavSelRange = "{6767, 0}"; - sepNavVisRect = "{{0, 1498}, {1031, 840}}"; - sepNavWindowFrame = "{{15, 54}, {1070, 969}}"; + sepNavIntBoundsRect = "{{0, 0}, {914, 2674}}"; + sepNavSelRange = "{4560, 0}"; + sepNavVisRect = "{{0, 990}, {737, 827}}"; + sepNavWindowFrame = "{{15, 67}, {776, 956}}"; }; }; 2CF552110CDA3D1400627463 /* UPluginDefs.pas */ = { @@ -1153,18 +1146,16 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 216237043; - PBXWorkspaceStateSaveDate = 216237043; + PBXPerProjectTemplateStateSaveDate = 216240742; + PBXWorkspaceStateSaveDate = 216240742; }; perUserProjectItems = { - 2C3366B90CE129A900399210 /* PBXTextBookmark */ = 2C3366B90CE129A900399210 /* PBXTextBookmark */; - 2C3366BA0CE129A900399210 /* PBXTextBookmark */ = 2C3366BA0CE129A900399210 /* PBXTextBookmark */; - 2CEA2B060CE388ED0097A5FF /* PBXTextBookmark */ = 2CEA2B060CE388ED0097A5FF /* PBXTextBookmark */; - 2CEA2B800CE38FA50097A5FF /* PBXBookmark */ = 2CEA2B800CE38FA50097A5FF /* PBXBookmark */; - 2CEA2B960CE391870097A5FF /* PBXTextBookmark */ = 2CEA2B960CE391870097A5FF /* PBXTextBookmark */; - 2CEA2B970CE391870097A5FF /* PBXTextBookmark */ = 2CEA2B970CE391870097A5FF /* PBXTextBookmark */; - 2CEA2B980CE391870097A5FF /* PBXTextBookmark */ = 2CEA2B980CE391870097A5FF /* PBXTextBookmark */; - 2CEA2B990CE391870097A5FF /* PBXTextBookmark */ = 2CEA2B990CE391870097A5FF /* PBXTextBookmark */; + 2C8938610CE3A901005D8A87 /* PBXTextBookmark */ = 2C8938610CE3A901005D8A87 /* PBXTextBookmark */; + 2C8938630CE3AA53005D8A87 /* PBXBookmark */ = 2C8938630CE3AA53005D8A87 /* PBXBookmark */; + 2C8938690CE3AD88005D8A87 /* PBXBookmark */ = 2C8938690CE3AD88005D8A87 /* PBXBookmark */; + 2C8938830CE3AFCE005D8A87 /* PBXTextBookmark */ = 2C8938830CE3AFCE005D8A87 /* PBXTextBookmark */; + 2C8938840CE3AFCE005D8A87 /* PBXTextBookmark */ = 2C8938840CE3AFCE005D8A87 /* PBXTextBookmark */; + 2C8938850CE3AFCE005D8A87 /* PBXTextBookmark */ = 2C8938850CE3AFCE005D8A87 /* PBXTextBookmark */; }; sourceControlManager = 2CDD4B690CB9357000549FAC /* Source Control */; userBuildSettings = { @@ -1172,9 +1163,9 @@ }; DDC6851B09F57195004E4BFF /* UltraStarDX.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {923, 342}}"; - sepNavSelRange = "{117, 0}"; - sepNavVisRect = "{{0, 0}, {923, 342}}"; + sepNavIntBoundsRect = "{{0, 0}, {948, 730}}"; + sepNavSelRange = "{37, 0}"; + sepNavVisRect = "{{0, 0}, {948, 730}}"; sepNavWindowFrame = "{{189, 86}, {987, 859}}"; }; }; diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj index a1515214..c1ce71ee 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj @@ -136,6 +136,10 @@ 2C4D9E450CC9F0ED0031092D /* switches.inc in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E440CC9F0ED0031092D /* switches.inc */; }; 2C4D9E460CC9F0ED0031092D /* switches.inc in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E440CC9F0ED0031092D /* switches.inc */; }; 2C4FA2A80CDBAD1E002CC3B0 /* ustar-icon_v01.icns in Resources */ = {isa = PBXBuildFile; fileRef = 2C4FA2A70CDBAD1E002CC3B0 /* ustar-icon_v01.icns */; }; + 2C89372A0CE393FB005D8A87 /* UPlatform.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C8937290CE393FB005D8A87 /* UPlatform.pas */; }; + 2C89372B0CE393FB005D8A87 /* UPlatform.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C8937290CE393FB005D8A87 /* UPlatform.pas */; }; + 2C8937340CE395CE005D8A87 /* UPlatformMacOSX.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */; }; + 2C8937370CE395CE005D8A87 /* UPlatformMacOSX.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */; }; 2CDC716C0CDB9CB70018F966 /* StrUtils.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */; }; 2CDC716D0CDB9CB70018F966 /* StrUtils.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */; }; 2CDD4BDE0CB947A400549FAC /* sdl.pas in Sources */ = {isa = PBXBuildFile; fileRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; }; @@ -430,6 +434,8 @@ 2C4D9E090CC9EF840031092D /* Windows.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = Windows.pas; path = Wrapper/Windows.pas; sourceTree = ""; tabWidth = 2; }; 2C4D9E440CC9F0ED0031092D /* switches.inc */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = switches.inc; path = ../switches.inc; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4FA2A70CDBAD1E002CC3B0 /* ustar-icon_v01.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = "ustar-icon_v01.icns"; path = "../../Graphics/ustar-icon_v01.icns"; sourceTree = SOURCE_ROOT; }; + 2C8937290CE393FB005D8A87 /* UPlatform.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UPlatform.pas; path = ../Classes/UPlatform.pas; sourceTree = SOURCE_ROOT; }; + 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; lineEnding = 0; name = UPlatformMacOSX.pas; path = ../Classes/UPlatformMacOSX.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = StrUtils.pas; path = ../../../Modis/SDK/StrUtils.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2CDEA4F60CBD725B0096994C /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; 2CEA2ADE0CE385190097A5FF /* Graphics.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = Graphics.pas; path = Wrapper/Graphics.pas; sourceTree = ""; }; @@ -562,6 +568,8 @@ 2CDD43820CBBE8D400F364DE /* Classes */ = { isa = PBXGroup; children = ( + 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */, + 2C8937290CE393FB005D8A87 /* UPlatform.pas */, 2C4D9C620CC9EC8C0031092D /* TextGL.pas */, 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */, 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */, @@ -1083,6 +1091,8 @@ 2CEA2AE00CE385190097A5FF /* Graphics.pas in Sources */, 2CEA2AE10CE385190097A5FF /* JPEG.pas in Sources */, 2CEA2AF10CE3868E0097A5FF /* PseudoThread.pas in Sources */, + 2C89372A0CE393FB005D8A87 /* UPlatform.pas in Sources */, + 2C8937340CE395CE005D8A87 /* UPlatformMacOSX.pas in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1206,6 +1216,8 @@ 2CEA2AE20CE385190097A5FF /* Graphics.pas in Sources */, 2CEA2AE30CE385190097A5FF /* JPEG.pas in Sources */, 2CEA2AF20CE3868E0097A5FF /* PseudoThread.pas in Sources */, + 2C89372B0CE393FB005D8A87 /* UPlatform.pas in Sources */, + 2C8937370CE395CE005D8A87 /* UPlatformMacOSX.pas in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 0ab28cb6..fcc56d33 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -101,9 +101,16 @@ uses uPluginLoader in 'Classes\uPluginLoader.pas', //New Plugin Loader Module UParty in 'Classes\UParty.pas', // to - do : rewrite Party Manager as Module, reomplent ability to offer party Mody by Plugin + UPlatform in 'Classes\UPlatform.pas', +{$IFDEF WIN32} + UPlatformWindows in 'Classes\UPlatformWindows.pas', +{$ENDIF} +{$IFDEF LINUX} + UPlatformLinux in 'Classes\UPlatformLinux.pas', +{$ENDIF} {$IFDEF FPC} - ulazjpeg in 'Classes\Ulazjpeg.pas', + ulazjpeg in 'Classes\Ulazjpeg.pas', {$ENDIF} -- cgit v1.2.3 From d2254ffc1eb4bfe47ee68311eea21892b1bcc5d9 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Thu, 8 Nov 2007 21:09:23 +0000 Subject: Added missing functions. I Hope this fixes the build on Windows. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@596 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlatformWindows.pas | 70 ++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlatformWindows.pas b/Game/Code/Classes/UPlatformWindows.pas index eb432335..c7965761 100644 --- a/Game/Code/Classes/UPlatformWindows.pas +++ b/Game/Code/Classes/UPlatformWindows.pas @@ -11,6 +11,16 @@ interface uses Classes, UPlatform; type + + TSearchRecW = record + Time: Integer; + Size: Integer; + Attr: Integer; + Name: WideString; + ExcludeAttr: Integer; + FindHandle: THandle; + FindData: TWin32FindDataW; + end; TPlatform = class(TInterfacedObject, IPlatform) public @@ -21,6 +31,66 @@ implementation uses SysUtils, Windows; +function FindFirstW(const Path: widestring; Attr: Integer; var F: TSearchRecW): Integer; +const + faSpecial = faHidden or faSysFile or faVolumeID or faDirectory; +begin + F.ExcludeAttr := not Attr and faSpecial; + F.FindHandle := FindFirstFileW(PWideChar(Path), F.FindData); + if F.FindHandle <> INVALID_HANDLE_VALUE then + begin + Result := FindMatchingFileW(F); + if Result <> 0 then FindCloseW(F); + end else + Result := GetLastError; +end; + +function FindNextW(var F: TSearchRecW): Integer; +begin + if FindNextFileW(F.FindHandle, F.FindData) then + Result := FindMatchingFileW(F) + else + Result := GetLastError; +end; + +procedure FindCloseW(var F: TSearchRecW); +begin + if F.FindHandle <> INVALID_HANDLE_VALUE then + begin + Windows.FindClose(F.FindHandle); + F.FindHandle := INVALID_HANDLE_VALUE; + end; +end; + +function FindMatchingFileW(var F: TSearchRecW): Integer; +var + LocalFileTime: TFileTime; +begin + with F do + begin + while FindData.dwFileAttributes and ExcludeAttr <> 0 do + if not FindNextFileW(FindHandle, FindData) then + begin + Result := GetLastError; + Exit; + end; + FileTimeToLocalFileTime(FindData.ftLastWriteTime, LocalFileTime); + FileTimeToDosDateTime(LocalFileTime, LongRec(Time).Hi, LongRec(Time).Lo); + Size := FindData.nFileSizeLow; + Attr := FindData.dwFileAttributes; + Name := FindData.cFileName; + end; + Result := 0; +end; + +function DirectoryExistsW(const Directory: widestring): Boolean; +var + Code: Integer; +begin + Code := GetFileAttributesW(PWideChar(Directory)); + Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0); +end; + Function TPlatform.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; var i : Integer; -- cgit v1.2.3 From 5b4785d36f83f3361f89b33c84839591969d24a6 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Thu, 8 Nov 2007 21:15:01 +0000 Subject: Changed d_name to name. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@597 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlatformLinux.pas | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlatformLinux.pas b/Game/Code/Classes/UPlatformLinux.pas index 1713df1c..fd06097d 100644 --- a/Game/Code/Classes/UPlatformLinux.pas +++ b/Game/Code/Classes/UPlatformLinux.pas @@ -38,21 +38,21 @@ begin repeat ADirent := oldlinux.ReadDir(TheDir); - If Assigned(ADirent) and (ADirent^.d_name <> '.') and (ADirent^.d_name <> '..') then + If Assigned(ADirent) and (ADirent^.name <> '.') and (ADirent^.name <> '..') then begin - lAttrib := FileGetAttr(Dir + ADirent^.d_name); + lAttrib := FileGetAttr(Dir + ADirent^.name); if ReturnAllSubDirs and ((lAttrib and faDirectory) <> 0) then begin SetLength( Result, i + 1); - Result[i].Name := ADirent^.d_name; + Result[i].Name := ADirent^.name; Result[i].IsDirectory := true; Result[i].IsFile := false; i := i + 1; end - else if (Length(Filter) = 0) or (Pos( Filter, LowerCase(ADirent^.d_name)) > 0) then + else if (Length(Filter) = 0) or (Pos( Filter, LowerCase(ADirent^.name)) > 0) then begin SetLength( Result, i + 1); - Result[i].Name := ADirent^.d_name; + Result[i].Name := ADirent^.name; Result[i].IsDirectory := false; Result[i].IsFile := true; i := i + 1; -- cgit v1.2.3 From b2a203f519a2a4d13ffdad2cedb9fcfa2d07db8b Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Thu, 8 Nov 2007 21:21:20 +0000 Subject: Move the TSearchRecW record to the implementation part. This should fix the compilation error. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@598 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlatformWindows.pas | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlatformWindows.pas b/Game/Code/Classes/UPlatformWindows.pas index c7965761..1786d6cc 100644 --- a/Game/Code/Classes/UPlatformWindows.pas +++ b/Game/Code/Classes/UPlatformWindows.pas @@ -10,6 +10,17 @@ interface uses Classes, UPlatform; +type + + TPlatform = class(TInterfacedObject, IPlatform) + public + Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; + end; + +implementation + +uses SysUtils, Windows; + type TSearchRecW = record @@ -22,14 +33,6 @@ type FindData: TWin32FindDataW; end; - TPlatform = class(TInterfacedObject, IPlatform) - public - Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; - end; - -implementation - -uses SysUtils, Windows; function FindFirstW(const Path: widestring; Attr: Integer; var F: TSearchRecW): Integer; const -- cgit v1.2.3 From e83126a1e93f274c32e4a243f93d1dc2bcb63c44 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Thu, 8 Nov 2007 21:25:57 +0000 Subject: Added forward declarations... git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@599 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlatformWindows.pas | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlatformWindows.pas b/Game/Code/Classes/UPlatformWindows.pas index 1786d6cc..f78b87ec 100644 --- a/Game/Code/Classes/UPlatformWindows.pas +++ b/Game/Code/Classes/UPlatformWindows.pas @@ -33,6 +33,11 @@ type FindData: TWin32FindDataW; end; +function FindFirstW(const Path: WideString; Attr: Integer; var F: TSearchRecW): Integer; forward; +function FindNextW(var F: TSearchRecW): Integer; forward; +procedure FindCloseW(var F: TSearchRecW); forward; +function FindMatchingFileW(var F: TSearchRecW): Integer; forward; +function DirectoryExistsW(const Directory: widestring): Boolean; forward; function FindFirstW(const Path: widestring; Attr: Integer; var F: TSearchRecW): Integer; const -- cgit v1.2.3 From fad9bf088ffa01246ca1ada66a0c1ab81f07108b Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Thu, 8 Nov 2007 21:56:26 +0000 Subject: Removed the String() casts. Now BrowseDir is unicode capable again. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@600 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/USongs.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index dcca08bd..0ffa2a8d 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -318,8 +318,8 @@ begin SLen := BrowsePos; Song[SLen].Path := Dir; - Song[SLen].Folder := Copy(String(Dir), Length(String(SongPath))+1, 10000); - Song[SLen].Folder := Copy(String(Song[SLen].Folder), 1, Pos( PathDelim , Song[SLen].Folder)-1); + Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); + Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); Song[SLen].FileName := Files[i].Name; if (AnalyseFile(Song[SLen]) = false) then -- cgit v1.2.3 From fba9a67e3718a65594dc7969dac952ce5cca99d8 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Thu, 8 Nov 2007 23:18:12 +0000 Subject: Fixed song loading on Windows. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@601 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlatformWindows.pas | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlatformWindows.pas b/Game/Code/Classes/UPlatformWindows.pas index f78b87ec..7e65d700 100644 --- a/Game/Code/Classes/UPlatformWindows.pas +++ b/Game/Code/Classes/UPlatformWindows.pas @@ -103,32 +103,33 @@ Function TPlatform.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs var i : Integer; SR : TSearchRecW; + lAttrib : Integer; begin i := 0; Filter := LowerCase(Filter); - if ReturnAllSubDirs then begin - if FindFirstW(Dir + '*', faDirectory, SR) = 0 then - repeat - if (SR.Name <> '.') and (SR.Name <> '..') then + if FindFirstW(Dir + '*', faAnyFile or faDirectory, SR) = 0 then + repeat + if (SR.Name <> '.') and (SR.Name <> '..') then + begin + lAttrib := FileGetAttr(Dir + SR.name); + if ReturnAllSubDirs and ((lAttrib and faDirectory) <> 0) then begin SetLength( Result, i + 1); - Result[i].Name := SR.Name; + Result[i].Name := SR.name; Result[i].IsDirectory := true; Result[i].IsFile := false; i := i + 1; + end + else if (Length(Filter) = 0) or (Pos( Filter, LowerCase(SR.Name)) > 0) then + begin + SetLength( Result, i + 1); + Result[i].Name := SR.Name; + Result[i].IsDirectory := false; + Result[i].IsFile := true; + i := i + 1; end; - until FindNextW(SR) <> 0; - FindCloseW(SR); - end; - - if FindFirstW(Dir + '*' + Filter, 0, SR) = 0 then - repeat - SetLength( Result, i + 1); - Result[i].Name := SR.Name; - Result[i].IsDirectory := true; - Result[i].IsFile := false; - i := i + 1; + end; until FindNextW(SR) <> 0; FindCloseW(SR); end; -- cgit v1.2.3 From e7b509d9fcf5251f19cad8465b80792463932d06 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sun, 11 Nov 2007 23:00:17 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@603 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UIni.pas | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index 998a1d4b..040a0cdb 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -271,15 +271,12 @@ begin // Resolution SetLength(IResolution, 0); Modes := SDL_ListModes(nil, SDL_OPENGL or SDL_FULLSCREEN); // Check if there are any modes available - repeat + while Assigned(Modes) do //this should solve the biggest wine problem | THANKS Linnex (11.11.07) + begin SetLength(IResolution, Length(IResolution) + 1); IResolution[High(IResolution)] := IntToStr(Modes^.w) + 'x' + IntToStr(Modes^.h); - Tekst := IniFile.ReadString('Graphics', 'Screens', IScreens[0]); - - Log.LogStatus('SDL_ListModes Res : ' + IResolution[High(IResolution)], 'Graphics - Resolutions'); - Inc(Modes); - until Modes^ = nil; + end; // if no modes were set, then failback to 800x600 // as per http://sourceforge.net/forum/message.php?msg_id=4544965 -- cgit v1.2.3 From 318b273351e334c61ebf114508044043ee96cb35 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 19 Nov 2007 00:29:54 +0000 Subject: fixed bug in UIni ( on linux at least ) todo with SDL Initialization. Modifed Theme selection screen, so ALL theme options are runtime changable. ( Without restart ) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@610 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UIni.pas | 3 +- Game/Code/Screens/UScreenOptionsThemes.pas | 330 +++++++++++++++-------------- 2 files changed, 168 insertions(+), 165 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index 040a0cdb..ef135e65 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -270,8 +270,9 @@ begin // Resolution SetLength(IResolution, 0); + Modes^ := nil; Modes := SDL_ListModes(nil, SDL_OPENGL or SDL_FULLSCREEN); // Check if there are any modes available - while Assigned(Modes) do //this should solve the biggest wine problem | THANKS Linnex (11.11.07) + while assigned( Modes^ ) do //this should solve the biggest wine problem | THANKS Linnex (11.11.07) begin SetLength(IResolution, Length(IResolution) + 1); IResolution[High(IResolution)] := IntToStr(Modes^.w) + 'x' + IntToStr(Modes^.h); diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index 5b7e4d43..06444dfe 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -1,164 +1,166 @@ -unit UScreenOptionsThemes; - -interface - -{$I switches.inc} - -uses - UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; - -type - TScreenOptionsThemes = class(TMenu) - public - SkinSelect: Integer; - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - procedure onShow; override; - procedure InteractInc; override; - procedure InteractDec; override; - end; - -implementation - -uses UGraphic, USkins; - -function TScreenOptionsThemes.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; - - // Reload all screens, after Theme changed - // Todo : JB - Check if theme was actually changed - UGraphic.UnLoadScreens(); - UGraphic.LoadScreens(); - - AudioPlayback.PlayBack; - FadeTo(@ScreenOptions); - end; - SDLK_RETURN: - begin - if SelInteraction = 3 then - begin - Ini.Save; - - // Reload all screens, after Theme changed - // Todo : JB - Check if theme was actually changed - UGraphic.UnLoadScreens(); - UGraphic.LoadScreens(); - - UGraphic.LoadScreens(); - - AudioPlayback.PlayBack; - FadeTo(@ScreenOptions); - end; - end; - SDLK_DOWN: - InteractNext; - SDLK_UP : - InteractPrev; - SDLK_RIGHT: - begin - if (SelInteraction >= 0) and (SelInteraction <= 2) then - begin - AudioPlayback.PlayOption; - InteractInc; - end; - end; - SDLK_LEFT: - begin - if (SelInteraction >= 0) and (SelInteraction <= 2) then - begin - AudioPlayback.PlayOption; - InteractDec; - end; - end; - end; - end; -end; - -procedure TScreenOptionsThemes.InteractInc; -begin - inherited InteractInc; - //Update Skins - if (SelInteraction = 0) then - begin - Skin.OnThemeChange; - UpdateSelectSlideOptions (Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); - - Theme.LoadTheme('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); - - ScreenOptionsThemes := TScreenOptionsThemes.create(); - ScreenOptionsThemes.onshow; - Display.ActualScreen := @ScreenOptionsThemes; - ScreenOptionsThemes.Draw; - - - Display.Draw; - SwapBuffers; - - freeandnil( self ); - - end; -end; - -procedure TScreenOptionsThemes.InteractDec; -begin - inherited InteractDec; - //Update Skins - if (SelInteraction = 0) then - begin - Skin.OnThemeChange; - UpdateSelectSlideOptions (Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); - - Theme.LoadTheme('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); - - ScreenOptionsThemes := TScreenOptionsThemes.create(); - ScreenOptionsThemes.onshow; - Display.ActualScreen := @ScreenOptionsThemes; - ScreenOptionsThemes.Draw; - - - Display.Draw; - SwapBuffers; - - freeandnil( self ); - - end; -end; - -constructor TScreenOptionsThemes.Create; -var - I: integer; -begin - inherited Create; - - LoadFromTheme(Theme.OptionsThemes); - - AddSelectSlide(Theme.OptionsThemes.SelectTheme, Ini.Theme, ITheme); - - SkinSelect := AddSelectSlide(Theme.OptionsThemes.SelectSkin, Ini.SkinNo, ISkin); - - AddSelectSlide(Theme.OptionsThemes.SelectColor, Ini.Color, IColor); - - AddButton(Theme.OptionsThemes.ButtonExit); - if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[7]); -end; - -procedure TScreenOptionsThemes.onShow; -begin - Interaction := 0; -end; - -end. +unit UScreenOptionsThemes; + +interface + +{$I switches.inc} + +uses + SDL, + UMenu, + UDisplay, + UMusic, + UFiles, + UIni, + UThemes; + +type + TScreenOptionsThemes = class(TMenu) + private + procedure ReloadTheme; + public + SkinSelect: Integer; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure InteractInc; override; + procedure InteractDec; override; + end; + +implementation + +uses UGraphic, USkins; + +function TScreenOptionsThemes.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; + + // Reload all screens, after Theme changed + // Todo : JB - Check if theme was actually changed + UGraphic.UnLoadScreens(); + UGraphic.LoadScreens(); + + AudioPlayback.PlayBack; + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 3 then + begin + Ini.Save; + + // Reload all screens, after Theme changed + // Todo : JB - Check if theme was actually changed + UGraphic.UnLoadScreens(); + UGraphic.LoadScreens(); + + AudioPlayback.PlayBack; + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 2) then + begin + AudioPlayback.PlayOption; + InteractInc; + end; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 2) then + begin + AudioPlayback.PlayOption; + InteractDec; + end; + end; + end; + end; +end; + +procedure TScreenOptionsThemes.InteractInc; +begin + inherited InteractInc; + + //Update Skins + if (SelInteraction = 0) then + begin + Skin.OnThemeChange; + UpdateSelectSlideOptions (Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); + end; + + ReloadTheme(); +end; + +procedure TScreenOptionsThemes.InteractDec; +begin + inherited InteractDec; + + //Update Skins + if (SelInteraction = 0 ) then + begin + Skin.OnThemeChange; + UpdateSelectSlideOptions (Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); + end; + + ReloadTheme(); +end; + +constructor TScreenOptionsThemes.Create; +var + I: integer; +begin + inherited Create; + + LoadFromTheme(Theme.OptionsThemes); + + AddSelectSlide(Theme.OptionsThemes.SelectTheme, Ini.Theme, ITheme); + + SkinSelect := AddSelectSlide(Theme.OptionsThemes.SelectSkin, Ini.SkinNo, ISkin); + + AddSelectSlide(Theme.OptionsThemes.SelectColor, Ini.Color, IColor); + + AddButton(Theme.OptionsThemes.ButtonExit); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[7]); +end; + +procedure TScreenOptionsThemes.onShow; +begin + Interaction := 0; +end; + +procedure TScreenOptionsThemes.ReloadTheme; +begin + Theme.LoadTheme('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + + ScreenOptionsThemes := TScreenOptionsThemes.create(); + ScreenOptionsThemes.onshow; + Display.ActualScreen := @ScreenOptionsThemes; + + ScreenOptionsThemes.Interaction := self.Interaction; + ScreenOptionsThemes.Draw; + + + Display.Draw; + SwapBuffers; + + freeandnil( self ); +end; + +end. -- cgit v1.2.3 From 4359220f85163f438c33afc0b2d78fa852ff6ef8 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 19 Nov 2007 10:31:08 +0000 Subject: fix run time bug git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@611 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UIni.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index ef135e65..444eef32 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -270,8 +270,8 @@ begin // Resolution SetLength(IResolution, 0); - Modes^ := nil; - Modes := SDL_ListModes(nil, SDL_OPENGL or SDL_FULLSCREEN); // Check if there are any modes available + + Modes := SDL_ListModes(nil, SDL_OPENGL or SDL_FULLSCREEN); // Check if there are any modes available while assigned( Modes^ ) do //this should solve the biggest wine problem | THANKS Linnex (11.11.07) begin SetLength(IResolution, Length(IResolution) + 1); -- cgit v1.2.3 From 34b0cb8bd025b40f52cff91bd9c29cd02faee7c2 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 20 Nov 2007 13:04:13 +0000 Subject: promoted changes from fisheye#614 to the main trunk git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@615 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UThemes.pas | 92 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index c212e7cb..f7b08479 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -659,6 +659,7 @@ type {$ENDIF} LastThemeBasic: TThemeBasic; + procedure create_theme_objects(); public Loading: TThemeLoading; @@ -801,6 +802,8 @@ var Path: string; begin Result := false; + + create_theme_objects(); FileName := AdaptFilePaths( FileName ); @@ -2210,5 +2213,94 @@ begin DecimalSeparator := ','; end; +procedure TTheme.create_theme_objects(); +begin + freeandnil( Loading ); + Loading := TThemeLoading.Create; + + freeandnil( Main ); + Main := TThemeMain.Create; + + freeandnil( Name ); + Name := TThemeName.Create; + + freeandnil( Level ); + Level := TThemeLevel.Create; + + freeandnil( Song ); + Song := TThemeSong.Create; + + freeandnil( Sing ); + Sing := TThemeSing.Create; + + freeandnil( Score ); + Score := TThemeScore.Create; + + freeandnil( Top5 ); + Top5 := TThemeTop5.Create; + + freeandnil( Options ); + Options := TThemeOptions.Create; + + freeandnil( OptionsGame ); + OptionsGame := TThemeOptionsGame.Create; + + freeandnil( OptionsGraphics ); + OptionsGraphics := TThemeOptionsGraphics.Create; + + freeandnil( OptionsSound ); + OptionsSound := TThemeOptionsSound.Create; + + freeandnil( OptionsLyrics ); + OptionsLyrics := TThemeOptionsLyrics.Create; + + freeandnil( OptionsThemes ); + OptionsThemes := TThemeOptionsThemes.Create; + + freeandnil( OptionsRecord ); + OptionsRecord := TThemeOptionsRecord.Create; + + freeandnil( OptionsAdvanced ); + OptionsAdvanced := TThemeOptionsAdvanced.Create; + + + freeandnil( ErrorPopup ); + ErrorPopup := TThemeError.Create; + + freeandnil( CheckPopup ); + CheckPopup := TThemeCheck.Create; + + + freeandnil( SongMenu ); + SongMenu := TThemeSongMenu.Create; + + freeandnil( SongJumpto ); + SongJumpto := TThemeSongJumpto.Create; + + //Party Screens + freeandnil( PartyNewRound ); + PartyNewRound := TThemePartyNewRound.Create; + + freeandnil( PartyWin ); + PartyWin := TThemePartyWin.Create; + + freeandnil( PartyScore ); + PartyScore := TThemePartyScore.Create; + + freeandnil( PartyOptions ); + PartyOptions := TThemePartyOptions.Create; + + freeandnil( PartyPlayer ); + PartyPlayer := TThemePartyPlayer.Create; + + + //Stats Screens: + freeandnil( StatMain ); + StatMain := TThemeStatMain.Create; + + freeandnil( StatDetail ); + StatDetail := TThemeStatDetail.Create; + + end; end. -- cgit v1.2.3 From ce484ce148d1db51ddb3cda575786f0871843cb3 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Tue, 20 Nov 2007 21:02:37 +0000 Subject: Changed Platform from Interface to Class. Added TerminateIfAlreadyRunning and GetGamePath to UPlatform.pas. Fixed a bug in THookManager.Create ("SpacetoAllocate-1"). git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@617 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCommon.pas | 92 ++-------------------------------- Game/Code/Classes/UHooks.pas | 2 +- Game/Code/Classes/UMain.pas | 55 ++------------------ Game/Code/Classes/UPlatform.pas | 46 ++++++++++++++--- Game/Code/Classes/UPlatformLinux.pas | 6 +-- Game/Code/Classes/UPlatformMacOSX.pas | 26 ++++++++-- Game/Code/Classes/UPlatformWindows.pas | 35 +++++++++++-- 7 files changed, 105 insertions(+), 157 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UCommon.pas b/Game/Code/Classes/UCommon.pas index 65d98e30..fb74af0b 100644 --- a/Game/Code/Classes/UCommon.pas +++ b/Game/Code/Classes/UCommon.pas @@ -64,24 +64,7 @@ function AdaptFilePaths( const aPath : widestring ): widestring; procedure ZeroMemory( Destination: Pointer; Length: DWORD ); {$ENDIF} -{$IFNDEF FPC} -type - TSearchRecW = record - Time: Integer; - Size: Integer; - Attr: Integer; - Name: WideString; - ExcludeAttr: Integer; - FindHandle: THandle; - FindData: TWin32FindDataW; - end; - - function FindFirstW(const Path: WideString; Attr: Integer; var F: TSearchRecW): Integer; - function FindNextW(var F: TSearchRecW): Integer; - procedure FindCloseW(var F: TSearchRecW); - function FindMatchingFileW(var F: TSearchRecW): Integer; - function DirectoryExistsW(const Directory: widestring): Boolean; -{$endif} +// eddie: FindFirstW etc are now in UPlatformWindows.pas implementation @@ -225,77 +208,8 @@ end; procedure DeallocateHWnd(Wnd: HWND); begin end; -{$ENDIF} - - - - -{$ENDIF} - -{$ifNdef FPC} -function FindFirstW(const Path: widestring; Attr: Integer; var F: TSearchRecW): Integer; -const - faSpecial = faHidden or faSysFile or faVolumeID or faDirectory; -begin - F.ExcludeAttr := not Attr and faSpecial; - F.FindHandle := FindFirstFileW(PWideChar(Path), F.FindData); - if F.FindHandle <> INVALID_HANDLE_VALUE then - begin - Result := FindMatchingFileW(F); - if Result <> 0 then FindCloseW(F); - end else - Result := GetLastError; -end; - -function FindNextW(var F: TSearchRecW): Integer; -begin - if FindNextFileW(F.FindHandle, F.FindData) then - Result := FindMatchingFileW(F) - else - Result := GetLastError; -end; - -procedure FindCloseW(var F: TSearchRecW); -begin - if F.FindHandle <> INVALID_HANDLE_VALUE then - begin - Windows.FindClose(F.FindHandle); - F.FindHandle := INVALID_HANDLE_VALUE; - end; -end; - -function FindMatchingFileW(var F: TSearchRecW): Integer; -var - LocalFileTime: TFileTime; -begin - with F do - begin - while FindData.dwFileAttributes and ExcludeAttr <> 0 do - if not FindNextFileW(FindHandle, FindData) then - begin - Result := GetLastError; - Exit; - end; - FileTimeToLocalFileTime(FindData.ftLastWriteTime, LocalFileTime); - FileTimeToDosDateTime(LocalFileTime, LongRec(Time).Hi, LongRec(Time).Lo); - Size := FindData.nFileSizeLow; - Attr := FindData.dwFileAttributes; - Name := FindData.cFileName; - end; - Result := 0; -end; - -function DirectoryExistsW(const Directory: widestring): Boolean; -var - Code: Integer; -begin - Code := GetFileAttributesW(PWideChar(Directory)); - Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0); -end; -{$endif} - - - +{$ENDIF} // IFDEF DARWIN +{$ENDIF} // IFDEF FPC end. diff --git a/Game/Code/Classes/UHooks.pas b/Game/Code/Classes/UHooks.pas index 3e22bc75..8b33959d 100644 --- a/Game/Code/Classes/UHooks.pas +++ b/Game/Code/Classes/UHooks.pas @@ -76,7 +76,7 @@ var I: Integer; begin //Get the Space and "Zero" it SetLength (Events, SpacetoAllocate); - For I := 0 to SpacetoAllocate do + For I := 0 to SpacetoAllocate-1 do Events[I].Name[1] := chr(0); SpaceinEvents := SpacetoAllocate; diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index c11b68d9..019e638a 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -125,7 +125,7 @@ implementation uses USongs, UJoystick, math, UCommandLine, ULanguage, SDL_ttf, USkins, UCovers, UCatCovers, UDataBase, UPlaylist, UDLLManager, - UParty, UCore, UGraphicClasses, UPluginDefs; + UParty, UCore, UGraphicClasses, UPluginDefs, UPlatform; const Version = 'UltraStar Deluxe V 1.10 Alpha Build'; @@ -133,36 +133,14 @@ const Procedure Main; var WndTitle: string; - hWnd: THandle; - I: Integer; begin try WndTitle := Version; - {$IFDEF MSWINDOWS} - //------------------------------ - //Start more than One Time Prevention - //------------------------------ - hWnd:= FindWindow(nil, PChar(WndTitle)); - //Programm already started - if (hWnd <> 0) then - begin - I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Continue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); - if (I = IDYes) then - begin - I := 1; - repeat - Inc(I); - hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); - until (hWnd = 0); - WndTitle := WndTitle + ' Instance ' + InttoStr(I); - end - else - Exit; - end; - {$ENDIF} - + if Platform.TerminateIfAlreadyRunning( {var} WndTitle) then + Exit; + //------------------------------ //StartUp - Create Classes and Load Files //------------------------------ @@ -1008,25 +986,6 @@ begin Player[PlayerNum].ScoreTotalI := 0; end; -{$IFDEF DARWIN} -// Mac applications are packaged in directories. -// We have to cut the last two directories -// to get the application directory. -Function GetGamePath : String; -var - x, - i : integer; -begin - Result := ExtractFilePath(ParamStr(0)); - for x := 0 to 2 do begin - i := Length(Result); - repeat - Delete( Result, i, 1); - i := Length(Result); - until (i = 0) or (Result[i] = '/'); - end; -end; -{$ENDIF} //-------------------- // Function sets all Absolute Paths e.g. Song Path and makes sure the Directorys exist @@ -1062,11 +1021,7 @@ procedure InitializePaths; begin -{$IFDEF DARWIN} - GamePath := GetGamePath; -{$ELSE} - GamePath := ExtractFilePath(ParamStr(0)); -{$ENDIF} + GamePath := Platform.GetGamePath; initialize_path( LogPath , GamePath ); initialize_path( SoundPath , GamePath + 'Sounds' + PathDelim ); diff --git a/Game/Code/Classes/UPlatform.pas b/Game/Code/Classes/UPlatform.pas index cc971bed..878c1ec2 100644 --- a/Game/Code/Classes/UPlatform.pas +++ b/Game/Code/Classes/UPlatform.pas @@ -25,20 +25,25 @@ type TDirectoryEntryArray = Array of TDirectoryEntry; - IPlatform = interface - - // DirectoryFindFiles returns all files matching the filter. Do not use '*' in the filter. - // If you set ReturnAllSubDirs = true all directories will be returned, if yout set it to false - // directories are completely ignored. - Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; + TPlatform = class + + // DirectoryFindFiles returns all files matching the filter. Do not use '*' in the filter. + // If you set ReturnAllSubDirs = true all directories will be returned, if yout set it to false + // directories are completely ignored. + Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; virtual; abstract; + + function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; virtual; + + function GetGamePath : WideString; virtual; end; var - Platform : IPlatform; + Platform : TPlatform; implementation uses + SysUtils, {$IFDEF MSWINDOWS} UPlatformWindows; {$ENDIF} @@ -49,8 +54,33 @@ uses UPlatformMacOSX; {$ENDIF} +{ TPlatform } + +function TPlatform.GetGamePath: WideString; +begin + // Windows and Linux use this: + Result := ExtractFilePath(ParamStr(0)); +end; + +function TPlatform.TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; +begin + // Linux and Mac don't check for running apps at the moment + Result := false; +end; + initialization - Platform := TPlatform.Create; + {$IFDEF MSWINDOWS} + Platform := TPlatformWindows.Create; + {$ENDIF} + {$IFDEF LINUX} + Platform := TPlatformLinux.Create; + {$ENDIF} + {$IFDEF DARWIN} + Platform := TPlatformMacOSX.Create; + {$ENDIF} + +finalization + Platform.Free; end. diff --git a/Game/Code/Classes/UPlatformLinux.pas b/Game/Code/Classes/UPlatformLinux.pas index fd06097d..e6d90e20 100644 --- a/Game/Code/Classes/UPlatformLinux.pas +++ b/Game/Code/Classes/UPlatformLinux.pas @@ -12,16 +12,16 @@ uses Classes, UPlatform; type - TPlatform = class(TInterfacedObject, IPlatform) + TPlatform = class(TPlatform) public - Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; + Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override; end; implementation uses SysUtils, oldlinux; -Function TPlatform.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; +Function TPlatformLinux.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; var i : Integer; TheDir : oldlinux.pdir; diff --git a/Game/Code/Classes/UPlatformMacOSX.pas b/Game/Code/Classes/UPlatformMacOSX.pas index 56469299..4e0c9061 100644 --- a/Game/Code/Classes/UPlatformMacOSX.pas +++ b/Game/Code/Classes/UPlatformMacOSX.pas @@ -12,16 +12,36 @@ uses Classes, UPlatform; type - TPlatform = class(TInterfacedObject, IPlatform) + TPlatformMacOSX = class(TPlatform) + private public - Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; + Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override; + function GetGamePath: WideString; override; end; implementation uses SysUtils, baseunix; -Function TPlatform.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; +// Mac applications are packaged in directories. +// We have to cut the last two directories +// to get the application directory. +Function TPlatformMacOSX.GetGamePath : WideString; +var + x, + i : integer; +begin + Result := ExtractFilePath(ParamStr(0)); + for x := 0 to 2 do begin + i := Length(Result); + repeat + Delete( Result, i, 1); + i := Length(Result); + until (i = 0) or (Result[i] = '/'); + end; +end; + +Function TPlatformMacOSX.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; var i : Integer; TheDir : pdir; diff --git a/Game/Code/Classes/UPlatformWindows.pas b/Game/Code/Classes/UPlatformWindows.pas index 7e65d700..afdcebcf 100644 --- a/Game/Code/Classes/UPlatformWindows.pas +++ b/Game/Code/Classes/UPlatformWindows.pas @@ -12,9 +12,10 @@ uses Classes, UPlatform; type - TPlatform = class(TInterfacedObject, IPlatform) + TPlatformWindows = class(TPlatform) public - Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; + Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override; + function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; override; end; implementation @@ -99,7 +100,35 @@ begin Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0); end; -Function TPlatform.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; +//------------------------------ +//Start more than One Time Prevention +//------------------------------ +function TPlatformWindows.TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; +var + hWnd: THandle; + I: Integer; +begin + Result := false; + hWnd:= FindWindow(nil, PChar(WndTitle)); + //Programm already started + if (hWnd <> 0) then + begin + I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Continue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); + if (I = IDYes) then + begin + I := 1; + repeat + Inc(I); + hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); + until (hWnd = 0); + WndTitle := WndTitle + ' Instance ' + InttoStr(I); + end + else + Result := true; + end; +end; + +Function TPlatformWindows.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; var i : Integer; SR : TSearchRecW; -- cgit v1.2.3 From d3e475ad32f82e770981b8035621ce52d8faccae Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Tue, 20 Nov 2007 21:08:33 +0000 Subject: Fixed UPlatformLinux.pas git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@618 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlatformLinux.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlatformLinux.pas b/Game/Code/Classes/UPlatformLinux.pas index e6d90e20..741662cd 100644 --- a/Game/Code/Classes/UPlatformLinux.pas +++ b/Game/Code/Classes/UPlatformLinux.pas @@ -12,7 +12,7 @@ uses Classes, UPlatform; type - TPlatform = class(TPlatform) + TPlatformLinux = class(TPlatform) public Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override; end; -- cgit v1.2.3 From 974acf9d30f717e99a9320d2f975141d399feb98 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Tue, 20 Nov 2007 21:21:58 +0000 Subject: Removed Windows.pas include git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@619 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMain.pas | 3 --- 1 file changed, 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 019e638a..924ef0ab 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -9,9 +9,6 @@ interface {$I switches.inc} uses - {$IFDEF MSWINDOWS} - Windows, - {$ENDIF} SDL, UGraphic, UMusic, -- cgit v1.2.3 From ec0343498ff3d83e10f468a635ba7c13a253ca2d Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 21 Nov 2007 01:34:49 +0000 Subject: added TeamDuell Mode... jira#USDX-169 THANKS Jekatt git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@620 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/linux-build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/linux-build.sh b/Game/Code/linux-build.sh index bcaca539..54938479 100755 --- a/Game/Code/linux-build.sh +++ b/Game/Code/linux-build.sh @@ -1,4 +1,4 @@ clear -fpc -S2cgi -OG1 -gl -vewnhi -l -Filib/JEDI-SDLv1.0/SDL/Pas/ -Fu/usr/lib/lazarus/components/images/lib/i386-linux/ -Fu/usr/lib/lazarus/lcl/units/i386-linux/ -Fu/usr/lib/lazarus/lcl/units/i386-linux/gtk2/ -Fu/usr/lib/lazarus/packager/units/i386-linux/ -Fu. -oUltraStar -dLCL -dLCLgtk2 UltraStar.lpr +fpc -S2cgi -OG1 -gl -vewnhi -l -Filib/JEDI-SDLv1.0/SDL/Pas/ -Fu/usr/bin/lazarus/components/images/lib/i386-linux/ -Fu/usr/bin/lazarus/lcl/units/i386-linux/ -Fu/usr/bin/lazarus/lcl/units/i386-linux/gtk2/ -Fu/usr/bin/lazarus/packager/units/i386-linux/ -Fu. -oUltraStar -dLCL -dLCLgtk2 UltraStar.lpr -#mv ./UltraStar /home/jay/src/ultrastardx/output/ +mv ./UltraStar /home/jay/src/ultrastardx/output/ -- cgit v1.2.3 From a224f217974a1d7e523f104fcfe1010a6f2143ef Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 21 Nov 2007 18:31:32 +0000 Subject: Solved Usdx-1 in Trunk and 1.0.1 ChannelOptions now 'Off', '1', '2', '3'.. instead of '0', '1', '2', '3'.. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@622 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UIni.pas | 1588 ++++++++++++++++++++++---------------------- 1 file changed, 794 insertions(+), 794 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index 444eef32..f1b73d38 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -1,794 +1,794 @@ -unit UIni; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses IniFiles, ULog, SysUtils; - -type - TIni = class - Name: array[0..11] of string; - - // Templates for Names Mod - NameTeam: array[0..2] of string; - NameTemplate: array[0..11] of string; - - //Filename of the opened iniFile - Filename: string; - - // Game - Players: integer; - Difficulty: integer; - Language: integer; - Tabs: integer; - Tabs_at_startup:integer; //Tabs at Startup fix - Sorting: integer; - Debug: integer; - - // Graphics - Screens: integer; - Resolution: integer; - Depth: integer; - FullScreen: integer; - TextureSize: integer; - SingWindow: integer; - Oscilloscope: integer; - Spectrum: integer; - Spectrograph: integer; - MovieSize: integer; - - // Sound - MicBoost: integer; - ClickAssist: integer; - BeatClick: integer; - SavePlayback: integer; - Threshold: integer; - - //Song Preview - PreviewVolume: integer; - PreviewFading: integer; - - // Lyrics - LyricsFont: integer; - LyricsEffect: integer; - Solmization: integer; - - // Themes - Theme: integer; - SkinNo: integer; - Color: integer; - - // Record - Card: integer; // not saved in config.ini - - CardList: array of record - Name: string; - Input: integer; - ChannelL: integer; - ChannelR: integer; - end; - - // Advanced - LoadAnimation: integer; - EffectSing: integer; - ScreenFade: integer; - AskbeforeDel: integer; - OnSongClick: integer; - LineBonus: integer; - PartyPopup: integer; - - // Controller - Joypad: integer; - - // Soundcards - SoundCard: array[0..7, 1..2] of integer; - - // Devices - LPT: integer; - - procedure Load; - procedure Save; - procedure SaveNames; - procedure SaveLevel; - end; - - -var - Ini: TIni; - IResolution: array of string; - ILanguage: array of string; - ITheme: array of string; - ISkin: array of string; - ICard: array of string; - IInput: array of string; - -const - IPlayers: array[0..4] of string = ('1', '2', '3', '4', '6'); - IDifficulty: array[0..2] of string = ('Easy', 'Medium', 'Hard'); - ITabs: array[0..1] of string = ('Off', 'On'); - - ISorting: array[0..7] of string = ('Edition', 'Genre', 'Language', 'Folder', 'Title', 'Artist', 'Title2', 'Artist2'); - sEdition = 0; - sGenre = 1; - sLanguage = 2; - sFolder = 3; - sTitle = 4; - sArtist = 5; - sTitle2 = 6; - sArtist2 = 7; - - IDebug: array[0..1] of string = ('Off', 'On'); - - IScreens: array[0..1] of string = ('1', '2'); - IFullScreen: array[0..1] of string = ('Off', 'On'); - IDepth: array[0..1] of string = ('16 bit', '32 bit'); - ITextureSize: array[0..2] of string = ('128', '256', '512'); - ISingWindow: array[0..1] of string = ('Small', 'Big'); - - //SingBar Mod - IOscilloscope: array[0..2] of string = ('Off', 'Osci', 'Bar'); - //IOscilloscope: array[0..1] of string = ('Off', 'On'); - - ISpectrum: array[0..1] of string = ('Off', 'On'); - ISpectrograph: array[0..1] of string = ('Off', 'On'); - IMovieSize: array[0..2] of string = ('Half', 'Full [Vid]', 'Full [BG+Vid]'); - - IMicBoost: array[0..3] of string = ('Off', '+6dB', '+12dB', '+18dB'); - IClickAssist: array[0..1] of string = ('Off', 'On'); - IBeatClick: array[0..1] of string = ('Off', 'On'); - ISavePlayback: array[0..1] of string = ('Off', 'On'); - IThreshold: array[0..3] of string = ('5%', '10%', '15%', '20%'); - //Song Preview - IPreviewVolume: array[0..10] of string = ('Off', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%'); - IPreviewFading: array[0..5] of string = ('Off', '1 Sec', '2 Secs', '3 Secs', '4 Secs', '5 Secs'); - - - ILyricsFont: array[0..2] of string = ('Plain', 'OLine1', 'OLine2'); - ILyricsEffect: array[0..3] of string = ('Simple', 'Zoom', 'Slide', 'Ball'); - ISolmization: array[0..3] of string = ('Off', 'Euro', 'Jap', 'American'); - - IColor: array[0..8] of string = ('Blue', 'Green', 'Pink', 'Red', 'Violet', 'Orange', 'Yellow', 'Brown', 'Black'); - - // Advanced - ILoadAnimation: array[0..1] of string = ('Off', 'On'); - IEffectSing: array[0..1] of string = ('Off', 'On'); - IScreenFade: array [0..1] of String =('Off', 'On'); - IAskbeforeDel: array[0..1] of string = ('Off', 'On'); - IOnSongClick: array[0..2] of string = ('Sing', 'Select Players', 'Open Menu'); - ILineBonus: array[0..2] of string = ('Off', 'At Score', 'At Notes'); - IPartyPopup: array[0..1] of string = ('Off', 'On'); - - IJoypad: array[0..1] of string = ('Off', 'On'); - ILPT: array[0..2] of string = ('Off', 'LCD', 'Lights'); - - IChannel: array[0..6] of string = ('0', '1', '2', '3', '4', '5', '6'); - -implementation - -uses //UFiles, - UMain, - SDL, - ULanguage, - USkins, - URecord, - UCommandLine; - -procedure TIni.Load; -var - IniFile: TMemIniFile; - ThemeIni: TMemIniFile; - Tekst: string; - Pet: integer; - B: boolean; - I, I2, I3: integer; - S: string; - Modes: PPSDL_Rect; - SR: TSearchRec; //Skin List Patch - - function GetFileName (S: String):String; - begin - //Result := copy (S,0,StrRScan (PChar(S),char('.'))+1); - Result := copy (S,0,Pos ('.ini',S)-1); - end; - -begin - GamePath := ExtractFilePath(ParamStr(0)); - - if (Params.ConfigFile <> '') then - try - IniFile := TMemIniFile.Create(Params.ConfigFile); - except - IniFile := TMemIniFile.Create(GamePath + 'config.ini'); - end - else - IniFile := TMemIniFile.Create(GamePath + 'config.ini'); - - - // Name - for I := 0 to 11 do - Ini.Name[I] := IniFile.ReadString('Name', 'P'+IntToStr(I+1), 'Player'+IntToStr(I+1)); - - - // Templates for Names Mod - for I := 0 to 2 do - Ini.NameTeam[I] := IniFile.ReadString('NameTeam', 'T'+IntToStr(I+1), 'Team'+IntToStr(I+1)); - for I := 0 to 11 do - Ini.NameTemplate[I] := IniFile.ReadString('NameTemplate', 'Name'+IntToStr(I+1), 'Template'+IntToStr(I+1)); - - // Players - Tekst := IniFile.ReadString('Game', 'Players', IPlayers[0]); - for Pet := 0 to High(IPlayers) do - if Tekst = IPlayers[Pet] then Ini.Players := Pet; - - // Difficulty - Tekst := IniFile.ReadString('Game', 'Difficulty', 'Easy'); - for Pet := 0 to High(IDifficulty) do - if Tekst = IDifficulty[Pet] then Ini.Difficulty := Pet; - - // Language - Tekst := IniFile.ReadString('Game', 'Language', 'English'); - for Pet := 0 to High(ILanguage) do - if Tekst = ILanguage[Pet] then Ini.Language := Pet; - -// Language.ChangeLanguage(ILanguage[Ini.Language]); - - // Tabs - Tekst := IniFile.ReadString('Game', 'Tabs', ITabs[0]); - for Pet := 0 to High(ITabs) do - if Tekst = ITabs[Pet] then Ini.Tabs := Pet; - - //Tabs at Startup fix - Ini.Tabs_at_startup := Ini.Tabs; - - // Sorting - Tekst := IniFile.ReadString('Game', 'Sorting', ISorting[0]); - for Pet := 0 to High(ISorting) do - if Tekst = ISorting[Pet] then Ini.Sorting := Pet; - - // Debug - Tekst := IniFile.ReadString('Game', 'Debug', IDebug[0]); - for Pet := 0 to High(IDebug) do - if Tekst = IDebug[Pet] then Ini.Debug := Pet; - - //if Ini.Debug = 1 then SongPath := 'E:\UltraStar 03\Songs\'; - - // Screens - Tekst := IniFile.ReadString('Graphics', 'Screens', IScreens[0]); - for Pet := 0 to High(IScreens) do - if Tekst = IScreens[Pet] then Ini.Screens := Pet; - - // FullScreen - Tekst := IniFile.ReadString('Graphics', 'FullScreen', 'On'); - for Pet := 0 to High(IFullScreen) do - if Tekst = IFullScreen[Pet] then Ini.FullScreen := Pet; - - - // Resolution - SetLength(IResolution, 0); - - Modes := SDL_ListModes(nil, SDL_OPENGL or SDL_FULLSCREEN); // Check if there are any modes available - while assigned( Modes^ ) do //this should solve the biggest wine problem | THANKS Linnex (11.11.07) - begin - SetLength(IResolution, Length(IResolution) + 1); - IResolution[High(IResolution)] := IntToStr(Modes^.w) + 'x' + IntToStr(Modes^.h); - Inc(Modes); - end; - - // if no modes were set, then failback to 800x600 - // as per http://sourceforge.net/forum/message.php?msg_id=4544965 - // THANKS : linnex at users.sourceforge.net - if Length(IResolution) < 1 then - begin - SetLength(IResolution, Length(IResolution) + 1); - IResolution[High(IResolution)] := IntToStr(800) + 'x' + IntToStr(600); - Log.LogStatus('SDL_ListModes Defaulted Res To : ' + IResolution[High(IResolution)] , 'Graphics - Resolutions'); - - // Default to fullscreen OFF, in this case ! - Ini.FullScreen := 0; - end; - - // reverse order - for I := 0 to (Length(IResolution) div 2) - 1 do begin - S := IResolution[I]; - IResolution[I] := IResolution[High(IResolution)-I]; - IResolution[High(IResolution)-I] := S; - end; - - Tekst := IniFile.ReadString('Graphics', 'Resolution', '800x600'); - for Pet := 0 to High(IResolution) do - if Tekst = IResolution[Pet] then Ini.Resolution := Pet; - - - // Resolution - Tekst := IniFile.ReadString('Graphics', 'Depth', '32 bit'); - for Pet := 0 to High(IDepth) do - if Tekst = IDepth[Pet] then Ini.Depth := Pet; - - // Texture Size - Tekst := IniFile.ReadString('Graphics', 'TextureSize', ITextureSize[1]); - for Pet := 0 to High(ITextureSize) do - if Tekst = ITextureSize[Pet] then Ini.TextureSize := Pet; - - // SingWindow - Tekst := IniFile.ReadString('Graphics', 'SingWindow', 'Big'); - for Pet := 0 to High(ISingWindow) do - if Tekst = ISingWindow[Pet] then Ini.SingWindow := Pet; - - // Oscilloscope - Tekst := IniFile.ReadString('Graphics', 'Oscilloscope', 'Bar'); - for Pet := 0 to High(IOscilloscope) do - if Tekst = IOscilloscope[Pet] then Ini.Oscilloscope := Pet; - - // Spectrum - Tekst := IniFile.ReadString('Graphics', 'Spectrum', 'Off'); - for Pet := 0 to High(ISpectrum) do - if Tekst = ISpectrum[Pet] then Ini.Spectrum := Pet; - - // Spectrograph - Tekst := IniFile.ReadString('Graphics', 'Spectrograph', 'Off'); - for Pet := 0 to High(ISpectrograph) do - if Tekst = ISpectrograph[Pet] then Ini.Spectrograph := Pet; - - // MovieSize - Tekst := IniFile.ReadString('Graphics', 'MovieSize', IMovieSize[2]); - for Pet := 0 to High(IMovieSize) do - if Tekst = IMovieSize[Pet] then Ini.MovieSize := Pet; - - // MicBoost - Tekst := IniFile.ReadString('Sound', 'MicBoost', 'Off'); - for Pet := 0 to High(IMicBoost) do - if Tekst = IMicBoost[Pet] then Ini.MicBoost := Pet; - - // ClickAssist - Tekst := IniFile.ReadString('Sound', 'ClickAssist', 'Off'); - for Pet := 0 to High(IClickAssist) do - if Tekst = IClickAssist[Pet] then Ini.ClickAssist := Pet; - - // BeatClick - Tekst := IniFile.ReadString('Sound', 'BeatClick', IBeatClick[0]); - for Pet := 0 to High(IBeatClick) do - if Tekst = IBeatClick[Pet] then Ini.BeatClick := Pet; - - // SavePlayback - Tekst := IniFile.ReadString('Sound', 'SavePlayback', ISavePlayback[0]); - for Pet := 0 to High(ISavePlayback) do - if Tekst = ISavePlayback[Pet] then Ini.SavePlayback := Pet; - - // Threshold - Tekst := IniFile.ReadString('Sound', 'Threshold', IThreshold[2]); - for Pet := 0 to High(IThreshold) do - if Tekst = IThreshold[Pet] then Ini.Threshold := Pet; - - //Song Preview - Tekst := IniFile.ReadString('Sound', 'PreviewVolume', IPreviewVolume[7]); - for Pet := 0 to High(IPreviewVolume) do - if Tekst = IPreviewVolume[Pet] then Ini.PreviewVolume := Pet; - - Tekst := IniFile.ReadString('Sound', 'PreviewFading', IPreviewFading[1]); - for Pet := 0 to High(IPreviewFading) do - if Tekst = IPreviewFading[Pet] then Ini.PreviewFading := Pet; - - // Lyrics Font - Tekst := IniFile.ReadString('Lyrics', 'LyricsFont', ILyricsFont[1]); - for Pet := 0 to High(ILyricsFont) do - if Tekst = ILyricsFont[Pet] then Ini.LyricsFont := Pet; - - // Lyrics Effect - Tekst := IniFile.ReadString('Lyrics', 'LyricsEffect', ILyricsEffect[1]); - for Pet := 0 to High(ILyricsEffect) do - if Tekst = ILyricsEffect[Pet] then Ini.LyricsEffect := Pet; - - // Solmization - Tekst := IniFile.ReadString('Lyrics', 'Solmization', ISolmization[0]); - for Pet := 0 to High(ISolmization) do - if Tekst = ISolmization[Pet] then Ini.Solmization := Pet; - - // Theme - - //Theme List Patch - - //I2 Saves the no of the Deluxe (Standard-) Theme - I2 := 0; - //I counts is the cur. Theme no - I := 0; - - SetLength(ITheme, 0); - FindFirst('Themes' + PathDelim + '*.ini',faAnyFile,SR); - Repeat - //Read Themename from Theme - ThemeIni := TMemIniFile.Create(SR.Name); - Tekst := UpperCase(ThemeIni.ReadString('Theme','Name',GetFileName(SR.Name))); - ThemeIni.Free; - - //if Deluxe Theme then save Themeno to I2 - if (Tekst = 'DELUXE') then - I2 := I; - - //Search for Skins for this Theme - for Pet := low(Skin.Skin) to high(Skin.Skin) do - begin - if UpperCase(Skin.Skin[Pet].Theme) = Tekst then - begin - SetLength(ITheme, Length(ITheme)+1); - ITheme[High(ITheme)] := GetFileName(SR.Name); - break; - end; - end; - - Inc(I); - Until FindNext(SR) <> 0; - FindClose(SR); - //Theme List Patch End } - - //No Theme Found - if (Length(ITheme)=0) then - begin - Log.CriticalError('Could not find any valid Themes.'); - end; - - - Tekst := IniFile.ReadString('Themes', 'Theme', ITheme[I2]); - Ini.Theme := 0; - for Pet := 0 to High(ITheme) do - if Uppercase(Tekst) = Uppercase(ITheme[Pet]) then Ini.Theme := Pet; - - // Skin - Skin.onThemeChange; - Ini.SkinNo := 0; - - Tekst := IniFile.ReadString('Themes', 'Skin', ISkin[0]); - for Pet := 0 to High(ISkin) do - if Tekst = ISkin[Pet] then Ini.SkinNo := Pet; - - // Color - Tekst := IniFile.ReadString('Themes', 'Color', IColor[0]); - for Pet := 0 to High(IColor) do - if Tekst = IColor[Pet] then Ini.Color := Pet; - - // Record - load ini list - SetLength(CardList, 0); - I := 1; - while (IniFile.ValueExists('Record', 'DeviceName' + IntToStr(I)) = true) do begin - //Automatically Delete not Existing Sound Cards - S := IniFile.ReadString('Record', 'DeviceName' + IntToStr(I), ''); - //{ - B := False; - //Look for Soundcard - for I2 := 0 to High(Recording.SoundCard) do - begin - if (S = Trim(Recording.SoundCard[I2].Description)) then - begin - B := True; - Break; - end; - end; - - if B then - begin //} - I3 := Length(CardList); - SetLength(CardList, I3+1); - Ini.CardList[I3].Name := S; - Ini.CardList[I3].Input := IniFile.ReadInteger('Record', 'Input' + IntToStr(I), 0); - Ini.CardList[I3].ChannelL := IniFile.ReadInteger('Record', 'ChannelL' + IntToStr(I), 0); - Ini.CardList[I3].ChannelR := IniFile.ReadInteger('Record', 'ChannelR' + IntToStr(I), 0); - end; - Inc(I); - end; - - // Record - append detected soundcards - for I := 0 to High(Recording.SoundCard) do - begin - B := False; - For I2 := 0 to High(CardList) do - begin //Search for Card in List - if (CardList[I2].Name = Trim(Recording.SoundCard[I].Description)) then - begin - B := True; - Break; - end; - end; - - //If not in List -> Add - If not B then - begin - I3 := Length(CardList); - SetLength(CardList, I3+1); - CardList[I3].Name := Trim(Recording.SoundCard[I].Description); - CardList[I3].Input := 0; - CardList[I3].ChannelL := 0; - CardList[I3].ChannelR := 0; - // default for new users - if (Length(CardList) = 1) then - CardList[I].ChannelL := 1; - end; - end; - - //Advanced Settings - - // LoadAnimation - Tekst := IniFile.ReadString('Advanced', 'LoadAnimation', 'On'); - for Pet := 0 to High(ILoadAnimation) do - if Tekst = ILoadAnimation[Pet] then Ini.LoadAnimation := Pet; - - // ScreenFade - Tekst := IniFile.ReadString('Advanced', 'ScreenFade', 'On'); - for Pet := 0 to High(IScreenFade) do - if Tekst = IScreenFade[Pet] then Ini.ScreenFade := Pet; - - // EffectSing - Tekst := IniFile.ReadString('Advanced', 'EffectSing', 'On'); - for Pet := 0 to High(IEffectSing) do - if Tekst = IEffectSing[Pet] then Ini.EffectSing := Pet; - - // AskbeforeDel - Tekst := IniFile.ReadString('Advanced', 'AskbeforeDel', 'On'); - for Pet := 0 to High(IAskbeforeDel) do - if Tekst = IAskbeforeDel[Pet] then Ini.AskbeforeDel := Pet; - - // OnSongClick - Tekst := IniFile.ReadString('Advanced', 'OnSongClick', 'Sing'); - for Pet := 0 to High(IOnSongClick) do - if Tekst = IOnSongClick[Pet] then Ini.OnSongClick := Pet; - - // Linebonus - Tekst := IniFile.ReadString('Advanced', 'LineBonus', 'At Score'); - for Pet := 0 to High(ILineBonus) do - if Tekst = ILineBonus[Pet] then Ini.LineBonus := Pet; - - // PartyPopup - Tekst := IniFile.ReadString('Advanced', 'PartyPopup', 'On'); - for Pet := 0 to High(IPartyPopup) do - if Tekst = IPartyPopup[Pet] then Ini.PartyPopup := Pet; - - - // Joypad - Tekst := IniFile.ReadString('Controller', 'Joypad', IJoypad[0]); - for Pet := 0 to High(IJoypad) do - if Tekst = IJoypad[Pet] then Ini.Joypad := Pet; - - // LCD - Tekst := IniFile.ReadString('Devices', 'LPT', ILPT[0]); - for Pet := 0 to High(ILPT) do - if Tekst = ILPT[Pet] then Ini.LPT := Pet; - - - // SongPath - if (Params.SongPath <> '') then - SongPath := IncludeTrailingPathDelimiter(Params.SongPath) - else - SongPath := IncludeTrailingPathDelimiter(IniFile.ReadString('Path', 'Songs', SongPath)); - - Filename := IniFile.FileName; - IniFile.Free; -end; - -procedure TIni.Save; -var - IniFile: TIniFile; - Tekst: string; - I: Integer; - S: String; -begin - //if not (FileExists(GamePath + 'config.ini') and FileIsReadOnly(GamePath + 'config.ini')) then begin - if not (FileExists(Filename) and FileIsReadOnly(Filename)) then begin - - IniFile := TIniFile.Create(Filename); - - // Players - Tekst := IPlayers[Ini.Players]; - IniFile.WriteString('Game', 'Players', Tekst); - - // Difficulty - Tekst := IDifficulty[Ini.Difficulty]; - IniFile.WriteString('Game', 'Difficulty', Tekst); - - // Language - Tekst := ILanguage[Ini.Language]; - IniFile.WriteString('Game', 'Language', Tekst); - - // Tabs - Tekst := ITabs[Ini.Tabs]; - IniFile.WriteString('Game', 'Tabs', Tekst); - - // Sorting - Tekst := ISorting[Ini.Sorting]; - IniFile.WriteString('Game', 'Sorting', Tekst); - - // Debug - Tekst := IDebug[Ini.Debug]; - IniFile.WriteString('Game', 'Debug', Tekst); - - // Screens - Tekst := IScreens[Ini.Screens]; - IniFile.WriteString('Graphics', 'Screens', Tekst); - - // FullScreen - Tekst := IFullScreen[Ini.FullScreen]; - IniFile.WriteString('Graphics', 'FullScreen', Tekst); - - // Resolution - Tekst := IResolution[Ini.Resolution]; - IniFile.WriteString('Graphics', 'Resolution', Tekst); - - // Depth - Tekst := IDepth[Ini.Depth]; - IniFile.WriteString('Graphics', 'Depth', Tekst); - - // Resolution - Tekst := ITextureSize[Ini.TextureSize]; - IniFile.WriteString('Graphics', 'TextureSize', Tekst); - - // Sing Window - Tekst := ISingWindow[Ini.SingWindow]; - IniFile.WriteString('Graphics', 'SingWindow', Tekst); - - // Oscilloscope - Tekst := IOscilloscope[Ini.Oscilloscope]; - IniFile.WriteString('Graphics', 'Oscilloscope', Tekst); - - // Spectrum - Tekst := ISpectrum[Ini.Spectrum]; - IniFile.WriteString('Graphics', 'Spectrum', Tekst); - - // Spectrograph - Tekst := ISpectrograph[Ini.Spectrograph]; - IniFile.WriteString('Graphics', 'Spectrograph', Tekst); - - // Movie Size - Tekst := IMovieSize[Ini.MovieSize]; - IniFile.WriteString('Graphics', 'MovieSize', Tekst); - - // MicBoost - Tekst := IMicBoost[Ini.MicBoost]; - IniFile.WriteString('Sound', 'MicBoost', Tekst); - - // ClickAssist - Tekst := IClickAssist[Ini.ClickAssist]; - IniFile.WriteString('Sound', 'ClickAssist', Tekst); - - // BeatClick - Tekst := IBeatClick[Ini.BeatClick]; - IniFile.WriteString('Sound', 'BeatClick', Tekst); - - // Threshold - Tekst := IThreshold[Ini.Threshold]; - IniFile.WriteString('Sound', 'Threshold', Tekst); - - // Song Preview - Tekst := IPreviewVolume[Ini.PreviewVolume]; - IniFile.WriteString('Sound', 'PreviewVolume', Tekst); - - Tekst := IPreviewFading[Ini.PreviewFading]; - IniFile.WriteString('Sound', 'PreviewFading', Tekst); - - // SavePlayback - Tekst := ISavePlayback[Ini.SavePlayback]; - IniFile.WriteString('Sound', 'SavePlayback', Tekst); - - // Lyrics Font - Tekst := ILyricsFont[Ini.LyricsFont]; - IniFile.WriteString('Lyrics', 'LyricsFont', Tekst); - - // Lyrics Effect - Tekst := ILyricsEffect[Ini.LyricsEffect]; - IniFile.WriteString('Lyrics', 'LyricsEffect', Tekst); - - // Solmization - Tekst := ISolmization[Ini.Solmization]; - IniFile.WriteString('Lyrics', 'Solmization', Tekst); - - // Theme - Tekst := ITheme[Ini.Theme]; - IniFile.WriteString('Themes', 'Theme', Tekst); - - // Skin - Tekst := ISkin[Ini.SkinNo]; - IniFile.WriteString('Themes', 'Skin', Tekst); - - // Color - Tekst := IColor[Ini.Color]; - IniFile.WriteString('Themes', 'Color', Tekst); - - // Record - for I := 0 to High(CardList) do begin - S := IntToStr(I+1); - - Tekst := CardList[I].Name; - IniFile.WriteString('Record', 'DeviceName' + S, Tekst); - - Tekst := IntToStr(CardList[I].Input); - IniFile.WriteString('Record', 'Input' + S, Tekst); - - Tekst := IntToStr(CardList[I].ChannelL); - IniFile.WriteString('Record', 'ChannelL' + S, Tekst); - - Tekst := IntToStr(CardList[I].ChannelR); - IniFile.WriteString('Record', 'ChannelR' + S, Tekst); - end; - - //Log.LogError(InttoStr(Length(CardList)) + ' Cards Saved'); - - //Advanced Settings - - //LoadAnimation - Tekst := ILoadAnimation[Ini.LoadAnimation]; - IniFile.WriteString('Advanced', 'LoadAnimation', Tekst); - - //EffectSing - Tekst := IEffectSing[Ini.EffectSing]; - IniFile.WriteString('Advanced', 'EffectSing', Tekst); - - //ScreenFade - Tekst := IScreenFade[Ini.ScreenFade]; - IniFile.WriteString('Advanced', 'ScreenFade', Tekst); - - //AskbeforeDel - Tekst := IAskbeforeDel[Ini.AskbeforeDel]; - IniFile.WriteString('Advanced', 'AskbeforeDel', Tekst); - - //OnSongClick - Tekst := IOnSongClick[Ini.OnSongClick]; - IniFile.WriteString('Advanced', 'OnSongClick', Tekst); - - //Line Bonus - Tekst := ILineBonus[Ini.LineBonus]; - IniFile.WriteString('Advanced', 'LineBonus', Tekst); - - //Party Popup - Tekst := IPartyPopup[Ini.PartyPopup]; - IniFile.WriteString('Advanced', 'PartyPopup', Tekst); - - // Joypad - Tekst := IJoypad[Ini.Joypad]; - IniFile.WriteString('Controller', 'Joypad', Tekst); - - IniFile.Free; - end; -end; - -procedure TIni.SaveNames; -var - IniFile: TIniFile; - I: integer; -begin - //if not FileIsReadOnly(GamePath + 'config.ini') then begin - //IniFile := TIniFile.Create(GamePath + 'config.ini'); - if not FileIsReadOnly(Filename) then begin - IniFile := TIniFile.Create(Filename); - - //Name - // Templates for Names Mod - for I := 1 to 12 do - IniFile.WriteString('Name', 'P' + IntToStr(I), Ini.Name[I-1]); - for I := 1 to 3 do - IniFile.WriteString('NameTeam', 'T' + IntToStr(I), Ini.NameTeam[I-1]); - for I := 1 to 12 do - IniFile.WriteString('NameTemplate', 'Name' + IntToStr(I), Ini.NameTemplate[I-1]); - - IniFile.Free; - end; -end; - -procedure TIni.SaveLevel; -var - IniFile: TIniFile; - I: integer; -begin - //if not FileIsReadOnly(GamePath + 'config.ini') then begin - //IniFile := TIniFile.Create(GamePath + 'config.ini'); - if not FileIsReadOnly(Filename) then begin - IniFile := TIniFile.Create(Filename); - - // Difficulty - IniFile.WriteString('Game', 'Difficulty', IDifficulty[Ini.Difficulty]); - - IniFile.Free; - end; -end; - -end. +unit UIni; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses IniFiles, ULog, SysUtils; + +type + TIni = class + Name: array[0..11] of string; + + // Templates for Names Mod + NameTeam: array[0..2] of string; + NameTemplate: array[0..11] of string; + + //Filename of the opened iniFile + Filename: string; + + // Game + Players: integer; + Difficulty: integer; + Language: integer; + Tabs: integer; + Tabs_at_startup:integer; //Tabs at Startup fix + Sorting: integer; + Debug: integer; + + // Graphics + Screens: integer; + Resolution: integer; + Depth: integer; + FullScreen: integer; + TextureSize: integer; + SingWindow: integer; + Oscilloscope: integer; + Spectrum: integer; + Spectrograph: integer; + MovieSize: integer; + + // Sound + MicBoost: integer; + ClickAssist: integer; + BeatClick: integer; + SavePlayback: integer; + Threshold: integer; + + //Song Preview + PreviewVolume: integer; + PreviewFading: integer; + + // Lyrics + LyricsFont: integer; + LyricsEffect: integer; + Solmization: integer; + + // Themes + Theme: integer; + SkinNo: integer; + Color: integer; + + // Record + Card: integer; // not saved in config.ini + + CardList: array of record + Name: string; + Input: integer; + ChannelL: integer; + ChannelR: integer; + end; + + // Advanced + LoadAnimation: integer; + EffectSing: integer; + ScreenFade: integer; + AskbeforeDel: integer; + OnSongClick: integer; + LineBonus: integer; + PartyPopup: integer; + + // Controller + Joypad: integer; + + // Soundcards + SoundCard: array[0..7, 1..2] of integer; + + // Devices + LPT: integer; + + procedure Load; + procedure Save; + procedure SaveNames; + procedure SaveLevel; + end; + + +var + Ini: TIni; + IResolution: array of string; + ILanguage: array of string; + ITheme: array of string; + ISkin: array of string; + ICard: array of string; + IInput: array of string; + +const + IPlayers: array[0..4] of string = ('1', '2', '3', '4', '6'); + IDifficulty: array[0..2] of string = ('Easy', 'Medium', 'Hard'); + ITabs: array[0..1] of string = ('Off', 'On'); + + ISorting: array[0..7] of string = ('Edition', 'Genre', 'Language', 'Folder', 'Title', 'Artist', 'Title2', 'Artist2'); + sEdition = 0; + sGenre = 1; + sLanguage = 2; + sFolder = 3; + sTitle = 4; + sArtist = 5; + sTitle2 = 6; + sArtist2 = 7; + + IDebug: array[0..1] of string = ('Off', 'On'); + + IScreens: array[0..1] of string = ('1', '2'); + IFullScreen: array[0..1] of string = ('Off', 'On'); + IDepth: array[0..1] of string = ('16 bit', '32 bit'); + ITextureSize: array[0..2] of string = ('128', '256', '512'); + ISingWindow: array[0..1] of string = ('Small', 'Big'); + + //SingBar Mod + IOscilloscope: array[0..2] of string = ('Off', 'Osci', 'Bar'); + //IOscilloscope: array[0..1] of string = ('Off', 'On'); + + ISpectrum: array[0..1] of string = ('Off', 'On'); + ISpectrograph: array[0..1] of string = ('Off', 'On'); + IMovieSize: array[0..2] of string = ('Half', 'Full [Vid]', 'Full [BG+Vid]'); + + IMicBoost: array[0..3] of string = ('Off', '+6dB', '+12dB', '+18dB'); + IClickAssist: array[0..1] of string = ('Off', 'On'); + IBeatClick: array[0..1] of string = ('Off', 'On'); + ISavePlayback: array[0..1] of string = ('Off', 'On'); + IThreshold: array[0..3] of string = ('5%', '10%', '15%', '20%'); + //Song Preview + IPreviewVolume: array[0..10] of string = ('Off', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%'); + IPreviewFading: array[0..5] of string = ('Off', '1 Sec', '2 Secs', '3 Secs', '4 Secs', '5 Secs'); + + + ILyricsFont: array[0..2] of string = ('Plain', 'OLine1', 'OLine2'); + ILyricsEffect: array[0..3] of string = ('Simple', 'Zoom', 'Slide', 'Ball'); + ISolmization: array[0..3] of string = ('Off', 'Euro', 'Jap', 'American'); + + IColor: array[0..8] of string = ('Blue', 'Green', 'Pink', 'Red', 'Violet', 'Orange', 'Yellow', 'Brown', 'Black'); + + // Advanced + ILoadAnimation: array[0..1] of string = ('Off', 'On'); + IEffectSing: array[0..1] of string = ('Off', 'On'); + IScreenFade: array [0..1] of String =('Off', 'On'); + IAskbeforeDel: array[0..1] of string = ('Off', 'On'); + IOnSongClick: array[0..2] of string = ('Sing', 'Select Players', 'Open Menu'); + ILineBonus: array[0..2] of string = ('Off', 'At Score', 'At Notes'); + IPartyPopup: array[0..1] of string = ('Off', 'On'); + + IJoypad: array[0..1] of string = ('Off', 'On'); + ILPT: array[0..2] of string = ('Off', 'LCD', 'Lights'); + + IChannel: array[0..6] of string = ('Off', '1', '2', '3', '4', '5', '6'); + +implementation + +uses //UFiles, + UMain, + SDL, + ULanguage, + USkins, + URecord, + UCommandLine; + +procedure TIni.Load; +var + IniFile: TMemIniFile; + ThemeIni: TMemIniFile; + Tekst: string; + Pet: integer; + B: boolean; + I, I2, I3: integer; + S: string; + Modes: PPSDL_Rect; + SR: TSearchRec; //Skin List Patch + + function GetFileName (S: String):String; + begin + //Result := copy (S,0,StrRScan (PChar(S),char('.'))+1); + Result := copy (S,0,Pos ('.ini',S)-1); + end; + +begin + GamePath := ExtractFilePath(ParamStr(0)); + + if (Params.ConfigFile <> '') then + try + IniFile := TMemIniFile.Create(Params.ConfigFile); + except + IniFile := TMemIniFile.Create(GamePath + 'config.ini'); + end + else + IniFile := TMemIniFile.Create(GamePath + 'config.ini'); + + + // Name + for I := 0 to 11 do + Ini.Name[I] := IniFile.ReadString('Name', 'P'+IntToStr(I+1), 'Player'+IntToStr(I+1)); + + + // Templates for Names Mod + for I := 0 to 2 do + Ini.NameTeam[I] := IniFile.ReadString('NameTeam', 'T'+IntToStr(I+1), 'Team'+IntToStr(I+1)); + for I := 0 to 11 do + Ini.NameTemplate[I] := IniFile.ReadString('NameTemplate', 'Name'+IntToStr(I+1), 'Template'+IntToStr(I+1)); + + // Players + Tekst := IniFile.ReadString('Game', 'Players', IPlayers[0]); + for Pet := 0 to High(IPlayers) do + if Tekst = IPlayers[Pet] then Ini.Players := Pet; + + // Difficulty + Tekst := IniFile.ReadString('Game', 'Difficulty', 'Easy'); + for Pet := 0 to High(IDifficulty) do + if Tekst = IDifficulty[Pet] then Ini.Difficulty := Pet; + + // Language + Tekst := IniFile.ReadString('Game', 'Language', 'English'); + for Pet := 0 to High(ILanguage) do + if Tekst = ILanguage[Pet] then Ini.Language := Pet; + +// Language.ChangeLanguage(ILanguage[Ini.Language]); + + // Tabs + Tekst := IniFile.ReadString('Game', 'Tabs', ITabs[0]); + for Pet := 0 to High(ITabs) do + if Tekst = ITabs[Pet] then Ini.Tabs := Pet; + + //Tabs at Startup fix + Ini.Tabs_at_startup := Ini.Tabs; + + // Sorting + Tekst := IniFile.ReadString('Game', 'Sorting', ISorting[0]); + for Pet := 0 to High(ISorting) do + if Tekst = ISorting[Pet] then Ini.Sorting := Pet; + + // Debug + Tekst := IniFile.ReadString('Game', 'Debug', IDebug[0]); + for Pet := 0 to High(IDebug) do + if Tekst = IDebug[Pet] then Ini.Debug := Pet; + + //if Ini.Debug = 1 then SongPath := 'E:\UltraStar 03\Songs\'; + + // Screens + Tekst := IniFile.ReadString('Graphics', 'Screens', IScreens[0]); + for Pet := 0 to High(IScreens) do + if Tekst = IScreens[Pet] then Ini.Screens := Pet; + + // FullScreen + Tekst := IniFile.ReadString('Graphics', 'FullScreen', 'On'); + for Pet := 0 to High(IFullScreen) do + if Tekst = IFullScreen[Pet] then Ini.FullScreen := Pet; + + + // Resolution + SetLength(IResolution, 0); + + Modes := SDL_ListModes(nil, SDL_OPENGL or SDL_FULLSCREEN); // Check if there are any modes available + while assigned( Modes^ ) do //this should solve the biggest wine problem | THANKS Linnex (11.11.07) + begin + SetLength(IResolution, Length(IResolution) + 1); + IResolution[High(IResolution)] := IntToStr(Modes^.w) + 'x' + IntToStr(Modes^.h); + Inc(Modes); + end; + + // if no modes were set, then failback to 800x600 + // as per http://sourceforge.net/forum/message.php?msg_id=4544965 + // THANKS : linnex at users.sourceforge.net + if Length(IResolution) < 1 then + begin + SetLength(IResolution, Length(IResolution) + 1); + IResolution[High(IResolution)] := IntToStr(800) + 'x' + IntToStr(600); + Log.LogStatus('SDL_ListModes Defaulted Res To : ' + IResolution[High(IResolution)] , 'Graphics - Resolutions'); + + // Default to fullscreen OFF, in this case ! + Ini.FullScreen := 0; + end; + + // reverse order + for I := 0 to (Length(IResolution) div 2) - 1 do begin + S := IResolution[I]; + IResolution[I] := IResolution[High(IResolution)-I]; + IResolution[High(IResolution)-I] := S; + end; + + Tekst := IniFile.ReadString('Graphics', 'Resolution', '800x600'); + for Pet := 0 to High(IResolution) do + if Tekst = IResolution[Pet] then Ini.Resolution := Pet; + + + // Resolution + Tekst := IniFile.ReadString('Graphics', 'Depth', '32 bit'); + for Pet := 0 to High(IDepth) do + if Tekst = IDepth[Pet] then Ini.Depth := Pet; + + // Texture Size + Tekst := IniFile.ReadString('Graphics', 'TextureSize', ITextureSize[1]); + for Pet := 0 to High(ITextureSize) do + if Tekst = ITextureSize[Pet] then Ini.TextureSize := Pet; + + // SingWindow + Tekst := IniFile.ReadString('Graphics', 'SingWindow', 'Big'); + for Pet := 0 to High(ISingWindow) do + if Tekst = ISingWindow[Pet] then Ini.SingWindow := Pet; + + // Oscilloscope + Tekst := IniFile.ReadString('Graphics', 'Oscilloscope', 'Bar'); + for Pet := 0 to High(IOscilloscope) do + if Tekst = IOscilloscope[Pet] then Ini.Oscilloscope := Pet; + + // Spectrum + Tekst := IniFile.ReadString('Graphics', 'Spectrum', 'Off'); + for Pet := 0 to High(ISpectrum) do + if Tekst = ISpectrum[Pet] then Ini.Spectrum := Pet; + + // Spectrograph + Tekst := IniFile.ReadString('Graphics', 'Spectrograph', 'Off'); + for Pet := 0 to High(ISpectrograph) do + if Tekst = ISpectrograph[Pet] then Ini.Spectrograph := Pet; + + // MovieSize + Tekst := IniFile.ReadString('Graphics', 'MovieSize', IMovieSize[2]); + for Pet := 0 to High(IMovieSize) do + if Tekst = IMovieSize[Pet] then Ini.MovieSize := Pet; + + // MicBoost + Tekst := IniFile.ReadString('Sound', 'MicBoost', 'Off'); + for Pet := 0 to High(IMicBoost) do + if Tekst = IMicBoost[Pet] then Ini.MicBoost := Pet; + + // ClickAssist + Tekst := IniFile.ReadString('Sound', 'ClickAssist', 'Off'); + for Pet := 0 to High(IClickAssist) do + if Tekst = IClickAssist[Pet] then Ini.ClickAssist := Pet; + + // BeatClick + Tekst := IniFile.ReadString('Sound', 'BeatClick', IBeatClick[0]); + for Pet := 0 to High(IBeatClick) do + if Tekst = IBeatClick[Pet] then Ini.BeatClick := Pet; + + // SavePlayback + Tekst := IniFile.ReadString('Sound', 'SavePlayback', ISavePlayback[0]); + for Pet := 0 to High(ISavePlayback) do + if Tekst = ISavePlayback[Pet] then Ini.SavePlayback := Pet; + + // Threshold + Tekst := IniFile.ReadString('Sound', 'Threshold', IThreshold[2]); + for Pet := 0 to High(IThreshold) do + if Tekst = IThreshold[Pet] then Ini.Threshold := Pet; + + //Song Preview + Tekst := IniFile.ReadString('Sound', 'PreviewVolume', IPreviewVolume[7]); + for Pet := 0 to High(IPreviewVolume) do + if Tekst = IPreviewVolume[Pet] then Ini.PreviewVolume := Pet; + + Tekst := IniFile.ReadString('Sound', 'PreviewFading', IPreviewFading[1]); + for Pet := 0 to High(IPreviewFading) do + if Tekst = IPreviewFading[Pet] then Ini.PreviewFading := Pet; + + // Lyrics Font + Tekst := IniFile.ReadString('Lyrics', 'LyricsFont', ILyricsFont[1]); + for Pet := 0 to High(ILyricsFont) do + if Tekst = ILyricsFont[Pet] then Ini.LyricsFont := Pet; + + // Lyrics Effect + Tekst := IniFile.ReadString('Lyrics', 'LyricsEffect', ILyricsEffect[1]); + for Pet := 0 to High(ILyricsEffect) do + if Tekst = ILyricsEffect[Pet] then Ini.LyricsEffect := Pet; + + // Solmization + Tekst := IniFile.ReadString('Lyrics', 'Solmization', ISolmization[0]); + for Pet := 0 to High(ISolmization) do + if Tekst = ISolmization[Pet] then Ini.Solmization := Pet; + + // Theme + + //Theme List Patch + + //I2 Saves the no of the Deluxe (Standard-) Theme + I2 := 0; + //I counts is the cur. Theme no + I := 0; + + SetLength(ITheme, 0); + FindFirst('Themes' + PathDelim + '*.ini',faAnyFile,SR); + Repeat + //Read Themename from Theme + ThemeIni := TMemIniFile.Create(SR.Name); + Tekst := UpperCase(ThemeIni.ReadString('Theme','Name',GetFileName(SR.Name))); + ThemeIni.Free; + + //if Deluxe Theme then save Themeno to I2 + if (Tekst = 'DELUXE') then + I2 := I; + + //Search for Skins for this Theme + for Pet := low(Skin.Skin) to high(Skin.Skin) do + begin + if UpperCase(Skin.Skin[Pet].Theme) = Tekst then + begin + SetLength(ITheme, Length(ITheme)+1); + ITheme[High(ITheme)] := GetFileName(SR.Name); + break; + end; + end; + + Inc(I); + Until FindNext(SR) <> 0; + FindClose(SR); + //Theme List Patch End } + + //No Theme Found + if (Length(ITheme)=0) then + begin + Log.CriticalError('Could not find any valid Themes.'); + end; + + + Tekst := IniFile.ReadString('Themes', 'Theme', ITheme[I2]); + Ini.Theme := 0; + for Pet := 0 to High(ITheme) do + if Uppercase(Tekst) = Uppercase(ITheme[Pet]) then Ini.Theme := Pet; + + // Skin + Skin.onThemeChange; + Ini.SkinNo := 0; + + Tekst := IniFile.ReadString('Themes', 'Skin', ISkin[0]); + for Pet := 0 to High(ISkin) do + if Tekst = ISkin[Pet] then Ini.SkinNo := Pet; + + // Color + Tekst := IniFile.ReadString('Themes', 'Color', IColor[0]); + for Pet := 0 to High(IColor) do + if Tekst = IColor[Pet] then Ini.Color := Pet; + + // Record - load ini list + SetLength(CardList, 0); + I := 1; + while (IniFile.ValueExists('Record', 'DeviceName' + IntToStr(I)) = true) do begin + //Automatically Delete not Existing Sound Cards + S := IniFile.ReadString('Record', 'DeviceName' + IntToStr(I), ''); + //{ + B := False; + //Look for Soundcard + for I2 := 0 to High(Recording.SoundCard) do + begin + if (S = Trim(Recording.SoundCard[I2].Description)) then + begin + B := True; + Break; + end; + end; + + if B then + begin //} + I3 := Length(CardList); + SetLength(CardList, I3+1); + Ini.CardList[I3].Name := S; + Ini.CardList[I3].Input := IniFile.ReadInteger('Record', 'Input' + IntToStr(I), 0); + Ini.CardList[I3].ChannelL := IniFile.ReadInteger('Record', 'ChannelL' + IntToStr(I), 0); + Ini.CardList[I3].ChannelR := IniFile.ReadInteger('Record', 'ChannelR' + IntToStr(I), 0); + end; + Inc(I); + end; + + // Record - append detected soundcards + for I := 0 to High(Recording.SoundCard) do + begin + B := False; + For I2 := 0 to High(CardList) do + begin //Search for Card in List + if (CardList[I2].Name = Trim(Recording.SoundCard[I].Description)) then + begin + B := True; + Break; + end; + end; + + //If not in List -> Add + If not B then + begin + I3 := Length(CardList); + SetLength(CardList, I3+1); + CardList[I3].Name := Trim(Recording.SoundCard[I].Description); + CardList[I3].Input := 0; + CardList[I3].ChannelL := 0; + CardList[I3].ChannelR := 0; + // default for new users + if (Length(CardList) = 1) then + CardList[I].ChannelL := 1; + end; + end; + + //Advanced Settings + + // LoadAnimation + Tekst := IniFile.ReadString('Advanced', 'LoadAnimation', 'On'); + for Pet := 0 to High(ILoadAnimation) do + if Tekst = ILoadAnimation[Pet] then Ini.LoadAnimation := Pet; + + // ScreenFade + Tekst := IniFile.ReadString('Advanced', 'ScreenFade', 'On'); + for Pet := 0 to High(IScreenFade) do + if Tekst = IScreenFade[Pet] then Ini.ScreenFade := Pet; + + // EffectSing + Tekst := IniFile.ReadString('Advanced', 'EffectSing', 'On'); + for Pet := 0 to High(IEffectSing) do + if Tekst = IEffectSing[Pet] then Ini.EffectSing := Pet; + + // AskbeforeDel + Tekst := IniFile.ReadString('Advanced', 'AskbeforeDel', 'On'); + for Pet := 0 to High(IAskbeforeDel) do + if Tekst = IAskbeforeDel[Pet] then Ini.AskbeforeDel := Pet; + + // OnSongClick + Tekst := IniFile.ReadString('Advanced', 'OnSongClick', 'Sing'); + for Pet := 0 to High(IOnSongClick) do + if Tekst = IOnSongClick[Pet] then Ini.OnSongClick := Pet; + + // Linebonus + Tekst := IniFile.ReadString('Advanced', 'LineBonus', 'At Score'); + for Pet := 0 to High(ILineBonus) do + if Tekst = ILineBonus[Pet] then Ini.LineBonus := Pet; + + // PartyPopup + Tekst := IniFile.ReadString('Advanced', 'PartyPopup', 'On'); + for Pet := 0 to High(IPartyPopup) do + if Tekst = IPartyPopup[Pet] then Ini.PartyPopup := Pet; + + + // Joypad + Tekst := IniFile.ReadString('Controller', 'Joypad', IJoypad[0]); + for Pet := 0 to High(IJoypad) do + if Tekst = IJoypad[Pet] then Ini.Joypad := Pet; + + // LCD + Tekst := IniFile.ReadString('Devices', 'LPT', ILPT[0]); + for Pet := 0 to High(ILPT) do + if Tekst = ILPT[Pet] then Ini.LPT := Pet; + + + // SongPath + if (Params.SongPath <> '') then + SongPath := IncludeTrailingPathDelimiter(Params.SongPath) + else + SongPath := IncludeTrailingPathDelimiter(IniFile.ReadString('Path', 'Songs', SongPath)); + + Filename := IniFile.FileName; + IniFile.Free; +end; + +procedure TIni.Save; +var + IniFile: TIniFile; + Tekst: string; + I: Integer; + S: String; +begin + //if not (FileExists(GamePath + 'config.ini') and FileIsReadOnly(GamePath + 'config.ini')) then begin + if not (FileExists(Filename) and FileIsReadOnly(Filename)) then begin + + IniFile := TIniFile.Create(Filename); + + // Players + Tekst := IPlayers[Ini.Players]; + IniFile.WriteString('Game', 'Players', Tekst); + + // Difficulty + Tekst := IDifficulty[Ini.Difficulty]; + IniFile.WriteString('Game', 'Difficulty', Tekst); + + // Language + Tekst := ILanguage[Ini.Language]; + IniFile.WriteString('Game', 'Language', Tekst); + + // Tabs + Tekst := ITabs[Ini.Tabs]; + IniFile.WriteString('Game', 'Tabs', Tekst); + + // Sorting + Tekst := ISorting[Ini.Sorting]; + IniFile.WriteString('Game', 'Sorting', Tekst); + + // Debug + Tekst := IDebug[Ini.Debug]; + IniFile.WriteString('Game', 'Debug', Tekst); + + // Screens + Tekst := IScreens[Ini.Screens]; + IniFile.WriteString('Graphics', 'Screens', Tekst); + + // FullScreen + Tekst := IFullScreen[Ini.FullScreen]; + IniFile.WriteString('Graphics', 'FullScreen', Tekst); + + // Resolution + Tekst := IResolution[Ini.Resolution]; + IniFile.WriteString('Graphics', 'Resolution', Tekst); + + // Depth + Tekst := IDepth[Ini.Depth]; + IniFile.WriteString('Graphics', 'Depth', Tekst); + + // Resolution + Tekst := ITextureSize[Ini.TextureSize]; + IniFile.WriteString('Graphics', 'TextureSize', Tekst); + + // Sing Window + Tekst := ISingWindow[Ini.SingWindow]; + IniFile.WriteString('Graphics', 'SingWindow', Tekst); + + // Oscilloscope + Tekst := IOscilloscope[Ini.Oscilloscope]; + IniFile.WriteString('Graphics', 'Oscilloscope', Tekst); + + // Spectrum + Tekst := ISpectrum[Ini.Spectrum]; + IniFile.WriteString('Graphics', 'Spectrum', Tekst); + + // Spectrograph + Tekst := ISpectrograph[Ini.Spectrograph]; + IniFile.WriteString('Graphics', 'Spectrograph', Tekst); + + // Movie Size + Tekst := IMovieSize[Ini.MovieSize]; + IniFile.WriteString('Graphics', 'MovieSize', Tekst); + + // MicBoost + Tekst := IMicBoost[Ini.MicBoost]; + IniFile.WriteString('Sound', 'MicBoost', Tekst); + + // ClickAssist + Tekst := IClickAssist[Ini.ClickAssist]; + IniFile.WriteString('Sound', 'ClickAssist', Tekst); + + // BeatClick + Tekst := IBeatClick[Ini.BeatClick]; + IniFile.WriteString('Sound', 'BeatClick', Tekst); + + // Threshold + Tekst := IThreshold[Ini.Threshold]; + IniFile.WriteString('Sound', 'Threshold', Tekst); + + // Song Preview + Tekst := IPreviewVolume[Ini.PreviewVolume]; + IniFile.WriteString('Sound', 'PreviewVolume', Tekst); + + Tekst := IPreviewFading[Ini.PreviewFading]; + IniFile.WriteString('Sound', 'PreviewFading', Tekst); + + // SavePlayback + Tekst := ISavePlayback[Ini.SavePlayback]; + IniFile.WriteString('Sound', 'SavePlayback', Tekst); + + // Lyrics Font + Tekst := ILyricsFont[Ini.LyricsFont]; + IniFile.WriteString('Lyrics', 'LyricsFont', Tekst); + + // Lyrics Effect + Tekst := ILyricsEffect[Ini.LyricsEffect]; + IniFile.WriteString('Lyrics', 'LyricsEffect', Tekst); + + // Solmization + Tekst := ISolmization[Ini.Solmization]; + IniFile.WriteString('Lyrics', 'Solmization', Tekst); + + // Theme + Tekst := ITheme[Ini.Theme]; + IniFile.WriteString('Themes', 'Theme', Tekst); + + // Skin + Tekst := ISkin[Ini.SkinNo]; + IniFile.WriteString('Themes', 'Skin', Tekst); + + // Color + Tekst := IColor[Ini.Color]; + IniFile.WriteString('Themes', 'Color', Tekst); + + // Record + for I := 0 to High(CardList) do begin + S := IntToStr(I+1); + + Tekst := CardList[I].Name; + IniFile.WriteString('Record', 'DeviceName' + S, Tekst); + + Tekst := IntToStr(CardList[I].Input); + IniFile.WriteString('Record', 'Input' + S, Tekst); + + Tekst := IntToStr(CardList[I].ChannelL); + IniFile.WriteString('Record', 'ChannelL' + S, Tekst); + + Tekst := IntToStr(CardList[I].ChannelR); + IniFile.WriteString('Record', 'ChannelR' + S, Tekst); + end; + + //Log.LogError(InttoStr(Length(CardList)) + ' Cards Saved'); + + //Advanced Settings + + //LoadAnimation + Tekst := ILoadAnimation[Ini.LoadAnimation]; + IniFile.WriteString('Advanced', 'LoadAnimation', Tekst); + + //EffectSing + Tekst := IEffectSing[Ini.EffectSing]; + IniFile.WriteString('Advanced', 'EffectSing', Tekst); + + //ScreenFade + Tekst := IScreenFade[Ini.ScreenFade]; + IniFile.WriteString('Advanced', 'ScreenFade', Tekst); + + //AskbeforeDel + Tekst := IAskbeforeDel[Ini.AskbeforeDel]; + IniFile.WriteString('Advanced', 'AskbeforeDel', Tekst); + + //OnSongClick + Tekst := IOnSongClick[Ini.OnSongClick]; + IniFile.WriteString('Advanced', 'OnSongClick', Tekst); + + //Line Bonus + Tekst := ILineBonus[Ini.LineBonus]; + IniFile.WriteString('Advanced', 'LineBonus', Tekst); + + //Party Popup + Tekst := IPartyPopup[Ini.PartyPopup]; + IniFile.WriteString('Advanced', 'PartyPopup', Tekst); + + // Joypad + Tekst := IJoypad[Ini.Joypad]; + IniFile.WriteString('Controller', 'Joypad', Tekst); + + IniFile.Free; + end; +end; + +procedure TIni.SaveNames; +var + IniFile: TIniFile; + I: integer; +begin + //if not FileIsReadOnly(GamePath + 'config.ini') then begin + //IniFile := TIniFile.Create(GamePath + 'config.ini'); + if not FileIsReadOnly(Filename) then begin + IniFile := TIniFile.Create(Filename); + + //Name + // Templates for Names Mod + for I := 1 to 12 do + IniFile.WriteString('Name', 'P' + IntToStr(I), Ini.Name[I-1]); + for I := 1 to 3 do + IniFile.WriteString('NameTeam', 'T' + IntToStr(I), Ini.NameTeam[I-1]); + for I := 1 to 12 do + IniFile.WriteString('NameTemplate', 'Name' + IntToStr(I), Ini.NameTemplate[I-1]); + + IniFile.Free; + end; +end; + +procedure TIni.SaveLevel; +var + IniFile: TIniFile; + I: integer; +begin + //if not FileIsReadOnly(GamePath + 'config.ini') then begin + //IniFile := TIniFile.Create(GamePath + 'config.ini'); + if not FileIsReadOnly(Filename) then begin + IniFile := TIniFile.Create(Filename); + + // Difficulty + IniFile.WriteString('Game', 'Difficulty', IDifficulty[Ini.Difficulty]); + + IniFile.Free; + end; +end; + +end. \ No newline at end of file -- cgit v1.2.3 From 3d2e9f4f029c5bb8868bb438d677c724ff6a2609 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Thu, 22 Nov 2007 21:05:11 +0000 Subject: Added LogBuffer to dump binary data to a file. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@628 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/ULog.pas | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index 7f0b82c4..ac08f2d5 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -45,6 +45,7 @@ type // compability procedure LogStatus(Log1, Log2: string); procedure LogError(Log1, Log2: string); overload; + procedure LogBuffer(const buf : Pointer; const bufLength : Integer; filename : string); end; var @@ -256,6 +257,24 @@ begin Halt; end; +procedure TLog.LogBuffer(const buf: Pointer; const bufLength: Integer; filename: string); +var + f : TFileStream; +begin + f := nil; + + try + f := TFileStream.Create( filename, fmCreate); + f.Write( buf^, bufLength); + f.Free; + except + on e : Exception do begin + Log.LogError('TLog.LogBuffer: Failed to log buffer into file "' + filename + '". ErrMsg: ' + e.Message); + f.Free; + end; + end; +end; + end. -- cgit v1.2.3 From ffd5802b61992b3b6a5f891036c1717fa4de7d6b Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Thu, 22 Nov 2007 23:46:45 +0000 Subject: Fixed texture drawing on Mac OS X (looks like BackImg.Z was not initialized). Now BackImg.Z is set to 0. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@629 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 | 112 ++----- .../MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser | 348 +++++++++++++-------- .../MacOSX/UltraStarDX.xcodeproj/project.pbxproj | 6 +- Game/Code/Menu/UMenu.pas | 1 + 4 files changed, 255 insertions(+), 212 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 index 60534b6e..578575c4 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1 @@ -190,7 +190,7 @@ Content PBXProjectModuleGUID - 2C89379C0CE3A0CD005D8A87 + 2CAE5FE50CE3B914009D9EF2 PBXProjectModuleLabel USongs.pas PBXSplitModuleInNavigatorKey @@ -198,16 +198,16 @@ Split0 PBXProjectModuleGUID - 2C89379D0CE3A0CD005D8A87 + 2CAE5FE60CE3B914009D9EF2 PBXProjectModuleLabel USongs.pas _historyCapacity 0 bookmark - 2C8938830CE3AFCE005D8A87 + 2CF1EFD70CE77D5600B5167D history - 2C8938610CE3A901005D8A87 + 2C0B367E0CE3D50000158AB2 SplitCount @@ -230,64 +230,24 @@ Content PBXProjectModuleGUID - 2C89386D0CE3AD9B005D8A87 + 2CC28B200CE3C14E00D16793 PBXProjectModuleLabel - UltraStarDX.pas + UPlatformWindows.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2C89386E0CE3AD9B005D8A87 + 2CC28B210CE3C14E00D16793 PBXProjectModuleLabel - UltraStarDX.pas + UPlatformWindows.pas _historyCapacity 0 bookmark - 2C8938840CE3AFCE005D8A87 + 2CF1EFD80CE77D5600B5167D history - 2C8938690CE3AD88005D8A87 - - - SplitCount - 1 - - StatusBarVisibility - - - Geometry - - Frame - {{0, 20}, {987, 762}} - PBXModuleWindowStatusBarHidden2 - - RubberWindowFrame - 189 142 987 803 0 0 1680 1028 - - - - Content - - PBXProjectModuleGUID - 2C8938710CE3AD9B005D8A87 - PBXProjectModuleLabel - UPlatformMacOSX.pas - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 2C8938720CE3AD9B005D8A87 - PBXProjectModuleLabel - UPlatformMacOSX.pas - _historyCapacity - 0 - bookmark - 2C8938850CE3AFCE005D8A87 - history - - 2C8938630CE3AA53005D8A87 + 2C0B367F0CE3D50000158AB2 SplitCount @@ -303,7 +263,7 @@ PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 12 87 776 900 0 0 1680 1028 + 15 123 776 900 0 0 1680 1028 @@ -340,8 +300,6 @@ Layout - BecomeActive - ContentConfiguration PBXBottomSmartGroupGIDs @@ -385,7 +343,7 @@ PBXSmartGroupTreeModuleOutlineStateSelectionKey - 22 + 17 15 0 @@ -410,7 +368,7 @@ 266 RubberWindowFrame - 759 271 817 753 0 0 1680 1028 + 858 143 817 753 0 0 1680 1028 Module PBXSmartGroupTreeModule @@ -447,7 +405,7 @@ Frame {{0, 0}, {529, 0}} RubberWindowFrame - 759 271 817 753 0 0 1680 1028 + 858 143 817 753 0 0 1680 1028 Module PBXNavigatorGroup @@ -455,6 +413,8 @@ 0pt + BecomeActive + ContentConfiguration PBXProjectModuleGUID @@ -467,7 +427,7 @@ Frame {{0, 5}, {529, 707}} RubberWindowFrame - 759 271 817 753 0 0 1680 1028 + 858 143 817 753 0 0 1680 1028 Module XCDetailModule @@ -491,9 +451,9 @@ TableOfContents - 2C8937960CE3A0CC005D8A87 + 2CF1EFD10CE77D5600B5167D 1CE0B1FE06471DED0097A5F4 - 2C8937970CE3A0CC005D8A87 + 2CF1EFD20CE77D5600B5167D 1CE0B20306471E060097A5F4 1CE0B20506471E060097A5F4 @@ -627,21 +587,13 @@ 5 WindowOrderList - 1C530D57069F1CE1000CFCEE - 2C8937D10CE3A1FF005D8A87 - 2C8937D20CE3A1FF005D8A87 - 2CDD4BFC0CB948FC00549FAC - 2CDD4B730CB935C700549FAC - 1CD10A99069EF8BA00B06720 - 2C8937230CE3926A005D8A87 - 2C8938710CE3AD9B005D8A87 - 2C89386D0CE3AD9B005D8A87 - 2C89379C0CE3A0CD005D8A87 - /Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj + 2CC28B200CE3C14E00D16793 + 2CAE5FE50CE3B914009D9EF2 1C0AD2B3069F1EA900FABCE6 + /Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj WindowString - 759 271 817 753 0 0 1680 1028 + 858 143 817 753 0 0 1680 1028 WindowTools @@ -657,14 +609,12 @@ Dock - BecomeActive - ContentConfiguration PBXProjectModuleGUID 1CD0528F0623707200166675 PBXProjectModuleLabel - UPlatform.pas + StatusBarVisibility @@ -720,7 +670,7 @@ TableOfContents 2CDD4B730CB935C700549FAC - 2C89375C0CE396D8005D8A87 + 2C0B36810CE3D50000158AB2 1CD0528F0623707200166675 XCMainBuildResultsModuleGUID @@ -867,7 +817,7 @@ PBXProjectModuleGUID 1CDD528C0622207200134675 PBXProjectModuleLabel - UMusic.pas + UCommon.pas StatusBarVisibility @@ -923,8 +873,8 @@ TableOfContents 1C530D57069F1CE1000CFCEE - 2C89383B0CE3A559005D8A87 - 2C89383C0CE3A559005D8A87 + 2C5C69C90CE3B3AF00545A7B + 2C5C69CA0CE3B3AF00545A7B 1CDD528C0622207200134675 1CD0528E0623707200166675 @@ -933,7 +883,7 @@ WindowToolGUID 1C530D57069F1CE1000CFCEE WindowToolIsVisible - + Identifier @@ -1082,9 +1032,9 @@ TableOfContents 1C0AD2B3069F1EA900FABCE6 - 2C8937C80CE3A1ED005D8A87 + 2CF1EFD50CE77D5600B5167D 1CD0528B0623707200166675 - 2C8937C90CE3A1ED005D8A87 + 2CF1EFD60CE77D5600B5167D ToolbarConfiguration xcode.toolbar.config.run diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser index d421585b..bc713544 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser @@ -1,9 +1,77 @@ // !$*UTF8*$! { + 2C2DB59F0CF64B6900786BB9 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9DCE0CC9EE6F0031092D /* UMenu.pas */; + rLen = 0; + rLoc = 768; + rType = 1; + }; + 2C2DB5A60CF64BA500786BB9 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9DCE0CC9EE6F0031092D /* UMenu.pas */; + name = "UMenu.pas: 752"; + rLen = 0; + rLoc = 28010; + rType = 0; + vrLen = 1215; + vrLoc = 27813; + }; + 2C2DB5A70CF64BA500786BB9 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2CF54F4A0CDA1B2B00627463 /* UScreenMain.pas */; + name = "UScreenMain.pas: 150"; + rLen = 0; + rLoc = 3430; + rType = 0; + vrLen = 1705; + vrLoc = 2876; + }; + 2C2DB5A80CF64BA500786BB9 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */; + name = "UScreenCredits.pas: 768"; + rLen = 471; + rLoc = 26865; + rType = 0; + vrLen = 2367; + vrLoc = 25405; + }; + 2C2DB5A90CF64BA500786BB9 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; + name = "UTexture.pas: 637"; + rLen = 0; + rLoc = 19395; + rType = 0; + vrLen = 1984; + vrLoc = 18649; + }; + 2C2DB5AA0CF64BA500786BB9 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C880CC9EC8C0031092D /* USkins.pas */; + name = "USkins.pas: 138"; + rLen = 0; + rLoc = 3097; + rType = 0; + vrLen = 1352; + vrLoc = 1935; + }; + 2C2DB5AB0CF64BA500786BB9 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C8C0CC9EC8C0031092D /* UThemes.pas */; + name = "UThemes.pas: 886"; + rLen = 0; + rLoc = 25381; + rType = 0; + vrLen = 2043; + vrLoc = 24248; + }; 2C4D9C620CC9EC8C0031092D /* TextGL.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {758, 7840}}"; - sepNavSelRange = "{2871, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {729, 7728}}"; + sepNavSelRange = "{4228, 11}"; + sepNavVisRange = "{3672, 1043}"; sepNavVisRect = "{{0, 5908}, {758, 716}}"; sepNavWindowFrame = "{{38, 157}, {797, 845}}"; }; @@ -43,8 +111,8 @@ 2C4D9C670CC9EC8C0031092D /* UCommon.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {715, 4228}}"; - sepNavSelRange = "{30, 42}"; - sepNavVisRect = "{{0, 0}, {715, 815}}"; + sepNavSelRange = "{1581, 322}"; + sepNavVisRect = "{{0, 508}, {715, 815}}"; sepNavWindowFrame = "{{38, 58}, {754, 944}}"; }; }; @@ -82,8 +150,9 @@ }; 2C4D9C6C0CC9EC8C0031092D /* UDLLManager.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1436, 3486}}"; - sepNavSelRange = "{1375, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {1424, 3542}}"; + sepNavSelRange = "{4330, 0}"; + sepNavVisRange = "{3445, 1320}"; sepNavVisRect = "{{0, 456}, {758, 716}}"; sepNavWindowFrame = "{{15, 178}, {797, 845}}"; }; @@ -106,8 +175,9 @@ }; 2C4D9C6F0CC9EC8C0031092D /* UGraphic.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {830, 10444}}"; - sepNavSelRange = "{7232, 12}"; + sepNavIntBoundsRect = "{{0, 0}, {729, 10626}}"; + sepNavSelRange = "{16099, 0}"; + sepNavVisRange = "{13982, 870}"; sepNavVisRect = "{{0, 3790}, {749, 470}}"; sepNavWindowFrame = "{{38, 157}, {797, 845}}"; }; @@ -170,8 +240,9 @@ }; 2C4D9C780CC9EC8C0031092D /* ULog.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {758, 3668}}"; - sepNavSelRange = "{6056, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {842, 4102}}"; + sepNavSelRange = "{6569, 0}"; + sepNavVisRange = "{6421, 474}"; sepNavVisRect = "{{0, 147}, {758, 716}}"; sepNavWindowFrame = "{{38, 157}, {797, 845}}"; }; @@ -186,16 +257,18 @@ }; 2C4D9C7A0CC9EC8C0031092D /* ULyrics.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1220, 7700}}"; - sepNavSelRange = "{11162, 13}"; + sepNavIntBoundsRect = "{{0, 0}, {738, 7476}}"; + sepNavSelRange = "{169, 0}"; + sepNavVisRange = "{0, 2043}"; sepNavVisRect = "{{0, 4395}, {758, 716}}"; sepNavWindowFrame = "{{61, 136}, {797, 845}}"; }; }; 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1013, 15204}}"; - sepNavSelRange = "{137, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {842, 14980}}"; + sepNavSelRange = "{7383, 0}"; + sepNavVisRange = "{6895, 743}"; sepNavVisRect = "{{0, 0}, {1013, 614}}"; sepNavWindowFrame = "{{222, 91}, {1052, 743}}"; }; @@ -226,8 +299,9 @@ }; 2C4D9C7F0CC9EC8C0031092D /* UParty.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1305, 8610}}"; - sepNavSelRange = "{7616, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {854, 8988}}"; + sepNavSelRange = "{17977, 0}"; + sepNavVisRange = "{16881, 1096}"; sepNavVisRect = "{{0, 3141}, {1305, 534}}"; sepNavWindowFrame = "{{15, 178}, {797, 845}}"; }; @@ -290,8 +364,9 @@ }; 2C4D9C880CC9EC8C0031092D /* USkins.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {923, 2464}}"; - sepNavSelRange = "{1178, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {738, 2464}}"; + sepNavSelRange = "{3097, 0}"; + sepNavVisRange = "{1935, 1352}"; sepNavVisRect = "{{0, 550}, {923, 342}}"; sepNavWindowFrame = "{{61, 136}, {797, 845}}"; }; @@ -299,8 +374,8 @@ 2C4D9C890CC9EC8C0031092D /* USongs.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {950, 12908}}"; - sepNavSelRange = "{8059, 0}"; - sepNavVisRect = "{{0, 4142}, {758, 716}}"; + sepNavSelRange = "{7752, 9}"; + sepNavVisRect = "{{0, 4157}, {758, 716}}"; sepNavWindowFrame = "{{15, 156}, {797, 845}}"; }; }; @@ -314,18 +389,20 @@ }; 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1730, 16002}}"; - sepNavSelRange = "{36398, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {860, 16324}}"; + sepNavSelRange = "{19395, 0}"; + sepNavVisRange = "{18649, 1984}"; sepNavVisRect = "{{0, 3420}, {737, 826}}"; sepNavWindowFrame = "{{15, 68}, {776, 955}}"; }; }; 2C4D9C8C0CC9EC8C0031092D /* UThemes.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {923, 31010}}"; - sepNavSelRange = "{21229, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {738, 33124}}"; + sepNavSelRange = "{25381, 0}"; + sepNavVisRange = "{24248, 2043}"; sepNavVisRect = "{{0, 19678}, {923, 342}}"; - sepNavWindowFrame = "{{130, 73}, {797, 845}}"; + sepNavWindowFrame = "{{28, 161}, {797, 845}}"; }; }; 2C4D9C8D0CC9EC8C0031092D /* UTime.pas */ = { @@ -338,8 +415,9 @@ }; 2C4D9C8E0CC9EC8C0031092D /* UVideo.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {902, 9646}}"; - sepNavSelRange = "{12347, 13}"; + sepNavIntBoundsRect = "{{0, 0}, {746, 10024}}"; + sepNavSelRange = "{12365, 13}"; + sepNavVisRange = "{11732, 1140}"; sepNavVisRect = "{{0, 5722}, {749, 470}}"; sepNavWindowFrame = "{{15, 178}, {797, 845}}"; }; @@ -370,24 +448,27 @@ }; 2C4D9DCC0CC9EE6F0031092D /* UDisplay.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {794, 6734}}"; - sepNavSelRange = "{9129, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {796, 6706}}"; + sepNavSelRange = "{3871, 0}"; + sepNavVisRange = "{7952, 477}"; sepNavVisRect = "{{0, 4834}, {758, 716}}"; sepNavWindowFrame = "{{38, 157}, {797, 845}}"; }; }; 2C4D9DCD0CC9EE6F0031092D /* UDrawTexture.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {758, 1470}}"; - sepNavSelRange = "{54, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {738, 1470}}"; + sepNavSelRange = "{2779, 0}"; + sepNavVisRange = "{937, 1764}"; sepNavVisRect = "{{0, 0}, {758, 716}}"; sepNavWindowFrame = "{{61, 136}, {797, 845}}"; }; }; 2C4D9DCE0CC9EE6F0031092D /* UMenu.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1502, 21658}}"; - sepNavSelRange = "{11354, 12}"; + sepNavIntBoundsRect = "{{0, 0}, {842, 22372}}"; + sepNavSelRange = "{28728, 0}"; + sepNavVisRange = "{28445, 689}"; sepNavVisRect = "{{0, 3972}, {749, 470}}"; sepNavWindowFrame = "{{38, 157}, {797, 845}}"; }; @@ -434,8 +515,9 @@ }; 2C4D9DD40CC9EE6F0031092D /* UMenuStatic.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {577, 1204}}"; - sepNavSelRange = "{53, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {842, 1204}}"; + sepNavSelRange = "{400, 0}"; + sepNavVisRange = "{184, 530}"; sepNavVisRect = "{{0, 0}, {577, 612}}"; sepNavWindowFrame = "{{107, 198}, {616, 741}}"; }; @@ -487,69 +569,72 @@ sepNavWindowFrame = "{{15, 282}, {616, 741}}"; }; }; - 2C8937290CE393FB005D8A87 /* UPlatform.pas */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {737, 826}}"; - sepNavSelRange = "{654, 0}"; - sepNavVisRect = "{{0, 0}, {737, 826}}"; - sepNavWindowFrame = "{{200, 62}, {776, 955}}"; - }; - }; - 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {737, 938}}"; - sepNavSelRange = "{1158, 0}"; - sepNavVisRect = "{{0, 111}, {737, 827}}"; - sepNavWindowFrame = "{{12, 31}, {776, 956}}"; - }; - }; - 2C8938610CE3A901005D8A87 /* PBXTextBookmark */ = { + 2C71B9290CF6478000048804 /* PBXTextBookmark */ = { isa = PBXTextBookmark; - fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; - name = "USongs.pas: 467"; + fRef = 2CF54F4A0CDA1B2B00627463 /* UScreenMain.pas */; + name = "UScreenMain.pas: 150"; rLen = 0; - rLoc = 8854; + rLoc = 3430; rType = 0; - vrLen = 1589; - vrLoc = 12291; + vrLen = 1719; + vrLoc = 2876; }; - 2C8938630CE3AA53005D8A87 /* PBXBookmark */ = { - isa = PBXBookmark; - fRef = 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */; - }; - 2C8938690CE3AD88005D8A87 /* PBXBookmark */ = { - isa = PBXBookmark; - fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; + 2C71B92B0CF6478000048804 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */; + name = "UScreenCredits.pas: 768"; + rLen = 471; + rLoc = 26865; + rType = 0; + vrLen = 2367; + vrLoc = 25405; }; - 2C8938830CE3AFCE005D8A87 /* PBXTextBookmark */ = { + 2C71B92C0CF6478000048804 /* PBXTextBookmark */ = { isa = PBXTextBookmark; - fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; - name = "USongs.pas: 315"; + fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; + name = "UTexture.pas: 637"; rLen = 0; - rLoc = 8059; + rLoc = 19395; rType = 0; - vrLen = 1284; - vrLoc = 7645; + vrLen = 1984; + vrLoc = 18649; }; - 2C8938840CE3AFCE005D8A87 /* PBXTextBookmark */ = { + 2C71B92D0CF6478000048804 /* PBXTextBookmark */ = { isa = PBXTextBookmark; - fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; - name = "UltraStarDX.pas: 3"; + fRef = 2C4D9C880CC9EC8C0031092D /* USkins.pas */; + name = "USkins.pas: 138"; rLen = 0; - rLoc = 37; + rLoc = 3097; rType = 0; - vrLen = 141; - vrLoc = 0; + vrLen = 1352; + vrLoc = 1935; }; - 2C8938850CE3AFCE005D8A87 /* PBXTextBookmark */ = { + 2C71B92E0CF6478000048804 /* PBXTextBookmark */ = { isa = PBXTextBookmark; - fRef = 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */; - name = "UPlatformMacOSX.pas: 52"; + fRef = 2C4D9C8C0CC9EC8C0031092D /* UThemes.pas */; + name = "UThemes.pas: 886"; rLen = 0; - rLoc = 1158; + rLoc = 25381; rType = 0; - vrLen = 1411; - vrLoc = 80; + vrLen = 2043; + vrLoc = 24248; + }; + 2C8937290CE393FB005D8A87 /* UPlatform.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {717, 827}}"; + sepNavSelRange = "{426, 0}"; + sepNavVisRange = "{0, 1116}"; + sepNavVisRect = "{{0, 0}, {737, 826}}"; + sepNavWindowFrame = "{{200, 62}, {776, 955}}"; + }; + }; + 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {737, 938}}"; + sepNavSelRange = "{1158, 0}"; + sepNavVisRect = "{{0, 105}, {737, 827}}"; + sepNavWindowFrame = "{{12, 61}, {776, 956}}"; + }; }; 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = { uiCtxt = { @@ -559,22 +644,14 @@ sepNavWindowFrame = "{{38, 259}, {1052, 743}}"; }; }; - 2CDD439C0CBBE92D00F364DE /* UMain.pas */ = { - isa = PBXFileReference; - fileEncoding = 30; - lastKnownFileType = sourcecode.pascal; - name = UMain.pas; - path = /Users/eddie/Projekte/UltraStar/UltraStarSource/Main/UMain.pas; - sourceTree = ""; - }; 2CDD4B5D0CB9354800549FAC /* UltraStarDX */ = { isa = PBXExecutable; - activeArgIndex = 2147483647; activeArgIndices = ( ); argumentStrings = ( ); autoAttachOnCrash = 1; + breakpointsEnabled = 0; configStateDict = { }; customDataFormattersEnabled = 1; @@ -607,27 +684,6 @@ isa = PBXCodeSenseManager; indexTemplatePath = ""; }; - 2CDD4B7F0CB9394600549FAC /* XCBreakpointsBucket */ = { - isa = XCBreakpointsBucket; - name = "Project Breakpoints"; - objects = ( - 2CDEA8080CBD7D920096994C /* UMain.pas:293 */, - ); - }; - 2CDEA8080CBD7D920096994C /* UMain.pas:293 */ = { - isa = PBXFileBreakpoint; - actions = ( - ); - breakpointStyle = 0; - continueAfterActions = 0; - delayBeforeContinue = 0; - fileReference = 2CDD439C0CBBE92D00F364DE /* UMain.pas */; - hitCount = 1; - lineNumber = 293; - location = UltraStarDX; - modificationTime = 216245614.79797; - state = 1; - }; 2CEA2AF00CE3868E0097A5FF /* PseudoThread.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {737, 826}}"; @@ -654,8 +710,9 @@ }; 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1196, 19586}}"; - sepNavSelRange = "{50178, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {695, 19544}}"; + sepNavSelRange = "{26865, 471}"; + sepNavVisRange = "{25405, 2367}"; sepNavVisRect = "{{0, 1770}, {715, 815}}"; sepNavWindowFrame = "{{15, 79}, {754, 944}}"; }; @@ -710,10 +767,11 @@ }; 2CF54F4A0CDA1B2B00627463 /* UScreenMain.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {715, 3990}}"; - sepNavSelRange = "{55, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {695, 4102}}"; + sepNavSelRange = "{3430, 0}"; + sepNavVisRange = "{2876, 1705}"; sepNavVisRect = "{{0, 0}, {715, 815}}"; - sepNavWindowFrame = "{{38, 58}, {754, 944}}"; + sepNavWindowFrame = "{{38, 79}, {754, 944}}"; }; }; 2CF54F4B0CDA1B2B00627463 /* UScreenName.pas */ = { @@ -870,10 +928,11 @@ }; 2CF54F5E0CDA1B2B00627463 /* UScreenSong.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1700, 29050}}"; - sepNavSelRange = "{23456, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {1112, 30352}}"; + sepNavSelRange = "{25430, 0}"; + sepNavVisRange = "{24530, 2449}"; sepNavVisRect = "{{0, 11219}, {1277, 312}}"; - sepNavWindowFrame = "{{38, 58}, {754, 944}}"; + sepNavWindowFrame = "{{38, 78}, {754, 944}}"; }; }; 2CF54F5F0CDA1B2B00627463 /* UScreenSongJumpto.pas */ = { @@ -1032,6 +1091,7 @@ activeExec = 0; }; DDC6850F09F5717A004E4BFF /* Project object */ = { + activeArchitecture = i386; activeBuildConfigurationName = Debug; activeExecutable = 2CDD4B5D0CB9354800549FAC /* UltraStarDX */; activeTarget = DDC688C709F574E9004E4BFF /* UltraStarDX */; @@ -1040,14 +1100,36 @@ DDC688D409F57523004E4BFF /* Put all program sources also in this target */, ); breakpoints = ( - 2CDEA8080CBD7D920096994C /* UMain.pas:293 */, ); - breakpointsGroup = 2CDD4B7F0CB9394600549FAC /* XCBreakpointsBucket */; codeSenseManager = 2CDD4B6A0CB9357000549FAC /* Code sense */; executables = ( 2CDD4B5D0CB9354800549FAC /* UltraStarDX */, ); perUserDictionary = { + "PBXConfiguration.PBXBreakpointsDataSource.v1:1CA1AED706398EBD00589147" = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXBreakpointsDataSource_BreakpointID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 20, + 198, + 20, + 99, + 99, + 29, + 20, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXBreakpointsDataSource_ActionID, + PBXBreakpointsDataSource_TypeID, + PBXBreakpointsDataSource_BreakpointID, + PBXBreakpointsDataSource_UseID, + PBXBreakpointsDataSource_LocationID, + PBXBreakpointsDataSource_ConditionID, + PBXBreakpointsDataSource_IgnoreCountID, + PBXBreakpointsDataSource_ContinueID, + ); + }; PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = { PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID; @@ -1146,16 +1228,22 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 216240742; - PBXWorkspaceStateSaveDate = 216240742; + PBXPerProjectTemplateStateSaveDate = 217466767; + PBXWorkspaceStateSaveDate = 217466767; }; perUserProjectItems = { - 2C8938610CE3A901005D8A87 /* PBXTextBookmark */ = 2C8938610CE3A901005D8A87 /* PBXTextBookmark */; - 2C8938630CE3AA53005D8A87 /* PBXBookmark */ = 2C8938630CE3AA53005D8A87 /* PBXBookmark */; - 2C8938690CE3AD88005D8A87 /* PBXBookmark */ = 2C8938690CE3AD88005D8A87 /* PBXBookmark */; - 2C8938830CE3AFCE005D8A87 /* PBXTextBookmark */ = 2C8938830CE3AFCE005D8A87 /* PBXTextBookmark */; - 2C8938840CE3AFCE005D8A87 /* PBXTextBookmark */ = 2C8938840CE3AFCE005D8A87 /* PBXTextBookmark */; - 2C8938850CE3AFCE005D8A87 /* PBXTextBookmark */ = 2C8938850CE3AFCE005D8A87 /* PBXTextBookmark */; + 2C2DB59F0CF64B6900786BB9 /* PBXTextBookmark */ = 2C2DB59F0CF64B6900786BB9 /* PBXTextBookmark */; + 2C2DB5A60CF64BA500786BB9 /* PBXTextBookmark */ = 2C2DB5A60CF64BA500786BB9 /* PBXTextBookmark */; + 2C2DB5A70CF64BA500786BB9 /* PBXTextBookmark */ = 2C2DB5A70CF64BA500786BB9 /* PBXTextBookmark */; + 2C2DB5A80CF64BA500786BB9 /* PBXTextBookmark */ = 2C2DB5A80CF64BA500786BB9 /* PBXTextBookmark */; + 2C2DB5A90CF64BA500786BB9 /* PBXTextBookmark */ = 2C2DB5A90CF64BA500786BB9 /* PBXTextBookmark */; + 2C2DB5AA0CF64BA500786BB9 /* PBXTextBookmark */ = 2C2DB5AA0CF64BA500786BB9 /* PBXTextBookmark */; + 2C2DB5AB0CF64BA500786BB9 /* PBXTextBookmark */ = 2C2DB5AB0CF64BA500786BB9 /* PBXTextBookmark */; + 2C71B9290CF6478000048804 /* PBXTextBookmark */ = 2C71B9290CF6478000048804 /* PBXTextBookmark */; + 2C71B92B0CF6478000048804 /* PBXTextBookmark */ = 2C71B92B0CF6478000048804 /* PBXTextBookmark */; + 2C71B92C0CF6478000048804 /* PBXTextBookmark */ = 2C71B92C0CF6478000048804 /* PBXTextBookmark */; + 2C71B92D0CF6478000048804 /* PBXTextBookmark */ = 2C71B92D0CF6478000048804 /* PBXTextBookmark */; + 2C71B92E0CF6478000048804 /* PBXTextBookmark */ = 2C71B92E0CF6478000048804 /* PBXTextBookmark */; }; sourceControlManager = 2CDD4B690CB9357000549FAC /* Source Control */; userBuildSettings = { diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj index c1ce71ee..447b1155 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj @@ -384,7 +384,7 @@ 2C4D9C700CC9EC8C0031092D /* UGraphicClasses.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UGraphicClasses.pas; path = ../Classes/UGraphicClasses.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4D9C710CC9EC8C0031092D /* UHooks.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UHooks.pas; path = ../Classes/UHooks.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4D9C720CC9EC8C0031092D /* UIni.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UIni.pas; path = ../Classes/UIni.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; - 2C4D9C730CC9EC8C0031092D /* UJoystick.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UJoystick.pas; path = ../Classes/UJoystick.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2C4D9C730CC9EC8C0031092D /* UJoystick.pas */ = {isa = PBXFileReference; explicitFileType = sourcecode.pascal; fileEncoding = 5; indentWidth = 2; name = UJoystick.pas; path = ../Classes/UJoystick.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4D9C740CC9EC8C0031092D /* ULanguage.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = ULanguage.pas; path = ../Classes/ULanguage.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4D9C760CC9EC8C0031092D /* ULCD.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = ULCD.pas; path = ../Classes/ULCD.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4D9C770CC9EC8C0031092D /* ULight.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = ULight.pas; path = ../Classes/ULight.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; @@ -875,10 +875,12 @@ DDC6850F09F5717A004E4BFF /* Project object */ = { isa = PBXProject; buildConfigurationList = DDC6851009F5717A004E4BFF /* Build configuration list for PBXProject "UltraStarDX" */; + compatibilityVersion = "Xcode 2.4"; hasScannedForEncodings = 0; mainGroup = DDC6850D09F5717A004E4BFF; productRefGroup = DDC6888C09F57243004E4BFF /* Products */; projectDirPath = ""; + projectRoot = ""; targets = ( DDC688C709F574E9004E4BFF /* UltraStarDX */, DDC688D409F57523004E4BFF /* Put all program sources also in this target */, @@ -1280,6 +1282,7 @@ HEADER_SEARCH_PATHS = ""; LIBRARY_SEARCH_PATHS = ""; REZ_SEARCH_PATHS = ""; + SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; USER_HEADER_SEARCH_PATHS = ""; }; name = Debug; @@ -1293,6 +1296,7 @@ FPC_OVERRIDE_OPTIONS = ""; FPC_RTL_UNITS_BASE = /usr/local/lib/fpc/; FPC_SPECIFIC_OPTIONS = "-Ci- -Cr- -Co- -O3 -Xs "; + SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; }; name = Release; }; diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 84cbe8a3..99f10c08 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -767,6 +767,7 @@ begin BackImg.Y:=BackW; } BackImg.X := 0; BackImg.Y := 0; + BackImg.Z := 0; // todo: eddie: to the opengl experts: please check this! On the mac z is not initialized??? BackImg.W := 800; BackImg.H := 600; DrawTexture(BackImg); -- cgit v1.2.3 From 96bad07609c8f0036dc482a74797deabeac46d33 Mon Sep 17 00:00:00 2001 From: jekatt Date: Fri, 23 Nov 2007 14:30:13 +0000 Subject: Fixed: PartyModus: SinglePlayer Teams but only Multiplayer Plugins available git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@633 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenPartyOptions.pas | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 85ee65bc..46a075ce 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -51,6 +51,7 @@ uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UDLLManager, UPlaylist, function TScreenPartyOptions.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; var I, J: Integer; + OnlyMultiPlayer: boolean; begin Result := true; If (PressedDown) Then @@ -74,7 +75,15 @@ begin //Don'T start when Playlist is Selected and there are no Playlists If (Playlist = 2) and (Length(PlaylistMan.Playlists) = 0) then Exit; - + // Don't start when SinglePlayer Teams but only Multiplayer Plugins available + OnlyMultiPlayer:=true; + for I := 0 to High(DLLMan.Plugins) do begin + OnlyMultiPlayer := (OnlyMultiPlayer AND DLLMan.Plugins[I].TeamModeOnly); + end; + if (OnlyMultiPlayer) AND ((NumPlayer1 = 0) OR (NumPlayer2 = 0) OR ((NumPlayer3 = 0) AND (NumTeams = 1))) then begin + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS')); + Exit; + end; //Save Difficulty Ini.Difficulty := SelectsS[SelectLevel].SelectedOption; Ini.SaveLevel; -- cgit v1.2.3 From d8c84c39ed5d060e0c172e6fa478936a6337c147 Mon Sep 17 00:00:00 2001 From: mogguh Date: Fri, 23 Nov 2007 18:48:31 +0000 Subject: Fonts are readable again, didn't edit the outline fonts (will be done later, maybe) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@641 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.pas | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index 7475da7a..ed897071 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -140,7 +140,7 @@ begin Log.LogStatus( 'Font' , '---------------------------'); SetLength(Fonts, 5); - Fonts[0].Tex := Texture.LoadTexture(true, 'Font', 'PNG', 'Font', 0); + Fonts[0].Tex := Texture.LoadTexture(true, 'Font', 'PNG', 'Transparent', 0); Fonts[0].Tex.H := 30; Fonts[0].AspectW := 0.9; Fonts[0].Done := -1; @@ -148,21 +148,21 @@ begin Log.LogStatus( 'FontB' , '---------------------------'); - Fonts[1].Tex := Texture.LoadTexture(true, 'FontB', 'PNG', 'Font', 0); + Fonts[1].Tex := Texture.LoadTexture(true, 'FontB', 'PNG', 'Transparent', 0); Fonts[1].Tex.H := 30; Fonts[1].AspectW := 1; Fonts[1].Done := -1; Fonts[1].Outline := 0; Log.LogStatus( 'FontO' , '---------------------------'); - Fonts[2].Tex := Texture.LoadTexture(true, 'FontO', 'PNG', 'Font Outline', 0); + Fonts[2].Tex := Texture.LoadTexture(true, 'FontO', 'PNG', 'Transparent', 0); Fonts[2].Tex.H := 30; Fonts[2].AspectW := 0.95; Fonts[2].Done := -1; Fonts[2].Outline := 5; Log.LogStatus( 'FontO2' , '---------------------------'); - Fonts[3].Tex := Texture.LoadTexture(true, 'FontO2', 'PNG', 'Font Outline 2', 0); + Fonts[3].Tex := Texture.LoadTexture(true, 'FontO2', 'PNG', 'Transparent', 0); Fonts[3].Tex.H := 30; Fonts[3].AspectW := 0.95; Fonts[3].Done := -1; @@ -262,7 +262,7 @@ begin glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); - glBlendFunc(GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBindTexture(GL_TEXTURE_2D, TexNum); glBegin(GL_QUADS); @@ -321,7 +321,7 @@ begin glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); - glBlendFunc(GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBindTexture(GL_TEXTURE_2D, TexNum); glBegin(GL_QUADS); glTexCoord2f(TexX, TexY); glVertex2f(PL+XItal, PT); -- cgit v1.2.3 From 2a3e98281141c47b08eb3876d7ed52fdfe4daa81 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Fri, 23 Nov 2007 19:53:21 +0000 Subject: Now it should build again... git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@644 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSingModi.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 5e9d94ec..5d87ffdd 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -133,7 +133,7 @@ begin begin Result.Sentence[I].Start := Czeski.Czesc[I].Start; Result.Sentence[I].StartNote := Czeski.Czesc[I].StartNote; - Result.Sentence[I].Lyric := Czeski.Czesc[I].Lyric; + Result.Sentence[I].Lyric := Czeski.Czesc[I].Lyric; Result.Sentence[I].LyricWidth := Czeski.Czesc[I].LyricWidth; Result.Sentence[I].Koniec := Czeski.Czesc[I].Koniec; Result.Sentence[I].BaseNote := Czeski.Czesc[I].BaseNote; -- cgit v1.2.3 From 83ffc1a1d5b10b4ae77228c501f40d3e32f106fc Mon Sep 17 00:00:00 2001 From: b1indy Date: Fri, 23 Nov 2007 21:21:07 +0000 Subject: this shouldn't have been here git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@650 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/other/DirWatch.dcu | Bin 9101 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 Game/Code/lib/other/DirWatch.dcu (limited to 'Game/Code') diff --git a/Game/Code/lib/other/DirWatch.dcu b/Game/Code/lib/other/DirWatch.dcu deleted file mode 100644 index e82e738b..00000000 Binary files a/Game/Code/lib/other/DirWatch.dcu and /dev/null differ -- cgit v1.2.3 From 80f3f5fe438a48b94a2ec9c70e6ff8475ede4ff3 Mon Sep 17 00:00:00 2001 From: b1indy Date: Fri, 23 Nov 2007 21:32:44 +0000 Subject: checking for delta=0 in col2h git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@652 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 7b537840..445c7d4f 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -427,6 +427,8 @@ procedure TTextureUnit.ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); clr[2]:=(Color and $ff)/255; hls[1]:=maxvalue(clr); delta:=hls[1]-minvalue(clr); + // this is for safety reasons + if delta = 0.0 then delta:=0.000000000001; if clr[0]=hls[1] then hls[0]:=(clr[1]-clr[2])/delta else if clr[1]=hls[1] then hls[0]:=2.0+(clr[2]-clr[0])/delta else if clr[2]=hls[1] then hls[0]:=4.0+(clr[0]-clr[1])/delta; -- cgit v1.2.3 From 64de8825666fcb234fb31b4c716cf1c9fbcaacfe Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 28 Nov 2007 16:35:34 +0000 Subject: fixed lazarus build-error due to differing declarations of FindFirstFileW and FindNextFileW (var vs pointer) in delphi and lazarus git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@655 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlatformWindows.pas | 54 +++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 21 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlatformWindows.pas b/Game/Code/Classes/UPlatformWindows.pas index afdcebcf..93e72e7a 100644 --- a/Game/Code/Classes/UPlatformWindows.pas +++ b/Game/Code/Classes/UPlatformWindows.pas @@ -11,7 +11,7 @@ interface uses Classes, UPlatform; type - + TPlatformWindows = class(TPlatform) public Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override; @@ -23,7 +23,7 @@ implementation uses SysUtils, Windows; type - + TSearchRecW = record Time: Integer; Size: Integer; @@ -45,7 +45,11 @@ const faSpecial = faHidden or faSysFile or faVolumeID or faDirectory; begin F.ExcludeAttr := not Attr and faSpecial; +{$IFDEF Delphi} F.FindHandle := FindFirstFileW(PWideChar(Path), F.FindData); +{$ELSE} + F.FindHandle := FindFirstFileW(PWideChar(Path), @F.FindData); +{$ENDIF} if F.FindHandle <> INVALID_HANDLE_VALUE then begin Result := FindMatchingFileW(F); @@ -56,7 +60,11 @@ end; function FindNextW(var F: TSearchRecW): Integer; begin +{$IFDEF Delphi} if FindNextFileW(F.FindHandle, F.FindData) then +{$ELSE} + if FindNextFileW(F.FindHandle, @F.FindData) then +{$ENDIF} Result := FindMatchingFileW(F) else Result := GetLastError; @@ -78,7 +86,11 @@ begin with F do begin while FindData.dwFileAttributes and ExcludeAttr <> 0 do +{$IFDEF Delphi} if not FindNextFileW(FindHandle, FindData) then +{$ELSE} + if not FindNextFileW(FindHandle, @FindData) then +{$ENDIF} begin Result := GetLastError; Exit; @@ -101,31 +113,31 @@ begin end; //------------------------------ -//Start more than One Time Prevention -//------------------------------ +//Start more than One Time Prevention +//------------------------------ function TPlatformWindows.TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; var hWnd: THandle; - I: Integer; + I: Integer; begin Result := false; hWnd:= FindWindow(nil, PChar(WndTitle)); - //Programm already started - if (hWnd <> 0) then - begin - I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Continue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); - if (I = IDYes) then - begin - I := 1; - repeat - Inc(I); - hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); - until (hWnd = 0); - WndTitle := WndTitle + ' Instance ' + InttoStr(I); - end - else - Result := true; - end; + //Programm already started + if (hWnd <> 0) then + begin + I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Continue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); + if (I = IDYes) then + begin + I := 1; + repeat + Inc(I); + hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); + until (hWnd = 0); + WndTitle := WndTitle + ' Instance ' + InttoStr(I); + end + else + Result := true; + end; end; Function TPlatformWindows.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; -- cgit v1.2.3 From 758a9f2a8ee94b7e3f20695ede89b6fb71bd7f5b Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 28 Nov 2007 17:28:13 +0000 Subject: added portaudio and portmixer headers as replacement for bass in linux git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@656 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/portaudio/delphi/portaudio.pas | 1155 ++++++++++++++++++++++++++ Game/Code/lib/portmixer/delphi/portmixer.pas | 148 ++++ 2 files changed, 1303 insertions(+) create mode 100644 Game/Code/lib/portaudio/delphi/portaudio.pas create mode 100644 Game/Code/lib/portmixer/delphi/portmixer.pas (limited to 'Game/Code') diff --git a/Game/Code/lib/portaudio/delphi/portaudio.pas b/Game/Code/lib/portaudio/delphi/portaudio.pas new file mode 100644 index 00000000..0e6a2b8c --- /dev/null +++ b/Game/Code/lib/portaudio/delphi/portaudio.pas @@ -0,0 +1,1155 @@ +{* + * $Id: portaudio.h,v 1.7 2007/08/16 20:45:34 richardash1981 Exp $ + * PortAudio Portable Real-Time Audio Library + * PortAudio API Header File + * Latest version available at: http://www.portaudio.com/ + * + * Copyright (c) 1999-2002 Ross Bencina and Phil Burk + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *} + +{* + * The text above constitutes the entire PortAudio license; however, + * the PortAudio community also makes the following non-binding requests: + * + * Any person wishing to distribute modifications to the Software is + * requested to send the modifications to the original developer so that + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the + * license above. + *} + +{** @file + @brief The PortAudio API. +*} + +unit portaudio; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +//uses; + +const +{$IFDEF WIN32} + LibName = 'portaudio_x86.dll'; +{$ENDIF} +{$IFDEF LINUX} + LibName = 'libportaudio.so'; +{$ENDIF} +{$IFDEF MACOS} + LibName = 'libportaudio.dylib'; +{$ENDIF} + +{** Retrieve the release number of the currently running PortAudio build, + eg 1900. +*} +function Pa_GetVersion(): Integer; cdecl ; external LibName; + + +{** Retrieve a textual description of the current PortAudio build, + eg "PortAudio V19-devel 13 October 2002". +*} +function Pa_GetVersionText(): PChar; cdecl ; external LibName; + + +{** Error codes returned by PortAudio functions. + Note that with the exception of paNoError, all PaErrorCodes are negative. +*} + +type TPaError = Integer; +type TPaErrorCode = {enum}Integer; const +{enum_begin PaErrorCode} + paNoError = 0; + + paNotInitialized = -10000; + paUnanticipatedHostError = (paNotInitialized+ 1); + paInvalidChannelCount = (paNotInitialized+ 2); + paInvalidSampleRate = (paNotInitialized+ 3); + paInvalidDevice = (paNotInitialized+ 4); + paInvalidFlag = (paNotInitialized+ 5); + paSampleFormatNotSupported = (paNotInitialized+ 6); + paBadIODeviceCombination = (paNotInitialized+ 7); + paInsufficientMemory = (paNotInitialized+ 8); + paBufferTooBig = (paNotInitialized+ 9); + paBufferTooSmall = (paNotInitialized+10); + paNullCallback = (paNotInitialized+11); + paBadStreamPtr = (paNotInitialized+12); + paTimedOut = (paNotInitialized+13); + paInternalError = (paNotInitialized+14); + paDeviceUnavailable = (paNotInitialized+15); + paIncompatibleHostApiSpecificStreamInfo = (paNotInitialized+16); + paStreamIsStopped = (paNotInitialized+17); + paStreamIsNotStopped = (paNotInitialized+18); + paInputOverflowed = (paNotInitialized+19); + paOutputUnderflowed = (paNotInitialized+20); + paHostApiNotFound = (paNotInitialized+21); + paInvalidHostApi = (paNotInitialized+22); + paCanNotReadFromACallbackStream = (paNotInitialized+23); {**< @todo review error code name *} + paCanNotWriteToACallbackStream = (paNotInitialized+24); {**< @todo review error code name *} + paCanNotReadFromAnOutputOnlyStream = (paNotInitialized+25); {**< @todo review error code name *} + paCanNotWriteToAnInputOnlyStream = (paNotInitialized+26); {**< @todo review error code name *} + paIncompatibleStreamHostApi = (paNotInitialized+27); + paBadBufferPtr = (paNotInitialized+28); +{enum_end PaErrorCode} + + +{** Translate the supplied PortAudio error code into a human readable + message. +*} +function Pa_GetErrorText( errorCode: TPaError ): PChar; cdecl ; external LibName; + + +{** Library initialization function - call this before using PortAudio. + This function initialises internal data structures and prepares underlying + host APIs for use. With the exception of Pa_GetVersion(), Pa_GetVersionText(), + and Pa_GetErrorText(), this function MUST be called before using any other + PortAudio API functions. + + If Pa_Initialize() is called multiple times, each successful + call must be matched with a corresponding call to Pa_Terminate(). + Pairs of calls to Pa_Initialize()/Pa_Terminate() may overlap, and are not + required to be fully nested. + + Note that if Pa_Initialize() returns an error code, Pa_Terminate() should + NOT be called. + + @return paNoError if successful, otherwise an error code indicating the cause + of failure. + + @see Pa_Terminate +*} +function Pa_Initialize(): TPaError; cdecl ; external LibName; + + +{** Library termination function - call this when finished using PortAudio. + This function deallocates all resources allocated by PortAudio since it was + initializied by a call to Pa_Initialize(). In cases where Pa_Initialise() has + been called multiple times, each call must be matched with a corresponding call + to Pa_Terminate(). The final matching call to Pa_Terminate() will automatically + close any PortAudio streams that are still open. + + Pa_Terminate() MUST be called before exiting a program which uses PortAudio. + Failure to do so may result in serious resource leaks, such as audio devices + not being available until the next reboot. + + @return paNoError if successful, otherwise an error code indicating the cause + of failure. + + @see Pa_Initialize +*} +function Pa_Terminate(): TPaError; cdecl ; external LibName; + + + +{** The type used to refer to audio devices. Values of this type usually + range from 0 to (Pa_GetDeviceCount()-1), and may also take on the PaNoDevice + and paUseHostApiSpecificDeviceSpecification values. + + @see Pa_GetDeviceCount, paNoDevice, paUseHostApiSpecificDeviceSpecification +*} +type TPaDeviceIndex = Integer; + + +{** A special PaDeviceIndex value indicating that no device is available, + or should be used. + + @see PaDeviceIndex +*} +const paNoDevice = TPaDeviceIndex(-1); + + +{** A special PaDeviceIndex value indicating that the device(s) to be used + are specified in the host api specific stream info structure. + + @see PaDeviceIndex +*} +const paUseHostApiSpecificDeviceSpecification = TPaDeviceIndex(-2); + + +{* Host API enumeration mechanism *} + +{** The type used to enumerate to host APIs at runtime. Values of this type + range from 0 to (Pa_GetHostApiCount()-1). + + @see Pa_GetHostApiCount +*} +type TPaHostApiIndex = Integer; + +{** Retrieve the number of available host APIs. Even if a host API is + available it may have no devices available. + + @return A non-negative value indicating the number of available host APIs + or, a PaErrorCode (which are always negative) if PortAudio is not initialized + or an error is encountered. + + @see PaHostApiIndex +*} +function Pa_GetHostApiCount(): TPaHostApiIndex; cdecl ; external LibName; + + +{** Retrieve the index of the default host API. The default host API will be + the lowest common denominator host API on the current platform and is + unlikely to provide the best performance. + + @return A non-negative value ranging from 0 to (Pa_GetHostApiCount()-1) + indicating the default host API index or, a PaErrorCode (which are always + negative) if PortAudio is not initialized or an error is encountered. +*} +function Pa_GetDefaultHostApi(): TPaHostApiIndex; cdecl ; external LibName; + + +{** Unchanging unique identifiers for each supported host API. This type + is used in the PaHostApiInfo structure. The values are guaranteed to be + unique and to never change, thus allowing code to be written that + conditionally uses host API specific extensions. + + New type ids will be allocated when support for a host API reaches + "public alpha" status, prior to that developers should use the + paInDevelopment type id. + + @see PaHostApiInfo +*} +type TPaHostApiTypeId = {enum}Integer; const +{enum_begin PaHostApiTypeId} + paInDevelopment=0; {* use while developing support for a new host API *} + paDirectSound=1; + paMME=2; + paASIO=3; + paSoundManager=4; + paCoreAudio=5; + paOSS=7; + paALSA=8; + paAL=9; + paBeOS=10; + paWDMKS=11; + paJACK=12; + paWASAPI=13; + paAudioScienceHPI=14; +{enum_end PaHostApiTypeId} + +{** A structure containing information about a particular host API. *} + +type + PPaHostApiInfo = ^TPaHostApiInfo; + TPaHostApiInfo = record + {** this is struct version 1 *} + structVersion: Integer; + {** The well known unique identifier of this host API @see PaHostApiTypeId *} + _type: TPaHostApiTypeId; + {** A textual description of the host API for display on user interfaces. *} + name: PChar; + + {** The number of devices belonging to this host API. This field may be + used in conjunction with Pa_HostApiDeviceIndexToDeviceIndex() to enumerate + all devices for this host API. + @see Pa_HostApiDeviceIndexToDeviceIndex + *} + deviceCount: Integer; + + {** The default input device for this host API. The value will be a + device index ranging from 0 to (Pa_GetDeviceCount()-1), or paNoDevice + if no default input device is available. + *} + defaultInputDevice: TPaDeviceIndex; + + {** The default output device for this host API. The value will be a + device index ranging from 0 to (Pa_GetDeviceCount()-1), or paNoDevice + if no default output device is available. + *} + defaultOutputDevice: TPaDeviceIndex; + end; + + +{** Retrieve a pointer to a structure containing information about a specific + host Api. + + @param hostApi A valid host API index ranging from 0 to (Pa_GetHostApiCount()-1) + + @return A pointer to an immutable PaHostApiInfo structure describing + a specific host API. If the hostApi parameter is out of range or an error + is encountered, the function returns NULL. + + The returned structure is owned by the PortAudio implementation and must not + be manipulated or freed. The pointer is only guaranteed to be valid between + calls to Pa_Initialize() and Pa_Terminate(). +*} +function Pa_GetHostApiInfo( hostApi: TPaHostApiIndex ): PPaHostApiInfo; cdecl ; external LibName; + + +{** Convert a static host API unique identifier, into a runtime + host API index. + + @param type A unique host API identifier belonging to the PaHostApiTypeId + enumeration. + + @return A valid PaHostApiIndex ranging from 0 to (Pa_GetHostApiCount()-1) or, + a PaErrorCode (which are always negative) if PortAudio is not initialized + or an error is encountered. + + The paHostApiNotFound error code indicates that the host API specified by the + type parameter is not available. + + @see PaHostApiTypeId +*} +function Pa_HostApiTypeIdToHostApiIndex( _type: TPaHostApiTypeId ): TPaHostApiIndex; cdecl ; external LibName; + + +{** Convert a host-API-specific device index to standard PortAudio device index. + This function may be used in conjunction with the deviceCount field of + PaHostApiInfo to enumerate all devices for the specified host API. + + @param hostApi A valid host API index ranging from 0 to (Pa_GetHostApiCount()-1) + + @param hostApiDeviceIndex A valid per-host device index in the range + 0 to (Pa_GetHostApiInfo(hostApi)->deviceCount-1) + + @return A non-negative PaDeviceIndex ranging from 0 to (Pa_GetDeviceCount()-1) + or, a PaErrorCode (which are always negative) if PortAudio is not initialized + or an error is encountered. + + A paInvalidHostApi error code indicates that the host API index specified by + the hostApi parameter is out of range. + + A paInvalidDevice error code indicates that the hostApiDeviceIndex parameter + is out of range. + + @see PaHostApiInfo +*} +function Pa_HostApiDeviceIndexToDeviceIndex( hostApi: TPaHostApiIndex; + hostApiDeviceIndex: Integer ): TPaDeviceIndex; cdecl ; external LibName; + + + +{** Structure used to return information about a host error condition. +*} +type + PPaHostErrorInfo = ^TPaHostErrorInfo; + TPaHostErrorInfo = record + hostApiType: TPaHostApiTypeId; {**< the host API which returned the error code *} + errorCode: Longint; {**< the error code returned *} + errorText: PChar; {**< a textual description of the error if available, otherwise a zero-length string *} + end; + + +{** Return information about the last host error encountered. The error + information returned by Pa_GetLastHostErrorInfo() will never be modified + asyncronously by errors occurring in other PortAudio owned threads + (such as the thread that manages the stream callback.) + + This function is provided as a last resort, primarily to enhance debugging + by providing clients with access to all available error information. + + @return A pointer to an immutable structure constaining information about + the host error. The values in this structure will only be valid if a + PortAudio function has previously returned the paUnanticipatedHostError + error code. +*} +function Pa_GetLastHostErrorInfo(): PPaHostErrorInfo; cdecl ; external LibName; + + + +{* Device enumeration and capabilities *} + +{** Retrieve the number of available devices. The number of available devices + may be zero. + + @return A non-negative value indicating the number of available devices or, + a PaErrorCode (which are always negative) if PortAudio is not initialized + or an error is encountered. +*} +function Pa_GetDeviceCount(): TPaDeviceIndex; cdecl ; external LibName; + + +{** Retrieve the index of the default input device. The result can be + used in the inputDevice parameter to Pa_OpenStream(). + + @return The default input device index for the default host API, or paNoDevice + if no default input device is available or an error was encountered. +*} +function Pa_GetDefaultInputDevice(): TPaDeviceIndex; cdecl ; external LibName; + + +{** Retrieve the index of the default output device. The result can be + used in the outputDevice parameter to Pa_OpenStream(). + + @return The default output device index for the defualt host API, or paNoDevice + if no default output device is available or an error was encountered. + + @note + On the PC, the user can specify a default device by + setting an environment variable. For example, to use device #1. +
+ set PA_RECOMMENDED_OUTPUT_DEVICE=1
+
+ The user should first determine the available device ids by using + the supplied application "pa_devs". +*} +function Pa_GetDefaultOutputDevice(): TPaDeviceIndex; cdecl ; external LibName; + + +{** The type used to represent monotonic time in seconds that can be used + for syncronisation. The type is used for the outTime argument to the + PaStreamCallback and as the result of Pa_GetStreamTime(). + + @see PaStreamCallback, Pa_GetStreamTime +*} +type TPaTime = Double; + + +{** A type used to specify one or more sample formats. Each value indicates + a possible format for sound data passed to and from the stream callback, + Pa_ReadStream and Pa_WriteStream. + + The standard formats paFloat32, paInt16, paInt32, paInt24, paInt8 + and aUInt8 are usually implemented by all implementations. + + The floating point representation (paFloat32) uses +1.0 and -1.0 as the + maximum and minimum respectively. + + paUInt8 is an unsigned 8 bit format where 128 is considered "ground" + + The paNonInterleaved flag indicates that a multichannel buffer is passed + as a set of non-interleaved pointers. + + @see Pa_OpenStream, Pa_OpenDefaultStream, PaDeviceInfo + @see paFloat32, paInt16, paInt32, paInt24, paInt8 + @see paUInt8, paCustomFormat, paNonInterleaved +*} +type TPaSampleFormat = Longword; +const + paFloat32 = TPaSampleFormat($00000001); {**< @see PaSampleFormat *} + paInt32 = TPaSampleFormat($00000002); {**< @see PaSampleFormat *} + paInt24 = TPaSampleFormat($00000004); {**< Packed 24 bit format. @see PaSampleFormat *} + paInt16 = TPaSampleFormat($00000008); {**< @see PaSampleFormat *} + paInt8 = TPaSampleFormat($00000010); {**< @see PaSampleFormat *} + paUInt8 = TPaSampleFormat($00000020); {**< @see PaSampleFormat *} + paCustomFormat = TPaSampleFormat($00010000); {**< @see PaSampleFormat *} + paNonInterleaved = TPaSampleFormat($80000000); + +{** A structure providing information and capabilities of PortAudio devices. + Devices may support input, output or both input and output. +*} +type + PPaDeviceInfo = ^TPaDeviceInfo; + TPaDeviceInfo = record + structVersion: Integer; {* this is struct version 2 *} + name: PChar; + hostApi: TPaHostApiIndex; {* note this is a host API index, not a type id*} + + maxInputChannels: Integer; + maxOutputChannels: Integer; + + {* Default latency values for interactive performance. *} + defaultLowInputLatency: TPaTime; + defaultLowOutputLatency: TPaTime; + {* Default latency values for robust non-interactive applications (eg. playing sound files). *} + defaultHighInputLatency: TPaTime; + defaultHighOutputLatency: TPaTime; + + defaultSampleRate: Double; + end; + + +{** Retrieve a pointer to a PaDeviceInfo structure containing information + about the specified device. + @return A pointer to an immutable PaDeviceInfo structure. If the device + parameter is out of range the function returns NULL. + + @param device A valid device index in the range 0 to (Pa_GetDeviceCount()-1) + + @note PortAudio manages the memory referenced by the returned pointer, + the client must not manipulate or free the memory. The pointer is only + guaranteed to be valid between calls to Pa_Initialize() and Pa_Terminate(). + + @see PaDeviceInfo, PaDeviceIndex +*} +function Pa_GetDeviceInfo( device: TPaDeviceIndex ): PPaDeviceInfo; cdecl ; external LibName; + + +{** Parameters for one direction (input or output) of a stream. +*} +type + PPaStreamParameters = ^TPaStreamParameters; + TPaStreamParameters = record + {** A valid device index in the range 0 to (Pa_GetDeviceCount()-1) + specifying the device to be used or the special constant + paUseHostApiSpecificDeviceSpecification which indicates that the actual + device(s) to use are specified in hostApiSpecificStreamInfo. + This field must not be set to paNoDevice. + *} + device: TPaDeviceIndex; + + {** The number of channels of sound to be delivered to the + stream callback or accessed by Pa_ReadStream() or Pa_WriteStream(). + It can range from 1 to the value of maxInputChannels in the + PaDeviceInfo record for the device specified by the device parameter. + *} + channelCount: Integer; + + {** The sample format of the buffer provided to the stream callback, + a_ReadStream() or Pa_WriteStream(). It may be any of the formats described + by the PaSampleFormat enumeration. + *} + sampleFormat: TPaSampleFormat; + + {** The desired latency in seconds. Where practical, implementations should + configure their latency based on these parameters, otherwise they may + choose the closest viable latency instead. Unless the suggested latency + is greater than the absolute upper limit for the device implementations + should round the suggestedLatency up to the next practial value - ie to + provide an equal or higher latency than suggestedLatency wherever possibe. + Actual latency values for an open stream may be retrieved using the + inputLatency and outputLatency fields of the PaStreamInfo structure + returned by Pa_GetStreamInfo(). + @see default*Latency in PaDeviceInfo, *Latency in PaStreamInfo + *} + suggestedLatency: TPaTime; + + {** An optional pointer to a host api specific data structure + containing additional information for device setup and/or stream processing. + hostApiSpecificStreamInfo is never required for correct operation, + if not used it should be set to NULL. + *} + hostApiSpecificStreamInfo: Pointer; + end; + + +{** Return code for Pa_IsFormatSupported indicating success. *} +const paFormatIsSupported = (0); + +{** Determine whether it would be possible to open a stream with the specified + parameters. + + @param inputParameters A structure that describes the input parameters used to + open a stream. The suggestedLatency field is ignored. See PaStreamParameters + for a description of these parameters. inputParameters must be NULL for + output-only streams. + + @param outputParameters A structure that describes the output parameters used + to open a stream. The suggestedLatency field is ignored. See PaStreamParameters + for a description of these parameters. outputParameters must be NULL for + input-only streams. + + @param sampleRate The required sampleRate. For full-duplex streams it is the + sample rate for both input and output + + @return Returns 0 if the format is supported, and an error code indicating why + the format is not supported otherwise. The constant paFormatIsSupported is + provided to compare with the return value for success. + + @see paFormatIsSupported, PaStreamParameters +*} +function Pa_IsFormatSupported( inputParameters: PPaStreamParameters; + outputParameters: PPaStreamParameters; + sampleRate: Double ): TPaError; cdecl ; external LibName; + + + +{* Streaming types and functions *} + + +{** + A single PaStream can provide multiple channels of real-time + streaming audio input and output to a client application. A stream + provides access to audio hardware represented by one or more + PaDevices. Depending on the underlying Host API, it may be possible + to open multiple streams using the same device, however this behavior + is implementation defined. Portable applications should assume that + a PaDevice may be simultaneously used by at most one PaStream. + + Pointers to PaStream objects are passed between PortAudio functions that + operate on streams. + + @see Pa_OpenStream, Pa_OpenDefaultStream, Pa_OpenDefaultStream, Pa_CloseStream, + Pa_StartStream, Pa_StopStream, Pa_AbortStream, Pa_IsStreamActive, + Pa_GetStreamTime, Pa_GetStreamCpuLoad + +*} +type + PPaStream = Pointer; + +{** Can be passed as the framesPerBuffer parameter to Pa_OpenStream() + or Pa_OpenDefaultStream() to indicate that the stream callback will + accept buffers of any size. +*} +const paFramesPerBufferUnspecified = (0); + + +{** Flags used to control the behavior of a stream. They are passed as + parameters to Pa_OpenStream or Pa_OpenDefaultStream. Multiple flags may be + ORed together. + + @see Pa_OpenStream, Pa_OpenDefaultStream + @see paNoFlag, paClipOff, paDitherOff, paNeverDropInput, + paPrimeOutputBuffersUsingStreamCallback, paPlatformSpecificFlags +*} +type TPaStreamFlags = Longword; + +{** @see PaStreamFlags *} +const paNoFlag = TPaStreamFlags(0); + +{** Disable default clipping of out of range samples. + @see PaStreamFlags +*} +const paClipOff = TPaStreamFlags($00000001); + +{** Disable default dithering. + @see PaStreamFlags +*} +const paDitherOff = TPaStreamFlags($00000002); + +{** Flag requests that where possible a full duplex stream will not discard + overflowed input samples without calling the stream callback. This flag is + only valid for full duplex callback streams and only when used in combination + with the paFramesPerBufferUnspecified (0) framesPerBuffer parameter. Using + this flag incorrectly results in a paInvalidFlag error being returned from + Pa_OpenStream and Pa_OpenDefaultStream. + + @see PaStreamFlags, paFramesPerBufferUnspecified +*} +const paNeverDropInput = TPaStreamFlags($00000004); + +{** Call the stream callback to fill initial output buffers, rather than the + default behavior of priming the buffers with zeros (silence). This flag has + no effect for input-only and blocking read/write streams. + + @see PaStreamFlags +*} +const paPrimeOutputBuffersUsingStreamCallback = TPaStreamFlags($00000008); + +{** A mask specifying the platform specific bits. + @see PaStreamFlags +*} +const paPlatformSpecificFlags = TPaStreamFlags($FFFF0000); + +{** + Timing information for the buffers passed to the stream callback. +*} +type + PPaStreamCallbackTimeInfo = ^PaStreamCallbackTimeInfo; + PaStreamCallbackTimeInfo = record + inputBufferAdcTime: TPaTime; + currentTime: TPaTime; + outputBufferDacTime: TPaTime; + end; + + +{** + Flag bit constants for the statusFlags to PaStreamCallback. + + @see paInputUnderflow, paInputOverflow, paOutputUnderflow, paOutputOverflow, + paPrimingOutput +*} +type TPaStreamCallbackFlags = Longword; + +{** In a stream opened with paFramesPerBufferUnspecified, indicates that + input data is all silence (zeros) because no real data is available. In a + stream opened without paFramesPerBufferUnspecified, it indicates that one or + more zero samples have been inserted into the input buffer to compensate + for an input underflow. + @see PaStreamCallbackFlags +*} +const paInputUnderflow = TPaStreamCallbackFlags($00000001); + +{** In a stream opened with paFramesPerBufferUnspecified, indicates that data + prior to the first sample of the input buffer was discarded due to an + overflow, possibly because the stream callback is using too much CPU time. + Otherwise indicates that data prior to one or more samples in the + input buffer was discarded. + @see PaStreamCallbackFlags +*} +const paInputOverflow = TPaStreamCallbackFlags($00000002); + +{** Indicates that output data (or a gap) was inserted, possibly because the + stream callback is using too much CPU time. + @see PaStreamCallbackFlags +*} +const paOutputUnderflow = TPaStreamCallbackFlags($00000004); + +{** Indicates that output data will be discarded because no room is available. + @see PaStreamCallbackFlags +*} +const paOutputOverflow = TPaStreamCallbackFlags($00000008); + +{** Some of all of the output data will be used to prime the stream, input + data may be zero. + @see PaStreamCallbackFlags +*} +const paPrimingOutput = TPaStreamCallbackFlags($00000010); + +{** + Allowable return values for the PaStreamCallback. + @see PaStreamCallback +*} +type TPaStreamCallbackResult = {enum}Integer; const +{enum_begin PaStreamCallbackResult} + paContinue=0; + paComplete=1; + paAbort=2; +{enum_end PaStreamCallbackResult} + +{** + Functions of type PaStreamCallback are implemented by PortAudio clients. + They consume, process or generate audio in response to requests from an + active PortAudio stream. + + @param input and @param output are arrays of interleaved samples, + the format, packing and number of channels used by the buffers are + determined by parameters to Pa_OpenStream(). + + @param frameCount The number of sample frames to be processed by + the stream callback. + + @param timeInfo The time in seconds when the first sample of the input + buffer was received at the audio input, the time in seconds when the first + sample of the output buffer will begin being played at the audio output, and + the time in seconds when the stream callback was called. + See also Pa_GetStreamTime() + + @param statusFlags Flags indicating whether input and/or output buffers + have been inserted or will be dropped to overcome underflow or overflow + conditions. + + @param userData The value of a user supplied pointer passed to + Pa_OpenStream() intended for storing synthesis data etc. + + @return + The stream callback should return one of the values in the + PaStreamCallbackResult enumeration. To ensure that the callback continues + to be called, it should return paContinue (0). Either paComplete or paAbort + can be returned to finish stream processing, after either of these values is + returned the callback will not be called again. If paAbort is returned the + stream will finish as soon as possible. If paComplete is returned, the stream + will continue until all buffers generated by the callback have been played. + This may be useful in applications such as soundfile players where a specific + duration of output is required. However, it is not necessary to utilise this + mechanism as Pa_StopStream(), Pa_AbortStream() or Pa_CloseStream() can also + be used to stop the stream. The callback must always fill the entire output + buffer irrespective of its return value. + + @see Pa_OpenStream, Pa_OpenDefaultStream + + @note With the exception of Pa_GetStreamCpuLoad() it is not permissable to call + PortAudio API functions from within the stream callback. +*} +type + PPaStreamCallback = ^TPaStreamCallback; + TPaStreamCallback = function( + input: Pointer; output: Pointer; + frameCount: Longword; + timeInfo: PPaStreamCallbackTimeInfo; + statusFlags: TPaStreamCallbackFlags; + userData: Pointer ): Integer; cdecl; + + +{** Opens a stream for either input, output or both. + + @param stream The address of a PaStream pointer which will receive + a pointer to the newly opened stream. + + @param inputParameters A structure that describes the input parameters used by + the opened stream. See PaStreamParameters for a description of these parameters. + inputParameters must be NULL for output-only streams. + + @param outputParameters A structure that describes the output parameters used by + the opened stream. See PaStreamParameters for a description of these parameters. + outputParameters must be NULL for input-only streams. + + @param sampleRate The desired sampleRate. For full-duplex streams it is the + sample rate for both input and output + + @param framesPerBuffer The number of frames passed to the stream callback + function, or the preferred block granularity for a blocking read/write stream. + The special value paFramesPerBufferUnspecified (0) may be used to request that + the stream callback will recieve an optimal (and possibly varying) number of + frames based on host requirements and the requested latency settings. + Note: With some host APIs, the use of non-zero framesPerBuffer for a callback + stream may introduce an additional layer of buffering which could introduce + additional latency. PortAudio guarantees that the additional latency + will be kept to the theoretical minimum however, it is strongly recommended + that a non-zero framesPerBuffer value only be used when your algorithm + requires a fixed number of frames per stream callback. + + @param streamFlags Flags which modify the behaviour of the streaming process. + This parameter may contain a combination of flags ORed together. Some flags may + only be relevant to certain buffer formats. + + @param streamCallback A pointer to a client supplied function that is responsible + for processing and filling input and output buffers. If this parameter is NULL + the stream will be opened in 'blocking read/write' mode. In blocking mode, + the client can receive sample data using Pa_ReadStream and write sample data + using Pa_WriteStream, the number of samples that may be read or written + without blocking is returned by Pa_GetStreamReadAvailable and + Pa_GetStreamWriteAvailable respectively. + + @param userData A client supplied pointer which is passed to the stream callback + function. It could for example, contain a pointer to instance data necessary + for processing the audio buffers. This parameter is ignored if streamCallback + is NULL. + + @return + Upon success Pa_OpenStream() returns paNoError and places a pointer to a + valid PaStream in the stream argument. The stream is inactive (stopped). + If a call to Pa_OpenStream() fails, a non-zero error code is returned (see + PaError for possible error codes) and the value of stream is invalid. + + @see PaStreamParameters, PaStreamCallback, Pa_ReadStream, Pa_WriteStream, + Pa_GetStreamReadAvailable, Pa_GetStreamWriteAvailable +*} +function Pa_OpenStream( var stream: PPaStream; + inputParameters: PPaStreamParameters; + outputParameters: PPaStreamParameters; + sampleRate: Double; + framesPerBuffer: Longword; + streamFlags: TPaStreamFlags; + streamCallback: PPaStreamCallback; + userData: Pointer ): TPaError; cdecl ; external LibName; + + +{** A simplified version of Pa_OpenStream() that opens the default input + and/or output devices. + + @param stream The address of a PaStream pointer which will receive + a pointer to the newly opened stream. + + @param numInputChannels The number of channels of sound that will be supplied + to the stream callback or returned by Pa_ReadStream. It can range from 1 to + the value of maxInputChannels in the PaDeviceInfo record for the default input + device. If 0 the stream is opened as an output-only stream. + + @param numOutputChannels The number of channels of sound to be delivered to the + stream callback or passed to Pa_WriteStream. It can range from 1 to the value + of maxOutputChannels in the PaDeviceInfo record for the default output dvice. + If 0 the stream is opened as an output-only stream. + + @param sampleFormat The sample format of both the input and output buffers + provided to the callback or passed to and from Pa_ReadStream and Pa_WriteStream. + sampleFormat may be any of the formats described by the PaSampleFormat + enumeration. + + @param sampleRate Same as Pa_OpenStream parameter of the same name. + @param framesPerBuffer Same as Pa_OpenStream parameter of the same name. + @param streamCallback Same as Pa_OpenStream parameter of the same name. + @param userData Same as Pa_OpenStream parameter of the same name. + + @return As for Pa_OpenStream + + @see Pa_OpenStream, PaStreamCallback +*} +function Pa_OpenDefaultStream( var stream: PPaStream; + numInputChannels: Integer; + numOutputChannels: Integer; + sampleFormat: TPaSampleFormat; + sampleRate: Double; + framesPerBuffer: Longword; + streamCallback: PPaStreamCallback; + userData: Pointer ): TPaError; cdecl ; external LibName; + + +{** Closes an audio stream. If the audio stream is active it + discards any pending buffers as if Pa_AbortStream() had been called. +*} +function Pa_CloseStream( stream: PPaStream ): TPaError; cdecl ; external LibName; + + +{** Functions of type PaStreamFinishedCallback are implemented by PortAudio + clients. They can be registered with a stream using the Pa_SetStreamFinishedCallback + function. Once registered they are called when the stream becomes inactive + (ie once a call to Pa_StopStream() will not block). + A stream will become inactive after the stream callback returns non-zero, + or when Pa_StopStream or Pa_AbortStream is called. For a stream providing audio + output, if the stream callback returns paComplete, or Pa_StopStream is called, + the stream finished callback will not be called until all generated sample data + has been played. + + @param userData The userData parameter supplied to Pa_OpenStream() + + @see Pa_SetStreamFinishedCallback +*} +type + PPaStreamFinishedCallback = ^TPaStreamFinishedCallback; + TPaStreamFinishedCallback = procedure( userData: Pointer ); cdecl; + + +{** Register a stream finished callback function which will be called when the + stream becomes inactive. See the description of PaStreamFinishedCallback for + further details about when the callback will be called. + + @param stream a pointer to a PaStream that is in the stopped state - if the + stream is not stopped, the stream's finished callback will remain unchanged + and an error code will be returned. + + @param streamFinishedCallback a pointer to a function with the same signature + as PaStreamFinishedCallback, that will be called when the stream becomes + inactive. Passing NULL for this parameter will un-register a previously + registered stream finished callback function. + + @return on success returns paNoError, otherwise an error code indicating the cause + of the error. + + @see PaStreamFinishedCallback +*} +function Pa_SetStreamFinishedCallback( stream: PPaStream; + streamFinishedCallback: PPaStreamFinishedCallback ): TPaError; cdecl ; external LibName; + + +{** Commences audio processing. +*} +function Pa_StartStream( stream: PPaStream ): TPaError; cdecl ; external LibName; + + +{** Terminates audio processing. It waits until all pending + audio buffers have been played before it returns. +*} +function Pa_StopStream( stream: PPaStream ): TPaError; cdecl ; external LibName; + + +{** Terminates audio processing immediately without waiting for pending + buffers to complete. +*} +function Pa_AbortStream( stream: PPaStream ): TPaError; cdecl ; external LibName; + + +{** Determine whether the stream is stopped. + A stream is considered to be stopped prior to a successful call to + Pa_StartStream and after a successful call to Pa_StopStream or Pa_AbortStream. + If a stream callback returns a value other than paContinue the stream is NOT + considered to be stopped. + + @return Returns one (1) when the stream is stopped, zero (0) when + the stream is running or, a PaErrorCode (which are always negative) if + PortAudio is not initialized or an error is encountered. + + @see Pa_StopStream, Pa_AbortStream, Pa_IsStreamActive +*} +function Pa_IsStreamStopped( stream: PPaStream ): TPaError; cdecl ; external LibName; + + +{** Determine whether the stream is active. + A stream is active after a successful call to Pa_StartStream(), until it + becomes inactive either as a result of a call to Pa_StopStream() or + Pa_AbortStream(), or as a result of a return value other than paContinue from + the stream callback. In the latter case, the stream is considered inactive + after the last buffer has finished playing. + + @return Returns one (1) when the stream is active (ie playing or recording + audio), zero (0) when not playing or, a PaErrorCode (which are always negative) + if PortAudio is not initialized or an error is encountered. + + @see Pa_StopStream, Pa_AbortStream, Pa_IsStreamStopped +*} +function Pa_IsStreamActive( stream: PPaStream ): TPaError; cdecl ; external LibName; + + + +{** A structure containing unchanging information about an open stream. + @see Pa_GetStreamInfo +*} +type + PPaStreamInfo = ^PaStreamInfo; + PaStreamInfo = record + {** this is struct version 1 *} + structVersion: Integer; + + {** The input latency of the stream in seconds. This value provides the most + accurate estimate of input latency available to the implementation. It may + differ significantly from the suggestedLatency value passed to Pa_OpenStream(). + The value of this field will be zero (0.) for output-only streams. + @see PaTime + *} + inputLatency: TPaTime; + + {** The output latency of the stream in seconds. This value provides the most + accurate estimate of output latency available to the implementation. It may + differ significantly from the suggestedLatency value passed to Pa_OpenStream(). + The value of this field will be zero (0.) for input-only streams. + @see PaTime + *} + outputLatency: TPaTime; + + {** The sample rate of the stream in Hertz (samples per second). In cases + where the hardware sample rate is inaccurate and PortAudio is aware of it, + the value of this field may be different from the sampleRate parameter + passed to Pa_OpenStream(). If information about the actual hardware sample + rate is not available, this field will have the same value as the sampleRate + parameter passed to Pa_OpenStream(). + *} + sampleRate: Double; + end; + + +{** Retrieve a pointer to a PaStreamInfo structure containing information + about the specified stream. + @return A pointer to an immutable PaStreamInfo structure. If the stream + parameter invalid, or an error is encountered, the function returns NULL. + + @param stream A pointer to an open stream previously created with Pa_OpenStream. + + @note PortAudio manages the memory referenced by the returned pointer, + the client must not manipulate or free the memory. The pointer is only + guaranteed to be valid until the specified stream is closed. + + @see PaStreamInfo +*} +function Pa_GetStreamInfo( stream: PPaStream ): PPaStreamInfo; cdecl ; external LibName; + + +{** Determine the current time for the stream according to the same clock used + to generate buffer timestamps. This time may be used for syncronising other + events to the audio stream, for example synchronizing audio to MIDI. + + @return The stream's current time in seconds, or 0 if an error occurred. + + @see PaTime, PaStreamCallback +*} +function Pa_GetStreamTime( stream: PPaStream ): TPaTime; cdecl ; external LibName; + + +{** Retrieve CPU usage information for the specified stream. + The "CPU Load" is a fraction of total CPU time consumed by a callback stream's + audio processing routines including, but not limited to the client supplied + stream callback. This function does not work with blocking read/write streams. + + This function may be called from the stream callback function or the + application. + + @return + A floating point value, typically between 0.0 and 1.0, where 1.0 indicates + that the stream callback is consuming the maximum number of CPU cycles possible + to maintain real-time operation. A value of 0.5 would imply that PortAudio and + the stream callback was consuming roughly 50% of the available CPU time. The + return value may exceed 1.0. A value of 0.0 will always be returned for a + blocking read/write stream, or if an error occurrs. +*} +function Pa_GetStreamCpuLoad( stream: PPaStream ): Double; cdecl ; external LibName; + + +{** Read samples from an input stream. The function doesn't return until + the entire buffer has been filled - this may involve waiting for the operating + system to supply the data. + + @param stream A pointer to an open stream previously created with Pa_OpenStream. + + @param buffer A pointer to a buffer of sample frames. The buffer contains + samples in the format specified by the inputParameters->sampleFormat field + used to open the stream, and the number of channels specified by + inputParameters->numChannels. If non-interleaved samples were requested, + buffer is a pointer to the first element of an array of non-interleaved + buffer pointers, one for each channel. + + @param frames The number of frames to be read into buffer. This parameter + is not constrained to a specific range, however high performance applications + will want to match this parameter to the framesPerBuffer parameter used + when opening the stream. + + @return On success PaNoError will be returned, or PaInputOverflowed if input + data was discarded by PortAudio after the previous call and before this call. +*} +function Pa_ReadStream( stream: PPaStream; + buffer: Pointer; + frames: Longword ): TPaError; cdecl ; external LibName; + + +{** Write samples to an output stream. This function doesn't return until the + entire buffer has been consumed - this may involve waiting for the operating + system to consume the data. + + @param stream A pointer to an open stream previously created with Pa_OpenStream. + + @param buffer A pointer to a buffer of sample frames. The buffer contains + samples in the format specified by the outputParameters->sampleFormat field + used to open the stream, and the number of channels specified by + outputParameters->numChannels. If non-interleaved samples were requested, + buffer is a pointer to the first element of an array of non-interleaved + buffer pointers, one for each channel. + + @param frames The number of frames to be written from buffer. This parameter + is not constrained to a specific range, however high performance applications + will want to match this parameter to the framesPerBuffer parameter used + when opening the stream. + + @return On success PaNoError will be returned, or paOutputUnderflowed if + additional output data was inserted after the previous call and before this + call. +*} +function Pa_WriteStream( stream: PPaStream; + buffer: Pointer; + frames: Longword ): TPaError; cdecl ; external LibName; + + +{** Retrieve the number of frames that can be read from the stream without + waiting. + + @return Returns a non-negative value representing the maximum number of frames + that can be read from the stream without blocking or busy waiting or, a + PaErrorCode (which are always negative) if PortAudio is not initialized or an + error is encountered. +*} +function Pa_GetStreamReadAvailable( stream: PPaStream ): Longint; cdecl ; external LibName; + + +{** Retrieve the number of frames that can be written to the stream without + waiting. + + @return Returns a non-negative value representing the maximum number of frames + that can be written to the stream without blocking or busy waiting or, a + PaErrorCode (which are always negative) if PortAudio is not initialized or an + error is encountered. +*} +function Pa_GetStreamWriteAvailable( stream: PPaStream ): Longint; cdecl ; external LibName; + + +{** Retrieve the host type handling an open stream. + + @return Returns a non-negative value representing the host API type + handling an open stream or, a PaErrorCode (which are always negative) + if PortAudio is not initialized or an error is encountered. +*} +function Pa_GetStreamHostApiType( stream: PPaStream ): TPaHostApiTypeId; cdecl ; external LibName; + + +{* Miscellaneous utilities *} + + +{** Retrieve the size of a given sample format in bytes. + + @return The size in bytes of a single sample in the specified format, + or paSampleFormatNotSupported if the format is not supported. +*} +function Pa_GetSampleSize( format: TPaSampleFormat ): TPaError; cdecl ; external LibName; + + +{** Put the caller to sleep for at least 'msec' milliseconds. This function is + provided only as a convenience for authors of portable code (such as the tests + and examples in the PortAudio distribution.) + + The function may sleep longer than requested so don't rely on this for accurate + musical timing. +*} +procedure Pa_Sleep( msec: Longint ); cdecl ; external LibName; + +implementation + +end. diff --git a/Game/Code/lib/portmixer/delphi/portmixer.pas b/Game/Code/lib/portmixer/delphi/portmixer.pas new file mode 100644 index 00000000..f5854bb2 --- /dev/null +++ b/Game/Code/lib/portmixer/delphi/portmixer.pas @@ -0,0 +1,148 @@ +{* + * PortMixer + * PortMixer API Header File + * + * Copyright (c) 2002, 2006 + * + * Written by Dominic Mazzoni + * and Leland Lucius + * + * PortMixer is intended to work side-by-side with PortAudio, + * the Portable Real-Time Audio Library by Ross Bencina and + * Phil Burk. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * Any person wishing to distribute modifications to the Software is + * requested to send the modifications to the original developer so that + * they can be incorporated into the canonical version. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *} +unit portmixer; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses + portaudio; + +const +{$IFDEF WIN32} + LibName = 'portmixer.dll'; +{$ENDIF} +{$IFDEF LINUX} + LibName = 'libportmixer.so'; +{$ENDIF} +{$IFDEF MACOS} + LibName = 'libportmixer.dylib'; +{$ENDIF} + +type + PPxMixer = Pointer; + TPxVolume = Single; {* 0.0 (min) --> 1.0 (max) *} + TPxBalance = Single; {* -1.0 (left) --> 1.0 (right) *} + +{* + Px_OpenMixer() returns a mixer which will work with the given PortAudio + audio device. Pass 0 as the index for the first (default) mixer. +*} + +function Px_OpenMixer( pa_stream: Pointer; i: Integer ): PPxMixer; cdecl ; external LibName; + +{* + Px_CloseMixer() closes a mixer opened using Px_OpenMixer and frees any + memory associated with it. +*} + +procedure Px_CloseMixer( mixer: PPxMixer ); cdecl ; external LibName; + +{* + Px_GetNumMixers returns the number of mixers which could be + used with the given PortAudio device. On most systems, there + will be only one mixer for each device; however there may be + multiple mixers for each device, or possibly multiple mixers + which are independent of any particular PortAudio device. +*} + +function Px_GetNumMixers( mixer: PPxMixer ): Integer; cdecl ; external LibName; +function Px_GetMixerName( mixer: PPxMixer; i: Integer ): PChar; cdecl ; external LibName; + +{* + Master (output) volume +*} + +function Px_GetMasterVolume( mixer: PPxMixer ): TPxVolume; cdecl ; external LibName; +procedure Px_SetMasterVolume( mixer: PPxMixer; volume: TPxVolume ); cdecl ; external LibName; + +{* + Main output volume +*} + +function Px_GetPCMOutputVolume( mixer: PPxMixer ): TPxVolume; cdecl ; external LibName; +procedure Px_SetPCMOutputVolume( mixer: PPxMixer; volume: TPxVolume ); cdecl ; external LibName; +function Px_SupportsPCMOutputVolume( mixer: PPxMixer ): Integer; cdecl ; external LibName; + +{* + All output volumes +*} + +function Px_GetNumOutputVolumes( mixer: PPxMixer ): Integer; cdecl ; external LibName; +function Px_GetOutputVolumeName( mixer: PPxMixer; i: Integer ): PChar; cdecl ; external LibName; +function Px_GetOutputVolume( mixer: PPxMixer; i: Integer ): TPxVolume; cdecl ; external LibName; +procedure Px_SetOutputVolume( mixer: PPxMixer; i: Integer; volume: TPxVolume ); cdecl ; external LibName; + +{* + Input source +*} + +function Px_GetNumInputSources( mixer: PPxMixer ): Integer; cdecl ; external LibName; +function Px_GetInputSourceName( mixer: PPxMixer; i: Integer): PChar; cdecl ; external LibName; +function Px_GetCurrentInputSource( mixer: PPxMixer ): Integer; cdecl ; external LibName; {* may return -1 == none *} +procedure Px_SetCurrentInputSource( mixer: PPxMixer; i: Integer ); cdecl ; external LibName; + +{* + Input volume +*} + +function Px_GetInputVolume( mixer: PPxMixer ): TPxVolume; cdecl ; external LibName; +procedure Px_SetInputVolume( mixer: PPxMixer; volume: TPxVolume ); cdecl ; external LibName; + +{* + Balance +*} + +function Px_SupportsOutputBalance( mixer: PPxMixer ): Integer; cdecl ; external LibName; +function Px_GetOutputBalance( mixer: PPxMixer ): TPxBalance; cdecl ; external LibName; +procedure Px_SetOutputBalance( mixer: PPxMixer; balance: TPxBalance ); cdecl ; external LibName; + +{* + Playthrough +*} + +function Px_SupportsPlaythrough( mixer: PPxMixer ): Integer; cdecl ; external LibName; +function Px_GetPlaythrough( mixer: PPxMixer ): TPxVolume; cdecl ; external LibName; +procedure Px_SetPlaythrough( mixer: PPxMixer; volume: TPxVolume ); cdecl ; external LibName; + +implementation + +end. -- cgit v1.2.3 From 0785f09a42a52f77b1c6d4683edd18385006e1eb Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 3 Dec 2007 00:57:22 +0000 Subject: Added Makefile and lazres script from hennymcc ( on IRC ) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@657 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Makefile | 69 +++++++++++++++++++++++++++++++ Game/Code/lazres-UltraStar.sh | 94 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 163 insertions(+) create mode 100644 Game/Code/Makefile create mode 100755 Game/Code/lazres-UltraStar.sh (limited to 'Game/Code') diff --git a/Game/Code/Makefile b/Game/Code/Makefile new file mode 100644 index 00000000..fcf534cd --- /dev/null +++ b/Game/Code/Makefile @@ -0,0 +1,69 @@ +## +# UltraStar bamboo build for linux +## + +# lazarus base-dir +# will be set by configure later on +LAZDIR := $(shell whereis lazarus | cut -d ' ' -f2) +#LAZDIR = /usr/local/share/lazarus + +# Directories added to the unit path +UNIT_FLAG = -Fu +UNIT_PATH = $(UNIT_FLAG)$(LAZDIR)/lcl/units/i386-linux \ + $(UNIT_FLAG)$(LAZDIR)/components/images/lib/i386-linux \ + $(UNIT_FLAG)$(LAZDIR)/components/jpeg \ + $(UNIT_FLAG). +# $(UNIT_FLAG)$(LAZDIR)/packager/units/i386-linux \ + +# Directory where compiled units (.ppu and .o) files are stored +CUNIT_DIR = build/linux/lazarus + +# Directories added to the includes path +INC_FLAG = -Fi +INC_PATH = $(INC_FLAG)lib/JEDI-SDLv1.0/SDL/Pas + +# Defines +DEFINES = -dLCL +DEFINES += -dFPC_V220 + +# Misc fpc options +COMPAT_FLAGS = -S2dgi +#COMPAT_FLAGS += -Mdelphi +VERBOSE_FLAGS = -vew -l +DEBUG_FLAGS = -gl +DEBUG_FLAGS += -g +#DEBUG_FLAGS = -dDEBUG +#-Crtoi +#OPTIMIZE_FLAGS_FPC204 = -OG2p3 +#OPTIMIZE_FLAGS_FPC220 = -O2p"NAME" +#OPTIMIZE_FLAGS = -dRELEASE +OPTIMIZE_FLAGS += -Xs +FLAGS = $(COMPAT_FLAGS) \ + $(VERBOSE_FLAGS) \ + $(DEBUG_FLAGS) \ + $(OPTIMIZE_FLAGS) \ + $(DEFINES) + +# lpr project file used as input +PROJECT_FILE = UltraStar.lpr +# name of executable +OUTPUT = UltraStar + +all: resource ultrastar +resource: UltraStar.lrs +ultrastar: clean_obj + mkdir -p $(CUNIT_DIR) + fpc $(FLAGS) $(INC_PATH) $(UNIT_PATH) -FU$(CUNIT_DIR) -o$(OUTPUT) $(PROJECT_FILE) +install: + mv $(OUTPUT) ../.. +clean: clean_obj clean_res +distclean: clean +clean_obj: + rm -f -r $(CUNIT_DIR)/*.o $(CUNIT_DIR)/*.ppu $(CUNIT_DIR)/*.rst + rm -f $(OUTPUT) +clean_res: + rm -f UltraStar.lrs link.res +UltraStar.lrs: UltraStar.rc + sh lazres-UltraStar.sh + +.PHONY: all resource ultrastar install clean distclean clean_obj clean_res diff --git a/Game/Code/lazres-UltraStar.sh b/Game/Code/lazres-UltraStar.sh new file mode 100755 index 00000000..1f5adb78 --- /dev/null +++ b/Game/Code/lazres-UltraStar.sh @@ -0,0 +1,94 @@ +#!/bin/bash + +## +# Creates an .lrs resource-file. +# This script reads an rc resource definition file +# and uses lazres to compile it into an lrs-file. +## + +RCFILE=UltraStar.rc +OUTFILE=UltraStar.lrs +# set this to your lazarus directory if autodetection fails +LAZDIR_DEFAULT=/usr/local/share/lazarus + +LAZDIR=`whereis -b lazarus | cut -s -d ' ' -f2` +if [ ! -d "${LAZDIR}" ]; then + if [ ! -d "${LAZDIR_DEFAULT}" ]; then + echo "Autodetecting Lazarus-directory failed!" + echo "Set LAZDIR_DEFAULT to your Lazarus directory in this script." + exit 1 + fi + LAZDIR="${LAZDIR_DEFAULT}" +fi + +LAZRES="${LAZDIR}/tools/lazres" +LAZRES_SRC="${LAZRES}.pp" +LAZRES_PROJ="${LAZRES}.lpi" +LAZBUILD="${LAZDIR}/lazbuild" +UNIT_PATH=-Fu${LAZDIR}/lcl/units/i386-linux + +# check if lazres is available +if [ ! -x "${LAZRES}" ]; then + # lazres not available -> build it + echo -e "Building of lazres required...\n" + # check if lazres project-file exists + if [ ! -f "${LAZRES_SRC}" ]; then + echo -e "\n${LAZRES_SRC} not found!" + exit 1 + fi + # build lazres + fpc -dRELEASE "${UNIT_PATH}" "${LAZRES_SRC}" + #"${LAZBUILD}" "${LAZRES_PROJ}" + # did it fail? + if [ $? -ne 0 ]; then + echo -e "\nBuilding lazres failed!" + exit 1 + fi + echo -e "\nBuilding lazres finished!" +fi + +# create temp-dir for file renaming (do not use varname TMPDIR!) +RENAME_DIR=`mktemp -t -d usdxresXXXXXXXXXX` || exit 1 +echo "Temporary directory for file-renaming created! (${RENAME_DIR})" + +# read each line of RC-file and add resource-path to parameter-list +LAZRES_PARAMS="" +echo "Reading RC-file..." +{ +while read -r res_name res_type res_path; do + # check if line is commented out + if (echo ${res_name} | grep "^//" >/dev/null) ; then + echo "Skip resource: ${res_name}" + continue + fi + # add non-empty paths to parameter-list + if [ ! -z "${res_path}" ]; then + # replace backslashes (\\) and carriage return (\r) (MS-DOS line-ending) + RES_PATH=`echo "${res_path}" | tr '\r\\' '\0/'` + RES_NEW_PATH="${RENAME_DIR}/${res_name}.${res_type}" + eval cp "${RES_PATH}" "${RES_NEW_PATH}" + # append to parameter-list + LAZRES_PARAMS="${LAZRES_PARAMS} ${RES_NEW_PATH}" + fi +done +} < "${RCFILE}" + +# create resource file +rm -f ${OUTFILE} +echo "Creating resource file..." +"${LAZRES}" "${OUTFILE}" ${LAZRES_PARAMS} +RES=0 +if [ -f "${OUTFILE}" ]; then + echo -e "\nResource file successfully created!" + RES=1 +else + echo -e "\nCreation of resource file failed!" +fi + +# remove temp-directory +echo "Removing temporary directory..." +rm -rf "${RENAME_DIR}" + +if [ $RES -eq 1 ]; then + echo -e "\nReady." +fi -- cgit v1.2.3 From e72155505b5e98eb751fe8de98211530dc0faa85 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 3 Dec 2007 02:36:46 +0000 Subject: fixed line endings git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@658 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lazres-UltraStar.sh | 188 +++++++++++++++++++++--------------------- 1 file changed, 94 insertions(+), 94 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/lazres-UltraStar.sh b/Game/Code/lazres-UltraStar.sh index 1f5adb78..603ec4be 100755 --- a/Game/Code/lazres-UltraStar.sh +++ b/Game/Code/lazres-UltraStar.sh @@ -1,94 +1,94 @@ -#!/bin/bash - -## -# Creates an .lrs resource-file. -# This script reads an rc resource definition file -# and uses lazres to compile it into an lrs-file. -## - -RCFILE=UltraStar.rc -OUTFILE=UltraStar.lrs -# set this to your lazarus directory if autodetection fails -LAZDIR_DEFAULT=/usr/local/share/lazarus - -LAZDIR=`whereis -b lazarus | cut -s -d ' ' -f2` -if [ ! -d "${LAZDIR}" ]; then - if [ ! -d "${LAZDIR_DEFAULT}" ]; then - echo "Autodetecting Lazarus-directory failed!" - echo "Set LAZDIR_DEFAULT to your Lazarus directory in this script." - exit 1 - fi - LAZDIR="${LAZDIR_DEFAULT}" -fi - -LAZRES="${LAZDIR}/tools/lazres" -LAZRES_SRC="${LAZRES}.pp" -LAZRES_PROJ="${LAZRES}.lpi" -LAZBUILD="${LAZDIR}/lazbuild" -UNIT_PATH=-Fu${LAZDIR}/lcl/units/i386-linux - -# check if lazres is available -if [ ! -x "${LAZRES}" ]; then - # lazres not available -> build it - echo -e "Building of lazres required...\n" - # check if lazres project-file exists - if [ ! -f "${LAZRES_SRC}" ]; then - echo -e "\n${LAZRES_SRC} not found!" - exit 1 - fi - # build lazres - fpc -dRELEASE "${UNIT_PATH}" "${LAZRES_SRC}" - #"${LAZBUILD}" "${LAZRES_PROJ}" - # did it fail? - if [ $? -ne 0 ]; then - echo -e "\nBuilding lazres failed!" - exit 1 - fi - echo -e "\nBuilding lazres finished!" -fi - -# create temp-dir for file renaming (do not use varname TMPDIR!) -RENAME_DIR=`mktemp -t -d usdxresXXXXXXXXXX` || exit 1 -echo "Temporary directory for file-renaming created! (${RENAME_DIR})" - -# read each line of RC-file and add resource-path to parameter-list -LAZRES_PARAMS="" -echo "Reading RC-file..." -{ -while read -r res_name res_type res_path; do - # check if line is commented out - if (echo ${res_name} | grep "^//" >/dev/null) ; then - echo "Skip resource: ${res_name}" - continue - fi - # add non-empty paths to parameter-list - if [ ! -z "${res_path}" ]; then - # replace backslashes (\\) and carriage return (\r) (MS-DOS line-ending) - RES_PATH=`echo "${res_path}" | tr '\r\\' '\0/'` - RES_NEW_PATH="${RENAME_DIR}/${res_name}.${res_type}" - eval cp "${RES_PATH}" "${RES_NEW_PATH}" - # append to parameter-list - LAZRES_PARAMS="${LAZRES_PARAMS} ${RES_NEW_PATH}" - fi -done -} < "${RCFILE}" - -# create resource file -rm -f ${OUTFILE} -echo "Creating resource file..." -"${LAZRES}" "${OUTFILE}" ${LAZRES_PARAMS} -RES=0 -if [ -f "${OUTFILE}" ]; then - echo -e "\nResource file successfully created!" - RES=1 -else - echo -e "\nCreation of resource file failed!" -fi - -# remove temp-directory -echo "Removing temporary directory..." -rm -rf "${RENAME_DIR}" - -if [ $RES -eq 1 ]; then - echo -e "\nReady." -fi +#!/bin/sh + +## +# Creates an .lrs resource-file. +# This script reads an rc resource definition file +# and uses lazres to compile it into an lrs-file. +## + +RCFILE=UltraStar.rc +OUTFILE=UltraStar.lrs +# set this to your lazarus directory if autodetection fails +LAZDIR_DEFAULT=/usr/local/share/lazarus + +LAZDIR=`whereis -b lazarus | cut -s -d ' ' -f2` +if [ ! -d "${LAZDIR}" ]; then + if [ ! -d "${LAZDIR_DEFAULT}" ]; then + echo "Autodetecting Lazarus-directory failed!" + echo "Set LAZDIR_DEFAULT to your Lazarus directory in this script." + exit 1 + fi + LAZDIR="${LAZDIR_DEFAULT}" +fi + +LAZRES="${LAZDIR}/tools/lazres" +LAZRES_SRC="${LAZRES}.pp" +LAZRES_PROJ="${LAZRES}.lpi" +LAZBUILD="${LAZDIR}/lazbuild" +UNIT_PATH=-Fu${LAZDIR}/lcl/units/i386-linux + +# check if lazres is available +if [ ! -x "${LAZRES}" ]; then + # lazres not available -> build it + echo -e "Building of lazres required...\n" + # check if lazres project-file exists + if [ ! -f "${LAZRES_SRC}" ]; then + echo -e "\n${LAZRES_SRC} not found!" + exit 1 + fi + # build lazres + fpc -dRELEASE "${UNIT_PATH}" "${LAZRES_SRC}" + #"${LAZBUILD}" "${LAZRES_PROJ}" + # did it fail? + if [ $? -ne 0 ]; then + echo -e "\nBuilding lazres failed!" + exit 1 + fi + echo -e "\nBuilding lazres finished!" +fi + +# create temp-dir for file renaming (do not use varname TMPDIR!) +RENAME_DIR=`mktemp -t -d usdxresXXXXXXXXXX` || exit 1 +echo "Temporary directory for file-renaming created! (${RENAME_DIR})" + +# read each line of RC-file and add resource-path to parameter-list +LAZRES_PARAMS="" +echo "Reading RC-file..." +{ +while read -r res_name res_type res_path; do + # check if line is commented out + if (echo ${res_name} | grep "^//" >/dev/null) ; then + echo "Skip resource: ${res_name}" + continue + fi + # add non-empty paths to parameter-list + if [ ! -z "${res_path}" ]; then + # replace backslashes (\\) and carriage return (\r) (MS-DOS line-ending) + RES_PATH=`echo "${res_path}" | tr '\r\\' '\0/'` + RES_NEW_PATH="${RENAME_DIR}/${res_name}.${res_type}" + eval cp "${RES_PATH}" "${RES_NEW_PATH}" + # append to parameter-list + LAZRES_PARAMS="${LAZRES_PARAMS} ${RES_NEW_PATH}" + fi +done +} < "${RCFILE}" + +# create resource file +rm -f ${OUTFILE} +echo "Creating resource file..." +"${LAZRES}" "${OUTFILE}" ${LAZRES_PARAMS} +RES=0 +if [ -f "${OUTFILE}" ]; then + echo -e "\nResource file successfully created!" + RES=1 +else + echo -e "\nCreation of resource file failed!" +fi + +# remove temp-directory +echo "Removing temporary directory..." +rm -rf "${RENAME_DIR}" + +if [ $RES -eq 1 ]; then + echo -e "\nReady." +fi -- cgit v1.2.3 From e4c285f12b6571773b6ff6b5c03b9f948116c7e7 Mon Sep 17 00:00:00 2001 From: b1indy Date: Mon, 3 Dec 2007 12:08:25 +0000 Subject: Initialize SDL_GL_ALPHA_SIZE for the OpenGL Surface git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@659 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphic.pas | 1 + 1 file changed, 1 insertion(+) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 02c06002..c3b042ea 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -521,6 +521,7 @@ begin SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 5); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); -- cgit v1.2.3 From 71425690496481c5937b47fe11cbcc9bbadf1fb7 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 5 Dec 2007 20:08:23 +0000 Subject: Added swscaler as a replacement for the deprecated img_convert function git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@660 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/ffmpeg/swscale.pas | 194 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 Game/Code/lib/ffmpeg/swscale.pas (limited to 'Game/Code') diff --git a/Game/Code/lib/ffmpeg/swscale.pas b/Game/Code/lib/ffmpeg/swscale.pas new file mode 100644 index 00000000..7f356901 --- /dev/null +++ b/Game/Code/lib/ffmpeg/swscale.pas @@ -0,0 +1,194 @@ +{ + * Copyright (C) 2001-2003 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +} +{ + * @file swscale.h + * @brief + * external api for the swscale stuff +} + +unit swscale; + +{$IFDEF FPC} + {$IFNDEF win32} + {$LINKLIB libavutil} + {$LINKLIB libswscale} + {$ENDIF} + {$MODE DELPHI } (* CAT *) + {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) + {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) +{$ENDIF} + +interface + +uses + avutil; + +const +{$IFDEF win32} + sw__scale = 'swscale-0.dll'; +{$ELSE} + sw__scale = 'libswscale.so'; // .0.5.0 +{$ENDIF} + +type + TQuadIntArray = array[0..3] of integer; + PQuadIntArray = ^TQuadIntArray; + TIntArray = array[0..0] of integer; + PIntArray = ^TIntArray; + TPByteArray = array[0..0] of Pbyte; + PPByteArray = ^TPByteArray; + +const + LIBSWSCALE_VERSION_INT = ((0 shl 16)+(5 shl 8))+0; + LIBSWSCALE_VERSION = '0.5.0'; + LIBSWSCALE_BUILD = LIBSWSCALE_VERSION_INT; + + LIBSWSCALE_IDENT = 'SwS'+LIBSWSCALE_VERSION; + + {* values for the flags, the stuff on the command line is different *} + SWS_FAST_BILINEAR = 1; + SWS_BILINEAR = 2; + SWS_BICUBIC = 4; + SWS_X = 8; + SWS_POINT = $10; + SWS_AREA = $20; + SWS_BICUBLIN = $40; + SWS_GAUSS = $80; + SWS_SINC = $100; + SWS_LANCZOS = $200; + SWS_SPLINE = $400; + + SWS_SRC_V_CHR_DROP_MASK = $30000; + SWS_SRC_V_CHR_DROP_SHIFT = 16; + + SWS_PARAM_DEFAULT = 123456; + + SWS_PRINT_INFO = $1000; + + //the following 3 flags are not completely implemented + //internal chrominace subsampling info + SWS_FULL_CHR_H_INT = $2000; + //input subsampling info + SWS_FULL_CHR_H_INP = $4000; + SWS_DIRECT_BGR = $8000; + SWS_ACCURATE_RND = $40000; + + SWS_CPU_CAPS_MMX = $80000000; + SWS_CPU_CAPS_MMX2 = $20000000; + SWS_CPU_CAPS_3DNOW = $40000000; + SWS_CPU_CAPS_ALTIVEC = $10000000; + SWS_CPU_CAPS_BFIN = $01000000; + + SWS_MAX_REDUCE_CUTOFF = 0.002; + + SWS_CS_ITU709 = 1; + SWS_CS_FCC = 4; + SWS_CS_ITU601 = 5; + SWS_CS_ITU624 = 5; + SWS_CS_SMPTE170M = 5; + SWS_CS_SMPTE240M = 7; + SWS_CS_DEFAULT = 5; + + +type + + // when used for filters they must have an odd number of elements + // coeffs cannot be shared between vectors + PSwsVector = ^TSwsVector; + TSwsVector = record + coeff: Pdouble; + length: integer; + end; + + // vectors can be shared + PSwsFilter = ^TSwsFilter; + TSwsFilter = record + lumH: PSwsVector; + lumV: PSwsVector; + chrH: PSwsVector; + chrV: PSwsVector; + end; + + PSwsContext = ^TSwsContext; + TSwsContext = record + {internal structure} + end; + + +procedure sws_freeContext(swsContext: PSwsContext); + cdecl; external sw__scale; + +function sws_getContext(srcW: integer; srcH: integer; srcFormat: integer; dstW: integer; dstH: integer;dstFormat: integer; flags: integer; + srcFilter: PSwsFilter; dstFilter: PSwsFilter; param: Pdouble): PSwsContext; + cdecl; external sw__scale; +function sws_scale(context: PSwsContext; src: PPByteArray; srcStride: PIntArray; srcSliceY: integer; srcSliceH: integer; + dst: PPByteArray; dstStride: PIntArray): integer; + cdecl; external sw__scale; +function sws_scale_ordered(context: PSwsContext; src: PPByteArray; srcStride: PIntArray; srcSliceY: integer; + srcSliceH: integer; dst: PPByteArray; dstStride: PIntArray): integer; + cdecl; external sw__scale; deprecated; + +function sws_setColorspaceDetails(c: PSwsContext; inv_table: PQuadIntArray; srcRange: integer; table: PQuadIntArray; dstRange: integer; + brightness: integer; contrast: integer; saturation: integer): integer; + cdecl; external sw__scale; +function sws_getColorspaceDetails(c: PSwsContext; var inv_table: PQuadIntArray; var srcRange: integer; var table: PQuadIntArray; var dstRange: integer; + var brightness: integer; var contrast: integer; var saturation: integer): integer; + cdecl; external sw__scale; +function sws_getGaussianVec(variance: double; quality: double): PSwsVector; + cdecl; external sw__scale; +function sws_getConstVec(c: double; length: integer): PSwsVector; + cdecl; external sw__scale; +function sws_getIdentityVec: PSwsVector; + cdecl; external sw__scale; +procedure sws_scaleVec(a: PSwsVector; scalar: double); + cdecl; external sw__scale; +procedure sws_normalizeVec(a: PSwsVector; height: double); + cdecl; external sw__scale; +procedure sws_convVec(a: PSwsVector; b: PSwsVector); + cdecl; external sw__scale; +procedure sws_addVec(a: PSwsVector; b: PSwsVector); + cdecl; external sw__scale; +procedure sws_subVec(a: PSwsVector; b: PSwsVector); + cdecl; external sw__scale; +procedure sws_shiftVec(a: PSwsVector; shift: integer); + cdecl; external sw__scale; +function sws_cloneVec(a: PSwsVector): PSwsVector; + cdecl; external sw__scale; + +procedure sws_printVec(a: PSwsVector); + cdecl; external sw__scale; +procedure sws_freeVec(a: PSwsVector); + cdecl; external sw__scale; + +function sws_getDefaultFilter(lumaGBlur: single; chromaGBlur: single; lumaSarpen: single; chromaSharpen: single; chromaHShift: single; + chromaVShift: single; verbose: integer): PSwsFilter; + cdecl; external sw__scale; +procedure sws_freeFilter(filter: PSwsFilter); + cdecl; external sw__scale; + +function sws_getCachedContext(context: PSwsContext; + srcW: integer; srcH: integer; srcFormat: integer; + dstW: integer; dstH: integer; dstFormat: integer; flags: integer; + srcFilter: PSwsFilter; dstFilter: PSwsFilter; param: Pdouble): PSwsContext; + cdecl; external sw__scale; + +implementation + +end. -- cgit v1.2.3 From 8cbb63b81afcd172697a65dc43871631e0c073ca Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 5 Dec 2007 20:15:27 +0000 Subject: Added {$PACKRECORDS C} for correct structure alignment in Windows/Linux. Some cleanup done. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@661 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/portaudio/delphi/portaudio.pas | 2272 +++++++++++++------------- Game/Code/lib/portmixer/delphi/portmixer.pas | 268 +-- 2 files changed, 1274 insertions(+), 1266 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/lib/portaudio/delphi/portaudio.pas b/Game/Code/lib/portaudio/delphi/portaudio.pas index 0e6a2b8c..a01808ab 100644 --- a/Game/Code/lib/portaudio/delphi/portaudio.pas +++ b/Game/Code/lib/portaudio/delphi/portaudio.pas @@ -1,57 +1,61 @@ -{* - * $Id: portaudio.h,v 1.7 2007/08/16 20:45:34 richardash1981 Exp $ - * PortAudio Portable Real-Time Audio Library - * PortAudio API Header File - * Latest version available at: http://www.portaudio.com/ - * - * Copyright (c) 1999-2002 Ross Bencina and Phil Burk - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *} - -{* - * The text above constitutes the entire PortAudio license; however, - * the PortAudio community also makes the following non-binding requests: - * - * Any person wishing to distribute modifications to the Software is - * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the - * license above. - *} - -{** @file - @brief The PortAudio API. -*} - -unit portaudio; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} +{* + * $Id: portaudio.h,v 1.7 2007/08/16 20:45:34 richardash1981 Exp $ + * PortAudio Portable Real-Time Audio Library + * PortAudio API Header File + * Latest version available at: http://www.portaudio.com/ + * + * Copyright (c) 1999-2002 Ross Bencina and Phil Burk + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *} + +{* + * The text above constitutes the entire PortAudio license; however, + * the PortAudio community also makes the following non-binding requests: + * + * Any person wishing to distribute modifications to the Software is + * requested to send the modifications to the original developer so that + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the + * license above. + *} + +{** @file + @brief The PortAudio API. +*} + +unit portaudio; + +{$IFDEF FPC} + {$IFNDEF win32} + {$LINKLIB libportaudio} + {$ENDIF} + {$PACKRECORDS C} (* GCC/Visual C/C++ compatible record packing *) + {$MODE DELPHI } {$ENDIF} - -//uses; - -const + +interface + +//uses; + +const {$IFDEF WIN32} LibName = 'portaudio_x86.dll'; {$ENDIF} @@ -61,1095 +65,1095 @@ const {$IFDEF MACOS} LibName = 'libportaudio.dylib'; {$ENDIF} - -{** Retrieve the release number of the currently running PortAudio build, - eg 1900. -*} -function Pa_GetVersion(): Integer; cdecl ; external LibName; - - -{** Retrieve a textual description of the current PortAudio build, - eg "PortAudio V19-devel 13 October 2002". -*} -function Pa_GetVersionText(): PChar; cdecl ; external LibName; - - -{** Error codes returned by PortAudio functions. - Note that with the exception of paNoError, all PaErrorCodes are negative. -*} - -type TPaError = Integer; -type TPaErrorCode = {enum}Integer; const -{enum_begin PaErrorCode} - paNoError = 0; - - paNotInitialized = -10000; - paUnanticipatedHostError = (paNotInitialized+ 1); - paInvalidChannelCount = (paNotInitialized+ 2); - paInvalidSampleRate = (paNotInitialized+ 3); - paInvalidDevice = (paNotInitialized+ 4); - paInvalidFlag = (paNotInitialized+ 5); - paSampleFormatNotSupported = (paNotInitialized+ 6); - paBadIODeviceCombination = (paNotInitialized+ 7); - paInsufficientMemory = (paNotInitialized+ 8); - paBufferTooBig = (paNotInitialized+ 9); - paBufferTooSmall = (paNotInitialized+10); - paNullCallback = (paNotInitialized+11); - paBadStreamPtr = (paNotInitialized+12); - paTimedOut = (paNotInitialized+13); - paInternalError = (paNotInitialized+14); - paDeviceUnavailable = (paNotInitialized+15); - paIncompatibleHostApiSpecificStreamInfo = (paNotInitialized+16); - paStreamIsStopped = (paNotInitialized+17); - paStreamIsNotStopped = (paNotInitialized+18); - paInputOverflowed = (paNotInitialized+19); - paOutputUnderflowed = (paNotInitialized+20); - paHostApiNotFound = (paNotInitialized+21); - paInvalidHostApi = (paNotInitialized+22); - paCanNotReadFromACallbackStream = (paNotInitialized+23); {**< @todo review error code name *} - paCanNotWriteToACallbackStream = (paNotInitialized+24); {**< @todo review error code name *} - paCanNotReadFromAnOutputOnlyStream = (paNotInitialized+25); {**< @todo review error code name *} - paCanNotWriteToAnInputOnlyStream = (paNotInitialized+26); {**< @todo review error code name *} - paIncompatibleStreamHostApi = (paNotInitialized+27); - paBadBufferPtr = (paNotInitialized+28); -{enum_end PaErrorCode} - - -{** Translate the supplied PortAudio error code into a human readable - message. -*} -function Pa_GetErrorText( errorCode: TPaError ): PChar; cdecl ; external LibName; - - -{** Library initialization function - call this before using PortAudio. - This function initialises internal data structures and prepares underlying + +{** Retrieve the release number of the currently running PortAudio build, + eg 1900. +*} +function Pa_GetVersion(): Integer; cdecl; external LibName; + + +{** Retrieve a textual description of the current PortAudio build, + eg "PortAudio V19-devel 13 October 2002". +*} +function Pa_GetVersionText(): PChar; cdecl; external LibName; + + +{** Error codes returned by PortAudio functions. + Note that with the exception of paNoError, all PaErrorCodes are negative. +*} + +type TPaError = Integer; +type TPaErrorCode = {enum}Integer; const +{enum_begin PaErrorCode} + paNoError = 0; + + paNotInitialized = -10000; + paUnanticipatedHostError = (paNotInitialized+ 1); + paInvalidChannelCount = (paNotInitialized+ 2); + paInvalidSampleRate = (paNotInitialized+ 3); + paInvalidDevice = (paNotInitialized+ 4); + paInvalidFlag = (paNotInitialized+ 5); + paSampleFormatNotSupported = (paNotInitialized+ 6); + paBadIODeviceCombination = (paNotInitialized+ 7); + paInsufficientMemory = (paNotInitialized+ 8); + paBufferTooBig = (paNotInitialized+ 9); + paBufferTooSmall = (paNotInitialized+10); + paNullCallback = (paNotInitialized+11); + paBadStreamPtr = (paNotInitialized+12); + paTimedOut = (paNotInitialized+13); + paInternalError = (paNotInitialized+14); + paDeviceUnavailable = (paNotInitialized+15); + paIncompatibleHostApiSpecificStreamInfo = (paNotInitialized+16); + paStreamIsStopped = (paNotInitialized+17); + paStreamIsNotStopped = (paNotInitialized+18); + paInputOverflowed = (paNotInitialized+19); + paOutputUnderflowed = (paNotInitialized+20); + paHostApiNotFound = (paNotInitialized+21); + paInvalidHostApi = (paNotInitialized+22); + paCanNotReadFromACallbackStream = (paNotInitialized+23); {**< @todo review error code name *} + paCanNotWriteToACallbackStream = (paNotInitialized+24); {**< @todo review error code name *} + paCanNotReadFromAnOutputOnlyStream = (paNotInitialized+25); {**< @todo review error code name *} + paCanNotWriteToAnInputOnlyStream = (paNotInitialized+26); {**< @todo review error code name *} + paIncompatibleStreamHostApi = (paNotInitialized+27); + paBadBufferPtr = (paNotInitialized+28); +{enum_end PaErrorCode} + + +{** Translate the supplied PortAudio error code into a human readable + message. +*} +function Pa_GetErrorText( errorCode: TPaError ): PChar; cdecl; external LibName; + + +{** Library initialization function - call this before using PortAudio. + This function initialises internal data structures and prepares underlying host APIs for use. With the exception of Pa_GetVersion(), Pa_GetVersionText(), and Pa_GetErrorText(), this function MUST be called before using any other PortAudio API functions. - - If Pa_Initialize() is called multiple times, each successful - call must be matched with a corresponding call to Pa_Terminate(). - Pairs of calls to Pa_Initialize()/Pa_Terminate() may overlap, and are not - required to be fully nested. - - Note that if Pa_Initialize() returns an error code, Pa_Terminate() should - NOT be called. - - @return paNoError if successful, otherwise an error code indicating the cause - of failure. - - @see Pa_Terminate -*} -function Pa_Initialize(): TPaError; cdecl ; external LibName; - - -{** Library termination function - call this when finished using PortAudio. - This function deallocates all resources allocated by PortAudio since it was - initializied by a call to Pa_Initialize(). In cases where Pa_Initialise() has - been called multiple times, each call must be matched with a corresponding call - to Pa_Terminate(). The final matching call to Pa_Terminate() will automatically - close any PortAudio streams that are still open. - - Pa_Terminate() MUST be called before exiting a program which uses PortAudio. - Failure to do so may result in serious resource leaks, such as audio devices - not being available until the next reboot. - - @return paNoError if successful, otherwise an error code indicating the cause - of failure. - - @see Pa_Initialize -*} -function Pa_Terminate(): TPaError; cdecl ; external LibName; - - - -{** The type used to refer to audio devices. Values of this type usually - range from 0 to (Pa_GetDeviceCount()-1), and may also take on the PaNoDevice + + If Pa_Initialize() is called multiple times, each successful + call must be matched with a corresponding call to Pa_Terminate(). + Pairs of calls to Pa_Initialize()/Pa_Terminate() may overlap, and are not + required to be fully nested. + + Note that if Pa_Initialize() returns an error code, Pa_Terminate() should + NOT be called. + + @return paNoError if successful, otherwise an error code indicating the cause + of failure. + + @see Pa_Terminate +*} +function Pa_Initialize(): TPaError; cdecl; external LibName; + + +{** Library termination function - call this when finished using PortAudio. + This function deallocates all resources allocated by PortAudio since it was + initializied by a call to Pa_Initialize(). In cases where Pa_Initialise() has + been called multiple times, each call must be matched with a corresponding call + to Pa_Terminate(). The final matching call to Pa_Terminate() will automatically + close any PortAudio streams that are still open. + + Pa_Terminate() MUST be called before exiting a program which uses PortAudio. + Failure to do so may result in serious resource leaks, such as audio devices + not being available until the next reboot. + + @return paNoError if successful, otherwise an error code indicating the cause + of failure. + + @see Pa_Initialize +*} +function Pa_Terminate(): TPaError; cdecl; external LibName; + + + +{** The type used to refer to audio devices. Values of this type usually + range from 0 to (Pa_GetDeviceCount()-1), and may also take on the PaNoDevice and paUseHostApiSpecificDeviceSpecification values. @see Pa_GetDeviceCount, paNoDevice, paUseHostApiSpecificDeviceSpecification -*} -type TPaDeviceIndex = Integer; - - -{** A special PaDeviceIndex value indicating that no device is available, - or should be used. - - @see PaDeviceIndex -*} -const paNoDevice = TPaDeviceIndex(-1); - - -{** A special PaDeviceIndex value indicating that the device(s) to be used - are specified in the host api specific stream info structure. - - @see PaDeviceIndex -*} -const paUseHostApiSpecificDeviceSpecification = TPaDeviceIndex(-2); - - -{* Host API enumeration mechanism *} - -{** The type used to enumerate to host APIs at runtime. Values of this type - range from 0 to (Pa_GetHostApiCount()-1). - - @see Pa_GetHostApiCount -*} -type TPaHostApiIndex = Integer; - -{** Retrieve the number of available host APIs. Even if a host API is - available it may have no devices available. - - @return A non-negative value indicating the number of available host APIs - or, a PaErrorCode (which are always negative) if PortAudio is not initialized - or an error is encountered. - - @see PaHostApiIndex -*} -function Pa_GetHostApiCount(): TPaHostApiIndex; cdecl ; external LibName; - - -{** Retrieve the index of the default host API. The default host API will be - the lowest common denominator host API on the current platform and is - unlikely to provide the best performance. - - @return A non-negative value ranging from 0 to (Pa_GetHostApiCount()-1) - indicating the default host API index or, a PaErrorCode (which are always - negative) if PortAudio is not initialized or an error is encountered. -*} -function Pa_GetDefaultHostApi(): TPaHostApiIndex; cdecl ; external LibName; - - -{** Unchanging unique identifiers for each supported host API. This type - is used in the PaHostApiInfo structure. The values are guaranteed to be - unique and to never change, thus allowing code to be written that - conditionally uses host API specific extensions. - - New type ids will be allocated when support for a host API reaches - "public alpha" status, prior to that developers should use the - paInDevelopment type id. - - @see PaHostApiInfo -*} -type TPaHostApiTypeId = {enum}Integer; const -{enum_begin PaHostApiTypeId} - paInDevelopment=0; {* use while developing support for a new host API *} - paDirectSound=1; - paMME=2; - paASIO=3; - paSoundManager=4; - paCoreAudio=5; - paOSS=7; - paALSA=8; - paAL=9; - paBeOS=10; - paWDMKS=11; - paJACK=12; - paWASAPI=13; - paAudioScienceHPI=14; -{enum_end PaHostApiTypeId} - -{** A structure containing information about a particular host API. *} - -type - PPaHostApiInfo = ^TPaHostApiInfo; - TPaHostApiInfo = record - {** this is struct version 1 *} - structVersion: Integer; - {** The well known unique identifier of this host API @see PaHostApiTypeId *} - _type: TPaHostApiTypeId; - {** A textual description of the host API for display on user interfaces. *} - name: PChar; - - {** The number of devices belonging to this host API. This field may be - used in conjunction with Pa_HostApiDeviceIndexToDeviceIndex() to enumerate - all devices for this host API. - @see Pa_HostApiDeviceIndexToDeviceIndex - *} - deviceCount: Integer; - - {** The default input device for this host API. The value will be a - device index ranging from 0 to (Pa_GetDeviceCount()-1), or paNoDevice - if no default input device is available. - *} - defaultInputDevice: TPaDeviceIndex; - - {** The default output device for this host API. The value will be a - device index ranging from 0 to (Pa_GetDeviceCount()-1), or paNoDevice - if no default output device is available. - *} - defaultOutputDevice: TPaDeviceIndex; - end; - - -{** Retrieve a pointer to a structure containing information about a specific - host Api. - - @param hostApi A valid host API index ranging from 0 to (Pa_GetHostApiCount()-1) - - @return A pointer to an immutable PaHostApiInfo structure describing - a specific host API. If the hostApi parameter is out of range or an error - is encountered, the function returns NULL. - - The returned structure is owned by the PortAudio implementation and must not - be manipulated or freed. The pointer is only guaranteed to be valid between - calls to Pa_Initialize() and Pa_Terminate(). -*} -function Pa_GetHostApiInfo( hostApi: TPaHostApiIndex ): PPaHostApiInfo; cdecl ; external LibName; - - -{** Convert a static host API unique identifier, into a runtime - host API index. - - @param type A unique host API identifier belonging to the PaHostApiTypeId - enumeration. - - @return A valid PaHostApiIndex ranging from 0 to (Pa_GetHostApiCount()-1) or, - a PaErrorCode (which are always negative) if PortAudio is not initialized - or an error is encountered. - - The paHostApiNotFound error code indicates that the host API specified by the - type parameter is not available. - - @see PaHostApiTypeId -*} -function Pa_HostApiTypeIdToHostApiIndex( _type: TPaHostApiTypeId ): TPaHostApiIndex; cdecl ; external LibName; - - -{** Convert a host-API-specific device index to standard PortAudio device index. - This function may be used in conjunction with the deviceCount field of - PaHostApiInfo to enumerate all devices for the specified host API. - - @param hostApi A valid host API index ranging from 0 to (Pa_GetHostApiCount()-1) - - @param hostApiDeviceIndex A valid per-host device index in the range - 0 to (Pa_GetHostApiInfo(hostApi)->deviceCount-1) - - @return A non-negative PaDeviceIndex ranging from 0 to (Pa_GetDeviceCount()-1) - or, a PaErrorCode (which are always negative) if PortAudio is not initialized - or an error is encountered. - - A paInvalidHostApi error code indicates that the host API index specified by - the hostApi parameter is out of range. - - A paInvalidDevice error code indicates that the hostApiDeviceIndex parameter - is out of range. - - @see PaHostApiInfo -*} -function Pa_HostApiDeviceIndexToDeviceIndex( hostApi: TPaHostApiIndex; - hostApiDeviceIndex: Integer ): TPaDeviceIndex; cdecl ; external LibName; - - - -{** Structure used to return information about a host error condition. -*} -type - PPaHostErrorInfo = ^TPaHostErrorInfo; - TPaHostErrorInfo = record - hostApiType: TPaHostApiTypeId; {**< the host API which returned the error code *} - errorCode: Longint; {**< the error code returned *} - errorText: PChar; {**< a textual description of the error if available, otherwise a zero-length string *} - end; - - -{** Return information about the last host error encountered. The error - information returned by Pa_GetLastHostErrorInfo() will never be modified - asyncronously by errors occurring in other PortAudio owned threads - (such as the thread that manages the stream callback.) - - This function is provided as a last resort, primarily to enhance debugging - by providing clients with access to all available error information. - - @return A pointer to an immutable structure constaining information about - the host error. The values in this structure will only be valid if a - PortAudio function has previously returned the paUnanticipatedHostError - error code. -*} -function Pa_GetLastHostErrorInfo(): PPaHostErrorInfo; cdecl ; external LibName; - - - -{* Device enumeration and capabilities *} - -{** Retrieve the number of available devices. The number of available devices - may be zero. - - @return A non-negative value indicating the number of available devices or, - a PaErrorCode (which are always negative) if PortAudio is not initialized - or an error is encountered. -*} -function Pa_GetDeviceCount(): TPaDeviceIndex; cdecl ; external LibName; - - -{** Retrieve the index of the default input device. The result can be - used in the inputDevice parameter to Pa_OpenStream(). - - @return The default input device index for the default host API, or paNoDevice - if no default input device is available or an error was encountered. -*} -function Pa_GetDefaultInputDevice(): TPaDeviceIndex; cdecl ; external LibName; - - -{** Retrieve the index of the default output device. The result can be - used in the outputDevice parameter to Pa_OpenStream(). - - @return The default output device index for the defualt host API, or paNoDevice - if no default output device is available or an error was encountered. - - @note - On the PC, the user can specify a default device by - setting an environment variable. For example, to use device #1. -
- set PA_RECOMMENDED_OUTPUT_DEVICE=1
-
- The user should first determine the available device ids by using - the supplied application "pa_devs". -*} -function Pa_GetDefaultOutputDevice(): TPaDeviceIndex; cdecl ; external LibName; - - -{** The type used to represent monotonic time in seconds that can be used - for syncronisation. The type is used for the outTime argument to the - PaStreamCallback and as the result of Pa_GetStreamTime(). - - @see PaStreamCallback, Pa_GetStreamTime -*} -type TPaTime = Double; - - -{** A type used to specify one or more sample formats. Each value indicates - a possible format for sound data passed to and from the stream callback, - Pa_ReadStream and Pa_WriteStream. - - The standard formats paFloat32, paInt16, paInt32, paInt24, paInt8 - and aUInt8 are usually implemented by all implementations. - - The floating point representation (paFloat32) uses +1.0 and -1.0 as the - maximum and minimum respectively. - - paUInt8 is an unsigned 8 bit format where 128 is considered "ground" - - The paNonInterleaved flag indicates that a multichannel buffer is passed - as a set of non-interleaved pointers. - - @see Pa_OpenStream, Pa_OpenDefaultStream, PaDeviceInfo - @see paFloat32, paInt16, paInt32, paInt24, paInt8 - @see paUInt8, paCustomFormat, paNonInterleaved -*} -type TPaSampleFormat = Longword; -const - paFloat32 = TPaSampleFormat($00000001); {**< @see PaSampleFormat *} - paInt32 = TPaSampleFormat($00000002); {**< @see PaSampleFormat *} - paInt24 = TPaSampleFormat($00000004); {**< Packed 24 bit format. @see PaSampleFormat *} - paInt16 = TPaSampleFormat($00000008); {**< @see PaSampleFormat *} - paInt8 = TPaSampleFormat($00000010); {**< @see PaSampleFormat *} - paUInt8 = TPaSampleFormat($00000020); {**< @see PaSampleFormat *} - paCustomFormat = TPaSampleFormat($00010000); {**< @see PaSampleFormat *} - paNonInterleaved = TPaSampleFormat($80000000); - -{** A structure providing information and capabilities of PortAudio devices. - Devices may support input, output or both input and output. -*} -type - PPaDeviceInfo = ^TPaDeviceInfo; - TPaDeviceInfo = record - structVersion: Integer; {* this is struct version 2 *} - name: PChar; - hostApi: TPaHostApiIndex; {* note this is a host API index, not a type id*} - - maxInputChannels: Integer; - maxOutputChannels: Integer; - - {* Default latency values for interactive performance. *} - defaultLowInputLatency: TPaTime; - defaultLowOutputLatency: TPaTime; - {* Default latency values for robust non-interactive applications (eg. playing sound files). *} - defaultHighInputLatency: TPaTime; - defaultHighOutputLatency: TPaTime; - - defaultSampleRate: Double; - end; - - -{** Retrieve a pointer to a PaDeviceInfo structure containing information - about the specified device. - @return A pointer to an immutable PaDeviceInfo structure. If the device - parameter is out of range the function returns NULL. - - @param device A valid device index in the range 0 to (Pa_GetDeviceCount()-1) - - @note PortAudio manages the memory referenced by the returned pointer, - the client must not manipulate or free the memory. The pointer is only - guaranteed to be valid between calls to Pa_Initialize() and Pa_Terminate(). - - @see PaDeviceInfo, PaDeviceIndex -*} -function Pa_GetDeviceInfo( device: TPaDeviceIndex ): PPaDeviceInfo; cdecl ; external LibName; - - -{** Parameters for one direction (input or output) of a stream. -*} -type - PPaStreamParameters = ^TPaStreamParameters; - TPaStreamParameters = record - {** A valid device index in the range 0 to (Pa_GetDeviceCount()-1) - specifying the device to be used or the special constant - paUseHostApiSpecificDeviceSpecification which indicates that the actual - device(s) to use are specified in hostApiSpecificStreamInfo. - This field must not be set to paNoDevice. - *} - device: TPaDeviceIndex; - - {** The number of channels of sound to be delivered to the - stream callback or accessed by Pa_ReadStream() or Pa_WriteStream(). - It can range from 1 to the value of maxInputChannels in the - PaDeviceInfo record for the device specified by the device parameter. - *} - channelCount: Integer; - - {** The sample format of the buffer provided to the stream callback, - a_ReadStream() or Pa_WriteStream(). It may be any of the formats described - by the PaSampleFormat enumeration. - *} - sampleFormat: TPaSampleFormat; - - {** The desired latency in seconds. Where practical, implementations should - configure their latency based on these parameters, otherwise they may - choose the closest viable latency instead. Unless the suggested latency - is greater than the absolute upper limit for the device implementations - should round the suggestedLatency up to the next practial value - ie to - provide an equal or higher latency than suggestedLatency wherever possibe. - Actual latency values for an open stream may be retrieved using the - inputLatency and outputLatency fields of the PaStreamInfo structure - returned by Pa_GetStreamInfo(). - @see default*Latency in PaDeviceInfo, *Latency in PaStreamInfo - *} - suggestedLatency: TPaTime; - - {** An optional pointer to a host api specific data structure - containing additional information for device setup and/or stream processing. - hostApiSpecificStreamInfo is never required for correct operation, - if not used it should be set to NULL. - *} - hostApiSpecificStreamInfo: Pointer; - end; - - -{** Return code for Pa_IsFormatSupported indicating success. *} -const paFormatIsSupported = (0); - -{** Determine whether it would be possible to open a stream with the specified - parameters. - - @param inputParameters A structure that describes the input parameters used to - open a stream. The suggestedLatency field is ignored. See PaStreamParameters - for a description of these parameters. inputParameters must be NULL for - output-only streams. - - @param outputParameters A structure that describes the output parameters used - to open a stream. The suggestedLatency field is ignored. See PaStreamParameters - for a description of these parameters. outputParameters must be NULL for - input-only streams. - - @param sampleRate The required sampleRate. For full-duplex streams it is the - sample rate for both input and output - - @return Returns 0 if the format is supported, and an error code indicating why - the format is not supported otherwise. The constant paFormatIsSupported is - provided to compare with the return value for success. - - @see paFormatIsSupported, PaStreamParameters -*} -function Pa_IsFormatSupported( inputParameters: PPaStreamParameters; - outputParameters: PPaStreamParameters; - sampleRate: Double ): TPaError; cdecl ; external LibName; - - - -{* Streaming types and functions *} - - -{** - A single PaStream can provide multiple channels of real-time - streaming audio input and output to a client application. A stream - provides access to audio hardware represented by one or more - PaDevices. Depending on the underlying Host API, it may be possible - to open multiple streams using the same device, however this behavior - is implementation defined. Portable applications should assume that - a PaDevice may be simultaneously used by at most one PaStream. - - Pointers to PaStream objects are passed between PortAudio functions that - operate on streams. - - @see Pa_OpenStream, Pa_OpenDefaultStream, Pa_OpenDefaultStream, Pa_CloseStream, - Pa_StartStream, Pa_StopStream, Pa_AbortStream, Pa_IsStreamActive, - Pa_GetStreamTime, Pa_GetStreamCpuLoad - -*} -type - PPaStream = Pointer; - -{** Can be passed as the framesPerBuffer parameter to Pa_OpenStream() - or Pa_OpenDefaultStream() to indicate that the stream callback will - accept buffers of any size. -*} -const paFramesPerBufferUnspecified = (0); - - -{** Flags used to control the behavior of a stream. They are passed as - parameters to Pa_OpenStream or Pa_OpenDefaultStream. Multiple flags may be - ORed together. - - @see Pa_OpenStream, Pa_OpenDefaultStream - @see paNoFlag, paClipOff, paDitherOff, paNeverDropInput, - paPrimeOutputBuffersUsingStreamCallback, paPlatformSpecificFlags -*} -type TPaStreamFlags = Longword; - -{** @see PaStreamFlags *} -const paNoFlag = TPaStreamFlags(0); - -{** Disable default clipping of out of range samples. - @see PaStreamFlags -*} -const paClipOff = TPaStreamFlags($00000001); - -{** Disable default dithering. - @see PaStreamFlags -*} -const paDitherOff = TPaStreamFlags($00000002); - -{** Flag requests that where possible a full duplex stream will not discard - overflowed input samples without calling the stream callback. This flag is - only valid for full duplex callback streams and only when used in combination - with the paFramesPerBufferUnspecified (0) framesPerBuffer parameter. Using - this flag incorrectly results in a paInvalidFlag error being returned from - Pa_OpenStream and Pa_OpenDefaultStream. - - @see PaStreamFlags, paFramesPerBufferUnspecified -*} -const paNeverDropInput = TPaStreamFlags($00000004); - -{** Call the stream callback to fill initial output buffers, rather than the - default behavior of priming the buffers with zeros (silence). This flag has - no effect for input-only and blocking read/write streams. - - @see PaStreamFlags -*} -const paPrimeOutputBuffersUsingStreamCallback = TPaStreamFlags($00000008); - -{** A mask specifying the platform specific bits. - @see PaStreamFlags -*} -const paPlatformSpecificFlags = TPaStreamFlags($FFFF0000); - -{** - Timing information for the buffers passed to the stream callback. -*} -type - PPaStreamCallbackTimeInfo = ^PaStreamCallbackTimeInfo; - PaStreamCallbackTimeInfo = record - inputBufferAdcTime: TPaTime; - currentTime: TPaTime; - outputBufferDacTime: TPaTime; - end; - - -{** - Flag bit constants for the statusFlags to PaStreamCallback. - - @see paInputUnderflow, paInputOverflow, paOutputUnderflow, paOutputOverflow, - paPrimingOutput -*} -type TPaStreamCallbackFlags = Longword; - -{** In a stream opened with paFramesPerBufferUnspecified, indicates that - input data is all silence (zeros) because no real data is available. In a - stream opened without paFramesPerBufferUnspecified, it indicates that one or - more zero samples have been inserted into the input buffer to compensate - for an input underflow. - @see PaStreamCallbackFlags -*} -const paInputUnderflow = TPaStreamCallbackFlags($00000001); - -{** In a stream opened with paFramesPerBufferUnspecified, indicates that data - prior to the first sample of the input buffer was discarded due to an - overflow, possibly because the stream callback is using too much CPU time. - Otherwise indicates that data prior to one or more samples in the - input buffer was discarded. - @see PaStreamCallbackFlags -*} -const paInputOverflow = TPaStreamCallbackFlags($00000002); - -{** Indicates that output data (or a gap) was inserted, possibly because the - stream callback is using too much CPU time. - @see PaStreamCallbackFlags -*} -const paOutputUnderflow = TPaStreamCallbackFlags($00000004); - -{** Indicates that output data will be discarded because no room is available. - @see PaStreamCallbackFlags -*} -const paOutputOverflow = TPaStreamCallbackFlags($00000008); - -{** Some of all of the output data will be used to prime the stream, input - data may be zero. - @see PaStreamCallbackFlags -*} -const paPrimingOutput = TPaStreamCallbackFlags($00000010); - -{** - Allowable return values for the PaStreamCallback. - @see PaStreamCallback -*} -type TPaStreamCallbackResult = {enum}Integer; const -{enum_begin PaStreamCallbackResult} - paContinue=0; - paComplete=1; - paAbort=2; -{enum_end PaStreamCallbackResult} - -{** - Functions of type PaStreamCallback are implemented by PortAudio clients. - They consume, process or generate audio in response to requests from an - active PortAudio stream. - - @param input and @param output are arrays of interleaved samples, - the format, packing and number of channels used by the buffers are - determined by parameters to Pa_OpenStream(). - - @param frameCount The number of sample frames to be processed by - the stream callback. - - @param timeInfo The time in seconds when the first sample of the input - buffer was received at the audio input, the time in seconds when the first - sample of the output buffer will begin being played at the audio output, and - the time in seconds when the stream callback was called. - See also Pa_GetStreamTime() - - @param statusFlags Flags indicating whether input and/or output buffers - have been inserted or will be dropped to overcome underflow or overflow - conditions. - - @param userData The value of a user supplied pointer passed to - Pa_OpenStream() intended for storing synthesis data etc. - - @return - The stream callback should return one of the values in the - PaStreamCallbackResult enumeration. To ensure that the callback continues - to be called, it should return paContinue (0). Either paComplete or paAbort - can be returned to finish stream processing, after either of these values is - returned the callback will not be called again. If paAbort is returned the - stream will finish as soon as possible. If paComplete is returned, the stream - will continue until all buffers generated by the callback have been played. - This may be useful in applications such as soundfile players where a specific - duration of output is required. However, it is not necessary to utilise this - mechanism as Pa_StopStream(), Pa_AbortStream() or Pa_CloseStream() can also - be used to stop the stream. The callback must always fill the entire output - buffer irrespective of its return value. - - @see Pa_OpenStream, Pa_OpenDefaultStream - - @note With the exception of Pa_GetStreamCpuLoad() it is not permissable to call - PortAudio API functions from within the stream callback. -*} -type - PPaStreamCallback = ^TPaStreamCallback; - TPaStreamCallback = function( - input: Pointer; output: Pointer; - frameCount: Longword; - timeInfo: PPaStreamCallbackTimeInfo; - statusFlags: TPaStreamCallbackFlags; - userData: Pointer ): Integer; cdecl; - - -{** Opens a stream for either input, output or both. - - @param stream The address of a PaStream pointer which will receive - a pointer to the newly opened stream. - - @param inputParameters A structure that describes the input parameters used by - the opened stream. See PaStreamParameters for a description of these parameters. - inputParameters must be NULL for output-only streams. - - @param outputParameters A structure that describes the output parameters used by - the opened stream. See PaStreamParameters for a description of these parameters. - outputParameters must be NULL for input-only streams. - - @param sampleRate The desired sampleRate. For full-duplex streams it is the - sample rate for both input and output - - @param framesPerBuffer The number of frames passed to the stream callback - function, or the preferred block granularity for a blocking read/write stream. - The special value paFramesPerBufferUnspecified (0) may be used to request that - the stream callback will recieve an optimal (and possibly varying) number of - frames based on host requirements and the requested latency settings. - Note: With some host APIs, the use of non-zero framesPerBuffer for a callback - stream may introduce an additional layer of buffering which could introduce - additional latency. PortAudio guarantees that the additional latency - will be kept to the theoretical minimum however, it is strongly recommended - that a non-zero framesPerBuffer value only be used when your algorithm - requires a fixed number of frames per stream callback. - - @param streamFlags Flags which modify the behaviour of the streaming process. - This parameter may contain a combination of flags ORed together. Some flags may - only be relevant to certain buffer formats. - - @param streamCallback A pointer to a client supplied function that is responsible - for processing and filling input and output buffers. If this parameter is NULL - the stream will be opened in 'blocking read/write' mode. In blocking mode, - the client can receive sample data using Pa_ReadStream and write sample data - using Pa_WriteStream, the number of samples that may be read or written - without blocking is returned by Pa_GetStreamReadAvailable and - Pa_GetStreamWriteAvailable respectively. - - @param userData A client supplied pointer which is passed to the stream callback - function. It could for example, contain a pointer to instance data necessary - for processing the audio buffers. This parameter is ignored if streamCallback - is NULL. - - @return - Upon success Pa_OpenStream() returns paNoError and places a pointer to a - valid PaStream in the stream argument. The stream is inactive (stopped). - If a call to Pa_OpenStream() fails, a non-zero error code is returned (see - PaError for possible error codes) and the value of stream is invalid. - - @see PaStreamParameters, PaStreamCallback, Pa_ReadStream, Pa_WriteStream, - Pa_GetStreamReadAvailable, Pa_GetStreamWriteAvailable -*} -function Pa_OpenStream( var stream: PPaStream; - inputParameters: PPaStreamParameters; - outputParameters: PPaStreamParameters; - sampleRate: Double; - framesPerBuffer: Longword; - streamFlags: TPaStreamFlags; - streamCallback: PPaStreamCallback; - userData: Pointer ): TPaError; cdecl ; external LibName; - - -{** A simplified version of Pa_OpenStream() that opens the default input - and/or output devices. - - @param stream The address of a PaStream pointer which will receive - a pointer to the newly opened stream. - - @param numInputChannels The number of channels of sound that will be supplied - to the stream callback or returned by Pa_ReadStream. It can range from 1 to - the value of maxInputChannels in the PaDeviceInfo record for the default input - device. If 0 the stream is opened as an output-only stream. - - @param numOutputChannels The number of channels of sound to be delivered to the - stream callback or passed to Pa_WriteStream. It can range from 1 to the value - of maxOutputChannels in the PaDeviceInfo record for the default output dvice. - If 0 the stream is opened as an output-only stream. - - @param sampleFormat The sample format of both the input and output buffers - provided to the callback or passed to and from Pa_ReadStream and Pa_WriteStream. - sampleFormat may be any of the formats described by the PaSampleFormat - enumeration. - - @param sampleRate Same as Pa_OpenStream parameter of the same name. - @param framesPerBuffer Same as Pa_OpenStream parameter of the same name. - @param streamCallback Same as Pa_OpenStream parameter of the same name. - @param userData Same as Pa_OpenStream parameter of the same name. - - @return As for Pa_OpenStream - - @see Pa_OpenStream, PaStreamCallback -*} -function Pa_OpenDefaultStream( var stream: PPaStream; - numInputChannels: Integer; - numOutputChannels: Integer; - sampleFormat: TPaSampleFormat; - sampleRate: Double; - framesPerBuffer: Longword; - streamCallback: PPaStreamCallback; - userData: Pointer ): TPaError; cdecl ; external LibName; - - -{** Closes an audio stream. If the audio stream is active it - discards any pending buffers as if Pa_AbortStream() had been called. -*} -function Pa_CloseStream( stream: PPaStream ): TPaError; cdecl ; external LibName; - - -{** Functions of type PaStreamFinishedCallback are implemented by PortAudio - clients. They can be registered with a stream using the Pa_SetStreamFinishedCallback - function. Once registered they are called when the stream becomes inactive - (ie once a call to Pa_StopStream() will not block). - A stream will become inactive after the stream callback returns non-zero, - or when Pa_StopStream or Pa_AbortStream is called. For a stream providing audio - output, if the stream callback returns paComplete, or Pa_StopStream is called, - the stream finished callback will not be called until all generated sample data - has been played. - - @param userData The userData parameter supplied to Pa_OpenStream() - - @see Pa_SetStreamFinishedCallback -*} -type - PPaStreamFinishedCallback = ^TPaStreamFinishedCallback; - TPaStreamFinishedCallback = procedure( userData: Pointer ); cdecl; - - -{** Register a stream finished callback function which will be called when the - stream becomes inactive. See the description of PaStreamFinishedCallback for - further details about when the callback will be called. - - @param stream a pointer to a PaStream that is in the stopped state - if the - stream is not stopped, the stream's finished callback will remain unchanged - and an error code will be returned. - - @param streamFinishedCallback a pointer to a function with the same signature - as PaStreamFinishedCallback, that will be called when the stream becomes - inactive. Passing NULL for this parameter will un-register a previously - registered stream finished callback function. - - @return on success returns paNoError, otherwise an error code indicating the cause - of the error. - - @see PaStreamFinishedCallback -*} -function Pa_SetStreamFinishedCallback( stream: PPaStream; - streamFinishedCallback: PPaStreamFinishedCallback ): TPaError; cdecl ; external LibName; - - -{** Commences audio processing. -*} -function Pa_StartStream( stream: PPaStream ): TPaError; cdecl ; external LibName; - - -{** Terminates audio processing. It waits until all pending - audio buffers have been played before it returns. -*} -function Pa_StopStream( stream: PPaStream ): TPaError; cdecl ; external LibName; - - -{** Terminates audio processing immediately without waiting for pending - buffers to complete. -*} -function Pa_AbortStream( stream: PPaStream ): TPaError; cdecl ; external LibName; - - -{** Determine whether the stream is stopped. - A stream is considered to be stopped prior to a successful call to - Pa_StartStream and after a successful call to Pa_StopStream or Pa_AbortStream. - If a stream callback returns a value other than paContinue the stream is NOT - considered to be stopped. - - @return Returns one (1) when the stream is stopped, zero (0) when - the stream is running or, a PaErrorCode (which are always negative) if - PortAudio is not initialized or an error is encountered. - - @see Pa_StopStream, Pa_AbortStream, Pa_IsStreamActive -*} -function Pa_IsStreamStopped( stream: PPaStream ): TPaError; cdecl ; external LibName; - - -{** Determine whether the stream is active. - A stream is active after a successful call to Pa_StartStream(), until it - becomes inactive either as a result of a call to Pa_StopStream() or - Pa_AbortStream(), or as a result of a return value other than paContinue from - the stream callback. In the latter case, the stream is considered inactive - after the last buffer has finished playing. - - @return Returns one (1) when the stream is active (ie playing or recording - audio), zero (0) when not playing or, a PaErrorCode (which are always negative) - if PortAudio is not initialized or an error is encountered. - - @see Pa_StopStream, Pa_AbortStream, Pa_IsStreamStopped -*} -function Pa_IsStreamActive( stream: PPaStream ): TPaError; cdecl ; external LibName; - - - -{** A structure containing unchanging information about an open stream. - @see Pa_GetStreamInfo -*} -type - PPaStreamInfo = ^PaStreamInfo; - PaStreamInfo = record - {** this is struct version 1 *} - structVersion: Integer; - - {** The input latency of the stream in seconds. This value provides the most - accurate estimate of input latency available to the implementation. It may - differ significantly from the suggestedLatency value passed to Pa_OpenStream(). - The value of this field will be zero (0.) for output-only streams. - @see PaTime - *} - inputLatency: TPaTime; - - {** The output latency of the stream in seconds. This value provides the most - accurate estimate of output latency available to the implementation. It may - differ significantly from the suggestedLatency value passed to Pa_OpenStream(). - The value of this field will be zero (0.) for input-only streams. - @see PaTime - *} - outputLatency: TPaTime; - - {** The sample rate of the stream in Hertz (samples per second). In cases - where the hardware sample rate is inaccurate and PortAudio is aware of it, - the value of this field may be different from the sampleRate parameter - passed to Pa_OpenStream(). If information about the actual hardware sample - rate is not available, this field will have the same value as the sampleRate - parameter passed to Pa_OpenStream(). - *} - sampleRate: Double; - end; - - -{** Retrieve a pointer to a PaStreamInfo structure containing information - about the specified stream. - @return A pointer to an immutable PaStreamInfo structure. If the stream - parameter invalid, or an error is encountered, the function returns NULL. - - @param stream A pointer to an open stream previously created with Pa_OpenStream. - - @note PortAudio manages the memory referenced by the returned pointer, - the client must not manipulate or free the memory. The pointer is only - guaranteed to be valid until the specified stream is closed. - - @see PaStreamInfo -*} -function Pa_GetStreamInfo( stream: PPaStream ): PPaStreamInfo; cdecl ; external LibName; - - -{** Determine the current time for the stream according to the same clock used - to generate buffer timestamps. This time may be used for syncronising other - events to the audio stream, for example synchronizing audio to MIDI. - - @return The stream's current time in seconds, or 0 if an error occurred. - - @see PaTime, PaStreamCallback -*} -function Pa_GetStreamTime( stream: PPaStream ): TPaTime; cdecl ; external LibName; - - -{** Retrieve CPU usage information for the specified stream. - The "CPU Load" is a fraction of total CPU time consumed by a callback stream's - audio processing routines including, but not limited to the client supplied - stream callback. This function does not work with blocking read/write streams. - - This function may be called from the stream callback function or the - application. - - @return - A floating point value, typically between 0.0 and 1.0, where 1.0 indicates - that the stream callback is consuming the maximum number of CPU cycles possible - to maintain real-time operation. A value of 0.5 would imply that PortAudio and - the stream callback was consuming roughly 50% of the available CPU time. The - return value may exceed 1.0. A value of 0.0 will always be returned for a - blocking read/write stream, or if an error occurrs. -*} -function Pa_GetStreamCpuLoad( stream: PPaStream ): Double; cdecl ; external LibName; - - -{** Read samples from an input stream. The function doesn't return until - the entire buffer has been filled - this may involve waiting for the operating - system to supply the data. - - @param stream A pointer to an open stream previously created with Pa_OpenStream. - - @param buffer A pointer to a buffer of sample frames. The buffer contains - samples in the format specified by the inputParameters->sampleFormat field - used to open the stream, and the number of channels specified by - inputParameters->numChannels. If non-interleaved samples were requested, - buffer is a pointer to the first element of an array of non-interleaved - buffer pointers, one for each channel. - - @param frames The number of frames to be read into buffer. This parameter - is not constrained to a specific range, however high performance applications - will want to match this parameter to the framesPerBuffer parameter used - when opening the stream. - - @return On success PaNoError will be returned, or PaInputOverflowed if input - data was discarded by PortAudio after the previous call and before this call. -*} -function Pa_ReadStream( stream: PPaStream; - buffer: Pointer; - frames: Longword ): TPaError; cdecl ; external LibName; - - -{** Write samples to an output stream. This function doesn't return until the - entire buffer has been consumed - this may involve waiting for the operating - system to consume the data. - - @param stream A pointer to an open stream previously created with Pa_OpenStream. - - @param buffer A pointer to a buffer of sample frames. The buffer contains - samples in the format specified by the outputParameters->sampleFormat field - used to open the stream, and the number of channels specified by - outputParameters->numChannels. If non-interleaved samples were requested, - buffer is a pointer to the first element of an array of non-interleaved - buffer pointers, one for each channel. - - @param frames The number of frames to be written from buffer. This parameter - is not constrained to a specific range, however high performance applications - will want to match this parameter to the framesPerBuffer parameter used - when opening the stream. - - @return On success PaNoError will be returned, or paOutputUnderflowed if - additional output data was inserted after the previous call and before this - call. -*} -function Pa_WriteStream( stream: PPaStream; - buffer: Pointer; - frames: Longword ): TPaError; cdecl ; external LibName; - - -{** Retrieve the number of frames that can be read from the stream without - waiting. - - @return Returns a non-negative value representing the maximum number of frames - that can be read from the stream without blocking or busy waiting or, a - PaErrorCode (which are always negative) if PortAudio is not initialized or an - error is encountered. -*} -function Pa_GetStreamReadAvailable( stream: PPaStream ): Longint; cdecl ; external LibName; - - -{** Retrieve the number of frames that can be written to the stream without - waiting. - - @return Returns a non-negative value representing the maximum number of frames - that can be written to the stream without blocking or busy waiting or, a - PaErrorCode (which are always negative) if PortAudio is not initialized or an - error is encountered. -*} -function Pa_GetStreamWriteAvailable( stream: PPaStream ): Longint; cdecl ; external LibName; - - -{** Retrieve the host type handling an open stream. +*} +type TPaDeviceIndex = Integer; + + +{** A special PaDeviceIndex value indicating that no device is available, + or should be used. + + @see PaDeviceIndex +*} +const paNoDevice = TPaDeviceIndex(-1); + + +{** A special PaDeviceIndex value indicating that the device(s) to be used + are specified in the host api specific stream info structure. + + @see PaDeviceIndex +*} +const paUseHostApiSpecificDeviceSpecification = TPaDeviceIndex(-2); + + +{* Host API enumeration mechanism *} + +{** The type used to enumerate to host APIs at runtime. Values of this type + range from 0 to (Pa_GetHostApiCount()-1). + + @see Pa_GetHostApiCount +*} +type TPaHostApiIndex = Integer; + +{** Retrieve the number of available host APIs. Even if a host API is + available it may have no devices available. + + @return A non-negative value indicating the number of available host APIs + or, a PaErrorCode (which are always negative) if PortAudio is not initialized + or an error is encountered. + + @see PaHostApiIndex +*} +function Pa_GetHostApiCount(): TPaHostApiIndex; cdecl; external LibName; + + +{** Retrieve the index of the default host API. The default host API will be + the lowest common denominator host API on the current platform and is + unlikely to provide the best performance. + + @return A non-negative value ranging from 0 to (Pa_GetHostApiCount()-1) + indicating the default host API index or, a PaErrorCode (which are always + negative) if PortAudio is not initialized or an error is encountered. +*} +function Pa_GetDefaultHostApi(): TPaHostApiIndex; cdecl; external LibName; + + +{** Unchanging unique identifiers for each supported host API. This type + is used in the PaHostApiInfo structure. The values are guaranteed to be + unique and to never change, thus allowing code to be written that + conditionally uses host API specific extensions. + + New type ids will be allocated when support for a host API reaches + "public alpha" status, prior to that developers should use the + paInDevelopment type id. + + @see PaHostApiInfo +*} +type TPaHostApiTypeId = {enum}Integer; const +{enum_begin PaHostApiTypeId} + paInDevelopment=0; {* use while developing support for a new host API *} + paDirectSound=1; + paMME=2; + paASIO=3; + paSoundManager=4; + paCoreAudio=5; + paOSS=7; + paALSA=8; + paAL=9; + paBeOS=10; + paWDMKS=11; + paJACK=12; + paWASAPI=13; + paAudioScienceHPI=14; +{enum_end PaHostApiTypeId} + +{** A structure containing information about a particular host API. *} + +type + PPaHostApiInfo = ^TPaHostApiInfo; + TPaHostApiInfo = record + {** this is struct version 1 *} + structVersion: Integer; + {** The well known unique identifier of this host API @see PaHostApiTypeId *} + _type: TPaHostApiTypeId; + {** A textual description of the host API for display on user interfaces. *} + name: PChar; + + {** The number of devices belonging to this host API. This field may be + used in conjunction with Pa_HostApiDeviceIndexToDeviceIndex() to enumerate + all devices for this host API. + @see Pa_HostApiDeviceIndexToDeviceIndex + *} + deviceCount: Integer; + + {** The default input device for this host API. The value will be a + device index ranging from 0 to (Pa_GetDeviceCount()-1), or paNoDevice + if no default input device is available. + *} + defaultInputDevice: TPaDeviceIndex; + + {** The default output device for this host API. The value will be a + device index ranging from 0 to (Pa_GetDeviceCount()-1), or paNoDevice + if no default output device is available. + *} + defaultOutputDevice: TPaDeviceIndex; + end; + + +{** Retrieve a pointer to a structure containing information about a specific + host Api. + + @param hostApi A valid host API index ranging from 0 to (Pa_GetHostApiCount()-1) + + @return A pointer to an immutable PaHostApiInfo structure describing + a specific host API. If the hostApi parameter is out of range or an error + is encountered, the function returns NULL. + + The returned structure is owned by the PortAudio implementation and must not + be manipulated or freed. The pointer is only guaranteed to be valid between + calls to Pa_Initialize() and Pa_Terminate(). +*} +function Pa_GetHostApiInfo( hostApi: TPaHostApiIndex ): PPaHostApiInfo; cdecl; external LibName; + + +{** Convert a static host API unique identifier, into a runtime + host API index. + + @param type A unique host API identifier belonging to the PaHostApiTypeId + enumeration. + + @return A valid PaHostApiIndex ranging from 0 to (Pa_GetHostApiCount()-1) or, + a PaErrorCode (which are always negative) if PortAudio is not initialized + or an error is encountered. + + The paHostApiNotFound error code indicates that the host API specified by the + type parameter is not available. + + @see PaHostApiTypeId +*} +function Pa_HostApiTypeIdToHostApiIndex( _type: TPaHostApiTypeId ): TPaHostApiIndex; cdecl; external LibName; + + +{** Convert a host-API-specific device index to standard PortAudio device index. + This function may be used in conjunction with the deviceCount field of + PaHostApiInfo to enumerate all devices for the specified host API. + + @param hostApi A valid host API index ranging from 0 to (Pa_GetHostApiCount()-1) + + @param hostApiDeviceIndex A valid per-host device index in the range + 0 to (Pa_GetHostApiInfo(hostApi)->deviceCount-1) + + @return A non-negative PaDeviceIndex ranging from 0 to (Pa_GetDeviceCount()-1) + or, a PaErrorCode (which are always negative) if PortAudio is not initialized + or an error is encountered. + + A paInvalidHostApi error code indicates that the host API index specified by + the hostApi parameter is out of range. + + A paInvalidDevice error code indicates that the hostApiDeviceIndex parameter + is out of range. + + @see PaHostApiInfo +*} +function Pa_HostApiDeviceIndexToDeviceIndex( hostApi: TPaHostApiIndex; + hostApiDeviceIndex: Integer ): TPaDeviceIndex; cdecl; external LibName; + + + +{** Structure used to return information about a host error condition. +*} +type + PPaHostErrorInfo = ^TPaHostErrorInfo; + TPaHostErrorInfo = record + hostApiType: TPaHostApiTypeId; {**< the host API which returned the error code *} + errorCode: Longint; {**< the error code returned *} + errorText: PChar; {**< a textual description of the error if available, otherwise a zero-length string *} + end; + + +{** Return information about the last host error encountered. The error + information returned by Pa_GetLastHostErrorInfo() will never be modified + asyncronously by errors occurring in other PortAudio owned threads + (such as the thread that manages the stream callback.) + + This function is provided as a last resort, primarily to enhance debugging + by providing clients with access to all available error information. + + @return A pointer to an immutable structure constaining information about + the host error. The values in this structure will only be valid if a + PortAudio function has previously returned the paUnanticipatedHostError + error code. +*} +function Pa_GetLastHostErrorInfo(): PPaHostErrorInfo; cdecl; external LibName; + + + +{* Device enumeration and capabilities *} + +{** Retrieve the number of available devices. The number of available devices + may be zero. + + @return A non-negative value indicating the number of available devices or, + a PaErrorCode (which are always negative) if PortAudio is not initialized + or an error is encountered. +*} +function Pa_GetDeviceCount(): TPaDeviceIndex; cdecl; external LibName; + + +{** Retrieve the index of the default input device. The result can be + used in the inputDevice parameter to Pa_OpenStream(). + + @return The default input device index for the default host API, or paNoDevice + if no default input device is available or an error was encountered. +*} +function Pa_GetDefaultInputDevice(): TPaDeviceIndex; cdecl; external LibName; + + +{** Retrieve the index of the default output device. The result can be + used in the outputDevice parameter to Pa_OpenStream(). + + @return The default output device index for the defualt host API, or paNoDevice + if no default output device is available or an error was encountered. + + @note + On the PC, the user can specify a default device by + setting an environment variable. For example, to use device #1. +
+ set PA_RECOMMENDED_OUTPUT_DEVICE=1
+
+ The user should first determine the available device ids by using + the supplied application "pa_devs". +*} +function Pa_GetDefaultOutputDevice(): TPaDeviceIndex; cdecl; external LibName; + + +{** The type used to represent monotonic time in seconds that can be used + for syncronisation. The type is used for the outTime argument to the + PaStreamCallback and as the result of Pa_GetStreamTime(). + + @see PaStreamCallback, Pa_GetStreamTime +*} +type TPaTime = Double; + + +{** A type used to specify one or more sample formats. Each value indicates + a possible format for sound data passed to and from the stream callback, + Pa_ReadStream and Pa_WriteStream. + + The standard formats paFloat32, paInt16, paInt32, paInt24, paInt8 + and aUInt8 are usually implemented by all implementations. + + The floating point representation (paFloat32) uses +1.0 and -1.0 as the + maximum and minimum respectively. + + paUInt8 is an unsigned 8 bit format where 128 is considered "ground" + + The paNonInterleaved flag indicates that a multichannel buffer is passed + as a set of non-interleaved pointers. + + @see Pa_OpenStream, Pa_OpenDefaultStream, PaDeviceInfo + @see paFloat32, paInt16, paInt32, paInt24, paInt8 + @see paUInt8, paCustomFormat, paNonInterleaved +*} +type TPaSampleFormat = Longword; +const + paFloat32 = TPaSampleFormat($00000001); {**< @see PaSampleFormat *} + paInt32 = TPaSampleFormat($00000002); {**< @see PaSampleFormat *} + paInt24 = TPaSampleFormat($00000004); {**< Packed 24 bit format. @see PaSampleFormat *} + paInt16 = TPaSampleFormat($00000008); {**< @see PaSampleFormat *} + paInt8 = TPaSampleFormat($00000010); {**< @see PaSampleFormat *} + paUInt8 = TPaSampleFormat($00000020); {**< @see PaSampleFormat *} + paCustomFormat = TPaSampleFormat($00010000); {**< @see PaSampleFormat *} + paNonInterleaved = TPaSampleFormat($80000000); + +{** A structure providing information and capabilities of PortAudio devices. + Devices may support input, output or both input and output. +*} +type + PPaDeviceInfo = ^TPaDeviceInfo; + TPaDeviceInfo = record + structVersion: Integer; {* this is struct version 2 *} + name: PChar; + hostApi: TPaHostApiIndex; {* note this is a host API index, not a type id*} + + maxInputChannels: Integer; + maxOutputChannels: Integer; + + {* Default latency values for interactive performance. *} + defaultLowInputLatency: TPaTime; + defaultLowOutputLatency: TPaTime; + {* Default latency values for robust non-interactive applications (eg. playing sound files). *} + defaultHighInputLatency: TPaTime; + defaultHighOutputLatency: TPaTime; + + defaultSampleRate: Double; + end; + + +{** Retrieve a pointer to a PaDeviceInfo structure containing information + about the specified device. + @return A pointer to an immutable PaDeviceInfo structure. If the device + parameter is out of range the function returns NULL. + + @param device A valid device index in the range 0 to (Pa_GetDeviceCount()-1) + + @note PortAudio manages the memory referenced by the returned pointer, + the client must not manipulate or free the memory. The pointer is only + guaranteed to be valid between calls to Pa_Initialize() and Pa_Terminate(). + + @see PaDeviceInfo, PaDeviceIndex +*} +function Pa_GetDeviceInfo( device: TPaDeviceIndex ): PPaDeviceInfo; cdecl; external LibName; + + +{** Parameters for one direction (input or output) of a stream. +*} +type + PPaStreamParameters = ^TPaStreamParameters; + TPaStreamParameters = record + {** A valid device index in the range 0 to (Pa_GetDeviceCount()-1) + specifying the device to be used or the special constant + paUseHostApiSpecificDeviceSpecification which indicates that the actual + device(s) to use are specified in hostApiSpecificStreamInfo. + This field must not be set to paNoDevice. + *} + device: TPaDeviceIndex; + + {** The number of channels of sound to be delivered to the + stream callback or accessed by Pa_ReadStream() or Pa_WriteStream(). + It can range from 1 to the value of maxInputChannels in the + PaDeviceInfo record for the device specified by the device parameter. + *} + channelCount: Integer; + + {** The sample format of the buffer provided to the stream callback, + a_ReadStream() or Pa_WriteStream(). It may be any of the formats described + by the PaSampleFormat enumeration. + *} + sampleFormat: TPaSampleFormat; + + {** The desired latency in seconds. Where practical, implementations should + configure their latency based on these parameters, otherwise they may + choose the closest viable latency instead. Unless the suggested latency + is greater than the absolute upper limit for the device implementations + should round the suggestedLatency up to the next practial value - ie to + provide an equal or higher latency than suggestedLatency wherever possibe. + Actual latency values for an open stream may be retrieved using the + inputLatency and outputLatency fields of the PaStreamInfo structure + returned by Pa_GetStreamInfo(). + @see default*Latency in PaDeviceInfo, *Latency in PaStreamInfo + *} + suggestedLatency: TPaTime; + + {** An optional pointer to a host api specific data structure + containing additional information for device setup and/or stream processing. + hostApiSpecificStreamInfo is never required for correct operation, + if not used it should be set to NULL. + *} + hostApiSpecificStreamInfo: Pointer; + end; + + +{** Return code for Pa_IsFormatSupported indicating success. *} +const paFormatIsSupported = (0); + +{** Determine whether it would be possible to open a stream with the specified + parameters. + + @param inputParameters A structure that describes the input parameters used to + open a stream. The suggestedLatency field is ignored. See PaStreamParameters + for a description of these parameters. inputParameters must be NULL for + output-only streams. + + @param outputParameters A structure that describes the output parameters used + to open a stream. The suggestedLatency field is ignored. See PaStreamParameters + for a description of these parameters. outputParameters must be NULL for + input-only streams. + + @param sampleRate The required sampleRate. For full-duplex streams it is the + sample rate for both input and output + + @return Returns 0 if the format is supported, and an error code indicating why + the format is not supported otherwise. The constant paFormatIsSupported is + provided to compare with the return value for success. + + @see paFormatIsSupported, PaStreamParameters +*} +function Pa_IsFormatSupported( inputParameters: PPaStreamParameters; + outputParameters: PPaStreamParameters; + sampleRate: Double ): TPaError; cdecl; external LibName; + + + +{* Streaming types and functions *} + + +{** + A single PaStream can provide multiple channels of real-time + streaming audio input and output to a client application. A stream + provides access to audio hardware represented by one or more + PaDevices. Depending on the underlying Host API, it may be possible + to open multiple streams using the same device, however this behavior + is implementation defined. Portable applications should assume that + a PaDevice may be simultaneously used by at most one PaStream. + + Pointers to PaStream objects are passed between PortAudio functions that + operate on streams. + + @see Pa_OpenStream, Pa_OpenDefaultStream, Pa_OpenDefaultStream, Pa_CloseStream, + Pa_StartStream, Pa_StopStream, Pa_AbortStream, Pa_IsStreamActive, + Pa_GetStreamTime, Pa_GetStreamCpuLoad + +*} +type + PPaStream = Pointer; + +{** Can be passed as the framesPerBuffer parameter to Pa_OpenStream() + or Pa_OpenDefaultStream() to indicate that the stream callback will + accept buffers of any size. +*} +const paFramesPerBufferUnspecified = (0); + + +{** Flags used to control the behavior of a stream. They are passed as + parameters to Pa_OpenStream or Pa_OpenDefaultStream. Multiple flags may be + ORed together. + + @see Pa_OpenStream, Pa_OpenDefaultStream + @see paNoFlag, paClipOff, paDitherOff, paNeverDropInput, + paPrimeOutputBuffersUsingStreamCallback, paPlatformSpecificFlags +*} +type TPaStreamFlags = Longword; + +{** @see PaStreamFlags *} +const paNoFlag = TPaStreamFlags(0); + +{** Disable default clipping of out of range samples. + @see PaStreamFlags +*} +const paClipOff = TPaStreamFlags($00000001); + +{** Disable default dithering. + @see PaStreamFlags +*} +const paDitherOff = TPaStreamFlags($00000002); + +{** Flag requests that where possible a full duplex stream will not discard + overflowed input samples without calling the stream callback. This flag is + only valid for full duplex callback streams and only when used in combination + with the paFramesPerBufferUnspecified (0) framesPerBuffer parameter. Using + this flag incorrectly results in a paInvalidFlag error being returned from + Pa_OpenStream and Pa_OpenDefaultStream. + + @see PaStreamFlags, paFramesPerBufferUnspecified +*} +const paNeverDropInput = TPaStreamFlags($00000004); + +{** Call the stream callback to fill initial output buffers, rather than the + default behavior of priming the buffers with zeros (silence). This flag has + no effect for input-only and blocking read/write streams. + + @see PaStreamFlags +*} +const paPrimeOutputBuffersUsingStreamCallback = TPaStreamFlags($00000008); + +{** A mask specifying the platform specific bits. + @see PaStreamFlags +*} +const paPlatformSpecificFlags = TPaStreamFlags($FFFF0000); + +{** + Timing information for the buffers passed to the stream callback. +*} +type + PPaStreamCallbackTimeInfo = ^TPaStreamCallbackTimeInfo; + TPaStreamCallbackTimeInfo = record + inputBufferAdcTime: TPaTime; + currentTime: TPaTime; + outputBufferDacTime: TPaTime; + end; + + +{** + Flag bit constants for the statusFlags to PaStreamCallback. + + @see paInputUnderflow, paInputOverflow, paOutputUnderflow, paOutputOverflow, + paPrimingOutput +*} +type TPaStreamCallbackFlags = Longword; + +{** In a stream opened with paFramesPerBufferUnspecified, indicates that + input data is all silence (zeros) because no real data is available. In a + stream opened without paFramesPerBufferUnspecified, it indicates that one or + more zero samples have been inserted into the input buffer to compensate + for an input underflow. + @see PaStreamCallbackFlags +*} +const paInputUnderflow = TPaStreamCallbackFlags($00000001); + +{** In a stream opened with paFramesPerBufferUnspecified, indicates that data + prior to the first sample of the input buffer was discarded due to an + overflow, possibly because the stream callback is using too much CPU time. + Otherwise indicates that data prior to one or more samples in the + input buffer was discarded. + @see PaStreamCallbackFlags +*} +const paInputOverflow = TPaStreamCallbackFlags($00000002); + +{** Indicates that output data (or a gap) was inserted, possibly because the + stream callback is using too much CPU time. + @see PaStreamCallbackFlags +*} +const paOutputUnderflow = TPaStreamCallbackFlags($00000004); + +{** Indicates that output data will be discarded because no room is available. + @see PaStreamCallbackFlags +*} +const paOutputOverflow = TPaStreamCallbackFlags($00000008); + +{** Some of all of the output data will be used to prime the stream, input + data may be zero. + @see PaStreamCallbackFlags +*} +const paPrimingOutput = TPaStreamCallbackFlags($00000010); + +{** + Allowable return values for the PaStreamCallback. + @see PaStreamCallback +*} +type TPaStreamCallbackResult = {enum}Integer; const +{enum_begin PaStreamCallbackResult} + paContinue=0; + paComplete=1; + paAbort=2; +{enum_end PaStreamCallbackResult} + +{** + Functions of type PaStreamCallback are implemented by PortAudio clients. + They consume, process or generate audio in response to requests from an + active PortAudio stream. + + @param input and @param output are arrays of interleaved samples, + the format, packing and number of channels used by the buffers are + determined by parameters to Pa_OpenStream(). + + @param frameCount The number of sample frames to be processed by + the stream callback. + + @param timeInfo The time in seconds when the first sample of the input + buffer was received at the audio input, the time in seconds when the first + sample of the output buffer will begin being played at the audio output, and + the time in seconds when the stream callback was called. + See also Pa_GetStreamTime() + + @param statusFlags Flags indicating whether input and/or output buffers + have been inserted or will be dropped to overcome underflow or overflow + conditions. + + @param userData The value of a user supplied pointer passed to + Pa_OpenStream() intended for storing synthesis data etc. + + @return + The stream callback should return one of the values in the + PaStreamCallbackResult enumeration. To ensure that the callback continues + to be called, it should return paContinue (0). Either paComplete or paAbort + can be returned to finish stream processing, after either of these values is + returned the callback will not be called again. If paAbort is returned the + stream will finish as soon as possible. If paComplete is returned, the stream + will continue until all buffers generated by the callback have been played. + This may be useful in applications such as soundfile players where a specific + duration of output is required. However, it is not necessary to utilise this + mechanism as Pa_StopStream(), Pa_AbortStream() or Pa_CloseStream() can also + be used to stop the stream. The callback must always fill the entire output + buffer irrespective of its return value. + + @see Pa_OpenStream, Pa_OpenDefaultStream + + @note With the exception of Pa_GetStreamCpuLoad() it is not permissable to call + PortAudio API functions from within the stream callback. +*} +type + PPaStreamCallback = ^TPaStreamCallback; + TPaStreamCallback = function( + input: Pointer; output: Pointer; + frameCount: Longword; + timeInfo: PPaStreamCallbackTimeInfo; + statusFlags: TPaStreamCallbackFlags; + userData: Pointer ): Integer; cdecl; + + +{** Opens a stream for either input, output or both. + + @param stream The address of a PaStream pointer which will receive + a pointer to the newly opened stream. + + @param inputParameters A structure that describes the input parameters used by + the opened stream. See PaStreamParameters for a description of these parameters. + inputParameters must be NULL for output-only streams. + + @param outputParameters A structure that describes the output parameters used by + the opened stream. See PaStreamParameters for a description of these parameters. + outputParameters must be NULL for input-only streams. + + @param sampleRate The desired sampleRate. For full-duplex streams it is the + sample rate for both input and output + + @param framesPerBuffer The number of frames passed to the stream callback + function, or the preferred block granularity for a blocking read/write stream. + The special value paFramesPerBufferUnspecified (0) may be used to request that + the stream callback will recieve an optimal (and possibly varying) number of + frames based on host requirements and the requested latency settings. + Note: With some host APIs, the use of non-zero framesPerBuffer for a callback + stream may introduce an additional layer of buffering which could introduce + additional latency. PortAudio guarantees that the additional latency + will be kept to the theoretical minimum however, it is strongly recommended + that a non-zero framesPerBuffer value only be used when your algorithm + requires a fixed number of frames per stream callback. + + @param streamFlags Flags which modify the behaviour of the streaming process. + This parameter may contain a combination of flags ORed together. Some flags may + only be relevant to certain buffer formats. + + @param streamCallback A pointer to a client supplied function that is responsible + for processing and filling input and output buffers. If this parameter is NULL + the stream will be opened in 'blocking read/write' mode. In blocking mode, + the client can receive sample data using Pa_ReadStream and write sample data + using Pa_WriteStream, the number of samples that may be read or written + without blocking is returned by Pa_GetStreamReadAvailable and + Pa_GetStreamWriteAvailable respectively. + + @param userData A client supplied pointer which is passed to the stream callback + function. It could for example, contain a pointer to instance data necessary + for processing the audio buffers. This parameter is ignored if streamCallback + is NULL. + + @return + Upon success Pa_OpenStream() returns paNoError and places a pointer to a + valid PaStream in the stream argument. The stream is inactive (stopped). + If a call to Pa_OpenStream() fails, a non-zero error code is returned (see + PaError for possible error codes) and the value of stream is invalid. + + @see PaStreamParameters, PaStreamCallback, Pa_ReadStream, Pa_WriteStream, + Pa_GetStreamReadAvailable, Pa_GetStreamWriteAvailable +*} +function Pa_OpenStream( var stream: PPaStream; + inputParameters: PPaStreamParameters; + outputParameters: PPaStreamParameters; + sampleRate: Double; + framesPerBuffer: Longword; + streamFlags: TPaStreamFlags; + streamCallback: PPaStreamCallback; + userData: Pointer ): TPaError; cdecl; external LibName; + + +{** A simplified version of Pa_OpenStream() that opens the default input + and/or output devices. + + @param stream The address of a PaStream pointer which will receive + a pointer to the newly opened stream. + + @param numInputChannels The number of channels of sound that will be supplied + to the stream callback or returned by Pa_ReadStream. It can range from 1 to + the value of maxInputChannels in the PaDeviceInfo record for the default input + device. If 0 the stream is opened as an output-only stream. + + @param numOutputChannels The number of channels of sound to be delivered to the + stream callback or passed to Pa_WriteStream. It can range from 1 to the value + of maxOutputChannels in the PaDeviceInfo record for the default output dvice. + If 0 the stream is opened as an output-only stream. + + @param sampleFormat The sample format of both the input and output buffers + provided to the callback or passed to and from Pa_ReadStream and Pa_WriteStream. + sampleFormat may be any of the formats described by the PaSampleFormat + enumeration. + + @param sampleRate Same as Pa_OpenStream parameter of the same name. + @param framesPerBuffer Same as Pa_OpenStream parameter of the same name. + @param streamCallback Same as Pa_OpenStream parameter of the same name. + @param userData Same as Pa_OpenStream parameter of the same name. + + @return As for Pa_OpenStream + + @see Pa_OpenStream, PaStreamCallback +*} +function Pa_OpenDefaultStream( var stream: PPaStream; + numInputChannels: Integer; + numOutputChannels: Integer; + sampleFormat: TPaSampleFormat; + sampleRate: Double; + framesPerBuffer: Longword; + streamCallback: PPaStreamCallback; + userData: Pointer ): TPaError; cdecl; external LibName; + + +{** Closes an audio stream. If the audio stream is active it + discards any pending buffers as if Pa_AbortStream() had been called. +*} +function Pa_CloseStream( stream: PPaStream ): TPaError; cdecl; external LibName; + + +{** Functions of type PaStreamFinishedCallback are implemented by PortAudio + clients. They can be registered with a stream using the Pa_SetStreamFinishedCallback + function. Once registered they are called when the stream becomes inactive + (ie once a call to Pa_StopStream() will not block). + A stream will become inactive after the stream callback returns non-zero, + or when Pa_StopStream or Pa_AbortStream is called. For a stream providing audio + output, if the stream callback returns paComplete, or Pa_StopStream is called, + the stream finished callback will not be called until all generated sample data + has been played. + + @param userData The userData parameter supplied to Pa_OpenStream() + + @see Pa_SetStreamFinishedCallback +*} +type + PPaStreamFinishedCallback = ^TPaStreamFinishedCallback; + TPaStreamFinishedCallback = procedure( userData: Pointer ); cdecl; + + +{** Register a stream finished callback function which will be called when the + stream becomes inactive. See the description of PaStreamFinishedCallback for + further details about when the callback will be called. + + @param stream a pointer to a PaStream that is in the stopped state - if the + stream is not stopped, the stream's finished callback will remain unchanged + and an error code will be returned. + + @param streamFinishedCallback a pointer to a function with the same signature + as PaStreamFinishedCallback, that will be called when the stream becomes + inactive. Passing NULL for this parameter will un-register a previously + registered stream finished callback function. + + @return on success returns paNoError, otherwise an error code indicating the cause + of the error. + + @see PaStreamFinishedCallback +*} +function Pa_SetStreamFinishedCallback( stream: PPaStream; + streamFinishedCallback: PPaStreamFinishedCallback ): TPaError; cdecl; external LibName; + + +{** Commences audio processing. +*} +function Pa_StartStream( stream: PPaStream ): TPaError; cdecl; external LibName; + + +{** Terminates audio processing. It waits until all pending + audio buffers have been played before it returns. +*} +function Pa_StopStream( stream: PPaStream ): TPaError; cdecl; external LibName; + + +{** Terminates audio processing immediately without waiting for pending + buffers to complete. +*} +function Pa_AbortStream( stream: PPaStream ): TPaError; cdecl; external LibName; + + +{** Determine whether the stream is stopped. + A stream is considered to be stopped prior to a successful call to + Pa_StartStream and after a successful call to Pa_StopStream or Pa_AbortStream. + If a stream callback returns a value other than paContinue the stream is NOT + considered to be stopped. + + @return Returns one (1) when the stream is stopped, zero (0) when + the stream is running or, a PaErrorCode (which are always negative) if + PortAudio is not initialized or an error is encountered. + + @see Pa_StopStream, Pa_AbortStream, Pa_IsStreamActive +*} +function Pa_IsStreamStopped( stream: PPaStream ): TPaError; cdecl; external LibName; + + +{** Determine whether the stream is active. + A stream is active after a successful call to Pa_StartStream(), until it + becomes inactive either as a result of a call to Pa_StopStream() or + Pa_AbortStream(), or as a result of a return value other than paContinue from + the stream callback. In the latter case, the stream is considered inactive + after the last buffer has finished playing. + + @return Returns one (1) when the stream is active (ie playing or recording + audio), zero (0) when not playing or, a PaErrorCode (which are always negative) + if PortAudio is not initialized or an error is encountered. + + @see Pa_StopStream, Pa_AbortStream, Pa_IsStreamStopped +*} +function Pa_IsStreamActive( stream: PPaStream ): TPaError; cdecl; external LibName; + + + +{** A structure containing unchanging information about an open stream. + @see Pa_GetStreamInfo +*} +type + PPaStreamInfo = ^TPaStreamInfo; + TPaStreamInfo = record + {** this is struct version 1 *} + structVersion: Integer; + + {** The input latency of the stream in seconds. This value provides the most + accurate estimate of input latency available to the implementation. It may + differ significantly from the suggestedLatency value passed to Pa_OpenStream(). + The value of this field will be zero (0.) for output-only streams. + @see PaTime + *} + inputLatency: TPaTime; + + {** The output latency of the stream in seconds. This value provides the most + accurate estimate of output latency available to the implementation. It may + differ significantly from the suggestedLatency value passed to Pa_OpenStream(). + The value of this field will be zero (0.) for input-only streams. + @see PaTime + *} + outputLatency: TPaTime; + + {** The sample rate of the stream in Hertz (samples per second). In cases + where the hardware sample rate is inaccurate and PortAudio is aware of it, + the value of this field may be different from the sampleRate parameter + passed to Pa_OpenStream(). If information about the actual hardware sample + rate is not available, this field will have the same value as the sampleRate + parameter passed to Pa_OpenStream(). + *} + sampleRate: Double; + end; + + +{** Retrieve a pointer to a PaStreamInfo structure containing information + about the specified stream. + @return A pointer to an immutable PaStreamInfo structure. If the stream + parameter invalid, or an error is encountered, the function returns NULL. + + @param stream A pointer to an open stream previously created with Pa_OpenStream. + + @note PortAudio manages the memory referenced by the returned pointer, + the client must not manipulate or free the memory. The pointer is only + guaranteed to be valid until the specified stream is closed. + + @see PaStreamInfo +*} +function Pa_GetStreamInfo( stream: PPaStream ): PPaStreamInfo; cdecl; external LibName; + + +{** Determine the current time for the stream according to the same clock used + to generate buffer timestamps. This time may be used for syncronising other + events to the audio stream, for example synchronizing audio to MIDI. + + @return The stream's current time in seconds, or 0 if an error occurred. + + @see PaTime, PaStreamCallback +*} +function Pa_GetStreamTime( stream: PPaStream ): TPaTime; cdecl; external LibName; + + +{** Retrieve CPU usage information for the specified stream. + The "CPU Load" is a fraction of total CPU time consumed by a callback stream's + audio processing routines including, but not limited to the client supplied + stream callback. This function does not work with blocking read/write streams. + + This function may be called from the stream callback function or the + application. + + @return + A floating point value, typically between 0.0 and 1.0, where 1.0 indicates + that the stream callback is consuming the maximum number of CPU cycles possible + to maintain real-time operation. A value of 0.5 would imply that PortAudio and + the stream callback was consuming roughly 50% of the available CPU time. The + return value may exceed 1.0. A value of 0.0 will always be returned for a + blocking read/write stream, or if an error occurrs. +*} +function Pa_GetStreamCpuLoad( stream: PPaStream ): Double; cdecl; external LibName; + + +{** Read samples from an input stream. The function doesn't return until + the entire buffer has been filled - this may involve waiting for the operating + system to supply the data. + + @param stream A pointer to an open stream previously created with Pa_OpenStream. + + @param buffer A pointer to a buffer of sample frames. The buffer contains + samples in the format specified by the inputParameters->sampleFormat field + used to open the stream, and the number of channels specified by + inputParameters->numChannels. If non-interleaved samples were requested, + buffer is a pointer to the first element of an array of non-interleaved + buffer pointers, one for each channel. + + @param frames The number of frames to be read into buffer. This parameter + is not constrained to a specific range, however high performance applications + will want to match this parameter to the framesPerBuffer parameter used + when opening the stream. + + @return On success PaNoError will be returned, or PaInputOverflowed if input + data was discarded by PortAudio after the previous call and before this call. +*} +function Pa_ReadStream( stream: PPaStream; + buffer: Pointer; + frames: Longword ): TPaError; cdecl; external LibName; + + +{** Write samples to an output stream. This function doesn't return until the + entire buffer has been consumed - this may involve waiting for the operating + system to consume the data. + + @param stream A pointer to an open stream previously created with Pa_OpenStream. + + @param buffer A pointer to a buffer of sample frames. The buffer contains + samples in the format specified by the outputParameters->sampleFormat field + used to open the stream, and the number of channels specified by + outputParameters->numChannels. If non-interleaved samples were requested, + buffer is a pointer to the first element of an array of non-interleaved + buffer pointers, one for each channel. + + @param frames The number of frames to be written from buffer. This parameter + is not constrained to a specific range, however high performance applications + will want to match this parameter to the framesPerBuffer parameter used + when opening the stream. + + @return On success PaNoError will be returned, or paOutputUnderflowed if + additional output data was inserted after the previous call and before this + call. +*} +function Pa_WriteStream( stream: PPaStream; + buffer: Pointer; + frames: Longword ): TPaError; cdecl; external LibName; + + +{** Retrieve the number of frames that can be read from the stream without + waiting. + + @return Returns a non-negative value representing the maximum number of frames + that can be read from the stream without blocking or busy waiting or, a + PaErrorCode (which are always negative) if PortAudio is not initialized or an + error is encountered. +*} +function Pa_GetStreamReadAvailable( stream: PPaStream ): Longint; cdecl; external LibName; + + +{** Retrieve the number of frames that can be written to the stream without + waiting. + + @return Returns a non-negative value representing the maximum number of frames + that can be written to the stream without blocking or busy waiting or, a + PaErrorCode (which are always negative) if PortAudio is not initialized or an + error is encountered. +*} +function Pa_GetStreamWriteAvailable( stream: PPaStream ): Longint; cdecl; external LibName; + + +{** Retrieve the host type handling an open stream. @return Returns a non-negative value representing the host API type handling an open stream or, a PaErrorCode (which are always negative) if PortAudio is not initialized or an error is encountered. *} -function Pa_GetStreamHostApiType( stream: PPaStream ): TPaHostApiTypeId; cdecl ; external LibName; - - -{* Miscellaneous utilities *} - - -{** Retrieve the size of a given sample format in bytes. - - @return The size in bytes of a single sample in the specified format, - or paSampleFormatNotSupported if the format is not supported. -*} -function Pa_GetSampleSize( format: TPaSampleFormat ): TPaError; cdecl ; external LibName; - - -{** Put the caller to sleep for at least 'msec' milliseconds. This function is - provided only as a convenience for authors of portable code (such as the tests - and examples in the PortAudio distribution.) - - The function may sleep longer than requested so don't rely on this for accurate - musical timing. -*} -procedure Pa_Sleep( msec: Longint ); cdecl ; external LibName; - -implementation - -end. +function Pa_GetStreamHostApiType( stream: PPaStream ): TPaHostApiTypeId; cdecl; external LibName; + + +{* Miscellaneous utilities *} + + +{** Retrieve the size of a given sample format in bytes. + + @return The size in bytes of a single sample in the specified format, + or paSampleFormatNotSupported if the format is not supported. +*} +function Pa_GetSampleSize( format: TPaSampleFormat ): TPaError; cdecl; external LibName; + + +{** Put the caller to sleep for at least 'msec' milliseconds. This function is + provided only as a convenience for authors of portable code (such as the tests + and examples in the PortAudio distribution.) + + The function may sleep longer than requested so don't rely on this for accurate + musical timing. +*} +procedure Pa_Sleep( msec: Longint ); cdecl; external LibName; + +implementation + +end. diff --git a/Game/Code/lib/portmixer/delphi/portmixer.pas b/Game/Code/lib/portmixer/delphi/portmixer.pas index f5854bb2..a9e27516 100644 --- a/Game/Code/lib/portmixer/delphi/portmixer.pas +++ b/Game/Code/lib/portmixer/delphi/portmixer.pas @@ -1,52 +1,56 @@ -{* - * PortMixer - * PortMixer API Header File - * - * Copyright (c) 2002, 2006 - * - * Written by Dominic Mazzoni - * and Leland Lucius - * - * PortMixer is intended to work side-by-side with PortAudio, - * the Portable Real-Time Audio Library by Ross Bencina and - * Phil Burk. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * Any person wishing to distribute modifications to the Software is - * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - *} -unit portmixer; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} +{* + * PortMixer + * PortMixer API Header File + * + * Copyright (c) 2002, 2006 + * + * Written by Dominic Mazzoni + * and Leland Lucius + * + * PortMixer is intended to work side-by-side with PortAudio, + * the Portable Real-Time Audio Library by Ross Bencina and + * Phil Burk. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * Any person wishing to distribute modifications to the Software is + * requested to send the modifications to the original developer so that + * they can be incorporated into the canonical version. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *} +unit portmixer; + +{$IFDEF FPC} + {$IFNDEF win32} + {$LINKLIB libportaudio} + {$ENDIF} + {$PACKRECORDS C} (* GCC/Visual C/C++ compatible record packing *) + {$MODE DELPHI } {$ENDIF} - -uses - portaudio; - -const + +interface + +uses + portaudio; + +const {$IFDEF WIN32} LibName = 'portmixer.dll'; {$ENDIF} @@ -56,93 +60,93 @@ const {$IFDEF MACOS} LibName = 'libportmixer.dylib'; {$ENDIF} - -type - PPxMixer = Pointer; - TPxVolume = Single; {* 0.0 (min) --> 1.0 (max) *} - TPxBalance = Single; {* -1.0 (left) --> 1.0 (right) *} - -{* - Px_OpenMixer() returns a mixer which will work with the given PortAudio - audio device. Pass 0 as the index for the first (default) mixer. -*} - -function Px_OpenMixer( pa_stream: Pointer; i: Integer ): PPxMixer; cdecl ; external LibName; - -{* - Px_CloseMixer() closes a mixer opened using Px_OpenMixer and frees any - memory associated with it. -*} - -procedure Px_CloseMixer( mixer: PPxMixer ); cdecl ; external LibName; - -{* - Px_GetNumMixers returns the number of mixers which could be + +type + PPxMixer = Pointer; + TPxVolume = Single; {* 0.0 (min) --> 1.0 (max) *} + TPxBalance = Single; {* -1.0 (left) --> 1.0 (right) *} + +{* + Px_OpenMixer() returns a mixer which will work with the given PortAudio + audio device. Pass 0 as the index for the first (default) mixer. +*} + +function Px_OpenMixer( pa_stream: Pointer; i: Integer ): PPxMixer; cdecl; external LibName; + +{* + Px_CloseMixer() closes a mixer opened using Px_OpenMixer and frees any + memory associated with it. +*} + +procedure Px_CloseMixer( mixer: PPxMixer ); cdecl; external LibName; + +{* + Px_GetNumMixers returns the number of mixers which could be used with the given PortAudio device. On most systems, there will be only one mixer for each device; however there may be multiple mixers for each device, or possibly multiple mixers which are independent of any particular PortAudio device. *} -function Px_GetNumMixers( mixer: PPxMixer ): Integer; cdecl ; external LibName; -function Px_GetMixerName( mixer: PPxMixer; i: Integer ): PChar; cdecl ; external LibName; - -{* - Master (output) volume -*} - -function Px_GetMasterVolume( mixer: PPxMixer ): TPxVolume; cdecl ; external LibName; -procedure Px_SetMasterVolume( mixer: PPxMixer; volume: TPxVolume ); cdecl ; external LibName; - -{* - Main output volume -*} - -function Px_GetPCMOutputVolume( mixer: PPxMixer ): TPxVolume; cdecl ; external LibName; -procedure Px_SetPCMOutputVolume( mixer: PPxMixer; volume: TPxVolume ); cdecl ; external LibName; -function Px_SupportsPCMOutputVolume( mixer: PPxMixer ): Integer; cdecl ; external LibName; - -{* - All output volumes -*} - -function Px_GetNumOutputVolumes( mixer: PPxMixer ): Integer; cdecl ; external LibName; -function Px_GetOutputVolumeName( mixer: PPxMixer; i: Integer ): PChar; cdecl ; external LibName; -function Px_GetOutputVolume( mixer: PPxMixer; i: Integer ): TPxVolume; cdecl ; external LibName; -procedure Px_SetOutputVolume( mixer: PPxMixer; i: Integer; volume: TPxVolume ); cdecl ; external LibName; - -{* - Input source -*} - -function Px_GetNumInputSources( mixer: PPxMixer ): Integer; cdecl ; external LibName; -function Px_GetInputSourceName( mixer: PPxMixer; i: Integer): PChar; cdecl ; external LibName; -function Px_GetCurrentInputSource( mixer: PPxMixer ): Integer; cdecl ; external LibName; {* may return -1 == none *} -procedure Px_SetCurrentInputSource( mixer: PPxMixer; i: Integer ); cdecl ; external LibName; - -{* - Input volume -*} - -function Px_GetInputVolume( mixer: PPxMixer ): TPxVolume; cdecl ; external LibName; -procedure Px_SetInputVolume( mixer: PPxMixer; volume: TPxVolume ); cdecl ; external LibName; - -{* - Balance -*} - -function Px_SupportsOutputBalance( mixer: PPxMixer ): Integer; cdecl ; external LibName; -function Px_GetOutputBalance( mixer: PPxMixer ): TPxBalance; cdecl ; external LibName; -procedure Px_SetOutputBalance( mixer: PPxMixer; balance: TPxBalance ); cdecl ; external LibName; - -{* - Playthrough -*} - -function Px_SupportsPlaythrough( mixer: PPxMixer ): Integer; cdecl ; external LibName; -function Px_GetPlaythrough( mixer: PPxMixer ): TPxVolume; cdecl ; external LibName; -procedure Px_SetPlaythrough( mixer: PPxMixer; volume: TPxVolume ); cdecl ; external LibName; - -implementation - -end. +function Px_GetNumMixers( mixer: PPxMixer ): Integer; cdecl; external LibName; +function Px_GetMixerName( mixer: PPxMixer; i: Integer ): PChar; cdecl; external LibName; + +{* + Master (output) volume +*} + +function Px_GetMasterVolume( mixer: PPxMixer ): TPxVolume; cdecl; external LibName; +procedure Px_SetMasterVolume( mixer: PPxMixer; volume: TPxVolume ); cdecl; external LibName; + +{* + Main output volume +*} + +function Px_GetPCMOutputVolume( mixer: PPxMixer ): TPxVolume; cdecl; external LibName; +procedure Px_SetPCMOutputVolume( mixer: PPxMixer; volume: TPxVolume ); cdecl; external LibName; +function Px_SupportsPCMOutputVolume( mixer: PPxMixer ): Integer; cdecl; external LibName; + +{* + All output volumes +*} + +function Px_GetNumOutputVolumes( mixer: PPxMixer ): Integer; cdecl; external LibName; +function Px_GetOutputVolumeName( mixer: PPxMixer; i: Integer ): PChar; cdecl; external LibName; +function Px_GetOutputVolume( mixer: PPxMixer; i: Integer ): TPxVolume; cdecl; external LibName; +procedure Px_SetOutputVolume( mixer: PPxMixer; i: Integer; volume: TPxVolume ); cdecl; external LibName; + +{* + Input source +*} + +function Px_GetNumInputSources( mixer: PPxMixer ): Integer; cdecl; external LibName; +function Px_GetInputSourceName( mixer: PPxMixer; i: Integer): PChar; cdecl; external LibName; +function Px_GetCurrentInputSource( mixer: PPxMixer ): Integer; cdecl; external LibName; {* may return -1 == none *} +procedure Px_SetCurrentInputSource( mixer: PPxMixer; i: Integer ); cdecl; external LibName; + +{* + Input volume +*} + +function Px_GetInputVolume( mixer: PPxMixer ): TPxVolume; cdecl; external LibName; +procedure Px_SetInputVolume( mixer: PPxMixer; volume: TPxVolume ); cdecl; external LibName; + +{* + Balance +*} + +function Px_SupportsOutputBalance( mixer: PPxMixer ): Integer; cdecl; external LibName; +function Px_GetOutputBalance( mixer: PPxMixer ): TPxBalance; cdecl; external LibName; +procedure Px_SetOutputBalance( mixer: PPxMixer; balance: TPxBalance ); cdecl; external LibName; + +{* + Playthrough +*} + +function Px_SupportsPlaythrough( mixer: PPxMixer ): Integer; cdecl; external LibName; +function Px_GetPlaythrough( mixer: PPxMixer ): TPxVolume; cdecl; external LibName; +procedure Px_SetPlaythrough( mixer: PPxMixer; volume: TPxVolume ); cdecl; external LibName; + +implementation + +end. -- cgit v1.2.3 From 4486047d353396029848e94d43cb1459ab8f82d6 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 5 Dec 2007 20:18:40 +0000 Subject: bugfix: changed sqlite3.dll to SQLiteDLL (which was never used) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@662 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/SQLite/SQLite3.pas | 398 +++++++++++++++++++-------------------- 1 file changed, 199 insertions(+), 199 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/lib/SQLite/SQLite3.pas b/Game/Code/lib/SQLite/SQLite3.pas index 4991fc66..f1b03e08 100644 --- a/Game/Code/lib/SQLite/SQLite3.pas +++ b/Game/Code/lib/SQLite/SQLite3.pas @@ -1,199 +1,199 @@ -unit SQLite3; - -{ - Simplified interface for SQLite. - Updated for Sqlite 3 by Tim Anderson (tim@itwriting.com) - Note: NOT COMPLETE for version 3, just minimal functionality - Adapted from file created by Pablo Pissanetzky (pablo@myhtpc.net) - which was based on SQLite.pas by Ben Hochstrasser (bhoc@surfeu.ch) -} - -interface - -{$I switches.inc} - -const - -{$IFDEF MSWINDOWS} - SQLiteDLL = 'sqlite3.dll'; -{$ENDIF} -{$IFDEF LINUX} - SQLiteDLL = 'sqlite3.so'; -{$ENDIF} -{$IFDEF DARWIN} - SQLiteDLL = 'libsqlite3.dylib'; -{$ENDIF} - -// Return values for sqlite3_exec() and sqlite3_step() - - SQLITE_OK = 0; // Successful result - SQLITE_ERROR = 1; // SQL error or missing database - SQLITE_INTERNAL = 2; // An internal logic error in SQLite - SQLITE_PERM = 3; // Access permission denied - SQLITE_ABORT = 4; // Callback routine requested an abort - SQLITE_BUSY = 5; // The database file is locked - SQLITE_LOCKED = 6; // A table in the database is locked - SQLITE_NOMEM = 7; // A malloc() failed - SQLITE_READONLY = 8; // Attempt to write a readonly database - SQLITE_INTERRUPT = 9; // Operation terminated by sqlite3_interrupt() - SQLITE_IOERR = 10; // Some kind of disk I/O error occurred - SQLITE_CORRUPT = 11; // The database disk image is malformed - SQLITE_NOTFOUND = 12; // (Internal Only) Table or record not found - SQLITE_FULL = 13; // Insertion failed because database is full - SQLITE_CANTOPEN = 14; // Unable to open the database file - SQLITE_PROTOCOL = 15; // Database lock protocol error - SQLITE_EMPTY = 16; // Database is empty - SQLITE_SCHEMA = 17; // The database schema changed - SQLITE_TOOBIG = 18; // Too much data for one row of a table - SQLITE_CONSTRAINT = 19; // Abort due to contraint violation - SQLITE_MISMATCH = 20; // Data type mismatch - SQLITE_MISUSE = 21; // Library used incorrectly - SQLITE_NOLFS = 22; // Uses OS features not supported on host - SQLITE_AUTH = 23; // Authorization denied - SQLITE_FORMAT = 24; // Auxiliary database format error - SQLITE_RANGE = 25; // 2nd parameter to sqlite3_bind out of range - SQLITE_NOTADB = 26; // File opened that is not a database file - SQLITE_ROW = 100; // sqlite3_step() has another row ready - SQLITE_DONE = 101; // sqlite3_step() has finished executing - - SQLITE_INTEGER = 1; - SQLITE_FLOAT = 2; - SQLITE_TEXT = 3; - SQLITE_BLOB = 4; - SQLITE_NULL = 5; - -type - TSQLiteDB = Pointer; - TSQLiteResult = ^PChar; - TSQLiteStmt = Pointer; - -function SQLite3_Open(dbname: PChar; var db: TSqliteDB): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_open'; -function SQLite3_Close(db: TSQLiteDB): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_close'; -function SQLite3_Exec(db: TSQLiteDB; SQLStatement: PChar; CallbackPtr: Pointer; Sender: TObject; var ErrMsg: PChar): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_exec'; -function SQLite3_Version(): PChar; cdecl; external 'sqlite3.dll' name 'sqlite3_libversion'; -function SQLite3_ErrMsg(db: TSQLiteDB): PChar; cdecl; external 'sqlite3.dll' name 'sqlite3_errmsg'; -function SQLite3_ErrCode(db: TSQLiteDB): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_errcode'; -procedure SQlite3_Free(P: PChar); cdecl; external 'sqlite3.dll' name 'sqlite3_free'; -function SQLite3_GetTable(db: TSQLiteDB; SQLStatement: PChar; var ResultPtr: TSQLiteResult; var RowCount: Cardinal; var ColCount: Cardinal; var ErrMsg: PChar): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_get_table'; -procedure SQLite3_FreeTable(Table: TSQLiteResult); cdecl; external 'sqlite3.dll' name 'sqlite3_free_table'; -function SQLite3_Complete(P: PChar): boolean; cdecl; external 'sqlite3.dll' name 'sqlite3_complete'; -function SQLite3_LastInsertRowID(db: TSQLiteDB): int64; cdecl; external 'sqlite3.dll' name 'sqlite3_last_insert_rowid'; -procedure SQLite3_Interrupt(db: TSQLiteDB); cdecl; external 'sqlite3.dll' name 'sqlite3_interrupt'; -procedure SQLite3_BusyHandler(db: TSQLiteDB; CallbackPtr: Pointer; Sender: TObject); cdecl; external 'sqlite3.dll' name 'sqlite3_busy_handler'; -procedure SQLite3_BusyTimeout(db: TSQLiteDB; TimeOut: integer); cdecl; external 'sqlite3.dll' name 'sqlite3_busy_timeout'; -function SQLite3_Changes(db: TSQLiteDB): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_changes'; -function SQLite3_TotalChanges(db: TSQLiteDB): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_total_changes'; -function SQLite3_Prepare(db: TSQLiteDB; SQLStatement: PChar; nBytes: integer; var hStmt: TSqliteStmt; var pzTail: PChar): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_prepare'; -function SQLite3_ColumnCount(hStmt: TSqliteStmt): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_column_count'; -function Sqlite3_ColumnName(hStmt: TSqliteStmt; ColNum: integer): pchar; cdecl; external 'sqlite3.dll' name 'sqlite3_column_name'; -function Sqlite3_ColumnDeclType(hStmt: TSqliteStmt; ColNum: integer): pchar; cdecl; external 'sqlite3.dll' name 'sqlite3_column_decltype'; -function Sqlite3_Step(hStmt: TSqliteStmt): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_step'; -function SQLite3_DataCount(hStmt: TSqliteStmt): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_data_count'; - -function Sqlite3_ColumnBlob(hStmt: TSqliteStmt; ColNum: integer): pointer; cdecl; external 'sqlite3.dll' name 'sqlite3_column_blob'; -function Sqlite3_ColumnBytes(hStmt: TSqliteStmt; ColNum: integer): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_column_bytes'; -function Sqlite3_ColumnDouble(hStmt: TSqliteStmt; ColNum: integer): double; cdecl; external 'sqlite3.dll' name 'sqlite3_column_double'; -function Sqlite3_ColumnInt(hStmt: TSqliteStmt; ColNum: integer): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_column_int'; -function Sqlite3_ColumnText(hStmt: TSqliteStmt; ColNum: integer): pchar; cdecl; external 'sqlite3.dll' name 'sqlite3_column_text'; -function Sqlite3_ColumnType(hStmt: TSqliteStmt; ColNum: integer): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_column_type'; -function Sqlite3_ColumnInt64(hStmt: TSqliteStmt; ColNum: integer): Int64; cdecl; external 'sqlite3.dll' name 'sqlite3_column_int64'; -function SQLite3_Finalize(hStmt: TSqliteStmt): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_finalize'; -function SQLite3_Reset(hStmt: TSqliteStmt): integer; cdecl; external 'sqlite3.dll' name 'sqlite3_reset'; - -// -// In the SQL strings input to sqlite3_prepare() and sqlite3_prepare16(), -// one or more literals can be replace by a wildcard "?" or ":N:" where -// N is an integer. These value of these wildcard literals can be set -// using the routines listed below. -// -// In every case, the first parameter is a pointer to the sqlite3_stmt -// structure returned from sqlite3_prepare(). The second parameter is the -// index of the wildcard. The first "?" has an index of 1. ":N:" wildcards -// use the index N. -// - // The fifth parameter to sqlite3_bind_blob(), sqlite3_bind_text(), and - //sqlite3_bind_text16() is a destructor used to dispose of the BLOB or -//text after SQLite has finished with it. If the fifth argument is the -// special value SQLITE_STATIC, then the library assumes that the information -// is in static, unmanaged space and does not need to be freed. If the -// fifth argument has the value SQLITE_TRANSIENT, then SQLite makes its -// own private copy of the data. -// -// The sqlite3_bind_* routine must be called before sqlite3_step() after -// an sqlite3_prepare() or sqlite3_reset(). Unbound wildcards are interpreted -// as NULL. -// - -function SQLite3_BindBlob(hStmt: TSqliteStmt; ParamNum: integer; - ptrData: pointer; numBytes: integer; ptrDestructor: pointer): integer; -cdecl; external 'sqlite3.dll' name 'sqlite3_bind_blob'; - -function SQLiteFieldType(SQLiteFieldTypeCode: Integer): AnsiString; -function SQLiteErrorStr(SQLiteErrorCode: Integer): AnsiString; - -implementation - -uses - SysUtils; - -function SQLiteFieldType(SQLiteFieldTypeCode: Integer): AnsiString; -begin - case SQLiteFieldTypeCode of - SQLITE_INTEGER: Result := 'Integer'; - SQLITE_FLOAT: Result := 'Float'; - SQLITE_TEXT: Result := 'Text'; - SQLITE_BLOB: Result := 'Blob'; - SQLITE_NULL: Result := 'Null'; - else - Result := 'Unknown SQLite Field Type Code "' + IntToStr(SQLiteFieldTypeCode) + '"'; - end; -end; - -function SQLiteErrorStr(SQLiteErrorCode: Integer): AnsiString; -begin - case SQLiteErrorCode of - SQLITE_OK: Result := 'Successful result'; - SQLITE_ERROR: Result := 'SQL error or missing database'; - SQLITE_INTERNAL: Result := 'An internal logic error in SQLite'; - SQLITE_PERM: Result := 'Access permission denied'; - SQLITE_ABORT: Result := 'Callback routine requested an abort'; - SQLITE_BUSY: Result := 'The database file is locked'; - SQLITE_LOCKED: Result := 'A table in the database is locked'; - SQLITE_NOMEM: Result := 'A malloc() failed'; - SQLITE_READONLY: Result := 'Attempt to write a readonly database'; - SQLITE_INTERRUPT: Result := 'Operation terminated by sqlite3_interrupt()'; - SQLITE_IOERR: Result := 'Some kind of disk I/O error occurred'; - SQLITE_CORRUPT: Result := 'The database disk image is malformed'; - SQLITE_NOTFOUND: Result := '(Internal Only) Table or record not found'; - SQLITE_FULL: Result := 'Insertion failed because database is full'; - SQLITE_CANTOPEN: Result := 'Unable to open the database file'; - SQLITE_PROTOCOL: Result := 'Database lock protocol error'; - SQLITE_EMPTY: Result := 'Database is empty'; - SQLITE_SCHEMA: Result := 'The database schema changed'; - SQLITE_TOOBIG: Result := 'Too much data for one row of a table'; - SQLITE_CONSTRAINT: Result := 'Abort due to contraint violation'; - SQLITE_MISMATCH: Result := 'Data type mismatch'; - SQLITE_MISUSE: Result := 'Library used incorrectly'; - SQLITE_NOLFS: Result := 'Uses OS features not supported on host'; - SQLITE_AUTH: Result := 'Authorization denied'; - SQLITE_FORMAT: Result := 'Auxiliary database format error'; - SQLITE_RANGE: Result := '2nd parameter to sqlite3_bind out of range'; - SQLITE_NOTADB: Result := 'File opened that is not a database file'; - SQLITE_ROW: Result := 'sqlite3_step() has another row ready'; - SQLITE_DONE: Result := 'sqlite3_step() has finished executing'; - else - Result := 'Unknown SQLite Error Code "' + IntToStr(SQLiteErrorCode) + '"'; - end; -end; - -function ColValueToStr(Value: PChar): AnsiString; -begin - if (Value = nil) then - Result := 'NULL' - else - Result := Value; -end; - - -end. - +unit SQLite3; + +{ + Simplified interface for SQLite. + Updated for Sqlite 3 by Tim Anderson (tim@itwriting.com) + Note: NOT COMPLETE for version 3, just minimal functionality + Adapted from file created by Pablo Pissanetzky (pablo@myhtpc.net) + which was based on SQLite.pas by Ben Hochstrasser (bhoc@surfeu.ch) +} + +interface + +{$I switches.inc} + +const + +{$IFDEF MSWINDOWS} + SQLiteDLL = 'sqlite3.dll'; +{$ENDIF} +{$IFDEF LINUX} + SQLiteDLL = 'sqlite3.so'; +{$ENDIF} +{$IFDEF DARWIN} + SQLiteDLL = 'libsqlite3.dylib'; +{$ENDIF} + +// Return values for sqlite3_exec() and sqlite3_step() + + SQLITE_OK = 0; // Successful result + SQLITE_ERROR = 1; // SQL error or missing database + SQLITE_INTERNAL = 2; // An internal logic error in SQLite + SQLITE_PERM = 3; // Access permission denied + SQLITE_ABORT = 4; // Callback routine requested an abort + SQLITE_BUSY = 5; // The database file is locked + SQLITE_LOCKED = 6; // A table in the database is locked + SQLITE_NOMEM = 7; // A malloc() failed + SQLITE_READONLY = 8; // Attempt to write a readonly database + SQLITE_INTERRUPT = 9; // Operation terminated by sqlite3_interrupt() + SQLITE_IOERR = 10; // Some kind of disk I/O error occurred + SQLITE_CORRUPT = 11; // The database disk image is malformed + SQLITE_NOTFOUND = 12; // (Internal Only) Table or record not found + SQLITE_FULL = 13; // Insertion failed because database is full + SQLITE_CANTOPEN = 14; // Unable to open the database file + SQLITE_PROTOCOL = 15; // Database lock protocol error + SQLITE_EMPTY = 16; // Database is empty + SQLITE_SCHEMA = 17; // The database schema changed + SQLITE_TOOBIG = 18; // Too much data for one row of a table + SQLITE_CONSTRAINT = 19; // Abort due to contraint violation + SQLITE_MISMATCH = 20; // Data type mismatch + SQLITE_MISUSE = 21; // Library used incorrectly + SQLITE_NOLFS = 22; // Uses OS features not supported on host + SQLITE_AUTH = 23; // Authorization denied + SQLITE_FORMAT = 24; // Auxiliary database format error + SQLITE_RANGE = 25; // 2nd parameter to sqlite3_bind out of range + SQLITE_NOTADB = 26; // File opened that is not a database file + SQLITE_ROW = 100; // sqlite3_step() has another row ready + SQLITE_DONE = 101; // sqlite3_step() has finished executing + + SQLITE_INTEGER = 1; + SQLITE_FLOAT = 2; + SQLITE_TEXT = 3; + SQLITE_BLOB = 4; + SQLITE_NULL = 5; + +type + TSQLiteDB = Pointer; + TSQLiteResult = ^PChar; + TSQLiteStmt = Pointer; + +function SQLite3_Open(dbname: PChar; var db: TSqliteDB): integer; cdecl; external SQLiteDLL name 'sqlite3_open'; +function SQLite3_Close(db: TSQLiteDB): integer; cdecl; external SQLiteDLL name 'sqlite3_close'; +function SQLite3_Exec(db: TSQLiteDB; SQLStatement: PChar; CallbackPtr: Pointer; Sender: TObject; var ErrMsg: PChar): integer; cdecl; external SQLiteDLL name 'sqlite3_exec'; +function SQLite3_Version(): PChar; cdecl; external SQLiteDLL name 'sqlite3_libversion'; +function SQLite3_ErrMsg(db: TSQLiteDB): PChar; cdecl; external SQLiteDLL name 'sqlite3_errmsg'; +function SQLite3_ErrCode(db: TSQLiteDB): integer; cdecl; external SQLiteDLL name 'sqlite3_errcode'; +procedure SQlite3_Free(P: PChar); cdecl; external SQLiteDLL name 'sqlite3_free'; +function SQLite3_GetTable(db: TSQLiteDB; SQLStatement: PChar; var ResultPtr: TSQLiteResult; var RowCount: Cardinal; var ColCount: Cardinal; var ErrMsg: PChar): integer; cdecl; external SQLiteDLL name 'sqlite3_get_table'; +procedure SQLite3_FreeTable(Table: TSQLiteResult); cdecl; external SQLiteDLL name 'sqlite3_free_table'; +function SQLite3_Complete(P: PChar): boolean; cdecl; external SQLiteDLL name 'sqlite3_complete'; +function SQLite3_LastInsertRowID(db: TSQLiteDB): int64; cdecl; external SQLiteDLL name 'sqlite3_last_insert_rowid'; +procedure SQLite3_Interrupt(db: TSQLiteDB); cdecl; external SQLiteDLL name 'sqlite3_interrupt'; +procedure SQLite3_BusyHandler(db: TSQLiteDB; CallbackPtr: Pointer; Sender: TObject); cdecl; external SQLiteDLL name 'sqlite3_busy_handler'; +procedure SQLite3_BusyTimeout(db: TSQLiteDB; TimeOut: integer); cdecl; external SQLiteDLL name 'sqlite3_busy_timeout'; +function SQLite3_Changes(db: TSQLiteDB): integer; cdecl; external SQLiteDLL name 'sqlite3_changes'; +function SQLite3_TotalChanges(db: TSQLiteDB): integer; cdecl; external SQLiteDLL name 'sqlite3_total_changes'; +function SQLite3_Prepare(db: TSQLiteDB; SQLStatement: PChar; nBytes: integer; var hStmt: TSqliteStmt; var pzTail: PChar): integer; cdecl; external SQLiteDLL name 'sqlite3_prepare'; +function SQLite3_ColumnCount(hStmt: TSqliteStmt): integer; cdecl; external SQLiteDLL name 'sqlite3_column_count'; +function Sqlite3_ColumnName(hStmt: TSqliteStmt; ColNum: integer): pchar; cdecl; external SQLiteDLL name 'sqlite3_column_name'; +function Sqlite3_ColumnDeclType(hStmt: TSqliteStmt; ColNum: integer): pchar; cdecl; external SQLiteDLL name 'sqlite3_column_decltype'; +function Sqlite3_Step(hStmt: TSqliteStmt): integer; cdecl; external SQLiteDLL name 'sqlite3_step'; +function SQLite3_DataCount(hStmt: TSqliteStmt): integer; cdecl; external SQLiteDLL name 'sqlite3_data_count'; + +function Sqlite3_ColumnBlob(hStmt: TSqliteStmt; ColNum: integer): pointer; cdecl; external SQLiteDLL name 'sqlite3_column_blob'; +function Sqlite3_ColumnBytes(hStmt: TSqliteStmt; ColNum: integer): integer; cdecl; external SQLiteDLL name 'sqlite3_column_bytes'; +function Sqlite3_ColumnDouble(hStmt: TSqliteStmt; ColNum: integer): double; cdecl; external SQLiteDLL name 'sqlite3_column_double'; +function Sqlite3_ColumnInt(hStmt: TSqliteStmt; ColNum: integer): integer; cdecl; external SQLiteDLL name 'sqlite3_column_int'; +function Sqlite3_ColumnText(hStmt: TSqliteStmt; ColNum: integer): pchar; cdecl; external SQLiteDLL name 'sqlite3_column_text'; +function Sqlite3_ColumnType(hStmt: TSqliteStmt; ColNum: integer): integer; cdecl; external SQLiteDLL name 'sqlite3_column_type'; +function Sqlite3_ColumnInt64(hStmt: TSqliteStmt; ColNum: integer): Int64; cdecl; external SQLiteDLL name 'sqlite3_column_int64'; +function SQLite3_Finalize(hStmt: TSqliteStmt): integer; cdecl; external SQLiteDLL name 'sqlite3_finalize'; +function SQLite3_Reset(hStmt: TSqliteStmt): integer; cdecl; external SQLiteDLL name 'sqlite3_reset'; + +// +// In the SQL strings input to sqlite3_prepare() and sqlite3_prepare16(), +// one or more literals can be replace by a wildcard "?" or ":N:" where +// N is an integer. These value of these wildcard literals can be set +// using the routines listed below. +// +// In every case, the first parameter is a pointer to the sqlite3_stmt +// structure returned from sqlite3_prepare(). The second parameter is the +// index of the wildcard. The first "?" has an index of 1. ":N:" wildcards +// use the index N. +// + // The fifth parameter to sqlite3_bind_blob(), sqlite3_bind_text(), and + //sqlite3_bind_text16() is a destructor used to dispose of the BLOB or +//text after SQLite has finished with it. If the fifth argument is the +// special value SQLITE_STATIC, then the library assumes that the information +// is in static, unmanaged space and does not need to be freed. If the +// fifth argument has the value SQLITE_TRANSIENT, then SQLite makes its +// own private copy of the data. +// +// The sqlite3_bind_* routine must be called before sqlite3_step() after +// an sqlite3_prepare() or sqlite3_reset(). Unbound wildcards are interpreted +// as NULL. +// + +function SQLite3_BindBlob(hStmt: TSqliteStmt; ParamNum: integer; + ptrData: pointer; numBytes: integer; ptrDestructor: pointer): integer; +cdecl; external SQLiteDLL name 'sqlite3_bind_blob'; + +function SQLiteFieldType(SQLiteFieldTypeCode: Integer): AnsiString; +function SQLiteErrorStr(SQLiteErrorCode: Integer): AnsiString; + +implementation + +uses + SysUtils; + +function SQLiteFieldType(SQLiteFieldTypeCode: Integer): AnsiString; +begin + case SQLiteFieldTypeCode of + SQLITE_INTEGER: Result := 'Integer'; + SQLITE_FLOAT: Result := 'Float'; + SQLITE_TEXT: Result := 'Text'; + SQLITE_BLOB: Result := 'Blob'; + SQLITE_NULL: Result := 'Null'; + else + Result := 'Unknown SQLite Field Type Code "' + IntToStr(SQLiteFieldTypeCode) + '"'; + end; +end; + +function SQLiteErrorStr(SQLiteErrorCode: Integer): AnsiString; +begin + case SQLiteErrorCode of + SQLITE_OK: Result := 'Successful result'; + SQLITE_ERROR: Result := 'SQL error or missing database'; + SQLITE_INTERNAL: Result := 'An internal logic error in SQLite'; + SQLITE_PERM: Result := 'Access permission denied'; + SQLITE_ABORT: Result := 'Callback routine requested an abort'; + SQLITE_BUSY: Result := 'The database file is locked'; + SQLITE_LOCKED: Result := 'A table in the database is locked'; + SQLITE_NOMEM: Result := 'A malloc() failed'; + SQLITE_READONLY: Result := 'Attempt to write a readonly database'; + SQLITE_INTERRUPT: Result := 'Operation terminated by sqlite3_interrupt()'; + SQLITE_IOERR: Result := 'Some kind of disk I/O error occurred'; + SQLITE_CORRUPT: Result := 'The database disk image is malformed'; + SQLITE_NOTFOUND: Result := '(Internal Only) Table or record not found'; + SQLITE_FULL: Result := 'Insertion failed because database is full'; + SQLITE_CANTOPEN: Result := 'Unable to open the database file'; + SQLITE_PROTOCOL: Result := 'Database lock protocol error'; + SQLITE_EMPTY: Result := 'Database is empty'; + SQLITE_SCHEMA: Result := 'The database schema changed'; + SQLITE_TOOBIG: Result := 'Too much data for one row of a table'; + SQLITE_CONSTRAINT: Result := 'Abort due to contraint violation'; + SQLITE_MISMATCH: Result := 'Data type mismatch'; + SQLITE_MISUSE: Result := 'Library used incorrectly'; + SQLITE_NOLFS: Result := 'Uses OS features not supported on host'; + SQLITE_AUTH: Result := 'Authorization denied'; + SQLITE_FORMAT: Result := 'Auxiliary database format error'; + SQLITE_RANGE: Result := '2nd parameter to sqlite3_bind out of range'; + SQLITE_NOTADB: Result := 'File opened that is not a database file'; + SQLITE_ROW: Result := 'sqlite3_step() has another row ready'; + SQLITE_DONE: Result := 'sqlite3_step() has finished executing'; + else + Result := 'Unknown SQLite Error Code "' + IntToStr(SQLiteErrorCode) + '"'; + end; +end; + +function ColValueToStr(Value: PChar): AnsiString; +begin + if (Value = nil) then + Result := 'NULL' + else + Result := Value; +end; + + +end. + -- cgit v1.2.3 From 1faf3afc9b8c30c47a3f3d6a92ff0b4b18cddefd Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 5 Dec 2007 20:35:57 +0000 Subject: New portaudio interface added git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@663 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudio_portaudio.pas | 434 +++++++++++++++++++++++++++++++++ 1 file changed, 434 insertions(+) create mode 100644 Game/Code/Classes/UAudio_portaudio.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudio_portaudio.pas b/Game/Code/Classes/UAudio_portaudio.pas new file mode 100644 index 00000000..9ed2107d --- /dev/null +++ b/Game/Code/Classes/UAudio_portaudio.pas @@ -0,0 +1,434 @@ +unit UAudio_Portaudio; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +uses Classes, + {$IFDEF win32} + windows, + {$ENDIF} + Messages, + SysUtils, + {$IFNDEF FPC} + Forms, + {$ENDIF} + portaudio, + {$IFDEF UsePortmixer} + portmixer, + {$ENDIF} + ULog, + UMusic; + +implementation + +uses + {$IFDEF LAZARUS} + lclintf, + {$ENDIF} + URecord, + UIni, + UMain, + UCommon, + UThemes; +{ +type + TPaHostApiIndex = PaHostApiIndex; + TPaDeviceIndex = PaDeviceIndex; + PPaStream = ^PaStreamPtr; + PPaStreamCallbackTimeInfo = ^PaStreamCallbackTimeInfo; + TPaStreamCallbackFlags = PaStreamCallbackFlags; + TPaHostApiTypeId = PaHostApiTypeId; + PPaHostApiInfo = ^PaHostApiInfo; + PPaDeviceInfo = ^PaDeviceInfo; + TPaError = PaError; + TPaStreamParameters = PaStreamParameters; +} +type + TAudio_Portaudio = class( TInterfacedObject, IAudioInput ) + private + function GetPreferredApiIndex(): TPaHostApiIndex; + public + function GetName: String; + procedure InitializeRecord; + + procedure CaptureStart; + procedure CaptureStop; + + procedure CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); + procedure StopCard(Card: byte); + end; + + TPortaudioSoundCard = class(TGenericSoundCard) + RecordStream: PPaStream; + DeviceIndex: TPaDeviceIndex; + end; + +function MicrophoneCallback(input: Pointer; output: Pointer; frameCount: Longword; + timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; + inputDevice: Pointer): Integer; cdecl; forward; + +var + singleton_MusicPortaudio : IAudioInput; + +const + sampleRate: Double = 44100.; + +{* the default API used by Portaudio is the least common denominator + * and might lack efficiency. ApiPreferenceOrder defines the order of + * preferred APIs to use. The first API-type in the list is tried first. If it's + * not available the next is tried, ... + * If none of the preferred APIs was found the default API is used. + * Pascal doesn't permit zero-length static arrays, so you can use paDefaultApi + * as an array's only member if you do not have any preferences. + * paDefaultApi also terminates a preferences list but this is optional. + *} +const + paDefaultApi = -1; +var + ApiPreferenceOrder: +{$IF Defined(WIN32)} + // Note1: Portmixer has no mixer support for paASIO and paWASAPI at the moment + // Note2: Windows Default-API is MME + //array[0..0] of TPaHostApiTypeId = ( paDirectSound, paMME ); + array[0..0] of TPaHostApiTypeId = ( paDirectSound ); +{$ELSEIF Defined(LINUX)} + // Note1: Portmixer has no mixer support for paJACK at the moment + // Note2: Not tested, but ALSA might be better than OSS. + array[0..1] of TPaHostApiTypeId = ( paALSA, paOSS ); +{$ELSEIF Defined(DARWIN)} + // Note: Not tested. + //array[0..0] of TPaHostApiTypeId = ( paCoreAudio ); + array[0..0] of TPaHostApiTypeId = ( paDefaultApi ); +{$ELSE} + array[0..0] of TPaHostApiTypeId = ( paDefaultApi ); +{$IFEND} + +function TAudio_Portaudio.GetName: String; +begin + result := 'Portaudio'; +end; + +function TAudio_Portaudio.GetPreferredApiIndex(): TPaHostApiIndex; +var + i: integer; +begin + result := -1; + + // select preferred sound-API + for i:= 0 to High(ApiPreferenceOrder) do + begin + if(ApiPreferenceOrder[i] <> paDefaultApi) then begin + // check if API is available + result := Pa_HostApiTypeIdToHostApiIndex(ApiPreferenceOrder[i]); + if(result >= 0) then + break; + end; + end; + + // None of the preferred APIs is available -> use default + if(result < 0) then begin + result := Pa_GetDefaultHostApi(); + end; +end; + +// TODO: should be a function with boolean return type +procedure TAudio_Portaudio.InitializeRecord; +var + i: integer; + apiIndex: TPaHostApiIndex; + apiInfo: PPaHostApiInfo; + deviceName: string; + deviceIndex: TPaDeviceIndex; + deviceInfo: PPaDeviceInfo; + inputCnt: integer; + inputName: string; + SC: integer; // soundcard + SCI: integer; // soundcard input + err: TPaError; + errMsg: string; + paSoundCard: TPortaudioSoundCard; + inputParams: TPaStreamParameters; + stream: PPaStream; + {$IFDEF UsePortmixer} + mixer: PPxMixer; + {$ENDIF} +begin + // TODO: call Pa_Terminate() on termination + err := Pa_Initialize(); + if(err <> paNoError) then begin + Log.CriticalError('Portaudio.InitializeRecord: ' + Pa_GetErrorText(err)); + //Log.LogError('Portaudio.InitializeRecord: ' + Pa_GetErrorText(err)); + // result := false; + Exit; + end; + + apiIndex := GetPreferredApiIndex(); + apiInfo := Pa_GetHostApiInfo(apiIndex); + + SC := 0; + + // init array-size to max. input-devices count + SetLength(Recording.SoundCard, apiInfo^.deviceCount); // fix deviceCountL + for i:= 0 to High(Recording.SoundCard) do + begin + // convert API-specific device-index to global index + deviceIndex := Pa_HostApiDeviceIndexToDeviceIndex(apiIndex, i); + deviceInfo := Pa_GetDeviceInfo(deviceIndex); + + // current device is no input device -> skip + if(deviceInfo^.maxInputChannels <= 0) then + continue; + + // TODO: free object on termination + paSoundCard := TPortaudioSoundCard.Create(); + Recording.SoundCard[SC] := paSoundCard; + + // retrieve device-name + deviceName := deviceInfo^.name; + paSoundCard.Description := deviceName; + paSoundCard.DeviceIndex := deviceIndex; + + // setup desired input parameters + with inputParams do begin + device := deviceIndex; + channelCount := 2; + sampleFormat := paInt16; + suggestedLatency := deviceInfo^.defaultLowInputLatency; + hostApiSpecificStreamInfo := nil; + end; + + // check if device supports our input-format + err := Pa_IsFormatSupported(@inputParams, nil, sampleRate); + if(err <> 0) then begin + // format not supported -> skip + errMsg := Pa_GetErrorText(err); + Log.LogError('Portaudio.InitializeRecord, device: "'+ deviceName +'" ' + + '('+ errMsg +')'); + paSoundCard.Free(); + continue; + end; + + // TODO: retry with mono if stereo is not supported + // TODO: retry with input-latency set to 20ms (defaultLowInputLatency might + // not be set correctly in OSS) + + err := Pa_OpenStream(stream, @inputParams, nil, sampleRate, + paFramesPerBufferUnspecified, paNoFlag, @MicrophoneCallback, nil); + if(err <> paNoError) then begin + // unable to open device -> skip + errMsg := Pa_GetErrorText(err); + Log.LogError('Portaudio.InitializeRecord, device: "'+ deviceName +'" ' + + '('+ errMsg +')'); + paSoundCard.Free(); + continue; + end; + + + {$IFDEF UsePortmixer} + + // use default mixer + mixer := Px_OpenMixer(stream, 0); + + // get input count + inputCnt := Px_GetNumInputSources(mixer); + SetLength(paSoundCard.Input, inputCnt); + + // get input names + for SCI := 0 to inputCnt-1 do + begin + inputName := Px_GetInputSourceName(mixer, SCI); + paSoundCard.Input[SCI].Name := inputName; + end; + + Px_CloseMixer(mixer); + + {$ELSE} // !UsePortmixer + + //Pa_StartStream(stream); + // TODO: check if callback was called (this problem may occur on some devices) + //Pa_StopStream(stream); + + Pa_CloseStream(stream); + + // create a standard input source + SetLength(paSoundCard.Input, 1); + paSoundCard.Input[0].Name := 'Standard'; + + {$ENDIF} + + // use default input source + paSoundCard.InputSelected := 0; + + Inc(SC); + end; + + // adjust size to actual input-device count + SetLength(Recording.SoundCard, SC); + + Log.LogStatus('#Soundcards: ' + inttostr(SC), 'Portaudio'); + + { + SoundCard[SC].InputSelected := Mic[Device]; + } +end; + +// TODO: code is used by all IAudioInput implementors +// -> move to a common superclass (TAudioInput_Generic?) +procedure TAudio_Portaudio.CaptureStart; +var + S: integer; + SC: integer; + PlayerLeft, PlayerRight: integer; + CaptureSoundLeft, CaptureSoundRight: TSound; +begin + for S := 0 to High(Recording.Sound) do + Recording.Sound[S].BufferLong[0].Clear; + + for SC := 0 to High(Ini.CardList) do begin + PlayerLeft := Ini.CardList[SC].ChannelL-1; + PlayerRight := Ini.CardList[SC].ChannelR-1; + if PlayerLeft >= PlayersPlay then PlayerLeft := -1; + if PlayerRight >= PlayersPlay then PlayerRight := -1; + if (PlayerLeft > -1) or (PlayerRight > -1) then begin + if (PlayerLeft > -1) then + CaptureSoundLeft := Recording.Sound[PlayerLeft] + else + CaptureSoundLeft := nil; + if (PlayerRight > -1) then + CaptureSoundRight := Recording.Sound[PlayerRight] + else + CaptureSoundRight := nil; + + CaptureCard(SC, CaptureSoundLeft, CaptureSoundRight); + end; + end; +end; + +// TODO: code is used by all IAudioInput implementors +// -> move to a common superclass (TAudioInput_Generic?) +procedure TAudio_Portaudio.CaptureStop; +var + SC: integer; + PlayerLeft: integer; + PlayerRight: integer; +begin + + for SC := 0 to High(Ini.CardList) do begin + PlayerLeft := Ini.CardList[SC].ChannelL-1; + PlayerRight := Ini.CardList[SC].ChannelR-1; + if PlayerLeft >= PlayersPlay then PlayerLeft := -1; + if PlayerRight >= PlayersPlay then PlayerRight := -1; + if (PlayerLeft > -1) or (PlayerRight > -1) then + StopCard(SC); + end; + +end; + +{* + * Portaudio input capture callback. + *} +function MicrophoneCallback(input: Pointer; output: Pointer; frameCount: Longword; + timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; + inputDevice: Pointer): Integer; cdecl; +begin + Recording.HandleMicrophoneData(input, frameCount*4, inputDevice); + result := paContinue; +end; + +{* + * Start input-capturing on Soundcard specified by Card. + * Params: + * Card - soundcard index in Recording.SoundCard array + * CaptureSoundLeft - sound(-buffer) used for left channel capture data + * CaptureSoundRight - sound(-buffer) used for right channel capture data + *} +procedure TAudio_Portaudio.CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); +var + Error: TPaError; + ErrorMsg: string; + inputParams: TPaStreamParameters; + deviceInfo: PPaDeviceInfo; + stream: PPaStream; + paSoundCard: TPortaudioSoundCard; +begin + Log.LogStatus('Cap1', 'Portaudio'); + + paSoundCard := TPortaudioSoundCard(Recording.SoundCard[Card]); + paSoundCard.CaptureSoundLeft := CaptureSoundLeft; + paSoundCard.CaptureSoundRight := CaptureSoundRight; + + // get input latency info + deviceInfo := Pa_GetDeviceInfo(paSoundCard.DeviceIndex); + + // set input stream parameters + with inputParams do begin + device := paSoundCard.DeviceIndex; + channelCount := 2; + sampleFormat := paInt16; + suggestedLatency := deviceInfo^.defaultLowInputLatency; + hostApiSpecificStreamInfo := nil; + end; + + Log.LogStatus(inttostr(paSoundCard.DeviceIndex), 'Portaudio'); + Log.LogStatus(floattostr(deviceInfo^.defaultLowInputLatency), 'Portaudio'); + + // open input stream + Error := Pa_OpenStream(stream, @inputParams, nil, sampleRate, + paFramesPerBufferUnspecified, paNoFlag, + @MicrophoneCallback, Pointer(paSoundCard)); + if(Error <> paNoError) then begin + ErrorMsg := Pa_GetErrorText(Error); + Log.CriticalError('TAudio_Portaudio.CaptureCard('+ IntToStr(Card) +'): Error opening stream: ' + ErrorMsg); + //Halt; + end; + + paSoundCard.RecordStream := stream; + + // start capture + Error := Pa_StartStream(stream); + if(Error <> paNoError) then begin + Pa_CloseStream(stream); + ErrorMsg := Pa_GetErrorText(Error); + Log.CriticalError('TAudio_Portaudio.CaptureCard('+ IntToStr(Card) +'): Error starting stream: ' + ErrorMsg); + //Halt; + end; + + //Readln; + Log.LogStatus('Cap2', 'Portaudio'); +end; + +{* + * Stop input-capturing on Soundcard specified by Card. + * Params: + * Card - soundcard index in Recording.SoundCard array + *} +procedure TAudio_Portaudio.StopCard(Card: byte); +var + stream: PPaStream; + paSoundCard: TPortaudioSoundCard; +begin + paSoundCard := TPortaudioSoundCard(Recording.SoundCard[Card]); + stream := paSoundCard.RecordStream; + if(stream <> nil) then begin + Pa_StopStream(stream); + Pa_CloseStream(stream); + end; +end; + + +initialization + singleton_MusicPortaudio := TAudio_Portaudio.create(); + writeln( 'UAudio_Portaudio - Register' ); + AudioManager.add( singleton_MusicPortaudio ); + +finalization + writeln( 'UAudio_Portaudio - UnRegister' ); + AudioManager.Remove( singleton_MusicPortaudio ); + +end. -- cgit v1.2.3 From d5ecf3a8ca7d6caf21721018bb74c1fa47a83711 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 5 Dec 2007 20:51:57 +0000 Subject: - Sound-Device initialization was moved from URecord to the specific Audio-Interface (Bass/Portaudio) called by InitializeSound(). As TIni.Create needs a filled in Recording.SoundCard array, InitialzeSound() has to be called before TIni.Create. - Sound is now Recording.Sound git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@664 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMain.pas | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 924ef0ab..67ec2ea8 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -191,6 +191,13 @@ begin Log.BenchmarkEnd(1); Log.LogBenchmark('Loading Soundcard list', 1); + // Sound (+ fills Sound Card List) + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Sound', 'Initialization'); + InitializeSound(); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Sound', 1); + // Ini + Paths Log.BenchmarkStart(1); Log.LogStatus('Load Ini', 'Initialization'); @@ -262,7 +269,7 @@ begin Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; - + Log.BenchmarkEnd(1); Log.LogBenchmark('Loading Songs', 1); @@ -281,15 +288,6 @@ begin Log.BenchmarkEnd(1); Log.LogBenchmark('Loading PartySession Manager', 1); } - // Sound - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Sound', 'Initialization'); - InitializeSound(); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Sound', 1); - - // exit; - // Graphics Log.BenchmarkStart(1); Log.LogStatus('Initialize 3D', 'Initialization'); @@ -813,7 +811,7 @@ begin // beep; // On linux we get an AV @ NEWNOTE, line 600 of Classes/UMain.pas - if not assigned( Sound ) then // TODO : JB_Linux ... why is this now not assigned... it was fine a few hours ago.. + if not assigned( Recording.Sound ) then // TODO : JB_Linux ... why is this now not assigned... it was fine a few hours ago.. exit; // analizuje dla obu graczy ten sam sygnal (Sound.OneSrcForBoth) @@ -822,7 +820,7 @@ begin begin // analyze buffer - Sound[CP].AnalizujBufor; + Recording.Sound[CP].AnalizujBufor; // adds some noise // Czas.Ton := Czas.Ton + Round(Random(3)) - 1; @@ -857,7 +855,7 @@ begin // Czas.Ton := 27; // gdy moze, to dodaje nute - if (Sound[CP].SzczytJest) and (Mozna) then begin + if (Recording.Sound[CP].SzczytJest) and (Mozna) then begin // operowanie na ostatniej nucie for Pet := 0 to Czesci[0].Czesc[S].HighNut do if (Czesci[0].Czesc[S].Nuta[Pet].Start <= Czas.OldBeatD+1) @@ -866,10 +864,10 @@ begin // to robi, tylko dla pary nut (oryginalnej i gracza) // przesuwanie tonu w odpowiednia game - while (Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton > 6) do - Sound[CP].Ton := Sound[CP].Ton - 12; - while (Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton < -6) do - Sound[CP].Ton := Sound[CP].Ton + 12; + while (Recording.Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton > 6) do + Recording.Sound[CP].Ton := Recording.Sound[CP].Ton - 12; + while (Recording.Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton < -6) do + Recording.Sound[CP].Ton := Recording.Sound[CP].Ton + 12; // Half size Notes Patch NoteHit := false; @@ -878,8 +876,8 @@ begin //if Ini.Difficulty = 1 then Range := 1; //if Ini.Difficulty = 2 then Range := 0; Range := 2 - Ini.Difficulty; - if abs(Czesci[0].Czesc[S].Nuta[Pet].Ton - Sound[CP].Ton) <= Range then begin - Sound[CP].Ton := Czesci[0].Czesc[S].Nuta[Pet].Ton; + if abs(Czesci[0].Czesc[S].Nuta[Pet].Ton - Recording.Sound[CP].Ton) <= Range then begin + Recording.Sound[CP].Ton := Czesci[0].Czesc[S].Nuta[Pet].Ton; // Half size Notes Patch @@ -919,7 +917,8 @@ begin if S = SMax then begin Nowa := true; // jezeli ostatnia ma ten sam ton - if (Player[CP].IlNut > 0 ) and (Player[CP].Nuta[Player[CP].HighNut].Ton = Sound[CP].Ton) + if (Player[CP].IlNut > 0 ) + and (Player[CP].Nuta[Player[CP].HighNut].Ton = Recording.Sound[CP].Ton) and (Player[CP].Nuta[Player[CP].HighNut].Start + Player[CP].Nuta[Player[CP].HighNut].Dlugosc = Czas.AktBeatD) then Nowa := false; // jezeli jest jakas nowa nuta na sprawdzanym beacie @@ -935,7 +934,7 @@ begin SetLength(Player[CP].Nuta, Player[CP].IlNut); Player[CP].Nuta[Player[CP].HighNut].Start := Czas.AktBeatD; Player[CP].Nuta[Player[CP].HighNut].Dlugosc := 1; - Player[CP].Nuta[Player[CP].HighNut].Ton := Sound[CP].Ton; // Ton || TonDokl + Player[CP].Nuta[Player[CP].HighNut].Ton := Recording.Sound[CP].Ton; // Ton || TonDokl Player[CP].Nuta[Player[CP].HighNut].Detekt := Czas.MidBeat; -- cgit v1.2.3 From a4a3643898a9f566b926bbd5fcc47c24a18be1ab Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 5 Dec 2007 21:11:16 +0000 Subject: Sound is now Recording.Sound git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@665 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 8 ++++---- Game/Code/Classes/ULog.pas | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index efc3494b..c399057b 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -169,10 +169,10 @@ begin; glColor3f(1, 1, 1); } glBegin(GL_LINE_STRIP); - glVertex2f(X, -Sound[NrSound].BufferArray[1] / $10000 * H + Y + H/2); - for Pet := 2 to Sound[NrSound].n div 1 do begin - glVertex2f(X + (Pet-1) * W / (Sound[NrSound].n - 1), - -Sound[NrSound].BufferArray[Pet] / $10000 * H + Y + H/2); + glVertex2f(X, -Recording.Sound[NrSound].BufferArray[1] / $10000 * H + Y + H/2); + for Pet := 2 to Recording.Sound[NrSound].n div 1 do begin + glVertex2f(X + (Pet-1) * W / (Recording.Sound[NrSound].n - 1), + -Recording.Sound[NrSound].BufferArray[Pet] / $10000 * H + Y + H/2); end; glEnd; end; diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index ac08f2d5..50e9bf68 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -214,9 +214,9 @@ begin FS := TFileStream.Create(FileName, fmCreate); - for BL := 0 to High(Sound[SoundNr].BufferLong) do begin - Sound[SoundNr].BufferLong[BL].Seek(0, soBeginning); - FS.CopyFrom(Sound[SoundNr].BufferLong[BL], Sound[SoundNr].BufferLong[BL].Size); + for BL := 0 to High(Recording.Sound[SoundNr].BufferLong) do begin + Recording.Sound[SoundNr].BufferLong[BL].Seek(0, soBeginning); + FS.CopyFrom(Recording.Sound[SoundNr].BufferLong[BL], Recording.Sound[SoundNr].BufferLong[BL].Size); end; FS.Free; -- cgit v1.2.3 From 9ced8826685af3aece39649fb0912780781ab2ae Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 5 Dec 2007 21:19:50 +0000 Subject: - Removed all BASS stuff. BASS initialization is now done in UAudio_bass (or UAudio_portaudio). - Sound moved to Recording.Sound - Removed duplicated unreferenced global Soundcard-array var (which was moved to the TRecord-Class previously but has not been deleted) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@666 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/URecord.pas | 186 ++++++++++++------------------------------ 1 file changed, 52 insertions(+), 134 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/URecord.pas b/Game/Code/Classes/URecord.pas index 29a9d7f9..dee1a687 100644 --- a/Game/Code/Classes/URecord.pas +++ b/Game/Code/Classes/URecord.pas @@ -11,9 +11,6 @@ interface uses Classes, Math, SysUtils, - {$IFDEF useBASS} - bass, - {$ENDIF} UCommon, UMusic, UIni; @@ -46,32 +43,31 @@ type Name: string; end; - TSoundCard = record + TGenericSoundCard = class // here can be the soundcard information - whole database from which user will select recording source - Description: string; - Input: array of TSoundCardInput; - InputSelected: integer; - MicInput: Integer; - - // bass record - BassRecordStream: hStream; + Description: string; // soundcard name/description + Input: array of TSoundCardInput; // soundcard input(-source)s + InputSelected: integer; // unused. What is this good for? + MicInput: integer; // unused. What is this good for? + //SampleRate: integer; // TODO: for sample-rate conversion (for devices that do not support 44.1kHz) + CaptureSoundLeft: TSound; // sound(-buffer) used for left channel capture data + CaptureSoundRight: TSound; // sound(-buffer) used for right channel capture data end; TRecord = class - SoundCard: array of TSoundCard; + Sound: array of TSound; + SoundCard: array of TGenericSoundCard; constructor Create; + + // handle microphone input + procedure HandleMicrophoneData(Buffer: Pointer; Length: Cardinal; + InputDevice: TGenericSoundCard); end; smallintarray = array [0..maxInt shr 1-1] of smallInt; psmallintarray = ^smallintarray; - // procedures - bass record - function GetMicrophone(handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD): boolean; stdcall; - - var - Sound: array of TSound; - SoundCard: array of TSoundCard; Poz: integer; Recording: TRecord; @@ -79,6 +75,10 @@ implementation uses UMain; +// FIXME: Race-Conditions between Callback-thread and main-thread +// on BufferArray (maybe BufferNew also). +// Use SDL-mutexes to solve this problem. + procedure TSound.ProcessNewBuffer; var S: integer; @@ -197,7 +197,17 @@ begin Result := 1 - Count / Il; end; -function GetMicrophone(handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD): boolean; stdcall; +{* + * Handle captured microphone input data. + * Params: + * Buffer - buffer of signed 16bit interleaved stereo PCM-samples. + * Interleaved means that a right-channel sample follows a left- + * channel sample and vice versa (0:left[0],1:right[0],2:left[1],...). + * Length - number of bytes in Buffer + * Input - Soundcard-Input used for capture + *} +procedure TRecord.HandleMicrophoneData(Buffer: Pointer; Length: Cardinal; + InputDevice: TGenericSoundCard); var L: integer; S: integer; @@ -205,8 +215,6 @@ var PSI: psmallintarray; I: integer; Skip: integer; - P1: integer; - P2: integer; Boost: byte; begin // set boost @@ -218,7 +226,7 @@ begin end; // boost buffer - L := Len div 2; // number of samples + L := Length div 2; // number of samples PSI := Buffer; for S := 0 to L-1 do begin @@ -228,139 +236,49 @@ begin PSI^[S] := I; end; - // decode user - P1 := (user and 255) - 1; - P2 := (user div 256) - 1; - - // 2 players USB mic, left channel - if P1 >= 0 then + if InputDevice.CaptureSoundLeft <> nil then begin - L := Len div 4; // number of samples + L := Length div 4; // number of samples PB := Buffer; - Sound[P1].BufferNew.Clear; // 0.5.2: problem on exiting - for S := 1 to L do + InputDevice.CaptureSoundLeft.BufferNew.Clear; // 0.5.2: problem on exiting + for S := 0 to L-1 do begin - Sound[P1].BufferNew.Write(PB[(S-1)*4], 2); + InputDevice.CaptureSoundLeft.BufferNew.Write(PB[S*4], 2); end; - Sound[P1].ProcessNewBuffer; + InputDevice.CaptureSoundLeft.ProcessNewBuffer; end; // 2 players USB mic, right channel Skip := 2; - if P2 >= 0 then + if InputDevice.CaptureSoundRight <> nil then begin - L := Len div 4; // number of samples + L := Length div 4; // number of samples PB := Buffer; - Sound[P2].BufferNew.Clear; - for S := 1 to L do + InputDevice.CaptureSoundRight.BufferNew.Clear; + for S := 0 to L-1 do begin - Sound[P2].BufferNew.Write(PB[Skip + (S-1)*4], 2); + InputDevice.CaptureSoundRight.BufferNew.Write(PB[Skip + S*4], 2); end; - Sound[P2].ProcessNewBuffer; + InputDevice.CaptureSoundRight.ProcessNewBuffer; end; - - Result := true; end; constructor TRecord.Create; var - SC: integer; // soundcard - SCI: integer; // soundcard input - Descr: string; - InputName: PChar; - Flags: integer; - No: integer; - - function isDuplicate(Desc: String): Boolean; - var - I: Integer; - begin - Result := False; - //Check for Soundcard with same Description - For I := 0 to SC-1 do - begin - if (SoundCard[I].Description = Desc) then - begin - Result := True; - Break; - end; - end; - end; - + S: integer; begin - // TODO : JB_linux - Reimplement recording, without bass for linux - {$IFDEF useBASS} - // checks for recording devices and puts them into array; - SetLength(SoundCard, 0); - - SC := 0; - Descr := BASS_RecordGetDeviceDescription(SC); - - while (Descr <> '') do - begin - - //If there is another SoundCard with the Same ID, Search an available Name - if (IsDuplicate(Descr)) then - begin - No:= 1; //Count of SoundCards with same Name - Repeat - Inc(No) - Until not IsDuplicate(Descr + ' (' + InttoStr(No) + ')'); - - //Set Description - Descr := Descr + ' (' + InttoStr(No) + ')'; - end; - - SetLength(SoundCard, SC+1); - - SoundCard[SC].Description := Descr; - - //Get Recording Inputs - SCI := 0; - BASS_RecordInit(SC); - - InputName := BASS_RecordGetInputName(SCI); - - {$IFDEF DARWIN} - // Under MacOSX the SingStar Mics have an empty - // InputName. So, we have to add a hard coded - // Workaround for this problem - if (InputName = nil) and (Pos( 'USBMIC Serial#', Descr) > 0) then - begin - InputName := 'Microphone'; - end; - {$ENDIF} - - SetLength(SoundCard[SC].Input, 1); - SoundCard[SC].Input[SCI].Name := InputName; - - // process each input - while (InputName <> nil) do - begin - Flags := BASS_RecordGetInput(SCI); - if (SCI >= 1) {AND (Flags AND BASS_INPUT_OFF = 0)} then - begin - SetLength(SoundCard[SC].Input, SCI+1); - SoundCard[SC].Input[SCI].Name := InputName; - end; - - //Set Mic Index - if ((Flags and BASS_INPUT_TYPE_MIC) = 1) then - SoundCard[SC].MicInput := SCI; - - Inc(SCI); - InputName := BASS_RecordGetInputName(SCI); - end; - - BASS_RecordFree; - - Inc(SC); - Descr := BASS_RecordGetDeviceDescription(SC); - end; // while - {$ENDIF} + SetLength(Sound, 6 {max players});//Ini.Players+1); + for S := 0 to High(Sound) do begin //Ini.Players do begin + Sound[S] := TSound.Create; + Sound[S].Num := S; + Sound[S].BufferNew := TMemoryStream.Create; + SetLength(Sound[S].BufferLong, 1); + Sound[S].BufferLong[0] := TMemoryStream.Create; + Sound[S].n := 4*1024; + end; end; -- cgit v1.2.3 From 7e4373d4c9d5718f8beb97a28763a68580ad8ea9 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 5 Dec 2007 21:35:23 +0000 Subject: Removed duplicated registration to the AudioManager. Registering once is enough (Casting has no effect here) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@667 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMedia_dummy.pas | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMedia_dummy.pas b/Game/Code/Classes/UMedia_dummy.pas index 0c788677..42a3f1b9 100644 --- a/Game/Code/Classes/UMedia_dummy.pas +++ b/Game/Code/Classes/UMedia_dummy.pas @@ -261,19 +261,11 @@ end; initialization singleton_dummy := Tmedia_dummy.create(); - writeln( 'UMedia_dummy - Register dummy Video_Playback' ); - AudioManager.add( IVideoPlayback( singleton_dummy ) ); + writeln( 'UMedia_dummy - Register' ); + AudioManager.add( singleton_dummy ); - writeln( 'UMedia_dummy - Register dummy Video_Playback' ); - AudioManager.add( IAudioPlayback( singleton_dummy ) ); - - writeln( 'UMedia_dummy - Register dummy Video_Playback' ); - AudioManager.add( IAudioInput( singleton_dummy ) ); - finalization - AudioManager.Remove( IVideoPlayback( singleton_dummy ) ); - AudioManager.Remove( IAudioPlayback( singleton_dummy ) ); - AudioManager.Remove( IAudioInput( singleton_dummy ) ); - + writeln( 'UMedia_dummy - UnRegister' ); + AudioManager.Remove( singleton_dummy ); end. -- cgit v1.2.3 From 80c11b3e86ee826e66640711f11f927472f6ce47 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 5 Dec 2007 21:41:56 +0000 Subject: - Moved GetFFTData from IAudioInput -> IAudioOutput (it is used for the song-selection equalizer not for mic-input) - CaptureCard/StopCard is not visible to public anymore git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@668 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMusic.pas | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index 3fc1136b..feba3f61 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -162,6 +162,9 @@ type //Custom Sounds function LoadCustomSound(const Filename: String): Cardinal; procedure PlayCustomSound(const Index: Cardinal ); + + //Equalizer + function GetFFTData: TFFTData; end; IAudioInput = Interface @@ -171,12 +174,6 @@ type procedure CaptureStart; procedure CaptureStop; - - procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); - procedure StopCard(Card: byte); - - //Equalizer - function GetFFTData: TFFTData; end; -- cgit v1.2.3 From 21e5e8cec6f253ec24b5116b4020dc62bb2a80b1 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 5 Dec 2007 21:48:59 +0000 Subject: - Moved initialization from URecord to UAudio_bass. - Removed duplicate registration at AudioManager - separated input an output functions so input-functionality can be switched on and off with the UseBASSInput define - Removed HWND Windows stuff git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@669 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudio_bass.pas | 1297 ++++++++++++++++++------------------- 1 file changed, 648 insertions(+), 649 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudio_bass.pas b/Game/Code/Classes/UAudio_bass.pas index 9ef3b789..bcf01f92 100644 --- a/Game/Code/Classes/UAudio_bass.pas +++ b/Game/Code/Classes/UAudio_bass.pas @@ -1,649 +1,648 @@ -unit UAudio_bass; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - - -uses Classes, - {$IFDEF win32} - windows, - {$ENDIF} - Messages, - SysUtils, - {$IFNDEF FPC} - Forms, - {$ENDIF} - - bass, - ULog, - UMusic; - -implementation - -uses - {$IFDEF LAZARUS} - lclintf, - {$ENDIF} - URecord, - UIni, - UMain, - UCommon, - UThemes; - -const - RecordSystem = 1; - -type - TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, - mpPaused, mpOpen); - -const - ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); - -type - TAudio_bass = class( TInterfacedObject, IAudioPlayback, IAudioInput ) - private - BassStart: hStream; // Wait, I've replaced this with BASS - BassBack: hStream; // It has almost all features we need - BassSwoosh: hStream; - BassChange: hStream; // Almost? It aleady has them all :) - BassOption: hStream; - BassClick: hStream; - BassDrum: hStream; - BassHihat: hStream; - BassClap: hStream; - BassShuffle: hStream; - - //Custom Sounds - CustomSounds: array of TCustomSoundEntry; - Loaded: boolean; - Loop: boolean; - fHWND: THandle; - - public - Bass: hStream; - function GetName: String; - procedure InitializePlayback; - procedure InitializeRecord; - procedure SetVolume(Volume: integer); - procedure SetMusicVolume(Volume: integer); - procedure SetLoop(Enabled: boolean); - function Open(Name: string): boolean; // true if succeed - procedure Rewind; - procedure MoveTo(Time: real); - procedure Play; - procedure Pause; //Pause Mod - procedure Stop; - procedure Close; - function Finished: boolean; - function Length: real; - function getPosition: real; - procedure PlayStart; - procedure PlayBack; - procedure PlaySwoosh; - procedure PlayChange; - procedure PlayOption; - procedure PlayClick; - procedure PlayDrum; - procedure PlayHihat; - procedure PlayClap; - procedure PlayShuffle; - procedure StopShuffle; - procedure CaptureStart; - procedure CaptureStop; - procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); - procedure StopCard(Card: byte); - function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; - - //Equalizer - function GetFFTData: TFFTData; - - //Custom Sounds - function LoadCustomSound(const Filename: String): Cardinal; - procedure PlayCustomSound(const Index: Cardinal ); -end; - -var - singleton_MusicBass : IAudioPlayback; - -function TAudio_bass.GetName: String; -begin - result := 'BASS'; -end; - -procedure TAudio_bass.InitializePlayback; -var - Pet: integer; - S: integer; -begin - writeln( 'TAudio_bass.InitializePlayback' ); -// Log.BenchmarkStart(4); -// Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); - - Loaded := false; - Loop := false; - - - writeln( 'TAudio_bass AllocateHWND' ); - {$ifdef win32} - // TODO : JB_Linux ... is this needed ? :) - fHWND := AllocateHWND( nil); // TODO : JB_lazarus - can we do something different here ?? lazarus didnt like this function - {$ENDIF} - - - writeln( 'TAudio_bass BASS_Init' ); - // TODO : jb_linux replace with something other than bass - if not BASS_Init(1, 44100, 0, fHWND, nil) then - begin - {$IFNDEF FPC} - // TODO : JB_linux find a way to do this nice.. - Application.MessageBox ('Could not initialize BASS', 'Error'); - {$ENDIF} - Exit; - end; - -// Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); - - // config playing buffer -// BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); -// BASS_SetConfig(BASS_CONFIG_BUFFER, 100); - -// Log.LogStatus('Loading Sounds', 'Music Initialize'); - - writeln( 'TAudio_bass LoadSoundFromFile' ); -// Log.BenchmarkStart(4); - LoadSoundFromFile(BassStart, SoundPath + 'Common Start.mp3'); - LoadSoundFromFile(BassBack, SoundPath + 'Common Back.mp3'); - LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3'); - LoadSoundFromFile(BassChange, SoundPath + 'select music change music 50.mp3'); - LoadSoundFromFile(BassOption, SoundPath + 'option change col.mp3'); - LoadSoundFromFile(BassClick, SoundPath + 'rimshot022b.mp3'); - -// LoadSoundFromFile(BassDrum, SoundPath + 'bassdrumhard076b.mp3'); -// LoadSoundFromFile(BassHihat, SoundPath + 'hihatclosed068b.mp3'); -// LoadSoundFromFile(BassClap, SoundPath + 'claps050b.mp3'); - -// LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3'); - -// Log.BenchmarkEnd(4); -// Log.LogBenchmark('--> Loading Sounds', 4); -end; - -procedure TAudio_bass.InitializeRecord; -var - S: integer; - device: integer; - descr: string; - input: integer; - input2: integer; - flags: integer; - mic: array[0..15] of integer; - SC: integer; // soundcard - SCI: integer; // soundcard input -begin - if RecordSystem = 1 then begin - SetLength(Sound, 6 {max players});//Ini.Players+1); - for S := 0 to High(Sound) do begin //Ini.Players do begin - Sound[S] := TSound.Create; - Sound[S].Num := S; - Sound[S].BufferNew := TMemoryStream.Create; - SetLength(Sound[S].BufferLong, 1); - Sound[S].BufferLong[0] := TMemoryStream.Create; - Sound[S].n := 4*1024; - end; - - - // check for recording devices; - {device := 0; - descr := BASS_RecordGetDeviceDescription(device); - - SetLength(SoundCard, 0); - while (descr <> '') do begin - SC := High(SoundCard) + 1; - SetLength(SoundCard, SC+1); - - Log.LogAnalyze('Device #'+IntToStr(device)+': '+ descr); - SoundCard[SC].Description := Descr; - - // check for recording inputs - mic[device] := -1; // default to no change - input := 0; - BASS_RecordInit(device); - Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); - flags := BASS_RecordGetInput(input); - - SetLength(SoundCard[SC].Input, 0); - while (flags <> -1) do begin - SCI := High(SoundCard[SC].Input) + 1; - SetLength(SoundCard[SC].Input, SCI+1); - - Log.LogAnalyze('Input #' + IntToStr(Input) + ': ' + BASS_RecordGetInputName(input)); - SoundCard[SC].Input[SCI].Name := BASS_RecordGetInputName(Input); - - if (flags and BASS_INPUT_TYPE_MASK) = BASS_INPUT_TYPE_MIC then begin - mic[device] := input; // auto set microphone - end; - Inc(Input); - flags := BASS_RecordGetInput(input); - end; - - if mic[device] <> -1 then begin - Log.LogAnalyze('Found the mic at input ' + IntToStr(Mic[device])) - end else begin - Log.LogAnalyze('Mic not found'); - mic[device] := 0; // setting to the first one (for kxproject) - end; - SoundCard[SC].InputSeleceted := Mic[Device]; - - - BASS_RecordFree; - - inc(Device); - descr := BASS_RecordGetDeviceDescription(Device); - end; // while} - end; // if -end; - -procedure TAudio_bass.SetVolume(Volume: integer); -begin - //Old Sets Wave Volume - //BASS_SetVolume(Volume); - //New: Sets Volume only for this Application - - - // TODO : jb_linux replace with something other than bass - BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); -end; - -procedure TAudio_bass.SetMusicVolume(Volume: Integer); -begin - //Max Volume Prevention - if Volume > 100 then - Volume := 100; - - if Volume < 0 then - Volume := 0; - - - //Set Volume - // TODO : jb_linux replace with something other than bass - BASS_ChannelSetAttributes (Bass, -1, Volume, -101); -end; - -procedure TAudio_bass.SetLoop(Enabled: boolean); -begin - Loop := Enabled; -end; - -function TAudio_bass.Open(Name: string): boolean; -begin - Loaded := false; - if FileExists(Name) then - begin - // TODO : jb_linux replace with something other than bass - Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); - - Loaded := true; - //Set Max Volume - SetMusicVolume (100); - end; - - Result := Loaded; -end; - -procedure TAudio_bass.Rewind; -begin - if Loaded then begin - end; -end; - -procedure TAudio_bass.MoveTo(Time: real); -var - bytes: integer; -begin - // TODO : jb_linux replace with something other than bass - bytes := BASS_ChannelSeconds2Bytes(Bass, Time); - BASS_ChannelSetPosition(Bass, bytes); -end; - -procedure TAudio_bass.Play; -begin - // TODO : jb_linux replace with something other than bass - if Loaded then - begin - if Loop then - BASS_ChannelPlay(Bass, True); // start from beginning... actually bass itself does not loop, nor does this TAudio_bass Class - - BASS_ChannelPlay(Bass, False); // for setting position before playing - end; -end; - -procedure TAudio_bass.Pause; //Pause Mod -begin - // TODO : jb_linux replace with something other than bass - if Loaded then begin - BASS_ChannelPause(Bass); // Pauses Song - end; -end; - -procedure TAudio_bass.Stop; -begin - // TODO : jb_linux replace with something other than bass - Bass_ChannelStop(Bass); -end; - -procedure TAudio_bass.Close; -begin - // TODO : jb_linux replace with something other than bass - Bass_StreamFree(Bass); -end; - -function TAudio_bass.Length: real; -var - bytes: integer; -begin - Result := 60; - - // TODO : jb_linux replace with something other than bass - bytes := BASS_ChannelGetLength(Bass); - Result := BASS_ChannelBytes2Seconds(Bass, bytes); -end; - -function TAudio_bass.getPosition: real; -var - bytes: integer; -begin - Result := 0; - - // TODO : jb_linux replace with something other than bass - bytes := BASS_ChannelGetPosition(BASS); - Result := BASS_ChannelBytes2Seconds(BASS, bytes); -end; - -function TAudio_bass.Finished: boolean; -begin - Result := false; - - // TODO : jb_linux replace with something other than bass - if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then - begin - Result := true; - end; -end; - -procedure TAudio_bass.PlayStart; -begin - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassStart, True); -end; - -procedure TAudio_bass.PlayBack; -begin - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassBack, True);// then -end; - -procedure TAudio_bass.PlaySwoosh; -begin - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassSwoosh, True); -end; - -procedure TAudio_bass.PlayChange; -begin - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassChange, True); -end; - -procedure TAudio_bass.PlayOption; -begin - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassOption, True); -end; - -procedure TAudio_bass.PlayClick; -begin - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassClick, True); -end; - -procedure TAudio_bass.PlayDrum; -begin - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassDrum, True); -end; - -procedure TAudio_bass.PlayHihat; -begin - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassHihat, True); -end; - -procedure TAudio_bass.PlayClap; -begin - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassClap, True); -end; - -procedure TAudio_bass.PlayShuffle; -begin - // TODO : jb_linux replace with something other than bass - BASS_ChannelPlay(BassShuffle, True); -end; - -procedure TAudio_bass.StopShuffle; -begin - // TODO : jb_linux replace with something other than bass - BASS_ChannelStop(BassShuffle); -end; - -procedure TAudio_bass.CaptureStart; -var - S: integer; - SC: integer; - P1: integer; - P2: integer; -begin - for S := 0 to High(Sound) do - Sound[S].BufferLong[0].Clear; - - for SC := 0 to High(Ini.CardList) do begin - P1 := Ini.CardList[SC].ChannelL; - P2 := Ini.CardList[SC].ChannelR; - if P1 > PlayersPlay then P1 := 0; - if P2 > PlayersPlay then P2 := 0; - if (P1 > 0) or (P2 > 0) then - CaptureCard(SC, P1, P2); - end; -end; - -procedure TAudio_bass.CaptureStop; -var - SC: integer; - P1: integer; - P2: integer; -begin - - for SC := 0 to High(Ini.CardList) do begin - P1 := Ini.CardList[SC].ChannelL; - P2 := Ini.CardList[SC].ChannelR; - if P1 > PlayersPlay then P1 := 0; - if P2 > PlayersPlay then P2 := 0; - if (P1 > 0) or (P2 > 0) then StopCard(SC); - end; - -end; - -//procedure TAudio_bass.CaptureCard(RecordI, SoundNum, PlayerLeft, PlayerRight: byte); -procedure TAudio_bass.CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); -var - Error: integer; - ErrorMsg: string; -begin - if not BASS_RecordInit(RecordI) then - begin - Error := BASS_ErrorGetCode; - - ErrorMsg := IntToStr(Error); - if Error = BASS_ERROR_DX then ErrorMsg := 'No DX5'; - if Error = BASS_ERROR_ALREADY then ErrorMsg := 'The device has already been initialized'; - if Error = BASS_ERROR_DEVICE then ErrorMsg := 'The device number specified is invalid'; - if Error = BASS_ERROR_DRIVER then ErrorMsg := 'There is no available device driver'; - - {Log.LogAnalyze('Error initializing record [' + IntToStr(RecordI) + ', ' - + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' - + ErrorMsg);} - Log.LogError('Error initializing record [' + IntToStr(RecordI) + ', ' - + IntToStr(PlayerLeft) + ', '+ IntToStr(PlayerRight) + ']: ' - + ErrorMsg); - Log.LogError('Music -> CaptureCard: Error initializing record: ' + ErrorMsg); - - - end - else - begin - Recording.SoundCard[RecordI].BassRecordStream := BASS_RecordStart(44100, 2, MakeLong(0, 20) , @GetMicrophone, PlayerLeft + PlayerRight*256); - end; -end; - -procedure TAudio_bass.StopCard(Card: byte); -begin - // TODO : jb_linux replace with something other than bass - BASS_RecordSetDevice(Card); - BASS_RecordFree; -end; - -function TAudio_bass.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; -var - L: Integer; -begin - if FileExists(Name) then - begin - Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); - try - // TODO : jb_linux replace with something other than bass - hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); - - //Add CustomSound - L := High(CustomSounds) + 1; - SetLength (CustomSounds, L + 1); - CustomSounds[L].Filename := Name; - CustomSounds[L].Handle := hStream; - except - Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); - end; - end - else - begin - Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); - exit; - end; -end; - -//Equalizer -function TAudio_bass.GetFFTData: TFFTData; -var - Data: TFFTData; -begin - //Get Channel Data Mono and 256 Values - BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); -end; - -function TAudio_bass.LoadCustomSound(const Filename: String): Cardinal; -var - S: hStream; - I: Integer; - F: String; -begin - //Search for Sound in already loaded Sounds - F := UpperCase(SoundPath + FileName); - For I := 0 to High(CustomSounds) do - begin - if (UpperCase(CustomSounds[I].Filename) = F) then - begin - Result := I; - Exit; - end; - end; - - if LoadSoundFromFile(S, SoundPath + Filename) then - Result := High(CustomSounds) - else - Result := 0; -end; - -procedure TAudio_bass.PlayCustomSound(const Index: Cardinal ); -begin - if Index <= High(CustomSounds) then - BASS_ChannelPlay(CustomSounds[Index].Handle, True); -end; - - -{* - -Sorry guys... this is my mess :( -Im going to try and get ffmpeg to handle audio playback ( at least for linux ) -and Im going to implement it nicly along side BASS, in TAudio_bass ( where I can ) - -http://www.dranger.com/ffmpeg/ffmpeg.html -http://www.dranger.com/ffmpeg/ffmpegtutorial_all.html - -http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html - -*} -{* -function TAudio_bass.FFMPeg_StreamCreateFile(abool : boolean; aFileName : pchar ): THandle; -var - lFormatCtx : PAVFormatContext; -begin - -(* - if(SDL_OpenAudio(&wanted_spec, &spec) < 0) - begin - fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError()); - writeln( 'SDL_OpenAudio' ); - exit; - end; -*) - -(* - if ( av_open_input_file( lFormatCtx, aFileName, NULL, 0, NULL ) <> 0 ) - begin - writeln( 'Unable to open file '+ aFileName ); - exit; - end; - - // Retrieve stream information - if ( av_find_stream_info(pFormatCtx) < 0 ) - begin - writeln( 'Unable to Retrieve stream information' ); - exit; - end; -*) - -end; *} - -initialization - singleton_MusicBass := TAudio_bass.create(); - - writeln( 'UAudio_Bass - Register Playback' ); - AudioManager.add( IAudioPlayback( singleton_MusicBass ) ); - - writeln( 'UAudio_Bass - Register Input' ); - AudioManager.add( IAudioInput( singleton_MusicBass ) ); - -finalization - writeln( 'UAudio_Bass - UnRegister Playback' ); - AudioManager.Remove( IAudioPlayback( singleton_MusicBass ) ); - - writeln( 'UAudio_Bass - UnRegister Input' ); - AudioManager.Remove( IAudioInput( singleton_MusicBass ) ); - -end. +unit UAudio_bass; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +uses Classes, + {$IFDEF win32} + windows, + {$ENDIF} + Messages, + SysUtils, + {$IFNDEF FPC} + Forms, + {$ENDIF} + bass, + ULog, + UMusic; + +implementation + +uses + {$IFDEF LAZARUS} + lclintf, + {$ENDIF} + URecord, + UIni, + UMain, + UCommon, + UThemes; + +type + TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, + mpPaused, mpOpen); + +const + ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); + +type +{$IFDEF UseBASSInput} + TAudio_bass = class( TInterfacedObject, IAudioPlayback, IAudioInput) +{$ELSE} + TAudio_bass = class( TInterfacedObject, IAudioPlayback) +{$ENDIF} + private + BassStart: hStream; // Wait, I've replaced this with BASS + BassBack: hStream; // It has almost all features we need + BassSwoosh: hStream; + BassChange: hStream; // Almost? It aleady has them all :) + BassOption: hStream; + BassClick: hStream; + BassDrum: hStream; + BassHihat: hStream; + BassClap: hStream; + BassShuffle: hStream; + + //Custom Sounds + CustomSounds: array of TCustomSoundEntry; + Loaded: boolean; + Loop: boolean; + + public + Bass: hStream; + function GetName: String; + + {IAudioOutput interface} + + procedure InitializePlayback; + procedure SetVolume(Volume: integer); + procedure SetMusicVolume(Volume: integer); + procedure SetLoop(Enabled: boolean); + function Open(Name: string): boolean; // true if succeed + procedure Rewind; + procedure MoveTo(Time: real); + procedure Play; + procedure Pause; //Pause Mod + procedure Stop; + procedure Close; + function Finished: boolean; + function Length: real; + function getPosition: real; + procedure PlayStart; + procedure PlayBack; + procedure PlaySwoosh; + procedure PlayChange; + procedure PlayOption; + procedure PlayClick; + procedure PlayDrum; + procedure PlayHihat; + procedure PlayClap; + procedure PlayShuffle; + procedure StopShuffle; + function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; + + //Equalizer + function GetFFTData: TFFTData; + + //Custom Sounds + function LoadCustomSound(const Filename: String): Cardinal; + procedure PlayCustomSound(const Index: Cardinal ); + + {IAudioInput interface} + {$IFDEF UseBASSInput} + procedure InitializeRecord; + + procedure CaptureStart; + procedure CaptureStop; + procedure CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); + procedure StopCard(Card: byte); + {$ENDIF} + end; + +{$IFDEF UseBASSInput} + TBassSoundCard = class(TGenericSoundCard) + RecordStream: HSTREAM; + end; +{$ENDIF} + + +var + singleton_MusicBass : IAudioPlayback; + +function TAudio_bass.GetName: String; +begin + result := 'BASS'; +end; + +procedure TAudio_bass.InitializePlayback; +var + Pet: integer; + S: integer; +begin + writeln( 'TAudio_bass.InitializePlayback' ); +// Log.BenchmarkStart(4); +// Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); + + Loaded := false; + Loop := false; + + writeln( 'TAudio_bass BASS_Init' ); + if not BASS_Init(1, 44100, 0, 0, nil) then + begin + Log.LogError('Could not initialize BASS', 'Error'); + Exit; + end; + +// Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); + + // config playing buffer +// BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); +// BASS_SetConfig(BASS_CONFIG_BUFFER, 100); + +// Log.LogStatus('Loading Sounds', 'Music Initialize'); + + writeln( 'TAudio_bass LoadSoundFromFile' ); +// Log.BenchmarkStart(4); + LoadSoundFromFile(BassStart, SoundPath + 'Common Start.mp3'); + LoadSoundFromFile(BassBack, SoundPath + 'Common Back.mp3'); + LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3'); + LoadSoundFromFile(BassChange, SoundPath + 'select music change music 50.mp3'); + LoadSoundFromFile(BassOption, SoundPath + 'option change col.mp3'); + LoadSoundFromFile(BassClick, SoundPath + 'rimshot022b.mp3'); + +// LoadSoundFromFile(BassDrum, SoundPath + 'bassdrumhard076b.mp3'); +// LoadSoundFromFile(BassHihat, SoundPath + 'hihatclosed068b.mp3'); +// LoadSoundFromFile(BassClap, SoundPath + 'claps050b.mp3'); + +// LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3'); + +// Log.BenchmarkEnd(4); +// Log.LogBenchmark('--> Loading Sounds', 4); +end; + +procedure TAudio_bass.SetVolume(Volume: integer); +begin + //Old Sets Wave Volume + //BASS_SetVolume(Volume); + //New: Sets Volume only for this Application + + BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); +end; + +procedure TAudio_bass.SetMusicVolume(Volume: Integer); +begin + //Max Volume Prevention + if Volume > 100 then + Volume := 100; + + if Volume < 0 then + Volume := 0; + + + //Set Volume + // TODO : jb_linux replace with something other than bass + BASS_ChannelSetAttributes (Bass, -1, Volume, -101); +end; + +procedure TAudio_bass.SetLoop(Enabled: boolean); +begin + Loop := Enabled; +end; + +function TAudio_bass.Open(Name: string): boolean; +begin + Loaded := false; + if FileExists(Name) then + begin + Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); + + Loaded := true; + //Set Max Volume + SetMusicVolume (100); + end; + + Result := Loaded; +end; + +procedure TAudio_bass.Rewind; +begin + if Loaded then begin + end; +end; + +procedure TAudio_bass.MoveTo(Time: real); +var + bytes: integer; +begin + bytes := BASS_ChannelSeconds2Bytes(Bass, Time); + BASS_ChannelSetPosition(Bass, bytes); +end; + +procedure TAudio_bass.Play; +begin + if Loaded then + begin + if Loop then + BASS_ChannelPlay(Bass, True); // start from beginning... actually bass itself does not loop, nor does this TAudio_bass Class + + BASS_ChannelPlay(Bass, False); // for setting position before playing + end; +end; + +procedure TAudio_bass.Pause; //Pause Mod +begin + if Loaded then begin + BASS_ChannelPause(Bass); // Pauses Song + end; +end; + +procedure TAudio_bass.Stop; +begin + Bass_ChannelStop(Bass); +end; + +procedure TAudio_bass.Close; +begin + Bass_StreamFree(Bass); +end; + +function TAudio_bass.Length: real; +var + bytes: integer; +begin + Result := 60; + + bytes := BASS_ChannelGetLength(Bass); + Result := BASS_ChannelBytes2Seconds(Bass, bytes); +end; + +function TAudio_bass.getPosition: real; +var + bytes: integer; +begin + Result := 0; + + bytes := BASS_ChannelGetPosition(BASS); + Result := BASS_ChannelBytes2Seconds(BASS, bytes); +end; + +function TAudio_bass.Finished: boolean; +begin + Result := false; + + if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then + begin + Result := true; + end; +end; + +procedure TAudio_bass.PlayStart; +begin + BASS_ChannelPlay(BassStart, True); +end; + +procedure TAudio_bass.PlayBack; +begin + BASS_ChannelPlay(BassBack, True);// then +end; + +procedure TAudio_bass.PlaySwoosh; +begin + BASS_ChannelPlay(BassSwoosh, True); +end; + +procedure TAudio_bass.PlayChange; +begin + BASS_ChannelPlay(BassChange, True); +end; + +procedure TAudio_bass.PlayOption; +begin + BASS_ChannelPlay(BassOption, True); +end; + +procedure TAudio_bass.PlayClick; +begin + BASS_ChannelPlay(BassClick, True); +end; + +procedure TAudio_bass.PlayDrum; +begin + BASS_ChannelPlay(BassDrum, True); +end; + +procedure TAudio_bass.PlayHihat; +begin + BASS_ChannelPlay(BassHihat, True); +end; + +procedure TAudio_bass.PlayClap; +begin + BASS_ChannelPlay(BassClap, True); +end; + +procedure TAudio_bass.PlayShuffle; +begin + BASS_ChannelPlay(BassShuffle, True); +end; + +procedure TAudio_bass.StopShuffle; +begin + BASS_ChannelStop(BassShuffle); +end; + +function TAudio_bass.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; +var + L: Integer; +begin + if FileExists(Name) then + begin + Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); + try + hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); + + //Add CustomSound + L := High(CustomSounds) + 1; + SetLength (CustomSounds, L + 1); + CustomSounds[L].Filename := Name; + CustomSounds[L].Handle := hStream; + except + Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); + end; + end + else + begin + Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); + exit; + end; +end; + +//Equalizer +function TAudio_bass.GetFFTData: TFFTData; +var + Data: TFFTData; +begin + //Get Channel Data Mono and 256 Values + BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); +end; + +function TAudio_bass.LoadCustomSound(const Filename: String): Cardinal; +var + S: hStream; + I: Integer; + F: String; +begin + //Search for Sound in already loaded Sounds + F := UpperCase(SoundPath + FileName); + For I := 0 to High(CustomSounds) do + begin + if (UpperCase(CustomSounds[I].Filename) = F) then + begin + Result := I; + Exit; + end; + end; + + if LoadSoundFromFile(S, SoundPath + Filename) then + Result := High(CustomSounds) + else + Result := 0; +end; + +procedure TAudio_bass.PlayCustomSound(const Index: Cardinal ); +begin + if Index <= High(CustomSounds) then + BASS_ChannelPlay(CustomSounds[Index].Handle, True); +end; + +{$IFDEF UseBASSInput} + +procedure TAudio_bass.InitializeRecord; +var + device: integer; + Descr: string; + input: integer; + input2: integer; + InputName: PChar; + Flags: integer; + mic: array[0..15] of integer; + SC: integer; // soundcard + SCI: integer; // soundcard input + No: integer; + +function isDuplicate(Desc: String): Boolean; +var + I: Integer; +begin + Result := False; + //Check for Soundcard with same Description + For I := 0 to SC-1 do + begin + if (Recording.SoundCard[I].Description = Desc) then + begin + Result := True; + Break; + end; + end; +end; + +begin + with Recording do + begin + // checks for recording devices and puts them into an array + SetLength(SoundCard, 0); + + SC := 0; + Descr := BASS_RecordGetDeviceDescription(SC); + + while (Descr <> '') do + begin + //If there is another SoundCard with the Same ID, Search an available Name + if (IsDuplicate(Descr)) then + begin + No:= 1; //Count of SoundCards with same Name + Repeat + Inc(No) + Until not IsDuplicate(Descr + ' (' + InttoStr(No) + ')'); + + //Set Description + Descr := Descr + ' (' + InttoStr(No) + ')'; + end; + + SetLength(SoundCard, SC+1); + + // TODO: free object on termination + SoundCard[SC] := TBassSoundCard.Create(); + SoundCard[SC].Description := Descr; + + //Get Recording Inputs + SCI := 0; + BASS_RecordInit(SC); + + InputName := BASS_RecordGetInputName(SCI); + + {$IFDEF DARWIN} + // Under MacOSX the SingStar Mics have an empty + // InputName. So, we have to add a hard coded + // Workaround for this problem + if (InputName = nil) and (Pos( 'USBMIC Serial#', Descr) > 0) then + begin + InputName := 'Microphone'; + end; + {$ENDIF} + + SetLength(SoundCard[SC].Input, 1); + SoundCard[SC].Input[SCI].Name := InputName; + + // process each input + while (InputName <> nil) do + begin + Flags := BASS_RecordGetInput(SCI); + if (SCI >= 1) {AND (Flags AND BASS_INPUT_OFF = 0)} then + begin + SetLength(SoundCard[SC].Input, SCI+1); + SoundCard[SC].Input[SCI].Name := InputName; + end; + + //Set Mic Index + if ((Flags and BASS_INPUT_TYPE_MIC) = 1) then + SoundCard[SC].MicInput := SCI; + + Inc(SCI); + InputName := BASS_RecordGetInputName(SCI); + end; + + BASS_RecordFree; + + Inc(SC); + Descr := BASS_RecordGetDeviceDescription(SC); + end; // while + end; // with Recording +end; + +// TODO: code is used by all IAudioInput implementors +// -> move to a common superclass (TAudioInput_Generic?) +procedure TAudio_bass.CaptureStart; +var + S: integer; + SC: integer; + PlayerLeft, PlayerRight: integer; + CaptureSoundLeft, CaptureSoundRight: TSound; +begin + for S := 0 to High(Recording.Sound) do + Recording.Sound[S].BufferLong[0].Clear; + + for SC := 0 to High(Ini.CardList) do begin + PlayerLeft := Ini.CardList[SC].ChannelL-1; + PlayerRight := Ini.CardList[SC].ChannelR-1; + if PlayerLeft >= PlayersPlay then PlayerLeft := -1; + if PlayerRight >= PlayersPlay then PlayerRight := -1; + if (PlayerLeft > -1) or (PlayerRight > -1) then begin + if (PlayerLeft > -1) then + CaptureSoundLeft := Recording.Sound[PlayerLeft] + else + CaptureSoundLeft := nil; + if (PlayerRight > -1) then + CaptureSoundRight := Recording.Sound[PlayerRight] + else + CaptureSoundRight := nil; + + CaptureCard(SC, CaptureSoundLeft, CaptureSoundRight); + end; + end; +end; + +// TODO: code is used by all IAudioInput implementors +// -> move to a common superclass (TAudioInput_Generic?) +procedure TAudio_bass.CaptureStop; +var + SC: integer; + PlayerLeft: integer; + PlayerRight: integer; +begin + + for SC := 0 to High(Ini.CardList) do begin + PlayerLeft := Ini.CardList[SC].ChannelL-1; + PlayerRight := Ini.CardList[SC].ChannelR-1; + if PlayerLeft >= PlayersPlay then PlayerLeft := -1; + if PlayerRight >= PlayersPlay then PlayerRight := -1; + if (PlayerLeft > -1) or (PlayerRight > -1) then + StopCard(SC); + end; + +end; + +{* + * Bass input capture callback. + * Params: + * stream - BASS input stream + * buffer - buffer of captured samples + * len - size of buffer in bytes + * user - players associated with left/right channels + *} +function MicrophoneCallback(stream: HSTREAM; buffer: Pointer; + len: Cardinal; Card: Cardinal): boolean; stdcall; +begin + Recording.HandleMicrophoneData(buffer, len, Recording.SoundCard[Card]); + Result := true; +end; + +{* + * Start input-capturing on Soundcard specified by Card. + * Params: + * Card - soundcard index in Recording.SoundCard array + * CaptureSoundLeft - sound(-buffer) used for left channel capture data + * CaptureSoundRight - sound(-buffer) used for right channel capture data + *} +procedure TAudio_bass.CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); +var + Error: integer; + ErrorMsg: string; + bassSoundCard: TBassSoundCard; +begin + if not BASS_RecordInit(Card) then + begin + Error := BASS_ErrorGetCode; + ErrorMsg := IntToStr(Error); + if Error = BASS_ERROR_DX then ErrorMsg := 'No DX5'; + if Error = BASS_ERROR_ALREADY then ErrorMsg := 'The device has already been initialized'; + if Error = BASS_ERROR_DEVICE then ErrorMsg := 'The device number specified is invalid'; + if Error = BASS_ERROR_DRIVER then ErrorMsg := 'There is no available device driver'; + Log.LogError('Error initializing record [' + IntToStr(Card) + ']'); + Log.LogError('TAudio_bass.CaptureCard: Error initializing record: ' + ErrorMsg); + end + else + begin + bassSoundCard := TBassSoundCard(Recording.SoundCard[Card]); + bassSoundCard.CaptureSoundLeft := CaptureSoundLeft; + bassSoundCard.CaptureSoundRight := CaptureSoundRight; + + // capture in 44.1kHz/stereo/16bit and a 20ms callback period + bassSoundCard.RecordStream := + BASS_RecordStart(44100, 2, MakeLong(0, 20) , @MicrophoneCallback, Card); + end; +end; + +{* + * Stop input-capturing on Soundcard specified by Card. + * Params: + * Card - soundcard index in Recording.SoundCard array + *} +procedure TAudio_bass.StopCard(Card: byte); +begin + BASS_RecordSetDevice(Card); + BASS_RecordFree; +end; + +{$ENDIF} + + +initialization + singleton_MusicBass := TAudio_bass.create(); + + writeln( 'UAudio_Bass - Register' ); + AudioManager.add( singleton_MusicBass ); + +finalization + writeln( 'UAudio_Bass - UnRegister' ); + AudioManager.Remove( singleton_MusicBass ); + +end. -- cgit v1.2.3 From dcbfb30a62776ffa128f620235a8bacf6137e0d5 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 5 Dec 2007 21:52:18 +0000 Subject: - bugfix: tried to access array element -1 if video contained no audio-stream git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@670 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UVideo.pas | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index 65dbc0a2..6c9458f9 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -487,7 +487,11 @@ begin writeln( 'VideoStreamIndex : ' + inttostr(VideoStreamIndex) ); writeln( 'AudioStreamIndex : ' + inttostr(AudioStreamIndex) ); end; - aCodecCtx := VideoFormatContext.streams[ AudioStreamIndex ].codec; + // FIXME: AudioStreamIndex is -1 if video has no sound -> memory access error + // Just a temporary workaround for now + aCodecCtx := nil; + if( AudioStreamIndex >= 0) then + aCodecCtx := VideoFormatContext.streams[ AudioStreamIndex ].codec; {$ifdef FFMpegAudio} // This is the audio ffmpeg audio support Jay is working on. @@ -683,11 +687,11 @@ initialization singleton_VideoFFMpeg := TVideoPlayback_ffmpeg.create(); writeln( 'UVideo_FFMpeg - Register Playback' ); - AudioManager.add( IVideoPlayback( singleton_VideoFFMpeg ) ); + AudioManager.add( singleton_VideoFFMpeg ); finalization - AudioManager.Remove( IVideoPlayback( singleton_VideoFFMpeg ) ); + AudioManager.Remove( singleton_VideoFFMpeg ); end. -- cgit v1.2.3 From 0723a3058fd34826251f2dbd8169131863b69df5 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 5 Dec 2007 21:56:25 +0000 Subject: GetFFTData() is an output- and not an input-interface's function git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@671 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 2 +- Game/Code/Screens/UScreenSong.pas | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 7147be2e..d5c9bebc 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -445,7 +445,7 @@ const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),( begin //dis does teh muiwk y0r - Data := AudioInput.GetFFTData; + Data := AudioPlayback.GetFFTData; Log.LogStatus('',' JB-1'); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 8123ef03..0def87ab 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1816,7 +1816,7 @@ begin if (A <> EqualizerTime) then begin EqualizerTime := A; - Data := AudioInput.GetFFTData; + Data := AudioPlayback.GetFFTData; B:=0; Pos := 0; -- cgit v1.2.3 From 47d6da8f4e8eb47e3c9b26b7d231d91f3cebafd0 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 5 Dec 2007 22:03:49 +0000 Subject: - compatibility changes for fpc 2.2.0 and lazarus 0.9.24. Changes are enabled if {$DEFINE LAZARUS_V0924} and/or {$DEFINE FPC_V220} are defined in switches.inc. - this is a very ugly HACK and should be replaced by something different (not in switches.inc and some sort of {$IF FPC_VERSION > VERSION(2, 2, 0)} git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@672 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlatformLinux.pas | 182 ++++++++++++++++++++++------------- Game/Code/Classes/USongs.pas | 2 +- Game/Code/Classes/Ulazjpeg.pas | 31 ++++++ 3 files changed, 148 insertions(+), 67 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlatformLinux.pas b/Game/Code/Classes/UPlatformLinux.pas index 741662cd..8119346e 100644 --- a/Game/Code/Classes/UPlatformLinux.pas +++ b/Game/Code/Classes/UPlatformLinux.pas @@ -1,66 +1,116 @@ -unit UPlatformLinux; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses Classes, UPlatform; - -type - - TPlatformLinux = class(TPlatform) - public - Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override; - end; - -implementation - -uses SysUtils, oldlinux; - -Function TPlatformLinux.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; -var - i : Integer; - TheDir : oldlinux.pdir; - ADirent : oldlinux.pDirent; - Entry : Longint; - info : oldlinux.stat; - lAttrib : integer; -begin - i := 0; - Filter := LowerCase(Filter); - - TheDir := oldlinux.opendir( Dir ); - if Assigned(TheDir) then - repeat - ADirent := oldlinux.ReadDir(TheDir); - - If Assigned(ADirent) and (ADirent^.name <> '.') and (ADirent^.name <> '..') then - begin - lAttrib := FileGetAttr(Dir + ADirent^.name); - if ReturnAllSubDirs and ((lAttrib and faDirectory) <> 0) then - begin - SetLength( Result, i + 1); - Result[i].Name := ADirent^.name; - Result[i].IsDirectory := true; - Result[i].IsFile := false; - i := i + 1; - end - else if (Length(Filter) = 0) or (Pos( Filter, LowerCase(ADirent^.name)) > 0) then - begin - SetLength( Result, i + 1); - Result[i].Name := ADirent^.name; - Result[i].IsDirectory := false; - Result[i].IsFile := true; - i := i + 1; - end; - end; - Until ADirent = nil; - - oldlinux.CloseDir(TheDir); -end; - -end. +unit UPlatformLinux; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses Classes, UPlatform; + +type + + TPlatformLinux = class(TPlatform) + public + Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override; + end; + +implementation + +uses +{$IFNDEF FPC_V220} + oldlinux, +{$ELSE} + BaseUnix, +{$ENDIF} + SysUtils; + +{$IFDEF FPC_V220} +Function TPlatformLinux.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; +var + i : Integer; + TheDir : pDir; + ADirent : pDirent; + Entry : Longint; + //info : oldlinux.stat; + lAttrib : integer; +begin + i := 0; + Filter := LowerCase(Filter); + + TheDir := FpOpenDir( Dir ); + if Assigned(TheDir) then + repeat + ADirent := FpReadDir(TheDir^); + + If Assigned(ADirent) and (ADirent^.d_name <> '.') and (ADirent^.d_name <> '..') then + begin + lAttrib := FileGetAttr(Dir + ADirent^.d_name); + if ReturnAllSubDirs and ((lAttrib and faDirectory) <> 0) then + begin + SetLength( Result, i + 1); + Result[i].Name := ADirent^.d_name; + Result[i].IsDirectory := true; + Result[i].IsFile := false; + i := i + 1; + end + else if (Length(Filter) = 0) or (Pos( Filter, LowerCase(ADirent^.d_name)) > 0) then + begin + SetLength( Result, i + 1); + Result[i].Name := ADirent^.d_name; + Result[i].IsDirectory := false; + Result[i].IsFile := true; + i := i + 1; + end; + end; + Until ADirent = nil; + + FpCloseDir(TheDir^); +end; +{$ELSE} +Function TPlatformLinux.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; +var + i : Integer; + TheDir : oldlinux.pdir; + ADirent : oldlinux.pDirent; + Entry : Longint; + info : oldlinux.stat; + lAttrib : integer; +begin + i := 0; + Filter := LowerCase(Filter); + + TheDir := oldlinux.opendir( Dir ); + if Assigned(TheDir) then + repeat + ADirent := oldlinux.ReadDir(TheDir); + + If Assigned(ADirent) and (ADirent^.name <> '.') and (ADirent^.name <> '..') then + begin + lAttrib := FileGetAttr(Dir + ADirent^.name); + if ReturnAllSubDirs and ((lAttrib and faDirectory) <> 0) then + begin + SetLength( Result, i + 1); + Result[i].Name := ADirent^.name; + Result[i].IsDirectory := true; + Result[i].IsFile := false; + i := i + 1; + end + else if (Length(Filter) = 0) or (Pos( Filter, LowerCase(ADirent^.name)) > 0) then + begin + SetLength( Result, i + 1); + Result[i].Name := ADirent^.name; + Result[i].IsDirectory := false; + Result[i].IsFile := true; + i := i + 1; + end; + end; + Until ADirent = nil; + + oldlinux.CloseDir(TheDir); +end; +{$ENDIF} + +end. diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 0ffa2a8d..3ac32dda 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -22,7 +22,7 @@ uses {$endif} {$ELSE} {$IFNDEF DARWIN} - oldlinux, +// oldlinux, syscall, {$ENDIF} baseunix, diff --git a/Game/Code/Classes/Ulazjpeg.pas b/Game/Code/Classes/Ulazjpeg.pas index 1f6d8b99..d63ce753 100644 --- a/Game/Code/Classes/Ulazjpeg.pas +++ b/Game/Code/Classes/Ulazjpeg.pas @@ -17,6 +17,7 @@ unit Ulazjpeg; {$mode objfpc}{$H+} +{$I switches.inc} interface @@ -33,9 +34,17 @@ type FProgressiveEncoding: boolean; FQuality: TJPEGQualityRange; protected +{$IFDEF LAZARUS_V0924} + procedure InitFPImageReader(IntfImg: TLazIntfImage; ImgReader: TFPCustomImageReader); override; +{$ELSE} procedure InitFPImageReader(ImgReader: TFPCustomImageReader); override; +{$ENDIF} procedure FinalizeFPImageReader(ImgReader: TFPCustomImageReader); override; +{$IFDEF LAZARUS_V0924} + procedure InitFPImageWriter(IntfImg: TLazIntfImage; ImgWriter: TFPCustomImageWriter); override; +{$ELSE} procedure InitFPImageWriter(ImgWriter: TFPCustomImageWriter); override; +{$ENDIF} public constructor Create; override; class function GetFileExtensions: string; override; @@ -56,15 +65,26 @@ implementation { TJPEGImage } +{$IFDEF LAZARUS_V0924} +procedure TJPEGImage.InitFPImageReader(IntfImg: TLazIntfImage; ImgReader: TFPCustomImageReader); +{$ELSE} procedure TJPEGImage.InitFPImageReader(ImgReader: TFPCustomImageReader); +{$ENDIF} var JPEGReader: TFPReaderJPEG; begin if ImgReader is TFPReaderJPEG then begin JPEGReader:=TFPReaderJPEG(ImgReader); JPEGReader.Performance:=Performance; +{$IFDEF LAZARUS_V0924} + JPEGReader.OnProgress:=@Progress; +{$ENDIF} end; +{$IFDEF LAZARUS_V0924} + inherited InitFPImageReader(IntfImg, ImgReader); +{$ELSE} inherited InitFPImageReader(ImgReader); +{$ENDIF} end; procedure TJPEGImage.FinalizeFPImageReader(ImgReader: TFPCustomImageReader); @@ -78,7 +98,11 @@ begin inherited FinalizeFPImageReader(ImgReader); end; +{$IFDEF LAZARUS_V0924} +procedure TJPEGImage.InitFPImageWriter(IntfImg: TLazIntfImage; ImgWriter: TFPCustomImageWriter); +{$ELSE} procedure TJPEGImage.InitFPImageWriter(ImgWriter: TFPCustomImageWriter); +{$ENDIF} var JPEGWriter: TFPWriterJPEG; begin @@ -87,8 +111,15 @@ begin if JPEGWriter<>nil then ; JPEGWriter.ProgressiveEncoding:=ProgressiveEncoding; JPEGWriter.CompressionQuality:=CompressionQuality; +{$IFDEF LAZARUS_V0924} + JPEGWriter.OnProgress:=@Progress; +{$ENDIF} end; +{$IFDEF LAZARUS_V0924} + inherited InitFPImageWriter(IntfImg, ImgWriter); +{$ELSE} inherited InitFPImageWriter(ImgWriter); +{$ENDIF} end; class function TJPEGImage.GetDefaultFPReader: TFPCustomImageReaderClass; -- cgit v1.2.3 From 5bda51a14091c942b93753cb622400451a13031d Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 5 Dec 2007 22:05:36 +0000 Subject: Changed this so that us-dx doesn't crash anymore if no soundcard is available git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@673 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenOptionsRecord.pas | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index 4be16e70..80259802 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -86,25 +86,17 @@ begin SetLength(ICard, Length(Recording.SoundCard)); for SC := 0 to High(Recording.SoundCard) do ICard[SC] := Recording.SoundCard[SC].Description; -// end; -// if Length(Recording.SoundCard[Ini.Card].Input) > 0 then begin - - {$IFDEF win32} - // TODO : JB_Linux .... Audio Input ... had to remove to get it to run ??? - + if (Length(Recording.SoundCard) > 0) then begin SetLength(IInput, Length(Recording.SoundCard[Ini.Card].Input)); for SCI := 0 to High(Recording.SoundCard[Ini.Card].Input) do IInput[SCI] := Recording.SoundCard[Ini.Card].Input[SCI].Name; -// end; - - AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, Ini.Card, ICard); - SelectSlideInput := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, Ini.CardList[0].Input, IInput); - SelectSlideChannelL := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelL, Ini.CardList[0].ChannelL, IChannel); - SelectSlideChannelR := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelR, Ini.CardList[0].ChannelR, IChannel); - - {$ENDIF} + AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, Ini.Card, ICard); + SelectSlideInput := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, Ini.CardList[0].Input, IInput); + SelectSlideChannelL := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelL, Ini.CardList[0].ChannelL, IChannel); + SelectSlideChannelR := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelR, Ini.CardList[0].ChannelR, IChannel); + end; AddButton(Theme.OptionsRecord.ButtonExit); if (Length(Button[0].Text)=0) then -- cgit v1.2.3 From b712fc1607a1b7b0f94c75391b9607a91b1f832b Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 5 Dec 2007 22:11:48 +0000 Subject: - bass input and output can now be switched on/off separately - portaudio-support in linux enabled by default git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@674 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/switches.inc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index a5ec9994..8d395688 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -16,7 +16,7 @@ {$DEFINE WIN32} {$DEFINE TRANSLATE} {$ELSE} - {$DEFINE LAZARUS} + {$DEFINE LAZARUS} {$ENDIF} // {$MODE DELPHI} // JB - This is not allowed by the free pascal compiler for some reason ( At least on linux ) @@ -33,13 +33,20 @@ {$IFDEF win32} - {$DEFINE UseBASS} + {$DEFINE UseBASSOutput} + {$DEFINE UseBASSInput} + //{$DEFINE UsePortaudio} + //{$DEFINE UsePortmixer} {$IFDEF DEBUG} {$IFNDEF DARWIN} {$APPTYPE CONSOLE} {$ENDIF} {$ENDIF} {$ELSE} - {$UNDEF UseBASS} + //{$DEFINE FFMpegAudio} + {$DEFINE UsePortaudio} {$ENDIF} +{$IF Defined(UseBASSInput) or Defined(UseBASSOutput)} + {$DEFINE UseBASS} +{$IFEND} -- cgit v1.2.3 From 4b6577b5988fe3551ce126bb2b1ca91e612015b5 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 5 Dec 2007 22:22:01 +0000 Subject: portaudio support added git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@675 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.dpr | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index fcc56d33..e5ace11e 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -18,9 +18,17 @@ uses sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', - {$ifdef delphi} + {$ifdef UseBass} bass in 'lib\bass\delphi\bass.pas', + {$endif} + {$ifdef UsePortAudio} + portaudio in 'lib\portaudio\delphi\portaudio.pas', + {$endif} + {$ifdef UsePortmixer} + portmixer in 'lib\portmixer\delphi\portmixer.pas', + {$endif} + {$ifdef delphi} midiout in 'lib\midi\midiout.pas', midiin in 'lib\midi\midiin.pas', CIRCBUF in 'lib\midi\CIRCBUF.PAS', @@ -39,7 +47,7 @@ uses rational in 'lib\ffmpeg\rational.pas', opt in 'lib\ffmpeg\opt.pas', avio in 'lib\ffmpeg\avio.pas', - + //swscale in 'lib\ffmpeg\swscale.pas', SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', SQLite3 in 'lib\SQLite\SQLite3.pas', @@ -106,7 +114,7 @@ uses UPlatformWindows in 'Classes\UPlatformWindows.pas', {$ENDIF} {$IFDEF LINUX} - UPlatformLinux in 'Classes\UPlatformLinux.pas', + UPlatformLinux in 'Classes\UPlatformLinux.pas', {$ENDIF} {$IFDEF FPC} @@ -121,12 +129,15 @@ uses UMusic in 'Classes\UMusic.pas', UMedia_dummy in 'Classes\UMedia_dummy.pas', UVideo in 'Classes\UVideo.pas', -{$ifdef linux} - UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', -{$endif} -{$ifdef win32} +{$ifdef UseBass} UAudio_bass in 'Classes\UAudio_bass.pas', {$endif} +{$ifdef UsePortaudio} + UAudio_portaudio in 'Classes\UAudio_portaudio.pas', +{$endif} +{$ifdef FFMpegAudio} + UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', +{$endif} //------------------------------ //Includes - Screens @@ -188,4 +199,4 @@ const begin Main; end. -{$ENDIF} \ No newline at end of file +{$ENDIF} -- cgit v1.2.3 From 793c046c898eb933a175bf5b153f0dcf0cb56767 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 5 Dec 2007 22:47:52 +0000 Subject: added projectM header file git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@676 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/projectM/projectM.pas | 354 ++++++++++++++++++++++++++++++++++++ 1 file changed, 354 insertions(+) create mode 100644 Game/Code/lib/projectM/projectM.pas (limited to 'Game/Code') diff --git a/Game/Code/lib/projectM/projectM.pas b/Game/Code/lib/projectM/projectM.pas new file mode 100644 index 00000000..72fb0b92 --- /dev/null +++ b/Game/Code/lib/projectM/projectM.pas @@ -0,0 +1,354 @@ +unit projectM; + +interface + +uses OpenGL12; + +type + FLOAT = Single; + PFLOAT = ^FLOAT; + PPFLOAT = ^PFLOAT; + INT = Integer; + SHORT = Smallint; + LONG = Longint; + +type + TPCM16 = array[0..1, 0..511] of SHORT; + +type + TTextureScale = INT; +const + SCALE_NEAREST = 0; + SCALE_MAGNIFY = 1; + SCALE_MINIFY = 2; + +type + TContextType = INT; +const + AGL_CONTEXT = 0; + CGL_CONTEXT = 1; + NSGL_CONTEXT = 2; + GLX_CONTEXT = 3; + WGL_CONTEXT = 4; + +type + TPBufferPass = INT; +const + PBUFFER_PASS1 = 0; + PBUFFER_PASS2 = 1; + +type + PRenderTarget = ^TRenderTarget; + TRenderTarget = record + { Texture size } + texsize: INT; + + { Application context } + origContextType: TContextType; + + usePbuffers: INT; + + {$ifdef LINUX} + lock_func: procedure(); cdecl; + unlock_func: procedure(); cdecl; + {$endif} + + { Opaque pbuffer context and pbuffer } + {$ifdef MACOS} + origContext: Pointer; + pbufferContext: Pointer; + pbuffer: Pointer; + {$endif} + + { Render target texture ID for non-pbuffer systems } + textureID: array[0..2] of TGLuint; + end; + + { + procedure createPBuffers( width, height: INT; target: PRenderTarget ); + procedure lockPBuffer( target: PRenderTarget; pass: PBufferPass ); + procedure unlockPBuffer( target: PRenderTarget ); + function nearestPower2( value: INT; scaleRule: TTextureScale ): INT; + } + + PProjectM = ^TProjectM; + TProjectM = record + presetURL: PChar; + presetName: PChar; + fontURL: PChar; + + hasInit: INT; + + noSwitch: INT; + pcmframes: INT; + freqframes: INT; + totalframes: INT; + + showfps: INT; + showtitle: INT; + showpreset: INT; + showhelp: INT; + showstats: INT; + + studio: INT; + + fbuffer: PGLubyte; + + {$ifndef Win32} + { The first ticks value of the application } + startTime: LONG; //struct timeval + {$else} + startTime: LONG; + {$endif Win32} + Time: FLOAT; + + { Render target texture ID } + renderTarget: PRenderTarget; + + disp: array[0..79] of Char; + + wave_o: FLOAT; + + //int texsize=1024; //size of texture to do actual graphics + fvw: INT; //fullscreen dimensions + fvh: INT; + wvw: INT; //windowed dimensions + wvh: INT; + vw: INT; //runtime dimensions + vh: INT; + fullscreen: INT; + + maxsamples: INT; //size of PCM buffer + numsamples: INT; //size of new PCM info + pcmdataL: PFLOAT; //holder for most recent pcm data + pcmdataR: PFLOAT; //holder for most recent pcm data + + avgtime: INT; //# frames per preset + + title: PChar; + drawtitle: INT; + + correction: INT; + + vol: FLOAT; + + //per pixel equation variables + gridx: PPFLOAT; //grid containing interpolated mesh + gridy: PPFLOAT; + origtheta: PPFLOAT; //grid containing interpolated mesh reference values + origrad: PPFLOAT; + origx: PPFLOAT; //original mesh + origy: PPFLOAT; + origx2: PPFLOAT; //original mesh + origy2: PPFLOAT; + + { Timing information } + mspf: INT; + timed: INT; + timestart: INT; + nohard: INT; + count: INT; + realfps, + fpsstart: FLOAT; + + { PCM data } + vdataL: array[0..511] of FLOAT; //holders for FFT data (spectrum) + vdataR: array[0..511] of FLOAT; + + { Various toggles } + doPerPixelEffects: INT; + doIterative: INT; + + { ENGINE VARIABLES } + { From engine_vars.h } + preset_name: array[0..255] of Char; + + { PER FRAME CONSTANTS BEGIN } + zoom: FLOAT; + zoomexp: FLOAT; + rot: FLOAT; + warp: FLOAT; + + sx: FLOAT; + sy: FLOAT; + dx: FLOAT; + dy: FLOAT; + cx: FLOAT; + cy: FLOAT; + + gy: INT; + gx: INT; + + decay: FLOAT; + + wave_r: FLOAT; + wave_g: FLOAT; + wave_b: FLOAT; + wave_x: FLOAT; + wave_y: FLOAT; + wave_mystery: FLOAT; + + ob_size: FLOAT; + ob_r: FLOAT; + ob_g: FLOAT; + ob_b: FLOAT; + ob_a: FLOAT; + + ib_size: FLOAT; + ib_r: FLOAT; + ib_g: FLOAT; + ib_b: FLOAT; + ib_a: FLOAT; + + meshx: INT; + meshy: INT; + + mv_a: FLOAT; + mv_r: FLOAT; + mv_g: FLOAT; + mv_b: FLOAT; + mv_l: FLOAT; + mv_x: FLOAT; + mv_y: FLOAT; + mv_dy: FLOAT; + mv_dx: FLOAT; + + treb: FLOAT; + mid: FLOAT; + bass: FLOAT; + bass_old: FLOAT; + beat_sensitivity: FLOAT; + treb_att: FLOAT; + mid_att: FLOAT; + bass_att: FLOAT; + progress: FLOAT; + frame: INT; + + { PER_FRAME CONSTANTS END } + + { PER_PIXEL CONSTANTS BEGIN } + + x_per_pixel: FLOAT; + y_per_pixel: FLOAT; + rad_per_pixel: FLOAT; + ang_per_pixel: FLOAT; + + { PER_PIXEL CONSTANT END } + + + fRating: FLOAT; + fGammaAdj: FLOAT; + fVideoEchoZoom: FLOAT; + fVideoEchoAlpha: FLOAT; + + nVideoEchoOrientation: INT; + nWaveMode: INT; + bAdditiveWaves: INT; + bWaveDots: INT; + bWaveThick: INT; + bModWaveAlphaByVolume: INT; + bMaximizeWaveColor: INT; + bTexWrap: INT; + bDarkenCenter: INT; + bRedBlueStereo: INT; + bBrighten: INT; + bDarken: INT; + bSolarize: INT; + bInvert: INT; + bMotionVectorsOn: INT; + fps: INT; + + fWaveAlpha: FLOAT; + fWaveScale: FLOAT; + fWaveSmoothing: FLOAT; + fWaveParam: FLOAT; + fModWaveAlphaStart: FLOAT; + fModWaveAlphaEnd: FLOAT; + fWarpAnimSpeed: FLOAT; + fWarpScale: FLOAT; + fShader: FLOAT; + + + { Q VARIABLES START } + + q1: FLOAT; + q2: FLOAT; + q3: FLOAT; + q4: FLOAT; + q5: FLOAT; + q6: FLOAT; + q7: FLOAT; + q8: FLOAT; + + + { Q VARIABLES END } + + zoom_mesh: PPFLOAT; + zoomexp_mesh: PPFLOAT; + rot_mesh: PPFLOAT; + + sx_mesh: PPFLOAT; + sy_mesh: PPFLOAT; + dx_mesh: PPFLOAT; + dy_mesh: PPFLOAT; + cx_mesh: PPFLOAT; + cy_mesh: PPFLOAT; + + x_mesh: PPFLOAT; + y_mesh: PPFLOAT; + rad_mesh: PPFLOAT; + theta_mesh: PPFLOAT; + end; + + { Functions } + procedure projectM_init(pm: PProjectM); cdecl; external 'libprojectM.dll'; + procedure projectM_reset(pm: PProjectM); cdecl; external 'libprojectM.dll'; + procedure projectM_resetGL(pm: PProjectM; width: INT; height: INT); cdecl; external 'libprojectM.dll'; + procedure projectM_setTitle(pm: PProjectM; title: PChar); cdecl; external 'libprojectM.dll'; + procedure renderFrame(pm: PProjectM); cdecl; external 'libprojectM.dll'; + + { + procedure draw_help(pm: PProjectM); + procedure draw_fps(pm: PProjectM; fps: Single); + procedure draw_preset(pm: PProjectM); + procedure draw_title(pm: PProjectM); + procedure draw_stats(pm: PProjectM); + + procedure modulate_opacity_by_volume(pm: PProjectM); + procedure maximize_colors(pm: PProjectM); + procedure do_per_pixel_math(pm: PProjectM); + procedure do_per_frame(pm: PProjectM); + procedure render_texture_to_studio(pm: PProjectM); + procedure darken_center(pm: PProjectM); + + procedure render_interpolation(pm: PProjectM); + procedure render_texture_to_screen(pm: PProjectM); + procedure render_texture_to_studio(pm: PProjectM); + procedure draw_motion_vectors(pm: PProjectM); + procedure draw_borders(pm: PProjectM); + procedure draw_shapes(pm: PProjectM); + procedure draw_waveform(pm: PProjectM); + procedure draw_custom_waves(pm: PProjectM); + + procedure draw_title_to_screen(pm: PProjectM); + procedure draw_title_to_texture(pm: PProjectM); + procedure get_title(pm: PProjectM); + + procedure reset_per_pixel_matrices(pm: PProjectM); + procedure init_per_pixel_matrices(pm: PProjectM); + procedure rescale_per_pixel_matrices(pm: PProjectM); + } + + { PCM.h declarations } + { + procedure addPCMfloat(PCMdata: PFLOAT, samples: INT); + } + procedure addPCM16(pcm_data: TPCM16); cdecl; external 'libprojectM.dll'; + { + procedure addPCM16Data(const short* pcm_data, short samples); + procedure addPCM8( unsigned char [2][512]); + } + +implementation + +end. -- cgit v1.2.3 From 6a6ef888e1132505da264e395d2c1ca08fffecc5 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 5 Dec 2007 22:51:01 +0000 Subject: - music-visualization support added. - hardcoded to projectm at the moment. - needs a plugin-structure makeover git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@677 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UVisualizer.pas | 201 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 Game/Code/Classes/UVisualizer.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UVisualizer.pas b/Game/Code/Classes/UVisualizer.pas new file mode 100644 index 00000000..3bea8f54 --- /dev/null +++ b/Game/Code/Classes/UVisualizer.pas @@ -0,0 +1,201 @@ +{############################################################################ +# Visualizer support for UltraStar deluxe # +# # +# Created by hennymcc # +# based on UVideo.pas # +#############################################################################} + +unit UVisualizer; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses SDL, + UGraphicClasses, + textgl, + math, + OpenGL12, + SysUtils, + UIni, + {$ifdef DebugDisplay} + dialogs, + {$ENDIF} + projectM, + windows; + +procedure Init; +procedure VisualizerStart; +procedure VisualizerStop; +procedure VisualizerGetFrame(Time: Extended); +procedure VisualizerDrawGL(Screen: integer); +procedure VisualizerTogglePause; + +const + VisualWidth = 640; + VisualHeight = 480; + gx = 32; + gy = 24; + fps = 30; + texsize = 512; + +var + pm: PProjectM; + VisualizerStarted, VisualizerPaused: Boolean; + VisualTex: glUint; + pcm_data: TPCM16; + hRC: Integer; + hDC: Integer; + +implementation + +procedure Init; +begin + VisualizerStarted := False; + VisualizerPaused := False; + glGenTextures(1, PglUint(@VisualTex)); + glBindTexture(GL_TEXTURE_2D, VisualTex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); +end; + +procedure VisualizerStart; +begin +exit; + VisualizerStarted := True; + + New(pm); + projectM_reset(pm); + + pm^.fullscreen := 0; + pm^.renderTarget^.texsize := texsize; + pm^.gx := gx; + pm^.gy := gy; + pm^.fps := fps; + pm^.renderTarget^.usePbuffers := 0; + + pm^.fontURL := PChar('Visuals\fonts'); + pm^.presetURL := PChar('Visuals\presets'); + + glPushAttrib(GL_ALL_ATTRIB_BITS); + projectM_init(pm); + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + projectM_resetGL(pm, VisualWidth, VisualHeight); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + glMatrixMode(GL_TEXTURE); + glPopMatrix(); + glPopAttrib(); +end; + +procedure VisualizerStop; +begin + if VisualizerStarted then begin + VisualizerStarted := False; + Dispose(pm); + end; +end; + +procedure VisualizerTogglePause; +begin + if VisualizerPaused then VisualizerPaused:=False + else VisualizerPaused:=True; +end; + +procedure VisualizerGetFrame(Time: Extended); +var + i: integer; +begin + exit; + + if not VisualizerStarted then Exit; + if VisualizerPaused then Exit; + + Randomize(); + + for i := 0 to 511 do + begin + pcm_data[0][i] := RandomRange(High(Smallint), Low(Smallint)); + pcm_data[1][i] := pcm_data[0][i]; + end; + addPCM16(pcm_data); + + glPushAttrib(GL_ALL_ATTRIB_BITS); + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + renderFrame(pm); + glFlush(); + { + glBindTexture(GL_TEXTURE_2D, VisualTex); + glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, VisualWidth, VisualHeight, 0); + } + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + glMatrixMode(GL_TEXTURE); + glPopMatrix(); + glPopAttrib(); + + glClear(GL_DEPTH_BUFFER_BIT); + + { + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + glEnable(GL_TEXTURE_2D); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + glBindTexture(GL_TEXTURE_2D, VisualTex); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(-1, -1); + glTexCoord2f(1, 0); glVertex2f( 1, -1); + glTexCoord2f(1, 1); glVertex2f( 1, 1); + glTexCoord2f(0, 1); glVertex2f(-1, 1); + glEnd(); + glDisable(GL_TEXTURE_2D); + } +end; + +procedure VisualizerDrawGL(Screen: integer); +begin +{ + // have a nice black background to draw on (even if there were errors opening the vid) + if Screen=1 then begin + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end; + // exit if there's nothing to draw + if not VisualizerStarted then Exit; + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, VisualTex); + glbegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex2f(400-VisualWidth/2, 300-VisualHeight/2); + glTexCoord2f(0, 1); + glVertex2f(400-VisualWidth/2, 300+VisualHeight/2); + glTexCoord2f(1, 1); + glVertex2f(400+VisualWidth/2, 300+VisualHeight/2); + glTexCoord2f(1, 0); + glVertex2f(400+VisualWidth/2, 300-VisualHeight/2); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); +} +end; + +end. -- cgit v1.2.3 From 486ad8796acc5883ef83f3a78cd615f6711d77f0 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 6 Dec 2007 09:39:49 +0000 Subject: conformed projectM to IVideoPlayback still needs a little work. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@678 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMedia_dummy.pas | 8 +- Game/Code/Classes/UMusic.pas | 5 +- Game/Code/Classes/UPlatform.pas | 11 ++- Game/Code/Classes/UVideo.pas | 8 +- Game/Code/Classes/UVisualizer.pas | 157 +++++++++++++++++++++++++++++-------- Game/Code/Screens/UScreenSing.pas | 8 +- Game/Code/UltraStar.dpr | 5 +- Game/Code/switches.inc | 5 +- 8 files changed, 151 insertions(+), 56 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMedia_dummy.pas b/Game/Code/Classes/UMedia_dummy.pas index 42a3f1b9..630b497e 100644 --- a/Game/Code/Classes/UMedia_dummy.pas +++ b/Game/Code/Classes/UMedia_dummy.pas @@ -47,8 +47,8 @@ type procedure MoveTo(Time: real); function getPosition: real; - procedure FFmpegGetFrame(Time: Extended); - procedure FFmpegDrawGL(Screen: integer); + procedure GetFrame(Time: Extended); + procedure DrawGL(Screen: integer); // IAudioInput procedure InitializeRecord; @@ -95,11 +95,11 @@ begin end; -procedure Tmedia_dummy.FFmpegGetFrame(Time: Extended); +procedure Tmedia_dummy.GetFrame(Time: Extended); begin end; -procedure Tmedia_dummy.FFmpegDrawGL(Screen: integer); +procedure Tmedia_dummy.DrawGL(Screen: integer); begin end; diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index feba3f61..18ec2944 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -123,8 +123,8 @@ type *) procedure init(); - procedure FFmpegGetFrame(Time: Extended); // WANT TO RENAME THESE TO BE MORE GENERIC - procedure FFmpegDrawGL(Screen: integer); // WANT TO RENAME THESE TO BE MORE GENERIC + procedure GetFrame(Time: Extended); // WANT TO RENAME THESE TO BE MORE GENERIC + procedure DrawGL(Screen: integer); // WANT TO RENAME THESE TO BE MORE GENERIC end; @@ -265,6 +265,7 @@ begin // ( not assigned( singleton_AudioInput ) ) then begin singleton_AudioInput := IAudioInput( lTmpInterface ); + Writeln(singleton_AudioInput.GetName); end; // if this interface is a Input, then set it as the default used diff --git a/Game/Code/Classes/UPlatform.pas b/Game/Code/Classes/UPlatform.pas index 878c1ec2..a06914d0 100644 --- a/Game/Code/Classes/UPlatform.pas +++ b/Game/Code/Classes/UPlatform.pas @@ -18,10 +18,10 @@ uses Classes; type TDirectoryEntry = Record - Name : WideString; - IsDirectory : Boolean; - IsFile : Boolean; - end; + Name : WideString; + IsDirectory : Boolean; + IsFile : Boolean; + end; TDirectoryEntryArray = Array of TDirectoryEntry; @@ -81,6 +81,5 @@ initialization {$ENDIF} finalization - - Platform.Free; + freeandnil( Platform ); end. diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index 6c9458f9..c2e42224 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -110,8 +110,8 @@ type procedure MoveTo(Time: real); function getPosition: real; - procedure FFmpegGetFrame(Time: Extended); // WANT TO RENAME THESE TO BE MORE GENERIC - procedure FFmpegDrawGL(Screen: integer); // WANT TO RENAME THESE TO BE MORE GENERIC + procedure GetFrame(Time: Extended); // WANT TO RENAME THESE TO BE MORE GENERIC + procedure DrawGL(Screen: integer); // WANT TO RENAME THESE TO BE MORE GENERIC end; @@ -192,7 +192,7 @@ end; -procedure TVideoPlayback_ffmpeg.FFmpegGetFrame(Time: Extended); +procedure TVideoPlayback_ffmpeg.GetFrame(Time: Extended); var FrameFinished: Integer; AVPacket: TAVPacket; @@ -355,7 +355,7 @@ begin end; end; -procedure TVideoPlayback_ffmpeg.FFmpegDrawGL(Screen: integer); +procedure TVideoPlayback_ffmpeg.DrawGL(Screen: integer); begin // have a nice black background to draw on (even if there were errors opening the vid) if Screen=1 then diff --git a/Game/Code/Classes/UVisualizer.pas b/Game/Code/Classes/UVisualizer.pas index 3bea8f54..1905358f 100644 --- a/Game/Code/Classes/UVisualizer.pas +++ b/Game/Code/Classes/UVisualizer.pas @@ -2,6 +2,7 @@ # Visualizer support for UltraStar deluxe # # # # Created by hennymcc # +# Slight modifications by Jay Binks # # based on UVideo.pas # #############################################################################} @@ -24,46 +25,122 @@ uses SDL, dialogs, {$ENDIF} projectM, + UMusic, windows; -procedure Init; -procedure VisualizerStart; -procedure VisualizerStop; -procedure VisualizerGetFrame(Time: Extended); -procedure VisualizerDrawGL(Screen: integer); -procedure VisualizerTogglePause; +implementation + +var + singleton_VideoProjectM : IVideoPlayback; const - VisualWidth = 640; - VisualHeight = 480; - gx = 32; - gy = 24; - fps = 30; - texsize = 512; + VisualWidth = 800; // 640 + VisualHeight = 600; // 480 + gx = 32; + gy = 24; + fps = 30; + texsize = 512; -var - pm: PProjectM; - VisualizerStarted, VisualizerPaused: Boolean; - VisualTex: glUint; - pcm_data: TPCM16; - hRC: Integer; - hDC: Integer; +type + TVideoPlayback_ProjectM = class( TInterfacedObject, IVideoPlayback ) + + pm : PProjectM; -implementation + VisualizerStarted , + VisualizerPaused : Boolean; -procedure Init; -begin + VisualTex : glUint; + pcm_data : TPCM16; + hRC : Integer; + hDC : Integer; + + procedure VisualizerStart; + procedure VisualizerStop; + + procedure VisualizerTogglePause; + public + constructor create(); + function GetName: String; + + procedure init(); + + function Open( aFileName : string): boolean; // true if succeed + procedure Close; + + procedure Play; + procedure Pause; + procedure Stop; + + procedure MoveTo(Time: real); + function getPosition: real; + + procedure GetFrame(Time: Extended); // WANT TO RENAME THESE TO BE MORE GENERIC + procedure DrawGL(Screen: integer); // WANT TO RENAME THESE TO BE MORE GENERIC + end; + + +constructor TVideoPlayback_ProjectM.create(); +begin +end; + + +procedure TVideoPlayback_ProjectM.init(); +begin + writeln( 'TVideoPlayback_ProjectM - INITIALIZE !!!!!!!!' ); + VisualizerStarted := False; - VisualizerPaused := False; + VisualizerPaused := False; + glGenTextures(1, PglUint(@VisualTex)); glBindTexture(GL_TEXTURE_2D, VisualTex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); end; -procedure VisualizerStart; +function TVideoPlayback_ProjectM.GetName: String; +begin + result := 'ProjectM'; +end; + + +function TVideoPlayback_ProjectM.Open( aFileName : string): boolean; // true if succeed begin -exit; + VisualizerStart(); + result := true; +end; + +procedure TVideoPlayback_ProjectM.Close; +begin +end; + +procedure TVideoPlayback_ProjectM.Play; +begin + VisualizerStart(); +end; + +procedure TVideoPlayback_ProjectM.Pause; +begin + VisualizerTogglePause(); +end; + +procedure TVideoPlayback_ProjectM.Stop; +begin + VisualizerStop(); +end; + +procedure TVideoPlayback_ProjectM.MoveTo(Time: real); +begin +end; + +function TVideoPlayback_ProjectM.getPosition: real; +begin + result := 0; +end; + +procedure TVideoPlayback_ProjectM.VisualizerStart; +begin +//exit; VisualizerStarted := True; New(pm); @@ -76,7 +153,7 @@ exit; pm^.fps := fps; pm^.renderTarget^.usePbuffers := 0; - pm^.fontURL := PChar('Visuals\fonts'); + pm^.fontURL := PChar('Visuals\fonts'); pm^.presetURL := PChar('Visuals\presets'); glPushAttrib(GL_ALL_ATTRIB_BITS); @@ -97,7 +174,7 @@ exit; glPopAttrib(); end; -procedure VisualizerStop; +procedure TVideoPlayback_ProjectM.VisualizerStop; begin if VisualizerStarted then begin VisualizerStarted := False; @@ -105,17 +182,17 @@ begin end; end; -procedure VisualizerTogglePause; +procedure TVideoPlayback_ProjectM.VisualizerTogglePause; begin if VisualizerPaused then VisualizerPaused:=False else VisualizerPaused:=True; end; -procedure VisualizerGetFrame(Time: Extended); +procedure TVideoPlayback_ProjectM.GetFrame(Time: Extended); var i: integer; begin - exit; +// exit; if not VisualizerStarted then Exit; if VisualizerPaused then Exit; @@ -168,9 +245,11 @@ begin } end; -procedure VisualizerDrawGL(Screen: integer); +procedure TVideoPlayback_ProjectM.DrawGL(Screen: integer); begin -{ + + exit; + // have a nice black background to draw on (even if there were errors opening the vid) if Screen=1 then begin glClearColor(0,0,0,0); @@ -195,7 +274,19 @@ begin glEnd; glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); -} + end; + +initialization + singleton_VideoProjectM := TVideoPlayback_ProjectM.create(); + + writeln( 'UVideoProjectM - Register Playback' ); + AudioManager.add( singleton_VideoProjectM ); + +finalization + AudioManager.Remove( singleton_VideoProjectM ); + + + end. diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index dd11ee07..c3bb78d2 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -851,10 +851,10 @@ begin begin try writeln( 'VideoPlayback.FFmpegGetFrame' ); - VideoPlayback.FFmpegGetFrame(Czas.Teraz); + VideoPlayback.GetFrame(Czas.Teraz); writeln( 'VideoPlayback.FFmpegDrawGL' ); - VideoPlayback.FFmpegDrawGL(ScreenAct); + VideoPlayback.DrawGL(ScreenAct); // PlaySmpeg; except @@ -1125,8 +1125,8 @@ begin // todo: find a way to determine, when a new frame is needed // toto: same for the need to skip frames - VideoPlayback.FFmpegGetFrame(Czas.Teraz); - VideoPlayback.FFmpegDrawGL(ScreenAct); + VideoPlayback.GetFrame(Czas.Teraz); + VideoPlayback.DrawGL(ScreenAct); except on E : Exception do begin diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index e5ace11e..6a1d0013 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -128,7 +128,7 @@ uses //------------------------------ UMusic in 'Classes\UMusic.pas', UMedia_dummy in 'Classes\UMedia_dummy.pas', - UVideo in 'Classes\UVideo.pas', +// UVideo in 'Classes\UVideo.pas', {$ifdef UseBass} UAudio_bass in 'Classes\UAudio_bass.pas', {$endif} @@ -139,6 +139,9 @@ uses UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', {$endif} + projectM in 'lib\projectM\projectM.pas', + UVisualizer in 'Classes\UVisualizer.pas', + //------------------------------ //Includes - Screens //------------------------------ diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index 8d395688..15fb31bb 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -34,8 +34,9 @@ {$IFDEF win32} {$DEFINE UseBASSOutput} - {$DEFINE UseBASSInput} - //{$DEFINE UsePortaudio} +// {$DEFINE UseBASSInput} + + {$DEFINE UsePortaudio} //{$DEFINE UsePortmixer} {$IFDEF DEBUG} {$IFNDEF DARWIN} -- cgit v1.2.3 From 27ca028ea19879bb3b109c58bae86b61e60b3370 Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 6 Dec 2007 10:40:15 +0000 Subject: Visualizer changes (audio connection, some opengl fixes) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@679 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudio_bass.pas | 37 ++++++++++++++ Game/Code/Classes/UMedia_dummy.pas | 6 +++ Game/Code/Classes/UMusic.pas | 8 +++- Game/Code/Classes/UVisualizer.pas | 96 +++++++++++++++++++++---------------- Game/Code/UltraStar.dpr | 16 +++++-- Game/Code/lib/projectM/projectM.pas | 2 +- 6 files changed, 118 insertions(+), 47 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudio_bass.pas b/Game/Code/Classes/UAudio_bass.pas index bcf01f92..69278cca 100644 --- a/Game/Code/Classes/UAudio_bass.pas +++ b/Game/Code/Classes/UAudio_bass.pas @@ -100,6 +100,9 @@ type //Equalizer function GetFFTData: TFFTData; + // Interface for Visualizer + function GetPCMData(var data: TPCMData): Cardinal; + //Custom Sounds function LoadCustomSound(const Filename: String): Cardinal; procedure PlayCustomSound(const Index: Cardinal ); @@ -384,6 +387,40 @@ begin BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); end; +{* + * Copies interleaved PCM 16bit uint (maybe fake) stereo samples into data. + * Returns the number of frames (= stereo/mono sample) + *} +function TAudio_bass.GetPCMData(var data: TPCMData): Cardinal; +var + info: BASS_CHANNELINFO; + nBytes: DWORD; +begin + //Get Channel Data Mono and 256 Values + BASS_ChannelGetInfo(Bass, info); + ZeroMemory(@data, sizeof(TPCMData)); + + if (info.chans = 1) then + begin + // mono file -> add stereo channel + { + nBytes := BASS_ChannelGetData(Bass, @data[0], samples*sizeof(Smallint)); + // interleave data + //CopyMemory(@data[1], @data[0], samples*sizeof(Smallint)); + } + result := 0; + end + else + begin + // stereo file + nBytes := BASS_ChannelGetData(Bass, @data, sizeof(TPCMData)); + end; + if(nBytes <= 0) then + result := 0 + else + result := nBytes div sizeof(TPCMStereoSample); +end; + function TAudio_bass.LoadCustomSound(const Filename: String): Cardinal; var S: hStream; diff --git a/Game/Code/Classes/UMedia_dummy.pas b/Game/Code/Classes/UMedia_dummy.pas index 630b497e..c5fb799c 100644 --- a/Game/Code/Classes/UMedia_dummy.pas +++ b/Game/Code/Classes/UMedia_dummy.pas @@ -57,6 +57,7 @@ type procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); procedure StopCard(Card: byte); function GetFFTData: TFFTData; + function GetPCMData(var data: TPCMData): Cardinal; // IAudioPlayback procedure InitializePlayback; @@ -167,6 +168,11 @@ function Tmedia_dummy.GetFFTData: TFFTData; begin end; +function Tmedia_dummy.GetPCMData(var data: TPCMData): Cardinal; +begin + result := 0; +end; + // IAudioPlayback procedure Tmedia_dummy.InitializePlayback; begin diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index 18ec2944..4acbb55a 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -83,7 +83,10 @@ type Source: array of string; end; - TFFTData = array [0..256] of Single; + TFFTData = array[0..256] of Single; + + TPCMStereoSample = array[0..1] of Smallint; + TPCMData = array[0..511] of TPCMStereoSample; hStream = Cardinal; @@ -165,6 +168,9 @@ type //Equalizer function GetFFTData: TFFTData; + + // Interface for Visualizer + function GetPCMData(var data: TPCMData): Cardinal; end; IAudioInput = Interface diff --git a/Game/Code/Classes/UVisualizer.pas b/Game/Code/Classes/UVisualizer.pas index 1905358f..0f2334ba 100644 --- a/Game/Code/Classes/UVisualizer.pas +++ b/Game/Code/Classes/UVisualizer.pas @@ -30,16 +30,19 @@ uses SDL, implementation +uses + UGraphic; + var singleton_VideoProjectM : IVideoPlayback; const - VisualWidth = 800; // 640 - VisualHeight = 600; // 480 gx = 32; gy = 24; fps = 30; texsize = 512; + visuals_Dir = 'Visuals'; // TODO: move this to a place common for all visualizers + projectM_Dir = visuals_Dir+'/projectM'; type TVideoPlayback_ProjectM = class( TInterfacedObject, IVideoPlayback ) @@ -50,7 +53,7 @@ type VisualizerPaused : Boolean; VisualTex : glUint; - pcm_data : TPCM16; + PCMData : TPCMData; hRC : Integer; hDC : Integer; @@ -140,7 +143,6 @@ end; procedure TVideoPlayback_ProjectM.VisualizerStart; begin -//exit; VisualizerStarted := True; New(pm); @@ -153,8 +155,8 @@ begin pm^.fps := fps; pm^.renderTarget^.usePbuffers := 0; - pm^.fontURL := PChar('Visuals\fonts'); - pm^.presetURL := PChar('Visuals\presets'); + pm^.fontURL := PChar(projectM_Dir+'/fonts'); + pm^.presetURL := PChar(projectM_Dir+'/presets'); glPushAttrib(GL_ALL_ATTRIB_BITS); projectM_init(pm); @@ -164,7 +166,9 @@ begin glPushMatrix(); glMatrixMode(GL_TEXTURE); glPushMatrix(); - projectM_resetGL(pm, VisualWidth, VisualHeight); + + projectM_resetGL(pm, ScreenW, ScreenH); + glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); @@ -191,21 +195,16 @@ end; procedure TVideoPlayback_ProjectM.GetFrame(Time: Extended); var i: integer; + nSamples: cardinal; begin -// exit; - if not VisualizerStarted then Exit; if VisualizerPaused then Exit; - Randomize(); - - for i := 0 to 511 do - begin - pcm_data[0][i] := RandomRange(High(Smallint), Low(Smallint)); - pcm_data[1][i] := pcm_data[0][i]; - end; - addPCM16(pcm_data); + // get audio data + nSamples := AudioPlayback.GetPCMData(PcmData); + addPCM16Data(PSmallInt(@PcmData), nSamples); + // store OpenGL state (might be messed up otherwise) glPushAttrib(GL_ALL_ATTRIB_BITS); glMatrixMode(GL_PROJECTION); glPushMatrix(); @@ -213,12 +212,17 @@ begin glPushMatrix(); glMatrixMode(GL_TEXTURE); glPushMatrix(); + + // let projectM render a frame renderFrame(pm); glFlush(); - { + + {$IFDEF UseTexture} glBindTexture(GL_TEXTURE_2D, VisualTex); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, VisualWidth, VisualHeight, 0); - } + {$ENDIF} + + // restore USDX OpenGL state glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); @@ -227,41 +231,45 @@ begin glPopMatrix(); glPopAttrib(); + // discard projectM's depth buffer information (avoid overlay) glClear(GL_DEPTH_BUFFER_BIT); - - { - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - - glEnable(GL_TEXTURE_2D); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glBindTexture(GL_TEXTURE_2D, VisualTex); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(-1, -1); - glTexCoord2f(1, 0); glVertex2f( 1, -1); - glTexCoord2f(1, 1); glVertex2f( 1, 1); - glTexCoord2f(0, 1); glVertex2f(-1, 1); - glEnd(); - glDisable(GL_TEXTURE_2D); - } end; procedure TVideoPlayback_ProjectM.DrawGL(Screen: integer); begin - - exit; - + {$IFDEF UseTexture} // have a nice black background to draw on (even if there were errors opening the vid) if Screen=1 then begin - glClearColor(0,0,0,0); + glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); end; // exit if there's nothing to draw if not VisualizerStarted then Exit; - glEnable(GL_TEXTURE_2D); + // setup display + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + gluOrtho2D(0, 1, 0, 1); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + glEnable(GL_BLEND); - glColor4f(1, 1, 1, 1); + glEnable(GL_TEXTURE_2D); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glBindTexture(GL_TEXTURE_2D, VisualTex); + glColor4f(1, 1, 1, 1); + + // draw projectM frame + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(0, 0); + glTexCoord2f(1, 0); glVertex2f(1, 0); + glTexCoord2f(1, 1); glVertex2f(1, 1); + glTexCoord2f(0, 1); glVertex2f(0, 1); + glEnd(); + + { glbegin(GL_QUADS); glTexCoord2f(0, 0); glVertex2f(400-VisualWidth/2, 300-VisualHeight/2); @@ -272,9 +280,17 @@ begin glTexCoord2f(1, 0); glVertex2f(400+VisualWidth/2, 300-VisualHeight/2); glEnd; + } + glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); + // restore state + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + {$ENDIF} end; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 6a1d0013..49ba145d 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -49,9 +49,14 @@ uses avio in 'lib\ffmpeg\avio.pas', //swscale in 'lib\ffmpeg\swscale.pas', + {$ifdef UseProjectM} + projectM in 'lib\projectM\projectM.pas', + {$endif} + SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', SQLite3 in 'lib\SQLite\SQLite3.pas', + //------------------------------ //Includes - Menu System //------------------------------ @@ -68,7 +73,7 @@ uses //------------------------------ //Includes - Classes - //------------------------------ + //------------------------------ UCommon in 'Classes\UCommon.pas', UGraphic in 'Classes\UGraphic.pas', UTexture in 'Classes\UTexture.pas', @@ -109,9 +114,9 @@ uses uPluginLoader in 'Classes\uPluginLoader.pas', //New Plugin Loader Module UParty in 'Classes\UParty.pas', // to - do : rewrite Party Manager as Module, reomplent ability to offer party Mody by Plugin - UPlatform in 'Classes\UPlatform.pas', + UPlatform in 'Classes\UPlatform.pas', {$IFDEF WIN32} - UPlatformWindows in 'Classes\UPlatformWindows.pas', + UPlatformWindows in 'Classes\UPlatformWindows.pas', {$ENDIF} {$IFDEF LINUX} UPlatformLinux in 'Classes\UPlatformLinux.pas', @@ -139,8 +144,9 @@ uses UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', {$endif} - projectM in 'lib\projectM\projectM.pas', - UVisualizer in 'Classes\UVisualizer.pas', +{$IFDEF UseProjectM} + UVisualizer in 'Classes\UVisualizer.pas', +{$ENDIF} //------------------------------ //Includes - Screens diff --git a/Game/Code/lib/projectM/projectM.pas b/Game/Code/lib/projectM/projectM.pas index 72fb0b92..be6f77b1 100644 --- a/Game/Code/lib/projectM/projectM.pas +++ b/Game/Code/lib/projectM/projectM.pas @@ -344,8 +344,8 @@ type procedure addPCMfloat(PCMdata: PFLOAT, samples: INT); } procedure addPCM16(pcm_data: TPCM16); cdecl; external 'libprojectM.dll'; + procedure addPCM16Data(pcm_data: PSmallint; samples: Smallint); cdecl; external 'libprojectM.dll'; { - procedure addPCM16Data(const short* pcm_data, short samples); procedure addPCM8( unsigned char [2][512]); } -- cgit v1.2.3 From 3363e2079c5fee09bc65bdad9342571b7fc23dc0 Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 6 Dec 2007 10:42:49 +0000 Subject: added projectM switch (disabled by default) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@680 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/switches.inc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index 15fb31bb..d8d811b6 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -34,10 +34,13 @@ {$IFDEF win32} {$DEFINE UseBASSOutput} -// {$DEFINE UseBASSInput} + {$DEFINE UseBASSInput} - {$DEFINE UsePortaudio} + //{$DEFINE UsePortaudio} //{$DEFINE UsePortmixer} + + //{$DEFINE UseProjectM} + {$IFDEF DEBUG} {$IFNDEF DARWIN} {$APPTYPE CONSOLE} -- cgit v1.2.3 From 553ee1ad981964a3689e6510d5813dbff0f2119c Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 6 Dec 2007 10:46:53 +0000 Subject: added "V" key to sing screen to start Visualization... git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@681 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UVideo.pas | 23 +++++++++++------------ Game/Code/Classes/UVisualizer.pas | 26 ++++++++++++-------------- Game/Code/Screens/UScreenSing.pas | 17 +++++++++-------- 3 files changed, 32 insertions(+), 34 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index c2e42224..62351e2d 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -96,22 +96,21 @@ type function find_stream_ids( const aFormatCtx : PAVFormatContext; Out aFirstVideoStream, aFirstAudioStream : integer ): boolean; public constructor create(); - function GetName: String; + function GetName: String; + procedure init(); - procedure init(); + function Open( aFileName : string): boolean; // true if succeed + procedure Close; - function Open( aFileName : string): boolean; // true if succeed - procedure Close; + procedure Play; + procedure Pause; + procedure Stop; - procedure Play; - procedure Pause; - procedure Stop; + procedure MoveTo(Time: real); + function getPosition: real; - procedure MoveTo(Time: real); - function getPosition: real; - - procedure GetFrame(Time: Extended); // WANT TO RENAME THESE TO BE MORE GENERIC - procedure DrawGL(Screen: integer); // WANT TO RENAME THESE TO BE MORE GENERIC + procedure GetFrame(Time: Extended); + procedure DrawGL(Screen: integer); end; diff --git a/Game/Code/Classes/UVisualizer.pas b/Game/Code/Classes/UVisualizer.pas index 0f2334ba..6fb5b7a7 100644 --- a/Game/Code/Classes/UVisualizer.pas +++ b/Game/Code/Classes/UVisualizer.pas @@ -63,22 +63,21 @@ type procedure VisualizerTogglePause; public constructor create(); - function GetName: String; + procedure init(); + function GetName: String; - procedure init(); + function Open( aFileName : string): boolean; // true if succeed + procedure Close; - function Open( aFileName : string): boolean; // true if succeed - procedure Close; + procedure Play; + procedure Pause; + procedure Stop; - procedure Play; - procedure Pause; - procedure Stop; + procedure MoveTo(Time: real); + function getPosition: real; - procedure MoveTo(Time: real); - function getPosition: real; - - procedure GetFrame(Time: Extended); // WANT TO RENAME THESE TO BE MORE GENERIC - procedure DrawGL(Screen: integer); // WANT TO RENAME THESE TO BE MORE GENERIC + procedure GetFrame(Time: Extended); + procedure DrawGL(Screen: integer); end; @@ -188,8 +187,7 @@ end; procedure TVideoPlayback_ProjectM.VisualizerTogglePause; begin - if VisualizerPaused then VisualizerPaused:=False - else VisualizerPaused:=True; + VisualizerPaused := not VisualizerPaused; end; procedure TVideoPlayback_ProjectM.GetFrame(Time: Extended); diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index c3bb78d2..b3b92446 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -150,6 +150,13 @@ begin begin Pause; end; + + SDLK_V: //Show Visualization + begin + AktSong.VideoLoaded := not AktSong.VideoLoaded; + VideoPlayback.play; + + end; SDLK_RETURN: begin @@ -183,7 +190,7 @@ begin // pause Video if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then VideoPlayback.Pause; -// FFmpegTogglePause; + end else //Pause ausschalten begin @@ -197,8 +204,6 @@ begin // Video if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then VideoPlayback.Pause; -// FFmpegTogglePause; - //SkipSmpeg(PauseTime); Paused := false; end; @@ -427,14 +432,9 @@ begin // set movie if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin -(* OpenSmpeg(AktSong.Path + AktSong.Video); - SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*) - // todo: VideoGap and Start time verwursten -// FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); VideoPlayback.Open( AktSong.Path + AktSong.Video ); -// FFmpegSkip(AktSong.VideoGAP + AktSong.Start); VideoPlayback.position := AktSong.VideoGAP + AktSong.Start; AktSong.VideoLoaded := true; @@ -1119,6 +1119,7 @@ begin // update and draw movie if ShowFinish and AktSong.VideoLoaded then +// if ShowFinish then begin try // UpdateSmpeg; // this only draws -- cgit v1.2.3 From 886b7205df1355054eda3cb72b65c77ec8a40d73 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 6 Dec 2007 11:19:36 +0000 Subject: added [tab] to change visualization preset git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@682 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UVisualizer.pas | 33 +++++++++++++++++++++++++++++++++ Game/Code/Screens/UScreenSing.pas | 6 ++++++ 2 files changed, 39 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UVisualizer.pas b/Game/Code/Classes/UVisualizer.pas index 6fb5b7a7..08e4b594 100644 --- a/Game/Code/Classes/UVisualizer.pas +++ b/Game/Code/Classes/UVisualizer.pas @@ -133,6 +133,39 @@ end; procedure TVideoPlayback_ProjectM.MoveTo(Time: real); begin + // this code MAY be able to be cut down... but Im not 100% sure.. + // in here, we cant realy move to a specific time, since its all random generated + // but a call to this function will change the preset, which changes the pattern + projectM_reset(pm); + + pm^.fullscreen := 0; + pm^.renderTarget^.texsize := texsize; + pm^.gx := gx; + pm^.gy := gy; + pm^.fps := fps; + pm^.renderTarget^.usePbuffers := 0; + + pm^.fontURL := PChar(projectM_Dir+'/fonts'); + pm^.presetURL := PChar(projectM_Dir+'/presets'); + + glPushAttrib(GL_ALL_ATTRIB_BITS); + projectM_init(pm); + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + + projectM_resetGL(pm, ScreenW, ScreenH); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + glMatrixMode(GL_TEXTURE); + glPopMatrix(); + glPopAttrib(); + end; function TVideoPlayback_ProjectM.getPosition: real; diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index b3b92446..e62b9339 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -157,6 +157,12 @@ begin VideoPlayback.play; end; + + SDLK_TAB: //Change Visualization Preset + begin + if AktSong.VideoLoaded then + VideoPlayback.MoveTo( now ); // move to a random position + end; SDLK_RETURN: begin -- cgit v1.2.3 From d3f1d5ec15ea7dae7252f9b71e2659dd94ee2075 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 6 Dec 2007 11:48:37 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@685 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.dpr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 49ba145d..82dab1c7 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -133,7 +133,7 @@ uses //------------------------------ UMusic in 'Classes\UMusic.pas', UMedia_dummy in 'Classes\UMedia_dummy.pas', -// UVideo in 'Classes\UVideo.pas', + UVideo in 'Classes\UVideo.pas', {$ifdef UseBass} UAudio_bass in 'Classes\UAudio_bass.pas', {$endif} -- cgit v1.2.3 From 8514766ed130d4c8d7cd06fce956ace10f5afeb9 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 6 Dec 2007 11:54:46 +0000 Subject: turn on visualization git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@686 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/switches.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index d8d811b6..5811979e 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -39,7 +39,7 @@ //{$DEFINE UsePortaudio} //{$DEFINE UsePortmixer} - //{$DEFINE UseProjectM} + {$DEFINE UseProjectM} {$IFDEF DEBUG} {$IFNDEF DARWIN} -- cgit v1.2.3 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/Classes/UMedia_dummy.pas | 2 +- Game/Code/Classes/UMusic.pas | 24 ++++++++++++++++-- Game/Code/Classes/UVisualizer.pas | 2 +- Game/Code/Screens/UScreenSing.pas | 51 +++++++++++++++++++++++++------------- Game/Code/UltraStar.dpr | 6 ++--- 5 files changed, 61 insertions(+), 24 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMedia_dummy.pas b/Game/Code/Classes/UMedia_dummy.pas index c5fb799c..4fc39d4e 100644 --- a/Game/Code/Classes/UMedia_dummy.pas +++ b/Game/Code/Classes/UMedia_dummy.pas @@ -29,7 +29,7 @@ var singleton_dummy : IVideoPlayback; type - Tmedia_dummy = class( TInterfacedObject, IVideoPlayback, IAudioPlayback, IAudioInput ) + Tmedia_dummy = class( TInterfacedObject, IVideoPlayback, IVideoVisualization, IAudioPlayback, IAudioInput ) private public constructor create(); diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index 4acbb55a..2cdcc707 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -131,6 +131,10 @@ type end; + IVideoVisualization = Interface( IVideoPlayback ) + ['{5AC17D60-B34D-478D-B632-EB00D4078017}'] + end; + IAudioPlayback = Interface( IGenericPlayback ) ['{E4AE0B40-3C21-4DC5-847C-20A87E0DFB96}'] procedure InitializePlayback; @@ -195,7 +199,8 @@ var // TODO : JB --- THESE SHOULD NOT BE GLOBAL procedure InitializeSound; - + +function Visualization(): IVideoPlayback; function VideoPlayback(): IVideoPlayback; function AudioPlayback(): IAudioPlayback; function AudioInput(): IAudioInput; @@ -210,9 +215,11 @@ uses // uLog; var - singleton_VideoPlayback : IVideoPlayback = nil; + singleton_VideoPlayback : IVideoPlayback = nil; + singleton_Visualization : IVideoPlayback = nil; singleton_AudioPlayback : IAudioPlayback = nil; singleton_AudioInput : IAudioInput = nil; + singleton_AudioManager : TInterfaceList = nil; @@ -230,6 +237,11 @@ begin result := singleton_VideoPlayback; end; +function Visualization(): IVideoPlayback; +begin + result := singleton_Visualization; +end; + function AudioPlayback(): IAudioPlayback; begin result := singleton_AudioPlayback; @@ -250,6 +262,7 @@ begin singleton_AudioPlayback := nil; singleton_AudioInput := nil; singleton_VideoPlayback := nil; + singleton_Visualization := nil; writeln( 'InitializeSound , Enumerate Registered Audio Interfaces' ); for iCount := 0 to AudioManager.Count - 1 do @@ -276,12 +289,19 @@ begin // if this interface is a Input, then set it as the default used if ( AudioManager[iCount].QueryInterface( IVideoPlayback, lTmpInterface ) = 0 ) AND + //( AudioManager[iCount].QueryInterface( IVideoVisualization, lTmpInterface ) <> 0 ) AND ( true ) then // ( not assigned( singleton_VideoPlayback ) ) then begin singleton_VideoPlayback := IVideoPlayback( lTmpInterface ); end; + if ( AudioManager[iCount].QueryInterface( IVideoVisualization, lTmpInterface ) = 0 ) AND + ( true ) then + begin + singleton_Visualization := IVideoPlayback( lTmpInterface ); + end; + end; end; diff --git a/Game/Code/Classes/UVisualizer.pas b/Game/Code/Classes/UVisualizer.pas index 08e4b594..b6b3a1cc 100644 --- a/Game/Code/Classes/UVisualizer.pas +++ b/Game/Code/Classes/UVisualizer.pas @@ -45,7 +45,7 @@ const projectM_Dir = visuals_Dir+'/projectM'; type - TVideoPlayback_ProjectM = class( TInterfacedObject, IVideoPlayback ) + TVideoPlayback_ProjectM = class( TInterfacedObject, IVideoPlayback, IVideoVisualization ) pm : PProjectM; 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; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 82dab1c7..6394113a 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -133,6 +133,9 @@ uses //------------------------------ UMusic in 'Classes\UMusic.pas', UMedia_dummy in 'Classes\UMedia_dummy.pas', +{$IFDEF UseProjectM} + UVisualizer in 'Classes\UVisualizer.pas', // MUST be before Video... +{$ENDIF} UVideo in 'Classes\UVideo.pas', {$ifdef UseBass} UAudio_bass in 'Classes\UAudio_bass.pas', @@ -144,9 +147,6 @@ uses UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', {$endif} -{$IFDEF UseProjectM} - UVisualizer in 'Classes\UVisualizer.pas', -{$ENDIF} //------------------------------ //Includes - Screens -- cgit v1.2.3 From 011d12dd56e5c18e08c311e880d010e73674a029 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 6 Dec 2007 12:31:25 +0000 Subject: added some comments git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@688 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.dpr | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 6394113a..bd8c42ac 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -131,10 +131,12 @@ uses //Includes - Media support classes.... // Make sure UMedia always first, then UMedia_dummy //------------------------------ + + // TODO : these all need to be renamed like UMedia_******** for consistency UMusic in 'Classes\UMusic.pas', - UMedia_dummy in 'Classes\UMedia_dummy.pas', + UMedia_dummy in 'Classes\UMedia_dummy.pas', // Must be first UMedia Unit, all others will override available interfaces {$IFDEF UseProjectM} - UVisualizer in 'Classes\UVisualizer.pas', // MUST be before Video... + UVisualizer in 'Classes\UVisualizer.pas', // MUST be before Video... so video can override... {$ENDIF} UVideo in 'Classes\UVideo.pas', {$ifdef UseBass} -- cgit v1.2.3 From 5ec90c178c0c04b42ed80918d0497bb24ee774ed Mon Sep 17 00:00:00 2001 From: mogguh Date: Thu, 6 Dec 2007 15:01:07 +0000 Subject: Fixed array issues, moving through the several arrays is ugly - but at least it works git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@689 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenScore.pas | 355 ++++++++++++++++++------------------- 1 file changed, 171 insertions(+), 184 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 3537a26d..0ed04b89 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -61,17 +61,17 @@ type Animation: real; Fadeout: boolean; - BarScore_ActualHeight : array[1..6] of real; - BarPhrase_ActualHeight : array[1..6] of real; - BarGolden_ActualHeight : array[1..6] of real; + BarScore_ActualHeight : array[0..5] of real; + BarPhrase_ActualHeight : array[0..5] of real; + BarGolden_ActualHeight : array[0..5] of real; BarScore_EaseOut_Step : real; BarPhrase_EaseOut_Step : real; BarGolden_EaseOut_Step : real; - TextScore_ActualValue : array[1..6] of integer; - TextPhrase_ActualValue : array[1..6] of integer; - TextGolden_ActualValue : array[1..6] of integer; + TextScore_ActualValue : array[0..5] of integer; + TextPhrase_ActualValue : array[0..5] of integer; + TextGolden_ActualValue : array[0..5] of integer; EaseOut_MaxSteps : real; @@ -150,44 +150,41 @@ begin LoadFromTheme(Theme.Score); TextArtist := AddText(Theme.Score.TextArtist); - TextTitle := AddText(Theme.Score.TextTitle); + TextTitle := AddText(Theme.Score.TextTitle); TextArtistTitle := AddText(Theme.Score.TextArtistTitle); - for P := 1 to 6 do begin - TextName[P] := AddText(Theme.Score.TextName[P]); - TextScore[P] := AddText(Theme.Score.TextScore[P]); - - TextNotes[P] := AddText(Theme.Score.TextNotes[P]); - TextNotesScore[P] := AddText(Theme.Score.TextNotesScore[P]); - TextLineBonus[P] := AddText(Theme.Score.TextLineBonus[P]); - TextLineBonusScore[P] := AddText(Theme.Score.TextLineBonusScore[P]); - TextGoldenNotes[P] := AddText(Theme.Score.TextGoldenNotes[P]); - TextGoldenNotesScore[P] := AddText(Theme.Score.TextGoldenNotesScore[P]); - TextTotal[P] := AddText(Theme.Score.TextTotal[P]); - TextTotalScore[P] := AddText(Theme.Score.TextTotalScore[P]); - - SetLength(PlayerStatic[P], Length(Theme.Score.PlayerStatic[P])); - - SetLength(PlayerTexts[P], Length(Theme.Score.PlayerTexts[P])); + for P := 1 to 6 do + begin + SetLength(PlayerStatic[P], Length(Theme.Score.PlayerStatic[P])); + SetLength(PlayerTexts[P], Length(Theme.Score.PlayerTexts[P])); for I := 0 to High(Theme.Score.PlayerStatic[P]) do - PlayerStatic[P, I] := AddStatic(Theme.Score.PlayerStatic[P, I]); + PlayerStatic[P, I] := AddStatic(Theme.Score.PlayerStatic[P, I]); - - //added by mog for C := 0 to High(Theme.Score.PlayerTexts[P]) do - PlayerTexts[P, C] := AddText(Theme.Score.PlayerTexts[P, C]); - // more skinable now - - StaticBoxLightest[P] := AddStatic(Theme.Score.StaticBoxLightest[P]); - StaticBoxLight[P] := AddStatic(Theme.Score.StaticBoxLight[P]); - StaticBoxDark[P] := AddStatic(Theme.Score.StaticBoxDark[P]); - - StaticBackLevel[P] := AddStatic(Theme.Score.StaticBackLevel[P]); - StaticBackLevelRound[P] := AddStatic(Theme.Score.StaticBackLevelRound[P]); - StaticLevel[P] := AddStatic(Theme.Score.StaticLevel[P]); - StaticLevelRound[P] := AddStatic(Theme.Score.StaticLevelRound[P]); + PlayerTexts[P, C] := AddText(Theme.Score.PlayerTexts[P, C]); + + TextName[P] := AddText(Theme.Score.TextName[P]); + TextScore[P] := AddText(Theme.Score.TextScore[P]); + + TextNotes[P] := AddText(Theme.Score.TextNotes[P]); + TextNotesScore[P] := AddText(Theme.Score.TextNotesScore[P]); + TextLineBonus[P] := AddText(Theme.Score.TextLineBonus[P]); + TextLineBonusScore[P] := AddText(Theme.Score.TextLineBonusScore[P]); + TextGoldenNotes[P] := AddText(Theme.Score.TextGoldenNotes[P]); + TextGoldenNotesScore[P] := AddText(Theme.Score.TextGoldenNotesScore[P]); + TextTotal[P] := AddText(Theme.Score.TextTotal[P]); + TextTotalScore[P] := AddText(Theme.Score.TextTotalScore[P]); + + StaticBoxLightest[P] := AddStatic(Theme.Score.StaticBoxLightest[P]); + StaticBoxLight[P] := AddStatic(Theme.Score.StaticBoxLight[P]); + StaticBoxDark[P] := AddStatic(Theme.Score.StaticBoxDark[P]); + + StaticBackLevel[P] := AddStatic(Theme.Score.StaticBackLevel[P]); + StaticBackLevelRound[P] := AddStatic(Theme.Score.StaticBackLevelRound[P]); + StaticLevel[P] := AddStatic(Theme.Score.StaticLevel[P]); + StaticLevelRound[P] := AddStatic(Theme.Score.StaticLevelRound[P]); end; end; @@ -203,124 +200,91 @@ var MaxH: real; // maximum height of score bar Wsp: real; begin -{* - CountSkipTimeSet; - - Animation := 0; - Fadeout := false; - - Text[1].Text := AktSong.Artist + ' - ' + AktSong.Title; - Text[2].Text := ' ' + IntToStr((Round(Gracz[0].Punkty) div 10) * 10) + ' points'; - - Static[0].Texture.X := -2000; - Static[1].Texture.X := -2000; - Static[2].Texture.X := -2000; - Static[3].Texture.X := -2000; - Static[4].Texture.X := -2000; - Static[5].Texture.X := -2000; - Static[6].Texture.X := -2000; - Static[7].Texture.X := -2000; - - Text[0].X := -2000; - Text[1].X := -2000; - Text[2].X := -2000; - Text[3].X := -2000; - - - case (Round(Gracz[0].Punkty) div 10) * 10 of - 0..1000: Text[3].Text := ' Tone Deaf'; - 2010..4000: Text[3].Text := ' Amateur'; - 4010..6000: Text[3].Text := ' Rising Star'; - 6010..8000: Text[3].Text := ' Lead Singer'; - 8010..9000: Text[3].Text := ' Hit Artist'; - 9010..10000: Text[3].Text := ' Superstar'; - end; - - Music.PlayShuffle; -*} // Singstar Fadeout := false; - Text[TextArtist].Text := AktSong.Artist; - Text[TextTitle].Text := AktSong.Title; + Text[TextArtist].Text := AktSong.Artist; + Text[TextTitle].Text := AktSong.Title; Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; // set visibility - case PlayersPlay of - 1: begin - V[1] := true; - V[2] := false; - V[3] := false; - V[4] := false; - V[5] := false; - V[6] := false; - end; - 2, 4: begin - V[1] := false; - V[2] := true; - V[3] := true; - V[4] := false; - V[5] := false; - V[6] := false; - end; - 3, 6: begin - V[1] := false; - V[2] := false; - V[3] := false; - V[4] := true; - V[5] := true; - V[6] := true; - end; - end; - - for P := 1 to 6 do begin - Text[TextName[P]].Visible := V[P]; - Text[TextScore[P]].Visible := V[P]; - - // We set alpha to 0 , so we can nicely blend them in when we need them - Text[TextScore[P]].Alpha := 0; - Text[TextNotesScore[P]].Alpha := 0; - Text[TextNotes[P]].Alpha := 0; - Text[TextLineBonus[P]].Alpha := 0; - Text[TextLineBonusScore[P]].Alpha := 0; - Text[TextGoldenNotes[P]].Alpha := 0; - Text[TextGoldenNotesScore[P]].Alpha := 0; - Text[TextTotal[P]].Alpha := 0; - Text[TextTotalScore[P]].Alpha := 0; - - Text[TextNotes[P]].Visible := V[P]; - Text[TextNotesScore[P]].Visible := V[P]; - Text[TextLineBonus[P]].Visible := V[P]; - Text[TextLineBonusScore[P]].Visible := V[P]; - Text[TextGoldenNotes[P]].Visible := V[P]; - Text[TextGoldenNotesScore[P]].Visible := V[P]; - Text[TextTotal[P]].Visible := V[P]; - Text[TextTotalScore[P]].Visible := V[P]; - - for I := 0 to high(PlayerStatic[P]) do - Static[PlayerStatic[P, I]].Visible := V[P]; - - for I := 0 to high(PlayerTexts[P]) do - Text[PlayerTexts[P, I]].Visible := V[P]; - - Static[StaticBoxLightest[P]].Visible := V[P]; - Static[StaticBoxLight[P]].Visible := V[P]; - Static[StaticBoxDark[P]].Visible := V[P]; - - Static[StaticBackLevel[P]].Visible := false; //V[P]; - Static[StaticBackLevelRound[P]].Visible := false; //V[P]; - Static[StaticLevel[P]].Visible := false; //V[P]; - Static[StaticLevelRound[P]].Visible := false; //V[P]; + case PlayersPlay of + 1: begin + V[1] := true; + V[2] := false; + V[3] := false; + V[4] := false; + V[5] := false; + V[6] := false; + end; + 2, 4: begin + V[1] := false; + V[2] := true; + V[3] := true; + V[4] := false; + V[5] := false; + V[6] := false; + end; + 3, 6: begin + V[1] := false; + V[2] := false; + V[3] := false; + V[4] := true; + V[5] := true; + V[6] := true; + end; end; + for P := 1 to 6 do + begin + Text[TextName[P]].Visible := V[P]; + Text[TextScore[P]].Visible := V[P]; + + // We set alpha to 0 , so we can nicely blend them in when we need them + Text[TextScore[P]].Alpha := 0; + Text[TextNotesScore[P]].Alpha := 0; + Text[TextNotes[P]].Alpha := 0; + Text[TextLineBonus[P]].Alpha := 0; + Text[TextLineBonusScore[P]].Alpha := 0; + Text[TextGoldenNotes[P]].Alpha := 0; + Text[TextGoldenNotesScore[P]].Alpha := 0; + Text[TextTotal[P]].Alpha := 0; + Text[TextTotalScore[P]].Alpha := 0; + + + Text[TextNotes[P]].Visible := V[P]; + Text[TextNotesScore[P]].Visible := V[P]; + Text[TextLineBonus[P]].Visible := V[P]; + Text[TextLineBonusScore[P]].Visible := V[P]; + Text[TextGoldenNotes[P]].Visible := V[P]; + Text[TextGoldenNotesScore[P]].Visible := V[P]; + Text[TextTotal[P]].Visible := V[P]; + Text[TextTotalScore[P]].Visible := V[P]; + + for I := 0 to high(PlayerStatic[P]) do + Static[PlayerStatic[P, I]].Visible := V[P]; + + for I := 0 to high(PlayerTexts[P]) do + Text[PlayerTexts[P, I]].Visible := V[P]; + + Static[StaticBoxLightest[P]].Visible := V[P]; + Static[StaticBoxLight[P]].Visible := V[P]; + Static[StaticBoxDark[P]].Visible := V[P]; + +// + Static[StaticBackLevel[P]].Visible := false; + Static[StaticBackLevelRound[P]].Visible := false; + Static[StaticLevel[P]].Visible := false; + Static[StaticLevelRound[P]].Visible := false; + end; end; procedure TScreenScore.onShowFinish; var index : integer; begin -for index := 1 to 2 do +for index := 0 to (PlayersPlay-1) do begin BarScore_ActualHeight[index] := 0; BarPhrase_ActualHeight[index] := 0; @@ -331,7 +295,6 @@ for index := 1 to 2 do TextGolden_ActualValue[index] := 0; end; - BarScore_EaseOut_Step := 1; BarPhrase_EaseOut_Step := 1; BarGolden_EaseOut_Step := 1; @@ -354,6 +317,7 @@ var C: integer; katze : integer; + ArrayStartModifier : integer; begin // 0.5.0: try also use 4 players screen with nicks @@ -395,22 +359,45 @@ begin end; inherited Draw; -{ - player[1].ScoreI := 7000; - player[1].ScoreLineI := 2000; - player[1].ScoreGoldenI := 1000; - - player[2].ScoreI := 2500; - player[2].ScoreLineI := 1100; - player[2].ScoreGoldenI := 900; - } + + //player[1].ScoreI := 7000; + //player[1].ScoreLineI := 2000; + //player[1].ScoreGoldenI := 1000; + + //player[2].ScoreI := 2500; + //player[2].ScoreLineI := 1100; + //player[2].ScoreGoldenI := 900; + // Let's arise the bars ActualTime := GetTickCount div 33; if ((ActualTime <> OldTime) and ShowFinish )then begin OldTime := ActualTime; - For katze:= 0 to 5 do +// okay i hate that as much as you might do too, but there's no way around that yet (imho) +// all statics / texts are loaded at start - so that we have them all even if we change the amount of players +// array overview: + +// 1 Player -> Player[0].Score (The score for one player starts at 0) +// -> Statics[1] (The statics for the one player screen start at 0) +// 2 Player -> Player[0..1].Score +// -> Statics[2..3] +// 3 Player -> Player[0..5].Score +// -> Statics[4..6] + + case PlayersPlay of + 1: begin + ArrayStartModifier := 1; + end; + 2, 4: begin + ArrayStartModifier := 2; + end; + 3, 6: begin + ArrayStartModifier := 4; + end; + end; + + For katze:= 0 to (PlayersPlay-1) do begin // We actually araise them in the right order, but we have to draw them in reverse order (golden -> phrase -> mainscore) @@ -436,72 +423,72 @@ begin // Draw golden score bar # //######################## - BarGolden_ActualHeight[katze] := RaiseBar(katze, - Static[StaticBackLevel[katze+1]].Texture.y - BarScore_ActualHeight[katze] - BarPhrase_ActualHeight[katze], + BarGolden_ActualHeight[katze] := RaiseBar(katze + ArrayStartModifier, + Static[StaticBackLevel[katze + ArrayStartModifier]].Texture.y - BarScore_ActualHeight[katze] - BarPhrase_ActualHeight[katze], BarGolden_ActualHeight[katze], - player[katze+1].ScoreGoldenI, + player[katze].ScoreGoldenI, 'Lightest', BarGolden_EaseOut_Step); // Increment and show total score and plain score TextGolden_ActualValue[katze] := IncrementScore(katze, TextGolden_ActualValue[katze], - Player[katze+1].ScoreGoldenI, + Player[katze].ScoreGoldenI, BarGolden_EaseOut_Step); - Text[TextGoldenNotesScore[katze+1]].Text := IntToStr(TextGolden_ActualValue[katze]); + Text[TextGoldenNotesScore[katze + ArrayStartModifier]].Text := IntToStr(TextGolden_ActualValue[katze]); // Blend in - Text[TextGoldenNotesScore[katze+1]].Alpha := (BarGolden_EaseOut_Step / 100); - Text[TextGoldenNotes[katze+1]].Alpha := (BarGolden_EaseOut_Step / 100); + Text[TextGoldenNotesScore[katze + ArrayStartModifier]].Alpha := (BarGolden_EaseOut_Step / 100); + Text[TextGoldenNotes[katze + ArrayStartModifier]].Alpha := (BarGolden_EaseOut_Step / 100); end; //######################## // Draw phrase score bar # //######################## - BarPhrase_ActualHeight[katze] := RaiseBar(katze, - Static[StaticBackLevel[katze+1]].Texture.y - BarScore_ActualHeight[katze], + BarPhrase_ActualHeight[katze] := RaiseBar(katze + ArrayStartModifier, + Static[StaticBackLevel[katze + ArrayStartModifier]].Texture.y - BarScore_ActualHeight[katze], BarPhrase_ActualHeight[katze], - Player[katze+1].ScoreLineI, + Player[katze].ScoreLineI, 'Light', BarPhrase_EaseOut_Step); // Increment and show total score and plain score TextPhrase_ActualValue[katze] := IncrementScore(katze, TextPhrase_ActualValue[katze], - Player[katze+1].ScoreLineI, + Player[katze].ScoreLineI, BarPhrase_EaseOut_Step); - Text[TextLineBonusScore[katze+1]].Text := IntToStr(TextPhrase_ActualValue[katze]); + Text[TextLineBonusScore[katze + ArrayStartModifier]].Text := IntToStr(TextPhrase_ActualValue[katze]); //Blend in - Text[TextLineBonusScore[katze+1]].Alpha := (BarPhrase_EaseOut_Step / 100); - Text[TextLineBonus[katze+1]].Alpha := (BarPhrase_EaseOut_Step / 100); + Text[TextLineBonusScore[katze + ArrayStartModifier]].Alpha := (BarPhrase_EaseOut_Step / 100); + Text[TextLineBonus[katze + ArrayStartModifier]].Alpha := (BarPhrase_EaseOut_Step / 100); end; //####################### // Draw plain score bar # //####################### - BarScore_ActualHeight[katze] := RaiseBar(katze, - Static[StaticBackLevel[katze+1]].Texture.y, + BarScore_ActualHeight[katze] := RaiseBar(katze + ArrayStartModifier, + Static[StaticBackLevel[katze + ArrayStartModifier]].Texture.y, BarScore_ActualHeight[katze], - Player[katze+1].ScoreI, + Player[katze].ScoreI, 'Dark', BarScore_EaseOut_Step); // Increment and show total score and plain score TextScore_ActualValue[katze] := IncrementScore(katze, TextScore_ActualValue[katze], - Player[katze+1].ScoreI, + Player[katze].ScoreI, BarScore_EaseOut_Step); - Text[TextNotesScore[katze+1]].Text := IntToStr(TextScore_ActualValue[katze]); + Text[TextNotesScore[katze + ArrayStartModifier]].Text := IntToStr(TextScore_ActualValue[katze]); - Text[TextTotalScore[katze+1]].Text := IntToStr(TextScore_ActualValue[katze] + TextPhrase_ActualValue[katze] + TextGolden_ActualValue[katze]); + Text[TextTotalScore[katze + ArrayStartModifier]].Text := IntToStr(TextScore_ActualValue[katze] + TextPhrase_ActualValue[katze] + TextGolden_ActualValue[katze]); //Blend em in - Text[TextTotalScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextTotal[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextNotesScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextNotes[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextTotalScore[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextTotal[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextNotesScore[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextNotes[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextScore[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); end; // me loop end; @@ -526,10 +513,10 @@ var lTmp : real; begin - MaxHeight := Static[StaticBackLevel[PlayerNumber + 1]].Texture.H; - Width := Static[StaticBackLevel[PlayerNumber + 1]].Texture.W; + MaxHeight := Static[StaticBackLevel[PlayerNumber]].Texture.H; + Width := Static[StaticBackLevel[PlayerNumber]].Texture.W; - BarStartPosX := Static[StaticBackLevel[PlayerNumber + 1]].Texture.X; + BarStartPosX := Static[StaticBackLevel[PlayerNumber]].Texture.X; BarStartPosY := BarStartPosY + MaxHeight; // The texture starts in the upper left corner, so let's subtract the height - so we can arise it @@ -559,11 +546,11 @@ begin NewHeight := Height2Reach; end; //+1 - LoadColor(R, G, B, 'P' + inttostr(PlayerNumber+1) + ColorBrightness); //dark, light, lightest + LoadColor(R, G, B, 'P' + inttostr(PlayerNumber) + ColorBrightness); //dark, light, lightest glColor4f(R, G, B, 1); //the actual bar - glBindTexture(GL_TEXTURE_2D, Static[StaticLevel[PlayerNumber + 1]].Texture.TexNum); + glBindTexture(GL_TEXTURE_2D, Static[StaticLevel[PlayerNumber]].Texture.TexNum); glEnable(GL_TEXTURE_2D); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -577,15 +564,15 @@ begin glEnd; //the round thing on top - glBindTexture(GL_TEXTURE_2D, Static[StaticLevelRound[PlayerNumber + 1]].Texture.TexNum); + glBindTexture(GL_TEXTURE_2D, Static[StaticLevelRound[PlayerNumber]].Texture.TexNum); glEnable(GL_TEXTURE_2D); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(BarStartPosX, (BarStartPosY - Static[StaticLevelRound[PlayerNumber + 1]].Texture.h) - NewHeight); - glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, (BarStartPosY - Static[StaticLevelRound[PlayerNumber + 1]].Texture.h) - NewHeight); + glTexCoord2f(0, 0); glVertex2f(BarStartPosX, (BarStartPosY - Static[StaticLevelRound[PlayerNumber]].Texture.h) - NewHeight); + glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, (BarStartPosY - Static[StaticLevelRound[PlayerNumber]].Texture.h) - NewHeight); glTexCoord2f(1, 1); glVertex2f(BarStartPosX + Width, BarStartPosY - NewHeight); glTexCoord2f(0, 1); glVertex2f(BarStartPosX, BarStartPosY - NewHeight); glEnd; -- cgit v1.2.3 From 20e43a8aeb1c9ea5fe29d2b9c9e9842826d2c7d8 Mon Sep 17 00:00:00 2001 From: mogguh Date: Thu, 6 Dec 2007 22:02:02 +0000 Subject: Singscreen: pop up is now faster Scorescreen: minor graphic edits git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@690 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/USingScores.pas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/USingScores.pas b/Game/Code/Classes/USingScores.pas index c7213180..894f5782 100644 --- a/Game/Code/Classes/USingScores.pas +++ b/Game/Code/Classes/USingScores.pas @@ -212,9 +212,9 @@ begin oPositionCount := 0; oPlayerCount := 0; - Settings.Phase1Time := 1000; - Settings.Phase2Time := 2000; - Settings.Phase3Time := 2000; + Settings.Phase1Time := 350; // plop it up . -> [ ] + Settings.Phase2Time := 550; // shift it up ^[ ]^ + Settings.Phase3Time := 200; // increase score [s++] Settings.PopUpTex[0].TexNum := High(gluInt); Settings.PopUpTex[1].TexNum := High(gluInt); -- cgit v1.2.3 From 73a9bf99b8993aa69f3ed77b36b0236fb1cde2ed Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 6 Dec 2007 23:53:46 +0000 Subject: trying to get projectM to run in linux git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@692 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UVisualizer.pas | 540 ++++++++++++++++--------------- Game/Code/lib/projectM/projectM.pas | 621 ++++++++++++++++++------------------ Game/Code/lib/requirements.txt | 7 +- Game/Code/switches.inc | 113 +++---- 4 files changed, 651 insertions(+), 630 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UVisualizer.pas b/Game/Code/Classes/UVisualizer.pas index b6b3a1cc..a49187e7 100644 --- a/Game/Code/Classes/UVisualizer.pas +++ b/Game/Code/Classes/UVisualizer.pas @@ -1,66 +1,65 @@ -{############################################################################ -# Visualizer support for UltraStar deluxe # -# # -# Created by hennymcc # -# Slight modifications by Jay Binks # -# based on UVideo.pas # -#############################################################################} - -unit UVisualizer; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -uses SDL, - UGraphicClasses, - textgl, - math, - OpenGL12, - SysUtils, - UIni, - {$ifdef DebugDisplay} - dialogs, - {$ENDIF} - projectM, - UMusic, - windows; - -implementation - -uses - UGraphic; - -var +{############################################################################ +# Visualizer support for UltraStar deluxe # +# # +# Created by hennymcc # +# Slight modifications by Jay Binks # +# based on UVideo.pas # +#############################################################################} + +unit UVisualizer; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses SDL, + UGraphicClasses, + textgl, + math, + OpenGL12, + SysUtils, + UIni, + {$ifdef DebugDisplay} + dialogs, + {$ENDIF} + projectM, + UMusic; + +implementation + +uses + UGraphic; + +var singleton_VideoProjectM : IVideoPlayback; - -const - gx = 32; - gy = 24; - fps = 30; - texsize = 512; - visuals_Dir = 'Visuals'; // TODO: move this to a place common for all visualizers - projectM_Dir = visuals_Dir+'/projectM'; - -type - TVideoPlayback_ProjectM = class( TInterfacedObject, IVideoPlayback, IVideoVisualization ) + +const + gx = 32; + gy = 24; + fps = 30; + texsize = 512; + visuals_Dir = 'Visuals'; // TODO: move this to a place common for all visualizers + projectM_Dir = visuals_Dir+'/projectM'; + +type + TVideoPlayback_ProjectM = class( TInterfacedObject, IVideoPlayback, IVideoVisualization ) pm : PProjectM; - - VisualizerStarted , - VisualizerPaused : Boolean; - - VisualTex : glUint; - PCMData : TPCMData; - hRC : Integer; - hDC : Integer; + + VisualizerStarted , + VisualizerPaused : Boolean; + + VisualTex : glUint; + PCMData : TPCMData; + hRC : Integer; + hDC : Integer; procedure VisualizerStart; procedure VisualizerStop; - - procedure VisualizerTogglePause; + + procedure VisualizerTogglePause; public constructor create(); procedure init(); @@ -79,40 +78,44 @@ type procedure GetFrame(Time: Extended); procedure DrawGL(Screen: integer); end; - - -constructor TVideoPlayback_ProjectM.create(); + + +constructor TVideoPlayback_ProjectM.create(); begin end; - - -procedure TVideoPlayback_ProjectM.init(); + + +procedure TVideoPlayback_ProjectM.init(); begin writeln( 'TVideoPlayback_ProjectM - INITIALIZE !!!!!!!!' ); - VisualizerStarted := False; - VisualizerPaused := False; - - glGenTextures(1, PglUint(@VisualTex)); - glBindTexture(GL_TEXTURE_2D, VisualTex); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); -end; - -function TVideoPlayback_ProjectM.GetName: String; + VisualizerStarted := False; + VisualizerPaused := False; + + glGenTextures(1, PglUint(@VisualTex)); + glBindTexture(GL_TEXTURE_2D, VisualTex); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + New(pm); + projectM_reset(pm); + +end; + +function TVideoPlayback_ProjectM.GetName: String; begin result := 'ProjectM'; end; - - -function TVideoPlayback_ProjectM.Open( aFileName : string): boolean; // true if succeed -begin - VisualizerStart(); - result := true; -end; - -procedure TVideoPlayback_ProjectM.Close; + + +function TVideoPlayback_ProjectM.Open( aFileName : string): boolean; // true if succeed +begin + VisualizerStart(); + result := true; +end; + +procedure TVideoPlayback_ProjectM.Close; begin end; @@ -137,33 +140,33 @@ begin // in here, we cant realy move to a specific time, since its all random generated // but a call to this function will change the preset, which changes the pattern projectM_reset(pm); - - pm^.fullscreen := 0; - pm^.renderTarget^.texsize := texsize; - pm^.gx := gx; - pm^.gy := gy; - pm^.fps := fps; - pm^.renderTarget^.usePbuffers := 0; - - pm^.fontURL := PChar(projectM_Dir+'/fonts'); - pm^.presetURL := PChar(projectM_Dir+'/presets'); - - glPushAttrib(GL_ALL_ATTRIB_BITS); - projectM_init(pm); - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glMatrixMode(GL_TEXTURE); - glPushMatrix(); - - projectM_resetGL(pm, ScreenW, ScreenH); - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); - glMatrixMode(GL_TEXTURE); - glPopMatrix(); + + pm^.fullscreen := 0; + pm^.renderTarget^.texsize := texsize; + pm^.gx := gx; + pm^.gy := gy; + pm^.fps := fps; + pm^.renderTarget^.usePbuffers := 0; + + pm^.fontURL := PChar(projectM_Dir+'/fonts'); + pm^.presetURL := PChar(projectM_Dir+'/presets'); + + glPushAttrib(GL_ALL_ATTRIB_BITS); + projectM_init(pm); + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + + projectM_resetGL(pm, ScreenW, ScreenH); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + glMatrixMode(GL_TEXTURE); + glPopMatrix(); glPopAttrib(); end; @@ -173,158 +176,165 @@ begin result := 0; end; -procedure TVideoPlayback_ProjectM.VisualizerStart; -begin - VisualizerStarted := True; - - New(pm); - projectM_reset(pm); - - pm^.fullscreen := 0; - pm^.renderTarget^.texsize := texsize; - pm^.gx := gx; - pm^.gy := gy; - pm^.fps := fps; - pm^.renderTarget^.usePbuffers := 0; - - pm^.fontURL := PChar(projectM_Dir+'/fonts'); - pm^.presetURL := PChar(projectM_Dir+'/presets'); - - glPushAttrib(GL_ALL_ATTRIB_BITS); - projectM_init(pm); - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glMatrixMode(GL_TEXTURE); - glPushMatrix(); - - projectM_resetGL(pm, ScreenW, ScreenH); - - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); - glMatrixMode(GL_TEXTURE); - glPopMatrix(); - glPopAttrib(); -end; - -procedure TVideoPlayback_ProjectM.VisualizerStop; -begin - if VisualizerStarted then begin - VisualizerStarted := False; - Dispose(pm); - end; -end; - -procedure TVideoPlayback_ProjectM.VisualizerTogglePause; -begin - VisualizerPaused := not VisualizerPaused; -end; - -procedure TVideoPlayback_ProjectM.GetFrame(Time: Extended); -var - i: integer; - nSamples: cardinal; -begin - if not VisualizerStarted then Exit; - if VisualizerPaused then Exit; - - // get audio data - nSamples := AudioPlayback.GetPCMData(PcmData); - addPCM16Data(PSmallInt(@PcmData), nSamples); - - // store OpenGL state (might be messed up otherwise) - glPushAttrib(GL_ALL_ATTRIB_BITS); - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glMatrixMode(GL_TEXTURE); - glPushMatrix(); - - // let projectM render a frame - renderFrame(pm); - glFlush(); - - {$IFDEF UseTexture} - glBindTexture(GL_TEXTURE_2D, VisualTex); - glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, VisualWidth, VisualHeight, 0); - {$ENDIF} - - // restore USDX OpenGL state - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); - glMatrixMode(GL_TEXTURE); - glPopMatrix(); - glPopAttrib(); - - // discard projectM's depth buffer information (avoid overlay) - glClear(GL_DEPTH_BUFFER_BIT); -end; - -procedure TVideoPlayback_ProjectM.DrawGL(Screen: integer); -begin - {$IFDEF UseTexture} - // have a nice black background to draw on (even if there were errors opening the vid) - if Screen=1 then begin - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - end; - // exit if there's nothing to draw - if not VisualizerStarted then Exit; - - // setup display - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - gluOrtho2D(0, 1, 0, 1); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); - - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glBindTexture(GL_TEXTURE_2D, VisualTex); - glColor4f(1, 1, 1, 1); - - // draw projectM frame - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(0, 0); - glTexCoord2f(1, 0); glVertex2f(1, 0); - glTexCoord2f(1, 1); glVertex2f(1, 1); - glTexCoord2f(0, 1); glVertex2f(0, 1); - glEnd(); - - { - glbegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(400-VisualWidth/2, 300-VisualHeight/2); - glTexCoord2f(0, 1); - glVertex2f(400-VisualWidth/2, 300+VisualHeight/2); - glTexCoord2f(1, 1); - glVertex2f(400+VisualWidth/2, 300+VisualHeight/2); - glTexCoord2f(1, 0); - glVertex2f(400+VisualWidth/2, 300-VisualHeight/2); - glEnd; - } - - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - // restore state - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); - {$ENDIF} -end; - - +procedure TVideoPlayback_ProjectM.VisualizerStart; +begin + VisualizerStarted := True; + +// New(pm); +// projectM_reset(pm); + + writeln('Render Target'); + writeln( inttostr( integer( assigned(pm^.renderTarget) ) ) ); + + pm^.fullscreen := 0; + pm^.gx := gx; + pm^.gy := gy; + pm^.fps := fps; + + if assigned(pm^.renderTarget) then + begin + pm^.renderTarget^.texsize := texsize; + pm^.renderTarget^.usePbuffers := 0; + end; + + pm^.fontURL := PChar(projectM_Dir+'/fonts'); + pm^.presetURL := PChar(projectM_Dir+'/presets'); + + glPushAttrib(GL_ALL_ATTRIB_BITS); + projectM_init(pm); + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + + projectM_resetGL(pm, ScreenW, ScreenH); + + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + glMatrixMode(GL_TEXTURE); + glPopMatrix(); + glPopAttrib(); +end; + +procedure TVideoPlayback_ProjectM.VisualizerStop; +begin + if VisualizerStarted then begin + VisualizerStarted := False; + Dispose(pm); + end; +end; + +procedure TVideoPlayback_ProjectM.VisualizerTogglePause; +begin + VisualizerPaused := not VisualizerPaused; +end; + +procedure TVideoPlayback_ProjectM.GetFrame(Time: Extended); +var + i: integer; + nSamples: cardinal; +begin + if not VisualizerStarted then Exit; + if VisualizerPaused then Exit; + + // get audio data + nSamples := AudioPlayback.GetPCMData(PcmData); + addPCM16Data(PSmallInt(@PcmData), nSamples); + + // store OpenGL state (might be messed up otherwise) + glPushAttrib(GL_ALL_ATTRIB_BITS); + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + + // let projectM render a frame + renderFrame(pm); + glFlush(); + + {$IFDEF UseTexture} + glBindTexture(GL_TEXTURE_2D, VisualTex); + glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, VisualWidth, VisualHeight, 0); + {$ENDIF} + + // restore USDX OpenGL state + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + glMatrixMode(GL_TEXTURE); + glPopMatrix(); + glPopAttrib(); + + // discard projectM's depth buffer information (avoid overlay) + glClear(GL_DEPTH_BUFFER_BIT); +end; + +procedure TVideoPlayback_ProjectM.DrawGL(Screen: integer); +begin + {$IFDEF UseTexture} + // have a nice black background to draw on (even if there were errors opening the vid) + if Screen=1 then begin + glClearColor(0, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end; + // exit if there's nothing to draw + if not VisualizerStarted then Exit; + + // setup display + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + gluOrtho2D(0, 1, 0, 1); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + glBindTexture(GL_TEXTURE_2D, VisualTex); + glColor4f(1, 1, 1, 1); + + // draw projectM frame + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(0, 0); + glTexCoord2f(1, 0); glVertex2f(1, 0); + glTexCoord2f(1, 1); glVertex2f(1, 1); + glTexCoord2f(0, 1); glVertex2f(0, 1); + glEnd(); + + { + glbegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex2f(400-VisualWidth/2, 300-VisualHeight/2); + glTexCoord2f(0, 1); + glVertex2f(400-VisualWidth/2, 300+VisualHeight/2); + glTexCoord2f(1, 1); + glVertex2f(400+VisualWidth/2, 300+VisualHeight/2); + glTexCoord2f(1, 0); + glVertex2f(400+VisualWidth/2, 300-VisualHeight/2); + glEnd; + } + + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // restore state + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + {$ENDIF} +end; + + initialization singleton_VideoProjectM := TVideoPlayback_ProjectM.create(); @@ -334,6 +344,6 @@ initialization finalization AudioManager.Remove( singleton_VideoProjectM ); - - -end. + + +end. diff --git a/Game/Code/lib/projectM/projectM.pas b/Game/Code/lib/projectM/projectM.pas index be6f77b1..9adf5acf 100644 --- a/Game/Code/lib/projectM/projectM.pas +++ b/Game/Code/lib/projectM/projectM.pas @@ -1,27 +1,34 @@ -unit projectM; - -interface - -uses OpenGL12; - -type - FLOAT = Single; - PFLOAT = ^FLOAT; - PPFLOAT = ^PFLOAT; - INT = Integer; - SHORT = Smallint; - LONG = Longint; - -type - TPCM16 = array[0..1, 0..511] of SHORT; - -type - TTextureScale = INT; -const - SCALE_NEAREST = 0; - SCALE_MAGNIFY = 1; - SCALE_MINIFY = 2; - +unit projectM; + +interface + +uses OpenGL12; + +const + {$IFDEF win32} + libname = 'libprojectM.dll'; + {$Else} + libname = 'libprojectM.so'; + {$endif} + +type + FLOAT = Single; + PFLOAT = ^FLOAT; + PPFLOAT = ^PFLOAT; + INT = Integer; + SHORT = Smallint; + LONG = Longint; + +type + TPCM16 = array[0..1, 0..511] of SHORT; + +type + TTextureScale = INT; +const + SCALE_NEAREST = 0; + SCALE_MAGNIFY = 1; + SCALE_MINIFY = 2; + type TContextType = INT; const @@ -69,286 +76,286 @@ type procedure lockPBuffer( target: PRenderTarget; pass: PBufferPass ); procedure unlockPBuffer( target: PRenderTarget ); function nearestPower2( value: INT; scaleRule: TTextureScale ): INT; - } - - PProjectM = ^TProjectM; - TProjectM = record - presetURL: PChar; - presetName: PChar; - fontURL: PChar; - - hasInit: INT; - - noSwitch: INT; - pcmframes: INT; - freqframes: INT; - totalframes: INT; - - showfps: INT; - showtitle: INT; - showpreset: INT; - showhelp: INT; - showstats: INT; - - studio: INT; - - fbuffer: PGLubyte; - - {$ifndef Win32} - { The first ticks value of the application } - startTime: LONG; //struct timeval - {$else} - startTime: LONG; - {$endif Win32} - Time: FLOAT; - - { Render target texture ID } - renderTarget: PRenderTarget; - - disp: array[0..79] of Char; - - wave_o: FLOAT; - - //int texsize=1024; //size of texture to do actual graphics - fvw: INT; //fullscreen dimensions - fvh: INT; - wvw: INT; //windowed dimensions - wvh: INT; - vw: INT; //runtime dimensions - vh: INT; - fullscreen: INT; - - maxsamples: INT; //size of PCM buffer - numsamples: INT; //size of new PCM info - pcmdataL: PFLOAT; //holder for most recent pcm data - pcmdataR: PFLOAT; //holder for most recent pcm data - - avgtime: INT; //# frames per preset - - title: PChar; - drawtitle: INT; - - correction: INT; - - vol: FLOAT; - - //per pixel equation variables - gridx: PPFLOAT; //grid containing interpolated mesh - gridy: PPFLOAT; - origtheta: PPFLOAT; //grid containing interpolated mesh reference values - origrad: PPFLOAT; - origx: PPFLOAT; //original mesh - origy: PPFLOAT; - origx2: PPFLOAT; //original mesh - origy2: PPFLOAT; - - { Timing information } - mspf: INT; - timed: INT; - timestart: INT; - nohard: INT; - count: INT; - realfps, - fpsstart: FLOAT; - - { PCM data } - vdataL: array[0..511] of FLOAT; //holders for FFT data (spectrum) - vdataR: array[0..511] of FLOAT; - - { Various toggles } - doPerPixelEffects: INT; - doIterative: INT; - - { ENGINE VARIABLES } - { From engine_vars.h } - preset_name: array[0..255] of Char; - - { PER FRAME CONSTANTS BEGIN } - zoom: FLOAT; - zoomexp: FLOAT; - rot: FLOAT; - warp: FLOAT; - - sx: FLOAT; - sy: FLOAT; - dx: FLOAT; - dy: FLOAT; - cx: FLOAT; - cy: FLOAT; - - gy: INT; - gx: INT; - - decay: FLOAT; - - wave_r: FLOAT; - wave_g: FLOAT; - wave_b: FLOAT; - wave_x: FLOAT; - wave_y: FLOAT; - wave_mystery: FLOAT; - - ob_size: FLOAT; - ob_r: FLOAT; - ob_g: FLOAT; - ob_b: FLOAT; - ob_a: FLOAT; - - ib_size: FLOAT; - ib_r: FLOAT; - ib_g: FLOAT; - ib_b: FLOAT; - ib_a: FLOAT; - - meshx: INT; - meshy: INT; - - mv_a: FLOAT; - mv_r: FLOAT; - mv_g: FLOAT; - mv_b: FLOAT; - mv_l: FLOAT; - mv_x: FLOAT; - mv_y: FLOAT; - mv_dy: FLOAT; - mv_dx: FLOAT; - - treb: FLOAT; - mid: FLOAT; - bass: FLOAT; - bass_old: FLOAT; - beat_sensitivity: FLOAT; - treb_att: FLOAT; - mid_att: FLOAT; - bass_att: FLOAT; - progress: FLOAT; - frame: INT; - - { PER_FRAME CONSTANTS END } - - { PER_PIXEL CONSTANTS BEGIN } - - x_per_pixel: FLOAT; - y_per_pixel: FLOAT; - rad_per_pixel: FLOAT; - ang_per_pixel: FLOAT; - - { PER_PIXEL CONSTANT END } - - - fRating: FLOAT; - fGammaAdj: FLOAT; - fVideoEchoZoom: FLOAT; - fVideoEchoAlpha: FLOAT; - - nVideoEchoOrientation: INT; - nWaveMode: INT; - bAdditiveWaves: INT; - bWaveDots: INT; - bWaveThick: INT; - bModWaveAlphaByVolume: INT; - bMaximizeWaveColor: INT; - bTexWrap: INT; - bDarkenCenter: INT; - bRedBlueStereo: INT; - bBrighten: INT; - bDarken: INT; - bSolarize: INT; - bInvert: INT; - bMotionVectorsOn: INT; - fps: INT; - - fWaveAlpha: FLOAT; - fWaveScale: FLOAT; - fWaveSmoothing: FLOAT; - fWaveParam: FLOAT; - fModWaveAlphaStart: FLOAT; - fModWaveAlphaEnd: FLOAT; - fWarpAnimSpeed: FLOAT; - fWarpScale: FLOAT; - fShader: FLOAT; - - - { Q VARIABLES START } - - q1: FLOAT; - q2: FLOAT; - q3: FLOAT; - q4: FLOAT; - q5: FLOAT; - q6: FLOAT; - q7: FLOAT; - q8: FLOAT; - - - { Q VARIABLES END } - - zoom_mesh: PPFLOAT; - zoomexp_mesh: PPFLOAT; - rot_mesh: PPFLOAT; - - sx_mesh: PPFLOAT; - sy_mesh: PPFLOAT; - dx_mesh: PPFLOAT; - dy_mesh: PPFLOAT; - cx_mesh: PPFLOAT; - cy_mesh: PPFLOAT; - - x_mesh: PPFLOAT; - y_mesh: PPFLOAT; - rad_mesh: PPFLOAT; - theta_mesh: PPFLOAT; - end; - - { Functions } - procedure projectM_init(pm: PProjectM); cdecl; external 'libprojectM.dll'; - procedure projectM_reset(pm: PProjectM); cdecl; external 'libprojectM.dll'; - procedure projectM_resetGL(pm: PProjectM; width: INT; height: INT); cdecl; external 'libprojectM.dll'; - procedure projectM_setTitle(pm: PProjectM; title: PChar); cdecl; external 'libprojectM.dll'; - procedure renderFrame(pm: PProjectM); cdecl; external 'libprojectM.dll'; - - { - procedure draw_help(pm: PProjectM); - procedure draw_fps(pm: PProjectM; fps: Single); - procedure draw_preset(pm: PProjectM); - procedure draw_title(pm: PProjectM); - procedure draw_stats(pm: PProjectM); - - procedure modulate_opacity_by_volume(pm: PProjectM); - procedure maximize_colors(pm: PProjectM); - procedure do_per_pixel_math(pm: PProjectM); - procedure do_per_frame(pm: PProjectM); - procedure render_texture_to_studio(pm: PProjectM); - procedure darken_center(pm: PProjectM); - - procedure render_interpolation(pm: PProjectM); - procedure render_texture_to_screen(pm: PProjectM); - procedure render_texture_to_studio(pm: PProjectM); - procedure draw_motion_vectors(pm: PProjectM); - procedure draw_borders(pm: PProjectM); - procedure draw_shapes(pm: PProjectM); - procedure draw_waveform(pm: PProjectM); - procedure draw_custom_waves(pm: PProjectM); - - procedure draw_title_to_screen(pm: PProjectM); - procedure draw_title_to_texture(pm: PProjectM); - procedure get_title(pm: PProjectM); - - procedure reset_per_pixel_matrices(pm: PProjectM); - procedure init_per_pixel_matrices(pm: PProjectM); - procedure rescale_per_pixel_matrices(pm: PProjectM); - } - - { PCM.h declarations } - { - procedure addPCMfloat(PCMdata: PFLOAT, samples: INT); - } - procedure addPCM16(pcm_data: TPCM16); cdecl; external 'libprojectM.dll'; - procedure addPCM16Data(pcm_data: PSmallint; samples: Smallint); cdecl; external 'libprojectM.dll'; - { - procedure addPCM8( unsigned char [2][512]); - } - -implementation - -end. + } + + PProjectM = ^TProjectM; + TProjectM = record + presetURL: PChar; + presetName: PChar; + fontURL: PChar; + + hasInit: INT; + + noSwitch: INT; + pcmframes: INT; + freqframes: INT; + totalframes: INT; + + showfps: INT; + showtitle: INT; + showpreset: INT; + showhelp: INT; + showstats: INT; + + studio: INT; + + fbuffer: PGLubyte; + + {$ifndef Win32} + { The first ticks value of the application } + startTime: LONG; //struct timeval + {$else} + startTime: LONG; + {$endif Win32} + Time: FLOAT; + + { Render target texture ID } + renderTarget: PRenderTarget; + + disp: array[0..79] of Char; + + wave_o: FLOAT; + + //int texsize=1024; //size of texture to do actual graphics + fvw: INT; //fullscreen dimensions + fvh: INT; + wvw: INT; //windowed dimensions + wvh: INT; + vw: INT; //runtime dimensions + vh: INT; + fullscreen: INT; + + maxsamples: INT; //size of PCM buffer + numsamples: INT; //size of new PCM info + pcmdataL: PFLOAT; //holder for most recent pcm data + pcmdataR: PFLOAT; //holder for most recent pcm data + + avgtime: INT; //# frames per preset + + title: PChar; + drawtitle: INT; + + correction: INT; + + vol: FLOAT; + + //per pixel equation variables + gridx: PPFLOAT; //grid containing interpolated mesh + gridy: PPFLOAT; + origtheta: PPFLOAT; //grid containing interpolated mesh reference values + origrad: PPFLOAT; + origx: PPFLOAT; //original mesh + origy: PPFLOAT; + origx2: PPFLOAT; //original mesh + origy2: PPFLOAT; + + { Timing information } + mspf: INT; + timed: INT; + timestart: INT; + nohard: INT; + count: INT; + realfps, + fpsstart: FLOAT; + + { PCM data } + vdataL: array[0..511] of FLOAT; //holders for FFT data (spectrum) + vdataR: array[0..511] of FLOAT; + + { Various toggles } + doPerPixelEffects: INT; + doIterative: INT; + + { ENGINE VARIABLES } + { From engine_vars.h } + preset_name: array[0..255] of Char; + + { PER FRAME CONSTANTS BEGIN } + zoom: FLOAT; + zoomexp: FLOAT; + rot: FLOAT; + warp: FLOAT; + + sx: FLOAT; + sy: FLOAT; + dx: FLOAT; + dy: FLOAT; + cx: FLOAT; + cy: FLOAT; + + gy: INT; + gx: INT; + + decay: FLOAT; + + wave_r: FLOAT; + wave_g: FLOAT; + wave_b: FLOAT; + wave_x: FLOAT; + wave_y: FLOAT; + wave_mystery: FLOAT; + + ob_size: FLOAT; + ob_r: FLOAT; + ob_g: FLOAT; + ob_b: FLOAT; + ob_a: FLOAT; + + ib_size: FLOAT; + ib_r: FLOAT; + ib_g: FLOAT; + ib_b: FLOAT; + ib_a: FLOAT; + + meshx: INT; + meshy: INT; + + mv_a: FLOAT; + mv_r: FLOAT; + mv_g: FLOAT; + mv_b: FLOAT; + mv_l: FLOAT; + mv_x: FLOAT; + mv_y: FLOAT; + mv_dy: FLOAT; + mv_dx: FLOAT; + + treb: FLOAT; + mid: FLOAT; + bass: FLOAT; + bass_old: FLOAT; + beat_sensitivity: FLOAT; + treb_att: FLOAT; + mid_att: FLOAT; + bass_att: FLOAT; + progress: FLOAT; + frame: INT; + + { PER_FRAME CONSTANTS END } + + { PER_PIXEL CONSTANTS BEGIN } + + x_per_pixel: FLOAT; + y_per_pixel: FLOAT; + rad_per_pixel: FLOAT; + ang_per_pixel: FLOAT; + + { PER_PIXEL CONSTANT END } + + + fRating: FLOAT; + fGammaAdj: FLOAT; + fVideoEchoZoom: FLOAT; + fVideoEchoAlpha: FLOAT; + + nVideoEchoOrientation: INT; + nWaveMode: INT; + bAdditiveWaves: INT; + bWaveDots: INT; + bWaveThick: INT; + bModWaveAlphaByVolume: INT; + bMaximizeWaveColor: INT; + bTexWrap: INT; + bDarkenCenter: INT; + bRedBlueStereo: INT; + bBrighten: INT; + bDarken: INT; + bSolarize: INT; + bInvert: INT; + bMotionVectorsOn: INT; + fps: INT; + + fWaveAlpha: FLOAT; + fWaveScale: FLOAT; + fWaveSmoothing: FLOAT; + fWaveParam: FLOAT; + fModWaveAlphaStart: FLOAT; + fModWaveAlphaEnd: FLOAT; + fWarpAnimSpeed: FLOAT; + fWarpScale: FLOAT; + fShader: FLOAT; + + + { Q VARIABLES START } + + q1: FLOAT; + q2: FLOAT; + q3: FLOAT; + q4: FLOAT; + q5: FLOAT; + q6: FLOAT; + q7: FLOAT; + q8: FLOAT; + + + { Q VARIABLES END } + + zoom_mesh: PPFLOAT; + zoomexp_mesh: PPFLOAT; + rot_mesh: PPFLOAT; + + sx_mesh: PPFLOAT; + sy_mesh: PPFLOAT; + dx_mesh: PPFLOAT; + dy_mesh: PPFLOAT; + cx_mesh: PPFLOAT; + cy_mesh: PPFLOAT; + + x_mesh: PPFLOAT; + y_mesh: PPFLOAT; + rad_mesh: PPFLOAT; + theta_mesh: PPFLOAT; + end; + + { Functions } + procedure projectM_init(pm: PProjectM); cdecl; external libname; + procedure projectM_reset(pm: PProjectM); cdecl; external libname; + procedure projectM_resetGL(pm: PProjectM; width: INT; height: INT); cdecl; external libname; + procedure projectM_setTitle(pm: PProjectM; title: PChar); cdecl; external libname; + procedure renderFrame(pm: PProjectM); cdecl; external libname; + + { + procedure draw_help(pm: PProjectM); + procedure draw_fps(pm: PProjectM; fps: Single); + procedure draw_preset(pm: PProjectM); + procedure draw_title(pm: PProjectM); + procedure draw_stats(pm: PProjectM); + + procedure modulate_opacity_by_volume(pm: PProjectM); + procedure maximize_colors(pm: PProjectM); + procedure do_per_pixel_math(pm: PProjectM); + procedure do_per_frame(pm: PProjectM); + procedure render_texture_to_studio(pm: PProjectM); + procedure darken_center(pm: PProjectM); + + procedure render_interpolation(pm: PProjectM); + procedure render_texture_to_screen(pm: PProjectM); + procedure render_texture_to_studio(pm: PProjectM); + procedure draw_motion_vectors(pm: PProjectM); + procedure draw_borders(pm: PProjectM); + procedure draw_shapes(pm: PProjectM); + procedure draw_waveform(pm: PProjectM); + procedure draw_custom_waves(pm: PProjectM); + + procedure draw_title_to_screen(pm: PProjectM); + procedure draw_title_to_texture(pm: PProjectM); + procedure get_title(pm: PProjectM); + + procedure reset_per_pixel_matrices(pm: PProjectM); + procedure init_per_pixel_matrices(pm: PProjectM); + procedure rescale_per_pixel_matrices(pm: PProjectM); + } + + { PCM.h declarations } + { + procedure addPCMfloat(PCMdata: PFLOAT, samples: INT); + } + procedure addPCM16(pcm_data: TPCM16); cdecl; external libname; + procedure addPCM16Data(pcm_data: PSmallint; samples: Smallint); cdecl; external libname; + { + procedure addPCM8( unsigned char [2][512]); + } + +implementation + +end. diff --git a/Game/Code/lib/requirements.txt b/Game/Code/lib/requirements.txt index ebaffea7..d1775390 100644 --- a/Game/Code/lib/requirements.txt +++ b/Game/Code/lib/requirements.txt @@ -34,6 +34,9 @@ here are the instructions needed to compile on ubunty ( 7.04 ) ffmpeg : sudo apt-get install libavcodec-dev libavformat-dev + +portaudio : + sudo apt-get install portaudio19-dev sqlite : sudo apt-get install libsqlite3-dev @@ -43,6 +46,6 @@ sdl development libraries : THERE WILL be more of them... oops I forgot to list them :P For the Lazy... who use Debian or Ubuntu.... here is a single line - sudo apt-get install libavcodec-dev libavformat-dev libsqlite3-dev libsdl-ttf2.0-dev libsdl-image1.2-dev + sudo apt-get install libavcodec-dev libavformat-dev libsqlite3-dev libsdl-ttf2.0-dev libsdl-image1.2-dev portaudio19-dev - \ No newline at end of file + diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index 5811979e..540ba068 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -1,56 +1,57 @@ -{$DEFINE DEBUG} // to-do : Remove b4 release - -// Comment by eddie: -// The mac port currently also uses the WIN32 define. -// Once I get the beast compiled, linked and running -// I will change this. -// There are some parts where the WIN32 define could not -// be used. I changed the WIN32 to MSWINDOWS. -// So, for Windows-only code use the MSWINDOWS define. - - -{$IFDEF FPC} - {$IFDEF DARWIN} - {$H+} - {$R-} - {$DEFINE WIN32} - {$DEFINE TRANSLATE} - {$ELSE} - {$DEFINE LAZARUS} - {$ENDIF} - -// {$MODE DELPHI} // JB - This is not allowed by the free pascal compiler for some reason ( At least on linux ) - - {$DEFINE DLL_CDECL} - {$UNDEF UseSerialPort} - {$UNDEF UseMIDIPort} -{$ELSE} - {$DEFINE Delphi} - {$DEFINE DLL_STDCALL} - {$UNDEF UseSerialPort} - {$DEFINE UseMIDIPort} -{$ENDIF} - - -{$IFDEF win32} - {$DEFINE UseBASSOutput} - {$DEFINE UseBASSInput} - - //{$DEFINE UsePortaudio} - //{$DEFINE UsePortmixer} - - {$DEFINE UseProjectM} - - {$IFDEF DEBUG} - {$IFNDEF DARWIN} - {$APPTYPE CONSOLE} - {$ENDIF} - {$ENDIF} -{$ELSE} - //{$DEFINE FFMpegAudio} - {$DEFINE UsePortaudio} -{$ENDIF} - -{$IF Defined(UseBASSInput) or Defined(UseBASSOutput)} - {$DEFINE UseBASS} -{$IFEND} +{$DEFINE DEBUG} // to-do : Remove b4 release + +// Comment by eddie: +// The mac port currently also uses the WIN32 define. +// Once I get the beast compiled, linked and running +// I will change this. +// There are some parts where the WIN32 define could not +// be used. I changed the WIN32 to MSWINDOWS. +// So, for Windows-only code use the MSWINDOWS define. + + +{$IFDEF FPC} + {$IFDEF DARWIN} + {$H+} + {$R-} + {$DEFINE WIN32} + {$DEFINE TRANSLATE} + {$ELSE} + {$DEFINE LAZARUS} + {$ENDIF} + +// {$MODE DELPHI} // JB - This is not allowed by the free pascal compiler for some reason ( At least on linux ) + + {$DEFINE DLL_CDECL} + {$UNDEF UseSerialPort} + {$UNDEF UseMIDIPort} +{$ELSE} + {$DEFINE Delphi} + {$DEFINE DLL_STDCALL} + {$UNDEF UseSerialPort} + {$DEFINE UseMIDIPort} +{$ENDIF} + + +{$IFDEF win32} + {$DEFINE UseBASSOutput} + {$DEFINE UseBASSInput} + + //{$DEFINE UsePortaudio} + //{$DEFINE UsePortmixer} + + {$DEFINE UseProjectM} + + {$IFDEF DEBUG} + {$IFNDEF DARWIN} + {$APPTYPE CONSOLE} + {$ENDIF} + {$ENDIF} +{$ELSE} + //{$DEFINE FFMpegAudio} +// {$DEFINE UsePortaudio} + {$DEFINE UseProjectM} +{$ENDIF} + +{$IF Defined(UseBASSInput) or Defined(UseBASSOutput)} + {$DEFINE UseBASS} +{$IFEND} -- cgit v1.2.3 From 842af29c79390c0f78c2f004b463fe555ab01430 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Fri, 7 Dec 2007 00:37:39 +0000 Subject: oops didnt mean to commit that. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@693 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UVisualizer.pas | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UVisualizer.pas b/Game/Code/Classes/UVisualizer.pas index a49187e7..fc5eacbf 100644 --- a/Game/Code/Classes/UVisualizer.pas +++ b/Game/Code/Classes/UVisualizer.pas @@ -98,9 +98,6 @@ begin glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - New(pm); - projectM_reset(pm); - end; function TVideoPlayback_ProjectM.GetName: String; @@ -180,8 +177,8 @@ procedure TVideoPlayback_ProjectM.VisualizerStart; begin VisualizerStarted := True; -// New(pm); -// projectM_reset(pm); + New(pm); + projectM_reset(pm); writeln('Render Target'); writeln( inttostr( integer( assigned(pm^.renderTarget) ) ) ); -- cgit v1.2.3 From 2e41ddbf9dc84772cdc9c8a9ab80d4861d6e4177 Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 7 Dec 2007 02:32:44 +0000 Subject: Fixed some linux visualizer errors git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@694 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudio_portaudio.pas | 863 ++++++++++++++++----------------- Game/Code/Classes/UMedia_dummy.pas | 2 + Game/Code/Classes/UVisualizer.pas | 18 +- 3 files changed, 436 insertions(+), 447 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudio_portaudio.pas b/Game/Code/Classes/UAudio_portaudio.pas index 9ed2107d..941d90d1 100644 --- a/Game/Code/Classes/UAudio_portaudio.pas +++ b/Game/Code/Classes/UAudio_portaudio.pas @@ -1,434 +1,429 @@ -unit UAudio_Portaudio; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - - -uses Classes, - {$IFDEF win32} - windows, - {$ENDIF} - Messages, - SysUtils, - {$IFNDEF FPC} - Forms, - {$ENDIF} - portaudio, - {$IFDEF UsePortmixer} - portmixer, - {$ENDIF} - ULog, - UMusic; - -implementation - -uses - {$IFDEF LAZARUS} - lclintf, - {$ENDIF} - URecord, - UIni, - UMain, - UCommon, - UThemes; -{ -type - TPaHostApiIndex = PaHostApiIndex; - TPaDeviceIndex = PaDeviceIndex; - PPaStream = ^PaStreamPtr; - PPaStreamCallbackTimeInfo = ^PaStreamCallbackTimeInfo; - TPaStreamCallbackFlags = PaStreamCallbackFlags; - TPaHostApiTypeId = PaHostApiTypeId; - PPaHostApiInfo = ^PaHostApiInfo; - PPaDeviceInfo = ^PaDeviceInfo; - TPaError = PaError; - TPaStreamParameters = PaStreamParameters; -} -type - TAudio_Portaudio = class( TInterfacedObject, IAudioInput ) - private - function GetPreferredApiIndex(): TPaHostApiIndex; - public - function GetName: String; - procedure InitializeRecord; - - procedure CaptureStart; - procedure CaptureStop; - - procedure CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); - procedure StopCard(Card: byte); - end; - - TPortaudioSoundCard = class(TGenericSoundCard) - RecordStream: PPaStream; - DeviceIndex: TPaDeviceIndex; - end; - -function MicrophoneCallback(input: Pointer; output: Pointer; frameCount: Longword; - timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; - inputDevice: Pointer): Integer; cdecl; forward; - -var - singleton_MusicPortaudio : IAudioInput; - -const - sampleRate: Double = 44100.; - -{* the default API used by Portaudio is the least common denominator - * and might lack efficiency. ApiPreferenceOrder defines the order of - * preferred APIs to use. The first API-type in the list is tried first. If it's - * not available the next is tried, ... - * If none of the preferred APIs was found the default API is used. - * Pascal doesn't permit zero-length static arrays, so you can use paDefaultApi - * as an array's only member if you do not have any preferences. - * paDefaultApi also terminates a preferences list but this is optional. - *} -const - paDefaultApi = -1; -var - ApiPreferenceOrder: -{$IF Defined(WIN32)} - // Note1: Portmixer has no mixer support for paASIO and paWASAPI at the moment - // Note2: Windows Default-API is MME - //array[0..0] of TPaHostApiTypeId = ( paDirectSound, paMME ); - array[0..0] of TPaHostApiTypeId = ( paDirectSound ); -{$ELSEIF Defined(LINUX)} - // Note1: Portmixer has no mixer support for paJACK at the moment - // Note2: Not tested, but ALSA might be better than OSS. - array[0..1] of TPaHostApiTypeId = ( paALSA, paOSS ); -{$ELSEIF Defined(DARWIN)} - // Note: Not tested. - //array[0..0] of TPaHostApiTypeId = ( paCoreAudio ); - array[0..0] of TPaHostApiTypeId = ( paDefaultApi ); -{$ELSE} - array[0..0] of TPaHostApiTypeId = ( paDefaultApi ); -{$IFEND} - -function TAudio_Portaudio.GetName: String; -begin - result := 'Portaudio'; -end; - -function TAudio_Portaudio.GetPreferredApiIndex(): TPaHostApiIndex; -var - i: integer; -begin - result := -1; - - // select preferred sound-API - for i:= 0 to High(ApiPreferenceOrder) do - begin - if(ApiPreferenceOrder[i] <> paDefaultApi) then begin - // check if API is available - result := Pa_HostApiTypeIdToHostApiIndex(ApiPreferenceOrder[i]); - if(result >= 0) then - break; - end; - end; - - // None of the preferred APIs is available -> use default - if(result < 0) then begin - result := Pa_GetDefaultHostApi(); - end; -end; - -// TODO: should be a function with boolean return type -procedure TAudio_Portaudio.InitializeRecord; -var - i: integer; - apiIndex: TPaHostApiIndex; - apiInfo: PPaHostApiInfo; - deviceName: string; - deviceIndex: TPaDeviceIndex; - deviceInfo: PPaDeviceInfo; - inputCnt: integer; - inputName: string; - SC: integer; // soundcard - SCI: integer; // soundcard input - err: TPaError; - errMsg: string; - paSoundCard: TPortaudioSoundCard; - inputParams: TPaStreamParameters; - stream: PPaStream; - {$IFDEF UsePortmixer} - mixer: PPxMixer; - {$ENDIF} -begin - // TODO: call Pa_Terminate() on termination - err := Pa_Initialize(); - if(err <> paNoError) then begin - Log.CriticalError('Portaudio.InitializeRecord: ' + Pa_GetErrorText(err)); - //Log.LogError('Portaudio.InitializeRecord: ' + Pa_GetErrorText(err)); - // result := false; - Exit; - end; - - apiIndex := GetPreferredApiIndex(); - apiInfo := Pa_GetHostApiInfo(apiIndex); - - SC := 0; - - // init array-size to max. input-devices count - SetLength(Recording.SoundCard, apiInfo^.deviceCount); // fix deviceCountL - for i:= 0 to High(Recording.SoundCard) do - begin - // convert API-specific device-index to global index - deviceIndex := Pa_HostApiDeviceIndexToDeviceIndex(apiIndex, i); - deviceInfo := Pa_GetDeviceInfo(deviceIndex); - - // current device is no input device -> skip - if(deviceInfo^.maxInputChannels <= 0) then - continue; - - // TODO: free object on termination - paSoundCard := TPortaudioSoundCard.Create(); - Recording.SoundCard[SC] := paSoundCard; - - // retrieve device-name - deviceName := deviceInfo^.name; - paSoundCard.Description := deviceName; - paSoundCard.DeviceIndex := deviceIndex; - - // setup desired input parameters - with inputParams do begin - device := deviceIndex; - channelCount := 2; - sampleFormat := paInt16; - suggestedLatency := deviceInfo^.defaultLowInputLatency; - hostApiSpecificStreamInfo := nil; - end; - - // check if device supports our input-format - err := Pa_IsFormatSupported(@inputParams, nil, sampleRate); - if(err <> 0) then begin - // format not supported -> skip - errMsg := Pa_GetErrorText(err); - Log.LogError('Portaudio.InitializeRecord, device: "'+ deviceName +'" ' - + '('+ errMsg +')'); - paSoundCard.Free(); - continue; - end; - - // TODO: retry with mono if stereo is not supported - // TODO: retry with input-latency set to 20ms (defaultLowInputLatency might - // not be set correctly in OSS) - - err := Pa_OpenStream(stream, @inputParams, nil, sampleRate, - paFramesPerBufferUnspecified, paNoFlag, @MicrophoneCallback, nil); - if(err <> paNoError) then begin - // unable to open device -> skip - errMsg := Pa_GetErrorText(err); - Log.LogError('Portaudio.InitializeRecord, device: "'+ deviceName +'" ' - + '('+ errMsg +')'); - paSoundCard.Free(); - continue; - end; - - - {$IFDEF UsePortmixer} - - // use default mixer - mixer := Px_OpenMixer(stream, 0); - - // get input count - inputCnt := Px_GetNumInputSources(mixer); - SetLength(paSoundCard.Input, inputCnt); - - // get input names - for SCI := 0 to inputCnt-1 do - begin - inputName := Px_GetInputSourceName(mixer, SCI); - paSoundCard.Input[SCI].Name := inputName; - end; - - Px_CloseMixer(mixer); - - {$ELSE} // !UsePortmixer - - //Pa_StartStream(stream); - // TODO: check if callback was called (this problem may occur on some devices) - //Pa_StopStream(stream); - - Pa_CloseStream(stream); - - // create a standard input source - SetLength(paSoundCard.Input, 1); - paSoundCard.Input[0].Name := 'Standard'; - - {$ENDIF} - - // use default input source - paSoundCard.InputSelected := 0; - - Inc(SC); - end; - - // adjust size to actual input-device count - SetLength(Recording.SoundCard, SC); - - Log.LogStatus('#Soundcards: ' + inttostr(SC), 'Portaudio'); - - { - SoundCard[SC].InputSelected := Mic[Device]; - } -end; - -// TODO: code is used by all IAudioInput implementors -// -> move to a common superclass (TAudioInput_Generic?) -procedure TAudio_Portaudio.CaptureStart; -var - S: integer; - SC: integer; - PlayerLeft, PlayerRight: integer; - CaptureSoundLeft, CaptureSoundRight: TSound; -begin - for S := 0 to High(Recording.Sound) do - Recording.Sound[S].BufferLong[0].Clear; - - for SC := 0 to High(Ini.CardList) do begin - PlayerLeft := Ini.CardList[SC].ChannelL-1; - PlayerRight := Ini.CardList[SC].ChannelR-1; - if PlayerLeft >= PlayersPlay then PlayerLeft := -1; - if PlayerRight >= PlayersPlay then PlayerRight := -1; - if (PlayerLeft > -1) or (PlayerRight > -1) then begin - if (PlayerLeft > -1) then - CaptureSoundLeft := Recording.Sound[PlayerLeft] - else - CaptureSoundLeft := nil; - if (PlayerRight > -1) then - CaptureSoundRight := Recording.Sound[PlayerRight] - else - CaptureSoundRight := nil; - - CaptureCard(SC, CaptureSoundLeft, CaptureSoundRight); - end; - end; -end; - -// TODO: code is used by all IAudioInput implementors -// -> move to a common superclass (TAudioInput_Generic?) -procedure TAudio_Portaudio.CaptureStop; -var - SC: integer; - PlayerLeft: integer; - PlayerRight: integer; -begin - - for SC := 0 to High(Ini.CardList) do begin - PlayerLeft := Ini.CardList[SC].ChannelL-1; - PlayerRight := Ini.CardList[SC].ChannelR-1; - if PlayerLeft >= PlayersPlay then PlayerLeft := -1; - if PlayerRight >= PlayersPlay then PlayerRight := -1; - if (PlayerLeft > -1) or (PlayerRight > -1) then - StopCard(SC); - end; - -end; - -{* - * Portaudio input capture callback. - *} -function MicrophoneCallback(input: Pointer; output: Pointer; frameCount: Longword; - timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; - inputDevice: Pointer): Integer; cdecl; -begin - Recording.HandleMicrophoneData(input, frameCount*4, inputDevice); - result := paContinue; -end; - -{* - * Start input-capturing on Soundcard specified by Card. - * Params: - * Card - soundcard index in Recording.SoundCard array - * CaptureSoundLeft - sound(-buffer) used for left channel capture data - * CaptureSoundRight - sound(-buffer) used for right channel capture data - *} -procedure TAudio_Portaudio.CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); -var - Error: TPaError; - ErrorMsg: string; - inputParams: TPaStreamParameters; - deviceInfo: PPaDeviceInfo; - stream: PPaStream; - paSoundCard: TPortaudioSoundCard; -begin - Log.LogStatus('Cap1', 'Portaudio'); - - paSoundCard := TPortaudioSoundCard(Recording.SoundCard[Card]); - paSoundCard.CaptureSoundLeft := CaptureSoundLeft; - paSoundCard.CaptureSoundRight := CaptureSoundRight; - - // get input latency info - deviceInfo := Pa_GetDeviceInfo(paSoundCard.DeviceIndex); - - // set input stream parameters - with inputParams do begin - device := paSoundCard.DeviceIndex; - channelCount := 2; - sampleFormat := paInt16; - suggestedLatency := deviceInfo^.defaultLowInputLatency; - hostApiSpecificStreamInfo := nil; - end; - - Log.LogStatus(inttostr(paSoundCard.DeviceIndex), 'Portaudio'); - Log.LogStatus(floattostr(deviceInfo^.defaultLowInputLatency), 'Portaudio'); - - // open input stream - Error := Pa_OpenStream(stream, @inputParams, nil, sampleRate, - paFramesPerBufferUnspecified, paNoFlag, - @MicrophoneCallback, Pointer(paSoundCard)); - if(Error <> paNoError) then begin - ErrorMsg := Pa_GetErrorText(Error); - Log.CriticalError('TAudio_Portaudio.CaptureCard('+ IntToStr(Card) +'): Error opening stream: ' + ErrorMsg); - //Halt; - end; - - paSoundCard.RecordStream := stream; - - // start capture - Error := Pa_StartStream(stream); - if(Error <> paNoError) then begin - Pa_CloseStream(stream); - ErrorMsg := Pa_GetErrorText(Error); - Log.CriticalError('TAudio_Portaudio.CaptureCard('+ IntToStr(Card) +'): Error starting stream: ' + ErrorMsg); - //Halt; - end; - - //Readln; - Log.LogStatus('Cap2', 'Portaudio'); -end; - -{* - * Stop input-capturing on Soundcard specified by Card. - * Params: - * Card - soundcard index in Recording.SoundCard array - *} -procedure TAudio_Portaudio.StopCard(Card: byte); -var - stream: PPaStream; - paSoundCard: TPortaudioSoundCard; -begin - paSoundCard := TPortaudioSoundCard(Recording.SoundCard[Card]); - stream := paSoundCard.RecordStream; - if(stream <> nil) then begin - Pa_StopStream(stream); - Pa_CloseStream(stream); - end; -end; - - -initialization - singleton_MusicPortaudio := TAudio_Portaudio.create(); - writeln( 'UAudio_Portaudio - Register' ); - AudioManager.add( singleton_MusicPortaudio ); - -finalization - writeln( 'UAudio_Portaudio - UnRegister' ); - AudioManager.Remove( singleton_MusicPortaudio ); - -end. +unit UAudio_Portaudio; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +uses Classes, + {$IFDEF win32} + windows, + {$ENDIF} + Messages, + SysUtils, + {$IFNDEF FPC} + Forms, + {$ENDIF} + portaudio, + {$IFDEF UsePortmixer} + portmixer, + {$ENDIF} + ULog, + UMusic; + +implementation + +uses + {$IFDEF LAZARUS} + lclintf, + {$ENDIF} + URecord, + UIni, + UMain, + UCommon, + UThemes; +{ +type + TPaHostApiIndex = PaHostApiIndex; + TPaDeviceIndex = PaDeviceIndex; + PPaStream = ^PaStreamPtr; + PPaStreamCallbackTimeInfo = ^PaStreamCallbackTimeInfo; + TPaStreamCallbackFlags = PaStreamCallbackFlags; + TPaHostApiTypeId = PaHostApiTypeId; + PPaHostApiInfo = ^PaHostApiInfo; + PPaDeviceInfo = ^PaDeviceInfo; + TPaError = PaError; + TPaStreamParameters = PaStreamParameters; +} +type + TAudio_Portaudio = class( TInterfacedObject, IAudioInput ) + private + function GetPreferredApiIndex(): TPaHostApiIndex; + public + function GetName: String; + procedure InitializeRecord; + + procedure CaptureStart; + procedure CaptureStop; + + procedure CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); + procedure StopCard(Card: byte); + end; + + TPortaudioSoundCard = class(TGenericSoundCard) + RecordStream: PPaStream; + DeviceIndex: TPaDeviceIndex; + end; + +function MicrophoneCallback(input: Pointer; output: Pointer; frameCount: Longword; + timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; + inputDevice: Pointer): Integer; cdecl; forward; + +var + singleton_MusicPortaudio : IAudioInput; + +const + sampleRate: Double = 44100.; + +{* the default API used by Portaudio is the least common denominator + * and might lack efficiency. ApiPreferenceOrder defines the order of + * preferred APIs to use. The first API-type in the list is tried first. If it's + * not available the next is tried, ... + * If none of the preferred APIs was found the default API is used. + * Pascal doesn't permit zero-length static arrays, so you can use paDefaultApi + * as an array's only member if you do not have any preferences. + * paDefaultApi also terminates a preferences list but this is optional. + *} +const + paDefaultApi = -1; +var + ApiPreferenceOrder: +{$IF Defined(WIN32)} + // Note1: Portmixer has no mixer support for paASIO and paWASAPI at the moment + // Note2: Windows Default-API is MME + //array[0..0] of TPaHostApiTypeId = ( paDirectSound, paMME ); + array[0..0] of TPaHostApiTypeId = ( paDirectSound ); +{$ELSEIF Defined(LINUX)} + // Note1: Portmixer has no mixer support for paJACK at the moment + // Note2: Not tested, but ALSA might be better than OSS. + array[0..1] of TPaHostApiTypeId = ( paALSA, paOSS ); +{$ELSEIF Defined(DARWIN)} + // Note: Not tested. + //array[0..0] of TPaHostApiTypeId = ( paCoreAudio ); + array[0..0] of TPaHostApiTypeId = ( paDefaultApi ); +{$ELSE} + array[0..0] of TPaHostApiTypeId = ( paDefaultApi ); +{$IFEND} + +function TAudio_Portaudio.GetName: String; +begin + result := 'Portaudio'; +end; + +function TAudio_Portaudio.GetPreferredApiIndex(): TPaHostApiIndex; +var + i: integer; +begin + result := -1; + + // select preferred sound-API + for i:= 0 to High(ApiPreferenceOrder) do + begin + if(ApiPreferenceOrder[i] <> paDefaultApi) then begin + // check if API is available + result := Pa_HostApiTypeIdToHostApiIndex(ApiPreferenceOrder[i]); + if(result >= 0) then + break; + end; + end; + + // None of the preferred APIs is available -> use default + if(result < 0) then begin + result := Pa_GetDefaultHostApi(); + end; +end; + +// TODO: should be a function with boolean return type +procedure TAudio_Portaudio.InitializeRecord; +var + i: integer; + apiIndex: TPaHostApiIndex; + apiInfo: PPaHostApiInfo; + deviceName: string; + deviceIndex: TPaDeviceIndex; + deviceInfo: PPaDeviceInfo; + inputCnt: integer; + inputName: string; + SC: integer; // soundcard + SCI: integer; // soundcard input + err: TPaError; + errMsg: string; + paSoundCard: TPortaudioSoundCard; + inputParams: TPaStreamParameters; + stream: PPaStream; + {$IFDEF UsePortmixer} + mixer: PPxMixer; + {$ENDIF} +begin + // TODO: call Pa_Terminate() on termination + err := Pa_Initialize(); + if(err <> paNoError) then begin + Log.CriticalError('Portaudio.InitializeRecord: ' + Pa_GetErrorText(err)); + //Log.LogError('Portaudio.InitializeRecord: ' + Pa_GetErrorText(err)); + // result := false; + Exit; + end; + + apiIndex := GetPreferredApiIndex(); + apiInfo := Pa_GetHostApiInfo(apiIndex); + + SC := 0; + + // init array-size to max. input-devices count + SetLength(Recording.SoundCard, apiInfo^.deviceCount); // fix deviceCountL + for i:= 0 to High(Recording.SoundCard) do + begin + // convert API-specific device-index to global index + deviceIndex := Pa_HostApiDeviceIndexToDeviceIndex(apiIndex, i); + deviceInfo := Pa_GetDeviceInfo(deviceIndex); + + // current device is no input device -> skip + if(deviceInfo^.maxInputChannels <= 0) then + continue; + + // TODO: free object on termination + paSoundCard := TPortaudioSoundCard.Create(); + Recording.SoundCard[SC] := paSoundCard; + + // retrieve device-name + deviceName := deviceInfo^.name; + paSoundCard.Description := deviceName; + paSoundCard.DeviceIndex := deviceIndex; + + // setup desired input parameters + with inputParams do begin + device := deviceIndex; + channelCount := 2; + sampleFormat := paInt16; + suggestedLatency := deviceInfo^.defaultLowInputLatency; + hostApiSpecificStreamInfo := nil; + end; + + // check if device supports our input-format + err := Pa_IsFormatSupported(@inputParams, nil, sampleRate); + if(err <> 0) then begin + // format not supported -> skip + errMsg := Pa_GetErrorText(err); + Log.LogError('Portaudio.InitializeRecord, device: "'+ deviceName +'" ' + + '('+ errMsg +')'); + paSoundCard.Free(); + continue; + end; + + // TODO: retry with mono if stereo is not supported + // TODO: retry with input-latency set to 20ms (defaultLowInputLatency might + // not be set correctly in OSS) + + err := Pa_OpenStream(stream, @inputParams, nil, sampleRate, + paFramesPerBufferUnspecified, paNoFlag, @MicrophoneCallback, nil); + if(err <> paNoError) then begin + // unable to open device -> skip + errMsg := Pa_GetErrorText(err); + Log.LogError('Portaudio.InitializeRecord, device: "'+ deviceName +'" ' + + '('+ errMsg +')'); + paSoundCard.Free(); + continue; + end; + + + {$IFDEF UsePortmixer} + + // use default mixer + mixer := Px_OpenMixer(stream, 0); + + // get input count + inputCnt := Px_GetNumInputSources(mixer); + SetLength(paSoundCard.Input, inputCnt); + + // get input names + for SCI := 0 to inputCnt-1 do + begin + inputName := Px_GetInputSourceName(mixer, SCI); + paSoundCard.Input[SCI].Name := inputName; + end; + + Px_CloseMixer(mixer); + + {$ELSE} // !UsePortmixer + + //Pa_StartStream(stream); + // TODO: check if callback was called (this problem may occur on some devices) + //Pa_StopStream(stream); + + Pa_CloseStream(stream); + + // create a standard input source + SetLength(paSoundCard.Input, 1); + paSoundCard.Input[0].Name := 'Standard'; + + {$ENDIF} + + // use default input source + paSoundCard.InputSelected := 0; + + Inc(SC); + end; + + // adjust size to actual input-device count + SetLength(Recording.SoundCard, SC); + + Log.LogStatus('#Soundcards: ' + inttostr(SC), 'Portaudio'); + + { + SoundCard[SC].InputSelected := Mic[Device]; + } +end; + +// TODO: code is used by all IAudioInput implementors +// -> move to a common superclass (TAudioInput_Generic?) +procedure TAudio_Portaudio.CaptureStart; +var + S: integer; + SC: integer; + PlayerLeft, PlayerRight: integer; + CaptureSoundLeft, CaptureSoundRight: TSound; +begin + for S := 0 to High(Recording.Sound) do + Recording.Sound[S].BufferLong[0].Clear; + + for SC := 0 to High(Ini.CardList) do begin + PlayerLeft := Ini.CardList[SC].ChannelL-1; + PlayerRight := Ini.CardList[SC].ChannelR-1; + if PlayerLeft >= PlayersPlay then PlayerLeft := -1; + if PlayerRight >= PlayersPlay then PlayerRight := -1; + if (PlayerLeft > -1) or (PlayerRight > -1) then begin + if (PlayerLeft > -1) then + CaptureSoundLeft := Recording.Sound[PlayerLeft] + else + CaptureSoundLeft := nil; + if (PlayerRight > -1) then + CaptureSoundRight := Recording.Sound[PlayerRight] + else + CaptureSoundRight := nil; + + CaptureCard(SC, CaptureSoundLeft, CaptureSoundRight); + end; + end; +end; + +// TODO: code is used by all IAudioInput implementors +// -> move to a common superclass (TAudioInput_Generic?) +procedure TAudio_Portaudio.CaptureStop; +var + SC: integer; + PlayerLeft: integer; + PlayerRight: integer; +begin + + for SC := 0 to High(Ini.CardList) do begin + PlayerLeft := Ini.CardList[SC].ChannelL-1; + PlayerRight := Ini.CardList[SC].ChannelR-1; + if PlayerLeft >= PlayersPlay then PlayerLeft := -1; + if PlayerRight >= PlayersPlay then PlayerRight := -1; + if (PlayerLeft > -1) or (PlayerRight > -1) then + StopCard(SC); + end; + +end; + +{* + * Portaudio input capture callback. + *} +function MicrophoneCallback(input: Pointer; output: Pointer; frameCount: Longword; + timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; + inputDevice: Pointer): Integer; cdecl; +begin + Recording.HandleMicrophoneData(input, frameCount*4, inputDevice); + result := paContinue; +end; + +{* + * Start input-capturing on Soundcard specified by Card. + * Params: + * Card - soundcard index in Recording.SoundCard array + * CaptureSoundLeft - sound(-buffer) used for left channel capture data + * CaptureSoundRight - sound(-buffer) used for right channel capture data + *} +procedure TAudio_Portaudio.CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); +var + Error: TPaError; + ErrorMsg: string; + inputParams: TPaStreamParameters; + deviceInfo: PPaDeviceInfo; + stream: PPaStream; + paSoundCard: TPortaudioSoundCard; +begin + paSoundCard := TPortaudioSoundCard(Recording.SoundCard[Card]); + paSoundCard.CaptureSoundLeft := CaptureSoundLeft; + paSoundCard.CaptureSoundRight := CaptureSoundRight; + + // get input latency info + deviceInfo := Pa_GetDeviceInfo(paSoundCard.DeviceIndex); + + // set input stream parameters + with inputParams do begin + device := paSoundCard.DeviceIndex; + channelCount := 2; + sampleFormat := paInt16; + suggestedLatency := deviceInfo^.defaultLowInputLatency; + hostApiSpecificStreamInfo := nil; + end; + + Log.LogStatus(inttostr(paSoundCard.DeviceIndex), 'Portaudio'); + Log.LogStatus(floattostr(deviceInfo^.defaultLowInputLatency), 'Portaudio'); + + // open input stream + Error := Pa_OpenStream(stream, @inputParams, nil, sampleRate, + paFramesPerBufferUnspecified, paNoFlag, + @MicrophoneCallback, Pointer(paSoundCard)); + if(Error <> paNoError) then begin + ErrorMsg := Pa_GetErrorText(Error); + Log.CriticalError('TAudio_Portaudio.CaptureCard('+ IntToStr(Card) +'): Error opening stream: ' + ErrorMsg); + //Halt; + end; + + paSoundCard.RecordStream := stream; + + // start capture + Error := Pa_StartStream(stream); + if(Error <> paNoError) then begin + Pa_CloseStream(stream); + ErrorMsg := Pa_GetErrorText(Error); + Log.CriticalError('TAudio_Portaudio.CaptureCard('+ IntToStr(Card) +'): Error starting stream: ' + ErrorMsg); + //Halt; + end; +end; + +{* + * Stop input-capturing on Soundcard specified by Card. + * Params: + * Card - soundcard index in Recording.SoundCard array + *} +procedure TAudio_Portaudio.StopCard(Card: byte); +var + stream: PPaStream; + paSoundCard: TPortaudioSoundCard; +begin + paSoundCard := TPortaudioSoundCard(Recording.SoundCard[Card]); + stream := paSoundCard.RecordStream; + if(stream <> nil) then begin + Pa_StopStream(stream); + Pa_CloseStream(stream); + end; +end; + + +initialization + singleton_MusicPortaudio := TAudio_Portaudio.create(); + writeln( 'UAudio_Portaudio - Register' ); + AudioManager.add( singleton_MusicPortaudio ); + +finalization + writeln( 'UAudio_Portaudio - UnRegister' ); + AudioManager.Remove( singleton_MusicPortaudio ); + +end. diff --git a/Game/Code/Classes/UMedia_dummy.pas b/Game/Code/Classes/UMedia_dummy.pas index 4fc39d4e..12268a55 100644 --- a/Game/Code/Classes/UMedia_dummy.pas +++ b/Game/Code/Classes/UMedia_dummy.pas @@ -165,7 +165,9 @@ begin end; function Tmedia_dummy.GetFFTData: TFFTData; +var data: TFFTData; begin + result := data; end; function Tmedia_dummy.GetPCMData(var data: TPCMData): Cardinal; diff --git a/Game/Code/Classes/UVisualizer.pas b/Game/Code/Classes/UVisualizer.pas index fc5eacbf..fa737d81 100644 --- a/Game/Code/Classes/UVisualizer.pas +++ b/Game/Code/Classes/UVisualizer.pas @@ -97,7 +97,6 @@ begin glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - end; function TVideoPlayback_ProjectM.GetName: String; @@ -180,19 +179,12 @@ begin New(pm); projectM_reset(pm); - writeln('Render Target'); - writeln( inttostr( integer( assigned(pm^.renderTarget) ) ) ); - pm^.fullscreen := 0; - pm^.gx := gx; - pm^.gy := gy; + pm^.renderTarget^.texsize := texsize; + pm^.gx := gx; + pm^.gy := gy; pm^.fps := fps; - - if assigned(pm^.renderTarget) then - begin - pm^.renderTarget^.texsize := texsize; - pm^.renderTarget^.usePbuffers := 0; - end; + pm^.renderTarget^.usePbuffers := 0; pm^.fontURL := PChar(projectM_Dir+'/fonts'); pm^.presetURL := PChar(projectM_Dir+'/presets'); @@ -240,7 +232,7 @@ begin // get audio data nSamples := AudioPlayback.GetPCMData(PcmData); - addPCM16Data(PSmallInt(@PcmData), nSamples); + addPCM16Data(PPCM16Data(@PcmData), nSamples); // store OpenGL state (might be messed up otherwise) glPushAttrib(GL_ALL_ATTRIB_BITS); -- cgit v1.2.3 From 0de7856abe4ca4eccd3404fc737092573c3d461d Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 7 Dec 2007 02:37:05 +0000 Subject: linux fix git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@695 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/projectM/projectM.pas | 122 +++++++++++++++++++++--------------- 1 file changed, 71 insertions(+), 51 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/lib/projectM/projectM.pas b/Game/Code/lib/projectM/projectM.pas index 9adf5acf..1c699e2b 100644 --- a/Game/Code/lib/projectM/projectM.pas +++ b/Game/Code/lib/projectM/projectM.pas @@ -1,15 +1,32 @@ unit projectM; +{$IFDEF FPC} + {$IFNDEF win32} + {$LINKLIB libprojectM} + {$ENDIF} + {$MODE DELPHI} + {$PACKENUM 4} + {$PACKRECORDS C} +{$ENDIF} + interface -uses OpenGL12; +uses +{$IFNDEF win32} + baseunix, +{$ENDIF} + OpenGL12; + +const +{$IFDEF win32} + libprojectM = 'libprojectM.dll'; +{$ELSE} + libprojectM = 'libprojectM.so'; +{$ENDIF} const - {$IFDEF win32} - libname = 'libprojectM.dll'; - {$Else} - libname = 'libprojectM.so'; - {$endif} + PROJECTM_VERSION = '0.99'; + PROJECTM_TITLE = 'projectM 0.99'; type FLOAT = Single; @@ -20,8 +37,16 @@ type LONG = Longint; type + // 16bit interleaved data + TPCM16Data = array[0..511, 0..1] of SHORT; + PPCM16Data = ^TPCM16Data; + // 16bit non-interleaved data TPCM16 = array[0..1, 0..511] of SHORT; - + PPCM16 = ^TPCM16; + // 8bit non-interleaved data + TPCM8 = array[0..1, 0..511] of byte; + PPCM8 = ^TPCM8; + type TTextureScale = INT; const @@ -103,7 +128,7 @@ type {$ifndef Win32} { The first ticks value of the application } - startTime: LONG; //struct timeval + startTime: timeval; {$else} startTime: LONG; {$endif Win32} @@ -308,53 +333,48 @@ type end; { Functions } - procedure projectM_init(pm: PProjectM); cdecl; external libname; - procedure projectM_reset(pm: PProjectM); cdecl; external libname; - procedure projectM_resetGL(pm: PProjectM; width: INT; height: INT); cdecl; external libname; - procedure projectM_setTitle(pm: PProjectM; title: PChar); cdecl; external libname; - procedure renderFrame(pm: PProjectM); cdecl; external libname; + procedure projectM_init(pm: PProjectM); cdecl; external libprojectM; + procedure projectM_reset(pm: PProjectM); cdecl; external libprojectM; + procedure projectM_resetGL(pm: PProjectM; width: INT; height: INT); cdecl; external libprojectM; + procedure projectM_setTitle(pm: PProjectM; title: PChar); cdecl; external libprojectM; + procedure renderFrame(pm: PProjectM); cdecl; external libprojectM; { - procedure draw_help(pm: PProjectM); - procedure draw_fps(pm: PProjectM; fps: Single); - procedure draw_preset(pm: PProjectM); - procedure draw_title(pm: PProjectM); - procedure draw_stats(pm: PProjectM); - - procedure modulate_opacity_by_volume(pm: PProjectM); - procedure maximize_colors(pm: PProjectM); - procedure do_per_pixel_math(pm: PProjectM); - procedure do_per_frame(pm: PProjectM); - procedure render_texture_to_studio(pm: PProjectM); - procedure darken_center(pm: PProjectM); - - procedure render_interpolation(pm: PProjectM); - procedure render_texture_to_screen(pm: PProjectM); - procedure render_texture_to_studio(pm: PProjectM); - procedure draw_motion_vectors(pm: PProjectM); - procedure draw_borders(pm: PProjectM); - procedure draw_shapes(pm: PProjectM); - procedure draw_waveform(pm: PProjectM); - procedure draw_custom_waves(pm: PProjectM); - - procedure draw_title_to_screen(pm: PProjectM); - procedure draw_title_to_texture(pm: PProjectM); - procedure get_title(pm: PProjectM); - - procedure reset_per_pixel_matrices(pm: PProjectM); - procedure init_per_pixel_matrices(pm: PProjectM); - procedure rescale_per_pixel_matrices(pm: PProjectM); + procedure draw_help(pm: PProjectM); cdecl; external libprojectM; + procedure draw_fps(pm: PProjectM; fps: Single); cdecl; external libprojectM; + procedure draw_preset(pm: PProjectM); cdecl; external libprojectM; + procedure draw_title(pm: PProjectM); cdecl; external libprojectM; + procedure draw_stats(pm: PProjectM); cdecl; external libprojectM; + + procedure modulate_opacity_by_volume(pm: PProjectM); cdecl; external libprojectM; + procedure maximize_colors(pm: PProjectM); cdecl; external libprojectM; + procedure do_per_pixel_math(pm: PProjectM); cdecl; external libprojectM; + procedure do_per_frame(pm: PProjectM); cdecl; external libprojectM; + procedure darken_center(pm: PProjectM); cdecl; external libprojectM; + + procedure render_interpolation(pm: PProjectM); cdecl; external libprojectM; + procedure render_texture_to_screen(pm: PProjectM); cdecl; external libprojectM; + procedure render_texture_to_studio(pm: PProjectM); cdecl; external libprojectM; + procedure draw_motion_vectors(pm: PProjectM); cdecl; external libprojectM; + procedure draw_borders(pm: PProjectM); cdecl; external libprojectM; + procedure draw_shapes(pm: PProjectM); cdecl; external libprojectM; + procedure draw_waveform(pm: PProjectM); cdecl; external libprojectM; + procedure draw_custom_waves(pm: PProjectM); cdecl; external libprojectM; + + procedure draw_title_to_screen(pm: PProjectM); cdecl; external libprojectM; + procedure draw_title_to_texture(pm: PProjectM); cdecl; external libprojectM; + procedure get_title(pm: PProjectM); cdecl; external libprojectM; + + procedure reset_per_pixel_matrices(pm: PProjectM); cdecl; external libprojectM; + procedure init_per_pixel_matrices(pm: PProjectM); cdecl; external libprojectM; + procedure rescale_per_pixel_matrices(pm: PProjectM); cdecl; external libprojectM; } - + { PCM.h declarations } - { - procedure addPCMfloat(PCMdata: PFLOAT, samples: INT); - } - procedure addPCM16(pcm_data: TPCM16); cdecl; external libname; - procedure addPCM16Data(pcm_data: PSmallint; samples: Smallint); cdecl; external libname; - { - procedure addPCM8( unsigned char [2][512]); - } + procedure addPCMfloat(pcm_data: PSingle; samples: integer); cdecl; external libprojectM; + procedure addPCM16(pcm_data: PPCM16); cdecl; external libprojectM; + procedure addPCM16Data(pcm_data: PPCM16Data; samples: Smallint); cdecl; external libprojectM; + procedure addPCM8(pcm_data: PPCM8); cdecl; external libprojectM; implementation -- cgit v1.2.3 From bd04e1c76d7139287be2244d03f2b62c9d117c0a Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 7 Dec 2007 03:52:07 +0000 Subject: getpcmdata creates fake pcm-data now git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@696 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMedia_dummy.pas | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMedia_dummy.pas b/Game/Code/Classes/UMedia_dummy.pas index 12268a55..a5cc4b5a 100644 --- a/Game/Code/Classes/UMedia_dummy.pas +++ b/Game/Code/Classes/UMedia_dummy.pas @@ -22,6 +22,7 @@ implementation uses SysUtils, + math, UMusic; @@ -170,9 +171,37 @@ begin result := data; end; +var count: integer = 0; + function Tmedia_dummy.GetPCMData(var data: TPCMData): Cardinal; -begin - result := 0; +var i: integer; +begin + // Produce some fake PCM data + if ( count mod 500 = 0 ) then + begin + for i := 0 to 511 do begin + data[0][i] := 0; + data[1][i] := 0; + end; + end + else begin + for i := 0 to 511 do begin + if ( i mod 2 = 0 ) then begin + data[0][i] := floor(Random * power(2.,14)); + data[1][i] := floor(Random * power(2.,14)); + end + else begin; + data[0][i] := floor(Random * power(2.,14)); + data[1][i] := floor(Random * power(2.,14)); + end; + if ( i mod 2 = 1 ) then begin + data[0][i] := -data[0][i]; + data[1][i] := -data[1][i]; + end; + end; + end; + Inc(count); + result := 512; end; // IAudioPlayback -- cgit v1.2.3 From 425ff834dbc3933475ee8f783eea6167e92ec174 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Fri, 7 Dec 2007 04:32:38 +0000 Subject: little bit of tidy up.. added command line switch, to see what media interfaces are being used. moved RandomPCM Data generation to Visualizer class. added Visualization preset change, on new line ( may be a little to much... maybe we should do ever 4 or 16 bars or something ?) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@697 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudio_bass.pas | 1364 ++++++++++++++++---------------- Game/Code/Classes/UAudio_portaudio.pas | 2 - Game/Code/Classes/UCommandLine.pas | 622 ++++++++------- Game/Code/Classes/UMain.pas | 5 +- Game/Code/Classes/UMedia_dummy.pas | 37 +- Game/Code/Classes/UMusic.pas | 58 +- Game/Code/Classes/UVideo.pas | 18 +- Game/Code/Classes/UVisualizer.pas | 55 +- Game/Code/Screens/UScreenSing.pas | 27 +- 9 files changed, 1109 insertions(+), 1079 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudio_bass.pas b/Game/Code/Classes/UAudio_bass.pas index 69278cca..a7bace06 100644 --- a/Game/Code/Classes/UAudio_bass.pas +++ b/Game/Code/Classes/UAudio_bass.pas @@ -1,685 +1,679 @@ -unit UAudio_bass; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - - -uses Classes, - {$IFDEF win32} - windows, - {$ENDIF} - Messages, - SysUtils, - {$IFNDEF FPC} - Forms, - {$ENDIF} - bass, - ULog, - UMusic; - -implementation - -uses - {$IFDEF LAZARUS} - lclintf, - {$ENDIF} - URecord, - UIni, - UMain, - UCommon, - UThemes; - -type - TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, - mpPaused, mpOpen); - -const - ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); - -type -{$IFDEF UseBASSInput} - TAudio_bass = class( TInterfacedObject, IAudioPlayback, IAudioInput) -{$ELSE} - TAudio_bass = class( TInterfacedObject, IAudioPlayback) -{$ENDIF} - private - BassStart: hStream; // Wait, I've replaced this with BASS - BassBack: hStream; // It has almost all features we need - BassSwoosh: hStream; - BassChange: hStream; // Almost? It aleady has them all :) - BassOption: hStream; - BassClick: hStream; - BassDrum: hStream; - BassHihat: hStream; - BassClap: hStream; - BassShuffle: hStream; - - //Custom Sounds - CustomSounds: array of TCustomSoundEntry; - Loaded: boolean; - Loop: boolean; - - public - Bass: hStream; - function GetName: String; - - {IAudioOutput interface} - - procedure InitializePlayback; - procedure SetVolume(Volume: integer); - procedure SetMusicVolume(Volume: integer); - procedure SetLoop(Enabled: boolean); - function Open(Name: string): boolean; // true if succeed - procedure Rewind; - procedure MoveTo(Time: real); - procedure Play; - procedure Pause; //Pause Mod - procedure Stop; - procedure Close; - function Finished: boolean; - function Length: real; - function getPosition: real; - procedure PlayStart; - procedure PlayBack; - procedure PlaySwoosh; - procedure PlayChange; - procedure PlayOption; - procedure PlayClick; - procedure PlayDrum; - procedure PlayHihat; - procedure PlayClap; - procedure PlayShuffle; - procedure StopShuffle; - function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; - - //Equalizer - function GetFFTData: TFFTData; - - // Interface for Visualizer - function GetPCMData(var data: TPCMData): Cardinal; - - //Custom Sounds - function LoadCustomSound(const Filename: String): Cardinal; - procedure PlayCustomSound(const Index: Cardinal ); - - {IAudioInput interface} - {$IFDEF UseBASSInput} - procedure InitializeRecord; - - procedure CaptureStart; - procedure CaptureStop; - procedure CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); - procedure StopCard(Card: byte); - {$ENDIF} - end; - -{$IFDEF UseBASSInput} - TBassSoundCard = class(TGenericSoundCard) - RecordStream: HSTREAM; - end; -{$ENDIF} - - -var - singleton_MusicBass : IAudioPlayback; - -function TAudio_bass.GetName: String; -begin - result := 'BASS'; -end; - -procedure TAudio_bass.InitializePlayback; -var - Pet: integer; - S: integer; -begin - writeln( 'TAudio_bass.InitializePlayback' ); -// Log.BenchmarkStart(4); -// Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); - - Loaded := false; - Loop := false; - - writeln( 'TAudio_bass BASS_Init' ); - if not BASS_Init(1, 44100, 0, 0, nil) then - begin - Log.LogError('Could not initialize BASS', 'Error'); - Exit; - end; - -// Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); - - // config playing buffer -// BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); -// BASS_SetConfig(BASS_CONFIG_BUFFER, 100); - -// Log.LogStatus('Loading Sounds', 'Music Initialize'); - - writeln( 'TAudio_bass LoadSoundFromFile' ); -// Log.BenchmarkStart(4); - LoadSoundFromFile(BassStart, SoundPath + 'Common Start.mp3'); - LoadSoundFromFile(BassBack, SoundPath + 'Common Back.mp3'); - LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3'); - LoadSoundFromFile(BassChange, SoundPath + 'select music change music 50.mp3'); - LoadSoundFromFile(BassOption, SoundPath + 'option change col.mp3'); - LoadSoundFromFile(BassClick, SoundPath + 'rimshot022b.mp3'); - -// LoadSoundFromFile(BassDrum, SoundPath + 'bassdrumhard076b.mp3'); -// LoadSoundFromFile(BassHihat, SoundPath + 'hihatclosed068b.mp3'); -// LoadSoundFromFile(BassClap, SoundPath + 'claps050b.mp3'); - -// LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3'); - -// Log.BenchmarkEnd(4); -// Log.LogBenchmark('--> Loading Sounds', 4); -end; - -procedure TAudio_bass.SetVolume(Volume: integer); -begin - //Old Sets Wave Volume - //BASS_SetVolume(Volume); - //New: Sets Volume only for this Application - - BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); -end; - -procedure TAudio_bass.SetMusicVolume(Volume: Integer); -begin - //Max Volume Prevention - if Volume > 100 then - Volume := 100; - - if Volume < 0 then - Volume := 0; - - - //Set Volume - // TODO : jb_linux replace with something other than bass - BASS_ChannelSetAttributes (Bass, -1, Volume, -101); -end; - -procedure TAudio_bass.SetLoop(Enabled: boolean); -begin - Loop := Enabled; -end; - -function TAudio_bass.Open(Name: string): boolean; -begin - Loaded := false; - if FileExists(Name) then - begin - Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); - - Loaded := true; - //Set Max Volume - SetMusicVolume (100); - end; - - Result := Loaded; -end; - -procedure TAudio_bass.Rewind; -begin - if Loaded then begin - end; -end; - -procedure TAudio_bass.MoveTo(Time: real); -var - bytes: integer; -begin - bytes := BASS_ChannelSeconds2Bytes(Bass, Time); - BASS_ChannelSetPosition(Bass, bytes); -end; - -procedure TAudio_bass.Play; -begin - if Loaded then - begin - if Loop then - BASS_ChannelPlay(Bass, True); // start from beginning... actually bass itself does not loop, nor does this TAudio_bass Class - - BASS_ChannelPlay(Bass, False); // for setting position before playing - end; -end; - -procedure TAudio_bass.Pause; //Pause Mod -begin - if Loaded then begin - BASS_ChannelPause(Bass); // Pauses Song - end; -end; - -procedure TAudio_bass.Stop; -begin - Bass_ChannelStop(Bass); -end; - -procedure TAudio_bass.Close; -begin - Bass_StreamFree(Bass); -end; - -function TAudio_bass.Length: real; -var - bytes: integer; -begin - Result := 60; - - bytes := BASS_ChannelGetLength(Bass); - Result := BASS_ChannelBytes2Seconds(Bass, bytes); -end; - -function TAudio_bass.getPosition: real; -var - bytes: integer; -begin - Result := 0; - - bytes := BASS_ChannelGetPosition(BASS); - Result := BASS_ChannelBytes2Seconds(BASS, bytes); -end; - -function TAudio_bass.Finished: boolean; -begin - Result := false; - - if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then - begin - Result := true; - end; -end; - -procedure TAudio_bass.PlayStart; -begin - BASS_ChannelPlay(BassStart, True); -end; - -procedure TAudio_bass.PlayBack; -begin - BASS_ChannelPlay(BassBack, True);// then -end; - -procedure TAudio_bass.PlaySwoosh; -begin - BASS_ChannelPlay(BassSwoosh, True); -end; - -procedure TAudio_bass.PlayChange; -begin - BASS_ChannelPlay(BassChange, True); -end; - -procedure TAudio_bass.PlayOption; -begin - BASS_ChannelPlay(BassOption, True); -end; - -procedure TAudio_bass.PlayClick; -begin - BASS_ChannelPlay(BassClick, True); -end; - -procedure TAudio_bass.PlayDrum; -begin - BASS_ChannelPlay(BassDrum, True); -end; - -procedure TAudio_bass.PlayHihat; -begin - BASS_ChannelPlay(BassHihat, True); -end; - -procedure TAudio_bass.PlayClap; -begin - BASS_ChannelPlay(BassClap, True); -end; - -procedure TAudio_bass.PlayShuffle; -begin - BASS_ChannelPlay(BassShuffle, True); -end; - -procedure TAudio_bass.StopShuffle; -begin - BASS_ChannelStop(BassShuffle); -end; - -function TAudio_bass.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; -var - L: Integer; -begin - if FileExists(Name) then - begin - Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); - try - hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); - - //Add CustomSound - L := High(CustomSounds) + 1; - SetLength (CustomSounds, L + 1); - CustomSounds[L].Filename := Name; - CustomSounds[L].Handle := hStream; - except - Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); - end; - end - else - begin - Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); - exit; - end; -end; - -//Equalizer -function TAudio_bass.GetFFTData: TFFTData; -var - Data: TFFTData; -begin - //Get Channel Data Mono and 256 Values - BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); -end; - -{* - * Copies interleaved PCM 16bit uint (maybe fake) stereo samples into data. - * Returns the number of frames (= stereo/mono sample) - *} -function TAudio_bass.GetPCMData(var data: TPCMData): Cardinal; -var - info: BASS_CHANNELINFO; - nBytes: DWORD; -begin - //Get Channel Data Mono and 256 Values - BASS_ChannelGetInfo(Bass, info); - ZeroMemory(@data, sizeof(TPCMData)); - - if (info.chans = 1) then - begin - // mono file -> add stereo channel - { - nBytes := BASS_ChannelGetData(Bass, @data[0], samples*sizeof(Smallint)); - // interleave data - //CopyMemory(@data[1], @data[0], samples*sizeof(Smallint)); - } - result := 0; - end - else - begin - // stereo file - nBytes := BASS_ChannelGetData(Bass, @data, sizeof(TPCMData)); - end; - if(nBytes <= 0) then - result := 0 - else - result := nBytes div sizeof(TPCMStereoSample); -end; - -function TAudio_bass.LoadCustomSound(const Filename: String): Cardinal; -var - S: hStream; - I: Integer; - F: String; -begin - //Search for Sound in already loaded Sounds - F := UpperCase(SoundPath + FileName); - For I := 0 to High(CustomSounds) do - begin - if (UpperCase(CustomSounds[I].Filename) = F) then - begin - Result := I; - Exit; - end; - end; - - if LoadSoundFromFile(S, SoundPath + Filename) then - Result := High(CustomSounds) - else - Result := 0; -end; - -procedure TAudio_bass.PlayCustomSound(const Index: Cardinal ); -begin - if Index <= High(CustomSounds) then - BASS_ChannelPlay(CustomSounds[Index].Handle, True); -end; - -{$IFDEF UseBASSInput} - -procedure TAudio_bass.InitializeRecord; -var - device: integer; - Descr: string; - input: integer; - input2: integer; - InputName: PChar; - Flags: integer; - mic: array[0..15] of integer; - SC: integer; // soundcard - SCI: integer; // soundcard input - No: integer; - -function isDuplicate(Desc: String): Boolean; -var - I: Integer; -begin - Result := False; - //Check for Soundcard with same Description - For I := 0 to SC-1 do - begin - if (Recording.SoundCard[I].Description = Desc) then - begin - Result := True; - Break; - end; - end; -end; - -begin - with Recording do - begin - // checks for recording devices and puts them into an array - SetLength(SoundCard, 0); - - SC := 0; - Descr := BASS_RecordGetDeviceDescription(SC); - - while (Descr <> '') do - begin - //If there is another SoundCard with the Same ID, Search an available Name - if (IsDuplicate(Descr)) then - begin - No:= 1; //Count of SoundCards with same Name - Repeat - Inc(No) - Until not IsDuplicate(Descr + ' (' + InttoStr(No) + ')'); - - //Set Description - Descr := Descr + ' (' + InttoStr(No) + ')'; - end; - - SetLength(SoundCard, SC+1); - - // TODO: free object on termination - SoundCard[SC] := TBassSoundCard.Create(); - SoundCard[SC].Description := Descr; - - //Get Recording Inputs - SCI := 0; - BASS_RecordInit(SC); - - InputName := BASS_RecordGetInputName(SCI); - - {$IFDEF DARWIN} - // Under MacOSX the SingStar Mics have an empty - // InputName. So, we have to add a hard coded - // Workaround for this problem - if (InputName = nil) and (Pos( 'USBMIC Serial#', Descr) > 0) then - begin - InputName := 'Microphone'; - end; - {$ENDIF} - - SetLength(SoundCard[SC].Input, 1); - SoundCard[SC].Input[SCI].Name := InputName; - - // process each input - while (InputName <> nil) do - begin - Flags := BASS_RecordGetInput(SCI); - if (SCI >= 1) {AND (Flags AND BASS_INPUT_OFF = 0)} then - begin - SetLength(SoundCard[SC].Input, SCI+1); - SoundCard[SC].Input[SCI].Name := InputName; - end; - - //Set Mic Index - if ((Flags and BASS_INPUT_TYPE_MIC) = 1) then - SoundCard[SC].MicInput := SCI; - - Inc(SCI); - InputName := BASS_RecordGetInputName(SCI); - end; - - BASS_RecordFree; - - Inc(SC); - Descr := BASS_RecordGetDeviceDescription(SC); - end; // while - end; // with Recording -end; - -// TODO: code is used by all IAudioInput implementors -// -> move to a common superclass (TAudioInput_Generic?) -procedure TAudio_bass.CaptureStart; -var - S: integer; - SC: integer; - PlayerLeft, PlayerRight: integer; - CaptureSoundLeft, CaptureSoundRight: TSound; -begin - for S := 0 to High(Recording.Sound) do - Recording.Sound[S].BufferLong[0].Clear; - - for SC := 0 to High(Ini.CardList) do begin - PlayerLeft := Ini.CardList[SC].ChannelL-1; - PlayerRight := Ini.CardList[SC].ChannelR-1; - if PlayerLeft >= PlayersPlay then PlayerLeft := -1; - if PlayerRight >= PlayersPlay then PlayerRight := -1; - if (PlayerLeft > -1) or (PlayerRight > -1) then begin - if (PlayerLeft > -1) then - CaptureSoundLeft := Recording.Sound[PlayerLeft] - else - CaptureSoundLeft := nil; - if (PlayerRight > -1) then - CaptureSoundRight := Recording.Sound[PlayerRight] - else - CaptureSoundRight := nil; - - CaptureCard(SC, CaptureSoundLeft, CaptureSoundRight); - end; - end; -end; - -// TODO: code is used by all IAudioInput implementors -// -> move to a common superclass (TAudioInput_Generic?) -procedure TAudio_bass.CaptureStop; -var - SC: integer; - PlayerLeft: integer; - PlayerRight: integer; -begin - - for SC := 0 to High(Ini.CardList) do begin - PlayerLeft := Ini.CardList[SC].ChannelL-1; - PlayerRight := Ini.CardList[SC].ChannelR-1; - if PlayerLeft >= PlayersPlay then PlayerLeft := -1; - if PlayerRight >= PlayersPlay then PlayerRight := -1; - if (PlayerLeft > -1) or (PlayerRight > -1) then - StopCard(SC); - end; - -end; - -{* - * Bass input capture callback. - * Params: - * stream - BASS input stream - * buffer - buffer of captured samples - * len - size of buffer in bytes - * user - players associated with left/right channels - *} -function MicrophoneCallback(stream: HSTREAM; buffer: Pointer; - len: Cardinal; Card: Cardinal): boolean; stdcall; -begin - Recording.HandleMicrophoneData(buffer, len, Recording.SoundCard[Card]); - Result := true; -end; - -{* - * Start input-capturing on Soundcard specified by Card. - * Params: - * Card - soundcard index in Recording.SoundCard array - * CaptureSoundLeft - sound(-buffer) used for left channel capture data - * CaptureSoundRight - sound(-buffer) used for right channel capture data - *} -procedure TAudio_bass.CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); -var - Error: integer; - ErrorMsg: string; - bassSoundCard: TBassSoundCard; -begin - if not BASS_RecordInit(Card) then - begin - Error := BASS_ErrorGetCode; - ErrorMsg := IntToStr(Error); - if Error = BASS_ERROR_DX then ErrorMsg := 'No DX5'; - if Error = BASS_ERROR_ALREADY then ErrorMsg := 'The device has already been initialized'; - if Error = BASS_ERROR_DEVICE then ErrorMsg := 'The device number specified is invalid'; - if Error = BASS_ERROR_DRIVER then ErrorMsg := 'There is no available device driver'; - Log.LogError('Error initializing record [' + IntToStr(Card) + ']'); - Log.LogError('TAudio_bass.CaptureCard: Error initializing record: ' + ErrorMsg); - end - else - begin - bassSoundCard := TBassSoundCard(Recording.SoundCard[Card]); - bassSoundCard.CaptureSoundLeft := CaptureSoundLeft; - bassSoundCard.CaptureSoundRight := CaptureSoundRight; - - // capture in 44.1kHz/stereo/16bit and a 20ms callback period - bassSoundCard.RecordStream := - BASS_RecordStart(44100, 2, MakeLong(0, 20) , @MicrophoneCallback, Card); - end; -end; - -{* - * Stop input-capturing on Soundcard specified by Card. - * Params: - * Card - soundcard index in Recording.SoundCard array - *} -procedure TAudio_bass.StopCard(Card: byte); -begin - BASS_RecordSetDevice(Card); - BASS_RecordFree; -end; - -{$ENDIF} - - -initialization - singleton_MusicBass := TAudio_bass.create(); - - writeln( 'UAudio_Bass - Register' ); - AudioManager.add( singleton_MusicBass ); - -finalization - writeln( 'UAudio_Bass - UnRegister' ); - AudioManager.Remove( singleton_MusicBass ); - -end. +unit UAudio_bass; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +uses Classes, + {$IFDEF win32} + windows, + {$ENDIF} + Messages, + SysUtils, + {$IFNDEF FPC} + Forms, + {$ENDIF} + bass, + ULog, + UMusic; + +implementation + +uses + {$IFDEF LAZARUS} + lclintf, + {$ENDIF} + URecord, + UIni, + UMain, + UCommon, + UThemes; + +type + TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, + mpPaused, mpOpen); + +const + ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); + +type +{$IFDEF UseBASSInput} + TAudio_bass = class( TInterfacedObject, IAudioPlayback, IAudioInput) +{$ELSE} + TAudio_bass = class( TInterfacedObject, IAudioPlayback) +{$ENDIF} + private + BassStart: hStream; // Wait, I've replaced this with BASS + BassBack: hStream; // It has almost all features we need + BassSwoosh: hStream; + BassChange: hStream; // Almost? It aleady has them all :) + BassOption: hStream; + BassClick: hStream; + BassDrum: hStream; + BassHihat: hStream; + BassClap: hStream; + BassShuffle: hStream; + + //Custom Sounds + CustomSounds: array of TCustomSoundEntry; + Loaded: boolean; + Loop: boolean; + + public + Bass: hStream; + function GetName: String; + + {IAudioOutput interface} + + procedure InitializePlayback; + procedure SetVolume(Volume: integer); + procedure SetMusicVolume(Volume: integer); + procedure SetLoop(Enabled: boolean); + function Open(Name: string): boolean; // true if succeed + procedure Rewind; + procedure MoveTo(Time: real); + procedure Play; + procedure Pause; //Pause Mod + procedure Stop; + procedure Close; + function Finished: boolean; + function Length: real; + function getPosition: real; + procedure PlayStart; + procedure PlayBack; + procedure PlaySwoosh; + procedure PlayChange; + procedure PlayOption; + procedure PlayClick; + procedure PlayDrum; + procedure PlayHihat; + procedure PlayClap; + procedure PlayShuffle; + procedure StopShuffle; + function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; + + //Equalizer + function GetFFTData: TFFTData; + + // Interface for Visualizer + function GetPCMData(var data: TPCMData): Cardinal; + + //Custom Sounds + function LoadCustomSound(const Filename: String): Cardinal; + procedure PlayCustomSound(const Index: Cardinal ); + + {IAudioInput interface} + {$IFDEF UseBASSInput} + procedure InitializeRecord; + + procedure CaptureStart; + procedure CaptureStop; + procedure CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); + procedure StopCard(Card: byte); + {$ENDIF} + end; + +{$IFDEF UseBASSInput} + TBassSoundCard = class(TGenericSoundCard) + RecordStream: HSTREAM; + end; +{$ENDIF} + + +var + singleton_MusicBass : IAudioPlayback; + +function TAudio_bass.GetName: String; +begin + result := 'BASS'; +end; + +procedure TAudio_bass.InitializePlayback; +var + Pet: integer; + S: integer; +begin +// Log.BenchmarkStart(4); +// Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); + + Loaded := false; + Loop := false; + + if not BASS_Init(1, 44100, 0, 0, nil) then + begin + Log.LogError('Could not initialize BASS', 'Error'); + Exit; + end; + +// Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); + + // config playing buffer +// BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); +// BASS_SetConfig(BASS_CONFIG_BUFFER, 100); + +// Log.LogStatus('Loading Sounds', 'Music Initialize'); + +// Log.BenchmarkStart(4); + LoadSoundFromFile(BassStart, SoundPath + 'Common Start.mp3'); + LoadSoundFromFile(BassBack, SoundPath + 'Common Back.mp3'); + LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3'); + LoadSoundFromFile(BassChange, SoundPath + 'select music change music 50.mp3'); + LoadSoundFromFile(BassOption, SoundPath + 'option change col.mp3'); + LoadSoundFromFile(BassClick, SoundPath + 'rimshot022b.mp3'); + +// LoadSoundFromFile(BassDrum, SoundPath + 'bassdrumhard076b.mp3'); +// LoadSoundFromFile(BassHihat, SoundPath + 'hihatclosed068b.mp3'); +// LoadSoundFromFile(BassClap, SoundPath + 'claps050b.mp3'); + +// LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3'); + +// Log.BenchmarkEnd(4); +// Log.LogBenchmark('--> Loading Sounds', 4); +end; + +procedure TAudio_bass.SetVolume(Volume: integer); +begin + //Old Sets Wave Volume + //BASS_SetVolume(Volume); + //New: Sets Volume only for this Application + + BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); +end; + +procedure TAudio_bass.SetMusicVolume(Volume: Integer); +begin + //Max Volume Prevention + if Volume > 100 then + Volume := 100; + + if Volume < 0 then + Volume := 0; + + + //Set Volume + // TODO : jb_linux replace with something other than bass + BASS_ChannelSetAttributes (Bass, -1, Volume, -101); +end; + +procedure TAudio_bass.SetLoop(Enabled: boolean); +begin + Loop := Enabled; +end; + +function TAudio_bass.Open(Name: string): boolean; +begin + Loaded := false; + if FileExists(Name) then + begin + Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); + + Loaded := true; + //Set Max Volume + SetMusicVolume (100); + end; + + Result := Loaded; +end; + +procedure TAudio_bass.Rewind; +begin + if Loaded then begin + end; +end; + +procedure TAudio_bass.MoveTo(Time: real); +var + bytes: integer; +begin + bytes := BASS_ChannelSeconds2Bytes(Bass, Time); + BASS_ChannelSetPosition(Bass, bytes); +end; + +procedure TAudio_bass.Play; +begin + if Loaded then + begin + if Loop then + BASS_ChannelPlay(Bass, True); // start from beginning... actually bass itself does not loop, nor does this TAudio_bass Class + + BASS_ChannelPlay(Bass, False); // for setting position before playing + end; +end; + +procedure TAudio_bass.Pause; //Pause Mod +begin + if Loaded then begin + BASS_ChannelPause(Bass); // Pauses Song + end; +end; + +procedure TAudio_bass.Stop; +begin + Bass_ChannelStop(Bass); +end; + +procedure TAudio_bass.Close; +begin + Bass_StreamFree(Bass); +end; + +function TAudio_bass.Length: real; +var + bytes: integer; +begin + Result := 60; + + bytes := BASS_ChannelGetLength(Bass); + Result := BASS_ChannelBytes2Seconds(Bass, bytes); +end; + +function TAudio_bass.getPosition: real; +var + bytes: integer; +begin + Result := 0; + + bytes := BASS_ChannelGetPosition(BASS); + Result := BASS_ChannelBytes2Seconds(BASS, bytes); +end; + +function TAudio_bass.Finished: boolean; +begin + Result := false; + + if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then + begin + Result := true; + end; +end; + +procedure TAudio_bass.PlayStart; +begin + BASS_ChannelPlay(BassStart, True); +end; + +procedure TAudio_bass.PlayBack; +begin + BASS_ChannelPlay(BassBack, True);// then +end; + +procedure TAudio_bass.PlaySwoosh; +begin + BASS_ChannelPlay(BassSwoosh, True); +end; + +procedure TAudio_bass.PlayChange; +begin + BASS_ChannelPlay(BassChange, True); +end; + +procedure TAudio_bass.PlayOption; +begin + BASS_ChannelPlay(BassOption, True); +end; + +procedure TAudio_bass.PlayClick; +begin + BASS_ChannelPlay(BassClick, True); +end; + +procedure TAudio_bass.PlayDrum; +begin + BASS_ChannelPlay(BassDrum, True); +end; + +procedure TAudio_bass.PlayHihat; +begin + BASS_ChannelPlay(BassHihat, True); +end; + +procedure TAudio_bass.PlayClap; +begin + BASS_ChannelPlay(BassClap, True); +end; + +procedure TAudio_bass.PlayShuffle; +begin + BASS_ChannelPlay(BassShuffle, True); +end; + +procedure TAudio_bass.StopShuffle; +begin + BASS_ChannelStop(BassShuffle); +end; + +function TAudio_bass.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; +var + L: Integer; +begin + if FileExists(Name) then + begin + Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); + try + hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); + + //Add CustomSound + L := High(CustomSounds) + 1; + SetLength (CustomSounds, L + 1); + CustomSounds[L].Filename := Name; + CustomSounds[L].Handle := hStream; + except + Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); + end; + end + else + begin + Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); + exit; + end; +end; + +//Equalizer +function TAudio_bass.GetFFTData: TFFTData; +var + Data: TFFTData; +begin + //Get Channel Data Mono and 256 Values + BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); +end; + +{* + * Copies interleaved PCM 16bit uint (maybe fake) stereo samples into data. + * Returns the number of frames (= stereo/mono sample) + *} +function TAudio_bass.GetPCMData(var data: TPCMData): Cardinal; +var + info: BASS_CHANNELINFO; + nBytes: DWORD; +begin + //Get Channel Data Mono and 256 Values + BASS_ChannelGetInfo(Bass, info); + ZeroMemory(@data, sizeof(TPCMData)); + + if (info.chans = 1) then + begin + // mono file -> add stereo channel + { + nBytes := BASS_ChannelGetData(Bass, @data[0], samples*sizeof(Smallint)); + // interleave data + //CopyMemory(@data[1], @data[0], samples*sizeof(Smallint)); + } + result := 0; + end + else + begin + // stereo file + nBytes := BASS_ChannelGetData(Bass, @data, sizeof(TPCMData)); + end; + if(nBytes <= 0) then + result := 0 + else + result := nBytes div sizeof(TPCMStereoSample); +end; + +function TAudio_bass.LoadCustomSound(const Filename: String): Cardinal; +var + S: hStream; + I: Integer; + F: String; +begin + //Search for Sound in already loaded Sounds + F := UpperCase(SoundPath + FileName); + For I := 0 to High(CustomSounds) do + begin + if (UpperCase(CustomSounds[I].Filename) = F) then + begin + Result := I; + Exit; + end; + end; + + if LoadSoundFromFile(S, SoundPath + Filename) then + Result := High(CustomSounds) + else + Result := 0; +end; + +procedure TAudio_bass.PlayCustomSound(const Index: Cardinal ); +begin + if Index <= High(CustomSounds) then + BASS_ChannelPlay(CustomSounds[Index].Handle, True); +end; + +{$IFDEF UseBASSInput} + +procedure TAudio_bass.InitializeRecord; +var + device: integer; + Descr: string; + input: integer; + input2: integer; + InputName: PChar; + Flags: integer; + mic: array[0..15] of integer; + SC: integer; // soundcard + SCI: integer; // soundcard input + No: integer; + +function isDuplicate(Desc: String): Boolean; +var + I: Integer; +begin + Result := False; + //Check for Soundcard with same Description + For I := 0 to SC-1 do + begin + if (Recording.SoundCard[I].Description = Desc) then + begin + Result := True; + Break; + end; + end; +end; + +begin + with Recording do + begin + // checks for recording devices and puts them into an array + SetLength(SoundCard, 0); + + SC := 0; + Descr := BASS_RecordGetDeviceDescription(SC); + + while (Descr <> '') do + begin + //If there is another SoundCard with the Same ID, Search an available Name + if (IsDuplicate(Descr)) then + begin + No:= 1; //Count of SoundCards with same Name + Repeat + Inc(No) + Until not IsDuplicate(Descr + ' (' + InttoStr(No) + ')'); + + //Set Description + Descr := Descr + ' (' + InttoStr(No) + ')'; + end; + + SetLength(SoundCard, SC+1); + + // TODO: free object on termination + SoundCard[SC] := TBassSoundCard.Create(); + SoundCard[SC].Description := Descr; + + //Get Recording Inputs + SCI := 0; + BASS_RecordInit(SC); + + InputName := BASS_RecordGetInputName(SCI); + + {$IFDEF DARWIN} + // Under MacOSX the SingStar Mics have an empty + // InputName. So, we have to add a hard coded + // Workaround for this problem + if (InputName = nil) and (Pos( 'USBMIC Serial#', Descr) > 0) then + begin + InputName := 'Microphone'; + end; + {$ENDIF} + + SetLength(SoundCard[SC].Input, 1); + SoundCard[SC].Input[SCI].Name := InputName; + + // process each input + while (InputName <> nil) do + begin + Flags := BASS_RecordGetInput(SCI); + if (SCI >= 1) {AND (Flags AND BASS_INPUT_OFF = 0)} then + begin + SetLength(SoundCard[SC].Input, SCI+1); + SoundCard[SC].Input[SCI].Name := InputName; + end; + + //Set Mic Index + if ((Flags and BASS_INPUT_TYPE_MIC) = 1) then + SoundCard[SC].MicInput := SCI; + + Inc(SCI); + InputName := BASS_RecordGetInputName(SCI); + end; + + BASS_RecordFree; + + Inc(SC); + Descr := BASS_RecordGetDeviceDescription(SC); + end; // while + end; // with Recording +end; + +// TODO: code is used by all IAudioInput implementors +// -> move to a common superclass (TAudioInput_Generic?) +procedure TAudio_bass.CaptureStart; +var + S: integer; + SC: integer; + PlayerLeft, PlayerRight: integer; + CaptureSoundLeft, CaptureSoundRight: TSound; +begin + for S := 0 to High(Recording.Sound) do + Recording.Sound[S].BufferLong[0].Clear; + + for SC := 0 to High(Ini.CardList) do begin + PlayerLeft := Ini.CardList[SC].ChannelL-1; + PlayerRight := Ini.CardList[SC].ChannelR-1; + if PlayerLeft >= PlayersPlay then PlayerLeft := -1; + if PlayerRight >= PlayersPlay then PlayerRight := -1; + if (PlayerLeft > -1) or (PlayerRight > -1) then begin + if (PlayerLeft > -1) then + CaptureSoundLeft := Recording.Sound[PlayerLeft] + else + CaptureSoundLeft := nil; + if (PlayerRight > -1) then + CaptureSoundRight := Recording.Sound[PlayerRight] + else + CaptureSoundRight := nil; + + CaptureCard(SC, CaptureSoundLeft, CaptureSoundRight); + end; + end; +end; + +// TODO: code is used by all IAudioInput implementors +// -> move to a common superclass (TAudioInput_Generic?) +procedure TAudio_bass.CaptureStop; +var + SC: integer; + PlayerLeft: integer; + PlayerRight: integer; +begin + + for SC := 0 to High(Ini.CardList) do begin + PlayerLeft := Ini.CardList[SC].ChannelL-1; + PlayerRight := Ini.CardList[SC].ChannelR-1; + if PlayerLeft >= PlayersPlay then PlayerLeft := -1; + if PlayerRight >= PlayersPlay then PlayerRight := -1; + if (PlayerLeft > -1) or (PlayerRight > -1) then + StopCard(SC); + end; + +end; + +{* + * Bass input capture callback. + * Params: + * stream - BASS input stream + * buffer - buffer of captured samples + * len - size of buffer in bytes + * user - players associated with left/right channels + *} +function MicrophoneCallback(stream: HSTREAM; buffer: Pointer; + len: Cardinal; Card: Cardinal): boolean; stdcall; +begin + Recording.HandleMicrophoneData(buffer, len, Recording.SoundCard[Card]); + Result := true; +end; + +{* + * Start input-capturing on Soundcard specified by Card. + * Params: + * Card - soundcard index in Recording.SoundCard array + * CaptureSoundLeft - sound(-buffer) used for left channel capture data + * CaptureSoundRight - sound(-buffer) used for right channel capture data + *} +procedure TAudio_bass.CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); +var + Error: integer; + ErrorMsg: string; + bassSoundCard: TBassSoundCard; +begin + if not BASS_RecordInit(Card) then + begin + Error := BASS_ErrorGetCode; + ErrorMsg := IntToStr(Error); + if Error = BASS_ERROR_DX then ErrorMsg := 'No DX5'; + if Error = BASS_ERROR_ALREADY then ErrorMsg := 'The device has already been initialized'; + if Error = BASS_ERROR_DEVICE then ErrorMsg := 'The device number specified is invalid'; + if Error = BASS_ERROR_DRIVER then ErrorMsg := 'There is no available device driver'; + Log.LogError('Error initializing record [' + IntToStr(Card) + ']'); + Log.LogError('TAudio_bass.CaptureCard: Error initializing record: ' + ErrorMsg); + end + else + begin + bassSoundCard := TBassSoundCard(Recording.SoundCard[Card]); + bassSoundCard.CaptureSoundLeft := CaptureSoundLeft; + bassSoundCard.CaptureSoundRight := CaptureSoundRight; + + // capture in 44.1kHz/stereo/16bit and a 20ms callback period + bassSoundCard.RecordStream := + BASS_RecordStart(44100, 2, MakeLong(0, 20) , @MicrophoneCallback, Card); + end; +end; + +{* + * Stop input-capturing on Soundcard specified by Card. + * Params: + * Card - soundcard index in Recording.SoundCard array + *} +procedure TAudio_bass.StopCard(Card: byte); +begin + BASS_RecordSetDevice(Card); + BASS_RecordFree; +end; + +{$ENDIF} + + +initialization + singleton_MusicBass := TAudio_bass.create(); + AudioManager.add( singleton_MusicBass ); + +finalization + AudioManager.Remove( singleton_MusicBass ); + +end. diff --git a/Game/Code/Classes/UAudio_portaudio.pas b/Game/Code/Classes/UAudio_portaudio.pas index 941d90d1..47e54981 100644 --- a/Game/Code/Classes/UAudio_portaudio.pas +++ b/Game/Code/Classes/UAudio_portaudio.pas @@ -419,11 +419,9 @@ end; initialization singleton_MusicPortaudio := TAudio_Portaudio.create(); - writeln( 'UAudio_Portaudio - Register' ); AudioManager.add( singleton_MusicPortaudio ); finalization - writeln( 'UAudio_Portaudio - UnRegister' ); AudioManager.Remove( singleton_MusicPortaudio ); end. diff --git a/Game/Code/Classes/UCommandLine.pas b/Game/Code/Classes/UCommandLine.pas index 01ece795..6a5a4808 100644 --- a/Game/Code/Classes/UCommandLine.pas +++ b/Game/Code/Classes/UCommandLine.pas @@ -1,294 +1,328 @@ -unit UCommandLine; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - - -type - //----------- - // TCMDParams - Class Reaads Infos from ParamStr and set some easy Interface Variables - //----------- - TCMDParams = class - private - sLanguage: String; - sResolution: String; - public - //Some Boolean Variables Set when Reading Infos - Debug: Boolean; - Benchmark: Boolean; - NoLog: Boolean; - FullScreen: Boolean; - Joypad: Boolean; - - //Some Value Variables Set when Reading Infos {-1: Not Set, others: Value} - Depth: Integer; - Screens: Integer; - - //Some Strings Set when Reading Infos {Length=0 Not Set} - SongPath: String; - ConfigFile: String; - ScoreFile: String; - - //Pseudo Integer Values - Function GetLanguage: Integer; - Property Language: Integer read GetLanguage; - - Function GetResolution: Integer; - Property Resolution: Integer read GetResolution; - - //Some Procedures for Reading Infos - Constructor Create; - - Procedure ResetVariables; - Procedure ReadParamInfo; - end; - -var - Params: TCMDParams; - -implementation - -uses SysUtils; -// uINI -- Nasty requirement... ( removed with permission of blindy ) - - -//------------- -// Constructor - Create class, Reset Variables and Read Infos -//------------- -Constructor TCMDParams.Create; -begin - ResetVariables; - ReadParamInfo; -end; - -//------------- -// ResetVariables - Reset Class Variables -//------------- -Procedure TCMDParams.ResetVariables; -begin - Debug := False; - Benchmark := False; - NoLog := False; - FullScreen := False; - Joypad := False; - - //Some Value Variables Set when Reading Infos {-1: Not Set, others: Value} - sResolution := ''; - sLanguage := ''; - Depth := -1; - Screens := -1; - - //Some Strings Set when Reading Infos {Length=0 Not Set} - SongPath := ''; - ConfigFile := ''; - ScoreFile := ''; -end; - -//------------- -// ReadParamInfo - Read Infos from Parameters -//------------- -Procedure TCMDParams.ReadParamInfo; -var - I: Integer; - PCount: Integer; - Command: String; -begin - PCount := ParamCount; - //Log.LogError('ParamCount: ' + Inttostr(PCount)); - - //Check all Parameters - For I := 1 to PCount do - begin - Command := Paramstr(I); - //Log.LogError('Start parsing Command: ' + Command); - //Is String Parameter ? - if (Length(Command) > 1) AND (Command[1] = '-') then - begin - //Remove - from Command - Command := Lowercase(Trim(Copy(Command, 2, Length(Command) - 1))); - //Log.LogError('Command prepared: ' + Command); - - //Check Command - - // Boolean Triggers: - if (Command = 'debug') then - Debug := True - else if (Command = 'benchmark') then - Benchmark := True - else if (Command = 'nolog') then - NoLog := True - else if (Command = 'fullscreen') then - Fullscreen := True - else if (Command = 'joypad') then - Joypad := True - - //Integer Variables - else if (Command = 'depth') then - begin - //Check if there is another Parameter to get the Value from - if (PCount > I) then - begin - Command := ParamStr(I + 1); - - //Check for valid Value - If (Command = '16') then - Depth := 0 - Else If (Command = '32') then - Depth := 1; - end; - end - - else if (Command = 'screens') then - begin - //Check if there is another Parameter to get the Value from - if (PCount > I) then - begin - Command := ParamStr(I + 1); - - //Check for valid Value - If (Command = '1') then - Screens := 0 - Else If (Command = '2') then - Screens := 1; - end; - end - - //Pseudo Integer Values - else if (Command = 'language') then - begin - //Check if there is another Parameter to get the Value from - if (PCount > I) then - begin - //Write Value to String - sLanguage := Lowercase(ParamStr(I + 1)); - end; - end - - else if (Command = 'resolution') then - begin - //Check if there is another Parameter to get the Value from - if (PCount > I) then - begin - //Write Value to String - sResolution := Lowercase(ParamStr(I + 1)); - end; - end - - //String Values - else if (Command = 'songpath') then - begin - //Check if there is another Parameter to get the Value from - if (PCount > I) then - begin - //Write Value to String - SongPath := ParamStr(I + 1); - end; - end - - else if (Command = 'configfile') then - begin - //Check if there is another Parameter to get the Value from - if (PCount > I) then - begin - //Write Value to String - ConfigFile := ParamStr(I + 1); - - //is this a relative PAth -> then add Gamepath - if Not ((Length(ConfigFile) > 2) AND (ConfigFile[2] = ':')) then - ConfigFile := ExtractFilePath(ParamStr(0)) + Configfile; - end; - end - - else if (Command = 'scorefile') then - begin - //Check if there is another Parameter to get the Value from - if (PCount > I) then - begin - //Write Value to String - ScoreFile := ParamStr(I + 1); - end; - end; - - end; - - end; - -{ Log.LogError('Values: '); - - if Debug then - Log.LogError('Debug'); - - if Benchmark then - Log.LogError('Benchmark'); - - if NoLog then - Log.LogError('NoLog'); - - if Fullscreen then - Log.LogError('FullScreen'); - - if JoyStick then - Log.LogError('Joystick'); - - - Log.LogError('Screens: ' + Inttostr(Screens)); - Log.LogError('Depth: ' + Inttostr(Depth)); - - Log.LogError('Resolution: ' + Inttostr(Resolution)); - Log.LogError('Resolution: ' + Inttostr(Language)); - - Log.LogError('sResolution: ' + sResolution); - Log.LogError('sLanguage: ' + sLanguage); - - Log.LogError('ConfigFile: ' + ConfigFile); - Log.LogError('SongPath: ' + SongPath); - Log.LogError('ScoreFile: ' + ScoreFile); } - -end; - -//------------- -// GetLanguage - Get Language ID from saved String Information -//------------- -Function TCMDParams.GetLanguage: Integer; -var - I: integer; -begin - Result := -1; -{* JB - 12sep07 to remove uINI dependency - - //Search for Language - For I := 0 to high(ILanguage) do - if (LowerCase(ILanguage[I]) = sLanguage) then - begin - Result := I; - Break; - end; -*} -end; - -//------------- -// GetResolution - Get Resolution ID from saved String Information -//------------- -Function TCMDParams.GetResolution: Integer; -var - I: integer; -begin - Result := -1; -{* JB - 12sep07 to remove uINI dependency - - //Search for Resolution - For I := 0 to high(IResolution) do - if (LowerCase(IResolution[I]) = sResolution) then - begin - Result := I; - Break; - end; -*} -end; - -end. +unit UCommandLine; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +type + //----------- + // TCMDParams - Class Reaads Infos from ParamStr and set some easy Interface Variables + //----------- + TCMDParams = class + private + sLanguage: String; + sResolution: String; + public + //Some Boolean Variables Set when Reading Infos + Debug: Boolean; + Benchmark: Boolean; + NoLog: Boolean; + FullScreen: Boolean; + Joypad: Boolean; + + //Some Value Variables Set when Reading Infos {-1: Not Set, others: Value} + Depth: Integer; + Screens: Integer; + + //Some Strings Set when Reading Infos {Length=0 Not Set} + SongPath: String; + ConfigFile: String; + ScoreFile: String; + + procedure showhelp(); + + //Pseudo Integer Values + Function GetLanguage: Integer; + Property Language: Integer read GetLanguage; + + Function GetResolution: Integer; + Property Resolution: Integer read GetResolution; + + //Some Procedures for Reading Infos + Constructor Create; + + Procedure ResetVariables; + Procedure ReadParamInfo; + end; + +var + Params: TCMDParams; + +const + cHelp = 'help'; + cMediaInterfaces = 'showinterfaces'; + + +implementation + +uses SysUtils; +// uINI -- Nasty requirement... ( removed with permission of blindy ) + + +//------------- +// Constructor - Create class, Reset Variables and Read Infos +//------------- +Constructor TCMDParams.Create; +begin + + if FindCmdLineSwitch( cHelp ) then + showhelp(); + + ResetVariables; + ReadParamInfo; +end; + +procedure TCMDParams.showhelp(); + + function s( aString : String ) : string; + begin + result := aString + StringofChar( ' ', 15 - length( aString ) ); + end; + +begin + + writeln( '' ); + writeln( '**************************************************************' ); + writeln( ' UltraStar Deluxe - Command line switches ' ); + writeln( '**************************************************************' ); + writeln( '' ); + writeln( ' '+s( 'Switch' ) +' : Purpose' ); + writeln( ' ----------------------------------------------------------' ); + writeln( ' '+s( cMediaInterfaces ) + ' : Show in-use media interfaces' ); + writeln( '' ); + + halt(); +end; + +//------------- +// ResetVariables - Reset Class Variables +//------------- +Procedure TCMDParams.ResetVariables; +begin + Debug := False; + Benchmark := False; + NoLog := False; + FullScreen := False; + Joypad := False; + + //Some Value Variables Set when Reading Infos {-1: Not Set, others: Value} + sResolution := ''; + sLanguage := ''; + Depth := -1; + Screens := -1; + + //Some Strings Set when Reading Infos {Length=0 Not Set} + SongPath := ''; + ConfigFile := ''; + ScoreFile := ''; +end; + +//------------- +// ReadParamInfo - Read Infos from Parameters +//------------- +Procedure TCMDParams.ReadParamInfo; +var + I: Integer; + PCount: Integer; + Command: String; +begin + PCount := ParamCount; + //Log.LogError('ParamCount: ' + Inttostr(PCount)); + + + //Check all Parameters + For I := 1 to PCount do + begin + Command := Paramstr(I); + //Log.LogError('Start parsing Command: ' + Command); + //Is String Parameter ? + if (Length(Command) > 1) AND (Command[1] = '-') then + begin + //Remove - from Command + Command := Lowercase(Trim(Copy(Command, 2, Length(Command) - 1))); + //Log.LogError('Command prepared: ' + Command); + + //Check Command + + // Boolean Triggers: + if (Command = 'debug') then + Debug := True + else if (Command = 'benchmark') then + Benchmark := True + else if (Command = 'nolog') then + NoLog := True + else if (Command = 'fullscreen') then + Fullscreen := True + else if (Command = 'joypad') then + Joypad := True + + //Integer Variables + else if (Command = 'depth') then + begin + //Check if there is another Parameter to get the Value from + if (PCount > I) then + begin + Command := ParamStr(I + 1); + + //Check for valid Value + If (Command = '16') then + Depth := 0 + Else If (Command = '32') then + Depth := 1; + end; + end + + else if (Command = 'screens') then + begin + //Check if there is another Parameter to get the Value from + if (PCount > I) then + begin + Command := ParamStr(I + 1); + + //Check for valid Value + If (Command = '1') then + Screens := 0 + Else If (Command = '2') then + Screens := 1; + end; + end + + //Pseudo Integer Values + else if (Command = 'language') then + begin + //Check if there is another Parameter to get the Value from + if (PCount > I) then + begin + //Write Value to String + sLanguage := Lowercase(ParamStr(I + 1)); + end; + end + + else if (Command = 'resolution') then + begin + //Check if there is another Parameter to get the Value from + if (PCount > I) then + begin + //Write Value to String + sResolution := Lowercase(ParamStr(I + 1)); + end; + end + + //String Values + else if (Command = 'songpath') then + begin + //Check if there is another Parameter to get the Value from + if (PCount > I) then + begin + //Write Value to String + SongPath := ParamStr(I + 1); + end; + end + + else if (Command = 'configfile') then + begin + //Check if there is another Parameter to get the Value from + if (PCount > I) then + begin + //Write Value to String + ConfigFile := ParamStr(I + 1); + + //is this a relative PAth -> then add Gamepath + if Not ((Length(ConfigFile) > 2) AND (ConfigFile[2] = ':')) then + ConfigFile := ExtractFilePath(ParamStr(0)) + Configfile; + end; + end + + else if (Command = 'scorefile') then + begin + //Check if there is another Parameter to get the Value from + if (PCount > I) then + begin + //Write Value to String + ScoreFile := ParamStr(I + 1); + end; + end; + + end; + + end; + +{ Log.LogError('Values: '); + + if Debug then + Log.LogError('Debug'); + + if Benchmark then + Log.LogError('Benchmark'); + + if NoLog then + Log.LogError('NoLog'); + + if Fullscreen then + Log.LogError('FullScreen'); + + if JoyStick then + Log.LogError('Joystick'); + + + Log.LogError('Screens: ' + Inttostr(Screens)); + Log.LogError('Depth: ' + Inttostr(Depth)); + + Log.LogError('Resolution: ' + Inttostr(Resolution)); + Log.LogError('Resolution: ' + Inttostr(Language)); + + Log.LogError('sResolution: ' + sResolution); + Log.LogError('sLanguage: ' + sLanguage); + + Log.LogError('ConfigFile: ' + ConfigFile); + Log.LogError('SongPath: ' + SongPath); + Log.LogError('ScoreFile: ' + ScoreFile); } + +end; + +//------------- +// GetLanguage - Get Language ID from saved String Information +//------------- +Function TCMDParams.GetLanguage: Integer; +var + I: integer; +begin + Result := -1; +{* JB - 12sep07 to remove uINI dependency + + //Search for Language + For I := 0 to high(ILanguage) do + if (LowerCase(ILanguage[I]) = sLanguage) then + begin + Result := I; + Break; + end; +*} +end; + +//------------- +// GetResolution - Get Resolution ID from saved String Information +//------------- +Function TCMDParams.GetResolution: Integer; +var + I: integer; +begin + Result := -1; +{* JB - 12sep07 to remove uINI dependency + + //Search for Resolution + For I := 0 to high(IResolution) do + if (LowerCase(IResolution[I]) = sResolution) then + begin + Result := I; + Break; + end; +*} +end; + +end. diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 67ec2ea8..b97408d4 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -120,7 +120,10 @@ procedure ClearScores(PlayerNum: integer); implementation -uses USongs, UJoystick, math, UCommandLine, ULanguage, SDL_ttf, +uses USongs, + UJoystick, + math, + UCommandLine, ULanguage, SDL_ttf, USkins, UCovers, UCatCovers, UDataBase, UPlaylist, UDLLManager, UParty, UCore, UGraphicClasses, UPluginDefs, UPlatform; diff --git a/Game/Code/Classes/UMedia_dummy.pas b/Game/Code/Classes/UMedia_dummy.pas index a5cc4b5a..697dc2f9 100644 --- a/Game/Code/Classes/UMedia_dummy.pas +++ b/Game/Code/Classes/UMedia_dummy.pas @@ -171,37 +171,9 @@ begin result := data; end; -var count: integer = 0; - function Tmedia_dummy.GetPCMData(var data: TPCMData): Cardinal; -var i: integer; -begin - // Produce some fake PCM data - if ( count mod 500 = 0 ) then - begin - for i := 0 to 511 do begin - data[0][i] := 0; - data[1][i] := 0; - end; - end - else begin - for i := 0 to 511 do begin - if ( i mod 2 = 0 ) then begin - data[0][i] := floor(Random * power(2.,14)); - data[1][i] := floor(Random * power(2.,14)); - end - else begin; - data[0][i] := floor(Random * power(2.,14)); - data[1][i] := floor(Random * power(2.,14)); - end; - if ( i mod 2 = 1 ) then begin - data[0][i] := -data[0][i]; - data[1][i] := -data[1][i]; - end; - end; - end; - Inc(count); - result := 512; +begin + result := 0; end; // IAudioPlayback @@ -293,16 +265,11 @@ procedure Tmedia_dummy.PlayCustomSound(const Index: Cardinal ); begin end; - - initialization singleton_dummy := Tmedia_dummy.create(); - - writeln( 'UMedia_dummy - Register' ); AudioManager.add( singleton_dummy ); finalization - writeln( 'UMedia_dummy - UnRegister' ); AudioManager.Remove( singleton_dummy ); end. diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index 2cdcc707..7e1aa839 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -109,21 +109,12 @@ type procedure MoveTo(Time: real); function getPosition: real; - - property position : real READ getPosition WRITE MoveTo; + + property position : real READ getPosition WRITE MoveTo; end; IVideoPlayback = Interface( IGenericPlayback ) ['{3574C40C-28AE-4201-B3D1-3D1F0759B131}'] -(* - procedure FFmpegOpenFile(FileName: pAnsiChar); - procedure FFmpegClose; - - procedure FFmpegGetFrame(Time: Extended); - procedure FFmpegDrawGL(Screen: integer); - procedure FFmpegTogglePause; - procedure FFmpegSkip(Time: Single); -*) procedure init(); procedure GetFrame(Time: Extended); // WANT TO RENAME THESE TO BE MORE GENERIC @@ -141,16 +132,10 @@ type procedure SetVolume(Volume: integer); procedure SetMusicVolume(Volume: integer); procedure SetLoop(Enabled: boolean); -// function Open(Name: string): boolean; // true if succeed + procedure Rewind; -// procedure MoveTo(Time: real); -// procedure Play; -// procedure Pause; -// procedure Stop; -// procedure Close; - function Finished: boolean; - function Length: real; -// function getPosition: real; + function Finished: boolean; + function Length: real; procedure PlayStart; procedure PlayBack; @@ -211,7 +196,8 @@ function AudioManager: TInterfaceList; implementation uses - sysutils; + sysutils, + UCommandLine; // uLog; var @@ -264,7 +250,6 @@ begin singleton_VideoPlayback := nil; singleton_Visualization := nil; - writeln( 'InitializeSound , Enumerate Registered Audio Interfaces' ); for iCount := 0 to AudioManager.Count - 1 do begin if assigned( AudioManager[iCount] ) then @@ -273,7 +258,6 @@ begin if ( AudioManager[iCount].QueryInterface( IAudioPlayback, lTmpInterface ) = 0 ) AND ( true ) then -// ( not assigned( singleton_AudioPlayback ) ) then begin singleton_AudioPlayback := IAudioPlayback( lTmpInterface ); end; @@ -281,17 +265,13 @@ begin // if this interface is a Input, then set it as the default used if ( AudioManager[iCount].QueryInterface( IAudioInput, lTmpInterface ) = 0 ) AND ( true ) then -// ( not assigned( singleton_AudioInput ) ) then begin singleton_AudioInput := IAudioInput( lTmpInterface ); - Writeln(singleton_AudioInput.GetName); end; // if this interface is a Input, then set it as the default used if ( AudioManager[iCount].QueryInterface( IVideoPlayback, lTmpInterface ) = 0 ) AND - //( AudioManager[iCount].QueryInterface( IVideoVisualization, lTmpInterface ) <> 0 ) AND ( true ) then -// ( not assigned( singleton_VideoPlayback ) ) then begin singleton_VideoPlayback := IVideoPlayback( lTmpInterface ); end; @@ -306,38 +286,44 @@ begin end; + if VideoPlayback <> nil then begin - writeln( 'Registered Video Playback Interface : ' + VideoPlayback.GetName ); end; if AudioPlayback <> nil then begin - writeln( 'Registered Audio Playback Interface : ' + AudioPlayback.GetName ); - // Log.LogStatus('Initializing Playback ('+AudioPlayback.GetName+')', 'InitializeSound'); AudioPlayback.InitializePlayback; end; if AudioInput <> nil then begin - writeln( 'Registered Audio Input Interface : ' + AudioInput.GetName ); - -// Log.LogStatus('Initializing Record ('+AudioPlayback.GetName+')', 'InitializeSound'); AudioInput.InitializeRecord; end; - writeln( 'InitializeSound DONE' ); + if FindCmdLineSwitch( cMediaInterfaces ) then + begin + writeln( '' ); + writeln( '--------------------------------------------------------------' ); + writeln( ' In-use Media Interfaces ' ); + writeln( '--------------------------------------------------------------' ); + writeln( 'Registered Audio Playback Interface : ' + AudioPlayback.GetName ); + writeln( 'Registered Audio Input Interface : ' + AudioInput.GetName ); + writeln( 'Registered Video Playback Interface : ' + VideoPlayback.GetName ); + writeln( 'Registered Visualization Interface : ' + Visualization.GetName ); + writeln( '--------------------------------------------------------------' ); + writeln( '' ); + halt; + end; end; initialization begin - writeln('Init AudioManager'); singleton_AudioManager := TInterfaceList.Create(); end; finalization - writeln('Finalize AudioManager'); singleton_AudioManager.clear; FreeAndNil( singleton_AudioManager ); diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index 62351e2d..644c62a8 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -161,7 +161,7 @@ begin writeln( ' aFormatCtx.nb_streams : ' + inttostr( aFormatCtx.nb_streams ) ); writeln( ' length( aFormatCtx.streams ) : ' + inttostr( length(aFormatCtx.streams) ) ); - + i := 0; while ( i < aFormatCtx.nb_streams ) do // while ( i < length(aFormatCtx.streams)-1 ) do @@ -415,22 +415,15 @@ end; constructor TVideoPlayback_ffmpeg.create(); begin - writeln( 'UVideo_FFMpeg - TVideoPlayback_ffmpeg.create()' ); - - writeln( 'UVideo_FFMpeg - av_register_all' ); av_register_all; fVideoOpened := False; fVideoPaused := False; - end; procedure TVideoPlayback_ffmpeg.init(); begin - writeln( 'UVideo_FFMpeg - glGenTextures(1, PglUint(@fVideoTex))' ); glGenTextures(1, PglUint(@fVideoTex)); - - writeln( 'UVideo_FFMpeg - SetLength(fTexData,0)' ); SetLength(fTexData,0); end; @@ -453,10 +446,10 @@ begin TimeDifference := 0; VideoFormatContext := 0; - writeln( aFileName ); - +// writeln( aFileName ); + errnum := av_open_input_file(VideoFormatContext, pchar( aFileName ), Nil, 0, Nil); - writeln( 'Errnum : ' +inttostr( errnum )); +// writeln( 'Errnum : ' +inttostr( errnum )); if(errnum <> 0) then begin {$ifdef DebugDisplay} @@ -684,11 +677,8 @@ end; initialization singleton_VideoFFMpeg := TVideoPlayback_ffmpeg.create(); - - writeln( 'UVideo_FFMpeg - Register Playback' ); AudioManager.add( singleton_VideoFFMpeg ); - finalization AudioManager.Remove( singleton_VideoFFMpeg ); diff --git a/Game/Code/Classes/UVisualizer.pas b/Game/Code/Classes/UVisualizer.pas index fa737d81..6548e2b7 100644 --- a/Game/Code/Classes/UVisualizer.pas +++ b/Game/Code/Classes/UVisualizer.pas @@ -56,10 +56,14 @@ type hRC : Integer; hDC : Integer; + RndPCMcount : integer; + procedure VisualizerStart; procedure VisualizerStop; procedure VisualizerTogglePause; + + function GetRandomPCMData(var data: TPCMData): Cardinal; public constructor create(); procedure init(); @@ -82,13 +86,12 @@ type constructor TVideoPlayback_ProjectM.create(); begin + RndPCMcount := 0; end; procedure TVideoPlayback_ProjectM.init(); begin - writeln( 'TVideoPlayback_ProjectM - INITIALIZE !!!!!!!!' ); - VisualizerStarted := False; VisualizerPaused := False; @@ -232,6 +235,10 @@ begin // get audio data nSamples := AudioPlayback.GetPCMData(PcmData); + + if nSamples = 0 then + nSamples := GetRandomPCMData(PcmData); + addPCM16Data(PPCM16Data(@PcmData), nSamples); // store OpenGL state (might be messed up otherwise) @@ -244,7 +251,15 @@ begin glPushMatrix(); // let projectM render a frame - renderFrame(pm); + try + renderFrame(pm); + except + // This happens with some presets... ( and only some times also .. moreso on linux ) + // if we have an "Invalid Floating Point Error" while rendering a frame... then change preset. + MoveTo( now ); + + // hmm have to be careful, that we dont get to many here... coz it could keep failing.. and trying again. + end; glFlush(); {$IFDEF UseTexture} @@ -323,11 +338,41 @@ begin {$ENDIF} end; +function TVideoPlayback_ProjectM.GetRandomPCMData(var data: TPCMData): Cardinal; +var + i: integer; +begin + // Produce some fake PCM data + if ( RndPCMcount mod 500 = 0 ) then + begin + for i := 0 to 511 do begin + data[0][i] := 0; + data[1][i] := 0; + end; + end + else begin + for i := 0 to 511 do begin + if ( i mod 2 = 0 ) then begin + data[0][i] := floor(Random * power(2.,14)); + data[1][i] := floor(Random * power(2.,14)); + end + else begin; + data[0][i] := floor(Random * power(2.,14)); + data[1][i] := floor(Random * power(2.,14)); + end; + if ( i mod 2 = 1 ) then begin + data[0][i] := -data[0][i]; + data[1][i] := -data[1][i]; + end; + end; + end; + Inc( RndPCMcount ); + result := 512; +end; + initialization singleton_VideoProjectM := TVideoPlayback_ProjectM.create(); - - writeln( 'UVideoProjectM - Register Playback' ); AudioManager.add( singleton_VideoProjectM ); finalization diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 75246d09..31e9f511 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -165,14 +165,14 @@ begin if fShowVisualization then fCurrentVideoPlaybackEngine.play; - + end; SDLK_TAB: //Change Visualization Preset begin - if fShowVisualization then - fCurrentVideoPlaybackEngine.MoveTo( now ); // move to a random position - end; + if fShowVisualization then + fCurrentVideoPlaybackEngine.MoveTo( now ); // move to a random position + end; SDLK_RETURN: begin @@ -1144,13 +1144,18 @@ begin if ShowFinish and ( AktSong.VideoLoaded or fShowVisualization ) then // if ShowFinish then begin - try +// try // UpdateSmpeg; // this only draws // todo: find a way to determine, when a new frame is needed // toto: same for the need to skip frames - fCurrentVideoPlaybackEngine.GetFrame(Czas.Teraz); - fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); + if assigned( fCurrentVideoPlaybackEngine ) then + begin + fCurrentVideoPlaybackEngine.GetFrame(Czas.Teraz); + fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); + end; + +(* except on E : Exception do begin @@ -1170,6 +1175,8 @@ begin end; end; end; +*) + end; // draw static menu (FG) @@ -1332,6 +1339,12 @@ begin if Ini.EffectSing=1 then GoldenRec.SpawnPerfectLineTwinkle; //PerfectLineTwinkle Mod end + + + // if we are shoing a visualization... change to a new preset after each sentence.. + // Maybe we should make this less often or something... just a + if fShowVisualization then + fCurrentVideoPlaybackEngine.MoveTo( now ); // move to a random position end; //Called on Sentence Change S= New Current Sentence -- cgit v1.2.3 From 10e4f765a5953f3644055d6628531855e9a30df6 Mon Sep 17 00:00:00 2001 From: b1indy Date: Wed, 12 Dec 2007 15:46:07 +0000 Subject: got back those nice stars ;) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@698 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphic.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index c3b042ea..f774a899 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -295,8 +295,8 @@ begin Log.LogStatus('Loading Textures - B', 'LoadTextures'); - Tex_Note_Perfect_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePerfectStar')), 'JPG', 'Font Black', 0); - Tex_Note_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteStar')) , 'JPG', 'Alpha Black Colored', $FFFFFF); + Tex_Note_Perfect_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePerfectStar')), 'PNG', 'Transparent', 0); + Tex_Note_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteStar')) , 'PNG', 'Transparent', $FFFFFF); Tex_Ball := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'BMP', 'Transparent', $FF00FF); Tex_Lyric_Help_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricHelpBar')), 'BMP', 'Transparent', $FF00FF); -- cgit v1.2.3 From 8cc30e0a1603053ea7f4830187a47f958d6c5a4b Mon Sep 17 00:00:00 2001 From: b1indy Date: Wed, 12 Dec 2007 16:56:17 +0000 Subject: some "progress" with the lyrics don't understand, why my debug display and what's shown in thy lyric-bar doesn't match (as i see it in the code, it should be the same) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@700 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/ULyrics.pas | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/ULyrics.pas b/Game/Code/Classes/ULyrics.pas index 8eaa2a5f..70031ef0 100644 --- a/Game/Code/Classes/ULyrics.pas +++ b/Game/Code/Classes/ULyrics.pas @@ -342,7 +342,7 @@ begin //Create LyricTexture //Prepare Ogl glGetIntegerv(GL_VIEWPORT, @ViewPort); - glClearColor(0.0,0.0,0.0,0); + glClearColor(0.0,0.0,0.0,0.0); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); {glMatrixMode(GL_PROJECTION); glLoadIdentity; @@ -356,9 +356,10 @@ begin Display.ScreenShot; //Copy to Texture + glEnable(GL_ALPHA); glBindTexture(GL_TEXTURE_2D, LyricLine.Tex); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 448, 512, 64, 0); - + glDisable(GL_ALPHA); //Clear Buffer glClearColor(0,0,0,0); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); @@ -383,10 +384,10 @@ Procedure TLyricEngine.Draw (Beat: Real); begin DrawLyrics(Beat); - +/////// start of debug draw glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); - glBlendFunc(GL_SRC_Alpha {GL_ONE_MINUS_SRC_COLOR}, GL_ONE_MINUS_SRC_Alpha); + glBlendFunc(GL_SRC_Alpha, GL_ONE_MINUS_SRC_Alpha); glBindTexture(GL_TEXTURE_2D, PUpperLine^.Tex); glColor4f(1,1,0,1); @@ -409,7 +410,7 @@ begin glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); - +/////// end of debug draw end; //--------------- @@ -500,7 +501,7 @@ begin //Draw complete Sentence glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); - glBlendFunc(GL_SRC_COLOR {GL_ONE_MINUS_SRC_COLOR}, GL_ONE_MINUS_SRC_COLOR); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBindTexture(GL_TEXTURE_2D, Line.Tex); glColorRGB(LineColor_en); @@ -517,6 +518,29 @@ begin end else begin + //Get Start Position: + { Start of Line - Width of all Icons + LineWidth/2 (Center} + LyricX := X + {(W - ((IconSize + 1) * 6))/2 +} ((IconSize + 1) * 3); + + LyricX2 := LyricX +500{ Line.Width}; + + //Draw complete Sentence + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, Line.Tex); + + glColorRGB(LineColor_akt); + glBegin(GL_QUADS); + glTexCoord2f(0, 1); glVertex2f(LyricX, Y); + glTexCoord2f(0, 0); glVertex2f(LyricX, Y + 64 * W / 512); + glTexCoord2f(1, 0); glVertex2f(LyricX2, Y + 64 * W / 512); + glTexCoord2f(1, 1); glVertex2f(LyricX2, Y); + glEnd; + + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); end; -- cgit v1.2.3 From 3fee8809240ec65ea6bf3e8a143fd88b31550f11 Mon Sep 17 00:00:00 2001 From: mogguh Date: Wed, 12 Dec 2007 19:28:09 +0000 Subject: Some tweaking on the lyrics, credits to blindy! :X git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@701 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/ULyrics.pas | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/ULyrics.pas b/Game/Code/Classes/ULyrics.pas index 70031ef0..2d826547 100644 --- a/Game/Code/Classes/ULyrics.pas +++ b/Game/Code/Classes/ULyrics.pas @@ -59,7 +59,7 @@ type //Some helper Procedures for Lyric Drawing procedure DrawLyrics (Beat: Real); - procedure DrawLyricsLine(const X, W, Y: Real; Size: Byte; const Line: TLyricLine; Beat: Real); + procedure DrawLyricsLine(const X, W, Y: Real; Size: Byte; const Line: PLyricLine; Beat: Real); procedure DrawPlayerIcon(const Player: Byte; const Enabled: Boolean; const X, Y, Size, Alpha: Real); public //Positions, Line specific Settings @@ -418,8 +418,8 @@ end; //--------------- procedure TLyricEngine.DrawLyrics (Beat: Real); begin - DrawLyricsLine(UpperLineX, UpperLineW, UpperlineY, 15, Upperline, Beat); - DrawLyricsLine(LowerLineX, LowerLineW, LowerlineY, 15, Lowerline, Beat); + DrawLyricsLine(UpperLineX, UpperLineW, UpperlineY, 15, PUpperline, Beat); + DrawLyricsLine(LowerLineX, LowerLineW, LowerlineY, 15, PLowerline, Beat); end; //--------------- @@ -453,7 +453,7 @@ end; //--------------- // DrawLyricsLine(private) - Helper for Draw; Draws one LyricLine //--------------- -procedure TLyricEngine.DrawLyricsLine(const X, W, Y: Real; Size: Byte; const Line: TLyricLine; Beat: Real); +procedure TLyricEngine.DrawLyricsLine(const X, W, Y: Real; Size: Byte; const Line: PLyricLine; Beat: Real); var I: Integer; CurWord: Integer; @@ -490,19 +490,19 @@ begin DrawPlayerIcon (2, True, X + (IconSize + 1)*2, Y, IconSize, IconAlpha);} //Check if a Word in the Sentence is active - if ((Line.Start > Beat) AND (Line.Start + Line.Length < Beat)) then + if ((Line^.Start > Beat) AND (Line^.Start + Line^.Length < Beat)) then begin //Get Start Position: { Start of Line - Width of all Icons + LineWidth/2 (Center} LyricX := X + (W - ((IconSize + 1) * 6))/2 + ((IconSize + 1) * 3); - LyricX2 := LyricX + Line.Width; + LyricX2 := LyricX + Line^.Width; //Draw complete Sentence glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, Line.Tex); + glBindTexture(GL_TEXTURE_2D, Line^.Tex); glColorRGB(LineColor_en); glBegin(GL_QUADS); @@ -528,7 +528,7 @@ begin glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, Line.Tex); + glBindTexture(GL_TEXTURE_2D, Line^.Tex); glColorRGB(LineColor_akt); glBegin(GL_QUADS); -- cgit v1.2.3 From 5404b0734c15320423bc4848fbc0880ed092e5e7 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 15 Dec 2007 17:12:20 +0000 Subject: again some progress with the lyrics... git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@703 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/ULyrics.pas | 254 ++++++++++++++++++++++++++++---------- Game/Code/Screens/UScreenSing.pas | 24 ++-- 2 files changed, 201 insertions(+), 77 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/ULyrics.pas b/Game/Code/Classes/ULyrics.pas index 2d826547..8bbb2db3 100644 --- a/Game/Code/Classes/ULyrics.pas +++ b/Game/Code/Classes/ULyrics.pas @@ -33,6 +33,7 @@ type Width: Real; //Width of the Lyricline in Tex Size: Byte; //Size of the Font in the Texture Words: ALyricWord; //Words from this Line + CurWord: Integer; //current active word (only valid if line is active) Start: Cardinal; //Start in Quarters of teh Line Length: Cardinal; //Length in Quarters (From Start of First Note to the End of Last Note) Freestyle: Boolean; //Complete Line is Freestyle ? @@ -76,7 +77,7 @@ type //Display Propertys LineColor_en: TRGBA; //Color of Words in an Enabled Line LineColor_dis: TRGBA; //Color of Words in a Disabled Line - LineColor_akt: TRGBA; //Color of teh active Word + LineColor_act: TRGBA; //Color of teh active Word FontStyle: Byte; //Font for the Lyric Text FontReSize: Boolean; //ReSize Lyrics if they don't fit Screen @@ -206,7 +207,7 @@ var function CreateLineTex: glUint; begin - GetMem(pTexData, 1024*128*4); //get Memory to save Tex in + GetMem(pTexData, 1024*64*4); //get Memory to save Tex in //generate and bind Texture glGenTextures(1, @Result); @@ -278,7 +279,7 @@ begin end; end else - begin + begin // rotate lines (round-robin-like) LyricLine:=PUpperLine; PUpperLine:=PLowerLine; PLowerLine:=PQueueLine; @@ -295,6 +296,7 @@ begin LyricLine.Freestyle := True; //is set by And Notes Freestyle while copying Notes LyricLine.Text := ''; //Also Set while copying Notes LyricLine.Players := 127; //All Players for now, no Duett Mode available + LyricLine.CurWord:=-1; // inactive line - so no word active atm //Copy Words SetLength(LyricLine.Words, CountNotes + 1); For I := 0 to CountNotes do @@ -316,7 +318,8 @@ begin glColor4f(1, 1, 1, 1); //Change Fontsize to Fit the Screen - While (LyricLine.Width > 508) do + LyricLine.Width := glTextWidth(PChar(LyricLine.Text)); + While (LyricLine.Width > UpperLineW) do begin Dec(LyricLine.Size); @@ -328,13 +331,13 @@ begin end; //Set Word Positions and Line Size - PosX := 2 {LowerLineX + LowerLineW/2 + 80 - LyricLine.Width/2}; + PosX := 0 {LowerLineX + LowerLineW/2 + 80 - LyricLine.Width/2}; For I := 0 to High(LyricLine.Words) do begin LyricLine.Words[I].X := PosX; LyricLine.Words[I].Width := glTextWidth(PChar(LyricLine.Words[I].Text)); - LyricLine.Words[I].TexPos := PosX / 512; - LyricLine.Words[I].TexWidth := LyricLine.Words[I].TexWidth / 512; + LyricLine.Words[I].TexPos := (PosX+1) / 1024; + LyricLine.Words[I].TexWidth := (LyricLine.Words[I].Width-1) / 1024; PosX := PosX + LyricLine.Words[I].Width; end; @@ -348,7 +351,7 @@ begin glLoadIdentity; glOrtho(0, 1024, 64, 0, -1, 100); glMatrixMode(GL_MODELVIEW);} - glViewport(0, 0, 512, 512); + glViewPort(0,0,800,600); //Draw Lyrics SetFontPos(0, 0); @@ -358,7 +361,7 @@ begin //Copy to Texture glEnable(GL_ALPHA); glBindTexture(GL_TEXTURE_2D, LyricLine.Tex); - glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 448, 512, 64, 0); + glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 600-64, 1024, 64, 0); glDisable(GL_ALPHA); //Clear Buffer glClearColor(0,0,0,0); @@ -384,33 +387,6 @@ Procedure TLyricEngine.Draw (Beat: Real); begin DrawLyrics(Beat); -/////// start of debug draw - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_Alpha, GL_ONE_MINUS_SRC_Alpha); - glBindTexture(GL_TEXTURE_2D, PUpperLine^.Tex); - - glColor4f(1,1,0,1); - glBegin(GL_QUADS); - glTexCoord2f(0, 1); glVertex2f(100, 100); - glTexCoord2f(0, 0); glVertex2f(100, 200); - glTexCoord2f(1, 0); glVertex2f(612, 200); - glTexCoord2f(1, 1); glVertex2f(612, 100); - glEnd; - - glBindTexture(GL_TEXTURE_2D, PLowerLine^.Tex); - - glColor4f(1,0,1,1); - glBegin(GL_QUADS); - glTexCoord2f(0, 1); glVertex2f(100, 200); - glTexCoord2f(0, 0); glVertex2f(100, 300); - glTexCoord2f(1, 0); glVertex2f(612, 300); - glTexCoord2f(1, 1); glVertex2f(612, 200); - glEnd; - - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); -/////// end of debug draw end; //--------------- @@ -432,7 +408,7 @@ begin True: IEnabled := 0; False: IEnabled:= 1; end; - + glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -456,28 +432,43 @@ end; procedure TLyricEngine.DrawLyricsLine(const X, W, Y: Real; Size: Byte; const Line: PLyricLine; Beat: Real); var I: Integer; - CurWord: Integer; +// CurWord: Integer; + CurWordStartTx, + CurWordEndTx: Real; // texture-coordinates of start and end of current word + CurWordStart, + CurWordEnd: Real; // screen coordinates of current word and the rest of the sentence Progress: Real; LyricX: Real; //Left Corner on X Axis LyricX2: Real;//Right Corner " " - LyricScale: Real; //Up or Downscale the Lyrics need + LyricScale: Real; //Up or Downscale the Lyrics need <- ??? IconSize: Real; IconAlpha: Real; -begin -{ For I := 0 to High(Line.Words) do - begin - //Set Font Params - SetFontStyle(FontStyle); + mybeat:string; + mywidth:real; + realfontsize:real; +begin +{ SetFontStyle(FontStyle); SetFontSize(Size); - SetFontItalic(Line.Words[I].Freestyle); glColor4f(1, 1, 1, 1); - SetFontPos(Line.Words[I].X, Y); + // line start beat + SetFontPos(50, Y-500); + mybeat:=inttostr(trunc(line^.start*100)); + glPrint(addr(mybeat[1])); - glPrint(PChar(Line.Words[I].Text)); - end; } + // current beat + SetFontPos(250, Y-500); + mybeat:=inttostr(trunc(beat*100)); + glPrint(addr(mybeat[1])); + // current beat + SetFontPos(450, Y-500); + mybeat:=inttostr(trunc((line^.start+line^.length)*100)); + glPrint(addr(mybeat[1])); +} + + // what is this for? LyricScale := Size / Line.Size; //Draw Icons @@ -490,39 +481,145 @@ begin DrawPlayerIcon (2, True, X + (IconSize + 1)*2, Y, IconSize, IconAlpha);} //Check if a Word in the Sentence is active - if ((Line^.Start > Beat) AND (Line^.Start + Line^.Length < Beat)) then + if ((Line^.Start < Beat) and (Beat < Line^.Start + Line^.Length)) then begin + // if this line just got active, then CurWord is still -1 + // this means, we should try to make the first word active + // then we check if the current active word is still meant to be active + // if not, we proceed to the next word + if Line^.CurWord = -1 then + Line^.CurWord:=0; + if not ((Beat < (Line^.Words[Line^.CurWord].Start+Line^.Words[Line^.CurWord].Length))) then + Line^.CurWord:=Line^.CurWord+1; + +// !!TODO: make sure, it works if the sentence is still enabled, after last word was active +// if Line^.CurWord > high(Line^.Words) then Line^.CurWord:=-2; + + with Line^.Words[Line^.CurWord] do + begin + Progress:=(Beat-Start)/Length; + CurWordStartTx:=TexPos; + CurWordEndTx:=TexPos+TexWidth; + CurWordStart:=X; + CurWordEnd:=X+Width; + end; + //Get Start Position: { Start of Line - Width of all Icons + LineWidth/2 (Center} - LyricX := X + (W - ((IconSize + 1) * 6))/2 + ((IconSize + 1) * 3); - - LyricX2 := LyricX + Line^.Width; +// LyricX := X + {(W - ((IconSize + 1) * 6))/2 + ((IconSize + 1) * 3) +} (W/2); + LyricX:=X+W/2; + LyricX2 := LyricX + Line^.Width/2; + LyricX:=LyricX - Line^.Width/2; //Draw complete Sentence - glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + +{ glColor4f(0,1,0.1,0.1); + glBegin(GL_QUADS); + glVertex2f(X+W/2, Y); + glVertex2f(X+W/2, Y + line^.size*3.5); + glVertex2f(X+W/2+line^.width/2, Y + line^.size*3.5); + glVertex2f(X+W/2+line^.width/2, Y); + glEnd; + glColor4f(0,1,0,0.1); + glBegin(GL_QUADS); + glVertex2f(X+W/2-line^.width/2, Y); + glVertex2f(X+W/2-line^.width/2, Y + line^.size*3.5); + glVertex2f(X+W/2, Y + line^.size*3.5); + glVertex2f(X+W/2, Y); + glEnd; + + // draw whole sentence + glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, Line^.Tex); glColorRGB(LineColor_en); glBegin(GL_QUADS); glTexCoord2f(0, 1); glVertex2f(LyricX, Y); - glTexCoord2f(0, 0); glVertex2f(LyricX, Y + 64 * W / 512); - glTexCoord2f(1, 0); glVertex2f(LyricX + LyricX2, Y + 64 * W / 512); - glTexCoord2f(1, 1); glVertex2f(LyricX + LyricX2, Y); + glTexCoord2f(0, 0); glVertex2f(LyricX, Y + 64); + glTexCoord2f(Line^.Width/512, 0); glVertex2f(LyricX2, Y + 64); + glTexCoord2f(Line^.Width/512, 1); glVertex2f(LyricX2, Y); + glEnd; +} + // draw sentence up to current word + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, Line^.Tex); + + glColorRGB(LineColor_act); + glBegin(GL_QUADS); + glTexCoord2f(0, 1); glVertex2f(LyricX, Y); + glTexCoord2f(0, 0); glVertex2f(LyricX, Y + 64); + glTexCoord2f(CurWordStartTx, 0); glVertex2f(LyricX+CurWordStart, Y + 64); + glTexCoord2f(CurWordStartTx, 1); glVertex2f(LyricX+CurWordStart, Y); + glEnd; + +{ // draw active word - type 1: farbwechsel - HoverEffect=3 oder so? + glColor4f(LineColor_en.r,LineColor_en.g,LineColor_en.b,1-progress); + glBegin(GL_QUADS); + glTexCoord2f(CurWordStartTx, 1); glVertex2f(LyricX+CurWordStart, Y); + glTexCoord2f(CurWordStartTx, 0); glVertex2f(LyricX+CurWordStart, Y + 64); + glTexCoord2f(CurWordEndTx, 0); glVertex2f(LyricX+CurWordEnd, Y + 64); + glTexCoord2f(CurWordEndTx, 1); glVertex2f(LyricX+CurWordEnd, Y); + glEnd; + glColor4f(LineColor_act.r,LineColor_act.g,LineColor_act.b,progress); + glBegin(GL_QUADS); + glTexCoord2f(CurWordStartTx, 1); glVertex2f(LyricX+CurWordStart, Y); + glTexCoord2f(CurWordStartTx, 0); glVertex2f(LyricX+CurWordStart, Y + 64); + glTexCoord2f(CurWordEndTx, 0); glVertex2f(LyricX+CurWordEnd, Y + 64); + glTexCoord2f(CurWordEndTx, 1); glVertex2f(LyricX+CurWordEnd, Y); + glEnd; +} + + // draw active word - type 2: zoom + farbwechsel - HoverEffect=4 ??? +// realfontsize:=30 * (Line^.Size/10); + glPushMatrix; + glTranslatef(LyricX+CurWordStart+(CurWordEnd-CurWordStart)/2,Y+32,0); + glScalef(1.0+(1-progress)/2,1.0+(1-progress)/2,1.0); + glColor4f(LineColor_en.r,LineColor_en.g,LineColor_en.b,1-progress); + glBegin(GL_QUADS); + glTexCoord2f(CurWordStartTx+0.0001, 1); glVertex2f(-(CurWordEnd-CurWordStart)/2, -32); + glTexCoord2f(CurWordStartTx+0.0001, 0); glVertex2f(-(CurWordEnd-CurWordStart)/2, + 32); + glTexCoord2f(CurWordEndTx-0.0001, 0); glVertex2f((CurWordEnd-CurWordStart)/2, + 32); + glTexCoord2f(CurWordEndTx-0.0001, 1); glVertex2f((CurWordEnd-CurWordStart)/2, -32); + glEnd; + glColor4f(LineColor_act.r,LineColor_act.g,LineColor_act.b,1); + glBegin(GL_QUADS); + glTexCoord2f(CurWordStartTx+0.0001, 1); glVertex2f(-(CurWordEnd-CurWordStart)/2, -32); + glTexCoord2f(CurWordStartTx+0.0001, 0); glVertex2f(-(CurWordEnd-CurWordStart)/2, + 32); + glTexCoord2f(CurWordEndTx-0.0001, 0); glVertex2f((CurWordEnd-CurWordStart)/2, + 32); + glTexCoord2f(CurWordEndTx-0.0001, 1); glVertex2f((CurWordEnd-CurWordStart)/2, -32); + glEnd; + glPopMatrix; + + // draw rest of sentence + glColorRGB(LineColor_en); + glBegin(GL_QUADS); + glTexCoord2f(CurWordEndTx, 1); glVertex2f(LyricX+CurWordEnd, Y); + glTexCoord2f(CurWordEndTx, 0); glVertex2f(LyricX+CurWordEnd, Y + 64); + glTexCoord2f(Line^.Width/1024, 0); glVertex2f(LyricX2, Y + 64); + glTexCoord2f(Line^.Width/1024, 1); glVertex2f(LyricX2, Y); glEnd; - glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + +{ SetFontPos(50, Y); + SetFontSize(9); + mybeat:=line^.words[line^.CurWord].text; + mybeat:=inttostr(trunc(Fonts[actfont].Tex.H)); + glPrint(addr(mybeat[1])); +} end else begin //Get Start Position: { Start of Line - Width of all Icons + LineWidth/2 (Center} - LyricX := X + {(W - ((IconSize + 1) * 6))/2 +} ((IconSize + 1) * 3); - - LyricX2 := LyricX +500{ Line.Width}; +// LyricX := X + {(W - ((IconSize + 1) * 6))/2 + ((IconSize + 1) * 3) +} (W/2); + LyricX:=X+W/2; + LyricX2 := LyricX + Line^.Width/2; + LyricX:=LyricX - Line^.Width/2; //Draw complete Sentence glEnable(GL_TEXTURE_2D); @@ -530,17 +627,44 @@ begin glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBindTexture(GL_TEXTURE_2D, Line^.Tex); - glColorRGB(LineColor_akt); +// realfontsize:=30 * (Line^.Size/10); + + glColorRGB(LineColor_dis); glBegin(GL_QUADS); glTexCoord2f(0, 1); glVertex2f(LyricX, Y); - glTexCoord2f(0, 0); glVertex2f(LyricX, Y + 64 * W / 512); - glTexCoord2f(1, 0); glVertex2f(LyricX2, Y + 64 * W / 512); - glTexCoord2f(1, 1); glVertex2f(LyricX2, Y); + glTexCoord2f(0, 0); glVertex2f(LyricX, Y + 64); + glTexCoord2f(Line^.Width/1024, 0); glVertex2f(LyricX2, Y + 64); + glTexCoord2f(Line^.Width/1024, 1); glVertex2f(LyricX2, Y); glEnd; + glDisable(GL_TEXTURE_2D); +{ glColor4f(0,0,0,0.1); + glBegin(GL_QUADS); + glTexCoord2f(0, 1); glVertex2f(LyricX, Y); + glTexCoord2f(0, 0); glVertex2f(LyricX, Y + line^.size*3.5); + glTexCoord2f(Line^.Width/512, 0); glVertex2f(LyricX2, Y + line^.size*3.5); + glTexCoord2f(Line^.Width/512, 1); glVertex2f(LyricX2, Y); + glEnd; +} glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); +// glDisable(GL_TEXTURE_2D); +{ SetFontPos(0, Y); + SetFontSize(9); + glColor4f(1,1,0,1); + mybeat:=inttostr(line^.size); + glPrint(addr(mybeat[1])); +{ mywidth:=gltextwidth(addr(mybeat[1])); + glEnable(GL_BLEND); + glColor4f(0,0,1,0.1); + glBegin(GL_QUADS); + glVertex2f(0,y); + glVertex2f(0,y+64); + glVertex2f(0+mywidth,y+64); + glVertex2f(0+mywidth,y); + glEnd; + glDisable(GL_BLEND); +} end; diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 31e9f511..d3019ac6 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -511,10 +511,10 @@ begin Lyrics.LineColor_dis.B := 0.4; Lyrics.LineColor_dis.A := 1; - Lyrics.LineColor_akt.R := 5/256; - Lyrics.LineColor_akt.G := 163/256; - Lyrics.LineColor_akt.B := 210/256; - Lyrics.LineColor_akt.A := 1; + Lyrics.LineColor_act.R := 5/256; + Lyrics.LineColor_act.G := 163/256; + Lyrics.LineColor_act.B := 210/256; + Lyrics.LineColor_act.A := 1; { LyricSub.FontStyle := 0; LyricMain.Size := 14; // 13 @@ -563,10 +563,10 @@ begin Lyrics.LineColor_dis.B := 0.8; Lyrics.LineColor_dis.A := 1; - Lyrics.LineColor_akt.R := 0.5; - Lyrics.LineColor_akt.G := 0.5; - Lyrics.LineColor_akt.B := 1; - Lyrics.LineColor_akt.A := 1; + Lyrics.LineColor_act.R := 0.5; + Lyrics.LineColor_act.G := 0.5; + Lyrics.LineColor_act.B := 1; + Lyrics.LineColor_act.A := 1; end; 2: begin @@ -584,10 +584,10 @@ begin Lyrics.LineColor_dis.B := 0.8; Lyrics.LineColor_dis.A := 1; - Lyrics.LineColor_akt.R := 0.5; - Lyrics.LineColor_akt.G := 0.5; - Lyrics.LineColor_akt.B := 1; - Lyrics.LineColor_akt.A := 1; + Lyrics.LineColor_act.R := 0.5; + Lyrics.LineColor_act.G := 0.5; + Lyrics.LineColor_act.B := 1; + Lyrics.LineColor_act.A := 1; { LyricSub.FontStyle := 3; LyricMain.Size := 12; LyricSub.Size := 12; -- cgit v1.2.3 From 9f4eaeef7d2100486af9ecbdd1e94e3bd10df3f8 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sun, 16 Dec 2007 11:10:20 +0000 Subject: elimitated sentence change flicker bug git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@704 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/ULyrics.pas | 18 ++++++++---------- Game/Code/Screens/UScreenSing.pas | 11 +++++++++++ 2 files changed, 19 insertions(+), 10 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/ULyrics.pas b/Game/Code/Classes/ULyrics.pas index 8bbb2db3..8fd1f3ec 100644 --- a/Game/Code/Classes/ULyrics.pas +++ b/Game/Code/Classes/ULyrics.pas @@ -44,6 +44,7 @@ type TLyricEngine = class private EoLastSentence: Real; //When did the Last Sentence End (in Beats) + LastDrawBeat: Real; UpperLine: TLyricLine; //Line in the Upper Part of the Lyric Display LowerLine: TLyricLine; //Line in the Lower Part of teh Lyric Display QueueLine: TLyricLine; //Line that is in Queue and will be added when next Line is Finished @@ -116,7 +117,8 @@ uses SysUtils, TextGL, UGraphic, UDisplay, - dialogs; + dialogs, + math; //----------- //Helper procs to use TRGB in Opengl ...maybe this should be somewhere else @@ -151,6 +153,7 @@ begin PQueueLine:=@QueueLine; UseLinearFilter := True; + LastDrawBeat:=NAN; end; Constructor TLyricEngine.Create(ULX,ULY,ULW,ULS,LLX,LLY,LLW,LLS:Real); @@ -194,6 +197,7 @@ begin PUpperline:=@UpperLine; PLowerLine:=@LowerLine; PQueueLine:=@QueueLine; + LastDrawBeat:=NAN; end; @@ -342,15 +346,12 @@ begin PosX := PosX + LyricLine.Words[I].Width; end; + //Create LyricTexture //Prepare Ogl glGetIntegerv(GL_VIEWPORT, @ViewPort); glClearColor(0.0,0.0,0.0,0.0); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - {glMatrixMode(GL_PROJECTION); - glLoadIdentity; - glOrtho(0, 1024, 64, 0, -1, 100); - glMatrixMode(GL_MODELVIEW);} glViewPort(0,0,800,600); //Draw Lyrics @@ -368,10 +369,7 @@ begin glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); glViewPort(ViewPort[0], ViewPort[1], ViewPort[2], ViewPort[3]); - {glMatrixMode(GL_PROJECTION); - glLoadIdentity; - glOrtho(0, RenderW, RenderH, 0, -1, 100); - glMatrixMode(GL_MODELVIEW); } + end; //Increase the Counter @@ -385,8 +383,8 @@ end; //--------------- Procedure TLyricEngine.Draw (Beat: Real); begin - DrawLyrics(Beat); + LastDrawBeat:=Beat; end; //--------------- diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index d3019ac6..309af301 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1353,7 +1353,18 @@ begin //GoldenStarsTwinkle Mod GoldenRec.SentenceChange; if (Lyrics.LineCounter <= High(Czesci[0].Czesc)) then + begin Lyrics.AddLine(@Czesci[0].Czesc[Lyrics.LineCounter]); + // addline uses display memory + // calling draw makes sure, there's the singscreen in it, when the next + // swap between onscreen and offscreen buffers is done + // (this eliminates the onSentenceChange flickering) + // note: maybe it would be better to make sure, a display redraw is done + // right after the sentence change (before buffer swap) or make sure + // onsentencechange is only called right before calling Display.Draw + // (or whatever it was called) + Draw; + end; //GoldenStarsTwinkle Mod End end; -- cgit v1.2.3 From 179f9ad2ecad73b3db1d4c9113547d8ceccc9b48 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sun, 16 Dec 2007 11:14:07 +0000 Subject: added some texture parameters (hope this fixes the "strich" problem that mog experienced git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@705 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/ULyrics.pas | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Classes/ULyrics.pas b/Game/Code/Classes/ULyrics.pas index 8fd1f3ec..c6b42940 100644 --- a/Game/Code/Classes/ULyrics.pas +++ b/Game/Code/Classes/ULyrics.pas @@ -220,6 +220,9 @@ var //Get Memory glTexImage2D(GL_TEXTURE_2D, 0, 4, 1024, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, pTexData); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + if UseLinearFilter then begin glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); -- cgit v1.2.3 From b2910a8978a45fc34fdacf71bffcb9ffbad9cd24 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sun, 16 Dec 2007 11:31:30 +0000 Subject: some adjustment to the way, the lyrics zoom effect works (center of zoom should be more precise now) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@706 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/ULyrics.pas | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/ULyrics.pas b/Game/Code/Classes/ULyrics.pas index c6b42940..0d709eef 100644 --- a/Game/Code/Classes/ULyrics.pas +++ b/Game/Code/Classes/ULyrics.pas @@ -543,6 +543,10 @@ begin glTexCoord2f(Line^.Width/512, 1); glVertex2f(LyricX2, Y); glEnd; } + + // this is actually a bit more than the real font size + // it helps adjusting the "zoom-center" + realfontsize:=30 * (Line^.Size/10)+16; // draw sentence up to current word glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, Line^.Tex); @@ -550,8 +554,8 @@ begin glColorRGB(LineColor_act); glBegin(GL_QUADS); glTexCoord2f(0, 1); glVertex2f(LyricX, Y); - glTexCoord2f(0, 0); glVertex2f(LyricX, Y + 64); - glTexCoord2f(CurWordStartTx, 0); glVertex2f(LyricX+CurWordStart, Y + 64); + glTexCoord2f(0, 1-realfontsize/64); glVertex2f(LyricX, Y + realfontsize); + glTexCoord2f(CurWordStartTx, 1-realfontsize/64); glVertex2f(LyricX+CurWordStart, Y + realfontsize); glTexCoord2f(CurWordStartTx, 1); glVertex2f(LyricX+CurWordStart, Y); glEnd; @@ -573,23 +577,22 @@ begin } // draw active word - type 2: zoom + farbwechsel - HoverEffect=4 ??? -// realfontsize:=30 * (Line^.Size/10); glPushMatrix; - glTranslatef(LyricX+CurWordStart+(CurWordEnd-CurWordStart)/2,Y+32,0); + glTranslatef(LyricX+CurWordStart+(CurWordEnd-CurWordStart)/2,Y+realfontsize/2,0); glScalef(1.0+(1-progress)/2,1.0+(1-progress)/2,1.0); glColor4f(LineColor_en.r,LineColor_en.g,LineColor_en.b,1-progress); glBegin(GL_QUADS); - glTexCoord2f(CurWordStartTx+0.0001, 1); glVertex2f(-(CurWordEnd-CurWordStart)/2, -32); - glTexCoord2f(CurWordStartTx+0.0001, 0); glVertex2f(-(CurWordEnd-CurWordStart)/2, + 32); - glTexCoord2f(CurWordEndTx-0.0001, 0); glVertex2f((CurWordEnd-CurWordStart)/2, + 32); - glTexCoord2f(CurWordEndTx-0.0001, 1); glVertex2f((CurWordEnd-CurWordStart)/2, -32); + glTexCoord2f(CurWordStartTx+0.0001, 1); glVertex2f(-(CurWordEnd-CurWordStart)/2, -realfontsize/2); + glTexCoord2f(CurWordStartTx+0.0001, 1-realfontsize/64); glVertex2f(-(CurWordEnd-CurWordStart)/2, + realfontsize/2); + glTexCoord2f(CurWordEndTx-0.0001, 1-realfontsize/64); glVertex2f((CurWordEnd-CurWordStart)/2, + realfontsize/2); + glTexCoord2f(CurWordEndTx-0.0001, 1); glVertex2f((CurWordEnd-CurWordStart)/2, -realfontsize/2); glEnd; glColor4f(LineColor_act.r,LineColor_act.g,LineColor_act.b,1); glBegin(GL_QUADS); - glTexCoord2f(CurWordStartTx+0.0001, 1); glVertex2f(-(CurWordEnd-CurWordStart)/2, -32); - glTexCoord2f(CurWordStartTx+0.0001, 0); glVertex2f(-(CurWordEnd-CurWordStart)/2, + 32); - glTexCoord2f(CurWordEndTx-0.0001, 0); glVertex2f((CurWordEnd-CurWordStart)/2, + 32); - glTexCoord2f(CurWordEndTx-0.0001, 1); glVertex2f((CurWordEnd-CurWordStart)/2, -32); + glTexCoord2f(CurWordStartTx+0.0001, 1); glVertex2f(-(CurWordEnd-CurWordStart)/2, -realfontsize/2); + glTexCoord2f(CurWordStartTx+0.0001, 1-realfontsize/64); glVertex2f(-(CurWordEnd-CurWordStart)/2, + realfontsize/2); + glTexCoord2f(CurWordEndTx-0.0001, 1-realfontsize/64); glVertex2f((CurWordEnd-CurWordStart)/2, + realfontsize/2); + glTexCoord2f(CurWordEndTx-0.0001, 1); glVertex2f((CurWordEnd-CurWordStart)/2, -realfontsize/2); glEnd; glPopMatrix; @@ -597,8 +600,8 @@ begin glColorRGB(LineColor_en); glBegin(GL_QUADS); glTexCoord2f(CurWordEndTx, 1); glVertex2f(LyricX+CurWordEnd, Y); - glTexCoord2f(CurWordEndTx, 0); glVertex2f(LyricX+CurWordEnd, Y + 64); - glTexCoord2f(Line^.Width/1024, 0); glVertex2f(LyricX2, Y + 64); + glTexCoord2f(CurWordEndTx, 1-realfontsize/64); glVertex2f(LyricX+CurWordEnd, Y + realfontsize); + glTexCoord2f(Line^.Width/1024, 1-realfontsize/64); glVertex2f(LyricX2, Y + realfontsize); glTexCoord2f(Line^.Width/1024, 1); glVertex2f(LyricX2, Y); glEnd; @@ -628,13 +631,13 @@ begin glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBindTexture(GL_TEXTURE_2D, Line^.Tex); -// realfontsize:=30 * (Line^.Size/10); + realfontsize:=30 * (Line^.Size/10)+16; glColorRGB(LineColor_dis); glBegin(GL_QUADS); glTexCoord2f(0, 1); glVertex2f(LyricX, Y); - glTexCoord2f(0, 0); glVertex2f(LyricX, Y + 64); - glTexCoord2f(Line^.Width/1024, 0); glVertex2f(LyricX2, Y + 64); + glTexCoord2f(0, 1-realfontsize/64); glVertex2f(LyricX, Y + realfontsize); + glTexCoord2f(Line^.Width/1024, 1-realfontsize/64); glVertex2f(LyricX2, Y + realfontsize); glTexCoord2f(Line^.Width/1024, 1); glVertex2f(LyricX2, Y); glEnd; -- cgit v1.2.3 From b88a17a87b2ccae7788ecce964bbb8d1b0e877da Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 17 Dec 2007 11:16:51 +0000 Subject: lazarus (was it lazarus?) complained about missing parameters for halt. after removing the bracket it knew it should use the parameter-less version of halt. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@707 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCommandLine.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UCommandLine.pas b/Game/Code/Classes/UCommandLine.pas index 6a5a4808..e99ee37a 100644 --- a/Game/Code/Classes/UCommandLine.pas +++ b/Game/Code/Classes/UCommandLine.pas @@ -96,7 +96,7 @@ begin writeln( ' '+s( cMediaInterfaces ) + ' : Show in-use media interfaces' ); writeln( '' ); - halt(); + halt; end; //------------- -- cgit v1.2.3 From 58ffcecef49caacf566150ea266453fbf61930e9 Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 17 Dec 2007 11:20:56 +0000 Subject: - removed hStream in favour of TAudioOutputStream - removed all this BASS-specific sound-names git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@708 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudio_bass.pas | 136 ++++++++++++++++++++++--------------- Game/Code/Classes/UMedia_dummy.pas | 4 +- Game/Code/Classes/UMusic.pas | 8 ++- 3 files changed, 87 insertions(+), 61 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudio_bass.pas b/Game/Code/Classes/UAudio_bass.pas index a7bace06..972d6df0 100644 --- a/Game/Code/Classes/UAudio_bass.pas +++ b/Game/Code/Classes/UAudio_bass.pas @@ -41,6 +41,14 @@ type const ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); +type + TBassOutputStream = class(TAudioOutputStream) + Handle: HSTREAM; + + constructor Create(); overload; + constructor Create(stream: HSTREAM); overload; + end; + type {$IFDEF UseBASSInput} TAudio_bass = class( TInterfacedObject, IAudioPlayback, IAudioInput) @@ -48,16 +56,18 @@ type TAudio_bass = class( TInterfacedObject, IAudioPlayback) {$ENDIF} private - BassStart: hStream; // Wait, I've replaced this with BASS - BassBack: hStream; // It has almost all features we need - BassSwoosh: hStream; - BassChange: hStream; // Almost? It aleady has them all :) - BassOption: hStream; - BassClick: hStream; - BassDrum: hStream; - BassHihat: hStream; - BassClap: hStream; - BassShuffle: hStream; + MusicStream: HSTREAM; + + StartSoundStream: HSTREAM; + BackSoundStream: HSTREAM; + SwooshSoundStream: HSTREAM; + ChangeSoundStream: HSTREAM; + OptionSoundStream: HSTREAM; + ClickSoundStream: HSTREAM; + DrumSoundStream: HSTREAM; + HihatSoundStream: HSTREAM; + ClapSoundStream: HSTREAM; + ShuffleSoundStream: HSTREAM; //Custom Sounds CustomSounds: array of TCustomSoundEntry; @@ -65,7 +75,6 @@ type Loop: boolean; public - Bass: hStream; function GetName: String; {IAudioOutput interface} @@ -95,7 +104,8 @@ type procedure PlayClap; procedure PlayShuffle; procedure StopShuffle; - function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; + + function LoadSoundFromFile(var stream: HSTREAM; Name: string): boolean; //Equalizer function GetFFTData: TFFTData; @@ -128,6 +138,19 @@ type var singleton_MusicBass : IAudioPlayback; + +constructor TBassOutputStream.Create(); +begin + inherited; +end; + +constructor TBassOutputStream.Create(stream: HSTREAM); +begin + Create(); + Handle := stream; +end; + + function TAudio_bass.GetName: String; begin result := 'BASS'; @@ -159,18 +182,18 @@ begin // Log.LogStatus('Loading Sounds', 'Music Initialize'); // Log.BenchmarkStart(4); - LoadSoundFromFile(BassStart, SoundPath + 'Common Start.mp3'); - LoadSoundFromFile(BassBack, SoundPath + 'Common Back.mp3'); - LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3'); - LoadSoundFromFile(BassChange, SoundPath + 'select music change music 50.mp3'); - LoadSoundFromFile(BassOption, SoundPath + 'option change col.mp3'); - LoadSoundFromFile(BassClick, SoundPath + 'rimshot022b.mp3'); + LoadSoundFromFile(StartSoundStream, SoundPath + 'Common Start.mp3'); + LoadSoundFromFile(BackSoundStream, SoundPath + 'Common Back.mp3'); + LoadSoundFromFile(SwooshSoundStream, SoundPath + 'menu swoosh.mp3'); + LoadSoundFromFile(ChangeSoundStream, SoundPath + 'select music change music 50.mp3'); + LoadSoundFromFile(OptionSoundStream, SoundPath + 'option change col.mp3'); + LoadSoundFromFile(ClickSoundStream, SoundPath + 'rimshot022b.mp3'); -// LoadSoundFromFile(BassDrum, SoundPath + 'bassdrumhard076b.mp3'); -// LoadSoundFromFile(BassHihat, SoundPath + 'hihatclosed068b.mp3'); -// LoadSoundFromFile(BassClap, SoundPath + 'claps050b.mp3'); +// LoadSoundFromFile(DrumSoundStream, SoundPath + 'bassdrumhard076b.mp3'); +// LoadSoundFromFile(HihatSoundStream, SoundPath + 'hihatclosed068b.mp3'); +// LoadSoundFromFile(ClapSoundStream, SoundPath + 'claps050b.mp3'); -// LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3'); +// LoadSoundFromFile(ShuffleSoundStream, SoundPath + 'Shuffle.mp3'); // Log.BenchmarkEnd(4); // Log.LogBenchmark('--> Loading Sounds', 4); @@ -196,10 +219,8 @@ begin if Volume < 0 then Volume := 0; - //Set Volume - // TODO : jb_linux replace with something other than bass - BASS_ChannelSetAttributes (Bass, -1, Volume, -101); + BASS_ChannelSetAttributes (MusicStream, -1, Volume, -101); end; procedure TAudio_bass.SetLoop(Enabled: boolean); @@ -212,7 +233,7 @@ begin Loaded := false; if FileExists(Name) then begin - Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); + MusicStream := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); Loaded := true; //Set Max Volume @@ -232,8 +253,8 @@ procedure TAudio_bass.MoveTo(Time: real); var bytes: integer; begin - bytes := BASS_ChannelSeconds2Bytes(Bass, Time); - BASS_ChannelSetPosition(Bass, bytes); + bytes := BASS_ChannelSeconds2Bytes(MusicStream, Time); + BASS_ChannelSetPosition(MusicStream, bytes); end; procedure TAudio_bass.Play; @@ -241,27 +262,27 @@ begin if Loaded then begin if Loop then - BASS_ChannelPlay(Bass, True); // start from beginning... actually bass itself does not loop, nor does this TAudio_bass Class + BASS_ChannelPlay(MusicStream, True); // start from beginning... actually bass itself does not loop, nor does this TAudio_bass Class - BASS_ChannelPlay(Bass, False); // for setting position before playing + BASS_ChannelPlay(MusicStream, False); // for setting position before playing end; end; procedure TAudio_bass.Pause; //Pause Mod begin if Loaded then begin - BASS_ChannelPause(Bass); // Pauses Song + BASS_ChannelPause(MusicStream); // Pauses Song end; end; procedure TAudio_bass.Stop; begin - Bass_ChannelStop(Bass); + Bass_ChannelStop(MusicStream); end; procedure TAudio_bass.Close; begin - Bass_StreamFree(Bass); + Bass_StreamFree(MusicStream); end; function TAudio_bass.Length: real; @@ -270,8 +291,8 @@ var begin Result := 60; - bytes := BASS_ChannelGetLength(Bass); - Result := BASS_ChannelBytes2Seconds(Bass, bytes); + bytes := BASS_ChannelGetLength(MusicStream); + Result := BASS_ChannelBytes2Seconds(MusicStream, bytes); end; function TAudio_bass.getPosition: real; @@ -280,15 +301,15 @@ var begin Result := 0; - bytes := BASS_ChannelGetPosition(BASS); - Result := BASS_ChannelBytes2Seconds(BASS, bytes); + bytes := BASS_ChannelGetPosition(MusicStream); + Result := BASS_ChannelBytes2Seconds(MusicStream, bytes); end; function TAudio_bass.Finished: boolean; begin Result := false; - if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then + if BASS_ChannelIsActive(MusicStream) = BASS_ACTIVE_STOPPED then begin Result := true; end; @@ -296,60 +317,60 @@ end; procedure TAudio_bass.PlayStart; begin - BASS_ChannelPlay(BassStart, True); + BASS_ChannelPlay(StartSoundStream, True); end; procedure TAudio_bass.PlayBack; begin - BASS_ChannelPlay(BassBack, True);// then + BASS_ChannelPlay(BackSoundStream, True);// then end; procedure TAudio_bass.PlaySwoosh; begin - BASS_ChannelPlay(BassSwoosh, True); + BASS_ChannelPlay(SwooshSoundStream, True); end; procedure TAudio_bass.PlayChange; begin - BASS_ChannelPlay(BassChange, True); + BASS_ChannelPlay(ChangeSoundStream, True); end; procedure TAudio_bass.PlayOption; begin - BASS_ChannelPlay(BassOption, True); + BASS_ChannelPlay(OptionSoundStream, True); end; procedure TAudio_bass.PlayClick; begin - BASS_ChannelPlay(BassClick, True); + BASS_ChannelPlay(ClickSoundStream, True); end; procedure TAudio_bass.PlayDrum; begin - BASS_ChannelPlay(BassDrum, True); + BASS_ChannelPlay(DrumSoundStream, True); end; procedure TAudio_bass.PlayHihat; begin - BASS_ChannelPlay(BassHihat, True); + BASS_ChannelPlay(HihatSoundStream, True); end; procedure TAudio_bass.PlayClap; begin - BASS_ChannelPlay(BassClap, True); + BASS_ChannelPlay(ClapSoundStream, True); end; procedure TAudio_bass.PlayShuffle; begin - BASS_ChannelPlay(BassShuffle, True); + BASS_ChannelPlay(ShuffleSoundStream, True); end; procedure TAudio_bass.StopShuffle; begin - BASS_ChannelStop(BassShuffle); + BASS_ChannelStop(ShuffleSoundStream); end; -function TAudio_bass.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; +function TAudio_bass.LoadSoundFromFile(var stream: HSTREAM; Name: string): boolean; var L: Integer; begin @@ -357,13 +378,13 @@ begin begin Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); try - hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); + stream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); //Add CustomSound L := High(CustomSounds) + 1; SetLength (CustomSounds, L + 1); CustomSounds[L].Filename := Name; - CustomSounds[L].Handle := hStream; + CustomSounds[L].Stream := TBassOutputStream.Create(stream); except Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); end; @@ -381,7 +402,7 @@ var Data: TFFTData; begin //Get Channel Data Mono and 256 Values - BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); + BASS_ChannelGetData(MusicStream, @Result, BASS_DATA_FFT512); end; {* @@ -394,7 +415,7 @@ var nBytes: DWORD; begin //Get Channel Data Mono and 256 Values - BASS_ChannelGetInfo(Bass, info); + BASS_ChannelGetInfo(MusicStream, info); ZeroMemory(@data, sizeof(TPCMData)); if (info.chans = 1) then @@ -410,7 +431,7 @@ begin else begin // stereo file - nBytes := BASS_ChannelGetData(Bass, @data, sizeof(TPCMData)); + nBytes := BASS_ChannelGetData(MusicStream, @data, sizeof(TPCMData)); end; if(nBytes <= 0) then result := 0 @@ -444,7 +465,10 @@ end; procedure TAudio_bass.PlayCustomSound(const Index: Cardinal ); begin if Index <= High(CustomSounds) then - BASS_ChannelPlay(CustomSounds[Index].Handle, True); + with CustomSounds[Index].Stream as TBassOutputStream do + begin + BASS_ChannelPlay(Handle, True); + end; end; {$IFDEF UseBASSInput} diff --git a/Game/Code/Classes/UMedia_dummy.pas b/Game/Code/Classes/UMedia_dummy.pas index 697dc2f9..52e3434e 100644 --- a/Game/Code/Classes/UMedia_dummy.pas +++ b/Game/Code/Classes/UMedia_dummy.pas @@ -82,7 +82,7 @@ type procedure PlayShuffle; procedure StopShuffle; - function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; + function LoadSoundFromFile(var stream: TAudioOutputStream; Name: string): boolean; function LoadCustomSound(const Filename: String): Cardinal; procedure PlayCustomSound(const Index: Cardinal ); @@ -251,7 +251,7 @@ procedure Tmedia_dummy.StopShuffle; begin end; -function Tmedia_dummy.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; +function Tmedia_dummy.LoadSoundFromFile(var stream: TAudioOutputStream; Name: string): boolean; begin result := false; end; diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index 7e1aa839..c2d616ec 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -88,11 +88,12 @@ type TPCMStereoSample = array[0..1] of Smallint; TPCMData = array[0..511] of TPCMStereoSample; - hStream = Cardinal; + TAudioOutputStream = class + end; TCustomSoundEntry = record Filename : String; - Handle : hStream; + Stream : TAudioOutputStream; end; type @@ -149,7 +150,8 @@ type procedure PlayShuffle; procedure StopShuffle; - function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; + // TODO + //function LoadSoundFromFile(var stream: TAudioOutputStream; Name: string): boolean; //Custom Sounds function LoadCustomSound(const Filename: String): Cardinal; -- cgit v1.2.3 From 549fd3677bd451169bb45a97ae2da3ee5514622b Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 17 Dec 2007 11:24:51 +0000 Subject: disabled the FFMPEG_AUDIO stuff for the moment git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@709 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UVideo.pas | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index 644c62a8..94c8d7ab 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -14,9 +14,6 @@ unit UVideo; //{$define DebugFrames} //{$define Info} -// {$define FFMpegAudio} -{} - interface @@ -49,7 +46,7 @@ uses SDL, dialogs, {$endif} {$ENDIF} - {$ifdef FFMpegAudio} + {$ifdef UseFFMpegAudio} UAudio_FFMpeg, {$endif} UIni, @@ -279,14 +276,16 @@ begin if (AVPacket.stream_index=VideoStreamIndex) then begin errnum := avcodec_decode_video(VideoCodecContext, AVFrame, frameFinished , AVPacket.data, AVPacket.size); // JB-ffmpeg - {$ifdef FFMpegAudio} + (* FIXME + {$ifdef UseFFMpegAudio} end else if (AVPacket.stream_index = AudioStreamIndex ) then begin writeln('Encue Audio packet'); - UAudio_FFMpeg.packet_queue_put(UAudio_FFMpeg.audioq, AVPacket); + audioq.put(AVPacket); {$endif} + *) end; try @@ -485,7 +484,8 @@ begin if( AudioStreamIndex >= 0) then aCodecCtx := VideoFormatContext.streams[ AudioStreamIndex ].codec; - {$ifdef FFMpegAudio} + (* FIXME + {$ifdef UseFFMpegAudio} // This is the audio ffmpeg audio support Jay is working on. if aCodecCtx <> nil then begin @@ -516,15 +516,16 @@ begin avcodec_open(aCodecCtx, aCodec); writeln( 'Opened the codec' ); - + packet_queue_init( audioq ); SDL_PauseAudio(0); - + writeln( 'SDL_PauseAudio' ); - + end; {$endif} + *) if(VideoStreamIndex >= 0) then begin -- cgit v1.2.3 From 06b754fdbc1bad124b6057d06056a1233d910933 Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 17 Dec 2007 11:28:03 +0000 Subject: - changed compiler-switch FFMpegAudio to UseFFMpegAudio - UseProjectM splitted into UseProjectM_0_9 or UseProjectM_1_0 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@710 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.dpr | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index bd8c42ac..7b0b85a8 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -16,7 +16,7 @@ uses sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', - sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', + sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', {$ifdef UseBass} bass in 'lib\bass\delphi\bass.pas', @@ -49,8 +49,11 @@ uses avio in 'lib\ffmpeg\avio.pas', //swscale in 'lib\ffmpeg\swscale.pas', - {$ifdef UseProjectM} - projectM in 'lib\projectM\projectM.pas', + {$ifdef UseProjectM_0_9} + projectM in 'lib\projectM\0.9\projectM.pas', + {$endif} + {$ifdef UseProjectM_1_0} + projectM in 'lib\projectM\1.0\projectM.pas', {$endif} SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', @@ -145,7 +148,7 @@ uses {$ifdef UsePortaudio} UAudio_portaudio in 'Classes\UAudio_portaudio.pas', {$endif} -{$ifdef FFMpegAudio} +{$ifdef UseFFMpegAudio} UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', {$endif} -- cgit v1.2.3 From 6baf1389fddd651e03090ea8008d279696a18e5f Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 17 Dec 2007 11:29:49 +0000 Subject: - non-working ffmpeg-audio test version - "plays" (not at all) only the start-sound at the moment git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@711 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudio_FFMpeg.pas | 998 +++++++++++++++++------------------- 1 file changed, 462 insertions(+), 536 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudio_FFMpeg.pas b/Game/Code/Classes/UAudio_FFMpeg.pas index b89fa00f..f050eaea 100644 --- a/Game/Code/Classes/UAudio_FFMpeg.pas +++ b/Game/Code/Classes/UAudio_FFMpeg.pas @@ -36,36 +36,6 @@ uses Classes, ULog, UMusic; -type - TPacketQueue = record - first_pkt , - last_pkt : pAVPacketList; - nb_packets : integer; - size : integer; - mutex : pSDL_mutex; - cond : pSDL_cond; - end; - pPacketQueue = ^TPacketQueue; - - function packet_queue_put(var aPacketQueue : TPacketQueue; var AVPacket : TAVPacket): integer; - function packet_queue_get(var aPacketQueue : TPacketQueue; var AVPacket : TAVPacket; block : integer ): integer; - procedure packet_queue_init( var aPacketQueue : TPacketQueue ); - procedure audio_callback( userdata: Pointer; stream: PUInt8; len: Integer ); cdecl; - function audio_decode_frame(aCodecCtx : TAVCodecContext; aAudio_buf : PUInt8; buf_size: integer): integer; - -var - singleton_MusicFFMpeg : IAudioPlayback = nil; - -var - audioq : TPacketQueue; - quit : integer = 0; -// faudio_buf : array[ 0 .. 0 ] of byte; //pUInt8{$ifndef fpc};{$else} = nil;{$endif} -// audio_buf : array[ 0 .. AVCODEC_MAX_AUDIO_FRAME_SIZE ] of byte; //pUInt8{$ifndef fpc};{$else} = nil;{$endif} - -type - Taudiobuff = array[ 0 .. AVCODEC_MAX_AUDIO_FRAME_SIZE-1 ] of byte; - PAudioBuff = ^Taudiobuff; - implementation uses @@ -73,55 +43,104 @@ uses lclintf, libc, {$ENDIF} -// URecord, UIni, UMain, UThemes; -//var -// singleton_MusicFFMpeg : IAudioPlayback = nil; +type + PPacketQueue = ^TPacketQueue; + TPacketQueue = class + private + firstPkt, + lastPkt : PAVPacketList; + nbPackets : integer; + size : integer; + mutex : PSDL_Mutex; + cond : PSDL_Cond; + quit : boolean; -const - RecordSystem = 1; - SDL_AUDIO_BUFFER_SIZE = 1024; - + public + constructor Create(); + + function Put(pkt : PAVPacket): integer; + function Get(var pkt: TAVPacket; block: boolean): integer; + end; type - TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, mpPaused, mpOpen); + TStreamStatus = (sNotReady, sStopped, sPlaying, sSeeking, sPaused, sOpen); +const + StreamStatusStr: array[TStreamStatus] of string = ('Not ready', 'Stopped', 'Playing', 'Seeking', 'Paused', 'Open'); +type + PAudioBuffer = ^TAudioBuffer; + TAudioBuffer = array[0 .. (AVCODEC_MAX_AUDIO_FRAME_SIZE * 3 div 2)-1] of byte; const - ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); + SDL_AUDIO_BUFFER_SIZE = 1024; + +type + TFFMpegOutputStream = class(TAudioOutputStream) + private + parseThread: PSDL_Thread; + packetQueue: TPacketQueue; + + status: TStreamStatus; + + // FFMpeg internal data + pFormatCtx : PAVFormatContext; + pCodecCtx : PAVCodecContext; + pCodec : PAVCodec; + ffmpegStreamID : Integer; + ffmpegStream : PAVStream; + + // static vars for AudioDecodeFrame + pkt : TAVPacket; + audio_pkt_data : PChar; + audio_pkt_size : integer; + + // static vars for AudioCallback + audio_buf_index : cardinal; + audio_buf_size : cardinal; + audio_buf : TAudioBuffer; + public + constructor Create(); overload; + constructor Create(pFormatCtx: PAVFormatContext; + pCodecCtx: PAVCodecContext; pCodec: PAVCodec; + ffmpegStreamID : Integer; ffmpegStream: PAVStream); overload; + procedure Play(); + procedure Pause(); + procedure Stop(); + procedure Close(); + function AudioDecodeFrame(buffer : PUInt8; bufSize: integer): integer; + end; type - TAudio_ffMpeg = class( TInterfacedObject, IAudioPlayback ) + TAudio_FFMpeg = class( TInterfacedObject, IAudioPlayback ) private - - BassStart: hStream; - BassBack: hStream; - BassSwoosh: hStream; - BassChange: hStream; - BassOption: hStream; - BassClick: hStream; - BassDrum: hStream; - BassHihat: hStream; - BassClap: hStream; - BassShuffle: hStream; + MusicStream: TFFMpegOutputStream; + + StartSoundStream: TFFMpegOutputStream; + BackSoundStream: TFFMpegOutputStream; + SwooshSoundStream: TFFMpegOutputStream; + ChangeSoundStream: TFFMpegOutputStream; + OptionSoundStream: TFFMpegOutputStream; + ClickSoundStream: TFFMpegOutputStream; + DrumSoundStream: TFFMpegOutputStream; + HihatSoundStream: TFFMpegOutputStream; + ClapSoundStream: TFFMpegOutputStream; + ShuffleSoundStream: TFFMpegOutputStream; //Custom Sounds CustomSounds: array of TCustomSoundEntry; Loaded: boolean; Loop: boolean; - fHWND: THandle; - function find_stream_ids( const aFormatCtx : PAVFormatContext; Out aFirstVideoStream, aFirstAudioStream : integer ): boolean; + function FindAudioStreamID(pFormatCtx : PAVFormatContext): integer; public -// Bass: hStream; - constructor create(); function GetName: String; procedure InitializePlayback; procedure SetVolume(Volume: integer); @@ -148,105 +167,120 @@ type procedure PlayClap; procedure PlayShuffle; procedure StopShuffle; -// procedure CaptureStart; -// procedure CaptureStop; -// procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); - procedure StopCard(Card: byte); - function LoadSoundFromFile(var hStream: hStream; Name: string): boolean; + + function LoadSoundFromFile(Name: string): TFFMpegOutputStream; //Equalizer function GetFFTData: TFFTData; + // Interface for Visualizer + function GetPCMData(var data: TPCMData): Cardinal; + //Custom Sounds function LoadCustomSound(const Filename: String): Cardinal; procedure PlayCustomSound(const Index: Cardinal ); -end; + end; -constructor TAudio_ffMpeg.create(); +var + singleton_MusicFFMpeg : IAudioPlayback = nil; + + +function ParseAudio(data: Pointer): integer; cdecl; forward; +procedure AudioCallback( userdata: Pointer; stream: PUInt8; len: Integer ); cdecl; forward; + +constructor TFFMpegOutputStream.Create(); begin -// writeln( 'UVideo_FFMpeg - av_register_all' ); - av_register_all; + inherited; + + packetQueue := TPacketQueue.Create(); + + FillChar(pkt, sizeof(TAVPacket), #0); + + status := sStopped; + + audio_pkt_data := nil; + audio_pkt_size := 0; + + audio_buf_index := 0; + audio_buf_size := 0; end; -function TAudio_ffMpeg.find_stream_ids( const aFormatCtx : PAVFormatContext; Out aFirstVideoStream, aFirstAudioStream : integer ): boolean; -var - i : integer; - st : pAVStream; +constructor TFFMpegOutputStream.Create(pFormatCtx: PAVFormatContext; + pCodecCtx: PAVCodecContext; pCodec: PAVCodec; + ffmpegStreamID : Integer; ffmpegStream: PAVStream); begin - // Find the first video stream - aFirstAudioStream := -1; - aFirstVideoStream := -1; + Create(); + Self.pFormatCtx := pFormatCtx; + Self.pCodecCtx := pCodecCtx; + Self.pCodec := pCodec; + Self.ffmpegStreamID := ffmpegStreamID; + Self.ffmpegStream := ffmpegStream; +end; - i := 0; - while ( i < aFormatCtx.nb_streams ) do +procedure TFFMpegOutputStream.Play(); +begin + writeln('Play request'); + if(status = sStopped) then begin -// writeln( ' aFormatCtx.streams[i] : ' + inttostr( i ) ); - st := aFormatCtx.streams[i]; + writeln('Play ok'); + status := sPlaying; + Self.parseThread := SDL_CreateThread(@ParseAudio, Self); + SDL_PauseAudio(0); + end; +end; - if(st.codec.codec_type = CODEC_TYPE_VIDEO ) AND - (aFirstVideoStream < 0) THEN - begin -// writeln( 'Found Video Stream' ); - aFirstVideoStream := i; - end; +procedure TFFMpegOutputStream.Pause(); +begin +end; - if ( st.codec.codec_type = CODEC_TYPE_AUDIO ) AND - ( aFirstAudioStream < 0) THEN - begin -// writeln( 'Found Audio Stream' ); - aFirstAudioStream := i; - end; +procedure TFFMpegOutputStream.Stop(); +begin +end; - inc( i ); - end; // while +procedure TFFMpegOutputStream.Close(); +begin + // Close the codec + avcodec_close(pCodecCtx); - result := (aFirstAudioStream > -1) OR - (aFirstVideoStream > -1) ; // Didn't find any streams stream + // Close the video file + av_close_input_file(pFormatCtx); end; -function TAudio_ffMpeg.GetName: String; +function TAudio_FFMpeg.GetName: String; begin result := 'FFMpeg'; end; -procedure TAudio_ffMpeg.InitializePlayback; -var -// Pet: integer; - S: integer; +procedure TAudio_FFMpeg.InitializePlayback; begin + Log.LogStatus('InitializePlayback', 'UAudio_FFMpeg'); -// LoadSoundFromFile(BassStart, SoundPath + 'Green Day - American Idiot.mp3'); - -(* - LoadSoundFromFile(BassStart, SoundPath + 'Common start.mp3'); - LoadSoundFromFile(BassBack, SoundPath + 'Common back.mp3'); - LoadSoundFromFile(BassSwoosh, SoundPath + 'menu swoosh.mp3'); - LoadSoundFromFile(BassChange, SoundPath + 'select music change music 50.mp3'); - LoadSoundFromFile(BassOption, SoundPath + 'option change col.mp3'); - LoadSoundFromFile(BassClick, SoundPath + 'rimshot022b.mp3'); - - LoadSoundFromFile(BassDrum, SoundPath + 'bassdrumhard076b.mp3'); - LoadSoundFromFile(BassHihat, SoundPath + 'hihatclosed068b.mp3'); - LoadSoundFromFile(BassClap, SoundPath + 'claps050b.mp3'); -*) + Loaded := false; + Loop := false; -// LoadSoundFromFile(BassShuffle, SoundPath + 'Shuffle.mp3'); + av_register_all(); + SDL_Init(SDL_INIT_AUDIO); -// Log.BenchmarkEnd(4); -// Log.LogBenchmark('--> Loading Sounds', 4); + StartSoundStream := LoadSoundFromFile(SoundPath + 'Common Start.mp3'); + { + BackSoundStream := LoadSoundFromFile(SoundPath + 'Common Back.mp3'); + SwooshSoundStream := LoadSoundFromFile(SoundPath + 'menu swoosh.mp3'); + ChangeSoundStream := LoadSoundFromFile(SoundPath + 'select music change music 50.mp3'); + OptionSoundStream := LoadSoundFromFile(SoundPath + 'option change col.mp3'); + ClickSoundStream := LoadSoundFromFile(SoundPath + 'rimshot022b.mp3'); + } +// DrumSoundStream := LoadSoundFromFile(SoundPath + 'bassdrumhard076b.mp3'); +// HihatSoundStream := LoadSoundFromFile(SoundPath + 'hihatclosed068b.mp3'); +// ClapSoundStream := LoadSoundFromFile(SoundPath + 'claps050b.mp3'); +// ShuffleSoundStream := LoadSoundFromFile(SoundPath + 'Shuffle.mp3'); end; -procedure TAudio_ffMpeg.SetVolume(Volume: integer); +procedure TAudio_FFMpeg.SetVolume(Volume: integer); begin - //Old Sets Wave Volume - //BASS_SetVolume(Volume); //New: Sets Volume only for this Application - - - // TODO : jb_linux replace with something other than bass (* BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); @@ -254,7 +288,7 @@ begin *) end; -procedure TAudio_ffMpeg.SetMusicVolume(Volume: Integer); +procedure TAudio_FFMpeg.SetMusicVolume(Volume: Integer); begin //Max Volume Prevention if Volume > 100 then @@ -265,112 +299,102 @@ begin //Set Volume - // TODO : jb_linux replace with something other than bass // BASS_ChannelSetAttributes (Bass, -1, Volume, -101); end; -procedure TAudio_ffMpeg.SetLoop(Enabled: boolean); +procedure TAudio_FFMpeg.SetLoop(Enabled: boolean); begin Loop := Enabled; end; -function TAudio_ffMpeg.Open(Name: string): boolean; +function TAudio_FFMpeg.Open(Name: string): boolean; begin Loaded := false; if FileExists(Name) then begin - // TODO : jb_linux replace with something other than bass // Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); - + Loaded := true; //Set Max Volume -// SetMusicVolume (100); + SetMusicVolume (100); end; Result := Loaded; end; -procedure TAudio_ffMpeg.Rewind; +procedure TAudio_FFMpeg.Rewind; begin if Loaded then begin end; end; -procedure TAudio_ffMpeg.MoveTo(Time: real); +procedure TAudio_FFMpeg.MoveTo(Time: real); var bytes: integer; begin - // TODO : jb_linux replace with something other than bass // bytes := BASS_ChannelSeconds2Bytes(Bass, Time); // BASS_ChannelSetPosition(Bass, bytes); end; -procedure TAudio_ffMpeg.Play; +procedure TAudio_FFMpeg.Play; begin -(* - // TODO : jb_linux replace with something other than bass + if MusicStream <> nil then if Loaded then begin if Loop then - BASS_ChannelPlay(Bass, True); // start from beginning... actually bass itself does not loop, nor does this TAudio_ffMpeg Class - - BASS_ChannelPlay(Bass, False); // for setting position before playing + begin + end; + // start from beginning... + // actually bass itself does not loop, nor does this TAudio_FFMpeg Class + MusicStream.Play(); end; -*) end; -procedure TAudio_ffMpeg.Pause; //Pause Mod +procedure TAudio_FFMpeg.Pause; //Pause Mod begin -(* - // TODO : jb_linux replace with something other than bass + if MusicStream <> nil then if Loaded then begin - BASS_ChannelPause(Bass); // Pauses Song + MusicStream.Pause(); // Pauses Song end; -*) end; -procedure TAudio_ffMpeg.Stop; +procedure TAudio_FFMpeg.Stop; begin -// Bass_ChannelStop(Bass); + if MusicStream <> nil then + MusicStream.Stop(); end; -procedure TAudio_ffMpeg.Close; +procedure TAudio_FFMpeg.Close; begin -// Bass_StreamFree(Bass); + if MusicStream <> nil then + MusicStream.Close(); end; -function TAudio_ffMpeg.Length: real; +function TAudio_FFMpeg.Length: real; var - bytes: integer; + bytes: integer; begin - Result := 60; -(* - // TODO : jb_linux replace with something other than bass - bytes := BASS_ChannelGetLength(Bass); - Result := BASS_ChannelBytes2Seconds(Bass, bytes); -*) + Result := MusicStream.pFormatCtx^.duration / AV_TIME_BASE; end; -function TAudio_ffMpeg.getPosition: real; +function TAudio_FFMpeg.getPosition: real; var - bytes: integer; + bytes: integer; begin Result := 0; (* - // TODO : jb_linux replace with something other than bass bytes := BASS_ChannelGetPosition(BASS); Result := BASS_ChannelBytes2Seconds(BASS, bytes); *) end; -function TAudio_ffMpeg.Finished: boolean; +function TAudio_FFMpeg.Finished: boolean; begin Result := false; (* - // TODO : jb_linux replace with something other than bass if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then begin Result := true; @@ -378,215 +402,166 @@ begin *) end; -procedure TAudio_ffMpeg.PlayStart; +procedure TAudio_FFMpeg.PlayStart; begin - // LoadSoundFromFile(BassStart, SoundPath + 'foo fighters - best of you.mp3'); - - // TODO : jb_linux replace with something other than bass -// BASS_ChannelPlay(BassStart, True); + if StartSoundStream <> nil then + StartSoundStream.Play(); end; -procedure TAudio_ffMpeg.PlayBack; +procedure TAudio_FFMpeg.PlayBack; begin - // TODO : jb_linux replace with something other than bass -// BASS_ChannelPlay(BassBack, True);// then + if BackSoundStream <> nil then + BackSoundStream.Play(); end; -procedure TAudio_ffMpeg.PlaySwoosh; +procedure TAudio_FFMpeg.PlaySwoosh; begin - // TODO : jb_linux replace with something other than bass -// BASS_ChannelPlay(BassSwoosh, True); - - + if SwooshSoundStream <> nil then + SwooshSoundStream.Play(); end; -procedure TAudio_ffMpeg.PlayChange; +procedure TAudio_FFMpeg.PlayChange; begin - // TODO : jb_linux replace with something other than bass -// BASS_ChannelPlay(BassChange, True); + if ChangeSoundStream <> nil then + ChangeSoundStream.Play(); end; -procedure TAudio_ffMpeg.PlayOption; +procedure TAudio_FFMpeg.PlayOption; begin - // TODO : jb_linux replace with something other than bass -// BASS_ChannelPlay(BassOption, True); + if OptionSoundStream <> nil then + OptionSoundStream.Play(); end; -procedure TAudio_ffMpeg.PlayClick; +procedure TAudio_FFMpeg.PlayClick; begin - // TODO : jb_linux replace with something other than bass -// BASS_ChannelPlay(BassClick, True); + if ClickSoundStream <> nil then + ClickSoundStream.Play(); end; -procedure TAudio_ffMpeg.PlayDrum; +procedure TAudio_FFMpeg.PlayDrum; begin - // TODO : jb_linux replace with something other than bass -// BASS_ChannelPlay(BassDrum, True); + if DrumSoundStream <> nil then + DrumSoundStream.Play(); end; -procedure TAudio_ffMpeg.PlayHihat; +procedure TAudio_FFMpeg.PlayHihat; begin - // TODO : jb_linux replace with something other than bass -// BASS_ChannelPlay(BassHihat, True); + if HihatSoundStream <> nil then + HihatSoundStream.Play(); end; -procedure TAudio_ffMpeg.PlayClap; +procedure TAudio_FFMpeg.PlayClap; begin - // TODO : jb_linux replace with something other than bass -// BASS_ChannelPlay(BassClap, True); + if ClapSoundStream <> nil then + ClapSoundStream.Play(); end; -procedure TAudio_ffMpeg.PlayShuffle; +procedure TAudio_FFMpeg.PlayShuffle; begin - // TODO : jb_linux replace with something other than bass -// BASS_ChannelPlay(BassShuffle, True); + if ShuffleSoundStream <> nil then + ShuffleSoundStream.Play(); end; -procedure TAudio_ffMpeg.StopShuffle; +procedure TAudio_FFMpeg.StopShuffle; begin - // TODO : jb_linux replace with something other than bass -// BASS_ChannelStop(BassShuffle); + if ShuffleSoundStream <> nil then + ShuffleSoundStream.Stop(); end; -procedure TAudio_ffMpeg.StopCard(Card: byte); -begin - - // TODO : jb_linux replace with something other than bass -// BASS_RecordSetDevice(Card); -// BASS_RecordFree; -end; - -function audio_decode_frame(aCodecCtx : TAVCodecContext; aAudio_buf : PUInt8; buf_size: integer): integer; +function TFFMpegOutputStream.AudioDecodeFrame(buffer : PUInt8; bufSize: integer): integer; var - pkt : TAVPacket; - audio_pkt_data : pchar;//PUInt8 = nil; - audio_pkt_size : integer; - len1 , - data_size : integer; + len1, + data_size: integer; begin result := -1; -(* - {$ifdef win32} - FillChar(pkt, sizeof(TAVPacket), #0); - {$else} - memset(@pkt, 0, sizeof(TAVPacket)); // todo : jb memset - {$endif} - - audio_pkt_data := nil; - audio_pkt_size := 0; + if (buffer = nil) then + exit; while true do - begin - - while ( audio_pkt_size > 0 ) do + begin + while (audio_pkt_size > 0) do begin // writeln( 'got audio packet' ); - data_size := buf_size; - - len1 := -1; + data_size := bufSize; - if aAudio_buf <> nil then - begin - len1 := avcodec_decode_audio(@aCodecCtx, Pointer( aAudio_buf ), data_size, audio_pkt_data, audio_pkt_size); // Todo.. should be avcodec_decode_audio2 but this wont link on my ubuntu box. - end; + // TODO: should be avcodec_decode_audio2 but this wont link on my ubuntu box. + len1 := avcodec_decode_audio(pCodecCtx, Pointer(buffer), + data_size, audio_pkt_data, audio_pkt_size); -// writeln('avcodec_decode_audio : ' + inttostr( len1 )); + writeln('avcodec_decode_audio : ' + inttostr( len1 )); if(len1 < 0) then begin - //* if error, skip frame */ - writeln( 'Skip audio frame' ); + // if error, skip frame +// writeln( 'Skip audio frame' ); audio_pkt_size := 0; break; end; - + audio_pkt_data := audio_pkt_data + len1; audio_pkt_size := audio_pkt_size + len1; - + if (data_size <= 0) then begin - //* No data yet, get more frames */ + // No data yet, get more frames continue; end; - - //* We have data, return it and come back for more later */ + + // We have data, return it and come back for more later result := data_size; exit; end; - if ( pkt.data <> nil ) then - av_free_packet( pkt ); + if (pkt.data <> nil) then + av_free_packet(pkt); - if ( quit <> 0 ) then + if (packetQueue.quit) then begin result := -1; exit; end; - if (packet_queue_get(audioq, pkt, 1) < 0) then + if (packetQueue.Get(pkt, true) < 0) then begin result := -1; exit; end; - - audio_pkt_data := pchar( pkt.data ); + audio_pkt_data := PChar(pkt.data); audio_pkt_size := pkt.size; // writeln( 'Audio Packet Size - ' + inttostr(audio_pkt_size) ); - end; *) + end; end; -procedure audio_callback( userdata: Pointer; stream: PUInt8; len: Integer ); +procedure AudioCallback(userdata: Pointer; stream: PUInt8; len: Integer); cdecl; var - audio_buf_index : cardinal; // static unsigned int audio_buf_index = 0; - audio_buf_size : cardinal; // static unsigned int audio_buf_size = 0; - audio_size , - len1 : integer; - aCodecCtx : TAVCodecContext; - - lSrc : pointer; - - // this is used to emulate ...... static uint8_t audio_buf[(AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) / 2]; - lAudio_buf_data : Taudiobuff; // This created the memory we need - laudio_buf : PAudioBuff; // this makes it easy to work with.. since its the pointer to that memeory everywhere + outStream : TFFMpegOutputStream; + len1, + audio_size : integer; + pSrc : Pointer; begin - laudio_buf := @lAudio_buf_data ; - - aCodecCtx := pAVCodecContext(userdata)^; - audio_size := -1; - audio_buf_index := 0; - audio_buf_size := 0; + outStream := TFFMpegOutputStream(userdata); while (len > 0) do - begin - + with outStream do begin if (audio_buf_index >= audio_buf_size) then begin + // We have already sent all our data; get more + audio_size := AudioDecodeFrame(@audio_buf, sizeof(TAudioBuffer)); + writeln('audio_decode_frame : '+ inttostr(audio_size)); - // We have already sent all our data; get more */ - audio_size := audio_decode_frame(aCodecCtx, pUInt8( laudio_buf ), sizeof(Taudiobuff)); - writeln( 'audio_decode_frame : ' + inttostr( audio_size ) + ' / ' + inttostr( sizeof(Taudiobuff) ) ); - - if(audio_size > 0) then + if(audio_size < 0) then begin - audio_buf_size := audio_size; + // If error, output silence + audio_buf_size := 1024; + FillChar(audio_buf, audio_buf_size, #0); + writeln( 'Silence' ); end else begin - // If error, output silence */ - -// audio_buf_size := 1024; // arbitrary? - -// {$ifdef win32} -// FillChar(laudio_buf, audio_buf_size, #0); -// {$else} -// memset(laudio_buf, 0, audio_buf_size); // todo : jb memset -// {$endif} - - writeln( 'Silence' ); + audio_buf_size := audio_size; end; - audio_buf_index := 0; // Todo : jb - SegFault ? end; @@ -594,354 +569,305 @@ begin if (len1 > len) then len1 := len; - lSrc := PUInt8( integer( laudio_buf ) + audio_buf_index ); + pSrc := PChar(@audio_buf) + audio_buf_index; {$ifdef WIN32} - CopyMemory(stream, lSrc , len1); + CopyMemory(stream, pSrc , len1); {$else} - memcpy(stream, lSrc , len1); + memcpy(stream, pSrc , len1); {$endif} - len := len - len1; - stream^ := stream^ + len1; - audio_buf_index := audio_buf_index + len1; + Dec(len, len1); + Inc(stream, len1); + Inc(audio_buf_index, len1); end; end; -function TAudio_ffMpeg.LoadSoundFromFile(var hStream: hStream; Name: string): boolean; +function TAudio_FFMpeg.FindAudioStreamID(pFormatCtx : PAVFormatContext): integer; var - L : Integer; - pFormatCtx : PAVFormatContext; - lVidStreamID , - lAudStreamID : Integer; - aCodecCtx : pAVCodecContext; - wanted_spec , - spec : TSDL_AudioSpec; - lAudioStream : pAVStream; - aCodec : pAVCodec; - i : integer; - packet : TAVPacket; - event : TSDL_Event; -begin - result := false; + i : integer; + streamID: integer; + stream : PAVStream; +begin + // Find the first audio stream + streamID := -1; - if FileExists(Name) then + for i := 0 to pFormatCtx^.nb_streams-1 do begin - writeln('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); - - // Open video file - if (av_open_input_file(pFormatCtx, pchar(Name), nil, 0, nil) > 0) then - exit; + //Log.LogStatus('aFormatCtx.streams[i] : ' + inttostr(i), 'UAudio_FFMpeg'); + stream := pFormatCtx^.streams[i]; - // Retrieve stream information - if (av_find_stream_info(pFormatCtx)<0) then - exit; - - dump_format(pFormatCtx, 0, pchar(Name), 0); - - if not find_stream_ids( pFormatCtx, lVidStreamID, lAudStreamID ) then - exit; - -// writeln( 'done searching for stream ids' ); - - if lAudStreamID > -1 then - begin -// writeln( 'Audio Stream ID is : '+ inttostr( lAudStreamID ) ); - - lAudioStream := pFormatCtx.streams[lAudStreamID]; - aCodecCtx := lAudioStream.codec; - - // Set audio settings from codec info - wanted_spec.freq := aCodecCtx.sample_rate; - wanted_spec.format := AUDIO_S16SYS; - wanted_spec.channels := aCodecCtx.channels; - wanted_spec.silence := 0; - wanted_spec.samples := SDL_AUDIO_BUFFER_SIZE; - wanted_spec.callback := audio_callback; - wanted_spec.userdata := aCodecCtx; - end; - - if (SDL_OpenAudio(@wanted_spec, @spec) < 0) then - begin - writeln('SDL_OpenAudio: '+SDL_GetError()); - exit + if ( stream.codec^.codec_type = CODEC_TYPE_AUDIO ) then + begin + Log.LogStatus('Found Audio Stream', 'UAudio_FFMpeg'); + streamID := i; + break; + end; end; -// writeln( 'SDL opened audio device' ); - - aCodec := avcodec_find_decoder(aCodecCtx.codec_id); - if (aCodec = nil) then - begin - writeln('Unsupported codec!'); - exit; - end; + result := streamID; +end; - avcodec_open(aCodecCtx, aCodec); +function ParseAudio(data: Pointer): integer; cdecl; +var + packet: TAVPacket; + stream: TFFMpegOutputStream; +begin + stream := TFFMpegOutputStream(data); -// writeln( 'Opened the codec' ); - - packet_queue_init( audioq ); - SDL_PauseAudio(0); - -// writeln( 'SDL_PauseAudio' ); - - i := 0; - while (av_read_frame(pFormatCtx, packet) >= 0) do + while (av_read_frame(stream.pFormatCtx, packet) >= 0) do begin -// writeln( 'ffmpeg - av_read_frame' ); - - if (packet.stream_index = lAudStreamID ) then + writeln( 'ffmpeg - av_read_frame' ); + + if (packet.stream_index = stream.ffmpegStreamID) then begin -// writeln( 'packet_queue_put' ); - packet_queue_put(audioq, packet); + //writeln( 'packet_queue_put' ); + stream.packetQueue.put(@packet); end else begin av_free_packet(packet); end; + end; + Writeln('Done: ' + inttostr(stream.packetQueue.nbPackets)); - // Free the packet that was allocated by av_read_frame - SDL_PollEvent(@event); + result := 0; +end; -(* - if event.type_ = SDL_QUIT the - begin - quit := 1; - SDL_Quit(); - end - else - break; -*) +function TAudio_FFMpeg.LoadSoundFromFile(Name: string): TFFMpegOutputStream; +var + pFormatCtx : PAVFormatContext; + pCodecCtx : PAVCodecContext; + pCodec : PAVCodec; + ffmpegStreamID : Integer; + ffmpegStream : PAVStream; + wanted_spec, + spec : TSDL_AudioSpec; + csIndex : integer; + stream : TFFMpegOutputStream; +begin + result := nil; + + if (not FileExists(Name)) then + begin + Log.LogStatus('LoadSoundFromFile: Sound not found "' + Name + '"', 'UAudio_FFMpeg'); + exit; end; - - writeln( 'Done filling buffer' ); -// halt(0); + // Open audio file + if (av_open_input_file(pFormatCtx, PChar(Name), nil, 0, nil) > 0) then + exit; - // Close the codec -// avcodec_close(aCodecCtx); + // Retrieve stream information + if (av_find_stream_info(pFormatCtx) < 0) then + exit; - // Close the video file -// av_close_input_file(pFormatCtx); + dump_format(pFormatCtx, 0, pchar(Name), 0); -(* - try - // TODO : jb_linux replace with something other than bass - hStream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); - - //Add CustomSound - L := High(CustomSounds) + 1; - SetLength (CustomSounds, L + 1); - CustomSounds[L].Filename := Name; - CustomSounds[L].Handle := hStream; - except - Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); - end; -*) - - end - else + ffmpegStreamID := FindAudioStreamID(pFormatCtx); + if (ffmpegStreamID < 0) then + exit; + + //Log.LogStatus('Audio Stream ID is : '+ inttostr(ffmpegStreamID), 'UAudio_FFMpeg'); + + ffmpegStream := pFormatCtx.streams[ffmpegStreamID]; + pCodecCtx := ffmpegStream^.codec; + + pCodec := avcodec_find_decoder(pCodecCtx^.codec_id); + if (pCodec = nil) then begin - writeln('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); + Log.LogStatus('Unsupported codec!', 'UAudio_FFMpeg'); exit; end; + avcodec_open(pCodecCtx, pCodec); + //writeln( 'Opened the codec' ); + + stream := TFFMpegOutputStream.Create(pFormatCtx, pCodecCtx, pCodec, + ffmpegStreamID, ffmpegStream); + + // Set SDL audio settings from codec info + wanted_spec.freq := pCodecCtx^.sample_rate; + wanted_spec.format := AUDIO_S16SYS; + wanted_spec.channels := pCodecCtx^.channels; + wanted_spec.silence := 0; + wanted_spec.samples := SDL_AUDIO_BUFFER_SIZE; + wanted_spec.callback := AudioCallback; + wanted_spec.userdata := stream; + + // TODO: this works only one time (?) + if (SDL_OpenAudio(@wanted_spec, @spec) < 0) then + begin + Log.LogStatus('SDL_OpenAudio: '+SDL_GetError(), 'UAudio_FFMpeg'); + stream.Free(); + exit + end; + + Log.LogStatus('SDL opened audio device', 'UAudio_FFMpeg'); + + //Add CustomSound + csIndex := High(CustomSounds) + 1; + SetLength (CustomSounds, csIndex + 1); + CustomSounds[csIndex].Filename := Name; + CustomSounds[csIndex].Stream := stream; + + result := stream; end; -procedure packet_queue_init(var aPacketQueue : TPacketQueue ); +//Equalizer +function TAudio_FFMpeg.GetFFTData: TFFTData; +var + data: TFFTData; begin - {$ifdef win32} - FillChar(aPacketQueue, sizeof(TPacketQueue), #0); - {$else} - memset(@aPacketQueue, 0, sizeof(TPacketQueue)); - {$endif} - - aPacketQueue.mutex := SDL_CreateMutex(); - aPacketQueue.cond := SDL_CreateCond(); + //Get Channel Data Mono and 256 Values +// BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); + result := data; +end; + +// Interface for Visualizer +function TAudio_FFMpeg.GetPCMData(var data: TPCMData): Cardinal; +begin + result := 0; +end; + +function TAudio_FFMpeg.LoadCustomSound(const Filename: String): Cardinal; +var + S: TFFMpegOutputStream; + I: Integer; + F: String; +begin + //Search for Sound in already loaded Sounds + F := UpperCase(SoundPath + FileName); + For I := 0 to High(CustomSounds) do + begin + if (UpperCase(CustomSounds[I].Filename) = F) then + begin + Result := I; + Exit; + end; + end; + + S := LoadSoundFromFile(SoundPath + Filename); + if (S <> nil) then + Result := High(CustomSounds) + else + Result := 0; +end; + +procedure TAudio_FFMpeg.PlayCustomSound(const Index: Cardinal ); +begin + if Index <= High(CustomSounds) then + (CustomSounds[Index].Stream as TFFMpegOutputStream).Play(); end; -function packet_queue_put(var aPacketQueue : TPacketQueue; var AVPacket : TAVPacket): integer; + +constructor TPacketQueue.Create(); +begin + inherited; + + firstPkt := nil; + lastPkt := nil; + nbPackets := 0; + size := 0; + + mutex := SDL_CreateMutex(); + cond := SDL_CreateCond(); +end; + +function TPacketQueue.Put(pkt : PAVPacket): integer; var - pkt1 : pAVPacketList; + pkt1 : PAVPacketList; begin result := -1; - -// writeln( 'TAudio_ffMpeg.packet_queue_put' ); - - if av_dup_packet(@AVPacket) < 0 then + + if (av_dup_packet(pkt) < 0) then exit; pkt1 := av_malloc(sizeof(TAVPacketList)); if (pkt1 = nil) then exit; - - pkt1.pkt := AVPacket; - pkt1.next := nil; + + pkt1^.pkt := pkt^; + pkt1^.next := nil; - SDL_LockMutex( aPacketQueue.mutex ); + SDL_LockMutex(Self.mutex); try - if (aPacketQueue.last_pkt = nil) then - aPacketQueue.first_pkt := pkt1 + if (Self.lastPkt = nil) then + Self.firstPkt := pkt1 else - aPacketQueue.last_pkt.next := pkt1; + Self.lastPkt^.next := pkt1; - aPacketQueue.last_pkt := pkt1; - inc( aPacketQueue.nb_packets ); - - aPacketQueue.size := aPacketQueue.size + pkt1.pkt.size; - SDL_CondSignal(aPacketQueue.cond); + Self.lastPkt := pkt1; + inc(Self.nbPackets); + + Writeln('Put: ' + inttostr(nbPackets)); + + Self.size := Self.size + pkt1^.pkt.size; + SDL_CondSignal(Self.cond); finally - SDL_UnlockMutex( aPacketQueue.mutex ); + SDL_UnlockMutex(Self.mutex); end; result := 0; end; -function packet_queue_get(var aPacketQueue : TPacketQueue; var AVPacket : TAVPacket; block : integer ): integer; +function TPacketQueue.Get(var pkt: TAVPacket; block: boolean): integer; var - pkt1 : pAVPacketList; + pkt1 : PAVPacketList; begin result := -1; -// writeln( 'packet_queue_get' ); - - SDL_LockMutex(aPacketQueue.mutex); + + SDL_LockMutex(Self.mutex); try while true do begin - - if (quit <> 0) then + if (quit) then exit; - pkt1 := aPacketQueue.first_pkt; - - if ( pkt1 <> nil ) then + pkt1 := Self.firstPkt; + + if (pkt1 <> nil) then begin - aPacketQueue.first_pkt := pkt1.next; - - if (aPacketQueue.first_pkt = nil ) then - aPacketQueue.last_pkt := nil; - - dec(aPacketQueue.nb_packets); - - aPacketQueue.size := aPacketQueue.size - pkt1.pkt.size; - - AVPacket := pkt1.pkt; + Self.firstPkt := pkt1.next; + if (Self.firstPkt = nil) then + Self.lastPkt := nil; + dec(Self.nbPackets); + + Writeln('Get: ' + inttostr(nbPackets)); + Self.size := Self.size - pkt1^.pkt.size; + pkt := pkt1^.pkt; av_free(pkt1); result := 1; break; end else - if (block = 0) then + if (not block) then begin result := 0; break; end else begin - SDL_CondWait(aPacketQueue.cond, aPacketQueue.mutex); + SDL_CondWait(Self.cond, Self.mutex); end; end; finally - SDL_UnlockMutex(aPacketQueue.mutex); - end; -end; - - -//Equalizer -function TAudio_ffMpeg.GetFFTData: TFFTData; -var - Data: TFFTData; -begin - //Get Channel Data Mono and 256 Values -// BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); -end; - -function TAudio_ffMpeg.LoadCustomSound(const Filename: String): Cardinal; -var - S: hStream; - I: Integer; - F: String; -begin -(* - //Search for Sound in already loaded Sounds - F := UpperCase(SoundPath + FileName); - For I := 0 to High(CustomSounds) do - begin - if (UpperCase(CustomSounds[I].Filename) = F) then - begin - Result := I; - Exit; - end; + SDL_UnlockMutex(Self.mutex); end; - - if LoadSoundFromFile(S, SoundPath + Filename) then - Result := High(CustomSounds) - else - Result := 0; -*) end; -procedure TAudio_ffMpeg.PlayCustomSound(const Index: Cardinal ); -begin -// if Index <= High(CustomSounds) then -// BASS_ChannelPlay(CustomSounds[Index].Handle, True); -end; - - -{* - -Sorry guys... this is my mess :( -Im going to try and get ffmpeg to handle audio playback ( at least for linux ) -and Im going to implement it nicly along side BASS, in TAudio_ffMpeg ( where I can ) - -http://www.dranger.com/ffmpeg/ffmpeg.html -http://www.dranger.com/ffmpeg/ffmpegtutorial_all.html - -http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html - -*} -{* -function TAudio_ffMpeg.FFMPeg_StreamCreateFile(abool : boolean; aFileName : pchar ): THandle; -var - lFormatCtx : PAVFormatContext; -begin - -(* - if(SDL_OpenAudio(&wanted_spec, &spec) < 0) - begin - fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError()); - writeln( 'SDL_OpenAudio' ); - exit; - end; -*) - -(* - if ( av_open_input_file( lFormatCtx, aFileName, NULL, 0, NULL ) <> 0 ) - begin - writeln( 'Unable to open file '+ aFileName ); - exit; - end; - - // Retrieve stream information - if ( av_find_stream_info(pFormatCtx) < 0 ) - begin - writeln( 'Unable to Retrieve stream information' ); - exit; - end; -*) -end; *} initialization - singleton_MusicFFMpeg := TAudio_ffMpeg.create(); + singleton_MusicFFMpeg := TAudio_FFMpeg.create(); - writeln( 'UAudio_Bass - Register Playback' ); + writeln( 'UAudio_FFMpeg - Register Playback' ); AudioManager.add( IAudioPlayback( singleton_MusicFFMpeg ) ); finalization -- cgit v1.2.3 From 6194a1562e4990efe2655f660b73223ed0919311 Mon Sep 17 00:00:00 2001 From: b1indy Date: Mon, 17 Dec 2007 15:26:55 +0000 Subject: some minor changes to make swscale work git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@712 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/ffmpeg/swscale.pas | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/lib/ffmpeg/swscale.pas b/Game/Code/lib/ffmpeg/swscale.pas index 7f356901..83aabb12 100644 --- a/Game/Code/lib/ffmpeg/swscale.pas +++ b/Game/Code/lib/ffmpeg/swscale.pas @@ -128,6 +128,16 @@ type PSwsContext = ^TSwsContext; TSwsContext = record + av_class: Pointer; + swScale: Pointer; + srxW,srcH, dstH: integer; + chrSrcW, chrSrcH, chrDstW, chrDstH: integer; + lumXInc, chrXInc, lumYInc, chrYInc: integer; + dstFormat, srcFormat, origDstFormat, origSrcFormat: integer; + chrSrcHSubSample, chrSrcVSubSample, chrIntHSubSample, chrIntVSubSample: integer; + chrDstHSubSample, chrDstVSubSample: integer; + vChrDrop, sliceDir: integer; + param: array[0..1] of double; {internal structure} end; @@ -135,11 +145,11 @@ type procedure sws_freeContext(swsContext: PSwsContext); cdecl; external sw__scale; -function sws_getContext(srcW: integer; srcH: integer; srcFormat: integer; dstW: integer; dstH: integer;dstFormat: integer; flags: integer; +function sws_getContext(srcW: integer; srcH: integer; srcFormat: TAVPixelFormat; dstW: integer; dstH: integer;dstFormat: TAVPixelFormat; flags: integer; srcFilter: PSwsFilter; dstFilter: PSwsFilter; param: Pdouble): PSwsContext; cdecl; external sw__scale; -function sws_scale(context: PSwsContext; src: PPByteArray; srcStride: PIntArray; srcSliceY: integer; srcSliceH: integer; - dst: PPByteArray; dstStride: PIntArray): integer; +function sws_scale(context: PSwsContext; src: {PPByteArray}array of pbyte; srcStride: {PIntArray} array of integer; srcSliceY: integer; srcSliceH: integer; + dst: {PPByteArray} array of pbyte; dstStride: {PIntArray}array of integer): integer; cdecl; external sw__scale; function sws_scale_ordered(context: PSwsContext; src: PPByteArray; srcStride: PIntArray; srcSliceY: integer; srcSliceH: integer; dst: PPByteArray; dstStride: PIntArray): integer; -- cgit v1.2.3 From 29214cceb54e4683811186e1280a53509f2e888a Mon Sep 17 00:00:00 2001 From: b1indy Date: Mon, 17 Dec 2007 15:50:07 +0000 Subject: include swscale.pas git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@713 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.dpr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 7b0b85a8..9ba415bc 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -47,7 +47,7 @@ uses rational in 'lib\ffmpeg\rational.pas', opt in 'lib\ffmpeg\opt.pas', avio in 'lib\ffmpeg\avio.pas', - //swscale in 'lib\ffmpeg\swscale.pas', + swscale in 'lib\ffmpeg\swscale.pas', {$ifdef UseProjectM_0_9} projectM in 'lib\projectM\0.9\projectM.pas', -- cgit v1.2.3 From 69182994753c4dd7f16ba7f6ac2e406a2d71d3a6 Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 17 Dec 2007 16:39:13 +0000 Subject: added version 1.0 for testing git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@714 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/projectM/0.9/projectM.pas | 590 ++++++++++++++++++++++++++++++++ Game/Code/lib/projectM/1.0/projectM.pas | 336 ++++++++++++++++++ Game/Code/lib/projectM/projectM.pas | 381 --------------------- 3 files changed, 926 insertions(+), 381 deletions(-) create mode 100644 Game/Code/lib/projectM/0.9/projectM.pas create mode 100644 Game/Code/lib/projectM/1.0/projectM.pas delete mode 100644 Game/Code/lib/projectM/projectM.pas (limited to 'Game/Code') diff --git a/Game/Code/lib/projectM/0.9/projectM.pas b/Game/Code/lib/projectM/0.9/projectM.pas new file mode 100644 index 00000000..511e1744 --- /dev/null +++ b/Game/Code/lib/projectM/0.9/projectM.pas @@ -0,0 +1,590 @@ +unit projectM; + +{$IFDEF FPC} + {$IFNDEF win32} + {$LINKLIB libprojectM} + {$ENDIF} + {$MODE DELPHI} + {$PACKENUM 4} + {$PACKRECORDS C} +{$ENDIF} + +interface + +uses + SysUtils; + +const +{$IFDEF win32} + libprojectM = 'libprojectM.dll'; +{$ELSE} + libprojectM = 'libprojectM.so'; +{$ENDIF} + +const + PROJECTM_VERSION = '0.99'; + PROJECTM_TITLE = 'projectM 0.99'; + +type + // 16bit non-interleaved data + TPCM16 = array[0..1, 0..511] of Smallint; + PPCM16 = ^TPCM16; + // 8bit non-interleaved data + TPCM8_512 = array[0..1, 0..511] of byte; + PPCM8_512 = ^TPCM8_512; + +{ Event types } +type + TProjectMEvent = integer; +const + PROJECTM_KEYUP = 0; + PROJECTM_KEYDOWN = 1; + PROJECTM_VIDEORESIZE = 2; + PROJECTM_VIDEOQUIT = 3; + PROJECTM_NONE = 4; + +{ Keycodes } +type + TProjectMKeycode = integer; +const + PROJECTM_K_RETURN = 0; + PROJECTM_K_RIGHT = 1; + PROJECTM_K_LEFT = 2; + PROJECTM_K_UP = 3; + PROJECTM_K_DOWN = 4; + PROJECTM_K_PAGEUP = 5; + PROJECTM_K_PAGEDOWN = 6; + PROJECTM_K_INSERT = 7; + PROJECTM_K_DELETE = 8; + PROJECTM_K_ESCAPE = 9; + PROJECTM_K_LSHIFT = 10; + PROJECTM_K_RSHIFT = 11; + PROJECTM_K_CAPSLOCK = 12; + PROJECTM_K_LCTRL = 13; + PROJECTM_K_HOME = 14; + PROJECTM_K_END = 15; + PROJECTM_K_BACKSPACE = 16; + + PROJECTM_K_F1 = 17; + PROJECTM_K_F2 = (PROJECTM_K_F1 + 1); + PROJECTM_K_F3 = (PROJECTM_K_F1 + 2); + PROJECTM_K_F4 = (PROJECTM_K_F1 + 3); + PROJECTM_K_F5 = (PROJECTM_K_F1 + 4); + PROJECTM_K_F6 = (PROJECTM_K_F1 + 5); + PROJECTM_K_F7 = (PROJECTM_K_F1 + 6); + PROJECTM_K_F8 = (PROJECTM_K_F1 + 7); + PROJECTM_K_F9 = (PROJECTM_K_F1 + 8); + PROJECTM_K_F10 = (PROJECTM_K_F1 + 9); + PROJECTM_K_F11 = (PROJECTM_K_F1 + 10); + PROJECTM_K_F12 = (PROJECTM_K_F1 + 11); + + PROJECTM_K_0 = 48; + PROJECTM_K_1 = (PROJECTM_K_0 + 1); + PROJECTM_K_2 = (PROJECTM_K_0 + 2); + PROJECTM_K_3 = (PROJECTM_K_0 + 3); + PROJECTM_K_4 = (PROJECTM_K_0 + 4); + PROJECTM_K_5 = (PROJECTM_K_0 + 5); + PROJECTM_K_6 = (PROJECTM_K_0 + 6); + PROJECTM_K_7 = (PROJECTM_K_0 + 7); + PROJECTM_K_8 = (PROJECTM_K_0 + 8); + PROJECTM_K_9 = (PROJECTM_K_0 + 9); + + { Upper case } + PROJECTM_K_A_UPPERCASE = 65; + PROJECTM_K_B_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 1); + PROJECTM_K_C_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 2); + PROJECTM_K_D_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 3); + PROJECTM_K_E_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 4); + PROJECTM_K_F_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 5); + PROJECTM_K_G_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 6); + PROJECTM_K_H_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 7); + PROJECTM_K_I_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 8); + PROJECTM_K_J_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 9); + PROJECTM_K_K_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 10); + PROJECTM_K_L_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 11); + PROJECTM_K_M_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 12); + PROJECTM_K_N_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 13); + PROJECTM_K_O_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 14); + PROJECTM_K_P_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 15); + PROJECTM_K_Q_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 16); + PROJECTM_K_R_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 17); + PROJECTM_K_S_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 18); + PROJECTM_K_T_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 19); + PROJECTM_K_U_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 20); + PROJECTM_K_V_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 21); + PROJECTM_K_W_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 22); + PROJECTM_K_X_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 23); + PROJECTM_K_Y_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 24); + PROJECTM_K_Z_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 25); + + { Lower case } + PROJECTM_K_a_LOWERCASE = 97; + PROJECTM_K_b_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 1); + PROJECTM_K_c_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 2); + PROJECTM_K_d_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 3); + PROJECTM_K_e_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 4); + PROJECTM_K_f_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 5); + PROJECTM_K_g_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 6); + PROJECTM_K_h_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 7); + PROJECTM_K_i_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 8); + PROJECTM_K_j_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 9); + PROJECTM_K_k_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 10); + PROJECTM_K_l_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 11); + PROJECTM_K_m_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 12); + PROJECTM_K_n_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 13); + PROJECTM_K_o_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 14); + PROJECTM_K_p_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 15); + PROJECTM_K_q_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 16); + PROJECTM_K_r_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 17); + PROJECTM_K_s_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 18); + PROJECTM_K_t_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 19); + PROJECTM_K_u_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 20); + PROJECTM_K_v_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 21); + PROJECTM_K_w_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 22); + PROJECTM_K_x_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 23); + PROJECTM_K_y_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 24); + PROJECTM_K_z_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 25); + + PROJECTM_K_NONE = (PROJECTM_K_z_LOWERCASE + 1); + +{ Modifiers } +type + TProjectMModifier = integer; +const + PROJECTM_KMOD_LSHIFT = 0; + PROJECTM_KMOD_RSHIFT = 1; + PROJECTM_KMOD_CAPS = 2; + PROJECTM_KMOD_LCTRL = 3; + PROJECTM_KMOD_RCTRL = 4; + +type + PProjectM = ^TProjectM; + TProjectM = class(TObject) + private + _pm: Pointer; + public + constructor Create(gx, gy: integer; fps: integer; + texsize: integer; width, height: integer; + presetsDir, fontsDir: string); + + procedure ResetGL(width, height: Integer); + procedure SetTitle(title: string); + procedure RenderFrame(); + + procedure AddPCMfloat(pcmData: PSingle; samples: integer); + procedure AddPCM16(pcmData: PPCM16); + procedure AddPCM16Data(pcmData: PSmallint; samples: Smallint); + procedure AddPCM8_512(pcmData: PPCM8_512); + + procedure RandomPreset(); + procedure PreviousPreset(); + procedure NextPreset(); + procedure ToggleShowPresetNames(); + + procedure KeyHandler(event: TProjectMEvent; + keycode: TProjectMKeycode; + modifier: TProjectMModifier); + + destructor Destroy(); + end; + +implementation + +uses +{$IFNDEF win32} + baseunix, +{$ENDIF} + OpenGL12; + + +{**************** INTERNAL SECTION ****************} + + +type + PPSingle = ^PSingle; + +type + _TContextType = Integer; +const + AGL_CONTEXT = 0; + CGL_CONTEXT = 1; + NSGL_CONTEXT = 2; + GLX_CONTEXT = 3; + WGL_CONTEXT = 4; + +type + _PRenderTarget = ^_TRenderTarget; + _TRenderTarget = record + { Texture size } + texsize: Integer; + + { Application context } + origContextType: _TContextType; + + usePbuffers: Integer; + + {$ifdef LINUX} + lock_func: procedure(); cdecl; + unlock_func: procedure(); cdecl; + {$endif} + + { Opaque pbuffer context and pbuffer } + {$ifdef MACOS} + origContext: Pointer; + pbufferContext: Pointer; + pbuffer: Pointer; + {$endif} + + { Render target texture ID for non-pbuffer systems } + textureID: array[0..2] of TGLuint; + end; + + _PProjectM = ^_TProjectM; + _TProjectM = record + presetURL: PChar; + presetName: PChar; + fontURL: PChar; + + hasInit: Integer; + + noSwitch: Integer; + pcmframes: Integer; + freqframes: Integer; + totalframes: Integer; + + showfps: Integer; + showtitle: Integer; + showpreset: Integer; + showhelp: Integer; + showstats: Integer; + + studio: Integer; + + fbuffer: PGLubyte; + + {$ifndef Win32} + { The first ticks value of the application } + startTime: timeval; + {$else} + startTime: Longint; + {$endif Win32} + Time: Single; + + { Render target texture ID } + renderTarget: _PRenderTarget; + + disp: array[0..79] of Char; + + wave_o: Single; + + //int texsize=1024; //size of texture to do actual graphics + fvw: Integer; //fullscreen dimensions + fvh: Integer; + wvw: Integer; //windowed dimensions + wvh: Integer; + vw: Integer; //runtime dimensions + vh: Integer; + fullscreen: Integer; + + maxsamples: Integer; //size of PCM buffer + numsamples: Integer; //size of new PCM info + pcmdataL: PSingle; //holder for most recent pcm data + pcmdataR: PSingle; //holder for most recent pcm data + + avgtime: Integer; //# frames per preset + + title: PChar; + drawtitle: Integer; + + correction: Integer; + + vol: Single; + + //per pixel equation variables + gridx: PPSingle; //grid containing interpolated mesh + gridy: PPSingle; + origtheta: PPSingle; //grid containing interpolated mesh reference values + origrad: PPSingle; + origx: PPSingle; //original mesh + origy: PPSingle; + origx2: PPSingle; //original mesh + origy2: PPSingle; + + { Timing information } + mspf: Integer; + timed: Integer; + timestart: Integer; + nohard: Integer; + count: Integer; + realfps, + fpsstart: Single; + + { PCM data } + vdataL: array[0..511] of Single; //holders for FFT data (spectrum) + vdataR: array[0..511] of Single; + + { Various toggles } + doPerPixelEffects: Integer; + doIterative: Integer; + + { ENGINE VARIABLES } + { From engine_vars.h } + preset_name: array[0..255] of Char; + + { PER FRAME CONSTANTS BEGIN } + zoom: Single; + zoomexp: Single; + rot: Single; + warp: Single; + + sx: Single; + sy: Single; + dx: Single; + dy: Single; + cx: Single; + cy: Single; + + gy: Integer; + gx: Integer; + + decay: Single; + + wave_r: Single; + wave_g: Single; + wave_b: Single; + wave_x: Single; + wave_y: Single; + wave_mystery: Single; + + ob_size: Single; + ob_r: Single; + ob_g: Single; + ob_b: Single; + ob_a: Single; + + ib_size: Single; + ib_r: Single; + ib_g: Single; + ib_b: Single; + ib_a: Single; + + meshx: Integer; + meshy: Integer; + + mv_a: Single; + mv_r: Single; + mv_g: Single; + mv_b: Single; + mv_l: Single; + mv_x: Single; + mv_y: Single; + mv_dy: Single; + mv_dx: Single; + + treb: Single; + mid: Single; + bass: Single; + bass_old: Single; + beat_sensitivity: Single; + treb_att: Single; + mid_att: Single; + bass_att: Single; + progress: Single; + frame: Integer; + + { PER_FRAME CONSTANTS END } + + { PER_PIXEL CONSTANTS BEGIN } + + x_per_pixel: Single; + y_per_pixel: Single; + rad_per_pixel: Single; + ang_per_pixel: Single; + + { PER_PIXEL CONSTANT END } + + + fRating: Single; + fGammaAdj: Single; + fVideoEchoZoom: Single; + fVideoEchoAlpha: Single; + + nVideoEchoOrientation: Integer; + nWaveMode: Integer; + bAdditiveWaves: Integer; + bWaveDots: Integer; + bWaveThick: Integer; + bModWaveAlphaByVolume: Integer; + bMaximizeWaveColor: Integer; + bTexWrap: Integer; + bDarkenCenter: Integer; + bRedBlueStereo: Integer; + bBrighten: Integer; + bDarken: Integer; + bSolarize: Integer; + bInvert: Integer; + bMotionVectorsOn: Integer; + fps: Integer; + + fWaveAlpha: Single; + fWaveScale: Single; + fWaveSmoothing: Single; + fWaveParam: Single; + fModWaveAlphaStart: Single; + fModWaveAlphaEnd: Single; + fWarpAnimSpeed: Single; + fWarpScale: Single; + fShader: Single; + + + { Q VARIABLES START } + + q1: Single; + q2: Single; + q3: Single; + q4: Single; + q5: Single; + q6: Single; + q7: Single; + q8: Single; + + + { Q VARIABLES END } + + zoom_mesh: PPSingle; + zoomexp_mesh: PPSingle; + rot_mesh: PPSingle; + + sx_mesh: PPSingle; + sy_mesh: PPSingle; + dx_mesh: PPSingle; + dy_mesh: PPSingle; + cx_mesh: PPSingle; + cy_mesh: PPSingle; + + x_mesh: PPSingle; + y_mesh: PPSingle; + rad_mesh: PPSingle; + theta_mesh: PPSingle; + end; + +{ projectM.h declarations } +procedure _projectM_init(pm: _PProjectM); cdecl; external libprojectM name 'projectM_init'; +procedure _projectM_reset(pm: _PProjectM); cdecl; external libprojectM name 'projectM_reset'; +procedure _projectM_resetGL(pm: _PProjectM; width: Integer; height: Integer); cdecl; external libprojectM name 'projectM_resetGL'; +procedure _projectM_setTitle(pm: _PProjectM; title: PChar); cdecl; external libprojectM name 'projectM_setTitle'; +procedure _renderFrame(pm: _PProjectM); cdecl; external libprojectM name 'renderFrame'; + +{ PCM.h declarations } +procedure _addPCMfloat(pcm_data: PSingle; samples: integer); cdecl; external libprojectM name 'addPCMfloat'; +procedure _addPCM16(pcm_data: PPCM16); cdecl; external libprojectM name 'addPCM16'; +procedure _addPCM16Data(pcm_data: PSmallint; samples: Smallint); cdecl; external libprojectM name 'addPCM16Data'; +procedure _addPCM8_512(pcm_data: PPCM8_512); cdecl; external libprojectM name 'addPCM8'; + +{ console_interface.h declarations } +procedure _key_handler(pm: _PProjectM; + event: TProjectMEvent; + keycode: TProjectMKeycode; + modifier: TProjectMModifier); cdecl; external libprojectM name 'key_handler'; + + + + +{**************** EXTERNAL SECTION ****************} + + +constructor TProjectM.Create(gx, gy: integer; fps: integer; + texsize: integer; width, height: integer; + presetsDir, fontsDir: string); +var + pm: _PProjectM; +begin + New(pm); + _pm := pm; + _projectM_reset(pm); + + pm^.fullscreen := 0; + pm^.renderTarget^.texsize := texsize; + pm^.gx := gx; + pm^.gy := gy; + pm^.fps := fps; + pm^.renderTarget^.usePbuffers := 0; + + pm^.fontURL := PChar(fontsDir); + pm^.presetURL := PChar(presetsDir); + + _projectM_init(pm); +end; + +procedure TProjectM.ResetGL(width, height: Integer); +begin + _projectM_resetGL(_pm, width, height); +end; + +procedure TProjectM.SetTitle(title: string); +var pm: _PProjectM; +begin + pm := _pm; + pm^.title := PChar(title); + pm^.showtitle := 1; +end; + +procedure TProjectM.RenderFrame(); +begin + _renderFrame(_pm); +end; + +procedure TProjectM.AddPCMfloat(pcmData: PSingle; samples: integer); +begin + _addPCMfloat(pcmData, samples); +end; + +procedure TProjectM.AddPCM16(pcmData: PPCM16); +begin + _addPCM16(pcmData); +end; + +procedure TProjectM.AddPCM16Data(pcmData: PSmallint; samples: Smallint); +begin + _addPCM16Data(pcmData, samples); +end; + +procedure TProjectM.AddPCM8_512(pcmData: PPCM8_512); +begin + _addPCM8_512(pcmData); +end; + +procedure TProjectM.KeyHandler(event: TProjectMEvent; + keycode: TProjectMKeycode; + modifier: TProjectMModifier); +begin + _key_handler(_pm, event, keycode, modifier); +end; + +procedure TProjectM.RandomPreset(); +begin + KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_r_LOWERCASE, PROJECTM_KMOD_LSHIFT); +end; + +procedure TProjectM.PreviousPreset(); +begin + KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_p_LOWERCASE, PROJECTM_KMOD_LSHIFT); +end; + +procedure TProjectM.NextPreset(); +begin + KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_n_LOWERCASE, PROJECTM_KMOD_LSHIFT); +end; + +procedure TProjectM.ToggleShowPresetNames(); +begin + KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_F3, PROJECTM_KMOD_LSHIFT); +end; + +destructor TProjectM.Destroy(); +begin + Dispose(_pm); + _pm := nil; +end; + +end. diff --git a/Game/Code/lib/projectM/1.0/projectM.pas b/Game/Code/lib/projectM/1.0/projectM.pas new file mode 100644 index 00000000..87184e2f --- /dev/null +++ b/Game/Code/lib/projectM/1.0/projectM.pas @@ -0,0 +1,336 @@ +unit projectM; + +{$IFDEF FPC} + {$IFNDEF win32} + {$LINKLIB libprojectM} + {$ENDIF} + {$MODE DELPHI} + {$PACKENUM 4} + {$PACKRECORDS C} +{$ENDIF} + +interface + +uses + OpenGL12; + +const +{$IFDEF win32} + libprojectM = 'projectM-cwrapper.dll'; +{$ELSE} + libprojectM = 'libprojectM-cwrapper.so'; +{$ENDIF} + +const + PROJECTM_VERSION = '1.00.00'; + PROJECTM_TITLE = 'projectM 1.00.00'; + +type + // 16bit non-interleaved data + TPCM16 = array[0..1, 0..511] of Smallint; + PPCM16 = ^TPCM16; + // 8bit non-interleaved data (512 samples) + TPCM8_512 = array[0..1, 0..511] of byte; + PPCM8_512 = ^TPCM8_512; + // 8bit non-interleaved data (1024 samples) + TPCM8_1024 = array[0..1, 0..1023] of byte; + PPCM8_1024 = ^TPCM8_512; + +{ Event types } +type + TProjectMEvent = integer; +const + PROJECTM_KEYUP = 0; + PROJECTM_KEYDOWN = 1; + PROJECTM_VIDEORESIZE = 2; + PROJECTM_VIDEOQUIT = 3; + PROJECTM_NONE = 4; + +{ Keycodes } +type + TProjectMKeycode = integer; +const + PROJECTM_K_RETURN = 0; + PROJECTM_K_RIGHT = 1; + PROJECTM_K_LEFT = 2; + PROJECTM_K_UP = 3; + PROJECTM_K_DOWN = 4; + PROJECTM_K_PAGEUP = 5; + PROJECTM_K_PAGEDOWN = 6; + PROJECTM_K_INSERT = 7; + PROJECTM_K_DELETE = 8; + PROJECTM_K_ESCAPE = 9; + PROJECTM_K_LSHIFT = 10; + PROJECTM_K_RSHIFT = 11; + PROJECTM_K_CAPSLOCK = 12; + PROJECTM_K_LCTRL = 13; + PROJECTM_K_HOME = 14; + PROJECTM_K_END = 15; + PROJECTM_K_BACKSPACE = 16; + + PROJECTM_K_F1 = 17; + PROJECTM_K_F2 = (PROJECTM_K_F1 + 1); + PROJECTM_K_F3 = (PROJECTM_K_F1 + 2); + PROJECTM_K_F4 = (PROJECTM_K_F1 + 3); + PROJECTM_K_F5 = (PROJECTM_K_F1 + 4); + PROJECTM_K_F6 = (PROJECTM_K_F1 + 5); + PROJECTM_K_F7 = (PROJECTM_K_F1 + 6); + PROJECTM_K_F8 = (PROJECTM_K_F1 + 7); + PROJECTM_K_F9 = (PROJECTM_K_F1 + 8); + PROJECTM_K_F10 = (PROJECTM_K_F1 + 9); + PROJECTM_K_F11 = (PROJECTM_K_F1 + 10); + PROJECTM_K_F12 = (PROJECTM_K_F1 + 11); + + PROJECTM_K_0 = 48; + PROJECTM_K_1 = (PROJECTM_K_0 + 1); + PROJECTM_K_2 = (PROJECTM_K_0 + 2); + PROJECTM_K_3 = (PROJECTM_K_0 + 3); + PROJECTM_K_4 = (PROJECTM_K_0 + 4); + PROJECTM_K_5 = (PROJECTM_K_0 + 5); + PROJECTM_K_6 = (PROJECTM_K_0 + 6); + PROJECTM_K_7 = (PROJECTM_K_0 + 7); + PROJECTM_K_8 = (PROJECTM_K_0 + 8); + PROJECTM_K_9 = (PROJECTM_K_0 + 9); + + { Upper case } + PROJECTM_K_A_UPPERCASE = 65; + PROJECTM_K_B_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 1); + PROJECTM_K_C_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 2); + PROJECTM_K_D_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 3); + PROJECTM_K_E_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 4); + PROJECTM_K_F_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 5); + PROJECTM_K_G_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 6); + PROJECTM_K_H_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 7); + PROJECTM_K_I_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 8); + PROJECTM_K_J_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 9); + PROJECTM_K_K_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 10); + PROJECTM_K_L_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 11); + PROJECTM_K_M_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 12); + PROJECTM_K_N_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 13); + PROJECTM_K_O_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 14); + PROJECTM_K_P_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 15); + PROJECTM_K_Q_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 16); + PROJECTM_K_R_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 17); + PROJECTM_K_S_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 18); + PROJECTM_K_T_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 19); + PROJECTM_K_U_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 20); + PROJECTM_K_V_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 21); + PROJECTM_K_W_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 22); + PROJECTM_K_X_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 23); + PROJECTM_K_Y_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 24); + PROJECTM_K_Z_UPPERCASE = (PROJECTM_K_A_UPPERCASE + 25); + + { Lower case } + PROJECTM_K_a_LOWERCASE = 97; + PROJECTM_K_b_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 1); + PROJECTM_K_c_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 2); + PROJECTM_K_d_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 3); + PROJECTM_K_e_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 4); + PROJECTM_K_f_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 5); + PROJECTM_K_g_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 6); + PROJECTM_K_h_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 7); + PROJECTM_K_i_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 8); + PROJECTM_K_j_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 9); + PROJECTM_K_k_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 10); + PROJECTM_K_l_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 11); + PROJECTM_K_m_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 12); + PROJECTM_K_n_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 13); + PROJECTM_K_o_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 14); + PROJECTM_K_p_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 15); + PROJECTM_K_q_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 16); + PROJECTM_K_r_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 17); + PROJECTM_K_s_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 18); + PROJECTM_K_t_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 19); + PROJECTM_K_u_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 20); + PROJECTM_K_v_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 21); + PROJECTM_K_w_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 22); + PROJECTM_K_x_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 23); + PROJECTM_K_y_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 24); + PROJECTM_K_z_LOWERCASE = (PROJECTM_K_a_LOWERCASE + 25); + + PROJECTM_K_NONE = (PROJECTM_K_z_LOWERCASE + 1); + +{ Modifiers } +type + TProjectMModifier = integer; +const + PROJECTM_KMOD_LSHIFT = 0; + PROJECTM_KMOD_RSHIFT = 1; + PROJECTM_KMOD_CAPS = 2; + PROJECTM_KMOD_LCTRL = 3; + PROJECTM_KMOD_RCTRL = 4; + + +type + PProjectM = ^TProjectM; + TProjectM = class(TObject) + private + _pm: Pointer; + public + constructor Create(gx, gy: integer; fps: integer; + texsize: integer; width, height: integer; + presetsDir, fontsDir: string; + titleFont: string = 'Vera.ttf'; + menuFont: string = 'Vera.ttf'); overload; + constructor Create(configFile: string); overload; + + procedure ResetGL(width, height: Integer); + procedure SetTitle(title: string); + procedure RenderFrame(); + + procedure AddPCMfloat(pcmData: PSingle; samples: integer); + procedure AddPCM16(pcmData: PPCM16); + procedure AddPCM16Data(pcmData: PSmallint; samples: Smallint); + procedure AddPCM8_512(pcmData: PPCM8_512); + procedure AddPCM8_1024(pcmData: PPCM8_1024); + + procedure RandomPreset(); + procedure PreviousPreset(); + procedure NextPreset(); + procedure ToggleShowPresetNames(); + + function InitRenderToTexture(): GLuint; + + procedure KeyHandler(event: TProjectMEvent; + keycode: TProjectMKeycode; + modifier: TProjectMModifier); + + destructor Destroy(); + end; + +implementation + + +{**************** INTERNAL SECTION ****************} + + +type + _PProjectM = Pointer; + +{ projectM.hpp declarations } +function _projectM_create1(config_file: PChar): _PProjectM; cdecl; external libprojectM name 'projectM_create1'; +function _projectM_create2(gx: integer; gy: integer; fps: integer; + texsize: integer; width: integer; height: integer; + preset_url: PChar; title_fonturl: PChar; title_menuurl: PChar): _PProjectM; cdecl; external libprojectM name 'projectM_create2'; + +procedure _projectM_resetGL(pm: _PProjectM; width: integer; height: integer); cdecl; external libprojectM name 'projectM_resetGL'; +procedure _projectM_setTitle(pm: _PProjectM; title: PChar); cdecl; external libprojectM name 'projectM_setTitle'; +procedure _projectM_renderFrame(pm: _PProjectM); cdecl; external libprojectM name 'projectM_renderFrame'; +function _projectM_initRenderToTexture(pm: _PProjectM): Cardinal; cdecl; external libprojectM name 'projectM_initRenderToTexture'; + +procedure _projectM_free(pm: _PProjectM); cdecl; external libprojectM name 'projectM_free'; + +procedure _projectM_key_handler(pm: _PProjectM; event: TProjectMEvent; + keycode: TProjectMKeycode; modifier: TProjectMModifier); cdecl; external libprojectM name 'projectM_key_handler'; + +{ PCM.hpp declarations } +procedure _PCM_addPCMfloat(pm: _PProjectM; pcm_data: PSingle; samples: integer); cdecl; external libprojectM name 'PCM_addPCMfloat'; +procedure _PCM_addPCM16(pm: _PProjectM; pcm_data: PPCM16); cdecl; external libprojectM name 'PCM_addPCM16'; +procedure _PCM_addPCM16Data(pm: _PProjectM; pcm_data: PSmallint; samples: Smallint); cdecl; external libprojectM name 'PCM_addPCM16Data'; +procedure _PCM_addPCM8_512(pm: _PProjectM; pcm_data: PPCM8_512); cdecl; external libprojectM name 'PCM_addPCM8_512'; +procedure _PCM_addPCM8_1024(pm: _PProjectM; pcm_data: PPCM8_1024); cdecl; external libprojectM name 'PCM_addPCM8'; + + +{**************** EXTERNAL SECTION ****************} + +constructor TProjectM.Create(gx, gy: integer; fps: integer; + texsize: integer; width, height: integer; + presetsDir, fontsDir: string; titleFont, menuFont: string); +begin + _pm := _projectM_create2(gx, gy, fps, texsize, width, height, + PChar(presetsDir), + PChar(fontsDir + '/' + titleFont), + PChar(fontsDir + '/' + menuFont)) +end; + +constructor TProjectM.Create(configFile: string); +begin + _pm := _projectM_create1(PChar(configFile)); +end; + +procedure TProjectM.ResetGL(width, height: Integer); +begin + _projectM_resetGL(_pm, width, height); +end; + +procedure TProjectM.SetTitle(title: string); +begin + _projectM_setTitle(_pm, PChar(title)); +end; + +procedure TProjectM.RenderFrame(); +begin + _projectM_renderFrame(_pm); +end; + +procedure TProjectM.AddPCMfloat(pcmData: PSingle; samples: integer); +begin + _PCM_addPCMfloat(_pm, pcmData, samples); +end; + +procedure TProjectM.AddPCM16(pcmData: PPCM16); +begin + _PCM_addPCM16(_pm, pcmData); +end; + +{** + * Passes interleaved stereo PCM-samples to projectM. + *} +procedure TProjectM.AddPCM16Data(pcmData: PSmallint; samples: Smallint); +begin + _PCM_addPCM16Data(_pm, pcmData, samples); +end; + +procedure TProjectM.AddPCM8_512(pcmData: PPCM8_512); +begin + _PCM_addPCM8_512(_pm, pcmData); +end; + +procedure TProjectM.AddPCM8_1024(pcmData: PPCM8_1024); +begin + _PCM_addPCM8_1024(_pm, pcmData); +end; + +{** + * If the result is > -1 projectM will render to a texture. + * The texture-ID is the return-value. + *} +function TProjectM.InitRenderToTexture(): GLuint; +begin + result := _projectM_initRenderToTexture(_pm); +end; + +procedure TProjectM.KeyHandler(event: TProjectMEvent; + keycode: TProjectMKeycode; + modifier: TProjectMModifier); +begin + _projectM_key_handler(_pm, event, keycode, modifier); +end; + +procedure TProjectM.RandomPreset(); +begin + KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_r_LOWERCASE, PROJECTM_KMOD_LSHIFT); +end; + +procedure TProjectM.PreviousPreset(); +begin + KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_p_LOWERCASE, PROJECTM_KMOD_LSHIFT); +end; + +procedure TProjectM.NextPreset(); +begin + KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_n_LOWERCASE, PROJECTM_KMOD_LSHIFT); +end; + +procedure TProjectM.ToggleShowPresetNames(); +begin + KeyHandler(PROJECTM_KEYDOWN, PROJECTM_K_F3, PROJECTM_KMOD_LSHIFT); +end; + +destructor TProjectM.Destroy(); +begin + _projectM_free(_pm); + _pm := nil; +end; + +end. diff --git a/Game/Code/lib/projectM/projectM.pas b/Game/Code/lib/projectM/projectM.pas deleted file mode 100644 index 1c699e2b..00000000 --- a/Game/Code/lib/projectM/projectM.pas +++ /dev/null @@ -1,381 +0,0 @@ -unit projectM; - -{$IFDEF FPC} - {$IFNDEF win32} - {$LINKLIB libprojectM} - {$ENDIF} - {$MODE DELPHI} - {$PACKENUM 4} - {$PACKRECORDS C} -{$ENDIF} - -interface - -uses -{$IFNDEF win32} - baseunix, -{$ENDIF} - OpenGL12; - -const -{$IFDEF win32} - libprojectM = 'libprojectM.dll'; -{$ELSE} - libprojectM = 'libprojectM.so'; -{$ENDIF} - -const - PROJECTM_VERSION = '0.99'; - PROJECTM_TITLE = 'projectM 0.99'; - -type - FLOAT = Single; - PFLOAT = ^FLOAT; - PPFLOAT = ^PFLOAT; - INT = Integer; - SHORT = Smallint; - LONG = Longint; - -type - // 16bit interleaved data - TPCM16Data = array[0..511, 0..1] of SHORT; - PPCM16Data = ^TPCM16Data; - // 16bit non-interleaved data - TPCM16 = array[0..1, 0..511] of SHORT; - PPCM16 = ^TPCM16; - // 8bit non-interleaved data - TPCM8 = array[0..1, 0..511] of byte; - PPCM8 = ^TPCM8; - -type - TTextureScale = INT; -const - SCALE_NEAREST = 0; - SCALE_MAGNIFY = 1; - SCALE_MINIFY = 2; - -type - TContextType = INT; -const - AGL_CONTEXT = 0; - CGL_CONTEXT = 1; - NSGL_CONTEXT = 2; - GLX_CONTEXT = 3; - WGL_CONTEXT = 4; - -type - TPBufferPass = INT; -const - PBUFFER_PASS1 = 0; - PBUFFER_PASS2 = 1; - -type - PRenderTarget = ^TRenderTarget; - TRenderTarget = record - { Texture size } - texsize: INT; - - { Application context } - origContextType: TContextType; - - usePbuffers: INT; - - {$ifdef LINUX} - lock_func: procedure(); cdecl; - unlock_func: procedure(); cdecl; - {$endif} - - { Opaque pbuffer context and pbuffer } - {$ifdef MACOS} - origContext: Pointer; - pbufferContext: Pointer; - pbuffer: Pointer; - {$endif} - - { Render target texture ID for non-pbuffer systems } - textureID: array[0..2] of TGLuint; - end; - - { - procedure createPBuffers( width, height: INT; target: PRenderTarget ); - procedure lockPBuffer( target: PRenderTarget; pass: PBufferPass ); - procedure unlockPBuffer( target: PRenderTarget ); - function nearestPower2( value: INT; scaleRule: TTextureScale ): INT; - } - - PProjectM = ^TProjectM; - TProjectM = record - presetURL: PChar; - presetName: PChar; - fontURL: PChar; - - hasInit: INT; - - noSwitch: INT; - pcmframes: INT; - freqframes: INT; - totalframes: INT; - - showfps: INT; - showtitle: INT; - showpreset: INT; - showhelp: INT; - showstats: INT; - - studio: INT; - - fbuffer: PGLubyte; - - {$ifndef Win32} - { The first ticks value of the application } - startTime: timeval; - {$else} - startTime: LONG; - {$endif Win32} - Time: FLOAT; - - { Render target texture ID } - renderTarget: PRenderTarget; - - disp: array[0..79] of Char; - - wave_o: FLOAT; - - //int texsize=1024; //size of texture to do actual graphics - fvw: INT; //fullscreen dimensions - fvh: INT; - wvw: INT; //windowed dimensions - wvh: INT; - vw: INT; //runtime dimensions - vh: INT; - fullscreen: INT; - - maxsamples: INT; //size of PCM buffer - numsamples: INT; //size of new PCM info - pcmdataL: PFLOAT; //holder for most recent pcm data - pcmdataR: PFLOAT; //holder for most recent pcm data - - avgtime: INT; //# frames per preset - - title: PChar; - drawtitle: INT; - - correction: INT; - - vol: FLOAT; - - //per pixel equation variables - gridx: PPFLOAT; //grid containing interpolated mesh - gridy: PPFLOAT; - origtheta: PPFLOAT; //grid containing interpolated mesh reference values - origrad: PPFLOAT; - origx: PPFLOAT; //original mesh - origy: PPFLOAT; - origx2: PPFLOAT; //original mesh - origy2: PPFLOAT; - - { Timing information } - mspf: INT; - timed: INT; - timestart: INT; - nohard: INT; - count: INT; - realfps, - fpsstart: FLOAT; - - { PCM data } - vdataL: array[0..511] of FLOAT; //holders for FFT data (spectrum) - vdataR: array[0..511] of FLOAT; - - { Various toggles } - doPerPixelEffects: INT; - doIterative: INT; - - { ENGINE VARIABLES } - { From engine_vars.h } - preset_name: array[0..255] of Char; - - { PER FRAME CONSTANTS BEGIN } - zoom: FLOAT; - zoomexp: FLOAT; - rot: FLOAT; - warp: FLOAT; - - sx: FLOAT; - sy: FLOAT; - dx: FLOAT; - dy: FLOAT; - cx: FLOAT; - cy: FLOAT; - - gy: INT; - gx: INT; - - decay: FLOAT; - - wave_r: FLOAT; - wave_g: FLOAT; - wave_b: FLOAT; - wave_x: FLOAT; - wave_y: FLOAT; - wave_mystery: FLOAT; - - ob_size: FLOAT; - ob_r: FLOAT; - ob_g: FLOAT; - ob_b: FLOAT; - ob_a: FLOAT; - - ib_size: FLOAT; - ib_r: FLOAT; - ib_g: FLOAT; - ib_b: FLOAT; - ib_a: FLOAT; - - meshx: INT; - meshy: INT; - - mv_a: FLOAT; - mv_r: FLOAT; - mv_g: FLOAT; - mv_b: FLOAT; - mv_l: FLOAT; - mv_x: FLOAT; - mv_y: FLOAT; - mv_dy: FLOAT; - mv_dx: FLOAT; - - treb: FLOAT; - mid: FLOAT; - bass: FLOAT; - bass_old: FLOAT; - beat_sensitivity: FLOAT; - treb_att: FLOAT; - mid_att: FLOAT; - bass_att: FLOAT; - progress: FLOAT; - frame: INT; - - { PER_FRAME CONSTANTS END } - - { PER_PIXEL CONSTANTS BEGIN } - - x_per_pixel: FLOAT; - y_per_pixel: FLOAT; - rad_per_pixel: FLOAT; - ang_per_pixel: FLOAT; - - { PER_PIXEL CONSTANT END } - - - fRating: FLOAT; - fGammaAdj: FLOAT; - fVideoEchoZoom: FLOAT; - fVideoEchoAlpha: FLOAT; - - nVideoEchoOrientation: INT; - nWaveMode: INT; - bAdditiveWaves: INT; - bWaveDots: INT; - bWaveThick: INT; - bModWaveAlphaByVolume: INT; - bMaximizeWaveColor: INT; - bTexWrap: INT; - bDarkenCenter: INT; - bRedBlueStereo: INT; - bBrighten: INT; - bDarken: INT; - bSolarize: INT; - bInvert: INT; - bMotionVectorsOn: INT; - fps: INT; - - fWaveAlpha: FLOAT; - fWaveScale: FLOAT; - fWaveSmoothing: FLOAT; - fWaveParam: FLOAT; - fModWaveAlphaStart: FLOAT; - fModWaveAlphaEnd: FLOAT; - fWarpAnimSpeed: FLOAT; - fWarpScale: FLOAT; - fShader: FLOAT; - - - { Q VARIABLES START } - - q1: FLOAT; - q2: FLOAT; - q3: FLOAT; - q4: FLOAT; - q5: FLOAT; - q6: FLOAT; - q7: FLOAT; - q8: FLOAT; - - - { Q VARIABLES END } - - zoom_mesh: PPFLOAT; - zoomexp_mesh: PPFLOAT; - rot_mesh: PPFLOAT; - - sx_mesh: PPFLOAT; - sy_mesh: PPFLOAT; - dx_mesh: PPFLOAT; - dy_mesh: PPFLOAT; - cx_mesh: PPFLOAT; - cy_mesh: PPFLOAT; - - x_mesh: PPFLOAT; - y_mesh: PPFLOAT; - rad_mesh: PPFLOAT; - theta_mesh: PPFLOAT; - end; - - { Functions } - procedure projectM_init(pm: PProjectM); cdecl; external libprojectM; - procedure projectM_reset(pm: PProjectM); cdecl; external libprojectM; - procedure projectM_resetGL(pm: PProjectM; width: INT; height: INT); cdecl; external libprojectM; - procedure projectM_setTitle(pm: PProjectM; title: PChar); cdecl; external libprojectM; - procedure renderFrame(pm: PProjectM); cdecl; external libprojectM; - - { - procedure draw_help(pm: PProjectM); cdecl; external libprojectM; - procedure draw_fps(pm: PProjectM; fps: Single); cdecl; external libprojectM; - procedure draw_preset(pm: PProjectM); cdecl; external libprojectM; - procedure draw_title(pm: PProjectM); cdecl; external libprojectM; - procedure draw_stats(pm: PProjectM); cdecl; external libprojectM; - - procedure modulate_opacity_by_volume(pm: PProjectM); cdecl; external libprojectM; - procedure maximize_colors(pm: PProjectM); cdecl; external libprojectM; - procedure do_per_pixel_math(pm: PProjectM); cdecl; external libprojectM; - procedure do_per_frame(pm: PProjectM); cdecl; external libprojectM; - procedure darken_center(pm: PProjectM); cdecl; external libprojectM; - - procedure render_interpolation(pm: PProjectM); cdecl; external libprojectM; - procedure render_texture_to_screen(pm: PProjectM); cdecl; external libprojectM; - procedure render_texture_to_studio(pm: PProjectM); cdecl; external libprojectM; - procedure draw_motion_vectors(pm: PProjectM); cdecl; external libprojectM; - procedure draw_borders(pm: PProjectM); cdecl; external libprojectM; - procedure draw_shapes(pm: PProjectM); cdecl; external libprojectM; - procedure draw_waveform(pm: PProjectM); cdecl; external libprojectM; - procedure draw_custom_waves(pm: PProjectM); cdecl; external libprojectM; - - procedure draw_title_to_screen(pm: PProjectM); cdecl; external libprojectM; - procedure draw_title_to_texture(pm: PProjectM); cdecl; external libprojectM; - procedure get_title(pm: PProjectM); cdecl; external libprojectM; - - procedure reset_per_pixel_matrices(pm: PProjectM); cdecl; external libprojectM; - procedure init_per_pixel_matrices(pm: PProjectM); cdecl; external libprojectM; - procedure rescale_per_pixel_matrices(pm: PProjectM); cdecl; external libprojectM; - } - - { PCM.h declarations } - procedure addPCMfloat(pcm_data: PSingle; samples: integer); cdecl; external libprojectM; - procedure addPCM16(pcm_data: PPCM16); cdecl; external libprojectM; - procedure addPCM16Data(pcm_data: PPCM16Data; samples: Smallint); cdecl; external libprojectM; - procedure addPCM8(pcm_data: PPCM8); cdecl; external libprojectM; - -implementation - -end. -- cgit v1.2.3 From 65cd744909a51e2c9adcfbd3bbbeee096b35b111 Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 17 Dec 2007 16:40:13 +0000 Subject: - faster preset switching - added projectM 1.0 support git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@715 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UVisualizer.pas | 761 +++++++++++++++++++------------------- 1 file changed, 378 insertions(+), 383 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UVisualizer.pas b/Game/Code/Classes/UVisualizer.pas index 6548e2b7..5fc4bb82 100644 --- a/Game/Code/Classes/UVisualizer.pas +++ b/Game/Code/Classes/UVisualizer.pas @@ -1,383 +1,378 @@ -{############################################################################ -# Visualizer support for UltraStar deluxe # -# # -# Created by hennymcc # -# Slight modifications by Jay Binks # -# based on UVideo.pas # -#############################################################################} - -unit UVisualizer; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -uses SDL, - UGraphicClasses, - textgl, - math, - OpenGL12, - SysUtils, - UIni, - {$ifdef DebugDisplay} - dialogs, - {$ENDIF} - projectM, - UMusic; - -implementation - -uses - UGraphic; - -var - singleton_VideoProjectM : IVideoPlayback; - -const - gx = 32; - gy = 24; - fps = 30; - texsize = 512; - visuals_Dir = 'Visuals'; // TODO: move this to a place common for all visualizers - projectM_Dir = visuals_Dir+'/projectM'; - -type - TVideoPlayback_ProjectM = class( TInterfacedObject, IVideoPlayback, IVideoVisualization ) - - pm : PProjectM; - - VisualizerStarted , - VisualizerPaused : Boolean; - - VisualTex : glUint; - PCMData : TPCMData; - hRC : Integer; - hDC : Integer; - - RndPCMcount : integer; - - procedure VisualizerStart; - procedure VisualizerStop; - - procedure VisualizerTogglePause; - - function GetRandomPCMData(var data: TPCMData): Cardinal; - public - constructor create(); - procedure init(); - function GetName: String; - - function Open( aFileName : string): boolean; // true if succeed - procedure Close; - - procedure Play; - procedure Pause; - procedure Stop; - - procedure MoveTo(Time: real); - function getPosition: real; - - procedure GetFrame(Time: Extended); - procedure DrawGL(Screen: integer); - end; - - -constructor TVideoPlayback_ProjectM.create(); -begin - RndPCMcount := 0; -end; - - -procedure TVideoPlayback_ProjectM.init(); -begin - VisualizerStarted := False; - VisualizerPaused := False; - - glGenTextures(1, PglUint(@VisualTex)); - glBindTexture(GL_TEXTURE_2D, VisualTex); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); -end; - -function TVideoPlayback_ProjectM.GetName: String; -begin - result := 'ProjectM'; -end; - - -function TVideoPlayback_ProjectM.Open( aFileName : string): boolean; // true if succeed -begin - VisualizerStart(); - result := true; -end; - -procedure TVideoPlayback_ProjectM.Close; -begin -end; - -procedure TVideoPlayback_ProjectM.Play; -begin - VisualizerStart(); -end; - -procedure TVideoPlayback_ProjectM.Pause; -begin - VisualizerTogglePause(); -end; - -procedure TVideoPlayback_ProjectM.Stop; -begin - VisualizerStop(); -end; - -procedure TVideoPlayback_ProjectM.MoveTo(Time: real); -begin - // this code MAY be able to be cut down... but Im not 100% sure.. - // in here, we cant realy move to a specific time, since its all random generated - // but a call to this function will change the preset, which changes the pattern - projectM_reset(pm); - - pm^.fullscreen := 0; - pm^.renderTarget^.texsize := texsize; - pm^.gx := gx; - pm^.gy := gy; - pm^.fps := fps; - pm^.renderTarget^.usePbuffers := 0; - - pm^.fontURL := PChar(projectM_Dir+'/fonts'); - pm^.presetURL := PChar(projectM_Dir+'/presets'); - - glPushAttrib(GL_ALL_ATTRIB_BITS); - projectM_init(pm); - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glMatrixMode(GL_TEXTURE); - glPushMatrix(); - - projectM_resetGL(pm, ScreenW, ScreenH); - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); - glMatrixMode(GL_TEXTURE); - glPopMatrix(); - glPopAttrib(); - -end; - -function TVideoPlayback_ProjectM.getPosition: real; -begin - result := 0; -end; - -procedure TVideoPlayback_ProjectM.VisualizerStart; -begin - VisualizerStarted := True; - - New(pm); - projectM_reset(pm); - - pm^.fullscreen := 0; - pm^.renderTarget^.texsize := texsize; - pm^.gx := gx; - pm^.gy := gy; - pm^.fps := fps; - pm^.renderTarget^.usePbuffers := 0; - - pm^.fontURL := PChar(projectM_Dir+'/fonts'); - pm^.presetURL := PChar(projectM_Dir+'/presets'); - - glPushAttrib(GL_ALL_ATTRIB_BITS); - projectM_init(pm); - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glMatrixMode(GL_TEXTURE); - glPushMatrix(); - - projectM_resetGL(pm, ScreenW, ScreenH); - - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); - glMatrixMode(GL_TEXTURE); - glPopMatrix(); - glPopAttrib(); -end; - -procedure TVideoPlayback_ProjectM.VisualizerStop; -begin - if VisualizerStarted then begin - VisualizerStarted := False; - Dispose(pm); - end; -end; - -procedure TVideoPlayback_ProjectM.VisualizerTogglePause; -begin - VisualizerPaused := not VisualizerPaused; -end; - -procedure TVideoPlayback_ProjectM.GetFrame(Time: Extended); -var - i: integer; - nSamples: cardinal; -begin - if not VisualizerStarted then Exit; - if VisualizerPaused then Exit; - - // get audio data - nSamples := AudioPlayback.GetPCMData(PcmData); - - if nSamples = 0 then - nSamples := GetRandomPCMData(PcmData); - - addPCM16Data(PPCM16Data(@PcmData), nSamples); - - // store OpenGL state (might be messed up otherwise) - glPushAttrib(GL_ALL_ATTRIB_BITS); - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glMatrixMode(GL_TEXTURE); - glPushMatrix(); - - // let projectM render a frame - try - renderFrame(pm); - except - // This happens with some presets... ( and only some times also .. moreso on linux ) - // if we have an "Invalid Floating Point Error" while rendering a frame... then change preset. - MoveTo( now ); - - // hmm have to be careful, that we dont get to many here... coz it could keep failing.. and trying again. - end; - glFlush(); - - {$IFDEF UseTexture} - glBindTexture(GL_TEXTURE_2D, VisualTex); - glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, VisualWidth, VisualHeight, 0); - {$ENDIF} - - // restore USDX OpenGL state - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); - glMatrixMode(GL_TEXTURE); - glPopMatrix(); - glPopAttrib(); - - // discard projectM's depth buffer information (avoid overlay) - glClear(GL_DEPTH_BUFFER_BIT); -end; - -procedure TVideoPlayback_ProjectM.DrawGL(Screen: integer); -begin - {$IFDEF UseTexture} - // have a nice black background to draw on (even if there were errors opening the vid) - if Screen=1 then begin - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - end; - // exit if there's nothing to draw - if not VisualizerStarted then Exit; - - // setup display - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - gluOrtho2D(0, 1, 0, 1); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); - - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glBindTexture(GL_TEXTURE_2D, VisualTex); - glColor4f(1, 1, 1, 1); - - // draw projectM frame - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(0, 0); - glTexCoord2f(1, 0); glVertex2f(1, 0); - glTexCoord2f(1, 1); glVertex2f(1, 1); - glTexCoord2f(0, 1); glVertex2f(0, 1); - glEnd(); - - { - glbegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(400-VisualWidth/2, 300-VisualHeight/2); - glTexCoord2f(0, 1); - glVertex2f(400-VisualWidth/2, 300+VisualHeight/2); - glTexCoord2f(1, 1); - glVertex2f(400+VisualWidth/2, 300+VisualHeight/2); - glTexCoord2f(1, 0); - glVertex2f(400+VisualWidth/2, 300-VisualHeight/2); - glEnd; - } - - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - // restore state - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); - {$ENDIF} -end; - -function TVideoPlayback_ProjectM.GetRandomPCMData(var data: TPCMData): Cardinal; -var - i: integer; -begin - // Produce some fake PCM data - if ( RndPCMcount mod 500 = 0 ) then - begin - for i := 0 to 511 do begin - data[0][i] := 0; - data[1][i] := 0; - end; - end - else begin - for i := 0 to 511 do begin - if ( i mod 2 = 0 ) then begin - data[0][i] := floor(Random * power(2.,14)); - data[1][i] := floor(Random * power(2.,14)); - end - else begin; - data[0][i] := floor(Random * power(2.,14)); - data[1][i] := floor(Random * power(2.,14)); - end; - if ( i mod 2 = 1 ) then begin - data[0][i] := -data[0][i]; - data[1][i] := -data[1][i]; - end; - end; - end; - Inc( RndPCMcount ); - result := 512; -end; - - -initialization - singleton_VideoProjectM := TVideoPlayback_ProjectM.create(); - AudioManager.add( singleton_VideoProjectM ); - -finalization - AudioManager.Remove( singleton_VideoProjectM ); - - - -end. +{############################################################################ +# Visualizer support for UltraStar deluxe # +# # +# Created by hennymcc # +# Slight modifications by Jay Binks # +# based on UVideo.pas # +#############################################################################} + +unit UVisualizer; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +{$I switches.inc} + +uses + SDL, + UGraphicClasses, + textgl, + math, + OpenGL12, + SysUtils, + UIni, + {$ifdef DebugDisplay} + {$ifdef win32} + dialogs, + {$endif} + {$endif} + projectM, + UMusic; + +implementation + +uses + UGraphic, + ULog; + +var + singleton_VideoProjectM : IVideoPlayback; + +const + gx = 32; + gy = 24; + fps = 30; + texsize = 512; + visualsDir = 'Visuals'; // TODO: move this to a place common for all visualizers + projectMDir = visualsDir+'/projectM'; + presetsDir = projectMDir+'/presets'; + fontsDir = projectMDir+'/fonts'; + +type + TVideoPlayback_ProjectM = class( TInterfacedObject, IVideoPlayback, IVideoVisualization ) + private + pm : TProjectM; + + VisualizerStarted , + VisualizerPaused : Boolean; + + VisualTex : glUint; + PCMData : TPCMData; + hRC : Integer; + hDC : Integer; + + RndPCMcount : integer; + + projMatrix: array[0..3, 0..3] of GLdouble; + texMatrix: array[0..3, 0..3] of GLdouble; + + procedure VisualizerStart; + procedure VisualizerStop; + + procedure VisualizerTogglePause; + + function GetRandomPCMData(var data: TPCMData): Cardinal; + + procedure SaveOpenGLState(); + procedure RestoreOpenGLState(); + + public + constructor create(); + procedure init(); + function GetName: String; + + function Open( aFileName : string): boolean; // true if succeed + procedure Close; + + procedure Play; + procedure Pause; + procedure Stop; + + procedure MoveTo(Time: real); + function getPosition: real; + + procedure GetFrame(Time: Extended); + procedure DrawGL(Screen: integer); + end; + + +constructor TVideoPlayback_ProjectM.create(); +begin + RndPCMcount := 0; +end; + + +procedure TVideoPlayback_ProjectM.init(); +begin + VisualizerStarted := False; + VisualizerPaused := False; + + {$IFDEF UseTexture} + glGenTextures(1, PglUint(@VisualTex)); + glBindTexture(GL_TEXTURE_2D, VisualTex); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + {$ENDIF} +end; + +function TVideoPlayback_ProjectM.GetName: String; +begin + result := 'ProjectM'; +end; + + +function TVideoPlayback_ProjectM.Open( aFileName : string): boolean; // true if succeed +begin + VisualizerStart(); + result := true; +end; + +procedure TVideoPlayback_ProjectM.Close; +begin +end; + +procedure TVideoPlayback_ProjectM.Play; +begin + VisualizerStart(); +end; + +procedure TVideoPlayback_ProjectM.Pause; +begin + VisualizerTogglePause(); +end; + +procedure TVideoPlayback_ProjectM.Stop; +begin + VisualizerStop(); +end; + +procedure TVideoPlayback_ProjectM.MoveTo(Time: real); +begin + pm.RandomPreset(); +end; + +function TVideoPlayback_ProjectM.getPosition: real; +begin + result := 0; +end; + +procedure TVideoPlayback_ProjectM.SaveOpenGLState(); +begin + // save all OpenGL state-machine attributes + glPushAttrib(GL_ALL_ATTRIB_BITS); + + // save projection-matrix + glMatrixMode(GL_PROJECTION); + // - WARNING: projection-matrix stack-depth is only 2! + // -> overflow might occur if glPopMatrix() is used for this matrix + // -> use glGet() instead of glPushMatrix() + glPushMatrix(); + //glGetDoublev(GL_PROJECTION_MATRIX, @projMatrix); + + // save texture-matrix + glMatrixMode(GL_TEXTURE); + // - WARNING: texture-matrix stack-depth is only 2! + // -> overflow might occur if glPopMatrix() is used for this matrix + // -> use glGet() instead of glPushMatrix() if problems appear + glPushMatrix(); + //glGetDoublev(GL_TEXTURE_MATRIX, @texMatrix); + + // save modelview-matrix + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); +end; + +procedure TVideoPlayback_ProjectM.RestoreOpenGLState(); +begin + // restore projection-matrix + glMatrixMode(GL_PROJECTION); + // - WARNING: projection-matrix stack-depth is only 2! + // -> overflow _occurs_ if glPopMatrix() is used for this matrix + // -> use glLoadMatrix() instead of glPopMatrix() + glPopMatrix(); + //glLoadMatrixd(@projMatrix); + + // restore texture-matrix + // -> overflow might occur if glPopMatrix() is used for this matrix + glMatrixMode(GL_TEXTURE); + glPopMatrix(); + //glLoadMatrixd(@texMatrix); + + // restore modelview-matrix + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + + // restore all OpenGL state-machine attributes + glPopAttrib(); +end; + +procedure TVideoPlayback_ProjectM.VisualizerStart; +var + initResult: Cardinal; +begin + VisualizerStarted := True; + + pm := TProjectM.Create(gx, gy, fps, texsize, ScreenW, ScreenH, + presetsDir, fontsDir); + //initResult := projectM_initRenderToTexture(pm); + + SaveOpenGLState(); + pm.ResetGL(ScreenW, ScreenH); + RestoreOpenGLState(); +end; + +procedure TVideoPlayback_ProjectM.VisualizerStop; +begin + if VisualizerStarted then begin + VisualizerStarted := False; + pm.Free(); + end; +end; + +procedure TVideoPlayback_ProjectM.VisualizerTogglePause; +begin + VisualizerPaused := not VisualizerPaused; +end; + +procedure TVideoPlayback_ProjectM.GetFrame(Time: Extended); +var + i: integer; + nSamples: cardinal; + stackDepth: Integer; +begin + if not VisualizerStarted then Exit; + if VisualizerPaused then Exit; + + // get audio data + nSamples := AudioPlayback.GetPCMData(PcmData); + + if nSamples = 0 then + nSamples := GetRandomPCMData(PcmData); + + pm.AddPCM16Data(PSmallint(@PcmData), nSamples); + + // store OpenGL state (might be messed up otherwise) + SaveOpenGLState(); + pm.ResetGL(ScreenW, ScreenH); + + //glGetIntegerv(GL_PROJECTION_STACK_DEPTH, @stackDepth); + //writeln('StackDepth0: ' + inttostr(stackDepth)); + + // let projectM render a frame + try + pm.RenderFrame(); + except + // this may happen with some presets ( on linux ) if there is a div by zero + // in projectM's getBeatVals() function (file: beat_detect.cc) + Log.LogStatus('Div by zero!', 'Visualizer'); + MoveTo( now ); + end; + + //glGetIntegerv(GL_PROJECTION_STACK_DEPTH, @stackDepth); + //writeln('StackDepth1: ' + inttostr(stackDepth)); + + {$IFDEF UseTexture} + glBindTexture(GL_TEXTURE_2D, VisualTex); + glFlush(); + glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, VisualWidth, VisualHeight, 0); + {$ENDIF} + + // restore USDX OpenGL state + RestoreOpenGLState(); + + // discard projectM's depth buffer information (avoid overlay) + glClear(GL_DEPTH_BUFFER_BIT); +end; + +procedure TVideoPlayback_ProjectM.DrawGL(Screen: integer); +begin + {$IFDEF UseTexture} + // have a nice black background to draw on (even if there were errors opening the vid) + if Screen=1 then begin + glClearColor(0, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end; + // exit if there's nothing to draw + if not VisualizerStarted then Exit; + + // setup display + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + gluOrtho2D(0, 1, 0, 1); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + glBindTexture(GL_TEXTURE_2D, VisualTex); + glColor4f(1, 1, 1, 1); + + // draw projectM frame + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(0, 0); + glTexCoord2f(1, 0); glVertex2f(1, 0); + glTexCoord2f(1, 1); glVertex2f(1, 1); + glTexCoord2f(0, 1); glVertex2f(0, 1); + glEnd(); + + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // restore state + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + {$ENDIF} +end; + +function TVideoPlayback_ProjectM.GetRandomPCMData(var data: TPCMData): Cardinal; +var + i: integer; +begin + // Produce some fake PCM data + if ( RndPCMcount mod 500 = 0 ) then + begin + for i := 0 to 511 do begin + data[0][i] := 0; + data[1][i] := 0; + end; + end + else begin + for i := 0 to 511 do begin + if ( i mod 2 = 0 ) then begin + data[0][i] := floor(Random * power(2.,14)); + data[1][i] := floor(Random * power(2.,14)); + end + else begin; + data[0][i] := floor(Random * power(2.,14)); + data[1][i] := floor(Random * power(2.,14)); + end; + if ( i mod 2 = 1 ) then begin + data[0][i] := -data[0][i]; + data[1][i] := -data[1][i]; + end; + end; + end; + Inc( RndPCMcount ); + result := 512; +end; + + +initialization + singleton_VideoProjectM := TVideoPlayback_ProjectM.create(); + AudioManager.add( singleton_VideoProjectM ); + +finalization + AudioManager.Remove( singleton_VideoProjectM ); + + + +end. -- cgit v1.2.3 From bb9941b08dda865d2f882e505b4417f37c87ca0c Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 17 Dec 2007 16:43:27 +0000 Subject: allows switching between projectm 0.9/1.0 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@716 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/switches.inc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index 540ba068..84aebbf5 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -39,7 +39,7 @@ //{$DEFINE UsePortaudio} //{$DEFINE UsePortmixer} - {$DEFINE UseProjectM} + {$DEFINE UseProjectM_0_9} {$IFDEF DEBUG} {$IFNDEF DARWIN} @@ -49,9 +49,14 @@ {$ELSE} //{$DEFINE FFMpegAudio} // {$DEFINE UsePortaudio} - {$DEFINE UseProjectM} + {$DEFINE UseProjectM_0_9} {$ENDIF} {$IF Defined(UseBASSInput) or Defined(UseBASSOutput)} {$DEFINE UseBASS} {$IFEND} + +{$IF Defined(UseProjectM_0_9) or Defined(UseProjectM_1_0)} + {$DEFINE UseProjectM} +{$IFEND} + -- cgit v1.2.3 From 96407b5adf8eb1b9ff5e3838a70158d7d3aa29fd Mon Sep 17 00:00:00 2001 From: b1indy Date: Mon, 17 Dec 2007 17:52:42 +0000 Subject: swscale experiment was not satisfying (bad performance), but made clear, that there was unnecessary copying done in GetFrame. UVideo.pas will need some more cleanup but should work better than before. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@717 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UVideo.pas | 81 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 65 insertions(+), 16 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index 94c8d7ab..42971daf 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -14,7 +14,6 @@ unit UVideo; //{$define DebugFrames} //{$define Info} - interface {$IFDEF FPC} @@ -38,6 +37,7 @@ uses SDL, avcodec, avformat, avutil, +// swscale, math, OpenGL12, SysUtils, @@ -50,7 +50,8 @@ uses SDL, UAudio_FFMpeg, {$endif} UIni, - UMusic; + UMusic, + UGraphic; var @@ -65,6 +66,7 @@ type fVideoTex : glUint; fVideoSkipTime : Single; + //remove fTexData : array of Byte; VideoFormatContext: PAVFormatContext; @@ -77,6 +79,8 @@ type AVFrameRGB: PAVFrame; myBuffer: pByte; +// SoftwareScaleContext: PSwsContext; + TexX, TexY, dataX, dataY: Cardinal; ScaledVideoWidth, ScaledVideoHeight: Real; @@ -107,13 +111,13 @@ type function getPosition: real; procedure GetFrame(Time: Extended); - procedure DrawGL(Screen: integer); + procedure DrawGL(Screen: integer); end; const SDL_AUDIO_BUFFER_SIZE = 1024; - + {$ifdef DebugDisplay} //{$ifNdef win32} @@ -165,7 +169,7 @@ begin begin writeln( ' aFormatCtx.streams[i] : ' + inttostr( i ) ); st := aFormatCtx.streams[i]; - + if(st.codec.codec_type = CODEC_TYPE_VIDEO ) AND (aFirstVideoStream < 0) THEN begin @@ -177,10 +181,10 @@ begin begin aFirstAudioStream := i; end; - + inc( i ); end; // while - + result := (aFirstAudioStream > -1) OR (aFirstVideoStream > -1) ; // Didn't find a video stream end; @@ -327,10 +331,22 @@ begin PAVPicture(AVFrame), VideoCodecContext^.pix_fmt, VideoCodecContext^.width, VideoCodecContext^.height); //errnum:=1; - +{ + writeln('swscontext->srcH='+inttostr(SoftwareScaleContext^.srcH)); + writeln('swscontext->dstH='+inttostr(SoftwareScaleContext^.dstH)); + writeln('swscontext->slicedir='+inttostr(SoftwareScaleContext^.slicedir)); + errnum:=sws_scale(SoftwareScaleContext,@(AVFrame.data),@(AVFrame.linesize), + 0,VideoCodecContext^.Height, + @(AVFrameRGB.data),@(AVFrameRGB.linesize)); + writeln('errnum='+inttostr(errnum)); +} if errnum >=0 then begin - // copy RGB pixeldata to our TextureBuffer + glBindTexture(GL_TEXTURE_2D, fVideoTex); + glTexImage2D(GL_TEXTURE_2D, 0, 3, dataX, dataY, 0, GL_RGB, GL_UNSIGNED_BYTE, AVFrameRGB^.data[0]); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); +(* // copy RGB pixeldata to our TextureBuffer // (line by line) FrameDataPtr := pointer( AVFrameRGB^.data[0] ); @@ -345,6 +361,7 @@ begin glTexImage2D(GL_TEXTURE_2D, 0, 3, dataX, dataY, 0, GL_RGB, GL_UNSIGNED_BYTE, fTexData); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); +*) {$ifdef DebugFrames} //frame decode debug display GoldenRec.Spawn(200,35,1,16,0,-1,ColoredStar,$ffff00); @@ -436,6 +453,8 @@ var spec : TSDL_AudioSpec; aCodec : pAVCodec; + sws_dst_w, sws_dst_h: Integer; + begin fVideoOpened := False; fVideoPaused := False; @@ -474,7 +493,7 @@ begin if( av_find_stream_info(VideoFormatContext) >= 0 ) then begin find_stream_ids( VideoFormatContext, VideoStreamIndex, AudioStreamIndex ); - + writeln( 'VideoStreamIndex : ' + inttostr(VideoStreamIndex) ); writeln( 'AudioStreamIndex : ' + inttostr(AudioStreamIndex) ); end; @@ -541,7 +560,7 @@ begin Exit; end; - + if(VideoCodec<>Nil) then begin errnum:=avcodec_open(VideoCodecContext, VideoCodec); @@ -555,6 +574,13 @@ begin end; if(errnum >=0) then begin + if (VideoCodecContext^.width >1024) or (VideoCodecContext^.height >1024) then + begin + ScreenPopupError.ShowPopup('Video dimensions\nmust not exceed\n1024 pixels\n\nvideo disabled'); //show error message + avcodec_close(VideoCodecContext); + av_close_input_file(VideoFormatContext); + Exit; + end; {$ifdef DebugDisplay} showmessage('Found a matching Codec: '+ VideoCodecContext^.Codec.Name +#13#10#13#10+ ' Width = '+inttostr(VideoCodecContext^.width)+ ', Height='+inttostr(VideoCodecContext^.height)+#13#10+ @@ -565,24 +591,47 @@ begin AVFrame:=avcodec_alloc_frame; AVFrameRGB:=avcodec_alloc_frame; end; + + dataX := Round(Power(2, Ceil(Log2(VideoCodecContext^.width)))); + dataY := Round(Power(2, Ceil(Log2(VideoCodecContext^.height)))); myBuffer:=Nil; if(AVFrame <> Nil) and (AVFrameRGB <> Nil) then begin - myBuffer:=av_malloc(avpicture_get_size(PIX_FMT_RGB24, VideoCodecContext^.width, - VideoCodecContext^.height)); + myBuffer:=av_malloc(avpicture_get_size(PIX_FMT_RGB24, dataX, dataY)); +// myBuffer:=av_malloc(avpicture_get_size(PIX_FMT_RGB24, VideoCodecContext^.width, VideoCodecContext^.height)); end; if myBuffer <> Nil then errnum:=avpicture_fill(PAVPicture(AVFrameRGB), myBuffer, PIX_FMT_RGB24, - VideoCodecContext^.width, VideoCodecContext^.height) +// VideoCodecContext^.width, VideoCodecContext^.height) + dataX, dataY) else begin -{$ifdef DebugDisplay} + {$ifdef DebugDisplay} showmessage('failed to allocate video buffer'); -{$endif} + {$endif} av_free(AVFrameRGB); av_free(AVFrame); avcodec_close(VideoCodecContext); av_close_input_file(VideoFormatContext); Exit; end; +{ + writeln('trying to get sws context: '+inttostr(VideoCodecContext^.width)+'x'+ + inttostr(VideoCodecContext^.height)+' -> '+inttostr(dataX)+'x'+inttostr(dataY)); + SoftwareScaleContext:=Nil; + SoftwareScaleContext:=sws_getContext(VideoCodecContext^.width,VideoCodecContext^.height,integer(VideoCodecContext^.pix_fmt), + dataX, dataY, integer(PIX_FMT_RGB24), + SWS_FAST_BILINEAR, 0, 0, 0); + if SoftwareScaleContext <> Nil then + writeln('got swscale context') + else begin + writeln('ERROR: didn´t get swscale context'); + av_free(AVFrameRGB); + av_free(AVFrame); + avcodec_close(VideoCodecContext); + av_close_input_file(VideoFormatContext); + Exit; + end; +} + // this is the errnum from avpicture_fill if errnum >=0 then begin fVideoOpened:=True; -- cgit v1.2.3 From 8056eb8ad82f956ca257d44274b26760110bc567 Mon Sep 17 00:00:00 2001 From: b1indy Date: Mon, 17 Dec 2007 17:54:35 +0000 Subject: swscale back to the way it should be (works, but is too slow for video scaling) if we need to scale textures it might be worth a try git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@718 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/ffmpeg/swscale.pas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/lib/ffmpeg/swscale.pas b/Game/Code/lib/ffmpeg/swscale.pas index 83aabb12..a1bbf04f 100644 --- a/Game/Code/lib/ffmpeg/swscale.pas +++ b/Game/Code/lib/ffmpeg/swscale.pas @@ -145,11 +145,11 @@ type procedure sws_freeContext(swsContext: PSwsContext); cdecl; external sw__scale; -function sws_getContext(srcW: integer; srcH: integer; srcFormat: TAVPixelFormat; dstW: integer; dstH: integer;dstFormat: TAVPixelFormat; flags: integer; +function sws_getContext(srcW: integer; srcH: integer; srcFormat: integer; dstW: integer; dstH: integer;dstFormat: integer; flags: integer; srcFilter: PSwsFilter; dstFilter: PSwsFilter; param: Pdouble): PSwsContext; cdecl; external sw__scale; -function sws_scale(context: PSwsContext; src: {PPByteArray}array of pbyte; srcStride: {PIntArray} array of integer; srcSliceY: integer; srcSliceH: integer; - dst: {PPByteArray} array of pbyte; dstStride: {PIntArray}array of integer): integer; +function sws_scale(context: PSwsContext; src: PPByteArray; srcStride: PIntArray; srcSliceY: integer; srcSliceH: integer; + dst: PPByteArray; dstStride: PIntArray): integer; cdecl; external sw__scale; function sws_scale_ordered(context: PSwsContext; src: PPByteArray; srcStride: PIntArray; srcSliceY: integer; srcSliceH: integer; dst: PPByteArray; dstStride: PIntArray): integer; -- cgit v1.2.3 From bbda88716432ec68fd686438d291b41f918dc4af Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 18 Dec 2007 02:25:24 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@719 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMain.pas | 7 +- Game/Code/UltraStar.dpr | 432 ++++++++++++++++++++++---------------------- 2 files changed, 221 insertions(+), 218 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index b97408d4..18bed197 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -358,8 +358,11 @@ begin //------------------------------ //Finish Application //------------------------------ - if Ini.LPT = 1 then LCD.Clear; - if Ini.LPT = 2 then Light.TurnOff; + + {$ifdef WIN32} + if Ini.LPT = 1 then LCD.Clear; + if Ini.LPT = 2 then Light.TurnOff; + {$endif} Log.LogStatus('Main Loop', 'Finished'); Log.Free; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 9ba415bc..b442b3bc 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -1,216 +1,216 @@ -{$IFNDEF FPC} // This is here, so linux & MacOS X Versions can simply include the uses - // from the dpr. Saves dupicating the uses clause. -program UltraStar; - - {$R 'UltraStar.res' 'UltraStar.rc'} - {$I switches.inc} - -uses -{$ENDIF} - - //------------------------------ - //Includes - 3rd Party Libraries - //------------------------------ - moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', - opengl12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\opengl12.pas', - sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', - sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', - sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', - sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', - - {$ifdef UseBass} - bass in 'lib\bass\delphi\bass.pas', - {$endif} - {$ifdef UsePortAudio} - portaudio in 'lib\portaudio\delphi\portaudio.pas', - {$endif} - {$ifdef UsePortmixer} - portmixer in 'lib\portmixer\delphi\portmixer.pas', - {$endif} - - {$ifdef delphi} - midiout in 'lib\midi\midiout.pas', - midiin in 'lib\midi\midiin.pas', - CIRCBUF in 'lib\midi\CIRCBUF.PAS', - MidiType in 'lib\midi\MidiType.PAS', - MidiDefs in 'lib\midi\MidiDefs.PAS', - MidiCons in 'lib\midi\MidiCons.PAS', - MidiFile in 'lib\midi\MidiFile.PAS', - Delphmcb in 'lib\midi\Delphmcb.PAS', - - DirWatch in 'lib\other\DirWatch.pas', - {$endif} - - avcodec in 'lib\ffmpeg\avcodec.pas', - avformat in 'lib\ffmpeg\avformat.pas', - avutil in 'lib\ffmpeg\avutil.pas', - rational in 'lib\ffmpeg\rational.pas', - opt in 'lib\ffmpeg\opt.pas', - avio in 'lib\ffmpeg\avio.pas', - swscale in 'lib\ffmpeg\swscale.pas', - - {$ifdef UseProjectM_0_9} - projectM in 'lib\projectM\0.9\projectM.pas', - {$endif} - {$ifdef UseProjectM_1_0} - projectM in 'lib\projectM\1.0\projectM.pas', - {$endif} - - SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', - SQLite3 in 'lib\SQLite\SQLite3.pas', - - - //------------------------------ - //Includes - Menu System - //------------------------------ - UDisplay in 'Menu\UDisplay.pas', - UMenu in 'Menu\UMenu.pas', - UMenuStatic in 'Menu\UMenuStatic.pas', - UMenuText in 'Menu\UMenuText.pas', - UMenuButton in 'Menu\UMenuButton.pas', - UMenuInteract in 'Menu\UMenuInteract.pas', - UMenuSelect in 'Menu\UMenuSelect.pas', - UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', - UDrawTexture in 'Menu\UDrawTexture.pas', - UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', - - //------------------------------ - //Includes - Classes - //------------------------------ - UCommon in 'Classes\UCommon.pas', - UGraphic in 'Classes\UGraphic.pas', - UTexture in 'Classes\UTexture.pas', - ULanguage in 'Classes\ULanguage.pas', - UMain in 'Classes\UMain.pas', - UDraw in 'Classes\UDraw.pas', - URecord in 'Classes\URecord.pas', - UTime in 'Classes\UTime.pas', - TextGL in 'Classes\TextGL.pas', - USongs in 'Classes\USongs.pas', - UIni in 'Classes\UIni.pas', - ULyrics in 'Classes\ULyrics.pas', - ULyrics_bak in 'Classes\ULyrics_bak.pas', - USkins in 'Classes\USkins.pas', - UThemes in 'Classes\UThemes.pas', - ULog in 'Classes\ULog.pas', - UJoystick in 'Classes\UJoystick.pas', - ULCD in 'Classes\ULCD.pas', - ULight in 'Classes\ULight.pas', - UDataBase in 'Classes\UDataBase.pas', - UCovers in 'Classes\UCovers.pas', - UCatCovers in 'Classes\UCatCovers.pas', - UFiles in 'Classes\UFiles.pas', - UGraphicClasses in 'Classes\UGraphicClasses.pas', - UDLLManager in 'Classes\UDLLManager.pas', - UPlaylist in 'Classes\UPlaylist.pas', - UCommandLine in 'Classes\UCommandLine.pas', - UTextClasses in 'Classes\UTextClasses.pas', - USingScores in 'Classes\USingScores.pas', - USingNotes in 'Classes\USingNotes.pas', - - UModules in 'Classes\UModules.pas', //List of Modules to Load - UHooks in 'Classes\UHooks.pas', //Hook Managing - UServices in 'Classes\UServices.pas', //Service Managing - UCore in 'Classes\UCore.pas', //Core, Maybe remove this - UCoreModule in 'Classes\UCoreModule.pas', //^ - UPluginInterface in 'Classes\UPluginInterface.pas', //Interface offered by Core to Plugins - uPluginLoader in 'Classes\uPluginLoader.pas', //New Plugin Loader Module - - UParty in 'Classes\UParty.pas', // to - do : rewrite Party Manager as Module, reomplent ability to offer party Mody by Plugin - UPlatform in 'Classes\UPlatform.pas', -{$IFDEF WIN32} - UPlatformWindows in 'Classes\UPlatformWindows.pas', -{$ENDIF} -{$IFDEF LINUX} - UPlatformLinux in 'Classes\UPlatformLinux.pas', -{$ENDIF} - -{$IFDEF FPC} - ulazjpeg in 'Classes\Ulazjpeg.pas', -{$ENDIF} - - - //------------------------------ - //Includes - Media support classes.... - // Make sure UMedia always first, then UMedia_dummy - //------------------------------ - - // TODO : these all need to be renamed like UMedia_******** for consistency - UMusic in 'Classes\UMusic.pas', - UMedia_dummy in 'Classes\UMedia_dummy.pas', // Must be first UMedia Unit, all others will override available interfaces -{$IFDEF UseProjectM} - UVisualizer in 'Classes\UVisualizer.pas', // MUST be before Video... so video can override... -{$ENDIF} - UVideo in 'Classes\UVideo.pas', -{$ifdef UseBass} - UAudio_bass in 'Classes\UAudio_bass.pas', -{$endif} -{$ifdef UsePortaudio} - UAudio_portaudio in 'Classes\UAudio_portaudio.pas', -{$endif} -{$ifdef UseFFMpegAudio} - UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', -{$endif} - - - //------------------------------ - //Includes - Screens - //------------------------------ - UScreenLoading in 'Screens\UScreenLoading.pas', - UScreenWelcome in 'Screens\UScreenWelcome.pas', - UScreenMain in 'Screens\UScreenMain.pas', - UScreenName in 'Screens\UScreenName.pas', - UScreenLevel in 'Screens\UScreenLevel.pas', - UScreenSong in 'Screens\UScreenSong.pas', - UScreenSing in 'Screens\UScreenSing.pas', - UScreenScore in 'Screens\UScreenScore.pas', - UScreenOptions in 'Screens\UScreenOptions.pas', - UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', - UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', - UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', - UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', - UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', - UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', - UScreenOptionsAdvanced in 'Screens\UScreenOptionsAdvanced.pas', - UScreenEditSub in 'Screens\UScreenEditSub.pas', - UScreenEdit in 'Screens\UScreenEdit.pas', - UScreenEditConvert in 'Screens\UScreenEditConvert.pas', - UScreenEditHeader in 'Screens\UScreenEditHeader.pas', - UScreenOpen in 'Screens\UScreenOpen.pas', - UScreenTop5 in 'Screens\UScreenTop5.pas', - UScreenSongMenu in 'Screens\UScreenSongMenu.pas', - UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', - UScreenStatMain in 'Screens\UScreenStatMain.pas', - UScreenStatDetail in 'Screens\UScreenStatDetail.pas', - UScreenCredits in 'Screens\UScreenCredits.pas', - UScreenPopup in 'Screens\UScreenPopup.pas', - - //Includes - Screens PartyMode - UScreenSingModi in 'Screens\UScreenSingModi.pas', - UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', - UScreenPartyScore in 'Screens\UScreenPartyScore.pas', - UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', - UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', - UScreenPartyWin in 'Screens\UScreenPartyWin.pas', - - - //------------------------------ - //Includes - Modi SDK - //------------------------------ - ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', //Old SDK, will be deleted soon - UPluginDefs in '..\..\Modis\SDK\UPluginDefs.pas', //New SDK, not only Modis - UPartyDefs in '..\..\Modis\SDK\UPartyDefs.pas', //Headers to register Party Modes - - {$IFDEF win32} - Windows, - {$ENDIF} - SysUtils; - -const - Version = 'UltraStar Deluxe V 1.10 Alpha Build'; - -{$IFNDEF FPC} -begin - Main; -end. -{$ENDIF} +{$IFNDEF FPC} // This is here, so linux & MacOS X Versions can simply include the uses + // from the dpr. Saves dupicating the uses clause. +program UltraStar; + + {$R 'UltraStar.res' 'UltraStar.rc'} + {$I switches.inc} + +uses +{$ENDIF} + + //------------------------------ + //Includes - 3rd Party Libraries + //------------------------------ + moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', + opengl12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\opengl12.pas', + sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', + sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', + sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', + sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', + + {$ifdef UseBass} + bass in 'lib\bass\delphi\bass.pas', + {$endif} + {$ifdef UsePortAudio} + portaudio in 'lib\portaudio\delphi\portaudio.pas', + {$endif} + {$ifdef UsePortmixer} + portmixer in 'lib\portmixer\delphi\portmixer.pas', + {$endif} + + {$ifdef delphi} + midiout in 'lib\midi\midiout.pas', + midiin in 'lib\midi\midiin.pas', + CIRCBUF in 'lib\midi\CIRCBUF.PAS', + MidiType in 'lib\midi\MidiType.PAS', + MidiDefs in 'lib\midi\MidiDefs.PAS', + MidiCons in 'lib\midi\MidiCons.PAS', + MidiFile in 'lib\midi\MidiFile.PAS', + Delphmcb in 'lib\midi\Delphmcb.PAS', + + DirWatch in 'lib\other\DirWatch.pas', + {$endif} + + avcodec in 'lib\ffmpeg\avcodec.pas', + avformat in 'lib\ffmpeg\avformat.pas', + avutil in 'lib\ffmpeg\avutil.pas', + rational in 'lib\ffmpeg\rational.pas', + opt in 'lib\ffmpeg\opt.pas', + avio in 'lib\ffmpeg\avio.pas', +// swscale in 'lib\ffmpeg\swscale.pas', + + {$ifdef UseProjectM_0_9} + projectM in 'lib\projectM\0.9\projectM.pas', + {$endif} + {$ifdef UseProjectM_1_0} + projectM in 'lib\projectM\1.0\projectM.pas', + {$endif} + + SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', + SQLite3 in 'lib\SQLite\SQLite3.pas', + + + //------------------------------ + //Includes - Menu System + //------------------------------ + UDisplay in 'Menu\UDisplay.pas', + UMenu in 'Menu\UMenu.pas', + UMenuStatic in 'Menu\UMenuStatic.pas', + UMenuText in 'Menu\UMenuText.pas', + UMenuButton in 'Menu\UMenuButton.pas', + UMenuInteract in 'Menu\UMenuInteract.pas', + UMenuSelect in 'Menu\UMenuSelect.pas', + UMenuSelectSlide in 'Menu\UMenuSelectSlide.pas', + UDrawTexture in 'Menu\UDrawTexture.pas', + UMenuButtonCollection in 'Menu\UMenuButtonCollection.pas', + + //------------------------------ + //Includes - Classes + //------------------------------ + UCommon in 'Classes\UCommon.pas', + UGraphic in 'Classes\UGraphic.pas', + UTexture in 'Classes\UTexture.pas', + ULanguage in 'Classes\ULanguage.pas', + UMain in 'Classes\UMain.pas', + UDraw in 'Classes\UDraw.pas', + URecord in 'Classes\URecord.pas', + UTime in 'Classes\UTime.pas', + TextGL in 'Classes\TextGL.pas', + USongs in 'Classes\USongs.pas', + UIni in 'Classes\UIni.pas', + ULyrics in 'Classes\ULyrics.pas', + ULyrics_bak in 'Classes\ULyrics_bak.pas', + USkins in 'Classes\USkins.pas', + UThemes in 'Classes\UThemes.pas', + ULog in 'Classes\ULog.pas', + UJoystick in 'Classes\UJoystick.pas', + ULCD in 'Classes\ULCD.pas', + ULight in 'Classes\ULight.pas', + UDataBase in 'Classes\UDataBase.pas', + UCovers in 'Classes\UCovers.pas', + UCatCovers in 'Classes\UCatCovers.pas', + UFiles in 'Classes\UFiles.pas', + UGraphicClasses in 'Classes\UGraphicClasses.pas', + UDLLManager in 'Classes\UDLLManager.pas', + UPlaylist in 'Classes\UPlaylist.pas', + UCommandLine in 'Classes\UCommandLine.pas', + UTextClasses in 'Classes\UTextClasses.pas', + USingScores in 'Classes\USingScores.pas', + USingNotes in 'Classes\USingNotes.pas', + + UModules in 'Classes\UModules.pas', //List of Modules to Load + UHooks in 'Classes\UHooks.pas', //Hook Managing + UServices in 'Classes\UServices.pas', //Service Managing + UCore in 'Classes\UCore.pas', //Core, Maybe remove this + UCoreModule in 'Classes\UCoreModule.pas', //^ + UPluginInterface in 'Classes\UPluginInterface.pas', //Interface offered by Core to Plugins + uPluginLoader in 'Classes\uPluginLoader.pas', //New Plugin Loader Module + + UParty in 'Classes\UParty.pas', // to - do : rewrite Party Manager as Module, reomplent ability to offer party Mody by Plugin + UPlatform in 'Classes\UPlatform.pas', +{$IFDEF WIN32} + UPlatformWindows in 'Classes\UPlatformWindows.pas', +{$ENDIF} +{$IFDEF LINUX} + UPlatformLinux in 'Classes\UPlatformLinux.pas', +{$ENDIF} + +{$IFDEF FPC} + ulazjpeg in 'Classes\Ulazjpeg.pas', +{$ENDIF} + + + //------------------------------ + //Includes - Media support classes.... + // Make sure UMedia always first, then UMedia_dummy + //------------------------------ + + // TODO : these all need to be renamed like UMedia_******** for consistency + UMusic in 'Classes\UMusic.pas', + UMedia_dummy in 'Classes\UMedia_dummy.pas', // Must be first UMedia Unit, all others will override available interfaces +{$IFDEF UseProjectM} + UVisualizer in 'Classes\UVisualizer.pas', // MUST be before Video... so video can override... +{$ENDIF} + UVideo in 'Classes\UVideo.pas', +{$ifdef UseBass} + UAudio_bass in 'Classes\UAudio_bass.pas', +{$endif} +{$ifdef UsePortaudio} + UAudio_portaudio in 'Classes\UAudio_portaudio.pas', +{$endif} +{$ifdef UseFFMpegAudio} + UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', +{$endif} + + + //------------------------------ + //Includes - Screens + //------------------------------ + UScreenLoading in 'Screens\UScreenLoading.pas', + UScreenWelcome in 'Screens\UScreenWelcome.pas', + UScreenMain in 'Screens\UScreenMain.pas', + UScreenName in 'Screens\UScreenName.pas', + UScreenLevel in 'Screens\UScreenLevel.pas', + UScreenSong in 'Screens\UScreenSong.pas', + UScreenSing in 'Screens\UScreenSing.pas', + UScreenScore in 'Screens\UScreenScore.pas', + UScreenOptions in 'Screens\UScreenOptions.pas', + UScreenOptionsGame in 'Screens\UScreenOptionsGame.pas', + UScreenOptionsGraphics in 'Screens\UScreenOptionsGraphics.pas', + UScreenOptionsSound in 'Screens\UScreenOptionsSound.pas', + UScreenOptionsLyrics in 'Screens\UScreenOptionsLyrics.pas', + UScreenOptionsThemes in 'Screens\UScreenOptionsThemes.pas', + UScreenOptionsRecord in 'Screens\UScreenOptionsRecord.pas', + UScreenOptionsAdvanced in 'Screens\UScreenOptionsAdvanced.pas', + UScreenEditSub in 'Screens\UScreenEditSub.pas', + UScreenEdit in 'Screens\UScreenEdit.pas', + UScreenEditConvert in 'Screens\UScreenEditConvert.pas', + UScreenEditHeader in 'Screens\UScreenEditHeader.pas', + UScreenOpen in 'Screens\UScreenOpen.pas', + UScreenTop5 in 'Screens\UScreenTop5.pas', + UScreenSongMenu in 'Screens\UScreenSongMenu.pas', + UScreenSongJumpto in 'Screens\UScreenSongJumpto.pas', + UScreenStatMain in 'Screens\UScreenStatMain.pas', + UScreenStatDetail in 'Screens\UScreenStatDetail.pas', + UScreenCredits in 'Screens\UScreenCredits.pas', + UScreenPopup in 'Screens\UScreenPopup.pas', + + //Includes - Screens PartyMode + UScreenSingModi in 'Screens\UScreenSingModi.pas', + UScreenPartyNewRound in 'Screens\UScreenPartyNewRound.pas', + UScreenPartyScore in 'Screens\UScreenPartyScore.pas', + UScreenPartyPlayer in 'Screens\UScreenPartyPlayer.pas', + UScreenPartyOptions in 'Screens\UScreenPartyOptions.pas', + UScreenPartyWin in 'Screens\UScreenPartyWin.pas', + + + //------------------------------ + //Includes - Modi SDK + //------------------------------ + ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', //Old SDK, will be deleted soon + UPluginDefs in '..\..\Modis\SDK\UPluginDefs.pas', //New SDK, not only Modis + UPartyDefs in '..\..\Modis\SDK\UPartyDefs.pas', //Headers to register Party Modes + + {$IFDEF win32} + Windows, + {$ENDIF} + SysUtils; + +const + Version = 'UltraStar Deluxe V 1.10 Alpha Build'; + +{$IFNDEF FPC} +begin + Main; +end. +{$ENDIF} -- cgit v1.2.3 From 070bdf48932aa39e048ed645d6c5ad1a9eaf1309 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 18 Dec 2007 02:35:14 +0000 Subject: fixed file name error git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@720 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudio_FFMpeg.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudio_FFMpeg.pas b/Game/Code/Classes/UAudio_FFMpeg.pas index f050eaea..c3a7228b 100644 --- a/Game/Code/Classes/UAudio_FFMpeg.pas +++ b/Game/Code/Classes/UAudio_FFMpeg.pas @@ -262,9 +262,9 @@ begin av_register_all(); SDL_Init(SDL_INIT_AUDIO); - StartSoundStream := LoadSoundFromFile(SoundPath + 'Common Start.mp3'); + StartSoundStream := LoadSoundFromFile(SoundPath + 'Common start.mp3'); { - BackSoundStream := LoadSoundFromFile(SoundPath + 'Common Back.mp3'); + BackSoundStream := LoadSoundFromFile(SoundPath + 'Common back.mp3'); SwooshSoundStream := LoadSoundFromFile(SoundPath + 'menu swoosh.mp3'); ChangeSoundStream := LoadSoundFromFile(SoundPath + 'select music change music 50.mp3'); OptionSoundStream := LoadSoundFromFile(SoundPath + 'option change col.mp3'); -- cgit v1.2.3 From 19903a5497d2a4468280cab56b0cac71207e3c03 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 18 Dec 2007 03:36:28 +0000 Subject: fixed ffmpeg-sdl_audio playback still only got noise.. but it works on linux git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@721 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudio_FFMpeg.pas | 42 ++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 14 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudio_FFMpeg.pas b/Game/Code/Classes/UAudio_FFMpeg.pas index c3a7228b..8cef934b 100644 --- a/Game/Code/Classes/UAudio_FFMpeg.pas +++ b/Game/Code/Classes/UAudio_FFMpeg.pas @@ -478,8 +478,10 @@ begin if (buffer = nil) then exit; + while true do begin + while (audio_pkt_size > 0) do begin // writeln( 'got audio packet' ); @@ -489,7 +491,7 @@ begin len1 := avcodec_decode_audio(pCodecCtx, Pointer(buffer), data_size, audio_pkt_data, audio_pkt_size); - writeln('avcodec_decode_audio : ' + inttostr( len1 )); +// writeln('avcodec_decode_audio : ' + inttostr( len1 )); if(len1 < 0) then begin @@ -516,6 +518,8 @@ begin if (pkt.data <> nil) then av_free_packet(pkt); + + if (packetQueue.quit) then begin result := -1; @@ -528,10 +532,12 @@ begin exit; end; + audio_pkt_data := PChar(pkt.data); audio_pkt_size := pkt.size; // writeln( 'Audio Packet Size - ' + inttostr(audio_pkt_size) ); end; + end; procedure AudioCallback(userdata: Pointer; stream: PUInt8; len: Integer); cdecl; @@ -544,19 +550,21 @@ begin outStream := TFFMpegOutputStream(userdata); while (len > 0) do - with outStream do begin + with outStream do + begin + if (audio_buf_index >= audio_buf_size) then begin // We have already sent all our data; get more audio_size := AudioDecodeFrame(@audio_buf, sizeof(TAudioBuffer)); - writeln('audio_decode_frame : '+ inttostr(audio_size)); +// writeln('audio_decode_frame : '+ inttostr(audio_size)); if(audio_size < 0) then begin // If error, output silence audio_buf_size := 1024; FillChar(audio_buf, audio_buf_size, #0); - writeln( 'Silence' ); +// writeln( 'Silence' ); end else begin @@ -579,7 +587,9 @@ begin Dec(len, len1); Inc(stream, len1); Inc(audio_buf_index, len1); + end; + end; function TAudio_FFMpeg.FindAudioStreamID(pFormatCtx : PAVFormatContext): integer; @@ -616,7 +626,7 @@ begin while (av_read_frame(stream.pFormatCtx, packet) >= 0) do begin - writeln( 'ffmpeg - av_read_frame' ); +// writeln( 'ffmpeg - av_read_frame' ); if (packet.stream_index = stream.ffmpegStreamID) then begin @@ -627,9 +637,10 @@ begin begin av_free_packet(packet); end; + end; - Writeln('Done: ' + inttostr(stream.packetQueue.nbPackets)); +// Writeln('Done: ' + inttostr(stream.packetQueue.nbPackets)); result := 0; end; @@ -779,6 +790,7 @@ function TPacketQueue.Put(pkt : PAVPacket): integer; var pkt1 : PAVPacketList; begin + result := -1; if (av_dup_packet(pkt) < 0) then @@ -793,7 +805,7 @@ begin SDL_LockMutex(Self.mutex); - try +// try if (Self.lastPkt = nil) then Self.firstPkt := pkt1 @@ -803,14 +815,14 @@ begin Self.lastPkt := pkt1; inc(Self.nbPackets); - Writeln('Put: ' + inttostr(nbPackets)); +// Writeln('Put: ' + inttostr(nbPackets)); Self.size := Self.size + pkt1^.pkt.size; SDL_CondSignal(Self.cond); - finally +// finally SDL_UnlockMutex(Self.mutex); - end; +// end; result := 0; end; @@ -819,10 +831,11 @@ function TPacketQueue.Get(var pkt: TAVPacket; block: boolean): integer; var pkt1 : PAVPacketList; begin + result := -1; SDL_LockMutex(Self.mutex); - try +// try while true do begin if (quit) then @@ -837,7 +850,7 @@ begin Self.lastPkt := nil; dec(Self.nbPackets); - Writeln('Get: ' + inttostr(nbPackets)); +// Writeln('Get: ' + inttostr(nbPackets)); Self.size := Self.size - pkt1^.pkt.size; pkt := pkt1^.pkt; @@ -857,9 +870,10 @@ begin SDL_CondWait(Self.cond, Self.mutex); end; end; - finally +// finally SDL_UnlockMutex(Self.mutex); - end; +// end; + end; -- cgit v1.2.3 From c7e01792aaf8f16bb17d7254d93157d617271391 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 18 Dec 2007 03:51:24 +0000 Subject: fixed crash on song play, if the AudioInterface reports the song as 0 length. fixed ffmpeg bug with song length. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@722 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudio_FFMpeg.pas | 28 ++++++++++++---------------- Game/Code/Screens/UScreenSong.pas | 3 ++- 2 files changed, 14 insertions(+), 17 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudio_FFMpeg.pas b/Game/Code/Classes/UAudio_FFMpeg.pas index 8cef934b..9a242cd9 100644 --- a/Game/Code/Classes/UAudio_FFMpeg.pas +++ b/Game/Code/Classes/UAudio_FFMpeg.pas @@ -375,37 +375,33 @@ function TAudio_FFMpeg.Length: real; var bytes: integer; begin - Result := MusicStream.pFormatCtx^.duration / AV_TIME_BASE; + Result := 0; + // Todo : why is Music stream always nil !? + + if assigned( MusicStream ) then + begin + //writeln( 'MusicStream : ' + inttostr( integer( assigned( MusicStream ))) ); + //writeln( 'MusicStream.pFormatCtx : ' + inttostr( integer( assigned( MusicStream.pFormatCtx ))) ); + //writeln( 'MusicStream.pFormatCtx^.duration : ' + inttostr( integer( MusicStream.pFormatCtx^.duration )) ); + + Result := MusicStream.pFormatCtx^.duration / AV_TIME_BASE; + end; end; function TAudio_FFMpeg.getPosition: real; -var - bytes: integer; begin Result := 0; - -(* - bytes := BASS_ChannelGetPosition(BASS); - Result := BASS_ChannelBytes2Seconds(BASS, bytes); -*) end; function TAudio_FFMpeg.Finished: boolean; begin Result := false; - -(* - if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then - begin - Result := true; - end; -*) end; procedure TAudio_FFMpeg.PlayStart; begin if StartSoundStream <> nil then - StartSoundStream.Play(); + StartSoundStream.Play(); end; procedure TAudio_FFMpeg.PlayBack; diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 0def87ab..03ef793b 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1519,7 +1519,8 @@ begin if Length(CatSongs.Song) > 0 then begin //Load Music only when Song Preview is activated - if (Ini.PreviewVolume <> 0) then + if ( Ini.PreviewVolume <> 0 ) AND + ( AudioPlayback.Length > 1 ) then begin AudioPlayback.SetLoop(false); AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); -- cgit v1.2.3 From d31df89c2c152567cdb35bc695f33d131ea885b7 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 18 Dec 2007 04:35:24 +0000 Subject: non_working with portaudio-support git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@723 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudio_FFMpeg_Pa.pas | 969 +++++++++++++++++++++++++++++++++ 1 file changed, 969 insertions(+) create mode 100644 Game/Code/Classes/UAudio_FFMpeg_Pa.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudio_FFMpeg_Pa.pas b/Game/Code/Classes/UAudio_FFMpeg_Pa.pas new file mode 100644 index 00000000..a1682e78 --- /dev/null +++ b/Game/Code/Classes/UAudio_FFMpeg_Pa.pas @@ -0,0 +1,969 @@ +unit UAudio_FFMpeg; + +(******************************************************************************* + +This unit is primarily based upon - + http://www.dranger.com/ffmpeg/ffmpegtutorial_all.html + + and tutorial03.c + + http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html + +*******************************************************************************) + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +uses Classes, + {$IFDEF win32} + windows, + {$ENDIF} + Messages, + SysUtils, + {$IFNDEF FPC} + Forms, + {$ENDIF} + SDL, // Used for Audio output Interface + avcodec, // FFMpeg Audio file decoding + avformat, + avutil, + ULog, + UMusic; + +implementation + +uses + {$IFDEF LAZARUS} + lclintf, + //libc, // not available in win32 + {$ENDIF} + portaudio, + UIni, + UMain, + UThemes; + + +type + PPacketQueue = ^TPacketQueue; + TPacketQueue = class + private + firstPkt, + lastPkt : PAVPacketList; + nbPackets : integer; + size : integer; + mutex : PSDL_Mutex; + cond : PSDL_Cond; + quit : boolean; + + public + constructor Create(); + + function Put(pkt : PAVPacket): integer; + function Get(var pkt: TAVPacket; block: boolean): integer; + end; + +type + TStreamStatus = (sNotReady, sStopped, sPlaying, sSeeking, sPaused, sOpen); + +const + StreamStatusStr: array[TStreamStatus] of string = ('Not ready', 'Stopped', 'Playing', 'Seeking', 'Paused', 'Open'); + +type + PAudioBuffer = ^TAudioBuffer; + TAudioBuffer = array[0 .. (AVCODEC_MAX_AUDIO_FRAME_SIZE * 3 div 2)-1] of byte; + +const + SDL_AUDIO_BUFFER_SIZE = 1024; + +type + TFFMpegOutputStream = class(TAudioOutputStream) + private + parseThread: PSDL_Thread; + packetQueue: TPacketQueue; + + status: TStreamStatus; + + // FFMpeg internal data + pFormatCtx : PAVFormatContext; + pCodecCtx : PAVCodecContext; + pCodec : PAVCodec; + ffmpegStreamID : Integer; + ffmpegStream : PAVStream; + + // static vars for AudioDecodeFrame + pkt : TAVPacket; + audio_pkt_data : PChar; + audio_pkt_size : integer; + + // static vars for AudioCallback + audio_buf_index : cardinal; + audio_buf_size : cardinal; + audio_buf : TAudioBuffer; + + channel: PPaStream; + public + constructor Create(); overload; + constructor Create(pFormatCtx: PAVFormatContext; + pCodecCtx: PAVCodecContext; pCodec: PAVCodec; + ffmpegStreamID : Integer; ffmpegStream: PAVStream); overload; + + procedure Play(); + procedure Pause(); + procedure Stop(); + procedure Close(); + + function AudioDecodeFrame(buffer : PUInt8; bufSize: integer): integer; + end; + +type + TAudio_FFMpeg = class( TInterfacedObject, IAudioPlayback ) + private + MusicStream: TFFMpegOutputStream; + + StartSoundStream: TFFMpegOutputStream; + BackSoundStream: TFFMpegOutputStream; + SwooshSoundStream: TFFMpegOutputStream; + ChangeSoundStream: TFFMpegOutputStream; + OptionSoundStream: TFFMpegOutputStream; + ClickSoundStream: TFFMpegOutputStream; + DrumSoundStream: TFFMpegOutputStream; + HihatSoundStream: TFFMpegOutputStream; + ClapSoundStream: TFFMpegOutputStream; + ShuffleSoundStream: TFFMpegOutputStream; + + //Custom Sounds + CustomSounds: array of TCustomSoundEntry; + Loaded: boolean; + Loop: boolean; + + function FindAudioStreamID(pFormatCtx : PAVFormatContext): integer; + public + function GetName: String; + procedure InitializePlayback; + procedure SetVolume(Volume: integer); + procedure SetMusicVolume(Volume: integer); + procedure SetLoop(Enabled: boolean); + function Open(Name: string): boolean; // true if succeed + procedure Rewind; + procedure MoveTo(Time: real); + procedure Play; + procedure Pause; //Pause Mod + procedure Stop; + procedure Close; + function Finished: boolean; + function Length: real; + function getPosition: real; + procedure PlayStart; + procedure PlayBack; + procedure PlaySwoosh; + procedure PlayChange; + procedure PlayOption; + procedure PlayClick; + procedure PlayDrum; + procedure PlayHihat; + procedure PlayClap; + procedure PlayShuffle; + procedure StopShuffle; + + function LoadSoundFromFile(Name: string): TFFMpegOutputStream; + + //Equalizer + function GetFFTData: TFFTData; + + // Interface for Visualizer + function GetPCMData(var data: TPCMData): Cardinal; + + //Custom Sounds + function LoadCustomSound(const Filename: String): Cardinal; + procedure PlayCustomSound(const Index: Cardinal ); + end; + +var + test: TFFMpegOutputStream; + it: integer; + +var + singleton_MusicFFMpeg : IAudioPlayback = nil; + + +function ParseAudio(data: Pointer): integer; cdecl; forward; +procedure SDL_AudioCallback( userdata: Pointer; stream: PUInt8; len: Integer ); cdecl; forward; +function Pa_AudioCallback(input: Pointer; output: Pointer; frameCount: Longword; + timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; + userData: Pointer): Integer; cdecl; forward; + +constructor TFFMpegOutputStream.Create(); +begin + inherited; + + packetQueue := TPacketQueue.Create(); + + FillChar(pkt, sizeof(TAVPacket), #0); + + status := sStopped; + + audio_pkt_data := nil; + audio_pkt_size := 0; + + audio_buf_index := 0; + audio_buf_size := 0; +end; + +constructor TFFMpegOutputStream.Create(pFormatCtx: PAVFormatContext; + pCodecCtx: PAVCodecContext; pCodec: PAVCodec; + ffmpegStreamID : Integer; ffmpegStream: PAVStream); +begin + Create(); + + Self.pFormatCtx := pFormatCtx; + Self.pCodecCtx := pCodecCtx; + Self.pCodec := pCodec; + Self.ffmpegStreamID := ffmpegStreamID; + Self.ffmpegStream := ffmpegStream; + + test := Self; + it:=0; +end; + +procedure TFFMpegOutputStream.Play(); +var + err: TPaError; +begin + writeln('Play request'); + if(status = sStopped) then + begin + writeln('Play ok'); + status := sPlaying; + Self.parseThread := SDL_CreateThread(@ParseAudio, Self); + //SDL_PauseAudio(0); + + err := Pa_StartStream(Self.channel); + end; +end; + +procedure TFFMpegOutputStream.Pause(); +begin +end; + +procedure TFFMpegOutputStream.Stop(); +begin +end; + +procedure TFFMpegOutputStream.Close(); +begin + // Close the codec + avcodec_close(pCodecCtx); + + // Close the video file + av_close_input_file(pFormatCtx); +end; + + +function TAudio_FFMpeg.GetName: String; +begin + result := 'FFMpeg'; +end; + +procedure TAudio_FFMpeg.InitializePlayback; +begin + Log.LogStatus('InitializePlayback', 'UAudio_FFMpeg'); + + Loaded := false; + Loop := false; + + av_register_all(); + //SDL_Init(SDL_INIT_AUDIO); + Pa_Initialize(); + + StartSoundStream := LoadSoundFromFile(SoundPath + 'Common Start.mp3'); + { + BackSoundStream := LoadSoundFromFile(SoundPath + 'Common Back.mp3'); + SwooshSoundStream := LoadSoundFromFile(SoundPath + 'menu swoosh.mp3'); + ChangeSoundStream := LoadSoundFromFile(SoundPath + 'select music change music 50.mp3'); + OptionSoundStream := LoadSoundFromFile(SoundPath + 'option change col.mp3'); + ClickSoundStream := LoadSoundFromFile(SoundPath + 'rimshot022b.mp3'); + } +// DrumSoundStream := LoadSoundFromFile(SoundPath + 'bassdrumhard076b.mp3'); +// HihatSoundStream := LoadSoundFromFile(SoundPath + 'hihatclosed068b.mp3'); +// ClapSoundStream := LoadSoundFromFile(SoundPath + 'claps050b.mp3'); + +// ShuffleSoundStream := LoadSoundFromFile(SoundPath + 'Shuffle.mp3'); +end; + + +procedure TAudio_FFMpeg.SetVolume(Volume: integer); +begin + //New: Sets Volume only for this Application +(* + BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); +*) +end; + +procedure TAudio_FFMpeg.SetMusicVolume(Volume: Integer); +begin + //Max Volume Prevention + if Volume > 100 then + Volume := 100; + + if Volume < 0 then + Volume := 0; + + + //Set Volume +// BASS_ChannelSetAttributes (Bass, -1, Volume, -101); +end; + +procedure TAudio_FFMpeg.SetLoop(Enabled: boolean); +begin + Loop := Enabled; +end; + +function TAudio_FFMpeg.Open(Name: string): boolean; +begin + Loaded := false; + if FileExists(Name) then + begin +// Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); + + Loaded := true; + //Set Max Volume + SetMusicVolume (100); + end; + + Result := Loaded; +end; + +procedure TAudio_FFMpeg.Rewind; +begin + if Loaded then + begin + end; +end; + +procedure TAudio_FFMpeg.MoveTo(Time: real); +var + bytes: integer; +begin +// bytes := BASS_ChannelSeconds2Bytes(Bass, Time); +// BASS_ChannelSetPosition(Bass, bytes); +end; + +procedure TAudio_FFMpeg.Play; +begin + if MusicStream <> nil then + if Loaded then + begin + if Loop then + begin + end; + // start from beginning... + // actually bass itself does not loop, nor does this TAudio_FFMpeg Class + MusicStream.Play(); + end; +end; + +procedure TAudio_FFMpeg.Pause; //Pause Mod +begin + if MusicStream <> nil then + if Loaded then begin + MusicStream.Pause(); // Pauses Song + end; +end; + +procedure TAudio_FFMpeg.Stop; +begin + if MusicStream <> nil then + MusicStream.Stop(); +end; + +procedure TAudio_FFMpeg.Close; +begin + if MusicStream <> nil then + MusicStream.Close(); +end; + +function TAudio_FFMpeg.Length: real; +var + bytes: integer; +begin + Result := MusicStream.pFormatCtx^.duration / AV_TIME_BASE; +end; + +function TAudio_FFMpeg.getPosition: real; +var + bytes: integer; +begin + Result := 0; + +(* + bytes := BASS_ChannelGetPosition(BASS); + Result := BASS_ChannelBytes2Seconds(BASS, bytes); +*) +end; + +function TAudio_FFMpeg.Finished: boolean; +begin + Result := false; + +(* + if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then + begin + Result := true; + end; +*) +end; + +procedure TAudio_FFMpeg.PlayStart; +begin + if StartSoundStream <> nil then + StartSoundStream.Play(); +end; + +procedure TAudio_FFMpeg.PlayBack; +begin + if BackSoundStream <> nil then + BackSoundStream.Play(); +end; + +procedure TAudio_FFMpeg.PlaySwoosh; +begin + if SwooshSoundStream <> nil then + SwooshSoundStream.Play(); +end; + +procedure TAudio_FFMpeg.PlayChange; +begin + if ChangeSoundStream <> nil then + ChangeSoundStream.Play(); +end; + +procedure TAudio_FFMpeg.PlayOption; +begin + if OptionSoundStream <> nil then + OptionSoundStream.Play(); +end; + +procedure TAudio_FFMpeg.PlayClick; +begin + if ClickSoundStream <> nil then + ClickSoundStream.Play(); +end; + +procedure TAudio_FFMpeg.PlayDrum; +begin + if DrumSoundStream <> nil then + DrumSoundStream.Play(); +end; + +procedure TAudio_FFMpeg.PlayHihat; +begin + if HihatSoundStream <> nil then + HihatSoundStream.Play(); +end; + +procedure TAudio_FFMpeg.PlayClap; +begin + if ClapSoundStream <> nil then + ClapSoundStream.Play(); +end; + +procedure TAudio_FFMpeg.PlayShuffle; +begin + if ShuffleSoundStream <> nil then + ShuffleSoundStream.Play(); +end; + +procedure TAudio_FFMpeg.StopShuffle; +begin + if ShuffleSoundStream <> nil then + ShuffleSoundStream.Stop(); +end; + + +function TFFMpegOutputStream.AudioDecodeFrame(buffer : PUInt8; bufSize: integer): integer; +var + len1, + data_size: integer; +begin + result := -1; + + if (buffer = nil) then + exit; + + while true do + begin + while (audio_pkt_size > 0) do + begin +// writeln( 'got audio packet' ); + data_size := bufSize; + + if(pCodecCtx = nil) then begin + writeln('Das wars'); + exit; + end; + + // TODO: should be avcodec_decode_audio2 but this wont link on my ubuntu box. + len1 := avcodec_decode_audio(pCodecCtx, Pointer(buffer), + data_size, audio_pkt_data, audio_pkt_size); + + //writeln('avcodec_decode_audio : ' + inttostr( len1 )); + + if(len1 < 0) then + begin + // if error, skip frame +// writeln( 'Skip audio frame' ); + audio_pkt_size := 0; + break; + end; + + audio_pkt_data := audio_pkt_data + len1; + audio_pkt_size := audio_pkt_size + len1; + + if (data_size <= 0) then + begin + // No data yet, get more frames + continue; + end; + + // We have data, return it and come back for more later + result := data_size; + exit; + end; + + inc(it); + if (pkt.data <> nil) then + begin + av_free_packet(pkt); + end; + + if (packetQueue.quit) then + begin + result := -1; + exit; + end; + writeln(it); + if (packetQueue.Get(pkt, true) < 0) then + begin + result := -1; + exit; + end; + + audio_pkt_data := PChar(pkt.data); + audio_pkt_size := pkt.size; +// writeln( 'Audio Packet Size - ' + inttostr(audio_pkt_size) ); + end; +end; + +procedure SDL_AudioCallback(userdata: Pointer; stream: PUInt8; len: Integer); cdecl; +var + outStream : TFFMpegOutputStream; + len1, + audio_size : integer; + pSrc : Pointer; +begin + outStream := TFFMpegOutputStream(userdata); + + while (len > 0) do + with outStream do begin + if (audio_buf_index >= audio_buf_size) then + begin + // We have already sent all our data; get more + audio_size := AudioDecodeFrame(@audio_buf, sizeof(TAudioBuffer)); + //writeln('audio_decode_frame : '+ inttostr(audio_size)); + + if(audio_size < 0) then + begin + // If error, output silence + audio_buf_size := 1024; + FillChar(audio_buf, audio_buf_size, #0); + //writeln( 'Silence' ); + end + else + begin + audio_buf_size := audio_size; + end; + audio_buf_index := 0; // Todo : jb - SegFault ? + end; + + len1 := audio_buf_size - audio_buf_index; + if (len1 > len) then + len1 := len; + + pSrc := PChar(@audio_buf) + audio_buf_index; + {$ifdef WIN32} + CopyMemory(stream, pSrc , len1); + {$else} + memcpy(stream, pSrc , len1); + {$endif} + + Dec(len, len1); + Inc(stream, len1); + Inc(audio_buf_index, len1); + end; +end; + +function Pa_AudioCallback(input: Pointer; output: Pointer; frameCount: Longword; + timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; + userData: Pointer): Integer; cdecl; +var + outStream : TFFMpegOutputStream; + len1, + audio_size : integer; + pSrc : Pointer; + len : integer; +begin + outStream := TFFMpegOutputStream(userData); + len := frameCount * 4; // use *2 for mono-files + + while (len > 0) do + with outStream do begin + if (audio_buf_index >= audio_buf_size) then + begin + // We have already sent all our data; get more + audio_size := AudioDecodeFrame(@audio_buf, sizeof(TAudioBuffer)); + //writeln('audio_decode_frame : '+ inttostr(audio_size)); + + if(audio_size < 0) then + begin + // If error, output silence + audio_buf_size := 1024; + FillChar(audio_buf, audio_buf_size, #0); + //writeln( 'Silence' ); + end + else + begin + audio_buf_size := audio_size; + end; + audio_buf_index := 0; // Todo : jb - SegFault ? + end; + + len1 := audio_buf_size - audio_buf_index; + if (len1 > len) then + len1 := len; + + pSrc := PChar(@audio_buf) + audio_buf_index; + {$ifdef WIN32} + CopyMemory(output, pSrc , len1); + {$else} + memcpy(output, pSrc , len1); + {$endif} + + Dec(len, len1); + Inc(PChar(output), len1); + Inc(audio_buf_index, len1); + end; +end; + +function TAudio_FFMpeg.FindAudioStreamID(pFormatCtx : PAVFormatContext): integer; +var + i : integer; + streamID: integer; + stream : PAVStream; +begin + // Find the first audio stream + streamID := -1; + + for i := 0 to pFormatCtx^.nb_streams-1 do + begin + //Log.LogStatus('aFormatCtx.streams[i] : ' + inttostr(i), 'UAudio_FFMpeg'); + stream := pFormatCtx^.streams[i]; + + if ( stream.codec^.codec_type = CODEC_TYPE_AUDIO ) then + begin + Log.LogStatus('Found Audio Stream', 'UAudio_FFMpeg'); + streamID := i; + break; + end; + end; + + result := streamID; +end; + +function ParseAudio(data: Pointer): integer; cdecl; +var + packet: TAVPacket; + stream: TFFMpegOutputStream; +begin + stream := TFFMpegOutputStream(data); + + while (av_read_frame(stream.pFormatCtx, packet) >= 0) do + begin + //writeln( 'ffmpeg - av_read_frame' ); + + if (packet.stream_index = stream.ffmpegStreamID) then + begin + //writeln( 'packet_queue_put' ); + stream.packetQueue.put(@packet); + end + else + begin + av_free_packet(packet); + end; + end; + + //Writeln('Done: ' + inttostr(stream.packetQueue.nbPackets)); + + result := 0; +end; + + +function TAudio_FFMpeg.LoadSoundFromFile(Name: string): TFFMpegOutputStream; +var + pFormatCtx : PAVFormatContext; + pCodecCtx : PAVCodecContext; + pCodec : PAVCodec; + ffmpegStreamID : Integer; + ffmpegStream : PAVStream; + wanted_spec, + spec : TSDL_AudioSpec; + csIndex : integer; + stream : TFFMpegOutputStream; + err : TPaError; +begin + result := nil; + + if (not FileExists(Name)) then + begin + Log.LogStatus('LoadSoundFromFile: Sound not found "' + Name + '"', 'UAudio_FFMpeg'); + exit; + end; + + // Open audio file + if (av_open_input_file(pFormatCtx, PChar(Name), nil, 0, nil) > 0) then + exit; + + // Retrieve stream information + if (av_find_stream_info(pFormatCtx) < 0) then + exit; + + dump_format(pFormatCtx, 0, pchar(Name), 0); + + ffmpegStreamID := FindAudioStreamID(pFormatCtx); + if (ffmpegStreamID < 0) then + exit; + + //Log.LogStatus('Audio Stream ID is : '+ inttostr(ffmpegStreamID), 'UAudio_FFMpeg'); + + ffmpegStream := pFormatCtx.streams[ffmpegStreamID]; + pCodecCtx := ffmpegStream^.codec; + + pCodec := avcodec_find_decoder(pCodecCtx^.codec_id); + if (pCodec = nil) then + begin + Log.LogStatus('Unsupported codec!', 'UAudio_FFMpeg'); + exit; + end; + + avcodec_open(pCodecCtx, pCodec); + //writeln( 'Opened the codec' ); + + stream := TFFMpegOutputStream.Create(pFormatCtx, pCodecCtx, pCodec, + ffmpegStreamID, ffmpegStream); + + { + // Set SDL audio settings from codec info + wanted_spec.freq := pCodecCtx^.sample_rate; + wanted_spec.format := AUDIO_S16SYS; + wanted_spec.channels := pCodecCtx^.channels; + wanted_spec.silence := 0; + wanted_spec.samples := SDL_AUDIO_BUFFER_SIZE; + wanted_spec.callback := AudioCallback; + wanted_spec.userdata := stream; + + // TODO: this works only one time (?) + if (SDL_OpenAudio(@wanted_spec, @spec) < 0) then + begin + Log.LogStatus('SDL_OpenAudio: '+SDL_GetError(), 'UAudio_FFMpeg'); + stream.Free(); + exit; + end; + } + + err := Pa_OpenDefaultStream(stream.channel, 0, pCodecCtx^.channels, paInt16, + pCodecCtx^.sample_rate, SDL_AUDIO_BUFFER_SIZE div 4, //paFramesPerBufferUnspecified, + @PA_AudioCallback, stream); + if(err <> paNoError) then begin + Log.LogStatus('Pa_OpenDefaultStream: '+Pa_GetErrorText(err), 'UAudio_FFMpeg'); + stream.Free(); + exit; + end; + + Log.LogStatus('SDL opened audio device', 'UAudio_FFMpeg'); + + //Add CustomSound + csIndex := High(CustomSounds) + 1; + SetLength (CustomSounds, csIndex + 1); + CustomSounds[csIndex].Filename := Name; + CustomSounds[csIndex].Stream := stream; + + result := stream; +end; + +//Equalizer +function TAudio_FFMpeg.GetFFTData: TFFTData; +var + data: TFFTData; +begin + //Get Channel Data Mono and 256 Values +// BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); + result := data; +end; + +// Interface for Visualizer +function TAudio_FFMpeg.GetPCMData(var data: TPCMData): Cardinal; +begin + result := 0; +end; + +function TAudio_FFMpeg.LoadCustomSound(const Filename: String): Cardinal; +var + S: TFFMpegOutputStream; + I: Integer; + F: String; +begin + //Search for Sound in already loaded Sounds + F := UpperCase(SoundPath + FileName); + For I := 0 to High(CustomSounds) do + begin + if (UpperCase(CustomSounds[I].Filename) = F) then + begin + Result := I; + Exit; + end; + end; + + S := LoadSoundFromFile(SoundPath + Filename); + if (S <> nil) then + Result := High(CustomSounds) + else + Result := 0; +end; + +procedure TAudio_FFMpeg.PlayCustomSound(const Index: Cardinal ); +begin + if Index <= High(CustomSounds) then + (CustomSounds[Index].Stream as TFFMpegOutputStream).Play(); +end; + + +constructor TPacketQueue.Create(); +begin + inherited; + + firstPkt := nil; + lastPkt := nil; + nbPackets := 0; + size := 0; + + mutex := SDL_CreateMutex(); + cond := SDL_CreateCond(); +end; + +function TPacketQueue.Put(pkt : PAVPacket): integer; +var + pkt1 : PAVPacketList; +begin + result := -1; + + if (av_dup_packet(pkt) < 0) then + exit; + + pkt1 := av_malloc(sizeof(TAVPacketList)); + if (pkt1 = nil) then + exit; + + pkt1^.pkt := pkt^; + pkt1^.next := nil; + + + SDL_LockMutex(Self.mutex); + try + + if (Self.lastPkt = nil) then + Self.firstPkt := pkt1 + else + Self.lastPkt^.next := pkt1; + + Self.lastPkt := pkt1; + inc(Self.nbPackets); + + Writeln('Put: ' + inttostr(nbPackets)); + + Self.size := Self.size + pkt1^.pkt.size; + SDL_CondSignal(Self.cond); + + finally + SDL_UnlockMutex(Self.mutex); + end; + + result := 0; +end; + +function TPacketQueue.Get(var pkt: TAVPacket; block: boolean): integer; +var + pkt1 : PAVPacketList; +begin + result := -1; + + SDL_LockMutex(Self.mutex); + try + while true do + begin + if (quit) then + exit; + + pkt1 := Self.firstPkt; + + if (pkt1 <> nil) then + begin + Self.firstPkt := pkt1.next; + if (Self.firstPkt = nil) then + Self.lastPkt := nil; + dec(Self.nbPackets); + + Writeln('Get: ' + inttostr(nbPackets)); + + Self.size := Self.size - pkt1^.pkt.size; + pkt := pkt1^.pkt; + av_free(pkt1); + + result := 1; + break; + end + else + if (not block) then + begin + result := 0; + break; + end + else + begin + SDL_CondWait(Self.cond, Self.mutex); + end; + end; + finally + SDL_UnlockMutex(Self.mutex); + end; +end; + + + +initialization + singleton_MusicFFMpeg := TAudio_FFMpeg.create(); + + writeln( 'UAudio_FFMpeg - Register Playback' ); + AudioManager.add( IAudioPlayback( singleton_MusicFFMpeg ) ); + +finalization + AudioManager.Remove( IAudioPlayback( singleton_MusicFFMpeg ) ); + + +end. -- cgit v1.2.3 From b45a6fc256e832532fa491e1fd1f5ba7d09f011e Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 18 Dec 2007 04:56:10 +0000 Subject: added audio-callback return value git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@724 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudio_FFMpeg_Pa.pas | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudio_FFMpeg_Pa.pas b/Game/Code/Classes/UAudio_FFMpeg_Pa.pas index a1682e78..55ef347a 100644 --- a/Game/Code/Classes/UAudio_FFMpeg_Pa.pas +++ b/Game/Code/Classes/UAudio_FFMpeg_Pa.pas @@ -660,6 +660,8 @@ begin Inc(PChar(output), len1); Inc(audio_buf_index, len1); end; + + result := paContinue; end; function TAudio_FFMpeg.FindAudioStreamID(pFormatCtx : PAVFormatContext): integer; -- cgit v1.2.3 From 518fc523189641a8434536a7665b802157b95799 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 18 Dec 2007 05:11:54 +0000 Subject: fixed to make compile on linux git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@725 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudio_FFMpeg_Pa.pas | 1951 ++++++++++++++++---------------- 1 file changed, 980 insertions(+), 971 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudio_FFMpeg_Pa.pas b/Game/Code/Classes/UAudio_FFMpeg_Pa.pas index 55ef347a..400af7ce 100644 --- a/Game/Code/Classes/UAudio_FFMpeg_Pa.pas +++ b/Game/Code/Classes/UAudio_FFMpeg_Pa.pas @@ -1,971 +1,980 @@ -unit UAudio_FFMpeg; - -(******************************************************************************* - -This unit is primarily based upon - - http://www.dranger.com/ffmpeg/ffmpegtutorial_all.html - - and tutorial03.c - - http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html - -*******************************************************************************) - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - - -uses Classes, - {$IFDEF win32} - windows, - {$ENDIF} - Messages, - SysUtils, - {$IFNDEF FPC} - Forms, - {$ENDIF} - SDL, // Used for Audio output Interface - avcodec, // FFMpeg Audio file decoding - avformat, - avutil, - ULog, - UMusic; - -implementation - -uses - {$IFDEF LAZARUS} - lclintf, - //libc, // not available in win32 - {$ENDIF} - portaudio, - UIni, - UMain, - UThemes; - - -type - PPacketQueue = ^TPacketQueue; - TPacketQueue = class - private - firstPkt, - lastPkt : PAVPacketList; - nbPackets : integer; - size : integer; - mutex : PSDL_Mutex; - cond : PSDL_Cond; - quit : boolean; - - public - constructor Create(); - - function Put(pkt : PAVPacket): integer; - function Get(var pkt: TAVPacket; block: boolean): integer; - end; - -type - TStreamStatus = (sNotReady, sStopped, sPlaying, sSeeking, sPaused, sOpen); - -const - StreamStatusStr: array[TStreamStatus] of string = ('Not ready', 'Stopped', 'Playing', 'Seeking', 'Paused', 'Open'); - -type - PAudioBuffer = ^TAudioBuffer; - TAudioBuffer = array[0 .. (AVCODEC_MAX_AUDIO_FRAME_SIZE * 3 div 2)-1] of byte; - -const - SDL_AUDIO_BUFFER_SIZE = 1024; - -type - TFFMpegOutputStream = class(TAudioOutputStream) - private - parseThread: PSDL_Thread; - packetQueue: TPacketQueue; - - status: TStreamStatus; - - // FFMpeg internal data - pFormatCtx : PAVFormatContext; - pCodecCtx : PAVCodecContext; - pCodec : PAVCodec; - ffmpegStreamID : Integer; - ffmpegStream : PAVStream; - - // static vars for AudioDecodeFrame - pkt : TAVPacket; - audio_pkt_data : PChar; - audio_pkt_size : integer; - - // static vars for AudioCallback - audio_buf_index : cardinal; - audio_buf_size : cardinal; - audio_buf : TAudioBuffer; - - channel: PPaStream; - public - constructor Create(); overload; - constructor Create(pFormatCtx: PAVFormatContext; - pCodecCtx: PAVCodecContext; pCodec: PAVCodec; - ffmpegStreamID : Integer; ffmpegStream: PAVStream); overload; - - procedure Play(); - procedure Pause(); - procedure Stop(); - procedure Close(); - - function AudioDecodeFrame(buffer : PUInt8; bufSize: integer): integer; - end; - -type - TAudio_FFMpeg = class( TInterfacedObject, IAudioPlayback ) - private - MusicStream: TFFMpegOutputStream; - - StartSoundStream: TFFMpegOutputStream; - BackSoundStream: TFFMpegOutputStream; - SwooshSoundStream: TFFMpegOutputStream; - ChangeSoundStream: TFFMpegOutputStream; - OptionSoundStream: TFFMpegOutputStream; - ClickSoundStream: TFFMpegOutputStream; - DrumSoundStream: TFFMpegOutputStream; - HihatSoundStream: TFFMpegOutputStream; - ClapSoundStream: TFFMpegOutputStream; - ShuffleSoundStream: TFFMpegOutputStream; - - //Custom Sounds - CustomSounds: array of TCustomSoundEntry; - Loaded: boolean; - Loop: boolean; - - function FindAudioStreamID(pFormatCtx : PAVFormatContext): integer; - public - function GetName: String; - procedure InitializePlayback; - procedure SetVolume(Volume: integer); - procedure SetMusicVolume(Volume: integer); - procedure SetLoop(Enabled: boolean); - function Open(Name: string): boolean; // true if succeed - procedure Rewind; - procedure MoveTo(Time: real); - procedure Play; - procedure Pause; //Pause Mod - procedure Stop; - procedure Close; - function Finished: boolean; - function Length: real; - function getPosition: real; - procedure PlayStart; - procedure PlayBack; - procedure PlaySwoosh; - procedure PlayChange; - procedure PlayOption; - procedure PlayClick; - procedure PlayDrum; - procedure PlayHihat; - procedure PlayClap; - procedure PlayShuffle; - procedure StopShuffle; - - function LoadSoundFromFile(Name: string): TFFMpegOutputStream; - - //Equalizer - function GetFFTData: TFFTData; - - // Interface for Visualizer - function GetPCMData(var data: TPCMData): Cardinal; - - //Custom Sounds - function LoadCustomSound(const Filename: String): Cardinal; - procedure PlayCustomSound(const Index: Cardinal ); - end; - -var - test: TFFMpegOutputStream; - it: integer; - -var - singleton_MusicFFMpeg : IAudioPlayback = nil; - - -function ParseAudio(data: Pointer): integer; cdecl; forward; -procedure SDL_AudioCallback( userdata: Pointer; stream: PUInt8; len: Integer ); cdecl; forward; -function Pa_AudioCallback(input: Pointer; output: Pointer; frameCount: Longword; - timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; - userData: Pointer): Integer; cdecl; forward; - -constructor TFFMpegOutputStream.Create(); -begin - inherited; - - packetQueue := TPacketQueue.Create(); - - FillChar(pkt, sizeof(TAVPacket), #0); - - status := sStopped; - - audio_pkt_data := nil; - audio_pkt_size := 0; - - audio_buf_index := 0; - audio_buf_size := 0; -end; - -constructor TFFMpegOutputStream.Create(pFormatCtx: PAVFormatContext; - pCodecCtx: PAVCodecContext; pCodec: PAVCodec; - ffmpegStreamID : Integer; ffmpegStream: PAVStream); -begin - Create(); - - Self.pFormatCtx := pFormatCtx; - Self.pCodecCtx := pCodecCtx; - Self.pCodec := pCodec; - Self.ffmpegStreamID := ffmpegStreamID; - Self.ffmpegStream := ffmpegStream; - - test := Self; - it:=0; -end; - -procedure TFFMpegOutputStream.Play(); -var - err: TPaError; -begin - writeln('Play request'); - if(status = sStopped) then - begin - writeln('Play ok'); - status := sPlaying; - Self.parseThread := SDL_CreateThread(@ParseAudio, Self); - //SDL_PauseAudio(0); - - err := Pa_StartStream(Self.channel); - end; -end; - -procedure TFFMpegOutputStream.Pause(); -begin -end; - -procedure TFFMpegOutputStream.Stop(); -begin -end; - -procedure TFFMpegOutputStream.Close(); -begin - // Close the codec - avcodec_close(pCodecCtx); - - // Close the video file - av_close_input_file(pFormatCtx); -end; - - -function TAudio_FFMpeg.GetName: String; -begin - result := 'FFMpeg'; -end; - -procedure TAudio_FFMpeg.InitializePlayback; -begin - Log.LogStatus('InitializePlayback', 'UAudio_FFMpeg'); - - Loaded := false; - Loop := false; - - av_register_all(); - //SDL_Init(SDL_INIT_AUDIO); - Pa_Initialize(); - - StartSoundStream := LoadSoundFromFile(SoundPath + 'Common Start.mp3'); - { - BackSoundStream := LoadSoundFromFile(SoundPath + 'Common Back.mp3'); - SwooshSoundStream := LoadSoundFromFile(SoundPath + 'menu swoosh.mp3'); - ChangeSoundStream := LoadSoundFromFile(SoundPath + 'select music change music 50.mp3'); - OptionSoundStream := LoadSoundFromFile(SoundPath + 'option change col.mp3'); - ClickSoundStream := LoadSoundFromFile(SoundPath + 'rimshot022b.mp3'); - } -// DrumSoundStream := LoadSoundFromFile(SoundPath + 'bassdrumhard076b.mp3'); -// HihatSoundStream := LoadSoundFromFile(SoundPath + 'hihatclosed068b.mp3'); -// ClapSoundStream := LoadSoundFromFile(SoundPath + 'claps050b.mp3'); - -// ShuffleSoundStream := LoadSoundFromFile(SoundPath + 'Shuffle.mp3'); -end; - - -procedure TAudio_FFMpeg.SetVolume(Volume: integer); -begin - //New: Sets Volume only for this Application -(* - BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); -*) -end; - -procedure TAudio_FFMpeg.SetMusicVolume(Volume: Integer); -begin - //Max Volume Prevention - if Volume > 100 then - Volume := 100; - - if Volume < 0 then - Volume := 0; - - - //Set Volume -// BASS_ChannelSetAttributes (Bass, -1, Volume, -101); -end; - -procedure TAudio_FFMpeg.SetLoop(Enabled: boolean); -begin - Loop := Enabled; -end; - -function TAudio_FFMpeg.Open(Name: string): boolean; -begin - Loaded := false; - if FileExists(Name) then - begin -// Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); - - Loaded := true; - //Set Max Volume - SetMusicVolume (100); - end; - - Result := Loaded; -end; - -procedure TAudio_FFMpeg.Rewind; -begin - if Loaded then - begin - end; -end; - -procedure TAudio_FFMpeg.MoveTo(Time: real); -var - bytes: integer; -begin -// bytes := BASS_ChannelSeconds2Bytes(Bass, Time); -// BASS_ChannelSetPosition(Bass, bytes); -end; - -procedure TAudio_FFMpeg.Play; -begin - if MusicStream <> nil then - if Loaded then - begin - if Loop then - begin - end; - // start from beginning... - // actually bass itself does not loop, nor does this TAudio_FFMpeg Class - MusicStream.Play(); - end; -end; - -procedure TAudio_FFMpeg.Pause; //Pause Mod -begin - if MusicStream <> nil then - if Loaded then begin - MusicStream.Pause(); // Pauses Song - end; -end; - -procedure TAudio_FFMpeg.Stop; -begin - if MusicStream <> nil then - MusicStream.Stop(); -end; - -procedure TAudio_FFMpeg.Close; -begin - if MusicStream <> nil then - MusicStream.Close(); -end; - -function TAudio_FFMpeg.Length: real; -var - bytes: integer; -begin - Result := MusicStream.pFormatCtx^.duration / AV_TIME_BASE; -end; - -function TAudio_FFMpeg.getPosition: real; -var - bytes: integer; -begin - Result := 0; - -(* - bytes := BASS_ChannelGetPosition(BASS); - Result := BASS_ChannelBytes2Seconds(BASS, bytes); -*) -end; - -function TAudio_FFMpeg.Finished: boolean; -begin - Result := false; - -(* - if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then - begin - Result := true; - end; -*) -end; - -procedure TAudio_FFMpeg.PlayStart; -begin - if StartSoundStream <> nil then - StartSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayBack; -begin - if BackSoundStream <> nil then - BackSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlaySwoosh; -begin - if SwooshSoundStream <> nil then - SwooshSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayChange; -begin - if ChangeSoundStream <> nil then - ChangeSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayOption; -begin - if OptionSoundStream <> nil then - OptionSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayClick; -begin - if ClickSoundStream <> nil then - ClickSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayDrum; -begin - if DrumSoundStream <> nil then - DrumSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayHihat; -begin - if HihatSoundStream <> nil then - HihatSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayClap; -begin - if ClapSoundStream <> nil then - ClapSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayShuffle; -begin - if ShuffleSoundStream <> nil then - ShuffleSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.StopShuffle; -begin - if ShuffleSoundStream <> nil then - ShuffleSoundStream.Stop(); -end; - - -function TFFMpegOutputStream.AudioDecodeFrame(buffer : PUInt8; bufSize: integer): integer; -var - len1, - data_size: integer; -begin - result := -1; - - if (buffer = nil) then - exit; - - while true do - begin - while (audio_pkt_size > 0) do - begin -// writeln( 'got audio packet' ); - data_size := bufSize; - - if(pCodecCtx = nil) then begin - writeln('Das wars'); - exit; - end; - - // TODO: should be avcodec_decode_audio2 but this wont link on my ubuntu box. - len1 := avcodec_decode_audio(pCodecCtx, Pointer(buffer), - data_size, audio_pkt_data, audio_pkt_size); - - //writeln('avcodec_decode_audio : ' + inttostr( len1 )); - - if(len1 < 0) then - begin - // if error, skip frame -// writeln( 'Skip audio frame' ); - audio_pkt_size := 0; - break; - end; - - audio_pkt_data := audio_pkt_data + len1; - audio_pkt_size := audio_pkt_size + len1; - - if (data_size <= 0) then - begin - // No data yet, get more frames - continue; - end; - - // We have data, return it and come back for more later - result := data_size; - exit; - end; - - inc(it); - if (pkt.data <> nil) then - begin - av_free_packet(pkt); - end; - - if (packetQueue.quit) then - begin - result := -1; - exit; - end; - writeln(it); - if (packetQueue.Get(pkt, true) < 0) then - begin - result := -1; - exit; - end; - - audio_pkt_data := PChar(pkt.data); - audio_pkt_size := pkt.size; -// writeln( 'Audio Packet Size - ' + inttostr(audio_pkt_size) ); - end; -end; - -procedure SDL_AudioCallback(userdata: Pointer; stream: PUInt8; len: Integer); cdecl; -var - outStream : TFFMpegOutputStream; - len1, - audio_size : integer; - pSrc : Pointer; -begin - outStream := TFFMpegOutputStream(userdata); - - while (len > 0) do - with outStream do begin - if (audio_buf_index >= audio_buf_size) then - begin - // We have already sent all our data; get more - audio_size := AudioDecodeFrame(@audio_buf, sizeof(TAudioBuffer)); - //writeln('audio_decode_frame : '+ inttostr(audio_size)); - - if(audio_size < 0) then - begin - // If error, output silence - audio_buf_size := 1024; - FillChar(audio_buf, audio_buf_size, #0); - //writeln( 'Silence' ); - end - else - begin - audio_buf_size := audio_size; - end; - audio_buf_index := 0; // Todo : jb - SegFault ? - end; - - len1 := audio_buf_size - audio_buf_index; - if (len1 > len) then - len1 := len; - - pSrc := PChar(@audio_buf) + audio_buf_index; - {$ifdef WIN32} - CopyMemory(stream, pSrc , len1); - {$else} - memcpy(stream, pSrc , len1); - {$endif} - - Dec(len, len1); - Inc(stream, len1); - Inc(audio_buf_index, len1); - end; -end; - -function Pa_AudioCallback(input: Pointer; output: Pointer; frameCount: Longword; - timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; - userData: Pointer): Integer; cdecl; -var - outStream : TFFMpegOutputStream; - len1, - audio_size : integer; - pSrc : Pointer; - len : integer; -begin - outStream := TFFMpegOutputStream(userData); - len := frameCount * 4; // use *2 for mono-files - - while (len > 0) do - with outStream do begin - if (audio_buf_index >= audio_buf_size) then - begin - // We have already sent all our data; get more - audio_size := AudioDecodeFrame(@audio_buf, sizeof(TAudioBuffer)); - //writeln('audio_decode_frame : '+ inttostr(audio_size)); - - if(audio_size < 0) then - begin - // If error, output silence - audio_buf_size := 1024; - FillChar(audio_buf, audio_buf_size, #0); - //writeln( 'Silence' ); - end - else - begin - audio_buf_size := audio_size; - end; - audio_buf_index := 0; // Todo : jb - SegFault ? - end; - - len1 := audio_buf_size - audio_buf_index; - if (len1 > len) then - len1 := len; - - pSrc := PChar(@audio_buf) + audio_buf_index; - {$ifdef WIN32} - CopyMemory(output, pSrc , len1); - {$else} - memcpy(output, pSrc , len1); - {$endif} - - Dec(len, len1); - Inc(PChar(output), len1); - Inc(audio_buf_index, len1); - end; - - result := paContinue; -end; - -function TAudio_FFMpeg.FindAudioStreamID(pFormatCtx : PAVFormatContext): integer; -var - i : integer; - streamID: integer; - stream : PAVStream; -begin - // Find the first audio stream - streamID := -1; - - for i := 0 to pFormatCtx^.nb_streams-1 do - begin - //Log.LogStatus('aFormatCtx.streams[i] : ' + inttostr(i), 'UAudio_FFMpeg'); - stream := pFormatCtx^.streams[i]; - - if ( stream.codec^.codec_type = CODEC_TYPE_AUDIO ) then - begin - Log.LogStatus('Found Audio Stream', 'UAudio_FFMpeg'); - streamID := i; - break; - end; - end; - - result := streamID; -end; - -function ParseAudio(data: Pointer): integer; cdecl; -var - packet: TAVPacket; - stream: TFFMpegOutputStream; -begin - stream := TFFMpegOutputStream(data); - - while (av_read_frame(stream.pFormatCtx, packet) >= 0) do - begin - //writeln( 'ffmpeg - av_read_frame' ); - - if (packet.stream_index = stream.ffmpegStreamID) then - begin - //writeln( 'packet_queue_put' ); - stream.packetQueue.put(@packet); - end - else - begin - av_free_packet(packet); - end; - end; - - //Writeln('Done: ' + inttostr(stream.packetQueue.nbPackets)); - - result := 0; -end; - - -function TAudio_FFMpeg.LoadSoundFromFile(Name: string): TFFMpegOutputStream; -var - pFormatCtx : PAVFormatContext; - pCodecCtx : PAVCodecContext; - pCodec : PAVCodec; - ffmpegStreamID : Integer; - ffmpegStream : PAVStream; - wanted_spec, - spec : TSDL_AudioSpec; - csIndex : integer; - stream : TFFMpegOutputStream; - err : TPaError; -begin - result := nil; - - if (not FileExists(Name)) then - begin - Log.LogStatus('LoadSoundFromFile: Sound not found "' + Name + '"', 'UAudio_FFMpeg'); - exit; - end; - - // Open audio file - if (av_open_input_file(pFormatCtx, PChar(Name), nil, 0, nil) > 0) then - exit; - - // Retrieve stream information - if (av_find_stream_info(pFormatCtx) < 0) then - exit; - - dump_format(pFormatCtx, 0, pchar(Name), 0); - - ffmpegStreamID := FindAudioStreamID(pFormatCtx); - if (ffmpegStreamID < 0) then - exit; - - //Log.LogStatus('Audio Stream ID is : '+ inttostr(ffmpegStreamID), 'UAudio_FFMpeg'); - - ffmpegStream := pFormatCtx.streams[ffmpegStreamID]; - pCodecCtx := ffmpegStream^.codec; - - pCodec := avcodec_find_decoder(pCodecCtx^.codec_id); - if (pCodec = nil) then - begin - Log.LogStatus('Unsupported codec!', 'UAudio_FFMpeg'); - exit; - end; - - avcodec_open(pCodecCtx, pCodec); - //writeln( 'Opened the codec' ); - - stream := TFFMpegOutputStream.Create(pFormatCtx, pCodecCtx, pCodec, - ffmpegStreamID, ffmpegStream); - - { - // Set SDL audio settings from codec info - wanted_spec.freq := pCodecCtx^.sample_rate; - wanted_spec.format := AUDIO_S16SYS; - wanted_spec.channels := pCodecCtx^.channels; - wanted_spec.silence := 0; - wanted_spec.samples := SDL_AUDIO_BUFFER_SIZE; - wanted_spec.callback := AudioCallback; - wanted_spec.userdata := stream; - - // TODO: this works only one time (?) - if (SDL_OpenAudio(@wanted_spec, @spec) < 0) then - begin - Log.LogStatus('SDL_OpenAudio: '+SDL_GetError(), 'UAudio_FFMpeg'); - stream.Free(); - exit; - end; - } - - err := Pa_OpenDefaultStream(stream.channel, 0, pCodecCtx^.channels, paInt16, - pCodecCtx^.sample_rate, SDL_AUDIO_BUFFER_SIZE div 4, //paFramesPerBufferUnspecified, - @PA_AudioCallback, stream); - if(err <> paNoError) then begin - Log.LogStatus('Pa_OpenDefaultStream: '+Pa_GetErrorText(err), 'UAudio_FFMpeg'); - stream.Free(); - exit; - end; - - Log.LogStatus('SDL opened audio device', 'UAudio_FFMpeg'); - - //Add CustomSound - csIndex := High(CustomSounds) + 1; - SetLength (CustomSounds, csIndex + 1); - CustomSounds[csIndex].Filename := Name; - CustomSounds[csIndex].Stream := stream; - - result := stream; -end; - -//Equalizer -function TAudio_FFMpeg.GetFFTData: TFFTData; -var - data: TFFTData; -begin - //Get Channel Data Mono and 256 Values -// BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); - result := data; -end; - -// Interface for Visualizer -function TAudio_FFMpeg.GetPCMData(var data: TPCMData): Cardinal; -begin - result := 0; -end; - -function TAudio_FFMpeg.LoadCustomSound(const Filename: String): Cardinal; -var - S: TFFMpegOutputStream; - I: Integer; - F: String; -begin - //Search for Sound in already loaded Sounds - F := UpperCase(SoundPath + FileName); - For I := 0 to High(CustomSounds) do - begin - if (UpperCase(CustomSounds[I].Filename) = F) then - begin - Result := I; - Exit; - end; - end; - - S := LoadSoundFromFile(SoundPath + Filename); - if (S <> nil) then - Result := High(CustomSounds) - else - Result := 0; -end; - -procedure TAudio_FFMpeg.PlayCustomSound(const Index: Cardinal ); -begin - if Index <= High(CustomSounds) then - (CustomSounds[Index].Stream as TFFMpegOutputStream).Play(); -end; - - -constructor TPacketQueue.Create(); -begin - inherited; - - firstPkt := nil; - lastPkt := nil; - nbPackets := 0; - size := 0; - - mutex := SDL_CreateMutex(); - cond := SDL_CreateCond(); -end; - -function TPacketQueue.Put(pkt : PAVPacket): integer; -var - pkt1 : PAVPacketList; -begin - result := -1; - - if (av_dup_packet(pkt) < 0) then - exit; - - pkt1 := av_malloc(sizeof(TAVPacketList)); - if (pkt1 = nil) then - exit; - - pkt1^.pkt := pkt^; - pkt1^.next := nil; - - - SDL_LockMutex(Self.mutex); - try - - if (Self.lastPkt = nil) then - Self.firstPkt := pkt1 - else - Self.lastPkt^.next := pkt1; - - Self.lastPkt := pkt1; - inc(Self.nbPackets); - - Writeln('Put: ' + inttostr(nbPackets)); - - Self.size := Self.size + pkt1^.pkt.size; - SDL_CondSignal(Self.cond); - - finally - SDL_UnlockMutex(Self.mutex); - end; - - result := 0; -end; - -function TPacketQueue.Get(var pkt: TAVPacket; block: boolean): integer; -var - pkt1 : PAVPacketList; -begin - result := -1; - - SDL_LockMutex(Self.mutex); - try - while true do - begin - if (quit) then - exit; - - pkt1 := Self.firstPkt; - - if (pkt1 <> nil) then - begin - Self.firstPkt := pkt1.next; - if (Self.firstPkt = nil) then - Self.lastPkt := nil; - dec(Self.nbPackets); - - Writeln('Get: ' + inttostr(nbPackets)); - - Self.size := Self.size - pkt1^.pkt.size; - pkt := pkt1^.pkt; - av_free(pkt1); - - result := 1; - break; - end - else - if (not block) then - begin - result := 0; - break; - end - else - begin - SDL_CondWait(Self.cond, Self.mutex); - end; - end; - finally - SDL_UnlockMutex(Self.mutex); - end; -end; - - - -initialization - singleton_MusicFFMpeg := TAudio_FFMpeg.create(); - - writeln( 'UAudio_FFMpeg - Register Playback' ); - AudioManager.add( IAudioPlayback( singleton_MusicFFMpeg ) ); - -finalization - AudioManager.Remove( IAudioPlayback( singleton_MusicFFMpeg ) ); - - -end. +unit UAudio_FFMpeg_Pa; + +(******************************************************************************* + +This unit is primarily based upon - + http://www.dranger.com/ffmpeg/ffmpegtutorial_all.html + + and tutorial03.c + + http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html + +*******************************************************************************) + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +uses Classes, + {$IFDEF win32} + windows, + {$ENDIF} + Messages, + SysUtils, + {$IFNDEF FPC} + Forms, + {$ENDIF} + SDL, // Used for Audio output Interface + avcodec, // FFMpeg Audio file decoding + avformat, + avutil, + ULog, + UMusic; + +implementation + +uses + {$IFDEF LAZARUS} + lclintf, + {$ifndef win32} + libc, // not available in win32 + {$endif} + {$ENDIF} + portaudio, + UIni, + UMain, + UThemes; + + +type + PPacketQueue = ^TPacketQueue; + TPacketQueue = class + private + firstPkt, + lastPkt : PAVPacketList; + nbPackets : integer; + size : integer; + mutex : PSDL_Mutex; + cond : PSDL_Cond; + quit : boolean; + + public + constructor Create(); + + function Put(pkt : PAVPacket): integer; + function Get(var pkt: TAVPacket; block: boolean): integer; + end; + +type + TStreamStatus = (sNotReady, sStopped, sPlaying, sSeeking, sPaused, sOpen); + +const + StreamStatusStr: array[TStreamStatus] of string = ('Not ready', 'Stopped', 'Playing', 'Seeking', 'Paused', 'Open'); + +type + PAudioBuffer = ^TAudioBuffer; + TAudioBuffer = array[0 .. (AVCODEC_MAX_AUDIO_FRAME_SIZE * 3 div 2)-1] of byte; + +const + SDL_AUDIO_BUFFER_SIZE = 1024; + +type + TFFMpegOutputStream = class(TAudioOutputStream) + private + parseThread: PSDL_Thread; + packetQueue: TPacketQueue; + + status: TStreamStatus; + + // FFMpeg internal data + pFormatCtx : PAVFormatContext; + pCodecCtx : PAVCodecContext; + pCodec : PAVCodec; + ffmpegStreamID : Integer; + ffmpegStream : PAVStream; + + // static vars for AudioDecodeFrame + pkt : TAVPacket; + audio_pkt_data : PChar; + audio_pkt_size : integer; + + // static vars for AudioCallback + audio_buf_index : cardinal; + audio_buf_size : cardinal; + audio_buf : TAudioBuffer; + + channel: PPaStream; + public + constructor Create(); overload; + constructor Create(pFormatCtx: PAVFormatContext; + pCodecCtx: PAVCodecContext; pCodec: PAVCodec; + ffmpegStreamID : Integer; ffmpegStream: PAVStream); overload; + + procedure Play(); + procedure Pause(); + procedure Stop(); + procedure Close(); + + function AudioDecodeFrame(buffer : PUInt8; bufSize: integer): integer; + end; + +type + TAudio_FFMpeg = class( TInterfacedObject, IAudioPlayback ) + private + MusicStream: TFFMpegOutputStream; + + StartSoundStream: TFFMpegOutputStream; + BackSoundStream: TFFMpegOutputStream; + SwooshSoundStream: TFFMpegOutputStream; + ChangeSoundStream: TFFMpegOutputStream; + OptionSoundStream: TFFMpegOutputStream; + ClickSoundStream: TFFMpegOutputStream; + DrumSoundStream: TFFMpegOutputStream; + HihatSoundStream: TFFMpegOutputStream; + ClapSoundStream: TFFMpegOutputStream; + ShuffleSoundStream: TFFMpegOutputStream; + + //Custom Sounds + CustomSounds: array of TCustomSoundEntry; + Loaded: boolean; + Loop: boolean; + + function FindAudioStreamID(pFormatCtx : PAVFormatContext): integer; + public + function GetName: String; + procedure InitializePlayback; + procedure SetVolume(Volume: integer); + procedure SetMusicVolume(Volume: integer); + procedure SetLoop(Enabled: boolean); + function Open(Name: string): boolean; // true if succeed + procedure Rewind; + procedure MoveTo(Time: real); + procedure Play; + procedure Pause; //Pause Mod + procedure Stop; + procedure Close; + function Finished: boolean; + function Length: real; + function getPosition: real; + procedure PlayStart; + procedure PlayBack; + procedure PlaySwoosh; + procedure PlayChange; + procedure PlayOption; + procedure PlayClick; + procedure PlayDrum; + procedure PlayHihat; + procedure PlayClap; + procedure PlayShuffle; + procedure StopShuffle; + + function LoadSoundFromFile(Name: string): TFFMpegOutputStream; + + //Equalizer + function GetFFTData: TFFTData; + + // Interface for Visualizer + function GetPCMData(var data: TPCMData): Cardinal; + + //Custom Sounds + function LoadCustomSound(const Filename: String): Cardinal; + procedure PlayCustomSound(const Index: Cardinal ); + end; + +var + test: TFFMpegOutputStream; + it: integer; + +var + singleton_MusicFFMpeg : IAudioPlayback = nil; + + +function ParseAudio(data: Pointer): integer; cdecl; forward; +procedure SDL_AudioCallback( userdata: Pointer; stream: PUInt8; len: Integer ); cdecl; forward; +function Pa_AudioCallback(input: Pointer; output: Pointer; frameCount: Longword; + timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; + userData: Pointer): Integer; cdecl; forward; + +constructor TFFMpegOutputStream.Create(); +begin + inherited; + + packetQueue := TPacketQueue.Create(); + + FillChar(pkt, sizeof(TAVPacket), #0); + + status := sStopped; + + audio_pkt_data := nil; + audio_pkt_size := 0; + + audio_buf_index := 0; + audio_buf_size := 0; +end; + +constructor TFFMpegOutputStream.Create(pFormatCtx: PAVFormatContext; + pCodecCtx: PAVCodecContext; pCodec: PAVCodec; + ffmpegStreamID : Integer; ffmpegStream: PAVStream); +begin + Create(); + + Self.pFormatCtx := pFormatCtx; + Self.pCodecCtx := pCodecCtx; + Self.pCodec := pCodec; + Self.ffmpegStreamID := ffmpegStreamID; + Self.ffmpegStream := ffmpegStream; + + test := Self; + it:=0; +end; + +procedure TFFMpegOutputStream.Play(); +var + err: TPaError; +begin + writeln('Play request'); + if(status = sStopped) then + begin + writeln('Play ok'); + status := sPlaying; + Self.parseThread := SDL_CreateThread(@ParseAudio, Self); + //SDL_PauseAudio(0); + + err := Pa_StartStream(Self.channel); + end; +end; + +procedure TFFMpegOutputStream.Pause(); +begin +end; + +procedure TFFMpegOutputStream.Stop(); +begin +end; + +procedure TFFMpegOutputStream.Close(); +begin + // Close the codec + avcodec_close(pCodecCtx); + + // Close the video file + av_close_input_file(pFormatCtx); +end; + + +function TAudio_FFMpeg.GetName: String; +begin + result := 'FFMpeg'; +end; + +procedure TAudio_FFMpeg.InitializePlayback; +begin + Log.LogStatus('InitializePlayback', 'UAudio_FFMpeg'); + + Loaded := false; + Loop := false; + + av_register_all(); + //SDL_Init(SDL_INIT_AUDIO); + Pa_Initialize(); + + StartSoundStream := LoadSoundFromFile(SoundPath + 'Common start.mp3'); + { + BackSoundStream := LoadSoundFromFile(SoundPath + 'Common Back.mp3'); + SwooshSoundStream := LoadSoundFromFile(SoundPath + 'menu swoosh.mp3'); + ChangeSoundStream := LoadSoundFromFile(SoundPath + 'select music change music 50.mp3'); + OptionSoundStream := LoadSoundFromFile(SoundPath + 'option change col.mp3'); + ClickSoundStream := LoadSoundFromFile(SoundPath + 'rimshot022b.mp3'); + } +// DrumSoundStream := LoadSoundFromFile(SoundPath + 'bassdrumhard076b.mp3'); +// HihatSoundStream := LoadSoundFromFile(SoundPath + 'hihatclosed068b.mp3'); +// ClapSoundStream := LoadSoundFromFile(SoundPath + 'claps050b.mp3'); + +// ShuffleSoundStream := LoadSoundFromFile(SoundPath + 'Shuffle.mp3'); +end; + + +procedure TAudio_FFMpeg.SetVolume(Volume: integer); +begin + //New: Sets Volume only for this Application +(* + BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); +*) +end; + +procedure TAudio_FFMpeg.SetMusicVolume(Volume: Integer); +begin + //Max Volume Prevention + if Volume > 100 then + Volume := 100; + + if Volume < 0 then + Volume := 0; + + + //Set Volume +// BASS_ChannelSetAttributes (Bass, -1, Volume, -101); +end; + +procedure TAudio_FFMpeg.SetLoop(Enabled: boolean); +begin + Loop := Enabled; +end; + +function TAudio_FFMpeg.Open(Name: string): boolean; +begin + Loaded := false; + if FileExists(Name) then + begin +// Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); + + Loaded := true; + //Set Max Volume + SetMusicVolume (100); + end; + + Result := Loaded; +end; + +procedure TAudio_FFMpeg.Rewind; +begin + if Loaded then + begin + end; +end; + +procedure TAudio_FFMpeg.MoveTo(Time: real); +var + bytes: integer; +begin +// bytes := BASS_ChannelSeconds2Bytes(Bass, Time); +// BASS_ChannelSetPosition(Bass, bytes); +end; + +procedure TAudio_FFMpeg.Play; +begin + if MusicStream <> nil then + if Loaded then + begin + if Loop then + begin + end; + // start from beginning... + // actually bass itself does not loop, nor does this TAudio_FFMpeg Class + MusicStream.Play(); + end; +end; + +procedure TAudio_FFMpeg.Pause; //Pause Mod +begin + if MusicStream <> nil then + if Loaded then begin + MusicStream.Pause(); // Pauses Song + end; +end; + +procedure TAudio_FFMpeg.Stop; +begin + if MusicStream <> nil then + MusicStream.Stop(); +end; + +procedure TAudio_FFMpeg.Close; +begin + if MusicStream <> nil then + MusicStream.Close(); +end; + +function TAudio_FFMpeg.Length: real; +var + bytes: integer; +begin + Result := 0; + // Todo : why is Music stream always nil !? + + if assigned( MusicStream ) then + begin + Result := MusicStream.pFormatCtx^.duration / AV_TIME_BASE; + end; +end; + +function TAudio_FFMpeg.getPosition: real; +var + bytes: integer; +begin + Result := 0; + +(* + bytes := BASS_ChannelGetPosition(BASS); + Result := BASS_ChannelBytes2Seconds(BASS, bytes); +*) +end; + +function TAudio_FFMpeg.Finished: boolean; +begin + Result := false; + +(* + if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then + begin + Result := true; + end; +*) +end; + +procedure TAudio_FFMpeg.PlayStart; +begin + if StartSoundStream <> nil then + StartSoundStream.Play(); +end; + +procedure TAudio_FFMpeg.PlayBack; +begin + if BackSoundStream <> nil then + BackSoundStream.Play(); +end; + +procedure TAudio_FFMpeg.PlaySwoosh; +begin + if SwooshSoundStream <> nil then + SwooshSoundStream.Play(); +end; + +procedure TAudio_FFMpeg.PlayChange; +begin + if ChangeSoundStream <> nil then + ChangeSoundStream.Play(); +end; + +procedure TAudio_FFMpeg.PlayOption; +begin + if OptionSoundStream <> nil then + OptionSoundStream.Play(); +end; + +procedure TAudio_FFMpeg.PlayClick; +begin + if ClickSoundStream <> nil then + ClickSoundStream.Play(); +end; + +procedure TAudio_FFMpeg.PlayDrum; +begin + if DrumSoundStream <> nil then + DrumSoundStream.Play(); +end; + +procedure TAudio_FFMpeg.PlayHihat; +begin + if HihatSoundStream <> nil then + HihatSoundStream.Play(); +end; + +procedure TAudio_FFMpeg.PlayClap; +begin + if ClapSoundStream <> nil then + ClapSoundStream.Play(); +end; + +procedure TAudio_FFMpeg.PlayShuffle; +begin + if ShuffleSoundStream <> nil then + ShuffleSoundStream.Play(); +end; + +procedure TAudio_FFMpeg.StopShuffle; +begin + if ShuffleSoundStream <> nil then + ShuffleSoundStream.Stop(); +end; + + +function TFFMpegOutputStream.AudioDecodeFrame(buffer : PUInt8; bufSize: integer): integer; +var + len1, + data_size: integer; +begin + result := -1; + + if (buffer = nil) then + exit; + + while true do + begin + while (audio_pkt_size > 0) do + begin +// writeln( 'got audio packet' ); + data_size := bufSize; + + if(pCodecCtx = nil) then begin +// writeln('Das wars'); + exit; + end; + + // TODO: should be avcodec_decode_audio2 but this wont link on my ubuntu box. + len1 := avcodec_decode_audio(pCodecCtx, Pointer(buffer), + data_size, audio_pkt_data, audio_pkt_size); + + //writeln('avcodec_decode_audio : ' + inttostr( len1 )); + + if(len1 < 0) then + begin + // if error, skip frame +// writeln( 'Skip audio frame' ); + audio_pkt_size := 0; + break; + end; + + audio_pkt_data := audio_pkt_data + len1; + audio_pkt_size := audio_pkt_size + len1; + + if (data_size <= 0) then + begin + // No data yet, get more frames + continue; + end; + + // We have data, return it and come back for more later + result := data_size; + exit; + end; + + inc(it); + if (pkt.data <> nil) then + begin + av_free_packet(pkt); + end; + + if (packetQueue.quit) then + begin + result := -1; + exit; + end; +// writeln(it); + if (packetQueue.Get(pkt, true) < 0) then + begin + result := -1; + exit; + end; + + audio_pkt_data := PChar(pkt.data); + audio_pkt_size := pkt.size; +// writeln( 'Audio Packet Size - ' + inttostr(audio_pkt_size) ); + end; +end; + +procedure SDL_AudioCallback(userdata: Pointer; stream: PUInt8; len: Integer); cdecl; +var + outStream : TFFMpegOutputStream; + len1, + audio_size : integer; + pSrc : Pointer; +begin + outStream := TFFMpegOutputStream(userdata); + + while (len > 0) do + with outStream do begin + if (audio_buf_index >= audio_buf_size) then + begin + // We have already sent all our data; get more + audio_size := AudioDecodeFrame(@audio_buf, sizeof(TAudioBuffer)); + //writeln('audio_decode_frame : '+ inttostr(audio_size)); + + if(audio_size < 0) then + begin + // If error, output silence + audio_buf_size := 1024; + FillChar(audio_buf, audio_buf_size, #0); + //writeln( 'Silence' ); + end + else + begin + audio_buf_size := audio_size; + end; + audio_buf_index := 0; // Todo : jb - SegFault ? + end; + + len1 := audio_buf_size - audio_buf_index; + if (len1 > len) then + len1 := len; + + pSrc := PChar(@audio_buf) + audio_buf_index; + {$ifdef WIN32} + CopyMemory(stream, pSrc , len1); + {$else} + memcpy(stream, pSrc , len1); + {$endif} + + Dec(len, len1); + Inc(stream, len1); + Inc(audio_buf_index, len1); + end; +end; + +function Pa_AudioCallback(input: Pointer; output: Pointer; frameCount: Longword; + timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; + userData: Pointer): Integer; cdecl; +var + outStream : TFFMpegOutputStream; + len1, + audio_size : integer; + pSrc : Pointer; + len : integer; +begin + outStream := TFFMpegOutputStream(userData); + len := frameCount * 2; // use *2 for mono-files + + while (len > 0) do + with outStream do begin + if (audio_buf_index >= audio_buf_size) then + begin + // We have already sent all our data; get more + audio_size := AudioDecodeFrame(@audio_buf, sizeof(TAudioBuffer)); + //writeln('audio_decode_frame : '+ inttostr(audio_size)); + + if(audio_size < 0) then + begin + // If error, output silence + audio_buf_size := 1024; + FillChar(audio_buf, audio_buf_size, #0); + //writeln( 'Silence' ); + end + else + begin + audio_buf_size := audio_size; + end; + audio_buf_index := 0; // Todo : jb - SegFault ? + end; + + len1 := audio_buf_size - audio_buf_index; + if (len1 > len) then + len1 := len; + + pSrc := PChar(@audio_buf) + audio_buf_index; + {$ifdef WIN32} + CopyMemory(output, pSrc , len1); + {$else} + memcpy(output, pSrc , len1); + {$endif} + + Dec(len, len1); + Inc(PChar(output), len1); + Inc(audio_buf_index, len1); + end; + + result := paContinue; +end; + +function TAudio_FFMpeg.FindAudioStreamID(pFormatCtx : PAVFormatContext): integer; +var + i : integer; + streamID: integer; + stream : PAVStream; +begin + // Find the first audio stream + streamID := -1; + + for i := 0 to pFormatCtx^.nb_streams-1 do + begin + //Log.LogStatus('aFormatCtx.streams[i] : ' + inttostr(i), 'UAudio_FFMpeg'); + stream := pFormatCtx^.streams[i]; + + if ( stream.codec^.codec_type = CODEC_TYPE_AUDIO ) then + begin + Log.LogStatus('Found Audio Stream', 'UAudio_FFMpeg'); + streamID := i; + break; + end; + end; + + result := streamID; +end; + +function ParseAudio(data: Pointer): integer; cdecl; +var + packet: TAVPacket; + stream: TFFMpegOutputStream; +begin + stream := TFFMpegOutputStream(data); + + while (av_read_frame(stream.pFormatCtx, packet) >= 0) do + begin + //writeln( 'ffmpeg - av_read_frame' ); + + if (packet.stream_index = stream.ffmpegStreamID) then + begin + //writeln( 'packet_queue_put' ); + stream.packetQueue.put(@packet); + end + else + begin + av_free_packet(packet); + end; + end; + + //Writeln('Done: ' + inttostr(stream.packetQueue.nbPackets)); + + result := 0; +end; + + +function TAudio_FFMpeg.LoadSoundFromFile(Name: string): TFFMpegOutputStream; +var + pFormatCtx : PAVFormatContext; + pCodecCtx : PAVCodecContext; + pCodec : PAVCodec; + ffmpegStreamID : Integer; + ffmpegStream : PAVStream; + wanted_spec, + spec : TSDL_AudioSpec; + csIndex : integer; + stream : TFFMpegOutputStream; + err : TPaError; +begin + result := nil; + + if (not FileExists(Name)) then + begin + Log.LogStatus('LoadSoundFromFile: Sound not found "' + Name + '"', 'UAudio_FFMpeg'); + writeln('ERROR : LoadSoundFromFile: Sound not found "' + Name + '"', 'UAudio_FFMpeg'); + exit; + end; + + // Open audio file + if (av_open_input_file(pFormatCtx, PChar(Name), nil, 0, nil) > 0) then + exit; + + // Retrieve stream information + if (av_find_stream_info(pFormatCtx) < 0) then + exit; + + dump_format(pFormatCtx, 0, pchar(Name), 0); + + ffmpegStreamID := FindAudioStreamID(pFormatCtx); + if (ffmpegStreamID < 0) then + exit; + + //Log.LogStatus('Audio Stream ID is : '+ inttostr(ffmpegStreamID), 'UAudio_FFMpeg'); + + ffmpegStream := pFormatCtx.streams[ffmpegStreamID]; + pCodecCtx := ffmpegStream^.codec; + + pCodec := avcodec_find_decoder(pCodecCtx^.codec_id); + if (pCodec = nil) then + begin + Log.LogStatus('Unsupported codec!', 'UAudio_FFMpeg'); + exit; + end; + + avcodec_open(pCodecCtx, pCodec); + //writeln( 'Opened the codec' ); + + stream := TFFMpegOutputStream.Create(pFormatCtx, pCodecCtx, pCodec, + ffmpegStreamID, ffmpegStream); + + { + // Set SDL audio settings from codec info + wanted_spec.freq := pCodecCtx^.sample_rate; + wanted_spec.format := AUDIO_S16SYS; + wanted_spec.channels := pCodecCtx^.channels; + wanted_spec.silence := 0; + wanted_spec.samples := SDL_AUDIO_BUFFER_SIZE; + wanted_spec.callback := AudioCallback; + wanted_spec.userdata := stream; + + // TODO: this works only one time (?) + if (SDL_OpenAudio(@wanted_spec, @spec) < 0) then + begin + Log.LogStatus('SDL_OpenAudio: '+SDL_GetError(), 'UAudio_FFMpeg'); + stream.Free(); + exit; + end; + } + + err := Pa_OpenDefaultStream(stream.channel, 0, pCodecCtx^.channels, paInt16, + pCodecCtx^.sample_rate, SDL_AUDIO_BUFFER_SIZE div 2, //paFramesPerBufferUnspecified, + @PA_AudioCallback, stream); + if(err <> paNoError) then begin + Log.LogStatus('Pa_OpenDefaultStream: '+Pa_GetErrorText(err), 'UAudio_FFMpeg'); + stream.Free(); + exit; + end; + + Log.LogStatus('SDL opened audio device', 'UAudio_FFMpeg'); + + //Add CustomSound + csIndex := High(CustomSounds) + 1; + SetLength (CustomSounds, csIndex + 1); + CustomSounds[csIndex].Filename := Name; + CustomSounds[csIndex].Stream := stream; + + result := stream; +end; + +//Equalizer +function TAudio_FFMpeg.GetFFTData: TFFTData; +var + data: TFFTData; +begin + //Get Channel Data Mono and 256 Values +// BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); + result := data; +end; + +// Interface for Visualizer +function TAudio_FFMpeg.GetPCMData(var data: TPCMData): Cardinal; +begin + result := 0; +end; + +function TAudio_FFMpeg.LoadCustomSound(const Filename: String): Cardinal; +var + S: TFFMpegOutputStream; + I: Integer; + F: String; +begin + //Search for Sound in already loaded Sounds + F := UpperCase(SoundPath + FileName); + For I := 0 to High(CustomSounds) do + begin + if (UpperCase(CustomSounds[I].Filename) = F) then + begin + Result := I; + Exit; + end; + end; + + S := LoadSoundFromFile(SoundPath + Filename); + if (S <> nil) then + Result := High(CustomSounds) + else + Result := 0; +end; + +procedure TAudio_FFMpeg.PlayCustomSound(const Index: Cardinal ); +begin + if Index <= High(CustomSounds) then + (CustomSounds[Index].Stream as TFFMpegOutputStream).Play(); +end; + + +constructor TPacketQueue.Create(); +begin + inherited; + + firstPkt := nil; + lastPkt := nil; + nbPackets := 0; + size := 0; + + mutex := SDL_CreateMutex(); + cond := SDL_CreateCond(); +end; + +function TPacketQueue.Put(pkt : PAVPacket): integer; +var + pkt1 : PAVPacketList; +begin + result := -1; + + if (av_dup_packet(pkt) < 0) then + exit; + + pkt1 := av_malloc(sizeof(TAVPacketList)); + if (pkt1 = nil) then + exit; + + pkt1^.pkt := pkt^; + pkt1^.next := nil; + + + SDL_LockMutex(Self.mutex); + try + + if (Self.lastPkt = nil) then + Self.firstPkt := pkt1 + else + Self.lastPkt^.next := pkt1; + + Self.lastPkt := pkt1; + inc(Self.nbPackets); + +// Writeln('Put: ' + inttostr(nbPackets)); + + Self.size := Self.size + pkt1^.pkt.size; + SDL_CondSignal(Self.cond); + + finally + SDL_UnlockMutex(Self.mutex); + end; + + result := 0; +end; + +function TPacketQueue.Get(var pkt: TAVPacket; block: boolean): integer; +var + pkt1 : PAVPacketList; +begin + result := -1; + + SDL_LockMutex(Self.mutex); + try + while true do + begin + if (quit) then + exit; + + pkt1 := Self.firstPkt; + + if (pkt1 <> nil) then + begin + Self.firstPkt := pkt1.next; + if (Self.firstPkt = nil) then + Self.lastPkt := nil; + dec(Self.nbPackets); + +// Writeln('Get: ' + inttostr(nbPackets)); + + Self.size := Self.size - pkt1^.pkt.size; + pkt := pkt1^.pkt; + av_free(pkt1); + + result := 1; + break; + end + else + if (not block) then + begin + result := 0; + break; + end + else + begin + SDL_CondWait(Self.cond, Self.mutex); + end; + end; + finally + SDL_UnlockMutex(Self.mutex); + end; +end; + + + +initialization + singleton_MusicFFMpeg := TAudio_FFMpeg.create(); + + writeln( 'UAudio_FFMpeg - Register Playback' ); + AudioManager.add( IAudioPlayback( singleton_MusicFFMpeg ) ); + +finalization + AudioManager.Remove( IAudioPlayback( singleton_MusicFFMpeg ) ); + + +end. -- cgit v1.2.3 From 252ffd6dadbce63252e5b6632ffc9daeb9484365 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 18 Dec 2007 09:42:53 +0000 Subject: Scattered sound with portaudio works now (in linux) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@726 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudio_FFMpeg.pas | 199 ++++++++++++++++++++++++++++-------- 1 file changed, 159 insertions(+), 40 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudio_FFMpeg.pas b/Game/Code/Classes/UAudio_FFMpeg.pas index 9a242cd9..ca91f095 100644 --- a/Game/Code/Classes/UAudio_FFMpeg.pas +++ b/Game/Code/Classes/UAudio_FFMpeg.pas @@ -41,8 +41,11 @@ implementation uses {$IFDEF LAZARUS} lclintf, - libc, + {$ifndef win32} + libc, // not available in win32 + {$endif} {$ENDIF} + portaudio, UIni, UMain, UThemes; @@ -104,6 +107,9 @@ type audio_buf_index : cardinal; audio_buf_size : cardinal; audio_buf : TAudioBuffer; + + paStream : PPaStream; + paFrameSize : integer; public constructor Create(); overload; constructor Create(pFormatCtx: PAVFormatContext; @@ -181,17 +187,24 @@ type procedure PlayCustomSound(const Index: Cardinal ); end; +var + test: TFFMpegOutputStream; + it: integer; + var singleton_MusicFFMpeg : IAudioPlayback = nil; function ParseAudio(data: Pointer): integer; cdecl; forward; -procedure AudioCallback( userdata: Pointer; stream: PUInt8; len: Integer ); cdecl; forward; +procedure SDL_AudioCallback( userdata: Pointer; stream: PUInt8; len: Integer ); cdecl; forward; +function Pa_AudioCallback(input: Pointer; output: Pointer; frameCount: Longword; + timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; + userData: Pointer): Integer; cdecl; forward; constructor TFFMpegOutputStream.Create(); begin inherited; - + packetQueue := TPacketQueue.Create(); FillChar(pkt, sizeof(TAVPacket), #0); @@ -210,14 +223,20 @@ constructor TFFMpegOutputStream.Create(pFormatCtx: PAVFormatContext; ffmpegStreamID : Integer; ffmpegStream: PAVStream); begin Create(); + Self.pFormatCtx := pFormatCtx; Self.pCodecCtx := pCodecCtx; Self.pCodec := pCodec; Self.ffmpegStreamID := ffmpegStreamID; Self.ffmpegStream := ffmpegStream; + + test := Self; + it:=0; end; procedure TFFMpegOutputStream.Play(); +var + err: TPaError; begin writeln('Play request'); if(status = sStopped) then @@ -225,7 +244,13 @@ begin writeln('Play ok'); status := sPlaying; Self.parseThread := SDL_CreateThread(@ParseAudio, Self); - SDL_PauseAudio(0); + //SDL_PauseAudio(0); + + err := Pa_StartStream(Self.paStream); + if(err <> paNoError) then + begin + Writeln('Play: '+ Pa_GetErrorText(err)); + end; end; end; @@ -260,11 +285,12 @@ begin Loop := false; av_register_all(); - SDL_Init(SDL_INIT_AUDIO); + //SDL_Init(SDL_INIT_AUDIO); + Pa_Initialize(); StartSoundStream := LoadSoundFromFile(SoundPath + 'Common start.mp3'); { - BackSoundStream := LoadSoundFromFile(SoundPath + 'Common back.mp3'); + BackSoundStream := LoadSoundFromFile(SoundPath + 'Common Back.mp3'); SwooshSoundStream := LoadSoundFromFile(SoundPath + 'menu swoosh.mp3'); ChangeSoundStream := LoadSoundFromFile(SoundPath + 'select music change music 50.mp3'); OptionSoundStream := LoadSoundFromFile(SoundPath + 'option change col.mp3'); @@ -380,28 +406,38 @@ begin if assigned( MusicStream ) then begin - //writeln( 'MusicStream : ' + inttostr( integer( assigned( MusicStream ))) ); - //writeln( 'MusicStream.pFormatCtx : ' + inttostr( integer( assigned( MusicStream.pFormatCtx ))) ); - //writeln( 'MusicStream.pFormatCtx^.duration : ' + inttostr( integer( MusicStream.pFormatCtx^.duration )) ); - Result := MusicStream.pFormatCtx^.duration / AV_TIME_BASE; end; end; function TAudio_FFMpeg.getPosition: real; +var + bytes: integer; begin Result := 0; + +(* + bytes := BASS_ChannelGetPosition(BASS); + Result := BASS_ChannelBytes2Seconds(BASS, bytes); +*) end; function TAudio_FFMpeg.Finished: boolean; begin Result := false; + +(* + if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then + begin + Result := true; + end; +*) end; procedure TAudio_FFMpeg.PlayStart; begin if StartSoundStream <> nil then - StartSoundStream.Play(); + StartSoundStream.Play(); end; procedure TAudio_FFMpeg.PlayBack; @@ -464,6 +500,7 @@ begin ShuffleSoundStream.Stop(); end; + function TFFMpegOutputStream.AudioDecodeFrame(buffer : PUInt8; bufSize: integer): integer; var len1, @@ -474,20 +511,23 @@ begin if (buffer = nil) then exit; - while true do - begin - + begin while (audio_pkt_size > 0) do begin // writeln( 'got audio packet' ); data_size := bufSize; + if(pCodecCtx = nil) then begin +// writeln('Das wars'); + exit; + end; + // TODO: should be avcodec_decode_audio2 but this wont link on my ubuntu box. len1 := avcodec_decode_audio(pCodecCtx, Pointer(buffer), data_size, audio_pkt_data, audio_pkt_size); -// writeln('avcodec_decode_audio : ' + inttostr( len1 )); + //writeln('avcodec_decode_audio : ' + inttostr( len1 )); if(len1 < 0) then begin @@ -506,37 +546,36 @@ begin continue; end; - // We have data, return it and come back for more later + // We have data, return it and come back for more later result := data_size; exit; end; + inc(it); if (pkt.data <> nil) then + begin av_free_packet(pkt); - - + end; if (packetQueue.quit) then begin result := -1; exit; end; - +// writeln(it); if (packetQueue.Get(pkt, true) < 0) then begin result := -1; exit; end; - audio_pkt_data := PChar(pkt.data); audio_pkt_size := pkt.size; // writeln( 'Audio Packet Size - ' + inttostr(audio_pkt_size) ); end; - end; -procedure AudioCallback(userdata: Pointer; stream: PUInt8; len: Integer); cdecl; +procedure SDL_AudioCallback(userdata: Pointer; stream: PUInt8; len: Integer); cdecl; var outStream : TFFMpegOutputStream; len1, @@ -546,21 +585,19 @@ begin outStream := TFFMpegOutputStream(userdata); while (len > 0) do - with outStream do - begin - + with outStream do begin if (audio_buf_index >= audio_buf_size) then begin // We have already sent all our data; get more audio_size := AudioDecodeFrame(@audio_buf, sizeof(TAudioBuffer)); -// writeln('audio_decode_frame : '+ inttostr(audio_size)); + //writeln('audio_decode_frame : '+ inttostr(audio_size)); if(audio_size < 0) then begin // If error, output silence audio_buf_size := 1024; FillChar(audio_buf, audio_buf_size, #0); -// writeln( 'Silence' ); + //writeln( 'Silence' ); end else begin @@ -583,9 +620,61 @@ begin Dec(len, len1); Inc(stream, len1); Inc(audio_buf_index, len1); + end; +end; + +function Pa_AudioCallback(input: Pointer; output: Pointer; frameCount: Longword; + timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; + userData: Pointer): Integer; cdecl; +var + outStream : TFFMpegOutputStream; + len1, + audio_size : integer; + pSrc : Pointer; + len : integer; +begin + outStream := TFFMpegOutputStream(userData); + len := frameCount * outStream.paFrameSize; + while (len > 0) do + with outStream do begin + if (audio_buf_index >= audio_buf_size) then + begin + // We have already sent all our data; get more + audio_size := AudioDecodeFrame(@audio_buf, sizeof(TAudioBuffer)); + //writeln('audio_decode_frame : '+ inttostr(audio_size)); + + if(audio_size < 0) then + begin + // If error, output silence + audio_buf_size := 1024; + FillChar(audio_buf, audio_buf_size, #0); + //writeln( 'Silence' ); + end + else + begin + audio_buf_size := audio_size; + end; + audio_buf_index := 0; // Todo : jb - SegFault ? + end; + + len1 := audio_buf_size - audio_buf_index; + if (len1 > len) then + len1 := len; + + pSrc := PChar(@audio_buf) + audio_buf_index; + {$ifdef WIN32} + CopyMemory(output, pSrc , len1); + {$else} + memcpy(output, pSrc , len1); + {$endif} + + Dec(len, len1); + Inc(PChar(output), len1); + Inc(audio_buf_index, len1); end; + result := paContinue; end; function TAudio_FFMpeg.FindAudioStreamID(pFormatCtx : PAVFormatContext): integer; @@ -622,7 +711,7 @@ begin while (av_read_frame(stream.pFormatCtx, packet) >= 0) do begin -// writeln( 'ffmpeg - av_read_frame' ); + //writeln( 'ffmpeg - av_read_frame' ); if (packet.stream_index = stream.ffmpegStreamID) then begin @@ -633,10 +722,9 @@ begin begin av_free_packet(packet); end; - end; -// Writeln('Done: ' + inttostr(stream.packetQueue.nbPackets)); + //Writeln('Done: ' + inttostr(stream.packetQueue.nbPackets)); result := 0; end; @@ -653,12 +741,20 @@ var spec : TSDL_AudioSpec; csIndex : integer; stream : TFFMpegOutputStream; + err : TPaError; + // move this to a portaudio specific section + paOutParams : TPaStreamParameters; + paApiInfo : PPaHostApiInfo; + paApi : TPaHostApiIndex; + paOutDevice : TPaDeviceIndex; + paOutDeviceInfo : PPaDeviceInfo; begin result := nil; if (not FileExists(Name)) then begin Log.LogStatus('LoadSoundFromFile: Sound not found "' + Name + '"', 'UAudio_FFMpeg'); + writeln('ERROR : LoadSoundFromFile: Sound not found "' + Name + '"', 'UAudio_FFMpeg'); exit; end; @@ -694,6 +790,7 @@ begin stream := TFFMpegOutputStream.Create(pFormatCtx, pCodecCtx, pCodec, ffmpegStreamID, ffmpegStream); + { // Set SDL audio settings from codec info wanted_spec.freq := pCodecCtx^.sample_rate; wanted_spec.format := AUDIO_S16SYS; @@ -708,7 +805,32 @@ begin begin Log.LogStatus('SDL_OpenAudio: '+SDL_GetError(), 'UAudio_FFMpeg'); stream.Free(); - exit + exit; + end; + } + + paApi := Pa_HostApiTypeIdToHostApiIndex(paALSA); + paApiInfo := Pa_GetHostApiInfo(paApi); + paOutDevice := paApiInfo^.defaultOutputDevice; + paOutDeviceInfo := Pa_GetDeviceInfo(paOutDevice); + + with paOutParams do begin + device := paOutDevice; + channelCount := pCodecCtx^.channels; + sampleFormat := paInt16; + suggestedLatency := paOutDeviceInfo^.defaultHighOutputLatency; + hostApiSpecificStreamInfo := nil; + end; + + stream.paFrameSize := sizeof(Smallint) * pCodecCtx^.channels; + + err := Pa_OpenStream(stream.paStream, nil, @paOutParams, pCodecCtx^.sample_rate, + paFramesPerBufferUnspecified, //SDL_AUDIO_BUFFER_SIZE div stream.paFrameSize + paNoFlag, @PA_AudioCallback, stream); + if(err <> paNoError) then begin + Log.LogStatus('Pa_OpenDefaultStream: '+Pa_GetErrorText(err), 'UAudio_FFMpeg'); + stream.Free(); + exit; end; Log.LogStatus('SDL opened audio device', 'UAudio_FFMpeg'); @@ -786,7 +908,6 @@ function TPacketQueue.Put(pkt : PAVPacket): integer; var pkt1 : PAVPacketList; begin - result := -1; if (av_dup_packet(pkt) < 0) then @@ -801,7 +922,7 @@ begin SDL_LockMutex(Self.mutex); -// try + try if (Self.lastPkt = nil) then Self.firstPkt := pkt1 @@ -816,9 +937,9 @@ begin Self.size := Self.size + pkt1^.pkt.size; SDL_CondSignal(Self.cond); -// finally + finally SDL_UnlockMutex(Self.mutex); -// end; + end; result := 0; end; @@ -827,11 +948,10 @@ function TPacketQueue.Get(var pkt: TAVPacket; block: boolean): integer; var pkt1 : PAVPacketList; begin - result := -1; SDL_LockMutex(Self.mutex); -// try + try while true do begin if (quit) then @@ -866,10 +986,9 @@ begin SDL_CondWait(Self.cond, Self.mutex); end; end; -// finally + finally SDL_UnlockMutex(Self.mutex); -// end; - + end; end; -- cgit v1.2.3 From f3ee66ae042f65832d9230dbdaec352b17420bfd Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 18 Dec 2007 12:12:15 +0000 Subject: start-sound works now. JAY: it's a '-' not a '+' git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@727 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudio_FFMpeg.pas | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudio_FFMpeg.pas b/Game/Code/Classes/UAudio_FFMpeg.pas index ca91f095..fb25b0f9 100644 --- a/Game/Code/Classes/UAudio_FFMpeg.pas +++ b/Game/Code/Classes/UAudio_FFMpeg.pas @@ -289,13 +289,12 @@ begin Pa_Initialize(); StartSoundStream := LoadSoundFromFile(SoundPath + 'Common start.mp3'); - { - BackSoundStream := LoadSoundFromFile(SoundPath + 'Common Back.mp3'); + BackSoundStream := LoadSoundFromFile(SoundPath + 'Common back.mp3'); SwooshSoundStream := LoadSoundFromFile(SoundPath + 'menu swoosh.mp3'); ChangeSoundStream := LoadSoundFromFile(SoundPath + 'select music change music 50.mp3'); OptionSoundStream := LoadSoundFromFile(SoundPath + 'option change col.mp3'); ClickSoundStream := LoadSoundFromFile(SoundPath + 'rimshot022b.mp3'); - } + // DrumSoundStream := LoadSoundFromFile(SoundPath + 'bassdrumhard076b.mp3'); // HihatSoundStream := LoadSoundFromFile(SoundPath + 'hihatclosed068b.mp3'); // ClapSoundStream := LoadSoundFromFile(SoundPath + 'claps050b.mp3'); @@ -537,8 +536,8 @@ begin break; end; - audio_pkt_data := audio_pkt_data + len1; - audio_pkt_size := audio_pkt_size + len1; + Inc(audio_pkt_data, len1); + Dec(audio_pkt_size, len1); if (data_size <= 0) then begin @@ -603,7 +602,7 @@ begin begin audio_buf_size := audio_size; end; - audio_buf_index := 0; // Todo : jb - SegFault ? + audio_buf_index := 0; end; len1 := audio_buf_size - audio_buf_index; @@ -833,7 +832,7 @@ begin exit; end; - Log.LogStatus('SDL opened audio device', 'UAudio_FFMpeg'); + Log.LogStatus('Opened audio device', 'UAudio_FFMpeg'); //Add CustomSound csIndex := High(CustomSounds) + 1; -- cgit v1.2.3 From ff85cdbd66a19dd80ed4d09b8cca7b0bf3ebf77b Mon Sep 17 00:00:00 2001 From: b1indy Date: Tue, 18 Dec 2007 15:49:16 +0000 Subject: incorporated some improvements (video scaling to full width, seeking for videogap) from 1.0.1 cleanup in UVideo.pas git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@728 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UVideo.pas | 148 ++++++++++--------------------------------- 1 file changed, 33 insertions(+), 115 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index 42971daf..4f6b566a 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -37,7 +37,6 @@ uses SDL, avcodec, avformat, avutil, -// swscale, math, OpenGL12, SysUtils, @@ -66,9 +65,6 @@ type fVideoTex : glUint; fVideoSkipTime : Single; - //remove - fTexData : array of Byte; - VideoFormatContext: PAVFormatContext; VideoStreamIndex , @@ -79,8 +75,6 @@ type AVFrameRGB: PAVFrame; myBuffer: pByte; -// SoftwareScaleContext: PSwsContext; - TexX, TexY, dataX, dataY: Cardinal; ScaledVideoWidth, ScaledVideoHeight: Real; @@ -93,8 +87,8 @@ type AudioCodecContext : PSDL_AudioSpec; aCodecCtx : PAVCodecContext; - function find_stream_ids( const aFormatCtx : PAVFormatContext; Out aFirstVideoStream, aFirstAudioStream : integer ): boolean; + public constructor create(); function GetName: String; @@ -215,9 +209,9 @@ begin {$IFDEF DebugDisplay} showmessage('Time: '+inttostr(floor(Time*1000))+#13#10+ - 'VideoTime: '+inttostr(floor(VideoTime*1000))+#13#10+ - 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ - 'TimeDiff: '+inttostr(floor(TimeDifference*1000))); + 'VideoTime: '+inttostr(floor(VideoTime*1000))+#13#10+ + 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ + 'TimeDiff: '+inttostr(floor(TimeDifference*1000))); {$endif} if (VideoTime <> 0) and (TimeDifference <= VideoTimeBase) then @@ -238,7 +232,6 @@ begin Exit;// we don't need a new frame now end; - VideoTime:=VideoTime+VideoTimeBase; TimeDifference:=myTime-VideoTime; if TimeDifference >= (FRAMEDROPCOUNT-1)*VideoTimeBase then // skip frames @@ -247,35 +240,25 @@ begin //frame drop debug display GoldenRec.Spawn(200,55,1,16,0,-1,ColoredStar,$ff0000); {$endif} - {$IFDEF DebugDisplay} - showmessage('skipping frames'+#13#10+ 'TimeBase: '+inttostr(floor(VideoTimeBase*1000))+#13#10+ 'TimeDiff: '+inttostr(floor(TimeDifference*1000))+#13#10+ 'Time2Skip: '+inttostr(floor((Time-LastFrameTime)*1000))); - {$endif} -// av_seek_frame(VideoFormatContext.,VideoStreamIndex,Floor(Time*VideoTimeBase),0); -{ av_seek_frame(VideoFormatContext,-1,Floor((myTime+VideoTimeBase)*1500000),0); - VideoTime:=floor(myTime/VideoTimeBase)*VideoTimeBase;} VideoTime:=VideoTime+FRAMEDROPCOUNT*VideoTimeBase; DropFrame:=True; end; - -// av_init_packet(@AVPacket); AVPacket.data := nil; av_init_packet( AVPacket ); // JB-ffmpeg - FrameFinished:=0; // read packets until we have a finished frame (or there are no more packets) - while ( FrameFinished = 0 ) and - ( av_read_frame(VideoFormatContext, AVPacket) >= 0 ) do // JB-ffmpeg + while ( FrameFinished = 0 ) do begin - - + if ( av_read_frame(VideoFormatContext, AVPacket) < 0 ) then + break; // if we got a packet from the video stream, then decode it if (AVPacket.stream_index=VideoStreamIndex) then begin @@ -293,7 +276,7 @@ begin end; try - if AVPacket.data <> nil then +// if AVPacket.data <> nil then av_free_packet( AVPacket ); // JB-ffmpeg except // TODO : JB_FFMpeg ... why does this now AV sometimes ( or always !! ) @@ -301,72 +284,46 @@ begin end; - if DropFrame then for droppedFrames:=1 to FRAMEDROPCOUNT do begin FrameFinished:=0; // read packets until we have a finished frame (or there are no more packets) -// while (FrameFinished=0) and (av_read_frame(VideoFormatContext, @AVPacket)>=0) do - while (FrameFinished=0) and (av_read_frame(VideoFormatContext, AVPacket)>=0) do // JB-ffmpeg + while (FrameFinished=0) do begin + if (av_read_frame(VideoFormatContext, AVPacket)<0) then + Break; // if we got a packet from the video stream, then decode it if (AVPacket.stream_index=VideoStreamIndex) then -// errnum:=avcodec_decode_video(VideoCodecContext, AVFrame, @frameFinished, AVPacket.data, AVPacket.size); errnum:=avcodec_decode_video(VideoCodecContext, AVFrame, frameFinished , AVPacket.data, AVPacket.size); // JB-ffmpeg - // release internal packet structure created by av_read_frame -// av_free_packet(PAVPacket(@AVPacket)); // JB-ffmpeg - av_free_packet( AVPacket ); + try +// if AVPacket.data <> nil then + av_free_packet( AVPacket ); // JB-ffmpeg + except + // TODO : JB_FFMpeg ... why does this now AV sometimes ( or always !! ) + end; end; end; // if we did not get an new frame, there's nothing more to do if Framefinished=0 then begin - GoldenRec.Spawn(220,15,1,16,0,-1,ColoredStar,$0000ff); Exit; end; // otherwise we convert the pixeldata from YUV to RGB errnum:=img_convert(PAVPicture(AVFrameRGB), PIX_FMT_RGB24, PAVPicture(AVFrame), VideoCodecContext^.pix_fmt, VideoCodecContext^.width, VideoCodecContext^.height); -//errnum:=1; -{ - writeln('swscontext->srcH='+inttostr(SoftwareScaleContext^.srcH)); - writeln('swscontext->dstH='+inttostr(SoftwareScaleContext^.dstH)); - writeln('swscontext->slicedir='+inttostr(SoftwareScaleContext^.slicedir)); - errnum:=sws_scale(SoftwareScaleContext,@(AVFrame.data),@(AVFrame.linesize), - 0,VideoCodecContext^.Height, - @(AVFrameRGB.data),@(AVFrameRGB.linesize)); - writeln('errnum='+inttostr(errnum)); -} if errnum >=0 then begin glBindTexture(GL_TEXTURE_2D, fVideoTex); glTexImage2D(GL_TEXTURE_2D, 0, 3, dataX, dataY, 0, GL_RGB, GL_UNSIGNED_BYTE, AVFrameRGB^.data[0]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); -(* // copy RGB pixeldata to our TextureBuffer - // (line by line) - - FrameDataPtr := pointer( AVFrameRGB^.data[0] ); - linesize := AVFrameRGB^.linesize[0]; - for y:=0 to TexY-1 do - begin - System.Move(FrameDataPtr[y*linesize],fTexData[3*y*dataX],linesize); - end; - - // generate opengl texture out of whatever we got - glBindTexture(GL_TEXTURE_2D, fVideoTex); - glTexImage2D(GL_TEXTURE_2D, 0, 3, dataX, dataY, 0, GL_RGB, GL_UNSIGNED_BYTE, fTexData); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); -*) {$ifdef DebugFrames} //frame decode debug display GoldenRec.Spawn(200,35,1,16,0,-1,ColoredStar,$ffff00); {$endif} - end; end; @@ -440,7 +397,6 @@ end; procedure TVideoPlayback_ffmpeg.init(); begin glGenTextures(1, PglUint(@fVideoTex)); - SetLength(fTexData,0); end; @@ -560,7 +516,6 @@ begin Exit; end; - if(VideoCodec<>Nil) then begin errnum:=avcodec_open(VideoCodecContext, VideoCodec); @@ -598,10 +553,8 @@ begin if(AVFrame <> Nil) and (AVFrameRGB <> Nil) then begin myBuffer:=av_malloc(avpicture_get_size(PIX_FMT_RGB24, dataX, dataY)); -// myBuffer:=av_malloc(avpicture_get_size(PIX_FMT_RGB24, VideoCodecContext^.width, VideoCodecContext^.height)); end; if myBuffer <> Nil then errnum:=avpicture_fill(PAVPicture(AVFrameRGB), myBuffer, PIX_FMT_RGB24, -// VideoCodecContext^.width, VideoCodecContext^.height) dataX, dataY) else begin {$ifdef DebugDisplay} @@ -613,24 +566,6 @@ begin av_close_input_file(VideoFormatContext); Exit; end; -{ - writeln('trying to get sws context: '+inttostr(VideoCodecContext^.width)+'x'+ - inttostr(VideoCodecContext^.height)+' -> '+inttostr(dataX)+'x'+inttostr(dataY)); - SoftwareScaleContext:=Nil; - SoftwareScaleContext:=sws_getContext(VideoCodecContext^.width,VideoCodecContext^.height,integer(VideoCodecContext^.pix_fmt), - dataX, dataY, integer(PIX_FMT_RGB24), - SWS_FAST_BILINEAR, 0, 0, 0); - if SoftwareScaleContext <> Nil then - writeln('got swscale context') - else begin - writeln('ERROR: didn´t get swscale context'); - av_free(AVFrameRGB); - av_free(AVFrame); - avcodec_close(VideoCodecContext); - av_close_input_file(VideoFormatContext); - Exit; - end; -} // this is the errnum from avpicture_fill if errnum >=0 then begin @@ -640,41 +575,26 @@ begin TexY := VideoCodecContext^.height; dataX := Round(Power(2, Ceil(Log2(TexX)))); dataY := Round(Power(2, Ceil(Log2(TexY)))); - SetLength(fTexData,dataX*dataY*3); // calculate some information for video display VideoAspect:=VideoCodecContext^.sample_aspect_ratio.num/VideoCodecContext^.sample_aspect_ratio.den; if (VideoAspect = 0) then VideoAspect:=VideoCodecContext^.width/VideoCodecContext^.height else VideoAspect:=VideoAspect*VideoCodecContext^.width/VideoCodecContext^.height; - if VideoAspect >= 4/3 then - begin ScaledVideoWidth:=800.0; ScaledVideoHeight:=800.0/VideoAspect; - end else - begin - ScaledVideoHeight:=600.0; - ScaledVideoWidth:=600.0*VideoAspect; - end; - VideoTimeBase:=VideoCodecContext^.time_base.num/VideoCodecContext^.time_base.den; - // hack to get reasonable timebase for divx -{$ifdef DebugDisplay} - showmessage('framerate: '+inttostr(floor(1/videotimebase))+'fps'); -{$endif} - if VideoTimeBase < 0.02 then // 0.02 <-> 50 fps - begin - VideoTimeBase:=VideoCodecContext^.time_base.den/VideoCodecContext^.time_base.num; - while VideoTimeBase > 50 do VideoTimeBase:=VideoTimeBase/10; - VideoTimeBase:=1/VideoTimeBase; - end; -{$ifdef DebugDisplay} - showmessage('corrected framerate: '+inttostr(floor(1/videotimebase))+'fps'); - - if ((VideoAspect*VideoCodecContext^.width*VideoCodecContext^.height)>200000) then - showmessage('you are trying to play a rather large video'+#13#10+ - 'be prepared to experience some timing problems'); -{$endif} - end; + VideoTimeBase:=VideoFormatContext^.streams[VideoStreamIndex]^.r_frame_rate.den/VideoFormatContext^.streams[VideoStreamIndex]^.r_frame_rate.num; +{$ifdef DebugDisplay} + showmessage('framerate: '+inttostr(floor(1/videotimebase))+'fps'); +{$endif} + // hack to get reasonable timebase (for divx and others) + if VideoTimeBase < 0.02 then // 0.02 <-> 50 fps + begin + VideoTimeBase:=VideoFormatContext^.streams[VideoStreamIndex]^.r_frame_rate.num/VideoFormatContext^.streams[VideoStreamIndex]^.r_frame_rate.den; + while VideoTimeBase > 50 do VideoTimeBase:=VideoTimeBase/10; + VideoTimeBase:=1/VideoTimeBase; + end; + end; end; end; @@ -689,8 +609,6 @@ begin avcodec_close(VideoCodecContext); av_close_input_file(VideoFormatContext); - SetLength(fTexData,0); - fVideoOpened:=False; end; end; @@ -711,18 +629,19 @@ end; procedure TVideoPlayback_ffmpeg.MoveTo(Time: real); begin fVideoSkipTime := Time; - + if fVideoSkipTime > 0 then begin - av_seek_frame(VideoFormatContext,-1,Floor((fVideoSkipTime)*1500000),0); + av_seek_frame(VideoFormatContext,VideoStreamIndex,Floor(Time/VideoTimeBase),AVSEEK_FLAG_ANY); VideoTime := fVideoSkipTime; end; end; +// what is this supposed to do? return VideoTime? function TVideoPlayback_ffmpeg.getPosition: real; begin - result := 0; + result := 0; end; initialization @@ -732,5 +651,4 @@ initialization finalization AudioManager.Remove( singleton_VideoFFMpeg ); - end. -- cgit v1.2.3 From e9e0cc34b7d492fcbcc5614d197ba536cacb2bc0 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 18 Dec 2007 23:46:20 +0000 Subject: Added a cdecl for the TAVPacket.destruct procedure. This fixes the av_free_packet() errors. Because of this bug, memory was never freed by av_free_packet and other memory areas were corrupted. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@729 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/ffmpeg/avformat.pas | 1390 ++++++++++++++++++------------------- 1 file changed, 695 insertions(+), 695 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/lib/ffmpeg/avformat.pas b/Game/Code/lib/ffmpeg/avformat.pas index aa74043b..6e30865f 100644 --- a/Game/Code/lib/ffmpeg/avformat.pas +++ b/Game/Code/lib/ffmpeg/avformat.pas @@ -1,701 +1,701 @@ - (* - * copyright (c) 2001 Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) - -(* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. -For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT -in the source codes *) - -unit avformat; - -{$IFDEF FPC} - {$IFNDEF win32} + (* + * copyright (c) 2001 Fabrice Bellard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +(* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. +For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT +in the source codes *) + +unit avformat; + +{$IFDEF FPC} + {$IFNDEF win32} {$LINKLIB libavutil} - {$LINKLIB libavformat} + {$LINKLIB libavformat} {$ENDIF} - - {$MODE DELPHI } (* CAT *) - {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) - {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) -{$ENDIF} - -interface - -uses - avcodec, - avio, - rational, - avutil; (* CAT *) - -const - - -{$IFDEF win32} + + {$MODE DELPHI } (* CAT *) + {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) + {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) +{$ENDIF} + +interface + +uses + avcodec, + avio, + rational, + avutil; (* CAT *) + +const + + +{$IFDEF win32} av__format = 'avformat-50.dll'; {$ELSE} av__format = 'libavformat.so'; // .0d //av__format = 'libavformat.51'; (* CAT *) -{$ENDIF} - - LIBAVUTIL_VERSION_INT = ((51 shl 16) + (12 shl 8) + 1); - LIBAVUTIL_VERSION = '51.12.1'; - LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; - - MAXINT64 = $7fffffffffffffff; - MININT64 = $8000000000000000; - - PKT_FLAG_KEY = $0001; - -(*************************************************) -(* input/output formats *) - - AVPROBE_SCORE_MAX = 100; ///< max score, half of that is used for file extension based detection - AVPROBE_PADDING_SIZE = 32; ///< extra allocated bytes at the end of the probe buffer - -//! demuxer will use url_fopen, no opened file should be provided by the caller - AVFMT_NOFILE = $0001; - AVFMT_NEEDNUMBER = $0002; (**< needs '%d' in filename *) - AVFMT_SHOW_IDS = $0008; (**< show format stream IDs numbers *) - AVFMT_RAWPICTURE = $0020; (**< format wants AVPicture structure for - raw picture data *) - AVFMT_GLOBALHEADER = $0040; (**< format wants global header *) - AVFMT_NOTIMESTAMPS = $0080; (**< format does not need / have any timestamps *) - AVFMT_GENERIC_INDEX = $0100; (**< use generic index building code *) - - AVINDEX_KEYFRAME = $0001; - - MAX_REORDER_DELAY = 4; - - AVFMTCTX_NOHEADER = $0001; (**< signal that no header is present - (streams are added dynamically) *) - MAX_STREAMS = 20; - AVFMT_NOOUTPUTLOOP = -1; - AVFMT_INFINITEOUTPUTLOOP = 0; - AVFMT_FLAG_GENPTS = $0001; ///< generate pts if missing even if it requires parsing future frames - AVFMT_FLAG_IGNIDX = $0002; ///< ignore index - AVFMT_FLAG_NONBLOCK = $0004; ///< do not block when reading packets from input - -type - HFILE = THandle; /// (* CAT *) - int = integer; - - PAVPacket = ^TAVPacket; - PAVImageFormat = ^TAVImageFormat; - PAVFormatContext = ^TAVFormatContext; - PAVFormatParameters = ^TAVFormatParameters; - PAVOutputFormat = ^TAVOutputFormat; - PAVProbeData = ^TAVProbeData; - PAVInputFormat = ^TAVInputFormat; - PAVIndexEntry = ^TAVIndexEntry; - PAVStream = ^TAVStream; - PAVPacketList = ^TAVPacketList; - PAVImageInfo = ^TAVImageInfo; - - TAVPacket = record {56} - pts: int64; ///< presentation time stamp in time_base units - dts: int64; ///< decompression time stamp in time_base units - data: PByte; - size: integer; - stream_index: integer; - flags: integer; - duration: integer; ///< presentation duration in time_base units (0 if not available) - destruct: procedure (p: PAVPacket); (* This cannot be var : TAVPacket. - because TAVPacket is not completely defined yet *) - priv: pointer; - pos: int64 ///< byte position in stream, -1 if unknown - end; - -(*************************************************) -(* fractional numbers for exact pts handling *) - -(* the exact value of the fractional number is: 'val + num / den'. num - is assumed to be such as 0 <= num < den *) - PAVFrac = ^TAVFrac; - TAVFrac = record - val, num, den: int64; - end; - -(* this structure contains the data a format has to probe a file *) - TAVProbeData = record {12} - filename: pchar; - buf: pchar; - buf_size: integer; - end; - - TAVFormatParameters = record {56} - time_base: TAVRational; (* 8 bytes *) - sample_rate: integer; - channels: integer; - width: integer; - height: integer; - pix_fmt: TAVPixelFormat; -{ image_format: PAVImageFormat; (* 4 bytes *)} (* CAT#3 *) - channel: integer; (* used to select dv channel *) - device: pchar; (* video, audio or DV device, if LIBAVFORMAT_VERSION_INT < (52<<16) *) - standard: pchar; (* tv standard, NTSC, PAL, SECAM *) -// int mpeg2ts_raw:1; (* force raw MPEG2 transport stream output, if possible *) -// int mpeg2ts_compute_pcr:1; (* compute exact PCR for each transport -// stream packet (only meaningful if -// mpeg2ts_raw is TRUE *) -// int initial_pause:1; (* do not begin to play the stream -// immediately (RTSP only) *) -// int prealloced_context:1; - dummy: byte; - video_codec_id: TCodecID; - audio_codec_id: TCodecID; - end; - - TAVOutputFormat = record {56} - name: pchar; - long_name: pchar; - mime_type: pchar; - extensions: pchar; (* comma separated extensions *) - (* size of private data so that it can be allocated in the wrapper *) - priv_data_size: integer; - (* output support *) - audio_codec: TCodecID; (* default audio codec *) - video_codec: TCodecID; (* default video codec *) - write_header: function (c: PAVFormatContext): integer; cdecl; - write_packet: function (c: PAVFormatContext; var pkt: TAVPacket): integer; cdecl; (* CAT#2 *) - write_trailer: function (c: PAVFormatContext): integer; cdecl; - (* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER *) - flags: integer; - (* currently only used to set pixel format if not YUV420P *) - set_parameters: function (c: PAVFormatContext; f: PAVFormatParameters): integer; cdecl; - interleave_packet: function (s: PAVFormatContext; _out: PAVPacket; _in: PAVPacket; flush: integer): integer; cdecl; - - (** - * list of supported codec_id-codec_tag pairs, ordered by "better choice first" - * the arrays are all CODEC_ID_NONE terminated - *) - //const struct AVCodecTag **codec_tag; - - (* private fields *) - next: PAVOutputFormat; - end; - - TAVInputFormat = record {60} - name: pchar; - long_name: pchar; - (* size of private data so that it can be allocated in the wrapper *) - priv_data_size: integer; - (* tell if a given file has a chance of being parsing by this format *) - read_probe: function (p: PAVProbeData): integer; cdecl; - (* read the format header and initialize the AVFormatContext - structure. Return 0 if OK. 'ap' if non NULL contains - additionnal paramters. Only used in raw format right - now. 'av_new_stream' should be called to create new streams. *) - read_header: function (c: PAVFormatContext; ap: PAVFormatParameters): integer; cdecl; - (* read one packet and put it in 'pkt'. pts and flags are also - set. 'av_new_stream' can be called only if the flag - AVFMTCTX_NOHEADER is used. *) - read_packet: function (c: PAVFormatContext; var pkt: TAVPacket): integer; cdecl; - (* close the stream. The AVFormatContext and AVStreams are not - freed by this function *) - read_close: function (c: PAVFormatContext): integer; cdecl; - (*** seek to a given timestamp relative to the frames in - * stream component stream_index - * @param stream_index must not be -1 - * @param flags selects which direction should be preferred if no exact - * match is available *) - read_seek: function (c: PAVFormatContext; stream_index: integer; - timestamp: int64; flags: integer): integer; cdecl; - (*** gets the next timestamp in AV_TIME_BASE units. *) - read_timestamp: function (s: PAVFormatContext; stream_index: integer; - pos: pint64; pos_limit: int64): integer; cdecl; - (* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER *) - flags: integer; - (* if extensions are defined, then no probe is done. You should - usually not use extension format guessing because it is not - reliable enough *) - extensions: pchar; - (* general purpose read only value that the format can use *) - value: integer; - - (* start/resume playing - only meaningful if using a network based format (RTSP) *) - read_play: function (c: PAVFormatContext): integer; cdecl; - - (* pause playing - only meaningful if using a network based format (RTSP) *) - read_pause: function (c: PAVFormatContext): integer; cdecl; - - //const struct AVCodecTag **codec_tag; - - (* private fields *) - next: PAVInputFormat; - end; - - TAVStreamParseType = ( - AVSTREAM_PARSE_NONE, - AVSTREAM_PARSE_FULL, (**< full parsing and repack *) - AVSTREAM_PARSE_HEADERS, (**< only parse headers, don't repack *) - AVSTREAM_PARSE_TIMESTAMPS (**< full parsing and interpolation of timestamps for frames not starting on packet boundary *) - ); - - TAVIndexEntry = record {24} - pos: int64; - timestamp: int64; -(* the following 2 flags indicate that the next/prev keyframe is known, and scaning for it isnt needed *) - flags: integer; -// int flags:2; -// int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs 32 byte due to possible 8byte align). - min_distance: integer; (* min distance between this and the previous keyframe, used to avoid unneeded searching *) - end; - - TAVStream = record {168} - index: integer; (* stream index in AVFormatContext *) {4-4} - id: integer; (* format specific stream id *) {4-8} - codec: PAVCodecContext; (* codec context *) {4-12} - (*** real base frame rate of the stream. - * for example if the timebase is 1/90000 and all frames have either - * approximately 3600 or 1800 timer ticks then r_frame_rate will be 50/1 *) - r_frame_rate: TAVRational; {4*2=8-20} - priv_data: pointer; {4-24} - (* internal data used in av_find_stream_info() *) - codec_info_duration: int64; (* #if LIBAVFORMAT_VERSION_INT < (52<<16) *) {8-32} - codec_info_nb_frames: integer; (* #if LIBAVFORMAT_VERSION_INT < (52<<16) *) {4-38} - (* encoding: PTS generation when outputing stream *) - pts: TAVFrac; {8*3=24-62} - - (*** this is the fundamental unit of time (in seconds) in terms - * of which frame timestamps are represented. for fixed-fps content, - * timebase should be 1/framerate and timestamp increments should be - * identically 1. *) - time_base: TAVRational; {4*2=8-70} - pts_wrap_bits: integer; (* number of bits in pts (used for wrapping control) *) {4-74} - (* ffmpeg.c private use *) - stream_copy: integer; (* if TRUE, just copy stream *) {4-78} - discard: TAVDiscard; ///< selects which packets can be discarded at will and dont need to be demuxed {4-82} - //FIXME move stuff to a flags field? - (* quality, as it has been removed from AVCodecContext and put in AVVideoFrame - * MN:dunno if thats the right place, for it *) - quality: single; {4-86} - (* decoding: position of the first frame of the component, in AV_TIME_BASE fractional seconds. *) - start_time: int64; {8-92} - (* decoding: duration of the stream, in stream time base. *) - duration: int64; {8-100} - - language: array [0..3] of char; (* ISO 639 3-letter language code (empty string if undefined) *)(* 101 th byte - 1 base *) {4-104} - - (* av_read_frame() support *) - need_parsing: TAVStreamParseType;//CAT#3 ///< 1->full parsing needed, 2->only parse headers dont repack - parser: PAVCodecParserContext; - - cur_dts: int64; - last_IP_duration: integer; - last_IP_pts: int64; - (* av_seek_frame() support *) - index_entries: PAVIndexEntry; (* only used if the format does not support seeking natively *) - nb_index_entries: integer; - index_entries_allocated_size: cardinal; (* CAT#3 *) - - nb_frames: int64; ///< number of frames in this stream if known or 0 - pts_buffer: array [0..MAX_REORDER_DELAY] of int64 - end; - -(* format I/O context *) - TAVFormatContext = record {3960} - av_class: PAVClass; (* set by av_alloc_format_context *) - (* can only be iformat or oformat, not both at the same time *) - iformat: PAVInputFormat; - oformat: PAVOutputFormat; - priv_data: pointer; - pb: TByteIOContext; - nb_streams: cardinal; (* CAT#3 *) - streams: array [0..MAX_STREAMS - 1] of PAVStream; - filename: array [0..1023] of char; (* input or output filename *) - (* stream info *) - timestamp: int64; - title: array [0..511] of char; - author: array [0..511] of char; - copyright: array [0..511] of char; - comment: array [0..511] of char; - album: array [0..511] of char; - year: integer; (* ID3 year, 0 if none *) - track: integer; (* track number, 0 if none *) - genre: array [0..31] of char; (* ID3 genre *) - - ctx_flags: integer; (* format specific flags, see AVFMTCTX_xx *) - (* private data for pts handling (do not modify directly) *) - (* This buffer is only needed when packets were already buffered but - not decoded, for example to get the codec parameters in mpeg - streams *) - packet_buffer: PAVPacketList; - - (* decoding: position of the first frame of the component, in - AV_TIME_BASE fractional seconds. NEVER set this value directly: - it is deduced from the AVStream values. *) - start_time: int64; - (* decoding: duration of the stream, in AV_TIME_BASE fractional - seconds. NEVER set this value directly: it is deduced from the - AVStream values. *) - duration: int64; - (* decoding: total file size. 0 if unknown *) - file_size: int64; - (* decoding: total stream bitrate in bit/s, 0 if not - available. Never set it directly if the file_size and the - duration are known as ffmpeg can compute it automatically. *) - bit_rate: integer; - - (* av_read_frame() support *) - cur_st: PAVStream; - cur_ptr: pbyte; - cur_len: integer; - cur_pkt: TAVPacket; - - (* av_seek_frame() support *) - data_offset: int64; (* offset of the first packet *) - index_built: integer; - - mux_rate: integer; - packet_size: integer; - preload: integer; - max_delay: integer; - - (* number of times to loop output in formats that support it *) - loop_output: integer; - - flags: integer; - loop_input: integer; - (* decoding: size of data to probe; encoding unused *) - probesize: cardinal; - - (** - * maximum duration in AV_TIME_BASE units over which the input should be analyzed in av_find_stream_info() - *) - max_analyze_duration: integer; - - key: pbyte; - keylen : integer - end; - - TAVPacketList = record {64} - pkt: TAVPacket; - next: PAVPacketList; - end; - -(* still image support *) - PAVInputImageContext = pointer; // attribute_deprecated; -// PAVInputImageContext = pointer; //AVInputImageContext attribute_deprecated; - -(* still image support *) - TAVImageInfo = record {48} - pix_fmt: TAVPixelFormat; (* requested pixel format *) - width: integer; (* requested width *) - height: integer; (* requested height *) - interleaved: integer; (* image is interleaved (e.g. interleaved GIF) *) - pict: TAVPicture; (* returned allocated image *) - end; - - TAVImageFormat = record {32} - name: pchar; - extensions: pchar; - (* tell if a given file has a chance of being parsing by this format *) - img_probe: function (d: PAVProbeData): integer; cdecl; - (* read a whole image. 'alloc_cb' is called when the image size is - known so that the caller can allocate the image. If 'allo_cb' - returns non zero, then the parsing is aborted. Return '0' if - OK. *) - img_read: function (b: PByteIOContext; alloc_cb: pointer; ptr: pointer): integer; cdecl; - (* write the image *) - supported_pixel_formats: integer; (* mask of supported formats for output *) - img_write: function (b: PByteIOContext; i: PAVImageInfo): integer; cdecl; - flags: integer; - next: PAVImageFormat; - end; - -procedure av_destruct_packet_nofree (var pkt: TAVPacket); (* CAT#2 *) - cdecl; external av__format; -procedure av_destruct_packet (var pkt: TAVPacket); (* CAT#2 *) - cdecl; external av__format; - -(* initialize optional fields of a packet *) -procedure av_init_packet (var pkt: TAVPacket); (* CAT#2 *) - -function av_new_packet(var pkt: TAVPacket; size: integer): integer; (* CAT#2 *) - cdecl; external av__format; - -function av_get_packet (s: PByteIOContext; var pkt: TAVPacket; size: integer): integer; (* CAT#2 *) - cdecl; external av__format; - -function av_dup_packet (pkt: PAVPacket): integer; - cdecl; external av__format; - -(** * Free a packet - * - * @param pkt packet to free *) -procedure av_free_packet (var pkt: TAVPacket); (* CAT#2 *) - -procedure av_register_image_format (img_fmt: PAVImageFormat); - cdecl; external av__format; - -function av_probe_image_format (pd: PAVProbeData): PAVImageFormat; - cdecl; external av__format; - -function guess_image_format (filename: pchar): PAVImageFormat; - cdecl; external av__format; - -function av_guess_image2_codec(filename: pchar): TCodecID; - cdecl; external av__format; - -function av_read_image (pb: PByteIOContext; filename: pchar; - fmt: PAVImageFormat; - alloc_cb: pointer; opaque: pointer): integer; - cdecl; external av__format; - -function av_write_image(pb: PByteIOContext; fmt: PAVImageFormat; img: PAVImageInfo): integer; - cdecl; external av__format; - -(* XXX: use automatic init with either ELF sections or C file parser *) -(* modules *) - -//#include "rtp.h" - -//#include "rtsp.h" - -(* utils.c *) - procedure av_register_input_format (format: PAVInputFormat); - cdecl; external av__format; - - procedure av_register_output_format (format: PAVOutputFormat); - cdecl; external av__format; - - function guess_stream_format (short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; - cdecl; external av__format; - - function guess_format(short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; - cdecl; external av__format; - - function av_guess_codec(fmt: PAVOutputFormat; short_name: pchar; - filename: pchar; mime_type: pchar; _type: TCodecType): TCodecID; - cdecl; external av__format; - - procedure av_hex_dump (f: HFILE; buf: pchar; size: integer); - cdecl; external av__format; - procedure av_pkt_dump(f: HFILE; var pkt: TAVPacket; dump_payload: integer); (* CAT#2 *) - cdecl; external av__format; - - procedure av_register_all (); - cdecl; external av__format; - - -(* media file input *) - function av_find_input_format (short_name: pchar): PAVInputFormat; - cdecl; external av__format; - function av_probe_input_format (pd: PAVProbeData; is_opened: integer): PAVInputFormat; - cdecl; external av__format; - function av_open_input_stream (ic_ptr: PAVFormatContext; - pb: PByteIOContext; filename: pchar; - fmt: PAVInputFormat; ap: PAVFormatParameters): integer; - cdecl; external av__format; -(*** Open a media file as input. The codec are not opened. Only the file - * header (if present) is read. - * - * @param ic_ptr the opened media file handle is put here - * @param filename filename to open. - * @param fmt if non NULL, force the file format to use - * @param buf_size optional buffer size (zero if default is OK) - * @param ap additionnal parameters needed when opening the file (NULL if default) - * @return 0 if OK. AVERROR_xxx otherwise. *) - - function av_open_input_file (var ic_ptr: PAVFormatContext; filename: pchar; - fmt: PAVInputFormat; buf_size: integer; - ap: PAVFormatParameters): integer; - cdecl; external av__format; - - (* no av_open for output, so applications will need this: *) - function av_alloc_format_context (): PAVFormatContext; - cdecl; external av__format; - -const - AVERROR_UNKNOWN =(-1); (* unknown error *) - AVERROR_IO =(-2); (* i/o error *) - AVERROR_NUMEXPECTED =(-3); (* number syntax expected in filename *) - AVERROR_INVALIDDATA =(-4); (* invalid data found *) - AVERROR_NOMEM =(-5); (* not enough memory *) - AVERROR_NOFMT =(-6); (* unknown format *) - AVERROR_NOTSUPP =(-7); (* operation not supported *) - -(*** Read the beginning of a media file to get stream information. This - * is useful for file formats with no headers such as MPEG. This - * function also compute the real frame rate in case of mpeg2 repeat - * frame mode. - * - * @param ic media file handle - * @return >=0 if OK. AVERROR_xxx if error. - * @todo let user decide somehow what information is needed so we dont waste time geting stuff the user doesnt need *) - - function av_find_stream_info (ic: PAVFormatContext): integer; - cdecl; external av__format; - function av_read_packet (s: PAVFormatContext; var pkt: TAVPacket): integer; (* CAT#2 *) - cdecl; external av__format; -(*** Return the next frame of a stream. - * - * The returned packet is valid - * until the next av_read_frame() or until av_close_input_file() and - * must be freed with av_free_packet. For video, the packet contains - * exactly one frame. For audio, it contains an integer number of - * frames if each frame has a known fixed size (e.g. PCM or ADPCM - * data). If the audio frames have a variable size (e.g. MPEG audio), - * then it contains one frame. - * - * pkt->pts, pkt->dts and pkt->duration are always set to correct - * values in AV_TIME_BASE unit (and guessed if the format cannot - * provided them). pkt->pts can be AV_NOPTS_VALUE if the video format - * has B frames, so it is better to rely on pkt->dts if you do not - * decompress the payload. - * - * @return 0 if OK, < 0 if error or end of file. *) - - function av_read_frame (s: PAVFormatContext; var pkt: TAVPacket): integer; (* CAT#2 *) - cdecl; external av__format; - function av_seek_frame (s: PAVFormatContext; stream_index: integer; timestamp: int64; flags: integer): integer; - cdecl; external av__format; - function av_read_play (s: PAVFormatContext): integer; - cdecl; external av__format; - function av_read_pause (s: PAVFormatContext): integer; - cdecl; external av__format; - procedure av_close_input_file (s: PAVFormatContext); - cdecl; external av__format; - function av_new_stream (s: PAVFormatContext; id: integer): PAVStream; - cdecl; external av__format; - procedure av_set_pts_info (s: PAVStream; pts_wrap_bits: integer; - pts_num: integer; pts_den: integer); - cdecl; external av__format; - -const - AVSEEK_FLAG_BACKWARD =1; ///< seek backward - AVSEEK_FLAG_BYTE =2; ///< seeking based on position in bytes - AVSEEK_FLAG_ANY =4; ///< seek to any frame, even non keyframes - - function av_find_default_stream_index (s: PAVFormatContext): integer; - cdecl; external av__format; - function av_index_search_timestamp (st: PAVStream; timestamp: int64; flags: integer): integer; - cdecl; external av__format; - function av_add_index_entry (st: PAVStream; pos: int64; timestamp: int64; - distance: integer; flags: integer): integer; - cdecl; external av__format; - function av_seek_frame_binary (s: PAVFormatContext; stream_index: integer; - target_ts: int64; flags: integer): integer; - cdecl; external av__format; - - procedure av_update_cur_dts (s: PAVFormatContext; ref_st: PAVStream; - timestamp: int64); - cdecl; external av__format; - -(* media file output *) - function av_set_parameters (s: PAVFormatContext; ap: PAVFormatParameters): integer; - cdecl; external av__format; - - function av_write_header (s: PAVFormatContext): integer; - cdecl; external av__format; - - function av_write_frame(s: PAVFormatContext; var pkt: TAVPacket): integer; - cdecl; external av__format; (* CAT#2 *) - - function av_interleaved_write_frame (s: PAVFormatContext; var pkt: TAVPacket): integer; - cdecl; external av__format; (* CAT#2 *) - - function av_interleave_packet_per_dts(s: PAVFormatContext; _out: PAVPacket; - pkt: PAVPacket; flush: integer): integer; - cdecl; external av__format; - function av_write_trailer(s: pAVFormatContext): integer; - cdecl; external av__format; - - procedure dump_format(ic: PAVFormatContext; index: integer; url: pchar; - is_output: integer); - cdecl; external av__format; - - function parse_image_size(width_ptr: PInteger; height_ptr: PInteger; str: pchar): integer; - cdecl; external av__format; - function parse_frame_rate (frame_rate: PInteger; frame_rate_base: PInteger; arg: pchar): integer; - cdecl; external av__format; - function parse_date(datestr: pchar; duration: integer): int64; - cdecl; external av__format; - function av_gettime (): int64; - cdecl; external av__format; - -(* ffm specific for ffserver *) -const - FFM_PACKET_SIZE = 4096; - - function ffm_read_write_index (fd: integer): int64; - cdecl; external av__format; - - procedure ffm_write_write_index(fd: integer; pos: int64); - cdecl; external av__format; - - procedure ffm_set_write_index (s: PAVFormatContext; pos: int64; file_size: int64); - cdecl; external av__format; - - function find_info_tag (arg: pchar; arg_size: integer; tag1: pchar; info: pchar): integer; - cdecl; external av__format; - - function get_frame_filename(buf: pchar; buf_size: integer; - path: pchar; number: integer): integer; - cdecl; external av__format; - function filename_number_test (filename: pchar): integer; - cdecl; external av__format; - - -(* grab specific *) - function video_grab_init (): integer; - cdecl; external av__format; - function audio_init (): integer; - cdecl; external av__format; - -(* DV1394 *) - function dv1394_init (): integer; - cdecl; external av__format; - function dc1394_init (): integer; - cdecl; external av__format; - - function strstart(str: pchar; val: pchar; ptr: PPointer): integer; - cdecl; external av__format; - function stristart(str: pchar; val: pchar; ptr: PPointer): integer; - cdecl; external av__format; - procedure pstrcpy(buf: pchar; buf_size: integer; str: pchar); - cdecl; external av__format; - function pstrcat(buf: pchar; buf_size: integer; s: pchar): pchar; - cdecl; external av__format; - - procedure __dynarray_add (tab_ptr: PPointer; nb_ptr: PInteger; elem: cardinal); - cdecl; external av__format; - - -implementation - -procedure av_init_packet (var pkt: TAVPacket); (* CAT#2 + bug fix *) -begin - with pkt do begin - pts := AV_NOPTS_VALUE; - dts := AV_NOPTS_VALUE; - pos := -1; - duration := 0; - flags := 0; - stream_index := 0; - destruct := @av_destruct_packet_nofree - end -end; - -procedure av_free_packet (var pkt: TAVPacket); (* CAT#2 *) -begin - if @pkt.destruct <> nil then pkt.destruct (@pkt) -{ if (pkt <> nil) and (@pkt^.destruct <> nil) then - pkt^.destruct (pkt)} -end; - -end. +{$ENDIF} + + LIBAVUTIL_VERSION_INT = ((51 shl 16) + (12 shl 8) + 1); + LIBAVUTIL_VERSION = '51.12.1'; + LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; + + MAXINT64 = $7fffffffffffffff; + MININT64 = $8000000000000000; + + PKT_FLAG_KEY = $0001; + +(*************************************************) +(* input/output formats *) + + AVPROBE_SCORE_MAX = 100; ///< max score, half of that is used for file extension based detection + AVPROBE_PADDING_SIZE = 32; ///< extra allocated bytes at the end of the probe buffer + +//! demuxer will use url_fopen, no opened file should be provided by the caller + AVFMT_NOFILE = $0001; + AVFMT_NEEDNUMBER = $0002; (**< needs '%d' in filename *) + AVFMT_SHOW_IDS = $0008; (**< show format stream IDs numbers *) + AVFMT_RAWPICTURE = $0020; (**< format wants AVPicture structure for + raw picture data *) + AVFMT_GLOBALHEADER = $0040; (**< format wants global header *) + AVFMT_NOTIMESTAMPS = $0080; (**< format does not need / have any timestamps *) + AVFMT_GENERIC_INDEX = $0100; (**< use generic index building code *) + + AVINDEX_KEYFRAME = $0001; + + MAX_REORDER_DELAY = 4; + + AVFMTCTX_NOHEADER = $0001; (**< signal that no header is present + (streams are added dynamically) *) + MAX_STREAMS = 20; + AVFMT_NOOUTPUTLOOP = -1; + AVFMT_INFINITEOUTPUTLOOP = 0; + AVFMT_FLAG_GENPTS = $0001; ///< generate pts if missing even if it requires parsing future frames + AVFMT_FLAG_IGNIDX = $0002; ///< ignore index + AVFMT_FLAG_NONBLOCK = $0004; ///< do not block when reading packets from input + +type + HFILE = THandle; /// (* CAT *) + int = integer; + + PAVPacket = ^TAVPacket; + PAVImageFormat = ^TAVImageFormat; + PAVFormatContext = ^TAVFormatContext; + PAVFormatParameters = ^TAVFormatParameters; + PAVOutputFormat = ^TAVOutputFormat; + PAVProbeData = ^TAVProbeData; + PAVInputFormat = ^TAVInputFormat; + PAVIndexEntry = ^TAVIndexEntry; + PAVStream = ^TAVStream; + PAVPacketList = ^TAVPacketList; + PAVImageInfo = ^TAVImageInfo; + + TAVPacket = record {56} + pts: int64; ///< presentation time stamp in time_base units + dts: int64; ///< decompression time stamp in time_base units + data: PByte; + size: integer; + stream_index: integer; + flags: integer; + duration: integer; ///< presentation duration in time_base units (0 if not available) + destruct: procedure (p: PAVPacket); cdecl; (* This cannot be var : TAVPacket. + because TAVPacket is not completely defined yet *) + priv: pointer; + pos: int64 ///< byte position in stream, -1 if unknown + end; + +(*************************************************) +(* fractional numbers for exact pts handling *) + +(* the exact value of the fractional number is: 'val + num / den'. num + is assumed to be such as 0 <= num < den *) + PAVFrac = ^TAVFrac; + TAVFrac = record + val, num, den: int64; + end; + +(* this structure contains the data a format has to probe a file *) + TAVProbeData = record {12} + filename: pchar; + buf: pchar; + buf_size: integer; + end; + + TAVFormatParameters = record {56} + time_base: TAVRational; (* 8 bytes *) + sample_rate: integer; + channels: integer; + width: integer; + height: integer; + pix_fmt: TAVPixelFormat; +{ image_format: PAVImageFormat; (* 4 bytes *)} (* CAT#3 *) + channel: integer; (* used to select dv channel *) + device: pchar; (* video, audio or DV device, if LIBAVFORMAT_VERSION_INT < (52<<16) *) + standard: pchar; (* tv standard, NTSC, PAL, SECAM *) +// int mpeg2ts_raw:1; (* force raw MPEG2 transport stream output, if possible *) +// int mpeg2ts_compute_pcr:1; (* compute exact PCR for each transport +// stream packet (only meaningful if +// mpeg2ts_raw is TRUE *) +// int initial_pause:1; (* do not begin to play the stream +// immediately (RTSP only) *) +// int prealloced_context:1; + dummy: byte; + video_codec_id: TCodecID; + audio_codec_id: TCodecID; + end; + + TAVOutputFormat = record {56} + name: pchar; + long_name: pchar; + mime_type: pchar; + extensions: pchar; (* comma separated extensions *) + (* size of private data so that it can be allocated in the wrapper *) + priv_data_size: integer; + (* output support *) + audio_codec: TCodecID; (* default audio codec *) + video_codec: TCodecID; (* default video codec *) + write_header: function (c: PAVFormatContext): integer; cdecl; + write_packet: function (c: PAVFormatContext; var pkt: TAVPacket): integer; cdecl; (* CAT#2 *) + write_trailer: function (c: PAVFormatContext): integer; cdecl; + (* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER *) + flags: integer; + (* currently only used to set pixel format if not YUV420P *) + set_parameters: function (c: PAVFormatContext; f: PAVFormatParameters): integer; cdecl; + interleave_packet: function (s: PAVFormatContext; _out: PAVPacket; _in: PAVPacket; flush: integer): integer; cdecl; + + (** + * list of supported codec_id-codec_tag pairs, ordered by "better choice first" + * the arrays are all CODEC_ID_NONE terminated + *) + //const struct AVCodecTag **codec_tag; + + (* private fields *) + next: PAVOutputFormat; + end; + + TAVInputFormat = record {60} + name: pchar; + long_name: pchar; + (* size of private data so that it can be allocated in the wrapper *) + priv_data_size: integer; + (* tell if a given file has a chance of being parsing by this format *) + read_probe: function (p: PAVProbeData): integer; cdecl; + (* read the format header and initialize the AVFormatContext + structure. Return 0 if OK. 'ap' if non NULL contains + additionnal paramters. Only used in raw format right + now. 'av_new_stream' should be called to create new streams. *) + read_header: function (c: PAVFormatContext; ap: PAVFormatParameters): integer; cdecl; + (* read one packet and put it in 'pkt'. pts and flags are also + set. 'av_new_stream' can be called only if the flag + AVFMTCTX_NOHEADER is used. *) + read_packet: function (c: PAVFormatContext; var pkt: TAVPacket): integer; cdecl; + (* close the stream. The AVFormatContext and AVStreams are not + freed by this function *) + read_close: function (c: PAVFormatContext): integer; cdecl; + (*** seek to a given timestamp relative to the frames in + * stream component stream_index + * @param stream_index must not be -1 + * @param flags selects which direction should be preferred if no exact + * match is available *) + read_seek: function (c: PAVFormatContext; stream_index: integer; + timestamp: int64; flags: integer): integer; cdecl; + (*** gets the next timestamp in AV_TIME_BASE units. *) + read_timestamp: function (s: PAVFormatContext; stream_index: integer; + pos: pint64; pos_limit: int64): integer; cdecl; + (* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER *) + flags: integer; + (* if extensions are defined, then no probe is done. You should + usually not use extension format guessing because it is not + reliable enough *) + extensions: pchar; + (* general purpose read only value that the format can use *) + value: integer; + + (* start/resume playing - only meaningful if using a network based format (RTSP) *) + read_play: function (c: PAVFormatContext): integer; cdecl; + + (* pause playing - only meaningful if using a network based format (RTSP) *) + read_pause: function (c: PAVFormatContext): integer; cdecl; + + //const struct AVCodecTag **codec_tag; + + (* private fields *) + next: PAVInputFormat; + end; + + TAVStreamParseType = ( + AVSTREAM_PARSE_NONE, + AVSTREAM_PARSE_FULL, (**< full parsing and repack *) + AVSTREAM_PARSE_HEADERS, (**< only parse headers, don't repack *) + AVSTREAM_PARSE_TIMESTAMPS (**< full parsing and interpolation of timestamps for frames not starting on packet boundary *) + ); + + TAVIndexEntry = record {24} + pos: int64; + timestamp: int64; +(* the following 2 flags indicate that the next/prev keyframe is known, and scaning for it isnt needed *) + flags: integer; +// int flags:2; +// int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs 32 byte due to possible 8byte align). + min_distance: integer; (* min distance between this and the previous keyframe, used to avoid unneeded searching *) + end; + + TAVStream = record {168} + index: integer; (* stream index in AVFormatContext *) {4-4} + id: integer; (* format specific stream id *) {4-8} + codec: PAVCodecContext; (* codec context *) {4-12} + (*** real base frame rate of the stream. + * for example if the timebase is 1/90000 and all frames have either + * approximately 3600 or 1800 timer ticks then r_frame_rate will be 50/1 *) + r_frame_rate: TAVRational; {4*2=8-20} + priv_data: pointer; {4-24} + (* internal data used in av_find_stream_info() *) + codec_info_duration: int64; (* #if LIBAVFORMAT_VERSION_INT < (52<<16) *) {8-32} + codec_info_nb_frames: integer; (* #if LIBAVFORMAT_VERSION_INT < (52<<16) *) {4-38} + (* encoding: PTS generation when outputing stream *) + pts: TAVFrac; {8*3=24-62} + + (*** this is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. for fixed-fps content, + * timebase should be 1/framerate and timestamp increments should be + * identically 1. *) + time_base: TAVRational; {4*2=8-70} + pts_wrap_bits: integer; (* number of bits in pts (used for wrapping control) *) {4-74} + (* ffmpeg.c private use *) + stream_copy: integer; (* if TRUE, just copy stream *) {4-78} + discard: TAVDiscard; ///< selects which packets can be discarded at will and dont need to be demuxed {4-82} + //FIXME move stuff to a flags field? + (* quality, as it has been removed from AVCodecContext and put in AVVideoFrame + * MN:dunno if thats the right place, for it *) + quality: single; {4-86} + (* decoding: position of the first frame of the component, in AV_TIME_BASE fractional seconds. *) + start_time: int64; {8-92} + (* decoding: duration of the stream, in stream time base. *) + duration: int64; {8-100} + + language: array [0..3] of char; (* ISO 639 3-letter language code (empty string if undefined) *)(* 101 th byte - 1 base *) {4-104} + + (* av_read_frame() support *) + need_parsing: TAVStreamParseType;//CAT#3 ///< 1->full parsing needed, 2->only parse headers dont repack + parser: PAVCodecParserContext; + + cur_dts: int64; + last_IP_duration: integer; + last_IP_pts: int64; + (* av_seek_frame() support *) + index_entries: PAVIndexEntry; (* only used if the format does not support seeking natively *) + nb_index_entries: integer; + index_entries_allocated_size: cardinal; (* CAT#3 *) + + nb_frames: int64; ///< number of frames in this stream if known or 0 + pts_buffer: array [0..MAX_REORDER_DELAY] of int64 + end; + +(* format I/O context *) + TAVFormatContext = record {3960} + av_class: PAVClass; (* set by av_alloc_format_context *) + (* can only be iformat or oformat, not both at the same time *) + iformat: PAVInputFormat; + oformat: PAVOutputFormat; + priv_data: pointer; + pb: TByteIOContext; + nb_streams: cardinal; (* CAT#3 *) + streams: array [0..MAX_STREAMS - 1] of PAVStream; + filename: array [0..1023] of char; (* input or output filename *) + (* stream info *) + timestamp: int64; + title: array [0..511] of char; + author: array [0..511] of char; + copyright: array [0..511] of char; + comment: array [0..511] of char; + album: array [0..511] of char; + year: integer; (* ID3 year, 0 if none *) + track: integer; (* track number, 0 if none *) + genre: array [0..31] of char; (* ID3 genre *) + + ctx_flags: integer; (* format specific flags, see AVFMTCTX_xx *) + (* private data for pts handling (do not modify directly) *) + (* This buffer is only needed when packets were already buffered but + not decoded, for example to get the codec parameters in mpeg + streams *) + packet_buffer: PAVPacketList; + + (* decoding: position of the first frame of the component, in + AV_TIME_BASE fractional seconds. NEVER set this value directly: + it is deduced from the AVStream values. *) + start_time: int64; + (* decoding: duration of the stream, in AV_TIME_BASE fractional + seconds. NEVER set this value directly: it is deduced from the + AVStream values. *) + duration: int64; + (* decoding: total file size. 0 if unknown *) + file_size: int64; + (* decoding: total stream bitrate in bit/s, 0 if not + available. Never set it directly if the file_size and the + duration are known as ffmpeg can compute it automatically. *) + bit_rate: integer; + + (* av_read_frame() support *) + cur_st: PAVStream; + cur_ptr: pbyte; + cur_len: integer; + cur_pkt: TAVPacket; + + (* av_seek_frame() support *) + data_offset: int64; (* offset of the first packet *) + index_built: integer; + + mux_rate: integer; + packet_size: integer; + preload: integer; + max_delay: integer; + + (* number of times to loop output in formats that support it *) + loop_output: integer; + + flags: integer; + loop_input: integer; + (* decoding: size of data to probe; encoding unused *) + probesize: cardinal; + + (** + * maximum duration in AV_TIME_BASE units over which the input should be analyzed in av_find_stream_info() + *) + max_analyze_duration: integer; + + key: pbyte; + keylen : integer + end; + + TAVPacketList = record {64} + pkt: TAVPacket; + next: PAVPacketList; + end; + +(* still image support *) + PAVInputImageContext = pointer; // attribute_deprecated; +// PAVInputImageContext = pointer; //AVInputImageContext attribute_deprecated; + +(* still image support *) + TAVImageInfo = record {48} + pix_fmt: TAVPixelFormat; (* requested pixel format *) + width: integer; (* requested width *) + height: integer; (* requested height *) + interleaved: integer; (* image is interleaved (e.g. interleaved GIF) *) + pict: TAVPicture; (* returned allocated image *) + end; + + TAVImageFormat = record {32} + name: pchar; + extensions: pchar; + (* tell if a given file has a chance of being parsing by this format *) + img_probe: function (d: PAVProbeData): integer; cdecl; + (* read a whole image. 'alloc_cb' is called when the image size is + known so that the caller can allocate the image. If 'allo_cb' + returns non zero, then the parsing is aborted. Return '0' if + OK. *) + img_read: function (b: PByteIOContext; alloc_cb: pointer; ptr: pointer): integer; cdecl; + (* write the image *) + supported_pixel_formats: integer; (* mask of supported formats for output *) + img_write: function (b: PByteIOContext; i: PAVImageInfo): integer; cdecl; + flags: integer; + next: PAVImageFormat; + end; + +procedure av_destruct_packet_nofree (var pkt: TAVPacket); (* CAT#2 *) + cdecl; external av__format; +procedure av_destruct_packet (var pkt: TAVPacket); (* CAT#2 *) + cdecl; external av__format; + +(* initialize optional fields of a packet *) +procedure av_init_packet (var pkt: TAVPacket); (* CAT#2 *) + +function av_new_packet(var pkt: TAVPacket; size: integer): integer; (* CAT#2 *) + cdecl; external av__format; + +function av_get_packet (s: PByteIOContext; var pkt: TAVPacket; size: integer): integer; (* CAT#2 *) + cdecl; external av__format; + +function av_dup_packet (pkt: PAVPacket): integer; + cdecl; external av__format; + +(** * Free a packet + * + * @param pkt packet to free *) +procedure av_free_packet (var pkt: TAVPacket); (* CAT#2 *) + +procedure av_register_image_format (img_fmt: PAVImageFormat); + cdecl; external av__format; + +function av_probe_image_format (pd: PAVProbeData): PAVImageFormat; + cdecl; external av__format; + +function guess_image_format (filename: pchar): PAVImageFormat; + cdecl; external av__format; + +function av_guess_image2_codec(filename: pchar): TCodecID; + cdecl; external av__format; + +function av_read_image (pb: PByteIOContext; filename: pchar; + fmt: PAVImageFormat; + alloc_cb: pointer; opaque: pointer): integer; + cdecl; external av__format; + +function av_write_image(pb: PByteIOContext; fmt: PAVImageFormat; img: PAVImageInfo): integer; + cdecl; external av__format; + +(* XXX: use automatic init with either ELF sections or C file parser *) +(* modules *) + +//#include "rtp.h" + +//#include "rtsp.h" + +(* utils.c *) + procedure av_register_input_format (format: PAVInputFormat); + cdecl; external av__format; + + procedure av_register_output_format (format: PAVOutputFormat); + cdecl; external av__format; + + function guess_stream_format (short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; + cdecl; external av__format; + + function guess_format(short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; + cdecl; external av__format; + + function av_guess_codec(fmt: PAVOutputFormat; short_name: pchar; + filename: pchar; mime_type: pchar; _type: TCodecType): TCodecID; + cdecl; external av__format; + + procedure av_hex_dump (f: HFILE; buf: pchar; size: integer); + cdecl; external av__format; + procedure av_pkt_dump(f: HFILE; var pkt: TAVPacket; dump_payload: integer); (* CAT#2 *) + cdecl; external av__format; + + procedure av_register_all (); + cdecl; external av__format; + + +(* media file input *) + function av_find_input_format (short_name: pchar): PAVInputFormat; + cdecl; external av__format; + function av_probe_input_format (pd: PAVProbeData; is_opened: integer): PAVInputFormat; + cdecl; external av__format; + function av_open_input_stream (ic_ptr: PAVFormatContext; + pb: PByteIOContext; filename: pchar; + fmt: PAVInputFormat; ap: PAVFormatParameters): integer; + cdecl; external av__format; +(*** Open a media file as input. The codec are not opened. Only the file + * header (if present) is read. + * + * @param ic_ptr the opened media file handle is put here + * @param filename filename to open. + * @param fmt if non NULL, force the file format to use + * @param buf_size optional buffer size (zero if default is OK) + * @param ap additionnal parameters needed when opening the file (NULL if default) + * @return 0 if OK. AVERROR_xxx otherwise. *) + + function av_open_input_file (var ic_ptr: PAVFormatContext; filename: pchar; + fmt: PAVInputFormat; buf_size: integer; + ap: PAVFormatParameters): integer; + cdecl; external av__format; + + (* no av_open for output, so applications will need this: *) + function av_alloc_format_context (): PAVFormatContext; + cdecl; external av__format; + +const + AVERROR_UNKNOWN =(-1); (* unknown error *) + AVERROR_IO =(-2); (* i/o error *) + AVERROR_NUMEXPECTED =(-3); (* number syntax expected in filename *) + AVERROR_INVALIDDATA =(-4); (* invalid data found *) + AVERROR_NOMEM =(-5); (* not enough memory *) + AVERROR_NOFMT =(-6); (* unknown format *) + AVERROR_NOTSUPP =(-7); (* operation not supported *) + +(*** Read the beginning of a media file to get stream information. This + * is useful for file formats with no headers such as MPEG. This + * function also compute the real frame rate in case of mpeg2 repeat + * frame mode. + * + * @param ic media file handle + * @return >=0 if OK. AVERROR_xxx if error. + * @todo let user decide somehow what information is needed so we dont waste time geting stuff the user doesnt need *) + + function av_find_stream_info (ic: PAVFormatContext): integer; + cdecl; external av__format; + function av_read_packet (s: PAVFormatContext; var pkt: TAVPacket): integer; (* CAT#2 *) + cdecl; external av__format; +(*** Return the next frame of a stream. + * + * The returned packet is valid + * until the next av_read_frame() or until av_close_input_file() and + * must be freed with av_free_packet. For video, the packet contains + * exactly one frame. For audio, it contains an integer number of + * frames if each frame has a known fixed size (e.g. PCM or ADPCM + * data). If the audio frames have a variable size (e.g. MPEG audio), + * then it contains one frame. + * + * pkt->pts, pkt->dts and pkt->duration are always set to correct + * values in AV_TIME_BASE unit (and guessed if the format cannot + * provided them). pkt->pts can be AV_NOPTS_VALUE if the video format + * has B frames, so it is better to rely on pkt->dts if you do not + * decompress the payload. + * + * @return 0 if OK, < 0 if error or end of file. *) + + function av_read_frame (s: PAVFormatContext; var pkt: TAVPacket): integer; (* CAT#2 *) + cdecl; external av__format; + function av_seek_frame (s: PAVFormatContext; stream_index: integer; timestamp: int64; flags: integer): integer; + cdecl; external av__format; + function av_read_play (s: PAVFormatContext): integer; + cdecl; external av__format; + function av_read_pause (s: PAVFormatContext): integer; + cdecl; external av__format; + procedure av_close_input_file (s: PAVFormatContext); + cdecl; external av__format; + function av_new_stream (s: PAVFormatContext; id: integer): PAVStream; + cdecl; external av__format; + procedure av_set_pts_info (s: PAVStream; pts_wrap_bits: integer; + pts_num: integer; pts_den: integer); + cdecl; external av__format; + +const + AVSEEK_FLAG_BACKWARD =1; ///< seek backward + AVSEEK_FLAG_BYTE =2; ///< seeking based on position in bytes + AVSEEK_FLAG_ANY =4; ///< seek to any frame, even non keyframes + + function av_find_default_stream_index (s: PAVFormatContext): integer; + cdecl; external av__format; + function av_index_search_timestamp (st: PAVStream; timestamp: int64; flags: integer): integer; + cdecl; external av__format; + function av_add_index_entry (st: PAVStream; pos: int64; timestamp: int64; + distance: integer; flags: integer): integer; + cdecl; external av__format; + function av_seek_frame_binary (s: PAVFormatContext; stream_index: integer; + target_ts: int64; flags: integer): integer; + cdecl; external av__format; + + procedure av_update_cur_dts (s: PAVFormatContext; ref_st: PAVStream; + timestamp: int64); + cdecl; external av__format; + +(* media file output *) + function av_set_parameters (s: PAVFormatContext; ap: PAVFormatParameters): integer; + cdecl; external av__format; + + function av_write_header (s: PAVFormatContext): integer; + cdecl; external av__format; + + function av_write_frame(s: PAVFormatContext; var pkt: TAVPacket): integer; + cdecl; external av__format; (* CAT#2 *) + + function av_interleaved_write_frame (s: PAVFormatContext; var pkt: TAVPacket): integer; + cdecl; external av__format; (* CAT#2 *) + + function av_interleave_packet_per_dts(s: PAVFormatContext; _out: PAVPacket; + pkt: PAVPacket; flush: integer): integer; + cdecl; external av__format; + function av_write_trailer(s: pAVFormatContext): integer; + cdecl; external av__format; + + procedure dump_format(ic: PAVFormatContext; index: integer; url: pchar; + is_output: integer); + cdecl; external av__format; + + function parse_image_size(width_ptr: PInteger; height_ptr: PInteger; str: pchar): integer; + cdecl; external av__format; + function parse_frame_rate (frame_rate: PInteger; frame_rate_base: PInteger; arg: pchar): integer; + cdecl; external av__format; + function parse_date(datestr: pchar; duration: integer): int64; + cdecl; external av__format; + function av_gettime (): int64; + cdecl; external av__format; + +(* ffm specific for ffserver *) +const + FFM_PACKET_SIZE = 4096; + + function ffm_read_write_index (fd: integer): int64; + cdecl; external av__format; + + procedure ffm_write_write_index(fd: integer; pos: int64); + cdecl; external av__format; + + procedure ffm_set_write_index (s: PAVFormatContext; pos: int64; file_size: int64); + cdecl; external av__format; + + function find_info_tag (arg: pchar; arg_size: integer; tag1: pchar; info: pchar): integer; + cdecl; external av__format; + + function get_frame_filename(buf: pchar; buf_size: integer; + path: pchar; number: integer): integer; + cdecl; external av__format; + function filename_number_test (filename: pchar): integer; + cdecl; external av__format; + + +(* grab specific *) + function video_grab_init (): integer; + cdecl; external av__format; + function audio_init (): integer; + cdecl; external av__format; + +(* DV1394 *) + function dv1394_init (): integer; + cdecl; external av__format; + function dc1394_init (): integer; + cdecl; external av__format; + + function strstart(str: pchar; val: pchar; ptr: PPointer): integer; + cdecl; external av__format; + function stristart(str: pchar; val: pchar; ptr: PPointer): integer; + cdecl; external av__format; + procedure pstrcpy(buf: pchar; buf_size: integer; str: pchar); + cdecl; external av__format; + function pstrcat(buf: pchar; buf_size: integer; s: pchar): pchar; + cdecl; external av__format; + + procedure __dynarray_add (tab_ptr: PPointer; nb_ptr: PInteger; elem: cardinal); + cdecl; external av__format; + + +implementation + +procedure av_init_packet (var pkt: TAVPacket); (* CAT#2 + bug fix *) +begin + with pkt do begin + pts := AV_NOPTS_VALUE; + dts := AV_NOPTS_VALUE; + pos := -1; + duration := 0; + flags := 0; + stream_index := 0; + destruct := @av_destruct_packet_nofree + end +end; + +procedure av_free_packet (var pkt: TAVPacket); (* CAT#2 *) +begin + if @pkt.destruct <> nil then pkt.destruct (@pkt) +{ if (pkt <> nil) and (@pkt^.destruct <> nil) then + pkt^.destruct (pkt)} +end; + +end. -- cgit v1.2.3 From 0f482be3ee9588081363963b382faabcef07c295 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 18 Dec 2007 23:47:42 +0000 Subject: Added a missing override for the destroy-destructor git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@730 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 445c7d4f..8701673e 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -100,7 +100,7 @@ type function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; procedure UnloadTexture(Name: string; FromCache: boolean); Constructor Create; - Destructor Destroy; + Destructor Destroy; override; end; var -- cgit v1.2.3 From 8239e84d1378a111c0336fa8e942fc6805dc847c Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 18 Dec 2007 23:51:19 +0000 Subject: Added a missing override-flag for the destroy-destructor git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@731 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/projectM/0.9/projectM.pas | 2 +- Game/Code/lib/projectM/1.0/projectM.pas | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/lib/projectM/0.9/projectM.pas b/Game/Code/lib/projectM/0.9/projectM.pas index 511e1744..b3103b2e 100644 --- a/Game/Code/lib/projectM/0.9/projectM.pas +++ b/Game/Code/lib/projectM/0.9/projectM.pas @@ -185,7 +185,7 @@ type keycode: TProjectMKeycode; modifier: TProjectMModifier); - destructor Destroy(); + destructor Destroy(); override; end; implementation diff --git a/Game/Code/lib/projectM/1.0/projectM.pas b/Game/Code/lib/projectM/1.0/projectM.pas index 87184e2f..47da36cc 100644 --- a/Game/Code/lib/projectM/1.0/projectM.pas +++ b/Game/Code/lib/projectM/1.0/projectM.pas @@ -195,7 +195,7 @@ type keycode: TProjectMKeycode; modifier: TProjectMModifier); - destructor Destroy(); + destructor Destroy(); override; end; implementation -- cgit v1.2.3 From 0d5fbd096cddf37bfc3a5f642644179c81bde582 Mon Sep 17 00:00:00 2001 From: mogguh Date: Thu, 20 Dec 2007 00:21:32 +0000 Subject: Minor refinings in score screen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@732 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphic.pas | 47 ++- Game/Code/Classes/UThemes.pas | 4 + Game/Code/Screens/UScreenScore.pas | 701 ++++++++++++++++++++++++++++--------- 3 files changed, 583 insertions(+), 169 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index f774a899..32d7d304 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -157,8 +157,20 @@ var //End PhrasenBonus - Line Bonus Mod //ScoreBG Texs - Tex_ScoreBG: array [0..5] of TTexture; + Tex_ScoreBG: array [1..6] of TTexture; + //Score Screen Textures + Tex_Score_NoteBarLevel_Dark : array [1..6] of TTexture; + Tex_Score_NoteBarRound_Dark : array [1..6] of TTexture; + + Tex_Score_NoteBarLevel_Light : array [1..6] of TTexture; + Tex_Score_NoteBarRound_Light : array [1..6] of TTexture; + + Tex_Score_NoteBarLevel_Lightest : array [1..6] of TTexture; + Tex_Score_NoteBarRound_Lightest : array [1..6] of TTexture; + + Tex_Score_Ratings : array [0..6] of TTexture; + const Skin_BGColorR = 1; Skin_BGColorG = 1; @@ -348,14 +360,45 @@ begin Tex_SingLineBonusBack[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LineBonusBack')), 'PNG', 'Colorized', Col); end; - //Score BG Textures +//## backgrounds for the scores ## for P := 0 to 5 do begin LoadColor(R, G, B, 'P' + IntToStr(P+1) + 'Light'); Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); Tex_ScoreBG[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreBG')), 'PNG', 'Colorized', Col); end; + Log.LogStatus('Loading Textures - D', 'LoadTextures'); + +// ###################### +// Score screen textures +// ###################### + +//## the bars that visualize the score ## + for P := 1 to 6 do begin +//NoteBar ScoreBar + LoadColor(R, G, B, 'P' + IntToStr(P) + 'Dark'); + Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + Tex_Score_NoteBarLevel_Dark[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Dark')), 'PNG', 'Colorized', Col); + Tex_Score_NoteBarRound_Dark[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Dark_Round')), 'PNG', 'Colorized', Col); +//LineBonus ScoreBar + LoadColor(R, G, B, 'P' + IntToStr(P) + 'Light'); + Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + Tex_Score_NoteBarLevel_Light[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Light')), 'PNG', 'Colorized', Col); + Tex_Score_NoteBarRound_Light[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Light_Round')), 'PNG', 'Colorized', Col); +//GoldenNotes ScoreBar + LoadColor(R, G, B, 'P' + IntToStr(P) + 'Lightest'); + Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + Tex_Score_NoteBarLevel_Lightest[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Lightest')), 'PNG', 'Colorized', Col); + Tex_Score_NoteBarRound_Lightest[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Lightest_Round')), 'PNG', 'Colorized', Col); + end; + +//## rating pictures that show a picture according to your rate ## + for P := 0 to 6 do begin + Tex_Score_Ratings[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Rating_'+IntToStr(P))), 'PNG', 'Transparent', 0); + end; + + Log.LogStatus('Loading Textures - Done', 'LoadTextures'); end; procedure Initialize3D (Title: string); diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index f7b08479..1c731ce0 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -343,6 +343,8 @@ type StaticBoxLight: array[1..6] of TThemeStatic; StaticBoxDark: array[1..6] of TThemeStatic; + StaticRatings: array[1..6] of TThemeStatic; + StaticBackLevel: array[1..6] of TThemeStatic; StaticBackLevelRound: array[1..6] of TThemeStatic; StaticLevel: array[1..6] of TThemeStatic; @@ -1082,6 +1084,8 @@ begin ThemeLoadStatic(Score.StaticBackLevelRound[I], 'ScoreStaticBackLevelRound' + IntToStr(I)); ThemeLoadStatic(Score.StaticLevel[I], 'ScoreStaticLevel' + IntToStr(I)); ThemeLoadStatic(Score.StaticLevelRound[I], 'ScoreStaticLevelRound' + IntToStr(I)); + + ThemeLoadStatic(Score.StaticRatings[I], 'ScoreStaticRatingPicture' + IntToStr(I)); end; // Top5 diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 0ed04b89..35296233 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -19,20 +19,69 @@ uses OpenGL12, {$ifdef win32} Windows, + dialogs, {$endif} math, - ULCD; - + ULCD, + UTexture; // OpenGL; +const + ZBars : real = 0.8; // Z value for the bars + ZRatingPic : real = 0.8; // Z value for the rating pictures + + EaseOut_MaxSteps : real = 40; // that's the speed of the bars (10 is fast | 100 is slower) + type + TPlayerScoreScreenTexture = record // holds all colorized textures for up to 6 players + //Bar textures + Score_NoteBarLevel_Dark : TTexture; // Note + Score_NoteBarRound_Dark : TTexture; // that's the round thing on top + + Score_NoteBarLevel_Light : TTexture; // LineBonus | Phrasebonus + Score_NoteBarRound_Light : TTexture; + + Score_NoteBarLevel_Lightest : TTexture; // GoldenNotes + Score_NoteBarRound_Lightest : TTexture; + end; + + TPlayerScoreScreenData = record // holds the positions and other data + Bar_X :Real; + Bar_Y :Real; + Bar_Height :Real; // this is the max height of the bar, who knows if there ever will be a theme with different heights :D + Bar_Width :Real; // another rather senseless setting, but you never know what our cool users do with the them :) + + Bar_Actual_Height : Real; // this one holds the actual height of the bar, while we animate it + BarScore_ActualHeight : Real; + BarLine_ActualHeight : Real; + BarGolden_ActualHeight : Real; + end; + + TPlayerScoreRatingPics = record // a fine array of the rating pictures + RatePic_X :Real; + RatePic_Y :Real; + RatePic_Height :Real; + RatePic_Width :Real; + + RateEaseStep : Integer; + RateEaseValue: Real; + end; + TScreenScore = class(TMenu) public + aPlayerScoreScreenTextures : array[1..6] of TPlayerScoreScreenTexture; + aPlayerScoreScreenDatas : array[1..6] of TPlayerScoreScreenData; + aPlayerScoreScreenRatings : array[1..6] of TPlayerScoreRatingPics; + + BarScore_EaseOut_Step : real; + BarPhrase_EaseOut_Step : real; + BarGolden_EaseOut_Step : real; + TextArtist: integer; TextTitle: integer; TextArtistTitle : integer; - + TextName: array[1..6] of integer; TextScore: array[1..6] of integer; @@ -61,19 +110,11 @@ type Animation: real; Fadeout: boolean; - BarScore_ActualHeight : array[0..5] of real; - BarPhrase_ActualHeight : array[0..5] of real; - BarGolden_ActualHeight : array[0..5] of real; - - BarScore_EaseOut_Step : real; - BarPhrase_EaseOut_Step : real; - BarGolden_EaseOut_Step : real; + TextScore_ActualValue : array[1..6] of integer; + TextPhrase_ActualValue : array[1..6] of integer; + TextGolden_ActualValue : array[1..6] of integer; - TextScore_ActualValue : array[0..5] of integer; - TextPhrase_ActualValue : array[0..5] of integer; - TextGolden_ActualValue : array[0..5] of integer; - EaseOut_MaxSteps : real; constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; @@ -82,8 +123,13 @@ type function Draw: boolean; override; procedure FillPlayer(Item, P: integer); - function RaiseBar(PlayerNumber: integer; BarStartPosY: Single; ActualHeight: real; Score: integer; ColorBrightness : String; EaseOut_Step: Real) : real; - function IncrementScore(PlayerNumber: integer; ActualScoreValue: Integer; ScoreReached: integer; EaseOut_Step: Real) : integer; + function EaseBarIn(PlayerNumber : Integer; BarType: String) : real; + function EaseScoreIn(PlayerNumber : Integer; ScoreType: String) : real; + + procedure FillPlayerItems(PlayerNumber : Integer; ScoreType: String); + procedure ShowRating(PlayerNumber: integer); + + function elastique(PlayerNumber : Integer): real; end; implementation @@ -142,18 +188,35 @@ end; constructor TScreenScore.Create; var - P: integer; - I, C: integer; + P : integer; + I, C : integer; + ArrayStartModifier : Byte; + begin inherited Create; LoadFromTheme(Theme.Score); - TextArtist := AddText(Theme.Score.TextArtist); - TextTitle := AddText(Theme.Score.TextTitle); - + TextArtist := AddText(Theme.Score.TextArtist); + TextTitle := AddText(Theme.Score.TextTitle); TextArtistTitle := AddText(Theme.Score.TextArtistTitle); + for P := 1 to 6 do + begin + //textures + aPlayerScoreScreenTextures[P].Score_NoteBarLevel_Dark := Tex_Score_NoteBarLevel_Dark[P]; + aPlayerScoreScreenTextures[P].Score_NoteBarRound_Dark := Tex_Score_NoteBarRound_Dark[P]; + + aPlayerScoreScreenTextures[P].Score_NoteBarLevel_Light := Tex_Score_NoteBarLevel_Light[P]; + aPlayerScoreScreenTextures[P].Score_NoteBarRound_Light := Tex_Score_NoteBarRound_Light[P]; + + aPlayerScoreScreenTextures[P].Score_NoteBarLevel_Lightest := Tex_Score_NoteBarLevel_Lightest[P]; + aPlayerScoreScreenTextures[P].Score_NoteBarRound_Lightest := Tex_Score_NoteBarRound_Lightest[P]; + end; + + +//old stuff + for P := 1 to 6 do begin SetLength(PlayerStatic[P], Length(Theme.Score.PlayerStatic[P])); @@ -186,6 +249,7 @@ begin StaticLevel[P] := AddStatic(Theme.Score.StaticLevel[P]); StaticLevelRound[P] := AddStatic(Theme.Score.StaticLevelRound[P]); end; + end; procedure TScreenScore.onShow; @@ -199,8 +263,44 @@ var V: array[1..6] of boolean; // visibility array MaxH: real; // maximum height of score bar Wsp: real; + ArrayStartModifier :integer; begin + case PlayersPlay of + 1: begin + ArrayStartModifier := 0; + end; + 2, 4: begin + ArrayStartModifier := 1; + end; + 3, 6: begin + ArrayStartModifier := 3; + end; + end; + + for P := 1 to PlayersPlay do + begin + // data + aPlayerScoreScreenDatas[P].Bar_X := Theme.Score.StaticBackLevel[P + ArrayStartModifier].X; + aPlayerScoreScreenDatas[P].Bar_Y := Theme.Score.StaticBackLevel[P + ArrayStartModifier].Y; + aPlayerScoreScreenDatas[P].Bar_Height := Theme.Score.StaticBackLevel[P + ArrayStartModifier].H; + aPlayerScoreScreenDatas[P].Bar_Width := Theme.Score.StaticBackLevel[P + ArrayStartModifier].W; + + aPlayerScoreScreenDatas[P].Bar_Actual_Height := 0; + aPlayerScoreScreenDatas[P].BarScore_ActualHeight := 0; + aPlayerScoreScreenDatas[P].BarLine_ActualHeight := 0; + aPlayerScoreScreenDatas[P].BarGolden_ActualHeight := 0; + + // ratings + aPlayerScoreScreenRatings[P].RatePic_X := Theme.Score.StaticRatings[P + ArrayStartModifier].X; + aPlayerScoreScreenRatings[P].RatePic_Y := Theme.Score.StaticRatings[P + ArrayStartModifier].Y; + aPlayerScoreScreenRatings[P].RatePic_Height := Theme.Score.StaticRatings[P + ArrayStartModifier].H; + aPlayerScoreScreenRatings[P].RatePic_Width := Theme.Score.StaticRatings[P + ArrayStartModifier].W; + aPlayerScoreScreenRatings[P].RateEaseStep := 1; + aPlayerScoreScreenRatings[P].RateEaseValue := 20; + end; + + // Singstar Fadeout := false; @@ -242,15 +342,18 @@ begin Text[TextScore[P]].Visible := V[P]; // We set alpha to 0 , so we can nicely blend them in when we need them - Text[TextScore[P]].Alpha := 0; - Text[TextNotesScore[P]].Alpha := 0; - Text[TextNotes[P]].Alpha := 0; - Text[TextLineBonus[P]].Alpha := 0; - Text[TextLineBonusScore[P]].Alpha := 0; - Text[TextGoldenNotes[P]].Alpha := 0; - Text[TextGoldenNotesScore[P]].Alpha := 0; - Text[TextTotal[P]].Alpha := 0; - Text[TextTotalScore[P]].Alpha := 0; + Text[TextScore[P]].Alpha := 0; + Text[TextNotesScore[P]].Alpha := 0; + Text[TextNotes[P]].Alpha := 0; + Text[TextLineBonus[P]].Alpha := 0; + Text[TextLineBonusScore[P]].Alpha := 0; + Text[TextGoldenNotes[P]].Alpha := 0; + Text[TextGoldenNotesScore[P]].Alpha := 0; + Text[TextTotal[P]].Alpha := 0; + Text[TextTotalScore[P]].Alpha := 0; + Static[StaticBoxLightest[P]].Texture.Alpha := 0; + Static[StaticBoxLight[P]].Texture.Alpha := 0; + Static[StaticBoxDark[P]].Texture.Alpha := 0; Text[TextNotes[P]].Visible := V[P]; @@ -272,7 +375,7 @@ begin Static[StaticBoxLight[P]].Visible := V[P]; Static[StaticBoxDark[P]].Visible := V[P]; -// +// we draw that on our own Static[StaticBackLevel[P]].Visible := false; Static[StaticBackLevelRound[P]].Visible := false; Static[StaticLevel[P]].Visible := false; @@ -284,11 +387,8 @@ procedure TScreenScore.onShowFinish; var index : integer; begin -for index := 0 to (PlayersPlay-1) do +for index := 1 to (PlayersPlay) do begin - BarScore_ActualHeight[index] := 0; - BarPhrase_ActualHeight[index] := 0; - BarGolden_ActualHeight[index] := 0; TextScore_ActualValue[index] := 0; TextPhrase_ActualValue[index] := 0; @@ -298,8 +398,6 @@ for index := 0 to (PlayersPlay-1) do BarScore_EaseOut_Step := 1; BarPhrase_EaseOut_Step := 1; BarGolden_EaseOut_Step := 1; - - EaseOut_MaxSteps := 100; end; function TScreenScore.Draw: boolean; @@ -314,11 +412,14 @@ var Item: integer; P: integer; - C: integer; + C, I: integer; + + CurTime: Cardinal; + + PlayerCounter : integer; - katze : integer; - ArrayStartModifier : integer; begin +{ // 0.5.0: try also use 4 players screen with nicks if PlayersPlay = 4 then begin @@ -339,7 +440,7 @@ begin FillPlayer(Item, P); -{ if ScreenAct = 1 then begin + if ScreenAct = 1 then begin LoadColor( Static[StaticBoxLightest[Item]].Texture.ColR, Static[StaticBoxLightest[Item]].Texture.ColG, @@ -353,57 +454,39 @@ begin Static[StaticBoxLightest[Item]].Texture.ColG, Static[StaticBoxLightest[Item]].Texture.ColB, 'P4Dark'); - end;} + end; end; + + end; +} +inherited Draw; - inherited Draw; + player[0].ScoreI := 7000; + player[0].ScoreLineI := 2000; + player[0].ScoreGoldenI := 1000; + player[0].ScoreTotalI := 10000; - //player[1].ScoreI := 7000; - //player[1].ScoreLineI := 2000; - //player[1].ScoreGoldenI := 1000; + player[1].ScoreI := 2500; + player[1].ScoreLineI := 1100; + player[1].ScoreGoldenI := 900; + player[1].ScoreTotalI := 4500; - //player[2].ScoreI := 2500; - //player[2].ScoreLineI := 1100; - //player[2].ScoreGoldenI := 900; // Let's arise the bars + ActualTime := GetTickCount div 33; if ((ActualTime <> OldTime) and ShowFinish )then begin OldTime := ActualTime; -// okay i hate that as much as you might do too, but there's no way around that yet (imho) -// all statics / texts are loaded at start - so that we have them all even if we change the amount of players -// array overview: - -// 1 Player -> Player[0].Score (The score for one player starts at 0) -// -> Statics[1] (The statics for the one player screen start at 0) -// 2 Player -> Player[0..1].Score -// -> Statics[2..3] -// 3 Player -> Player[0..5].Score -// -> Statics[4..6] - - case PlayersPlay of - 1: begin - ArrayStartModifier := 1; - end; - 2, 4: begin - ArrayStartModifier := 2; - end; - 3, 6: begin - ArrayStartModifier := 4; - end; - end; - - For katze:= 0 to (PlayersPlay-1) do + For PlayerCounter := 1 to PlayersPlay do begin // We actually araise them in the right order, but we have to draw them in reverse order (golden -> phrase -> mainscore) - Case BarScore_EaseOut_Step < EaseOut_MaxSteps * 10 of - true : BarScore_EaseOut_Step := BarScore_EaseOut_Step + 1; - end; + if (BarScore_EaseOut_Step < EaseOut_MaxSteps * 10) + then BarScore_EaseOut_Step := BarScore_EaseOut_Step + 1; // PhrasenBonus if (BarScore_EaseOut_Step >= (EaseOut_MaxSteps * 10)) then @@ -423,79 +506,250 @@ begin // Draw golden score bar # //######################## - BarGolden_ActualHeight[katze] := RaiseBar(katze + ArrayStartModifier, - Static[StaticBackLevel[katze + ArrayStartModifier]].Texture.y - BarScore_ActualHeight[katze] - BarPhrase_ActualHeight[katze], - BarGolden_ActualHeight[katze], - player[katze].ScoreGoldenI, - 'Lightest', - BarGolden_EaseOut_Step); - - // Increment and show total score and plain score - TextGolden_ActualValue[katze] := IncrementScore(katze, - TextGolden_ActualValue[katze], - Player[katze].ScoreGoldenI, - BarGolden_EaseOut_Step); - Text[TextGoldenNotesScore[katze + ArrayStartModifier]].Text := IntToStr(TextGolden_ActualValue[katze]); - - // Blend in - Text[TextGoldenNotesScore[katze + ArrayStartModifier]].Alpha := (BarGolden_EaseOut_Step / 100); - Text[TextGoldenNotes[katze + ArrayStartModifier]].Alpha := (BarGolden_EaseOut_Step / 100); + EaseBarIn(PlayerCounter, 'Golden'); // ease bar for golden notes in + EaseScoreIn(PlayerCounter,'Golden'); end; //######################## // Draw phrase score bar # //######################## - BarPhrase_ActualHeight[katze] := RaiseBar(katze + ArrayStartModifier, - Static[StaticBackLevel[katze + ArrayStartModifier]].Texture.y - BarScore_ActualHeight[katze], - BarPhrase_ActualHeight[katze], - Player[katze].ScoreLineI, - 'Light', - BarPhrase_EaseOut_Step); - - // Increment and show total score and plain score - TextPhrase_ActualValue[katze] := IncrementScore(katze, - TextPhrase_ActualValue[katze], - Player[katze].ScoreLineI, - BarPhrase_EaseOut_Step); - Text[TextLineBonusScore[katze + ArrayStartModifier]].Text := IntToStr(TextPhrase_ActualValue[katze]); - //Blend in - Text[TextLineBonusScore[katze + ArrayStartModifier]].Alpha := (BarPhrase_EaseOut_Step / 100); - Text[TextLineBonus[katze + ArrayStartModifier]].Alpha := (BarPhrase_EaseOut_Step / 100); + EaseBarIn(PlayerCounter, 'Line'); // ease bar for line bonus / phrasenbonus notes in + EaseScoreIn(PlayerCounter,'Line'); end; //####################### // Draw plain score bar # //####################### - BarScore_ActualHeight[katze] := RaiseBar(katze + ArrayStartModifier, - Static[StaticBackLevel[katze + ArrayStartModifier]].Texture.y, - BarScore_ActualHeight[katze], - Player[katze].ScoreI, - 'Dark', - BarScore_EaseOut_Step); - // Increment and show total score and plain score - TextScore_ActualValue[katze] := IncrementScore(katze, - TextScore_ActualValue[katze], - Player[katze].ScoreI, - BarScore_EaseOut_Step); - Text[TextNotesScore[katze + ArrayStartModifier]].Text := IntToStr(TextScore_ActualValue[katze]); - - Text[TextTotalScore[katze + ArrayStartModifier]].Text := IntToStr(TextScore_ActualValue[katze] + TextPhrase_ActualValue[katze] + TextGolden_ActualValue[katze]); - - //Blend em in - Text[TextTotalScore[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextTotal[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextNotesScore[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextNotes[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextScore[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); - - end; // me loop + + + EaseBarIn(PlayerCounter, 'Note'); // ease bar for all other notes in + EaseScoreIn(PlayerCounter,'Note'); + + + FillPlayerItems(PlayerCounter,'Funky'); + + end; + end; +//todo: i need a clever method to draw statics with their z value + for I := 0 to Length(Static) - 1 do + Static[I].Draw; + for I := 0 to Length(Text) - 1 do + Text[I].Draw; +end; + +procedure TscreenScore.FillPlayerItems(PlayerNumber : Integer; ScoreType: String); +var + ArrayStartModifier : integer; +begin +// okay i hate that as much as you might do too, but there's no way around that yet (imho) +// all statics / texts are loaded at start - so that we have them all even if we change the amount of players +// array overview: + +// 1 Player -> Player[0].Score (The score for one player starts at 0) +// -> Statics[1] (The statics for the one player screen start at 0) +// 2 Player -> Player[0..1].Score +// -> Statics[2..3] +// 3 Player -> Player[0..5].Score +// -> Statics[4..6] + + case PlayersPlay of + 1: begin + ArrayStartModifier := 0; + end; + 2, 4: begin + ArrayStartModifier := 1; + end; + 3, 6: begin + ArrayStartModifier := 3; + end; + end; + +// todo: take the name from player[PlayerNumber].Name instead of the ini when this is done (mog) + Text[TextName[PlayerNumber + ArrayStartModifier]].Text := Ini.Name[PlayerNumber - 1]; +// end todo + + +//golden + Text[TextGoldenNotesScore[PlayerNumber + ArrayStartModifier]].Text := IntToStr(TextGolden_ActualValue[PlayerNumber]); + Text[TextGoldenNotesScore[PlayerNumber + ArrayStartModifier]].Alpha := (BarGolden_EaseOut_Step / 100); + + Static[StaticBoxLightest[PlayerNumber + ArrayStartModifier]].Texture.Alpha := (BarGolden_EaseOut_Step / 100); + Text[TextGoldenNotes[PlayerNumber + ArrayStartModifier]].Alpha := (BarGolden_EaseOut_Step / 100); + + // line bonus + Text[TextLineBonusScore[PlayerNumber + ArrayStartModifier]].Text := IntToStr(TextPhrase_ActualValue[PlayerNumber]); + Text[TextLineBonusScore[PlayerNumber + ArrayStartModifier]].Alpha := (BarPhrase_EaseOut_Step / 100); + + Static[StaticBoxLight[PlayerNumber + ArrayStartModifier]].Texture.Alpha := (BarPhrase_EaseOut_Step / 100); + Text[TextLineBonus[PlayerNumber + ArrayStartModifier]].Alpha := (BarPhrase_EaseOut_Step / 100); + +// plain score + Text[TextNotesScore[PlayerNumber + ArrayStartModifier]].Text := IntToStr(TextScore_ActualValue[PlayerNumber]); + Text[TextNotes[PlayerNumber + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); + + Static[StaticBoxDark[PlayerNumber + ArrayStartModifier]].Texture.Alpha := (BarScore_EaseOut_Step / 100); + Text[TextNotesScore[PlayerNumber + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); + +// total score + Text[TextTotalScore[PlayerNumber + ArrayStartModifier]].Text := IntToStr(TextScore_ActualValue[PlayerNumber] + TextPhrase_ActualValue[PlayerNumber] + TextGolden_ActualValue[PlayerNumber]); + Text[TextTotalScore[PlayerNumber + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); + + Text[TextTotal[PlayerNumber + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); + + Text[TextTotal[PlayerNumber + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); + + if(BarGolden_EaseOut_Step > 100) then + begin + ShowRating(PlayerNumber); end; + end; + + +procedure TScreenScore.ShowRating(PlayerNumber: integer); +var + ArrayStartModifier : integer; + Rating : integer; + fu : integer; + + Posx : real; + Posy : real; + width : array[1..3] of real; +begin + case PlayersPlay of + 1: begin + ArrayStartModifier := 0; + end; + 2, 4: begin + ArrayStartModifier := 1; + end; + 3, 6: begin + ArrayStartModifier := 3; + end; + end; + + fu := PlayerNumber + ArrayStartModifier; + +//todo: this could break if the width is not given, for instance when there's a skin with no picture for ratings + Text[TextScore[PlayerNumber + ArrayStartModifier]].Alpha := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue / aPlayerScoreScreenRatings[PlayerNumber].RatePic_Width; +// end todo + {{$IFDEF TRANSLATE} + case (Player[PlayerNumber-1].ScoreTotalI) of + 0..2000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_TONE_DEAF'); + Rating := 0; + end; + 2010..4000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_AMATEUR'); + Rating := 1; + end; + 4010..6000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_RISING_STAR'); + Rating := 2; + end; + 6010..8000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_LEAD_SINGER'); + Rating := 3; + end; + 8010..9000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_HIT_ARTIST'); + Rating := 4; + end; + 9010..9800: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_SUPERSTAR'); + Rating := 5; + end; + 9810..10000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_ULTRASTAR'); + Rating := 6; + end; + end; + {{$ELSE}{ + case (Player[P].ScoreTotalI-1) of + 0..2000: Text[TextScore[fu]].Text := 'Tone Deaf'; + 2010..4000: Text[TextScore[fu]].Text := 'Amateur'; + 4010..6000: Text[TextScore[fu]].Text := 'Rising Star'; + 6010..8000: Text[TextScore[fu]].Text := 'Lead Singer'; + 8010..9000: Text[TextScore[fu]].Text := 'Hit Artist'; + 9010..9800: Text[TextScore[fu]].Text := 'Superstar'; + 9810..10000: Text[TextScore[fu]].Text := 'Ultrastar'; + end; + {$ENDIF} + +// Bounce the rating picture in + PosX := aPlayerScoreScreenRatings[PlayerNumber].RatePic_X + (aPlayerScoreScreenRatings[PlayerNumber].RatePic_Width / 2); + PosY := aPlayerScoreScreenRatings[PlayerNumber].RatePic_Y + (aPlayerScoreScreenRatings[PlayerNumber].RatePic_Height / 2); ; + + elastique(PlayerNumber); + + width[PlayerNumber] := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue/2; + + glBindTexture(GL_TEXTURE_2D, Tex_Score_Ratings[Rating].TexNum); + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(PosX - width[PlayerNumber], PosY - width[PlayerNumber]); + glTexCoord2f(Tex_Score_Ratings[Rating].TexW, 0); glVertex2f(PosX + width[PlayerNumber], PosY - width[PlayerNumber]); + glTexCoord2f(Tex_Score_Ratings[Rating].TexW, Tex_Score_Ratings[Rating].TexH); glVertex2f(PosX + width[PlayerNumber], PosY + width[PlayerNumber]); + glTexCoord2f(0, Tex_Score_Ratings[Rating].TexH); glVertex2f(PosX - width[PlayerNumber], PosY + width[PlayerNumber]); + glEnd; + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2d); end; -function TscreenScore.RaiseBar(PlayerNumber: integer; BarStartPosY: Single; ActualHeight: real; Score: integer; ColorBrightness : String; EaseOut_Step: Real) : real; +function TscreenScore.elastique(PlayerNumber : Integer): real; +var + ReturnValue : real; + p, s : real; + + RaiseStep, Actual_Value, MaxVal : real; + EaseOut_Step : integer; +begin + + EaseOut_Step := aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep; + Actual_Value := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue; + MaxVal := aPlayerScoreScreenRatings[PlayerNumber].RatePic_Width; + + RaiseStep := EaseOut_Step; + + if (RaiseStep = 0) + then ReturnValue := MaxVal; + + RaiseStep := RaiseStep / MaxVal; + + if (RaiseStep = 1) + then + begin + ReturnValue := MaxVal; + end + else + begin + p := MaxVal * 0.4; + + s := p/(2*PI) * arcsin (1); + ReturnValue := MaxVal * power(2,-5 * RaiseStep) * sin( (RaiseStep * MaxVal - s) * (2 * PI) / p) + MaxVal; + + inc(aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep); + aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue := ReturnValue; + end; + Result := ReturnValue; +end; + + +function TscreenScore.EaseBarIn(PlayerNumber : Integer; BarType: String) : real; const RaiseSmoothness : integer = 100; var @@ -508,25 +762,52 @@ var RaiseStep : real; BarStartPosX : Single; + BarStartPosY : Single; - R,G,B : real; lTmp : real; + Score : integer; + + //textures + TextureBar : integer; + TextureRound : integer; begin - MaxHeight := Static[StaticBackLevel[PlayerNumber]].Texture.H; - Width := Static[StaticBackLevel[PlayerNumber]].Texture.W; + MaxHeight := aPlayerScoreScreenDatas[PlayerNumber].Bar_Height; + Width := aPlayerScoreScreenDatas[PlayerNumber].Bar_Width; - BarStartPosX := Static[StaticBackLevel[PlayerNumber]].Texture.X; + BarStartPosX := aPlayerScoreScreenDatas[PlayerNumber].Bar_X; - BarStartPosY := BarStartPosY + MaxHeight; // The texture starts in the upper left corner, so let's subtract the height - so we can arise it + // The texture starts in the upper left corner, so let's subtract the height - so we can arise it + + // let's get the points according to the bar we draw + // score array starts at 0, which means the score for player 1 is in score[0] + // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps + if (BarType = 'Note') + then + begin + Score := Player[PlayerNumber - 1].ScoreI; + RaiseStep := BarScore_EaseOut_Step; + BarStartPosY := aPlayerScoreScreenDatas[PlayerNumber].Bar_Y + MaxHeight; + end; + if (BarType = 'Line') + then + begin + Score := Player[PlayerNumber - 1].ScoreLineI; + RaiseStep := BarPhrase_EaseOut_Step; + BarStartPosY := aPlayerScoreScreenDatas[PlayerNumber].Bar_Y - aPlayerScoreScreenDatas[PlayerNumber].BarScore_ActualHeight + MaxHeight; + end; + if (BarType = 'Golden') + then + begin + Score := Player[PlayerNumber - 1].ScoreGoldenI; + RaiseStep := BarGolden_EaseOut_Step; + BarStartPosY := aPlayerScoreScreenDatas[PlayerNumber].Bar_Y - aPlayerScoreScreenDatas[PlayerNumber].BarScore_ActualHeight - aPlayerScoreScreenDatas[PlayerNumber].BarLine_ActualHeight + MaxHeight; + end; // the height dependend of the score Height2Reach := (Score / 10000) * MaxHeight; - // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps - RaiseStep := EaseOut_Step; - - if (ActualHeight < Height2Reach) then + if (aPlayerScoreScreenDatas[PlayerNumber].Bar_Actual_Height < Height2Reach) then begin // Check http://proto.layer51.com/d.aspx?f=400 for more info on easing functions // Calculate the actual step according to the maxsteps @@ -535,58 +816,117 @@ begin // quadratic easing out - decelerating to zero velocity // -end_position * current_time * ( current_time - 2 ) + start_postion lTmp := (-Height2Reach * RaiseStep * (RaiseStep - 20) + BarStartPosY); - if ( RaiseSmoothness > 0 ) AND - ( lTmp > 0 ) then - begin - NewHeight := lTmp / RaiseSmoothness; - end; + + if ( RaiseSmoothness > 0 ) AND ( lTmp > 0 ) + then + begin + NewHeight := lTmp / RaiseSmoothness; + end; end else begin NewHeight := Height2Reach; end; - //+1 - LoadColor(R, G, B, 'P' + inttostr(PlayerNumber) + ColorBrightness); //dark, light, lightest - glColor4f(R, G, B, 1); - //the actual bar - glBindTexture(GL_TEXTURE_2D, Static[StaticLevel[PlayerNumber]].Texture.TexNum); + glColor4f(1, 1, 1, 1); + +// set the texture for the bar + if (BarType = 'Note') + then + begin + glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarLevel_Dark.TexNum); + end; + if (BarType = 'Line') + then + begin + glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarLevel_Light.TexNum); + end; + if (BarType = 'Golden') + then + begin + glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarLevel_Lightest.TexNum); + end; + //draw it glEnable(GL_TEXTURE_2D); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(BarStartPosX, BarStartPosY - NewHeight); - glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, BarStartPosY - NewHeight); - glTexCoord2f(1, 1); glVertex2f(BarStartPosX + Width, BarStartPosY); - glTexCoord2f(0, 1); glVertex2f(BarStartPosX, BarStartPosY); + glTexCoord2f(0, 0); glVertex3f(BarStartPosX, BarStartPosY - NewHeight, ZBars); + glTexCoord2f(1, 0); glVertex3f(BarStartPosX + Width, BarStartPosY - NewHeight, ZBars); + glTexCoord2f(1, 1); glVertex3f(BarStartPosX + Width, BarStartPosY, ZBars); + glTexCoord2f(0, 1); glVertex3f(BarStartPosX, BarStartPosY, ZBars); glEnd; - //the round thing on top - glBindTexture(GL_TEXTURE_2D, Static[StaticLevelRound[PlayerNumber]].Texture.TexNum); + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2d); + + //the round thing on top + if (BarType = 'Note') then + glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarRound_Dark.TexNum); + if (BarType = 'Line') then + glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarRound_Light.TexNum); + if (BarType = 'Golden') then + glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarRound_Lightest.TexNum); glEnable(GL_TEXTURE_2D); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(BarStartPosX, (BarStartPosY - Static[StaticLevelRound[PlayerNumber]].Texture.h) - NewHeight); - glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, (BarStartPosY - Static[StaticLevelRound[PlayerNumber]].Texture.h) - NewHeight); - glTexCoord2f(1, 1); glVertex2f(BarStartPosX + Width, BarStartPosY - NewHeight); - glTexCoord2f(0, 1); glVertex2f(BarStartPosX, BarStartPosY - NewHeight); + glTexCoord2f(0, 0); glVertex3f(BarStartPosX, (BarStartPosY - Static[StaticLevelRound[PlayerNumber]].Texture.h) - NewHeight, ZBars); + glTexCoord2f(1, 0); glVertex3f(BarStartPosX + Width, (BarStartPosY - Static[StaticLevelRound[PlayerNumber]].Texture.h) - NewHeight, ZBars); + glTexCoord2f(1, 1); glVertex3f(BarStartPosX + Width, BarStartPosY - NewHeight, ZBars); + glTexCoord2f(0, 1); glVertex3f(BarStartPosX, BarStartPosY - NewHeight, ZBars); glEnd; - Result := NewHeight; + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2d); + + if (BarType = 'Note') + then + aPlayerScoreScreenDatas[PlayerNumber].BarScore_ActualHeight := NewHeight; + if (BarType = 'Line') + then + aPlayerScoreScreenDatas[PlayerNumber].BarLine_ActualHeight := NewHeight; + if (BarType = 'Golden') + then + aPlayerScoreScreenDatas[PlayerNumber].BarGolden_ActualHeight := NewHeight; end; -function TScreenScore.IncrementScore(PlayerNumber: integer; ActualScoreValue: Integer; ScoreReached: integer; EaseOut_Step: Real) : integer; + +function TScreenScore.EaseScoreIn(PlayerNumber: integer; ScoreType : String) : real; const RaiseSmoothness : integer = 100; var RaiseStep : Real; lTmpA : Real; + ScoreReached :Integer; + EaseOut_Step :Real; + ActualScoreValue:integer; begin + + + if (ScoreType = 'Note') then + begin + EaseOut_Step := BarScore_EaseOut_Step; + ActualScoreValue := TextScore_ActualValue[PlayerNumber]; + ScoreReached := Player[PlayerNumber-1].ScoreI; + end; + if (ScoreType = 'Line') then + begin + EaseOut_Step := BarPhrase_EaseOut_Step; + ActualScoreValue := TextPhrase_ActualValue[PlayerNumber]; + ScoreReached := Player[PlayerNumber-1].ScoreLineI; + end; + if (ScoreType = 'Golden') then + begin + EaseOut_Step := BarGolden_EaseOut_Step; + ActualScoreValue := TextGolden_ActualValue[PlayerNumber]; + ScoreReached := Player[PlayerNumber-1].ScoreGoldenI; + end; + // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps RaiseStep := EaseOut_Step; @@ -601,12 +941,38 @@ begin if ( lTmpA > 0 ) AND ( RaiseSmoothness > 0 ) THEN begin - Result := floor( lTmpA / RaiseSmoothness); + + if (ScoreType = 'Note') then + begin + TextScore_ActualValue[PlayerNumber] := floor( lTmpA / RaiseSmoothness); + end; + if (ScoreType = 'Line') then + begin + TextPhrase_ActualValue[PlayerNumber] := floor( lTmpA / RaiseSmoothness); + end; + if (ScoreType = 'Golden') then + begin + TextGolden_ActualValue[PlayerNumber] := floor( lTmpA / RaiseSmoothness); + end; + end; end else begin - Result := ScoreReached; + + if (ScoreType = 'Note') then + begin + TextScore_ActualValue[PlayerNumber] := ScoreReached; + end; + if (ScoreType = 'Line') then + begin + TextPhrase_ActualValue[PlayerNumber] := ScoreReached; + end; + if (ScoreType = 'Golden') then + begin + TextGolden_ActualValue[PlayerNumber] := ScoreReached; + end; + end; end; @@ -644,7 +1010,7 @@ begin Text[TextName[Item]].ColG, Text[TextName[Item]].ColB, 'P' + IntToStr(P+1) + 'Dark'); - + { LoadColor( Static[StaticBoxLightest[Item]].Texture.ColR, Static[StaticBoxLightest[Item]].Texture.ColG, @@ -662,6 +1028,7 @@ begin Static[StaticBoxDark[Item]].Texture.ColG, Static[StaticBoxDark[Item]].Texture.ColB, 'P' + IntToStr(P+1) + 'Dark'); + } end; end. -- cgit v1.2.3 From 0fc1609b13b256acef7fe9ab456225b68a806730 Mon Sep 17 00:00:00 2001 From: mogguh Date: Thu, 20 Dec 2007 00:38:12 +0000 Subject: Some more minor refining in the score screen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@733 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenScore.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 35296233..7273a06c 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -462,7 +462,7 @@ begin end; } inherited Draw; - + {* player[0].ScoreI := 7000; player[0].ScoreLineI := 2000; player[0].ScoreGoldenI := 1000; @@ -472,7 +472,7 @@ inherited Draw; player[1].ScoreLineI := 1100; player[1].ScoreGoldenI := 900; player[1].ScoreTotalI := 4500; - + *} // Let's arise the bars -- cgit v1.2.3 From cdfdd0ea3fa2eb92893db46c158cf61b7a9411d7 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Dec 2007 01:33:30 +0000 Subject: fixed divide by 0 bugs in score screen. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@734 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenScore.pas | 331 +++++++++++++++++++------------------ 1 file changed, 170 insertions(+), 161 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 7273a06c..84fd4e15 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -267,15 +267,15 @@ var begin case PlayersPlay of - 1: begin - ArrayStartModifier := 0; - end; - 2, 4: begin - ArrayStartModifier := 1; - end; - 3, 6: begin - ArrayStartModifier := 3; - end; + 1: begin + ArrayStartModifier := 0; + end; + 2, 4: begin + ArrayStartModifier := 1; + end; + 3, 6: begin + ArrayStartModifier := 3; + end; end; for P := 1 to PlayersPlay do @@ -309,36 +309,36 @@ begin Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; // set visibility - case PlayersPlay of - 1: begin - V[1] := true; - V[2] := false; - V[3] := false; - V[4] := false; - V[5] := false; - V[6] := false; - end; - 2, 4: begin - V[1] := false; - V[2] := true; - V[3] := true; - V[4] := false; - V[5] := false; - V[6] := false; - end; - 3, 6: begin - V[1] := false; - V[2] := false; - V[3] := false; - V[4] := true; - V[5] := true; - V[6] := true; - end; + case PlayersPlay of + 1: begin + V[1] := true; + V[2] := false; + V[3] := false; + V[4] := false; + V[5] := false; + V[6] := false; + end; + 2, 4: begin + V[1] := false; + V[2] := true; + V[3] := true; + V[4] := false; + V[5] := false; + V[6] := false; + end; + 3, 6: begin + V[1] := false; + V[2] := false; + V[3] := false; + V[4] := true; + V[5] := true; + V[6] := true; + end; end; for P := 1 to 6 do begin - Text[TextName[P]].Visible := V[P]; + Text[TextName[P]].Visible := V[P]; Text[TextScore[P]].Visible := V[P]; // We set alpha to 0 , so we can nicely blend them in when we need them @@ -352,27 +352,27 @@ begin Text[TextTotal[P]].Alpha := 0; Text[TextTotalScore[P]].Alpha := 0; Static[StaticBoxLightest[P]].Texture.Alpha := 0; - Static[StaticBoxLight[P]].Texture.Alpha := 0; + Static[StaticBoxLight[P]].Texture.Alpha := 0; Static[StaticBoxDark[P]].Texture.Alpha := 0; Text[TextNotes[P]].Visible := V[P]; - Text[TextNotesScore[P]].Visible := V[P]; - Text[TextLineBonus[P]].Visible := V[P]; - Text[TextLineBonusScore[P]].Visible := V[P]; - Text[TextGoldenNotes[P]].Visible := V[P]; - Text[TextGoldenNotesScore[P]].Visible := V[P]; - Text[TextTotal[P]].Visible := V[P]; - Text[TextTotalScore[P]].Visible := V[P]; - - for I := 0 to high(PlayerStatic[P]) do - Static[PlayerStatic[P, I]].Visible := V[P]; - - for I := 0 to high(PlayerTexts[P]) do - Text[PlayerTexts[P, I]].Visible := V[P]; - - Static[StaticBoxLightest[P]].Visible := V[P]; - Static[StaticBoxLight[P]].Visible := V[P]; + Text[TextNotesScore[P]].Visible := V[P]; + Text[TextLineBonus[P]].Visible := V[P]; + Text[TextLineBonusScore[P]].Visible := V[P]; + Text[TextGoldenNotes[P]].Visible := V[P]; + Text[TextGoldenNotesScore[P]].Visible := V[P]; + Text[TextTotal[P]].Visible := V[P]; + Text[TextTotalScore[P]].Visible := V[P]; + + for I := 0 to high(PlayerStatic[P]) do + Static[PlayerStatic[P, I]].Visible := V[P]; + + for I := 0 to high(PlayerTexts[P]) do + Text[PlayerTexts[P, I]].Visible := V[P]; + + Static[StaticBoxLightest[P]].Visible := V[P]; + Static[StaticBoxLight[P]].Visible := V[P]; Static[StaticBoxDark[P]].Visible := V[P]; // we draw that on our own @@ -555,19 +555,19 @@ begin // -> Statics[4..6] case PlayersPlay of - 1: begin - ArrayStartModifier := 0; - end; - 2, 4: begin - ArrayStartModifier := 1; - end; - 3, 6: begin - ArrayStartModifier := 3; - end; + 1: begin + ArrayStartModifier := 0; + end; + 2, 4: begin + ArrayStartModifier := 1; + end; + 3, 6: begin + ArrayStartModifier := 3; + end; end; // todo: take the name from player[PlayerNumber].Name instead of the ini when this is done (mog) - Text[TextName[PlayerNumber + ArrayStartModifier]].Text := Ini.Name[PlayerNumber - 1]; + Text[TextName[PlayerNumber + ArrayStartModifier]].Text := Ini.Name[PlayerNumber - 1]; // end todo @@ -618,70 +618,75 @@ var width : array[1..3] of real; begin case PlayersPlay of - 1: begin - ArrayStartModifier := 0; - end; - 2, 4: begin - ArrayStartModifier := 1; - end; - 3, 6: begin - ArrayStartModifier := 3; - end; + 1: begin + ArrayStartModifier := 0; + end; + 2, 4: begin + ArrayStartModifier := 1; + end; + 3, 6: begin + ArrayStartModifier := 3; + end; end; - fu := PlayerNumber + ArrayStartModifier; - -//todo: this could break if the width is not given, for instance when there's a skin with no picture for ratings - Text[TextScore[PlayerNumber + ArrayStartModifier]].Alpha := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue / aPlayerScoreScreenRatings[PlayerNumber].RatePic_Width; -// end todo - {{$IFDEF TRANSLATE} - case (Player[PlayerNumber-1].ScoreTotalI) of - 0..2000: - begin - Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_TONE_DEAF'); - Rating := 0; - end; - 2010..4000: - begin - Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_AMATEUR'); - Rating := 1; - end; - 4010..6000: - begin - Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_RISING_STAR'); - Rating := 2; - end; - 6010..8000: - begin - Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_LEAD_SINGER'); - Rating := 3; - end; - 8010..9000: - begin - Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_HIT_ARTIST'); - Rating := 4; - end; - 9010..9800: - begin - Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_SUPERSTAR'); - Rating := 5; - end; - 9810..10000: - begin - Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_ULTRASTAR'); - Rating := 6; - end; - end; - {{$ELSE}{ - case (Player[P].ScoreTotalI-1) of - 0..2000: Text[TextScore[fu]].Text := 'Tone Deaf'; - 2010..4000: Text[TextScore[fu]].Text := 'Amateur'; - 4010..6000: Text[TextScore[fu]].Text := 'Rising Star'; - 6010..8000: Text[TextScore[fu]].Text := 'Lead Singer'; - 8010..9000: Text[TextScore[fu]].Text := 'Hit Artist'; - 9010..9800: Text[TextScore[fu]].Text := 'Superstar'; - 9810..10000: Text[TextScore[fu]].Text := 'Ultrastar'; - end; + fu := PlayerNumber + ArrayStartModifier; + +//todo: this could break if the width is not given, for instance when there's a skin with no picture for ratings + if ( aPlayerScoreScreenRatings[PlayerNumber].RatePic_Width > 0 ) AND // JB :) + ( aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue > 0 ) then + begin + Text[TextScore[PlayerNumber + ArrayStartModifier]].Alpha := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue / aPlayerScoreScreenRatings[PlayerNumber].RatePic_Width; + end; + +// end todo + {{$IFDEF TRANSLATE} + case (Player[PlayerNumber-1].ScoreTotalI) of + 0..2000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_TONE_DEAF'); + Rating := 0; + end; + 2010..4000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_AMATEUR'); + Rating := 1; + end; + 4010..6000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_RISING_STAR'); + Rating := 2; + end; + 6010..8000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_LEAD_SINGER'); + Rating := 3; + end; + 8010..9000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_HIT_ARTIST'); + Rating := 4; + end; + 9010..9800: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_SUPERSTAR'); + Rating := 5; + end; + 9810..10000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_ULTRASTAR'); + Rating := 6; + end; + end; + {{$ELSE}{ + case (Player[P].ScoreTotalI-1) of + 0..2000: Text[TextScore[fu]].Text := 'Tone Deaf'; + 2010..4000: Text[TextScore[fu]].Text := 'Amateur'; + 4010..6000: Text[TextScore[fu]].Text := 'Rising Star'; + 6010..8000: Text[TextScore[fu]].Text := 'Lead Singer'; + 8010..9000: Text[TextScore[fu]].Text := 'Hit Artist'; + 9010..9800: Text[TextScore[fu]].Text := 'Superstar'; + 9810..10000: Text[TextScore[fu]].Text := 'Ultrastar'; + end; {$ENDIF} // Bounce the rating picture in @@ -710,43 +715,47 @@ begin end; -function TscreenScore.elastique(PlayerNumber : Integer): real; -var - ReturnValue : real; - p, s : real; - - RaiseStep, Actual_Value, MaxVal : real; - EaseOut_Step : integer; -begin - - EaseOut_Step := aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep; - Actual_Value := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue; - MaxVal := aPlayerScoreScreenRatings[PlayerNumber].RatePic_Width; - - RaiseStep := EaseOut_Step; - - if (RaiseStep = 0) - then ReturnValue := MaxVal; - - RaiseStep := RaiseStep / MaxVal; - - if (RaiseStep = 1) - then - begin - ReturnValue := MaxVal; - end - else - begin - p := MaxVal * 0.4; - - s := p/(2*PI) * arcsin (1); - ReturnValue := MaxVal * power(2,-5 * RaiseStep) * sin( (RaiseStep * MaxVal - s) * (2 * PI) / p) + MaxVal; - - inc(aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep); - aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue := ReturnValue; - end; - Result := ReturnValue; -end; +function TscreenScore.elastique(PlayerNumber : Integer): real; +var + ReturnValue : real; + p, s : real; + + RaiseStep, Actual_Value, MaxVal : real; + EaseOut_Step : integer; +begin + + EaseOut_Step := aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep; + Actual_Value := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue; + MaxVal := aPlayerScoreScreenRatings[PlayerNumber].RatePic_Width; + + RaiseStep := EaseOut_Step; + + if (RaiseStep = 0) + then ReturnValue := MaxVal; + + if ( MaxVal > 0 ) AND // JB :) + ( RaiseStep > 0 ) then + begin + RaiseStep := RaiseStep / MaxVal; + end; + + if (RaiseStep = 1) + then + begin + ReturnValue := MaxVal; + end + else + begin + p := MaxVal * 0.4; + + s := p/(2*PI) * arcsin (1); + ReturnValue := MaxVal * power(2,-5 * RaiseStep) * sin( (RaiseStep * MaxVal - s) * (2 * PI) / p) + MaxVal; + + inc(aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep); + aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue := ReturnValue; + end; + Result := ReturnValue; +end; function TscreenScore.EaseBarIn(PlayerNumber : Integer; BarType: String) : real; -- cgit v1.2.3 From 7d61a98f807803a337fd12342c29eb0f5f69fc76 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Dec 2007 03:33:14 +0000 Subject: made USDX function when file paths differ from previous expectations.. ( most of the software was still using hard coded paths ) also added ability to have multiple song directories. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@735 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UIni.pas | 1593 ++++++++++++++-------------- Game/Code/Classes/UMain.pas | 36 +- Game/Code/Classes/UPlatform.pas | 63 +- Game/Code/Classes/UPlatformLinux.pas | 38 + Game/Code/Classes/USkins.pas | 35 +- Game/Code/Classes/USongs.pas | 9 +- Game/Code/Classes/UThemes.pas | 179 ++-- Game/Code/Classes/Ulazjpeg.pas | 300 +++--- Game/Code/Screens/UScreenOptionsThemes.pas | 6 +- Game/Code/UltraStar.dpr | 2 +- 10 files changed, 1183 insertions(+), 1078 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index f1b73d38..0e84c506 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -1,794 +1,799 @@ -unit UIni; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses IniFiles, ULog, SysUtils; - -type - TIni = class - Name: array[0..11] of string; - - // Templates for Names Mod - NameTeam: array[0..2] of string; - NameTemplate: array[0..11] of string; - - //Filename of the opened iniFile - Filename: string; - - // Game - Players: integer; - Difficulty: integer; - Language: integer; - Tabs: integer; - Tabs_at_startup:integer; //Tabs at Startup fix - Sorting: integer; - Debug: integer; - - // Graphics - Screens: integer; - Resolution: integer; - Depth: integer; - FullScreen: integer; - TextureSize: integer; - SingWindow: integer; - Oscilloscope: integer; - Spectrum: integer; - Spectrograph: integer; - MovieSize: integer; - - // Sound - MicBoost: integer; - ClickAssist: integer; - BeatClick: integer; - SavePlayback: integer; - Threshold: integer; - - //Song Preview - PreviewVolume: integer; - PreviewFading: integer; - - // Lyrics - LyricsFont: integer; - LyricsEffect: integer; - Solmization: integer; - - // Themes - Theme: integer; - SkinNo: integer; - Color: integer; - - // Record - Card: integer; // not saved in config.ini - - CardList: array of record - Name: string; - Input: integer; - ChannelL: integer; - ChannelR: integer; - end; - - // Advanced - LoadAnimation: integer; - EffectSing: integer; - ScreenFade: integer; - AskbeforeDel: integer; - OnSongClick: integer; - LineBonus: integer; - PartyPopup: integer; - - // Controller - Joypad: integer; - - // Soundcards - SoundCard: array[0..7, 1..2] of integer; - - // Devices - LPT: integer; - - procedure Load; - procedure Save; - procedure SaveNames; - procedure SaveLevel; - end; - - -var - Ini: TIni; - IResolution: array of string; - ILanguage: array of string; - ITheme: array of string; - ISkin: array of string; - ICard: array of string; - IInput: array of string; - -const - IPlayers: array[0..4] of string = ('1', '2', '3', '4', '6'); - IDifficulty: array[0..2] of string = ('Easy', 'Medium', 'Hard'); - ITabs: array[0..1] of string = ('Off', 'On'); - - ISorting: array[0..7] of string = ('Edition', 'Genre', 'Language', 'Folder', 'Title', 'Artist', 'Title2', 'Artist2'); - sEdition = 0; - sGenre = 1; - sLanguage = 2; - sFolder = 3; - sTitle = 4; - sArtist = 5; - sTitle2 = 6; - sArtist2 = 7; - - IDebug: array[0..1] of string = ('Off', 'On'); - - IScreens: array[0..1] of string = ('1', '2'); - IFullScreen: array[0..1] of string = ('Off', 'On'); - IDepth: array[0..1] of string = ('16 bit', '32 bit'); - ITextureSize: array[0..2] of string = ('128', '256', '512'); - ISingWindow: array[0..1] of string = ('Small', 'Big'); - - //SingBar Mod - IOscilloscope: array[0..2] of string = ('Off', 'Osci', 'Bar'); - //IOscilloscope: array[0..1] of string = ('Off', 'On'); - - ISpectrum: array[0..1] of string = ('Off', 'On'); - ISpectrograph: array[0..1] of string = ('Off', 'On'); - IMovieSize: array[0..2] of string = ('Half', 'Full [Vid]', 'Full [BG+Vid]'); - - IMicBoost: array[0..3] of string = ('Off', '+6dB', '+12dB', '+18dB'); - IClickAssist: array[0..1] of string = ('Off', 'On'); - IBeatClick: array[0..1] of string = ('Off', 'On'); - ISavePlayback: array[0..1] of string = ('Off', 'On'); - IThreshold: array[0..3] of string = ('5%', '10%', '15%', '20%'); - //Song Preview - IPreviewVolume: array[0..10] of string = ('Off', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%'); - IPreviewFading: array[0..5] of string = ('Off', '1 Sec', '2 Secs', '3 Secs', '4 Secs', '5 Secs'); - - - ILyricsFont: array[0..2] of string = ('Plain', 'OLine1', 'OLine2'); - ILyricsEffect: array[0..3] of string = ('Simple', 'Zoom', 'Slide', 'Ball'); - ISolmization: array[0..3] of string = ('Off', 'Euro', 'Jap', 'American'); - - IColor: array[0..8] of string = ('Blue', 'Green', 'Pink', 'Red', 'Violet', 'Orange', 'Yellow', 'Brown', 'Black'); - - // Advanced - ILoadAnimation: array[0..1] of string = ('Off', 'On'); - IEffectSing: array[0..1] of string = ('Off', 'On'); - IScreenFade: array [0..1] of String =('Off', 'On'); - IAskbeforeDel: array[0..1] of string = ('Off', 'On'); - IOnSongClick: array[0..2] of string = ('Sing', 'Select Players', 'Open Menu'); - ILineBonus: array[0..2] of string = ('Off', 'At Score', 'At Notes'); - IPartyPopup: array[0..1] of string = ('Off', 'On'); - - IJoypad: array[0..1] of string = ('Off', 'On'); - ILPT: array[0..2] of string = ('Off', 'LCD', 'Lights'); - - IChannel: array[0..6] of string = ('Off', '1', '2', '3', '4', '5', '6'); - -implementation - -uses //UFiles, - UMain, - SDL, - ULanguage, - USkins, - URecord, - UCommandLine; - -procedure TIni.Load; -var - IniFile: TMemIniFile; - ThemeIni: TMemIniFile; - Tekst: string; - Pet: integer; - B: boolean; - I, I2, I3: integer; - S: string; - Modes: PPSDL_Rect; - SR: TSearchRec; //Skin List Patch - - function GetFileName (S: String):String; - begin - //Result := copy (S,0,StrRScan (PChar(S),char('.'))+1); - Result := copy (S,0,Pos ('.ini',S)-1); - end; - -begin - GamePath := ExtractFilePath(ParamStr(0)); - - if (Params.ConfigFile <> '') then - try - IniFile := TMemIniFile.Create(Params.ConfigFile); - except - IniFile := TMemIniFile.Create(GamePath + 'config.ini'); - end - else - IniFile := TMemIniFile.Create(GamePath + 'config.ini'); - - - // Name - for I := 0 to 11 do - Ini.Name[I] := IniFile.ReadString('Name', 'P'+IntToStr(I+1), 'Player'+IntToStr(I+1)); - - - // Templates for Names Mod - for I := 0 to 2 do - Ini.NameTeam[I] := IniFile.ReadString('NameTeam', 'T'+IntToStr(I+1), 'Team'+IntToStr(I+1)); - for I := 0 to 11 do - Ini.NameTemplate[I] := IniFile.ReadString('NameTemplate', 'Name'+IntToStr(I+1), 'Template'+IntToStr(I+1)); - - // Players - Tekst := IniFile.ReadString('Game', 'Players', IPlayers[0]); - for Pet := 0 to High(IPlayers) do - if Tekst = IPlayers[Pet] then Ini.Players := Pet; - - // Difficulty - Tekst := IniFile.ReadString('Game', 'Difficulty', 'Easy'); - for Pet := 0 to High(IDifficulty) do - if Tekst = IDifficulty[Pet] then Ini.Difficulty := Pet; - - // Language - Tekst := IniFile.ReadString('Game', 'Language', 'English'); - for Pet := 0 to High(ILanguage) do - if Tekst = ILanguage[Pet] then Ini.Language := Pet; - -// Language.ChangeLanguage(ILanguage[Ini.Language]); - - // Tabs - Tekst := IniFile.ReadString('Game', 'Tabs', ITabs[0]); - for Pet := 0 to High(ITabs) do - if Tekst = ITabs[Pet] then Ini.Tabs := Pet; - - //Tabs at Startup fix - Ini.Tabs_at_startup := Ini.Tabs; - - // Sorting - Tekst := IniFile.ReadString('Game', 'Sorting', ISorting[0]); - for Pet := 0 to High(ISorting) do - if Tekst = ISorting[Pet] then Ini.Sorting := Pet; - - // Debug - Tekst := IniFile.ReadString('Game', 'Debug', IDebug[0]); - for Pet := 0 to High(IDebug) do - if Tekst = IDebug[Pet] then Ini.Debug := Pet; - - //if Ini.Debug = 1 then SongPath := 'E:\UltraStar 03\Songs\'; - - // Screens - Tekst := IniFile.ReadString('Graphics', 'Screens', IScreens[0]); - for Pet := 0 to High(IScreens) do - if Tekst = IScreens[Pet] then Ini.Screens := Pet; - - // FullScreen - Tekst := IniFile.ReadString('Graphics', 'FullScreen', 'On'); - for Pet := 0 to High(IFullScreen) do - if Tekst = IFullScreen[Pet] then Ini.FullScreen := Pet; - - - // Resolution - SetLength(IResolution, 0); - - Modes := SDL_ListModes(nil, SDL_OPENGL or SDL_FULLSCREEN); // Check if there are any modes available - while assigned( Modes^ ) do //this should solve the biggest wine problem | THANKS Linnex (11.11.07) - begin - SetLength(IResolution, Length(IResolution) + 1); - IResolution[High(IResolution)] := IntToStr(Modes^.w) + 'x' + IntToStr(Modes^.h); - Inc(Modes); - end; - - // if no modes were set, then failback to 800x600 - // as per http://sourceforge.net/forum/message.php?msg_id=4544965 - // THANKS : linnex at users.sourceforge.net - if Length(IResolution) < 1 then - begin - SetLength(IResolution, Length(IResolution) + 1); - IResolution[High(IResolution)] := IntToStr(800) + 'x' + IntToStr(600); - Log.LogStatus('SDL_ListModes Defaulted Res To : ' + IResolution[High(IResolution)] , 'Graphics - Resolutions'); - - // Default to fullscreen OFF, in this case ! - Ini.FullScreen := 0; - end; - - // reverse order - for I := 0 to (Length(IResolution) div 2) - 1 do begin - S := IResolution[I]; - IResolution[I] := IResolution[High(IResolution)-I]; - IResolution[High(IResolution)-I] := S; - end; - - Tekst := IniFile.ReadString('Graphics', 'Resolution', '800x600'); - for Pet := 0 to High(IResolution) do - if Tekst = IResolution[Pet] then Ini.Resolution := Pet; - - - // Resolution - Tekst := IniFile.ReadString('Graphics', 'Depth', '32 bit'); - for Pet := 0 to High(IDepth) do - if Tekst = IDepth[Pet] then Ini.Depth := Pet; - - // Texture Size - Tekst := IniFile.ReadString('Graphics', 'TextureSize', ITextureSize[1]); - for Pet := 0 to High(ITextureSize) do - if Tekst = ITextureSize[Pet] then Ini.TextureSize := Pet; - - // SingWindow - Tekst := IniFile.ReadString('Graphics', 'SingWindow', 'Big'); - for Pet := 0 to High(ISingWindow) do - if Tekst = ISingWindow[Pet] then Ini.SingWindow := Pet; - - // Oscilloscope - Tekst := IniFile.ReadString('Graphics', 'Oscilloscope', 'Bar'); - for Pet := 0 to High(IOscilloscope) do - if Tekst = IOscilloscope[Pet] then Ini.Oscilloscope := Pet; - - // Spectrum - Tekst := IniFile.ReadString('Graphics', 'Spectrum', 'Off'); - for Pet := 0 to High(ISpectrum) do - if Tekst = ISpectrum[Pet] then Ini.Spectrum := Pet; - - // Spectrograph - Tekst := IniFile.ReadString('Graphics', 'Spectrograph', 'Off'); - for Pet := 0 to High(ISpectrograph) do - if Tekst = ISpectrograph[Pet] then Ini.Spectrograph := Pet; - - // MovieSize - Tekst := IniFile.ReadString('Graphics', 'MovieSize', IMovieSize[2]); - for Pet := 0 to High(IMovieSize) do - if Tekst = IMovieSize[Pet] then Ini.MovieSize := Pet; - - // MicBoost - Tekst := IniFile.ReadString('Sound', 'MicBoost', 'Off'); - for Pet := 0 to High(IMicBoost) do - if Tekst = IMicBoost[Pet] then Ini.MicBoost := Pet; - - // ClickAssist - Tekst := IniFile.ReadString('Sound', 'ClickAssist', 'Off'); - for Pet := 0 to High(IClickAssist) do - if Tekst = IClickAssist[Pet] then Ini.ClickAssist := Pet; - - // BeatClick - Tekst := IniFile.ReadString('Sound', 'BeatClick', IBeatClick[0]); - for Pet := 0 to High(IBeatClick) do - if Tekst = IBeatClick[Pet] then Ini.BeatClick := Pet; - - // SavePlayback - Tekst := IniFile.ReadString('Sound', 'SavePlayback', ISavePlayback[0]); - for Pet := 0 to High(ISavePlayback) do - if Tekst = ISavePlayback[Pet] then Ini.SavePlayback := Pet; - - // Threshold - Tekst := IniFile.ReadString('Sound', 'Threshold', IThreshold[2]); - for Pet := 0 to High(IThreshold) do - if Tekst = IThreshold[Pet] then Ini.Threshold := Pet; - - //Song Preview - Tekst := IniFile.ReadString('Sound', 'PreviewVolume', IPreviewVolume[7]); - for Pet := 0 to High(IPreviewVolume) do - if Tekst = IPreviewVolume[Pet] then Ini.PreviewVolume := Pet; - - Tekst := IniFile.ReadString('Sound', 'PreviewFading', IPreviewFading[1]); - for Pet := 0 to High(IPreviewFading) do - if Tekst = IPreviewFading[Pet] then Ini.PreviewFading := Pet; - - // Lyrics Font - Tekst := IniFile.ReadString('Lyrics', 'LyricsFont', ILyricsFont[1]); - for Pet := 0 to High(ILyricsFont) do - if Tekst = ILyricsFont[Pet] then Ini.LyricsFont := Pet; - - // Lyrics Effect - Tekst := IniFile.ReadString('Lyrics', 'LyricsEffect', ILyricsEffect[1]); - for Pet := 0 to High(ILyricsEffect) do - if Tekst = ILyricsEffect[Pet] then Ini.LyricsEffect := Pet; - - // Solmization - Tekst := IniFile.ReadString('Lyrics', 'Solmization', ISolmization[0]); - for Pet := 0 to High(ISolmization) do - if Tekst = ISolmization[Pet] then Ini.Solmization := Pet; - - // Theme - - //Theme List Patch - - //I2 Saves the no of the Deluxe (Standard-) Theme - I2 := 0; - //I counts is the cur. Theme no - I := 0; - - SetLength(ITheme, 0); - FindFirst('Themes' + PathDelim + '*.ini',faAnyFile,SR); - Repeat - //Read Themename from Theme - ThemeIni := TMemIniFile.Create(SR.Name); - Tekst := UpperCase(ThemeIni.ReadString('Theme','Name',GetFileName(SR.Name))); - ThemeIni.Free; - - //if Deluxe Theme then save Themeno to I2 - if (Tekst = 'DELUXE') then - I2 := I; - - //Search for Skins for this Theme - for Pet := low(Skin.Skin) to high(Skin.Skin) do - begin - if UpperCase(Skin.Skin[Pet].Theme) = Tekst then - begin - SetLength(ITheme, Length(ITheme)+1); - ITheme[High(ITheme)] := GetFileName(SR.Name); - break; - end; - end; - - Inc(I); - Until FindNext(SR) <> 0; - FindClose(SR); - //Theme List Patch End } - - //No Theme Found - if (Length(ITheme)=0) then - begin - Log.CriticalError('Could not find any valid Themes.'); - end; - - - Tekst := IniFile.ReadString('Themes', 'Theme', ITheme[I2]); - Ini.Theme := 0; - for Pet := 0 to High(ITheme) do - if Uppercase(Tekst) = Uppercase(ITheme[Pet]) then Ini.Theme := Pet; - - // Skin - Skin.onThemeChange; - Ini.SkinNo := 0; - - Tekst := IniFile.ReadString('Themes', 'Skin', ISkin[0]); - for Pet := 0 to High(ISkin) do - if Tekst = ISkin[Pet] then Ini.SkinNo := Pet; - - // Color - Tekst := IniFile.ReadString('Themes', 'Color', IColor[0]); - for Pet := 0 to High(IColor) do - if Tekst = IColor[Pet] then Ini.Color := Pet; - - // Record - load ini list - SetLength(CardList, 0); - I := 1; - while (IniFile.ValueExists('Record', 'DeviceName' + IntToStr(I)) = true) do begin - //Automatically Delete not Existing Sound Cards - S := IniFile.ReadString('Record', 'DeviceName' + IntToStr(I), ''); - //{ - B := False; - //Look for Soundcard - for I2 := 0 to High(Recording.SoundCard) do - begin - if (S = Trim(Recording.SoundCard[I2].Description)) then - begin - B := True; - Break; - end; - end; - - if B then - begin //} - I3 := Length(CardList); - SetLength(CardList, I3+1); - Ini.CardList[I3].Name := S; - Ini.CardList[I3].Input := IniFile.ReadInteger('Record', 'Input' + IntToStr(I), 0); - Ini.CardList[I3].ChannelL := IniFile.ReadInteger('Record', 'ChannelL' + IntToStr(I), 0); - Ini.CardList[I3].ChannelR := IniFile.ReadInteger('Record', 'ChannelR' + IntToStr(I), 0); - end; - Inc(I); - end; - - // Record - append detected soundcards - for I := 0 to High(Recording.SoundCard) do - begin - B := False; - For I2 := 0 to High(CardList) do - begin //Search for Card in List - if (CardList[I2].Name = Trim(Recording.SoundCard[I].Description)) then - begin - B := True; - Break; - end; - end; - - //If not in List -> Add - If not B then - begin - I3 := Length(CardList); - SetLength(CardList, I3+1); - CardList[I3].Name := Trim(Recording.SoundCard[I].Description); - CardList[I3].Input := 0; - CardList[I3].ChannelL := 0; - CardList[I3].ChannelR := 0; - // default for new users - if (Length(CardList) = 1) then - CardList[I].ChannelL := 1; - end; - end; - - //Advanced Settings - - // LoadAnimation - Tekst := IniFile.ReadString('Advanced', 'LoadAnimation', 'On'); - for Pet := 0 to High(ILoadAnimation) do - if Tekst = ILoadAnimation[Pet] then Ini.LoadAnimation := Pet; - - // ScreenFade - Tekst := IniFile.ReadString('Advanced', 'ScreenFade', 'On'); - for Pet := 0 to High(IScreenFade) do - if Tekst = IScreenFade[Pet] then Ini.ScreenFade := Pet; - - // EffectSing - Tekst := IniFile.ReadString('Advanced', 'EffectSing', 'On'); - for Pet := 0 to High(IEffectSing) do - if Tekst = IEffectSing[Pet] then Ini.EffectSing := Pet; - - // AskbeforeDel - Tekst := IniFile.ReadString('Advanced', 'AskbeforeDel', 'On'); - for Pet := 0 to High(IAskbeforeDel) do - if Tekst = IAskbeforeDel[Pet] then Ini.AskbeforeDel := Pet; - - // OnSongClick - Tekst := IniFile.ReadString('Advanced', 'OnSongClick', 'Sing'); - for Pet := 0 to High(IOnSongClick) do - if Tekst = IOnSongClick[Pet] then Ini.OnSongClick := Pet; - - // Linebonus - Tekst := IniFile.ReadString('Advanced', 'LineBonus', 'At Score'); - for Pet := 0 to High(ILineBonus) do - if Tekst = ILineBonus[Pet] then Ini.LineBonus := Pet; - - // PartyPopup - Tekst := IniFile.ReadString('Advanced', 'PartyPopup', 'On'); - for Pet := 0 to High(IPartyPopup) do - if Tekst = IPartyPopup[Pet] then Ini.PartyPopup := Pet; - - - // Joypad - Tekst := IniFile.ReadString('Controller', 'Joypad', IJoypad[0]); - for Pet := 0 to High(IJoypad) do - if Tekst = IJoypad[Pet] then Ini.Joypad := Pet; - - // LCD - Tekst := IniFile.ReadString('Devices', 'LPT', ILPT[0]); - for Pet := 0 to High(ILPT) do - if Tekst = ILPT[Pet] then Ini.LPT := Pet; - - - // SongPath - if (Params.SongPath <> '') then - SongPath := IncludeTrailingPathDelimiter(Params.SongPath) - else - SongPath := IncludeTrailingPathDelimiter(IniFile.ReadString('Path', 'Songs', SongPath)); - - Filename := IniFile.FileName; - IniFile.Free; -end; - -procedure TIni.Save; -var - IniFile: TIniFile; - Tekst: string; - I: Integer; - S: String; -begin - //if not (FileExists(GamePath + 'config.ini') and FileIsReadOnly(GamePath + 'config.ini')) then begin - if not (FileExists(Filename) and FileIsReadOnly(Filename)) then begin - - IniFile := TIniFile.Create(Filename); - - // Players - Tekst := IPlayers[Ini.Players]; - IniFile.WriteString('Game', 'Players', Tekst); - - // Difficulty - Tekst := IDifficulty[Ini.Difficulty]; - IniFile.WriteString('Game', 'Difficulty', Tekst); - - // Language - Tekst := ILanguage[Ini.Language]; - IniFile.WriteString('Game', 'Language', Tekst); - - // Tabs - Tekst := ITabs[Ini.Tabs]; - IniFile.WriteString('Game', 'Tabs', Tekst); - - // Sorting - Tekst := ISorting[Ini.Sorting]; - IniFile.WriteString('Game', 'Sorting', Tekst); - - // Debug - Tekst := IDebug[Ini.Debug]; - IniFile.WriteString('Game', 'Debug', Tekst); - - // Screens - Tekst := IScreens[Ini.Screens]; - IniFile.WriteString('Graphics', 'Screens', Tekst); - - // FullScreen - Tekst := IFullScreen[Ini.FullScreen]; - IniFile.WriteString('Graphics', 'FullScreen', Tekst); - - // Resolution - Tekst := IResolution[Ini.Resolution]; - IniFile.WriteString('Graphics', 'Resolution', Tekst); - - // Depth - Tekst := IDepth[Ini.Depth]; - IniFile.WriteString('Graphics', 'Depth', Tekst); - - // Resolution - Tekst := ITextureSize[Ini.TextureSize]; - IniFile.WriteString('Graphics', 'TextureSize', Tekst); - - // Sing Window - Tekst := ISingWindow[Ini.SingWindow]; - IniFile.WriteString('Graphics', 'SingWindow', Tekst); - - // Oscilloscope - Tekst := IOscilloscope[Ini.Oscilloscope]; - IniFile.WriteString('Graphics', 'Oscilloscope', Tekst); - - // Spectrum - Tekst := ISpectrum[Ini.Spectrum]; - IniFile.WriteString('Graphics', 'Spectrum', Tekst); - - // Spectrograph - Tekst := ISpectrograph[Ini.Spectrograph]; - IniFile.WriteString('Graphics', 'Spectrograph', Tekst); - - // Movie Size - Tekst := IMovieSize[Ini.MovieSize]; - IniFile.WriteString('Graphics', 'MovieSize', Tekst); - - // MicBoost - Tekst := IMicBoost[Ini.MicBoost]; - IniFile.WriteString('Sound', 'MicBoost', Tekst); - - // ClickAssist - Tekst := IClickAssist[Ini.ClickAssist]; - IniFile.WriteString('Sound', 'ClickAssist', Tekst); - - // BeatClick - Tekst := IBeatClick[Ini.BeatClick]; - IniFile.WriteString('Sound', 'BeatClick', Tekst); - - // Threshold - Tekst := IThreshold[Ini.Threshold]; - IniFile.WriteString('Sound', 'Threshold', Tekst); - - // Song Preview - Tekst := IPreviewVolume[Ini.PreviewVolume]; - IniFile.WriteString('Sound', 'PreviewVolume', Tekst); - - Tekst := IPreviewFading[Ini.PreviewFading]; - IniFile.WriteString('Sound', 'PreviewFading', Tekst); - - // SavePlayback - Tekst := ISavePlayback[Ini.SavePlayback]; - IniFile.WriteString('Sound', 'SavePlayback', Tekst); - - // Lyrics Font - Tekst := ILyricsFont[Ini.LyricsFont]; - IniFile.WriteString('Lyrics', 'LyricsFont', Tekst); - - // Lyrics Effect - Tekst := ILyricsEffect[Ini.LyricsEffect]; - IniFile.WriteString('Lyrics', 'LyricsEffect', Tekst); - - // Solmization - Tekst := ISolmization[Ini.Solmization]; - IniFile.WriteString('Lyrics', 'Solmization', Tekst); - - // Theme - Tekst := ITheme[Ini.Theme]; - IniFile.WriteString('Themes', 'Theme', Tekst); - - // Skin - Tekst := ISkin[Ini.SkinNo]; - IniFile.WriteString('Themes', 'Skin', Tekst); - - // Color - Tekst := IColor[Ini.Color]; - IniFile.WriteString('Themes', 'Color', Tekst); - - // Record - for I := 0 to High(CardList) do begin - S := IntToStr(I+1); - - Tekst := CardList[I].Name; - IniFile.WriteString('Record', 'DeviceName' + S, Tekst); - - Tekst := IntToStr(CardList[I].Input); - IniFile.WriteString('Record', 'Input' + S, Tekst); - - Tekst := IntToStr(CardList[I].ChannelL); - IniFile.WriteString('Record', 'ChannelL' + S, Tekst); - - Tekst := IntToStr(CardList[I].ChannelR); - IniFile.WriteString('Record', 'ChannelR' + S, Tekst); - end; - - //Log.LogError(InttoStr(Length(CardList)) + ' Cards Saved'); - - //Advanced Settings - - //LoadAnimation - Tekst := ILoadAnimation[Ini.LoadAnimation]; - IniFile.WriteString('Advanced', 'LoadAnimation', Tekst); - - //EffectSing - Tekst := IEffectSing[Ini.EffectSing]; - IniFile.WriteString('Advanced', 'EffectSing', Tekst); - - //ScreenFade - Tekst := IScreenFade[Ini.ScreenFade]; - IniFile.WriteString('Advanced', 'ScreenFade', Tekst); - - //AskbeforeDel - Tekst := IAskbeforeDel[Ini.AskbeforeDel]; - IniFile.WriteString('Advanced', 'AskbeforeDel', Tekst); - - //OnSongClick - Tekst := IOnSongClick[Ini.OnSongClick]; - IniFile.WriteString('Advanced', 'OnSongClick', Tekst); - - //Line Bonus - Tekst := ILineBonus[Ini.LineBonus]; - IniFile.WriteString('Advanced', 'LineBonus', Tekst); - - //Party Popup - Tekst := IPartyPopup[Ini.PartyPopup]; - IniFile.WriteString('Advanced', 'PartyPopup', Tekst); - - // Joypad - Tekst := IJoypad[Ini.Joypad]; - IniFile.WriteString('Controller', 'Joypad', Tekst); - - IniFile.Free; - end; -end; - -procedure TIni.SaveNames; -var - IniFile: TIniFile; - I: integer; -begin - //if not FileIsReadOnly(GamePath + 'config.ini') then begin - //IniFile := TIniFile.Create(GamePath + 'config.ini'); - if not FileIsReadOnly(Filename) then begin - IniFile := TIniFile.Create(Filename); - - //Name - // Templates for Names Mod - for I := 1 to 12 do - IniFile.WriteString('Name', 'P' + IntToStr(I), Ini.Name[I-1]); - for I := 1 to 3 do - IniFile.WriteString('NameTeam', 'T' + IntToStr(I), Ini.NameTeam[I-1]); - for I := 1 to 12 do - IniFile.WriteString('NameTemplate', 'Name' + IntToStr(I), Ini.NameTemplate[I-1]); - - IniFile.Free; - end; -end; - -procedure TIni.SaveLevel; -var - IniFile: TIniFile; - I: integer; -begin - //if not FileIsReadOnly(GamePath + 'config.ini') then begin - //IniFile := TIniFile.Create(GamePath + 'config.ini'); - if not FileIsReadOnly(Filename) then begin - IniFile := TIniFile.Create(Filename); - - // Difficulty - IniFile.WriteString('Game', 'Difficulty', IDifficulty[Ini.Difficulty]); - - IniFile.Free; - end; -end; - -end. \ No newline at end of file +unit UIni; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses IniFiles, ULog, SysUtils; + +type + TIni = class + Name: array[0..11] of string; + + // Templates for Names Mod + NameTeam: array[0..2] of string; + NameTemplate: array[0..11] of string; + + //Filename of the opened iniFile + Filename: string; + + // Game + Players: integer; + Difficulty: integer; + Language: integer; + Tabs: integer; + Tabs_at_startup:integer; //Tabs at Startup fix + Sorting: integer; + Debug: integer; + + // Graphics + Screens: integer; + Resolution: integer; + Depth: integer; + FullScreen: integer; + TextureSize: integer; + SingWindow: integer; + Oscilloscope: integer; + Spectrum: integer; + Spectrograph: integer; + MovieSize: integer; + + // Sound + MicBoost: integer; + ClickAssist: integer; + BeatClick: integer; + SavePlayback: integer; + Threshold: integer; + + //Song Preview + PreviewVolume: integer; + PreviewFading: integer; + + // Lyrics + LyricsFont: integer; + LyricsEffect: integer; + Solmization: integer; + + // Themes + Theme: integer; + SkinNo: integer; + Color: integer; + + // Record + Card: integer; // not saved in config.ini + + CardList: array of record + Name: string; + Input: integer; + ChannelL: integer; + ChannelR: integer; + end; + + // Advanced + LoadAnimation: integer; + EffectSing: integer; + ScreenFade: integer; + AskbeforeDel: integer; + OnSongClick: integer; + LineBonus: integer; + PartyPopup: integer; + + // Controller + Joypad: integer; + + // Soundcards + SoundCard: array[0..7, 1..2] of integer; + + // Devices + LPT: integer; + + procedure Load; + procedure Save; + procedure SaveNames; + procedure SaveLevel; + end; + + +var + Ini: TIni; + IResolution: array of string; + ILanguage: array of string; + ITheme: array of string; + ISkin: array of string; + ICard: array of string; + IInput: array of string; + +const + IPlayers: array[0..4] of string = ('1', '2', '3', '4', '6'); + IDifficulty: array[0..2] of string = ('Easy', 'Medium', 'Hard'); + ITabs: array[0..1] of string = ('Off', 'On'); + + ISorting: array[0..7] of string = ('Edition', 'Genre', 'Language', 'Folder', 'Title', 'Artist', 'Title2', 'Artist2'); + sEdition = 0; + sGenre = 1; + sLanguage = 2; + sFolder = 3; + sTitle = 4; + sArtist = 5; + sTitle2 = 6; + sArtist2 = 7; + + IDebug: array[0..1] of string = ('Off', 'On'); + + IScreens: array[0..1] of string = ('1', '2'); + IFullScreen: array[0..1] of string = ('Off', 'On'); + IDepth: array[0..1] of string = ('16 bit', '32 bit'); + ITextureSize: array[0..2] of string = ('128', '256', '512'); + ISingWindow: array[0..1] of string = ('Small', 'Big'); + + //SingBar Mod + IOscilloscope: array[0..2] of string = ('Off', 'Osci', 'Bar'); + //IOscilloscope: array[0..1] of string = ('Off', 'On'); + + ISpectrum: array[0..1] of string = ('Off', 'On'); + ISpectrograph: array[0..1] of string = ('Off', 'On'); + IMovieSize: array[0..2] of string = ('Half', 'Full [Vid]', 'Full [BG+Vid]'); + + IMicBoost: array[0..3] of string = ('Off', '+6dB', '+12dB', '+18dB'); + IClickAssist: array[0..1] of string = ('Off', 'On'); + IBeatClick: array[0..1] of string = ('Off', 'On'); + ISavePlayback: array[0..1] of string = ('Off', 'On'); + IThreshold: array[0..3] of string = ('5%', '10%', '15%', '20%'); + //Song Preview + IPreviewVolume: array[0..10] of string = ('Off', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%'); + IPreviewFading: array[0..5] of string = ('Off', '1 Sec', '2 Secs', '3 Secs', '4 Secs', '5 Secs'); + + + ILyricsFont: array[0..2] of string = ('Plain', 'OLine1', 'OLine2'); + ILyricsEffect: array[0..3] of string = ('Simple', 'Zoom', 'Slide', 'Ball'); + ISolmization: array[0..3] of string = ('Off', 'Euro', 'Jap', 'American'); + + IColor: array[0..8] of string = ('Blue', 'Green', 'Pink', 'Red', 'Violet', 'Orange', 'Yellow', 'Brown', 'Black'); + + // Advanced + ILoadAnimation: array[0..1] of string = ('Off', 'On'); + IEffectSing: array[0..1] of string = ('Off', 'On'); + IScreenFade: array [0..1] of String =('Off', 'On'); + IAskbeforeDel: array[0..1] of string = ('Off', 'On'); + IOnSongClick: array[0..2] of string = ('Sing', 'Select Players', 'Open Menu'); + ILineBonus: array[0..2] of string = ('Off', 'At Score', 'At Notes'); + IPartyPopup: array[0..1] of string = ('Off', 'On'); + + IJoypad: array[0..1] of string = ('Off', 'On'); + ILPT: array[0..2] of string = ('Off', 'LCD', 'Lights'); + + IChannel: array[0..6] of string = ('Off', '1', '2', '3', '4', '5', '6'); + +implementation + +uses //UFiles, + UMain, + SDL, + ULanguage, + USkins, + URecord, + UCommandLine; + +procedure TIni.Load; +var + IniFile: TMemIniFile; + ThemeIni: TMemIniFile; + Tekst: string; + Pet: integer; + B: boolean; + I, I2, I3: integer; + S: string; + Modes: PPSDL_Rect; + SR: TSearchRec; //Skin List Patch + + function GetFileName (S: String):String; + begin + //Result := copy (S,0,StrRScan (PChar(S),char('.'))+1); + Result := copy (S,0,Pos ('.ini',S)-1); + end; + +begin + GamePath := ExtractFilePath(ParamStr(0)); + + if (Params.ConfigFile <> '') then + try + IniFile := TMemIniFile.Create(Params.ConfigFile); + except + IniFile := TMemIniFile.Create(GamePath + 'config.ini'); + end + else + IniFile := TMemIniFile.Create(GamePath + 'config.ini'); + + + // Name + for I := 0 to 11 do + Ini.Name[I] := IniFile.ReadString('Name', 'P'+IntToStr(I+1), 'Player'+IntToStr(I+1)); + + + // Templates for Names Mod + for I := 0 to 2 do + Ini.NameTeam[I] := IniFile.ReadString('NameTeam', 'T'+IntToStr(I+1), 'Team'+IntToStr(I+1)); + for I := 0 to 11 do + Ini.NameTemplate[I] := IniFile.ReadString('NameTemplate', 'Name'+IntToStr(I+1), 'Template'+IntToStr(I+1)); + + // Players + Tekst := IniFile.ReadString('Game', 'Players', IPlayers[0]); + for Pet := 0 to High(IPlayers) do + if Tekst = IPlayers[Pet] then Ini.Players := Pet; + + // Difficulty + Tekst := IniFile.ReadString('Game', 'Difficulty', 'Easy'); + for Pet := 0 to High(IDifficulty) do + if Tekst = IDifficulty[Pet] then Ini.Difficulty := Pet; + + // Language + Tekst := IniFile.ReadString('Game', 'Language', 'English'); + for Pet := 0 to High(ILanguage) do + if Tekst = ILanguage[Pet] then Ini.Language := Pet; + +// Language.ChangeLanguage(ILanguage[Ini.Language]); + + // Tabs + Tekst := IniFile.ReadString('Game', 'Tabs', ITabs[0]); + for Pet := 0 to High(ITabs) do + if Tekst = ITabs[Pet] then Ini.Tabs := Pet; + + //Tabs at Startup fix + Ini.Tabs_at_startup := Ini.Tabs; + + // Sorting + Tekst := IniFile.ReadString('Game', 'Sorting', ISorting[0]); + for Pet := 0 to High(ISorting) do + if Tekst = ISorting[Pet] then Ini.Sorting := Pet; + + // Debug + Tekst := IniFile.ReadString('Game', 'Debug', IDebug[0]); + for Pet := 0 to High(IDebug) do + if Tekst = IDebug[Pet] then Ini.Debug := Pet; + + //if Ini.Debug = 1 then SongPath := 'E:\UltraStar 03\Songs\'; + + // Screens + Tekst := IniFile.ReadString('Graphics', 'Screens', IScreens[0]); + for Pet := 0 to High(IScreens) do + if Tekst = IScreens[Pet] then Ini.Screens := Pet; + + // FullScreen + Tekst := IniFile.ReadString('Graphics', 'FullScreen', 'On'); + for Pet := 0 to High(IFullScreen) do + if Tekst = IFullScreen[Pet] then Ini.FullScreen := Pet; + + + // Resolution + SetLength(IResolution, 0); + + Modes := SDL_ListModes(nil, SDL_OPENGL or SDL_FULLSCREEN); // Check if there are any modes available + while assigned( Modes^ ) do //this should solve the biggest wine problem | THANKS Linnex (11.11.07) + begin + SetLength(IResolution, Length(IResolution) + 1); + IResolution[High(IResolution)] := IntToStr(Modes^.w) + 'x' + IntToStr(Modes^.h); + Inc(Modes); + end; + + // if no modes were set, then failback to 800x600 + // as per http://sourceforge.net/forum/message.php?msg_id=4544965 + // THANKS : linnex at users.sourceforge.net + if Length(IResolution) < 1 then + begin + SetLength(IResolution, Length(IResolution) + 1); + IResolution[High(IResolution)] := IntToStr(800) + 'x' + IntToStr(600); + Log.LogStatus('SDL_ListModes Defaulted Res To : ' + IResolution[High(IResolution)] , 'Graphics - Resolutions'); + + // Default to fullscreen OFF, in this case ! + Ini.FullScreen := 0; + end; + + // reverse order + for I := 0 to (Length(IResolution) div 2) - 1 do begin + S := IResolution[I]; + IResolution[I] := IResolution[High(IResolution)-I]; + IResolution[High(IResolution)-I] := S; + end; + + Tekst := IniFile.ReadString('Graphics', 'Resolution', '800x600'); + for Pet := 0 to High(IResolution) do + if Tekst = IResolution[Pet] then Ini.Resolution := Pet; + + + // Resolution + Tekst := IniFile.ReadString('Graphics', 'Depth', '32 bit'); + for Pet := 0 to High(IDepth) do + if Tekst = IDepth[Pet] then Ini.Depth := Pet; + + // Texture Size + Tekst := IniFile.ReadString('Graphics', 'TextureSize', ITextureSize[1]); + for Pet := 0 to High(ITextureSize) do + if Tekst = ITextureSize[Pet] then Ini.TextureSize := Pet; + + // SingWindow + Tekst := IniFile.ReadString('Graphics', 'SingWindow', 'Big'); + for Pet := 0 to High(ISingWindow) do + if Tekst = ISingWindow[Pet] then Ini.SingWindow := Pet; + + // Oscilloscope + Tekst := IniFile.ReadString('Graphics', 'Oscilloscope', 'Bar'); + for Pet := 0 to High(IOscilloscope) do + if Tekst = IOscilloscope[Pet] then Ini.Oscilloscope := Pet; + + // Spectrum + Tekst := IniFile.ReadString('Graphics', 'Spectrum', 'Off'); + for Pet := 0 to High(ISpectrum) do + if Tekst = ISpectrum[Pet] then Ini.Spectrum := Pet; + + // Spectrograph + Tekst := IniFile.ReadString('Graphics', 'Spectrograph', 'Off'); + for Pet := 0 to High(ISpectrograph) do + if Tekst = ISpectrograph[Pet] then Ini.Spectrograph := Pet; + + // MovieSize + Tekst := IniFile.ReadString('Graphics', 'MovieSize', IMovieSize[2]); + for Pet := 0 to High(IMovieSize) do + if Tekst = IMovieSize[Pet] then Ini.MovieSize := Pet; + + // MicBoost + Tekst := IniFile.ReadString('Sound', 'MicBoost', 'Off'); + for Pet := 0 to High(IMicBoost) do + if Tekst = IMicBoost[Pet] then Ini.MicBoost := Pet; + + // ClickAssist + Tekst := IniFile.ReadString('Sound', 'ClickAssist', 'Off'); + for Pet := 0 to High(IClickAssist) do + if Tekst = IClickAssist[Pet] then Ini.ClickAssist := Pet; + + // BeatClick + Tekst := IniFile.ReadString('Sound', 'BeatClick', IBeatClick[0]); + for Pet := 0 to High(IBeatClick) do + if Tekst = IBeatClick[Pet] then Ini.BeatClick := Pet; + + // SavePlayback + Tekst := IniFile.ReadString('Sound', 'SavePlayback', ISavePlayback[0]); + for Pet := 0 to High(ISavePlayback) do + if Tekst = ISavePlayback[Pet] then Ini.SavePlayback := Pet; + + // Threshold + Tekst := IniFile.ReadString('Sound', 'Threshold', IThreshold[2]); + for Pet := 0 to High(IThreshold) do + if Tekst = IThreshold[Pet] then Ini.Threshold := Pet; + + //Song Preview + Tekst := IniFile.ReadString('Sound', 'PreviewVolume', IPreviewVolume[7]); + for Pet := 0 to High(IPreviewVolume) do + if Tekst = IPreviewVolume[Pet] then Ini.PreviewVolume := Pet; + + Tekst := IniFile.ReadString('Sound', 'PreviewFading', IPreviewFading[1]); + for Pet := 0 to High(IPreviewFading) do + if Tekst = IPreviewFading[Pet] then Ini.PreviewFading := Pet; + + // Lyrics Font + Tekst := IniFile.ReadString('Lyrics', 'LyricsFont', ILyricsFont[1]); + for Pet := 0 to High(ILyricsFont) do + if Tekst = ILyricsFont[Pet] then Ini.LyricsFont := Pet; + + // Lyrics Effect + Tekst := IniFile.ReadString('Lyrics', 'LyricsEffect', ILyricsEffect[1]); + for Pet := 0 to High(ILyricsEffect) do + if Tekst = ILyricsEffect[Pet] then Ini.LyricsEffect := Pet; + + // Solmization + Tekst := IniFile.ReadString('Lyrics', 'Solmization', ISolmization[0]); + for Pet := 0 to High(ISolmization) do + if Tekst = ISolmization[Pet] then Ini.Solmization := Pet; + + // Theme + + //Theme List Patch + + //I2 Saves the no of the Deluxe (Standard-) Theme + I2 := 0; + //I counts is the cur. Theme no + I := 0; + + SetLength(ITheme, 0); + writeln( 'Searching for Theme : '+ ThemePath + '*.ini' ); + FindFirst(ThemePath + '*.ini',faAnyFile,SR); + Repeat + writeln( SR.Name ); + + //Read Themename from Theme + ThemeIni := TMemIniFile.Create(SR.Name); + Tekst := UpperCase(ThemeIni.ReadString('Theme','Name',GetFileName(SR.Name))); + ThemeIni.Free; + + //if Deluxe Theme then save Themeno to I2 + if (Tekst = 'DELUXE') then + I2 := I; + + //Search for Skins for this Theme + for Pet := low(Skin.Skin) to high(Skin.Skin) do + begin + writeln( 'forloop' ); + if UpperCase(Skin.Skin[Pet].Theme) = Tekst then + begin + writeln( 'match' ); + SetLength(ITheme, Length(ITheme)+1); + ITheme[High(ITheme)] := GetFileName(SR.Name); + break; + end; + end; + + Inc(I); + Until FindNext(SR) <> 0; + FindClose(SR); + //Theme List Patch End } + + //No Theme Found + if (Length(ITheme)=0) then + begin + Log.CriticalError('Could not find any valid Themes.'); + end; + + + Tekst := IniFile.ReadString('Themes', 'Theme', ITheme[I2]); + Ini.Theme := 0; + for Pet := 0 to High(ITheme) do + if Uppercase(Tekst) = Uppercase(ITheme[Pet]) then Ini.Theme := Pet; + + // Skin + Skin.onThemeChange; + Ini.SkinNo := 0; + + Tekst := IniFile.ReadString('Themes', 'Skin', ISkin[0]); + for Pet := 0 to High(ISkin) do + if Tekst = ISkin[Pet] then Ini.SkinNo := Pet; + + // Color + Tekst := IniFile.ReadString('Themes', 'Color', IColor[0]); + for Pet := 0 to High(IColor) do + if Tekst = IColor[Pet] then Ini.Color := Pet; + + // Record - load ini list + SetLength(CardList, 0); + I := 1; + while (IniFile.ValueExists('Record', 'DeviceName' + IntToStr(I)) = true) do begin + //Automatically Delete not Existing Sound Cards + S := IniFile.ReadString('Record', 'DeviceName' + IntToStr(I), ''); + //{ + B := False; + //Look for Soundcard + for I2 := 0 to High(Recording.SoundCard) do + begin + if (S = Trim(Recording.SoundCard[I2].Description)) then + begin + B := True; + Break; + end; + end; + + if B then + begin //} + I3 := Length(CardList); + SetLength(CardList, I3+1); + Ini.CardList[I3].Name := S; + Ini.CardList[I3].Input := IniFile.ReadInteger('Record', 'Input' + IntToStr(I), 0); + Ini.CardList[I3].ChannelL := IniFile.ReadInteger('Record', 'ChannelL' + IntToStr(I), 0); + Ini.CardList[I3].ChannelR := IniFile.ReadInteger('Record', 'ChannelR' + IntToStr(I), 0); + end; + Inc(I); + end; + + // Record - append detected soundcards + for I := 0 to High(Recording.SoundCard) do + begin + B := False; + For I2 := 0 to High(CardList) do + begin //Search for Card in List + if (CardList[I2].Name = Trim(Recording.SoundCard[I].Description)) then + begin + B := True; + Break; + end; + end; + + //If not in List -> Add + If not B then + begin + I3 := Length(CardList); + SetLength(CardList, I3+1); + CardList[I3].Name := Trim(Recording.SoundCard[I].Description); + CardList[I3].Input := 0; + CardList[I3].ChannelL := 0; + CardList[I3].ChannelR := 0; + // default for new users + if (Length(CardList) = 1) then + CardList[I].ChannelL := 1; + end; + end; + + //Advanced Settings + + // LoadAnimation + Tekst := IniFile.ReadString('Advanced', 'LoadAnimation', 'On'); + for Pet := 0 to High(ILoadAnimation) do + if Tekst = ILoadAnimation[Pet] then Ini.LoadAnimation := Pet; + + // ScreenFade + Tekst := IniFile.ReadString('Advanced', 'ScreenFade', 'On'); + for Pet := 0 to High(IScreenFade) do + if Tekst = IScreenFade[Pet] then Ini.ScreenFade := Pet; + + // EffectSing + Tekst := IniFile.ReadString('Advanced', 'EffectSing', 'On'); + for Pet := 0 to High(IEffectSing) do + if Tekst = IEffectSing[Pet] then Ini.EffectSing := Pet; + + // AskbeforeDel + Tekst := IniFile.ReadString('Advanced', 'AskbeforeDel', 'On'); + for Pet := 0 to High(IAskbeforeDel) do + if Tekst = IAskbeforeDel[Pet] then Ini.AskbeforeDel := Pet; + + // OnSongClick + Tekst := IniFile.ReadString('Advanced', 'OnSongClick', 'Sing'); + for Pet := 0 to High(IOnSongClick) do + if Tekst = IOnSongClick[Pet] then Ini.OnSongClick := Pet; + + // Linebonus + Tekst := IniFile.ReadString('Advanced', 'LineBonus', 'At Score'); + for Pet := 0 to High(ILineBonus) do + if Tekst = ILineBonus[Pet] then Ini.LineBonus := Pet; + + // PartyPopup + Tekst := IniFile.ReadString('Advanced', 'PartyPopup', 'On'); + for Pet := 0 to High(IPartyPopup) do + if Tekst = IPartyPopup[Pet] then Ini.PartyPopup := Pet; + + + // Joypad + Tekst := IniFile.ReadString('Controller', 'Joypad', IJoypad[0]); + for Pet := 0 to High(IJoypad) do + if Tekst = IJoypad[Pet] then Ini.Joypad := Pet; + + // LCD + Tekst := IniFile.ReadString('Devices', 'LPT', ILPT[0]); + for Pet := 0 to High(ILPT) do + if Tekst = ILPT[Pet] then Ini.LPT := Pet; + + + // SongPath + if (Params.SongPath <> '') then + SongPath := IncludeTrailingPathDelimiter(Params.SongPath) + else + SongPath := IncludeTrailingPathDelimiter(IniFile.ReadString('Path', 'Songs', SongPath)); + + Filename := IniFile.FileName; + IniFile.Free; +end; + +procedure TIni.Save; +var + IniFile: TIniFile; + Tekst: string; + I: Integer; + S: String; +begin + //if not (FileExists(GamePath + 'config.ini') and FileIsReadOnly(GamePath + 'config.ini')) then begin + if not (FileExists(Filename) and FileIsReadOnly(Filename)) then begin + + IniFile := TIniFile.Create(Filename); + + // Players + Tekst := IPlayers[Ini.Players]; + IniFile.WriteString('Game', 'Players', Tekst); + + // Difficulty + Tekst := IDifficulty[Ini.Difficulty]; + IniFile.WriteString('Game', 'Difficulty', Tekst); + + // Language + Tekst := ILanguage[Ini.Language]; + IniFile.WriteString('Game', 'Language', Tekst); + + // Tabs + Tekst := ITabs[Ini.Tabs]; + IniFile.WriteString('Game', 'Tabs', Tekst); + + // Sorting + Tekst := ISorting[Ini.Sorting]; + IniFile.WriteString('Game', 'Sorting', Tekst); + + // Debug + Tekst := IDebug[Ini.Debug]; + IniFile.WriteString('Game', 'Debug', Tekst); + + // Screens + Tekst := IScreens[Ini.Screens]; + IniFile.WriteString('Graphics', 'Screens', Tekst); + + // FullScreen + Tekst := IFullScreen[Ini.FullScreen]; + IniFile.WriteString('Graphics', 'FullScreen', Tekst); + + // Resolution + Tekst := IResolution[Ini.Resolution]; + IniFile.WriteString('Graphics', 'Resolution', Tekst); + + // Depth + Tekst := IDepth[Ini.Depth]; + IniFile.WriteString('Graphics', 'Depth', Tekst); + + // Resolution + Tekst := ITextureSize[Ini.TextureSize]; + IniFile.WriteString('Graphics', 'TextureSize', Tekst); + + // Sing Window + Tekst := ISingWindow[Ini.SingWindow]; + IniFile.WriteString('Graphics', 'SingWindow', Tekst); + + // Oscilloscope + Tekst := IOscilloscope[Ini.Oscilloscope]; + IniFile.WriteString('Graphics', 'Oscilloscope', Tekst); + + // Spectrum + Tekst := ISpectrum[Ini.Spectrum]; + IniFile.WriteString('Graphics', 'Spectrum', Tekst); + + // Spectrograph + Tekst := ISpectrograph[Ini.Spectrograph]; + IniFile.WriteString('Graphics', 'Spectrograph', Tekst); + + // Movie Size + Tekst := IMovieSize[Ini.MovieSize]; + IniFile.WriteString('Graphics', 'MovieSize', Tekst); + + // MicBoost + Tekst := IMicBoost[Ini.MicBoost]; + IniFile.WriteString('Sound', 'MicBoost', Tekst); + + // ClickAssist + Tekst := IClickAssist[Ini.ClickAssist]; + IniFile.WriteString('Sound', 'ClickAssist', Tekst); + + // BeatClick + Tekst := IBeatClick[Ini.BeatClick]; + IniFile.WriteString('Sound', 'BeatClick', Tekst); + + // Threshold + Tekst := IThreshold[Ini.Threshold]; + IniFile.WriteString('Sound', 'Threshold', Tekst); + + // Song Preview + Tekst := IPreviewVolume[Ini.PreviewVolume]; + IniFile.WriteString('Sound', 'PreviewVolume', Tekst); + + Tekst := IPreviewFading[Ini.PreviewFading]; + IniFile.WriteString('Sound', 'PreviewFading', Tekst); + + // SavePlayback + Tekst := ISavePlayback[Ini.SavePlayback]; + IniFile.WriteString('Sound', 'SavePlayback', Tekst); + + // Lyrics Font + Tekst := ILyricsFont[Ini.LyricsFont]; + IniFile.WriteString('Lyrics', 'LyricsFont', Tekst); + + // Lyrics Effect + Tekst := ILyricsEffect[Ini.LyricsEffect]; + IniFile.WriteString('Lyrics', 'LyricsEffect', Tekst); + + // Solmization + Tekst := ISolmization[Ini.Solmization]; + IniFile.WriteString('Lyrics', 'Solmization', Tekst); + + // Theme + Tekst := ITheme[Ini.Theme]; + IniFile.WriteString('Themes', 'Theme', Tekst); + + // Skin + Tekst := ISkin[Ini.SkinNo]; + IniFile.WriteString('Themes', 'Skin', Tekst); + + // Color + Tekst := IColor[Ini.Color]; + IniFile.WriteString('Themes', 'Color', Tekst); + + // Record + for I := 0 to High(CardList) do begin + S := IntToStr(I+1); + + Tekst := CardList[I].Name; + IniFile.WriteString('Record', 'DeviceName' + S, Tekst); + + Tekst := IntToStr(CardList[I].Input); + IniFile.WriteString('Record', 'Input' + S, Tekst); + + Tekst := IntToStr(CardList[I].ChannelL); + IniFile.WriteString('Record', 'ChannelL' + S, Tekst); + + Tekst := IntToStr(CardList[I].ChannelR); + IniFile.WriteString('Record', 'ChannelR' + S, Tekst); + end; + + //Log.LogError(InttoStr(Length(CardList)) + ' Cards Saved'); + + //Advanced Settings + + //LoadAnimation + Tekst := ILoadAnimation[Ini.LoadAnimation]; + IniFile.WriteString('Advanced', 'LoadAnimation', Tekst); + + //EffectSing + Tekst := IEffectSing[Ini.EffectSing]; + IniFile.WriteString('Advanced', 'EffectSing', Tekst); + + //ScreenFade + Tekst := IScreenFade[Ini.ScreenFade]; + IniFile.WriteString('Advanced', 'ScreenFade', Tekst); + + //AskbeforeDel + Tekst := IAskbeforeDel[Ini.AskbeforeDel]; + IniFile.WriteString('Advanced', 'AskbeforeDel', Tekst); + + //OnSongClick + Tekst := IOnSongClick[Ini.OnSongClick]; + IniFile.WriteString('Advanced', 'OnSongClick', Tekst); + + //Line Bonus + Tekst := ILineBonus[Ini.LineBonus]; + IniFile.WriteString('Advanced', 'LineBonus', Tekst); + + //Party Popup + Tekst := IPartyPopup[Ini.PartyPopup]; + IniFile.WriteString('Advanced', 'PartyPopup', Tekst); + + // Joypad + Tekst := IJoypad[Ini.Joypad]; + IniFile.WriteString('Controller', 'Joypad', Tekst); + + IniFile.Free; + end; +end; + +procedure TIni.SaveNames; +var + IniFile: TIniFile; + I: integer; +begin + //if not FileIsReadOnly(GamePath + 'config.ini') then begin + //IniFile := TIniFile.Create(GamePath + 'config.ini'); + if not FileIsReadOnly(Filename) then begin + IniFile := TIniFile.Create(Filename); + + //Name + // Templates for Names Mod + for I := 1 to 12 do + IniFile.WriteString('Name', 'P' + IntToStr(I), Ini.Name[I-1]); + for I := 1 to 3 do + IniFile.WriteString('NameTeam', 'T' + IntToStr(I), Ini.NameTeam[I-1]); + for I := 1 to 12 do + IniFile.WriteString('NameTemplate', 'Name' + IntToStr(I), Ini.NameTemplate[I-1]); + + IniFile.Free; + end; +end; + +procedure TIni.SaveLevel; +var + IniFile: TIniFile; + I: integer; +begin + //if not FileIsReadOnly(GamePath + 'config.ini') then begin + //IniFile := TIniFile.Create(GamePath + 'config.ini'); + if not FileIsReadOnly(Filename) then begin + IniFile := TIniFile.Create(Filename); + + // Difficulty + IniFile.WriteString('Game', 'Difficulty', IDifficulty[Ini.Difficulty]); + + IniFile.Free; + end; +end; + +end. diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 18bed197..06c4824a 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -86,12 +86,17 @@ var SongPath: string; LogPath: string; ThemePath: string; + SkinsPath: string; ScreenshotsPath: string; CoversPath: string; LanguagesPath: string; PluginPath: string; PlayListPath: string; + UserSongPath: string = ''; + UserCoversPath: string = ''; + UserPlaylistPath: string = ''; + OGL: Boolean; Done: Boolean; Event: TSDL_event; @@ -246,7 +251,7 @@ begin // Theme Log.BenchmarkStart(1); Log.LogStatus('Load Themes', 'Initialization'); - Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + Theme := TTheme.Create(ThemePath + ITheme[Ini.Theme] + '.ini', Ini.Color); Log.BenchmarkEnd(1); Log.LogBenchmark('Loading Themes', 1); @@ -1023,17 +1028,24 @@ procedure InitializePaths; begin - GamePath := Platform.GetGamePath; - - initialize_path( LogPath , GamePath ); - initialize_path( SoundPath , GamePath + 'Sounds' + PathDelim ); - initialize_path( SongPath , GamePath + 'Songs' + PathDelim ); - initialize_path( ThemePath , GamePath + 'Themes' + PathDelim ); - initialize_path( ScreenshotsPath , GamePath + 'Screenshots' + PathDelim ); - initialize_path( CoversPath , GamePath + 'Covers' + PathDelim ); - initialize_path( LanguagesPath , GamePath + 'Languages' + PathDelim ); - initialize_path( PluginPath , GamePath + 'Plugins' + PathDelim ); - initialize_path( PlaylistPath , GamePath + 'Playlists' + PathDelim ); + initialize_path( LogPath , Platform.GetLogPath ); + initialize_path( SoundPath , Platform.GetGameSharedPath + 'Sounds' + PathDelim ); + initialize_path( ThemePath , Platform.GetGameSharedPath + 'Themes' + PathDelim ); + initialize_path( SkinsPath , Platform.GetGameSharedPath + 'Skins' + PathDelim ); + initialize_path( LanguagesPath , Platform.GetGameSharedPath + 'Languages' + PathDelim ); + initialize_path( PluginPath , Platform.GetGameSharedPath + 'Plugins' + PathDelim ); + + initialize_path( ScreenshotsPath , Platform.GetGameUserPath + 'Screenshots' + PathDelim ); + + // Users Song Path .... + initialize_path( UserSongPath , Platform.GetGameUserPath + 'Songs' + PathDelim ); + initialize_path( UserCoversPath , Platform.GetGameUserPath + 'Covers' + PathDelim ); + initialize_path( UserPlaylistPath , Platform.GetGameUserPath + 'Playlists' + PathDelim ); + + // Shared Song Path .... + initialize_path( SongPath , Platform.GetGameSharedPath + 'Songs' + PathDelim ); + initialize_path( CoversPath , Platform.GetGameSharedPath + 'Covers' + PathDelim ); + initialize_path( PlaylistPath , Platform.GetGameSharedPath + 'Playlists' + PathDelim ); DecimalSeparator := ','; end; diff --git a/Game/Code/Classes/UPlatform.pas b/Game/Code/Classes/UPlatform.pas index a06914d0..bdd6cf78 100644 --- a/Game/Code/Classes/UPlatform.pas +++ b/Game/Code/Classes/UPlatform.pas @@ -25,7 +25,17 @@ type TDirectoryEntryArray = Array of TDirectoryEntry; - TPlatform = class + IPlatform = Interface + ['{63A5EBC3-3F4D-4F23-8DFB-B5165FCA23DF}'] + Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; + function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; + + function GetLogPath : WideString; + function GetGameSharedPath : WideString; + function GetGameUserPath : WideString; + end; + + TPlatform = class( TInterfacedOBject, IPlatform ) // DirectoryFindFiles returns all files matching the filter. Do not use '*' in the filter. // If you set ReturnAllSubDirs = true all directories will be returned, if yout set it to false @@ -34,11 +44,16 @@ type function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; virtual; - function GetGamePath : WideString; virtual; +// function GetGamePath : WideString; virtual; + function GetLogPath : WideString; virtual; + function GetGameSharedPath : WideString; virtual; + function GetGameUserPath : WideString; virtual; + end; + var - Platform : TPlatform; + Platform : IPlatform; implementation @@ -55,19 +70,37 @@ uses {$ENDIF} { TPlatform } - + +(* function TPlatform.GetGamePath: WideString; -begin - // Windows and Linux use this: - Result := ExtractFilePath(ParamStr(0)); -end; - +begin + // Windows and Linux use this: + Result := ExtractFilePath(ParamStr(0)); +end; +*) +function TPlatform.GetLogPath : WideString; +begin + result := ExtractFilePath(ParamStr(0)); +end; + +function TPlatform.GetGameSharedPath : WideString; +begin + result := ExtractFilePath(ParamStr(0)); +end; + +function TPlatform.GetGameUserPath : WideString; +begin + result := ExtractFilePath(ParamStr(0)); +end; + + + function TPlatform.TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; -begin - // Linux and Mac don't check for running apps at the moment - Result := false; -end; - +begin + // Linux and Mac don't check for running apps at the moment + Result := false; +end; + initialization {$IFDEF MSWINDOWS} @@ -81,5 +114,5 @@ initialization {$ENDIF} finalization - freeandnil( Platform ); + Platform := nil; end. diff --git a/Game/Code/Classes/UPlatformLinux.pas b/Game/Code/Classes/UPlatformLinux.pas index 8119346e..03e04560 100644 --- a/Game/Code/Classes/UPlatformLinux.pas +++ b/Game/Code/Classes/UPlatformLinux.pas @@ -13,13 +13,20 @@ uses Classes, UPlatform; type TPlatformLinux = class(TPlatform) + function get_homedir(): string; public Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override; + function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; override; + + function GetLogPath : WideString; override; + function GetGameSharedPath : WideString; override; + function GetGameUserPath : WideString; override; end; implementation uses + libc, {$IFNDEF FPC_V220} oldlinux, {$ELSE} @@ -113,4 +120,35 @@ begin end; {$ENDIF} + +function TPlatformLinux.GetLogPath : WideString; +begin + result := '/var/log/UltraStarDeluxe/'; +end; + +function TPlatformLinux.GetGameSharedPath : WideString; +begin + result := '/usr/share/UltraStarDeluxe/'; +end; + +function TPlatformLinux.GetGameUserPath : WideString; +begin + result := get_homedir()+'/.UltraStarDeluxe/'; +end; + +function TPlatformLinux.get_homedir(): string; +var + pPasswdEntry : Ppasswd; + lUserName : String; +begin + pPasswdEntry := getpwuid( getuid() ); + result := pPasswdEntry^.pw_dir; +end; + +function TPlatformLinux.TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; +begin + // Linux and Mac don't check for running apps at the moment + Result := false; +end; + end. diff --git a/Game/Code/Classes/USkins.pas b/Game/Code/Classes/USkins.pas index 2237c22a..6a022153 100644 --- a/Game/Code/Classes/USkins.pas +++ b/Game/Code/Classes/USkins.pas @@ -42,7 +42,12 @@ var implementation -uses IniFiles, Classes, SysUtils, ULog, UIni; +uses IniFiles, + Classes, + SysUtils, + UMain, + ULog, + UIni; constructor TSkin.Create; begin @@ -54,13 +59,11 @@ end; procedure TSkin.LoadList; var SR: TSearchRec; -// SR2: TSearchRec; -// SLen: integer; begin - if FindFirst('Skins'+PathDelim+'*', faDirectory, SR) = 0 then begin + if FindFirst(SkinsPath+'*', faDirectory, SR) = 0 then begin repeat if (SR.Name <> '.') and (SR.Name <> '..') then - ParseDir('Skins'+PathDelim + SR.Name + PathDelim); + ParseDir(SkinsPath + SR.Name + PathDelim); until FindNext(SR) <> 0; end; // if FindClose(SR); @@ -69,13 +72,13 @@ end; procedure TSkin.ParseDir(Dir: string); var SR: TSearchRec; -// SLen: integer; begin if FindFirst(Dir + '*.ini', faAnyFile, SR) = 0 then begin repeat + if (SR.Name <> '.') and (SR.Name <> '..') then LoadHeader(Dir + SR.Name); - //Log.LogError(SR.Name); + until FindNext(SR) <> 0; end; end; @@ -89,11 +92,12 @@ begin S := Length(Skin); SetLength(Skin, S+1); - Skin[S].Path := IncludeTrailingBackslash(ExtractFileDir(FileName)); + + Skin[S].Path := IncludeTrailingBackslash(ExtractFileDir(FileName)); Skin[S].FileName := ExtractFileName(FileName); - Skin[S].Theme := SkinIni.ReadString('Skin', 'Theme', ''); - Skin[S].Name := SkinIni.ReadString('Skin', 'Name', ''); - Skin[S].Creator := SkinIni.ReadString('Skin', 'Creator', ''); + Skin[S].Theme := SkinIni.ReadString('Skin', 'Theme', ''); + Skin[S].Name := SkinIni.ReadString('Skin', 'Name', ''); + Skin[S].Creator := SkinIni.ReadString('Skin', 'Creator', ''); SkinIni.Free; end; @@ -105,17 +109,18 @@ var T: integer; S: integer; begin - S := GetSkinNumber(Name); + S := GetSkinNumber(Name); SkinPath := Skin[S].Path; - SkinIni := TMemIniFile.Create(SkinPath + Skin[S].FileName); + SkinIni := TMemIniFile.Create(SkinPath + Skin[S].FileName); SL := TStringList.Create; SkinIni.ReadSection('Textures', SL); SetLength(SkinTexture, SL.Count); - for T := 0 to SL.Count-1 do begin - SkinTexture[T].Name := SL.Strings[T]; + for T := 0 to SL.Count-1 do + begin + SkinTexture[T].Name := SL.Strings[T]; SkinTexture[T].FileName := SkinIni.ReadString('Textures', SL.Strings[T], ''); end; diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 3ac32dda..31db883d 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -265,7 +265,10 @@ begin BrowsePos := 0; // browse directories BrowseDir(SongPath); - + + if UserSongPath <> SongPath then + BrowseDir(UserSongPath); + //Set Correct SongArray Length SetLength(Song, BrowsePos); @@ -306,6 +309,7 @@ var i : Integer; Files : TDirectoryEntryArray; begin + Files := Platform.DirectoryFindFiles( Dir, '.txt', true); for i := 0 to Length(Files)-1 do begin @@ -318,7 +322,8 @@ begin SLen := BrowsePos; Song[SLen].Path := Dir; - Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); +// Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); + Song[SLen].Folder := Copy(Dir, Length(Dir)+1, 10000); Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); Song[SLen].FileName := Files[i].Name; diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 1c731ce0..bfffb26a 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -807,6 +807,8 @@ begin create_theme_objects(); + writeln( 'TTheme.LoadTheme : '+ FileName ); + FileName := AdaptFilePaths( FileName ); if not FileExists(FileName) then @@ -828,7 +830,8 @@ begin ThemeIni := TMemIniFile.Create(FileName); {$ENDIF} - if ThemeIni.ReadString('Theme', 'Name', '') <> '' then begin + if ThemeIni.ReadString('Theme', 'Name', '') <> '' then + begin {Skin.SkinName := ThemeIni.ReadString('Theme', 'Name', 'Singstar'); Skin.SkinPath := 'Skins\' + Skin.SkinName + '\'; @@ -2218,93 +2221,93 @@ begin end; procedure TTheme.create_theme_objects(); -begin - freeandnil( Loading ); - Loading := TThemeLoading.Create; - - freeandnil( Main ); - Main := TThemeMain.Create; - - freeandnil( Name ); - Name := TThemeName.Create; - - freeandnil( Level ); - Level := TThemeLevel.Create; - - freeandnil( Song ); - Song := TThemeSong.Create; - - freeandnil( Sing ); - Sing := TThemeSing.Create; - - freeandnil( Score ); - Score := TThemeScore.Create; - - freeandnil( Top5 ); - Top5 := TThemeTop5.Create; - - freeandnil( Options ); - Options := TThemeOptions.Create; - - freeandnil( OptionsGame ); - OptionsGame := TThemeOptionsGame.Create; - - freeandnil( OptionsGraphics ); - OptionsGraphics := TThemeOptionsGraphics.Create; - - freeandnil( OptionsSound ); - OptionsSound := TThemeOptionsSound.Create; - - freeandnil( OptionsLyrics ); - OptionsLyrics := TThemeOptionsLyrics.Create; - - freeandnil( OptionsThemes ); - OptionsThemes := TThemeOptionsThemes.Create; - - freeandnil( OptionsRecord ); - OptionsRecord := TThemeOptionsRecord.Create; - - freeandnil( OptionsAdvanced ); - OptionsAdvanced := TThemeOptionsAdvanced.Create; - - - freeandnil( ErrorPopup ); - ErrorPopup := TThemeError.Create; - - freeandnil( CheckPopup ); - CheckPopup := TThemeCheck.Create; - - - freeandnil( SongMenu ); - SongMenu := TThemeSongMenu.Create; - - freeandnil( SongJumpto ); - SongJumpto := TThemeSongJumpto.Create; - - //Party Screens - freeandnil( PartyNewRound ); - PartyNewRound := TThemePartyNewRound.Create; - - freeandnil( PartyWin ); - PartyWin := TThemePartyWin.Create; - - freeandnil( PartyScore ); - PartyScore := TThemePartyScore.Create; - - freeandnil( PartyOptions ); - PartyOptions := TThemePartyOptions.Create; - - freeandnil( PartyPlayer ); - PartyPlayer := TThemePartyPlayer.Create; - - - //Stats Screens: - freeandnil( StatMain ); - StatMain := TThemeStatMain.Create; - - freeandnil( StatDetail ); - StatDetail := TThemeStatDetail.Create; - +begin + freeandnil( Loading ); + Loading := TThemeLoading.Create; + + freeandnil( Main ); + Main := TThemeMain.Create; + + freeandnil( Name ); + Name := TThemeName.Create; + + freeandnil( Level ); + Level := TThemeLevel.Create; + + freeandnil( Song ); + Song := TThemeSong.Create; + + freeandnil( Sing ); + Sing := TThemeSing.Create; + + freeandnil( Score ); + Score := TThemeScore.Create; + + freeandnil( Top5 ); + Top5 := TThemeTop5.Create; + + freeandnil( Options ); + Options := TThemeOptions.Create; + + freeandnil( OptionsGame ); + OptionsGame := TThemeOptionsGame.Create; + + freeandnil( OptionsGraphics ); + OptionsGraphics := TThemeOptionsGraphics.Create; + + freeandnil( OptionsSound ); + OptionsSound := TThemeOptionsSound.Create; + + freeandnil( OptionsLyrics ); + OptionsLyrics := TThemeOptionsLyrics.Create; + + freeandnil( OptionsThemes ); + OptionsThemes := TThemeOptionsThemes.Create; + + freeandnil( OptionsRecord ); + OptionsRecord := TThemeOptionsRecord.Create; + + freeandnil( OptionsAdvanced ); + OptionsAdvanced := TThemeOptionsAdvanced.Create; + + + freeandnil( ErrorPopup ); + ErrorPopup := TThemeError.Create; + + freeandnil( CheckPopup ); + CheckPopup := TThemeCheck.Create; + + + freeandnil( SongMenu ); + SongMenu := TThemeSongMenu.Create; + + freeandnil( SongJumpto ); + SongJumpto := TThemeSongJumpto.Create; + + //Party Screens + freeandnil( PartyNewRound ); + PartyNewRound := TThemePartyNewRound.Create; + + freeandnil( PartyWin ); + PartyWin := TThemePartyWin.Create; + + freeandnil( PartyScore ); + PartyScore := TThemePartyScore.Create; + + freeandnil( PartyOptions ); + PartyOptions := TThemePartyOptions.Create; + + freeandnil( PartyPlayer ); + PartyPlayer := TThemePartyPlayer.Create; + + + //Stats Screens: + freeandnil( StatMain ); + StatMain := TThemeStatMain.Create; + + freeandnil( StatDetail ); + StatDetail := TThemeStatDetail.Create; + end; end. diff --git a/Game/Code/Classes/Ulazjpeg.pas b/Game/Code/Classes/Ulazjpeg.pas index d63ce753..003e9ab0 100644 --- a/Game/Code/Classes/Ulazjpeg.pas +++ b/Game/Code/Classes/Ulazjpeg.pas @@ -1,149 +1,151 @@ -{ Copyright (C) 2003 Mattias Gaertner - - This library is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published by - the Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License - for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -} -unit Ulazjpeg; - -{$mode objfpc}{$H+} -{$I switches.inc} - -interface - -uses - SysUtils, Classes, FPImage, IntfGraphics, Graphics, FPReadJPEG, FPWriteJPEG; - -type - TJPEGQualityRange = TFPJPEGCompressionQuality; - TJPEGPerformance = TJPEGReadPerformance; - - TJPEGImage = class(TFPImageBitmap) - private - FPerformance: TJPEGPerformance; - FProgressiveEncoding: boolean; - FQuality: TJPEGQualityRange; - protected -{$IFDEF LAZARUS_V0924} - procedure InitFPImageReader(IntfImg: TLazIntfImage; ImgReader: TFPCustomImageReader); override; -{$ELSE} - procedure InitFPImageReader(ImgReader: TFPCustomImageReader); override; -{$ENDIF} - procedure FinalizeFPImageReader(ImgReader: TFPCustomImageReader); override; -{$IFDEF LAZARUS_V0924} - procedure InitFPImageWriter(IntfImg: TLazIntfImage; ImgWriter: TFPCustomImageWriter); override; -{$ELSE} - procedure InitFPImageWriter(ImgWriter: TFPCustomImageWriter); override; -{$ENDIF} - public - constructor Create; override; - class function GetFileExtensions: string; override; - class function GetDefaultFPReader: TFPCustomImageReaderClass; override; - class function GetDefaultFPWriter: TFPCustomImageWriterClass; override; - public - property CompressionQuality: TJPEGQualityRange read FQuality write FQuality; - property ProgressiveEncoding: boolean read FProgressiveEncoding; - property Performance: TJPEGPerformance read FPerformance write FPerformance; - end; - -const - DefaultJPEGMimeType = 'image/jpeg'; - - -implementation - - -{ TJPEGImage } - -{$IFDEF LAZARUS_V0924} -procedure TJPEGImage.InitFPImageReader(IntfImg: TLazIntfImage; ImgReader: TFPCustomImageReader); -{$ELSE} -procedure TJPEGImage.InitFPImageReader(ImgReader: TFPCustomImageReader); -{$ENDIF} -var - JPEGReader: TFPReaderJPEG; -begin - if ImgReader is TFPReaderJPEG then begin - JPEGReader:=TFPReaderJPEG(ImgReader); - JPEGReader.Performance:=Performance; -{$IFDEF LAZARUS_V0924} - JPEGReader.OnProgress:=@Progress; -{$ENDIF} - end; -{$IFDEF LAZARUS_V0924} - inherited InitFPImageReader(IntfImg, ImgReader); -{$ELSE} - inherited InitFPImageReader(ImgReader); -{$ENDIF} -end; - -procedure TJPEGImage.FinalizeFPImageReader(ImgReader: TFPCustomImageReader); -var - JPEGReader: TFPReaderJPEG; -begin - if ImgReader is TFPReaderJPEG then begin - JPEGReader:=TFPReaderJPEG(ImgReader); - FProgressiveEncoding:=JPEGReader.ProgressiveEncoding; - end; - inherited FinalizeFPImageReader(ImgReader); -end; - -{$IFDEF LAZARUS_V0924} -procedure TJPEGImage.InitFPImageWriter(IntfImg: TLazIntfImage; ImgWriter: TFPCustomImageWriter); -{$ELSE} -procedure TJPEGImage.InitFPImageWriter(ImgWriter: TFPCustomImageWriter); -{$ENDIF} -var - JPEGWriter: TFPWriterJPEG; -begin - if ImgWriter is TFPWriterJPEG then begin - JPEGWriter:=TFPWriterJPEG(ImgWriter); - if JPEGWriter<>nil then ; - JPEGWriter.ProgressiveEncoding:=ProgressiveEncoding; - JPEGWriter.CompressionQuality:=CompressionQuality; -{$IFDEF LAZARUS_V0924} - JPEGWriter.OnProgress:=@Progress; -{$ENDIF} - end; -{$IFDEF LAZARUS_V0924} - inherited InitFPImageWriter(IntfImg, ImgWriter); -{$ELSE} - inherited InitFPImageWriter(ImgWriter); -{$ENDIF} -end; - -class function TJPEGImage.GetDefaultFPReader: TFPCustomImageReaderClass; -begin - Result:=TFPReaderJPEG; -end; - -class function TJPEGImage.GetDefaultFPWriter: TFPCustomImageWriterClass; -begin - Result:=TFPWriterJPEG; -end; - -constructor TJPEGImage.Create; -begin - inherited Create; - FPerformance:=jpBestQuality; - FProgressiveEncoding:=false; - FQuality:=75; -end; - -class function TJPEGImage.GetFileExtensions: string; -begin - Result:='jpg;jpeg'; -end; - -end. - +{ Copyright (C) 2003 Mattias Gaertner + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License + for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +} +unit Ulazjpeg; + +{$mode objfpc}{$H+} +{$I switches.inc} + +{$DEFINE LAZARUS_V0924} + +interface + +uses + SysUtils, Classes, FPImage, IntfGraphics, Graphics, FPReadJPEG, FPWriteJPEG; + +type + TJPEGQualityRange = TFPJPEGCompressionQuality; + TJPEGPerformance = TJPEGReadPerformance; + + TJPEGImage = class(TFPImageBitmap) + private + FPerformance: TJPEGPerformance; + FProgressiveEncoding: boolean; + FQuality: TJPEGQualityRange; + protected +{$IFDEF LAZARUS_V0924} + procedure InitFPImageReader(IntfImg: TLazIntfImage; ImgReader: TFPCustomImageReader); override; +{$ELSE} + procedure InitFPImageReader(ImgReader: TFPCustomImageReader); override; +{$ENDIF} + procedure FinalizeFPImageReader(ImgReader: TFPCustomImageReader); override; +{$IFDEF LAZARUS_V0924} + procedure InitFPImageWriter(IntfImg: TLazIntfImage; ImgWriter: TFPCustomImageWriter); override; +{$ELSE} + procedure InitFPImageWriter(ImgWriter: TFPCustomImageWriter); override; +{$ENDIF} + public + constructor Create; override; + class function GetFileExtensions: string; override; + class function GetDefaultFPReader: TFPCustomImageReaderClass; override; + class function GetDefaultFPWriter: TFPCustomImageWriterClass; override; + public + property CompressionQuality: TJPEGQualityRange read FQuality write FQuality; + property ProgressiveEncoding: boolean read FProgressiveEncoding; + property Performance: TJPEGPerformance read FPerformance write FPerformance; + end; + +const + DefaultJPEGMimeType = 'image/jpeg'; + + +implementation + + +{ TJPEGImage } + +{$IFDEF LAZARUS_V0924} +procedure TJPEGImage.InitFPImageReader(IntfImg: TLazIntfImage; ImgReader: TFPCustomImageReader); +{$ELSE} +procedure TJPEGImage.InitFPImageReader(ImgReader: TFPCustomImageReader); +{$ENDIF} +var + JPEGReader: TFPReaderJPEG; +begin + if ImgReader is TFPReaderJPEG then begin + JPEGReader:=TFPReaderJPEG(ImgReader); + JPEGReader.Performance:=Performance; +{$IFDEF LAZARUS_V0924} + JPEGReader.OnProgress:=@Progress; +{$ENDIF} + end; +{$IFDEF LAZARUS_V0924} + inherited InitFPImageReader(IntfImg, ImgReader); +{$ELSE} + inherited InitFPImageReader(ImgReader); +{$ENDIF} +end; + +procedure TJPEGImage.FinalizeFPImageReader(ImgReader: TFPCustomImageReader); +var + JPEGReader: TFPReaderJPEG; +begin + if ImgReader is TFPReaderJPEG then begin + JPEGReader:=TFPReaderJPEG(ImgReader); + FProgressiveEncoding:=JPEGReader.ProgressiveEncoding; + end; + inherited FinalizeFPImageReader(ImgReader); +end; + +{$IFDEF LAZARUS_V0924} +procedure TJPEGImage.InitFPImageWriter(IntfImg: TLazIntfImage; ImgWriter: TFPCustomImageWriter); +{$ELSE} +procedure TJPEGImage.InitFPImageWriter(ImgWriter: TFPCustomImageWriter); +{$ENDIF} +var + JPEGWriter: TFPWriterJPEG; +begin + if ImgWriter is TFPWriterJPEG then begin + JPEGWriter:=TFPWriterJPEG(ImgWriter); + if JPEGWriter<>nil then ; + JPEGWriter.ProgressiveEncoding:=ProgressiveEncoding; + JPEGWriter.CompressionQuality:=CompressionQuality; +{$IFDEF LAZARUS_V0924} + JPEGWriter.OnProgress:=@Progress; +{$ENDIF} + end; +{$IFDEF LAZARUS_V0924} + inherited InitFPImageWriter(IntfImg, ImgWriter); +{$ELSE} + inherited InitFPImageWriter(ImgWriter); +{$ENDIF} +end; + +class function TJPEGImage.GetDefaultFPReader: TFPCustomImageReaderClass; +begin + Result:=TFPReaderJPEG; +end; + +class function TJPEGImage.GetDefaultFPWriter: TFPCustomImageWriterClass; +begin + Result:=TFPWriterJPEG; +end; + +constructor TJPEGImage.Create; +begin + inherited Create; + FPerformance:=jpBestQuality; + FProgressiveEncoding:=false; + FQuality:=75; +end; + +class function TJPEGImage.GetFileExtensions: string; +begin + Result:='jpg;jpeg'; +end; + +end. + diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index 06444dfe..114a5e45 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -28,7 +28,9 @@ type implementation -uses UGraphic, USkins; +uses UMain, + UGraphic, + USkins; function TScreenOptionsThemes.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -147,7 +149,7 @@ end; procedure TScreenOptionsThemes.ReloadTheme; begin - Theme.LoadTheme('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + Theme.LoadTheme(ThemePath + ITheme[Ini.Theme] + '.ini', Ini.Color); ScreenOptionsThemes := TScreenOptionsThemes.create(); ScreenOptionsThemes.onshow; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index b442b3bc..b15c5bbf 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -149,7 +149,7 @@ uses UAudio_portaudio in 'Classes\UAudio_portaudio.pas', {$endif} {$ifdef UseFFMpegAudio} - UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', + UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', {$endif} -- cgit v1.2.3 From 8d367ca3e9d49fbac6798f5aad0be03f8e5cfeec Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 20 Dec 2007 20:12:38 +0000 Subject: removed hard-coded lazarus_v0924 define (why is it in there?) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@736 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/Ulazjpeg.pas | 2 -- 1 file changed, 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/Ulazjpeg.pas b/Game/Code/Classes/Ulazjpeg.pas index 003e9ab0..a5271a7e 100644 --- a/Game/Code/Classes/Ulazjpeg.pas +++ b/Game/Code/Classes/Ulazjpeg.pas @@ -19,8 +19,6 @@ unit Ulazjpeg; {$mode objfpc}{$H+} {$I switches.inc} -{$DEFINE LAZARUS_V0924} - interface uses -- cgit v1.2.3 From d808dde8310ecfd659d36bfe1ba77e76ea43b6c0 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Dec 2007 22:53:06 +0000 Subject: added -localpaths command line switch so we dont always have to use the packaged locations. ( profox ) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@737 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCommandLine.pas | 5 ++++- Game/Code/Classes/UPlatformLinux.pas | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UCommandLine.pas b/Game/Code/Classes/UCommandLine.pas index e99ee37a..86f822a4 100644 --- a/Game/Code/Classes/UCommandLine.pas +++ b/Game/Code/Classes/UCommandLine.pas @@ -56,6 +56,7 @@ var const cHelp = 'help'; cMediaInterfaces = 'showinterfaces'; + cUseLocalPaths = 'localpaths'; implementation @@ -93,7 +94,9 @@ begin writeln( '' ); writeln( ' '+s( 'Switch' ) +' : Purpose' ); writeln( ' ----------------------------------------------------------' ); - writeln( ' '+s( cMediaInterfaces ) + ' : Show in-use media interfaces' ); + writeln( ' '+s( cMediaInterfaces ) + #9 + ' : Show in-use media interfaces' ); + writeln( ' '+s( cUseLocalPaths ) + #9 + ' : Use relative paths' ); + writeln( '' ); halt; diff --git a/Game/Code/Classes/UPlatformLinux.pas b/Game/Code/Classes/UPlatformLinux.pas index 03e04560..0098baee 100644 --- a/Game/Code/Classes/UPlatformLinux.pas +++ b/Game/Code/Classes/UPlatformLinux.pas @@ -27,6 +27,7 @@ implementation uses libc, + uCommandLine, {$IFNDEF FPC_V220} oldlinux, {$ELSE} @@ -123,17 +124,26 @@ end; function TPlatformLinux.GetLogPath : WideString; begin - result := '/var/log/UltraStarDeluxe/'; + if FindCmdLineSwitch( cUseLocalPaths ) then + result := inherited + else + result := '/var/log/UltraStarDeluxe/'; end; function TPlatformLinux.GetGameSharedPath : WideString; begin - result := '/usr/share/UltraStarDeluxe/'; + if FindCmdLineSwitch( cUseLocalPaths ) then + result := inherited + else + result := '/usr/share/UltraStarDeluxe/'; end; function TPlatformLinux.GetGameUserPath : WideString; begin - result := get_homedir()+'/.UltraStarDeluxe/'; + if FindCmdLineSwitch( cUseLocalPaths ) then + result := inherited + else + result := get_homedir()+'/.UltraStarDeluxe/'; end; function TPlatformLinux.get_homedir(): string; -- cgit v1.2.3 From a00122fe60de966751b637477ac8e0a4fdcfbf4b Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Dec 2007 23:59:59 +0000 Subject: removed a bunch of debugging from usdx startup. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@738 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UFiles.pas | 4 ---- Game/Code/Classes/UIni.pas | 2 -- Game/Code/Classes/ULog.pas | 34 ++++++++++++++++------------------ Game/Code/Classes/UTexture.pas | 2 +- Game/Code/Menu/UMenu.pas | 15 --------------- 5 files changed, 17 insertions(+), 40 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index e4f83b7a..274bf404 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -128,8 +128,6 @@ begin Identifier := Uppercase(Trim(Copy(Line, 2, Temp - 2))); //Uppercase is for Case Insensitive Checks Value := Trim(Copy(Line, Temp + 1,Length(Line) - Temp)); - Log.LogError('Identifier: '+Identifier+' - '+ Value ); - //Check the Identifier (If Value is given) if (Length(Value) <> 0) then begin @@ -332,8 +330,6 @@ Result := False; //Reset LineNo FileLineNo := 0; - writeln( 'Assign File : ' + Song.Path + Song.FileName ); - //Open File and set File Pointer to the beginning AssignFile(SongFile, Song.Path + Song.FileName); diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index 0e84c506..abbef723 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -415,10 +415,8 @@ begin //Search for Skins for this Theme for Pet := low(Skin.Skin) to high(Skin.Skin) do begin - writeln( 'forloop' ); if UpperCase(Skin.Skin[Pet].Theme) = Tekst then begin - writeln( 'match' ); SetLength(ITheme, Length(ITheme)+1); ITheme[High(ITheme)] := GetFileName(SR.Name); break; diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index 50e9bf68..01eff5f4 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -189,8 +189,6 @@ begin FileErrorO := false; end; end; - {$DEFINE DEBUG} //How can i check if this is set in *.dpr file o0 - //If Debug => Write to Console Output {$IFDEF DEBUG} WriteLn('Error: ' + Text); {$ENDIF} @@ -230,7 +228,7 @@ begin //If Debug => Write to Console Output {$IFDEF DEBUG} - WriteLn(Log2 + ': ' + Log1); +// WriteLn(Log2 + ': ' + Log1); {$ENDIF} end; @@ -260,21 +258,21 @@ end; procedure TLog.LogBuffer(const buf: Pointer; const bufLength: Integer; filename: string); var f : TFileStream; -begin - f := nil; - - try - f := TFileStream.Create( filename, fmCreate); - f.Write( buf^, bufLength); - f.Free; - except - on e : Exception do begin - Log.LogError('TLog.LogBuffer: Failed to log buffer into file "' + filename + '". ErrMsg: ' + e.Message); - f.Free; - end; - end; -end; - +begin + f := nil; + + try + f := TFileStream.Create( filename, fmCreate); + f.Write( buf^, bufLength); + f.Free; + except + on e : Exception do begin + Log.LogError('TLog.LogBuffer: Failed to log buffer into file "' + filename + '". ErrMsg: ' + e.Message); + f.Free; + end; + end; +end; + end. diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 8701673e..f57c9c15 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -1,6 +1,6 @@ unit UTexture; // added for easier debug disabling -{$define blindydebug} +{$undefine blindydebug} // Plain (alpha = 1) // Transparent diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 99f10c08..e6bb6b45 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -277,10 +277,6 @@ begin //Button Collections are Created when the first ChildButton is Created PrepareButtonCollections(ThemeBasic.ButtonCollection); - {$ifdef fpc} - writeln(' TMenu.LoadFromThem : '+ThemeBasic.Background.Tex ); - {$endif} - //Add Background AddBackground(ThemeBasic.Background.Tex); @@ -298,24 +294,13 @@ var begin if Name <> '' then begin -// BackImg := Texture.LoadTexture(false, PChar(Skin.SkinPath + FileName), 'JPG', 'Plain', 0); // new theme system lFileName := Skin.GetTextureFileName(Name); lFileName := AdaptFilePaths( lFileName ); - {$ifdef fpc} - writeln(' TMenu.AddBackground : '+Name+ ' - '+ lFileName ); - {$endif} - -// if lFileName <> '' then if fileexists( lFileName ) then begin BackImg := Texture.GetTexture( lFileName , 'Plain'); - {$ifdef fpc} - writeln(' TMenu.AddBackground : '+ lFileName +' - LOADED'); - {$endif} - - BackImg.W := 800; BackImg.H := 600; BackW := 1; -- cgit v1.2.3 From bb30a9bec3566db0a8a8a65a0afe6cf864cdeb11 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 22 Dec 2007 16:53:25 +0000 Subject: fixed a "typo" git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@740 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index f57c9c15..82dedf45 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -1,6 +1,6 @@ unit UTexture; // added for easier debug disabling -{$undefine blindydebug} +{$undef blindydebug} // Plain (alpha = 1) // Transparent -- cgit v1.2.3 From d4ecb06978eafef8ea7aff79197d6869916389d9 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 22 Dec 2007 22:08:10 +0000 Subject: fixed screenshot problem git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@743 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMain.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 06c4824a..7c3ad9d4 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -448,7 +448,7 @@ Begin SDL_KEYDOWN: begin //ScreenShot hack. If Print is pressed-> Make screenshot and Save to Screenshots Path - if (Event.key.keysym.sym = SDLK_SYSREQ) then + if (Event.key.keysym.sym = SDLK_SYSREQ) or (Event.key.keysym.sym = SDLK_PRINT) then Display.ScreenShot // popup hack... if there is a visible popup then let it handle input instead of underlying screen -- cgit v1.2.3 From 5f6141d2d49c280c5ae70332290f360272d07e35 Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 27 Dec 2007 00:08:54 +0000 Subject: bug-fix: Tex_ScoreBG bounds were changed from [0..5] to [1..6] but Tex_ScoreBG[0] was used at several places in the code. This corrupted Tex_SingLineBonusBack[8].Name and caused a segmentation fault. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@745 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphic.pas | 1578 ++++++++++++++++++++-------------------- 1 file changed, 789 insertions(+), 789 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 32d7d304..3536d9d7 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -1,789 +1,789 @@ -unit UGraphic; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses - SDL, - OpenGL12, - UTexture, - TextGL, - ULog, - SysUtils, - ULyrics, - UScreenLoading, - UScreenWelcome, - UScreenMain, - UScreenName, - UScreenLevel, - UScreenOptions, - UScreenOptionsGame, - UScreenOptionsGraphics, - UScreenOptionsSound, - UScreenOptionsLyrics, - UScreenOptionsThemes, - UScreenOptionsRecord, - UScreenOptionsAdvanced, - UScreenSong, - UScreenSing, - UScreenScore, - UScreenTop5, - UScreenEditSub, - UScreenEdit, - UScreenEditConvert, - UScreenEditHeader, - UScreenOpen, - UThemes, - USkins, - UScreenSongMenu, - UScreenSongJumpto, - {Party Screens} - UScreenSingModi, - UScreenPartyNewRound, - UScreenPartyScore, - UScreenPartyOptions, - UScreenPartyWin, - UScreenPartyPlayer, - {Stats Screens} - UScreenStatMain, - UScreenStatDetail, - {CreditsScreen} - UScreenCredits, - {Popup for errors, etc.} - UScreenPopup; - -type - TRecR = record - Top: real; - Left: real; - Right: real; - Bottom: real; - end; - -var - Screen: PSDL_Surface; - LoadingThread: PSDL_Thread; - Mutex: PSDL_Mutex; - - RenderW: integer; - RenderH: integer; - ScreenW: integer; - ScreenH: integer; - Screens: integer; - ScreenAct: integer; - ScreenX: integer; - - ScreenLoading: TScreenLoading; - ScreenWelcome: TScreenWelcome; - ScreenMain: TScreenMain; - ScreenName: TScreenName; - ScreenLevel: TScreenLevel; - ScreenSong: TScreenSong; - ScreenSing: TScreenSing; - ScreenScore: TScreenScore; - ScreenTop5: TScreenTop5; - ScreenOptions: TScreenOptions; - ScreenOptionsGame: TScreenOptionsGame; - ScreenOptionsGraphics: TScreenOptionsGraphics; - ScreenOptionsSound: TScreenOptionsSound; - ScreenOptionsLyrics: TScreenOptionsLyrics; - ScreenOptionsThemes: TScreenOptionsThemes; - ScreenOptionsRecord: TScreenOptionsRecord; - ScreenOptionsAdvanced: TScreenOptionsAdvanced; - ScreenEditSub: TScreenEditSub; - ScreenEdit: TScreenEdit; - ScreenEditConvert: TScreenEditConvert; - ScreenEditHeader: TScreenEditHeader; - ScreenOpen: TScreenOpen; - - ScreenSongMenu: TScreenSongMenu; - ScreenSongJumpto: TScreenSongJumpto; - - //Party Screens - ScreenSingModi: TScreenSingModi; - ScreenPartyNewRound: TScreenPartyNewRound; - ScreenPartyScore: TScreenPartyScore; - ScreenPartyWin: TScreenPartyWin; - ScreenPartyOptions: TScreenPartyOptions; - ScreenPartyPlayer: TScreenPartyPlayer; - - //StatsScreens - ScreenStatMain: TScreenStatMain; - ScreenStatDetail: TScreenStatDetail; - - //CreditsScreen - ScreenCredits: TScreenCredits; - - //popup mod - ScreenPopupCheck: TScreenPopupCheck; - ScreenPopupError: TScreenPopupError; - - //Notes - Tex_Left: array[0..6] of TTexture; //rename to tex_note_left - Tex_Mid: array[0..6] of TTexture; //rename to tex_note_mid - Tex_Right: array[0..6] of TTexture; //rename to tex_note_right - - Tex_plain_Left: array[1..6] of TTexture; //rename to tex_notebg_left - Tex_plain_Mid: array[1..6] of TTexture; //rename to tex_notebg_mid - Tex_plain_Right: array[1..6] of TTexture; //rename to tex_notebg_right - - Tex_BG_Left: array[1..6] of TTexture; //rename to tex_noteglow_left - Tex_BG_Mid: array[1..6] of TTexture; //rename to tex_noteglow_mid - Tex_BG_Right: array[1..6] of TTexture; //rename to tex_noteglow_right - - Tex_Note_Star: TTexture; - Tex_Note_Perfect_Star: TTexture; - - - Tex_Ball: TTexture; - Tex_Lyric_Help_Bar: TTexture; - FullScreen: boolean; - - Tex_TimeProgress: TTexture; - - //Sing Bar Mod - Tex_SingBar_Back: TTexture; - Tex_SingBar_Bar: TTexture; - Tex_SingBar_Front: TTexture; - //end Singbar Mod - - //PhrasenBonus - Line Bonus Mod - Tex_SingLineBonusBack: array[0..8] of TTexture; - //End PhrasenBonus - Line Bonus Mod - - //ScoreBG Texs - Tex_ScoreBG: array [1..6] of TTexture; - - //Score Screen Textures - Tex_Score_NoteBarLevel_Dark : array [1..6] of TTexture; - Tex_Score_NoteBarRound_Dark : array [1..6] of TTexture; - - Tex_Score_NoteBarLevel_Light : array [1..6] of TTexture; - Tex_Score_NoteBarRound_Light : array [1..6] of TTexture; - - Tex_Score_NoteBarLevel_Lightest : array [1..6] of TTexture; - Tex_Score_NoteBarRound_Lightest : array [1..6] of TTexture; - - Tex_Score_Ratings : array [0..6] of TTexture; - -const - Skin_BGColorR = 1; - Skin_BGColorG = 1; - Skin_BGColorB = 1; - - Skin_SpectrumR = 0; - Skin_SpectrumG = 0; - Skin_SpectrumB = 0; - - Skin_Spectograph1R = 0.6; - Skin_Spectograph1G = 0.8; - Skin_Spectograph1B = 1; - - Skin_Spectograph2R = 0; - Skin_Spectograph2G = 0; - Skin_Spectograph2B = 0.2; - - Skin_SzczytR = 0.8; - Skin_SzczytG = 0; - Skin_SzczytB = 0; - - Skin_SzczytLimitR = 0; - Skin_SzczytLimitG = 0.8; - Skin_SzczytLimitB = 0; - - Skin_FontR = 0; - Skin_FontG = 0; - Skin_FontB = 0; - - Skin_FontHighlightR = 0.3; // 0.3 - Skin_FontHighlightG = 0.3; // 0.3 - Skin_FontHighlightB = 1; // 1 - - Skin_TimeR = 0.25; //0,0,0 - Skin_TimeG = 0.25; - Skin_TimeB = 0.25; - - Skin_OscR = 0; - Skin_OscG = 0; - Skin_OscB = 0; - - Skin_LyricsT = 494; // 500 / 510 / 400 - Skin_SpectrumT = 470; - Skin_SpectrumBot = 570; - Skin_SpectrumH = 100; - - Skin_P1_LinesR = 0.5; // 0.6 0.6 1 - Skin_P1_LinesG = 0.5; - Skin_P1_LinesB = 0.5; - - Skin_P2_LinesR = 0.5; // 1 0.6 0.6 - Skin_P2_LinesG = 0.5; - Skin_P2_LinesB = 0.5; - - Skin_P1_NotesB = 250; - Skin_P2_NotesB = 430; // 430 / 300 - - Skin_P1_ScoreT = 50; - Skin_P1_ScoreL = 20; - - Skin_P2_ScoreT = 50; - Skin_P2_ScoreL = 640; - -procedure Initialize3D (Title: string); -procedure Reinitialize3D; -procedure SwapBuffers; - -procedure LoadTextures; -procedure InitializeScreen; -procedure LoadLoadingScreen; -procedure LoadScreens; -procedure UnLoadScreens; - -function LoadingThreadFunction: integer; - - -implementation - -uses UMain, - UIni, - UDisplay, - UCommandLine, - {$IFNDEF FPC} - Graphics, - {$ENDIF} - {$IFDEF win32} - windows, - {$ENDIF} - Classes; - -procedure LoadFontTextures; -begin - Log.LogStatus('Building Fonts', 'LoadTextures'); - BuildFont; -end; - -procedure LoadTextures; - - -var - P: integer; - R, G, B: real; - Col: integer; -begin - // zaladowanie tekstur - Log.LogStatus('Loading Textures', 'LoadTextures'); - - Tex_Left[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'BMP', 'Transparent', 0); //brauch man die noch? - Tex_Mid[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'BMP', 'Plain', 0); //brauch man die noch? - Tex_Right[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'BMP', 'Transparent', 0); //brauch man die noch? - - Log.LogStatus('Loading Textures - A', 'LoadTextures'); - - // P1-6 - // TODO... do it once for each player... this is a bit crappy !! - // can we make it any better !? - for P := 1 to 6 do - begin - LoadColor(R, G, B, 'P' + IntToStr(P) + 'Light'); - Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); - - Tex_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'PNG', 'Colorized', Col); - Tex_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'PNG', 'Colorized', Col); - Tex_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'PNG', 'Colorized', Col); - - Tex_plain_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainLeft')), 'PNG', 'Colorized', Col); - Tex_plain_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainMid')), 'PNG', 'Colorized', Col); - Tex_plain_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainRight')), 'PNG', 'Colorized', Col); - - Tex_BG_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGLeft')), 'PNG', 'Colorized', Col); - Tex_BG_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGMid')), 'PNG', 'Colorized', Col); - Tex_BG_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGRight')), 'PNG', 'Colorized', Col); - end; - - Log.LogStatus('Loading Textures - B', 'LoadTextures'); - - Tex_Note_Perfect_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePerfectStar')), 'PNG', 'Transparent', 0); - Tex_Note_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteStar')) , 'PNG', 'Transparent', $FFFFFF); - Tex_Ball := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'BMP', 'Transparent', $FF00FF); - Tex_Lyric_Help_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricHelpBar')), 'BMP', 'Transparent', $FF00FF); - - - //TimeBar mod - Tex_TimeProgress := Texture.LoadTexture(pchar(Skin.GetTextureFileName('TimeBar'))); - //eoa TimeBar mod - - //SingBar Mod - Tex_SingBar_Back := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBack')), 'JPG', 'Plain', 0); - Tex_SingBar_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBar')), 'JPG', 'Plain', 0); - Tex_SingBar_Front := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarFront')), 'JPG', 'Font', 0); - //end Singbar Mod - - Log.LogStatus('Loading Textures - C', 'LoadTextures'); - - //Line Bonus PopUp - for P := 0 to 8 do - begin - Case P of - 0: begin - R := 1; - G := 0; - B := 0; - end; - 1..3: begin - R := 1; - G := (P * 0.25); - B := 0; - end; - 4: begin - R := 1; - G := 1; - B := 0; - end; - 5..7: begin - R := 1-((P-4)*0.25); - G := 1; - B := 0; - end; - 8: begin - R := 0; - G := 1; - B := 0; - end; - End; - - Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); - Tex_SingLineBonusBack[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LineBonusBack')), 'PNG', 'Colorized', Col); - end; - -//## backgrounds for the scores ## - for P := 0 to 5 do begin - LoadColor(R, G, B, 'P' + IntToStr(P+1) + 'Light'); - Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); - Tex_ScoreBG[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreBG')), 'PNG', 'Colorized', Col); - end; - - - Log.LogStatus('Loading Textures - D', 'LoadTextures'); - -// ###################### -// Score screen textures -// ###################### - -//## the bars that visualize the score ## - for P := 1 to 6 do begin -//NoteBar ScoreBar - LoadColor(R, G, B, 'P' + IntToStr(P) + 'Dark'); - Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); - Tex_Score_NoteBarLevel_Dark[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Dark')), 'PNG', 'Colorized', Col); - Tex_Score_NoteBarRound_Dark[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Dark_Round')), 'PNG', 'Colorized', Col); -//LineBonus ScoreBar - LoadColor(R, G, B, 'P' + IntToStr(P) + 'Light'); - Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); - Tex_Score_NoteBarLevel_Light[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Light')), 'PNG', 'Colorized', Col); - Tex_Score_NoteBarRound_Light[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Light_Round')), 'PNG', 'Colorized', Col); -//GoldenNotes ScoreBar - LoadColor(R, G, B, 'P' + IntToStr(P) + 'Lightest'); - Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); - Tex_Score_NoteBarLevel_Lightest[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Lightest')), 'PNG', 'Colorized', Col); - Tex_Score_NoteBarRound_Lightest[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Lightest_Round')), 'PNG', 'Colorized', Col); - end; - -//## rating pictures that show a picture according to your rate ## - for P := 0 to 6 do begin - Tex_Score_Ratings[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Rating_'+IntToStr(P))), 'PNG', 'Transparent', 0); - end; - - Log.LogStatus('Loading Textures - Done', 'LoadTextures'); -end; - -procedure Initialize3D (Title: string); -var -// Icon: TIcon; -// Res: TResourceStream; - ISurface: PSDL_Surface; - Pixel: PByteArray; - I: Integer; -begin - Log.LogStatus('LoadOpenGL', 'UGraphic.Initialize3D'); -// Log.BenchmarkStart(2); - - LoadOpenGL; - - Log.LogStatus('SDL_Init', 'UGraphic.Initialize3D'); - if ( SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO)= -1 ) then - begin - Log.LogError('SDL_Init Failed', 'UGraphic.Initialize3D'); - exit; - end; - - { //Load Icon - Res := TResourceStream.CreateFromID(HInstance, 3, RT_ICON); - Icon := TIcon.Create; - Icon.LoadFromStream(Res); - Res.Free; - Icon. - //Create icon Surface - SDL_CreateRGBSurfaceFrom ( - SDL_SWSURFACE, - Icon.Width, - Icon.Height, - 32, - 128 or 64, - 32 or 16, - 8 or 4, - 2 or 1); - //SDL_BlitSurface( - - - SDL_WM_SetIcon(SDL_LoadBMP('DEFAULT_WINDOW_ICON'), 0); //} - - SDL_WM_SetCaption(PChar(Title), nil); - - InitializeScreen; - -// Log.BenchmarkEnd(2); -// Log.LogBenchmark('--> Setting Screen', 2); - - // ladowanie tekstur -// Log.BenchmarkStart(2); - Texture := TTextureUnit.Create; - Texture.Limit := 1024*1024; - -// LoadTextures; -// Log.BenchmarkEnd(2); -// Log.LogBenchmark('--> Loading Textures', 2); - -{ Log.BenchmarkStart(2); - Lyric:= TLyric.Create; - Log.BenchmarkEnd(2); - Log.LogBenchmark('--> Loading Fonts', 2); -} - -// Log.BenchmarkStart(2); - - Log.LogStatus('TDisplay.Create', 'UGraphic.Initialize3D'); - Display := TDisplay.Create; - - Log.LogStatus('SDL_EnableUnicode', 'UGraphic.Initialize3D'); - SDL_EnableUnicode(1); -// Log.BenchmarkEnd(2); Log.LogBenchmark('====> Creating Display', 2); - -// Log.LogStatus('Loading Screens', 'Initialize3D'); -// Log.BenchmarkStart(3); - - Log.LogStatus('Loading Font Textures', 'UGraphic.Initialize3D'); - LoadFontTextures(); - - // Show the Loading Screen ------------- - Log.LogStatus('Loading Loading Screen', 'UGraphic.Initialize3D'); - LoadLoadingScreen; - - - Log.LogStatus(' Loading Textures', 'UGraphic.Initialize3D'); - LoadTextures; // jb - - - - // now that we have something to display while loading, - // start thread that loads the rest of ultrastar -// Mutex := SDL_CreateMutex; -// SDL_UnLockMutex(Mutex); - - // funktioniert so noch nicht, da der ladethread unverändert auf opengl zugreifen will - // siehe dazu kommentar unten - //LoadingThread := SDL_CreateThread(@LoadingThread, nil); - - // das hier würde dann im ladethread ausgeführt - Log.LogStatus(' Loading Screens', 'UGraphic.Initialize3D'); - LoadScreens; - - - // TODO!!!!!!1 - // hier käme jetzt eine schleife, die - // * den ladescreen malt (ab und zu) - // * den "fortschritt" des ladescreens steuert - // * zwischendrin schaut, ob der ladethread texturen geladen hat (mutex prüfen) und - // * die texturen in die opengl lädt, sowie - // * dem ladethread signalisiert, dass der speicher für die textur - // zum laden der nächsten textur weiterverwendet werden kann (über weiteren mutex) - // * über einen 3. mutex so lange läuft, bis der ladethread signalisiert, - // dass er alles geladen hat fertig ist - // - // dafür muss loadtexture so umgeschrieben werden, dass es, statt selbst irgendwelche - // opengl funktionen aufzurufen, entsprechend mutexe verändert - // der hauptthread muss auch irgendwoher erfahren, was an opengl funktionen auszuführen ist, - // mit welchen parametern (texturtyp, entspr. texturobjekt, textur-zwischenspeicher-adresse, ... - - - //wait for loading thread to finish - // funktioniert so auch noch nicht - //SDL_WaitThread(LoadingThread, I); -// SDL_DestroyMutex(Mutex); - - Display.ActualScreen^.FadeTo( @ScreenMain ); - - Log.BenchmarkEnd(2); - Log.LogBenchmark('--> Loading Screens', 2); - - Log.LogStatus('Finish', 'Initialize3D'); -end; - -procedure SwapBuffers; -begin - SDL_GL_SwapBuffers; - glMatrixMode(GL_PROJECTION); - glLoadIdentity; - glOrtho(0, RenderW, RenderH, 0, -1, 100); - glMatrixMode(GL_MODELVIEW); -end; - -procedure Reinitialize3D; -begin -// InitializeScreen; -// LoadTextures; -// LoadScreens; -end; - -procedure InitializeScreen; -var - S: string; - I: integer; - W, H: integer; - Depth: Integer; -begin - if (Params.Screens <> -1) then - Screens := Params.Screens + 1 - else - Screens := Ini.Screens + 1; - - SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - - // If there is a resolution in Parameters, use it, else use the Ini value - I := Params.Resolution; - if (I <> -1) then - S := IResolution[I] - else - S := IResolution[Ini.Resolution]; - - I := Pos('x', S); - W := StrToInt(Copy(S, 1, I-1)) * Screens; - H := StrToInt(Copy(S, I+1, 1000)); - - {if ParamStr(1) = '-fsblack' then begin - W := 800; - H := 600; - end; - if ParamStr(1) = '-320x240' then begin - W := 320; - H := 240; - end; } - - If (Params.Depth <> -1) then - Depth := Params.Depth - else - Depth := Ini.Depth; - - - Log.LogStatus('SDL_SetVideoMode', 'Set Window Icon'); - -// Okay it's possible to set the title bar / taskbar icon here -// it's working this way, but just if the bmp is in your exe folder - SDL_WM_SetIcon(SDL_LoadBMP('ustar-icon.bmp'), 0); - - Log.LogStatus('SDL_SetVideoMode', 'Initialize3D'); -// SDL_SetRefreshrate(85); -// SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); - - {$ifndef win32} - // Todo : jb_linux remove this for linux... but helps for debugging - Ini.FullScreen := 0; - W := 800; - H := 600; - {$endif} - - {$IFDEF DARWIN} - // Todo : eddie: remove before realease - Ini.FullScreen := 0; - {$ENDIF} - - if (Ini.FullScreen = 0) and (Not Params.FullScreen) then - begin - Log.LogStatus('SDL_SetVideoMode', 'Set Video Mode... Windowed'); - screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL) - end - else - begin - Log.LogStatus('SDL_SetVideoMode', 'Set Video Mode... Full Screen'); - screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN); - SDL_ShowCursor(0); - end; - - if (screen = nil) then - begin - Log.LogError('SDL_SetVideoMode Failed', 'Initialize3D'); - exit; - end; - - // clear screen once window is being shown - glClearColor(1, 1, 1, 1); - glClear(GL_COLOR_BUFFER_BIT); - SwapBuffers; - - // zmienne - RenderW := 800; - RenderH := 600; - ScreenW := W; - ScreenH := H; -end; - -procedure LoadLoadingScreen; -begin - ScreenLoading := TScreenLoading.Create; - ScreenLoading.onShow; - - Display.ActualScreen := @ScreenLoading; - - swapbuffers; - - ScreenLoading.Draw; - Display.Draw; - - SwapBuffers; -end; - -procedure LoadScreens; -begin -{ ScreenLoading := TScreenLoading.Create; - ScreenLoading.onShow; - Display.ActualScreen := @ScreenLoading; - ScreenLoading.Draw; - Display.Draw; - SwapBuffers; -} - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Loading', 3); Log.BenchmarkStart(3); -{ ScreenWelcome := TScreenWelcome.Create; //'BG', 4, 3); - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Welcome', 3); Log.BenchmarkStart(3);} - ScreenMain := TScreenMain.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Main', 3); Log.BenchmarkStart(3); - ScreenName := TScreenName.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Name', 3); Log.BenchmarkStart(3); - ScreenLevel := TScreenLevel.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Level', 3); Log.BenchmarkStart(3); - ScreenSong := TScreenSong.Create; - 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); - ScreenSing := TScreenSing.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing', 3); Log.BenchmarkStart(3); - ScreenScore := TScreenScore.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Score', 3); Log.BenchmarkStart(3); - ScreenTop5 := TScreenTop5.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Top5', 3); Log.BenchmarkStart(3); - ScreenOptions := TScreenOptions.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options', 3); Log.BenchmarkStart(3); - ScreenOptionsGame := TScreenOptionsGame.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Game', 3); Log.BenchmarkStart(3); - ScreenOptionsGraphics := TScreenOptionsGraphics.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Graphics', 3); Log.BenchmarkStart(3); - ScreenOptionsSound := TScreenOptionsSound.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Sound', 3); Log.BenchmarkStart(3); - ScreenOptionsLyrics := TScreenOptionsLyrics.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Lyrics', 3); Log.BenchmarkStart(3); - ScreenOptionsThemes := TScreenOptionsThemes.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Themes', 3); Log.BenchmarkStart(3); - ScreenOptionsRecord := TScreenOptionsRecord.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Record', 3); Log.BenchmarkStart(3); - ScreenOptionsAdvanced := TScreenOptionsAdvanced.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Advanced', 3); Log.BenchmarkStart(3); - ScreenEditSub := TScreenEditSub.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Sub', 3); Log.BenchmarkStart(3); - ScreenEdit := TScreenEdit.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit', 3); Log.BenchmarkStart(3); - ScreenEditConvert := TScreenEditConvert.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen EditConvert', 3); Log.BenchmarkStart(3); -// ScreenEditHeader := TScreenEditHeader.Create(Skin.ScoreBG); -// Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Header', 3); Log.BenchmarkStart(3); - ScreenOpen := TScreenOpen.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Open', 3); Log.BenchmarkStart(3); - ScreenSingModi := TScreenSingModi.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing with Modi support', 3); Log.BenchmarkStart(3); - ScreenSongMenu := TScreenSongMenu.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongMenu', 3); Log.BenchmarkStart(3); - ScreenSongJumpto := TScreenSongJumpto.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongJumpto', 3); Log.BenchmarkStart(3); - ScreenPopupCheck := TScreenPopupCheck.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Popup (Check)', 3); Log.BenchmarkStart(3); - ScreenPopupError := TScreenPopupError.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Popup (Error)', 3); Log.BenchmarkStart(3); - ScreenPartyNewRound := TScreenPartyNewRound.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyNewRound', 3); Log.BenchmarkStart(3); - ScreenPartyScore := TScreenPartyScore.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyScore', 3); Log.BenchmarkStart(3); - ScreenPartyWin := TScreenPartyWin.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyWin', 3); Log.BenchmarkStart(3); - ScreenPartyOptions := TScreenPartyOptions.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyOptions', 3); Log.BenchmarkStart(3); - ScreenPartyPlayer := TScreenPartyPlayer.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyPlayer', 3); Log.BenchmarkStart(3); - ScreenStatMain := TScreenStatMain.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Main', 3); Log.BenchmarkStart(3); - ScreenStatDetail := TScreenStatDetail.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Detail', 3); Log.BenchmarkStart(3); - ScreenCredits := TScreenCredits.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Credits', 3); Log.BenchmarkStart(3); - -end; - -function LoadingThreadFunction: integer; -begin - LoadScreens; - Result:= 1; -end; - -procedure UnLoadScreens; -begin - freeandnil( ScreenMain ); - freeandnil( ScreenName ); - freeandnil( ScreenLevel); - freeandnil( ScreenSong ); - freeandnil( ScreenSongMenu ); - freeandnil( ScreenSing ); - freeandnil( ScreenScore); - freeandnil( ScreenTop5 ); - freeandnil( ScreenOptions ); - freeandnil( ScreenOptionsGame ); - freeandnil( ScreenOptionsGraphics ); - freeandnil( ScreenOptionsSound ); - freeandnil( ScreenOptionsLyrics ); -// freeandnil( ScreenOptionsThemes ); - freeandnil( ScreenOptionsRecord ); - freeandnil( ScreenOptionsAdvanced ); - freeandnil( ScreenEditSub ); - freeandnil( ScreenEdit ); - freeandnil( ScreenEditConvert ); - freeandnil( ScreenOpen ); - freeandnil( ScreenSingModi ); - freeandnil( ScreenSongMenu ); - freeandnil( ScreenSongJumpto); - freeandnil( ScreenPopupCheck ); - freeandnil( ScreenPopupError ); - freeandnil( ScreenPartyNewRound ); - freeandnil( ScreenPartyScore ); - freeandnil( ScreenPartyWin ); - freeandnil( ScreenPartyOptions ); - freeandnil( ScreenPartyPlayer ); - freeandnil( ScreenStatMain ); - freeandnil( ScreenStatDetail ); -end; - -end. +unit UGraphic; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + SDL, + OpenGL12, + UTexture, + TextGL, + ULog, + SysUtils, + ULyrics, + UScreenLoading, + UScreenWelcome, + UScreenMain, + UScreenName, + UScreenLevel, + UScreenOptions, + UScreenOptionsGame, + UScreenOptionsGraphics, + UScreenOptionsSound, + UScreenOptionsLyrics, + UScreenOptionsThemes, + UScreenOptionsRecord, + UScreenOptionsAdvanced, + UScreenSong, + UScreenSing, + UScreenScore, + UScreenTop5, + UScreenEditSub, + UScreenEdit, + UScreenEditConvert, + UScreenEditHeader, + UScreenOpen, + UThemes, + USkins, + UScreenSongMenu, + UScreenSongJumpto, + {Party Screens} + UScreenSingModi, + UScreenPartyNewRound, + UScreenPartyScore, + UScreenPartyOptions, + UScreenPartyWin, + UScreenPartyPlayer, + {Stats Screens} + UScreenStatMain, + UScreenStatDetail, + {CreditsScreen} + UScreenCredits, + {Popup for errors, etc.} + UScreenPopup; + +type + TRecR = record + Top: real; + Left: real; + Right: real; + Bottom: real; + end; + +var + Screen: PSDL_Surface; + LoadingThread: PSDL_Thread; + Mutex: PSDL_Mutex; + + RenderW: integer; + RenderH: integer; + ScreenW: integer; + ScreenH: integer; + Screens: integer; + ScreenAct: integer; + ScreenX: integer; + + ScreenLoading: TScreenLoading; + ScreenWelcome: TScreenWelcome; + ScreenMain: TScreenMain; + ScreenName: TScreenName; + ScreenLevel: TScreenLevel; + ScreenSong: TScreenSong; + ScreenSing: TScreenSing; + ScreenScore: TScreenScore; + ScreenTop5: TScreenTop5; + ScreenOptions: TScreenOptions; + ScreenOptionsGame: TScreenOptionsGame; + ScreenOptionsGraphics: TScreenOptionsGraphics; + ScreenOptionsSound: TScreenOptionsSound; + ScreenOptionsLyrics: TScreenOptionsLyrics; + ScreenOptionsThemes: TScreenOptionsThemes; + ScreenOptionsRecord: TScreenOptionsRecord; + ScreenOptionsAdvanced: TScreenOptionsAdvanced; + ScreenEditSub: TScreenEditSub; + ScreenEdit: TScreenEdit; + ScreenEditConvert: TScreenEditConvert; + ScreenEditHeader: TScreenEditHeader; + ScreenOpen: TScreenOpen; + + ScreenSongMenu: TScreenSongMenu; + ScreenSongJumpto: TScreenSongJumpto; + + //Party Screens + ScreenSingModi: TScreenSingModi; + ScreenPartyNewRound: TScreenPartyNewRound; + ScreenPartyScore: TScreenPartyScore; + ScreenPartyWin: TScreenPartyWin; + ScreenPartyOptions: TScreenPartyOptions; + ScreenPartyPlayer: TScreenPartyPlayer; + + //StatsScreens + ScreenStatMain: TScreenStatMain; + ScreenStatDetail: TScreenStatDetail; + + //CreditsScreen + ScreenCredits: TScreenCredits; + + //popup mod + ScreenPopupCheck: TScreenPopupCheck; + ScreenPopupError: TScreenPopupError; + + //Notes + Tex_Left: array[0..6] of TTexture; //rename to tex_note_left + Tex_Mid: array[0..6] of TTexture; //rename to tex_note_mid + Tex_Right: array[0..6] of TTexture; //rename to tex_note_right + + Tex_plain_Left: array[1..6] of TTexture; //rename to tex_notebg_left + Tex_plain_Mid: array[1..6] of TTexture; //rename to tex_notebg_mid + Tex_plain_Right: array[1..6] of TTexture; //rename to tex_notebg_right + + Tex_BG_Left: array[1..6] of TTexture; //rename to tex_noteglow_left + Tex_BG_Mid: array[1..6] of TTexture; //rename to tex_noteglow_mid + Tex_BG_Right: array[1..6] of TTexture; //rename to tex_noteglow_right + + Tex_Note_Star: TTexture; + Tex_Note_Perfect_Star: TTexture; + + + Tex_Ball: TTexture; + Tex_Lyric_Help_Bar: TTexture; + FullScreen: boolean; + + Tex_TimeProgress: TTexture; + + //Sing Bar Mod + Tex_SingBar_Back: TTexture; + Tex_SingBar_Bar: TTexture; + Tex_SingBar_Front: TTexture; + //end Singbar Mod + + //PhrasenBonus - Line Bonus Mod + Tex_SingLineBonusBack: array[0..8] of TTexture; + //End PhrasenBonus - Line Bonus Mod + + //ScoreBG Texs + Tex_ScoreBG: array [0..5] of TTexture; + + //Score Screen Textures + Tex_Score_NoteBarLevel_Dark : array [1..6] of TTexture; + Tex_Score_NoteBarRound_Dark : array [1..6] of TTexture; + + Tex_Score_NoteBarLevel_Light : array [1..6] of TTexture; + Tex_Score_NoteBarRound_Light : array [1..6] of TTexture; + + Tex_Score_NoteBarLevel_Lightest : array [1..6] of TTexture; + Tex_Score_NoteBarRound_Lightest : array [1..6] of TTexture; + + Tex_Score_Ratings : array [0..6] of TTexture; + +const + Skin_BGColorR = 1; + Skin_BGColorG = 1; + Skin_BGColorB = 1; + + Skin_SpectrumR = 0; + Skin_SpectrumG = 0; + Skin_SpectrumB = 0; + + Skin_Spectograph1R = 0.6; + Skin_Spectograph1G = 0.8; + Skin_Spectograph1B = 1; + + Skin_Spectograph2R = 0; + Skin_Spectograph2G = 0; + Skin_Spectograph2B = 0.2; + + Skin_SzczytR = 0.8; + Skin_SzczytG = 0; + Skin_SzczytB = 0; + + Skin_SzczytLimitR = 0; + Skin_SzczytLimitG = 0.8; + Skin_SzczytLimitB = 0; + + Skin_FontR = 0; + Skin_FontG = 0; + Skin_FontB = 0; + + Skin_FontHighlightR = 0.3; // 0.3 + Skin_FontHighlightG = 0.3; // 0.3 + Skin_FontHighlightB = 1; // 1 + + Skin_TimeR = 0.25; //0,0,0 + Skin_TimeG = 0.25; + Skin_TimeB = 0.25; + + Skin_OscR = 0; + Skin_OscG = 0; + Skin_OscB = 0; + + Skin_LyricsT = 494; // 500 / 510 / 400 + Skin_SpectrumT = 470; + Skin_SpectrumBot = 570; + Skin_SpectrumH = 100; + + Skin_P1_LinesR = 0.5; // 0.6 0.6 1 + Skin_P1_LinesG = 0.5; + Skin_P1_LinesB = 0.5; + + Skin_P2_LinesR = 0.5; // 1 0.6 0.6 + Skin_P2_LinesG = 0.5; + Skin_P2_LinesB = 0.5; + + Skin_P1_NotesB = 250; + Skin_P2_NotesB = 430; // 430 / 300 + + Skin_P1_ScoreT = 50; + Skin_P1_ScoreL = 20; + + Skin_P2_ScoreT = 50; + Skin_P2_ScoreL = 640; + +procedure Initialize3D (Title: string); +procedure Reinitialize3D; +procedure SwapBuffers; + +procedure LoadTextures; +procedure InitializeScreen; +procedure LoadLoadingScreen; +procedure LoadScreens; +procedure UnLoadScreens; + +function LoadingThreadFunction: integer; + + +implementation + +uses UMain, + UIni, + UDisplay, + UCommandLine, + {$IFNDEF FPC} + Graphics, + {$ENDIF} + {$IFDEF win32} + windows, + {$ENDIF} + Classes; + +procedure LoadFontTextures; +begin + Log.LogStatus('Building Fonts', 'LoadTextures'); + BuildFont; +end; + +procedure LoadTextures; + + +var + P: integer; + R, G, B: real; + Col: integer; +begin + // zaladowanie tekstur + Log.LogStatus('Loading Textures', 'LoadTextures'); + + Tex_Left[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'BMP', 'Transparent', 0); //brauch man die noch? + Tex_Mid[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'BMP', 'Plain', 0); //brauch man die noch? + Tex_Right[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'BMP', 'Transparent', 0); //brauch man die noch? + + Log.LogStatus('Loading Textures - A', 'LoadTextures'); + + // P1-6 + // TODO... do it once for each player... this is a bit crappy !! + // can we make it any better !? + for P := 1 to 6 do + begin + LoadColor(R, G, B, 'P' + IntToStr(P) + 'Light'); + Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + + Tex_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'PNG', 'Colorized', Col); + Tex_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'PNG', 'Colorized', Col); + Tex_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'PNG', 'Colorized', Col); + + Tex_plain_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainLeft')), 'PNG', 'Colorized', Col); + Tex_plain_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainMid')), 'PNG', 'Colorized', Col); + Tex_plain_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainRight')), 'PNG', 'Colorized', Col); + + Tex_BG_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGLeft')), 'PNG', 'Colorized', Col); + Tex_BG_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGMid')), 'PNG', 'Colorized', Col); + Tex_BG_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGRight')), 'PNG', 'Colorized', Col); + end; + + Log.LogStatus('Loading Textures - B', 'LoadTextures'); + + Tex_Note_Perfect_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePerfectStar')), 'PNG', 'Transparent', 0); + Tex_Note_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteStar')) , 'PNG', 'Transparent', $FFFFFF); + Tex_Ball := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'BMP', 'Transparent', $FF00FF); + Tex_Lyric_Help_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricHelpBar')), 'BMP', 'Transparent', $FF00FF); + + + //TimeBar mod + Tex_TimeProgress := Texture.LoadTexture(pchar(Skin.GetTextureFileName('TimeBar'))); + //eoa TimeBar mod + + //SingBar Mod + Tex_SingBar_Back := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBack')), 'JPG', 'Plain', 0); + Tex_SingBar_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBar')), 'JPG', 'Plain', 0); + Tex_SingBar_Front := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarFront')), 'JPG', 'Font', 0); + //end Singbar Mod + + Log.LogStatus('Loading Textures - C', 'LoadTextures'); + + //Line Bonus PopUp + for P := 0 to 8 do + begin + Case P of + 0: begin + R := 1; + G := 0; + B := 0; + end; + 1..3: begin + R := 1; + G := (P * 0.25); + B := 0; + end; + 4: begin + R := 1; + G := 1; + B := 0; + end; + 5..7: begin + R := 1-((P-4)*0.25); + G := 1; + B := 0; + end; + 8: begin + R := 0; + G := 1; + B := 0; + end; + End; + + Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + Tex_SingLineBonusBack[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LineBonusBack')), 'PNG', 'Colorized', Col); + end; + +//## backgrounds for the scores ## + for P := 0 to 5 do begin + LoadColor(R, G, B, 'P' + IntToStr(P+1) + 'Light'); + Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + Tex_ScoreBG[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreBG')), 'PNG', 'Colorized', Col); + end; + + + Log.LogStatus('Loading Textures - D', 'LoadTextures'); + +// ###################### +// Score screen textures +// ###################### + +//## the bars that visualize the score ## + for P := 1 to 6 do begin +//NoteBar ScoreBar + LoadColor(R, G, B, 'P' + IntToStr(P) + 'Dark'); + Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + Tex_Score_NoteBarLevel_Dark[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Dark')), 'PNG', 'Colorized', Col); + Tex_Score_NoteBarRound_Dark[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Dark_Round')), 'PNG', 'Colorized', Col); +//LineBonus ScoreBar + LoadColor(R, G, B, 'P' + IntToStr(P) + 'Light'); + Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + Tex_Score_NoteBarLevel_Light[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Light')), 'PNG', 'Colorized', Col); + Tex_Score_NoteBarRound_Light[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Light_Round')), 'PNG', 'Colorized', Col); +//GoldenNotes ScoreBar + LoadColor(R, G, B, 'P' + IntToStr(P) + 'Lightest'); + Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + Tex_Score_NoteBarLevel_Lightest[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Lightest')), 'PNG', 'Colorized', Col); + Tex_Score_NoteBarRound_Lightest[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Lightest_Round')), 'PNG', 'Colorized', Col); + end; + +//## rating pictures that show a picture according to your rate ## + for P := 0 to 6 do begin + Tex_Score_Ratings[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Rating_'+IntToStr(P))), 'PNG', 'Transparent', 0); + end; + + Log.LogStatus('Loading Textures - Done', 'LoadTextures'); +end; + +procedure Initialize3D (Title: string); +var +// Icon: TIcon; +// Res: TResourceStream; + ISurface: PSDL_Surface; + Pixel: PByteArray; + I: Integer; +begin + Log.LogStatus('LoadOpenGL', 'UGraphic.Initialize3D'); +// Log.BenchmarkStart(2); + + LoadOpenGL; + + Log.LogStatus('SDL_Init', 'UGraphic.Initialize3D'); + if ( SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO)= -1 ) then + begin + Log.LogError('SDL_Init Failed', 'UGraphic.Initialize3D'); + exit; + end; + + { //Load Icon + Res := TResourceStream.CreateFromID(HInstance, 3, RT_ICON); + Icon := TIcon.Create; + Icon.LoadFromStream(Res); + Res.Free; + Icon. + //Create icon Surface + SDL_CreateRGBSurfaceFrom ( + SDL_SWSURFACE, + Icon.Width, + Icon.Height, + 32, + 128 or 64, + 32 or 16, + 8 or 4, + 2 or 1); + //SDL_BlitSurface( + + + SDL_WM_SetIcon(SDL_LoadBMP('DEFAULT_WINDOW_ICON'), 0); //} + + SDL_WM_SetCaption(PChar(Title), nil); + + InitializeScreen; + +// Log.BenchmarkEnd(2); +// Log.LogBenchmark('--> Setting Screen', 2); + + // ladowanie tekstur +// Log.BenchmarkStart(2); + Texture := TTextureUnit.Create; + Texture.Limit := 1024*1024; + +// LoadTextures; +// Log.BenchmarkEnd(2); +// Log.LogBenchmark('--> Loading Textures', 2); + +{ Log.BenchmarkStart(2); + Lyric:= TLyric.Create; + Log.BenchmarkEnd(2); + Log.LogBenchmark('--> Loading Fonts', 2); +} + +// Log.BenchmarkStart(2); + + Log.LogStatus('TDisplay.Create', 'UGraphic.Initialize3D'); + Display := TDisplay.Create; + + Log.LogStatus('SDL_EnableUnicode', 'UGraphic.Initialize3D'); + SDL_EnableUnicode(1); +// Log.BenchmarkEnd(2); Log.LogBenchmark('====> Creating Display', 2); + +// Log.LogStatus('Loading Screens', 'Initialize3D'); +// Log.BenchmarkStart(3); + + Log.LogStatus('Loading Font Textures', 'UGraphic.Initialize3D'); + LoadFontTextures(); + + // Show the Loading Screen ------------- + Log.LogStatus('Loading Loading Screen', 'UGraphic.Initialize3D'); + LoadLoadingScreen; + + + Log.LogStatus(' Loading Textures', 'UGraphic.Initialize3D'); + LoadTextures; // jb + + + + // now that we have something to display while loading, + // start thread that loads the rest of ultrastar +// Mutex := SDL_CreateMutex; +// SDL_UnLockMutex(Mutex); + + // funktioniert so noch nicht, da der ladethread unverändert auf opengl zugreifen will + // siehe dazu kommentar unten + //LoadingThread := SDL_CreateThread(@LoadingThread, nil); + + // das hier würde dann im ladethread ausgeführt + Log.LogStatus(' Loading Screens', 'UGraphic.Initialize3D'); + LoadScreens; + + + // TODO!!!!!!1 + // hier käme jetzt eine schleife, die + // * den ladescreen malt (ab und zu) + // * den "fortschritt" des ladescreens steuert + // * zwischendrin schaut, ob der ladethread texturen geladen hat (mutex prüfen) und + // * die texturen in die opengl lädt, sowie + // * dem ladethread signalisiert, dass der speicher für die textur + // zum laden der nächsten textur weiterverwendet werden kann (über weiteren mutex) + // * über einen 3. mutex so lange läuft, bis der ladethread signalisiert, + // dass er alles geladen hat fertig ist + // + // dafür muss loadtexture so umgeschrieben werden, dass es, statt selbst irgendwelche + // opengl funktionen aufzurufen, entsprechend mutexe verändert + // der hauptthread muss auch irgendwoher erfahren, was an opengl funktionen auszuführen ist, + // mit welchen parametern (texturtyp, entspr. texturobjekt, textur-zwischenspeicher-adresse, ... + + + //wait for loading thread to finish + // funktioniert so auch noch nicht + //SDL_WaitThread(LoadingThread, I); +// SDL_DestroyMutex(Mutex); + + Display.ActualScreen^.FadeTo( @ScreenMain ); + + Log.BenchmarkEnd(2); + Log.LogBenchmark('--> Loading Screens', 2); + + Log.LogStatus('Finish', 'Initialize3D'); +end; + +procedure SwapBuffers; +begin + SDL_GL_SwapBuffers; + glMatrixMode(GL_PROJECTION); + glLoadIdentity; + glOrtho(0, RenderW, RenderH, 0, -1, 100); + glMatrixMode(GL_MODELVIEW); +end; + +procedure Reinitialize3D; +begin +// InitializeScreen; +// LoadTextures; +// LoadScreens; +end; + +procedure InitializeScreen; +var + S: string; + I: integer; + W, H: integer; + Depth: Integer; +begin + if (Params.Screens <> -1) then + Screens := Params.Screens + 1 + else + Screens := Ini.Screens + 1; + + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + + // If there is a resolution in Parameters, use it, else use the Ini value + I := Params.Resolution; + if (I <> -1) then + S := IResolution[I] + else + S := IResolution[Ini.Resolution]; + + I := Pos('x', S); + W := StrToInt(Copy(S, 1, I-1)) * Screens; + H := StrToInt(Copy(S, I+1, 1000)); + + {if ParamStr(1) = '-fsblack' then begin + W := 800; + H := 600; + end; + if ParamStr(1) = '-320x240' then begin + W := 320; + H := 240; + end; } + + If (Params.Depth <> -1) then + Depth := Params.Depth + else + Depth := Ini.Depth; + + + Log.LogStatus('SDL_SetVideoMode', 'Set Window Icon'); + +// Okay it's possible to set the title bar / taskbar icon here +// it's working this way, but just if the bmp is in your exe folder + SDL_WM_SetIcon(SDL_LoadBMP('ustar-icon.bmp'), 0); + + Log.LogStatus('SDL_SetVideoMode', 'Initialize3D'); +// SDL_SetRefreshrate(85); +// SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); + + {$ifndef win32} + // Todo : jb_linux remove this for linux... but helps for debugging + Ini.FullScreen := 0; + W := 800; + H := 600; + {$endif} + + {$IFDEF DARWIN} + // Todo : eddie: remove before realease + Ini.FullScreen := 0; + {$ENDIF} + + if (Ini.FullScreen = 0) and (Not Params.FullScreen) then + begin + Log.LogStatus('SDL_SetVideoMode', 'Set Video Mode... Windowed'); + screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL) + end + else + begin + Log.LogStatus('SDL_SetVideoMode', 'Set Video Mode... Full Screen'); + screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN); + SDL_ShowCursor(0); + end; + + if (screen = nil) then + begin + Log.LogError('SDL_SetVideoMode Failed', 'Initialize3D'); + exit; + end; + + // clear screen once window is being shown + glClearColor(1, 1, 1, 1); + glClear(GL_COLOR_BUFFER_BIT); + SwapBuffers; + + // zmienne + RenderW := 800; + RenderH := 600; + ScreenW := W; + ScreenH := H; +end; + +procedure LoadLoadingScreen; +begin + ScreenLoading := TScreenLoading.Create; + ScreenLoading.onShow; + + Display.ActualScreen := @ScreenLoading; + + swapbuffers; + + ScreenLoading.Draw; + Display.Draw; + + SwapBuffers; +end; + +procedure LoadScreens; +begin +{ ScreenLoading := TScreenLoading.Create; + ScreenLoading.onShow; + Display.ActualScreen := @ScreenLoading; + ScreenLoading.Draw; + Display.Draw; + SwapBuffers; +} + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Loading', 3); Log.BenchmarkStart(3); +{ ScreenWelcome := TScreenWelcome.Create; //'BG', 4, 3); + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Welcome', 3); Log.BenchmarkStart(3);} + ScreenMain := TScreenMain.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Main', 3); Log.BenchmarkStart(3); + ScreenName := TScreenName.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Name', 3); Log.BenchmarkStart(3); + ScreenLevel := TScreenLevel.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Level', 3); Log.BenchmarkStart(3); + ScreenSong := TScreenSong.Create; + 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); + ScreenSing := TScreenSing.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing', 3); Log.BenchmarkStart(3); + ScreenScore := TScreenScore.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Score', 3); Log.BenchmarkStart(3); + ScreenTop5 := TScreenTop5.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Top5', 3); Log.BenchmarkStart(3); + ScreenOptions := TScreenOptions.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options', 3); Log.BenchmarkStart(3); + ScreenOptionsGame := TScreenOptionsGame.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Game', 3); Log.BenchmarkStart(3); + ScreenOptionsGraphics := TScreenOptionsGraphics.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Graphics', 3); Log.BenchmarkStart(3); + ScreenOptionsSound := TScreenOptionsSound.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Sound', 3); Log.BenchmarkStart(3); + ScreenOptionsLyrics := TScreenOptionsLyrics.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Lyrics', 3); Log.BenchmarkStart(3); + ScreenOptionsThemes := TScreenOptionsThemes.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Themes', 3); Log.BenchmarkStart(3); + ScreenOptionsRecord := TScreenOptionsRecord.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Record', 3); Log.BenchmarkStart(3); + ScreenOptionsAdvanced := TScreenOptionsAdvanced.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Options Advanced', 3); Log.BenchmarkStart(3); + ScreenEditSub := TScreenEditSub.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Sub', 3); Log.BenchmarkStart(3); + ScreenEdit := TScreenEdit.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit', 3); Log.BenchmarkStart(3); + ScreenEditConvert := TScreenEditConvert.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen EditConvert', 3); Log.BenchmarkStart(3); +// ScreenEditHeader := TScreenEditHeader.Create(Skin.ScoreBG); +// Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Edit Header', 3); Log.BenchmarkStart(3); + ScreenOpen := TScreenOpen.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Open', 3); Log.BenchmarkStart(3); + ScreenSingModi := TScreenSingModi.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing with Modi support', 3); Log.BenchmarkStart(3); + ScreenSongMenu := TScreenSongMenu.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongMenu', 3); Log.BenchmarkStart(3); + ScreenSongJumpto := TScreenSongJumpto.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongJumpto', 3); Log.BenchmarkStart(3); + ScreenPopupCheck := TScreenPopupCheck.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Popup (Check)', 3); Log.BenchmarkStart(3); + ScreenPopupError := TScreenPopupError.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Popup (Error)', 3); Log.BenchmarkStart(3); + ScreenPartyNewRound := TScreenPartyNewRound.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyNewRound', 3); Log.BenchmarkStart(3); + ScreenPartyScore := TScreenPartyScore.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyScore', 3); Log.BenchmarkStart(3); + ScreenPartyWin := TScreenPartyWin.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyWin', 3); Log.BenchmarkStart(3); + ScreenPartyOptions := TScreenPartyOptions.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyOptions', 3); Log.BenchmarkStart(3); + ScreenPartyPlayer := TScreenPartyPlayer.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyPlayer', 3); Log.BenchmarkStart(3); + ScreenStatMain := TScreenStatMain.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Main', 3); Log.BenchmarkStart(3); + ScreenStatDetail := TScreenStatDetail.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Detail', 3); Log.BenchmarkStart(3); + ScreenCredits := TScreenCredits.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Credits', 3); Log.BenchmarkStart(3); + +end; + +function LoadingThreadFunction: integer; +begin + LoadScreens; + Result:= 1; +end; + +procedure UnLoadScreens; +begin + freeandnil( ScreenMain ); + freeandnil( ScreenName ); + freeandnil( ScreenLevel); + freeandnil( ScreenSong ); + freeandnil( ScreenSongMenu ); + freeandnil( ScreenSing ); + freeandnil( ScreenScore); + freeandnil( ScreenTop5 ); + freeandnil( ScreenOptions ); + freeandnil( ScreenOptionsGame ); + freeandnil( ScreenOptionsGraphics ); + freeandnil( ScreenOptionsSound ); + freeandnil( ScreenOptionsLyrics ); +// freeandnil( ScreenOptionsThemes ); + freeandnil( ScreenOptionsRecord ); + freeandnil( ScreenOptionsAdvanced ); + freeandnil( ScreenEditSub ); + freeandnil( ScreenEdit ); + freeandnil( ScreenEditConvert ); + freeandnil( ScreenOpen ); + freeandnil( ScreenSingModi ); + freeandnil( ScreenSongMenu ); + freeandnil( ScreenSongJumpto); + freeandnil( ScreenPopupCheck ); + freeandnil( ScreenPopupError ); + freeandnil( ScreenPartyNewRound ); + freeandnil( ScreenPartyScore ); + freeandnil( ScreenPartyWin ); + freeandnil( ScreenPartyOptions ); + freeandnil( ScreenPartyPlayer ); + freeandnil( ScreenStatMain ); + freeandnil( ScreenStatDetail ); +end; + +end. -- cgit v1.2.3 From 08ac48400b9cd669ef80c9ed0f1acf57743d6875 Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 27 Dec 2007 12:27:55 +0000 Subject: Added missing return-values (always true) to InitCore and LoadCore. Whiteshark: Please change this to the appropriate values. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@749 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCore.pas | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UCore.pas b/Game/Code/Classes/UCore.pas index c150ff34..9718b2eb 100644 --- a/Game/Code/Classes/UCore.pas +++ b/Game/Code/Classes/UCore.pas @@ -376,6 +376,8 @@ begin //A little Test Hooks.AddSubscriber('Core/NewError', HookTest); + + result := true; end; //------------- @@ -384,6 +386,7 @@ end; Function TCore.InitCore: Boolean; begin //Dont Init s.th. atm. + result := true; end; //------------- -- cgit v1.2.3 From e4c30499349a0cc5b75fce7e59dc0a4abfa0a10e Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 27 Dec 2007 12:31:21 +0000 Subject: FileErrorO is set to true to early. Even if FileError couldn't be opened it will be set to true and hence usdx tries to close and unopened fileerror-stream later which results in a segmentation fault git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@750 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/ULog.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index 01eff5f4..fc567d54 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -163,7 +163,7 @@ end; procedure TLog.LogError(Text: string); begin if Enabled AND (not FileErrorO) then begin - FileErrorO := true; + //FileErrorO := true; AssignFile(FileError, LogPath + 'Error.log'); {$I-} Rewrite(FileError); -- cgit v1.2.3 From e5bdcfc8e584d2867d0ad7995d18bd30c7874d1b Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 28 Dec 2007 11:46:04 +0000 Subject: New class-structure seperates decoders/input and playback. The files aren't used in usdx until they are stable so they will not conflict with the old structure. The older files (UAudio_Bass etc.) will be replaced then. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@752 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudioDecoder_FFMpeg.pas | 600 ++++++++++++++++++++++ Game/Code/Classes/UAudioInput_Bass.pas | 286 +++++++++++ Game/Code/Classes/UAudioInput_Portaudio.pas | 420 ++++++++++++++++ Game/Code/Classes/UAudioPlayback_Bass.pas | 460 +++++++++++++++++ Game/Code/Classes/UAudioPlayback_Portaudio.pas | 664 +++++++++++++++++++++++++ 5 files changed, 2430 insertions(+) create mode 100644 Game/Code/Classes/UAudioDecoder_FFMpeg.pas create mode 100644 Game/Code/Classes/UAudioInput_Bass.pas create mode 100644 Game/Code/Classes/UAudioInput_Portaudio.pas create mode 100644 Game/Code/Classes/UAudioPlayback_Bass.pas create mode 100644 Game/Code/Classes/UAudioPlayback_Portaudio.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudioDecoder_FFMpeg.pas b/Game/Code/Classes/UAudioDecoder_FFMpeg.pas new file mode 100644 index 00000000..54055454 --- /dev/null +++ b/Game/Code/Classes/UAudioDecoder_FFMpeg.pas @@ -0,0 +1,600 @@ +unit UAudioDecoder_FFMpeg; + +(******************************************************************************* + +This unit is primarily based upon - + http://www.dranger.com/ffmpeg/ffmpegtutorial_all.html + + and tutorial03.c + + http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html + +*******************************************************************************) + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +uses Classes, + {$IFDEF win32} + windows, + {$ENDIF} + SysUtils, + SDL, + avcodec, // FFMpeg Audio file decoding + avformat, + avutil, + ULog, + UMusic; + +implementation + +uses + {$IFDEF LAZARUS} + lclintf, + {$ifndef win32} + libc, + {$endif} + {$ENDIF} + UIni, + UMain, + UThemes; + + +type + PPacketQueue = ^TPacketQueue; + TPacketQueue = class + private + firstPkt, + lastPkt : PAVPacketList; + nbPackets : integer; + size : integer; + mutex : PSDL_Mutex; + cond : PSDL_Cond; + quit : boolean; + + public + constructor Create(); + destructor Destroy(); override; + + function Put(pkt : PAVPacket): integer; + function Get(var pkt: TAVPacket; block: boolean): integer; + end; + +var + EOSPacket: TAVPacket; + +type + PAudioBuffer = ^TAudioBuffer; + TAudioBuffer = array[0 .. (AVCODEC_MAX_AUDIO_FRAME_SIZE * 3 div 2)-1] of byte; + +type + TFFMpegDecodeStream = class(TAudioDecodeStream) + private + status: TStreamStatus; + + EOS_Flag: boolean; // end-of-stream flag + + parseThread: PSDL_Thread; + packetQueue: TPacketQueue; + + // FFMpeg internal data + pFormatCtx : PAVFormatContext; + pCodecCtx : PAVCodecContext; + pCodec : PAVCodec; + ffmpegStreamID : Integer; + ffmpegStream : PAVStream; + + // "static" vars for DecodeFrame + pkt : TAVPacket; + audio_pkt_data : PChar; + audio_pkt_size : integer; + + // "static" vars for AudioCallback + audio_buf_index : cardinal; + audio_buf_size : cardinal; + audio_buf : TAudioBuffer; + + function DecodeFrame(var buffer: TAudioBuffer; bufSize: integer): integer; + public + constructor Create(pFormatCtx: PAVFormatContext; + pCodecCtx: PAVCodecContext; pCodec: PAVCodec; + ffmpegStreamID : Integer; ffmpegStream: PAVStream); + destructor Destroy(); override; + + procedure Close(); override; + + function GetLength(): real; override; + function GetChannelCount(): cardinal; override; + function GetSampleRate(): cardinal; override; + function GetPosition: real; override; + procedure SetPosition(Time: real); override; + function IsEOS(): boolean; override; + + function ReadData(Buffer: PChar; BufSize: integer): integer; override; + end; + +type + TAudioDecoder_FFMpeg = class( TInterfacedObject, IAudioDecoder ) + private + class function FindAudioStreamID(pFormatCtx : PAVFormatContext): integer; + public + function GetName: String; + + function InitializeDecoder(): boolean; + function Open(const Filename: string): TAudioDecodeStream; + end; + +function ParseAudio(streamPtr: Pointer): integer; cdecl; forward; + +var + singleton_AudioDecoderFFMpeg : IAudioDecoder; + + +{ TFFMpegDecodeStream } + +constructor TFFMpegDecodeStream.Create(pFormatCtx: PAVFormatContext; + pCodecCtx: PAVCodecContext; pCodec: PAVCodec; + ffmpegStreamID : Integer; ffmpegStream: PAVStream); +begin + inherited Create(); + + status := sStopped; + packetQueue := TPacketQueue.Create(); + + audio_pkt_data := nil; + audio_pkt_size := 0; + + audio_buf_index := 0; + audio_buf_size := 0; + + FillChar(pkt, sizeof(TAVPacket), #0); + + Self.pFormatCtx := pFormatCtx; + Self.pCodecCtx := pCodecCtx; + Self.pCodec := pCodec; + Self.ffmpegStreamID := ffmpegStreamID; + Self.ffmpegStream := ffmpegStream; + + EOS_Flag := false; + + parseThread := SDL_CreateThread(@ParseAudio, Self); +end; + +destructor TFFMpegDecodeStream.Destroy(); +begin + packetQueue.Free(); + //SDL_WaitThread(parseThread, nil); + inherited; +end; + +procedure TFFMpegDecodeStream.Close(); +begin + // Close the codec + avcodec_close(pCodecCtx); + + // Close the video file + av_close_input_file(pFormatCtx); + + // TODO: abort thread +end; + +function TFFMpegDecodeStream.GetLength(): real; +begin + result := pFormatCtx^.duration / AV_TIME_BASE; +end; + +function TFFMpegDecodeStream.GetChannelCount(): cardinal; +begin + result := pCodecCtx^.channels; +end; + +function TFFMpegDecodeStream.GetSampleRate(): cardinal; +begin + result := pCodecCtx^.sample_rate; +end; + +function TFFMpegDecodeStream.IsEOS(): boolean; +begin + result := EOS_Flag; +end; + + +function ParseAudio(streamPtr: Pointer): integer; cdecl; +var + packet: TAVPacket; + stream: TFFMpegDecodeStream; +begin + stream := TFFMpegDecodeStream(streamPtr); + + while (av_read_frame(stream.pFormatCtx, packet) >= 0) do + begin + //writeln( 'ffmpeg - av_read_frame' ); + + if (packet.stream_index = stream.ffmpegStreamID) then + begin + //writeln( 'packet_queue_put' ); + stream.packetQueue.put(@packet); + end + else + begin + av_free_packet(packet); + end; + end; + + //Writeln('Done: ' + inttostr(stream.packetQueue.nbPackets)); + + // signal end-of-stream + stream.packetQueue.put(@EOSPacket); + + result := 0; +end; + +function TFFMpegDecodeStream.DecodeFrame(var buffer: TAudioBuffer; bufSize: integer): integer; +var + len1, + data_size: integer; +begin + result := -1; + + if (EOS_Flag) then + exit; + + while true do + begin + while (audio_pkt_size > 0) do + begin + //writeln( 'got audio packet' ); + data_size := bufSize; + + // TODO: should be avcodec_decode_audio2 but this wont link on my ubuntu box. + len1 := avcodec_decode_audio(pCodecCtx, @buffer, + data_size, audio_pkt_data, audio_pkt_size); + + //writeln('avcodec_decode_audio : ' + inttostr( len1 )); + + if(len1 < 0) then + begin + // if error, skip frame + //writeln( 'Skip audio frame' ); + audio_pkt_size := 0; + break; + end; + + Inc(audio_pkt_data, len1); + Dec(audio_pkt_size, len1); + + if (data_size <= 0) then + begin + // No data yet, get more frames + continue; + end; + + // We have data, return it and come back for more later + result := data_size; + exit; + end; + + if (pkt.data <> nil) then + begin + av_free_packet(pkt); + end; + + if (packetQueue.quit) then + exit; + + if (packetQueue.Get(pkt, true) < 0) then + exit; + + audio_pkt_data := PChar(pkt.data); + audio_pkt_size := pkt.size; + + // check for end-of-stream + if (audio_pkt_data = PChar(EOSPacket.data)) then + begin + // end-of-stream reached -> set EOS-flag + EOS_Flag := true; + // note: buffer is not (even partially) filled -> no data to return + exit; + end; + + //writeln( 'Audio Packet Size - ' + inttostr(audio_pkt_size) ); + end; +end; + +function TFFMpegDecodeStream.ReadData(Buffer : PChar; BufSize: integer): integer; +var + outStream : TFFMpegDecodeStream; + len1, + audio_size : integer; + pSrc : Pointer; + len : integer; +begin + len := BufSize; + + // end-of-stream reached + if (EOS_Flag) then + exit; + + while (len > 0) do begin + if (audio_buf_index >= audio_buf_size) then + begin + // We have already sent all our data; get more + audio_size := DecodeFrame(audio_buf, sizeof(TAudioBuffer)); + //writeln('audio_decode_frame : '+ inttostr(audio_size)); + + if(audio_size < 0) then + begin + // If error, output silence + audio_buf_size := 1024; + FillChar(audio_buf, audio_buf_size, #0); + //writeln( 'Silence' ); + end + else + begin + audio_buf_size := audio_size; + end; + audio_buf_index := 0; + end; + + len1 := audio_buf_size - audio_buf_index; + if (len1 > len) then + len1 := len; + + pSrc := PChar(@audio_buf) + audio_buf_index; + {$ifdef WIN32} + CopyMemory(Buffer, pSrc , len1); + {$else} + memcpy(Buffer, pSrc , len1); + {$endif} + + Dec(len, len1); + Inc(PChar(Buffer), len1); + Inc(audio_buf_index, len1); + end; + + result := BufSize; +end; + +function TFFMpegDecodeStream.GetPosition(): real; +var + bytes: integer; +begin + Result := 0; +end; + +procedure TFFMpegDecodeStream.SetPosition(Time: real); +var + bytes: integer; +begin +end; + + +{ TAudioDecoder_FFMpeg } + +function TAudioDecoder_FFMpeg.GetName: String; +begin + result := 'FFMpeg_Decoder'; +end; + +function TAudioDecoder_FFMpeg.InitializeDecoder: boolean; +begin + //Log.LogStatus('InitializeDecoder', 'UAudioDecoder_FFMpeg'); + + av_register_all(); + + // init end-of-stream package + av_init_packet(EOSPacket); + EOSPacket.data := Pointer(PChar('EOS')); + + result := true; +end; + +class function TAudioDecoder_FFMpeg.FindAudioStreamID(pFormatCtx : PAVFormatContext): integer; +var + i : integer; + streamID: integer; + stream : PAVStream; +begin + // Find the first audio stream + streamID := -1; + + for i := 0 to pFormatCtx^.nb_streams-1 do + begin + //Log.LogStatus('aFormatCtx.streams[i] : ' + inttostr(i), 'UAudio_FFMpeg'); + stream := pFormatCtx^.streams[i]; + + if ( stream.codec^.codec_type = CODEC_TYPE_AUDIO ) then + begin + //Log.LogStatus('Found Audio Stream', 'UAudio_FFMpeg'); + streamID := i; + break; + end; + end; + + result := streamID; +end; + +function TAudioDecoder_FFMpeg.Open(const Filename: string): TAudioDecodeStream; +var + pFormatCtx : PAVFormatContext; + pCodecCtx : PAVCodecContext; + pCodec : PAVCodec; + ffmpegStreamID : Integer; + ffmpegStream : PAVStream; + wanted_spec, + csIndex : integer; + stream : TFFMpegDecodeStream; +begin + result := nil; + + if (not FileExists(Filename)) then + begin + Log.LogStatus('LoadSoundFromFile: Sound not found "' + Filename + '"', 'UAudio_FFMpeg'); + exit; + end; + + // Open audio file + if (av_open_input_file(pFormatCtx, PChar(Filename), nil, 0, nil) > 0) then + exit; + + // Retrieve stream information + if (av_find_stream_info(pFormatCtx) < 0) then + exit; + + dump_format(pFormatCtx, 0, pchar(Filename), 0); + + ffmpegStreamID := FindAudioStreamID(pFormatCtx); + if (ffmpegStreamID < 0) then + exit; + + //Log.LogStatus('Audio Stream ID is : '+ inttostr(ffmpegStreamID), 'UAudio_FFMpeg'); + + ffmpegStream := pFormatCtx.streams[ffmpegStreamID]; + pCodecCtx := ffmpegStream^.codec; + + pCodec := avcodec_find_decoder(pCodecCtx^.codec_id); + if (pCodec = nil) then + begin + Log.LogStatus('Unsupported codec!', 'UAudio_FFMpeg'); + exit; + end; + + avcodec_open(pCodecCtx, pCodec); + //writeln( 'Opened the codec' ); + + stream := TFFMpegDecodeStream.Create(pFormatCtx, pCodecCtx, pCodec, + ffmpegStreamID, ffmpegStream); + + result := stream; +end; + + +{ TPacketQueue } + +constructor TPacketQueue.Create(); +begin + inherited; + + firstPkt := nil; + lastPkt := nil; + nbPackets := 0; + size := 0; + + mutex := SDL_CreateMutex(); + cond := SDL_CreateCond(); +end; + +destructor TPacketQueue.Destroy(); +begin + SDL_DestroyMutex(mutex); + SDL_DestroyCond(cond); + inherited; +end; + +function TPacketQueue.Put(pkt : PAVPacket): integer; +var + pkt1 : PAVPacketList; +begin + result := -1; + + if (pkt <> @EOSPacket) then + if (av_dup_packet(pkt) < 0) then + exit; + + pkt1 := av_malloc(sizeof(TAVPacketList)); + if (pkt1 = nil) then + exit; + + pkt1^.pkt := pkt^; + pkt1^.next := nil; + + + SDL_LockMutex(Self.mutex); + try + + if (Self.lastPkt = nil) then + Self.firstPkt := pkt1 + else + Self.lastPkt^.next := pkt1; + + Self.lastPkt := pkt1; + inc(Self.nbPackets); + + //Writeln('Put: ' + inttostr(nbPackets)); + + Self.size := Self.size + pkt1^.pkt.size; + SDL_CondSignal(Self.cond); + + finally + SDL_UnlockMutex(Self.mutex); + end; + + result := 0; +end; + +function TPacketQueue.Get(var pkt: TAVPacket; block: boolean): integer; +var + pkt1 : PAVPacketList; +begin + result := -1; + + SDL_LockMutex(Self.mutex); + try + while true do + begin + if (quit) then + exit; + + pkt1 := Self.firstPkt; + + if (pkt1 <> nil) then + begin + Self.firstPkt := pkt1.next; + if (Self.firstPkt = nil) then + Self.lastPkt := nil; + dec(Self.nbPackets); + + //Writeln('Get: ' + inttostr(nbPackets)); + + Self.size := Self.size - pkt1^.pkt.size; + pkt := pkt1^.pkt; + av_free(pkt1); + + result := 1; + break; + end + else + if (not block) then + begin + result := 0; + break; + end + else + begin + SDL_CondWait(Self.cond, Self.mutex); + end; + end; + finally + SDL_UnlockMutex(Self.mutex); + end; +end; + + + +initialization + singleton_AudioDecoderFFMpeg := TAudioDecoder_FFMpeg.create(); + + //writeln( 'UAudioDecoder_FFMpeg - Register Decoder' ); + AudioManager.add( singleton_AudioDecoderFFMpeg ); + +finalization + AudioManager.Remove( singleton_AudioDecoderFFMpeg ); + + +end. diff --git a/Game/Code/Classes/UAudioInput_Bass.pas b/Game/Code/Classes/UAudioInput_Bass.pas new file mode 100644 index 00000000..9807ffc3 --- /dev/null +++ b/Game/Code/Classes/UAudioInput_Bass.pas @@ -0,0 +1,286 @@ +unit UAudioInput_Bass; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +uses Classes, + {$IFDEF win32} + windows, + {$ENDIF} + SysUtils, + bass, + ULog, + UMusic; + +implementation + +uses + {$IFDEF LAZARUS} + lclintf, + {$ENDIF} + URecord, + UIni, + UMain, + UCommon, + UThemes; + +type + TAudioInput_Bass = class( TInterfacedObject, IAudioInput) + private + public + function GetName: String; + + {IAudioInput interface} + procedure InitializeRecord; + + procedure CaptureStart; + procedure CaptureStop; + procedure CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); + procedure StopCard(Card: byte); + end; + + TBassSoundCard = class(TGenericSoundCard) + RecordStream: HSTREAM; + end; + +var + singleton_AudioInputBass : IAudioInput; + + +function TAudioInput_Bass.GetName: String; +begin + result := 'BASS_Input'; +end; + +procedure TAudioInput_Bass.InitializeRecord; +var + device: integer; + Descr: string; + input: integer; + input2: integer; + InputName: PChar; + Flags: integer; + mic: array[0..15] of integer; + SC: integer; // soundcard + SCI: integer; // soundcard input + No: integer; + +function isDuplicate(Desc: String): Boolean; +var + I: Integer; +begin + Result := False; + //Check for Soundcard with same Description + For I := 0 to SC-1 do + begin + if (Recording.SoundCard[I].Description = Desc) then + begin + Result := True; + Break; + end; + end; +end; + +begin + with Recording do + begin + // checks for recording devices and puts them into an array + SetLength(SoundCard, 0); + + SC := 0; + Descr := BASS_RecordGetDeviceDescription(SC); + + while (Descr <> '') do + begin + //If there is another SoundCard with the Same ID, Search an available Name + if (IsDuplicate(Descr)) then + begin + No:= 1; //Count of SoundCards with same Name + Repeat + Inc(No) + Until not IsDuplicate(Descr + ' (' + InttoStr(No) + ')'); + + //Set Description + Descr := Descr + ' (' + InttoStr(No) + ')'; + end; + + SetLength(SoundCard, SC+1); + + // TODO: free object on termination + SoundCard[SC] := TBassSoundCard.Create(); + SoundCard[SC].Description := Descr; + + //Get Recording Inputs + SCI := 0; + BASS_RecordInit(SC); + + InputName := BASS_RecordGetInputName(SCI); + + {$IFDEF DARWIN} + // Under MacOSX the SingStar Mics have an empty + // InputName. So, we have to add a hard coded + // Workaround for this problem + if (InputName = nil) and (Pos( 'USBMIC Serial#', Descr) > 0) then + begin + InputName := 'Microphone'; + end; + {$ENDIF} + + SetLength(SoundCard[SC].Input, 1); + SoundCard[SC].Input[SCI].Name := InputName; + + // process each input + while (InputName <> nil) do + begin + Flags := BASS_RecordGetInput(SCI); + if (SCI >= 1) {AND (Flags AND BASS_INPUT_OFF = 0)} then + begin + SetLength(SoundCard[SC].Input, SCI+1); + SoundCard[SC].Input[SCI].Name := InputName; + end; + + //Set Mic Index + if ((Flags and BASS_INPUT_TYPE_MIC) = 1) then + SoundCard[SC].MicInput := SCI; + + Inc(SCI); + InputName := BASS_RecordGetInputName(SCI); + end; + + BASS_RecordFree; + + Inc(SC); + Descr := BASS_RecordGetDeviceDescription(SC); + end; // while + end; // with Recording +end; + +// TODO: code is used by all IAudioInput implementors +// -> move to a common superclass (TAudioInput_Generic?) +procedure TAudioInput_Bass.CaptureStart; +var + S: integer; + SC: integer; + PlayerLeft, PlayerRight: integer; + CaptureSoundLeft, CaptureSoundRight: TSound; +begin + for S := 0 to High(Recording.Sound) do + Recording.Sound[S].BufferLong[0].Clear; + + for SC := 0 to High(Ini.CardList) do begin + PlayerLeft := Ini.CardList[SC].ChannelL-1; + PlayerRight := Ini.CardList[SC].ChannelR-1; + if PlayerLeft >= PlayersPlay then PlayerLeft := -1; + if PlayerRight >= PlayersPlay then PlayerRight := -1; + if (PlayerLeft > -1) or (PlayerRight > -1) then begin + if (PlayerLeft > -1) then + CaptureSoundLeft := Recording.Sound[PlayerLeft] + else + CaptureSoundLeft := nil; + if (PlayerRight > -1) then + CaptureSoundRight := Recording.Sound[PlayerRight] + else + CaptureSoundRight := nil; + + CaptureCard(SC, CaptureSoundLeft, CaptureSoundRight); + end; + end; +end; + +// TODO: code is used by all IAudioInput implementors +// -> move to a common superclass (TAudioInput_Generic?) +procedure TAudioInput_Bass.CaptureStop; +var + SC: integer; + PlayerLeft: integer; + PlayerRight: integer; +begin + + for SC := 0 to High(Ini.CardList) do begin + PlayerLeft := Ini.CardList[SC].ChannelL-1; + PlayerRight := Ini.CardList[SC].ChannelR-1; + if PlayerLeft >= PlayersPlay then PlayerLeft := -1; + if PlayerRight >= PlayersPlay then PlayerRight := -1; + if (PlayerLeft > -1) or (PlayerRight > -1) then + StopCard(SC); + end; + +end; + +{* + * Bass input capture callback. + * Params: + * stream - BASS input stream + * buffer - buffer of captured samples + * len - size of buffer in bytes + * user - players associated with left/right channels + *} +function MicrophoneCallback(stream: HSTREAM; buffer: Pointer; + len: Cardinal; Card: Cardinal): boolean; stdcall; +begin + Recording.HandleMicrophoneData(buffer, len, Recording.SoundCard[Card]); + Result := true; +end; + +{* + * Start input-capturing on Soundcard specified by Card. + * Params: + * Card - soundcard index in Recording.SoundCard array + * CaptureSoundLeft - sound(-buffer) used for left channel capture data + * CaptureSoundRight - sound(-buffer) used for right channel capture data + *} +procedure TAudioInput_Bass.CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); +var + Error: integer; + ErrorMsg: string; + bassSoundCard: TBassSoundCard; +begin + if not BASS_RecordInit(Card) then + begin + Error := BASS_ErrorGetCode; + ErrorMsg := IntToStr(Error); + if Error = BASS_ERROR_DX then ErrorMsg := 'No DX5'; + if Error = BASS_ERROR_ALREADY then ErrorMsg := 'The device has already been initialized'; + if Error = BASS_ERROR_DEVICE then ErrorMsg := 'The device number specified is invalid'; + if Error = BASS_ERROR_DRIVER then ErrorMsg := 'There is no available device driver'; + Log.LogError('Error initializing record [' + IntToStr(Card) + ']'); + Log.LogError('TAudio_bass.CaptureCard: Error initializing record: ' + ErrorMsg); + end + else + begin + bassSoundCard := TBassSoundCard(Recording.SoundCard[Card]); + bassSoundCard.CaptureSoundLeft := CaptureSoundLeft; + bassSoundCard.CaptureSoundRight := CaptureSoundRight; + + // capture in 44.1kHz/stereo/16bit and a 20ms callback period + bassSoundCard.RecordStream := + BASS_RecordStart(44100, 2, MakeLong(0, 20) , @MicrophoneCallback, Card); + end; +end; + +{* + * Stop input-capturing on Soundcard specified by Card. + * Params: + * Card - soundcard index in Recording.SoundCard array + *} +procedure TAudioInput_Bass.StopCard(Card: byte); +begin + BASS_RecordSetDevice(Card); + BASS_RecordFree; +end; + + +initialization + singleton_AudioInputBass := TAudioInput_Bass.create(); + AudioManager.add( singleton_AudioInputBass ); + +finalization + AudioManager.Remove( singleton_AudioInputBass ); + +end. diff --git a/Game/Code/Classes/UAudioInput_Portaudio.pas b/Game/Code/Classes/UAudioInput_Portaudio.pas new file mode 100644 index 00000000..853fc35b --- /dev/null +++ b/Game/Code/Classes/UAudioInput_Portaudio.pas @@ -0,0 +1,420 @@ +unit UAudioInput_Portaudio; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +uses Classes, + SysUtils, + portaudio, + {$IFDEF UsePortmixer} + portmixer, + {$ENDIF} + ULog, + UMusic; + +implementation + +uses + {$IFDEF LAZARUS} + lclintf, + {$ENDIF} + URecord, + UIni, + UMain, + UCommon, + UThemes; +{ +type + TPaHostApiIndex = PaHostApiIndex; + TPaDeviceIndex = PaDeviceIndex; + PPaStream = ^PaStreamPtr; + PPaStreamCallbackTimeInfo = ^PaStreamCallbackTimeInfo; + TPaStreamCallbackFlags = PaStreamCallbackFlags; + TPaHostApiTypeId = PaHostApiTypeId; + PPaHostApiInfo = ^PaHostApiInfo; + PPaDeviceInfo = ^PaDeviceInfo; + TPaError = PaError; + TPaStreamParameters = PaStreamParameters; +} +type + TAudioInput_Portaudio = class( TInterfacedObject, IAudioInput ) + private + function GetPreferredApiIndex(): TPaHostApiIndex; + public + function GetName: String; + procedure InitializeRecord; + + procedure CaptureStart; + procedure CaptureStop; + + procedure CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); + procedure StopCard(Card: byte); + end; + + TPortaudioSoundCard = class(TGenericSoundCard) + RecordStream: PPaStream; + DeviceIndex: TPaDeviceIndex; + end; + +function MicrophoneCallback(input: Pointer; output: Pointer; frameCount: Longword; + timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; + inputDevice: Pointer): Integer; cdecl; forward; + +var + singleton_AudioInputPortaudio : IAudioInput; + +const + sampleRate: Double = 44100.; + +{* the default API used by Portaudio is the least common denominator + * and might lack efficiency. ApiPreferenceOrder defines the order of + * preferred APIs to use. The first API-type in the list is tried first. If it's + * not available the next is tried, ... + * If none of the preferred APIs was found the default API is used. + * Pascal doesn't permit zero-length static arrays, so you can use paDefaultApi + * as an array's only member if you do not have any preferences. + * paDefaultApi also terminates a preferences list but this is optional. + *} +const + paDefaultApi = -1; +var + ApiPreferenceOrder: +{$IF Defined(WIN32)} + // Note1: Portmixer has no mixer support for paASIO and paWASAPI at the moment + // Note2: Windows Default-API is MME + //array[0..0] of TPaHostApiTypeId = ( paDirectSound, paMME ); + array[0..0] of TPaHostApiTypeId = ( paDirectSound ); +{$ELSEIF Defined(LINUX)} + // Note1: Portmixer has no mixer support for paJACK at the moment + // Note2: Not tested, but ALSA might be better than OSS. + array[0..1] of TPaHostApiTypeId = ( paALSA, paOSS ); +{$ELSEIF Defined(DARWIN)} + // Note: Not tested. + //array[0..0] of TPaHostApiTypeId = ( paCoreAudio ); + array[0..0] of TPaHostApiTypeId = ( paDefaultApi ); +{$ELSE} + array[0..0] of TPaHostApiTypeId = ( paDefaultApi ); +{$IFEND} + +function TAudioInput_Portaudio.GetName: String; +begin + result := 'Portaudio'; +end; + +function TAudioInput_Portaudio.GetPreferredApiIndex(): TPaHostApiIndex; +var + i: integer; +begin + result := -1; + + // select preferred sound-API + for i:= 0 to High(ApiPreferenceOrder) do + begin + if(ApiPreferenceOrder[i] <> paDefaultApi) then begin + // check if API is available + result := Pa_HostApiTypeIdToHostApiIndex(ApiPreferenceOrder[i]); + if(result >= 0) then + break; + end; + end; + + // None of the preferred APIs is available -> use default + if(result < 0) then begin + result := Pa_GetDefaultHostApi(); + end; +end; + +// TODO: should be a function with boolean return type +procedure TAudioInput_Portaudio.InitializeRecord; +var + i: integer; + apiIndex: TPaHostApiIndex; + apiInfo: PPaHostApiInfo; + deviceName: string; + deviceIndex: TPaDeviceIndex; + deviceInfo: PPaDeviceInfo; + inputCnt: integer; + inputName: string; + SC: integer; // soundcard + SCI: integer; // soundcard input + err: TPaError; + errMsg: string; + paSoundCard: TPortaudioSoundCard; + inputParams: TPaStreamParameters; + stream: PPaStream; + {$IFDEF UsePortmixer} + mixer: PPxMixer; + {$ENDIF} +begin + // TODO: call Pa_Terminate() on termination + err := Pa_Initialize(); + if(err <> paNoError) then begin + Log.CriticalError('Portaudio.InitializeRecord: ' + Pa_GetErrorText(err)); + //Log.LogError('Portaudio.InitializeRecord: ' + Pa_GetErrorText(err)); + // result := false; + Exit; + end; + + apiIndex := GetPreferredApiIndex(); + apiInfo := Pa_GetHostApiInfo(apiIndex); + + SC := 0; + + // init array-size to max. input-devices count + SetLength(Recording.SoundCard, apiInfo^.deviceCount); // fix deviceCountL + for i:= 0 to High(Recording.SoundCard) do + begin + // convert API-specific device-index to global index + deviceIndex := Pa_HostApiDeviceIndexToDeviceIndex(apiIndex, i); + deviceInfo := Pa_GetDeviceInfo(deviceIndex); + + // current device is no input device -> skip + if(deviceInfo^.maxInputChannels <= 0) then + continue; + + // TODO: free object on termination + paSoundCard := TPortaudioSoundCard.Create(); + Recording.SoundCard[SC] := paSoundCard; + + // retrieve device-name + deviceName := deviceInfo^.name; + paSoundCard.Description := deviceName; + paSoundCard.DeviceIndex := deviceIndex; + + // setup desired input parameters + with inputParams do begin + device := deviceIndex; + channelCount := 2; + sampleFormat := paInt16; + suggestedLatency := deviceInfo^.defaultLowInputLatency; + hostApiSpecificStreamInfo := nil; + end; + + // check if device supports our input-format + err := Pa_IsFormatSupported(@inputParams, nil, sampleRate); + if(err <> 0) then begin + // format not supported -> skip + errMsg := Pa_GetErrorText(err); + Log.LogError('Portaudio.InitializeRecord, device: "'+ deviceName +'" ' + + '('+ errMsg +')'); + paSoundCard.Free(); + continue; + end; + + // TODO: retry with mono if stereo is not supported + // TODO: retry with input-latency set to 20ms (defaultLowInputLatency might + // not be set correctly in OSS) + + err := Pa_OpenStream(stream, @inputParams, nil, sampleRate, + paFramesPerBufferUnspecified, paNoFlag, @MicrophoneCallback, nil); + if(err <> paNoError) then begin + // unable to open device -> skip + errMsg := Pa_GetErrorText(err); + Log.LogError('Portaudio.InitializeRecord, device: "'+ deviceName +'" ' + + '('+ errMsg +')'); + paSoundCard.Free(); + continue; + end; + + + {$IFDEF UsePortmixer} + + // use default mixer + mixer := Px_OpenMixer(stream, 0); + + // get input count + inputCnt := Px_GetNumInputSources(mixer); + SetLength(paSoundCard.Input, inputCnt); + + // get input names + for SCI := 0 to inputCnt-1 do + begin + inputName := Px_GetInputSourceName(mixer, SCI); + paSoundCard.Input[SCI].Name := inputName; + end; + + Px_CloseMixer(mixer); + + {$ELSE} // !UsePortmixer + + //Pa_StartStream(stream); + // TODO: check if callback was called (this problem may occur on some devices) + //Pa_StopStream(stream); + + Pa_CloseStream(stream); + + // create a standard input source + SetLength(paSoundCard.Input, 1); + paSoundCard.Input[0].Name := 'Standard'; + + {$ENDIF} + + // use default input source + paSoundCard.InputSelected := 0; + + Inc(SC); + end; + + // adjust size to actual input-device count + SetLength(Recording.SoundCard, SC); + + Log.LogStatus('#Soundcards: ' + inttostr(SC), 'Portaudio'); + + { + SoundCard[SC].InputSelected := Mic[Device]; + } +end; + +// TODO: code is used by all IAudioInput implementors +// -> move to a common superclass (TAudioInput_Generic?) +procedure TAudioInput_Portaudio.CaptureStart; +var + S: integer; + SC: integer; + PlayerLeft, PlayerRight: integer; + CaptureSoundLeft, CaptureSoundRight: TSound; +begin + for S := 0 to High(Recording.Sound) do + Recording.Sound[S].BufferLong[0].Clear; + + for SC := 0 to High(Ini.CardList) do begin + PlayerLeft := Ini.CardList[SC].ChannelL-1; + PlayerRight := Ini.CardList[SC].ChannelR-1; + if PlayerLeft >= PlayersPlay then PlayerLeft := -1; + if PlayerRight >= PlayersPlay then PlayerRight := -1; + if (PlayerLeft > -1) or (PlayerRight > -1) then begin + if (PlayerLeft > -1) then + CaptureSoundLeft := Recording.Sound[PlayerLeft] + else + CaptureSoundLeft := nil; + if (PlayerRight > -1) then + CaptureSoundRight := Recording.Sound[PlayerRight] + else + CaptureSoundRight := nil; + + CaptureCard(SC, CaptureSoundLeft, CaptureSoundRight); + end; + end; +end; + +// TODO: code is used by all IAudioInput implementors +// -> move to a common superclass (TAudioInput_Generic?) +procedure TAudioInput_Portaudio.CaptureStop; +var + SC: integer; + PlayerLeft: integer; + PlayerRight: integer; +begin + + for SC := 0 to High(Ini.CardList) do begin + PlayerLeft := Ini.CardList[SC].ChannelL-1; + PlayerRight := Ini.CardList[SC].ChannelR-1; + if PlayerLeft >= PlayersPlay then PlayerLeft := -1; + if PlayerRight >= PlayersPlay then PlayerRight := -1; + if (PlayerLeft > -1) or (PlayerRight > -1) then + StopCard(SC); + end; + +end; + +{* + * Portaudio input capture callback. + *} +function MicrophoneCallback(input: Pointer; output: Pointer; frameCount: Longword; + timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; + inputDevice: Pointer): Integer; cdecl; +begin + Recording.HandleMicrophoneData(input, frameCount*4, inputDevice); + result := paContinue; +end; + +{* + * Start input-capturing on Soundcard specified by Card. + * Params: + * Card - soundcard index in Recording.SoundCard array + * CaptureSoundLeft - sound(-buffer) used for left channel capture data + * CaptureSoundRight - sound(-buffer) used for right channel capture data + *} +procedure TAudioInput_Portaudio.CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); +var + Error: TPaError; + ErrorMsg: string; + inputParams: TPaStreamParameters; + deviceInfo: PPaDeviceInfo; + stream: PPaStream; + paSoundCard: TPortaudioSoundCard; +begin + paSoundCard := TPortaudioSoundCard(Recording.SoundCard[Card]); + paSoundCard.CaptureSoundLeft := CaptureSoundLeft; + paSoundCard.CaptureSoundRight := CaptureSoundRight; + + // get input latency info + deviceInfo := Pa_GetDeviceInfo(paSoundCard.DeviceIndex); + + // set input stream parameters + with inputParams do begin + device := paSoundCard.DeviceIndex; + channelCount := 2; + sampleFormat := paInt16; + suggestedLatency := deviceInfo^.defaultLowInputLatency; + hostApiSpecificStreamInfo := nil; + end; + + Log.LogStatus(inttostr(paSoundCard.DeviceIndex), 'Portaudio'); + Log.LogStatus(floattostr(deviceInfo^.defaultLowInputLatency), 'Portaudio'); + + // open input stream + Error := Pa_OpenStream(stream, @inputParams, nil, sampleRate, + paFramesPerBufferUnspecified, paNoFlag, + @MicrophoneCallback, Pointer(paSoundCard)); + if(Error <> paNoError) then begin + ErrorMsg := Pa_GetErrorText(Error); + Log.CriticalError('TAudio_Portaudio.CaptureCard('+ IntToStr(Card) +'): Error opening stream: ' + ErrorMsg); + //Halt; + end; + + paSoundCard.RecordStream := stream; + + // start capture + Error := Pa_StartStream(stream); + if(Error <> paNoError) then begin + Pa_CloseStream(stream); + ErrorMsg := Pa_GetErrorText(Error); + Log.CriticalError('TAudio_Portaudio.CaptureCard('+ IntToStr(Card) +'): Error starting stream: ' + ErrorMsg); + //Halt; + end; +end; + +{* + * Stop input-capturing on Soundcard specified by Card. + * Params: + * Card - soundcard index in Recording.SoundCard array + *} +procedure TAudioInput_Portaudio.StopCard(Card: byte); +var + stream: PPaStream; + paSoundCard: TPortaudioSoundCard; +begin + paSoundCard := TPortaudioSoundCard(Recording.SoundCard[Card]); + stream := paSoundCard.RecordStream; + if(stream <> nil) then begin + Pa_StopStream(stream); + Pa_CloseStream(stream); + end; +end; + + +initialization + singleton_AudioInputPortaudio := TAudioInput_Portaudio.create(); + AudioManager.add( singleton_AudioInputPortaudio ); + +finalization + AudioManager.Remove( singleton_AudioInputPortaudio ); + +end. diff --git a/Game/Code/Classes/UAudioPlayback_Bass.pas b/Game/Code/Classes/UAudioPlayback_Bass.pas new file mode 100644 index 00000000..ee6b1ef9 --- /dev/null +++ b/Game/Code/Classes/UAudioPlayback_Bass.pas @@ -0,0 +1,460 @@ +unit UAudioPlayback_Bass; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +uses Classes, + {$IFDEF win32} + windows, + {$ENDIF} + SysUtils, + bass, + ULog, + UMusic; + +implementation + +uses + {$IFDEF LAZARUS} + lclintf, + {$ENDIF} + URecord, + UIni, + UMain, + UCommon, + UThemes; + +type + TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, + mpPaused, mpOpen); + +const + ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); + +type + TBassOutputStream = class(TAudioOutputStream) + Handle: HSTREAM; + + constructor Create(); overload; + constructor Create(stream: HSTREAM); overload; + end; + +type + TAudioPlayback_Bass = class( TInterfacedObject, IAudioPlayback) + private + MusicStream: HSTREAM; + + StartSoundStream: HSTREAM; + BackSoundStream: HSTREAM; + SwooshSoundStream: HSTREAM; + ChangeSoundStream: HSTREAM; + OptionSoundStream: HSTREAM; + ClickSoundStream: HSTREAM; + DrumSoundStream: HSTREAM; + HihatSoundStream: HSTREAM; + ClapSoundStream: HSTREAM; + ShuffleSoundStream: HSTREAM; + + //Custom Sounds + CustomSounds: array of TCustomSoundEntry; + Loaded: boolean; + Loop: boolean; + + public + function GetName: String; + + {IAudioOutput interface} + + procedure InitializePlayback; + procedure SetVolume(Volume: integer); + procedure SetMusicVolume(Volume: integer); + procedure SetLoop(Enabled: boolean); + + function Open(Name: string): boolean; // true if succeed + + procedure Rewind; + procedure Play; + procedure Pause; //Pause Mod + procedure Stop; + procedure Close; + function Finished: boolean; + function Length: real; + function GetPosition: real; + procedure SetPosition(Time: real); + + procedure PlayStart; + procedure PlayBack; + procedure PlaySwoosh; + procedure PlayChange; + procedure PlayOption; + procedure PlayClick; + procedure PlayDrum; + procedure PlayHihat; + procedure PlayClap; + procedure PlayShuffle; + procedure StopShuffle; + + function LoadSoundFromFile(var stream: HSTREAM; Name: string): boolean; + + //Equalizer + function GetFFTData: TFFTData; + + // Interface for Visualizer + function GetPCMData(var data: TPCMData): Cardinal; + + //Custom Sounds + function LoadCustomSound(const Filename: String): Cardinal; + procedure PlayCustomSound(const Index: Cardinal ); + end; + +var + singleton_AudioPlaybackBass : IAudioPlayback; + + +constructor TBassOutputStream.Create(); +begin + inherited; +end; + +constructor TBassOutputStream.Create(stream: HSTREAM); +begin + Create(); + Handle := stream; +end; + + +function TAudioPlayback_Bass.GetName: String; +begin + result := 'BASS_Playback'; +end; + +procedure TAudioPlayback_Bass.InitializePlayback; +var + Pet: integer; + S: integer; +begin +// Log.BenchmarkStart(4); +// Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); + + Loaded := false; + Loop := false; + + if not BASS_Init(1, 44100, 0, 0, nil) then + begin + Log.LogError('Could not initialize BASS', 'Error'); + Exit; + end; + +// Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); + + // config playing buffer +// BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); +// BASS_SetConfig(BASS_CONFIG_BUFFER, 100); + +// Log.LogStatus('Loading Sounds', 'Music Initialize'); + +// Log.BenchmarkStart(4); + LoadSoundFromFile(StartSoundStream, SoundPath + 'Common Start.mp3'); + LoadSoundFromFile(BackSoundStream, SoundPath + 'Common Back.mp3'); + LoadSoundFromFile(SwooshSoundStream, SoundPath + 'menu swoosh.mp3'); + LoadSoundFromFile(ChangeSoundStream, SoundPath + 'select music change music 50.mp3'); + LoadSoundFromFile(OptionSoundStream, SoundPath + 'option change col.mp3'); + LoadSoundFromFile(ClickSoundStream, SoundPath + 'rimshot022b.mp3'); + +// LoadSoundFromFile(DrumSoundStream, SoundPath + 'bassdrumhard076b.mp3'); +// LoadSoundFromFile(HihatSoundStream, SoundPath + 'hihatclosed068b.mp3'); +// LoadSoundFromFile(ClapSoundStream, SoundPath + 'claps050b.mp3'); + +// LoadSoundFromFile(ShuffleSoundStream, SoundPath + 'Shuffle.mp3'); + +// Log.BenchmarkEnd(4); +// Log.LogBenchmark('--> Loading Sounds', 4); +end; + +procedure TAudioPlayback_Bass.SetVolume(Volume: integer); +begin + //Old Sets Wave Volume + //BASS_SetVolume(Volume); + //New: Sets Volume only for this Application + + BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); +end; + +procedure TAudioPlayback_Bass.SetMusicVolume(Volume: Integer); +begin + //Max Volume Prevention + if Volume > 100 then + Volume := 100; + + if Volume < 0 then + Volume := 0; + + //Set Volume + BASS_ChannelSetAttributes (MusicStream, -1, Volume, -101); +end; + +procedure TAudioPlayback_Bass.SetLoop(Enabled: boolean); +begin + Loop := Enabled; +end; + +function TAudioPlayback_Bass.Open(Name: string): boolean; +begin + Loaded := false; + if FileExists(Name) then + begin + MusicStream := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); + + Loaded := true; + //Set Max Volume + SetMusicVolume (100); + end; + + Result := Loaded; +end; + +procedure TAudioPlayback_Bass.Rewind; +begin + if Loaded then begin + end; +end; + +procedure TAudioPlayback_Bass.SetPosition(Time: real); +var + bytes: integer; +begin + bytes := BASS_ChannelSeconds2Bytes(MusicStream, Time); + BASS_ChannelSetPosition(MusicStream, bytes); +end; + +procedure TAudioPlayback_Bass.Play; +begin + if Loaded then + begin + if Loop then + BASS_ChannelPlay(MusicStream, True); // start from beginning... actually bass itself does not loop, nor does this TAudio_bass Class + + BASS_ChannelPlay(MusicStream, False); // for setting position before playing + end; +end; + +procedure TAudioPlayback_Bass.Pause; //Pause Mod +begin + if Loaded then begin + BASS_ChannelPause(MusicStream); // Pauses Song + end; +end; + +procedure TAudioPlayback_Bass.Stop; +begin + Bass_ChannelStop(MusicStream); +end; + +procedure TAudioPlayback_Bass.Close; +begin + Bass_StreamFree(MusicStream); +end; + +function TAudioPlayback_Bass.Length: real; +var + bytes: integer; +begin + Result := 60; + + bytes := BASS_ChannelGetLength(MusicStream); + Result := BASS_ChannelBytes2Seconds(MusicStream, bytes); +end; + +function TAudioPlayback_Bass.getPosition: real; +var + bytes: integer; +begin + Result := 0; + + bytes := BASS_ChannelGetPosition(MusicStream); + Result := BASS_ChannelBytes2Seconds(MusicStream, bytes); +end; + +function TAudioPlayback_Bass.Finished: boolean; +begin + Result := false; + + if BASS_ChannelIsActive(MusicStream) = BASS_ACTIVE_STOPPED then + begin + Result := true; + end; +end; + +procedure TAudioPlayback_Bass.PlayStart; +begin + BASS_ChannelPlay(StartSoundStream, True); +end; + +procedure TAudioPlayback_Bass.PlayBack; +begin + BASS_ChannelPlay(BackSoundStream, True);// then +end; + +procedure TAudioPlayback_Bass.PlaySwoosh; +begin + BASS_ChannelPlay(SwooshSoundStream, True); +end; + +procedure TAudioPlayback_Bass.PlayChange; +begin + BASS_ChannelPlay(ChangeSoundStream, True); +end; + +procedure TAudioPlayback_Bass.PlayOption; +begin + BASS_ChannelPlay(OptionSoundStream, True); +end; + +procedure TAudioPlayback_Bass.PlayClick; +begin + BASS_ChannelPlay(ClickSoundStream, True); +end; + +procedure TAudioPlayback_Bass.PlayDrum; +begin + BASS_ChannelPlay(DrumSoundStream, True); +end; + +procedure TAudioPlayback_Bass.PlayHihat; +begin + BASS_ChannelPlay(HihatSoundStream, True); +end; + +procedure TAudioPlayback_Bass.PlayClap; +begin + BASS_ChannelPlay(ClapSoundStream, True); +end; + +procedure TAudioPlayback_Bass.PlayShuffle; +begin + BASS_ChannelPlay(ShuffleSoundStream, True); +end; + +procedure TAudioPlayback_Bass.StopShuffle; +begin + BASS_ChannelStop(ShuffleSoundStream); +end; + +function TAudioPlayback_Bass.LoadSoundFromFile(var stream: HSTREAM; Name: string): boolean; +var + L: Integer; +begin + if FileExists(Name) then + begin + Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); + try + stream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); + + //Add CustomSound + L := High(CustomSounds) + 1; + SetLength (CustomSounds, L + 1); + CustomSounds[L].Filename := Name; + CustomSounds[L].Stream := TBassOutputStream.Create(stream); + except + Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); + end; + end + else + begin + Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); + exit; + end; +end; + +//Equalizer +function TAudioPlayback_Bass.GetFFTData: TFFTData; +var + Data: TFFTData; +begin + //Get Channel Data Mono and 256 Values + BASS_ChannelGetData(MusicStream, @Result, BASS_DATA_FFT512); +end; + +{* + * Copies interleaved PCM 16bit uint (maybe fake) stereo samples into data. + * Returns the number of frames (= stereo/mono sample) + *} +function TAudioPlayback_Bass.GetPCMData(var data: TPCMData): Cardinal; +var + info: BASS_CHANNELINFO; + nBytes: DWORD; +begin + //Get Channel Data Mono and 256 Values + BASS_ChannelGetInfo(MusicStream, info); + ZeroMemory(@data, sizeof(TPCMData)); + + if (info.chans = 1) then + begin + // mono file -> add stereo channel + { + nBytes := BASS_ChannelGetData(Bass, @data[0], samples*sizeof(Smallint)); + // interleave data + //CopyMemory(@data[1], @data[0], samples*sizeof(Smallint)); + } + result := 0; + end + else + begin + // stereo file + nBytes := BASS_ChannelGetData(MusicStream, @data, sizeof(TPCMData)); + end; + if(nBytes <= 0) then + result := 0 + else + result := nBytes div sizeof(TPCMStereoSample); +end; + +function TAudioPlayback_Bass.LoadCustomSound(const Filename: String): Cardinal; +var + S: hStream; + I: Integer; + F: String; +begin + //Search for Sound in already loaded Sounds + F := UpperCase(SoundPath + FileName); + For I := 0 to High(CustomSounds) do + begin + if (UpperCase(CustomSounds[I].Filename) = F) then + begin + Result := I; + Exit; + end; + end; + + if LoadSoundFromFile(S, SoundPath + Filename) then + Result := High(CustomSounds) + else + Result := 0; +end; + +procedure TAudioPlayback_Bass.PlayCustomSound(const Index: Cardinal ); +begin + if Index <= High(CustomSounds) then + with CustomSounds[Index].Stream as TBassOutputStream do + begin + BASS_ChannelPlay(Handle, True); + end; +end; + + +initialization + singleton_AudioPlaybackBass := TAudioPlayback_Bass.create(); + AudioManager.add( singleton_AudioPlaybackBass ); + +finalization + AudioManager.Remove( singleton_AudioPlaybackBass ); + +end. diff --git a/Game/Code/Classes/UAudioPlayback_Portaudio.pas b/Game/Code/Classes/UAudioPlayback_Portaudio.pas new file mode 100644 index 00000000..36bebc8a --- /dev/null +++ b/Game/Code/Classes/UAudioPlayback_Portaudio.pas @@ -0,0 +1,664 @@ +unit UAudioPlayback_Portaudio; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +uses Classes, + SysUtils, + UMusic; + +implementation + +uses + {$IFDEF LAZARUS} + lclintf, + {$ifndef win32} + libc, + {$endif} + {$ENDIF} + portaudio, + ULog, + UIni, + UMain; + +type + TPortaudioPlaybackStream = class(TAudioPlaybackStream) + private + status: TStreamStatus; + Loaded: boolean; + Loop: boolean; + public + decodeStream: TAudioDecodeStream; + + constructor Create(decodeStream: TAudioDecodeStream); + procedure Play(); override; + procedure Pause(); override; + procedure Stop(); override; + procedure Close(); override; + function GetLoop(): boolean; override; + procedure SetLoop(Enabled: boolean); override; + function GetLength(): real; override; + function GetStatus(): TStreamStatus; override; + + function ReadData(Buffer: PChar; BufSize: integer): integer; + + function IsLoaded(): boolean; + end; + +type + TAudioMixerStream = class + private + activeStreams: TList; + public + constructor Create(); + destructor Destroy(); override; + procedure AddStream(stream: TAudioPlaybackStream); + procedure RemoveStream(stream: TAudioPlaybackStream); + function ReadData(Buffer: PChar; BufSize: integer): integer; + end; + +type + TAudioPlayback_Portaudio = class( TInterfacedObject, IAudioPlayback ) + private + MusicStream: TPortaudioPlaybackStream; + + StartSoundStream: TPortaudioPlaybackStream; + BackSoundStream: TPortaudioPlaybackStream; + SwooshSoundStream: TPortaudioPlaybackStream; + ChangeSoundStream: TPortaudioPlaybackStream; + OptionSoundStream: TPortaudioPlaybackStream; + ClickSoundStream: TPortaudioPlaybackStream; + DrumSoundStream: TPortaudioPlaybackStream; + HihatSoundStream: TPortaudioPlaybackStream; + ClapSoundStream: TPortaudioPlaybackStream; + ShuffleSoundStream: TPortaudioPlaybackStream; + + //Custom Sounds + CustomSounds: array of TCustomSoundEntry; + + mixerStream: TAudioMixerStream; + paStream: PPaStream; + public + FrameSize: integer; + + function GetName: String; + + function InitializePortaudio(): boolean; + function StartPortaudioStream(): boolean; + + procedure InitializePlayback(); + procedure SetVolume(Volume: integer); + procedure SetMusicVolume(Volume: integer); + procedure SetLoop(Enabled: boolean); + function Open(Filename: string): boolean; // true if succeed + function Load(Filename: string): TPortaudioPlaybackStream; + procedure Rewind; + procedure SetPosition(Time: real); + procedure Play; + procedure Pause; //Pause Mod + + procedure Stop; + procedure Close; + function Finished: boolean; + function Length: real; + function GetPosition: real; + procedure PlayStart; + procedure PlayBack; + procedure PlaySwoosh; + procedure PlayChange; + procedure PlayOption; + procedure PlayClick; + procedure PlayDrum; + procedure PlayHihat; + procedure PlayClap; + procedure PlayShuffle; + procedure StopShuffle; + + //Equalizer + function GetFFTData: TFFTData; + + // Interface for Visualizer + function GetPCMData(var data: TPCMData): Cardinal; + + //Custom Sounds + function LoadCustomSound(const Filename: String): Cardinal; + procedure PlayCustomSound(const Index: Cardinal ); + end; + + +function AudioCallback(input: Pointer; output: Pointer; frameCount: Longword; + timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; + userData: Pointer): Integer; cdecl; forward; + +var + singleton_AudioPlaybackPortaudio : IAudioPlayback; + + +{ TAudioMixerStream } + +constructor TAudioMixerStream.Create(); +begin + activeStreams := TList.Create; +end; + +destructor TAudioMixerStream.Destroy(); +begin + activeStreams.Free; +end; + +procedure TAudioMixerStream.AddStream(stream: TAudioPlaybackStream); +begin + // check if stream is already in list to avoid duplicates + if (activeStreams.IndexOf(Pointer(stream)) = -1) then + activeStreams.Add(Pointer(stream)); +end; + +procedure TAudioMixerStream.RemoveStream(stream: TAudioPlaybackStream); +begin + activeStreams.Remove(Pointer(stream)); +end; + +function TAudioMixerStream.ReadData(Buffer: PChar; BufSize: integer): integer; +var + i: integer; + stream: TPortaudioPlaybackStream; + dataAvailable: boolean; +begin + dataAvailable := false; + + // search for playing stream + if (activeStreams.Count > 0) then + begin + for i := 0 to activeStreams.Count-1 do + begin + stream := TPortaudioPlaybackStream(activeStreams[i]); + if (stream.getStatus = sPlaying) then + begin + dataAvailable := true; + break; + end; + end; + + // fetch data from current stream + if (dataAvailable) then + begin + result := stream.ReadData(Buffer, BufSize); + end; + end; + + // return silence + if ((not dataAvailable) or (result = -1)) then + begin + FillChar(Buffer^, BufSize, 0); + result := BufSize; + end; +end; + + +{ TPortaudioPlaybackStream } + +constructor TPortaudioPlaybackStream.Create(decodeStream: TAudioDecodeStream); +begin + inherited Create(); + status := sStopped; + if (decodeStream <> nil) then + begin + Self.decodeStream := decodeStream; + Loaded := true; + end; +end; + +procedure TPortaudioPlaybackStream.Play(); +begin + status := sPlaying; +end; + +procedure TPortaudioPlaybackStream.Pause(); +begin + status := sPaused; +end; + +procedure TPortaudioPlaybackStream.Stop(); +begin + status := sStopped; +end; + +procedure TPortaudioPlaybackStream.Close(); +begin + Stop(); +end; + +function TPortaudioPlaybackStream.IsLoaded(): boolean; +begin + result := Loaded; +end; + +function TPortaudioPlaybackStream.GetLoop(): boolean; +begin + result := Loop; +end; + +procedure TPortaudioPlaybackStream.SetLoop(Enabled: boolean); +begin + Loop := Enabled; +end; + +function TPortaudioPlaybackStream.GetLength(): real; +begin + result := decodeStream.Length; +end; + +function TPortaudioPlaybackStream.GetStatus(): TStreamStatus; +begin + result := status; +end; + +function TPortaudioPlaybackStream.ReadData(Buffer: PChar; BufSize: integer): integer; +begin + result := decodeStream.ReadData(Buffer, BufSize); + // end-of-stream reached -> stop playback + if (decodeStream.EOS) then + begin + status := sStopped; + end; +end; + + +{ TAudioPlayback_Portaudio } + +function AudioCallback(input: Pointer; output: Pointer; frameCount: Longword; + timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; + userData: Pointer): Integer; cdecl; +var + playback : TAudioPlayback_Portaudio; + playbackStream : TPortaudioPlaybackStream; + decodeStream : TAudioDecodeStream; +begin + playback := TAudioPlayback_Portaudio(userData); + with playback do + begin + mixerStream.ReadData(output, frameCount * FrameSize); + end; + result := paContinue; +end; + + +function TAudioPlayback_Portaudio.GetName: String; +begin + result := 'Portaudio_Playback'; +end; + +function TAudioPlayback_Portaudio.InitializePortaudio(): boolean; +var + paApi : TPaHostApiIndex; + paApiInfo : PPaHostApiInfo; + paOutParams : TPaStreamParameters; + paOutDevice : TPaDeviceIndex; + paOutDeviceInfo : PPaDeviceInfo; + err : TPaError; +begin + result := false; + + Pa_Initialize(); + + // FIXME: determine automatically + {$IFDEF WIN32} + paApi := Pa_HostApiTypeIdToHostApiIndex(paDirectSound); + {$ELSE} + paApi := Pa_HostApiTypeIdToHostApiIndex(paALSA); + {$ENDIF} + if (paApi < 0) then + begin + Log.LogStatus('Pa_HostApiTypeIdToHostApiIndex: '+Pa_GetErrorText(paApi), 'UAudioPlayback_Portaudio'); + exit; + end; + + paApiInfo := Pa_GetHostApiInfo(paApi); + paOutDevice := paApiInfo^.defaultOutputDevice; + paOutDeviceInfo := Pa_GetDeviceInfo(paOutDevice); + + with paOutParams do begin + device := paOutDevice; + channelCount := 2; + sampleFormat := paInt16; + suggestedLatency := paOutDeviceInfo^.defaultLowOutputLatency; + hostApiSpecificStreamInfo := nil; + end; + + FrameSize := 2 * sizeof(Smallint); + + err := Pa_OpenStream(paStream, nil, @paOutParams, 44100, + paFramesPerBufferUnspecified, + paNoFlag, @AudioCallback, Self); + if(err <> paNoError) then begin + Log.LogStatus('Pa_OpenStream: '+Pa_GetErrorText(err), 'UAudioPlayback_Portaudio'); + exit; + end; + + Log.LogStatus('Opened audio device', 'UAudioPlayback_Portaudio'); + + result := true; +end; + +function TAudioPlayback_Portaudio.StartPortaudioStream(): boolean; +var + err: TPaError; +begin + result := false; + + err := Pa_StartStream(paStream); + if(err <> paNoError) then + begin + Log.LogStatus('Pa_StartStream: '+Pa_GetErrorText(err), 'UAudioPlayback_Portaudio'); + exit; + end; + + result := true; +end; + +procedure TAudioPlayback_Portaudio.InitializePlayback; +begin + Log.LogStatus('InitializePlayback', 'UAudioPlayback_Portaudio'); + + InitializePortaudio(); + mixerStream := TAudioMixerStream.Create; + + StartSoundStream := Load(SoundPath + 'Common start.mp3'); + BackSoundStream := Load(SoundPath + 'Common back.mp3'); + SwooshSoundStream := Load(SoundPath + 'menu swoosh.mp3'); + ChangeSoundStream := Load(SoundPath + 'select music change music 50.mp3'); + OptionSoundStream := Load(SoundPath + 'option change col.mp3'); + ClickSoundStream := Load(SoundPath + 'rimshot022b.mp3'); + +// DrumSoundStream := Load(SoundPath + 'bassdrumhard076b.mp3'); +// HihatSoundStream := Load(SoundPath + 'hihatclosed068b.mp3'); +// ClapSoundStream := Load(SoundPath + 'claps050b.mp3'); + +// ShuffleSoundStream := Load(SoundPath + 'Shuffle.mp3'); + + StartPortaudioStream(); +end; + + +procedure TAudioPlayback_Portaudio.SetVolume(Volume: integer); +begin + //New: Sets Volume only for this Application +(* + BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); + BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); +*) +end; + +procedure TAudioPlayback_Portaudio.SetMusicVolume(Volume: Integer); +begin + //Max Volume Prevention + if Volume > 100 then + Volume := 100; + + if Volume < 0 then + Volume := 0; + + //Set Volume +// BASS_ChannelSetAttributes (Bass, -1, Volume, -101); +end; + +procedure TAudioPlayback_Portaudio.SetLoop(Enabled: boolean); +begin + MusicStream.SetLoop(Enabled); +end; + +function TAudioPlayback_Portaudio.Open(Filename: string): boolean; +var + decodeStream: TAudioDecodeStream; +begin + decodeStream := AudioDecoder.Open(Filename); + MusicStream := TPortaudioPlaybackStream.Create(decodeStream); + + if(MusicStream.IsLoaded()) then + begin + //Set Max Volume + SetMusicVolume(100); + end; + + Result := MusicStream.IsLoaded(); +end; + +procedure TAudioPlayback_Portaudio.Rewind; +begin + SetPosition(0); +end; + +procedure TAudioPlayback_Portaudio.SetPosition(Time: real); +var + bytes: integer; +begin + if (MusicStream.IsLoaded) then + begin + MusicStream.SetPosition(Time); + end; +end; + +procedure TAudioPlayback_Portaudio.Play; +begin + if (MusicStream <> nil) then + if (MusicStream.IsLoaded()) then + begin + if (MusicStream.GetLoop()) then + begin + end; + // start from beginning... + // actually bass itself does not loop, nor does this TAudio_FFMpeg Class + MusicStream.Play(); + end; +end; + +procedure TAudioPlayback_Portaudio.Pause; //Pause Mod +begin + if (MusicStream <> nil) then + if (MusicStream.IsLoaded()) then begin + MusicStream.Pause(); // Pauses Song + end; +end; + +procedure TAudioPlayback_Portaudio.Stop; +begin + if MusicStream <> nil then + MusicStream.Stop(); +end; + +procedure TAudioPlayback_Portaudio.Close; +begin + if MusicStream <> nil then + MusicStream.Close(); +end; + +function TAudioPlayback_Portaudio.Length: real; +begin + Result := 0; + if assigned( MusicStream ) then + begin + Result := MusicStream.GetLength(); + end; +end; + +function TAudioPlayback_Portaudio.getPosition: real; +var + bytes: integer; +begin + Result := 0; + +(* + bytes := BASS_ChannelGetPosition(BASS); + Result := BASS_ChannelBytes2Seconds(BASS, bytes); +*) +end; + +function TAudioPlayback_Portaudio.Finished: boolean; +begin + Result := false; + +(* + if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then + begin + Result := true; + end; +*) +end; + +procedure TAudioPlayback_Portaudio.PlayStart; +begin + if StartSoundStream <> nil then + StartSoundStream.Play(); +end; + +procedure TAudioPlayback_Portaudio.PlayBack; +begin + if BackSoundStream <> nil then + BackSoundStream.Play(); +end; + +procedure TAudioPlayback_Portaudio.PlaySwoosh; +begin + if SwooshSoundStream <> nil then + SwooshSoundStream.Play(); +end; + +procedure TAudioPlayback_Portaudio.PlayChange; +begin + if ChangeSoundStream <> nil then + ChangeSoundStream.Play(); +end; + +procedure TAudioPlayback_Portaudio.PlayOption; +begin + if OptionSoundStream <> nil then + OptionSoundStream.Play(); +end; + +procedure TAudioPlayback_Portaudio.PlayClick; +begin + if ClickSoundStream <> nil then + ClickSoundStream.Play(); +end; + +procedure TAudioPlayback_Portaudio.PlayDrum; +begin + if DrumSoundStream <> nil then + DrumSoundStream.Play(); +end; + +procedure TAudioPlayback_Portaudio.PlayHihat; +begin + if HihatSoundStream <> nil then + HihatSoundStream.Play(); +end; + +procedure TAudioPlayback_Portaudio.PlayClap; +begin + if ClapSoundStream <> nil then + ClapSoundStream.Play(); +end; + +procedure TAudioPlayback_Portaudio.PlayShuffle; +begin + if ShuffleSoundStream <> nil then + ShuffleSoundStream.Play(); +end; + +procedure TAudioPlayback_Portaudio.StopShuffle; +begin + if ShuffleSoundStream <> nil then + ShuffleSoundStream.Stop(); +end; + +//Equalizer +function TAudioPlayback_Portaudio.GetFFTData: TFFTData; +var + data: TFFTData; +begin + //Get Channel Data Mono and 256 Values +// BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); + result := data; +end; + +// Interface for Visualizer +function TAudioPlayback_Portaudio.GetPCMData(var data: TPCMData): Cardinal; +begin + result := 0; +end; + +function TAudioPlayback_Portaudio.Load(Filename: string): TPortaudioPlaybackStream; +var + decodeStream : TAudioDecodeStream; + playbackStream : TPortaudioPlaybackStream; + csIndex : integer; +begin + result := nil; + + decodeStream := AudioDecoder.Open(Filename); + if (decodeStream = nil) then + begin + Log.LogStatus('LoadSoundFromFile: Sound not found "' + Filename + '"', 'UAudioPlayback_Portaudio'); + exit; + end; + + playbackStream := TPortaudioPlaybackStream.Create(decodeStream); + mixerStream.AddStream(playbackStream); + + //Add CustomSound + csIndex := High(CustomSounds) + 1; + SetLength(CustomSounds, csIndex + 1); + CustomSounds[csIndex].Filename := Filename; + CustomSounds[csIndex].Stream := playbackStream; + + result := playbackStream; +end; + +function TAudioPlayback_Portaudio.LoadCustomSound(const Filename: String): Cardinal; +var + S: TAudioPlaybackStream; + I: Integer; + F: String; +begin + //Search for Sound in already loaded Sounds + F := UpperCase(SoundPath + FileName); + For I := 0 to High(CustomSounds) do + begin + if (UpperCase(CustomSounds[I].Filename) = F) then + begin + Result := I; + Exit; + end; + end; + + S := Load(SoundPath + Filename); + if (S <> nil) then + Result := High(CustomSounds) + else + Result := 0; +end; + +procedure TAudioPlayback_Portaudio.PlayCustomSound(const Index: Cardinal ); +begin + if (Index <= High(CustomSounds)) then + CustomSounds[Index].Stream.Play(); +end; + + + +initialization + singleton_AudioPlaybackPortaudio := TAudioPlayback_Portaudio.create(); + AudioManager.add( singleton_AudioPlaybackPortaudio ); + +finalization + AudioManager.Remove( singleton_AudioPlaybackPortaudio ); + + +end. -- cgit v1.2.3 From 4a0e50ba0cc5bd835aaf942b65149e9613aad86e Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 28 Dec 2007 13:08:55 +0000 Subject: experimental positioning support added git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@753 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudioPlayback_Portaudio.pas | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudioPlayback_Portaudio.pas b/Game/Code/Classes/UAudioPlayback_Portaudio.pas index 36bebc8a..c2694e6d 100644 --- a/Game/Code/Classes/UAudioPlayback_Portaudio.pas +++ b/Game/Code/Classes/UAudioPlayback_Portaudio.pas @@ -46,9 +46,12 @@ type function GetLength(): real; override; function GetStatus(): TStreamStatus; override; - function ReadData(Buffer: PChar; BufSize: integer): integer; - function IsLoaded(): boolean; + + // functions delegated to the decode stream + function GetPosition: real; + procedure SetPosition(Time: real); + function ReadData(Buffer: PChar; BufSize: integer): integer; end; type @@ -269,6 +272,16 @@ begin end; end; +function TPortaudioPlaybackStream.GetPosition: real; +begin + result := decodeStream.Position; +end; + +procedure TPortaudioPlaybackStream.SetPosition(Time: real); +begin + decodeStream.Position := Time; +end; + { TAudioPlayback_Portaudio } -- cgit v1.2.3 From cdee9af63e2c7d3d6a7bfab152d197a4f1cdca03 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 8 Jan 2008 11:53:22 +0000 Subject: added my dodgey control file :) ( for deb packaging ) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@756 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStarDeluxe.control | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Game/Code/UltraStarDeluxe.control (limited to 'Game/Code') diff --git a/Game/Code/UltraStarDeluxe.control b/Game/Code/UltraStarDeluxe.control new file mode 100644 index 00000000..0fc4bf10 --- /dev/null +++ b/Game/Code/UltraStarDeluxe.control @@ -0,0 +1,9 @@ +Package: UltraStar-Deluxe +Priority: optional +Section: games +Installed-Size: 45 +Maintainer: Jay Binks +Architecture: i386 +Version: 1.1.1 +Depends: libc6 (>= 2.1), libavcodec, libavformat, libsqlite3, libsdl-ttf2.0, libsdl-image1.2, portaudio19 +Description: Ultrastar is a Karaoke game for the pc, similar to SingStar -- cgit v1.2.3 From 17b2f9f88c28fa7d598625d14a36b01eb2afaee1 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 8 Jan 2008 12:00:01 +0000 Subject: first revision of my helper script to move files to the correct locations for packaging. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@757 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/package_debian.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Game/Code/package_debian.sh (limited to 'Game/Code') diff --git a/Game/Code/package_debian.sh b/Game/Code/package_debian.sh new file mode 100644 index 00000000..b051f54e --- /dev/null +++ b/Game/Code/package_debian.sh @@ -0,0 +1,18 @@ +# This script should be run post-compile +# and i should move files to the correct location for packaging ... ( for DEB package ) + +rm -fr ../../../deb-package +clear + +mkdir ../../../deb-package +mkdir ../../../deb-package/usr +mkdir ../../../deb-package/usr/share +mkdir ../../../deb-package/usr/share/UltraStarDeluxe +mkdir ../../../deb-package/usr/bin + +cp ./UltraStar ../../../deb-package/usr/bin/UltraStarDeluxe + +cp -a ../../Themes/ ../../../deb-package/usr/share/UltraStarDeluxe/ +cp -a ../../Sounds/ ../../../deb-package/usr/share/UltraStarDeluxe/ +cp -a ../../Skins/ ../../../deb-package/usr/share/UltraStarDeluxe/ +cp -a ../../Languages/ ../../../deb-package/usr/share/UltraStarDeluxe/ -- cgit v1.2.3 From ae6207c17c53e0319a39324e5c20bdccfbbd9976 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 8 Jan 2008 12:11:00 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@758 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStarDeluxe.control | 18 +++++++++--------- Game/Code/package_debian.sh | 36 ++++++++++++++++++------------------ 2 files changed, 27 insertions(+), 27 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStarDeluxe.control b/Game/Code/UltraStarDeluxe.control index 0fc4bf10..a9fe4f14 100644 --- a/Game/Code/UltraStarDeluxe.control +++ b/Game/Code/UltraStarDeluxe.control @@ -1,9 +1,9 @@ -Package: UltraStar-Deluxe -Priority: optional -Section: games -Installed-Size: 45 -Maintainer: Jay Binks -Architecture: i386 -Version: 1.1.1 -Depends: libc6 (>= 2.1), libavcodec, libavformat, libsqlite3, libsdl-ttf2.0, libsdl-image1.2, portaudio19 -Description: Ultrastar is a Karaoke game for the pc, similar to SingStar +Package: UltraStar-Deluxe +Priority: optional +Section: games +Installed-Size: 45 +Maintainer: Jay Binks +Architecture: i386 +Version: 1.1.1 +Depends: libc6 (>= 2.1), libavcodec, libavformat, libsqlite3, libsdl-ttf2.0, libsdl-image1.2, portaudio19 +Description: Ultrastar is a Karaoke game for the pc, similar to SingStar diff --git a/Game/Code/package_debian.sh b/Game/Code/package_debian.sh index b051f54e..373c82a0 100644 --- a/Game/Code/package_debian.sh +++ b/Game/Code/package_debian.sh @@ -1,18 +1,18 @@ -# This script should be run post-compile -# and i should move files to the correct location for packaging ... ( for DEB package ) - -rm -fr ../../../deb-package -clear - -mkdir ../../../deb-package -mkdir ../../../deb-package/usr -mkdir ../../../deb-package/usr/share -mkdir ../../../deb-package/usr/share/UltraStarDeluxe -mkdir ../../../deb-package/usr/bin - -cp ./UltraStar ../../../deb-package/usr/bin/UltraStarDeluxe - -cp -a ../../Themes/ ../../../deb-package/usr/share/UltraStarDeluxe/ -cp -a ../../Sounds/ ../../../deb-package/usr/share/UltraStarDeluxe/ -cp -a ../../Skins/ ../../../deb-package/usr/share/UltraStarDeluxe/ -cp -a ../../Languages/ ../../../deb-package/usr/share/UltraStarDeluxe/ +# This script should be run post-compile +# and i should move files to the correct location for packaging ... ( for DEB package ) + +rm -fr ../../../deb-package +clear + +mkdir ../../../deb-package +mkdir ../../../deb-package/usr +mkdir ../../../deb-package/usr/share +mkdir ../../../deb-package/usr/share/UltraStarDeluxe +mkdir ../../../deb-package/usr/bin + +cp ./UltraStar ../../../deb-package/usr/bin/UltraStarDeluxe + +cp -a ../../Themes/ ../../../deb-package/usr/share/UltraStarDeluxe/ +cp -a ../../Sounds/ ../../../deb-package/usr/share/UltraStarDeluxe/ +cp -a ../../Skins/ ../../../deb-package/usr/share/UltraStarDeluxe/ +cp -a ../../Languages/ ../../../deb-package/usr/share/UltraStarDeluxe/ -- cgit v1.2.3 From 77edbade28e7aa7798fbf0518e105e27781896d9 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 8 Jan 2008 12:22:50 +0000 Subject: this script seems to build a deb now... wonder if its correct :) or if it even works !! haha git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@759 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/package_debian.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/package_debian.sh b/Game/Code/package_debian.sh index 373c82a0..7a4dfccc 100644 --- a/Game/Code/package_debian.sh +++ b/Game/Code/package_debian.sh @@ -2,9 +2,13 @@ # and i should move files to the correct location for packaging ... ( for DEB package ) rm -fr ../../../deb-package +rm -fr ../../../packages clear +mkdir ../../../packages + mkdir ../../../deb-package +mkdir ../../../deb-package/DEBIAN mkdir ../../../deb-package/usr mkdir ../../../deb-package/usr/share mkdir ../../../deb-package/usr/share/UltraStarDeluxe @@ -16,3 +20,12 @@ cp -a ../../Themes/ ../../../deb-package/usr/share/UltraStarDeluxe/ cp -a ../../Sounds/ ../../../deb-package/usr/share/UltraStarDeluxe/ cp -a ../../Skins/ ../../../deb-package/usr/share/UltraStarDeluxe/ cp -a ../../Languages/ ../../../deb-package/usr/share/UltraStarDeluxe/ + +cp UltraStarDeluxe.control ../../../deb-package/DEBIAN/control + +cd ../../../ + +dpkg-deb --build ./deb-package +mv deb-package.deb ./packages/UltraStarDeluxe_1.1_i386.deb + +rm -fr ../../../deb-package -- cgit v1.2.3 From 803a451d8addfe84c6b7f34a691357db0b432baf Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 8 Jan 2008 12:47:25 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@760 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStarDeluxe.control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStarDeluxe.control b/Game/Code/UltraStarDeluxe.control index a9fe4f14..cfbbfc13 100644 --- a/Game/Code/UltraStarDeluxe.control +++ b/Game/Code/UltraStarDeluxe.control @@ -5,5 +5,5 @@ Installed-Size: 45 Maintainer: Jay Binks Architecture: i386 Version: 1.1.1 -Depends: libc6 (>= 2.1), libavcodec, libavformat, libsqlite3, libsdl-ttf2.0, libsdl-image1.2, portaudio19 +Depends: libc6 (>= 2.1), libsdl1.2debian-alsa, libportaudio2, libavcodec0d, libavformat0d, libsqlite3-0, libsdl-ttf2.0-0, libsdl-image1.2 Description: Ultrastar is a Karaoke game for the pc, similar to SingStar -- cgit v1.2.3 From 269105ab3d8c4cad1d1f6156850b893d8ed24390 Mon Sep 17 00:00:00 2001 From: wesleyprofox Date: Tue, 8 Jan 2008 15:35:46 +0000 Subject: Use /bin/bash to execute lazres-UltraStar.sh as a temporary solution to be able to compile the resources (better solution would be to make the script fully POSIX-compliant) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@761 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Makefile | 2 +- Game/Code/lazres-UltraStar.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Makefile b/Game/Code/Makefile index fcf534cd..85f7ae67 100644 --- a/Game/Code/Makefile +++ b/Game/Code/Makefile @@ -64,6 +64,6 @@ clean_obj: clean_res: rm -f UltraStar.lrs link.res UltraStar.lrs: UltraStar.rc - sh lazres-UltraStar.sh + ./lazres-UltraStar.sh .PHONY: all resource ultrastar install clean distclean clean_obj clean_res diff --git a/Game/Code/lazres-UltraStar.sh b/Game/Code/lazres-UltraStar.sh index 603ec4be..bd3f130d 100755 --- a/Game/Code/lazres-UltraStar.sh +++ b/Game/Code/lazres-UltraStar.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ## # Creates an .lrs resource-file. -- cgit v1.2.3 From 26dc68d67f6906c186912fbf00962f4aebe17d94 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Wed, 9 Jan 2008 20:02:01 +0000 Subject: Added readme and scripts for building and patching ffmpeg on OS X. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@762 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/ffmpeg/src/MacOSX/MacOSXReadMe.txt | 23 ++++++++++++++++++++++ Game/Code/lib/ffmpeg/src/MacOSX/build_ffmpeg.sh | 6 ++++++ .../lib/ffmpeg/src/MacOSX/copy_and_patch_dylibs.sh | 23 ++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 Game/Code/lib/ffmpeg/src/MacOSX/MacOSXReadMe.txt create mode 100755 Game/Code/lib/ffmpeg/src/MacOSX/build_ffmpeg.sh create mode 100755 Game/Code/lib/ffmpeg/src/MacOSX/copy_and_patch_dylibs.sh (limited to 'Game/Code') diff --git a/Game/Code/lib/ffmpeg/src/MacOSX/MacOSXReadMe.txt b/Game/Code/lib/ffmpeg/src/MacOSX/MacOSXReadMe.txt new file mode 100644 index 00000000..59e54e04 --- /dev/null +++ b/Game/Code/lib/ffmpeg/src/MacOSX/MacOSXReadMe.txt @@ -0,0 +1,23 @@ + +How to download an build ffmpeg for UltraStar Deluxe on Mac OS X: + +1. Open a terminal. + +2. cd into the Game/Code/lib/ffmpeg/src/MacOSX directory + +3. Run the following command: + +svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg + +4. The compile ffmpeg. I made a script for this: + +./build_ffmpeg.sh + +5. On OS X you have to patch the the dylibs. Run the following + script. It patches the dylibs and copies them to the + lib/ffmpeg dir: + +./copy_and_patch_dylibs.sh + + +You're done. diff --git a/Game/Code/lib/ffmpeg/src/MacOSX/build_ffmpeg.sh b/Game/Code/lib/ffmpeg/src/MacOSX/build_ffmpeg.sh new file mode 100755 index 00000000..bcb3ca1e --- /dev/null +++ b/Game/Code/lib/ffmpeg/src/MacOSX/build_ffmpeg.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +cd ffmpeg +./configure --enable-shared --disable-static --disable-mmx +make + diff --git a/Game/Code/lib/ffmpeg/src/MacOSX/copy_and_patch_dylibs.sh b/Game/Code/lib/ffmpeg/src/MacOSX/copy_and_patch_dylibs.sh new file mode 100755 index 00000000..064d2ecc --- /dev/null +++ b/Game/Code/lib/ffmpeg/src/MacOSX/copy_and_patch_dylibs.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Copy dylibs: +cp ffmpeg/libavcodec/libavcodec.51.dylib ../../libavcodec.dylib +cp ffmpeg/libavformat/libavformat.52.dylib ../../libavformat.dylib +cp ffmpeg/libavutil/libavutil.49.dylib ../../libavutil.dylib + +# Patching libavcodec: +install_name_tool -id @executable_path/libavcodec.dylib ../../libavcodec.dylib +install_name_tool -change /usr/local/lib/libavutil.dylib @executable_path/libavutil.dylib ../../libavcodec.dylib + +# Patching libavformat: +install_name_tool -id @executable_path/libavformat.dylib ../../libavformat.dylib +install_name_tool -change /usr/local/lib/libavutil.dylib @executable_path/libavutil.dylib ../../libavformat.dylib +install_name_tool -change /usr/local/lib/libavcodec.dylib @executable_path/libavcodec.dylib ../../libavformat.dylib + +# Patching libavcodec: +install_name_tool -id @executable_path/libavutil.dylib ../../libavutil.dylib + +# Printing result: +otool -L ../../libavutil.dylib +otool -L ../../libavcodec.dylib +otool -L ../../libavformat.dylib \ No newline at end of file -- cgit v1.2.3 From 77f3d0dcae9fe77a8d3cef1825756741b6d269ee Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Wed, 9 Jan 2008 21:04:41 +0000 Subject: The constant NAN causes a range check error on OS X. I've set LastDrawBeat to 0 - would this be OK for all Platforms? git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@763 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/ULyrics.pas | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Classes/ULyrics.pas b/Game/Code/Classes/ULyrics.pas index 0d709eef..165084a8 100644 --- a/Game/Code/Classes/ULyrics.pas +++ b/Game/Code/Classes/ULyrics.pas @@ -153,7 +153,12 @@ begin PQueueLine:=@QueueLine; UseLinearFilter := True; + {$IFDEF DARWIN} + // eddie: Getting range check error with NAN on OS X: + LastDrawBeat:=0; + {$ELSE} LastDrawBeat:=NAN; + {$ENDIF} end; Constructor TLyricEngine.Create(ULX,ULY,ULW,ULS,LLX,LLY,LLW,LLS:Real); @@ -197,7 +202,12 @@ begin PUpperline:=@UpperLine; PLowerLine:=@LowerLine; PQueueLine:=@QueueLine; + {$IFDEF DARWIN} + // eddie: Getting range check error with NAN on OS X: + LastDrawBeat:=0; + {$ELSE} LastDrawBeat:=NAN; + {$ENDIF} end; -- cgit v1.2.3 From 49d52afc94a97f808adc246247989244ef2071ff Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Wed, 9 Jan 2008 21:05:38 +0000 Subject: Added the new GetxxxxPath functions for OS X. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@764 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlatformMacOSX.pas | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlatformMacOSX.pas b/Game/Code/Classes/UPlatformMacOSX.pas index 4e0c9061..ff369049 100644 --- a/Game/Code/Classes/UPlatformMacOSX.pas +++ b/Game/Code/Classes/UPlatformMacOSX.pas @@ -16,7 +16,9 @@ type private public Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override; - function GetGamePath: WideString; override; + function GetLogPath : WideString; override; + function GetGameSharedPath : WideString; override; + function GetGameUserPath : WideString; override; end; implementation @@ -26,7 +28,7 @@ uses SysUtils, baseunix; // Mac applications are packaged in directories. // We have to cut the last two directories // to get the application directory. -Function TPlatformMacOSX.GetGamePath : WideString; +Function GetBundlePath : WideString; var x, i : integer; @@ -41,6 +43,21 @@ begin end; end; +function TPlatformMacOSX.GetLogPath : WideString; +begin + Result := GetBundlePath; +end; + +function TPlatformMacOSX.GetGameSharedPath : WideString; +begin + Result := GetBundlePath; +end; + +function TPlatformMacOSX.GetGameUserPath : WideString; +begin + Result := GetBundlePath; +end; + Function TPlatformMacOSX.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; var i : Integer; -- cgit v1.2.3 From 19986ca4e578add66672d6597862e51221ac3666 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Wed, 9 Jan 2008 21:07:38 +0000 Subject: Changed BrowsePos from Cardinal to Integer, because of range check errors at runtime. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@765 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/USongs.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 31db883d..a4709b43 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -104,7 +104,7 @@ type TSongs = class( TThread ) {$ENDIF} private - BrowsePos : Cardinal; //Actual Pos in Song Array + BrowsePos : Integer; //Actual Pos in Song Array. eddie: Must be int, because it could be decremented to -1. fNotify , fWatch : longint; fParseSongDirectory : boolean; -- cgit v1.2.3 From 57b182981383609a328f5766def62542a0a3c288 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Wed, 9 Jan 2008 21:08:42 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@766 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/MacOSX/UltraStarDX.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/MacOSX/UltraStarDX.pas b/Game/Code/MacOSX/UltraStarDX.pas index cab748c6..59a0880f 100644 --- a/Game/Code/MacOSX/UltraStarDX.pas +++ b/Game/Code/MacOSX/UltraStarDX.pas @@ -1,6 +1,6 @@ program UltraStarDX; -uses cthreads, UMain, UMedia_dummy, UAudio_FFMpeg, UAudio_bass, USingNotes, UTextClasses, UVideo; +uses cthreads, UMain, UMedia_dummy, UAudio_bass, USingNotes, UTextClasses, UVideo; begin Main; -- cgit v1.2.3 From 7756a7a686a8d5d348088382079316e733b67a96 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Wed, 9 Jan 2008 21:09:12 +0000 Subject: Changed MACOS define to DARWIN. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@767 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/portaudio/delphi/portaudio.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/lib/portaudio/delphi/portaudio.pas b/Game/Code/lib/portaudio/delphi/portaudio.pas index a01808ab..31f9ee3a 100644 --- a/Game/Code/lib/portaudio/delphi/portaudio.pas +++ b/Game/Code/lib/portaudio/delphi/portaudio.pas @@ -62,7 +62,7 @@ const {$IFDEF LINUX} LibName = 'libportaudio.so'; {$ENDIF} -{$IFDEF MACOS} +{$IFDEF DARWIN} LibName = 'libportaudio.dylib'; {$ENDIF} -- cgit v1.2.3 From 167a453b22fe86c327b0b3cd1948e1fb919c13bb Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Wed, 9 Jan 2008 22:26:48 +0000 Subject: Added UTF8-Conversion for values read out of the txt file. This must be done only on OS X. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@768 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UFiles.pas | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index 274bf404..69beefe9 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -54,6 +54,7 @@ implementation uses TextGL, UIni, + UPlatform, UMain; //-------------------- @@ -131,6 +132,15 @@ begin //Check the Identifier (If Value is given) if (Length(Value) <> 0) then begin + + {$IFDEF DARWIN} + if ((Identifier = 'MP3') or (Identifier = 'COVER') or (Identifier = 'BACKGROUND') or (Identifier = 'VIDEO')) then + begin + // Filenames on OS X must be UTF8: + Value := Utf8Encode(Value); + end; + {$ENDIF} + //----------- //Required Attributes @@ -332,7 +342,7 @@ Result := False; //Open File and set File Pointer to the beginning AssignFile(SongFile, Song.Path + Song.FileName); - + // if assinged( SongFile ) then begin try -- cgit v1.2.3 From 48be9f5bdc2050578789af544d4575d0b4dffed2 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Wed, 9 Jan 2008 22:27:55 +0000 Subject: Changed the GamePath. Now the GamePath is loaded from Platform.GetGameUserPath. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@769 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UIni.pas | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index abbef723..e4f5e823 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -174,6 +174,7 @@ uses //UFiles, UMain, SDL, ULanguage, + UPlatform, USkins, URecord, UCommandLine; @@ -197,7 +198,7 @@ var end; begin - GamePath := ExtractFilePath(ParamStr(0)); + GamePath := Platform.GetGameUserPath; if (Params.ConfigFile <> '') then try -- cgit v1.2.3 From 31195a7ab6e264d325a589b1dd6673d6ba3d0e5a Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Wed, 9 Jan 2008 22:29:28 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@770 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlatform.pas | 8 +++----- Game/Code/Classes/UPlatformMacOSX.pas | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlatform.pas b/Game/Code/Classes/UPlatform.pas index bdd6cf78..19a960e7 100644 --- a/Game/Code/Classes/UPlatform.pas +++ b/Game/Code/Classes/UPlatform.pas @@ -29,7 +29,7 @@ type ['{63A5EBC3-3F4D-4F23-8DFB-B5165FCA23DF}'] Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; - + function GetLogPath : WideString; function GetGameSharedPath : WideString; function GetGameUserPath : WideString; @@ -40,8 +40,8 @@ type // DirectoryFindFiles returns all files matching the filter. Do not use '*' in the filter. // If you set ReturnAllSubDirs = true all directories will be returned, if yout set it to false // directories are completely ignored. - Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; virtual; abstract; - + function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; virtual; abstract; + function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; virtual; // function GetGamePath : WideString; virtual; @@ -93,8 +93,6 @@ begin result := ExtractFilePath(ParamStr(0)); end; - - function TPlatform.TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; begin // Linux and Mac don't check for running apps at the moment diff --git a/Game/Code/Classes/UPlatformMacOSX.pas b/Game/Code/Classes/UPlatformMacOSX.pas index ff369049..a418919c 100644 --- a/Game/Code/Classes/UPlatformMacOSX.pas +++ b/Game/Code/Classes/UPlatformMacOSX.pas @@ -15,7 +15,7 @@ type TPlatformMacOSX = class(TPlatform) private public - Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override; + function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override; function GetLogPath : WideString; override; function GetGameSharedPath : WideString; override; function GetGameUserPath : WideString; override; -- cgit v1.2.3 From bb15f9bc1bbe2e53778c38faab2ffc3169a99c18 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Wed, 9 Jan 2008 22:33:09 +0000 Subject: Changed DLL/so/dylib constants. Changed TAVFormatContext fiels "pb" from structure to pointer. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@771 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/ffmpeg/avformat.pas | 1407 +++++++++++++++++++------------------ 1 file changed, 706 insertions(+), 701 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/lib/ffmpeg/avformat.pas b/Game/Code/lib/ffmpeg/avformat.pas index 6e30865f..4b130dd3 100644 --- a/Game/Code/lib/ffmpeg/avformat.pas +++ b/Game/Code/lib/ffmpeg/avformat.pas @@ -1,701 +1,706 @@ - (* - * copyright (c) 2001 Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) - -(* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. -For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT -in the source codes *) - -unit avformat; - -{$IFDEF FPC} - {$IFNDEF win32} - {$LINKLIB libavutil} - {$LINKLIB libavformat} - {$ENDIF} - - {$MODE DELPHI } (* CAT *) - {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) - {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) -{$ENDIF} - -interface - -uses - avcodec, - avio, - rational, - avutil; (* CAT *) - -const - - -{$IFDEF win32} - av__format = 'avformat-50.dll'; -{$ELSE} - av__format = 'libavformat.so'; // .0d - //av__format = 'libavformat.51'; (* CAT *) -{$ENDIF} - - LIBAVUTIL_VERSION_INT = ((51 shl 16) + (12 shl 8) + 1); - LIBAVUTIL_VERSION = '51.12.1'; - LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; - - MAXINT64 = $7fffffffffffffff; - MININT64 = $8000000000000000; - - PKT_FLAG_KEY = $0001; - -(*************************************************) -(* input/output formats *) - - AVPROBE_SCORE_MAX = 100; ///< max score, half of that is used for file extension based detection - AVPROBE_PADDING_SIZE = 32; ///< extra allocated bytes at the end of the probe buffer - -//! demuxer will use url_fopen, no opened file should be provided by the caller - AVFMT_NOFILE = $0001; - AVFMT_NEEDNUMBER = $0002; (**< needs '%d' in filename *) - AVFMT_SHOW_IDS = $0008; (**< show format stream IDs numbers *) - AVFMT_RAWPICTURE = $0020; (**< format wants AVPicture structure for - raw picture data *) - AVFMT_GLOBALHEADER = $0040; (**< format wants global header *) - AVFMT_NOTIMESTAMPS = $0080; (**< format does not need / have any timestamps *) - AVFMT_GENERIC_INDEX = $0100; (**< use generic index building code *) - - AVINDEX_KEYFRAME = $0001; - - MAX_REORDER_DELAY = 4; - - AVFMTCTX_NOHEADER = $0001; (**< signal that no header is present - (streams are added dynamically) *) - MAX_STREAMS = 20; - AVFMT_NOOUTPUTLOOP = -1; - AVFMT_INFINITEOUTPUTLOOP = 0; - AVFMT_FLAG_GENPTS = $0001; ///< generate pts if missing even if it requires parsing future frames - AVFMT_FLAG_IGNIDX = $0002; ///< ignore index - AVFMT_FLAG_NONBLOCK = $0004; ///< do not block when reading packets from input - -type - HFILE = THandle; /// (* CAT *) - int = integer; - - PAVPacket = ^TAVPacket; - PAVImageFormat = ^TAVImageFormat; - PAVFormatContext = ^TAVFormatContext; - PAVFormatParameters = ^TAVFormatParameters; - PAVOutputFormat = ^TAVOutputFormat; - PAVProbeData = ^TAVProbeData; - PAVInputFormat = ^TAVInputFormat; - PAVIndexEntry = ^TAVIndexEntry; - PAVStream = ^TAVStream; - PAVPacketList = ^TAVPacketList; - PAVImageInfo = ^TAVImageInfo; - - TAVPacket = record {56} - pts: int64; ///< presentation time stamp in time_base units - dts: int64; ///< decompression time stamp in time_base units - data: PByte; - size: integer; - stream_index: integer; - flags: integer; - duration: integer; ///< presentation duration in time_base units (0 if not available) - destruct: procedure (p: PAVPacket); cdecl; (* This cannot be var : TAVPacket. - because TAVPacket is not completely defined yet *) - priv: pointer; - pos: int64 ///< byte position in stream, -1 if unknown - end; - -(*************************************************) -(* fractional numbers for exact pts handling *) - -(* the exact value of the fractional number is: 'val + num / den'. num - is assumed to be such as 0 <= num < den *) - PAVFrac = ^TAVFrac; - TAVFrac = record - val, num, den: int64; - end; - -(* this structure contains the data a format has to probe a file *) - TAVProbeData = record {12} - filename: pchar; - buf: pchar; - buf_size: integer; - end; - - TAVFormatParameters = record {56} - time_base: TAVRational; (* 8 bytes *) - sample_rate: integer; - channels: integer; - width: integer; - height: integer; - pix_fmt: TAVPixelFormat; -{ image_format: PAVImageFormat; (* 4 bytes *)} (* CAT#3 *) - channel: integer; (* used to select dv channel *) - device: pchar; (* video, audio or DV device, if LIBAVFORMAT_VERSION_INT < (52<<16) *) - standard: pchar; (* tv standard, NTSC, PAL, SECAM *) -// int mpeg2ts_raw:1; (* force raw MPEG2 transport stream output, if possible *) -// int mpeg2ts_compute_pcr:1; (* compute exact PCR for each transport -// stream packet (only meaningful if -// mpeg2ts_raw is TRUE *) -// int initial_pause:1; (* do not begin to play the stream -// immediately (RTSP only) *) -// int prealloced_context:1; - dummy: byte; - video_codec_id: TCodecID; - audio_codec_id: TCodecID; - end; - - TAVOutputFormat = record {56} - name: pchar; - long_name: pchar; - mime_type: pchar; - extensions: pchar; (* comma separated extensions *) - (* size of private data so that it can be allocated in the wrapper *) - priv_data_size: integer; - (* output support *) - audio_codec: TCodecID; (* default audio codec *) - video_codec: TCodecID; (* default video codec *) - write_header: function (c: PAVFormatContext): integer; cdecl; - write_packet: function (c: PAVFormatContext; var pkt: TAVPacket): integer; cdecl; (* CAT#2 *) - write_trailer: function (c: PAVFormatContext): integer; cdecl; - (* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER *) - flags: integer; - (* currently only used to set pixel format if not YUV420P *) - set_parameters: function (c: PAVFormatContext; f: PAVFormatParameters): integer; cdecl; - interleave_packet: function (s: PAVFormatContext; _out: PAVPacket; _in: PAVPacket; flush: integer): integer; cdecl; - - (** - * list of supported codec_id-codec_tag pairs, ordered by "better choice first" - * the arrays are all CODEC_ID_NONE terminated - *) - //const struct AVCodecTag **codec_tag; - - (* private fields *) - next: PAVOutputFormat; - end; - - TAVInputFormat = record {60} - name: pchar; - long_name: pchar; - (* size of private data so that it can be allocated in the wrapper *) - priv_data_size: integer; - (* tell if a given file has a chance of being parsing by this format *) - read_probe: function (p: PAVProbeData): integer; cdecl; - (* read the format header and initialize the AVFormatContext - structure. Return 0 if OK. 'ap' if non NULL contains - additionnal paramters. Only used in raw format right - now. 'av_new_stream' should be called to create new streams. *) - read_header: function (c: PAVFormatContext; ap: PAVFormatParameters): integer; cdecl; - (* read one packet and put it in 'pkt'. pts and flags are also - set. 'av_new_stream' can be called only if the flag - AVFMTCTX_NOHEADER is used. *) - read_packet: function (c: PAVFormatContext; var pkt: TAVPacket): integer; cdecl; - (* close the stream. The AVFormatContext and AVStreams are not - freed by this function *) - read_close: function (c: PAVFormatContext): integer; cdecl; - (*** seek to a given timestamp relative to the frames in - * stream component stream_index - * @param stream_index must not be -1 - * @param flags selects which direction should be preferred if no exact - * match is available *) - read_seek: function (c: PAVFormatContext; stream_index: integer; - timestamp: int64; flags: integer): integer; cdecl; - (*** gets the next timestamp in AV_TIME_BASE units. *) - read_timestamp: function (s: PAVFormatContext; stream_index: integer; - pos: pint64; pos_limit: int64): integer; cdecl; - (* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER *) - flags: integer; - (* if extensions are defined, then no probe is done. You should - usually not use extension format guessing because it is not - reliable enough *) - extensions: pchar; - (* general purpose read only value that the format can use *) - value: integer; - - (* start/resume playing - only meaningful if using a network based format (RTSP) *) - read_play: function (c: PAVFormatContext): integer; cdecl; - - (* pause playing - only meaningful if using a network based format (RTSP) *) - read_pause: function (c: PAVFormatContext): integer; cdecl; - - //const struct AVCodecTag **codec_tag; - - (* private fields *) - next: PAVInputFormat; - end; - - TAVStreamParseType = ( - AVSTREAM_PARSE_NONE, - AVSTREAM_PARSE_FULL, (**< full parsing and repack *) - AVSTREAM_PARSE_HEADERS, (**< only parse headers, don't repack *) - AVSTREAM_PARSE_TIMESTAMPS (**< full parsing and interpolation of timestamps for frames not starting on packet boundary *) - ); - - TAVIndexEntry = record {24} - pos: int64; - timestamp: int64; -(* the following 2 flags indicate that the next/prev keyframe is known, and scaning for it isnt needed *) - flags: integer; -// int flags:2; -// int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs 32 byte due to possible 8byte align). - min_distance: integer; (* min distance between this and the previous keyframe, used to avoid unneeded searching *) - end; - - TAVStream = record {168} - index: integer; (* stream index in AVFormatContext *) {4-4} - id: integer; (* format specific stream id *) {4-8} - codec: PAVCodecContext; (* codec context *) {4-12} - (*** real base frame rate of the stream. - * for example if the timebase is 1/90000 and all frames have either - * approximately 3600 or 1800 timer ticks then r_frame_rate will be 50/1 *) - r_frame_rate: TAVRational; {4*2=8-20} - priv_data: pointer; {4-24} - (* internal data used in av_find_stream_info() *) - codec_info_duration: int64; (* #if LIBAVFORMAT_VERSION_INT < (52<<16) *) {8-32} - codec_info_nb_frames: integer; (* #if LIBAVFORMAT_VERSION_INT < (52<<16) *) {4-38} - (* encoding: PTS generation when outputing stream *) - pts: TAVFrac; {8*3=24-62} - - (*** this is the fundamental unit of time (in seconds) in terms - * of which frame timestamps are represented. for fixed-fps content, - * timebase should be 1/framerate and timestamp increments should be - * identically 1. *) - time_base: TAVRational; {4*2=8-70} - pts_wrap_bits: integer; (* number of bits in pts (used for wrapping control) *) {4-74} - (* ffmpeg.c private use *) - stream_copy: integer; (* if TRUE, just copy stream *) {4-78} - discard: TAVDiscard; ///< selects which packets can be discarded at will and dont need to be demuxed {4-82} - //FIXME move stuff to a flags field? - (* quality, as it has been removed from AVCodecContext and put in AVVideoFrame - * MN:dunno if thats the right place, for it *) - quality: single; {4-86} - (* decoding: position of the first frame of the component, in AV_TIME_BASE fractional seconds. *) - start_time: int64; {8-92} - (* decoding: duration of the stream, in stream time base. *) - duration: int64; {8-100} - - language: array [0..3] of char; (* ISO 639 3-letter language code (empty string if undefined) *)(* 101 th byte - 1 base *) {4-104} - - (* av_read_frame() support *) - need_parsing: TAVStreamParseType;//CAT#3 ///< 1->full parsing needed, 2->only parse headers dont repack - parser: PAVCodecParserContext; - - cur_dts: int64; - last_IP_duration: integer; - last_IP_pts: int64; - (* av_seek_frame() support *) - index_entries: PAVIndexEntry; (* only used if the format does not support seeking natively *) - nb_index_entries: integer; - index_entries_allocated_size: cardinal; (* CAT#3 *) - - nb_frames: int64; ///< number of frames in this stream if known or 0 - pts_buffer: array [0..MAX_REORDER_DELAY] of int64 - end; - -(* format I/O context *) - TAVFormatContext = record {3960} - av_class: PAVClass; (* set by av_alloc_format_context *) - (* can only be iformat or oformat, not both at the same time *) - iformat: PAVInputFormat; - oformat: PAVOutputFormat; - priv_data: pointer; - pb: TByteIOContext; - nb_streams: cardinal; (* CAT#3 *) - streams: array [0..MAX_STREAMS - 1] of PAVStream; - filename: array [0..1023] of char; (* input or output filename *) - (* stream info *) - timestamp: int64; - title: array [0..511] of char; - author: array [0..511] of char; - copyright: array [0..511] of char; - comment: array [0..511] of char; - album: array [0..511] of char; - year: integer; (* ID3 year, 0 if none *) - track: integer; (* track number, 0 if none *) - genre: array [0..31] of char; (* ID3 genre *) - - ctx_flags: integer; (* format specific flags, see AVFMTCTX_xx *) - (* private data for pts handling (do not modify directly) *) - (* This buffer is only needed when packets were already buffered but - not decoded, for example to get the codec parameters in mpeg - streams *) - packet_buffer: PAVPacketList; - - (* decoding: position of the first frame of the component, in - AV_TIME_BASE fractional seconds. NEVER set this value directly: - it is deduced from the AVStream values. *) - start_time: int64; - (* decoding: duration of the stream, in AV_TIME_BASE fractional - seconds. NEVER set this value directly: it is deduced from the - AVStream values. *) - duration: int64; - (* decoding: total file size. 0 if unknown *) - file_size: int64; - (* decoding: total stream bitrate in bit/s, 0 if not - available. Never set it directly if the file_size and the - duration are known as ffmpeg can compute it automatically. *) - bit_rate: integer; - - (* av_read_frame() support *) - cur_st: PAVStream; - cur_ptr: pbyte; - cur_len: integer; - cur_pkt: TAVPacket; - - (* av_seek_frame() support *) - data_offset: int64; (* offset of the first packet *) - index_built: integer; - - mux_rate: integer; - packet_size: integer; - preload: integer; - max_delay: integer; - - (* number of times to loop output in formats that support it *) - loop_output: integer; - - flags: integer; - loop_input: integer; - (* decoding: size of data to probe; encoding unused *) - probesize: cardinal; - - (** - * maximum duration in AV_TIME_BASE units over which the input should be analyzed in av_find_stream_info() - *) - max_analyze_duration: integer; - - key: pbyte; - keylen : integer - end; - - TAVPacketList = record {64} - pkt: TAVPacket; - next: PAVPacketList; - end; - -(* still image support *) - PAVInputImageContext = pointer; // attribute_deprecated; -// PAVInputImageContext = pointer; //AVInputImageContext attribute_deprecated; - -(* still image support *) - TAVImageInfo = record {48} - pix_fmt: TAVPixelFormat; (* requested pixel format *) - width: integer; (* requested width *) - height: integer; (* requested height *) - interleaved: integer; (* image is interleaved (e.g. interleaved GIF) *) - pict: TAVPicture; (* returned allocated image *) - end; - - TAVImageFormat = record {32} - name: pchar; - extensions: pchar; - (* tell if a given file has a chance of being parsing by this format *) - img_probe: function (d: PAVProbeData): integer; cdecl; - (* read a whole image. 'alloc_cb' is called when the image size is - known so that the caller can allocate the image. If 'allo_cb' - returns non zero, then the parsing is aborted. Return '0' if - OK. *) - img_read: function (b: PByteIOContext; alloc_cb: pointer; ptr: pointer): integer; cdecl; - (* write the image *) - supported_pixel_formats: integer; (* mask of supported formats for output *) - img_write: function (b: PByteIOContext; i: PAVImageInfo): integer; cdecl; - flags: integer; - next: PAVImageFormat; - end; - -procedure av_destruct_packet_nofree (var pkt: TAVPacket); (* CAT#2 *) - cdecl; external av__format; -procedure av_destruct_packet (var pkt: TAVPacket); (* CAT#2 *) - cdecl; external av__format; - -(* initialize optional fields of a packet *) -procedure av_init_packet (var pkt: TAVPacket); (* CAT#2 *) - -function av_new_packet(var pkt: TAVPacket; size: integer): integer; (* CAT#2 *) - cdecl; external av__format; - -function av_get_packet (s: PByteIOContext; var pkt: TAVPacket; size: integer): integer; (* CAT#2 *) - cdecl; external av__format; - -function av_dup_packet (pkt: PAVPacket): integer; - cdecl; external av__format; - -(** * Free a packet - * - * @param pkt packet to free *) -procedure av_free_packet (var pkt: TAVPacket); (* CAT#2 *) - -procedure av_register_image_format (img_fmt: PAVImageFormat); - cdecl; external av__format; - -function av_probe_image_format (pd: PAVProbeData): PAVImageFormat; - cdecl; external av__format; - -function guess_image_format (filename: pchar): PAVImageFormat; - cdecl; external av__format; - -function av_guess_image2_codec(filename: pchar): TCodecID; - cdecl; external av__format; - -function av_read_image (pb: PByteIOContext; filename: pchar; - fmt: PAVImageFormat; - alloc_cb: pointer; opaque: pointer): integer; - cdecl; external av__format; - -function av_write_image(pb: PByteIOContext; fmt: PAVImageFormat; img: PAVImageInfo): integer; - cdecl; external av__format; - -(* XXX: use automatic init with either ELF sections or C file parser *) -(* modules *) - -//#include "rtp.h" - -//#include "rtsp.h" - -(* utils.c *) - procedure av_register_input_format (format: PAVInputFormat); - cdecl; external av__format; - - procedure av_register_output_format (format: PAVOutputFormat); - cdecl; external av__format; - - function guess_stream_format (short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; - cdecl; external av__format; - - function guess_format(short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; - cdecl; external av__format; - - function av_guess_codec(fmt: PAVOutputFormat; short_name: pchar; - filename: pchar; mime_type: pchar; _type: TCodecType): TCodecID; - cdecl; external av__format; - - procedure av_hex_dump (f: HFILE; buf: pchar; size: integer); - cdecl; external av__format; - procedure av_pkt_dump(f: HFILE; var pkt: TAVPacket; dump_payload: integer); (* CAT#2 *) - cdecl; external av__format; - - procedure av_register_all (); - cdecl; external av__format; - - -(* media file input *) - function av_find_input_format (short_name: pchar): PAVInputFormat; - cdecl; external av__format; - function av_probe_input_format (pd: PAVProbeData; is_opened: integer): PAVInputFormat; - cdecl; external av__format; - function av_open_input_stream (ic_ptr: PAVFormatContext; - pb: PByteIOContext; filename: pchar; - fmt: PAVInputFormat; ap: PAVFormatParameters): integer; - cdecl; external av__format; -(*** Open a media file as input. The codec are not opened. Only the file - * header (if present) is read. - * - * @param ic_ptr the opened media file handle is put here - * @param filename filename to open. - * @param fmt if non NULL, force the file format to use - * @param buf_size optional buffer size (zero if default is OK) - * @param ap additionnal parameters needed when opening the file (NULL if default) - * @return 0 if OK. AVERROR_xxx otherwise. *) - - function av_open_input_file (var ic_ptr: PAVFormatContext; filename: pchar; - fmt: PAVInputFormat; buf_size: integer; - ap: PAVFormatParameters): integer; - cdecl; external av__format; - - (* no av_open for output, so applications will need this: *) - function av_alloc_format_context (): PAVFormatContext; - cdecl; external av__format; - -const - AVERROR_UNKNOWN =(-1); (* unknown error *) - AVERROR_IO =(-2); (* i/o error *) - AVERROR_NUMEXPECTED =(-3); (* number syntax expected in filename *) - AVERROR_INVALIDDATA =(-4); (* invalid data found *) - AVERROR_NOMEM =(-5); (* not enough memory *) - AVERROR_NOFMT =(-6); (* unknown format *) - AVERROR_NOTSUPP =(-7); (* operation not supported *) - -(*** Read the beginning of a media file to get stream information. This - * is useful for file formats with no headers such as MPEG. This - * function also compute the real frame rate in case of mpeg2 repeat - * frame mode. - * - * @param ic media file handle - * @return >=0 if OK. AVERROR_xxx if error. - * @todo let user decide somehow what information is needed so we dont waste time geting stuff the user doesnt need *) - - function av_find_stream_info (ic: PAVFormatContext): integer; - cdecl; external av__format; - function av_read_packet (s: PAVFormatContext; var pkt: TAVPacket): integer; (* CAT#2 *) - cdecl; external av__format; -(*** Return the next frame of a stream. - * - * The returned packet is valid - * until the next av_read_frame() or until av_close_input_file() and - * must be freed with av_free_packet. For video, the packet contains - * exactly one frame. For audio, it contains an integer number of - * frames if each frame has a known fixed size (e.g. PCM or ADPCM - * data). If the audio frames have a variable size (e.g. MPEG audio), - * then it contains one frame. - * - * pkt->pts, pkt->dts and pkt->duration are always set to correct - * values in AV_TIME_BASE unit (and guessed if the format cannot - * provided them). pkt->pts can be AV_NOPTS_VALUE if the video format - * has B frames, so it is better to rely on pkt->dts if you do not - * decompress the payload. - * - * @return 0 if OK, < 0 if error or end of file. *) - - function av_read_frame (s: PAVFormatContext; var pkt: TAVPacket): integer; (* CAT#2 *) - cdecl; external av__format; - function av_seek_frame (s: PAVFormatContext; stream_index: integer; timestamp: int64; flags: integer): integer; - cdecl; external av__format; - function av_read_play (s: PAVFormatContext): integer; - cdecl; external av__format; - function av_read_pause (s: PAVFormatContext): integer; - cdecl; external av__format; - procedure av_close_input_file (s: PAVFormatContext); - cdecl; external av__format; - function av_new_stream (s: PAVFormatContext; id: integer): PAVStream; - cdecl; external av__format; - procedure av_set_pts_info (s: PAVStream; pts_wrap_bits: integer; - pts_num: integer; pts_den: integer); - cdecl; external av__format; - -const - AVSEEK_FLAG_BACKWARD =1; ///< seek backward - AVSEEK_FLAG_BYTE =2; ///< seeking based on position in bytes - AVSEEK_FLAG_ANY =4; ///< seek to any frame, even non keyframes - - function av_find_default_stream_index (s: PAVFormatContext): integer; - cdecl; external av__format; - function av_index_search_timestamp (st: PAVStream; timestamp: int64; flags: integer): integer; - cdecl; external av__format; - function av_add_index_entry (st: PAVStream; pos: int64; timestamp: int64; - distance: integer; flags: integer): integer; - cdecl; external av__format; - function av_seek_frame_binary (s: PAVFormatContext; stream_index: integer; - target_ts: int64; flags: integer): integer; - cdecl; external av__format; - - procedure av_update_cur_dts (s: PAVFormatContext; ref_st: PAVStream; - timestamp: int64); - cdecl; external av__format; - -(* media file output *) - function av_set_parameters (s: PAVFormatContext; ap: PAVFormatParameters): integer; - cdecl; external av__format; - - function av_write_header (s: PAVFormatContext): integer; - cdecl; external av__format; - - function av_write_frame(s: PAVFormatContext; var pkt: TAVPacket): integer; - cdecl; external av__format; (* CAT#2 *) - - function av_interleaved_write_frame (s: PAVFormatContext; var pkt: TAVPacket): integer; - cdecl; external av__format; (* CAT#2 *) - - function av_interleave_packet_per_dts(s: PAVFormatContext; _out: PAVPacket; - pkt: PAVPacket; flush: integer): integer; - cdecl; external av__format; - function av_write_trailer(s: pAVFormatContext): integer; - cdecl; external av__format; - - procedure dump_format(ic: PAVFormatContext; index: integer; url: pchar; - is_output: integer); - cdecl; external av__format; - - function parse_image_size(width_ptr: PInteger; height_ptr: PInteger; str: pchar): integer; - cdecl; external av__format; - function parse_frame_rate (frame_rate: PInteger; frame_rate_base: PInteger; arg: pchar): integer; - cdecl; external av__format; - function parse_date(datestr: pchar; duration: integer): int64; - cdecl; external av__format; - function av_gettime (): int64; - cdecl; external av__format; - -(* ffm specific for ffserver *) -const - FFM_PACKET_SIZE = 4096; - - function ffm_read_write_index (fd: integer): int64; - cdecl; external av__format; - - procedure ffm_write_write_index(fd: integer; pos: int64); - cdecl; external av__format; - - procedure ffm_set_write_index (s: PAVFormatContext; pos: int64; file_size: int64); - cdecl; external av__format; - - function find_info_tag (arg: pchar; arg_size: integer; tag1: pchar; info: pchar): integer; - cdecl; external av__format; - - function get_frame_filename(buf: pchar; buf_size: integer; - path: pchar; number: integer): integer; - cdecl; external av__format; - function filename_number_test (filename: pchar): integer; - cdecl; external av__format; - - -(* grab specific *) - function video_grab_init (): integer; - cdecl; external av__format; - function audio_init (): integer; - cdecl; external av__format; - -(* DV1394 *) - function dv1394_init (): integer; - cdecl; external av__format; - function dc1394_init (): integer; - cdecl; external av__format; - - function strstart(str: pchar; val: pchar; ptr: PPointer): integer; - cdecl; external av__format; - function stristart(str: pchar; val: pchar; ptr: PPointer): integer; - cdecl; external av__format; - procedure pstrcpy(buf: pchar; buf_size: integer; str: pchar); - cdecl; external av__format; - function pstrcat(buf: pchar; buf_size: integer; s: pchar): pchar; - cdecl; external av__format; - - procedure __dynarray_add (tab_ptr: PPointer; nb_ptr: PInteger; elem: cardinal); - cdecl; external av__format; - - -implementation - -procedure av_init_packet (var pkt: TAVPacket); (* CAT#2 + bug fix *) -begin - with pkt do begin - pts := AV_NOPTS_VALUE; - dts := AV_NOPTS_VALUE; - pos := -1; - duration := 0; - flags := 0; - stream_index := 0; - destruct := @av_destruct_packet_nofree - end -end; - -procedure av_free_packet (var pkt: TAVPacket); (* CAT#2 *) -begin - if @pkt.destruct <> nil then pkt.destruct (@pkt) -{ if (pkt <> nil) and (@pkt^.destruct <> nil) then - pkt^.destruct (pkt)} -end; - -end. + (* + * copyright (c) 2001 Fabrice Bellard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +(* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. +For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT +in the source codes *) + +unit avformat; + +{$IFDEF FPC} + {$IFDEF LINUX} + {$LINKLIB libavutil} + {$LINKLIB libavformat} + {$ENDIF} + + {$MODE DELPHI } (* CAT *) + {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) + {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) +{$ENDIF} + +interface + +uses + avcodec, + avio, + rational, + avutil; (* CAT *) + +const + +{$IFDEF MSWINDOWS} + av__format = 'avformat-50.dll'; +{$ENDIF} +{$IFDEF LINUX} + av__format = 'libavformat.so'; +{$ENDIF} +{$IFDEF DARWIN} + av__format = 'libavformat.dylib'; +{$ENDIF} + + LIBAVUTIL_VERSION_INT = ((51 shl 16) + (12 shl 8) + 1); + LIBAVUTIL_VERSION = '51.12.1'; + LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; + + MAXINT64 = $7fffffffffffffff; + MININT64 = $8000000000000000; + + PKT_FLAG_KEY = $0001; + +(*************************************************) +(* input/output formats *) + + AVPROBE_SCORE_MAX = 100; ///< max score, half of that is used for file extension based detection + AVPROBE_PADDING_SIZE = 32; ///< extra allocated bytes at the end of the probe buffer + +//! demuxer will use url_fopen, no opened file should be provided by the caller + AVFMT_NOFILE = $0001; + AVFMT_NEEDNUMBER = $0002; (**< needs '%d' in filename *) + AVFMT_SHOW_IDS = $0008; (**< show format stream IDs numbers *) + AVFMT_RAWPICTURE = $0020; (**< format wants AVPicture structure for + raw picture data *) + AVFMT_GLOBALHEADER = $0040; (**< format wants global header *) + AVFMT_NOTIMESTAMPS = $0080; (**< format does not need / have any timestamps *) + AVFMT_GENERIC_INDEX = $0100; (**< use generic index building code *) + + AVINDEX_KEYFRAME = $0001; + + MAX_REORDER_DELAY = 4; + + AVFMTCTX_NOHEADER = $0001; (**< signal that no header is present + (streams are added dynamically) *) + MAX_STREAMS = 20; + AVFMT_NOOUTPUTLOOP = -1; + AVFMT_INFINITEOUTPUTLOOP = 0; + AVFMT_FLAG_GENPTS = $0001; ///< generate pts if missing even if it requires parsing future frames + AVFMT_FLAG_IGNIDX = $0002; ///< ignore index + AVFMT_FLAG_NONBLOCK = $0004; ///< do not block when reading packets from input + +type + HFILE = THandle; /// (* CAT *) + int = integer; + + PAVPacket = ^TAVPacket; + PAVImageFormat = ^TAVImageFormat; + PAVFormatContext = ^TAVFormatContext; + PAVFormatParameters = ^TAVFormatParameters; + PAVOutputFormat = ^TAVOutputFormat; + PAVProbeData = ^TAVProbeData; + PAVInputFormat = ^TAVInputFormat; + PAVIndexEntry = ^TAVIndexEntry; + PAVStream = ^TAVStream; + PAVPacketList = ^TAVPacketList; + PAVImageInfo = ^TAVImageInfo; + + TAVPacket = record {56} + pts: int64; ///< presentation time stamp in time_base units + dts: int64; ///< decompression time stamp in time_base units + data: PByte; + size: integer; + stream_index: integer; + flags: integer; + duration: integer; ///< presentation duration in time_base units (0 if not available) + destruct: procedure (p: PAVPacket); cdecl; (* This cannot be var : TAVPacket. + because TAVPacket is not completely defined yet *) + priv: pointer; + pos: int64 ///< byte position in stream, -1 if unknown + end; + +(*************************************************) +(* fractional numbers for exact pts handling *) + +(* the exact value of the fractional number is: 'val + num / den'. num + is assumed to be such as 0 <= num < den *) + PAVFrac = ^TAVFrac; + TAVFrac = record + val, num, den: int64; + end; + +(* this structure contains the data a format has to probe a file *) + TAVProbeData = record {12} + filename: pchar; + buf: pchar; + buf_size: integer; + end; + + TAVFormatParameters = record {56} + time_base: TAVRational; (* 8 bytes *) + sample_rate: integer; + channels: integer; + width: integer; + height: integer; + pix_fmt: TAVPixelFormat; +{ image_format: PAVImageFormat; (* 4 bytes *)} (* CAT#3 *) + channel: integer; (* used to select dv channel *) + device: pchar; (* video, audio or DV device, if LIBAVFORMAT_VERSION_INT < (52<<16) *) + standard: pchar; (* tv standard, NTSC, PAL, SECAM *) +// int mpeg2ts_raw:1; (* force raw MPEG2 transport stream output, if possible *) +// int mpeg2ts_compute_pcr:1; (* compute exact PCR for each transport +// stream packet (only meaningful if +// mpeg2ts_raw is TRUE *) +// int initial_pause:1; (* do not begin to play the stream +// immediately (RTSP only) *) +// int prealloced_context:1; + dummy: byte; + video_codec_id: TCodecID; + audio_codec_id: TCodecID; + end; + + TAVOutputFormat = record {56} + name: pchar; + long_name: pchar; + mime_type: pchar; + extensions: pchar; (* comma separated extensions *) + (* size of private data so that it can be allocated in the wrapper *) + priv_data_size: integer; + (* output support *) + audio_codec: TCodecID; (* default audio codec *) + video_codec: TCodecID; (* default video codec *) + write_header: function (c: PAVFormatContext): integer; cdecl; + write_packet: function (c: PAVFormatContext; var pkt: TAVPacket): integer; cdecl; (* CAT#2 *) + write_trailer: function (c: PAVFormatContext): integer; cdecl; + (* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER *) + flags: integer; + (* currently only used to set pixel format if not YUV420P *) + set_parameters: function (c: PAVFormatContext; f: PAVFormatParameters): integer; cdecl; + interleave_packet: function (s: PAVFormatContext; _out: PAVPacket; _in: PAVPacket; flush: integer): integer; cdecl; + + (** + * list of supported codec_id-codec_tag pairs, ordered by "better choice first" + * the arrays are all CODEC_ID_NONE terminated + *) + //const struct AVCodecTag **codec_tag; + + (* private fields *) + next: PAVOutputFormat; + end; + + TAVInputFormat = record {60} + name: pchar; + long_name: pchar; + (* size of private data so that it can be allocated in the wrapper *) + priv_data_size: integer; + (* tell if a given file has a chance of being parsing by this format *) + read_probe: function (p: PAVProbeData): integer; cdecl; + (* read the format header and initialize the AVFormatContext + structure. Return 0 if OK. 'ap' if non NULL contains + additionnal paramters. Only used in raw format right + now. 'av_new_stream' should be called to create new streams. *) + read_header: function (c: PAVFormatContext; ap: PAVFormatParameters): integer; cdecl; + (* read one packet and put it in 'pkt'. pts and flags are also + set. 'av_new_stream' can be called only if the flag + AVFMTCTX_NOHEADER is used. *) + read_packet: function (c: PAVFormatContext; var pkt: TAVPacket): integer; cdecl; + (* close the stream. The AVFormatContext and AVStreams are not + freed by this function *) + read_close: function (c: PAVFormatContext): integer; cdecl; + (*** seek to a given timestamp relative to the frames in + * stream component stream_index + * @param stream_index must not be -1 + * @param flags selects which direction should be preferred if no exact + * match is available *) + read_seek: function (c: PAVFormatContext; stream_index: integer; + timestamp: int64; flags: integer): integer; cdecl; + (*** gets the next timestamp in AV_TIME_BASE units. *) + read_timestamp: function (s: PAVFormatContext; stream_index: integer; + pos: pint64; pos_limit: int64): integer; cdecl; + (* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER *) + flags: integer; + (* if extensions are defined, then no probe is done. You should + usually not use extension format guessing because it is not + reliable enough *) + extensions: pchar; + (* general purpose read only value that the format can use *) + value: integer; + + (* start/resume playing - only meaningful if using a network based format (RTSP) *) + read_play: function (c: PAVFormatContext): integer; cdecl; + + (* pause playing - only meaningful if using a network based format (RTSP) *) + read_pause: function (c: PAVFormatContext): integer; cdecl; + + //const struct AVCodecTag **codec_tag; + + (* private fields *) + next: PAVInputFormat; + end; + + TAVStreamParseType = ( + AVSTREAM_PARSE_NONE, + AVSTREAM_PARSE_FULL, (**< full parsing and repack *) + AVSTREAM_PARSE_HEADERS, (**< only parse headers, don't repack *) + AVSTREAM_PARSE_TIMESTAMPS (**< full parsing and interpolation of timestamps for frames not starting on packet boundary *) + ); + + TAVIndexEntry = record {24} + pos: int64; + timestamp: int64; +(* the following 2 flags indicate that the next/prev keyframe is known, and scaning for it isnt needed *) + flags: integer; +// int flags:2; +// int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs 32 byte due to possible 8byte align). + min_distance: integer; (* min distance between this and the previous keyframe, used to avoid unneeded searching *) + end; + + TAVStream = record {168} + index: integer; (* stream index in AVFormatContext *) {4-4} + id: integer; (* format specific stream id *) {4-8} + codec: PAVCodecContext; (* codec context *) {4-12} + (*** real base frame rate of the stream. + * for example if the timebase is 1/90000 and all frames have either + * approximately 3600 or 1800 timer ticks then r_frame_rate will be 50/1 *) + r_frame_rate: TAVRational; {4*2=8-20} + priv_data: pointer; {4-24} + (* internal data used in av_find_stream_info() *) + codec_info_duration: int64; (* #if LIBAVFORMAT_VERSION_INT < (52<<16) *) {8-32} + codec_info_nb_frames: integer; (* #if LIBAVFORMAT_VERSION_INT < (52<<16) *) {4-38} + (* encoding: PTS generation when outputing stream *) + pts: TAVFrac; {8*3=24-62} + + (*** this is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. for fixed-fps content, + * timebase should be 1/framerate and timestamp increments should be + * identically 1. *) + time_base: TAVRational; {4*2=8-70} + pts_wrap_bits: integer; (* number of bits in pts (used for wrapping control) *) {4-74} + (* ffmpeg.c private use *) + stream_copy: integer; (* if TRUE, just copy stream *) {4-78} + discard: TAVDiscard; ///< selects which packets can be discarded at will and dont need to be demuxed {4-82} + //FIXME move stuff to a flags field? + (* quality, as it has been removed from AVCodecContext and put in AVVideoFrame + * MN:dunno if thats the right place, for it *) + quality: single; {4-86} + (* decoding: position of the first frame of the component, in AV_TIME_BASE fractional seconds. *) + start_time: int64; {8-92} + (* decoding: duration of the stream, in stream time base. *) + duration: int64; {8-100} + + language: array [0..3] of char; (* ISO 639 3-letter language code (empty string if undefined) *)(* 101 th byte - 1 base *) {4-104} + + (* av_read_frame() support *) + need_parsing: TAVStreamParseType;//CAT#3 ///< 1->full parsing needed, 2->only parse headers dont repack + parser: PAVCodecParserContext; + + cur_dts: int64; + last_IP_duration: integer; + last_IP_pts: int64; + (* av_seek_frame() support *) + index_entries: PAVIndexEntry; (* only used if the format does not support seeking natively *) + nb_index_entries: integer; + index_entries_allocated_size: cardinal; (* CAT#3 *) + + nb_frames: int64; ///< number of frames in this stream if known or 0 + pts_buffer: array [0..MAX_REORDER_DELAY] of int64 + end; + +(* format I/O context *) + TAVFormatContext = record {3960} + av_class: PAVClass; (* set by av_alloc_format_context *) + (* can only be iformat or oformat, not both at the same time *) + iformat: PAVInputFormat; + oformat: PAVOutputFormat; + priv_data: pointer; + + //pb: TByteIOContext; + pb: Pointer; // eddie: This is a pointer (at least on OS X) + + nb_streams: cardinal; (* CAT#3 *) + streams: array [0..MAX_STREAMS - 1] of PAVStream; + filename: array [0..1023] of char; (* input or output filename *) + (* stream info *) + timestamp: int64; + title: array [0..511] of char; + author: array [0..511] of char; + copyright: array [0..511] of char; + comment: array [0..511] of char; + album: array [0..511] of char; + year: integer; (* ID3 year, 0 if none *) + track: integer; (* track number, 0 if none *) + genre: array [0..31] of char; (* ID3 genre *) + + ctx_flags: integer; (* format specific flags, see AVFMTCTX_xx *) + (* private data for pts handling (do not modify directly) *) + (* This buffer is only needed when packets were already buffered but + not decoded, for example to get the codec parameters in mpeg + streams *) + packet_buffer: PAVPacketList; + + (* decoding: position of the first frame of the component, in + AV_TIME_BASE fractional seconds. NEVER set this value directly: + it is deduced from the AVStream values. *) + start_time: int64; + (* decoding: duration of the stream, in AV_TIME_BASE fractional + seconds. NEVER set this value directly: it is deduced from the + AVStream values. *) + duration: int64; + (* decoding: total file size. 0 if unknown *) + file_size: int64; + (* decoding: total stream bitrate in bit/s, 0 if not + available. Never set it directly if the file_size and the + duration are known as ffmpeg can compute it automatically. *) + bit_rate: integer; + + (* av_read_frame() support *) + cur_st: PAVStream; + cur_ptr: pbyte; + cur_len: integer; + cur_pkt: TAVPacket; + + (* av_seek_frame() support *) + data_offset: int64; (* offset of the first packet *) + index_built: integer; + + mux_rate: integer; + packet_size: integer; + preload: integer; + max_delay: integer; + + (* number of times to loop output in formats that support it *) + loop_output: integer; + + flags: integer; + loop_input: integer; + (* decoding: size of data to probe; encoding unused *) + probesize: cardinal; + + (** + * maximum duration in AV_TIME_BASE units over which the input should be analyzed in av_find_stream_info() + *) + max_analyze_duration: integer; + + key: pbyte; + keylen : integer + end; + + TAVPacketList = record {64} + pkt: TAVPacket; + next: PAVPacketList; + end; + +(* still image support *) + PAVInputImageContext = pointer; // attribute_deprecated; +// PAVInputImageContext = pointer; //AVInputImageContext attribute_deprecated; + +(* still image support *) + TAVImageInfo = record {48} + pix_fmt: TAVPixelFormat; (* requested pixel format *) + width: integer; (* requested width *) + height: integer; (* requested height *) + interleaved: integer; (* image is interleaved (e.g. interleaved GIF) *) + pict: TAVPicture; (* returned allocated image *) + end; + + TAVImageFormat = record {32} + name: pchar; + extensions: pchar; + (* tell if a given file has a chance of being parsing by this format *) + img_probe: function (d: PAVProbeData): integer; cdecl; + (* read a whole image. 'alloc_cb' is called when the image size is + known so that the caller can allocate the image. If 'allo_cb' + returns non zero, then the parsing is aborted. Return '0' if + OK. *) + img_read: function (b: PByteIOContext; alloc_cb: pointer; ptr: pointer): integer; cdecl; + (* write the image *) + supported_pixel_formats: integer; (* mask of supported formats for output *) + img_write: function (b: PByteIOContext; i: PAVImageInfo): integer; cdecl; + flags: integer; + next: PAVImageFormat; + end; + +procedure av_destruct_packet_nofree (var pkt: TAVPacket); (* CAT#2 *) + cdecl; external av__format; +procedure av_destruct_packet (var pkt: TAVPacket); (* CAT#2 *) + cdecl; external av__format; + +(* initialize optional fields of a packet *) +procedure av_init_packet (var pkt: TAVPacket); (* CAT#2 *) + +function av_new_packet(var pkt: TAVPacket; size: integer): integer; (* CAT#2 *) + cdecl; external av__format; + +function av_get_packet (s: PByteIOContext; var pkt: TAVPacket; size: integer): integer; (* CAT#2 *) + cdecl; external av__format; + +function av_dup_packet (pkt: PAVPacket): integer; + cdecl; external av__format; + +(** * Free a packet + * + * @param pkt packet to free *) +procedure av_free_packet (var pkt: TAVPacket); (* CAT#2 *) + +procedure av_register_image_format (img_fmt: PAVImageFormat); + cdecl; external av__format; + +function av_probe_image_format (pd: PAVProbeData): PAVImageFormat; + cdecl; external av__format; + +function guess_image_format (filename: pchar): PAVImageFormat; + cdecl; external av__format; + +function av_guess_image2_codec(filename: pchar): TCodecID; + cdecl; external av__format; + +function av_read_image (pb: PByteIOContext; filename: pchar; + fmt: PAVImageFormat; + alloc_cb: pointer; opaque: pointer): integer; + cdecl; external av__format; + +function av_write_image(pb: PByteIOContext; fmt: PAVImageFormat; img: PAVImageInfo): integer; + cdecl; external av__format; + +(* XXX: use automatic init with either ELF sections or C file parser *) +(* modules *) + +//#include "rtp.h" + +//#include "rtsp.h" + +(* utils.c *) + procedure av_register_input_format (format: PAVInputFormat); + cdecl; external av__format; + + procedure av_register_output_format (format: PAVOutputFormat); + cdecl; external av__format; + + function guess_stream_format (short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; + cdecl; external av__format; + + function guess_format(short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; + cdecl; external av__format; + + function av_guess_codec(fmt: PAVOutputFormat; short_name: pchar; + filename: pchar; mime_type: pchar; _type: TCodecType): TCodecID; + cdecl; external av__format; + + procedure av_hex_dump (f: HFILE; buf: pchar; size: integer); + cdecl; external av__format; + procedure av_pkt_dump(f: HFILE; var pkt: TAVPacket; dump_payload: integer); (* CAT#2 *) + cdecl; external av__format; + + procedure av_register_all (); + cdecl; external av__format; + + +(* media file input *) + function av_find_input_format (short_name: pchar): PAVInputFormat; + cdecl; external av__format; + function av_probe_input_format (pd: PAVProbeData; is_opened: integer): PAVInputFormat; + cdecl; external av__format; + function av_open_input_stream (ic_ptr: PAVFormatContext; + pb: PByteIOContext; filename: pchar; + fmt: PAVInputFormat; ap: PAVFormatParameters): integer; + cdecl; external av__format; +(*** Open a media file as input. The codec are not opened. Only the file + * header (if present) is read. + * + * @param ic_ptr the opened media file handle is put here + * @param filename filename to open. + * @param fmt if non NULL, force the file format to use + * @param buf_size optional buffer size (zero if default is OK) + * @param ap additionnal parameters needed when opening the file (NULL if default) + * @return 0 if OK. AVERROR_xxx otherwise. *) + + function av_open_input_file (var ic_ptr: PAVFormatContext; filename: pchar; + fmt: PAVInputFormat; buf_size: integer; + ap: PAVFormatParameters): integer; + cdecl; external av__format; + + (* no av_open for output, so applications will need this: *) + function av_alloc_format_context (): PAVFormatContext; + cdecl; external av__format; + +const + AVERROR_UNKNOWN =(-1); (* unknown error *) + AVERROR_IO =(-2); (* i/o error *) + AVERROR_NUMEXPECTED =(-3); (* number syntax expected in filename *) + AVERROR_INVALIDDATA =(-4); (* invalid data found *) + AVERROR_NOMEM =(-5); (* not enough memory *) + AVERROR_NOFMT =(-6); (* unknown format *) + AVERROR_NOTSUPP =(-7); (* operation not supported *) + +(*** Read the beginning of a media file to get stream information. This + * is useful for file formats with no headers such as MPEG. This + * function also compute the real frame rate in case of mpeg2 repeat + * frame mode. + * + * @param ic media file handle + * @return >=0 if OK. AVERROR_xxx if error. + * @todo let user decide somehow what information is needed so we dont waste time geting stuff the user doesnt need *) + + function av_find_stream_info (ic: PAVFormatContext): integer; + cdecl; external av__format; + function av_read_packet (s: PAVFormatContext; var pkt: TAVPacket): integer; (* CAT#2 *) + cdecl; external av__format; +(*** Return the next frame of a stream. + * + * The returned packet is valid + * until the next av_read_frame() or until av_close_input_file() and + * must be freed with av_free_packet. For video, the packet contains + * exactly one frame. For audio, it contains an integer number of + * frames if each frame has a known fixed size (e.g. PCM or ADPCM + * data). If the audio frames have a variable size (e.g. MPEG audio), + * then it contains one frame. + * + * pkt->pts, pkt->dts and pkt->duration are always set to correct + * values in AV_TIME_BASE unit (and guessed if the format cannot + * provided them). pkt->pts can be AV_NOPTS_VALUE if the video format + * has B frames, so it is better to rely on pkt->dts if you do not + * decompress the payload. + * + * @return 0 if OK, < 0 if error or end of file. *) + + function av_read_frame (s: PAVFormatContext; var pkt: TAVPacket): integer; (* CAT#2 *) + cdecl; external av__format; + function av_seek_frame (s: PAVFormatContext; stream_index: integer; timestamp: int64; flags: integer): integer; + cdecl; external av__format; + function av_read_play (s: PAVFormatContext): integer; + cdecl; external av__format; + function av_read_pause (s: PAVFormatContext): integer; + cdecl; external av__format; + procedure av_close_input_file (s: PAVFormatContext); + cdecl; external av__format; + function av_new_stream (s: PAVFormatContext; id: integer): PAVStream; + cdecl; external av__format; + procedure av_set_pts_info (s: PAVStream; pts_wrap_bits: integer; + pts_num: integer; pts_den: integer); + cdecl; external av__format; + +const + AVSEEK_FLAG_BACKWARD =1; ///< seek backward + AVSEEK_FLAG_BYTE =2; ///< seeking based on position in bytes + AVSEEK_FLAG_ANY =4; ///< seek to any frame, even non keyframes + + function av_find_default_stream_index (s: PAVFormatContext): integer; + cdecl; external av__format; + function av_index_search_timestamp (st: PAVStream; timestamp: int64; flags: integer): integer; + cdecl; external av__format; + function av_add_index_entry (st: PAVStream; pos: int64; timestamp: int64; + distance: integer; flags: integer): integer; + cdecl; external av__format; + function av_seek_frame_binary (s: PAVFormatContext; stream_index: integer; + target_ts: int64; flags: integer): integer; + cdecl; external av__format; + + procedure av_update_cur_dts (s: PAVFormatContext; ref_st: PAVStream; + timestamp: int64); + cdecl; external av__format; + +(* media file output *) + function av_set_parameters (s: PAVFormatContext; ap: PAVFormatParameters): integer; + cdecl; external av__format; + + function av_write_header (s: PAVFormatContext): integer; + cdecl; external av__format; + + function av_write_frame(s: PAVFormatContext; var pkt: TAVPacket): integer; + cdecl; external av__format; (* CAT#2 *) + + function av_interleaved_write_frame (s: PAVFormatContext; var pkt: TAVPacket): integer; + cdecl; external av__format; (* CAT#2 *) + + function av_interleave_packet_per_dts(s: PAVFormatContext; _out: PAVPacket; + pkt: PAVPacket; flush: integer): integer; + cdecl; external av__format; + function av_write_trailer(s: pAVFormatContext): integer; + cdecl; external av__format; + + procedure dump_format(ic: PAVFormatContext; index: integer; url: pchar; + is_output: integer); + cdecl; external av__format; + + function parse_image_size(width_ptr: PInteger; height_ptr: PInteger; str: pchar): integer; + cdecl; external av__format; + function parse_frame_rate (frame_rate: PInteger; frame_rate_base: PInteger; arg: pchar): integer; + cdecl; external av__format; + function parse_date(datestr: pchar; duration: integer): int64; + cdecl; external av__format; + function av_gettime (): int64; + cdecl; external av__format; + +(* ffm specific for ffserver *) +const + FFM_PACKET_SIZE = 4096; + + function ffm_read_write_index (fd: integer): int64; + cdecl; external av__format; + + procedure ffm_write_write_index(fd: integer; pos: int64); + cdecl; external av__format; + + procedure ffm_set_write_index (s: PAVFormatContext; pos: int64; file_size: int64); + cdecl; external av__format; + + function find_info_tag (arg: pchar; arg_size: integer; tag1: pchar; info: pchar): integer; + cdecl; external av__format; + + function get_frame_filename(buf: pchar; buf_size: integer; + path: pchar; number: integer): integer; + cdecl; external av__format; + function filename_number_test (filename: pchar): integer; + cdecl; external av__format; + + +(* grab specific *) + function video_grab_init (): integer; + cdecl; external av__format; + function audio_init (): integer; + cdecl; external av__format; + +(* DV1394 *) + function dv1394_init (): integer; + cdecl; external av__format; + function dc1394_init (): integer; + cdecl; external av__format; + + function strstart(str: pchar; val: pchar; ptr: PPointer): integer; + cdecl; external av__format; + function stristart(str: pchar; val: pchar; ptr: PPointer): integer; + cdecl; external av__format; + procedure pstrcpy(buf: pchar; buf_size: integer; str: pchar); + cdecl; external av__format; + function pstrcat(buf: pchar; buf_size: integer; s: pchar): pchar; + cdecl; external av__format; + + procedure __dynarray_add (tab_ptr: PPointer; nb_ptr: PInteger; elem: cardinal); + cdecl; external av__format; + + +implementation + +procedure av_init_packet (var pkt: TAVPacket); (* CAT#2 + bug fix *) +begin + with pkt do begin + pts := AV_NOPTS_VALUE; + dts := AV_NOPTS_VALUE; + pos := -1; + duration := 0; + flags := 0; + stream_index := 0; + destruct := @av_destruct_packet_nofree + end +end; + +procedure av_free_packet (var pkt: TAVPacket); (* CAT#2 *) +begin + if @pkt.destruct <> nil then pkt.destruct (@pkt) +{ if (pkt <> nil) and (@pkt^.destruct <> nil) then + pkt^.destruct (pkt)} +end; + +end. -- cgit v1.2.3 From 69ca319d60b756db31c104b9d40df8371c2d5337 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Wed, 9 Jan 2008 22:34:12 +0000 Subject: Changed DLL/so/dylib constants. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@772 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/ffmpeg/avcodec.pas | 19 ++++++++++++------- Game/Code/lib/ffmpeg/avutil.pas | 10 ++++++---- 2 files changed, 18 insertions(+), 11 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/lib/ffmpeg/avcodec.pas b/Game/Code/lib/ffmpeg/avcodec.pas index bcfe9809..4182b979 100644 --- a/Game/Code/lib/ffmpeg/avcodec.pas +++ b/Game/Code/lib/ffmpeg/avcodec.pas @@ -23,10 +23,11 @@ in the source codes *) unit avcodec; {$IFDEF FPC} - {$IFNDEF win32} - {$LINKLIB libavutil} - {$LINKLIB libavcodec} + {$IFDEF LINUX} + {$LINKLIB libavutil} + {$LINKLIB libavcodec} {$ENDIF} + {$MODE DELPHI } (* CAT *) {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) @@ -38,11 +39,15 @@ uses avutil, rational, opt; // CAT const -{$IFDEF win32} + +{$IFDEF MSWINDOWS} av__format = 'avformat-50.dll'; -{$ELSE} - av__format = 'libavformat.so'; // .0d -// av__format = 'libavformat.51'; +{$ENDIF} +{$IFDEF LINUX} + av__format = 'libavformat.so'; +{$ENDIF} +{$IFDEF DARWIN} + av__format = 'libavformat.dylib'; {$ENDIF} diff --git a/Game/Code/lib/ffmpeg/avutil.pas b/Game/Code/lib/ffmpeg/avutil.pas index 0a2078dc..ff833ad4 100644 --- a/Game/Code/lib/ffmpeg/avutil.pas +++ b/Game/Code/lib/ffmpeg/avutil.pas @@ -29,13 +29,15 @@ unit avutil; interface const -{$IFDEF win32} +{$IFDEF MSWINDOWS} av__util = 'avutil-49.dll'; -{$ELSE} +{$ENDIF} +{$IFDEF LINUX} av__util = 'libavutil.so'; // .0d -// av__util = 'libavutil.49'; {$ENDIF} - +{$IFDEF DARWIN} + av__util = 'libavutil.dylib'; +{$ENDIF} LIBAVUTIL_VERSION_INT = ((49 shl 16) + (4 shl 8) + 1); LIBAVUTIL_VERSION = '49.4.1'; -- cgit v1.2.3 From 7daa01ac59e2e940ca504cd594079944f4baa27d Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Wed, 9 Jan 2008 22:34:29 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@773 b956fd51-792f-4845-bead-9b4dfca2ff2c --- .../MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser | 329 ++++++++------------- .../MacOSX/UltraStarDX.xcodeproj/project.pbxproj | 183 +++++++++--- 2 files changed, 266 insertions(+), 246 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser index bc713544..7e214ce3 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser @@ -1,71 +1,22 @@ // !$*UTF8*$! { - 2C2DB59F0CF64B6900786BB9 /* PBXTextBookmark */ = { + 2C07C94F0D3582C9002A4079 /* PBXTextBookmark */ = { isa = PBXTextBookmark; - fRef = 2C4D9DCE0CC9EE6F0031092D /* UMenu.pas */; + fRef = 2C4D9C720CC9EC8C0031092D /* UIni.pas */; + name = "UIni.pas: 177"; rLen = 0; - rLoc = 768; - rType = 1; - }; - 2C2DB5A60CF64BA500786BB9 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9DCE0CC9EE6F0031092D /* UMenu.pas */; - name = "UMenu.pas: 752"; - rLen = 0; - rLoc = 28010; - rType = 0; - vrLen = 1215; - vrLoc = 27813; - }; - 2C2DB5A70CF64BA500786BB9 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2CF54F4A0CDA1B2B00627463 /* UScreenMain.pas */; - name = "UScreenMain.pas: 150"; - rLen = 0; - rLoc = 3430; - rType = 0; - vrLen = 1705; - vrLoc = 2876; - }; - 2C2DB5A80CF64BA500786BB9 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */; - name = "UScreenCredits.pas: 768"; - rLen = 471; - rLoc = 26865; - rType = 0; - vrLen = 2367; - vrLoc = 25405; - }; - 2C2DB5A90CF64BA500786BB9 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; - name = "UTexture.pas: 637"; - rLen = 0; - rLoc = 19395; + rLoc = 5110; rType = 0; - vrLen = 1984; - vrLoc = 18649; + vrLen = 1173; + vrLoc = 4819; }; - 2C2DB5AA0CF64BA500786BB9 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C880CC9EC8C0031092D /* USkins.pas */; - name = "USkins.pas: 138"; - rLen = 0; - rLoc = 3097; - rType = 0; - vrLen = 1352; - vrLoc = 1935; - }; - 2C2DB5AB0CF64BA500786BB9 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C8C0CC9EC8C0031092D /* UThemes.pas */; - name = "UThemes.pas: 886"; - rLen = 0; - rLoc = 25381; - rType = 0; - vrLen = 2043; - vrLoc = 24248; + 2C4B70220CF757A400B0F0BD /* Until5000.dpr */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {691, 1218}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{0, 1115}"; + sepNavWindowFrame = "{{15, 465}, {750, 558}}"; + }; }; 2C4D9C620CC9EC8C0031092D /* TextGL.pas */ = { uiCtxt = { @@ -84,14 +35,6 @@ sepNavWindowFrame = "{{15, 178}, {797, 845}}"; }; }; - 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1184, 13328}}"; - sepNavSelRange = "{22697, 0}"; - sepNavVisRect = "{{0, 12598}, {758, 716}}"; - sepNavWindowFrame = "{{38, 157}, {797, 845}}"; - }; - }; 2C4D9C650CC9EC8C0031092D /* UCatCovers.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {923, 2128}}"; @@ -167,10 +110,11 @@ }; 2C4D9C6E0CC9EC8C0031092D /* UFiles.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1562, 10850}}"; - sepNavSelRange = "{8099, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {1550, 10850}}"; + sepNavSelRange = "{13981, 0}"; + sepNavVisRange = "{13243, 859}"; sepNavVisRect = "{{0, 4494}, {923, 342}}"; - sepNavWindowFrame = "{{84, 219}, {616, 741}}"; + sepNavWindowFrame = "{{84, 77}, {874, 883}}"; }; }; 2C4D9C6F0CC9EC8C0031092D /* UGraphic.pas */ = { @@ -200,8 +144,9 @@ }; 2C4D9C720CC9EC8C0031092D /* UIni.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {770, 11102}}"; - sepNavSelRange = "{41, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {758, 11340}}"; + sepNavSelRange = "{5110, 0}"; + sepNavVisRange = "{4819, 1173}"; sepNavVisRect = "{{0, 0}, {758, 716}}"; sepNavWindowFrame = "{{107, 94}, {797, 845}}"; }; @@ -216,8 +161,9 @@ }; 2C4D9C740CC9EC8C0031092D /* ULanguage.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {923, 3346}}"; - sepNavSelRange = "{1257, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {842, 3318}}"; + sepNavSelRange = "{1263, 0}"; + sepNavVisRange = "{1275, 723}"; sepNavVisRect = "{{0, 914}, {923, 342}}"; sepNavWindowFrame = "{{153, 52}, {797, 845}}"; }; @@ -257,20 +203,20 @@ }; 2C4D9C7A0CC9EC8C0031092D /* ULyrics.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {738, 7476}}"; - sepNavSelRange = "{169, 0}"; - sepNavVisRange = "{0, 2043}"; + sepNavIntBoundsRect = "{{0, 0}, {881, 10346}}"; + sepNavSelRange = "{8686, 66}"; + sepNavVisRange = "{8126, 1127}"; sepNavVisRect = "{{0, 4395}, {758, 716}}"; sepNavWindowFrame = "{{61, 136}, {797, 845}}"; }; }; 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {842, 14980}}"; - sepNavSelRange = "{7383, 0}"; - sepNavVisRange = "{6895, 743}"; + sepNavIntBoundsRect = "{{0, 0}, {993, 14658}}"; + sepNavSelRange = "{6688, 0}"; + sepNavVisRange = "{5814, 1323}"; sepNavVisRect = "{{0, 0}, {1013, 614}}"; - sepNavWindowFrame = "{{222, 91}, {1052, 743}}"; + sepNavWindowFrame = "{{30, 285}, {1052, 743}}"; }; }; 2C4D9C7C0CC9EC8C0031092D /* UMedia_dummy.pas */ = { @@ -364,17 +310,18 @@ }; 2C4D9C880CC9EC8C0031092D /* USkins.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {738, 2464}}"; + sepNavIntBoundsRect = "{{0, 0}, {738, 2534}}"; sepNavSelRange = "{3097, 0}"; - sepNavVisRange = "{1935, 1352}"; + sepNavVisRange = "{1981, 1318}"; sepNavVisRect = "{{0, 550}, {923, 342}}"; sepNavWindowFrame = "{{61, 136}, {797, 845}}"; }; }; 2C4D9C890CC9EC8C0031092D /* USongs.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {950, 12908}}"; - sepNavSelRange = "{7752, 9}"; + sepNavIntBoundsRect = "{{0, 0}, {938, 13230}}"; + sepNavSelRange = "{2259, 0}"; + sepNavVisRange = "{26907, 1463}"; sepNavVisRect = "{{0, 4157}, {758, 716}}"; sepNavWindowFrame = "{{15, 156}, {797, 845}}"; }; @@ -389,18 +336,18 @@ }; 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {860, 16324}}"; - sepNavSelRange = "{19395, 0}"; - sepNavVisRange = "{18649, 1984}"; + sepNavIntBoundsRect = "{{0, 0}, {717, 16506}}"; + sepNavSelRange = "{12906, 0}"; + sepNavVisRange = "{12038, 1920}"; sepNavVisRect = "{{0, 3420}, {737, 826}}"; sepNavWindowFrame = "{{15, 68}, {776, 955}}"; }; }; 2C4D9C8C0CC9EC8C0031092D /* UThemes.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {738, 33124}}"; + sepNavIntBoundsRect = "{{0, 0}, {738, 33208}}"; sepNavSelRange = "{25381, 0}"; - sepNavVisRange = "{24248, 2043}"; + sepNavVisRange = "{24314, 2017}"; sepNavVisRect = "{{0, 19678}, {923, 342}}"; sepNavWindowFrame = "{{28, 161}, {797, 845}}"; }; @@ -415,9 +362,9 @@ }; 2C4D9C8E0CC9EC8C0031092D /* UVideo.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {746, 10024}}"; - sepNavSelRange = "{12365, 13}"; - sepNavVisRange = "{11732, 1140}"; + sepNavIntBoundsRect = "{{0, 0}, {914, 9016}}"; + sepNavSelRange = "{12966, 0}"; + sepNavVisRange = "{12857, 955}"; sepNavVisRect = "{{0, 5722}, {749, 470}}"; sepNavWindowFrame = "{{15, 178}, {797, 845}}"; }; @@ -448,9 +395,9 @@ }; 2C4D9DCC0CC9EE6F0031092D /* UDisplay.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {796, 6706}}"; - sepNavSelRange = "{3871, 0}"; - sepNavVisRange = "{7952, 477}"; + sepNavIntBoundsRect = "{{0, 0}, {842, 6650}}"; + sepNavSelRange = "{7897, 0}"; + sepNavVisRange = "{7979, 593}"; sepNavVisRect = "{{0, 4834}, {758, 716}}"; sepNavWindowFrame = "{{38, 157}, {797, 845}}"; }; @@ -466,9 +413,9 @@ }; 2C4D9DCE0CC9EE6F0031092D /* UMenu.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {842, 22372}}"; - sepNavSelRange = "{28728, 0}"; - sepNavVisRange = "{28445, 689}"; + sepNavIntBoundsRect = "{{0, 0}, {1220, 21980}}"; + sepNavSelRange = "{28010, 0}"; + sepNavVisRange = "{27660, 1472}"; sepNavVisRect = "{{0, 3972}, {749, 470}}"; sepNavWindowFrame = "{{38, 157}, {797, 845}}"; }; @@ -547,10 +494,11 @@ }; 2C4D9E040CC9EF840031092D /* OpenGL12.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1616, 65828}}"; - sepNavSelRange = "{213686, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {1604, 65450}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{207947, 6380}"; sepNavVisRect = "{{0, 64932}, {1031, 840}}"; - sepNavWindowFrame = "{{1, 53}, {1070, 969}}"; + sepNavWindowFrame = "{{1, 63}, {1070, 965}}"; }; }; 2C4D9E090CC9EF840031092D /* Windows.pas */ = { @@ -569,71 +517,46 @@ sepNavWindowFrame = "{{15, 282}, {616, 741}}"; }; }; - 2C71B9290CF6478000048804 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2CF54F4A0CDA1B2B00627463 /* UScreenMain.pas */; - name = "UScreenMain.pas: 150"; - rLen = 0; - rLoc = 3430; - rType = 0; - vrLen = 1719; - vrLoc = 2876; - }; - 2C71B92B0CF6478000048804 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2CF54F430CDA1B2B00627463 /* UScreenCredits.pas */; - name = "UScreenCredits.pas: 768"; - rLen = 471; - rLoc = 26865; - rType = 0; - vrLen = 2367; - vrLoc = 25405; - }; - 2C71B92C0CF6478000048804 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; - name = "UTexture.pas: 637"; - rLen = 0; - rLoc = 19395; - rType = 0; - vrLen = 1984; - vrLoc = 18649; + 2C5663EE0D35645700D4FF53 /* portaudio.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {881, 16842}}"; + sepNavSelRange = "{2289, 0}"; + sepNavVisRange = "{7295, 1046}"; + }; }; - 2C71B92D0CF6478000048804 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C880CC9EC8C0031092D /* USkins.pas */; - name = "USkins.pas: 138"; - rLen = 0; - rLoc = 3097; - rType = 0; - vrLen = 1352; - vrLoc = 1935; + 2C56642B0D35683200D4FF53 /* SDLMain.m */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {881, 5404}}"; + sepNavSelRange = "{247, 16}"; + sepNavVisRange = "{0, 1181}"; + }; }; - 2C71B92E0CF6478000048804 /* PBXTextBookmark */ = { + 2C5A59420D35813800DCBB8F /* PBXTextBookmark */ = { isa = PBXTextBookmark; - fRef = 2C4D9C8C0CC9EC8C0031092D /* UThemes.pas */; - name = "UThemes.pas: 886"; + fRef = 2C4D9C720CC9EC8C0031092D /* UIni.pas */; + name = "UIni.pas: 177"; rLen = 0; - rLoc = 25381; + rLoc = 5110; rType = 0; - vrLen = 2043; - vrLoc = 24248; + vrLen = 1173; + vrLoc = 4819; }; 2C8937290CE393FB005D8A87 /* UPlatform.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {717, 827}}"; - sepNavSelRange = "{426, 0}"; - sepNavVisRange = "{0, 1116}"; + sepNavIntBoundsRect = "{{0, 0}, {776, 1638}}"; + sepNavSelRange = "{2299, 15}"; + sepNavVisRange = "{1739, 1083}"; sepNavVisRect = "{{0, 0}, {737, 826}}"; sepNavWindowFrame = "{{200, 62}, {776, 955}}"; }; }; 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {737, 938}}"; - sepNavSelRange = "{1158, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {734, 1456}}"; + sepNavSelRange = "{1212, 0}"; + sepNavVisRange = "{473, 1363}"; sepNavVisRect = "{{0, 105}, {737, 827}}"; - sepNavWindowFrame = "{{12, 61}, {776, 956}}"; + sepNavWindowFrame = "{{79, 54}, {776, 956}}"; }; }; 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = { @@ -670,6 +593,21 @@ sourceDirectories = ( ); variableFormatDictionary = { + $cs = 1; + $ds = 1; + $eax = 1; + $ebp = 1; + $ebx = 1; + $ecx = 1; + $edi = 1; + $edx = 1; + $eflags = 1; + $eip = 1; + $es = 1; + $esi = 1; + $esp = 1; + $gs = 1; + $ss = 1; }; }; 2CDD4B690CB9357000549FAC /* Source Control */ = { @@ -686,8 +624,9 @@ }; 2CEA2AF00CE3868E0097A5FF /* PseudoThread.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {737, 826}}"; - sepNavSelRange = "{415, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {842, 686}}"; + sepNavSelRange = "{563, 0}"; + sepNavVisRange = "{287, 430}"; sepNavVisRect = "{{0, 0}, {737, 826}}"; sepNavWindowFrame = "{{15, 68}, {776, 955}}"; }; @@ -712,7 +651,7 @@ uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {695, 19544}}"; sepNavSelRange = "{26865, 471}"; - sepNavVisRange = "{25405, 2367}"; + sepNavVisRange = "{25408, 2367}"; sepNavVisRect = "{{0, 1770}, {715, 815}}"; sepNavWindowFrame = "{{15, 79}, {754, 944}}"; }; @@ -769,7 +708,7 @@ uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {695, 4102}}"; sepNavSelRange = "{3430, 0}"; - sepNavVisRange = "{2876, 1705}"; + sepNavVisRange = "{2860, 1701}"; sepNavVisRect = "{{0, 0}, {715, 815}}"; sepNavWindowFrame = "{{38, 79}, {754, 944}}"; }; @@ -912,8 +851,9 @@ }; 2CF54F5C0CDA1B2B00627463 /* UScreenSing.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1262, 18480}}"; - sepNavSelRange = "{49, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {920, 19586}}"; + sepNavSelRange = "{12838, 0}"; + sepNavVisRange = "{12982, 724}"; sepNavVisRect = "{{0, 0}, {715, 815}}"; sepNavWindowFrame = "{{38, 58}, {754, 944}}"; }; @@ -985,8 +925,9 @@ }; 2CF5508B0CDA22B000627463 /* ModiSDK.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {998, 2072}}"; - sepNavSelRange = "{30, 19}"; + sepNavIntBoundsRect = "{{0, 0}, {986, 2128}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{0, 2269}"; sepNavVisRect = "{{0, 0}, {715, 815}}"; sepNavWindowFrame = "{{15, 79}, {754, 944}}"; }; @@ -1025,16 +966,18 @@ }; 2CF5529E0CDA42C900627463 /* avcodec.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1013, 28616}}"; - sepNavSelRange = "{0, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {993, 28406}}"; + sepNavSelRange = "{1536, 0}"; + sepNavVisRange = "{0, 1591}"; sepNavVisRect = "{{0, 375}, {1013, 614}}"; sepNavWindowFrame = "{{176, 133}, {1052, 743}}"; }; }; 2CF5529F0CDA42C900627463 /* avformat.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1013, 9828}}"; - sepNavSelRange = "{0, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {993, 10206}}"; + sepNavSelRange = "{1559, 189}"; + sepNavVisRange = "{1159, 858}"; sepNavVisRect = "{{0, 298}, {1013, 614}}"; sepNavWindowFrame = "{{245, 70}, {1052, 743}}"; }; @@ -1049,8 +992,9 @@ }; 2CF552A10CDA42C900627463 /* avutil.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1022, 2058}}"; - sepNavSelRange = "{674, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {993, 2170}}"; + sepNavSelRange = "{1520, 0}"; + sepNavVisRange = "{0, 1756}"; sepNavVisRect = "{{0, 293}, {1013, 614}}"; sepNavWindowFrame = "{{222, 91}, {1052, 743}}"; }; @@ -1063,13 +1007,8 @@ sepNavWindowFrame = "{{38, 259}, {1052, 743}}"; }; }; - 9845B6590B1F9B9E0084DD62 /* SDL.h */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {948, 1330}}"; - sepNavSelRange = "{273, 0}"; - sepNavVisRect = "{{0, 0}, {948, 730}}"; - sepNavWindowFrame = "{{61, 122}, {987, 859}}"; - }; + 2CF77DB50CF7556C00F3B101 /* Modi_Until5000 */ = { + activeExec = 0; }; 98B8BE5C0B1F974F00162019 /* sdl.pas */ = { uiCtxt = { @@ -1079,14 +1018,6 @@ sepNavWindowFrame = "{{211, 143}, {987, 859}}"; }; }; - 98B8BE750B1F97F800162019 /* SDLMain.m */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {948, 5390}}"; - sepNavSelRange = "{6150, 21}"; - sepNavVisRect = "{{0, 2650}, {948, 730}}"; - sepNavWindowFrame = "{{15, 164}, {987, 859}}"; - }; - }; DD37F2420A60255800975B2D /* fpcrtl */ = { activeExec = 0; }; @@ -1097,7 +1028,6 @@ activeTarget = DDC688C709F574E9004E4BFF /* UltraStarDX */; addToTargets = ( DDC688C709F574E9004E4BFF /* UltraStarDX */, - DDC688D409F57523004E4BFF /* Put all program sources also in this target */, ); breakpoints = ( ); @@ -1211,8 +1141,8 @@ PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; PBXFileTableDataSourceColumnWidthsKey = ( 20, - 200, - 110, + 250, + 60, 20, 48, 43, @@ -1228,22 +1158,12 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 217466767; - PBXWorkspaceStateSaveDate = 217466767; + PBXPerProjectTemplateStateSaveDate = 221610651; + PBXWorkspaceStateSaveDate = 221610651; }; perUserProjectItems = { - 2C2DB59F0CF64B6900786BB9 /* PBXTextBookmark */ = 2C2DB59F0CF64B6900786BB9 /* PBXTextBookmark */; - 2C2DB5A60CF64BA500786BB9 /* PBXTextBookmark */ = 2C2DB5A60CF64BA500786BB9 /* PBXTextBookmark */; - 2C2DB5A70CF64BA500786BB9 /* PBXTextBookmark */ = 2C2DB5A70CF64BA500786BB9 /* PBXTextBookmark */; - 2C2DB5A80CF64BA500786BB9 /* PBXTextBookmark */ = 2C2DB5A80CF64BA500786BB9 /* PBXTextBookmark */; - 2C2DB5A90CF64BA500786BB9 /* PBXTextBookmark */ = 2C2DB5A90CF64BA500786BB9 /* PBXTextBookmark */; - 2C2DB5AA0CF64BA500786BB9 /* PBXTextBookmark */ = 2C2DB5AA0CF64BA500786BB9 /* PBXTextBookmark */; - 2C2DB5AB0CF64BA500786BB9 /* PBXTextBookmark */ = 2C2DB5AB0CF64BA500786BB9 /* PBXTextBookmark */; - 2C71B9290CF6478000048804 /* PBXTextBookmark */ = 2C71B9290CF6478000048804 /* PBXTextBookmark */; - 2C71B92B0CF6478000048804 /* PBXTextBookmark */ = 2C71B92B0CF6478000048804 /* PBXTextBookmark */; - 2C71B92C0CF6478000048804 /* PBXTextBookmark */ = 2C71B92C0CF6478000048804 /* PBXTextBookmark */; - 2C71B92D0CF6478000048804 /* PBXTextBookmark */ = 2C71B92D0CF6478000048804 /* PBXTextBookmark */; - 2C71B92E0CF6478000048804 /* PBXTextBookmark */ = 2C71B92E0CF6478000048804 /* PBXTextBookmark */; + 2C07C94F0D3582C9002A4079 /* PBXTextBookmark */ = 2C07C94F0D3582C9002A4079 /* PBXTextBookmark */; + 2C5A59420D35813800DCBB8F /* PBXTextBookmark */ = 2C5A59420D35813800DCBB8F /* PBXTextBookmark */; }; sourceControlManager = 2CDD4B690CB9357000549FAC /* Source Control */; userBuildSettings = { @@ -1251,10 +1171,11 @@ }; DDC6851B09F57195004E4BFF /* UltraStarDX.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {948, 730}}"; - sepNavSelRange = "{37, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {928, 731}}"; + sepNavSelRange = "{58, 0}"; + sepNavVisRange = "{0, 126}"; sepNavVisRect = "{{0, 0}, {948, 730}}"; - sepNavWindowFrame = "{{189, 86}, {987, 859}}"; + sepNavWindowFrame = "{{558, 105}, {987, 859}}"; }; }; DDC6868B09F571C2004E4BFF /* Info.plist */ = { diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj index 447b1155..be2d67d4 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj @@ -7,9 +7,10 @@ objects = { /* Begin PBXBuildFile section */ + 2C4B70230CF7581000B0F0BD /* Until5000.dpr in Sources */ = {isa = PBXBuildFile; fileRef = 2C4B70220CF757A400B0F0BD /* Until5000.dpr */; }; + 2C4B70240CF7584500B0F0BD /* ModiSDK.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF5508B0CDA22B000627463 /* ModiSDK.pas */; }; 2C4D9C8F0CC9EC8C0031092D /* TextGL.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C620CC9EC8C0031092D /* TextGL.pas */; }; 2C4D9C900CC9EC8C0031092D /* UAudio_bass.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; }; - 2C4D9C910CC9EC8C0031092D /* UAudio_FFMpeg.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; }; 2C4D9C920CC9EC8C0031092D /* UCatCovers.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C650CC9EC8C0031092D /* UCatCovers.pas */; }; 2C4D9C930CC9EC8C0031092D /* UCommandLine.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C660CC9EC8C0031092D /* UCommandLine.pas */; }; 2C4D9C940CC9EC8C0031092D /* UCommon.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C670CC9EC8C0031092D /* UCommon.pas */; }; @@ -52,7 +53,6 @@ 2C4D9CBB0CC9EC8C0031092D /* UVideo.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C8E0CC9EC8C0031092D /* UVideo.pas */; }; 2C4D9CBC0CC9EC8C0031092D /* TextGL.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C620CC9EC8C0031092D /* TextGL.pas */; }; 2C4D9CBD0CC9EC8C0031092D /* UAudio_bass.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; }; - 2C4D9CBE0CC9EC8C0031092D /* UAudio_FFMpeg.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */; }; 2C4D9CBF0CC9EC8C0031092D /* UCatCovers.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C650CC9EC8C0031092D /* UCatCovers.pas */; }; 2C4D9CC00CC9EC8C0031092D /* UCommandLine.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C660CC9EC8C0031092D /* UCommandLine.pas */; }; 2C4D9CC10CC9EC8C0031092D /* UCommon.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C670CC9EC8C0031092D /* UCommon.pas */; }; @@ -126,9 +126,7 @@ 2C4D9DED0CC9EF0A0031092D /* sdl_image.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; }; 2C4D9DEE0CC9EF0A0031092D /* sdl_image.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */; }; 2C4D9DF10CC9EF210031092D /* sdl_ttf.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DEF0CC9EF210031092D /* sdl_ttf.pas */; }; - 2C4D9DF20CC9EF210031092D /* sdltruetypefont.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DF00CC9EF210031092D /* sdltruetypefont.pas */; }; 2C4D9DF30CC9EF210031092D /* sdl_ttf.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DEF0CC9EF210031092D /* sdl_ttf.pas */; }; - 2C4D9DF40CC9EF210031092D /* sdltruetypefont.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9DF00CC9EF210031092D /* sdltruetypefont.pas */; }; 2C4D9E100CC9EF840031092D /* OpenGL12.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E040CC9EF840031092D /* OpenGL12.pas */; }; 2C4D9E150CC9EF840031092D /* Windows.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E090CC9EF840031092D /* Windows.pas */; }; 2C4D9E1C0CC9EF840031092D /* OpenGL12.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E040CC9EF840031092D /* OpenGL12.pas */; }; @@ -136,6 +134,9 @@ 2C4D9E450CC9F0ED0031092D /* switches.inc in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E440CC9F0ED0031092D /* switches.inc */; }; 2C4D9E460CC9F0ED0031092D /* switches.inc in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9E440CC9F0ED0031092D /* switches.inc */; }; 2C4FA2A80CDBAD1E002CC3B0 /* ustar-icon_v01.icns in Resources */ = {isa = PBXBuildFile; fileRef = 2C4FA2A70CDBAD1E002CC3B0 /* ustar-icon_v01.icns */; }; + 2C5663EF0D35645700D4FF53 /* portaudio.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C5663EE0D35645700D4FF53 /* portaudio.pas */; }; + 2C5663F00D35645700D4FF53 /* portaudio.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C5663EE0D35645700D4FF53 /* portaudio.pas */; }; + 2C56642C0D35683200D4FF53 /* SDLMain.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C56642B0D35683200D4FF53 /* SDLMain.m */; }; 2C89372A0CE393FB005D8A87 /* UPlatform.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C8937290CE393FB005D8A87 /* UPlatform.pas */; }; 2C89372B0CE393FB005D8A87 /* UPlatform.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C8937290CE393FB005D8A87 /* UPlatform.pas */; }; 2C8937340CE395CE005D8A87 /* UPlatformMacOSX.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */; }; @@ -147,6 +148,12 @@ 2CDD4BE20CB947BE00549FAC /* UltraStarDX.pas in Sources */ = {isa = PBXBuildFile; fileRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; }; 2CDEA4F70CBD725B0096994C /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CDEA4F60CBD725B0096994C /* OpenGL.framework */; }; 2CDEC4960CC5264600FFA244 /* SDL.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 98B8BE570B1F972400162019 /* SDL.framework */; }; + 2CE907930D1BC8A800A1FDFF /* libavcodec.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CE907900D1BC8A800A1FDFF /* libavcodec.dylib */; }; + 2CE907940D1BC8A800A1FDFF /* libavformat.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CE907910D1BC8A800A1FDFF /* libavformat.dylib */; }; + 2CE907950D1BC8A800A1FDFF /* libavutil.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CE907920D1BC8A800A1FDFF /* libavutil.dylib */; }; + 2CE907980D1BC90A00A1FDFF /* libavcodec.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2CE907900D1BC8A800A1FDFF /* libavcodec.dylib */; }; + 2CE907990D1BC91D00A1FDFF /* libavformat.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2CE907910D1BC8A800A1FDFF /* libavformat.dylib */; }; + 2CE9079A0D1BC91D00A1FDFF /* libavutil.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2CE907920D1BC8A800A1FDFF /* libavutil.dylib */; }; 2CEA2AE00CE385190097A5FF /* Graphics.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CEA2ADE0CE385190097A5FF /* Graphics.pas */; }; 2CEA2AE10CE385190097A5FF /* JPEG.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CEA2ADF0CE385190097A5FF /* JPEG.pas */; }; 2CEA2AE20CE385190097A5FF /* Graphics.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CEA2ADE0CE385190097A5FF /* Graphics.pas */; }; @@ -246,10 +253,6 @@ 2CF552B30CDA42C900627463 /* avutil.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552A10CDA42C900627463 /* avutil.pas */; }; 2CF552B60CDA42C900627463 /* opt.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552A40CDA42C900627463 /* opt.pas */; }; 2CF552B70CDA42C900627463 /* rational.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF552A50CDA42C900627463 /* rational.pas */; }; - 2CF552C30CDA4B7B00627463 /* libavcodec.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CF552BF0CDA4B7B00627463 /* libavcodec.dylib */; }; - 2CF552C40CDA4B7B00627463 /* libavformat.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CF552C00CDA4B7B00627463 /* libavformat.dylib */; }; - 2CF552C50CDA4B7B00627463 /* libavutil.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CF552C10CDA4B7B00627463 /* libavutil.dylib */; }; - 2CF552C60CDA4B7B00627463 /* libmp3lame.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CF552C20CDA4B7B00627463 /* libmp3lame.dylib */; }; 2CF553080CDA51B500627463 /* sdlutils.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF553070CDA51B500627463 /* sdlutils.pas */; }; 2CF553090CDA51B500627463 /* sdlutils.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF553070CDA51B500627463 /* sdlutils.pas */; }; 2CF553100CDA52D100627463 /* SDL_image.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2C4D9D980CC9EE0B0031092D /* SDL_image.framework */; }; @@ -257,17 +260,12 @@ 2CF5533E0CDA530300627463 /* libbass.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2C4D9CE90CC9ECB50031092D /* libbass.dylib */; }; 2CF5533F0CDA531100627463 /* libfreeimage.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2C4D9D960CC9EDEB0031092D /* libfreeimage.dylib */; }; 2CF553400CDA531100627463 /* libsqlite3.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2CF5512C0CDA29C600627463 /* libsqlite3.dylib */; }; - 2CF553410CDA531100627463 /* libavcodec.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2CF552BF0CDA4B7B00627463 /* libavcodec.dylib */; }; - 2CF553420CDA531100627463 /* libavformat.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2CF552C00CDA4B7B00627463 /* libavformat.dylib */; }; - 2CF553430CDA531100627463 /* libavutil.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2CF552C10CDA4B7B00627463 /* libavutil.dylib */; }; - 2CF553440CDA531100627463 /* libmp3lame.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2CF552C20CDA4B7B00627463 /* libmp3lame.dylib */; }; 2CF8E6BE0CDFA8E80053A996 /* UPartyDefs.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF8E6BD0CDFA8E80053A996 /* UPartyDefs.pas */; }; 2CF8E6BF0CDFA8E80053A996 /* UPartyDefs.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF8E6BD0CDFA8E80053A996 /* UPartyDefs.pas */; }; 98B8BE340B1F947800162019 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 98B8BE330B1F947800162019 /* AppKit.framework */; }; 98B8BE390B1F949C00162019 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 98B8BE370B1F949C00162019 /* Cocoa.framework */; }; 98B8BE3A0B1F949C00162019 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 98B8BE380B1F949C00162019 /* Foundation.framework */; }; 98B8BE580B1F972400162019 /* SDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 98B8BE570B1F972400162019 /* SDL.framework */; }; - 98B8BE760B1F97F800162019 /* SDLMain.m in Sources */ = {isa = PBXBuildFile; fileRef = 98B8BE750B1F97F800162019 /* SDLMain.m */; }; DD37F23D0A60252800975B2D /* UltraStarDX.pas in Sources */ = {isa = PBXBuildFile; fileRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; }; DD37F2C70A6037EA00975B2D /* libfpcrtl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DD37F2430A60255800975B2D /* libfpcrtl.a */; }; DDC689B509F57C69004E4BFF /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = DDC689B309F57C69004E4BFF /* InfoPlist.strings */; }; @@ -342,12 +340,11 @@ dstPath = ""; dstSubfolderSpec = 6; files = ( + 2CE907990D1BC91D00A1FDFF /* libavformat.dylib in CopyFiles */, + 2CE9079A0D1BC91D00A1FDFF /* libavutil.dylib in CopyFiles */, + 2CE907980D1BC90A00A1FDFF /* libavcodec.dylib in CopyFiles */, 2CF5533F0CDA531100627463 /* libfreeimage.dylib in CopyFiles */, 2CF553400CDA531100627463 /* libsqlite3.dylib in CopyFiles */, - 2CF553410CDA531100627463 /* libavcodec.dylib in CopyFiles */, - 2CF553420CDA531100627463 /* libavformat.dylib in CopyFiles */, - 2CF553430CDA531100627463 /* libavutil.dylib in CopyFiles */, - 2CF553440CDA531100627463 /* libmp3lame.dylib in CopyFiles */, 2CF5533E0CDA530300627463 /* libbass.dylib in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; @@ -367,9 +364,9 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 2C4B70220CF757A400B0F0BD /* Until5000.dpr */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; name = Until5000.dpr; path = ../../../Modis/5000Points/Until5000.dpr; sourceTree = SOURCE_ROOT; }; 2C4D9C620CC9EC8C0031092D /* TextGL.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = TextGL.pas; path = ../Classes/TextGL.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UAudio_bass.pas; path = ../Classes/UAudio_bass.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; - 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UAudio_FFMpeg.pas; path = ../Classes/UAudio_FFMpeg.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4D9C650CC9EC8C0031092D /* UCatCovers.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UCatCovers.pas; path = ../Classes/UCatCovers.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4D9C660CC9EC8C0031092D /* UCommandLine.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UCommandLine.pas; path = ../Classes/UCommandLine.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4D9C670CC9EC8C0031092D /* UCommon.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UCommon.pas; path = ../Classes/UCommon.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; @@ -429,15 +426,20 @@ 2C4D9DD50CC9EE6F0031092D /* UMenuText.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UMenuText.pas; path = ../Menu/UMenuText.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = sdl_image.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL_image/sdl_image.pas"; sourceTree = ""; tabWidth = 2; }; 2C4D9DEF0CC9EF210031092D /* sdl_ttf.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = sdl_ttf.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL_ttf/sdl_ttf.pas"; sourceTree = ""; tabWidth = 2; }; - 2C4D9DF00CC9EF210031092D /* sdltruetypefont.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = sdltruetypefont.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL_ttf/sdltruetypefont.pas"; sourceTree = ""; tabWidth = 2; }; 2C4D9E040CC9EF840031092D /* OpenGL12.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = OpenGL12.pas; path = Wrapper/OpenGL12.pas; sourceTree = ""; tabWidth = 2; }; 2C4D9E090CC9EF840031092D /* Windows.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = Windows.pas; path = Wrapper/Windows.pas; sourceTree = ""; tabWidth = 2; }; 2C4D9E440CC9F0ED0031092D /* switches.inc */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = switches.inc; path = ../switches.inc; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4FA2A70CDBAD1E002CC3B0 /* ustar-icon_v01.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = "ustar-icon_v01.icns"; path = "../../Graphics/ustar-icon_v01.icns"; sourceTree = SOURCE_ROOT; }; + 2C5663EE0D35645700D4FF53 /* portaudio.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = portaudio.pas; path = ../lib/portaudio/delphi/portaudio.pas; sourceTree = SOURCE_ROOT; }; + 2C56642B0D35683200D4FF53 /* SDLMain.m */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.objc; name = SDLMain.m; path = "/Library/Frameworks/JEDI-SDL.framework/SDL/SDLMain.m"; sourceTree = ""; }; + 2C56642F0D35688200D4FF53 /* SDL.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = SDL.h; path = /Library/Frameworks/SDL.framework/Versions/A/Headers/SDL.h; sourceTree = ""; }; 2C8937290CE393FB005D8A87 /* UPlatform.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UPlatform.pas; path = ../Classes/UPlatform.pas; sourceTree = SOURCE_ROOT; }; 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; lineEnding = 0; name = UPlatformMacOSX.pas; path = ../Classes/UPlatformMacOSX.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = StrUtils.pas; path = ../../../Modis/SDK/StrUtils.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2CDEA4F60CBD725B0096994C /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; + 2CE907900D1BC8A800A1FDFF /* libavcodec.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libavcodec.dylib; path = ../lib/ffmpeg/libavcodec.dylib; sourceTree = SOURCE_ROOT; }; + 2CE907910D1BC8A800A1FDFF /* libavformat.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libavformat.dylib; path = ../lib/ffmpeg/libavformat.dylib; sourceTree = SOURCE_ROOT; }; + 2CE907920D1BC8A800A1FDFF /* libavutil.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libavutil.dylib; path = ../lib/ffmpeg/libavutil.dylib; sourceTree = SOURCE_ROOT; }; 2CEA2ADE0CE385190097A5FF /* Graphics.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = Graphics.pas; path = Wrapper/Graphics.pas; sourceTree = ""; }; 2CEA2ADF0CE385190097A5FF /* JPEG.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = JPEG.pas; path = Wrapper/JPEG.pas; sourceTree = ""; }; 2CEA2AF00CE3868E0097A5FF /* PseudoThread.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = PseudoThread.pas; path = Wrapper/PseudoThread.pas; sourceTree = ""; }; @@ -489,19 +491,14 @@ 2CF552A10CDA42C900627463 /* avutil.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = avutil.pas; path = ../lib/ffmpeg/avutil.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2CF552A40CDA42C900627463 /* opt.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = opt.pas; path = ../lib/ffmpeg/opt.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2CF552A50CDA42C900627463 /* rational.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = rational.pas; path = ../lib/ffmpeg/rational.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; - 2CF552BF0CDA4B7B00627463 /* libavcodec.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libavcodec.dylib; path = ../lib/ffmpeg/libavcodec.dylib; sourceTree = SOURCE_ROOT; }; - 2CF552C00CDA4B7B00627463 /* libavformat.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libavformat.dylib; path = ../lib/ffmpeg/libavformat.dylib; sourceTree = SOURCE_ROOT; }; - 2CF552C10CDA4B7B00627463 /* libavutil.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libavutil.dylib; path = ../lib/ffmpeg/libavutil.dylib; sourceTree = SOURCE_ROOT; }; - 2CF552C20CDA4B7B00627463 /* libmp3lame.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libmp3lame.dylib; path = ../lib/ffmpeg/libmp3lame.dylib; sourceTree = SOURCE_ROOT; }; 2CF553070CDA51B500627463 /* sdlutils.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = sdlutils.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL/sdlutils.pas"; sourceTree = ""; tabWidth = 2; }; + 2CF77DB60CF7556C00F3B101 /* libUntil5000.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libUntil5000.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; 2CF8E6BD0CDFA8E80053A996 /* UPartyDefs.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UPartyDefs.pas; path = ../../../Modis/SDK/UPartyDefs.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; - 9845B6590B1F9B9E0084DD62 /* SDL.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL.h; path = /Library/Frameworks/SDL.framework/Versions/A/Headers/SDL.h; sourceTree = ""; }; 98B8BE330B1F947800162019 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 98B8BE370B1F949C00162019 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 98B8BE380B1F949C00162019 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 98B8BE570B1F972400162019 /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL.framework; path = /Library/Frameworks/SDL.framework; sourceTree = ""; }; 98B8BE5C0B1F974F00162019 /* sdl.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = sdl.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL/sdl.pas"; sourceTree = ""; tabWidth = 2; }; - 98B8BE750B1F97F800162019 /* SDLMain.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = SDLMain.m; path = "/Library/Frameworks/JEDI-SDL.framework/SDL/SDLMain.m"; sourceTree = ""; }; DD37F2430A60255800975B2D /* libfpcrtl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libfpcrtl.a; sourceTree = BUILT_PRODUCTS_DIR; }; DDC6851B09F57195004E4BFF /* UltraStarDX.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; path = UltraStarDX.pas; sourceTree = ""; tabWidth = 2; }; DDC6868B09F571C2004E4BFF /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 12; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; @@ -512,6 +509,13 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 2CF77DB40CF7556C00F3B101 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; DDC688C609F574E9004E4BFF /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -527,10 +531,9 @@ 2C4D9D9A0CC9EE0B0031092D /* SDL_image.framework in Frameworks */, 2C4D9D9B0CC9EE0B0031092D /* SDL_ttf.framework in Frameworks */, 2CF5512D0CDA29C600627463 /* libsqlite3.dylib in Frameworks */, - 2CF552C30CDA4B7B00627463 /* libavcodec.dylib in Frameworks */, - 2CF552C40CDA4B7B00627463 /* libavformat.dylib in Frameworks */, - 2CF552C50CDA4B7B00627463 /* libavutil.dylib in Frameworks */, - 2CF552C60CDA4B7B00627463 /* libmp3lame.dylib in Frameworks */, + 2CE907930D1BC8A800A1FDFF /* libavcodec.dylib in Frameworks */, + 2CE907940D1BC8A800A1FDFF /* libavformat.dylib in Frameworks */, + 2CE907950D1BC8A800A1FDFF /* libavutil.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -540,12 +543,11 @@ 2C4D9DEB0CC9EECC0031092D /* SDL */ = { isa = PBXGroup; children = ( + 2C56642F0D35688200D4FF53 /* SDL.h */, + 2C56642B0D35683200D4FF53 /* SDLMain.m */, 2CF553070CDA51B500627463 /* sdlutils.pas */, 2C4D9DEF0CC9EF210031092D /* sdl_ttf.pas */, - 2C4D9DF00CC9EF210031092D /* sdltruetypefont.pas */, 2C4D9DEC0CC9EF0A0031092D /* sdl_image.pas */, - 9845B6590B1F9B9E0084DD62 /* SDL.h */, - 98B8BE750B1F97F800162019 /* SDLMain.m */, 98B8BE5C0B1F974F00162019 /* sdl.pas */, ); name = SDL; @@ -565,6 +567,14 @@ name = Wrapper; sourceTree = ""; }; + 2C5663EC0D35642E00D4FF53 /* portaudio */ = { + isa = PBXGroup; + children = ( + 2C5663EE0D35645700D4FF53 /* portaudio.pas */, + ); + name = portaudio; + sourceTree = ""; + }; 2CDD43820CBBE8D400F364DE /* Classes */ = { isa = PBXGroup; children = ( @@ -572,7 +582,6 @@ 2C8937290CE393FB005D8A87 /* UPlatform.pas */, 2C4D9C620CC9EC8C0031092D /* TextGL.pas */, 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */, - 2C4D9C640CC9EC8C0031092D /* UAudio_FFMpeg.pas */, 2C4D9C650CC9EC8C0031092D /* UCatCovers.pas */, 2C4D9C660CC9EC8C0031092D /* UCommandLine.pas */, 2C4D9C670CC9EC8C0031092D /* UCommon.pas */, @@ -714,6 +723,7 @@ isa = PBXGroup; children = ( 2CE8C7CE0CBAA47D00E4D835 /* BASS */, + 2C5663EC0D35642E00D4FF53 /* portaudio */, 2CF5529C0CDA428000627463 /* ffmpeg */, 2CE1F4080CC3EEA400CD02E5 /* FreeImage */, 2C4D9DEB0CC9EECC0031092D /* SDL */, @@ -744,6 +754,14 @@ name = ffmpeg; sourceTree = ""; }; + 2CF77DBA0CF755CA00F3B101 /* Modis */ = { + isa = PBXGroup; + children = ( + 2C4B70220CF757A400B0F0BD /* Until5000.dpr */, + ); + name = Modis; + sourceTree = ""; + }; DD7C45450A6E72DE003FA52B /* Source */ = { isa = PBXGroup; children = ( @@ -753,6 +771,7 @@ 2CDD438D0CBBE8F700F364DE /* Menu */, 2CF5508A0CDA228800627463 /* SDK */, 2C4D9DF50CC9EF3A0031092D /* Wrapper */, + 2CF77DBA0CF755CA00F3B101 /* Modis */, DDC6851B09F57195004E4BFF /* UltraStarDX.pas */, 2CF551A70CDA356800627463 /* UltraStar.dpr */, 2C4D9E440CC9F0ED0031092D /* switches.inc */, @@ -763,6 +782,9 @@ DDC6850D09F5717A004E4BFF = { isa = PBXGroup; children = ( + 2CE907900D1BC8A800A1FDFF /* libavcodec.dylib */, + 2CE907910D1BC8A800A1FDFF /* libavformat.dylib */, + 2CE907920D1BC8A800A1FDFF /* libavutil.dylib */, 98B8BE570B1F972400162019 /* SDL.framework */, 2C4D9D980CC9EE0B0031092D /* SDL_image.framework */, 2C4D9D990CC9EE0B0031092D /* SDL_ttf.framework */, @@ -773,10 +795,6 @@ 2C4D9CE90CC9ECB50031092D /* libbass.dylib */, 2C4D9D960CC9EDEB0031092D /* libfreeimage.dylib */, 2CF5512C0CDA29C600627463 /* libsqlite3.dylib */, - 2CF552BF0CDA4B7B00627463 /* libavcodec.dylib */, - 2CF552C00CDA4B7B00627463 /* libavformat.dylib */, - 2CF552C10CDA4B7B00627463 /* libavutil.dylib */, - 2CF552C20CDA4B7B00627463 /* libmp3lame.dylib */, DD7C45450A6E72DE003FA52B /* Source */, DDC6868A09F571C2004E4BFF /* Resources */, 2CDD8D0B0CC5539900E4169D /* UltraStarDX Resources */, @@ -802,13 +820,41 @@ children = ( DDC688C809F574E9004E4BFF /* UltraStarDX.app */, DD37F2430A60255800975B2D /* libfpcrtl.a */, + 2CF77DB60CF7556C00F3B101 /* libUntil5000.dylib */, ); name = Products; sourceTree = ""; }; /* End PBXGroup section */ +/* Begin PBXHeadersBuildPhase section */ + 2CF77DB20CF7556C00F3B101 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + /* Begin PBXNativeTarget section */ + 2CF77DB50CF7556C00F3B101 /* Modi_Until5000 */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2CF77DB90CF7558B00F3B101 /* Build configuration list for PBXNativeTarget "Modi_Until5000" */; + buildPhases = ( + 2CF77DB20CF7556C00F3B101 /* Headers */, + 2CF77DB30CF7556C00F3B101 /* Sources */, + 2CF77DB40CF7556C00F3B101 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Modi_Until5000; + productName = Lib_UltraPong; + productReference = 2CF77DB60CF7556C00F3B101 /* libUntil5000.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; DD37F2420A60255800975B2D /* fpcrtl */ = { isa = PBXNativeTarget; buildConfigurationList = DD37F2560A60258300975B2D /* Build configuration list for PBXNativeTarget "fpcrtl" */; @@ -885,6 +931,7 @@ DDC688C709F574E9004E4BFF /* UltraStarDX */, DDC688D409F57523004E4BFF /* Put all program sources also in this target */, DD37F2420A60255800975B2D /* fpcrtl */, + 2CF77DB50CF7556C00F3B101 /* Modi_Until5000 */, ); }; /* End PBXProject section */ @@ -972,16 +1019,23 @@ /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 2CF77DB30CF7556C00F3B101 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2C4B70240CF7584500B0F0BD /* ModiSDK.pas in Sources */, + 2C4B70230CF7581000B0F0BD /* Until5000.dpr in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; DDC688C509F574E9004E4BFF /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 2CDD4BE20CB947BE00549FAC /* UltraStarDX.pas in Sources */, 2CDD4BE00CB947B100549FAC /* sdl.pas in Sources */, - 98B8BE760B1F97F800162019 /* SDLMain.m in Sources */, 2C4D9C8F0CC9EC8C0031092D /* TextGL.pas in Sources */, 2C4D9C900CC9EC8C0031092D /* UAudio_bass.pas in Sources */, - 2C4D9C910CC9EC8C0031092D /* UAudio_FFMpeg.pas in Sources */, 2C4D9C920CC9EC8C0031092D /* UCatCovers.pas in Sources */, 2C4D9C930CC9EC8C0031092D /* UCommandLine.pas in Sources */, 2C4D9C940CC9EC8C0031092D /* UCommon.pas in Sources */, @@ -1037,7 +1091,6 @@ 2C4D9DDF0CC9EE6F0031092D /* UMenuText.pas in Sources */, 2C4D9DED0CC9EF0A0031092D /* sdl_image.pas in Sources */, 2C4D9DF10CC9EF210031092D /* sdl_ttf.pas in Sources */, - 2C4D9DF20CC9EF210031092D /* sdltruetypefont.pas in Sources */, 2C4D9E100CC9EF840031092D /* OpenGL12.pas in Sources */, 2C4D9E150CC9EF840031092D /* Windows.pas in Sources */, 2C4D9E450CC9F0ED0031092D /* switches.inc in Sources */, @@ -1095,6 +1148,8 @@ 2CEA2AF10CE3868E0097A5FF /* PseudoThread.pas in Sources */, 2C89372A0CE393FB005D8A87 /* UPlatform.pas in Sources */, 2C8937340CE395CE005D8A87 /* UPlatformMacOSX.pas in Sources */, + 2C5663EF0D35645700D4FF53 /* portaudio.pas in Sources */, + 2C56642C0D35683200D4FF53 /* SDLMain.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1106,7 +1161,6 @@ DD37F23D0A60252800975B2D /* UltraStarDX.pas in Sources */, 2C4D9CBC0CC9EC8C0031092D /* TextGL.pas in Sources */, 2C4D9CBD0CC9EC8C0031092D /* UAudio_bass.pas in Sources */, - 2C4D9CBE0CC9EC8C0031092D /* UAudio_FFMpeg.pas in Sources */, 2C4D9CBF0CC9EC8C0031092D /* UCatCovers.pas in Sources */, 2C4D9CC00CC9EC8C0031092D /* UCommandLine.pas in Sources */, 2C4D9CC10CC9EC8C0031092D /* UCommon.pas in Sources */, @@ -1162,7 +1216,6 @@ 2C4D9DE90CC9EE6F0031092D /* UMenuText.pas in Sources */, 2C4D9DEE0CC9EF0A0031092D /* sdl_image.pas in Sources */, 2C4D9DF30CC9EF210031092D /* sdl_ttf.pas in Sources */, - 2C4D9DF40CC9EF210031092D /* sdltruetypefont.pas in Sources */, 2C4D9E1C0CC9EF840031092D /* OpenGL12.pas in Sources */, 2C4D9E210CC9EF840031092D /* Windows.pas in Sources */, 2C4D9E460CC9F0ED0031092D /* switches.inc in Sources */, @@ -1220,6 +1273,7 @@ 2CEA2AF20CE3868E0097A5FF /* PseudoThread.pas in Sources */, 2C89372B0CE393FB005D8A87 /* UPlatform.pas in Sources */, 2C8937370CE395CE005D8A87 /* UPlatformMacOSX.pas in Sources */, + 2C5663F00D35645700D4FF53 /* portaudio.pas in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1239,6 +1293,38 @@ /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ + 2CF77DB70CF7556D00F3B101 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + EXECUTABLE_PREFIX = lib; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + INSTALL_PATH = /usr/local/lib; + LD_DYLIB_INSTALL_NAME = "@executable_path/libUntil5000.dylib"; + PREBINDING = NO; + PRODUCT_NAME = Until5000; + ZERO_LINK = YES; + }; + name = Debug; + }; + 2CF77DB80CF7556D00F3B101 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + EXECUTABLE_PREFIX = lib; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + INSTALL_PATH = /usr/local/lib; + PREBINDING = NO; + PRODUCT_NAME = Lib_UltraPong; + ZERO_LINK = NO; + }; + name = Release; + }; DD37F2570A60258300975B2D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1328,12 +1414,14 @@ "$(LIBRARY_SEARCH_PATHS_QUOTED_6)", "$(LIBRARY_SEARCH_PATHS_QUOTED_2)", "$(LIBRARY_SEARCH_PATHS_QUOTED_3)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", ); LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/build/Debug\""; LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)/../lib/SQLite\""; LIBRARY_SEARCH_PATHS_QUOTED_3 = "\"$(SRCROOT)/../lib/ffmpeg\""; LIBRARY_SEARCH_PATHS_QUOTED_5 = "\"$(SRCROOT)/../lib/bass\""; LIBRARY_SEARCH_PATHS_QUOTED_6 = "\"$(SRCROOT)/../lib/FreeImage\""; + LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../lib/ffmpeg\""; LINK_WITH_STANDARD_LIBRARIES = YES; OTHER_LDFLAGS = ( "-framework", @@ -1372,6 +1460,7 @@ "$(LIBRARY_SEARCH_PATHS_QUOTED_6)", "$(LIBRARY_SEARCH_PATHS_QUOTED_7)", "$(LIBRARY_SEARCH_PATHS_QUOTED_8)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_9)", ); LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/build/Debug\""; LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)/Bass\""; @@ -1381,6 +1470,7 @@ LIBRARY_SEARCH_PATHS_QUOTED_6 = "\"$(SRCROOT)/../lib/FreeImage\""; LIBRARY_SEARCH_PATHS_QUOTED_7 = "\"$(SRCROOT)/../lib/SQLite\""; LIBRARY_SEARCH_PATHS_QUOTED_8 = "\"$(SRCROOT)/../lib/ffmpeg\""; + LIBRARY_SEARCH_PATHS_QUOTED_9 = "\"$(SRCROOT)/../lib/ffmpeg\""; LINK_WITH_STANDARD_LIBRARIES = YES; OTHER_LDFLAGS = ( "-framework", @@ -1436,6 +1526,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 2CF77DB90CF7558B00F3B101 /* Build configuration list for PBXNativeTarget "Modi_Until5000" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2CF77DB70CF7556D00F3B101 /* Debug */, + 2CF77DB80CF7556D00F3B101 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; DD37F2560A60258300975B2D /* Build configuration list for PBXNativeTarget "fpcrtl" */ = { isa = XCConfigurationList; buildConfigurations = ( -- cgit v1.2.3 From 2d5c9ab3a153b95d0a1bc089ebe8ae2eb7376afa Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Wed, 9 Jan 2008 22:36:26 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@774 b956fd51-792f-4845-bead-9b4dfca2ff2c --- .../MacOSX/UltraStarDX.xcodeproj/eddie.mode1v3 | 1407 ++++++++++++++++++++ 1 file changed, 1407 insertions(+) create mode 100644 Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1v3 (limited to 'Game/Code') diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1v3 b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1v3 new file mode 100644 index 00000000..1039e4c9 --- /dev/null +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1v3 @@ -0,0 +1,1407 @@ + + + + + ActivePerspectiveName + Project + AllowedModules + + + BundleLoadPath + + MaxInstances + n + Module + PBXSmartGroupTreeModule + Name + Groups and Files Outline View + + + BundleLoadPath + + MaxInstances + n + Module + PBXNavigatorGroup + Name + Editor + + + BundleLoadPath + + MaxInstances + n + Module + XCTaskListModule + Name + Task List + + + BundleLoadPath + + MaxInstances + n + Module + XCDetailModule + Name + File and Smart Group Detail Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXBuildResultsModule + Name + Detailed Build Results Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXProjectFindModule + Name + Project Batch Find Tool + + + BundleLoadPath + + MaxInstances + n + Module + XCProjectFormatConflictsModule + Name + Project Format Conflicts List + + + BundleLoadPath + + MaxInstances + n + Module + PBXBookmarksModule + Name + Bookmarks Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXClassBrowserModule + Name + Class Browser + + + BundleLoadPath + + MaxInstances + n + Module + PBXCVSModule + Name + Source Code Control Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXDebugBreakpointsModule + Name + Debug Breakpoints Tool + + + BundleLoadPath + + MaxInstances + n + Module + XCDockableInspector + Name + Inspector + + + BundleLoadPath + + MaxInstances + n + Module + PBXOpenQuicklyModule + Name + Open Quickly Tool + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugSessionModule + Name + Debugger + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugCLIModule + Name + Debug Console + + + BundleLoadPath + + MaxInstances + n + Module + XCSnapshotModule + Name + Snapshots Tool + + + Description + DefaultDescriptionKey + DockingSystemVisible + + Extension + mode1v3 + FavBarConfig + + PBXProjectModuleGUID + 2C349F430CF222D900A55A81 + XCBarModuleItemNames + + XCBarModuleItems + + + FirstTimeWindowDisplayed + + Identifier + com.apple.perspectives.project.mode1v3 + MajorVersion + 33 + MinorVersion + 0 + Name + Default + Notifications + + OpenEditors + + + Content + + PBXProjectModuleGUID + 2C5A593F0D35811F00DCBB8F + PBXProjectModuleLabel + UIni.pas + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 2C5A59400D35811F00DCBB8F + PBXProjectModuleLabel + UIni.pas + _historyCapacity + 0 + bookmark + 2C07C94F0D3582C9002A4079 + history + + 2C5A59420D35813800DCBB8F + + + SplitCount + 1 + + StatusBarVisibility + + + Geometry + + Frame + {{0, 20}, {797, 748}} + PBXModuleWindowStatusBarHidden2 + + RubberWindowFrame + 107 150 797 789 0 0 1680 1028 + + + + PerspectiveWidths + + -1 + -1 + + Perspectives + + + ChosenToolbarItems + + active-target-popup + active-buildstyle-popup + action + NSToolbarFlexibleSpaceItem + buildOrClean + build-and-goOrGo + com.apple.ide.PBXToolbarStopButton + get-info + toggle-editor + NSToolbarFlexibleSpaceItem + com.apple.pbx.toolbar.searchfield + + ControllerClassBaseName + + IconName + WindowOfProjectWithEditor + Identifier + perspective.project + IsVertical + + Layout + + + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 1CE0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 266 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + DDC6850D09F5717A004E4BFF + DD7C45450A6E72DE003FA52B + 2CF5510C0CDA28F000627463 + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 18 + 15 + 14 + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {266, 694}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {283, 712}} + GroupTreeTableConfiguration + + MainColumn + 266 + + RubberWindowFrame + 799 242 817 753 0 0 1680 1028 + + Module + PBXSmartGroupTreeModule + Proportion + 283pt + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20306471E060097A5F4 + PBXProjectModuleLabel + + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1CE0B20406471E060097A5F4 + PBXProjectModuleLabel + + + SplitCount + 1 + + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {529, 0}} + RubberWindowFrame + 799 242 817 753 0 0 1680 1028 + + Module + PBXNavigatorGroup + Proportion + 0pt + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20506471E060097A5F4 + PBXProjectModuleLabel + Detail + + GeometryConfiguration + + Frame + {{0, 5}, {529, 707}} + RubberWindowFrame + 799 242 817 753 0 0 1680 1028 + + Module + XCDetailModule + Proportion + 707pt + + + Proportion + 529pt + + + Name + Project + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + XCModuleDock + PBXNavigatorGroup + XCDetailModule + + TableOfContents + + 2C07C9450D3582BA002A4079 + 1CE0B1FE06471DED0097A5F4 + 2C07C9460D3582BA002A4079 + 1CE0B20306471E060097A5F4 + 1CE0B20506471E060097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.defaultV3 + + + ControllerClassBaseName + + IconName + WindowOfProject + Identifier + perspective.morph + IsVertical + + Layout + + + BecomeActive + 1 + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 11E0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 29B97314FDCFA39411CA2CEA + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {186, 337}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + 1 + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 355}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 373 269 690 397 0 0 1440 878 + + Module + PBXSmartGroupTreeModule + Proportion + 100% + + + Name + Morph + PreferredWidth + 300 + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + + TableOfContents + + 11E0B1FE06471DED0097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default.shortV3 + + + PerspectivesBarVisible + + ShelfIsVisible + + StatusbarIsVisible + + TimeStamp + 0.0 + ToolbarDisplayMode + 1 + ToolbarIsVisible + + ToolbarSizeMode + 1 + Type + Perspectives + UpdateMessage + The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'? + WindowJustification + 5 + WindowOrderList + + 1CD10A99069EF8BA00B06720 + 2C5A593F0D35811F00DCBB8F + /Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj + + WindowString + 799 242 817 753 0 0 1680 1028 + WindowToolsV3 + + + FirstTimeWindowDisplayed + + Identifier + windowTool.build + IsVertical + + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528F0623707200166675 + PBXProjectModuleLabel + UFiles.pas + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {942, 546}} + RubberWindowFrame + 105 189 942 828 0 0 1680 1028 + + Module + PBXNavigatorGroup + Proportion + 546pt + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + XCMainBuildResultsModuleGUID + PBXProjectModuleLabel + Build + XCBuildResultsTrigger_Collapse + 1021 + XCBuildResultsTrigger_Open + 1011 + + GeometryConfiguration + + Frame + {{0, 551}, {942, 236}} + RubberWindowFrame + 105 189 942 828 0 0 1680 1028 + + Module + PBXBuildResultsModule + Proportion + 236pt + + + Proportion + 787pt + + + Name + Build Results + ServiceClasses + + PBXBuildResultsModule + + StatusbarIsVisible + + TableOfContents + + 2C65660B0CF2236C0041F7DC + 2C5A58BA0D3573FD00DCBB8F + 1CD0528F0623707200166675 + XCMainBuildResultsModuleGUID + + ToolbarConfiguration + xcode.toolbar.config.buildV3 + WindowString + 105 189 942 828 0 0 1680 1028 + WindowToolGUID + 2C65660B0CF2236C0041F7DC + WindowToolIsVisible + + + + FirstTimeWindowDisplayed + + Identifier + windowTool.debugger + IsVertical + + Layout + + + Dock + + + ContentConfiguration + + Debugger + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {312, 440}} + {{312, 0}, {591, 440}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {903, 440}} + {{0, 440}, {903, 385}} + + + + LauncherConfigVersion + 8 + PBXProjectModuleGUID + 1C162984064C10D400B95A72 + PBXProjectModuleLabel + Debug - GLUTExamples (Underwater) + + GeometryConfiguration + + DebugConsoleVisible + None + DebugConsoleWindowFrame + {{200, 200}, {500, 300}} + DebugSTDIOWindowFrame + {{200, 200}, {500, 300}} + Frame + {{0, 0}, {903, 825}} + PBXDebugSessionStackFrameViewKey + + DebugVariablesTableConfiguration + + Name + 120 + Value + 85 + Summary + 361 + + Frame + {{312, 0}, {591, 440}} + RubberWindowFrame + 130 124 903 866 0 0 1680 1028 + + RubberWindowFrame + 130 124 903 866 0 0 1680 1028 + + Module + PBXDebugSessionModule + Proportion + 825pt + + + Proportion + 825pt + + + Name + Debugger + ServiceClasses + + PBXDebugSessionModule + + StatusbarIsVisible + + TableOfContents + + 1CD10A99069EF8BA00B06720 + 2C07C9480D3582BA002A4079 + 1C162984064C10D400B95A72 + 2C07C9490D3582BA002A4079 + 2C07C94A0D3582BA002A4079 + 2C07C94B0D3582BA002A4079 + 2C07C94C0D3582BA002A4079 + 2C07C94D0D3582BA002A4079 + + ToolbarConfiguration + xcode.toolbar.config.debugV3 + WindowString + 130 124 903 866 0 0 1680 1028 + WindowToolGUID + 1CD10A99069EF8BA00B06720 + WindowToolIsVisible + + + + FirstTimeWindowDisplayed + + Identifier + windowTool.find + IsVertical + + Layout + + + Dock + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CDD528C0622207200134675 + PBXProjectModuleLabel + avformat.pas + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {790, 502}} + RubberWindowFrame + 821 68 790 888 0 0 1680 1028 + + Module + PBXNavigatorGroup + Proportion + 790pt + + + Proportion + 502pt + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528E0623707200166675 + PBXProjectModuleLabel + Project Find + + GeometryConfiguration + + Frame + {{0, 507}, {790, 340}} + RubberWindowFrame + 821 68 790 888 0 0 1680 1028 + + Module + PBXProjectFindModule + Proportion + 340pt + + + Proportion + 847pt + + + Name + Project Find + ServiceClasses + + PBXProjectFindModule + + StatusbarIsVisible + + TableOfContents + + 1C530D57069F1CE1000CFCEE + 2CE907AC0D1BC9A200A1FDFF + 2CE907AD0D1BC9A200A1FDFF + 1CDD528C0622207200134675 + 1CD0528E0623707200166675 + + WindowString + 821 68 790 888 0 0 1680 1028 + WindowToolGUID + 1C530D57069F1CE1000CFCEE + WindowToolIsVisible + + + + FirstTimeWindowDisplayed + + Identifier + MENUSEPARATOR + + + FirstTimeWindowDisplayed + + Identifier + windowTool.debuggerConsole + IsVertical + + Layout + + + Dock + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAAC065D492600B07095 + PBXProjectModuleLabel + Debugger Console + + GeometryConfiguration + + Frame + {{0, 0}, {779, 729}} + RubberWindowFrame + 890 238 779 770 0 0 1680 1028 + + Module + PBXDebugCLIModule + Proportion + 729pt + + + Proportion + 729pt + + + Name + Debugger Console + ServiceClasses + + PBXDebugCLIModule + + StatusbarIsVisible + + TableOfContents + + 1C78EAAD065D492600B07095 + 2C5A58BB0D3573FD00DCBB8F + 1C78EAAC065D492600B07095 + + ToolbarConfiguration + xcode.toolbar.config.consoleV3 + WindowString + 890 238 779 770 0 0 1680 1028 + WindowToolGUID + 1C78EAAD065D492600B07095 + WindowToolIsVisible + + + + Identifier + windowTool.snapshots + Layout + + + Dock + + + Module + XCSnapshotModule + Proportion + 100% + + + Proportion + 100% + + + Name + Snapshots + ServiceClasses + + XCSnapshotModule + + StatusbarIsVisible + Yes + ToolbarConfiguration + xcode.toolbar.config.snapshots + WindowString + 315 824 300 550 0 0 1440 878 + WindowToolIsVisible + Yes + + + FirstTimeWindowDisplayed + + Identifier + windowTool.scm + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAB2065D492600B07095 + PBXProjectModuleLabel + + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {452, 0}} + RubberWindowFrame + 194 589 452 308 0 0 1680 1028 + + Module + PBXNavigatorGroup + Proportion + 0pt + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CD052920623707200166675 + PBXProjectModuleLabel + SCM Results + + GeometryConfiguration + + Frame + {{0, 5}, {452, 262}} + RubberWindowFrame + 194 589 452 308 0 0 1680 1028 + + Module + PBXCVSModule + Proportion + 262pt + + + Proportion + 267pt + + + Name + SCM + ServiceClasses + + PBXCVSModule + + StatusbarIsVisible + + TableOfContents + + 1C78EAB4065D492600B07095 + 1C78EAB5065D492600B07095 + 1C78EAB2065D492600B07095 + 1CD052920623707200166675 + + ToolbarConfiguration + xcode.toolbar.config.scm + WindowString + 194 589 452 308 0 0 1680 1028 + + + FirstTimeWindowDisplayed + + Identifier + windowTool.breakpoints + IsVertical + + Layout + + + Dock + + + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C77FABC04509CD000000102 + + PBXProjectModuleGUID + 1CE0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + no + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 168 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 1C77FABC04509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {168, 350}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + + + GeometryConfiguration + + Frame + {{0, 0}, {185, 368}} + GroupTreeTableConfiguration + + MainColumn + 168 + + RubberWindowFrame + 424 558 744 409 0 0 1680 1028 + + Module + PBXSmartGroupTreeModule + Proportion + 185pt + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CA1AED706398EBD00589147 + PBXProjectModuleLabel + Detail + + GeometryConfiguration + + Frame + {{190, 0}, {554, 368}} + RubberWindowFrame + 424 558 744 409 0 0 1680 1028 + + Module + XCDetailModule + Proportion + 554pt + + + Proportion + 368pt + + + MajorVersion + 3 + MinorVersion + 0 + Name + Breakpoints + ServiceClasses + + PBXSmartGroupTreeModule + XCDetailModule + + StatusbarIsVisible + + TableOfContents + + 2CA2CD2C0CF61AD5008733A1 + 2CA2CD2D0CF61AD5008733A1 + 1CE0B1FE06471DED0097A5F4 + 1CA1AED706398EBD00589147 + + ToolbarConfiguration + xcode.toolbar.config.breakpointsV3 + WindowString + 424 558 744 409 0 0 1680 1028 + WindowToolGUID + 2CA2CD2C0CF61AD5008733A1 + WindowToolIsVisible + + + + FirstTimeWindowDisplayed + + Identifier + windowTool.debugAnimator + Layout + + + Dock + + + Module + PBXNavigatorGroup + Proportion + 100% + + + Proportion + 100% + + + Name + Debug Visualizer + ServiceClasses + + PBXNavigatorGroup + + StatusbarIsVisible + + ToolbarConfiguration + xcode.toolbar.config.debugAnimatorV3 + WindowString + 100 100 700 500 0 0 1280 1002 + + + FirstTimeWindowDisplayed + + Identifier + windowTool.bookmarks + Layout + + + Dock + + + Module + PBXBookmarksModule + Proportion + 100% + + + Proportion + 100% + + + Name + Bookmarks + ServiceClasses + + PBXBookmarksModule + + StatusbarIsVisible + + WindowString + 538 42 401 187 0 0 1280 1002 + + + Identifier + windowTool.projectFormatConflicts + Layout + + + Dock + + + Module + XCProjectFormatConflictsModule + Proportion + 100% + + + Proportion + 100% + + + Name + Project Format Conflicts + ServiceClasses + + XCProjectFormatConflictsModule + + StatusbarIsVisible + + WindowContentMinSize + 450 300 + WindowString + 50 850 472 307 0 0 1440 877 + + + FirstTimeWindowDisplayed + + Identifier + windowTool.classBrowser + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + OptionsSetName + Hierarchy, all classes + PBXProjectModuleGUID + 1CA6456E063B45B4001379D8 + PBXProjectModuleLabel + Class Browser - NSObject + + GeometryConfiguration + + ClassesFrame + {{0, 0}, {374, 96}} + ClassesTreeTableConfiguration + + PBXClassNameColumnIdentifier + 208 + PBXClassBookColumnIdentifier + 22 + + Frame + {{0, 0}, {630, 331}} + MembersFrame + {{0, 105}, {374, 395}} + MembersTreeTableConfiguration + + PBXMemberTypeIconColumnIdentifier + 22 + PBXMemberNameColumnIdentifier + 216 + PBXMemberTypeColumnIdentifier + 97 + PBXMemberBookColumnIdentifier + 22 + + PBXModuleWindowStatusBarHidden2 + 1 + RubberWindowFrame + 385 179 630 352 0 0 1440 878 + + Module + PBXClassBrowserModule + Proportion + 332pt + + + Proportion + 332pt + + + Name + Class Browser + ServiceClasses + + PBXClassBrowserModule + + StatusbarIsVisible + + TableOfContents + + 1C0AD2AF069F1E9B00FABCE6 + 1C0AD2B0069F1E9B00FABCE6 + 1CA6456E063B45B4001379D8 + + ToolbarConfiguration + xcode.toolbar.config.classbrowser + WindowString + 385 179 630 352 0 0 1440 878 + WindowToolGUID + 1C0AD2AF069F1E9B00FABCE6 + WindowToolIsVisible + + + + Identifier + windowTool.refactoring + IncludeInToolsMenu + + Layout + + + Dock + + + BecomeActive + + GeometryConfiguration + + Frame + {0, 0}, {500, 335} + RubberWindowFrame + {0, 0}, {500, 335} + + Module + XCRefactoringModule + Proportion + 100% + + + Proportion + 100% + + + Name + Refactoring + ServiceClasses + + XCRefactoringModule + + WindowString + 200 200 500 356 0 0 1920 1200 + + + + -- cgit v1.2.3 From d69c2a35192623e5d923f17c07d96d980d045adf Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 10 Jan 2008 22:59:10 +0000 Subject: partial seeking and mixing support git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@775 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudioDecoder_FFMpeg.pas | 273 +++++++++++++++++++------ Game/Code/Classes/UAudioPlayback_Portaudio.pas | 123 ++++++----- 2 files changed, 275 insertions(+), 121 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudioDecoder_FFMpeg.pas b/Game/Code/Classes/UAudioDecoder_FFMpeg.pas index 54055454..c81e4be1 100644 --- a/Game/Code/Classes/UAudioDecoder_FFMpeg.pas +++ b/Game/Code/Classes/UAudioDecoder_FFMpeg.pas @@ -26,9 +26,11 @@ uses Classes, {$ENDIF} SysUtils, SDL, - avcodec, // FFMpeg Audio file decoding + avcodec, // FFMpeg Audio file decoding avformat, avutil, + avio, // used for url_ferror + mathematics, // used for av_rescale_q ULog, UMusic; @@ -64,10 +66,15 @@ type function Put(pkt : PAVPacket): integer; function Get(var pkt: TAVPacket; block: boolean): integer; + procedure Flush(); end; +const + MAX_AUDIOQ_SIZE = (5 * 16 * 1024); + var - EOSPacket: TAVPacket; + EOFPacket: TAVPacket; + FlushPacket: TAVPacket; type PAudioBuffer = ^TAudioBuffer; @@ -76,9 +83,17 @@ type type TFFMpegDecodeStream = class(TAudioDecodeStream) private - status: TStreamStatus; + _EOF: boolean; // end-of-stream flag + _EOF_lock : PSDL_Mutex; + + lock : PSDL_Mutex; + resumeCond : PSDL_Cond; + + quitRequest : boolean; - EOS_Flag: boolean; // end-of-stream flag + seekRequest: boolean; + seekFlags : integer; + seekPos : int64; parseThread: PSDL_Thread; packetQueue: TPacketQueue; @@ -87,8 +102,8 @@ type pFormatCtx : PAVFormatContext; pCodecCtx : PAVCodecContext; pCodec : PAVCodec; - ffmpegStreamID : Integer; - ffmpegStream : PAVStream; + ffmpegStreamIndex : Integer; + ffmpegStream : PAVStream; // "static" vars for DecodeFrame pkt : TAVPacket; @@ -101,6 +116,7 @@ type audio_buf : TAudioBuffer; function DecodeFrame(var buffer: TAudioBuffer; bufSize: integer): integer; + procedure SetEOF(state: boolean); public constructor Create(pFormatCtx: PAVFormatContext; pCodecCtx: PAVCodecContext; pCodec: PAVCodec; @@ -114,7 +130,7 @@ type function GetSampleRate(): cardinal; override; function GetPosition: real; override; procedure SetPosition(Time: real); override; - function IsEOS(): boolean; override; + function IsEOF(): boolean; override; function ReadData(Buffer: PChar; BufSize: integer): integer; override; end; @@ -122,7 +138,7 @@ type type TAudioDecoder_FFMpeg = class( TInterfacedObject, IAudioDecoder ) private - class function FindAudioStreamID(pFormatCtx : PAVFormatContext): integer; + class function FindAudioStreamIndex(pFormatCtx : PAVFormatContext): integer; public function GetName: String; @@ -144,7 +160,6 @@ constructor TFFMpegDecodeStream.Create(pFormatCtx: PAVFormatContext; begin inherited Create(); - status := sStopped; packetQueue := TPacketQueue.Create(); audio_pkt_data := nil; @@ -158,30 +173,46 @@ begin Self.pFormatCtx := pFormatCtx; Self.pCodecCtx := pCodecCtx; Self.pCodec := pCodec; - Self.ffmpegStreamID := ffmpegStreamID; - Self.ffmpegStream := ffmpegStream; + Self.ffmpegStreamIndex := ffmpegStreamIndex; + Self.ffmpegStream := ffmpegStream; - EOS_Flag := false; + _EOF := false; + _EOF_lock := SDL_CreateMutex(); + + lock := SDL_CreateMutex(); + resumeCond := SDL_CreateCond(); parseThread := SDL_CreateThread(@ParseAudio, Self); end; destructor TFFMpegDecodeStream.Destroy(); begin - packetQueue.Free(); - //SDL_WaitThread(parseThread, nil); + //Close(); + //packetQueue.Free(); inherited; end; procedure TFFMpegDecodeStream.Close(); begin + // TODO: abort thread + //quitRequest := true; + //SDL_WaitThread(parseThread, nil); + + (* // Close the codec - avcodec_close(pCodecCtx); + if (pCodecCtx <> nil) then + begin + avcodec_close(pCodecCtx); + pCodecCtx := nil; + end; // Close the video file - av_close_input_file(pFormatCtx); - - // TODO: abort thread + if (pFormatCtx <> nil) then + begin + av_close_input_file(pFormatCtx); + pFormatCtx := nil; + end; + *) end; function TFFMpegDecodeStream.GetLength(): real; @@ -199,24 +230,134 @@ begin result := pCodecCtx^.sample_rate; end; -function TFFMpegDecodeStream.IsEOS(): boolean; +function TFFMpegDecodeStream.IsEOF(): boolean; +begin + SDL_mutexP(_EOF_lock); + result := _EOF; + SDL_mutexV(_EOF_lock); +end; + +procedure TFFMpegDecodeStream.SetEOF(state: boolean); +begin + SDL_mutexP(_EOF_lock); + _EOF := state; + SDL_mutexV(_EOF_lock); +end; + +function TFFMpegDecodeStream.GetPosition(): real; +var + bytes: integer; begin - result := EOS_Flag; + // see: tutorial on synching (audio-clock) + Result := 0; end; +procedure TFFMpegDecodeStream.SetPosition(Time: real); +var + bytes: integer; +begin + SDL_mutexP(lock); + seekPos := Trunc(Time * AV_TIME_BASE); + // FIXME: seek_flags = rel < 0 ? AVSEEK_FLAG_BACKWARD : 0 + seekFlags := 0; + seekRequest := true; + SDL_CondSignal(resumeCond); + SDL_mutexV(lock); +end; function ParseAudio(streamPtr: Pointer): integer; cdecl; var packet: TAVPacket; stream: TFFMpegDecodeStream; + seekTarget: int64; + eofState: boolean; begin stream := TFFMpegDecodeStream(streamPtr); + eofState := false; - while (av_read_frame(stream.pFormatCtx, packet) >= 0) do + while (true) do begin + + SDL_mutexP(stream.lock); + + // wait if end-of-file reached + if (eofState) then + begin + if (not (stream.seekRequest or stream.quitRequest)) then + begin + // signal end-of-file + stream.packetQueue.put(@EOFPacket); + // wait for reuse or destruction of stream + repeat + SDL_CondWait(stream.resumeCond, stream.lock); + until (stream.seekRequest or stream.quitRequest); + end; + eofState := false; + stream.SetEOF(false); + end; + + if (stream.quitRequest) then + begin + break; + end; + + // handle seek-request + if(stream.seekRequest) then + begin + // TODO: Do we need this? + // The position is converted to AV_TIME_BASE and then to the stream-specific base. + // Why not convert to the stream-specific one from the beginning. + seekTarget := av_rescale_q(stream.seekPos, AV_TIME_BASE_Q, stream.ffmpegStream^.time_base); + if(av_seek_frame(stream.pFormatCtx, stream.ffmpegStreamIndex, + seekTarget, stream.seekFlags) = 0) then + begin + Log.LogStatus(stream.pFormatCtx^.filename + ': error while seeking', 'UAudioDecoder_FFMpeg'); + end + else + begin + stream.packetQueue.Flush(); + stream.packetQueue.Put(@FlushPacket); + end; + stream.seekRequest := false; + end; + + SDL_mutexV(stream.lock); + + + if(stream.packetQueue.size > MAX_AUDIOQ_SIZE) then + begin + SDL_Delay(10); + continue; + end; + + if(av_read_frame(stream.pFormatCtx, packet) < 0) then + begin + // check for end-of-file (eof is not an error) + if(url_feof(@stream.pFormatCtx^.pb) <> 0) then + begin + eofState := true; + continue; + end; + + // check for errors + if(url_ferror(@stream.pFormatCtx^.pb) = 0) then + begin + // no error -> wait for user input + SDL_Delay(100); + continue; + end + else + begin + // an error occured -> abort + // TODO: eof or quit? + eofState := true; + continue; + end; + end; + //writeln( 'ffmpeg - av_read_frame' ); - if (packet.stream_index = stream.ffmpegStreamID) then + if(packet.stream_index = stream.ffmpegStreamIndex) then begin //writeln( 'packet_queue_put' ); stream.packetQueue.put(@packet); @@ -229,9 +370,6 @@ begin //Writeln('Done: ' + inttostr(stream.packetQueue.nbPackets)); - // signal end-of-stream - stream.packetQueue.put(@EOSPacket); - result := 0; end; @@ -242,10 +380,10 @@ var begin result := -1; - if (EOS_Flag) then + if EOF then exit; - while true do + while(true) do begin while (audio_pkt_size > 0) do begin @@ -253,6 +391,8 @@ begin data_size := bufSize; // TODO: should be avcodec_decode_audio2 but this wont link on my ubuntu box. + // FIXME: with avcodec_decode_audio a package could contain several frames + // this is not handled yet len1 := avcodec_decode_audio(pCodecCtx, @buffer, data_size, audio_pkt_data, audio_pkt_size); @@ -294,11 +434,17 @@ begin audio_pkt_data := PChar(pkt.data); audio_pkt_size := pkt.size; - // check for end-of-stream - if (audio_pkt_data = PChar(EOSPacket.data)) then + if (audio_pkt_data = PChar(FlushPacket.data)) then + begin + avcodec_flush_buffers(pCodecCtx); + continue; + end; + + // check for end-of-file + if (audio_pkt_data = PChar(EOFPacket.data)) then begin - // end-of-stream reached -> set EOS-flag - EOS_Flag := true; + // end-of-file reached -> set EOF-flag + SetEOF(true); // note: buffer is not (even partially) filled -> no data to return exit; end; @@ -316,9 +462,10 @@ var len : integer; begin len := BufSize; + result := -1; - // end-of-stream reached - if (EOS_Flag) then + // end-of-file reached + if EOF then exit; while (len > 0) do begin @@ -361,19 +508,6 @@ begin result := BufSize; end; -function TFFMpegDecodeStream.GetPosition(): real; -var - bytes: integer; -begin - Result := 0; -end; - -procedure TFFMpegDecodeStream.SetPosition(Time: real); -var - bytes: integer; -begin -end; - { TAudioDecoder_FFMpeg } @@ -388,21 +522,25 @@ begin av_register_all(); - // init end-of-stream package - av_init_packet(EOSPacket); - EOSPacket.data := Pointer(PChar('EOS')); + // init end-of-file package + av_init_packet(EOFPacket); + EOFPacket.data := Pointer(PChar('EOF')); + + // init flush package + av_init_packet(FlushPacket); + FlushPacket.data := Pointer(PChar('FLUSH')); result := true; end; -class function TAudioDecoder_FFMpeg.FindAudioStreamID(pFormatCtx : PAVFormatContext): integer; +class function TAudioDecoder_FFMpeg.FindAudioStreamIndex(pFormatCtx : PAVFormatContext): integer; var i : integer; - streamID: integer; + streamIndex: integer; stream : PAVStream; begin // Find the first audio stream - streamID := -1; + streamIndex := -1; for i := 0 to pFormatCtx^.nb_streams-1 do begin @@ -412,12 +550,12 @@ begin if ( stream.codec^.codec_type = CODEC_TYPE_AUDIO ) then begin //Log.LogStatus('Found Audio Stream', 'UAudio_FFMpeg'); - streamID := i; + streamIndex := i; break; end; end; - result := streamID; + result := streamIndex; end; function TAudioDecoder_FFMpeg.Open(const Filename: string): TAudioDecodeStream; @@ -449,11 +587,11 @@ begin dump_format(pFormatCtx, 0, pchar(Filename), 0); - ffmpegStreamID := FindAudioStreamID(pFormatCtx); + ffmpegStreamID := FindAudioStreamIndex(pFormatCtx); if (ffmpegStreamID < 0) then exit; - //Log.LogStatus('Audio Stream ID is : '+ inttostr(ffmpegStreamID), 'UAudio_FFMpeg'); + //Log.LogStatus('AudioStreamIndex is: '+ inttostr(ffmpegStreamID), 'UAudio_FFMpeg'); ffmpegStream := pFormatCtx.streams[ffmpegStreamID]; pCodecCtx := ffmpegStream^.codec; @@ -503,7 +641,7 @@ var begin result := -1; - if (pkt <> @EOSPacket) then + if ((pkt <> @EOFPacket) and (pkt <> @FlushPacket)) then if (av_dup_packet(pkt) < 0) then exit; @@ -585,6 +723,27 @@ begin end; end; +procedure TPacketQueue.Flush(); +var + pkt, pkt1: PAVPacketList; +begin + SDL_LockMutex(Self.mutex); + + pkt := Self.firstPkt; + while(pkt <> nil) do + begin + pkt1 := pkt^.next; + av_free_packet(pkt^.pkt); + av_freep(pkt); + pkt := pkt1; + end; + Self.lastPkt := nil; + Self.firstPkt := nil; + Self.nbPackets := 0; + Self.size := 0; + + SDL_UnlockMutex(Self.mutex); +end; initialization diff --git a/Game/Code/Classes/UAudioPlayback_Portaudio.pas b/Game/Code/Classes/UAudioPlayback_Portaudio.pas index c2694e6d..c1abd0eb 100644 --- a/Game/Code/Classes/UAudioPlayback_Portaudio.pas +++ b/Game/Code/Classes/UAudioPlayback_Portaudio.pas @@ -22,6 +22,7 @@ uses libc, {$endif} {$ENDIF} + sdl, portaudio, ULog, UIni, @@ -58,6 +59,7 @@ type TAudioMixerStream = class private activeStreams: TList; + mixerBuffer: PChar; public constructor Create(); destructor Destroy(); override; @@ -104,7 +106,7 @@ type procedure Rewind; procedure SetPosition(Time: real); procedure Play; - procedure Pause; //Pause Mod + procedure Pause; procedure Stop; procedure Close; @@ -152,6 +154,8 @@ end; destructor TAudioMixerStream.Destroy(); begin + if (mixerBuffer <> nil) then + Freemem(mixerBuffer); activeStreams.Free; end; @@ -170,36 +174,33 @@ end; function TAudioMixerStream.ReadData(Buffer: PChar; BufSize: integer): integer; var i: integer; + size: integer; stream: TPortaudioPlaybackStream; - dataAvailable: boolean; begin - dataAvailable := false; + result := BufSize; - // search for playing stream - if (activeStreams.Count > 0) then + // zero target-buffer (silence) + FillChar(Buffer^, BufSize, 0); + + // resize mixer-buffer + ReallocMem(mixerBuffer, BufSize); + if (mixerBuffer = nil) then + Exit; + + writeln('Mix: ' + inttostr(activeStreams.Count)); + + for i := 0 to activeStreams.Count-1 do begin - for i := 0 to activeStreams.Count-1 do + stream := TPortaudioPlaybackStream(activeStreams[i]); + if (stream.GetStatus() = sPlaying) then begin - stream := TPortaudioPlaybackStream(activeStreams[i]); - if (stream.getStatus = sPlaying) then + // fetch data from current stream + size := stream.ReadData(mixerBuffer, BufSize); + if (size > 0) then begin - dataAvailable := true; - break; + SDL_MixAudio(PUInt8(Buffer), PUInt8(mixerBuffer), size, SDL_MIX_MAXVOLUME); end; end; - - // fetch data from current stream - if (dataAvailable) then - begin - result := stream.ReadData(Buffer, BufSize); - end; - end; - - // return silence - if ((not dataAvailable) or (result = -1)) then - begin - FillChar(Buffer^, BufSize, 0); - result := BufSize; end; end; @@ -219,7 +220,13 @@ end; procedure TPortaudioPlaybackStream.Play(); begin + if (status <> sPaused) then + begin + // rewind + decodeStream.Position := 0; + end; status := sPlaying; + mixerStream.AddStream(Self); end; procedure TPortaudioPlaybackStream.Pause(); @@ -234,7 +241,9 @@ end; procedure TPortaudioPlaybackStream.Close(); begin - Stop(); + status := sStopped; + Loaded := false; + // TODO: cleanup decode-stream end; function TPortaudioPlaybackStream.IsLoaded(): boolean; @@ -265,8 +274,8 @@ end; function TPortaudioPlaybackStream.ReadData(Buffer: PChar; BufSize: integer): integer; begin result := decodeStream.ReadData(Buffer, BufSize); - // end-of-stream reached -> stop playback - if (decodeStream.EOS) then + // end-of-file reached -> stop playback + if (decodeStream.EOF) then begin status := sStopped; end; @@ -424,7 +433,9 @@ end; procedure TAudioPlayback_Portaudio.SetLoop(Enabled: boolean); begin - MusicStream.SetLoop(Enabled); + if (MusicStream <> nil) then + if (MusicStream.IsLoaded) then + MusicStream.SetLoop(Enabled); end; function TAudioPlayback_Portaudio.Open(Filename: string): boolean; @@ -449,8 +460,6 @@ begin end; procedure TAudioPlayback_Portaudio.SetPosition(Time: real); -var - bytes: integer; begin if (MusicStream.IsLoaded) then begin @@ -458,10 +467,26 @@ begin end; end; +function TAudioPlayback_Portaudio.GetPosition: real; +begin + if (MusicStream.IsLoaded) then + Result := MusicStream.GetPosition(); +end; + +function TAudioPlayback_Portaudio.Length: real; +begin + Result := 0; + if assigned( MusicStream ) then + if (MusicStream.IsLoaded) then + begin + Result := MusicStream.GetLength(); + end; +end; + procedure TAudioPlayback_Portaudio.Play; begin if (MusicStream <> nil) then - if (MusicStream.IsLoaded()) then + if (MusicStream.IsLoaded) then begin if (MusicStream.GetLoop()) then begin @@ -472,12 +497,10 @@ begin end; end; -procedure TAudioPlayback_Portaudio.Pause; //Pause Mod +procedure TAudioPlayback_Portaudio.Pause; begin if (MusicStream <> nil) then - if (MusicStream.IsLoaded()) then begin - MusicStream.Pause(); // Pauses Song - end; + MusicStream.Pause(); end; procedure TAudioPlayback_Portaudio.Stop; @@ -492,37 +515,10 @@ begin MusicStream.Close(); end; -function TAudioPlayback_Portaudio.Length: real; -begin - Result := 0; - if assigned( MusicStream ) then - begin - Result := MusicStream.GetLength(); - end; -end; - -function TAudioPlayback_Portaudio.getPosition: real; -var - bytes: integer; -begin - Result := 0; - -(* - bytes := BASS_ChannelGetPosition(BASS); - Result := BASS_ChannelBytes2Seconds(BASS, bytes); -*) -end; - function TAudioPlayback_Portaudio.Finished: boolean; begin - Result := false; - -(* - if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then - begin - Result := true; - end; -*) + if MusicStream <> nil then + Result := (MusicStream.GetStatus() = sStopped); end; procedure TAudioPlayback_Portaudio.PlayStart; @@ -623,7 +619,6 @@ begin end; playbackStream := TPortaudioPlaybackStream.Create(decodeStream); - mixerStream.AddStream(playbackStream); //Add CustomSound csIndex := High(CustomSounds) + 1; -- cgit v1.2.3 From b665420d6f2cac825c8c5be252521a89e3da197a Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 10 Jan 2008 23:24:35 +0000 Subject: "MATHEMATICS.pas" is now "mathematics.pas" git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@776 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/ffmpeg/MATHEMATICS.pas | 66 ------------------------------------ 1 file changed, 66 deletions(-) delete mode 100644 Game/Code/lib/ffmpeg/MATHEMATICS.pas (limited to 'Game/Code') diff --git a/Game/Code/lib/ffmpeg/MATHEMATICS.pas b/Game/Code/lib/ffmpeg/MATHEMATICS.pas deleted file mode 100644 index 83121899..00000000 --- a/Game/Code/lib/ffmpeg/MATHEMATICS.pas +++ /dev/null @@ -1,66 +0,0 @@ -unit MATHEMATICS; - -interface - -(* - * copyright (c) 2005 Michael Niedermayer - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) - -(* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. -For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT -in the source codes *) - -{$MODE DELPHI} (* CAT *) -{$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) -{$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) - -uses - rational; (* CAT *) - -const - av__util = 'libavutil.49'; (* CAT *) - -type - TAVRounding = ( - AV_ROUND_ZERO = 0, ///< round toward zero - AV_ROUND_INF = 1, ///< round away from zero - AV_ROUND_DOWN = 2, ///< round toward -infinity - AV_ROUND_UP = 3, ///< round toward +infinity - AV_ROUND_NEAR_INF = 5, ///< round to nearest and halfway cases away from zero - AV_ROUND_FUCKING = $FFFFFF - ); - -(** * rescale a 64bit integer with rounding to nearest. - * a simple a*b/c isn't possible as it can overflow *) -function av_rescale (a, b, c: int64): int64; - cdecl; external av__util; - -(** - * rescale a 64bit integer with specified rounding. - * a simple a*b/c isn't possible as it can overflow *) -function av_rescale_rnd (a, b, c: int64; enum: TAVRounding): int64; - cdecl; external av__util; - -(** - * rescale a 64bit integer by 2 rational numbers. *) -function av_rescale_q (a: int64; bq, cq: TAVRational): int64; - cdecl; external av__util; - -implementation - -end. - -- cgit v1.2.3 From 6084e90af46bac033d637a9075f308b4d2ec57fd Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 10 Jan 2008 23:26:03 +0000 Subject: "MATHEMATICS.pas" is now "mathematics.pas" git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@777 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/ffmpeg/mathematics.pas | 79 ++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 Game/Code/lib/ffmpeg/mathematics.pas (limited to 'Game/Code') diff --git a/Game/Code/lib/ffmpeg/mathematics.pas b/Game/Code/lib/ffmpeg/mathematics.pas new file mode 100644 index 00000000..42a30925 --- /dev/null +++ b/Game/Code/lib/ffmpeg/mathematics.pas @@ -0,0 +1,79 @@ +unit mathematics; + +interface + +(* + * copyright (c) 2005 Michael Niedermayer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +(* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. +For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT +in the source codes *) + +{$IFDEF FPC} + {$IFDEF LINUX} + {$LINKLIB libavutil} + {$ENDIF} + {$MODE DELPHI } (* CAT *) + {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) + {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) +{$ENDIF} + +uses + rational; (* CAT *) + +const +{$IFDEF MSWINDOWS} + av__util = 'avutil-49.dll'; +{$ENDIF} +{$IFDEF LINUX} + av__util = 'libavutil.so'; // .0d +{$ENDIF} +{$IFDEF DARWIN} + av__util = 'libavutil.dylib'; +{$ENDIF} + +type + TAVRounding = ( + AV_ROUND_ZERO = 0, ///< round toward zero + AV_ROUND_INF = 1, ///< round away from zero + AV_ROUND_DOWN = 2, ///< round toward -infinity + AV_ROUND_UP = 3, ///< round toward +infinity + AV_ROUND_NEAR_INF = 5, ///< round to nearest and halfway cases away from zero + AV_ROUND_FUCKING = $FFFFFF + ); + +(** * rescale a 64bit integer with rounding to nearest. + * a simple a*b/c isn't possible as it can overflow *) +function av_rescale (a, b, c: int64): int64; + cdecl; external av__util; + +(** + * rescale a 64bit integer with specified rounding. + * a simple a*b/c isn't possible as it can overflow *) +function av_rescale_rnd (a, b, c: int64; enum: TAVRounding): int64; + cdecl; external av__util; + +(** + * rescale a 64bit integer by 2 rational numbers. *) +function av_rescale_q (a: int64; bq, cq: TAVRational): int64; + cdecl; external av__util; + +implementation + +end. + -- cgit v1.2.3 From fc79f056741619c9432fe5f5e99f861e82705a2e Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 10 Jan 2008 23:47:40 +0000 Subject: eddie is right: pb is a pointer and not a TByteIOContext struct. I changed the generic Pointer to a PByteIOContext to be more specific. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@778 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/ffmpeg/avformat.pas | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/lib/ffmpeg/avformat.pas b/Game/Code/lib/ffmpeg/avformat.pas index 4b130dd3..091b8fe0 100644 --- a/Game/Code/lib/ffmpeg/avformat.pas +++ b/Game/Code/lib/ffmpeg/avformat.pas @@ -316,10 +316,9 @@ type oformat: PAVOutputFormat; priv_data: pointer; - //pb: TByteIOContext; - pb: Pointer; // eddie: This is a pointer (at least on OS X) - - nb_streams: cardinal; (* CAT#3 *) + pb: PByteIOContext; + + nb_streams: cardinal; (* CAT#3 *) streams: array [0..MAX_STREAMS - 1] of PAVStream; filename: array [0..1023] of char; (* input or output filename *) (* stream info *) -- cgit v1.2.3 From 9ddb8c2b7c851d82922342ee8873267f0f1ae310 Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 11 Jan 2008 03:26:05 +0000 Subject: there were some changes in the ffmpeg interface (for example TAVFormatContext's pb member is a pointer now). To better track version changes, version numbers of the dlls are now managed by the version.inc file. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@779 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/ffmpeg/avcodec.pas | 22 ++------ Game/Code/lib/ffmpeg/avformat.pas | 23 +++----- Game/Code/lib/ffmpeg/avio.pas | 12 +---- Game/Code/lib/ffmpeg/avutil.pas | 15 +----- Game/Code/lib/ffmpeg/mathematics.pas | 11 +--- Game/Code/lib/ffmpeg/opt.pas | 11 +--- Game/Code/lib/ffmpeg/rational.pas | 10 +--- Game/Code/lib/ffmpeg/version.inc | 102 +++++++++++++++++++++++++++++++++++ 8 files changed, 121 insertions(+), 85 deletions(-) create mode 100644 Game/Code/lib/ffmpeg/version.inc (limited to 'Game/Code') diff --git a/Game/Code/lib/ffmpeg/avcodec.pas b/Game/Code/lib/ffmpeg/avcodec.pas index 4182b979..88447ffc 100644 --- a/Game/Code/lib/ffmpeg/avcodec.pas +++ b/Game/Code/lib/ffmpeg/avcodec.pas @@ -24,8 +24,8 @@ unit avcodec; {$IFDEF FPC} {$IFDEF LINUX} - {$LINKLIB libavutil} - {$LINKLIB libavcodec} + {$LINKLIB libavutil} + {$LINKLIB libavcodec} {$ENDIF} {$MODE DELPHI } (* CAT *) @@ -38,23 +38,9 @@ interface uses avutil, rational, opt; // CAT -const - -{$IFDEF MSWINDOWS} - av__format = 'avformat-50.dll'; -{$ENDIF} -{$IFDEF LINUX} - av__format = 'libavformat.so'; -{$ENDIF} -{$IFDEF DARWIN} - av__format = 'libavformat.dylib'; -{$ENDIF} - - - LIBAVUTIL_VERSION_INT = ((51 shl 16) + (12 shl 8) + 1); - LIBAVUTIL_VERSION = '51.12.1'; - LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; +{$I version.inc} +const AV_NOPTS_VALUE: int64 = $8000000000000000; AV_TIME_BASE = 1000000; AV_TIME_BASE_Q : TAVRational = (num:1; den:AV_TIME_BASE); (* added by CAT *) diff --git a/Game/Code/lib/ffmpeg/avformat.pas b/Game/Code/lib/ffmpeg/avformat.pas index 091b8fe0..174542b3 100644 --- a/Game/Code/lib/ffmpeg/avformat.pas +++ b/Game/Code/lib/ffmpeg/avformat.pas @@ -41,22 +41,9 @@ uses rational, avutil; (* CAT *) -const - -{$IFDEF MSWINDOWS} - av__format = 'avformat-50.dll'; -{$ENDIF} -{$IFDEF LINUX} - av__format = 'libavformat.so'; -{$ENDIF} -{$IFDEF DARWIN} - av__format = 'libavformat.dylib'; -{$ENDIF} - - LIBAVUTIL_VERSION_INT = ((51 shl 16) + (12 shl 8) + 1); - LIBAVUTIL_VERSION = '51.12.1'; - LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; +{$I version.inc} +const MAXINT64 = $7fffffffffffffff; MININT64 = $8000000000000000; @@ -315,8 +302,12 @@ type iformat: PAVInputFormat; oformat: PAVOutputFormat; priv_data: pointer; - + + {$IF (LIBAVFORMAT_VERSION >= 52)} pb: PByteIOContext; + {$ELSE} + pb: TByteIOContext; + {$IFEND} nb_streams: cardinal; (* CAT#3 *) streams: array [0..MAX_STREAMS - 1] of PAVStream; diff --git a/Game/Code/lib/ffmpeg/avio.pas b/Game/Code/lib/ffmpeg/avio.pas index 5e40bd4e..fa65b6fa 100644 --- a/Game/Code/lib/ffmpeg/avio.pas +++ b/Game/Code/lib/ffmpeg/avio.pas @@ -30,17 +30,9 @@ unit avio; interface (* Widows unit is deleted by CAT *) -const -(* version numbers are changed by The Creative CAT *) - -{$IFDEF win32} - av__format = 'avformat-50.dll'; -{$ELSE} - av__format = 'libavformat.so'; // .0d -//av__format = 'libavformat.51'; -{$ENDIF} - +{$I version.inc} +const URL_RDONLY = 0; URL_WRONLY = 1; URL_RDWR = 2; diff --git a/Game/Code/lib/ffmpeg/avutil.pas b/Game/Code/lib/ffmpeg/avutil.pas index ff833ad4..48c5f4c2 100644 --- a/Game/Code/lib/ffmpeg/avutil.pas +++ b/Game/Code/lib/ffmpeg/avutil.pas @@ -28,20 +28,7 @@ unit avutil; interface -const -{$IFDEF MSWINDOWS} - av__util = 'avutil-49.dll'; -{$ENDIF} -{$IFDEF LINUX} - av__util = 'libavutil.so'; // .0d -{$ENDIF} -{$IFDEF DARWIN} - av__util = 'libavutil.dylib'; -{$ENDIF} - - LIBAVUTIL_VERSION_INT = ((49 shl 16) + (4 shl 8) + 1); - LIBAVUTIL_VERSION = '49.4.1'; - LIBAVUTIL_BUILD = LIBAVUTIL_VERSION_INT; +{$I version.inc} type (** diff --git a/Game/Code/lib/ffmpeg/mathematics.pas b/Game/Code/lib/ffmpeg/mathematics.pas index 42a30925..3beef517 100644 --- a/Game/Code/lib/ffmpeg/mathematics.pas +++ b/Game/Code/lib/ffmpeg/mathematics.pas @@ -36,16 +36,7 @@ in the source codes *) uses rational; (* CAT *) -const -{$IFDEF MSWINDOWS} - av__util = 'avutil-49.dll'; -{$ENDIF} -{$IFDEF LINUX} - av__util = 'libavutil.so'; // .0d -{$ENDIF} -{$IFDEF DARWIN} - av__util = 'libavutil.dylib'; -{$ENDIF} +{$I version.inc} type TAVRounding = ( diff --git a/Game/Code/lib/ffmpeg/opt.pas b/Game/Code/lib/ffmpeg/opt.pas index e70d77ad..bd3f14fd 100644 --- a/Game/Code/lib/ffmpeg/opt.pas +++ b/Game/Code/lib/ffmpeg/opt.pas @@ -32,6 +32,8 @@ interface uses rational; (* CAT *) +{$I version.inc} + type TAVOptionType = ( FF_OPT_TYPE_FLAGS, @@ -45,15 +47,6 @@ type ); const - -{$IFDEF win32} - av__codec = 'avcodec-51.dll'; -{$ELSE} - av__codec = 'avcodec.so'; // .0d - // av__codec = 'libavcodec.51'; -{$ENDIF} - - AV_OPT_FLAG_ENCODING_PARAM = 1; ///< a generic parameter which can be set by the user for muxing or encoding AV_OPT_FLAG_DECODING_PARAM = 2; ///< a generic parameter which can be set by the user for demuxing or decoding AV_OPT_FLAG_METADATA = 4; ///< some data extracted or inserted into the file like title, comment, ... diff --git a/Game/Code/lib/ffmpeg/rational.pas b/Game/Code/lib/ffmpeg/rational.pas index 8fb3cbd8..86dbf8a4 100644 --- a/Game/Code/lib/ffmpeg/rational.pas +++ b/Game/Code/lib/ffmpeg/rational.pas @@ -29,15 +29,9 @@ unit rational; interface (* unit windows is deleted by CAT *) -const - {$IFDEF win32} - av__util = 'avutil-49.dll'; - {$ELSE} - av__util = 'libavutil.so'; // .0d -// av__util = 'libavutil.49'; - {$ENDIF} -type +{$I version.inc} +type (* * Rational number num/den. *) PAVRational = ^TAVRational; diff --git a/Game/Code/lib/ffmpeg/version.inc b/Game/Code/lib/ffmpeg/version.inc new file mode 100644 index 00000000..2944e643 --- /dev/null +++ b/Game/Code/lib/ffmpeg/version.inc @@ -0,0 +1,102 @@ +const +{$IFDEF MSWINDOWS} + av__codec = 'avcodec-51.dll'; + LIBAVCODEC_MAJOR_VERSION = 51; + LIBAVCODEC_MINOR_VERSION = 0; + LIBAVCODEC_SUB_VERSION = 0; + + av__format = 'avformat-50.dll'; + LIBAVFORMAT_MAJOR_VERSION = 50; + LIBAVFORMAT_MINOR_VERSION = 0; + LIBAVFORMAT_SUB_VERSION = 0; + + av__util = 'avutil-49.dll'; + LIBAVUTIL_MAJOR_VERSION = 49; + LIBAVUTIL_MINOR_VERSION = 0; + LIBAVUTIL_SUB_VERSION = 0; +{$ENDIF} +{$IFDEF LINUX} + av__codec = 'libavcodec.so'; + LIBAVCODEC_MAJOR_VERSION = 51; + LIBAVCODEC_MINOR_VERSION = 0; + LIBAVCODEC_SUB_VERSION = 0; + + av__format = 'libavformat.so'; +//av__format = 'libavformat.51'; + LIBAVFORMAT_MAJOR_VERSION = 51; + LIBAVFORMAT_MINOR_VERSION = 0; + LIBAVFORMAT_SUB_VERSION = 0; + + av__util = 'libavutil.so'; + LIBAVUTIL_MAJOR_VERSION = 49; + LIBAVUTIL_MINOR_VERSION = 0; + LIBAVUTIL_SUB_VERSION = 0; +{$ENDIF} +{$IFDEF DARWIN} + av__format = 'libavcodec.dylib'; + LIBAVCODEC_MAJOR_VERSION = 51; + LIBAVCODEC_MINOR_VERSION = 0; + LIBAVCODEC_SUB_VERSION = 0; + + av__format = 'libavformat.dylib'; + LIBAVFORMAT_MAJOR_VERSION = 52; + LIBAVFORMAT_MINOR_VERSION = 0; + LIBAVFORMAT_SUB_VERSION = 0; + + av__util = 'libavutil.dylib'; + LIBAVUTIL_MAJOR_VERSION = 49; + LIBAVUTIL_MINOR_VERSION = 0; + LIBAVUTIL_SUB_VERSION = 0; +{$ENDIF} + +(* Max. supported version by this header *) +(* TODO: someone has to check the changes up to version 52, add some IFDEFS and increase this version number *) + +LIBAVCODEC_MAX_MAJOR_VERSION = 51; +LIBAVCODEC_MAX_MINOR_VERSION = 12; +LIBAVCODEC_MAX_SUB_VERSION = 1; +LIBAVCODEC_MAX_VERSION = LIBAVCODEC_MAX_MAJOR_VERSION + + (LIBAVCODEC_MAX_MINOR_VERSION * 0.01) + + (LIBAVCODEC_MAX_SUB_VERSION * 0.0001); + +LIBAVFORMAT_MAX_MAJOR_VERSION = 51; +LIBAVFORMAT_MAX_MINOR_VERSION = 12; +LIBAVFORMAT_MAX_SUB_VERSION = 1; +LIBAVFORMAT_MAX_VERSION = LIBAVFORMAT_MAX_MAJOR_VERSION + + (LIBAVFORMAT_MAX_MINOR_VERSION * 0.01) + + (LIBAVFORMAT_MAX_SUB_VERSION * 0.0001); + +LIBAVUTIL_MAX_MAJOR_VERSION = 49; +LIBAVUTIL_MAX_MINOR_VERSION = 4; +LIBAVUTIL_MAX_SUB_VERSION = 1; +LIBAVUTIL_MAX_VERSION = LIBAVUTIL_MAX_MAJOR_VERSION + + (LIBAVUTIL_MAX_MINOR_VERSION * 0.01) + + (LIBAVUTIL_MAX_SUB_VERSION * 0.0001); + +(* Calc linked version *) + +LIBAVCODEC_VERSION = LIBAVCODEC_MAJOR_VERSION + + (LIBAVCODEC_MINOR_VERSION * 0.01) + + (LIBAVCODEC_SUB_VERSION * 0.0001); + +LIBAVFORMAT_VERSION = LIBAVFORMAT_MAJOR_VERSION + + (LIBAVFORMAT_MINOR_VERSION * 0.01) + + (LIBAVFORMAT_SUB_VERSION * 0.0001); + +LIBAVUTIL_VERSION = LIBAVUTIL_MAJOR_VERSION + + (LIBAVUTIL_MINOR_VERSION * 0.01) + + (LIBAVUTIL_SUB_VERSION * 0.0001); + +(* Check if linked versions are supported *) + +{$IF (LIBAVCODEC_VERSION > LIBAVCODEC_MAX_VERSION)} + {$MESSAGE Warn 'Linked version of libavcodec may be unsupported!'} +{$IFEND} + +{$IF (LIBAVFORMAT_VERSION > LIBAVFORMAT_MAX_VERSION)} + {$MESSAGE Warn 'Linked version of libavformat may be unsupported!'} +{$IFEND} + +{$IF (LIBAVUTIL_VERSION > LIBAVUTIL_MAX_VERSION)} + {$MESSAGE Warn 'Linked version of libavutil may be unsupported!'} +{$IFEND} -- cgit v1.2.3 From c1a89635c888f21203db62021cb30333d5d80a47 Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 11 Jan 2008 03:27:40 +0000 Subject: some minor changes git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@780 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudioDecoder_FFMpeg.pas | 10 ++++++++-- Game/Code/Classes/UAudioPlayback_Portaudio.pas | 6 +++++- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudioDecoder_FFMpeg.pas b/Game/Code/Classes/UAudioDecoder_FFMpeg.pas index c81e4be1..7ea9dd6a 100644 --- a/Game/Code/Classes/UAudioDecoder_FFMpeg.pas +++ b/Game/Code/Classes/UAudioDecoder_FFMpeg.pas @@ -271,6 +271,7 @@ var stream: TFFMpegDecodeStream; seekTarget: int64; eofState: boolean; + pbIOCtx: PByteIOContext; begin stream := TFFMpegDecodeStream(streamPtr); eofState := false; @@ -333,14 +334,19 @@ begin if(av_read_frame(stream.pFormatCtx, packet) < 0) then begin // check for end-of-file (eof is not an error) - if(url_feof(@stream.pFormatCtx^.pb) <> 0) then + {$IF (LIBAVFORMAT_VERSION >= 52)} + pbIOCtx := stream.pFormatCtx^.pb; + {$ELSE} + pbIOCtx := @stream.pFormatCtx^.pb; + {$IFEND} + if(url_feof(pbIOCtx) <> 0) then begin eofState := true; continue; end; // check for errors - if(url_ferror(@stream.pFormatCtx^.pb) = 0) then + if(url_ferror(pbIOCtx) = 0) then begin // no error -> wait for user input SDL_Delay(100); diff --git a/Game/Code/Classes/UAudioPlayback_Portaudio.pas b/Game/Code/Classes/UAudioPlayback_Portaudio.pas index c1abd0eb..5f4a8cde 100644 --- a/Game/Code/Classes/UAudioPlayback_Portaudio.pas +++ b/Game/Code/Classes/UAudioPlayback_Portaudio.pas @@ -226,7 +226,7 @@ begin decodeStream.Position := 0; end; status := sPlaying; - mixerStream.AddStream(Self); + //mixerStream.AddStream(Self); end; procedure TPortaudioPlaybackStream.Pause(); @@ -444,6 +444,8 @@ var begin decodeStream := AudioDecoder.Open(Filename); MusicStream := TPortaudioPlaybackStream.Create(decodeStream); + // FIXME: remove this line + mixerStream.AddStream(MusicStream); if(MusicStream.IsLoaded()) then begin @@ -619,6 +621,8 @@ begin end; playbackStream := TPortaudioPlaybackStream.Create(decodeStream); + // FIXME: remove this line + mixerStream.AddStream(playbackStream); //Add CustomSound csIndex := High(CustomSounds) + 1; -- cgit v1.2.3 From 34d10d2e193b83e5ae7cff9037708fd44d801e60 Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 11 Jan 2008 03:33:10 +0000 Subject: do not initialize sdl_audio at this place git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@781 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphic.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 3536d9d7..fcda137c 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -415,7 +415,7 @@ begin LoadOpenGL; Log.LogStatus('SDL_Init', 'UGraphic.Initialize3D'); - if ( SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO)= -1 ) then + if ( SDL_Init(SDL_INIT_VIDEO)= -1 ) then begin Log.LogError('SDL_Init Failed', 'UGraphic.Initialize3D'); exit; -- cgit v1.2.3 From ef679a21a892fbf6298cdc08dcae0c70cc1818d3 Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 11 Jan 2008 11:44:27 +0000 Subject: removed one of the doubled CDECLs in av_register_codec_parser git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@782 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/ffmpeg/avcodec.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/lib/ffmpeg/avcodec.pas b/Game/Code/lib/ffmpeg/avcodec.pas index 88447ffc..f5646fd8 100644 --- a/Game/Code/lib/ffmpeg/avcodec.pas +++ b/Game/Code/lib/ffmpeg/avcodec.pas @@ -1946,7 +1946,7 @@ type next: PAVCodecParser; end; - procedure av_register_codec_parser (parser: PAVCodecParser); cdecl; + procedure av_register_codec_parser (parser: PAVCodecParser); cdecl; external av__codec; function av_parser_init (codec_id: integer): PAVCodecParserContext; -- cgit v1.2.3 From 69af8d0951d9c741680e9c7f5c5ccd63f36b8df5 Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 11 Jan 2008 11:50:24 +0000 Subject: FPC compatible FFMPEG versioning support. Version-numbers are in the form AAIISS now instead of AA.IISS (which is not supported by fpc) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@783 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudioDecoder_FFMpeg.pas | 2 +- Game/Code/Classes/UAudio_FFMpeg_Pa.pas | 980 ----------------------------- Game/Code/lib/ffmpeg/avformat.pas | 2 +- Game/Code/lib/ffmpeg/version.inc | 196 +++--- 4 files changed, 100 insertions(+), 1080 deletions(-) delete mode 100644 Game/Code/Classes/UAudio_FFMpeg_Pa.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudioDecoder_FFMpeg.pas b/Game/Code/Classes/UAudioDecoder_FFMpeg.pas index 7ea9dd6a..4cd6ec37 100644 --- a/Game/Code/Classes/UAudioDecoder_FFMpeg.pas +++ b/Game/Code/Classes/UAudioDecoder_FFMpeg.pas @@ -334,7 +334,7 @@ begin if(av_read_frame(stream.pFormatCtx, packet) < 0) then begin // check for end-of-file (eof is not an error) - {$IF (LIBAVFORMAT_VERSION >= 52)} + {$IF (LIBAVFORMAT_MAJOR_VERSION >= 52)} pbIOCtx := stream.pFormatCtx^.pb; {$ELSE} pbIOCtx := @stream.pFormatCtx^.pb; diff --git a/Game/Code/Classes/UAudio_FFMpeg_Pa.pas b/Game/Code/Classes/UAudio_FFMpeg_Pa.pas deleted file mode 100644 index 400af7ce..00000000 --- a/Game/Code/Classes/UAudio_FFMpeg_Pa.pas +++ /dev/null @@ -1,980 +0,0 @@ -unit UAudio_FFMpeg_Pa; - -(******************************************************************************* - -This unit is primarily based upon - - http://www.dranger.com/ffmpeg/ffmpegtutorial_all.html - - and tutorial03.c - - http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html - -*******************************************************************************) - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - - -uses Classes, - {$IFDEF win32} - windows, - {$ENDIF} - Messages, - SysUtils, - {$IFNDEF FPC} - Forms, - {$ENDIF} - SDL, // Used for Audio output Interface - avcodec, // FFMpeg Audio file decoding - avformat, - avutil, - ULog, - UMusic; - -implementation - -uses - {$IFDEF LAZARUS} - lclintf, - {$ifndef win32} - libc, // not available in win32 - {$endif} - {$ENDIF} - portaudio, - UIni, - UMain, - UThemes; - - -type - PPacketQueue = ^TPacketQueue; - TPacketQueue = class - private - firstPkt, - lastPkt : PAVPacketList; - nbPackets : integer; - size : integer; - mutex : PSDL_Mutex; - cond : PSDL_Cond; - quit : boolean; - - public - constructor Create(); - - function Put(pkt : PAVPacket): integer; - function Get(var pkt: TAVPacket; block: boolean): integer; - end; - -type - TStreamStatus = (sNotReady, sStopped, sPlaying, sSeeking, sPaused, sOpen); - -const - StreamStatusStr: array[TStreamStatus] of string = ('Not ready', 'Stopped', 'Playing', 'Seeking', 'Paused', 'Open'); - -type - PAudioBuffer = ^TAudioBuffer; - TAudioBuffer = array[0 .. (AVCODEC_MAX_AUDIO_FRAME_SIZE * 3 div 2)-1] of byte; - -const - SDL_AUDIO_BUFFER_SIZE = 1024; - -type - TFFMpegOutputStream = class(TAudioOutputStream) - private - parseThread: PSDL_Thread; - packetQueue: TPacketQueue; - - status: TStreamStatus; - - // FFMpeg internal data - pFormatCtx : PAVFormatContext; - pCodecCtx : PAVCodecContext; - pCodec : PAVCodec; - ffmpegStreamID : Integer; - ffmpegStream : PAVStream; - - // static vars for AudioDecodeFrame - pkt : TAVPacket; - audio_pkt_data : PChar; - audio_pkt_size : integer; - - // static vars for AudioCallback - audio_buf_index : cardinal; - audio_buf_size : cardinal; - audio_buf : TAudioBuffer; - - channel: PPaStream; - public - constructor Create(); overload; - constructor Create(pFormatCtx: PAVFormatContext; - pCodecCtx: PAVCodecContext; pCodec: PAVCodec; - ffmpegStreamID : Integer; ffmpegStream: PAVStream); overload; - - procedure Play(); - procedure Pause(); - procedure Stop(); - procedure Close(); - - function AudioDecodeFrame(buffer : PUInt8; bufSize: integer): integer; - end; - -type - TAudio_FFMpeg = class( TInterfacedObject, IAudioPlayback ) - private - MusicStream: TFFMpegOutputStream; - - StartSoundStream: TFFMpegOutputStream; - BackSoundStream: TFFMpegOutputStream; - SwooshSoundStream: TFFMpegOutputStream; - ChangeSoundStream: TFFMpegOutputStream; - OptionSoundStream: TFFMpegOutputStream; - ClickSoundStream: TFFMpegOutputStream; - DrumSoundStream: TFFMpegOutputStream; - HihatSoundStream: TFFMpegOutputStream; - ClapSoundStream: TFFMpegOutputStream; - ShuffleSoundStream: TFFMpegOutputStream; - - //Custom Sounds - CustomSounds: array of TCustomSoundEntry; - Loaded: boolean; - Loop: boolean; - - function FindAudioStreamID(pFormatCtx : PAVFormatContext): integer; - public - function GetName: String; - procedure InitializePlayback; - procedure SetVolume(Volume: integer); - procedure SetMusicVolume(Volume: integer); - procedure SetLoop(Enabled: boolean); - function Open(Name: string): boolean; // true if succeed - procedure Rewind; - procedure MoveTo(Time: real); - procedure Play; - procedure Pause; //Pause Mod - procedure Stop; - procedure Close; - function Finished: boolean; - function Length: real; - function getPosition: real; - procedure PlayStart; - procedure PlayBack; - procedure PlaySwoosh; - procedure PlayChange; - procedure PlayOption; - procedure PlayClick; - procedure PlayDrum; - procedure PlayHihat; - procedure PlayClap; - procedure PlayShuffle; - procedure StopShuffle; - - function LoadSoundFromFile(Name: string): TFFMpegOutputStream; - - //Equalizer - function GetFFTData: TFFTData; - - // Interface for Visualizer - function GetPCMData(var data: TPCMData): Cardinal; - - //Custom Sounds - function LoadCustomSound(const Filename: String): Cardinal; - procedure PlayCustomSound(const Index: Cardinal ); - end; - -var - test: TFFMpegOutputStream; - it: integer; - -var - singleton_MusicFFMpeg : IAudioPlayback = nil; - - -function ParseAudio(data: Pointer): integer; cdecl; forward; -procedure SDL_AudioCallback( userdata: Pointer; stream: PUInt8; len: Integer ); cdecl; forward; -function Pa_AudioCallback(input: Pointer; output: Pointer; frameCount: Longword; - timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; - userData: Pointer): Integer; cdecl; forward; - -constructor TFFMpegOutputStream.Create(); -begin - inherited; - - packetQueue := TPacketQueue.Create(); - - FillChar(pkt, sizeof(TAVPacket), #0); - - status := sStopped; - - audio_pkt_data := nil; - audio_pkt_size := 0; - - audio_buf_index := 0; - audio_buf_size := 0; -end; - -constructor TFFMpegOutputStream.Create(pFormatCtx: PAVFormatContext; - pCodecCtx: PAVCodecContext; pCodec: PAVCodec; - ffmpegStreamID : Integer; ffmpegStream: PAVStream); -begin - Create(); - - Self.pFormatCtx := pFormatCtx; - Self.pCodecCtx := pCodecCtx; - Self.pCodec := pCodec; - Self.ffmpegStreamID := ffmpegStreamID; - Self.ffmpegStream := ffmpegStream; - - test := Self; - it:=0; -end; - -procedure TFFMpegOutputStream.Play(); -var - err: TPaError; -begin - writeln('Play request'); - if(status = sStopped) then - begin - writeln('Play ok'); - status := sPlaying; - Self.parseThread := SDL_CreateThread(@ParseAudio, Self); - //SDL_PauseAudio(0); - - err := Pa_StartStream(Self.channel); - end; -end; - -procedure TFFMpegOutputStream.Pause(); -begin -end; - -procedure TFFMpegOutputStream.Stop(); -begin -end; - -procedure TFFMpegOutputStream.Close(); -begin - // Close the codec - avcodec_close(pCodecCtx); - - // Close the video file - av_close_input_file(pFormatCtx); -end; - - -function TAudio_FFMpeg.GetName: String; -begin - result := 'FFMpeg'; -end; - -procedure TAudio_FFMpeg.InitializePlayback; -begin - Log.LogStatus('InitializePlayback', 'UAudio_FFMpeg'); - - Loaded := false; - Loop := false; - - av_register_all(); - //SDL_Init(SDL_INIT_AUDIO); - Pa_Initialize(); - - StartSoundStream := LoadSoundFromFile(SoundPath + 'Common start.mp3'); - { - BackSoundStream := LoadSoundFromFile(SoundPath + 'Common Back.mp3'); - SwooshSoundStream := LoadSoundFromFile(SoundPath + 'menu swoosh.mp3'); - ChangeSoundStream := LoadSoundFromFile(SoundPath + 'select music change music 50.mp3'); - OptionSoundStream := LoadSoundFromFile(SoundPath + 'option change col.mp3'); - ClickSoundStream := LoadSoundFromFile(SoundPath + 'rimshot022b.mp3'); - } -// DrumSoundStream := LoadSoundFromFile(SoundPath + 'bassdrumhard076b.mp3'); -// HihatSoundStream := LoadSoundFromFile(SoundPath + 'hihatclosed068b.mp3'); -// ClapSoundStream := LoadSoundFromFile(SoundPath + 'claps050b.mp3'); - -// ShuffleSoundStream := LoadSoundFromFile(SoundPath + 'Shuffle.mp3'); -end; - - -procedure TAudio_FFMpeg.SetVolume(Volume: integer); -begin - //New: Sets Volume only for this Application -(* - BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); -*) -end; - -procedure TAudio_FFMpeg.SetMusicVolume(Volume: Integer); -begin - //Max Volume Prevention - if Volume > 100 then - Volume := 100; - - if Volume < 0 then - Volume := 0; - - - //Set Volume -// BASS_ChannelSetAttributes (Bass, -1, Volume, -101); -end; - -procedure TAudio_FFMpeg.SetLoop(Enabled: boolean); -begin - Loop := Enabled; -end; - -function TAudio_FFMpeg.Open(Name: string): boolean; -begin - Loaded := false; - if FileExists(Name) then - begin -// Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); - - Loaded := true; - //Set Max Volume - SetMusicVolume (100); - end; - - Result := Loaded; -end; - -procedure TAudio_FFMpeg.Rewind; -begin - if Loaded then - begin - end; -end; - -procedure TAudio_FFMpeg.MoveTo(Time: real); -var - bytes: integer; -begin -// bytes := BASS_ChannelSeconds2Bytes(Bass, Time); -// BASS_ChannelSetPosition(Bass, bytes); -end; - -procedure TAudio_FFMpeg.Play; -begin - if MusicStream <> nil then - if Loaded then - begin - if Loop then - begin - end; - // start from beginning... - // actually bass itself does not loop, nor does this TAudio_FFMpeg Class - MusicStream.Play(); - end; -end; - -procedure TAudio_FFMpeg.Pause; //Pause Mod -begin - if MusicStream <> nil then - if Loaded then begin - MusicStream.Pause(); // Pauses Song - end; -end; - -procedure TAudio_FFMpeg.Stop; -begin - if MusicStream <> nil then - MusicStream.Stop(); -end; - -procedure TAudio_FFMpeg.Close; -begin - if MusicStream <> nil then - MusicStream.Close(); -end; - -function TAudio_FFMpeg.Length: real; -var - bytes: integer; -begin - Result := 0; - // Todo : why is Music stream always nil !? - - if assigned( MusicStream ) then - begin - Result := MusicStream.pFormatCtx^.duration / AV_TIME_BASE; - end; -end; - -function TAudio_FFMpeg.getPosition: real; -var - bytes: integer; -begin - Result := 0; - -(* - bytes := BASS_ChannelGetPosition(BASS); - Result := BASS_ChannelBytes2Seconds(BASS, bytes); -*) -end; - -function TAudio_FFMpeg.Finished: boolean; -begin - Result := false; - -(* - if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then - begin - Result := true; - end; -*) -end; - -procedure TAudio_FFMpeg.PlayStart; -begin - if StartSoundStream <> nil then - StartSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayBack; -begin - if BackSoundStream <> nil then - BackSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlaySwoosh; -begin - if SwooshSoundStream <> nil then - SwooshSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayChange; -begin - if ChangeSoundStream <> nil then - ChangeSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayOption; -begin - if OptionSoundStream <> nil then - OptionSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayClick; -begin - if ClickSoundStream <> nil then - ClickSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayDrum; -begin - if DrumSoundStream <> nil then - DrumSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayHihat; -begin - if HihatSoundStream <> nil then - HihatSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayClap; -begin - if ClapSoundStream <> nil then - ClapSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayShuffle; -begin - if ShuffleSoundStream <> nil then - ShuffleSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.StopShuffle; -begin - if ShuffleSoundStream <> nil then - ShuffleSoundStream.Stop(); -end; - - -function TFFMpegOutputStream.AudioDecodeFrame(buffer : PUInt8; bufSize: integer): integer; -var - len1, - data_size: integer; -begin - result := -1; - - if (buffer = nil) then - exit; - - while true do - begin - while (audio_pkt_size > 0) do - begin -// writeln( 'got audio packet' ); - data_size := bufSize; - - if(pCodecCtx = nil) then begin -// writeln('Das wars'); - exit; - end; - - // TODO: should be avcodec_decode_audio2 but this wont link on my ubuntu box. - len1 := avcodec_decode_audio(pCodecCtx, Pointer(buffer), - data_size, audio_pkt_data, audio_pkt_size); - - //writeln('avcodec_decode_audio : ' + inttostr( len1 )); - - if(len1 < 0) then - begin - // if error, skip frame -// writeln( 'Skip audio frame' ); - audio_pkt_size := 0; - break; - end; - - audio_pkt_data := audio_pkt_data + len1; - audio_pkt_size := audio_pkt_size + len1; - - if (data_size <= 0) then - begin - // No data yet, get more frames - continue; - end; - - // We have data, return it and come back for more later - result := data_size; - exit; - end; - - inc(it); - if (pkt.data <> nil) then - begin - av_free_packet(pkt); - end; - - if (packetQueue.quit) then - begin - result := -1; - exit; - end; -// writeln(it); - if (packetQueue.Get(pkt, true) < 0) then - begin - result := -1; - exit; - end; - - audio_pkt_data := PChar(pkt.data); - audio_pkt_size := pkt.size; -// writeln( 'Audio Packet Size - ' + inttostr(audio_pkt_size) ); - end; -end; - -procedure SDL_AudioCallback(userdata: Pointer; stream: PUInt8; len: Integer); cdecl; -var - outStream : TFFMpegOutputStream; - len1, - audio_size : integer; - pSrc : Pointer; -begin - outStream := TFFMpegOutputStream(userdata); - - while (len > 0) do - with outStream do begin - if (audio_buf_index >= audio_buf_size) then - begin - // We have already sent all our data; get more - audio_size := AudioDecodeFrame(@audio_buf, sizeof(TAudioBuffer)); - //writeln('audio_decode_frame : '+ inttostr(audio_size)); - - if(audio_size < 0) then - begin - // If error, output silence - audio_buf_size := 1024; - FillChar(audio_buf, audio_buf_size, #0); - //writeln( 'Silence' ); - end - else - begin - audio_buf_size := audio_size; - end; - audio_buf_index := 0; // Todo : jb - SegFault ? - end; - - len1 := audio_buf_size - audio_buf_index; - if (len1 > len) then - len1 := len; - - pSrc := PChar(@audio_buf) + audio_buf_index; - {$ifdef WIN32} - CopyMemory(stream, pSrc , len1); - {$else} - memcpy(stream, pSrc , len1); - {$endif} - - Dec(len, len1); - Inc(stream, len1); - Inc(audio_buf_index, len1); - end; -end; - -function Pa_AudioCallback(input: Pointer; output: Pointer; frameCount: Longword; - timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; - userData: Pointer): Integer; cdecl; -var - outStream : TFFMpegOutputStream; - len1, - audio_size : integer; - pSrc : Pointer; - len : integer; -begin - outStream := TFFMpegOutputStream(userData); - len := frameCount * 2; // use *2 for mono-files - - while (len > 0) do - with outStream do begin - if (audio_buf_index >= audio_buf_size) then - begin - // We have already sent all our data; get more - audio_size := AudioDecodeFrame(@audio_buf, sizeof(TAudioBuffer)); - //writeln('audio_decode_frame : '+ inttostr(audio_size)); - - if(audio_size < 0) then - begin - // If error, output silence - audio_buf_size := 1024; - FillChar(audio_buf, audio_buf_size, #0); - //writeln( 'Silence' ); - end - else - begin - audio_buf_size := audio_size; - end; - audio_buf_index := 0; // Todo : jb - SegFault ? - end; - - len1 := audio_buf_size - audio_buf_index; - if (len1 > len) then - len1 := len; - - pSrc := PChar(@audio_buf) + audio_buf_index; - {$ifdef WIN32} - CopyMemory(output, pSrc , len1); - {$else} - memcpy(output, pSrc , len1); - {$endif} - - Dec(len, len1); - Inc(PChar(output), len1); - Inc(audio_buf_index, len1); - end; - - result := paContinue; -end; - -function TAudio_FFMpeg.FindAudioStreamID(pFormatCtx : PAVFormatContext): integer; -var - i : integer; - streamID: integer; - stream : PAVStream; -begin - // Find the first audio stream - streamID := -1; - - for i := 0 to pFormatCtx^.nb_streams-1 do - begin - //Log.LogStatus('aFormatCtx.streams[i] : ' + inttostr(i), 'UAudio_FFMpeg'); - stream := pFormatCtx^.streams[i]; - - if ( stream.codec^.codec_type = CODEC_TYPE_AUDIO ) then - begin - Log.LogStatus('Found Audio Stream', 'UAudio_FFMpeg'); - streamID := i; - break; - end; - end; - - result := streamID; -end; - -function ParseAudio(data: Pointer): integer; cdecl; -var - packet: TAVPacket; - stream: TFFMpegOutputStream; -begin - stream := TFFMpegOutputStream(data); - - while (av_read_frame(stream.pFormatCtx, packet) >= 0) do - begin - //writeln( 'ffmpeg - av_read_frame' ); - - if (packet.stream_index = stream.ffmpegStreamID) then - begin - //writeln( 'packet_queue_put' ); - stream.packetQueue.put(@packet); - end - else - begin - av_free_packet(packet); - end; - end; - - //Writeln('Done: ' + inttostr(stream.packetQueue.nbPackets)); - - result := 0; -end; - - -function TAudio_FFMpeg.LoadSoundFromFile(Name: string): TFFMpegOutputStream; -var - pFormatCtx : PAVFormatContext; - pCodecCtx : PAVCodecContext; - pCodec : PAVCodec; - ffmpegStreamID : Integer; - ffmpegStream : PAVStream; - wanted_spec, - spec : TSDL_AudioSpec; - csIndex : integer; - stream : TFFMpegOutputStream; - err : TPaError; -begin - result := nil; - - if (not FileExists(Name)) then - begin - Log.LogStatus('LoadSoundFromFile: Sound not found "' + Name + '"', 'UAudio_FFMpeg'); - writeln('ERROR : LoadSoundFromFile: Sound not found "' + Name + '"', 'UAudio_FFMpeg'); - exit; - end; - - // Open audio file - if (av_open_input_file(pFormatCtx, PChar(Name), nil, 0, nil) > 0) then - exit; - - // Retrieve stream information - if (av_find_stream_info(pFormatCtx) < 0) then - exit; - - dump_format(pFormatCtx, 0, pchar(Name), 0); - - ffmpegStreamID := FindAudioStreamID(pFormatCtx); - if (ffmpegStreamID < 0) then - exit; - - //Log.LogStatus('Audio Stream ID is : '+ inttostr(ffmpegStreamID), 'UAudio_FFMpeg'); - - ffmpegStream := pFormatCtx.streams[ffmpegStreamID]; - pCodecCtx := ffmpegStream^.codec; - - pCodec := avcodec_find_decoder(pCodecCtx^.codec_id); - if (pCodec = nil) then - begin - Log.LogStatus('Unsupported codec!', 'UAudio_FFMpeg'); - exit; - end; - - avcodec_open(pCodecCtx, pCodec); - //writeln( 'Opened the codec' ); - - stream := TFFMpegOutputStream.Create(pFormatCtx, pCodecCtx, pCodec, - ffmpegStreamID, ffmpegStream); - - { - // Set SDL audio settings from codec info - wanted_spec.freq := pCodecCtx^.sample_rate; - wanted_spec.format := AUDIO_S16SYS; - wanted_spec.channels := pCodecCtx^.channels; - wanted_spec.silence := 0; - wanted_spec.samples := SDL_AUDIO_BUFFER_SIZE; - wanted_spec.callback := AudioCallback; - wanted_spec.userdata := stream; - - // TODO: this works only one time (?) - if (SDL_OpenAudio(@wanted_spec, @spec) < 0) then - begin - Log.LogStatus('SDL_OpenAudio: '+SDL_GetError(), 'UAudio_FFMpeg'); - stream.Free(); - exit; - end; - } - - err := Pa_OpenDefaultStream(stream.channel, 0, pCodecCtx^.channels, paInt16, - pCodecCtx^.sample_rate, SDL_AUDIO_BUFFER_SIZE div 2, //paFramesPerBufferUnspecified, - @PA_AudioCallback, stream); - if(err <> paNoError) then begin - Log.LogStatus('Pa_OpenDefaultStream: '+Pa_GetErrorText(err), 'UAudio_FFMpeg'); - stream.Free(); - exit; - end; - - Log.LogStatus('SDL opened audio device', 'UAudio_FFMpeg'); - - //Add CustomSound - csIndex := High(CustomSounds) + 1; - SetLength (CustomSounds, csIndex + 1); - CustomSounds[csIndex].Filename := Name; - CustomSounds[csIndex].Stream := stream; - - result := stream; -end; - -//Equalizer -function TAudio_FFMpeg.GetFFTData: TFFTData; -var - data: TFFTData; -begin - //Get Channel Data Mono and 256 Values -// BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); - result := data; -end; - -// Interface for Visualizer -function TAudio_FFMpeg.GetPCMData(var data: TPCMData): Cardinal; -begin - result := 0; -end; - -function TAudio_FFMpeg.LoadCustomSound(const Filename: String): Cardinal; -var - S: TFFMpegOutputStream; - I: Integer; - F: String; -begin - //Search for Sound in already loaded Sounds - F := UpperCase(SoundPath + FileName); - For I := 0 to High(CustomSounds) do - begin - if (UpperCase(CustomSounds[I].Filename) = F) then - begin - Result := I; - Exit; - end; - end; - - S := LoadSoundFromFile(SoundPath + Filename); - if (S <> nil) then - Result := High(CustomSounds) - else - Result := 0; -end; - -procedure TAudio_FFMpeg.PlayCustomSound(const Index: Cardinal ); -begin - if Index <= High(CustomSounds) then - (CustomSounds[Index].Stream as TFFMpegOutputStream).Play(); -end; - - -constructor TPacketQueue.Create(); -begin - inherited; - - firstPkt := nil; - lastPkt := nil; - nbPackets := 0; - size := 0; - - mutex := SDL_CreateMutex(); - cond := SDL_CreateCond(); -end; - -function TPacketQueue.Put(pkt : PAVPacket): integer; -var - pkt1 : PAVPacketList; -begin - result := -1; - - if (av_dup_packet(pkt) < 0) then - exit; - - pkt1 := av_malloc(sizeof(TAVPacketList)); - if (pkt1 = nil) then - exit; - - pkt1^.pkt := pkt^; - pkt1^.next := nil; - - - SDL_LockMutex(Self.mutex); - try - - if (Self.lastPkt = nil) then - Self.firstPkt := pkt1 - else - Self.lastPkt^.next := pkt1; - - Self.lastPkt := pkt1; - inc(Self.nbPackets); - -// Writeln('Put: ' + inttostr(nbPackets)); - - Self.size := Self.size + pkt1^.pkt.size; - SDL_CondSignal(Self.cond); - - finally - SDL_UnlockMutex(Self.mutex); - end; - - result := 0; -end; - -function TPacketQueue.Get(var pkt: TAVPacket; block: boolean): integer; -var - pkt1 : PAVPacketList; -begin - result := -1; - - SDL_LockMutex(Self.mutex); - try - while true do - begin - if (quit) then - exit; - - pkt1 := Self.firstPkt; - - if (pkt1 <> nil) then - begin - Self.firstPkt := pkt1.next; - if (Self.firstPkt = nil) then - Self.lastPkt := nil; - dec(Self.nbPackets); - -// Writeln('Get: ' + inttostr(nbPackets)); - - Self.size := Self.size - pkt1^.pkt.size; - pkt := pkt1^.pkt; - av_free(pkt1); - - result := 1; - break; - end - else - if (not block) then - begin - result := 0; - break; - end - else - begin - SDL_CondWait(Self.cond, Self.mutex); - end; - end; - finally - SDL_UnlockMutex(Self.mutex); - end; -end; - - - -initialization - singleton_MusicFFMpeg := TAudio_FFMpeg.create(); - - writeln( 'UAudio_FFMpeg - Register Playback' ); - AudioManager.add( IAudioPlayback( singleton_MusicFFMpeg ) ); - -finalization - AudioManager.Remove( IAudioPlayback( singleton_MusicFFMpeg ) ); - - -end. diff --git a/Game/Code/lib/ffmpeg/avformat.pas b/Game/Code/lib/ffmpeg/avformat.pas index 174542b3..bcd7861c 100644 --- a/Game/Code/lib/ffmpeg/avformat.pas +++ b/Game/Code/lib/ffmpeg/avformat.pas @@ -303,7 +303,7 @@ type oformat: PAVOutputFormat; priv_data: pointer; - {$IF (LIBAVFORMAT_VERSION >= 52)} + {$IF (LIBAVFORMAT_MAJOR_VERSION >= 52)} pb: PByteIOContext; {$ELSE} pb: TByteIOContext; diff --git a/Game/Code/lib/ffmpeg/version.inc b/Game/Code/lib/ffmpeg/version.inc index 2944e643..e7f32f5a 100644 --- a/Game/Code/lib/ffmpeg/version.inc +++ b/Game/Code/lib/ffmpeg/version.inc @@ -1,102 +1,102 @@ const {$IFDEF MSWINDOWS} - av__codec = 'avcodec-51.dll'; - LIBAVCODEC_MAJOR_VERSION = 51; - LIBAVCODEC_MINOR_VERSION = 0; - LIBAVCODEC_SUB_VERSION = 0; - - av__format = 'avformat-50.dll'; - LIBAVFORMAT_MAJOR_VERSION = 50; - LIBAVFORMAT_MINOR_VERSION = 0; - LIBAVFORMAT_SUB_VERSION = 0; - - av__util = 'avutil-49.dll'; - LIBAVUTIL_MAJOR_VERSION = 49; - LIBAVUTIL_MINOR_VERSION = 0; - LIBAVUTIL_SUB_VERSION = 0; -{$ENDIF} -{$IFDEF LINUX} - av__codec = 'libavcodec.so'; - LIBAVCODEC_MAJOR_VERSION = 51; - LIBAVCODEC_MINOR_VERSION = 0; - LIBAVCODEC_SUB_VERSION = 0; - - av__format = 'libavformat.so'; -//av__format = 'libavformat.51'; - LIBAVFORMAT_MAJOR_VERSION = 51; - LIBAVFORMAT_MINOR_VERSION = 0; - LIBAVFORMAT_SUB_VERSION = 0; - - av__util = 'libavutil.so'; - LIBAVUTIL_MAJOR_VERSION = 49; - LIBAVUTIL_MINOR_VERSION = 0; - LIBAVUTIL_SUB_VERSION = 0; -{$ENDIF} -{$IFDEF DARWIN} - av__format = 'libavcodec.dylib'; - LIBAVCODEC_MAJOR_VERSION = 51; - LIBAVCODEC_MINOR_VERSION = 0; - LIBAVCODEC_SUB_VERSION = 0; - - av__format = 'libavformat.dylib'; - LIBAVFORMAT_MAJOR_VERSION = 52; - LIBAVFORMAT_MINOR_VERSION = 0; - LIBAVFORMAT_SUB_VERSION = 0; - - av__util = 'libavutil.dylib'; - LIBAVUTIL_MAJOR_VERSION = 49; - LIBAVUTIL_MINOR_VERSION = 0; - LIBAVUTIL_SUB_VERSION = 0; -{$ENDIF} - -(* Max. supported version by this header *) -(* TODO: someone has to check the changes up to version 52, add some IFDEFS and increase this version number *) - -LIBAVCODEC_MAX_MAJOR_VERSION = 51; -LIBAVCODEC_MAX_MINOR_VERSION = 12; -LIBAVCODEC_MAX_SUB_VERSION = 1; -LIBAVCODEC_MAX_VERSION = LIBAVCODEC_MAX_MAJOR_VERSION + - (LIBAVCODEC_MAX_MINOR_VERSION * 0.01) + - (LIBAVCODEC_MAX_SUB_VERSION * 0.0001); - -LIBAVFORMAT_MAX_MAJOR_VERSION = 51; -LIBAVFORMAT_MAX_MINOR_VERSION = 12; -LIBAVFORMAT_MAX_SUB_VERSION = 1; -LIBAVFORMAT_MAX_VERSION = LIBAVFORMAT_MAX_MAJOR_VERSION + - (LIBAVFORMAT_MAX_MINOR_VERSION * 0.01) + - (LIBAVFORMAT_MAX_SUB_VERSION * 0.0001); - -LIBAVUTIL_MAX_MAJOR_VERSION = 49; -LIBAVUTIL_MAX_MINOR_VERSION = 4; -LIBAVUTIL_MAX_SUB_VERSION = 1; -LIBAVUTIL_MAX_VERSION = LIBAVUTIL_MAX_MAJOR_VERSION + - (LIBAVUTIL_MAX_MINOR_VERSION * 0.01) + - (LIBAVUTIL_MAX_SUB_VERSION * 0.0001); - -(* Calc linked version *) - -LIBAVCODEC_VERSION = LIBAVCODEC_MAJOR_VERSION + - (LIBAVCODEC_MINOR_VERSION * 0.01) + - (LIBAVCODEC_SUB_VERSION * 0.0001); - -LIBAVFORMAT_VERSION = LIBAVFORMAT_MAJOR_VERSION + - (LIBAVFORMAT_MINOR_VERSION * 0.01) + - (LIBAVFORMAT_SUB_VERSION * 0.0001); - -LIBAVUTIL_VERSION = LIBAVUTIL_MAJOR_VERSION + - (LIBAVUTIL_MINOR_VERSION * 0.01) + - (LIBAVUTIL_SUB_VERSION * 0.0001); - -(* Check if linked versions are supported *) - -{$IF (LIBAVCODEC_VERSION > LIBAVCODEC_MAX_VERSION)} - {$MESSAGE Warn 'Linked version of libavcodec may be unsupported!'} -{$IFEND} - -{$IF (LIBAVFORMAT_VERSION > LIBAVFORMAT_MAX_VERSION)} - {$MESSAGE Warn 'Linked version of libavformat may be unsupported!'} -{$IFEND} + av__codec = 'avcodec-51.dll'; + LIBAVCODEC_MAJOR_VERSION = 51; + LIBAVCODEC_MINOR_VERSION = 0; + LIBAVCODEC_SUB_VERSION = 0; + + av__format = 'avformat-50.dll'; + LIBAVFORMAT_MAJOR_VERSION = 50; + LIBAVFORMAT_MINOR_VERSION = 0; + LIBAVFORMAT_SUB_VERSION = 0; + + av__util = 'avutil-49.dll'; + LIBAVUTIL_MAJOR_VERSION = 49; + LIBAVUTIL_MINOR_VERSION = 0; + LIBAVUTIL_SUB_VERSION = 0; +{$ENDIF} +{$IFDEF LINUX} + av__codec = 'libavcodec.so'; + LIBAVCODEC_MAJOR_VERSION = 51; + LIBAVCODEC_MINOR_VERSION = 0; + LIBAVCODEC_SUB_VERSION = 0; + + av__format = 'libavformat.so'; +//av__format = 'libavformat.51'; + LIBAVFORMAT_MAJOR_VERSION = 51; + LIBAVFORMAT_MINOR_VERSION = 0; + LIBAVFORMAT_SUB_VERSION = 0; + + av__util = 'libavutil.so'; + LIBAVUTIL_MAJOR_VERSION = 49; + LIBAVUTIL_MINOR_VERSION = 0; + LIBAVUTIL_SUB_VERSION = 0; +{$ENDIF} +{$IFDEF DARWIN} + av__format = 'libavcodec.dylib'; + LIBAVCODEC_MAJOR_VERSION = 51; + LIBAVCODEC_MINOR_VERSION = 0; + LIBAVCODEC_SUB_VERSION = 0; + + av__format = 'libavformat.dylib'; + LIBAVFORMAT_MAJOR_VERSION = 52; + LIBAVFORMAT_MINOR_VERSION = 0; + LIBAVFORMAT_SUB_VERSION = 0; + + av__util = 'libavutil.dylib'; + LIBAVUTIL_MAJOR_VERSION = 49; + LIBAVUTIL_MINOR_VERSION = 0; + LIBAVUTIL_SUB_VERSION = 0; +{$ENDIF} + +(* Max. supported version by this header *) +(* TODO: someone has to check the changes up to version 52, add some IFDEFS and increase this version number *) + +LIBAVCODEC_MAX_MAJOR_VERSION = 51; +LIBAVCODEC_MAX_MINOR_VERSION = 12; +LIBAVCODEC_MAX_SUB_VERSION = 1; +LIBAVCODEC_MAX_VERSION = (LIBAVCODEC_MAX_MAJOR_VERSION * 10000) + + (LIBAVCODEC_MAX_MINOR_VERSION * 100) + + (LIBAVCODEC_MAX_SUB_VERSION); + +LIBAVFORMAT_MAX_MAJOR_VERSION = 51; +LIBAVFORMAT_MAX_MINOR_VERSION = 12; +LIBAVFORMAT_MAX_SUB_VERSION = 1; +LIBAVFORMAT_MAX_VERSION = (LIBAVFORMAT_MAX_MAJOR_VERSION * 10000) + + (LIBAVFORMAT_MAX_MINOR_VERSION * 100) + + (LIBAVFORMAT_MAX_SUB_VERSION); + +LIBAVUTIL_MAX_MAJOR_VERSION = 49; +LIBAVUTIL_MAX_MINOR_VERSION = 4; +LIBAVUTIL_MAX_SUB_VERSION = 1; +LIBAVUTIL_MAX_VERSION = (LIBAVUTIL_MAX_MAJOR_VERSION * 10000) + + (LIBAVUTIL_MAX_MINOR_VERSION * 100) + + (LIBAVUTIL_MAX_SUB_VERSION); + +(* Calc linked version *) +LIBAVCODEC_VERSION = (LIBAVCODEC_MAJOR_VERSION * 10000) + + (LIBAVCODEC_MINOR_VERSION * 100) + + (LIBAVCODEC_SUB_VERSION); + +LIBAVFORMAT_VERSION = (LIBAVFORMAT_MAJOR_VERSION * 10000) + + (LIBAVFORMAT_MINOR_VERSION * 100) + + (LIBAVFORMAT_SUB_VERSION); + +LIBAVUTIL_VERSION = (LIBAVUTIL_MAJOR_VERSION * 10000) + + (LIBAVUTIL_MINOR_VERSION * 100) + + (LIBAVUTIL_SUB_VERSION); + +(* Check if linked versions are supported *) + +{$IF (LIBAVCODEC_VERSION > LIBAVCODEC_MAX_VERSION)} + {$MESSAGE Warn 'Linked version of libavcodec may be unsupported!'} +{$IFEND} + +{$IF (LIBAVFORMAT_VERSION > LIBAVFORMAT_MAX_VERSION)} + {$MESSAGE Warn 'Linked version of libavformat may be unsupported!'} +{$IFEND} {$IF (LIBAVUTIL_VERSION > LIBAVUTIL_MAX_VERSION)} - {$MESSAGE Warn 'Linked version of libavutil may be unsupported!'} -{$IFEND} + {$MESSAGE Warn 'Linked version of libavutil may be unsupported!'} +{$IFEND} + -- cgit v1.2.3 From bc01e7c70cf07c9758e09b07af5f788a45297eee Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 11 Jan 2008 12:41:51 +0000 Subject: Cleanup: Use the property Position in favor of MoveTo() (MoveTo() will be SetPosition() soon) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@784 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditSub.pas | 6 +++--- Game/Code/Screens/UScreenSing.pas | 8 ++++---- Game/Code/Screens/UScreenSong.pas | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 6dcb1f5f..725dd4e9 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -322,7 +322,7 @@ begin AudioPlayback.Stop; R := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote); if R <= AudioPlayback.Length then begin - AudioPlayback.MoveTo(R); + AudioPlayback.Position := R; PlayStopTime := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec); PlaySentence := true; AudioPlayback.Play; @@ -349,7 +349,7 @@ begin PlaySentence := true; Click := true; AudioPlayback.Stop; - AudioPlayback.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote)+0{-0.10}); + AudioPlayback.Position := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote)+0{-0.10}; PlayStopTime := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec)+0; AudioPlayback.Play; LastClick := -100; @@ -363,7 +363,7 @@ begin PlaySentence := true; Click := false; AudioPlayback.Stop; - AudioPlayback.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start)); + AudioPlayback.Position := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start); PlayStopTime := (GetTimeFromBeat( Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start + Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc)); diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 309af301..5a9ecae7 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -171,7 +171,7 @@ begin SDLK_TAB: //Change Visualization Preset begin if fShowVisualization then - fCurrentVideoPlaybackEngine.MoveTo( now ); // move to a random position + fCurrentVideoPlaybackEngine.Position := now; // move to a random position end; SDLK_RETURN: @@ -213,7 +213,7 @@ begin Czas.Teraz := PauseTime; //Position of Notes // Position of Music - AudioPlayback.MoveTo (PauseTime); + AudioPlayback.Position := PauseTime; // Play Music AudioPlayback.Play; @@ -478,7 +478,7 @@ begin // play music (I) AudioInput.CaptureStart; - AudioPlayback.MoveTo(AktSong.Start); + AudioPlayback.Position := AktSong.Start; // Music.Play; // prepare timer (I) @@ -1344,7 +1344,7 @@ begin // if we are shoing a visualization... change to a new preset after each sentence.. // Maybe we should make this less often or something... just a if fShowVisualization then - fCurrentVideoPlaybackEngine.MoveTo( now ); // move to a random position + fCurrentVideoPlaybackEngine.Position := now; // move to a random position end; //Called on Sentence Change S= New Current Sentence diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 03ef793b..4f90e2ca 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1524,7 +1524,7 @@ begin begin AudioPlayback.SetLoop(false); AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); - AudioPlayback.MoveTo(AudioPlayback.Length / 4); + AudioPlayback.Position := AudioPlayback.Length / 4; AudioPlayback.Play; //Set Preview Volume @@ -1768,7 +1768,7 @@ begin begin AudioPlayback.Close; if AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - AudioPlayback.MoveTo(AudioPlayback.Length / 4); + AudioPlayback.Position := AudioPlayback.Length / 4; //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal if (Ini.PreviewFading = 0) then AudioPlayback.Play -- cgit v1.2.3 From 4e4e55b6e62a225d7f70a8aa9342e91881decbc8 Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 11 Jan 2008 13:42:57 +0000 Subject: Updated to the new audio-interface git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@785 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudioPlayback_Bass.pas | 86 +++++++++++++++++++++++++------ 1 file changed, 70 insertions(+), 16 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudioPlayback_Bass.pas b/Game/Code/Classes/UAudioPlayback_Bass.pas index ee6b1ef9..87ff183d 100644 --- a/Game/Code/Classes/UAudioPlayback_Bass.pas +++ b/Game/Code/Classes/UAudioPlayback_Bass.pas @@ -31,18 +31,21 @@ uses UThemes; type - TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, - mpPaused, mpOpen); - -const - ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); - -type - TBassOutputStream = class(TAudioOutputStream) - Handle: HSTREAM; - - constructor Create(); overload; - constructor Create(stream: HSTREAM); overload; + TBassOutputStream = class(TAudioPlaybackStream) + private + Handle: HSTREAM; + public + constructor Create(); overload; + constructor Create(stream: HSTREAM); overload; + + procedure Play(); override; + procedure Pause(); override; + procedure Stop(); override; + procedure Close(); override; + function GetLoop(): boolean; override; + procedure SetLoop(Enabled: boolean); override; + function GetLength(): real; override; + function GetStatus(): TStreamStatus; override; end; type @@ -128,6 +131,61 @@ begin Handle := stream; end; +procedure TBassOutputStream.Play(); +begin + BASS_ChannelPlay(Handle, True); +end; + +procedure TBassOutputStream.Pause(); +begin + //if (Loaded) then + BASS_ChannelPause(Handle); +end; + +procedure TBassOutputStream.Stop(); +begin + BASS_ChannelStop(Handle); +end; + +procedure TBassOutputStream.Close(); +begin + Bass_StreamFree(Handle); +end; + +function TBassOutputStream.GetLoop(): boolean; +begin + // TODO + result := false; +end; + +procedure TBassOutputStream.SetLoop(Enabled: boolean); +begin + // TODO +end; + +function TBassOutputStream.GetLength(): real; +var + bytes: integer; +begin + bytes := BASS_ChannelGetLength(Handle); + Result := BASS_ChannelBytes2Seconds(Handle, bytes); +end; + +function TBassOutputStream.GetStatus(): TStreamStatus; +var + state: DWORD; +begin + state := BASS_ChannelIsActive(Handle); + case state of + BASS_ACTIVE_PLAYING: + result := sPlaying; + BASS_ACTIVE_PAUSED: + result := sPaused; + else + result := sStopped; + end; +end; + function TAudioPlayback_Bass.GetName: String; begin @@ -267,8 +325,6 @@ function TAudioPlayback_Bass.Length: real; var bytes: integer; begin - Result := 60; - bytes := BASS_ChannelGetLength(MusicStream); Result := BASS_ChannelBytes2Seconds(MusicStream, bytes); end; @@ -277,8 +333,6 @@ function TAudioPlayback_Bass.getPosition: real; var bytes: integer; begin - Result := 0; - bytes := BASS_ChannelGetPosition(MusicStream); Result := BASS_ChannelBytes2Seconds(MusicStream, bytes); end; -- cgit v1.2.3 From ff1dc556936cef441e105a19aa9d1d3b9e0cc833 Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 11 Jan 2008 13:52:44 +0000 Subject: changed from ffmpeg-free (audio) to ffmpeg-enabled (if turned on in switches.inc) version. BASS is used by default. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@786 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudio_FFMpeg.pas | 1005 -------------------------------- Game/Code/Classes/UAudio_bass.pas | 703 ---------------------- Game/Code/Classes/UAudio_portaudio.pas | 427 -------------- Game/Code/Classes/UMedia_dummy.pas | 13 +- Game/Code/Classes/UMusic.pas | 112 +++- Game/Code/Classes/UVideo.pas | 12 +- Game/Code/Classes/UVisualizer.pas | 15 +- Game/Code/UltraStar.dpr | 21 +- Game/Code/switches.inc | 131 +++-- 9 files changed, 200 insertions(+), 2239 deletions(-) delete mode 100644 Game/Code/Classes/UAudio_FFMpeg.pas delete mode 100644 Game/Code/Classes/UAudio_bass.pas delete mode 100644 Game/Code/Classes/UAudio_portaudio.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudio_FFMpeg.pas b/Game/Code/Classes/UAudio_FFMpeg.pas deleted file mode 100644 index fb25b0f9..00000000 --- a/Game/Code/Classes/UAudio_FFMpeg.pas +++ /dev/null @@ -1,1005 +0,0 @@ -unit UAudio_FFMpeg; - -(******************************************************************************* - -This unit is primarily based upon - - http://www.dranger.com/ffmpeg/ffmpegtutorial_all.html - - and tutorial03.c - - http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html - -*******************************************************************************) - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - - -uses Classes, - {$IFDEF win32} - windows, - {$ENDIF} - Messages, - SysUtils, - {$IFNDEF FPC} - Forms, - {$ENDIF} - SDL, // Used for Audio output Interface - avcodec, // FFMpeg Audio file decoding - avformat, - avutil, - ULog, - UMusic; - -implementation - -uses - {$IFDEF LAZARUS} - lclintf, - {$ifndef win32} - libc, // not available in win32 - {$endif} - {$ENDIF} - portaudio, - UIni, - UMain, - UThemes; - - -type - PPacketQueue = ^TPacketQueue; - TPacketQueue = class - private - firstPkt, - lastPkt : PAVPacketList; - nbPackets : integer; - size : integer; - mutex : PSDL_Mutex; - cond : PSDL_Cond; - quit : boolean; - - public - constructor Create(); - - function Put(pkt : PAVPacket): integer; - function Get(var pkt: TAVPacket; block: boolean): integer; - end; - -type - TStreamStatus = (sNotReady, sStopped, sPlaying, sSeeking, sPaused, sOpen); - -const - StreamStatusStr: array[TStreamStatus] of string = ('Not ready', 'Stopped', 'Playing', 'Seeking', 'Paused', 'Open'); - -type - PAudioBuffer = ^TAudioBuffer; - TAudioBuffer = array[0 .. (AVCODEC_MAX_AUDIO_FRAME_SIZE * 3 div 2)-1] of byte; - -const - SDL_AUDIO_BUFFER_SIZE = 1024; - -type - TFFMpegOutputStream = class(TAudioOutputStream) - private - parseThread: PSDL_Thread; - packetQueue: TPacketQueue; - - status: TStreamStatus; - - // FFMpeg internal data - pFormatCtx : PAVFormatContext; - pCodecCtx : PAVCodecContext; - pCodec : PAVCodec; - ffmpegStreamID : Integer; - ffmpegStream : PAVStream; - - // static vars for AudioDecodeFrame - pkt : TAVPacket; - audio_pkt_data : PChar; - audio_pkt_size : integer; - - // static vars for AudioCallback - audio_buf_index : cardinal; - audio_buf_size : cardinal; - audio_buf : TAudioBuffer; - - paStream : PPaStream; - paFrameSize : integer; - public - constructor Create(); overload; - constructor Create(pFormatCtx: PAVFormatContext; - pCodecCtx: PAVCodecContext; pCodec: PAVCodec; - ffmpegStreamID : Integer; ffmpegStream: PAVStream); overload; - - procedure Play(); - procedure Pause(); - procedure Stop(); - procedure Close(); - - function AudioDecodeFrame(buffer : PUInt8; bufSize: integer): integer; - end; - -type - TAudio_FFMpeg = class( TInterfacedObject, IAudioPlayback ) - private - MusicStream: TFFMpegOutputStream; - - StartSoundStream: TFFMpegOutputStream; - BackSoundStream: TFFMpegOutputStream; - SwooshSoundStream: TFFMpegOutputStream; - ChangeSoundStream: TFFMpegOutputStream; - OptionSoundStream: TFFMpegOutputStream; - ClickSoundStream: TFFMpegOutputStream; - DrumSoundStream: TFFMpegOutputStream; - HihatSoundStream: TFFMpegOutputStream; - ClapSoundStream: TFFMpegOutputStream; - ShuffleSoundStream: TFFMpegOutputStream; - - //Custom Sounds - CustomSounds: array of TCustomSoundEntry; - Loaded: boolean; - Loop: boolean; - - function FindAudioStreamID(pFormatCtx : PAVFormatContext): integer; - public - function GetName: String; - procedure InitializePlayback; - procedure SetVolume(Volume: integer); - procedure SetMusicVolume(Volume: integer); - procedure SetLoop(Enabled: boolean); - function Open(Name: string): boolean; // true if succeed - procedure Rewind; - procedure MoveTo(Time: real); - procedure Play; - procedure Pause; //Pause Mod - procedure Stop; - procedure Close; - function Finished: boolean; - function Length: real; - function getPosition: real; - procedure PlayStart; - procedure PlayBack; - procedure PlaySwoosh; - procedure PlayChange; - procedure PlayOption; - procedure PlayClick; - procedure PlayDrum; - procedure PlayHihat; - procedure PlayClap; - procedure PlayShuffle; - procedure StopShuffle; - - function LoadSoundFromFile(Name: string): TFFMpegOutputStream; - - //Equalizer - function GetFFTData: TFFTData; - - // Interface for Visualizer - function GetPCMData(var data: TPCMData): Cardinal; - - //Custom Sounds - function LoadCustomSound(const Filename: String): Cardinal; - procedure PlayCustomSound(const Index: Cardinal ); - end; - -var - test: TFFMpegOutputStream; - it: integer; - -var - singleton_MusicFFMpeg : IAudioPlayback = nil; - - -function ParseAudio(data: Pointer): integer; cdecl; forward; -procedure SDL_AudioCallback( userdata: Pointer; stream: PUInt8; len: Integer ); cdecl; forward; -function Pa_AudioCallback(input: Pointer; output: Pointer; frameCount: Longword; - timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; - userData: Pointer): Integer; cdecl; forward; - -constructor TFFMpegOutputStream.Create(); -begin - inherited; - - packetQueue := TPacketQueue.Create(); - - FillChar(pkt, sizeof(TAVPacket), #0); - - status := sStopped; - - audio_pkt_data := nil; - audio_pkt_size := 0; - - audio_buf_index := 0; - audio_buf_size := 0; -end; - -constructor TFFMpegOutputStream.Create(pFormatCtx: PAVFormatContext; - pCodecCtx: PAVCodecContext; pCodec: PAVCodec; - ffmpegStreamID : Integer; ffmpegStream: PAVStream); -begin - Create(); - - Self.pFormatCtx := pFormatCtx; - Self.pCodecCtx := pCodecCtx; - Self.pCodec := pCodec; - Self.ffmpegStreamID := ffmpegStreamID; - Self.ffmpegStream := ffmpegStream; - - test := Self; - it:=0; -end; - -procedure TFFMpegOutputStream.Play(); -var - err: TPaError; -begin - writeln('Play request'); - if(status = sStopped) then - begin - writeln('Play ok'); - status := sPlaying; - Self.parseThread := SDL_CreateThread(@ParseAudio, Self); - //SDL_PauseAudio(0); - - err := Pa_StartStream(Self.paStream); - if(err <> paNoError) then - begin - Writeln('Play: '+ Pa_GetErrorText(err)); - end; - end; -end; - -procedure TFFMpegOutputStream.Pause(); -begin -end; - -procedure TFFMpegOutputStream.Stop(); -begin -end; - -procedure TFFMpegOutputStream.Close(); -begin - // Close the codec - avcodec_close(pCodecCtx); - - // Close the video file - av_close_input_file(pFormatCtx); -end; - - -function TAudio_FFMpeg.GetName: String; -begin - result := 'FFMpeg'; -end; - -procedure TAudio_FFMpeg.InitializePlayback; -begin - Log.LogStatus('InitializePlayback', 'UAudio_FFMpeg'); - - Loaded := false; - Loop := false; - - av_register_all(); - //SDL_Init(SDL_INIT_AUDIO); - Pa_Initialize(); - - StartSoundStream := LoadSoundFromFile(SoundPath + 'Common start.mp3'); - BackSoundStream := LoadSoundFromFile(SoundPath + 'Common back.mp3'); - SwooshSoundStream := LoadSoundFromFile(SoundPath + 'menu swoosh.mp3'); - ChangeSoundStream := LoadSoundFromFile(SoundPath + 'select music change music 50.mp3'); - OptionSoundStream := LoadSoundFromFile(SoundPath + 'option change col.mp3'); - ClickSoundStream := LoadSoundFromFile(SoundPath + 'rimshot022b.mp3'); - -// DrumSoundStream := LoadSoundFromFile(SoundPath + 'bassdrumhard076b.mp3'); -// HihatSoundStream := LoadSoundFromFile(SoundPath + 'hihatclosed068b.mp3'); -// ClapSoundStream := LoadSoundFromFile(SoundPath + 'claps050b.mp3'); - -// ShuffleSoundStream := LoadSoundFromFile(SoundPath + 'Shuffle.mp3'); -end; - - -procedure TAudio_FFMpeg.SetVolume(Volume: integer); -begin - //New: Sets Volume only for this Application -(* - BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); -*) -end; - -procedure TAudio_FFMpeg.SetMusicVolume(Volume: Integer); -begin - //Max Volume Prevention - if Volume > 100 then - Volume := 100; - - if Volume < 0 then - Volume := 0; - - - //Set Volume -// BASS_ChannelSetAttributes (Bass, -1, Volume, -101); -end; - -procedure TAudio_FFMpeg.SetLoop(Enabled: boolean); -begin - Loop := Enabled; -end; - -function TAudio_FFMpeg.Open(Name: string): boolean; -begin - Loaded := false; - if FileExists(Name) then - begin -// Bass := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); - - Loaded := true; - //Set Max Volume - SetMusicVolume (100); - end; - - Result := Loaded; -end; - -procedure TAudio_FFMpeg.Rewind; -begin - if Loaded then - begin - end; -end; - -procedure TAudio_FFMpeg.MoveTo(Time: real); -var - bytes: integer; -begin -// bytes := BASS_ChannelSeconds2Bytes(Bass, Time); -// BASS_ChannelSetPosition(Bass, bytes); -end; - -procedure TAudio_FFMpeg.Play; -begin - if MusicStream <> nil then - if Loaded then - begin - if Loop then - begin - end; - // start from beginning... - // actually bass itself does not loop, nor does this TAudio_FFMpeg Class - MusicStream.Play(); - end; -end; - -procedure TAudio_FFMpeg.Pause; //Pause Mod -begin - if MusicStream <> nil then - if Loaded then begin - MusicStream.Pause(); // Pauses Song - end; -end; - -procedure TAudio_FFMpeg.Stop; -begin - if MusicStream <> nil then - MusicStream.Stop(); -end; - -procedure TAudio_FFMpeg.Close; -begin - if MusicStream <> nil then - MusicStream.Close(); -end; - -function TAudio_FFMpeg.Length: real; -var - bytes: integer; -begin - Result := 0; - // Todo : why is Music stream always nil !? - - if assigned( MusicStream ) then - begin - Result := MusicStream.pFormatCtx^.duration / AV_TIME_BASE; - end; -end; - -function TAudio_FFMpeg.getPosition: real; -var - bytes: integer; -begin - Result := 0; - -(* - bytes := BASS_ChannelGetPosition(BASS); - Result := BASS_ChannelBytes2Seconds(BASS, bytes); -*) -end; - -function TAudio_FFMpeg.Finished: boolean; -begin - Result := false; - -(* - if BASS_ChannelIsActive(BASS) = BASS_ACTIVE_STOPPED then - begin - Result := true; - end; -*) -end; - -procedure TAudio_FFMpeg.PlayStart; -begin - if StartSoundStream <> nil then - StartSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayBack; -begin - if BackSoundStream <> nil then - BackSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlaySwoosh; -begin - if SwooshSoundStream <> nil then - SwooshSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayChange; -begin - if ChangeSoundStream <> nil then - ChangeSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayOption; -begin - if OptionSoundStream <> nil then - OptionSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayClick; -begin - if ClickSoundStream <> nil then - ClickSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayDrum; -begin - if DrumSoundStream <> nil then - DrumSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayHihat; -begin - if HihatSoundStream <> nil then - HihatSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayClap; -begin - if ClapSoundStream <> nil then - ClapSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.PlayShuffle; -begin - if ShuffleSoundStream <> nil then - ShuffleSoundStream.Play(); -end; - -procedure TAudio_FFMpeg.StopShuffle; -begin - if ShuffleSoundStream <> nil then - ShuffleSoundStream.Stop(); -end; - - -function TFFMpegOutputStream.AudioDecodeFrame(buffer : PUInt8; bufSize: integer): integer; -var - len1, - data_size: integer; -begin - result := -1; - - if (buffer = nil) then - exit; - - while true do - begin - while (audio_pkt_size > 0) do - begin -// writeln( 'got audio packet' ); - data_size := bufSize; - - if(pCodecCtx = nil) then begin -// writeln('Das wars'); - exit; - end; - - // TODO: should be avcodec_decode_audio2 but this wont link on my ubuntu box. - len1 := avcodec_decode_audio(pCodecCtx, Pointer(buffer), - data_size, audio_pkt_data, audio_pkt_size); - - //writeln('avcodec_decode_audio : ' + inttostr( len1 )); - - if(len1 < 0) then - begin - // if error, skip frame -// writeln( 'Skip audio frame' ); - audio_pkt_size := 0; - break; - end; - - Inc(audio_pkt_data, len1); - Dec(audio_pkt_size, len1); - - if (data_size <= 0) then - begin - // No data yet, get more frames - continue; - end; - - // We have data, return it and come back for more later - result := data_size; - exit; - end; - - inc(it); - if (pkt.data <> nil) then - begin - av_free_packet(pkt); - end; - - if (packetQueue.quit) then - begin - result := -1; - exit; - end; -// writeln(it); - if (packetQueue.Get(pkt, true) < 0) then - begin - result := -1; - exit; - end; - - audio_pkt_data := PChar(pkt.data); - audio_pkt_size := pkt.size; -// writeln( 'Audio Packet Size - ' + inttostr(audio_pkt_size) ); - end; -end; - -procedure SDL_AudioCallback(userdata: Pointer; stream: PUInt8; len: Integer); cdecl; -var - outStream : TFFMpegOutputStream; - len1, - audio_size : integer; - pSrc : Pointer; -begin - outStream := TFFMpegOutputStream(userdata); - - while (len > 0) do - with outStream do begin - if (audio_buf_index >= audio_buf_size) then - begin - // We have already sent all our data; get more - audio_size := AudioDecodeFrame(@audio_buf, sizeof(TAudioBuffer)); - //writeln('audio_decode_frame : '+ inttostr(audio_size)); - - if(audio_size < 0) then - begin - // If error, output silence - audio_buf_size := 1024; - FillChar(audio_buf, audio_buf_size, #0); - //writeln( 'Silence' ); - end - else - begin - audio_buf_size := audio_size; - end; - audio_buf_index := 0; - end; - - len1 := audio_buf_size - audio_buf_index; - if (len1 > len) then - len1 := len; - - pSrc := PChar(@audio_buf) + audio_buf_index; - {$ifdef WIN32} - CopyMemory(stream, pSrc , len1); - {$else} - memcpy(stream, pSrc , len1); - {$endif} - - Dec(len, len1); - Inc(stream, len1); - Inc(audio_buf_index, len1); - end; -end; - -function Pa_AudioCallback(input: Pointer; output: Pointer; frameCount: Longword; - timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; - userData: Pointer): Integer; cdecl; -var - outStream : TFFMpegOutputStream; - len1, - audio_size : integer; - pSrc : Pointer; - len : integer; -begin - outStream := TFFMpegOutputStream(userData); - len := frameCount * outStream.paFrameSize; - - while (len > 0) do - with outStream do begin - if (audio_buf_index >= audio_buf_size) then - begin - // We have already sent all our data; get more - audio_size := AudioDecodeFrame(@audio_buf, sizeof(TAudioBuffer)); - //writeln('audio_decode_frame : '+ inttostr(audio_size)); - - if(audio_size < 0) then - begin - // If error, output silence - audio_buf_size := 1024; - FillChar(audio_buf, audio_buf_size, #0); - //writeln( 'Silence' ); - end - else - begin - audio_buf_size := audio_size; - end; - audio_buf_index := 0; // Todo : jb - SegFault ? - end; - - len1 := audio_buf_size - audio_buf_index; - if (len1 > len) then - len1 := len; - - pSrc := PChar(@audio_buf) + audio_buf_index; - {$ifdef WIN32} - CopyMemory(output, pSrc , len1); - {$else} - memcpy(output, pSrc , len1); - {$endif} - - Dec(len, len1); - Inc(PChar(output), len1); - Inc(audio_buf_index, len1); - end; - - result := paContinue; -end; - -function TAudio_FFMpeg.FindAudioStreamID(pFormatCtx : PAVFormatContext): integer; -var - i : integer; - streamID: integer; - stream : PAVStream; -begin - // Find the first audio stream - streamID := -1; - - for i := 0 to pFormatCtx^.nb_streams-1 do - begin - //Log.LogStatus('aFormatCtx.streams[i] : ' + inttostr(i), 'UAudio_FFMpeg'); - stream := pFormatCtx^.streams[i]; - - if ( stream.codec^.codec_type = CODEC_TYPE_AUDIO ) then - begin - Log.LogStatus('Found Audio Stream', 'UAudio_FFMpeg'); - streamID := i; - break; - end; - end; - - result := streamID; -end; - -function ParseAudio(data: Pointer): integer; cdecl; -var - packet: TAVPacket; - stream: TFFMpegOutputStream; -begin - stream := TFFMpegOutputStream(data); - - while (av_read_frame(stream.pFormatCtx, packet) >= 0) do - begin - //writeln( 'ffmpeg - av_read_frame' ); - - if (packet.stream_index = stream.ffmpegStreamID) then - begin - //writeln( 'packet_queue_put' ); - stream.packetQueue.put(@packet); - end - else - begin - av_free_packet(packet); - end; - end; - - //Writeln('Done: ' + inttostr(stream.packetQueue.nbPackets)); - - result := 0; -end; - - -function TAudio_FFMpeg.LoadSoundFromFile(Name: string): TFFMpegOutputStream; -var - pFormatCtx : PAVFormatContext; - pCodecCtx : PAVCodecContext; - pCodec : PAVCodec; - ffmpegStreamID : Integer; - ffmpegStream : PAVStream; - wanted_spec, - spec : TSDL_AudioSpec; - csIndex : integer; - stream : TFFMpegOutputStream; - err : TPaError; - // move this to a portaudio specific section - paOutParams : TPaStreamParameters; - paApiInfo : PPaHostApiInfo; - paApi : TPaHostApiIndex; - paOutDevice : TPaDeviceIndex; - paOutDeviceInfo : PPaDeviceInfo; -begin - result := nil; - - if (not FileExists(Name)) then - begin - Log.LogStatus('LoadSoundFromFile: Sound not found "' + Name + '"', 'UAudio_FFMpeg'); - writeln('ERROR : LoadSoundFromFile: Sound not found "' + Name + '"', 'UAudio_FFMpeg'); - exit; - end; - - // Open audio file - if (av_open_input_file(pFormatCtx, PChar(Name), nil, 0, nil) > 0) then - exit; - - // Retrieve stream information - if (av_find_stream_info(pFormatCtx) < 0) then - exit; - - dump_format(pFormatCtx, 0, pchar(Name), 0); - - ffmpegStreamID := FindAudioStreamID(pFormatCtx); - if (ffmpegStreamID < 0) then - exit; - - //Log.LogStatus('Audio Stream ID is : '+ inttostr(ffmpegStreamID), 'UAudio_FFMpeg'); - - ffmpegStream := pFormatCtx.streams[ffmpegStreamID]; - pCodecCtx := ffmpegStream^.codec; - - pCodec := avcodec_find_decoder(pCodecCtx^.codec_id); - if (pCodec = nil) then - begin - Log.LogStatus('Unsupported codec!', 'UAudio_FFMpeg'); - exit; - end; - - avcodec_open(pCodecCtx, pCodec); - //writeln( 'Opened the codec' ); - - stream := TFFMpegOutputStream.Create(pFormatCtx, pCodecCtx, pCodec, - ffmpegStreamID, ffmpegStream); - - { - // Set SDL audio settings from codec info - wanted_spec.freq := pCodecCtx^.sample_rate; - wanted_spec.format := AUDIO_S16SYS; - wanted_spec.channels := pCodecCtx^.channels; - wanted_spec.silence := 0; - wanted_spec.samples := SDL_AUDIO_BUFFER_SIZE; - wanted_spec.callback := AudioCallback; - wanted_spec.userdata := stream; - - // TODO: this works only one time (?) - if (SDL_OpenAudio(@wanted_spec, @spec) < 0) then - begin - Log.LogStatus('SDL_OpenAudio: '+SDL_GetError(), 'UAudio_FFMpeg'); - stream.Free(); - exit; - end; - } - - paApi := Pa_HostApiTypeIdToHostApiIndex(paALSA); - paApiInfo := Pa_GetHostApiInfo(paApi); - paOutDevice := paApiInfo^.defaultOutputDevice; - paOutDeviceInfo := Pa_GetDeviceInfo(paOutDevice); - - with paOutParams do begin - device := paOutDevice; - channelCount := pCodecCtx^.channels; - sampleFormat := paInt16; - suggestedLatency := paOutDeviceInfo^.defaultHighOutputLatency; - hostApiSpecificStreamInfo := nil; - end; - - stream.paFrameSize := sizeof(Smallint) * pCodecCtx^.channels; - - err := Pa_OpenStream(stream.paStream, nil, @paOutParams, pCodecCtx^.sample_rate, - paFramesPerBufferUnspecified, //SDL_AUDIO_BUFFER_SIZE div stream.paFrameSize - paNoFlag, @PA_AudioCallback, stream); - if(err <> paNoError) then begin - Log.LogStatus('Pa_OpenDefaultStream: '+Pa_GetErrorText(err), 'UAudio_FFMpeg'); - stream.Free(); - exit; - end; - - Log.LogStatus('Opened audio device', 'UAudio_FFMpeg'); - - //Add CustomSound - csIndex := High(CustomSounds) + 1; - SetLength (CustomSounds, csIndex + 1); - CustomSounds[csIndex].Filename := Name; - CustomSounds[csIndex].Stream := stream; - - result := stream; -end; - -//Equalizer -function TAudio_FFMpeg.GetFFTData: TFFTData; -var - data: TFFTData; -begin - //Get Channel Data Mono and 256 Values -// BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); - result := data; -end; - -// Interface for Visualizer -function TAudio_FFMpeg.GetPCMData(var data: TPCMData): Cardinal; -begin - result := 0; -end; - -function TAudio_FFMpeg.LoadCustomSound(const Filename: String): Cardinal; -var - S: TFFMpegOutputStream; - I: Integer; - F: String; -begin - //Search for Sound in already loaded Sounds - F := UpperCase(SoundPath + FileName); - For I := 0 to High(CustomSounds) do - begin - if (UpperCase(CustomSounds[I].Filename) = F) then - begin - Result := I; - Exit; - end; - end; - - S := LoadSoundFromFile(SoundPath + Filename); - if (S <> nil) then - Result := High(CustomSounds) - else - Result := 0; -end; - -procedure TAudio_FFMpeg.PlayCustomSound(const Index: Cardinal ); -begin - if Index <= High(CustomSounds) then - (CustomSounds[Index].Stream as TFFMpegOutputStream).Play(); -end; - - -constructor TPacketQueue.Create(); -begin - inherited; - - firstPkt := nil; - lastPkt := nil; - nbPackets := 0; - size := 0; - - mutex := SDL_CreateMutex(); - cond := SDL_CreateCond(); -end; - -function TPacketQueue.Put(pkt : PAVPacket): integer; -var - pkt1 : PAVPacketList; -begin - result := -1; - - if (av_dup_packet(pkt) < 0) then - exit; - - pkt1 := av_malloc(sizeof(TAVPacketList)); - if (pkt1 = nil) then - exit; - - pkt1^.pkt := pkt^; - pkt1^.next := nil; - - - SDL_LockMutex(Self.mutex); - try - - if (Self.lastPkt = nil) then - Self.firstPkt := pkt1 - else - Self.lastPkt^.next := pkt1; - - Self.lastPkt := pkt1; - inc(Self.nbPackets); - -// Writeln('Put: ' + inttostr(nbPackets)); - - Self.size := Self.size + pkt1^.pkt.size; - SDL_CondSignal(Self.cond); - - finally - SDL_UnlockMutex(Self.mutex); - end; - - result := 0; -end; - -function TPacketQueue.Get(var pkt: TAVPacket; block: boolean): integer; -var - pkt1 : PAVPacketList; -begin - result := -1; - - SDL_LockMutex(Self.mutex); - try - while true do - begin - if (quit) then - exit; - - pkt1 := Self.firstPkt; - - if (pkt1 <> nil) then - begin - Self.firstPkt := pkt1.next; - if (Self.firstPkt = nil) then - Self.lastPkt := nil; - dec(Self.nbPackets); - -// Writeln('Get: ' + inttostr(nbPackets)); - - Self.size := Self.size - pkt1^.pkt.size; - pkt := pkt1^.pkt; - av_free(pkt1); - - result := 1; - break; - end - else - if (not block) then - begin - result := 0; - break; - end - else - begin - SDL_CondWait(Self.cond, Self.mutex); - end; - end; - finally - SDL_UnlockMutex(Self.mutex); - end; -end; - - - -initialization - singleton_MusicFFMpeg := TAudio_FFMpeg.create(); - - writeln( 'UAudio_FFMpeg - Register Playback' ); - AudioManager.add( IAudioPlayback( singleton_MusicFFMpeg ) ); - -finalization - AudioManager.Remove( IAudioPlayback( singleton_MusicFFMpeg ) ); - - -end. diff --git a/Game/Code/Classes/UAudio_bass.pas b/Game/Code/Classes/UAudio_bass.pas deleted file mode 100644 index 972d6df0..00000000 --- a/Game/Code/Classes/UAudio_bass.pas +++ /dev/null @@ -1,703 +0,0 @@ -unit UAudio_bass; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - - -uses Classes, - {$IFDEF win32} - windows, - {$ENDIF} - Messages, - SysUtils, - {$IFNDEF FPC} - Forms, - {$ENDIF} - bass, - ULog, - UMusic; - -implementation - -uses - {$IFDEF LAZARUS} - lclintf, - {$ENDIF} - URecord, - UIni, - UMain, - UCommon, - UThemes; - -type - TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking, - mpPaused, mpOpen); - -const - ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open'); - -type - TBassOutputStream = class(TAudioOutputStream) - Handle: HSTREAM; - - constructor Create(); overload; - constructor Create(stream: HSTREAM); overload; - end; - -type -{$IFDEF UseBASSInput} - TAudio_bass = class( TInterfacedObject, IAudioPlayback, IAudioInput) -{$ELSE} - TAudio_bass = class( TInterfacedObject, IAudioPlayback) -{$ENDIF} - private - MusicStream: HSTREAM; - - StartSoundStream: HSTREAM; - BackSoundStream: HSTREAM; - SwooshSoundStream: HSTREAM; - ChangeSoundStream: HSTREAM; - OptionSoundStream: HSTREAM; - ClickSoundStream: HSTREAM; - DrumSoundStream: HSTREAM; - HihatSoundStream: HSTREAM; - ClapSoundStream: HSTREAM; - ShuffleSoundStream: HSTREAM; - - //Custom Sounds - CustomSounds: array of TCustomSoundEntry; - Loaded: boolean; - Loop: boolean; - - public - function GetName: String; - - {IAudioOutput interface} - - procedure InitializePlayback; - procedure SetVolume(Volume: integer); - procedure SetMusicVolume(Volume: integer); - procedure SetLoop(Enabled: boolean); - function Open(Name: string): boolean; // true if succeed - procedure Rewind; - procedure MoveTo(Time: real); - procedure Play; - procedure Pause; //Pause Mod - procedure Stop; - procedure Close; - function Finished: boolean; - function Length: real; - function getPosition: real; - procedure PlayStart; - procedure PlayBack; - procedure PlaySwoosh; - procedure PlayChange; - procedure PlayOption; - procedure PlayClick; - procedure PlayDrum; - procedure PlayHihat; - procedure PlayClap; - procedure PlayShuffle; - procedure StopShuffle; - - function LoadSoundFromFile(var stream: HSTREAM; Name: string): boolean; - - //Equalizer - function GetFFTData: TFFTData; - - // Interface for Visualizer - function GetPCMData(var data: TPCMData): Cardinal; - - //Custom Sounds - function LoadCustomSound(const Filename: String): Cardinal; - procedure PlayCustomSound(const Index: Cardinal ); - - {IAudioInput interface} - {$IFDEF UseBASSInput} - procedure InitializeRecord; - - procedure CaptureStart; - procedure CaptureStop; - procedure CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); - procedure StopCard(Card: byte); - {$ENDIF} - end; - -{$IFDEF UseBASSInput} - TBassSoundCard = class(TGenericSoundCard) - RecordStream: HSTREAM; - end; -{$ENDIF} - - -var - singleton_MusicBass : IAudioPlayback; - - -constructor TBassOutputStream.Create(); -begin - inherited; -end; - -constructor TBassOutputStream.Create(stream: HSTREAM); -begin - Create(); - Handle := stream; -end; - - -function TAudio_bass.GetName: String; -begin - result := 'BASS'; -end; - -procedure TAudio_bass.InitializePlayback; -var - Pet: integer; - S: integer; -begin -// Log.BenchmarkStart(4); -// Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); - - Loaded := false; - Loop := false; - - if not BASS_Init(1, 44100, 0, 0, nil) then - begin - Log.LogError('Could not initialize BASS', 'Error'); - Exit; - end; - -// Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); - - // config playing buffer -// BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); -// BASS_SetConfig(BASS_CONFIG_BUFFER, 100); - -// Log.LogStatus('Loading Sounds', 'Music Initialize'); - -// Log.BenchmarkStart(4); - LoadSoundFromFile(StartSoundStream, SoundPath + 'Common Start.mp3'); - LoadSoundFromFile(BackSoundStream, SoundPath + 'Common Back.mp3'); - LoadSoundFromFile(SwooshSoundStream, SoundPath + 'menu swoosh.mp3'); - LoadSoundFromFile(ChangeSoundStream, SoundPath + 'select music change music 50.mp3'); - LoadSoundFromFile(OptionSoundStream, SoundPath + 'option change col.mp3'); - LoadSoundFromFile(ClickSoundStream, SoundPath + 'rimshot022b.mp3'); - -// LoadSoundFromFile(DrumSoundStream, SoundPath + 'bassdrumhard076b.mp3'); -// LoadSoundFromFile(HihatSoundStream, SoundPath + 'hihatclosed068b.mp3'); -// LoadSoundFromFile(ClapSoundStream, SoundPath + 'claps050b.mp3'); - -// LoadSoundFromFile(ShuffleSoundStream, SoundPath + 'Shuffle.mp3'); - -// Log.BenchmarkEnd(4); -// Log.LogBenchmark('--> Loading Sounds', 4); -end; - -procedure TAudio_bass.SetVolume(Volume: integer); -begin - //Old Sets Wave Volume - //BASS_SetVolume(Volume); - //New: Sets Volume only for this Application - - BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); -end; - -procedure TAudio_bass.SetMusicVolume(Volume: Integer); -begin - //Max Volume Prevention - if Volume > 100 then - Volume := 100; - - if Volume < 0 then - Volume := 0; - - //Set Volume - BASS_ChannelSetAttributes (MusicStream, -1, Volume, -101); -end; - -procedure TAudio_bass.SetLoop(Enabled: boolean); -begin - Loop := Enabled; -end; - -function TAudio_bass.Open(Name: string): boolean; -begin - Loaded := false; - if FileExists(Name) then - begin - MusicStream := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); - - Loaded := true; - //Set Max Volume - SetMusicVolume (100); - end; - - Result := Loaded; -end; - -procedure TAudio_bass.Rewind; -begin - if Loaded then begin - end; -end; - -procedure TAudio_bass.MoveTo(Time: real); -var - bytes: integer; -begin - bytes := BASS_ChannelSeconds2Bytes(MusicStream, Time); - BASS_ChannelSetPosition(MusicStream, bytes); -end; - -procedure TAudio_bass.Play; -begin - if Loaded then - begin - if Loop then - BASS_ChannelPlay(MusicStream, True); // start from beginning... actually bass itself does not loop, nor does this TAudio_bass Class - - BASS_ChannelPlay(MusicStream, False); // for setting position before playing - end; -end; - -procedure TAudio_bass.Pause; //Pause Mod -begin - if Loaded then begin - BASS_ChannelPause(MusicStream); // Pauses Song - end; -end; - -procedure TAudio_bass.Stop; -begin - Bass_ChannelStop(MusicStream); -end; - -procedure TAudio_bass.Close; -begin - Bass_StreamFree(MusicStream); -end; - -function TAudio_bass.Length: real; -var - bytes: integer; -begin - Result := 60; - - bytes := BASS_ChannelGetLength(MusicStream); - Result := BASS_ChannelBytes2Seconds(MusicStream, bytes); -end; - -function TAudio_bass.getPosition: real; -var - bytes: integer; -begin - Result := 0; - - bytes := BASS_ChannelGetPosition(MusicStream); - Result := BASS_ChannelBytes2Seconds(MusicStream, bytes); -end; - -function TAudio_bass.Finished: boolean; -begin - Result := false; - - if BASS_ChannelIsActive(MusicStream) = BASS_ACTIVE_STOPPED then - begin - Result := true; - end; -end; - -procedure TAudio_bass.PlayStart; -begin - BASS_ChannelPlay(StartSoundStream, True); -end; - -procedure TAudio_bass.PlayBack; -begin - BASS_ChannelPlay(BackSoundStream, True);// then -end; - -procedure TAudio_bass.PlaySwoosh; -begin - BASS_ChannelPlay(SwooshSoundStream, True); -end; - -procedure TAudio_bass.PlayChange; -begin - BASS_ChannelPlay(ChangeSoundStream, True); -end; - -procedure TAudio_bass.PlayOption; -begin - BASS_ChannelPlay(OptionSoundStream, True); -end; - -procedure TAudio_bass.PlayClick; -begin - BASS_ChannelPlay(ClickSoundStream, True); -end; - -procedure TAudio_bass.PlayDrum; -begin - BASS_ChannelPlay(DrumSoundStream, True); -end; - -procedure TAudio_bass.PlayHihat; -begin - BASS_ChannelPlay(HihatSoundStream, True); -end; - -procedure TAudio_bass.PlayClap; -begin - BASS_ChannelPlay(ClapSoundStream, True); -end; - -procedure TAudio_bass.PlayShuffle; -begin - BASS_ChannelPlay(ShuffleSoundStream, True); -end; - -procedure TAudio_bass.StopShuffle; -begin - BASS_ChannelStop(ShuffleSoundStream); -end; - -function TAudio_bass.LoadSoundFromFile(var stream: HSTREAM; Name: string): boolean; -var - L: Integer; -begin - if FileExists(Name) then - begin - Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); - try - stream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); - - //Add CustomSound - L := High(CustomSounds) + 1; - SetLength (CustomSounds, L + 1); - CustomSounds[L].Filename := Name; - CustomSounds[L].Stream := TBassOutputStream.Create(stream); - except - Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); - end; - end - else - begin - Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); - exit; - end; -end; - -//Equalizer -function TAudio_bass.GetFFTData: TFFTData; -var - Data: TFFTData; -begin - //Get Channel Data Mono and 256 Values - BASS_ChannelGetData(MusicStream, @Result, BASS_DATA_FFT512); -end; - -{* - * Copies interleaved PCM 16bit uint (maybe fake) stereo samples into data. - * Returns the number of frames (= stereo/mono sample) - *} -function TAudio_bass.GetPCMData(var data: TPCMData): Cardinal; -var - info: BASS_CHANNELINFO; - nBytes: DWORD; -begin - //Get Channel Data Mono and 256 Values - BASS_ChannelGetInfo(MusicStream, info); - ZeroMemory(@data, sizeof(TPCMData)); - - if (info.chans = 1) then - begin - // mono file -> add stereo channel - { - nBytes := BASS_ChannelGetData(Bass, @data[0], samples*sizeof(Smallint)); - // interleave data - //CopyMemory(@data[1], @data[0], samples*sizeof(Smallint)); - } - result := 0; - end - else - begin - // stereo file - nBytes := BASS_ChannelGetData(MusicStream, @data, sizeof(TPCMData)); - end; - if(nBytes <= 0) then - result := 0 - else - result := nBytes div sizeof(TPCMStereoSample); -end; - -function TAudio_bass.LoadCustomSound(const Filename: String): Cardinal; -var - S: hStream; - I: Integer; - F: String; -begin - //Search for Sound in already loaded Sounds - F := UpperCase(SoundPath + FileName); - For I := 0 to High(CustomSounds) do - begin - if (UpperCase(CustomSounds[I].Filename) = F) then - begin - Result := I; - Exit; - end; - end; - - if LoadSoundFromFile(S, SoundPath + Filename) then - Result := High(CustomSounds) - else - Result := 0; -end; - -procedure TAudio_bass.PlayCustomSound(const Index: Cardinal ); -begin - if Index <= High(CustomSounds) then - with CustomSounds[Index].Stream as TBassOutputStream do - begin - BASS_ChannelPlay(Handle, True); - end; -end; - -{$IFDEF UseBASSInput} - -procedure TAudio_bass.InitializeRecord; -var - device: integer; - Descr: string; - input: integer; - input2: integer; - InputName: PChar; - Flags: integer; - mic: array[0..15] of integer; - SC: integer; // soundcard - SCI: integer; // soundcard input - No: integer; - -function isDuplicate(Desc: String): Boolean; -var - I: Integer; -begin - Result := False; - //Check for Soundcard with same Description - For I := 0 to SC-1 do - begin - if (Recording.SoundCard[I].Description = Desc) then - begin - Result := True; - Break; - end; - end; -end; - -begin - with Recording do - begin - // checks for recording devices and puts them into an array - SetLength(SoundCard, 0); - - SC := 0; - Descr := BASS_RecordGetDeviceDescription(SC); - - while (Descr <> '') do - begin - //If there is another SoundCard with the Same ID, Search an available Name - if (IsDuplicate(Descr)) then - begin - No:= 1; //Count of SoundCards with same Name - Repeat - Inc(No) - Until not IsDuplicate(Descr + ' (' + InttoStr(No) + ')'); - - //Set Description - Descr := Descr + ' (' + InttoStr(No) + ')'; - end; - - SetLength(SoundCard, SC+1); - - // TODO: free object on termination - SoundCard[SC] := TBassSoundCard.Create(); - SoundCard[SC].Description := Descr; - - //Get Recording Inputs - SCI := 0; - BASS_RecordInit(SC); - - InputName := BASS_RecordGetInputName(SCI); - - {$IFDEF DARWIN} - // Under MacOSX the SingStar Mics have an empty - // InputName. So, we have to add a hard coded - // Workaround for this problem - if (InputName = nil) and (Pos( 'USBMIC Serial#', Descr) > 0) then - begin - InputName := 'Microphone'; - end; - {$ENDIF} - - SetLength(SoundCard[SC].Input, 1); - SoundCard[SC].Input[SCI].Name := InputName; - - // process each input - while (InputName <> nil) do - begin - Flags := BASS_RecordGetInput(SCI); - if (SCI >= 1) {AND (Flags AND BASS_INPUT_OFF = 0)} then - begin - SetLength(SoundCard[SC].Input, SCI+1); - SoundCard[SC].Input[SCI].Name := InputName; - end; - - //Set Mic Index - if ((Flags and BASS_INPUT_TYPE_MIC) = 1) then - SoundCard[SC].MicInput := SCI; - - Inc(SCI); - InputName := BASS_RecordGetInputName(SCI); - end; - - BASS_RecordFree; - - Inc(SC); - Descr := BASS_RecordGetDeviceDescription(SC); - end; // while - end; // with Recording -end; - -// TODO: code is used by all IAudioInput implementors -// -> move to a common superclass (TAudioInput_Generic?) -procedure TAudio_bass.CaptureStart; -var - S: integer; - SC: integer; - PlayerLeft, PlayerRight: integer; - CaptureSoundLeft, CaptureSoundRight: TSound; -begin - for S := 0 to High(Recording.Sound) do - Recording.Sound[S].BufferLong[0].Clear; - - for SC := 0 to High(Ini.CardList) do begin - PlayerLeft := Ini.CardList[SC].ChannelL-1; - PlayerRight := Ini.CardList[SC].ChannelR-1; - if PlayerLeft >= PlayersPlay then PlayerLeft := -1; - if PlayerRight >= PlayersPlay then PlayerRight := -1; - if (PlayerLeft > -1) or (PlayerRight > -1) then begin - if (PlayerLeft > -1) then - CaptureSoundLeft := Recording.Sound[PlayerLeft] - else - CaptureSoundLeft := nil; - if (PlayerRight > -1) then - CaptureSoundRight := Recording.Sound[PlayerRight] - else - CaptureSoundRight := nil; - - CaptureCard(SC, CaptureSoundLeft, CaptureSoundRight); - end; - end; -end; - -// TODO: code is used by all IAudioInput implementors -// -> move to a common superclass (TAudioInput_Generic?) -procedure TAudio_bass.CaptureStop; -var - SC: integer; - PlayerLeft: integer; - PlayerRight: integer; -begin - - for SC := 0 to High(Ini.CardList) do begin - PlayerLeft := Ini.CardList[SC].ChannelL-1; - PlayerRight := Ini.CardList[SC].ChannelR-1; - if PlayerLeft >= PlayersPlay then PlayerLeft := -1; - if PlayerRight >= PlayersPlay then PlayerRight := -1; - if (PlayerLeft > -1) or (PlayerRight > -1) then - StopCard(SC); - end; - -end; - -{* - * Bass input capture callback. - * Params: - * stream - BASS input stream - * buffer - buffer of captured samples - * len - size of buffer in bytes - * user - players associated with left/right channels - *} -function MicrophoneCallback(stream: HSTREAM; buffer: Pointer; - len: Cardinal; Card: Cardinal): boolean; stdcall; -begin - Recording.HandleMicrophoneData(buffer, len, Recording.SoundCard[Card]); - Result := true; -end; - -{* - * Start input-capturing on Soundcard specified by Card. - * Params: - * Card - soundcard index in Recording.SoundCard array - * CaptureSoundLeft - sound(-buffer) used for left channel capture data - * CaptureSoundRight - sound(-buffer) used for right channel capture data - *} -procedure TAudio_bass.CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); -var - Error: integer; - ErrorMsg: string; - bassSoundCard: TBassSoundCard; -begin - if not BASS_RecordInit(Card) then - begin - Error := BASS_ErrorGetCode; - ErrorMsg := IntToStr(Error); - if Error = BASS_ERROR_DX then ErrorMsg := 'No DX5'; - if Error = BASS_ERROR_ALREADY then ErrorMsg := 'The device has already been initialized'; - if Error = BASS_ERROR_DEVICE then ErrorMsg := 'The device number specified is invalid'; - if Error = BASS_ERROR_DRIVER then ErrorMsg := 'There is no available device driver'; - Log.LogError('Error initializing record [' + IntToStr(Card) + ']'); - Log.LogError('TAudio_bass.CaptureCard: Error initializing record: ' + ErrorMsg); - end - else - begin - bassSoundCard := TBassSoundCard(Recording.SoundCard[Card]); - bassSoundCard.CaptureSoundLeft := CaptureSoundLeft; - bassSoundCard.CaptureSoundRight := CaptureSoundRight; - - // capture in 44.1kHz/stereo/16bit and a 20ms callback period - bassSoundCard.RecordStream := - BASS_RecordStart(44100, 2, MakeLong(0, 20) , @MicrophoneCallback, Card); - end; -end; - -{* - * Stop input-capturing on Soundcard specified by Card. - * Params: - * Card - soundcard index in Recording.SoundCard array - *} -procedure TAudio_bass.StopCard(Card: byte); -begin - BASS_RecordSetDevice(Card); - BASS_RecordFree; -end; - -{$ENDIF} - - -initialization - singleton_MusicBass := TAudio_bass.create(); - AudioManager.add( singleton_MusicBass ); - -finalization - AudioManager.Remove( singleton_MusicBass ); - -end. diff --git a/Game/Code/Classes/UAudio_portaudio.pas b/Game/Code/Classes/UAudio_portaudio.pas deleted file mode 100644 index 47e54981..00000000 --- a/Game/Code/Classes/UAudio_portaudio.pas +++ /dev/null @@ -1,427 +0,0 @@ -unit UAudio_Portaudio; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - - -uses Classes, - {$IFDEF win32} - windows, - {$ENDIF} - Messages, - SysUtils, - {$IFNDEF FPC} - Forms, - {$ENDIF} - portaudio, - {$IFDEF UsePortmixer} - portmixer, - {$ENDIF} - ULog, - UMusic; - -implementation - -uses - {$IFDEF LAZARUS} - lclintf, - {$ENDIF} - URecord, - UIni, - UMain, - UCommon, - UThemes; -{ -type - TPaHostApiIndex = PaHostApiIndex; - TPaDeviceIndex = PaDeviceIndex; - PPaStream = ^PaStreamPtr; - PPaStreamCallbackTimeInfo = ^PaStreamCallbackTimeInfo; - TPaStreamCallbackFlags = PaStreamCallbackFlags; - TPaHostApiTypeId = PaHostApiTypeId; - PPaHostApiInfo = ^PaHostApiInfo; - PPaDeviceInfo = ^PaDeviceInfo; - TPaError = PaError; - TPaStreamParameters = PaStreamParameters; -} -type - TAudio_Portaudio = class( TInterfacedObject, IAudioInput ) - private - function GetPreferredApiIndex(): TPaHostApiIndex; - public - function GetName: String; - procedure InitializeRecord; - - procedure CaptureStart; - procedure CaptureStop; - - procedure CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); - procedure StopCard(Card: byte); - end; - - TPortaudioSoundCard = class(TGenericSoundCard) - RecordStream: PPaStream; - DeviceIndex: TPaDeviceIndex; - end; - -function MicrophoneCallback(input: Pointer; output: Pointer; frameCount: Longword; - timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; - inputDevice: Pointer): Integer; cdecl; forward; - -var - singleton_MusicPortaudio : IAudioInput; - -const - sampleRate: Double = 44100.; - -{* the default API used by Portaudio is the least common denominator - * and might lack efficiency. ApiPreferenceOrder defines the order of - * preferred APIs to use. The first API-type in the list is tried first. If it's - * not available the next is tried, ... - * If none of the preferred APIs was found the default API is used. - * Pascal doesn't permit zero-length static arrays, so you can use paDefaultApi - * as an array's only member if you do not have any preferences. - * paDefaultApi also terminates a preferences list but this is optional. - *} -const - paDefaultApi = -1; -var - ApiPreferenceOrder: -{$IF Defined(WIN32)} - // Note1: Portmixer has no mixer support for paASIO and paWASAPI at the moment - // Note2: Windows Default-API is MME - //array[0..0] of TPaHostApiTypeId = ( paDirectSound, paMME ); - array[0..0] of TPaHostApiTypeId = ( paDirectSound ); -{$ELSEIF Defined(LINUX)} - // Note1: Portmixer has no mixer support for paJACK at the moment - // Note2: Not tested, but ALSA might be better than OSS. - array[0..1] of TPaHostApiTypeId = ( paALSA, paOSS ); -{$ELSEIF Defined(DARWIN)} - // Note: Not tested. - //array[0..0] of TPaHostApiTypeId = ( paCoreAudio ); - array[0..0] of TPaHostApiTypeId = ( paDefaultApi ); -{$ELSE} - array[0..0] of TPaHostApiTypeId = ( paDefaultApi ); -{$IFEND} - -function TAudio_Portaudio.GetName: String; -begin - result := 'Portaudio'; -end; - -function TAudio_Portaudio.GetPreferredApiIndex(): TPaHostApiIndex; -var - i: integer; -begin - result := -1; - - // select preferred sound-API - for i:= 0 to High(ApiPreferenceOrder) do - begin - if(ApiPreferenceOrder[i] <> paDefaultApi) then begin - // check if API is available - result := Pa_HostApiTypeIdToHostApiIndex(ApiPreferenceOrder[i]); - if(result >= 0) then - break; - end; - end; - - // None of the preferred APIs is available -> use default - if(result < 0) then begin - result := Pa_GetDefaultHostApi(); - end; -end; - -// TODO: should be a function with boolean return type -procedure TAudio_Portaudio.InitializeRecord; -var - i: integer; - apiIndex: TPaHostApiIndex; - apiInfo: PPaHostApiInfo; - deviceName: string; - deviceIndex: TPaDeviceIndex; - deviceInfo: PPaDeviceInfo; - inputCnt: integer; - inputName: string; - SC: integer; // soundcard - SCI: integer; // soundcard input - err: TPaError; - errMsg: string; - paSoundCard: TPortaudioSoundCard; - inputParams: TPaStreamParameters; - stream: PPaStream; - {$IFDEF UsePortmixer} - mixer: PPxMixer; - {$ENDIF} -begin - // TODO: call Pa_Terminate() on termination - err := Pa_Initialize(); - if(err <> paNoError) then begin - Log.CriticalError('Portaudio.InitializeRecord: ' + Pa_GetErrorText(err)); - //Log.LogError('Portaudio.InitializeRecord: ' + Pa_GetErrorText(err)); - // result := false; - Exit; - end; - - apiIndex := GetPreferredApiIndex(); - apiInfo := Pa_GetHostApiInfo(apiIndex); - - SC := 0; - - // init array-size to max. input-devices count - SetLength(Recording.SoundCard, apiInfo^.deviceCount); // fix deviceCountL - for i:= 0 to High(Recording.SoundCard) do - begin - // convert API-specific device-index to global index - deviceIndex := Pa_HostApiDeviceIndexToDeviceIndex(apiIndex, i); - deviceInfo := Pa_GetDeviceInfo(deviceIndex); - - // current device is no input device -> skip - if(deviceInfo^.maxInputChannels <= 0) then - continue; - - // TODO: free object on termination - paSoundCard := TPortaudioSoundCard.Create(); - Recording.SoundCard[SC] := paSoundCard; - - // retrieve device-name - deviceName := deviceInfo^.name; - paSoundCard.Description := deviceName; - paSoundCard.DeviceIndex := deviceIndex; - - // setup desired input parameters - with inputParams do begin - device := deviceIndex; - channelCount := 2; - sampleFormat := paInt16; - suggestedLatency := deviceInfo^.defaultLowInputLatency; - hostApiSpecificStreamInfo := nil; - end; - - // check if device supports our input-format - err := Pa_IsFormatSupported(@inputParams, nil, sampleRate); - if(err <> 0) then begin - // format not supported -> skip - errMsg := Pa_GetErrorText(err); - Log.LogError('Portaudio.InitializeRecord, device: "'+ deviceName +'" ' - + '('+ errMsg +')'); - paSoundCard.Free(); - continue; - end; - - // TODO: retry with mono if stereo is not supported - // TODO: retry with input-latency set to 20ms (defaultLowInputLatency might - // not be set correctly in OSS) - - err := Pa_OpenStream(stream, @inputParams, nil, sampleRate, - paFramesPerBufferUnspecified, paNoFlag, @MicrophoneCallback, nil); - if(err <> paNoError) then begin - // unable to open device -> skip - errMsg := Pa_GetErrorText(err); - Log.LogError('Portaudio.InitializeRecord, device: "'+ deviceName +'" ' - + '('+ errMsg +')'); - paSoundCard.Free(); - continue; - end; - - - {$IFDEF UsePortmixer} - - // use default mixer - mixer := Px_OpenMixer(stream, 0); - - // get input count - inputCnt := Px_GetNumInputSources(mixer); - SetLength(paSoundCard.Input, inputCnt); - - // get input names - for SCI := 0 to inputCnt-1 do - begin - inputName := Px_GetInputSourceName(mixer, SCI); - paSoundCard.Input[SCI].Name := inputName; - end; - - Px_CloseMixer(mixer); - - {$ELSE} // !UsePortmixer - - //Pa_StartStream(stream); - // TODO: check if callback was called (this problem may occur on some devices) - //Pa_StopStream(stream); - - Pa_CloseStream(stream); - - // create a standard input source - SetLength(paSoundCard.Input, 1); - paSoundCard.Input[0].Name := 'Standard'; - - {$ENDIF} - - // use default input source - paSoundCard.InputSelected := 0; - - Inc(SC); - end; - - // adjust size to actual input-device count - SetLength(Recording.SoundCard, SC); - - Log.LogStatus('#Soundcards: ' + inttostr(SC), 'Portaudio'); - - { - SoundCard[SC].InputSelected := Mic[Device]; - } -end; - -// TODO: code is used by all IAudioInput implementors -// -> move to a common superclass (TAudioInput_Generic?) -procedure TAudio_Portaudio.CaptureStart; -var - S: integer; - SC: integer; - PlayerLeft, PlayerRight: integer; - CaptureSoundLeft, CaptureSoundRight: TSound; -begin - for S := 0 to High(Recording.Sound) do - Recording.Sound[S].BufferLong[0].Clear; - - for SC := 0 to High(Ini.CardList) do begin - PlayerLeft := Ini.CardList[SC].ChannelL-1; - PlayerRight := Ini.CardList[SC].ChannelR-1; - if PlayerLeft >= PlayersPlay then PlayerLeft := -1; - if PlayerRight >= PlayersPlay then PlayerRight := -1; - if (PlayerLeft > -1) or (PlayerRight > -1) then begin - if (PlayerLeft > -1) then - CaptureSoundLeft := Recording.Sound[PlayerLeft] - else - CaptureSoundLeft := nil; - if (PlayerRight > -1) then - CaptureSoundRight := Recording.Sound[PlayerRight] - else - CaptureSoundRight := nil; - - CaptureCard(SC, CaptureSoundLeft, CaptureSoundRight); - end; - end; -end; - -// TODO: code is used by all IAudioInput implementors -// -> move to a common superclass (TAudioInput_Generic?) -procedure TAudio_Portaudio.CaptureStop; -var - SC: integer; - PlayerLeft: integer; - PlayerRight: integer; -begin - - for SC := 0 to High(Ini.CardList) do begin - PlayerLeft := Ini.CardList[SC].ChannelL-1; - PlayerRight := Ini.CardList[SC].ChannelR-1; - if PlayerLeft >= PlayersPlay then PlayerLeft := -1; - if PlayerRight >= PlayersPlay then PlayerRight := -1; - if (PlayerLeft > -1) or (PlayerRight > -1) then - StopCard(SC); - end; - -end; - -{* - * Portaudio input capture callback. - *} -function MicrophoneCallback(input: Pointer; output: Pointer; frameCount: Longword; - timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; - inputDevice: Pointer): Integer; cdecl; -begin - Recording.HandleMicrophoneData(input, frameCount*4, inputDevice); - result := paContinue; -end; - -{* - * Start input-capturing on Soundcard specified by Card. - * Params: - * Card - soundcard index in Recording.SoundCard array - * CaptureSoundLeft - sound(-buffer) used for left channel capture data - * CaptureSoundRight - sound(-buffer) used for right channel capture data - *} -procedure TAudio_Portaudio.CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); -var - Error: TPaError; - ErrorMsg: string; - inputParams: TPaStreamParameters; - deviceInfo: PPaDeviceInfo; - stream: PPaStream; - paSoundCard: TPortaudioSoundCard; -begin - paSoundCard := TPortaudioSoundCard(Recording.SoundCard[Card]); - paSoundCard.CaptureSoundLeft := CaptureSoundLeft; - paSoundCard.CaptureSoundRight := CaptureSoundRight; - - // get input latency info - deviceInfo := Pa_GetDeviceInfo(paSoundCard.DeviceIndex); - - // set input stream parameters - with inputParams do begin - device := paSoundCard.DeviceIndex; - channelCount := 2; - sampleFormat := paInt16; - suggestedLatency := deviceInfo^.defaultLowInputLatency; - hostApiSpecificStreamInfo := nil; - end; - - Log.LogStatus(inttostr(paSoundCard.DeviceIndex), 'Portaudio'); - Log.LogStatus(floattostr(deviceInfo^.defaultLowInputLatency), 'Portaudio'); - - // open input stream - Error := Pa_OpenStream(stream, @inputParams, nil, sampleRate, - paFramesPerBufferUnspecified, paNoFlag, - @MicrophoneCallback, Pointer(paSoundCard)); - if(Error <> paNoError) then begin - ErrorMsg := Pa_GetErrorText(Error); - Log.CriticalError('TAudio_Portaudio.CaptureCard('+ IntToStr(Card) +'): Error opening stream: ' + ErrorMsg); - //Halt; - end; - - paSoundCard.RecordStream := stream; - - // start capture - Error := Pa_StartStream(stream); - if(Error <> paNoError) then begin - Pa_CloseStream(stream); - ErrorMsg := Pa_GetErrorText(Error); - Log.CriticalError('TAudio_Portaudio.CaptureCard('+ IntToStr(Card) +'): Error starting stream: ' + ErrorMsg); - //Halt; - end; -end; - -{* - * Stop input-capturing on Soundcard specified by Card. - * Params: - * Card - soundcard index in Recording.SoundCard array - *} -procedure TAudio_Portaudio.StopCard(Card: byte); -var - stream: PPaStream; - paSoundCard: TPortaudioSoundCard; -begin - paSoundCard := TPortaudioSoundCard(Recording.SoundCard[Card]); - stream := paSoundCard.RecordStream; - if(stream <> nil) then begin - Pa_StopStream(stream); - Pa_CloseStream(stream); - end; -end; - - -initialization - singleton_MusicPortaudio := TAudio_Portaudio.create(); - AudioManager.add( singleton_MusicPortaudio ); - -finalization - AudioManager.Remove( singleton_MusicPortaudio ); - -end. diff --git a/Game/Code/Classes/UMedia_dummy.pas b/Game/Code/Classes/UMedia_dummy.pas index 52e3434e..c973512d 100644 --- a/Game/Code/Classes/UMedia_dummy.pas +++ b/Game/Code/Classes/UMedia_dummy.pas @@ -45,8 +45,8 @@ type procedure Pause; procedure Stop; - procedure MoveTo(Time: real); - function getPosition: real; + procedure SetPosition(Time: real); + function GetPosition: real; procedure GetFrame(Time: Extended); procedure DrawGL(Screen: integer); @@ -82,8 +82,6 @@ type procedure PlayShuffle; procedure StopShuffle; - function LoadSoundFromFile(var stream: TAudioOutputStream; Name: string): boolean; - function LoadCustomSound(const Filename: String): Cardinal; procedure PlayCustomSound(const Index: Cardinal ); @@ -135,7 +133,7 @@ procedure Tmedia_dummy.Stop; begin end; -procedure Tmedia_dummy.MoveTo(Time: real); +procedure Tmedia_dummy.SetPosition(Time: real); begin end; @@ -251,11 +249,6 @@ procedure Tmedia_dummy.StopShuffle; begin end; -function Tmedia_dummy.LoadSoundFromFile(var stream: TAudioOutputStream; Name: string): boolean; -begin - result := false; -end; - function Tmedia_dummy.LoadCustomSound(const Filename: String): Cardinal; begin result := 0; diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index c2d616ec..bf366130 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -83,17 +83,72 @@ type Source: array of string; end; +type TFFTData = array[0..256] of Single; TPCMStereoSample = array[0..1] of Smallint; TPCMData = array[0..511] of TPCMStereoSample; - TAudioOutputStream = class +type + TStreamStatus = (sStopped, sPlaying, sPaused); +const + StreamStatusStr: array[TStreamStatus] of string = ('Stopped', 'Playing', 'Paused'); + +type + TAudioProcessingStream = class + public + procedure Close(); virtual; abstract; + end; + + TAudioPlaybackStream = class(TAudioProcessingStream) + protected + function GetLoop(): boolean; virtual; abstract; + procedure SetLoop(Enabled: boolean); virtual; abstract; + function GetLength(): real; virtual; abstract; + function GetStatus(): TStreamStatus; virtual; abstract; + public + procedure Play(); virtual; abstract; + procedure Pause(); virtual; abstract; + procedure Stop(); virtual; abstract; + + property Loop: boolean READ GetLoop WRITE SetLoop; + property Length: real READ GetLength; + property Status: TStreamStatus READ GetStatus; end; + (* + TAudioMixerStream = class(TAudioProcessingStream) + procedure AddStream(stream: TAudioProcessingStream); + procedure RemoveStream(stream: TAudioProcessingStream); + procedure SetMasterVolume(volume: cardinal); + function GetMasterVolume(): cardinal; + procedure SetStreamVolume(stream: TAudioProcessingStream; volume: cardinal); + function GetStreamVolume(stream: TAudioProcessingStream): cardinal; + end; + *) + + TAudioDecodeStream = class(TAudioProcessingStream) + protected + function GetLength(): real; virtual; abstract; + function GetChannelCount(): cardinal; virtual; abstract; + function GetSampleRate(): cardinal; virtual; abstract; + function GetPosition(): real; virtual; abstract; + procedure SetPosition(Time: real); virtual; abstract; + function IsEOF(): boolean; virtual; abstract; + public + function ReadData(Buffer: PChar; BufSize: integer): integer; virtual; abstract; + + property Length: real READ GetLength; + property ChannelCount: cardinal READ GetChannelCount; + property SampleRate: cardinal READ GetSampleRate; + property Position: real READ GetPosition WRITE SetPosition; + property EOF: boolean READ IsEOF; + end; + +type TCustomSoundEntry = record Filename : String; - Stream : TAudioOutputStream; + Stream : TAudioPlaybackStream; end; type @@ -101,23 +156,23 @@ type ['{63A5EBC3-3F4D-4F23-8DFB-B5165FCE33DD}'] function GetName: String; - function Open(Name: string): boolean; // true if succeed + function Open(Filename: string): boolean; // true if succeed procedure Close; procedure Play; procedure Pause; procedure Stop; - procedure MoveTo(Time: real); - function getPosition: real; - - property position : real READ getPosition WRITE MoveTo; + procedure SetPosition(Time: real); + function GetPosition: real; + + property Position : real READ GetPosition WRITE SetPosition; end; IVideoPlayback = Interface( IGenericPlayback ) ['{3574C40C-28AE-4201-B3D1-3D1F0759B131}'] procedure init(); - + procedure GetFrame(Time: Extended); // WANT TO RENAME THESE TO BE MORE GENERIC procedure DrawGL(Screen: integer); // WANT TO RENAME THESE TO BE MORE GENERIC @@ -150,9 +205,6 @@ type procedure PlayShuffle; procedure StopShuffle; - // TODO - //function LoadSoundFromFile(var stream: TAudioOutputStream; Name: string): boolean; - //Custom Sounds function LoadCustomSound(const Filename: String): Cardinal; procedure PlayCustomSound(const Index: Cardinal ); @@ -164,6 +216,24 @@ type function GetPCMData(var data: TPCMData): Cardinal; end; + IGenericDecoder = Interface + ['{557B0E9A-604D-47E4-B826-13769F3E10B7}'] + function InitializeDecoder(): boolean; + //function IsSupported(const Filename: string): boolean; + end; + + (* + IVideoDecoder = Interface( IGenericDecoder ) + ['{2F184B2B-FE69-44D5-9031-0A2462391DCA}'] + function Open(const Filename: string): TVideoDecodeStream; + end; + *) + + IAudioDecoder = Interface( IGenericDecoder ) + ['{AB47B1B6-2AA9-4410-BF8C-EC79561B5478}'] + function Open(const Filename: string): TAudioDecodeStream; + end; + IAudioInput = Interface ['{A5C8DA92-2A0C-4AB2-849B-2F7448C6003A}'] function GetName: String; @@ -191,6 +261,7 @@ function Visualization(): IVideoPlayback; function VideoPlayback(): IVideoPlayback; function AudioPlayback(): IAudioPlayback; function AudioInput(): IAudioInput; +function AudioDecoder(): IAudioDecoder; function AudioManager: TInterfaceList; @@ -207,6 +278,7 @@ var singleton_Visualization : IVideoPlayback = nil; singleton_AudioPlayback : IAudioPlayback = nil; singleton_AudioInput : IAudioInput = nil; + singleton_AudioDecoder : IAudioDecoder = nil; singleton_AudioManager : TInterfaceList = nil; @@ -240,6 +312,11 @@ begin result := singleton_AudioInput; end; +function AudioDecoder(): IAudioDecoder; +begin + result := singleton_AudioDecoder; +end; + procedure InitializeSound; var lTmpInterface : IInterface; @@ -249,6 +326,7 @@ begin singleton_AudioPlayback := nil; singleton_AudioInput := nil; + singleton_AudioDecoder := nil; singleton_VideoPlayback := nil; singleton_Visualization := nil; @@ -271,6 +349,13 @@ begin singleton_AudioInput := IAudioInput( lTmpInterface ); end; + // if this interface is a Decoder, then set it as the default used + if ( AudioManager[iCount].QueryInterface( IAudioDecoder, lTmpInterface ) = 0 ) AND + ( true ) then + begin + singleton_AudioDecoder := IAudioDecoder( lTmpInterface ); + end; + // if this interface is a Input, then set it as the default used if ( AudioManager[iCount].QueryInterface( IVideoPlayback, lTmpInterface ) = 0 ) AND ( true ) then @@ -293,6 +378,11 @@ begin begin end; + if AudioDecoder <> nil then + begin + AudioDecoder.InitializeDecoder; + end; + if AudioPlayback <> nil then begin AudioPlayback.InitializePlayback; diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index 4f6b566a..bbd03d84 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -45,9 +45,11 @@ uses SDL, dialogs, {$endif} {$ENDIF} + (* FIXME {$ifdef UseFFMpegAudio} - UAudio_FFMpeg, + UAudioDecoder_FFMpeg, {$endif} + *) UIni, UMusic, UGraphic; @@ -101,8 +103,8 @@ type procedure Pause; procedure Stop; - procedure MoveTo(Time: real); - function getPosition: real; + procedure SetPosition(Time: real); + function GetPosition: real; procedure GetFrame(Time: Extended); procedure DrawGL(Screen: integer); @@ -626,7 +628,7 @@ procedure TVideoPlayback_ffmpeg.Stop; begin end; -procedure TVideoPlayback_ffmpeg.MoveTo(Time: real); +procedure TVideoPlayback_ffmpeg.SetPosition(Time: real); begin fVideoSkipTime := Time; @@ -639,7 +641,7 @@ begin end; // what is this supposed to do? return VideoTime? -function TVideoPlayback_ffmpeg.getPosition: real; +function TVideoPlayback_ffmpeg.GetPosition: real; begin result := 0; end; diff --git a/Game/Code/Classes/UVisualizer.pas b/Game/Code/Classes/UVisualizer.pas index 5fc4bb82..22c168a2 100644 --- a/Game/Code/Classes/UVisualizer.pas +++ b/Game/Code/Classes/UVisualizer.pas @@ -61,9 +61,7 @@ type VisualTex : glUint; PCMData : TPCMData; - hRC : Integer; - hDC : Integer; - + RndPCMcount : integer; projMatrix: array[0..3, 0..3] of GLdouble; @@ -91,8 +89,8 @@ type procedure Pause; procedure Stop; - procedure MoveTo(Time: real); - function getPosition: real; + procedure SetPosition(Time: real); + function GetPosition: real; procedure GetFrame(Time: Extended); procedure DrawGL(Screen: integer); @@ -150,12 +148,12 @@ begin VisualizerStop(); end; -procedure TVideoPlayback_ProjectM.MoveTo(Time: real); +procedure TVideoPlayback_ProjectM.SetPosition(Time: real); begin pm.RandomPreset(); end; -function TVideoPlayback_ProjectM.getPosition: real; +function TVideoPlayback_ProjectM.GetPosition: real; begin result := 0; end; @@ -240,7 +238,6 @@ end; procedure TVideoPlayback_ProjectM.GetFrame(Time: Extended); var - i: integer; nSamples: cardinal; stackDepth: Integer; begin @@ -269,7 +266,7 @@ begin // this may happen with some presets ( on linux ) if there is a div by zero // in projectM's getBeatVals() function (file: beat_detect.cc) Log.LogStatus('Div by zero!', 'Visualizer'); - MoveTo( now ); + SetPosition( now ); end; //glGetIntegerv(GL_PROJECTION_STACK_DEPTH, @stackDepth); diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index b15c5bbf..236d0b1e 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -21,7 +21,7 @@ uses {$ifdef UseBass} bass in 'lib\bass\delphi\bass.pas', {$endif} - {$ifdef UsePortAudio} + {$ifdef UsePortaudio} portaudio in 'lib\portaudio\delphi\portaudio.pas', {$endif} {$ifdef UsePortmixer} @@ -47,6 +47,7 @@ uses rational in 'lib\ffmpeg\rational.pas', opt in 'lib\ffmpeg\opt.pas', avio in 'lib\ffmpeg\avio.pas', + mathematics in 'lib\ffmpeg\mathematics.pas', // swscale in 'lib\ffmpeg\swscale.pas', {$ifdef UseProjectM_0_9} @@ -142,14 +143,20 @@ uses UVisualizer in 'Classes\UVisualizer.pas', // MUST be before Video... so video can override... {$ENDIF} UVideo in 'Classes\UVideo.pas', -{$ifdef UseBass} - UAudio_bass in 'Classes\UAudio_bass.pas', +{$ifdef UseFFMpegDecoder} + UAudioDecoder_FFMpeg in 'Classes\UAudioDecoder_FFMpeg.pas', // MUST be before Playback-classes {$endif} -{$ifdef UsePortaudio} - UAudio_portaudio in 'Classes\UAudio_portaudio.pas', +{$ifdef UseBASSInput} + UAudioInput_Bass in 'Classes\UAudioInput_Bass.pas', {$endif} -{$ifdef UseFFMpegAudio} - UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas', +{$ifdef UseBASSPlayback} + UAudioPlayback_Bass in 'Classes\UAudioPlayback_Bass.pas', +{$endif} +{$ifdef UsePortaudioInput} + UAudioInput_Portaudio in 'Classes\UAudioInput_Portaudio.pas', +{$endif} +{$ifdef UsePortaudioPlayback} + UAudioPlayback_Portaudio in 'Classes\UAudioPlayback_Portaudio.pas', {$endif} diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index 84aebbf5..3980a801 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -1,62 +1,69 @@ -{$DEFINE DEBUG} // to-do : Remove b4 release - -// Comment by eddie: -// The mac port currently also uses the WIN32 define. -// Once I get the beast compiled, linked and running -// I will change this. -// There are some parts where the WIN32 define could not -// be used. I changed the WIN32 to MSWINDOWS. -// So, for Windows-only code use the MSWINDOWS define. - - -{$IFDEF FPC} - {$IFDEF DARWIN} - {$H+} - {$R-} - {$DEFINE WIN32} - {$DEFINE TRANSLATE} - {$ELSE} - {$DEFINE LAZARUS} - {$ENDIF} - -// {$MODE DELPHI} // JB - This is not allowed by the free pascal compiler for some reason ( At least on linux ) - - {$DEFINE DLL_CDECL} - {$UNDEF UseSerialPort} - {$UNDEF UseMIDIPort} -{$ELSE} - {$DEFINE Delphi} - {$DEFINE DLL_STDCALL} - {$UNDEF UseSerialPort} - {$DEFINE UseMIDIPort} -{$ENDIF} - - -{$IFDEF win32} - {$DEFINE UseBASSOutput} - {$DEFINE UseBASSInput} - - //{$DEFINE UsePortaudio} - //{$DEFINE UsePortmixer} - - {$DEFINE UseProjectM_0_9} - - {$IFDEF DEBUG} - {$IFNDEF DARWIN} - {$APPTYPE CONSOLE} - {$ENDIF} - {$ENDIF} -{$ELSE} - //{$DEFINE FFMpegAudio} -// {$DEFINE UsePortaudio} - {$DEFINE UseProjectM_0_9} -{$ENDIF} - -{$IF Defined(UseBASSInput) or Defined(UseBASSOutput)} - {$DEFINE UseBASS} -{$IFEND} - -{$IF Defined(UseProjectM_0_9) or Defined(UseProjectM_1_0)} - {$DEFINE UseProjectM} -{$IFEND} - +{$DEFINE DEBUG} // to-do : Remove b4 release + +// Comment by eddie: +// The mac port currently also uses the WIN32 define. +// Once I get the beast compiled, linked and running +// I will change this. +// There are some parts where the WIN32 define could not +// be used. I changed the WIN32 to MSWINDOWS. +// So, for Windows-only code use the MSWINDOWS define. + + +{$IFDEF FPC} + {$IFDEF DARWIN} + {$H+} + {$R-} + {$DEFINE WIN32} + {$DEFINE TRANSLATE} + {$ELSE} + {$DEFINE LAZARUS} + {$ENDIF} + +// {$MODE DELPHI} // JB - This is not allowed by the free pascal compiler for some reason ( At least on linux ) + + {$DEFINE DLL_CDECL} + {$UNDEF UseSerialPort} + {$UNDEF UseMIDIPort} +{$ELSE} + {$DEFINE Delphi} + {$DEFINE DLL_STDCALL} + {$UNDEF UseSerialPort} + {$DEFINE UseMIDIPort} +{$ENDIF} + + +{$IFDEF win32} + {$DEFINE UseBASSPlayback} + {$DEFINE UseBASSInput} + + //{$DEFINE UseFFMpegDecoder} + //{$DEFINE UsePortaudioPlayback} + //{$DEFINE UsePortaudioInput} + //{$DEFINE UsePortmixer} + + {$DEFINE UseProjectM_0_9} + //{$DEFINE UseProjectM_1_0} + + {$IFDEF DEBUG} + {$IFNDEF DARWIN} + {$APPTYPE CONSOLE} + {$ENDIF} + {$ENDIF} +{$ELSE} + {$DEFINE UseFFMpegAudio} + {$DEFINE UsePortaudio} + {$DEFINE UseProjectM_0_9} +{$ENDIF} + +{$IF Defined(UseBASSInput) or Defined(UseBASSPlayback)} + {$DEFINE UseBASS} +{$IFEND} + +{$IF Defined(UsePortaudioInput) or Defined(UsePortaudioPlayback)} + {$DEFINE UsePortaudio} +{$IFEND} + +{$IF Defined(UseProjectM_0_9) or Defined(UseProjectM_1_0)} + {$DEFINE UseProjectM} +{$IFEND} + -- cgit v1.2.3 From fa4f747ca8b83247981e89ec83b21d8f6a7ffa84 Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 11 Jan 2008 18:06:15 +0000 Subject: SDL_Init(SDL_INIT_AUDIO) prevents Portaudio from acquiring the soundcard (no sound). Use SDL_Init_Subsystem(SDL_INIT_AUDIO) if SDL is used instead of Portaudio for audio output. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@787 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMain.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 7c3ad9d4..e2e0eaa0 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -174,7 +174,7 @@ begin // SDL Log.BenchmarkStart(1); Log.LogStatus('Initialize SDL', 'Initialization'); - SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO); + SDL_Init(SDL_INIT_VIDEO); Log.BenchmarkEnd(1); Log.LogBenchmark('Initializing SDL', 1); -- cgit v1.2.3 From 79c5b96f49412541efdd51bca62ce5912b864c08 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Fri, 11 Jan 2008 20:56:16 +0000 Subject: Fixed compiling and typos on OS X. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@788 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/MacOSX/UltraStarDX.pas | 2 +- .../MacOSX/UltraStarDX.xcodeproj/eddie.mode1v3 | 221 ++++++++++++++++++--- .../MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser | 181 ++++++++++++----- .../MacOSX/UltraStarDX.xcodeproj/project.pbxproj | 74 ++++--- Game/Code/lib/ffmpeg/version.inc | 2 +- 5 files changed, 365 insertions(+), 115 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/MacOSX/UltraStarDX.pas b/Game/Code/MacOSX/UltraStarDX.pas index 59a0880f..5e75ccf9 100644 --- a/Game/Code/MacOSX/UltraStarDX.pas +++ b/Game/Code/MacOSX/UltraStarDX.pas @@ -1,6 +1,6 @@ program UltraStarDX; -uses cthreads, UMain, UMedia_dummy, UAudio_bass, USingNotes, UTextClasses, UVideo; +uses cthreads, UMain, UMedia_dummy, UAudioPlayback_Bass, UAudioInput_Bass, USingNotes, UTextClasses, UVideo; begin Main; diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1v3 b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1v3 index 1039e4c9..05251214 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1v3 +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1v3 @@ -196,6 +196,166 @@ OpenEditors + + Content + + PBXProjectModuleGUID + 2CAC2C100D380F1200CA518A + PBXProjectModuleLabel + URecord.pas + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 2CAC2C110D380F1200CA518A + PBXProjectModuleLabel + URecord.pas + _historyCapacity + 0 + bookmark + 2CAC2C120D380F1200CA518A + history + + 2CAC2C0F0D380E8700CA518A + + + SplitCount + 1 + + StatusBarVisibility + + + Geometry + + Frame + {{0, 20}, {797, 748}} + PBXModuleWindowStatusBarHidden2 + + RubberWindowFrame + 130 129 797 789 0 0 1680 1028 + + + + Content + + PBXProjectModuleGUID + 2CAC2C000D380C5700CA518A + PBXProjectModuleLabel + UAudioInput_Bass.pas + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 2CAC2C010D380C5700CA518A + PBXProjectModuleLabel + UAudioInput_Bass.pas + _historyCapacity + 0 + bookmark + 2CAC2C140D380F1200CA518A + history + + 2CAC2C130D380F1200CA518A + + + SplitCount + 1 + + StatusBarVisibility + + + Geometry + + Frame + {{0, 20}, {874, 786}} + PBXModuleWindowStatusBarHidden2 + + RubberWindowFrame + 15 196 874 827 0 0 1680 1028 + + + + Content + + PBXProjectModuleGUID + 2C36B5C30D358BF100E8D797 + PBXProjectModuleLabel + UltraStarDX.pas + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 2C36B5C40D358BF100E8D797 + PBXProjectModuleLabel + UltraStarDX.pas + _historyCapacity + 0 + bookmark + 2CAC2C150D380F1200CA518A + history + + 2CAC2C030D380C5700CA518A + + + SplitCount + 1 + + StatusBarVisibility + + + Geometry + + Frame + {{0, 20}, {987, 762}} + PBXModuleWindowStatusBarHidden2 + + RubberWindowFrame + 311 168 987 803 0 0 1680 1028 + + + + Content + + PBXProjectModuleGUID + 2C36B5750D3585ED00E8D797 + PBXProjectModuleLabel + UScreenSing.pas + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 2C36B5760D3585ED00E8D797 + PBXProjectModuleLabel + UScreenSing.pas + _historyCapacity + 0 + bookmark + 2CAC2C160D380F1200CA518A + history + + 2C36B5E20D358CFB00E8D797 + + + SplitCount + 1 + + StatusBarVisibility + + + Geometry + + Frame + {{0, 20}, {754, 847}} + PBXModuleWindowStatusBarHidden2 + + RubberWindowFrame + 38 134 754 888 0 0 1680 1028 + + Content @@ -214,10 +374,10 @@ _historyCapacity 0 bookmark - 2C07C94F0D3582C9002A4079 + 2CAC2C170D380F1200CA518A history - 2C5A59420D35813800DCBB8F + 2C36B5E30D358CFB00E8D797 SplitCount @@ -306,22 +466,21 @@ PBXSmartGroupTreeModuleOutlineStateExpansionKey DDC6850D09F5717A004E4BFF + 2C4D9D980CC9EE0B0031092D DD7C45450A6E72DE003FA52B 2CF5510C0CDA28F000627463 - 1C37FBAC04509CD000000102 1C37FAAC04509CD000000102 PBXSmartGroupTreeModuleOutlineStateSelectionKey - 18 + 23 15 - 14 0 PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 0}, {266, 694}} + {{0, 88}, {266, 694}} PBXTopSmartGroupGIDs @@ -423,9 +582,9 @@ TableOfContents - 2C07C9450D3582BA002A4079 + 2CAC2BC40D3808A200CA518A 1CE0B1FE06471DED0097A5F4 - 2C07C9460D3582BA002A4079 + 2CAC2BC50D3808A200CA518A 1CE0B20306471E060097A5F4 1CE0B20506471E060097A5F4 @@ -557,9 +716,15 @@ 5 WindowOrderList + 1C78EAAD065D492600B07095 1CD10A99069EF8BA00B06720 2C5A593F0D35811F00DCBB8F + 2C36B5750D3585ED00E8D797 + 2C36B5C30D358BF100E8D797 + 2C65660B0CF2236C0041F7DC + 2CAC2C000D380C5700CA518A /Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj + 2CAC2C100D380F1200CA518A WindowString 799 242 817 753 0 0 1680 1028 @@ -583,7 +748,7 @@ PBXProjectModuleGUID 1CD0528F0623707200166675 PBXProjectModuleLabel - UFiles.pas + version.inc StatusBarVisibility
@@ -641,7 +806,7 @@ TableOfContents 2C65660B0CF2236C0041F7DC - 2C5A58BA0D3573FD00DCBB8F + 2CAC2BCC0D38094900CA518A 1CD0528F0623707200166675 XCMainBuildResultsModuleGUID @@ -652,7 +817,7 @@ WindowToolGUID 2C65660B0CF2236C0041F7DC WindowToolIsVisible - +
FirstTimeWindowDisplayed @@ -761,13 +926,13 @@ TableOfContents 1CD10A99069EF8BA00B06720 - 2C07C9480D3582BA002A4079 + 2CAC2C070D380C5700CA518A 1C162984064C10D400B95A72 - 2C07C9490D3582BA002A4079 - 2C07C94A0D3582BA002A4079 - 2C07C94B0D3582BA002A4079 - 2C07C94C0D3582BA002A4079 - 2C07C94D0D3582BA002A4079 + 2CAC2C080D380C5700CA518A + 2CAC2C090D380C5700CA518A + 2CAC2C0A0D380C5700CA518A + 2CAC2C0B0D380C5700CA518A + 2CAC2C0C0D380C5700CA518A ToolbarConfiguration xcode.toolbar.config.debugV3 @@ -776,7 +941,7 @@ WindowToolGUID 1CD10A99069EF8BA00B06720 WindowToolIsVisible - + FirstTimeWindowDisplayed @@ -794,12 +959,14 @@ Dock + BecomeActive + ContentConfiguration PBXProjectModuleGUID 1CDD528C0622207200134675 PBXProjectModuleLabel - avformat.pas + UAudio_bass.pas StatusBarVisibility @@ -820,8 +987,6 @@ 502pt - BecomeActive - ContentConfiguration PBXProjectModuleGUID @@ -857,8 +1022,8 @@ TableOfContents 1C530D57069F1CE1000CFCEE - 2CE907AC0D1BC9A200A1FDFF - 2CE907AD0D1BC9A200A1FDFF + 2C36B5940D3587D000E8D797 + 2C36B5950D3587D000E8D797 1CDD528C0622207200134675 1CD0528E0623707200166675 @@ -888,8 +1053,6 @@ Dock - BecomeActive - ContentConfiguration PBXProjectModuleGUID @@ -902,7 +1065,7 @@ Frame {{0, 0}, {779, 729}} RubberWindowFrame - 890 238 779 770 0 0 1680 1028 + 886 204 779 770 0 0 1680 1028 Module PBXDebugCLIModule @@ -925,17 +1088,17 @@ TableOfContents 1C78EAAD065D492600B07095 - 2C5A58BB0D3573FD00DCBB8F + 2CAC2C0D0D380C5700CA518A 1C78EAAC065D492600B07095 ToolbarConfiguration xcode.toolbar.config.consoleV3 WindowString - 890 238 779 770 0 0 1680 1028 + 886 204 779 770 0 0 1680 1028 WindowToolGUID 1C78EAAD065D492600B07095 WindowToolIsVisible - + Identifier diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser index 7e214ce3..65a02a81 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser @@ -1,6 +1,16 @@ // !$*UTF8*$! { - 2C07C94F0D3582C9002A4079 /* PBXTextBookmark */ = { + 2C36B5E20D358CFB00E8D797 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2CF54F5C0CDA1B2B00627463 /* UScreenSing.pas */; + name = "UScreenSing.pas: 321"; + rLen = 0; + rLoc = 8497; + rType = 0; + vrLen = 1569; + vrLoc = 7617; + }; + 2C36B5E30D358CFB00E8D797 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 2C4D9C720CC9EC8C0031092D /* UIni.pas */; name = "UIni.pas: 177"; @@ -27,14 +37,6 @@ sepNavWindowFrame = "{{38, 157}, {797, 845}}"; }; }; - 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {884, 9100}}"; - sepNavSelRange = "{16714, 12}"; - sepNavVisRect = "{{0, 8384}, {758, 716}}"; - sepNavWindowFrame = "{{15, 178}, {797, 845}}"; - }; - }; 2C4D9C650CC9EC8C0031092D /* UCatCovers.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {923, 2128}}"; @@ -203,9 +205,9 @@ }; 2C4D9C7A0CC9EC8C0031092D /* ULyrics.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {881, 10346}}"; - sepNavSelRange = "{8686, 66}"; - sepNavVisRange = "{8126, 1127}"; + sepNavIntBoundsRect = "{{0, 0}, {1208, 10584}}"; + sepNavSelRange = "{6025, 1}"; + sepNavVisRange = "{5645, 705}"; sepNavVisRect = "{{0, 4395}, {758, 716}}"; sepNavWindowFrame = "{{61, 136}, {797, 845}}"; }; @@ -221,8 +223,9 @@ }; 2C4D9C7C0CC9EC8C0031092D /* UMedia_dummy.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {749, 3920}}"; - sepNavSelRange = "{4805, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {738, 3864}}"; + sepNavSelRange = "{960, 0}"; + sepNavVisRange = "{4488, 788}"; sepNavVisRect = "{{0, 1071}, {749, 470}}"; sepNavWindowFrame = "{{107, 94}, {797, 845}}"; }; @@ -278,8 +281,9 @@ }; 2C4D9C840CC9EC8C0031092D /* URecord.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {758, 5194}}"; - sepNavSelRange = "{7340, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {738, 4046}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{0, 1755}"; sepNavVisRect = "{{0, 4312}, {758, 716}}"; sepNavWindowFrame = "{{130, 73}, {797, 845}}"; }; @@ -369,14 +373,6 @@ sepNavWindowFrame = "{{15, 178}, {797, 845}}"; }; }; - 2C4D9D8D0CC9ED230031092D /* Bass.pas */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1358, 13790}}"; - sepNavSelRange = "{51143, 0}"; - sepNavVisRect = "{{0, 10534}, {715, 815}}"; - sepNavWindowFrame = "{{38, 58}, {754, 944}}"; - }; - }; 2C4D9D900CC9ED4F0031092D /* FreeBitmap.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {974, 24374}}"; @@ -395,9 +391,9 @@ }; 2C4D9DCC0CC9EE6F0031092D /* UDisplay.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {842, 6650}}"; - sepNavSelRange = "{7897, 0}"; - sepNavVisRange = "{7979, 593}"; + sepNavIntBoundsRect = "{{0, 0}, {764, 6454}}"; + sepNavSelRange = "{7920, 10}"; + sepNavVisRange = "{7458, 890}"; sepNavVisRect = "{{0, 4834}, {758, 716}}"; sepNavWindowFrame = "{{38, 157}, {797, 845}}"; }; @@ -531,16 +527,6 @@ sepNavVisRange = "{0, 1181}"; }; }; - 2C5A59420D35813800DCBB8F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C720CC9EC8C0031092D /* UIni.pas */; - name = "UIni.pas: 177"; - rLen = 0; - rLoc = 5110; - rType = 0; - vrLen = 1173; - vrLoc = 4819; - }; 2C8937290CE393FB005D8A87 /* UPlatform.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {776, 1638}}"; @@ -559,6 +545,88 @@ sepNavWindowFrame = "{{79, 54}, {776, 956}}"; }; }; + 2CAC2BDD0D3809F500CA518A /* UAudioInput_Bass.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {815, 4018}}"; + sepNavSelRange = "{2733, 0}"; + sepNavVisRange = "{5615, 1821}"; + sepNavWindowFrame = "{{15, 140}, {874, 883}}"; + }; + }; + 2CAC2C030D380C5700CA518A /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; + name = "UltraStarDX.pas: 4"; + rLen = 0; + rLoc = 131; + rType = 0; + vrLen = 126; + vrLoc = 0; + }; + 2CAC2C0F0D380E8700CA518A /* PBXBookmark */ = { + isa = PBXBookmark; + fRef = 2C4D9C840CC9EC8C0031092D /* URecord.pas */; + }; + 2CAC2C120D380F1200CA518A /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C840CC9EC8C0031092D /* URecord.pas */; + name = "URecord.pas: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1755; + vrLoc = 0; + }; + 2CAC2C130D380F1200CA518A /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2CAC2BDD0D3809F500CA518A /* UAudioInput_Bass.pas */; + name = "UAudioInput_Bass.pas: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1426; + vrLoc = 2083; + }; + 2CAC2C140D380F1200CA518A /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2CAC2BDD0D3809F500CA518A /* UAudioInput_Bass.pas */; + name = "UAudioInput_Bass.pas: 131"; + rLen = 0; + rLoc = 2733; + rType = 0; + vrLen = 1821; + vrLoc = 5615; + }; + 2CAC2C150D380F1200CA518A /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; + name = "UltraStarDX.pas: 3"; + rLen = 0; + rLoc = 72; + rType = 0; + vrLen = 152; + vrLoc = 0; + }; + 2CAC2C160D380F1200CA518A /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2CF54F5C0CDA1B2B00627463 /* UScreenSing.pas */; + name = "UScreenSing.pas: 320"; + rLen = 0; + rLoc = 8497; + rType = 0; + vrLen = 1601; + vrLoc = 7561; + }; + 2CAC2C170D380F1200CA518A /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C720CC9EC8C0031092D /* UIni.pas */; + name = "UIni.pas: 177"; + rLen = 0; + rLoc = 5110; + rType = 0; + vrLen = 1173; + vrLoc = 4819; + }; 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1013, 1022}}"; @@ -851,11 +919,11 @@ }; 2CF54F5C0CDA1B2B00627463 /* UScreenSing.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {920, 19586}}"; - sepNavSelRange = "{12838, 0}"; - sepNavVisRange = "{12982, 724}"; + sepNavIntBoundsRect = "{{0, 0}, {695, 19880}}"; + sepNavSelRange = "{8497, 0}"; + sepNavVisRange = "{7561, 1601}"; sepNavVisRect = "{{0, 0}, {715, 815}}"; - sepNavWindowFrame = "{{38, 58}, {754, 944}}"; + sepNavWindowFrame = "{{38, 78}, {754, 944}}"; }; }; 2CF54F5D0CDA1B2B00627463 /* UScreenSingModi.pas */ = { @@ -868,9 +936,9 @@ }; 2CF54F5E0CDA1B2B00627463 /* UScreenSong.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1112, 30352}}"; - sepNavSelRange = "{25430, 0}"; - sepNavVisRange = "{24530, 2449}"; + sepNavIntBoundsRect = "{{0, 0}, {842, 31486}}"; + sepNavSelRange = "{54304, 0}"; + sepNavVisRange = "{53982, 735}"; sepNavVisRect = "{{0, 11219}, {1277, 312}}"; sepNavWindowFrame = "{{38, 78}, {754, 944}}"; }; @@ -1023,11 +1091,12 @@ }; DDC6850F09F5717A004E4BFF /* Project object */ = { activeArchitecture = i386; - activeBuildConfigurationName = Debug; + activeBuildConfigurationName = Release; activeExecutable = 2CDD4B5D0CB9354800549FAC /* UltraStarDX */; activeTarget = DDC688C709F574E9004E4BFF /* UltraStarDX */; addToTargets = ( DDC688C709F574E9004E4BFF /* UltraStarDX */, + DDC688D409F57523004E4BFF /* Put all program sources also in this target */, ); breakpoints = ( ); @@ -1158,12 +1227,20 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 221610651; - PBXWorkspaceStateSaveDate = 221610651; + PBXPerProjectTemplateStateSaveDate = 221776031; + PBXWorkspaceStateSaveDate = 221776031; }; perUserProjectItems = { - 2C07C94F0D3582C9002A4079 /* PBXTextBookmark */ = 2C07C94F0D3582C9002A4079 /* PBXTextBookmark */; - 2C5A59420D35813800DCBB8F /* PBXTextBookmark */ = 2C5A59420D35813800DCBB8F /* PBXTextBookmark */; + 2C36B5E20D358CFB00E8D797 /* PBXTextBookmark */ = 2C36B5E20D358CFB00E8D797 /* PBXTextBookmark */; + 2C36B5E30D358CFB00E8D797 /* PBXTextBookmark */ = 2C36B5E30D358CFB00E8D797 /* PBXTextBookmark */; + 2CAC2C030D380C5700CA518A /* PBXTextBookmark */ = 2CAC2C030D380C5700CA518A /* PBXTextBookmark */; + 2CAC2C0F0D380E8700CA518A /* PBXBookmark */ = 2CAC2C0F0D380E8700CA518A /* PBXBookmark */; + 2CAC2C120D380F1200CA518A /* PBXTextBookmark */ = 2CAC2C120D380F1200CA518A /* PBXTextBookmark */; + 2CAC2C130D380F1200CA518A /* PBXTextBookmark */ = 2CAC2C130D380F1200CA518A /* PBXTextBookmark */; + 2CAC2C140D380F1200CA518A /* PBXTextBookmark */ = 2CAC2C140D380F1200CA518A /* PBXTextBookmark */; + 2CAC2C150D380F1200CA518A /* PBXTextBookmark */ = 2CAC2C150D380F1200CA518A /* PBXTextBookmark */; + 2CAC2C160D380F1200CA518A /* PBXTextBookmark */ = 2CAC2C160D380F1200CA518A /* PBXTextBookmark */; + 2CAC2C170D380F1200CA518A /* PBXTextBookmark */ = 2CAC2C170D380F1200CA518A /* PBXTextBookmark */; }; sourceControlManager = 2CDD4B690CB9357000549FAC /* Source Control */; userBuildSettings = { @@ -1172,10 +1249,10 @@ DDC6851B09F57195004E4BFF /* UltraStarDX.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {928, 731}}"; - sepNavSelRange = "{58, 0}"; - sepNavVisRange = "{0, 126}"; + sepNavSelRange = "{72, 0}"; + sepNavVisRange = "{0, 152}"; sepNavVisRect = "{{0, 0}, {948, 730}}"; - sepNavWindowFrame = "{{558, 105}, {987, 859}}"; + sepNavWindowFrame = "{{311, 112}, {987, 859}}"; }; }; DDC6868B09F571C2004E4BFF /* Info.plist */ = { diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj index be2d67d4..fff4e14b 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj @@ -10,7 +10,6 @@ 2C4B70230CF7581000B0F0BD /* Until5000.dpr in Sources */ = {isa = PBXBuildFile; fileRef = 2C4B70220CF757A400B0F0BD /* Until5000.dpr */; }; 2C4B70240CF7584500B0F0BD /* ModiSDK.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF5508B0CDA22B000627463 /* ModiSDK.pas */; }; 2C4D9C8F0CC9EC8C0031092D /* TextGL.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C620CC9EC8C0031092D /* TextGL.pas */; }; - 2C4D9C900CC9EC8C0031092D /* UAudio_bass.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; }; 2C4D9C920CC9EC8C0031092D /* UCatCovers.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C650CC9EC8C0031092D /* UCatCovers.pas */; }; 2C4D9C930CC9EC8C0031092D /* UCommandLine.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C660CC9EC8C0031092D /* UCommandLine.pas */; }; 2C4D9C940CC9EC8C0031092D /* UCommon.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C670CC9EC8C0031092D /* UCommon.pas */; }; @@ -52,7 +51,6 @@ 2C4D9CBA0CC9EC8C0031092D /* UTime.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C8D0CC9EC8C0031092D /* UTime.pas */; }; 2C4D9CBB0CC9EC8C0031092D /* UVideo.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C8E0CC9EC8C0031092D /* UVideo.pas */; }; 2C4D9CBC0CC9EC8C0031092D /* TextGL.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C620CC9EC8C0031092D /* TextGL.pas */; }; - 2C4D9CBD0CC9EC8C0031092D /* UAudio_bass.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */; }; 2C4D9CBF0CC9EC8C0031092D /* UCatCovers.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C650CC9EC8C0031092D /* UCatCovers.pas */; }; 2C4D9CC00CC9EC8C0031092D /* UCommandLine.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C660CC9EC8C0031092D /* UCommandLine.pas */; }; 2C4D9CC10CC9EC8C0031092D /* UCommon.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C670CC9EC8C0031092D /* UCommon.pas */; }; @@ -93,9 +91,6 @@ 2C4D9CE60CC9EC8C0031092D /* UThemes.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C8C0CC9EC8C0031092D /* UThemes.pas */; }; 2C4D9CE70CC9EC8C0031092D /* UTime.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C8D0CC9EC8C0031092D /* UTime.pas */; }; 2C4D9CE80CC9EC8C0031092D /* UVideo.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9C8E0CC9EC8C0031092D /* UVideo.pas */; }; - 2C4D9CEA0CC9ECB50031092D /* libbass.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2C4D9CE90CC9ECB50031092D /* libbass.dylib */; }; - 2C4D9D8E0CC9ED230031092D /* Bass.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9D8D0CC9ED230031092D /* Bass.pas */; }; - 2C4D9D8F0CC9ED230031092D /* Bass.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9D8D0CC9ED230031092D /* Bass.pas */; }; 2C4D9D920CC9ED4F0031092D /* FreeBitmap.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9D900CC9ED4F0031092D /* FreeBitmap.pas */; }; 2C4D9D930CC9ED4F0031092D /* FreeImage.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9D910CC9ED4F0031092D /* FreeImage.pas */; }; 2C4D9D940CC9ED4F0031092D /* FreeBitmap.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D9D900CC9ED4F0031092D /* FreeBitmap.pas */; }; @@ -141,6 +136,14 @@ 2C89372B0CE393FB005D8A87 /* UPlatform.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C8937290CE393FB005D8A87 /* UPlatform.pas */; }; 2C8937340CE395CE005D8A87 /* UPlatformMacOSX.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */; }; 2C8937370CE395CE005D8A87 /* UPlatformMacOSX.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */; }; + 2CAC2BE20D3809F500CA518A /* UAudioInput_Bass.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CAC2BDD0D3809F500CA518A /* UAudioInput_Bass.pas */; }; + 2CAC2BE40D3809F500CA518A /* UAudioPlayback_Bass.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CAC2BDF0D3809F500CA518A /* UAudioPlayback_Bass.pas */; }; + 2CAC2BE70D3809F500CA518A /* UAudioInput_Bass.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CAC2BDD0D3809F500CA518A /* UAudioInput_Bass.pas */; }; + 2CAC2BE90D3809F500CA518A /* UAudioPlayback_Bass.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CAC2BDF0D3809F500CA518A /* UAudioPlayback_Bass.pas */; }; + 2CAC2BF10D380AC200CA518A /* libbass.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CAC2BF00D380AC200CA518A /* libbass.dylib */; }; + 2CAC2BF40D380AE800CA518A /* libbass.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2CAC2BF00D380AC200CA518A /* libbass.dylib */; }; + 2CAC2BF80D380B1B00CA518A /* Bass.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CAC2BF70D380B1B00CA518A /* Bass.pas */; }; + 2CAC2BF90D380B1B00CA518A /* Bass.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CAC2BF70D380B1B00CA518A /* Bass.pas */; }; 2CDC716C0CDB9CB70018F966 /* StrUtils.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */; }; 2CDC716D0CDB9CB70018F966 /* StrUtils.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */; }; 2CDD4BDE0CB947A400549FAC /* sdl.pas in Sources */ = {isa = PBXBuildFile; fileRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; }; @@ -257,7 +260,6 @@ 2CF553090CDA51B500627463 /* sdlutils.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF553070CDA51B500627463 /* sdlutils.pas */; }; 2CF553100CDA52D100627463 /* SDL_image.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2C4D9D980CC9EE0B0031092D /* SDL_image.framework */; }; 2CF5533B0CDA52E200627463 /* SDL_ttf.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2C4D9D990CC9EE0B0031092D /* SDL_ttf.framework */; }; - 2CF5533E0CDA530300627463 /* libbass.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2C4D9CE90CC9ECB50031092D /* libbass.dylib */; }; 2CF5533F0CDA531100627463 /* libfreeimage.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2C4D9D960CC9EDEB0031092D /* libfreeimage.dylib */; }; 2CF553400CDA531100627463 /* libsqlite3.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2CF5512C0CDA29C600627463 /* libsqlite3.dylib */; }; 2CF8E6BE0CDFA8E80053A996 /* UPartyDefs.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CF8E6BD0CDFA8E80053A996 /* UPartyDefs.pas */; }; @@ -340,12 +342,12 @@ dstPath = ""; dstSubfolderSpec = 6; files = ( + 2CAC2BF40D380AE800CA518A /* libbass.dylib in CopyFiles */, 2CE907990D1BC91D00A1FDFF /* libavformat.dylib in CopyFiles */, 2CE9079A0D1BC91D00A1FDFF /* libavutil.dylib in CopyFiles */, 2CE907980D1BC90A00A1FDFF /* libavcodec.dylib in CopyFiles */, 2CF5533F0CDA531100627463 /* libfreeimage.dylib in CopyFiles */, 2CF553400CDA531100627463 /* libsqlite3.dylib in CopyFiles */, - 2CF5533E0CDA530300627463 /* libbass.dylib in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -366,7 +368,6 @@ /* Begin PBXFileReference section */ 2C4B70220CF757A400B0F0BD /* Until5000.dpr */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; name = Until5000.dpr; path = ../../../Modis/5000Points/Until5000.dpr; sourceTree = SOURCE_ROOT; }; 2C4D9C620CC9EC8C0031092D /* TextGL.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = TextGL.pas; path = ../Classes/TextGL.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; - 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UAudio_bass.pas; path = ../Classes/UAudio_bass.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4D9C650CC9EC8C0031092D /* UCatCovers.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UCatCovers.pas; path = ../Classes/UCatCovers.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4D9C660CC9EC8C0031092D /* UCommandLine.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UCommandLine.pas; path = ../Classes/UCommandLine.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4D9C670CC9EC8C0031092D /* UCommon.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UCommon.pas; path = ../Classes/UCommon.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; @@ -407,8 +408,6 @@ 2C4D9C8C0CC9EC8C0031092D /* UThemes.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UThemes.pas; path = ../Classes/UThemes.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4D9C8D0CC9EC8C0031092D /* UTime.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UTime.pas; path = ../Classes/UTime.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4D9C8E0CC9EC8C0031092D /* UVideo.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UVideo.pas; path = ../Classes/UVideo.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; - 2C4D9CE90CC9ECB50031092D /* libbass.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbass.dylib; path = ../lib/bass/libbass.dylib; sourceTree = SOURCE_ROOT; }; - 2C4D9D8D0CC9ED230031092D /* Bass.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = Bass.pas; path = ../lib/bass/MacOSX/Bass.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4D9D900CC9ED4F0031092D /* FreeBitmap.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = FreeBitmap.pas; path = ../lib/FreeImage/FreeBitmap.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4D9D910CC9ED4F0031092D /* FreeImage.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = FreeImage.pas; path = ../lib/FreeImage/FreeImage.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2C4D9D960CC9EDEB0031092D /* libfreeimage.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libfreeimage.dylib; path = ../lib/FreeImage/libfreeimage.dylib; sourceTree = SOURCE_ROOT; }; @@ -435,6 +434,10 @@ 2C56642F0D35688200D4FF53 /* SDL.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = SDL.h; path = /Library/Frameworks/SDL.framework/Versions/A/Headers/SDL.h; sourceTree = ""; }; 2C8937290CE393FB005D8A87 /* UPlatform.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UPlatform.pas; path = ../Classes/UPlatform.pas; sourceTree = SOURCE_ROOT; }; 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; lineEnding = 0; name = UPlatformMacOSX.pas; path = ../Classes/UPlatformMacOSX.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 2CAC2BDD0D3809F500CA518A /* UAudioInput_Bass.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UAudioInput_Bass.pas; path = ../Classes/UAudioInput_Bass.pas; sourceTree = SOURCE_ROOT; }; + 2CAC2BDF0D3809F500CA518A /* UAudioPlayback_Bass.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UAudioPlayback_Bass.pas; path = ../Classes/UAudioPlayback_Bass.pas; sourceTree = SOURCE_ROOT; }; + 2CAC2BF00D380AC200CA518A /* libbass.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbass.dylib; path = ../lib/bass/libbass.dylib; sourceTree = SOURCE_ROOT; }; + 2CAC2BF70D380B1B00CA518A /* Bass.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = Bass.pas; path = ../lib/bass/MacOSX/Bass.pas; sourceTree = SOURCE_ROOT; }; 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = StrUtils.pas; path = ../../../Modis/SDK/StrUtils.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2CDEA4F60CBD725B0096994C /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; 2CE907900D1BC8A800A1FDFF /* libavcodec.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libavcodec.dylib; path = ../lib/ffmpeg/libavcodec.dylib; sourceTree = SOURCE_ROOT; }; @@ -492,7 +495,7 @@ 2CF552A40CDA42C900627463 /* opt.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = opt.pas; path = ../lib/ffmpeg/opt.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2CF552A50CDA42C900627463 /* rational.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = rational.pas; path = ../lib/ffmpeg/rational.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2CF553070CDA51B500627463 /* sdlutils.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = sdlutils.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL/sdlutils.pas"; sourceTree = ""; tabWidth = 2; }; - 2CF77DB60CF7556C00F3B101 /* libUntil5000.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libUntil5000.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 2CF77DB60CF7556C00F3B101 /* libLib_UltraPong.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libLib_UltraPong.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; 2CF8E6BD0CDFA8E80053A996 /* UPartyDefs.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UPartyDefs.pas; path = ../../../Modis/SDK/UPartyDefs.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 98B8BE330B1F947800162019 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 98B8BE370B1F949C00162019 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; @@ -502,7 +505,7 @@ DD37F2430A60255800975B2D /* libfpcrtl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libfpcrtl.a; sourceTree = BUILT_PRODUCTS_DIR; }; DDC6851B09F57195004E4BFF /* UltraStarDX.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; path = UltraStarDX.pas; sourceTree = ""; tabWidth = 2; }; DDC6868B09F571C2004E4BFF /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 12; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; - DDC688C809F574E9004E4BFF /* UltraStarDX.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UltraStarDX.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DDC688C809F574E9004E4BFF /* UltraStar Deluxe.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "UltraStar Deluxe.app"; sourceTree = BUILT_PRODUCTS_DIR; }; DDC688CA09F574E9004E4BFF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; DDC689B309F57C69004E4BFF /* InfoPlist.strings */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = InfoPlist.strings; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; DDC689B409F57C69004E4BFF /* SDLMain.nib */ = {isa = PBXFileReference; explicitFileType = wrapper.nib; name = SDLMain.nib; path = English.lproj/SDLMain.nib; sourceTree = ""; }; @@ -526,7 +529,6 @@ 98B8BE3A0B1F949C00162019 /* Foundation.framework in Frameworks */, 98B8BE580B1F972400162019 /* SDL.framework in Frameworks */, 2CDEA4F70CBD725B0096994C /* OpenGL.framework in Frameworks */, - 2C4D9CEA0CC9ECB50031092D /* libbass.dylib in Frameworks */, 2C4D9D970CC9EDEB0031092D /* libfreeimage.dylib in Frameworks */, 2C4D9D9A0CC9EE0B0031092D /* SDL_image.framework in Frameworks */, 2C4D9D9B0CC9EE0B0031092D /* SDL_ttf.framework in Frameworks */, @@ -534,6 +536,7 @@ 2CE907930D1BC8A800A1FDFF /* libavcodec.dylib in Frameworks */, 2CE907940D1BC8A800A1FDFF /* libavformat.dylib in Frameworks */, 2CE907950D1BC8A800A1FDFF /* libavutil.dylib in Frameworks */, + 2CAC2BF10D380AC200CA518A /* libbass.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -575,13 +578,22 @@ name = portaudio; sourceTree = ""; }; + 2CAC2BF60D380B0800CA518A /* BASS */ = { + isa = PBXGroup; + children = ( + 2CAC2BF70D380B1B00CA518A /* Bass.pas */, + ); + name = BASS; + sourceTree = ""; + }; 2CDD43820CBBE8D400F364DE /* Classes */ = { isa = PBXGroup; children = ( + 2CAC2BDD0D3809F500CA518A /* UAudioInput_Bass.pas */, + 2CAC2BDF0D3809F500CA518A /* UAudioPlayback_Bass.pas */, 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */, 2C8937290CE393FB005D8A87 /* UPlatform.pas */, 2C4D9C620CC9EC8C0031092D /* TextGL.pas */, - 2C4D9C630CC9EC8C0031092D /* UAudio_bass.pas */, 2C4D9C650CC9EC8C0031092D /* UCatCovers.pas */, 2C4D9C660CC9EC8C0031092D /* UCommandLine.pas */, 2C4D9C670CC9EC8C0031092D /* UCommon.pas */, @@ -659,14 +671,6 @@ name = FreeImage; sourceTree = ""; }; - 2CE8C7CE0CBAA47D00E4D835 /* BASS */ = { - isa = PBXGroup; - children = ( - 2C4D9D8D0CC9ED230031092D /* Bass.pas */, - ); - name = BASS; - sourceTree = ""; - }; 2CF54F420CDA1B0C00627463 /* Screens */ = { isa = PBXGroup; children = ( @@ -722,7 +726,7 @@ 2CF5510C0CDA28F000627463 /* Lib */ = { isa = PBXGroup; children = ( - 2CE8C7CE0CBAA47D00E4D835 /* BASS */, + 2CAC2BF60D380B0800CA518A /* BASS */, 2C5663EC0D35642E00D4FF53 /* portaudio */, 2CF5529C0CDA428000627463 /* ffmpeg */, 2CE1F4080CC3EEA400CD02E5 /* FreeImage */, @@ -782,6 +786,7 @@ DDC6850D09F5717A004E4BFF = { isa = PBXGroup; children = ( + 2CAC2BF00D380AC200CA518A /* libbass.dylib */, 2CE907900D1BC8A800A1FDFF /* libavcodec.dylib */, 2CE907910D1BC8A800A1FDFF /* libavformat.dylib */, 2CE907920D1BC8A800A1FDFF /* libavutil.dylib */, @@ -792,7 +797,6 @@ 98B8BE370B1F949C00162019 /* Cocoa.framework */, 98B8BE380B1F949C00162019 /* Foundation.framework */, 98B8BE330B1F947800162019 /* AppKit.framework */, - 2C4D9CE90CC9ECB50031092D /* libbass.dylib */, 2C4D9D960CC9EDEB0031092D /* libfreeimage.dylib */, 2CF5512C0CDA29C600627463 /* libsqlite3.dylib */, DD7C45450A6E72DE003FA52B /* Source */, @@ -818,9 +822,9 @@ DDC6888C09F57243004E4BFF /* Products */ = { isa = PBXGroup; children = ( - DDC688C809F574E9004E4BFF /* UltraStarDX.app */, + DDC688C809F574E9004E4BFF /* UltraStar Deluxe.app */, DD37F2430A60255800975B2D /* libfpcrtl.a */, - 2CF77DB60CF7556C00F3B101 /* libUntil5000.dylib */, + 2CF77DB60CF7556C00F3B101 /* libLib_UltraPong.dylib */, ); name = Products; sourceTree = ""; @@ -852,7 +856,7 @@ ); name = Modi_Until5000; productName = Lib_UltraPong; - productReference = 2CF77DB60CF7556C00F3B101 /* libUntil5000.dylib */; + productReference = 2CF77DB60CF7556C00F3B101 /* libLib_UltraPong.dylib */; productType = "com.apple.product-type.library.dynamic"; }; DD37F2420A60255800975B2D /* fpcrtl */ = { @@ -894,7 +898,7 @@ ); name = UltraStarDX; productName = "JEDI-SDLCocoa"; - productReference = DDC688C809F574E9004E4BFF /* UltraStarDX.app */; + productReference = DDC688C809F574E9004E4BFF /* UltraStar Deluxe.app */; productType = "com.apple.product-type.application"; }; DDC688D409F57523004E4BFF /* Put all program sources also in this target */ = { @@ -1035,7 +1039,6 @@ 2CDD4BE20CB947BE00549FAC /* UltraStarDX.pas in Sources */, 2CDD4BE00CB947B100549FAC /* sdl.pas in Sources */, 2C4D9C8F0CC9EC8C0031092D /* TextGL.pas in Sources */, - 2C4D9C900CC9EC8C0031092D /* UAudio_bass.pas in Sources */, 2C4D9C920CC9EC8C0031092D /* UCatCovers.pas in Sources */, 2C4D9C930CC9EC8C0031092D /* UCommandLine.pas in Sources */, 2C4D9C940CC9EC8C0031092D /* UCommon.pas in Sources */, @@ -1076,7 +1079,6 @@ 2C4D9CB90CC9EC8C0031092D /* UThemes.pas in Sources */, 2C4D9CBA0CC9EC8C0031092D /* UTime.pas in Sources */, 2C4D9CBB0CC9EC8C0031092D /* UVideo.pas in Sources */, - 2C4D9D8E0CC9ED230031092D /* Bass.pas in Sources */, 2C4D9D920CC9ED4F0031092D /* FreeBitmap.pas in Sources */, 2C4D9D930CC9ED4F0031092D /* FreeImage.pas in Sources */, 2C4D9DD60CC9EE6F0031092D /* UDisplay.pas in Sources */, @@ -1150,6 +1152,9 @@ 2C8937340CE395CE005D8A87 /* UPlatformMacOSX.pas in Sources */, 2C5663EF0D35645700D4FF53 /* portaudio.pas in Sources */, 2C56642C0D35683200D4FF53 /* SDLMain.m in Sources */, + 2CAC2BE20D3809F500CA518A /* UAudioInput_Bass.pas in Sources */, + 2CAC2BE40D3809F500CA518A /* UAudioPlayback_Bass.pas in Sources */, + 2CAC2BF80D380B1B00CA518A /* Bass.pas in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1160,7 +1165,6 @@ 2CDD4BDE0CB947A400549FAC /* sdl.pas in Sources */, DD37F23D0A60252800975B2D /* UltraStarDX.pas in Sources */, 2C4D9CBC0CC9EC8C0031092D /* TextGL.pas in Sources */, - 2C4D9CBD0CC9EC8C0031092D /* UAudio_bass.pas in Sources */, 2C4D9CBF0CC9EC8C0031092D /* UCatCovers.pas in Sources */, 2C4D9CC00CC9EC8C0031092D /* UCommandLine.pas in Sources */, 2C4D9CC10CC9EC8C0031092D /* UCommon.pas in Sources */, @@ -1201,7 +1205,6 @@ 2C4D9CE60CC9EC8C0031092D /* UThemes.pas in Sources */, 2C4D9CE70CC9EC8C0031092D /* UTime.pas in Sources */, 2C4D9CE80CC9EC8C0031092D /* UVideo.pas in Sources */, - 2C4D9D8F0CC9ED230031092D /* Bass.pas in Sources */, 2C4D9D940CC9ED4F0031092D /* FreeBitmap.pas in Sources */, 2C4D9D950CC9ED4F0031092D /* FreeImage.pas in Sources */, 2C4D9DE00CC9EE6F0031092D /* UDisplay.pas in Sources */, @@ -1274,6 +1277,9 @@ 2C89372B0CE393FB005D8A87 /* UPlatform.pas in Sources */, 2C8937370CE395CE005D8A87 /* UPlatformMacOSX.pas in Sources */, 2C5663F00D35645700D4FF53 /* portaudio.pas in Sources */, + 2CAC2BE70D3809F500CA518A /* UAudioInput_Bass.pas in Sources */, + 2CAC2BE90D3809F500CA518A /* UAudioPlayback_Bass.pas in Sources */, + 2CAC2BF90D380B1B00CA518A /* Bass.pas in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1415,6 +1421,7 @@ "$(LIBRARY_SEARCH_PATHS_QUOTED_2)", "$(LIBRARY_SEARCH_PATHS_QUOTED_3)", "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_2)", ); LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/build/Debug\""; LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)/../lib/SQLite\""; @@ -1422,6 +1429,7 @@ LIBRARY_SEARCH_PATHS_QUOTED_5 = "\"$(SRCROOT)/../lib/bass\""; LIBRARY_SEARCH_PATHS_QUOTED_6 = "\"$(SRCROOT)/../lib/FreeImage\""; LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../lib/ffmpeg\""; + LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SRCROOT)/../lib/bass\""; LINK_WITH_STANDARD_LIBRARIES = YES; OTHER_LDFLAGS = ( "-framework", @@ -1461,6 +1469,7 @@ "$(LIBRARY_SEARCH_PATHS_QUOTED_7)", "$(LIBRARY_SEARCH_PATHS_QUOTED_8)", "$(LIBRARY_SEARCH_PATHS_QUOTED_9)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", ); LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/build/Debug\""; LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)/Bass\""; @@ -1471,6 +1480,7 @@ LIBRARY_SEARCH_PATHS_QUOTED_7 = "\"$(SRCROOT)/../lib/SQLite\""; LIBRARY_SEARCH_PATHS_QUOTED_8 = "\"$(SRCROOT)/../lib/ffmpeg\""; LIBRARY_SEARCH_PATHS_QUOTED_9 = "\"$(SRCROOT)/../lib/ffmpeg\""; + LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../lib/bass\""; LINK_WITH_STANDARD_LIBRARIES = YES; OTHER_LDFLAGS = ( "-framework", diff --git a/Game/Code/lib/ffmpeg/version.inc b/Game/Code/lib/ffmpeg/version.inc index e7f32f5a..6ba2bd52 100644 --- a/Game/Code/lib/ffmpeg/version.inc +++ b/Game/Code/lib/ffmpeg/version.inc @@ -33,7 +33,7 @@ const LIBAVUTIL_SUB_VERSION = 0; {$ENDIF} {$IFDEF DARWIN} - av__format = 'libavcodec.dylib'; + av__codec = 'libavcodec.dylib'; LIBAVCODEC_MAJOR_VERSION = 51; LIBAVCODEC_MINOR_VERSION = 0; LIBAVCODEC_SUB_VERSION = 0; -- 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/Classes/UAudioInput_Bass.pas | 23 +- Game/Code/Classes/UCommandLine.pas | 5 +- Game/Code/Classes/UDataBase.pas | 1 + Game/Code/Classes/UDraw.pas | 28 ++- Game/Code/Classes/UFiles.pas | 360 +++-------------------------- Game/Code/Classes/UIni.pas | 10 +- Game/Code/Classes/ULog.pas | 6 +- Game/Code/Classes/UMain.pas | 86 +++---- Game/Code/Classes/UMusic.pas | 1 + Game/Code/Classes/UPlatform.pas | 74 ++---- Game/Code/Classes/UPlatformLinux.pas | 2 +- Game/Code/Classes/UPlatformMacOSX.pas | 20 +- Game/Code/Classes/UPlatformWindows.pas | 59 ++++- Game/Code/Classes/URecord.pas | 81 +++++-- Game/Code/Classes/USongs.pas | 259 +++++++++------------ Game/Code/Screens/UScreenEditConvert.pas | 1 + Game/Code/Screens/UScreenEditHeader.pas | 6 +- Game/Code/Screens/UScreenEditSub.pas | 51 ++-- Game/Code/Screens/UScreenMain.pas | 7 +- Game/Code/Screens/UScreenOptionsRecord.pas | 132 ++++++++--- Game/Code/Screens/UScreenOptionsSound.pas | 9 +- Game/Code/Screens/UScreenScore.pas | 6 +- Game/Code/Screens/UScreenSing.pas | 91 ++++---- Game/Code/Screens/UScreenSingModi.pas | 4 +- Game/Code/Screens/UScreenSong.pas | 18 +- Game/Code/Screens/UScreenStatMain.pas | 7 +- Game/Code/Screens/UScreenTop5.pas | 18 +- Game/Code/UltraStar.dpr | 1 + 28 files changed, 599 insertions(+), 767 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudioInput_Bass.pas b/Game/Code/Classes/UAudioInput_Bass.pas index 9807ffc3..75a5aee5 100644 --- a/Game/Code/Classes/UAudioInput_Bass.pas +++ b/Game/Code/Classes/UAudioInput_Bass.pas @@ -79,7 +79,7 @@ begin //Check for Soundcard with same Description For I := 0 to SC-1 do begin - if (Recording.SoundCard[I].Description = Desc) then + if (AudioInputProcessor.SoundCard[I].Description = Desc) then begin Result := True; Break; @@ -88,7 +88,7 @@ begin end; begin - with Recording do + with AudioInputProcessor do begin // checks for recording devices and puts them into an array SetLength(SoundCard, 0); @@ -170,21 +170,22 @@ var PlayerLeft, PlayerRight: integer; CaptureSoundLeft, CaptureSoundRight: TSound; begin - for S := 0 to High(Recording.Sound) do - Recording.Sound[S].BufferLong[0].Clear; + for S := 0 to High(AudioInputProcessor.Sound) do + AudioInputProcessor.Sound[S].BufferLong[0].Clear; - for SC := 0 to High(Ini.CardList) do begin + for SC := 0 to High(Ini.CardList) do + begin PlayerLeft := Ini.CardList[SC].ChannelL-1; PlayerRight := Ini.CardList[SC].ChannelR-1; if PlayerLeft >= PlayersPlay then PlayerLeft := -1; if PlayerRight >= PlayersPlay then PlayerRight := -1; if (PlayerLeft > -1) or (PlayerRight > -1) then begin if (PlayerLeft > -1) then - CaptureSoundLeft := Recording.Sound[PlayerLeft] + CaptureSoundLeft := AudioInputProcessor.Sound[PlayerLeft] else CaptureSoundLeft := nil; if (PlayerRight > -1) then - CaptureSoundRight := Recording.Sound[PlayerRight] + CaptureSoundRight := AudioInputProcessor.Sound[PlayerRight] else CaptureSoundRight := nil; @@ -224,14 +225,14 @@ end; function MicrophoneCallback(stream: HSTREAM; buffer: Pointer; len: Cardinal; Card: Cardinal): boolean; stdcall; begin - Recording.HandleMicrophoneData(buffer, len, Recording.SoundCard[Card]); + AudioInputProcessor.HandleMicrophoneData(buffer, len, AudioInputProcessor.SoundCard[Card]); Result := true; end; {* * Start input-capturing on Soundcard specified by Card. * Params: - * Card - soundcard index in Recording.SoundCard array + * Card - soundcard index in AudioInputProcessor.SoundCard array * CaptureSoundLeft - sound(-buffer) used for left channel capture data * CaptureSoundRight - sound(-buffer) used for right channel capture data *} @@ -254,7 +255,7 @@ begin end else begin - bassSoundCard := TBassSoundCard(Recording.SoundCard[Card]); + bassSoundCard := TBassSoundCard(AudioInputProcessor.SoundCard[Card]); bassSoundCard.CaptureSoundLeft := CaptureSoundLeft; bassSoundCard.CaptureSoundRight := CaptureSoundRight; @@ -267,7 +268,7 @@ end; {* * Stop input-capturing on Soundcard specified by Card. * Params: - * Card - soundcard index in Recording.SoundCard array + * Card - soundcard index in AudioInputProcessor.SoundCard array *} procedure TAudioInput_Bass.StopCard(Card: byte); begin diff --git a/Game/Code/Classes/UCommandLine.pas b/Game/Code/Classes/UCommandLine.pas index 86f822a4..55dfc6ce 100644 --- a/Game/Code/Classes/UCommandLine.pas +++ b/Game/Code/Classes/UCommandLine.pas @@ -61,7 +61,8 @@ const implementation -uses SysUtils; +uses SysUtils, + uPlatform; // uINI -- Nasty requirement... ( removed with permission of blindy ) @@ -99,7 +100,7 @@ begin writeln( '' ); - halt; + platform.halt; end; //------------- diff --git a/Game/Code/Classes/UDataBase.pas b/Game/Code/Classes/UDataBase.pas index e99cb891..b5636d52 100644 --- a/Game/Code/Classes/UDataBase.pas +++ b/Game/Code/Classes/UDataBase.pas @@ -9,6 +9,7 @@ interface {$I switches.inc} uses USongs, + USong, SQLiteTable3; //-------------------- diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index c399057b..662050dc 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -161,7 +161,7 @@ end; procedure SingDrawOscilloscope(X, Y, W, H: real; NrSound: integer); var - Pet: integer; + Pet : integer; begin; // Log.LogStatus('Oscilloscope', 'SingDraw'); glColor3f(Skin_OscR, Skin_OscG, Skin_OscB); @@ -169,14 +169,19 @@ begin; glColor3f(1, 1, 1); } glBegin(GL_LINE_STRIP); - glVertex2f(X, -Recording.Sound[NrSound].BufferArray[1] / $10000 * H + Y + H/2); - for Pet := 2 to Recording.Sound[NrSound].n div 1 do begin - glVertex2f(X + (Pet-1) * W / (Recording.Sound[NrSound].n - 1), - -Recording.Sound[NrSound].BufferArray[Pet] / $10000 * H + Y + H/2); + + glVertex2f(X, -AudioInputProcessor.Sound[NrSound].BufferArray[1] / $10000 * H + Y + H/2); + + for Pet := 2 to AudioInputProcessor.Sound[NrSound].n div 1 do + begin + glVertex2f( X + (Pet-1) * W / (AudioInputProcessor.Sound[NrSound].n - 1), + -AudioInputProcessor.Sound[NrSound].BufferArray[Pet] / $10000 * H + Y + H/2 ); end; glEnd; end; + + procedure SingDrawNoteLines(Left, Top, Right: real; Space: integer); var Pet: integer; @@ -366,7 +371,7 @@ var glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - if Player[NrGracza].IlNut > 0 then +//// if Player[NrGracza].IlNut > 0 then begin TempR := W / (Czesci[0].Czesc[Czesci[0].Akt].Koniec - Czesci[0].Czesc[Czesci[0].Akt].StartNote); for N := 0 to Player[NrGracza].HighNut do @@ -480,14 +485,7 @@ begin lTmpA := (Right-Left); lTmpB := (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote); - - {$IFDEF LAZARUS} -{* - writeln( 'UDRAW (Right-Left) : ' + floattostr( lTmpA ) ); - writeln( 'UDRAW : ' + floattostr( lTmpB ) ); - writeln( '' ); -*} - {$ENDIF} + if ( lTmpA > 0 ) AND ( lTmpB > 0 ) THEN @@ -555,7 +553,7 @@ begin end; // if not FreeStyle end; // with end; // for - end; // with + end; // with 1 glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index 69beefe9..d3e4729b 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -10,45 +10,33 @@ interface uses SysUtils, ULog, UMusic, - USongs; + USongs, + USong; //procedure InitializePaths; //Function sets All Absolute Paths eg. for Songs -function ReadTXTHeader(var Song: TSong): boolean; //Reads Standard TXT Header -function AnalyseFile(var Song: TSong): boolean; //Analyse Song File and Read Header -procedure ClearSong(var Song: TSong); //Clears Song Header values +//function ReadTXTHeader(var Song: TSong): boolean; //Reads Standard TXT Header +//function AnalyseFile(var Song: TSong): boolean; //Analyse Song File and Read Header +//procedure ClearSong(var Song: TSong); //Clears Song Header values //Methodes Loading and Saving Songfiles procedure ResetSingTemp; -procedure ParseNote(NrCzesci: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string); -procedure NewSentence(NrCzesciP: integer; Param1, Param2: integer); -function LoadSong(Name: string): boolean; +//procedure ParseNote(NrCzesci: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string); +//procedure NewSentence(NrCzesciP: integer; Param1, Param2: integer); + +//function LoadSong(Name: string): boolean; function SaveSong(Song: TSong; Czesc: TCzesci; Name: string; Relative: boolean): boolean; var -{* - //Absolute Paths - GamePath: string; - SoundPath: string; - SongPath: string; - LogPath: string; - ThemePath: string; - ScreenshotsPath: string; - CoversPath: string; - LanguagesPath: string; - PluginPath: string; - PlayListPath: string; -*} - SongFile: TextFile; // all procedures in this unit operates on this file FileLineNo: integer; //Line which is readed at Last, for error reporting // variables available for all procedures - Base: array[0..1] of integer; - Rel: array[0..1] of integer; - Mult: integer = 1; - MultBPM: integer = 4; + Base : array[0..1] of integer; + Rel : array[0..1] of integer; + Mult : integer = 1; + MultBPM : integer = 4; implementation @@ -57,7 +45,10 @@ uses TextGL, UPlatform, UMain; +(* //-------------------- +<<<<<<< .mine +======= // Clears Song Header values //-------------------- procedure ClearSong(var Song: TSong); @@ -367,7 +358,7 @@ Result := False; Log.LogError('An Error occured reading Line ' + inttostr(FileLineNo) + ' from SongHeader: ' + Song.FileName); end;} end; - + *) //-------------------- // Resets the temporary Sentence Arrays for each Player and some other Variables //-------------------- @@ -376,7 +367,6 @@ var Pet: integer; begin SetLength(Czesci, Length(Player)); - SetLength(AktSong.BPM, 0); for Pet := 0 to High(Player) do begin SetLength(Czesci[Pet].Czesc, 1); SetLength(Czesci[Pet].Czesc[0].Nuta, 0); @@ -386,316 +376,18 @@ begin Player[pet].IlNut := 0; Player[pet].HighNut := -1; end; - //Reset Path and Filename Values to Prevent Errors in Editor - AktSong.Path := ''; - AktSong.FileName := ''; -end; - -//-------------------- -// Parses Note Infos and save them to Array -//-------------------- -procedure ParseNote(NrCzesci: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string); -var - Space: boolean; -begin - case Ini.Solmization of - 1: // european - begin - case (NoteP mod 12) of - 0..1: LyricS := ' do '; - 2..3: LyricS := ' re '; - 4: LyricS := ' mi '; - 5..6: LyricS := ' fa '; - 7..8: LyricS := ' sol '; - 9..10: LyricS := ' la '; - 11: LyricS := ' si '; - end; - end; - 2: // japanese - begin - case (NoteP mod 12) of - 0..1: LyricS := ' do '; - 2..3: LyricS := ' re '; - 4: LyricS := ' mi '; - 5..6: LyricS := ' fa '; - 7..8: LyricS := ' so '; - 9..10: LyricS := ' la '; - 11: LyricS := ' shi '; - end; - end; - 3: // american - begin - case (NoteP mod 12) of - 0..1: LyricS := ' do '; - 2..3: LyricS := ' re '; - 4: LyricS := ' mi '; - 5..6: LyricS := ' fa '; - 7..8: LyricS := ' sol '; - 9..10: LyricS := ' la '; - 11: LyricS := ' ti '; - end; - end; - end; // case - - with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].High] do begin - SetLength(Nuta, Length(Nuta) + 1); - IlNut := IlNut + 1; - HighNut := HighNut + 1; - Muzyka.IlNut := Muzyka.IlNut + 1; - - Nuta[HighNut].Start := StartP; - if IlNut = 1 then begin - StartNote := Nuta[HighNut].Start; - if Czesci[NrCzesci].Ilosc = 1 then - Start := -100; -// Start := Nuta[HighNut].Start; - end; - - Nuta[HighNut].Dlugosc := DurationP; - Muzyka.DlugoscNut := Muzyka.DlugoscNut + Nuta[HighNut].Dlugosc; - - // back to the normal system with normal, golden and now freestyle notes - case TypeP of - 'F': Nuta[HighNut].Wartosc := 0; - ':': Nuta[HighNut].Wartosc := 1; - '*': Nuta[HighNut].Wartosc := 2; - end; - - Czesci[NrCzesci].Wartosc := Czesci[NrCzesci].Wartosc + Nuta[HighNut].Dlugosc * Nuta[HighNut].Wartosc; - Nuta[HighNut].Ton := NoteP; - if Nuta[HighNut].Ton < Base[NrCzesci] then Base[NrCzesci] := Nuta[HighNut].Ton; - Nuta[HighNut].TonGamy := Nuta[HighNut].TonGamy mod 12; - - Nuta[HighNut].Tekst := Copy(LyricS, 2, 100); - Lyric := Lyric + Nuta[HighNut].Tekst; - - if TypeP = 'F' then - Nuta[HighNut].FreeStyle := true; - - Koniec := Nuta[HighNut].Start + Nuta[HighNut].Dlugosc; - end; // with -end; - -//-------------------- -// Called when a new Sentence is found in the TXT File -//-------------------- -procedure NewSentence(NrCzesciP: integer; Param1, Param2: integer); -var -I: Integer; -begin - - // stara czesc //Alter Satz //Update Old Part - Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].BaseNote := Base[NrCzesciP]; - Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].LyricWidth := glTextWidth(PChar(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Lyric)); - - //Total Notes Patch - Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes := 0; - for I := low(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta) to high(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta) do + //Reset Path and Filename Values to Prevent Errors in Editor + if assigned( CurrentSong ) then begin - Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes := Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta[I].Dlugosc * Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta[I].Wartosc; + SetLength(CurrentSong.BPM, 0); + CurrentSong.Path := ''; + CurrentSong.FileName := ''; end; - //Total Notes Patch End - - - // nowa czesc //Neuer Satz //Update New Part - SetLength(Czesci[NrCzesciP].Czesc, Czesci[NrCzesciP].Ilosc + 1); - Czesci[NrCzesciP].High := Czesci[NrCzesciP].High + 1; - Czesci[NrCzesciP].Ilosc := Czesci[NrCzesciP].Ilosc + 1; - Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].HighNut := -1; - - if not AktSong.Relative then - Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Start := Param1; - - if AktSong.Relative then begin - Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Start := Param1; - Rel[NrCzesciP] := Rel[NrCzesciP] + Param2; - end; - - Base[NrCzesciP] := 100; // high number + +// CurrentSong := nil; end; -//-------------------- -// Load a Song -//-------------------- -function LoadSong(Name: string): boolean; -var - TempC: char; - Tekst: string; - CP: integer; // Current Player (0 or 1) - Pet: integer; - Both: boolean; - Param1: integer; - Param2: integer; - Param3: integer; - ParamS: string; - I: Integer; -begin - Result := false; - - if not FileExists(Name) then begin - Log.LogError('File not found: "' + Name + '"', 'WczytajCzesci'); - exit; - end; - - try - MultBPM := 4; // 4 - mnoznik dla czasu nut - Mult := 1; // 4 - dokladnosc pomiaru nut - Base[0] := 100; // high number -// Base[1] := 100; // high number - Czesci[0].Wartosc := 0; -// Czesci[1].Wartosc := 0; // here was the error in 0.3.2 - AktSong.Relative := false; - - Rel[0] := 0; -// Rel[1] := 0; - CP := 0; - Both := false; - if Length(Player) = 2 then Both := true; - - FileMode := fmOpenRead; - AssignFile(SongFile, Name); - Reset(SongFile); - - //Clear old Song Header - ClearSong(AktSong); - - if (AktSong.Path = '') then - AktSong.Path := ExtractFilePath(Name); - - if (AktSong.FileName = '') then - AktSong.Filename := ExtractFileName(Name); - //Read Header - Result := ReadTxTHeader(AktSong); - if not Result then - begin - CloseFile(SongFile); - Log.LogError('Error Loading SongHeader, abort Song Loading'); - Exit; - end; - - Result := False; - - Reset(SongFile); - FileLineNo := 0; - //Search for Note Begining - repeat - ReadLn(SongFile, Tekst); - Inc(FileLineNo); - - if (EoF(SongFile)) then - begin //Song File Corrupted - No Notes - CloseFile(SongFile); - Log.LogError('Could not load txt File, no Notes found: ' + Name); - Result := False; - Exit; - end; - Read(SongFile, TempC); - until ((TempC = ':') or (TempC = 'F') or (TempC = '*')); - - SetLength(Czesci, 2); - for Pet := 0 to High(Czesci) do begin - SetLength(Czesci[Pet].Czesc, 1); - Czesci[Pet].High := 0; - Czesci[Pet].Ilosc := 1; - Czesci[Pet].Akt := 0; - Czesci[Pet].Resolution := AktSong.Resolution; - Czesci[Pet].NotesGAP := AktSong.NotesGAP; - Czesci[Pet].Czesc[0].IlNut := 0; - Czesci[Pet].Czesc[0].HighNut := -1; - end; - -// TempC := ':'; -// TempC := Tekst[1]; // read from backup variable, don't use default ':' value - - while (TempC <> 'E') AND (not EOF(SongFile)) do begin - if (TempC = ':') or (TempC = '*') or (TempC = 'F') then begin - // wczytuje nute - Read(SongFile, Param1); - Read(SongFile, Param2); - Read(SongFile, Param3); - Read(SongFile, ParamS); - - // dodaje nute - if not Both then - // P1 - ParseNote(0, TempC, (Param1+Rel[0]) * Mult, Param2 * Mult, Param3, ParamS) - else begin - // P1 + P2 - ParseNote(0, TempC, (Param1+Rel[0]) * Mult, Param2 * Mult, Param3, ParamS); - ParseNote(1, TempC, (Param1+Rel[1]) * Mult, Param2 * Mult, Param3, ParamS); - end; - end; // if - if TempC = '-' then begin - // reads sentence - Read(SongFile, Param1); - if AktSong.Relative then Read(SongFile, Param2); // read one more data for relative system - - // new sentence - if not Both then - // P1 - NewSentence(0, (Param1 + Rel[0]) * Mult, Param2) - else begin - // P1 + P2 - NewSentence(0, (Param1 + Rel[0]) * Mult, Param2); - NewSentence(1, (Param1 + Rel[1]) * Mult, Param2); - end; - - end; // if - - if TempC = 'B' then begin - SetLength(AktSong.BPM, Length(AktSong.BPM) + 1); - Read(SongFile, AktSong.BPM[High(AktSong.BPM)].StartBeat); - AktSong.BPM[High(AktSong.BPM)].StartBeat := AktSong.BPM[High(AktSong.BPM)].StartBeat + Rel[0]; - - Read(SongFile, Tekst); - AktSong.BPM[High(AktSong.BPM)].BPM := StrToFloat(Tekst); - AktSong.BPM[High(AktSong.BPM)].BPM := AktSong.BPM[High(AktSong.BPM)].BPM * Mult * MultBPM; - end; - - - if not Both then begin - Czesci[CP].Czesc[Czesci[CP].High].BaseNote := Base[CP]; - Czesci[CP].Czesc[Czesci[CP].High].LyricWidth := glTextWidth(PChar(Czesci[CP].Czesc[Czesci[CP].High].Lyric)); - //Total Notes Patch - Czesci[CP].Czesc[Czesci[CP].High].TotalNotes := 0; - for I := low(Czesci[CP].Czesc[Czesci[CP].High].Nuta) to high(Czesci[CP].Czesc[Czesci[CP].High].Nuta) do - begin - Czesci[CP].Czesc[Czesci[CP].High].TotalNotes := Czesci[CP].Czesc[Czesci[CP].High].TotalNotes + Czesci[CP].Czesc[Czesci[CP].High].Nuta[I].Dlugosc * Czesci[CP].Czesc[Czesci[CP].High].Nuta[I].Wartosc; - end; - //Total Notes Patch End - end else begin - for Pet := 0 to High(Czesci) do begin - Czesci[Pet].Czesc[Czesci[Pet].High].BaseNote := Base[Pet]; - Czesci[Pet].Czesc[Czesci[Pet].High].LyricWidth := glTextWidth(PChar(Czesci[Pet].Czesc[Czesci[Pet].High].Lyric)); - //Total Notes Patch - Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes := 0; - for I := low(Czesci[Pet].Czesc[Czesci[Pet].High].Nuta) to high(Czesci[Pet].Czesc[Czesci[Pet].High].Nuta) do - begin - Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes := Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes + Czesci[Pet].Czesc[Czesci[Pet].High].Nuta[I].Dlugosc * Czesci[Pet].Czesc[Czesci[Pet].High].Nuta[I].Wartosc; - end; - //Total Notes Patch End - end; - end; - - Read(SongFile, TempC); - Inc(FileLineNo); - end; // while} - - CloseFile(SongFile); - except - try - CloseFile(SongFile); - except - - end; - - Log.LogError('Error Loading File: "' + Name + '" in Line ' + inttostr(FileLineNo)); - exit; - end; - - Result := true; -end; //-------------------- // Saves a Song @@ -738,8 +430,8 @@ begin WriteLn(SongFile, '#GAP:' + FloatToStr(Song.GAP)); RelativeSubTime := 0; - for B := 1 to High(AktSong.BPM) do - WriteLn(SongFile, 'B ' + FloatToStr(AktSong.BPM[B].StartBeat) + ' ' + FloatToStr(AktSong.BPM[B].BPM/4)); + for B := 1 to High(CurrentSong.BPM) do + WriteLn(SongFile, 'B ' + FloatToStr(CurrentSong.BPM[B].StartBeat) + ' ' + FloatToStr(CurrentSong.BPM[B].BPM/4)); for C := 0 to Czesc.High do begin for N := 0 to Czesc.Czesc[C].HighNut do begin diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index e4f5e823..599bb8fa 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -463,9 +463,9 @@ begin //{ B := False; //Look for Soundcard - for I2 := 0 to High(Recording.SoundCard) do + for I2 := 0 to High(AudioInputProcessor.SoundCard) do begin - if (S = Trim(Recording.SoundCard[I2].Description)) then + if (S = Trim(AudioInputProcessor.SoundCard[I2].Description)) then begin B := True; Break; @@ -485,12 +485,12 @@ begin end; // Record - append detected soundcards - for I := 0 to High(Recording.SoundCard) do + for I := 0 to High(AudioInputProcessor.SoundCard) do begin B := False; For I2 := 0 to High(CardList) do begin //Search for Card in List - if (CardList[I2].Name = Trim(Recording.SoundCard[I].Description)) then + if (CardList[I2].Name = Trim(AudioInputProcessor.SoundCard[I].Description)) then begin B := True; Break; @@ -502,7 +502,7 @@ begin begin I3 := Length(CardList); SetLength(CardList, I3+1); - CardList[I3].Name := Trim(Recording.SoundCard[I].Description); + CardList[I3].Name := Trim(AudioInputProcessor.SoundCard[I].Description); CardList[I3].Input := 0; CardList[I3].ChannelL := 0; CardList[I3].ChannelR := 0; diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index fc567d54..49b02c00 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -212,9 +212,9 @@ begin FS := TFileStream.Create(FileName, fmCreate); - for BL := 0 to High(Recording.Sound[SoundNr].BufferLong) do begin - Recording.Sound[SoundNr].BufferLong[BL].Seek(0, soBeginning); - FS.CopyFrom(Recording.Sound[SoundNr].BufferLong[BL], Recording.Sound[SoundNr].BufferLong[BL].Size); + for BL := 0 to High(AudioInputProcessor.Sound[SoundNr].BufferLong) do begin + AudioInputProcessor.Sound[SoundNr].BufferLong[BL].Seek(0, soBeginning); + FS.CopyFrom(AudioInputProcessor.Sound[SoundNr].BufferLong[BL], AudioInputProcessor.Sound[SoundNr].BufferLong[BL].Size); end; FS.Free; diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index e2e0eaa0..901d7370 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -20,6 +20,7 @@ uses ULog, ULyrics, UScreenSing, + USong, OpenGL12, {$IFDEF UseSerialPort} zlportio {you can disable it and all PortWriteB calls}, @@ -107,6 +108,8 @@ var Player: array of TPlayer; PlayersPlay: integer; + CurrentSong : TSong; + procedure InitializePaths; Procedure Main; @@ -130,7 +133,7 @@ uses USongs, math, UCommandLine, ULanguage, SDL_ttf, USkins, UCovers, UCatCovers, UDataBase, UPlaylist, UDLLManager, - UParty, UCore, UGraphicClasses, UPluginDefs, UPlatform; + UParty, UCore, UGraphicClasses, UPluginDefs, UPlatform; const Version = 'UltraStar Deluxe V 1.10 Alpha Build'; @@ -192,12 +195,14 @@ begin Log.BenchmarkEnd(1); Log.LogBenchmark('Loading Skin List', 1); +(* // Sound Card List Log.BenchmarkStart(1); Log.LogStatus('Loading Soundcard list', 'Initialization'); Recording := TRecord.Create; Log.BenchmarkEnd(1); Log.LogBenchmark('Loading Soundcard list', 1); +*) // Sound (+ fills Sound Card List) Log.BenchmarkStart(1); @@ -508,23 +513,23 @@ procedure GetMidBeatSub(BPMNum: integer; var Time: real; var CurBeat: real); var NewTime: real; begin - if High(AktSong.BPM) = BPMNum then begin + if High(CurrentSong.BPM) = BPMNum then begin // last BPM - CurBeat := AktSong.BPM[BPMNum].StartBeat + GetBeats(AktSong.BPM[BPMNum].BPM, Time); + CurBeat := CurrentSong.BPM[BPMNum].StartBeat + GetBeats(CurrentSong.BPM[BPMNum].BPM, Time); Time := 0; end else begin // not last BPM // count how much time is it for start of the new BPM and store it in NewTime - NewTime := GetTimeForBeats(AktSong.BPM[BPMNum].BPM, AktSong.BPM[BPMNum+1].StartBeat - AktSong.BPM[BPMNum].StartBeat); + NewTime := GetTimeForBeats(CurrentSong.BPM[BPMNum].BPM, CurrentSong.BPM[BPMNum+1].StartBeat - CurrentSong.BPM[BPMNum].StartBeat); // compare it to remaining time if (Time - NewTime) > 0 then begin // there is still remaining time - CurBeat := AktSong.BPM[BPMNum].StartBeat; + CurBeat := CurrentSong.BPM[BPMNum].StartBeat; Time := Time - NewTime; end else begin // there is no remaining time - CurBeat := AktSong.BPM[BPMNum].StartBeat + GetBeats(AktSong.BPM[BPMNum].BPM, Time); + CurBeat := CurrentSong.BPM[BPMNum].StartBeat + GetBeats(CurrentSong.BPM[BPMNum].BPM, Time); Time := 0; end; // if end; // if @@ -539,18 +544,18 @@ var // TempTime: real; begin Result := 0; - if Length(AktSong.BPM) = 1 then Result := Time * AktSong.BPM[0].BPM / 60; + if Length(CurrentSong.BPM) = 1 then Result := Time * CurrentSong.BPM[0].BPM / 60; (* 2 BPMs *) -{ if Length(AktSong.BPM) > 1 then begin +{ if Length(CurrentSong.BPM) > 1 then begin (* new system *) CurBeat := 0; - TopBeat := GetBeats(AktSong.BPM[0].BPM, Time); - if TopBeat > AktSong.BPM[1].StartBeat then begin + TopBeat := GetBeats(CurrentSong.BPM[0].BPM, Time); + if TopBeat > CurrentSong.BPM[1].StartBeat then begin // analyze second BPM - Time := Time - GetTimeForBeats(AktSong.BPM[0].BPM, AktSong.BPM[1].StartBeat - CurBeat); - CurBeat := AktSong.BPM[1].StartBeat; - TopBeat := GetBeats(AktSong.BPM[1].BPM, Time); + Time := Time - GetTimeForBeats(CurrentSong.BPM[0].BPM, CurrentSong.BPM[1].StartBeat - CurBeat); + CurBeat := CurrentSong.BPM[1].StartBeat; + TopBeat := GetBeats(CurrentSong.BPM[1].BPM, Time); Result := CurBeat + TopBeat; end else begin @@ -560,7 +565,7 @@ begin end; // if} (* more BPMs *) - if Length(AktSong.BPM) > 1 then begin + if Length(CurrentSong.BPM) > 1 then begin CurBeat := 0; CurBPM := 0; @@ -578,21 +583,21 @@ var CurBPM: integer; begin Result := 0; - if Length(AktSong.BPM) = 1 then Result := AktSong.GAP / 1000 + Beat * 60 / AktSong.BPM[0].BPM; + if Length(CurrentSong.BPM) = 1 then Result := CurrentSong.GAP / 1000 + Beat * 60 / CurrentSong.BPM[0].BPM; (* more BPMs *) - if Length(AktSong.BPM) > 1 then begin - Result := AktSong.GAP / 1000; + if Length(CurrentSong.BPM) > 1 then begin + Result := CurrentSong.GAP / 1000; CurBPM := 0; - while (CurBPM <= High(AktSong.BPM)) and (Beat > AktSong.BPM[CurBPM].StartBeat) do begin - if (CurBPM < High(AktSong.BPM)) and (Beat >= AktSong.BPM[CurBPM+1].StartBeat) then begin + while (CurBPM <= High(CurrentSong.BPM)) and (Beat > CurrentSong.BPM[CurBPM].StartBeat) do begin + if (CurBPM < High(CurrentSong.BPM)) and (Beat >= CurrentSong.BPM[CurBPM+1].StartBeat) then begin // full range - Result := Result + (60 / AktSong.BPM[CurBPM].BPM) * (AktSong.BPM[CurBPM+1].StartBeat - AktSong.BPM[CurBPM].StartBeat); + Result := Result + (60 / CurrentSong.BPM[CurBPM].BPM) * (CurrentSong.BPM[CurBPM+1].StartBeat - CurrentSong.BPM[CurBPM].StartBeat); end; - if (CurBPM = High(AktSong.BPM)) or (Beat < AktSong.BPM[CurBPM+1].StartBeat) then begin + if (CurBPM = High(CurrentSong.BPM)) or (Beat < CurrentSong.BPM[CurBPM+1].StartBeat) then begin // in the middle - Result := Result + (60 / AktSong.BPM[CurBPM].BPM) * (Beat - AktSong.BPM[CurBPM].StartBeat); + Result := Result + (60 / CurrentSong.BPM[CurBPM].BPM) * (Beat - CurrentSong.BPM[CurBPM].StartBeat); end; Inc(CurBPM); end; @@ -615,7 +620,7 @@ begin Czas.Teraz := Czas.Teraz + TimeSkip; Czas.OldBeat := Czas.AktBeat; - Czas.MidBeat := GetMidBeat(Czas.Teraz - (AktSong.Gap{ + 90 I've forgotten for what it is}) / 1000); // new system with variable BPM in function + Czas.MidBeat := GetMidBeat(Czas.Teraz - (CurrentSong.Gap{ + 90 I've forgotten for what it is}) / 1000); // new system with variable BPM in function Czas.AktBeat := Floor(Czas.MidBeat); // Czas.OldHalf := Czas.AktHalf; @@ -623,11 +628,11 @@ begin // Czas.AktHalf := Floor(Czas.MidHalf); Czas.OldBeatC := Czas.AktBeatC; - Czas.MidBeatC := GetMidBeat(Czas.Teraz - (AktSong.Gap) / 1000); + Czas.MidBeatC := GetMidBeat(Czas.Teraz - (CurrentSong.Gap) / 1000); Czas.AktBeatC := Floor(Czas.MidBeatC); Czas.OldBeatD := Czas.AktBeatD; - Czas.MidBeatD := -0.5+GetMidBeat(Czas.Teraz - (AktSong.Gap + 120 + 20) / 1000); // MidBeat with addition GAP + Czas.MidBeatD := -0.5+GetMidBeat(Czas.Teraz - (CurrentSong.Gap + 120 + 20) / 1000); // MidBeat with addition GAP Czas.AktBeatD := Floor(Czas.MidBeatD); Czas.FracBeatD := Frac(Czas.MidBeatD); @@ -822,7 +827,7 @@ begin // beep; // On linux we get an AV @ NEWNOTE, line 600 of Classes/UMain.pas - if not assigned( Recording.Sound ) then // TODO : JB_Linux ... why is this now not assigned... it was fine a few hours ago.. + if not assigned( AudioInputProcessor.Sound ) then // TODO : JB_Linux ... why is this now not assigned... it was fine a few hours ago.. exit; // analizuje dla obu graczy ten sam sygnal (Sound.OneSrcForBoth) @@ -831,7 +836,7 @@ begin begin // analyze buffer - Recording.Sound[CP].AnalizujBufor; + AudioInputProcessor.Sound[CP].AnalyzeBuffer; // adds some noise // Czas.Ton := Czas.Ton + Round(Random(3)) - 1; @@ -866,7 +871,7 @@ begin // Czas.Ton := 27; // gdy moze, to dodaje nute - if (Recording.Sound[CP].SzczytJest) and (Mozna) then begin + if (AudioInputProcessor.Sound[CP].SzczytJest) and (Mozna) then begin // operowanie na ostatniej nucie for Pet := 0 to Czesci[0].Czesc[S].HighNut do if (Czesci[0].Czesc[S].Nuta[Pet].Start <= Czas.OldBeatD+1) @@ -875,10 +880,11 @@ begin // to robi, tylko dla pary nut (oryginalnej i gracza) // przesuwanie tonu w odpowiednia game - while (Recording.Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton > 6) do - Recording.Sound[CP].Ton := Recording.Sound[CP].Ton - 12; - while (Recording.Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton < -6) do - Recording.Sound[CP].Ton := Recording.Sound[CP].Ton + 12; + while (AudioInputProcessor.Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton > 6) do + AudioInputProcessor.Sound[CP].Ton := AudioInputProcessor.Sound[CP].Ton - 12; + + while (AudioInputProcessor.Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton < -6) do + AudioInputProcessor.Sound[CP].Ton := AudioInputProcessor.Sound[CP].Ton + 12; // Half size Notes Patch NoteHit := false; @@ -887,8 +893,9 @@ begin //if Ini.Difficulty = 1 then Range := 1; //if Ini.Difficulty = 2 then Range := 0; Range := 2 - Ini.Difficulty; - if abs(Czesci[0].Czesc[S].Nuta[Pet].Ton - Recording.Sound[CP].Ton) <= Range then begin - Recording.Sound[CP].Ton := Czesci[0].Czesc[S].Nuta[Pet].Ton; + + if abs(Czesci[0].Czesc[S].Nuta[Pet].Ton - AudioInputProcessor.Sound[CP].Ton) <= Range then begin + AudioInputProcessor.Sound[CP].Ton := Czesci[0].Czesc[S].Nuta[Pet].Ton; // Half size Notes Patch @@ -929,7 +936,7 @@ begin Nowa := true; // jezeli ostatnia ma ten sam ton if (Player[CP].IlNut > 0 ) - and (Player[CP].Nuta[Player[CP].HighNut].Ton = Recording.Sound[CP].Ton) + and (Player[CP].Nuta[Player[CP].HighNut].Ton = AudioInputProcessor.Sound[CP].Ton) and (Player[CP].Nuta[Player[CP].HighNut].Start + Player[CP].Nuta[Player[CP].HighNut].Dlugosc = Czas.AktBeatD) then Nowa := false; // jezeli jest jakas nowa nuta na sprawdzanym beacie @@ -943,10 +950,10 @@ begin Player[CP].IlNut := Player[CP].IlNut + 1; Player[CP].HighNut := Player[CP].HighNut + 1; SetLength(Player[CP].Nuta, Player[CP].IlNut); - Player[CP].Nuta[Player[CP].HighNut].Start := Czas.AktBeatD; + Player[CP].Nuta[Player[CP].HighNut].Start := Czas.AktBeatD; Player[CP].Nuta[Player[CP].HighNut].Dlugosc := 1; - Player[CP].Nuta[Player[CP].HighNut].Ton := Recording.Sound[CP].Ton; // Ton || TonDokl - Player[CP].Nuta[Player[CP].HighNut].Detekt := Czas.MidBeat; + Player[CP].Nuta[Player[CP].HighNut].Ton := AudioInputProcessor.Sound[CP].Ton; // Ton || TonDokl + Player[CP].Nuta[Player[CP].HighNut].Detekt := Czas.MidBeat; // Half Note Patch @@ -977,7 +984,8 @@ begin //On Sentence End -> For LineBonus + SingBar if (sDet >= low(Czesci[0].Czesc)) AND (sDet <= high(Czesci[0].Czesc)) then -if ((Czesci[0].Czesc[SDet].Nuta[Czesci[0].Czesc[SDet].HighNut].Start + Czesci[0].Czesc[SDet].Nuta[Czesci[0].Czesc[SDet].HighNut].Dlugosc - 1) = Czas.AktBeatD) then +if assigned( Sender ) AND + ((Czesci[0].Czesc[SDet].Nuta[Czesci[0].Czesc[SDet].HighNut].Start + Czesci[0].Czesc[SDet].Nuta[Czesci[0].Czesc[SDet].HighNut].Dlugosc - 1) = Czas.AktBeatD) then Sender.onSentenceEnd(sDet); end; diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index bf366130..a7f1918f 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -413,6 +413,7 @@ end; initialization begin singleton_AudioManager := TInterfaceList.Create(); + end; finalization diff --git a/Game/Code/Classes/UPlatform.pas b/Game/Code/Classes/UPlatform.pas index 19a960e7..bfb03d54 100644 --- a/Game/Code/Classes/UPlatform.pas +++ b/Game/Code/Classes/UPlatform.pas @@ -16,7 +16,6 @@ interface uses Classes; type - TDirectoryEntry = Record Name : WideString; IsDirectory : Boolean; @@ -27,33 +26,16 @@ type IPlatform = Interface ['{63A5EBC3-3F4D-4F23-8DFB-B5165FCA23DF}'] - Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; - function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; - - function GetLogPath : WideString; - function GetGameSharedPath : WideString; - function GetGameUserPath : WideString; - end; - - TPlatform = class( TInterfacedOBject, IPlatform ) - - // DirectoryFindFiles returns all files matching the filter. Do not use '*' in the filter. - // If you set ReturnAllSubDirs = true all directories will be returned, if yout set it to false - // directories are completely ignored. - function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; virtual; abstract; - - function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; virtual; - -// function GetGamePath : WideString; virtual; - function GetLogPath : WideString; virtual; - function GetGameSharedPath : WideString; virtual; - function GetGameUserPath : WideString; virtual; - + Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; + function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; + function FindSongFile(Dir, Mask: widestring): widestring; + procedure halt; + function GetLogPath : WideString; + function GetGameSharedPath : WideString; + function GetGameUserPath : WideString; end; - -var - Platform : IPlatform; + function Platform : IPlatform; implementation @@ -69,48 +51,30 @@ uses UPlatformMacOSX; {$ENDIF} -{ TPlatform } -(* -function TPlatform.GetGamePath: WideString; -begin - // Windows and Linux use this: - Result := ExtractFilePath(ParamStr(0)); -end; -*) -function TPlatform.GetLogPath : WideString; -begin - result := ExtractFilePath(ParamStr(0)); -end; - -function TPlatform.GetGameSharedPath : WideString; -begin - result := ExtractFilePath(ParamStr(0)); -end; +// I have modified it to use the Platform_singleton in this location ( in the implementaiton ) +// so that this variable can NOT be overwritten from anywhere else in the application. +// the accessor function platform, emulates all previous calls to work the same way. +var + Platform_singleton : IPlatform; -function TPlatform.GetGameUserPath : WideString; +function Platform : IPlatform; begin - result := ExtractFilePath(ParamStr(0)); + result := Platform_singleton; end; -function TPlatform.TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; -begin - // Linux and Mac don't check for running apps at the moment - Result := false; -end; initialization - {$IFDEF MSWINDOWS} - Platform := TPlatformWindows.Create; + Platform_singleton := TPlatformWindows.Create; {$ENDIF} {$IFDEF LINUX} - Platform := TPlatformLinux.Create; + Platform_singleton := TPlatformLinux.Create; {$ENDIF} {$IFDEF DARWIN} - Platform := TPlatformMacOSX.Create; + Platform_singleton := TPlatformMacOSX.Create; {$ENDIF} finalization - Platform := nil; + Platform_singleton := nil; end. diff --git a/Game/Code/Classes/UPlatformLinux.pas b/Game/Code/Classes/UPlatformLinux.pas index 0098baee..cde737b6 100644 --- a/Game/Code/Classes/UPlatformLinux.pas +++ b/Game/Code/Classes/UPlatformLinux.pas @@ -12,7 +12,7 @@ uses Classes, UPlatform; type - TPlatformLinux = class(TPlatform) + TPlatformLinux = class(TInterfacedObject, IPlatform) function get_homedir(): string; public Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override; diff --git a/Game/Code/Classes/UPlatformMacOSX.pas b/Game/Code/Classes/UPlatformMacOSX.pas index a418919c..97c32fe3 100644 --- a/Game/Code/Classes/UPlatformMacOSX.pas +++ b/Game/Code/Classes/UPlatformMacOSX.pas @@ -12,13 +12,20 @@ uses Classes, UPlatform; type - TPlatformMacOSX = class(TPlatform) + TPlatformMacOSX = class( TInterfacedObject, IPlatform) private public +<<<<<<< .mine + Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override; + function GetGamePath: WideString; override; + function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; + procedure halt(); +======= function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override; function GetLogPath : WideString; override; function GetGameSharedPath : WideString; override; function GetGameUserPath : WideString; override; +>>>>>>> .r788 end; implementation @@ -100,4 +107,15 @@ begin FPCloseDir(TheDir); end; +function TPlatformMacOSX.TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; +begin + result := false; +end; + + +procedure TPlatformMacOSX.halt; +begin + halt; +end; + end. diff --git a/Game/Code/Classes/UPlatformWindows.pas b/Game/Code/Classes/UPlatformWindows.pas index 93e72e7a..d4ba757a 100644 --- a/Game/Code/Classes/UPlatformWindows.pas +++ b/Game/Code/Classes/UPlatformWindows.pas @@ -8,19 +8,30 @@ interface {$I switches.inc} -uses Classes, UPlatform; +uses Classes, + UPlatform; type - TPlatformWindows = class(TPlatform) + TPlatformWindows = class( TInterfacedObject, IPlatform) public - Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override; - function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; override; + Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; + function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; + function GetGamePath: WideString; + function FindSongFile(Dir, Mask: widestring): widestring; + + procedure halt; + + function GetLogPath : WideString; + function GetGameSharedPath : WideString; + function GetGameUserPath : WideString; end; implementation -uses SysUtils, Windows; +uses SysUtils, + Windows, + Forms; type @@ -175,4 +186,42 @@ begin FindCloseW(SR); end; +function TPlatformWindows.GetGamePath: WideString; +begin + // Windows and Linux use this: + Result := ExtractFilePath(ParamStr(0)); +end; + +procedure TPlatformWindows.halt; +begin + application.terminate; +end; + +function TPlatformWindows.GetLogPath : WideString; +begin + result := ExtractFilePath(ParamStr(0)); +end; + +function TPlatformWindows.GetGameSharedPath : WideString; +begin + result := ExtractFilePath(ParamStr(0)); +end; + +function TPlatformWindows.GetGameUserPath : WideString; +begin + result := ExtractFilePath(ParamStr(0)); +end; + + function TPlatformWindows.FindSongFile(Dir, Mask: widestring): widestring; + var + SR: TSearchRec; // for parsing song directory +begin + Result := ''; + if SysUtils.FindFirst(Dir + Mask, faDirectory, SR) = 0 then begin + Result := SR.Name; + end; // if + SysUtils.FindClose(SR); +end; + + end. diff --git a/Game/Code/Classes/URecord.pas b/Game/Code/Classes/URecord.pas index dee1a687..ab351f6e 100644 --- a/Game/Code/Classes/URecord.pas +++ b/Game/Code/Classes/URecord.pas @@ -14,7 +14,9 @@ uses Classes, UCommon, UMusic, UIni; - + +// http://www.poltran.com + type TSound = class BufferNew: TMemoryStream; // buffer for newest sample @@ -26,7 +28,7 @@ type // pitch detection SzczytJest: boolean; // czy jest szczyt - Szczyt: integer; // pozycja szczytu na osi poziomej + pivot : integer; // Position of summit (top) on horizontal pivot TonDokl: real; // ton aktualnego szczytu Ton: integer; // ton bez ulamka TonGamy: integer; // ton w gamie. wartosci: 0-11 @@ -34,8 +36,8 @@ type // procedures procedure ProcessNewBuffer; - procedure AnalizujBufor; // use to analyze sound from buffers to get new pitch - procedure AnalizujByAutocorrelation; // we call it to analyze sound by checking Autocorrelation + procedure AnalyzeBuffer; // use to analyze sound from buffers to get new pitch + procedure AnalyzeByAutocorrelation; // we call it to analyze sound by checking Autocorrelation function AnalyzeAutocorrelationFreq(Freq: real): real; // use this to check one frequency by Autocorrelation end; @@ -54,31 +56,46 @@ type CaptureSoundRight: TSound; // sound(-buffer) used for right channel capture data end; - TRecord = class + TAudioInputProcessor = class Sound: array of TSound; SoundCard: array of TGenericSoundCard; + constructor Create; - + // handle microphone input procedure HandleMicrophoneData(Buffer: Pointer; Length: Cardinal; - InputDevice: TGenericSoundCard); + InputDevice: TGenericSoundCard); + + function volume( aChannel : byte ): byte; end; smallintarray = array [0..maxInt shr 1-1] of smallInt; psmallintarray = ^smallintarray; -var - Poz: integer; - Recording: TRecord; + function AudioInputProcessor(): TAudioInputProcessor; implementation uses UMain; +var + singleton_AudioInputProcessor : TAudioInputProcessor = nil; + + // FIXME: Race-Conditions between Callback-thread and main-thread // on BufferArray (maybe BufferNew also). // Use SDL-mutexes to solve this problem. + +function AudioInputProcessor(): TAudioInputProcessor; +begin + if singleton_AudioInputProcessor = nil then + singleton_AudioInputProcessor := TAudioInputProcessor.create(); + + result := singleton_AudioInputProcessor; + +end; + procedure TSound.ProcessNewBuffer; var S: integer; @@ -108,12 +125,12 @@ begin end; end; -procedure TSound.AnalizujBufor; +procedure TSound.AnalyzeBuffer; begin - AnalizujByAutocorrelation; + AnalyzeByAutocorrelation; end; -procedure TSound.AnalizujByAutocorrelation; +procedure TSound.AnalyzeByAutocorrelation; var T: integer; // tone F: real; // freq @@ -143,7 +160,7 @@ begin // analyze all 12 halftones for T := 0 to 35 do // to 11, then 23, now 35 (for Whitney and my high voice) begin - F := 130.81*Power(1.05946309436, T)/2; // let's analyze below 130.81 + F := 130.81 * Power(1.05946309436, T)/2; // let's analyze below 130.81 Wages[T] := AnalyzeAutocorrelationFreq(F); if Wages[T] > MaxW then @@ -164,8 +181,8 @@ begin if MaxV >= Threshold then begin // found acceptable volume // 0.1 SzczytJest := true; - TonGamy := MaxT mod 12; - Ton := MaxT mod 12; + TonGamy := MaxT mod 12; + Ton := MaxT mod 12; end; end; @@ -206,8 +223,7 @@ end; * Length - number of bytes in Buffer * Input - Soundcard-Input used for capture *} -procedure TRecord.HandleMicrophoneData(Buffer: Pointer; Length: Cardinal; - InputDevice: TGenericSoundCard); +procedure TAudioInputProcessor.HandleMicrophoneData(Buffer: Pointer; Length: Cardinal; InputDevice: TGenericSoundCard); var L: integer; S: integer; @@ -231,8 +247,14 @@ begin for S := 0 to L-1 do begin I := PSI^[S] * Boost; - if I > 32767 then I := 32767; // 0.5.0: limit - if I < -32768 then I := -32768; // 0.5.0: limit + + // TODO : JB - This will clip the audio... cant we reduce the "Boot" if the data clips ?? + if I > 32767 then + I := 32767; // 0.5.0: limit + + if I < -32768 then + I := -32768; // 0.5.0: limit + PSI^[S] := I; end; @@ -266,12 +288,13 @@ begin end; end; -constructor TRecord.Create; +constructor TAudioInputProcessor.Create; var S: integer; begin SetLength(Sound, 6 {max players});//Ini.Players+1); - for S := 0 to High(Sound) do begin //Ini.Players do begin + for S := 0 to High(Sound) do + begin //Ini.Players do begin Sound[S] := TSound.Create; Sound[S].Num := S; Sound[S].BufferNew := TMemoryStream.Create; @@ -281,6 +304,20 @@ begin end; end; +function TAudioInputProcessor.volume( aChannel : byte ): byte; +var + lCount : Integer; + lMaxVol : double; +begin; + lMaxVol := AudioInputProcessor.Sound[aChannel].BufferArray[1]; + for lCount := 2 to AudioInputProcessor.Sound[aChannel].n div 1 do + begin + if AudioInputProcessor.Sound[aChannel].BufferArray[lCount] > lMaxVol then + lMaxVol := AudioInputProcessor.Sound[aChannel].BufferArray[lCount]; + end; + + result := trunc( ( 255 / 32767 ) * trunc( lMaxVol ) ); +end; end. diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index a4709b43..c5acec9c 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -40,6 +40,7 @@ uses {$IFDEF USE_PSEUDO_THREAD} PseudoThread, {$ENDIF} + USong, UCatCovers; type @@ -55,48 +56,6 @@ type Length: string; end; - TSong = record - Path: widestring; - Folder: widestring; // for sorting by folder - FileName: widestring; - - // sorting methods - Category: array of widestring; // I think I won't need this - Genre: widestring; - Edition: widestring; - Language: widestring; // 0.5.0: new - - Title: widestring; - Artist: widestring; - - Text: widestring; - Creator: widestring; - - Cover: widestring; - CoverTex: TTexture; - Mp3: widestring; - Background: widestring; - Video: widestring; - VideoGAP: real; - VideoLoaded: boolean; // 0.5.0: true if the video has been loaded - NotesGAP: integer; - Start: real; // in seconds - Finish: integer; // in miliseconds - Relative: boolean; - Resolution: integer; - BPM: array of TBPM; - GAP: real; // in miliseconds - - Score: array[0..2] of array of TScore; - - // these are used when sorting is enabled - Visible: boolean; // false if hidden, true if visible - Main: boolean; // false for songs, true for category buttons - OrderNum: integer; // has a number of category for category buttons and songs - OrderTyp: integer; // type of sorting for this button (0=name) - CatNumber: integer; // Count of Songs in Category for Cats and Number of Song in Category for Songs - end; - {$IFDEF USE_PSEUDO_THREAD} TSongs = class( TPseudoThread ) @@ -104,7 +63,6 @@ type TSongs = class( TThread ) {$ENDIF} private - BrowsePos : Integer; //Actual Pos in Song Array. eddie: Must be int, because it could be decremented to -1. fNotify , fWatch : longint; fParseSongDirectory : boolean; @@ -117,9 +75,13 @@ type protected procedure Execute; override; public - Song : array of TSong; // array of songs +// Song : array of TSong; // array of songs + SongList : TList; // array of songs Selected : integer; // selected song index constructor create(); + destructor destroy(); + + procedure LoadSongList; // load all songs procedure BrowseDir(Dir: widestring); // should return number of songs in the future procedure Sort(Order: integer); @@ -127,6 +89,7 @@ type property Processing : boolean read fProcessing; end; + TCatSongs = class Song: array of TSong; // array of categories with songs Selected: integer; // selected song index @@ -150,7 +113,6 @@ type var Songs: TSongs; // all songs CatSongs: TCatSongs; // categorized songs - AktSong: TSong; // one song *unknown use) const IN_ACCESS = $00000001; //* File was accessed */ @@ -187,6 +149,8 @@ begin inherited create( false ); self.freeonterminate := true; + SongList := TList.create(); + {$ifdef Delphi} fDirWatch := TDirectoryWatch.create(nil); fDirWatch.OnChange := DoDirChanged; @@ -218,12 +182,18 @@ begin writeln( 'Calling syscall_nr_inotify_init : '+ inttostr(fWatch) ); *) {$endif} - -{$IFNDEF USE_PSEUDO_THREAD} - Setlength(Song, 0); + +{$IFNDEF USE_PSEUDO_THREAD} +// Setlength(Song, 0); + SongList.clear; {$ENDIF} end; +destructor TSongs.destroy(); +begin + freeandnil( SongList ); +end; + procedure TSongs.DoDirChanged(Sender: TObject); begin LoadSongList(); @@ -237,7 +207,7 @@ begin int_LoadSongList(); {$ELSE} fParseSongDirectory := true; - + while not self.terminated do begin @@ -256,21 +226,15 @@ procedure TSongs.int_LoadSongList; begin try fProcessing := true; - Setlength(Song, 0); + SongList.clear; Log.LogError('SongList', 'Searching For Songs'); - Setlength(Song, 50); - - BrowsePos := 0; // browse directories BrowseDir(SongPath); - + if UserSongPath <> SongPath then BrowseDir(UserSongPath); - - //Set Correct SongArray Length - SetLength(Song, BrowsePos); if assigned( CatSongs ) then CatSongs.Refresh; @@ -287,7 +251,6 @@ begin ScreenSong.OnShow; // refresh ScreenSong end; - finally Log.LogError('SongList', 'Search Complete'); @@ -305,12 +268,13 @@ end; procedure TSongs.BrowseDir(Dir: widestring); var - SLen: integer; - i : Integer; + i : Integer; Files : TDirectoryEntryArray; + lSong : TSong; begin Files := Platform.DirectoryFindFiles( Dir, '.txt', true); + for i := 0 to Length(Files)-1 do begin if Files[i].IsDirectory then @@ -319,37 +283,21 @@ begin end else begin - SLen := BrowsePos; + lSong := TSong.create( Dir + Files[i].Name ); - Song[SLen].Path := Dir; -// Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); - Song[SLen].Folder := Copy(Dir, Length(Dir)+1, 10000); - Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos( PathDelim , Song[SLen].Folder)-1); - Song[SLen].FileName := Files[i].Name; - - if (AnalyseFile(Song[SLen]) = false) then + if NOT lSong.Analyse then begin Log.LogError('AnalyseFile failed for "' + Files[i].Name + '".'); - Dec(BrowsePos); + freeandnil( lSong ); end else begin - if Song[SLen].Cover = '' then - Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg'); + SongList.add( lSong ); end; - //Change Length Only every 50 Entrys - Inc(BrowsePos); - - if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then - begin - SetLength(Song, Length(Song) + 50); - end; end; end; SetLength( Files, 0); - -// Log.LogStatus('Parsing directory: ' + Dir + SR.Name, 'LoadSongList'); end; procedure TSongs.Sort(Order: integer); @@ -361,91 +309,99 @@ begin case Order of sEdition: // by edition begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Edition, Song[S-1].Edition) < 0 then begin + for S2 := 0 to SongList.Count -1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Edition, TSong( SongList[S-1] ).Edition) < 0 then + begin // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; end; end; sGenre: // by genre begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Genre, Song[S-1].Genre) < 0 then begin + for S2 := 0 to SongList.Count-1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Genre, TSong( SongList[S-1] ).Genre) < 0 then + begin // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; end; end; sTitle: // by title begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin + for S2 := 0 to SongList.Count-1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Title, TSong( SongList[S-1] ).Title) < 0 then + begin // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; end; end; sArtist: // by artist begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin + for S2 := 0 to SongList.Count-1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Artist, TSong( SongList[S-1] ).Artist) < 0 then + begin // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; end; end; sFolder: // by folder begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Folder, Song[S-1].Folder) < 0 then begin + for S2 := 0 to SongList.Count-1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Folder, TSong( SongList[S-1] ).Folder) < 0 then + begin // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; end; end; sTitle2: // by title2 begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Title, Song[S-1].Title) < 0 then begin + for S2 := 0 to SongList.Count-1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Title, TSong( SongList[S-1] ).Title) < 0 then + begin // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; end; end; sArtist2: // by artist2 begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Artist, Song[S-1].Artist) < 0 then begin + for S2 := 0 to SongList.Count-1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Artist, TSong( SongList[S-1] ).Artist) < 0 then + begin // zamiana miejscami - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; end; end; sLanguage: // by Language begin - for S2 := 0 to Length(Song)-1 do - for S := 1 to Length(Song)-1 do - if CompareText(Song[S].Language, Song[S-1].Language) < 0 then begin - TempSong := Song[S-1]; - Song[S-1] := Song[S]; - Song[S] := TempSong; + for S2 := 0 to SongList.Count-1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Language, TSong( SongList[S-1] ).Language) < 0 then + begin + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; end; end; @@ -509,12 +465,13 @@ case Ini.Sorting of //Songs leeren SetLength (Song, 0); - for S := Low(Songs.Song) to High(Songs.Song) do begin + for S := 0 to Songs.SongList.Count-1 do + begin if (Ini.Tabs = 1) then - if (Ini.Sorting = sEdition) and (CompareText(SS, Songs.Song[S].Edition) <> 0) then begin + if (Ini.Sorting = sEdition) and (CompareText(SS, TSong( Songs.SongList[S] ).Edition) <> 0) then begin // add Category Button Inc(Order); - SS := Songs.Song[S].Edition; + SS := TSong( Songs.SongList[S] ).Edition; CatLen := Length(CatSongs.Song); SetLength(CatSongs.Song, CatLen+1); CatSongs.Song[CatLen].Artist := '[' + SS + ']'; @@ -554,10 +511,10 @@ case Ini.Sorting of CatSongs.Song[CatLen].Visible := true; end - else if (Ini.Sorting = sGenre) and (CompareText(SS, Songs.Song[S].Genre) <> 0) then begin + else if (Ini.Sorting = sGenre) and (CompareText(SS, TSong( Songs.SongList[S] ).Genre) <> 0) then begin // add Genre Button Inc(Order); - SS := Songs.Song[S].Genre; + SS := TSong( Songs.SongList[S] ).Genre; CatLen := Length(CatSongs.Song); SetLength(CatSongs.Song, CatLen+1); CatSongs.Song[CatLen].Artist := SS; @@ -580,10 +537,10 @@ case Ini.Sorting of CatSongs.Song[CatLen].Visible := true; end - else if (Ini.Sorting = sLanguage) and (CompareText(SS, Songs.Song[S].Language) <> 0) then begin + else if (Ini.Sorting = sLanguage) and (CompareText(SS, TSong( Songs.SongList[S] ).Language) <> 0) then begin // add Language Button Inc(Order); - SS := Songs.Song[S].Language; + SS := TSong( Songs.SongList[S] ).Language; CatLen := Length(CatSongs.Song); SetLength(CatSongs.Song, CatLen+1); CatSongs.Song[CatLen].Artist := SS; @@ -607,11 +564,11 @@ case Ini.Sorting of end else if (Ini.Sorting = sTitle) and - (Length(Songs.Song[S].Title)>=1) and - (Letter <> UpperCase(Songs.Song[S].Title)[1]) then begin + (Length(TSong( Songs.SongList[S] ).Title)>=1) and + (Letter <> UpperCase(TSong( Songs.SongList[S] ).Title)[1]) then begin // add a letter Category Button Inc(Order); - Letter := Uppercase(Songs.Song[S].Title)[1]; + Letter := Uppercase(TSong( Songs.SongList[S] ).Title)[1]; CatLen := Length(CatSongs.Song); SetLength(CatSongs.Song, CatLen+1); CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; @@ -636,10 +593,11 @@ case Ini.Sorting of CatSongs.Song[CatLen].Visible := true; end - else if (Ini.Sorting = sArtist) and (Length(Songs.Song[S].Artist)>=1) and (Letter <> UpperCase(Songs.Song[S].Artist)[1]) then begin + else if (Ini.Sorting = sArtist) and (Length(TSong( Songs.SongList[S] ).Artist)>=1) and + (Letter <> UpperCase(TSong( Songs.SongList[S] ).Artist)[1]) then begin // add a letter Category Button Inc(Order); - Letter := UpperCase(Songs.Song[S].Artist)[1]; + Letter := UpperCase(TSong( Songs.SongList[S] ).Artist)[1]; CatLen := Length(CatSongs.Song); SetLength(CatSongs.Song, CatLen+1); CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; @@ -663,10 +621,10 @@ case Ini.Sorting of CatSongs.Song[CatLen].Visible := true; end - else if (Ini.Sorting = sFolder) and (CompareText(SS, Songs.Song[S].Folder) <> 0) then begin + else if (Ini.Sorting = sFolder) and (CompareText(SS, TSong( Songs.SongList[S] ).Folder) <> 0) then begin // 0.5.0: add folder tab Inc(Order); - SS := Songs.Song[S].Folder; + SS := TSong( Songs.SongList[S] ).Folder; CatLen := Length(CatSongs.Song); SetLength(CatSongs.Song, CatLen+1); CatSongs.Song[CatLen].Artist := SS; @@ -689,8 +647,8 @@ case Ini.Sorting of CatSongs.Song[CatLen].Visible := true; end - else if (Ini.Sorting = sTitle2) AND (Length(Songs.Song[S].Title)>=1) then begin - if (ord(Songs.Song[S].Title[1]) > 47) and (ord(Songs.Song[S].Title[1]) < 58) then Letter2 := '#' else Letter2 := UpperCase(Songs.Song[S].Title)[1]; + else if (Ini.Sorting = sTitle2) AND (Length(TSong( Songs.SongList[S] ).Title)>=1) then begin + if (ord(TSong( Songs.SongList[S] ).Title[1]) > 47) and (ord(TSong( Songs.SongList[S] ).Title[1]) < 58) then Letter2 := '#' else Letter2 := UpperCase(TSong( Songs.SongList[S] ).Title)[1]; if (Letter <> Letter2) then begin // add a letter Category Button Inc(Order); @@ -719,8 +677,8 @@ case Ini.Sorting of end; end - else if (Ini.Sorting = sArtist2) AND (Length(Songs.Song[S].Artist)>=1) then begin - if (ord(Songs.Song[S].Artist[1]) > 47) and (ord(Songs.Song[S].Artist[1]) < 58) then Letter2 := '#' else Letter2 := UpperCase(Songs.Song[S].Artist)[1]; + else if (Ini.Sorting = sArtist2) AND (Length(TSong( Songs.SongList[S] ).Artist)>=1) then begin + if (ord(TSong( Songs.SongList[S] ).Artist[1]) > 47) and (ord(TSong( Songs.SongList[S] ).Artist[1]) < 58) then Letter2 := '#' else Letter2 := UpperCase(TSong( Songs.SongList[S] ).Artist)[1]; if (Letter <> Letter2) then begin // add a letter Category Button Inc(Order); @@ -755,7 +713,7 @@ case Ini.Sorting of Inc (CatNumber); //Increase Number in Cat - CatSongs.Song[CatLen] := Songs.Song[S]; + CatSongs.Song[CatLen] := TSong( Songs.SongList[S] ); CatSongs.Song[CatLen].OrderNum := Order; // assigns category CatSongs.Song[CatLen].CatNumber := CatNumber; @@ -923,4 +881,11 @@ begin end; end; + + +// ----------------------------------------------------------------------------- + + + + end. diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index e370ad67..a523afd2 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -16,6 +16,7 @@ uses UMenu, {$ENDIF} ULog, USongs, + USong, UMusic, UThemes; diff --git a/Game/Code/Screens/UScreenEditHeader.pas b/Game/Code/Screens/UScreenEditHeader.pas index 7c8b2d56..60466a27 100644 --- a/Game/Code/Screens/UScreenEditHeader.pas +++ b/Game/Code/Screens/UScreenEditHeader.pas @@ -4,7 +4,11 @@ interface {$I switches.inc} -uses UMenu, SDL, USongs, UThemes; +uses UMenu, + SDL, + USongs, + USong, + UThemes; type TScreenEditHeader = class(TMenu) diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 725dd4e9..57d6777e 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -15,6 +15,7 @@ uses UFiles, UTime, USongs, + USong, UIni, ULog, UTexture, @@ -143,40 +144,40 @@ begin begin // Increase BPM if SDL_ModState = 0 then - AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 5) + 1) / 5; // (1/20) + CurrentSong.BPM[0].BPM := Round((CurrentSong.BPM[0].BPM * 5) + 1) / 5; // (1/20) if SDL_ModState = KMOD_LSHIFT then - AktSong.BPM[0].BPM := AktSong.BPM[0].BPM + 4; // (1/1) + CurrentSong.BPM[0].BPM := CurrentSong.BPM[0].BPM + 4; // (1/1) if SDL_ModState = KMOD_LCTRL then - AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 25) + 1) / 25; // (1/100) + CurrentSong.BPM[0].BPM := Round((CurrentSong.BPM[0].BPM * 25) + 1) / 25; // (1/100) end; SDLK_MINUS: begin // Decrease BPM if SDL_ModState = 0 then - AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 5) - 1) / 5; + CurrentSong.BPM[0].BPM := Round((CurrentSong.BPM[0].BPM * 5) - 1) / 5; if SDL_ModState = KMOD_LSHIFT then - AktSong.BPM[0].BPM := AktSong.BPM[0].BPM - 4; + CurrentSong.BPM[0].BPM := CurrentSong.BPM[0].BPM - 4; if SDL_ModState = KMOD_LCTRL then - AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 25) - 1) / 25; + CurrentSong.BPM[0].BPM := Round((CurrentSong.BPM[0].BPM * 25) - 1) / 25; end; SDLK_0: begin // Increase GAP if SDL_ModState = 0 then - AktSong.GAP := AktSong.GAP + 10; + CurrentSong.GAP := CurrentSong.GAP + 10; if SDL_ModState = KMOD_LSHIFT then - AktSong.GAP := AktSong.GAP + 1000; + CurrentSong.GAP := CurrentSong.GAP + 1000; end; SDLK_9: begin // Decrease GAP if SDL_ModState = 0 then - AktSong.GAP := AktSong.GAP - 10; + CurrentSong.GAP := CurrentSong.GAP - 10; if SDL_ModState = KMOD_LSHIFT then - AktSong.GAP := AktSong.GAP - 1000; + CurrentSong.GAP := CurrentSong.GAP - 1000; end; SDLK_KP_PLUS: @@ -222,13 +223,13 @@ begin begin // Save Song if SDL_ModState = KMOD_LSHIFT then - SaveSong(AktSong, Czesci[0], Path + FileName, true) + SaveSong(CurrentSong, Czesci[0], Path + FileName, true) else - SaveSong(AktSong, Czesci[0], Path + FileName, false); + SaveSong(CurrentSong, Czesci[0], Path + FileName, false); {if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL + KMOD_LALT then // Save Song - SaveSongDebug(AktSong, Czesci[0], 'C:\song.asm', false);} + SaveSongDebug(CurrentSong, Czesci[0], 'C:\song.asm', false);} end; @@ -656,7 +657,7 @@ var C: integer; N: integer; begin - AktSong.BPM[0].BPM := AktSong.BPM[0].BPM / 2; + CurrentSong.BPM[0].BPM := CurrentSong.BPM[0].BPM / 2; for C := 0 to Czesci[0].High do begin Czesci[0].Czesc[C].Start := Czesci[0].Czesc[C].Start div 2; Czesci[0].Czesc[C].StartNote := Czesci[0].Czesc[C].StartNote div 2; @@ -673,7 +674,7 @@ var C: integer; N: integer; begin - AktSong.BPM[0].BPM := AktSong.BPM[0].BPM * 2; + CurrentSong.BPM[0].BPM := CurrentSong.BPM[0].BPM * 2; for C := 0 to Czesci[0].High do begin Czesci[0].Czesc[C].Start := Czesci[0].Czesc[C].Start * 2; Czesci[0].Czesc[C].StartNote := Czesci[0].Czesc[C].StartNote * 2; @@ -1160,7 +1161,7 @@ begin try ResetSingTemp; - Error := not LoadSong(Path + FileName); +// Error := not LoadSong(Path + FileName); // todo - JB come back to this except Error := True; end; @@ -1179,15 +1180,15 @@ begin MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table MidiOut.Open; {$ENDIF} - Text[TextTitle].Text := AktSong.Title; - Text[TextArtist].Text := AktSong.Artist; - Text[TextMp3].Text := AktSong.Mp3; + Text[TextTitle].Text := CurrentSong.Title; + Text[TextArtist].Text := CurrentSong.Artist; + Text[TextMp3].Text := CurrentSong.Mp3; Czesci[0].Akt := 0; AktNuta := 0; Czesci[0].Czesc[0].Nuta[0].Color := 1; - AudioPlayback.Open(Path + AktSong.Mp3); + AudioPlayback.Open(Path + CurrentSong.Mp3); //Set Down Music Volume for Better hearability of Midi Sounds //Music.SetVolume(40); @@ -1238,7 +1239,7 @@ begin {$ENDIF} // click - AktBeat := Floor(GetMidBeat(MidiPos - AktSong.GAP / 1000)); + AktBeat := Floor(GetMidBeat(MidiPos - CurrentSong.GAP / 1000)); Text[TextDebug].Text := IntToStr(AktBeat); if AktBeat <> LastClick then begin @@ -1269,8 +1270,8 @@ begin // click if (Click) and (PlaySentence) then begin -// AktBeat := Floor(AktSong.BPM[0].BPM * (Music.Position - AktSong.GAP / 1000) / 60); - AktBeat := Floor(GetMidBeat(AudioPlayback.Position - AktSong.GAP / 1000)); +// AktBeat := Floor(CurrentSong.BPM[0].BPM * (Music.Position - CurrentSong.GAP / 1000) / 60); + AktBeat := Floor(GetMidBeat(AudioPlayback.Position - CurrentSong.GAP / 1000)); Text[TextDebug].Text := IntToStr(AktBeat); if AktBeat <> LastClick then begin for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do @@ -1288,8 +1289,8 @@ begin Text[TextNote].Text := IntToStr(AktNuta + 1) + ' / ' + IntToStr(Czesci[0].Czesc[Czesci[0].Akt].IlNut); // Song info - Text[TextBPM].Text := FloatToStr(AktSong.BPM[0].BPM / 4); - Text[TextGAP].Text := FloatToStr(AktSong.GAP); + Text[TextBPM].Text := FloatToStr(CurrentSong.BPM[0].BPM / 4); + Text[TextGAP].Text := FloatToStr(CurrentSong.GAP); //Error reading Variables when no Song is loaded if not Error then diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 5f7a0461..a4dc5f0d 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -124,7 +124,7 @@ begin //Solo if (Interaction = 0) then begin - if (Length(Songs.Song) >= 1) then + if (Songs.SongList.Count >= 1) then begin AudioPlayback.PlayStart; if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1; @@ -138,8 +138,9 @@ begin end; //Multi - if Interaction = 1 then begin - if (Length(Songs.Song) >= 1) then + if Interaction = 1 then + begin + if (Songs.SongList.Count >= 1) then begin if (Length(DLLMan.Plugins)>=1) then begin diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index 80259802..42776717 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -15,14 +15,21 @@ type SelectSlideChannelR: integer; public constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - procedure onShow; override; - procedure UpdateCard; + function Draw: boolean; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure UpdateCard; end; implementation -uses SysUtils, UGraphic, URecord, ULog; +uses SysUtils, + UGraphic, + URecord, + UDraw, + UMain, + ULog; function TScreenOptionsRecord.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -43,7 +50,7 @@ begin end; SDLK_RETURN: begin - if SelInteraction = 4 then begin + if SelInteraction = 5 then begin Ini.Save; AudioPlayback.PlayBack; FadeTo(@ScreenOptions); @@ -55,19 +62,21 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + if (SelInteraction >= 0) and (SelInteraction <= 4) then begin AudioPlayback.PlayOption; InteractInc; end; - if SelInteraction = 0 then UpdateCard; +// if SelInteraction = 0 then UpdateCard; + UpdateCard; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + if (SelInteraction >= 0) and (SelInteraction <= 4) then begin AudioPlayback.PlayOption; InteractDec; end; - if SelInteraction = 0 then UpdateCard; + UpdateCard; +// if SelInteraction = 0 then UpdateCard; end; end; end; @@ -80,22 +89,27 @@ var SCI: integer; begin inherited Create; - + LoadFromTheme(Theme.OptionsRecord); - SetLength(ICard, Length(Recording.SoundCard)); - for SC := 0 to High(Recording.SoundCard) do - ICard[SC] := Recording.SoundCard[SC].Description; + SetLength(ICard, Length(AudioInputProcessor.SoundCard)); + for SC := 0 to High(AudioInputProcessor.SoundCard) do + ICard[SC] := AudioInputProcessor.SoundCard[SC].Description; + + if (Length(AudioInputProcessor.SoundCard) > 0) then + begin + SetLength(IInput, Length(AudioInputProcessor.SoundCard[Ini.Card].Input)); + for SCI := 0 to High(AudioInputProcessor.SoundCard[Ini.Card].Input) do + IInput[SCI] := AudioInputProcessor.SoundCard[Ini.Card].Input[SCI].Name; - if (Length(Recording.SoundCard) > 0) then begin - SetLength(IInput, Length(Recording.SoundCard[Ini.Card].Input)); - for SCI := 0 to High(Recording.SoundCard[Ini.Card].Input) do - IInput[SCI] := Recording.SoundCard[Ini.Card].Input[SCI].Name; AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, Ini.Card, ICard); + SelectSlideInput := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, Ini.CardList[0].Input, IInput); SelectSlideChannelL := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelL, Ini.CardList[0].ChannelL, IChannel); SelectSlideChannelR := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelR, Ini.CardList[0].ChannelR, IChannel); + + AddSelect(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost); end; AddButton(Theme.OptionsRecord.ButtonExit); @@ -108,6 +122,16 @@ end; procedure TScreenOptionsRecord.onShow; begin Interaction := 0; + writeln( 'AudioInput.CaptureStart') ; + + PlayersPlay := 2; // TODO : This needs fixing + AudioInput.CaptureStart; + +end; + +procedure TScreenOptionsRecord.onHide; +begin + AudioInput.CaptureStop; end; procedure TScreenOptionsRecord.UpdateCard; @@ -115,18 +139,74 @@ var SC: integer; SCI: integer; begin - SC := Ini.Card; -// if SC = 1 then beep; + writeln( 'Update Card') ; + AudioInput.CaptureStop; + try + SC := Ini.Card; + // if SC = 1 then beep; + + SetLength(IInput, Length(AudioInputProcessor.SoundCard[SC].Input)); + for SCI := 0 to High(AudioInputProcessor.SoundCard[SC].Input) do begin + IInput[SCI] := AudioInputProcessor.SoundCard[SC].Input[SCI].Name; + // Log.LogError(IInput[SCI]); + end; - SetLength(IInput, Length(Recording.SoundCard[SC].Input)); - for SCI := 0 to High(Recording.SoundCard[SC].Input) do begin - IInput[SCI] := Recording.SoundCard[SC].Input[SCI].Name; -// Log.LogError(IInput[SCI]); + + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideInput, SelectSlideInput, IInput, Ini.CardList[SC].Input); + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelL, SelectSlideChannelL, IChannel, Ini.CardList[SC].ChannelL); + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelR, SelectSlideChannelR, IChannel, Ini.CardList[SC].ChannelR); + + finally + AudioInput.CaptureStart; end; +end; - UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideInput, SelectSlideInput, IInput, Ini.CardList[SC].Input); - UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelL, SelectSlideChannelL, IChannel, Ini.CardList[SC].ChannelL); - UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelR, SelectSlideChannelR, IChannel, Ini.CardList[SC].ChannelR); +function TScreenOptionsRecord.Draw: boolean; +begin + DrawBG; + DrawFG; + + // TODO : this needs to be positioned correctly + if PlayersPlay = 1 then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + + if PlayersPlay = 2 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + if ScreenAct = 2 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 2); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 3); + end; + end; + + if PlayersPlay = 3 then begin + SingDrawOscilloscope(75 + 10*ScreenX, 95, 100, 20, 0); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 0); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + if ScreenAct = 2 then begin + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 3); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 4); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 5); + end; + end; + + Result := True; end; + end. diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index 867a10b6..64a0413f 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -51,14 +51,14 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + if (SelInteraction >= 0) and (SelInteraction <= 6) then begin AudioPlayback.PlayOption; InteractInc; end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + if (SelInteraction >= 0) and (SelInteraction <= 6) then begin AudioPlayback.PlayOption; InteractDec; end; @@ -75,15 +75,14 @@ begin LoadFromTheme(Theme.OptionsSound); - AddSelect(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost); + AddSelect(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost); // TODO - This need moving to ScreenOptionsRecord AddSelect(Theme.OptionsSound.SelectClickAssist, Ini.ClickAssist, IClickAssist); AddSelect(Theme.OptionsSound.SelectBeatClick, Ini.BeatClick, IBeatClick); AddSelect(Theme.OptionsSound.SelectThreshold, Ini.Threshold, IThreshold); //Song Preview AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewVolume, Ini.PreviewVolume, IPreviewVolume); - AddSelectSlide - (Theme.OptionsSound.SelectSlidePreviewFading, Ini.PreviewFading, IPreviewFading); + AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewFading, Ini.PreviewFading, IPreviewFading); AddButton(Theme.OptionsSound.ButtonExit); if (Length(Button[0].Text)=0) then diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 84fd4e15..c53844f5 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -304,9 +304,9 @@ begin // Singstar Fadeout := false; - Text[TextArtist].Text := AktSong.Artist; - Text[TextTitle].Text := AktSong.Title; - Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; + Text[TextArtist].Text := CurrentSong.Artist; + Text[TextTitle].Text := CurrentSong.Title; + Text[TextArtistTitle].Text := CurrentSong.Artist + ' - ' + CurrentSong.Title; // set visibility case PlayersPlay of diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 5a9ecae7..adfc4d2c 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -101,22 +101,29 @@ type fCurrentVideoPlaybackEngine : IVideoPlayback; constructor Create; override; - procedure onShow; override; - procedure onShowFinish; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure Finish; virtual; - procedure UpdateLCD; - procedure Pause; //Pause Mod(Toggles Pause) - - //OnSentenceEnd for LineBonus + Singbar - procedure onSentenceEnd(S: Cardinal); - //OnSentenceChange (for Golden Notes) - procedure onSentenceChange(S: Cardinal); + procedure onShow; override; + procedure onShowFinish; override; + + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + + procedure Finish; virtual; + procedure UpdateLCD; + procedure Pause; //Pause Mod(Toggles Pause) + + procedure onSentenceEnd(S: Cardinal); //OnSentenceEnd for LineBonus + Singbar + procedure onSentenceChange(S: Cardinal); //OnSentenceChange (for Golden Notes) end; implementation -uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math; + +uses UGraphic, + UDraw, + UMain, + Classes, + URecord, + ULanguage, + math; // Method for input parsing. If False is returned, GetNextWindow // should be checked to know the next window to load; @@ -204,7 +211,7 @@ begin AudioPlayback.Pause; // pause Video - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then fCurrentVideoPlaybackEngine.Pause; end @@ -218,7 +225,7 @@ begin AudioPlayback.Play; // Video - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then fCurrentVideoPlaybackEngine.Pause; Paused := false; @@ -425,12 +432,13 @@ begin {Static[StaticP3RScoreBG].Visible := V3R; Text[TextP3RScore].Visible := V3R; } - // load notes ResetSingTemp; // Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); - AktSong := CatSongs.Song[CatSongs.Selected]; + CurrentSong := CatSongs.Song[CatSongs.Selected]; + try - if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName) then + if not CurrentSong.LoadSong then +// if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName) then begin //Error Loading Song -> Go back to Song Screen and Show some Error Message FadeTo(@ScreenSong); @@ -449,26 +457,26 @@ begin ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); Exit; end; - AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; -// AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed + CurrentSong.Path := CatSongs.Song[CatSongs.Selected].Path; +// CurrentSong.GAP := CurrentSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / CurrentSong.BPM[0].BPM / 2; // temporary until UMain will be fixed // set movie - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then begin // todo: VideoGap and Start time verwursten - fCurrentVideoPlaybackEngine.Open( AktSong.Path + AktSong.Video ); + fCurrentVideoPlaybackEngine.Open( CurrentSong.Path + CurrentSong.Video ); - fCurrentVideoPlaybackEngine.position := AktSong.VideoGAP + AktSong.Start; + fCurrentVideoPlaybackEngine.position := CurrentSong.VideoGAP + CurrentSong.Start; - AktSong.VideoLoaded := true; + CurrentSong.VideoLoaded := true; end; // set background - if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then + if (CurrentSong.Background <> '') and (CurrentSong.VideoLoaded = false) then try - Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background); + Tex_Background := Texture.LoadTexture(CurrentSong.Path + CurrentSong.Background); except - log.LogError('Background could not be loaded: ' + AktSong.Path + AktSong.Background); + log.LogError('Background could not be loaded: ' + CurrentSong.Path + CurrentSong.Background); Tex_Background.TexNum := -1; end else @@ -478,20 +486,20 @@ begin // play music (I) AudioInput.CaptureStart; - AudioPlayback.Position := AktSong.Start; + AudioPlayback.Position := CurrentSong.Start; // Music.Play; // prepare timer (I) // CountSkipTimeSet; - Czas.Teraz := AktSong.Start; + Czas.Teraz := CurrentSong.Start; Czas.Razem := AudioPlayback.Length; - if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000; + if (CurrentSong.Finish > 0) then Czas.Razem := CurrentSong.Finish / 1000; Czas.OldBeat := -1; for P := 0 to High(Player) do ClearScores(P); // main text - Lyrics.Clear (AktSong.BPM[0].BPM, AktSong.Resolution); + Lyrics.Clear (CurrentSong.BPM[0].BPM, CurrentSong.Resolution); // set custom options case Ini.LyricsFont of @@ -870,7 +878,7 @@ procedure TScreenSing.onShowFinish; begin // play movie (II) - if AktSong.VideoLoaded then + if CurrentSong.VideoLoaded then begin try writeln( 'VideoPlayback.FFmpegGetFrame' ); @@ -884,11 +892,11 @@ begin on E : Exception do begin //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video - AktSong.VideoLoaded := False; + CurrentSong.VideoLoaded := False; Log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); Log.LogError('Error Message : '+ E.message ); Log.LogError(' In : '+ E.ClassName +' (TScreenSing.onShowFinish)' ); - Log.LogError('Corrupted File: ' + AktSong.Video); + Log.LogError('Corrupted File: ' + CurrentSong.Video); try // CloseSmpeg; fCurrentVideoPlaybackEngine.Close; @@ -1141,7 +1149,8 @@ begin SingDrawBackground; // update and draw movie - if ShowFinish and ( AktSong.VideoLoaded or fShowVisualization ) then + if ShowFinish and + ( CurrentSong.VideoLoaded or fShowVisualization ) then // if ShowFinish then begin // try @@ -1161,12 +1170,12 @@ begin begin //If an Error occurs drawing: prevent Video from being Drawn again and Close Video - AktSong.VideoLoaded := False; + CurrentSong.VideoLoaded := False; log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); Log.LogError('Error Message : '+ E.message ); Log.LogError(' In : '+ E.ClassName +' (TScreenSing.Draw)' ); - Log.LogError('Corrupted File: ' + AktSong.Video); + Log.LogError('Corrupted File: ' + CurrentSong.Video); try // CloseSmpeg; fCurrentVideoPlaybackEngine.Close; @@ -1183,9 +1192,9 @@ begin DrawFG; // check for music finish -// Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(AktSong.Finish)); +// Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(CurrentSong.Finish)); if ShowFinish then begin - if (not AudioPlayback.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + if (not AudioPlayback.Finished) and ((CurrentSong.Finish = 0) or (Czas.Teraz*1000 <= CurrentSong.Finish)) then begin //Pause Mod: if not Paused then Sing(Self); // analyze song @@ -1251,11 +1260,11 @@ begin Log.LogBenchmark('Creating files', 0); end; - if AktSong.VideoLoaded then + if CurrentSong.VideoLoaded then begin // CloseSmpeg; fCurrentVideoPlaybackEngine.Close; - AktSong.VideoLoaded := false; // to prevent drawing closed video + CurrentSong.VideoLoaded := false; // to prevent drawing closed video end; SetFontItalic (False); diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 5d87ffdd..7d2eba07 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -520,7 +520,7 @@ end; // comment by blindy: wo zum henker wird denn in diesem screen ein video abgespielt? // update and draw movie // wie wo wadd? also in der selben funktion in der uscreensing kommt des video in der zeile 995, oder was wollteste wissen? :X -{ if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin +{ if ShowFinish and CurrentSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin UpdateSmpeg; // this only draws end;} @@ -530,7 +530,7 @@ end; if ShowFinish then begin if DllMan.Selected.LoadSong then begin - if (not AudioPlayback.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + if (not AudioPlayback.Finished) and ((CurrentSong.Finish = 0) or (Czas.Teraz*1000 <= CurrentSong.Finish)) then begin //Pause Mod: if not Paused then Sing(Self); // analyze song diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 4f90e2ca..4b42288a 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -383,7 +383,7 @@ begin end; SDLK_RETURN: begin - if Length(Songs.Song) > 0 then + if Songs.SongList.Count > 0 then begin {$IFDEF UseSerialPort} // PortWriteB($378, 0); @@ -438,7 +438,7 @@ begin SDLK_M: //Show SongMenu begin - if (Length(Songs.Song) > 0) then begin + if (Songs.SongList.Count > 0) then begin if (Mode = 0) then begin if not CatSongs.Song[Interaction].Main then begin // clicked on Song if CatSongs.CatNumShow = -3 then @@ -457,14 +457,14 @@ begin SDLK_P: //Show Playlist Menu begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + if (Songs.SongList.Count > 0) AND (Mode = 0) then begin ScreenSongMenu.MenuShow(SM_Playlist_Load); end; end; SDLK_J: //Show Jumpto Menu begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then + if (Songs.SongList.Count > 0) AND (Mode = 0) then begin ScreenSongJumpto.Visible := True; end; @@ -553,7 +553,7 @@ begin SDLK_RIGHT: begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then + if (Songs.SongList.Count > 0) AND (Mode = 0) then begin AudioPlayback.PlayChange; SelectNext; @@ -568,7 +568,7 @@ begin SDLK_LEFT: begin - if (Length(Songs.Song) > 0)AND (Mode = 0) then begin + if (Songs.SongList.Count > 0)AND (Mode = 0) then begin AudioPlayback.PlayChange; SelectPrev; ChangeMusic; @@ -585,7 +585,7 @@ begin SDLK_R: begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + if (Songs.SongList.Count > 0) AND (Mode = 0) then begin if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category begin @@ -1819,7 +1819,7 @@ begin EqualizerTime := A; Data := AudioPlayback.GetFFTData; - B:=0; + B := 0; Pos := 0; Res := ceil(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band @@ -2121,7 +2121,7 @@ end; procedure TScreenSong.OpenEditor; begin - if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then + if (Songs.SongList.Count > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin AudioPlayback.Stop; AudioPlayback.PlayStart; 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; diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas index bf19fed2..207f6ee6 100644 --- a/Game/Code/Screens/UScreenTop5.pas +++ b/Game/Code/Screens/UScreenTop5.pas @@ -92,29 +92,29 @@ var begin Fadeout := false; - //ReadScore(AktSong); + //ReadScore(CurrentSong); PMax := Ini.Players; if Ini.Players = 4 then Ini.Players := 5; for I := 0 to PMax do - DataBase.AddScore(AktSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalI)); + DataBase.AddScore(CurrentSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalI)); - DataBase.WriteScore(AktSong); - DataBase.ReadScore(AktSong); + DataBase.WriteScore(CurrentSong); + DataBase.ReadScore(CurrentSong); - Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; + Text[TextArtistTitle].Text := CurrentSong.Artist + ' - ' + CurrentSong.Title; - for I := 1 to Length(AktSong.Score[Ini.Difficulty]) do begin + for I := 1 to Length(CurrentSong.Score[Ini.Difficulty]) do begin Static[StaticNumber[I]].Visible := true; Text[TextNumber[I]].Visible := true; Text[TextName[I]].Visible := true; Text[TextScore[I]].Visible := true; - Text[TextName[I]].Text := AktSong.Score[Ini.Difficulty, I-1].Name; - Text[TextScore[I]].Text := IntToStr(AktSong.Score[Ini.Difficulty, I-1].Score); + Text[TextName[I]].Text := CurrentSong.Score[Ini.Difficulty, I-1].Name; + Text[TextScore[I]].Text := IntToStr(CurrentSong.Score[Ini.Difficulty, I-1].Score); end; - for I := Length(AktSong.Score[Ini.Difficulty])+1 to 5 do begin + for I := Length(CurrentSong.Score[Ini.Difficulty])+1 to 5 do begin Static[StaticNumber[I]].Visible := false; Text[TextNumber[I]].Visible := false; Text[TextName[I]].Visible := false; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 236d0b1e..ca639d1e 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -87,6 +87,7 @@ uses URecord in 'Classes\URecord.pas', UTime in 'Classes\UTime.pas', TextGL in 'Classes\TextGL.pas', + USong in 'Classes\USong.pas', USongs in 'Classes\USongs.pas', UIni in 'Classes\UIni.pas', ULyrics in 'Classes\ULyrics.pas', -- cgit v1.2.3 From 19ab8eded9d18e077906fd716ab25992eba1767d Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sat, 12 Jan 2008 12:44:09 +0000 Subject: removed big ugly commented out code.. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@790 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UFiles.pas | 328 +------------------------------------------ 1 file changed, 1 insertion(+), 327 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index d3e4729b..b65dcbf2 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -13,21 +13,9 @@ uses SysUtils, USongs, USong; -//procedure InitializePaths; //Function sets All Absolute Paths eg. for Songs -//function ReadTXTHeader(var Song: TSong): boolean; //Reads Standard TXT Header -//function AnalyseFile(var Song: TSong): boolean; //Analyse Song File and Read Header -//procedure ClearSong(var Song: TSong); //Clears Song Header values - -//Methodes Loading and Saving Songfiles procedure ResetSingTemp; -//procedure ParseNote(NrCzesci: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string); -//procedure NewSentence(NrCzesciP: integer; Param1, Param2: integer); - -//function LoadSong(Name: string): boolean; function SaveSong(Song: TSong; Czesc: TCzesci; Name: string; Relative: boolean): boolean; - - var SongFile: TextFile; // all procedures in this unit operates on this file FileLineNo: integer; //Line which is readed at Last, for error reporting @@ -44,321 +32,7 @@ uses TextGL, UIni, UPlatform, UMain; - -(* -//-------------------- -<<<<<<< .mine -======= -// Clears Song Header values -//-------------------- -procedure ClearSong(var Song: TSong); -begin - //Main Information - Song.Title := ''; - Song.Artist := ''; - - //Sortings: - Song.Genre := 'Unknown'; - Song.Edition := 'Unknown'; - Song.Language := 'Unknown'; //Language Patch - - //Required Information - Song.Mp3 := ''; - {$IFDEF FPC} - setlength( Song.BPM, 0 ); - {$ELSE} - Song.BPM := 0; - {$ENDIF} - - Song.GAP := 0; - Song.Start := 0; - Song.Finish := 0; - - //Additional Information - Song.Background := ''; - Song.Cover := ''; - Song.Video := ''; - Song.VideoGAP := 0; - Song.NotesGAP := 0; - Song.Resolution := 4; - Song.Creator := ''; -end; - -//-------------------- -// Reads Standard TXT Header -//-------------------- -function ReadTXTHeader(var Song: TSong): boolean; -var - Line, Identifier, Value: String; - Temp: word; - Done: byte; -begin - Result := true; - Done := 0; - - //Read first Line - ReadLn (SongFile, Line); - - if (Length(Line)<=0) then - begin - Log.LogError('File Starts with Empty Line: ' + Song.FileName); - Result := False; - Exit; - end; - - //Read Lines while Line starts with # - While (Length(Line) = 0) OR (Line[1] = '#') do - begin - //Increase Line Number - Inc (FileLineNo); - Temp := Pos(':', Line); - - //Line has a Seperator-> Headerline - if (Temp <> 0) then - begin - //Read Identifier and Value - Identifier := Uppercase(Trim(Copy(Line, 2, Temp - 2))); //Uppercase is for Case Insensitive Checks - Value := Trim(Copy(Line, Temp + 1,Length(Line) - Temp)); - - //Check the Identifier (If Value is given) - if (Length(Value) <> 0) then - begin - - {$IFDEF DARWIN} - if ((Identifier = 'MP3') or (Identifier = 'COVER') or (Identifier = 'BACKGROUND') or (Identifier = 'VIDEO')) then - begin - // Filenames on OS X must be UTF8: - Value := Utf8Encode(Value); - end; - {$ENDIF} - - - //----------- - //Required Attributes - //----------- - - //Title - if (Identifier = 'TITLE') then - begin - Song.Title := Value; - - //Add Title Flag to Done - Done := Done or 1; - end - - //Artist - else if (Identifier = 'ARTIST') then - begin - Song.Artist := Value; - - //Add Artist Flag to Done - Done := Done or 2; - end - - //MP3 File //Test if Exists - else if (Identifier = 'MP3') AND (FileExists(Song.Path + Value)) then - begin - Song.Mp3 := Value; - - //Add Mp3 Flag to Done - Done := Done or 4; - end - - //Beats per Minute - else if (Identifier = 'BPM') then - begin - // Replace . with , - if (Pos('.', Value) <> 0) then - Value[Pos('.', Value)] := ','; - - SetLength(Song.BPM, 1); - Song.BPM[0].StartBeat := 0; - - Song.BPM[0].BPM := StrtoFloatDef(Value, 0) * Mult * MultBPM; - - if Song.BPM[0].BPM <> 0 then - begin - //Add BPM Flag to Done - Done := Done or 8; - end; - end - - //--------- - //Additional Header Information - //--------- - - // Video Gap - else if (Identifier = 'GAP') then - begin - // Replace . with , - if (Pos('.', Value) <> 0) then - Value[Pos('.', Value)] := ','; - - Song.GAP := StrtoFloatDef (Value, 0); - end - - //Cover Picture - else if (Identifier = 'COVER') then - begin - Song.Cover := Value; - end - - //Background Picture - else if (Identifier = 'BACKGROUND') then - begin - Song.Background := Value; - end - - // Video File - else if (Identifier = 'VIDEO') then - begin - if (FileExists(Song.Path + Value)) then - Song.Video := Value - else - Log.LogError('Can''t find Video File in Song: ' + Song.Path + Song.FileName); - end - - // Video Gap - else if (Identifier = 'VIDEOGAP') then - begin - // Replace . with , - if (Pos('.', Value) <> 0) then - Value[Pos('.', Value)] := ','; - - Song.VideoGAP := StrtoFloatDef (Value, 0); - end - - //Genre Sorting - else if (Identifier = 'GENRE') then - begin - Song.Genre := Value; - end - - //Edition Sorting - else if (Identifier = 'EDITION') then - begin - Song.Edition := Value; - end - - //Creator Tag - else if (Identifier = 'CREATOR') then - begin - Song.Creator := Value; - end - - //Language Sorting - else if (Identifier = 'LANGUAGE') then - begin - Song.Language := Value; - end - - // Song Start - else if (Identifier = 'START') then - begin - // Replace . with , - if (Pos('.', Value) <> 0) then - Value[Pos('.', Value)] := ','; - - Song.Start := StrtoFloatDef(Value, 0); - end - - // Song Ending - else if (Identifier = 'END') then - begin - TryStrtoInt(Value, Song.Finish); - end - - // Resolution - else if (Identifier = 'RESOLUTION') then - begin - TryStrtoInt(Value, Song.Resolution); - end - - // Notes Gap - else if (Identifier = 'NOTESGAP') then - begin - TryStrtoInt(Value, Song.NotesGAP); - end - - // Relative Notes - else if (Identifier = 'RELATIVE') AND (uppercase(Value) = 'YES') then - begin - Song.Relative := True; - end; - - end; - end; - - if not EOf(SongFile) then - ReadLn (SongFile, Line) - else - begin - Result := False; - Log.LogError('File Incomplete or not Ultrastar TxT (A): ' + Song.FileName); - break; - end; - - {//End on first empty Line - if (Length(Line) = 0) then - break;} - end; - - //Check if all Required Values are given - if (Done <> 15) then - begin - Result := False; - if (Done and 8) = 0 then //No BPM Flag - Log.LogError('BPM Tag Missing: ' + Song.FileName) - else if (Done and 4) = 0 then //No MP3 Flag - Log.LogError('MP3 Tag/File Missing: ' + Song.FileName) - else if (Done and 2) = 0 then //No Artist Flag - Log.LogError('Artist Tag Missing: ' + Song.FileName) - else if (Done and 1) = 0 then //No Title Flag - Log.LogError('Title Tag Missing: ' + Song.FileName) - else //unknown Error - Log.LogError('File Incomplete or not Ultrastar TxT (B - '+ inttostr(Done) +'): ' + Song.FileName); - end; - -end; - -//-------------------- -// Analyse Song File and Read Header -//-------------------- -function AnalyseFile(var Song: TSong): boolean; -begin -Result := False; -{try } - //Reset LineNo - FileLineNo := 0; - - //Open File and set File Pointer to the beginning - AssignFile(SongFile, Song.Path + Song.FileName); - -// if assinged( SongFile ) then - begin - try - Reset(SongFile); - - //Clear old Song Header - ClearSong(Song); - - //Read Header - Result := ReadTxTHeader(Song); - - //And Close File - finally - CloseFile(SongFile); - end; - end; -{except - CloseFile(SongFile); - - Result := False; - //Error Reporting - Log.LogError('An Error occured reading Line ' + inttostr(FileLineNo) + ' from SongHeader: ' + Song.FileName); -end;} -end; - *) + //-------------------- // Resets the temporary Sentence Arrays for each Player and some other Variables //-------------------- -- cgit v1.2.3 From ceae3d4f3b8d1697ec345787b35064f96fc67e14 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sat, 12 Jan 2008 12:49:16 +0000 Subject: oops... :) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@791 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlatformMacOSX.pas | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlatformMacOSX.pas b/Game/Code/Classes/UPlatformMacOSX.pas index 97c32fe3..30a2ab47 100644 --- a/Game/Code/Classes/UPlatformMacOSX.pas +++ b/Game/Code/Classes/UPlatformMacOSX.pas @@ -15,17 +15,13 @@ type TPlatformMacOSX = class( TInterfacedObject, IPlatform) private public -<<<<<<< .mine Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override; function GetGamePath: WideString; override; function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; procedure halt(); -======= - function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override; - function GetLogPath : WideString; override; - function GetGameSharedPath : WideString; override; - function GetGameUserPath : WideString; override; ->>>>>>> .r788 + function GetLogPath : WideString; override; + function GetGameSharedPath : WideString; override; + function GetGameUserPath : WideString; override; end; implementation @@ -52,6 +48,7 @@ end; function TPlatformMacOSX.GetLogPath : WideString; begin + // surly logs go in /var/log/ ??? Result := GetBundlePath; end; @@ -62,6 +59,8 @@ end; function TPlatformMacOSX.GetGameUserPath : WideString; begin + // is there no user profile ??? + // like ... /home/user/ that could be used for song locations etc ?? Result := GetBundlePath; end; -- cgit v1.2.3 From 8226572159609fc0ee15de155d84576c00163371 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sun, 13 Jan 2008 12:48:28 +0000 Subject: oops sorry I forgot this one .. bugger ! git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@792 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/USong.pas | 706 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 706 insertions(+) create mode 100644 Game/Code/Classes/USong.pas (limited to 'Game/Code') diff --git a/Game/Code/Classes/USong.pas b/Game/Code/Classes/USong.pas new file mode 100644 index 00000000..6af16a1a --- /dev/null +++ b/Game/Code/Classes/USong.pas @@ -0,0 +1,706 @@ +unit USong; + +interface + +uses + {$IFDEF MSWINDOWS} + Windows, + {$ifdef Delphi} + DirWatch, + {$endif} + {$ELSE} + {$IFNDEF DARWIN} +// oldlinux, + syscall, + {$ENDIF} + baseunix, + UnixType, + {$ENDIF} + SysUtils, + Classes, + UPlatform, + ULog, + UTexture, + UCommon, + {$IFDEF DARWIN} + cthreads, + {$ENDIF} + {$IFDEF USE_PSEUDO_THREAD} + PseudoThread, + {$ENDIF} + UCatCovers; + +type + + + TBPM = record + BPM: real; + StartBeat: real; + end; + + TScore = record + Name: widestring; + Score: integer; + Length: string; + end; + + TSong = class + + FileLineNo : integer; //Line which is readed at Last, for error reporting + + procedure ParseNote(NrCzesci: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string); + procedure NewSentence(NrCzesciP: integer; Param1, Param2: integer); + + function ReadTXTHeader( const aFileName : WideString ): boolean; + public + + Path: widestring; + Folder: widestring; // for sorting by folder + fFileName, + FileName: widestring; + + // sorting methods + Category: array of widestring; // I think I won't need this + Genre: widestring; + Edition: widestring; + Language: widestring; // 0.5.0: new + + Title: widestring; + Artist: widestring; + + Text: widestring; + Creator: widestring; + + Cover: widestring; + CoverTex: TTexture; + Mp3: widestring; + Background: widestring; + Video: widestring; + VideoGAP: real; + VideoLoaded: boolean; // 0.5.0: true if the video has been loaded + NotesGAP: integer; + Start: real; // in seconds + Finish: integer; // in miliseconds + Relative: boolean; + Resolution: integer; + BPM: array of TBPM; + GAP: real; // in miliseconds + + Score: array[0..2] of array of TScore; + + // these are used when sorting is enabled + Visible: boolean; // false if hidden, true if visible + Main: boolean; // false for songs, true for category buttons + OrderNum: integer; // has a number of category for category buttons and songs + OrderTyp: integer; // type of sorting for this button (0=name) + CatNumber: integer; // Count of Songs in Category for Cats and Number of Song in Category for Songs + + SongFile: TextFile; // all procedures in this unit operates on this file + + Base : array[0..1] of integer; + Rel : array[0..1] of integer; + Mult : integer; + MultBPM : integer; + + constructor create ( const aFileName : WideString ); + function LoadSong: boolean; + function Analyse(): boolean; + procedure clear(); + end; + +implementation + +uses + TextGL, + UIni, + UMusic, // needed for Czesci .. ( whatever that is ) + UMain; //needed for Player + +constructor TSong.create( const aFileName : WideString ); +begin + Mult := 1; + MultBPM := 4; + + fFileName := aFileName; + + if fileexists( aFileName ) then + begin + self.Path := ExtractFilePath( aFileName ); + self.Folder := ExtractFilePath( aFileName ); + self.FileName := ExtractFileName( aFileName ); + + (* + if ReadTXTHeader( aFileName ) then + begin + LoadSong(); + end + else + begin + Log.LogError('Error Loading SongHeader, abort Song Loading'); + Exit; + end; +*) + end; + +end; + + function TSong.LoadSong(): boolean; + var + TempC: char; + Tekst: string; + CP: integer; // Current Player (0 or 1) + Pet: integer; + Both: boolean; + Param1: integer; + Param2: integer; + Param3: integer; + ParamS: string; + I: Integer; +begin + Result := false; + + if not FileExists(Path + PathDelim + FileName) then + begin + Log.LogError('File not found: "' + Path + PathDelim + FileName + '"', 'WczytajCzesci'); + exit; + end; + + try + MultBPM := 4; // 4 - mnoznik dla czasu nut + Mult := 1; // 4 - dokladnosc pomiaru nut + Base[0] := 100; // high number + Czesci[0].Wartosc := 0; + self.Relative := false; + Rel[0] := 0; + CP := 0; + Both := false; + + if Length(Player) = 2 then + Both := true; + + // Open song file for reading..... + FileMode := fmOpenRead; + AssignFile(SongFile, fFileName); + Reset(SongFile); + + //Clear old Song Header + if (self.Path = '') then + self.Path := ExtractFilePath(FileName); + + if (self.FileName = '') then + self.Filename := ExtractFileName(FileName); + + Result := False; + + Reset(SongFile); + FileLineNo := 0; + //Search for Note Begining + repeat + ReadLn(SongFile, Tekst); + Inc(FileLineNo); + + if (EoF(SongFile)) then + begin //Song File Corrupted - No Notes + CloseFile(SongFile); + Log.LogError('Could not load txt File, no Notes found: ' + FileName); + Result := False; + Exit; + end; + Read(SongFile, TempC); + until ((TempC = ':') or (TempC = 'F') or (TempC = '*')); + + SetLength(Czesci, 2); + for Pet := 0 to High(Czesci) do begin + SetLength(Czesci[Pet].Czesc, 1); + Czesci[Pet].High := 0; + Czesci[Pet].Ilosc := 1; + Czesci[Pet].Akt := 0; + Czesci[Pet].Resolution := self.Resolution; + Czesci[Pet].NotesGAP := self.NotesGAP; + Czesci[Pet].Czesc[0].IlNut := 0; + Czesci[Pet].Czesc[0].HighNut := -1; + end; + + // TempC := ':'; + // TempC := Tekst[1]; // read from backup variable, don't use default ':' value + + while (TempC <> 'E') AND (not EOF(SongFile)) do + begin + + if (TempC = ':') or (TempC = '*') or (TempC = 'F') then begin + // wczytuje nute + Read(SongFile, Param1); + Read(SongFile, Param2); + Read(SongFile, Param3); + Read(SongFile, ParamS); + + // dodaje nute + if not Both then + // P1 + ParseNote(0, TempC, (Param1+Rel[0]) * Mult, Param2 * Mult, Param3, ParamS) + else begin + // P1 + P2 + ParseNote(0, TempC, (Param1+Rel[0]) * Mult, Param2 * Mult, Param3, ParamS); + ParseNote(1, TempC, (Param1+Rel[1]) * Mult, Param2 * Mult, Param3, ParamS); + end; + end; // if + + if TempC = '-' then + begin + // reads sentence + Read(SongFile, Param1); + if self.Relative then Read(SongFile, Param2); // read one more data for relative system + + // new sentence + if not Both then + // P1 + NewSentence(0, (Param1 + Rel[0]) * Mult, Param2) + else begin + // P1 + P2 + NewSentence(0, (Param1 + Rel[0]) * Mult, Param2); + NewSentence(1, (Param1 + Rel[1]) * Mult, Param2); + end; + end; // if + + if TempC = 'B' then + begin + SetLength(self.BPM, Length(self.BPM) + 1); + Read(SongFile, self.BPM[High(self.BPM)].StartBeat); + self.BPM[High(self.BPM)].StartBeat := self.BPM[High(self.BPM)].StartBeat + Rel[0]; + + Read(SongFile, Tekst); + self.BPM[High(self.BPM)].BPM := StrToFloat(Tekst); + self.BPM[High(self.BPM)].BPM := self.BPM[High(self.BPM)].BPM * Mult * MultBPM; + end; + + + if not Both then + begin + Czesci[CP].Czesc[Czesci[CP].High].BaseNote := Base[CP]; + Czesci[CP].Czesc[Czesci[CP].High].LyricWidth := glTextWidth(PChar(Czesci[CP].Czesc[Czesci[CP].High].Lyric)); + //Total Notes Patch + Czesci[CP].Czesc[Czesci[CP].High].TotalNotes := 0; + for I := low(Czesci[CP].Czesc[Czesci[CP].High].Nuta) to high(Czesci[CP].Czesc[Czesci[CP].High].Nuta) do + begin + Czesci[CP].Czesc[Czesci[CP].High].TotalNotes := Czesci[CP].Czesc[Czesci[CP].High].TotalNotes + Czesci[CP].Czesc[Czesci[CP].High].Nuta[I].Dlugosc * Czesci[CP].Czesc[Czesci[CP].High].Nuta[I].Wartosc; + end; + //Total Notes Patch End + end else begin + for Pet := 0 to High(Czesci) do begin + Czesci[Pet].Czesc[Czesci[Pet].High].BaseNote := Base[Pet]; + Czesci[Pet].Czesc[Czesci[Pet].High].LyricWidth := glTextWidth(PChar(Czesci[Pet].Czesc[Czesci[Pet].High].Lyric)); + //Total Notes Patch + Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes := 0; + for I := low(Czesci[Pet].Czesc[Czesci[Pet].High].Nuta) to high(Czesci[Pet].Czesc[Czesci[Pet].High].Nuta) do + begin + Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes := Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes + Czesci[Pet].Czesc[Czesci[Pet].High].Nuta[I].Dlugosc * Czesci[Pet].Czesc[Czesci[Pet].High].Nuta[I].Wartosc; + end; + //Total Notes Patch End + end; + end; + + Read(SongFile, TempC); + Inc(FileLineNo); + end; // while} + + CloseFile(SongFile); + except + try + CloseFile(SongFile); + except + + end; + + Log.LogError('Error Loading File: "' + fFileName + '" in Line ' + inttostr(FileLineNo)); + exit; + end; + + Result := true; +end; + + function TSong.ReadTXTHeader(const aFileName : WideString): boolean; + var + Line, Identifier, Value: String; + Temp : word; + Done : byte; +begin + Result := true; + Done := 0; + + //Read first Line + ReadLn (SongFile, Line); + + if (Length(Line)<=0) then + begin + Log.LogError('File Starts with Empty Line: ' + aFileName); + Result := False; + Exit; + end; + + //Read Lines while Line starts with # or its empty + While ( Length(Line) = 0 ) OR + ( Line[1] = '#' ) DO + begin + //Increase Line Number + Inc (FileLineNo); + Temp := Pos(':', Line); + + //Line has a Seperator-> Headerline + if (Temp <> 0) then + begin + //Read Identifier and Value + Identifier := Uppercase(Trim(Copy(Line, 2, Temp - 2))); //Uppercase is for Case Insensitive Checks + Value := Trim(Copy(Line, Temp + 1,Length(Line) - Temp)); + + //Check the Identifier (If Value is given) + if (Length(Value) <> 0) then + begin + + //----------- + //Required Attributes + //----------- + + //Title + if (Identifier = 'TITLE') then + begin + self.Title := Value; + + //Add Title Flag to Done + Done := Done or 1; + end + + //Artist + else if (Identifier = 'ARTIST') then + begin + self.Artist := Value; + + //Add Artist Flag to Done + Done := Done or 2; + end + + //MP3 File //Test if Exists + else if (Identifier = 'MP3') AND + (FileExists(self.Path + Value)) then + begin + self.Mp3 := Value; + + //Add Mp3 Flag to Done + Done := Done or 4; + end + + //Beats per Minute + else if (Identifier = 'BPM') then + begin + // Replace . with , + if (Pos('.', Value) <> 0) then + Value[Pos('.', Value)] := ','; + + SetLength(self.BPM, 1); + self.BPM[0].StartBeat := 0; + + self.BPM[0].BPM := StrtoFloatDef(Value, 0) * Mult * MultBPM; + + if self.BPM[0].BPM <> 0 then + begin + //Add BPM Flag to Done + Done := Done or 8; + end; + end + + //--------- + //Additional Header Information + //--------- + + // Video Gap + else if (Identifier = 'GAP') then + begin + // Replace . with , + if (Pos('.', Value) <> 0) then + Value[Pos('.', Value)] := ','; + + self.GAP := StrtoFloatDef (Value, 0); + end + + //Cover Picture + else if (Identifier = 'COVER') then + self.Cover := Value + + //Background Picture + else if (Identifier = 'BACKGROUND') then + self.Background := Value + + // Video File + else if (Identifier = 'VIDEO') then + begin + if (FileExists(self.Path + Value)) then + self.Video := Value + else + Log.LogError('Can''t find Video File in Song: ' + aFileName); + end + + // Video Gap + else if (Identifier = 'VIDEOGAP') then + begin + // Replace . with , + if (Pos('.', Value) <> 0) then + Value[Pos('.', Value)] := ','; + + self.VideoGAP := StrtoFloatDef (Value, 0); + end + + //Genre Sorting + else if (Identifier = 'GENRE') then + self.Genre := Value + + //Edition Sorting + else if (Identifier = 'EDITION') then + self.Edition := Value + + //Creator Tag + else if (Identifier = 'CREATOR') then + self.Creator := Value + + //Language Sorting + else if (Identifier = 'LANGUAGE') then + self.Language := Value + + // Song Start + else if (Identifier = 'START') then + begin + // Replace . with , + if (Pos('.', Value) <> 0) then + Value[Pos('.', Value)] := ','; + + self.Start := StrtoFloatDef(Value, 0); + end + + // Song Ending + else if (Identifier = 'END') then + TryStrtoInt(Value, self.Finish) + + // Resolution + else if (Identifier = 'RESOLUTION') then + TryStrtoInt(Value, self.Resolution) + + // Notes Gap + else if (Identifier = 'NOTESGAP') then + TryStrtoInt(Value, self.NotesGAP) + // Relative Notes + else if (Identifier = 'RELATIVE') AND (uppercase(Value) = 'YES') then + self.Relative := True; + + end; + end; + + if not EOf(SongFile) then + ReadLn (SongFile, Line) + else + begin + Result := False; + Log.LogError('File Incomplete or not Ultrastar TxT (A): ' + aFileName); + break; + end; + + end; + + if self.Cover = '' then + self.Cover := platform.FindSongFile(Path, '*[CO].jpg'); + + //Check if all Required Values are given + if (Done <> 15) then + begin + Result := False; + if (Done and 8) = 0 then //No BPM Flag + Log.LogError('BPM Tag Missing: ' + self.FileName) + else if (Done and 4) = 0 then //No MP3 Flag + Log.LogError('MP3 Tag/File Missing: ' + self.FileName) + else if (Done and 2) = 0 then //No Artist Flag + Log.LogError('Artist Tag Missing: ' + self.FileName) + else if (Done and 1) = 0 then //No Title Flag + Log.LogError('Title Tag Missing: ' + self.FileName) + else //unknown Error + Log.LogError('File Incomplete or not Ultrastar TxT (B - '+ inttostr(Done) +'): ' + aFileName); + end; + +end; + +procedure TSong.ParseNote(NrCzesci: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string); +var + Space: boolean; +begin + case Ini.Solmization of + 1: // european + begin + case (NoteP mod 12) of + 0..1: LyricS := ' do '; + 2..3: LyricS := ' re '; + 4: LyricS := ' mi '; + 5..6: LyricS := ' fa '; + 7..8: LyricS := ' sol '; + 9..10: LyricS := ' la '; + 11: LyricS := ' si '; + end; + end; + 2: // japanese + begin + case (NoteP mod 12) of + 0..1: LyricS := ' do '; + 2..3: LyricS := ' re '; + 4: LyricS := ' mi '; + 5..6: LyricS := ' fa '; + 7..8: LyricS := ' so '; + 9..10: LyricS := ' la '; + 11: LyricS := ' shi '; + end; + end; + 3: // american + begin + case (NoteP mod 12) of + 0..1: LyricS := ' do '; + 2..3: LyricS := ' re '; + 4: LyricS := ' mi '; + 5..6: LyricS := ' fa '; + 7..8: LyricS := ' sol '; + 9..10: LyricS := ' la '; + 11: LyricS := ' ti '; + end; + end; + end; // case + + with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].High] do begin + SetLength(Nuta, Length(Nuta) + 1); + IlNut := IlNut + 1; + HighNut := HighNut + 1; + Muzyka.IlNut := Muzyka.IlNut + 1; + + Nuta[HighNut].Start := StartP; + if IlNut = 1 then begin + StartNote := Nuta[HighNut].Start; + if Czesci[NrCzesci].Ilosc = 1 then + Start := -100; +// Start := Nuta[HighNut].Start; + end; + + Nuta[HighNut].Dlugosc := DurationP; + Muzyka.DlugoscNut := Muzyka.DlugoscNut + Nuta[HighNut].Dlugosc; + + // back to the normal system with normal, golden and now freestyle notes + case TypeP of + 'F': Nuta[HighNut].Wartosc := 0; + ':': Nuta[HighNut].Wartosc := 1; + '*': Nuta[HighNut].Wartosc := 2; + end; + + Czesci[NrCzesci].Wartosc := Czesci[NrCzesci].Wartosc + Nuta[HighNut].Dlugosc * Nuta[HighNut].Wartosc; + + Nuta[HighNut].Ton := NoteP; + if Nuta[HighNut].Ton < Base[NrCzesci] then Base[NrCzesci] := Nuta[HighNut].Ton; + Nuta[HighNut].TonGamy := Nuta[HighNut].TonGamy mod 12; + + Nuta[HighNut].Tekst := Copy(LyricS, 2, 100); + Lyric := Lyric + Nuta[HighNut].Tekst; + + if TypeP = 'F' then + Nuta[HighNut].FreeStyle := true; + + Koniec := Nuta[HighNut].Start + Nuta[HighNut].Dlugosc; + end; // with +end; + +procedure TSong.NewSentence(NrCzesciP: integer; Param1, Param2: integer); +var +I: Integer; +begin + + // stara czesc //Alter Satz //Update Old Part + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].BaseNote := Base[NrCzesciP]; + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].LyricWidth := glTextWidth(PChar(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Lyric)); + + //Total Notes Patch + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes := 0; + for I := low(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta) to high(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta) do + begin + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes := Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta[I].Dlugosc * Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta[I].Wartosc; + end; + //Total Notes Patch End + + + // nowa czesc //Neuer Satz //Update New Part + SetLength(Czesci[NrCzesciP].Czesc, Czesci[NrCzesciP].Ilosc + 1); + Czesci[NrCzesciP].High := Czesci[NrCzesciP].High + 1; + Czesci[NrCzesciP].Ilosc := Czesci[NrCzesciP].Ilosc + 1; + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].HighNut := -1; + + if self.Relative then + begin + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Start := Param1; + Rel[NrCzesciP] := Rel[NrCzesciP] + Param2; + end + else + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Start := Param1; + + Base[NrCzesciP] := 100; // high number +end; + +procedure TSong.clear(); +begin + //Main Information + Title := ''; + Artist := ''; + + //Sortings: + Genre := 'Unknown'; + Edition := 'Unknown'; + Language := 'Unknown'; //Language Patch + + //Required Information + Mp3 := ''; + {$IFDEF FPC} + setlength( BPM, 0 ); + {$ELSE} + BPM := 0; + {$ENDIF} + + GAP := 0; + Start := 0; + Finish := 0; + + //Additional Information + Background := ''; + Cover := ''; + Video := ''; + VideoGAP := 0; + NotesGAP := 0; + Resolution := 4; + Creator := ''; + +end; + +function TSong.Analyse(): boolean; +begin + Result := False; + + //Reset LineNo + FileLineNo := 0; + + //Open File and set File Pointer to the beginning + AssignFile(SongFile, self.Path + self.FileName); + + try + Reset(SongFile); + + //Clear old Song Header + self.clear; + + //Read Header + Result := self.ReadTxTHeader( FileName ) + + //And Close File + finally + CloseFile(SongFile); + end; +end; + + + +end. -- cgit v1.2.3 From f153a656e343f043673f97203ca680797196335e Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 14 Jan 2008 00:31:20 +0000 Subject: Bugfix: when entering the song-screen the preview on the first song was never played. Reason: Length of audio-file was checked _before_ it was opened. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@793 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 4b42288a..a54bda9f 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1519,19 +1519,20 @@ begin if Length(CatSongs.Song) > 0 then begin //Load Music only when Song Preview is activated - if ( Ini.PreviewVolume <> 0 ) AND - ( AudioPlayback.Length > 1 ) then + if ( Ini.PreviewVolume <> 0 ) then begin - AudioPlayback.SetLoop(false); - AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); - AudioPlayback.Position := AudioPlayback.Length / 4; - AudioPlayback.Play; - - //Set Preview Volume - AudioPlayback.SetMusicVolume (Ini.PreviewVolume * 10); - {//if Music Fade is activated, Set Volume to 0 % - if (Ini.PreviewFading <> 0) then - Music.SetMusicVolume(0);} + if(AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3)) then + begin + AudioPlayback.SetLoop(false); + AudioPlayback.Position := AudioPlayback.Length / 4; + AudioPlayback.Play; + + //Set Preview Volume + AudioPlayback.SetMusicVolume (Ini.PreviewVolume * 10); + {//if Music Fade is activated, Set Volume to 0 % + if (Ini.PreviewFading <> 0) then + Music.SetMusicVolume(0);} + end; end; SetScroll; -- cgit v1.2.3 From 1b458d8b1f4723ce82bb74f2157982980274e79c Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 14 Jan 2008 12:27:38 +0000 Subject: tidy up sing mode, to be an enum now. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@794 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlaylist.pas | 7 +++- Game/Code/Classes/USong.pas | 2 + Game/Code/Screens/UScreenLevel.pas | 8 +++- Game/Code/Screens/UScreenOptionsRecord.pas | 2 +- Game/Code/Screens/UScreenPartyNewRound.pas | 12 +++++- Game/Code/Screens/UScreenPartyOptions.pas | 4 +- Game/Code/Screens/UScreenSing.pas | 5 ++- Game/Code/Screens/UScreenSong.pas | 60 ++++++++++++++++-------------- 8 files changed, 61 insertions(+), 39 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlaylist.pas b/Game/Code/Classes/UPlaylist.pas index 8d981065..2c09c493 100644 --- a/Game/Code/Classes/UPlaylist.pas +++ b/Game/Code/Classes/UPlaylist.pas @@ -9,6 +9,9 @@ interface {$I switches.inc} +uses + USong; + type TPlaylistItem = record Artist: String; @@ -33,7 +36,7 @@ type private public - Mode: Byte; //Current Playlist Mode for SongScreen + Mode: TSingMode; //Current Playlist Mode for SongScreen CurPlayList: Cardinal; CurItem: Cardinal; @@ -262,7 +265,7 @@ begin //Set CatSongsMode + Playlist Mode CatSongs.CatNumShow := -3; - Mode := 2; + Mode := smPlayListRandom; //Set CurPlaylist CurPlaylist := Index; diff --git a/Game/Code/Classes/USong.pas b/Game/Code/Classes/USong.pas index 6af16a1a..728f5055 100644 --- a/Game/Code/Classes/USong.pas +++ b/Game/Code/Classes/USong.pas @@ -33,6 +33,8 @@ uses type + TSingMode = ( smNormal, smPartyMode, smPlaylistRandom ); + TBPM = record BPM: real; StartBeat: real; diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas index d4b528b5..e5deb6ba 100644 --- a/Game/Code/Screens/UScreenLevel.pas +++ b/Game/Code/Screens/UScreenLevel.pas @@ -18,7 +18,11 @@ type implementation -uses UGraphic, UMain, UIni, UTexture; +uses UGraphic, + UMain, + UIni, + USong, + UTexture; function TScreenLevel.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -44,7 +48,7 @@ begin Ini.SaveLevel; AudioPlayback.PlayStart; //Set Standard Mode - ScreenSong.Mode := 0; + ScreenSong.Mode := smNormal; FadeTo(@ScreenSong); end; diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index 42776717..65d016c7 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -124,7 +124,7 @@ begin Interaction := 0; writeln( 'AudioInput.CaptureStart') ; - PlayersPlay := 2; // TODO : This needs fixing + PlayersPlay := 2; // TODO : This needs fixing AudioInput.CaptureStart; end; diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 6f039080..2f07dcb0 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -76,7 +76,15 @@ type implementation -uses UGraphic, UMain, UIni, UTexture, UParty, UDLLManager, ULanguage, ULog; +uses UGraphic, + UMain, + UIni, + UTexture, + UParty, + UDLLManager, + ULanguage, + USong, + ULog; function TScreenPartyNewRound.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -103,7 +111,7 @@ begin if DLLMan.Selected.LoadSong then begin //Select PartyMode ScreenSong - ScreenSong.Mode := 1; + ScreenSong.Mode := smPartyMode; FadeTo(@ScreenSong); end else diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 46a075ce..c8cb2bb5 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -46,7 +46,7 @@ const implementation -uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UDLLManager, UPlaylist, USongs; +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, USong, UDLLManager, UPlaylist, USongs; function TScreenPartyOptions.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; var @@ -96,7 +96,7 @@ begin PartySession.Teams.Teaminfo[2].NumPlayers := NumPlayer3+1;} //Save Playlist - PlaylistMan.Mode := Playlist; + PlaylistMan.Mode := TSingMode( Playlist ); PlaylistMan.CurPlayList := High(Cardinal); //If Category Selected Search Category ID if Playlist = 1 then diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index adfc4d2c..5216477d 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -120,6 +120,7 @@ implementation uses UGraphic, UDraw, UMain, + USong, Classes, URecord, ULanguage, @@ -443,7 +444,7 @@ begin //Error Loading Song -> Go back to Song Screen and Show some Error Message FadeTo(@ScreenSong); //Select New Song in Party Mode - if ScreenSong.Mode = 1 then + if ScreenSong.Mode = smPartyMode then ScreenSong.SelectRandomSong; ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); Exit; @@ -452,7 +453,7 @@ begin //Error Loading Song -> Go back to Song Screen and Show some Error Message FadeTo(@ScreenSong); //Select New Song in Party Mode - if ScreenSong.Mode = 1 then + if ScreenSong.Mode = smPartyMode then ScreenSong.SelectRandomSong; ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); Exit; diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index a54bda9f..4773cdac 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -24,6 +24,7 @@ uses ULanguage, ULCD, ULight, + USong, UIni; type @@ -56,7 +57,8 @@ type EqualizerTime2: Byte; //Party Mod - Mode: Byte; //0 = Standard, 1= Go to PartyMode after Selection + Change to Random Song at Show + Mode: TSingMode; + //party Statics (Joker) StaticTeam1Joker1: Cardinal; StaticTeam1Joker2: Cardinal; @@ -252,7 +254,7 @@ begin + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); //Jump to Artist/Titel - if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then + if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = smNormal) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then begin Letter := UpCase(Chr(ScanCode)); I2 := Length(CatSongs.Song); @@ -312,7 +314,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - if (Mode = 0) then + if (Mode = smNormal) then begin //On Escape goto Cat-List Hack if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then @@ -375,7 +377,7 @@ begin end; end //When in party Mode then Ask before Close - else if (Mode = 1) then + else if (Mode = smPartyMode) then begin AudioPlayback.PlayBack; CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); @@ -410,8 +412,10 @@ begin //Play Music: ChangeMusic; - end else begin // clicked on song - if (Mode = 0) then //Normal Mode -> Start Song + end + else + begin // clicked on song + if (Mode = smNormal) then //Normal Mode -> Start Song begin //Do the Action that is specified in Ini case Ini.OnSongClick of @@ -425,7 +429,7 @@ begin end; end; end - else if (Mode = 1) then //PartyMode -> Show Menu + else if (Mode = smPartyMode) then //PartyMode -> Show Menu begin if (Ini.PartyPopup = 1) then ScreenSongMenu.MenuShow(SM_Party_Main) @@ -439,7 +443,7 @@ begin SDLK_M: //Show SongMenu begin if (Songs.SongList.Count > 0) then begin - if (Mode = 0) then begin + if (Mode = smNormal) then begin if not CatSongs.Song[Interaction].Main then begin // clicked on Song if CatSongs.CatNumShow = -3 then ScreenSongMenu.MenuShow(SM_Playlist) @@ -457,14 +461,14 @@ begin SDLK_P: //Show Playlist Menu begin - if (Songs.SongList.Count > 0) AND (Mode = 0) then begin + if (Songs.SongList.Count > 0) AND (Mode = smNormal) then begin ScreenSongMenu.MenuShow(SM_Playlist_Load); end; end; SDLK_J: //Show Jumpto Menu begin - if (Songs.SongList.Count > 0) AND (Mode = 0) then + if (Songs.SongList.Count > 0) AND (Mode = smNormal) then begin ScreenSongJumpto.Visible := True; end; @@ -472,7 +476,7 @@ begin SDLK_DOWN: begin - if (Mode = 0) then + if (Mode = smNormal) then begin //Only Change Cat when not in Playlist or Search Mode if (CatSongs.CatNumShow > -2) then @@ -512,7 +516,7 @@ begin end; SDLK_UP: begin - if (Mode = 0) then + if (Mode = smNormal) then begin //Only Change Cat when not in Playlist or Search Mode if (CatSongs.CatNumShow > -2) then @@ -553,7 +557,7 @@ begin SDLK_RIGHT: begin - if (Songs.SongList.Count > 0) AND (Mode = 0) then + if (Songs.SongList.Count > 0) AND (Mode = smNormal) then begin AudioPlayback.PlayChange; SelectNext; @@ -568,7 +572,7 @@ begin SDLK_LEFT: begin - if (Songs.SongList.Count > 0)AND (Mode = 0) then begin + if (Songs.SongList.Count > 0)AND (Mode = smNormal) then begin AudioPlayback.PlayChange; SelectPrev; ChangeMusic; @@ -585,7 +589,7 @@ begin SDLK_R: begin - if (Songs.SongList.Count > 0) AND (Mode = 0) then begin + if (Songs.SongList.Count > 0) AND (Mode = smNormal) then begin if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category begin @@ -661,7 +665,7 @@ begin SDLK_1: begin //Jocker // to-do : Party - {if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then + {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then begin //Joker spielen Dec(PartySession.Teams.Teaminfo[0].Joker); @@ -672,7 +676,7 @@ begin SDLK_2: begin //Jocker - {if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then + {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then begin //Joker spielen Dec(PartySession.Teams.Teaminfo[1].Joker); @@ -683,7 +687,7 @@ begin SDLK_3: begin //Jocker - {if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then + {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then begin //Joker spielen Dec(PartySession.Teams.Teaminfo[2].Joker); @@ -1540,7 +1544,7 @@ begin end; //Playlist Mode - if (Mode = 0) then + if (Mode = smNormal) then begin //If Playlist Shown -> Select Next automatically if (CatSongs.CatNumShow = -3) then @@ -1550,7 +1554,7 @@ begin end; end //Party Mode - else if (Mode = 1) then + else if (Mode = smPartyMode) then begin SelectRandomSong; @@ -1931,7 +1935,7 @@ var I, I2: Integer; begin Case PlaylistMan.Mode of - 0: //All Songs Just Select Random Song + smNormal: //All Songs Just Select Random Song begin //When Tabs are activated then use Tab Method if (Ini.Tabs_at_startup = 1) then @@ -1965,7 +1969,7 @@ begin else SkipTo(Random(CatSongs.VisibleSongs)); end; - 1: //One Category Select Category and Select Random Song + smPartyMode: //One Category Select Category and Select Random Song begin CatSongs.ShowCategoryList; CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); @@ -1976,7 +1980,7 @@ begin SkipTo(Random(CatSongs.VisibleSongs)); end; - 2: //Playlist: Select Playlist and Select Random Song + smPlaylistRandom: //Playlist: Select Playlist and Select Random Song begin PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); @@ -1995,7 +1999,7 @@ procedure TScreenSong.SetJoker; begin {//If Party Mode // to-do : Party - if Mode = 1 then //Show Joker that are available + if Mode = smPartyMode then //Show Joker that are available begin if (PartySession.Teams.NumTeams >= 1) then begin @@ -2076,7 +2080,7 @@ var Visible: Boolean; begin //Set Visibility of Party Statics and Text - Visible := (Mode = 1); + Visible := (Mode = smPartyMode); For I := 0 to high(StaticParty) do Static[StaticParty[I]].Visible := Visible; @@ -2101,7 +2105,7 @@ begin CatSongs.Selected := Interaction; AudioPlayback.Stop; //Party Mode - if (Mode = 1) then + if (Mode = smPartyMode) then begin FadeTo(@ScreenSingModi); end @@ -2122,7 +2126,7 @@ end; procedure TScreenSong.OpenEditor; begin - if (Songs.SongList.Count > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then + if (Songs.SongList.Count > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = smNormal) then begin AudioPlayback.Stop; AudioPlayback.PlayStart; @@ -2135,7 +2139,7 @@ end; //Team No of Team (0-5) procedure TScreenSong.DoJoker (Team: Byte); begin - {if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then + {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then begin //Joker spielen Dec(PartySession.Teams.Teaminfo[Team].Joker); -- cgit v1.2.3 From e95f320dd030e9def8174e8b173e3631f11dba25 Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 18 Jan 2008 16:30:06 +0000 Subject: added blindy's swscale support. It can be enabled with {$DEFINE UseSWScale}. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@795 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UVideo.pas | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index bbd03d84..c30b271e 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -37,6 +37,9 @@ uses SDL, avcodec, avformat, avutil, + {$IFDEF UseSWScale} + swscale, + {$ENDIF} math, OpenGL12, SysUtils, @@ -77,6 +80,10 @@ type AVFrameRGB: PAVFrame; myBuffer: pByte; + {$IFDEF UseSWScale} + SoftwareScaleContext: PSwsContext; + {$ENDIF} + TexX, TexY, dataX, dataY: Cardinal; ScaledVideoWidth, ScaledVideoHeight: Real; @@ -312,10 +319,18 @@ begin if Framefinished=0 then begin Exit; end; + // otherwise we convert the pixeldata from YUV to RGB + {$IFDEF UseSWScale} + errnum:=sws_scale(SoftwareScaleContext,@(AVFrame.data),@(AVFrame.linesize), + 0,VideoCodecContext^.Height, + @(AVFrameRGB.data),@(AVFrameRGB.linesize)); + {$ELSE} errnum:=img_convert(PAVPicture(AVFrameRGB), PIX_FMT_RGB24, PAVPicture(AVFrame), VideoCodecContext^.pix_fmt, VideoCodecContext^.width, VideoCodecContext^.height); + {$ENDIF} + if errnum >=0 then begin glBindTexture(GL_TEXTURE_2D, fVideoTex); @@ -568,6 +583,23 @@ begin av_close_input_file(VideoFormatContext); Exit; end; + + {$IFDEF UseSWScale} + SoftwareScaleContext:=sws_getContext(VideoCodecContext^.width,VideoCodecContext^.height,integer(VideoCodecContext^.pix_fmt), + dataX, dataY, integer(PIX_FMT_RGB24), + SWS_FAST_BILINEAR, 0, 0, 0); + if SoftwareScaleContext <> Nil then + writeln('got swscale context') + else begin + writeln('ERROR: didn´t get swscale context'); + av_free(AVFrameRGB); + av_free(AVFrame); + avcodec_close(VideoCodecContext); + av_close_input_file(VideoFormatContext); + Exit; + end; + {$ENDIF} + // this is the errnum from avpicture_fill if errnum >=0 then begin -- cgit v1.2.3 From b35a00ba936bc16180c2f18fb0089e80c05ee4a8 Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 18 Jan 2008 17:59:54 +0000 Subject: Autoconf scripts for configure and make. Run "aclocal -I m4" and "autoconf" to create the configure script. I checked this in to test the configure script. Note: the generated Makefile is not supposed to work yet. Use the already checked in Makefile instead. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@796 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Makefile.in | 141 ++++++++++++++++++++++ Game/Code/config.inc.in | 127 ++++++++++++++++++++ Game/Code/configure.ac | 307 ++++++++++++++++++++++++++++++++++++++++++++++++ Game/Code/m4/fpc.m4 | 148 +++++++++++++++++++++++ 4 files changed, 723 insertions(+) create mode 100644 Game/Code/Makefile.in create mode 100644 Game/Code/config.inc.in create mode 100644 Game/Code/configure.ac create mode 100644 Game/Code/m4/fpc.m4 (limited to 'Game/Code') diff --git a/Game/Code/Makefile.in b/Game/Code/Makefile.in new file mode 100644 index 00000000..b702f8d6 --- /dev/null +++ b/Game/Code/Makefile.in @@ -0,0 +1,141 @@ +## +# Makefile for @PACKAGE_NAME@ @PACKAGE_VERSION@ +# @PACKAGE_BUGREPORT@ +## + +# general definitions +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +libdir = @libdir@ +infodir = @infodir@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +datarootdir = @datarootdir@ + +# install tool +INSTALL = @INSTALL@ +# calls "ln -s" +LN_S = @LN_S@ + +USDX_PREFIX = UltraStar +USDX_TOOLS_DIR = ../../Tools + +EXE_SUFFIX = @EXEEXT@ + +# Free Pascal compiler +PPC = @PPC@ +PFLAGS = @PFLAGS@ +# FPC target platform and processor +PPLATFORM = @FPC_PLATFORM@ +PPROCESSOR = @FPC_PROCESSOR@ + +# lazarus defines +LAZARUS_DIR = @LAZARUS_DIR@ +PROJ_SUFFIX = .lpr + +# RC to LRS resource compiler +RESCOMPILER_NAME = USDXResCompiler +RESCOMPILER_BIN = $(USDX_TOOLS_DIR)/$(RESCOMPILER_NAME)$(EXE_SUFFIX) +RESCOMPILER_SRC = $(USDX_TOOLS_DIR)/$(RESCOMPILER_NAME)$(PROJ_SUFFIX) +RESCOMPILER_PFLAGS = -dRELEASE + +RES_SUFFIX = .lrs + +# Directories added to the unit path +PUNIT_TOKEN = -Fu +PUNIT_FLAGS = $(PUNIT_TOKEN)$(LAZARUS_DIR)/lcl/units/$(PPROCESSOR)-$(PPLATFORM) \ + $(PUNIT_TOKEN)$(LAZARUS_DIR)/components/images/lib/$(PPROCESSOR)-$(PPLATFORM) \ + $(PUNIT_TOKEN)$(LAZARUS_DIR)/components/jpeg \ + $(PUNIT_TOKEN). + +# Directory where compiled units (.ppu and .o files) are stored +PCUNIT_TOKEN = -FU +PCUNIT_DIR = ./build/$(PPLATFORM)/lazarus +PCUNIT_FLAGS = $(PCUNIT_TOKEN)$(PCUNIT_DIR) + +# Directories added to the includes path +PINC_TOKEN = -Fi +PINC_FLAGS = $(PINC_TOKEN)lib/JEDI-SDLv1.0/SDL/Pas + +# Defines +PDEFINES = -dLCL + +# Misc fpc options +PCOMPAT_FLAGS = -S2dgi +#PCOMPAT_FLAGS += -Mdelphi +PVERBOSE_FLAGS = -vew -l +#PDEBUG_FLAGS = -g -gl +#PDEBUG_FLAGS = -dDEBUG +#POTHER_FLAGS = -Crtoi +#POPTIMIZE_FLAGS_FPC204 = -OG2p3 +#POPTIMIZE_FLAGS_FPC220 = -O2p"NAME" +#POPTIMIZE_FLAGS = -dRELEASE +#POPTIMIZE_FLAGS = -Xs +PFLAGS += $(PCOMPAT_FLAGS) \ + $(PVERBOSE_FLAGS) \ + $(PDEFINES) + +# lpr project file used as input +USDX_SRC = $(USDX_PREFIX)$(PROJ_SUFFIX) +# name of executable +USDX_BIN = $(USDX_PREFIX)$(EXE_SUFFIX) +# name of resource +USDX_RES = $(USDX_PREFIX)$(RES_SUFFIX) + +.PHONY: all resources ultrastar install uninstall clean distclean clean_obj clean_res + +all: resources ultrastar + +resources: $(USDX_RES) + +# we need to rebuild everything, fpc does some sort of caching of old files, +# so we have to delete all the old stuff first +ultrastar: clean_obj + mkdir -p $(PCUNIT_DIR) + $(PPC) $(PFLAGS) $(PINC_FLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS) -o$(USDX_BIN) $(USDX_SRC) + +install: all +# $()/mkinstalldirs $(bindir) +# $()/mkinstalldirs $(libdir) +# $()/mkinstalldirs $(infodir) + mv $(OUTPUT) ../.. +# $(INSTALL) $(USDX_BIN) $(bindir)/$(USDX_BIN) + +uninstall: +# rm -f ... + echo "Comming soon!" + +clean: clean_obj clean_res + +distclean: clean + find . -name "*.o" -o -name "*.ppu" -o -name "*.rst" | xargs rm -f + find . -name "*.bak" -o -name "*.orig" -o -name "*.dcu" | xargs rm -f + find . -name "__history" | xargs rm -r -f + rm -f $(OUTPUT).cfg $(OUTPUT).res $(OUTPUT).identcache + rm -f config.inc config.log config.status configure + +clean_obj: + find "$(PCUNIT_DIR)" -name "*.o" -o -name "*.ppu" -o -name "*.rst" | xargs rm -f + rm -f $(OUTPUT) + +clean_res: + rm -f $(USDX_RES) link.res + +$(USDX_RES): $(RESCOMPILER_BIN) $(USDX_PREFIX).rc + $(RESCOMPILER_BIN) $(USDX_PREFIX).rc + +$(RESCOMPILER_BIN): $(RESCOMPILER_SRC) + $(PPC) $(RESCOMPILER_PFLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS) -o$@ $(RESCOMPILER_SRC) + +configure: configure.ac aclocal.m4 + autoconf + +aclocal.m4: m4/* + aclocal -I m4 + +Makefile: Makefile.in config.status + ./config.status + +config.status: configure + ./config.status --recheck \ No newline at end of file diff --git a/Game/Code/config.inc.in b/Game/Code/config.inc.in new file mode 100644 index 00000000..eaa37de7 --- /dev/null +++ b/Game/Code/config.inc.in @@ -0,0 +1,127 @@ +// Configuration include file for @PACKAGE_NAME@ @PACKAGE_VERSION@ +// @PACKAGE_BUGREPORT@ + +// Note on version comparison: +// ------------------------------------------------------------------- +// Delphi (in contrast to FPC) DOESN'T support MACROS. So we +// can't define a macro like VERSION_MAJOR(version) to extract +// parts of the version-number or to create version numbers for +// comparison purposes as with a MAKE_VERSION(maj, min, rev) macro. +// So we have to define constants for every part of the version here. +// +// In addition FPC (in contrast to delphi) DOESN'T support floating- +// point numbers in $IF compiler-directives (e.g. {$IF VERSION > 1.23}) +// It also DOESN'T support arithmetic operations so we aren't able to +// compare versions this way (brackets aren't supported too): +// {$IF VERSION > ((VER_MAJ*2)+(VER_MIN*23)+(VER_REL*1))} +// +// Hence we have to use fixed numbers in the directives. At least +// Pascal allows leading 0s so 0005 equals 5 (octals are +// preceded by & and not by 0 in FPC). +// We also fix the count of digits for each part of the version number +// to 3 (aaaiiirrr with aaa=major, iii=minor, rrr=release version) +// +// A check for a library with at least a version of 2.5.11 would look +// like this: +// {$IF LIB_VERSION >= 002005011} +// +// If you just need to check the major version to this: +// {$IF LIB_VERSION_MAJOR >= 23} +// +// PLEASE consider this if you use version numbers in $IF compiler- +// directives. Otherwise you might break portability. +// ------------------------------------------------------------------- + +{$@DEFINE_DEBUG@ DEBUG} + +const + VERSION_MAJOR = 1000000; + VERSION_MINOR = 1000; + VERSION_RELEASE = 1; + + FPC_VERSION_MAJOR = @FPC_VERSION_MAJOR@; + FPC_VERSION_MINOR = @FPC_VERSION_MINOR@; + FPC_VERSION_RELEASE = @FPC_VERSION_RELEASE@; + FPC_VERSION = (FPC_VERSION_MAJOR * VERSION_MAJOR) + + (FPC_VERSION_MINOR * VERSION_MINOR) + + (FPC_VERSION_RELEASE * VERSION_RELEASE); + + LAZARUS_VERSION_MAJOR = @LAZARUS_VERSION_MAJOR@; + LAZARUS_VERSION_MINOR = @LAZARUS_VERSION_MINOR@; + LAZARUS_VERSION_RELEASE = @LAZARUS_VERSION_RELEASE@; + LAZARUS_VERSION = (LAZARUS_VERSION_MAJOR * VERSION_MAJOR) + + (LAZARUS_VERSION_MINOR * VERSION_MINOR) + + (LAZARUS_VERSION_RELEASE * VERSION_RELEASE); + + {$@DEFINE_HAVE_FFMPEG@ HaveFFMpeg} + {$IFDEF HaveFFMpeg} + + av__codec = '@AVCODEC_LIB@'; + LIBAVCODEC_VERSION_MAJOR = @AVCODEC_VERSION_MAJOR@; + LIBAVCODEC_VERSION_MINOR = @AVCODEC_VERSION_MINOR@; + LIBAVCODEC_VERSION_RELEASE = @AVCODEC_VERSION_RELEASE@; + LIBAVCODEC_VERSION = (LIBAVCODEC_VERSION_MAJOR * VERSION_MAJOR) + + (LIBAVCODEC_VERSION_MINOR * VERSION_MINOR) + + (LIBAVCODEC_VERSION_RELEASE * VERSION_RELEASE); + + av__format = '@AVFORMAT_LIB@'; + LIBAVFORMAT_VERSION_MAJOR = @AVFORMAT_VERSION_MAJOR@; + LIBAVFORMAT_VERSION_MINOR = @AVFORMAT_VERSION_MINOR@; + LIBAVFORMAT_VERSION_RELEASE = @AVFORMAT_VERSION_RELEASE@; + LIBAVFORMAT_VERSION = (LIBAVFORMAT_VERSION_MAJOR * VERSION_MAJOR) + + (LIBAVFORMAT_VERSION_MINOR * VERSION_MINOR) + + (LIBAVFORMAT_VERSION_RELEASE * VERSION_RELEASE); + + av__util = '@AVUTIL_LIB@'; + LIBAVUTIL_VERSION_MAJOR = @AVUTIL_VERSION_MAJOR@; + LIBAVUTIL_VERSION_MINOR = @AVUTIL_VERSION_MINOR@; + LIBAVUTIL_VERSION_RELEASE = @AVUTIL_VERSION_RELEASE@; + LIBAVUTIL_VERSION = (LIBAVUTIL_VERSION_MAJOR * VERSION_MAJOR) + + (LIBAVUTIL_VERSION_MINOR * VERSION_MINOR) + + (LIBAVUTIL_VERSION_RELEASE * VERSION_RELEASE); + + {$ENDIF} + + {$@DEFINE_HAVE_SWSCALE@ HaveSWScale} + {$IFDEF HaveSWScale} + sw__scale = '@SWSCALE_LIB@'; + LIBSWSCALE_VERSION_MAJOR = @SWSCALE_VERSION_MAJOR@; + LIBSWSCALE_VERSION_MINOR = @SWSCALE_VERSION_MINOR@; + LIBSWSCALE_VERSION_RELEASE = @SWSCALE_VERSION_RELEASE@; + LIBSWSCALE_VERSION = (LIBSWSCALE_VERSION_MAJOR * VERSION_MAJOR) + + (LIBSWSCALE_VERSION_MINOR * VERSION_MINOR) + + (LIBSWSCALE_VERSION_RELEASE * VERSION_RELEASE); + {$ENDIF} + + {$@DEFINE_HAVE_PROJECTM@ HaveProjectM} + {$IFDEF HaveProjectM} + libprojectM = '@PROJECTM_LIB@'; + PROJECTM_VERSION_MAJOR = @PROJECTM_VERSION_MAJOR@; + PROJECTM_VERSION_MINOR = @PROJECTM_VERSION_MINOR@; + PROJECTM_VERSION_RELEASE = @PROJECTM_VERSION_RELEASE@; + PROJECTM_VERSION = (PROJECTM_VERSION_MAJOR * VERSION_MAJOR) + + (PROJECTM_VERSION_MINOR * VERSION_MINOR) + + (PROJECTM_VERSION_RELEASE * VERSION_RELEASE); + {$ENDIF} + + {$@DEFINE_HAVE_PORTAUDIO@ HavePortaudio} + {$IFDEF HavePortaudio} + libportaudio = '@PORTAUDIO_LIB@'; + PORTAUDIO_VERSION_MAJOR = @PORTAUDIO_VERSION_MAJOR@; + PORTAUDIO_VERSION_MINOR = @PORTAUDIO_VERSION_MINOR@; + PORTAUDIO_VERSION_RELEASE = @PORTAUDIO_VERSION_RELEASE@; + PORTAUDIO_VERSION = (PORTAUDIO_VERSION_MAJOR * VERSION_MAJOR) + + (PORTAUDIO_VERSION_MINOR * VERSION_MINOR) + + (PORTAUDIO_VERSION_RELEASE * VERSION_RELEASE); + {$ENDIF} + + {$@DEFINE_HAVE_PORTMIXER@ HavePortmixer} + {$IFDEF HavePortmixer} + libportmixer = '@PORTMIXER_LIB@'; + PORTMIXER_VERSION_MAJOR = @PORTMIXER_VERSION_MAJOR@; + PORTMIXER_VERSION_MINOR = @PORTMIXER_VERSION_MINOR@; + PORTMIXER_VERSION_RELEASE = @PORTMIXER_VERSION_RELEASE@; + PORTMIXER_VERSION = (PORTMIXER_VERSION_MAJOR * VERSION_MAJOR) + + (PORTMIXER_VERSION_MINOR * VERSION_MINOR) + + (PORTMIXER_VERSION_RELEASE * VERSION_RELEASE); + {$ENDIF} diff --git a/Game/Code/configure.ac b/Game/Code/configure.ac new file mode 100644 index 00000000..2c4e37f1 --- /dev/null +++ b/Game/Code/configure.ac @@ -0,0 +1,307 @@ +# +# UltraStar-DX configure.in script +# +# by UltraStar Deluxe Team +# +# Call "aclocal -I m4" to create the aclocal.m4 file. +# Process this file with autoconf to produce a configure script. +# + +# Require autoconf >= 2.61 +AC_PREREQ(2.61) + +# Init autoconf +AC_INIT([UltraStar Deluxe], [1.1], [TODO: send bugreport BUG-REPORT-ADDRESS]) +AC_CONFIG_SRCDIR(UltraStar.lpr) +AC_CONFIG_MACRO_DIR(m4) + +# show features and packages in one list +AC_PRESERVE_HELP_ORDER + +# ----------------------------------------- +# define switches +# ----------------------------------------- + +# print library option header +AC_ARG_WITH([cfg-dummy1], [ +External Libraries:]) + +# add lazarus option +AC_ARG_WITH([lazarus], + [AS_HELP_STRING([--with-lazarus=DIR], + [Directory of lazarus directory @<:@LAZARUSDIR@:>@])], + [with_lazarus=$withval], [with_lazarus="yes"]) +if [[ $with_lazarus = "no" ]] ; then + AC_MSG_ERROR("Lazarus is required. It is impossible to build without it."); +fi + +# add portaudio option +AC_ARG_WITH([portaudio], + [AS_HELP_STRING([--with-portaudio=DIR], + [Directory of portaudio library @<:@PORTAUDIODIR@:>@])], + [with_portaudio=$withval], [with_portaudio="yes"]) + +# add portmixer option +AC_ARG_WITH([portmixer], + [AS_HELP_STRING([--with-portmixer@<:@=DIR@:>@], + [Enable portmixer audio-mixer support @<:@default=check@:>@])], + [with_portmixer=$withval], [with_portmixer="check"]) + +# add projectM option +AC_ARG_WITH([projectM], + [AS_HELP_STRING([--with-projectM@<:@=DIR@:>@], + [Enable projectM visualization support @<:@default=check@:>@])], + [with_projectM=$withval], [with_projectM="check"]) + +# AC_ARG_ENABLE(foobar, +# [ --enable-foobar Dummy option], +# enable_foobar=$enableval, enable_foobar="no") + + +# ----------------------------------------- +# macro declarations +# ----------------------------------------- + +# AC_SPLIT_VERSION(VARIABLE_PREFIX, VERSION) +# Splits version number ("major.minor.release") into its components. +# Sets +# [$VARIABLE_PREFIX]_VERSION_MAJOR +# [$VARIABLE_PREFIX]_VERSION_MINOR +# [$VARIABLE_PREFIX]_VERSION_RELEASE +# This function calls +# AC_SUBST([$VARIABLE_PREFIX]_VERSION_type] for each type +AC_DEFUN([AC_SPLIT_VERSION], +[ + # replace "." and "-" with " " and ignore trailing tokens. + # 1.23.4-r2 will be splitted to [maj=1, min=23, rel=4]. + # In addition we delete every character which is not 0-9. + # 1.3a4-r32 will be [maj=1, min=34, rel=32]. + # + # Note: We use a here-document (<<< here-strings not POSIX compatible) + # Do NOT indent the eof-delimiter + read major minor release ignore <@) + fi + else + AC_MSG_CHECKING(for [$2]) + fi + if test x$have_lib = xno; then + [$1][_HAVE]="no" + AC_SPLIT_VERSION([$1], [0.0.0]) + AC_MSG_RESULT(no) + if test x$3 = xyes -o x$4 = xyes; then + AC_MSG_ERROR(["Could not find required library $2. Please install $2 and try again."]); + fi + fi +]) + +# ----------------------------------------- +# check for compilers +# ----------------------------------------- + +# find and test the freepascal compiler +# sets PFLAGS, FPC_VERSION, FPC_DEBUG, etc. +AC_PROG_FPC +AC_SPLIT_VERSION(FPC, $FPC_VERSION) + +# find and test the C compiler (for C-libs and wrappers) +AC_PROG_CC +AC_LANG([C]) + +# find and test the C++ compiler (for C-libs and wrappers) +AC_PROG_CXX +AC_LANG([C++]) + +# options for make command +AC_PROG_MAKE_SET +# find tool for ln -s +AC_LN_S +# find the best install tool +AC_PROG_INSTALL +# some other useful tools +#AC_PROG_AWK +#AC_PROG_SED +#AC_PROG_GREP +#AC_PROG_EGREP + +# find pkg-config +PKG_PROG_PKG_CONFIG() +if [[ x$PKG_CONFIG = x ]]; then + AC_MSG_ERROR([ +!!! pkg-config was not found on your system. +!!! It is needed to determine the versions of your libraries. +!!! Install it and try again.]) +fi + +# ----------------------------------------- +# check for libraries +# ----------------------------------------- + +# set dirs to check for lazarus +if [[ x$with_lazarus = xyes ]]; then + # use default path (ignore the standard path (PATH) because the lazarus executable might + # be in /usr/bin, but what we want is the program directory with the libs) + LAZARUS_CHECK_DIRS="/usr/bin/lazarus:/usr/lib/lazarus:/usr/share/lazarus:/opt/lazarus:/usr/local/bin/lazarus:/usr/local/lib/lazarus:/usr/local/share/lazarus" +else + # check if dir is valid + if [[ -d $with_lazarus ]] ; then + LAZARUS_CHECK_DIRS=$with_lazarus + else + AC_MSG_ERROR(["LAZARUSDIR is not a directory."]); + fi +fi + +# find lazarus +AC_PATH_PROG(LAZARUS, lazarus, no, [$LAZARUS_CHECK_DIRS]) +if [[ $LAZARUS = "no" ]] ; then + AC_MSG_ERROR(["Could not find lazarus. Please install lazarus and try again."]); +fi +LAZARUS_DIR=`dirname "$LAZARUS"` + +# get lazarus version +AC_MSG_CHECKING(for version of lazarus) +# (do this in a temporary shell to prevent a change of directory) +LAZARUS_VERSION=`(cd "$LAZARUS_DIR/tools/install"; ./get_lazarus_version.sh)` +#LAZARUS_VERSION=`cat ide/version.inc | tr -d "' \t"` +AC_SPLIT_VERSION([LAZARUS], [$LAZARUS_VERSION]) +AC_MSG_RESULT(@<:@$LAZARUS_VERSION@:>@) + +# find sdl +AC_PKG_CHECK_VERSION(SDL, [sdl], yes) + +# find sqlite3 +AC_PKG_CHECK_VERSION(SQLITE3, [sqlite3], yes) + +# find ffmpeg +AC_PKG_CHECK_VERSION(AVCODEC, [libavcodec], yes) +AC_CHECK_LIB(avcodec, avcodec_decode_audio) +AC_CHECK_LIB(avcodec, avcodec_decode_audio2) +AC_CHECK_LIB(avcodec, img_convert) +AC_PKG_CHECK_VERSION(AVFORMAT, [libavformat], yes) +AC_PKG_CHECK_VERSION(AVUTIL, [libavutil], yes) +AC_PKG_CHECK_VERSION(SWSCALE, [libswscale], no) + +if [[ x$AVCODEC_HAVE = xyes -a x$AVFORMAT_HAVE = xyes -a x$AVUTIL_HAVE = xyes ]]; then + FFMPEG_HAVE=yes +else + FFMPEG_HAVE=no +fi + +# find projectM version +AC_PKG_CHECK_VERSION(PROJECTM, [libprojectM], no, $with_projectM, [], 0.99) + +# find portaudio version +AC_PKG_CHECK_VERSION(PORTAUDIO, [portaudio-2.0], yes, $with_portaudio) +AC_PKG_CHECK_VERSION(PORTMIXER, [portmixer], no, $with_portmixer) + +# ----------------------------------------- +# defines for config.inc +# ----------------------------------------- + +# AC_SUBST_DEFINE(DEFINE_SUFFIX, IS_DEFINED) +AC_DEFUN([AC_SUBST_DEFINE], +[ + if [[ x$2 = xyes ]]; then + DEFINE_[$1]=DEFINE + else + DEFINE_[$1]=UNDEF + fi + AC_SUBST(DEFINE_[$1]) +]) + +AC_SUBST_DEFINE(DEBUG, $FPC_DEBUG) + +AC_SUBST(AVCODEC_LIB) +AC_SUBST(AVFORMAT_LIB) +AC_SUBST(AVUTIL_LIB) +AC_SUBST_DEFINE(HAVE_FFMPEG, $FFMPEG_HAVE) + +AC_SUBST(SWSCALE_LIB) +AC_SUBST_DEFINE(HAVE_SWSCALE, $SWSCALE_HAVE) + +AC_SUBST(PROJECTM_LIB) +AC_SUBST_DEFINE(HAVE_PROJECTM, $PROJECTM_HAVE) + +AC_SUBST(PORTAUDIO_LIB) +AC_SUBST_DEFINE(HAVE_PORTAUDIO, $PORTAUDIO_HAVE) + +AC_SUBST(PORTMIXER_LIB) +AC_SUBST_DEFINE(HAVE_PORTMIXER, $PORTMIXER_HAVE) + +AC_SUBST(LAZARUS_DIR) + +# ----------------------------------------- +# create output files +# ----------------------------------------- + +AC_CONFIG_FILES([config.inc Makefile]) +AC_OUTPUT + +# ----------------------------------------- +# show results +# ----------------------------------------- + +AC_MSG_NOTICE([ + +!!! Configuration done! +!!! Type "make" to compile the program. +]) diff --git a/Game/Code/m4/fpc.m4 b/Game/Code/m4/fpc.m4 new file mode 100644 index 00000000..44822b28 --- /dev/null +++ b/Game/Code/m4/fpc.m4 @@ -0,0 +1,148 @@ +dnl ** Version 1.1 of file is part of the LGPLed +dnl ** J Sound System (http://jss.sourceforge.net) +dnl ** +dnl ** Checks for Free Pascal Compiler by Matti "ccr/TNSP" Hamalainen +dnl ** (C) Copyright 2000-2001 Tecnic Software productions (TNSP) +dnl ** +dnl ** Versions +dnl ** -------- +dnl ** 1.0 - Created +dnl ** +dnl ** 1.1 - Added stuff to enable unix -> win32 +dnl ** cross compilation. +dnl ** +dnl ** 1.x - A few fixes (by the UltraStar Deluxe Team) +dnl ** + +AC_DEFUN([AC_PROG_FPC], [ + +AC_ARG_VAR(PFLAGS, [Free Pascal Compiler flags]) + +AC_ARG_ENABLE(dummy_fpc1,[ +Free Pascal Compiler specific options:]) + +AC_ARG_WITH(fpc, + [AS_HELP_STRING([--with-fpc], + [Directory of the FPC executable @<:@PATH@:>@])], + [PPC_PATH=$withval], []) + +FPC_DEBUG="no" + +AC_ARG_ENABLE(debug, + [AS_HELP_STRING([--enable-debug], + [Enable FPC debug options @<:@default=no@:>@])], + [FPC_DEBUG="yes"], []) + + +AC_ARG_ENABLE(release, + [AS_HELP_STRING([--enable-release], + [Enable FPC release options (same as --enable-debug=no)])], + [FPC_DEBUG="no"], []) + +dnl use -dDEBUG (instead of -g) so it uses the fpc.cfg defaults +AC_ARG_WITH(debug-flags, + [AS_HELP_STRING([--with-debug-flags], + [FPC debug flags @<:@-dDEBUG@:>@])], + [fpc_debugflags="$withval"], + [fpc_debugflags="-dDEBUG"]) + +dnl use -dDEBUG (instead of e.g. -O2) so it uses the fpc.cfg defaults +AC_ARG_WITH(release-flags, + [AS_HELP_STRING([--with-release-flags], + [FPC release flags @<:@-dRELEASE@:>@])], + [fpc_releaseflags="$withval"], + [fpc_releaseflags="-dRELEASE"]) + +if test x$FPC_DEBUG = xyes; then + PFLAGS="$PFLAGS $fpc_debugflags" +else + PFLAGS="$PFLAGS $fpc_releaseflags" +fi + +AC_ARG_ENABLE(profile, + [AS_HELP_STRING([--enable-profile], + [Enable FPC profiling options])], + [PFLAGS="$PFLAGS -pg"], []) + +PPC_CHECK_PROGS="fpc FPC ppc386 ppc PPC386 ppos2" + +if test -z "$PPC_PATH"; then + PPC_PATH=$PATH + AC_CHECK_PROGS(PPC, $PPC_CHECK_PROGS) +else + AC_PATH_PROGS(PPC, $PPC_CHECK_PROGS, [], $PPC_PATH) +fi +if test -z "$PPC"; then + AC_MSG_ERROR([no Free Pascal Compiler found in $PPC_PATH]) +fi + +AC_PROG_FPC_WORKS +AC_PROG_FPC_LINKS + +dnl *** Get the FPC version and some paths +FPC_VERSION=`${PPC} ${PFLAGS} -iV` +FPC_PLATFORM=`${PPC} ${PFLAGS} -iTO` +FPC_PROCESSOR=`${PPC} ${PFLAGS} -iTP` +if test "x$prefix" != xNONE; then + FPC_PREFIX=$prefix +else + FPC_PREFIX=$ac_default_prefix +fi +FPC_BASE_PATH="${FPC_PREFIX}/lib/fpc/${FPC_VERSION}" +FPC_UNIT_PATH="${FPC_BASE_PATH}/units/${FPC_PLATFORM}" +AC_SUBST(PFLAGS) +AC_SUBST(FPC_VERSION) +AC_SUBST(FPC_PLATFORM) +AC_SUBST(FPC_PROCESSOR) +AC_SUBST(FPC_PREFIX) +AC_SUBST(FPC_BASE_PATH) +AC_SUBST(FPC_UNIT_PATH) +]) + + +dnl *** +dnl *** Check if FPC works and can compile a program +dnl *** +AC_DEFUN([AC_PROG_FPC_WORKS], +[AC_CACHE_CHECK([whether the Free Pascal Compiler ($PPC $PFLAGS) works], ac_cv_prog_ppc_works, +[ +rm -f conftest* +echo "program foo; begin writeln; end." > conftest.pp +${PPC} ${PFLAGS} conftest.pp >> config.log + +if test -f conftest || test -f conftest.exe; then +dnl *** It works! + ac_cv_prog_ppc_works="yes" + +else + ac_cv_prog_ppc_works="no" +fi +rm -f conftest* +dnl AC_MSG_RESULT($ac_cv_prog_ppc_works) +if test x$ac_cv_prog_ppc_works = xno; then + AC_MSG_ERROR([installation or configuration problem: Cannot create executables.]) +fi +])]) + + +dnl *** +dnl *** Check if FPC can link with standard libraries +dnl *** +AC_DEFUN([AC_PROG_FPC_LINKS], +[AC_CACHE_CHECK([whether the Free Pascal Compiler ($PPC $PFLAGS) can link], ac_cv_prog_ppc_works, +[ +rm -f conftest* +echo "program foo; uses crt; begin writeln; end." > conftest.pp +${PPC} ${PFLAGS} conftest.pp >> config.log +if test -f conftest || test -f conftest.exe; then + ac_cv_prog_ppc_links="yes" +else + ac_cv_prog_ppc_links="no" +fi +rm -f conftest* +AC_MSG_RESULT($ac_cv_prog_ppc_links) +if test x$ac_cv_prog_ppc_links = xno; then + AC_MSG_ERROR([installation or configuration problem: Cannot link with some standard libraries.]) +fi +])]) + -- cgit v1.2.3 From 5717a98e5cade730eabe7ee06daf3f5afc7dd190 Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 18 Jan 2008 18:38:15 +0000 Subject: sorry, missed this one git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@797 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/install-sh | 251 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 251 insertions(+) create mode 100644 Game/Code/install-sh (limited to 'Game/Code') diff --git a/Game/Code/install-sh b/Game/Code/install-sh new file mode 100644 index 00000000..e9de2384 --- /dev/null +++ b/Game/Code/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 -- cgit v1.2.3 From fc31e84fe89000bee337983d933539794c7552fd Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Sun, 20 Jan 2008 16:27:17 +0000 Subject: Fixed compilation on the mac. At the moment the project doesn't link on the mac. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@798 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlatformMacOSX.pas | 48 +++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 13 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlatformMacOSX.pas b/Game/Code/Classes/UPlatformMacOSX.pas index 30a2ab47..7b081607 100644 --- a/Game/Code/Classes/UPlatformMacOSX.pas +++ b/Game/Code/Classes/UPlatformMacOSX.pas @@ -1,5 +1,18 @@ unit UPlatformMacOSX; +// Note on directories (by eddie): +// We use subfolders of the application directory on tha mac, because: +// 1. Installation on the mac works as follows: Extract and copy an application +// and if you don't like or need the application anymore you move the folder +// to the trash - and you're done. +// 2. If we would use subfolders of the home directory we would have to spread our +// files to many directories - these directories are defined by Apple, but the +// average user doesn't know them, beacuse he or she doesn't need to know them. +// But for UltraStar the user must at least know the songs directory... +// +// Creating a subfolder directly under the home directory is not acceptable. +// + interface {$IFDEF FPC} @@ -13,15 +26,14 @@ uses Classes, UPlatform; type TPlatformMacOSX = class( TInterfacedObject, IPlatform) - private public - Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override; - function GetGamePath: WideString; override; + Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; procedure halt(); - function GetLogPath : WideString; override; - function GetGameSharedPath : WideString; override; - function GetGameUserPath : WideString; override; + function GetLogPath : WideString; + function GetGameSharedPath : WideString; + function GetGameUserPath : WideString; + function FindSongFile(Dir, Mask: widestring): widestring; end; implementation @@ -48,19 +60,19 @@ end; function TPlatformMacOSX.GetLogPath : WideString; begin - // surly logs go in /var/log/ ??? - Result := GetBundlePath; + // eddie: Please read the note at the top of this file, why we use the application directory and not the user directory. + Result := GetBundlePath + '/Logs'; end; function TPlatformMacOSX.GetGameSharedPath : WideString; begin + // eddie: Please read the note at the top of this file, why we use the application directory and not the user directory. Result := GetBundlePath; end; function TPlatformMacOSX.GetGameUserPath : WideString; begin - // is there no user profile ??? - // like ... /home/user/ that could be used for song locations etc ?? + // eddie: Please read the note at the top of this file, why we use the application directory and not the user directory. Result := GetBundlePath; end; @@ -69,8 +81,6 @@ var i : Integer; TheDir : pdir; ADirent : pDirent; - Entry : Longint; - info : stat; lAttrib : integer; begin i := 0; @@ -108,7 +118,7 @@ end; function TPlatformMacOSX.TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; begin - result := false; + result := false; end; @@ -117,4 +127,16 @@ begin halt; end; +function TPlatformMacOSX.FindSongFile(Dir, Mask: widestring): widestring; +var + SR: TSearchRec; // for parsing song directory +begin + Result := ''; + if SysUtils.FindFirst(Dir + Mask, faDirectory, SR) = 0 then begin + Result := SR.Name; + end; // if + SysUtils.FindClose(SR); +end; + + end. -- cgit v1.2.3 From fc789bbf80f730d9ffa8ff846b55bb067d401ee2 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Sun, 20 Jan 2008 16:27:54 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@799 b956fd51-792f-4845-bead-9b4dfca2ff2c --- .../MacOSX/UltraStarDX.xcodeproj/eddie.mode1v3 | 180 ++++-------- .../MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser | 301 +++++++++++---------- .../MacOSX/UltraStarDX.xcodeproj/project.pbxproj | 12 +- 3 files changed, 209 insertions(+), 284 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1v3 b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1v3 index 05251214..89b83464 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1v3 +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1v3 @@ -200,24 +200,24 @@ Content PBXProjectModuleGUID - 2CAC2C100D380F1200CA518A + 2C91297D0D43ADA1009299BF PBXProjectModuleLabel - URecord.pas + UPlatformMacOSX.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2CAC2C110D380F1200CA518A + 2C91297E0D43ADA1009299BF PBXProjectModuleLabel - URecord.pas + UPlatformMacOSX.pas _historyCapacity 0 bookmark - 2CAC2C120D380F1200CA518A + 2C91297F0D43ADA1009299BF history - 2CAC2C0F0D380E8700CA518A + 2C9129710D43A23B009299BF SplitCount @@ -229,35 +229,35 @@ Geometry Frame - {{0, 20}, {797, 748}} + {{0, 20}, {776, 859}} PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 130 129 797 789 0 0 1680 1028 + 79 110 776 900 0 0 1680 1028 Content PBXProjectModuleGUID - 2CAC2C000D380C5700CA518A + 2C9129800D43ADA1009299BF PBXProjectModuleLabel - UAudioInput_Bass.pas + UPlatform.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2CAC2C010D380C5700CA518A + 2C9129810D43ADA1009299BF PBXProjectModuleLabel - UAudioInput_Bass.pas + UPlatform.pas _historyCapacity 0 bookmark - 2CAC2C140D380F1200CA518A + 2C9129820D43ADA1009299BF history - 2CAC2C130D380F1200CA518A + 2C9129700D43A20F009299BF SplitCount @@ -269,75 +269,35 @@ Geometry Frame - {{0, 20}, {874, 786}} + {{0, 20}, {776, 858}} PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 15 196 874 827 0 0 1680 1028 + 200 118 776 899 0 0 1680 1028 Content PBXProjectModuleGUID - 2C36B5C30D358BF100E8D797 + 2C4D9D060D381D8200270C66 PBXProjectModuleLabel - UltraStarDX.pas + UScreenMain.pas PBXSplitModuleInNavigatorKey Split0 PBXProjectModuleGUID - 2C36B5C40D358BF100E8D797 + 2C4D9D070D381D8200270C66 PBXProjectModuleLabel - UltraStarDX.pas + UScreenMain.pas _historyCapacity 0 bookmark - 2CAC2C150D380F1200CA518A + 2C9129830D43ADA1009299BF history - 2CAC2C030D380C5700CA518A - - - SplitCount - 1 - - StatusBarVisibility - - - Geometry - - Frame - {{0, 20}, {987, 762}} - PBXModuleWindowStatusBarHidden2 - - RubberWindowFrame - 311 168 987 803 0 0 1680 1028 - - - - Content - - PBXProjectModuleGUID - 2C36B5750D3585ED00E8D797 - PBXProjectModuleLabel - UScreenSing.pas - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 2C36B5760D3585ED00E8D797 - PBXProjectModuleLabel - UScreenSing.pas - _historyCapacity - 0 - bookmark - 2CAC2C160D380F1200CA518A - history - - 2C36B5E20D358CFB00E8D797 + 2C4D9D1C0D381F7A00270C66 SplitCount @@ -353,47 +313,7 @@ PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 38 134 754 888 0 0 1680 1028 - - - - Content - - PBXProjectModuleGUID - 2C5A593F0D35811F00DCBB8F - PBXProjectModuleLabel - UIni.pas - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 2C5A59400D35811F00DCBB8F - PBXProjectModuleLabel - UIni.pas - _historyCapacity - 0 - bookmark - 2CAC2C170D380F1200CA518A - history - - 2C36B5E30D358CFB00E8D797 - - - SplitCount - 1 - - StatusBarVisibility - - - Geometry - - Frame - {{0, 20}, {797, 748}} - PBXModuleWindowStatusBarHidden2 - - RubberWindowFrame - 107 150 797 789 0 0 1680 1028 + 38 135 754 888 0 0 1680 1028 @@ -480,7 +400,7 @@ PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 88}, {266, 694}} + {{0, 0}, {266, 694}} PBXTopSmartGroupGIDs @@ -582,9 +502,9 @@ TableOfContents - 2CAC2BC40D3808A200CA518A + 2C91297B0D43ADA1009299BF 1CE0B1FE06471DED0097A5F4 - 2CAC2BC50D3808A200CA518A + 2C91297C0D43ADA1009299BF 1CE0B20306471E060097A5F4 1CE0B20506471E060097A5F4 @@ -716,15 +636,13 @@ 5 WindowOrderList - 1C78EAAD065D492600B07095 + 2C4D9D060D381D8200270C66 1CD10A99069EF8BA00B06720 - 2C5A593F0D35811F00DCBB8F - 2C36B5750D3585ED00E8D797 - 2C36B5C30D358BF100E8D797 + 2C9129800D43ADA1009299BF + 2C91297D0D43ADA1009299BF + 1C530D57069F1CE1000CFCEE 2C65660B0CF2236C0041F7DC - 2CAC2C000D380C5700CA518A /Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj - 2CAC2C100D380F1200CA518A WindowString 799 242 817 753 0 0 1680 1028 @@ -743,12 +661,14 @@ Dock + BecomeActive + ContentConfiguration PBXProjectModuleGUID 1CD0528F0623707200166675 PBXProjectModuleLabel - version.inc + UPlatformMacOSX.pas StatusBarVisibility @@ -765,8 +685,6 @@ 546pt - BecomeActive - ContentConfiguration PBXProjectModuleGUID @@ -806,7 +724,7 @@ TableOfContents 2C65660B0CF2236C0041F7DC - 2CAC2BCC0D38094900CA518A + 2C9129840D43ADA1009299BF 1CD0528F0623707200166675 XCMainBuildResultsModuleGUID @@ -926,13 +844,13 @@ TableOfContents 1CD10A99069EF8BA00B06720 - 2CAC2C070D380C5700CA518A + 2C9129850D43ADA1009299BF 1C162984064C10D400B95A72 - 2CAC2C080D380C5700CA518A - 2CAC2C090D380C5700CA518A - 2CAC2C0A0D380C5700CA518A - 2CAC2C0B0D380C5700CA518A - 2CAC2C0C0D380C5700CA518A + 2C9129860D43ADA1009299BF + 2C9129870D43ADA1009299BF + 2C9129880D43ADA1009299BF + 2C9129890D43ADA1009299BF + 2C91298A0D43ADA1009299BF ToolbarConfiguration xcode.toolbar.config.debugV3 @@ -941,7 +859,7 @@ WindowToolGUID 1CD10A99069EF8BA00B06720 WindowToolIsVisible - + FirstTimeWindowDisplayed @@ -959,14 +877,12 @@ Dock - BecomeActive - ContentConfiguration PBXProjectModuleGUID 1CDD528C0622207200134675 PBXProjectModuleLabel - UAudio_bass.pas + UIni.pas StatusBarVisibility @@ -987,6 +903,8 @@ 502pt + BecomeActive + ContentConfiguration PBXProjectModuleGUID @@ -1022,8 +940,8 @@ TableOfContents 1C530D57069F1CE1000CFCEE - 2C36B5940D3587D000E8D797 - 2C36B5950D3587D000E8D797 + 2C91298B0D43ADA1009299BF + 2C91298C0D43ADA1009299BF 1CDD528C0622207200134675 1CD0528E0623707200166675 @@ -1053,6 +971,8 @@ Dock + BecomeActive + ContentConfiguration PBXProjectModuleGUID @@ -1088,7 +1008,7 @@ TableOfContents 1C78EAAD065D492600B07095 - 2CAC2C0D0D380C5700CA518A + 2C4D9C9E0D3811ED00270C66 1C78EAAC065D492600B07095 ToolbarConfiguration @@ -1098,7 +1018,7 @@ WindowToolGUID 1C78EAAD065D492600B07095 WindowToolIsVisible - + Identifier diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser index 65a02a81..5e9049de 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser @@ -1,25 +1,5 @@ // !$*UTF8*$! { - 2C36B5E20D358CFB00E8D797 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2CF54F5C0CDA1B2B00627463 /* UScreenSing.pas */; - name = "UScreenSing.pas: 321"; - rLen = 0; - rLoc = 8497; - rType = 0; - vrLen = 1569; - vrLoc = 7617; - }; - 2C36B5E30D358CFB00E8D797 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C720CC9EC8C0031092D /* UIni.pas */; - name = "UIni.pas: 177"; - rLen = 0; - rLoc = 5110; - rType = 0; - vrLen = 1173; - vrLoc = 4819; - }; 2C4B70220CF757A400B0F0BD /* Until5000.dpr */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {691, 1218}}"; @@ -104,10 +84,11 @@ }; 2C4D9C6D0CC9EC8C0031092D /* UDraw.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1277, 18872}}"; - sepNavSelRange = "{9710, 15}"; + sepNavIntBoundsRect = "{{0, 0}, {836, 19516}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{6577, 1474}"; sepNavVisRect = "{{0, 4065}, {1277, 312}}"; - sepNavWindowFrame = "{{61, 240}, {616, 741}}"; + sepNavWindowFrame = "{{61, 122}, {794, 859}}"; }; }; 2C4D9C6E0CC9EC8C0031092D /* UFiles.pas */ = { @@ -146,9 +127,9 @@ }; 2C4D9C720CC9EC8C0031092D /* UIni.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {758, 11340}}"; - sepNavSelRange = "{5110, 0}"; - sepNavVisRange = "{4819, 1173}"; + sepNavIntBoundsRect = "{{0, 0}, {758, 11214}}"; + sepNavSelRange = "{5601, 15}"; + sepNavVisRange = "{5183, 839}"; sepNavVisRect = "{{0, 0}, {758, 716}}"; sepNavWindowFrame = "{{107, 94}, {797, 845}}"; }; @@ -205,18 +186,18 @@ }; 2C4D9C7A0CC9EC8C0031092D /* ULyrics.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1208, 10584}}"; - sepNavSelRange = "{6025, 1}"; - sepNavVisRange = "{5645, 705}"; + sepNavIntBoundsRect = "{{0, 0}, {758, 10626}}"; + sepNavSelRange = "{6965, 12}"; + sepNavVisRange = "{6549, 702}"; sepNavVisRect = "{{0, 4395}, {758, 716}}"; sepNavWindowFrame = "{{61, 136}, {797, 845}}"; }; }; 2C4D9C7B0CC9EC8C0031092D /* UMain.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {993, 14658}}"; - sepNavSelRange = "{6688, 0}"; - sepNavVisRange = "{5814, 1323}"; + sepNavIntBoundsRect = "{{0, 0}, {842, 15400}}"; + sepNavSelRange = "{9910, 0}"; + sepNavVisRange = "{9538, 599}"; sepNavVisRect = "{{0, 0}, {1013, 614}}"; sepNavWindowFrame = "{{30, 285}, {1052, 743}}"; }; @@ -281,7 +262,7 @@ }; 2C4D9C840CC9EC8C0031092D /* URecord.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {738, 4046}}"; + sepNavIntBoundsRect = "{{0, 0}, {738, 3794}}"; sepNavSelRange = "{0, 0}"; sepNavVisRange = "{0, 1755}"; sepNavVisRect = "{{0, 4312}, {758, 716}}"; @@ -314,9 +295,9 @@ }; 2C4D9C880CC9EC8C0031092D /* USkins.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {738, 2534}}"; - sepNavSelRange = "{3097, 0}"; - sepNavVisRange = "{1981, 1318}"; + sepNavIntBoundsRect = "{{0, 0}, {842, 2450}}"; + sepNavSelRange = "{2805, 0}"; + sepNavVisRange = "{2928, 803}"; sepNavVisRect = "{{0, 550}, {923, 342}}"; sepNavWindowFrame = "{{61, 136}, {797, 845}}"; }; @@ -340,18 +321,18 @@ }; 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {717, 16506}}"; - sepNavSelRange = "{12906, 0}"; - sepNavVisRange = "{12038, 1920}"; + sepNavIntBoundsRect = "{{0, 0}, {729, 16002}}"; + sepNavSelRange = "{14991, 11}"; + sepNavVisRange = "{14754, 1148}"; sepNavVisRect = "{{0, 3420}, {737, 826}}"; sepNavWindowFrame = "{{15, 68}, {776, 955}}"; }; }; 2C4D9C8C0CC9EC8C0031092D /* UThemes.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {738, 33208}}"; - sepNavSelRange = "{25381, 0}"; - sepNavVisRange = "{24314, 2017}"; + sepNavIntBoundsRect = "{{0, 0}, {842, 32242}}"; + sepNavSelRange = "{59317, 12}"; + sepNavVisRange = "{61073, 1036}"; sepNavVisRect = "{{0, 19678}, {923, 342}}"; sepNavWindowFrame = "{{28, 161}, {797, 845}}"; }; @@ -373,6 +354,64 @@ sepNavWindowFrame = "{{15, 178}, {797, 845}}"; }; }; + 2C4D9D0E0D381DB000270C66 /* UScreenMain.pas:221 */ = { + isa = PBXFileBreakpoint; + actions = ( + ); + breakpointStyle = 0; + continueAfterActions = 0; + countType = 0; + delayBeforeContinue = 0; + fileReference = 2CF54F4A0CDA1B2B00627463 /* UScreenMain.pas */; + hitCount = 1; + ignoreCount = 0; + lineNumber = 221; + location = UltraStarDX; + modificationTime = 221781732.375473; + state = 1; + }; + 2C4D9D160D381EBD00270C66 /* UTexture.pas:318 */ = { + isa = PBXFileBreakpoint; + actions = ( + ); + breakpointStyle = 0; + continueAfterActions = 0; + countType = 0; + delayBeforeContinue = 0; + fileReference = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; + hitCount = 0; + ignoreCount = 0; + lineNumber = 318; + location = UltraStarDX; + modificationTime = 221781728.225761; + state = 1; + }; + 2C4D9D1B0D381EEA00270C66 /* UTexture.pas:500 */ = { + isa = PBXFileBreakpoint; + actions = ( + ); + breakpointStyle = 0; + continueAfterActions = 0; + countType = 0; + delayBeforeContinue = 0; + fileReference = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; + hitCount = 1; + ignoreCount = 0; + lineNumber = 500; + location = UltraStarDX; + modificationTime = 221781740.212444; + state = 1; + }; + 2C4D9D1C0D381F7A00270C66 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2CF54F4A0CDA1B2B00627463 /* UScreenMain.pas */; + name = "UScreenMain.pas: 221"; + rLen = 0; + rLoc = 5112; + rType = 0; + vrLen = 1245; + vrLoc = 4506; + }; 2C4D9D900CC9ED4F0031092D /* FreeBitmap.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {974, 24374}}"; @@ -391,9 +430,9 @@ }; 2C4D9DCC0CC9EE6F0031092D /* UDisplay.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {764, 6454}}"; - sepNavSelRange = "{7920, 10}"; - sepNavVisRange = "{7458, 890}"; + sepNavIntBoundsRect = "{{0, 0}, {782, 6748}}"; + sepNavSelRange = "{8084, 0}"; + sepNavVisRange = "{551, 818}"; sepNavVisRect = "{{0, 4834}, {758, 716}}"; sepNavWindowFrame = "{{38, 157}, {797, 845}}"; }; @@ -409,19 +448,20 @@ }; 2C4D9DCE0CC9EE6F0031092D /* UMenu.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1220, 21980}}"; - sepNavSelRange = "{28010, 0}"; - sepNavVisRange = "{27660, 1472}"; + sepNavIntBoundsRect = "{{0, 0}, {1220, 21770}}"; + sepNavSelRange = "{25533, 1}"; + sepNavVisRange = "{22476, 1170}"; sepNavVisRect = "{{0, 3972}, {749, 470}}"; - sepNavWindowFrame = "{{38, 157}, {797, 845}}"; + sepNavWindowFrame = "{{38, 82}, {898, 920}}"; }; }; 2C4D9DCF0CC9EE6F0031092D /* UMenuButton.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {680, 8064}}"; - sepNavSelRange = "{6107, 37}"; + sepNavIntBoundsRect = "{{0, 0}, {934, 7546}}"; + sepNavSelRange = "{10421, 15}"; + sepNavVisRange = "{9357, 1695}"; sepNavVisRect = "{{0, 1104}, {577, 612}}"; - sepNavWindowFrame = "{{153, 156}, {616, 741}}"; + sepNavWindowFrame = "{{44, 71}, {993, 935}}"; }; }; 2C4D9DD00CC9EE6F0031092D /* UMenuButtonCollection.pas */ = { @@ -529,103 +569,67 @@ }; 2C8937290CE393FB005D8A87 /* UPlatform.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {776, 1638}}"; - sepNavSelRange = "{2299, 15}"; - sepNavVisRange = "{1739, 1083}"; + sepNavIntBoundsRect = "{{0, 0}, {717, 1120}}"; + sepNavSelRange = "{830, 0}"; + sepNavVisRange = "{241, 1433}"; sepNavVisRect = "{{0, 0}, {737, 826}}"; sepNavWindowFrame = "{{200, 62}, {776, 955}}"; }; }; 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {734, 1456}}"; - sepNavSelRange = "{1212, 0}"; - sepNavVisRange = "{473, 1363}"; + sepNavIntBoundsRect = "{{0, 0}, {881, 2002}}"; + sepNavSelRange = "{696, 0}"; + sepNavVisRange = "{0, 1327}"; sepNavVisRect = "{{0, 105}, {737, 827}}"; sepNavWindowFrame = "{{79, 54}, {776, 956}}"; }; }; - 2CAC2BDD0D3809F500CA518A /* UAudioInput_Bass.pas */ = { - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {815, 4018}}"; - sepNavSelRange = "{2733, 0}"; - sepNavVisRange = "{5615, 1821}"; - sepNavWindowFrame = "{{15, 140}, {874, 883}}"; - }; - }; - 2CAC2C030D380C5700CA518A /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; - name = "UltraStarDX.pas: 4"; - rLen = 0; - rLoc = 131; - rType = 0; - vrLen = 126; - vrLoc = 0; - }; - 2CAC2C0F0D380E8700CA518A /* PBXBookmark */ = { + 2C9129700D43A20F009299BF /* PBXBookmark */ = { isa = PBXBookmark; - fRef = 2C4D9C840CC9EC8C0031092D /* URecord.pas */; + fRef = 2C8937290CE393FB005D8A87 /* UPlatform.pas */; }; - 2CAC2C120D380F1200CA518A /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C840CC9EC8C0031092D /* URecord.pas */; - name = "URecord.pas: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 1755; - vrLoc = 0; - }; - 2CAC2C130D380F1200CA518A /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2CAC2BDD0D3809F500CA518A /* UAudioInput_Bass.pas */; - name = "UAudioInput_Bass.pas: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 1426; - vrLoc = 2083; + 2C9129710D43A23B009299BF /* PBXBookmark */ = { + isa = PBXBookmark; + fRef = 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */; }; - 2CAC2C140D380F1200CA518A /* PBXTextBookmark */ = { + 2C91297F0D43ADA1009299BF /* PBXTextBookmark */ = { isa = PBXTextBookmark; - fRef = 2CAC2BDD0D3809F500CA518A /* UAudioInput_Bass.pas */; - name = "UAudioInput_Bass.pas: 131"; + fRef = 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */; + name = "UPlatformMacOSX.pas: 31"; rLen = 0; - rLoc = 2733; + rLoc = 1020; rType = 0; - vrLen = 1821; - vrLoc = 5615; + vrLen = 1818; + vrLoc = 23; }; - 2CAC2C150D380F1200CA518A /* PBXTextBookmark */ = { + 2C9129820D43ADA1009299BF /* PBXTextBookmark */ = { isa = PBXTextBookmark; - fRef = DDC6851B09F57195004E4BFF /* UltraStarDX.pas */; - name = "UltraStarDX.pas: 3"; + fRef = 2C8937290CE393FB005D8A87 /* UPlatform.pas */; + name = "UPlatform.pas: 31"; rLen = 0; - rLoc = 72; + rLoc = 830; rType = 0; - vrLen = 152; - vrLoc = 0; + vrLen = 1433; + vrLoc = 241; }; - 2CAC2C160D380F1200CA518A /* PBXTextBookmark */ = { + 2C9129830D43ADA1009299BF /* PBXTextBookmark */ = { isa = PBXTextBookmark; - fRef = 2CF54F5C0CDA1B2B00627463 /* UScreenSing.pas */; - name = "UScreenSing.pas: 320"; + fRef = 2CF54F4A0CDA1B2B00627463 /* UScreenMain.pas */; + name = "UScreenMain.pas: 220"; rLen = 0; - rLoc = 8497; + rLoc = 5112; rType = 0; - vrLen = 1601; - vrLoc = 7561; + vrLen = 1285; + vrLoc = 4486; }; - 2CAC2C170D380F1200CA518A /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2C4D9C720CC9EC8C0031092D /* UIni.pas */; - name = "UIni.pas: 177"; - rLen = 0; - rLoc = 5110; - rType = 0; - vrLen = 1173; - vrLoc = 4819; + 2CAC2BDD0D3809F500CA518A /* UAudioInput_Bass.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {815, 4018}}"; + sepNavSelRange = "{2733, 0}"; + sepNavVisRange = "{5604, 1832}"; + sepNavWindowFrame = "{{15, 140}, {874, 883}}"; + }; }; 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = { uiCtxt = { @@ -642,7 +646,7 @@ argumentStrings = ( ); autoAttachOnCrash = 1; - breakpointsEnabled = 0; + breakpointsEnabled = 1; configStateDict = { }; customDataFormattersEnabled = 1; @@ -734,8 +738,9 @@ }; 2CF54F450CDA1B2B00627463 /* UScreenEditConvert.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1178, 8092}}"; - sepNavSelRange = "{41, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {842, 8484}}"; + sepNavSelRange = "{13516, 0}"; + sepNavVisRange = "{13202, 415}"; sepNavVisRect = "{{0, 0}, {715, 815}}"; sepNavWindowFrame = "{{15, 79}, {754, 944}}"; }; @@ -774,9 +779,9 @@ }; 2CF54F4A0CDA1B2B00627463 /* UScreenMain.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {695, 4102}}"; - sepNavSelRange = "{3430, 0}"; - sepNavVisRange = "{2860, 1701}"; + sepNavIntBoundsRect = "{{0, 0}, {695, 4018}}"; + sepNavSelRange = "{5112, 0}"; + sepNavVisRange = "{4486, 1285}"; sepNavVisRect = "{{0, 0}, {715, 815}}"; sepNavWindowFrame = "{{38, 79}, {754, 944}}"; }; @@ -919,17 +924,18 @@ }; 2CF54F5C0CDA1B2B00627463 /* UScreenSing.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {695, 19880}}"; - sepNavSelRange = "{8497, 0}"; - sepNavVisRange = "{7561, 1601}"; + sepNavIntBoundsRect = "{{0, 0}, {1250, 18788}}"; + sepNavSelRange = "{39356, 0}"; + sepNavVisRange = "{39482, 1725}"; sepNavVisRect = "{{0, 0}, {715, 815}}"; sepNavWindowFrame = "{{38, 78}, {754, 944}}"; }; }; 2CF54F5D0CDA1B2B00627463 /* UScreenSingModi.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1277, 9324}}"; - sepNavSelRange = "{265, 14}"; + sepNavIntBoundsRect = "{{0, 0}, {729, 9912}}"; + sepNavSelRange = "{21169, 11}"; + sepNavVisRange = "{20602, 649}"; sepNavVisRect = "{{0, 187}, {1277, 312}}"; sepNavWindowFrame = "{{15, 79}, {754, 944}}"; }; @@ -1091,7 +1097,7 @@ }; DDC6850F09F5717A004E4BFF /* Project object */ = { activeArchitecture = i386; - activeBuildConfigurationName = Release; + activeBuildConfigurationName = Debug; activeExecutable = 2CDD4B5D0CB9354800549FAC /* UltraStarDX */; activeTarget = DDC688C709F574E9004E4BFF /* UltraStarDX */; addToTargets = ( @@ -1099,6 +1105,9 @@ DDC688D409F57523004E4BFF /* Put all program sources also in this target */, ); breakpoints = ( + 2C4D9D0E0D381DB000270C66 /* UScreenMain.pas:221 */, + 2C4D9D160D381EBD00270C66 /* UTexture.pas:318 */, + 2C4D9D1B0D381EEA00270C66 /* UTexture.pas:500 */, ); codeSenseManager = 2CDD4B6A0CB9357000549FAC /* Code sense */; executables = ( @@ -1227,20 +1236,16 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 221776031; - PBXWorkspaceStateSaveDate = 221776031; + PBXPerProjectTemplateStateSaveDate = 222536036; + PBXWorkspaceStateSaveDate = 222536036; }; perUserProjectItems = { - 2C36B5E20D358CFB00E8D797 /* PBXTextBookmark */ = 2C36B5E20D358CFB00E8D797 /* PBXTextBookmark */; - 2C36B5E30D358CFB00E8D797 /* PBXTextBookmark */ = 2C36B5E30D358CFB00E8D797 /* PBXTextBookmark */; - 2CAC2C030D380C5700CA518A /* PBXTextBookmark */ = 2CAC2C030D380C5700CA518A /* PBXTextBookmark */; - 2CAC2C0F0D380E8700CA518A /* PBXBookmark */ = 2CAC2C0F0D380E8700CA518A /* PBXBookmark */; - 2CAC2C120D380F1200CA518A /* PBXTextBookmark */ = 2CAC2C120D380F1200CA518A /* PBXTextBookmark */; - 2CAC2C130D380F1200CA518A /* PBXTextBookmark */ = 2CAC2C130D380F1200CA518A /* PBXTextBookmark */; - 2CAC2C140D380F1200CA518A /* PBXTextBookmark */ = 2CAC2C140D380F1200CA518A /* PBXTextBookmark */; - 2CAC2C150D380F1200CA518A /* PBXTextBookmark */ = 2CAC2C150D380F1200CA518A /* PBXTextBookmark */; - 2CAC2C160D380F1200CA518A /* PBXTextBookmark */ = 2CAC2C160D380F1200CA518A /* PBXTextBookmark */; - 2CAC2C170D380F1200CA518A /* PBXTextBookmark */ = 2CAC2C170D380F1200CA518A /* PBXTextBookmark */; + 2C4D9D1C0D381F7A00270C66 /* PBXTextBookmark */ = 2C4D9D1C0D381F7A00270C66 /* PBXTextBookmark */; + 2C9129700D43A20F009299BF /* PBXBookmark */ = 2C9129700D43A20F009299BF /* PBXBookmark */; + 2C9129710D43A23B009299BF /* PBXBookmark */ = 2C9129710D43A23B009299BF /* PBXBookmark */; + 2C91297F0D43ADA1009299BF /* PBXTextBookmark */ = 2C91297F0D43ADA1009299BF /* PBXTextBookmark */; + 2C9129820D43ADA1009299BF /* PBXTextBookmark */ = 2C9129820D43ADA1009299BF /* PBXTextBookmark */; + 2C9129830D43ADA1009299BF /* PBXTextBookmark */ = 2C9129830D43ADA1009299BF /* PBXTextBookmark */; }; sourceControlManager = 2CDD4B690CB9357000549FAC /* Source Control */; userBuildSettings = { diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj index fff4e14b..882b3563 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj @@ -495,7 +495,7 @@ 2CF552A40CDA42C900627463 /* opt.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = opt.pas; path = ../lib/ffmpeg/opt.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2CF552A50CDA42C900627463 /* rational.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = rational.pas; path = ../lib/ffmpeg/rational.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2CF553070CDA51B500627463 /* sdlutils.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = sdlutils.pas; path = "/Library/Frameworks/JEDI-SDL.framework/SDL/sdlutils.pas"; sourceTree = ""; tabWidth = 2; }; - 2CF77DB60CF7556C00F3B101 /* libLib_UltraPong.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libLib_UltraPong.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 2CF77DB60CF7556C00F3B101 /* libUntil5000.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libUntil5000.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; 2CF8E6BD0CDFA8E80053A996 /* UPartyDefs.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = UPartyDefs.pas; path = ../../../Modis/SDK/UPartyDefs.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 98B8BE330B1F947800162019 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 98B8BE370B1F949C00162019 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; @@ -505,7 +505,7 @@ DD37F2430A60255800975B2D /* libfpcrtl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libfpcrtl.a; sourceTree = BUILT_PRODUCTS_DIR; }; DDC6851B09F57195004E4BFF /* UltraStarDX.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; path = UltraStarDX.pas; sourceTree = ""; tabWidth = 2; }; DDC6868B09F571C2004E4BFF /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 12; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; - DDC688C809F574E9004E4BFF /* UltraStar Deluxe.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "UltraStar Deluxe.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + DDC688C809F574E9004E4BFF /* UltraStarDX.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UltraStarDX.app; sourceTree = BUILT_PRODUCTS_DIR; }; DDC688CA09F574E9004E4BFF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; DDC689B309F57C69004E4BFF /* InfoPlist.strings */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = InfoPlist.strings; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; DDC689B409F57C69004E4BFF /* SDLMain.nib */ = {isa = PBXFileReference; explicitFileType = wrapper.nib; name = SDLMain.nib; path = English.lproj/SDLMain.nib; sourceTree = ""; }; @@ -822,9 +822,9 @@ DDC6888C09F57243004E4BFF /* Products */ = { isa = PBXGroup; children = ( - DDC688C809F574E9004E4BFF /* UltraStar Deluxe.app */, + DDC688C809F574E9004E4BFF /* UltraStarDX.app */, DD37F2430A60255800975B2D /* libfpcrtl.a */, - 2CF77DB60CF7556C00F3B101 /* libLib_UltraPong.dylib */, + 2CF77DB60CF7556C00F3B101 /* libUntil5000.dylib */, ); name = Products; sourceTree = ""; @@ -856,7 +856,7 @@ ); name = Modi_Until5000; productName = Lib_UltraPong; - productReference = 2CF77DB60CF7556C00F3B101 /* libLib_UltraPong.dylib */; + productReference = 2CF77DB60CF7556C00F3B101 /* libUntil5000.dylib */; productType = "com.apple.product-type.library.dynamic"; }; DD37F2420A60255800975B2D /* fpcrtl */ = { @@ -898,7 +898,7 @@ ); name = UltraStarDX; productName = "JEDI-SDLCocoa"; - productReference = DDC688C809F574E9004E4BFF /* UltraStar Deluxe.app */; + productReference = DDC688C809F574E9004E4BFF /* UltraStarDX.app */; productType = "com.apple.product-type.application"; }; DDC688D409F57523004E4BFF /* Put all program sources also in this target */ = { -- cgit v1.2.3 From fb4154e323aeb2cb3c601a418bd5362253b62134 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Sun, 20 Jan 2008 18:15:00 +0000 Subject: Fixed song loading on OS X (UTF8 filenames). Added switches.inc. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@800 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/USong.pas | 107 +++++++++++++++++++++++++++----------------- 1 file changed, 66 insertions(+), 41 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/USong.pas b/Game/Code/Classes/USong.pas index 728f5055..e5777c75 100644 --- a/Game/Code/Classes/USong.pas +++ b/Game/Code/Classes/USong.pas @@ -1,9 +1,15 @@ -unit USong; - -interface - -uses - {$IFDEF MSWINDOWS} +unit USong; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + {$IFDEF MSWINDOWS} Windows, {$ifdef Delphi} DirWatch, @@ -29,8 +35,8 @@ uses PseudoThread, {$ENDIF} UCatCovers; - -type + +type TSingMode = ( smNormal, smPartyMode, smPlaylistRandom ); @@ -109,33 +115,43 @@ type function Analyse(): boolean; procedure clear(); end; - -implementation - -uses - TextGL, - UIni, - UMusic, // needed for Czesci .. ( whatever that is ) - UMain; //needed for Player - -constructor TSong.create( const aFileName : WideString ); + +implementation + +uses + TextGL, + UIni, + UMusic, // needed for Czesci .. ( whatever that is ) + UMain; //needed for Player + +constructor TSong.create( const aFileName : WideString ); begin - Mult := 1; - MultBPM := 4; - - fFileName := aFileName; - - if fileexists( aFileName ) then - begin - self.Path := ExtractFilePath( aFileName ); - self.Folder := ExtractFilePath( aFileName ); + + Mult := 1; + + MultBPM := 4; + + + fFileName := aFileName; + + + if fileexists( aFileName ) then + + begin + + self.Path := ExtractFilePath( aFileName ); + self.Folder := ExtractFilePath( aFileName ); self.FileName := ExtractFileName( aFileName ); - (* - if ReadTXTHeader( aFileName ) then - begin - LoadSong(); - end +(* + + if ReadTXTHeader( aFileName ) then + + begin + + LoadSong(); + + end else begin Log.LogError('Error Loading SongHeader, abort Song Loading'); @@ -145,9 +161,11 @@ begin end; end; - - function TSong.LoadSong(): boolean; - var + + +function TSong.LoadSong(): boolean; + +var TempC: char; Tekst: string; CP: integer; // Current Player (0 or 1) @@ -319,9 +337,11 @@ begin Result := true; end; - - function TSong.ReadTXTHeader(const aFileName : WideString): boolean; - var + + +function TSong.ReadTXTHeader(const aFileName : WideString): boolean; + +var Line, Identifier, Value: String; Temp : word; Done : byte; @@ -362,6 +382,11 @@ begin //Required Attributes //----------- + {$IFDEF UTF8_FILENAMES} + if ((Identifier = 'MP3') or (Identifier = 'BACKGROUND') or (Identifier = 'COVER') or (Identifier = 'VIDEO')) then + Value := Utf8Encode(Value); + {$ENDIF} + //Title if (Identifier = 'TITLE') then begin @@ -646,7 +671,7 @@ end; procedure TSong.clear(); begin - //Main Information + //Main Information Title := ''; Artist := ''; @@ -675,7 +700,7 @@ begin NotesGAP := 0; Resolution := 4; Creator := ''; - + end; function TSong.Analyse(): boolean; @@ -705,4 +730,4 @@ end; -end. +end. -- cgit v1.2.3 From 126c49ab26899dd54f2beb1d91284afeb34b50b3 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Sun, 20 Jan 2008 18:16:43 +0000 Subject: Added UTF8_FILENAMES. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@801 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/switches.inc | 1 + 1 file changed, 1 insertion(+) (limited to 'Game/Code') diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index 3980a801..d89e89b3 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -15,6 +15,7 @@ {$R-} {$DEFINE WIN32} {$DEFINE TRANSLATE} + {$DEFINE UTF8_FILENAMES} {$ELSE} {$DEFINE LAZARUS} {$ENDIF} -- cgit v1.2.3 From 8a73bd2301655e736bc307aad3c807f4b5310903 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Sun, 20 Jan 2008 18:17:19 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@802 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/USongs.pas | 14 +- .../MacOSX/UltraStarDX.xcodeproj/eddie.mode1v3 | 178 +++++++++++++++--- .../MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser | 201 +++++++++++++-------- .../MacOSX/UltraStarDX.xcodeproj/project.pbxproj | 6 + 4 files changed, 289 insertions(+), 110 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index c5acec9c..2bf98151 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -149,7 +149,9 @@ begin inherited create( false ); self.freeonterminate := true; - SongList := TList.create(); + // This check is needed if PseudoThread is used: + if not Assigned(SongList) then + SongList := TList.create(); {$ifdef Delphi} fDirWatch := TDirectoryWatch.create(nil); @@ -191,8 +193,8 @@ end; destructor TSongs.destroy(); begin - freeandnil( SongList ); -end; + freeandnil( SongList ); +end; procedure TSongs.DoDirChanged(Sender: TObject); begin @@ -227,7 +229,11 @@ begin try fProcessing := true; - SongList.clear; + {$IFDEF USE_PSEUDO_THREAD} + if not Assigned(SongList) then + SongList := TList.create(); + {$ENDIF} + SongList.clear; Log.LogError('SongList', 'Searching For Songs'); // browse directories diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1v3 b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1v3 index 89b83464..52f06983 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1v3 +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.mode1v3 @@ -196,6 +196,126 @@ OpenEditors + + Content + + PBXProjectModuleGUID + 2CB9E8C70D43BECB00214DFA + PBXProjectModuleLabel + USong.pas + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 2CB9E8C80D43BECB00214DFA + PBXProjectModuleLabel + USong.pas + _historyCapacity + 0 + bookmark + 2CB9E90F0D43C6BD00214DFA + history + + 2CB9E9080D43C60E00214DFA + + + SplitCount + 1 + + StatusBarVisibility + + + Geometry + + Frame + {{0, 20}, {993, 838}} + PBXModuleWindowStatusBarHidden2 + + RubberWindowFrame + 15 144 993 879 0 0 1680 1028 + + + + Content + + PBXProjectModuleGUID + 2CB9E8990D43B80A00214DFA + PBXProjectModuleLabel + USongs.pas + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 2CB9E89A0D43B80A00214DFA + PBXProjectModuleLabel + USongs.pas + _historyCapacity + 0 + bookmark + 2CB9E9100D43C6BD00214DFA + history + + 2CB9E8F10D43C00200214DFA + + + SplitCount + 1 + + StatusBarVisibility + + + Geometry + + Frame + {{0, 20}, {797, 748}} + PBXModuleWindowStatusBarHidden2 + + RubberWindowFrame + 15 212 797 789 0 0 1680 1028 + + + + Content + + PBXProjectModuleGUID + 2CB9E8CA0D43BECB00214DFA + PBXProjectModuleLabel + UFiles.pas + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 2CB9E8CB0D43BECB00214DFA + PBXProjectModuleLabel + UFiles.pas + _historyCapacity + 0 + bookmark + 2CB9E9110D43C6BD00214DFA + history + + 2CB9E8BF0D43BD1400214DFA + + + SplitCount + 1 + + StatusBarVisibility + + + Geometry + + Frame + {{0, 20}, {874, 786}} + PBXModuleWindowStatusBarHidden2 + + RubberWindowFrame + 84 133 874 827 0 0 1680 1028 + + Content @@ -214,10 +334,10 @@ _historyCapacity 0 bookmark - 2C91297F0D43ADA1009299BF + 2CB9E9120D43C6BD00214DFA history - 2C9129710D43A23B009299BF + 2C91297F0D43ADA1009299BF SplitCount @@ -233,7 +353,7 @@ PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 79 110 776 900 0 0 1680 1028 + 79 126 776 900 0 0 1680 1028 @@ -254,10 +374,10 @@ _historyCapacity 0 bookmark - 2C9129820D43ADA1009299BF + 2CB9E9130D43C6BD00214DFA history - 2C9129700D43A20F009299BF + 2C9129820D43ADA1009299BF SplitCount @@ -273,7 +393,7 @@ PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 200 118 776 899 0 0 1680 1028 + 200 127 776 899 0 0 1680 1028 @@ -294,10 +414,10 @@ _historyCapacity 0 bookmark - 2C9129830D43ADA1009299BF + 2CB9E9140D43C6BD00214DFA history - 2C4D9D1C0D381F7A00270C66 + 2C9129830D43ADA1009299BF SplitCount @@ -502,9 +622,9 @@ TableOfContents - 2C91297B0D43ADA1009299BF + 2CB9E8830D43B7A600214DFA 1CE0B1FE06471DED0097A5F4 - 2C91297C0D43ADA1009299BF + 2CB9E8840D43B7A600214DFA 1CE0B20306471E060097A5F4 1CE0B20506471E060097A5F4 @@ -636,13 +756,19 @@ 5 WindowOrderList + 2CB9E8900D43B7A600214DFA + 2CB9E8910D43B7A600214DFA + 2CB9E8920D43B7A600214DFA 2C4D9D060D381D8200270C66 - 1CD10A99069EF8BA00B06720 2C9129800D43ADA1009299BF 2C91297D0D43ADA1009299BF - 1C530D57069F1CE1000CFCEE 2C65660B0CF2236C0041F7DC + 2CB9E8CA0D43BECB00214DFA + 2CB9E8990D43B80A00214DFA /Users/eddie/Projekte/UltraStarDX/trunk/Game/Code/MacOSX/UltraStarDX.xcodeproj + 2CB9E8C70D43BECB00214DFA + 1C78EAAD065D492600B07095 + 1CD10A99069EF8BA00B06720 WindowString 799 242 817 753 0 0 1680 1028 @@ -661,14 +787,12 @@ Dock - BecomeActive - ContentConfiguration PBXProjectModuleGUID 1CD0528F0623707200166675 PBXProjectModuleLabel - UPlatformMacOSX.pas + StatusBarVisibility @@ -685,6 +809,8 @@ 546pt + BecomeActive + ContentConfiguration PBXProjectModuleGUID @@ -724,7 +850,7 @@ TableOfContents 2C65660B0CF2236C0041F7DC - 2C9129840D43ADA1009299BF + 2CB9E8880D43B7A600214DFA 1CD0528F0623707200166675 XCMainBuildResultsModuleGUID @@ -818,10 +944,10 @@ Frame {{312, 0}, {591, 440}} RubberWindowFrame - 130 124 903 866 0 0 1680 1028 + 13 162 903 866 0 0 1680 1028 RubberWindowFrame - 130 124 903 866 0 0 1680 1028 + 13 162 903 866 0 0 1680 1028 Module PBXDebugSessionModule @@ -844,18 +970,18 @@ TableOfContents 1CD10A99069EF8BA00B06720 - 2C9129850D43ADA1009299BF + 2CB9E8890D43B7A600214DFA 1C162984064C10D400B95A72 - 2C9129860D43ADA1009299BF - 2C9129870D43ADA1009299BF - 2C9129880D43ADA1009299BF - 2C9129890D43ADA1009299BF - 2C91298A0D43ADA1009299BF + 2CB9E88A0D43B7A600214DFA + 2CB9E88B0D43B7A600214DFA + 2CB9E88C0D43B7A600214DFA + 2CB9E88D0D43B7A600214DFA + 2CB9E88E0D43B7A600214DFA ToolbarConfiguration xcode.toolbar.config.debugV3 WindowString - 130 124 903 866 0 0 1680 1028 + 13 162 903 866 0 0 1680 1028 WindowToolGUID 1CD10A99069EF8BA00B06720 WindowToolIsVisible @@ -1008,7 +1134,7 @@ TableOfContents 1C78EAAD065D492600B07095 - 2C4D9C9E0D3811ED00270C66 + 2CB9E88F0D43B7A600214DFA 1C78EAAC065D492600B07095 ToolbarConfiguration diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser index 5e9049de..ef721549 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/eddie.pbxuser @@ -93,9 +93,9 @@ }; 2C4D9C6E0CC9EC8C0031092D /* UFiles.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1550, 10850}}"; - sepNavSelRange = "{13981, 0}"; - sepNavVisRange = "{13243, 859}"; + sepNavIntBoundsRect = "{{0, 0}, {815, 2058}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{2415, 2047}"; sepNavVisRect = "{{0, 4494}, {923, 342}}"; sepNavWindowFrame = "{{84, 77}, {874, 883}}"; }; @@ -144,9 +144,9 @@ }; 2C4D9C740CC9EC8C0031092D /* ULanguage.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {842, 3318}}"; - sepNavSelRange = "{1263, 0}"; - sepNavVisRange = "{1275, 723}"; + sepNavIntBoundsRect = "{{0, 0}, {738, 3388}}"; + sepNavSelRange = "{28, 58}"; + sepNavVisRange = "{0, 1050}"; sepNavVisRect = "{{0, 914}, {923, 342}}"; sepNavWindowFrame = "{{153, 52}, {797, 845}}"; }; @@ -304,9 +304,9 @@ }; 2C4D9C890CC9EC8C0031092D /* USongs.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {938, 13230}}"; - sepNavSelRange = "{2259, 0}"; - sepNavVisRange = "{26907, 1463}"; + sepNavIntBoundsRect = "{{0, 0}, {872, 12992}}"; + sepNavSelRange = "{6946, 0}"; + sepNavVisRange = "{6493, 916}"; sepNavVisRect = "{{0, 4157}, {758, 716}}"; sepNavWindowFrame = "{{15, 156}, {797, 845}}"; }; @@ -321,9 +321,9 @@ }; 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {729, 16002}}"; - sepNavSelRange = "{14991, 11}"; - sepNavVisRange = "{14754, 1148}"; + sepNavIntBoundsRect = "{{0, 0}, {842, 16254}}"; + sepNavSelRange = "{15244, 0}"; + sepNavVisRange = "{14754, 860}"; sepNavVisRect = "{{0, 3420}, {737, 826}}"; sepNavWindowFrame = "{{15, 68}, {776, 955}}"; }; @@ -354,22 +354,6 @@ sepNavWindowFrame = "{{15, 178}, {797, 845}}"; }; }; - 2C4D9D0E0D381DB000270C66 /* UScreenMain.pas:221 */ = { - isa = PBXFileBreakpoint; - actions = ( - ); - breakpointStyle = 0; - continueAfterActions = 0; - countType = 0; - delayBeforeContinue = 0; - fileReference = 2CF54F4A0CDA1B2B00627463 /* UScreenMain.pas */; - hitCount = 1; - ignoreCount = 0; - lineNumber = 221; - location = UltraStarDX; - modificationTime = 221781732.375473; - state = 1; - }; 2C4D9D160D381EBD00270C66 /* UTexture.pas:318 */ = { isa = PBXFileBreakpoint; actions = ( @@ -383,35 +367,9 @@ ignoreCount = 0; lineNumber = 318; location = UltraStarDX; - modificationTime = 221781728.225761; + modificationTime = 222545419.290224; state = 1; }; - 2C4D9D1B0D381EEA00270C66 /* UTexture.pas:500 */ = { - isa = PBXFileBreakpoint; - actions = ( - ); - breakpointStyle = 0; - continueAfterActions = 0; - countType = 0; - delayBeforeContinue = 0; - fileReference = 2C4D9C8B0CC9EC8C0031092D /* UTexture.pas */; - hitCount = 1; - ignoreCount = 0; - lineNumber = 500; - location = UltraStarDX; - modificationTime = 221781740.212444; - state = 1; - }; - 2C4D9D1C0D381F7A00270C66 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 2CF54F4A0CDA1B2B00627463 /* UScreenMain.pas */; - name = "UScreenMain.pas: 221"; - rLen = 0; - rLoc = 5112; - rType = 0; - vrLen = 1245; - vrLoc = 4506; - }; 2C4D9D900CC9ED4F0031092D /* FreeBitmap.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {974, 24374}}"; @@ -547,8 +505,9 @@ }; 2C4D9E440CC9F0ED0031092D /* switches.inc */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {698, 644}}"; - sepNavSelRange = "{312, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {686, 980}}"; + sepNavSelRange = "{485, 14}"; + sepNavVisRange = "{0, 1065}"; sepNavVisRect = "{{0, 7}, {577, 612}}"; sepNavWindowFrame = "{{15, 282}, {616, 741}}"; }; @@ -573,26 +532,18 @@ sepNavSelRange = "{830, 0}"; sepNavVisRange = "{241, 1433}"; sepNavVisRect = "{{0, 0}, {737, 826}}"; - sepNavWindowFrame = "{{200, 62}, {776, 955}}"; + sepNavWindowFrame = "{{200, 71}, {776, 955}}"; }; }; 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {881, 2002}}"; - sepNavSelRange = "{696, 0}"; - sepNavVisRange = "{0, 1327}"; + sepNavIntBoundsRect = "{{0, 0}, {740, 1918}}"; + sepNavSelRange = "{1020, 0}"; + sepNavVisRange = "{23, 1818}"; sepNavVisRect = "{{0, 105}, {737, 827}}"; - sepNavWindowFrame = "{{79, 54}, {776, 956}}"; + sepNavWindowFrame = "{{79, 70}, {776, 956}}"; }; }; - 2C9129700D43A20F009299BF /* PBXBookmark */ = { - isa = PBXBookmark; - fRef = 2C8937290CE393FB005D8A87 /* UPlatform.pas */; - }; - 2C9129710D43A23B009299BF /* PBXBookmark */ = { - isa = PBXBookmark; - fRef = 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */; - }; 2C91297F0D43ADA1009299BF /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */; @@ -631,6 +582,92 @@ sepNavWindowFrame = "{{15, 140}, {874, 883}}"; }; }; + 2CB9E87D0D43B78400214DFA /* USong.pas */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1550, 9898}}"; + sepNavSelRange = "{19153, 0}"; + sepNavVisRange = "{18561, 846}"; + sepNavWindowFrame = "{{15, 88}, {993, 935}}"; + }; + }; + 2CB9E8BF0D43BD1400214DFA /* PBXBookmark */ = { + isa = PBXBookmark; + fRef = 2C4D9C6E0CC9EC8C0031092D /* UFiles.pas */; + }; + 2CB9E8F10D43C00200214DFA /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; + rLen = 0; + rLoc = 291; + rType = 1; + }; + 2CB9E9080D43C60E00214DFA /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2CB9E87D0D43B78400214DFA /* USong.pas */; + rLen = 0; + rLoc = 713; + rType = 1; + }; + 2CB9E90F0D43C6BD00214DFA /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2CB9E87D0D43B78400214DFA /* USong.pas */; + name = "USong.pas: 714"; + rLen = 0; + rLoc = 19153; + rType = 0; + vrLen = 846; + vrLoc = 18561; + }; + 2CB9E9100D43C6BD00214DFA /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C890CC9EC8C0031092D /* USongs.pas */; + name = "USongs.pas: 292"; + rLen = 0; + rLoc = 6946; + rType = 0; + vrLen = 916; + vrLoc = 6493; + }; + 2CB9E9110D43C6BD00214DFA /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C4D9C6E0CC9EC8C0031092D /* UFiles.pas */; + name = "UFiles.pas: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 2047; + vrLoc = 2415; + }; + 2CB9E9120D43C6BD00214DFA /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */; + name = "UPlatformMacOSX.pas: 31"; + rLen = 0; + rLoc = 1020; + rType = 0; + vrLen = 1818; + vrLoc = 23; + }; + 2CB9E9130D43C6BD00214DFA /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2C8937290CE393FB005D8A87 /* UPlatform.pas */; + name = "UPlatform.pas: 31"; + rLen = 0; + rLoc = 830; + rType = 0; + vrLen = 1433; + vrLoc = 241; + }; + 2CB9E9140D43C6BD00214DFA /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2CF54F4A0CDA1B2B00627463 /* UScreenMain.pas */; + name = "UScreenMain.pas: 220"; + rLen = 0; + rLoc = 5112; + rType = 0; + vrLen = 1285; + vrLoc = 4486; + }; 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1013, 1022}}"; @@ -697,8 +734,8 @@ 2CEA2AF00CE3868E0097A5FF /* PseudoThread.pas */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {842, 686}}"; - sepNavSelRange = "{563, 0}"; - sepNavVisRange = "{287, 430}"; + sepNavSelRange = "{598, 0}"; + sepNavVisRange = "{214, 458}"; sepNavVisRect = "{{0, 0}, {737, 826}}"; sepNavWindowFrame = "{{15, 68}, {776, 955}}"; }; @@ -779,7 +816,7 @@ }; 2CF54F4A0CDA1B2B00627463 /* UScreenMain.pas */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {695, 4018}}"; + sepNavIntBoundsRect = "{{0, 0}, {695, 3836}}"; sepNavSelRange = "{5112, 0}"; sepNavVisRange = "{4486, 1285}"; sepNavVisRect = "{{0, 0}, {715, 815}}"; @@ -1105,9 +1142,7 @@ DDC688D409F57523004E4BFF /* Put all program sources also in this target */, ); breakpoints = ( - 2C4D9D0E0D381DB000270C66 /* UScreenMain.pas:221 */, 2C4D9D160D381EBD00270C66 /* UTexture.pas:318 */, - 2C4D9D1B0D381EEA00270C66 /* UTexture.pas:500 */, ); codeSenseManager = 2CDD4B6A0CB9357000549FAC /* Code sense */; executables = ( @@ -1236,16 +1271,22 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 222536036; - PBXWorkspaceStateSaveDate = 222536036; + PBXPerProjectTemplateStateSaveDate = 222541603; + PBXWorkspaceStateSaveDate = 222541603; }; perUserProjectItems = { - 2C4D9D1C0D381F7A00270C66 /* PBXTextBookmark */ = 2C4D9D1C0D381F7A00270C66 /* PBXTextBookmark */; - 2C9129700D43A20F009299BF /* PBXBookmark */ = 2C9129700D43A20F009299BF /* PBXBookmark */; - 2C9129710D43A23B009299BF /* PBXBookmark */ = 2C9129710D43A23B009299BF /* PBXBookmark */; 2C91297F0D43ADA1009299BF /* PBXTextBookmark */ = 2C91297F0D43ADA1009299BF /* PBXTextBookmark */; 2C9129820D43ADA1009299BF /* PBXTextBookmark */ = 2C9129820D43ADA1009299BF /* PBXTextBookmark */; 2C9129830D43ADA1009299BF /* PBXTextBookmark */ = 2C9129830D43ADA1009299BF /* PBXTextBookmark */; + 2CB9E8BF0D43BD1400214DFA /* PBXBookmark */ = 2CB9E8BF0D43BD1400214DFA /* PBXBookmark */; + 2CB9E8F10D43C00200214DFA /* PBXTextBookmark */ = 2CB9E8F10D43C00200214DFA /* PBXTextBookmark */; + 2CB9E9080D43C60E00214DFA /* PBXTextBookmark */ = 2CB9E9080D43C60E00214DFA /* PBXTextBookmark */; + 2CB9E90F0D43C6BD00214DFA /* PBXTextBookmark */ = 2CB9E90F0D43C6BD00214DFA /* PBXTextBookmark */; + 2CB9E9100D43C6BD00214DFA /* PBXTextBookmark */ = 2CB9E9100D43C6BD00214DFA /* PBXTextBookmark */; + 2CB9E9110D43C6BD00214DFA /* PBXTextBookmark */ = 2CB9E9110D43C6BD00214DFA /* PBXTextBookmark */; + 2CB9E9120D43C6BD00214DFA /* PBXTextBookmark */ = 2CB9E9120D43C6BD00214DFA /* PBXTextBookmark */; + 2CB9E9130D43C6BD00214DFA /* PBXTextBookmark */ = 2CB9E9130D43C6BD00214DFA /* PBXTextBookmark */; + 2CB9E9140D43C6BD00214DFA /* PBXTextBookmark */ = 2CB9E9140D43C6BD00214DFA /* PBXTextBookmark */; }; sourceControlManager = 2CDD4B690CB9357000549FAC /* Source Control */; userBuildSettings = { diff --git a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj index 882b3563..307af5e6 100644 --- a/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj +++ b/Game/Code/MacOSX/UltraStarDX.xcodeproj/project.pbxproj @@ -144,6 +144,8 @@ 2CAC2BF40D380AE800CA518A /* libbass.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2CAC2BF00D380AC200CA518A /* libbass.dylib */; }; 2CAC2BF80D380B1B00CA518A /* Bass.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CAC2BF70D380B1B00CA518A /* Bass.pas */; }; 2CAC2BF90D380B1B00CA518A /* Bass.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CAC2BF70D380B1B00CA518A /* Bass.pas */; }; + 2CB9E87E0D43B78400214DFA /* USong.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CB9E87D0D43B78400214DFA /* USong.pas */; }; + 2CB9E87F0D43B78400214DFA /* USong.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CB9E87D0D43B78400214DFA /* USong.pas */; }; 2CDC716C0CDB9CB70018F966 /* StrUtils.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */; }; 2CDC716D0CDB9CB70018F966 /* StrUtils.pas in Sources */ = {isa = PBXBuildFile; fileRef = 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */; }; 2CDD4BDE0CB947A400549FAC /* sdl.pas in Sources */ = {isa = PBXBuildFile; fileRef = 98B8BE5C0B1F974F00162019 /* sdl.pas */; }; @@ -438,6 +440,7 @@ 2CAC2BDF0D3809F500CA518A /* UAudioPlayback_Bass.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = UAudioPlayback_Bass.pas; path = ../Classes/UAudioPlayback_Bass.pas; sourceTree = SOURCE_ROOT; }; 2CAC2BF00D380AC200CA518A /* libbass.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbass.dylib; path = ../lib/bass/libbass.dylib; sourceTree = SOURCE_ROOT; }; 2CAC2BF70D380B1B00CA518A /* Bass.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = Bass.pas; path = ../lib/bass/MacOSX/Bass.pas; sourceTree = SOURCE_ROOT; }; + 2CB9E87D0D43B78400214DFA /* USong.pas */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.pascal; name = USong.pas; path = ../Classes/USong.pas; sourceTree = SOURCE_ROOT; }; 2CDC716B0CDB9CB70018F966 /* StrUtils.pas */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.pascal; name = StrUtils.pas; path = ../../../Modis/SDK/StrUtils.pas; sourceTree = SOURCE_ROOT; tabWidth = 2; }; 2CDEA4F60CBD725B0096994C /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; 2CE907900D1BC8A800A1FDFF /* libavcodec.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libavcodec.dylib; path = ../lib/ffmpeg/libavcodec.dylib; sourceTree = SOURCE_ROOT; }; @@ -589,6 +592,7 @@ 2CDD43820CBBE8D400F364DE /* Classes */ = { isa = PBXGroup; children = ( + 2CB9E87D0D43B78400214DFA /* USong.pas */, 2CAC2BDD0D3809F500CA518A /* UAudioInput_Bass.pas */, 2CAC2BDF0D3809F500CA518A /* UAudioPlayback_Bass.pas */, 2C8937310CE395CE005D8A87 /* UPlatformMacOSX.pas */, @@ -1155,6 +1159,7 @@ 2CAC2BE20D3809F500CA518A /* UAudioInput_Bass.pas in Sources */, 2CAC2BE40D3809F500CA518A /* UAudioPlayback_Bass.pas in Sources */, 2CAC2BF80D380B1B00CA518A /* Bass.pas in Sources */, + 2CB9E87E0D43B78400214DFA /* USong.pas in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1280,6 +1285,7 @@ 2CAC2BE70D3809F500CA518A /* UAudioInput_Bass.pas in Sources */, 2CAC2BE90D3809F500CA518A /* UAudioPlayback_Bass.pas in Sources */, 2CAC2BF90D380B1B00CA518A /* Bass.pas in Sources */, + 2CB9E87F0D43B78400214DFA /* USong.pas in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; -- cgit v1.2.3 From 8c8037702011cbcc7f1bdc420ea1430025c573e0 Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 25 Jan 2008 16:49:18 +0000 Subject: reenabled TLog.LogError(Log1, Log2: string). Some severe errors have not been displayed because this function was disabled. If this function should be deprecated then mark it as deprecated instead of just emptying the body of the function. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@803 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/ULog.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index 49b02c00..c9c87a92 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -234,7 +234,7 @@ end; procedure TLog.LogError(Log1, Log2: string); begin -//asd + LogError(Log1 + ' ['+Log2+']'); end; procedure TLog.CriticalError(Text: string); -- cgit v1.2.3 From 7870ce72a56d56736550376a15e3469fed3afd5d Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 25 Jan 2008 17:03:38 +0000 Subject: Bugfix: some inherited functions were missing. Jay please check for correctness (did you forget to check your file in?)! git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@804 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlatformLinux.pas | 39 ++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlatformLinux.pas b/Game/Code/Classes/UPlatformLinux.pas index cde737b6..2115428f 100644 --- a/Game/Code/Classes/UPlatformLinux.pas +++ b/Game/Code/Classes/UPlatformLinux.pas @@ -15,12 +15,15 @@ type TPlatformLinux = class(TInterfacedObject, IPlatform) function get_homedir(): string; public - Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override; - function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; override; - - function GetLogPath : WideString; override; - function GetGameSharedPath : WideString; override; - function GetGameUserPath : WideString; override; + function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; + function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; + function FindSongFile(Dir, Mask: widestring): widestring; + + procedure Halt; + + function GetLogPath : WideString; + function GetGameSharedPath : WideString; + function GetGameUserPath : WideString; end; implementation @@ -155,10 +158,34 @@ begin result := pPasswdEntry^.pw_dir; end; +// FIXME: just a dirty-fix to make the linux build work again. +// This i the same as the corresponding function for windows +// and MacOSX. +// Maybe this should be TPlatformBase.Halt() +procedure TPlatformLinux.Halt; +begin + application.terminate; +end; + function TPlatformLinux.TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; begin // Linux and Mac don't check for running apps at the moment Result := false; end; +// FIXME: just a dirty-fix to make the linux build work again. +// This i the same as the corresponding function for windows +// (and MacOSX?). +// Maybe this should be TPlatformBase.FindSongFile() +function TPlatformLinux.FindSongFile(Dir, Mask: widestring): widestring; +var + SR: TSearchRec; // for parsing song directory +begin + Result := ''; + if SysUtils.FindFirst(Dir + Mask, faDirectory, SR) = 0 then begin + Result := SR.Name; + end; // if + SysUtils.FindClose(SR); +end; + end. -- cgit v1.2.3 From d97013cb176bdda64e85db47d8e61a50e7e8bfb7 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 27 Jan 2008 10:05:34 +0000 Subject: - Added missing "override" for TSongs.destroy(). - Bugfix: Fixed a severe Race-Condition that crashed USDX on startup from time to time. The race-condition was due to unsuspended thread-creation in the constructor TSongs.create(). If a class is inherited from TThread and calls "inherited create(false)" in its constructor the thread will immediately start its Execute() method, although the overridden constructor is not finished yet and the members may not be initialized (in this case a TList has not been created). NOTE: If you inherit from TThread always create the thread in suspended mode ("inherited create(true)") and call "Resume()" at the end of the constructor. Don't do this if the class is subject to be overriden, otherwise you may get a race-condition in the child-classes then. In this case it would be better if Resume() was called by the creator of the object. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@805 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/USongs.pas | 1785 +++++++++++++++++++++--------------------- 1 file changed, 888 insertions(+), 897 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 2bf98151..53d5556f 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -1,897 +1,888 @@ -unit USongs; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -{$IFDEF DARWIN} - {$IFDEF DEBUG} - {$DEFINE USE_PSEUDO_THREAD} - {$ENDIF} -{$ENDIF} - -uses - {$IFDEF MSWINDOWS} - Windows, - {$ifdef Delphi} - DirWatch, - {$endif} - {$ELSE} - {$IFNDEF DARWIN} -// oldlinux, - syscall, - {$ENDIF} - baseunix, - UnixType, - {$ENDIF} - SysUtils, - Classes, - UPlatform, - ULog, - UTexture, - UCommon, - {$IFDEF DARWIN} - cthreads, - {$ENDIF} - {$IFDEF USE_PSEUDO_THREAD} - PseudoThread, - {$ENDIF} - USong, - UCatCovers; - -type - - TBPM = record - BPM: real; - StartBeat: real; - end; - - TScore = record - Name: widestring; - Score: integer; - Length: string; - end; - - - {$IFDEF USE_PSEUDO_THREAD} - TSongs = class( TPseudoThread ) - {$ELSE} - TSongs = class( TThread ) - {$ENDIF} - private - fNotify , - fWatch : longint; - fParseSongDirectory : boolean; - fProcessing : boolean; - {$ifdef Delphi} - fDirWatch : TDirectoryWatch; - {$endif} - procedure int_LoadSongList; - procedure DoDirChanged(Sender: TObject); - protected - procedure Execute; override; - public -// Song : array of TSong; // array of songs - SongList : TList; // array of songs - Selected : integer; // selected song index - constructor create(); - destructor destroy(); - - - procedure LoadSongList; // load all songs - procedure BrowseDir(Dir: widestring); // should return number of songs in the future - procedure Sort(Order: integer); - function FindSongFile(Dir, Mask: widestring): widestring; - property Processing : boolean read fProcessing; - end; - - - TCatSongs = class - Song: array of TSong; // array of categories with songs - Selected: integer; // selected song index - Order: integer; // order type (0=title) - CatNumShow: integer; // Category Number being seen - CatCount: integer; //Number of Categorys - - procedure Refresh; // refreshes arrays by recreating them from Songs array -// procedure Sort(Order: integer); - procedure ShowCategory(Index: integer); // expands all songs in category - procedure HideCategory(Index: integer); // hides all songs in category - procedure ClickCategoryButton(Index: integer); // uses ShowCategory and HideCategory when needed - procedure ShowCategoryList; //Hides all Songs And Show the List of all Categorys - function FindNextVisible(SearchFrom:integer): integer; //Find Next visible Song - function VisibleSongs: integer; // returns number of visible songs (for tabs) - function VisibleIndex(Index: integer): integer; // returns visible song index (skips invisible) - - function SetFilter(FilterStr: String; const fType: Byte): Cardinal; - end; - -var - Songs: TSongs; // all songs - CatSongs: TCatSongs; // categorized songs - -const - IN_ACCESS = $00000001; //* File was accessed */ - IN_MODIFY = $00000002; //* File was modified */ - IN_ATTRIB = $00000004; //* Metadata changed */ - IN_CLOSE_WRITE = $00000008; //* Writtable file was closed */ - IN_CLOSE_NOWRITE = $00000010; //* Unwrittable file closed */ - IN_OPEN = $00000020; //* File was opened */ - IN_MOVED_FROM = $00000040; //* File was moved from X */ - IN_MOVED_TO = $00000080; //* File was moved to Y */ - IN_CREATE = $00000100; //* Subfile was created */ - IN_DELETE = $00000200; //* Subfile was deleted */ - IN_DELETE_SELF = $00000400; //* Self was deleted */ - - -implementation - -uses StrUtils, - UGraphic, - UCovers, - UFiles, - UMain, - UIni; - -{$IFDEF DARWIN} -function AnsiContainsText(const AText, ASubText: string): Boolean; -begin - Result := AnsiPos(AnsiUppercase(ASubText), AnsiUppercase(AText)) > 0; -end; -{$ENDIF} - -constructor TSongs.create(); -begin - inherited create( false ); - self.freeonterminate := true; - - // This check is needed if PseudoThread is used: - if not Assigned(SongList) then - SongList := TList.create(); - - {$ifdef Delphi} - fDirWatch := TDirectoryWatch.create(nil); - fDirWatch.OnChange := DoDirChanged; - fDirWatch.Directory := SongPath; - fDirWatch.WatchSubDirs := true; - fDirWatch.active := true; - {$ENDIF} - - {$IFDEF linux} - (* - Thankyou to : http://www.linuxjournal.com/article/8478 - http://www.tin.org/bin/man.cgi?section=2&topic=inotify_add_watch - *) -(* - fNotify := -1; - fWatch := -1; - - writeln( 'Calling inotify_init' ); - fNotify := Do_SysCall( syscall_nr_inotify_init ); - if ( fNotify < 0 ) then - writeln( 'Filesystem change notification - disabled' ); - writeln( 'Calling inotify_init : '+ inttostr(fNotify) ); - - writeln( 'Calling syscall_nr_inotify_init ('+SongPath+')' ); - fWatch := Do_SysCall( syscall_nr_inotify_init , TSysParam( fNotify ), longint( pchar( SongPath ) ) , IN_MODIFY AND IN_CREATE AND IN_DELETE ); - - if (fWatch < 0) then - writeln ('inotify_add_watch'); - writeln( 'Calling syscall_nr_inotify_init : '+ inttostr(fWatch) ); -*) - {$endif} - -{$IFNDEF USE_PSEUDO_THREAD} -// Setlength(Song, 0); - SongList.clear; -{$ENDIF} -end; - -destructor TSongs.destroy(); -begin - freeandnil( SongList ); -end; - -procedure TSongs.DoDirChanged(Sender: TObject); -begin - LoadSongList(); -end; - -procedure TSongs.Execute(); -var - fChangeNotify : THandle; -begin -{$IFDEF USE_PSEUDO_THREAD} - int_LoadSongList(); -{$ELSE} - fParseSongDirectory := true; - - while not self.terminated do - begin - - if fParseSongDirectory then - begin - writeln( 'int_LoadSongList' ); - int_LoadSongList(); - end; - - self.suspend; - end; -{$ENDIF} -end; - -procedure TSongs.int_LoadSongList; -begin - try - fProcessing := true; - - {$IFDEF USE_PSEUDO_THREAD} - if not Assigned(SongList) then - SongList := TList.create(); - {$ENDIF} - SongList.clear; - Log.LogError('SongList', 'Searching For Songs'); - - // browse directories - BrowseDir(SongPath); - - if UserSongPath <> SongPath then - BrowseDir(UserSongPath); - - if assigned( CatSongs ) then - CatSongs.Refresh; - - if assigned( CatCovers ) then - CatCovers.Load; - - if assigned( Covers ) then - Covers.Load; - - if assigned(ScreenSong) then - begin - ScreenSong.GenerateThumbnails(); - ScreenSong.OnShow; // refresh ScreenSong - end; - - finally - Log.LogError('SongList', 'Search Complete'); - - fParseSongDirectory := false; - fProcessing := false; - end; -end; - - -procedure TSongs.LoadSongList; -begin - fParseSongDirectory := true; - self.resume; -end; - -procedure TSongs.BrowseDir(Dir: widestring); -var - i : Integer; - Files : TDirectoryEntryArray; - lSong : TSong; -begin - - Files := Platform.DirectoryFindFiles( Dir, '.txt', true); - - for i := 0 to Length(Files)-1 do - begin - if Files[i].IsDirectory then - begin - BrowseDir( Dir + Files[i].Name + PathDelim ); - end - else - begin - lSong := TSong.create( Dir + Files[i].Name ); - - if NOT lSong.Analyse then - begin - Log.LogError('AnalyseFile failed for "' + Files[i].Name + '".'); - freeandnil( lSong ); - end - else - begin - SongList.add( lSong ); - end; - - end; - end; - SetLength( Files, 0); -end; - -procedure TSongs.Sort(Order: integer); -var - S: integer; - S2: integer; - TempSong: TSong; -begin - case Order of - sEdition: // by edition - begin - for S2 := 0 to SongList.Count -1 do - for S := 1 to SongList.Count-1 do - if CompareText(TSong( SongList[S] ).Edition, TSong( SongList[S-1] ).Edition) < 0 then - begin - // zamiana miejscami - TempSong := SongList[S-1]; - SongList[S-1] := SongList[S]; - SongList[S] := TempSong; - end; - end; - sGenre: // by genre - begin - for S2 := 0 to SongList.Count-1 do - for S := 1 to SongList.Count-1 do - if CompareText(TSong( SongList[S] ).Genre, TSong( SongList[S-1] ).Genre) < 0 then - begin - // zamiana miejscami - TempSong := SongList[S-1]; - SongList[S-1] := SongList[S]; - SongList[S] := TempSong; - end; - end; - sTitle: // by title - begin - for S2 := 0 to SongList.Count-1 do - for S := 1 to SongList.Count-1 do - if CompareText(TSong( SongList[S] ).Title, TSong( SongList[S-1] ).Title) < 0 then - begin - // zamiana miejscami - TempSong := SongList[S-1]; - SongList[S-1] := SongList[S]; - SongList[S] := TempSong; - end; - - end; - sArtist: // by artist - begin - for S2 := 0 to SongList.Count-1 do - for S := 1 to SongList.Count-1 do - if CompareText(TSong( SongList[S] ).Artist, TSong( SongList[S-1] ).Artist) < 0 then - begin - // zamiana miejscami - TempSong := SongList[S-1]; - SongList[S-1] := SongList[S]; - SongList[S] := TempSong; - end; - end; - sFolder: // by folder - begin - for S2 := 0 to SongList.Count-1 do - for S := 1 to SongList.Count-1 do - if CompareText(TSong( SongList[S] ).Folder, TSong( SongList[S-1] ).Folder) < 0 then - begin - // zamiana miejscami - TempSong := SongList[S-1]; - SongList[S-1] := SongList[S]; - SongList[S] := TempSong; - end; - end; - sTitle2: // by title2 - begin - for S2 := 0 to SongList.Count-1 do - for S := 1 to SongList.Count-1 do - if CompareText(TSong( SongList[S] ).Title, TSong( SongList[S-1] ).Title) < 0 then - begin - // zamiana miejscami - TempSong := SongList[S-1]; - SongList[S-1] := SongList[S]; - SongList[S] := TempSong; - end; - - end; - sArtist2: // by artist2 - begin - for S2 := 0 to SongList.Count-1 do - for S := 1 to SongList.Count-1 do - if CompareText(TSong( SongList[S] ).Artist, TSong( SongList[S-1] ).Artist) < 0 then - begin - // zamiana miejscami - TempSong := SongList[S-1]; - SongList[S-1] := SongList[S]; - SongList[S] := TempSong; - end; - end; - sLanguage: // by Language - begin - for S2 := 0 to SongList.Count-1 do - for S := 1 to SongList.Count-1 do - if CompareText(TSong( SongList[S] ).Language, TSong( SongList[S-1] ).Language) < 0 then - begin - TempSong := SongList[S-1]; - SongList[S-1] := SongList[S]; - SongList[S] := TempSong; - end; - end; - - end; // case -end; - -function TSongs.FindSongFile(Dir, Mask: widestring): widestring; -var - SR: TSearchRec; // for parsing song directory -begin - Result := ''; - if FindFirst(Dir + Mask, faDirectory, SR) = 0 then begin - Result := SR.Name; - end; // if - FindClose(SR); -end; - -procedure TCatSongs.Refresh; -var - S: integer; // temporary song index - CatLen: integer; // length of CatSongs.Song - Letter: char; // current letter for sorting using letter - SS: string; // current edition for sorting using edition, genre etc. - Order: integer; // number used for ordernum - Letter2: char; // - CatNumber:integer; // Number of Song in Category -begin - CatNumShow := -1; -// Songs.Sort(0); // by title - -case Ini.Sorting of - sEdition: begin - Songs.Sort(sArtist); - Songs.Sort(sEdition); - end; - sGenre: begin - Songs.Sort(sArtist); - Songs.Sort(sGenre); - end; - sLanguage: begin - Songs.Sort(sArtist); - Songs.Sort(sLanguage); - end; - sFolder: begin - Songs.Sort(sArtist); - Songs.Sort(sFolder); - end; - sTitle: Songs.Sort(sTitle); - sArtist: Songs.Sort(sArtist); - sTitle2: Songs.Sort(sTitle2); // by title2 - sArtist2: Songs.Sort(sArtist2); // by artist2 - - end; // case - - - Letter := ' '; - SS := ''; - Order := 0; - CatNumber := 0; - - //Songs leeren - SetLength (Song, 0); - - for S := 0 to Songs.SongList.Count-1 do - begin - if (Ini.Tabs = 1) then - if (Ini.Sorting = sEdition) and (CompareText(SS, TSong( Songs.SongList[S] ).Edition) <> 0) then begin - // add Category Button - Inc(Order); - SS := TSong( Songs.SongList[S] ).Edition; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + SS + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - - - // 0.4.3 - // if SS = 'Singstar' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Part 2' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar German' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Spanish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Italian' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar French' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Party' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Party.jpg'; - // if SS = 'Singstar Popworld' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Popworld.jpg'; - // if SS = 'Singstar 80s' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; - // if SS = 'Singstar 80s Polish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; - // if SS = 'Singstar Rocks' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Rocks.jpg'; - // if SS = 'Singstar Anthems' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Anthems.jpg'; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';//} - - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sGenre) and (CompareText(SS, TSong( Songs.SongList[S] ).Genre) <> 0) then begin - // add Genre Button - Inc(Order); - SS := TSong( Songs.SongList[S] ).Genre; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sLanguage) and (CompareText(SS, TSong( Songs.SongList[S] ).Language) <> 0) then begin - // add Language Button - Inc(Order); - SS := TSong( Songs.SongList[S] ).Language; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sTitle) and - (Length(TSong( Songs.SongList[S] ).Title)>=1) and - (Letter <> UpperCase(TSong( Songs.SongList[S] ).Title)[1]) then begin - // add a letter Category Button - Inc(Order); - Letter := Uppercase(TSong( Songs.SongList[S] ).Title)[1]; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - - {// cover-patch - if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sArtist) and (Length(TSong( Songs.SongList[S] ).Artist)>=1) and - (Letter <> UpperCase(TSong( Songs.SongList[S] ).Artist)[1]) then begin - // add a letter Category Button - Inc(Order); - Letter := UpperCase(TSong( Songs.SongList[S] ).Artist)[1]; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sFolder) and (CompareText(SS, TSong( Songs.SongList[S] ).Folder) <> 0) then begin - // 0.5.0: add folder tab - Inc(Order); - SS := TSong( Songs.SongList[S] ).Folder; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sTitle2) AND (Length(TSong( Songs.SongList[S] ).Title)>=1) then begin - if (ord(TSong( Songs.SongList[S] ).Title[1]) > 47) and (ord(TSong( Songs.SongList[S] ).Title[1]) < 58) then Letter2 := '#' else Letter2 := UpperCase(TSong( Songs.SongList[S] ).Title)[1]; - if (Letter <> Letter2) then begin - // add a letter Category Button - Inc(Order); - Letter := Letter2; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end; - end - - else if (Ini.Sorting = sArtist2) AND (Length(TSong( Songs.SongList[S] ).Artist)>=1) then begin - if (ord(TSong( Songs.SongList[S] ).Artist[1]) > 47) and (ord(TSong( Songs.SongList[S] ).Artist[1]) < 58) then Letter2 := '#' else Letter2 := UpperCase(TSong( Songs.SongList[S] ).Artist)[1]; - if (Letter <> Letter2) then begin - // add a letter Category Button - Inc(Order); - Letter := Letter2; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end; - end; - - - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - - Inc (CatNumber); //Increase Number in Cat - - CatSongs.Song[CatLen] := TSong( Songs.SongList[S] ); - CatSongs.Song[CatLen].OrderNum := Order; // assigns category - CatSongs.Song[CatLen].CatNumber := CatNumber; - - if (Ini.Tabs = 0) then CatSongs.Song[CatLen].Visible := true - else if (Ini.Tabs = 1) then CatSongs.Song[CatLen].Visible := false; -// if (Ini.Tabs = 1) and (Order = 1) then CatSongs.Song[CatLen].Visible := true; // open first tab -//CatSongs.Song[CatLen].Visible := true; - - end; -//CatNumber Patch - Set CatNumber of Last Category -if (ini.Tabs_at_startup = 1) And (high(Song) >=1) then - Song[CatLen - CatNumber].CatNumber := CatNumber;//Set CatNumber of Categroy -//CatCount Patch -CatCount := Order; -end; - -procedure TCatSongs.ShowCategory(Index: integer); -var - S: integer; // song -begin - CatNumShow := Index; - for S := 0 to high(CatSongs.Song) do - begin - if (CatSongs.Song[S].OrderNum = Index) AND (Not CatSongs.Song[S].Main) then - CatSongs.Song[S].Visible := true - else - CatSongs.Song[S].Visible := false; - end; -end; - -procedure TCatSongs.HideCategory(Index: integer); // hides all songs in category -var - S: integer; // song -begin - for S := 0 to high(CatSongs.Song) do begin - if not CatSongs.Song[S].Main then - CatSongs.Song[S].Visible := false // hides all at now - end; -end; - -procedure TCatSongs.ClickCategoryButton(Index: integer); -var - Num, S: integer; -begin - Num := CatSongs.Song[Index].OrderNum; - if Num <> CatNumShow then - begin - ShowCategory(Num); - end - else begin - ShowCategoryList; - end; -end; - -//Hide Categorys when in Category Hack -procedure TCatSongs.ShowCategoryList; -var - Num, S: integer; -begin - //Hide All Songs Show All Cats - for S := 0 to high(CatSongs.Song) do begin - if CatSongs.Song[S].Main then - CatSongs.Song[S].Visible := true - else - CatSongs.Song[S].Visible := false - end; - CatSongs.Selected := CatNumShow; //Show last shown Category - CatNumShow := -1; -end; -//Hide Categorys when in Category Hack End - -//Wrong song selected when tabs on bug -function TCatSongs.FindNextVisible(SearchFrom:integer): integer;//Find next Visible Song -var - I: Integer; - begin - Result := -1; - I := SearchFrom + 1; - while not CatSongs.Song[I].Visible do - begin - Inc (I); - if (I>high(CatSongs.Song)) then - I := low(CatSongs.Song); - if (I = SearchFrom) then //Make One Round and no song found->quit - break; - end; - end; -//Wrong song selected when tabs on bug End - -function TCatSongs.VisibleSongs: integer; -var - S: integer; // song -begin - Result := 0; - for S := 0 to high(CatSongs.Song) do - if CatSongs.Song[S].Visible = true then Inc(Result); -end; - -function TCatSongs.VisibleIndex(Index: integer): integer; -var - S: integer; // song -begin - Result := 0; - for S := 0 to Index-1 do - if CatSongs.Song[S].Visible = true then Inc(Result); -end; - -function TCatSongs.SetFilter(FilterStr: String; const fType: Byte): Cardinal; -var - I, J: Integer; - cString: String; - SearchStr: Array of String; -begin - {fType: 0: All - 1: Title - 2: Artist} - FilterStr := Trim(FilterStr); - if FilterStr<>'' then begin - Result := 0; - //Create Search Array - SetLength(SearchStr, 1); - I := Pos (' ', FilterStr); - While (I <> 0) do - begin - SetLength (SearchStr, Length(SearchStr) + 1); - cString := Copy(FilterStr, 1, I-1); - if (cString <> ' ') AND (cString <> '') then - SearchStr[High(SearchStr)-1] := cString; - Delete (FilterStr, 1, I); - - I := Pos (' ', FilterStr); - end; - //Copy last Word - if (FilterStr <> ' ') AND (FilterStr <> '') then - SearchStr[High(SearchStr)] := FilterStr; - - for I:=0 to High(Song) do begin - if not Song[i].Main then - begin - case fType of - 0: cString := Song[I].Artist + ' ' + Song[i].Title + ' ' + Song[i].Folder; - 1: cString := Song[I].Title; - 2: cString := Song[I].Artist; - end; - Song[i].Visible:=True; - //Look for every Searched Word - For J := 0 to High(SearchStr) do - begin - Song[i].Visible := Song[i].Visible AND AnsiContainsText(cString, SearchStr[J]) - end; - if Song[i].Visible then - Inc(Result); - end - else - Song[i].Visible:=False; - end; - CatNumShow := -2; - end - else begin - for i:=0 to High(Song) do begin - Song[i].Visible:=(Ini.Tabs=1)=Song[i].Main; - CatNumShow := -1; - end; - Result := 0; - end; -end; - - - -// ----------------------------------------------------------------------------- - - - - -end. +unit USongs; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +{$IFDEF DARWIN} + {$IFDEF DEBUG} + {$DEFINE USE_PSEUDO_THREAD} + {$ENDIF} +{$ENDIF} + +uses + {$IFDEF MSWINDOWS} + Windows, + {$IFDEF Delphi} + DirWatch, + {$ENDIF} + {$ELSE} + {$IFNDEF DARWIN} + syscall, + {$ENDIF} + baseunix, + UnixType, + {$ENDIF} + SysUtils, + Classes, + UPlatform, + ULog, + UTexture, + UCommon, + {$IFDEF DARWIN} + cthreads, + {$ENDIF} + {$IFDEF USE_PSEUDO_THREAD} + PseudoThread, + {$ENDIF} + USong, + UCatCovers; + +type + + TBPM = record + BPM: real; + StartBeat: real; + end; + + TScore = record + Name: widestring; + Score: integer; + Length: string; + end; + + + {$IFDEF USE_PSEUDO_THREAD} + TSongs = class( TPseudoThread ) + {$ELSE} + TSongs = class( TThread ) + {$ENDIF} + private + fNotify , + fWatch : longint; + fParseSongDirectory : boolean; + fProcessing : boolean; + {$ifdef Delphi} + fDirWatch : TDirectoryWatch; + {$endif} + procedure int_LoadSongList; + procedure DoDirChanged(Sender: TObject); + protected + procedure Execute; override; + public +// Song : array of TSong; // array of songs + SongList : TList; // array of songs + Selected : integer; // selected song index + constructor create(); + destructor destroy(); override; + + + procedure LoadSongList; // load all songs + procedure BrowseDir(Dir: widestring); // should return number of songs in the future + procedure Sort(Order: integer); + function FindSongFile(Dir, Mask: widestring): widestring; + property Processing : boolean read fProcessing; + end; + + + TCatSongs = class + Song: array of TSong; // array of categories with songs + Selected: integer; // selected song index + Order: integer; // order type (0=title) + CatNumShow: integer; // Category Number being seen + CatCount: integer; //Number of Categorys + + procedure Refresh; // refreshes arrays by recreating them from Songs array +// procedure Sort(Order: integer); + procedure ShowCategory(Index: integer); // expands all songs in category + procedure HideCategory(Index: integer); // hides all songs in category + procedure ClickCategoryButton(Index: integer); // uses ShowCategory and HideCategory when needed + procedure ShowCategoryList; //Hides all Songs And Show the List of all Categorys + function FindNextVisible(SearchFrom:integer): integer; //Find Next visible Song + function VisibleSongs: integer; // returns number of visible songs (for tabs) + function VisibleIndex(Index: integer): integer; // returns visible song index (skips invisible) + + function SetFilter(FilterStr: String; const fType: Byte): Cardinal; + end; + +var + Songs: TSongs; // all songs + CatSongs: TCatSongs; // categorized songs + +const + IN_ACCESS = $00000001; //* File was accessed */ + IN_MODIFY = $00000002; //* File was modified */ + IN_ATTRIB = $00000004; //* Metadata changed */ + IN_CLOSE_WRITE = $00000008; //* Writtable file was closed */ + IN_CLOSE_NOWRITE = $00000010; //* Unwrittable file closed */ + IN_OPEN = $00000020; //* File was opened */ + IN_MOVED_FROM = $00000040; //* File was moved from X */ + IN_MOVED_TO = $00000080; //* File was moved to Y */ + IN_CREATE = $00000100; //* Subfile was created */ + IN_DELETE = $00000200; //* Subfile was deleted */ + IN_DELETE_SELF = $00000400; //* Self was deleted */ + + +implementation + +uses StrUtils, + UGraphic, + UCovers, + UFiles, + UMain, + UIni; + +{$IFDEF DARWIN} +function AnsiContainsText(const AText, ASubText: string): Boolean; +begin + Result := AnsiPos(AnsiUppercase(ASubText), AnsiUppercase(AText)) > 0; +end; +{$ENDIF} + +constructor TSongs.create(); +begin + // do not start thread BEFORE initialization (suspended = true) + inherited create( true ); + self.freeonterminate := true; + + SongList := TList.create(); + + {$ifdef Delphi} + fDirWatch := TDirectoryWatch.create(nil); + fDirWatch.OnChange := DoDirChanged; + fDirWatch.Directory := SongPath; + fDirWatch.WatchSubDirs := true; + fDirWatch.active := true; + {$ENDIF} + + {$IFDEF linux} + (* + Thankyou to : http://www.linuxjournal.com/article/8478 + http://www.tin.org/bin/man.cgi?section=2&topic=inotify_add_watch + *) +(* + fNotify := -1; + fWatch := -1; + + writeln( 'Calling inotify_init' ); + fNotify := Do_SysCall( syscall_nr_inotify_init ); + if ( fNotify < 0 ) then + writeln( 'Filesystem change notification - disabled' ); + writeln( 'Calling inotify_init : '+ inttostr(fNotify) ); + + writeln( 'Calling syscall_nr_inotify_init ('+SongPath+')' ); + fWatch := Do_SysCall( syscall_nr_inotify_init , TSysParam( fNotify ), longint( pchar( SongPath ) ) , IN_MODIFY AND IN_CREATE AND IN_DELETE ); + + if (fWatch < 0) then + writeln ('inotify_add_watch'); + writeln( 'Calling syscall_nr_inotify_init : '+ inttostr(fWatch) ); +*) + {$endif} + + // now we can start the thread + Resume(); +end; + +destructor TSongs.destroy(); +begin + freeandnil( SongList ); +end; + +procedure TSongs.DoDirChanged(Sender: TObject); +begin + LoadSongList(); +end; + +procedure TSongs.Execute(); +var + fChangeNotify : THandle; +begin +{$IFDEF USE_PSEUDO_THREAD} + int_LoadSongList(); +{$ELSE} + fParseSongDirectory := true; + + while not self.terminated do + begin + + if fParseSongDirectory then + begin + writeln( 'int_LoadSongList' ); + int_LoadSongList(); + end; + + self.suspend; + end; +{$ENDIF} +end; + +procedure TSongs.int_LoadSongList; +begin + try + fProcessing := true; + + Log.LogError('SongList', 'Searching For Songs'); + + // browse directories + BrowseDir(SongPath); + + if UserSongPath <> SongPath then + BrowseDir(UserSongPath); + + if assigned( CatSongs ) then + CatSongs.Refresh; + + if assigned( CatCovers ) then + CatCovers.Load; + + if assigned( Covers ) then + Covers.Load; + + if assigned(ScreenSong) then + begin + ScreenSong.GenerateThumbnails(); + ScreenSong.OnShow; // refresh ScreenSong + end; + + finally + Log.LogError('SongList', 'Search Complete'); + + fParseSongDirectory := false; + fProcessing := false; + end; +end; + + +procedure TSongs.LoadSongList; +begin + fParseSongDirectory := true; + self.resume; +end; + +procedure TSongs.BrowseDir(Dir: widestring); +var + i : Integer; + Files : TDirectoryEntryArray; + lSong : TSong; +begin + + Files := Platform.DirectoryFindFiles( Dir, '.txt', true); + + for i := 0 to Length(Files)-1 do + begin + if Files[i].IsDirectory then + begin + BrowseDir( Dir + Files[i].Name + PathDelim ); + end + else + begin + lSong := TSong.create( Dir + Files[i].Name ); + + if NOT lSong.Analyse then + begin + Log.LogError('AnalyseFile failed for "' + Files[i].Name + '".'); + freeandnil( lSong ); + end + else + begin + SongList.add( lSong ); + end; + + end; + end; + SetLength( Files, 0); +end; + +procedure TSongs.Sort(Order: integer); +var + S: integer; + S2: integer; + TempSong: TSong; +begin + case Order of + sEdition: // by edition + begin + for S2 := 0 to SongList.Count -1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Edition, TSong( SongList[S-1] ).Edition) < 0 then + begin + // zamiana miejscami + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; + end; + end; + sGenre: // by genre + begin + for S2 := 0 to SongList.Count-1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Genre, TSong( SongList[S-1] ).Genre) < 0 then + begin + // zamiana miejscami + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; + end; + end; + sTitle: // by title + begin + for S2 := 0 to SongList.Count-1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Title, TSong( SongList[S-1] ).Title) < 0 then + begin + // zamiana miejscami + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; + end; + + end; + sArtist: // by artist + begin + for S2 := 0 to SongList.Count-1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Artist, TSong( SongList[S-1] ).Artist) < 0 then + begin + // zamiana miejscami + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; + end; + end; + sFolder: // by folder + begin + for S2 := 0 to SongList.Count-1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Folder, TSong( SongList[S-1] ).Folder) < 0 then + begin + // zamiana miejscami + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; + end; + end; + sTitle2: // by title2 + begin + for S2 := 0 to SongList.Count-1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Title, TSong( SongList[S-1] ).Title) < 0 then + begin + // zamiana miejscami + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; + end; + + end; + sArtist2: // by artist2 + begin + for S2 := 0 to SongList.Count-1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Artist, TSong( SongList[S-1] ).Artist) < 0 then + begin + // zamiana miejscami + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; + end; + end; + sLanguage: // by Language + begin + for S2 := 0 to SongList.Count-1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Language, TSong( SongList[S-1] ).Language) < 0 then + begin + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; + end; + end; + + end; // case +end; + +function TSongs.FindSongFile(Dir, Mask: widestring): widestring; +var + SR: TSearchRec; // for parsing song directory +begin + Result := ''; + if FindFirst(Dir + Mask, faDirectory, SR) = 0 then begin + Result := SR.Name; + end; // if + FindClose(SR); +end; + +procedure TCatSongs.Refresh; +var + S: integer; // temporary song index + CatLen: integer; // length of CatSongs.Song + Letter: char; // current letter for sorting using letter + SS: string; // current edition for sorting using edition, genre etc. + Order: integer; // number used for ordernum + Letter2: char; // + CatNumber:integer; // Number of Song in Category +begin + CatNumShow := -1; +// Songs.Sort(0); // by title + +case Ini.Sorting of + sEdition: begin + Songs.Sort(sArtist); + Songs.Sort(sEdition); + end; + sGenre: begin + Songs.Sort(sArtist); + Songs.Sort(sGenre); + end; + sLanguage: begin + Songs.Sort(sArtist); + Songs.Sort(sLanguage); + end; + sFolder: begin + Songs.Sort(sArtist); + Songs.Sort(sFolder); + end; + sTitle: Songs.Sort(sTitle); + sArtist: Songs.Sort(sArtist); + sTitle2: Songs.Sort(sTitle2); // by title2 + sArtist2: Songs.Sort(sArtist2); // by artist2 + + end; // case + + + Letter := ' '; + SS := ''; + Order := 0; + CatNumber := 0; + + //Songs leeren + SetLength (Song, 0); + + for S := 0 to Songs.SongList.Count-1 do + begin + if (Ini.Tabs = 1) then + if (Ini.Sorting = sEdition) and (CompareText(SS, TSong( Songs.SongList[S] ).Edition) <> 0) then begin + // add Category Button + Inc(Order); + SS := TSong( Songs.SongList[S] ).Edition; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + SS + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + + + // 0.4.3 + // if SS = 'Singstar' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Part 2' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar German' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Spanish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Italian' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar French' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Party' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Party.jpg'; + // if SS = 'Singstar Popworld' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Popworld.jpg'; + // if SS = 'Singstar 80s' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; + // if SS = 'Singstar 80s Polish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; + // if SS = 'Singstar Rocks' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Rocks.jpg'; + // if SS = 'Singstar Anthems' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Anthems.jpg'; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';//} + + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sGenre) and (CompareText(SS, TSong( Songs.SongList[S] ).Genre) <> 0) then begin + // add Genre Button + Inc(Order); + SS := TSong( Songs.SongList[S] ).Genre; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sLanguage) and (CompareText(SS, TSong( Songs.SongList[S] ).Language) <> 0) then begin + // add Language Button + Inc(Order); + SS := TSong( Songs.SongList[S] ).Language; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sTitle) and + (Length(TSong( Songs.SongList[S] ).Title)>=1) and + (Letter <> UpperCase(TSong( Songs.SongList[S] ).Title)[1]) then begin + // add a letter Category Button + Inc(Order); + Letter := Uppercase(TSong( Songs.SongList[S] ).Title)[1]; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + + {// cover-patch + if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sArtist) and (Length(TSong( Songs.SongList[S] ).Artist)>=1) and + (Letter <> UpperCase(TSong( Songs.SongList[S] ).Artist)[1]) then begin + // add a letter Category Button + Inc(Order); + Letter := UpperCase(TSong( Songs.SongList[S] ).Artist)[1]; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sFolder) and (CompareText(SS, TSong( Songs.SongList[S] ).Folder) <> 0) then begin + // 0.5.0: add folder tab + Inc(Order); + SS := TSong( Songs.SongList[S] ).Folder; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sTitle2) AND (Length(TSong( Songs.SongList[S] ).Title)>=1) then begin + if (ord(TSong( Songs.SongList[S] ).Title[1]) > 47) and (ord(TSong( Songs.SongList[S] ).Title[1]) < 58) then Letter2 := '#' else Letter2 := UpperCase(TSong( Songs.SongList[S] ).Title)[1]; + if (Letter <> Letter2) then begin + // add a letter Category Button + Inc(Order); + Letter := Letter2; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end; + end + + else if (Ini.Sorting = sArtist2) AND (Length(TSong( Songs.SongList[S] ).Artist)>=1) then begin + if (ord(TSong( Songs.SongList[S] ).Artist[1]) > 47) and (ord(TSong( Songs.SongList[S] ).Artist[1]) < 58) then Letter2 := '#' else Letter2 := UpperCase(TSong( Songs.SongList[S] ).Artist)[1]; + if (Letter <> Letter2) then begin + // add a letter Category Button + Inc(Order); + Letter := Letter2; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end; + end; + + + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + + Inc (CatNumber); //Increase Number in Cat + + CatSongs.Song[CatLen] := TSong( Songs.SongList[S] ); + CatSongs.Song[CatLen].OrderNum := Order; // assigns category + CatSongs.Song[CatLen].CatNumber := CatNumber; + + if (Ini.Tabs = 0) then CatSongs.Song[CatLen].Visible := true + else if (Ini.Tabs = 1) then CatSongs.Song[CatLen].Visible := false; +// if (Ini.Tabs = 1) and (Order = 1) then CatSongs.Song[CatLen].Visible := true; // open first tab +//CatSongs.Song[CatLen].Visible := true; + + end; +//CatNumber Patch - Set CatNumber of Last Category +if (ini.Tabs_at_startup = 1) And (high(Song) >=1) then + Song[CatLen - CatNumber].CatNumber := CatNumber;//Set CatNumber of Categroy +//CatCount Patch +CatCount := Order; +end; + +procedure TCatSongs.ShowCategory(Index: integer); +var + S: integer; // song +begin + CatNumShow := Index; + for S := 0 to high(CatSongs.Song) do + begin + if (CatSongs.Song[S].OrderNum = Index) AND (Not CatSongs.Song[S].Main) then + CatSongs.Song[S].Visible := true + else + CatSongs.Song[S].Visible := false; + end; +end; + +procedure TCatSongs.HideCategory(Index: integer); // hides all songs in category +var + S: integer; // song +begin + for S := 0 to high(CatSongs.Song) do begin + if not CatSongs.Song[S].Main then + CatSongs.Song[S].Visible := false // hides all at now + end; +end; + +procedure TCatSongs.ClickCategoryButton(Index: integer); +var + Num, S: integer; +begin + Num := CatSongs.Song[Index].OrderNum; + if Num <> CatNumShow then + begin + ShowCategory(Num); + end + else begin + ShowCategoryList; + end; +end; + +//Hide Categorys when in Category Hack +procedure TCatSongs.ShowCategoryList; +var + Num, S: integer; +begin + //Hide All Songs Show All Cats + for S := 0 to high(CatSongs.Song) do begin + if CatSongs.Song[S].Main then + CatSongs.Song[S].Visible := true + else + CatSongs.Song[S].Visible := false + end; + CatSongs.Selected := CatNumShow; //Show last shown Category + CatNumShow := -1; +end; +//Hide Categorys when in Category Hack End + +//Wrong song selected when tabs on bug +function TCatSongs.FindNextVisible(SearchFrom:integer): integer;//Find next Visible Song +var + I: Integer; + begin + Result := -1; + I := SearchFrom + 1; + while not CatSongs.Song[I].Visible do + begin + Inc (I); + if (I>high(CatSongs.Song)) then + I := low(CatSongs.Song); + if (I = SearchFrom) then //Make One Round and no song found->quit + break; + end; + end; +//Wrong song selected when tabs on bug End + +function TCatSongs.VisibleSongs: integer; +var + S: integer; // song +begin + Result := 0; + for S := 0 to high(CatSongs.Song) do + if CatSongs.Song[S].Visible = true then Inc(Result); +end; + +function TCatSongs.VisibleIndex(Index: integer): integer; +var + S: integer; // song +begin + Result := 0; + for S := 0 to Index-1 do + if CatSongs.Song[S].Visible = true then Inc(Result); +end; + +function TCatSongs.SetFilter(FilterStr: String; const fType: Byte): Cardinal; +var + I, J: Integer; + cString: String; + SearchStr: Array of String; +begin + {fType: 0: All + 1: Title + 2: Artist} + FilterStr := Trim(FilterStr); + if FilterStr<>'' then begin + Result := 0; + //Create Search Array + SetLength(SearchStr, 1); + I := Pos (' ', FilterStr); + While (I <> 0) do + begin + SetLength (SearchStr, Length(SearchStr) + 1); + cString := Copy(FilterStr, 1, I-1); + if (cString <> ' ') AND (cString <> '') then + SearchStr[High(SearchStr)-1] := cString; + Delete (FilterStr, 1, I); + + I := Pos (' ', FilterStr); + end; + //Copy last Word + if (FilterStr <> ' ') AND (FilterStr <> '') then + SearchStr[High(SearchStr)] := FilterStr; + + for I:=0 to High(Song) do begin + if not Song[i].Main then + begin + case fType of + 0: cString := Song[I].Artist + ' ' + Song[i].Title + ' ' + Song[i].Folder; + 1: cString := Song[I].Title; + 2: cString := Song[I].Artist; + end; + Song[i].Visible:=True; + //Look for every Searched Word + For J := 0 to High(SearchStr) do + begin + Song[i].Visible := Song[i].Visible AND AnsiContainsText(cString, SearchStr[J]) + end; + if Song[i].Visible then + Inc(Result); + end + else + Song[i].Visible:=False; + end; + CatNumShow := -2; + end + else begin + for i:=0 to High(Song) do begin + Song[i].Visible:=(Ini.Tabs=1)=Song[i].Main; + CatNumShow := -1; + end; + Result := 0; + end; +end; + + + +// ----------------------------------------------------------------------------- + + + + +end. -- cgit v1.2.3 From 1e473d07c13c60a49a590e46314eb653c15b15e9 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 27 Jan 2008 10:16:40 +0000 Subject: Bugfix: In glTextWidth() "text := pchar(Copy(text, 2, Length(text)-1))" does not work with FPC, probably because a part of text is assigned to itself. Note: Why is the string copied so many times just to get the current character? I just simplified this method to use Text[index] instead. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@806 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.pas | 1121 +++++++++++++++++++++--------------------- 1 file changed, 562 insertions(+), 559 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index ed897071..0bd61fa7 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -1,559 +1,562 @@ -unit TextGL; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - - -uses OpenGL12, - SDL, - UTexture, - Classes, - dialogs, - SDL_ttf, - ULog; - -procedure BuildFont; // Build Our Bitmap Font -procedure KillFont; // Delete The Font -function glTextWidth(text: pchar): real; // Returns Text Width -procedure glPrintDone(text: pchar; Done: real; ColR, ColG, ColB: real); -procedure glPrintLetter(letter: char); -procedure glPrintLetterCut(letter: char; Start, Finish: real); -procedure glPrint(text: pchar); // Custom GL "Print" Routine -procedure glPrintCut(text: pchar); -procedure SetFontPos(X, Y: real); // Sets X And Y -procedure SetFontSize(Size: real); -procedure SetFontStyle(Style: integer); // sets active font style (normal, bold, etc) -procedure SetFontItalic(Enable: boolean); // sets italic type letter (works for all fonts) -procedure SetFontAspectW(Aspect: real); - -// Start of SDL_ttf -function NextPowerOfTwo(Value: Integer): Integer; -//Checks if the ttf exists, if yes then a SDL_ttf is returned -function LoadFont(FileName: PAnsiChar; PointSize: integer):PTTF_Font; - -// Does the renderstuff, color is in $ffeecc style -function RenderText(font: PTTF_Font; Text:PAnsiChar; Color: Cardinal):PSDL_Surface; -procedure printrandomtext(); -// End of SDL_ttf - -type - TTextGL = record - X: real; - Y: real; - Text: string; - Size: real; - ColR: real; - ColG: real; - ColB: real; - end; - - TFont = record - Tex: TTexture; - Width: array[0..255] of byte; - AspectW: real; - Centered: boolean; - Done: real; - Outline: real; - Italic: boolean; - end; - - -var - base: GLuint; // Base Display List For The Font Set - Fonts: array of TFont; - ActFont: integer; - PColR: real; // temps for glPrintDone - PColG: real; - PColB: real; - -implementation - -uses UMain, - UCommon, - {$IFDEF win32} - windows, - {$ELSE} - lclintf, - lcltype, - {$ENDIF} - SysUtils, - {$IFDEF LAZARUS} - LResources, - {$ENDIF} - {$IFDEF DARWIN} - MacResources, - {$ENDIF} - UGraphic; - -procedure BuildFont; // Build Our Bitmap Font - - procedure loadfont( aID : integer; aType, aResourceName : String); - {$IFDEF LAZARUS} - var - lLazRes : TLResource; - lResData : TStringStream; - begin - try - lLazRes := LazFindResource( aResourceName, aType ); - if lLazRes <> nil then - begin - lResData := TStringStream.create( lLazRes.value ); - try - lResData.position := 0; - lResData.Read(Fonts[ aID ].Width, 256); - finally - freeandnil( lResData ); - end; - end; - - {$ELSE} - var - Rejestr: TResourceStream; - begin - try - Rejestr := TResourceStream.Create(HInstance, aResourceName , pchar( aType ) ); - try - Rejestr.Read(Fonts[ aID ].Width, 256); - finally - Rejestr.Free; - end; - {$ENDIF} - - except - Log.LogStatus( 'Could not load font : loadfont( '+ inttostr( aID ) +' , '+aType+' )' , 'ERROR'); - end; - end; - -var - font: HFONT; // Windows Font ID - h_dc: hdc; - Pet: integer; -begin - ActFont := 0; - - Log.LogStatus( '' , '---------------------------'); - - Log.LogStatus( 'Font' , '---------------------------'); - SetLength(Fonts, 5); - Fonts[0].Tex := Texture.LoadTexture(true, 'Font', 'PNG', 'Transparent', 0); - Fonts[0].Tex.H := 30; - Fonts[0].AspectW := 0.9; - Fonts[0].Done := -1; - Fonts[0].Outline := 0; - - Log.LogStatus( 'FontB' , '---------------------------'); - - Fonts[1].Tex := Texture.LoadTexture(true, 'FontB', 'PNG', 'Transparent', 0); - Fonts[1].Tex.H := 30; - Fonts[1].AspectW := 1; - Fonts[1].Done := -1; - Fonts[1].Outline := 0; - - Log.LogStatus( 'FontO' , '---------------------------'); - Fonts[2].Tex := Texture.LoadTexture(true, 'FontO', 'PNG', 'Transparent', 0); - Fonts[2].Tex.H := 30; - Fonts[2].AspectW := 0.95; - Fonts[2].Done := -1; - Fonts[2].Outline := 5; - - Log.LogStatus( 'FontO2' , '---------------------------'); - Fonts[3].Tex := Texture.LoadTexture(true, 'FontO2', 'PNG', 'Transparent', 0); - Fonts[3].Tex.H := 30; - Fonts[3].AspectW := 0.95; - Fonts[3].Done := -1; - Fonts[3].Outline := 4; - -{ Fonts[4].Tex := Texture.LoadTexture('FontO', 'BMP', 'Arrow', 0); // for score screen - Fonts[4].Tex.H := 30; - Fonts[4].AspectW := 0.95; - Fonts[4].Done := -1; - Fonts[4].Outline := 5;} - - - - loadfont( 0, 'FNT', 'Font' ); - loadfont( 1, 'FNT', 'FontB' ); - loadfont( 2, 'FNT', 'FontO' ); - loadfont( 3, 'FNT', 'FontO2' ); - -{ Rejestr := TResourceStream.Create(HInstance, 'FontO', 'FNT'); - Rejestr.Read(Fonts[4].Width, 256); - Rejestr.Free;} - - for Pet := 0 to 255 do - Fonts[1].Width[Pet] := Fonts[1].Width[Pet] div 2; - - for Pet := 0 to 255 do - Fonts[2].Width[Pet] := Fonts[2].Width[Pet] div 2 + 2; - - for Pet := 0 to 255 do - Fonts[3].Width[Pet] := Fonts[3].Width[Pet] + 1; - -{ for Pet := 0 to 255 do - Fonts[4].Width[Pet] := Fonts[4].Width[Pet] div 2 + 2;} - -end; - -procedure KillFont; // Delete The Font -begin -// glDeleteLists(base, 256); // Delete All 96 Characters -end; - -function glTextWidth(text: pchar): real; -var - Letter: char; -begin -// Log.LogStatus(Text, 'glTextWidth'); - Result := 0; - while (length(text) > 0) do begin - Letter := Text[0]; - text := pchar(Copy(text, 2, Length(text)-1)); - Result := Result + Fonts[ActFont].Width[Ord(Letter)] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; - end; // while -end; - -procedure glPrintDone(text: pchar; Done: real; ColR, ColG, ColB: real); -begin - Fonts[ActFont].Done := Done; - PColR := ColR; - PColG := ColG; - PColB := ColB; - glPrintCut(text); - Fonts[ActFont].Done := -1; -end; - -procedure glPrintLetter(Letter: char); -var - TexX, TexY: real; - TexR, TexB: real; - FWidth: real; - PL, PT: real; - PR, PB: real; - XItal: real; // X shift for italic type letter -begin - with Fonts[ActFont].Tex do - begin - FWidth := Fonts[ActFont].Width[Ord(Letter)]; - - W := FWidth * (H/30) * Fonts[ActFont].AspectW; - // H := 30; - - // set texture positions - TexX := (ord(Letter) mod 16) * 1/16 + 1/32 - FWidth/1024 - Fonts[ActFont].Outline/1024; - TexY := (ord(Letter) div 16) * 1/16 + 2/1024; // 2/1024 - TexR := (ord(Letter) mod 16) * 1/16 + 1/32 + FWidth/1024 + Fonts[ActFont].Outline/1024; - TexB := (1 + ord(Letter) div 16) * 1/16 - 2/1024; - - // set vector positions - PL := X - Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW /2; - PT := Y; - PR := PL + W + Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW; - PB := PT + H; - - if Fonts[ActFont].Italic = false then - XItal := 0 - else - XItal := 12; - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, TexNum); - - glBegin(GL_QUADS); - try - glTexCoord2f(TexX, TexY); glVertex2f(PL+XItal, PT); - glTexCoord2f(TexX, TexB); glVertex2f(PL, PB); - glTexCoord2f(TexR, TexB); glVertex2f(PR, PB); - glTexCoord2f(TexR, TexY); glVertex2f(PR+XItal, PT); - finally - glEnd; - end; - - X := X + W; - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - end; // with -end; - -procedure glPrintLetterCut(letter: char; Start, Finish: real); -var - TexX, TexY: real; - TexR, TexB: real; - TexTemp: real; - FWidth: real; - PL, PT: real; - PR, PB: real; - OutTemp: real; - XItal: real; -begin - with Fonts[ActFont].Tex do begin - FWidth := Fonts[ActFont].Width[Ord(Letter)]; - - W := FWidth * (H/30) * Fonts[ActFont].AspectW; -// H := 30; - OutTemp := Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW; - - // set texture positions - TexX := (ord(Letter) mod 16) * 1/16 + 1/32 - FWidth/1024 - Fonts[ActFont].Outline/1024; - TexY := (ord(Letter) div 16) * 1/16 + 2/1024; // 2/1024 - TexR := (ord(Letter) mod 16) * 1/16 + 1/32 + FWidth/1024 + Fonts[ActFont].Outline/1024; - TexB := (1 + ord(Letter) div 16) * 1/16 - 2/1024; - - TexTemp := TexX + Start * (TexR - TexX); - TexR := TexX + Finish * (TexR - TexX); - TexX := TexTemp; - - // set vector positions - PL := X - OutTemp / 2 + OutTemp * Start; - PT := Y; - PR := PL + (W + OutTemp) * (Finish - Start); - PB := PT + H; - if Fonts[ActFont].Italic = false then - XItal := 0 - else - XItal := 12; - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, TexNum); - glBegin(GL_QUADS); - glTexCoord2f(TexX, TexY); glVertex2f(PL+XItal, PT); - glTexCoord2f(TexX, TexB); glVertex2f(PL, PB); - glTexCoord2f(TexR, TexB); glVertex2f(PR, PB); - glTexCoord2f(TexR, TexY); glVertex2f(PR+XItal, PT); // not tested with XItal - glEnd; - X := X + W * (Finish - Start); - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - end; // with - -end; - -procedure glPrint(text: pchar); // Custom GL "Print" Routine -var -// Letter : char; - iPos : Integer; - -begin - if (Text = '') then // If There's No Text - Exit; // Do Nothing - -(* - while (length(text) > 0) do - begin - // cut - Letter := Text[0]; - Text := pchar(Copy(Text, 2, Length(Text)-1)); - - // print - glPrintLetter(Letter); - end; // while -*) - - // This code is better, because doing a Copy of for every - // letter in a string is a waste of CPU & Memory resources. - // Copy operations are quite memory intensive, and this simple - // code achieves the same result. - for iPos := 0 to length( text ) - 1 do - begin - glPrintLetter( Text[iPos] ); - end; - -end; - -function NextPowerOfTwo(Value: Integer): Integer; -// tyty to Asphyre -begin - Result:= 1; - asm - xor ecx, ecx - bsr ecx, Value - inc ecx - shl Result, cl - end; -end; - -function LoadFont(FileName: PAnsiChar; PointSize: integer):PTTF_Font; -begin - if (FileExists(FileName)) then - begin - Result := TTF_OpenFont( FileName, PointSize ); - end - else - begin - Log.LogStatus('ERROR Could not find font in ' + FileName , ''); - ShowMessage( 'ERROR Could not find font in ' + FileName ); - end; -end; - -function RenderText(font: PTTF_Font; Text:PAnsiChar; Color: Cardinal): PSDL_Surface; -var - clr : TSDL_color; -begin - clr.r := ((Color and $ff0000) shr 16 ) div 255; - clr.g := ((Color and $ff00 ) shr 8 ) div 255; - clr.b := ( Color and $ff ) div 255 ; - - result := TTF_RenderText_Blended( font, text, cLr); -end; - -procedure printrandomtext(); -var - stext,intermediary : PSDL_surface; - clrFg, clrBG : TSDL_color; - texture : Gluint; - font : PTTF_Font; - w,h : integer; -begin - -font := LoadFont('fonts\comicbd.ttf', 42); - -clrFg.r := 255; -clrFg.g := 255; -clrFg.b := 255; -clrFg.unused := 255; - -clrBg.r := 255; -clrbg.g := 0; -clrbg.b := 255; -clrbg.unused := 0; - - sText := RenderText(font, 'katzeeeeeee', $fe198e); -//sText := TTF_RenderText_Blended( font, 'huuuuuuuuuund', clrFG); - - // Convert the rendered text to a known format - w := nextpoweroftwo(sText.w); - h := nextpoweroftwo(sText.h); - -intermediary := SDL_CreateRGBSurface(0, w, h, 32, - $000000ff, $0000ff00, $00ff0000, $ff000000); - - SDL_SetAlpha(intermediary, 0, 255); - SDL_SetAlpha(sText, 0, 255); - SDL_BlitSurface(sText, 0, intermediary, 0); - - glGenTextures(1, @texture); - - glBindTexture(GL_TEXTURE_2D, texture); - - glTexImage2D(GL_TEXTURE_2D, 0, 4, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, intermediary.pixels); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - - - - - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glBindTexture(GL_TEXTURE_2D, texture); - glColor4f(1, 0, 1, 1); - - glbegin(gl_quads); - glTexCoord2f(0,0); glVertex2f(200, 300); - glTexCoord2f(0,sText.h/h); glVertex2f(200 , 300 + sText.h); - glTexCoord2f(sText.w/w,sText.h/h); glVertex2f(200 + sText.w, 300 + sText.h); - glTexCoord2f(sText.w/w,0); glVertex2f(200 + sText.w, 300); - glEnd; - glfinish(); - glDisable(GL_BLEND); - gldisable(gl_texture_2d); - - - - -SDL_FreeSurface( sText ); -SDL_FreeSurface( intermediary ); -glDeleteTextures(1, @texture); -TTF_CloseFont( font ); - -end; - -procedure glPrintCut(text: pchar); -var - Letter: char; - PToDo: real; - PTotWidth: real; - PDoingNow: real; - S: string; -begin - if (Text = '') then // If There's No Text - Exit; // Do Nothing - - PTotWidth := glTextWidth(Text); - PToDo := Fonts[ActFont].Done; - - while (length(text) > 0) do begin - // cut - Letter := Text[0]; - Text := pchar(Copy(Text, 2, Length(Text)-1)); - - // analyze - S := Letter; - PDoingNow := glTextWidth(pchar(S)) / PTotWidth; - - // drawing - if (PToDo > 0) and (PDoingNow <= PToDo) then - glPrintLetter(Letter); - - if (PToDo > 0) and (PDoingNow > PToDo) then begin - glPrintLetterCut(Letter, 0, PToDo / PDoingNow); - glColor3f(PColR, PColG, PColB); - glPrintLetterCut(Letter, PToDo / PDoingNow, 1); - end; - - if (PToDo <= 0) then - glPrintLetter(Letter); - - PToDo := PToDo - PDoingNow; - - end; // while -end; - - -procedure SetFontPos(X, Y: real); -begin - Fonts[ActFont].Tex.X := X; - Fonts[ActFont].Tex.Y := Y; -end; - -procedure SetFontSize(Size: real); -begin - Fonts[ActFont].Tex.H := 30 * (Size/10); -end; - -procedure SetFontStyle(Style: integer); -begin - ActFont := Style; -end; - -procedure SetFontItalic(Enable: boolean); -begin - Fonts[ActFont].Italic := Enable; -end; - -procedure SetFontAspectW(Aspect: real); -begin - Fonts[ActFont].AspectW := Aspect; -end; - - -{$IFDEF LAZARUS} -{$IFDEF win32} -initialization - {$I UltraStar.lrs} -{$ENDIF} -{$ENDIF} - - -end. - - +unit TextGL; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +uses OpenGL12, + SDL, + UTexture, + Classes, + dialogs, + SDL_ttf, + ULog; + +procedure BuildFont; // Build Our Bitmap Font +procedure KillFont; // Delete The Font +function glTextWidth(text: pchar): real; // Returns Text Width +procedure glPrintDone(text: pchar; Done: real; ColR, ColG, ColB: real); +procedure glPrintLetter(letter: char); +procedure glPrintLetterCut(letter: char; Start, Finish: real); +procedure glPrint(text: pchar); // Custom GL "Print" Routine +procedure glPrintCut(text: pchar); +procedure SetFontPos(X, Y: real); // Sets X And Y +procedure SetFontSize(Size: real); +procedure SetFontStyle(Style: integer); // sets active font style (normal, bold, etc) +procedure SetFontItalic(Enable: boolean); // sets italic type letter (works for all fonts) +procedure SetFontAspectW(Aspect: real); + +// Start of SDL_ttf +function NextPowerOfTwo(Value: Integer): Integer; +//Checks if the ttf exists, if yes then a SDL_ttf is returned +function LoadFont(FileName: PAnsiChar; PointSize: integer):PTTF_Font; + +// Does the renderstuff, color is in $ffeecc style +function RenderText(font: PTTF_Font; Text:PAnsiChar; Color: Cardinal):PSDL_Surface; +procedure printrandomtext(); +// End of SDL_ttf + +type + TTextGL = record + X: real; + Y: real; + Text: string; + Size: real; + ColR: real; + ColG: real; + ColB: real; + end; + + TFont = record + Tex: TTexture; + Width: array[0..255] of byte; + AspectW: real; + Centered: boolean; + Done: real; + Outline: real; + Italic: boolean; + end; + + +var + base: GLuint; // Base Display List For The Font Set + Fonts: array of TFont; + ActFont: integer; + PColR: real; // temps for glPrintDone + PColG: real; + PColB: real; + +implementation + +uses UMain, + UCommon, + {$IFDEF win32} + windows, + {$ELSE} + lclintf, + lcltype, + {$ENDIF} + SysUtils, + {$IFDEF LAZARUS} + LResources, + {$ENDIF} + {$IFDEF DARWIN} + MacResources, + {$ENDIF} + UGraphic; + +procedure BuildFont; // Build Our Bitmap Font + + procedure loadfont( aID : integer; aType, aResourceName : String); + {$IFDEF LAZARUS} + var + lLazRes : TLResource; + lResData : TStringStream; + begin + try + lLazRes := LazFindResource( aResourceName, aType ); + if lLazRes <> nil then + begin + lResData := TStringStream.create( lLazRes.value ); + try + lResData.position := 0; + lResData.Read(Fonts[ aID ].Width, 256); + finally + freeandnil( lResData ); + end; + end; + + {$ELSE} + var + Rejestr: TResourceStream; + begin + try + Rejestr := TResourceStream.Create(HInstance, aResourceName , pchar( aType ) ); + try + Rejestr.Read(Fonts[ aID ].Width, 256); + finally + Rejestr.Free; + end; + {$ENDIF} + + except + Log.LogStatus( 'Could not load font : loadfont( '+ inttostr( aID ) +' , '+aType+' )' , 'ERROR'); + end; + end; + +var + font: HFONT; // Windows Font ID + h_dc: hdc; + Pet: integer; +begin + ActFont := 0; + + Log.LogStatus( '' , '---------------------------'); + + Log.LogStatus( 'Font' , '---------------------------'); + SetLength(Fonts, 5); + Fonts[0].Tex := Texture.LoadTexture(true, 'Font', 'PNG', 'Transparent', 0); + Fonts[0].Tex.H := 30; + Fonts[0].AspectW := 0.9; + Fonts[0].Done := -1; + Fonts[0].Outline := 0; + + Log.LogStatus( 'FontB' , '---------------------------'); + + Fonts[1].Tex := Texture.LoadTexture(true, 'FontB', 'PNG', 'Transparent', 0); + Fonts[1].Tex.H := 30; + Fonts[1].AspectW := 1; + Fonts[1].Done := -1; + Fonts[1].Outline := 0; + + Log.LogStatus( 'FontO' , '---------------------------'); + Fonts[2].Tex := Texture.LoadTexture(true, 'FontO', 'PNG', 'Transparent', 0); + Fonts[2].Tex.H := 30; + Fonts[2].AspectW := 0.95; + Fonts[2].Done := -1; + Fonts[2].Outline := 5; + + Log.LogStatus( 'FontO2' , '---------------------------'); + Fonts[3].Tex := Texture.LoadTexture(true, 'FontO2', 'PNG', 'Transparent', 0); + Fonts[3].Tex.H := 30; + Fonts[3].AspectW := 0.95; + Fonts[3].Done := -1; + Fonts[3].Outline := 4; + +{ Fonts[4].Tex := Texture.LoadTexture('FontO', 'BMP', 'Arrow', 0); // for score screen + Fonts[4].Tex.H := 30; + Fonts[4].AspectW := 0.95; + Fonts[4].Done := -1; + Fonts[4].Outline := 5;} + + + + loadfont( 0, 'FNT', 'Font' ); + loadfont( 1, 'FNT', 'FontB' ); + loadfont( 2, 'FNT', 'FontO' ); + loadfont( 3, 'FNT', 'FontO2' ); + +{ Rejestr := TResourceStream.Create(HInstance, 'FontO', 'FNT'); + Rejestr.Read(Fonts[4].Width, 256); + Rejestr.Free;} + + for Pet := 0 to 255 do + Fonts[1].Width[Pet] := Fonts[1].Width[Pet] div 2; + + for Pet := 0 to 255 do + Fonts[2].Width[Pet] := Fonts[2].Width[Pet] div 2 + 2; + + for Pet := 0 to 255 do + Fonts[3].Width[Pet] := Fonts[3].Width[Pet] + 1; + +{ for Pet := 0 to 255 do + Fonts[4].Width[Pet] := Fonts[4].Width[Pet] div 2 + 2;} + +end; + +procedure KillFont; // Delete The Font +begin +// glDeleteLists(base, 256); // Delete All 96 Characters +end; + +function glTextWidth(text: pchar): real; +var + Letter: char; + i: integer; +begin +// Log.LogStatus(Text, 'glTextWidth'); + Result := 0; + for i := 0 to Length(text) do + begin + Letter := Text[i]; + // Bugfix: does not work with FPC, probably because a part of text is assigned to itself + //text := pchar(Copy(text, 2, Length(text)-1)); + Result := Result + Fonts[ActFont].Width[Ord(Letter)] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + end; +end; + +procedure glPrintDone(text: pchar; Done: real; ColR, ColG, ColB: real); +begin + Fonts[ActFont].Done := Done; + PColR := ColR; + PColG := ColG; + PColB := ColB; + glPrintCut(text); + Fonts[ActFont].Done := -1; +end; + +procedure glPrintLetter(Letter: char); +var + TexX, TexY: real; + TexR, TexB: real; + FWidth: real; + PL, PT: real; + PR, PB: real; + XItal: real; // X shift for italic type letter +begin + with Fonts[ActFont].Tex do + begin + FWidth := Fonts[ActFont].Width[Ord(Letter)]; + + W := FWidth * (H/30) * Fonts[ActFont].AspectW; + // H := 30; + + // set texture positions + TexX := (ord(Letter) mod 16) * 1/16 + 1/32 - FWidth/1024 - Fonts[ActFont].Outline/1024; + TexY := (ord(Letter) div 16) * 1/16 + 2/1024; // 2/1024 + TexR := (ord(Letter) mod 16) * 1/16 + 1/32 + FWidth/1024 + Fonts[ActFont].Outline/1024; + TexB := (1 + ord(Letter) div 16) * 1/16 - 2/1024; + + // set vector positions + PL := X - Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW /2; + PT := Y; + PR := PL + W + Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW; + PB := PT + H; + + if Fonts[ActFont].Italic = false then + XItal := 0 + else + XItal := 12; + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, TexNum); + + glBegin(GL_QUADS); + try + glTexCoord2f(TexX, TexY); glVertex2f(PL+XItal, PT); + glTexCoord2f(TexX, TexB); glVertex2f(PL, PB); + glTexCoord2f(TexR, TexB); glVertex2f(PR, PB); + glTexCoord2f(TexR, TexY); glVertex2f(PR+XItal, PT); + finally + glEnd; + end; + + X := X + W; + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + end; // with +end; + +procedure glPrintLetterCut(letter: char; Start, Finish: real); +var + TexX, TexY: real; + TexR, TexB: real; + TexTemp: real; + FWidth: real; + PL, PT: real; + PR, PB: real; + OutTemp: real; + XItal: real; +begin + with Fonts[ActFont].Tex do begin + FWidth := Fonts[ActFont].Width[Ord(Letter)]; + + W := FWidth * (H/30) * Fonts[ActFont].AspectW; +// H := 30; + OutTemp := Fonts[ActFont].Outline * (H/30) * Fonts[ActFont].AspectW; + + // set texture positions + TexX := (ord(Letter) mod 16) * 1/16 + 1/32 - FWidth/1024 - Fonts[ActFont].Outline/1024; + TexY := (ord(Letter) div 16) * 1/16 + 2/1024; // 2/1024 + TexR := (ord(Letter) mod 16) * 1/16 + 1/32 + FWidth/1024 + Fonts[ActFont].Outline/1024; + TexB := (1 + ord(Letter) div 16) * 1/16 - 2/1024; + + TexTemp := TexX + Start * (TexR - TexX); + TexR := TexX + Finish * (TexR - TexX); + TexX := TexTemp; + + // set vector positions + PL := X - OutTemp / 2 + OutTemp * Start; + PT := Y; + PR := PL + (W + OutTemp) * (Finish - Start); + PB := PT + H; + if Fonts[ActFont].Italic = false then + XItal := 0 + else + XItal := 12; + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, TexNum); + glBegin(GL_QUADS); + glTexCoord2f(TexX, TexY); glVertex2f(PL+XItal, PT); + glTexCoord2f(TexX, TexB); glVertex2f(PL, PB); + glTexCoord2f(TexR, TexB); glVertex2f(PR, PB); + glTexCoord2f(TexR, TexY); glVertex2f(PR+XItal, PT); // not tested with XItal + glEnd; + X := X + W * (Finish - Start); + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + end; // with + +end; + +procedure glPrint(text: pchar); // Custom GL "Print" Routine +var +// Letter : char; + iPos : Integer; + +begin + if (Text = '') then // If There's No Text + Exit; // Do Nothing + +(* + while (length(text) > 0) do + begin + // cut + Letter := Text[0]; + Text := pchar(Copy(Text, 2, Length(Text)-1)); + + // print + glPrintLetter(Letter); + end; // while +*) + + // This code is better, because doing a Copy of for every + // letter in a string is a waste of CPU & Memory resources. + // Copy operations are quite memory intensive, and this simple + // code achieves the same result. + for iPos := 0 to length( text ) - 1 do + begin + glPrintLetter( Text[iPos] ); + end; + +end; + +function NextPowerOfTwo(Value: Integer): Integer; +// tyty to Asphyre +begin + Result:= 1; + asm + xor ecx, ecx + bsr ecx, Value + inc ecx + shl Result, cl + end; +end; + +function LoadFont(FileName: PAnsiChar; PointSize: integer):PTTF_Font; +begin + if (FileExists(FileName)) then + begin + Result := TTF_OpenFont( FileName, PointSize ); + end + else + begin + Log.LogStatus('ERROR Could not find font in ' + FileName , ''); + ShowMessage( 'ERROR Could not find font in ' + FileName ); + end; +end; + +function RenderText(font: PTTF_Font; Text:PAnsiChar; Color: Cardinal): PSDL_Surface; +var + clr : TSDL_color; +begin + clr.r := ((Color and $ff0000) shr 16 ) div 255; + clr.g := ((Color and $ff00 ) shr 8 ) div 255; + clr.b := ( Color and $ff ) div 255 ; + + result := TTF_RenderText_Blended( font, text, cLr); +end; + +procedure printrandomtext(); +var + stext,intermediary : PSDL_surface; + clrFg, clrBG : TSDL_color; + texture : Gluint; + font : PTTF_Font; + w,h : integer; +begin + +font := LoadFont('fonts\comicbd.ttf', 42); + +clrFg.r := 255; +clrFg.g := 255; +clrFg.b := 255; +clrFg.unused := 255; + +clrBg.r := 255; +clrbg.g := 0; +clrbg.b := 255; +clrbg.unused := 0; + + sText := RenderText(font, 'katzeeeeeee', $fe198e); +//sText := TTF_RenderText_Blended( font, 'huuuuuuuuuund', clrFG); + + // Convert the rendered text to a known format + w := nextpoweroftwo(sText.w); + h := nextpoweroftwo(sText.h); + +intermediary := SDL_CreateRGBSurface(0, w, h, 32, + $000000ff, $0000ff00, $00ff0000, $ff000000); + + SDL_SetAlpha(intermediary, 0, 255); + SDL_SetAlpha(sText, 0, 255); + SDL_BlitSurface(sText, 0, intermediary, 0); + + glGenTextures(1, @texture); + + glBindTexture(GL_TEXTURE_2D, texture); + + glTexImage2D(GL_TEXTURE_2D, 0, 4, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, intermediary.pixels); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + + + + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glBindTexture(GL_TEXTURE_2D, texture); + glColor4f(1, 0, 1, 1); + + glbegin(gl_quads); + glTexCoord2f(0,0); glVertex2f(200, 300); + glTexCoord2f(0,sText.h/h); glVertex2f(200 , 300 + sText.h); + glTexCoord2f(sText.w/w,sText.h/h); glVertex2f(200 + sText.w, 300 + sText.h); + glTexCoord2f(sText.w/w,0); glVertex2f(200 + sText.w, 300); + glEnd; + glfinish(); + glDisable(GL_BLEND); + gldisable(gl_texture_2d); + + + + +SDL_FreeSurface( sText ); +SDL_FreeSurface( intermediary ); +glDeleteTextures(1, @texture); +TTF_CloseFont( font ); + +end; + +procedure glPrintCut(text: pchar); +var + Letter: char; + PToDo: real; + PTotWidth: real; + PDoingNow: real; + S: string; +begin + if (Text = '') then // If There's No Text + Exit; // Do Nothing + + PTotWidth := glTextWidth(Text); + PToDo := Fonts[ActFont].Done; + + while (length(text) > 0) do begin + // cut + Letter := Text[0]; + Text := pchar(Copy(Text, 2, Length(Text)-1)); + + // analyze + S := Letter; + PDoingNow := glTextWidth(pchar(S)) / PTotWidth; + + // drawing + if (PToDo > 0) and (PDoingNow <= PToDo) then + glPrintLetter(Letter); + + if (PToDo > 0) and (PDoingNow > PToDo) then begin + glPrintLetterCut(Letter, 0, PToDo / PDoingNow); + glColor3f(PColR, PColG, PColB); + glPrintLetterCut(Letter, PToDo / PDoingNow, 1); + end; + + if (PToDo <= 0) then + glPrintLetter(Letter); + + PToDo := PToDo - PDoingNow; + + end; // while +end; + + +procedure SetFontPos(X, Y: real); +begin + Fonts[ActFont].Tex.X := X; + Fonts[ActFont].Tex.Y := Y; +end; + +procedure SetFontSize(Size: real); +begin + Fonts[ActFont].Tex.H := 30 * (Size/10); +end; + +procedure SetFontStyle(Style: integer); +begin + ActFont := Style; +end; + +procedure SetFontItalic(Enable: boolean); +begin + Fonts[ActFont].Italic := Enable; +end; + +procedure SetFontAspectW(Aspect: real); +begin + Fonts[ActFont].AspectW := Aspect; +end; + + +{$IFDEF LAZARUS} +{$IFDEF win32} +initialization + {$I UltraStar.lrs} +{$ENDIF} +{$ENDIF} + + +end. + + -- cgit v1.2.3 From ffd5faaf020fa5f8504c2b8b90e5daf93ed1edaf Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 28 Jan 2008 09:31:22 +0000 Subject: TTexture.Z was never initialized (TTextureUnit.LoadTexture). In FPC (not in delphi) this resulted in a floating-point error when calling glVertex3f(x1, y1, z) in DrawTexture (UDrawTexture.pas) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@807 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 2289 ++++++++++++++++++++-------------------- 1 file changed, 1145 insertions(+), 1144 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 82dedf45..770b88bd 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -1,1144 +1,1145 @@ -unit UTexture; -// added for easier debug disabling -{$undef blindydebug} - -// Plain (alpha = 1) -// Transparent -// Colorized - -// obsolete? -// Transparent Range -// Font (white is drawn, black is transparent) -// Font Outline (Font with darker outline) -// Font Outline 2 (Font with darker outline) -// Font Black (black is drawn, white is transparent) -// Font Gray (gray is drawn, white is transparent) -// Arrow (for arrows, white is white, gray has color, black is transparent); - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses OpenGL12, - {$IFDEF win32} - windows, - {$ENDIF} - Math, - Classes, - SysUtils, - Graphics, - UCommon, - UThemes, - SDL, - sdlutils, - SDL_Image; - -type - TTexture = record - TexNum: integer; - X: real; - Y: real; - Z: real; // new - W: real; - H: real; - ScaleW: real; // for dynamic scalling while leaving width constant - ScaleH: real; // for dynamic scalling while leaving height constant - Rot: real; // 0 - 2*pi - Int: real; // intensity - ColR: real; - ColG: real; - ColB: real; - TexW: real; // used? - TexH: real; // used? - TexX1: real; - TexY1: real; - TexX2: real; - TexY2: real; - Alpha: real; - Name: string; // 0.5.0: experimental for handling cache images. maybe it's useful for dynamic skins - end; - - TTextureEntry = record - Name: string; - Typ: string; - - // we use normal TTexture, it's easier to implement and if needed - we copy ready data - Texture: TTexture; - TextureCache: TTexture; // 0.5.0 - end; - - TTextureDatabase = record - Texture: array of TTextureEntry; - end; - - TTextureUnit = class - - private - function LoadImage(Identifier: PChar): PSDL_Surface; - function pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; - procedure AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); - function GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; - procedure ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); - procedure FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); - procedure ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); - - public - Limit: integer; - CreateCacheMipmap: boolean; - -// function GetNumberFor - function GetTexture(Name, Typ: string): TTexture; overload; - function GetTexture(Name, Typ: string; FromCache: boolean): TTexture; overload; - function FindTexture(Name: string): integer; - function LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; - function LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; - function LoadTexture(Identifier: string): TTexture; overload; - function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; - procedure UnloadTexture(Name: string; FromCache: boolean); - Constructor Create; - Destructor Destroy; override; - end; - -var - Texture: TTextureUnit; - TextureDatabase: TTextureDatabase; - - // this should be in UDisplay?! - PrintScreenData: array[0..1024*768-1] of longword; - - ActTex: GLuint;//integer; - -// TextureD8: array[1..1024*1024] of byte; // 1MB - TextureD16: array[1..1024*1024, 1..2] of byte; // luminance/alpha tex (2MB) -// TextureD24: array[1..1024*1024, 1..3] of byte; // normal 24-bit tex (3MB) -// TextureD242: array[1..512*512, 1..3] of byte; // normal 24-bit tex (0,75MB) -// TextureD32: array[1..1024*1024, 1..4] of byte; // transparent 32-bit tex (4MB) - // total 40MB at 2048*2048 - // total 10MB at 1024*1024 - - Mipmapping: Boolean; - - CacheMipmap: array[0..256*256*3-1] of byte; // 3KB - CacheMipmapSurface: PSDL_Surface; - - -implementation - -uses ULog, - DateUtils, - UCovers, - {$IFDEF LAZARUS} - LResources, - {$ENDIF} - {$IFDEF DARWIN} - MacResources, - {$ENDIF} - StrUtils, dialogs; - -const - fmt_rgba: TSDL_Pixelformat=(palette: nil; - BitsPerPixel: 32; - BytesPerPixel: 4; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 24; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $ff000000; - ColorKey: 0; - Alpha: 255); - fmt_rgb: TSDL_Pixelformat=( palette: nil; - BitsPerPixel: 24; - BytesPerPixel: 3; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 0; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $00000000; - ColorKey: 0; - Alpha: 255); - - -Constructor TTextureUnit.Create; -begin - inherited Create; -end; - -Destructor TTextureUnit.Destroy; -begin - inherited Destroy; -end; - -function TTextureUnit.pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; -begin - if (fmt1^.BitsPerPixel = fmt2^.BitsPerPixel) and - (fmt1^.BytesPerPixel = fmt2^.BytesPerPixel) and - (fmt1^.Rloss = fmt2^.Rloss) and (fmt1^.Gloss = fmt2^.Gloss) and - (fmt1^.Bloss = fmt2^.Bloss) and (fmt1^.Rmask = fmt2^.Rmask) and - (fmt1^.Gmask = fmt2^.Gmask) and (fmt1^.Bmask = fmt2^.Bmask) and - (fmt1^.Rshift = fmt2^.Rshift) and (fmt1^.Gshift = fmt2^.Gshift) and - (fmt1^.Bshift = fmt2^.Bshift) - then - Result:=True - else - Result:=False; -end; - -// +++++++++++++++++++++ helpers for loadimage +++++++++++++++ - function SdlStreamSeek( context : PSDL_RWops; offset : Integer; whence : Integer ) : integer; cdecl; - var - stream : TStream; - origin : Word; - begin - stream := TStream( context.unknown ); - if ( stream = nil ) then - raise EInvalidContainer.Create( 'SDLStreamSeek on nil' ); - case whence of - 0 : origin := soFromBeginning; // Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0. - 1 : origin := soFromCurrent; // Offset is from the current position in the resource. Seek moves to Position + Offset. - 2 : origin := soFromEnd; - else - origin := soFromBeginning; // just in case - end; - Result := stream.Seek( offset, origin ); - end; - function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : Integer; maxnum: Integer ) : Integer; cdecl; - var - stream : TStream; - begin - stream := TStream( context.unknown ); - if ( stream = nil ) then - raise EInvalidContainer.Create( 'SDLStreamRead on nil' ); - try - Result := stream.read( Ptr^, Size * maxnum ) div size; - except - Result := -1; - end; - end; - function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl; - var - stream : TStream; - begin - stream := TStream( context.unknown ); - if ( stream = nil ) then - raise EInvalidContainer.Create( 'SDLStreamClose on nil' ); - stream.Free; - Result := 1; - end; -// ----------------------------------------------- - -function TTextureUnit.LoadImage(Identifier: PChar): PSDL_Surface; -var - - TexRWops: PSDL_RWops; - dHandle: THandle; - - {$IFDEF LAZARUS} - lLazRes : TLResource; - lResData : TStringStream; - {$ELSE} - TexStream: TStream; - {$ENDIF} - -begin - Result := nil; - TexRWops := nil; - -// Log.LogStatus( Identifier, 'LoadImage' ); - - if ( FileExists(Identifier) ) then - begin - // load from file - Log.LogStatus( 'Is File', ' LoadImage' ); - try - Result:=IMG_Load(Identifier); - except - Log.LogStatus( 'ERROR Could not load from file' , Identifier); - beep; - Exit; - end; - end - else - begin - Log.LogStatus( 'IS Resource, because file does not exist.('+Identifier+')', ' LoadImage' ); - - // load from resource stream - {$IFDEF LAZARUS} - lLazRes := LazFindResource( Identifier, 'TEX' ); - if lLazRes <> nil then - begin - lResData := TStringStream.create( lLazRes.value ); - try - lResData.position := 0; - try - TexRWops := SDL_AllocRW; - TexRWops.unknown := TUnknown( lResData ); - TexRWops.seek := SDLStreamSeek; - TexRWops.read := SDLStreamRead; - TexRWops.write := nil; - TexRWops.close := SDLStreamClose; - TexRWops.type_ := 2; - except - Log.LogStatus( 'ERROR Could not assign resource ('+Identifier+')' , Identifier); - beep; - Exit; - end; - - Result := IMG_Load_RW(TexRWops,0); - SDL_FreeRW(TexRWops); - finally - freeandnil( lResData ); - end; - end - else - begin - Log.LogStatus( 'NOT found in Resource ('+Identifier+')', ' LoadImage' ); - end; - {$ELSE} - dHandle := FindResource(hInstance, Identifier, 'TEX'); - if dHandle=0 then - begin - Log.LogStatus( 'ERROR Could not find resource' , ' '+ Identifier); - beep; - Exit; - end; - - - TexStream := nil; - try - TexStream := TResourceStream.Create(HInstance, Identifier, 'TEX'); - except - Log.LogStatus( 'ERROR Could not load from resource' , Identifier); - beep; - Exit; - end; - - try - TexStream.position := 0; - try - TexRWops := SDL_AllocRW; - TexRWops.unknown := TUnknown(TexStream); - TexRWops.seek := SDLStreamSeek; - TexRWops.read := SDLStreamRead; - TexRWops.write := nil; - TexRWops.close := SDLStreamClose; - TexRWops.type_ := 2; - except - Log.LogStatus( 'ERROR Could not assign resource' , Identifier); - beep; - Exit; - end; - - Log.LogStatus( 'resource Assigned....' , Identifier); - Result:=IMG_Load_RW(TexRWops,0); - SDL_FreeRW(TexRWops); - - finally - if assigned( TexStream ) then - freeandnil( TexStream ); - end; - {$ENDIF} - end; -end; - -procedure TTextureUnit.AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); -var - TempSurface: PSDL_Surface; - NeededPixFmt: PSDL_Pixelformat; -begin - NeededPixFmt:=@fmt_rgba; - if Typ= 'Plain' then NeededPixFmt:=@fmt_rgb - else - if (Typ='Transparent') or - (Typ='Colorized') - then NeededPixFmt:=@fmt_rgba - else - NeededPixFmt:=@fmt_rgb; - - - if not pixfmt_eq(TexSurface^.format, NeededPixFmt) then - begin - TempSurface:=TexSurface; - TexSurface:=SDL_ConvertSurface(TempSurface,NeededPixFmt,SDL_SWSURFACE); - SDL_FreeSurface(TempSurface); - end; -end; - -function TTextureUnit.GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; -var - TempSurface: PSDL_Surface; -begin - TempSurface:=TexSurface; - Result:=SDL_ScaleSurfaceRect(TempSurface, - 0,0,TempSurface^.W,TempSurface^.H, - W,H); -end; - -procedure TTextureUnit.ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); -var - TempSurface: PSDL_Surface; -begin - TempSurface:=TexSurface; - TexSurface:=SDL_ScaleSurfaceRect(TempSurface, - 0,0,TempSurface^.W,TempSurface^.H, - W,H); - SDL_FreeSurface(TempSurface); -end; - -procedure TTextureUnit.FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); -var - TempSurface: PSDL_Surface; -begin - TempSurface:=TexSurface; - with TempSurface^.format^ do - TexSurface:=SDL_CreateRGBSurface(SDL_SWSURFACE,W,H,BitsPerPixel,RMask, GMask, BMask, AMask); - SDL_SetAlpha(TexSurface, 0, 255); - SDL_SetAlpha(TempSurface, 0, 255); - SDL_BlitSurface(TempSurface,nil,TexSurface,nil); - SDL_FreeSurface(TempSurface); -end; - -procedure TTextureUnit.ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); - //returns hue within range [0.0-6.0) - function col2h(Color:Cardinal):double; - var - clr,hls: array[0..2] of double; - delta: double; - begin - clr[0]:=((Color and $ff0000) shr 16)/255; - clr[1]:=((Color and $ff00) shr 8)/255; - clr[2]:=(Color and $ff)/255; - hls[1]:=maxvalue(clr); - delta:=hls[1]-minvalue(clr); - // this is for safety reasons - if delta = 0.0 then delta:=0.000000000001; - if clr[0]=hls[1] then hls[0]:=(clr[1]-clr[2])/delta - else if clr[1]=hls[1] then hls[0]:=2.0+(clr[2]-clr[0])/delta - else if clr[2]=hls[1] then hls[0]:=4.0+(clr[0]-clr[1])/delta; - if hls[0]<0.0 then hls[0]:=hls[0]+6.0; - if hls[0]=6.0 then hls[0]:=0.0; - col2h:=hls[0]; - end; - procedure ColorizePixel(Pix: PByteArray; hue: Double); - var - i,j,k: Cardinal; - clr, hls: array[0..2] of Double; - delta, f, p, q, t: Double; - begin - hls[0]:=hue; - - clr[0] := Pix[0]/255; - clr[1] := Pix[1]/255; - clr[2] := Pix[2]/255; - - //calculate luminance and saturation from rgb - hls[1] := maxvalue(clr); //l:=... - delta := hls[1] - minvalue(clr); - - if hls[1] = 0.0 then - hls[2] := 0.0 - else - hls[2] := delta/hls[1]; //v:=... - - // calc new rgb from our hls (h from color, l ans s from pixel) - // if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense - begin - k:=trunc(hls[0]); - f:=hls[0]-k; - p:=hls[1]*(1.0-hls[2]); - q:=hls[1]*(1.0-(hls[2]*f)); - t:=hls[1]*(1.0-(hls[2]*(1.0-f))); - case k of - 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end; - 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end; - 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end; - 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end; - 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end; - 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; - end; - // and store new rgb back into the image - Pix[0]:=floor(255*clr[0]); - Pix[1]:=floor(255*clr[1]); - Pix[2]:=floor(255*clr[2]); - end; - end; - -var - DestinationHue: Double; - PixelIndex: Cardinal; -begin - DestinationHue:=col2h(Col); - for PixelIndex:=0 to (TexSurface^.W*TexSurface^.H -1) do - ColorizePixel(@(PByteArray(TexSurface^.Pixels)[PixelIndex*TexSurface^.format.BytesPerPixel]),DestinationHue); -end; - -function TTextureUnit.LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; -var - TexSurface: PSDL_Surface; - MipmapSurface: PSDL_Surface; - newWidth, newHeight: Cardinal; - oldWidth, oldHeight: Cardinal; - kopierindex: Cardinal; -begin - Log.BenchmarkStart(4); - Mipmapping := true; -(* - Log.LogStatus( '', '' ); - - if Identifier = nil then - Log.LogStatus(' ERROR unknown Identifier', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+'''') - else - Log.LogStatus(' should be ok - trying to load', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+''''); -*) - - // load texture data into memory - {$ifdef blindydebug} - Log.LogStatus('',' ----------------------------------------------------'); - Log.LogStatus('',' LoadImage('''+Identifier+''') (called by '+Format+')'); - {$endif} - TexSurface := LoadImage(Identifier); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - {$endif} - if not assigned(TexSurface) then - begin - Log.LogStatus( 'ERROR Could not load texture' , Identifier +' '+ Format +' '+ Typ ); - beep; - Exit; - end; - - // convert pixel format as needed - {$ifdef blindydebug} - Log.LogStatus('',' AdjustPixelFormat'); - {$endif} - AdjustPixelFormat(TexSurface, Typ); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - {$endif} - // adjust texture size (scale down, if necessary) - newWidth := TexSurface.W; - newHeight := TexSurface.H; - - if (newWidth > Limit) then - newWidth := Limit; - - if (newHeight > Limit) then - newHeight := Limit; - - if (TexSurface.W > newWidth) or (TexSurface.H > newHeight) then - begin - {$ifdef blindydebug} - Log.LogStatus('',' ScaleTexture'); - {$endif} - ScaleTexture(TexSurface,newWidth,newHeight); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - {$endif} - end; - - {$ifdef blindydebug} - Log.LogStatus('',' JB-1 : typ='+Typ); - {$endif} - - - - // don't actually understand, if this is needed... - // this should definately be changed... together with all this - // cover cache stuff - if (CreateCacheMipmap) and (Typ='Plain') then - begin - {$ifdef blindydebug} - Log.LogStatus('',' JB-1 : Minimap'); - {$endif} - - if (Covers.W <= 256) and (Covers.H <= 256) then - begin - {$ifdef blindydebug} - Log.LogStatus('',' GetScaledTexture('''+inttostr(Covers.W)+''','''+inttostr(Covers.H)+''') (for CacheMipmap)'); - {$endif} - MipmapSurface:=GetScaledTexture(TexSurface,Covers.W, Covers.H); - if assigned(MipmapSurface) then - begin - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - Log.LogStatus('',' BlitSurface Stuff'); - {$endif} - // creating and freeing the surface could be done once, if Cover.W and Cover.H don't change - CacheMipmapSurface:=SDL_CreateRGBSurfaceFrom(@CacheMipmap[0], Covers.W, Covers.H, 24, Covers.W*3, $000000ff, $0000ff00, $00ff0000, 0); - SDL_BlitSurface(MipMapSurface,nil,CacheMipmapSurface,nil); - SDL_FreeSurface(CacheMipmapSurface); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - Log.LogStatus('',' SDL_FreeSurface (CacheMipmap)'); - {$endif} - SDL_FreeSurface(MipmapSurface); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - {$endif} - end - else - begin - Log.LogStatus(' Error creating CacheMipmap',' LoadTexture('''+Identifier+''')'); - end; - end; - // should i create a cache texture, if Covers.W/H are larger? - end; - - {$ifdef blindydebug} - Log.LogStatus('',' JB-2'); - {$endif} - - - // now we might colorize the whole thing - if Typ='Colorized' then - ColorizeTexture(TexSurface,Col); - - // save actual dimensions of our texture - oldWidth:=newWidth; - oldHeight:=newHeight; - // make texture dimensions be powers of 2 - newWidth:=Round(Power(2, Ceil(Log2(newWidth)))); - newHeight:=Round(Power(2, Ceil(Log2(newHeight)))); - if (newHeight <> oldHeight) or (newWidth <> oldWidth) then - FitTexture(TexSurface,newWidth,newHeight); - - // at this point we have the image in memory... - // scaled to be at most 1024x1024 pixels large - // scaled so that dimensions are powers of 2 - // and converted to either RGB or RGBA - - {$ifdef blindydebug} - Log.LogStatus('',' JB-3'); - {$endif} - - - // if we got a Texture of Type Plain, Transparent or Colorized, - // then we're done manipulating it - // and could now create our openGL texture from it - - // prepare OpenGL texture - - // JB_linux : this is causing AV's on linux... ActText seems to be nil ! -// {$IFnDEF win32} -// if pointer(ActTex) = nil then -// exit; -// {$endif} - - glGenTextures(1, @ActTex); - - glBindTexture(GL_TEXTURE_2D, ActTex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - // load data into gl texture - if (Typ = 'Transparent') or - (Typ='Colorized') then - begin - glTexImage2D(GL_TEXTURE_2D, 0, 4, newWidth, newHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, TexSurface.pixels); - end - {if Typ = 'Plain' then} else - begin - glTexImage2D(GL_TEXTURE_2D, 0, 3, newWidth, newHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, TexSurface.pixels); - end; - - {$ifdef blindydebug} - Log.LogStatus('',' JB-4'); - {$endif} - -{ - if Typ = 'Transparent Range' then - // set alpha to 256-green-component (not sure) - Pix := TextureB.Canvas.Pixels[Position2, Position]; - TextureD32[Position*TexNewW + Position2+1, 1] := Pix; - TextureD32[Position*TexNewW + Position2+1, 2] := Pix div 256; - TextureD32[Position*TexNewW + Position2+1, 3] := Pix div (256*256); - TextureD32[Position*TexNewW + Position2+1, 4] := 256 - Pix div 256; -} -{ - if Typ = 'Font' then - // either create luminance-alpha texture - // or use transparency from differently saved file - // or do something totally different (text engine with ttf) - Pix := PPix[Position2 * 3]; - TextureD16[Position*TextureB.Width + Position2 + 1, 1] := 255; - TextureD16[Position*TextureB.Width + Position2 + 1, 2] := Pix; - glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); -} -{ - if Typ = 'Font Outline' then - // no idea... - begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - - Col := Pix; - if Col < 127 then Col := 127; - - TempA := Pix; - if TempA >= 95 then TempA := 255; - if TempA >= 31 then TempA := 255; - if Pix < 95 then TempA := (Pix * 256) div 96; - - - TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; - TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - end; -} -{ - if Typ = 'Font Outline 2' then - // same as above - begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - - Col := Pix; - if Col < 31 then Col := 31; - - TempA := Pix; - if TempA >= 31 then TempA := 255; - if Pix < 31 then TempA := Pix * (256 div 32); - - TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; - TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - if Error > 0 then beep; - end; - end; - - if Typ = 'Font Black' then - // and so on - begin - // normalnie 0,125s bez niczego 0,015s - 0,030s z pix 0,125s <-- ??? - // dimensions - TextureB.PixelFormat := pf24bit; - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2*3]; - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; - - if Typ = 'Alpha Black Colored' then - // ... hope, noone needs this - begin - TextureB.PixelFormat := pf24bit; - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2*3]; - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := (Col div $10000) and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Col div $100) and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Col and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; - - if Typ = 'Font Gray' then - begin - // dimensions - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TextureB.Height-1 do begin - for Position2 := 0 to TextureB.Width-1 do begin - Pix := TextureB.Canvas.Pixels[Position2, Position]; - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 127; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 127; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 127; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; - - if Typ = 'Arrow' then - begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - - // transparency - if Pix >= 127 then TempA := 255; - if Pix < 127 then TempA := Pix * 2; - - // ColInt = color intensity - if Pix < 127 then ColInt := 1; - if Pix >= 127 then ColInt := 2 - Pix / 128; - //0.75, 0.6, 0.25 - - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Round(ColInt * 0.75 * 255 + (1 - ColInt) * 255); - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := Round(ColInt * 0.6 * 255 + (1 - ColInt) * 255); - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Round(ColInt * 0.25 * 255 + (1 - ColInt) * 255); - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - - if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - if Error > 0 then beep; - end; - end; - - if Typ = 'Note Plain' then - begin - for Position := 0 to TextureB.Height-1 do - begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do - begin - - - - // Skin Patch - // 0-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White - case PPix[Position2*3] of - 0..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); - 192: Pix := Col; - 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); - 255: Pix := $FFFFFF; - end; -// 0.5.0. Original -// case PPix[Position2*3] of -// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; -// 192: Pix := Col; -// 255: Pix := $FFFFFF; -// end; - - - - - - TextureD24[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; - TextureD24[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; - TextureD24[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureB.Width, TextureB.Height, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); - end; - - if Typ = 'Note Transparent' then - begin - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - TempA := 255; - - - - //Skin Patch - // 0= Transparent, 1-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White - case PPix[Position2*3] of - 0: TempA := 0; - 1..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); - 192: Pix := Col; - 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); - 255: Pix := $FFFFFF; - end; -// 0.5.0 Original -// case PPix[Position2*3] of -// 0: TempA := 0; -// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; -// 192: Pix := Col; -// 255: Pix := $FFFFFF; -// end; - - - - - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; -} - - {$ifdef blindydebug} - Log.LogStatus('',' JB-5'); - {$endif} - - - Result.X := 0; - Result.Y := 0; - Result.W := 0; - Result.H := 0; - Result.ScaleW := 1; - Result.ScaleH := 1; - Result.Rot := 0; - Result.TexNum := ActTex; - Result.TexW := oldWidth / newWidth; - Result.TexH := oldHeight / newHeight; - - Result.Int := 1; - Result.ColR := 1; - Result.ColG := 1; - Result.ColB := 1; - Result.Alpha := 1; - - // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these - Result.TexX1 := 0; - Result.TexY1 := 0; - Result.TexX2 := 1; - Result.TexY2 := 1; - - {$ifdef blindydebug} - Log.LogStatus('',' JB-6'); - {$endif} - - - // 0.5.0 - Result.Name := Identifier; - - SDL_FreeSurface(TexSurface); - - {$ifdef blindydebug} - Log.LogStatus('',' JB-7'); - {$endif} - - - Log.BenchmarkEnd(4); - if Log.BenchmarkTimeLength[4] >= 1 then - Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4); - - {$ifdef blindydebug} - Log.LogStatus('',' JB-8'); - {$endif} - -end; - - -function TTextureUnit.GetTexture(Name, Typ: string): TTexture; -begin - Result := GetTexture(Name, Typ, true); -end; - -function TTextureUnit.GetTexture(Name, Typ: string; FromCache: boolean): TTexture; -var - T: integer; // texture - C: integer; // cover - Data: array of byte; -begin - - if Name = '' then - exit; - - // find texture entry - T := FindTexture(Name); - - if T = -1 then - begin - // create texture entry - T := Length(TextureDatabase.Texture); - SetLength(TextureDatabase.Texture, T+1); - - TextureDatabase.Texture[T].Name := Name; - TextureDatabase.Texture[T].Typ := Typ; - - // inform database that no textures have been loaded into memory - TextureDatabase.Texture[T].Texture.TexNum := -1; - TextureDatabase.Texture[T].TextureCache.TexNum := -1; - end; - - // use preloaded texture - if (not FromCache) or (FromCache and not Covers.CoverExists(Name)) then - begin - // use full texture - if TextureDatabase.Texture[T].Texture.TexNum = -1 then - begin - // load texture - {$ifdef blindydebug} - Log.LogStatus('...', 'GetTexture('''+Name+''','''+Typ+''')'); - {$endif} - TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', pchar(Typ), $0); - {$ifdef blindydebug} - Log.LogStatus('done',' '); - {$endif} - end; - - // use texture - Result := TextureDatabase.Texture[T].Texture; - end; - - if FromCache and Covers.CoverExists(Name) then - begin - // use cache texture - C := Covers.CoverNumber(Name); - - if TextureDatabase.Texture[T].TextureCache.TexNum = -1 then - begin - // load texture - Covers.PrepareData(Name); - TextureDatabase.Texture[T].TextureCache := CreateTexture(Covers.Data, Name, Covers.Cover[C].W, Covers.Cover[C].H, 24); - end; - - // use texture - Result := TextureDatabase.Texture[T].TextureCache; - end; -end; - -function TTextureUnit.FindTexture(Name: string): integer; -var - T: integer; // texture -begin - Result := -1; - for T := 0 to high(TextureDatabase.Texture) do - if TextureDatabase.Texture[T].Name = Name then - Result := T; -end; - -function TTextureUnit.LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; -begin - Result := LoadTexture(false, Identifier, Format, Typ, Col); -end; - -function TTextureUnit.LoadTexture(Identifier: string): TTexture; -begin - Result := LoadTexture(false, pchar(Identifier), 'JPG', 'Plain', 0); -end; - -function TTextureUnit.CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; -var - Position: integer; - Position2: integer; - Pix: integer; - ColInt: real; - PPix: PByteArray; - TempA: integer; - Error: integer; -begin - Mipmapping := false; - - glGenTextures(1, @ActTex); // ActText = new texture number - glBindTexture(GL_TEXTURE_2D, ActTex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - glTexImage2D(GL_TEXTURE_2D, 0, 3, W, H, 0, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, W, H, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); - if Error > 0 then beep; - end; - - Result.X := 0; - Result.Y := 0; - Result.W := 0; - Result.H := 0; - Result.ScaleW := 1; - Result.ScaleH := 1; - Result.Rot := 0; - Result.TexNum := ActTex; - Result.TexW := 1; - Result.TexH := 1; - - Result.Int := 1; - Result.ColR := 1; - Result.ColG := 1; - Result.ColB := 1; - Result.Alpha := 1; - - // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these - Result.TexX1 := 0; - Result.TexY1 := 0; - Result.TexX2 := 1; - Result.TexY2 := 1; - - // 0.5.0 - Result.Name := Name; -end; - -procedure TTextureUnit.UnloadTexture(Name: string; FromCache: boolean); -var - T: integer; - TexNum: GLuint; -begin - T := FindTexture(Name); - - if not FromCache then begin - TexNum := TextureDatabase.Texture[T].Texture.TexNum; - if TexNum >= 0 then begin - glDeleteTextures(1, @TexNum); - TextureDatabase.Texture[T].Texture.TexNum := -1; -// Log.LogError('Unload texture no '+IntToStr(TexNum)); - end; - end else begin - TexNum := TextureDatabase.Texture[T].TextureCache.TexNum; - if TexNum >= 0 then begin - glDeleteTextures(1, @TexNum); - TextureDatabase.Texture[T].TextureCache.TexNum := -1; -// Log.LogError('Unload texture cache no '+IntToStr(TexNum)); - end; - end; -end; - -{$IFDEF LAZARUS} -initialization - {$I UltraStar.lrs} -{$ENDIF} - - -end. +unit UTexture; +// added for easier debug disabling +{$undef blindydebug} + +// Plain (alpha = 1) +// Transparent +// Colorized + +// obsolete? +// Transparent Range +// Font (white is drawn, black is transparent) +// Font Outline (Font with darker outline) +// Font Outline 2 (Font with darker outline) +// Font Black (black is drawn, white is transparent) +// Font Gray (gray is drawn, white is transparent) +// Arrow (for arrows, white is white, gray has color, black is transparent); + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses OpenGL12, + {$IFDEF win32} + windows, + {$ENDIF} + Math, + Classes, + SysUtils, + Graphics, + UCommon, + UThemes, + SDL, + sdlutils, + SDL_Image; + +type + TTexture = record + TexNum: integer; + X: real; + Y: real; + Z: real; // new + W: real; + H: real; + ScaleW: real; // for dynamic scalling while leaving width constant + ScaleH: real; // for dynamic scalling while leaving height constant + Rot: real; // 0 - 2*pi + Int: real; // intensity + ColR: real; + ColG: real; + ColB: real; + TexW: real; // used? + TexH: real; // used? + TexX1: real; + TexY1: real; + TexX2: real; + TexY2: real; + Alpha: real; + Name: string; // 0.5.0: experimental for handling cache images. maybe it's useful for dynamic skins + end; + + TTextureEntry = record + Name: string; + Typ: string; + + // we use normal TTexture, it's easier to implement and if needed - we copy ready data + Texture: TTexture; + TextureCache: TTexture; // 0.5.0 + end; + + TTextureDatabase = record + Texture: array of TTextureEntry; + end; + + TTextureUnit = class + + private + function LoadImage(Identifier: PChar): PSDL_Surface; + function pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; + procedure AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); + function GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; + procedure ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); + procedure FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); + procedure ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); + + public + Limit: integer; + CreateCacheMipmap: boolean; + +// function GetNumberFor + function GetTexture(Name, Typ: string): TTexture; overload; + function GetTexture(Name, Typ: string; FromCache: boolean): TTexture; overload; + function FindTexture(Name: string): integer; + function LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; + function LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; + function LoadTexture(Identifier: string): TTexture; overload; + function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; + procedure UnloadTexture(Name: string; FromCache: boolean); + Constructor Create; + Destructor Destroy; override; + end; + +var + Texture: TTextureUnit; + TextureDatabase: TTextureDatabase; + + // this should be in UDisplay?! + PrintScreenData: array[0..1024*768-1] of longword; + + ActTex: GLuint;//integer; + +// TextureD8: array[1..1024*1024] of byte; // 1MB + TextureD16: array[1..1024*1024, 1..2] of byte; // luminance/alpha tex (2MB) +// TextureD24: array[1..1024*1024, 1..3] of byte; // normal 24-bit tex (3MB) +// TextureD242: array[1..512*512, 1..3] of byte; // normal 24-bit tex (0,75MB) +// TextureD32: array[1..1024*1024, 1..4] of byte; // transparent 32-bit tex (4MB) + // total 40MB at 2048*2048 + // total 10MB at 1024*1024 + + Mipmapping: Boolean; + + CacheMipmap: array[0..256*256*3-1] of byte; // 3KB + CacheMipmapSurface: PSDL_Surface; + + +implementation + +uses ULog, + DateUtils, + UCovers, + {$IFDEF LAZARUS} + LResources, + {$ENDIF} + {$IFDEF DARWIN} + MacResources, + {$ENDIF} + StrUtils, dialogs; + +const + fmt_rgba: TSDL_Pixelformat=(palette: nil; + BitsPerPixel: 32; + BytesPerPixel: 4; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 24; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $ff000000; + ColorKey: 0; + Alpha: 255); + fmt_rgb: TSDL_Pixelformat=( palette: nil; + BitsPerPixel: 24; + BytesPerPixel: 3; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 0; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $00000000; + ColorKey: 0; + Alpha: 255); + + +Constructor TTextureUnit.Create; +begin + inherited Create; +end; + +Destructor TTextureUnit.Destroy; +begin + inherited Destroy; +end; + +function TTextureUnit.pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; +begin + if (fmt1^.BitsPerPixel = fmt2^.BitsPerPixel) and + (fmt1^.BytesPerPixel = fmt2^.BytesPerPixel) and + (fmt1^.Rloss = fmt2^.Rloss) and (fmt1^.Gloss = fmt2^.Gloss) and + (fmt1^.Bloss = fmt2^.Bloss) and (fmt1^.Rmask = fmt2^.Rmask) and + (fmt1^.Gmask = fmt2^.Gmask) and (fmt1^.Bmask = fmt2^.Bmask) and + (fmt1^.Rshift = fmt2^.Rshift) and (fmt1^.Gshift = fmt2^.Gshift) and + (fmt1^.Bshift = fmt2^.Bshift) + then + Result:=True + else + Result:=False; +end; + +// +++++++++++++++++++++ helpers for loadimage +++++++++++++++ + function SdlStreamSeek( context : PSDL_RWops; offset : Integer; whence : Integer ) : integer; cdecl; + var + stream : TStream; + origin : Word; + begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamSeek on nil' ); + case whence of + 0 : origin := soFromBeginning; // Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0. + 1 : origin := soFromCurrent; // Offset is from the current position in the resource. Seek moves to Position + Offset. + 2 : origin := soFromEnd; + else + origin := soFromBeginning; // just in case + end; + Result := stream.Seek( offset, origin ); + end; + function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : Integer; maxnum: Integer ) : Integer; cdecl; + var + stream : TStream; + begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamRead on nil' ); + try + Result := stream.read( Ptr^, Size * maxnum ) div size; + except + Result := -1; + end; + end; + function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl; + var + stream : TStream; + begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamClose on nil' ); + stream.Free; + Result := 1; + end; +// ----------------------------------------------- + +function TTextureUnit.LoadImage(Identifier: PChar): PSDL_Surface; +var + + TexRWops: PSDL_RWops; + dHandle: THandle; + + {$IFDEF LAZARUS} + lLazRes : TLResource; + lResData : TStringStream; + {$ELSE} + TexStream: TStream; + {$ENDIF} + +begin + Result := nil; + TexRWops := nil; + +// Log.LogStatus( Identifier, 'LoadImage' ); + + if ( FileExists(Identifier) ) then + begin + // load from file + Log.LogStatus( 'Is File', ' LoadImage' ); + try + Result:=IMG_Load(Identifier); + except + Log.LogStatus( 'ERROR Could not load from file' , Identifier); + beep; + Exit; + end; + end + else + begin + Log.LogStatus( 'IS Resource, because file does not exist.('+Identifier+')', ' LoadImage' ); + + // load from resource stream + {$IFDEF LAZARUS} + lLazRes := LazFindResource( Identifier, 'TEX' ); + if lLazRes <> nil then + begin + lResData := TStringStream.create( lLazRes.value ); + try + lResData.position := 0; + try + TexRWops := SDL_AllocRW; + TexRWops.unknown := TUnknown( lResData ); + TexRWops.seek := SDLStreamSeek; + TexRWops.read := SDLStreamRead; + TexRWops.write := nil; + TexRWops.close := SDLStreamClose; + TexRWops.type_ := 2; + except + Log.LogStatus( 'ERROR Could not assign resource ('+Identifier+')' , Identifier); + beep; + Exit; + end; + + Result := IMG_Load_RW(TexRWops,0); + SDL_FreeRW(TexRWops); + finally + freeandnil( lResData ); + end; + end + else + begin + Log.LogStatus( 'NOT found in Resource ('+Identifier+')', ' LoadImage' ); + end; + {$ELSE} + dHandle := FindResource(hInstance, Identifier, 'TEX'); + if dHandle=0 then + begin + Log.LogStatus( 'ERROR Could not find resource' , ' '+ Identifier); + beep; + Exit; + end; + + + TexStream := nil; + try + TexStream := TResourceStream.Create(HInstance, Identifier, 'TEX'); + except + Log.LogStatus( 'ERROR Could not load from resource' , Identifier); + beep; + Exit; + end; + + try + TexStream.position := 0; + try + TexRWops := SDL_AllocRW; + TexRWops.unknown := TUnknown(TexStream); + TexRWops.seek := SDLStreamSeek; + TexRWops.read := SDLStreamRead; + TexRWops.write := nil; + TexRWops.close := SDLStreamClose; + TexRWops.type_ := 2; + except + Log.LogStatus( 'ERROR Could not assign resource' , Identifier); + beep; + Exit; + end; + + Log.LogStatus( 'resource Assigned....' , Identifier); + Result:=IMG_Load_RW(TexRWops,0); + SDL_FreeRW(TexRWops); + + finally + if assigned( TexStream ) then + freeandnil( TexStream ); + end; + {$ENDIF} + end; +end; + +procedure TTextureUnit.AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); +var + TempSurface: PSDL_Surface; + NeededPixFmt: PSDL_Pixelformat; +begin + NeededPixFmt:=@fmt_rgba; + if Typ= 'Plain' then NeededPixFmt:=@fmt_rgb + else + if (Typ='Transparent') or + (Typ='Colorized') + then NeededPixFmt:=@fmt_rgba + else + NeededPixFmt:=@fmt_rgb; + + + if not pixfmt_eq(TexSurface^.format, NeededPixFmt) then + begin + TempSurface:=TexSurface; + TexSurface:=SDL_ConvertSurface(TempSurface,NeededPixFmt,SDL_SWSURFACE); + SDL_FreeSurface(TempSurface); + end; +end; + +function TTextureUnit.GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; +var + TempSurface: PSDL_Surface; +begin + TempSurface:=TexSurface; + Result:=SDL_ScaleSurfaceRect(TempSurface, + 0,0,TempSurface^.W,TempSurface^.H, + W,H); +end; + +procedure TTextureUnit.ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); +var + TempSurface: PSDL_Surface; +begin + TempSurface:=TexSurface; + TexSurface:=SDL_ScaleSurfaceRect(TempSurface, + 0,0,TempSurface^.W,TempSurface^.H, + W,H); + SDL_FreeSurface(TempSurface); +end; + +procedure TTextureUnit.FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); +var + TempSurface: PSDL_Surface; +begin + TempSurface:=TexSurface; + with TempSurface^.format^ do + TexSurface:=SDL_CreateRGBSurface(SDL_SWSURFACE,W,H,BitsPerPixel,RMask, GMask, BMask, AMask); + SDL_SetAlpha(TexSurface, 0, 255); + SDL_SetAlpha(TempSurface, 0, 255); + SDL_BlitSurface(TempSurface,nil,TexSurface,nil); + SDL_FreeSurface(TempSurface); +end; + +procedure TTextureUnit.ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); + //returns hue within range [0.0-6.0) + function col2h(Color:Cardinal):double; + var + clr,hls: array[0..2] of double; + delta: double; + begin + clr[0]:=((Color and $ff0000) shr 16)/255; + clr[1]:=((Color and $ff00) shr 8)/255; + clr[2]:=(Color and $ff)/255; + hls[1]:=maxvalue(clr); + delta:=hls[1]-minvalue(clr); + // this is for safety reasons + if delta = 0.0 then delta:=0.000000000001; + if clr[0]=hls[1] then hls[0]:=(clr[1]-clr[2])/delta + else if clr[1]=hls[1] then hls[0]:=2.0+(clr[2]-clr[0])/delta + else if clr[2]=hls[1] then hls[0]:=4.0+(clr[0]-clr[1])/delta; + if hls[0]<0.0 then hls[0]:=hls[0]+6.0; + if hls[0]=6.0 then hls[0]:=0.0; + col2h:=hls[0]; + end; + procedure ColorizePixel(Pix: PByteArray; hue: Double); + var + i,j,k: Cardinal; + clr, hls: array[0..2] of Double; + delta, f, p, q, t: Double; + begin + hls[0]:=hue; + + clr[0] := Pix[0]/255; + clr[1] := Pix[1]/255; + clr[2] := Pix[2]/255; + + //calculate luminance and saturation from rgb + hls[1] := maxvalue(clr); //l:=... + delta := hls[1] - minvalue(clr); + + if hls[1] = 0.0 then + hls[2] := 0.0 + else + hls[2] := delta/hls[1]; //v:=... + + // calc new rgb from our hls (h from color, l ans s from pixel) + // if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense + begin + k:=trunc(hls[0]); + f:=hls[0]-k; + p:=hls[1]*(1.0-hls[2]); + q:=hls[1]*(1.0-(hls[2]*f)); + t:=hls[1]*(1.0-(hls[2]*(1.0-f))); + case k of + 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end; + 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end; + 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end; + 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end; + 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end; + 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; + end; + // and store new rgb back into the image + Pix[0]:=floor(255*clr[0]); + Pix[1]:=floor(255*clr[1]); + Pix[2]:=floor(255*clr[2]); + end; + end; + +var + DestinationHue: Double; + PixelIndex: Cardinal; +begin + DestinationHue:=col2h(Col); + for PixelIndex:=0 to (TexSurface^.W*TexSurface^.H -1) do + ColorizePixel(@(PByteArray(TexSurface^.Pixels)[PixelIndex*TexSurface^.format.BytesPerPixel]),DestinationHue); +end; + +function TTextureUnit.LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; +var + TexSurface: PSDL_Surface; + MipmapSurface: PSDL_Surface; + newWidth, newHeight: Cardinal; + oldWidth, oldHeight: Cardinal; + kopierindex: Cardinal; +begin + Log.BenchmarkStart(4); + Mipmapping := true; +(* + Log.LogStatus( '', '' ); + + if Identifier = nil then + Log.LogStatus(' ERROR unknown Identifier', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+'''') + else + Log.LogStatus(' should be ok - trying to load', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+''''); +*) + + // load texture data into memory + {$ifdef blindydebug} + Log.LogStatus('',' ----------------------------------------------------'); + Log.LogStatus('',' LoadImage('''+Identifier+''') (called by '+Format+')'); + {$endif} + TexSurface := LoadImage(Identifier); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + if not assigned(TexSurface) then + begin + Log.LogStatus( 'ERROR Could not load texture' , Identifier +' '+ Format +' '+ Typ ); + beep; + Exit; + end; + + // convert pixel format as needed + {$ifdef blindydebug} + Log.LogStatus('',' AdjustPixelFormat'); + {$endif} + AdjustPixelFormat(TexSurface, Typ); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + // adjust texture size (scale down, if necessary) + newWidth := TexSurface.W; + newHeight := TexSurface.H; + + if (newWidth > Limit) then + newWidth := Limit; + + if (newHeight > Limit) then + newHeight := Limit; + + if (TexSurface.W > newWidth) or (TexSurface.H > newHeight) then + begin + {$ifdef blindydebug} + Log.LogStatus('',' ScaleTexture'); + {$endif} + ScaleTexture(TexSurface,newWidth,newHeight); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + end; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-1 : typ='+Typ); + {$endif} + + + + // don't actually understand, if this is needed... + // this should definately be changed... together with all this + // cover cache stuff + if (CreateCacheMipmap) and (Typ='Plain') then + begin + {$ifdef blindydebug} + Log.LogStatus('',' JB-1 : Minimap'); + {$endif} + + if (Covers.W <= 256) and (Covers.H <= 256) then + begin + {$ifdef blindydebug} + Log.LogStatus('',' GetScaledTexture('''+inttostr(Covers.W)+''','''+inttostr(Covers.H)+''') (for CacheMipmap)'); + {$endif} + MipmapSurface:=GetScaledTexture(TexSurface,Covers.W, Covers.H); + if assigned(MipmapSurface) then + begin + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + Log.LogStatus('',' BlitSurface Stuff'); + {$endif} + // creating and freeing the surface could be done once, if Cover.W and Cover.H don't change + CacheMipmapSurface:=SDL_CreateRGBSurfaceFrom(@CacheMipmap[0], Covers.W, Covers.H, 24, Covers.W*3, $000000ff, $0000ff00, $00ff0000, 0); + SDL_BlitSurface(MipMapSurface,nil,CacheMipmapSurface,nil); + SDL_FreeSurface(CacheMipmapSurface); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + Log.LogStatus('',' SDL_FreeSurface (CacheMipmap)'); + {$endif} + SDL_FreeSurface(MipmapSurface); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + end + else + begin + Log.LogStatus(' Error creating CacheMipmap',' LoadTexture('''+Identifier+''')'); + end; + end; + // should i create a cache texture, if Covers.W/H are larger? + end; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-2'); + {$endif} + + + // now we might colorize the whole thing + if Typ='Colorized' then + ColorizeTexture(TexSurface,Col); + + // save actual dimensions of our texture + oldWidth:=newWidth; + oldHeight:=newHeight; + // make texture dimensions be powers of 2 + newWidth:=Round(Power(2, Ceil(Log2(newWidth)))); + newHeight:=Round(Power(2, Ceil(Log2(newHeight)))); + if (newHeight <> oldHeight) or (newWidth <> oldWidth) then + FitTexture(TexSurface,newWidth,newHeight); + + // at this point we have the image in memory... + // scaled to be at most 1024x1024 pixels large + // scaled so that dimensions are powers of 2 + // and converted to either RGB or RGBA + + {$ifdef blindydebug} + Log.LogStatus('',' JB-3'); + {$endif} + + + // if we got a Texture of Type Plain, Transparent or Colorized, + // then we're done manipulating it + // and could now create our openGL texture from it + + // prepare OpenGL texture + + // JB_linux : this is causing AV's on linux... ActText seems to be nil ! +// {$IFnDEF win32} +// if pointer(ActTex) = nil then +// exit; +// {$endif} + + glGenTextures(1, @ActTex); + + glBindTexture(GL_TEXTURE_2D, ActTex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + // load data into gl texture + if (Typ = 'Transparent') or + (Typ='Colorized') then + begin + glTexImage2D(GL_TEXTURE_2D, 0, 4, newWidth, newHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, TexSurface.pixels); + end + {if Typ = 'Plain' then} else + begin + glTexImage2D(GL_TEXTURE_2D, 0, 3, newWidth, newHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, TexSurface.pixels); + end; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-4'); + {$endif} + +{ + if Typ = 'Transparent Range' then + // set alpha to 256-green-component (not sure) + Pix := TextureB.Canvas.Pixels[Position2, Position]; + TextureD32[Position*TexNewW + Position2+1, 1] := Pix; + TextureD32[Position*TexNewW + Position2+1, 2] := Pix div 256; + TextureD32[Position*TexNewW + Position2+1, 3] := Pix div (256*256); + TextureD32[Position*TexNewW + Position2+1, 4] := 256 - Pix div 256; +} +{ + if Typ = 'Font' then + // either create luminance-alpha texture + // or use transparency from differently saved file + // or do something totally different (text engine with ttf) + Pix := PPix[Position2 * 3]; + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := 255; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := Pix; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); +} +{ + if Typ = 'Font Outline' then + // no idea... + begin + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + Col := Pix; + if Col < 127 then Col := 127; + + TempA := Pix; + if TempA >= 95 then TempA := 255; + if TempA >= 31 then TempA := 255; + if Pix < 95 then TempA := (Pix * 256) div 96; + + + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + end; +} +{ + if Typ = 'Font Outline 2' then + // same as above + begin + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + Col := Pix; + if Col < 31 then Col := 31; + + TempA := Pix; + if TempA >= 31 then TempA := 255; + if Pix < 31 then TempA := Pix * (256 div 32); + + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + if Error > 0 then beep; + end; + end; + + if Typ = 'Font Black' then + // and so on + begin + // normalnie 0,125s bez niczego 0,015s - 0,030s z pix 0,125s <-- ??? + // dimensions + TextureB.PixelFormat := pf24bit; + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2*3]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + if Typ = 'Alpha Black Colored' then + // ... hope, noone needs this + begin + TextureB.PixelFormat := pf24bit; + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2*3]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := (Col div $10000) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Col div $100) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Col and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + if Typ = 'Font Gray' then + begin + // dimensions + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + for Position2 := 0 to TextureB.Width-1 do begin + Pix := TextureB.Canvas.Pixels[Position2, Position]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + if Typ = 'Arrow' then + begin + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + // transparency + if Pix >= 127 then TempA := 255; + if Pix < 127 then TempA := Pix * 2; + + // ColInt = color intensity + if Pix < 127 then ColInt := 1; + if Pix >= 127 then ColInt := 2 - Pix / 128; + //0.75, 0.6, 0.25 + + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Round(ColInt * 0.75 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := Round(ColInt * 0.6 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Round(ColInt * 0.25 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + if Error > 0 then beep; + end; + end; + + if Typ = 'Note Plain' then + begin + for Position := 0 to TextureB.Height-1 do + begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do + begin + + + + // Skin Patch + // 0-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White + case PPix[Position2*3] of + 0..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); + 192: Pix := Col; + 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); + 255: Pix := $FFFFFF; + end; +// 0.5.0. Original +// case PPix[Position2*3] of +// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; +// 192: Pix := Col; +// 255: Pix := $FFFFFF; +// end; + + + + + + TextureD24[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; + TextureD24[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; + TextureD24[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureB.Width, TextureB.Height, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); + end; + + if Typ = 'Note Transparent' then + begin + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + TempA := 255; + + + + //Skin Patch + // 0= Transparent, 1-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White + case PPix[Position2*3] of + 0: TempA := 0; + 1..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); + 192: Pix := Col; + 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); + 255: Pix := $FFFFFF; + end; +// 0.5.0 Original +// case PPix[Position2*3] of +// 0: TempA := 0; +// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; +// 192: Pix := Col; +// 255: Pix := $FFFFFF; +// end; + + + + + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; +} + + {$ifdef blindydebug} + Log.LogStatus('',' JB-5'); + {$endif} + + + Result.X := 0; + Result.Y := 0; + Result.Z := 0; + Result.W := 0; + Result.H := 0; + Result.ScaleW := 1; + Result.ScaleH := 1; + Result.Rot := 0; + Result.TexNum := ActTex; + Result.TexW := oldWidth / newWidth; + Result.TexH := oldHeight / newHeight; + + Result.Int := 1; + Result.ColR := 1; + Result.ColG := 1; + Result.ColB := 1; + Result.Alpha := 1; + + // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these + Result.TexX1 := 0; + Result.TexY1 := 0; + Result.TexX2 := 1; + Result.TexY2 := 1; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-6'); + {$endif} + + + // 0.5.0 + Result.Name := Identifier; + + SDL_FreeSurface(TexSurface); + + {$ifdef blindydebug} + Log.LogStatus('',' JB-7'); + {$endif} + + + Log.BenchmarkEnd(4); + if Log.BenchmarkTimeLength[4] >= 1 then + Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4); + + {$ifdef blindydebug} + Log.LogStatus('',' JB-8'); + {$endif} + +end; + + +function TTextureUnit.GetTexture(Name, Typ: string): TTexture; +begin + Result := GetTexture(Name, Typ, true); +end; + +function TTextureUnit.GetTexture(Name, Typ: string; FromCache: boolean): TTexture; +var + T: integer; // texture + C: integer; // cover + Data: array of byte; +begin + + if Name = '' then + exit; + + // find texture entry + T := FindTexture(Name); + + if T = -1 then + begin + // create texture entry + T := Length(TextureDatabase.Texture); + SetLength(TextureDatabase.Texture, T+1); + + TextureDatabase.Texture[T].Name := Name; + TextureDatabase.Texture[T].Typ := Typ; + + // inform database that no textures have been loaded into memory + TextureDatabase.Texture[T].Texture.TexNum := -1; + TextureDatabase.Texture[T].TextureCache.TexNum := -1; + end; + + // use preloaded texture + if (not FromCache) or (FromCache and not Covers.CoverExists(Name)) then + begin + // use full texture + if TextureDatabase.Texture[T].Texture.TexNum = -1 then + begin + // load texture + {$ifdef blindydebug} + Log.LogStatus('...', 'GetTexture('''+Name+''','''+Typ+''')'); + {$endif} + TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', pchar(Typ), $0); + {$ifdef blindydebug} + Log.LogStatus('done',' '); + {$endif} + end; + + // use texture + Result := TextureDatabase.Texture[T].Texture; + end; + + if FromCache and Covers.CoverExists(Name) then + begin + // use cache texture + C := Covers.CoverNumber(Name); + + if TextureDatabase.Texture[T].TextureCache.TexNum = -1 then + begin + // load texture + Covers.PrepareData(Name); + TextureDatabase.Texture[T].TextureCache := CreateTexture(Covers.Data, Name, Covers.Cover[C].W, Covers.Cover[C].H, 24); + end; + + // use texture + Result := TextureDatabase.Texture[T].TextureCache; + end; +end; + +function TTextureUnit.FindTexture(Name: string): integer; +var + T: integer; // texture +begin + Result := -1; + for T := 0 to high(TextureDatabase.Texture) do + if TextureDatabase.Texture[T].Name = Name then + Result := T; +end; + +function TTextureUnit.LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; +begin + Result := LoadTexture(false, Identifier, Format, Typ, Col); +end; + +function TTextureUnit.LoadTexture(Identifier: string): TTexture; +begin + Result := LoadTexture(false, pchar(Identifier), 'JPG', 'Plain', 0); +end; + +function TTextureUnit.CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; +var + Position: integer; + Position2: integer; + Pix: integer; + ColInt: real; + PPix: PByteArray; + TempA: integer; + Error: integer; +begin + Mipmapping := false; + + glGenTextures(1, @ActTex); // ActText = new texture number + glBindTexture(GL_TEXTURE_2D, ActTex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + glTexImage2D(GL_TEXTURE_2D, 0, 3, W, H, 0, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, W, H, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); + if Error > 0 then beep; + end; + + Result.X := 0; + Result.Y := 0; + Result.W := 0; + Result.H := 0; + Result.ScaleW := 1; + Result.ScaleH := 1; + Result.Rot := 0; + Result.TexNum := ActTex; + Result.TexW := 1; + Result.TexH := 1; + + Result.Int := 1; + Result.ColR := 1; + Result.ColG := 1; + Result.ColB := 1; + Result.Alpha := 1; + + // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these + Result.TexX1 := 0; + Result.TexY1 := 0; + Result.TexX2 := 1; + Result.TexY2 := 1; + + // 0.5.0 + Result.Name := Name; +end; + +procedure TTextureUnit.UnloadTexture(Name: string; FromCache: boolean); +var + T: integer; + TexNum: GLuint; +begin + T := FindTexture(Name); + + if not FromCache then begin + TexNum := TextureDatabase.Texture[T].Texture.TexNum; + if TexNum >= 0 then begin + glDeleteTextures(1, @TexNum); + TextureDatabase.Texture[T].Texture.TexNum := -1; +// Log.LogError('Unload texture no '+IntToStr(TexNum)); + end; + end else begin + TexNum := TextureDatabase.Texture[T].TextureCache.TexNum; + if TexNum >= 0 then begin + glDeleteTextures(1, @TexNum); + TextureDatabase.Texture[T].TextureCache.TexNum := -1; +// Log.LogError('Unload texture cache no '+IntToStr(TexNum)); + end; + end; +end; + +{$IFDEF LAZARUS} +initialization + {$I UltraStar.lrs} +{$ENDIF} + + +end. -- cgit v1.2.3 From 6fa012e73a04959d69307911b90f526148c8352a Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 4 Feb 2008 23:10:16 +0000 Subject: small changes to check linux compilation. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@808 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlatformLinux.pas | 11 +-- Game/Code/UltraStarDeluxe.control | 2 +- Game/Code/linux-build.sh | 8 +- Game/Code/switches.inc | 142 ++++++++++++++++++----------------- 4 files changed, 84 insertions(+), 79 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlatformLinux.pas b/Game/Code/Classes/UPlatformLinux.pas index 2115428f..882376a2 100644 --- a/Game/Code/Classes/UPlatformLinux.pas +++ b/Game/Code/Classes/UPlatformLinux.pas @@ -128,7 +128,7 @@ end; function TPlatformLinux.GetLogPath : WideString; begin if FindCmdLineSwitch( cUseLocalPaths ) then - result := inherited + result := ExtractFilePath(ParamStr(0)) else result := '/var/log/UltraStarDeluxe/'; end; @@ -136,7 +136,7 @@ end; function TPlatformLinux.GetGameSharedPath : WideString; begin if FindCmdLineSwitch( cUseLocalPaths ) then - result := inherited + result := ExtractFilePath(ParamStr(0)) else result := '/usr/share/UltraStarDeluxe/'; end; @@ -144,7 +144,7 @@ end; function TPlatformLinux.GetGameUserPath : WideString; begin if FindCmdLineSwitch( cUseLocalPaths ) then - result := inherited + result := ExtractFilePath(ParamStr(0)) else result := get_homedir()+'/.UltraStarDeluxe/'; end; @@ -164,7 +164,7 @@ end; // Maybe this should be TPlatformBase.Halt() procedure TPlatformLinux.Halt; begin - application.terminate; + halt(); end; function TPlatformLinux.TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; @@ -182,7 +182,8 @@ var SR: TSearchRec; // for parsing song directory begin Result := ''; - if SysUtils.FindFirst(Dir + Mask, faDirectory, SR) = 0 then begin + if SysUtils.FindFirst(Dir + Mask, faDirectory, SR) = 0 then + begin Result := SR.Name; end; // if SysUtils.FindClose(SR); diff --git a/Game/Code/UltraStarDeluxe.control b/Game/Code/UltraStarDeluxe.control index cfbbfc13..f85408f1 100644 --- a/Game/Code/UltraStarDeluxe.control +++ b/Game/Code/UltraStarDeluxe.control @@ -1,7 +1,7 @@ Package: UltraStar-Deluxe Priority: optional Section: games -Installed-Size: 45 +Installed-Size: 18400 Maintainer: Jay Binks Architecture: i386 Version: 1.1.1 diff --git a/Game/Code/linux-build.sh b/Game/Code/linux-build.sh index 54938479..7a1b82a2 100755 --- a/Game/Code/linux-build.sh +++ b/Game/Code/linux-build.sh @@ -1,4 +1,6 @@ -clear -fpc -S2cgi -OG1 -gl -vewnhi -l -Filib/JEDI-SDLv1.0/SDL/Pas/ -Fu/usr/bin/lazarus/components/images/lib/i386-linux/ -Fu/usr/bin/lazarus/lcl/units/i386-linux/ -Fu/usr/bin/lazarus/lcl/units/i386-linux/gtk2/ -Fu/usr/bin/lazarus/packager/units/i386-linux/ -Fu. -oUltraStar -dLCL -dLCLgtk2 UltraStar.lpr -mv ./UltraStar /home/jay/src/ultrastardx/output/ +fpc -S2cgi -OG1 -gl -vewnhi -l -Filib/JEDI-SDLv1.0/SDL/Pas/ -Fu/usr/share/lazarus/components/images/lib/i386-linux/ -Fu/usr/share/lazarus/lcl/units/i386-linux/ -Fu/usr/share/lazarus/lcl/units/i386-linux/gtk2/ -Fu/usr/share/lazarus/packager/units/i386-linux/ -Fu. -oUltraStar -dLCL -dLCLgtk2 UltraStar.lpr + +cp ./UltraStar ../../../output/ + + diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index d89e89b3..fc21a373 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -1,70 +1,72 @@ -{$DEFINE DEBUG} // to-do : Remove b4 release - -// Comment by eddie: -// The mac port currently also uses the WIN32 define. -// Once I get the beast compiled, linked and running -// I will change this. -// There are some parts where the WIN32 define could not -// be used. I changed the WIN32 to MSWINDOWS. -// So, for Windows-only code use the MSWINDOWS define. - - -{$IFDEF FPC} - {$IFDEF DARWIN} - {$H+} - {$R-} - {$DEFINE WIN32} - {$DEFINE TRANSLATE} - {$DEFINE UTF8_FILENAMES} - {$ELSE} - {$DEFINE LAZARUS} - {$ENDIF} - -// {$MODE DELPHI} // JB - This is not allowed by the free pascal compiler for some reason ( At least on linux ) - - {$DEFINE DLL_CDECL} - {$UNDEF UseSerialPort} - {$UNDEF UseMIDIPort} -{$ELSE} - {$DEFINE Delphi} - {$DEFINE DLL_STDCALL} - {$UNDEF UseSerialPort} - {$DEFINE UseMIDIPort} -{$ENDIF} - - -{$IFDEF win32} - {$DEFINE UseBASSPlayback} - {$DEFINE UseBASSInput} - - //{$DEFINE UseFFMpegDecoder} - //{$DEFINE UsePortaudioPlayback} - //{$DEFINE UsePortaudioInput} - //{$DEFINE UsePortmixer} - - {$DEFINE UseProjectM_0_9} - //{$DEFINE UseProjectM_1_0} - - {$IFDEF DEBUG} - {$IFNDEF DARWIN} - {$APPTYPE CONSOLE} - {$ENDIF} - {$ENDIF} -{$ELSE} - {$DEFINE UseFFMpegAudio} - {$DEFINE UsePortaudio} - {$DEFINE UseProjectM_0_9} -{$ENDIF} - -{$IF Defined(UseBASSInput) or Defined(UseBASSPlayback)} - {$DEFINE UseBASS} -{$IFEND} - -{$IF Defined(UsePortaudioInput) or Defined(UsePortaudioPlayback)} - {$DEFINE UsePortaudio} -{$IFEND} - -{$IF Defined(UseProjectM_0_9) or Defined(UseProjectM_1_0)} - {$DEFINE UseProjectM} -{$IFEND} - +{$DEFINE DEBUG} // to-do : Remove b4 release + +// Comment by eddie: +// The mac port currently also uses the WIN32 define. +// Once I get the beast compiled, linked and running +// I will change this. +// There are some parts where the WIN32 define could not +// be used. I changed the WIN32 to MSWINDOWS. +// So, for Windows-only code use the MSWINDOWS define. + + +{$IFDEF FPC} + {$IFDEF DARWIN} + {$H+} + {$R-} + {$DEFINE WIN32} + {$DEFINE TRANSLATE} + {$DEFINE UTF8_FILENAMES} + {$ELSE} + {$DEFINE LAZARUS} + {$ENDIF} + + {$DEFINE DLL_CDECL} + {$UNDEF UseSerialPort} + {$UNDEF UseMIDIPort} +{$ELSE} + {$DEFINE Delphi} + {$DEFINE DLL_STDCALL} + {$UNDEF UseSerialPort} + {$DEFINE UseMIDIPort} +{$ENDIF} + + +{$IFDEF win32} + {$DEFINE UseBASSPlayback} + {$DEFINE UseBASSInput} + + //{$DEFINE UseFFMpegDecoder} + //{$DEFINE UsePortaudioPlayback} + //{$DEFINE UsePortaudioInput} + //{$DEFINE UsePortmixer} + + {$DEFINE UseProjectM_0_9} + //{$DEFINE UseProjectM_1_0} + + {$IFDEF DEBUG} + {$IFNDEF DARWIN} + {$APPTYPE CONSOLE} + {$ENDIF} + {$ENDIF} +{$ELSE} + {$DEFINE UseFFMpegAudio} + {$DEFINE UsePortaudio} + {$DEFINE UseProjectM_0_9} +{$ENDIF} + +{$IF Defined(UseBASSInput) or Defined(UseBASSPlayback)} + {$DEFINE UseBASS} +{$IFEND} + +{$IF Defined(UsePortaudioInput) or Defined(UsePortaudioPlayback)} + {$DEFINE UsePortaudio} +{$IFEND} + +{$IF Defined(UseProjectM_0_9) or Defined(UseProjectM_1_0)} + {$DEFINE UseProjectM} +{$IFEND} + +// I had to add these (jay)... but maybe henny has some way that the config script is meant to do this ? +// Ill need to check with him. +//{$DEFINE FPC_V220} +//{$DEFINE LAZARUS_V0924} -- cgit v1.2.3 From 7ad8d5e253f452bb8e208f75397d53beca5b3a49 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 5 Feb 2008 10:38:57 +0000 Subject: added Jedi-SDL to our SVN tree.. simplifies SVN checkout and build, and now that this version is well and truly deprecated, we should keep it here in case its removed. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@809 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/JEDI-SDLv1.0/JEDI-SDL-README.txt | 242 + Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/geometry.pas | 1994 ++++ Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/gl.pas | 2294 +++++ Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glext.pas | 8527 +++++++++++++++++ Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glu.pas | 563 ++ Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glut.pas | 682 ++ Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glx.pas | 276 + Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/opengl12.pas | 9967 ++++++++++++++++++++ Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/opengl12.rst | 26 + Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/Readme.txt | 27 + Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/jedi-sdl.inc | 337 + .../Code/lib/JEDI-SDLv1.0/SDL/Pas/libxmlparser.pas | 2690 ++++++ Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/logger.pas | 176 + .../Code/lib/JEDI-SDLv1.0/SDL/Pas/moduleloader.pas | 319 + .../SDL/Pas/registryuserpreferences.pas | 229 + Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdl.pas | 4118 ++++++++ Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdl_cpuinfo.pas | 155 + .../lib/JEDI-SDLv1.0/SDL/Pas/sdlgameinterface.pas | 195 + .../Code/lib/JEDI-SDLv1.0/SDL/Pas/sdli386utils.pas | 5236 ++++++++++ Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlinput.pas | 692 ++ Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlstreams.pas | 216 + Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlticks.pas | 196 + Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlutils.pas | 4256 +++++++++ Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlwindow.pas | 564 ++ .../lib/JEDI-SDLv1.0/SDL/Pas/userpreferences.pas | 159 + .../lib/JEDI-SDLv1.0/SDL_Image/Pas/sdl_image.pas | 287 + Game/Code/lib/JEDI-SDLv1.0/SDL_ttf/Pas/sdl_ttf.pas | 451 + .../JEDI-SDLv1.0/SDL_ttf/Pas/sdltruetypefont.pas | 437 + Game/Code/lib/JEDI-SDLv1.0/fpc-install.sh | 252 + Game/Code/lib/JEDI-SDLv1.0/placeholder.txt | 4 - 30 files changed, 45563 insertions(+), 4 deletions(-) create mode 100644 Game/Code/lib/JEDI-SDLv1.0/JEDI-SDL-README.txt create mode 100644 Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/geometry.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/gl.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glext.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glu.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glut.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glx.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/opengl12.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/opengl12.rst create mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/Readme.txt create mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/jedi-sdl.inc create mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/libxmlparser.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/logger.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/moduleloader.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/registryuserpreferences.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdl.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdl_cpuinfo.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlgameinterface.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdli386utils.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlinput.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlstreams.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlticks.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlutils.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlwindow.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/userpreferences.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL_Image/Pas/sdl_image.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL_ttf/Pas/sdl_ttf.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL_ttf/Pas/sdltruetypefont.pas create mode 100644 Game/Code/lib/JEDI-SDLv1.0/fpc-install.sh delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/placeholder.txt (limited to 'Game/Code') diff --git a/Game/Code/lib/JEDI-SDLv1.0/JEDI-SDL-README.txt b/Game/Code/lib/JEDI-SDLv1.0/JEDI-SDL-README.txt new file mode 100644 index 00000000..968c5311 --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/JEDI-SDL-README.txt @@ -0,0 +1,242 @@ +This is the based on the SDL ( http://www.libsdl.org ) headers, and has been converted, comments and all, to the Pascal unit called sdl.pas. +Other conversions that have also been done are SDL_Mixer.h, SDL_Net.h, SDL_Image.h, SDL_ttf, SMPEG.h, SDL_sound and the SFont library, +which are all included in this distribution. + +It allows you to access all the functions within the SDL libraries under Windows, Linux and FreeBSD, so you can write cross-platform games or multimedia applications. + +Installation Instructions +------------------------- +Windows - We now have a semi-automated setup under Windows ( thanks to David House and the Jedi JCL team ). + Once you have extracted the zip file, simply double click on the "JEDISDLWin32Installer.exe" to have the correct paths added to your respective + IDEs. All IDEs from Delphi 4 - 7 are supported and it also adds a link to the .CHM help file under the Tools menu. + +Linux - Alternatively if you use Linux or want to to manually install the paths, then make sure you read the "Getting Started.html" file ( ideal for those who are new to JEDI-SDL ) and is now included as a guide to help getting everything setup for smooth compilation. + +Also included is a guide of how to use Sourceforge using TortoiseCVS under Windows ( Linux guide is under development ). +Both documents can be found in the "documentation" directory. + + +Release History +--------------- +1.0 : Yeah!! The Official v1.0 Release of JEDI-SDL!! + JEDI-SDL now updated to SDL v1.2.8, SDL_Image v1.2.4, SDL_Mixer v1.2.6, SDL_Net v1.2.1 & SDL_ttf v2.0.7 + Added Improved FreePascal, TMT Pascal and GnuPascal support as well as maintaining Delphi/Kylix support. + Fixed Various bugs as pointed out on the JEDI-SDL mailing list. + Added SDL_GL_STEREO, SDL_GL_MULTISAMPLEBUFFERS, SDL_GL_MULTISAMPLESAMPLES + +// DLL/Shared object functions +function SDL_LoadObject( const sofile : PChar ) : Pointer; + +function SDL_LoadFunction( handle : Pointer; const name : PChar ) : Pointer; + +procedure SDL_UnloadObject( handle : Pointer ); + +//Added function to create RWops from const memory: SDL_RWFromConstMem() +function SDL_RWFromConstMem(const mem: Pointer; size: Integer) : PSDL_RWops; + +//Added support for environment variables SDL_VIDEO_WINDOW_POS and SDL_VIDEO_CENTERED on Windows + + New Units : + ----------- + sdl_cpuinfo.pas - ported SDL_cpuinfo.h so Now you can test for Specific CPU types. + sdlinput.pas - Input wrapper class + sdlwindow.pas - Window wrapper class + sdltruetypefont.pas - True Type Font wrapper class + tcputils.pas - SDL_Net utility functions + sdlweb.pas - SDL_Net Web class + sdlwebhttp.pas - SDL_Net http protocol wrapper class + sdlwebftp.pas - SDL_Net ftp protocol wrapper class + + New 2D Demos : + -------------- + + + New 3D Demos : + -------------- + + + Other New Stuff : + ----------------- + + + +0.5 : The JEDI-SDL project is now also set up on Sourceforge ( http://sf.net/projects/jedi-sdl/ ) so the latest code is available from there. + Improved FreePascal support has been added. + Various bug fixes as pointed out on the JEDI-SDL mailing list. + SDL_Mixer has been updated to version 1.2.1 and includes an Effects API. + Demo directories are now split into 2D and 3D related sub-directories. + There are now both Kylix ( K prefix ) and Delphi ( D prefix ) project groups for all the demos. + They can be found in Demos and the 2D and 3D directories. + + New Units + --------- + SDLStreams.pas - Chris Bruner has created a wrapper that uses Streams to load BMPs + SDLUtils.pas - Pascal only version of some Utility functions + SDLi386Utils.pas - Intel Assembler versions of the SDLUtils.pas functions. + SDL_ttf.pas - Port of the SDL True Type font support unit. + SDL_Sound.pas - Port of the SDL Sound library ( untested ). + + New 2D Demos : + -------------- + Pan and Zoom Demo - How to Pan and Zoom an SDL surface. + Isometric Demo - I ported my old DelphiX isometric demo over to SDL. + TestTimer demo - Shows hows how to use AddTimer and RemoveTimer. + MpegPlayer - I have updated and improved Anders Ohlsson's CLX MPegPlayer and component and it now works + and installs into D4, D5, D6, D7, K1, K2 & K3. + Showfont - Demo to show how to us SDL_ttf.dll + SmpegPlayer - is a console MPEG player that use smpeg and SDL_Mixer + + New 3D Demos : + -------------- + DeathTruckTion 1.1 - A slightly updated version of this fully functional 3D network game. + TerrainDemo - Terrain demo ported from the book "OpenGL Game programming" by Hawkins and Astle. + TestGL - the standard SDL/OpenGL Test demo. Shows how to mix 2D and 3D rendering using OpenGL. + glfont - Demo to show how to us SDL_ttf with OpenGL. + Particle Engine - Ariel's OpenGL Particle Engine. + Picking - Phil Freeman's Picking Demo + Motion Blur - Phil Freeman's Motion Blur Demo + Dynamic Light - Phil Freeman's Dynamic Light Demo + Environment Map - Phil Freeman's Environment Map Demo + GLMovie - is an MPEG Player that uses OpenGL to render the movie. + NeHe - Quite a few more NeHe demos are now included. + + New Network Demos : + ------------------- + There are now 3 SDL_Net Server demos and 4 SDL_Client demos as submitted by Dean Ellis. + + +Beta 4 : The JEDI-SDL home page is now located @ http://www.delphi-jedi.org/Jedi:TEAM_SDL_HOME + All Demos ( including OpenGL Demos ) now compile under both Kylix and Delphi. + I have added quite a few more OpenGL examples, we are now up to Nehe tutorial 12. + All OpenGL demos also show how to handle Window resizing. + Included an OpenGL demo called Puntos by Gustavo Maximo. + Ported Jan Horn's OpenGL MetaBalls and also SkyBox demo to SDL. + Ported Ilkka Tuomioja's OpenGL Quake 2 Model Viewer/Animator to SDL. + NOTE : All OpenGL demos require OpenGL12.pas which can be found at... + http://www.lischke-online.de/Graphics.html#OpenGL12 + I also fixed a conversion bug to do with SDL_MustLock and also a conversion omission to do with various events. + Fixed a conversion bug with SDL_CDOpen ( as suggested on the mailing list ). + Added the GetPixel and PuxPixel functions to the SDLUtils.pas file. + Jason Farmer has donated SFont, a simple, yet effective Font library he converted for JEDI-SDL. + It contains 4 Demos show how to best use it. + Added TUInt8Array and PUIntArray to SDL.pas after suggestions from Matthias Thoma and Eric Grange. + In the file area of the JEDI-SDL mailing list ( http://groups.yahoo.com/group/JEDI-SDL/files/DTTSrc/ there + is a fully functional 3D network game called DeathTruckTion v1.0 written by the TNTeam that makes use of + JEDI-SDL and is just too big to include with this distribution but is well worth looking at as it works under Windows and Linux! + Gustavo Maxima is working on translating the JEDI-SDL Documentation to Spanish and Portugese. + The Mouse Demo has now been speeded up considerably and it is very responsive now. + Dean Ellis will provide steps on how to compile the demos using the Free Pascal compiler. + Jason Farmer and I are working on a series of Tutorials that should hopefully be out soon. + David Aclan has donated a SMpeg component that should work under Kylix. + Róbert Kisnémeth, has been hard at work, and has donated some new demos he has created with a SpriteEngine ( which he also donated ). + He has also donated a couple of games called BlitzBomber and Oxygene ( which uses the SpriteEngine ) and added a couple of useful + functions to SDLUtils.pas. + The Functions added are SDL_FlipV, SDL_FlipH, SDL_NewPutPixel ( assembler version ), SDL_AddPixel, SDL_SubPixel, SDL_DrawLine, SDL_AddLine, + SDL_SubLine, SDL_AddSurface, SDL_SubSurface, SDL_MonoSurface & SDL_TexturedSurface. + He has also donated a Font Blitting class and demo called SDL_MonoFonts which supports alignment like Left, Right and Center. + He and Thomas are also working on a GUI library. + Jason Farmer has donated a set of Image Filtering functions which add quite a few interesting effects. Check the SDL_Filter sub-directory for more + info. + Christian Hackbart also donated an OpenGL BlockOut clone. + + +Beta 3 : I have added conversions for SDL_env.h, SDL_Mixer.h and SDL_Net.h while Matthias Thoma has added conversions for SDL_Image.h and SMPEG.h. + This version is also SDL version 1.2.0 compliant. + This release also adds demos for the SDL_Image, SDL_Mixer and SDL_Net libraries. + There are now also some OpenGL demos that make some use of SDL as well as a demo on how to use the Mouse with Clickable regions. + A conversion bug, that was pointed out by Clem Vasseur, has also been fixed. + There is now a mailing list that has been set up at http://groups.yahoo.com/group/JEDI-SDL/join/ so we can all learn from each other how to use + these libraries. + Demos have not been unified into single .dpr files for each demo, thus showing how you would write a crossplatform game using only 1 .dpr file. + There is also a documentation directory that is currently in HTML format. All code examples in the documentation have been converted to Object + Pascal but are untested. + I Also fixed a few conversion bugs which I came across while converting the documentation. + +Beta 2 : I have added conversions for SDL_active.h, SDL_thread.h, SDL_mutex.h and + SDL_error.h, Matthias Thoma has added Linux Support and JEDI compliancy so these + units and examples are now x-platform and x-compiler compilable. + I also added Tom Jones' SDLUtils.pas file; + Matthias also cleaned up the 2 new demos and made them work on both Linux and + Windows. + +Beta 1 : Initial Release; + + +There are now 5 examples included with this JEDI-SDL distribution. +1. Is the TestWin application, which is based on the testwin application that comes with the SDL SDK, only my version has a gui front end to the options available and has been compiled under Delphi 4.03. It should be compatible with Delphi 3.0 onwards ( though Delphi 2 compatibility has not been tested ). + +2. A Plasma example which was converted from one found on the Demos page of the SDL site. + +3. A Voxel terrain following demo, which was converted from one found on the Demos page of the SDL site. This one should be of interest to others as it shows how to handle keyboard events when using SDL. + +4. A Mouse handling demo that shows how to use transparency and clickable regions. + +5. A Space Invaders style game called Aliens which shows the use of SDL, SDL_Image and SDL_Mixer. This game shows how to handle sound, keyboards and some basic collision detection. It is a conversion of one found on the SDL Demos page. + +There are also 14 OpenGL demos that are based on the NeHe tutorials . The other 3 OpenGL demos are Jan Horns' OpenGL demo, A Quake 2 Model viewer that I ported and a Demo by Gustavo Maxima called Puntos. + +If writing your own, just make sure that the SDL.pas file is in your projects path for compiling and that the SDL.dll file is in your path when running the compiled app. + +Please test these units and report problems to the JEDI-SDL mailing list @ http://groups.yahoo.com/group/JEDI-SDL/ outlining steps under which the error occurred. If you convert any more demos please send them to me so that I can +include them in the ditribution for others to learn from. + +Also if you are using these Units to write any games +please let me know about it so that I can post the information to the http://www.DelphiGamer.com site. + +The plan is to have this unit JEDI certified at some point so that it can be included on the Delphi and Kylix CDs, so all feedback is greatly welcomed. + +Compilers supported Tested +------------------- ------ +Delphi Yes +Kylix Yes +FreePascal Yes +TMT Pascal compiler Not Yet. +Virtual Pascal No +Gnu Pascal No + + + +Credits +------- +Matthias Thoma for is endless help with my conversion bugs. +Jason Farmer for donating the SFont Font Library. +Gustavo Maximo for the Puntos OpenGL Demo and work he is doing on the documentation +Róbert Kisnémeth for his numerous contributions +Chris Bruner for testing under Kylix +August Logan Bear Jr. for testing under Kylix +Dean Ellis for FreePascal Compiler compatability testing and SDL_Net demos and testing +David House for Windows Insaller and testing. +Romi Kuntsman for helping out on some OpenGL issues. +Everyone on the JEDI-SDL mailing list for their feedback and support. +Everyone on the Delphi-JEDI mailing for answering my conversion questions. +Tom Jones for inspiring this conversion. + +The JEDI-SDL Home page can be found @ http://www.delphi-jedi.org/Jedi:TEAM_SDL_HOME + +The JEDI-SDL source code archive can be found @ http://www.sf.net/projects/jedi-sdl/ + +The JEDI-SDL mailing list can be found @ http://groups.yahoo.com/group/JEDI-SDL/join/ + +The Latest Stable Release version of the JEDI-SDL.zip file can always be found on the Delphi-JEDI site + +The Latest Alpha/Unstable version can always be grabbed from the SourceForge CVS http://sourceforge.net/cvs/?group_id=43805 + + +Sincerely, + + + +Dominique Louis +Delphi Game Developer. +********************************************************* +** To Do Nothing is to Collaborate with the oppressor ** +** -------------------------------------------------- ** +********************************************************* +========================================================= +From . . . . . . . : Dominique Louis +Email. . . . . . . : Dominique@SavageSoftware.com.au +Company. . . . . . : Savage Software Solutions +Delphi Games Site. : http://www.DelphiGamer.com +Delphi JEDI Site . : http://www.delphi-jedi.org +========================================================= + diff --git a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/geometry.pas b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/geometry.pas new file mode 100644 index 00000000..15783515 --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/geometry.pas @@ -0,0 +1,1994 @@ +unit geometry; +{ + $Id: geometry.pas,v 1.1 2004/03/30 21:53:54 savage Exp $ + +} + +// This unit contains many needed types, functions and procedures for +// quaternion, vector and matrix arithmetics. It is specifically designed +// for geometric calculations within R3 (affine vector space) +// and R4 (homogeneous vector space). +// +// Note: The terms 'affine' or 'affine coordinates' are not really correct here +// because an 'affine transformation' describes generally a transformation which leads +// to a uniquely solvable system of equations and has nothing to do with the dimensionality +// of a vector. One could use 'projective coordinates' but this is also not really correct +// and since I haven't found a better name (or even any correct one), 'affine' is as good +// as any other one. +// +// Identifiers containing no dimensionality (like affine or homogeneous) +// and no datatype (integer..extended) are supposed as R4 representation +// with 'single' floating point type (examples are TVector, TMatrix, +// and TQuaternion). The default data type is 'single' ('GLFloat' for OpenGL) +// and used in all routines (except conversions and trigonometric functions). +// +// Routines with an open array as argument can either take Func([1,2,3,4,..]) or Func(Vect). +// The latter is prefered, since no extra stack operations is required. +// Note: Be careful while passing open array elements! If you pass more elements +// than there's room in the result the behaviour will be unpredictable. +// +// If not otherwise stated, all angles are given in radians +// (instead of degrees). Use RadToDeg or DegToRad to convert between them. +// +// Geometry.pas was assembled from different sources (like GraphicGems) +// and relevant books or based on self written code, respectivly. +// +// Note: Some aspects need to be considered when using Delphi and pure +// assembler code. Delphi ensures that the direction flag is always +// cleared while entering a function and expects it cleared on return. +// This is in particular important in routines with (CPU) string commands (MOVSD etc.) +// The registers EDI, ESI and EBX (as well as the stack management +// registers EBP and ESP) must not be changed! EAX, ECX and EDX are +// freely available and mostly used for parameter. +// +// Version 2.5 +// last change : 04. January 2000 +// +// (c) Copyright 1999, Dipl. Ing. Mike Lischke (public@lischke-online.de) +{ + $Log: geometry.pas,v $ + Revision 1.1 2004/03/30 21:53:54 savage + Moved to it's own folder. + + Revision 1.1 2004/02/05 00:08:19 savage + Module 1.0 release + + +} + +interface + +{$I jedi-sdl.inc} + +type + // data types needed for 3D graphics calculation, + // included are 'C like' aliases for each type (to be + // conformal with OpenGL types) + + PByte = ^Byte; + PWord = ^Word; + PInteger = ^Integer; + PFloat = ^Single; + PDouble = ^Double; + PExtended = ^Extended; + PPointer = ^Pointer; + + // types to specify continous streams of a specific type + // switch off range checking to access values beyond the limits + PByteVector = ^TByteVector; + PByteArray = PByteVector; + TByteVector = array[0..0] of Byte; + + PWordVector = ^TWordVector; + PWordArray = PWordVector; // note: there's a same named type in SysUtils + TWordVector = array[0..0] of Word; + + PIntegerVector = ^TIntegerVector; + PIntegerArray = PIntegerVector; + TIntegerVector = array[0..0] of Integer; + + PFloatVector = ^TFloatVector; + PFloatArray = PFloatVector; + TFloatVector = array[0..0] of Single; + + PDoubleVector = ^TDoubleVector; + PDoubleArray = PDoubleVector; + TDoubleVector = array[0..0] of Double; + + PExtendedVector = ^TExtendedVector; + PExtendedArray = PExtendedVector; + TExtendedVector = array[0..0] of Extended; + + PPointerVector = ^TPointerVector; + PPointerArray = PPointerVector; + TPointerVector = array[0..0] of Pointer; + + PCardinalVector = ^TCardinalVector; + PCardinalArray = PCardinalVector; + TCardinalVector = array[0..0] of Cardinal; + + // common vector and matrix types with predefined limits + // indices correspond like: x -> 0 + // y -> 1 + // z -> 2 + // w -> 3 + + PHomogeneousByteVector = ^THomogeneousByteVector; + THomogeneousByteVector = array[0..3] of Byte; + TVector4b = THomogeneousByteVector; + + PHomogeneousWordVector = ^THomogeneousWordVector; + THomogeneousWordVector = array[0..3] of Word; + TVector4w = THomogeneousWordVector; + + PHomogeneousIntVector = ^THomogeneousIntVector; + THomogeneousIntVector = array[0..3] of Integer; + TVector4i = THomogeneousIntVector; + + PHomogeneousFltVector = ^THomogeneousFltVector; + THomogeneousFltVector = array[0..3] of Single; + TVector4f = THomogeneousFltVector; + + PHomogeneousDblVector = ^THomogeneousDblVector; + THomogeneousDblVector = array[0..3] of Double; + TVector4d = THomogeneousDblVector; + + PHomogeneousExtVector = ^THomogeneousExtVector; + THomogeneousExtVector = array[0..3] of Extended; + TVector4e = THomogeneousExtVector; + + PHomogeneousPtrVector = ^THomogeneousPtrVector; + THomogeneousPtrVector = array[0..3] of Pointer; + TVector4p = THomogeneousPtrVector; + + PAffineByteVector = ^TAffineByteVector; + TAffineByteVector = array[0..2] of Byte; + TVector3b = TAffineByteVector; + + PAffineWordVector = ^TAffineWordVector; + TAffineWordVector = array[0..2] of Word; + TVector3w = TAffineWordVector; + + PAffineIntVector = ^TAffineIntVector; + TAffineIntVector = array[0..2] of Integer; + TVector3i = TAffineIntVector; + + PAffineFltVector = ^TAffineFltVector; + TAffineFltVector = array[0..2] of Single; + TVector3f = TAffineFltVector; + + PAffineDblVector = ^TAffineDblVector; + TAffineDblVector = array[0..2] of Double; + TVector3d = TAffineDblVector; + + PAffineExtVector = ^TAffineExtVector; + TAffineExtVector = array[0..2] of Extended; + TVector3e = TAffineExtVector; + + PAffinePtrVector = ^TAffinePtrVector; + TAffinePtrVector = array[0..2] of Pointer; + TVector3p = TAffinePtrVector; + + // some simplified names + PVector = ^TVector; + TVector = THomogeneousFltVector; + + PHomogeneousVector = ^THomogeneousVector; + THomogeneousVector = THomogeneousFltVector; + + PAffineVector = ^TAffineVector; + TAffineVector = TAffineFltVector; + + // arrays of vectors + PVectorArray = ^TVectorArray; + TVectorArray = array[0..0] of TAffineVector; + + // matrices + THomogeneousByteMatrix = array[0..3] of THomogeneousByteVector; + TMatrix4b = THomogeneousByteMatrix; + + THomogeneousWordMatrix = array[0..3] of THomogeneousWordVector; + TMatrix4w = THomogeneousWordMatrix; + + THomogeneousIntMatrix = array[0..3] of THomogeneousIntVector; + TMatrix4i = THomogeneousIntMatrix; + + THomogeneousFltMatrix = array[0..3] of THomogeneousFltVector; + TMatrix4f = THomogeneousFltMatrix; + + THomogeneousDblMatrix = array[0..3] of THomogeneousDblVector; + TMatrix4d = THomogeneousDblMatrix; + + THomogeneousExtMatrix = array[0..3] of THomogeneousExtVector; + TMatrix4e = THomogeneousExtMatrix; + + TAffineByteMatrix = array[0..2] of TAffineByteVector; + TMatrix3b = TAffineByteMatrix; + + TAffineWordMatrix = array[0..2] of TAffineWordVector; + TMatrix3w = TAffineWordMatrix; + + TAffineIntMatrix = array[0..2] of TAffineIntVector; + TMatrix3i = TAffineIntMatrix; + + TAffineFltMatrix = array[0..2] of TAffineFltVector; + TMatrix3f = TAffineFltMatrix; + + TAffineDblMatrix = array[0..2] of TAffineDblVector; + TMatrix3d = TAffineDblMatrix; + + TAffineExtMatrix = array[0..2] of TAffineExtVector; + TMatrix3e = TAffineExtMatrix; + + // some simplified names + PMatrix = ^TMatrix; + TMatrix = THomogeneousFltMatrix; + + PHomogeneousMatrix = ^THomogeneousMatrix; + THomogeneousMatrix = THomogeneousFltMatrix; + + PAffineMatrix = ^TAffineMatrix; + TAffineMatrix = TAffineFltMatrix; + + // q = ([x, y, z], w) + TQuaternion = record + case Integer of + 0: + (ImagPart: TAffineVector; + RealPart: Single); + 1: + (Vector: TVector4f); + end; + + TRectangle = record + Left, + Top, + Width, + Height: Integer; + end; + + TTransType = (ttScaleX, ttScaleY, ttScaleZ, + ttShearXY, ttShearXZ, ttShearYZ, + ttRotateX, ttRotateY, ttRotateZ, + ttTranslateX, ttTranslateY, ttTranslateZ, + ttPerspectiveX, ttPerspectiveY, ttPerspectiveZ, ttPerspectiveW); + + // used to describe a sequence of transformations in following order: + // [Sx][Sy][Sz][ShearXY][ShearXZ][ShearZY][Rx][Ry][Rz][Tx][Ty][Tz][P(x,y,z,w)] + // constants are declared for easier access (see MatrixDecompose below) + TTransformations = array[TTransType] of Single; + + +const + // useful constants + + // standard vectors + XVector: TAffineVector = (1, 0, 0); + YVector: TAffineVector = (0, 1, 0); + ZVector: TAffineVector = (0, 0, 1); + NullVector: TAffineVector = (0, 0, 0); + + IdentityMatrix: TMatrix = ((1, 0, 0, 0), + (0, 1, 0, 0), + (0, 0, 1, 0), + (0, 0, 0, 1)); + EmptyMatrix: TMatrix = ((0, 0, 0, 0), + (0, 0, 0, 0), + (0, 0, 0, 0), + (0, 0, 0, 0)); + // some very small numbers + EPSILON = 1e-100; + EPSILON2 = 1e-50; + +//---------------------------------------------------------------------------------------------------------------------- + +// vector functions +function VectorAdd(V1, V2: TVector): TVector; +function VectorAffineAdd(V1, V2: TAffineVector): TAffineVector; +function VectorAffineCombine(V1, V2: TAffineVector; F1, F2: Single): TAffineVector; +function VectorAffineDotProduct(V1, V2: TAffineVector): Single; +function VectorAffineLerp(V1, V2: TAffineVector; t: Single): TAffineVector; +function VectorAffineSubtract(V1, V2: TAffineVector): TAffineVector; +function VectorAngle(V1, V2: TAffineVector): Single; +function VectorCombine(V1, V2: TVector; F1, F2: Single): TVector; +function VectorCrossProduct(V1, V2: TAffineVector): TAffineVector; +function VectorDotProduct(V1, V2: TVector): Single; +function VectorLength(V: array of Single): Single; +function VectorLerp(V1, V2: TVector; t: Single): TVector; +procedure VectorNegate(V: array of Single); +function VectorNorm(V: array of Single): Single; +function VectorNormalize(V: array of Single): Single; +function VectorPerpendicular(V, N: TAffineVector): TAffineVector; +function VectorReflect(V, N: TAffineVector): TAffineVector; +procedure VectorRotate(var Vector: TVector4f; Axis: TVector3f; Angle: Single); +procedure VectorScale(V: array of Single; Factor: Single); +function VectorSubtract(V1, V2: TVector): TVector; + +// matrix functions +function CreateRotationMatrixX(Sine, Cosine: Single): TMatrix; +function CreateRotationMatrixY(Sine, Cosine: Single): TMatrix; +function CreateRotationMatrixZ(Sine, Cosine: Single): TMatrix; +function CreateScaleMatrix(V: TAffineVector): TMatrix; +function CreateTranslationMatrix(V: TVector): TMatrix; +procedure MatrixAdjoint(var M: TMatrix); +function MatrixAffineDeterminant(M: TAffineMatrix): Single; +procedure MatrixAffineTranspose(var M: TAffineMatrix); +function MatrixDeterminant(M: TMatrix): Single; +procedure MatrixInvert(var M: TMatrix); +function MatrixMultiply(M1, M2: TMatrix): TMatrix; +procedure MatrixScale(var M: TMatrix; Factor: Single); +procedure MatrixTranspose(var M: TMatrix); + +// quaternion functions +function QuaternionConjugate(Q: TQuaternion): TQuaternion; +function QuaternionFromPoints(V1, V2: TAffineVector): TQuaternion; +function QuaternionMultiply(qL, qR: TQuaternion): TQuaternion; +function QuaternionSlerp(QStart, QEnd: TQuaternion; Spin: Integer; t: Single): TQuaternion; +function QuaternionToMatrix(Q: TQuaternion): TMatrix; +procedure QuaternionToPoints(Q: TQuaternion; var ArcFrom, ArcTo: TAffineVector); + +// mixed functions +function ConvertRotation(Angles: TAffineVector): TVector; +function CreateRotationMatrix(Axis: TVector3f; Angle: Single): TMatrix; +function MatrixDecompose(M: TMatrix; var Tran: TTransformations): Boolean; +function VectorAffineTransform(V: TAffineVector; M: TAffineMatrix): TAffineVector; +function VectorTransform(V: TVector4f; M: TMatrix): TVector4f; overload; +function VectorTransform(V: TVector3f; M: TMatrix): TVector3f; overload; + +// miscellaneous functions +function MakeAffineDblVector(V: array of Double): TAffineDblVector; +function MakeDblVector(V: array of Double): THomogeneousDblVector; +function MakeAffineVector(V: array of Single): TAffineVector; +function MakeQuaternion(Imag: array of Single; Real: Single): TQuaternion; +function MakeVector(V: array of Single): TVector; +function PointInPolygon(xp, yp : array of Single; x, y: Single): Boolean; +function VectorAffineDblToFlt(V: TAffineDblVector): TAffineVector; +function VectorDblToFlt(V: THomogeneousDblVector): THomogeneousVector; +function VectorAffineFltToDbl(V: TAffineVector): TAffineDblVector; +function VectorFltToDbl(V: TVector): THomogeneousDblVector; + +// trigonometric functions +function ArcCos(X: Extended): Extended; +function ArcSin(X: Extended): Extended; +function ArcTan2(Y, X: Extended): Extended; +function CoTan(X: Extended): Extended; +function DegToRad(Degrees: Extended): Extended; +function RadToDeg(Radians: Extended): Extended; +procedure SinCos(Theta: Extended; var Sin, Cos: Extended); +function Tan(X: Extended): Extended; + +// coordinate system manipulation functions +function Turn(Matrix: TMatrix; Angle: Single): TMatrix; overload; +function Turn(Matrix: TMatrix; MasterUp: TAffineVector; Angle: Single): TMatrix; overload; +function Pitch(Matrix: TMatrix; Angle: Single): TMatrix; overload; +function Pitch(Matrix: TMatrix; MasterRight: TAffineVector; Angle: Single): TMatrix; overload; +function Roll(Matrix: TMatrix; Angle: Single): TMatrix; overload; +function Roll(Matrix: TMatrix; MasterDirection: TAffineVector; Angle: Single): TMatrix; overload; + +//---------------------------------------------------------------------------------------------------------------------- + +implementation + +const + // FPU status flags (high order byte) + C0 = 1; + C1 = 2; + C2 = 4; + C3 = $40; + + // to be used as descriptive indices + X = 0; + Y = 1; + Z = 2; + W = 3; + +//----------------- trigonometric helper functions --------------------------------------------------------------------- + +function DegToRad(Degrees: Extended): Extended; + +begin + Result := Degrees * (PI / 180); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function RadToDeg(Radians: Extended): Extended; + +begin + Result := Radians * (180 / PI); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure SinCos(Theta: Extended; var Sin, Cos: Extended); assembler; register; + +// calculates sine and cosine from the given angle Theta +// EAX contains address of Sin +// EDX contains address of Cos +// Theta is passed over the stack + +asm + FLD Theta + FSINCOS + FSTP TBYTE PTR [EDX] // cosine + FSTP TBYTE PTR [EAX] // sine + FWAIT +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function ArcCos(X: Extended): Extended; + +begin + Result := ArcTan2(Sqrt(1 - X * X), X); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function ArcSin(X: Extended): Extended; + +begin + Result := ArcTan2(X, Sqrt(1 - X * X)) +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function ArcTan2(Y, X: Extended): Extended; + +asm + FLD Y + FLD X + FPATAN + FWAIT +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function Tan(X: Extended): Extended; + +asm + FLD X + FPTAN + FSTP ST(0) // FPTAN pushes 1.0 after result + FWAIT +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function CoTan(X: Extended): Extended; + +asm + FLD X + FPTAN + FDIVRP + FWAIT +end; + +//----------------- miscellaneous vector functions --------------------------------------------------------------------- + +function MakeAffineDblVector(V: array of Double): TAffineDblVector; assembler; + +// creates a vector from given values +// EAX contains address of V +// ECX contains address to result vector +// EDX contains highest index of V + +asm + PUSH EDI + PUSH ESI + MOV EDI, ECX + MOV ESI, EAX + MOV ECX, EDX + ADD ECX, 2 + REP MOVSD + POP ESI + POP EDI +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function MakeDblVector(V: array of Double): THomogeneousDblVector; assembler; + +// creates a vector from given values +// EAX contains address of V +// ECX contains address to result vector +// EDX contains highest index of V + +asm + PUSH EDI + PUSH ESI + MOV EDI, ECX + MOV ESI, EAX + MOV ECX, EDX + ADD ECX, 2 + REP MOVSD + POP ESI + POP EDI +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function MakeAffineVector(V: array of Single): TAffineVector; assembler; + +// creates a vector from given values +// EAX contains address of V +// ECX contains address to result vector +// EDX contains highest index of V + +asm + PUSH EDI + PUSH ESI + MOV EDI, ECX + MOV ESI, EAX + MOV ECX, EDX + INC ECX + CMP ECX, 3 + JB @@1 + MOV ECX, 3 +@@1: REP MOVSD // copy given values + MOV ECX, 2 + SUB ECX, EDX // determine missing entries + JS @@Finish + XOR EAX, EAX + REP STOSD // set remaining fields to 0 +@@Finish: POP ESI + POP EDI +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function MakeQuaternion(Imag: array of Single; Real: Single): TQuaternion; assembler; + +// creates a quaternion from the given values +// EAX contains address of Imag +// ECX contains address to result vector +// EDX contains highest index of Imag +// Real part is passed on the stack + +asm + PUSH EDI + PUSH ESI + MOV EDI, ECX + MOV ESI, EAX + MOV ECX, EDX + INC ECX + REP MOVSD + MOV EAX, [Real] + MOV [EDI], EAX + POP ESI + POP EDI +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function MakeVector(V: array of Single): TVector; assembler; + +// creates a vector from given values +// EAX contains address of V +// ECX contains address to result vector +// EDX contains highest index of V + +asm + PUSH EDI + PUSH ESI + MOV EDI, ECX + MOV ESI, EAX + MOV ECX, EDX + INC ECX + CMP ECX, 4 + JB @@1 + MOV ECX, 4 +@@1: REP MOVSD // copy given values + MOV ECX, 3 + SUB ECX, EDX // determine missing entries + JS @@Finish + XOR EAX, EAX + REP STOSD // set remaining fields to 0 +@@Finish: POP ESI + POP EDI +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorLength(V: array of Single): Single; assembler; + +// calculates the length of a vector following the equation: sqrt(x * x + y * y + ...) +// Note: The parameter of this function is declared as open array. Thus +// there's no restriction about the number of the components of the vector. +// +// EAX contains address of V +// EDX contains the highest index of V +// the result is returned in ST(0) + +asm + FLDZ // initialize sum +@@Loop: FLD DWORD PTR [EAX + 4 * EDX] // load a component + FMUL ST, ST + FADDP + SUB EDX, 1 + JNL @@Loop + FSQRT +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorAngle(V1, V2: TAffineVector): Single; assembler; + +// calculates the cosine of the angle between Vector1 and Vector2 +// Result = DotProduct(V1, V2) / (Length(V1) * Length(V2)) +// +// EAX contains address of Vector1 +// EDX contains address of Vector2 + +asm + FLD DWORD PTR [EAX] // V1[0] + FLD ST // double V1[0] + FMUL ST, ST // V1[0]^2 (prep. for divisor) + FLD DWORD PTR [EDX] // V2[0] + FMUL ST(2), ST // ST(2) := V1[0] * V2[0] + FMUL ST, ST // V2[0]^2 (prep. for divisor) + FLD DWORD PTR [EAX + 4] // V1[1] + FLD ST // double V1[1] + FMUL ST, ST // ST(0) := V1[1]^2 + FADDP ST(3), ST // ST(2) := V1[0]^2 + V1[1] * * 2 + FLD DWORD PTR [EDX + 4] // V2[1] + FMUL ST(1), ST // ST(1) := V1[1] * V2[1] + FMUL ST, ST // ST(0) := V2[1]^2 + FADDP ST(2), ST // ST(1) := V2[0]^2 + V2[1]^2 + FADDP ST(3), ST // ST(2) := V1[0] * V2[0] + V1[1] * V2[1] + FLD DWORD PTR [EAX + 8] // load V2[1] + FLD ST // same calcs go here + FMUL ST, ST // (compare above) + FADDP ST(3), ST + FLD DWORD PTR [EDX + 8] + FMUL ST(1), ST + FMUL ST, ST + FADDP ST(2), ST + FADDP ST(3), ST + FMULP // ST(0) := (V1[0]^2 + V1[1]^2 + V1[2]) * + // (V2[0]^2 + V2[1]^2 + V2[2]) + FSQRT // sqrt(ST(0)) + FDIVP // ST(0) := Result := ST(1) / ST(0) + // the result is expected in ST(0), if it's invalid, an error is raised +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorNorm(V: array of Single): Single; assembler; register; + +// calculates norm of a vector which is defined as norm = x * x + y * y + ... +// EAX contains address of V +// EDX contains highest index in V +// result is passed in ST(0) + +asm + FLDZ // initialize sum +@@Loop: FLD DWORD PTR [EAX + 4 * EDX] // load a component + FMUL ST, ST // make square + FADDP // add previous calculated sum + SUB EDX, 1 + JNL @@Loop +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorNormalize(V: array of Single): Single; assembler; register; + +// transforms a vector to unit length and return length +// EAX contains address of V +// EDX contains the highest index in V +// return former length of V in ST + +asm + PUSH EBX + MOV ECX, EDX // save size of V + CALL VectorLength // calculate length of vector + FTST // test if length = 0 + MOV EBX, EAX // save parameter address + FSTSW AX // get test result + TEST AH, C3 // check the test result + JNZ @@Finish + SUB EBX, 4 // simplyfied address calculation + INC ECX + FLD1 // calculate reciprocal of length + FDIV ST, ST(1) +@@1: FLD ST // double reciprocal + FMUL DWORD PTR [EBX + 4 * ECX] // scale component + WAIT + FSTP DWORD PTR [EBX + 4 * ECX] // store result + LOOP @@1 + FSTP ST // remove reciprocal from FPU stack +@@Finish: POP EBX +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorAffineSubtract(V1, V2: TAffineVector): TAffineVector; assembler; register; + +// returns v1 minus v2 +// EAX contains address of V1 +// EDX contains address of V2 +// ECX contains address of the result + +asm + {Result[X] := V1[X]-V2[X]; + Result[Y] := V1[Y]-V2[Y]; + Result[Z] := V1[Z]-V2[Z];} + + FLD DWORD PTR [EAX] + FSUB DWORD PTR [EDX] + FSTP DWORD PTR [ECX] + FLD DWORD PTR [EAX + 4] + FSUB DWORD PTR [EDX + 4] + FSTP DWORD PTR [ECX + 4] + FLD DWORD PTR [EAX + 8] + FSUB DWORD PTR [EDX + 8] + FSTP DWORD PTR [ECX + 8] +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorReflect(V, N: TAffineVector): TAffineVector; assembler; register; + +// reflects vector V against N (assumes N is normalized) +// EAX contains address of V +// EDX contains address of N +// ECX contains address of the result + +//var Dot : Single; + +asm + {Dot := VectorAffineDotProduct(V, N); + Result[X] := V[X]-2 * Dot * N[X]; + Result[Y] := V[Y]-2 * Dot * N[Y]; + Result[Z] := V[Z]-2 * Dot * N[Z];} + + CALL VectorAffineDotProduct // dot is now in ST(0) + FCHS // -dot + FADD ST, ST // -dot * 2 + FLD DWORD PTR [EDX] // ST := N[X] + FMUL ST, ST(1) // ST := -2 * dot * N[X] + FADD DWORD PTR[EAX] // ST := V[X] - 2 * dot * N[X] + FSTP DWORD PTR [ECX] // store result + FLD DWORD PTR [EDX + 4] // etc. + FMUL ST, ST(1) + FADD DWORD PTR[EAX + 4] + FSTP DWORD PTR [ECX + 4] + FLD DWORD PTR [EDX + 8] + FMUL ST, ST(1) + FADD DWORD PTR[EAX + 8] + FSTP DWORD PTR [ECX + 8] + FSTP ST // clean FPU stack +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure VectorRotate(var Vector: TVector4f; Axis: TVector3f; Angle: Single); + +// rotates Vector about Axis with Angle radiants + +var RotMatrix : TMatrix4f; + +begin + RotMatrix := CreateRotationMatrix(Axis, Angle); + Vector := VectorTransform(Vector, RotMatrix); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure VectorScale(V: array of Single; Factor: Single); assembler; register; + +// returns a vector scaled by a factor +// EAX contains address of V +// EDX contains highest index in V +// Factor is located on the stack + +asm + {for I := Low(V) to High(V) do V[I] := V[I] * Factor;} + + FLD DWORD PTR [Factor] // load factor +@@Loop: FLD DWORD PTR [EAX + 4 * EDX] // load a component + FMUL ST, ST(1) // multiply it with the factor + WAIT + FSTP DWORD PTR [EAX + 4 * EDX] // store the result + DEC EDX // do the entire array + JNS @@Loop + FSTP ST(0) // clean the FPU stack +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure VectorNegate(V: array of Single); assembler; register; + +// returns a negated vector +// EAX contains address of V +// EDX contains highest index in V + +asm + {V[X] := -V[X]; + V[Y] := -V[Y]; + V[Z] := -V[Z];} + +@@Loop: FLD DWORD PTR [EAX + 4 * EDX] + FCHS + WAIT + FSTP DWORD PTR [EAX + 4 * EDX] + DEC EDX + JNS @@Loop +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorAdd(V1, V2: TVector): TVector; register; + +// returns the sum of two vectors + +begin + Result[X] := V1[X] + V2[X]; + Result[Y] := V1[Y] + V2[Y]; + Result[Z] := V1[Z] + V2[Z]; + Result[W] := V1[W] + V2[W]; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorAffineAdd(V1, V2: TAffineVector): TAffineVector; register; + +// returns the sum of two vectors + +begin + Result[X] := V1[X] + V2[X]; + Result[Y] := V1[Y] + V2[Y]; + Result[Z] := V1[Z] + V2[Z]; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorSubtract(V1, V2: TVector): TVector; register; + +// returns the difference of two vectors + +begin + Result[X] := V1[X] - V2[X]; + Result[Y] := V1[Y] - V2[Y]; + Result[Z] := V1[Z] - V2[Z]; + Result[W] := V1[W] - V2[W]; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorDotProduct(V1, V2: TVector): Single; register; + +begin + Result := V1[X] * V2[X] + V1[Y] * V2[Y] + V1[Z] * V2[Z] + V1[W] * V2[W]; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorAffineDotProduct(V1, V2: TAffineVector): Single; assembler; register; + +// calculates the dot product between V1 and V2 +// EAX contains address of V1 +// EDX contains address of V2 +// result is stored in ST(0) + +asm + //Result := V1[X] * V2[X] + V1[Y] * V2[Y] + V1[Z] * V2[Z]; + + FLD DWORD PTR [EAX] + FMUL DWORD PTR [EDX] + FLD DWORD PTR [EAX + 4] + FMUL DWORD PTR [EDX + 4] + FADDP + FLD DWORD PTR [EAX + 8] + FMUL DWORD PTR [EDX + 8] + FADDP +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorCrossProduct(V1, V2: TAffineVector): TAffineVector; + +// calculates the cross product between vector 1 and 2, Temp is necessary because +// either V1 or V2 could also be the result vector +// +// EAX contains address of V1 +// EDX contains address of V2 +// ECX contains address of result + +var Temp: TAffineVector; + +asm + {Temp[X] := V1[Y] * V2[Z]-V1[Z] * V2[Y]; + Temp[Y] := V1[Z] * V2[X]-V1[X] * V2[Z]; + Temp[Z] := V1[X] * V2[Y]-V1[Y] * V2[X]; + Result := Temp;} + + PUSH EBX // save EBX, must be restored to original value + LEA EBX, [Temp] + FLD DWORD PTR [EDX + 8] // first load both vectors onto FPU register stack + FLD DWORD PTR [EDX + 4] + FLD DWORD PTR [EDX + 0] + FLD DWORD PTR [EAX + 8] + FLD DWORD PTR [EAX + 4] + FLD DWORD PTR [EAX + 0] + + FLD ST(1) // ST(0) := V1[Y] + FMUL ST, ST(6) // ST(0) := V1[Y] * V2[Z] + FLD ST(3) // ST(0) := V1[Z] + FMUL ST, ST(6) // ST(0) := V1[Z] * V2[Y] + FSUBP ST(1), ST // ST(0) := ST(1)-ST(0) + FSTP DWORD [EBX] // Temp[X] := ST(0) + FLD ST(2) // ST(0) := V1[Z] + FMUL ST, ST(4) // ST(0) := V1[Z] * V2[X] + FLD ST(1) // ST(0) := V1[X] + FMUL ST, ST(7) // ST(0) := V1[X] * V2[Z] + FSUBP ST(1), ST // ST(0) := ST(1)-ST(0) + FSTP DWORD [EBX + 4] // Temp[Y] := ST(0) + FLD ST // ST(0) := V1[X] + FMUL ST, ST(5) // ST(0) := V1[X] * V2[Y] + FLD ST(2) // ST(0) := V1[Y] + FMUL ST, ST(5) // ST(0) := V1[Y] * V2[X] + FSUBP ST(1), ST // ST(0) := ST(1)-ST(0) + FSTP DWORD [EBX + 8] // Temp[Z] := ST(0) + FSTP ST(0) // clear FPU register stack + FSTP ST(0) + FSTP ST(0) + FSTP ST(0) + FSTP ST(0) + FSTP ST(0) + MOV EAX, [EBX] // copy Temp to Result + MOV [ECX], EAX + MOV EAX, [EBX + 4] + MOV [ECX + 4], EAX + MOV EAX, [EBX + 8] + MOV [ECX + 8], EAX + POP EBX +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorPerpendicular(V, N: TAffineVector): TAffineVector; + +// calculates a vector perpendicular to N (N is assumed to be of unit length) +// subtract out any component parallel to N + +var Dot: Single; + +begin + Dot := VectorAffineDotProduct(V, N); + Result[X] := V[X]-Dot * N[X]; + Result[Y] := V[Y]-Dot * N[Y]; + Result[Z] := V[Z]-Dot * N[Z]; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorTransform(V: TVector4f; M: TMatrix): TVector4f; register; + +// transforms a homogeneous vector by multiplying it with a matrix + +var TV: TVector4f; + +begin + TV[X] := V[X] * M[X, X] + V[Y] * M[Y, X] + V[Z] * M[Z, X] + V[W] * M[W, X]; + TV[Y] := V[X] * M[X, Y] + V[Y] * M[Y, Y] + V[Z] * M[Z, Y] + V[W] * M[W, Y]; + TV[Z] := V[X] * M[X, Z] + V[Y] * M[Y, Z] + V[Z] * M[Z, Z] + V[W] * M[W, Z]; + TV[W] := V[X] * M[X, W] + V[Y] * M[Y, W] + V[Z] * M[Z, W] + V[W] * M[W, W]; + Result := TV +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorTransform(V: TVector3f; M: TMatrix): TVector3f; + +// transforms an affine vector by multiplying it with a (homogeneous) matrix + +var TV: TVector3f; + +begin + TV[X] := V[X] * M[X, X] + V[Y] * M[Y, X] + V[Z] * M[Z, X] + M[W, X]; + TV[Y] := V[X] * M[X, Y] + V[Y] * M[Y, Y] + V[Z] * M[Z, Y] + M[W, Y]; + TV[Z] := V[X] * M[X, Z] + V[Y] * M[Y, Z] + V[Z] * M[Z, Z] + M[W, Z]; + Result := TV; +end; + + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorAffineTransform(V: TAffineVector; M: TAffineMatrix): TAffineVector; register; + +// transforms an affine vector by multiplying it with a matrix + +var TV: TAffineVector; + +begin + TV[X] := V[X] * M[X, X] + V[Y] * M[Y, X] + V[Z] * M[Z, X]; + TV[Y] := V[X] * M[X, Y] + V[Y] * M[Y, Y] + V[Z] * M[Z, Y]; + TV[Z] := V[X] * M[X, Z] + V[Y] * M[Y, Z] + V[Z] * M[Z, Z]; + Result := TV; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function PointInPolygon(xp, yp : array of Single; x, y: Single): Boolean; + +// The code below is from Wm. Randolph Franklin +// with some minor modifications for speed. It returns 1 for strictly +// interior points, 0 for strictly exterior, and 0 or 1 for points on +// the boundary. +// This code is not yet tested! + +var I, J: Integer; + +begin + Result := False; + if High(XP) <> High(YP) then Exit; + J := High(XP); + for I := 0 to High(XP) do + begin + if ((((yp[I] <= y) and (y < yp[J])) or ((yp[J] <= y) and (y < yp[I]))) and + (x < (xp[J] - xp[I]) * (y - yp[I]) / (yp[J] - yp[I]) + xp[I])) + then Result := not Result; + J := I + 1; + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function QuaternionConjugate(Q: TQuaternion): TQuaternion; assembler; + +// returns the conjugate of a quaternion +// EAX contains address of Q +// EDX contains address of result + +asm + FLD DWORD PTR [EAX] + FCHS + WAIT + FSTP DWORD PTR [EDX] + FLD DWORD PTR [EAX + 4] + FCHS + WAIT + FSTP DWORD PTR [EDX + 4] + FLD DWORD PTR [EAX + 8] + FCHS + WAIT + FSTP DWORD PTR [EDX + 8] + MOV EAX, [EAX + 12] + MOV [EDX + 12], EAX +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function QuaternionFromPoints(V1, V2: TAffineVector): TQuaternion; assembler; + +// constructs a unit quaternion from two points on unit sphere +// EAX contains address of V1 +// ECX contains address to result +// EDX contains address of V2 + +asm + {Result.ImagPart := VectorCrossProduct(V1, V2); + Result.RealPart := Sqrt((VectorAffineDotProduct(V1, V2) + 1)/2);} + + PUSH EAX + CALL VectorCrossProduct // determine axis to rotate about + POP EAX + FLD1 // prepare next calculation + Call VectorAffineDotProduct // calculate cos(angle between V1 and V2) + FADD ST, ST(1) // transform angle to angle/2 by: cos(a/2)=sqrt((1 + cos(a))/2) + FXCH ST(1) + FADD ST, ST + FDIVP ST(1), ST + FSQRT + FSTP DWORD PTR [ECX + 12] // Result.RealPart := ST(0) +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function QuaternionMultiply(qL, qR: TQuaternion): TQuaternion; + +// Returns quaternion product qL * qR. Note: order is important! +// To combine rotations, use the product QuaternionMuliply(qSecond, qFirst), +// which gives the effect of rotating by qFirst then qSecond. + +var Temp : TQuaternion; + +begin + Temp.RealPart := qL.RealPart * qR.RealPart - qL.ImagPart[X] * qR.ImagPart[X] - + qL.ImagPart[Y] * qR.ImagPart[Y] - qL.ImagPart[Z] * qR.ImagPart[Z]; + Temp.ImagPart[X] := qL.RealPart * qR.ImagPart[X] + qL.ImagPart[X] * qR.RealPart + + qL.ImagPart[Y] * qR.ImagPart[Z] - qL.ImagPart[Z] * qR.ImagPart[Y]; + Temp.ImagPart[Y] := qL.RealPart * qR.ImagPart[Y] + qL.ImagPart[Y] * qR.RealPart + + qL.ImagPart[Z] * qR.ImagPart[X] - qL.ImagPart[X] * qR.ImagPart[Z]; + Temp.ImagPart[Z] := qL.RealPart * qR.ImagPart[Z] + qL.ImagPart[Z] * qR.RealPart + + qL.ImagPart[X] * qR.ImagPart[Y] - qL.ImagPart[Y] * qR.ImagPart[X]; + Result := Temp; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function QuaternionToMatrix(Q: TQuaternion): TMatrix; + +// Constructs rotation matrix from (possibly non-unit) quaternion. +// Assumes matrix is used to multiply column vector on the left: +// vnew = mat vold. Works correctly for right-handed coordinate system +// and right-handed rotations. + +// Essentially, this function is the same as CreateRotationMatrix and you can consider it as +// being for reference here. + +{var Norm, S, + XS, YS, ZS, + WX, WY, WZ, + XX, XY, XZ, + YY, YZ, ZZ : Single; + +begin + Norm := Q.Vector[X] * Q.Vector[X] + Q.Vector[Y] * Q.Vector[Y] + Q.Vector[Z] * Q.Vector[Z] + Q.RealPart * Q.RealPart; + if Norm > 0 then S := 2 / Norm + else S := 0; + + XS := Q.Vector[X] * S; YS := Q.Vector[Y] * S; ZS := Q.Vector[Z] * S; + WX := Q.RealPart * XS; WY := Q.RealPart * YS; WZ := Q.RealPart * ZS; + XX := Q.Vector[X] * XS; XY := Q.Vector[X] * YS; XZ := Q.Vector[X] * ZS; + YY := Q.Vector[Y] * YS; YZ := Q.Vector[Y] * ZS; ZZ := Q.Vector[Z] * ZS; + + Result[X, X] := 1 - (YY + ZZ); Result[Y, X] := XY + WZ; Result[Z, X] := XZ - WY; Result[W, X] := 0; + Result[X, Y] := XY - WZ; Result[Y, Y] := 1 - (XX + ZZ); Result[Z, Y] := YZ + WX; Result[W, Y] := 0; + Result[X, Z] := XZ + WY; Result[Y, Z] := YZ - WX; Result[Z, Z] := 1 - (XX + YY); Result[W, Z] := 0; + Result[X, W] := 0; Result[Y, W] := 0; Result[Z, W] := 0; Result[W, W] := 1;} + +var + V: TAffineVector; + SinA, CosA, + A, B, C: Extended; + +begin + V := Q.ImagPart; + VectorNormalize(V); + SinCos(Q.RealPart / 2, SinA, CosA); + A := V[X] * SinA; + B := V[Y] * SinA; + C := V[Z] * SinA; + + Result := IdentityMatrix; + Result[X, X] := 1 - 2 * B * B - 2 * C * C; + Result[X, Y] := 2 * A * B - 2 * CosA * C; + Result[X, Z] := 2 * A * C + 2 * CosA * B; + + Result[Y, X] := 2 * A * B + 2 * CosA * C; + Result[Y, Y] := 1 - 2 * A * A - 2 * C * C; + Result[Y, Z] := 2 * B * C - 2 * CosA * A; + + Result[Z, X] := 2 * A * C - 2 * CosA * B; + Result[Z, Y] := 2 * B * C + 2 * CosA * A; + Result[Z, Z] := 1 - 2 * A * A - 2 * B * B; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure QuaternionToPoints(Q: TQuaternion; var ArcFrom, ArcTo: TAffineVector); register; + +// converts a unit quaternion into two points on a unit sphere + +var S: Single; + +begin + S := Sqrt(Q.ImagPart[X] * Q.ImagPart[X] + Q.ImagPart[Y] * Q.ImagPart[Y]); + if S = 0 then ArcFrom := MakeAffineVector([0, 1, 0]) + else ArcFrom := MakeAffineVector([-Q.ImagPart[Y] / S, Q.ImagPart[X] / S, 0]); + ArcTo[X] := Q.RealPart * ArcFrom[X] - Q.ImagPart[Z] * ArcFrom[Y]; + ArcTo[Y] := Q.RealPart * ArcFrom[Y] + Q.ImagPart[Z] * ArcFrom[X]; + ArcTo[Z] := Q.ImagPart[X] * ArcFrom[Y] - Q.ImagPart[Y] * ArcFrom[X]; + if Q.RealPart < 0 then ArcFrom := MakeAffineVector([-ArcFrom[X], -ArcFrom[Y], 0]); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function MatrixAffineDeterminant(M: TAffineMatrix): Single; register; + +// determinant of a 3x3 matrix + +begin + Result := M[X, X] * (M[Y, Y] * M[Z, Z] - M[Z, Y] * M[Y, Z]) - + M[X, Y] * (M[Y, X] * M[Z, Z] - M[Z, X] * M[Y, Z]) + + M[X, Z] * (M[Y, X] * M[Z, Y] - M[Z, X] * M[Y, Y]); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function MatrixDetInternal(a1, a2, a3, b1, b2, b3, c1, c2, c3: Single): Single; + +// internal version for the determinant of a 3x3 matrix + +begin + Result := a1 * (b2 * c3 - b3 * c2) - + b1 * (a2 * c3 - a3 * c2) + + c1 * (a2 * b3 - a3 * b2); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure MatrixAdjoint(var M: TMatrix); register; + +// Adjoint of a 4x4 matrix - used in the computation of the inverse +// of a 4x4 matrix + +var a1, a2, a3, a4, + b1, b2, b3, b4, + c1, c2, c3, c4, + d1, d2, d3, d4: Single; + + +begin + a1 := M[X, X]; b1 := M[X, Y]; + c1 := M[X, Z]; d1 := M[X, W]; + a2 := M[Y, X]; b2 := M[Y, Y]; + c2 := M[Y, Z]; d2 := M[Y, W]; + a3 := M[Z, X]; b3 := M[Z, Y]; + c3 := M[Z, Z]; d3 := M[Z, W]; + a4 := M[W, X]; b4 := M[W, Y]; + c4 := M[W, Z]; d4 := M[W, W]; + + // row column labeling reversed since we transpose rows & columns + M[X, X] := MatrixDetInternal(b2, b3, b4, c2, c3, c4, d2, d3, d4); + M[Y, X] := -MatrixDetInternal(a2, a3, a4, c2, c3, c4, d2, d3, d4); + M[Z, X] := MatrixDetInternal(a2, a3, a4, b2, b3, b4, d2, d3, d4); + M[W, X] := -MatrixDetInternal(a2, a3, a4, b2, b3, b4, c2, c3, c4); + + M[X, Y] := -MatrixDetInternal(b1, b3, b4, c1, c3, c4, d1, d3, d4); + M[Y, Y] := MatrixDetInternal(a1, a3, a4, c1, c3, c4, d1, d3, d4); + M[Z, Y] := -MatrixDetInternal(a1, a3, a4, b1, b3, b4, d1, d3, d4); + M[W, Y] := MatrixDetInternal(a1, a3, a4, b1, b3, b4, c1, c3, c4); + + M[X, Z] := MatrixDetInternal(b1, b2, b4, c1, c2, c4, d1, d2, d4); + M[Y, Z] := -MatrixDetInternal(a1, a2, a4, c1, c2, c4, d1, d2, d4); + M[Z, Z] := MatrixDetInternal(a1, a2, a4, b1, b2, b4, d1, d2, d4); + M[W, Z] := -MatrixDetInternal(a1, a2, a4, b1, b2, b4, c1, c2, c4); + + M[X, W] := -MatrixDetInternal(b1, b2, b3, c1, c2, c3, d1, d2, d3); + M[Y, W] := MatrixDetInternal(a1, a2, a3, c1, c2, c3, d1, d2, d3); + M[Z, W] := -MatrixDetInternal(a1, a2, a3, b1, b2, b3, d1, d2, d3); + M[W, W] := MatrixDetInternal(a1, a2, a3, b1, b2, b3, c1, c2, c3); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function MatrixDeterminant(M: TMatrix): Single; register; + +// Determinant of a 4x4 matrix + +var a1, a2, a3, a4, + b1, b2, b3, b4, + c1, c2, c3, c4, + d1, d2, d3, d4 : Single; + +begin + a1 := M[X, X]; b1 := M[X, Y]; c1 := M[X, Z]; d1 := M[X, W]; + a2 := M[Y, X]; b2 := M[Y, Y]; c2 := M[Y, Z]; d2 := M[Y, W]; + a3 := M[Z, X]; b3 := M[Z, Y]; c3 := M[Z, Z]; d3 := M[Z, W]; + a4 := M[W, X]; b4 := M[W, Y]; c4 := M[W, Z]; d4 := M[W, W]; + + Result := a1 * MatrixDetInternal(b2, b3, b4, c2, c3, c4, d2, d3, d4) - + b1 * MatrixDetInternal(a2, a3, a4, c2, c3, c4, d2, d3, d4) + + c1 * MatrixDetInternal(a2, a3, a4, b2, b3, b4, d2, d3, d4) - + d1 * MatrixDetInternal(a2, a3, a4, b2, b3, b4, c2, c3, c4); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure MatrixScale(var M: TMatrix; Factor: Single); register; + +// multiplies all elements of a 4x4 matrix with a factor + +var I, J: Integer; + +begin + for I := 0 to 3 do + for J := 0 to 3 do M[I, J] := M[I, J] * Factor; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure MatrixInvert(var M: TMatrix); register; + +// finds the inverse of a 4x4 matrix + +var Det: Single; + +begin + Det := MatrixDeterminant(M); + if Abs(Det) < EPSILON then M := IdentityMatrix + else + begin + MatrixAdjoint(M); + MatrixScale(M, 1 / Det); + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure MatrixTranspose(var M: TMatrix); register; + +// computes transpose of 4x4 matrix + +var I, J: Integer; + TM: TMatrix; + +begin + for I := 0 to 3 do + for J := 0 to 3 do TM[J, I] := M[I, J]; + M := TM; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure MatrixAffineTranspose(var M: TAffineMatrix); register; + +// computes transpose of 3x3 matrix + +var I, J: Integer; + TM: TAffineMatrix; + +begin + for I := 0 to 2 do + for J := 0 to 2 do TM[J, I] := M[I, J]; + M := TM; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function MatrixMultiply(M1, M2: TMatrix): TMatrix; register; + +// multiplies two 4x4 matrices + +var I, J: Integer; + TM: TMatrix; + +begin + for I := 0 to 3 do + for J := 0 to 3 do + TM[I, J] := M1[I, X] * M2[X, J] + + M1[I, Y] * M2[Y, J] + + M1[I, Z] * M2[Z, J] + + M1[I, W] * M2[W, J]; + Result := TM; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function CreateRotationMatrix(Axis: TVector3f; Angle: Single): TMatrix; register; + +// Creates a rotation matrix along the given Axis by the given Angle in radians. + +var cosine, + sine, + Len, + one_minus_cosine: Extended; + +begin + SinCos(Angle, Sine, Cosine); + one_minus_cosine := 1 - cosine; + Len := VectorNormalize(Axis); + + if Len = 0 then Result := IdentityMatrix + else + begin + Result[X, X] := (one_minus_cosine * Sqr(Axis[0])) + Cosine; + Result[X, Y] := (one_minus_cosine * Axis[0] * Axis[1]) - (Axis[2] * Sine); + Result[X, Z] := (one_minus_cosine * Axis[2] * Axis[0]) + (Axis[1] * Sine); + Result[X, W] := 0; + + Result[Y, X] := (one_minus_cosine * Axis[0] * Axis[1]) + (Axis[2] * Sine); + Result[Y, Y] := (one_minus_cosine * Sqr(Axis[1])) + Cosine; + Result[Y, Z] := (one_minus_cosine * Axis[1] * Axis[2]) - (Axis[0] * Sine); + Result[Y, W] := 0; + + Result[Z, X] := (one_minus_cosine * Axis[2] * Axis[0]) - (Axis[1] * Sine); + Result[Z, Y] := (one_minus_cosine * Axis[1] * Axis[2]) + (Axis[0] * Sine); + Result[Z, Z] := (one_minus_cosine * Sqr(Axis[2])) + Cosine; + Result[Z, W] := 0; + + Result[W, X] := 0; + Result[W, Y] := 0; + Result[W, Z] := 0; + Result[W, W] := 1; + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function ConvertRotation(Angles: TAffineVector): TVector; register; + +{ Turn a triplet of rotations about x, y, and z (in that order) into an + equivalent rotation around a single axis (all in radians). + + Rotation of the Angle t about the axis (X, Y, Z) is given by: + + | X^2 + (1-X^2) Cos(t), XY(1-Cos(t)) + Z Sin(t), XZ(1-Cos(t))-Y Sin(t) | + M = | XY(1-Cos(t))-Z Sin(t), Y^2 + (1-Y^2) Cos(t), YZ(1-Cos(t)) + X Sin(t) | + | XZ(1-Cos(t)) + Y Sin(t), YZ(1-Cos(t))-X Sin(t), Z^2 + (1-Z^2) Cos(t) | + + Rotation about the three axes (Angles a1, a2, a3) can be represented as + the product of the individual rotation matrices: + + | 1 0 0 | | Cos(a2) 0 -Sin(a2) | | Cos(a3) Sin(a3) 0 | + | 0 Cos(a1) Sin(a1) | * | 0 1 0 | * | -Sin(a3) Cos(a3) 0 | + | 0 -Sin(a1) Cos(a1) | | Sin(a2) 0 Cos(a2) | | 0 0 1 | + Mx My Mz + + We now want to solve for X, Y, Z, and t given 9 equations in 4 unknowns. + Using the diagonal elements of the two matrices, we get: + + X^2 + (1-X^2) Cos(t) = M[0][0] + Y^2 + (1-Y^2) Cos(t) = M[1][1] + Z^2 + (1-Z^2) Cos(t) = M[2][2] + + Adding the three equations, we get: + + X^2 + Y^2 + Z^2 - (M[0][0] + M[1][1] + M[2][2]) = + - (3 - X^2 - Y^2 - Z^2) Cos(t) + + Since (X^2 + Y^2 + Z^2) = 1, we can rewrite as: + + Cos(t) = (1 - (M[0][0] + M[1][1] + M[2][2])) / 2 + + Solving for t, we get: + + t = Acos(((M[0][0] + M[1][1] + M[2][2]) - 1) / 2) + + We can substitute t into the equations for X^2, Y^2, and Z^2 above + to get the values for X, Y, and Z. To find the proper signs we note + that: + + 2 X Sin(t) = M[1][2] - M[2][1] + 2 Y Sin(t) = M[2][0] - M[0][2] + 2 Z Sin(t) = M[0][1] - M[1][0] +} + +var Axis1, Axis2: TVector3f; + M, M1, M2: TMatrix; + cost, cost1, + sint, + s1, s2, s3: Single; + I: Integer; + + +begin + // see if we are only rotating about a single Axis + if Abs(Angles[X]) < EPSILON then + begin + if Abs(Angles[Y]) < EPSILON then + begin + Result := MakeVector([0, 0, 1, Angles[Z]]); + Exit; + end + else + if Abs(Angles[Z]) < EPSILON then + begin + Result := MakeVector([0, 1, 0, Angles[Y]]); + Exit; + end + end + else + if (Abs(Angles[Y]) < EPSILON) and + (Abs(Angles[Z]) < EPSILON) then + begin + Result := MakeVector([1, 0, 0, Angles[X]]); + Exit; + end; + + // make the rotation matrix + Axis1 := MakeAffineVector([1, 0, 0]); + M := CreateRotationMatrix(Axis1, Angles[X]); + + Axis2 := MakeAffineVector([0, 1, 0]); + M2 := CreateRotationMatrix(Axis2, Angles[Y]); + M1 := MatrixMultiply(M, M2); + + Axis2 := MakeAffineVector([0, 0, 1]); + M2 := CreateRotationMatrix(Axis2, Angles[Z]); + M := MatrixMultiply(M1, M2); + + cost := ((M[X, X] + M[Y, Y] + M[Z, Z])-1) / 2; + if cost < -1 then cost := -1 + else + if cost > 1 - EPSILON then + begin + // Bad Angle - this would cause a crash + Result := MakeVector([1, 0, 0, 0]); + Exit; + end; + + cost1 := 1 - cost; + Result := Makevector([Sqrt((M[X, X]-cost) / cost1), + Sqrt((M[Y, Y]-cost) / cost1), + sqrt((M[Z, Z]-cost) / cost1), + arccos(cost)]); + + sint := 2 * Sqrt(1 - cost * cost); // This is actually 2 Sin(t) + + // Determine the proper signs + for I := 0 to 7 do + begin + if (I and 1) > 1 then s1 := -1 else s1 := 1; + if (I and 2) > 1 then s2 := -1 else s2 := 1; + if (I and 4) > 1 then s3 := -1 else s3 := 1; + if (Abs(s1 * Result[X] * sint-M[Y, Z] + M[Z, Y]) < EPSILON2) and + (Abs(s2 * Result[Y] * sint-M[Z, X] + M[X, Z]) < EPSILON2) and + (Abs(s3 * Result[Z] * sint-M[X, Y] + M[Y, X]) < EPSILON2) then + begin + // We found the right combination of signs + Result[X] := Result[X] * s1; + Result[Y] := Result[Y] * s2; + Result[Z] := Result[Z] * s3; + Exit; + end; + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function CreateRotationMatrixX(Sine, Cosine: Single): TMatrix; register; + +// creates matrix for rotation about x-axis + +begin + Result := EmptyMatrix; + Result[X, X] := 1; + Result[Y, Y] := Cosine; + Result[Y, Z] := Sine; + Result[Z, Y] := -Sine; + Result[Z, Z] := Cosine; + Result[W, W] := 1; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function CreateRotationMatrixY(Sine, Cosine: Single): TMatrix; register; + +// creates matrix for rotation about y-axis + +begin + Result := EmptyMatrix; + Result[X, X] := Cosine; + Result[X, Z] := -Sine; + Result[Y, Y] := 1; + Result[Z, X] := Sine; + Result[Z, Z] := Cosine; + Result[W, W] := 1; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function CreateRotationMatrixZ(Sine, Cosine: Single): TMatrix; register; + +// creates matrix for rotation about z-axis + +begin + Result := EmptyMatrix; + Result[X, X] := Cosine; + Result[X, Y] := Sine; + Result[Y, X] := -Sine; + Result[Y, Y] := Cosine; + Result[Z, Z] := 1; + Result[W, W] := 1; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function CreateScaleMatrix(V: TAffineVector): TMatrix; register; + +// creates scaling matrix + +begin + Result := IdentityMatrix; + Result[X, X] := V[X]; + Result[Y, Y] := V[Y]; + Result[Z, Z] := V[Z]; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function CreateTranslationMatrix(V: TVector): TMatrix; register; + +// creates translation matrix + +begin + Result := IdentityMatrix; + Result[W, X] := V[X]; + Result[W, Y] := V[Y]; + Result[W, Z] := V[Z]; + Result[W, W] := V[W]; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function Lerp(Start, Stop, t: Single): Single; + +// calculates linear interpolation between start and stop at point t + +begin + Result := Start + (Stop - Start) * t; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorAffineLerp(V1, V2: TAffineVector; t: Single): TAffineVector; + +// calculates linear interpolation between vector1 and vector2 at point t + +begin + Result[X] := Lerp(V1[X], V2[X], t); + Result[Y] := Lerp(V1[Y], V2[Y], t); + Result[Z] := Lerp(V1[Z], V2[Z], t); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorLerp(V1, V2: TVector; t: Single): TVector; + +// calculates linear interpolation between vector1 and vector2 at point t + +begin + Result[X] := Lerp(V1[X], V2[X], t); + Result[Y] := Lerp(V1[Y], V2[Y], t); + Result[Z] := Lerp(V1[Z], V2[Z], t); + Result[W] := Lerp(V1[W], V2[W], t); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function QuaternionSlerp(QStart, QEnd: TQuaternion; Spin: Integer; t: Single): TQuaternion; + +// spherical linear interpolation of unit quaternions with spins +// QStart, QEnd - start and end unit quaternions +// t - interpolation parameter (0 to 1) +// Spin - number of extra spin rotations to involve + +var beta, // complementary interp parameter + theta, // Angle between A and B + sint, cost, // sine, cosine of theta + phi: Single; // theta plus spins + bflip: Boolean; // use negativ t? + + +begin + // cosine theta + cost := VectorAngle(QStart.ImagPart, QEnd.ImagPart); + + // if QEnd is on opposite hemisphere from QStart, use -QEnd instead + if cost < 0 then + begin + cost := -cost; + bflip := True; + end + else bflip := False; + + // if QEnd is (within precision limits) the same as QStart, + // just linear interpolate between QStart and QEnd. + // Can't do spins, since we don't know what direction to spin. + + if (1 - cost) < EPSILON then beta := 1 - t + else + begin + // normal case + theta := arccos(cost); + phi := theta + Spin * Pi; + sint := sin(theta); + beta := sin(theta - t * phi) / sint; + t := sin(t * phi) / sint; + end; + + if bflip then t := -t; + + // interpolate + Result.ImagPart[X] := beta * QStart.ImagPart[X] + t * QEnd.ImagPart[X]; + Result.ImagPart[Y] := beta * QStart.ImagPart[Y] + t * QEnd.ImagPart[Y]; + Result.ImagPart[Z] := beta * QStart.ImagPart[Z] + t * QEnd.ImagPart[Z]; + Result.RealPart := beta * QStart.RealPart + t * QEnd.RealPart; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorAffineCombine(V1, V2: TAffineVector; F1, F2: Single): TAffineVector; + +// makes a linear combination of two vectors and return the result + +begin + Result[X] := (F1 * V1[X]) + (F2 * V2[X]); + Result[Y] := (F1 * V1[Y]) + (F2 * V2[Y]); + Result[Z] := (F1 * V1[Z]) + (F2 * V2[Z]); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorCombine(V1, V2: TVector; F1, F2: Single): TVector; + +// makes a linear combination of two vectors and return the result + +begin + Result[X] := (F1 * V1[X]) + (F2 * V2[X]); + Result[Y] := (F1 * V1[Y]) + (F2 * V2[Y]); + Result[Z] := (F1 * V1[Z]) + (F2 * V2[Z]); + Result[W] := (F1 * V1[W]) + (F2 * V2[W]); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function MatrixDecompose(M: TMatrix; var Tran: TTransformations): Boolean; register; + +// Author: Spencer W. Thomas, University of Michigan +// +// MatrixDecompose - Decompose a non-degenerated 4x4 transformation matrix into +// the sequence of transformations that produced it. +// +// The coefficient of each transformation is returned in the corresponding +// element of the vector Tran. +// +// Returns true upon success, false if the matrix is singular. + +var I, J: Integer; + LocMat, + pmat, + invpmat, + tinvpmat: TMatrix; + prhs, + psol: TVector; + Row: array[0..2] of TAffineVector; + +begin + Result := False; + locmat := M; + // normalize the matrix + if locmat[W, W] = 0 then Exit; + for I := 0 to 3 do + for J := 0 to 3 do + locmat[I, J] := locmat[I, J] / locmat[W, W]; + + // pmat is used to solve for perspective, but it also provides + // an easy way to test for singularity of the upper 3x3 component. + + pmat := locmat; + for I := 0 to 2 do pmat[I, W] := 0; + pmat[W, W] := 1; + + if MatrixDeterminant(pmat) = 0 then Exit; + + // First, isolate perspective. This is the messiest. + if (locmat[X, W] <> 0) or + (locmat[Y, W] <> 0) or + (locmat[Z, W] <> 0) then + begin + // prhs is the right hand side of the equation. + prhs[X] := locmat[X, W]; + prhs[Y] := locmat[Y, W]; + prhs[Z] := locmat[Z, W]; + prhs[W] := locmat[W, W]; + + // Solve the equation by inverting pmat and multiplying + // prhs by the inverse. (This is the easiest way, not + // necessarily the best.) + + invpmat := pmat; + MatrixInvert(invpmat); + MatrixTranspose(invpmat); + psol := VectorTransform(prhs, tinvpmat); + + // stuff the answer away + Tran[ttPerspectiveX] := psol[X]; + Tran[ttPerspectiveY] := psol[Y]; + Tran[ttPerspectiveZ] := psol[Z]; + Tran[ttPerspectiveW] := psol[W]; + + // clear the perspective partition + locmat[X, W] := 0; + locmat[Y, W] := 0; + locmat[Z, W] := 0; + locmat[W, W] := 1; + end + else + begin + // no perspective + Tran[ttPerspectiveX] := 0; + Tran[ttPerspectiveY] := 0; + Tran[ttPerspectiveZ] := 0; + Tran[ttPerspectiveW] := 0; + end; + + // next take care of translation (easy) + for I := 0 to 2 do + begin + Tran[TTransType(Ord(ttTranslateX) + I)] := locmat[W, I]; + locmat[W, I] := 0; + end; + + // now get scale and shear + for I := 0 to 2 do + begin + row[I, X] := locmat[I, X]; + row[I, Y] := locmat[I, Y]; + row[I, Z] := locmat[I, Z]; + end; + + // compute X scale factor and normalize first row + Tran[ttScaleX] := Sqr(VectorNormalize(row[0])); // ml: calculation optimized + + // compute XY shear factor and make 2nd row orthogonal to 1st + Tran[ttShearXY] := VectorAffineDotProduct(row[0], row[1]); + row[1] := VectorAffineCombine(row[1], row[0], 1, -Tran[ttShearXY]); + + // now, compute Y scale and normalize 2nd row + Tran[ttScaleY] := Sqr(VectorNormalize(row[1])); // ml: calculation optimized + Tran[ttShearXY] := Tran[ttShearXY]/Tran[ttScaleY]; + + // compute XZ and YZ shears, orthogonalize 3rd row + Tran[ttShearXZ] := VectorAffineDotProduct(row[0], row[2]); + row[2] := VectorAffineCombine(row[2], row[0], 1, -Tran[ttShearXZ]); + Tran[ttShearYZ] := VectorAffineDotProduct(row[1], row[2]); + row[2] := VectorAffineCombine(row[2], row[1], 1, -Tran[ttShearYZ]); + + // next, get Z scale and normalize 3rd row + Tran[ttScaleZ] := Sqr(VectorNormalize(row[1])); // (ML) calc. optimized + Tran[ttShearXZ] := Tran[ttShearXZ] / tran[ttScaleZ]; + Tran[ttShearYZ] := Tran[ttShearYZ] / Tran[ttScaleZ]; + + // At this point, the matrix (in rows[]) is orthonormal. + // Check for a coordinate system flip. If the determinant + // is -1, then negate the matrix and the scaling factors. + if VectorAffineDotProduct(row[0], VectorCrossProduct(row[1], row[2])) < 0 then + for I := 0 to 2 do + begin + Tran[TTransType(Ord(ttScaleX) + I)] := -Tran[TTransType(Ord(ttScaleX) + I)]; + row[I, X] := -row[I, X]; + row[I, Y] := -row[I, Y]; + row[I, Z] := -row[I, Z]; + end; + + // now, get the rotations out, as described in the gem + Tran[ttRotateY] := arcsin(-row[0, Z]); + if cos(Tran[ttRotateY]) <> 0 then + begin + Tran[ttRotateX] := arctan2(row[1, Z], row[2, Z]); + Tran[ttRotateZ] := arctan2(row[0, Y], row[0, X]); + end + else + begin + tran[ttRotateX] := arctan2(row[1, X], row[1, Y]); + tran[ttRotateZ] := 0; + end; + // All done! + Result := True; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorDblToFlt(V: THomogeneousDblVector): THomogeneousVector; assembler; + +// converts a vector containing double sized values into a vector with single sized values + +asm + FLD QWORD PTR [EAX] + FSTP DWORD PTR [EDX] + FLD QWORD PTR [EAX + 8] + FSTP DWORD PTR [EDX + 4] + FLD QWORD PTR [EAX + 16] + FSTP DWORD PTR [EDX + 8] + FLD QWORD PTR [EAX + 24] + FSTP DWORD PTR [EDX + 12] +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorAffineDblToFlt(V: TAffineDblVector): TAffineVector; assembler; + +// converts a vector containing double sized values into a vector with single sized values + +asm + FLD QWORD PTR [EAX] + FSTP DWORD PTR [EDX] + FLD QWORD PTR [EAX + 8] + FSTP DWORD PTR [EDX + 4] + FLD QWORD PTR [EAX + 16] + FSTP DWORD PTR [EDX + 8] +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorAffineFltToDbl(V: TAffineVector): TAffineDblVector; assembler; + +// converts a vector containing single sized values into a vector with double sized values + +asm + FLD DWORD PTR [EAX] + FSTP QWORD PTR [EDX] + FLD DWORD PTR [EAX + 8] + FSTP QWORD PTR [EDX + 4] + FLD DWORD PTR [EAX + 16] + FSTP QWORD PTR [EDX + 8] +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorFltToDbl(V: TVector): THomogeneousDblVector; assembler; + +// converts a vector containing single sized values into a vector with double sized values + +asm + FLD DWORD PTR [EAX] + FSTP QWORD PTR [EDX] + FLD DWORD PTR [EAX + 8] + FSTP QWORD PTR [EDX + 4] + FLD DWORD PTR [EAX + 16] + FSTP QWORD PTR [EDX + 8] + FLD DWORD PTR [EAX + 24] + FSTP QWORD PTR [EDX + 12] +end; + +//----------------- coordinate system manipulation functions ----------------------------------------------------------- + +function Turn(Matrix: TMatrix; Angle: Single): TMatrix; + +// rotates the given coordinate system (represented by the matrix) around its Y-axis + +begin + Result := MatrixMultiply(Matrix, CreateRotationMatrix(MakeAffineVector(Matrix[1]), Angle)); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function Turn(Matrix: TMatrix; MasterUp: TAffineVector; Angle: Single): TMatrix; + +// rotates the given coordinate system (represented by the matrix) around MasterUp + +begin + Result := MatrixMultiply(Matrix, CreateRotationMatrix(MasterUp, Angle)); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function Pitch(Matrix: TMatrix; Angle: Single): TMatrix; + +// rotates the given coordinate system (represented by the matrix) around its X-axis + +begin + Result := MatrixMultiply(Matrix, CreateRotationMatrix(MakeAffineVector(Matrix[0]), Angle)); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function Pitch(Matrix: TMatrix; MasterRight: TAffineVector; Angle: Single): TMatrix; overload; + +// rotates the given coordinate system (represented by the matrix) around MasterRight + +begin + Result := MatrixMultiply(Matrix, CreateRotationMatrix(MasterRight, Angle)); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function Roll(Matrix: TMatrix; Angle: Single): TMatrix; + +// rotates the given coordinate system (represented by the matrix) around its Z-axis + +begin + Result := MatrixMultiply(Matrix, CreateRotationMatrix(MakeAffineVector(Matrix[2]), Angle)); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function Roll(Matrix: TMatrix; MasterDirection: TAffineVector; Angle: Single): TMatrix; overload; + +// rotates the given coordinate system (represented by the matrix) around MasterDirection + +begin + Result := MatrixMultiply(Matrix, CreateRotationMatrix(MasterDirection, Angle)); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +end. + + diff --git a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/gl.pas b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/gl.pas new file mode 100644 index 00000000..aa0dd169 --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/gl.pas @@ -0,0 +1,2294 @@ +unit gl; +{ + $Id: gl.pas,v 1.2 2004/08/14 22:54:30 savage Exp $ + + Adaption of the delphi3d.net OpenGL units to FreePascal + Sebastian Guenther (sg@freepascal.org) in 2002 + These units are free to use +} + +(*++ BUILD Version: 0004 // Increment this if a change has global effects + +Copyright (c) 1985-96, Microsoft Corporation + +Module Name: + + gl.h + +Abstract: + + Procedure declarations, constant definitions and macros for the OpenGL + component. + +--*) + +(* +** Copyright 1996 Silicon Graphics, Inc. +** All Rights Reserved. +** +** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.; +** the contents of this file may not be disclosed to third parties, copied or +** duplicated in any form, in whole or in part, without the prior written +** permission of Silicon Graphics, Inc. +** +** RESTRICTED RIGHTS LEGEND: +** Use, duplication or disclosure by the Government is subject to restrictions +** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data +** and Computer Software clause at DFARS 252.227-7013, and/or in similar or +** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - +** rights reserved under the Copyright Laws of the United States. +*) + +{******************************************************************************} +{ } +{ Converted to Delphi by Tom Nuydens (tom@delphi3d.net) } +{ For the latest updates, visit Delphi3D: http://www.delphi3d.net } +{ } +{ Modified for Delphi/Kylix and FreePascal } +{ by Dominique Louis ( Dominique@Savagesoftware.com.au) } +{ For the latest updates, visit JEDI-SDL : http://www.sf.net/projects/jedi-sdl } +{ } +{******************************************************************************} + +{ + $Log: gl.pas,v $ + Revision 1.2 2004/08/14 22:54:30 savage + Updated so that Library name defines are correctly defined for MacOS X. + + Revision 1.1 2004/03/30 21:53:54 savage + Moved to it's own folder. + + Revision 1.4 2004/02/20 17:09:55 savage + Code tidied up in gl, glu and glut, while extensions in glext.pas are now loaded using SDL_GL_GetProcAddress, thus making it more cross-platform compatible, but now more tied to SDL. + + Revision 1.3 2004/02/14 00:23:39 savage + As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. + + Revision 1.2 2004/02/14 00:09:18 savage + Changed uses to now make use of moduleloader.pas rather than dllfuncs.pas + + Revision 1.1 2004/02/05 00:08:19 savage + Module 1.0 release + + Revision 1.6 2003/06/02 12:32:12 savage + Modified Sources to avoid warnings with Delphi by moving CVS Logging to the top of the header files. Hopefully CVS Logging still works. + +} + +interface + +{$I jedi-sdl.inc} + +uses +{$IFDEF __GPC__} + system, + gpc, +{$ENDIF} + +{$IFDEF WIN32} + Windows, +{$ENDIF} + moduleloader; + + +var + LibGL: TModuleHandle; + +type + GLenum = Cardinal; PGLenum = ^GLenum; + GLboolean = Byte; PGLboolean = ^GLboolean; + GLbitfield = Cardinal; PGLbitfield = ^GLbitfield; + GLbyte = ShortInt; PGLbyte = ^GLbyte; + GLshort = SmallInt; PGLshort = ^GLshort; + GLint = Integer; PGLint = ^GLint; + GLsizei = Integer; PGLsizei = ^GLsizei; + GLubyte = Byte; PGLubyte = ^GLubyte; + GLushort = Word; PGLushort = ^GLushort; + GLuint = Cardinal; PGLuint = ^GLuint; + GLfloat = Single; PGLfloat = ^GLfloat; + GLclampf = Single; PGLclampf = ^GLclampf; + GLdouble = Double; PGLdouble = ^GLdouble; + GLclampd = Double; PGLclampd = ^GLclampd; +{ GLvoid = void; } PGLvoid = Pointer; + +{******************************************************************************} + +const +{$IFDEF WIN32} + GLLibName = 'OpenGL32.dll'; +{$ENDIF} + +{$IFDEF UNIX} +{$IFDEF DARWIN} + GLLibName = 'libGL.dylib'; +{$ELSE} + GLLibName = 'libGL.so'; +{$ENDIF} +{$ENDIF} + + // Version + GL_VERSION_1_1 = 1; + + // AccumOp + GL_ACCUM = $0100; + GL_LOAD = $0101; + GL_RETURN = $0102; + GL_MULT = $0103; + GL_ADD = $0104; + + // AlphaFunction + GL_NEVER = $0200; + GL_LESS = $0201; + GL_EQUAL = $0202; + GL_LEQUAL = $0203; + GL_GREATER = $0204; + GL_NOTEQUAL = $0205; + GL_GEQUAL = $0206; + GL_ALWAYS = $0207; + + // AttribMask + GL_CURRENT_BIT = $00000001; + GL_POINT_BIT = $00000002; + GL_LINE_BIT = $00000004; + GL_POLYGON_BIT = $00000008; + GL_POLYGON_STIPPLE_BIT = $00000010; + GL_PIXEL_MODE_BIT = $00000020; + GL_LIGHTING_BIT = $00000040; + GL_FOG_BIT = $00000080; + GL_DEPTH_BUFFER_BIT = $00000100; + GL_ACCUM_BUFFER_BIT = $00000200; + GL_STENCIL_BUFFER_BIT = $00000400; + GL_VIEWPORT_BIT = $00000800; + GL_TRANSFORM_BIT = $00001000; + GL_ENABLE_BIT = $00002000; + GL_COLOR_BUFFER_BIT = $00004000; + GL_HINT_BIT = $00008000; + GL_EVAL_BIT = $00010000; + GL_LIST_BIT = $00020000; + GL_TEXTURE_BIT = $00040000; + GL_SCISSOR_BIT = $00080000; + GL_ALL_ATTRIB_BITS = $000FFFFF; + + // BeginMode + GL_POINTS = $0000; + GL_LINES = $0001; + GL_LINE_LOOP = $0002; + GL_LINE_STRIP = $0003; + GL_TRIANGLES = $0004; + GL_TRIANGLE_STRIP = $0005; + GL_TRIANGLE_FAN = $0006; + GL_QUADS = $0007; + GL_QUAD_STRIP = $0008; + GL_POLYGON = $0009; + + // BlendingFactorDest + GL_ZERO = 0; + GL_ONE = 1; + GL_SRC_COLOR = $0300; + GL_ONE_MINUS_SRC_COLOR = $0301; + GL_SRC_ALPHA = $0302; + GL_ONE_MINUS_SRC_ALPHA = $0303; + GL_DST_ALPHA = $0304; + GL_ONE_MINUS_DST_ALPHA = $0305; + + // BlendingFactorSrc + // GL_ZERO + // GL_ONE + GL_DST_COLOR = $0306; + GL_ONE_MINUS_DST_COLOR = $0307; + GL_SRC_ALPHA_SATURATE = $0308; + // GL_SRC_ALPHA + // GL_ONE_MINUS_SRC_ALPHA + // GL_DST_ALPHA + // GL_ONE_MINUS_DST_ALPHA + + // Boolean + GL_TRUE = 1; + GL_FALSE = 0; + + // ClearBufferMask + // GL_COLOR_BUFFER_BIT + // GL_ACCUM_BUFFER_BIT + // GL_STENCIL_BUFFER_BIT + // GL_DEPTH_BUFFER_BIT + + // ClientArrayType + // GL_VERTEX_ARRAY + // GL_NORMAL_ARRAY + // GL_COLOR_ARRAY + // GL_INDEX_ARRAY + // GL_TEXTURE_COORD_ARRAY + // GL_EDGE_FLAG_ARRAY + + // ClipPlaneName + GL_CLIP_PLANE0 = $3000; + GL_CLIP_PLANE1 = $3001; + GL_CLIP_PLANE2 = $3002; + GL_CLIP_PLANE3 = $3003; + GL_CLIP_PLANE4 = $3004; + GL_CLIP_PLANE5 = $3005; + + // ColorMaterialFace + // GL_FRONT + // GL_BACK + // GL_FRONT_AND_BACK + + // ColorMaterialParameter + // GL_AMBIENT + // GL_DIFFUSE + // GL_SPECULAR + // GL_EMISSION + // GL_AMBIENT_AND_DIFFUSE + + // ColorPointerType + // GL_BYTE + // GL_UNSIGNED_BYTE + // GL_SHORT + // GL_UNSIGNED_SHORT + // GL_INT + // GL_UNSIGNED_INT + // GL_FLOAT + // GL_DOUBLE + + // CullFaceMode + // GL_FRONT + // GL_BACK + // GL_FRONT_AND_BACK + + // DataType + GL_BYTE = $1400; + GL_UNSIGNED_BYTE = $1401; + GL_SHORT = $1402; + GL_UNSIGNED_SHORT = $1403; + GL_INT = $1404; + GL_UNSIGNED_INT = $1405; + GL_FLOAT = $1406; + GL_2_BYTES = $1407; + GL_3_BYTES = $1408; + GL_4_BYTES = $1409; + GL_DOUBLE = $140A; + + // DepthFunction + // GL_NEVER + // GL_LESS + // GL_EQUAL + // GL_LEQUAL + // GL_GREATER + // GL_NOTEQUAL + // GL_GEQUAL + // GL_ALWAYS + + // DrawBufferMode + GL_NONE = 0; + GL_FRONT_LEFT = $0400; + GL_FRONT_RIGHT = $0401; + GL_BACK_LEFT = $0402; + GL_BACK_RIGHT = $0403; + GL_FRONT = $0404; + GL_BACK = $0405; + GL_LEFT = $0406; + GL_RIGHT = $0407; + GL_FRONT_AND_BACK = $0408; + GL_AUX0 = $0409; + GL_AUX1 = $040A; + GL_AUX2 = $040B; + GL_AUX3 = $040C; + + // Enable + // GL_FOG + // GL_LIGHTING + // GL_TEXTURE_1D + // GL_TEXTURE_2D + // GL_LINE_STIPPLE + // GL_POLYGON_STIPPLE + // GL_CULL_FACE + // GL_ALPHA_TEST + // GL_BLEND + // GL_INDEX_LOGIC_OP + // GL_COLOR_LOGIC_OP + // GL_DITHER + // GL_STENCIL_TEST + // GL_DEPTH_TEST + // GL_CLIP_PLANE0 + // GL_CLIP_PLANE1 + // GL_CLIP_PLANE2 + // GL_CLIP_PLANE3 + // GL_CLIP_PLANE4 + // GL_CLIP_PLANE5 + // GL_LIGHT0 + // GL_LIGHT1 + // GL_LIGHT2 + // GL_LIGHT3 + // GL_LIGHT4 + // GL_LIGHT5 + // GL_LIGHT6 + // GL_LIGHT7 + // GL_TEXTURE_GEN_S + // GL_TEXTURE_GEN_T + // GL_TEXTURE_GEN_R + // GL_TEXTURE_GEN_Q + // GL_MAP1_VERTEX_3 + // GL_MAP1_VERTEX_4 + // GL_MAP1_COLOR_4 + // GL_MAP1_INDEX + // GL_MAP1_NORMAL + // GL_MAP1_TEXTURE_COORD_1 + // GL_MAP1_TEXTURE_COORD_2 + // GL_MAP1_TEXTURE_COORD_3 + // GL_MAP1_TEXTURE_COORD_4 + // GL_MAP2_VERTEX_3 + // GL_MAP2_VERTEX_4 + // GL_MAP2_COLOR_4 + // GL_MAP2_INDEX + // GL_MAP2_NORMAL + // GL_MAP2_TEXTURE_COORD_1 + // GL_MAP2_TEXTURE_COORD_2 + // GL_MAP2_TEXTURE_COORD_3 + // GL_MAP2_TEXTURE_COORD_4 + // GL_POINT_SMOOTH + // GL_LINE_SMOOTH + // GL_POLYGON_SMOOTH + // GL_SCISSOR_TEST + // GL_COLOR_MATERIAL + // GL_NORMALIZE + // GL_AUTO_NORMAL + // GL_VERTEX_ARRAY + // GL_NORMAL_ARRAY + // GL_COLOR_ARRAY + // GL_INDEX_ARRAY + // GL_TEXTURE_COORD_ARRAY + // GL_EDGE_FLAG_ARRAY + // GL_POLYGON_OFFSET_POINT + // GL_POLYGON_OFFSET_LINE + // GL_POLYGON_OFFSET_FILL + + // ErrorCode + GL_NO_ERROR = 0; + GL_INVALID_ENUM = $0500; + GL_INVALID_VALUE = $0501; + GL_INVALID_OPERATION = $0502; + GL_STACK_OVERFLOW = $0503; + GL_STACK_UNDERFLOW = $0504; + GL_OUT_OF_MEMORY = $0505; + + // FeedBackMode + GL_2D = $0600; + GL_3D = $0601; + GL_3D_COLOR = $0602; + GL_3D_COLOR_TEXTURE = $0603; + GL_4D_COLOR_TEXTURE = $0604; + + // FeedBackToken + GL_PASS_THROUGH_TOKEN = $0700; + GL_POINT_TOKEN = $0701; + GL_LINE_TOKEN = $0702; + GL_POLYGON_TOKEN = $0703; + GL_BITMAP_TOKEN = $0704; + GL_DRAW_PIXEL_TOKEN = $0705; + GL_COPY_PIXEL_TOKEN = $0706; + GL_LINE_RESET_TOKEN = $0707; + + // FogMode + // GL_LINEAR + GL_EXP = $0800; + GL_EXP2 = $0801; + + // FogParameter + // GL_FOG_COLOR + // GL_FOG_DENSITY + // GL_FOG_END + // GL_FOG_INDEX + // GL_FOG_MODE + // GL_FOG_START + + // FrontFaceDirection + GL_CW = $0900; + GL_CCW = $0901; + + // GetMapTarget + GL_COEFF = $0A00; + GL_ORDER = $0A01; + GL_DOMAIN = $0A02; + + // GetPixelMap + // GL_PIXEL_MAP_I_TO_I + // GL_PIXEL_MAP_S_TO_S + // GL_PIXEL_MAP_I_TO_R + // GL_PIXEL_MAP_I_TO_G + // GL_PIXEL_MAP_I_TO_B + // GL_PIXEL_MAP_I_TO_A + // GL_PIXEL_MAP_R_TO_R + // GL_PIXEL_MAP_G_TO_G + // GL_PIXEL_MAP_B_TO_B + // GL_PIXEL_MAP_A_TO_A + + // GetPointerTarget + // GL_VERTEX_ARRAY_POINTER + // GL_NORMAL_ARRAY_POINTER + // GL_COLOR_ARRAY_POINTER + // GL_INDEX_ARRAY_POINTER + // GL_TEXTURE_COORD_ARRAY_POINTER + // GL_EDGE_FLAG_ARRAY_POINTER + + // GetTarget + GL_CURRENT_COLOR = $0B00; + GL_CURRENT_INDEX = $0B01; + GL_CURRENT_NORMAL = $0B02; + GL_CURRENT_TEXTURE_COORDS = $0B03; + GL_CURRENT_RASTER_COLOR = $0B04; + GL_CURRENT_RASTER_INDEX = $0B05; + GL_CURRENT_RASTER_TEXTURE_COORDS = $0B06; + GL_CURRENT_RASTER_POSITION = $0B07; + GL_CURRENT_RASTER_POSITION_VALID = $0B08; + GL_CURRENT_RASTER_DISTANCE = $0B09; + GL_POINT_SMOOTH = $0B10; + GL_POINT_SIZE = $0B11; + GL_POINT_SIZE_RANGE = $0B12; + GL_POINT_SIZE_GRANULARITY = $0B13; + GL_LINE_SMOOTH = $0B20; + GL_LINE_WIDTH = $0B21; + GL_LINE_WIDTH_RANGE = $0B22; + GL_LINE_WIDTH_GRANULARITY = $0B23; + GL_LINE_STIPPLE = $0B24; + GL_LINE_STIPPLE_PATTERN = $0B25; + GL_LINE_STIPPLE_REPEAT = $0B26; + GL_LIST_MODE = $0B30; + GL_MAX_LIST_NESTING = $0B31; + GL_LIST_BASE = $0B32; + GL_LIST_INDEX = $0B33; + GL_POLYGON_MODE = $0B40; + GL_POLYGON_SMOOTH = $0B41; + GL_POLYGON_STIPPLE = $0B42; + GL_EDGE_FLAG = $0B43; + GL_CULL_FACE = $0B44; + GL_CULL_FACE_MODE = $0B45; + GL_FRONT_FACE = $0B46; + GL_LIGHTING = $0B50; + GL_LIGHT_MODEL_LOCAL_VIEWER = $0B51; + GL_LIGHT_MODEL_TWO_SIDE = $0B52; + GL_LIGHT_MODEL_AMBIENT = $0B53; + GL_SHADE_MODEL = $0B54; + GL_COLOR_MATERIAL_FACE = $0B55; + GL_COLOR_MATERIAL_PARAMETER = $0B56; + GL_COLOR_MATERIAL = $0B57; + GL_FOG = $0B60; + GL_FOG_INDEX = $0B61; + GL_FOG_DENSITY = $0B62; + GL_FOG_START = $0B63; + GL_FOG_END = $0B64; + GL_FOG_MODE = $0B65; + GL_FOG_COLOR = $0B66; + GL_DEPTH_RANGE = $0B70; + GL_DEPTH_TEST = $0B71; + GL_DEPTH_WRITEMASK = $0B72; + GL_DEPTH_CLEAR_VALUE = $0B73; + GL_DEPTH_FUNC = $0B74; + GL_ACCUM_CLEAR_VALUE = $0B80; + GL_STENCIL_TEST = $0B90; + GL_STENCIL_CLEAR_VALUE = $0B91; + GL_STENCIL_FUNC = $0B92; + GL_STENCIL_VALUE_MASK = $0B93; + GL_STENCIL_FAIL = $0B94; + GL_STENCIL_PASS_DEPTH_FAIL = $0B95; + GL_STENCIL_PASS_DEPTH_PASS = $0B96; + GL_STENCIL_REF = $0B97; + GL_STENCIL_WRITEMASK = $0B98; + GL_MATRIX_MODE = $0BA0; + GL_NORMALIZE = $0BA1; + GL_VIEWPORT = $0BA2; + GL_MODELVIEW_STACK_DEPTH = $0BA3; + GL_PROJECTION_STACK_DEPTH = $0BA4; + GL_TEXTURE_STACK_DEPTH = $0BA5; + GL_MODELVIEW_MATRIX = $0BA6; + GL_PROJECTION_MATRIX = $0BA7; + GL_TEXTURE_MATRIX = $0BA8; + GL_ATTRIB_STACK_DEPTH = $0BB0; + GL_CLIENT_ATTRIB_STACK_DEPTH = $0BB1; + GL_ALPHA_TEST = $0BC0; + GL_ALPHA_TEST_FUNC = $0BC1; + GL_ALPHA_TEST_REF = $0BC2; + GL_DITHER = $0BD0; + GL_BLEND_DST = $0BE0; + GL_BLEND_SRC = $0BE1; + GL_BLEND = $0BE2; + GL_LOGIC_OP_MODE = $0BF0; + GL_INDEX_LOGIC_OP = $0BF1; + GL_COLOR_LOGIC_OP = $0BF2; + GL_AUX_BUFFERS = $0C00; + GL_DRAW_BUFFER = $0C01; + GL_READ_BUFFER = $0C02; + GL_SCISSOR_BOX = $0C10; + GL_SCISSOR_TEST = $0C11; + GL_INDEX_CLEAR_VALUE = $0C20; + GL_INDEX_WRITEMASK = $0C21; + GL_COLOR_CLEAR_VALUE = $0C22; + GL_COLOR_WRITEMASK = $0C23; + GL_INDEX_MODE = $0C30; + GL_RGBA_MODE = $0C31; + GL_DOUBLEBUFFER = $0C32; + GL_STEREO = $0C33; + GL_RENDER_MODE = $0C40; + GL_PERSPECTIVE_CORRECTION_HINT = $0C50; + GL_POINT_SMOOTH_HINT = $0C51; + GL_LINE_SMOOTH_HINT = $0C52; + GL_POLYGON_SMOOTH_HINT = $0C53; + GL_FOG_HINT = $0C54; + GL_TEXTURE_GEN_S = $0C60; + GL_TEXTURE_GEN_T = $0C61; + GL_TEXTURE_GEN_R = $0C62; + GL_TEXTURE_GEN_Q = $0C63; + GL_PIXEL_MAP_I_TO_I = $0C70; + GL_PIXEL_MAP_S_TO_S = $0C71; + GL_PIXEL_MAP_I_TO_R = $0C72; + GL_PIXEL_MAP_I_TO_G = $0C73; + GL_PIXEL_MAP_I_TO_B = $0C74; + GL_PIXEL_MAP_I_TO_A = $0C75; + GL_PIXEL_MAP_R_TO_R = $0C76; + GL_PIXEL_MAP_G_TO_G = $0C77; + GL_PIXEL_MAP_B_TO_B = $0C78; + GL_PIXEL_MAP_A_TO_A = $0C79; + GL_PIXEL_MAP_I_TO_I_SIZE = $0CB0; + GL_PIXEL_MAP_S_TO_S_SIZE = $0CB1; + GL_PIXEL_MAP_I_TO_R_SIZE = $0CB2; + GL_PIXEL_MAP_I_TO_G_SIZE = $0CB3; + GL_PIXEL_MAP_I_TO_B_SIZE = $0CB4; + GL_PIXEL_MAP_I_TO_A_SIZE = $0CB5; + GL_PIXEL_MAP_R_TO_R_SIZE = $0CB6; + GL_PIXEL_MAP_G_TO_G_SIZE = $0CB7; + GL_PIXEL_MAP_B_TO_B_SIZE = $0CB8; + GL_PIXEL_MAP_A_TO_A_SIZE = $0CB9; + GL_UNPACK_SWAP_BYTES = $0CF0; + GL_UNPACK_LSB_FIRST = $0CF1; + GL_UNPACK_ROW_LENGTH = $0CF2; + GL_UNPACK_SKIP_ROWS = $0CF3; + GL_UNPACK_SKIP_PIXELS = $0CF4; + GL_UNPACK_ALIGNMENT = $0CF5; + GL_PACK_SWAP_BYTES = $0D00; + GL_PACK_LSB_FIRST = $0D01; + GL_PACK_ROW_LENGTH = $0D02; + GL_PACK_SKIP_ROWS = $0D03; + GL_PACK_SKIP_PIXELS = $0D04; + GL_PACK_ALIGNMENT = $0D05; + GL_MAP_COLOR = $0D10; + GL_MAP_STENCIL = $0D11; + GL_INDEX_SHIFT = $0D12; + GL_INDEX_OFFSET = $0D13; + GL_RED_SCALE = $0D14; + GL_RED_BIAS = $0D15; + GL_ZOOM_X = $0D16; + GL_ZOOM_Y = $0D17; + GL_GREEN_SCALE = $0D18; + GL_GREEN_BIAS = $0D19; + GL_BLUE_SCALE = $0D1A; + GL_BLUE_BIAS = $0D1B; + GL_ALPHA_SCALE = $0D1C; + GL_ALPHA_BIAS = $0D1D; + GL_DEPTH_SCALE = $0D1E; + GL_DEPTH_BIAS = $0D1F; + GL_MAX_EVAL_ORDER = $0D30; + GL_MAX_LIGHTS = $0D31; + GL_MAX_CLIP_PLANES = $0D32; + GL_MAX_TEXTURE_SIZE = $0D33; + GL_MAX_PIXEL_MAP_TABLE = $0D34; + GL_MAX_ATTRIB_STACK_DEPTH = $0D35; + GL_MAX_MODELVIEW_STACK_DEPTH = $0D36; + GL_MAX_NAME_STACK_DEPTH = $0D37; + GL_MAX_PROJECTION_STACK_DEPTH = $0D38; + GL_MAX_TEXTURE_STACK_DEPTH = $0D39; + GL_MAX_VIEWPORT_DIMS = $0D3A; + GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = $0D3B; + GL_SUBPIXEL_BITS = $0D50; + GL_INDEX_BITS = $0D51; + GL_RED_BITS = $0D52; + GL_GREEN_BITS = $0D53; + GL_BLUE_BITS = $0D54; + GL_ALPHA_BITS = $0D55; + GL_DEPTH_BITS = $0D56; + GL_STENCIL_BITS = $0D57; + GL_ACCUM_RED_BITS = $0D58; + GL_ACCUM_GREEN_BITS = $0D59; + GL_ACCUM_BLUE_BITS = $0D5A; + GL_ACCUM_ALPHA_BITS = $0D5B; + GL_NAME_STACK_DEPTH = $0D70; + GL_AUTO_NORMAL = $0D80; + GL_MAP1_COLOR_4 = $0D90; + GL_MAP1_INDEX = $0D91; + GL_MAP1_NORMAL = $0D92; + GL_MAP1_TEXTURE_COORD_1 = $0D93; + GL_MAP1_TEXTURE_COORD_2 = $0D94; + GL_MAP1_TEXTURE_COORD_3 = $0D95; + GL_MAP1_TEXTURE_COORD_4 = $0D96; + GL_MAP1_VERTEX_3 = $0D97; + GL_MAP1_VERTEX_4 = $0D98; + GL_MAP2_COLOR_4 = $0DB0; + GL_MAP2_INDEX = $0DB1; + GL_MAP2_NORMAL = $0DB2; + GL_MAP2_TEXTURE_COORD_1 = $0DB3; + GL_MAP2_TEXTURE_COORD_2 = $0DB4; + GL_MAP2_TEXTURE_COORD_3 = $0DB5; + GL_MAP2_TEXTURE_COORD_4 = $0DB6; + GL_MAP2_VERTEX_3 = $0DB7; + GL_MAP2_VERTEX_4 = $0DB8; + GL_MAP1_GRID_DOMAIN = $0DD0; + GL_MAP1_GRID_SEGMENTS = $0DD1; + GL_MAP2_GRID_DOMAIN = $0DD2; + GL_MAP2_GRID_SEGMENTS = $0DD3; + GL_TEXTURE_1D = $0DE0; + GL_TEXTURE_2D = $0DE1; + GL_FEEDBACK_BUFFER_POINTER = $0DF0; + GL_FEEDBACK_BUFFER_SIZE = $0DF1; + GL_FEEDBACK_BUFFER_TYPE = $0DF2; + GL_SELECTION_BUFFER_POINTER = $0DF3; + GL_SELECTION_BUFFER_SIZE = $0DF4; + // GL_TEXTURE_BINDING_1D + // GL_TEXTURE_BINDING_2D + // GL_VERTEX_ARRAY + // GL_NORMAL_ARRAY + // GL_COLOR_ARRAY + // GL_INDEX_ARRAY + // GL_TEXTURE_COORD_ARRAY + // GL_EDGE_FLAG_ARRAY + // GL_VERTEX_ARRAY_SIZE + // GL_VERTEX_ARRAY_TYPE + // GL_VERTEX_ARRAY_STRIDE + // GL_NORMAL_ARRAY_TYPE + // GL_NORMAL_ARRAY_STRIDE + // GL_COLOR_ARRAY_SIZE + // GL_COLOR_ARRAY_TYPE + // GL_COLOR_ARRAY_STRIDE + // GL_INDEX_ARRAY_TYPE + // GL_INDEX_ARRAY_STRIDE + // GL_TEXTURE_COORD_ARRAY_SIZE + // GL_TEXTURE_COORD_ARRAY_TYPE + // GL_TEXTURE_COORD_ARRAY_STRIDE + // GL_EDGE_FLAG_ARRAY_STRIDE + // GL_POLYGON_OFFSET_FACTOR + // GL_POLYGON_OFFSET_UNITS + + // GetTextureParameter + // GL_TEXTURE_MAG_FILTER + // GL_TEXTURE_MIN_FILTER + // GL_TEXTURE_WRAP_S + // GL_TEXTURE_WRAP_T + GL_TEXTURE_WIDTH = $1000; + GL_TEXTURE_HEIGHT = $1001; + GL_TEXTURE_INTERNAL_FORMAT = $1003; + GL_TEXTURE_BORDER_COLOR = $1004; + GL_TEXTURE_BORDER = $1005; + // GL_TEXTURE_RED_SIZE + // GL_TEXTURE_GREEN_SIZE + // GL_TEXTURE_BLUE_SIZE + // GL_TEXTURE_ALPHA_SIZE + // GL_TEXTURE_LUMINANCE_SIZE + // GL_TEXTURE_INTENSITY_SIZE + // GL_TEXTURE_PRIORITY + // GL_TEXTURE_RESIDENT + + // HintMode + GL_DONT_CARE = $1100; + GL_FASTEST = $1101; + GL_NICEST = $1102; + + // HintTarget + // GL_PERSPECTIVE_CORRECTION_HINT + // GL_POINT_SMOOTH_HINT + // GL_LINE_SMOOTH_HINT + // GL_POLYGON_SMOOTH_HINT + // GL_FOG_HINT + + // IndexPointerType + // GL_SHORT + // GL_INT + // GL_FLOAT + // GL_DOUBLE + + // LightModelParameter + // GL_LIGHT_MODEL_AMBIENT + // GL_LIGHT_MODEL_LOCAL_VIEWER + // GL_LIGHT_MODEL_TWO_SIDE + + // LightName + GL_LIGHT0 = $4000; + GL_LIGHT1 = $4001; + GL_LIGHT2 = $4002; + GL_LIGHT3 = $4003; + GL_LIGHT4 = $4004; + GL_LIGHT5 = $4005; + GL_LIGHT6 = $4006; + GL_LIGHT7 = $4007; + + // LightParameter + GL_AMBIENT = $1200; + GL_DIFFUSE = $1201; + GL_SPECULAR = $1202; + GL_POSITION = $1203; + GL_SPOT_DIRECTION = $1204; + GL_SPOT_EXPONENT = $1205; + GL_SPOT_CUTOFF = $1206; + GL_CONSTANT_ATTENUATION = $1207; + GL_LINEAR_ATTENUATION = $1208; + GL_QUADRATIC_ATTENUATION = $1209; + + // InterleavedArrays + // GL_V2F + // GL_V3F + // GL_C4UB_V2F + // GL_C4UB_V3F + // GL_C3F_V3F + // GL_N3F_V3F + // GL_C4F_N3F_V3F + // GL_T2F_V3F + // GL_T4F_V4F + // GL_T2F_C4UB_V3F + // GL_T2F_C3F_V3F + // GL_T2F_N3F_V3F + // GL_T2F_C4F_N3F_V3F + // GL_T4F_C4F_N3F_V4F + + // ListMode + GL_COMPILE = $1300; + GL_COMPILE_AND_EXECUTE = $1301; + + // ListNameType + // GL_BYTE + // GL_UNSIGNED_BYTE + // GL_SHORT + // GL_UNSIGNED_SHORT + // GL_INT + // GL_UNSIGNED_INT + // GL_FLOAT + // GL_2_BYTES + // GL_3_BYTES + // GL_4_BYTES + + // LogicOp + GL_CLEAR = $1500; + GL_AND = $1501; + GL_AND_REVERSE = $1502; + GL_COPY = $1503; + GL_AND_INVERTED = $1504; + GL_NOOP = $1505; + GL_XOR = $1506; + GL_OR = $1507; + GL_NOR = $1508; + GL_EQUIV = $1509; + GL_INVERT = $150A; + GL_OR_REVERSE = $150B; + GL_COPY_INVERTED = $150C; + GL_OR_INVERTED = $150D; + GL_NAND = $150E; + GL_SET = $150F; + + // MapTarget + // GL_MAP1_COLOR_4 + // GL_MAP1_INDEX + // GL_MAP1_NORMAL + // GL_MAP1_TEXTURE_COORD_1 + // GL_MAP1_TEXTURE_COORD_2 + // GL_MAP1_TEXTURE_COORD_3 + // GL_MAP1_TEXTURE_COORD_4 + // GL_MAP1_VERTEX_3 + // GL_MAP1_VERTEX_4 + // GL_MAP2_COLOR_4 + // GL_MAP2_INDEX + // GL_MAP2_NORMAL + // GL_MAP2_TEXTURE_COORD_1 + // GL_MAP2_TEXTURE_COORD_2 + // GL_MAP2_TEXTURE_COORD_3 + // GL_MAP2_TEXTURE_COORD_4 + // GL_MAP2_VERTEX_3 + // GL_MAP2_VERTEX_4 + + // MaterialFace + // GL_FRONT + // GL_BACK + // GL_FRONT_AND_BACK + + // MaterialParameter + GL_EMISSION = $1600; + GL_SHININESS = $1601; + GL_AMBIENT_AND_DIFFUSE = $1602; + GL_COLOR_INDEXES = $1603; + // GL_AMBIENT + // GL_DIFFUSE + // GL_SPECULAR + + // MatrixMode + GL_MODELVIEW = $1700; + GL_PROJECTION = $1701; + GL_TEXTURE = $1702; + + // MeshMode1 + // GL_POINT + // GL_LINE + + // MeshMode2 + // GL_POINT + // GL_LINE + // GL_FILL + + // NormalPointerType + // GL_BYTE + // GL_SHORT + // GL_INT + // GL_FLOAT + // GL_DOUBLE + + // PixelCopyType + GL_COLOR = $1800; + GL_DEPTH = $1801; + GL_STENCIL = $1802; + + // PixelFormat + GL_COLOR_INDEX = $1900; + GL_STENCIL_INDEX = $1901; + GL_DEPTH_COMPONENT = $1902; + GL_RED = $1903; + GL_GREEN = $1904; + GL_BLUE = $1905; + GL_ALPHA = $1906; + GL_RGB = $1907; + GL_RGBA = $1908; + GL_LUMINANCE = $1909; + GL_LUMINANCE_ALPHA = $190A; + + // PixelMap + // GL_PIXEL_MAP_I_TO_I + // GL_PIXEL_MAP_S_TO_S + // GL_PIXEL_MAP_I_TO_R + // GL_PIXEL_MAP_I_TO_G + // GL_PIXEL_MAP_I_TO_B + // GL_PIXEL_MAP_I_TO_A + // GL_PIXEL_MAP_R_TO_R + // GL_PIXEL_MAP_G_TO_G + // GL_PIXEL_MAP_B_TO_B + // GL_PIXEL_MAP_A_TO_A + + // PixelStore + // GL_UNPACK_SWAP_BYTES + // GL_UNPACK_LSB_FIRST + // GL_UNPACK_ROW_LENGTH + // GL_UNPACK_SKIP_ROWS + // GL_UNPACK_SKIP_PIXELS + // GL_UNPACK_ALIGNMENT + // GL_PACK_SWAP_BYTES + // GL_PACK_LSB_FIRST + // GL_PACK_ROW_LENGTH + // GL_PACK_SKIP_ROWS + // GL_PACK_SKIP_PIXELS + // GL_PACK_ALIGNMENT + + // PixelTransfer + // GL_MAP_COLOR + // GL_MAP_STENCIL + // GL_INDEX_SHIFT + // GL_INDEX_OFFSET + // GL_RED_SCALE + // GL_RED_BIAS + // GL_GREEN_SCALE + // GL_GREEN_BIAS + // GL_BLUE_SCALE + // GL_BLUE_BIAS + // GL_ALPHA_SCALE + // GL_ALPHA_BIAS + // GL_DEPTH_SCALE + // GL_DEPTH_BIAS + + // PixelType + GL_BITMAP = $1A00; + // GL_BYTE + // GL_UNSIGNED_BYTE + // GL_SHORT + // GL_UNSIGNED_SHORT + // GL_INT + // GL_UNSIGNED_INT + // GL_FLOAT + + // PolygonMode + GL_POINT = $1B00; + GL_LINE = $1B01; + GL_FILL = $1B02; + + // ReadBufferMode + // GL_FRONT_LEFT + // GL_FRONT_RIGHT + // GL_BACK_LEFT + // GL_BACK_RIGHT + // GL_FRONT + // GL_BACK + // GL_LEFT + // GL_RIGHT + // GL_AUX0 + // GL_AUX1 + // GL_AUX2 + // GL_AUX3 + + // RenderingMode + GL_RENDER = $1C00; + GL_FEEDBACK = $1C01; + GL_SELECT = $1C02; + + // ShadingModel + GL_FLAT = $1D00; + GL_SMOOTH = $1D01; + + // StencilFunction + // GL_NEVER + // GL_LESS + // GL_EQUAL + // GL_LEQUAL + // GL_GREATER + // GL_NOTEQUAL + // GL_GEQUAL + // GL_ALWAYS + + // StencilOp + // GL_ZERO + GL_KEEP = $1E00; + GL_REPLACE = $1E01; + GL_INCR = $1E02; + GL_DECR = $1E03; + // GL_INVERT + + // StringName + GL_VENDOR = $1F00; + GL_RENDERER = $1F01; + GL_VERSION = $1F02; + GL_EXTENSIONS = $1F03; + + // TextureCoordName + GL_S = $2000; + GL_T = $2001; + GL_R = $2002; + GL_Q = $2003; + + // TexCoordPointerType + // GL_SHORT + // GL_INT + // GL_FLOAT + // GL_DOUBLE + + // TextureEnvMode + GL_MODULATE = $2100; + GL_DECAL = $2101; + // GL_BLEND + // GL_REPLACE + + // TextureEnvParameter + GL_TEXTURE_ENV_MODE = $2200; + GL_TEXTURE_ENV_COLOR = $2201; + + // TextureEnvTarget + GL_TEXTURE_ENV = $2300; + + // TextureGenMode + GL_EYE_LINEAR = $2400; + GL_OBJECT_LINEAR = $2401; + GL_SPHERE_MAP = $2402; + + // TextureGenParameter + GL_TEXTURE_GEN_MODE = $2500; + GL_OBJECT_PLANE = $2501; + GL_EYE_PLANE = $2502; + + // TextureMagFilter + GL_NEAREST = $2600; + GL_LINEAR = $2601; + + // TextureMinFilter + // GL_NEAREST + // GL_LINEAR + GL_NEAREST_MIPMAP_NEAREST = $2700; + GL_LINEAR_MIPMAP_NEAREST = $2701; + GL_NEAREST_MIPMAP_LINEAR = $2702; + GL_LINEAR_MIPMAP_LINEAR = $2703; + + // TextureParameterName + GL_TEXTURE_MAG_FILTER = $2800; + GL_TEXTURE_MIN_FILTER = $2801; + GL_TEXTURE_WRAP_S = $2802; + GL_TEXTURE_WRAP_T = $2803; + // GL_TEXTURE_BORDER_COLOR + // GL_TEXTURE_PRIORITY + + // TextureTarget + // GL_TEXTURE_1D + // GL_TEXTURE_2D + // GL_PROXY_TEXTURE_1D + // GL_PROXY_TEXTURE_2D + + // TextureWrapMode + GL_CLAMP = $2900; + GL_REPEAT = $2901; + + // VertexPointerType + // GL_SHORT + // GL_INT + // GL_FLOAT + // GL_DOUBLE + + // ClientAttribMask + GL_CLIENT_PIXEL_STORE_BIT = $00000001; + GL_CLIENT_VERTEX_ARRAY_BIT = $00000002; + GL_CLIENT_ALL_ATTRIB_BITS = $FFFFFFFF; + + // polygon_offset + GL_POLYGON_OFFSET_FACTOR = $8038; + GL_POLYGON_OFFSET_UNITS = $2A00; + GL_POLYGON_OFFSET_POINT = $2A01; + GL_POLYGON_OFFSET_LINE = $2A02; + GL_POLYGON_OFFSET_FILL = $8037; + + // texture + GL_ALPHA4 = $803B; + GL_ALPHA8 = $803C; + GL_ALPHA12 = $803D; + GL_ALPHA16 = $803E; + GL_LUMINANCE4 = $803F; + GL_LUMINANCE8 = $8040; + GL_LUMINANCE12 = $8041; + GL_LUMINANCE16 = $8042; + GL_LUMINANCE4_ALPHA4 = $8043; + GL_LUMINANCE6_ALPHA2 = $8044; + GL_LUMINANCE8_ALPHA8 = $8045; + GL_LUMINANCE12_ALPHA4 = $8046; + GL_LUMINANCE12_ALPHA12 = $8047; + GL_LUMINANCE16_ALPHA16 = $8048; + GL_INTENSITY = $8049; + GL_INTENSITY4 = $804A; + GL_INTENSITY8 = $804B; + GL_INTENSITY12 = $804C; + GL_INTENSITY16 = $804D; + GL_R3_G3_B2 = $2A10; + GL_RGB4 = $804F; + GL_RGB5 = $8050; + GL_RGB8 = $8051; + GL_RGB10 = $8052; + GL_RGB12 = $8053; + GL_RGB16 = $8054; + GL_RGBA2 = $8055; + GL_RGBA4 = $8056; + GL_RGB5_A1 = $8057; + GL_RGBA8 = $8058; + GL_RGB10_A2 = $8059; + GL_RGBA12 = $805A; + GL_RGBA16 = $805B; + GL_TEXTURE_RED_SIZE = $805C; + GL_TEXTURE_GREEN_SIZE = $805D; + GL_TEXTURE_BLUE_SIZE = $805E; + GL_TEXTURE_ALPHA_SIZE = $805F; + GL_TEXTURE_LUMINANCE_SIZE = $8060; + GL_TEXTURE_INTENSITY_SIZE = $8061; + GL_PROXY_TEXTURE_1D = $8063; + GL_PROXY_TEXTURE_2D = $8064; + + // texture_object + GL_TEXTURE_PRIORITY = $8066; + GL_TEXTURE_RESIDENT = $8067; + GL_TEXTURE_BINDING_1D = $8068; + GL_TEXTURE_BINDING_2D = $8069; + + // vertex_array + GL_VERTEX_ARRAY = $8074; + GL_NORMAL_ARRAY = $8075; + GL_COLOR_ARRAY = $8076; + GL_INDEX_ARRAY = $8077; + GL_TEXTURE_COORD_ARRAY = $8078; + GL_EDGE_FLAG_ARRAY = $8079; + GL_VERTEX_ARRAY_SIZE = $807A; + GL_VERTEX_ARRAY_TYPE = $807B; + GL_VERTEX_ARRAY_STRIDE = $807C; + GL_NORMAL_ARRAY_TYPE = $807E; + GL_NORMAL_ARRAY_STRIDE = $807F; + GL_COLOR_ARRAY_SIZE = $8081; + GL_COLOR_ARRAY_TYPE = $8082; + GL_COLOR_ARRAY_STRIDE = $8083; + GL_INDEX_ARRAY_TYPE = $8085; + GL_INDEX_ARRAY_STRIDE = $8086; + GL_TEXTURE_COORD_ARRAY_SIZE = $8088; + GL_TEXTURE_COORD_ARRAY_TYPE = $8089; + GL_TEXTURE_COORD_ARRAY_STRIDE = $808A; + GL_EDGE_FLAG_ARRAY_STRIDE = $808C; + GL_VERTEX_ARRAY_POINTER = $808E; + GL_NORMAL_ARRAY_POINTER = $808F; + GL_COLOR_ARRAY_POINTER = $8090; + GL_INDEX_ARRAY_POINTER = $8091; + GL_TEXTURE_COORD_ARRAY_POINTER = $8092; + GL_EDGE_FLAG_ARRAY_POINTER = $8093; + GL_V2F = $2A20; + GL_V3F = $2A21; + GL_C4UB_V2F = $2A22; + GL_C4UB_V3F = $2A23; + GL_C3F_V3F = $2A24; + GL_N3F_V3F = $2A25; + GL_C4F_N3F_V3F = $2A26; + GL_T2F_V3F = $2A27; + GL_T4F_V4F = $2A28; + GL_T2F_C4UB_V3F = $2A29; + GL_T2F_C3F_V3F = $2A2A; + GL_T2F_N3F_V3F = $2A2B; + GL_T2F_C4F_N3F_V3F = $2A2C; + GL_T4F_C4F_N3F_V4F = $2A2D; + + // Extensions + GL_EXT_vertex_array = 1; + GL_WIN_swap_hint = 1; + GL_EXT_bgra = 1; + GL_EXT_paletted_texture = 1; + + // EXT_vertex_array + GL_VERTEX_ARRAY_EXT = $8074; + GL_NORMAL_ARRAY_EXT = $8075; + GL_COLOR_ARRAY_EXT = $8076; + GL_INDEX_ARRAY_EXT = $8077; + GL_TEXTURE_COORD_ARRAY_EXT = $8078; + GL_EDGE_FLAG_ARRAY_EXT = $8079; + GL_VERTEX_ARRAY_SIZE_EXT = $807A; + GL_VERTEX_ARRAY_TYPE_EXT = $807B; + GL_VERTEX_ARRAY_STRIDE_EXT = $807C; + GL_VERTEX_ARRAY_COUNT_EXT = $807D; + GL_NORMAL_ARRAY_TYPE_EXT = $807E; + GL_NORMAL_ARRAY_STRIDE_EXT = $807F; + GL_NORMAL_ARRAY_COUNT_EXT = $8080; + GL_COLOR_ARRAY_SIZE_EXT = $8081; + GL_COLOR_ARRAY_TYPE_EXT = $8082; + GL_COLOR_ARRAY_STRIDE_EXT = $8083; + GL_COLOR_ARRAY_COUNT_EXT = $8084; + GL_INDEX_ARRAY_TYPE_EXT = $8085; + GL_INDEX_ARRAY_STRIDE_EXT = $8086; + GL_INDEX_ARRAY_COUNT_EXT = $8087; + GL_TEXTURE_COORD_ARRAY_SIZE_EXT = $8088; + GL_TEXTURE_COORD_ARRAY_TYPE_EXT = $8089; + GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = $808A; + GL_TEXTURE_COORD_ARRAY_COUNT_EXT = $808B; + GL_EDGE_FLAG_ARRAY_STRIDE_EXT = $808C; + GL_EDGE_FLAG_ARRAY_COUNT_EXT = $808D; + GL_VERTEX_ARRAY_POINTER_EXT = $808E; + GL_NORMAL_ARRAY_POINTER_EXT = $808F; + GL_COLOR_ARRAY_POINTER_EXT = $8090; + GL_INDEX_ARRAY_POINTER_EXT = $8091; + GL_TEXTURE_COORD_ARRAY_POINTER_EXT = $8092; + GL_EDGE_FLAG_ARRAY_POINTER_EXT = $8093; + GL_DOUBLE_EXT = GL_DOUBLE; + + // EXT_bgra + GL_BGR_EXT = $80E0; + GL_BGRA_EXT = $80E1; + + // EXT_paletted_texture + + // These must match the GL_COLOR_TABLE_*_SGI enumerants + GL_COLOR_TABLE_FORMAT_EXT = $80D8; + GL_COLOR_TABLE_WIDTH_EXT = $80D9; + GL_COLOR_TABLE_RED_SIZE_EXT = $80DA; + GL_COLOR_TABLE_GREEN_SIZE_EXT = $80DB; + GL_COLOR_TABLE_BLUE_SIZE_EXT = $80DC; + GL_COLOR_TABLE_ALPHA_SIZE_EXT = $80DD; + GL_COLOR_TABLE_LUMINANCE_SIZE_EXT = $80DE; + GL_COLOR_TABLE_INTENSITY_SIZE_EXT = $80DF; + + GL_COLOR_INDEX1_EXT = $80E2; + GL_COLOR_INDEX2_EXT = $80E3; + GL_COLOR_INDEX4_EXT = $80E4; + GL_COLOR_INDEX8_EXT = $80E5; + GL_COLOR_INDEX12_EXT = $80E6; + GL_COLOR_INDEX16_EXT = $80E7; + + // For compatibility with OpenGL v1.0 + GL_LOGIC_OP = GL_INDEX_LOGIC_OP; + GL_TEXTURE_COMPONENTS = GL_TEXTURE_INTERNAL_FORMAT; + +{******************************************************************************} + +var + glAccum: procedure(op: GLenum; value: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glAlphaFunc: procedure(func: GLenum; ref: GLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glAreTexturesResident: function (n: GLsizei; const textures: PGLuint; residences: PGLboolean): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glArrayElement: procedure(i: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBegin: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindTexture: procedure(target: GLenum; texture: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBitmap: procedure (width, height: GLsizei; xorig, yorig: GLfloat; xmove, ymove: GLfloat; const bitmap: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBlendFunc: procedure(sfactor, dfactor: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCallList: procedure(list: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCallLists: procedure(n: GLsizei; atype: GLenum; const lists: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glClear: procedure(mask: GLbitfield); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glClearAccum: procedure(red, green, blue, alpha: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glClearColor: procedure(red, green, blue, alpha: GLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glClearDepth: procedure(depth: GLclampd); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glClearIndex: procedure(c: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glClearStencil: procedure(s: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glClipPlane: procedure(plane: GLenum; const equation: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3b: procedure(red, green, blue: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3bv: procedure(const v: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3d: procedure(red, green, blue: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3f: procedure(red, green, blue: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3i: procedure(red, green, blue: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3s: procedure(red, green, blue: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3ub: procedure(red, green, blue: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3ubv: procedure(const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3ui: procedure(red, green, blue: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3uiv: procedure(const v: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3us: procedure(red, green, blue: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3usv: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4b: procedure(red, green, blue, alpha: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4bv: procedure(const v: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4d: procedure(red, green, blue, alpha: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4f: procedure(red, green, blue, alpha: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4i: procedure(red, green, blue, alpha: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4s: procedure(red, green, blue, alpha: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4ub: procedure(red, green, blue, alpha: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4ubv: procedure(const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4ui: procedure(red, green, blue, alpha: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4uiv: procedure(const v: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4us: procedure(red, green, blue, alpha: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4usv: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorMask: procedure(red, green, blue, alpha: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorMaterial: procedure(face, mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorPointer: procedure(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyPixels: procedure(x, y: GLint; width, height: GLsizei; atype: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyTexImage1D: procedure (target: GLenum; level: GLint; internalFormat: GLenum; x, y: GLint; width: GLsizei; border: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyTexImage2D: procedure(target: GLenum; level: GLint; internalFormat: GLenum; x, y: GLint; width, height: GLsizei; border: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyTexSubImage1D: procedure(target: GLenum; level, xoffset, x, y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyTexSubImage2D: procedure(target: GLenum; level, xoffset, yoffset, x, y: GLint; width, height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCullFace: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteLists: procedure(list: GLuint; range: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteTextures: procedure(n: GLsizei; const textures: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDepthFunc: procedure(func: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDepthMask: procedure(flag: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDepthRange: procedure(zNear, zFar: GLclampd); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDisable: procedure(cap: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDisableClientState: procedure(aarray: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawArrays: procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawBuffer: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawElements: procedure(mode: GLenum; count: GLsizei; atype: GLenum; const indices: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawPixels: procedure(width, height: GLsizei; format, atype: GLenum; const pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEdgeFlag: procedure(flag: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEdgeFlagPointer: procedure(stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEdgeFlagv: procedure(const flag: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEnable: procedure(cap: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEnableClientState: procedure(aarray: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEnd: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEndList: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord1d: procedure(u: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord1dv: procedure(const u: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord1f: procedure(u: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord1fv: procedure(const u: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord2d: procedure(u, v: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord2dv: procedure(const u: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord2f: procedure(u, v: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord2fv: procedure(const u: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalMesh1: procedure(mode: GLenum; i1, i2: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalMesh2: procedure(mode: GLenum; i1, i2, j1, j2: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalPoint1: procedure(i: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalPoint2: procedure(i, j: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFeedbackBuffer: procedure(size: GLsizei; atype: GLenum; buffer: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFinish: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFlush: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogfv: procedure(pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogi: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogiv: procedure(pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFrontFace: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFrustum: procedure(left, right, bottom, top, zNear, zFar: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenLists: function(range: GLsizei): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenTextures: procedure(n: GLsizei; textures: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetBooleanv: procedure(pname: GLenum; params: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetClipPlane: procedure(plane: GLenum; equation: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetDoublev: procedure(pname: GLenum; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetError: function: GLenum; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetFloatv: procedure(pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetIntegerv: procedure(pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetLightfv: procedure(light, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetLightiv: procedure(light, pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapdv: procedure(target, query: GLenum; v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapfv: procedure(target, query: GLenum; v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapiv: procedure(target, query: GLenum; v: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMaterialfv: procedure(face, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMaterialiv: procedure(face, pname: GLenum; params: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPixelMapfv: procedure(map: GLenum; values: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPixelMapuiv: procedure(map: GLenum; values: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPixelMapusv: procedure(map: GLenum; values: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPointerv: procedure(pname: GLenum; params: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPolygonStipple: procedure(mask: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetString: function(name: GLenum): PChar; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexEnvfv: procedure(target, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexEnviv: procedure(target, pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexGendv: procedure(coord, pname: GLenum; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexGenfv: procedure(coord, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexGeniv: procedure(coord, pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexImage: procedure(target: GLenum; level: GLint; format: GLenum; atype: GLenum; pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexLevelParameterfv: procedure(target: GLenum; level: GLint; pname: GLenum; params: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexLevelParameteriv: procedure(target: GLenum; level: GLint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexParameterfv: procedure(target, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexParameteriv: procedure(target, pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glHint: procedure(target, mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexMask: procedure(mask: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexPointer: procedure(atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexd: procedure(c: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexdv: procedure(const c: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexf: procedure(c: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexfv: procedure(const c: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexi: procedure(c: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexiv: procedure(const c: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexs: procedure(c: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexsv: procedure(const c: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexub: procedure(c: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexubv: procedure(const c: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glInitNames: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glInterleavedArrays: procedure(format: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsEnabled: function(cap: GLenum): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsList: function(list: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsTexture: function(texture: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightModelf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightModelfv: procedure(pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightModeli: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightModeliv: procedure(pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightf: procedure(light, pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightfv: procedure(light, pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLighti: procedure(light, pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightiv: procedure(light, pname: GLenum; const params: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLineStipple: procedure(factor: GLint; pattern: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLineWidth: procedure(width: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glListBase: procedure(base: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadIdentity: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadMatrixd: procedure(const m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadMatrixf: procedure(const m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadName: procedure(name: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLogicOp: procedure(opcode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMap1d: procedure(target: GLenum; u1, u2: GLdouble; stride, order: GLint; const points: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMap1f: procedure(target: GLenum; u1, u2: GLfloat; stride, order: GLint; const points: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMap2d: procedure(target: GLenum; u1, u2: GLdouble; ustride, uorder: GLint; v1, v2: GLdouble; vstride, vorder: GLint; const points: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMap2f: procedure(target: GLenum; u1, u2: GLfloat; ustride, uorder: GLint; v1, v2: GLfloat; vstride, vorder: GLint; const points: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapGrid1d: procedure(un: GLint; u1, u2: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapGrid1f: procedure(un: GLint; u1, u2: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapGrid2d: procedure(un: GLint; u1, u2: GLdouble; vn: GLint; v1, v2: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapGrid2f: procedure(un: GLint; u1, u2: GLfloat; vn: GLint; v1, v2: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMaterialf: procedure(face, pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMaterialfv: procedure(face, pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMateriali: procedure(face, pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMaterialiv: procedure(face, pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMatrixMode: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultMatrixd: procedure(const m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultMatrixf: procedure(const m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNewList: procedure(list: GLuint; mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3b: procedure(nx, ny, nz: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3bv: procedure(const v: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3d: procedure(nx, ny, nz: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3f: procedure(nx, ny, nz: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3i: procedure(nx, ny, nz: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3s: procedure(nx, ny, nz: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalPointer: procedure(atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glOrtho: procedure(left, right, bottom, top, zNear, zFar: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPassThrough: procedure(token: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelMapfv: procedure(map: GLenum; mapsize: GLsizei; const values: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelMapuiv: procedure(map: GLenum; mapsize: GLsizei; const values: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelMapusv: procedure(map: GLenum; mapsize: GLsizei; const values: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelStoref: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelStorei: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelTransferf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelTransferi: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelZoom: procedure(xfactor, yfactor: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPointSize: procedure(size: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPolygonMode: procedure(face, mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPolygonOffset: procedure(factor, units: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPolygonStipple: procedure(const mask: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPopAttrib: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPopClientAttrib: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPopMatrix: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPopName: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPrioritizeTextures: procedure(n: GLsizei; const textures: PGLuint; const priorities: PGLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPushAttrib: procedure(mask: GLbitfield); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPushClientAttrib: procedure(mask: GLbitfield); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPushMatrix: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPushName: procedure(name: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2d: procedure(x, y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2f: procedure(x, y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2i: procedure(x, y: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2s: procedure(x, y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3d: procedure(x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3f: procedure(x, y, z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3i: procedure(x, y, z: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3s: procedure(x, y, z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4d: procedure(x, y, z, w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4f: procedure(x, y, z, w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4i: procedure(x, y, z, w: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4s: procedure(x, y, z, w: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReadBuffer: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReadPixels: procedure(x, y: GLint; width, height: GLsizei; format, atype: GLenum; pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRectd: procedure(x1, y1, x2, y2: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRectdv: procedure(const v1: PGLdouble; const v2: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRectf: procedure(x1, y1, x2, y2: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRectfv: procedure(const v1: PGLfloat; const v2: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRecti: procedure(x1, y1, x2, y2: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRectiv: procedure(const v1: PGLint; const v2: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRects: procedure(x1, y1, x2, y2: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRectsv: procedure(const v1: PGLshort; const v2: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRenderMode: function(mode: GLint): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRotated: procedure(angle, x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRotatef: procedure(angle, x, y, z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glScaled: procedure(x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glScalef: procedure(x, y, z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glScissor: procedure(x, y: GLint; width, height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSelectBuffer: procedure(size: GLsizei; buffer: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glShadeModel: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glStencilFunc: procedure(func: GLenum; ref: GLint; mask: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glStencilMask: procedure(mask: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glStencilOp: procedure(fail, zfail, zpass: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1d: procedure(s: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1f: procedure(s: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1i: procedure(s: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1s: procedure(s: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2d: procedure(s, t: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2f: procedure(s, t: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2i: procedure(s, t: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2s: procedure(s, t: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3d: procedure(s, t, r: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3f: procedure(s, t, r: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3i: procedure(s, t, r: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3s: procedure(s, t, r: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4d: procedure(s, t, r, q: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4f: procedure(s, t, r, q: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4i: procedure(s, t, r, q: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4s: procedure(s, t, r, q: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoordPointer: procedure(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexEnvf: procedure(target: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexEnvfv: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexEnvi: procedure(target: GLenum; pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexEnviv: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGend: procedure(coord: GLenum; pname: GLenum; param: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGendv: procedure(coord: GLenum; pname: GLenum; const params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGenf: procedure(coord: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGenfv: procedure(coord: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGeni: procedure(coord: GLenum; pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGeniv: procedure(coord: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexImage1D: procedure(target: GLenum; level, internalformat: GLint; width: GLsizei; border: GLint; format, atype: GLenum; const pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexImage2D: procedure(target: GLenum; level, internalformat: GLint; width, height: GLsizei; border: GLint; format, atype: GLenum; const pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexParameterf: procedure(target: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexParameterfv: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexParameteri: procedure(target: GLenum; pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexParameteriv: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexSubImage1D: procedure(target: GLenum; level, xoffset: GLint; width: GLsizei; format, atype: GLenum; const pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexSubImage2D: procedure(target: GLenum; level, xoffset, yoffset: GLint; width, height: GLsizei; format, atype: GLenum; const pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTranslated: procedure(x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTranslatef: procedure(x, y, z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2d: procedure(x, y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2f: procedure(x, y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2i: procedure(x, y: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2s: procedure(x, y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3d: procedure(x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3f: procedure(x, y, z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3i: procedure(x, y, z: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3s: procedure(x, y, z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4d: procedure(x, y, z, w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4f: procedure(x, y, z, w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4i: procedure(x, y, z, w: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4s: procedure(x, y, z, w: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexPointer: procedure(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glViewport: procedure(x, y: GLint; width, height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + {$IFDEF Win32} + ChoosePixelFormat: function(DC: HDC; p2: PPixelFormatDescriptor): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + {$ENDIF} + +type + // EXT_vertex_array + PFNGLARRAYELEMENTEXTPROC = procedure(i: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLDRAWARRAYSEXTPROC = procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLVERTEXPOINTEREXTPROC = procedure(size: GLint; atype: GLenum; + stride, count: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLNORMALPOINTEREXTPROC = procedure(atype: GLenum; stride, count: GLsizei; + const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLCOLORPOINTEREXTPROC = procedure(size: GLint; atype: GLenum; stride, count: GLsizei; + const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLINDEXPOINTEREXTPROC = procedure(atype: GLenum; stride, count: GLsizei; + const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLTEXCOORDPOINTEREXTPROC = procedure(size: GLint; atype: GLenum; + stride, count: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLEDGEFLAGPOINTEREXTPROC = procedure(stride, count: GLsizei; + const pointer: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLGETPOINTERVEXTPROC = procedure(pname: GLenum; params: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLARRAYELEMENTARRAYEXTPROC = procedure(mode: GLenum; count: GLsizei; + const pi: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + + // WIN_swap_hint + PFNGLADDSWAPHINTRECTWINPROC = procedure(x, y: GLint; width, height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + + // EXT_paletted_texture + PFNGLCOLORTABLEEXTPROC = procedure(target, internalFormat: GLenum; width: GLsizei; + format, atype: GLenum; const data: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLCOLORSUBTABLEEXTPROC = procedure(target: GLenum; start, count: GLsizei; + format, atype: GLenum; const data: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLGETCOLORTABLEEXTPROC = procedure(target, format, atype: GLenum; data: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLGETCOLORTABLEPARAMETERIVEXTPROC = procedure(target, pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLGETCOLORTABLEPARAMETERFVEXTPROC = procedure(target, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +procedure LoadOpenGL( const dll: PChar ); +procedure FreeOpenGL; + +implementation + +procedure FreeOpenGL; +begin + + @glAccum := nil; + @glAlphaFunc := nil; + @glAreTexturesResident := nil; + @glArrayElement := nil; + @glBegin := nil; + @glBindTexture := nil; + @glBitmap := nil; + @glBlendFunc := nil; + @glCallList := nil; + @glCallLists := nil; + @glClear := nil; + @glClearAccum := nil; + @glClearColor := nil; + @glClearDepth := nil; + @glClearIndex := nil; + @glClearStencil := nil; + @glClipPlane := nil; + @glColor3b := nil; + @glColor3bv := nil; + @glColor3d := nil; + @glColor3dv := nil; + @glColor3f := nil; + @glColor3fv := nil; + @glColor3i := nil; + @glColor3iv := nil; + @glColor3s := nil; + @glColor3sv := nil; + @glColor3ub := nil; + @glColor3ubv := nil; + @glColor3ui := nil; + @glColor3uiv := nil; + @glColor3us := nil; + @glColor3usv := nil; + @glColor4b := nil; + @glColor4bv := nil; + @glColor4d := nil; + @glColor4dv := nil; + @glColor4f := nil; + @glColor4fv := nil; + @glColor4i := nil; + @glColor4iv := nil; + @glColor4s := nil; + @glColor4sv := nil; + @glColor4ub := nil; + @glColor4ubv := nil; + @glColor4ui := nil; + @glColor4uiv := nil; + @glColor4us := nil; + @glColor4usv := nil; + @glColorMask := nil; + @glColorMaterial := nil; + @glColorPointer := nil; + @glCopyPixels := nil; + @glCopyTexImage1D := nil; + @glCopyTexImage2D := nil; + @glCopyTexSubImage1D := nil; + @glCopyTexSubImage2D := nil; + @glCullFace := nil; + @glDeleteLists := nil; + @glDeleteTextures := nil; + @glDepthFunc := nil; + @glDepthMask := nil; + @glDepthRange := nil; + @glDisable := nil; + @glDisableClientState := nil; + @glDrawArrays := nil; + @glDrawBuffer := nil; + @glDrawElements := nil; + @glDrawPixels := nil; + @glEdgeFlag := nil; + @glEdgeFlagPointer := nil; + @glEdgeFlagv := nil; + @glEnable := nil; + @glEnableClientState := nil; + @glEnd := nil; + @glEndList := nil; + @glEvalCoord1d := nil; + @glEvalCoord1dv := nil; + @glEvalCoord1f := nil; + @glEvalCoord1fv := nil; + @glEvalCoord2d := nil; + @glEvalCoord2dv := nil; + @glEvalCoord2f := nil; + @glEvalCoord2fv := nil; + @glEvalMesh1 := nil; + @glEvalMesh2 := nil; + @glEvalPoint1 := nil; + @glEvalPoint2 := nil; + @glFeedbackBuffer := nil; + @glFinish := nil; + @glFlush := nil; + @glFogf := nil; + @glFogfv := nil; + @glFogi := nil; + @glFogiv := nil; + @glFrontFace := nil; + @glFrustum := nil; + @glGenLists := nil; + @glGenTextures := nil; + @glGetBooleanv := nil; + @glGetClipPlane := nil; + @glGetDoublev := nil; + @glGetError := nil; + @glGetFloatv := nil; + @glGetIntegerv := nil; + @glGetLightfv := nil; + @glGetLightiv := nil; + @glGetMapdv := nil; + @glGetMapfv := nil; + @glGetMapiv := nil; + @glGetMaterialfv := nil; + @glGetMaterialiv := nil; + @glGetPixelMapfv := nil; + @glGetPixelMapuiv := nil; + @glGetPixelMapusv := nil; + @glGetPointerv := nil; + @glGetPolygonStipple := nil; + @glGetString := nil; + @glGetTexEnvfv := nil; + @glGetTexEnviv := nil; + @glGetTexGendv := nil; + @glGetTexGenfv := nil; + @glGetTexGeniv := nil; + @glGetTexImage := nil; + @glGetTexLevelParameterfv := nil; + @glGetTexLevelParameteriv := nil; + @glGetTexParameterfv := nil; + @glGetTexParameteriv := nil; + @glHint := nil; + @glIndexMask := nil; + @glIndexPointer := nil; + @glIndexd := nil; + @glIndexdv := nil; + @glIndexf := nil; + @glIndexfv := nil; + @glIndexi := nil; + @glIndexiv := nil; + @glIndexs := nil; + @glIndexsv := nil; + @glIndexub := nil; + @glIndexubv := nil; + @glInitNames := nil; + @glInterleavedArrays := nil; + @glIsEnabled := nil; + @glIsList := nil; + @glIsTexture := nil; + @glLightModelf := nil; + @glLightModelfv := nil; + @glLightModeli := nil; + @glLightModeliv := nil; + @glLightf := nil; + @glLightfv := nil; + @glLighti := nil; + @glLightiv := nil; + @glLineStipple := nil; + @glLineWidth := nil; + @glListBase := nil; + @glLoadIdentity := nil; + @glLoadMatrixd := nil; + @glLoadMatrixf := nil; + @glLoadName := nil; + @glLogicOp := nil; + @glMap1d := nil; + @glMap1f := nil; + @glMap2d := nil; + @glMap2f := nil; + @glMapGrid1d := nil; + @glMapGrid1f := nil; + @glMapGrid2d := nil; + @glMapGrid2f := nil; + @glMaterialf := nil; + @glMaterialfv := nil; + @glMateriali := nil; + @glMaterialiv := nil; + @glMatrixMode := nil; + @glMultMatrixd := nil; + @glMultMatrixf := nil; + @glNewList := nil; + @glNormal3b := nil; + @glNormal3bv := nil; + @glNormal3d := nil; + @glNormal3dv := nil; + @glNormal3f := nil; + @glNormal3fv := nil; + @glNormal3i := nil; + @glNormal3iv := nil; + @glNormal3s := nil; + @glNormal3sv := nil; + @glNormalPointer := nil; + @glOrtho := nil; + @glPassThrough := nil; + @glPixelMapfv := nil; + @glPixelMapuiv := nil; + @glPixelMapusv := nil; + @glPixelStoref := nil; + @glPixelStorei := nil; + @glPixelTransferf := nil; + @glPixelTransferi := nil; + @glPixelZoom := nil; + @glPointSize := nil; + @glPolygonMode := nil; + @glPolygonOffset := nil; + @glPolygonStipple := nil; + @glPopAttrib := nil; + @glPopClientAttrib := nil; + @glPopMatrix := nil; + @glPopName := nil; + @glPrioritizeTextures := nil; + @glPushAttrib := nil; + @glPushClientAttrib := nil; + @glPushMatrix := nil; + @glPushName := nil; + @glRasterPos2d := nil; + @glRasterPos2dv := nil; + @glRasterPos2f := nil; + @glRasterPos2fv := nil; + @glRasterPos2i := nil; + @glRasterPos2iv := nil; + @glRasterPos2s := nil; + @glRasterPos2sv := nil; + @glRasterPos3d := nil; + @glRasterPos3dv := nil; + @glRasterPos3f := nil; + @glRasterPos3fv := nil; + @glRasterPos3i := nil; + @glRasterPos3iv := nil; + @glRasterPos3s := nil; + @glRasterPos3sv := nil; + @glRasterPos4d := nil; + @glRasterPos4dv := nil; + @glRasterPos4f := nil; + @glRasterPos4fv := nil; + @glRasterPos4i := nil; + @glRasterPos4iv := nil; + @glRasterPos4s := nil; + @glRasterPos4sv := nil; + @glReadBuffer := nil; + @glReadPixels := nil; + @glRectd := nil; + @glRectdv := nil; + @glRectf := nil; + @glRectfv := nil; + @glRecti := nil; + @glRectiv := nil; + @glRects := nil; + @glRectsv := nil; + @glRenderMode := nil; + @glRotated := nil; + @glRotatef := nil; + @glScaled := nil; + @glScalef := nil; + @glScissor := nil; + @glSelectBuffer := nil; + @glShadeModel := nil; + @glStencilFunc := nil; + @glStencilMask := nil; + @glStencilOp := nil; + @glTexCoord1d := nil; + @glTexCoord1dv := nil; + @glTexCoord1f := nil; + @glTexCoord1fv := nil; + @glTexCoord1i := nil; + @glTexCoord1iv := nil; + @glTexCoord1s := nil; + @glTexCoord1sv := nil; + @glTexCoord2d := nil; + @glTexCoord2dv := nil; + @glTexCoord2f := nil; + @glTexCoord2fv := nil; + @glTexCoord2i := nil; + @glTexCoord2iv := nil; + @glTexCoord2s := nil; + @glTexCoord2sv := nil; + @glTexCoord3d := nil; + @glTexCoord3dv := nil; + @glTexCoord3f := nil; + @glTexCoord3fv := nil; + @glTexCoord3i := nil; + @glTexCoord3iv := nil; + @glTexCoord3s := nil; + @glTexCoord3sv := nil; + @glTexCoord4d := nil; + @glTexCoord4dv := nil; + @glTexCoord4f := nil; + @glTexCoord4fv := nil; + @glTexCoord4i := nil; + @glTexCoord4iv := nil; + @glTexCoord4s := nil; + @glTexCoord4sv := nil; + @glTexCoordPointer := nil; + @glTexEnvf := nil; + @glTexEnvfv := nil; + @glTexEnvi := nil; + @glTexEnviv := nil; + @glTexGend := nil; + @glTexGendv := nil; + @glTexGenf := nil; + @glTexGenfv := nil; + @glTexGeni := nil; + @glTexGeniv := nil; + @glTexImage1D := nil; + @glTexImage2D := nil; + @glTexParameterf := nil; + @glTexParameterfv := nil; + @glTexParameteri := nil; + @glTexParameteriv := nil; + @glTexSubImage1D := nil; + @glTexSubImage2D := nil; + @glTranslated := nil; + @glTranslatef := nil; + @glVertex2d := nil; + @glVertex2dv := nil; + @glVertex2f := nil; + @glVertex2fv := nil; + @glVertex2i := nil; + @glVertex2iv := nil; + @glVertex2s := nil; + @glVertex2sv := nil; + @glVertex3d := nil; + @glVertex3dv := nil; + @glVertex3f := nil; + @glVertex3fv := nil; + @glVertex3i := nil; + @glVertex3iv := nil; + @glVertex3s := nil; + @glVertex3sv := nil; + @glVertex4d := nil; + @glVertex4dv := nil; + @glVertex4f := nil; + @glVertex4fv := nil; + @glVertex4i := nil; + @glVertex4iv := nil; + @glVertex4s := nil; + @glVertex4sv := nil; + @glVertexPointer := nil; + @glViewport := nil; + {$IFDEF Win32} + @ChoosePixelFormat := nil; + {$ENDIF} + + UnLoadModule(LibGL); + +end; + +procedure LoadOpenGL(const dll: PChar); +begin + + FreeOpenGL; + + if LoadModule( LibGL, dll ) then + begin + @glAccum := GetModuleSymbol(LibGL, 'glAccum'); + @glAlphaFunc := GetModuleSymbol(LibGL, 'glAlphaFunc'); + @glAreTexturesResident := GetModuleSymbol(LibGL, 'glAreTexturesResident'); + @glArrayElement := GetModuleSymbol(LibGL, 'glArrayElement'); + @glBegin := GetModuleSymbol(LibGL, 'glBegin'); + @glBindTexture := GetModuleSymbol(LibGL, 'glBindTexture'); + @glBitmap := GetModuleSymbol(LibGL, 'glBitmap'); + @glBlendFunc := GetModuleSymbol(LibGL, 'glBlendFunc'); + @glCallList := GetModuleSymbol(LibGL, 'glCallList'); + @glCallLists := GetModuleSymbol(LibGL, 'glCallLists'); + @glClear := GetModuleSymbol(LibGL, 'glClear'); + @glClearAccum := GetModuleSymbol(LibGL, 'glClearAccum'); + @glClearColor := GetModuleSymbol(LibGL, 'glClearColor'); + @glClearDepth := GetModuleSymbol(LibGL, 'glClearDepth'); + @glClearIndex := GetModuleSymbol(LibGL, 'glClearIndex'); + @glClearStencil := GetModuleSymbol(LibGL, 'glClearStencil'); + @glClipPlane := GetModuleSymbol(LibGL, 'glClipPlane'); + @glColor3b := GetModuleSymbol(LibGL, 'glColor3b'); + @glColor3bv := GetModuleSymbol(LibGL, 'glColor3bv'); + @glColor3d := GetModuleSymbol(LibGL, 'glColor3d'); + @glColor3dv := GetModuleSymbol(LibGL, 'glColor3dv'); + @glColor3f := GetModuleSymbol(LibGL, 'glColor3f'); + @glColor3fv := GetModuleSymbol(LibGL, 'glColor3fv'); + @glColor3i := GetModuleSymbol(LibGL, 'glColor3i'); + @glColor3iv := GetModuleSymbol(LibGL, 'glColor3iv'); + @glColor3s := GetModuleSymbol(LibGL, 'glColor3s'); + @glColor3sv := GetModuleSymbol(LibGL, 'glColor3sv'); + @glColor3ub := GetModuleSymbol(LibGL, 'glColor3ub'); + @glColor3ubv := GetModuleSymbol(LibGL, 'glColor3ubv'); + @glColor3ui := GetModuleSymbol(LibGL, 'glColor3ui'); + @glColor3uiv := GetModuleSymbol(LibGL, 'glColor3uiv'); + @glColor3us := GetModuleSymbol(LibGL, 'glColor3us'); + @glColor3usv := GetModuleSymbol(LibGL, 'glColor3usv'); + @glColor4b := GetModuleSymbol(LibGL, 'glColor4b'); + @glColor4bv := GetModuleSymbol(LibGL, 'glColor4bv'); + @glColor4d := GetModuleSymbol(LibGL, 'glColor4d'); + @glColor4dv := GetModuleSymbol(LibGL, 'glColor4dv'); + @glColor4f := GetModuleSymbol(LibGL, 'glColor4f'); + @glColor4fv := GetModuleSymbol(LibGL, 'glColor4fv'); + @glColor4i := GetModuleSymbol(LibGL, 'glColor4i'); + @glColor4iv := GetModuleSymbol(LibGL, 'glColor4iv'); + @glColor4s := GetModuleSymbol(LibGL, 'glColor4s'); + @glColor4sv := GetModuleSymbol(LibGL, 'glColor4sv'); + @glColor4ub := GetModuleSymbol(LibGL, 'glColor4ub'); + @glColor4ubv := GetModuleSymbol(LibGL, 'glColor4ubv'); + @glColor4ui := GetModuleSymbol(LibGL, 'glColor4ui'); + @glColor4uiv := GetModuleSymbol(LibGL, 'glColor4uiv'); + @glColor4us := GetModuleSymbol(LibGL, 'glColor4us'); + @glColor4usv := GetModuleSymbol(LibGL, 'glColor4usv'); + @glColorMask := GetModuleSymbol(LibGL, 'glColorMask'); + @glColorMaterial := GetModuleSymbol(LibGL, 'glColorMaterial'); + @glColorPointer := GetModuleSymbol(LibGL, 'glColorPointer'); + @glCopyPixels := GetModuleSymbol(LibGL, 'glCopyPixels'); + @glCopyTexImage1D := GetModuleSymbol(LibGL, 'glCopyTexImage1D'); + @glCopyTexImage2D := GetModuleSymbol(LibGL, 'glCopyTexImage2D'); + @glCopyTexSubImage1D := GetModuleSymbol(LibGL, 'glCopyTexSubImage1D'); + @glCopyTexSubImage2D := GetModuleSymbol(LibGL, 'glCopyTexSubImage2D'); + @glCullFace := GetModuleSymbol(LibGL, 'glCullFace'); + @glDeleteLists := GetModuleSymbol(LibGL, 'glDeleteLists'); + @glDeleteTextures := GetModuleSymbol(LibGL, 'glDeleteTextures'); + @glDepthFunc := GetModuleSymbol(LibGL, 'glDepthFunc'); + @glDepthMask := GetModuleSymbol(LibGL, 'glDepthMask'); + @glDepthRange := GetModuleSymbol(LibGL, 'glDepthRange'); + @glDisable := GetModuleSymbol(LibGL, 'glDisable'); + @glDisableClientState := GetModuleSymbol(LibGL, 'glDisableClientState'); + @glDrawArrays := GetModuleSymbol(LibGL, 'glDrawArrays'); + @glDrawBuffer := GetModuleSymbol(LibGL, 'glDrawBuffer'); + @glDrawElements := GetModuleSymbol(LibGL, 'glDrawElements'); + @glDrawPixels := GetModuleSymbol(LibGL, 'glDrawPixels'); + @glEdgeFlag := GetModuleSymbol(LibGL, 'glEdgeFlag'); + @glEdgeFlagPointer := GetModuleSymbol(LibGL, 'glEdgeFlagPointer'); + @glEdgeFlagv := GetModuleSymbol(LibGL, 'glEdgeFlagv'); + @glEnable := GetModuleSymbol(LibGL, 'glEnable'); + @glEnableClientState := GetModuleSymbol(LibGL, 'glEnableClientState'); + @glEnd := GetModuleSymbol(LibGL, 'glEnd'); + @glEndList := GetModuleSymbol(LibGL, 'glEndList'); + @glEvalCoord1d := GetModuleSymbol(LibGL, 'glEvalCoord1d'); + @glEvalCoord1dv := GetModuleSymbol(LibGL, 'glEvalCoord1dv'); + @glEvalCoord1f := GetModuleSymbol(LibGL, 'glEvalCoord1f'); + @glEvalCoord1fv := GetModuleSymbol(LibGL, 'glEvalCoord1fv'); + @glEvalCoord2d := GetModuleSymbol(LibGL, 'glEvalCoord2d'); + @glEvalCoord2dv := GetModuleSymbol(LibGL, 'glEvalCoord2dv'); + @glEvalCoord2f := GetModuleSymbol(LibGL, 'glEvalCoord2f'); + @glEvalCoord2fv := GetModuleSymbol(LibGL, 'glEvalCoord2fv'); + @glEvalMesh1 := GetModuleSymbol(LibGL, 'glEvalMesh1'); + @glEvalMesh2 := GetModuleSymbol(LibGL, 'glEvalMesh2'); + @glEvalPoint1 := GetModuleSymbol(LibGL, 'glEvalPoint1'); + @glEvalPoint2 := GetModuleSymbol(LibGL, 'glEvalPoint2'); + @glFeedbackBuffer := GetModuleSymbol(LibGL, 'glFeedbackBuffer'); + @glFinish := GetModuleSymbol(LibGL, 'glFinish'); + @glFlush := GetModuleSymbol(LibGL, 'glFlush'); + @glFogf := GetModuleSymbol(LibGL, 'glFogf'); + @glFogfv := GetModuleSymbol(LibGL, 'glFogfv'); + @glFogi := GetModuleSymbol(LibGL, 'glFogi'); + @glFogiv := GetModuleSymbol(LibGL, 'glFogiv'); + @glFrontFace := GetModuleSymbol(LibGL, 'glFrontFace'); + @glFrustum := GetModuleSymbol(LibGL, 'glFrustum'); + @glGenLists := GetModuleSymbol(LibGL, 'glGenLists'); + @glGenTextures := GetModuleSymbol(LibGL, 'glGenTextures'); + @glGetBooleanv := GetModuleSymbol(LibGL, 'glGetBooleanv'); + @glGetClipPlane := GetModuleSymbol(LibGL, 'glGetClipPlane'); + @glGetDoublev := GetModuleSymbol(LibGL, 'glGetDoublev'); + @glGetError := GetModuleSymbol(LibGL, 'glGetError'); + @glGetFloatv := GetModuleSymbol(LibGL, 'glGetFloatv'); + @glGetIntegerv := GetModuleSymbol(LibGL, 'glGetIntegerv'); + @glGetLightfv := GetModuleSymbol(LibGL, 'glGetLightfv'); + @glGetLightiv := GetModuleSymbol(LibGL, 'glGetLightiv'); + @glGetMapdv := GetModuleSymbol(LibGL, 'glGetMapdv'); + @glGetMapfv := GetModuleSymbol(LibGL, 'glGetMapfv'); + @glGetMapiv := GetModuleSymbol(LibGL, 'glGetMapiv'); + @glGetMaterialfv := GetModuleSymbol(LibGL, 'glGetMaterialfv'); + @glGetMaterialiv := GetModuleSymbol(LibGL, 'glGetMaterialiv'); + @glGetPixelMapfv := GetModuleSymbol(LibGL, 'glGetPixelMapfv'); + @glGetPixelMapuiv := GetModuleSymbol(LibGL, 'glGetPixelMapuiv'); + @glGetPixelMapusv := GetModuleSymbol(LibGL, 'glGetPixelMapusv'); + @glGetPointerv := GetModuleSymbol(LibGL, 'glGetPointerv'); + @glGetPolygonStipple := GetModuleSymbol(LibGL, 'glGetPolygonStipple'); + @glGetString := GetModuleSymbol(LibGL, 'glGetString'); + @glGetTexEnvfv := GetModuleSymbol(LibGL, 'glGetTexEnvfv'); + @glGetTexEnviv := GetModuleSymbol(LibGL, 'glGetTexEnviv'); + @glGetTexGendv := GetModuleSymbol(LibGL, 'glGetTexGendv'); + @glGetTexGenfv := GetModuleSymbol(LibGL, 'glGetTexGenfv'); + @glGetTexGeniv := GetModuleSymbol(LibGL, 'glGetTexGeniv'); + @glGetTexImage := GetModuleSymbol(LibGL, 'glGetTexImage'); + @glGetTexLevelParameterfv := GetModuleSymbol(LibGL, 'glGetTexLevelParameterfv'); + @glGetTexLevelParameteriv := GetModuleSymbol(LibGL, 'glGetTexLevelParameteriv'); + @glGetTexParameterfv := GetModuleSymbol(LibGL, 'glGetTexParameterfv'); + @glGetTexParameteriv := GetModuleSymbol(LibGL, 'glGetTexParameteriv'); + @glHint := GetModuleSymbol(LibGL, 'glHint'); + @glIndexMask := GetModuleSymbol(LibGL, 'glIndexMask'); + @glIndexPointer := GetModuleSymbol(LibGL, 'glIndexPointer'); + @glIndexd := GetModuleSymbol(LibGL, 'glIndexd'); + @glIndexdv := GetModuleSymbol(LibGL, 'glIndexdv'); + @glIndexf := GetModuleSymbol(LibGL, 'glIndexf'); + @glIndexfv := GetModuleSymbol(LibGL, 'glIndexfv'); + @glIndexi := GetModuleSymbol(LibGL, 'glIndexi'); + @glIndexiv := GetModuleSymbol(LibGL, 'glIndexiv'); + @glIndexs := GetModuleSymbol(LibGL, 'glIndexs'); + @glIndexsv := GetModuleSymbol(LibGL, 'glIndexsv'); + @glIndexub := GetModuleSymbol(LibGL, 'glIndexub'); + @glIndexubv := GetModuleSymbol(LibGL, 'glIndexubv'); + @glInitNames := GetModuleSymbol(LibGL, 'glInitNames'); + @glInterleavedArrays := GetModuleSymbol(LibGL, 'glInterleavedArrays'); + @glIsEnabled := GetModuleSymbol(LibGL, 'glIsEnabled'); + @glIsList := GetModuleSymbol(LibGL, 'glIsList'); + @glIsTexture := GetModuleSymbol(LibGL, 'glIsTexture'); + @glLightModelf := GetModuleSymbol(LibGL, 'glLightModelf'); + @glLightModelfv := GetModuleSymbol(LibGL, 'glLightModelfv'); + @glLightModeli := GetModuleSymbol(LibGL, 'glLightModeli'); + @glLightModeliv := GetModuleSymbol(LibGL, 'glLightModeliv'); + @glLightf := GetModuleSymbol(LibGL, 'glLightf'); + @glLightfv := GetModuleSymbol(LibGL, 'glLightfv'); + @glLighti := GetModuleSymbol(LibGL, 'glLighti'); + @glLightiv := GetModuleSymbol(LibGL, 'glLightiv'); + @glLineStipple := GetModuleSymbol(LibGL, 'glLineStipple'); + @glLineWidth := GetModuleSymbol(LibGL, 'glLineWidth'); + @glListBase := GetModuleSymbol(LibGL, 'glListBase'); + @glLoadIdentity := GetModuleSymbol(LibGL, 'glLoadIdentity'); + @glLoadMatrixd := GetModuleSymbol(LibGL, 'glLoadMatrixd'); + @glLoadMatrixf := GetModuleSymbol(LibGL, 'glLoadMatrixf'); + @glLoadName := GetModuleSymbol(LibGL, 'glLoadName'); + @glLogicOp := GetModuleSymbol(LibGL, 'glLogicOp'); + @glMap1d := GetModuleSymbol(LibGL, 'glMap1d'); + @glMap1f := GetModuleSymbol(LibGL, 'glMap1f'); + @glMap2d := GetModuleSymbol(LibGL, 'glMap2d'); + @glMap2f := GetModuleSymbol(LibGL, 'glMap2f'); + @glMapGrid1d := GetModuleSymbol(LibGL, 'glMapGrid1d'); + @glMapGrid1f := GetModuleSymbol(LibGL, 'glMapGrid1f'); + @glMapGrid2d := GetModuleSymbol(LibGL, 'glMapGrid2d'); + @glMapGrid2f := GetModuleSymbol(LibGL, 'glMapGrid2f'); + @glMaterialf := GetModuleSymbol(LibGL, 'glMaterialf'); + @glMaterialfv := GetModuleSymbol(LibGL, 'glMaterialfv'); + @glMateriali := GetModuleSymbol(LibGL, 'glMateriali'); + @glMaterialiv := GetModuleSymbol(LibGL, 'glMaterialiv'); + @glMatrixMode := GetModuleSymbol(LibGL, 'glMatrixMode'); + @glMultMatrixd := GetModuleSymbol(LibGL, 'glMultMatrixd'); + @glMultMatrixf := GetModuleSymbol(LibGL, 'glMultMatrixf'); + @glNewList := GetModuleSymbol(LibGL, 'glNewList'); + @glNormal3b := GetModuleSymbol(LibGL, 'glNormal3b'); + @glNormal3bv := GetModuleSymbol(LibGL, 'glNormal3bv'); + @glNormal3d := GetModuleSymbol(LibGL, 'glNormal3d'); + @glNormal3dv := GetModuleSymbol(LibGL, 'glNormal3dv'); + @glNormal3f := GetModuleSymbol(LibGL, 'glNormal3f'); + @glNormal3fv := GetModuleSymbol(LibGL, 'glNormal3fv'); + @glNormal3i := GetModuleSymbol(LibGL, 'glNormal3i'); + @glNormal3iv := GetModuleSymbol(LibGL, 'glNormal3iv'); + @glNormal3s := GetModuleSymbol(LibGL, 'glNormal3s'); + @glNormal3sv := GetModuleSymbol(LibGL, 'glNormal3sv'); + @glNormalPointer := GetModuleSymbol(LibGL, 'glNormalPointer'); + @glOrtho := GetModuleSymbol(LibGL, 'glOrtho'); + @glPassThrough := GetModuleSymbol(LibGL, 'glPassThrough'); + @glPixelMapfv := GetModuleSymbol(LibGL, 'glPixelMapfv'); + @glPixelMapuiv := GetModuleSymbol(LibGL, 'glPixelMapuiv'); + @glPixelMapusv := GetModuleSymbol(LibGL, 'glPixelMapusv'); + @glPixelStoref := GetModuleSymbol(LibGL, 'glPixelStoref'); + @glPixelStorei := GetModuleSymbol(LibGL, 'glPixelStorei'); + @glPixelTransferf := GetModuleSymbol(LibGL, 'glPixelTransferf'); + @glPixelTransferi := GetModuleSymbol(LibGL, 'glPixelTransferi'); + @glPixelZoom := GetModuleSymbol(LibGL, 'glPixelZoom'); + @glPointSize := GetModuleSymbol(LibGL, 'glPointSize'); + @glPolygonMode := GetModuleSymbol(LibGL, 'glPolygonMode'); + @glPolygonOffset := GetModuleSymbol(LibGL, 'glPolygonOffset'); + @glPolygonStipple := GetModuleSymbol(LibGL, 'glPolygonStipple'); + @glPopAttrib := GetModuleSymbol(LibGL, 'glPopAttrib'); + @glPopClientAttrib := GetModuleSymbol(LibGL, 'glPopClientAttrib'); + @glPopMatrix := GetModuleSymbol(LibGL, 'glPopMatrix'); + @glPopName := GetModuleSymbol(LibGL, 'glPopName'); + @glPrioritizeTextures := GetModuleSymbol(LibGL, 'glPrioritizeTextures'); + @glPushAttrib := GetModuleSymbol(LibGL, 'glPushAttrib'); + @glPushClientAttrib := GetModuleSymbol(LibGL, 'glPushClientAttrib'); + @glPushMatrix := GetModuleSymbol(LibGL, 'glPushMatrix'); + @glPushName := GetModuleSymbol(LibGL, 'glPushName'); + @glRasterPos2d := GetModuleSymbol(LibGL, 'glRasterPos2d'); + @glRasterPos2dv := GetModuleSymbol(LibGL, 'glRasterPos2dv'); + @glRasterPos2f := GetModuleSymbol(LibGL, 'glRasterPos2f'); + @glRasterPos2fv := GetModuleSymbol(LibGL, 'glRasterPos2fv'); + @glRasterPos2i := GetModuleSymbol(LibGL, 'glRasterPos2i'); + @glRasterPos2iv := GetModuleSymbol(LibGL, 'glRasterPos2iv'); + @glRasterPos2s := GetModuleSymbol(LibGL, 'glRasterPos2s'); + @glRasterPos2sv := GetModuleSymbol(LibGL, 'glRasterPos2sv'); + @glRasterPos3d := GetModuleSymbol(LibGL, 'glRasterPos3d'); + @glRasterPos3dv := GetModuleSymbol(LibGL, 'glRasterPos3dv'); + @glRasterPos3f := GetModuleSymbol(LibGL, 'glRasterPos3f'); + @glRasterPos3fv := GetModuleSymbol(LibGL, 'glRasterPos3fv'); + @glRasterPos3i := GetModuleSymbol(LibGL, 'glRasterPos3i'); + @glRasterPos3iv := GetModuleSymbol(LibGL, 'glRasterPos3iv'); + @glRasterPos3s := GetModuleSymbol(LibGL, 'glRasterPos3s'); + @glRasterPos3sv := GetModuleSymbol(LibGL, 'glRasterPos3sv'); + @glRasterPos4d := GetModuleSymbol(LibGL, 'glRasterPos4d'); + @glRasterPos4dv := GetModuleSymbol(LibGL, 'glRasterPos4dv'); + @glRasterPos4f := GetModuleSymbol(LibGL, 'glRasterPos4f'); + @glRasterPos4fv := GetModuleSymbol(LibGL, 'glRasterPos4fv'); + @glRasterPos4i := GetModuleSymbol(LibGL, 'glRasterPos4i'); + @glRasterPos4iv := GetModuleSymbol(LibGL, 'glRasterPos4iv'); + @glRasterPos4s := GetModuleSymbol(LibGL, 'glRasterPos4s'); + @glRasterPos4sv := GetModuleSymbol(LibGL, 'glRasterPos4sv'); + @glReadBuffer := GetModuleSymbol(LibGL, 'glReadBuffer'); + @glReadPixels := GetModuleSymbol(LibGL, 'glReadPixels'); + @glRectd := GetModuleSymbol(LibGL, 'glRectd'); + @glRectdv := GetModuleSymbol(LibGL, 'glRectdv'); + @glRectf := GetModuleSymbol(LibGL, 'glRectf'); + @glRectfv := GetModuleSymbol(LibGL, 'glRectfv'); + @glRecti := GetModuleSymbol(LibGL, 'glRecti'); + @glRectiv := GetModuleSymbol(LibGL, 'glRectiv'); + @glRects := GetModuleSymbol(LibGL, 'glRects'); + @glRectsv := GetModuleSymbol(LibGL, 'glRectsv'); + @glRenderMode := GetModuleSymbol(LibGL, 'glRenderMode'); + @glRotated := GetModuleSymbol(LibGL, 'glRotated'); + @glRotatef := GetModuleSymbol(LibGL, 'glRotatef'); + @glScaled := GetModuleSymbol(LibGL, 'glScaled'); + @glScalef := GetModuleSymbol(LibGL, 'glScalef'); + @glScissor := GetModuleSymbol(LibGL, 'glScissor'); + @glSelectBuffer := GetModuleSymbol(LibGL, 'glSelectBuffer'); + @glShadeModel := GetModuleSymbol(LibGL, 'glShadeModel'); + @glStencilFunc := GetModuleSymbol(LibGL, 'glStencilFunc'); + @glStencilMask := GetModuleSymbol(LibGL, 'glStencilMask'); + @glStencilOp := GetModuleSymbol(LibGL, 'glStencilOp'); + @glTexCoord1d := GetModuleSymbol(LibGL, 'glTexCoord1d'); + @glTexCoord1dv := GetModuleSymbol(LibGL, 'glTexCoord1dv'); + @glTexCoord1f := GetModuleSymbol(LibGL, 'glTexCoord1f'); + @glTexCoord1fv := GetModuleSymbol(LibGL, 'glTexCoord1fv'); + @glTexCoord1i := GetModuleSymbol(LibGL, 'glTexCoord1i'); + @glTexCoord1iv := GetModuleSymbol(LibGL, 'glTexCoord1iv'); + @glTexCoord1s := GetModuleSymbol(LibGL, 'glTexCoord1s'); + @glTexCoord1sv := GetModuleSymbol(LibGL, 'glTexCoord1sv'); + @glTexCoord2d := GetModuleSymbol(LibGL, 'glTexCoord2d'); + @glTexCoord2dv := GetModuleSymbol(LibGL, 'glTexCoord2dv'); + @glTexCoord2f := GetModuleSymbol(LibGL, 'glTexCoord2f'); + @glTexCoord2fv := GetModuleSymbol(LibGL, 'glTexCoord2fv'); + @glTexCoord2i := GetModuleSymbol(LibGL, 'glTexCoord2i'); + @glTexCoord2iv := GetModuleSymbol(LibGL, 'glTexCoord2iv'); + @glTexCoord2s := GetModuleSymbol(LibGL, 'glTexCoord2s'); + @glTexCoord2sv := GetModuleSymbol(LibGL, 'glTexCoord2sv'); + @glTexCoord3d := GetModuleSymbol(LibGL, 'glTexCoord3d'); + @glTexCoord3dv := GetModuleSymbol(LibGL, 'glTexCoord3dv'); + @glTexCoord3f := GetModuleSymbol(LibGL, 'glTexCoord3f'); + @glTexCoord3fv := GetModuleSymbol(LibGL, 'glTexCoord3fv'); + @glTexCoord3i := GetModuleSymbol(LibGL, 'glTexCoord3i'); + @glTexCoord3iv := GetModuleSymbol(LibGL, 'glTexCoord3iv'); + @glTexCoord3s := GetModuleSymbol(LibGL, 'glTexCoord3s'); + @glTexCoord3sv := GetModuleSymbol(LibGL, 'glTexCoord3sv'); + @glTexCoord4d := GetModuleSymbol(LibGL, 'glTexCoord4d'); + @glTexCoord4dv := GetModuleSymbol(LibGL, 'glTexCoord4dv'); + @glTexCoord4f := GetModuleSymbol(LibGL, 'glTexCoord4f'); + @glTexCoord4fv := GetModuleSymbol(LibGL, 'glTexCoord4fv'); + @glTexCoord4i := GetModuleSymbol(LibGL, 'glTexCoord4i'); + @glTexCoord4iv := GetModuleSymbol(LibGL, 'glTexCoord4iv'); + @glTexCoord4s := GetModuleSymbol(LibGL, 'glTexCoord4s'); + @glTexCoord4sv := GetModuleSymbol(LibGL, 'glTexCoord4sv'); + @glTexCoordPointer := GetModuleSymbol(LibGL, 'glTexCoordPointer'); + @glTexEnvf := GetModuleSymbol(LibGL, 'glTexEnvf'); + @glTexEnvfv := GetModuleSymbol(LibGL, 'glTexEnvfv'); + @glTexEnvi := GetModuleSymbol(LibGL, 'glTexEnvi'); + @glTexEnviv := GetModuleSymbol(LibGL, 'glTexEnviv'); + @glTexGend := GetModuleSymbol(LibGL, 'glTexGend'); + @glTexGendv := GetModuleSymbol(LibGL, 'glTexGendv'); + @glTexGenf := GetModuleSymbol(LibGL, 'glTexGenf'); + @glTexGenfv := GetModuleSymbol(LibGL, 'glTexGenfv'); + @glTexGeni := GetModuleSymbol(LibGL, 'glTexGeni'); + @glTexGeniv := GetModuleSymbol(LibGL, 'glTexGeniv'); + @glTexImage1D := GetModuleSymbol(LibGL, 'glTexImage1D'); + @glTexImage2D := GetModuleSymbol(LibGL, 'glTexImage2D'); + @glTexParameterf := GetModuleSymbol(LibGL, 'glTexParameterf'); + @glTexParameterfv := GetModuleSymbol(LibGL, 'glTexParameterfv'); + @glTexParameteri := GetModuleSymbol(LibGL, 'glTexParameteri'); + @glTexParameteriv := GetModuleSymbol(LibGL, 'glTexParameteriv'); + @glTexSubImage1D := GetModuleSymbol(LibGL, 'glTexSubImage1D'); + @glTexSubImage2D := GetModuleSymbol(LibGL, 'glTexSubImage2D'); + @glTranslated := GetModuleSymbol(LibGL, 'glTranslated'); + @glTranslatef := GetModuleSymbol(LibGL, 'glTranslatef'); + @glVertex2d := GetModuleSymbol(LibGL, 'glVertex2d'); + @glVertex2dv := GetModuleSymbol(LibGL, 'glVertex2dv'); + @glVertex2f := GetModuleSymbol(LibGL, 'glVertex2f'); + @glVertex2fv := GetModuleSymbol(LibGL, 'glVertex2fv'); + @glVertex2i := GetModuleSymbol(LibGL, 'glVertex2i'); + @glVertex2iv := GetModuleSymbol(LibGL, 'glVertex2iv'); + @glVertex2s := GetModuleSymbol(LibGL, 'glVertex2s'); + @glVertex2sv := GetModuleSymbol(LibGL, 'glVertex2sv'); + @glVertex3d := GetModuleSymbol(LibGL, 'glVertex3d'); + @glVertex3dv := GetModuleSymbol(LibGL, 'glVertex3dv'); + @glVertex3f := GetModuleSymbol(LibGL, 'glVertex3f'); + @glVertex3fv := GetModuleSymbol(LibGL, 'glVertex3fv'); + @glVertex3i := GetModuleSymbol(LibGL, 'glVertex3i'); + @glVertex3iv := GetModuleSymbol(LibGL, 'glVertex3iv'); + @glVertex3s := GetModuleSymbol(LibGL, 'glVertex3s'); + @glVertex3sv := GetModuleSymbol(LibGL, 'glVertex3sv'); + @glVertex4d := GetModuleSymbol(LibGL, 'glVertex4d'); + @glVertex4dv := GetModuleSymbol(LibGL, 'glVertex4dv'); + @glVertex4f := GetModuleSymbol(LibGL, 'glVertex4f'); + @glVertex4fv := GetModuleSymbol(LibGL, 'glVertex4fv'); + @glVertex4i := GetModuleSymbol(LibGL, 'glVertex4i'); + @glVertex4iv := GetModuleSymbol(LibGL, 'glVertex4iv'); + @glVertex4s := GetModuleSymbol(LibGL, 'glVertex4s'); + @glVertex4sv := GetModuleSymbol(LibGL, 'glVertex4sv'); + @glVertexPointer := GetModuleSymbol(LibGL, 'glVertexPointer'); + @glViewport := GetModuleSymbol(LibGL, 'glViewport'); + + {$IFDEF WIN32} + @ChoosePixelFormat := GetModuleSymbol(LibGL, 'ChoosePixelFormat'); + if not Assigned(ChoosePixelFormat) then + {$IFNDEF FPC}@{$ENDIF}ChoosePixelFormat := @Windows.ChoosePixelFormat; + {$ENDIF} + end; +end; + +initialization + {$IFNDEF FPC} + {$IFNDEF __GPC__} + Set8087CW($133F); + {$ENDIF} + {$ENDIF} + + LoadOpenGL( GLLibName ); + +finalization + + FreeOpenGL; + +end. + diff --git a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glext.pas b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glext.pas new file mode 100644 index 00000000..19ed2023 --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glext.pas @@ -0,0 +1,8527 @@ +unit glext; +{ + $Id: glext.pas,v 1.3 2004/08/24 19:33:06 savage Exp $ + +} +(************************************************** + * OpenGL extension loading library * + * Generated by MetaGLext, written by Tom Nuydens * + * (tom@delphi3d.net -- http://www.delphi3d.net * + **************************************************) + +{ + $Log: glext.pas,v $ + Revision 1.3 2004/08/24 19:33:06 savage + Removed declarations of SDL_GL_GetProcAddress as the correct ones are in sdl.pas. + + Revision 1.2 2004/08/09 00:38:01 savage + Updated to Tom's latest version. May contains bugs, but I hope not. + + Revision 1.1 2004/03/30 21:53:54 savage + Moved to it's own folder. + + Revision 1.6 2004/03/28 00:28:43 savage + Fixed some glSecondaryColor definitions... + + Revision 1.5 2004/02/20 17:18:16 savage + Forgot to prefix function pointer with @ for FPC and other Pascal compilers. + + Revision 1.4 2004/02/20 17:09:55 savage + Code tidied up in gl, glu and glut, while extensions in glext.pas are now loaded using SDL_GL_GetProcAddress, thus making it more cross-platform compatible, but now more tied to SDL. + + Revision 1.3 2004/02/14 22:36:29 savage + Fixed inconsistencies of using LoadLibrary and LoadModule. + Now all units make use of LoadModule rather than LoadLibrary and other dynamic proc procedures. + + Revision 1.2 2004/02/14 00:09:19 savage + Changed uses to now make use of moduleloader.pas rather than dllfuncs.pas + + Revision 1.1 2004/02/05 00:08:19 savage + Module 1.0 release + + Revision 1.7 2003/06/02 12:32:13 savage + Modified Sources to avoid warnings with Delphi by moving CVS Logging to the top of the header files. Hopefully CVS Logging still works. + +} + +interface + +{$I jedi-sdl.inc} + +uses + SysUtils, +{$IFDEF __GPC__} + gpc, +{$ENDIF} + +{$IFDEF WIN32} + Windows, +{$ENDIF} + moduleloader, + gl; + +// Test if the given extension name is present in the given extension string. +function glext_ExtensionSupported(const extension: PChar; const searchIn: PChar): Boolean; + +// Load the extension with the given name. +function glext_LoadExtension(ext: PChar): Boolean; + +// Some types that were introduced by extensions: +type + GLintptrARB = Integer; + PGLintptrARB = ^GLintptrARB; + + GLsizeiptrARB = Integer; + PGLsizeiptrARB = ^GLsizeiptrARB; + + GLcharARB = Char; + PGLcharARB = ^GLcharARB; + + GLhandleARB = Cardinal; + PGLhandleARB = ^GLhandleARB; + +//***** GL_version_1_2 *****// +const + GL_UNSIGNED_BYTE_3_3_2 = $8032; + GL_UNSIGNED_SHORT_4_4_4_4 = $8033; + GL_UNSIGNED_SHORT_5_5_5_1 = $8034; + GL_UNSIGNED_INT_8_8_8_8 = $8035; + GL_UNSIGNED_INT_10_10_10_2 = $8036; + GL_RESCALE_NORMAL = $803A; + GL_UNSIGNED_BYTE_2_3_3_REV = $8362; + GL_UNSIGNED_SHORT_5_6_5 = $8363; + GL_UNSIGNED_SHORT_5_6_5_REV = $8364; + GL_UNSIGNED_SHORT_4_4_4_4_REV = $8365; + GL_UNSIGNED_SHORT_1_5_5_5_REV = $8366; + GL_UNSIGNED_INT_8_8_8_8_REV = $8367; + GL_UNSIGNED_INT_2_10_10_10_REV = $8368; + GL_BGR = $80E0; + GL_BGRA = $80E1; + GL_MAX_ELEMENTS_VERTICES = $80E8; + GL_MAX_ELEMENTS_INDICES = $80E9; + GL_CLAMP_TO_EDGE = $812F; + GL_TEXTURE_MIN_LOD = $813A; + GL_TEXTURE_MAX_LOD = $813B; + GL_TEXTURE_BASE_LEVEL = $813C; + GL_TEXTURE_MAX_LEVEL = $813D; + GL_LIGHT_MODEL_COLOR_CONTROL = $81F8; + GL_SINGLE_COLOR = $81F9; + GL_SEPARATE_SPECULAR_COLOR = $81FA; + GL_SMOOTH_POINT_SIZE_RANGE = $0B12; + GL_SMOOTH_POINT_SIZE_GRANULARITY = $0B13; + GL_SMOOTH_LINE_WIDTH_RANGE = $0B22; + GL_SMOOTH_LINE_WIDTH_GRANULARITY = $0B23; + GL_ALIASED_POINT_SIZE_RANGE = $846D; + GL_ALIASED_LINE_WIDTH_RANGE = $846E; + GL_PACK_SKIP_IMAGES = $806B; + GL_PACK_IMAGE_HEIGHT = $806C; + GL_UNPACK_SKIP_IMAGES = $806D; + GL_UNPACK_IMAGE_HEIGHT = $806E; + GL_TEXTURE_3D = $806F; + GL_PROXY_TEXTURE_3D = $8070; + GL_TEXTURE_DEPTH = $8071; + GL_TEXTURE_WRAP_R = $8072; + GL_MAX_3D_TEXTURE_SIZE = $8073; +var + glDrawRangeElements: procedure(mode: GLenum; start: GLuint; _end: GLuint; count: GLsizei; _type: GLenum; const indices: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexImage3D: procedure(target: GLenum; level: GLint; internalformat: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexSubImage3D: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyTexSubImage3D: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; x: GLint; y: GLint; width: GLsizei; height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_version_1_2: Boolean; + +//***** GL_ARB_imaging *****// +const + GL_CONSTANT_COLOR = $8001; + GL_ONE_MINUS_CONSTANT_COLOR = $8002; + GL_CONSTANT_ALPHA = $8003; + GL_ONE_MINUS_CONSTANT_ALPHA = $8004; + GL_BLEND_COLOR = $8005; + GL_FUNC_ADD = $8006; + GL_MIN = $8007; + GL_MAX = $8008; + GL_BLEND_EQUATION = $8009; + GL_FUNC_SUBTRACT = $800A; + GL_FUNC_REVERSE_SUBTRACT = $800B; + GL_CONVOLUTION_1D = $8010; + GL_CONVOLUTION_2D = $8011; + GL_SEPARABLE_2D = $8012; + GL_CONVOLUTION_BORDER_MODE = $8013; + GL_CONVOLUTION_FILTER_SCALE = $8014; + GL_CONVOLUTION_FILTER_BIAS = $8015; + GL_REDUCE = $8016; + GL_CONVOLUTION_FORMAT = $8017; + GL_CONVOLUTION_WIDTH = $8018; + GL_CONVOLUTION_HEIGHT = $8019; + GL_MAX_CONVOLUTION_WIDTH = $801A; + GL_MAX_CONVOLUTION_HEIGHT = $801B; + GL_POST_CONVOLUTION_RED_SCALE = $801C; + GL_POST_CONVOLUTION_GREEN_SCALE = $801D; + GL_POST_CONVOLUTION_BLUE_SCALE = $801E; + GL_POST_CONVOLUTION_ALPHA_SCALE = $801F; + GL_POST_CONVOLUTION_RED_BIAS = $8020; + GL_POST_CONVOLUTION_GREEN_BIAS = $8021; + GL_POST_CONVOLUTION_BLUE_BIAS = $8022; + GL_POST_CONVOLUTION_ALPHA_BIAS = $8023; + GL_HISTOGRAM = $8024; + GL_PROXY_HISTOGRAM = $8025; + GL_HISTOGRAM_WIDTH = $8026; + GL_HISTOGRAM_FORMAT = $8027; + GL_HISTOGRAM_RED_SIZE = $8028; + GL_HISTOGRAM_GREEN_SIZE = $8029; + GL_HISTOGRAM_BLUE_SIZE = $802A; + GL_HISTOGRAM_ALPHA_SIZE = $802B; + GL_HISTOGRAM_LUMINANCE_SIZE = $802C; + GL_HISTOGRAM_SINK = $802D; + GL_MINMAX = $802E; + GL_MINMAX_FORMAT = $802F; + GL_MINMAX_SINK = $8030; + GL_TABLE_TOO_LARGE = $8031; + GL_COLOR_MATRIX = $80B1; + GL_COLOR_MATRIX_STACK_DEPTH = $80B2; + GL_MAX_COLOR_MATRIX_STACK_DEPTH = $80B3; + GL_POST_COLOR_MATRIX_RED_SCALE = $80B4; + GL_POST_COLOR_MATRIX_GREEN_SCALE = $80B5; + GL_POST_COLOR_MATRIX_BLUE_SCALE = $80B6; + GL_POST_COLOR_MATRIX_ALPHA_SCALE = $80B7; + GL_POST_COLOR_MATRIX_RED_BIAS = $80B8; + GL_POST_COLOR_MATRIX_GREEN_BIAS = $80B9; + GL_POST_COLOR_MATRIX_BLUE_BIAS = $80BA; + GL_POST_COLOR_MATIX_ALPHA_BIAS = $80BB; + GL_COLOR_TABLE = $80D0; + GL_POST_CONVOLUTION_COLOR_TABLE = $80D1; + GL_POST_COLOR_MATRIX_COLOR_TABLE = $80D2; + GL_PROXY_COLOR_TABLE = $80D3; + GL_PROXY_POST_CONVOLUTION_COLOR_TABLE = $80D4; + GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE = $80D5; + GL_COLOR_TABLE_SCALE = $80D6; + GL_COLOR_TABLE_BIAS = $80D7; + GL_COLOR_TABLE_FORMAT = $80D8; + GL_COLOR_TABLE_WIDTH = $80D9; + GL_COLOR_TABLE_RED_SIZE = $80DA; + GL_COLOR_TABLE_GREEN_SIZE = $80DB; + GL_COLOR_TABLE_BLUE_SIZE = $80DC; + GL_COLOR_TABLE_ALPHA_SIZE = $80DD; + GL_COLOR_TABLE_LUMINANCE_SIZE = $80DE; + GL_COLOR_TABLE_INTENSITY_SIZE = $80DF; + GL_IGNORE_BORDER = $8150; + GL_CONSTANT_BORDER = $8151; + GL_WRAP_BORDER = $8152; + GL_REPLICATE_BORDER = $8153; + GL_CONVOLUTION_BORDER_COLOR = $8154; +var + glColorTable: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const table: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorTableParameterfv: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorTableParameteriv: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyColorTable: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTable: procedure(target: GLenum; format: GLenum; _type: GLenum; table: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTableParameterfv: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTableParameteriv: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorSubTable: procedure(target: GLenum; start: GLsizei; count: GLsizei; format: GLenum; _type: GLenum; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyColorSubTable: procedure(target: GLenum; start: GLsizei; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionFilter1D: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionFilter2D: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameterf: procedure(target: GLenum; pname: GLenum; params: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameterfv: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameteri: procedure(target: GLenum; pname: GLenum; params: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameteriv: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyConvolutionFilter1D: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyConvolutionFilter2D: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei; height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetConvolutionFilter: procedure(target: GLenum; format: GLenum; _type: GLenum; image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetConvolutionParameterfv: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetConvolutionParameteriv: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetSeparableFilter: procedure(target: GLenum; format: GLenum; _type: GLenum; row: PGLvoid; column: PGLvoid; span: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSeparableFilter2D: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const row: PGLvoid; const column: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetHistogram: procedure(target: GLenum; reset: GLboolean; format: GLenum; _type: GLenum; values: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetHistogramParameterfv: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetHistogramParameteriv: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMinmax: procedure(target: GLenum; reset: GLboolean; format: GLenum; _type: GLenum; values: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMinmaxParameterfv: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMinmaxParameteriv: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glHistogram: procedure(target: GLenum; width: GLsizei; internalformat: GLenum; sink: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMinmax: procedure(target: GLenum; internalformat: GLenum; sink: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glResetHistogram: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glResetMinmax: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBlendEquation: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBlendColor: procedure(red: GLclampf; green: GLclampf; blue: GLclampf; alpha: GLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_imaging: Boolean; + +//***** GL_version_1_3 *****// +const + GL_TEXTURE0 = $84C0; + GL_TEXTURE1 = $84C1; + GL_TEXTURE2 = $84C2; + GL_TEXTURE3 = $84C3; + GL_TEXTURE4 = $84C4; + GL_TEXTURE5 = $84C5; + GL_TEXTURE6 = $84C6; + GL_TEXTURE7 = $84C7; + GL_TEXTURE8 = $84C8; + GL_TEXTURE9 = $84C9; + GL_TEXTURE10 = $84CA; + GL_TEXTURE11 = $84CB; + GL_TEXTURE12 = $84CC; + GL_TEXTURE13 = $84CD; + GL_TEXTURE14 = $84CE; + GL_TEXTURE15 = $84CF; + GL_TEXTURE16 = $84D0; + GL_TEXTURE17 = $84D1; + GL_TEXTURE18 = $84D2; + GL_TEXTURE19 = $84D3; + GL_TEXTURE20 = $84D4; + GL_TEXTURE21 = $84D5; + GL_TEXTURE22 = $84D6; + GL_TEXTURE23 = $84D7; + GL_TEXTURE24 = $84D8; + GL_TEXTURE25 = $84D9; + GL_TEXTURE26 = $84DA; + GL_TEXTURE27 = $84DB; + GL_TEXTURE28 = $84DC; + GL_TEXTURE29 = $84DD; + GL_TEXTURE30 = $84DE; + GL_TEXTURE31 = $84DF; + GL_ACTIVE_TEXTURE = $84E0; + GL_CLIENT_ACTIVE_TEXTURE = $84E1; + GL_MAX_TEXTURE_UNITS = $84E2; + GL_TRANSPOSE_MODELVIEW_MATRIX = $84E3; + GL_TRANSPOSE_PROJECTION_MATRIX = $84E4; + GL_TRANSPOSE_TEXTURE_MATRIX = $84E5; + GL_TRANSPOSE_COLOR_MATRIX = $84E6; + GL_MULTISAMPLE = $809D; + GL_SAMPLE_ALPHA_TO_COVERAGE = $809E; + GL_SAMPLE_ALPHA_TO_ONE = $809F; + GL_SAMPLE_COVERAGE = $80A0; + GL_SAMPLE_BUFFERS = $80A8; + GL_SAMPLES = $80A9; + GL_SAMPLE_COVERAGE_VALUE = $80AA; + GL_SAMPLE_COVERAGE_INVERT = $80AB; + GL_MULTISAMPLE_BIT = $20000000; + GL_NORMAL_MAP = $8511; + GL_REFLECTION_MAP = $8512; + GL_TEXTURE_CUBE_MAP = $8513; + GL_TEXTURE_BINDING_CUBE_MAP = $8514; + GL_TEXTURE_CUBE_MAP_POSITIVE_X = $8515; + GL_TEXTURE_CUBE_MAP_NEGATIVE_X = $8516; + GL_TEXTURE_CUBE_MAP_POSITIVE_Y = $8517; + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = $8518; + GL_TEXTURE_CUBE_MAP_POSITIVE_Z = $8519; + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = $851A; + GL_PROXY_TEXTURE_CUBE_MAP = $851B; + GL_MAX_CUBE_MAP_TEXTURE_SIZE = $851C; + GL_COMPRESSED_ALPHA = $84E9; + GL_COMPRESSED_LUMINANCE = $84EA; + GL_COMPRESSED_LUMINANCE_ALPHA = $84EB; + GL_COMPRESSED_INTENSITY = $84EC; + GL_COMPRESSED_RGB = $84ED; + GL_COMPRESSED_RGBA = $84EE; + GL_TEXTURE_COMPRESSION_HINT = $84EF; + GL_TEXTURE_COMPRESSED_IMAGE_SIZE = $86A0; + GL_TEXTURE_COMPRESSED = $86A1; + GL_NUM_COMPRESSED_TEXTURE_FORMATS = $86A2; + GL_COMPRESSED_TEXTURE_FORMATS = $86A3; + GL_CLAMP_TO_BORDER = $812D; + GL_CLAMP_TO_BORDER_SGIS = $812D; + GL_COMBINE = $8570; + GL_COMBINE_RGB = $8571; + GL_COMBINE_ALPHA = $8572; + GL_SOURCE0_RGB = $8580; + GL_SOURCE1_RGB = $8581; + GL_SOURCE2_RGB = $8582; + GL_SOURCE0_ALPHA = $8588; + GL_SOURCE1_ALPHA = $8589; + GL_SOURCE2_ALPHA = $858A; + GL_OPERAND0_RGB = $8590; + GL_OPERAND1_RGB = $8591; + GL_OPERAND2_RGB = $8592; + GL_OPERAND0_ALPHA = $8598; + GL_OPERAND1_ALPHA = $8599; + GL_OPERAND2_ALPHA = $859A; + GL_RGB_SCALE = $8573; + GL_ADD_SIGNED = $8574; + GL_INTERPOLATE = $8575; + GL_SUBTRACT = $84E7; + GL_CONSTANT = $8576; + GL_PRIMARY_COLOR = $8577; + GL_PREVIOUS = $8578; + GL_DOT3_RGB = $86AE; + GL_DOT3_RGBA = $86AF; +var + glActiveTexture: procedure(texture: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glClientActiveTexture: procedure(texture: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1d: procedure(target: GLenum; s: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1dv: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1f: procedure(target: GLenum; s: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1fv: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1i: procedure(target: GLenum; s: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1iv: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1s: procedure(target: GLenum; s: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1sv: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2d: procedure(target: GLenum; s: GLdouble; t: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2dv: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2f: procedure(target: GLenum; s: GLfloat; t: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2fv: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2i: procedure(target: GLenum; s: GLint; t: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2iv: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2s: procedure(target: GLenum; s: GLshort; t: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2sv: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3d: procedure(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3dv: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3f: procedure(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3fv: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3i: procedure(target: GLenum; s: GLint; t: GLint; r: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3iv: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3s: procedure(target: GLenum; s: GLshort; t: GLshort; r: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3sv: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4d: procedure(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble; q: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4dv: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4f: procedure(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat; q: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4fv: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4i: procedure(target: GLenum; s: GLint; t: GLint; r: GLint; q: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4iv: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4s: procedure(target: GLenum; s: GLshort; t: GLshort; r: GLshort; q: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4sv: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadTransposeMatrixf: procedure(const m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadTransposeMatrixd: procedure(const m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultTransposeMatrixf: procedure(const m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultTransposeMatrixd: procedure(const m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSampleCoverage: procedure(value: GLclampf; invert: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexImage3D: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexImage2D: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexImage1D: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexSubImage3D: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexSubImage2D: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; height: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexSubImage1D: procedure(target: GLenum; level: GLint; xoffset: GLint; width: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetCompressedTexImage: procedure(target: GLenum; level: GLint; img: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_version_1_3: Boolean; + +//***** GL_ARB_multitexture *****// +const + GL_TEXTURE0_ARB = $84C0; + GL_TEXTURE1_ARB = $84C1; + GL_TEXTURE2_ARB = $84C2; + GL_TEXTURE3_ARB = $84C3; + GL_TEXTURE4_ARB = $84C4; + GL_TEXTURE5_ARB = $84C5; + GL_TEXTURE6_ARB = $84C6; + GL_TEXTURE7_ARB = $84C7; + GL_TEXTURE8_ARB = $84C8; + GL_TEXTURE9_ARB = $84C9; + GL_TEXTURE10_ARB = $84CA; + GL_TEXTURE11_ARB = $84CB; + GL_TEXTURE12_ARB = $84CC; + GL_TEXTURE13_ARB = $84CD; + GL_TEXTURE14_ARB = $84CE; + GL_TEXTURE15_ARB = $84CF; + GL_TEXTURE16_ARB = $84D0; + GL_TEXTURE17_ARB = $84D1; + GL_TEXTURE18_ARB = $84D2; + GL_TEXTURE19_ARB = $84D3; + GL_TEXTURE20_ARB = $84D4; + GL_TEXTURE21_ARB = $84D5; + GL_TEXTURE22_ARB = $84D6; + GL_TEXTURE23_ARB = $84D7; + GL_TEXTURE24_ARB = $84D8; + GL_TEXTURE25_ARB = $84D9; + GL_TEXTURE26_ARB = $84DA; + GL_TEXTURE27_ARB = $84DB; + GL_TEXTURE28_ARB = $84DC; + GL_TEXTURE29_ARB = $84DD; + GL_TEXTURE30_ARB = $84DE; + GL_TEXTURE31_ARB = $84DF; + GL_ACTIVE_TEXTURE_ARB = $84E0; + GL_CLIENT_ACTIVE_TEXTURE_ARB = $84E1; + GL_MAX_TEXTURE_UNITS_ARB = $84E2; +var + glActiveTextureARB: procedure(texture: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glClientActiveTextureARB: procedure(texture: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1dARB: procedure(target: GLenum; s: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1dvARB: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1fARB: procedure(target: GLenum; s: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1fvARB: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1iARB: procedure(target: GLenum; s: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1ivARB: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1sARB: procedure(target: GLenum; s: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1svARB: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2dARB: procedure(target: GLenum; s: GLdouble; t: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2dvARB: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2fARB: procedure(target: GLenum; s: GLfloat; t: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2fvARB: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2iARB: procedure(target: GLenum; s: GLint; t: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2ivARB: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2sARB: procedure(target: GLenum; s: GLshort; t: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2svARB: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3dARB: procedure(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3dvARB: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3fARB: procedure(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3fvARB: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3iARB: procedure(target: GLenum; s: GLint; t: GLint; r: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3ivARB: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3sARB: procedure(target: GLenum; s: GLshort; t: GLshort; r: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3svARB: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4dARB: procedure(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble; q: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4dvARB: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4fARB: procedure(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat; q: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4fvARB: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4iARB: procedure(target: GLenum; s: GLint; t: GLint; r: GLint; q: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4ivARB: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4sARB: procedure(target: GLenum; s: GLshort; t: GLshort; r: GLshort; q: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4svARB: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_multitexture: Boolean; + +//***** GL_ARB_transpose_matrix *****// +const + GL_TRANSPOSE_MODELVIEW_MATRIX_ARB = $84E3; + GL_TRANSPOSE_PROJECTION_MATRIX_ARB = $84E4; + GL_TRANSPOSE_TEXTURE_MATRIX_ARB = $84E5; + GL_TRANSPOSE_COLOR_MATRIX_ARB = $84E6; +var + glLoadTransposeMatrixfARB: procedure(m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadTransposeMatrixdARB: procedure(m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultTransposeMatrixfARB: procedure(m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultTransposeMatrixdARB: procedure(m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_transpose_matrix: Boolean; + +//***** GL_ARB_multisample *****// +const + WGL_SAMPLE_BUFFERS_ARB = $2041; + WGL_SAMPLES_ARB = $2042; + GL_MULTISAMPLE_ARB = $809D; + GL_SAMPLE_ALPHA_TO_COVERAGE_ARB = $809E; + GL_SAMPLE_ALPHA_TO_ONE_ARB = $809F; + GL_SAMPLE_COVERAGE_ARB = $80A0; + GL_MULTISAMPLE_BIT_ARB = $20000000; + GL_SAMPLE_BUFFERS_ARB = $80A8; + GL_SAMPLES_ARB = $80A9; + GL_SAMPLE_COVERAGE_VALUE_ARB = $80AA; + GL_SAMPLE_COVERAGE_INVERT_ARB = $80AB; +var + glSampleCoverageARB: procedure(value: GLclampf; invert: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_multisample: Boolean; + +//***** GL_ARB_texture_env_add *****// + +function Load_GL_ARB_texture_env_add: Boolean; + +{$IFDEF Win32} +//***** WGL_ARB_extensions_string *****// +var + wglGetExtensionsStringARB: function(hdc: HDC): Pchar; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_ARB_extensions_string: Boolean; + +//***** WGL_ARB_buffer_region *****// +const + WGL_FRONT_COLOR_BUFFER_BIT_ARB = $0001; + WGL_BACK_COLOR_BUFFER_BIT_ARB = $0002; + WGL_DEPTH_BUFFER_BIT_ARB = $0004; + WGL_STENCIL_BUFFER_BIT_ARB = $0008; +var + wglCreateBufferRegionARB: function(hDC: HDC; iLayerPlane: GLint; uType: GLuint): THandle; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglDeleteBufferRegionARB: procedure(hRegion: THandle); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglSaveBufferRegionARB: function(hRegion: THandle; x: GLint; y: GLint; width: GLint; height: GLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglRestoreBufferRegionARB: function(hRegion: THandle; x: GLint; y: GLint; width: GLint; height: GLint; xSrc: GLint; ySrc: GLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_ARB_buffer_region: Boolean; +{$ENDIF} + +//***** GL_ARB_texture_cube_map *****// +const + GL_NORMAL_MAP_ARB = $8511; + GL_REFLECTION_MAP_ARB = $8512; + GL_TEXTURE_CUBE_MAP_ARB = $8513; + GL_TEXTURE_BINDING_CUBE_MAP_ARB = $8514; + GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = $8515; + GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = $8516; + GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = $8517; + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = $8518; + GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = $8519; + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = $851A; + GL_PROXY_TEXTURE_CUBE_MAP_ARB = $851B; + GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB = $851C; + +function Load_GL_ARB_texture_cube_map: Boolean; + +//***** GL_ARB_depth_texture *****// +const + GL_DEPTH_COMPONENT16_ARB = $81A5; + GL_DEPTH_COMPONENT24_ARB = $81A6; + GL_DEPTH_COMPONENT32_ARB = $81A7; + GL_TEXTURE_DEPTH_SIZE_ARB = $884A; + GL_DEPTH_TEXTURE_MODE_ARB = $884B; + +function Load_GL_ARB_depth_texture: Boolean; + +//***** GL_ARB_point_parameters *****// +const + GL_POINT_SIZE_MIN_ARB = $8126; + GL_POINT_SIZE_MAX_ARB = $8127; + GL_POINT_FADE_THRESHOLD_SIZE_ARB = $8128; + GL_POINT_DISTANCE_ATTENUATION_ARB = $8129; +var + glPointParameterfARB: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPointParameterfvARB: procedure(pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_point_parameters: Boolean; + +//***** GL_ARB_shadow *****// +const + GL_TEXTURE_COMPARE_MODE_ARB = $884C; + GL_TEXTURE_COMPARE_FUNC_ARB = $884D; + GL_COMPARE_R_TO_TEXTURE_ARB = $884E; + +function Load_GL_ARB_shadow: Boolean; + +//***** GL_ARB_shadow_ambient *****// +const + GL_TEXTURE_COMPARE_FAIL_VALUE_ARB = $80BF; + +function Load_GL_ARB_shadow_ambient: Boolean; + +//***** GL_ARB_texture_border_clamp *****// +const + GL_CLAMP_TO_BORDER_ARB = $812D; + +function Load_GL_ARB_texture_border_clamp: Boolean; + +//***** GL_ARB_texture_compression *****// +const + GL_COMPRESSED_ALPHA_ARB = $84E9; + GL_COMPRESSED_LUMINANCE_ARB = $84EA; + GL_COMPRESSED_LUMINANCE_ALPHA_ARB = $84EB; + GL_COMPRESSED_INTENSITY_ARB = $84EC; + GL_COMPRESSED_RGB_ARB = $84ED; + GL_COMPRESSED_RGBA_ARB = $84EE; + GL_TEXTURE_COMPRESSION_HINT_ARB = $84EF; + GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB = $86A0; + GL_TEXTURE_COMPRESSED_ARB = $86A1; + GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB = $86A2; + GL_COMPRESSED_TEXTURE_FORMATS_ARB = $86A3; +var + glCompressedTexImage3DARB: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexImage2DARB: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexImage1DARB: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexSubImage3DARB: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexSubImage2DARB: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; height: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexSubImage1DARB: procedure(target: GLenum; level: GLint; xoffset: GLint; width: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetCompressedTexImageARB: procedure(target: GLenum; lod: GLint; img: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_texture_compression: Boolean; + +//***** GL_ARB_texture_env_combine *****// +const + GL_COMBINE_ARB = $8570; + GL_COMBINE_RGB_ARB = $8571; + GL_COMBINE_ALPHA_ARB = $8572; + GL_SOURCE0_RGB_ARB = $8580; + GL_SOURCE1_RGB_ARB = $8581; + GL_SOURCE2_RGB_ARB = $8582; + GL_SOURCE0_ALPHA_ARB = $8588; + GL_SOURCE1_ALPHA_ARB = $8589; + GL_SOURCE2_ALPHA_ARB = $858A; + GL_OPERAND0_RGB_ARB = $8590; + GL_OPERAND1_RGB_ARB = $8591; + GL_OPERAND2_RGB_ARB = $8592; + GL_OPERAND0_ALPHA_ARB = $8598; + GL_OPERAND1_ALPHA_ARB = $8599; + GL_OPERAND2_ALPHA_ARB = $859A; + GL_RGB_SCALE_ARB = $8573; + GL_ADD_SIGNED_ARB = $8574; + GL_INTERPOLATE_ARB = $8575; + GL_SUBTRACT_ARB = $84E7; + GL_CONSTANT_ARB = $8576; + GL_PRIMARY_COLOR_ARB = $8577; + GL_PREVIOUS_ARB = $8578; + +function Load_GL_ARB_texture_env_combine: Boolean; + +//***** GL_ARB_texture_env_crossbar *****// + +function Load_GL_ARB_texture_env_crossbar: Boolean; + +//***** GL_ARB_texture_env_dot3 *****// +const + GL_DOT3_RGB_ARB = $86AE; + GL_DOT3_RGBA_ARB = $86AF; + +function Load_GL_ARB_texture_env_dot3: Boolean; + +//***** GL_ARB_texture_mirrored_repeat *****// +const + GL_MIRRORED_REPEAT_ARB = $8370; + +function Load_GL_ARB_texture_mirrored_repeat: Boolean; + +//***** GL_ARB_vertex_blend *****// +const + GL_MAX_VERTEX_UNITS_ARB = $86A4; + GL_ACTIVE_VERTEX_UNITS_ARB = $86A5; + GL_WEIGHT_SUM_UNITY_ARB = $86A6; + GL_VERTEX_BLEND_ARB = $86A7; + GL_MODELVIEW0_ARB = $1700; + GL_MODELVIEW1_ARB = $850A; + GL_MODELVIEW2_ARB = $8722; + GL_MODELVIEW3_ARB = $8723; + GL_MODELVIEW4_ARB = $8724; + GL_MODELVIEW5_ARB = $8725; + GL_MODELVIEW6_ARB = $8726; + GL_MODELVIEW7_ARB = $8727; + GL_MODELVIEW8_ARB = $8728; + GL_MODELVIEW9_ARB = $8729; + GL_MODELVIEW10_ARB = $872A; + GL_MODELVIEW11_ARB = $872B; + GL_MODELVIEW12_ARB = $872C; + GL_MODELVIEW13_ARB = $872D; + GL_MODELVIEW14_ARB = $872E; + GL_MODELVIEW15_ARB = $872F; + GL_MODELVIEW16_ARB = $8730; + GL_MODELVIEW17_ARB = $8731; + GL_MODELVIEW18_ARB = $8732; + GL_MODELVIEW19_ARB = $8733; + GL_MODELVIEW20_ARB = $8734; + GL_MODELVIEW21_ARB = $8735; + GL_MODELVIEW22_ARB = $8736; + GL_MODELVIEW23_ARB = $8737; + GL_MODELVIEW24_ARB = $8738; + GL_MODELVIEW25_ARB = $8739; + GL_MODELVIEW26_ARB = $873A; + GL_MODELVIEW27_ARB = $873B; + GL_MODELVIEW28_ARB = $873C; + GL_MODELVIEW29_ARB = $873D; + GL_MODELVIEW30_ARB = $873E; + GL_MODELVIEW31_ARB = $873F; + GL_CURRENT_WEIGHT_ARB = $86A8; + GL_WEIGHT_ARRAY_TYPE_ARB = $86A9; + GL_WEIGHT_ARRAY_STRIDE_ARB = $86AA; + GL_WEIGHT_ARRAY_SIZE_ARB = $86AB; + GL_WEIGHT_ARRAY_POINTER_ARB = $86AC; + GL_WEIGHT_ARRAY_ARB = $86AD; +var + glWeightbvARB: procedure(size: GLint; weights: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightsvARB: procedure(size: GLint; weights: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightivARB: procedure(size: GLint; weights: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightfvARB: procedure(size: GLint; weights: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightdvARB: procedure(size: GLint; weights: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightvARB: procedure(size: GLint; weights: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightubvARB: procedure(size: GLint; weights: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightusvARB: procedure(size: GLint; weights: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightuivARB: procedure(size: GLint; weights: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightPointerARB: procedure(size: GLint; _type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexBlendARB: procedure(count: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_vertex_blend: Boolean; + +//***** GL_ARB_vertex_program *****// +const + GL_VERTEX_PROGRAM_ARB = $8620; + GL_VERTEX_PROGRAM_POINT_SIZE_ARB = $8642; + GL_VERTEX_PROGRAM_TWO_SIDE_ARB = $8643; + GL_COLOR_SUM_ARB = $8458; + GL_PROGRAM_FORMAT_ASCII_ARB = $8875; + GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB = $8622; + GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB = $8623; + GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB = $8624; + GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB = $8625; + GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB = $886A; + GL_CURRENT_VERTEX_ATTRIB_ARB = $8626; + GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB = $8645; + GL_PROGRAM_LENGTH_ARB = $8627; + GL_PROGRAM_FORMAT_ARB = $8876; + GL_PROGRAM_BINDING_ARB = $8677; + GL_PROGRAM_INSTRUCTIONS_ARB = $88A0; + GL_MAX_PROGRAM_INSTRUCTIONS_ARB = $88A1; + GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB = $88A2; + GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB = $88A3; + GL_PROGRAM_TEMPORARIES_ARB = $88A4; + GL_MAX_PROGRAM_TEMPORARIES_ARB = $88A5; + GL_PROGRAM_NATIVE_TEMPORARIES_ARB = $88A6; + GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB = $88A7; + GL_PROGRAM_PARAMETERS_ARB = $88A8; + GL_MAX_PROGRAM_PARAMETERS_ARB = $88A9; + GL_PROGRAM_NATIVE_PARAMETERS_ARB = $88AA; + GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB = $88AB; + GL_PROGRAM_ATTRIBS_ARB = $88AC; + GL_MAX_PROGRAM_ATTRIBS_ARB = $88AD; + GL_PROGRAM_NATIVE_ATTRIBS_ARB = $88AE; + GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB = $88AF; + GL_PROGRAM_ADDRESS_REGISTERS_ARB = $88B0; + GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB = $88B1; + GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = $88B2; + GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = $88B3; + GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB = $88B4; + GL_MAX_PROGRAM_ENV_PARAMETERS_ARB = $88B5; + GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB = $88B6; + GL_PROGRAM_STRING_ARB = $8628; + GL_PROGRAM_ERROR_POSITION_ARB = $864B; + GL_CURRENT_MATRIX_ARB = $8641; + GL_TRANSPOSE_CURRENT_MATRIX_ARB = $88B7; + GL_CURRENT_MATRIX_STACK_DEPTH_ARB = $8640; + GL_MAX_VERTEX_ATTRIBS_ARB = $8869; + GL_MAX_PROGRAM_MATRICES_ARB = $862F; + GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB = $862E; + GL_PROGRAM_ERROR_STRING_ARB = $8874; + GL_MATRIX0_ARB = $88C0; + GL_MATRIX1_ARB = $88C1; + GL_MATRIX2_ARB = $88C2; + GL_MATRIX3_ARB = $88C3; + GL_MATRIX4_ARB = $88C4; + GL_MATRIX5_ARB = $88C5; + GL_MATRIX6_ARB = $88C6; + GL_MATRIX7_ARB = $88C7; + GL_MATRIX8_ARB = $88C8; + GL_MATRIX9_ARB = $88C9; + GL_MATRIX10_ARB = $88CA; + GL_MATRIX11_ARB = $88CB; + GL_MATRIX12_ARB = $88CC; + GL_MATRIX13_ARB = $88CD; + GL_MATRIX14_ARB = $88CE; + GL_MATRIX15_ARB = $88CF; + GL_MATRIX16_ARB = $88D0; + GL_MATRIX17_ARB = $88D1; + GL_MATRIX18_ARB = $88D2; + GL_MATRIX19_ARB = $88D3; + GL_MATRIX20_ARB = $88D4; + GL_MATRIX21_ARB = $88D5; + GL_MATRIX22_ARB = $88D6; + GL_MATRIX23_ARB = $88D7; + GL_MATRIX24_ARB = $88D8; + GL_MATRIX25_ARB = $88D9; + GL_MATRIX26_ARB = $88DA; + GL_MATRIX27_ARB = $88DB; + GL_MATRIX28_ARB = $88DC; + GL_MATRIX29_ARB = $88DD; + GL_MATRIX30_ARB = $88DE; + GL_MATRIX31_ARB = $88DF; +var + glVertexAttrib1sARB: procedure(index: GLuint; x: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1fARB: procedure(index: GLuint; x: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1dARB: procedure(index: GLuint; x: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2sARB: procedure(index: GLuint; x: GLshort; y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2fARB: procedure(index: GLuint; x: GLfloat; y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2dARB: procedure(index: GLuint; x: GLdouble; y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3sARB: procedure(index: GLuint; x: GLshort; y: GLshort; z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3fARB: procedure(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3dARB: procedure(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4sARB: procedure(index: GLuint; x: GLshort; y: GLshort; z: GLshort; w: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4fARB: procedure(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4dARB: procedure(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4NubARB: procedure(index: GLuint; x: GLubyte; y: GLubyte; z: GLubyte; w: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1svARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1fvARB: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1dvARB: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2svARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2fvARB: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2dvARB: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3svARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3fvARB: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3dvARB: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4bvARB: procedure(index: GLuint; const v: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4svARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4ivARB: procedure(index: GLuint; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4ubvARB: procedure(index: GLuint; const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4usvARB: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4uivARB: procedure(index: GLuint; const v: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4fvARB: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4dvARB: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4NbvARB: procedure(index: GLuint; const v: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4NsvARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4NivARB: procedure(index: GLuint; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4NubvARB: procedure(index: GLuint; const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4NusvARB: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4NuivARB: procedure(index: GLuint; const v: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribPointerARB: procedure(index: GLuint; size: GLint; _type: GLenum; normalized: GLboolean; stride: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEnableVertexAttribArrayARB: procedure(index: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDisableVertexAttribArrayARB: procedure(index: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramStringARB: procedure(target: GLenum; format: GLenum; len: GLsizei; const _string: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindProgramARB: procedure(target: GLenum; _program: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteProgramsARB: procedure(n: GLsizei; const programs: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenProgramsARB: procedure(n: GLsizei; programs: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramEnvParameter4dARB: procedure(target: GLenum; index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramEnvParameter4dvARB: procedure(target: GLenum; index: GLuint; const params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramEnvParameter4fARB: procedure(target: GLenum; index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramEnvParameter4fvARB: procedure(target: GLenum; index: GLuint; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramLocalParameter4dARB: procedure(target: GLenum; index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramLocalParameter4dvARB: procedure(target: GLenum; index: GLuint; const params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramLocalParameter4fARB: procedure(target: GLenum; index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramLocalParameter4fvARB: procedure(target: GLenum; index: GLuint; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramEnvParameterdvARB: procedure(target: GLenum; index: GLuint; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramEnvParameterfvARB: procedure(target: GLenum; index: GLuint; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramLocalParameterdvARB: procedure(target: GLenum; index: GLuint; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramLocalParameterfvARB: procedure(target: GLenum; index: GLuint; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramivARB: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramStringARB: procedure(target: GLenum; pname: GLenum; _string: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribdvARB: procedure(index: GLuint; pname: GLenum; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribfvARB: procedure(index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribivARB: procedure(index: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribPointervARB: procedure(index: GLuint; pname: GLenum; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsProgramARB: function(_program: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_vertex_program: Boolean; + +//***** GL_ARB_window_pos *****// +var + glWindowPos2dARB: procedure(x: GLdouble; y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2fARB: procedure(x: GLfloat; y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2iARB: procedure(x: GLint; y: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2sARB: procedure(x: GLshort; y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2dvARB: procedure(const p: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2fvARB: procedure(const p: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2ivARB: procedure(const p: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2svARB: procedure(const p: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3dARB: procedure(x: GLdouble; y: GLdouble; z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3fARB: procedure(x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3iARB: procedure(x: GLint; y: GLint; z: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3sARB: procedure(x: GLshort; y: GLshort; z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3dvARB: procedure(const p: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3fvARB: procedure(const p: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3ivARB: procedure(const p: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3svARB: procedure(const p: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_window_pos: Boolean; + +//***** GL_EXT_422_pixels *****// +const + GL_422_EXT = $80CC; + GL_422_REV_EXT = $80CD; + GL_422_AVERAGE_EXT = $80CE; + GL_422_REV_AVERAGE_EXT = $80CF; + +function Load_GL_EXT_422_pixels: Boolean; + +//***** GL_EXT_abgr *****// +const + GL_ABGR_EXT = $8000; + +function Load_GL_EXT_abgr: Boolean; + +//***** GL_EXT_bgra *****// +const + GL_BGR_EXT = $80E0; + GL_BGRA_EXT = $80E1; + +function Load_GL_EXT_bgra: Boolean; + +//***** GL_EXT_blend_color *****// +const + GL_CONSTANT_COLOR_EXT = $8001; + GL_ONE_MINUS_CONSTANT_COLOR_EXT = $8002; + GL_CONSTANT_ALPHA_EXT = $8003; + GL_ONE_MINUS_CONSTANT_ALPHA_EXT = $8004; + GL_BLEND_COLOR_EXT = $8005; +var + glBlendColorEXT: procedure(red: GLclampf; green: GLclampf; blue: GLclampf; alpha: GLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_blend_color: Boolean; + +//***** GL_EXT_blend_func_separate *****// +const + GL_BLEND_DST_RGB_EXT = $80C8; + GL_BLEND_SRC_RGB_EXT = $80C9; + GL_BLEND_DST_ALPHA_EXT = $80CA; + GL_BLEND_SRC_ALPHA_EXT = $80CB; +var + glBlendFuncSeparateEXT: procedure(sfactorRGB: GLenum; dfactorRGB: GLenum; sfactorAlpha: GLenum; dfactorAlpha: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_blend_func_separate: Boolean; + +//***** GL_EXT_blend_logic_op *****// + +function Load_GL_EXT_blend_logic_op: Boolean; + +//***** GL_EXT_blend_minmax *****// +const + GL_FUNC_ADD_EXT = $8006; + GL_MIN_EXT = $8007; + GL_MAX_EXT = $8008; + GL_BLEND_EQUATION_EXT = $8009; +var + glBlendEquationEXT: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_blend_minmax: Boolean; + +//***** GL_EXT_blend_subtract *****// +const + GL_FUNC_SUBTRACT_EXT = $800A; + GL_FUNC_REVERSE_SUBTRACT_EXT = $800B; + +function Load_GL_EXT_blend_subtract: Boolean; + +//***** GL_EXT_clip_volume_hint *****// +const + GL_CLIP_VOLUME_CLIPPING_HINT_EXT = $80F0; + +function Load_GL_EXT_clip_volume_hint: Boolean; + +//***** GL_EXT_color_subtable *****// +var + glColorSubTableEXT: procedure(target: GLenum; start: GLsizei; count: GLsizei; format: GLenum; _type: GLenum; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyColorSubTableEXT: procedure(target: GLenum; start: GLsizei; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_color_subtable: Boolean; + +//***** GL_EXT_compiled_vertex_array *****// +const + GL_ARRAY_ELEMENT_LOCK_FIRST_EXT = $81A8; + GL_ARRAY_ELEMENT_LOCK_COUNT_EXT = $81A9; +var + glLockArraysEXT: procedure(first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUnlockArraysEXT: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_compiled_vertex_array: Boolean; + +//***** GL_EXT_convolution *****// +const + GL_CONVOLUTION_1D_EXT = $8010; + GL_CONVOLUTION_2D_EXT = $8011; + GL_SEPARABLE_2D_EXT = $8012; + GL_CONVOLUTION_BORDER_MODE_EXT = $8013; + GL_CONVOLUTION_FILTER_SCALE_EXT = $8014; + GL_CONVOLUTION_FILTER_BIAS_EXT = $8015; + GL_REDUCE_EXT = $8016; + GL_CONVOLUTION_FORMAT_EXT = $8017; + GL_CONVOLUTION_WIDTH_EXT = $8018; + GL_CONVOLUTION_HEIGHT_EXT = $8019; + GL_MAX_CONVOLUTION_WIDTH_EXT = $801A; + GL_MAX_CONVOLUTION_HEIGHT_EXT = $801B; + GL_POST_CONVOLUTION_RED_SCALE_EXT = $801C; + GL_POST_CONVOLUTION_GREEN_SCALE_EXT = $801D; + GL_POST_CONVOLUTION_BLUE_SCALE_EXT = $801E; + GL_POST_CONVOLUTION_ALPHA_SCALE_EXT = $801F; + GL_POST_CONVOLUTION_RED_BIAS_EXT = $8020; + GL_POST_CONVOLUTION_GREEN_BIAS_EXT = $8021; + GL_POST_CONVOLUTION_BLUE_BIAS_EXT = $8022; + GL_POST_CONVOLUTION_ALPHA_BIAS_EXT = $8023; +var + glConvolutionFilter1DEXT: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionFilter2DEXT: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyConvolutionFilter1DEXT: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyConvolutionFilter2DEXT: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei; height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetConvolutionFilterEXT: procedure(target: GLenum; format: GLenum; _type: GLenum; image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSeparableFilter2DEXT: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const row: PGLvoid; const column: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetSeparableFilterEXT: procedure(target: GLenum; format: GLenum; _type: GLenum; row: PGLvoid; column: PGLvoid; span: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameteriEXT: procedure(target: GLenum; pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameterivEXT: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameterfEXT: procedure(target: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameterfvEXT: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetConvolutionParameterivEXT: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetConvolutionParameterfvEXT: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_convolution: Boolean; + +//***** GL_EXT_histogram *****// +const + GL_HISTOGRAM_EXT = $8024; + GL_PROXY_HISTOGRAM_EXT = $8025; + GL_HISTOGRAM_WIDTH_EXT = $8026; + GL_HISTOGRAM_FORMAT_EXT = $8027; + GL_HISTOGRAM_RED_SIZE_EXT = $8028; + GL_HISTOGRAM_GREEN_SIZE_EXT = $8029; + GL_HISTOGRAM_BLUE_SIZE_EXT = $802A; + GL_HISTOGRAM_ALPHA_SIZE_EXT = $802B; + GL_HISTOGRAM_LUMINANCE_SIZE_EXT = $802C; + GL_HISTOGRAM_SINK_EXT = $802D; + GL_MINMAX_EXT = $802E; + GL_MINMAX_FORMAT_EXT = $802F; + GL_MINMAX_SINK_EXT = $8030; +var + glHistogramEXT: procedure(target: GLenum; width: GLsizei; internalformat: GLenum; sink: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glResetHistogramEXT: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetHistogramEXT: procedure(target: GLenum; reset: GLboolean; format: GLenum; _type: GLenum; values: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetHistogramParameterivEXT: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetHistogramParameterfvEXT: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMinmaxEXT: procedure(target: GLenum; internalformat: GLenum; sink: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glResetMinmaxEXT: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMinmaxEXT: procedure(target: GLenum; reset: GLboolean; format: GLenum; _type: GLenum; values: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMinmaxParameterivEXT: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMinmaxParameterfvEXT: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_histogram: Boolean; + +//***** GL_EXT_multi_draw_arrays *****// +var + glMultiDrawArraysEXT: procedure(mode: GLenum; first: PGLint; count: PGLsizei; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiDrawElementsEXT: procedure(mode: GLenum; count: PGLsizei; _type: GLenum; const indices: PGLvoid; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_multi_draw_arrays: Boolean; + +//***** GL_EXT_packed_pixels *****// +const + GL_UNSIGNED_BYTE_3_3_2_EXT = $8032; + GL_UNSIGNED_SHORT_4_4_4_4_EXT = $8033; + GL_UNSIGNED_SHORT_5_5_5_1_EXT = $8034; + GL_UNSIGNED_INT_8_8_8_8_EXT = $8035; + GL_UNSIGNED_INT_10_10_10_2_EXT = $8036; + +function Load_GL_EXT_packed_pixels: Boolean; + +//***** GL_EXT_paletted_texture *****// +const + GL_COLOR_INDEX1_EXT = $80E2; + GL_COLOR_INDEX2_EXT = $80E3; + GL_COLOR_INDEX4_EXT = $80E4; + GL_COLOR_INDEX8_EXT = $80E5; + GL_COLOR_INDEX12_EXT = $80E6; + GL_COLOR_INDEX16_EXT = $80E7; + GL_COLOR_TABLE_FORMAT_EXT = $80D8; + GL_COLOR_TABLE_WIDTH_EXT = $80D9; + GL_COLOR_TABLE_RED_SIZE_EXT = $80DA; + GL_COLOR_TABLE_GREEN_SIZE_EXT = $80DB; + GL_COLOR_TABLE_BLUE_SIZE_EXT = $80DC; + GL_COLOR_TABLE_ALPHA_SIZE_EXT = $80DD; + GL_COLOR_TABLE_LUMINANCE_SIZE_EXT = $80DE; + GL_COLOR_TABLE_INTENSITY_SIZE_EXT = $80DF; + GL_TEXTURE_INDEX_SIZE_EXT = $80ED; + GL_TEXTURE_1D = $0DE0; + GL_TEXTURE_2D = $0DE1; + GL_TEXTURE_3D_EXT = $806F; + // GL_TEXTURE_CUBE_MAP_ARB { already defined } + GL_PROXY_TEXTURE_1D = $8063; + GL_PROXY_TEXTURE_2D = $8064; + GL_PROXY_TEXTURE_3D_EXT = $8070; + // GL_PROXY_TEXTURE_CUBE_MAP_ARB { already defined } + // GL_TEXTURE_1D { already defined } + // GL_TEXTURE_2D { already defined } + // GL_TEXTURE_3D_EXT { already defined } + // GL_TEXTURE_CUBE_MAP_ARB { already defined } +var + glColorTableEXT: procedure(target: GLenum; internalFormat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + // glColorSubTableEXT { already defined } + glGetColorTableEXT: procedure(target: GLenum; format: GLenum; _type: GLenum; data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTableParameterivEXT: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTableParameterfvEXT: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_paletted_texture: Boolean; + +//***** GL_EXT_point_parameters *****// +const + GL_POINT_SIZE_MIN_EXT = $8126; + GL_POINT_SIZE_MAX_EXT = $8127; + GL_POINT_FADE_THRESHOLD_SIZE_EXT = $8128; + GL_DISTANCE_ATTENUATION_EXT = $8129; +var + glPointParameterfEXT: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPointParameterfvEXT: procedure(pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_point_parameters: Boolean; + +//***** GL_EXT_polygon_offset *****// +const + GL_POLYGON_OFFSET_EXT = $8037; + GL_POLYGON_OFFSET_FACTOR_EXT = $8038; + GL_POLYGON_OFFSET_BIAS_EXT = $8039; +var + glPolygonOffsetEXT: procedure(factor: GLfloat; bias: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_polygon_offset: Boolean; + +//***** GL_EXT_separate_specular_color *****// +const + GL_LIGHT_MODEL_COLOR_CONTROL_EXT = $81F8; + GL_SINGLE_COLOR_EXT = $81F9; + GL_SEPARATE_SPECULAR_COLOR_EXT = $81FA; + +function Load_GL_EXT_separate_specular_color: Boolean; + +//***** GL_EXT_shadow_funcs *****// + +function Load_GL_EXT_shadow_funcs: Boolean; + +//***** GL_EXT_shared_texture_palette *****// +const + GL_SHARED_TEXTURE_PALETTE_EXT = $81FB; + +function Load_GL_EXT_shared_texture_palette: Boolean; + +//***** GL_EXT_stencil_two_side *****// +const + GL_STENCIL_TEST_TWO_SIDE_EXT = $8910; + GL_ACTIVE_STENCIL_FACE_EXT = $8911; +var + glActiveStencilFaceEXT: procedure(face: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_stencil_two_side: Boolean; + +//***** GL_EXT_stencil_wrap *****// +const + GL_INCR_WRAP_EXT = $8507; + GL_DECR_WRAP_EXT = $8508; + +function Load_GL_EXT_stencil_wrap: Boolean; + +//***** GL_EXT_subtexture *****// +var + glTexSubImage1DEXT: procedure(target: GLenum; level: GLint; xoffset: GLint; width: GLsizei; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexSubImage2DEXT: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexSubImage3DEXT: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_subtexture: Boolean; + +//***** GL_EXT_texture3D *****// +const + GL_PACK_SKIP_IMAGES_EXT = $806B; + GL_PACK_IMAGE_HEIGHT_EXT = $806C; + GL_UNPACK_SKIP_IMAGES_EXT = $806D; + GL_UNPACK_IMAGE_HEIGHT_EXT = $806E; + // GL_TEXTURE_3D_EXT { already defined } + // GL_PROXY_TEXTURE_3D_EXT { already defined } + GL_TEXTURE_DEPTH_EXT = $8071; + GL_TEXTURE_WRAP_R_EXT = $8072; + GL_MAX_3D_TEXTURE_SIZE_EXT = $8073; +var + glTexImage3DEXT: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_texture3D: Boolean; + +//***** GL_EXT_texture_compression_s3tc *****// +const + GL_COMPRESSED_RGB_S3TC_DXT1_EXT = $83F0; + GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = $83F1; + GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = $83F2; + GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = $83F3; + +function Load_GL_EXT_texture_compression_s3tc: Boolean; + +//***** GL_EXT_texture_env_add *****// + +function Load_GL_EXT_texture_env_add: Boolean; + +//***** GL_EXT_texture_env_combine *****// +const + GL_COMBINE_EXT = $8570; + GL_COMBINE_RGB_EXT = $8571; + GL_COMBINE_ALPHA_EXT = $8572; + GL_SOURCE0_RGB_EXT = $8580; + GL_SOURCE1_RGB_EXT = $8581; + GL_SOURCE2_RGB_EXT = $8582; + GL_SOURCE0_ALPHA_EXT = $8588; + GL_SOURCE1_ALPHA_EXT = $8589; + GL_SOURCE2_ALPHA_EXT = $858A; + GL_OPERAND0_RGB_EXT = $8590; + GL_OPERAND1_RGB_EXT = $8591; + GL_OPERAND2_RGB_EXT = $8592; + GL_OPERAND0_ALPHA_EXT = $8598; + GL_OPERAND1_ALPHA_EXT = $8599; + GL_OPERAND2_ALPHA_EXT = $859A; + GL_RGB_SCALE_EXT = $8573; + GL_ADD_SIGNED_EXT = $8574; + GL_INTERPOLATE_EXT = $8575; + GL_CONSTANT_EXT = $8576; + GL_PRIMARY_COLOR_EXT = $8577; + GL_PREVIOUS_EXT = $8578; + +function Load_GL_EXT_texture_env_combine: Boolean; + +//***** GL_EXT_texture_env_dot3 *****// +const + GL_DOT3_RGB_EXT = $8740; + GL_DOT3_RGBA_EXT = $8741; + +function Load_GL_EXT_texture_env_dot3: Boolean; + +//***** GL_EXT_texture_filter_anisotropic *****// +const + GL_TEXTURE_MAX_ANISOTROPY_EXT = $84FE; + GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = $84FF; + +function Load_GL_EXT_texture_filter_anisotropic: Boolean; + +//***** GL_EXT_texture_lod_bias *****// +const + GL_TEXTURE_FILTER_CONTROL_EXT = $8500; + GL_TEXTURE_LOD_BIAS_EXT = $8501; + GL_MAX_TEXTURE_LOD_BIAS_EXT = $84FD; + +function Load_GL_EXT_texture_lod_bias: Boolean; + +//***** GL_EXT_texture_object *****// +const + GL_TEXTURE_PRIORITY_EXT = $8066; + GL_TEXTURE_RESIDENT_EXT = $8067; + GL_TEXTURE_1D_BINDING_EXT = $8068; + GL_TEXTURE_2D_BINDING_EXT = $8069; + GL_TEXTURE_3D_BINDING_EXT = $806A; +var + glGenTexturesEXT: procedure(n: GLsizei; textures: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteTexturesEXT: procedure(n: GLsizei; const textures: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindTextureEXT: procedure(target: GLenum; texture: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPrioritizeTexturesEXT: procedure(n: GLsizei; const textures: PGLuint; const priorities: PGLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glAreTexturesResidentEXT: function(n: GLsizei; const textures: PGLuint; residences: PGLboolean): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsTextureEXT: function(texture: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_texture_object: Boolean; + +//***** GL_EXT_vertex_array *****// +const + GL_VERTEX_ARRAY_EXT = $8074; + GL_NORMAL_ARRAY_EXT = $8075; + GL_COLOR_ARRAY_EXT = $8076; + GL_INDEX_ARRAY_EXT = $8077; + GL_TEXTURE_COORD_ARRAY_EXT = $8078; + GL_EDGE_FLAG_ARRAY_EXT = $8079; + GL_DOUBLE_EXT = $140A; + GL_VERTEX_ARRAY_SIZE_EXT = $807A; + GL_VERTEX_ARRAY_TYPE_EXT = $807B; + GL_VERTEX_ARRAY_STRIDE_EXT = $807C; + GL_VERTEX_ARRAY_COUNT_EXT = $807D; + GL_NORMAL_ARRAY_TYPE_EXT = $807E; + GL_NORMAL_ARRAY_STRIDE_EXT = $807F; + GL_NORMAL_ARRAY_COUNT_EXT = $8080; + GL_COLOR_ARRAY_SIZE_EXT = $8081; + GL_COLOR_ARRAY_TYPE_EXT = $8082; + GL_COLOR_ARRAY_STRIDE_EXT = $8083; + GL_COLOR_ARRAY_COUNT_EXT = $8084; + GL_INDEX_ARRAY_TYPE_EXT = $8085; + GL_INDEX_ARRAY_STRIDE_EXT = $8086; + GL_INDEX_ARRAY_COUNT_EXT = $8087; + GL_TEXTURE_COORD_ARRAY_SIZE_EXT = $8088; + GL_TEXTURE_COORD_ARRAY_TYPE_EXT = $8089; + GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = $808A; + GL_TEXTURE_COORD_ARRAY_COUNT_EXT = $808B; + GL_EDGE_FLAG_ARRAY_STRIDE_EXT = $808C; + GL_EDGE_FLAG_ARRAY_COUNT_EXT = $808D; + GL_VERTEX_ARRAY_POINTER_EXT = $808E; + GL_NORMAL_ARRAY_POINTER_EXT = $808F; + GL_COLOR_ARRAY_POINTER_EXT = $8090; + GL_INDEX_ARRAY_POINTER_EXT = $8091; + GL_TEXTURE_COORD_ARRAY_POINTER_EXT = $8092; + GL_EDGE_FLAG_ARRAY_POINTER_EXT = $8093; +var + glArrayElementEXT: procedure(i: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawArraysEXT: procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalPointerEXT: procedure(_type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexPointerEXT: procedure(_type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoordPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEdgeFlagPointerEXT: procedure(stride: GLsizei; count: GLsizei; const pointer: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPointervEXT: procedure(pname: GLenum; params: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_vertex_array: Boolean; + +//***** GL_EXT_vertex_shader *****// +const + GL_VERTEX_SHADER_EXT = $8780; + GL_VARIANT_VALUE_EXT = $87E4; + GL_VARIANT_DATATYPE_EXT = $87E5; + GL_VARIANT_ARRAY_STRIDE_EXT = $87E6; + GL_VARIANT_ARRAY_TYPE_EXT = $87E7; + GL_VARIANT_ARRAY_EXT = $87E8; + GL_VARIANT_ARRAY_POINTER_EXT = $87E9; + GL_INVARIANT_VALUE_EXT = $87EA; + GL_INVARIANT_DATATYPE_EXT = $87EB; + GL_LOCAL_CONSTANT_VALUE_EXT = $87EC; + GL_LOCAL_CONSTANT_DATATYPE_EXT = $87ED; + GL_OP_INDEX_EXT = $8782; + GL_OP_NEGATE_EXT = $8783; + GL_OP_DOT3_EXT = $8784; + GL_OP_DOT4_EXT = $8785; + GL_OP_MUL_EXT = $8786; + GL_OP_ADD_EXT = $8787; + GL_OP_MADD_EXT = $8788; + GL_OP_FRAC_EXT = $8789; + GL_OP_MAX_EXT = $878A; + GL_OP_MIN_EXT = $878B; + GL_OP_SET_GE_EXT = $878C; + GL_OP_SET_LT_EXT = $878D; + GL_OP_CLAMP_EXT = $878E; + GL_OP_FLOOR_EXT = $878F; + GL_OP_ROUND_EXT = $8790; + GL_OP_EXP_BASE_2_EXT = $8791; + GL_OP_LOG_BASE_2_EXT = $8792; + GL_OP_POWER_EXT = $8793; + GL_OP_RECIP_EXT = $8794; + GL_OP_RECIP_SQRT_EXT = $8795; + GL_OP_SUB_EXT = $8796; + GL_OP_CROSS_PRODUCT_EXT = $8797; + GL_OP_MULTIPLY_MATRIX_EXT = $8798; + GL_OP_MOV_EXT = $8799; + GL_OUTPUT_VERTEX_EXT = $879A; + GL_OUTPUT_COLOR0_EXT = $879B; + GL_OUTPUT_COLOR1_EXT = $879C; + GL_OUTPUT_TEXTURE_COORD0_EXT = $879D; + GL_OUTPUT_TEXTURE_COORD1_EXT = $879E; + GL_OUTPUT_TEXTURE_COORD2_EXT = $879F; + GL_OUTPUT_TEXTURE_COORD3_EXT = $87A0; + GL_OUTPUT_TEXTURE_COORD4_EXT = $87A1; + GL_OUTPUT_TEXTURE_COORD5_EXT = $87A2; + GL_OUTPUT_TEXTURE_COORD6_EXT = $87A3; + GL_OUTPUT_TEXTURE_COORD7_EXT = $87A4; + GL_OUTPUT_TEXTURE_COORD8_EXT = $87A5; + GL_OUTPUT_TEXTURE_COORD9_EXT = $87A6; + GL_OUTPUT_TEXTURE_COORD10_EXT = $87A7; + GL_OUTPUT_TEXTURE_COORD11_EXT = $87A8; + GL_OUTPUT_TEXTURE_COORD12_EXT = $87A9; + GL_OUTPUT_TEXTURE_COORD13_EXT = $87AA; + GL_OUTPUT_TEXTURE_COORD14_EXT = $87AB; + GL_OUTPUT_TEXTURE_COORD15_EXT = $87AC; + GL_OUTPUT_TEXTURE_COORD16_EXT = $87AD; + GL_OUTPUT_TEXTURE_COORD17_EXT = $87AE; + GL_OUTPUT_TEXTURE_COORD18_EXT = $87AF; + GL_OUTPUT_TEXTURE_COORD19_EXT = $87B0; + GL_OUTPUT_TEXTURE_COORD20_EXT = $87B1; + GL_OUTPUT_TEXTURE_COORD21_EXT = $87B2; + GL_OUTPUT_TEXTURE_COORD22_EXT = $87B3; + GL_OUTPUT_TEXTURE_COORD23_EXT = $87B4; + GL_OUTPUT_TEXTURE_COORD24_EXT = $87B5; + GL_OUTPUT_TEXTURE_COORD25_EXT = $87B6; + GL_OUTPUT_TEXTURE_COORD26_EXT = $87B7; + GL_OUTPUT_TEXTURE_COORD27_EXT = $87B8; + GL_OUTPUT_TEXTURE_COORD28_EXT = $87B9; + GL_OUTPUT_TEXTURE_COORD29_EXT = $87BA; + GL_OUTPUT_TEXTURE_COORD30_EXT = $87BB; + GL_OUTPUT_TEXTURE_COORD31_EXT = $87BC; + GL_OUTPUT_FOG_EXT = $87BD; + GL_SCALAR_EXT = $87BE; + GL_VECTOR_EXT = $87BF; + GL_MATRIX_EXT = $87C0; + GL_VARIANT_EXT = $87C1; + GL_INVARIANT_EXT = $87C2; + GL_LOCAL_CONSTANT_EXT = $87C3; + GL_LOCAL_EXT = $87C4; + GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT = $87C5; + GL_MAX_VERTEX_SHADER_VARIANTS_EXT = $87C6; + GL_MAX_VERTEX_SHADER_INVARIANTS_EXT = $87C7; + GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = $87C8; + GL_MAX_VERTEX_SHADER_LOCALS_EXT = $87C9; + GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT = $87CA; + GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT = $87CB; + GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = $87CC; + GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT = $87CD; + GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT = $87CE; + GL_VERTEX_SHADER_INSTRUCTIONS_EXT = $87CF; + GL_VERTEX_SHADER_VARIANTS_EXT = $87D0; + GL_VERTEX_SHADER_INVARIANTS_EXT = $87D1; + GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = $87D2; + GL_VERTEX_SHADER_LOCALS_EXT = $87D3; + GL_VERTEX_SHADER_BINDING_EXT = $8781; + GL_VERTEX_SHADER_OPTIMIZED_EXT = $87D4; + GL_X_EXT = $87D5; + GL_Y_EXT = $87D6; + GL_Z_EXT = $87D7; + GL_W_EXT = $87D8; + GL_NEGATIVE_X_EXT = $87D9; + GL_NEGATIVE_Y_EXT = $87DA; + GL_NEGATIVE_Z_EXT = $87DB; + GL_NEGATIVE_W_EXT = $87DC; + GL_ZERO_EXT = $87DD; + GL_ONE_EXT = $87DE; + GL_NEGATIVE_ONE_EXT = $87DF; + GL_NORMALIZED_RANGE_EXT = $87E0; + GL_FULL_RANGE_EXT = $87E1; + GL_CURRENT_VERTEX_EXT = $87E2; + GL_MVP_MATRIX_EXT = $87E3; +var + glBeginVertexShaderEXT: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEndVertexShaderEXT: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindVertexShaderEXT: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenVertexShadersEXT: function(range: GLuint): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteVertexShaderEXT: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glShaderOp1EXT: procedure(op: GLenum; res: GLuint; arg1: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glShaderOp2EXT: procedure(op: GLenum; res: GLuint; arg1: GLuint; arg2: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glShaderOp3EXT: procedure(op: GLenum; res: GLuint; arg1: GLuint; arg2: GLuint; arg3: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSwizzleEXT: procedure(res: GLuint; _in: GLuint; outX: GLenum; outY: GLenum; outZ: GLenum; outW: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWriteMaskEXT: procedure(res: GLuint; _in: GLuint; outX: GLenum; outY: GLenum; outZ: GLenum; outW: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glInsertComponentEXT: procedure(res: GLuint; src: GLuint; num: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glExtractComponentEXT: procedure(res: GLuint; src: GLuint; num: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenSymbolsEXT: function(datatype: GLenum; storagetype: GLenum; range: GLenum; components: GLuint): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSetInvariantEXT: procedure(id: GLuint; _type: GLenum; addr: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSetLocalConstantEXT: procedure(id: GLuint; _type: GLenum; addr: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantbvEXT: procedure(id: GLuint; addr: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantsvEXT: procedure(id: GLuint; addr: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantivEXT: procedure(id: GLuint; addr: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantfvEXT: procedure(id: GLuint; addr: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantdvEXT: procedure(id: GLuint; addr: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantubvEXT: procedure(id: GLuint; addr: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantusvEXT: procedure(id: GLuint; addr: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantuivEXT: procedure(id: GLuint; addr: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantPointerEXT: procedure(id: GLuint; _type: GLenum; stride: GLuint; addr: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEnableVariantClientStateEXT: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDisableVariantClientStateEXT: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindLightParameterEXT: function(light: GLenum; value: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindMaterialParameterEXT: function(face: GLenum; value: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindTexGenParameterEXT: function(_unit: GLenum; coord: GLenum; value: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindTextureUnitParameterEXT: function(_unit: GLenum; value: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindParameterEXT: function(value: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsVariantEnabledEXT: function(id: GLuint; cap: GLenum): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVariantBooleanvEXT: procedure(id: GLuint; value: GLenum; data: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVariantIntegervEXT: procedure(id: GLuint; value: GLenum; data: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVariantFloatvEXT: procedure(id: GLuint; value: GLenum; data: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVariantPointervEXT: procedure(id: GLuint; value: GLenum; data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetInvariantBooleanvEXT: procedure(id: GLuint; value: GLenum; data: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetInvariantIntegervEXT: procedure(id: GLuint; value: GLenum; data: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetInvariantFloatvEXT: procedure(id: GLuint; value: GLenum; data: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetLocalConstantBooleanvEXT: procedure(id: GLuint; value: GLenum; data: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetLocalConstantIntegervEXT: procedure(id: GLuint; value: GLenum; data: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetLocalConstantFloatvEXT: procedure(id: GLuint; value: GLenum; data: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_vertex_shader: Boolean; + +//***** GL_EXT_vertex_weighting *****// +const + GL_VERTEX_WEIGHTING_EXT = $8509; + GL_MODELVIEW0_EXT = $1700; + GL_MODELVIEW1_EXT = $850A; + GL_MODELVIEW0_MATRIX_EXT = $0BA6; + GL_MODELVIEW1_MATRIX_EXT = $8506; + GL_CURRENT_VERTEX_WEIGHT_EXT = $850B; + GL_VERTEX_WEIGHT_ARRAY_EXT = $850C; + GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT = $850D; + GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT = $850E; + GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT = $850F; + GL_MODELVIEW0_STACK_DEPTH_EXT = $0BA3; + GL_MODELVIEW1_STACK_DEPTH_EXT = $8502; + GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT = $8510; +var + glVertexWeightfEXT: procedure(weight: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexWeightfvEXT: procedure(weight: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexWeightPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_vertex_weighting: Boolean; + +//***** GL_HP_occlusion_test *****// +const + GL_OCCLUSION_TEST_HP = $8165; + GL_OCCLUSION_TEST_RESULT_HP = $8166; + +function Load_GL_HP_occlusion_test: Boolean; + +//***** GL_NV_blend_square *****// + +function Load_GL_NV_blend_square: Boolean; + +//***** GL_NV_copy_depth_to_color *****// +const + GL_DEPTH_STENCIL_TO_RGBA_NV = $886E; + GL_DEPTH_STENCIL_TO_BGRA_NV = $886F; + +function Load_GL_NV_copy_depth_to_color: Boolean; + +//***** GL_NV_depth_clamp *****// +const + GL_DEPTH_CLAMP_NV = $864F; + +function Load_GL_NV_depth_clamp: Boolean; + +//***** GL_NV_evaluators *****// +const + GL_EVAL_2D_NV = $86C0; + GL_EVAL_TRIANGULAR_2D_NV = $86C1; + GL_MAP_TESSELLATION_NV = $86C2; + GL_MAP_ATTRIB_U_ORDER_NV = $86C3; + GL_MAP_ATTRIB_V_ORDER_NV = $86C4; + GL_EVAL_FRACTIONAL_TESSELLATION_NV = $86C5; + GL_EVAL_VERTEX_ATTRIB0_NV = $86C6; + GL_EVAL_VERTEX_ATTRIB1_NV = $86C7; + GL_EVAL_VERTEX_ATTRIB2_NV = $86C8; + GL_EVAL_VERTEX_ATTRIB3_NV = $86C9; + GL_EVAL_VERTEX_ATTRIB4_NV = $86CA; + GL_EVAL_VERTEX_ATTRIB5_NV = $86CB; + GL_EVAL_VERTEX_ATTRIB6_NV = $86CC; + GL_EVAL_VERTEX_ATTRIB7_NV = $86CD; + GL_EVAL_VERTEX_ATTRIB8_NV = $86CE; + GL_EVAL_VERTEX_ATTRIB9_NV = $86CF; + GL_EVAL_VERTEX_ATTRIB10_NV = $86D0; + GL_EVAL_VERTEX_ATTRIB11_NV = $86D1; + GL_EVAL_VERTEX_ATTRIB12_NV = $86D2; + GL_EVAL_VERTEX_ATTRIB13_NV = $86D3; + GL_EVAL_VERTEX_ATTRIB14_NV = $86D4; + GL_EVAL_VERTEX_ATTRIB15_NV = $86D5; + GL_MAX_MAP_TESSELLATION_NV = $86D6; + GL_MAX_RATIONAL_EVAL_ORDER_NV = $86D7; +var + glMapControlPointsNV: procedure(target: GLenum; index: GLuint; _type: GLenum; ustride: GLsizei; vstride: GLsizei; uorder: GLint; vorder: GLint; _packed: GLboolean; const points: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapParameterivNV: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapParameterfvNV: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapControlPointsNV: procedure(target: GLenum; index: GLuint; _type: GLenum; ustride: GLsizei; vstride: GLsizei; _packed: GLboolean; points: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapParameterivNV: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapParameterfvNV: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapAttribParameterivNV: procedure(target: GLenum; index: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapAttribParameterfvNV: procedure(target: GLenum; index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalMapsNV: procedure(target: GLenum; mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_NV_evaluators: Boolean; + +//***** GL_NV_fence *****// +const + GL_ALL_COMPLETED_NV = $84F2; + GL_FENCE_STATUS_NV = $84F3; + GL_FENCE_CONDITION_NV = $84F4; +var + glGenFencesNV: procedure(n: GLsizei; fences: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteFencesNV: procedure(n: GLsizei; const fences: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSetFenceNV: procedure(fence: GLuint; condition: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTestFenceNV: function(fence: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFinishFenceNV: procedure(fence: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsFenceNV: function(fence: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetFenceivNV: procedure(fence: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_NV_fence: Boolean; + +//***** GL_NV_fog_distance *****// +const + GL_FOG_DISTANCE_MODE_NV = $855A; + GL_EYE_RADIAL_NV = $855B; + GL_EYE_PLANE_ABSOLUTE_NV = $855C; + +function Load_GL_NV_fog_distance: Boolean; + +//***** GL_NV_light_max_exponent *****// +const + GL_MAX_SHININESS_NV = $8504; + GL_MAX_SPOT_EXPONENT_NV = $8505; + +function Load_GL_NV_light_max_exponent: Boolean; + +//***** GL_NV_multisample_filter_hint *****// +const + GL_MULTISAMPLE_FILTER_HINT_NV = $8534; + +function Load_GL_NV_multisample_filter_hint: Boolean; + +//***** GL_NV_occlusion_query *****// + // GL_OCCLUSION_TEST_HP { already defined } + // GL_OCCLUSION_TEST_RESULT_HP { already defined } +const + GL_PIXEL_COUNTER_BITS_NV = $8864; + GL_CURRENT_OCCLUSION_QUERY_ID_NV = $8865; + GL_PIXEL_COUNT_NV = $8866; + GL_PIXEL_COUNT_AVAILABLE_NV = $8867; +var + glGenOcclusionQueriesNV: procedure(n: GLsizei; ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteOcclusionQueriesNV: procedure(n: GLsizei; const ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsOcclusionQueryNV: function(id: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBeginOcclusionQueryNV: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEndOcclusionQueryNV: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetOcclusionQueryivNV: procedure(id: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetOcclusionQueryuivNV: procedure(id: GLuint; pname: GLenum; params: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_NV_occlusion_query: Boolean; + +//***** GL_NV_packed_depth_stencil *****// +const + GL_DEPTH_STENCIL_NV = $84F9; + GL_UNSIGNED_INT_24_8_NV = $84FA; + +function Load_GL_NV_packed_depth_stencil: Boolean; + +//***** GL_NV_point_sprite *****// +const + GL_POINT_SPRITE_NV = $8861; + GL_COORD_REPLACE_NV = $8862; + GL_POINT_SPRITE_R_MODE_NV = $8863; +var + glPointParameteriNV: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPointParameterivNV: procedure(pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_NV_point_sprite: Boolean; + +//***** GL_NV_register_combiners *****// +const + GL_REGISTER_COMBINERS_NV = $8522; + GL_COMBINER0_NV = $8550; + GL_COMBINER1_NV = $8551; + GL_COMBINER2_NV = $8552; + GL_COMBINER3_NV = $8553; + GL_COMBINER4_NV = $8554; + GL_COMBINER5_NV = $8555; + GL_COMBINER6_NV = $8556; + GL_COMBINER7_NV = $8557; + GL_VARIABLE_A_NV = $8523; + GL_VARIABLE_B_NV = $8524; + GL_VARIABLE_C_NV = $8525; + GL_VARIABLE_D_NV = $8526; + GL_VARIABLE_E_NV = $8527; + GL_VARIABLE_F_NV = $8528; + GL_VARIABLE_G_NV = $8529; + GL_CONSTANT_COLOR0_NV = $852A; + GL_CONSTANT_COLOR1_NV = $852B; + GL_PRIMARY_COLOR_NV = $852C; + GL_SECONDARY_COLOR_NV = $852D; + GL_SPARE0_NV = $852E; + GL_SPARE1_NV = $852F; + GL_UNSIGNED_IDENTITY_NV = $8536; + GL_UNSIGNED_INVERT_NV = $8537; + GL_EXPAND_NORMAL_NV = $8538; + GL_EXPAND_NEGATE_NV = $8539; + GL_HALF_BIAS_NORMAL_NV = $853A; + GL_HALF_BIAS_NEGATE_NV = $853B; + GL_SIGNED_IDENTITY_NV = $853C; + GL_SIGNED_NEGATE_NV = $853D; + GL_E_TIMES_F_NV = $8531; + GL_SPARE0_PLUS_SECONDARY_COLOR_NV = $8532; + GL_SCALE_BY_TWO_NV = $853E; + GL_SCALE_BY_FOUR_NV = $853F; + GL_SCALE_BY_ONE_HALF_NV = $8540; + GL_BIAS_BY_NEGATIVE_ONE_HALF_NV = $8541; + GL_DISCARD_NV = $8530; + GL_COMBINER_INPUT_NV = $8542; + GL_COMBINER_MAPPING_NV = $8543; + GL_COMBINER_COMPONENT_USAGE_NV = $8544; + GL_COMBINER_AB_DOT_PRODUCT_NV = $8545; + GL_COMBINER_CD_DOT_PRODUCT_NV = $8546; + GL_COMBINER_MUX_SUM_NV = $8547; + GL_COMBINER_SCALE_NV = $8548; + GL_COMBINER_BIAS_NV = $8549; + GL_COMBINER_AB_OUTPUT_NV = $854A; + GL_COMBINER_CD_OUTPUT_NV = $854B; + GL_COMBINER_SUM_OUTPUT_NV = $854C; + GL_NUM_GENERAL_COMBINERS_NV = $854E; + GL_COLOR_SUM_CLAMP_NV = $854F; + GL_MAX_GENERAL_COMBINERS_NV = $854D; +var + glCombinerParameterfvNV: procedure(pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCombinerParameterivNV: procedure(pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCombinerParameterfNV: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCombinerParameteriNV: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCombinerInputNV: procedure(stage: GLenum; portion: GLenum; variable: GLenum; input: GLenum; mapping: GLenum; componentUsage: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCombinerOutputNV: procedure(stage: GLenum; portion: GLenum; abOutput: GLenum; cdOutput: GLenum; sumOutput: GLenum; scale: GLenum; bias: GLenum; abDotProduct: GLboolean; cdDotProduct: GLboolean; muxSum: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFinalCombinerInputNV: procedure(variable: GLenum; input: GLenum; mapping: GLenum; componentUsage: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetCombinerInputParameterfvNV: procedure(stage: GLenum; portion: GLenum; variable: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetCombinerInputParameterivNV: procedure(stage: GLenum; portion: GLenum; variable: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetCombinerOutputParameterfvNV: procedure(stage: GLenum; portion: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetCombinerOutputParameterivNV: procedure(stage: GLenum; portion: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetFinalCombinerInputParameterfvNV: procedure(variable: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetFinalCombinerInputParameterivNV: procedure(variable: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_NV_register_combiners: Boolean; + +//***** GL_NV_register_combiners2 *****// +const + GL_PER_STAGE_CONSTANTS_NV = $8535; +var + glCombinerStageParameterfvNV: procedure(stage: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetCombinerStageParameterfvNV: procedure(stage: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_NV_register_combiners2: Boolean; + +//***** GL_NV_texgen_emboss *****// +const + GL_EMBOSS_MAP_NV = $855F; + GL_EMBOSS_LIGHT_NV = $855D; + GL_EMBOSS_CONSTANT_NV = $855E; + +function Load_GL_NV_texgen_emboss: Boolean; + +//***** GL_NV_texgen_reflection *****// +const + GL_NORMAL_MAP_NV = $8511; + GL_REFLECTION_MAP_NV = $8512; + +function Load_GL_NV_texgen_reflection: Boolean; + +//***** GL_NV_texture_compression_vtc *****// + // GL_COMPRESSED_RGB_S3TC_DXT1_EXT { already defined } + // GL_COMPRESSED_RGBA_S3TC_DXT1_EXT { already defined } + // GL_COMPRESSED_RGBA_S3TC_DXT3_EXT { already defined } + // GL_COMPRESSED_RGBA_S3TC_DXT5_EXT { already defined } + +function Load_GL_NV_texture_compression_vtc: Boolean; + +//***** GL_NV_texture_env_combine4 *****// +const + GL_COMBINE4_NV = $8503; + GL_SOURCE3_RGB_NV = $8583; + GL_SOURCE3_ALPHA_NV = $858B; + GL_OPERAND3_RGB_NV = $8593; + GL_OPERAND3_ALPHA_NV = $859B; + +function Load_GL_NV_texture_env_combine4: Boolean; + +//***** GL_NV_texture_rectangle *****// +const + GL_TEXTURE_RECTANGLE_NV = $84F5; + GL_TEXTURE_BINDING_RECTANGLE_NV = $84F6; + GL_PROXY_TEXTURE_RECTANGLE_NV = $84F7; + GL_MAX_RECTANGLE_TEXTURE_SIZE_NV = $84F8; + +function Load_GL_NV_texture_rectangle: Boolean; + +//***** GL_NV_texture_shader *****// +const + GL_TEXTURE_SHADER_NV = $86DE; + GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV = $86D9; + GL_SHADER_OPERATION_NV = $86DF; + GL_CULL_MODES_NV = $86E0; + GL_OFFSET_TEXTURE_MATRIX_NV = $86E1; + GL_OFFSET_TEXTURE_SCALE_NV = $86E2; + GL_OFFSET_TEXTURE_BIAS_NV = $86E3; + GL_PREVIOUS_TEXTURE_INPUT_NV = $86E4; + GL_CONST_EYE_NV = $86E5; + GL_SHADER_CONSISTENT_NV = $86DD; + GL_PASS_THROUGH_NV = $86E6; + GL_CULL_FRAGMENT_NV = $86E7; + GL_OFFSET_TEXTURE_2D_NV = $86E8; + GL_OFFSET_TEXTURE_RECTANGLE_NV = $864C; + GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV = $864D; + GL_DEPENDENT_AR_TEXTURE_2D_NV = $86E9; + GL_DEPENDENT_GB_TEXTURE_2D_NV = $86EA; + GL_DOT_PRODUCT_NV = $86EC; + GL_DOT_PRODUCT_DEPTH_REPLACE_NV = $86ED; + GL_DOT_PRODUCT_TEXTURE_2D_NV = $86EE; + GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV = $864E; + GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV = $86F0; + GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV = $86F1; + GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV = $86F2; + GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV = $86F3; + GL_HILO_NV = $86F4; + GL_DSDT_NV = $86F5; + GL_DSDT_MAG_NV = $86F6; + GL_DSDT_MAG_VIB_NV = $86F7; + GL_UNSIGNED_INT_S8_S8_8_8_NV = $86DA; + GL_UNSIGNED_INT_8_8_S8_S8_REV_NV = $86DB; + GL_SIGNED_RGBA_NV = $86FB; + GL_SIGNED_RGBA8_NV = $86FC; + GL_SIGNED_RGB_NV = $86FE; + GL_SIGNED_RGB8_NV = $86FF; + GL_SIGNED_LUMINANCE_NV = $8701; + GL_SIGNED_LUMINANCE8_NV = $8702; + GL_SIGNED_LUMINANCE_ALPHA_NV = $8703; + GL_SIGNED_LUMINANCE8_ALPHA8_NV = $8704; + GL_SIGNED_ALPHA_NV = $8705; + GL_SIGNED_ALPHA8_NV = $8706; + GL_SIGNED_INTENSITY_NV = $8707; + GL_SIGNED_INTENSITY8_NV = $8708; + GL_SIGNED_RGB_UNSIGNED_ALPHA_NV = $870C; + GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV = $870D; + GL_HILO16_NV = $86F8; + GL_SIGNED_HILO_NV = $86F9; + GL_SIGNED_HILO16_NV = $86FA; + GL_DSDT8_NV = $8709; + GL_DSDT8_MAG8_NV = $870A; + GL_DSDT_MAG_INTENSITY_NV = $86DC; + GL_DSDT8_MAG8_INTENSITY8_NV = $870B; + GL_HI_SCALE_NV = $870E; + GL_LO_SCALE_NV = $870F; + GL_DS_SCALE_NV = $8710; + GL_DT_SCALE_NV = $8711; + GL_MAGNITUDE_SCALE_NV = $8712; + GL_VIBRANCE_SCALE_NV = $8713; + GL_HI_BIAS_NV = $8714; + GL_LO_BIAS_NV = $8715; + GL_DS_BIAS_NV = $8716; + GL_DT_BIAS_NV = $8717; + GL_MAGNITUDE_BIAS_NV = $8718; + GL_VIBRANCE_BIAS_NV = $8719; + GL_TEXTURE_BORDER_VALUES_NV = $871A; + GL_TEXTURE_HI_SIZE_NV = $871B; + GL_TEXTURE_LO_SIZE_NV = $871C; + GL_TEXTURE_DS_SIZE_NV = $871D; + GL_TEXTURE_DT_SIZE_NV = $871E; + GL_TEXTURE_MAG_SIZE_NV = $871F; + +function Load_GL_NV_texture_shader: Boolean; + +//***** GL_NV_texture_shader2 *****// +const + GL_DOT_PRODUCT_TEXTURE_3D_NV = $86EF; + // GL_HILO_NV { already defined } + // GL_DSDT_NV { already defined } + // GL_DSDT_MAG_NV { already defined } + // GL_DSDT_MAG_VIB_NV { already defined } + // GL_UNSIGNED_INT_S8_S8_8_8_NV { already defined } + // GL_UNSIGNED_INT_8_8_S8_S8_REV_NV { already defined } + // GL_SIGNED_RGBA_NV { already defined } + // GL_SIGNED_RGBA8_NV { already defined } + // GL_SIGNED_RGB_NV { already defined } + // GL_SIGNED_RGB8_NV { already defined } + // GL_SIGNED_LUMINANCE_NV { already defined } + // GL_SIGNED_LUMINANCE8_NV { already defined } + // GL_SIGNED_LUMINANCE_ALPHA_NV { already defined } + // GL_SIGNED_LUMINANCE8_ALPHA8_NV { already defined } + // GL_SIGNED_ALPHA_NV { already defined } + // GL_SIGNED_ALPHA8_NV { already defined } + // GL_SIGNED_INTENSITY_NV { already defined } + // GL_SIGNED_INTENSITY8_NV { already defined } + // GL_SIGNED_RGB_UNSIGNED_ALPHA_NV { already defined } + // GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV { already defined } + // GL_HILO16_NV { already defined } + // GL_SIGNED_HILO_NV { already defined } + // GL_SIGNED_HILO16_NV { already defined } + // GL_DSDT8_NV { already defined } + // GL_DSDT8_MAG8_NV { already defined } + // GL_DSDT_MAG_INTENSITY_NV { already defined } + // GL_DSDT8_MAG8_INTENSITY8_NV { already defined } + +function Load_GL_NV_texture_shader2: Boolean; + +//***** GL_NV_texture_shader3 *****// +const + GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV = $8850; + GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV = $8851; + GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV = $8852; + GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV = $8853; + GL_OFFSET_HILO_TEXTURE_2D_NV = $8854; + GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV = $8855; + GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV = $8856; + GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV = $8857; + GL_DEPENDENT_HILO_TEXTURE_2D_NV = $8858; + GL_DEPENDENT_RGB_TEXTURE_3D_NV = $8859; + GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV = $885A; + GL_DOT_PRODUCT_PASS_THROUGH_NV = $885B; + GL_DOT_PRODUCT_TEXTURE_1D_NV = $885C; + GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV = $885D; + GL_HILO8_NV = $885E; + GL_SIGNED_HILO8_NV = $885F; + GL_FORCE_BLUE_TO_ONE_NV = $8860; + +function Load_GL_NV_texture_shader3: Boolean; + +//***** GL_NV_vertex_array_range *****// +const + GL_VERTEX_ARRAY_RANGE_NV = $851D; + GL_VERTEX_ARRAY_RANGE_LENGTH_NV = $851E; + GL_VERTEX_ARRAY_RANGE_VALID_NV = $851F; + GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV = $8520; + GL_VERTEX_ARRAY_RANGE_POINTER_NV = $8521; +var + glVertexArrayRangeNV: procedure(length: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFlushVertexArrayRangeNV: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} +{$IFDEF Win32} + wglAllocateMemoryNV: function(size: GLsizei; readFrequency: GLfloat; writeFrequency: GLfloat; priority: GLfloat): PGLvoid; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglFreeMemoryNV: procedure(pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} +{$ENDIF} + +function Load_GL_NV_vertex_array_range: Boolean; + +//***** GL_NV_vertex_array_range2 *****// +const + GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV = $8533; + +function Load_GL_NV_vertex_array_range2: Boolean; + +//***** GL_NV_vertex_program *****// +const + GL_VERTEX_PROGRAM_NV = $8620; + GL_VERTEX_PROGRAM_POINT_SIZE_NV = $8642; + GL_VERTEX_PROGRAM_TWO_SIDE_NV = $8643; + GL_VERTEX_STATE_PROGRAM_NV = $8621; + GL_ATTRIB_ARRAY_SIZE_NV = $8623; + GL_ATTRIB_ARRAY_STRIDE_NV = $8624; + GL_ATTRIB_ARRAY_TYPE_NV = $8625; + GL_CURRENT_ATTRIB_NV = $8626; + GL_PROGRAM_PARAMETER_NV = $8644; + GL_ATTRIB_ARRAY_POINTER_NV = $8645; + GL_PROGRAM_TARGET_NV = $8646; + GL_PROGRAM_LENGTH_NV = $8627; + GL_PROGRAM_RESIDENT_NV = $8647; + GL_PROGRAM_STRING_NV = $8628; + GL_TRACK_MATRIX_NV = $8648; + GL_TRACK_MATRIX_TRANSFORM_NV = $8649; + GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV = $862E; + GL_MAX_TRACK_MATRICES_NV = $862F; + GL_CURRENT_MATRIX_STACK_DEPTH_NV = $8640; + GL_CURRENT_MATRIX_NV = $8641; + GL_VERTEX_PROGRAM_BINDING_NV = $864A; + GL_PROGRAM_ERROR_POSITION_NV = $864B; + GL_MODELVIEW_PROJECTION_NV = $8629; + GL_MATRIX0_NV = $8630; + GL_MATRIX1_NV = $8631; + GL_MATRIX2_NV = $8632; + GL_MATRIX3_NV = $8633; + GL_MATRIX4_NV = $8634; + GL_MATRIX5_NV = $8635; + GL_MATRIX6_NV = $8636; + GL_MATRIX7_NV = $8637; + GL_IDENTITY_NV = $862A; + GL_INVERSE_NV = $862B; + GL_TRANSPOSE_NV = $862C; + GL_INVERSE_TRANSPOSE_NV = $862D; + GL_VERTEX_ATTRIB_ARRAY0_NV = $8650; + GL_VERTEX_ATTRIB_ARRAY1_NV = $8651; + GL_VERTEX_ATTRIB_ARRAY2_NV = $8652; + GL_VERTEX_ATTRIB_ARRAY3_NV = $8653; + GL_VERTEX_ATTRIB_ARRAY4_NV = $8654; + GL_VERTEX_ATTRIB_ARRAY5_NV = $8655; + GL_VERTEX_ATTRIB_ARRAY6_NV = $8656; + GL_VERTEX_ATTRIB_ARRAY7_NV = $8657; + GL_VERTEX_ATTRIB_ARRAY8_NV = $8658; + GL_VERTEX_ATTRIB_ARRAY9_NV = $8659; + GL_VERTEX_ATTRIB_ARRAY10_NV = $865A; + GL_VERTEX_ATTRIB_ARRAY11_NV = $865B; + GL_VERTEX_ATTRIB_ARRAY12_NV = $865C; + GL_VERTEX_ATTRIB_ARRAY13_NV = $865D; + GL_VERTEX_ATTRIB_ARRAY14_NV = $865E; + GL_VERTEX_ATTRIB_ARRAY15_NV = $865F; + GL_MAP1_VERTEX_ATTRIB0_4_NV = $8660; + GL_MAP1_VERTEX_ATTRIB1_4_NV = $8661; + GL_MAP1_VERTEX_ATTRIB2_4_NV = $8662; + GL_MAP1_VERTEX_ATTRIB3_4_NV = $8663; + GL_MAP1_VERTEX_ATTRIB4_4_NV = $8664; + GL_MAP1_VERTEX_ATTRIB5_4_NV = $8665; + GL_MAP1_VERTEX_ATTRIB6_4_NV = $8666; + GL_MAP1_VERTEX_ATTRIB7_4_NV = $8667; + GL_MAP1_VERTEX_ATTRIB8_4_NV = $8668; + GL_MAP1_VERTEX_ATTRIB9_4_NV = $8669; + GL_MAP1_VERTEX_ATTRIB10_4_NV = $866A; + GL_MAP1_VERTEX_ATTRIB11_4_NV = $866B; + GL_MAP1_VERTEX_ATTRIB12_4_NV = $866C; + GL_MAP1_VERTEX_ATTRIB13_4_NV = $866D; + GL_MAP1_VERTEX_ATTRIB14_4_NV = $866E; + GL_MAP1_VERTEX_ATTRIB15_4_NV = $866F; + GL_MAP2_VERTEX_ATTRIB0_4_NV = $8670; + GL_MAP2_VERTEX_ATTRIB1_4_NV = $8671; + GL_MAP2_VERTEX_ATTRIB2_4_NV = $8672; + GL_MAP2_VERTEX_ATTRIB3_4_NV = $8673; + GL_MAP2_VERTEX_ATTRIB4_4_NV = $8674; + GL_MAP2_VERTEX_ATTRIB5_4_NV = $8675; + GL_MAP2_VERTEX_ATTRIB6_4_NV = $8676; + GL_MAP2_VERTEX_ATTRIB7_4_NV = $8677; + GL_MAP2_VERTEX_ATTRIB8_4_NV = $8678; + GL_MAP2_VERTEX_ATTRIB9_4_NV = $8679; + GL_MAP2_VERTEX_ATTRIB10_4_NV = $867A; + GL_MAP2_VERTEX_ATTRIB11_4_NV = $867B; + GL_MAP2_VERTEX_ATTRIB12_4_NV = $867C; + GL_MAP2_VERTEX_ATTRIB13_4_NV = $867D; + GL_MAP2_VERTEX_ATTRIB14_4_NV = $867E; + GL_MAP2_VERTEX_ATTRIB15_4_NV = $867F; +var + glBindProgramNV: procedure(target: GLenum; id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteProgramsNV: procedure(n: GLsizei; const ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glExecuteProgramNV: procedure(target: GLenum; id: GLuint; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenProgramsNV: procedure(n: GLsizei; ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glAreProgramsResidentNV: function(n: GLsizei; const ids: PGLuint; residences: PGLboolean): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRequestResidentProgramsNV: procedure(n: GLsizei; ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramParameterfvNV: procedure(target: GLenum; index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramParameterdvNV: procedure(target: GLenum; index: GLuint; pname: GLenum; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramivNV: procedure(id: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramStringNV: procedure(id: GLuint; pname: GLenum; _program: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTrackMatrixivNV: procedure(target: GLenum; address: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribdvNV: procedure(index: GLuint; pname: GLenum; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribfvNV: procedure(index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribivNV: procedure(index: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribPointervNV: procedure(index: GLuint; pname: GLenum; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsProgramNV: function(id: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadProgramNV: procedure(target: GLenum; id: GLuint; len: GLsizei; const _program: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramParameter4fNV: procedure(target: GLenum; index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramParameter4fvNV: procedure(target: GLenum; index: GLuint; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramParameters4dvNV: procedure(target: GLenum; index: GLuint; num: GLuint; const params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramParameters4fvNV: procedure(target: GLenum; index: GLuint; num: GLuint; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTrackMatrixNV: procedure(target: GLenum; address: GLuint; matrix: GLenum; transform: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribPointerNV: procedure(index: GLuint; size: GLint; _type: GLenum; stride: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1sNV: procedure(index: GLuint; x: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1fNV: procedure(index: GLuint; x: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1dNV: procedure(index: GLuint; x: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2sNV: procedure(index: GLuint; x: GLshort; y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2fNV: procedure(index: GLuint; x: GLfloat; y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2dNV: procedure(index: GLuint; x: GLdouble; y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3sNV: procedure(index: GLuint; x: GLshort; y: GLshort; z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3fNV: procedure(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3dNV: procedure(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4sNV: procedure(index: GLuint; x: GLshort; y: GLshort; z: GLshort; w: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4fNV: procedure(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4dNV: procedure(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4ubNV: procedure(index: GLuint; x: GLubyte; y: GLubyte; z: GLubyte; w: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1svNV: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1fvNV: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1dvNV: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2svNV: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2fvNV: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2dvNV: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3svNV: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3fvNV: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3dvNV: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4svNV: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4fvNV: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4dvNV: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4ubvNV: procedure(index: GLuint; const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs1svNV: procedure(index: GLuint; n: GLsizei; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs1fvNV: procedure(index: GLuint; n: GLsizei; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs1dvNV: procedure(index: GLuint; n: GLsizei; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs2svNV: procedure(index: GLuint; n: GLsizei; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs2fvNV: procedure(index: GLuint; n: GLsizei; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs2dvNV: procedure(index: GLuint; n: GLsizei; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs3svNV: procedure(index: GLuint; n: GLsizei; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs3fvNV: procedure(index: GLuint; n: GLsizei; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs3dvNV: procedure(index: GLuint; n: GLsizei; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs4svNV: procedure(index: GLuint; n: GLsizei; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs4fvNV: procedure(index: GLuint; n: GLsizei; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs4dvNV: procedure(index: GLuint; n: GLsizei; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs4ubvNV: procedure(index: GLuint; n: GLsizei; const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_NV_vertex_program: Boolean; + +//***** GL_NV_vertex_program1_1 *****// + +function Load_GL_NV_vertex_program1_1: Boolean; + +//***** GL_ATI_element_array *****// +const + GL_ELEMENT_ARRAY_ATI = $8768; + GL_ELEMENT_ARRAY_TYPE_ATI = $8769; + GL_ELEMENT_ARRAY_POINTER_ATI = $876A; +var + glElementPointerATI: procedure(_type: GLenum; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawElementArrayATI: procedure(mode: GLenum; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawRangeElementArrayATI: procedure(mode: GLenum; start: GLuint; _end: GLuint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ATI_element_array: Boolean; + +//***** GL_ATI_envmap_bumpmap *****// +const + GL_BUMP_ROT_MATRIX_ATI = $8775; + GL_BUMP_ROT_MATRIX_SIZE_ATI = $8776; + GL_BUMP_NUM_TEX_UNITS_ATI = $8777; + GL_BUMP_TEX_UNITS_ATI = $8778; + GL_DUDV_ATI = $8779; + GL_DU8DV8_ATI = $877A; + GL_BUMP_ENVMAP_ATI = $877B; + GL_BUMP_TARGET_ATI = $877C; +var + glTexBumpParameterivATI: procedure(pname: GLenum; param: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexBumpParameterfvATI: procedure(pname: GLenum; param: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexBumpParameterivATI: procedure(pname: GLenum; param: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexBumpParameterfvATI: procedure(pname: GLenum; param: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ATI_envmap_bumpmap: Boolean; + +//***** GL_ATI_fragment_shader *****// +const + GL_FRAGMENT_SHADER_ATI = $8920; + GL_REG_0_ATI = $8921; + GL_REG_1_ATI = $8922; + GL_REG_2_ATI = $8923; + GL_REG_3_ATI = $8924; + GL_REG_4_ATI = $8925; + GL_REG_5_ATI = $8926; + GL_CON_0_ATI = $8941; + GL_CON_1_ATI = $8942; + GL_CON_2_ATI = $8943; + GL_CON_3_ATI = $8944; + GL_CON_4_ATI = $8945; + GL_CON_5_ATI = $8946; + GL_CON_6_ATI = $8947; + GL_CON_7_ATI = $8948; + GL_MOV_ATI = $8961; + GL_ADD_ATI = $8963; + GL_MUL_ATI = $8964; + GL_SUB_ATI = $8965; + GL_DOT3_ATI = $8966; + GL_DOT4_ATI = $8967; + GL_MAD_ATI = $8968; + GL_LERP_ATI = $8969; + GL_CND_ATI = $896A; + GL_CND0_ATI = $896B; + GL_DOT2_ADD_ATI = $896C; + GL_SECONDARY_INTERPOLATOR_ATI = $896D; + GL_SWIZZLE_STR_ATI = $8976; + GL_SWIZZLE_STQ_ATI = $8977; + GL_SWIZZLE_STR_DR_ATI = $8978; + GL_SWIZZLE_STQ_DQ_ATI = $8979; + GL_RED_BIT_ATI = $0001; + GL_GREEN_BIT_ATI = $0002; + GL_BLUE_BIT_ATI = $0004; + GL_2X_BIT_ATI = $0001; + GL_4X_BIT_ATI = $0002; + GL_8X_BIT_ATI = $0004; + GL_HALF_BIT_ATI = $0008; + GL_QUARTER_BIT_ATI = $0010; + GL_EIGHTH_BIT_ATI = $0020; + GL_SATURATE_BIT_ATI = $0040; + // GL_2X_BIT_ATI { already defined } + GL_COMP_BIT_ATI = $0002; + GL_NEGATE_BIT_ATI = $0004; + GL_BIAS_BIT_ATI = $0008; +var + glGenFragmentShadersATI: function(range: GLuint): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindFragmentShaderATI: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteFragmentShaderATI: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBeginFragmentShaderATI: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEndFragmentShaderATI: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPassTexCoordATI: procedure(dst: GLuint; coord: GLuint; swizzle: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSampleMapATI: procedure(dst: GLuint; interp: GLuint; swizzle: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorFragmentOp1ATI: procedure(op: GLenum; dst: GLuint; dstMask: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorFragmentOp2ATI: procedure(op: GLenum; dst: GLuint; dstMask: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorFragmentOp3ATI: procedure(op: GLenum; dst: GLuint; dstMask: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint; arg3: GLuint; arg3Rep: GLuint; arg3Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glAlphaFragmentOp1ATI: procedure(op: GLenum; dst: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glAlphaFragmentOp2ATI: procedure(op: GLenum; dst: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glAlphaFragmentOp3ATI: procedure(op: GLenum; dst: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint; arg3: GLuint; arg3Rep: GLuint; arg3Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSetFragmentShaderConstantATI: procedure(dst: GLuint; const value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ATI_fragment_shader: Boolean; + +//***** GL_ATI_pn_triangles *****// +const + GL_PN_TRIANGLES_ATI = $87F0; + GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI = $87F1; + GL_PN_TRIANGLES_POINT_MODE_ATI = $87F2; + GL_PN_TRIANGLES_NORMAL_MODE_ATI = $87F3; + GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI = $87F4; + GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI = $87F5; + GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI = $87F6; + GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI = $87F7; + GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI = $87F8; +var + glPNTrianglesiATI: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPNTrianglesfATI: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ATI_pn_triangles: Boolean; + +//***** GL_ATI_texture_mirror_once *****// +const + GL_MIRROR_CLAMP_ATI = $8742; + GL_MIRROR_CLAMP_TO_EDGE_ATI = $8743; + +function Load_GL_ATI_texture_mirror_once: Boolean; + +//***** GL_ATI_vertex_array_object *****// +const + GL_STATIC_ATI = $8760; + GL_DYNAMIC_ATI = $8761; + GL_PRESERVE_ATI = $8762; + GL_DISCARD_ATI = $8763; + GL_OBJECT_BUFFER_SIZE_ATI = $8764; + GL_OBJECT_BUFFER_USAGE_ATI = $8765; + GL_ARRAY_OBJECT_BUFFER_ATI = $8766; + GL_ARRAY_OBJECT_OFFSET_ATI = $8767; +var + glNewObjectBufferATI: function(size: GLsizei; const pointer: PGLvoid; usage: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsObjectBufferATI: function(buffer: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUpdateObjectBufferATI: procedure(buffer: GLuint; offset: GLuint; size: GLsizei; const pointer: PGLvoid; preserve: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetObjectBufferfvATI: procedure(buffer: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetObjectBufferivATI: procedure(buffer: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteObjectBufferATI: procedure(buffer: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glArrayObjectATI: procedure(_array: GLenum; size: GLint; _type: GLenum; stride: GLsizei; buffer: GLuint; offset: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetArrayObjectfvATI: procedure(_array: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetArrayObjectivATI: procedure(_array: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantArrayObjectATI: procedure(id: GLuint; _type: GLenum; stride: GLsizei; buffer: GLuint; offset: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVariantArrayObjectfvATI: procedure(id: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVariantArrayObjectivATI: procedure(id: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ATI_vertex_array_object: Boolean; + +//***** GL_ATI_vertex_streams *****// +const + GL_MAX_VERTEX_STREAMS_ATI = $876B; + GL_VERTEX_STREAM0_ATI = $876C; + GL_VERTEX_STREAM1_ATI = $876D; + GL_VERTEX_STREAM2_ATI = $876E; + GL_VERTEX_STREAM3_ATI = $876F; + GL_VERTEX_STREAM4_ATI = $8770; + GL_VERTEX_STREAM5_ATI = $8771; + GL_VERTEX_STREAM6_ATI = $8772; + GL_VERTEX_STREAM7_ATI = $8773; + GL_VERTEX_SOURCE_ATI = $8774; +var + glVertexStream1s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream1i: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream1f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream1d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream1sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream1iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream1fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream1dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2i: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3i: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4i: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3b: procedure(stream: GLenum; coords: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3i: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3bv: procedure(stream: GLenum; coords: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glClientActiveVertexStream: procedure(stream: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexBlendEnvi: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexBlendEnvf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ATI_vertex_streams: Boolean; + +{$IFDEF Win32} +//***** WGL_I3D_image_buffer *****// +const + WGL_IMAGE_BUFFER_MIN_ACCESS_I3D = $0001; + WGL_IMAGE_BUFFER_LOCK_I3D = $0002; +var + wglCreateImageBufferI3D: function(hDC: HDC; dwSize: DWORD; uFlags: UINT): PGLvoid; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglDestroyImageBufferI3D: function(hDC: HDC; pAddress: PGLvoid): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglAssociateImageBufferEventsI3D: function(hdc: HDC; pEvent: PHandle; pAddress: PGLvoid; pSize: PDWORD; count: UINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglReleaseImageBufferEventsI3D: function(hdc: HDC; pAddress: PGLvoid; count: UINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_I3D_image_buffer: Boolean; + +//***** WGL_I3D_swap_frame_lock *****// +var + wglEnableFrameLockI3D: function(): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglDisableFrameLockI3D: function(): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglIsEnabledFrameLockI3D: function(pFlag: PBOOL): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglQueryFrameLockMasterI3D: function(pFlag: PBOOL): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_I3D_swap_frame_lock: Boolean; + +//***** WGL_I3D_swap_frame_usage *****// +var + wglGetFrameUsageI3D: function(pUsage: PGLfloat): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglBeginFrameTrackingI3D: function(): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglEndFrameTrackingI3D: function(): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglQueryFrameTrackingI3D: function(pFrameCount: PDWORD; pMissedFrames: PDWORD; pLastMissedUsage: PGLfloat): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_I3D_swap_frame_usage: Boolean; +{$ENDIF} + +//***** GL_3DFX_texture_compression_FXT1 *****// +const + GL_COMPRESSED_RGB_FXT1_3DFX = $86B0; + GL_COMPRESSED_RGBA_FXT1_3DFX = $86B1; + +function Load_GL_3DFX_texture_compression_FXT1: Boolean; + +//***** GL_IBM_cull_vertex *****// +const + GL_CULL_VERTEX_IBM = $1928A; + +function Load_GL_IBM_cull_vertex: Boolean; + +//***** GL_IBM_multimode_draw_arrays *****// +var + glMultiModeDrawArraysIBM: procedure(mode: PGLenum; first: PGLint; count: PGLsizei; primcount: GLsizei; modestride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiModeDrawElementsIBM: procedure(mode: PGLenum; count: PGLsizei; _type: GLenum; const indices: PGLvoid; primcount: GLsizei; modestride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_IBM_multimode_draw_arrays: Boolean; + +//***** GL_IBM_raster_pos_clip *****// +const + GL_RASTER_POSITION_UNCLIPPED_IBM = $19262; + +function Load_GL_IBM_raster_pos_clip: Boolean; + +//***** GL_IBM_texture_mirrored_repeat *****// +const + GL_MIRRORED_REPEAT_IBM = $8370; + +function Load_GL_IBM_texture_mirrored_repeat: Boolean; + +//***** GL_IBM_vertex_array_lists *****// +const + GL_VERTEX_ARRAY_LIST_IBM = $1929E; + GL_NORMAL_ARRAY_LIST_IBM = $1929F; + GL_COLOR_ARRAY_LIST_IBM = $192A0; + GL_INDEX_ARRAY_LIST_IBM = $192A1; + GL_TEXTURE_COORD_ARRAY_LIST_IBM = $192A2; + GL_EDGE_FLAG_ARRAY_LIST_IBM = $192A3; + GL_FOG_COORDINATE_ARRAY_LIST_IBM = $192A4; + GL_SECONDARY_COLOR_ARRAY_LIST_IBM = $192A5; + GL_VERTEX_ARRAY_LIST_STRIDE_IBM = $192A8; + GL_NORMAL_ARRAY_LIST_STRIDE_IBM = $192A9; + GL_COLOR_ARRAY_LIST_STRIDE_IBM = $192AA; + GL_INDEX_ARRAY_LIST_STRIDE_IBM = $192AB; + GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM = $192AC; + GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM = $192AD; + GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM = $192AE; + GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM = $192AF; +var + glColorPointerListIBM: procedure(size: GLint; _type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColorPointerListIBM: procedure(size: GLint; _type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEdgeFlagPointerListIBM: procedure(stride: GLint; const pointer: PGLboolean; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoordPointerListIBM: procedure(_type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalPointerListIBM: procedure(_type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoordPointerListIBM: procedure(size: GLint; _type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexPointerListIBM: procedure(size: GLint; _type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_IBM_vertex_array_lists: Boolean; + +//***** GL_MESA_resize_buffers *****// +var + glResizeBuffersMESA: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_MESA_resize_buffers: Boolean; + +//***** GL_MESA_window_pos *****// +var + glWindowPos2dMESA: procedure(x: GLdouble; y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2fMESA: procedure(x: GLfloat; y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2iMESA: procedure(x: GLint; y: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2sMESA: procedure(x: GLshort; y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2ivMESA: procedure(const p: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2svMESA: procedure(const p: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2fvMESA: procedure(const p: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2dvMESA: procedure(const p: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3iMESA: procedure(x: GLint; y: GLint; z: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3sMESA: procedure(x: GLshort; y: GLshort; z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3fMESA: procedure(x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3dMESA: procedure(x: GLdouble; y: GLdouble; z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3ivMESA: procedure(const p: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3svMESA: procedure(const p: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3fvMESA: procedure(const p: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3dvMESA: procedure(const p: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4iMESA: procedure(x: GLint; y: GLint; z: GLint; w: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4sMESA: procedure(x: GLshort; y: GLshort; z: GLshort; w: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4fMESA: procedure(x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4dMESA: procedure(x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4ivMESA: procedure(const p: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4svMESA: procedure(const p: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4fvMESA: procedure(const p: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4dvMESA: procedure(const p: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_MESA_window_pos: Boolean; + +//***** GL_OML_interlace *****// +const + GL_INTERLACE_OML = $8980; + GL_INTERLACE_READ_OML = $8981; + +function Load_GL_OML_interlace: Boolean; + +//***** GL_OML_resample *****// +const + GL_PACK_RESAMPLE_OML = $8984; + GL_UNPACK_RESAMPLE_OML = $8985; + GL_RESAMPLE_REPLICATE_OML = $8986; + GL_RESAMPLE_ZERO_FILL_OML = $8987; + GL_RESAMPLE_AVERAGE_OML = $8988; + GL_RESAMPLE_DECIMATE_OML = $8989; + // GL_RESAMPLE_AVERAGE_OML { already defined } + +function Load_GL_OML_resample: Boolean; + +//***** GL_OML_subsample *****// +const + GL_FORMAT_SUBSAMPLE_24_24_OML = $8982; + GL_FORMAT_SUBSAMPLE_244_244_OML = $8983; + +function Load_GL_OML_subsample: Boolean; + +//***** GL_SGIS_generate_mipmap *****// +const + GL_GENERATE_MIPMAP_SGIS = $8191; + GL_GENERATE_MIPMAP_HINT_SGIS = $8192; + +function Load_GL_SGIS_generate_mipmap: Boolean; + +//***** GL_SGIS_multisample *****// +const + GLX_SAMPLE_BUFFERS_SGIS = $186A0; + GLX_SAMPLES_SGIS = $186A1; + GL_MULTISAMPLE_SGIS = $809D; + GL_SAMPLE_ALPHA_TO_MASK_SGIS = $809E; + GL_SAMPLE_ALPHA_TO_ONE_SGIS = $809F; + GL_SAMPLE_MASK_SGIS = $80A0; + GL_MULTISAMPLE_BIT_EXT = $20000000; + GL_1PASS_SGIS = $80A1; + GL_2PASS_0_SGIS = $80A2; + GL_2PASS_1_SGIS = $80A3; + GL_4PASS_0_SGIS = $80A4; + GL_4PASS_1_SGIS = $80A5; + GL_4PASS_2_SGIS = $80A6; + GL_4PASS_3_SGIS = $80A7; + GL_SAMPLE_BUFFERS_SGIS = $80A8; + GL_SAMPLES_SGIS = $80A9; + GL_SAMPLE_MASK_VALUE_SGIS = $80AA; + GL_SAMPLE_MASK_INVERT_SGIS = $80AB; + GL_SAMPLE_PATTERN_SGIS = $80AC; +var + glSampleMaskSGIS: procedure(value: GLclampf; invert: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSamplePatternSGIS: procedure(pattern: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_SGIS_multisample: Boolean; + +//***** GL_SGIS_pixel_texture *****// +const + GL_PIXEL_TEXTURE_SGIS = $8353; + GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS = $8354; + GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS = $8355; + GL_PIXEL_GROUP_COLOR_SGIS = $8356; +var + glPixelTexGenParameteriSGIS: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelTexGenParameterfSGIS: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPixelTexGenParameterivSGIS: procedure(pname: GLenum; params: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPixelTexGenParameterfvSGIS: procedure(pname: GLenum; params: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_SGIS_pixel_texture: Boolean; + +//***** GL_SGIS_texture_border_clamp *****// + // GL_CLAMP_TO_BORDER_SGIS { already defined } + +function Load_GL_SGIS_texture_border_clamp: Boolean; + +//***** GL_SGIS_texture_color_mask *****// +const + GL_TEXTURE_COLOR_WRITEMASK_SGIS = $81EF; +var + glTextureColorMaskSGIS: procedure(r: GLboolean; g: GLboolean; b: GLboolean; a: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_SGIS_texture_color_mask: Boolean; + +//***** GL_SGIS_texture_edge_clamp *****// +const + GL_CLAMP_TO_EDGE_SGIS = $812F; + +function Load_GL_SGIS_texture_edge_clamp: Boolean; + +//***** GL_SGIS_texture_lod *****// +const + GL_TEXTURE_MIN_LOD_SGIS = $813A; + GL_TEXTURE_MAX_LOD_SGIS = $813B; + GL_TEXTURE_BASE_LEVEL_SGIS = $813C; + GL_TEXTURE_MAX_LEVEL_SGIS = $813D; + +function Load_GL_SGIS_texture_lod: Boolean; + +//***** GL_SGIS_depth_texture *****// +const + GL_DEPTH_COMPONENT16_SGIX = $81A5; + GL_DEPTH_COMPONENT24_SGIX = $81A6; + GL_DEPTH_COMPONENT32_SGIX = $81A7; + +function Load_GL_SGIS_depth_texture: Boolean; + +//***** GL_SGIX_fog_offset *****// +const + GL_FOG_OFFSET_SGIX = $8198; + GL_FOG_OFFSET_VALUE_SGIX = $8199; + +function Load_GL_SGIX_fog_offset: Boolean; + +//***** GL_SGIX_interlace *****// +const + GL_INTERLACE_SGIX = $8094; + +function Load_GL_SGIX_interlace: Boolean; + +//***** GL_SGIX_shadow_ambient *****// +const + GL_SHADOW_AMBIENT_SGIX = $80BF; + +function Load_GL_SGIX_shadow_ambient: Boolean; + +//***** GL_SGI_color_matrix *****// +const + GL_COLOR_MATRIX_SGI = $80B1; + GL_COLOR_MATRIX_STACK_DEPTH_SGI = $80B2; + GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI = $80B3; + GL_POST_COLOR_MATRIX_RED_SCALE_SGI = $80B4; + GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI = $80B5; + GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI = $80B6; + GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI = $80B7; + GL_POST_COLOR_MATRIX_RED_BIAS_SGI = $80B8; + GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI = $80B9; + GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI = $80BA; + GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI = $80BB; + +function Load_GL_SGI_color_matrix: Boolean; + +//***** GL_SGI_color_table *****// +const + GL_COLOR_TABLE_SGI = $80D0; + GL_POST_CONVOLUTION_COLOR_TABLE_SGI = $80D1; + GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI = $80D2; + GL_PROXY_COLOR_TABLE_SGI = $80D3; + GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI = $80D4; + GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI = $80D5; + GL_COLOR_TABLE_SCALE_SGI = $80D6; + GL_COLOR_TABLE_BIAS_SGI = $80D7; + GL_COLOR_TABLE_FORMAT_SGI = $80D8; + GL_COLOR_TABLE_WIDTH_SGI = $80D9; + GL_COLOR_TABLE_RED_SIZE_SGI = $80DA; + GL_COLOR_TABLE_GREEN_SIZE_SGI = $80DB; + GL_COLOR_TABLE_BLUE_SIZE_SGI = $80DC; + GL_COLOR_TABLE_ALPHA_SIZE_SGI = $80DD; + GL_COLOR_TABLE_LUMINANCE_SIZE_SGI = $80DE; + GL_COLOR_TABLE_INTENSITY_SIZE_SGI = $80DF; +var + glColorTableSGI: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const table: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyColorTableSGI: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorTableParameterivSGI: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorTableParameterfvSGI: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTableSGI: procedure(target: GLenum; format: GLenum; _type: GLenum; table: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTableParameterivSGI: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTableParameterfvSGI: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_SGI_color_table: Boolean; + +//***** GL_SGI_texture_color_table *****// +const + GL_TEXTURE_COLOR_TABLE_SGI = $80BC; + GL_PROXY_TEXTURE_COLOR_TABLE_SGI = $80BD; + +function Load_GL_SGI_texture_color_table: Boolean; + +//***** GL_SUN_vertex *****// +var + glColor4ubVertex2fSUN: procedure(r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4ubVertex2fvSUN: procedure(const c: PGLubyte; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4ubVertex3fSUN: procedure(r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4ubVertex3fvSUN: procedure(const c: PGLubyte; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3fVertex3fSUN: procedure(r: GLfloat; g: GLfloat; b: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3fVertex3fvSUN: procedure(const c: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3fVertex3fSUN: procedure(nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3fVertex3fvSUN: procedure(const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4fNormal3fVertex3fSUN: procedure(r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4fNormal3fVertex3fvSUN: procedure(const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fVertex3fSUN: procedure(s: GLfloat; t: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fVertex3fvSUN: procedure(const tc: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4fVertex4fSUN: procedure(s: GLfloat; t: GLfloat; p: GLfloat; q: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4fVertex4fvSUN: procedure(const tc: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fColor4ubVertex3fSUN: procedure(s: GLfloat; t: GLfloat; r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fColor4ubVertex3fvSUN: procedure(const tc: PGLfloat; const c: PGLubyte; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fColor3fVertex3fSUN: procedure(s: GLfloat; t: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fColor3fVertex3fvSUN: procedure(const tc: PGLfloat; const c: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fNormal3fVertex3fSUN: procedure(s: GLfloat; t: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fNormal3fVertex3fvSUN: procedure(const tc: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fColor4fNormal3fVertex3fSUN: procedure(s: GLfloat; t: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fColor4fNormal3fVertex3fvSUN: procedure(const tc: PGLfloat; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4fColor4fNormal3fVertex4fSUN: procedure(s: GLfloat; t: GLfloat; p: GLfloat; q: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4fColor4fNormal3fVertex4fvSUN: procedure(const tc: PGLfloat; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiVertex3fSUN: procedure(rc: GLuint; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiVertex3fvSUN: procedure(const rc: PGLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiColor4ubVertex3fSUN: procedure(rc: GLuint; r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiColor4ubVertex3fvSUN: procedure(const rc: PGLuint; const c: PGLubyte; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiColor3fVertex3fSUN: procedure(rc: GLuint; r: GLfloat; g: GLfloat; b: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiColor3fVertex3fvSUN: procedure(const rc: PGLuint; const c: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiNormal3fVertex3fSUN: procedure(rc: GLuint; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiNormal3fVertex3fvSUN: procedure(const rc: PGLuint; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiColor4fNormal3fVertex3fSUN: procedure(rc: GLuint; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiColor4fNormal3fVertex3fvSUN: procedure(const rc: PGLuint; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiTexCoord2fVertex3fSUN: procedure(rc: GLuint; s: GLfloat; t: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiTexCoord2fVertex3fvSUN: procedure(const rc: PGLuint; const tc: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN: procedure(rc: GLuint; s: GLfloat; t: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN: procedure(const rc: PGLuint; const tc: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN: procedure(rc: GLuint; s: GLfloat; t: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN: procedure(const rc: PGLuint; const tc: PGLfloat; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_SUN_vertex: Boolean; + +//***** GL_ARB_fragment_program *****// +const + GL_FRAGMENT_PROGRAM_ARB = $8804; + // GL_PROGRAM_FORMAT_ASCII_ARB { already defined } + // GL_PROGRAM_LENGTH_ARB { already defined } + // GL_PROGRAM_FORMAT_ARB { already defined } + // GL_PROGRAM_BINDING_ARB { already defined } + // GL_PROGRAM_INSTRUCTIONS_ARB { already defined } + // GL_MAX_PROGRAM_INSTRUCTIONS_ARB { already defined } + // GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB { already defined } + // GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB { already defined } + // GL_PROGRAM_TEMPORARIES_ARB { already defined } + // GL_MAX_PROGRAM_TEMPORARIES_ARB { already defined } + // GL_PROGRAM_NATIVE_TEMPORARIES_ARB { already defined } + // GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB { already defined } + // GL_PROGRAM_PARAMETERS_ARB { already defined } + // GL_MAX_PROGRAM_PARAMETERS_ARB { already defined } + // GL_PROGRAM_NATIVE_PARAMETERS_ARB { already defined } + // GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB { already defined } + // GL_PROGRAM_ATTRIBS_ARB { already defined } + // GL_MAX_PROGRAM_ATTRIBS_ARB { already defined } + // GL_PROGRAM_NATIVE_ATTRIBS_ARB { already defined } + // GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB { already defined } + // GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB { already defined } + // GL_MAX_PROGRAM_ENV_PARAMETERS_ARB { already defined } + // GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB { already defined } + GL_PROGRAM_ALU_INSTRUCTIONS_ARB = $8805; + GL_PROGRAM_TEX_INSTRUCTIONS_ARB = $8806; + GL_PROGRAM_TEX_INDIRECTIONS_ARB = $8807; + GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB = $8808; + GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB = $8809; + GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB = $880A; + GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB = $880B; + GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB = $880C; + GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB = $880D; + GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB = $880E; + GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB = $880F; + GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB = $8810; + // GL_PROGRAM_STRING_ARB { already defined } + // GL_PROGRAM_ERROR_POSITION_ARB { already defined } + // GL_CURRENT_MATRIX_ARB { already defined } + // GL_TRANSPOSE_CURRENT_MATRIX_ARB { already defined } + // GL_CURRENT_MATRIX_STACK_DEPTH_ARB { already defined } + // GL_MAX_PROGRAM_MATRICES_ARB { already defined } + // GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB { already defined } + GL_MAX_TEXTURE_COORDS_ARB = $8871; + GL_MAX_TEXTURE_IMAGE_UNITS_ARB = $8872; + // GL_PROGRAM_ERROR_STRING_ARB { already defined } + // GL_MATRIX0_ARB { already defined } + // GL_MATRIX1_ARB { already defined } + // GL_MATRIX2_ARB { already defined } + // GL_MATRIX3_ARB { already defined } + // GL_MATRIX4_ARB { already defined } + // GL_MATRIX5_ARB { already defined } + // GL_MATRIX6_ARB { already defined } + // GL_MATRIX7_ARB { already defined } + // GL_MATRIX8_ARB { already defined } + // GL_MATRIX9_ARB { already defined } + // GL_MATRIX10_ARB { already defined } + // GL_MATRIX11_ARB { already defined } + // GL_MATRIX12_ARB { already defined } + // GL_MATRIX13_ARB { already defined } + // GL_MATRIX14_ARB { already defined } + // GL_MATRIX15_ARB { already defined } + // GL_MATRIX16_ARB { already defined } + // GL_MATRIX17_ARB { already defined } + // GL_MATRIX18_ARB { already defined } + // GL_MATRIX19_ARB { already defined } + // GL_MATRIX20_ARB { already defined } + // GL_MATRIX21_ARB { already defined } + // GL_MATRIX22_ARB { already defined } + // GL_MATRIX23_ARB { already defined } + // GL_MATRIX24_ARB { already defined } + // GL_MATRIX25_ARB { already defined } + // GL_MATRIX26_ARB { already defined } + // GL_MATRIX27_ARB { already defined } + // GL_MATRIX28_ARB { already defined } + // GL_MATRIX29_ARB { already defined } + // GL_MATRIX30_ARB { already defined } + // GL_MATRIX31_ARB { already defined } + // glProgramStringARB { already defined } + // glBindProgramARB { already defined } + // glDeleteProgramsARB { already defined } + // glGenProgramsARB { already defined } + // glProgramEnvParameter4dARB { already defined } + // glProgramEnvParameter4dvARB { already defined } + // glProgramEnvParameter4fARB { already defined } + // glProgramEnvParameter4fvARB { already defined } + // glProgramLocalParameter4dARB { already defined } + // glProgramLocalParameter4dvARB { already defined } + // glProgramLocalParameter4fARB { already defined } + // glProgramLocalParameter4fvARB { already defined } + // glGetProgramEnvParameterdvARB { already defined } + // glGetProgramEnvParameterfvARB { already defined } + // glGetProgramLocalParameterdvARB { already defined } + // glGetProgramLocalParameterfvARB { already defined } + // glGetProgramivARB { already defined } + // glGetProgramStringARB { already defined } + // glIsProgramARB { already defined } + +function Load_GL_ARB_fragment_program: Boolean; + +//***** GL_ATI_text_fragment_shader *****// +const + GL_TEXT_FRAGMENT_SHADER_ATI = $8200; + +function Load_GL_ATI_text_fragment_shader: Boolean; + +//***** GL_APPLE_client_storage *****// +const + GL_UNPACK_CLIENT_STORAGE_APPLE = $85B2; + +function Load_GL_APPLE_client_storage: Boolean; + +//***** GL_APPLE_element_array *****// +const + GL_ELEMENT_ARRAY_APPLE = $8768; + GL_ELEMENT_ARRAY_TYPE_APPLE = $8769; + GL_ELEMENT_ARRAY_POINTER_APPLE = $876A; +var + glElementPointerAPPLE: procedure(_type: GLenum; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawElementArrayAPPLE: procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawRangeElementArrayAPPLE: procedure(mode: GLenum; start: GLuint; _end: GLuint; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiDrawElementArrayAPPLE: procedure(mode: GLenum; const first: PGLint; const count: PGLsizei; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiDrawRangeElementArrayAPPLE: procedure(mode: GLenum; start: GLuint; _end: GLuint; const first: PGLint; const count: PGLsizei; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_APPLE_element_array: Boolean; + +//***** GL_APPLE_fence *****// +const + GL_DRAW_PIXELS_APPLE = $8A0A; + GL_FENCE_APPLE = $8A0B; +var + glGenFencesAPPLE: procedure(n: GLsizei; fences: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteFencesAPPLE: procedure(n: GLsizei; const fences: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSetFenceAPPLE: procedure(fence: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsFenceAPPLE: function(fence: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTestFenceAPPLE: function(fence: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFinishFenceAPPLE: procedure(fence: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTestObjectAPPLE: function(_object: GLenum; name: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFinishObjectAPPLE: procedure(_object: GLenum; name: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_APPLE_fence: Boolean; + +//***** GL_APPLE_vertex_array_object *****// +const + GL_VERTEX_ARRAY_BINDING_APPLE = $85B5; +var + glBindVertexArrayAPPLE: procedure(_array: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteVertexArraysAPPLE: procedure(n: GLsizei; const arrays: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenVertexArraysAPPLE: procedure(n: GLsizei; const arrays: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsVertexArrayAPPLE: function(_array: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_APPLE_vertex_array_object: Boolean; + +//***** GL_APPLE_vertex_array_range *****// +const + GL_VERTEX_ARRAY_RANGE_APPLE = $851D; + GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE = $851E; + GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_APPLE = $8520; + GL_VERTEX_ARRAY_RANGE_POINTER_APPLE = $8521; + GL_VERTEX_ARRAY_STORAGE_HINT_APPLE = $851F; + GL_STORAGE_CACHED_APPLE = $85BE; + GL_STORAGE_SHARED_APPLE = $85BF; +var + glVertexArrayRangeAPPLE: procedure(length: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFlushVertexArrayRangeAPPLE: procedure(length: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexArrayParameteriAPPLE: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_APPLE_vertex_array_range: Boolean; + +{$IFDEF Win32} +//***** WGL_ARB_pixel_format *****// +const + WGL_NUMBER_PIXEL_FORMATS_ARB = $2000; + WGL_DRAW_TO_WINDOW_ARB = $2001; + WGL_DRAW_TO_BITMAP_ARB = $2002; + WGL_ACCELERATION_ARB = $2003; + WGL_NEED_PALETTE_ARB = $2004; + WGL_NEED_SYSTEM_PALETTE_ARB = $2005; + WGL_SWAP_LAYER_BUFFERS_ARB = $2006; + WGL_SWAP_METHOD_ARB = $2007; + WGL_NUMBER_OVERLAYS_ARB = $2008; + WGL_NUMBER_UNDERLAYS_ARB = $2009; + WGL_TRANSPARENT_ARB = $200A; + WGL_TRANSPARENT_RED_VALUE_ARB = $2037; + WGL_TRANSPARENT_GREEN_VALUE_ARB = $2038; + WGL_TRANSPARENT_BLUE_VALUE_ARB = $2039; + WGL_TRANSPARENT_ALPHA_VALUE_ARB = $203A; + WGL_TRANSPARENT_INDEX_VALUE_ARB = $203B; + WGL_SHARE_DEPTH_ARB = $200C; + WGL_SHARE_STENCIL_ARB = $200D; + WGL_SHARE_ACCUM_ARB = $200E; + WGL_SUPPORT_GDI_ARB = $200F; + WGL_SUPPORT_OPENGL_ARB = $2010; + WGL_DOUBLE_BUFFER_ARB = $2011; + WGL_STEREO_ARB = $2012; + WGL_PIXEL_TYPE_ARB = $2013; + WGL_COLOR_BITS_ARB = $2014; + WGL_RED_BITS_ARB = $2015; + WGL_RED_SHIFT_ARB = $2016; + WGL_GREEN_BITS_ARB = $2017; + WGL_GREEN_SHIFT_ARB = $2018; + WGL_BLUE_BITS_ARB = $2019; + WGL_BLUE_SHIFT_ARB = $201A; + WGL_ALPHA_BITS_ARB = $201B; + WGL_ALPHA_SHIFT_ARB = $201C; + WGL_ACCUM_BITS_ARB = $201D; + WGL_ACCUM_RED_BITS_ARB = $201E; + WGL_ACCUM_GREEN_BITS_ARB = $201F; + WGL_ACCUM_BLUE_BITS_ARB = $2020; + WGL_ACCUM_ALPHA_BITS_ARB = $2021; + WGL_DEPTH_BITS_ARB = $2022; + WGL_STENCIL_BITS_ARB = $2023; + WGL_AUX_BUFFERS_ARB = $2024; + WGL_NO_ACCELERATION_ARB = $2025; + WGL_GENERIC_ACCELERATION_ARB = $2026; + WGL_FULL_ACCELERATION_ARB = $2027; + WGL_SWAP_EXCHANGE_ARB = $2028; + WGL_SWAP_COPY_ARB = $2029; + WGL_SWAP_UNDEFINED_ARB = $202A; + WGL_TYPE_RGBA_ARB = $202B; + WGL_TYPE_COLORINDEX_ARB = $202C; +var + wglGetPixelFormatAttribivARB: function(hdc: HDC; iPixelFormat: GLint; iLayerPlane: GLint; nAttributes: GLuint; const piAttributes: PGLint; piValues: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetPixelFormatAttribfvARB: function(hdc: HDC; iPixelFormat: GLint; iLayerPlane: GLint; nAttributes: GLuint; const piAttributes: PGLint; pfValues: PGLfloat): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglChoosePixelFormatARB: function(hdc: HDC; const piAttribIList: PGLint; const pfAttribFList: PGLfloat; nMaxFormats: GLuint; piFormats: PGLint; nNumFormats: PGLuint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_ARB_pixel_format: Boolean; + +//***** WGL_ARB_make_current_read *****// +const + WGL_ERROR_INVALID_PIXEL_TYPE_ARB = $2043; + WGL_ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB = $2054; +var + wglMakeContextCurrentARB: function(hDrawDC: HDC; hReadDC: HDC; hglrc: HGLRC): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetCurrentReadDCARB: function(): HDC; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_ARB_make_current_read: Boolean; + +//***** WGL_ARB_pbuffer *****// +const + WGL_DRAW_TO_PBUFFER_ARB = $202D; + // WGL_DRAW_TO_PBUFFER_ARB { already defined } + WGL_MAX_PBUFFER_PIXELS_ARB = $202E; + WGL_MAX_PBUFFER_WIDTH_ARB = $202F; + WGL_MAX_PBUFFER_HEIGHT_ARB = $2030; + WGL_PBUFFER_LARGEST_ARB = $2033; + WGL_PBUFFER_WIDTH_ARB = $2034; + WGL_PBUFFER_HEIGHT_ARB = $2035; + WGL_PBUFFER_LOST_ARB = $2036; +var + wglCreatePbufferARB: function(hDC: HDC; iPixelFormat: GLint; iWidth: GLint; iHeight: GLint; const piAttribList: PGLint): THandle; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetPbufferDCARB: function(hPbuffer: THandle): HDC; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglReleasePbufferDCARB: function(hPbuffer: THandle; hDC: HDC): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglDestroyPbufferARB: function(hPbuffer: THandle): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglQueryPbufferARB: function(hPbuffer: THandle; iAttribute: GLint; piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_ARB_pbuffer: Boolean; + +//***** WGL_EXT_swap_control *****// +var + wglSwapIntervalEXT: function(interval: GLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetSwapIntervalEXT: function(): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_EXT_swap_control: Boolean; + +//***** WGL_ARB_render_texture *****// +const + WGL_BIND_TO_TEXTURE_RGB_ARB = $2070; + WGL_BIND_TO_TEXTURE_RGBA_ARB = $2071; + WGL_TEXTURE_FORMAT_ARB = $2072; + WGL_TEXTURE_TARGET_ARB = $2073; + WGL_MIPMAP_TEXTURE_ARB = $2074; + WGL_TEXTURE_RGB_ARB = $2075; + WGL_TEXTURE_RGBA_ARB = $2076; + WGL_NO_TEXTURE_ARB = $2077; + WGL_TEXTURE_CUBE_MAP_ARB = $2078; + WGL_TEXTURE_1D_ARB = $2079; + WGL_TEXTURE_2D_ARB = $207A; + // WGL_NO_TEXTURE_ARB { already defined } + WGL_MIPMAP_LEVEL_ARB = $207B; + WGL_CUBE_MAP_FACE_ARB = $207C; + WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = $207D; + WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = $207E; + WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = $207F; + WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = $2080; + WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = $2081; + WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = $2082; + WGL_FRONT_LEFT_ARB = $2083; + WGL_FRONT_RIGHT_ARB = $2084; + WGL_BACK_LEFT_ARB = $2085; + WGL_BACK_RIGHT_ARB = $2086; + WGL_AUX0_ARB = $2087; + WGL_AUX1_ARB = $2088; + WGL_AUX2_ARB = $2089; + WGL_AUX3_ARB = $208A; + WGL_AUX4_ARB = $208B; + WGL_AUX5_ARB = $208C; + WGL_AUX6_ARB = $208D; + WGL_AUX7_ARB = $208E; + WGL_AUX8_ARB = $208F; + WGL_AUX9_ARB = $2090; +var + wglBindTexImageARB: function(hPbuffer: THandle; iBuffer: GLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglReleaseTexImageARB: function(hPbuffer: THandle; iBuffer: GLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglSetPbufferAttribARB: function(hPbuffer: THandle; const piAttribList: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_ARB_render_texture: Boolean; + +//***** WGL_EXT_extensions_string *****// +var + wglGetExtensionsStringEXT: function(): Pchar; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_EXT_extensions_string: Boolean; + +//***** WGL_EXT_make_current_read *****// +var + wglMakeContextCurrentEXT: function(hDrawDC: HDC; hReadDC: HDC; hglrc: HGLRC): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetCurrentReadDCEXT: function(): HDC; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_EXT_make_current_read: Boolean; + +//***** WGL_EXT_pbuffer *****// +const + WGL_DRAW_TO_PBUFFER_EXT = $202D; + WGL_MAX_PBUFFER_PIXELS_EXT = $202E; + WGL_MAX_PBUFFER_WIDTH_EXT = $202F; + WGL_MAX_PBUFFER_HEIGHT_EXT = $2030; + WGL_OPTIMAL_PBUFFER_WIDTH_EXT = $2031; + WGL_OPTIMAL_PBUFFER_HEIGHT_EXT = $2032; + WGL_PBUFFER_LARGEST_EXT = $2033; + WGL_PBUFFER_WIDTH_EXT = $2034; + WGL_PBUFFER_HEIGHT_EXT = $2035; +var + wglCreatePbufferEXT: function(hDC: HDC; iPixelFormat: GLint; iWidth: GLint; iHeight: GLint; const piAttribList: PGLint): THandle; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetPbufferDCEXT: function(hPbuffer: THandle): HDC; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglReleasePbufferDCEXT: function(hPbuffer: THandle; hDC: HDC): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglDestroyPbufferEXT: function(hPbuffer: THandle): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglQueryPbufferEXT: function(hPbuffer: THandle; iAttribute: GLint; piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_EXT_pbuffer: Boolean; + +//***** WGL_EXT_pixel_format *****// +const + WGL_NUMBER_PIXEL_FORMATS_EXT = $2000; + WGL_DRAW_TO_WINDOW_EXT = $2001; + WGL_DRAW_TO_BITMAP_EXT = $2002; + WGL_ACCELERATION_EXT = $2003; + WGL_NEED_PALETTE_EXT = $2004; + WGL_NEED_SYSTEM_PALETTE_EXT = $2005; + WGL_SWAP_LAYER_BUFFERS_EXT = $2006; + WGL_SWAP_METHOD_EXT = $2007; + WGL_NUMBER_OVERLAYS_EXT = $2008; + WGL_NUMBER_UNDERLAYS_EXT = $2009; + WGL_TRANSPARENT_EXT = $200A; + WGL_TRANSPARENT_VALUE_EXT = $200B; + WGL_SHARE_DEPTH_EXT = $200C; + WGL_SHARE_STENCIL_EXT = $200D; + WGL_SHARE_ACCUM_EXT = $200E; + WGL_SUPPORT_GDI_EXT = $200F; + WGL_SUPPORT_OPENGL_EXT = $2010; + WGL_DOUBLE_BUFFER_EXT = $2011; + WGL_STEREO_EXT = $2012; + WGL_PIXEL_TYPE_EXT = $2013; + WGL_COLOR_BITS_EXT = $2014; + WGL_RED_BITS_EXT = $2015; + WGL_RED_SHIFT_EXT = $2016; + WGL_GREEN_BITS_EXT = $2017; + WGL_GREEN_SHIFT_EXT = $2018; + WGL_BLUE_BITS_EXT = $2019; + WGL_BLUE_SHIFT_EXT = $201A; + WGL_ALPHA_BITS_EXT = $201B; + WGL_ALPHA_SHIFT_EXT = $201C; + WGL_ACCUM_BITS_EXT = $201D; + WGL_ACCUM_RED_BITS_EXT = $201E; + WGL_ACCUM_GREEN_BITS_EXT = $201F; + WGL_ACCUM_BLUE_BITS_EXT = $2020; + WGL_ACCUM_ALPHA_BITS_EXT = $2021; + WGL_DEPTH_BITS_EXT = $2022; + WGL_STENCIL_BITS_EXT = $2023; + WGL_AUX_BUFFERS_EXT = $2024; + WGL_NO_ACCELERATION_EXT = $2025; + WGL_GENERIC_ACCELERATION_EXT = $2026; + WGL_FULL_ACCELERATION_EXT = $2027; + WGL_SWAP_EXCHANGE_EXT = $2028; + WGL_SWAP_COPY_EXT = $2029; + WGL_SWAP_UNDEFINED_EXT = $202A; + WGL_TYPE_RGBA_EXT = $202B; + WGL_TYPE_COLORINDEX_EXT = $202C; +var + wglGetPixelFormatAttribivEXT: function(hdc: HDC; iPixelFormat: GLint; iLayerPlane: GLint; nAttributes: GLuint; piAttributes: PGLint; piValues: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetPixelFormatAttribfvEXT: function(hdc: HDC; iPixelFormat: GLint; iLayerPlane: GLint; nAttributes: GLuint; piAttributes: PGLint; pfValues: PGLfloat): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglChoosePixelFormatEXT: function(hdc: HDC; const piAttribIList: PGLint; const pfAttribFList: PGLfloat; nMaxFormats: GLuint; piFormats: PGLint; nNumFormats: PGLuint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_EXT_pixel_format: Boolean; + +//***** WGL_I3D_digital_video_control *****// +const + WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D = $2050; + WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D = $2051; + WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D = $2052; + WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D = $2053; +var + wglGetDigitalVideoParametersI3D: function(hDC: HDC; iAttribute: GLint; piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglSetDigitalVideoParametersI3D: function(hDC: HDC; iAttribute: GLint; const piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_I3D_digital_video_control: Boolean; + +//***** WGL_I3D_gamma *****// +const + WGL_GAMMA_TABLE_SIZE_I3D = $204E; + WGL_GAMMA_EXCLUDE_DESKTOP_I3D = $204F; + // WGL_GAMMA_EXCLUDE_DESKTOP_I3D { already defined } +var + wglGetGammaTableParametersI3D: function(hDC: HDC; iAttribute: GLint; piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglSetGammaTableParametersI3D: function(hDC: HDC; iAttribute: GLint; const piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetGammaTableI3D: function(hDC: HDC; iEntries: GLint; puRed: PGLUSHORT; puGreen: PGLUSHORT; puBlue: PGLUSHORT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglSetGammaTableI3D: function(hDC: HDC; iEntries: GLint; const puRed: PGLUSHORT; const puGreen: PGLUSHORT; const puBlue: PGLUSHORT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_I3D_gamma: Boolean; + +//***** WGL_I3D_genlock *****// +const + WGL_GENLOCK_SOURCE_MULTIVIEW_I3D = $2044; + WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D = $2045; + WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D = $2046; + WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D = $2047; + WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D = $2048; + WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D = $2049; + WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D = $204A; + WGL_GENLOCK_SOURCE_EDGE_RISING_I3D = $204B; + WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D = $204C; +var + wglEnableGenlockI3D: function(hDC: HDC): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglDisableGenlockI3D: function(hDC: HDC): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglIsEnabledGenlockI3D: function(hDC: HDC; pFlag: PBOOL): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGenlockSourceI3D: function(hDC: HDC; uSource: GLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetGenlockSourceI3D: function(hDC: HDC; uSource: PGLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGenlockSourceEdgeI3D: function(hDC: HDC; uEdge: GLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetGenlockSourceEdgeI3D: function(hDC: HDC; uEdge: PGLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGenlockSampleRateI3D: function(hDC: HDC; uRate: GLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetGenlockSampleRateI3D: function(hDC: HDC; uRate: PGLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGenlockSourceDelayI3D: function(hDC: HDC; uDelay: GLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetGenlockSourceDelayI3D: function(hDC: HDC; uDelay: PGLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglQueryGenlockMaxSourceDelayI3D: function(hDC: HDC; uMaxLineDelay: PGLUINT; uMaxPixelDelay: PGLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_I3D_genlock: Boolean; +{$ENDIF} + +//***** GL_ARB_matrix_palette *****// +const + GL_MATRIX_PALETTE_ARB = $8840; + GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB = $8841; + GL_MAX_PALETTE_MATRICES_ARB = $8842; + GL_CURRENT_PALETTE_MATRIX_ARB = $8843; + GL_MATRIX_INDEX_ARRAY_ARB = $8844; + GL_CURRENT_MATRIX_INDEX_ARB = $8845; + GL_MATRIX_INDEX_ARRAY_SIZE_ARB = $8846; + GL_MATRIX_INDEX_ARRAY_TYPE_ARB = $8847; + GL_MATRIX_INDEX_ARRAY_STRIDE_ARB = $8848; + GL_MATRIX_INDEX_ARRAY_POINTER_ARB = $8849; +var + glCurrentPaletteMatrixARB: procedure(index: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMatrixIndexubvARB: procedure(size: GLint; indices: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMatrixIndexusvARB: procedure(size: GLint; indices: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMatrixIndexuivARB: procedure(size: GLint; indices: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMatrixIndexPointerARB: procedure(size: GLint; _type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_matrix_palette: Boolean; + +//***** GL_NV_element_array *****// +const + GL_ELEMENT_ARRAY_TYPE_NV = $8769; + GL_ELEMENT_ARRAY_POINTER_NV = $876A; +var + glElementPointerNV: procedure(_type: GLenum; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawElementArrayNV: procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawRangeElementArrayNV: procedure(mode: GLenum; start: GLuint; _end: GLuint; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiDrawElementArrayNV: procedure(mode: GLenum; const first: PGLint; const count: PGLsizei; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiDrawRangeElementArrayNV: procedure(mode: GLenum; start: GLuint; _end: GLuint; const first: PGLint; const count: PGLsizei; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_NV_element_array: Boolean; + +//***** GL_NV_float_buffer *****// +const + GL_FLOAT_R_NV = $8880; + GL_FLOAT_RG_NV = $8881; + GL_FLOAT_RGB_NV = $8882; + GL_FLOAT_RGBA_NV = $8883; + GL_FLOAT_R16_NV = $8884; + GL_FLOAT_R32_NV = $8885; + GL_FLOAT_RG16_NV = $8886; + GL_FLOAT_RG32_NV = $8887; + GL_FLOAT_RGB16_NV = $8888; + GL_FLOAT_RGB32_NV = $8889; + GL_FLOAT_RGBA16_NV = $888A; + GL_FLOAT_RGBA32_NV = $888B; + GL_TEXTURE_FLOAT_COMPONENTS_NV = $888C; + GL_FLOAT_CLEAR_COLOR_VALUE_NV = $888D; + GL_FLOAT_RGBA_MODE_NV = $888E; +{$IFDEF Win32} + WGL_FLOAT_COMPONENTS_NV = $20B0; + WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV = $20B1; + WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV = $20B2; + WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV = $20B3; + WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV = $20B4; + WGL_TEXTURE_FLOAT_R_NV = $20B5; + WGL_TEXTURE_FLOAT_RG_NV = $20B6; + WGL_TEXTURE_FLOAT_RGB_NV = $20B7; + WGL_TEXTURE_FLOAT_RGBA_NV = $20B8; +{$ENDIF} + +function Load_GL_NV_float_buffer: Boolean; + +//***** GL_NV_fragment_program *****// +const + GL_FRAGMENT_PROGRAM_NV = $8870; + GL_MAX_TEXTURE_COORDS_NV = $8871; + GL_MAX_TEXTURE_IMAGE_UNITS_NV = $8872; + GL_FRAGMENT_PROGRAM_BINDING_NV = $8873; + GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV = $8868; + GL_PROGRAM_ERROR_STRING_NV = $8874; +var + glProgramNamedParameter4fNV: procedure(id: GLuint; len: GLsizei; const name: PGLubyte; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramNamedParameter4dNV: procedure(id: GLuint; len: GLsizei; const name: PGLubyte; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramNamedParameterfvNV: procedure(id: GLuint; len: GLsizei; const name: PGLubyte; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramNamedParameterdvNV: procedure(id: GLuint; len: GLsizei; const name: PGLubyte; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + // glProgramLocalParameter4dARB { already defined } + // glProgramLocalParameter4dvARB { already defined } + // glProgramLocalParameter4fARB { already defined } + // glProgramLocalParameter4fvARB { already defined } + // glGetProgramLocalParameterdvARB { already defined } + // glGetProgramLocalParameterfvARB { already defined } + +function Load_GL_NV_fragment_program: Boolean; + +//***** GL_NV_primitive_restart *****// +const + GL_PRIMITIVE_RESTART_NV = $8558; + GL_PRIMITIVE_RESTART_INDEX_NV = $8559; +var + glPrimitiveRestartNV: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPrimitiveRestartIndexNV: procedure(index: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_NV_primitive_restart: Boolean; + +//***** GL_NV_vertex_program2 *****// + +function Load_GL_NV_vertex_program2: Boolean; + +//***** WGL_NV_render_texture_rectangle *****// +const + WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV = $20A0; + WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV = $20A1; + WGL_TEXTURE_RECTANGLE_NV = $20A2; + +function Load_WGL_NV_render_texture_rectangle: Boolean; + +//***** GL_NV_pixel_data_range *****// +const + GL_WRITE_PIXEL_DATA_RANGE_NV = $8878; + GL_READ_PIXEL_DATA_RANGE_NV = $8879; + GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV = $887A; + GL_READ_PIXEL_DATA_RANGE_LENGTH_NV = $887B; + GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV = $887C; + GL_READ_PIXEL_DATA_RANGE_POINTER_NV = $887D; +var + glPixelDataRangeNV: procedure(target: GLenum; length: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFlushPixelDataRangeNV: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + // wglAllocateMemoryNV { already defined } + // wglFreeMemoryNV { already defined } + +function Load_GL_NV_pixel_data_range: Boolean; + +//***** GL_EXT_texture_rectangle *****// +const + GL_TEXTURE_RECTANGLE_EXT = $84F5; + GL_TEXTURE_BINDING_RECTANGLE_EXT = $84F6; + GL_PROXY_TEXTURE_RECTANGLE_EXT = $84F7; + GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT = $84F8; + +function Load_GL_EXT_texture_rectangle: Boolean; + +//***** GL_S3_s3tc *****// +const + GL_RGB_S3TC = $83A0; + GL_RGB4_S3TC = $83A1; + GL_RGBA_S3TC = $83A2; + GL_RGBA4_S3TC = $83A3; + +function Load_GL_S3_s3tc: Boolean; + +//***** GL_ATI_draw_buffers *****// +const + GL_MAX_DRAW_BUFFERS_ATI = $8824; + GL_DRAW_BUFFER0_ATI = $8825; + GL_DRAW_BUFFER1_ATI = $8826; + GL_DRAW_BUFFER2_ATI = $8827; + GL_DRAW_BUFFER3_ATI = $8828; + GL_DRAW_BUFFER4_ATI = $8829; + GL_DRAW_BUFFER5_ATI = $882A; + GL_DRAW_BUFFER6_ATI = $882B; + GL_DRAW_BUFFER7_ATI = $882C; + GL_DRAW_BUFFER8_ATI = $882D; + GL_DRAW_BUFFER9_ATI = $882E; + GL_DRAW_BUFFER10_ATI = $882F; + GL_DRAW_BUFFER11_ATI = $8830; + GL_DRAW_BUFFER12_ATI = $8831; + GL_DRAW_BUFFER13_ATI = $8832; + GL_DRAW_BUFFER14_ATI = $8833; + GL_DRAW_BUFFER15_ATI = $8834; +var + glDrawBuffersATI: procedure(n: GLsizei; const bufs: PGLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ATI_draw_buffers: Boolean; + +//***** WGL_ATI_pixel_format_float *****// +const + WGL_RGBA_FLOAT_MODE_ATI = $8820; + WGL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI = $8835; + WGL_TYPE_RGBA_FLOAT_ATI = $21A0; + +function Load_WGL_ATI_pixel_format_float: Boolean; + +//***** GL_ATI_texture_env_combine3 *****// +const + GL_MODULATE_ADD_ATI = $8744; + GL_MODULATE_SIGNED_ADD_ATI = $8745; + GL_MODULATE_SUBTRACT_ATI = $8746; + +function Load_GL_ATI_texture_env_combine3: Boolean; + +//***** GL_ATI_texture_float *****// +const + GL_RGBA_FLOAT32_ATI = $8814; + GL_RGB_FLOAT32_ATI = $8815; + GL_ALPHA_FLOAT32_ATI = $8816; + GL_INTENSITY_FLOAT32_ATI = $8817; + GL_LUMINANCE_FLOAT32_ATI = $8818; + GL_LUMINANCE_ALPHA_FLOAT32_ATI = $8819; + GL_RGBA_FLOAT16_ATI = $881A; + GL_RGB_FLOAT16_ATI = $881B; + GL_ALPHA_FLOAT16_ATI = $881C; + GL_INTENSITY_FLOAT16_ATI = $881D; + GL_LUMINANCE_FLOAT16_ATI = $881E; + GL_LUMINANCE_ALPHA_FLOAT16_ATI = $881F; + +function Load_GL_ATI_texture_float: Boolean; + +//***** GL_NV_texture_expand_normal *****// +const + GL_TEXTURE_UNSIGNED_REMAP_MODE_NV = $888F; + +function Load_GL_NV_texture_expand_normal: Boolean; + +//***** GL_NV_half_float *****// +const + GL_HALF_FLOAT_NV = $140B; +var + glVertex2hNV: procedure(x: GLushort; y: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3hNV: procedure(x: GLushort; y: GLushort; z: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4hNV: procedure(x: GLushort; y: GLushort; z: GLushort; w: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3hNV: procedure(nx: GLushort; ny: GLushort; nz: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3hNV: procedure(red: GLushort; green: GLushort; blue: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4hNV: procedure(red: GLushort; green: GLushort; blue: GLushort; alpha: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1hNV: procedure(s: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2hNV: procedure(s: GLushort; t: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3hNV: procedure(s: GLushort; t: GLushort; r: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4hNV: procedure(s: GLushort; t: GLushort; r: GLushort; q: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1hNV: procedure(target: GLenum; s: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1hvNV: procedure(target: GLenum; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2hNV: procedure(target: GLenum; s: GLushort; t: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2hvNV: procedure(target: GLenum; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3hNV: procedure(target: GLenum; s: GLushort; t: GLushort; r: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3hvNV: procedure(target: GLenum; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4hNV: procedure(target: GLenum; s: GLushort; t: GLushort; r: GLushort; q: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4hvNV: procedure(target: GLenum; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoordhNV: procedure(fog: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoordhvNV: procedure(const fog: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3hNV: procedure(red: GLushort; green: GLushort; blue: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexWeighthNV: procedure(weight: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexWeighthvNV: procedure(const weight: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1hNV: procedure(index: GLuint; x: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1hvNV: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2hNV: procedure(index: GLuint; x: GLushort; y: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2hvNV: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3hNV: procedure(index: GLuint; x: GLushort; y: GLushort; z: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3hvNV: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4hNV: procedure(index: GLuint; x: GLushort; y: GLushort; z: GLushort; w: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4hvNV: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs1hvNV: procedure(index: GLuint; n: GLsizei; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs2hvNV: procedure(index: GLuint; n: GLsizei; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs3hvNV: procedure(index: GLuint; n: GLsizei; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs4hvNV: procedure(index: GLuint; n: GLsizei; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_NV_half_float: Boolean; + +//***** GL_ATI_map_object_buffer *****// +var + glMapObjectBufferATI: function(buffer: GLuint): PGLvoid; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUnmapObjectBufferATI: procedure(buffer: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ATI_map_object_buffer: Boolean; + +//***** GL_ATI_separate_stencil *****// +const + GL_KEEP = $1E00; + GL_ZERO = $0000; + GL_REPLACE = $1E01; + GL_INCR = $1E02; + GL_DECR = $1E03; + GL_INVERT = $150A; + GL_NEVER = $0200; + GL_LESS = $0201; + GL_LEQUAL = $0203; + GL_GREATER = $0204; + GL_GEQUAL = $0206; + GL_EQUAL = $0202; + GL_NOTEQUAL = $0205; + GL_ALWAYS = $0207; + GL_FRONT = $0404; + GL_BACK = $0405; + GL_FRONT_AND_BACK = $0408; + GL_STENCIL_BACK_FUNC_ATI = $8800; + GL_STENCIL_BACK_FAIL_ATI = $8801; + GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI = $8802; + GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI = $8803; +var + glStencilOpSeparateATI: procedure(face: GLenum; sfail: GLenum; dpfail: GLenum; dppass: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glStencilFuncSeparateATI: procedure(frontfunc: GLenum; backfunc: GLenum; ref: GLint; mask: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ATI_separate_stencil: Boolean; + +//***** GL_ATI_vertex_attrib_array_object *****// +var + glVertexAttribArrayObjectATI: procedure(index: GLuint; size: GLint; _type: GLenum; normalized: GLboolean; stride: GLsizei; buffer: GLuint; offset: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribArrayObjectfvATI: procedure(index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribArrayObjectivATI: procedure(index: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ATI_vertex_attrib_array_object: Boolean; + +//***** GL_ARB_vertex_buffer_object *****// +const + GL_ARRAY_BUFFER_ARB = $8892; + GL_ELEMENT_ARRAY_BUFFER_ARB = $8893; + GL_ARRAY_BUFFER_BINDING_ARB = $8894; + GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB = $8895; + GL_VERTEX_ARRAY_BUFFER_BINDING_ARB = $8896; + GL_NORMAL_ARRAY_BUFFER_BINDING_ARB = $8897; + GL_COLOR_ARRAY_BUFFER_BINDING_ARB = $8898; + GL_INDEX_ARRAY_BUFFER_BINDING_ARB = $8899; + GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB = $889A; + GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB = $889B; + GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB = $889C; + GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB = $889D; + GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB = $889E; + GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB = $889F; + GL_STREAM_DRAW_ARB = $88E0; + GL_STREAM_READ_ARB = $88E1; + GL_STREAM_COPY_ARB = $88E2; + GL_STATIC_DRAW_ARB = $88E4; + GL_STATIC_READ_ARB = $88E5; + GL_STATIC_COPY_ARB = $88E6; + GL_DYNAMIC_DRAW_ARB = $88E8; + GL_DYNAMIC_READ_ARB = $88E9; + GL_DYNAMIC_COPY_ARB = $88EA; + GL_READ_ONLY_ARB = $88B8; + GL_WRITE_ONLY_ARB = $88B9; + GL_READ_WRITE_ARB = $88BA; + GL_BUFFER_SIZE_ARB = $8764; + GL_BUFFER_USAGE_ARB = $8765; + GL_BUFFER_ACCESS_ARB = $88BB; + GL_BUFFER_MAPPED_ARB = $88BC; + GL_BUFFER_MAP_POINTER_ARB = $88BD; +var + glBindBufferARB: procedure(target: GLenum; buffer: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteBuffersARB: procedure(n: GLsizei; const buffers: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenBuffersARB: procedure(n: GLsizei; buffers: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsBufferARB: function(buffer: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBufferDataARB: procedure(target: GLenum; size: GLsizeiptrARB; const data: PGLvoid; usage: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBufferSubDataARB: procedure(target: GLenum; offset: GLintptrARB; size: GLsizeiptrARB; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetBufferSubDataARB: procedure(target: GLenum; offset: GLintptrARB; size: GLsizeiptrARB; data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapBufferARB: function(target: GLenum; access: GLenum): PGLvoid; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUnmapBufferARB: function(target: GLenum): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetBufferParameterivARB: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetBufferPointervARB: procedure(target: GLenum; pname: GLenum; params: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_vertex_buffer_object: Boolean; + +//***** GL_ARB_occlusion_query *****// +const + GL_SAMPLES_PASSED_ARB = $8914; + GL_QUERY_COUNTER_BITS_ARB = $8864; + GL_CURRENT_QUERY_ARB = $8865; + GL_QUERY_RESULT_ARB = $8866; + GL_QUERY_RESULT_AVAILABLE_ARB = $8867; +var + glGenQueriesARB: procedure(n: GLsizei; ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteQueriesARB: procedure(n: GLsizei; const ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsQueryARB: function(id: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBeginQueryARB: procedure(target: GLenum; id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEndQueryARB: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetQueryivARB: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetQueryObjectivARB: procedure(id: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetQueryObjectuivARB: procedure(id: GLuint; pname: GLenum; params: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_occlusion_query: Boolean; + +//***** GL_ARB_shader_objects *****// +const + GL_PROGRAM_OBJECT_ARB = $8B40; + GL_OBJECT_TYPE_ARB = $8B4E; + GL_OBJECT_SUBTYPE_ARB = $8B4F; + GL_OBJECT_DELETE_STATUS_ARB = $8B80; + GL_OBJECT_COMPILE_STATUS_ARB = $8B81; + GL_OBJECT_LINK_STATUS_ARB = $8B82; + GL_OBJECT_VALIDATE_STATUS_ARB = $8B83; + GL_OBJECT_INFO_LOG_LENGTH_ARB = $8B84; + GL_OBJECT_ATTACHED_OBJECTS_ARB = $8B85; + GL_OBJECT_ACTIVE_UNIFORMS_ARB = $8B86; + GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB = $8B87; + GL_OBJECT_SHADER_SOURCE_LENGTH_ARB = $8B88; + GL_SHADER_OBJECT_ARB = $8B48; + GL_FLOAT = $1406; + GL_FLOAT_VEC2_ARB = $8B50; + GL_FLOAT_VEC3_ARB = $8B51; + GL_FLOAT_VEC4_ARB = $8B52; + GL_INT = $1404; + GL_INT_VEC2_ARB = $8B53; + GL_INT_VEC3_ARB = $8B54; + GL_INT_VEC4_ARB = $8B55; + GL_BOOL_ARB = $8B56; + GL_BOOL_VEC2_ARB = $8B57; + GL_BOOL_VEC3_ARB = $8B58; + GL_BOOL_VEC4_ARB = $8B59; + GL_FLOAT_MAT2_ARB = $8B5A; + GL_FLOAT_MAT3_ARB = $8B5B; + GL_FLOAT_MAT4_ARB = $8B5C; +var + glDeleteObjectARB: procedure(obj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetHandleARB: function(pname: GLenum): GLhandleARB; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDetachObjectARB: procedure(containerObj: GLhandleARB; attachedObj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCreateShaderObjectARB: function(shaderType: GLenum): GLhandleARB; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glShaderSourceARB: procedure(shaderObj: GLhandleARB; count: GLsizei; const _string: PGLvoid; const length: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompileShaderARB: procedure(shaderObj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCreateProgramObjectARB: function(): GLhandleARB; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glAttachObjectARB: procedure(containerObj: GLhandleARB; obj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLinkProgramARB: procedure(programObj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUseProgramObjectARB: procedure(programObj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glValidateProgramARB: procedure(programObj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform1fARB: procedure(location: GLint; v0: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform2fARB: procedure(location: GLint; v0: GLfloat; v1: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform3fARB: procedure(location: GLint; v0: GLfloat; v1: GLfloat; v2: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform4fARB: procedure(location: GLint; v0: GLfloat; v1: GLfloat; v2: GLfloat; v3: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform1iARB: procedure(location: GLint; v0: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform2iARB: procedure(location: GLint; v0: GLint; v1: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform3iARB: procedure(location: GLint; v0: GLint; v1: GLint; v2: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform4iARB: procedure(location: GLint; v0: GLint; v1: GLint; v2: GLint; v3: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform1fvARB: procedure(location: GLint; count: GLsizei; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform2fvARB: procedure(location: GLint; count: GLsizei; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform3fvARB: procedure(location: GLint; count: GLsizei; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform4fvARB: procedure(location: GLint; count: GLsizei; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform1ivARB: procedure(location: GLint; count: GLsizei; value: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform2ivARB: procedure(location: GLint; count: GLsizei; value: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform3ivARB: procedure(location: GLint; count: GLsizei; value: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform4ivARB: procedure(location: GLint; count: GLsizei; value: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniformMatrix2fvARB: procedure(location: GLint; count: GLsizei; transpose: GLboolean; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniformMatrix3fvARB: procedure(location: GLint; count: GLsizei; transpose: GLboolean; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniformMatrix4fvARB: procedure(location: GLint; count: GLsizei; transpose: GLboolean; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetObjectParameterfvARB: procedure(obj: GLhandleARB; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetObjectParameterivARB: procedure(obj: GLhandleARB; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetInfoLogARB: procedure(obj: GLhandleARB; maxLength: GLsizei; length: PGLsizei; infoLog: PGLcharARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetAttachedObjectsARB: procedure(containerObj: GLhandleARB; maxCount: GLsizei; count: PGLsizei; obj: PGLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetUniformLocationARB: function(programObj: GLhandleARB; const name: PGLcharARB): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetActiveUniformARB: procedure(programObj: GLhandleARB; index: GLuint; maxLength: GLsizei; length: PGLsizei; size: PGLint; _type: PGLenum; name: PGLcharARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetUniformfvARB: procedure(programObj: GLhandleARB; location: GLint; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetUniformivARB: procedure(programObj: GLhandleARB; location: GLint; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetShaderSourceARB: procedure(obj: GLhandleARB; maxLength: GLsizei; length: PGLsizei; source: PGLcharARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_shader_objects: Boolean; + +//***** GL_ARB_vertex_shader *****// +const + GL_VERTEX_SHADER_ARB = $8B31; + GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB = $8B4A; + GL_MAX_VARYING_FLOATS_ARB = $8B4B; + // GL_MAX_VERTEX_ATTRIBS_ARB { already defined } + // GL_MAX_TEXTURE_IMAGE_UNITS_ARB { already defined } + GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB = $8B4C; + GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB = $8B4D; + // GL_MAX_TEXTURE_COORDS_ARB { already defined } + // GL_VERTEX_PROGRAM_POINT_SIZE_ARB { already defined } + // GL_VERTEX_PROGRAM_TWO_SIDE_ARB { already defined } + // GL_OBJECT_TYPE_ARB { already defined } + // GL_OBJECT_SUBTYPE_ARB { already defined } + GL_OBJECT_ACTIVE_ATTRIBUTES_ARB = $8B89; + GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB = $8B8A; + // GL_SHADER_OBJECT_ARB { already defined } + // GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB { already defined } + // GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB { already defined } + // GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB { already defined } + // GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB { already defined } + // GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB { already defined } + // GL_CURRENT_VERTEX_ATTRIB_ARB { already defined } + // GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB { already defined } + // GL_FLOAT { already defined } + // GL_FLOAT_VEC2_ARB { already defined } + // GL_FLOAT_VEC3_ARB { already defined } + // GL_FLOAT_VEC4_ARB { already defined } + // GL_FLOAT_MAT2_ARB { already defined } + // GL_FLOAT_MAT3_ARB { already defined } + // GL_FLOAT_MAT4_ARB { already defined } + // glVertexAttrib1fARB { already defined } + // glVertexAttrib1sARB { already defined } + // glVertexAttrib1dARB { already defined } + // glVertexAttrib2fARB { already defined } + // glVertexAttrib2sARB { already defined } + // glVertexAttrib2dARB { already defined } + // glVertexAttrib3fARB { already defined } + // glVertexAttrib3sARB { already defined } + // glVertexAttrib3dARB { already defined } + // glVertexAttrib4fARB { already defined } + // glVertexAttrib4sARB { already defined } + // glVertexAttrib4dARB { already defined } + // glVertexAttrib4NubARB { already defined } + // glVertexAttrib1fvARB { already defined } + // glVertexAttrib1svARB { already defined } + // glVertexAttrib1dvARB { already defined } + // glVertexAttrib2fvARB { already defined } + // glVertexAttrib2svARB { already defined } + // glVertexAttrib2dvARB { already defined } + // glVertexAttrib3fvARB { already defined } + // glVertexAttrib3svARB { already defined } + // glVertexAttrib3dvARB { already defined } + // glVertexAttrib4fvARB { already defined } + // glVertexAttrib4svARB { already defined } + // glVertexAttrib4dvARB { already defined } + // glVertexAttrib4ivARB { already defined } + // glVertexAttrib4bvARB { already defined } + // glVertexAttrib4ubvARB { already defined } + // glVertexAttrib4usvARB { already defined } + // glVertexAttrib4uivARB { already defined } + // glVertexAttrib4NbvARB { already defined } + // glVertexAttrib4NsvARB { already defined } + // glVertexAttrib4NivARB { already defined } + // glVertexAttrib4NubvARB { already defined } + // glVertexAttrib4NusvARB { already defined } + // glVertexAttrib4NuivARB { already defined } + // glVertexAttribPointerARB { already defined } + // glEnableVertexAttribArrayARB { already defined } + // glDisableVertexAttribArrayARB { already defined } +var + glBindAttribLocationARB: procedure(programObj: GLhandleARB; index: GLuint; const name: PGLcharARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetActiveAttribARB: procedure(programObj: GLhandleARB; index: GLuint; maxLength: GLsizei; length: PGLsizei; size: PGLint; _type: PGLenum; name: PGLcharARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetAttribLocationARB: function(programObj: GLhandleARB; const name: PGLcharARB): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + // glGetVertexAttribdvARB { already defined } + // glGetVertexAttribfvARB { already defined } + // glGetVertexAttribivARB { already defined } + // glGetVertexAttribPointervARB { already defined } + +function Load_GL_ARB_vertex_shader: Boolean; + +//***** GL_ARB_fragment_shader *****// +const + GL_FRAGMENT_SHADER_ARB = $8B30; + GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB = $8B49; + // GL_MAX_TEXTURE_COORDS_ARB { already defined } + // GL_MAX_TEXTURE_IMAGE_UNITS_ARB { already defined } + // GL_OBJECT_TYPE_ARB { already defined } + // GL_OBJECT_SUBTYPE_ARB { already defined } + // GL_SHADER_OBJECT_ARB { already defined } + +function Load_GL_ARB_fragment_shader: Boolean; + +//***** GL_ARB_shading_language_100 *****// + +function Load_GL_ARB_shading_language_100: Boolean; + +//***** GL_ARB_texture_non_power_of_two *****// + +function Load_GL_ARB_texture_non_power_of_two: Boolean; + +//***** GL_ARB_point_sprite *****// +const + GL_POINT_SPRITE_ARB = $8861; + GL_COORD_REPLACE_ARB = $8862; + +function Load_GL_ARB_point_sprite: Boolean; + +//***** GL_EXT_depth_bounds_test *****// +const + GL_DEPTH_BOUNDS_TEST_EXT = $8890; + GL_DEPTH_BOUNDS_EXT = $8891; +var + glDepthBoundsEXT: procedure(zmin: GLclampd; zmax: GLclampd); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_depth_bounds_test: Boolean; + +//***** GL_EXT_secondary_color *****// +const + GL_COLOR_SUM_EXT = $8458; + GL_CURRENT_SECONDARY_COLOR_EXT = $8459; + GL_SECONDARY_COLOR_ARRAY_SIZE_EXT = $845A; + GL_SECONDARY_COLOR_ARRAY_TYPE_EXT = $845B; + GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT = $845C; + GL_SECONDARY_COLOR_ARRAY_POINTER_EXT = $845D; + GL_SECONDARY_COLOR_ARRAY_EXT = $845E; +var + glSecondaryColor3bEXT: procedure(r: GLbyte; g: GLbyte; b: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3sEXT: procedure(r: GLshort; g: GLshort; b: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3iEXT: procedure(r: GLint; g: GLint; b: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3fEXT: procedure(r: GLfloat; g: GLfloat; b: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3dEXT: procedure(r: GLdouble; g: GLdouble; b: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3ubEXT: procedure(r: GLubyte; g: GLubyte; b: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3usEXT: procedure(r: GLushort; g: GLushort; b: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3uiEXT: procedure(r: GLuint; g: GLuint; b: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3bvEXT: procedure(components: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3svEXT: procedure(components: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3ivEXT: procedure(components: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3fvEXT: procedure(components: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3dvEXT: procedure(components: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3ubvEXT: procedure(components: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3usvEXT: procedure(components: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3uivEXT: procedure(components: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColorPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_secondary_color: Boolean; + +//***** GL_EXT_texture_mirror_clamp *****// +const + GL_MIRROR_CLAMP_EXT = $8742; + GL_MIRROR_CLAMP_TO_EDGE_EXT = $8743; + GL_MIRROR_CLAMP_TO_BORDER_EXT = $8912; + +function Load_GL_EXT_texture_mirror_clamp: Boolean; + +//***** GL_EXT_blend_equation_separate *****// +const + GL_BLEND_EQUATION_RGB_EXT = $8009; + GL_BLEND_EQUATION_ALPHA_EXT = $883D; +var + glBlendEquationSeparateEXT: procedure(modeRGB: GLenum; modeAlpha: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_blend_equation_separate: Boolean; + +//***** GL_MESA_pack_invert *****// +const + GL_PACK_INVERT_MESA = $8758; + +function Load_GL_MESA_pack_invert: Boolean; + +//***** GL_MESA_ycbcr_texture *****// +const + GL_YCBCR_MESA = $8757; + GL_UNSIGNED_SHORT_8_8_MESA = $85BA; + GL_UNSIGNED_SHORT_8_8_REV_MESA = $85BB; + +function Load_GL_MESA_ycbcr_texture: Boolean; + +//***** GL_ARB_fragment_program_shadow *****// + +function Load_GL_ARB_fragment_program_shadow: Boolean; + +//***** GL_EXT_fog_coord *****// +const + GL_FOG_COORDINATE_SOURCE_EXT = $8450; + GL_FOG_COORDINATE_EXT = $8451; + GL_FRAGMENT_DEPTH_EXT = $8452; + GL_CURRENT_FOG_COORDINATE_EXT = $8453; + GL_FOG_COORDINATE_ARRAY_TYPE_EXT = $8454; + GL_FOG_COORDINATE_ARRAY_STRIDE_EXT = $8455; + GL_FOG_COORDINATE_ARRAY_POINTER_EXT = $8456; + GL_FOG_COORDINATE_ARRAY_EXT = $8457; +var + glFogCoordfEXT: procedure(coord: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoorddEXT: procedure(coord: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoordfvEXT: procedure(coord: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoorddvEXT: procedure(coord: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoordPointerEXT: procedure(_type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_fog_coord: Boolean; + +//***** GL_NV_fragment_program_option *****// + +function Load_GL_NV_fragment_program_option: Boolean; + +//***** GL_EXT_pixel_buffer_object *****// +const + GL_PIXEL_PACK_BUFFER_EXT = $88EB; + GL_PIXEL_UNPACK_BUFFER_EXT = $88EC; + GL_PIXEL_PACK_BUFFER_BINDING_EXT = $88ED; + GL_PIXEL_UNPACK_BUFFER_BINDING_EXT = $88EF; + +function Load_GL_EXT_pixel_buffer_object: Boolean; + +//***** GL_NV_fragment_program2 *****// +const + GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV = $88F4; + GL_MAX_PROGRAM_CALL_DEPTH_NV = $88F5; + GL_MAX_PROGRAM_IF_DEPTH_NV = $88F6; + GL_MAX_PROGRAM_LOOP_DEPTH_NV = $88F7; + GL_MAX_PROGRAM_LOOP_COUNT_NV = $88F8; + +function Load_GL_NV_fragment_program2: Boolean; + +//***** GL_NV_vertex_program2_option *****// + // GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV { already defined } + // GL_MAX_PROGRAM_CALL_DEPTH_NV { already defined } + +function Load_GL_NV_vertex_program2_option: Boolean; + +//***** GL_NV_vertex_program3 *****// + // GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB { already defined } + +function Load_GL_NV_vertex_program3: Boolean; + +implementation + +uses + sdl; + +function glext_ExtensionSupported(const extension: PChar; const searchIn: PChar): Boolean; +var + extensions: PChar; + start: PChar; + where, terminator: PChar; +begin + + if (Pos(' ', extension) <> 0) or (extension = '') then + begin + Result := FALSE; + Exit; + end; + + if searchIn = '' then + extensions := glGetString(GL_EXTENSIONS) + else + //StrLCopy( extensions, searchIn, StrLen(searchIn)+1 ); + extensions := searchIn; + start := extensions; + while TRUE do + begin + where := StrPos(start, extension ); + if where = nil then Break; + terminator := Pointer(Integer(where) + Integer( strlen( extension ) ) ); + if (where = start) or (PChar(Integer(where) - 1)^ = ' ') then + begin + if (terminator^ = ' ') or (terminator^ = #0) then + begin + Result := TRUE; + Exit; + end; + end; + start := terminator; + end; + Result := FALSE; + +end; + +function Load_GL_version_1_2: Boolean; +{var + extstring : PChar;} +begin + + Result := FALSE; + //extstring := glGetString( GL_EXTENSIONS ); + + @glCopyTexSubImage3D := SDL_GL_GetProcAddress('glCopyTexSubImage3D'); + if not Assigned(glCopyTexSubImage3D) then Exit; + @glDrawRangeElements := SDL_GL_GetProcAddress('glDrawRangeElements'); + if not Assigned(glDrawRangeElements) then Exit; + @glTexImage3D := SDL_GL_GetProcAddress('glTexImage3D'); + if not Assigned(glTexImage3D) then Exit; + @glTexSubImage3D := SDL_GL_GetProcAddress('glTexSubImage3D'); + if not Assigned(glTexSubImage3D) then Exit; + + Result := TRUE; + +end; + +function Load_GL_ARB_imaging: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_imaging', extstring) then + begin + @glColorTable := SDL_GL_GetProcAddress('glColorTable'); + if not Assigned(glColorTable) then Exit; + @glColorTableParameterfv := SDL_GL_GetProcAddress('glColorTableParameterfv'); + if not Assigned(glColorTableParameterfv) then Exit; + @glColorTableParameteriv := SDL_GL_GetProcAddress('glColorTableParameteriv'); + if not Assigned(glColorTableParameteriv) then Exit; + @glCopyColorTable := SDL_GL_GetProcAddress('glCopyColorTable'); + if not Assigned(glCopyColorTable) then Exit; + @glGetColorTable := SDL_GL_GetProcAddress('glGetColorTable'); + if not Assigned(glGetColorTable) then Exit; + @glGetColorTableParameterfv := SDL_GL_GetProcAddress('glGetColorTableParameterfv'); + if not Assigned(glGetColorTableParameterfv) then Exit; + @glGetColorTableParameteriv := SDL_GL_GetProcAddress('glGetColorTableParameteriv'); + if not Assigned(glGetColorTableParameteriv) then Exit; + @glColorSubTable := SDL_GL_GetProcAddress('glColorSubTable'); + if not Assigned(glColorSubTable) then Exit; + @glCopyColorSubTable := SDL_GL_GetProcAddress('glCopyColorSubTable'); + if not Assigned(glCopyColorSubTable) then Exit; + @glConvolutionFilter1D := SDL_GL_GetProcAddress('glConvolutionFilter1D'); + if not Assigned(glConvolutionFilter1D) then Exit; + @glConvolutionFilter2D := SDL_GL_GetProcAddress('glConvolutionFilter2D'); + if not Assigned(glConvolutionFilter2D) then Exit; + @glConvolutionParameterf := SDL_GL_GetProcAddress('glConvolutionParameterf'); + if not Assigned(glConvolutionParameterf) then Exit; + @glConvolutionParameterfv := SDL_GL_GetProcAddress('glConvolutionParameterfv'); + if not Assigned(glConvolutionParameterfv) then Exit; + @glConvolutionParameteri := SDL_GL_GetProcAddress('glConvolutionParameteri'); + if not Assigned(glConvolutionParameteri) then Exit; + @glConvolutionParameteriv := SDL_GL_GetProcAddress('glConvolutionParameteriv'); + if not Assigned(glConvolutionParameteriv) then Exit; + @glCopyConvolutionFilter1D := SDL_GL_GetProcAddress('glCopyConvolutionFilter1D'); + if not Assigned(glCopyConvolutionFilter1D) then Exit; + @glCopyConvolutionFilter2D := SDL_GL_GetProcAddress('glCopyConvolutionFilter2D'); + if not Assigned(glCopyConvolutionFilter2D) then Exit; + @glGetConvolutionFilter := SDL_GL_GetProcAddress('glGetConvolutionFilter'); + if not Assigned(glGetConvolutionFilter) then Exit; + @glGetConvolutionParameterfv := SDL_GL_GetProcAddress('glGetConvolutionParameterfv'); + if not Assigned(glGetConvolutionParameterfv) then Exit; + @glGetConvolutionParameteriv := SDL_GL_GetProcAddress('glGetConvolutionParameteriv'); + if not Assigned(glGetConvolutionParameteriv) then Exit; + @glGetSeparableFilter := SDL_GL_GetProcAddress('glGetSeparableFilter'); + if not Assigned(glGetSeparableFilter) then Exit; + @glSeparableFilter2D := SDL_GL_GetProcAddress('glSeparableFilter2D'); + if not Assigned(glSeparableFilter2D) then Exit; + @glGetHistogram := SDL_GL_GetProcAddress('glGetHistogram'); + if not Assigned(glGetHistogram) then Exit; + @glGetHistogramParameterfv := SDL_GL_GetProcAddress('glGetHistogramParameterfv'); + if not Assigned(glGetHistogramParameterfv) then Exit; + @glGetHistogramParameteriv := SDL_GL_GetProcAddress('glGetHistogramParameteriv'); + if not Assigned(glGetHistogramParameteriv) then Exit; + @glGetMinmax := SDL_GL_GetProcAddress('glGetMinmax'); + if not Assigned(glGetMinmax) then Exit; + @glGetMinmaxParameterfv := SDL_GL_GetProcAddress('glGetMinmaxParameterfv'); + if not Assigned(glGetMinmaxParameterfv) then Exit; + @glGetMinmaxParameteriv := SDL_GL_GetProcAddress('glGetMinmaxParameteriv'); + if not Assigned(glGetMinmaxParameteriv) then Exit; + @glHistogram := SDL_GL_GetProcAddress('glHistogram'); + if not Assigned(glHistogram) then Exit; + @glMinmax := SDL_GL_GetProcAddress('glMinmax'); + if not Assigned(glMinmax) then Exit; + @glResetHistogram := SDL_GL_GetProcAddress('glResetHistogram'); + if not Assigned(glResetHistogram) then Exit; + @glResetMinmax := SDL_GL_GetProcAddress('glResetMinmax'); + if not Assigned(glResetMinmax) then Exit; + @glBlendEquation := SDL_GL_GetProcAddress('glBlendEquation'); + if not Assigned(glBlendEquation) then Exit; + @glBlendColor := SDL_GL_GetProcAddress('glBlendColor'); + if not Assigned(glBlendColor) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_version_1_3: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + @glActiveTexture := SDL_GL_GetProcAddress('glActiveTexture'); + if not Assigned(glActiveTexture) then Exit; + @glClientActiveTexture := SDL_GL_GetProcAddress('glClientActiveTexture'); + if not Assigned(glClientActiveTexture) then Exit; + @glMultiTexCoord1d := SDL_GL_GetProcAddress('glMultiTexCoord1d'); + if not Assigned(glMultiTexCoord1d) then Exit; + @glMultiTexCoord1dv := SDL_GL_GetProcAddress('glMultiTexCoord1dv'); + if not Assigned(glMultiTexCoord1dv) then Exit; + @glMultiTexCoord1f := SDL_GL_GetProcAddress('glMultiTexCoord1f'); + if not Assigned(glMultiTexCoord1f) then Exit; + @glMultiTexCoord1fv := SDL_GL_GetProcAddress('glMultiTexCoord1fv'); + if not Assigned(glMultiTexCoord1fv) then Exit; + @glMultiTexCoord1i := SDL_GL_GetProcAddress('glMultiTexCoord1i'); + if not Assigned(glMultiTexCoord1i) then Exit; + @glMultiTexCoord1iv := SDL_GL_GetProcAddress('glMultiTexCoord1iv'); + if not Assigned(glMultiTexCoord1iv) then Exit; + @glMultiTexCoord1s := SDL_GL_GetProcAddress('glMultiTexCoord1s'); + if not Assigned(glMultiTexCoord1s) then Exit; + @glMultiTexCoord1sv := SDL_GL_GetProcAddress('glMultiTexCoord1sv'); + if not Assigned(glMultiTexCoord1sv) then Exit; + @glMultiTexCoord2d := SDL_GL_GetProcAddress('glMultiTexCoord2d'); + if not Assigned(glMultiTexCoord2d) then Exit; + @glMultiTexCoord2dv := SDL_GL_GetProcAddress('glMultiTexCoord2dv'); + if not Assigned(glMultiTexCoord2dv) then Exit; + @glMultiTexCoord2f := SDL_GL_GetProcAddress('glMultiTexCoord2f'); + if not Assigned(glMultiTexCoord2f) then Exit; + @glMultiTexCoord2fv := SDL_GL_GetProcAddress('glMultiTexCoord2fv'); + if not Assigned(glMultiTexCoord2fv) then Exit; + @glMultiTexCoord2i := SDL_GL_GetProcAddress('glMultiTexCoord2i'); + if not Assigned(glMultiTexCoord2i) then Exit; + @glMultiTexCoord2iv := SDL_GL_GetProcAddress('glMultiTexCoord2iv'); + if not Assigned(glMultiTexCoord2iv) then Exit; + @glMultiTexCoord2s := SDL_GL_GetProcAddress('glMultiTexCoord2s'); + if not Assigned(glMultiTexCoord2s) then Exit; + @glMultiTexCoord2sv := SDL_GL_GetProcAddress('glMultiTexCoord2sv'); + if not Assigned(glMultiTexCoord2sv) then Exit; + @glMultiTexCoord3d := SDL_GL_GetProcAddress('glMultiTexCoord3d'); + if not Assigned(glMultiTexCoord3d) then Exit; + @glMultiTexCoord3dv := SDL_GL_GetProcAddress('glMultiTexCoord3dv'); + if not Assigned(glMultiTexCoord3dv) then Exit; + @glMultiTexCoord3f := SDL_GL_GetProcAddress('glMultiTexCoord3f'); + if not Assigned(glMultiTexCoord3f) then Exit; + @glMultiTexCoord3fv := SDL_GL_GetProcAddress('glMultiTexCoord3fv'); + if not Assigned(glMultiTexCoord3fv) then Exit; + @glMultiTexCoord3i := SDL_GL_GetProcAddress('glMultiTexCoord3i'); + if not Assigned(glMultiTexCoord3i) then Exit; + @glMultiTexCoord3iv := SDL_GL_GetProcAddress('glMultiTexCoord3iv'); + if not Assigned(glMultiTexCoord3iv) then Exit; + @glMultiTexCoord3s := SDL_GL_GetProcAddress('glMultiTexCoord3s'); + if not Assigned(glMultiTexCoord3s) then Exit; + @glMultiTexCoord3sv := SDL_GL_GetProcAddress('glMultiTexCoord3sv'); + if not Assigned(glMultiTexCoord3sv) then Exit; + @glMultiTexCoord4d := SDL_GL_GetProcAddress('glMultiTexCoord4d'); + if not Assigned(glMultiTexCoord4d) then Exit; + @glMultiTexCoord4dv := SDL_GL_GetProcAddress('glMultiTexCoord4dv'); + if not Assigned(glMultiTexCoord4dv) then Exit; + @glMultiTexCoord4f := SDL_GL_GetProcAddress('glMultiTexCoord4f'); + if not Assigned(glMultiTexCoord4f) then Exit; + @glMultiTexCoord4fv := SDL_GL_GetProcAddress('glMultiTexCoord4fv'); + if not Assigned(glMultiTexCoord4fv) then Exit; + @glMultiTexCoord4i := SDL_GL_GetProcAddress('glMultiTexCoord4i'); + if not Assigned(glMultiTexCoord4i) then Exit; + @glMultiTexCoord4iv := SDL_GL_GetProcAddress('glMultiTexCoord4iv'); + if not Assigned(glMultiTexCoord4iv) then Exit; + @glMultiTexCoord4s := SDL_GL_GetProcAddress('glMultiTexCoord4s'); + if not Assigned(glMultiTexCoord4s) then Exit; + @glMultiTexCoord4sv := SDL_GL_GetProcAddress('glMultiTexCoord4sv'); + if not Assigned(glMultiTexCoord4sv) then Exit; + @glLoadTransposeMatrixf := SDL_GL_GetProcAddress('glLoadTransposeMatrixf'); + if not Assigned(glLoadTransposeMatrixf) then Exit; + @glLoadTransposeMatrixd := SDL_GL_GetProcAddress('glLoadTransposeMatrixd'); + if not Assigned(glLoadTransposeMatrixd) then Exit; + @glMultTransposeMatrixf := SDL_GL_GetProcAddress('glMultTransposeMatrixf'); + if not Assigned(glMultTransposeMatrixf) then Exit; + @glMultTransposeMatrixd := SDL_GL_GetProcAddress('glMultTransposeMatrixd'); + if not Assigned(glMultTransposeMatrixd) then Exit; + @glSampleCoverage := SDL_GL_GetProcAddress('glSampleCoverage'); + if not Assigned(glSampleCoverage) then Exit; + @glCompressedTexImage3D := SDL_GL_GetProcAddress('glCompressedTexImage3D'); + if not Assigned(glCompressedTexImage3D) then Exit; + @glCompressedTexImage2D := SDL_GL_GetProcAddress('glCompressedTexImage2D'); + if not Assigned(glCompressedTexImage2D) then Exit; + @glCompressedTexImage1D := SDL_GL_GetProcAddress('glCompressedTexImage1D'); + if not Assigned(glCompressedTexImage1D) then Exit; + @glCompressedTexSubImage3D := SDL_GL_GetProcAddress('glCompressedTexSubImage3D'); + if not Assigned(glCompressedTexSubImage3D) then Exit; + @glCompressedTexSubImage2D := SDL_GL_GetProcAddress('glCompressedTexSubImage2D'); + if not Assigned(glCompressedTexSubImage2D) then Exit; + @glCompressedTexSubImage1D := SDL_GL_GetProcAddress('glCompressedTexSubImage1D'); + if not Assigned(glCompressedTexSubImage1D) then Exit; + @glGetCompressedTexImage := SDL_GL_GetProcAddress('glGetCompressedTexImage'); + if not Assigned(glGetCompressedTexImage) then Exit; + Result := TRUE; + +end; + +function Load_GL_ARB_multitexture: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_multitexture', extstring) then + begin + @glActiveTextureARB := SDL_GL_GetProcAddress('glActiveTextureARB'); + if not Assigned(glActiveTextureARB) then Exit; + @glClientActiveTextureARB := SDL_GL_GetProcAddress('glClientActiveTextureARB'); + if not Assigned(glClientActiveTextureARB) then Exit; + @glMultiTexCoord1dARB := SDL_GL_GetProcAddress('glMultiTexCoord1dARB'); + if not Assigned(glMultiTexCoord1dARB) then Exit; + @glMultiTexCoord1dvARB := SDL_GL_GetProcAddress('glMultiTexCoord1dvARB'); + if not Assigned(glMultiTexCoord1dvARB) then Exit; + @glMultiTexCoord1fARB := SDL_GL_GetProcAddress('glMultiTexCoord1fARB'); + if not Assigned(glMultiTexCoord1fARB) then Exit; + @glMultiTexCoord1fvARB := SDL_GL_GetProcAddress('glMultiTexCoord1fvARB'); + if not Assigned(glMultiTexCoord1fvARB) then Exit; + @glMultiTexCoord1iARB := SDL_GL_GetProcAddress('glMultiTexCoord1iARB'); + if not Assigned(glMultiTexCoord1iARB) then Exit; + @glMultiTexCoord1ivARB := SDL_GL_GetProcAddress('glMultiTexCoord1ivARB'); + if not Assigned(glMultiTexCoord1ivARB) then Exit; + @glMultiTexCoord1sARB := SDL_GL_GetProcAddress('glMultiTexCoord1sARB'); + if not Assigned(glMultiTexCoord1sARB) then Exit; + @glMultiTexCoord1svARB := SDL_GL_GetProcAddress('glMultiTexCoord1svARB'); + if not Assigned(glMultiTexCoord1svARB) then Exit; + @glMultiTexCoord2dARB := SDL_GL_GetProcAddress('glMultiTexCoord2dARB'); + if not Assigned(glMultiTexCoord2dARB) then Exit; + @glMultiTexCoord2dvARB := SDL_GL_GetProcAddress('glMultiTexCoord2dvARB'); + if not Assigned(glMultiTexCoord2dvARB) then Exit; + @glMultiTexCoord2fARB := SDL_GL_GetProcAddress('glMultiTexCoord2fARB'); + if not Assigned(glMultiTexCoord2fARB) then Exit; + @glMultiTexCoord2fvARB := SDL_GL_GetProcAddress('glMultiTexCoord2fvARB'); + if not Assigned(glMultiTexCoord2fvARB) then Exit; + @glMultiTexCoord2iARB := SDL_GL_GetProcAddress('glMultiTexCoord2iARB'); + if not Assigned(glMultiTexCoord2iARB) then Exit; + @glMultiTexCoord2ivARB := SDL_GL_GetProcAddress('glMultiTexCoord2ivARB'); + if not Assigned(glMultiTexCoord2ivARB) then Exit; + @glMultiTexCoord2sARB := SDL_GL_GetProcAddress('glMultiTexCoord2sARB'); + if not Assigned(glMultiTexCoord2sARB) then Exit; + @glMultiTexCoord2svARB := SDL_GL_GetProcAddress('glMultiTexCoord2svARB'); + if not Assigned(glMultiTexCoord2svARB) then Exit; + @glMultiTexCoord3dARB := SDL_GL_GetProcAddress('glMultiTexCoord3dARB'); + if not Assigned(glMultiTexCoord3dARB) then Exit; + @glMultiTexCoord3dvARB := SDL_GL_GetProcAddress('glMultiTexCoord3dvARB'); + if not Assigned(glMultiTexCoord3dvARB) then Exit; + @glMultiTexCoord3fARB := SDL_GL_GetProcAddress('glMultiTexCoord3fARB'); + if not Assigned(glMultiTexCoord3fARB) then Exit; + @glMultiTexCoord3fvARB := SDL_GL_GetProcAddress('glMultiTexCoord3fvARB'); + if not Assigned(glMultiTexCoord3fvARB) then Exit; + @glMultiTexCoord3iARB := SDL_GL_GetProcAddress('glMultiTexCoord3iARB'); + if not Assigned(glMultiTexCoord3iARB) then Exit; + @glMultiTexCoord3ivARB := SDL_GL_GetProcAddress('glMultiTexCoord3ivARB'); + if not Assigned(glMultiTexCoord3ivARB) then Exit; + @glMultiTexCoord3sARB := SDL_GL_GetProcAddress('glMultiTexCoord3sARB'); + if not Assigned(glMultiTexCoord3sARB) then Exit; + @glMultiTexCoord3svARB := SDL_GL_GetProcAddress('glMultiTexCoord3svARB'); + if not Assigned(glMultiTexCoord3svARB) then Exit; + @glMultiTexCoord4dARB := SDL_GL_GetProcAddress('glMultiTexCoord4dARB'); + if not Assigned(glMultiTexCoord4dARB) then Exit; + @glMultiTexCoord4dvARB := SDL_GL_GetProcAddress('glMultiTexCoord4dvARB'); + if not Assigned(glMultiTexCoord4dvARB) then Exit; + @glMultiTexCoord4fARB := SDL_GL_GetProcAddress('glMultiTexCoord4fARB'); + if not Assigned(glMultiTexCoord4fARB) then Exit; + @glMultiTexCoord4fvARB := SDL_GL_GetProcAddress('glMultiTexCoord4fvARB'); + if not Assigned(glMultiTexCoord4fvARB) then Exit; + @glMultiTexCoord4iARB := SDL_GL_GetProcAddress('glMultiTexCoord4iARB'); + if not Assigned(glMultiTexCoord4iARB) then Exit; + @glMultiTexCoord4ivARB := SDL_GL_GetProcAddress('glMultiTexCoord4ivARB'); + if not Assigned(glMultiTexCoord4ivARB) then Exit; + @glMultiTexCoord4sARB := SDL_GL_GetProcAddress('glMultiTexCoord4sARB'); + if not Assigned(glMultiTexCoord4sARB) then Exit; + @glMultiTexCoord4svARB := SDL_GL_GetProcAddress('glMultiTexCoord4svARB'); + if not Assigned(glMultiTexCoord4svARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_transpose_matrix: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_transpose_matrix', extstring) then + begin + @glLoadTransposeMatrixfARB := SDL_GL_GetProcAddress('glLoadTransposeMatrixfARB'); + if not Assigned(glLoadTransposeMatrixfARB) then Exit; + @glLoadTransposeMatrixdARB := SDL_GL_GetProcAddress('glLoadTransposeMatrixdARB'); + if not Assigned(glLoadTransposeMatrixdARB) then Exit; + @glMultTransposeMatrixfARB := SDL_GL_GetProcAddress('glMultTransposeMatrixfARB'); + if not Assigned(glMultTransposeMatrixfARB) then Exit; + @glMultTransposeMatrixdARB := SDL_GL_GetProcAddress('glMultTransposeMatrixdARB'); + if not Assigned(glMultTransposeMatrixdARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_multisample: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_multisample', extstring) then + begin + @glSampleCoverageARB := SDL_GL_GetProcAddress('glSampleCoverageARB'); + if not Assigned(glSampleCoverageARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_texture_env_add: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_texture_env_add', extstring) then + begin + Result := TRUE; + end; + +end; + +{$IFDEF Win32} +function Load_WGL_ARB_extensions_string: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_ARB_extensions_string', extstring) then + begin + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_ARB_buffer_region: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_ARB_buffer_region', extstring) then + begin + @wglCreateBufferRegionARB := SDL_GL_GetProcAddress('wglCreateBufferRegionARB'); + if not Assigned(wglCreateBufferRegionARB) then Exit; + @wglDeleteBufferRegionARB := SDL_GL_GetProcAddress('wglDeleteBufferRegionARB'); + if not Assigned(wglDeleteBufferRegionARB) then Exit; + @wglSaveBufferRegionARB := SDL_GL_GetProcAddress('wglSaveBufferRegionARB'); + if not Assigned(wglSaveBufferRegionARB) then Exit; + @wglRestoreBufferRegionARB := SDL_GL_GetProcAddress('wglRestoreBufferRegionARB'); + if not Assigned(wglRestoreBufferRegionARB) then Exit; + Result := TRUE; + end; + +end; +{$ENDIF} + +function Load_GL_ARB_texture_cube_map: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_texture_cube_map', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_depth_texture: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_depth_texture', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_point_parameters: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_point_parameters', extstring) then + begin + @glPointParameterfARB := SDL_GL_GetProcAddress('glPointParameterfARB'); + if not Assigned(glPointParameterfARB) then Exit; + @glPointParameterfvARB := SDL_GL_GetProcAddress('glPointParameterfvARB'); + if not Assigned(glPointParameterfvARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_shadow: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_shadow', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_shadow_ambient: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_shadow_ambient', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_texture_border_clamp: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_texture_border_clamp', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_texture_compression: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_texture_compression', extstring) then + begin + @glCompressedTexImage3DARB := SDL_GL_GetProcAddress('glCompressedTexImage3DARB'); + if not Assigned(glCompressedTexImage3DARB) then Exit; + @glCompressedTexImage2DARB := SDL_GL_GetProcAddress('glCompressedTexImage2DARB'); + if not Assigned(glCompressedTexImage2DARB) then Exit; + @glCompressedTexImage1DARB := SDL_GL_GetProcAddress('glCompressedTexImage1DARB'); + if not Assigned(glCompressedTexImage1DARB) then Exit; + @glCompressedTexSubImage3DARB := SDL_GL_GetProcAddress('glCompressedTexSubImage3DARB'); + if not Assigned(glCompressedTexSubImage3DARB) then Exit; + @glCompressedTexSubImage2DARB := SDL_GL_GetProcAddress('glCompressedTexSubImage2DARB'); + if not Assigned(glCompressedTexSubImage2DARB) then Exit; + @glCompressedTexSubImage1DARB := SDL_GL_GetProcAddress('glCompressedTexSubImage1DARB'); + if not Assigned(glCompressedTexSubImage1DARB) then Exit; + @glGetCompressedTexImageARB := SDL_GL_GetProcAddress('glGetCompressedTexImageARB'); + if not Assigned(glGetCompressedTexImageARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_texture_env_combine: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_texture_env_combine', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_texture_env_crossbar: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_texture_env_crossbar', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_texture_env_dot3: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_texture_env_dot3', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_texture_mirrored_repeat: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_texture_mirrored_repeat', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_vertex_blend: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_vertex_blend', extstring) then + begin + @glWeightbvARB := SDL_GL_GetProcAddress('glWeightbvARB'); + if not Assigned(glWeightbvARB) then Exit; + @glWeightsvARB := SDL_GL_GetProcAddress('glWeightsvARB'); + if not Assigned(glWeightsvARB) then Exit; + @glWeightivARB := SDL_GL_GetProcAddress('glWeightivARB'); + if not Assigned(glWeightivARB) then Exit; + @glWeightfvARB := SDL_GL_GetProcAddress('glWeightfvARB'); + if not Assigned(glWeightfvARB) then Exit; + @glWeightdvARB := SDL_GL_GetProcAddress('glWeightdvARB'); + if not Assigned(glWeightdvARB) then Exit; + @glWeightvARB := SDL_GL_GetProcAddress('glWeightvARB'); + if not Assigned(glWeightvARB) then Exit; + @glWeightubvARB := SDL_GL_GetProcAddress('glWeightubvARB'); + if not Assigned(glWeightubvARB) then Exit; + @glWeightusvARB := SDL_GL_GetProcAddress('glWeightusvARB'); + if not Assigned(glWeightusvARB) then Exit; + @glWeightuivARB := SDL_GL_GetProcAddress('glWeightuivARB'); + if not Assigned(glWeightuivARB) then Exit; + @glWeightPointerARB := SDL_GL_GetProcAddress('glWeightPointerARB'); + if not Assigned(glWeightPointerARB) then Exit; + @glVertexBlendARB := SDL_GL_GetProcAddress('glVertexBlendARB'); + if not Assigned(glVertexBlendARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_vertex_program: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_vertex_program', extstring) then + begin + @glVertexAttrib1sARB := SDL_GL_GetProcAddress('glVertexAttrib1sARB'); + if not Assigned(glVertexAttrib1sARB) then Exit; + @glVertexAttrib1fARB := SDL_GL_GetProcAddress('glVertexAttrib1fARB'); + if not Assigned(glVertexAttrib1fARB) then Exit; + @glVertexAttrib1dARB := SDL_GL_GetProcAddress('glVertexAttrib1dARB'); + if not Assigned(glVertexAttrib1dARB) then Exit; + @glVertexAttrib2sARB := SDL_GL_GetProcAddress('glVertexAttrib2sARB'); + if not Assigned(glVertexAttrib2sARB) then Exit; + @glVertexAttrib2fARB := SDL_GL_GetProcAddress('glVertexAttrib2fARB'); + if not Assigned(glVertexAttrib2fARB) then Exit; + @glVertexAttrib2dARB := SDL_GL_GetProcAddress('glVertexAttrib2dARB'); + if not Assigned(glVertexAttrib2dARB) then Exit; + @glVertexAttrib3sARB := SDL_GL_GetProcAddress('glVertexAttrib3sARB'); + if not Assigned(glVertexAttrib3sARB) then Exit; + @glVertexAttrib3fARB := SDL_GL_GetProcAddress('glVertexAttrib3fARB'); + if not Assigned(glVertexAttrib3fARB) then Exit; + @glVertexAttrib3dARB := SDL_GL_GetProcAddress('glVertexAttrib3dARB'); + if not Assigned(glVertexAttrib3dARB) then Exit; + @glVertexAttrib4sARB := SDL_GL_GetProcAddress('glVertexAttrib4sARB'); + if not Assigned(glVertexAttrib4sARB) then Exit; + @glVertexAttrib4fARB := SDL_GL_GetProcAddress('glVertexAttrib4fARB'); + if not Assigned(glVertexAttrib4fARB) then Exit; + @glVertexAttrib4dARB := SDL_GL_GetProcAddress('glVertexAttrib4dARB'); + if not Assigned(glVertexAttrib4dARB) then Exit; + @glVertexAttrib4NubARB := SDL_GL_GetProcAddress('glVertexAttrib4NubARB'); + if not Assigned(glVertexAttrib4NubARB) then Exit; + @glVertexAttrib1svARB := SDL_GL_GetProcAddress('glVertexAttrib1svARB'); + if not Assigned(glVertexAttrib1svARB) then Exit; + @glVertexAttrib1fvARB := SDL_GL_GetProcAddress('glVertexAttrib1fvARB'); + if not Assigned(glVertexAttrib1fvARB) then Exit; + @glVertexAttrib1dvARB := SDL_GL_GetProcAddress('glVertexAttrib1dvARB'); + if not Assigned(glVertexAttrib1dvARB) then Exit; + @glVertexAttrib2svARB := SDL_GL_GetProcAddress('glVertexAttrib2svARB'); + if not Assigned(glVertexAttrib2svARB) then Exit; + @glVertexAttrib2fvARB := SDL_GL_GetProcAddress('glVertexAttrib2fvARB'); + if not Assigned(glVertexAttrib2fvARB) then Exit; + @glVertexAttrib2dvARB := SDL_GL_GetProcAddress('glVertexAttrib2dvARB'); + if not Assigned(glVertexAttrib2dvARB) then Exit; + @glVertexAttrib3svARB := SDL_GL_GetProcAddress('glVertexAttrib3svARB'); + if not Assigned(glVertexAttrib3svARB) then Exit; + @glVertexAttrib3fvARB := SDL_GL_GetProcAddress('glVertexAttrib3fvARB'); + if not Assigned(glVertexAttrib3fvARB) then Exit; + @glVertexAttrib3dvARB := SDL_GL_GetProcAddress('glVertexAttrib3dvARB'); + if not Assigned(glVertexAttrib3dvARB) then Exit; + @glVertexAttrib4bvARB := SDL_GL_GetProcAddress('glVertexAttrib4bvARB'); + if not Assigned(glVertexAttrib4bvARB) then Exit; + @glVertexAttrib4svARB := SDL_GL_GetProcAddress('glVertexAttrib4svARB'); + if not Assigned(glVertexAttrib4svARB) then Exit; + @glVertexAttrib4ivARB := SDL_GL_GetProcAddress('glVertexAttrib4ivARB'); + if not Assigned(glVertexAttrib4ivARB) then Exit; + @glVertexAttrib4ubvARB := SDL_GL_GetProcAddress('glVertexAttrib4ubvARB'); + if not Assigned(glVertexAttrib4ubvARB) then Exit; + @glVertexAttrib4usvARB := SDL_GL_GetProcAddress('glVertexAttrib4usvARB'); + if not Assigned(glVertexAttrib4usvARB) then Exit; + @glVertexAttrib4uivARB := SDL_GL_GetProcAddress('glVertexAttrib4uivARB'); + if not Assigned(glVertexAttrib4uivARB) then Exit; + @glVertexAttrib4fvARB := SDL_GL_GetProcAddress('glVertexAttrib4fvARB'); + if not Assigned(glVertexAttrib4fvARB) then Exit; + @glVertexAttrib4dvARB := SDL_GL_GetProcAddress('glVertexAttrib4dvARB'); + if not Assigned(glVertexAttrib4dvARB) then Exit; + @glVertexAttrib4NbvARB := SDL_GL_GetProcAddress('glVertexAttrib4NbvARB'); + if not Assigned(glVertexAttrib4NbvARB) then Exit; + @glVertexAttrib4NsvARB := SDL_GL_GetProcAddress('glVertexAttrib4NsvARB'); + if not Assigned(glVertexAttrib4NsvARB) then Exit; + @glVertexAttrib4NivARB := SDL_GL_GetProcAddress('glVertexAttrib4NivARB'); + if not Assigned(glVertexAttrib4NivARB) then Exit; + @glVertexAttrib4NubvARB := SDL_GL_GetProcAddress('glVertexAttrib4NubvARB'); + if not Assigned(glVertexAttrib4NubvARB) then Exit; + @glVertexAttrib4NusvARB := SDL_GL_GetProcAddress('glVertexAttrib4NusvARB'); + if not Assigned(glVertexAttrib4NusvARB) then Exit; + @glVertexAttrib4NuivARB := SDL_GL_GetProcAddress('glVertexAttrib4NuivARB'); + if not Assigned(glVertexAttrib4NuivARB) then Exit; + @glVertexAttribPointerARB := SDL_GL_GetProcAddress('glVertexAttribPointerARB'); + if not Assigned(glVertexAttribPointerARB) then Exit; + @glEnableVertexAttribArrayARB := SDL_GL_GetProcAddress('glEnableVertexAttribArrayARB'); + if not Assigned(glEnableVertexAttribArrayARB) then Exit; + @glDisableVertexAttribArrayARB := SDL_GL_GetProcAddress('glDisableVertexAttribArrayARB'); + if not Assigned(glDisableVertexAttribArrayARB) then Exit; + @glProgramStringARB := SDL_GL_GetProcAddress('glProgramStringARB'); + if not Assigned(glProgramStringARB) then Exit; + @glBindProgramARB := SDL_GL_GetProcAddress('glBindProgramARB'); + if not Assigned(glBindProgramARB) then Exit; + @glDeleteProgramsARB := SDL_GL_GetProcAddress('glDeleteProgramsARB'); + if not Assigned(glDeleteProgramsARB) then Exit; + @glGenProgramsARB := SDL_GL_GetProcAddress('glGenProgramsARB'); + if not Assigned(glGenProgramsARB) then Exit; + @glProgramEnvParameter4dARB := SDL_GL_GetProcAddress('glProgramEnvParameter4dARB'); + if not Assigned(glProgramEnvParameter4dARB) then Exit; + @glProgramEnvParameter4dvARB := SDL_GL_GetProcAddress('glProgramEnvParameter4dvARB'); + if not Assigned(glProgramEnvParameter4dvARB) then Exit; + @glProgramEnvParameter4fARB := SDL_GL_GetProcAddress('glProgramEnvParameter4fARB'); + if not Assigned(glProgramEnvParameter4fARB) then Exit; + @glProgramEnvParameter4fvARB := SDL_GL_GetProcAddress('glProgramEnvParameter4fvARB'); + if not Assigned(glProgramEnvParameter4fvARB) then Exit; + @glProgramLocalParameter4dARB := SDL_GL_GetProcAddress('glProgramLocalParameter4dARB'); + if not Assigned(glProgramLocalParameter4dARB) then Exit; + @glProgramLocalParameter4dvARB := SDL_GL_GetProcAddress('glProgramLocalParameter4dvARB'); + if not Assigned(glProgramLocalParameter4dvARB) then Exit; + @glProgramLocalParameter4fARB := SDL_GL_GetProcAddress('glProgramLocalParameter4fARB'); + if not Assigned(glProgramLocalParameter4fARB) then Exit; + @glProgramLocalParameter4fvARB := SDL_GL_GetProcAddress('glProgramLocalParameter4fvARB'); + if not Assigned(glProgramLocalParameter4fvARB) then Exit; + @glGetProgramEnvParameterdvARB := SDL_GL_GetProcAddress('glGetProgramEnvParameterdvARB'); + if not Assigned(glGetProgramEnvParameterdvARB) then Exit; + @glGetProgramEnvParameterfvARB := SDL_GL_GetProcAddress('glGetProgramEnvParameterfvARB'); + if not Assigned(glGetProgramEnvParameterfvARB) then Exit; + @glGetProgramLocalParameterdvARB := SDL_GL_GetProcAddress('glGetProgramLocalParameterdvARB'); + if not Assigned(glGetProgramLocalParameterdvARB) then Exit; + @glGetProgramLocalParameterfvARB := SDL_GL_GetProcAddress('glGetProgramLocalParameterfvARB'); + if not Assigned(glGetProgramLocalParameterfvARB) then Exit; + @glGetProgramivARB := SDL_GL_GetProcAddress('glGetProgramivARB'); + if not Assigned(glGetProgramivARB) then Exit; + @glGetProgramStringARB := SDL_GL_GetProcAddress('glGetProgramStringARB'); + if not Assigned(glGetProgramStringARB) then Exit; + @glGetVertexAttribdvARB := SDL_GL_GetProcAddress('glGetVertexAttribdvARB'); + if not Assigned(glGetVertexAttribdvARB) then Exit; + @glGetVertexAttribfvARB := SDL_GL_GetProcAddress('glGetVertexAttribfvARB'); + if not Assigned(glGetVertexAttribfvARB) then Exit; + @glGetVertexAttribivARB := SDL_GL_GetProcAddress('glGetVertexAttribivARB'); + if not Assigned(glGetVertexAttribivARB) then Exit; + @glGetVertexAttribPointervARB := SDL_GL_GetProcAddress('glGetVertexAttribPointervARB'); + if not Assigned(glGetVertexAttribPointervARB) then Exit; + @glIsProgramARB := SDL_GL_GetProcAddress('glIsProgramARB'); + if not Assigned(glIsProgramARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_window_pos: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_window_pos', extstring) then + begin + @glWindowPos2dARB := SDL_GL_GetProcAddress('glWindowPos2dARB'); + if not Assigned(glWindowPos2dARB) then Exit; + @glWindowPos2fARB := SDL_GL_GetProcAddress('glWindowPos2fARB'); + if not Assigned(glWindowPos2fARB) then Exit; + @glWindowPos2iARB := SDL_GL_GetProcAddress('glWindowPos2iARB'); + if not Assigned(glWindowPos2iARB) then Exit; + @glWindowPos2sARB := SDL_GL_GetProcAddress('glWindowPos2sARB'); + if not Assigned(glWindowPos2sARB) then Exit; + @glWindowPos2dvARB := SDL_GL_GetProcAddress('glWindowPos2dvARB'); + if not Assigned(glWindowPos2dvARB) then Exit; + @glWindowPos2fvARB := SDL_GL_GetProcAddress('glWindowPos2fvARB'); + if not Assigned(glWindowPos2fvARB) then Exit; + @glWindowPos2ivARB := SDL_GL_GetProcAddress('glWindowPos2ivARB'); + if not Assigned(glWindowPos2ivARB) then Exit; + @glWindowPos2svARB := SDL_GL_GetProcAddress('glWindowPos2svARB'); + if not Assigned(glWindowPos2svARB) then Exit; + @glWindowPos3dARB := SDL_GL_GetProcAddress('glWindowPos3dARB'); + if not Assigned(glWindowPos3dARB) then Exit; + @glWindowPos3fARB := SDL_GL_GetProcAddress('glWindowPos3fARB'); + if not Assigned(glWindowPos3fARB) then Exit; + @glWindowPos3iARB := SDL_GL_GetProcAddress('glWindowPos3iARB'); + if not Assigned(glWindowPos3iARB) then Exit; + @glWindowPos3sARB := SDL_GL_GetProcAddress('glWindowPos3sARB'); + if not Assigned(glWindowPos3sARB) then Exit; + @glWindowPos3dvARB := SDL_GL_GetProcAddress('glWindowPos3dvARB'); + if not Assigned(glWindowPos3dvARB) then Exit; + @glWindowPos3fvARB := SDL_GL_GetProcAddress('glWindowPos3fvARB'); + if not Assigned(glWindowPos3fvARB) then Exit; + @glWindowPos3ivARB := SDL_GL_GetProcAddress('glWindowPos3ivARB'); + if not Assigned(glWindowPos3ivARB) then Exit; + @glWindowPos3svARB := SDL_GL_GetProcAddress('glWindowPos3svARB'); + if not Assigned(glWindowPos3svARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_422_pixels: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_422_pixels', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_abgr: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_abgr', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_bgra: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_bgra', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_blend_color: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_blend_color', extstring) then + begin + @glBlendColorEXT := SDL_GL_GetProcAddress('glBlendColorEXT'); + if not Assigned(glBlendColorEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_blend_func_separate: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_blend_func_separate', extstring) then + begin + @glBlendFuncSeparateEXT := SDL_GL_GetProcAddress('glBlendFuncSeparateEXT'); + if not Assigned(glBlendFuncSeparateEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_blend_logic_op: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_blend_logic_op', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_blend_minmax: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_blend_minmax', extstring) then + begin + @glBlendEquationEXT := SDL_GL_GetProcAddress('glBlendEquationEXT'); + if not Assigned(glBlendEquationEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_blend_subtract: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_blend_subtract', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_clip_volume_hint: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_clip_volume_hint', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_color_subtable: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_color_subtable', extstring) then + begin + @glColorSubTableEXT := SDL_GL_GetProcAddress('glColorSubTableEXT'); + if not Assigned(glColorSubTableEXT) then Exit; + @glCopyColorSubTableEXT := SDL_GL_GetProcAddress('glCopyColorSubTableEXT'); + if not Assigned(glCopyColorSubTableEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_compiled_vertex_array: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_compiled_vertex_array', extstring) then + begin + @glLockArraysEXT := SDL_GL_GetProcAddress('glLockArraysEXT'); + if not Assigned(glLockArraysEXT) then Exit; + @glUnlockArraysEXT := SDL_GL_GetProcAddress('glUnlockArraysEXT'); + if not Assigned(glUnlockArraysEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_convolution: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_convolution', extstring) then + begin + @glConvolutionFilter1DEXT := SDL_GL_GetProcAddress('glConvolutionFilter1DEXT'); + if not Assigned(glConvolutionFilter1DEXT) then Exit; + @glConvolutionFilter2DEXT := SDL_GL_GetProcAddress('glConvolutionFilter2DEXT'); + if not Assigned(glConvolutionFilter2DEXT) then Exit; + @glCopyConvolutionFilter1DEXT := SDL_GL_GetProcAddress('glCopyConvolutionFilter1DEXT'); + if not Assigned(glCopyConvolutionFilter1DEXT) then Exit; + @glCopyConvolutionFilter2DEXT := SDL_GL_GetProcAddress('glCopyConvolutionFilter2DEXT'); + if not Assigned(glCopyConvolutionFilter2DEXT) then Exit; + @glGetConvolutionFilterEXT := SDL_GL_GetProcAddress('glGetConvolutionFilterEXT'); + if not Assigned(glGetConvolutionFilterEXT) then Exit; + @glSeparableFilter2DEXT := SDL_GL_GetProcAddress('glSeparableFilter2DEXT'); + if not Assigned(glSeparableFilter2DEXT) then Exit; + @glGetSeparableFilterEXT := SDL_GL_GetProcAddress('glGetSeparableFilterEXT'); + if not Assigned(glGetSeparableFilterEXT) then Exit; + @glConvolutionParameteriEXT := SDL_GL_GetProcAddress('glConvolutionParameteriEXT'); + if not Assigned(glConvolutionParameteriEXT) then Exit; + @glConvolutionParameterivEXT := SDL_GL_GetProcAddress('glConvolutionParameterivEXT'); + if not Assigned(glConvolutionParameterivEXT) then Exit; + @glConvolutionParameterfEXT := SDL_GL_GetProcAddress('glConvolutionParameterfEXT'); + if not Assigned(glConvolutionParameterfEXT) then Exit; + @glConvolutionParameterfvEXT := SDL_GL_GetProcAddress('glConvolutionParameterfvEXT'); + if not Assigned(glConvolutionParameterfvEXT) then Exit; + @glGetConvolutionParameterivEXT := SDL_GL_GetProcAddress('glGetConvolutionParameterivEXT'); + if not Assigned(glGetConvolutionParameterivEXT) then Exit; + @glGetConvolutionParameterfvEXT := SDL_GL_GetProcAddress('glGetConvolutionParameterfvEXT'); + if not Assigned(glGetConvolutionParameterfvEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_histogram: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_histogram', extstring) then + begin + @glHistogramEXT := SDL_GL_GetProcAddress('glHistogramEXT'); + if not Assigned(glHistogramEXT) then Exit; + @glResetHistogramEXT := SDL_GL_GetProcAddress('glResetHistogramEXT'); + if not Assigned(glResetHistogramEXT) then Exit; + @glGetHistogramEXT := SDL_GL_GetProcAddress('glGetHistogramEXT'); + if not Assigned(glGetHistogramEXT) then Exit; + @glGetHistogramParameterivEXT := SDL_GL_GetProcAddress('glGetHistogramParameterivEXT'); + if not Assigned(glGetHistogramParameterivEXT) then Exit; + @glGetHistogramParameterfvEXT := SDL_GL_GetProcAddress('glGetHistogramParameterfvEXT'); + if not Assigned(glGetHistogramParameterfvEXT) then Exit; + @glMinmaxEXT := SDL_GL_GetProcAddress('glMinmaxEXT'); + if not Assigned(glMinmaxEXT) then Exit; + @glResetMinmaxEXT := SDL_GL_GetProcAddress('glResetMinmaxEXT'); + if not Assigned(glResetMinmaxEXT) then Exit; + @glGetMinmaxEXT := SDL_GL_GetProcAddress('glGetMinmaxEXT'); + if not Assigned(glGetMinmaxEXT) then Exit; + @glGetMinmaxParameterivEXT := SDL_GL_GetProcAddress('glGetMinmaxParameterivEXT'); + if not Assigned(glGetMinmaxParameterivEXT) then Exit; + @glGetMinmaxParameterfvEXT := SDL_GL_GetProcAddress('glGetMinmaxParameterfvEXT'); + if not Assigned(glGetMinmaxParameterfvEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_multi_draw_arrays: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_multi_draw_arrays', extstring) then + begin + @glMultiDrawArraysEXT := SDL_GL_GetProcAddress('glMultiDrawArraysEXT'); + if not Assigned(glMultiDrawArraysEXT) then Exit; + @glMultiDrawElementsEXT := SDL_GL_GetProcAddress('glMultiDrawElementsEXT'); + if not Assigned(glMultiDrawElementsEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_packed_pixels: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_packed_pixels', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_paletted_texture: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_paletted_texture', extstring) then + begin + @glColorTableEXT := SDL_GL_GetProcAddress('glColorTableEXT'); + if not Assigned(glColorTableEXT) then Exit; + @glColorSubTableEXT := SDL_GL_GetProcAddress('glColorSubTableEXT'); + if not Assigned(glColorSubTableEXT) then Exit; + @glGetColorTableEXT := SDL_GL_GetProcAddress('glGetColorTableEXT'); + if not Assigned(glGetColorTableEXT) then Exit; + @glGetColorTableParameterivEXT := SDL_GL_GetProcAddress('glGetColorTableParameterivEXT'); + if not Assigned(glGetColorTableParameterivEXT) then Exit; + @glGetColorTableParameterfvEXT := SDL_GL_GetProcAddress('glGetColorTableParameterfvEXT'); + if not Assigned(glGetColorTableParameterfvEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_point_parameters: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_point_parameters', extstring) then + begin + @glPointParameterfEXT := SDL_GL_GetProcAddress('glPointParameterfEXT'); + if not Assigned(glPointParameterfEXT) then Exit; + @glPointParameterfvEXT := SDL_GL_GetProcAddress('glPointParameterfvEXT'); + if not Assigned(glPointParameterfvEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_polygon_offset: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_polygon_offset', extstring) then + begin + @glPolygonOffsetEXT := SDL_GL_GetProcAddress('glPolygonOffsetEXT'); + if not Assigned(glPolygonOffsetEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_separate_specular_color: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_separate_specular_color', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_shadow_funcs: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_shadow_funcs', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_shared_texture_palette: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_shared_texture_palette', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_stencil_two_side: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_stencil_two_side', extstring) then + begin + @glActiveStencilFaceEXT := SDL_GL_GetProcAddress('glActiveStencilFaceEXT'); + if not Assigned(glActiveStencilFaceEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_stencil_wrap: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_stencil_wrap', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_subtexture: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_subtexture', extstring) then + begin + @glTexSubImage1DEXT := SDL_GL_GetProcAddress('glTexSubImage1DEXT'); + if not Assigned(glTexSubImage1DEXT) then Exit; + @glTexSubImage2DEXT := SDL_GL_GetProcAddress('glTexSubImage2DEXT'); + if not Assigned(glTexSubImage2DEXT) then Exit; + @glTexSubImage3DEXT := SDL_GL_GetProcAddress('glTexSubImage3DEXT'); + if not Assigned(glTexSubImage3DEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_texture3D: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_texture3D', extstring) then + begin + glTexImage3DEXT := SDL_GL_GetProcAddress('glTexImage3DEXT'); + if not Assigned(glTexImage3DEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_texture_compression_s3tc: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_texture_compression_s3tc', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_texture_env_add: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_texture_env_add', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_texture_env_combine: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_texture_env_combine', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_texture_env_dot3: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_texture_env_dot3', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_texture_filter_anisotropic: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_texture_filter_anisotropic', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_texture_lod_bias: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_texture_lod_bias', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_texture_object: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_texture_object', extstring) then + begin + @glGenTexturesEXT := SDL_GL_GetProcAddress('glGenTexturesEXT'); + if not Assigned(glGenTexturesEXT) then Exit; + @glDeleteTexturesEXT := SDL_GL_GetProcAddress('glDeleteTexturesEXT'); + if not Assigned(glDeleteTexturesEXT) then Exit; + @glBindTextureEXT := SDL_GL_GetProcAddress('glBindTextureEXT'); + if not Assigned(glBindTextureEXT) then Exit; + @glPrioritizeTexturesEXT := SDL_GL_GetProcAddress('glPrioritizeTexturesEXT'); + if not Assigned(glPrioritizeTexturesEXT) then Exit; + @glAreTexturesResidentEXT := SDL_GL_GetProcAddress('glAreTexturesResidentEXT'); + if not Assigned(glAreTexturesResidentEXT) then Exit; + @glIsTextureEXT := SDL_GL_GetProcAddress('glIsTextureEXT'); + if not Assigned(glIsTextureEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_vertex_array: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_vertex_array', extstring) then + begin + @glArrayElementEXT := SDL_GL_GetProcAddress('glArrayElementEXT'); + if not Assigned(glArrayElementEXT) then Exit; + @glDrawArraysEXT := SDL_GL_GetProcAddress('glDrawArraysEXT'); + if not Assigned(glDrawArraysEXT) then Exit; + @glVertexPointerEXT := SDL_GL_GetProcAddress('glVertexPointerEXT'); + if not Assigned(glVertexPointerEXT) then Exit; + @glNormalPointerEXT := SDL_GL_GetProcAddress('glNormalPointerEXT'); + if not Assigned(glNormalPointerEXT) then Exit; + @glColorPointerEXT := SDL_GL_GetProcAddress('glColorPointerEXT'); + if not Assigned(glColorPointerEXT) then Exit; + @glIndexPointerEXT := SDL_GL_GetProcAddress('glIndexPointerEXT'); + if not Assigned(glIndexPointerEXT) then Exit; + @glTexCoordPointerEXT := SDL_GL_GetProcAddress('glTexCoordPointerEXT'); + if not Assigned(glTexCoordPointerEXT) then Exit; + @glEdgeFlagPointerEXT := SDL_GL_GetProcAddress('glEdgeFlagPointerEXT'); + if not Assigned(glEdgeFlagPointerEXT) then Exit; + @glGetPointervEXT := SDL_GL_GetProcAddress('glGetPointervEXT'); + if not Assigned(glGetPointervEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_vertex_shader: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_vertex_shader', extstring) then + begin + @glBeginVertexShaderEXT := SDL_GL_GetProcAddress('glBeginVertexShaderEXT'); + if not Assigned(glBeginVertexShaderEXT) then Exit; + @glEndVertexShaderEXT := SDL_GL_GetProcAddress('glEndVertexShaderEXT'); + if not Assigned(glEndVertexShaderEXT) then Exit; + @glBindVertexShaderEXT := SDL_GL_GetProcAddress('glBindVertexShaderEXT'); + if not Assigned(glBindVertexShaderEXT) then Exit; + @glGenVertexShadersEXT := SDL_GL_GetProcAddress('glGenVertexShadersEXT'); + if not Assigned(glGenVertexShadersEXT) then Exit; + @glDeleteVertexShaderEXT := SDL_GL_GetProcAddress('glDeleteVertexShaderEXT'); + if not Assigned(glDeleteVertexShaderEXT) then Exit; + @glShaderOp1EXT := SDL_GL_GetProcAddress('glShaderOp1EXT'); + if not Assigned(glShaderOp1EXT) then Exit; + @glShaderOp2EXT := SDL_GL_GetProcAddress('glShaderOp2EXT'); + if not Assigned(glShaderOp2EXT) then Exit; + @glShaderOp3EXT := SDL_GL_GetProcAddress('glShaderOp3EXT'); + if not Assigned(glShaderOp3EXT) then Exit; + @glSwizzleEXT := SDL_GL_GetProcAddress('glSwizzleEXT'); + if not Assigned(glSwizzleEXT) then Exit; + @glWriteMaskEXT := SDL_GL_GetProcAddress('glWriteMaskEXT'); + if not Assigned(glWriteMaskEXT) then Exit; + @glInsertComponentEXT := SDL_GL_GetProcAddress('glInsertComponentEXT'); + if not Assigned(glInsertComponentEXT) then Exit; + @glExtractComponentEXT := SDL_GL_GetProcAddress('glExtractComponentEXT'); + if not Assigned(glExtractComponentEXT) then Exit; + @glGenSymbolsEXT := SDL_GL_GetProcAddress('glGenSymbolsEXT'); + if not Assigned(glGenSymbolsEXT) then Exit; + @glSetInvariantEXT := SDL_GL_GetProcAddress('glSetInvariantEXT'); + if not Assigned(glSetInvariantEXT) then Exit; + @glSetLocalConstantEXT := SDL_GL_GetProcAddress('glSetLocalConstantEXT'); + if not Assigned(glSetLocalConstantEXT) then Exit; + @glVariantbvEXT := SDL_GL_GetProcAddress('glVariantbvEXT'); + if not Assigned(glVariantbvEXT) then Exit; + @glVariantsvEXT := SDL_GL_GetProcAddress('glVariantsvEXT'); + if not Assigned(glVariantsvEXT) then Exit; + @glVariantivEXT := SDL_GL_GetProcAddress('glVariantivEXT'); + if not Assigned(glVariantivEXT) then Exit; + @glVariantfvEXT := SDL_GL_GetProcAddress('glVariantfvEXT'); + if not Assigned(glVariantfvEXT) then Exit; + @glVariantdvEXT := SDL_GL_GetProcAddress('glVariantdvEXT'); + if not Assigned(glVariantdvEXT) then Exit; + @glVariantubvEXT := SDL_GL_GetProcAddress('glVariantubvEXT'); + if not Assigned(glVariantubvEXT) then Exit; + @glVariantusvEXT := SDL_GL_GetProcAddress('glVariantusvEXT'); + if not Assigned(glVariantusvEXT) then Exit; + @glVariantuivEXT := SDL_GL_GetProcAddress('glVariantuivEXT'); + if not Assigned(glVariantuivEXT) then Exit; + @glVariantPointerEXT := SDL_GL_GetProcAddress('glVariantPointerEXT'); + if not Assigned(glVariantPointerEXT) then Exit; + @glEnableVariantClientStateEXT := SDL_GL_GetProcAddress('glEnableVariantClientStateEXT'); + if not Assigned(glEnableVariantClientStateEXT) then Exit; + @glDisableVariantClientStateEXT := SDL_GL_GetProcAddress('glDisableVariantClientStateEXT'); + if not Assigned(glDisableVariantClientStateEXT) then Exit; + @glBindLightParameterEXT := SDL_GL_GetProcAddress('glBindLightParameterEXT'); + if not Assigned(glBindLightParameterEXT) then Exit; + @glBindMaterialParameterEXT := SDL_GL_GetProcAddress('glBindMaterialParameterEXT'); + if not Assigned(glBindMaterialParameterEXT) then Exit; + @glBindTexGenParameterEXT := SDL_GL_GetProcAddress('glBindTexGenParameterEXT'); + if not Assigned(glBindTexGenParameterEXT) then Exit; + @glBindTextureUnitParameterEXT := SDL_GL_GetProcAddress('glBindTextureUnitParameterEXT'); + if not Assigned(glBindTextureUnitParameterEXT) then Exit; + @glBindParameterEXT := SDL_GL_GetProcAddress('glBindParameterEXT'); + if not Assigned(glBindParameterEXT) then Exit; + @glIsVariantEnabledEXT := SDL_GL_GetProcAddress('glIsVariantEnabledEXT'); + if not Assigned(glIsVariantEnabledEXT) then Exit; + @glGetVariantBooleanvEXT := SDL_GL_GetProcAddress('glGetVariantBooleanvEXT'); + if not Assigned(glGetVariantBooleanvEXT) then Exit; + @glGetVariantIntegervEXT := SDL_GL_GetProcAddress('glGetVariantIntegervEXT'); + if not Assigned(glGetVariantIntegervEXT) then Exit; + @glGetVariantFloatvEXT := SDL_GL_GetProcAddress('glGetVariantFloatvEXT'); + if not Assigned(glGetVariantFloatvEXT) then Exit; + @glGetVariantPointervEXT := SDL_GL_GetProcAddress('glGetVariantPointervEXT'); + if not Assigned(glGetVariantPointervEXT) then Exit; + @glGetInvariantBooleanvEXT := SDL_GL_GetProcAddress('glGetInvariantBooleanvEXT'); + if not Assigned(glGetInvariantBooleanvEXT) then Exit; + @glGetInvariantIntegervEXT := SDL_GL_GetProcAddress('glGetInvariantIntegervEXT'); + if not Assigned(glGetInvariantIntegervEXT) then Exit; + @glGetInvariantFloatvEXT := SDL_GL_GetProcAddress('glGetInvariantFloatvEXT'); + if not Assigned(glGetInvariantFloatvEXT) then Exit; + @glGetLocalConstantBooleanvEXT := SDL_GL_GetProcAddress('glGetLocalConstantBooleanvEXT'); + if not Assigned(glGetLocalConstantBooleanvEXT) then Exit; + @glGetLocalConstantIntegervEXT := SDL_GL_GetProcAddress('glGetLocalConstantIntegervEXT'); + if not Assigned(glGetLocalConstantIntegervEXT) then Exit; + @glGetLocalConstantFloatvEXT := SDL_GL_GetProcAddress('glGetLocalConstantFloatvEXT'); + if not Assigned(glGetLocalConstantFloatvEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_vertex_weighting: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_vertex_weighting', extstring) then + begin + @glVertexWeightfEXT := SDL_GL_GetProcAddress('glVertexWeightfEXT'); + if not Assigned(glVertexWeightfEXT) then Exit; + @glVertexWeightfvEXT := SDL_GL_GetProcAddress('glVertexWeightfvEXT'); + if not Assigned(glVertexWeightfvEXT) then Exit; + @glVertexWeightPointerEXT := SDL_GL_GetProcAddress('glVertexWeightPointerEXT'); + if not Assigned(glVertexWeightPointerEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_HP_occlusion_test: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_HP_occlusion_test', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_blend_square: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_blend_square', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_copy_depth_to_color: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_copy_depth_to_color', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_depth_clamp: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_depth_clamp', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_evaluators: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_evaluators', extstring) then + begin + @glMapControlPointsNV := SDL_GL_GetProcAddress('glMapControlPointsNV'); + if not Assigned(glMapControlPointsNV) then Exit; + @glMapParameterivNV := SDL_GL_GetProcAddress('glMapParameterivNV'); + if not Assigned(glMapParameterivNV) then Exit; + @glMapParameterfvNV := SDL_GL_GetProcAddress('glMapParameterfvNV'); + if not Assigned(glMapParameterfvNV) then Exit; + @glGetMapControlPointsNV := SDL_GL_GetProcAddress('glGetMapControlPointsNV'); + if not Assigned(glGetMapControlPointsNV) then Exit; + @glGetMapParameterivNV := SDL_GL_GetProcAddress('glGetMapParameterivNV'); + if not Assigned(glGetMapParameterivNV) then Exit; + @glGetMapParameterfvNV := SDL_GL_GetProcAddress('glGetMapParameterfvNV'); + if not Assigned(glGetMapParameterfvNV) then Exit; + @glGetMapAttribParameterivNV := SDL_GL_GetProcAddress('glGetMapAttribParameterivNV'); + if not Assigned(glGetMapAttribParameterivNV) then Exit; + @glGetMapAttribParameterfvNV := SDL_GL_GetProcAddress('glGetMapAttribParameterfvNV'); + if not Assigned(glGetMapAttribParameterfvNV) then Exit; + @glEvalMapsNV := SDL_GL_GetProcAddress('glEvalMapsNV'); + if not Assigned(glEvalMapsNV) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_fence: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_fence', extstring) then + begin + @glGenFencesNV := SDL_GL_GetProcAddress('glGenFencesNV'); + if not Assigned(glGenFencesNV) then Exit; + @glDeleteFencesNV := SDL_GL_GetProcAddress('glDeleteFencesNV'); + if not Assigned(glDeleteFencesNV) then Exit; + @glSetFenceNV := SDL_GL_GetProcAddress('glSetFenceNV'); + if not Assigned(glSetFenceNV) then Exit; + @glTestFenceNV := SDL_GL_GetProcAddress('glTestFenceNV'); + if not Assigned(glTestFenceNV) then Exit; + @glFinishFenceNV := SDL_GL_GetProcAddress('glFinishFenceNV'); + if not Assigned(glFinishFenceNV) then Exit; + @glIsFenceNV := SDL_GL_GetProcAddress('glIsFenceNV'); + if not Assigned(glIsFenceNV) then Exit; + @glGetFenceivNV := SDL_GL_GetProcAddress('glGetFenceivNV'); + if not Assigned(glGetFenceivNV) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_fog_distance: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_fog_distance', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_light_max_exponent: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_light_max_exponent', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_multisample_filter_hint: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_multisample_filter_hint', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_occlusion_query: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_occlusion_query', extstring) then + begin + @glGenOcclusionQueriesNV := SDL_GL_GetProcAddress('glGenOcclusionQueriesNV'); + if not Assigned(glGenOcclusionQueriesNV) then Exit; + @glDeleteOcclusionQueriesNV := SDL_GL_GetProcAddress('glDeleteOcclusionQueriesNV'); + if not Assigned(glDeleteOcclusionQueriesNV) then Exit; + @glIsOcclusionQueryNV := SDL_GL_GetProcAddress('glIsOcclusionQueryNV'); + if not Assigned(glIsOcclusionQueryNV) then Exit; + @glBeginOcclusionQueryNV := SDL_GL_GetProcAddress('glBeginOcclusionQueryNV'); + if not Assigned(glBeginOcclusionQueryNV) then Exit; + @glEndOcclusionQueryNV := SDL_GL_GetProcAddress('glEndOcclusionQueryNV'); + if not Assigned(glEndOcclusionQueryNV) then Exit; + @glGetOcclusionQueryivNV := SDL_GL_GetProcAddress('glGetOcclusionQueryivNV'); + if not Assigned(glGetOcclusionQueryivNV) then Exit; + @glGetOcclusionQueryuivNV := SDL_GL_GetProcAddress('glGetOcclusionQueryuivNV'); + if not Assigned(glGetOcclusionQueryuivNV) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_packed_depth_stencil: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_packed_depth_stencil', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_point_sprite: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_point_sprite', extstring) then + begin + @glPointParameteriNV := SDL_GL_GetProcAddress('glPointParameteriNV'); + if not Assigned(glPointParameteriNV) then Exit; + @glPointParameterivNV := SDL_GL_GetProcAddress('glPointParameterivNV'); + if not Assigned(glPointParameterivNV) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_register_combiners: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_register_combiners', extstring) then + begin + @glCombinerParameterfvNV := SDL_GL_GetProcAddress('glCombinerParameterfvNV'); + if not Assigned(glCombinerParameterfvNV) then Exit; + @glCombinerParameterivNV := SDL_GL_GetProcAddress('glCombinerParameterivNV'); + if not Assigned(glCombinerParameterivNV) then Exit; + @glCombinerParameterfNV := SDL_GL_GetProcAddress('glCombinerParameterfNV'); + if not Assigned(glCombinerParameterfNV) then Exit; + @glCombinerParameteriNV := SDL_GL_GetProcAddress('glCombinerParameteriNV'); + if not Assigned(glCombinerParameteriNV) then Exit; + @glCombinerInputNV := SDL_GL_GetProcAddress('glCombinerInputNV'); + if not Assigned(glCombinerInputNV) then Exit; + @glCombinerOutputNV := SDL_GL_GetProcAddress('glCombinerOutputNV'); + if not Assigned(glCombinerOutputNV) then Exit; + @glFinalCombinerInputNV := SDL_GL_GetProcAddress('glFinalCombinerInputNV'); + if not Assigned(glFinalCombinerInputNV) then Exit; + @glGetCombinerInputParameterfvNV := SDL_GL_GetProcAddress('glGetCombinerInputParameterfvNV'); + if not Assigned(glGetCombinerInputParameterfvNV) then Exit; + @glGetCombinerInputParameterivNV := SDL_GL_GetProcAddress('glGetCombinerInputParameterivNV'); + if not Assigned(glGetCombinerInputParameterivNV) then Exit; + @glGetCombinerOutputParameterfvNV := SDL_GL_GetProcAddress('glGetCombinerOutputParameterfvNV'); + if not Assigned(glGetCombinerOutputParameterfvNV) then Exit; + @glGetCombinerOutputParameterivNV := SDL_GL_GetProcAddress('glGetCombinerOutputParameterivNV'); + if not Assigned(glGetCombinerOutputParameterivNV) then Exit; + @glGetFinalCombinerInputParameterfvNV := SDL_GL_GetProcAddress('glGetFinalCombinerInputParameterfvNV'); + if not Assigned(glGetFinalCombinerInputParameterfvNV) then Exit; + @glGetFinalCombinerInputParameterivNV := SDL_GL_GetProcAddress('glGetFinalCombinerInputParameterivNV'); + if not Assigned(glGetFinalCombinerInputParameterivNV) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_register_combiners2: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_register_combiners2', extstring) then + begin + @glCombinerStageParameterfvNV := SDL_GL_GetProcAddress('glCombinerStageParameterfvNV'); + if not Assigned(glCombinerStageParameterfvNV) then Exit; + @glGetCombinerStageParameterfvNV := SDL_GL_GetProcAddress('glGetCombinerStageParameterfvNV'); + if not Assigned(glGetCombinerStageParameterfvNV) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_texgen_emboss: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_texgen_emboss', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_texgen_reflection: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_texgen_reflection', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_texture_compression_vtc: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_texture_compression_vtc', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_texture_env_combine4: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_texture_env_combine4', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_texture_rectangle: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_texture_rectangle', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_texture_shader: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_texture_shader', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_texture_shader2: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_texture_shader2', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_texture_shader3: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_texture_shader3', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_vertex_array_range: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_vertex_array_range', extstring) then + begin + @glVertexArrayRangeNV := SDL_GL_GetProcAddress('glVertexArrayRangeNV'); + if not Assigned(glVertexArrayRangeNV) then Exit; + @glFlushVertexArrayRangeNV := SDL_GL_GetProcAddress('glFlushVertexArrayRangeNV'); + if not Assigned(glFlushVertexArrayRangeNV) then Exit; + {$IFDEF WIN32} + @wglAllocateMemoryNV := SDL_GL_GetProcAddress('wglAllocateMemoryNV'); + if not Assigned(wglAllocateMemoryNV) then Exit; + @wglFreeMemoryNV := SDL_GL_GetProcAddress('wglFreeMemoryNV'); + if not Assigned(wglFreeMemoryNV) then Exit; + {$ENDIF} + Result := TRUE; + end; + +end; + +function Load_GL_NV_vertex_array_range2: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_vertex_array_range2', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_vertex_program: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_vertex_program', extstring) then + begin + @glBindProgramNV := SDL_GL_GetProcAddress('glBindProgramNV'); + if not Assigned(glBindProgramNV) then Exit; + @glDeleteProgramsNV := SDL_GL_GetProcAddress('glDeleteProgramsNV'); + if not Assigned(glDeleteProgramsNV) then Exit; + @glExecuteProgramNV := SDL_GL_GetProcAddress('glExecuteProgramNV'); + if not Assigned(glExecuteProgramNV) then Exit; + @glGenProgramsNV := SDL_GL_GetProcAddress('glGenProgramsNV'); + if not Assigned(glGenProgramsNV) then Exit; + @glAreProgramsResidentNV := SDL_GL_GetProcAddress('glAreProgramsResidentNV'); + if not Assigned(glAreProgramsResidentNV) then Exit; + @glRequestResidentProgramsNV := SDL_GL_GetProcAddress('glRequestResidentProgramsNV'); + if not Assigned(glRequestResidentProgramsNV) then Exit; + @glGetProgramParameterfvNV := SDL_GL_GetProcAddress('glGetProgramParameterfvNV'); + if not Assigned(glGetProgramParameterfvNV) then Exit; + @glGetProgramParameterdvNV := SDL_GL_GetProcAddress('glGetProgramParameterdvNV'); + if not Assigned(glGetProgramParameterdvNV) then Exit; + @glGetProgramivNV := SDL_GL_GetProcAddress('glGetProgramivNV'); + if not Assigned(glGetProgramivNV) then Exit; + @glGetProgramStringNV := SDL_GL_GetProcAddress('glGetProgramStringNV'); + if not Assigned(glGetProgramStringNV) then Exit; + @glGetTrackMatrixivNV := SDL_GL_GetProcAddress('glGetTrackMatrixivNV'); + if not Assigned(glGetTrackMatrixivNV) then Exit; + @glGetVertexAttribdvNV := SDL_GL_GetProcAddress('glGetVertexAttribdvNV'); + if not Assigned(glGetVertexAttribdvNV) then Exit; + @glGetVertexAttribfvNV := SDL_GL_GetProcAddress('glGetVertexAttribfvNV'); + if not Assigned(glGetVertexAttribfvNV) then Exit; + @glGetVertexAttribivNV := SDL_GL_GetProcAddress('glGetVertexAttribivNV'); + if not Assigned(glGetVertexAttribivNV) then Exit; + @glGetVertexAttribPointervNV := SDL_GL_GetProcAddress('glGetVertexAttribPointervNV'); + if not Assigned(glGetVertexAttribPointervNV) then Exit; + @glIsProgramNV := SDL_GL_GetProcAddress('glIsProgramNV'); + if not Assigned(glIsProgramNV) then Exit; + @glLoadProgramNV := SDL_GL_GetProcAddress('glLoadProgramNV'); + if not Assigned(glLoadProgramNV) then Exit; + @glProgramParameter4fNV := SDL_GL_GetProcAddress('glProgramParameter4fNV'); + if not Assigned(glProgramParameter4fNV) then Exit; + @glProgramParameter4fvNV := SDL_GL_GetProcAddress('glProgramParameter4fvNV'); + if not Assigned(glProgramParameter4fvNV) then Exit; + @glProgramParameters4dvNV := SDL_GL_GetProcAddress('glProgramParameters4dvNV'); + if not Assigned(glProgramParameters4dvNV) then Exit; + @glProgramParameters4fvNV := SDL_GL_GetProcAddress('glProgramParameters4fvNV'); + if not Assigned(glProgramParameters4fvNV) then Exit; + @glTrackMatrixNV := SDL_GL_GetProcAddress('glTrackMatrixNV'); + if not Assigned(glTrackMatrixNV) then Exit; + @glVertexAttribPointerNV := SDL_GL_GetProcAddress('glVertexAttribPointerNV'); + if not Assigned(glVertexAttribPointerNV) then Exit; + @glVertexAttrib1sNV := SDL_GL_GetProcAddress('glVertexAttrib1sNV'); + if not Assigned(glVertexAttrib1sNV) then Exit; + @glVertexAttrib1fNV := SDL_GL_GetProcAddress('glVertexAttrib1fNV'); + if not Assigned(glVertexAttrib1fNV) then Exit; + @glVertexAttrib1dNV := SDL_GL_GetProcAddress('glVertexAttrib1dNV'); + if not Assigned(glVertexAttrib1dNV) then Exit; + @glVertexAttrib2sNV := SDL_GL_GetProcAddress('glVertexAttrib2sNV'); + if not Assigned(glVertexAttrib2sNV) then Exit; + @glVertexAttrib2fNV := SDL_GL_GetProcAddress('glVertexAttrib2fNV'); + if not Assigned(glVertexAttrib2fNV) then Exit; + @glVertexAttrib2dNV := SDL_GL_GetProcAddress('glVertexAttrib2dNV'); + if not Assigned(glVertexAttrib2dNV) then Exit; + @glVertexAttrib3sNV := SDL_GL_GetProcAddress('glVertexAttrib3sNV'); + if not Assigned(glVertexAttrib3sNV) then Exit; + @glVertexAttrib3fNV := SDL_GL_GetProcAddress('glVertexAttrib3fNV'); + if not Assigned(glVertexAttrib3fNV) then Exit; + @glVertexAttrib3dNV := SDL_GL_GetProcAddress('glVertexAttrib3dNV'); + if not Assigned(glVertexAttrib3dNV) then Exit; + @glVertexAttrib4sNV := SDL_GL_GetProcAddress('glVertexAttrib4sNV'); + if not Assigned(glVertexAttrib4sNV) then Exit; + @glVertexAttrib4fNV := SDL_GL_GetProcAddress('glVertexAttrib4fNV'); + if not Assigned(glVertexAttrib4fNV) then Exit; + @glVertexAttrib4dNV := SDL_GL_GetProcAddress('glVertexAttrib4dNV'); + if not Assigned(glVertexAttrib4dNV) then Exit; + @glVertexAttrib4ubNV := SDL_GL_GetProcAddress('glVertexAttrib4ubNV'); + if not Assigned(glVertexAttrib4ubNV) then Exit; + @glVertexAttrib1svNV := SDL_GL_GetProcAddress('glVertexAttrib1svNV'); + if not Assigned(glVertexAttrib1svNV) then Exit; + @glVertexAttrib1fvNV := SDL_GL_GetProcAddress('glVertexAttrib1fvNV'); + if not Assigned(glVertexAttrib1fvNV) then Exit; + @glVertexAttrib1dvNV := SDL_GL_GetProcAddress('glVertexAttrib1dvNV'); + if not Assigned(glVertexAttrib1dvNV) then Exit; + @glVertexAttrib2svNV := SDL_GL_GetProcAddress('glVertexAttrib2svNV'); + if not Assigned(glVertexAttrib2svNV) then Exit; + @glVertexAttrib2fvNV := SDL_GL_GetProcAddress('glVertexAttrib2fvNV'); + if not Assigned(glVertexAttrib2fvNV) then Exit; + @glVertexAttrib2dvNV := SDL_GL_GetProcAddress('glVertexAttrib2dvNV'); + if not Assigned(glVertexAttrib2dvNV) then Exit; + @glVertexAttrib3svNV := SDL_GL_GetProcAddress('glVertexAttrib3svNV'); + if not Assigned(glVertexAttrib3svNV) then Exit; + @glVertexAttrib3fvNV := SDL_GL_GetProcAddress('glVertexAttrib3fvNV'); + if not Assigned(glVertexAttrib3fvNV) then Exit; + @glVertexAttrib3dvNV := SDL_GL_GetProcAddress('glVertexAttrib3dvNV'); + if not Assigned(glVertexAttrib3dvNV) then Exit; + @glVertexAttrib4svNV := SDL_GL_GetProcAddress('glVertexAttrib4svNV'); + if not Assigned(glVertexAttrib4svNV) then Exit; + @glVertexAttrib4fvNV := SDL_GL_GetProcAddress('glVertexAttrib4fvNV'); + if not Assigned(glVertexAttrib4fvNV) then Exit; + @glVertexAttrib4dvNV := SDL_GL_GetProcAddress('glVertexAttrib4dvNV'); + if not Assigned(glVertexAttrib4dvNV) then Exit; + @glVertexAttrib4ubvNV := SDL_GL_GetProcAddress('glVertexAttrib4ubvNV'); + if not Assigned(glVertexAttrib4ubvNV) then Exit; + @glVertexAttribs1svNV := SDL_GL_GetProcAddress('glVertexAttribs1svNV'); + if not Assigned(glVertexAttribs1svNV) then Exit; + @glVertexAttribs1fvNV := SDL_GL_GetProcAddress('glVertexAttribs1fvNV'); + if not Assigned(glVertexAttribs1fvNV) then Exit; + @glVertexAttribs1dvNV := SDL_GL_GetProcAddress('glVertexAttribs1dvNV'); + if not Assigned(glVertexAttribs1dvNV) then Exit; + @glVertexAttribs2svNV := SDL_GL_GetProcAddress('glVertexAttribs2svNV'); + if not Assigned(glVertexAttribs2svNV) then Exit; + @glVertexAttribs2fvNV := SDL_GL_GetProcAddress('glVertexAttribs2fvNV'); + if not Assigned(glVertexAttribs2fvNV) then Exit; + @glVertexAttribs2dvNV := SDL_GL_GetProcAddress('glVertexAttribs2dvNV'); + if not Assigned(glVertexAttribs2dvNV) then Exit; + @glVertexAttribs3svNV := SDL_GL_GetProcAddress('glVertexAttribs3svNV'); + if not Assigned(glVertexAttribs3svNV) then Exit; + @glVertexAttribs3fvNV := SDL_GL_GetProcAddress('glVertexAttribs3fvNV'); + if not Assigned(glVertexAttribs3fvNV) then Exit; + @glVertexAttribs3dvNV := SDL_GL_GetProcAddress('glVertexAttribs3dvNV'); + if not Assigned(glVertexAttribs3dvNV) then Exit; + @glVertexAttribs4svNV := SDL_GL_GetProcAddress('glVertexAttribs4svNV'); + if not Assigned(glVertexAttribs4svNV) then Exit; + @glVertexAttribs4fvNV := SDL_GL_GetProcAddress('glVertexAttribs4fvNV'); + if not Assigned(glVertexAttribs4fvNV) then Exit; + @glVertexAttribs4dvNV := SDL_GL_GetProcAddress('glVertexAttribs4dvNV'); + if not Assigned(glVertexAttribs4dvNV) then Exit; + @glVertexAttribs4ubvNV := SDL_GL_GetProcAddress('glVertexAttribs4ubvNV'); + if not Assigned(glVertexAttribs4ubvNV) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_vertex_program1_1: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_vertex_program1_1', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ATI_element_array: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_element_array', extstring) then + begin + @glElementPointerATI := SDL_GL_GetProcAddress('glElementPointerATI'); + if not Assigned(glElementPointerATI) then Exit; + @glDrawElementArrayATI := SDL_GL_GetProcAddress('glDrawElementArrayATI'); + if not Assigned(glDrawElementArrayATI) then Exit; + @glDrawRangeElementArrayATI := SDL_GL_GetProcAddress('glDrawRangeElementArrayATI'); + if not Assigned(glDrawRangeElementArrayATI) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ATI_envmap_bumpmap: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_envmap_bumpmap', extstring) then + begin + @glTexBumpParameterivATI := SDL_GL_GetProcAddress('glTexBumpParameterivATI'); + if not Assigned(glTexBumpParameterivATI) then Exit; + @glTexBumpParameterfvATI := SDL_GL_GetProcAddress('glTexBumpParameterfvATI'); + if not Assigned(glTexBumpParameterfvATI) then Exit; + @glGetTexBumpParameterivATI := SDL_GL_GetProcAddress('glGetTexBumpParameterivATI'); + if not Assigned(glGetTexBumpParameterivATI) then Exit; + @glGetTexBumpParameterfvATI := SDL_GL_GetProcAddress('glGetTexBumpParameterfvATI'); + if not Assigned(glGetTexBumpParameterfvATI) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ATI_fragment_shader: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_fragment_shader', extstring) then + begin + @glGenFragmentShadersATI := SDL_GL_GetProcAddress('glGenFragmentShadersATI'); + if not Assigned(glGenFragmentShadersATI) then Exit; + @glBindFragmentShaderATI := SDL_GL_GetProcAddress('glBindFragmentShaderATI'); + if not Assigned(glBindFragmentShaderATI) then Exit; + @glDeleteFragmentShaderATI := SDL_GL_GetProcAddress('glDeleteFragmentShaderATI'); + if not Assigned(glDeleteFragmentShaderATI) then Exit; + @glBeginFragmentShaderATI := SDL_GL_GetProcAddress('glBeginFragmentShaderATI'); + if not Assigned(glBeginFragmentShaderATI) then Exit; + @glEndFragmentShaderATI := SDL_GL_GetProcAddress('glEndFragmentShaderATI'); + if not Assigned(glEndFragmentShaderATI) then Exit; + @glPassTexCoordATI := SDL_GL_GetProcAddress('glPassTexCoordATI'); + if not Assigned(glPassTexCoordATI) then Exit; + @glSampleMapATI := SDL_GL_GetProcAddress('glSampleMapATI'); + if not Assigned(glSampleMapATI) then Exit; + @glColorFragmentOp1ATI := SDL_GL_GetProcAddress('glColorFragmentOp1ATI'); + if not Assigned(glColorFragmentOp1ATI) then Exit; + @glColorFragmentOp2ATI := SDL_GL_GetProcAddress('glColorFragmentOp2ATI'); + if not Assigned(glColorFragmentOp2ATI) then Exit; + @glColorFragmentOp3ATI := SDL_GL_GetProcAddress('glColorFragmentOp3ATI'); + if not Assigned(glColorFragmentOp3ATI) then Exit; + @glAlphaFragmentOp1ATI := SDL_GL_GetProcAddress('glAlphaFragmentOp1ATI'); + if not Assigned(glAlphaFragmentOp1ATI) then Exit; + @glAlphaFragmentOp2ATI := SDL_GL_GetProcAddress('glAlphaFragmentOp2ATI'); + if not Assigned(glAlphaFragmentOp2ATI) then Exit; + @glAlphaFragmentOp3ATI := SDL_GL_GetProcAddress('glAlphaFragmentOp3ATI'); + if not Assigned(glAlphaFragmentOp3ATI) then Exit; + @glSetFragmentShaderConstantATI := SDL_GL_GetProcAddress('glSetFragmentShaderConstantATI'); + if not Assigned(glSetFragmentShaderConstantATI) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ATI_pn_triangles: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_pn_triangles', extstring) then + begin + @glPNTrianglesiATI := SDL_GL_GetProcAddress('glPNTrianglesiATI'); + if not Assigned(glPNTrianglesiATI) then Exit; + @glPNTrianglesfATI := SDL_GL_GetProcAddress('glPNTrianglesfATI'); + if not Assigned(glPNTrianglesfATI) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ATI_texture_mirror_once: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_texture_mirror_once', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ATI_vertex_array_object: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_vertex_array_object', extstring) then + begin + @glNewObjectBufferATI := SDL_GL_GetProcAddress('glNewObjectBufferATI'); + if not Assigned(glNewObjectBufferATI) then Exit; + @glIsObjectBufferATI := SDL_GL_GetProcAddress('glIsObjectBufferATI'); + if not Assigned(glIsObjectBufferATI) then Exit; + @glUpdateObjectBufferATI := SDL_GL_GetProcAddress('glUpdateObjectBufferATI'); + if not Assigned(glUpdateObjectBufferATI) then Exit; + @glGetObjectBufferfvATI := SDL_GL_GetProcAddress('glGetObjectBufferfvATI'); + if not Assigned(glGetObjectBufferfvATI) then Exit; + @glGetObjectBufferivATI := SDL_GL_GetProcAddress('glGetObjectBufferivATI'); + if not Assigned(glGetObjectBufferivATI) then Exit; + @glDeleteObjectBufferATI := SDL_GL_GetProcAddress('glDeleteObjectBufferATI'); + if not Assigned(glDeleteObjectBufferATI) then Exit; + @glArrayObjectATI := SDL_GL_GetProcAddress('glArrayObjectATI'); + if not Assigned(glArrayObjectATI) then Exit; + @glGetArrayObjectfvATI := SDL_GL_GetProcAddress('glGetArrayObjectfvATI'); + if not Assigned(glGetArrayObjectfvATI) then Exit; + @glGetArrayObjectivATI := SDL_GL_GetProcAddress('glGetArrayObjectivATI'); + if not Assigned(glGetArrayObjectivATI) then Exit; + @glVariantArrayObjectATI := SDL_GL_GetProcAddress('glVariantArrayObjectATI'); + if not Assigned(glVariantArrayObjectATI) then Exit; + @glGetVariantArrayObjectfvATI := SDL_GL_GetProcAddress('glGetVariantArrayObjectfvATI'); + if not Assigned(glGetVariantArrayObjectfvATI) then Exit; + @glGetVariantArrayObjectivATI := SDL_GL_GetProcAddress('glGetVariantArrayObjectivATI'); + if not Assigned(glGetVariantArrayObjectivATI) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ATI_vertex_streams: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_vertex_streams', extstring) then + begin + @glVertexStream1s := SDL_GL_GetProcAddress('glVertexStream1s'); + if not Assigned(glVertexStream1s) then Exit; + @glVertexStream1i := SDL_GL_GetProcAddress('glVertexStream1i'); + if not Assigned(glVertexStream1i) then Exit; + @glVertexStream1f := SDL_GL_GetProcAddress('glVertexStream1f'); + if not Assigned(glVertexStream1f) then Exit; + @glVertexStream1d := SDL_GL_GetProcAddress('glVertexStream1d'); + if not Assigned(glVertexStream1d) then Exit; + @glVertexStream1sv := SDL_GL_GetProcAddress('glVertexStream1sv'); + if not Assigned(glVertexStream1sv) then Exit; + @glVertexStream1iv := SDL_GL_GetProcAddress('glVertexStream1iv'); + if not Assigned(glVertexStream1iv) then Exit; + @glVertexStream1fv := SDL_GL_GetProcAddress('glVertexStream1fv'); + if not Assigned(glVertexStream1fv) then Exit; + @glVertexStream1dv := SDL_GL_GetProcAddress('glVertexStream1dv'); + if not Assigned(glVertexStream1dv) then Exit; + @glVertexStream2s := SDL_GL_GetProcAddress('glVertexStream2s'); + if not Assigned(glVertexStream2s) then Exit; + @glVertexStream2i := SDL_GL_GetProcAddress('glVertexStream2i'); + if not Assigned(glVertexStream2i) then Exit; + @glVertexStream2f := SDL_GL_GetProcAddress('glVertexStream2f'); + if not Assigned(glVertexStream2f) then Exit; + @glVertexStream2d := SDL_GL_GetProcAddress('glVertexStream2d'); + if not Assigned(glVertexStream2d) then Exit; + @glVertexStream2sv := SDL_GL_GetProcAddress('glVertexStream2sv'); + if not Assigned(glVertexStream2sv) then Exit; + @glVertexStream2iv := SDL_GL_GetProcAddress('glVertexStream2iv'); + if not Assigned(glVertexStream2iv) then Exit; + @glVertexStream2fv := SDL_GL_GetProcAddress('glVertexStream2fv'); + if not Assigned(glVertexStream2fv) then Exit; + @glVertexStream2dv := SDL_GL_GetProcAddress('glVertexStream2dv'); + if not Assigned(glVertexStream2dv) then Exit; + @glVertexStream3s := SDL_GL_GetProcAddress('glVertexStream3s'); + if not Assigned(glVertexStream3s) then Exit; + @glVertexStream3i := SDL_GL_GetProcAddress('glVertexStream3i'); + if not Assigned(glVertexStream3i) then Exit; + @glVertexStream3f := SDL_GL_GetProcAddress('glVertexStream3f'); + if not Assigned(glVertexStream3f) then Exit; + @glVertexStream3d := SDL_GL_GetProcAddress('glVertexStream3d'); + if not Assigned(glVertexStream3d) then Exit; + @glVertexStream3sv := SDL_GL_GetProcAddress('glVertexStream3sv'); + if not Assigned(glVertexStream3sv) then Exit; + @glVertexStream3iv := SDL_GL_GetProcAddress('glVertexStream3iv'); + if not Assigned(glVertexStream3iv) then Exit; + @glVertexStream3fv := SDL_GL_GetProcAddress('glVertexStream3fv'); + if not Assigned(glVertexStream3fv) then Exit; + @glVertexStream3dv := SDL_GL_GetProcAddress('glVertexStream3dv'); + if not Assigned(glVertexStream3dv) then Exit; + @glVertexStream4s := SDL_GL_GetProcAddress('glVertexStream4s'); + if not Assigned(glVertexStream4s) then Exit; + @glVertexStream4i := SDL_GL_GetProcAddress('glVertexStream4i'); + if not Assigned(glVertexStream4i) then Exit; + @glVertexStream4f := SDL_GL_GetProcAddress('glVertexStream4f'); + if not Assigned(glVertexStream4f) then Exit; + @glVertexStream4d := SDL_GL_GetProcAddress('glVertexStream4d'); + if not Assigned(glVertexStream4d) then Exit; + @glVertexStream4sv := SDL_GL_GetProcAddress('glVertexStream4sv'); + if not Assigned(glVertexStream4sv) then Exit; + @glVertexStream4iv := SDL_GL_GetProcAddress('glVertexStream4iv'); + if not Assigned(glVertexStream4iv) then Exit; + @glVertexStream4fv := SDL_GL_GetProcAddress('glVertexStream4fv'); + if not Assigned(glVertexStream4fv) then Exit; + @glVertexStream4dv := SDL_GL_GetProcAddress('glVertexStream4dv'); + if not Assigned(glVertexStream4dv) then Exit; + @glNormalStream3b := SDL_GL_GetProcAddress('glNormalStream3b'); + if not Assigned(glNormalStream3b) then Exit; + @glNormalStream3s := SDL_GL_GetProcAddress('glNormalStream3s'); + if not Assigned(glNormalStream3s) then Exit; + @glNormalStream3i := SDL_GL_GetProcAddress('glNormalStream3i'); + if not Assigned(glNormalStream3i) then Exit; + @glNormalStream3f := SDL_GL_GetProcAddress('glNormalStream3f'); + if not Assigned(glNormalStream3f) then Exit; + @glNormalStream3d := SDL_GL_GetProcAddress('glNormalStream3d'); + if not Assigned(glNormalStream3d) then Exit; + @glNormalStream3bv := SDL_GL_GetProcAddress('glNormalStream3bv'); + if not Assigned(glNormalStream3bv) then Exit; + @glNormalStream3sv := SDL_GL_GetProcAddress('glNormalStream3sv'); + if not Assigned(glNormalStream3sv) then Exit; + @glNormalStream3iv := SDL_GL_GetProcAddress('glNormalStream3iv'); + if not Assigned(glNormalStream3iv) then Exit; + @glNormalStream3fv := SDL_GL_GetProcAddress('glNormalStream3fv'); + if not Assigned(glNormalStream3fv) then Exit; + @glNormalStream3dv := SDL_GL_GetProcAddress('glNormalStream3dv'); + if not Assigned(glNormalStream3dv) then Exit; + @glClientActiveVertexStream := SDL_GL_GetProcAddress('glClientActiveVertexStream'); + if not Assigned(glClientActiveVertexStream) then Exit; + @glVertexBlendEnvi := SDL_GL_GetProcAddress('glVertexBlendEnvi'); + if not Assigned(glVertexBlendEnvi) then Exit; + @glVertexBlendEnvf := SDL_GL_GetProcAddress('glVertexBlendEnvf'); + if not Assigned(glVertexBlendEnvf) then Exit; + Result := TRUE; + end; + +end; + +{$IFDEF WIN32} +function Load_WGL_I3D_image_buffer: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_I3D_image_buffer', extstring) then + begin + @wglCreateImageBufferI3D := SDL_GL_GetProcAddress('wglCreateImageBufferI3D'); + if not Assigned(wglCreateImageBufferI3D) then Exit; + @wglDestroyImageBufferI3D := SDL_GL_GetProcAddress('wglDestroyImageBufferI3D'); + if not Assigned(wglDestroyImageBufferI3D) then Exit; + @wglAssociateImageBufferEventsI3D := SDL_GL_GetProcAddress('wglAssociateImageBufferEventsI3D'); + if not Assigned(wglAssociateImageBufferEventsI3D) then Exit; + @wglReleaseImageBufferEventsI3D := SDL_GL_GetProcAddress('wglReleaseImageBufferEventsI3D'); + if not Assigned(wglReleaseImageBufferEventsI3D) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_I3D_swap_frame_lock: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_I3D_swap_frame_lock', extstring) then + begin + @wglEnableFrameLockI3D := SDL_GL_GetProcAddress('wglEnableFrameLockI3D'); + if not Assigned(wglEnableFrameLockI3D) then Exit; + @wglDisableFrameLockI3D := SDL_GL_GetProcAddress('wglDisableFrameLockI3D'); + if not Assigned(wglDisableFrameLockI3D) then Exit; + @wglIsEnabledFrameLockI3D := SDL_GL_GetProcAddress('wglIsEnabledFrameLockI3D'); + if not Assigned(wglIsEnabledFrameLockI3D) then Exit; + @wglQueryFrameLockMasterI3D := SDL_GL_GetProcAddress('wglQueryFrameLockMasterI3D'); + if not Assigned(wglQueryFrameLockMasterI3D) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_I3D_swap_frame_usage: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_I3D_swap_frame_usage', extstring) then + begin + @wglGetFrameUsageI3D := SDL_GL_GetProcAddress('wglGetFrameUsageI3D'); + if not Assigned(wglGetFrameUsageI3D) then Exit; + @wglBeginFrameTrackingI3D := SDL_GL_GetProcAddress('wglBeginFrameTrackingI3D'); + if not Assigned(wglBeginFrameTrackingI3D) then Exit; + @wglEndFrameTrackingI3D := SDL_GL_GetProcAddress('wglEndFrameTrackingI3D'); + if not Assigned(wglEndFrameTrackingI3D) then Exit; + @wglQueryFrameTrackingI3D := SDL_GL_GetProcAddress('wglQueryFrameTrackingI3D'); + if not Assigned(wglQueryFrameTrackingI3D) then Exit; + Result := TRUE; + end; + +end; +{$ENDIF} + +function Load_GL_3DFX_texture_compression_FXT1: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_3DFX_texture_compression_FXT1', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_IBM_cull_vertex: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_IBM_cull_vertex', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_IBM_multimode_draw_arrays: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_IBM_multimode_draw_arrays', extstring) then + begin + @glMultiModeDrawArraysIBM := SDL_GL_GetProcAddress('glMultiModeDrawArraysIBM'); + if not Assigned(glMultiModeDrawArraysIBM) then Exit; + @glMultiModeDrawElementsIBM := SDL_GL_GetProcAddress('glMultiModeDrawElementsIBM'); + if not Assigned(glMultiModeDrawElementsIBM) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_IBM_raster_pos_clip: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_IBM_raster_pos_clip', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_IBM_texture_mirrored_repeat: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_IBM_texture_mirrored_repeat', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_IBM_vertex_array_lists: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_IBM_vertex_array_lists', extstring) then + begin + @glColorPointerListIBM := SDL_GL_GetProcAddress('glColorPointerListIBM'); + if not Assigned(glColorPointerListIBM) then Exit; + @glSecondaryColorPointerListIBM := SDL_GL_GetProcAddress('glSecondaryColorPointerListIBM'); + if not Assigned(glSecondaryColorPointerListIBM) then Exit; + @glEdgeFlagPointerListIBM := SDL_GL_GetProcAddress('glEdgeFlagPointerListIBM'); + if not Assigned(glEdgeFlagPointerListIBM) then Exit; + @glFogCoordPointerListIBM := SDL_GL_GetProcAddress('glFogCoordPointerListIBM'); + if not Assigned(glFogCoordPointerListIBM) then Exit; + @glNormalPointerListIBM := SDL_GL_GetProcAddress('glNormalPointerListIBM'); + if not Assigned(glNormalPointerListIBM) then Exit; + @glTexCoordPointerListIBM := SDL_GL_GetProcAddress('glTexCoordPointerListIBM'); + if not Assigned(glTexCoordPointerListIBM) then Exit; + @glVertexPointerListIBM := SDL_GL_GetProcAddress('glVertexPointerListIBM'); + if not Assigned(glVertexPointerListIBM) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_MESA_resize_buffers: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_MESA_resize_buffers', extstring) then + begin + @glResizeBuffersMESA := SDL_GL_GetProcAddress('glResizeBuffersMESA'); + if not Assigned(glResizeBuffersMESA) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_MESA_window_pos: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_MESA_window_pos', extstring) then + begin + @glWindowPos2dMESA := SDL_GL_GetProcAddress('glWindowPos2dMESA'); + if not Assigned(glWindowPos2dMESA) then Exit; + @glWindowPos2fMESA := SDL_GL_GetProcAddress('glWindowPos2fMESA'); + if not Assigned(glWindowPos2fMESA) then Exit; + @glWindowPos2iMESA := SDL_GL_GetProcAddress('glWindowPos2iMESA'); + if not Assigned(glWindowPos2iMESA) then Exit; + @glWindowPos2sMESA := SDL_GL_GetProcAddress('glWindowPos2sMESA'); + if not Assigned(glWindowPos2sMESA) then Exit; + @glWindowPos2ivMESA := SDL_GL_GetProcAddress('glWindowPos2ivMESA'); + if not Assigned(glWindowPos2ivMESA) then Exit; + @glWindowPos2svMESA := SDL_GL_GetProcAddress('glWindowPos2svMESA'); + if not Assigned(glWindowPos2svMESA) then Exit; + @glWindowPos2fvMESA := SDL_GL_GetProcAddress('glWindowPos2fvMESA'); + if not Assigned(glWindowPos2fvMESA) then Exit; + @glWindowPos2dvMESA := SDL_GL_GetProcAddress('glWindowPos2dvMESA'); + if not Assigned(glWindowPos2dvMESA) then Exit; + @glWindowPos3iMESA := SDL_GL_GetProcAddress('glWindowPos3iMESA'); + if not Assigned(glWindowPos3iMESA) then Exit; + @glWindowPos3sMESA := SDL_GL_GetProcAddress('glWindowPos3sMESA'); + if not Assigned(glWindowPos3sMESA) then Exit; + @glWindowPos3fMESA := SDL_GL_GetProcAddress('glWindowPos3fMESA'); + if not Assigned(glWindowPos3fMESA) then Exit; + @glWindowPos3dMESA := SDL_GL_GetProcAddress('glWindowPos3dMESA'); + if not Assigned(glWindowPos3dMESA) then Exit; + @glWindowPos3ivMESA := SDL_GL_GetProcAddress('glWindowPos3ivMESA'); + if not Assigned(glWindowPos3ivMESA) then Exit; + @glWindowPos3svMESA := SDL_GL_GetProcAddress('glWindowPos3svMESA'); + if not Assigned(glWindowPos3svMESA) then Exit; + @glWindowPos3fvMESA := SDL_GL_GetProcAddress('glWindowPos3fvMESA'); + if not Assigned(glWindowPos3fvMESA) then Exit; + @glWindowPos3dvMESA := SDL_GL_GetProcAddress('glWindowPos3dvMESA'); + if not Assigned(glWindowPos3dvMESA) then Exit; + @glWindowPos4iMESA := SDL_GL_GetProcAddress('glWindowPos4iMESA'); + if not Assigned(glWindowPos4iMESA) then Exit; + @glWindowPos4sMESA := SDL_GL_GetProcAddress('glWindowPos4sMESA'); + if not Assigned(glWindowPos4sMESA) then Exit; + @glWindowPos4fMESA := SDL_GL_GetProcAddress('glWindowPos4fMESA'); + if not Assigned(glWindowPos4fMESA) then Exit; + @glWindowPos4dMESA := SDL_GL_GetProcAddress('glWindowPos4dMESA'); + if not Assigned(glWindowPos4dMESA) then Exit; + @glWindowPos4ivMESA := SDL_GL_GetProcAddress('glWindowPos4ivMESA'); + if not Assigned(glWindowPos4ivMESA) then Exit; + @glWindowPos4svMESA := SDL_GL_GetProcAddress('glWindowPos4svMESA'); + if not Assigned(glWindowPos4svMESA) then Exit; + @glWindowPos4fvMESA := SDL_GL_GetProcAddress('glWindowPos4fvMESA'); + if not Assigned(glWindowPos4fvMESA) then Exit; + @glWindowPos4dvMESA := SDL_GL_GetProcAddress('glWindowPos4dvMESA'); + if not Assigned(glWindowPos4dvMESA) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_OML_interlace: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_OML_interlace', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_OML_resample: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_OML_resample', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_OML_subsample: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_OML_subsample', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_SGIS_generate_mipmap: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGIS_generate_mipmap', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_SGIS_multisample: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGIS_multisample', extstring) then + begin + @glSampleMaskSGIS := SDL_GL_GetProcAddress('glSampleMaskSGIS'); + if not Assigned(glSampleMaskSGIS) then Exit; + @glSamplePatternSGIS := SDL_GL_GetProcAddress('glSamplePatternSGIS'); + if not Assigned(glSamplePatternSGIS) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_SGIS_pixel_texture: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGIS_pixel_texture', extstring) then + begin + @glPixelTexGenParameteriSGIS := SDL_GL_GetProcAddress('glPixelTexGenParameteriSGIS'); + if not Assigned(glPixelTexGenParameteriSGIS) then Exit; + @glPixelTexGenParameterfSGIS := SDL_GL_GetProcAddress('glPixelTexGenParameterfSGIS'); + if not Assigned(glPixelTexGenParameterfSGIS) then Exit; + @glGetPixelTexGenParameterivSGIS := SDL_GL_GetProcAddress('glGetPixelTexGenParameterivSGIS'); + if not Assigned(glGetPixelTexGenParameterivSGIS) then Exit; + @glGetPixelTexGenParameterfvSGIS := SDL_GL_GetProcAddress('glGetPixelTexGenParameterfvSGIS'); + if not Assigned(glGetPixelTexGenParameterfvSGIS) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_SGIS_texture_border_clamp: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGIS_texture_border_clamp', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_SGIS_texture_color_mask: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGIS_texture_color_mask', extstring) then + begin + @glTextureColorMaskSGIS := SDL_GL_GetProcAddress('glTextureColorMaskSGIS'); + if not Assigned(glTextureColorMaskSGIS) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_SGIS_texture_edge_clamp: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGIS_texture_edge_clamp', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_SGIS_texture_lod: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGIS_texture_lod', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_SGIS_depth_texture: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGIS_depth_texture', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_SGIX_fog_offset: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGIX_fog_offset', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_SGIX_interlace: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGIX_interlace', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_SGIX_shadow_ambient: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGIX_shadow_ambient', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_SGI_color_matrix: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGI_color_matrix', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_SGI_color_table: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGI_color_table', extstring) then + begin + @glColorTableSGI := SDL_GL_GetProcAddress('glColorTableSGI'); + if not Assigned(glColorTableSGI) then Exit; + @glCopyColorTableSGI := SDL_GL_GetProcAddress('glCopyColorTableSGI'); + if not Assigned(glCopyColorTableSGI) then Exit; + @glColorTableParameterivSGI := SDL_GL_GetProcAddress('glColorTableParameterivSGI'); + if not Assigned(glColorTableParameterivSGI) then Exit; + @glColorTableParameterfvSGI := SDL_GL_GetProcAddress('glColorTableParameterfvSGI'); + if not Assigned(glColorTableParameterfvSGI) then Exit; + @glGetColorTableSGI := SDL_GL_GetProcAddress('glGetColorTableSGI'); + if not Assigned(glGetColorTableSGI) then Exit; + @glGetColorTableParameterivSGI := SDL_GL_GetProcAddress('glGetColorTableParameterivSGI'); + if not Assigned(glGetColorTableParameterivSGI) then Exit; + @glGetColorTableParameterfvSGI := SDL_GL_GetProcAddress('glGetColorTableParameterfvSGI'); + if not Assigned(glGetColorTableParameterfvSGI) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_SGI_texture_color_table: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGI_texture_color_table', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_SUN_vertex: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SUN_vertex', extstring) then + begin + @glColor4ubVertex2fSUN := SDL_GL_GetProcAddress('glColor4ubVertex2fSUN'); + if not Assigned(glColor4ubVertex2fSUN) then Exit; + @glColor4ubVertex2fvSUN := SDL_GL_GetProcAddress('glColor4ubVertex2fvSUN'); + if not Assigned(glColor4ubVertex2fvSUN) then Exit; + @glColor4ubVertex3fSUN := SDL_GL_GetProcAddress('glColor4ubVertex3fSUN'); + if not Assigned(glColor4ubVertex3fSUN) then Exit; + @glColor4ubVertex3fvSUN := SDL_GL_GetProcAddress('glColor4ubVertex3fvSUN'); + if not Assigned(glColor4ubVertex3fvSUN) then Exit; + @glColor3fVertex3fSUN := SDL_GL_GetProcAddress('glColor3fVertex3fSUN'); + if not Assigned(glColor3fVertex3fSUN) then Exit; + @glColor3fVertex3fvSUN := SDL_GL_GetProcAddress('glColor3fVertex3fvSUN'); + if not Assigned(glColor3fVertex3fvSUN) then Exit; + @glNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glNormal3fVertex3fSUN'); + if not Assigned(glNormal3fVertex3fSUN) then Exit; + @glNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glNormal3fVertex3fvSUN'); + if not Assigned(glNormal3fVertex3fvSUN) then Exit; + @glColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glColor4fNormal3fVertex3fSUN'); + if not Assigned(glColor4fNormal3fVertex3fSUN) then Exit; + @glColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glColor4fNormal3fVertex3fvSUN'); + if not Assigned(glColor4fNormal3fVertex3fvSUN) then Exit; + @glTexCoord2fVertex3fSUN := SDL_GL_GetProcAddress('glTexCoord2fVertex3fSUN'); + if not Assigned(glTexCoord2fVertex3fSUN) then Exit; + @glTexCoord2fVertex3fvSUN := SDL_GL_GetProcAddress('glTexCoord2fVertex3fvSUN'); + if not Assigned(glTexCoord2fVertex3fvSUN) then Exit; + @glTexCoord4fVertex4fSUN := SDL_GL_GetProcAddress('glTexCoord4fVertex4fSUN'); + if not Assigned(glTexCoord4fVertex4fSUN) then Exit; + @glTexCoord4fVertex4fvSUN := SDL_GL_GetProcAddress('glTexCoord4fVertex4fvSUN'); + if not Assigned(glTexCoord4fVertex4fvSUN) then Exit; + @glTexCoord2fColor4ubVertex3fSUN := SDL_GL_GetProcAddress('glTexCoord2fColor4ubVertex3fSUN'); + if not Assigned(glTexCoord2fColor4ubVertex3fSUN) then Exit; + @glTexCoord2fColor4ubVertex3fvSUN := SDL_GL_GetProcAddress('glTexCoord2fColor4ubVertex3fvSUN'); + if not Assigned(glTexCoord2fColor4ubVertex3fvSUN) then Exit; + @glTexCoord2fColor3fVertex3fSUN := SDL_GL_GetProcAddress('glTexCoord2fColor3fVertex3fSUN'); + if not Assigned(glTexCoord2fColor3fVertex3fSUN) then Exit; + @glTexCoord2fColor3fVertex3fvSUN := SDL_GL_GetProcAddress('glTexCoord2fColor3fVertex3fvSUN'); + if not Assigned(glTexCoord2fColor3fVertex3fvSUN) then Exit; + @glTexCoord2fNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glTexCoord2fNormal3fVertex3fSUN'); + if not Assigned(glTexCoord2fNormal3fVertex3fSUN) then Exit; + @glTexCoord2fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glTexCoord2fNormal3fVertex3fvSUN'); + if not Assigned(glTexCoord2fNormal3fVertex3fvSUN) then Exit; + @glTexCoord2fColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glTexCoord2fColor4fNormal3fVertex3fSUN'); + if not Assigned(glTexCoord2fColor4fNormal3fVertex3fSUN) then Exit; + @glTexCoord2fColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glTexCoord2fColor4fNormal3fVertex3fvSUN'); + if not Assigned(glTexCoord2fColor4fNormal3fVertex3fvSUN) then Exit; + @glTexCoord4fColor4fNormal3fVertex4fSUN := SDL_GL_GetProcAddress('glTexCoord4fColor4fNormal3fVertex4fSUN'); + if not Assigned(glTexCoord4fColor4fNormal3fVertex4fSUN) then Exit; + @glTexCoord4fColor4fNormal3fVertex4fvSUN := SDL_GL_GetProcAddress('glTexCoord4fColor4fNormal3fVertex4fvSUN'); + if not Assigned(glTexCoord4fColor4fNormal3fVertex4fvSUN) then Exit; + @glReplacementCodeuiVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiVertex3fSUN'); + if not Assigned(glReplacementCodeuiVertex3fSUN) then Exit; + @glReplacementCodeuiVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiVertex3fvSUN'); + if not Assigned(glReplacementCodeuiVertex3fvSUN) then Exit; + @glReplacementCodeuiColor4ubVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiColor4ubVertex3fSUN'); + if not Assigned(glReplacementCodeuiColor4ubVertex3fSUN) then Exit; + @glReplacementCodeuiColor4ubVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiColor4ubVertex3fvSUN'); + if not Assigned(glReplacementCodeuiColor4ubVertex3fvSUN) then Exit; + @glReplacementCodeuiColor3fVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiColor3fVertex3fSUN'); + if not Assigned(glReplacementCodeuiColor3fVertex3fSUN) then Exit; + @glReplacementCodeuiColor3fVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiColor3fVertex3fvSUN'); + if not Assigned(glReplacementCodeuiColor3fVertex3fvSUN) then Exit; + @glReplacementCodeuiNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiNormal3fVertex3fSUN'); + if not Assigned(glReplacementCodeuiNormal3fVertex3fSUN) then Exit; + @glReplacementCodeuiNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiNormal3fVertex3fvSUN'); + if not Assigned(glReplacementCodeuiNormal3fVertex3fvSUN) then Exit; + @glReplacementCodeuiColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiColor4fNormal3fVertex3fSUN'); + if not Assigned(glReplacementCodeuiColor4fNormal3fVertex3fSUN) then Exit; + @glReplacementCodeuiColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiColor4fNormal3fVertex3fvSUN'); + if not Assigned(glReplacementCodeuiColor4fNormal3fVertex3fvSUN) then Exit; + @glReplacementCodeuiTexCoord2fVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiTexCoord2fVertex3fSUN'); + if not Assigned(glReplacementCodeuiTexCoord2fVertex3fSUN) then Exit; + @glReplacementCodeuiTexCoord2fVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiTexCoord2fVertex3fvSUN'); + if not Assigned(glReplacementCodeuiTexCoord2fVertex3fvSUN) then Exit; + @glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN'); + if not Assigned(glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN) then Exit; + @glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN'); + if not Assigned(glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN) then Exit; + @glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN'); + if not Assigned(glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN) then Exit; + @glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN'); + if not Assigned(glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_fragment_program: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_fragment_program', extstring) then + begin + @glProgramStringARB := SDL_GL_GetProcAddress('glProgramStringARB'); + if not Assigned(glProgramStringARB) then Exit; + @glBindProgramARB := SDL_GL_GetProcAddress('glBindProgramARB'); + if not Assigned(glBindProgramARB) then Exit; + @glDeleteProgramsARB := SDL_GL_GetProcAddress('glDeleteProgramsARB'); + if not Assigned(glDeleteProgramsARB) then Exit; + @glGenProgramsARB := SDL_GL_GetProcAddress('glGenProgramsARB'); + if not Assigned(glGenProgramsARB) then Exit; + @glProgramEnvParameter4dARB := SDL_GL_GetProcAddress('glProgramEnvParameter4dARB'); + if not Assigned(glProgramEnvParameter4dARB) then Exit; + @glProgramEnvParameter4dvARB := SDL_GL_GetProcAddress('glProgramEnvParameter4dvARB'); + if not Assigned(glProgramEnvParameter4dvARB) then Exit; + @glProgramEnvParameter4fARB := SDL_GL_GetProcAddress('glProgramEnvParameter4fARB'); + if not Assigned(glProgramEnvParameter4fARB) then Exit; + @glProgramEnvParameter4fvARB := SDL_GL_GetProcAddress('glProgramEnvParameter4fvARB'); + if not Assigned(glProgramEnvParameter4fvARB) then Exit; + @glProgramLocalParameter4dARB := SDL_GL_GetProcAddress('glProgramLocalParameter4dARB'); + if not Assigned(glProgramLocalParameter4dARB) then Exit; + @glProgramLocalParameter4dvARB := SDL_GL_GetProcAddress('glProgramLocalParameter4dvARB'); + if not Assigned(glProgramLocalParameter4dvARB) then Exit; + @glProgramLocalParameter4fARB := SDL_GL_GetProcAddress('glProgramLocalParameter4fARB'); + if not Assigned(glProgramLocalParameter4fARB) then Exit; + @glProgramLocalParameter4fvARB := SDL_GL_GetProcAddress('glProgramLocalParameter4fvARB'); + if not Assigned(glProgramLocalParameter4fvARB) then Exit; + @glGetProgramEnvParameterdvARB := SDL_GL_GetProcAddress('glGetProgramEnvParameterdvARB'); + if not Assigned(glGetProgramEnvParameterdvARB) then Exit; + @glGetProgramEnvParameterfvARB := SDL_GL_GetProcAddress('glGetProgramEnvParameterfvARB'); + if not Assigned(glGetProgramEnvParameterfvARB) then Exit; + @glGetProgramLocalParameterdvARB := SDL_GL_GetProcAddress('glGetProgramLocalParameterdvARB'); + if not Assigned(glGetProgramLocalParameterdvARB) then Exit; + @glGetProgramLocalParameterfvARB := SDL_GL_GetProcAddress('glGetProgramLocalParameterfvARB'); + if not Assigned(glGetProgramLocalParameterfvARB) then Exit; + @glGetProgramivARB := SDL_GL_GetProcAddress('glGetProgramivARB'); + if not Assigned(glGetProgramivARB) then Exit; + @glGetProgramStringARB := SDL_GL_GetProcAddress('glGetProgramStringARB'); + if not Assigned(glGetProgramStringARB) then Exit; + @glIsProgramARB := SDL_GL_GetProcAddress('glIsProgramARB'); + if not Assigned(glIsProgramARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ATI_text_fragment_shader: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_text_fragment_shader', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_APPLE_client_storage: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_APPLE_client_storage', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_APPLE_element_array: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_APPLE_element_array', extstring) then + begin + @glElementPointerAPPLE := SDL_GL_GetProcAddress('glElementPointerAPPLE'); + if not Assigned(glElementPointerAPPLE) then Exit; + @glDrawElementArrayAPPLE := SDL_GL_GetProcAddress('glDrawElementArrayAPPLE'); + if not Assigned(glDrawElementArrayAPPLE) then Exit; + @glDrawRangeElementArrayAPPLE := SDL_GL_GetProcAddress('glDrawRangeElementArrayAPPLE'); + if not Assigned(glDrawRangeElementArrayAPPLE) then Exit; + @glMultiDrawElementArrayAPPLE := SDL_GL_GetProcAddress('glMultiDrawElementArrayAPPLE'); + if not Assigned(glMultiDrawElementArrayAPPLE) then Exit; + @glMultiDrawRangeElementArrayAPPLE := SDL_GL_GetProcAddress('glMultiDrawRangeElementArrayAPPLE'); + if not Assigned(glMultiDrawRangeElementArrayAPPLE) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_APPLE_fence: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_APPLE_fence', extstring) then + begin + @glGenFencesAPPLE := SDL_GL_GetProcAddress('glGenFencesAPPLE'); + if not Assigned(glGenFencesAPPLE) then Exit; + @glDeleteFencesAPPLE := SDL_GL_GetProcAddress('glDeleteFencesAPPLE'); + if not Assigned(glDeleteFencesAPPLE) then Exit; + @glSetFenceAPPLE := SDL_GL_GetProcAddress('glSetFenceAPPLE'); + if not Assigned(glSetFenceAPPLE) then Exit; + @glIsFenceAPPLE := SDL_GL_GetProcAddress('glIsFenceAPPLE'); + if not Assigned(glIsFenceAPPLE) then Exit; + @glTestFenceAPPLE := SDL_GL_GetProcAddress('glTestFenceAPPLE'); + if not Assigned(glTestFenceAPPLE) then Exit; + @glFinishFenceAPPLE := SDL_GL_GetProcAddress('glFinishFenceAPPLE'); + if not Assigned(glFinishFenceAPPLE) then Exit; + @glTestObjectAPPLE := SDL_GL_GetProcAddress('glTestObjectAPPLE'); + if not Assigned(glTestObjectAPPLE) then Exit; + @glFinishObjectAPPLE := SDL_GL_GetProcAddress('glFinishObjectAPPLE'); + if not Assigned(glFinishObjectAPPLE) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_APPLE_vertex_array_object: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_APPLE_vertex_array_object', extstring) then + begin + @glBindVertexArrayAPPLE := SDL_GL_GetProcAddress('glBindVertexArrayAPPLE'); + if not Assigned(glBindVertexArrayAPPLE) then Exit; + @glDeleteVertexArraysAPPLE := SDL_GL_GetProcAddress('glDeleteVertexArraysAPPLE'); + if not Assigned(glDeleteVertexArraysAPPLE) then Exit; + @glGenVertexArraysAPPLE := SDL_GL_GetProcAddress('glGenVertexArraysAPPLE'); + if not Assigned(glGenVertexArraysAPPLE) then Exit; + @glIsVertexArrayAPPLE := SDL_GL_GetProcAddress('glIsVertexArrayAPPLE'); + if not Assigned(glIsVertexArrayAPPLE) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_APPLE_vertex_array_range: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_APPLE_vertex_array_range', extstring) then + begin + @glVertexArrayRangeAPPLE := SDL_GL_GetProcAddress('glVertexArrayRangeAPPLE'); + if not Assigned(glVertexArrayRangeAPPLE) then Exit; + @glFlushVertexArrayRangeAPPLE := SDL_GL_GetProcAddress('glFlushVertexArrayRangeAPPLE'); + if not Assigned(glFlushVertexArrayRangeAPPLE) then Exit; + @glVertexArrayParameteriAPPLE := SDL_GL_GetProcAddress('glVertexArrayParameteriAPPLE'); + if not Assigned(glVertexArrayParameteriAPPLE) then Exit; + Result := TRUE; + end; + +end; + +{$IFDEF WIN32} +function Load_WGL_ARB_pixel_format: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_ARB_pixel_format', extstring) then + begin + @wglGetPixelFormatAttribivARB := SDL_GL_GetProcAddress('wglGetPixelFormatAttribivARB'); + if not Assigned(wglGetPixelFormatAttribivARB) then Exit; + @wglGetPixelFormatAttribfvARB := SDL_GL_GetProcAddress('wglGetPixelFormatAttribfvARB'); + if not Assigned(wglGetPixelFormatAttribfvARB) then Exit; + @wglChoosePixelFormatARB := SDL_GL_GetProcAddress('wglChoosePixelFormatARB'); + if not Assigned(wglChoosePixelFormatARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_ARB_make_current_read: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_ARB_make_current_read', extstring) then + begin + @wglMakeContextCurrentARB := SDL_GL_GetProcAddress('wglMakeContextCurrentARB'); + if not Assigned(wglMakeContextCurrentARB) then Exit; + @wglGetCurrentReadDCARB := SDL_GL_GetProcAddress('wglGetCurrentReadDCARB'); + if not Assigned(wglGetCurrentReadDCARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_ARB_pbuffer: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_ARB_pbuffer', extstring) then + begin + @wglCreatePbufferARB := SDL_GL_GetProcAddress('wglCreatePbufferARB'); + if not Assigned(wglCreatePbufferARB) then Exit; + @wglGetPbufferDCARB := SDL_GL_GetProcAddress('wglGetPbufferDCARB'); + if not Assigned(wglGetPbufferDCARB) then Exit; + @wglReleasePbufferDCARB := SDL_GL_GetProcAddress('wglReleasePbufferDCARB'); + if not Assigned(wglReleasePbufferDCARB) then Exit; + @wglDestroyPbufferARB := SDL_GL_GetProcAddress('wglDestroyPbufferARB'); + if not Assigned(wglDestroyPbufferARB) then Exit; + @wglQueryPbufferARB := SDL_GL_GetProcAddress('wglQueryPbufferARB'); + if not Assigned(wglQueryPbufferARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_EXT_swap_control: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_EXT_swap_control', extstring) then + begin + @wglSwapIntervalEXT := SDL_GL_GetProcAddress('wglSwapIntervalEXT'); + if not Assigned(wglSwapIntervalEXT) then Exit; + @wglGetSwapIntervalEXT := SDL_GL_GetProcAddress('wglGetSwapIntervalEXT'); + if not Assigned(wglGetSwapIntervalEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_ARB_render_texture: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_ARB_render_texture', extstring) then + begin + @wglBindTexImageARB := SDL_GL_GetProcAddress('wglBindTexImageARB'); + if not Assigned(wglBindTexImageARB) then Exit; + @wglReleaseTexImageARB := SDL_GL_GetProcAddress('wglReleaseTexImageARB'); + if not Assigned(wglReleaseTexImageARB) then Exit; + @wglSetPbufferAttribARB := SDL_GL_GetProcAddress('wglSetPbufferAttribARB'); + if not Assigned(wglSetPbufferAttribARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_EXT_extensions_string: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_EXT_extensions_string', extstring) then + begin + @wglGetExtensionsStringEXT := SDL_GL_GetProcAddress('wglGetExtensionsStringEXT'); + if not Assigned(wglGetExtensionsStringEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_EXT_make_current_read: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_EXT_make_current_read', extstring) then + begin + @wglMakeContextCurrentEXT := SDL_GL_GetProcAddress('wglMakeContextCurrentEXT'); + if not Assigned(wglMakeContextCurrentEXT) then Exit; + @wglGetCurrentReadDCEXT := SDL_GL_GetProcAddress('wglGetCurrentReadDCEXT'); + if not Assigned(wglGetCurrentReadDCEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_EXT_pbuffer: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_EXT_pbuffer', extstring) then + begin + @wglCreatePbufferEXT := SDL_GL_GetProcAddress('wglCreatePbufferEXT'); + if not Assigned(wglCreatePbufferEXT) then Exit; + @wglGetPbufferDCEXT := SDL_GL_GetProcAddress('wglGetPbufferDCEXT'); + if not Assigned(wglGetPbufferDCEXT) then Exit; + @wglReleasePbufferDCEXT := SDL_GL_GetProcAddress('wglReleasePbufferDCEXT'); + if not Assigned(wglReleasePbufferDCEXT) then Exit; + @wglDestroyPbufferEXT := SDL_GL_GetProcAddress('wglDestroyPbufferEXT'); + if not Assigned(wglDestroyPbufferEXT) then Exit; + @wglQueryPbufferEXT := SDL_GL_GetProcAddress('wglQueryPbufferEXT'); + if not Assigned(wglQueryPbufferEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_EXT_pixel_format: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_EXT_pixel_format', extstring) then + begin + @wglGetPixelFormatAttribivEXT := SDL_GL_GetProcAddress('wglGetPixelFormatAttribivEXT'); + if not Assigned(wglGetPixelFormatAttribivEXT) then Exit; + @wglGetPixelFormatAttribfvEXT := SDL_GL_GetProcAddress('wglGetPixelFormatAttribfvEXT'); + if not Assigned(wglGetPixelFormatAttribfvEXT) then Exit; + @wglChoosePixelFormatEXT := SDL_GL_GetProcAddress('wglChoosePixelFormatEXT'); + if not Assigned(wglChoosePixelFormatEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_I3D_digital_video_control: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_I3D_digital_video_control', extstring) then + begin + @wglGetDigitalVideoParametersI3D := SDL_GL_GetProcAddress('wglGetDigitalVideoParametersI3D'); + if not Assigned(wglGetDigitalVideoParametersI3D) then Exit; + @wglSetDigitalVideoParametersI3D := SDL_GL_GetProcAddress('wglSetDigitalVideoParametersI3D'); + if not Assigned(wglSetDigitalVideoParametersI3D) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_I3D_gamma: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_I3D_gamma', extstring) then + begin + @wglGetGammaTableParametersI3D := SDL_GL_GetProcAddress('wglGetGammaTableParametersI3D'); + if not Assigned(wglGetGammaTableParametersI3D) then Exit; + @wglSetGammaTableParametersI3D := SDL_GL_GetProcAddress('wglSetGammaTableParametersI3D'); + if not Assigned(wglSetGammaTableParametersI3D) then Exit; + @wglGetGammaTableI3D := SDL_GL_GetProcAddress('wglGetGammaTableI3D'); + if not Assigned(wglGetGammaTableI3D) then Exit; + @wglSetGammaTableI3D := SDL_GL_GetProcAddress('wglSetGammaTableI3D'); + if not Assigned(wglSetGammaTableI3D) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_I3D_genlock: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_I3D_genlock', extstring) then + begin + @wglEnableGenlockI3D := SDL_GL_GetProcAddress('wglEnableGenlockI3D'); + if not Assigned(wglEnableGenlockI3D) then Exit; + @wglDisableGenlockI3D := SDL_GL_GetProcAddress('wglDisableGenlockI3D'); + if not Assigned(wglDisableGenlockI3D) then Exit; + @wglIsEnabledGenlockI3D := SDL_GL_GetProcAddress('wglIsEnabledGenlockI3D'); + if not Assigned(wglIsEnabledGenlockI3D) then Exit; + @wglGenlockSourceI3D := SDL_GL_GetProcAddress('wglGenlockSourceI3D'); + if not Assigned(wglGenlockSourceI3D) then Exit; + @wglGetGenlockSourceI3D := SDL_GL_GetProcAddress('wglGetGenlockSourceI3D'); + if not Assigned(wglGetGenlockSourceI3D) then Exit; + @wglGenlockSourceEdgeI3D := SDL_GL_GetProcAddress('wglGenlockSourceEdgeI3D'); + if not Assigned(wglGenlockSourceEdgeI3D) then Exit; + @wglGetGenlockSourceEdgeI3D := SDL_GL_GetProcAddress('wglGetGenlockSourceEdgeI3D'); + if not Assigned(wglGetGenlockSourceEdgeI3D) then Exit; + @wglGenlockSampleRateI3D := SDL_GL_GetProcAddress('wglGenlockSampleRateI3D'); + if not Assigned(wglGenlockSampleRateI3D) then Exit; + @wglGetGenlockSampleRateI3D := SDL_GL_GetProcAddress('wglGetGenlockSampleRateI3D'); + if not Assigned(wglGetGenlockSampleRateI3D) then Exit; + @wglGenlockSourceDelayI3D := SDL_GL_GetProcAddress('wglGenlockSourceDelayI3D'); + if not Assigned(wglGenlockSourceDelayI3D) then Exit; + @wglGetGenlockSourceDelayI3D := SDL_GL_GetProcAddress('wglGetGenlockSourceDelayI3D'); + if not Assigned(wglGetGenlockSourceDelayI3D) then Exit; + @wglQueryGenlockMaxSourceDelayI3D := SDL_GL_GetProcAddress('wglQueryGenlockMaxSourceDelayI3D'); + if not Assigned(wglQueryGenlockMaxSourceDelayI3D) then Exit; + Result := TRUE; + end; + +end; +{$ENDIF} + +function Load_GL_ARB_matrix_palette: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_matrix_palette', extstring) then + begin + @glCurrentPaletteMatrixARB := SDL_GL_GetProcAddress('glCurrentPaletteMatrixARB'); + if not Assigned(glCurrentPaletteMatrixARB) then Exit; + @glMatrixIndexubvARB := SDL_GL_GetProcAddress('glMatrixIndexubvARB'); + if not Assigned(glMatrixIndexubvARB) then Exit; + @glMatrixIndexusvARB := SDL_GL_GetProcAddress('glMatrixIndexusvARB'); + if not Assigned(glMatrixIndexusvARB) then Exit; + @glMatrixIndexuivARB := SDL_GL_GetProcAddress('glMatrixIndexuivARB'); + if not Assigned(glMatrixIndexuivARB) then Exit; + @glMatrixIndexPointerARB := SDL_GL_GetProcAddress('glMatrixIndexPointerARB'); + if not Assigned(glMatrixIndexPointerARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_element_array: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_element_array', extstring) then + begin + @glElementPointerNV := SDL_GL_GetProcAddress('glElementPointerNV'); + if not Assigned(glElementPointerNV) then Exit; + @glDrawElementArrayNV := SDL_GL_GetProcAddress('glDrawElementArrayNV'); + if not Assigned(glDrawElementArrayNV) then Exit; + @glDrawRangeElementArrayNV := SDL_GL_GetProcAddress('glDrawRangeElementArrayNV'); + if not Assigned(glDrawRangeElementArrayNV) then Exit; + @glMultiDrawElementArrayNV := SDL_GL_GetProcAddress('glMultiDrawElementArrayNV'); + if not Assigned(glMultiDrawElementArrayNV) then Exit; + @glMultiDrawRangeElementArrayNV := SDL_GL_GetProcAddress('glMultiDrawRangeElementArrayNV'); + if not Assigned(glMultiDrawRangeElementArrayNV) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_float_buffer: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_float_buffer', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_fragment_program: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_fragment_program', extstring) then + begin + @glProgramNamedParameter4fNV := SDL_GL_GetProcAddress('glProgramNamedParameter4fNV'); + if not Assigned(glProgramNamedParameter4fNV) then Exit; + @glProgramNamedParameter4dNV := SDL_GL_GetProcAddress('glProgramNamedParameter4dNV'); + if not Assigned(glProgramNamedParameter4dNV) then Exit; + @glGetProgramNamedParameterfvNV := SDL_GL_GetProcAddress('glGetProgramNamedParameterfvNV'); + if not Assigned(glGetProgramNamedParameterfvNV) then Exit; + @glGetProgramNamedParameterdvNV := SDL_GL_GetProcAddress('glGetProgramNamedParameterdvNV'); + if not Assigned(glGetProgramNamedParameterdvNV) then Exit; + @glProgramLocalParameter4dARB := SDL_GL_GetProcAddress('glProgramLocalParameter4dARB'); + if not Assigned(glProgramLocalParameter4dARB) then Exit; + @glProgramLocalParameter4dvARB := SDL_GL_GetProcAddress('glProgramLocalParameter4dvARB'); + if not Assigned(glProgramLocalParameter4dvARB) then Exit; + @glProgramLocalParameter4fARB := SDL_GL_GetProcAddress('glProgramLocalParameter4fARB'); + if not Assigned(glProgramLocalParameter4fARB) then Exit; + @glProgramLocalParameter4fvARB := SDL_GL_GetProcAddress('glProgramLocalParameter4fvARB'); + if not Assigned(glProgramLocalParameter4fvARB) then Exit; + @glGetProgramLocalParameterdvARB := SDL_GL_GetProcAddress('glGetProgramLocalParameterdvARB'); + if not Assigned(glGetProgramLocalParameterdvARB) then Exit; + @glGetProgramLocalParameterfvARB := SDL_GL_GetProcAddress('glGetProgramLocalParameterfvARB'); + if not Assigned(glGetProgramLocalParameterfvARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_primitive_restart: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_primitive_restart', extstring) then + begin + @glPrimitiveRestartNV := SDL_GL_GetProcAddress('glPrimitiveRestartNV'); + if not Assigned(glPrimitiveRestartNV) then Exit; + @glPrimitiveRestartIndexNV := SDL_GL_GetProcAddress('glPrimitiveRestartIndexNV'); + if not Assigned(glPrimitiveRestartIndexNV) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_vertex_program2: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_vertex_program2', extstring) then + begin + Result := TRUE; + end; + +end; + +{$IFDEF WIN32} +function Load_WGL_NV_render_texture_rectangle: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_NV_render_texture_rectangle', extstring) then + begin + Result := TRUE; + end; + +end; +{$ENDIF} + +function Load_GL_NV_pixel_data_range: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_pixel_data_range', extstring) then + begin + @glPixelDataRangeNV := SDL_GL_GetProcAddress('glPixelDataRangeNV'); + if not Assigned(glPixelDataRangeNV) then Exit; + @glFlushPixelDataRangeNV := SDL_GL_GetProcAddress('glFlushPixelDataRangeNV'); + if not Assigned(glFlushPixelDataRangeNV) then Exit; + {$IFDEF WIN32} + @wglAllocateMemoryNV := SDL_GL_GetProcAddress('wglAllocateMemoryNV'); + if not Assigned(wglAllocateMemoryNV) then Exit; + @wglFreeMemoryNV := SDL_GL_GetProcAddress('wglFreeMemoryNV'); + if not Assigned(wglFreeMemoryNV) then Exit; + {$ENDIF} + Result := TRUE; + end; + +end; + +function Load_GL_EXT_texture_rectangle: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_texture_rectangle', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_S3_s3tc: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_S3_s3tc', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ATI_draw_buffers: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_draw_buffers', extstring) then + begin + @glDrawBuffersATI := SDL_GL_GetProcAddress('glDrawBuffersATI'); + if not Assigned(glDrawBuffersATI) then Exit; + Result := TRUE; + end; + +end; + +{$IFDEF WIN32} +function Load_WGL_ATI_pixel_format_float: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_ATI_pixel_format_float', extstring) then + begin + Result := TRUE; + end; + +end; +{$ENDIF} + +function Load_GL_ATI_texture_env_combine3: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_texture_env_combine3', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ATI_texture_float: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_texture_float', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_texture_expand_normal: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_texture_expand_normal', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_half_float: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_half_float', extstring) then + begin + @glVertex2hNV := SDL_GL_GetProcAddress('glVertex2hNV'); + if not Assigned(glVertex2hNV) then Exit; + @glVertex2hvNV := SDL_GL_GetProcAddress('glVertex2hvNV'); + if not Assigned(glVertex2hvNV) then Exit; + @glVertex3hNV := SDL_GL_GetProcAddress('glVertex3hNV'); + if not Assigned(glVertex3hNV) then Exit; + @glVertex3hvNV := SDL_GL_GetProcAddress('glVertex3hvNV'); + if not Assigned(glVertex3hvNV) then Exit; + @glVertex4hNV := SDL_GL_GetProcAddress('glVertex4hNV'); + if not Assigned(glVertex4hNV) then Exit; + @glVertex4hvNV := SDL_GL_GetProcAddress('glVertex4hvNV'); + if not Assigned(glVertex4hvNV) then Exit; + @glNormal3hNV := SDL_GL_GetProcAddress('glNormal3hNV'); + if not Assigned(glNormal3hNV) then Exit; + @glNormal3hvNV := SDL_GL_GetProcAddress('glNormal3hvNV'); + if not Assigned(glNormal3hvNV) then Exit; + @glColor3hNV := SDL_GL_GetProcAddress('glColor3hNV'); + if not Assigned(glColor3hNV) then Exit; + @glColor3hvNV := SDL_GL_GetProcAddress('glColor3hvNV'); + if not Assigned(glColor3hvNV) then Exit; + @glColor4hNV := SDL_GL_GetProcAddress('glColor4hNV'); + if not Assigned(glColor4hNV) then Exit; + @glColor4hvNV := SDL_GL_GetProcAddress('glColor4hvNV'); + if not Assigned(glColor4hvNV) then Exit; + @glTexCoord1hNV := SDL_GL_GetProcAddress('glTexCoord1hNV'); + if not Assigned(glTexCoord1hNV) then Exit; + @glTexCoord1hvNV := SDL_GL_GetProcAddress('glTexCoord1hvNV'); + if not Assigned(glTexCoord1hvNV) then Exit; + @glTexCoord2hNV := SDL_GL_GetProcAddress('glTexCoord2hNV'); + if not Assigned(glTexCoord2hNV) then Exit; + @glTexCoord2hvNV := SDL_GL_GetProcAddress('glTexCoord2hvNV'); + if not Assigned(glTexCoord2hvNV) then Exit; + @glTexCoord3hNV := SDL_GL_GetProcAddress('glTexCoord3hNV'); + if not Assigned(glTexCoord3hNV) then Exit; + @glTexCoord3hvNV := SDL_GL_GetProcAddress('glTexCoord3hvNV'); + if not Assigned(glTexCoord3hvNV) then Exit; + @glTexCoord4hNV := SDL_GL_GetProcAddress('glTexCoord4hNV'); + if not Assigned(glTexCoord4hNV) then Exit; + @glTexCoord4hvNV := SDL_GL_GetProcAddress('glTexCoord4hvNV'); + if not Assigned(glTexCoord4hvNV) then Exit; + @glMultiTexCoord1hNV := SDL_GL_GetProcAddress('glMultiTexCoord1hNV'); + if not Assigned(glMultiTexCoord1hNV) then Exit; + @glMultiTexCoord1hvNV := SDL_GL_GetProcAddress('glMultiTexCoord1hvNV'); + if not Assigned(glMultiTexCoord1hvNV) then Exit; + @glMultiTexCoord2hNV := SDL_GL_GetProcAddress('glMultiTexCoord2hNV'); + if not Assigned(glMultiTexCoord2hNV) then Exit; + @glMultiTexCoord2hvNV := SDL_GL_GetProcAddress('glMultiTexCoord2hvNV'); + if not Assigned(glMultiTexCoord2hvNV) then Exit; + @glMultiTexCoord3hNV := SDL_GL_GetProcAddress('glMultiTexCoord3hNV'); + if not Assigned(glMultiTexCoord3hNV) then Exit; + @glMultiTexCoord3hvNV := SDL_GL_GetProcAddress('glMultiTexCoord3hvNV'); + if not Assigned(glMultiTexCoord3hvNV) then Exit; + @glMultiTexCoord4hNV := SDL_GL_GetProcAddress('glMultiTexCoord4hNV'); + if not Assigned(glMultiTexCoord4hNV) then Exit; + @glMultiTexCoord4hvNV := SDL_GL_GetProcAddress('glMultiTexCoord4hvNV'); + if not Assigned(glMultiTexCoord4hvNV) then Exit; + @glFogCoordhNV := SDL_GL_GetProcAddress('glFogCoordhNV'); + if not Assigned(glFogCoordhNV) then Exit; + @glFogCoordhvNV := SDL_GL_GetProcAddress('glFogCoordhvNV'); + if not Assigned(glFogCoordhvNV) then Exit; + @glSecondaryColor3hNV := SDL_GL_GetProcAddress('glSecondaryColor3hNV'); + if not Assigned(glSecondaryColor3hNV) then Exit; + @glSecondaryColor3hvNV := SDL_GL_GetProcAddress('glSecondaryColor3hvNV'); + if not Assigned(glSecondaryColor3hvNV) then Exit; + @glVertexWeighthNV := SDL_GL_GetProcAddress('glVertexWeighthNV'); + if not Assigned(glVertexWeighthNV) then Exit; + @glVertexWeighthvNV := SDL_GL_GetProcAddress('glVertexWeighthvNV'); + if not Assigned(glVertexWeighthvNV) then Exit; + @glVertexAttrib1hNV := SDL_GL_GetProcAddress('glVertexAttrib1hNV'); + if not Assigned(glVertexAttrib1hNV) then Exit; + @glVertexAttrib1hvNV := SDL_GL_GetProcAddress('glVertexAttrib1hvNV'); + if not Assigned(glVertexAttrib1hvNV) then Exit; + @glVertexAttrib2hNV := SDL_GL_GetProcAddress('glVertexAttrib2hNV'); + if not Assigned(glVertexAttrib2hNV) then Exit; + @glVertexAttrib2hvNV := SDL_GL_GetProcAddress('glVertexAttrib2hvNV'); + if not Assigned(glVertexAttrib2hvNV) then Exit; + @glVertexAttrib3hNV := SDL_GL_GetProcAddress('glVertexAttrib3hNV'); + if not Assigned(glVertexAttrib3hNV) then Exit; + @glVertexAttrib3hvNV := SDL_GL_GetProcAddress('glVertexAttrib3hvNV'); + if not Assigned(glVertexAttrib3hvNV) then Exit; + @glVertexAttrib4hNV := SDL_GL_GetProcAddress('glVertexAttrib4hNV'); + if not Assigned(glVertexAttrib4hNV) then Exit; + @glVertexAttrib4hvNV := SDL_GL_GetProcAddress('glVertexAttrib4hvNV'); + if not Assigned(glVertexAttrib4hvNV) then Exit; + @glVertexAttribs1hvNV := SDL_GL_GetProcAddress('glVertexAttribs1hvNV'); + if not Assigned(glVertexAttribs1hvNV) then Exit; + @glVertexAttribs2hvNV := SDL_GL_GetProcAddress('glVertexAttribs2hvNV'); + if not Assigned(glVertexAttribs2hvNV) then Exit; + @glVertexAttribs3hvNV := SDL_GL_GetProcAddress('glVertexAttribs3hvNV'); + if not Assigned(glVertexAttribs3hvNV) then Exit; + @glVertexAttribs4hvNV := SDL_GL_GetProcAddress('glVertexAttribs4hvNV'); + if not Assigned(glVertexAttribs4hvNV) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ATI_map_object_buffer: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_map_object_buffer', extstring) then + begin + @glMapObjectBufferATI := SDL_GL_GetProcAddress('glMapObjectBufferATI'); + if not Assigned(glMapObjectBufferATI) then Exit; + @glUnmapObjectBufferATI := SDL_GL_GetProcAddress('glUnmapObjectBufferATI'); + if not Assigned(glUnmapObjectBufferATI) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ATI_separate_stencil: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_separate_stencil', extstring) then + begin + @glStencilOpSeparateATI := SDL_GL_GetProcAddress('glStencilOpSeparateATI'); + if not Assigned(glStencilOpSeparateATI) then Exit; + @glStencilFuncSeparateATI := SDL_GL_GetProcAddress('glStencilFuncSeparateATI'); + if not Assigned(glStencilFuncSeparateATI) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ATI_vertex_attrib_array_object: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_vertex_attrib_array_object', extstring) then + begin + @glVertexAttribArrayObjectATI := SDL_GL_GetProcAddress('glVertexAttribArrayObjectATI'); + if not Assigned(glVertexAttribArrayObjectATI) then Exit; + @glGetVertexAttribArrayObjectfvATI := SDL_GL_GetProcAddress('glGetVertexAttribArrayObjectfvATI'); + if not Assigned(glGetVertexAttribArrayObjectfvATI) then Exit; + @glGetVertexAttribArrayObjectivATI := SDL_GL_GetProcAddress('glGetVertexAttribArrayObjectivATI'); + if not Assigned(glGetVertexAttribArrayObjectivATI) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_vertex_buffer_object: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_vertex_buffer_object', extstring) then + begin + @glBindBufferARB := SDL_GL_GetProcAddress('glBindBufferARB'); + if not Assigned(glBindBufferARB) then Exit; + @glDeleteBuffersARB := SDL_GL_GetProcAddress('glDeleteBuffersARB'); + if not Assigned(glDeleteBuffersARB) then Exit; + @glGenBuffersARB := SDL_GL_GetProcAddress('glGenBuffersARB'); + if not Assigned(glGenBuffersARB) then Exit; + @glIsBufferARB := SDL_GL_GetProcAddress('glIsBufferARB'); + if not Assigned(glIsBufferARB) then Exit; + @glBufferDataARB := SDL_GL_GetProcAddress('glBufferDataARB'); + if not Assigned(glBufferDataARB) then Exit; + @glBufferSubDataARB := SDL_GL_GetProcAddress('glBufferSubDataARB'); + if not Assigned(glBufferSubDataARB) then Exit; + @glGetBufferSubDataARB := SDL_GL_GetProcAddress('glGetBufferSubDataARB'); + if not Assigned(glGetBufferSubDataARB) then Exit; + @glMapBufferARB := SDL_GL_GetProcAddress('glMapBufferARB'); + if not Assigned(glMapBufferARB) then Exit; + @glUnmapBufferARB := SDL_GL_GetProcAddress('glUnmapBufferARB'); + if not Assigned(glUnmapBufferARB) then Exit; + @glGetBufferParameterivARB := SDL_GL_GetProcAddress('glGetBufferParameterivARB'); + if not Assigned(glGetBufferParameterivARB) then Exit; + @glGetBufferPointervARB := SDL_GL_GetProcAddress('glGetBufferPointervARB'); + if not Assigned(glGetBufferPointervARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_occlusion_query: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_occlusion_query', extstring) then + begin + @glGenQueriesARB := SDL_GL_GetProcAddress('glGenQueriesARB'); + if not Assigned(glGenQueriesARB) then Exit; + @glDeleteQueriesARB := SDL_GL_GetProcAddress('glDeleteQueriesARB'); + if not Assigned(glDeleteQueriesARB) then Exit; + @glIsQueryARB := SDL_GL_GetProcAddress('glIsQueryARB'); + if not Assigned(glIsQueryARB) then Exit; + @glBeginQueryARB := SDL_GL_GetProcAddress('glBeginQueryARB'); + if not Assigned(glBeginQueryARB) then Exit; + @glEndQueryARB := SDL_GL_GetProcAddress('glEndQueryARB'); + if not Assigned(glEndQueryARB) then Exit; + @glGetQueryivARB := SDL_GL_GetProcAddress('glGetQueryivARB'); + if not Assigned(glGetQueryivARB) then Exit; + @glGetQueryObjectivARB := SDL_GL_GetProcAddress('glGetQueryObjectivARB'); + if not Assigned(glGetQueryObjectivARB) then Exit; + @glGetQueryObjectuivARB := SDL_GL_GetProcAddress('glGetQueryObjectuivARB'); + if not Assigned(glGetQueryObjectuivARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_shader_objects: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_shader_objects', extstring) then + begin + @glDeleteObjectARB := SDL_GL_GetProcAddress('glDeleteObjectARB'); + if not Assigned(glDeleteObjectARB) then Exit; + @glGetHandleARB := SDL_GL_GetProcAddress('glGetHandleARB'); + if not Assigned(glGetHandleARB) then Exit; + @glDetachObjectARB := SDL_GL_GetProcAddress('glDetachObjectARB'); + if not Assigned(glDetachObjectARB) then Exit; + @glCreateShaderObjectARB := SDL_GL_GetProcAddress('glCreateShaderObjectARB'); + if not Assigned(glCreateShaderObjectARB) then Exit; + @glShaderSourceARB := SDL_GL_GetProcAddress('glShaderSourceARB'); + if not Assigned(glShaderSourceARB) then Exit; + @glCompileShaderARB := SDL_GL_GetProcAddress('glCompileShaderARB'); + if not Assigned(glCompileShaderARB) then Exit; + @glCreateProgramObjectARB := SDL_GL_GetProcAddress('glCreateProgramObjectARB'); + if not Assigned(glCreateProgramObjectARB) then Exit; + @glAttachObjectARB := SDL_GL_GetProcAddress('glAttachObjectARB'); + if not Assigned(glAttachObjectARB) then Exit; + @glLinkProgramARB := SDL_GL_GetProcAddress('glLinkProgramARB'); + if not Assigned(glLinkProgramARB) then Exit; + @glUseProgramObjectARB := SDL_GL_GetProcAddress('glUseProgramObjectARB'); + if not Assigned(glUseProgramObjectARB) then Exit; + @glValidateProgramARB := SDL_GL_GetProcAddress('glValidateProgramARB'); + if not Assigned(glValidateProgramARB) then Exit; + @glUniform1fARB := SDL_GL_GetProcAddress('glUniform1fARB'); + if not Assigned(glUniform1fARB) then Exit; + @glUniform2fARB := SDL_GL_GetProcAddress('glUniform2fARB'); + if not Assigned(glUniform2fARB) then Exit; + @glUniform3fARB := SDL_GL_GetProcAddress('glUniform3fARB'); + if not Assigned(glUniform3fARB) then Exit; + @glUniform4fARB := SDL_GL_GetProcAddress('glUniform4fARB'); + if not Assigned(glUniform4fARB) then Exit; + @glUniform1iARB := SDL_GL_GetProcAddress('glUniform1iARB'); + if not Assigned(glUniform1iARB) then Exit; + @glUniform2iARB := SDL_GL_GetProcAddress('glUniform2iARB'); + if not Assigned(glUniform2iARB) then Exit; + @glUniform3iARB := SDL_GL_GetProcAddress('glUniform3iARB'); + if not Assigned(glUniform3iARB) then Exit; + @glUniform4iARB := SDL_GL_GetProcAddress('glUniform4iARB'); + if not Assigned(glUniform4iARB) then Exit; + @glUniform1fvARB := SDL_GL_GetProcAddress('glUniform1fvARB'); + if not Assigned(glUniform1fvARB) then Exit; + @glUniform2fvARB := SDL_GL_GetProcAddress('glUniform2fvARB'); + if not Assigned(glUniform2fvARB) then Exit; + @glUniform3fvARB := SDL_GL_GetProcAddress('glUniform3fvARB'); + if not Assigned(glUniform3fvARB) then Exit; + @glUniform4fvARB := SDL_GL_GetProcAddress('glUniform4fvARB'); + if not Assigned(glUniform4fvARB) then Exit; + @glUniform1ivARB := SDL_GL_GetProcAddress('glUniform1ivARB'); + if not Assigned(glUniform1ivARB) then Exit; + @glUniform2ivARB := SDL_GL_GetProcAddress('glUniform2ivARB'); + if not Assigned(glUniform2ivARB) then Exit; + @glUniform3ivARB := SDL_GL_GetProcAddress('glUniform3ivARB'); + if not Assigned(glUniform3ivARB) then Exit; + @glUniform4ivARB := SDL_GL_GetProcAddress('glUniform4ivARB'); + if not Assigned(glUniform4ivARB) then Exit; + @glUniformMatrix2fvARB := SDL_GL_GetProcAddress('glUniformMatrix2fvARB'); + if not Assigned(glUniformMatrix2fvARB) then Exit; + @glUniformMatrix3fvARB := SDL_GL_GetProcAddress('glUniformMatrix3fvARB'); + if not Assigned(glUniformMatrix3fvARB) then Exit; + @glUniformMatrix4fvARB := SDL_GL_GetProcAddress('glUniformMatrix4fvARB'); + if not Assigned(glUniformMatrix4fvARB) then Exit; + @glGetObjectParameterfvARB := SDL_GL_GetProcAddress('glGetObjectParameterfvARB'); + if not Assigned(glGetObjectParameterfvARB) then Exit; + @glGetObjectParameterivARB := SDL_GL_GetProcAddress('glGetObjectParameterivARB'); + if not Assigned(glGetObjectParameterivARB) then Exit; + @glGetInfoLogARB := SDL_GL_GetProcAddress('glGetInfoLogARB'); + if not Assigned(glGetInfoLogARB) then Exit; + @glGetAttachedObjectsARB := SDL_GL_GetProcAddress('glGetAttachedObjectsARB'); + if not Assigned(glGetAttachedObjectsARB) then Exit; + @glGetUniformLocationARB := SDL_GL_GetProcAddress('glGetUniformLocationARB'); + if not Assigned(glGetUniformLocationARB) then Exit; + @glGetActiveUniformARB := SDL_GL_GetProcAddress('glGetActiveUniformARB'); + if not Assigned(glGetActiveUniformARB) then Exit; + @glGetUniformfvARB := SDL_GL_GetProcAddress('glGetUniformfvARB'); + if not Assigned(glGetUniformfvARB) then Exit; + @glGetUniformivARB := SDL_GL_GetProcAddress('glGetUniformivARB'); + if not Assigned(glGetUniformivARB) then Exit; + @glGetShaderSourceARB := SDL_GL_GetProcAddress('glGetShaderSourceARB'); + if not Assigned(glGetShaderSourceARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_vertex_shader: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_vertex_shader', extstring) then + begin + @glVertexAttrib1fARB := SDL_GL_GetProcAddress('glVertexAttrib1fARB'); + if not Assigned(glVertexAttrib1fARB) then Exit; + @glVertexAttrib1sARB := SDL_GL_GetProcAddress('glVertexAttrib1sARB'); + if not Assigned(glVertexAttrib1sARB) then Exit; + @glVertexAttrib1dARB := SDL_GL_GetProcAddress('glVertexAttrib1dARB'); + if not Assigned(glVertexAttrib1dARB) then Exit; + @glVertexAttrib2fARB := SDL_GL_GetProcAddress('glVertexAttrib2fARB'); + if not Assigned(glVertexAttrib2fARB) then Exit; + @glVertexAttrib2sARB := SDL_GL_GetProcAddress('glVertexAttrib2sARB'); + if not Assigned(glVertexAttrib2sARB) then Exit; + @glVertexAttrib2dARB := SDL_GL_GetProcAddress('glVertexAttrib2dARB'); + if not Assigned(glVertexAttrib2dARB) then Exit; + @glVertexAttrib3fARB := SDL_GL_GetProcAddress('glVertexAttrib3fARB'); + if not Assigned(glVertexAttrib3fARB) then Exit; + @glVertexAttrib3sARB := SDL_GL_GetProcAddress('glVertexAttrib3sARB'); + if not Assigned(glVertexAttrib3sARB) then Exit; + @glVertexAttrib3dARB := SDL_GL_GetProcAddress('glVertexAttrib3dARB'); + if not Assigned(glVertexAttrib3dARB) then Exit; + @glVertexAttrib4fARB := SDL_GL_GetProcAddress('glVertexAttrib4fARB'); + if not Assigned(glVertexAttrib4fARB) then Exit; + @glVertexAttrib4sARB := SDL_GL_GetProcAddress('glVertexAttrib4sARB'); + if not Assigned(glVertexAttrib4sARB) then Exit; + @glVertexAttrib4dARB := SDL_GL_GetProcAddress('glVertexAttrib4dARB'); + if not Assigned(glVertexAttrib4dARB) then Exit; + @glVertexAttrib4NubARB := SDL_GL_GetProcAddress('glVertexAttrib4NubARB'); + if not Assigned(glVertexAttrib4NubARB) then Exit; + @glVertexAttrib1fvARB := SDL_GL_GetProcAddress('glVertexAttrib1fvARB'); + if not Assigned(glVertexAttrib1fvARB) then Exit; + @glVertexAttrib1svARB := SDL_GL_GetProcAddress('glVertexAttrib1svARB'); + if not Assigned(glVertexAttrib1svARB) then Exit; + @glVertexAttrib1dvARB := SDL_GL_GetProcAddress('glVertexAttrib1dvARB'); + if not Assigned(glVertexAttrib1dvARB) then Exit; + @glVertexAttrib2fvARB := SDL_GL_GetProcAddress('glVertexAttrib2fvARB'); + if not Assigned(glVertexAttrib2fvARB) then Exit; + @glVertexAttrib2svARB := SDL_GL_GetProcAddress('glVertexAttrib2svARB'); + if not Assigned(glVertexAttrib2svARB) then Exit; + @glVertexAttrib2dvARB := SDL_GL_GetProcAddress('glVertexAttrib2dvARB'); + if not Assigned(glVertexAttrib2dvARB) then Exit; + @glVertexAttrib3fvARB := SDL_GL_GetProcAddress('glVertexAttrib3fvARB'); + if not Assigned(glVertexAttrib3fvARB) then Exit; + @glVertexAttrib3svARB := SDL_GL_GetProcAddress('glVertexAttrib3svARB'); + if not Assigned(glVertexAttrib3svARB) then Exit; + @glVertexAttrib3dvARB := SDL_GL_GetProcAddress('glVertexAttrib3dvARB'); + if not Assigned(glVertexAttrib3dvARB) then Exit; + @glVertexAttrib4fvARB := SDL_GL_GetProcAddress('glVertexAttrib4fvARB'); + if not Assigned(glVertexAttrib4fvARB) then Exit; + @glVertexAttrib4svARB := SDL_GL_GetProcAddress('glVertexAttrib4svARB'); + if not Assigned(glVertexAttrib4svARB) then Exit; + @glVertexAttrib4dvARB := SDL_GL_GetProcAddress('glVertexAttrib4dvARB'); + if not Assigned(glVertexAttrib4dvARB) then Exit; + @glVertexAttrib4ivARB := SDL_GL_GetProcAddress('glVertexAttrib4ivARB'); + if not Assigned(glVertexAttrib4ivARB) then Exit; + @glVertexAttrib4bvARB := SDL_GL_GetProcAddress('glVertexAttrib4bvARB'); + if not Assigned(glVertexAttrib4bvARB) then Exit; + @glVertexAttrib4ubvARB := SDL_GL_GetProcAddress('glVertexAttrib4ubvARB'); + if not Assigned(glVertexAttrib4ubvARB) then Exit; + @glVertexAttrib4usvARB := SDL_GL_GetProcAddress('glVertexAttrib4usvARB'); + if not Assigned(glVertexAttrib4usvARB) then Exit; + @glVertexAttrib4uivARB := SDL_GL_GetProcAddress('glVertexAttrib4uivARB'); + if not Assigned(glVertexAttrib4uivARB) then Exit; + @glVertexAttrib4NbvARB := SDL_GL_GetProcAddress('glVertexAttrib4NbvARB'); + if not Assigned(glVertexAttrib4NbvARB) then Exit; + @glVertexAttrib4NsvARB := SDL_GL_GetProcAddress('glVertexAttrib4NsvARB'); + if not Assigned(glVertexAttrib4NsvARB) then Exit; + @glVertexAttrib4NivARB := SDL_GL_GetProcAddress('glVertexAttrib4NivARB'); + if not Assigned(glVertexAttrib4NivARB) then Exit; + @glVertexAttrib4NubvARB := SDL_GL_GetProcAddress('glVertexAttrib4NubvARB'); + if not Assigned(glVertexAttrib4NubvARB) then Exit; + @glVertexAttrib4NusvARB := SDL_GL_GetProcAddress('glVertexAttrib4NusvARB'); + if not Assigned(glVertexAttrib4NusvARB) then Exit; + @glVertexAttrib4NuivARB := SDL_GL_GetProcAddress('glVertexAttrib4NuivARB'); + if not Assigned(glVertexAttrib4NuivARB) then Exit; + @glVertexAttribPointerARB := SDL_GL_GetProcAddress('glVertexAttribPointerARB'); + if not Assigned(glVertexAttribPointerARB) then Exit; + @glEnableVertexAttribArrayARB := SDL_GL_GetProcAddress('glEnableVertexAttribArrayARB'); + if not Assigned(glEnableVertexAttribArrayARB) then Exit; + @glDisableVertexAttribArrayARB := SDL_GL_GetProcAddress('glDisableVertexAttribArrayARB'); + if not Assigned(glDisableVertexAttribArrayARB) then Exit; + @glBindAttribLocationARB := SDL_GL_GetProcAddress('glBindAttribLocationARB'); + if not Assigned(glBindAttribLocationARB) then Exit; + @glGetActiveAttribARB := SDL_GL_GetProcAddress('glGetActiveAttribARB'); + if not Assigned(glGetActiveAttribARB) then Exit; + @glGetAttribLocationARB := SDL_GL_GetProcAddress('glGetAttribLocationARB'); + if not Assigned(glGetAttribLocationARB) then Exit; + @glGetVertexAttribdvARB := SDL_GL_GetProcAddress('glGetVertexAttribdvARB'); + if not Assigned(glGetVertexAttribdvARB) then Exit; + @glGetVertexAttribfvARB := SDL_GL_GetProcAddress('glGetVertexAttribfvARB'); + if not Assigned(glGetVertexAttribfvARB) then Exit; + @glGetVertexAttribivARB := SDL_GL_GetProcAddress('glGetVertexAttribivARB'); + if not Assigned(glGetVertexAttribivARB) then Exit; + @glGetVertexAttribPointervARB := SDL_GL_GetProcAddress('glGetVertexAttribPointervARB'); + if not Assigned(glGetVertexAttribPointervARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_fragment_shader: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_fragment_shader', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_shading_language_100: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_shading_language_100', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_texture_non_power_of_two: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_texture_non_power_of_two', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_point_sprite: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_point_sprite', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_depth_bounds_test: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_depth_bounds_test', extstring) then + begin + @glDepthBoundsEXT := SDL_GL_GetProcAddress('glDepthBoundsEXT'); + if not Assigned(glDepthBoundsEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_secondary_color: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_secondary_color', extstring) then + begin + @glSecondaryColor3bEXT := SDL_GL_GetProcAddress('glSecondaryColor3bEXT'); + if not Assigned(glSecondaryColor3bEXT) then Exit; + @glSecondaryColor3sEXT := SDL_GL_GetProcAddress('glSecondaryColor3sEXT'); + if not Assigned(glSecondaryColor3sEXT) then Exit; + @glSecondaryColor3iEXT := SDL_GL_GetProcAddress('glSecondaryColor3iEXT'); + if not Assigned(glSecondaryColor3iEXT) then Exit; + @glSecondaryColor3fEXT := SDL_GL_GetProcAddress('glSecondaryColor3fEXT'); + if not Assigned(glSecondaryColor3fEXT) then Exit; + @glSecondaryColor3dEXT := SDL_GL_GetProcAddress('glSecondaryColor3dEXT'); + if not Assigned(glSecondaryColor3dEXT) then Exit; + @glSecondaryColor3ubEXT := SDL_GL_GetProcAddress('glSecondaryColor3ubEXT'); + if not Assigned(glSecondaryColor3ubEXT) then Exit; + @glSecondaryColor3usEXT := SDL_GL_GetProcAddress('glSecondaryColor3usEXT'); + if not Assigned(glSecondaryColor3usEXT) then Exit; + @glSecondaryColor3uiEXT := SDL_GL_GetProcAddress('glSecondaryColor3uiEXT'); + if not Assigned(glSecondaryColor3uiEXT) then Exit; + @glSecondaryColor3bvEXT := SDL_GL_GetProcAddress('glSecondaryColor3bvEXT'); + if not Assigned(glSecondaryColor3bvEXT) then Exit; + @glSecondaryColor3svEXT := SDL_GL_GetProcAddress('glSecondaryColor3svEXT'); + if not Assigned(glSecondaryColor3svEXT) then Exit; + @glSecondaryColor3ivEXT := SDL_GL_GetProcAddress('glSecondaryColor3ivEXT'); + if not Assigned(glSecondaryColor3ivEXT) then Exit; + @glSecondaryColor3fvEXT := SDL_GL_GetProcAddress('glSecondaryColor3fvEXT'); + if not Assigned(glSecondaryColor3fvEXT) then Exit; + @glSecondaryColor3dvEXT := SDL_GL_GetProcAddress('glSecondaryColor3dvEXT'); + if not Assigned(glSecondaryColor3dvEXT) then Exit; + @glSecondaryColor3ubvEXT := SDL_GL_GetProcAddress('glSecondaryColor3ubvEXT'); + if not Assigned(glSecondaryColor3ubvEXT) then Exit; + @glSecondaryColor3usvEXT := SDL_GL_GetProcAddress('glSecondaryColor3usvEXT'); + if not Assigned(glSecondaryColor3usvEXT) then Exit; + @glSecondaryColor3uivEXT := SDL_GL_GetProcAddress('glSecondaryColor3uivEXT'); + if not Assigned(glSecondaryColor3uivEXT) then Exit; + @glSecondaryColorPointerEXT := SDL_GL_GetProcAddress('glSecondaryColorPointerEXT'); + if not Assigned(glSecondaryColorPointerEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_texture_mirror_clamp: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_texture_mirror_clamp', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_blend_equation_separate: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_blend_equation_separate', extstring) then + begin + @glBlendEquationSeparateEXT := SDL_GL_GetProcAddress('glBlendEquationSeparateEXT'); + if not Assigned(glBlendEquationSeparateEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_MESA_pack_invert: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_MESA_pack_invert', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_MESA_ycbcr_texture: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_MESA_ycbcr_texture', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_fragment_program_shadow: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_fragment_program_shadow', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_fog_coord: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_fog_coord', extstring) then + begin + @glFogCoordfEXT := SDL_GL_GetProcAddress('glFogCoordfEXT'); + if not Assigned(glFogCoordfEXT) then Exit; + @glFogCoorddEXT := SDL_GL_GetProcAddress('glFogCoorddEXT'); + if not Assigned(glFogCoorddEXT) then Exit; + @glFogCoordfvEXT := SDL_GL_GetProcAddress('glFogCoordfvEXT'); + if not Assigned(glFogCoordfvEXT) then Exit; + @glFogCoorddvEXT := SDL_GL_GetProcAddress('glFogCoorddvEXT'); + if not Assigned(glFogCoorddvEXT) then Exit; + @glFogCoordPointerEXT := SDL_GL_GetProcAddress('glFogCoordPointerEXT'); + if not Assigned(glFogCoordPointerEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_fragment_program_option: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_fragment_program_option', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_pixel_buffer_object: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_pixel_buffer_object', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_fragment_program2: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_fragment_program2', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_vertex_program2_option: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_vertex_program2_option', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_vertex_program3: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_vertex_program3', extstring) then + begin + Result := TRUE; + end; + +end; + +function glext_LoadExtension(ext: PChar): Boolean; +begin + + Result := FALSE; + + if ext = 'GL_version_1_2' then Result := Load_GL_version_1_2 + else if ext = 'GL_ARB_imaging' then Result := Load_GL_ARB_imaging + else if ext = 'GL_version_1_3' then Result := Load_GL_version_1_3 + else if ext = 'GL_ARB_multitexture' then Result := Load_GL_ARB_multitexture + else if ext = 'GL_ARB_transpose_matrix' then Result := Load_GL_ARB_transpose_matrix + else if ext = 'GL_ARB_multisample' then Result := Load_GL_ARB_multisample + else if ext = 'GL_ARB_texture_env_add' then Result := Load_GL_ARB_texture_env_add + {$IFDEF WIN32} + else if ext = 'WGL_ARB_extensions_string' then Result := Load_WGL_ARB_extensions_string + else if ext = 'WGL_ARB_buffer_region' then Result := Load_WGL_ARB_buffer_region + {$ENDIF} + else if ext = 'GL_ARB_texture_cube_map' then Result := Load_GL_ARB_texture_cube_map + else if ext = 'GL_ARB_depth_texture' then Result := Load_GL_ARB_depth_texture + else if ext = 'GL_ARB_point_parameters' then Result := Load_GL_ARB_point_parameters + else if ext = 'GL_ARB_shadow' then Result := Load_GL_ARB_shadow + else if ext = 'GL_ARB_shadow_ambient' then Result := Load_GL_ARB_shadow_ambient + else if ext = 'GL_ARB_texture_border_clamp' then Result := Load_GL_ARB_texture_border_clamp + else if ext = 'GL_ARB_texture_compression' then Result := Load_GL_ARB_texture_compression + else if ext = 'GL_ARB_texture_env_combine' then Result := Load_GL_ARB_texture_env_combine + else if ext = 'GL_ARB_texture_env_crossbar' then Result := Load_GL_ARB_texture_env_crossbar + else if ext = 'GL_ARB_texture_env_dot3' then Result := Load_GL_ARB_texture_env_dot3 + else if ext = 'GL_ARB_texture_mirrored_repeat' then Result := Load_GL_ARB_texture_mirrored_repeat + else if ext = 'GL_ARB_vertex_blend' then Result := Load_GL_ARB_vertex_blend + else if ext = 'GL_ARB_vertex_program' then Result := Load_GL_ARB_vertex_program + else if ext = 'GL_ARB_window_pos' then Result := Load_GL_ARB_window_pos + else if ext = 'GL_EXT_422_pixels' then Result := Load_GL_EXT_422_pixels + else if ext = 'GL_EXT_abgr' then Result := Load_GL_EXT_abgr + else if ext = 'GL_EXT_bgra' then Result := Load_GL_EXT_bgra + else if ext = 'GL_EXT_blend_color' then Result := Load_GL_EXT_blend_color + else if ext = 'GL_EXT_blend_func_separate' then Result := Load_GL_EXT_blend_func_separate + else if ext = 'GL_EXT_blend_logic_op' then Result := Load_GL_EXT_blend_logic_op + else if ext = 'GL_EXT_blend_minmax' then Result := Load_GL_EXT_blend_minmax + else if ext = 'GL_EXT_blend_subtract' then Result := Load_GL_EXT_blend_subtract + else if ext = 'GL_EXT_clip_volume_hint' then Result := Load_GL_EXT_clip_volume_hint + else if ext = 'GL_EXT_color_subtable' then Result := Load_GL_EXT_color_subtable + else if ext = 'GL_EXT_compiled_vertex_array' then Result := Load_GL_EXT_compiled_vertex_array + else if ext = 'GL_EXT_convolution' then Result := Load_GL_EXT_convolution + else if ext = 'GL_EXT_histogram' then Result := Load_GL_EXT_histogram + else if ext = 'GL_EXT_multi_draw_arrays' then Result := Load_GL_EXT_multi_draw_arrays + else if ext = 'GL_EXT_packed_pixels' then Result := Load_GL_EXT_packed_pixels + else if ext = 'GL_EXT_paletted_texture' then Result := Load_GL_EXT_paletted_texture + else if ext = 'GL_EXT_point_parameters' then Result := Load_GL_EXT_point_parameters + else if ext = 'GL_EXT_polygon_offset' then Result := Load_GL_EXT_polygon_offset + else if ext = 'GL_EXT_separate_specular_color' then Result := Load_GL_EXT_separate_specular_color + else if ext = 'GL_EXT_shadow_funcs' then Result := Load_GL_EXT_shadow_funcs + else if ext = 'GL_EXT_shared_texture_palette' then Result := Load_GL_EXT_shared_texture_palette + else if ext = 'GL_EXT_stencil_two_side' then Result := Load_GL_EXT_stencil_two_side + else if ext = 'GL_EXT_stencil_wrap' then Result := Load_GL_EXT_stencil_wrap + else if ext = 'GL_EXT_subtexture' then Result := Load_GL_EXT_subtexture + else if ext = 'GL_EXT_texture3D' then Result := Load_GL_EXT_texture3D + else if ext = 'GL_EXT_texture_compression_s3tc' then Result := Load_GL_EXT_texture_compression_s3tc + else if ext = 'GL_EXT_texture_env_add' then Result := Load_GL_EXT_texture_env_add + else if ext = 'GL_EXT_texture_env_combine' then Result := Load_GL_EXT_texture_env_combine + else if ext = 'GL_EXT_texture_env_dot3' then Result := Load_GL_EXT_texture_env_dot3 + else if ext = 'GL_EXT_texture_filter_anisotropic' then Result := Load_GL_EXT_texture_filter_anisotropic + else if ext = 'GL_EXT_texture_lod_bias' then Result := Load_GL_EXT_texture_lod_bias + else if ext = 'GL_EXT_texture_object' then Result := Load_GL_EXT_texture_object + else if ext = 'GL_EXT_vertex_array' then Result := Load_GL_EXT_vertex_array + else if ext = 'GL_EXT_vertex_shader' then Result := Load_GL_EXT_vertex_shader + else if ext = 'GL_EXT_vertex_weighting' then Result := Load_GL_EXT_vertex_weighting + else if ext = 'GL_HP_occlusion_test' then Result := Load_GL_HP_occlusion_test + else if ext = 'GL_NV_blend_square' then Result := Load_GL_NV_blend_square + else if ext = 'GL_NV_copy_depth_to_color' then Result := Load_GL_NV_copy_depth_to_color + else if ext = 'GL_NV_depth_clamp' then Result := Load_GL_NV_depth_clamp + else if ext = 'GL_NV_evaluators' then Result := Load_GL_NV_evaluators + else if ext = 'GL_NV_fence' then Result := Load_GL_NV_fence + else if ext = 'GL_NV_fog_distance' then Result := Load_GL_NV_fog_distance + else if ext = 'GL_NV_light_max_exponent' then Result := Load_GL_NV_light_max_exponent + else if ext = 'GL_NV_multisample_filter_hint' then Result := Load_GL_NV_multisample_filter_hint + else if ext = 'GL_NV_occlusion_query' then Result := Load_GL_NV_occlusion_query + else if ext = 'GL_NV_packed_depth_stencil' then Result := Load_GL_NV_packed_depth_stencil + else if ext = 'GL_NV_point_sprite' then Result := Load_GL_NV_point_sprite + else if ext = 'GL_NV_register_combiners' then Result := Load_GL_NV_register_combiners + else if ext = 'GL_NV_register_combiners2' then Result := Load_GL_NV_register_combiners2 + else if ext = 'GL_NV_texgen_emboss' then Result := Load_GL_NV_texgen_emboss + else if ext = 'GL_NV_texgen_reflection' then Result := Load_GL_NV_texgen_reflection + else if ext = 'GL_NV_texture_compression_vtc' then Result := Load_GL_NV_texture_compression_vtc + else if ext = 'GL_NV_texture_env_combine4' then Result := Load_GL_NV_texture_env_combine4 + else if ext = 'GL_NV_texture_rectangle' then Result := Load_GL_NV_texture_rectangle + else if ext = 'GL_NV_texture_shader' then Result := Load_GL_NV_texture_shader + else if ext = 'GL_NV_texture_shader2' then Result := Load_GL_NV_texture_shader2 + else if ext = 'GL_NV_texture_shader3' then Result := Load_GL_NV_texture_shader3 + else if ext = 'GL_NV_vertex_array_range' then Result := Load_GL_NV_vertex_array_range + else if ext = 'GL_NV_vertex_array_range2' then Result := Load_GL_NV_vertex_array_range2 + else if ext = 'GL_NV_vertex_program' then Result := Load_GL_NV_vertex_program + else if ext = 'GL_NV_vertex_program1_1' then Result := Load_GL_NV_vertex_program1_1 + else if ext = 'GL_ATI_element_array' then Result := Load_GL_ATI_element_array + else if ext = 'GL_ATI_envmap_bumpmap' then Result := Load_GL_ATI_envmap_bumpmap + else if ext = 'GL_ATI_fragment_shader' then Result := Load_GL_ATI_fragment_shader + else if ext = 'GL_ATI_pn_triangles' then Result := Load_GL_ATI_pn_triangles + else if ext = 'GL_ATI_texture_mirror_once' then Result := Load_GL_ATI_texture_mirror_once + else if ext = 'GL_ATI_vertex_array_object' then Result := Load_GL_ATI_vertex_array_object + else if ext = 'GL_ATI_vertex_streams' then Result := Load_GL_ATI_vertex_streams + {$IFDEF WIN32} + else if ext = 'WGL_I3D_image_buffer' then Result := Load_WGL_I3D_image_buffer + else if ext = 'WGL_I3D_swap_frame_lock' then Result := Load_WGL_I3D_swap_frame_lock + else if ext = 'WGL_I3D_swap_frame_usage' then Result := Load_WGL_I3D_swap_frame_usage + {$ENDIF} + else if ext = 'GL_3DFX_texture_compression_FXT1' then Result := Load_GL_3DFX_texture_compression_FXT1 + else if ext = 'GL_IBM_cull_vertex' then Result := Load_GL_IBM_cull_vertex + else if ext = 'GL_IBM_multimode_draw_arrays' then Result := Load_GL_IBM_multimode_draw_arrays + else if ext = 'GL_IBM_raster_pos_clip' then Result := Load_GL_IBM_raster_pos_clip + else if ext = 'GL_IBM_texture_mirrored_repeat' then Result := Load_GL_IBM_texture_mirrored_repeat + else if ext = 'GL_IBM_vertex_array_lists' then Result := Load_GL_IBM_vertex_array_lists + else if ext = 'GL_MESA_resize_buffers' then Result := Load_GL_MESA_resize_buffers + else if ext = 'GL_MESA_window_pos' then Result := Load_GL_MESA_window_pos + else if ext = 'GL_OML_interlace' then Result := Load_GL_OML_interlace + else if ext = 'GL_OML_resample' then Result := Load_GL_OML_resample + else if ext = 'GL_OML_subsample' then Result := Load_GL_OML_subsample + else if ext = 'GL_SGIS_generate_mipmap' then Result := Load_GL_SGIS_generate_mipmap + else if ext = 'GL_SGIS_multisample' then Result := Load_GL_SGIS_multisample + else if ext = 'GL_SGIS_pixel_texture' then Result := Load_GL_SGIS_pixel_texture + else if ext = 'GL_SGIS_texture_border_clamp' then Result := Load_GL_SGIS_texture_border_clamp + else if ext = 'GL_SGIS_texture_color_mask' then Result := Load_GL_SGIS_texture_color_mask + else if ext = 'GL_SGIS_texture_edge_clamp' then Result := Load_GL_SGIS_texture_edge_clamp + else if ext = 'GL_SGIS_texture_lod' then Result := Load_GL_SGIS_texture_lod + else if ext = 'GL_SGIS_depth_texture' then Result := Load_GL_SGIS_depth_texture + else if ext = 'GL_SGIX_fog_offset' then Result := Load_GL_SGIX_fog_offset + else if ext = 'GL_SGIX_interlace' then Result := Load_GL_SGIX_interlace + else if ext = 'GL_SGIX_shadow_ambient' then Result := Load_GL_SGIX_shadow_ambient + else if ext = 'GL_SGI_color_matrix' then Result := Load_GL_SGI_color_matrix + else if ext = 'GL_SGI_color_table' then Result := Load_GL_SGI_color_table + else if ext = 'GL_SGI_texture_color_table' then Result := Load_GL_SGI_texture_color_table + else if ext = 'GL_SUN_vertex' then Result := Load_GL_SUN_vertex + else if ext = 'GL_ARB_fragment_program' then Result := Load_GL_ARB_fragment_program + else if ext = 'GL_ATI_text_fragment_shader' then Result := Load_GL_ATI_text_fragment_shader + else if ext = 'GL_APPLE_client_storage' then Result := Load_GL_APPLE_client_storage + else if ext = 'GL_APPLE_element_array' then Result := Load_GL_APPLE_element_array + else if ext = 'GL_APPLE_fence' then Result := Load_GL_APPLE_fence + else if ext = 'GL_APPLE_vertex_array_object' then Result := Load_GL_APPLE_vertex_array_object + else if ext = 'GL_APPLE_vertex_array_range' then Result := Load_GL_APPLE_vertex_array_range + {$IFDEF WIN32} + else if ext = 'WGL_ARB_pixel_format' then Result := Load_WGL_ARB_pixel_format + else if ext = 'WGL_ARB_make_current_read' then Result := Load_WGL_ARB_make_current_read + else if ext = 'WGL_ARB_pbuffer' then Result := Load_WGL_ARB_pbuffer + else if ext = 'WGL_EXT_swap_control' then Result := Load_WGL_EXT_swap_control + else if ext = 'WGL_ARB_render_texture' then Result := Load_WGL_ARB_render_texture + else if ext = 'WGL_EXT_extensions_string' then Result := Load_WGL_EXT_extensions_string + else if ext = 'WGL_EXT_make_current_read' then Result := Load_WGL_EXT_make_current_read + else if ext = 'WGL_EXT_pbuffer' then Result := Load_WGL_EXT_pbuffer + else if ext = 'WGL_EXT_pixel_format' then Result := Load_WGL_EXT_pixel_format + else if ext = 'WGL_I3D_digital_video_control' then Result := Load_WGL_I3D_digital_video_control + else if ext = 'WGL_I3D_gamma' then Result := Load_WGL_I3D_gamma + else if ext = 'WGL_I3D_genlock' then Result := Load_WGL_I3D_genlock + {$ENDIF} + else if ext = 'GL_ARB_matrix_palette' then Result := Load_GL_ARB_matrix_palette + else if ext = 'GL_NV_element_array' then Result := Load_GL_NV_element_array + else if ext = 'GL_NV_float_buffer' then Result := Load_GL_NV_float_buffer + else if ext = 'GL_NV_fragment_program' then Result := Load_GL_NV_fragment_program + else if ext = 'GL_NV_primitive_restart' then Result := Load_GL_NV_primitive_restart + else if ext = 'GL_NV_vertex_program2' then Result := Load_GL_NV_vertex_program2 + {$IFDEF WIN32} + else if ext = 'WGL_NV_render_texture_rectangle' then Result := Load_WGL_NV_render_texture_rectangle + {$ENDIF} + else if ext = 'GL_NV_pixel_data_range' then Result := Load_GL_NV_pixel_data_range + else if ext = 'GL_EXT_texture_rectangle' then Result := Load_GL_EXT_texture_rectangle + else if ext = 'GL_S3_s3tc' then Result := Load_GL_S3_s3tc + else if ext = 'GL_ATI_draw_buffers' then Result := Load_GL_ATI_draw_buffers + {$IFDEF WIN32} + else if ext = 'WGL_ATI_pixel_format_float' then Result := Load_WGL_ATI_pixel_format_float + {$ENDIF} + else if ext = 'GL_ATI_texture_env_combine3' then Result := Load_GL_ATI_texture_env_combine3 + else if ext = 'GL_ATI_texture_float' then Result := Load_GL_ATI_texture_float + else if ext = 'GL_NV_texture_expand_normal' then Result := Load_GL_NV_texture_expand_normal + else if ext = 'GL_NV_half_float' then Result := Load_GL_NV_half_float + else if ext = 'GL_ATI_map_object_buffer' then Result := Load_GL_ATI_map_object_buffer + else if ext = 'GL_ATI_separate_stencil' then Result := Load_GL_ATI_separate_stencil + else if ext = 'GL_ATI_vertex_attrib_array_object' then Result := Load_GL_ATI_vertex_attrib_array_object + else if ext = 'GL_ARB_vertex_buffer_object' then Result := Load_GL_ARB_vertex_buffer_object + else if ext = 'GL_ARB_occlusion_query' then Result := Load_GL_ARB_occlusion_query + else if ext = 'GL_ARB_shader_objects' then Result := Load_GL_ARB_shader_objects + else if ext = 'GL_ARB_vertex_shader' then Result := Load_GL_ARB_vertex_shader + else if ext = 'GL_ARB_fragment_shader' then Result := Load_GL_ARB_fragment_shader + else if ext = 'GL_ARB_shading_language_100' then Result := Load_GL_ARB_shading_language_100 + else if ext = 'GL_ARB_texture_non_power_of_two' then Result := Load_GL_ARB_texture_non_power_of_two + else if ext = 'GL_ARB_point_sprite' then Result := Load_GL_ARB_point_sprite + else if ext = 'GL_EXT_depth_bounds_test' then Result := Load_GL_EXT_depth_bounds_test + else if ext = 'GL_EXT_secondary_color' then Result := Load_GL_EXT_secondary_color + else if ext = 'GL_EXT_texture_mirror_clamp' then Result := Load_GL_EXT_texture_mirror_clamp + else if ext = 'GL_EXT_blend_equation_separate' then Result := Load_GL_EXT_blend_equation_separate + else if ext = 'GL_MESA_pack_invert' then Result := Load_GL_MESA_pack_invert + else if ext = 'GL_MESA_ycbcr_texture' then Result := Load_GL_MESA_ycbcr_texture + else if ext = 'GL_ARB_fragment_program_shadow' then Result := Load_GL_ARB_fragment_program_shadow + else if ext = 'GL_EXT_fog_coord' then Result := Load_GL_EXT_fog_coord + else if ext = 'GL_NV_fragment_program_option' then Result := Load_GL_NV_fragment_program_option + else if ext = 'GL_EXT_pixel_buffer_object' then Result := Load_GL_EXT_pixel_buffer_object + else if ext = 'GL_NV_fragment_program2' then Result := Load_GL_NV_fragment_program2 + else if ext = 'GL_NV_vertex_program2_option' then Result := Load_GL_NV_vertex_program2_option + else if ext = 'GL_NV_vertex_program3' then Result := Load_GL_NV_vertex_program3 + +end; + +end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glu.pas b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glu.pas new file mode 100644 index 00000000..fb48f65d --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glu.pas @@ -0,0 +1,563 @@ +unit glu; +{ + $Id: glu.pas,v 1.3 2004/10/07 21:01:29 savage Exp $ + + Adaption of the delphi3d.net OpenGL units to FreePascal + Sebastian Guenther (sg@freepascal.org) in 2002 + These units are free to use +} + +(*++ BUILD Version: 0004 // Increment this if a change has global effects + +Copyright (c) 1985-95, Microsoft Corporation + +Module Name: + + glu.h + +Abstract: + + Procedure declarations, constant definitions and macros for the OpenGL + Utility Library. + +--*) + +(* +** Copyright 1991-1993, Silicon Graphics, Inc. +** All Rights Reserved. +** +** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.; +** the contents of this file may not be disclosed to third parties, copied or +** duplicated in any form, in whole or in part, without the prior written +** permission of Silicon Graphics, Inc. +** +** RESTRICTED RIGHTS LEGEND: +** Use, duplication or disclosure by the Government is subject to restrictions +** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data +** and Computer Software clause at DFARS 252.227-7013, and/or in similar or +** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - +** rights reserved under the Copyright Laws of the United States. +*) + +(* +** Return the error string associated with a particular error code. +** This will return 0 for an invalid error code. +** +** The generic function prototype that can be compiled for ANSI or Unicode +** is defined as follows: +** +** LPCTSTR APIENTRY gluErrorStringWIN (GLenum errCode); +*) + +{******************************************************************************} +{ } +{ Converted to Delphi by Tom Nuydens (tom@delphi3d.net) } +{ For the latest updates, visit Delphi3D: http://www.delphi3d.net } +{ } +{ Modified for Delphi/Kylix and FreePascal } +{ by Dominique Louis ( Dominique@Savagesoftware.com.au) } +{ For the latest updates, visit JEDI-SDL : http://www.sf.net/projects/jedi-sdl } +{ } +{******************************************************************************} + +{ + $Log: glu.pas,v $ + Revision 1.3 2004/10/07 21:01:29 savage + Fix for FPC + + Revision 1.2 2004/08/14 22:54:30 savage + Updated so that Library name defines are correctly defined for MacOS X. + + Revision 1.1 2004/03/30 21:53:54 savage + Moved to it's own folder. + + Revision 1.4 2004/02/20 17:09:55 savage + Code tidied up in gl, glu and glut, while extensions in glext.pas are now loaded using SDL_GL_GetProcAddress, thus making it more cross-platform compatible, but now more tied to SDL. + + Revision 1.3 2004/02/14 00:23:39 savage + As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. + + Revision 1.2 2004/02/14 00:09:19 savage + Changed uses to now make use of moduleloader.pas rather than dllfuncs.pas + + Revision 1.1 2004/02/05 00:08:19 savage + Module 1.0 release + + Revision 1.4 2003/06/02 12:32:13 savage + Modified Sources to avoid warnings with Delphi by moving CVS Logging to the top of the header files. Hopefully CVS Logging still works. + + Revision 1.3 2003/05/29 22:55:00 savage + Make use of new DLLFunctions + + Revision 1.2 2003/05/27 09:39:53 savage + Added better Gnu Pascal support. + + Revision 1.1 2003/05/11 13:18:03 savage + Newest OpenGL Headers For Delphi, Kylix and FPC + + Revision 1.2 2002/10/13 14:36:47 sg + * Win32 fix: The OS symbol is called "Win32", not "Windows" + + Revision 1.1 2002/10/13 13:57:31 sg + * Finally, the new units are available: Match the C headers more closely; + support for OpenGL extensions, and much more. Based on the Delphi units + by Tom Nuydens of delphi3d.net + +} + +interface + +{$I jedi-sdl.inc} + +uses +{$IFDEF __GPC__} + gpc, +{$ENDIF} + moduleloader, + gl; + +const +{$IFDEF WIN32} + GLuLibName = 'glu32.dll'; +{$ENDIF} + +{$IFDEF UNIX} +{$IFDEF DARWIN} + GLuLibName = 'libGLU.dylib'; +{$ELSE} + GLuLibName = 'libGLU.so'; +{$ENDIF} +{$ENDIF} + +type + TViewPortArray = array [0..3] of GLint; + T16dArray = array [0..15] of GLdouble; + TCallBack = procedure; + T3dArray = array [0..2] of GLdouble; + T4pArray = array [0..3] of Pointer; + T4fArray = array [0..3] of GLfloat; + {$IFNDEF __GPC__} + PPointer = ^Pointer; + {$ENDIF} + +var + gluErrorString: function(errCode: GLenum): PGLubyte; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluErrorUnicodeStringEXT: function(errCode: GLenum): PWideChar; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluGetString: function(name: GLenum): PGLubyte; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluOrtho2D: procedure(left,right, bottom, top: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluPerspective: procedure(fovy, aspect, zNear, zFar: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluPickMatrix: procedure(x, y, width, height: GLdouble; viewport: TViewPortArray); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluLookAt: procedure(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluProject: function(objx, objy, objz: GLdouble; const modelMatrix, projMatrix: T16dArray; viewport: TViewPortArray; winx, winy, winz: PGLdouble): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluUnProject: function(winx, winy, winz: GLdouble; const modelMatrix, projMatrix: T16dArray; viewport: TViewPortArray; objx, objy, objz: PGLdouble): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluScaleImage: function(format: GLenum; widthin, heightin: GLint; typein: GLenum; const datain: Pointer; widthout, heightout: GLint; typeout: GLenum; dataout: Pointer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluBuild1DMipmaps: function(target: GLenum; components, width: GLint; format, atype: GLenum; const data: Pointer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluBuild2DMipmaps: function(target: GLenum; components, width, height: GLint; format, atype: GLenum; const data: Pointer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +type + GLUnurbs = record end; PGLUnurbs = ^GLUnurbs; + GLUquadric = record end; PGLUquadric = ^GLUquadric; + GLUtesselator = record end; PGLUtesselator = ^GLUtesselator; + + // backwards compatibility: + GLUnurbsObj = GLUnurbs; PGLUnurbsObj = PGLUnurbs; + GLUquadricObj = GLUquadric; PGLUquadricObj = PGLUquadric; + GLUtesselatorObj = GLUtesselator; PGLUtesselatorObj = PGLUtesselator; + GLUtriangulatorObj = GLUtesselator; PGLUtriangulatorObj = PGLUtesselator; + +var + gluNewQuadric: function: PGLUquadric; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluDeleteQuadric: procedure(state: PGLUquadric); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluQuadricNormals: procedure(quadObject: PGLUquadric; normals: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluQuadricTexture: procedure(quadObject: PGLUquadric; textureCoords: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluQuadricOrientation: procedure(quadObject: PGLUquadric; orientation: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluQuadricDrawStyle: procedure(quadObject: PGLUquadric; drawStyle: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluCylinder: procedure(qobj: PGLUquadric; baseRadius, topRadius, height: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluDisk: procedure(qobj: PGLUquadric; innerRadius, outerRadius: GLdouble; slices, loops: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluPartialDisk: procedure(qobj: PGLUquadric; innerRadius, outerRadius: GLdouble; slices, loops: GLint; startAngle, sweepAngle: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluSphere: procedure(qobj: PGLuquadric; radius: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluQuadricCallback: procedure(qobj: PGLUquadric; which: GLenum; fn: TCallBack); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluNewTess: function: PGLUtesselator; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluDeleteTess: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluTessBeginPolygon: procedure(tess: PGLUtesselator; polygon_data: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluTessBeginContour: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluTessVertex: procedure(tess: PGLUtesselator; coords: T3dArray; data: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluTessEndContour: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluTessEndPolygon: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluTessProperty: procedure(tess: PGLUtesselator; which: GLenum; value: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluTessNormal: procedure(tess: PGLUtesselator; x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluTessCallback: procedure(tess: PGLUtesselator; which: GLenum;fn: TCallBack); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluGetTessProperty: procedure(tess: PGLUtesselator; which: GLenum; value: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluNewNurbsRenderer: function: PGLUnurbs; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluDeleteNurbsRenderer: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluBeginSurface: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluBeginCurve: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluEndCurve: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluEndSurface: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluBeginTrim: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluEndTrim: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluPwlCurve: procedure(nobj: PGLUnurbs; count: GLint; aarray: PGLfloat; stride: GLint; atype: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluNurbsCurve: procedure(nobj: PGLUnurbs; nknots: GLint; knot: PGLfloat; stride: GLint; ctlarray: PGLfloat; order: GLint; atype: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluNurbsSurface: procedure(nobj: PGLUnurbs; sknot_count: GLint; sknot: PGLfloat; tknot_count: GLint; tknot: PGLfloat; s_stride, t_stride: GLint; ctlarray: PGLfloat; sorder, torder: GLint; atype: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluLoadSamplingMatrices: procedure(nobj: PGLUnurbs; const modelMatrix, projMatrix: T16dArray; viewport: TViewPortArray); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluNurbsProperty: procedure(nobj: PGLUnurbs; aproperty: GLenum; value: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluGetNurbsProperty: procedure(nobj: PGLUnurbs; aproperty: GLenum; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluNurbsCallback: procedure(nobj: PGLUnurbs; which: GLenum; fn: TCallBack); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +(**** Callback function prototypes ****) + +type + // gluQuadricCallback + GLUquadricErrorProc = procedure(p: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + + // gluTessCallback + GLUtessBeginProc = procedure(p: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessEdgeFlagProc = procedure(p: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessVertexProc = procedure(p: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessEndProc = procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessErrorProc = procedure(p: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessCombineProc = procedure(p1: T3dArray; p2: T4pArray; p3: T4fArray; p4: PPointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessBeginDataProc = procedure(p1: GLenum; p2: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessEdgeFlagDataProc = procedure(p1: GLboolean; p2: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessVertexDataProc = procedure(p1, p2: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessEndDataProc = procedure(p: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessErrorDataProc = procedure(p1: GLenum; p2: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessCombineDataProc = procedure(p1: T3dArray; p2: T4pArray; p3: T4fArray; + p4: PPointer; p5: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + + // gluNurbsCallback + GLUnurbsErrorProc = procedure(p: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + + +//*** Generic constants ****/ + +const + // Version + GLU_VERSION_1_1 = 1; + GLU_VERSION_1_2 = 1; + + // Errors: (return value 0 = no error) + GLU_INVALID_ENUM = 100900; + GLU_INVALID_VALUE = 100901; + GLU_OUT_OF_MEMORY = 100902; + GLU_INCOMPATIBLE_GL_VERSION = 100903; + + // StringName + GLU_VERSION = 100800; + GLU_EXTENSIONS = 100801; + + // Boolean + GLU_TRUE = GL_TRUE; + GLU_FALSE = GL_FALSE; + + + //*** Quadric constants ****/ + + // QuadricNormal + GLU_SMOOTH = 100000; + GLU_FLAT = 100001; + GLU_NONE = 100002; + + // QuadricDrawStyle + GLU_POINT = 100010; + GLU_LINE = 100011; + GLU_FILL = 100012; + GLU_SILHOUETTE = 100013; + + // QuadricOrientation + GLU_OUTSIDE = 100020; + GLU_INSIDE = 100021; + + // Callback types: + // GLU_ERROR = 100103; + + + //*** Tesselation constants ****/ + + GLU_TESS_MAX_COORD = 1.0e150; + + // TessProperty + GLU_TESS_WINDING_RULE = 100140; + GLU_TESS_BOUNDARY_ONLY = 100141; + GLU_TESS_TOLERANCE = 100142; + + // TessWinding + GLU_TESS_WINDING_ODD = 100130; + GLU_TESS_WINDING_NONZERO = 100131; + GLU_TESS_WINDING_POSITIVE = 100132; + GLU_TESS_WINDING_NEGATIVE = 100133; + GLU_TESS_WINDING_ABS_GEQ_TWO = 100134; + + // TessCallback + GLU_TESS_BEGIN = 100100; // void (CALLBACK*)(GLenum type) + GLU_TESS_VERTEX = 100101; // void (CALLBACK*)(void *data) + GLU_TESS_END = 100102; // void (CALLBACK*)(void) + GLU_TESS_ERROR = 100103; // void (CALLBACK*)(GLenum errno) + GLU_TESS_EDGE_FLAG = 100104; // void (CALLBACK*)(GLboolean boundaryEdge) + GLU_TESS_COMBINE = 100105; { void (CALLBACK*)(GLdouble coords[3], + void *data[4], + GLfloat weight[4], + void **dataOut) } + GLU_TESS_BEGIN_DATA = 100106; { void (CALLBACK*)(GLenum type, + void *polygon_data) } + GLU_TESS_VERTEX_DATA = 100107; { void (CALLBACK*)(void *data, + void *polygon_data) } + GLU_TESS_END_DATA = 100108; // void (CALLBACK*)(void *polygon_data) + GLU_TESS_ERROR_DATA = 100109; { void (CALLBACK*)(GLenum errno, + void *polygon_data) } + GLU_TESS_EDGE_FLAG_DATA = 100110; { void (CALLBACK*)(GLboolean boundaryEdge, + void *polygon_data) } + GLU_TESS_COMBINE_DATA = 100111; { void (CALLBACK*)(GLdouble coords[3], + void *data[4], + GLfloat weight[4], + void **dataOut, + void *polygon_data) } + + // TessError + GLU_TESS_ERROR1 = 100151; + GLU_TESS_ERROR2 = 100152; + GLU_TESS_ERROR3 = 100153; + GLU_TESS_ERROR4 = 100154; + GLU_TESS_ERROR5 = 100155; + GLU_TESS_ERROR6 = 100156; + GLU_TESS_ERROR7 = 100157; + GLU_TESS_ERROR8 = 100158; + + GLU_TESS_MISSING_BEGIN_POLYGON = GLU_TESS_ERROR1; + GLU_TESS_MISSING_BEGIN_CONTOUR = GLU_TESS_ERROR2; + GLU_TESS_MISSING_END_POLYGON = GLU_TESS_ERROR3; + GLU_TESS_MISSING_END_CONTOUR = GLU_TESS_ERROR4; + GLU_TESS_COORD_TOO_LARGE = GLU_TESS_ERROR5; + GLU_TESS_NEED_COMBINE_CALLBACK = GLU_TESS_ERROR6; + + //*** NURBS constants ****/ + + // NurbsProperty + GLU_AUTO_LOAD_MATRIX = 100200; + GLU_CULLING = 100201; + GLU_SAMPLING_TOLERANCE = 100203; + GLU_DISPLAY_MODE = 100204; + GLU_PARAMETRIC_TOLERANCE = 100202; + GLU_SAMPLING_METHOD = 100205; + GLU_U_STEP = 100206; + GLU_V_STEP = 100207; + + // NurbsSampling + GLU_PATH_LENGTH = 100215; + GLU_PARAMETRIC_ERROR = 100216; + GLU_DOMAIN_DISTANCE = 100217; + + + // NurbsTrim + GLU_MAP1_TRIM_2 = 100210; + GLU_MAP1_TRIM_3 = 100211; + + // NurbsDisplay + // GLU_FILL = 100012; + GLU_OUTLINE_POLYGON = 100240; + GLU_OUTLINE_PATCH = 100241; + + // NurbsCallback + // GLU_ERROR = 100103; + + // NurbsErrors + GLU_NURBS_ERROR1 = 100251; + GLU_NURBS_ERROR2 = 100252; + GLU_NURBS_ERROR3 = 100253; + GLU_NURBS_ERROR4 = 100254; + GLU_NURBS_ERROR5 = 100255; + GLU_NURBS_ERROR6 = 100256; + GLU_NURBS_ERROR7 = 100257; + GLU_NURBS_ERROR8 = 100258; + GLU_NURBS_ERROR9 = 100259; + GLU_NURBS_ERROR10 = 100260; + GLU_NURBS_ERROR11 = 100261; + GLU_NURBS_ERROR12 = 100262; + GLU_NURBS_ERROR13 = 100263; + GLU_NURBS_ERROR14 = 100264; + GLU_NURBS_ERROR15 = 100265; + GLU_NURBS_ERROR16 = 100266; + GLU_NURBS_ERROR17 = 100267; + GLU_NURBS_ERROR18 = 100268; + GLU_NURBS_ERROR19 = 100269; + GLU_NURBS_ERROR20 = 100270; + GLU_NURBS_ERROR21 = 100271; + GLU_NURBS_ERROR22 = 100272; + GLU_NURBS_ERROR23 = 100273; + GLU_NURBS_ERROR24 = 100274; + GLU_NURBS_ERROR25 = 100275; + GLU_NURBS_ERROR26 = 100276; + GLU_NURBS_ERROR27 = 100277; + GLU_NURBS_ERROR28 = 100278; + GLU_NURBS_ERROR29 = 100279; + GLU_NURBS_ERROR30 = 100280; + GLU_NURBS_ERROR31 = 100281; + GLU_NURBS_ERROR32 = 100282; + GLU_NURBS_ERROR33 = 100283; + GLU_NURBS_ERROR34 = 100284; + GLU_NURBS_ERROR35 = 100285; + GLU_NURBS_ERROR36 = 100286; + GLU_NURBS_ERROR37 = 100287; + +//*** Backwards compatibility for old tesselator ****/ + +var + gluBeginPolygon: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluNextContour: procedure(tess: PGLUtesselator; atype: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluEndPolygon: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +const + // Contours types -- obsolete! + GLU_CW = 100120; + GLU_CCW = 100121; + GLU_INTERIOR = 100122; + GLU_EXTERIOR = 100123; + GLU_UNKNOWN = 100124; + + // Names without "TESS_" prefix + GLU_BEGIN = GLU_TESS_BEGIN; + GLU_VERTEX = GLU_TESS_VERTEX; + GLU_END = GLU_TESS_END; + GLU_ERROR = GLU_TESS_ERROR; + GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG; + +procedure LoadGLu(const dll: PChar); +procedure FreeGLu; + +implementation + +var + LibGlu: TModuleHandle; + +procedure FreeGLu; +begin + + @gluErrorString := nil; + @gluErrorUnicodeStringEXT := nil; + @gluGetString := nil; + @gluOrtho2D := nil; + @gluPerspective := nil; + @gluPickMatrix := nil; + @gluLookAt := nil; + @gluProject := nil; + @gluUnProject := nil; + @gluScaleImage := nil; + @gluBuild1DMipmaps := nil; + @gluBuild2DMipmaps := nil; + @gluNewQuadric := nil; + @gluDeleteQuadric := nil; + @gluQuadricNormals := nil; + @gluQuadricTexture := nil; + @gluQuadricOrientation := nil; + @gluQuadricDrawStyle := nil; + @gluCylinder := nil; + @gluDisk := nil; + @gluPartialDisk := nil; + @gluSphere := nil; + @gluQuadricCallback := nil; + @gluNewTess := nil; + @gluDeleteTess := nil; + @gluTessBeginPolygon := nil; + @gluTessBeginContour := nil; + @gluTessVertex := nil; + @gluTessEndContour := nil; + @gluTessEndPolygon := nil; + @gluTessProperty := nil; + @gluTessNormal := nil; + @gluTessCallback := nil; + @gluGetTessProperty := nil; + @gluNewNurbsRenderer := nil; + @gluDeleteNurbsRenderer := nil; + @gluBeginSurface := nil; + @gluBeginCurve := nil; + @gluEndCurve := nil; + @gluEndSurface := nil; + @gluBeginTrim := nil; + @gluEndTrim := nil; + @gluPwlCurve := nil; + @gluNurbsCurve := nil; + @gluNurbsSurface := nil; + @gluLoadSamplingMatrices := nil; + @gluNurbsProperty := nil; + @gluGetNurbsProperty := nil; + @gluNurbsCallback := nil; + @gluBeginPolygon := nil; + @gluNextContour := nil; + @gluEndPolygon := nil; + + UnLoadModule(LibGlu); + +end; + +procedure LoadGLu(const dll: PChar); +begin + + FreeGLu; + + if LoadModule( LibGlu, dll ) then + begin + @gluErrorString := GetModuleSymbol(LibGlu, 'gluErrorString'); + @gluErrorUnicodeStringEXT := GetModuleSymbol(LibGlu, 'gluErrorUnicodeStringEXT'); + @gluGetString := GetModuleSymbol(LibGlu, 'gluGetString'); + @gluOrtho2D := GetModuleSymbol(LibGlu, 'gluOrtho2D'); + @gluPerspective := GetModuleSymbol(LibGlu, 'gluPerspective'); + @gluPickMatrix := GetModuleSymbol(LibGlu, 'gluPickMatrix'); + @gluLookAt := GetModuleSymbol(LibGlu, 'gluLookAt'); + @gluProject := GetModuleSymbol(LibGlu, 'gluProject'); + @gluUnProject := GetModuleSymbol(LibGlu, 'gluUnProject'); + @gluScaleImage := GetModuleSymbol(LibGlu, 'gluScaleImage'); + @gluBuild1DMipmaps := GetModuleSymbol(LibGlu, 'gluBuild1DMipmaps'); + @gluBuild2DMipmaps := GetModuleSymbol(LibGlu, 'gluBuild2DMipmaps'); + @gluNewQuadric := GetModuleSymbol(LibGlu, 'gluNewQuadric'); + @gluDeleteQuadric := GetModuleSymbol(LibGlu, 'gluDeleteQuadric'); + @gluQuadricNormals := GetModuleSymbol(LibGlu, 'gluQuadricNormals'); + @gluQuadricTexture := GetModuleSymbol(LibGlu, 'gluQuadricTexture'); + @gluQuadricOrientation := GetModuleSymbol(LibGlu, 'gluQuadricOrientation'); + @gluQuadricDrawStyle := GetModuleSymbol(LibGlu, 'gluQuadricDrawStyle'); + @gluCylinder := GetModuleSymbol(LibGlu, 'gluCylinder'); + @gluDisk := GetModuleSymbol(LibGlu, 'gluDisk'); + @gluPartialDisk := GetModuleSymbol(LibGlu, 'gluPartialDisk'); + @gluSphere := GetModuleSymbol(LibGlu, 'gluSphere'); + @gluQuadricCallback := GetModuleSymbol(LibGlu, 'gluQuadricCallback'); + @gluNewTess := GetModuleSymbol(LibGlu, 'gluNewTess'); + @gluDeleteTess := GetModuleSymbol(LibGlu, 'gluDeleteTess'); + @gluTessBeginPolygon := GetModuleSymbol(LibGlu, 'gluTessBeginPolygon'); + @gluTessBeginContour := GetModuleSymbol(LibGlu, 'gluTessBeginContour'); + @gluTessVertex := GetModuleSymbol(LibGlu, 'gluTessVertex'); + @gluTessEndContour := GetModuleSymbol(LibGlu, 'gluTessEndContour'); + @gluTessEndPolygon := GetModuleSymbol(LibGlu, 'gluTessEndPolygon'); + @gluTessProperty := GetModuleSymbol(LibGlu, 'gluTessProperty'); + @gluTessNormal := GetModuleSymbol(LibGlu, 'gluTessNormal'); + @gluTessCallback := GetModuleSymbol(LibGlu, 'gluTessCallback'); + @gluGetTessProperty := GetModuleSymbol(LibGlu, 'gluGetTessProperty'); + @gluNewNurbsRenderer := GetModuleSymbol(LibGlu, 'gluNewNurbsRenderer'); + @gluDeleteNurbsRenderer := GetModuleSymbol(LibGlu, 'gluDeleteNurbsRenderer'); + @gluBeginSurface := GetModuleSymbol(LibGlu, 'gluBeginSurface'); + @gluBeginCurve := GetModuleSymbol(LibGlu, 'gluBeginCurve'); + @gluEndCurve := GetModuleSymbol(LibGlu, 'gluEndCurve'); + @gluEndSurface := GetModuleSymbol(LibGlu, 'gluEndSurface'); + @gluBeginTrim := GetModuleSymbol(LibGlu, 'gluBeginTrim'); + @gluEndTrim := GetModuleSymbol(LibGlu, 'gluEndTrim'); + @gluPwlCurve := GetModuleSymbol(LibGlu, 'gluPwlCurve'); + @gluNurbsCurve := GetModuleSymbol(LibGlu, 'gluNurbsCurve'); + @gluNurbsSurface := GetModuleSymbol(LibGlu, 'gluNurbsSurface'); + @gluLoadSamplingMatrices := GetModuleSymbol(LibGlu, 'gluLoadSamplingMatrices'); + @gluNurbsProperty := GetModuleSymbol(LibGlu, 'gluNurbsProperty'); + @gluGetNurbsProperty := GetModuleSymbol(LibGlu, 'gluGetNurbsProperty'); + @gluNurbsCallback := GetModuleSymbol(LibGlu, 'gluNurbsCallback'); + + @gluBeginPolygon := GetModuleSymbol(LibGlu, 'gluBeginPolygon'); + @gluNextContour := GetModuleSymbol(LibGlu, 'gluNextContour'); + @gluEndPolygon := GetModuleSymbol(LibGlu, 'gluEndPolygon'); + end; +end; + +initialization + + LoadGLu( GLuLibName ); + +finalization + + FreeGLu; + +end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glut.pas b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glut.pas new file mode 100644 index 00000000..2a882a20 --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glut.pas @@ -0,0 +1,682 @@ +unit glut; +{ + $Id: glut.pas,v 1.2 2004/08/14 22:54:30 savage Exp $ + + Adaption of the delphi3d.net OpenGL units to FreePascal + Sebastian Guenther (sg@freepascal.org) in 2002 + These units are free to use +} + +// Copyright (c) Mark J. Kilgard, 1994, 1995, 1996. */ + +(* This program is freely distributable without licensing fees and is + provided without guarantee or warrantee expressed or implied. This + program is -not- in the public domain. *) + +{******************************************************************************} +{ } +{ Converted to Delphi by Tom Nuydens (tom@delphi3d.net) } +{ For the latest updates, visit Delphi3D: http://www.delphi3d.net } +{ } +{ Modified for Delphi/Kylix and FreePascal } +{ by Dominique Louis ( Dominique@Savagesoftware.com.au) } +{ For the latest updates, visit JEDI-SDL : http://www.sf.net/projects/jedi-sdl } +{ } +{******************************************************************************} + +{ + $Log: glut.pas,v $ + Revision 1.2 2004/08/14 22:54:30 savage + Updated so that Library name defines are correctly defined for MacOS X. + + Revision 1.1 2004/03/30 21:53:54 savage + Moved to it's own folder. + + Revision 1.5 2004/02/20 17:09:55 savage + Code tidied up in gl, glu and glut, while extensions in glext.pas are now loaded using SDL_GL_GetProcAddress, thus making it more cross-platform compatible, but now more tied to SDL. + + Revision 1.4 2004/02/14 22:36:29 savage + Fixed inconsistencies of using LoadLibrary and LoadModule. + Now all units make use of LoadModule rather than LoadLibrary and other dynamic proc procedures. + + Revision 1.3 2004/02/14 00:23:39 savage + As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. + + Revision 1.2 2004/02/14 00:09:19 savage + Changed uses to now make use of moduleloader.pas rather than dllfuncs.pas + + Revision 1.1 2004/02/05 00:08:19 savage + Module 1.0 release + + Revision 1.4 2003/06/02 12:32:13 savage + Modified Sources to avoid warnings with Delphi by moving CVS Logging to the top of the header files. Hopefully CVS Logging still works. + +} + +interface + +{$I jedi-sdl.inc} + +uses +{$IFDEF __GPC__} + system, + gpc, +{$ENDIF} + +{$IFDEF WIN32} + Windows, +{$ENDIF} + moduleloader, + gl; + +type + {$IFNDEF __GPC__} + PInteger = ^Integer; + PPChar = ^PChar; + {$ENDIF} + TGlutVoidCallback = procedure; {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} + TGlut1IntCallback = procedure(value: Integer); {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} + TGlut2IntCallback = procedure(v1, v2: Integer); {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} + TGlut3IntCallback = procedure(v1, v2, v3: Integer); {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} + TGlut4IntCallback = procedure(v1, v2, v3, v4: Integer); {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} + TGlut1Char2IntCallback = procedure(c: Byte; v1, v2: Integer); {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} + +const +{$IFDEF WIN32} + GlutLibName = 'glut32.dll'; +{$ENDIF} + +{$IFDEF UNIX} +{$IFDEF DARWIN} + GlutLibName = 'libglut.dylib'; +{$ELSE} + GlutLibName = 'libglut.so'; +{$ENDIF} +{$ENDIF} + + GLUT_API_VERSION = 3; + GLUT_XLIB_IMPLEMENTATION = 12; + // Display mode bit masks. + GLUT_RGB = 0; + GLUT_RGBA = GLUT_RGB; + GLUT_INDEX = 1; + GLUT_SINGLE = 0; + GLUT_DOUBLE = 2; + GLUT_ACCUM = 4; + GLUT_ALPHA = 8; + GLUT_DEPTH = 16; + GLUT_STENCIL = 32; + GLUT_MULTISAMPLE = 128; + GLUT_STEREO = 256; + GLUT_LUMINANCE = 512; + + // Mouse buttons. + GLUT_LEFT_BUTTON = 0; + GLUT_MIDDLE_BUTTON = 1; + GLUT_RIGHT_BUTTON = 2; + + // Mouse button state. + GLUT_DOWN = 0; + GLUT_UP = 1; + + // function keys + GLUT_KEY_F1 = 1; + GLUT_KEY_F2 = 2; + GLUT_KEY_F3 = 3; + GLUT_KEY_F4 = 4; + GLUT_KEY_F5 = 5; + GLUT_KEY_F6 = 6; + GLUT_KEY_F7 = 7; + GLUT_KEY_F8 = 8; + GLUT_KEY_F9 = 9; + GLUT_KEY_F10 = 10; + GLUT_KEY_F11 = 11; + GLUT_KEY_F12 = 12; + // directional keys + GLUT_KEY_LEFT = 100; + GLUT_KEY_UP = 101; + GLUT_KEY_RIGHT = 102; + GLUT_KEY_DOWN = 103; + GLUT_KEY_PAGE_UP = 104; + GLUT_KEY_PAGE_DOWN = 105; + GLUT_KEY_HOME = 106; + GLUT_KEY_END = 107; + GLUT_KEY_INSERT = 108; + + // Entry/exit state. + GLUT_LEFT = 0; + GLUT_ENTERED = 1; + + // Menu usage state. + GLUT_MENU_NOT_IN_USE = 0; + GLUT_MENU_IN_USE = 1; + + // Visibility state. + GLUT_NOT_VISIBLE = 0; + GLUT_VISIBLE = 1; + + // Window status state. + GLUT_HIDDEN = 0; + GLUT_FULLY_RETAINED = 1; + GLUT_PARTIALLY_RETAINED = 2; + GLUT_FULLY_COVERED = 3; + + // Color index component selection values. + GLUT_RED = 0; + GLUT_GREEN = 1; + GLUT_BLUE = 2; + + // Layers for use. + GLUT_NORMAL = 0; + GLUT_OVERLAY = 1; + + // Stroke font constants (use these in GLUT program). + GLUT_STROKE_ROMAN = Pointer(0); + GLUT_STROKE_MONO_ROMAN = Pointer(1); + + // Bitmap font constants (use these in GLUT program). + GLUT_BITMAP_9_BY_15 = Pointer(2); + GLUT_BITMAP_8_BY_13 = Pointer(3); + GLUT_BITMAP_TIMES_ROMAN_10 = Pointer(4); + GLUT_BITMAP_TIMES_ROMAN_24 = Pointer(5); + GLUT_BITMAP_HELVETICA_10 = Pointer(6); + GLUT_BITMAP_HELVETICA_12 = Pointer(7); + GLUT_BITMAP_HELVETICA_18 = Pointer(8); + + // glutGet parameters. + GLUT_WINDOW_X = 100; + GLUT_WINDOW_Y = 101; + GLUT_WINDOW_WIDTH = 102; + GLUT_WINDOW_HEIGHT = 103; + GLUT_WINDOW_BUFFER_SIZE = 104; + GLUT_WINDOW_STENCIL_SIZE = 105; + GLUT_WINDOW_DEPTH_SIZE = 106; + GLUT_WINDOW_RED_SIZE = 107; + GLUT_WINDOW_GREEN_SIZE = 108; + GLUT_WINDOW_BLUE_SIZE = 109; + GLUT_WINDOW_ALPHA_SIZE = 110; + GLUT_WINDOW_ACCUM_RED_SIZE = 111; + GLUT_WINDOW_ACCUM_GREEN_SIZE = 112; + GLUT_WINDOW_ACCUM_BLUE_SIZE = 113; + GLUT_WINDOW_ACCUM_ALPHA_SIZE = 114; + GLUT_WINDOW_DOUBLEBUFFER = 115; + GLUT_WINDOW_RGBA = 116; + GLUT_WINDOW_PARENT = 117; + GLUT_WINDOW_NUM_CHILDREN = 118; + GLUT_WINDOW_COLORMAP_SIZE = 119; + GLUT_WINDOW_NUM_SAMPLES = 120; + GLUT_WINDOW_STEREO = 121; + GLUT_WINDOW_CURSOR = 122; + GLUT_SCREEN_WIDTH = 200; + GLUT_SCREEN_HEIGHT = 201; + GLUT_SCREEN_WIDTH_MM = 202; + GLUT_SCREEN_HEIGHT_MM = 203; + GLUT_MENU_NUM_ITEMS = 300; + GLUT_DISPLAY_MODE_POSSIBLE = 400; + GLUT_INIT_WINDOW_X = 500; + GLUT_INIT_WINDOW_Y = 501; + GLUT_INIT_WINDOW_WIDTH = 502; + GLUT_INIT_WINDOW_HEIGHT = 503; + GLUT_INIT_DISPLAY_MODE = 504; + GLUT_ELAPSED_TIME = 700; + + // glutDeviceGet parameters. + GLUT_HAS_KEYBOARD = 600; + GLUT_HAS_MOUSE = 601; + GLUT_HAS_SPACEBALL = 602; + GLUT_HAS_DIAL_AND_BUTTON_BOX = 603; + GLUT_HAS_TABLET = 604; + GLUT_NUM_MOUSE_BUTTONS = 605; + GLUT_NUM_SPACEBALL_BUTTONS = 606; + GLUT_NUM_BUTTON_BOX_BUTTONS = 607; + GLUT_NUM_DIALS = 608; + GLUT_NUM_TABLET_BUTTONS = 609; + + // glutLayerGet parameters. + GLUT_OVERLAY_POSSIBLE = 800; + GLUT_LAYER_IN_USE = 801; + GLUT_HAS_OVERLAY = 802; + GLUT_TRANSPARENT_INDEX = 803; + GLUT_NORMAL_DAMAGED = 804; + GLUT_OVERLAY_DAMAGED = 805; + + // glutVideoResizeGet parameters. + GLUT_VIDEO_RESIZE_POSSIBLE = 900; + GLUT_VIDEO_RESIZE_IN_USE = 901; + GLUT_VIDEO_RESIZE_X_DELTA = 902; + GLUT_VIDEO_RESIZE_Y_DELTA = 903; + GLUT_VIDEO_RESIZE_WIDTH_DELTA = 904; + GLUT_VIDEO_RESIZE_HEIGHT_DELTA = 905; + GLUT_VIDEO_RESIZE_X = 906; + GLUT_VIDEO_RESIZE_Y = 907; + GLUT_VIDEO_RESIZE_WIDTH = 908; + GLUT_VIDEO_RESIZE_HEIGHT = 909; + + // glutGetModifiers return mask. + GLUT_ACTIVE_SHIFT = 1; + GLUT_ACTIVE_CTRL = 2; + GLUT_ACTIVE_ALT = 4; + + // glutSetCursor parameters. + // Basic arrows. + GLUT_CURSOR_RIGHT_ARROW = 0; + GLUT_CURSOR_LEFT_ARROW = 1; + // Symbolic cursor shapes. + GLUT_CURSOR_INFO = 2; + GLUT_CURSOR_DESTROY = 3; + GLUT_CURSOR_HELP = 4; + GLUT_CURSOR_CYCLE = 5; + GLUT_CURSOR_SPRAY = 6; + GLUT_CURSOR_WAIT = 7; + GLUT_CURSOR_TEXT = 8; + GLUT_CURSOR_CROSSHAIR = 9; + // Directional cursors. + GLUT_CURSOR_UP_DOWN = 10; + GLUT_CURSOR_LEFT_RIGHT = 11; + // Sizing cursors. + GLUT_CURSOR_TOP_SIDE = 12; + GLUT_CURSOR_BOTTOM_SIDE = 13; + GLUT_CURSOR_LEFT_SIDE = 14; + GLUT_CURSOR_RIGHT_SIDE = 15; + GLUT_CURSOR_TOP_LEFT_CORNER = 16; + GLUT_CURSOR_TOP_RIGHT_CORNER = 17; + GLUT_CURSOR_BOTTOM_RIGHT_CORNER = 18; + GLUT_CURSOR_BOTTOM_LEFT_CORNER = 19; + // Inherit from parent window. + GLUT_CURSOR_INHERIT = 100; + // Blank cursor. + GLUT_CURSOR_NONE = 101; + // Fullscreen crosshair (if available). + GLUT_CURSOR_FULL_CROSSHAIR = 102; + + // GLUT game mode sub-API. + // glutGameModeGet. + GLUT_GAME_MODE_ACTIVE = 0; + GLUT_GAME_MODE_POSSIBLE = 1; + GLUT_GAME_MODE_WIDTH = 2; + GLUT_GAME_MODE_HEIGHT = 3; + GLUT_GAME_MODE_PIXEL_DEPTH = 4; + GLUT_GAME_MODE_REFRESH_RATE = 5; + GLUT_GAME_MODE_DISPLAY_CHANGED = 6; + +var +// GLUT initialization sub-API. + glutInit: procedure(argcp: PInteger; argv: PPChar); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutInitDisplayMode: procedure(mode: Word); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutInitDisplayString: procedure(const str: PChar); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutInitWindowPosition: procedure(x, y: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutInitWindowSize: procedure(width, height: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutMainLoop: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +// GLUT window sub-API. + glutCreateWindow: function(const title: PChar): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutCreateSubWindow: function(win, x, y, width, height: Integer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutDestroyWindow: procedure(win: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPostRedisplay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPostWindowRedisplay: procedure(win: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSwapBuffers: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutGetWindow: function: Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSetWindow: procedure(win: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSetWindowTitle: procedure(const title: PChar); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSetIconTitle: procedure(const title: PChar); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPositionWindow: procedure(x, y: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutReshapeWindow: procedure(width, height: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPopWindow: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPushWindow: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutIconifyWindow: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutShowWindow: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutHideWindow: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutFullScreen: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSetCursor: procedure(cursor: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWarpPointer: procedure(x, y: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +// GLUT overlay sub-API. + glutEstablishOverlay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutRemoveOverlay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutUseLayer: procedure(layer: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPostOverlayRedisplay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPostWindowOverlayRedisplay: procedure(win: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutShowOverlay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutHideOverlay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +// GLUT menu sub-API. + glutCreateMenu: function(callback: TGlut1IntCallback): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutDestroyMenu: procedure(menu: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutGetMenu: function: Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSetMenu: procedure(menu: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutAddMenuEntry: procedure(const caption: PChar; value: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutAddSubMenu: procedure(const caption: PChar; submenu: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutChangeToMenuEntry: procedure(item: Integer; const caption: PChar; value: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutChangeToSubMenu: procedure(item: Integer; const caption: PChar; submenu: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutRemoveMenuItem: procedure(item: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutAttachMenu: procedure(button: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutDetachMenu: procedure(button: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +// GLUTsub-API. + glutDisplayFunc: procedure(f: TGlutVoidCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutReshapeFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutKeyboardFunc: procedure(f: TGlut1Char2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutMouseFunc: procedure(f: TGlut4IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutMotionFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPassiveMotionFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutEntryFunc: procedure(f: TGlut1IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutVisibilityFunc: procedure(f: TGlut1IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutIdleFunc: procedure(f: TGlutVoidCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutTimerFunc: procedure(millis: Word; f: TGlut1IntCallback; value: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutMenuStateFunc: procedure(f: TGlut1IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSpecialFunc: procedure(f: TGlut3IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSpaceballMotionFunc: procedure(f: TGlut3IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSpaceballRotateFunc: procedure(f: TGlut3IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSpaceballButtonFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutButtonBoxFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutDialsFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutTabletMotionFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutTabletButtonFunc: procedure(f: TGlut4IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutMenuStatusFunc: procedure(f: TGlut3IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutOverlayDisplayFunc: procedure(f:TGlutVoidCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWindowStatusFunc: procedure(f: TGlut1IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +// GLUT color index sub-API. + glutSetColor: procedure(cell: Integer; red, green, blue: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutGetColor: function(ndx, component: Integer): GLfloat; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutCopyColormap: procedure(win: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +// GLUT state retrieval sub-API. + glutGet: function(t: GLenum): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutDeviceGet: function(t: GLenum): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +// GLUT extension support sub-API + glutExtensionSupported: function(const name: PChar): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutGetModifiers: function: Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutLayerGet: function(t: GLenum): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +// GLUT font sub-API + glutBitmapCharacter: procedure(font : pointer; character: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutBitmapWidth: function(font : pointer; character: Integer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutStrokeCharacter: procedure(font : pointer; character: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutStrokeWidth: function(font : pointer; character: Integer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutBitmapLength: function(font: pointer; const str: PChar): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutStrokeLength: function(font: pointer; const str: PChar): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +// GLUT pre-built models sub-API + glutWireSphere: procedure(radius: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidSphere: procedure(radius: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireCone: procedure(base, height: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidCone: procedure(base, height: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireCube: procedure(size: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidCube: procedure(size: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireTorus: procedure(innerRadius, outerRadius: GLdouble; sides, rings: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidTorus: procedure(innerRadius, outerRadius: GLdouble; sides, rings: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireDodecahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidDodecahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireTeapot: procedure(size: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidTeapot: procedure(size: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireOctahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidOctahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireTetrahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidTetrahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireIcosahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidIcosahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +// GLUT video resize sub-API. + glutVideoResizeGet: function(param: GLenum): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSetupVideoResizing: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutStopVideoResizing: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutVideoResize: procedure(x, y, width, height: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutVideoPan: procedure(x, y, width, height: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +// GLUT debugging sub-API. + glutReportErrors: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +var + //example glutGameModeString('1280x1024:32@75'); + glutGameModeString : procedure (const AString : PChar); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutEnterGameMode : function : integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutLeaveGameMode : procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutGameModeGet : function (mode : GLenum) : integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +procedure LoadGlut(const dll: PChar); +procedure FreeGlut; + +implementation + +var + LibGLUT : TModuleHandle; + +procedure FreeGlut; +begin + + UnLoadModule( LibGLUT ); + + @glutInit := nil; + @glutInitDisplayMode := nil; + @glutInitDisplayString := nil; + @glutInitWindowPosition := nil; + @glutInitWindowSize := nil; + @glutMainLoop := nil; + @glutCreateWindow := nil; + @glutCreateSubWindow := nil; + @glutDestroyWindow := nil; + @glutPostRedisplay := nil; + @glutPostWindowRedisplay := nil; + @glutSwapBuffers := nil; + @glutGetWindow := nil; + @glutSetWindow := nil; + @glutSetWindowTitle := nil; + @glutSetIconTitle := nil; + @glutPositionWindow := nil; + @glutReshapeWindow := nil; + @glutPopWindow := nil; + @glutPushWindow := nil; + @glutIconifyWindow := nil; + @glutShowWindow := nil; + @glutHideWindow := nil; + @glutFullScreen := nil; + @glutSetCursor := nil; + @glutWarpPointer := nil; + @glutEstablishOverlay := nil; + @glutRemoveOverlay := nil; + @glutUseLayer := nil; + @glutPostOverlayRedisplay := nil; + @glutPostWindowOverlayRedisplay := nil; + @glutShowOverlay := nil; + @glutHideOverlay := nil; + @glutCreateMenu := nil; + @glutDestroyMenu := nil; + @glutGetMenu := nil; + @glutSetMenu := nil; + @glutAddMenuEntry := nil; + @glutAddSubMenu := nil; + @glutChangeToMenuEntry := nil; + @glutChangeToSubMenu := nil; + @glutRemoveMenuItem := nil; + @glutAttachMenu := nil; + @glutDetachMenu := nil; + @glutDisplayFunc := nil; + @glutReshapeFunc := nil; + @glutKeyboardFunc := nil; + @glutMouseFunc := nil; + @glutMotionFunc := nil; + @glutPassiveMotionFunc := nil; + @glutEntryFunc := nil; + @glutVisibilityFunc := nil; + @glutIdleFunc := nil; + @glutTimerFunc := nil; + @glutMenuStateFunc := nil; + @glutSpecialFunc := nil; + @glutSpaceballMotionFunc := nil; + @glutSpaceballRotateFunc := nil; + @glutSpaceballButtonFunc := nil; + @glutButtonBoxFunc := nil; + @glutDialsFunc := nil; + @glutTabletMotionFunc := nil; + @glutTabletButtonFunc := nil; + @glutMenuStatusFunc := nil; + @glutOverlayDisplayFunc := nil; + @glutWindowStatusFunc := nil; + @glutSetColor := nil; + @glutGetColor := nil; + @glutCopyColormap := nil; + @glutGet := nil; + @glutDeviceGet := nil; + @glutExtensionSupported := nil; + @glutGetModifiers := nil; + @glutLayerGet := nil; + @glutBitmapCharacter := nil; + @glutBitmapWidth := nil; + @glutStrokeCharacter := nil; + @glutStrokeWidth := nil; + @glutBitmapLength := nil; + @glutStrokeLength := nil; + @glutWireSphere := nil; + @glutSolidSphere := nil; + @glutWireCone := nil; + @glutSolidCone := nil; + @glutWireCube := nil; + @glutSolidCube := nil; + @glutWireTorus := nil; + @glutSolidTorus := nil; + @glutWireDodecahedron := nil; + @glutSolidDodecahedron := nil; + @glutWireTeapot := nil; + @glutSolidTeapot := nil; + @glutWireOctahedron := nil; + @glutSolidOctahedron := nil; + @glutWireTetrahedron := nil; + @glutSolidTetrahedron := nil; + @glutWireIcosahedron := nil; + @glutSolidIcosahedron := nil; + @glutVideoResizeGet := nil; + @glutSetupVideoResizing := nil; + @glutStopVideoResizing := nil; + @glutVideoResize := nil; + @glutVideoPan := nil; + @glutReportErrors := nil; + +end; + +procedure LoadGlut(const dll: PChar); +begin + + FreeGlut; + + if LoadModule( LibGLUT, dll ) then + begin + @glutInit := GetModuleSymbol(LibGLUT, 'glutInit'); + @glutInitDisplayMode := GetModuleSymbol(LibGLUT, 'glutInitDisplayMode'); + @glutInitDisplayString := GetModuleSymbol(LibGLUT, 'glutInitDisplayString'); + @glutInitWindowPosition := GetModuleSymbol(LibGLUT, 'glutInitWindowPosition'); + @glutInitWindowSize := GetModuleSymbol(LibGLUT, 'glutInitWindowSize'); + @glutMainLoop := GetModuleSymbol(LibGLUT, 'glutMainLoop'); + @glutCreateWindow := GetModuleSymbol(LibGLUT, 'glutCreateWindow'); + @glutCreateSubWindow := GetModuleSymbol(LibGLUT, 'glutCreateSubWindow'); + @glutDestroyWindow := GetModuleSymbol(LibGLUT, 'glutDestroyWindow'); + @glutPostRedisplay := GetModuleSymbol(LibGLUT, 'glutPostRedisplay'); + @glutPostWindowRedisplay := GetModuleSymbol(LibGLUT, 'glutPostWindowRedisplay'); + @glutSwapBuffers := GetModuleSymbol(LibGLUT, 'glutSwapBuffers'); + @glutGetWindow := GetModuleSymbol(LibGLUT, 'glutGetWindow'); + @glutSetWindow := GetModuleSymbol(LibGLUT, 'glutSetWindow'); + @glutSetWindowTitle := GetModuleSymbol(LibGLUT, 'glutSetWindowTitle'); + @glutSetIconTitle := GetModuleSymbol(LibGLUT, 'glutSetIconTitle'); + @glutPositionWindow := GetModuleSymbol(LibGLUT, 'glutPositionWindow'); + @glutReshapeWindow := GetModuleSymbol(LibGLUT, 'glutReshapeWindow'); + @glutPopWindow := GetModuleSymbol(LibGLUT, 'glutPopWindow'); + @glutPushWindow := GetModuleSymbol(LibGLUT, 'glutPushWindow'); + @glutIconifyWindow := GetModuleSymbol(LibGLUT, 'glutIconifyWindow'); + @glutShowWindow := GetModuleSymbol(LibGLUT, 'glutShowWindow'); + @glutHideWindow := GetModuleSymbol(LibGLUT, 'glutHideWindow'); + @glutFullScreen := GetModuleSymbol(LibGLUT, 'glutFullScreen'); + @glutSetCursor := GetModuleSymbol(LibGLUT, 'glutSetCursor'); + @glutWarpPointer := GetModuleSymbol(LibGLUT, 'glutWarpPointer'); + @glutEstablishOverlay := GetModuleSymbol(LibGLUT, 'glutEstablishOverlay'); + @glutRemoveOverlay := GetModuleSymbol(LibGLUT, 'glutRemoveOverlay'); + @glutUseLayer := GetModuleSymbol(LibGLUT, 'glutUseLayer'); + @glutPostOverlayRedisplay := GetModuleSymbol(LibGLUT, 'glutPostOverlayRedisplay'); + @glutPostWindowOverlayRedisplay := GetModuleSymbol(LibGLUT, 'glutPostWindowOverlayRedisplay'); + @glutShowOverlay := GetModuleSymbol(LibGLUT, 'glutShowOverlay'); + @glutHideOverlay := GetModuleSymbol(LibGLUT, 'glutHideOverlay'); + @glutCreateMenu := GetModuleSymbol(LibGLUT, 'glutCreateMenu'); + @glutDestroyMenu := GetModuleSymbol(LibGLUT, 'glutDestroyMenu'); + @glutGetMenu := GetModuleSymbol(LibGLUT, 'glutGetMenu'); + @glutSetMenu := GetModuleSymbol(LibGLUT, 'glutSetMenu'); + @glutAddMenuEntry := GetModuleSymbol(LibGLUT, 'glutAddMenuEntry'); + @glutAddSubMenu := GetModuleSymbol(LibGLUT, 'glutAddSubMenu'); + @glutChangeToMenuEntry := GetModuleSymbol(LibGLUT, 'glutChangeToMenuEntry'); + @glutChangeToSubMenu := GetModuleSymbol(LibGLUT, 'glutChangeToSubMenu'); + @glutRemoveMenuItem := GetModuleSymbol(LibGLUT, 'glutRemoveMenuItem'); + @glutAttachMenu := GetModuleSymbol(LibGLUT, 'glutAttachMenu'); + @glutDetachMenu := GetModuleSymbol(LibGLUT, 'glutDetachMenu'); + @glutDisplayFunc := GetModuleSymbol(LibGLUT, 'glutDisplayFunc'); + @glutReshapeFunc := GetModuleSymbol(LibGLUT, 'glutReshapeFunc'); + @glutKeyboardFunc := GetModuleSymbol(LibGLUT, 'glutKeyboardFunc'); + @glutMouseFunc := GetModuleSymbol(LibGLUT, 'glutMouseFunc'); + @glutMotionFunc := GetModuleSymbol(LibGLUT, 'glutMotionFunc'); + @glutPassiveMotionFunc := GetModuleSymbol(LibGLUT, 'glutPassiveMotionFunc'); + @glutEntryFunc := GetModuleSymbol(LibGLUT, 'glutEntryFunc'); + @glutVisibilityFunc := GetModuleSymbol(LibGLUT, 'glutVisibilityFunc'); + @glutIdleFunc := GetModuleSymbol(LibGLUT, 'glutIdleFunc'); + @glutTimerFunc := GetModuleSymbol(LibGLUT, 'glutTimerFunc'); + @glutMenuStateFunc := GetModuleSymbol(LibGLUT, 'glutMenuStateFunc'); + @glutSpecialFunc := GetModuleSymbol(LibGLUT, 'glutSpecialFunc'); + @glutSpaceballMotionFunc := GetModuleSymbol(LibGLUT, 'glutSpaceballMotionFunc'); + @glutSpaceballRotateFunc := GetModuleSymbol(LibGLUT, 'glutSpaceballRotateFunc'); + @glutSpaceballButtonFunc := GetModuleSymbol(LibGLUT, 'glutSpaceballButtonFunc'); + @glutButtonBoxFunc := GetModuleSymbol(LibGLUT, 'glutButtonBoxFunc'); + @glutDialsFunc := GetModuleSymbol(LibGLUT, 'glutDialsFunc'); + @glutTabletMotionFunc := GetModuleSymbol(LibGLUT, 'glutTabletMotionFunc'); + @glutTabletButtonFunc := GetModuleSymbol(LibGLUT, 'glutTabletButtonFunc'); + @glutMenuStatusFunc := GetModuleSymbol(LibGLUT, 'glutMenuStatusFunc'); + @glutOverlayDisplayFunc := GetModuleSymbol(LibGLUT, 'glutOverlayDisplayFunc'); + @glutWindowStatusFunc := GetModuleSymbol(LibGLUT, 'glutWindowStatusFunc'); + @glutSetColor := GetModuleSymbol(LibGLUT, 'glutSetColor'); + @glutGetColor := GetModuleSymbol(LibGLUT, 'glutGetColor'); + @glutCopyColormap := GetModuleSymbol(LibGLUT, 'glutCopyColormap'); + @glutGet := GetModuleSymbol(LibGLUT, 'glutGet'); + @glutDeviceGet := GetModuleSymbol(LibGLUT, 'glutDeviceGet'); + @glutExtensionSupported := GetModuleSymbol(LibGLUT, 'glutExtensionSupported'); + @glutGetModifiers := GetModuleSymbol(LibGLUT, 'glutGetModifiers'); + @glutLayerGet := GetModuleSymbol(LibGLUT, 'glutLayerGet'); + @glutBitmapCharacter := GetModuleSymbol(LibGLUT, 'glutBitmapCharacter'); + @glutBitmapWidth := GetModuleSymbol(LibGLUT, 'glutBitmapWidth'); + @glutStrokeCharacter := GetModuleSymbol(LibGLUT, 'glutStrokeCharacter'); + @glutStrokeWidth := GetModuleSymbol(LibGLUT, 'glutStrokeWidth'); + @glutBitmapLength := GetModuleSymbol(LibGLUT, 'glutBitmapLength'); + @glutStrokeLength := GetModuleSymbol(LibGLUT, 'glutStrokeLength'); + @glutWireSphere := GetModuleSymbol(LibGLUT, 'glutWireSphere'); + @glutSolidSphere := GetModuleSymbol(LibGLUT, 'glutSolidSphere'); + @glutWireCone := GetModuleSymbol(LibGLUT, 'glutWireCone'); + @glutSolidCone := GetModuleSymbol(LibGLUT, 'glutSolidCone'); + @glutWireCube := GetModuleSymbol(LibGLUT, 'glutWireCube'); + @glutSolidCube := GetModuleSymbol(LibGLUT, 'glutSolidCube'); + @glutWireTorus := GetModuleSymbol(LibGLUT, 'glutWireTorus'); + @glutSolidTorus := GetModuleSymbol(LibGLUT, 'glutSolidTorus'); + @glutWireDodecahedron := GetModuleSymbol(LibGLUT, 'glutWireDodecahedron'); + @glutSolidDodecahedron := GetModuleSymbol(LibGLUT, 'glutSolidDodecahedron'); + @glutWireTeapot := GetModuleSymbol(LibGLUT, 'glutWireTeapot'); + @glutSolidTeapot := GetModuleSymbol(LibGLUT, 'glutSolidTeapot'); + @glutWireOctahedron := GetModuleSymbol(LibGLUT, 'glutWireOctahedron'); + @glutSolidOctahedron := GetModuleSymbol(LibGLUT, 'glutSolidOctahedron'); + @glutWireTetrahedron := GetModuleSymbol(LibGLUT, 'glutWireTetrahedron'); + @glutSolidTetrahedron := GetModuleSymbol(LibGLUT, 'glutSolidTetrahedron'); + @glutWireIcosahedron := GetModuleSymbol(LibGLUT, 'glutWireIcosahedron'); + @glutSolidIcosahedron := GetModuleSymbol(LibGLUT, 'glutSolidIcosahedron'); + @glutVideoResizeGet := GetModuleSymbol(LibGLUT, 'glutVideoResizeGet'); + @glutSetupVideoResizing := GetModuleSymbol(LibGLUT, 'glutSetupVideoResizing'); + @glutStopVideoResizing := GetModuleSymbol(LibGLUT, 'glutStopVideoResizing'); + @glutVideoResize := GetModuleSymbol(LibGLUT, 'glutVideoResize'); + @glutVideoPan := GetModuleSymbol(LibGLUT, 'glutVideoPan'); + @glutReportErrors := GetModuleSymbol(LibGLUT, 'glutReportErrors'); + @glutGameModeString := GetModuleSymbol(LibGLUT, 'glutGameModeString'); + @glutEnterGameMode := GetModuleSymbol(LibGLUT, 'glutEnterGameMode'); + @glutLeaveGameMode := GetModuleSymbol(LibGLUT, 'glutLeaveGameMode'); + @glutGameModeGet := GetModuleSymbol(LibGLUT, 'glutGameModeGet'); + end; +end; + +initialization + LoadGlut( GlutLibName ); + +finalization + FreeGlut; + +end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glx.pas b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glx.pas new file mode 100644 index 00000000..e478758f --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glx.pas @@ -0,0 +1,276 @@ +unit glx; +{ + $Id: glx.pas,v 1.1 2004/03/30 21:53:55 savage Exp $ + + Translation of the Mesa GLX headers for FreePascal + Copyright (C) 1999 Sebastian Guenther + + + Mesa 3-D graphics library + Version: 3.0 + Copyright (C) 1995-1998 Brian Paul + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +} + +// {$MODE delphi} // objfpc would not work because of direct proc var assignments + +{You have to enable Macros (compiler switch "-Sm") for compiling this unit! + This is necessary for supporting different platforms with different calling + conventions via a single unit.} + +{ + $Log: glx.pas,v $ + Revision 1.1 2004/03/30 21:53:55 savage + Moved to it's own folder. + + Revision 1.5 2004/02/15 22:48:35 savage + More FPC and FreeBSD support changes. + + Revision 1.4 2004/02/14 22:36:29 savage + Fixed inconsistencies of using LoadLibrary and LoadModule. + Now all units make use of LoadModule rather than LoadLibrary and other dynamic proc procedures. + + Revision 1.3 2004/02/14 00:23:39 savage + As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. + + Revision 1.2 2004/02/14 00:09:19 savage + Changed uses to now make use of moduleloader.pas rather than dllfuncs.pas + + Revision 1.1 2004/02/05 00:08:19 savage + Module 1.0 release + + Revision 1.1 2003/05/11 13:18:03 savage + Newest OpenGL Headers For Delphi, Kylix and FPC + + Revision 1.1 2002/10/13 13:57:31 sg + * Finally, the new units are available: Match the C headers more closely; + support for OpenGL extensions, and much more. Based on the Delphi units + by Tom Nuydens of delphi3d.net + +} + +interface + +{$I jedi-sdl.inc} + +//{$MACRO ON} + +{$IFDEF UNIX} + uses + {$IFDEF FPC} + x, + xlib, + xutil; + {$ELSE} + xlib; + {$ENDIF} + {$DEFINE HasGLX} // Activate GLX stuff +{$ELSE} + {$MESSAGE Unsupported platform.} +{$ENDIF} + +{$IFNDEF HasGLX} + {$MESSAGE GLX not present on this platform.} +{$ENDIF} + + +// ======================================================= +// Unit specific extensions +// ======================================================= + +// Note: Requires that the GL library has already been initialized +function InitGLX: Boolean; + +var + GLXDumpUnresolvedFunctions, + GLXInitialized: Boolean; + + +// ======================================================= +// GLX consts, types and functions +// ======================================================= + +// Tokens for glXChooseVisual and glXGetConfig: +const + GLX_USE_GL = 1; + GLX_BUFFER_SIZE = 2; + GLX_LEVEL = 3; + GLX_RGBA = 4; + GLX_DOUBLEBUFFER = 5; + GLX_STEREO = 6; + GLX_AUX_BUFFERS = 7; + GLX_RED_SIZE = 8; + GLX_GREEN_SIZE = 9; + GLX_BLUE_SIZE = 10; + GLX_ALPHA_SIZE = 11; + GLX_DEPTH_SIZE = 12; + GLX_STENCIL_SIZE = 13; + GLX_ACCUM_RED_SIZE = 14; + GLX_ACCUM_GREEN_SIZE = 15; + GLX_ACCUM_BLUE_SIZE = 16; + GLX_ACCUM_ALPHA_SIZE = 17; + + // GLX_EXT_visual_info extension + GLX_X_VISUAL_TYPE_EXT = $22; + GLX_TRANSPARENT_TYPE_EXT = $23; + GLX_TRANSPARENT_INDEX_VALUE_EXT = $24; + GLX_TRANSPARENT_RED_VALUE_EXT = $25; + GLX_TRANSPARENT_GREEN_VALUE_EXT = $26; + GLX_TRANSPARENT_BLUE_VALUE_EXT = $27; + GLX_TRANSPARENT_ALPHA_VALUE_EXT = $28; + + + // Error codes returned by glXGetConfig: + GLX_BAD_SCREEN = 1; + GLX_BAD_ATTRIBUTE = 2; + GLX_NO_EXTENSION = 3; + GLX_BAD_VISUAL = 4; + GLX_BAD_CONTEXT = 5; + GLX_BAD_VALUE = 6; + GLX_BAD_ENUM = 7; + + // GLX 1.1 and later: + GLX_VENDOR = 1; + GLX_VERSION = 2; + GLX_EXTENSIONS = 3; + + // GLX_visual_info extension + GLX_TRUE_COLOR_EXT = $8002; + GLX_DIRECT_COLOR_EXT = $8003; + GLX_PSEUDO_COLOR_EXT = $8004; + GLX_STATIC_COLOR_EXT = $8005; + GLX_GRAY_SCALE_EXT = $8006; + GLX_STATIC_GRAY_EXT = $8007; + GLX_NONE_EXT = $8000; + GLX_TRANSPARENT_RGB_EXT = $8008; + GLX_TRANSPARENT_INDEX_EXT = $8009; + +type + // From XLib: + {$IFNDEF FPC} + TXID = XID; + {$ENDIF} + XPixmap = TXID; + XFont = TXID; + XColormap = TXID; + + GLXContext = Pointer; + GLXPixmap = TXID; + GLXDrawable = TXID; + GLXContextID = TXID; + +var + glXChooseVisual: function(dpy: PDisplay; screen: Integer; var attribList: Integer): PXVisualInfo; cdecl; + glXCreateContext: function(dpy: PDisplay; vis: PXVisualInfo; shareList: GLXContext; direct: Boolean): GLXContext; cdecl; + glXDestroyContext: procedure(dpy: PDisplay; ctx: GLXContext); cdecl; + glXMakeCurrent: function(dpy: PDisplay; drawable: GLXDrawable; ctx: GLXContext): Boolean; cdecl; + glXCopyContext: procedure(dpy: PDisplay; src, dst: GLXContext; mask: LongWord); cdecl; + glXSwapBuffers: procedure(dpy: PDisplay; drawable: GLXDrawable); cdecl; + glXCreateGLXPixmap: function(dpy: PDisplay; visual: PXVisualInfo; pixmap: XPixmap): GLXPixmap; cdecl; + glXDestroyGLXPixmap: procedure(dpy: PDisplay; pixmap: GLXPixmap); cdecl; + glXQueryExtension: function(dpy: PDisplay; var errorb, event: Integer): Boolean; cdecl; + glXQueryVersion: function(dpy: PDisplay; var maj, min: Integer): Boolean; cdecl; + glXIsDirect: function(dpy: PDisplay; ctx: GLXContext): Boolean; cdecl; + glXGetConfig: function(dpy: PDisplay; visual: PXVisualInfo; attrib: Integer; var value: Integer): Integer; cdecl; + glXGetCurrentContext: function: GLXContext; cdecl; + glXGetCurrentDrawable: function: GLXDrawable; cdecl; + glXWaitGL: procedure; cdecl; + glXWaitX: procedure; cdecl; + glXUseXFont: procedure(font: XFont; first, count, list: Integer); cdecl; + + // GLX 1.1 and later + glXQueryExtensionsString: function(dpy: PDisplay; screen: Integer): PChar; cdecl; + glXQueryServerString: function(dpy: PDisplay; screen, name: Integer): PChar; cdecl; + glXGetClientString: function(dpy: PDisplay; name: Integer): PChar; cdecl; + + // Mesa GLX Extensions + glXCreateGLXPixmapMESA: function(dpy: PDisplay; visual: PXVisualInfo; pixmap: XPixmap; cmap: XColormap): GLXPixmap; cdecl; + glXReleaseBufferMESA: function(dpy: PDisplay; d: GLXDrawable): Boolean; cdecl; + glXCopySubBufferMESA: procedure(dpy: PDisplay; drawbale: GLXDrawable; x, y, width, height: Integer); cdecl; + glXGetVideoSyncSGI: function(var counter: LongWord): Integer; cdecl; + glXWaitVideoSyncSGI: function(divisor, remainder: Integer; var count: LongWord): Integer; cdecl; + + +// ======================================================= +// +// ======================================================= + +implementation + +uses + {$IFNDEF __GPC__} + SysUtils, + {$ENDIF} + moduleloader; + +(* {$LINKLIB m} *) + +var + libGLX: TModuleHandle; + +function InitGLXFromLibrary( dll : PChar ): Boolean; +begin + Result := False; + + if LoadModule( libGLX, dll ) then + exit; + + glXChooseVisual := GetModuleSymbol(libglx, 'glXChooseVisual'); + glXCreateContext := GetModuleSymbol(libglx, 'glXCreateContext'); + glXDestroyContext := GetModuleSymbol(libglx, 'glXDestroyContext'); + glXMakeCurrent := GetModuleSymbol(libglx, 'glXMakeCurrent'); + glXCopyContext := GetModuleSymbol(libglx, 'glXCopyContext'); + glXSwapBuffers := GetModuleSymbol(libglx, 'glXSwapBuffers'); + glXCreateGLXPixmap := GetModuleSymbol(libglx, 'glXCreateGLXPixmap'); + glXDestroyGLXPixmap := GetModuleSymbol(libglx, 'glXDestroyGLXPixmap'); + glXQueryExtension := GetModuleSymbol(libglx, 'glXQueryExtension'); + glXQueryVersion := GetModuleSymbol(libglx, 'glXQueryVersion'); + glXIsDirect := GetModuleSymbol(libglx, 'glXIsDirect'); + glXGetConfig := GetModuleSymbol(libglx, 'glXGetConfig'); + glXGetCurrentContext := GetModuleSymbol(libglx, 'glXGetCurrentContext'); + glXGetCurrentDrawable := GetModuleSymbol(libglx, 'glXGetCurrentDrawable'); + glXWaitGL := GetModuleSymbol(libglx, 'glXWaitGL'); + glXWaitX := GetModuleSymbol(libglx, 'glXWaitX'); + glXUseXFont := GetModuleSymbol(libglx, 'glXUseXFont'); + // GLX 1.1 and later + glXQueryExtensionsString := GetModuleSymbol(libglx, 'glXQueryExtensionsString'); + glXQueryServerString := GetModuleSymbol(libglx, 'glXQueryServerString'); + glXGetClientString := GetModuleSymbol(libglx, 'glXGetClientString'); + // Mesa GLX Extensions + glXCreateGLXPixmapMESA := GetModuleSymbol(libglx, 'glXCreateGLXPixmapMESA'); + glXReleaseBufferMESA := GetModuleSymbol(libglx, 'glXReleaseBufferMESA'); + glXCopySubBufferMESA := GetModuleSymbol(libglx, 'glXCopySubBufferMESA'); + glXGetVideoSyncSGI := GetModuleSymbol(libglx, 'glXGetVideoSyncSGI'); + glXWaitVideoSyncSGI := GetModuleSymbol(libglx, 'glXWaitVideoSyncSGI'); + + GLXInitialized := True; + Result := True; +end; + +function InitGLX: Boolean; +begin + Result := InitGLXFromLibrary('libGL.so') or + InitGLXFromLibrary('libGL.so.1') or + InitGLXFromLibrary('libMesaGL.so') or + InitGLXFromLibrary('libMesaGL.so.3'); +end; + + +initialization + InitGLX; +finalization + UnloadModule(libGLX); +end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/opengl12.pas b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/opengl12.pas new file mode 100644 index 00000000..763edaee --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/opengl12.pas @@ -0,0 +1,9967 @@ +unit opengl12; +{ + $Id: opengl12.pas,v 1.2 2004/04/05 09:59:46 savage Exp $ + +} +{******************************************************************************} +{ } +{ Borland Delphi Runtime Library } +{ OpenGL interface unit } +{ } +{ } +{ This is an interface unit for the use of OpenGL from within Delphi and Kylix.} +{ It contains the translations of gl.h, glu.h, glx.h as well as context } +{ and extension management functions. } +{ } +{ The original Pascal code is: OpenGL12.pas } +{ The initial developer of the Pascal code is Mike Lischke } +{ } +{ } +{ Portions created by Microsoft are } +{ Copyright (C) 1995-2001 Microsoft Corporation. } +{ All Rights Reserved. } +{ } +{ Portions created by Silicon Graphics Incorporated are } +{ Copyright (C) 1995-2001 Silicon Graphics Incorporated } +{ All Rights Reserved. } +{ } +{ Portions created by NVidia are } +{ Copyright (C) 1995-2001 NVidia } +{ All Rights Reserved. } +{ } +{ Portions created by Brian Paul } +{ Copyright (C) 1995-2001 Brian Paul } +{ All Rights Reserved. } +{ } +{ } +{ The original file is: gl.h } +{ The original file is: glut.h } +{ The original file is: glx.h } +{ The original file is: glx.h } +{ } +{ Portions created by Mike Lischke are } +{ Copyright (C) 2001 Mike Lischke. } +{ } +{ Portions created by John O'Harrow are } +{ Copyright (C) 2001 John O'Harrow. } +{ } +{ Portions created by Eric Grange are } +{ Copyright (C) 2001 Eric Grange. } +{ } +{ Portions created by Olivier Chatelain } +{ Copyright (C) 2001 Olivier Chatelain. } +{ } +{ Portions created by Tom Nuydens } +{ Copyright (C) 2001 Tom Nuydens. } +{ } +{ Portions created by Matthias Thoma are } +{ Copyright (C) 2001 Matthias Thoma. } +{ } +{ Portions created by Sven Bobrowski are } +{ Copyright (C) 2001 Sven Bobrowski } +{ } +{ } +{ Obtained through: } +{ } +{ Joint Endeavour of Delphi Innovators (Project JEDI) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{******************************************************************************} + +//---------------------------------------------------------------------------------------------------------------------- +// +// This is an interface unit for the use of OpenGL from within Delphi and contains +// the translations of gl.h, glu.h as well as some support functions. +// OpenGL12.pas contains bug fixes and enhancements of Delphi's and other translations +// as well as support for extensions. +// +// NOTE: In order to fully support multi thread rendering it is necessary to hold all +// extension address in threadvars. For single threaded applications this would be an +// unnecessary time penalty, however. Hence there is a compiler switch to +// allow single threaded OpenGL application to use vars while multi threaded applications +// will use threadvars. By default the switch MULTITHREADOPENGL (see compiler switch under der interface keyword) +// is not active and must explicitly enabled to take effect. +// +//---------------------------------------------------------------------------------------------------------------------- +// +// function InitOpenGL: Boolean; +// Needed to load the OpenGL DLLs and all addresses of the standard functions. +// In case OpenGL is already initialized this function does nothing. No error +// is raised, if something goes wrong, but you need to inspect the result in order +// to know if all went okay. +// Result: True if successful or already loaded, False otherwise. +// +// function InitOpenGLFromLibrary(GL_Name, GLU_Name: String): Boolean; +// Same as InitOpenGL, but you can specify specific DLLs. Useful if you want to +// use different DLLs than the default ones. This function closes previously +// loaded DLLs before it tries to open the new libraries. +// Result: True if successful, False otherwise. +// +// procedure CloseOpenGL; +// Unloads the OpenGL DLLs and sets all function addresses to nil, including +// extensions. You can load and unload the DLLs as often as you like. +// +// procedure ClearExtensions; +// Sets all extension routines to nil. This is needed when you change the Pixelformat +// of your OpenGL window, since the availability of these routines changes from +// PixelFormat to Pixelformat (and also between various vendors). +// +// function CreateRenderingContext(DC: HDC; Options: TRCOptions; ColorBits, StencilBits, AccumBits, AuxBuffers: Integer; +// Layer: Integer; var Palette: HPALETTE): HGLRC; +// Sets up a pixel format and creates a new rendering context depending of the +// given parameters: +// DC - the device context for which the rc is to be created +// Options - options for the context, which the application would like to have +// (it is not guaranteed they will be available) +// ColorBits - the color depth of the device context (Note: Because of the internal DC handling of the VCL you +// should avoid using GetDeviceCaps for memory DCs which are members of a TBitmap class. +// Translate the Pixelformat member instead!) +// StencilBits - requested size of the stencil buffer +// AccumBits - requested size of the accumulation buffer +// AuxBuffers - requested number of auxiliary buffers +// Layer - ID for the layer for which the RC will be created (-1..-15 for underlay planes, 0 for main plane, +// 1..15 for overlay planes) +// Note: The layer handling is not yet complete as there is very few information +// available and (until now) no OpenGL implementation with layer support on the low budget market. +// Hence use 0 (for the main plane) as layer ID. +// Palette - Palette Handle created within function (need to use DeleteObject(Palette) to free this if <> 0) +// Result: the newly created context or 0 if setup failed +// +// procedure ActivateRenderingContext(DC: HDC; RC: HGLRC); +// Makes RC in DC 'current' (wglMakeCurrent(..)) and loads all extension addresses +// and flags if necessary. +// +// procedure DeactivateRenderingContext; +// Counterpart to ActivateRenderingContext. +// +// procedure DestroyRenderingContext(RC: HGLRC); +// RC will be destroyed and must be recreated if you want to use it again. +// +// procedure ReadExtensions; +// Determines which extensions for the current rendering context are available and +// loads their addresses. This procedure is called from ActivateRenderingContext +// if a new pixel format is used, but you can safely call it from where you want +// to actualize those values (under the condition that a rendering context MUST be +// active). +// +// procedure ReadImplementationProperties; +// Determines other properties of the OpenGL DLL (version, availability of extensions). +// Again, a valid rendering context must be active. +// +// function HasActiveContext: Boolean; +// Determines whether the calling thread has currently an active rendering context. +//---------------------------------------------------------------------------------------------------------------------- +// +// This translation is based on different sources: +// +// - first translation from Artemis Alliance Inc. +// - previous versions from Mike Lischke +// - Alexander Staubo +// - Borland OpenGL.pas (from Delphi 3) +// - Microsoft and SGI OpenGL header files +// - www.opengl.org, www.sgi.com/OpenGL +// - nVidia extension reference as of December 1999 +// - nVidia extension reference as of January 2001 +// - vertex_array_range sample by Tom Nuydens at Delphi3D +// - minor bug fixes and greatly extended by John O'Harrow (john@elmcrest.demon.co.uk) +// - initial context activation balancing by Eric Grange (egrange@infonie.fr) +// - additional nVidia extensions by Olivier Chatelain (Olivier.Chatelain@xitact.com) +// +// Contact: public@lischke-online.de, www.lischke-online.de +// +// Version: 1.2.11 +//---------------------------------------------------------------------------------------------------------------------- +// +// 12-Feb-2002 dml : +// - Further modifications to allow unit to compile under Free Pascal +// as suggested by "QuePasha Pepe" +// +// 25-OCT-2001 dre : +// - Made modifications to allow unit to compile under Free Pascal +// - added tMaxLogPalette declaration to Free Pascal +// - included fix to ReadExtensions +// - Added Set8088CW procedure +// +// 13-SEP-2001 ml: +// - added PWGLSwap etc. declarations for Delphi 3 +// 18-AUG-2001 ml: +// - multi thread support for function addresses (extensions) +// 28-JUL-2001 ml: +// - included original type names (+ $EXTERNALSYM directives) +// 10-JUL-2001 ml: +// - TGLubyte changed to UCHAR +// 05-JUL-2001 ml: +// - own exception type for OpenGL +// - TGLboolean is now of type BYTEBOOL +// 05-MAY-2001 ml: +// - correct tracking of RC creation and release as well as multithreaded RC activation +// - compatibility routines for users of other OpenGL unit variants +// - improved rendering context creation +// - bug fixes +// 01-MAY-2001 ml: +// - added more nVidia extensions +//---------------------------------------------------------------------------------------------------------------------- +{ April 03 2003 - DL : Added jedi-sdl.inc include file to support more } +{ Pascal compilers. Initial support is now included } +{ for GnuPascal, VirtualPascal, TMT and obviously } +{ continue support for Delphi Kylix and FreePascal. } +{ } +{ May 03 2003 - DL : under instruction from David Mears AKA } +{ Jason Siletto, I have added FPC Linux support. } +{ } +{******************************************************************************} +{ + $Log: opengl12.pas,v $ + Revision 1.2 2004/04/05 09:59:46 savage + Changes for FreePacal as suggested by Marco + + Revision 1.1 2004/03/30 21:53:55 savage + Moved to it's own folder. + + Revision 1.6 2004/02/20 17:26:19 savage + Extensions are now loaded using SDL_GL_GetProcAddress, thus making it more cross-platform compatible, but now more tied to SDL. + + Revision 1.5 2004/02/15 22:48:36 savage + More FPC and FreeBSD support changes. + + Revision 1.4 2004/02/14 22:36:29 savage + Fixed inconsistencies of using LoadLibrary and LoadModule. + Now all units make use of LoadModule rather than LoadLibrary and other dynamic proc procedures. + + Revision 1.3 2004/02/14 00:23:39 savage + As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. + + Revision 1.2 2004/02/14 00:09:19 savage + Changed uses to now make use of moduleloader.pas rather than dllfuncs.pas + + Revision 1.1 2004/02/05 00:08:20 savage + Module 1.0 release + + +} + +{$I jedi-sdl.inc} + +interface + +{.$define MULTITHREADOPENGL} + +uses +{$IFDEF __GPC__} + gpc; +{$ENDIF} + +{$IFDEF WIN32} + {$IFNDEF __GPC__} + Windows; + {$ENDIF} +{$ENDIF} + +{$IFDEF Unix} + {$IFDEF FPC} + {$IFDEF Ver1_0} + linux, + {$ELSE} + baseunix, + unix, + {$ENDIF} + x, + xlib, + xutil, + dl; + {$ELSE} + Types, + Libc, + Xlib; + {$ENDIF} +{$ENDIF} + +type + TRCOptions = set of ( opDoubleBuffered, opGDI, opStereo ); + + {$EXTERNALSYM GLenum} + GLenum = Cardinal; + TGLenum = Cardinal; + PGLenum = ^TGLenum; + + {$EXTERNALSYM GLboolean} + GLboolean = BYTEBOOL; + TGLboolean = BYTEBOOL; + PGLboolean = ^TGLboolean; + + {$EXTERNALSYM GLbitfield} + GLbitfield = Cardinal; + TGLbitfield = Cardinal; + PGLbitfield = ^TGLbitfield; + + {$EXTERNALSYM GLbyte} + GLbyte = ShortInt; + TGLbyte = ShortInt; + PGLbyte = ^TGLbyte; + + {$EXTERNALSYM GLshort} + GLshort = SmallInt; + TGLshort = SmallInt; + PGLshort = ^TGLshort; + + {$EXTERNALSYM GLint} + GLint = Integer; + TGLint = Integer; + PGLint = ^TGLint; + + {$EXTERNALSYM GLsizei} + GLsizei = Integer; + TGLsizei = Integer; + PGLsizei = ^TGLsizei; + + {$EXTERNALSYM GLubyte} + UCHAR = Byte; + GLubyte = UCHAR; + TGLubyte = UCHAR; + PGLubyte = ^TGLubyte; + + {$EXTERNALSYM GLushort} + GLushort = Word; + TGLushort = Word; + PGLushort = ^TGLushort; + + {$EXTERNALSYM GLuint} + GLuint = Cardinal; + TGLuint = Cardinal; + PGLuint = ^TGLuint; + + {$EXTERNALSYM GLfloat} + GLfloat = Single; + TGLfloat = Single; + PGLfloat = ^TGLfloat; + + {$EXTERNALSYM GLclampf} + GLclampf = Single; + TGLclampf = Single; + PGLclampf = ^TGLclampf; + + {$EXTERNALSYM GLdouble} + GLdouble = Double; + TGLdouble = Double; + PGLdouble = ^TGLdouble; + + {$EXTERNALSYM GLclampd} + GLclampd = Double; + TGLclampd = Double; + PGLclampd = ^TGLclampd; + + TVector3d = array[0..2] of GLdouble; + + TVector4i = array[0..3] of GLint; + TVector4f = array[0..3] of GLfloat; + TVector4p = array[0..3] of Pointer; + + TMatrix4f = array[0..3, 0..3] of GLfloat; + TMatrix4d = array[0..3, 0..3] of GLdouble; + + PPointer = ^Pointer; + +{$ifndef FPC} + {$ifdef MULTITHREADOPENGL} + threadvar + {$else} + var + {$endif} +{$else} +var +{$endif} + GL_VERSION_1_0, + GL_VERSION_1_1, + GL_VERSION_1_2, + GLU_VERSION_1_1, + GLU_VERSION_1_2, + GLU_VERSION_1_3: Boolean; + + // Extensions (gl) + GL_3DFX_multisample, + GL_3DFX_tbuffer, + GL_3DFX_texture_compression_FXT1, + + GL_APPLE_specular_vector, + GL_APPLE_transform_hint, + + GL_ARB_imaging, + GL_ARB_multisample, + GL_ARB_multitexture, + GL_ARB_texture_compression, + GL_ARB_texture_cube_map, + GL_ARB_transpose_matrix, + GL_ARB_vertex_blend, + + GL_EXT_422_pixels, + GL_EXT_abgr, + GL_EXT_bgra, + GL_EXT_blend_color, + GL_EXT_blend_func_separate, + GL_EXT_blend_logic_op, + GL_EXT_blend_minmax, + GL_EXT_blend_subtract, + GL_EXT_clip_volume_hint, + GL_EXT_cmyka, + GL_EXT_color_subtable, + GL_EXT_compiled_vertex_array, + GL_EXT_convolution, + GL_EXT_coordinate_frame, + GL_EXT_copy_texture, + GL_EXT_cull_vertex, + GL_EXT_draw_range_elements, + GL_EXT_fog_coord, + GL_EXT_histogram, + GL_EXT_index_array_formats, + GL_EXT_index_func, + GL_EXT_index_material, + GL_EXT_index_texture, + GL_EXT_light_max_exponent, + GL_EXT_light_texture, + GL_EXT_misc_attribute, + GL_EXT_multi_draw_arrays, + GL_EXT_multisample, + GL_EXT_packed_pixels, + GL_EXT_paletted_texture, + GL_EXT_pixel_transform, + GL_EXT_point_parameters, + GL_EXT_polygon_offset, + GL_EXT_rescale_normal, + GL_EXT_scene_marker, + GL_EXT_secondary_color, + GL_EXT_separate_specular_color, + GL_EXT_shared_texture_palette, + GL_EXT_stencil_wrap, + GL_EXT_subtexture, + GL_EXT_texture_color_table, + GL_EXT_texture_compression_s3tc, + GL_EXT_texture_cube_map, + GL_EXT_texture_edge_clamp, + GL_EXT_texture_env_add, + GL_EXT_texture_env_combine, + GL_EXT_texture_filter_anisotropic, + GL_EXT_texture_lod_bias, + GL_EXT_texture_object, + GL_EXT_texture_perturb_normal, + GL_EXT_texture3D, + GL_EXT_vertex_array, + GL_EXT_vertex_weighting, + + GL_FfdMaskSGIX, + GL_HP_convolution_border_modes, + GL_HP_image_transform, + GL_HP_occlusion_test, + GL_HP_texture_lighting, + + GL_IBM_cull_vertex, + GL_IBM_multimode_draw_arrays, + GL_IBM_rasterpos_clip, + GL_IBM_vertex_array_lists, + + GL_INGR_color_clamp, + GL_INGR_interlace_read, + + GL_INTEL_parallel_arrays, + + GL_KTX_buffer_region, + + GL_MESA_resize_buffers, + GL_MESA_window_pos, + + GL_NV_blend_square, + GL_NV_fog_distance, + GL_NV_light_max_exponent, + GL_NV_register_combiners, + GL_NV_texgen_emboss, + GL_NV_texgen_reflection, + GL_NV_texture_env_combine4, + GL_NV_vertex_array_range, + GL_NV_vertex_program, + + GL_PGI_misc_hints, + GL_PGI_vertex_hints, + + GL_REND_screen_coordinates, + + GL_SGI_color_matrix, + GL_SGI_color_table, + GL_SGI_depth_pass_instrument, + + GL_SGIS_detail_texture, + GL_SGIS_fog_function, + GL_SGIS_generate_mipmap, + GL_SGIS_multisample, + GL_SGIS_multitexture, + GL_SGIS_pixel_texture, + GL_SGIS_point_line_texgen, + GL_SGIS_point_parameters, + GL_SGIS_sharpen_texture, + GL_SGIS_texture_border_clamp, + GL_SGIS_texture_color_mask, + GL_SGIS_texture_edge_clamp, + GL_SGIS_texture_filter4, + GL_SGIS_texture_lod, + GL_SGIS_texture_select, + GL_SGIS_texture4D, + + GL_SGIX_async, + GL_SGIX_async_histogram, + GL_SGIX_async_pixel, + GL_SGIX_blend_alpha_minmax, + GL_SGIX_calligraphic_fragment, + GL_SGIX_clipmap, + GL_SGIX_convolution_accuracy, + GL_SGIX_depth_texture, + GL_SGIX_flush_raster, + GL_SGIX_fog_offset, + GL_SGIX_fog_scale, + GL_SGIX_fragment_lighting, + GL_SGIX_framezoom, + GL_SGIX_igloo_interface, + GL_SGIX_instruments, + GL_SGIX_interlace, + GL_SGIX_ir_instrument1, + GL_SGIX_list_priority, + GL_SGIX_pixel_texture, + GL_SGIX_pixel_tiles, + GL_SGIX_polynomial_ffd, + GL_SGIX_reference_plane, + GL_SGIX_resample, + GL_SGIX_shadow, + GL_SGIX_shadow_ambient, + GL_SGIX_sprite, + GL_SGIX_subsample, + GL_SGIX_tag_sample_buffer, + GL_SGIX_texture_add_env, + GL_SGIX_texture_lod_bias, + GL_SGIX_texture_multi_buffer, + GL_SGIX_texture_scale_bias, + GL_SGIX_vertex_preclip, + GL_SGIX_ycrcb, + GL_SGIX_ycrcba, + + GL_SUN_convolution_border_modes, + GL_SUN_global_alpha, + GL_SUN_triangle_list, + GL_SUN_vertex, + + GL_SUNX_constant_data, + + GL_WIN_phong_shading, + GL_WIN_specular_fog, + GL_WIN_swap_hint, + + WGL_EXT_swap_control, + WGL_ARB_extensions_string, + WGL_ARB_pixel_format, + + // Extensions (glu) + GLU_EXT_Texture, + GLU_EXT_object_space_tess, + GLU_EXT_nurbs_tessellator: Boolean; + +const + // ********** GL generic constants ********** + + // errors + GL_NO_ERROR = 0; + {$EXTERNALSYM GL_NO_ERROR} + GL_INVALID_ENUM = $0500; + {$EXTERNALSYM GL_INVALID_ENUM} + GL_INVALID_VALUE = $0501; + {$EXTERNALSYM GL_INVALID_VALUE} + GL_INVALID_OPERATION = $0502; + {$EXTERNALSYM GL_INVALID_OPERATION} + GL_STACK_OVERFLOW = $0503; + {$EXTERNALSYM GL_STACK_OVERFLOW} + GL_STACK_UNDERFLOW = $0504; + {$EXTERNALSYM GL_STACK_UNDERFLOW} + GL_OUT_OF_MEMORY = $0505; + {$EXTERNALSYM GL_STACK_UNDERFLOW} + + // attribute bits + GL_CURRENT_BIT = $00000001; + {$EXTERNALSYM GL_CURRENT_BIT} + GL_POINT_BIT = $00000002; + {$EXTERNALSYM GL_POINT_BIT} + GL_LINE_BIT = $00000004; + {$EXTERNALSYM GL_LINE_BIT} + GL_POLYGON_BIT = $00000008; + {$EXTERNALSYM GL_POLYGON_BIT} + GL_POLYGON_STIPPLE_BIT = $00000010; + {$EXTERNALSYM GL_POLYGON_STIPPLE_BIT} + GL_PIXEL_MODE_BIT = $00000020; + {$EXTERNALSYM GL_PIXEL_MODE_BIT} + GL_LIGHTING_BIT = $00000040; + {$EXTERNALSYM GL_LIGHTING_BIT} + GL_FOG_BIT = $00000080; + {$EXTERNALSYM GL_FOG_BIT} + GL_DEPTH_BUFFER_BIT = $00000100; + {$EXTERNALSYM GL_DEPTH_BUFFER_BIT} + GL_ACCUM_BUFFER_BIT = $00000200; + {$EXTERNALSYM GL_ACCUM_BUFFER_BIT} + GL_STENCIL_BUFFER_BIT = $00000400; + {$EXTERNALSYM GL_STENCIL_BUFFER_BIT} + GL_VIEWPORT_BIT = $00000800; + {$EXTERNALSYM GL_VIEWPORT_BIT} + GL_TRANSFORM_BIT = $00001000; + {$EXTERNALSYM GL_TRANSFORM_BIT} + GL_ENABLE_BIT = $00002000; + {$EXTERNALSYM GL_ENABLE_BIT} + GL_COLOR_BUFFER_BIT = $00004000; + {$EXTERNALSYM GL_COLOR_BUFFER_BIT} + GL_HINT_BIT = $00008000; + {$EXTERNALSYM GL_HINT_BIT} + GL_EVAL_BIT = $00010000; + {$EXTERNALSYM GL_EVAL_BIT} + GL_LIST_BIT = $00020000; + {$EXTERNALSYM GL_LIST_BIT} + GL_TEXTURE_BIT = $00040000; + {$EXTERNALSYM GL_TEXTURE_BIT} + GL_SCISSOR_BIT = $00080000; + {$EXTERNALSYM GL_SCISSOR_BIT} + GL_ALL_ATTRIB_BITS = $000FFFFF; + {$EXTERNALSYM GL_ALL_ATTRIB_BITS} + + // client attribute bits + GL_CLIENT_PIXEL_STORE_BIT = $00000001; + {$EXTERNALSYM GL_CLIENT_PIXEL_STORE_BIT} + GL_CLIENT_VERTEX_ARRAY_BIT = $00000002; + {$EXTERNALSYM GL_CLIENT_VERTEX_ARRAY_BIT} + GL_CLIENT_ALL_ATTRIB_BITS = $FFFFFFFF; + {$EXTERNALSYM GL_CLIENT_ALL_ATTRIB_BITS} + + // boolean values + GL_FALSE = Boolean( 0 ); + {$EXTERNALSYM GL_FALSE} + GL_TRUE = Boolean( 1 ); + {$EXTERNALSYM GL_TRUE} + + // primitives + GL_POINTS = $0000; + {$EXTERNALSYM GL_POINTS} + GL_LINES = $0001; + {$EXTERNALSYM GL_LINES} + GL_LINE_LOOP = $0002; + {$EXTERNALSYM GL_LINE_LOOP} + GL_LINE_STRIP = $0003; + {$EXTERNALSYM GL_LINE_STRIP} + GL_TRIANGLES = $0004; + {$EXTERNALSYM GL_TRIANGLES} + GL_TRIANGLE_STRIP = $0005; + {$EXTERNALSYM GL_TRIANGLE_STRIP} + GL_TRIANGLE_FAN = $0006; + {$EXTERNALSYM GL_TRIANGLE_FAN} + GL_QUADS = $0007; + {$EXTERNALSYM GL_QUADS} + GL_QUAD_STRIP = $0008; + {$EXTERNALSYM GL_QUAD_STRIP} + GL_POLYGON = $0009; + {$EXTERNALSYM GL_POLYGON} + + // blending + GL_ZERO = 0; + {$EXTERNALSYM GL_ZERO} + GL_ONE = 1; + {$EXTERNALSYM GL_ONE} + GL_SRC_COLOR = $0300; + {$EXTERNALSYM GL_SRC_COLOR} + GL_ONE_MINUS_SRC_COLOR = $0301; + {$EXTERNALSYM GL_ONE_MINUS_SRC_COLOR} + GL_SRC_ALPHA = $0302; + {$EXTERNALSYM GL_SRC_ALPHA} + GL_ONE_MINUS_SRC_ALPHA = $0303; + {$EXTERNALSYM GL_ONE_MINUS_SRC_ALPHA} + GL_DST_ALPHA = $0304; + {$EXTERNALSYM GL_DST_ALPHA} + GL_ONE_MINUS_DST_ALPHA = $0305; + {$EXTERNALSYM GL_ONE_MINUS_DST_ALPHA} + GL_DST_COLOR = $0306; + {$EXTERNALSYM GL_DST_COLOR} + GL_ONE_MINUS_DST_COLOR = $0307; + {$EXTERNALSYM GL_ONE_MINUS_DST_COLOR} + GL_SRC_ALPHA_SATURATE = $0308; + {$EXTERNALSYM GL_SRC_ALPHA_SATURATE} + GL_BLEND_DST = $0BE0; + {$EXTERNALSYM GL_BLEND_DST} + GL_BLEND_SRC = $0BE1; + {$EXTERNALSYM GL_BLEND_SRC} + GL_BLEND = $0BE2; + {$EXTERNALSYM GL_BLEND} + + // blending (GL 1.2 ARB imaging) + GL_BLEND_COLOR = $8005; + {$EXTERNALSYM GL_BLEND_COLOR} + GL_CONSTANT_COLOR = $8001; + {$EXTERNALSYM GL_CONSTANT_COLOR} + GL_ONE_MINUS_CONSTANT_COLOR = $8002; + {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_COLOR} + GL_CONSTANT_ALPHA = $8003; + {$EXTERNALSYM GL_CONSTANT_ALPHA} + GL_ONE_MINUS_CONSTANT_ALPHA = $8004; + {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_ALPHA} + GL_FUNC_ADD = $8006; + {$EXTERNALSYM GL_FUNC_ADD} + GL_MIN = $8007; + {$EXTERNALSYM GL_MIN} + GL_MAX = $8008; + {$EXTERNALSYM GL_MAX} + GL_FUNC_SUBTRACT = $800A; + {$EXTERNALSYM GL_FUNC_SUBTRACT} + GL_FUNC_REVERSE_SUBTRACT = $800B; + {$EXTERNALSYM GL_FUNC_REVERSE_SUBTRACT} + + // color table GL 1.2 ARB imaging + GL_COLOR_TABLE = $80D0; + {$EXTERNALSYM GL_COLOR_TABLE} + GL_POST_CONVOLUTION_COLOR_TABLE = $80D1; + {$EXTERNALSYM GL_POST_CONVOLUTION_COLOR_TABLE} + GL_POST_COLOR_MATRIX_COLOR_TABLE = $80D2; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_COLOR_TABLE} + GL_PROXY_COLOR_TABLE = $80D3; + {$EXTERNALSYM GL_PROXY_COLOR_TABLE} + GL_PROXY_POST_CONVOLUTION_COLOR_TABLE = $80D4; + {$EXTERNALSYM GL_PROXY_POST_CONVOLUTION_COLOR_TABLE} + GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE = $80D5; + {$EXTERNALSYM GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE} + GL_COLOR_TABLE_SCALE = $80D6; + {$EXTERNALSYM GL_COLOR_TABLE_SCALE} + GL_COLOR_TABLE_BIAS = $80D7; + {$EXTERNALSYM GL_COLOR_TABLE_BIAS} + GL_COLOR_TABLE_FORMAT = $80D8; + {$EXTERNALSYM GL_COLOR_TABLE_FORMAT} + GL_COLOR_TABLE_WIDTH = $80D9; + {$EXTERNALSYM GL_COLOR_TABLE_WIDTH} + GL_COLOR_TABLE_RED_SIZE = $80DA; + {$EXTERNALSYM GL_COLOR_TABLE_RED_SIZE} + GL_COLOR_TABLE_GREEN_SIZE = $80DB; + {$EXTERNALSYM GL_COLOR_TABLE_GREEN_SIZE} + GL_COLOR_TABLE_BLUE_SIZE = $80DC; + {$EXTERNALSYM GL_COLOR_TABLE_BLUE_SIZE} + GL_COLOR_TABLE_ALPHA_SIZE = $80DD; + {$EXTERNALSYM GL_COLOR_TABLE_ALPHA_SIZE} + GL_COLOR_TABLE_LUMINANCE_SIZE = $80DE; + {$EXTERNALSYM GL_COLOR_TABLE_LUMINANCE_SIZE} + GL_COLOR_TABLE_INTENSITY_SIZE = $80DF; + {$EXTERNALSYM GL_COLOR_TABLE_INTENSITY_SIZE} + + // convolutions GL 1.2 ARB imaging + GL_CONVOLUTION_1D = $8010; + {$EXTERNALSYM GL_CONVOLUTION_1D} + GL_CONVOLUTION_2D = $8011; + {$EXTERNALSYM GL_CONVOLUTION_2D} + GL_SEPARABLE_2D = $8012; + {$EXTERNALSYM GL_SEPARABLE_2D} + GL_CONVOLUTION_BORDER_MODE = $8013; + {$EXTERNALSYM GL_CONVOLUTION_BORDER_MODE} + GL_CONVOLUTION_FILTER_SCALE = $8014; + {$EXTERNALSYM GL_CONVOLUTION_FILTER_SCALE} + GL_CONVOLUTION_FILTER_BIAS = $8015; + {$EXTERNALSYM GL_CONVOLUTION_FILTER_BIAS} + GL_REDUCE = $8016; + {$EXTERNALSYM GL_REDUCE} + GL_CONVOLUTION_FORMAT = $8017; + {$EXTERNALSYM GL_CONVOLUTION_FORMAT} + GL_CONVOLUTION_WIDTH = $8018; + {$EXTERNALSYM GL_CONVOLUTION_WIDTH} + GL_CONVOLUTION_HEIGHT = $8019; + {$EXTERNALSYM GL_CONVOLUTION_HEIGHT} + GL_MAX_CONVOLUTION_WIDTH = $801A; + {$EXTERNALSYM GL_MAX_CONVOLUTION_WIDTH} + GL_MAX_CONVOLUTION_HEIGHT = $801B; + {$EXTERNALSYM GL_MAX_CONVOLUTION_HEIGHT} + GL_POST_CONVOLUTION_RED_SCALE = $801C; + {$EXTERNALSYM GL_POST_CONVOLUTION_RED_SCALE} + GL_POST_CONVOLUTION_GREEN_SCALE = $801D; + {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_SCALE} + GL_POST_CONVOLUTION_BLUE_SCALE = $801E; + {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_SCALE} + GL_POST_CONVOLUTION_ALPHA_SCALE = $801F; + {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_SCALE} + GL_POST_CONVOLUTION_RED_BIAS = $8020; + {$EXTERNALSYM GL_POST_CONVOLUTION_RED_BIAS} + GL_POST_CONVOLUTION_GREEN_BIAS = $8021; + {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_BIAS} + GL_POST_CONVOLUTION_BLUE_BIAS = $8022; + {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_BIAS} + GL_POST_CONVOLUTION_ALPHA_BIAS = $8023; + {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_BIAS} + + // histogram GL 1.2 ARB imaging + GL_HISTOGRAM = $8024; + {$EXTERNALSYM GL_HISTOGRAM} + GL_PROXY_HISTOGRAM = $8025; + {$EXTERNALSYM GL_PROXY_HISTOGRAM} + GL_HISTOGRAM_WIDTH = $8026; + {$EXTERNALSYM GL_HISTOGRAM_WIDTH} + GL_HISTOGRAM_FORMAT = $8027; + {$EXTERNALSYM GL_HISTOGRAM_FORMAT} + GL_HISTOGRAM_RED_SIZE = $8028; + {$EXTERNALSYM GL_HISTOGRAM_RED_SIZE} + GL_HISTOGRAM_GREEN_SIZE = $8029; + {$EXTERNALSYM GL_HISTOGRAM_GREEN_SIZE} + GL_HISTOGRAM_BLUE_SIZE = $802A; + {$EXTERNALSYM GL_HISTOGRAM_BLUE_SIZE} + GL_HISTOGRAM_ALPHA_SIZE = $802B; + {$EXTERNALSYM GL_HISTOGRAM_ALPHA_SIZE} + GL_HISTOGRAM_LUMINANCE_SIZE = $802C; + {$EXTERNALSYM GL_HISTOGRAM_LUMINANCE_SIZE} + GL_HISTOGRAM_SINK = $802D; + {$EXTERNALSYM GL_HISTOGRAM_SINK} + GL_MINMAX = $802E; + {$EXTERNALSYM GL_MINMAX} + GL_MINMAX_FORMAT = $802F; + {$EXTERNALSYM GL_MINMAX_FORMAT} + GL_MINMAX_SINK = $8030; + {$EXTERNALSYM GL_MINMAX_SINK} + + // buffers + GL_NONE = 0; + {$EXTERNALSYM GL_NONE} + GL_FRONT_LEFT = $0400; + {$EXTERNALSYM GL_FRONT_LEFT} + GL_FRONT_RIGHT = $0401; + {$EXTERNALSYM GL_FRONT_RIGHT} + GL_BACK_LEFT = $0402; + {$EXTERNALSYM GL_BACK_LEFT} + GL_BACK_RIGHT = $0403; + {$EXTERNALSYM GL_BACK_RIGHT} + GL_FRONT = $0404; + {$EXTERNALSYM GL_FRONT} + GL_BACK = $0405; + {$EXTERNALSYM GL_BACK} + GL_LEFT = $0406; + {$EXTERNALSYM GL_LEFT} + GL_RIGHT = $0407; + {$EXTERNALSYM GL_RIGHT} + GL_FRONT_AND_BACK = $0408; + {$EXTERNALSYM GL_FRONT_AND_BACK} + GL_AUX0 = $0409; + {$EXTERNALSYM GL_AUX0} + GL_AUX1 = $040A; + {$EXTERNALSYM GL_AUX1} + GL_AUX2 = $040B; + {$EXTERNALSYM GL_AUX2} + GL_AUX3 = $040C; + {$EXTERNALSYM GL_AUX3} + GL_AUX_BUFFERS = $0C00; + {$EXTERNALSYM GL_AUX_BUFFERS} + GL_DRAW_BUFFER = $0C01; + {$EXTERNALSYM GL_DRAW_BUFFER} + GL_READ_BUFFER = $0C02; + {$EXTERNALSYM GL_READ_BUFFER} + GL_DOUBLEBUFFER = $0C32; + {$EXTERNALSYM GL_DOUBLEBUFFER} + GL_STEREO = $0C33; + {$EXTERNALSYM GL_STEREO} + + // depth buffer + GL_DEPTH_RANGE = $0B70; + {$EXTERNALSYM GL_DEPTH_RANGE} + GL_DEPTH_TEST = $0B71; + {$EXTERNALSYM GL_DEPTH_TEST} + GL_DEPTH_WRITEMASK = $0B72; + {$EXTERNALSYM GL_DEPTH_WRITEMASK} + GL_DEPTH_CLEAR_VALUE = $0B73; + {$EXTERNALSYM GL_DEPTH_CLEAR_VALUE} + GL_DEPTH_FUNC = $0B74; + {$EXTERNALSYM GL_DEPTH_FUNC} + GL_NEVER = $0200; + {$EXTERNALSYM GL_NEVER} + GL_LESS = $0201; + {$EXTERNALSYM GL_LESS} + GL_EQUAL = $0202; + {$EXTERNALSYM GL_EQUAL} + GL_LEQUAL = $0203; + {$EXTERNALSYM GL_LEQUAL} + GL_GREATER = $0204; + {$EXTERNALSYM GL_GREATER} + GL_NOTEQUAL = $0205; + {$EXTERNALSYM GL_NOTEQUAL} + GL_GEQUAL = $0206; + {$EXTERNALSYM GL_GEQUAL} + GL_ALWAYS = $0207; + {$EXTERNALSYM GL_ALWAYS} + + // accumulation buffer + GL_ACCUM = $0100; + {$EXTERNALSYM GL_ACCUM} + GL_LOAD = $0101; + {$EXTERNALSYM GL_LOAD} + GL_RETURN = $0102; + {$EXTERNALSYM GL_RETURN} + GL_MULT = $0103; + {$EXTERNALSYM GL_MULT} + GL_ADD = $0104; + {$EXTERNALSYM GL_ADD} + GL_ACCUM_CLEAR_VALUE = $0B80; + {$EXTERNALSYM GL_ACCUM_CLEAR_VALUE} + + // feedback buffer + GL_FEEDBACK_BUFFER_POINTER = $0DF0; + {$EXTERNALSYM GL_FEEDBACK_BUFFER_POINTER} + GL_FEEDBACK_BUFFER_SIZE = $0DF1; + {$EXTERNALSYM GL_FEEDBACK_BUFFER_SIZE} + GL_FEEDBACK_BUFFER_TYPE = $0DF2; + {$EXTERNALSYM GL_FEEDBACK_BUFFER_TYPE} + + // feedback types + GL_2D = $0600; + {$EXTERNALSYM GL_2D} + GL_3D = $0601; + {$EXTERNALSYM GL_3D} + GL_3D_COLOR = $0602; + {$EXTERNALSYM GL_3D_COLOR} + GL_3D_COLOR_TEXTURE = $0603; + {$EXTERNALSYM GL_3D_COLOR_TEXTURE} + GL_4D_COLOR_TEXTURE = $0604; + {$EXTERNALSYM GL_4D_COLOR_TEXTURE} + + // feedback tokens + GL_PASS_THROUGH_TOKEN = $0700; + {$EXTERNALSYM GL_PASS_THROUGH_TOKEN} + GL_POINT_TOKEN = $0701; + {$EXTERNALSYM GL_POINT_TOKEN} + GL_LINE_TOKEN = $0702; + {$EXTERNALSYM GL_LINE_TOKEN} + GL_POLYGON_TOKEN = $0703; + {$EXTERNALSYM GL_POLYGON_TOKEN} + GL_BITMAP_TOKEN = $0704; + {$EXTERNALSYM GL_BITMAP_TOKEN} + GL_DRAW_PIXEL_TOKEN = $0705; + {$EXTERNALSYM GL_DRAW_PIXEL_TOKEN} + GL_COPY_PIXEL_TOKEN = $0706; + {$EXTERNALSYM GL_COPY_PIXEL_TOKEN} + GL_LINE_RESET_TOKEN = $0707; + {$EXTERNALSYM GL_LINE_RESET_TOKEN} + + // fog + GL_EXP = $0800; + {$EXTERNALSYM GL_EXP} + GL_EXP2 = $0801; + {$EXTERNALSYM GL_EXP2} + GL_FOG = $0B60; + {$EXTERNALSYM GL_FOG} + GL_FOG_INDEX = $0B61; + {$EXTERNALSYM GL_FOG_INDEX} + GL_FOG_DENSITY = $0B62; + {$EXTERNALSYM GL_FOG_DENSITY} + GL_FOG_START = $0B63; + {$EXTERNALSYM GL_FOG_START} + GL_FOG_END = $0B64; + {$EXTERNALSYM GL_FOG_END} + GL_FOG_MODE = $0B65; + {$EXTERNALSYM GL_FOG_MODE} + GL_FOG_COLOR = $0B66; + {$EXTERNALSYM GL_FOG_COLOR} + + // pixel mode, transfer + GL_PIXEL_MAP_I_TO_I = $0C70; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_I} + GL_PIXEL_MAP_S_TO_S = $0C71; + {$EXTERNALSYM GL_PIXEL_MAP_S_TO_S} + GL_PIXEL_MAP_I_TO_R = $0C72; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_R} + GL_PIXEL_MAP_I_TO_G = $0C73; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_G} + GL_PIXEL_MAP_I_TO_B = $0C74; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_B} + GL_PIXEL_MAP_I_TO_A = $0C75; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_A} + GL_PIXEL_MAP_R_TO_R = $0C76; + {$EXTERNALSYM GL_PIXEL_MAP_R_TO_R} + GL_PIXEL_MAP_G_TO_G = $0C77; + {$EXTERNALSYM GL_PIXEL_MAP_G_TO_G} + GL_PIXEL_MAP_B_TO_B = $0C78; + {$EXTERNALSYM GL_PIXEL_MAP_B_TO_B} + GL_PIXEL_MAP_A_TO_A = $0C79; + {$EXTERNALSYM GL_PIXEL_MAP_A_TO_A} + + // vertex arrays + GL_VERTEX_ARRAY_POINTER = $808E; + {$EXTERNALSYM GL_VERTEX_ARRAY_POINTER} + GL_NORMAL_ARRAY_POINTER = $808F; + {$EXTERNALSYM GL_NORMAL_ARRAY_POINTER} + GL_COLOR_ARRAY_POINTER = $8090; + {$EXTERNALSYM GL_COLOR_ARRAY_POINTER} + GL_INDEX_ARRAY_POINTER = $8091; + {$EXTERNALSYM GL_INDEX_ARRAY_POINTER} + GL_TEXTURE_COORD_ARRAY_POINTER = $8092; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_POINTER} + GL_EDGE_FLAG_ARRAY_POINTER = $8093; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_POINTER} + + // stenciling + GL_STENCIL_TEST = $0B90; + {$EXTERNALSYM GL_STENCIL_TEST} + GL_STENCIL_CLEAR_VALUE = $0B91; + {$EXTERNALSYM GL_STENCIL_CLEAR_VALUE} + GL_STENCIL_FUNC = $0B92; + {$EXTERNALSYM GL_STENCIL_FUNC} + GL_STENCIL_VALUE_MASK = $0B93; + {$EXTERNALSYM GL_STENCIL_VALUE_MASK} + GL_STENCIL_FAIL = $0B94; + {$EXTERNALSYM GL_STENCIL_FAIL} + GL_STENCIL_PASS_DEPTH_FAIL = $0B95; + {$EXTERNALSYM GL_STENCIL_PASS_DEPTH_FAIL} + GL_STENCIL_PASS_DEPTH_PASS = $0B96; + {$EXTERNALSYM GL_STENCIL_PASS_DEPTH_PASS} + GL_STENCIL_REF = $0B97; + {$EXTERNALSYM GL_STENCIL_REF} + GL_STENCIL_WRITEMASK = $0B98; + {$EXTERNALSYM GL_STENCIL_WRITEMASK} + GL_KEEP = $1E00; + {$EXTERNALSYM GL_KEEP} + GL_REPLACE = $1E01; + {$EXTERNALSYM GL_REPLACE} + GL_INCR = $1E02; + {$EXTERNALSYM GL_INCR} + GL_DECR = $1E03; + {$EXTERNALSYM GL_DECR} + + // color material + GL_COLOR_MATERIAL_FACE = $0B55; + {$EXTERNALSYM GL_COLOR_MATERIAL_FACE} + GL_COLOR_MATERIAL_PARAMETER = $0B56; + {$EXTERNALSYM GL_COLOR_MATERIAL_PARAMETER} + GL_COLOR_MATERIAL = $0B57; + {$EXTERNALSYM GL_COLOR_MATERIAL} + + // points + GL_POINT_SMOOTH = $0B10; + {$EXTERNALSYM GL_POINT_SMOOTH} + GL_POINT_SIZE = $0B11; + {$EXTERNALSYM GL_POINT_SIZE} + GL_POINT_SIZE_RANGE = $0B12; + {$EXTERNALSYM GL_POINT_SIZE_RANGE} + GL_POINT_SIZE_GRANULARITY = $0B13; + {$EXTERNALSYM GL_POINT_SIZE_GRANULARITY} + + // lines + GL_LINE_SMOOTH = $0B20; + {$EXTERNALSYM GL_LINE_SMOOTH} + GL_LINE_WIDTH = $0B21; + {$EXTERNALSYM GL_LINE_WIDTH} + GL_LINE_WIDTH_RANGE = $0B22; + {$EXTERNALSYM GL_LINE_WIDTH_RANGE} + GL_LINE_WIDTH_GRANULARITY = $0B23; + {$EXTERNALSYM GL_LINE_WIDTH_GRANULARITY} + GL_LINE_STIPPLE = $0B24; + {$EXTERNALSYM GL_LINE_STIPPLE} + GL_LINE_STIPPLE_PATTERN = $0B25; + {$EXTERNALSYM GL_LINE_STIPPLE_PATTERN} + GL_LINE_STIPPLE_REPEAT = $0B26; + {$EXTERNALSYM GL_LINE_STIPPLE_REPEAT} + + // polygons + GL_POLYGON_MODE = $0B40; + {$EXTERNALSYM GL_POLYGON_MODE} + GL_POLYGON_SMOOTH = $0B41; + {$EXTERNALSYM GL_POLYGON_SMOOTH} + GL_POLYGON_STIPPLE = $0B42; + {$EXTERNALSYM GL_POLYGON_STIPPLE} + GL_EDGE_FLAG = $0B43; + {$EXTERNALSYM GL_EDGE_FLAG} + GL_CULL_FACE = $0B44; + {$EXTERNALSYM GL_CULL_FACE} + GL_CULL_FACE_MODE = $0B45; + {$EXTERNALSYM GL_CULL_FACE_MODE} + GL_FRONT_FACE = $0B46; + {$EXTERNALSYM GL_FRONT_FACE} + GL_CW = $0900; + {$EXTERNALSYM GL_CW} + GL_CCW = $0901; + {$EXTERNALSYM GL_CCW} + GL_POINT = $1B00; + {$EXTERNALSYM GL_POINT} + GL_LINE = $1B01; + {$EXTERNALSYM GL_LINE} + GL_FILL = $1B02; + {$EXTERNALSYM GL_FILL} + + // display lists + GL_LIST_MODE = $0B30; + {$EXTERNALSYM GL_LIST_MODE} + GL_LIST_BASE = $0B32; + {$EXTERNALSYM GL_LIST_BASE} + GL_LIST_INDEX = $0B33; + {$EXTERNALSYM GL_LIST_INDEX} + GL_COMPILE = $1300; + {$EXTERNALSYM GL_COMPILE} + GL_COMPILE_AND_EXECUTE = $1301; + {$EXTERNALSYM GL_COMPILE_AND_EXECUTE} + + // lighting + GL_LIGHTING = $0B50; + {$EXTERNALSYM GL_LIGHTING} + GL_LIGHT_MODEL_LOCAL_VIEWER = $0B51; + {$EXTERNALSYM GL_LIGHT_MODEL_LOCAL_VIEWER} + GL_LIGHT_MODEL_TWO_SIDE = $0B52; + {$EXTERNALSYM GL_LIGHT_MODEL_TWO_SIDE} + GL_LIGHT_MODEL_AMBIENT = $0B53; + {$EXTERNALSYM GL_LIGHT_MODEL_AMBIENT} + GL_LIGHT_MODEL_COLOR_CONTROL = $81F8; // GL 1.2 + {$EXTERNALSYM GL_LIGHT_MODEL_COLOR_CONTROL} + GL_SHADE_MODEL = $0B54; + {$EXTERNALSYM GL_SHADE_MODEL} + GL_NORMALIZE = $0BA1; + {$EXTERNALSYM GL_NORMALIZE} + GL_AMBIENT = $1200; + {$EXTERNALSYM GL_AMBIENT} + GL_DIFFUSE = $1201; + {$EXTERNALSYM GL_DIFFUSE} + GL_SPECULAR = $1202; + {$EXTERNALSYM GL_SPECULAR} + GL_POSITION = $1203; + {$EXTERNALSYM GL_POSITION} + GL_SPOT_DIRECTION = $1204; + {$EXTERNALSYM GL_SPOT_DIRECTION} + GL_SPOT_EXPONENT = $1205; + {$EXTERNALSYM GL_SPOT_EXPONENT} + GL_SPOT_CUTOFF = $1206; + {$EXTERNALSYM GL_SPOT_CUTOFF} + GL_CONSTANT_ATTENUATION = $1207; + {$EXTERNALSYM GL_CONSTANT_ATTENUATION} + GL_LINEAR_ATTENUATION = $1208; + {$EXTERNALSYM GL_LINEAR_ATTENUATION} + GL_QUADRATIC_ATTENUATION = $1209; + {$EXTERNALSYM GL_QUADRATIC_ATTENUATION} + GL_EMISSION = $1600; + {$EXTERNALSYM GL_EMISSION} + GL_SHININESS = $1601; + {$EXTERNALSYM GL_SHININESS} + GL_AMBIENT_AND_DIFFUSE = $1602; + {$EXTERNALSYM GL_AMBIENT_AND_DIFFUSE} + GL_COLOR_INDEXES = $1603; + {$EXTERNALSYM GL_COLOR_INDEXES} + GL_FLAT = $1D00; + {$EXTERNALSYM GL_FLAT} + GL_SMOOTH = $1D01; + {$EXTERNALSYM GL_SMOOTH} + GL_LIGHT0 = $4000; + {$EXTERNALSYM GL_LIGHT0} + GL_LIGHT1 = $4001; + {$EXTERNALSYM GL_LIGHT1} + GL_LIGHT2 = $4002; + {$EXTERNALSYM GL_LIGHT2} + GL_LIGHT3 = $4003; + {$EXTERNALSYM GL_LIGHT3} + GL_LIGHT4 = $4004; + {$EXTERNALSYM GL_LIGHT4} + GL_LIGHT5 = $4005; + {$EXTERNALSYM GL_LIGHT5} + GL_LIGHT6 = $4006; + {$EXTERNALSYM GL_LIGHT6} + GL_LIGHT7 = $4007; + {$EXTERNALSYM GL_LIGHT7} + + // matrix modes + GL_MATRIX_MODE = $0BA0; + {$EXTERNALSYM GL_MATRIX_MODE} + GL_MODELVIEW = $1700; + {$EXTERNALSYM GL_MODELVIEW} + GL_PROJECTION = $1701; + {$EXTERNALSYM GL_PROJECTION} + GL_TEXTURE = $1702; + {$EXTERNALSYM GL_TEXTURE} + + // gets + GL_CURRENT_COLOR = $0B00; + {$EXTERNALSYM GL_CURRENT_COLOR} + GL_CURRENT_INDEX = $0B01; + {$EXTERNALSYM GL_CURRENT_INDEX} + GL_CURRENT_NORMAL = $0B02; + {$EXTERNALSYM GL_CURRENT_NORMAL} + GL_CURRENT_TEXTURE_COORDS = $0B03; + {$EXTERNALSYM GL_CURRENT_TEXTURE_COORDS} + GL_CURRENT_RASTER_COLOR = $0B04; + {$EXTERNALSYM GL_CURRENT_RASTER_COLOR} + GL_CURRENT_RASTER_INDEX = $0B05; + {$EXTERNALSYM GL_CURRENT_RASTER_INDEX} + GL_CURRENT_RASTER_TEXTURE_COORDS = $0B06; + {$EXTERNALSYM GL_CURRENT_RASTER_TEXTURE_COORDS} + GL_CURRENT_RASTER_POSITION = $0B07; + {$EXTERNALSYM GL_CURRENT_RASTER_POSITION} + GL_CURRENT_RASTER_POSITION_VALID = $0B08; + {$EXTERNALSYM GL_CURRENT_RASTER_POSITION_VALID} + GL_CURRENT_RASTER_DISTANCE = $0B09; + {$EXTERNALSYM GL_CURRENT_RASTER_DISTANCE} + GL_MAX_LIST_NESTING = $0B31; + {$EXTERNALSYM GL_MAX_LIST_NESTING} + GL_VIEWPORT = $0BA2; + {$EXTERNALSYM GL_VIEWPORT} + GL_MODELVIEW_STACK_DEPTH = $0BA3; + {$EXTERNALSYM GL_MODELVIEW_STACK_DEPTH} + GL_PROJECTION_STACK_DEPTH = $0BA4; + {$EXTERNALSYM GL_PROJECTION_STACK_DEPTH} + GL_TEXTURE_STACK_DEPTH = $0BA5; + {$EXTERNALSYM GL_TEXTURE_STACK_DEPTH} + GL_MODELVIEW_MATRIX = $0BA6; + {$EXTERNALSYM GL_MODELVIEW_MATRIX} + GL_PROJECTION_MATRIX = $0BA7; + {$EXTERNALSYM GL_PROJECTION_MATRIX} + GL_TEXTURE_MATRIX = $0BA8; + {$EXTERNALSYM GL_TEXTURE_MATRIX} + GL_ATTRIB_STACK_DEPTH = $0BB0; + {$EXTERNALSYM GL_ATTRIB_STACK_DEPTH} + GL_CLIENT_ATTRIB_STACK_DEPTH = $0BB1; + {$EXTERNALSYM GL_CLIENT_ATTRIB_STACK_DEPTH} + + GL_SINGLE_COLOR = $81F9; // GL 1.2 + {$EXTERNALSYM GL_SINGLE_COLOR} + GL_SEPARATE_SPECULAR_COLOR = $81FA; // GL 1.2 + {$EXTERNALSYM GL_SEPARATE_SPECULAR_COLOR} + + // alpha testing + GL_ALPHA_TEST = $0BC0; + {$EXTERNALSYM GL_ALPHA_TEST} + GL_ALPHA_TEST_FUNC = $0BC1; + {$EXTERNALSYM GL_ALPHA_TEST_FUNC} + GL_ALPHA_TEST_REF = $0BC2; + {$EXTERNALSYM GL_ALPHA_TEST_REF} + + GL_LOGIC_OP_MODE = $0BF0; + {$EXTERNALSYM GL_LOGIC_OP_MODE} + GL_INDEX_LOGIC_OP = $0BF1; + {$EXTERNALSYM GL_INDEX_LOGIC_OP} + GL_LOGIC_OP = $0BF1; + {$EXTERNALSYM GL_LOGIC_OP} + GL_COLOR_LOGIC_OP = $0BF2; + {$EXTERNALSYM GL_COLOR_LOGIC_OP} + GL_SCISSOR_BOX = $0C10; + {$EXTERNALSYM GL_SCISSOR_BOX} + GL_SCISSOR_TEST = $0C11; + {$EXTERNALSYM GL_SCISSOR_TEST} + GL_INDEX_CLEAR_VALUE = $0C20; + {$EXTERNALSYM GL_INDEX_CLEAR_VALUE} + GL_INDEX_WRITEMASK = $0C21; + {$EXTERNALSYM GL_INDEX_WRITEMASK} + GL_COLOR_CLEAR_VALUE = $0C22; + {$EXTERNALSYM GL_COLOR_CLEAR_VALUE} + GL_COLOR_WRITEMASK = $0C23; + {$EXTERNALSYM GL_COLOR_WRITEMASK} + GL_INDEX_MODE = $0C30; + {$EXTERNALSYM GL_INDEX_MODE} + GL_RGBA_MODE = $0C31; + {$EXTERNALSYM GL_RGBA_MODE} + GL_RENDER_MODE = $0C40; + {$EXTERNALSYM GL_RENDER_MODE} + GL_PERSPECTIVE_CORRECTION_HINT = $0C50; + {$EXTERNALSYM GL_PERSPECTIVE_CORRECTION_HINT} + GL_POINT_SMOOTH_HINT = $0C51; + {$EXTERNALSYM GL_POINT_SMOOTH_HINT} + GL_LINE_SMOOTH_HINT = $0C52; + {$EXTERNALSYM GL_LINE_SMOOTH_HINT} + GL_POLYGON_SMOOTH_HINT = $0C53; + {$EXTERNALSYM GL_POLYGON_SMOOTH_HINT} + GL_FOG_HINT = $0C54; + {$EXTERNALSYM GL_FOG_HINT} + GL_TEXTURE_GEN_S = $0C60; + {$EXTERNALSYM GL_TEXTURE_GEN_S} + GL_TEXTURE_GEN_T = $0C61; + {$EXTERNALSYM GL_TEXTURE_GEN_T} + GL_TEXTURE_GEN_R = $0C62; + {$EXTERNALSYM GL_TEXTURE_GEN_R} + GL_TEXTURE_GEN_Q = $0C63; + {$EXTERNALSYM GL_TEXTURE_GEN_Q} + GL_PIXEL_MAP_I_TO_I_SIZE = $0CB0; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_I_SIZE} + GL_PIXEL_MAP_S_TO_S_SIZE = $0CB1; + {$EXTERNALSYM GL_PIXEL_MAP_S_TO_S_SIZE} + GL_PIXEL_MAP_I_TO_R_SIZE = $0CB2; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_R_SIZE} + GL_PIXEL_MAP_I_TO_G_SIZE = $0CB3; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_G_SIZE} + GL_PIXEL_MAP_I_TO_B_SIZE = $0CB4; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_B_SIZE} + GL_PIXEL_MAP_I_TO_A_SIZE = $0CB5; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_A_SIZE} + GL_PIXEL_MAP_R_TO_R_SIZE = $0CB6; + {$EXTERNALSYM GL_PIXEL_MAP_R_TO_R_SIZE} + GL_PIXEL_MAP_G_TO_G_SIZE = $0CB7; + {$EXTERNALSYM GL_PIXEL_MAP_G_TO_G_SIZE} + GL_PIXEL_MAP_B_TO_B_SIZE = $0CB8; + {$EXTERNALSYM GL_PIXEL_MAP_B_TO_B_SIZE} + GL_PIXEL_MAP_A_TO_A_SIZE = $0CB9; + {$EXTERNALSYM GL_PIXEL_MAP_A_TO_A_SIZE} + GL_UNPACK_SWAP_BYTES = $0CF0; + {$EXTERNALSYM GL_UNPACK_SWAP_BYTES} + GL_UNPACK_LSB_FIRST = $0CF1; + {$EXTERNALSYM GL_UNPACK_LSB_FIRST} + GL_UNPACK_ROW_LENGTH = $0CF2; + {$EXTERNALSYM GL_UNPACK_ROW_LENGTH} + GL_UNPACK_SKIP_ROWS = $0CF3; + {$EXTERNALSYM GL_UNPACK_SKIP_ROWS} + GL_UNPACK_SKIP_PIXELS = $0CF4; + {$EXTERNALSYM GL_UNPACK_SKIP_PIXELS} + GL_UNPACK_ALIGNMENT = $0CF5; + {$EXTERNALSYM GL_UNPACK_ALIGNMENT} + GL_PACK_SWAP_BYTES = $0D00; + {$EXTERNALSYM GL_PACK_SWAP_BYTES} + GL_PACK_LSB_FIRST = $0D01; + {$EXTERNALSYM GL_PACK_LSB_FIRST} + GL_PACK_ROW_LENGTH = $0D02; + {$EXTERNALSYM GL_PACK_ROW_LENGTH} + GL_PACK_SKIP_ROWS = $0D03; + {$EXTERNALSYM GL_PACK_SKIP_ROWS} + GL_PACK_SKIP_PIXELS = $0D04; + {$EXTERNALSYM GL_PACK_SKIP_PIXELS} + GL_PACK_ALIGNMENT = $0D05; + {$EXTERNALSYM GL_PACK_ALIGNMENT} + GL_PACK_SKIP_IMAGES = $806B; // GL 1.2 + {$EXTERNALSYM GL_PACK_SKIP_IMAGES} + GL_PACK_IMAGE_HEIGHT = $806C; // GL 1.2 + {$EXTERNALSYM GL_PACK_IMAGE_HEIGHT} + GL_UNPACK_SKIP_IMAGES = $806D; // GL 1.2 + {$EXTERNALSYM GL_UNPACK_SKIP_IMAGES} + GL_UNPACK_IMAGE_HEIGHT = $806E; // GL 1.2 + {$EXTERNALSYM GL_UNPACK_IMAGE_HEIGHT} + GL_MAP_COLOR = $0D10; + {$EXTERNALSYM GL_MAP_COLOR} + GL_MAP_STENCIL = $0D11; + {$EXTERNALSYM GL_MAP_STENCIL} + GL_INDEX_SHIFT = $0D12; + {$EXTERNALSYM GL_INDEX_SHIFT} + GL_INDEX_OFFSET = $0D13; + {$EXTERNALSYM GL_INDEX_OFFSET} + GL_RED_SCALE = $0D14; + {$EXTERNALSYM GL_RED_SCALE} + GL_RED_BIAS = $0D15; + {$EXTERNALSYM GL_RED_BIAS} + GL_ZOOM_X = $0D16; + {$EXTERNALSYM GL_ZOOM_X} + GL_ZOOM_Y = $0D17; + {$EXTERNALSYM GL_ZOOM_Y} + GL_GREEN_SCALE = $0D18; + {$EXTERNALSYM GL_GREEN_SCALE} + GL_GREEN_BIAS = $0D19; + {$EXTERNALSYM GL_GREEN_BIAS} + GL_BLUE_SCALE = $0D1A; + {$EXTERNALSYM GL_BLUE_SCALE} + GL_BLUE_BIAS = $0D1B; + {$EXTERNALSYM GL_BLUE_BIAS} + GL_ALPHA_SCALE = $0D1C; + {$EXTERNALSYM GL_ALPHA_SCALE} + GL_ALPHA_BIAS = $0D1D; + {$EXTERNALSYM GL_ALPHA_BIAS} + GL_DEPTH_SCALE = $0D1E; + {$EXTERNALSYM GL_DEPTH_SCALE} + GL_DEPTH_BIAS = $0D1F; + {$EXTERNALSYM GL_DEPTH_BIAS} + GL_MAX_EVAL_ORDER = $0D30; + {$EXTERNALSYM GL_MAX_EVAL_ORDER} + GL_MAX_LIGHTS = $0D31; + {$EXTERNALSYM GL_MAX_LIGHTS} + GL_MAX_CLIP_PLANES = $0D32; + {$EXTERNALSYM GL_MAX_CLIP_PLANES} + GL_MAX_TEXTURE_SIZE = $0D33; + {$EXTERNALSYM GL_MAX_TEXTURE_SIZE} + GL_MAX_3D_TEXTURE_SIZE = $8073; // GL 1.2 + {$EXTERNALSYM GL_MAX_3D_TEXTURE_SIZE} + GL_MAX_PIXEL_MAP_TABLE = $0D34; + {$EXTERNALSYM GL_MAX_PIXEL_MAP_TABLE} + GL_MAX_ATTRIB_STACK_DEPTH = $0D35; + {$EXTERNALSYM GL_MAX_ATTRIB_STACK_DEPTH} + GL_MAX_MODELVIEW_STACK_DEPTH = $0D36; + {$EXTERNALSYM GL_MAX_MODELVIEW_STACK_DEPTH} + GL_MAX_NAME_STACK_DEPTH = $0D37; + {$EXTERNALSYM GL_MAX_NAME_STACK_DEPTH} + GL_MAX_PROJECTION_STACK_DEPTH = $0D38; + {$EXTERNALSYM GL_MAX_PROJECTION_STACK_DEPTH} + GL_MAX_TEXTURE_STACK_DEPTH = $0D39; + {$EXTERNALSYM GL_MAX_TEXTURE_STACK_DEPTH} + GL_MAX_VIEWPORT_DIMS = $0D3A; + {$EXTERNALSYM GL_MAX_VIEWPORT_DIMS} + GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = $0D3B; + {$EXTERNALSYM GL_MAX_CLIENT_ATTRIB_STACK_DEPTH} + GL_MAX_ELEMENTS_VERTICES = $80E8; // GL 1.2 + {$EXTERNALSYM GL_MAX_ELEMENTS_VERTICES} + GL_MAX_ELEMENTS_INDICES = $80E9; // GL 1.2 + {$EXTERNALSYM GL_MAX_ELEMENTS_INDICES} + GL_RESCALE_NORMAL = $803A; // GL 1.2 + {$EXTERNALSYM GL_RESCALE_NORMAL} + GL_SUBPIXEL_BITS = $0D50; + {$EXTERNALSYM GL_SUBPIXEL_BITS} + GL_INDEX_BITS = $0D51; + {$EXTERNALSYM GL_INDEX_BITS} + GL_RED_BITS = $0D52; + {$EXTERNALSYM GL_RED_BITS} + GL_GREEN_BITS = $0D53; + {$EXTERNALSYM GL_GREEN_BITS} + GL_BLUE_BITS = $0D54; + {$EXTERNALSYM GL_BLUE_BITS} + GL_ALPHA_BITS = $0D55; + {$EXTERNALSYM GL_ALPHA_BITS} + GL_DEPTH_BITS = $0D56; + {$EXTERNALSYM GL_DEPTH_BITS} + GL_STENCIL_BITS = $0D57; + {$EXTERNALSYM GL_STENCIL_BITS} + GL_ACCUM_RED_BITS = $0D58; + {$EXTERNALSYM GL_ACCUM_RED_BITS} + GL_ACCUM_GREEN_BITS = $0D59; + {$EXTERNALSYM GL_ACCUM_GREEN_BITS} + GL_ACCUM_BLUE_BITS = $0D5A; + {$EXTERNALSYM GL_ACCUM_BLUE_BITS} + GL_ACCUM_ALPHA_BITS = $0D5B; + {$EXTERNALSYM GL_ACCUM_ALPHA_BITS} + GL_NAME_STACK_DEPTH = $0D70; + {$EXTERNALSYM GL_NAME_STACK_DEPTH} + GL_AUTO_NORMAL = $0D80; + {$EXTERNALSYM GL_AUTO_NORMAL} + GL_MAP1_COLOR_4 = $0D90; + {$EXTERNALSYM GL_MAP1_COLOR_4} + GL_MAP1_INDEX = $0D91; + {$EXTERNALSYM GL_MAP1_INDEX} + GL_MAP1_NORMAL = $0D92; + {$EXTERNALSYM GL_MAP1_NORMAL} + GL_MAP1_TEXTURE_COORD_1 = $0D93; + {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_1} + GL_MAP1_TEXTURE_COORD_2 = $0D94; + {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_2} + GL_MAP1_TEXTURE_COORD_3 = $0D95; + {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_3} + GL_MAP1_TEXTURE_COORD_4 = $0D96; + {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_4} + GL_MAP1_VERTEX_3 = $0D97; + {$EXTERNALSYM GL_MAP1_VERTEX_3} + GL_MAP1_VERTEX_4 = $0D98; + {$EXTERNALSYM GL_MAP1_VERTEX_4} + GL_MAP2_COLOR_4 = $0DB0; + {$EXTERNALSYM GL_MAP2_COLOR_4} + GL_MAP2_INDEX = $0DB1; + {$EXTERNALSYM GL_MAP2_INDEX} + GL_MAP2_NORMAL = $0DB2; + {$EXTERNALSYM GL_MAP2_NORMAL} + GL_MAP2_TEXTURE_COORD_1 = $0DB3; + {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_1} + GL_MAP2_TEXTURE_COORD_2 = $0DB4; + {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_2} + GL_MAP2_TEXTURE_COORD_3 = $0DB5; + {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_3} + GL_MAP2_TEXTURE_COORD_4 = $0DB6; + {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_4} + GL_MAP2_VERTEX_3 = $0DB7; + {$EXTERNALSYM GL_MAP2_VERTEX_3} + GL_MAP2_VERTEX_4 = $0DB8; + {$EXTERNALSYM GL_MAP2_VERTEX_4} + GL_MAP1_GRID_DOMAIN = $0DD0; + {$EXTERNALSYM GL_MAP1_GRID_DOMAIN} + GL_MAP1_GRID_SEGMENTS = $0DD1; + {$EXTERNALSYM GL_MAP1_GRID_SEGMENTS} + GL_MAP2_GRID_DOMAIN = $0DD2; + {$EXTERNALSYM GL_MAP2_GRID_DOMAIN} + GL_MAP2_GRID_SEGMENTS = $0DD3; + {$EXTERNALSYM GL_MAP2_GRID_SEGMENTS} + GL_TEXTURE_1D = $0DE0; + {$EXTERNALSYM GL_TEXTURE_1D} + GL_TEXTURE_2D = $0DE1; + {$EXTERNALSYM GL_TEXTURE_2D} + GL_TEXTURE_3D = $806F; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_3D} + GL_SELECTION_BUFFER_POINTER = $0DF3; + {$EXTERNALSYM GL_SELECTION_BUFFER_POINTER} + GL_SELECTION_BUFFER_SIZE = $0DF4; + {$EXTERNALSYM GL_SELECTION_BUFFER_SIZE} + GL_POLYGON_OFFSET_UNITS = $2A00; + {$EXTERNALSYM GL_POLYGON_OFFSET_UNITS} + GL_POLYGON_OFFSET_POINT = $2A01; + {$EXTERNALSYM GL_POLYGON_OFFSET_POINT} + GL_POLYGON_OFFSET_LINE = $2A02; + {$EXTERNALSYM GL_POLYGON_OFFSET_LINE} + GL_POLYGON_OFFSET_FILL = $8037; + {$EXTERNALSYM GL_POLYGON_OFFSET_FILL} + GL_POLYGON_OFFSET_FACTOR = $8038; + {$EXTERNALSYM GL_POLYGON_OFFSET_FACTOR} + GL_TEXTURE_BINDING_1D = $8068; + {$EXTERNALSYM GL_TEXTURE_BINDING_1D} + GL_TEXTURE_BINDING_2D = $8069; + {$EXTERNALSYM GL_TEXTURE_BINDING_2D} + GL_VERTEX_ARRAY = $8074; + {$EXTERNALSYM GL_VERTEX_ARRAY} + GL_NORMAL_ARRAY = $8075; + {$EXTERNALSYM GL_NORMAL_ARRAY} + GL_COLOR_ARRAY = $8076; + {$EXTERNALSYM GL_COLOR_ARRAY} + GL_INDEX_ARRAY = $8077; + {$EXTERNALSYM GL_INDEX_ARRAY} + GL_TEXTURE_COORD_ARRAY = $8078; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY} + GL_EDGE_FLAG_ARRAY = $8079; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY} + GL_VERTEX_ARRAY_SIZE = $807A; + {$EXTERNALSYM GL_VERTEX_ARRAY_SIZE} + GL_VERTEX_ARRAY_TYPE = $807B; + {$EXTERNALSYM GL_VERTEX_ARRAY_TYPE} + GL_VERTEX_ARRAY_STRIDE = $807C; + {$EXTERNALSYM GL_VERTEX_ARRAY_STRIDE} + GL_NORMAL_ARRAY_TYPE = $807E; + {$EXTERNALSYM GL_NORMAL_ARRAY_TYPE} + GL_NORMAL_ARRAY_STRIDE = $807F; + {$EXTERNALSYM GL_NORMAL_ARRAY_STRIDE} + GL_COLOR_ARRAY_SIZE = $8081; + {$EXTERNALSYM GL_COLOR_ARRAY_SIZE} + GL_COLOR_ARRAY_TYPE = $8082; + {$EXTERNALSYM GL_COLOR_ARRAY_TYPE} + GL_COLOR_ARRAY_STRIDE = $8083; + {$EXTERNALSYM GL_COLOR_ARRAY_STRIDE} + GL_INDEX_ARRAY_TYPE = $8085; + {$EXTERNALSYM GL_INDEX_ARRAY_TYPE} + GL_INDEX_ARRAY_STRIDE = $8086; + {$EXTERNALSYM GL_INDEX_ARRAY_STRIDE} + GL_TEXTURE_COORD_ARRAY_SIZE = $8088; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_SIZE} + GL_TEXTURE_COORD_ARRAY_TYPE = $8089; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_TYPE} + GL_TEXTURE_COORD_ARRAY_STRIDE = $808A; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_STRIDE} + GL_EDGE_FLAG_ARRAY_STRIDE = $808C; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_STRIDE} + GL_COLOR_MATRIX = $80B1; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_COLOR_MATRIX} + GL_COLOR_MATRIX_STACK_DEPTH = $80B2; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_COLOR_MATRIX_STACK_DEPTH} + GL_MAX_COLOR_MATRIX_STACK_DEPTH = $80B3; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_MAX_COLOR_MATRIX_STACK_DEPTH} + GL_POST_COLOR_MATRIX_RED_SCALE = $80B4; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_SCALE} + GL_POST_COLOR_MATRIX_GREEN_SCALE = $80B5; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_SCALE} + GL_POST_COLOR_MATRIX_BLUE_SCALE = $80B6; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_SCALE} + GL_POST_COLOR_MATRIX_ALPHA_SCALE = $80B7; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_SCALE} + GL_POST_COLOR_MATRIX_RED_BIAS = $80B8; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_BIAS} + GL_POST_COLOR_MATRIX_GREEN_BIAS = $80B9; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_BIAS} + GL_POST_COLOR_MATRIX_BLUE_BIAS = $80BA; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_BIAS} + GL_POST_COLOR_MATRIX_ALPHA_BIAS = $80BB; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_BIAS} + + // evaluators + GL_COEFF = $0A00; + {$EXTERNALSYM GL_COEFF} + GL_ORDER = $0A01; + {$EXTERNALSYM GL_ORDER} + GL_DOMAIN = $0A02; + {$EXTERNALSYM GL_DOMAIN} + + // texture mapping + GL_TEXTURE_WIDTH = $1000; + {$EXTERNALSYM GL_TEXTURE_WIDTH} + GL_TEXTURE_HEIGHT = $1001; + {$EXTERNALSYM GL_TEXTURE_HEIGHT} + GL_TEXTURE_INTERNAL_FORMAT = $1003; + {$EXTERNALSYM GL_TEXTURE_INTERNAL_FORMAT} + GL_TEXTURE_COMPONENTS = $1003; + {$EXTERNALSYM GL_TEXTURE_COMPONENTS} + GL_TEXTURE_BORDER_COLOR = $1004; + {$EXTERNALSYM GL_TEXTURE_BORDER_COLOR} + GL_TEXTURE_BORDER = $1005; + {$EXTERNALSYM GL_TEXTURE_BORDER} + GL_TEXTURE_RED_SIZE = $805C; + {$EXTERNALSYM GL_TEXTURE_RED_SIZE} + GL_TEXTURE_GREEN_SIZE = $805D; + {$EXTERNALSYM GL_TEXTURE_GREEN_SIZE} + GL_TEXTURE_BLUE_SIZE = $805E; + {$EXTERNALSYM GL_TEXTURE_BLUE_SIZE} + GL_TEXTURE_ALPHA_SIZE = $805F; + {$EXTERNALSYM GL_TEXTURE_ALPHA_SIZE} + GL_TEXTURE_LUMINANCE_SIZE = $8060; + {$EXTERNALSYM GL_TEXTURE_LUMINANCE_SIZE} + GL_TEXTURE_INTENSITY_SIZE = $8061; + {$EXTERNALSYM GL_TEXTURE_INTENSITY_SIZE} + GL_TEXTURE_PRIORITY = $8066; + {$EXTERNALSYM GL_TEXTURE_PRIORITY} + GL_TEXTURE_RESIDENT = $8067; + {$EXTERNALSYM GL_TEXTURE_RESIDENT} + GL_BGR = $80E0; // v 1.2 + {$EXTERNALSYM GL_BGR} + GL_BGRA = $80E1; // v 1.2 + {$EXTERNALSYM GL_BGRA} + GL_S = $2000; + {$EXTERNALSYM GL_S} + GL_T = $2001; + {$EXTERNALSYM GL_T} + GL_R = $2002; + {$EXTERNALSYM GL_R} + GL_Q = $2003; + {$EXTERNALSYM GL_Q} + GL_MODULATE = $2100; + {$EXTERNALSYM GL_MODULATE} + GL_DECAL = $2101; + {$EXTERNALSYM GL_DECAL} + GL_TEXTURE_ENV_MODE = $2200; + {$EXTERNALSYM GL_TEXTURE_ENV_MODE} + GL_TEXTURE_ENV_COLOR = $2201; + {$EXTERNALSYM GL_TEXTURE_ENV_COLOR} + GL_TEXTURE_ENV = $2300; + {$EXTERNALSYM GL_TEXTURE_ENV} + GL_EYE_LINEAR = $2400; + {$EXTERNALSYM GL_EYE_LINEAR} + GL_OBJECT_LINEAR = $2401; + {$EXTERNALSYM GL_OBJECT_LINEAR} + GL_SPHERE_MAP = $2402; + {$EXTERNALSYM GL_SPHERE_MAP} + GL_TEXTURE_GEN_MODE = $2500; + {$EXTERNALSYM GL_TEXTURE_GEN_MODE} + GL_OBJECT_PLANE = $2501; + {$EXTERNALSYM GL_OBJECT_PLANE} + GL_EYE_PLANE = $2502; + {$EXTERNALSYM GL_EYE_PLANE} + GL_NEAREST = $2600; + {$EXTERNALSYM GL_NEAREST} + GL_LINEAR = $2601; + {$EXTERNALSYM GL_LINEAR} + GL_NEAREST_MIPMAP_NEAREST = $2700; + {$EXTERNALSYM GL_NEAREST_MIPMAP_NEAREST} + GL_LINEAR_MIPMAP_NEAREST = $2701; + {$EXTERNALSYM GL_LINEAR_MIPMAP_NEAREST} + GL_NEAREST_MIPMAP_LINEAR = $2702; + {$EXTERNALSYM GL_NEAREST_MIPMAP_LINEAR} + GL_LINEAR_MIPMAP_LINEAR = $2703; + {$EXTERNALSYM GL_LINEAR_MIPMAP_LINEAR} + GL_TEXTURE_MAG_FILTER = $2800; + {$EXTERNALSYM GL_TEXTURE_MAG_FILTER} + GL_TEXTURE_MIN_FILTER = $2801; + {$EXTERNALSYM GL_TEXTURE_MIN_FILTER} + GL_TEXTURE_WRAP_R = $8072; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_WRAP_R} + GL_TEXTURE_WRAP_S = $2802; + {$EXTERNALSYM GL_TEXTURE_WRAP_S} + GL_TEXTURE_WRAP_T = $2803; + {$EXTERNALSYM GL_TEXTURE_WRAP_T} + GL_CLAMP_TO_EDGE = $812F; // GL 1.2 + {$EXTERNALSYM GL_CLAMP_TO_EDGE} + GL_TEXTURE_MIN_LOD = $813A; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_MIN_LOD} + GL_TEXTURE_MAX_LOD = $813B; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_MAX_LOD} + GL_TEXTURE_BASE_LEVEL = $813C; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_BASE_LEVEL} + GL_TEXTURE_MAX_LEVEL = $813D; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_MAX_LEVEL} + GL_TEXTURE_DEPTH = $8071; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_DEPTH} + GL_PROXY_TEXTURE_1D = $8063; + {$EXTERNALSYM GL_PROXY_TEXTURE_1D} + GL_PROXY_TEXTURE_2D = $8064; + {$EXTERNALSYM GL_PROXY_TEXTURE_2D} + GL_PROXY_TEXTURE_3D = $8070; // GL 1.2 + {$EXTERNALSYM GL_PROXY_TEXTURE_3D} + GL_CLAMP = $2900; + {$EXTERNALSYM GL_CLAMP} + GL_REPEAT = $2901; + {$EXTERNALSYM GL_REPEAT} + + // hints + GL_DONT_CARE = $1100; + {$EXTERNALSYM GL_DONT_CARE} + GL_FASTEST = $1101; + {$EXTERNALSYM GL_FASTEST} + GL_NICEST = $1102; + {$EXTERNALSYM GL_NICEST} + + // data types + GL_BYTE = $1400; + {$EXTERNALSYM GL_BYTE} + GL_UNSIGNED_BYTE = $1401; + {$EXTERNALSYM GL_UNSIGNED_BYTE} + GL_SHORT = $1402; + {$EXTERNALSYM GL_SHORT} + GL_UNSIGNED_SHORT = $1403; + {$EXTERNALSYM GL_UNSIGNED_SHORT} + GL_INT = $1404; + {$EXTERNALSYM GL_INT} + GL_UNSIGNED_INT = $1405; + {$EXTERNALSYM GL_UNSIGNED_INT} + GL_FLOAT = $1406; + {$EXTERNALSYM GL_FLOAT} + GL_2_BYTES = $1407; + {$EXTERNALSYM GL_2_BYTES} + GL_3_BYTES = $1408; + {$EXTERNALSYM GL_3_BYTES} + GL_4_BYTES = $1409; + {$EXTERNALSYM GL_4_BYTES} + GL_DOUBLE = $140A; + {$EXTERNALSYM GL_DOUBLE} + GL_DOUBLE_EXT = $140A; + {$EXTERNALSYM GL_DOUBLE_EXT} + + // logic operations + GL_CLEAR = $1500; + {$EXTERNALSYM GL_CLEAR} + GL_AND = $1501; + {$EXTERNALSYM GL_AND} + GL_AND_REVERSE = $1502; + {$EXTERNALSYM GL_AND_REVERSE} + GL_COPY = $1503; + {$EXTERNALSYM GL_COPY} + GL_AND_INVERTED = $1504; + {$EXTERNALSYM GL_AND_INVERTED} + GL_NOOP = $1505; + {$EXTERNALSYM GL_NOOP} + GL_XOR = $1506; + {$EXTERNALSYM GL_XOR} + GL_OR = $1507; + {$EXTERNALSYM GL_OR} + GL_NOR = $1508; + {$EXTERNALSYM GL_NOR} + GL_EQUIV = $1509; + {$EXTERNALSYM GL_EQUIV} + GL_INVERT = $150A; + {$EXTERNALSYM GL_INVERT} + GL_OR_REVERSE = $150B; + {$EXTERNALSYM GL_OR_REVERSE} + GL_COPY_INVERTED = $150C; + {$EXTERNALSYM GL_COPY_INVERTED} + GL_OR_INVERTED = $150D; + {$EXTERNALSYM GL_OR_INVERTED} + GL_NAND = $150E; + {$EXTERNALSYM GL_NAND} + GL_SET = $150F; + {$EXTERNALSYM GL_SET} + + // PixelCopyType + GL_COLOR = $1800; + {$EXTERNALSYM GL_COLOR} + GL_DEPTH = $1801; + {$EXTERNALSYM GL_DEPTH} + GL_STENCIL = $1802; + {$EXTERNALSYM GL_STENCIL} + + // pixel formats + GL_COLOR_INDEX = $1900; + {$EXTERNALSYM GL_COLOR_INDEX} + GL_STENCIL_INDEX = $1901; + {$EXTERNALSYM GL_STENCIL_INDEX} + GL_DEPTH_COMPONENT = $1902; + {$EXTERNALSYM GL_DEPTH_COMPONENT} + GL_RED = $1903; + {$EXTERNALSYM GL_RED} + GL_GREEN = $1904; + {$EXTERNALSYM GL_GREEN} + GL_BLUE = $1905; + {$EXTERNALSYM GL_BLUE} + GL_ALPHA = $1906; + {$EXTERNALSYM GL_ALPHA} + GL_RGB = $1907; + {$EXTERNALSYM GL_RGB} + GL_RGBA = $1908; + {$EXTERNALSYM GL_RGBA} + GL_LUMINANCE = $1909; + {$EXTERNALSYM GL_LUMINANCE} + GL_LUMINANCE_ALPHA = $190A; + {$EXTERNALSYM GL_LUMINANCE_ALPHA} + + // pixel type + GL_BITMAP = $1A00; + {$EXTERNALSYM GL_BITMAP} + + // rendering modes + GL_RENDER = $1C00; + {$EXTERNALSYM GL_RENDER} + GL_FEEDBACK = $1C01; + {$EXTERNALSYM GL_FEEDBACK} + GL_SELECT = $1C02; + {$EXTERNALSYM GL_SELECT} + + // implementation strings + GL_VENDOR = $1F00; + {$EXTERNALSYM GL_VENDOR} + GL_RENDERER = $1F01; + {$EXTERNALSYM GL_RENDERER} + GL_VERSION = $1F02; + {$EXTERNALSYM GL_VERSION} + GL_EXTENSIONS = $1F03; + {$EXTERNALSYM GL_EXTENSIONS} + + // pixel formats + GL_R3_G3_B2 = $2A10; + {$EXTERNALSYM GL_R3_G3_B2} + GL_ALPHA4 = $803B; + {$EXTERNALSYM GL_ALPHA4} + GL_ALPHA8 = $803C; + {$EXTERNALSYM GL_ALPHA8} + GL_ALPHA12 = $803D; + {$EXTERNALSYM GL_ALPHA12} + GL_ALPHA16 = $803E; + {$EXTERNALSYM GL_ALPHA16} + GL_LUMINANCE4 = $803F; + {$EXTERNALSYM GL_LUMINANCE4} + GL_LUMINANCE8 = $8040; + {$EXTERNALSYM GL_LUMINANCE8} + GL_LUMINANCE12 = $8041; + {$EXTERNALSYM GL_LUMINANCE12} + GL_LUMINANCE16 = $8042; + {$EXTERNALSYM GL_LUMINANCE16} + GL_LUMINANCE4_ALPHA4 = $8043; + {$EXTERNALSYM GL_LUMINANCE4_ALPHA4} + GL_LUMINANCE6_ALPHA2 = $8044; + {$EXTERNALSYM GL_LUMINANCE6_ALPHA2} + GL_LUMINANCE8_ALPHA8 = $8045; + {$EXTERNALSYM GL_LUMINANCE8_ALPHA8} + GL_LUMINANCE12_ALPHA4 = $8046; + {$EXTERNALSYM GL_LUMINANCE12_ALPHA4} + GL_LUMINANCE12_ALPHA12 = $8047; + {$EXTERNALSYM GL_LUMINANCE12_ALPHA12} + GL_LUMINANCE16_ALPHA16 = $8048; + {$EXTERNALSYM GL_LUMINANCE16_ALPHA16} + GL_INTENSITY = $8049; + {$EXTERNALSYM GL_INTENSITY} + GL_INTENSITY4 = $804A; + {$EXTERNALSYM GL_INTENSITY4} + GL_INTENSITY8 = $804B; + {$EXTERNALSYM GL_INTENSITY8} + GL_INTENSITY12 = $804C; + {$EXTERNALSYM GL_INTENSITY12} + GL_INTENSITY16 = $804D; + {$EXTERNALSYM GL_INTENSITY16} + GL_RGB4 = $804F; + {$EXTERNALSYM GL_RGB4} + GL_RGB5 = $8050; + {$EXTERNALSYM GL_RGB5} + GL_RGB8 = $8051; + {$EXTERNALSYM GL_RGB8} + GL_RGB10 = $8052; + {$EXTERNALSYM GL_RGB10} + GL_RGB12 = $8053; + {$EXTERNALSYM GL_RGB12} + GL_RGB16 = $8054; + {$EXTERNALSYM GL_RGB16} + GL_RGBA2 = $8055; + {$EXTERNALSYM GL_RGBA2} + GL_RGBA4 = $8056; + {$EXTERNALSYM GL_RGBA4} + GL_RGB5_A1 = $8057; + {$EXTERNALSYM GL_RGB5_A1} + GL_RGBA8 = $8058; + {$EXTERNALSYM GL_RGBA8} + GL_RGB10_A2 = $8059; + {$EXTERNALSYM GL_RGB10_A2} + GL_RGBA12 = $805A; + {$EXTERNALSYM GL_RGBA12} + GL_RGBA16 = $805B; + {$EXTERNALSYM GL_RGBA16} + UNSIGNED_BYTE_3_3_2 = $8032; // GL 1.2 + {$EXTERNALSYM UNSIGNED_BYTE_3_3_2} + UNSIGNED_BYTE_2_3_3_REV = $8362; // GL 1.2 + {$EXTERNALSYM UNSIGNED_BYTE_2_3_3_REV} + UNSIGNED_SHORT_5_6_5 = $8363; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_5_6_5} + UNSIGNED_SHORT_5_6_5_REV = $8364; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_5_6_5_REV} + UNSIGNED_SHORT_4_4_4_4 = $8033; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_4_4_4_4} + UNSIGNED_SHORT_4_4_4_4_REV = $8365; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_4_4_4_4_REV} + UNSIGNED_SHORT_5_5_5_1 = $8034; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_5_5_5_1} + UNSIGNED_SHORT_1_5_5_5_REV = $8366; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_1_5_5_5_REV} + UNSIGNED_INT_8_8_8_8 = $8035; // GL 1.2 + {$EXTERNALSYM UNSIGNED_INT_8_8_8_8} + UNSIGNED_INT_8_8_8_8_REV = $8367; // GL 1.2 + {$EXTERNALSYM UNSIGNED_INT_8_8_8_8_REV} + UNSIGNED_INT_10_10_10_2 = $8036; // GL 1.2 + {$EXTERNALSYM UNSIGNED_INT_10_10_10_2} + UNSIGNED_INT_2_10_10_10_REV = $8368; // GL 1.2 + {$EXTERNALSYM UNSIGNED_INT_2_10_10_10_REV} + + // interleaved arrays formats + GL_V2F = $2A20; + {$EXTERNALSYM GL_V2F} + GL_V3F = $2A21; + {$EXTERNALSYM GL_V3F} + GL_C4UB_V2F = $2A22; + {$EXTERNALSYM GL_C4UB_V2F} + GL_C4UB_V3F = $2A23; + {$EXTERNALSYM GL_C4UB_V3F} + GL_C3F_V3F = $2A24; + {$EXTERNALSYM GL_C3F_V3F} + GL_N3F_V3F = $2A25; + {$EXTERNALSYM GL_N3F_V3F} + GL_C4F_N3F_V3F = $2A26; + {$EXTERNALSYM GL_C4F_N3F_V3F} + GL_T2F_V3F = $2A27; + {$EXTERNALSYM GL_T2F_V3F} + GL_T4F_V4F = $2A28; + {$EXTERNALSYM GL_T4F_V4F} + GL_T2F_C4UB_V3F = $2A29; + {$EXTERNALSYM GL_T2F_C4UB_V3F} + GL_T2F_C3F_V3F = $2A2A; + {$EXTERNALSYM GL_T2F_C3F_V3F} + GL_T2F_N3F_V3F = $2A2B; + {$EXTERNALSYM GL_T2F_N3F_V3F} + GL_T2F_C4F_N3F_V3F = $2A2C; + {$EXTERNALSYM GL_T2F_C4F_N3F_V3F} + GL_T4F_C4F_N3F_V4F = $2A2D; + {$EXTERNALSYM GL_T4F_C4F_N3F_V4F} + + // clip planes + GL_CLIP_PLANE0 = $3000; + {$EXTERNALSYM GL_CLIP_PLANE0} + GL_CLIP_PLANE1 = $3001; + {$EXTERNALSYM GL_CLIP_PLANE1} + GL_CLIP_PLANE2 = $3002; + {$EXTERNALSYM GL_CLIP_PLANE2} + GL_CLIP_PLANE3 = $3003; + {$EXTERNALSYM GL_CLIP_PLANE3} + GL_CLIP_PLANE4 = $3004; + {$EXTERNALSYM GL_CLIP_PLANE4} + GL_CLIP_PLANE5 = $3005; + {$EXTERNALSYM GL_CLIP_PLANE5} + + // miscellaneous + GL_DITHER = $0BD0; + {$EXTERNALSYM GL_DITHER} + + // ----- extensions enumerants ----- + // EXT_abgr + GL_ABGR_EXT = $8000; + {$EXTERNALSYM GL_ABGR_EXT} + + // EXT_packed_pixels + GL_UNSIGNED_BYTE_3_3_2_EXT = $8032; + {$EXTERNALSYM GL_UNSIGNED_BYTE_3_3_2_EXT} + GL_UNSIGNED_SHORT_4_4_4_4_EXT = $8033; + {$EXTERNALSYM GL_UNSIGNED_SHORT_4_4_4_4_EXT} + GL_UNSIGNED_SHORT_5_5_5_1_EXT = $8034; + {$EXTERNALSYM GL_UNSIGNED_SHORT_5_5_5_1_EXT} + GL_UNSIGNED_INT_8_8_8_8_EXT = $8035; + {$EXTERNALSYM GL_UNSIGNED_INT_8_8_8_8_EXT} + GL_UNSIGNED_INT_10_10_10_2_EXT = $8036; + {$EXTERNALSYM GL_UNSIGNED_INT_10_10_10_2_EXT} + + // EXT_vertex_array + GL_VERTEX_ARRAY_EXT = $8074; + {$EXTERNALSYM GL_VERTEX_ARRAY_EXT} + GL_NORMAL_ARRAY_EXT = $8075; + {$EXTERNALSYM GL_NORMAL_ARRAY_EXT} + GL_COLOR_ARRAY_EXT = $8076; + {$EXTERNALSYM GL_COLOR_ARRAY_EXT} + GL_INDEX_ARRAY_EXT = $8077; + {$EXTERNALSYM GL_INDEX_ARRAY_EXT} + GL_TEXTURE_COORD_ARRAY_EXT = $8078; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_EXT} + GL_EDGE_FLAG_ARRAY_EXT = $8079; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_EXT} + GL_VERTEX_ARRAY_SIZE_EXT = $807A; + {$EXTERNALSYM GL_VERTEX_ARRAY_SIZE_EXT} + GL_VERTEX_ARRAY_TYPE_EXT = $807B; + {$EXTERNALSYM GL_VERTEX_ARRAY_TYPE_EXT} + GL_VERTEX_ARRAY_STRIDE_EXT = $807C; + {$EXTERNALSYM GL_VERTEX_ARRAY_STRIDE_EXT} + GL_VERTEX_ARRAY_COUNT_EXT = $807D; + {$EXTERNALSYM GL_VERTEX_ARRAY_COUNT_EXT} + GL_NORMAL_ARRAY_TYPE_EXT = $807E; + {$EXTERNALSYM GL_NORMAL_ARRAY_TYPE_EXT} + GL_NORMAL_ARRAY_STRIDE_EXT = $807F; + {$EXTERNALSYM GL_NORMAL_ARRAY_STRIDE_EXT} + GL_NORMAL_ARRAY_COUNT_EXT = $8080; + {$EXTERNALSYM GL_NORMAL_ARRAY_COUNT_EXT} + GL_COLOR_ARRAY_SIZE_EXT = $8081; + {$EXTERNALSYM GL_COLOR_ARRAY_SIZE_EXT} + GL_COLOR_ARRAY_TYPE_EXT = $8082; + {$EXTERNALSYM GL_COLOR_ARRAY_TYPE_EXT} + GL_COLOR_ARRAY_STRIDE_EXT = $8083; + {$EXTERNALSYM GL_COLOR_ARRAY_STRIDE_EXT} + GL_COLOR_ARRAY_COUNT_EXT = $8084; + {$EXTERNALSYM GL_COLOR_ARRAY_COUNT_EXT} + GL_INDEX_ARRAY_TYPE_EXT = $8085; + {$EXTERNALSYM GL_INDEX_ARRAY_TYPE_EXT} + GL_INDEX_ARRAY_STRIDE_EXT = $8086; + {$EXTERNALSYM GL_INDEX_ARRAY_STRIDE_EXT} + GL_INDEX_ARRAY_COUNT_EXT = $8087; + {$EXTERNALSYM GL_INDEX_ARRAY_COUNT_EXT} + GL_TEXTURE_COORD_ARRAY_SIZE_EXT = $8088; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_SIZE_EXT} + GL_TEXTURE_COORD_ARRAY_TYPE_EXT = $8089; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_TYPE_EXT} + GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = $808A; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_STRIDE_EXT} + GL_TEXTURE_COORD_ARRAY_COUNT_EXT = $808B; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_COUNT_EXT} + GL_EDGE_FLAG_ARRAY_STRIDE_EXT = $808C; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_STRIDE_EXT} + GL_EDGE_FLAG_ARRAY_COUNT_EXT = $808D; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_COUNT_EXT} + GL_VERTEX_ARRAY_POINTER_EXT = $808E; + {$EXTERNALSYM GL_VERTEX_ARRAY_POINTER_EXT} + GL_NORMAL_ARRAY_POINTER_EXT = $808F; + {$EXTERNALSYM GL_NORMAL_ARRAY_POINTER_EXT} + GL_COLOR_ARRAY_POINTER_EXT = $8090; + {$EXTERNALSYM GL_COLOR_ARRAY_POINTER_EXT} + GL_INDEX_ARRAY_POINTER_EXT = $8091; + {$EXTERNALSYM GL_INDEX_ARRAY_POINTER_EXT} + GL_TEXTURE_COORD_ARRAY_POINTER_EXT = $8092; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_POINTER_EXT} + GL_EDGE_FLAG_ARRAY_POINTER_EXT = $8093; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_POINTER_EXT} + + // EXT_color_table + GL_TABLE_TOO_LARGE_EXT = $8031; + {$EXTERNALSYM GL_TABLE_TOO_LARGE_EXT} + GL_COLOR_TABLE_EXT = $80D0; + {$EXTERNALSYM GL_COLOR_TABLE_EXT} + GL_POST_CONVOLUTION_COLOR_TABLE_EXT = $80D1; + {$EXTERNALSYM GL_POST_CONVOLUTION_COLOR_TABLE_EXT} + GL_POST_COLOR_MATRIX_COLOR_TABLE_EXT = $80D2; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_COLOR_TABLE_EXT} + GL_PROXY_COLOR_TABLE_EXT = $80D3; + {$EXTERNALSYM GL_PROXY_COLOR_TABLE_EXT} + GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_EXT = $80D4; + {$EXTERNALSYM GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_EXT} + GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_EXT = $80D5; + {$EXTERNALSYM GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_EXT} + GL_COLOR_TABLE_SCALE_EXT = $80D6; + {$EXTERNALSYM GL_COLOR_TABLE_SCALE_EXT} + GL_COLOR_TABLE_BIAS_EXT = $80D7; + {$EXTERNALSYM GL_COLOR_TABLE_BIAS_EXT} + GL_COLOR_TABLE_FORMAT_EXT = $80D8; + {$EXTERNALSYM GL_COLOR_TABLE_FORMAT_EXT} + GL_COLOR_TABLE_WIDTH_EXT = $80D9; + {$EXTERNALSYM GL_COLOR_TABLE_WIDTH_EXT} + GL_COLOR_TABLE_RED_SIZE_EXT = $80DA; + {$EXTERNALSYM GL_COLOR_TABLE_RED_SIZE_EXT} + GL_COLOR_TABLE_GREEN_SIZE_EXT = $80DB; + {$EXTERNALSYM GL_COLOR_TABLE_GREEN_SIZE_EXT} + GL_COLOR_TABLE_BLUE_SIZE_EXT = $80DC; + {$EXTERNALSYM GL_COLOR_TABLE_BLUE_SIZE_EXT} + GL_COLOR_TABLE_ALPHA_SIZE_EXT = $80DD; + {$EXTERNALSYM GL_COLOR_TABLE_ALPHA_SIZE_EXT} + GL_COLOR_TABLE_LUMINANCE_SIZE_EXT = $80DE; + {$EXTERNALSYM GL_COLOR_TABLE_LUMINANCE_SIZE_EXT} + GL_COLOR_TABLE_INTENSITY_SIZE_EXT = $80DF; + {$EXTERNALSYM GL_COLOR_TABLE_INTENSITY_SIZE_EXT} + + // EXT_bgra + GL_BGR_EXT = $80E0; + {$EXTERNALSYM GL_BGR_EXT} + GL_BGRA_EXT = $80E1; + {$EXTERNALSYM GL_BGRA_EXT} + + // EXT_paletted_texture + GL_COLOR_INDEX1_EXT = $80E2; + {$EXTERNALSYM GL_COLOR_INDEX1_EXT} + GL_COLOR_INDEX2_EXT = $80E3; + {$EXTERNALSYM GL_COLOR_INDEX2_EXT} + GL_COLOR_INDEX4_EXT = $80E4; + {$EXTERNALSYM GL_COLOR_INDEX4_EXT} + GL_COLOR_INDEX8_EXT = $80E5; + {$EXTERNALSYM GL_COLOR_INDEX8_EXT} + GL_COLOR_INDEX12_EXT = $80E6; + {$EXTERNALSYM GL_COLOR_INDEX12_EXT} + GL_COLOR_INDEX16_EXT = $80E7; + {$EXTERNALSYM GL_COLOR_INDEX16_EXT} + + // EXT_blend_color + GL_CONSTANT_COLOR_EXT = $8001; + {$EXTERNALSYM GL_CONSTANT_COLOR_EXT} + GL_ONE_MINUS_CONSTANT_COLOR_EXT = $8002; + {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_COLOR_EXT} + GL_CONSTANT_ALPHA_EXT = $8003; + {$EXTERNALSYM GL_CONSTANT_ALPHA_EXT} + GL_ONE_MINUS_CONSTANT_ALPHA_EXT = $8004; + {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_ALPHA_EXT} + GL_BLEND_COLOR_EXT = $8005; + {$EXTERNALSYM GL_BLEND_COLOR_EXT} + + // EXT_blend_minmax + GL_FUNC_ADD_EXT = $8006; + {$EXTERNALSYM GL_FUNC_ADD_EXT} + GL_MIN_EXT = $8007; + {$EXTERNALSYM GL_MIN_EXT} + GL_MAX_EXT = $8008; + {$EXTERNALSYM GL_MAX_EXT} + GL_BLEND_EQUATION_EXT = $8009; + {$EXTERNALSYM GL_BLEND_EQUATION_EXT} + + // EXT_blend_subtract + GL_FUNC_SUBTRACT_EXT = $800A; + {$EXTERNALSYM GL_FUNC_SUBTRACT_EXT} + GL_FUNC_REVERSE_SUBTRACT_EXT = $800B; + {$EXTERNALSYM GL_FUNC_REVERSE_SUBTRACT_EXT} + + // EXT_convolution + GL_CONVOLUTION_1D_EXT = $8010; + {$EXTERNALSYM GL_CONVOLUTION_1D_EXT} + GL_CONVOLUTION_2D_EXT = $8011; + {$EXTERNALSYM GL_CONVOLUTION_2D_EXT} + GL_SEPARABLE_2D_EXT = $8012; + {$EXTERNALSYM GL_SEPARABLE_2D_EXT} + GL_CONVOLUTION_BORDER_MODE_EXT = $8013; + {$EXTERNALSYM GL_CONVOLUTION_BORDER_MODE_EXT} + GL_CONVOLUTION_FILTER_SCALE_EXT = $8014; + {$EXTERNALSYM GL_CONVOLUTION_FILTER_SCALE_EXT} + GL_CONVOLUTION_FILTER_BIAS_EXT = $8015; + {$EXTERNALSYM GL_CONVOLUTION_FILTER_BIAS_EXT} + GL_REDUCE_EXT = $8016; + {$EXTERNALSYM GL_REDUCE_EXT} + GL_CONVOLUTION_FORMAT_EXT = $8017; + {$EXTERNALSYM GL_CONVOLUTION_FORMAT_EXT} + GL_CONVOLUTION_WIDTH_EXT = $8018; + {$EXTERNALSYM GL_CONVOLUTION_WIDTH_EXT} + GL_CONVOLUTION_HEIGHT_EXT = $8019; + {$EXTERNALSYM GL_CONVOLUTION_HEIGHT_EXT} + GL_MAX_CONVOLUTION_WIDTH_EXT = $801A; + {$EXTERNALSYM GL_MAX_CONVOLUTION_WIDTH_EXT} + GL_MAX_CONVOLUTION_HEIGHT_EXT = $801B; + {$EXTERNALSYM GL_MAX_CONVOLUTION_HEIGHT_EXT} + GL_POST_CONVOLUTION_RED_SCALE_EXT = $801C; + {$EXTERNALSYM GL_POST_CONVOLUTION_RED_SCALE_EXT} + GL_POST_CONVOLUTION_GREEN_SCALE_EXT = $801D; + {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_SCALE_EXT} + GL_POST_CONVOLUTION_BLUE_SCALE_EXT = $801E; + {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_SCALE_EXT} + GL_POST_CONVOLUTION_ALPHA_SCALE_EXT = $801F; + {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_SCALE_EXT} + GL_POST_CONVOLUTION_RED_BIAS_EXT = $8020; + {$EXTERNALSYM GL_POST_CONVOLUTION_RED_BIAS_EXT} + GL_POST_CONVOLUTION_GREEN_BIAS_EXT = $8021; + {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_BIAS_EXT} + GL_POST_CONVOLUTION_BLUE_BIAS_EXT = $8022; + {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_BIAS_EXT} + GL_POST_CONVOLUTION_ALPHA_BIAS_EXT = $8023; + {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_BIAS_EXT} + + // EXT_histogram + GL_HISTOGRAM_EXT = $8024; + {$EXTERNALSYM GL_HISTOGRAM_EXT} + GL_PROXY_HISTOGRAM_EXT = $8025; + {$EXTERNALSYM GL_PROXY_HISTOGRAM_EXT} + GL_HISTOGRAM_WIDTH_EXT = $8026; + {$EXTERNALSYM GL_HISTOGRAM_WIDTH_EXT} + GL_HISTOGRAM_FORMAT_EXT = $8027; + {$EXTERNALSYM GL_HISTOGRAM_FORMAT_EXT} + GL_HISTOGRAM_RED_SIZE_EXT = $8028; + {$EXTERNALSYM GL_HISTOGRAM_RED_SIZE_EXT} + GL_HISTOGRAM_GREEN_SIZE_EXT = $8029; + {$EXTERNALSYM GL_HISTOGRAM_GREEN_SIZE_EXT} + GL_HISTOGRAM_BLUE_SIZE_EXT = $802A; + {$EXTERNALSYM GL_HISTOGRAM_BLUE_SIZE_EXT} + GL_HISTOGRAM_ALPHA_SIZE_EXT = $802B; + {$EXTERNALSYM GL_HISTOGRAM_ALPHA_SIZE_EXT} + GL_HISTOGRAM_LUMINANCE_SIZE_EXT = $802C; + {$EXTERNALSYM GL_HISTOGRAM_LUMINANCE_SIZE_EXT} + GL_HISTOGRAM_SINK_EXT = $802D; + {$EXTERNALSYM GL_HISTOGRAM_SINK_EXT} + GL_MINMAX_EXT = $802E; + {$EXTERNALSYM GL_MINMAX_EXT} + GL_MINMAX_FORMAT_EXT = $802F; + {$EXTERNALSYM GL_MINMAX_FORMAT_EXT} + GL_MINMAX_SINK_EXT = $8030; + {$EXTERNALSYM GL_MINMAX_SINK_EXT} + + // EXT_polygon_offset + GL_POLYGON_OFFSET_EXT = $8037; + {$EXTERNALSYM GL_POLYGON_OFFSET_EXT} + GL_POLYGON_OFFSET_FACTOR_EXT = $8038; + {$EXTERNALSYM GL_POLYGON_OFFSET_FACTOR_EXT} + GL_POLYGON_OFFSET_BIAS_EXT = $8039; + {$EXTERNALSYM GL_POLYGON_OFFSET_BIAS_EXT} + + // EXT_texture + GL_ALPHA4_EXT = $803B; + {$EXTERNALSYM GL_ALPHA4_EXT} + GL_ALPHA8_EXT = $803C; + {$EXTERNALSYM GL_ALPHA8_EXT} + GL_ALPHA12_EXT = $803D; + {$EXTERNALSYM GL_ALPHA12_EXT} + GL_ALPHA16_EXT = $803E; + {$EXTERNALSYM GL_ALPHA16_EXT} + GL_LUMINANCE4_EXT = $803F; + {$EXTERNALSYM GL_LUMINANCE4_EXT} + GL_LUMINANCE8_EXT = $8040; + {$EXTERNALSYM GL_LUMINANCE8_EXT} + GL_LUMINANCE12_EXT = $8041; + {$EXTERNALSYM GL_LUMINANCE12_EXT} + GL_LUMINANCE16_EXT = $8042; + {$EXTERNALSYM GL_LUMINANCE16_EXT} + GL_LUMINANCE4_ALPHA4_EXT = $8043; + {$EXTERNALSYM GL_LUMINANCE4_ALPHA4_EXT} + GL_LUMINANCE6_ALPHA2_EXT = $8044; + {$EXTERNALSYM GL_LUMINANCE6_ALPHA2_EXT} + GL_LUMINANCE8_ALPHA8_EXT = $8045; + {$EXTERNALSYM GL_LUMINANCE8_ALPHA8_EXT} + GL_LUMINANCE12_ALPHA4_EXT = $8046; + {$EXTERNALSYM GL_LUMINANCE12_ALPHA4_EXT} + GL_LUMINANCE12_ALPHA12_EXT = $8047; + {$EXTERNALSYM GL_LUMINANCE12_ALPHA12_EXT} + GL_LUMINANCE16_ALPHA16_EXT = $8048; + {$EXTERNALSYM GL_LUMINANCE16_ALPHA16_EXT} + GL_INTENSITY_EXT = $8049; + {$EXTERNALSYM GL_INTENSITY_EXT} + GL_INTENSITY4_EXT = $804A; + {$EXTERNALSYM GL_INTENSITY4_EXT} + GL_INTENSITY8_EXT = $804B; + {$EXTERNALSYM GL_INTENSITY8_EXT} + GL_INTENSITY12_EXT = $804C; + {$EXTERNALSYM GL_INTENSITY12_EXT} + GL_INTENSITY16_EXT = $804D; + {$EXTERNALSYM GL_INTENSITY16_EXT} + GL_RGB2_EXT = $804E; + {$EXTERNALSYM GL_RGB2_EXT} + GL_RGB4_EXT = $804F; + {$EXTERNALSYM GL_RGB4_EXT} + GL_RGB5_EXT = $8050; + {$EXTERNALSYM GL_RGB5_EXT} + GL_RGB8_EXT = $8051; + {$EXTERNALSYM GL_RGB8_EXT} + GL_RGB10_EXT = $8052; + {$EXTERNALSYM GL_RGB10_EXT} + GL_RGB12_EXT = $8053; + {$EXTERNALSYM GL_RGB12_EXT} + GL_RGB16_EXT = $8054; + {$EXTERNALSYM GL_RGB16_EXT} + GL_RGBA2_EXT = $8055; + {$EXTERNALSYM GL_RGBA2_EXT} + GL_RGBA4_EXT = $8056; + {$EXTERNALSYM GL_RGBA4_EXT} + GL_RGB5_A1_EXT = $8057; + {$EXTERNALSYM GL_RGB5_A1_EXT} + GL_RGBA8_EXT = $8058; + {$EXTERNALSYM GL_RGBA8_EXT} + GL_RGB10_A2_EXT = $8059; + {$EXTERNALSYM GL_RGB10_A2_EXT} + GL_RGBA12_EXT = $805A; + {$EXTERNALSYM GL_RGBA12_EXT} + GL_RGBA16_EXT = $805B; + {$EXTERNALSYM GL_RGBA16_EXT} + GL_TEXTURE_RED_SIZE_EXT = $805C; + {$EXTERNALSYM GL_TEXTURE_RED_SIZE_EXT} + GL_TEXTURE_GREEN_SIZE_EXT = $805D; + {$EXTERNALSYM GL_TEXTURE_GREEN_SIZE_EXT} + GL_TEXTURE_BLUE_SIZE_EXT = $805E; + {$EXTERNALSYM GL_TEXTURE_BLUE_SIZE_EXT} + GL_TEXTURE_ALPHA_SIZE_EXT = $805F; + {$EXTERNALSYM GL_TEXTURE_ALPHA_SIZE_EXT} + GL_TEXTURE_LUMINANCE_SIZE_EXT = $8060; + {$EXTERNALSYM GL_TEXTURE_LUMINANCE_SIZE_EXT} + GL_TEXTURE_INTENSITY_SIZE_EXT = $8061; + {$EXTERNALSYM GL_TEXTURE_INTENSITY_SIZE_EXT} + GL_REPLACE_EXT = $8062; + {$EXTERNALSYM GL_REPLACE_EXT} + GL_PROXY_TEXTURE_1D_EXT = $8063; + {$EXTERNALSYM GL_PROXY_TEXTURE_1D_EXT} + GL_PROXY_TEXTURE_2D_EXT = $8064; + {$EXTERNALSYM GL_PROXY_TEXTURE_2D_EXT} + GL_TEXTURE_TOO_LARGE_EXT = $8065; + {$EXTERNALSYM GL_TEXTURE_TOO_LARGE_EXT} + + // EXT_texture_object + GL_TEXTURE_PRIORITY_EXT = $8066; + {$EXTERNALSYM GL_TEXTURE_PRIORITY_EXT} + GL_TEXTURE_RESIDENT_EXT = $8067; + {$EXTERNALSYM GL_TEXTURE_RESIDENT_EXT} + GL_TEXTURE_1D_BINDING_EXT = $8068; + {$EXTERNALSYM GL_TEXTURE_1D_BINDING_EXT} + GL_TEXTURE_2D_BINDING_EXT = $8069; + {$EXTERNALSYM GL_TEXTURE_2D_BINDING_EXT} + GL_TEXTURE_3D_BINDING_EXT = $806A; + {$EXTERNALSYM GL_TEXTURE_3D_BINDING_EXT} + + // EXT_texture3D + GL_PACK_SKIP_IMAGES_EXT = $806B; + {$EXTERNALSYM GL_PACK_SKIP_IMAGES_EXT} + GL_PACK_IMAGE_HEIGHT_EXT = $806C; + {$EXTERNALSYM GL_PACK_IMAGE_HEIGHT_EXT} + GL_UNPACK_SKIP_IMAGES_EXT = $806D; + {$EXTERNALSYM GL_UNPACK_SKIP_IMAGES_EXT} + GL_UNPACK_IMAGE_HEIGHT_EXT = $806E; + {$EXTERNALSYM GL_UNPACK_IMAGE_HEIGHT_EXT} + GL_TEXTURE_3D_EXT = $806F; + {$EXTERNALSYM GL_TEXTURE_3D_EXT} + GL_PROXY_TEXTURE_3D_EXT = $8070; + {$EXTERNALSYM GL_PROXY_TEXTURE_3D_EXT} + GL_TEXTURE_DEPTH_EXT = $8071; + {$EXTERNALSYM GL_TEXTURE_DEPTH_EXT} + GL_TEXTURE_WRAP_R_EXT = $8072; + {$EXTERNALSYM GL_TEXTURE_WRAP_R_EXT} + GL_MAX_3D_TEXTURE_SIZE_EXT = $8073; + {$EXTERNALSYM GL_MAX_3D_TEXTURE_SIZE_EXT} + + // SGI_color_matrix + GL_COLOR_MATRIX_SGI = $80B1; + {$EXTERNALSYM GL_COLOR_MATRIX_SGI} + GL_COLOR_MATRIX_STACK_DEPTH_SGI = $80B2; + {$EXTERNALSYM GL_COLOR_MATRIX_STACK_DEPTH_SGI} + GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI = $80B3; + {$EXTERNALSYM GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI} + GL_POST_COLOR_MATRIX_RED_SCALE_SGI = $80B4; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_SCALE_SGI} + GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI = $80B5; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI} + GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI = $80B6; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI} + GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI = $80B7; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI} + GL_POST_COLOR_MATRIX_RED_BIAS_SGI = $80B8; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_BIAS_SGI} + GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI = $80B9; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI} + GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI = $80BA; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI} + GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI = $80BB; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI} + + // SGI_texture_color_table + GL_TEXTURE_COLOR_TABLE_SGI = $80BC; + {$EXTERNALSYM GL_TEXTURE_COLOR_TABLE_SGI} + GL_PROXY_TEXTURE_COLOR_TABLE_SGI = $80BD; + {$EXTERNALSYM GL_PROXY_TEXTURE_COLOR_TABLE_SGI} + GL_TEXTURE_COLOR_TABLE_BIAS_SGI = $80BE; + {$EXTERNALSYM GL_TEXTURE_COLOR_TABLE_BIAS_SGI} + GL_TEXTURE_COLOR_TABLE_SCALE_SGI = $80BF; + {$EXTERNALSYM GL_TEXTURE_COLOR_TABLE_SCALE_SGI} + + // SGI_color_table + GL_COLOR_TABLE_SGI = $80D0; + {$EXTERNALSYM GL_COLOR_TABLE_SGI} + GL_POST_CONVOLUTION_COLOR_TABLE_SGI = $80D1; + {$EXTERNALSYM GL_POST_CONVOLUTION_COLOR_TABLE_SGI} + GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI = $80D2; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI} + GL_PROXY_COLOR_TABLE_SGI = $80D3; + {$EXTERNALSYM GL_PROXY_COLOR_TABLE_SGI} + GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI = $80D4; + {$EXTERNALSYM GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI} + GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI = $80D5; + {$EXTERNALSYM GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI} + GL_COLOR_TABLE_SCALE_SGI = $80D6; + {$EXTERNALSYM GL_COLOR_TABLE_SCALE_SGI} + GL_COLOR_TABLE_BIAS_SGI = $80D7; + {$EXTERNALSYM GL_COLOR_TABLE_BIAS_SGI} + GL_COLOR_TABLE_FORMAT_SGI = $80D8; + {$EXTERNALSYM GL_COLOR_TABLE_FORMAT_SGI} + GL_COLOR_TABLE_WIDTH_SGI = $80D9; + {$EXTERNALSYM GL_COLOR_TABLE_WIDTH_SGI} + GL_COLOR_TABLE_RED_SIZE_SGI = $80DA; + {$EXTERNALSYM GL_COLOR_TABLE_RED_SIZE_SGI} + GL_COLOR_TABLE_GREEN_SIZE_SGI = $80DB; + {$EXTERNALSYM GL_COLOR_TABLE_GREEN_SIZE_SGI} + GL_COLOR_TABLE_BLUE_SIZE_SGI = $80DC; + {$EXTERNALSYM GL_COLOR_TABLE_BLUE_SIZE_SGI} + GL_COLOR_TABLE_ALPHA_SIZE_SGI = $80DD; + {$EXTERNALSYM GL_COLOR_TABLE_ALPHA_SIZE_SGI} + GL_COLOR_TABLE_LUMINANCE_SIZE_SGI = $80DE; + {$EXTERNALSYM GL_COLOR_TABLE_LUMINANCE_SIZE_SGI} + GL_COLOR_TABLE_INTENSITY_SIZE_SGI = $80DF; + {$EXTERNALSYM GL_COLOR_TABLE_INTENSITY_SIZE_SGI} + + // EXT_cmyka + GL_CMYK_EXT = $800C; + {$EXTERNALSYM GL_CMYK_EXT} + GL_CMYKA_EXT = $800D; + {$EXTERNALSYM GL_CMYKA_EXT} + GL_PACK_CMYK_HINT_EXT = $800E; + {$EXTERNALSYM GL_PACK_CMYK_HINT_EXT} + GL_UNPACK_CMYK_HINT_EXT = $800F; + {$EXTERNALSYM GL_UNPACK_CMYK_HINT_EXT} + + // EXT_rescale_normal + GL_RESCALE_NORMAL_EXT = $803A; + {$EXTERNALSYM GL_RESCALE_NORMAL_EXT} + + // EXT_clip_volume_hint + GL_CLIP_VOLUME_CLIPPING_HINT_EXT = $80F0; + {$EXTERNALSYM GL_CLIP_VOLUME_CLIPPING_HINT_EXT} + + // EXT_cull_vertex + GL_CULL_VERTEX_EXT = $81AA; + {$EXTERNALSYM GL_CULL_VERTEX_EXT} + GL_CULL_VERTEX_EYE_POSITION_EXT = $81AB; + {$EXTERNALSYM GL_CULL_VERTEX_EYE_POSITION_EXT} + GL_CULL_VERTEX_OBJECT_POSITION_EXT = $81AC; + {$EXTERNALSYM GL_CULL_VERTEX_OBJECT_POSITION_EXT} + + // EXT_index_array_formats + GL_IUI_V2F_EXT = $81AD; + {$EXTERNALSYM GL_IUI_V2F_EXT} + GL_IUI_V3F_EXT = $81AE; + {$EXTERNALSYM GL_IUI_V3F_EXT} + GL_IUI_N3F_V2F_EXT = $81AF; + {$EXTERNALSYM GL_IUI_N3F_V2F_EXT} + GL_IUI_N3F_V3F_EXT = $81B0; + {$EXTERNALSYM GL_IUI_N3F_V3F_EXT} + GL_T2F_IUI_V2F_EXT = $81B1; + {$EXTERNALSYM GL_T2F_IUI_V2F_EXT} + GL_T2F_IUI_V3F_EXT = $81B2; + {$EXTERNALSYM GL_T2F_IUI_V3F_EXT} + GL_T2F_IUI_N3F_V2F_EXT = $81B3; + {$EXTERNALSYM GL_T2F_IUI_N3F_V2F_EXT} + GL_T2F_IUI_N3F_V3F_EXT = $81B4; + {$EXTERNALSYM GL_T2F_IUI_N3F_V3F_EXT} + + // EXT_index_func + GL_INDEX_TEST_EXT = $81B5; + {$EXTERNALSYM GL_INDEX_TEST_EXT} + GL_INDEX_TEST_FUNC_EXT = $81B6; + {$EXTERNALSYM GL_INDEX_TEST_FUNC_EXT} + GL_INDEX_TEST_REF_EXT = $81B7; + {$EXTERNALSYM GL_INDEX_TEST_REF_EXT} + + // EXT_index_material + GL_INDEX_MATERIAL_EXT = $81B8; + {$EXTERNALSYM GL_INDEX_MATERIAL_EXT} + GL_INDEX_MATERIAL_PARAMETER_EXT = $81B9; + {$EXTERNALSYM GL_INDEX_MATERIAL_PARAMETER_EXT} + GL_INDEX_MATERIAL_FACE_EXT = $81BA; + {$EXTERNALSYM GL_INDEX_MATERIAL_FACE_EXT} + + // EXT_misc_attribute + GL_MISC_BIT_EXT = 0; // not yet defined + {$EXTERNALSYM GL_MISC_BIT_EXT} + + // EXT_scene_marker + GL_SCENE_REQUIRED_EXT = 0; // not yet defined + {$EXTERNALSYM GL_SCENE_REQUIRED_EXT} + + // EXT_shared_texture_palette + GL_SHARED_TEXTURE_PALETTE_EXT = $81FB; + {$EXTERNALSYM GL_SHARED_TEXTURE_PALETTE_EXT} + + // EXT_nurbs_tessellator + GLU_NURBS_MODE_EXT = 100160; + {$EXTERNALSYM GLU_NURBS_MODE_EXT} + GLU_NURBS_TESSELLATOR_EXT = 100161; + {$EXTERNALSYM GLU_NURBS_TESSELLATOR_EXT} + GLU_NURBS_RENDERER_EXT = 100162; + {$EXTERNALSYM GLU_NURBS_RENDERER_EXT} + GLU_NURBS_BEGIN_EXT = 100164; + {$EXTERNALSYM GLU_NURBS_BEGIN_EXT} + GLU_NURBS_VERTEX_EXT = 100165; + {$EXTERNALSYM GLU_NURBS_VERTEX_EXT} + GLU_NURBS_NORMAL_EXT = 100166; + {$EXTERNALSYM GLU_NURBS_NORMAL_EXT} + GLU_NURBS_COLOR_EXT = 100167; + {$EXTERNALSYM GLU_NURBS_COLOR_EXT} + GLU_NURBS_TEX_COORD_EXT = 100168; + {$EXTERNALSYM GLU_NURBS_TEX_COORD_EXT} + GLU_NURBS_END_EXT = 100169; + {$EXTERNALSYM GLU_NURBS_END_EXT} + GLU_NURBS_BEGIN_DATA_EXT = 100170; + {$EXTERNALSYM GLU_NURBS_BEGIN_DATA_EXT} + GLU_NURBS_VERTEX_DATA_EXT = 100171; + {$EXTERNALSYM GLU_NURBS_VERTEX_DATA_EXT} + GLU_NURBS_NORMAL_DATA_EXT = 100172; + {$EXTERNALSYM GLU_NURBS_NORMAL_DATA_EXT} + GLU_NURBS_COLOR_DATA_EXT = 100173; + {$EXTERNALSYM GLU_NURBS_COLOR_DATA_EXT} + GLU_NURBS_TEX_COORD_DATA_EXT = 100174; + {$EXTERNALSYM GLU_NURBS_TEX_COORD_DATA_EXT} + GLU_NURBS_END_DATA_EXT = 100175; + {$EXTERNALSYM GLU_NURBS_END_DATA_EXT} + + // EXT_object_space_tess + GLU_OBJECT_PARAMETRIC_ERROR_EXT = 100208; + {$EXTERNALSYM GLU_OBJECT_PARAMETRIC_ERROR_EXT} + GLU_OBJECT_PATH_LENGTH_EXT = 100209; + {$EXTERNALSYM GLU_OBJECT_PATH_LENGTH_EXT} + + // EXT_point_parameters + GL_POINT_SIZE_MIN_EXT = $8126; + {$EXTERNALSYM GL_POINT_SIZE_MIN_EXT} + GL_POINT_SIZE_MAX_EXT = $8127; + {$EXTERNALSYM GL_POINT_SIZE_MAX_EXT} + GL_POINT_FADE_THRESHOLD_SIZE_EXT = $8128; + {$EXTERNALSYM GL_POINT_FADE_THRESHOLD_SIZE_EXT} + GL_DISTANCE_ATTENUATION_EXT = $8129; + {$EXTERNALSYM GL_DISTANCE_ATTENUATION_EXT} + + // EXT_compiled_vertex_array + GL_ARRAY_ELEMENT_LOCK_FIRST_EXT = $81A8; + {$EXTERNALSYM GL_ARRAY_ELEMENT_LOCK_FIRST_EXT} + GL_ARRAY_ELEMENT_LOCK_COUNT_EXT = $81A9; + {$EXTERNALSYM GL_ARRAY_ELEMENT_LOCK_COUNT_EXT} + + // ARB_multitexture + GL_ACTIVE_TEXTURE_ARB = $84E0; + {$EXTERNALSYM GL_ACTIVE_TEXTURE_ARB} + GL_CLIENT_ACTIVE_TEXTURE_ARB = $84E1; + {$EXTERNALSYM GL_CLIENT_ACTIVE_TEXTURE_ARB} + GL_MAX_TEXTURE_UNITS_ARB = $84E2; + {$EXTERNALSYM GL_MAX_TEXTURE_UNITS_ARB} + GL_TEXTURE0_ARB = $84C0; + {$EXTERNALSYM GL_TEXTURE0_ARB} + GL_TEXTURE1_ARB = $84C1; + {$EXTERNALSYM GL_TEXTURE1_ARB} + GL_TEXTURE2_ARB = $84C2; + {$EXTERNALSYM GL_TEXTURE2_ARB} + GL_TEXTURE3_ARB = $84C3; + {$EXTERNALSYM GL_TEXTURE3_ARB} + GL_TEXTURE4_ARB = $84C4; + {$EXTERNALSYM GL_TEXTURE4_ARB} + GL_TEXTURE5_ARB = $84C5; + {$EXTERNALSYM GL_TEXTURE5_ARB} + GL_TEXTURE6_ARB = $84C6; + {$EXTERNALSYM GL_TEXTURE6_ARB} + GL_TEXTURE7_ARB = $84C7; + {$EXTERNALSYM GL_TEXTURE7_ARB} + GL_TEXTURE8_ARB = $84C8; + {$EXTERNALSYM GL_TEXTURE8_ARB} + GL_TEXTURE9_ARB = $84C9; + {$EXTERNALSYM GL_TEXTURE9_ARB} + GL_TEXTURE10_ARB = $84CA; + {$EXTERNALSYM GL_TEXTURE10_ARB} + GL_TEXTURE11_ARB = $84CB; + {$EXTERNALSYM GL_TEXTURE11_ARB} + GL_TEXTURE12_ARB = $84CC; + {$EXTERNALSYM GL_TEXTURE12_ARB} + GL_TEXTURE13_ARB = $84CD; + {$EXTERNALSYM GL_TEXTURE13_ARB} + GL_TEXTURE14_ARB = $84CE; + {$EXTERNALSYM GL_TEXTURE14_ARB} + GL_TEXTURE15_ARB = $84CF; + {$EXTERNALSYM GL_TEXTURE15_ARB} + GL_TEXTURE16_ARB = $84D0; + {$EXTERNALSYM GL_TEXTURE16_ARB} + GL_TEXTURE17_ARB = $84D1; + {$EXTERNALSYM GL_TEXTURE17_ARB} + GL_TEXTURE18_ARB = $84D2; + {$EXTERNALSYM GL_TEXTURE18_ARB} + GL_TEXTURE19_ARB = $84D3; + {$EXTERNALSYM GL_TEXTURE19_ARB} + GL_TEXTURE20_ARB = $84D4; + {$EXTERNALSYM GL_TEXTURE20_ARB} + GL_TEXTURE21_ARB = $84D5; + {$EXTERNALSYM GL_TEXTURE21_ARB} + GL_TEXTURE22_ARB = $84D6; + {$EXTERNALSYM GL_TEXTURE22_ARB} + GL_TEXTURE23_ARB = $84D7; + {$EXTERNALSYM GL_TEXTURE23_ARB} + GL_TEXTURE24_ARB = $84D8; + {$EXTERNALSYM GL_TEXTURE24_ARB} + GL_TEXTURE25_ARB = $84D9; + {$EXTERNALSYM GL_TEXTURE25_ARB} + GL_TEXTURE26_ARB = $84DA; + {$EXTERNALSYM GL_TEXTURE26_ARB} + GL_TEXTURE27_ARB = $84DB; + {$EXTERNALSYM GL_TEXTURE27_ARB} + GL_TEXTURE28_ARB = $84DC; + {$EXTERNALSYM GL_TEXTURE28_ARB} + GL_TEXTURE29_ARB = $84DD; + {$EXTERNALSYM GL_TEXTURE29_ARB} + GL_TEXTURE30_ARB = $84DE; + {$EXTERNALSYM GL_TEXTURE30_ARB} + GL_TEXTURE31_ARB = $84DF; + {$EXTERNALSYM GL_TEXTURE31_ARB} + + // EXT_stencil_wrap + GL_INCR_WRAP_EXT = $8507; + {$EXTERNALSYM GL_INCR_WRAP_EXT} + GL_DECR_WRAP_EXT = $8508; + {$EXTERNALSYM GL_DECR_WRAP_EXT} + + // NV_texgen_reflection + GL_NORMAL_MAP_NV = $8511; + {$EXTERNALSYM GL_NORMAL_MAP_NV} + GL_REFLECTION_MAP_NV = $8512; + {$EXTERNALSYM GL_REFLECTION_MAP_NV} + + // EXT_texture_env_combine + GL_COMBINE_EXT = $8570; + {$EXTERNALSYM GL_COMBINE_EXT} + GL_COMBINE_RGB_EXT = $8571; + {$EXTERNALSYM GL_COMBINE_RGB_EXT} + GL_COMBINE_ALPHA_EXT = $8572; + {$EXTERNALSYM GL_COMBINE_ALPHA_EXT} + GL_RGB_SCALE_EXT = $8573; + {$EXTERNALSYM GL_RGB_SCALE_EXT} + GL_ADD_SIGNED_EXT = $8574; + {$EXTERNALSYM GL_ADD_SIGNED_EXT} + GL_INTERPOLATE_EXT = $8575; + {$EXTERNALSYM GL_INTERPOLATE_EXT} + GL_CONSTANT_EXT = $8576; + {$EXTERNALSYM GL_CONSTANT_EXT} + GL_PRIMARY_COLOR_EXT = $8577; + {$EXTERNALSYM GL_PRIMARY_COLOR_EXT} + GL_PREVIOUS_EXT = $8578; + {$EXTERNALSYM GL_PREVIOUS_EXT} + GL_SOURCE0_RGB_EXT = $8580; + {$EXTERNALSYM GL_SOURCE0_RGB_EXT} + GL_SOURCE1_RGB_EXT = $8581; + {$EXTERNALSYM GL_SOURCE1_RGB_EXT} + GL_SOURCE2_RGB_EXT = $8582; + {$EXTERNALSYM GL_SOURCE2_RGB_EXT} + GL_SOURCE0_ALPHA_EXT = $8588; + {$EXTERNALSYM GL_SOURCE0_ALPHA_EXT} + GL_SOURCE1_ALPHA_EXT = $8589; + {$EXTERNALSYM GL_SOURCE1_ALPHA_EXT} + GL_SOURCE2_ALPHA_EXT = $858A; + {$EXTERNALSYM GL_SOURCE2_ALPHA_EXT} + GL_OPERAND0_RGB_EXT = $8590; + {$EXTERNALSYM GL_OPERAND0_RGB_EXT} + GL_OPERAND1_RGB_EXT = $8591; + {$EXTERNALSYM GL_OPERAND1_RGB_EXT} + GL_OPERAND2_RGB_EXT = $8592; + {$EXTERNALSYM GL_OPERAND2_RGB_EXT} + GL_OPERAND0_ALPHA_EXT = $8598; + {$EXTERNALSYM GL_OPERAND0_ALPHA_EXT} + GL_OPERAND1_ALPHA_EXT = $8599; + {$EXTERNALSYM GL_OPERAND1_ALPHA_EXT} + GL_OPERAND2_ALPHA_EXT = $859A; + {$EXTERNALSYM GL_OPERAND2_ALPHA_EXT} + + // NV_texture_env_combine4 + GL_COMBINE4_NV = $8503; + {$EXTERNALSYM GL_COMBINE4_NV} + GL_SOURCE3_RGB_NV = $8583; + {$EXTERNALSYM GL_SOURCE3_RGB_NV} + GL_SOURCE3_ALPHA_NV = $858B; + {$EXTERNALSYM GL_SOURCE3_ALPHA_NV} + GL_OPERAND3_RGB_NV = $8593; + {$EXTERNALSYM GL_OPERAND3_RGB_NV} + GL_OPERAND3_ALPHA_NV = $859B; + {$EXTERNALSYM GL_OPERAND3_ALPHA_NV} + + GL_BLEND_EQUATION = $8009; + {$EXTERNALSYM GL_BLEND_EQUATION} + GL_TABLE_TOO_LARGE = $8031; + {$EXTERNALSYM GL_TABLE_TOO_LARGE} + GL_UNSIGNED_BYTE_3_3_2 = $8032; + {$EXTERNALSYM GL_UNSIGNED_BYTE_3_3_2} + GL_UNSIGNED_SHORT_4_4_4_4 = $8033; + {$EXTERNALSYM GL_UNSIGNED_SHORT_4_4_4_4} + GL_UNSIGNED_SHORT_5_5_5_1 = $8034; + {$EXTERNALSYM GL_UNSIGNED_SHORT_5_5_5_1} + GL_UNSIGNED_INT_8_8_8_8 = $8035; + {$EXTERNALSYM GL_UNSIGNED_INT_8_8_8_8} + GL_UNSIGNED_INT_10_10_10_2 = $8036; + {$EXTERNALSYM GL_UNSIGNED_INT_10_10_10_2} + GL_UNSIGNED_BYTE_2_3_3_REV = $8362; + {$EXTERNALSYM GL_UNSIGNED_BYTE_2_3_3_REV} + GL_UNSIGNED_SHORT_5_6_5 = $8363; + {$EXTERNALSYM GL_UNSIGNED_SHORT_5_6_5} + GL_UNSIGNED_SHORT_5_6_5_REV = $8364; + {$EXTERNALSYM GL_UNSIGNED_SHORT_5_6_5_REV} + GL_UNSIGNED_SHORT_4_4_4_4_REV = $8365; + {$EXTERNALSYM GL_UNSIGNED_SHORT_4_4_4_4_REV} + GL_UNSIGNED_SHORT_1_5_5_5_REV = $8366; + {$EXTERNALSYM GL_UNSIGNED_SHORT_1_5_5_5_REV} + GL_UNSIGNED_INT_8_8_8_8_REV = $8367; + {$EXTERNALSYM GL_UNSIGNED_INT_8_8_8_8_REV} + GL_UNSIGNED_INT_2_10_10_10_REV = $8368; + {$EXTERNALSYM GL_UNSIGNED_INT_2_10_10_10_REV} + + // GL_ARB_transpose_matrix + GL_TRANSPOSE_MODELVIEW_MATRIX_ARB = $84E3; + {$EXTERNALSYM GL_TRANSPOSE_MODELVIEW_MATRIX_ARB} + GL_TRANSPOSE_PROJECTION_MATRIX_ARB = $84E4; + {$EXTERNALSYM GL_TRANSPOSE_PROJECTION_MATRIX_ARB} + GL_TRANSPOSE_TEXTURE_MATRIX_ARB = $84E5; + {$EXTERNALSYM GL_TRANSPOSE_TEXTURE_MATRIX_ARB} + GL_TRANSPOSE_COLOR_MATRIX_ARB = $84E6; + {$EXTERNALSYM GL_TRANSPOSE_COLOR_MATRIX_ARB} + + // GL_ARB_multisample + GL_MULTISAMPLE_ARB = $809D; + {$EXTERNALSYM GL_MULTISAMPLE_ARB} + GL_SAMPLE_ALPHA_TO_COVERAGE_ARB = $809E; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_COVERAGE_ARB} + GL_SAMPLE_ALPHA_TO_ONE_ARB = $809F; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_ONE_ARB} + GL_SAMPLE_COVERAGE_ARB = $80A0; + {$EXTERNALSYM GL_SAMPLE_COVERAGE_ARB} + GL_SAMPLE_BUFFERS_ARB = $80A8; + {$EXTERNALSYM GL_SAMPLE_BUFFERS_ARB} + GL_SAMPLES_ARB = $80A9; + {$EXTERNALSYM GL_SAMPLES_ARB} + GL_SAMPLE_COVERAGE_VALUE_ARB = $80AA; + {$EXTERNALSYM GL_SAMPLE_COVERAGE_VALUE_ARB} + GL_SAMPLE_COVERAGE_INVERT_ARB = $80AB; + {$EXTERNALSYM GL_SAMPLE_COVERAGE_INVERT_ARB} + GL_MULTISAMPLE_BIT_ARB = $20000000; + {$EXTERNALSYM GL_MULTISAMPLE_BIT_ARB} + GLX_SAMPLE_BUFFERS_ARB = 100000; + {$EXTERNALSYM GLX_SAMPLE_BUFFERS_ARB} + GLX_SAMPLES_ARB = 100001; + {$EXTERNALSYM GLX_SAMPLES_ARB} + WGL_SAMPLE_BUFFERS_ARB = $2041; + {$EXTERNALSYM WGL_SAMPLE_BUFFERS_ARB} + WGL_SAMPLES_ARB = $2042; + {$EXTERNALSYM WGL_SAMPLES_ARB} + + // GL_ARB_texture_cube_map + GL_NORMAL_MAP_ARB = $8511; + {$EXTERNALSYM GL_NORMAL_MAP_ARB} + GL_REFLECTION_MAP_ARB = $8512; + {$EXTERNALSYM GL_REFLECTION_MAP_ARB} + GL_TEXTURE_CUBE_MAP_ARB = $8513; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_ARB} + GL_TEXTURE_BINDING_CUBE_MAP_ARB = $8514; + {$EXTERNALSYM GL_TEXTURE_BINDING_CUBE_MAP_ARB} + GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = $8515; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB} + GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = $8516; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB} + GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = $8517; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB} + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = $8518; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB} + GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = $8519; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB} + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = $851A; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB} + GL_PROXY_TEXTURE_CUBE_MAP_ARB = $851B; + {$EXTERNALSYM GL_PROXY_TEXTURE_CUBE_MAP_ARB} + GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB = $851C; + {$EXTERNALSYM GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB} + + // GL_ARB_texture_compression + GL_COMPRESSED_ALPHA_ARB = $84E9; + {$EXTERNALSYM GL_COMPRESSED_ALPHA_ARB} + GL_COMPRESSED_LUMINANCE_ARB = $84EA; + {$EXTERNALSYM GL_COMPRESSED_LUMINANCE_ARB} + GL_COMPRESSED_LUMINANCE_ALPHA_ARB = $84EB; + {$EXTERNALSYM GL_COMPRESSED_LUMINANCE_ALPHA_ARB} + GL_COMPRESSED_INTENSITY_ARB = $84EC; + {$EXTERNALSYM GL_COMPRESSED_INTENSITY_ARB} + GL_COMPRESSED_RGB_ARB = $84ED; + {$EXTERNALSYM GL_COMPRESSED_RGB_ARB} + GL_COMPRESSED_RGBA_ARB = $84EE; + {$EXTERNALSYM GL_COMPRESSED_RGBA_ARB} + GL_TEXTURE_COMPRESSION_HINT_ARB = $84EF; + {$EXTERNALSYM GL_TEXTURE_COMPRESSION_HINT_ARB} + GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB = $86A0; + {$EXTERNALSYM GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB} + GL_TEXTURE_COMPRESSED_ARB = $86A1; + {$EXTERNALSYM GL_TEXTURE_COMPRESSED_ARB} + GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB = $86A2; + {$EXTERNALSYM GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB} + GL_COMPRESSED_TEXTURE_FORMATS_ARB = $86A3; + {$EXTERNALSYM GL_COMPRESSED_TEXTURE_FORMATS_ARB} + + // GL_ARB_vertex_blend + GL_MAX_VERTEX_UNITS_ARB = $86A4; + {$EXTERNALSYM GL_MAX_VERTEX_UNITS_ARB} + GL_ACTIVE_VERTEX_UNITS_ARB = $86A5; + {$EXTERNALSYM GL_ACTIVE_VERTEX_UNITS_ARB} + GL_WEIGHT_SUM_UNITY_ARB = $86A6; + {$EXTERNALSYM GL_WEIGHT_SUM_UNITY_ARB} + GL_VERTEX_BLEND_ARB = $86A7; + {$EXTERNALSYM GL_VERTEX_BLEND_ARB} + GL_CURRENT_WEIGHT_ARB = $86A8; + {$EXTERNALSYM GL_CURRENT_WEIGHT_ARB} + GL_WEIGHT_ARRAY_TYPE_ARB = $86A9; + {$EXTERNALSYM GL_WEIGHT_ARRAY_TYPE_ARB} + GL_WEIGHT_ARRAY_STRIDE_ARB = $86AA; + {$EXTERNALSYM GL_WEIGHT_ARRAY_STRIDE_ARB} + GL_WEIGHT_ARRAY_SIZE_ARB = $86AB; + {$EXTERNALSYM GL_WEIGHT_ARRAY_SIZE_ARB} + GL_WEIGHT_ARRAY_POINTER_ARB = $86AC; + {$EXTERNALSYM GL_WEIGHT_ARRAY_POINTER_ARB} + GL_WEIGHT_ARRAY_ARB = $86AD; + {$EXTERNALSYM GL_WEIGHT_ARRAY_ARB} + GL_MODELVIEW0_ARB = $1700; + {$EXTERNALSYM GL_MODELVIEW0_ARB} + GL_MODELVIEW1_ARB = $850A; + {$EXTERNALSYM GL_MODELVIEW1_ARB} + GL_MODELVIEW2_ARB = $8722; + {$EXTERNALSYM GL_MODELVIEW2_ARB} + GL_MODELVIEW3_ARB = $8723; + {$EXTERNALSYM GL_MODELVIEW3_ARB} + GL_MODELVIEW4_ARB = $8724; + {$EXTERNALSYM GL_MODELVIEW4_ARB} + GL_MODELVIEW5_ARB = $8725; + {$EXTERNALSYM GL_MODELVIEW5_ARB} + GL_MODELVIEW6_ARB = $8726; + {$EXTERNALSYM GL_MODELVIEW6_ARB} + GL_MODELVIEW7_ARB = $8727; + {$EXTERNALSYM GL_MODELVIEW7_ARB} + GL_MODELVIEW8_ARB = $8728; + {$EXTERNALSYM GL_MODELVIEW8_ARB} + GL_MODELVIEW9_ARB = $8729; + {$EXTERNALSYM GL_MODELVIEW9_ARB} + GL_MODELVIEW10_ARB = $872A; + {$EXTERNALSYM GL_MODELVIEW10_ARB} + GL_MODELVIEW11_ARB = $872B; + {$EXTERNALSYM GL_MODELVIEW11_ARB} + GL_MODELVIEW12_ARB = $872C; + {$EXTERNALSYM GL_MODELVIEW12_ARB} + GL_MODELVIEW13_ARB = $872D; + {$EXTERNALSYM GL_MODELVIEW13_ARB} + GL_MODELVIEW14_ARB = $872E; + {$EXTERNALSYM GL_MODELVIEW14_ARB} + GL_MODELVIEW15_ARB = $872F; + {$EXTERNALSYM GL_MODELVIEW15_ARB} + GL_MODELVIEW16_ARB = $8730; + {$EXTERNALSYM GL_MODELVIEW16_ARB} + GL_MODELVIEW17_ARB = $8731; + {$EXTERNALSYM GL_MODELVIEW17_ARB} + GL_MODELVIEW18_ARB = $8732; + {$EXTERNALSYM GL_MODELVIEW18_ARB} + GL_MODELVIEW19_ARB = $8733; + {$EXTERNALSYM GL_MODELVIEW19_ARB} + GL_MODELVIEW20_ARB = $8734; + {$EXTERNALSYM GL_MODELVIEW20_ARB} + GL_MODELVIEW21_ARB = $8735; + {$EXTERNALSYM GL_MODELVIEW21_ARB} + GL_MODELVIEW22_ARB = $8736; + {$EXTERNALSYM GL_MODELVIEW22_ARB} + GL_MODELVIEW23_ARB = $8737; + {$EXTERNALSYM GL_MODELVIEW23_ARB} + GL_MODELVIEW24_ARB = $8738; + {$EXTERNALSYM GL_MODELVIEW24_ARB} + GL_MODELVIEW25_ARB = $8739; + {$EXTERNALSYM GL_MODELVIEW25_ARB} + GL_MODELVIEW26_ARB = $873A; + {$EXTERNALSYM GL_MODELVIEW26_ARB} + GL_MODELVIEW27_ARB = $873B; + {$EXTERNALSYM GL_MODELVIEW27_ARB} + GL_MODELVIEW28_ARB = $873C; + {$EXTERNALSYM GL_MODELVIEW28_ARB} + GL_MODELVIEW29_ARB = $873D; + {$EXTERNALSYM GL_MODELVIEW29_ARB} + GL_MODELVIEW30_ARB = $873E; + {$EXTERNALSYM GL_MODELVIEW30_ARB} + GL_MODELVIEW31_ARB = $873F; + {$EXTERNALSYM GL_MODELVIEW31_ARB} + + // GL_SGIS_texture_filter4 + GL_FILTER4_SGIS = $8146; + {$EXTERNALSYM GL_FILTER4_SGIS} + GL_TEXTURE_FILTER4_SIZE_SGIS = $8147; + {$EXTERNALSYM GL_TEXTURE_FILTER4_SIZE_SGIS} + + // GL_SGIS_pixel_texture + GL_PIXEL_TEXTURE_SGIS = $8353; + {$EXTERNALSYM GL_PIXEL_TEXTURE_SGIS} + GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS = $8354; + {$EXTERNALSYM GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS} + GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS = $8355; + {$EXTERNALSYM GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS} + GL_PIXEL_GROUP_COLOR_SGIS = $8356; + {$EXTERNALSYM GL_PIXEL_GROUP_COLOR_SGIS} + + // GL_SGIX_pixel_texture + GL_PIXEL_TEX_GEN_SGIX = $8139; + {$EXTERNALSYM GL_PIXEL_TEX_GEN_SGIX} + GL_PIXEL_TEX_GEN_MODE_SGIX = $832B; + {$EXTERNALSYM GL_PIXEL_TEX_GEN_MODE_SGIX} + + // GL_SGIS_texture4D + GL_PACK_SKIP_VOLUMES_SGIS = $8130; + {$EXTERNALSYM GL_PACK_SKIP_VOLUMES_SGIS} + GL_PACK_IMAGE_DEPTH_SGIS = $8131; + {$EXTERNALSYM GL_PACK_IMAGE_DEPTH_SGIS} + GL_UNPACK_SKIP_VOLUMES_SGIS = $8132; + {$EXTERNALSYM GL_UNPACK_SKIP_VOLUMES_SGIS} + GL_UNPACK_IMAGE_DEPTH_SGIS = $8133; + {$EXTERNALSYM GL_UNPACK_IMAGE_DEPTH_SGIS} + GL_TEXTURE_4D_SGIS = $8134; + {$EXTERNALSYM GL_TEXTURE_4D_SGIS} + GL_PROXY_TEXTURE_4D_SGIS = $8135; + {$EXTERNALSYM GL_PROXY_TEXTURE_4D_SGIS} + GL_TEXTURE_4DSIZE_SGIS = $8136; + {$EXTERNALSYM GL_TEXTURE_4DSIZE_SGIS} + GL_TEXTURE_WRAP_Q_SGIS = $8137; + {$EXTERNALSYM GL_TEXTURE_WRAP_Q_SGIS} + GL_MAX_4D_TEXTURE_SIZE_SGIS = $8138; + {$EXTERNALSYM GL_MAX_4D_TEXTURE_SIZE_SGIS} + GL_TEXTURE_4D_BINDING_SGIS = $814F; + {$EXTERNALSYM GL_TEXTURE_4D_BINDING_SGIS} + + // GL_SGIS_detail_texture + GL_DETAIL_TEXTURE_2D_SGIS = $8095; + {$EXTERNALSYM GL_DETAIL_TEXTURE_2D_SGIS} + GL_DETAIL_TEXTURE_2D_BINDING_SGIS = $8096; + {$EXTERNALSYM GL_DETAIL_TEXTURE_2D_BINDING_SGIS} + GL_LINEAR_DETAIL_SGIS = $8097; + {$EXTERNALSYM GL_LINEAR_DETAIL_SGIS} + GL_LINEAR_DETAIL_ALPHA_SGIS = $8098; + {$EXTERNALSYM GL_LINEAR_DETAIL_ALPHA_SGIS} + GL_LINEAR_DETAIL_COLOR_SGIS = $8099; + {$EXTERNALSYM GL_LINEAR_DETAIL_COLOR_SGIS} + GL_DETAIL_TEXTURE_LEVEL_SGIS = $809A; + {$EXTERNALSYM GL_DETAIL_TEXTURE_LEVEL_SGIS} + GL_DETAIL_TEXTURE_MODE_SGIS = $809B; + {$EXTERNALSYM GL_DETAIL_TEXTURE_MODE_SGIS} + GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS = $809C; + {$EXTERNALSYM GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS} + + // GL_SGIS_sharpen_texture + GL_LINEAR_SHARPEN_SGIS = $80AD; + {$EXTERNALSYM GL_LINEAR_SHARPEN_SGIS} + GL_LINEAR_SHARPEN_ALPHA_SGIS = $80AE; + {$EXTERNALSYM GL_LINEAR_SHARPEN_ALPHA_SGIS} + GL_LINEAR_SHARPEN_COLOR_SGIS = $80AF; + {$EXTERNALSYM GL_LINEAR_SHARPEN_COLOR_SGIS} + GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS = $80B0; + {$EXTERNALSYM GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS} + + // GL_SGIS_texture_lod + GL_TEXTURE_MIN_LOD_SGIS = $813A; + {$EXTERNALSYM GL_TEXTURE_MIN_LOD_SGIS} + GL_TEXTURE_MAX_LOD_SGIS = $813B; + {$EXTERNALSYM GL_TEXTURE_MAX_LOD_SGIS} + GL_TEXTURE_BASE_LEVEL_SGIS = $813C; + {$EXTERNALSYM GL_TEXTURE_BASE_LEVEL_SGIS} + GL_TEXTURE_MAX_LEVEL_SGIS = $813D; + {$EXTERNALSYM GL_TEXTURE_MAX_LEVEL_SGIS} + + // GL_SGIS_multisample + GL_MULTISAMPLE_SGIS = $809D; + {$EXTERNALSYM GL_MULTISAMPLE_SGIS} + GL_SAMPLE_ALPHA_TO_MASK_SGIS = $809E; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_MASK_SGIS} + GL_SAMPLE_ALPHA_TO_ONE_SGIS = $809F; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_ONE_SGIS} + GL_SAMPLE_MASK_SGIS = $80A0; + {$EXTERNALSYM GL_SAMPLE_MASK_SGIS} + GL_1PASS_SGIS = $80A1; + {$EXTERNALSYM GL_1PASS_SGIS} + GL_2PASS_0_SGIS = $80A2; + {$EXTERNALSYM GL_2PASS_0_SGIS} + GL_2PASS_1_SGIS = $80A3; + {$EXTERNALSYM GL_2PASS_1_SGIS} + GL_4PASS_0_SGIS = $80A4; + {$EXTERNALSYM GL_4PASS_0_SGIS} + GL_4PASS_1_SGIS = $80A5; + {$EXTERNALSYM GL_4PASS_1_SGIS} + GL_4PASS_2_SGIS = $80A6; + {$EXTERNALSYM GL_4PASS_2_SGIS} + GL_4PASS_3_SGIS = $80A7; + {$EXTERNALSYM GL_4PASS_3_SGIS} + GL_SAMPLE_BUFFERS_SGIS = $80A8; + {$EXTERNALSYM GL_SAMPLE_BUFFERS_SGIS} + GL_SAMPLES_SGIS = $80A9; + {$EXTERNALSYM GL_SAMPLES_SGIS} + GL_SAMPLE_MASK_VALUE_SGIS = $80AA; + {$EXTERNALSYM GL_SAMPLE_MASK_VALUE_SGIS} + GL_SAMPLE_MASK_INVERT_SGIS = $80AB; + {$EXTERNALSYM GL_SAMPLE_MASK_INVERT_SGIS} + GL_SAMPLE_PATTERN_SGIS = $80AC; + {$EXTERNALSYM GL_SAMPLE_PATTERN_SGIS} + + // GL_SGIS_generate_mipmap + GL_GENERATE_MIPMAP_SGIS = $8191; + {$EXTERNALSYM GL_GENERATE_MIPMAP_SGIS} + GL_GENERATE_MIPMAP_HINT_SGIS = $8192; + {$EXTERNALSYM GL_GENERATE_MIPMAP_HINT_SGIS} + + // GL_SGIX_clipmap + GL_LINEAR_CLIPMAP_LINEAR_SGIX = $8170; + {$EXTERNALSYM GL_LINEAR_CLIPMAP_LINEAR_SGIX} + GL_TEXTURE_CLIPMAP_CENTER_SGIX = $8171; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_CENTER_SGIX} + GL_TEXTURE_CLIPMAP_FRAME_SGIX = $8172; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_FRAME_SGIX} + GL_TEXTURE_CLIPMAP_OFFSET_SGIX = $8173; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_OFFSET_SGIX} + GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX = $8174; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX} + GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX = $8175; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX} + GL_TEXTURE_CLIPMAP_DEPTH_SGIX = $8176; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_DEPTH_SGIX} + GL_MAX_CLIPMAP_DEPTH_SGIX = $8177; + {$EXTERNALSYM GL_MAX_CLIPMAP_DEPTH_SGIX} + GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX = $8178; + {$EXTERNALSYM GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX} + GL_NEAREST_CLIPMAP_NEAREST_SGIX = $844D; + {$EXTERNALSYM GL_NEAREST_CLIPMAP_NEAREST_SGIX} + GL_NEAREST_CLIPMAP_LINEAR_SGIX = $844E; + {$EXTERNALSYM GL_NEAREST_CLIPMAP_LINEAR_SGIX} + GL_LINEAR_CLIPMAP_NEAREST_SGIX = $844F; + {$EXTERNALSYM GL_LINEAR_CLIPMAP_NEAREST_SGIX} + + // GL_SGIX_shadow + GL_TEXTURE_COMPARE_SGIX = $819A; + {$EXTERNALSYM GL_TEXTURE_COMPARE_SGIX} + GL_TEXTURE_COMPARE_OPERATOR_SGIX = $819B; + {$EXTERNALSYM GL_TEXTURE_COMPARE_OPERATOR_SGIX} + GL_TEXTURE_LEQUAL_R_SGIX = $819C; + {$EXTERNALSYM GL_TEXTURE_LEQUAL_R_SGIX} + GL_TEXTURE_GEQUAL_R_SGIX = $819D; + {$EXTERNALSYM GL_TEXTURE_GEQUAL_R_SGIX} + + // GL_SGIS_texture_edge_clamp + GL_CLAMP_TO_EDGE_SGIS = $812F; + {$EXTERNALSYM GL_CLAMP_TO_EDGE_SGIS} + + // GL_SGIS_texture_border_clamp + GL_CLAMP_TO_BORDER_SGIS = $812D; + {$EXTERNALSYM GL_CLAMP_TO_BORDER_SGIS} + + // GL_SGIX_interlace + GL_INTERLACE_SGIX = $8094; + {$EXTERNALSYM GL_INTERLACE_SGIX} + + // GL_SGIX_pixel_tiles + GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX = $813E; + {$EXTERNALSYM GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX} + GL_PIXEL_TILE_CACHE_INCREMENT_SGIX = $813F; + {$EXTERNALSYM GL_PIXEL_TILE_CACHE_INCREMENT_SGIX} + GL_PIXEL_TILE_WIDTH_SGIX = $8140; + {$EXTERNALSYM GL_PIXEL_TILE_WIDTH_SGIX} + GL_PIXEL_TILE_HEIGHT_SGIX = $8141; + {$EXTERNALSYM GL_PIXEL_TILE_HEIGHT_SGIX} + GL_PIXEL_TILE_GRID_WIDTH_SGIX = $8142; + {$EXTERNALSYM GL_PIXEL_TILE_GRID_WIDTH_SGIX} + GL_PIXEL_TILE_GRID_HEIGHT_SGIX = $8143; + {$EXTERNALSYM GL_PIXEL_TILE_GRID_HEIGHT_SGIX} + GL_PIXEL_TILE_GRID_DEPTH_SGIX = $8144; + {$EXTERNALSYM GL_PIXEL_TILE_GRID_DEPTH_SGIX} + GL_PIXEL_TILE_CACHE_SIZE_SGIX = $8145; + {$EXTERNALSYM GL_PIXEL_TILE_CACHE_SIZE_SGIX} + + // GL_SGIS_texture_select + GL_DUAL_ALPHA4_SGIS = $8110; + {$EXTERNALSYM GL_DUAL_ALPHA4_SGIS} + GL_DUAL_ALPHA8_SGIS = $8111; + {$EXTERNALSYM GL_DUAL_ALPHA8_SGIS} + GL_DUAL_ALPHA12_SGIS = $8112; + {$EXTERNALSYM GL_DUAL_ALPHA12_SGIS} + GL_DUAL_ALPHA16_SGIS = $8113; + {$EXTERNALSYM GL_DUAL_ALPHA16_SGIS} + GL_DUAL_LUMINANCE4_SGIS = $8114; + {$EXTERNALSYM GL_DUAL_LUMINANCE4_SGIS} + GL_DUAL_LUMINANCE8_SGIS = $8115; + {$EXTERNALSYM GL_DUAL_LUMINANCE8_SGIS} + GL_DUAL_LUMINANCE12_SGIS = $8116; + {$EXTERNALSYM GL_DUAL_LUMINANCE12_SGIS} + GL_DUAL_LUMINANCE16_SGIS = $8117; + {$EXTERNALSYM GL_DUAL_LUMINANCE16_SGIS} + GL_DUAL_INTENSITY4_SGIS = $8118; + {$EXTERNALSYM GL_DUAL_INTENSITY4_SGIS} + GL_DUAL_INTENSITY8_SGIS = $8119; + {$EXTERNALSYM GL_DUAL_INTENSITY8_SGIS} + GL_DUAL_INTENSITY12_SGIS = $811A; + {$EXTERNALSYM GL_DUAL_INTENSITY12_SGIS} + GL_DUAL_INTENSITY16_SGIS = $811B; + {$EXTERNALSYM GL_DUAL_INTENSITY16_SGIS} + GL_DUAL_LUMINANCE_ALPHA4_SGIS = $811C; + {$EXTERNALSYM GL_DUAL_LUMINANCE_ALPHA4_SGIS} + GL_DUAL_LUMINANCE_ALPHA8_SGIS = $811D; + {$EXTERNALSYM GL_DUAL_LUMINANCE_ALPHA8_SGIS} + GL_QUAD_ALPHA4_SGIS = $811E; + {$EXTERNALSYM GL_QUAD_ALPHA4_SGIS} + GL_QUAD_ALPHA8_SGIS = $811F; + {$EXTERNALSYM GL_QUAD_ALPHA8_SGIS} + GL_QUAD_LUMINANCE4_SGIS = $8120; + {$EXTERNALSYM GL_QUAD_LUMINANCE4_SGIS} + GL_QUAD_LUMINANCE8_SGIS = $8121; + {$EXTERNALSYM GL_QUAD_LUMINANCE8_SGIS} + GL_QUAD_INTENSITY4_SGIS = $8122; + {$EXTERNALSYM GL_QUAD_INTENSITY4_SGIS} + GL_QUAD_INTENSITY8_SGIS = $8123; + {$EXTERNALSYM GL_QUAD_INTENSITY8_SGIS} + GL_DUAL_TEXTURE_SELECT_SGIS = $8124; + {$EXTERNALSYM GL_DUAL_TEXTURE_SELECT_SGIS} + GL_QUAD_TEXTURE_SELECT_SGIS = $8125; + {$EXTERNALSYM GL_QUAD_TEXTURE_SELECT_SGIS} + + // GL_SGIX_sprite + GL_SPRITE_SGIX = $8148; + {$EXTERNALSYM GL_SPRITE_SGIX} + GL_SPRITE_MODE_SGIX = $8149; + {$EXTERNALSYM GL_SPRITE_MODE_SGIX} + GL_SPRITE_AXIS_SGIX = $814A; + {$EXTERNALSYM GL_SPRITE_AXIS_SGIX} + GL_SPRITE_TRANSLATION_SGIX = $814B; + {$EXTERNALSYM GL_SPRITE_TRANSLATION_SGIX} + GL_SPRITE_AXIAL_SGIX = $814C; + {$EXTERNALSYM GL_SPRITE_AXIAL_SGIX} + GL_SPRITE_OBJECT_ALIGNED_SGIX = $814D; + {$EXTERNALSYM GL_SPRITE_OBJECT_ALIGNED_SGIX} + GL_SPRITE_EYE_ALIGNED_SGIX = $814E; + {$EXTERNALSYM GL_SPRITE_EYE_ALIGNED_SGIX} + + // GL_SGIX_texture_multi_buffer + GL_TEXTURE_MULTI_BUFFER_HINT_SGIX = $812E; + {$EXTERNALSYM GL_TEXTURE_MULTI_BUFFER_HINT_SGIX} + + // GL_SGIS_point_parameters + GL_POINT_SIZE_MIN_SGIS = $8126; + {$EXTERNALSYM GL_POINT_SIZE_MIN_SGIS} + GL_POINT_SIZE_MAX_SGIS = $8127; + {$EXTERNALSYM GL_POINT_SIZE_MAX_SGIS} + GL_POINT_FADE_THRESHOLD_SIZE_SGIS = $8128; + {$EXTERNALSYM GL_POINT_FADE_THRESHOLD_SIZE_SGIS} + GL_DISTANCE_ATTENUATION_SGIS = $8129; + {$EXTERNALSYM GL_DISTANCE_ATTENUATION_SGIS} + + // GL_SGIX_instruments + GL_INSTRUMENT_BUFFER_POINTER_SGIX = $8180; + {$EXTERNALSYM GL_INSTRUMENT_BUFFER_POINTER_SGIX} + GL_INSTRUMENT_MEASUREMENTS_SGIX = $8181; + {$EXTERNALSYM GL_INSTRUMENT_MEASUREMENTS_SGIX} + + // GL_SGIX_texture_scale_bias + GL_POST_TEXTURE_FILTER_BIAS_SGIX = $8179; + {$EXTERNALSYM GL_POST_TEXTURE_FILTER_BIAS_SGIX} + GL_POST_TEXTURE_FILTER_SCALE_SGIX = $817A; + {$EXTERNALSYM GL_POST_TEXTURE_FILTER_SCALE_SGIX} + GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX = $817B; + {$EXTERNALSYM GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX} + GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX = $817C; + {$EXTERNALSYM GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX} + + // GL_SGIX_framezoom + GL_FRAMEZOOM_SGIX = $818B; + {$EXTERNALSYM GL_FRAMEZOOM_SGIX} + GL_FRAMEZOOM_FACTOR_SGIX = $818C; + {$EXTERNALSYM GL_FRAMEZOOM_FACTOR_SGIX} + GL_MAX_FRAMEZOOM_FACTOR_SGIX = $818D; + {$EXTERNALSYM GL_MAX_FRAMEZOOM_FACTOR_SGIX} + + // GL_FfdMaskSGIX + GL_TEXTURE_DEFORMATION_BIT_SGIX = $00000001; + {$EXTERNALSYM GL_TEXTURE_DEFORMATION_BIT_SGIX} + GL_GEOMETRY_DEFORMATION_BIT_SGIX = $00000002; + {$EXTERNALSYM GL_GEOMETRY_DEFORMATION_BIT_SGIX} + + // GL_SGIX_polynomial_ffd + GL_GEOMETRY_DEFORMATION_SGIX = $8194; + {$EXTERNALSYM GL_GEOMETRY_DEFORMATION_SGIX} + GL_TEXTURE_DEFORMATION_SGIX = $8195; + {$EXTERNALSYM GL_TEXTURE_DEFORMATION_SGIX} + GL_DEFORMATIONS_MASK_SGIX = $8196; + {$EXTERNALSYM GL_DEFORMATIONS_MASK_SGIX} + GL_MAX_DEFORMATION_ORDER_SGIX = $8197; + {$EXTERNALSYM GL_MAX_DEFORMATION_ORDER_SGIX} + + // GL_SGIX_reference_plane + GL_REFERENCE_PLANE_SGIX = $817D; + {$EXTERNALSYM GL_REFERENCE_PLANE_SGIX} + GL_REFERENCE_PLANE_EQUATION_SGIX = $817E; + {$EXTERNALSYM GL_REFERENCE_PLANE_EQUATION_SGIX} + + // GL_SGIX_depth_texture + GL_DEPTH_COMPONENT16_SGIX = $81A5; + {$EXTERNALSYM GL_DEPTH_COMPONENT16_SGIX} + GL_DEPTH_COMPONENT24_SGIX = $81A6; + {$EXTERNALSYM GL_DEPTH_COMPONENT24_SGIX} + GL_DEPTH_COMPONENT32_SGIX = $81A7; + {$EXTERNALSYM GL_DEPTH_COMPONENT32_SGIX} + + // GL_SGIS_fog_function + GL_FOG_FUNC_SGIS = $812A; + {$EXTERNALSYM GL_FOG_FUNC_SGIS} + GL_FOG_FUNC_POINTS_SGIS = $812B; + {$EXTERNALSYM GL_FOG_FUNC_POINTS_SGIS} + GL_MAX_FOG_FUNC_POINTS_SGIS = $812C; + {$EXTERNALSYM GL_MAX_FOG_FUNC_POINTS_SGIS} + + // GL_SGIX_fog_offset + GL_FOG_OFFSET_SGIX = $8198; + {$EXTERNALSYM GL_FOG_OFFSET_SGIX} + GL_FOG_OFFSET_VALUE_SGIX = $8199; + {$EXTERNALSYM GL_FOG_OFFSET_VALUE_SGIX} + + // GL_HP_image_transform + GL_IMAGE_SCALE_X_HP = $8155; + {$EXTERNALSYM GL_IMAGE_SCALE_X_HP} + GL_IMAGE_SCALE_Y_HP = $8156; + {$EXTERNALSYM GL_IMAGE_SCALE_Y_HP} + GL_IMAGE_TRANSLATE_X_HP = $8157; + {$EXTERNALSYM GL_IMAGE_TRANSLATE_X_HP} + GL_IMAGE_TRANSLATE_Y_HP = $8158; + {$EXTERNALSYM GL_IMAGE_TRANSLATE_Y_HP} + GL_IMAGE_ROTATE_ANGLE_HP = $8159; + {$EXTERNALSYM GL_IMAGE_ROTATE_ANGLE_HP} + GL_IMAGE_ROTATE_ORIGIN_X_HP = $815A; + {$EXTERNALSYM GL_IMAGE_ROTATE_ORIGIN_X_HP} + GL_IMAGE_ROTATE_ORIGIN_Y_HP = $815B; + {$EXTERNALSYM GL_IMAGE_ROTATE_ORIGIN_Y_HP} + GL_IMAGE_MAG_FILTER_HP = $815C; + {$EXTERNALSYM GL_IMAGE_MAG_FILTER_HP} + GL_IMAGE_MIN_FILTER_HP = $815D; + {$EXTERNALSYM GL_IMAGE_MIN_FILTER_HP} + GL_IMAGE_CUBIC_WEIGHT_HP = $815E; + {$EXTERNALSYM GL_IMAGE_CUBIC_WEIGHT_HP} + GL_CUBIC_HP = $815F; + {$EXTERNALSYM GL_CUBIC_HP} + GL_AVERAGE_HP = $8160; + {$EXTERNALSYM GL_AVERAGE_HP} + GL_IMAGE_TRANSFORM_2D_HP = $8161; + {$EXTERNALSYM GL_IMAGE_TRANSFORM_2D_HP} + GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP = $8162; + {$EXTERNALSYM GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP} + GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP = $8163; + {$EXTERNALSYM GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP} + + // GL_HP_convolution_border_modes + GL_IGNORE_BORDER_HP = $8150; + {$EXTERNALSYM GL_IGNORE_BORDER_HP} + GL_CONSTANT_BORDER_HP = $8151; + {$EXTERNALSYM GL_CONSTANT_BORDER_HP} + GL_REPLICATE_BORDER_HP = $8153; + {$EXTERNALSYM GL_REPLICATE_BORDER_HP} + GL_CONVOLUTION_BORDER_COLOR_HP = $8154; + {$EXTERNALSYM GL_CONVOLUTION_BORDER_COLOR_HP} + + // GL_SGIX_texture_add_env + GL_TEXTURE_ENV_BIAS_SGIX = $80BE; + {$EXTERNALSYM GL_TEXTURE_ENV_BIAS_SGIX} + + // GL_PGI_vertex_hints + GL_VERTEX_DATA_HINT_PGI = $1A22A; + {$EXTERNALSYM GL_VERTEX_DATA_HINT_PGI} + GL_VERTEX_CONSISTENT_HINT_PGI = $1A22B; + {$EXTERNALSYM GL_VERTEX_CONSISTENT_HINT_PGI} + GL_MATERIAL_SIDE_HINT_PGI = $1A22C; + {$EXTERNALSYM GL_MATERIAL_SIDE_HINT_PGI} + GL_MAX_VERTEX_HINT_PGI = $1A22D; + {$EXTERNALSYM GL_MAX_VERTEX_HINT_PGI} + GL_COLOR3_BIT_PGI = $00010000; + {$EXTERNALSYM GL_COLOR3_BIT_PGI} + GL_COLOR4_BIT_PGI = $00020000; + {$EXTERNALSYM GL_COLOR4_BIT_PGI} + GL_EDGEFLAG_BIT_PGI = $00040000; + {$EXTERNALSYM GL_EDGEFLAG_BIT_PGI} + GL_INDEX_BIT_PGI = $00080000; + {$EXTERNALSYM GL_INDEX_BIT_PGI} + GL_MAT_AMBIENT_BIT_PGI = $00100000; + {$EXTERNALSYM GL_MAT_AMBIENT_BIT_PGI} + GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI = $00200000; + {$EXTERNALSYM GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI} + GL_MAT_DIFFUSE_BIT_PGI = $00400000; + {$EXTERNALSYM GL_MAT_DIFFUSE_BIT_PGI} + GL_MAT_EMISSION_BIT_PGI = $00800000; + {$EXTERNALSYM GL_MAT_EMISSION_BIT_PGI} + GL_MAT_COLOR_INDEXES_BIT_PGI = $01000000; + {$EXTERNALSYM GL_MAT_COLOR_INDEXES_BIT_PGI} + GL_MAT_SHININESS_BIT_PGI = $02000000; + {$EXTERNALSYM GL_MAT_SHININESS_BIT_PGI} + GL_MAT_SPECULAR_BIT_PGI = $04000000; + {$EXTERNALSYM GL_MAT_SPECULAR_BIT_PGI} + GL_NORMAL_BIT_PGI = $08000000; + {$EXTERNALSYM GL_NORMAL_BIT_PGI} + GL_TEXCOORD1_BIT_PGI = $10000000; + {$EXTERNALSYM GL_TEXCOORD1_BIT_PGI} + GL_TEXCOORD2_BIT_PGI = $20000000; + {$EXTERNALSYM GL_TEXCOORD2_BIT_PGI} + GL_TEXCOORD3_BIT_PGI = $40000000; + {$EXTERNALSYM GL_TEXCOORD3_BIT_PGI} + GL_TEXCOORD4_BIT_PGI = $80000000; + {$EXTERNALSYM GL_TEXCOORD4_BIT_PGI} + GL_VERTEX23_BIT_PGI = $00000004; + {$EXTERNALSYM GL_VERTEX23_BIT_PGI} + GL_VERTEX4_BIT_PGI = $00000008; + {$EXTERNALSYM GL_VERTEX4_BIT_PGI} + + // GL_PGI_misc_hints + GL_PREFER_DOUBLEBUFFER_HINT_PGI = $1A1F8; + {$EXTERNALSYM GL_PREFER_DOUBLEBUFFER_HINT_PGI} + GL_CONSERVE_MEMORY_HINT_PGI = $1A1FD; + {$EXTERNALSYM GL_CONSERVE_MEMORY_HINT_PGI} + GL_RECLAIM_MEMORY_HINT_PGI = $1A1FE; + {$EXTERNALSYM GL_RECLAIM_MEMORY_HINT_PGI} + GL_NATIVE_GRAPHICS_HANDLE_PGI = $1A202; + {$EXTERNALSYM GL_NATIVE_GRAPHICS_HANDLE_PGI} + GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI = $1A203; + {$EXTERNALSYM GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI} + GL_NATIVE_GRAPHICS_END_HINT_PGI = $1A204; + {$EXTERNALSYM GL_NATIVE_GRAPHICS_END_HINT_PGI} + GL_ALWAYS_FAST_HINT_PGI = $1A20C; + {$EXTERNALSYM GL_ALWAYS_FAST_HINT_PGI} + GL_ALWAYS_SOFT_HINT_PGI = $1A20D; + {$EXTERNALSYM GL_ALWAYS_SOFT_HINT_PGI} + GL_ALLOW_DRAW_OBJ_HINT_PGI = $1A20E; + {$EXTERNALSYM GL_ALLOW_DRAW_OBJ_HINT_PGI} + GL_ALLOW_DRAW_WIN_HINT_PGI = $1A20F; + {$EXTERNALSYM GL_ALLOW_DRAW_WIN_HINT_PGI} + GL_ALLOW_DRAW_FRG_HINT_PGI = $1A210; + {$EXTERNALSYM GL_ALLOW_DRAW_FRG_HINT_PGI} + GL_ALLOW_DRAW_MEM_HINT_PGI = $1A211; + {$EXTERNALSYM GL_ALLOW_DRAW_MEM_HINT_PGI} + GL_STRICT_DEPTHFUNC_HINT_PGI = $1A216; + {$EXTERNALSYM GL_STRICT_DEPTHFUNC_HINT_PGI} + GL_STRICT_LIGHTING_HINT_PGI = $1A217; + {$EXTERNALSYM GL_STRICT_LIGHTING_HINT_PGI} + GL_STRICT_SCISSOR_HINT_PGI = $1A218; + {$EXTERNALSYM GL_STRICT_SCISSOR_HINT_PGI} + GL_FULL_STIPPLE_HINT_PGI = $1A219; + {$EXTERNALSYM GL_FULL_STIPPLE_HINT_PGI} + GL_CLIP_NEAR_HINT_PGI = $1A220; + {$EXTERNALSYM GL_CLIP_NEAR_HINT_PGI} + GL_CLIP_FAR_HINT_PGI = $1A221; + {$EXTERNALSYM GL_CLIP_FAR_HINT_PGI} + GL_WIDE_LINE_HINT_PGI = $1A222; + {$EXTERNALSYM GL_WIDE_LINE_HINT_PGI} + GL_BACK_NORMALS_HINT_PGI = $1A223; + {$EXTERNALSYM GL_BACK_NORMALS_HINT_PGI} + + // GL_EXT_paletted_texture + GL_TEXTURE_INDEX_SIZE_EXT = $80ED; + {$EXTERNALSYM GL_TEXTURE_INDEX_SIZE_EXT} + + // GL_SGIX_list_priority + GL_LIST_PRIORITY_SGIX = $8182; + {$EXTERNALSYM GL_LIST_PRIORITY_SGIX} + + // GL_SGIX_ir_instrument1 + GL_IR_INSTRUMENT1_SGIX = $817F; + {$EXTERNALSYM GL_IR_INSTRUMENT1_SGIX} + + // GL_SGIX_calligraphic_fragment + GL_CALLIGRAPHIC_FRAGMENT_SGIX = $8183; + {$EXTERNALSYM GL_CALLIGRAPHIC_FRAGMENT_SGIX} + + // GL_SGIX_texture_lod_bias + GL_TEXTURE_LOD_BIAS_S_SGIX = $818E; + {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_S_SGIX} + GL_TEXTURE_LOD_BIAS_T_SGIX = $818F; + {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_T_SGIX} + GL_TEXTURE_LOD_BIAS_R_SGIX = $8190; + {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_R_SGIX} + + // GL_SGIX_shadow_ambient + GL_SHADOW_AMBIENT_SGIX = $80BF; + {$EXTERNALSYM GL_SHADOW_AMBIENT_SGIX} + + // GL_SGIX_ycrcb + GL_YCRCB_422_SGIX = $81BB; + {$EXTERNALSYM GL_YCRCB_422_SGIX} + GL_YCRCB_444_SGIX = $81BC; + {$EXTERNALSYM GL_YCRCB_444_SGIX} + + // GL_SGIX_fragment_lighting + GL_FRAGMENT_LIGHTING_SGIX = $8400; + {$EXTERNALSYM GL_FRAGMENT_LIGHTING_SGIX} + GL_FRAGMENT_COLOR_MATERIAL_SGIX = $8401; + {$EXTERNALSYM GL_FRAGMENT_COLOR_MATERIAL_SGIX} + GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX = $8402; + {$EXTERNALSYM GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX} + GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX = $8403; + {$EXTERNALSYM GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX} + GL_MAX_FRAGMENT_LIGHTS_SGIX = $8404; + {$EXTERNALSYM GL_MAX_FRAGMENT_LIGHTS_SGIX} + GL_MAX_ACTIVE_LIGHTS_SGIX = $8405; + {$EXTERNALSYM GL_MAX_ACTIVE_LIGHTS_SGIX} + GL_CURRENT_RASTER_NORMAL_SGIX = $8406; + {$EXTERNALSYM GL_CURRENT_RASTER_NORMAL_SGIX} + GL_LIGHT_ENV_MODE_SGIX = $8407; + {$EXTERNALSYM GL_LIGHT_ENV_MODE_SGIX} + GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX = $8408; + {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX} + GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX = $8409; + {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX} + GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX = $840A; + {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX} + GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX = $840B; + {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX} + GL_FRAGMENT_LIGHT0_SGIX = $840C; + {$EXTERNALSYM GL_FRAGMENT_LIGHT0_SGIX} + GL_FRAGMENT_LIGHT1_SGIX = $840D; + {$EXTERNALSYM GL_FRAGMENT_LIGHT1_SGIX} + GL_FRAGMENT_LIGHT2_SGIX = $840E; + {$EXTERNALSYM GL_FRAGMENT_LIGHT2_SGIX} + GL_FRAGMENT_LIGHT3_SGIX = $840F; + {$EXTERNALSYM GL_FRAGMENT_LIGHT3_SGIX} + GL_FRAGMENT_LIGHT4_SGIX = $8410; + {$EXTERNALSYM GL_FRAGMENT_LIGHT4_SGIX} + GL_FRAGMENT_LIGHT5_SGIX = $8411; + {$EXTERNALSYM GL_FRAGMENT_LIGHT5_SGIX} + GL_FRAGMENT_LIGHT6_SGIX = $8412; + {$EXTERNALSYM GL_FRAGMENT_LIGHT6_SGIX} + GL_FRAGMENT_LIGHT7_SGIX = $8413; + {$EXTERNALSYM GL_FRAGMENT_LIGHT7_SGIX} + + // GL_IBM_rasterpos_clip + GL_RASTER_POSITION_UNCLIPPED_IBM = $19262; + {$EXTERNALSYM GL_RASTER_POSITION_UNCLIPPED_IBM} + + // GL_HP_texture_lighting + GL_TEXTURE_LIGHTING_MODE_HP = $8167; + {$EXTERNALSYM GL_TEXTURE_LIGHTING_MODE_HP} + GL_TEXTURE_POST_SPECULAR_HP = $8168; + {$EXTERNALSYM GL_TEXTURE_POST_SPECULAR_HP} + GL_TEXTURE_PRE_SPECULAR_HP = $8169; + {$EXTERNALSYM GL_TEXTURE_PRE_SPECULAR_HP} + + // GL_EXT_draw_range_elements + GL_MAX_ELEMENTS_VERTICES_EXT = $80E8; + {$EXTERNALSYM GL_MAX_ELEMENTS_VERTICES_EXT} + GL_MAX_ELEMENTS_INDICES_EXT = $80E9; + {$EXTERNALSYM GL_MAX_ELEMENTS_INDICES_EXT} + + // GL_WIN_phong_shading + GL_PHONG_WIN = $80EA; + {$EXTERNALSYM GL_PHONG_WIN} + GL_PHONG_HINT_WIN = $80EB; + {$EXTERNALSYM GL_PHONG_HINT_WIN} + + // GL_WIN_specular_fog + GL_FOG_SPECULAR_TEXTURE_WIN = $80EC; + {$EXTERNALSYM GL_FOG_SPECULAR_TEXTURE_WIN} + + // GL_EXT_light_texture + GL_FRAGMENT_MATERIAL_EXT = $8349; + {$EXTERNALSYM GL_FRAGMENT_MATERIAL_EXT} + GL_FRAGMENT_NORMAL_EXT = $834A; + {$EXTERNALSYM GL_FRAGMENT_NORMAL_EXT} + GL_FRAGMENT_COLOR_EXT = $834C; + {$EXTERNALSYM GL_FRAGMENT_COLOR_EXT} + GL_ATTENUATION_EXT = $834D; + {$EXTERNALSYM GL_ATTENUATION_EXT} + GL_SHADOW_ATTENUATION_EXT = $834E; + {$EXTERNALSYM GL_SHADOW_ATTENUATION_EXT} + GL_TEXTURE_APPLICATION_MODE_EXT = $834F; + {$EXTERNALSYM GL_TEXTURE_APPLICATION_MODE_EXT} + GL_TEXTURE_LIGHT_EXT = $8350; + {$EXTERNALSYM GL_TEXTURE_LIGHT_EXT} + GL_TEXTURE_MATERIAL_FACE_EXT = $8351; + {$EXTERNALSYM GL_TEXTURE_MATERIAL_FACE_EXT} + GL_TEXTURE_MATERIAL_PARAMETER_EXT = $8352; + {$EXTERNALSYM GL_TEXTURE_MATERIAL_PARAMETER_EXT} + + // GL_SGIX_blend_alpha_minmax + GL_ALPHA_MIN_SGIX = $8320; + {$EXTERNALSYM GL_ALPHA_MIN_SGIX} + GL_ALPHA_MAX_SGIX = $8321; + {$EXTERNALSYM GL_ALPHA_MAX_SGIX} + + // GL_SGIX_async + GL_ASYNC_MARKER_SGIX = $8329; + {$EXTERNALSYM GL_ASYNC_MARKER_SGIX} + + // GL_SGIX_async_pixel + GL_ASYNC_TEX_IMAGE_SGIX = $835C; + {$EXTERNALSYM GL_ASYNC_TEX_IMAGE_SGIX} + GL_ASYNC_DRAW_PIXELS_SGIX = $835D; + {$EXTERNALSYM GL_ASYNC_DRAW_PIXELS_SGIX} + GL_ASYNC_READ_PIXELS_SGIX = $835E; + {$EXTERNALSYM GL_ASYNC_READ_PIXELS_SGIX} + GL_MAX_ASYNC_TEX_IMAGE_SGIX = $835F; + {$EXTERNALSYM GL_MAX_ASYNC_TEX_IMAGE_SGIX} + GL_MAX_ASYNC_DRAW_PIXELS_SGIX = $8360; + {$EXTERNALSYM GL_MAX_ASYNC_DRAW_PIXELS_SGIX} + GL_MAX_ASYNC_READ_PIXELS_SGIX = $8361; + {$EXTERNALSYM GL_MAX_ASYNC_READ_PIXELS_SGIX} + + // GL_SGIX_async_histogram + GL_ASYNC_HISTOGRAM_SGIX = $832C; + {$EXTERNALSYM GL_ASYNC_HISTOGRAM_SGIX} + GL_MAX_ASYNC_HISTOGRAM_SGIX = $832D; + {$EXTERNALSYM GL_MAX_ASYNC_HISTOGRAM_SGIX} + + // GL_INTEL_parallel_arrays + GL_PARALLEL_ARRAYS_INTEL = $83F4; + {$EXTERNALSYM GL_PARALLEL_ARRAYS_INTEL} + GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL = $83F5; + {$EXTERNALSYM GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL} + GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL = $83F6; + {$EXTERNALSYM GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL} + GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL = $83F7; + {$EXTERNALSYM GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL} + GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL = $83F8; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL} + + // GL_HP_occlusion_test + GL_OCCLUSION_TEST_HP = $8165; + {$EXTERNALSYM GL_OCCLUSION_TEST_HP} + GL_OCCLUSION_TEST_RESULT_HP = $8166; + {$EXTERNALSYM GL_OCCLUSION_TEST_RESULT_HP} + + // GL_EXT_pixel_transform + GL_PIXEL_TRANSFORM_2D_EXT = $8330; + {$EXTERNALSYM GL_PIXEL_TRANSFORM_2D_EXT} + GL_PIXEL_MAG_FILTER_EXT = $8331; + {$EXTERNALSYM GL_PIXEL_MAG_FILTER_EXT} + GL_PIXEL_MIN_FILTER_EXT = $8332; + {$EXTERNALSYM GL_PIXEL_MIN_FILTER_EXT} + GL_PIXEL_CUBIC_WEIGHT_EXT = $8333; + {$EXTERNALSYM GL_PIXEL_CUBIC_WEIGHT_EXT} + GL_CUBIC_EXT = $8334; + {$EXTERNALSYM GL_CUBIC_EXT} + GL_AVERAGE_EXT = $8335; + {$EXTERNALSYM GL_AVERAGE_EXT} + GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT = $8336; + {$EXTERNALSYM GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT} + GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT = $8337; + {$EXTERNALSYM GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT} + GL_PIXEL_TRANSFORM_2D_MATRIX_EXT = $8338; + {$EXTERNALSYM GL_PIXEL_TRANSFORM_2D_MATRIX_EXT} + + // GL_EXT_separate_specular_color + GL_LIGHT_MODEL_COLOR_CONTROL_EXT = $81F8; + {$EXTERNALSYM GL_LIGHT_MODEL_COLOR_CONTROL_EXT} + GL_SINGLE_COLOR_EXT = $81F9; + {$EXTERNALSYM GL_SINGLE_COLOR_EXT} + GL_SEPARATE_SPECULAR_COLOR_EXT = $81FA; + {$EXTERNALSYM GL_SEPARATE_SPECULAR_COLOR_EXT} + + // GL_EXT_secondary_color + GL_COLOR_SUM_EXT = $8458; + {$EXTERNALSYM GL_COLOR_SUM_EXT} + GL_CURRENT_SECONDARY_COLOR_EXT = $8459; + {$EXTERNALSYM GL_CURRENT_SECONDARY_COLOR_EXT} + GL_SECONDARY_COLOR_ARRAY_SIZE_EXT = $845A; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_SIZE_EXT} + GL_SECONDARY_COLOR_ARRAY_TYPE_EXT = $845B; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_TYPE_EXT} + GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT = $845C; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT} + GL_SECONDARY_COLOR_ARRAY_POINTER_EXT = $845D; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_POINTER_EXT} + GL_SECONDARY_COLOR_ARRAY_EXT = $845E; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_EXT} + + // GL_EXT_texture_perturb_normal + GL_PERTURB_EXT = $85AE; + {$EXTERNALSYM GL_PERTURB_EXT} + GL_TEXTURE_NORMAL_EXT = $85AF; + {$EXTERNALSYM GL_TEXTURE_NORMAL_EXT} + + // GL_EXT_fog_coord + GL_FOG_COORDINATE_SOURCE_EXT = $8450; + {$EXTERNALSYM GL_FOG_COORDINATE_SOURCE_EXT} + GL_FOG_COORDINATE_EXT = $8451; + {$EXTERNALSYM GL_FOG_COORDINATE_EXT} + GL_FRAGMENT_DEPTH_EXT = $8452; + {$EXTERNALSYM GL_FRAGMENT_DEPTH_EXT} + GL_CURRENT_FOG_COORDINATE_EXT = $8453; + {$EXTERNALSYM GL_CURRENT_FOG_COORDINATE_EXT} + GL_FOG_COORDINATE_ARRAY_TYPE_EXT = $8454; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_TYPE_EXT} + GL_FOG_COORDINATE_ARRAY_STRIDE_EXT = $8455; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_STRIDE_EXT} + GL_FOG_COORDINATE_ARRAY_POINTER_EXT = $8456; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_POINTER_EXT} + GL_FOG_COORDINATE_ARRAY_EXT = $8457; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_EXT} + + // GL_REND_screen_coordinates + GL_SCREEN_COORDINATES_REND = $8490; + {$EXTERNALSYM GL_SCREEN_COORDINATES_REND} + GL_INVERTED_SCREEN_W_REND = $8491; + {$EXTERNALSYM GL_INVERTED_SCREEN_W_REND} + + // GL_EXT_coordinate_frame + GL_TANGENT_ARRAY_EXT = $8439; + {$EXTERNALSYM GL_TANGENT_ARRAY_EXT} + GL_BINORMAL_ARRAY_EXT = $843A; + {$EXTERNALSYM GL_BINORMAL_ARRAY_EXT} + GL_CURRENT_TANGENT_EXT = $843B; + {$EXTERNALSYM GL_CURRENT_TANGENT_EXT} + GL_CURRENT_BINORMAL_EXT = $843C; + {$EXTERNALSYM GL_CURRENT_BINORMAL_EXT} + GL_TANGENT_ARRAY_TYPE_EXT = $843E; + {$EXTERNALSYM GL_TANGENT_ARRAY_TYPE_EXT} + GL_TANGENT_ARRAY_STRIDE_EXT = $843F; + {$EXTERNALSYM GL_TANGENT_ARRAY_STRIDE_EXT} + GL_BINORMAL_ARRAY_TYPE_EXT = $8440; + {$EXTERNALSYM GL_BINORMAL_ARRAY_TYPE_EXT} + GL_BINORMAL_ARRAY_STRIDE_EXT = $8441; + {$EXTERNALSYM GL_BINORMAL_ARRAY_STRIDE_EXT} + GL_TANGENT_ARRAY_POINTER_EXT = $8442; + {$EXTERNALSYM GL_TANGENT_ARRAY_POINTER_EXT} + GL_BINORMAL_ARRAY_POINTER_EXT = $8443; + {$EXTERNALSYM GL_BINORMAL_ARRAY_POINTER_EXT} + GL_MAP1_TANGENT_EXT = $8444; + {$EXTERNALSYM GL_MAP1_TANGENT_EXT} + GL_MAP2_TANGENT_EXT = $8445; + {$EXTERNALSYM GL_MAP2_TANGENT_EXT} + GL_MAP1_BINORMAL_EXT = $8446; + {$EXTERNALSYM GL_MAP1_BINORMAL_EXT} + GL_MAP2_BINORMAL_EXT = $8447; + {$EXTERNALSYM GL_MAP2_BINORMAL_EXT} + + // GL_EXT_texture_env_combine + GL_SOURCE3_RGB_EXT = $8583; + {$EXTERNALSYM GL_SOURCE3_RGB_EXT} + GL_SOURCE4_RGB_EXT = $8584; + {$EXTERNALSYM GL_SOURCE4_RGB_EXT} + GL_SOURCE5_RGB_EXT = $8585; + {$EXTERNALSYM GL_SOURCE5_RGB_EXT} + GL_SOURCE6_RGB_EXT = $8586; + {$EXTERNALSYM GL_SOURCE6_RGB_EXT} + GL_SOURCE7_RGB_EXT = $8587; + {$EXTERNALSYM GL_SOURCE7_RGB_EXT} + GL_SOURCE3_ALPHA_EXT = $858B; + {$EXTERNALSYM GL_SOURCE3_ALPHA_EXT} + GL_SOURCE4_ALPHA_EXT = $858C; + {$EXTERNALSYM GL_SOURCE4_ALPHA_EXT} + GL_SOURCE5_ALPHA_EXT = $858D; + {$EXTERNALSYM GL_SOURCE5_ALPHA_EXT} + GL_SOURCE6_ALPHA_EXT = $858E; + {$EXTERNALSYM GL_SOURCE6_ALPHA_EXT} + GL_SOURCE7_ALPHA_EXT = $858F; + {$EXTERNALSYM GL_SOURCE7_ALPHA_EXT} + GL_OPERAND3_RGB_EXT = $8593; + {$EXTERNALSYM GL_OPERAND3_RGB_EXT} + GL_OPERAND4_RGB_EXT = $8594; + {$EXTERNALSYM GL_OPERAND4_RGB_EXT} + GL_OPERAND5_RGB_EXT = $8595; + {$EXTERNALSYM GL_OPERAND5_RGB_EXT} + GL_OPERAND6_RGB_EXT = $8596; + {$EXTERNALSYM GL_OPERAND6_RGB_EXT} + GL_OPERAND7_RGB_EXT = $8597; + {$EXTERNALSYM GL_OPERAND7_RGB_EXT} + GL_OPERAND3_ALPHA_EXT = $859B; + {$EXTERNALSYM GL_OPERAND3_ALPHA_EXT} + GL_OPERAND4_ALPHA_EXT = $859C; + {$EXTERNALSYM GL_OPERAND4_ALPHA_EXT} + GL_OPERAND5_ALPHA_EXT = $859D; + {$EXTERNALSYM GL_OPERAND5_ALPHA_EXT} + GL_OPERAND6_ALPHA_EXT = $859E; + {$EXTERNALSYM GL_OPERAND6_ALPHA_EXT} + GL_OPERAND7_ALPHA_EXT = $859F; + {$EXTERNALSYM GL_OPERAND7_ALPHA_EXT} + + // GL_APPLE_specular_vector + GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE = $85B0; + {$EXTERNALSYM GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE} + + // GL_APPLE_transform_hint + GL_TRANSFORM_HINT_APPLE = $85B1; + {$EXTERNALSYM GL_TRANSFORM_HINT_APPLE} + + // GL_SGIX_fog_scale + GL_FOG_SCALE_SGIX = $81FC; + {$EXTERNALSYM GL_FOG_SCALE_SGIX} + GL_FOG_SCALE_VALUE_SGIX = $81FD; + {$EXTERNALSYM GL_FOG_SCALE_VALUE_SGIX} + + // GL_SUNX_constant_data + GL_UNPACK_CONSTANT_DATA_SUNX = $81D5; + {$EXTERNALSYM GL_UNPACK_CONSTANT_DATA_SUNX} + GL_TEXTURE_CONSTANT_DATA_SUNX = $81D6; + {$EXTERNALSYM GL_TEXTURE_CONSTANT_DATA_SUNX} + + // GL_SUN_global_alpha + GL_GLOBAL_ALPHA_SUN = $81D9; + {$EXTERNALSYM GL_GLOBAL_ALPHA_SUN} + GL_GLOBAL_ALPHA_FACTOR_SUN = $81DA; + {$EXTERNALSYM GL_GLOBAL_ALPHA_FACTOR_SUN} + + // GL_SUN_triangle_list + GL_RESTART_SUN = $01; + {$EXTERNALSYM GL_RESTART_SUN} + GL_REPLACE_MIDDLE_SUN = $02; + {$EXTERNALSYM GL_REPLACE_MIDDLE_SUN} + GL_REPLACE_OLDEST_SUN = $03; + {$EXTERNALSYM GL_REPLACE_OLDEST_SUN} + GL_TRIANGLE_LIST_SUN = $81D7; + {$EXTERNALSYM GL_TRIANGLE_LIST_SUN} + GL_REPLACEMENT_CODE_SUN = $81D8; + {$EXTERNALSYM GL_REPLACEMENT_CODE_SUN} + GL_REPLACEMENT_CODE_ARRAY_SUN = $85C0; + {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_SUN} + GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN = $85C1; + {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN} + GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN = $85C2; + {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN} + GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN = $85C3; + {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN} + GL_R1UI_V3F_SUN = $85C4; + {$EXTERNALSYM GL_R1UI_V3F_SUN} + GL_R1UI_C4UB_V3F_SUN = $85C5; + {$EXTERNALSYM GL_R1UI_C4UB_V3F_SUN} + GL_R1UI_C3F_V3F_SUN = $85C6; + {$EXTERNALSYM GL_R1UI_C3F_V3F_SUN} + GL_R1UI_N3F_V3F_SUN = $85C7; + {$EXTERNALSYM GL_R1UI_N3F_V3F_SUN} + GL_R1UI_C4F_N3F_V3F_SUN = $85C8; + {$EXTERNALSYM GL_R1UI_C4F_N3F_V3F_SUN} + GL_R1UI_T2F_V3F_SUN = $85C9; + {$EXTERNALSYM GL_R1UI_T2F_V3F_SUN} + GL_R1UI_T2F_N3F_V3F_SUN = $85CA; + {$EXTERNALSYM GL_R1UI_T2F_N3F_V3F_SUN} + GL_R1UI_T2F_C4F_N3F_V3F_SUN = $85CB; + {$EXTERNALSYM GL_R1UI_T2F_C4F_N3F_V3F_SUN} + + // GL_EXT_blend_func_separate + GL_BLEND_DST_RGB_EXT = $80C8; + {$EXTERNALSYM GL_BLEND_DST_RGB_EXT} + GL_BLEND_SRC_RGB_EXT = $80C9; + {$EXTERNALSYM GL_BLEND_SRC_RGB_EXT} + GL_BLEND_DST_ALPHA_EXT = $80CA; + {$EXTERNALSYM GL_BLEND_DST_ALPHA_EXT} + GL_BLEND_SRC_ALPHA_EXT = $80CB; + {$EXTERNALSYM GL_BLEND_SRC_ALPHA_EXT} + + // GL_INGR_color_clamp + GL_RED_MIN_CLAMP_INGR = $8560; + {$EXTERNALSYM GL_RED_MIN_CLAMP_INGR} + GL_GREEN_MIN_CLAMP_INGR = $8561; + {$EXTERNALSYM GL_GREEN_MIN_CLAMP_INGR} + GL_BLUE_MIN_CLAMP_INGR = $8562; + {$EXTERNALSYM GL_BLUE_MIN_CLAMP_INGR} + GL_ALPHA_MIN_CLAMP_INGR = $8563; + {$EXTERNALSYM GL_ALPHA_MIN_CLAMP_INGR} + GL_RED_MAX_CLAMP_INGR = $8564; + {$EXTERNALSYM GL_RED_MAX_CLAMP_INGR} + GL_GREEN_MAX_CLAMP_INGR = $8565; + {$EXTERNALSYM GL_GREEN_MAX_CLAMP_INGR} + GL_BLUE_MAX_CLAMP_INGR = $8566; + {$EXTERNALSYM GL_BLUE_MAX_CLAMP_INGR} + GL_ALPHA_MAX_CLAMP_INGR = $8567; + {$EXTERNALSYM GL_ALPHA_MAX_CLAMP_INGR} + + // GL_INGR_interlace_read + GL_INTERLACE_READ_INGR = $8568; + {$EXTERNALSYM GL_INTERLACE_READ_INGR} + + // GL_EXT_422_pixels + GL_422_EXT = $80CC; + {$EXTERNALSYM GL_422_EXT} + GL_422_REV_EXT = $80CD; + {$EXTERNALSYM GL_422_REV_EXT} + GL_422_AVERAGE_EXT = $80CE; + {$EXTERNALSYM GL_422_AVERAGE_EXT} + GL_422_REV_AVERAGE_EXT = $80CF; + {$EXTERNALSYM GL_422_REV_AVERAGE_EXT} + + // GL_EXT_texture_cube_map + GL_NORMAL_MAP_EXT = $8511; + {$EXTERNALSYM GL_NORMAL_MAP_EXT} + GL_REFLECTION_MAP_EXT = $8512; + {$EXTERNALSYM GL_REFLECTION_MAP_EXT} + GL_TEXTURE_CUBE_MAP_EXT = $8513; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_EXT} + GL_TEXTURE_BINDING_CUBE_MAP_EXT = $8514; + {$EXTERNALSYM GL_TEXTURE_BINDING_CUBE_MAP_EXT} + GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT = $8515; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT} + GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT = $8516; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT} + GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT = $8517; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT} + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT = $8518; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT} + GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT = $8519; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT} + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT = $851A; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT} + GL_PROXY_TEXTURE_CUBE_MAP_EXT = $851B; + {$EXTERNALSYM GL_PROXY_TEXTURE_CUBE_MAP_EXT} + GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT = $851C; + {$EXTERNALSYM GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT} + + // GL_SUN_convolution_border_modes + GL_WRAP_BORDER_SUN = $81D4; + {$EXTERNALSYM GL_WRAP_BORDER_SUN} + + // GL_EXT_texture_lod_bias + GL_MAX_TEXTURE_LOD_BIAS_EXT = $84FD; + {$EXTERNALSYM GL_MAX_TEXTURE_LOD_BIAS_EXT} + GL_TEXTURE_FILTER_CONTROL_EXT = $8500; + {$EXTERNALSYM GL_TEXTURE_FILTER_CONTROL_EXT} + GL_TEXTURE_LOD_BIAS_EXT = $8501; + {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_EXT} + + // GL_EXT_texture_filter_anisotropic + GL_TEXTURE_MAX_ANISOTROPY_EXT = $84FE; + {$EXTERNALSYM GL_TEXTURE_MAX_ANISOTROPY_EXT} + GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = $84FF; + {$EXTERNALSYM GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT} + + // GL_EXT_vertex_weighting + GL_MODELVIEW0_STACK_DEPTH_EXT = GL_MODELVIEW_STACK_DEPTH; + {$EXTERNALSYM GL_MODELVIEW0_STACK_DEPTH_EXT} + GL_MODELVIEW1_STACK_DEPTH_EXT = $8502; + {$EXTERNALSYM GL_MODELVIEW1_STACK_DEPTH_EXT} + GL_MODELVIEW0_MATRIX_EXT = GL_MODELVIEW_MATRIX; + {$EXTERNALSYM GL_MODELVIEW0_MATRIX_EXT} + GL_MODELVIEW_MATRIX1_EXT = $8506; + {$EXTERNALSYM GL_MODELVIEW_MATRIX1_EXT} + GL_VERTEX_WEIGHTING_EXT = $8509; + {$EXTERNALSYM GL_VERTEX_WEIGHTING_EXT} + GL_MODELVIEW0_EXT = GL_MODELVIEW; + {$EXTERNALSYM GL_MODELVIEW0_EXT} + GL_MODELVIEW1_EXT = $850A; + {$EXTERNALSYM GL_MODELVIEW1_EXT} + GL_CURRENT_VERTEX_WEIGHT_EXT = $850B; + {$EXTERNALSYM GL_CURRENT_VERTEX_WEIGHT_EXT} + GL_VERTEX_WEIGHT_ARRAY_EXT = $850C; + {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_EXT} + GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT = $850D; + {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT} + GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT = $850E; + {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT} + GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT = $850F; + {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT} + GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT = $8510; + {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT} + + // GL_NV_light_max_exponent + GL_MAX_SHININESS_NV = $8504; + {$EXTERNALSYM GL_MAX_SHININESS_NV} + GL_MAX_SPOT_EXPONENT_NV = $8505; + {$EXTERNALSYM GL_MAX_SPOT_EXPONENT_NV} + + // GL_NV_vertex_array_range + GL_VERTEX_ARRAY_RANGE_NV = $851D; + {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_NV} + GL_VERTEX_ARRAY_RANGE_LENGTH_NV = $851E; + {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_LENGTH_NV} + GL_VERTEX_ARRAY_RANGE_VALID_NV = $851F; + {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_VALID_NV} + GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV = $8520; + {$EXTERNALSYM GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV} + GL_VERTEX_ARRAY_RANGE_POINTER_NV = $8521; + {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_POINTER_NV} + + // GL_NV_register_combiners + GL_REGISTER_COMBINERS_NV = $8522; + {$EXTERNALSYM GL_REGISTER_COMBINERS_NV} + GL_VARIABLE_A_NV = $8523; + {$EXTERNALSYM GL_VARIABLE_A_NV} + GL_VARIABLE_B_NV = $8524; + {$EXTERNALSYM GL_VARIABLE_B_NV} + GL_VARIABLE_C_NV = $8525; + {$EXTERNALSYM GL_VARIABLE_C_NV} + GL_VARIABLE_D_NV = $8526; + {$EXTERNALSYM GL_VARIABLE_D_NV} + GL_VARIABLE_E_NV = $8527; + {$EXTERNALSYM GL_VARIABLE_E_NV} + GL_VARIABLE_F_NV = $8528; + {$EXTERNALSYM GL_VARIABLE_F_NV} + GL_VARIABLE_G_NV = $8529; + {$EXTERNALSYM GL_VARIABLE_G_NV} + GL_CONSTANT_COLOR0_NV = $852A; + {$EXTERNALSYM GL_CONSTANT_COLOR0_NV} + GL_CONSTANT_COLOR1_NV = $852B; + {$EXTERNALSYM GL_CONSTANT_COLOR1_NV} + GL_PRIMARY_COLOR_NV = $852C; + {$EXTERNALSYM GL_PRIMARY_COLOR_NV} + GL_SECONDARY_COLOR_NV = $852D; + {$EXTERNALSYM GL_SECONDARY_COLOR_NV} + GL_SPARE0_NV = $852E; + {$EXTERNALSYM GL_SPARE0_NV} + GL_SPARE1_NV = $852F; + {$EXTERNALSYM GL_SPARE1_NV} + GL_DISCARD_NV = $8530; + {$EXTERNALSYM GL_DISCARD_NV} + GL_E_TIMES_F_NV = $8531; + {$EXTERNALSYM GL_E_TIMES_F_NV} + GL_SPARE0_PLUS_SECONDARY_COLOR_NV = $8532; + {$EXTERNALSYM GL_SPARE0_PLUS_SECONDARY_COLOR_NV} + GL_UNSIGNED_IDENTITY_NV = $8536; + {$EXTERNALSYM GL_UNSIGNED_IDENTITY_NV} + GL_UNSIGNED_INVERT_NV = $8537; + {$EXTERNALSYM GL_UNSIGNED_INVERT_NV} + GL_EXPAND_NORMAL_NV = $8538; + {$EXTERNALSYM GL_EXPAND_NORMAL_NV} + GL_EXPAND_NEGATE_NV = $8539; + {$EXTERNALSYM GL_EXPAND_NEGATE_NV} + GL_HALF_BIAS_NORMAL_NV = $853A; + {$EXTERNALSYM GL_HALF_BIAS_NORMAL_NV} + GL_HALF_BIAS_NEGATE_NV = $853B; + {$EXTERNALSYM GL_HALF_BIAS_NEGATE_NV} + GL_SIGNED_IDENTITY_NV = $853C; + {$EXTERNALSYM GL_SIGNED_IDENTITY_NV} + GL_SIGNED_NEGATE_NV = $853D; + {$EXTERNALSYM GL_SIGNED_NEGATE_NV} + GL_SCALE_BY_TWO_NV = $853E; + {$EXTERNALSYM GL_SCALE_BY_TWO_NV} + GL_SCALE_BY_FOUR_NV = $853F; + {$EXTERNALSYM GL_SCALE_BY_FOUR_NV} + GL_SCALE_BY_ONE_HALF_NV = $8540; + {$EXTERNALSYM GL_SCALE_BY_ONE_HALF_NV} + GL_BIAS_BY_NEGATIVE_ONE_HALF_NV = $8541; + {$EXTERNALSYM GL_BIAS_BY_NEGATIVE_ONE_HALF_NV} + GL_COMBINER_INPUT_NV = $8542; + {$EXTERNALSYM GL_COMBINER_INPUT_NV} + GL_COMBINER_MAPPING_NV = $8543; + {$EXTERNALSYM GL_COMBINER_MAPPING_NV} + GL_COMBINER_COMPONENT_USAGE_NV = $8544; + {$EXTERNALSYM GL_COMBINER_COMPONENT_USAGE_NV} + GL_COMBINER_AB_DOT_PRODUCT_NV = $8545; + {$EXTERNALSYM GL_COMBINER_AB_DOT_PRODUCT_NV} + GL_COMBINER_CD_DOT_PRODUCT_NV = $8546; + {$EXTERNALSYM GL_COMBINER_CD_DOT_PRODUCT_NV} + GL_COMBINER_MUX_SUM_NV = $8547; + {$EXTERNALSYM GL_COMBINER_MUX_SUM_NV} + GL_COMBINER_SCALE_NV = $8548; + {$EXTERNALSYM GL_COMBINER_SCALE_NV} + GL_COMBINER_BIAS_NV = $8549; + {$EXTERNALSYM GL_COMBINER_BIAS_NV} + GL_COMBINER_AB_OUTPUT_NV = $854A; + {$EXTERNALSYM GL_COMBINER_AB_OUTPUT_NV} + GL_COMBINER_CD_OUTPUT_NV = $854B; + {$EXTERNALSYM GL_COMBINER_CD_OUTPUT_NV} + GL_COMBINER_SUM_OUTPUT_NV = $854C; + {$EXTERNALSYM GL_COMBINER_SUM_OUTPUT_NV} + GL_MAX_GENERAL_COMBINERS_NV = $854D; + {$EXTERNALSYM GL_MAX_GENERAL_COMBINERS_NV} + GL_NUM_GENERAL_COMBINERS_NV = $854E; + {$EXTERNALSYM GL_NUM_GENERAL_COMBINERS_NV} + GL_COLOR_SUM_CLAMP_NV = $854F; + {$EXTERNALSYM GL_COLOR_SUM_CLAMP_NV} + GL_COMBINER0_NV = $8550; + {$EXTERNALSYM GL_COMBINER0_NV} + GL_COMBINER1_NV = $8551; + {$EXTERNALSYM GL_COMBINER1_NV} + GL_COMBINER2_NV = $8552; + {$EXTERNALSYM GL_COMBINER2_NV} + GL_COMBINER3_NV = $8553; + {$EXTERNALSYM GL_COMBINER3_NV} + GL_COMBINER4_NV = $8554; + {$EXTERNALSYM GL_COMBINER4_NV} + GL_COMBINER5_NV = $8555; + {$EXTERNALSYM GL_COMBINER5_NV} + GL_COMBINER6_NV = $8556; + {$EXTERNALSYM GL_COMBINER6_NV} + GL_COMBINER7_NV = $8557; + {$EXTERNALSYM GL_COMBINER7_NV} + + // GL_NV_fog_distance + GL_FOG_DISTANCE_MODE_NV = $855A; + {$EXTERNALSYM GL_FOG_DISTANCE_MODE_NV} + GL_EYE_RADIAL_NV = $855B; + {$EXTERNALSYM GL_EYE_RADIAL_NV} + GL_EYE_PLANE_ABSOLUTE_NV = $855C; + {$EXTERNALSYM GL_EYE_PLANE_ABSOLUTE_NV} + + // GL_NV_texgen_emboss + GL_EMBOSS_LIGHT_NV = $855D; + {$EXTERNALSYM GL_EMBOSS_LIGHT_NV} + GL_EMBOSS_CONSTANT_NV = $855E; + {$EXTERNALSYM GL_EMBOSS_CONSTANT_NV} + GL_EMBOSS_MAP_NV = $855F; + {$EXTERNALSYM GL_EMBOSS_MAP_NV} + + // GL_EXT_texture_compression_s3tc + GL_COMPRESSED_RGB_S3TC_DXT1_EXT = $83F0; + {$EXTERNALSYM GL_COMPRESSED_RGB_S3TC_DXT1_EXT} + GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = $83F1; + {$EXTERNALSYM GL_COMPRESSED_RGBA_S3TC_DXT1_EXT} + GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = $83F2; + {$EXTERNALSYM GL_COMPRESSED_RGBA_S3TC_DXT3_EXT} + GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = $83F3; + {$EXTERNALSYM GL_COMPRESSED_RGBA_S3TC_DXT5_EXT} + + // GL_IBM_cull_vertex + GL_CULL_VERTEX_IBM = 103050; + {$EXTERNALSYM GL_CULL_VERTEX_IBM} + + // GL_IBM_vertex_array_lists + GL_VERTEX_ARRAY_LIST_IBM = 103070; + {$EXTERNALSYM GL_VERTEX_ARRAY_LIST_IBM} + GL_NORMAL_ARRAY_LIST_IBM = 103071; + {$EXTERNALSYM GL_NORMAL_ARRAY_LIST_IBM} + GL_COLOR_ARRAY_LIST_IBM = 103072; + {$EXTERNALSYM GL_COLOR_ARRAY_LIST_IBM} + GL_INDEX_ARRAY_LIST_IBM = 103073; + {$EXTERNALSYM GL_INDEX_ARRAY_LIST_IBM} + GL_TEXTURE_COORD_ARRAY_LIST_IBM = 103074; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_LIST_IBM} + GL_EDGE_FLAG_ARRAY_LIST_IBM = 103075; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_LIST_IBM} + GL_FOG_COORDINATE_ARRAY_LIST_IBM = 103076; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_LIST_IBM} + GL_SECONDARY_COLOR_ARRAY_LIST_IBM = 103077; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_LIST_IBM} + GL_VERTEX_ARRAY_LIST_STRIDE_IBM = 103080; + {$EXTERNALSYM GL_VERTEX_ARRAY_LIST_STRIDE_IBM} + GL_NORMAL_ARRAY_LIST_STRIDE_IBM = 103081; + {$EXTERNALSYM GL_NORMAL_ARRAY_LIST_STRIDE_IBM} + GL_COLOR_ARRAY_LIST_STRIDE_IBM = 103082; + {$EXTERNALSYM GL_COLOR_ARRAY_LIST_STRIDE_IBM} + GL_INDEX_ARRAY_LIST_STRIDE_IBM = 103083; + {$EXTERNALSYM GL_INDEX_ARRAY_LIST_STRIDE_IBM} + GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM = 103084; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM} + GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM = 103085; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM} + GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM = 103086; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM} + GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM = 103087; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM} + + // GL_SGIX_subsample + GL_PACK_SUBSAMPLE_RATE_SGIX = $85A0; + {$EXTERNALSYM GL_PACK_SUBSAMPLE_RATE_SGIX} + GL_UNPACK_SUBSAMPLE_RATE_SGIX = $85A1; + {$EXTERNALSYM GL_UNPACK_SUBSAMPLE_RATE_SGIX} + GL_PIXEL_SUBSAMPLE_4444_SGIX = $85A2; + {$EXTERNALSYM GL_PIXEL_SUBSAMPLE_4444_SGIX} + GL_PIXEL_SUBSAMPLE_2424_SGIX = $85A3; + {$EXTERNALSYM GL_PIXEL_SUBSAMPLE_2424_SGIX} + GL_PIXEL_SUBSAMPLE_4242_SGIX = $85A4; + {$EXTERNALSYM GL_PIXEL_SUBSAMPLE_4242_SGIX} + + // GL_SGIX_ycrcba + GL_YCRCB_SGIX = $8318; + {$EXTERNALSYM GL_YCRCB_SGIX} + GL_YCRCBA_SGIX = $8319; + {$EXTERNALSYM GL_YCRCBA_SGIX} + + // GL_SGI_depth_pass_instrument + GL_DEPTH_PASS_INSTRUMENT_SGIX = $8310; + {$EXTERNALSYM GL_DEPTH_PASS_INSTRUMENT_SGIX} + GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX = $8311; + {$EXTERNALSYM GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX} + GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX = $8312; + {$EXTERNALSYM GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX} + + // GL_3DFX_texture_compression_FXT1 + GL_COMPRESSED_RGB_FXT1_3DFX = $86B0; + {$EXTERNALSYM GL_COMPRESSED_RGB_FXT1_3DFX} + GL_COMPRESSED_RGBA_FXT1_3DFX = $86B1; + {$EXTERNALSYM GL_COMPRESSED_RGBA_FXT1_3DFX} + + // GL_3DFX_multisample + GL_MULTISAMPLE_3DFX = $86B2; + {$EXTERNALSYM GL_MULTISAMPLE_3DFX} + GL_SAMPLE_BUFFERS_3DFX = $86B3; + {$EXTERNALSYM GL_SAMPLE_BUFFERS_3DFX} + GL_SAMPLES_3DFX = $86B4; + {$EXTERNALSYM GL_SAMPLES_3DFX} + GL_MULTISAMPLE_BIT_3DFX = $20000000; + {$EXTERNALSYM GL_MULTISAMPLE_BIT_3DFX} + + // GL_EXT_multisample + GL_MULTISAMPLE_EXT = $809D; + {$EXTERNALSYM GL_MULTISAMPLE_EXT} + GL_SAMPLE_ALPHA_TO_MASK_EXT = $809E; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_MASK_EXT} + GL_SAMPLE_ALPHA_TO_ONE_EXT = $809F; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_ONE_EXT} + GL_SAMPLE_MASK_EXT = $80A0; + {$EXTERNALSYM GL_SAMPLE_MASK_EXT} + GL_1PASS_EXT = $80A1; + {$EXTERNALSYM GL_1PASS_EXT} + GL_2PASS_0_EXT = $80A2; + {$EXTERNALSYM GL_2PASS_0_EXT} + GL_2PASS_1_EXT = $80A3; + {$EXTERNALSYM GL_2PASS_1_EXT} + GL_4PASS_0_EXT = $80A4; + {$EXTERNALSYM GL_4PASS_0_EXT} + GL_4PASS_1_EXT = $80A5; + {$EXTERNALSYM GL_4PASS_1_EXT} + GL_4PASS_2_EXT = $80A6; + {$EXTERNALSYM GL_4PASS_2_EXT} + GL_4PASS_3_EXT = $80A7; + {$EXTERNALSYM GL_4PASS_3_EXT} + GL_SAMPLE_BUFFERS_EXT = $80A8; + {$EXTERNALSYM GL_SAMPLE_BUFFERS_EXT} + GL_SAMPLES_EXT = $80A9; + {$EXTERNALSYM GL_SAMPLES_EXT} + GL_SAMPLE_MASK_VALUE_EXT = $80AA; + {$EXTERNALSYM GL_SAMPLE_MASK_VALUE_EXT} + GL_SAMPLE_MASK_INVERT_EXT = $80AB; + {$EXTERNALSYM GL_SAMPLE_MASK_INVERT_EXT} + GL_SAMPLE_PATTERN_EXT = $80AC; + {$EXTERNALSYM GL_SAMPLE_PATTERN_EXT} + + // GL_SGIX_vertex_preclip + GL_VERTEX_PRECLIP_SGIX = $83EE; + {$EXTERNALSYM GL_VERTEX_PRECLIP_SGIX} + GL_VERTEX_PRECLIP_HINT_SGIX = $83EF; + {$EXTERNALSYM GL_VERTEX_PRECLIP_HINT_SGIX} + + // GL_SGIX_convolution_accuracy + GL_CONVOLUTION_HINT_SGIX = $8316; + {$EXTERNALSYM GL_CONVOLUTION_HINT_SGIX} + + // GL_SGIX_resample + GL_PACK_RESAMPLE_SGIX = $842C; + {$EXTERNALSYM GL_PACK_RESAMPLE_SGIX} + GL_UNPACK_RESAMPLE_SGIX = $842D; + {$EXTERNALSYM GL_UNPACK_RESAMPLE_SGIX} + GL_RESAMPLE_REPLICATE_SGIX = $842E; + {$EXTERNALSYM GL_RESAMPLE_REPLICATE_SGIX} + GL_RESAMPLE_ZERO_FILL_SGIX = $842F; + {$EXTERNALSYM GL_RESAMPLE_ZERO_FILL_SGIX} + GL_RESAMPLE_DECIMATE_SGIX = $8430; + {$EXTERNALSYM GL_RESAMPLE_DECIMATE_SGIX} + + // GL_SGIS_point_line_texgen + GL_EYE_DISTANCE_TO_POINT_SGIS = $81F0; + {$EXTERNALSYM GL_EYE_DISTANCE_TO_POINT_SGIS} + GL_OBJECT_DISTANCE_TO_POINT_SGIS = $81F1; + {$EXTERNALSYM GL_OBJECT_DISTANCE_TO_POINT_SGIS} + GL_EYE_DISTANCE_TO_LINE_SGIS = $81F2; + {$EXTERNALSYM GL_EYE_DISTANCE_TO_LINE_SGIS} + GL_OBJECT_DISTANCE_TO_LINE_SGIS = $81F3; + {$EXTERNALSYM GL_OBJECT_DISTANCE_TO_LINE_SGIS} + GL_EYE_POINT_SGIS = $81F4; + {$EXTERNALSYM GL_EYE_POINT_SGIS} + GL_OBJECT_POINT_SGIS = $81F5; + {$EXTERNALSYM GL_OBJECT_POINT_SGIS} + GL_EYE_LINE_SGIS = $81F6; + {$EXTERNALSYM GL_EYE_LINE_SGIS} + GL_OBJECT_LINE_SGIS = $81F7; + {$EXTERNALSYM GL_OBJECT_LINE_SGIS} + + // GL_SGIS_texture_color_mask + GL_TEXTURE_COLOR_WRITEMASK_SGIS = $81EF; + {$EXTERNALSYM GL_TEXTURE_COLOR_WRITEMASK_SGIS} + + // GL_NV_vertex_program + GL_VERTEX_PROGRAM_NV = $8620; + {$EXTERNALSYM GL_VERTEX_PROGRAM_NV} + GL_VERTEX_STATE_PROGRAM_NV = $8621; + {$EXTERNALSYM GL_VERTEX_STATE_PROGRAM_NV} + GL_ATTRIB_ARRAY_SIZE_NV = $8623; + {$EXTERNALSYM GL_ATTRIB_ARRAY_SIZE_NV} + GL_ATTRIB_ARRAY_STRIDE_NV = $8624; + {$EXTERNALSYM GL_ATTRIB_ARRAY_STRIDE_NV} + GL_ATTRIB_ARRAY_TYPE_NV = $8625; + {$EXTERNALSYM GL_ATTRIB_ARRAY_TYPE_NV} + GL_CURRENT_ATTRIB_NV = $8626; + {$EXTERNALSYM GL_CURRENT_ATTRIB_NV} + GL_PROGRAM_LENGTH_NV = $8627; + {$EXTERNALSYM GL_PROGRAM_LENGTH_NV} + GL_PROGRAM_STRING_NV = $8628; + {$EXTERNALSYM GL_PROGRAM_STRING_NV} + GL_MODELVIEW_PROJECTION_NV = $8629; + {$EXTERNALSYM GL_MODELVIEW_PROJECTION_NV} + GL_IDENTITY_NV = $862A; + {$EXTERNALSYM GL_IDENTITY_NV} + GL_INVERSE_NV = $862B; + {$EXTERNALSYM GL_INVERSE_NV} + GL_TRANSPOSE_NV = $862C; + {$EXTERNALSYM GL_TRANSPOSE_NV} + GL_INVERSE_TRANSPOSE_NV = $862D; + {$EXTERNALSYM GL_INVERSE_TRANSPOSE_NV} + GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV = $862E; + {$EXTERNALSYM GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV} + GL_MAX_TRACK_MATRICES_NV = $862F; + {$EXTERNALSYM GL_MAX_TRACK_MATRICES_NV} + GL_MATRIX0_NV = $8630; + {$EXTERNALSYM GL_MATRIX0_NV} + GL_MATRIX1_NV = $8631; + {$EXTERNALSYM GL_MATRIX1_NV} + GL_MATRIX2_NV = $8632; + {$EXTERNALSYM GL_MATRIX2_NV} + GL_MATRIX3_NV = $8633; + {$EXTERNALSYM GL_MATRIX3_NV} + GL_MATRIX4_NV = $8634; + {$EXTERNALSYM GL_MATRIX4_NV} + GL_MATRIX5_NV = $8635; + {$EXTERNALSYM GL_MATRIX5_NV} + GL_MATRIX6_NV = $8636; + {$EXTERNALSYM GL_MATRIX6_NV} + GL_MATRIX7_NV = $8637; + {$EXTERNALSYM GL_MATRIX7_NV} + GL_CURRENT_MATRIX_STACK_DEPTH_NV = $8640; + {$EXTERNALSYM GL_CURRENT_MATRIX_STACK_DEPTH_NV} + GL_CURRENT_MATRIX_NV = $8641; + {$EXTERNALSYM GL_CURRENT_MATRIX_NV} + GL_VERTEX_PROGRAM_POINT_SIZE_NV = $8642; + {$EXTERNALSYM GL_VERTEX_PROGRAM_POINT_SIZE_NV} + GL_VERTEX_PROGRAM_TWO_SIDE_NV = $8643; + {$EXTERNALSYM GL_VERTEX_PROGRAM_TWO_SIDE_NV} + GL_PROGRAM_PARAMETER_NV = $8644; + {$EXTERNALSYM GL_PROGRAM_PARAMETER_NV} + GL_ATTRIB_ARRAY_POINTER_NV = $8645; + {$EXTERNALSYM GL_ATTRIB_ARRAY_POINTER_NV} + GL_PROGRAM_TARGET_NV = $8646; + {$EXTERNALSYM GL_PROGRAM_TARGET_NV} + GL_PROGRAM_RESIDENT_NV = $8647; + {$EXTERNALSYM GL_PROGRAM_RESIDENT_NV} + GL_TRACK_MATRIX_NV = $8648; + {$EXTERNALSYM GL_TRACK_MATRIX_NV} + GL_TRACK_MATRIX_TRANSFORM_NV = $8649; + {$EXTERNALSYM GL_TRACK_MATRIX_TRANSFORM_NV} + GL_VERTEX_PROGRAM_BINDING_NV = $864A; + {$EXTERNALSYM GL_VERTEX_PROGRAM_BINDING_NV} + GL_PROGRAM_ERROR_POSITION_NV = $864B; + {$EXTERNALSYM GL_PROGRAM_ERROR_POSITION_NV} + GL_VERTEX_ATTRIB_ARRAY0_NV = $8650; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY0_NV} + GL_VERTEX_ATTRIB_ARRAY1_NV = $8651; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY1_NV} + GL_VERTEX_ATTRIB_ARRAY2_NV = $8652; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY2_NV} + GL_VERTEX_ATTRIB_ARRAY3_NV = $8653; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY3_NV} + GL_VERTEX_ATTRIB_ARRAY4_NV = $8654; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY4_NV} + GL_VERTEX_ATTRIB_ARRAY5_NV = $8655; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY5_NV} + GL_VERTEX_ATTRIB_ARRAY6_NV = $8656; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY6_NV} + GL_VERTEX_ATTRIB_ARRAY7_NV = $8657; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY7_NV} + GL_VERTEX_ATTRIB_ARRAY8_NV = $8658; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY8_NV} + GL_VERTEX_ATTRIB_ARRAY9_NV = $8659; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY9_NV} + GL_VERTEX_ATTRIB_ARRAY10_NV = $865A; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY10_NV} + GL_VERTEX_ATTRIB_ARRAY11_NV = $865B; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY11_NV} + GL_VERTEX_ATTRIB_ARRAY12_NV = $865C; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY12_NV} + GL_VERTEX_ATTRIB_ARRAY13_NV = $865D; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY13_NV} + GL_VERTEX_ATTRIB_ARRAY14_NV = $865E; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY14_NV} + GL_VERTEX_ATTRIB_ARRAY15_NV = $865F; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY15_NV} + GL_MAP1_VERTEX_ATTRIB0_4_NV = $8660; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB0_4_NV} + GL_MAP1_VERTEX_ATTRIB1_4_NV = $8661; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB1_4_NV} + GL_MAP1_VERTEX_ATTRIB2_4_NV = $8662; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB2_4_NV} + GL_MAP1_VERTEX_ATTRIB3_4_NV = $8663; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB3_4_NV} + GL_MAP1_VERTEX_ATTRIB4_4_NV = $8664; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB4_4_NV} + GL_MAP1_VERTEX_ATTRIB5_4_NV = $8665; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB5_4_NV} + GL_MAP1_VERTEX_ATTRIB6_4_NV = $8666; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB6_4_NV} + GL_MAP1_VERTEX_ATTRIB7_4_NV = $8667; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB7_4_NV} + GL_MAP1_VERTEX_ATTRIB8_4_NV = $8668; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB8_4_NV} + GL_MAP1_VERTEX_ATTRIB9_4_NV = $8669; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB9_4_NV} + GL_MAP1_VERTEX_ATTRIB10_4_NV = $866A; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB10_4_NV} + GL_MAP1_VERTEX_ATTRIB11_4_NV = $866B; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB11_4_NV} + GL_MAP1_VERTEX_ATTRIB12_4_NV = $866C; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB12_4_NV} + GL_MAP1_VERTEX_ATTRIB13_4_NV = $866D; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB13_4_NV} + GL_MAP1_VERTEX_ATTRIB14_4_NV = $866E; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB14_4_NV} + GL_MAP1_VERTEX_ATTRIB15_4_NV = $866F; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB15_4_NV} + GL_MAP2_VERTEX_ATTRIB0_4_NV = $8670; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB0_4_NV} + GL_MAP2_VERTEX_ATTRIB1_4_NV = $8671; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB1_4_NV} + GL_MAP2_VERTEX_ATTRIB2_4_NV = $8672; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB2_4_NV} + GL_MAP2_VERTEX_ATTRIB3_4_NV = $8673; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB3_4_NV} + GL_MAP2_VERTEX_ATTRIB4_4_NV = $8674; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB4_4_NV} + GL_MAP2_VERTEX_ATTRIB5_4_NV = $8675; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB5_4_NV} + GL_MAP2_VERTEX_ATTRIB6_4_NV = $8676; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB6_4_NV} + GL_MAP2_VERTEX_ATTRIB7_4_NV = $8677; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB7_4_NV} + GL_MAP2_VERTEX_ATTRIB8_4_NV = $8678; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB8_4_NV} + GL_MAP2_VERTEX_ATTRIB9_4_NV = $8679; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB9_4_NV} + GL_MAP2_VERTEX_ATTRIB10_4_NV = $867A; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB10_4_NV} + GL_MAP2_VERTEX_ATTRIB11_4_NV = $867B; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB11_4_NV} + GL_MAP2_VERTEX_ATTRIB12_4_NV = $867C; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB12_4_NV} + GL_MAP2_VERTEX_ATTRIB13_4_NV = $867D; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB13_4_NV} + GL_MAP2_VERTEX_ATTRIB14_4_NV = $867E; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB14_4_NV} + GL_MAP2_VERTEX_ATTRIB15_4_NV = $867F; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB15_4_NV} + + // WGL_ARB_pixel_format + WGL_NUMBER_PIXEL_FORMATS_ARB = $2000; + {$EXTERNALSYM WGL_NUMBER_PIXEL_FORMATS_ARB} + WGL_DRAW_TO_WINDOW_ARB = $2001; + {$EXTERNALSYM WGL_DRAW_TO_WINDOW_ARB} + WGL_DRAW_TO_BITMAP_ARB = $2002; + {$EXTERNALSYM WGL_DRAW_TO_BITMAP_ARB} + WGL_ACCELERATION_ARB = $2003; + {$EXTERNALSYM WGL_ACCELERATION_ARB} + WGL_NEED_PALETTE_ARB = $2004; + {$EXTERNALSYM WGL_NEED_PALETTE_ARB} + WGL_NEED_SYSTEM_PALETTE_ARB = $2005; + {$EXTERNALSYM WGL_NEED_SYSTEM_PALETTE_ARB} + WGL_SWAP_LAYER_BUFFERS_ARB = $2006; + {$EXTERNALSYM WGL_SWAP_LAYER_BUFFERS_ARB} + WGL_SWAP_METHOD_ARB = $2007; + {$EXTERNALSYM WGL_SWAP_METHOD_ARB} + WGL_NUMBER_OVERLAYS_ARB = $2008; + {$EXTERNALSYM WGL_NUMBER_OVERLAYS_ARB} + WGL_NUMBER_UNDERLAYS_ARB = $2009; + {$EXTERNALSYM WGL_NUMBER_UNDERLAYS_ARB} + WGL_TRANSPARENT_ARB = $200A; + {$EXTERNALSYM WGL_TRANSPARENT_ARB} + WGL_TRANSPARENT_RED_VALUE_ARB = $2037; + {$EXTERNALSYM WGL_TRANSPARENT_RED_VALUE_ARB} + WGL_TRANSPARENT_GREEN_VALUE_ARB = $2038; + {$EXTERNALSYM WGL_TRANSPARENT_GREEN_VALUE_ARB} + WGL_TRANSPARENT_BLUE_VALUE_ARB = $2039; + {$EXTERNALSYM WGL_TRANSPARENT_BLUE_VALUE_ARB} + WGL_TRANSPARENT_ALPHA_VALUE_ARB = $203A; + {$EXTERNALSYM WGL_TRANSPARENT_ALPHA_VALUE_ARB} + WGL_TRANSPARENT_INDEX_VALUE_ARB = $203B; + {$EXTERNALSYM WGL_TRANSPARENT_INDEX_VALUE_ARB} + WGL_SHARE_DEPTH_ARB = $200C; + {$EXTERNALSYM WGL_SHARE_DEPTH_ARB} + WGL_SHARE_STENCIL_ARB = $200D; + {$EXTERNALSYM WGL_SHARE_STENCIL_ARB} + WGL_SHARE_ACCUM_ARB = $200E; + {$EXTERNALSYM WGL_SHARE_ACCUM_ARB} + WGL_SUPPORT_GDI_ARB = $200F; + {$EXTERNALSYM WGL_SUPPORT_GDI_ARB} + WGL_SUPPORT_OPENGL_ARB = $2010; + {$EXTERNALSYM WGL_SUPPORT_OPENGL_ARB} + WGL_DOUBLE_BUFFER_ARB = $2011; + {$EXTERNALSYM WGL_DOUBLE_BUFFER_ARB} + WGL_STEREO_ARB = $2012; + {$EXTERNALSYM WGL_STEREO_ARB} + WGL_PIXEL_TYPE_ARB = $2013; + {$EXTERNALSYM WGL_PIXEL_TYPE_ARB} + WGL_COLOR_BITS_ARB = $2014; + {$EXTERNALSYM WGL_COLOR_BITS_ARB} + WGL_RED_BITS_ARB = $2015; + {$EXTERNALSYM WGL_RED_BITS_ARB} + WGL_RED_SHIFT_ARB = $2016; + {$EXTERNALSYM WGL_RED_SHIFT_ARB} + WGL_GREEN_BITS_ARB = $2017; + {$EXTERNALSYM WGL_GREEN_BITS_ARB} + WGL_GREEN_SHIFT_ARB = $2018; + {$EXTERNALSYM WGL_GREEN_SHIFT_ARB} + WGL_BLUE_BITS_ARB = $2019; + {$EXTERNALSYM WGL_BLUE_BITS_ARB} + WGL_BLUE_SHIFT_ARB = $201A; + {$EXTERNALSYM WGL_BLUE_SHIFT_ARB} + WGL_ALPHA_BITS_ARB = $201B; + {$EXTERNALSYM WGL_ALPHA_BITS_ARB} + WGL_ALPHA_SHIFT_ARB = $201C; + {$EXTERNALSYM WGL_ALPHA_SHIFT_ARB} + WGL_ACCUM_BITS_ARB = $201D; + {$EXTERNALSYM WGL_ACCUM_BITS_ARB} + WGL_ACCUM_RED_BITS_ARB = $201E; + {$EXTERNALSYM WGL_ACCUM_RED_BITS_ARB} + WGL_ACCUM_GREEN_BITS_ARB = $201F; + {$EXTERNALSYM WGL_ACCUM_GREEN_BITS_ARB} + WGL_ACCUM_BLUE_BITS_ARB = $2020; + {$EXTERNALSYM WGL_ACCUM_BLUE_BITS_ARB} + WGL_ACCUM_ALPHA_BITS_ARB = $2021; + {$EXTERNALSYM WGL_ACCUM_ALPHA_BITS_ARB} + WGL_DEPTH_BITS_ARB = $2022; + {$EXTERNALSYM WGL_DEPTH_BITS_ARB} + WGL_STENCIL_BITS_ARB = $2023; + {$EXTERNALSYM WGL_STENCIL_BITS_ARB} + WGL_AUX_BUFFERS_ARB = $2024; + {$EXTERNALSYM WGL_AUX_BUFFERS_ARB} + WGL_NO_ACCELERATION_ARB = $2025; + {$EXTERNALSYM WGL_NO_ACCELERATION_ARB} + WGL_GENERIC_ACCELERATION_ARB = $2026; + {$EXTERNALSYM WGL_GENERIC_ACCELERATION_ARB} + WGL_FULL_ACCELERATION_ARB = $2027; + {$EXTERNALSYM WGL_FULL_ACCELERATION_ARB} + WGL_SWAP_EXCHANGE_ARB = $2028; + {$EXTERNALSYM WGL_SWAP_EXCHANGE_ARB} + WGL_SWAP_COPY_ARB = $2029; + {$EXTERNALSYM WGL_SWAP_COPY_ARB} + WGL_SWAP_UNDEFINED_ARB = $202A; + {$EXTERNALSYM WGL_SWAP_UNDEFINED_ARB} + WGL_TYPE_RGBA_ARB = $202B; + {$EXTERNALSYM WGL_TYPE_RGBA_ARB} + WGL_TYPE_COLORINDEX_ARB = $202C; + {$EXTERNALSYM WGL_TYPE_COLORINDEX_ARB} + + + // ********** GLU generic constants ********** + + // Errors: (return value 0 = no error) + GLU_INVALID_ENUM = 100900; + {$EXTERNALSYM GLU_INVALID_ENUM} + GLU_INVALID_VALUE = 100901; + {$EXTERNALSYM GLU_INVALID_VALUE} + GLU_OUT_OF_MEMORY = 100902; + {$EXTERNALSYM GLU_OUT_OF_MEMORY} + GLU_INCOMPATIBLE_GL_VERSION = 100903; + {$EXTERNALSYM GLU_INCOMPATIBLE_GL_VERSION} + + // StringName + GLU_VERSION = 100800; + {$EXTERNALSYM GLU_VERSION} + GLU_EXTENSIONS = 100801; + {$EXTERNALSYM GLU_EXTENSIONS} + + // Boolean + GLU_TRUE = GL_TRUE; + {$EXTERNALSYM GLU_TRUE} + GLU_FALSE = GL_FALSE; + {$EXTERNALSYM GLU_FALSE} + + // Quadric constants + // QuadricNormal + GLU_SMOOTH = 100000; + {$EXTERNALSYM GLU_SMOOTH} + GLU_FLAT = 100001; + {$EXTERNALSYM GLU_FLAT} + GLU_NONE = 100002; + {$EXTERNALSYM GLU_NONE} + + // QuadricDrawStyle + GLU_POINT = 100010; + {$EXTERNALSYM GLU_POINT} + GLU_LINE = 100011; + {$EXTERNALSYM GLU_LINE} + GLU_FILL = 100012; + {$EXTERNALSYM GLU_FILL} + GLU_SILHOUETTE = 100013; + {$EXTERNALSYM GLU_SILHOUETTE} + + // QuadricOrientation + GLU_OUTSIDE = 100020; + {$EXTERNALSYM GLU_OUTSIDE} + GLU_INSIDE = 100021; + {$EXTERNALSYM GLU_INSIDE} + + // Tesselation constants + GLU_TESS_MAX_COORD = 1.0e150; + {$EXTERNALSYM GLU_TESS_MAX_COORD} + + // TessProperty + GLU_TESS_WINDING_RULE = 100140; + {$EXTERNALSYM GLU_TESS_WINDING_RULE} + GLU_TESS_BOUNDARY_ONLY = 100141; + {$EXTERNALSYM GLU_TESS_BOUNDARY_ONLY} + GLU_TESS_TOLERANCE = 100142; + {$EXTERNALSYM GLU_TESS_TOLERANCE} + + // TessWinding + GLU_TESS_WINDING_ODD = 100130; + {$EXTERNALSYM GLU_TESS_WINDING_ODD} + GLU_TESS_WINDING_NONZERO = 100131; + {$EXTERNALSYM GLU_TESS_WINDING_NONZERO} + GLU_TESS_WINDING_POSITIVE = 100132; + {$EXTERNALSYM GLU_TESS_WINDING_POSITIVE} + GLU_TESS_WINDING_NEGATIVE = 100133; + {$EXTERNALSYM GLU_TESS_WINDING_NEGATIVE} + GLU_TESS_WINDING_ABS_GEQ_TWO = 100134; + {$EXTERNALSYM GLU_TESS_WINDING_ABS_GEQ_TWO} + + // TessCallback + GLU_TESS_BEGIN = 100100; // TGLUTessBeginProc + {$EXTERNALSYM GLU_TESS_BEGIN} + GLU_TESS_VERTEX = 100101; // TGLUTessVertexProc + {$EXTERNALSYM GLU_TESS_VERTEX} + GLU_TESS_END = 100102; // TGLUTessEndProc + {$EXTERNALSYM GLU_TESS_END} + GLU_TESS_ERROR = 100103; // TGLUTessErrorProc + {$EXTERNALSYM GLU_TESS_ERROR} + GLU_TESS_EDGE_FLAG = 100104; // TGLUTessEdgeFlagProc + {$EXTERNALSYM GLU_TESS_EDGE_FLAG} + GLU_TESS_COMBINE = 100105; // TGLUTessCombineProc + {$EXTERNALSYM GLU_TESS_COMBINE} + GLU_TESS_BEGIN_DATA = 100106; // TGLUTessBeginDataProc + {$EXTERNALSYM GLU_TESS_BEGIN_DATA} + GLU_TESS_VERTEX_DATA = 100107; // TGLUTessVertexDataProc + {$EXTERNALSYM GLU_TESS_VERTEX_DATA} + GLU_TESS_END_DATA = 100108; // TGLUTessEndDataProc + {$EXTERNALSYM GLU_TESS_END_DATA} + GLU_TESS_ERROR_DATA = 100109; // TGLUTessErrorDataProc + {$EXTERNALSYM GLU_TESS_ERROR_DATA} + GLU_TESS_EDGE_FLAG_DATA = 100110; // TGLUTessEdgeFlagDataProc + {$EXTERNALSYM GLU_TESS_EDGE_FLAG_DATA} + GLU_TESS_COMBINE_DATA = 100111; // TGLUTessCombineDataProc + {$EXTERNALSYM GLU_TESS_COMBINE_DATA} + + // TessError + GLU_TESS_ERROR1 = 100151; + {$EXTERNALSYM GLU_TESS_ERROR1} + GLU_TESS_ERROR2 = 100152; + {$EXTERNALSYM GLU_TESS_ERROR2} + GLU_TESS_ERROR3 = 100153; + {$EXTERNALSYM GLU_TESS_ERROR3} + GLU_TESS_ERROR4 = 100154; + {$EXTERNALSYM GLU_TESS_ERROR4} + GLU_TESS_ERROR5 = 100155; + {$EXTERNALSYM GLU_TESS_ERROR5} + GLU_TESS_ERROR6 = 100156; + {$EXTERNALSYM GLU_TESS_ERROR6} + GLU_TESS_ERROR7 = 100157; + {$EXTERNALSYM GLU_TESS_ERROR7} + GLU_TESS_ERROR8 = 100158; + {$EXTERNALSYM GLU_TESS_ERROR8} + + GLU_TESS_MISSING_BEGIN_POLYGON = GLU_TESS_ERROR1; + {$EXTERNALSYM GLU_TESS_MISSING_BEGIN_POLYGON} + GLU_TESS_MISSING_BEGIN_CONTOUR = GLU_TESS_ERROR2; + {$EXTERNALSYM GLU_TESS_MISSING_BEGIN_CONTOUR} + GLU_TESS_MISSING_END_POLYGON = GLU_TESS_ERROR3; + {$EXTERNALSYM GLU_TESS_MISSING_END_POLYGON} + GLU_TESS_MISSING_END_CONTOUR = GLU_TESS_ERROR4; + {$EXTERNALSYM GLU_TESS_MISSING_END_CONTOUR} + GLU_TESS_COORD_TOO_LARGE = GLU_TESS_ERROR5; + {$EXTERNALSYM GLU_TESS_COORD_TOO_LARGE} + GLU_TESS_NEED_COMBINE_CALLBACK = GLU_TESS_ERROR6; + {$EXTERNALSYM GLU_TESS_NEED_COMBINE_CALLBACK} + + // NURBS constants + + // NurbsProperty + GLU_AUTO_LOAD_MATRIX = 100200; + {$EXTERNALSYM GLU_AUTO_LOAD_MATRIX} + GLU_CULLING = 100201; + {$EXTERNALSYM GLU_CULLING} + GLU_SAMPLING_TOLERANCE = 100203; + {$EXTERNALSYM GLU_SAMPLING_TOLERANCE} + GLU_DISPLAY_MODE = 100204; + {$EXTERNALSYM GLU_DISPLAY_MODE} + GLU_PARAMETRIC_TOLERANCE = 100202; + {$EXTERNALSYM GLU_PARAMETRIC_TOLERANCE} + GLU_SAMPLING_METHOD = 100205; + {$EXTERNALSYM GLU_SAMPLING_METHOD} + GLU_U_STEP = 100206; + {$EXTERNALSYM GLU_U_STEP} + GLU_V_STEP = 100207; + {$EXTERNALSYM GLU_V_STEP} + + // NurbsSampling + GLU_PATH_LENGTH = 100215; + {$EXTERNALSYM GLU_PATH_LENGTH} + GLU_PARAMETRIC_ERROR = 100216; + {$EXTERNALSYM GLU_PARAMETRIC_ERROR} + GLU_DOMAIN_DISTANCE = 100217; + {$EXTERNALSYM GLU_DOMAIN_DISTANCE} + + // NurbsTrim + GLU_MAP1_TRIM_2 = 100210; + {$EXTERNALSYM GLU_MAP1_TRIM_2} + GLU_MAP1_TRIM_3 = 100211; + {$EXTERNALSYM GLU_MAP1_TRIM_3} + + // NurbsDisplay + GLU_OUTLINE_POLYGON = 100240; + {$EXTERNALSYM GLU_OUTLINE_POLYGON} + GLU_OUTLINE_PATCH = 100241; + {$EXTERNALSYM GLU_OUTLINE_PATCH} + + // NurbsErrors + GLU_NURBS_ERROR1 = 100251; + {$EXTERNALSYM GLU_NURBS_ERROR1} + GLU_NURBS_ERROR2 = 100252; + {$EXTERNALSYM GLU_NURBS_ERROR2} + GLU_NURBS_ERROR3 = 100253; + {$EXTERNALSYM GLU_NURBS_ERROR3} + GLU_NURBS_ERROR4 = 100254; + {$EXTERNALSYM GLU_NURBS_ERROR4} + GLU_NURBS_ERROR5 = 100255; + {$EXTERNALSYM GLU_NURBS_ERROR5} + GLU_NURBS_ERROR6 = 100256; + {$EXTERNALSYM GLU_NURBS_ERROR6} + GLU_NURBS_ERROR7 = 100257; + {$EXTERNALSYM GLU_NURBS_ERROR7} + GLU_NURBS_ERROR8 = 100258; + {$EXTERNALSYM GLU_NURBS_ERROR8} + GLU_NURBS_ERROR9 = 100259; + {$EXTERNALSYM GLU_NURBS_ERROR9} + GLU_NURBS_ERROR10 = 100260; + {$EXTERNALSYM GLU_NURBS_ERROR10} + GLU_NURBS_ERROR11 = 100261; + {$EXTERNALSYM GLU_NURBS_ERROR11} + GLU_NURBS_ERROR12 = 100262; + {$EXTERNALSYM GLU_NURBS_ERROR12} + GLU_NURBS_ERROR13 = 100263; + {$EXTERNALSYM GLU_NURBS_ERROR13} + GLU_NURBS_ERROR14 = 100264; + {$EXTERNALSYM GLU_NURBS_ERROR14} + GLU_NURBS_ERROR15 = 100265; + {$EXTERNALSYM GLU_NURBS_ERROR15} + GLU_NURBS_ERROR16 = 100266; + {$EXTERNALSYM GLU_NURBS_ERROR16} + GLU_NURBS_ERROR17 = 100267; + {$EXTERNALSYM GLU_NURBS_ERROR17} + GLU_NURBS_ERROR18 = 100268; + {$EXTERNALSYM GLU_NURBS_ERROR18} + GLU_NURBS_ERROR19 = 100269; + {$EXTERNALSYM GLU_NURBS_ERROR19} + GLU_NURBS_ERROR20 = 100270; + {$EXTERNALSYM GLU_NURBS_ERROR20} + GLU_NURBS_ERROR21 = 100271; + {$EXTERNALSYM GLU_NURBS_ERROR21} + GLU_NURBS_ERROR22 = 100272; + {$EXTERNALSYM GLU_NURBS_ERROR22} + GLU_NURBS_ERROR23 = 100273; + {$EXTERNALSYM GLU_NURBS_ERROR23} + GLU_NURBS_ERROR24 = 100274; + {$EXTERNALSYM GLU_NURBS_ERROR24} + GLU_NURBS_ERROR25 = 100275; + {$EXTERNALSYM GLU_NURBS_ERROR25} + GLU_NURBS_ERROR26 = 100276; + {$EXTERNALSYM GLU_NURBS_ERROR26} + GLU_NURBS_ERROR27 = 100277; + {$EXTERNALSYM GLU_NURBS_ERROR27} + GLU_NURBS_ERROR28 = 100278; + {$EXTERNALSYM GLU_NURBS_ERROR28} + GLU_NURBS_ERROR29 = 100279; + {$EXTERNALSYM GLU_NURBS_ERROR29} + GLU_NURBS_ERROR30 = 100280; + {$EXTERNALSYM GLU_NURBS_ERROR30} + GLU_NURBS_ERROR31 = 100281; + {$EXTERNALSYM GLU_NURBS_ERROR31} + GLU_NURBS_ERROR32 = 100282; + {$EXTERNALSYM GLU_NURBS_ERROR32} + GLU_NURBS_ERROR33 = 100283; + {$EXTERNALSYM GLU_NURBS_ERROR33} + GLU_NURBS_ERROR34 = 100284; + {$EXTERNALSYM GLU_NURBS_ERROR34} + GLU_NURBS_ERROR35 = 100285; + {$EXTERNALSYM GLU_NURBS_ERROR35} + GLU_NURBS_ERROR36 = 100286; + {$EXTERNALSYM GLU_NURBS_ERROR36} + GLU_NURBS_ERROR37 = 100287; + {$EXTERNALSYM GLU_NURBS_ERROR37} + + // Contours types -- obsolete! + GLU_CW = 100120; + {$EXTERNALSYM GLU_CW} + GLU_CCW = 100121; + {$EXTERNALSYM GLU_CCW} + GLU_INTERIOR = 100122; + {$EXTERNALSYM GLU_INTERIOR} + GLU_EXTERIOR = 100123; + {$EXTERNALSYM GLU_EXTERIOR} + GLU_UNKNOWN = 100124; + {$EXTERNALSYM GLU_UNKNOWN} + + // Names without "TESS_" prefix + GLU_BEGIN = GLU_TESS_BEGIN; + {$EXTERNALSYM GLU_BEGIN} + GLU_VERTEX = GLU_TESS_VERTEX; + {$EXTERNALSYM GLU_VERTEX} + GLU_END = GLU_TESS_END; + {$EXTERNALSYM GLU_END} + GLU_ERROR = GLU_TESS_ERROR; + {$EXTERNALSYM GLU_ERROR} + GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG; + {$EXTERNALSYM GLU_EDGE_FLAG} + + GLX_VERSION_1_1 = 1; + GLX_VERSION_1_2 = 1; + GLX_VERSION_1_3 = 1; + GLX_EXTENSION_NAME = 'GLX'; + {$EXTERNALSYM GLX_EXTENSION_NAME} + GLX_USE_GL = 1; + {$EXTERNALSYM GLX_USE_GL} + GLX_BUFFER_SIZE = 2; + {$EXTERNALSYM GLX_BUFFER_SIZE} + GLX_LEVEL = 3; + {$EXTERNALSYM GLX_LEVEL} + GLX_RGBA = 4; + {$EXTERNALSYM GLX_RGBA} + GLX_DOUBLEBUFFER = 5; + {$EXTERNALSYM GLX_DOUBLEBUFFER} + GLX_STEREO = 6; + {$EXTERNALSYM GLX_STEREO} + GLX_AUX_BUFFERS = 7; + {$EXTERNALSYM GLX_AUX_BUFFERS} + GLX_RED_SIZE = 8; + {$EXTERNALSYM GLX_RED_SIZE} + GLX_GREEN_SIZE = 9; + {$EXTERNALSYM GLX_GREEN_SIZE} + GLX_BLUE_SIZE = 10; + {$EXTERNALSYM GLX_BLUE_SIZE} + GLX_ALPHA_SIZE = 11; + {$EXTERNALSYM GLX_ALPHA_SIZE} + GLX_DEPTH_SIZE = 12; + {$EXTERNALSYM GLX_DEPTH_SIZE} + GLX_STENCIL_SIZE = 13; + {$EXTERNALSYM GLX_STENCIL_SIZE} + GLX_ACCUM_RED_SIZE = 14; + {$EXTERNALSYM GLX_ACCUM_RED_SIZE} + GLX_ACCUM_GREEN_SIZE = 15; + {$EXTERNALSYM GLX_ACCUM_GREEN_SIZE} + GLX_ACCUM_BLUE_SIZE = 16; + {$EXTERNALSYM GLX_ACCUM_BLUE_SIZE} + GLX_ACCUM_ALPHA_SIZE = 17; + {$EXTERNALSYM GLX_ACCUM_ALPHA_SIZE} + + // Error codes returned by glXGetConfig: + GLX_BAD_SCREEN = 1; + {$EXTERNALSYM GLX_BAD_SCREEN} + GLX_BAD_ATTRIBUTE = 2; + {$EXTERNALSYM GLX_BAD_ATTRIBUTE} + GLX_NO_EXTENSION = 3; + {$EXTERNALSYM GLX_NO_EXTENSION} + GLX_BAD_VISUAL = 4; + {$EXTERNALSYM GLX_BAD_VISUAL} + GLX_BAD_CONTEXT = 5; + {$EXTERNALSYM GLX_BAD_CONTEXT} + GLX_BAD_VALUE = 6; + {$EXTERNALSYM GLX_BAD_VALUE} + GLX_BAD_ENUM = 7; + {$EXTERNALSYM GLX_BAD_ENUM} + + // GLX 1.1 and later: + GLX_VENDOR = 1; + {$EXTERNALSYM GLX_VENDOR} + GLX_VERSION = 2; + {$EXTERNALSYM GLX_VERSION} + GLX_EXTENSIONS = 3; + {$EXTERNALSYM GLX_EXTENSIONS} + + // GLX 1.3 and later: + GLX_CONFIG_CAVEAT = $20; + {$EXTERNALSYM GLX_CONFIG_CAVEAT} + GLX_DONT_CARE = $FFFFFFFF; + {$EXTERNALSYM GLX_DONT_CARE} + GLX_SLOW_CONFIG = $8001; + {$EXTERNALSYM GLX_SLOW_CONFIG} + GLX_NON_CONFORMANT_CONFIG = $800D; + {$EXTERNALSYM GLX_NON_CONFORMANT_CONFIG} + GLX_X_VISUAL_TYPE = $22; + {$EXTERNALSYM GLX_X_VISUAL_TYPE} + GLX_TRANSPARENT_TYPE = $23; + {$EXTERNALSYM GLX_TRANSPARENT_TYPE} + GLX_TRANSPARENT_INDEX_VALUE = $24; + {$EXTERNALSYM GLX_TRANSPARENT_INDEX_VALUE} + GLX_TRANSPARENT_RED_VALUE = $25; + {$EXTERNALSYM GLX_TRANSPARENT_RED_VALUE} + GLX_TRANSPARENT_GREEN_VALUE = $26; + {$EXTERNALSYM GLX_TRANSPARENT_GREEN_VALUE} + GLX_TRANSPARENT_BLUE_VALUE = $27; + {$EXTERNALSYM GLX_TRANSPARENT_BLUE_VALUE} + GLX_TRANSPARENT_ALPHA_VALUE = $28; + {$EXTERNALSYM GLX_TRANSPARENT_ALPHA_VALUE} + GLX_MAX_PBUFFER_WIDTH = $8016; + {$EXTERNALSYM GLX_MAX_PBUFFER_WIDTH} + GLX_MAX_PBUFFER_HEIGHT = $8017; + {$EXTERNALSYM GLX_MAX_PBUFFER_HEIGHT} + GLX_MAX_PBUFFER_PIXELS = $8018; + {$EXTERNALSYM GLX_MAX_PBUFFER_PIXELS} + GLX_PRESERVED_CONTENTS = $801B; + {$EXTERNALSYM GLX_PRESERVED_CONTENTS} + GLX_LARGEST_BUFFER = $801C; + {$EXTERNALSYM GLX_LARGEST_BUFFER} + GLX_DRAWABLE_TYPE = $8010; + {$EXTERNALSYM GLX_DRAWABLE_TYPE} + GLX_FBCONFIG_ID = $8013; + {$EXTERNALSYM GLX_FBCONFIG_ID} + GLX_VISUAL_ID = $800B; + {$EXTERNALSYM GLX_VISUAL_ID} + GLX_WINDOW_BIT = $00000001; + {$EXTERNALSYM GLX_WINDOW_BIT} + GLX_PIXMAP_BIT = $00000002; + {$EXTERNALSYM GLX_PIXMAP_BIT} + GLX_PBUFFER_BIT = $00000004; + {$EXTERNALSYM GLX_PBUFFER_BIT} + GLX_AUX_BUFFERS_BIT = $00000010; + {$EXTERNALSYM GLX_AUX_BUFFERS_BIT} + GLX_FRONT_LEFT_BUFFER_BIT = $00000001; + {$EXTERNALSYM GLX_FRONT_LEFT_BUFFER_BIT} + GLX_FRONT_RIGHT_BUFFER_BIT = $00000002; + {$EXTERNALSYM GLX_FRONT_RIGHT_BUFFER_BIT} + GLX_BACK_LEFT_BUFFER_BIT = $00000004; + {$EXTERNALSYM GLX_BACK_LEFT_BUFFER_BIT} + GLX_BACK_RIGHT_BUFFER_BIT = $00000008; + {$EXTERNALSYM GLX_BACK_RIGHT_BUFFER_BIT} + GLX_DEPTH_BUFFER_BIT = $00000020; + {$EXTERNALSYM GLX_DEPTH_BUFFER_BIT} + GLX_STENCIL_BUFFER_BIT = $00000040; + {$EXTERNALSYM GLX_STENCIL_BUFFER_BIT} + GLX_ACCUM_BUFFER_BIT = $00000080; + {$EXTERNALSYM GLX_ACCUM_BUFFER_BIT} + GLX_RENDER_TYPE = $8011; + {$EXTERNALSYM GLX_RENDER_TYPE} + GLX_X_RENDERABLE = $8012; + {$EXTERNALSYM GLX_X_RENDERABLE} + GLX_NONE = $8000; + {$EXTERNALSYM GLX_NONE} + GLX_TRUE_COLOR = $8002; + {$EXTERNALSYM GLX_TRUE_COLOR} + GLX_DIRECT_COLOR = $8003; + {$EXTERNALSYM GLX_DIRECT_COLOR} + GLX_PSEUDO_COLOR = $8004; + {$EXTERNALSYM GLX_PSEUDO_COLOR} + GLX_STATIC_COLOR = $8005; + {$EXTERNALSYM GLX_STATIC_COLOR} + GLX_GRAY_SCALE = $8006; + {$EXTERNALSYM GLX_GRAY_SCALE} + GLX_STATIC_GRAY = $8007; + {$EXTERNALSYM GLX_STATIC_GRAY} + GLX_TRANSPARENT_INDEX = $8009; + {$EXTERNALSYM GLX_TRANSPARENT_INDEX} + GLX_COLOR_INDEX_TYPE = $8015; + {$EXTERNALSYM GLX_COLOR_INDEX_TYPE} + GLX_COLOR_INDEX_BIT = $00000002; + {$EXTERNALSYM GLX_COLOR_INDEX_BIT} + GLX_SCREEN = $800C; + {$EXTERNALSYM GLX_SCREEN} + GLX_PBUFFER_CLOBBER_MASK = $08000000; + {$EXTERNALSYM GLX_PBUFFER_CLOBBER_MASK} + GLX_DAMAGED = $8020; + {$EXTERNALSYM GLX_DAMAGED} + GLX_SAVED = $8021; + {$EXTERNALSYM GLX_SAVED} + GLX_WINDOW = $8022; + {$EXTERNALSYM GLX_WINDOW} + GLX_PBUFFER = $8023; + {$EXTERNALSYM GLX_PBUFFER} + GLX_EXT_visual_info = 1; + {$EXTERNALSYM GLX_EXT_visual_info} + GLX_X_VISUAL_TYPE_EXT = $22; + {$EXTERNALSYM GLX_X_VISUAL_TYPE_EXT} + GLX_TRANSPARENT_TYPE_EXT = $23; + {$EXTERNALSYM GLX_TRANSPARENT_TYPE_EXT} + GLX_TRANSPARENT_INDEX_VALUE_EXT = $24; + {$EXTERNALSYM GLX_TRANSPARENT_INDEX_VALUE_EXT} + GLX_TRANSPARENT_RED_VALUE_EXT = $25; + {$EXTERNALSYM GLX_TRANSPARENT_RED_VALUE_EXT} + GLX_TRANSPARENT_GREEN_VALUE_EXT = $26; + {$EXTERNALSYM GLX_TRANSPARENT_GREEN_VALUE_EXT} + GLX_TRANSPARENT_BLUE_VALUE_EXT = $27; + {$EXTERNALSYM GLX_TRANSPARENT_BLUE_VALUE_EXT} + GLX_TRANSPARENT_ALPHA_VALUE_EXT = $28; + {$EXTERNALSYM GLX_TRANSPARENT_ALPHA_VALUE_EXT} + GLX_TRUE_COLOR_EXT = $8002; + {$EXTERNALSYM GLX_TRUE_COLOR_EXT} + GLX_DIRECT_COLOR_EXT = $8003; + {$EXTERNALSYM GLX_DIRECT_COLOR_EXT} + GLX_PSEUDO_COLOR_EXT = $8004; + {$EXTERNALSYM GLX_PSEUDO_COLOR_EXT} + GLX_STATIC_COLOR_EXT = $8005; + {$EXTERNALSYM GLX_STATIC_COLOR_EXT} + GLX_GRAY_SCALE_EXT = $8006; + {$EXTERNALSYM GLX_GRAY_SCALE_EXT} + GLX_STATIC_GRAY_EXT = $8007; + {$EXTERNALSYM GLX_STATIC_GRAY_EXT} + GLX_NONE_EXT = $8000; + {$EXTERNALSYM GLX_NONE_EXT} + GLX_TRANSPARENT_RGB_EXT = $8008; + {$EXTERNALSYM GLX_TRANSPARENT_RGB_EXT} + GLX_TRANSPARENT_INDEX_EXT = $8009; + {$EXTERNALSYM GLX_TRANSPARENT_INDEX_EXT} + GLX_VISUAL_CAVEAT_EXT = $20; + {$EXTERNALSYM GLX_VISUAL_CAVEAT_EXT} + GLX_SLOW_VISUAL_EXT = $8001; + {$EXTERNALSYM GLX_SLOW_VISUAL_EXT} + GLX_NON_CONFORMANT_VISUAL_EXT = $800D; + {$EXTERNALSYM GLX_NON_CONFORMANT_VISUAL_EXT} + GLX_SHARE_CONTEXT_EXT = $800A; + {$EXTERNALSYM GLX_SHARE_CONTEXT_EXT} + GLX_VISUAL_ID_EXT = $800B; + {$EXTERNALSYM GLX_VISUAL_ID_EXT} + GLX_SCREEN_EXT = $800C; + {$EXTERNALSYM GLX_SCREEN_EXT} + GLX_3DFX_WINDOW_MODE_MESA = $1; + {$EXTERNALSYM GLX_3DFX_WINDOW_MODE_MESA} + GLX_3DFX_FULLSCREEN_MODE_MESA = $2; + {$EXTERNALSYM GLX_3DFX_FULLSCREEN_MODE_MESA} + + +type + // GLU types + TGLUNurbs = record end; + TGLUQuadric = record end; + TGLUTesselator = record end; + + PGLUNurbs = ^TGLUNurbs; + PGLUQuadric = ^TGLUQuadric; + PGLUTesselator = ^TGLUTesselator; + + // backwards compatibility + TGLUNurbsObj = TGLUNurbs; + TGLUQuadricObj = TGLUQuadric; + TGLUTesselatorObj = TGLUTesselator; + TGLUTriangulatorObj = TGLUTesselator; + + PGLUNurbsObj = PGLUNurbs; + PGLUQuadricObj = PGLUQuadric; + PGLUTesselatorObj = PGLUTesselator; + PGLUTriangulatorObj = PGLUTesselator; + + {$IFDEF FPC} + {$IFDEF UNIX} + PALETTEENTRY = record + peRed : BYTE; + peGreen : BYTE; + peBlue : BYTE; + peFlags : BYTE; + end; + LPPALETTEENTRY = ^PALETTEENTRY; + tagPALETTEENTRY = PALETTEENTRY; + TPaletteEntry = PALETTEENTRY; + PPALETTEENTRY = ^PALETTEENTRY; + xid = txid; + pixmap = tpixmap; + font = tfont; + window = twindow; + colormap = tcolormap; + {$ENDIF} + + PMaxLogPalette = ^TMaxLogPalette; + TMaxLogPalette = packed record + palversion : word; + palnumentries : word; + palpalentry : array[byte] of TPaletteEntry; + end; + + {$ifdef WIN32} // If Windows + PWGLSwap = ^TWGLSwap; + {$EXTERNALSYM _WGLSWAP} + _WGLSWAP = packed record + hdc: HDC; + uiFlags: Cardinal; + end; + TWGLSwap = _WGLSWAP; + {$EXTERNALSYM WGLSWAP} + WGLSWAP = _WGLSWAP; + {$endif WIN32} + + {$ENDIF} + + {$ifdef VER100} // Delphi 3 + PWGLSwap = ^TWGLSwap; + {$EXTERNALSYM _WGLSWAP} + _WGLSWAP = packed record + hdc: HDC; + uiFlags: Cardinal; + end; + TWGLSwap = _WGLSWAP; + {$EXTERNALSYM WGLSWAP} + WGLSWAP = _WGLSWAP; + {$endif VER100} + + // Callback function prototypes + // GLUQuadricCallback + TGLUQuadricErrorProc = procedure(errorCode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + + // GLUTessCallback + TGLUTessBeginProc = procedure(AType: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + TGLUTessEdgeFlagProc = procedure(Flag: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + TGLUTessVertexProc = procedure(VertexData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + TGLUTessEndProc = procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + TGLUTessErrorProc = procedure(ErrNo: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + TGLUTessCombineProc = procedure(Coords: TVector3d; VertexData: TVector4p; Weight: TVector4f; OutData: PPointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + TGLUTessBeginDataProc = procedure(AType: TGLEnum; UserData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + TGLUTessEdgeFlagDataProc = procedure(Flag: TGLboolean; UserData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + TGLUTessVertexDataProc = procedure(VertexData: Pointer; UserData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + TGLUTessEndDataProc = procedure(UserData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + TGLUTessErrorDataProc = procedure(ErrNo: TGLEnum; UserData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + TGLUTessCombineDataProc = procedure(Coords: TVector3d; VertexData: TVector4p; Weight: TVector4f; OutData: PPointer; UserData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + + // GLUNurbsCallback + TGLUNurbsErrorProc = procedure(ErrorCode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + +var + // GL functions and procedures + glAccum: procedure(op: TGLuint; value: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glAccum} + glAlphaFunc: procedure(func: TGLEnum; ref: TGLclampf); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glAlphaFunc} + glAreTexturesResident: function(n: TGLsizei; Textures: PGLuint; residences: PGLboolean): TGLboolean; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glAreTexturesResident} + glArrayElement: procedure(i: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glArrayElement} + glBegin: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBegin} + glBindTexture: procedure(target: TGLEnum; texture: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBindTexture} + glBitmap: procedure(width: TGLsizei; height: TGLsizei; xorig, yorig: TGLfloat; xmove: TGLfloat; ymove: TGLfloat; bitmap: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBitmap} + glBlendFunc: procedure(sfactor: TGLEnum; dfactor: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBlendFunc} + glCallList: procedure(list: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCallList} + glCallLists: procedure(n: TGLsizei; atype: TGLEnum; lists: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCallLists} + glClear: procedure(mask: TGLbitfield); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glClear} + glClearAccum: procedure(red, green, blue, alpha: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glClearAccum} + glClearColor: procedure(red, green, blue, alpha: TGLclampf); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glClearColor} + glClearDepth: procedure(depth: TGLclampd); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glClearDepth} + glClearIndex: procedure(c: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glClearIndex} + glClearStencil: procedure(s: TGLint ); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glClearStencil} + glClipPlane: procedure(plane: TGLEnum; equation: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glClipPlane} + glColor3b: procedure(red, green, blue: TGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3b} + glColor3bv: procedure(v: PGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3bv} + glColor3d: procedure(red, green, blue: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3d} + glColor3dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3dv} + glColor3f: procedure(red, green, blue: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3f} + glColor3fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3fv} + glColor3i: procedure(red, green, blue: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3i} + glColor3iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3iv} + glColor3s: procedure(red, green, blue: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3s} + glColor3sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3sv} + glColor3ub: procedure(red, green, blue: TGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3ub} + glColor3ubv: procedure(v: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3ubv} + glColor3ui: procedure(red, green, blue: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3ui} + glColor3uiv: procedure(v: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3uiv} + glColor3us: procedure(red, green, blue: TGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3us} + glColor3usv: procedure(v: PGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3usv} + glColor4b: procedure(red, green, blue, alpha: TGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4b} + glColor4bv: procedure(v: PGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4bv} + glColor4d: procedure(red, green, blue, alpha: TGLdouble ); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4d} + glColor4dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4dv} + glColor4f: procedure(red, green, blue, alpha: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4f} + glColor4fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4fv} + glColor4i: procedure(red, green, blue, alpha: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4i} + glColor4iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4iv} + glColor4s: procedure(red, green, blue, alpha: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4s} + glColor4sv: procedure(v: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4sv} + glColor4ub: procedure(red, green, blue, alpha: TGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4ub} + glColor4ubv: procedure(v: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4ubv} + glColor4ui: procedure(red, green, blue, alpha: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4ui} + glColor4uiv: procedure(v: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4uiv} + glColor4us: procedure(red, green, blue, alpha: TGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4us} + glColor4usv: procedure(v: PGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4usv} + glColorMask: procedure(red, green, blue, alpha: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorMask} + glColorMaterial: procedure(face: TGLEnum; mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorMaterial} + glColorPointer: procedure(size: TGLint; atype: TGLEnum; stride: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorPointer} + glCopyPixels: procedure(x, y: TGLint; width, height: TGLsizei; atype: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyPixels} + glCopyTexImage1D: procedure(target: TGLEnum; level: TGLint; internalFormat: TGLEnum; x, y: TGLint; width: TGLsizei; border: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyTexImage1D} + glCopyTexImage2D: procedure(target: TGLEnum; level: TGLint; internalFormat: TGLEnum; x, y: TGLint; width, height: TGLsizei; border: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyTexImage2D} + glCopyTexSubImage1D: procedure(target: TGLEnum; level, xoffset, x, y: TGLint; width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyTexSubImage1D} + glCopyTexSubImage2D: procedure(target: TGLEnum; level, xoffset, yoffset, x, y: TGLint; width, height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyTexSubImage2D} + glCullFace: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCullFace} + glDeleteLists: procedure(list: TGLuint; range: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDeleteLists} + glDeleteTextures: procedure(n: TGLsizei; textures: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDeleteTextures} + glDepthFunc: procedure(func: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDepthFunc} + glDepthMask: procedure(flag: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDepthMask} + glDepthRange: procedure(zNear, zFar: TGLclampd); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDepthRange} + glDisable: procedure(cap: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDisable} + glDisableClientState: procedure(aarray: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDisableClientState} + glDrawArrays: procedure(mode: TGLEnum; first: TGLint; count: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDrawArrays} + glDrawBuffer: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDrawBuffer} + glDrawElements: procedure(mode: TGLEnum; count: TGLsizei; atype: TGLEnum; indices: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDrawElements} + glDrawPixels: procedure(width, height: TGLsizei; format, atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDrawPixels} + glEdgeFlag: procedure(flag: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEdgeFlag} + glEdgeFlagPointer: procedure(stride: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEdgeFlagPointer} + glEdgeFlagv: procedure(flag: PGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEdgeFlagv} + glEnable: procedure(cap: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEnable} + glEnableClientState: procedure(aarray: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEnableClientState} + glEnd: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEnd} + glEndList: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEndList} + glEvalCoord1d: procedure(u: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalCoord1d} + glEvalCoord1dv: procedure(u: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalCoord1dv} + glEvalCoord1f: procedure(u: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalCoord1f} + glEvalCoord1fv: procedure(u: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalCoord1fv} + glEvalCoord2d: procedure(u: TGLdouble; v: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalCoord2d} + glEvalCoord2dv: procedure(u: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalCoord2dv} + glEvalCoord2f: procedure(u, v: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalCoord2f} + glEvalCoord2fv: procedure(u: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalCoord2fv} + glEvalMesh1: procedure(mode: TGLEnum; i1, i2: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalMesh1} + glEvalMesh2: procedure(mode: TGLEnum; i1, i2, j1, j2: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalMesh2} + glEvalPoint1: procedure(i: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalPoint1} + glEvalPoint2: procedure(i, j: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalPoint2} + glFeedbackBuffer: procedure(size: TGLsizei; atype: TGLEnum; buffer: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFeedbackBuffer} + glFinish: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFinish} + glFlush: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFlush} + glFogf: procedure(pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFogf} + glFogfv: procedure(pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFogfv} + glFogi: procedure(pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFogi} + glFogiv: procedure(pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFogiv} + glFrontFace: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFrontFace} + glFrustum: procedure(left, right, bottom, top, zNear, zFar: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFrustum} + glGenLists: function(range: TGLsizei): TGLuint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGenLists} + glGenTextures: procedure(n: TGLsizei; textures: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGenTextures} + glGetBooleanv: procedure(pname: TGLEnum; params: PGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetBooleanv} + glGetClipPlane: procedure(plane: TGLEnum; equation: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetClipPlane} + glGetDoublev: procedure(pname: TGLEnum; params: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetDoublev} + glGetError: function: TGLuint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetError} + glGetFloatv: procedure(pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetFloatv} + glGetIntegerv: procedure(pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetIntegerv} + glGetLightfv: procedure(light, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetLightfv} + glGetLightiv: procedure(light, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetLightiv} + glGetMapdv: procedure(target, query: TGLEnum; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetMapdv} + glGetMapfv: procedure(target, query: TGLEnum; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetMapfv} + glGetMapiv: procedure(target, query: TGLEnum; v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetMapiv} + glGetMaterialfv: procedure(face, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetMaterialfv} + glGetMaterialiv: procedure(face, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetMaterialiv} + glGetPixelMapfv: procedure(map: TGLEnum; values: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetPixelMapfv} + glGetPixelMapuiv: procedure(map: TGLEnum; values: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetPixelMapuiv} + glGetPixelMapusv: procedure(map: TGLEnum; values: PGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetPixelMapusv} + glGetPointerv: procedure(pname: TGLEnum; var params); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetPointerv} + glGetPolygonStipple: procedure(mask: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetPolygonStipple} + glGetString: function(name: TGLEnum): PChar; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetString} + glGetTexEnvfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTexEnvfv} + glGetTexEnviv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTexEnviv} + glGetTexGendv: procedure(coord, pname: TGLEnum; params: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTexGendv} + glGetTexGenfv: procedure(coord, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTexGenfv} + glGetTexGeniv: procedure(coord, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTexGeniv} + glGetTexImage: procedure(target: TGLEnum; level: TGLint; format, atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTexImage} + glGetTexLevelParameterfv: procedure(target: TGLEnum; level: TGLint; pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTexLevelParameterfv} + glGetTexLevelParameteriv: procedure(target: TGLEnum; level: TGLint; pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTexLevelParameteriv} + glGetTexParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTexParameterfv} + glGetTexParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTexParameteriv} + glHint: procedure(target, mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glHint} + glIndexMask: procedure(mask: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexMask} + glIndexPointer: procedure(atype: TGLEnum; stride: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexPointer} + glIndexd: procedure(c: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexd} + glIndexdv: procedure(c: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexdv} + glIndexf: procedure(c: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexf} + glIndexfv: procedure(c: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexfv} + glIndexi: procedure(c: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexi} + glIndexiv: procedure(c: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexiv} + glIndexs: procedure(c: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexs} + glIndexsv: procedure(c: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexsv} + glIndexub: procedure(c: TGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexub} + glIndexubv: procedure(c: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexubv} + glInitNames: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glInitNames} + glInterleavedArrays: procedure(format: TGLEnum; stride: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glInterleavedArrays} + glIsEnabled: function(cap: TGLEnum): TGLboolean; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIsEnabled} + glIsList: function(list: TGLuint): TGLboolean; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIsList} + glIsTexture: function(texture: TGLuint): TGLboolean; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIsTexture} + glLightModelf: procedure(pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLightModelf} + glLightModelfv: procedure(pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLightModelfv} + glLightModeli: procedure(pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLightModeli} + glLightModeliv: procedure(pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLightModeliv} + glLightf: procedure(light, pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLightf} + glLightfv: procedure(light, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLightfv} + glLighti: procedure(light, pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLighti} + glLightiv: procedure(light, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLightiv} + glLineStipple: procedure(factor: TGLint; pattern: TGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLineStipple} + glLineWidth: procedure(width: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLineWidth} + glListBase: procedure(base: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glListBase} + glLoadIdentity: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLoadIdentity} + glLoadMatrixd: procedure(m: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLoadMatrixd} + glLoadMatrixf: procedure(m: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLoadMatrixf} + glLoadName: procedure(name: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLoadName} + glLogicOp: procedure(opcode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLogicOp} + glMap1d: procedure(target: TGLEnum; u1, u2: TGLdouble; stride, order: TGLint; points: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMap1d} + glMap1f: procedure(target: TGLEnum; u1, u2: TGLfloat; stride, order: TGLint; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMap1f} + glMap2d: procedure(target: TGLEnum; u1, u2: TGLdouble; ustride, uorder: TGLint; v1, v2: TGLdouble; vstride, + vorder: TGLint; points: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMap2d} + glMap2f: procedure(target: TGLEnum; u1, u2: TGLfloat; ustride, uorder: TGLint; v1, v2: TGLfloat; vstride, + vorder: TGLint; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMap2f} + glMapGrid1d: procedure(un: TGLint; u1, u2: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMapGrid1d} + glMapGrid1f: procedure(un: TGLint; u1, u2: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMapGrid1f} + glMapGrid2d: procedure(un: TGLint; u1, u2: TGLdouble; vn: TGLint; v1, v2: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMapGrid2d} + glMapGrid2f: procedure(un: TGLint; u1, u2: TGLfloat; vn: TGLint; v1, v2: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMapGrid2f} + glMaterialf: procedure(face, pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMaterialf} + glMaterialfv: procedure(face, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMaterialfv} + glMateriali: procedure(face, pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMateriali} + glMaterialiv: procedure(face, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMaterialiv} + glMatrixMode: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMatrixMode} + glMultMatrixd: procedure(m: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultMatrixd} + glMultMatrixf: procedure(m: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultMatrixf} + glNewList: procedure(list: TGLuint; mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNewList} + glNormal3b: procedure(nx, ny, nz: TGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3b} + glNormal3bv: procedure(v: PGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3bv} + glNormal3d: procedure(nx, ny, nz: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3d} + glNormal3dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3dv} + glNormal3f: procedure(nx, ny, nz: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3f} + glNormal3fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3fv} + glNormal3i: procedure(nx, ny, nz: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3i} + glNormal3iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3iv} + glNormal3s: procedure(nx, ny, nz: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3s} + glNormal3sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3sv} + glNormalPointer: procedure(atype: TGLEnum; stride: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormalPointer} + glOrtho: procedure(left, right, bottom, top, zNear, zFar: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glOrtho} + glPassThrough: procedure(token: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPassThrough} + glPixelMapfv: procedure(map: TGLEnum; mapsize: TGLsizei; values: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelMapfv} + glPixelMapuiv: procedure(map: TGLEnum; mapsize: TGLsizei; values: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelMapuiv} + glPixelMapusv: procedure(map: TGLEnum; mapsize: TGLsizei; values: PGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelMapusv} + glPixelStoref: procedure(pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelStoref} + glPixelStorei: procedure(pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelStorei} + glPixelTransferf: procedure(pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelTransferf} + glPixelTransferi: procedure(pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelTransferi} + glPixelZoom: procedure(xfactor, yfactor: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelZoom} + glPointSize: procedure(size: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPointSize} + glPolygonMode: procedure(face, mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPolygonMode} + glPolygonOffset: procedure(factor, units: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPolygonOffset} + glPolygonStipple: procedure(mask: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPolygonStipple} + glPopAttrib: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPopAttrib} + glPopClientAttrib: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPopClientAttrib} + glPopMatrix: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPopMatrix} + glPopName: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPopName} + glPrioritizeTextures: procedure(n: TGLsizei; textures: PGLuint; priorities: PGLclampf); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPrioritizeTextures} + glPushAttrib: procedure(mask: TGLbitfield); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPushAttrib} + glPushClientAttrib: procedure(mask: TGLbitfield); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPushClientAttrib} + glPushMatrix: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPushMatrix} + glPushName: procedure(name: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPushName} + glRasterPos2d: procedure(x, y: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos2d} + glRasterPos2dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos2dv} + glRasterPos2f: procedure(x, y: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos2f} + glRasterPos2fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos2fv} + glRasterPos2i: procedure(x, y: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos2i} + glRasterPos2iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos2iv} + glRasterPos2s: procedure(x, y: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos2s} + glRasterPos2sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos2sv} + glRasterPos3d: procedure(x, y, z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos3d} + glRasterPos3dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos3dv} + glRasterPos3f: procedure(x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos3f} + glRasterPos3fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos3fv} + glRasterPos3i: procedure(x, y, z: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos3i} + glRasterPos3iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos3iv} + glRasterPos3s: procedure(x, y, z: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos3s} + glRasterPos3sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos3sv} + glRasterPos4d: procedure(x, y, z, w: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos4d} + glRasterPos4dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos4dv} + glRasterPos4f: procedure(x, y, z, w: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos4f} + glRasterPos4fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos4fv} + glRasterPos4i: procedure(x, y, z, w: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos4i} + glRasterPos4iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos4iv} + glRasterPos4s: procedure(x, y, z, w: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos4s} + glRasterPos4sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos4sv} + glReadBuffer: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReadBuffer} + glReadPixels: procedure(x, y: TGLint; width, height: TGLsizei; format, atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReadPixels} + glRectd: procedure(x1, y1, x2, y2: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRectd} + glRectdv: procedure(v1, v2: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRectdv} + glRectf: procedure(x1, y1, x2, y2: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRectf} + glRectfv: procedure(v1, v2: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRectfv} + glRecti: procedure(x1, y1, x2, y2: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRecti} + glRectiv: procedure(v1, v2: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRectiv} + glRects: procedure(x1, y1, x2, y2: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRects} + glRectsv: procedure(v1, v2: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRectsv} + glRenderMode: function(mode: TGLEnum): TGLint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRenderMode} + glRotated: procedure(angle, x, y, z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRotated} + glRotatef: procedure(angle, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRotatef} + glScaled: procedure(x, y, z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glScaled} + glScalef: procedure(x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glScalef} + glScissor: procedure(x, y: TGLint; width, height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glScissor} + glSelectBuffer: procedure(size: TGLsizei; buffer: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSelectBuffer} + glShadeModel: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glShadeModel} + glStencilFunc: procedure(func: TGLEnum; ref: TGLint; mask: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glStencilFunc} + glStencilMask: procedure(mask: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glStencilMask} + glStencilOp: procedure(fail, zfail, zpass: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glStencilOp} + glTexCoord1d: procedure(s: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord1d} + glTexCoord1dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord1dv} + glTexCoord1f: procedure(s: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord1f} + glTexCoord1fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord1fv} + glTexCoord1i: procedure(s: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord1i} + glTexCoord1iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord1iv} + glTexCoord1s: procedure(s: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord1s} + glTexCoord1sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord1sv} + glTexCoord2d: procedure(s, t: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2d} + glTexCoord2dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2dv} + glTexCoord2f: procedure(s, t: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2f} + glTexCoord2fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2fv} + glTexCoord2i: procedure(s, t: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2i} + glTexCoord2iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2iv} + glTexCoord2s: procedure(s, t: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2s} + glTexCoord2sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2sv} + glTexCoord3d: procedure(s, t, r: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord3d} + glTexCoord3dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord3dv} + glTexCoord3f: procedure(s, t, r: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord3f} + glTexCoord3fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord3fv} + glTexCoord3i: procedure(s, t, r: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord3i} + glTexCoord3iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord3iv} + glTexCoord3s: procedure(s, t, r: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord3s} + glTexCoord3sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord3sv} + glTexCoord4d: procedure(s, t, r, q: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4d} + glTexCoord4dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4dv} + glTexCoord4f: procedure(s, t, r, q: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4f} + glTexCoord4fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4fv} + glTexCoord4i: procedure(s, t, r, q: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4i} + glTexCoord4iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4iv} + glTexCoord4s: procedure(s, t, r, q: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4s} + glTexCoord4sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4sv} + glTexCoordPointer: procedure(size: TGLint; atype: TGLEnum; stride: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoordPointer} + glTexEnvf: procedure(target, pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexEnvf} + glTexEnvfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexEnvfv} + glTexEnvi: procedure(target, pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexEnvi} + glTexEnviv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexEnviv} + glTexGend: procedure(coord, pname: TGLEnum; param: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexGend} + glTexGendv: procedure(coord, pname: TGLEnum; params: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexGendv} + glTexGenf: procedure(coord, pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexGenf} + glTexGenfv: procedure(coord, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexGenfv} + glTexGeni: procedure(coord, pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexGeni} + glTexGeniv: procedure(coord, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexGeniv} + glTexImage1D: procedure(target: TGLEnum; level, internalformat: TGLint; width: TGLsizei; border: TGLint; format, + atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexImage1D} + glTexImage2D: procedure(target: TGLEnum; level, internalformat: TGLint; width, height: TGLsizei; border: TGLint; + format, atype: TGLEnum; Pixels:Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexImage2D} + glTexParameterf: procedure(target, pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexParameterf} + glTexParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexParameterfv} + glTexParameteri: procedure(target, pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexParameteri} + glTexParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexParameteriv} + glTexSubImage1D: procedure(target: TGLEnum; level, xoffset: TGLint; width: TGLsizei; format, atype: TGLEnum; + pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexSubImage1D} + glTexSubImage2D: procedure(target: TGLEnum; level, xoffset, yoffset: TGLint; width, height: TGLsizei; format, + atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexSubImage2D} + glTranslated: procedure(x, y, z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTranslated} + glTranslatef: procedure(x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTranslatef} + glVertex2d: procedure(x, y: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex2d} + glVertex2dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex2dv} + glVertex2f: procedure(x, y: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex2f} + glVertex2fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex2fv} + glVertex2i: procedure(x, y: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex2i} + glVertex2iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex2iv} + glVertex2s: procedure(x, y: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex2s} + glVertex2sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex2sv} + glVertex3d: procedure(x, y, z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex3d} + glVertex3dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex3dv} + glVertex3f: procedure(x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex3f} + glVertex3fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex3fv} + glVertex3i: procedure(x, y, z: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex3i} + glVertex3iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex3iv} + glVertex3s: procedure(x, y, z: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex3s} + glVertex3sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex3sv} + glVertex4d: procedure(x, y, z, w: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex4d} + glVertex4dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex4dv} + glVertex4f: procedure(x, y, z, w: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex4f} + glVertex4fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex4fv} + glVertex4i: procedure(x, y, z, w: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex4i} + glVertex4iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex4iv} + glVertex4s: procedure(x, y, z, w: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex4s} + glVertex4sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex4sv} + glVertexPointer: procedure(size: TGLint; atype: TGLEnum; stride: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexPointer} + glViewport: procedure(x, y: TGLint; width, height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glViewport} + + // GL 1.2 + glDrawRangeElements: procedure(mode: TGLEnum; Astart, Aend: TGLuint; count: TGLsizei; Atype: TGLEnum; + indices: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDrawRangeElements} + glTexImage3D: procedure(target: TGLEnum; level: TGLint; internalformat: TGLEnum; width, height, depth: TGLsizei; + border: TGLint; format: TGLEnum; Atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexImage3D} + + // GL 1.2 ARB imaging + glBlendColor: procedure(red, green, blue, alpha: TGLclampf); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBlendColor} + glBlendEquation: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBlendEquation} + glColorSubTable: procedure(target: TGLEnum; start, count: TGLsizei; format, Atype: TGLEnum; data: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorSubTable} + glCopyColorSubTable: procedure(target: TGLEnum; start: TGLsizei; x, y: TGLint; width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyColorSubTable} + glColorTable: procedure(target, internalformat: TGLEnum; width: TGLsizei; format, Atype: TGLEnum; + table: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorTable} + glCopyColorTable: procedure(target, internalformat: TGLEnum; x, y: TGLint; width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyColorTable} + glColorTableParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorTableParameteriv} + glColorTableParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorTableParameterfv} + glGetColorTable: procedure(target, format, Atype: TGLEnum; table: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetColorTable} + glGetColorTableParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetColorTableParameteriv} + glGetColorTableParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetColorTableParameterfv} + glConvolutionFilter1D: procedure(target, internalformat: TGLEnum; width: TGLsizei; format, Atype: TGLEnum; + image: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionFilter1D} + glConvolutionFilter2D: procedure(target, internalformat: TGLEnum; width, height: TGLsizei; format, Atype: TGLEnum; + image: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionFilter2D} + glCopyConvolutionFilter1D: procedure(target, internalformat: TGLEnum; x, y: TGLint; width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyConvolutionFilter1D} + glCopyConvolutionFilter2D: procedure(target, internalformat: TGLEnum; x, y: TGLint; width, height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyConvolutionFilter2D} + glGetConvolutionFilter: procedure(target, internalformat, Atype: TGLEnum; image: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetConvolutionFilter} + glSeparableFilter2D: procedure(target, internalformat: TGLEnum; width, height: TGLsizei; format, Atype: TGLEnum; row, + column: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSeparableFilter2D} + glGetSeparableFilter: procedure(target, format, Atype: TGLEnum; row, column, span: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetSeparableFilter} + glConvolutionParameteri: procedure(target, pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionParameteri} + glConvolutionParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionParameteriv} + glConvolutionParameterf: procedure(target, pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionParameterf} + glConvolutionParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionParameterfv} + glGetConvolutionParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetConvolutionParameteriv} + glGetConvolutionParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetConvolutionParameterfv} + glHistogram: procedure(target: TGLEnum; width: TGLsizei; internalformat: TGLEnum; sink: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glHistogram} + glResetHistogram: procedure(target: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glResetHistogram} + glGetHistogram: procedure(target: TGLEnum; reset: TGLboolean; format, Atype: TGLEnum; values: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetHistogram} + glGetHistogramParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetHistogramParameteriv} + glGetHistogramParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetHistogramParameterfv} + glMinmax: procedure(target, internalformat: TGLEnum; sink: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMinmax} + glResetMinmax: procedure(target: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glResetMinmax} + glGetMinmax: procedure(target: TGLEnum; reset: TGLboolean; format, Atype: TGLEnum; values: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetMinmax} + glGetMinmaxParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetMinmaxParameteriv} + glGetMinmaxParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetMinmaxParameterfv} + + // GL utility functions and procedures + gluErrorString: function(errCode: TGLEnum): PChar; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluErrorString} + gluGetString: function(name: TGLEnum): PChar; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluGetString} + gluOrtho2D: procedure(left, right, bottom, top: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluOrtho2D} + gluPerspective: procedure(fovy, aspect, zNear, zFar: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluPerspective} + gluPickMatrix: procedure(x, y, width, height: TGLdouble; viewport: TVector4i); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluPickMatrix} + gluLookAt: procedure(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluLookAt} + gluProject: function(objx, objy, objz: TGLdouble; modelMatrix: TMatrix4d; projMatrix: TMatrix4d; viewport: TVector4i; + winx, winy, winz: PGLdouble): TGLint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluProject} + gluUnProject: function(winx, winy, winz: TGLdouble; modelMatrix: TMatrix4d; projMatrix: TMatrix4d; viewport: TVector4i; + objx, objy, objz: PGLdouble): TGLint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluUnProject} + gluScaleImage: function(format: TGLEnum; widthin, heightin: TGLint; typein: TGLEnum; datain: Pointer; widthout, + heightout: TGLint; typeout: TGLEnum; dataout: Pointer): TGLint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluScaleImage} + gluBuild1DMipmaps: function(target: TGLEnum; components, width: TGLint; format, atype: TGLEnum; + data: Pointer): TGLint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluBuild1DMipmaps} + gluBuild2DMipmaps: function(target: TGLEnum; components, width, height: TGLint; format, atype: TGLEnum; + Data: Pointer): TGLint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluBuild2DMipmaps} + gluNewQuadric: function: PGLUquadric; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluNewQuadric} + gluDeleteQuadric: procedure(state: PGLUquadric); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluDeleteQuadric} + gluQuadricNormals: procedure(quadObject: PGLUquadric; normals: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluQuadricNormals} + gluQuadricTexture: procedure(quadObject: PGLUquadric; textureCoords: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluQuadricTexture} + gluQuadricOrientation: procedure(quadObject: PGLUquadric; orientation: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluQuadricOrientation} + gluQuadricDrawStyle: procedure(quadObject: PGLUquadric; drawStyle: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluQuadricDrawStyle} + gluCylinder: procedure(quadObject: PGLUquadric; baseRadius, topRadius, height: TGLdouble; slices, + stacks: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluCylinder} + gluDisk: procedure(quadObject: PGLUquadric; innerRadius, outerRadius: TGLdouble; slices, loops: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluDisk} + gluPartialDisk: procedure(quadObject: PGLUquadric; innerRadius, outerRadius: TGLdouble; slices, loops: TGLint; + startAngle, sweepAngle: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluPartialDisk} + gluSphere: procedure(quadObject: PGLUquadric; radius: TGLdouble; slices, stacks: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluSphere} + gluQuadricCallback: procedure(quadObject: PGLUquadric; which: TGLEnum; fn: TGLUQuadricErrorProc); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluQuadricCallback} + gluNewTess: function: PGLUtesselator; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluNewTess} + gluDeleteTess: procedure(tess: PGLUtesselator); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluDeleteTess} + gluTessBeginPolygon: procedure(tess: PGLUtesselator; polygon_data: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluTessBeginPolygon} + gluTessBeginContour: procedure(tess: PGLUtesselator); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluTessBeginContour} + gluTessVertex: procedure(tess: PGLUtesselator; coords: TVector3d; data: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluTessVertex} + gluTessEndContour: procedure(tess: PGLUtesselator); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluTessEndContour} + gluTessEndPolygon: procedure(tess: PGLUtesselator); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluTessEndPolygon} + gluTessProperty: procedure(tess: PGLUtesselator; which: TGLEnum; value: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluTessProperty} + gluTessNormal: procedure(tess: PGLUtesselator; x, y, z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluTessNormal} + gluTessCallback: procedure(tess: PGLUtesselator; which: TGLEnum; fn: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluTessCallback} + gluGetTessProperty: procedure(tess: PGLUtesselator; which: TGLEnum; value: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluGetTessProperty} + gluNewNurbsRenderer: function: PGLUnurbs; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluNewNurbsRenderer} + gluDeleteNurbsRenderer: procedure(nobj: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluDeleteNurbsRenderer} + gluBeginSurface: procedure(nobj: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluBeginSurface} + gluBeginCurve: procedure(nobj: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluBeginCurve} + gluEndCurve: procedure(nobj: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluEndCurve} + gluEndSurface: procedure(nobj: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluEndSurface} + gluBeginTrim: procedure(nobj: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluBeginTrim} + gluEndTrim: procedure(nobj: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluEndTrim} + gluPwlCurve: procedure(nobj: PGLUnurbs; count: TGLint; points: PGLfloat; stride: TGLint; atype: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluPwlCurve} + gluNurbsCurve: procedure(nobj: PGLUnurbs; nknots: TGLint; knot: PGLfloat; stride: TGLint; ctlarray: PGLfloat; order: TGLint; atype: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluNurbsCurve} + gluNurbsSurface: procedure(nobj: PGLUnurbs; sknot_count: TGLint; sknot: PGLfloat; tknot_count: TGLint; tknot: PGLfloat; s_stride, t_stride: TGLint; ctlarray: PGLfloat; sorder, torder: TGLint; atype: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluNurbsSurface} + gluLoadSamplingMatrices: procedure(nobj: PGLUnurbs; modelMatrix, projMatrix: TMatrix4f; viewport: TVector4i); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluLoadSamplingMatrices} + gluNurbsProperty: procedure(nobj: PGLUnurbs; aproperty: TGLEnum; value: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluNurbsProperty} + gluGetNurbsProperty: procedure(nobj: PGLUnurbs; aproperty: TGLEnum; value: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluGetNurbsProperty} + gluNurbsCallback: procedure(nobj: PGLUnurbs; which: TGLEnum; fn: TGLUNurbsErrorProc); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluNurbsCallback} + gluBeginPolygon: procedure(tess: PGLUtesselator); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluBeginPolygon} + gluNextContour: procedure(tess: PGLUtesselator; atype: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluNextContour} + gluEndPolygon: procedure(tess: PGLUtesselator); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluEndPolygon} + + // window support functions + {$ifdef Win32} + wglGetProcAddress: function(ProcName: PChar): Pointer; stdcall; + {$EXTERNALSYM wglGetProcAddress} + wglCopyContext: function(p1: HGLRC; p2: HGLRC; p3: Cardinal): BOOL; stdcall; + {$EXTERNALSYM wglCopyContext} + wglCreateContext: function(DC: HDC): HGLRC; stdcall; + {$EXTERNALSYM wglCreateContext} + wglCreateLayerContext: function(p1: HDC; p2: Integer): HGLRC; stdcall; + {$EXTERNALSYM wglCreateLayerContext} + wglDeleteContext: function(p1: HGLRC): BOOL; stdcall; + {$EXTERNALSYM wglDeleteContext} + wglDescribeLayerPlane:function(p1: HDC; p2, p3: Integer; p4: Cardinal; var p5: TLayerPlaneDescriptor): BOOL; stdcall; + {$EXTERNALSYM wglDescribeLayerPlane} + wglGetCurrentContext: function: HGLRC; stdcall; + {$EXTERNALSYM wglGetCurrentContext} + wglGetCurrentDC: function: HDC; stdcall; + {$EXTERNALSYM wglGetCurrentDC} + wglGetLayerPaletteEntries: function(p1: HDC; p2, p3, p4: Integer; var pcr): Integer; stdcall; + {$EXTERNALSYM wglGetLayerPaletteEntries} + wglMakeCurrent: function(DC: HDC; p2: HGLRC): BOOL; stdcall; + {$EXTERNALSYM wglMakeCurrent} + wglRealizeLayerPalette: function(p1: HDC; p2: Integer; p3: BOOL): BOOL; stdcall; + {$EXTERNALSYM wglRealizeLayerPalette} + wglSetLayerPaletteEntries: function(p1: HDC; p2, p3, p4: Integer; var pcr): Integer; stdcall; + {$EXTERNALSYM wglSetLayerPaletteEntries} + wglShareLists: function(p1, p2: HGLRC): BOOL; stdcall; + {$EXTERNALSYM wglShareLists} + wglSwapLayerBuffers: function(p1: HDC; p2: Cardinal): BOOL; stdcall; + {$EXTERNALSYM wglSwapLayerBuffers} + wglSwapMultipleBuffers: function(p1: Cardinal; const p2: PWGLSwap): DWORD; stdcall; + {$EXTERNALSYM wglSwapMultipleBuffers} + wglUseFontBitmapsA: function(DC: HDC; p2, p3, p4: DWORD): BOOL; stdcall; + {$EXTERNALSYM wglUseFontBitmapsA} + wglUseFontOutlinesA: function (p1: HDC; p2, p3, p4: DWORD; p5, p6: Single; p7: Integer; p8: PGlyphMetricsFloat): BOOL; stdcall; + {$EXTERNALSYM wglUseFontOutlinesA} + wglUseFontBitmapsW: function(DC: HDC; p2, p3, p4: DWORD): BOOL; stdcall; + {$EXTERNALSYM wglUseFontBitmapsW} + wglUseFontOutlinesW: function (p1: HDC; p2, p3, p4: DWORD; p5, p6: Single; p7: Integer; p8: PGlyphMetricsFloat): BOOL; stdcall; + {$EXTERNALSYM wglUseFontOutlinesW} + wglUseFontBitmaps: function(DC: HDC; p2, p3, p4: DWORD): BOOL; stdcall; + {$EXTERNALSYM wglUseFontBitmaps} + wglUseFontOutlines: function(p1: HDC; p2, p3, p4: DWORD; p5, p6: Single; p7: Integer; p8: PGlyphMetricsFloat): BOOL; stdcall; + {$EXTERNALSYM wglUseFontOutlines} + + // ARB wgl extensions + wglGetExtensionsStringARB: function(DC: HDC): PChar; stdcall; + {$EXTERNALSYM wglGetExtensionsStringARB} + wglGetPixelFormatAttribivARB: function(DC: HDC; iPixelFormat, iLayerPlane: Integer; nAttributes: Cardinal; + const piAttributes: PInteger; piValues : PInteger) : BOOL; stdcall; + {$EXTERNALSYM wglGetPixelFormatAttribivARB} + wglGetPixelFormatAttribfvARB: function(DC: HDC; iPixelFormat, iLayerPlane: Integer; nAttributes: Cardinal; + const piAttributes: PInteger; piValues: PGLFloat) : BOOL; stdcall; + {$EXTERNALSYM wglGetPixelFormatAttribfvARB} + wglChoosePixelFormatARB: function(DC: HDC; const piAttribIList: PInteger; const pfAttribFList: PGLFloat; + nMaxFormats: Cardinal; piFormats: PInteger; nNumFormats: PCardinal) : BOOL; stdcall; + {$EXTERNALSYM wglChoosePixelFormatARB} + {$endif} + + // ARB_multitexture + glMultiTexCoord1dARB: procedure(target: TGLenum; s: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord1dARB} + glMultiTexCoord1dVARB: procedure(target: TGLenum; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord1dVARB} + glMultiTexCoord1fARBP: procedure(target: TGLenum; s: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord1fARBP} + glMultiTexCoord1fVARB: procedure(target: TGLenum; v: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord1fVARB} + glMultiTexCoord1iARB: procedure(target: TGLenum; s: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord1iARB} + glMultiTexCoord1iVARB: procedure(target: TGLenum; v: PGLInt); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord1iVARB} + glMultiTexCoord1sARBP: procedure(target: TGLenum; s: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord1sARBP} + glMultiTexCoord1sVARB: procedure(target: TGLenum; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord1sVARB} + glMultiTexCoord2dARB: procedure(target: TGLenum; s, t: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord2dARB} + glMultiTexCoord2dvARB: procedure(target: TGLenum; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord2dvARB} + glMultiTexCoord2fARB: procedure(target: TGLenum; s, t: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord2fARB} + glMultiTexCoord2fvARB: procedure(target: TGLenum; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord2fvARB} + glMultiTexCoord2iARB: procedure(target: TGLenum; s, t: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord2iARB} + glMultiTexCoord2ivARB: procedure(target: TGLenum; v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord2ivARB} + glMultiTexCoord2sARB: procedure(target: TGLenum; s, t: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord2sARB} + glMultiTexCoord2svARB: procedure(target: TGLenum; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord2svARB} + glMultiTexCoord3dARB: procedure(target: TGLenum; s, t, r: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord3dARB} + glMultiTexCoord3dvARB: procedure(target: TGLenum; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord3dvARB} + glMultiTexCoord3fARB: procedure(target: TGLenum; s, t, r: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord3fARB} + glMultiTexCoord3fvARB: procedure(target: TGLenum; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord3fvARB} + glMultiTexCoord3iARB: procedure(target: TGLenum; s, t, r: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord3iARB} + glMultiTexCoord3ivARB: procedure(target: TGLenum; v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord3ivARB} + glMultiTexCoord3sARB: procedure(target: TGLenum; s, t, r: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord3sARB} + glMultiTexCoord3svARB: procedure(target: TGLenum; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord3svARB} + glMultiTexCoord4dARB: procedure(target: TGLenum; s, t, r, q: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord4dARB} + glMultiTexCoord4dvARB: procedure(target: TGLenum; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord4dvARB} + glMultiTexCoord4fARB: procedure(target: TGLenum; s, t, r, q: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord4fARB} + glMultiTexCoord4fvARB: procedure(target: TGLenum; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord4fvARB} + glMultiTexCoord4iARB: procedure(target: TGLenum; s, t, r, q: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord4iARB} + glMultiTexCoord4ivARB: procedure(target: TGLenum; v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord4ivARB} + glMultiTexCoord4sARB: procedure(target: TGLenum; s, t, r, q: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord4sARB} + glMultiTexCoord4svARB: procedure(target: TGLenum; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord4svARB} + glActiveTextureARB: procedure(target: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glActiveTextureARB} + glClientActiveTextureARB: procedure(target: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glClientActiveTextureARB} + + // GLU extensions + gluNurbsCallbackDataEXT: procedure(nurb: PGLUnurbs; userData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluNurbsCallbackDataEXT} + gluNewNurbsTessellatorEXT: function: PGLUnurbs; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluNewNurbsTessellatorEXT} + gluDeleteNurbsTessellatorEXT: procedure(nurb: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluDeleteNurbsTessellatorEXT} + +{$ifndef FPC} + {$ifdef MULTITHREADOPENGL} + threadvar + {$else} + var + {$endif} +{$else} +var +{$endif} + // Extension functions + glAreTexturesResidentEXT: function(n: TGLsizei; textures: PGLuint; residences: PGLBoolean): TGLboolean; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glAreTexturesResidentEXT} + glArrayElementArrayEXT: procedure(mode: TGLEnum; count: TGLsizei; pi: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glArrayElementArrayEXT} + glBeginSceneEXT: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBeginSceneEXT} + glBindTextureEXT: procedure(target: TGLEnum; texture: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBindTextureEXT} + glColorTableEXT: procedure(target, internalFormat: TGLEnum; width: TGLsizei; format, atype: TGLEnum; data: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorTableEXT} + glColorSubTableExt: procedure(target: TGLEnum; start, count: TGLsizei; format, atype: TGLEnum; data: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorSubTableExt} + glCopyTexImage1DEXT: procedure(target: TGLEnum; level: TGLint; internalFormat: TGLEnum; x, y: TGLint; width: TGLsizei; border: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyTexImage1DEXT} + glCopyTexSubImage1DEXT: procedure(target: TGLEnum; level, xoffset, x, y: TGLint; width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyTexSubImage1DEXT} + glCopyTexImage2DEXT: procedure(target: TGLEnum; level: TGLint; internalFormat: TGLEnum; x, y: TGLint; width, height: TGLsizei; border: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyTexImage2DEXT} + glCopyTexSubImage2DEXT: procedure(target: TGLEnum; level, xoffset, yoffset, x, y: TGLint; width, height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyTexSubImage2DEXT} + glCopyTexSubImage3DEXT: procedure(target: TGLEnum; level, xoffset, yoffset, zoffset, x, y: TGLint; width, height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyTexSubImage3DEXT} + glDeleteTexturesEXT: procedure(n: TGLsizei; textures: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDeleteTexturesEXT} + glEndSceneEXT: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEndSceneEXT} + glGenTexturesEXT: procedure(n: TGLsizei; textures: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGenTexturesEXT} + glGetColorTableEXT: procedure(target, format, atype: TGLEnum; data: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetColorTableEXT} + glGetColorTablePameterfvEXT: procedure(target, pname: TGLEnum; params: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetColorTablePameterfvEXT} + glGetColorTablePameterivEXT: procedure(target, pname: TGLEnum; params: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetColorTablePameterivEXT} + glIndexFuncEXT: procedure(func: TGLEnum; ref: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexFuncEXT} + glIndexMaterialEXT: procedure(face: TGLEnum; mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexMaterialEXT} + glIsTextureEXT: function(texture: TGLuint): TGLboolean; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIsTextureEXT} + glLockArraysEXT: procedure(first: TGLint; count: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLockArraysEXT} + glPolygonOffsetEXT: procedure(factor, bias: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPolygonOffsetEXT} + glPrioritizeTexturesEXT: procedure(n: TGLsizei; textures: PGLuint; priorities: PGLclampf); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPrioritizeTexturesEXT} + glTexSubImage1DEXT: procedure(target: TGLEnum; level, xoffset: TGLint; width: TGLsizei; format, Atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexSubImage1DEXT} + glTexSubImage2DEXT: procedure(target: TGLEnum; level, xoffset, yoffset: TGLint; width, height: TGLsizei; format, Atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexSubImage2DEXT} + glTexSubImage3DEXT: procedure(target: TGLEnum; level, xoffset, yoffset, zoffset: TGLint; width, height, depth: TGLsizei; format, Atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexSubImage3DEXT} + glUnlockArraysEXT: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glUnlockArraysEXT} + + // EXT_vertex_array + glArrayElementEXT: procedure(I: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glArrayElementEXT} + glColorPointerEXT: procedure(size: TGLInt; atype: TGLenum; stride, count: TGLsizei; data: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorPointerEXT} + glDrawArraysEXT: procedure(mode: TGLenum; first: TGLInt; count: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDrawArraysEXT} + glEdgeFlagPointerEXT: procedure(stride, count: TGLsizei; data: PGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEdgeFlagPointerEXT} + glGetPointervEXT: procedure(pname: TGLEnum; var params); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetPointervEXT} + glIndexPointerEXT: procedure(AType: TGLEnum; stride, count: TGLsizei; P: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexPointerEXT} + glNormalPointerEXT: procedure(AType: TGLsizei; stride, count: TGLsizei; P: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormalPointerEXT} + glTexCoordPointerEXT: procedure(size: TGLint; AType: TGLenum; stride, count: TGLsizei; P: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoordPointerEXT} + glVertexPointerEXT: procedure(size: TGLint; AType: TGLenum; stride, count: TGLsizei; P: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexPointerEXT} + + // EXT_compiled_vertex_array + glLockArrayEXT: procedure(first: TGLint; count: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLockArrayEXT} + glUnlockArrayEXT: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glUnlockArrayEXT} + + // EXT_cull_vertex + glCullParameterdvEXT: procedure(pname: TGLenum; params: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCullParameterdvEXT} + glCullParameterfvEXT: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCullParameterfvEXT} + + // WIN_swap_hint + glAddSwapHintRectWIN: procedure(x, y: TGLint; width, height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glAddSwapHintRectWIN} + + // EXT_point_parameter + glPointParameterfEXT: procedure(pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPointParameterfEXT} + glPointParameterfvEXT: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPointParameterfvEXT} + + // GL_ARB_transpose_matrix + glLoadTransposeMatrixfARB: procedure(m: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLoadTransposeMatrixfARB} + glLoadTransposeMatrixdARB: procedure(m: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLoadTransposeMatrixdARB} + glMultTransposeMatrixfARB: procedure(m: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultTransposeMatrixfARB} + glMultTransposeMatrixdARB: procedure(m: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultTransposeMatrixdARB} + + // GL_ARB_multisample + glSampleCoverageARB: procedure(Value: TGLclampf; invert: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSampleCoverageARB} + glSamplePassARB: procedure(pass: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSamplePassARB} + + // GL_ARB_texture_compression + glCompressedTexImage3DARB: procedure(target: TGLenum; level: TGLint; internalformat: TGLenum; Width, Height, depth: TGLsizei; border: TGLint; imageSize: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCompressedTexImage3DARB} + glCompressedTexImage2DARB: procedure(target: TGLenum; level: TGLint; internalformat: TGLenum; Width, Height: TGLsizei; border: TGLint; imageSize: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCompressedTexImage2DARB} + glCompressedTexImage1DARB: procedure(target: TGLenum; level: TGLint; internalformat: TGLenum; Width: TGLsizei; border: TGLint; imageSize: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCompressedTexImage1DARB} + glCompressedTexSubImage3DARB: procedure(target: TGLenum; level: TGLint; xoffset, yoffset, zoffset: TGLint; width, height, depth: TGLsizei; Format: TGLenum; imageSize: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCompressedTexSubImage3DARB} + glCompressedTexSubImage2DARB: procedure(target: TGLenum; level: TGLint; xoffset, yoffset: TGLint; width, height: TGLsizei; Format: TGLenum; imageSize: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCompressedTexSubImage2DARB} + glCompressedTexSubImage1DARB: procedure(target: TGLenum; level: TGLint; xoffset: TGLint; width: TGLsizei; Format: TGLenum; imageSize: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCompressedTexSubImage1DARB} + glGetCompressedTexImageARB: procedure(target: TGLenum; level: TGLint; img: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetCompressedTexImageARB} + + // GL_EXT_blend_color + glBlendColorEXT: procedure(red, green, blue: TGLclampf; alpha: TGLclampf); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBlendColorEXT} + + // GL_EXT_texture3D + glTexImage3DEXT: procedure(target: TGLenum; level: TGLint; internalformat: TGLenum; width, height, depth: TGLsizei; border: TGLint; Format, AType: TGLenum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexImage3DEXT} + + // GL_SGIS_texture_filter4 + glGetTexFilterFuncSGIS: procedure(target, Filter: TGLenum; weights: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTexFilterFuncSGIS} + glTexFilterFuncSGIS: procedure(target, Filter: TGLenum; n: TGLsizei; weights: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexFilterFuncSGIS} + + // GL_EXT_histogram + glGetHistogramEXT: procedure(target: TGLenum; reset: TGLboolean; Format, AType: TGLenum; values: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetHistogramEXT} + glGetHistogramParameterfvEXT: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetHistogramParameterfvEXT} + glGetHistogramParameterivEXT: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetHistogramParameterivEXT} + glGetMinmaxEXT: procedure(target: TGLenum; reset: TGLboolean; Format, AType: TGLenum; values: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetMinmaxEXT} + glGetMinmaxParameterfvEXT: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetMinmaxParameterfvEXT} + glGetMinmaxParameterivEXT: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetMinmaxParameterivEXT} + glHistogramEXT: procedure(target: TGLenum; Width: TGLsizei; internalformat: TGLenum; sink: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glHistogramEXT} + glMinmaxEXT: procedure(target, internalformat: TGLenum; sink: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMinmaxEXT} + glResetHistogramEXT: procedure(target: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glResetHistogramEXT} + glResetMinmaxEXT: procedure(target: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glResetMinmaxEXT} + + // GL_EXT_convolution + glConvolutionFilter1DEXT: procedure(target, internalformat: TGLenum; Width: TGLsizei; Format, AType: TGLenum; image: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionFilter1DEXT} + glConvolutionFilter2DEXT: procedure(target, internalformat: TGLenum; Width, Height: TGLsizei; Format, AType: TGLenum; image: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionFilter2DEXT} + glConvolutionParameterfEXT: procedure(target, pname: TGLenum; params: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionParameterfEXT} + glConvolutionParameterfvEXT: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionParameterfvEXT} + glConvolutionParameteriEXT: procedure(target, pname: TGLenum; params: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionParameteriEXT} + glConvolutionParameterivEXT: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionParameterivEXT} + glCopyConvolutionFilter1DEXT: procedure(target, internalformat: TGLenum; x, y: TGLint; Width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyConvolutionFilter1DEXT} + glCopyConvolutionFilter2DEXT: procedure(target, internalformat: TGLenum; x, y: TGLint; Width, Height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyConvolutionFilter2DEXT} + glGetConvolutionFilterEXT: procedure(target, Format, AType: TGLenum; image: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetConvolutionFilterEXT} + glGetConvolutionParameterfvEXT: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetConvolutionParameterfvEXT} + glGetConvolutionParameterivEXT: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetConvolutionParameterivEXT} + glGetSeparableFilterEXT: procedure(target, Format, AType: TGLenum; row, column, span: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetSeparableFilterEXT} + glSeparableFilter2DEXT: procedure(target, internalformat: TGLenum; Width, Height: TGLsizei; Format, AType: TGLenum; row, column: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSeparableFilter2DEXT} + + // GL_SGI_color_table + glColorTableSGI: procedure(target, internalformat: TGLenum; Width: TGLsizei; Format, AType: TGLenum; Table: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorTableSGI} + glColorTableParameterfvSGI: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorTableParameterfvSGI} + glColorTableParameterivSGI: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorTableParameterivSGI} + glCopyColorTableSGI: procedure(target, internalformat: TGLenum; x, y: TGLint; Width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyColorTableSGI} + glGetColorTableSGI: procedure(target, Format, AType: TGLenum; Table: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetColorTableSGI} + glGetColorTableParameterfvSGI: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetColorTableParameterfvSGI} + glGetColorTableParameterivSGI: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetColorTableParameterivSGI} + + // GL_SGIX_pixel_texture + glPixelTexGenSGIX: procedure(mode: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelTexGenSGIX} + + // GL_SGIS_pixel_texture + glPixelTexGenParameteriSGIS: procedure(pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelTexGenParameteriSGIS} + glPixelTexGenParameterivSGIS: procedure(pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelTexGenParameterivSGIS} + glPixelTexGenParameterfSGIS: procedure(pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelTexGenParameterfSGIS} + glPixelTexGenParameterfvSGIS: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelTexGenParameterfvSGIS} + glGetPixelTexGenParameterivSGIS: procedure(pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetPixelTexGenParameterivSGIS} + glGetPixelTexGenParameterfvSGIS: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetPixelTexGenParameterfvSGIS} + + // GL_SGIS_texture4D + glTexImage4DSGIS: procedure(target: TGLenum; level: TGLint; internalformat: TGLenum; Width, Height, depth, size4d: TGLsizei; border: TGLint; Format, AType: TGLenum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexImage4DSGIS} + glTexSubImage4DSGIS: procedure(target: TGLenum; level, xoffset, yoffset, zoffset, woffset: TGLint; Width, Height, depth, size4d: TGLsizei; Format, AType: TGLenum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexSubImage4DSGIS} + + // GL_SGIS_detail_texture + glDetailTexFuncSGIS: procedure(target: TGLenum; n: TGLsizei; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDetailTexFuncSGIS} + glGetDetailTexFuncSGIS: procedure(target: TGLenum; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetDetailTexFuncSGIS} + + // GL_SGIS_sharpen_texture + glSharpenTexFuncSGIS: procedure(target: TGLenum; n: TGLsizei; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSharpenTexFuncSGIS} + glGetSharpenTexFuncSGIS: procedure(target: TGLenum; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetSharpenTexFuncSGIS} + + // GL_SGIS_multisample + glSampleMaskSGIS: procedure(Value: TGLclampf; invert: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSampleMaskSGIS} + glSamplePatternSGIS: procedure(pattern: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSamplePatternSGIS} + + // GL_EXT_blend_minmax + glBlendEquationEXT: procedure(mode: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBlendEquationEXT} + + // GL_SGIX_sprite + glSpriteParameterfSGIX: procedure(pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSpriteParameterfSGIX} + glSpriteParameterfvSGIX: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSpriteParameterfvSGIX} + glSpriteParameteriSGIX: procedure(pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSpriteParameteriSGIX} + glSpriteParameterivSGIX: procedure(pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSpriteParameterivSGIX} + + // GL_EXT_point_parameters + glPointParameterfSGIS: procedure(pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPointParameterfSGIS} + glPointParameterfvSGIS: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPointParameterfvSGIS} + + // GL_SGIX_instruments + glGetInstrumentsSGIX: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetInstrumentsSGIX} + glInstrumentsBufferSGIX: procedure(Size: TGLsizei; buffer: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glInstrumentsBufferSGIX} + glPollInstrumentsSGIX: procedure(marker_p: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPollInstrumentsSGIX} + glReadInstrumentsSGIX: procedure(marker: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReadInstrumentsSGIX} + glStartInstrumentsSGIX: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glStartInstrumentsSGIX} + glStopInstrumentsSGIX: procedure(marker: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glStopInstrumentsSGIX} + + // GL_SGIX_framezoom + glFrameZoomSGIX: procedure(factor: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFrameZoomSGIX} + + // GL_SGIX_tag_sample_buffer + glTagSampleBufferSGIX: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTagSampleBufferSGIX} + + // GL_SGIX_polynomial_ffd + glDeformationMap3dSGIX: procedure(target: TGLenum; u1, u2: TGLdouble; ustride, uorder: TGLint; v1, v2: TGLdouble; vstride, vorder: TGLint; w1, w2: TGLdouble; wstride, worder: TGLint; points: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDeformationMap3dSGIX} + glDeformationMap3fSGIX: procedure(target: TGLenum; u1, u2: TGLfloat; ustride, uorder: TGLint; v1, v2: TGLfloat; vstride, vorder: TGLint; w1, w2: TGLfloat; wstride, worder: TGLint; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDeformationMap3fSGIX} + glDeformSGIX: procedure(mask: TGLbitfield); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDeformSGIX} + glLoadIdentityDeformationMapSGIX: procedure(mask: TGLbitfield); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLoadIdentityDeformationMapSGIX} + + // GL_SGIX_reference_plane + glReferencePlaneSGIX: procedure(equation: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReferencePlaneSGIX} + + // GL_SGIX_flush_raster + glFlushRasterSGIX: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFlushRasterSGIX} + + // GL_SGIS_fog_function + glFogFuncSGIS: procedure(n: TGLsizei; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFogFuncSGIS} + glGetFogFuncSGIS: procedure(points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetFogFuncSGIS} + + // GL_HP_image_transform + glImageTransformParameteriHP: procedure(target, pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glImageTransformParameteriHP} + glImageTransformParameterfHP: procedure(target, pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glImageTransformParameterfHP} + glImageTransformParameterivHP: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glImageTransformParameterivHP} + glImageTransformParameterfvHP: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glImageTransformParameterfvHP} + glGetImageTransformParameterivHP: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetImageTransformParameterivHP} + glGetImageTransformParameterfvHP: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetImageTransformParameterfvHP} + + // GL_EXT_color_subtable + glCopyColorSubTableEXT: procedure(target: TGLenum; start: TGLsizei; x, y: TGLint; Width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyColorSubTableEXT} + + // GL_PGI_misc_hints + glHintPGI: procedure(target: TGLenum; mode: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glHintPGI} + + // GL_EXT_paletted_texture + glGetColorTableParameterivEXT: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetColorTableParameterivEXT} + glGetColorTableParameterfvEXT: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetColorTableParameterfvEXT} + + // GL_SGIX_list_priority + glGetListParameterfvSGIX: procedure(list: TGLuint; pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetListParameterfvSGIX} + glGetListParameterivSGIX: procedure(list: TGLuint; pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetListParameterivSGIX} + glListParameterfSGIX: procedure(list: TGLuint; pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glListParameterfSGIX} + glListParameterfvSGIX: procedure(list: TGLuint; pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glListParameterfvSGIX} + glListParameteriSGIX: procedure(list: TGLuint; pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glListParameteriSGIX} + glListParameterivSGIX: procedure(list: TGLuint; pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glListParameterivSGIX} + + // GL_SGIX_fragment_lighting + glFragmentColorMaterialSGIX: procedure(face, mode: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentColorMaterialSGIX} + glFragmentLightfSGIX: procedure(light, pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentLightfSGIX} + glFragmentLightfvSGIX: procedure(light, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentLightfvSGIX} + glFragmentLightiSGIX: procedure(light, pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentLightiSGIX} + glFragmentLightivSGIX: procedure(light, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentLightivSGIX} + glFragmentLightModelfSGIX: procedure(pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentLightModelfSGIX} + glFragmentLightModelfvSGIX: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentLightModelfvSGIX} + glFragmentLightModeliSGIX: procedure(pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentLightModeliSGIX} + glFragmentLightModelivSGIX: procedure(pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentLightModelivSGIX} + glFragmentMaterialfSGIX: procedure(face, pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentMaterialfSGIX} + glFragmentMaterialfvSGIX: procedure(face, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentMaterialfvSGIX} + glFragmentMaterialiSGIX: procedure(face, pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentMaterialiSGIX} + glFragmentMaterialivSGIX: procedure(face, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentMaterialivSGIX} + glGetFragmentLightfvSGIX: procedure(light, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetFragmentLightfvSGIX} + glGetFragmentLightivSGIX: procedure(light, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetFragmentLightivSGIX} + glGetFragmentMaterialfvSGIX: procedure(face, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetFragmentMaterialfvSGIX} + glGetFragmentMaterialivSGIX: procedure(face, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetFragmentMaterialivSGIX} + glLightEnviSGIX: procedure(pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLightEnviSGIX} + + // GL_EXT_draw_range_elements + glDrawRangeElementsEXT: procedure(mode: TGLenum; start, Aend: TGLuint; Count: TGLsizei; Atype: TGLenum; indices: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDrawRangeElementsEXT} + + // GL_EXT_light_texture + glApplyTextureEXT: procedure(mode: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glApplyTextureEXT} + glTextureLightEXT: procedure(pname: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTextureLightEXT} + glTextureMaterialEXT: procedure(face, mode: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTextureMaterialEXT} + + // GL_SGIX_async + glAsyncMarkerSGIX: procedure(marker: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glAsyncMarkerSGIX} + glFinishAsyncSGIX: procedure(markerp: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFinishAsyncSGIX} + glPollAsyncSGIX: procedure(markerp: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPollAsyncSGIX} + glGenAsyncMarkersSGIX: procedure(range: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGenAsyncMarkersSGIX} + glDeleteAsyncMarkersSGIX: procedure(marker: TGLuint; range: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDeleteAsyncMarkersSGIX} + glIsAsyncMarkerSGIX: procedure(marker: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIsAsyncMarkerSGIX} + + // GL_INTEL_parallel_arrays + glVertexPointervINTEL: procedure(size: TGLint; Atype: TGLenum; var P); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexPointervINTEL} + glNormalPointervINTEL: procedure(Atype: TGLenum; var P); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormalPointervINTEL} + glColorPointervINTEL: procedure(size: TGLint; Atype: TGLenum; var P); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorPointervINTEL} + glTexCoordPointervINTEL: procedure(size: TGLint; Atype: TGLenum; var P); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoordPointervINTEL} + + // GL_EXT_pixel_transform + glPixelTransformParameteriEXT: procedure(target, pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelTransformParameteriEXT} + glPixelTransformParameterfEXT: procedure(target, pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelTransformParameterfEXT} + glPixelTransformParameterivEXT: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelTransformParameterivEXT} + glPixelTransformParameterfvEXT: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelTransformParameterfvEXT} + + // GL_EXT_secondary_color + glSecondaryColor3bEXT: procedure(red, green, blue: TGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3bEXT} + glSecondaryColor3bvEXT: procedure(v: PGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3bvEXT} + glSecondaryColor3dEXT: procedure(red, green, blue: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3dEXT} + glSecondaryColor3dvEXT: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3dvEXT} + glSecondaryColor3fEXT: procedure(red, green, blue: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3fEXT} + glSecondaryColor3fvEXT: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3fvEXT} + glSecondaryColor3iEXT: procedure(red, green, blue: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3iEXT} + glSecondaryColor3ivEXT: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3ivEXT} + + glSecondaryColor3sEXT: procedure(red, green, blue: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3sEXT} + glSecondaryColor3svEXT: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3svEXT} + glSecondaryColor3ubEXT: procedure(red, green, blue: TGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3ubEXT} + glSecondaryColor3ubvEXT: procedure(v: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3ubvEXT} + glSecondaryColor3uiEXT: procedure(red, green, blue: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3uiEXT} + glSecondaryColor3uivEXT: procedure(v: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3uivEXT} + glSecondaryColor3usEXT: procedure(red, green, blue: TGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3usEXT} + glSecondaryColor3usvEXT: procedure(v: PGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3usvEXT} + glSecondaryColorPointerEXT: procedure(Size: TGLint; Atype: TGLenum; stride: TGLsizei; p: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColorPointerEXT} + + // GL_EXT_texture_perturb_normal + glTextureNormalEXT: procedure(mode: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTextureNormalEXT} + + // GL_EXT_multi_draw_arrays + glMultiDrawArraysEXT: procedure(mode: TGLenum; First: PGLint; Count: PGLsizei; primcount: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiDrawArraysEXT} + glMultiDrawElementsEXT: procedure(mode: TGLenum; Count: PGLsizei; AType: TGLenum; var indices; primcount: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiDrawElementsEXT} + + // GL_EXT_fog_coord + glFogCoordfEXT: procedure(coord: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFogCoordfEXT} + glFogCoordfvEXT: procedure(coord: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFogCoordfvEXT} + glFogCoorddEXT: procedure(coord: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFogCoorddEXT} + glFogCoorddvEXT: procedure(coord: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFogCoorddvEXT} + glFogCoordPointerEXT: procedure(AType: TGLenum; stride: TGLsizei; p: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFogCoordPointerEXT} + + // GL_EXT_coordinate_frame + glTangent3bEXT: procedure(tx, ty, tz: TGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTangent3bEXT} + glTangent3bvEXT: procedure(v: PGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTangent3bvEXT} + glTangent3dEXT: procedure(tx, ty, tz: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTangent3dEXT} + glTangent3dvEXT: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTangent3dvEXT} + glTangent3fEXT: procedure(tx, ty, tz: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTangent3fEXT} + glTangent3fvEXT: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTangent3fvEXT} + glTangent3iEXT: procedure(tx, ty, tz: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTangent3iEXT} + glTangent3ivEXT: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTangent3ivEXT} + glTangent3sEXT: procedure(tx, ty, tz: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTangent3sEXT} + glTangent3svEXT: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTangent3svEXT} + + glBinormal3bEXT: procedure(bx, by, bz: TGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBinormal3bEXT} + glBinormal3bvEXT: procedure(v: PGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBinormal3bvEXT} + glBinormal3dEXT: procedure(bx, by, bz: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBinormal3dEXT} + glBinormal3dvEXT: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBinormal3dvEXT} + glBinormal3fEXT: procedure(bx, by, bz: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBinormal3fEXT} + glBinormal3fvEXT: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBinormal3fvEXT} + glBinormal3iEXT: procedure(bx, by, bz: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBinormal3iEXT} + glBinormal3ivEXT: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBinormal3ivEXT} + glBinormal3sEXT: procedure(bx, by, bz: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBinormal3sEXT} + glBinormal3svEXT: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBinormal3svEXT} + glTangentPointerEXT: procedure(Atype: TGLenum; stride: TGLsizei; p: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTangentPointerEXT} + glBinormalPointerEXT: procedure(Atype: TGLenum; stride: TGLsizei; p: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBinormalPointerEXT} + + // GL_SUNX_constant_data + glFinishTextureSUNX: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFinishTextureSUNX} + + // GL_SUN_global_alpha + glGlobalAlphaFactorbSUN: procedure(factor: TGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGlobalAlphaFactorbSUN} + glGlobalAlphaFactorsSUN: procedure(factor: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGlobalAlphaFactorsSUN} + glGlobalAlphaFactoriSUN: procedure(factor: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGlobalAlphaFactoriSUN} + glGlobalAlphaFactorfSUN: procedure(factor: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGlobalAlphaFactorfSUN} + glGlobalAlphaFactordSUN: procedure(factor: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGlobalAlphaFactordSUN} + glGlobalAlphaFactorubSUN: procedure(factor: TGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGlobalAlphaFactorubSUN} + glGlobalAlphaFactorusSUN: procedure(factor: TGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGlobalAlphaFactorusSUN} + glGlobalAlphaFactoruiSUN: procedure(factor: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGlobalAlphaFactoruiSUN} + + // GL_SUN_triangle_list + glReplacementCodeuiSUN: procedure(code: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiSUN} + glReplacementCodeusSUN: procedure(code: TGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeusSUN} + glReplacementCodeubSUN: procedure(code: TGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeubSUN} + glReplacementCodeuivSUN: procedure(code: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuivSUN} + glReplacementCodeusvSUN: procedure(code: PGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeusvSUN} + glReplacementCodeubvSUN: procedure(code: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeubvSUN} + glReplacementCodePointerSUN: procedure(Atype: TGLenum; stride: TGLsizei; var p); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodePointerSUN} + + // GL_SUN_vertex + glColor4ubVertex2fSUN: procedure(r, g, b, a: TGLubyte; x, y: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4ubVertex2fSUN} + glColor4ubVertex2fvSUN: procedure(c: PGLubyte; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4ubVertex2fvSUN} + glColor4ubVertex3fSUN: procedure(r, g, b, a: TGLubyte; x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4ubVertex3fSUN} + glColor4ubVertex3fvSUN: procedure(c: PGLubyte; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4ubVertex3fvSUN} + glColor3fVertex3fSUN: procedure(r, g, b, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3fVertex3fSUN} + glColor3fVertex3fvSUN: procedure(c, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3fVertex3fvSUN} + glNormal3fVertex3fSUN: procedure(nx, ny, nz: TGLfloat; x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3fVertex3fSUN} + glNormal3fVertex3fvSUN: procedure(n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3fVertex3fvSUN} + glColor4fNormal3fVertex3fSUN: procedure(r, g, b, a, nx, ny, nz, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4fNormal3fVertex3fSUN} + glColor4fNormal3fVertex3fvSUN: procedure(c, n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4fNormal3fVertex3fvSUN} + glTexCoord2fVertex3fSUN: procedure(s, t, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2fVertex3fSUN} + glTexCoord2fVertex3fvSUN: procedure(tc, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2fVertex3fvSUN} + glTexCoord4fVertex4fSUN: procedure(s, t, p, q, x, y, z, w: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4fVertex4fSUN} + glTexCoord4fVertex4fvSUN: procedure(tc, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4fVertex4fvSUN} + glTexCoord2fColor4ubVertex3fSUN: procedure(s, t, r, g, b, a, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2fColor4ubVertex3fSUN} + glTexCoord2fColor4ubVertex3fvSUN: procedure(tc: PGLfloat; c: PGLubyte; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2fColor4ubVertex3fvSUN} + glTexCoord2fColor3fVertex3fSUN: procedure(s, t, r, g, b, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2fColor3fVertex3fSUN} + glTexCoord2fColor3fVertex3fvSUN: procedure(tc, c, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2fColor3fVertex3fvSUN} + glTexCoord2fNormal3fVertex3fSUN: procedure(s, t, nx, ny, nz, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2fNormal3fVertex3fSUN} + glTexCoord2fNormal3fVertex3fvSUN: procedure(tc, n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2fNormal3fVertex3fvSUN} + glTexCoord2fColor4fNormal3fVertex3fSUN: procedure(s, t, r, g, b, a, nx, ny, nz, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2fColor4fNormal3fVertex3fSUN} + glTexCoord2fColor4fNormal3fVertex3fvSUN: procedure(tc, c, n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2fColor4fNormal3fVertex3fvSUN} + glTexCoord4fColor4fNormal3fVertex4fSUN: procedure(s, t, p, q, r, g, b, a, nx, ny, nz, x, y, z, w: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4fColor4fNormal3fVertex4fSUN} + glTexCoord4fColor4fNormal3fVertex4fvSUN: procedure(tc, c, n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4fColor4fNormal3fVertex4fvSUN} + glReplacementCodeuiVertex3fSUN: procedure(rc: TGLenum; x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiVertex3fSUN} + glReplacementCodeuiVertex3fvSUN: procedure(rc: PGLenum; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiVertex3fvSUN} + glReplacementCodeuiColor4ubVertex3fSUN: procedure(rc: TGLenum; r, g, b, a: TGLubyte; x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiColor4ubVertex3fSUN} + glReplacementCodeuiColor4ubVertex3fvSUN: procedure(rc: PGLenum; c: PGLubyte; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiColor4ubVertex3fvSUN} + glReplacementCodeuiColor3fVertex3fSUN: procedure(rc: TGLenum; r, g, b, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiColor3fVertex3fSUN} + glReplacementCodeuiColor3fVertex3fvSUN: procedure(rc: PGLenum; c, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiColor3fVertex3fvSUN} + glReplacementCodeuiNormal3fVertex3fSUN: procedure(rc: TGLenum; nx, ny, nz, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiNormal3fVertex3fSUN} + glReplacementCodeuiNormal3fVertex3fvSUN: procedure(rc: PGLenum; n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiNormal3fVertex3fvSUN} + glReplacementCodeuiColor4fNormal3fVertex3fSUN: procedure(rc: TGLenum; r, g, b, a, nx, ny, nz, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiColor4fNormal3fVertex3fSUN} + glReplacementCodeuiColor4fNormal3fVertex3fvSUN: procedure(rc: PGLenum; c, n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiColor4fNormal3fVertex3fvSUN} + glReplacementCodeuiTexCoord2fVertex3fSUN: procedure(rc: TGLenum; s, t, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiTexCoord2fVertex3fSUN} + glReplacementCodeuiTexCoord2fVertex3fvSUN: procedure(rc: PGLenum; tc, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiTexCoord2fVertex3fvSUN} + glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN: procedure(rc: TGLenum; s, t, nx, ny, nz, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN} + glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN: procedure(rc: PGLenum; tc, n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN} + glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN: procedure(rc: TGLenum; s, t, r, g, b, a, nx, ny, nz, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN} + glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN: procedure(rc: PGLenum; tc, c, n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN} + + // GL_EXT_blend_func_separate + glBlendFuncSeparateEXT: procedure(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBlendFuncSeparateEXT} + + // GL_EXT_vertex_weighting + glVertexWeightfEXT: procedure(weight: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexWeightfEXT} + glVertexWeightfvEXT: procedure(weight: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexWeightfvEXT} + glVertexWeightPointerEXT: procedure(Size: TGLsizei; Atype: TGLenum; stride: TGLsizei; p: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexWeightPointerEXT} + + // GL_NV_vertex_array_range + glFlushVertexArrayRangeNV: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFlushVertexArrayRangeNV} + glVertexArrayRangeNV: procedure(Size: TGLsizei; p: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexArrayRangeNV} + wglAllocateMemoryNV: function(size: TGLsizei; readFrequency, writeFrequency, priority: Single): Pointer; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM wglAllocateMemoryNV} + wglFreeMemoryNV: procedure(ptr: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM wglFreeMemoryNV} + + // GL_NV_register_combiners + glCombinerParameterfvNV: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCombinerParameterfvNV} + glCombinerParameterfNV: procedure(pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCombinerParameterfNV} + glCombinerParameterivNV: procedure(pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCombinerParameterivNV} + glCombinerParameteriNV: procedure(pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCombinerParameteriNV} + glCombinerInputNV: procedure(stage, portion, variable, input, mapping, componentUsage: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCombinerInputNV} + glCombinerOutputNV: procedure(stage, portion, abOutput, cdOutput, sumOutput, scale, bias: TGLenum; abDotProduct, cdDotProduct, muxSum: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCombinerOutputNV} + glFinalCombinerInputNV: procedure(variable, input, mapping, componentUsage: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFinalCombinerInputNV} + glGetCombinerInputParameterfvNV: procedure(stage, portion, variable, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetCombinerInputParameterfvNV} + glGetCombinerInputParameterivNV: procedure(stage, portion, variable, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetCombinerInputParameterivNV} + glGetCombinerOutputParameterfvNV: procedure(stage, portion, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetCombinerOutputParameterfvNV} + glGetCombinerOutputParameterivNV: procedure(stage, portion, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetCombinerOutputParameterivNV} + glGetFinalCombinerInputParameterfvNV: procedure(variable, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetFinalCombinerInputParameterfvNV} + glGetFinalCombinerInputParameterivNV: procedure(variable, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetFinalCombinerInputParameterivNV} + + // GL_MESA_resize_buffers + glResizeBuffersMESA: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glResizeBuffersMESA} + + // GL_MESA_window_pos + glWindowPos2dMESA: procedure(x, y: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos2dMESA} + glWindowPos2dvMESA: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos2dvMESA} + glWindowPos2fMESA: procedure(x, y: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos2fMESA} + glWindowPos2fvMESA: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos2fvMESA} + glWindowPos2iMESA: procedure(x, y: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos2iMESA} + glWindowPos2ivMESA: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos2ivMESA} + glWindowPos2sMESA: procedure(x, y: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos2sMESA} + glWindowPos2svMESA: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos2svMESA} + glWindowPos3dMESA: procedure(x, y, z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos3dMESA} + glWindowPos3dvMESA: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos3dvMESA} + glWindowPos3fMESA: procedure(x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos3fMESA} + glWindowPos3fvMESA: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos3fvMESA} + glWindowPos3iMESA: procedure(x, y, z: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos3iMESA} + glWindowPos3ivMESA: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos3ivMESA} + glWindowPos3sMESA: procedure(x, y, z: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos3sMESA} + glWindowPos3svMESA: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos3svMESA} + glWindowPos4dMESA: procedure(x, y, z, w: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos4dMESA} + glWindowPos4dvMESA: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos4dvMESA} + glWindowPos4fMESA: procedure(x, y, z, w: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos4fMESA} + glWindowPos4fvMESA: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos4fvMESA} + glWindowPos4iMESA: procedure(x, y, z, w: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos4iMESA} + glWindowPos4ivMESA: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos4ivMESA} + glWindowPos4sMESA: procedure(x, y, z, w: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos4sMESA} + glWindowPos4svMESA: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos4svMESA} + + // GL_IBM_multimode_draw_arrays + glMultiModeDrawArraysIBM: procedure(mode: TGLenum; First: PGLint; Count: PGLsizei; primcount: TGLsizei; modestride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiModeDrawArraysIBM} + glMultiModeDrawElementsIBM: procedure(mode: PGLenum; Count: PGLsizei; Atype: TGLenum; var indices; primcount: TGLsizei; modestride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiModeDrawElementsIBM} + + // GL_IBM_vertex_array_lists + glColorPointerListIBM: procedure(Size: TGLint; Atype: TGLenum; stride: TGLint; var p; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorPointerListIBM} + glSecondaryColorPointerListIBM: procedure(Size: TGLint; Atype: TGLenum; stride: TGLint; var p; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColorPointerListIBM} + glEdgeFlagPointerListIBM: procedure(stride: TGLint; var p: PGLboolean; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEdgeFlagPointerListIBM} + glFogCoordPointerListIBM: procedure(Atype: TGLenum; stride: TGLint; var p; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFogCoordPointerListIBM} + glIndexPointerListIBM: procedure(Atype: TGLenum; stride: TGLint; var p; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexPointerListIBM} + glNormalPointerListIBM: procedure(Atype: TGLenum; stride: TGLint; var p; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormalPointerListIBM} + glTexCoordPointerListIBM: procedure(Size: TGLint; Atype: TGLenum; stride: TGLint; var p; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoordPointerListIBM} + glVertexPointerListIBM: procedure(Size: TGLint; Atype: TGLenum; stride: TGLint; var p; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexPointerListIBM} + + // GL_3DFX_tbuffer + glTbufferMask3DFX: procedure(mask: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTbufferMask3DFX} + + // GL_EXT_multisample + glSampleMaskEXT: procedure(Value: TGLclampf; invert: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSampleMaskEXT} + glSamplePatternEXT: procedure(pattern: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSamplePatternEXT} + + // GL_SGIS_texture_color_mask + glTextureColorMaskSGIS: procedure(red, green, blue, alpha: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTextureColorMaskSGIS} + + // GL_SGIX_igloo_interface + glIglooInterfaceSGIX: procedure(pname: TGLenum; params: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIglooInterfaceSGIX} + + // GL_NV_vertex_program + glAreProgramsResidentNV: procedure(n: TGLSizei; programs: PGLuint; residences: PGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glAreProgramsResidentNV} + glBindProgramNV: procedure(target: TGLenum; id: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBindProgramNV} + glDeleteProgramsNV: procedure(n: TGLSizei; programs: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDeleteProgramsNV} + glExecuteProgramNV: procedure(target: TGLenum; id: TGLuint; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glExecuteProgramNV} + glGenProgramsNV: procedure(n: TGLSizei; programs: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGenProgramsNV} + glGetProgramParameterdvNV: procedure (target: TGLenum; index: TGLuint; pname: TGLenum; params: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetProgramParameterdvNV} + glGetProgramParameterfvNV: procedure (target: TGLenum; index: TGLuint; pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetProgramParameterfvNV} + glGetProgramivNV: procedure (id: TGLuint; pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetProgramivNV} + glGetProgramStringNV: procedure (id: TGLuint; pname: TGLenum; programIdx: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetProgramStringNV} + glGetTrackMatrixivNV: procedure (target: TGLenum; address: TGLuint; pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTrackMatrixivNV} + glGetVertexAttribdvNV: procedure (index: TGLuint; pname: TGLenum; params: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetVertexAttribdvNV} + glGetVertexAttribfvNV: procedure (index: TGLuint; pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetVertexAttribfvNV} + glGetVertexAttribivNV: procedure (index: TGLuint; pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetVertexAttribivNV} + glGetVertexAttribPointervNV: procedure (index: TGLuint; pname: TGLenum; pointer: PPointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetVertexAttribPointervNV} + glIsProgramNV: function (id: TGLuint): TGLboolean; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIsProgramNV} + glLoadProgramNV: procedure (target: TGLenum; id: TGLuint; len: TGLSizei; programIdx: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLoadProgramNV} + glProgramParameter4dNV: procedure (target: TGLenum; index: TGLuint; x, y, z, w: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glProgramParameter4dNV} + glProgramParameter4dvNV: procedure (target: TGLenum; index: TGLuint; v: PGLdouble ); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glProgramParameter4dvNV} + glProgramParameter4fNV: procedure (target: TGLenum; index: TGLuint; x, y, z, w: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glProgramParameter4fNV} + glProgramParameter4fvNV: procedure (target: TGLenum; index: TGLuint; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glProgramParameter4fvNV} + glProgramParameters4dvNV: procedure (target: TGLenum; index: TGLuint; count: TGLSizei; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glProgramParameters4dvNV} + glProgramParameters4fvNV: procedure (target: TGLenum; index: TGLuint; count: TGLSizei; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glProgramParameters4fvNV} + glRequestResidentProgramsNV: procedure (n: TGLSizei; programs: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRequestResidentProgramsNV} + glTrackMatrixNV: procedure (target: TGLenum; address: TGLuint; matrix: TGLenum; transform: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTrackMatrixNV} + glVertexAttribPointerNV: procedure (index: TGLuint; fsize: TGLint; vertextype: TGLenum; stride: TGLSizei; pointer: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribPointerNV} + glVertexAttrib1dNV: procedure (index: TGLuint; x: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib1dNV} + glVertexAttrib1dvNV: procedure (index: TGLuint; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib1dvNV} + glVertexAttrib1fNV: procedure (index: TGLuint; x: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib1fNV} + glVertexAttrib1fvNV: procedure (index: TGLuint; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib1fvNV} + glVertexAttrib1sNV: procedure (index: TGLuint; x: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib1sNV} + glVertexAttrib1svNV: procedure (index: TGLuint; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib1svNV} + glVertexAttrib2dNV: procedure (index: TGLuint; x: TGLdouble; y: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib2dNV} + glVertexAttrib2dvNV: procedure (index: TGLuint; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib2dvNV} + glVertexAttrib2fNV: procedure (index: TGLuint; x: TGLfloat; y: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib2fNV} + glVertexAttrib2fvNV: procedure (index: TGLuint; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib2fvNV} + glVertexAttrib2sNV: procedure (index: TGLuint; x: TGLshort; y: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib2sNV} + glVertexAttrib2svNV: procedure (index: TGLuint; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib2svNV} + glVertexAttrib3dNV: procedure (index: TGLuint; x: TGLdouble; y: TGLdouble; z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib3dNV} + glVertexAttrib3dvNV: procedure (index: TGLuint; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib3dvNV} + glVertexAttrib3fNV: procedure (index: TGLuint; x: TGLfloat; y: TGLfloat; z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib3fNV} + glVertexAttrib3fvNV: procedure (index: TGLuint; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib3fvNV} + glVertexAttrib3sNV: procedure (index: TGLuint; x: TGLshort; y: TGLshort; z: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib3sNV} + glVertexAttrib3svNV: procedure (index: TGLuint; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib3svNV} + glVertexAttrib4dNV: procedure (index: TGLuint; x: TGLdouble; y: TGLdouble; z: TGLdouble; w: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib4dNV} + glVertexAttrib4dvNV: procedure (index: TGLuint; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib4dvNV} + glVertexAttrib4fNV: procedure(index: TGLuint; x: TGLfloat; y: TGLfloat; z: TGLfloat; w: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib4fNV} + glVertexAttrib4fvNV: procedure(index: TGLuint; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib4fvNV} + glVertexAttrib4sNV: procedure (index: TGLuint; x: TGLshort; y: TGLshort; z: TGLdouble; w: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib4sNV} + glVertexAttrib4svNV: procedure (index: TGLuint; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib4svNV} + glVertexAttrib4ubvNV: procedure (index: TGLuint; v: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib4ubvNV} + glVertexAttribs1dvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs1dvNV} + glVertexAttribs1fvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs1fvNV} + glVertexAttribs1svNV: procedure (index: TGLuint; count: TGLSizei; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs1svNV} + glVertexAttribs2dvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs2dvNV} + glVertexAttribs2fvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs2fvNV} + glVertexAttribs2svNV: procedure (index: TGLuint; count: TGLSizei; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs2svNV} + glVertexAttribs3dvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs3dvNV} + glVertexAttribs3fvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs3fvNV} + glVertexAttribs3svNV: procedure (index: TGLuint; count: TGLSizei; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs3svNV} + glVertexAttribs4dvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs4dvNV} + glVertexAttribs4fvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs4fvNV} + glVertexAttribs4svNV: procedure (index: TGLuint; count: TGLSizei; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs4svNV} + glVertexAttribs4ubvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs4ubvNV} + +{$ifdef UNIX} +type + GLXContext = Pointer; + GLXPixmap = XID; + GLXDrawable = XID; + + // GLX 1.3 and later + GLXFBConfig = Pointer; + GLXFBConfigID = XID; + GLXContextID = XID; + GLXWindow = XID; + GLXPbuffer = XID; + +var + glXChooseVisual: function(dpy: PDisplay; screen: TGLint; attribList: PGLint): PXVisualInfo; cdecl; + {$EXTERNALSYM glXChooseVisual} + glXCreateContext: function(dpy: PDisplay; vis: PXVisualInfo; shareList: GLXContext; direct: TGLboolean): GLXContext; cdecl; + {$EXTERNALSYM glXCreateContext} + glXDestroyContext: procedure(dpy: PDisplay; ctx: GLXContext); cdecl; + {$EXTERNALSYM glXDestroyContext} + glXMakeCurrent: function(dpy: PDisplay; drawable: GLXDrawable; ctx: GLXContext): TGLboolean; cdecl; + {$EXTERNALSYM glXMakeCurrent} + glXCopyContext: procedure(dpy: PDisplay; src: GLXContext; dst: GLXContext; mask: TGLuint); cdecl; + {$EXTERNALSYM glXCopyContext} + glXSwapBuffers: procedure(dpy: PDisplay; drawable: GLXDrawable); cdecl; + {$EXTERNALSYM glXSwapBuffers} + glXCreateGLXPixmap: function(dpy: PDisplay; visual: PXVisualInfo; pixmap: Pixmap): GLXPixmap; cdecl; + {$EXTERNALSYM glXCreateGLXPixmap} + glXDestroyGLXPixmap: procedure(dpy: PDisplay; pixmap: GLXPixmap); cdecl; + {$EXTERNALSYM glXDestroyGLXPixmap} + glXQueryExtension: function(dpy: PDisplay; errorb: PGLInt; event: PGLInt): TGLboolean; cdecl; + {$EXTERNALSYM glXQueryExtension} + glXQueryVersion: function(dpy: PDisplay; maj: PGLInt; min: PGLINT): TGLboolean; cdecl; + {$EXTERNALSYM glXQueryVersion} + glXIsDirect: function(dpy: PDisplay; ctx: GLXContext): TGLboolean; cdecl; + {$EXTERNALSYM glXIsDirect} + glXGetConfig: function(dpy: PDisplay; visual: PXVisualInfo; attrib: TGLInt; value: PGLInt): TGLInt; cdecl; + {$EXTERNALSYM glXGetConfig} + glXGetCurrentContext: function: GLXContext; cdecl; + {$EXTERNALSYM glXGetCurrentContext} + glXGetCurrentDrawable: function: GLXDrawable; cdecl; + {$EXTERNALSYM glXGetCurrentDrawable} + glXWaitGL: procedure; cdecl; + {$EXTERNALSYM glXWaitGL} + glXWaitX: procedure; cdecl; + {$EXTERNALSYM glXWaitX} + glXUseXFont: procedure(font: Font; first: TGLInt; count: TGLInt; list: TGLint); cdecl; + {$EXTERNALSYM glXUseXFont} + + // GLX 1.1 and later + glXQueryExtensionsString: function(dpy: PDisplay; screen: TGLInt): PChar; cdecl; + {$EXTERNALSYM glXQueryExtensionsString} + glXQueryServerString: function(dpy: PDisplay; screen: TGLInt; name: TGLInt): PChar; cdecl; + {$EXTERNALSYM glXQueryServerString} + glXGetClientString: function(dpy: PDisplay; name: TGLInt): PChar; cdecl; + {$EXTERNALSYM glXGetClientString} + + // GLX 1.2 and later + glXGetCurrentDisplay: function: PDisplay; cdecl; + {$EXTERNALSYM glXGetCurrentDisplay} + + // GLX 1.3 and later + glXChooseFBConfig: function(dpy: PDisplay; screen: TGLInt; attribList: PGLInt; nitems: PGLInt): GLXFBConfig; cdecl; + {$EXTERNALSYM glXChooseFBConfig} + glXGetFBConfigAttrib: function(dpy: PDisplay; config: GLXFBConfig; attribute: TGLInt; value: PGLInt): TGLInt; cdecl; + {$EXTERNALSYM glXGetFBConfigAttrib} + glXGetFBConfigs: function(dpy: PDisplay; screen: TGLInt; nelements: PGLInt): GLXFBConfig; cdecl; + {$EXTERNALSYM glXGetFBConfigs} + glXGetVisualFromFBConfig: function(dpy: PDisplay; config: GLXFBConfig): PXVisualInfo; cdecl; + {$EXTERNALSYM glXGetVisualFromFBConfig} + glXCreateWindow: function(dpy: PDisplay; config: GLXFBConfig; win: Window; const attribList: PGLInt): GLXWindow; cdecl; + {$EXTERNALSYM glXCreateWindow} + glXDestroyWindow: procedure(dpy: PDisplay; window: GLXWindow); cdecl; + {$EXTERNALSYM glXDestroyWindow} + glXCreatePixmap: function(dpy: PDisplay; config: GLXFBConfig; pixmap: Pixmap; attribList: PGLInt): GLXPixmap; cdecl; + {$EXTERNALSYM glXCreatePixmap} + glXDestroyPixmap: procedure(dpy: PDisplay; pixmap: GLXPixmap); cdecl; + {$EXTERNALSYM glXDestroyPixmap} + glXCreatePbuffer: function(dpy: PDisplay; config: GLXFBConfig; attribList: PGLInt): GLXPBuffer; cdecl; + {$EXTERNALSYM glXCreatePbuffer} + glXDestroyPbuffer: procedure(dpy: PDisplay; pbuf: GLXPBuffer); cdecl; + {$EXTERNALSYM glXDestroyPbuffer} + glXQueryDrawable: procedure(dpy: PDisplay; draw: GLXDrawable; attribute: TGLInt; value: PGLuint); cdecl; + {$EXTERNALSYM glXQueryDrawable} + glXCreateNewContext: function(dpy: PDisplay; config: GLXFBConfig; renderType: TGLInt; shareList: GLXContext; direct: TGLboolean): GLXContext; cdecl; + {$EXTERNALSYM glXCreateNewContext} + glXMakeContextCurrent: function(dpy: PDisplay; draw: GLXDrawable; read: GLXDrawable; ctx: GLXContext): TGLboolean; cdecl; + {$EXTERNALSYM glXMakeContextCurrent} + glXGetCurrentReadDrawable: function: GLXDrawable; cdecl; + {$EXTERNALSYM glXGetCurrentReadDrawable} + glXQueryContext: function(dpy: PDisplay; ctx: GLXContext; attribute: TGLInt; value: PGLInt): TGLInt; cdecl; + {$EXTERNALSYM glXQueryContext} + glXSelectEvent: procedure(dpy: PDisplay; drawable: GLXDrawable; mask: TGLsizei); cdecl; + {$EXTERNALSYM glXSelectEvent} + glXGetSelectedEvent: procedure(dpy: PDisplay; drawable: GLXDrawable; mask: TGLsizei); cdecl; + {$EXTERNALSYM glXGetSelectedEvent} + glXGetVideoSyncSGI: function(count: PGLuint): TGLInt; cdecl; + {$EXTERNALSYM glXGetVideoSyncSGI} + glXWaitVideoSyncSGI: function(divisor: TGLInt; remainder: TGLInt; count: PGLuint): TGLInt; cdecl; + {$EXTERNALSYM glXWaitVideoSyncSGI} + glXFreeContextEXT: procedure(dpy: PDisplay; context: GLXContext); cdecl; + {$EXTERNALSYM glXFreeContextEXT} + glXGetContextIDEXT: function(const context: GLXContext): GLXContextID; cdecl; + {$EXTERNALSYM glXGetContextIDEXT} + glXGetCurrentDisplayEXT: function: PDisplay; cdecl; + {$EXTERNALSYM glXGetCurrentDisplayEXT} + glXImportContextEXT: function(dpy: PDisplay; contextID: GLXContextID): GLXContext; cdecl; + {$EXTERNALSYM glXImportContextEXT} + glXQueryContextInfoEXT: function(dpy: PDisplay; context: GLXContext; attribute: TGLInt; value: PGLInt): TGLInt; cdecl; + {$EXTERNALSYM glXQueryContextInfoEXT} + glXCopySubBufferMESA: procedure(dpy: PDisplay; drawable: GLXDrawable; x: TGLInt; y: TGLInt; width: TGLInt; height: TGLInt); cdecl; + {$EXTERNALSYM glXCopySubBufferMESA} + glXCreateGLXPixmapMESA: function(dpy: PDisplay; visual: PXVisualInfo; pixmap: Pixmap; cmap: Colormap): GLXPixmap; cdecl; + {$EXTERNALSYM glXCreateGLXPixmapMESA} + glXReleaseBuffersMESA: function(dpy: PDisplay; d: GLXDrawable): TGLboolean; cdecl; + {$EXTERNALSYM glXReleaseBuffersMESA} + glXSet3DfxModeMESA: function(mode: TGLint): TGLboolean; cdecl; + {$EXTERNALSYM glXSet3DfxModeMESA} +{$endif} + + +//---------------------------------------------------------------------------------------------------------------------- + +procedure CloseOpenGL; +function InitOpenGL: Boolean; +function InitOpenGLFromLibrary(GLName, GLUName: PChar): Boolean; +function IsOpenGLInitialized: Boolean; + +// Compatibility routines +procedure UnloadOpenGL; +function LoadOpenGL: Boolean; +function LoadOpenGLFromLibrary(GLName, GLUName: PChar): Boolean; +function IsOpenGLLoaded: Boolean; + +{$ifdef Win32} +procedure ActivateRenderingContext(DC: HDC; RC: HGLRC); +function CreateRenderingContext(DC: HDC; Options: TRCOptions; ColorBits, StencilBits, AccumBits, AuxBuffers: Integer; Layer: Integer; var Palette: HPALETTE): HGLRC; +function CurrentDC: HDC; +procedure DeactivateRenderingContext; +procedure DestroyRenderingContext(RC: HGLRC); +procedure ClearExtensions; +function HasActiveContext: Boolean; +procedure ReadExtensions; +procedure ReadImplementationProperties; +{$endif} + +//---------------------------------------------------------------------------------------------------------------------- + +implementation + +uses + SysUtils, + Classes, + sdl, + moduleloader; + +type + EOpenGLException = class(Exception); + +{$ifndef FPC} +threadvar +{$else} +var +{$endif} + LastPixelFormat: Integer; + ActivationRefCount: Integer; + +{$ifdef Win32} +const + INVALID_MODULEHANDLE = 0; + +var + GLHandle: TModuleHandle; + GLUHandle: TModuleHandle; +{$endif} + +{$ifdef UNIX} +const + INVALID_MODULEHANDLE = nil; + +var + GLHandle: TModuleHandle; + GLUHandle: TModuleHandle; +{$endif} + + // The context list is used to determine if a context is active already in any thread. + ContextList: TThreadList; + +resourcestring + SRCAlreadyActive = 'Rendering context already active in another thread.'; + SMakeCurrentFailed = 'wglMakeCurrent failed'; + SDeleteContextFailed = 'wglDeleteContext failed'; + SContextInUse = 'Cannot delete rendering context. It is still in use by another thread.'; + +{$ifdef Win32} + SDefaultGLLibrary = 'OpenGL32.dll'; + SDefaultGLULibrary = 'GLU32.dll'; +{$endif} + +{$ifdef UNIX} + SDefaultGLLibrary = 'libGL.so'; + SDefaultGLULibrary = 'libGLU.so'; +{$endif} + +//---------------------------------------------------------------------------------------------------------------------- + +procedure ShowError(const Message: string); + +begin + raise EOpenGLException.Create(Message); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +{$ifndef VER140} + +procedure RaiseLastOSError; +begin + {$ifndef FPC} + RaiseLastWin32Error; + {$endif} +end; + +{$endif VER140} + +//---------------------------------------------------------------------------------------------------------------------- + +procedure ClearProcAddresses; + +begin + glAccum := nil; + glAlphaFunc := nil; + glAreTexturesResident := nil; + glArrayElement := nil; + glBegin := nil; + glBindTexture := nil; + glBitmap := nil; + glBlendFunc := nil; + glCallList := nil; + glCallLists := nil; + glClear := nil; + glClearAccum := nil; + glClearColor := nil; + glClearDepth := nil; + glClearIndex := nil; + glClearStencil := nil; + glClipPlane := nil; + glColor3b := nil; + glColor3bv := nil; + glColor3d := nil; + glColor3dv := nil; + glColor3f := nil; + glColor3fv := nil; + glColor3i := nil; + glColor3iv := nil; + glColor3s := nil; + glColor3sv := nil; + glColor3ub := nil; + glColor3ubv := nil; + glColor3ui := nil; + glColor3uiv := nil; + glColor3us := nil; + glColor3usv := nil; + glColor4b := nil; + glColor4bv := nil; + glColor4d := nil; + glColor4dv := nil; + glColor4f := nil; + glColor4fv := nil; + glColor4i := nil; + glColor4iv := nil; + glColor4s := nil; + glColor4sv := nil; + glColor4ub := nil; + glColor4ubv := nil; + glColor4ui := nil; + glColor4uiv := nil; + glColor4us := nil; + glColor4usv := nil; + glColorMask := nil; + glColorMaterial := nil; + glColorPointer := nil; + glCopyPixels := nil; + glCopyTexImage1D := nil; + glCopyTexImage2D := nil; + glCopyTexSubImage1D := nil; + glCopyTexSubImage2D := nil; + glCullFace := nil; + glDeleteLists := nil; + glDeleteTextures := nil; + glDepthFunc := nil; + glDepthMask := nil; + glDepthRange := nil; + glDisable := nil; + glDisableClientState := nil; + glDrawArrays := nil; + glDrawBuffer := nil; + glDrawElements := nil; + glDrawPixels := nil; + glEdgeFlag := nil; + glEdgeFlagPointer := nil; + glEdgeFlagv := nil; + glEnable := nil; + glEnableClientState := nil; + glEnd := nil; + glEndList := nil; + glEvalCoord1d := nil; + glEvalCoord1dv := nil; + glEvalCoord1f := nil; + glEvalCoord1fv := nil; + glEvalCoord2d := nil; + glEvalCoord2dv := nil; + glEvalCoord2f := nil; + glEvalCoord2fv := nil; + glEvalMesh1 := nil; + glEvalMesh2 := nil; + glEvalPoint1 := nil; + glEvalPoint2 := nil; + glFeedbackBuffer := nil; + glFinish := nil; + glFlush := nil; + glFogf := nil; + glFogfv := nil; + glFogi := nil; + glFogiv := nil; + glFrontFace := nil; + glFrustum := nil; + glGenLists := nil; + glGenTextures := nil; + glGetBooleanv := nil; + glGetClipPlane := nil; + glGetDoublev := nil; + glGetError := nil; + glGetFloatv := nil; + glGetIntegerv := nil; + glGetLightfv := nil; + glGetLightiv := nil; + glGetMapdv := nil; + glGetMapfv := nil; + glGetMapiv := nil; + glGetMaterialfv := nil; + glGetMaterialiv := nil; + glGetPixelMapfv := nil; + glGetPixelMapuiv := nil; + glGetPixelMapusv := nil; + glGetPointerv := nil; + glGetPolygonStipple := nil; + glGetString := nil; + glGetTexEnvfv := nil; + glGetTexEnviv := nil; + glGetTexGendv := nil; + glGetTexGenfv := nil; + glGetTexGeniv := nil; + glGetTexImage := nil; + glGetTexLevelParameterfv := nil; + glGetTexLevelParameteriv := nil; + glGetTexParameterfv := nil; + glGetTexParameteriv := nil; + glHint := nil; + glIndexMask := nil; + glIndexPointer := nil; + glIndexd := nil; + glIndexdv := nil; + glIndexf := nil; + glIndexfv := nil; + glIndexi := nil; + glIndexiv := nil; + glIndexs := nil; + glIndexsv := nil; + glIndexub := nil; + glIndexubv := nil; + glInitNames := nil; + glInterleavedArrays := nil; + glIsEnabled := nil; + glIsList := nil; + glIsTexture := nil; + glLightModelf := nil; + glLightModelfv := nil; + glLightModeli := nil; + glLightModeliv := nil; + glLightf := nil; + glLightfv := nil; + glLighti := nil; + glLightiv := nil; + glLineStipple := nil; + glLineWidth := nil; + glListBase := nil; + glLoadIdentity := nil; + glLoadMatrixd := nil; + glLoadMatrixf := nil; + glLoadName := nil; + glLogicOp := nil; + glMap1d := nil; + glMap1f := nil; + glMap2d := nil; + glMap2f := nil; + glMapGrid1d := nil; + glMapGrid1f := nil; + glMapGrid2d := nil; + glMapGrid2f := nil; + glMaterialf := nil; + glMaterialfv := nil; + glMateriali := nil; + glMaterialiv := nil; + glMatrixMode := nil; + glMultMatrixd := nil; + glMultMatrixf := nil; + glNewList := nil; + glNormal3b := nil; + glNormal3bv := nil; + glNormal3d := nil; + glNormal3dv := nil; + glNormal3f := nil; + glNormal3fv := nil; + glNormal3i := nil; + glNormal3iv := nil; + glNormal3s := nil; + glNormal3sv := nil; + glNormalPointer := nil; + glOrtho := nil; + glPassThrough := nil; + glPixelMapfv := nil; + glPixelMapuiv := nil; + glPixelMapusv := nil; + glPixelStoref := nil; + glPixelStorei := nil; + glPixelTransferf := nil; + glPixelTransferi := nil; + glPixelZoom := nil; + glPointSize := nil; + glPolygonMode := nil; + glPolygonOffset := nil; + glPolygonStipple := nil; + glPopAttrib := nil; + glPopClientAttrib := nil; + glPopMatrix := nil; + glPopName := nil; + glPrioritizeTextures := nil; + glPushAttrib := nil; + glPushClientAttrib := nil; + glPushMatrix := nil; + glPushName := nil; + glRasterPos2d := nil; + glRasterPos2dv := nil; + glRasterPos2f := nil; + glRasterPos2fv := nil; + glRasterPos2i := nil; + glRasterPos2iv := nil; + glRasterPos2s := nil; + glRasterPos2sv := nil; + glRasterPos3d := nil; + glRasterPos3dv := nil; + glRasterPos3f := nil; + glRasterPos3fv := nil; + glRasterPos3i := nil; + glRasterPos3iv := nil; + glRasterPos3s := nil; + glRasterPos3sv := nil; + glRasterPos4d := nil; + glRasterPos4dv := nil; + glRasterPos4f := nil; + glRasterPos4fv := nil; + glRasterPos4i := nil; + glRasterPos4iv := nil; + glRasterPos4s := nil; + glRasterPos4sv := nil; + glReadBuffer := nil; + glReadPixels := nil; + glRectd := nil; + glRectdv := nil; + glRectf := nil; + glRectfv := nil; + glRecti := nil; + glRectiv := nil; + glRects := nil; + glRectsv := nil; + glRenderMode := nil; + glRotated := nil; + glRotatef := nil; + glScaled := nil; + glScalef := nil; + glScissor := nil; + glSelectBuffer := nil; + glShadeModel := nil; + glStencilFunc := nil; + glStencilMask := nil; + glStencilOp := nil; + glTexCoord1d := nil; + glTexCoord1dv := nil; + glTexCoord1f := nil; + glTexCoord1fv := nil; + glTexCoord1i := nil; + glTexCoord1iv := nil; + glTexCoord1s := nil; + glTexCoord1sv := nil; + glTexCoord2d := nil; + glTexCoord2dv := nil; + glTexCoord2f := nil; + glTexCoord2fv := nil; + glTexCoord2i := nil; + glTexCoord2iv := nil; + glTexCoord2s := nil; + glTexCoord2sv := nil; + glTexCoord3d := nil; + glTexCoord3dv := nil; + glTexCoord3f := nil; + glTexCoord3fv := nil; + glTexCoord3i := nil; + glTexCoord3iv := nil; + glTexCoord3s := nil; + glTexCoord3sv := nil; + glTexCoord4d := nil; + glTexCoord4dv := nil; + glTexCoord4f := nil; + glTexCoord4fv := nil; + glTexCoord4i := nil; + glTexCoord4iv := nil; + glTexCoord4s := nil; + glTexCoord4sv := nil; + glTexCoordPointer := nil; + glTexEnvf := nil; + glTexEnvfv := nil; + glTexEnvi := nil; + glTexEnviv := nil; + glTexGend := nil; + glTexGendv := nil; + glTexGenf := nil; + glTexGenfv := nil; + glTexGeni := nil; + glTexGeniv := nil; + glTexImage1D := nil; + glTexImage2D := nil; + glTexParameterf := nil; + glTexParameterfv := nil; + glTexParameteri := nil; + glTexParameteriv := nil; + glTexSubImage1D := nil; + glTexSubImage2D := nil; + glTranslated := nil; + glTranslatef := nil; + glVertex2d := nil; + glVertex2dv := nil; + glVertex2f := nil; + glVertex2fv := nil; + glVertex2i := nil; + glVertex2iv := nil; + glVertex2s := nil; + glVertex2sv := nil; + glVertex3d := nil; + glVertex3dv := nil; + glVertex3f := nil; + glVertex3fv := nil; + glVertex3i := nil; + glVertex3iv := nil; + glVertex3s := nil; + glVertex3sv := nil; + glVertex4d := nil; + glVertex4dv := nil; + glVertex4f := nil; + glVertex4fv := nil; + glVertex4i := nil; + glVertex4iv := nil; + glVertex4s := nil; + glVertex4sv := nil; + glVertexPointer := nil; + glViewport := nil; + + {$ifdef Win32} + wglGetProcAddress := nil; + wglCopyContext := nil; + wglCreateContext := nil; + wglCreateLayerContext := nil; + wglDeleteContext := nil; + wglDescribeLayerPlane := nil; + wglGetCurrentContext := nil; + wglGetCurrentDC := nil; + wglGetLayerPaletteEntries := nil; + wglMakeCurrent := nil; + wglRealizeLayerPalette := nil; + wglSetLayerPaletteEntries := nil; + wglShareLists := nil; + wglSwapLayerBuffers := nil; + wglSwapMultipleBuffers := nil; + wglUseFontBitmapsA := nil; + wglUseFontOutlinesA := nil; + wglUseFontBitmapsW := nil; + wglUseFontOutlinesW := nil; + wglUseFontBitmaps := nil; + wglUseFontOutlines := nil; + {$endif} + + // GL 1.2 + glDrawRangeElements := nil; + glTexImage3D := nil; + + // GL 1.2 ARB imaging + glBlendColor := nil; + glBlendEquation := nil; + glColorSubTable := nil; + glCopyColorSubTable := nil; + glColorTable := nil; + glCopyColorTable := nil; + glColorTableParameteriv := nil; + glColorTableParameterfv := nil; + glGetColorTable := nil; + glGetColorTableParameteriv := nil; + glGetColorTableParameterfv := nil; + glConvolutionFilter1D := nil; + glConvolutionFilter2D := nil; + glCopyConvolutionFilter1D := nil; + glCopyConvolutionFilter2D := nil; + glGetConvolutionFilter := nil; + glSeparableFilter2D := nil; + glGetSeparableFilter := nil; + glConvolutionParameteri := nil; + glConvolutionParameteriv := nil; + glConvolutionParameterf := nil; + glConvolutionParameterfv := nil; + glGetConvolutionParameteriv := nil; + glGetConvolutionParameterfv := nil; + glHistogram := nil; + glResetHistogram := nil; + glGetHistogram := nil; + glGetHistogramParameteriv := nil; + glGetHistogramParameterfv := nil; + glMinmax := nil; + glResetMinmax := nil; + glGetMinmax := nil; + glGetMinmaxParameteriv := nil; + glGetMinmaxParameterfv := nil; + + // GLX + {$ifdef UNIX} + glXChooseVisual := nil; + glXCreateContext := nil; + glXDestroyContext := nil; + glXMakeCurrent := nil; + glXCopyContext := nil; + glXSwapBuffers := nil; + glXCreateGLXPixmap := nil; + glXDestroyGLXPixmap := nil; + glXQueryExtension := nil; + glXQueryVersion := nil; + glXIsDirect := nil; + glXGetConfig := nil; + glXGetCurrentContext := nil; + glXGetCurrentDrawable := nil; + glXWaitGL := nil; + glXWaitX := nil; + glXUseXFont := nil; + + // GLX 1.1 and later + glXQueryExtensionsString := nil; + glXQueryServerString := nil; + glXGetClientString := nil; + + // GLX 1.2 and later + glXGetCurrentDisplay := nil; + + // GLX 1.3 and later + glXChooseFBConfig := nil; + glXGetFBConfigAttrib := nil; + glXGetFBConfigs := nil; + glXGetVisualFromFBConfig := nil; + glXCreateWindow := nil; + glXDestroyWindow := nil; + glXCreatePixmap := nil; + glXDestroyPixmap := nil; + glXCreatePbuffer := nil; + glXDestroyPbuffer := nil; + glXQueryDrawable := nil; + glXCreateNewContext := nil; + glXMakeContextCurrent := nil; + glXGetCurrentReadDrawable := nil; + glXQueryContext := nil; + glXSelectEvent := nil; + glXGetSelectedEvent := nil; + glXGetVideoSyncSGI := nil; + glXWaitVideoSyncSGI := nil; + glXFreeContextEXT := nil; + glXGetContextIDEXT := nil; + glXGetCurrentDisplayEXT := nil; + glXImportContextEXT := nil; + glXQueryContextInfoEXT := nil; + glXCopySubBufferMESA := nil; + glXCreateGLXPixmapMESA := nil; + glXReleaseBuffersMESA := nil; + glXSet3DfxModeMESA := nil; + {$endif} +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure LoadProcAddresses; +begin + if GLHandle <> INVALID_MODULEHANDLE then + begin + glAccum := GetModuleSymbol( GLHandle, 'glAccum'); + glAlphaFunc := GetModuleSymbol( GLHandle, 'glAlphaFunc'); + glAreTexturesResident := GetModuleSymbol( GLHandle, 'glAreTexturesResident'); + glArrayElement := GetModuleSymbol( GLHandle, 'glArrayElement'); + glBegin := GetModuleSymbol( GLHandle, 'glBegin'); + glBindTexture := GetModuleSymbol( GLHandle, 'glBindTexture'); + glBitmap := GetModuleSymbol( GLHandle, 'glBitmap'); + glBlendFunc := GetModuleSymbol( GLHandle, 'glBlendFunc'); + glCallList := GetModuleSymbol( GLHandle, 'glCallList'); + glCallLists := GetModuleSymbol( GLHandle, 'glCallLists'); + glClear := GetModuleSymbol( GLHandle, 'glClear'); + glClearAccum := GetModuleSymbol( GLHandle, 'glClearAccum'); + glClearColor := GetModuleSymbol( GLHandle, 'glClearColor'); + glClearDepth := GetModuleSymbol( GLHandle, 'glClearDepth'); + glClearIndex := GetModuleSymbol( GLHandle, 'glClearIndex'); + glClearStencil := GetModuleSymbol( GLHandle, 'glClearStencil'); + glClipPlane := GetModuleSymbol( GLHandle, 'glClipPlane'); + glColor3b := GetModuleSymbol( GLHandle, 'glColor3b'); + glColor3bv := GetModuleSymbol( GLHandle, 'glColor3bv'); + glColor3d := GetModuleSymbol( GLHandle, 'glColor3d'); + glColor3dv := GetModuleSymbol( GLHandle, 'glColor3dv'); + glColor3f := GetModuleSymbol( GLHandle, 'glColor3f'); + glColor3fv := GetModuleSymbol( GLHandle, 'glColor3fv'); + glColor3i := GetModuleSymbol( GLHandle, 'glColor3i'); + glColor3iv := GetModuleSymbol( GLHandle, 'glColor3iv'); + glColor3s := GetModuleSymbol( GLHandle, 'glColor3s'); + glColor3sv := GetModuleSymbol( GLHandle, 'glColor3sv'); + glColor3ub := GetModuleSymbol( GLHandle, 'glColor3ub'); + glColor3ubv := GetModuleSymbol( GLHandle, 'glColor3ubv'); + glColor3ui := GetModuleSymbol( GLHandle, 'glColor3ui'); + glColor3uiv := GetModuleSymbol( GLHandle, 'glColor3uiv'); + glColor3us := GetModuleSymbol( GLHandle, 'glColor3us'); + glColor3usv := GetModuleSymbol( GLHandle, 'glColor3usv'); + glColor4b := GetModuleSymbol( GLHandle, 'glColor4b'); + glColor4bv := GetModuleSymbol( GLHandle, 'glColor4bv'); + glColor4d := GetModuleSymbol( GLHandle, 'glColor4d'); + glColor4dv := GetModuleSymbol( GLHandle, 'glColor4dv'); + glColor4f := GetModuleSymbol( GLHandle, 'glColor4f'); + glColor4fv := GetModuleSymbol( GLHandle, 'glColor4fv'); + glColor4i := GetModuleSymbol( GLHandle, 'glColor4i'); + glColor4iv := GetModuleSymbol( GLHandle, 'glColor4iv'); + glColor4s := GetModuleSymbol( GLHandle, 'glColor4s'); + glColor4sv := GetModuleSymbol( GLHandle, 'glColor4sv'); + glColor4ub := GetModuleSymbol( GLHandle, 'glColor4ub'); + glColor4ubv := GetModuleSymbol( GLHandle, 'glColor4ubv'); + glColor4ui := GetModuleSymbol( GLHandle, 'glColor4ui'); + glColor4uiv := GetModuleSymbol( GLHandle, 'glColor4uiv'); + glColor4us := GetModuleSymbol( GLHandle, 'glColor4us'); + glColor4usv := GetModuleSymbol( GLHandle, 'glColor4usv'); + glColorMask := GetModuleSymbol( GLHandle, 'glColorMask'); + glColorMaterial := GetModuleSymbol( GLHandle, 'glColorMaterial'); + glColorPointer := GetModuleSymbol( GLHandle, 'glColorPointer'); + glCopyPixels := GetModuleSymbol( GLHandle, 'glCopyPixels'); + glCopyTexImage1D := GetModuleSymbol( GLHandle, 'glCopyTexImage1D'); + glCopyTexImage2D := GetModuleSymbol( GLHandle, 'glCopyTexImage2D'); + glCopyTexSubImage1D := GetModuleSymbol( GLHandle, 'glCopyTexSubImage1D'); + glCopyTexSubImage2D := GetModuleSymbol( GLHandle, 'glCopyTexSubImage2D'); + glCullFace := GetModuleSymbol( GLHandle, 'glCullFace'); + glDeleteLists := GetModuleSymbol( GLHandle, 'glDeleteLists'); + glDeleteTextures := GetModuleSymbol( GLHandle, 'glDeleteTextures'); + glDepthFunc := GetModuleSymbol( GLHandle, 'glDepthFunc'); + glDepthMask := GetModuleSymbol( GLHandle, 'glDepthMask'); + glDepthRange := GetModuleSymbol( GLHandle, 'glDepthRange'); + glDisable := GetModuleSymbol( GLHandle, 'glDisable'); + glDisableClientState := GetModuleSymbol( GLHandle, 'glDisableClientState'); + glDrawArrays := GetModuleSymbol( GLHandle, 'glDrawArrays'); + glDrawBuffer := GetModuleSymbol( GLHandle, 'glDrawBuffer'); + glDrawElements := GetModuleSymbol( GLHandle, 'glDrawElements'); + glDrawPixels := GetModuleSymbol( GLHandle, 'glDrawPixels'); + glEdgeFlag := GetModuleSymbol( GLHandle, 'glEdgeFlag'); + glEdgeFlagPointer := GetModuleSymbol( GLHandle, 'glEdgeFlagPointer'); + glEdgeFlagv := GetModuleSymbol( GLHandle, 'glEdgeFlagv'); + glEnable := GetModuleSymbol( GLHandle, 'glEnable'); + glEnableClientState := GetModuleSymbol( GLHandle, 'glEnableClientState'); + glEnd := GetModuleSymbol( GLHandle, 'glEnd'); + glEndList := GetModuleSymbol( GLHandle, 'glEndList'); + glEvalCoord1d := GetModuleSymbol( GLHandle, 'glEvalCoord1d'); + glEvalCoord1dv := GetModuleSymbol( GLHandle, 'glEvalCoord1dv'); + glEvalCoord1f := GetModuleSymbol( GLHandle, 'glEvalCoord1f'); + glEvalCoord1fv := GetModuleSymbol( GLHandle, 'glEvalCoord1fv'); + glEvalCoord2d := GetModuleSymbol( GLHandle, 'glEvalCoord2d'); + glEvalCoord2dv := GetModuleSymbol( GLHandle, 'glEvalCoord2dv'); + glEvalCoord2f := GetModuleSymbol( GLHandle, 'glEvalCoord2f'); + glEvalCoord2fv := GetModuleSymbol( GLHandle, 'glEvalCoord2fv'); + glEvalMesh1 := GetModuleSymbol( GLHandle, 'glEvalMesh1'); + glEvalMesh2 := GetModuleSymbol( GLHandle, 'glEvalMesh2'); + glEvalPoint1 := GetModuleSymbol( GLHandle, 'glEvalPoint1'); + glEvalPoint2 := GetModuleSymbol( GLHandle, 'glEvalPoint2'); + glFeedbackBuffer := GetModuleSymbol( GLHandle, 'glFeedbackBuffer'); + glFinish := GetModuleSymbol( GLHandle, 'glFinish'); + glFlush := GetModuleSymbol( GLHandle, 'glFlush'); + glFogf := GetModuleSymbol( GLHandle, 'glFogf'); + glFogfv := GetModuleSymbol( GLHandle, 'glFogfv'); + glFogi := GetModuleSymbol( GLHandle, 'glFogi'); + glFogiv := GetModuleSymbol( GLHandle, 'glFogiv'); + glFrontFace := GetModuleSymbol( GLHandle, 'glFrontFace'); + glFrustum := GetModuleSymbol( GLHandle, 'glFrustum'); + glGenLists := GetModuleSymbol( GLHandle, 'glGenLists'); + glGenTextures := GetModuleSymbol( GLHandle, 'glGenTextures'); + glGetBooleanv := GetModuleSymbol( GLHandle, 'glGetBooleanv'); + glGetClipPlane := GetModuleSymbol( GLHandle, 'glGetClipPlane'); + glGetDoublev := GetModuleSymbol( GLHandle, 'glGetDoublev'); + glGetError := GetModuleSymbol( GLHandle, 'glGetError'); + glGetFloatv := GetModuleSymbol( GLHandle, 'glGetFloatv'); + glGetIntegerv := GetModuleSymbol( GLHandle, 'glGetIntegerv'); + glGetLightfv := GetModuleSymbol( GLHandle, 'glGetLightfv'); + glGetLightiv := GetModuleSymbol( GLHandle, 'glGetLightiv'); + glGetMapdv := GetModuleSymbol( GLHandle, 'glGetMapdv'); + glGetMapfv := GetModuleSymbol( GLHandle, 'glGetMapfv'); + glGetMapiv := GetModuleSymbol( GLHandle, 'glGetMapiv'); + glGetMaterialfv := GetModuleSymbol( GLHandle, 'glGetMaterialfv'); + glGetMaterialiv := GetModuleSymbol( GLHandle, 'glGetMaterialiv'); + glGetPixelMapfv := GetModuleSymbol( GLHandle, 'glGetPixelMapfv'); + glGetPixelMapuiv := GetModuleSymbol( GLHandle, 'glGetPixelMapuiv'); + glGetPixelMapusv := GetModuleSymbol( GLHandle, 'glGetPixelMapusv'); + glGetPointerv := GetModuleSymbol( GLHandle, 'glGetPointerv'); + glGetPolygonStipple := GetModuleSymbol( GLHandle, 'glGetPolygonStipple'); + glGetString := GetModuleSymbol( GLHandle, 'glGetString'); + glGetTexEnvfv := GetModuleSymbol( GLHandle, 'glGetTexEnvfv'); + glGetTexEnviv := GetModuleSymbol( GLHandle, 'glGetTexEnviv'); + glGetTexGendv := GetModuleSymbol( GLHandle, 'glGetTexGendv'); + glGetTexGenfv := GetModuleSymbol( GLHandle, 'glGetTexGenfv'); + glGetTexGeniv := GetModuleSymbol( GLHandle, 'glGetTexGeniv'); + glGetTexImage := GetModuleSymbol( GLHandle, 'glGetTexImage'); + glGetTexLevelParameterfv := GetModuleSymbol( GLHandle, 'glGetTexLevelParameterfv'); + glGetTexLevelParameteriv := GetModuleSymbol( GLHandle, 'glGetTexLevelParameteriv'); + glGetTexParameterfv := GetModuleSymbol( GLHandle, 'glGetTexParameterfv'); + glGetTexParameteriv := GetModuleSymbol( GLHandle, 'glGetTexParameteriv'); + glHint := GetModuleSymbol( GLHandle, 'glHint'); + glIndexMask := GetModuleSymbol( GLHandle, 'glIndexMask'); + glIndexPointer := GetModuleSymbol( GLHandle, 'glIndexPointer'); + glIndexd := GetModuleSymbol( GLHandle, 'glIndexd'); + glIndexdv := GetModuleSymbol( GLHandle, 'glIndexdv'); + glIndexf := GetModuleSymbol( GLHandle, 'glIndexf'); + glIndexfv := GetModuleSymbol( GLHandle, 'glIndexfv'); + glIndexi := GetModuleSymbol( GLHandle, 'glIndexi'); + glIndexiv := GetModuleSymbol( GLHandle, 'glIndexiv'); + glIndexs := GetModuleSymbol( GLHandle, 'glIndexs'); + glIndexsv := GetModuleSymbol( GLHandle, 'glIndexsv'); + glIndexub := GetModuleSymbol( GLHandle, 'glIndexub'); + glIndexubv := GetModuleSymbol( GLHandle, 'glIndexubv'); + glInitNames := GetModuleSymbol( GLHandle, 'glInitNames'); + glInterleavedArrays := GetModuleSymbol( GLHandle, 'glInterleavedArrays'); + glIsEnabled := GetModuleSymbol( GLHandle, 'glIsEnabled'); + glIsList := GetModuleSymbol( GLHandle, 'glIsList'); + glIsTexture := GetModuleSymbol( GLHandle, 'glIsTexture'); + glLightModelf := GetModuleSymbol( GLHandle, 'glLightModelf'); + glLightModelfv := GetModuleSymbol( GLHandle, 'glLightModelfv'); + glLightModeli := GetModuleSymbol( GLHandle, 'glLightModeli'); + glLightModeliv := GetModuleSymbol( GLHandle, 'glLightModeliv'); + glLightf := GetModuleSymbol( GLHandle, 'glLightf'); + glLightfv := GetModuleSymbol( GLHandle, 'glLightfv'); + glLighti := GetModuleSymbol( GLHandle, 'glLighti'); + glLightiv := GetModuleSymbol( GLHandle, 'glLightiv'); + glLineStipple := GetModuleSymbol( GLHandle, 'glLineStipple'); + glLineWidth := GetModuleSymbol( GLHandle, 'glLineWidth'); + glListBase := GetModuleSymbol( GLHandle, 'glListBase'); + glLoadIdentity := GetModuleSymbol( GLHandle, 'glLoadIdentity'); + glLoadMatrixd := GetModuleSymbol( GLHandle, 'glLoadMatrixd'); + glLoadMatrixf := GetModuleSymbol( GLHandle, 'glLoadMatrixf'); + glLoadName := GetModuleSymbol( GLHandle, 'glLoadName'); + glLogicOp := GetModuleSymbol( GLHandle, 'glLogicOp'); + glMap1d := GetModuleSymbol( GLHandle, 'glMap1d'); + glMap1f := GetModuleSymbol( GLHandle, 'glMap1f'); + glMap2d := GetModuleSymbol( GLHandle, 'glMap2d'); + glMap2f := GetModuleSymbol( GLHandle, 'glMap2f'); + glMapGrid1d := GetModuleSymbol( GLHandle, 'glMapGrid1d'); + glMapGrid1f := GetModuleSymbol( GLHandle, 'glMapGrid1f'); + glMapGrid2d := GetModuleSymbol( GLHandle, 'glMapGrid2d'); + glMapGrid2f := GetModuleSymbol( GLHandle, 'glMapGrid2f'); + glMaterialf := GetModuleSymbol( GLHandle, 'glMaterialf'); + glMaterialfv := GetModuleSymbol( GLHandle, 'glMaterialfv'); + glMateriali := GetModuleSymbol( GLHandle, 'glMateriali'); + glMaterialiv := GetModuleSymbol( GLHandle, 'glMaterialiv'); + glMatrixMode := GetModuleSymbol( GLHandle, 'glMatrixMode'); + glMultMatrixd := GetModuleSymbol( GLHandle, 'glMultMatrixd'); + glMultMatrixf := GetModuleSymbol( GLHandle, 'glMultMatrixf'); + glNewList := GetModuleSymbol( GLHandle, 'glNewList'); + glNormal3b := GetModuleSymbol( GLHandle, 'glNormal3b'); + glNormal3bv := GetModuleSymbol( GLHandle, 'glNormal3bv'); + glNormal3d := GetModuleSymbol( GLHandle, 'glNormal3d'); + glNormal3dv := GetModuleSymbol( GLHandle, 'glNormal3dv'); + glNormal3f := GetModuleSymbol( GLHandle, 'glNormal3f'); + glNormal3fv := GetModuleSymbol( GLHandle, 'glNormal3fv'); + glNormal3i := GetModuleSymbol( GLHandle, 'glNormal3i'); + glNormal3iv := GetModuleSymbol( GLHandle, 'glNormal3iv'); + glNormal3s := GetModuleSymbol( GLHandle, 'glNormal3s'); + glNormal3sv := GetModuleSymbol( GLHandle, 'glNormal3sv'); + glNormalPointer := GetModuleSymbol( GLHandle, 'glNormalPointer'); + glOrtho := GetModuleSymbol( GLHandle, 'glOrtho'); + glPassThrough := GetModuleSymbol( GLHandle, 'glPassThrough'); + glPixelMapfv := GetModuleSymbol( GLHandle, 'glPixelMapfv'); + glPixelMapuiv := GetModuleSymbol( GLHandle, 'glPixelMapuiv'); + glPixelMapusv := GetModuleSymbol( GLHandle, 'glPixelMapusv'); + glPixelStoref := GetModuleSymbol( GLHandle, 'glPixelStoref'); + glPixelStorei := GetModuleSymbol( GLHandle, 'glPixelStorei'); + glPixelTransferf := GetModuleSymbol( GLHandle, 'glPixelTransferf'); + glPixelTransferi := GetModuleSymbol( GLHandle, 'glPixelTransferi'); + glPixelZoom := GetModuleSymbol( GLHandle, 'glPixelZoom'); + glPointSize := GetModuleSymbol( GLHandle, 'glPointSize'); + glPolygonMode := GetModuleSymbol( GLHandle, 'glPolygonMode'); + glPolygonOffset := GetModuleSymbol( GLHandle, 'glPolygonOffset'); + glPolygonStipple := GetModuleSymbol( GLHandle, 'glPolygonStipple'); + glPopAttrib := GetModuleSymbol( GLHandle, 'glPopAttrib'); + glPopClientAttrib := GetModuleSymbol( GLHandle, 'glPopClientAttrib'); + glPopMatrix := GetModuleSymbol( GLHandle, 'glPopMatrix'); + glPopName := GetModuleSymbol( GLHandle, 'glPopName'); + glPrioritizeTextures := GetModuleSymbol( GLHandle, 'glPrioritizeTextures'); + glPushAttrib := GetModuleSymbol( GLHandle, 'glPushAttrib'); + glPushClientAttrib := GetModuleSymbol( GLHandle, 'glPushClientAttrib'); + glPushMatrix := GetModuleSymbol( GLHandle, 'glPushMatrix'); + glPushName := GetModuleSymbol( GLHandle, 'glPushName'); + glRasterPos2d := GetModuleSymbol( GLHandle, 'glRasterPos2d'); + glRasterPos2dv := GetModuleSymbol( GLHandle, 'glRasterPos2dv'); + glRasterPos2f := GetModuleSymbol( GLHandle, 'glRasterPos2f'); + glRasterPos2fv := GetModuleSymbol( GLHandle, 'glRasterPos2fv'); + glRasterPos2i := GetModuleSymbol( GLHandle, 'glRasterPos2i'); + glRasterPos2iv := GetModuleSymbol( GLHandle, 'glRasterPos2iv'); + glRasterPos2s := GetModuleSymbol( GLHandle, 'glRasterPos2s'); + glRasterPos2sv := GetModuleSymbol( GLHandle, 'glRasterPos2sv'); + glRasterPos3d := GetModuleSymbol( GLHandle, 'glRasterPos3d'); + glRasterPos3dv := GetModuleSymbol( GLHandle, 'glRasterPos3dv'); + glRasterPos3f := GetModuleSymbol( GLHandle, 'glRasterPos3f'); + glRasterPos3fv := GetModuleSymbol( GLHandle, 'glRasterPos3fv'); + glRasterPos3i := GetModuleSymbol( GLHandle, 'glRasterPos3i'); + glRasterPos3iv := GetModuleSymbol( GLHandle, 'glRasterPos3iv'); + glRasterPos3s := GetModuleSymbol( GLHandle, 'glRasterPos3s'); + glRasterPos3sv := GetModuleSymbol( GLHandle, 'glRasterPos3sv'); + glRasterPos4d := GetModuleSymbol( GLHandle, 'glRasterPos4d'); + glRasterPos4dv := GetModuleSymbol( GLHandle, 'glRasterPos4dv'); + glRasterPos4f := GetModuleSymbol( GLHandle, 'glRasterPos4f'); + glRasterPos4fv := GetModuleSymbol( GLHandle, 'glRasterPos4fv'); + glRasterPos4i := GetModuleSymbol( GLHandle, 'glRasterPos4i'); + glRasterPos4iv := GetModuleSymbol( GLHandle, 'glRasterPos4iv'); + glRasterPos4s := GetModuleSymbol( GLHandle, 'glRasterPos4s'); + glRasterPos4sv := GetModuleSymbol( GLHandle, 'glRasterPos4sv'); + glReadBuffer := GetModuleSymbol( GLHandle, 'glReadBuffer'); + glReadPixels := GetModuleSymbol( GLHandle, 'glReadPixels'); + glRectd := GetModuleSymbol( GLHandle, 'glRectd'); + glRectdv := GetModuleSymbol( GLHandle, 'glRectdv'); + glRectf := GetModuleSymbol( GLHandle, 'glRectf'); + glRectfv := GetModuleSymbol( GLHandle, 'glRectfv'); + glRecti := GetModuleSymbol( GLHandle, 'glRecti'); + glRectiv := GetModuleSymbol( GLHandle, 'glRectiv'); + glRects := GetModuleSymbol( GLHandle, 'glRects'); + glRectsv := GetModuleSymbol( GLHandle, 'glRectsv'); + glRenderMode := GetModuleSymbol( GLHandle, 'glRenderMode'); + glRotated := GetModuleSymbol( GLHandle, 'glRotated'); + glRotatef := GetModuleSymbol( GLHandle, 'glRotatef'); + glScaled := GetModuleSymbol( GLHandle, 'glScaled'); + glScalef := GetModuleSymbol( GLHandle, 'glScalef'); + glScissor := GetModuleSymbol( GLHandle, 'glScissor'); + glSelectBuffer := GetModuleSymbol( GLHandle, 'glSelectBuffer'); + glShadeModel := GetModuleSymbol( GLHandle, 'glShadeModel'); + glStencilFunc := GetModuleSymbol( GLHandle, 'glStencilFunc'); + glStencilMask := GetModuleSymbol( GLHandle, 'glStencilMask'); + glStencilOp := GetModuleSymbol( GLHandle, 'glStencilOp'); + glTexCoord1d := GetModuleSymbol( GLHandle, 'glTexCoord1d'); + glTexCoord1dv := GetModuleSymbol( GLHandle, 'glTexCoord1dv'); + glTexCoord1f := GetModuleSymbol( GLHandle, 'glTexCoord1f'); + glTexCoord1fv := GetModuleSymbol( GLHandle, 'glTexCoord1fv'); + glTexCoord1i := GetModuleSymbol( GLHandle, 'glTexCoord1i'); + glTexCoord1iv := GetModuleSymbol( GLHandle, 'glTexCoord1iv'); + glTexCoord1s := GetModuleSymbol( GLHandle, 'glTexCoord1s'); + glTexCoord1sv := GetModuleSymbol( GLHandle, 'glTexCoord1sv'); + glTexCoord2d := GetModuleSymbol( GLHandle, 'glTexCoord2d'); + glTexCoord2dv := GetModuleSymbol( GLHandle, 'glTexCoord2dv'); + glTexCoord2f := GetModuleSymbol( GLHandle, 'glTexCoord2f'); + glTexCoord2fv := GetModuleSymbol( GLHandle, 'glTexCoord2fv'); + glTexCoord2i := GetModuleSymbol( GLHandle, 'glTexCoord2i'); + glTexCoord2iv := GetModuleSymbol( GLHandle, 'glTexCoord2iv'); + glTexCoord2s := GetModuleSymbol( GLHandle, 'glTexCoord2s'); + glTexCoord2sv := GetModuleSymbol( GLHandle, 'glTexCoord2sv'); + glTexCoord3d := GetModuleSymbol( GLHandle, 'glTexCoord3d'); + glTexCoord3dv := GetModuleSymbol( GLHandle, 'glTexCoord3dv'); + glTexCoord3f := GetModuleSymbol( GLHandle, 'glTexCoord3f'); + glTexCoord3fv := GetModuleSymbol( GLHandle, 'glTexCoord3fv'); + glTexCoord3i := GetModuleSymbol( GLHandle, 'glTexCoord3i'); + glTexCoord3iv := GetModuleSymbol( GLHandle, 'glTexCoord3iv'); + glTexCoord3s := GetModuleSymbol( GLHandle, 'glTexCoord3s'); + glTexCoord3sv := GetModuleSymbol( GLHandle, 'glTexCoord3sv'); + glTexCoord4d := GetModuleSymbol( GLHandle, 'glTexCoord4d'); + glTexCoord4dv := GetModuleSymbol( GLHandle, 'glTexCoord4dv'); + glTexCoord4f := GetModuleSymbol( GLHandle, 'glTexCoord4f'); + glTexCoord4fv := GetModuleSymbol( GLHandle, 'glTexCoord4fv'); + glTexCoord4i := GetModuleSymbol( GLHandle, 'glTexCoord4i'); + glTexCoord4iv := GetModuleSymbol( GLHandle, 'glTexCoord4iv'); + glTexCoord4s := GetModuleSymbol( GLHandle, 'glTexCoord4s'); + glTexCoord4sv := GetModuleSymbol( GLHandle, 'glTexCoord4sv'); + glTexCoordPointer := GetModuleSymbol( GLHandle, 'glTexCoordPointer'); + glTexEnvf := GetModuleSymbol( GLHandle, 'glTexEnvf'); + glTexEnvfv := GetModuleSymbol( GLHandle, 'glTexEnvfv'); + glTexEnvi := GetModuleSymbol( GLHandle, 'glTexEnvi'); + glTexEnviv := GetModuleSymbol( GLHandle, 'glTexEnviv'); + glTexGend := GetModuleSymbol( GLHandle, 'glTexGend'); + glTexGendv := GetModuleSymbol( GLHandle, 'glTexGendv'); + glTexGenf := GetModuleSymbol( GLHandle, 'glTexGenf'); + glTexGenfv := GetModuleSymbol( GLHandle, 'glTexGenfv'); + glTexGeni := GetModuleSymbol( GLHandle, 'glTexGeni'); + glTexGeniv := GetModuleSymbol( GLHandle, 'glTexGeniv'); + glTexImage1D := GetModuleSymbol( GLHandle, 'glTexImage1D'); + glTexImage2D := GetModuleSymbol( GLHandle, 'glTexImage2D'); + glTexParameterf := GetModuleSymbol( GLHandle, 'glTexParameterf'); + glTexParameterfv := GetModuleSymbol( GLHandle, 'glTexParameterfv'); + glTexParameteri := GetModuleSymbol( GLHandle, 'glTexParameteri'); + glTexParameteriv := GetModuleSymbol( GLHandle, 'glTexParameteriv'); + glTexSubImage1D := GetModuleSymbol( GLHandle, 'glTexSubImage1D'); + glTexSubImage2D := GetModuleSymbol( GLHandle, 'glTexSubImage2D'); + glTranslated := GetModuleSymbol( GLHandle, 'glTranslated'); + glTranslatef := GetModuleSymbol( GLHandle, 'glTranslatef'); + glVertex2d := GetModuleSymbol( GLHandle, 'glVertex2d'); + glVertex2dv := GetModuleSymbol( GLHandle, 'glVertex2dv'); + glVertex2f := GetModuleSymbol( GLHandle, 'glVertex2f'); + glVertex2fv := GetModuleSymbol( GLHandle, 'glVertex2fv'); + glVertex2i := GetModuleSymbol( GLHandle, 'glVertex2i'); + glVertex2iv := GetModuleSymbol( GLHandle, 'glVertex2iv'); + glVertex2s := GetModuleSymbol( GLHandle, 'glVertex2s'); + glVertex2sv := GetModuleSymbol( GLHandle, 'glVertex2sv'); + glVertex3d := GetModuleSymbol( GLHandle, 'glVertex3d'); + glVertex3dv := GetModuleSymbol( GLHandle, 'glVertex3dv'); + glVertex3f := GetModuleSymbol( GLHandle, 'glVertex3f'); + glVertex3fv := GetModuleSymbol( GLHandle, 'glVertex3fv'); + glVertex3i := GetModuleSymbol( GLHandle, 'glVertex3i'); + glVertex3iv := GetModuleSymbol( GLHandle, 'glVertex3iv'); + glVertex3s := GetModuleSymbol( GLHandle, 'glVertex3s'); + glVertex3sv := GetModuleSymbol( GLHandle, 'glVertex3sv'); + glVertex4d := GetModuleSymbol( GLHandle, 'glVertex4d'); + glVertex4dv := GetModuleSymbol( GLHandle, 'glVertex4dv'); + glVertex4f := GetModuleSymbol( GLHandle, 'glVertex4f'); + glVertex4fv := GetModuleSymbol( GLHandle, 'glVertex4fv'); + glVertex4i := GetModuleSymbol( GLHandle, 'glVertex4i'); + glVertex4iv := GetModuleSymbol( GLHandle, 'glVertex4iv'); + glVertex4s := GetModuleSymbol( GLHandle, 'glVertex4s'); + glVertex4sv := GetModuleSymbol( GLHandle, 'glVertex4sv'); + glVertexPointer := GetModuleSymbol( GLHandle, 'glVertexPointer'); + glViewport := GetModuleSymbol( GLHandle, 'glViewport'); + + // window support routines + {$ifdef Win32} + wglGetProcAddress := GetModuleSymbol( GLHandle, 'wglGetProcAddress'); + wglCopyContext := GetModuleSymbol( GLHandle, 'wglCopyContext'); + wglCreateContext := GetModuleSymbol( GLHandle, 'wglCreateContext'); + wglCreateLayerContext := GetModuleSymbol( GLHandle, 'wglCreateLayerContext'); + wglDeleteContext := GetModuleSymbol( GLHandle, 'wglDeleteContext'); + wglDescribeLayerPlane := GetModuleSymbol( GLHandle, 'wglDescribeLayerPlane'); + wglGetCurrentContext := GetModuleSymbol( GLHandle, 'wglGetCurrentContext'); + wglGetCurrentDC := GetModuleSymbol( GLHandle, 'wglGetCurrentDC'); + wglGetLayerPaletteEntries := GetModuleSymbol( GLHandle, 'wglGetLayerPaletteEntries'); + wglMakeCurrent := GetModuleSymbol( GLHandle, 'wglMakeCurrent'); + wglRealizeLayerPalette := GetModuleSymbol( GLHandle, 'wglRealizeLayerPalette'); + wglSetLayerPaletteEntries := GetModuleSymbol( GLHandle, 'wglSetLayerPaletteEntries'); + wglShareLists := GetModuleSymbol( GLHandle, 'wglShareLists'); + wglSwapLayerBuffers := GetModuleSymbol( GLHandle, 'wglSwapLayerBuffers'); + wglSwapMultipleBuffers := GetModuleSymbol( GLHandle, 'wglSwapMultipleBuffers'); + wglUseFontBitmapsA := GetModuleSymbol( GLHandle, 'wglUseFontBitmapsA'); + wglUseFontOutlinesA := GetModuleSymbol( GLHandle, 'wglUseFontOutlinesA'); + wglUseFontBitmapsW := GetModuleSymbol( GLHandle, 'wglUseFontBitmapsW'); + wglUseFontOutlinesW := GetModuleSymbol( GLHandle, 'wglUseFontOutlinesW'); + wglUseFontBitmaps := GetModuleSymbol( GLHandle, 'wglUseFontBitmapsA'); + wglUseFontOutlines := GetModuleSymbol( GLHandle, 'wglUseFontOutlinesA'); + {$endif} + + // GL 1.2 + glDrawRangeElements := GetModuleSymbol( GLHandle, 'glDrawRangeElements'); + glTexImage3D := GetModuleSymbol( GLHandle, 'glTexImage3D'); + + // GL 1.2 ARB imaging + glBlendColor := GetModuleSymbol( GLHandle, 'glBlendColor'); + glBlendEquation := GetModuleSymbol( GLHandle, 'glBlendEquation'); + glColorSubTable := GetModuleSymbol( GLHandle, 'glColorSubTable'); + glCopyColorSubTable := GetModuleSymbol( GLHandle, 'glCopyColorSubTable'); + glColorTable := GetModuleSymbol( GLHandle, 'glCopyColorSubTable'); + glCopyColorTable := GetModuleSymbol( GLHandle, 'glCopyColorTable'); + glColorTableParameteriv := GetModuleSymbol( GLHandle, 'glColorTableParameteriv'); + glColorTableParameterfv := GetModuleSymbol( GLHandle, 'glColorTableParameterfv'); + glGetColorTable := GetModuleSymbol( GLHandle, 'glGetColorTable'); + glGetColorTableParameteriv := GetModuleSymbol( GLHandle, 'glGetColorTableParameteriv'); + glGetColorTableParameterfv := GetModuleSymbol( GLHandle, 'glGetColorTableParameterfv'); + glConvolutionFilter1D := GetModuleSymbol( GLHandle, 'glConvolutionFilter1D'); + glConvolutionFilter2D := GetModuleSymbol( GLHandle, 'glConvolutionFilter2D'); + glCopyConvolutionFilter1D := GetModuleSymbol( GLHandle, 'glCopyConvolutionFilter1D'); + glCopyConvolutionFilter2D := GetModuleSymbol( GLHandle, 'glCopyConvolutionFilter2D'); + glGetConvolutionFilter := GetModuleSymbol( GLHandle, 'glGetConvolutionFilter'); + glSeparableFilter2D := GetModuleSymbol( GLHandle, 'glSeparableFilter2D'); + glGetSeparableFilter := GetModuleSymbol( GLHandle, 'glGetSeparableFilter'); + glConvolutionParameteri := GetModuleSymbol( GLHandle, 'glConvolutionParameteri'); + glConvolutionParameteriv := GetModuleSymbol( GLHandle, 'glConvolutionParameteriv'); + glConvolutionParameterf := GetModuleSymbol( GLHandle, 'glConvolutionParameterf'); + glConvolutionParameterfv := GetModuleSymbol( GLHandle, 'glConvolutionParameterfv'); + glGetConvolutionParameteriv := GetModuleSymbol( GLHandle, 'glGetConvolutionParameteriv'); + glGetConvolutionParameterfv := GetModuleSymbol( GLHandle, 'glGetConvolutionParameterfv'); + glHistogram := GetModuleSymbol( GLHandle, 'glHistogram'); + glResetHistogram := GetModuleSymbol( GLHandle, 'glResetHistogram'); + glGetHistogram := GetModuleSymbol( GLHandle, 'glGetHistogram'); + glGetHistogramParameteriv := GetModuleSymbol( GLHandle, 'glGetHistogramParameteriv'); + glGetHistogramParameterfv := GetModuleSymbol( GLHandle, 'glGetHistogramParameterfv'); + glMinmax := GetModuleSymbol( GLHandle, 'glMinmax'); + glResetMinmax := GetModuleSymbol( GLHandle, 'glResetMinmax'); + glGetMinmax := GetModuleSymbol( GLHandle, 'glGetMinmax'); + glGetMinmaxParameteriv := GetModuleSymbol( GLHandle, 'glGetMinmaxParameteriv'); + glGetMinmaxParameterfv := GetModuleSymbol( GLHandle, 'glGetMinmaxParameterfv'); + + {$ifdef UNIX} + glXChooseVisual := GetModuleSymbol( GLHandle, 'glXChooseVisual'); + glXCreateContext := GetModuleSymbol( GLHandle, 'glXCreateContext'); + glXDestroyContext := GetModuleSymbol( GLHandle, 'glXDestroyContext'); + glXMakeCurrent := GetModuleSymbol( GLHandle, 'glXMakeCurrent'); + glXCopyContext := GetModuleSymbol( GLHandle, 'glXCopyContext'); + glXSwapBuffers := GetModuleSymbol( GLHandle, 'glXSwapBuffers'); + glXCreateGLXPixmap := GetModuleSymbol( GLHandle, 'glXCreateGLXPixmap'); + glXDestroyGLXPixmap := GetModuleSymbol( GLHandle, 'glXDestroyGLXPixmap'); + glXQueryExtension := GetModuleSymbol( GLHandle, 'glXQueryExtension'); + glXQueryVersion := GetModuleSymbol( GLHandle, 'glXQueryVersion'); + glXIsDirect := GetModuleSymbol( GLHandle, 'glXIsDirect'); + glXGetConfig := GetModuleSymbol( GLHandle, 'glXGetConfig'); + glXGetCurrentContext := GetModuleSymbol( GLHandle, 'glXGetCurrentContext'); + glXGetCurrentDrawable := GetModuleSymbol( GLHandle, 'glXGetCurrentDrawable'); + glXWaitGL := GetModuleSymbol( GLHandle, 'glXWaitGL'); + glXWaitX := GetModuleSymbol( GLHandle, 'glXWaitX'); + glXUseXFont := GetModuleSymbol( GLHandle, 'glXUseXFont'); + glXQueryExtensionsString := GetModuleSymbol( GLHandle, 'glXQueryExtensionsString'); + glXQueryServerString := GetModuleSymbol( GLHandle, 'glXQueryServerString'); + glXGetClientString := GetModuleSymbol( GLHandle, 'glXGetClientString'); + glXGetCurrentDisplay := GetModuleSymbol( GLHandle, 'glXGetCurrentDisplay'); + glXChooseFBConfig := GetModuleSymbol( GLHandle, 'glXChooseFBConfig'); + glXGetFBConfigAttrib := GetModuleSymbol( GLHandle, 'glXGetFBConfigAttrib'); + glXGetFBConfigs := GetModuleSymbol( GLHandle, 'glXGetFBConfigs'); + glXGetVisualFromFBConfig := GetModuleSymbol( GLHandle, 'glXGetVisualFromFBConfig'); + glXCreateWindow := GetModuleSymbol( GLHandle, 'glXCreateWindow'); + glXDestroyWindow := GetModuleSymbol( GLHandle, 'glXDestroyWindow'); + glXCreatePixmap := GetModuleSymbol( GLHandle, 'glXCreatePixmap'); + glXDestroyPixmap := GetModuleSymbol( GLHandle, 'glXDestroyPixmap'); + glXCreatePbuffer := GetModuleSymbol( GLHandle, 'glXCreatePbuffer'); + glXDestroyPbuffer := GetModuleSymbol( GLHandle, 'glXDestroyPbuffer'); + glXQueryDrawable := GetModuleSymbol( GLHandle, 'glXQueryDrawable'); + glXCreateNewContext := GetModuleSymbol( GLHandle, 'glXCreateNewContext'); + glXMakeContextCurrent := GetModuleSymbol( GLHandle, 'glXMakeContextCurrent'); + glXGetCurrentReadDrawable := GetModuleSymbol( GLHandle, 'glXGetCurrentReadDrawable'); + glXQueryContext := GetModuleSymbol( GLHandle, 'glXQueryContext'); + glXSelectEvent := GetModuleSymbol( GLHandle, 'glXSelectEvent'); + glXGetSelectedEvent := GetModuleSymbol( GLHandle, 'glXGetSelectedEvent'); + glXGetVideoSyncSGI := GetModuleSymbol( GLHandle, 'glXGetVideoSyncSGI'); + glXWaitVideoSyncSGI := GetModuleSymbol( GLHandle, 'glXWaitVideoSyncSGI'); + glXFreeContextEXT := GetModuleSymbol( GLHandle, 'glXFreeContextEXT'); + glXGetContextIDEXT := GetModuleSymbol( GLHandle, 'glXGetContextIDEXT'); + glXGetCurrentDisplayEXT := GetModuleSymbol( GLHandle, 'glXGetCurrentDisplayEXT'); + glXImportContextEXT := GetModuleSymbol( GLHandle, 'glXImportContextEXT'); + glXQueryContextInfoEXT := GetModuleSymbol( GLHandle, 'glXQueryContextInfoEXT'); + glXCopySubBufferMESA := GetModuleSymbol( GLHandle, 'glXCopySubBufferMESA'); + glXCreateGLXPixmapMESA := GetModuleSymbol( GLHandle, 'glXCreateGLXPixmapMESA'); + glXReleaseBuffersMESA := GetModuleSymbol( GLHandle, 'glXReleaseBuffersMESA'); + glXSet3DfxModeMESA := GetModuleSymbol( GLHandle, 'glXSet3DfxModeMESA'); + {$endif} + end; + + if GLUHandle <> INVALID_MODULEHANDLE then + begin + GLHandle := TModuleHandle(GLUHandle); // Kylix compatiblilty trick + + gluBeginCurve := GetModuleSymbol( GLUHandle, 'gluBeginCurve'); + gluBeginPolygon := GetModuleSymbol( GLUHandle, 'gluBeginPolygon'); + gluBeginSurface := GetModuleSymbol( GLUHandle, 'gluBeginSurface'); + gluBeginTrim := GetModuleSymbol( GLUHandle, 'gluBeginTrim'); + gluBuild1DMipmaps := GetModuleSymbol( GLUHandle, 'gluBuild1DMipmaps'); + gluBuild2DMipmaps := GetModuleSymbol( GLUHandle, 'gluBuild2DMipmaps'); + gluCylinder := GetModuleSymbol( GLUHandle, 'gluCylinder'); + gluDeleteNurbsRenderer := GetModuleSymbol( GLUHandle, 'gluDeleteNurbsRenderer'); + gluDeleteQuadric := GetModuleSymbol( GLUHandle, 'gluDeleteQuadric'); + gluDeleteTess := GetModuleSymbol( GLUHandle, 'gluDeleteTess'); + gluDisk := GetModuleSymbol( GLUHandle, 'gluDisk'); + gluEndCurve := GetModuleSymbol( GLUHandle, 'gluEndCurve'); + gluEndPolygon := GetModuleSymbol( GLUHandle, 'gluEndPolygon'); + gluEndSurface := GetModuleSymbol( GLUHandle, 'gluEndSurface'); + gluEndTrim := GetModuleSymbol( GLUHandle, 'gluEndTrim'); + gluErrorString := GetModuleSymbol( GLUHandle, 'gluErrorString'); + gluGetNurbsProperty := GetModuleSymbol( GLUHandle, 'gluGetNurbsProperty'); + gluGetString := GetModuleSymbol( GLUHandle, 'gluGetString'); + gluGetTessProperty := GetModuleSymbol( GLUHandle, 'gluGetTessProperty'); + gluLoadSamplingMatrices := GetModuleSymbol( GLUHandle, 'gluLoadSamplingMatrices'); + gluLookAt := GetModuleSymbol( GLUHandle, 'gluLookAt'); + gluNewNurbsRenderer := GetModuleSymbol( GLUHandle, 'gluNewNurbsRenderer'); + gluNewQuadric := GetModuleSymbol( GLUHandle, 'gluNewQuadric'); + gluNewTess := GetModuleSymbol( GLUHandle, 'gluNewTess'); + gluNextContour := GetModuleSymbol( GLUHandle, 'gluNextContour'); + gluNurbsCallback := GetModuleSymbol( GLUHandle, 'gluNurbsCallback'); + gluNurbsCurve := GetModuleSymbol( GLUHandle, 'gluNurbsCurve'); + gluNurbsProperty := GetModuleSymbol( GLUHandle, 'gluNurbsProperty'); + gluNurbsSurface := GetModuleSymbol( GLUHandle, 'gluNurbsSurface'); + gluOrtho2D := GetModuleSymbol( GLUHandle, 'gluOrtho2D'); + gluPartialDisk := GetModuleSymbol( GLUHandle, 'gluPartialDisk'); + gluPerspective := GetModuleSymbol( GLUHandle, 'gluPerspective'); + gluPickMatrix := GetModuleSymbol( GLUHandle, 'gluPickMatrix'); + gluProject := GetModuleSymbol( GLUHandle, 'gluProject'); + gluPwlCurve := GetModuleSymbol( GLUHandle, 'gluPwlCurve'); + gluQuadricCallback := GetModuleSymbol( GLUHandle, 'gluQuadricCallback'); + gluQuadricDrawStyle := GetModuleSymbol( GLUHandle, 'gluQuadricDrawStyle'); + gluQuadricNormals := GetModuleSymbol( GLUHandle, 'gluQuadricNormals'); + gluQuadricOrientation := GetModuleSymbol( GLUHandle, 'gluQuadricOrientation'); + gluQuadricTexture := GetModuleSymbol( GLUHandle, 'gluQuadricTexture'); + gluScaleImage := GetModuleSymbol( GLUHandle, 'gluScaleImage'); + gluSphere := GetModuleSymbol( GLUHandle, 'gluSphere'); + gluTessBeginContour := GetModuleSymbol( GLUHandle, 'gluTessBeginContour'); + gluTessBeginPolygon := GetModuleSymbol( GLUHandle, 'gluTessBeginPolygon'); + gluTessCallback := GetModuleSymbol( GLUHandle, 'gluTessCallback'); + gluTessEndContour := GetModuleSymbol( GLUHandle, 'gluTessEndContour'); + gluTessEndPolygon := GetModuleSymbol( GLUHandle, 'gluTessEndPolygon'); + gluTessNormal := GetModuleSymbol( GLUHandle, 'gluTessNormal'); + gluTessProperty := GetModuleSymbol( GLUHandle, 'gluTessProperty'); + gluTessVertex := GetModuleSymbol( GLUHandle, 'gluTessVertex'); + gluUnProject := GetModuleSymbol( GLUHandle, 'gluUnProject'); + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure ClearExtensions; + +begin + glArrayElementEXT := nil; + glDrawArraysEXT := nil; + glVertexPointerEXT := nil; + glNormalPointerEXT := nil; + glColorPointerEXT := nil; + glIndexPointerEXT := nil; + glTexCoordPointerEXT := nil; + glEdgeFlagPointerEXT := nil; + glGetPointervEXT := nil; + glArrayElementArrayEXT := nil; + glAddSwapHintRectWIN := nil; + glColorTableEXT := nil; + glColorSubTableEXT := nil; + glGetColorTableEXT := nil; + glGetColorTablePameterivEXT := nil; + glGetColorTablePameterfvEXT := nil; + gluNurbsCallbackDataEXT := nil; + gluNewNurbsTessellatorEXT := nil; + gluDeleteNurbsTessellatorEXT := nil; + glLockArraysEXT := nil; + glUnlockArraysEXT := nil; + glCopyTexImage1DEXT := nil; + glCopyTexSubImage1DEXT := nil; + glCopyTexImage2DEXT := nil; + glCopyTexSubImage2DEXT := nil; + glCopyTexSubImage3DEXT := nil; + glCullParameterfvEXT := nil; + glCullParameterdvEXT := nil; + glIndexFuncEXT := nil; + glIndexMaterialEXT := nil; + glPolygonOffsetEXT := nil; + glTexSubImage1DEXT := nil; + glTexSubImage2DEXT := nil; + glTexSubImage3DEXT := nil; + glGenTexturesEXT := nil; + glDeleteTexturesEXT := nil; + glBindTextureEXT := nil; + glPrioritizeTexturesEXT := nil; + glAreTexturesResidentEXT := nil; + glIsTextureEXT := nil; + + glMultiTexCoord1dARB := nil; + glMultiTexCoord1dVARB := nil; + glMultiTexCoord1fARBP := nil; + glMultiTexCoord1fVARB := nil; + glMultiTexCoord1iARB := nil; + glMultiTexCoord1iVARB := nil; + glMultiTexCoord1sARBP := nil; + glMultiTexCoord1sVARB := nil; + glMultiTexCoord2dARB := nil; + glMultiTexCoord2dvARB := nil; + glMultiTexCoord2fARB := nil; + glMultiTexCoord2fvARB := nil; + glMultiTexCoord2iARB := nil; + glMultiTexCoord2ivARB := nil; + glMultiTexCoord2sARB := nil; + glMultiTexCoord2svARB := nil; + glMultiTexCoord3dARB := nil; + glMultiTexCoord3dvARB := nil; + glMultiTexCoord3fARB := nil; + glMultiTexCoord3fvARB := nil; + glMultiTexCoord3iARB := nil; + glMultiTexCoord3ivARB := nil; + glMultiTexCoord3sARB := nil; + glMultiTexCoord3svARB := nil; + glMultiTexCoord4dARB := nil; + glMultiTexCoord4dvARB := nil; + glMultiTexCoord4fARB := nil; + glMultiTexCoord4fvARB := nil; + glMultiTexCoord4iARB := nil; + glMultiTexCoord4ivARB := nil; + glMultiTexCoord4sARB := nil; + glMultiTexCoord4svARB := nil; + glActiveTextureARB := nil; + glClientActiveTextureARB := nil; + + // EXT_compiled_vertex_array + glLockArrayEXT := nil; + glUnlockArrayEXT := nil; + + // EXT_cull_vertex + glCullParameterdvEXT := nil; + glCullParameterfvEXT := nil; + + // WIN_swap_hint + glAddSwapHintRectWIN := nil; + + // EXT_point_parameter + glPointParameterfEXT := nil; + glPointParameterfvEXT := nil; + + // GL_ARB_transpose_matrix + glLoadTransposeMatrixfARB := nil; + glLoadTransposeMatrixdARB := nil; + glMultTransposeMatrixfARB := nil; + glMultTransposeMatrixdARB := nil; + + glSampleCoverageARB := nil; + glSamplePassARB := nil; + + // GL_ARB_multisample + glCompressedTexImage3DARB := nil; + glCompressedTexImage2DARB := nil; + glCompressedTexImage1DARB := nil; + glCompressedTexSubImage3DARB := nil; + glCompressedTexSubImage2DARB := nil; + glCompressedTexSubImage1DARB := nil; + glGetCompressedTexImageARB := nil; + + // GL_EXT_blend_color + glBlendColorEXT := nil; + + // GL_EXT_texture3D + glTexImage3DEXT := nil; + + // GL_SGIS_texture_filter4 + glGetTexFilterFuncSGIS := nil; + glTexFilterFuncSGIS := nil; + + // GL_EXT_histogram + glGetHistogramEXT := nil; + glGetHistogramParameterfvEXT := nil; + glGetHistogramParameterivEXT := nil; + glGetMinmaxEXT := nil; + glGetMinmaxParameterfvEXT := nil; + glGetMinmaxParameterivEXT := nil; + glHistogramEXT := nil; + glMinmaxEXT := nil; + glResetHistogramEXT := nil; + glResetMinmaxEXT := nil; + + // GL_EXT_convolution + glConvolutionFilter1DEXT := nil; + glConvolutionFilter2DEXT := nil; + glConvolutionParameterfEXT := nil; + glConvolutionParameterfvEXT := nil; + glConvolutionParameteriEXT := nil; + glConvolutionParameterivEXT := nil; + glCopyConvolutionFilter1DEXT := nil; + glCopyConvolutionFilter2DEXT := nil; + glGetConvolutionFilterEXT := nil; + glGetConvolutionParameterfvEXT := nil; + glGetConvolutionParameterivEXT := nil; + glGetSeparableFilterEXT := nil; + glSeparableFilter2DEXT := nil; + + // GL_SGI_color_table + glColorTableSGI := nil; + glColorTableParameterfvSGI := nil; + glColorTableParameterivSGI := nil; + glCopyColorTableSGI := nil; + glGetColorTableSGI := nil; + glGetColorTableParameterfvSGI := nil; + glGetColorTableParameterivSGI := nil; + + // GL_SGIX_pixel_texture + glPixelTexGenSGIX := nil; + + // GL_SGIS_pixel_texture + glPixelTexGenParameteriSGIS := nil; + glPixelTexGenParameterivSGIS := nil; + glPixelTexGenParameterfSGIS := nil; + glPixelTexGenParameterfvSGIS := nil; + glGetPixelTexGenParameterivSGIS := nil; + glGetPixelTexGenParameterfvSGIS := nil; + + // GL_SGIS_texture4D + glTexImage4DSGIS := nil; + glTexSubImage4DSGIS := nil; + + // GL_SGIS_detail_texture + glDetailTexFuncSGIS := nil; + glGetDetailTexFuncSGIS := nil; + + // GL_SGIS_sharpen_texture + glSharpenTexFuncSGIS := nil; + glGetSharpenTexFuncSGIS := nil; + + // GL_SGIS_multisample + glSampleMaskSGIS := nil; + glSamplePatternSGIS := nil; + + // GL_EXT_blend_minmax + glBlendEquationEXT := nil; + + // GL_SGIX_sprite + glSpriteParameterfSGIX := nil; + glSpriteParameterfvSGIX := nil; + glSpriteParameteriSGIX := nil; + glSpriteParameterivSGIX := nil; + + // GL_EXT_point_parameters + glPointParameterfSGIS := nil; + glPointParameterfvSGIS := nil; + + // GL_SGIX_instruments + glGetInstrumentsSGIX := nil; + glInstrumentsBufferSGIX := nil; + glPollInstrumentsSGIX := nil; + glReadInstrumentsSGIX := nil; + glStartInstrumentsSGIX := nil; + glStopInstrumentsSGIX := nil; + + // GL_SGIX_framezoom + glFrameZoomSGIX := nil; + + // GL_SGIX_tag_sample_buffer + glTagSampleBufferSGIX := nil; + + // GL_SGIX_polynomial_ffd + glDeformationMap3dSGIX := nil; + glDeformationMap3fSGIX := nil; + glDeformSGIX := nil; + glLoadIdentityDeformationMapSGIX := nil; + + // GL_SGIX_reference_plane + glReferencePlaneSGIX := nil; + + // GL_SGIX_flush_raster + glFlushRasterSGIX := nil; + + // GL_SGIS_fog_function + glFogFuncSGIS := nil; + glGetFogFuncSGIS := nil; + + // GL_HP_image_transform + glImageTransformParameteriHP := nil; + glImageTransformParameterfHP := nil; + glImageTransformParameterivHP := nil; + glImageTransformParameterfvHP := nil; + glGetImageTransformParameterivHP := nil; + glGetImageTransformParameterfvHP := nil; + + // GL_EXT_color_subtable + glCopyColorSubTableEXT := nil; + + // GL_PGI_misc_hints + glHintPGI := nil; + + // GL_EXT_paletted_texture + glGetColorTableParameterivEXT := nil; + glGetColorTableParameterfvEXT := nil; + + // GL_SGIX_list_priority + glGetListParameterfvSGIX := nil; + glGetListParameterivSGIX := nil; + glListParameterfSGIX := nil; + glListParameterfvSGIX := nil; + glListParameteriSGIX := nil; + glListParameterivSGIX := nil; + + // GL_SGIX_fragment_lighting + glFragmentColorMaterialSGIX := nil; + glFragmentLightfSGIX := nil; + glFragmentLightfvSGIX := nil; + glFragmentLightiSGIX := nil; + glFragmentLightivSGIX := nil; + glFragmentLightModelfSGIX := nil; + glFragmentLightModelfvSGIX := nil; + glFragmentLightModeliSGIX := nil; + glFragmentLightModelivSGIX := nil; + glFragmentMaterialfSGIX := nil; + glFragmentMaterialfvSGIX := nil; + glFragmentMaterialiSGIX := nil; + glFragmentMaterialivSGIX := nil; + glGetFragmentLightfvSGIX := nil; + glGetFragmentLightivSGIX := nil; + glGetFragmentMaterialfvSGIX := nil; + glGetFragmentMaterialivSGIX := nil; + glLightEnviSGIX := nil; + + // GL_EXT_draw_range_elements + glDrawRangeElementsEXT := nil; + + // GL_EXT_light_texture + glApplyTextureEXT := nil; + glTextureLightEXT := nil; + glTextureMaterialEXT := nil; + + // GL_SGIX_async + glAsyncMarkerSGIX := nil; + glFinishAsyncSGIX := nil; + glPollAsyncSGIX := nil; + glGenAsyncMarkersSGIX := nil; + glDeleteAsyncMarkersSGIX := nil; + glIsAsyncMarkerSGIX := nil; + + // GL_INTEL_parallel_arrays + glVertexPointervINTEL := nil; + glNormalPointervINTEL := nil; + glColorPointervINTEL := nil; + glTexCoordPointervINTEL := nil; + + // GL_EXT_pixel_transform + glPixelTransformParameteriEXT := nil; + glPixelTransformParameterfEXT := nil; + glPixelTransformParameterivEXT := nil; + glPixelTransformParameterfvEXT := nil; + + // GL_EXT_secondary_color + glSecondaryColor3bEXT := nil; + glSecondaryColor3bvEXT := nil; + glSecondaryColor3dEXT := nil; + glSecondaryColor3dvEXT := nil; + glSecondaryColor3fEXT := nil; + glSecondaryColor3fvEXT := nil; + glSecondaryColor3iEXT := nil; + glSecondaryColor3ivEXT := nil; + glSecondaryColor3sEXT := nil; + glSecondaryColor3svEXT := nil; + glSecondaryColor3ubEXT := nil; + glSecondaryColor3ubvEXT := nil; + glSecondaryColor3uiEXT := nil; + glSecondaryColor3uivEXT := nil; + glSecondaryColor3usEXT := nil; + glSecondaryColor3usvEXT := nil; + glSecondaryColorPointerEXT := nil; + + // GL_EXT_texture_perturb_normal + glTextureNormalEXT := nil; + + // GL_EXT_multi_draw_arrays + glMultiDrawArraysEXT := nil; + glMultiDrawElementsEXT := nil; + + // GL_EXT_fog_coord + glFogCoordfEXT := nil; + glFogCoordfvEXT := nil; + glFogCoorddEXT := nil; + glFogCoorddvEXT := nil; + glFogCoordPointerEXT := nil; + + // GL_EXT_coordinate_frame + glTangent3bEXT := nil; + glTangent3bvEXT := nil; + glTangent3dEXT := nil; + glTangent3dvEXT := nil; + glTangent3fEXT := nil; + glTangent3fvEXT := nil; + glTangent3iEXT := nil; + glTangent3ivEXT := nil; + glTangent3sEXT := nil; + glTangent3svEXT := nil; + glBinormal3bEXT := nil; + glBinormal3bvEXT := nil; + glBinormal3dEXT := nil; + glBinormal3dvEXT := nil; + glBinormal3fEXT := nil; + glBinormal3fvEXT := nil; + glBinormal3iEXT := nil; + glBinormal3ivEXT := nil; + glBinormal3sEXT := nil; + glBinormal3svEXT := nil; + glTangentPointerEXT := nil; + glBinormalPointerEXT := nil; + + // GL_SUNX_constant_data + glFinishTextureSUNX := nil; + + // GL_SUN_global_alpha + glGlobalAlphaFactorbSUN := nil; + glGlobalAlphaFactorsSUN := nil; + glGlobalAlphaFactoriSUN := nil; + glGlobalAlphaFactorfSUN := nil; + glGlobalAlphaFactordSUN := nil; + glGlobalAlphaFactorubSUN := nil; + glGlobalAlphaFactorusSUN := nil; + glGlobalAlphaFactoruiSUN := nil; + + // GL_SUN_triangle_list + glReplacementCodeuiSUN := nil; + glReplacementCodeusSUN := nil; + glReplacementCodeubSUN := nil; + glReplacementCodeuivSUN := nil; + glReplacementCodeusvSUN := nil; + glReplacementCodeubvSUN := nil; + glReplacementCodePointerSUN := nil; + + // GL_SUN_vertex + glColor4ubVertex2fSUN := nil; + glColor4ubVertex2fvSUN := nil; + glColor4ubVertex3fSUN := nil; + glColor4ubVertex3fvSUN := nil; + glColor3fVertex3fSUN := nil; + glColor3fVertex3fvSUN := nil; + glNormal3fVertex3fSUN := nil; + glNormal3fVertex3fvSUN := nil; + glColor4fNormal3fVertex3fSUN := nil; + glColor4fNormal3fVertex3fvSUN := nil; + glTexCoord2fVertex3fSUN := nil; + glTexCoord2fVertex3fvSUN := nil; + glTexCoord4fVertex4fSUN := nil; + glTexCoord4fVertex4fvSUN := nil; + glTexCoord2fColor4ubVertex3fSUN := nil; + glTexCoord2fColor4ubVertex3fvSUN := nil; + glTexCoord2fColor3fVertex3fSUN := nil; + glTexCoord2fColor3fVertex3fvSUN := nil; + glTexCoord2fNormal3fVertex3fSUN := nil; + glTexCoord2fNormal3fVertex3fvSUN := nil; + glTexCoord2fColor4fNormal3fVertex3fSUN := nil; + glTexCoord2fColor4fNormal3fVertex3fvSUN := nil; + glTexCoord4fColor4fNormal3fVertex4fSUN := nil; + glTexCoord4fColor4fNormal3fVertex4fvSUN := nil; + glReplacementCodeuiVertex3fSUN := nil; + glReplacementCodeuiVertex3fvSUN := nil; + glReplacementCodeuiColor4ubVertex3fSUN := nil; + glReplacementCodeuiColor4ubVertex3fvSUN := nil; + glReplacementCodeuiColor3fVertex3fSUN := nil; + glReplacementCodeuiColor3fVertex3fvSUN := nil; + glReplacementCodeuiNormal3fVertex3fSUN := nil; + glReplacementCodeuiNormal3fVertex3fvSUN := nil; + glReplacementCodeuiColor4fNormal3fVertex3fSUN := nil; + glReplacementCodeuiColor4fNormal3fVertex3fvSUN := nil; + glReplacementCodeuiTexCoord2fVertex3fSUN := nil; + glReplacementCodeuiTexCoord2fVertex3fvSUN := nil; + glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN := nil; + glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN := nil; + glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN := nil; + glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN := nil; + + // GL_EXT_blend_func_separate + glBlendFuncSeparateEXT := nil; + + // GL_EXT_vertex_weighting + glVertexWeightfEXT := nil; + glVertexWeightfvEXT := nil; + glVertexWeightPointerEXT := nil; + + // GL_NV_vertex_array_range + glFlushVertexArrayRangeNV := nil; + glVertexArrayRangeNV := nil; + wglAllocateMemoryNV := nil; + wglFreeMemoryNV := nil; + + // GL_NV_register_combiners + glCombinerParameterfvNV := nil; + glCombinerParameterfNV := nil; + glCombinerParameterivNV := nil; + glCombinerParameteriNV := nil; + glCombinerInputNV := nil; + glCombinerOutputNV := nil; + glFinalCombinerInputNV := nil; + glGetCombinerInputParameterfvNV := nil; + glGetCombinerInputParameterivNV := nil; + glGetCombinerOutputParameterfvNV := nil; + glGetCombinerOutputParameterivNV := nil; + glGetFinalCombinerInputParameterfvNV := nil; + glGetFinalCombinerInputParameterivNV := nil; + + // GL_MESA_resize_buffers + glResizeBuffersMESA := nil; + + // GL_MESA_window_pos + glWindowPos2dMESA := nil; + glWindowPos2dvMESA := nil; + glWindowPos2fMESA := nil; + glWindowPos2fvMESA := nil; + glWindowPos2iMESA := nil; + glWindowPos2ivMESA := nil; + glWindowPos2sMESA := nil; + glWindowPos2svMESA := nil; + glWindowPos3dMESA := nil; + glWindowPos3dvMESA := nil; + glWindowPos3fMESA := nil; + glWindowPos3fvMESA := nil; + glWindowPos3iMESA := nil; + glWindowPos3ivMESA := nil; + glWindowPos3sMESA := nil; + glWindowPos3svMESA := nil; + glWindowPos4dMESA := nil; + glWindowPos4dvMESA := nil; + glWindowPos4fMESA := nil; + glWindowPos4fvMESA := nil; + glWindowPos4iMESA := nil; + glWindowPos4ivMESA := nil; + glWindowPos4sMESA := nil; + glWindowPos4svMESA := nil; + + // GL_IBM_multimode_draw_arrays + glMultiModeDrawArraysIBM := nil; + glMultiModeDrawElementsIBM := nil; + + // GL_IBM_vertex_array_lists + glColorPointerListIBM := nil; + glSecondaryColorPointerListIBM := nil; + glEdgeFlagPointerListIBM := nil; + glFogCoordPointerListIBM := nil; + glIndexPointerListIBM := nil; + glNormalPointerListIBM := nil; + glTexCoordPointerListIBM := nil; + glVertexPointerListIBM := nil; + + // GL_3DFX_tbuffer + glTbufferMask3DFX := nil; + + // GL_EXT_multisample + glSampleMaskEXT := nil; + glSamplePatternEXT := nil; + + // GL_SGIS_texture_color_mask + glTextureColorMaskSGIS := nil; + + // GL_SGIX_igloo_interface + glIglooInterfaceSGIX := nil; + + // GLU extensions + gluNurbsCallbackDataEXT := nil; + gluNewNurbsTessellatorEXT := nil; + gluDeleteNurbsTessellatorEXT := nil; + + // GL_NV_vertex_program + glAreProgramsResidentNV := nil; + glBindProgramNV := nil; + glDeleteProgramsNV := nil; + glExecuteProgramNV := nil; + glGenProgramsNV := nil; + glGetProgramParameterdvNV := nil; + glGetProgramParameterfvNV := nil; + glGetProgramivNV := nil; + glGetProgramStringNV := nil; + glGetTrackMatrixivNV := nil; + glGetVertexAttribdvNV:= nil; + glGetVertexAttribfvNV:= nil; + glGetVertexAttribivNV:= nil; + glGetVertexAttribPointervNV := nil; + glIsProgramNV := nil; + glLoadProgramNV := nil; + glProgramParameter4dNV := nil; + glProgramParameter4dvNV := nil; + glProgramParameter4fNV := nil; + glProgramParameter4fvNV := nil; + glProgramParameters4dvNV := nil; + glProgramParameters4fvNV := nil; + glRequestResidentProgramsNV := nil; + glTrackMatrixNV := nil; + glVertexAttribPointerNV := nil; + glVertexAttrib1dNV := nil; + glVertexAttrib1dvNV := nil; + glVertexAttrib1fNV := nil; + glVertexAttrib1fvNV := nil; + glVertexAttrib1sNV := nil; + glVertexAttrib1svNV := nil; + glVertexAttrib2dNV := nil; + glVertexAttrib2dvNV := nil; + glVertexAttrib2fNV := nil; + glVertexAttrib2fvNV := nil; + glVertexAttrib2sNV := nil; + glVertexAttrib2svNV := nil; + glVertexAttrib3dNV := nil; + glVertexAttrib3dvNV := nil; + glVertexAttrib3fNV := nil; + glVertexAttrib3fvNV := nil; + glVertexAttrib3sNV := nil; + glVertexAttrib3svNV := nil; + glVertexAttrib4dNV := nil; + glVertexAttrib4dvNV := nil; + glVertexAttrib4fNV := nil; + glVertexAttrib4fvNV := nil; + glVertexAttrib4sNV := nil; + glVertexAttrib4svNV := nil; + glVertexAttrib4ubvNV := nil; + glVertexAttribs1dvNV := nil; + glVertexAttribs1fvNV := nil; + glVertexAttribs1svNV := nil; + glVertexAttribs2dvNV := nil; + glVertexAttribs2fvNV := nil; + glVertexAttribs2svNV := nil; + glVertexAttribs3dvNV := nil; + glVertexAttribs3fvNV := nil; + glVertexAttribs3svNV := nil; + glVertexAttribs4dvNV := nil; + glVertexAttribs4fvNV := nil; + glVertexAttribs4svNV := nil; + glVertexAttribs4ubvNV := nil; + + LastPixelFormat := 0; // to get synchronized again, if this proc was called from outside +end; + +//---------------------------------------------------------------------------------------------------------------------- + +{$ifdef Win32} + +function HasActiveContext: Boolean; + +// Returns True if the caller thread has an active (current) rendering context. + +begin + Result := ActivationRefCount > 0; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure ReadExtensions; +begin + if GLHandle <> INVALID_MODULEHANDLE then + begin + // GL extensions + glArrayElementArrayEXT := SDL_GL_GetProcAddress( 'glArrayElementArrayEXT'); + glColorTableEXT := SDL_GL_GetProcAddress( 'glColorTableEXT'); + glColorSubTableEXT := SDL_GL_GetProcAddress( 'glColorSubTableEXT'); + glGetColorTableEXT := SDL_GL_GetProcAddress( 'glGetColorTableEXT'); + glGetColorTablePameterivEXT := SDL_GL_GetProcAddress( 'glGetColorTablePameterivEXT'); + glGetColorTablePameterfvEXT := SDL_GL_GetProcAddress( 'glGetColorTablePameterfvEXT'); + glLockArraysEXT := SDL_GL_GetProcAddress( 'glLockArraysEXT'); + glUnlockArraysEXT := SDL_GL_GetProcAddress( 'glUnlockArraysEXT'); + glCopyTexImage1DEXT := SDL_GL_GetProcAddress( 'glCopyTexImage1DEXT'); + glCopyTexSubImage1DEXT := SDL_GL_GetProcAddress( 'glCopyTexSubImage1DEXT'); + glCopyTexImage2DEXT := SDL_GL_GetProcAddress( 'glCopyTexImage2DEXT'); + glCopyTexSubImage2DEXT := SDL_GL_GetProcAddress( 'glCopyTexSubImage2DEXT'); + glCopyTexSubImage3DEXT := SDL_GL_GetProcAddress( 'glCopyTexSubImage3DEXT'); + glIndexFuncEXT := GetModuleSymbol( GLHandle, 'glIndexFuncEXT'); + glIndexMaterialEXT := SDL_GL_GetProcAddress( 'glIndexMaterialEXT'); + glPolygonOffsetEXT := SDL_GL_GetProcAddress( 'glPolygonOffsetEXT'); + glTexSubImage1dEXT := SDL_GL_GetProcAddress( 'glTexSubImage1DEXT'); + glTexSubImage2dEXT := SDL_GL_GetProcAddress( 'glTexSubImage2DEXT'); + glTexSubImage3dEXT := SDL_GL_GetProcAddress( 'glTexSubImage3DEXT'); + glGenTexturesEXT := SDL_GL_GetProcAddress( 'glGenTexturesEXT'); + glDeleteTexturesEXT := SDL_GL_GetProcAddress( 'glDeleteTexturesEXT'); + glBindTextureEXT := SDL_GL_GetProcAddress( 'glBindTextureEXT'); + glPrioritizeTexturesEXT := SDL_GL_GetProcAddress( 'glPrioritizeTexturesEXT'); + glAreTexturesResidentEXT := SDL_GL_GetProcAddress( 'glAreTexturesResidentEXT'); + glIsTextureEXT := GetModuleSymbol( GLHandle, 'glIsTextureEXT'); + + // EXT_vertex_array + glArrayElementEXT := SDL_GL_GetProcAddress( 'glArrayElementEXT'); + glColorPointerEXT := SDL_GL_GetProcAddress( 'glColorPointerEXT'); + glDrawArraysEXT := SDL_GL_GetProcAddress( 'glDrawArraysEXT'); + glEdgeFlagPointerEXT := SDL_GL_GetProcAddress( 'glEdgeFlagPointerEXT'); + glGetPointervEXT := SDL_GL_GetProcAddress( 'glGetPointervEXT'); + glIndexPointerEXT := SDL_GL_GetProcAddress( 'glIndexPointerEXT'); + glNormalPointerEXT := SDL_GL_GetProcAddress( 'glNormalPointerEXT'); + glTexCoordPointerEXT := SDL_GL_GetProcAddress( 'glTexCoordPointerEXT'); + glVertexPointerEXT := SDL_GL_GetProcAddress( 'glVertexPointerEXT'); + + // ARB_multitexture + glMultiTexCoord1dARB := SDL_GL_GetProcAddress( 'glMultiTexCoord1dARB'); + glMultiTexCoord1dVARB := SDL_GL_GetProcAddress( 'glMultiTexCoord1dVARB'); + glMultiTexCoord1fARBP := SDL_GL_GetProcAddress( 'glMultiTexCoord1fARBP'); + glMultiTexCoord1fVARB := SDL_GL_GetProcAddress( 'glMultiTexCoord1fVARB'); + glMultiTexCoord1iARB := SDL_GL_GetProcAddress( 'glMultiTexCoord1iARB'); + glMultiTexCoord1iVARB := SDL_GL_GetProcAddress( 'glMultiTexCoord1iVARB'); + glMultiTexCoord1sARBP := SDL_GL_GetProcAddress( 'glMultiTexCoord1sARBP'); + glMultiTexCoord1sVARB := SDL_GL_GetProcAddress( 'glMultiTexCoord1sVARB'); + glMultiTexCoord2dARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2dARB'); + glMultiTexCoord2dvARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2dvARB'); + glMultiTexCoord2fARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2fARB'); + glMultiTexCoord2fvARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2fvARB'); + glMultiTexCoord2iARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2iARB'); + glMultiTexCoord2ivARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2ivARB'); + glMultiTexCoord2sARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2sARB'); + glMultiTexCoord2svARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2svARB'); + glMultiTexCoord3dARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3dARB'); + glMultiTexCoord3dvARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3dvARB'); + glMultiTexCoord3fARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3fARB'); + glMultiTexCoord3fvARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3fvARB'); + glMultiTexCoord3iARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3iARB'); + glMultiTexCoord3ivARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3ivARB'); + glMultiTexCoord3sARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3sARB'); + glMultiTexCoord3svARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3svARB'); + glMultiTexCoord4dARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4dARB'); + glMultiTexCoord4dvARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4dvARB'); + glMultiTexCoord4fARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4fARB'); + glMultiTexCoord4fvARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4fvARB'); + glMultiTexCoord4iARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4iARB'); + glMultiTexCoord4ivARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4ivARB'); + glMultiTexCoord4sARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4sARB'); + glMultiTexCoord4svARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4svARB'); + glActiveTextureARB := SDL_GL_GetProcAddress( 'glActiveTextureARB'); + glClientActiveTextureARB := SDL_GL_GetProcAddress( 'glClientActiveTextureARB'); + + // EXT_compiled_vertex_array + glLockArrayEXT := SDL_GL_GetProcAddress( 'glLockArrayEXT'); + glUnlockArrayEXT := SDL_GL_GetProcAddress( 'glUnlockArrayEXT'); + + // EXT_cull_vertex + glCullParameterdvEXT := SDL_GL_GetProcAddress( 'glCullParameterdvEXT'); + glCullParameterfvEXT := SDL_GL_GetProcAddress( 'glCullParameterfvEXT'); + + // WIN_swap_hint + glAddSwapHintRectWIN := SDL_GL_GetProcAddress( 'glAddSwapHintRectWIN'); + + // EXT_point_parameter + glPointParameterfEXT := SDL_GL_GetProcAddress( 'glPointParameterfEXT'); + glPointParameterfvEXT := SDL_GL_GetProcAddress( 'glPointParameterfvEXT'); + + // GL_ARB_transpose_matrix + glLoadTransposeMatrixfARB := SDL_GL_GetProcAddress( 'glLoadTransposeMatrixfARB'); + glLoadTransposeMatrixdARB := SDL_GL_GetProcAddress( 'glLoadTransposeMatrixdARB'); + glMultTransposeMatrixfARB := SDL_GL_GetProcAddress( 'glMultTransposeMatrixfARB'); + glMultTransposeMatrixdARB := SDL_GL_GetProcAddress( 'glMultTransposeMatrixdARB'); + + glSampleCoverageARB := SDL_GL_GetProcAddress( 'glSampleCoverageARB'); + glSamplePassARB := SDL_GL_GetProcAddress( 'glSamplePassARB'); + + // GL_ARB_multisample + glCompressedTexImage3DARB := SDL_GL_GetProcAddress( 'glCompressedTexImage3DARB'); + glCompressedTexImage2DARB := SDL_GL_GetProcAddress( 'glCompressedTexImage2DARB'); + glCompressedTexImage1DARB := SDL_GL_GetProcAddress( 'glCompressedTexImage1DARB'); + glCompressedTexSubImage3DARB := SDL_GL_GetProcAddress( 'glCompressedTexSubImage3DARB'); + glCompressedTexSubImage2DARB := SDL_GL_GetProcAddress( 'glCompressedTexSubImage2DARB'); + glCompressedTexSubImage1DARB := SDL_GL_GetProcAddress( 'glCompressedTexSubImage1DARB'); + glGetCompressedTexImageARB := SDL_GL_GetProcAddress( 'glGetCompressedTexImageARB'); + + // GL_EXT_blend_color + glBlendColorEXT := SDL_GL_GetProcAddress( 'glBlendColorEXT'); + + // GL_EXT_texture3D + glTexImage3DEXT := SDL_GL_GetProcAddress( 'glTexImage3DEXT'); + + // GL_SGIS_texture_filter4 + glGetTexFilterFuncSGIS := SDL_GL_GetProcAddress( 'glGetTexFilterFuncSGIS'); + glTexFilterFuncSGIS := SDL_GL_GetProcAddress( 'glTexFilterFuncSGIS'); + + // GL_EXT_histogram + glGetHistogramEXT := SDL_GL_GetProcAddress( 'glGetHistogramEXT'); + glGetHistogramParameterfvEXT := SDL_GL_GetProcAddress( 'glGetHistogramParameterfvEXT'); + glGetHistogramParameterivEXT := SDL_GL_GetProcAddress( 'glGetHistogramParameterivEXT'); + glGetMinmaxEXT := SDL_GL_GetProcAddress( 'glGetMinmaxEXT'); + glGetMinmaxParameterfvEXT := SDL_GL_GetProcAddress( 'glGetMinmaxParameterfvEXT'); + glGetMinmaxParameterivEXT := SDL_GL_GetProcAddress( 'glGetMinmaxParameterivEXT'); + glHistogramEXT := SDL_GL_GetProcAddress( 'glHistogramEXT'); + glMinmaxEXT := SDL_GL_GetProcAddress( 'glMinmaxEXT'); + glResetHistogramEXT := SDL_GL_GetProcAddress( 'glResetHistogramEXT'); + glResetMinmaxEXT := SDL_GL_GetProcAddress( 'glResetMinmaxEXT'); + + // GL_EXT_convolution + glConvolutionFilter1DEXT := SDL_GL_GetProcAddress( 'glConvolutionFilter1DEXT'); + glConvolutionFilter2DEXT := SDL_GL_GetProcAddress( 'glConvolutionFilter2DEXT'); + glConvolutionParameterfEXT := SDL_GL_GetProcAddress( 'glConvolutionParameterfEXT'); + glConvolutionParameterfvEXT := SDL_GL_GetProcAddress( 'glConvolutionParameterfvEXT'); + glConvolutionParameteriEXT := SDL_GL_GetProcAddress( 'glConvolutionParameteriEXT'); + glConvolutionParameterivEXT := SDL_GL_GetProcAddress( 'glConvolutionParameterivEXT'); + glCopyConvolutionFilter1DEXT := SDL_GL_GetProcAddress( 'glCopyConvolutionFilter1DEXT'); + glCopyConvolutionFilter2DEXT := SDL_GL_GetProcAddress( 'glCopyConvolutionFilter2DEXT'); + glGetConvolutionFilterEXT := SDL_GL_GetProcAddress( 'glGetConvolutionFilterEXT'); + glGetConvolutionParameterfvEXT := SDL_GL_GetProcAddress( 'glGetConvolutionParameterfvEXT'); + glGetConvolutionParameterivEXT := SDL_GL_GetProcAddress( 'glGetConvolutionParameterivEXT'); + glGetSeparableFilterEXT := SDL_GL_GetProcAddress( 'glGetSeparableFilterEXT'); + glSeparableFilter2DEXT := SDL_GL_GetProcAddress( 'glSeparableFilter2DEXT'); + + // GL_SGI_color_table + glColorTableSGI := SDL_GL_GetProcAddress( 'glColorTableSGI'); + glColorTableParameterfvSGI := SDL_GL_GetProcAddress( 'glColorTableParameterfvSGI'); + glColorTableParameterivSGI := SDL_GL_GetProcAddress( 'glColorTableParameterivSGI'); + glCopyColorTableSGI := SDL_GL_GetProcAddress( 'glCopyColorTableSGI'); + glGetColorTableSGI := SDL_GL_GetProcAddress( 'glGetColorTableSGI'); + glGetColorTableParameterfvSGI := SDL_GL_GetProcAddress( 'glGetColorTableParameterfvSGI'); + glGetColorTableParameterivSGI := SDL_GL_GetProcAddress( 'glGetColorTableParameterivSGI'); + + // GL_SGIX_pixel_texture + glPixelTexGenSGIX := SDL_GL_GetProcAddress( 'glPixelTexGenSGIX'); + + // GL_SGIS_pixel_texture + glPixelTexGenParameteriSGIS := SDL_GL_GetProcAddress( 'glPixelTexGenParameteriSGIS'); + glPixelTexGenParameterivSGIS := SDL_GL_GetProcAddress( 'glPixelTexGenParameterivSGIS'); + glPixelTexGenParameterfSGIS := SDL_GL_GetProcAddress( 'glPixelTexGenParameterfSGIS'); + glPixelTexGenParameterfvSGIS := SDL_GL_GetProcAddress( 'glPixelTexGenParameterfvSGIS'); + glGetPixelTexGenParameterivSGIS := SDL_GL_GetProcAddress( 'glGetPixelTexGenParameterivSGIS'); + glGetPixelTexGenParameterfvSGIS := SDL_GL_GetProcAddress( 'glGetPixelTexGenParameterfvSGIS'); + + // GL_SGIS_texture4D + glTexImage4DSGIS := SDL_GL_GetProcAddress( 'glTexImage4DSGIS'); + glTexSubImage4DSGIS := SDL_GL_GetProcAddress( 'glTexSubImage4DSGIS'); + + // GL_SGIS_detail_texture + glDetailTexFuncSGIS := SDL_GL_GetProcAddress( 'glDetailTexFuncSGIS'); + glGetDetailTexFuncSGIS := SDL_GL_GetProcAddress( 'glGetDetailTexFuncSGIS'); + + // GL_SGIS_sharpen_texture + glSharpenTexFuncSGIS := SDL_GL_GetProcAddress( 'glSharpenTexFuncSGIS'); + glGetSharpenTexFuncSGIS := SDL_GL_GetProcAddress( 'glGetSharpenTexFuncSGIS'); + + // GL_SGIS_multisample + glSampleMaskSGIS := SDL_GL_GetProcAddress( 'glSampleMaskSGIS'); + glSamplePatternSGIS := SDL_GL_GetProcAddress( 'glSamplePatternSGIS'); + + // GL_EXT_blend_minmax + glBlendEquationEXT := SDL_GL_GetProcAddress( 'glBlendEquationEXT'); + + // GL_SGIX_sprite + glSpriteParameterfSGIX := SDL_GL_GetProcAddress( 'glSpriteParameterfSGIX'); + glSpriteParameterfvSGIX := SDL_GL_GetProcAddress( 'glSpriteParameterfvSGIX'); + glSpriteParameteriSGIX := SDL_GL_GetProcAddress( 'glSpriteParameteriSGIX'); + glSpriteParameterivSGIX := SDL_GL_GetProcAddress( 'glSpriteParameterivSGIX'); + + // GL_EXT_point_parameters + glPointParameterfSGIS := SDL_GL_GetProcAddress( 'glPointParameterfSGIS'); + glPointParameterfvSGIS := SDL_GL_GetProcAddress( 'glPointParameterfvSGIS'); + + // GL_SGIX_instruments + glGetInstrumentsSGIX := SDL_GL_GetProcAddress( 'glGetInstrumentsSGIX'); + glInstrumentsBufferSGIX := SDL_GL_GetProcAddress( 'glInstrumentsBufferSGIX'); + glPollInstrumentsSGIX := SDL_GL_GetProcAddress( 'glPollInstrumentsSGIX'); + glReadInstrumentsSGIX := SDL_GL_GetProcAddress( 'glReadInstrumentsSGIX'); + glStartInstrumentsSGIX := SDL_GL_GetProcAddress( 'glStartInstrumentsSGIX'); + glStopInstrumentsSGIX := SDL_GL_GetProcAddress( 'glStopInstrumentsSGIX'); + + // GL_SGIX_framezoom + glFrameZoomSGIX := SDL_GL_GetProcAddress( 'glFrameZoomSGIX'); + + // GL_SGIX_tag_sample_buffer + glTagSampleBufferSGIX := SDL_GL_GetProcAddress( 'glTagSampleBufferSGIX'); + + // GL_SGIX_polynomial_ffd + glDeformationMap3dSGIX := SDL_GL_GetProcAddress( 'glDeformationMap3dSGIX'); + glDeformationMap3fSGIX := SDL_GL_GetProcAddress( 'glDeformationMap3fSGIX'); + glDeformSGIX := SDL_GL_GetProcAddress( 'glDeformSGIX'); + glLoadIdentityDeformationMapSGIX := SDL_GL_GetProcAddress( 'glLoadIdentityDeformationMapSGIX'); + + // GL_SGIX_reference_plane + glReferencePlaneSGIX := SDL_GL_GetProcAddress( 'glReferencePlaneSGIX'); + + // GL_SGIX_flush_raster + glFlushRasterSGIX := SDL_GL_GetProcAddress( 'glFlushRasterSGIX'); + + // GL_SGIS_fog_function + glFogFuncSGIS := SDL_GL_GetProcAddress( 'glFogFuncSGIS'); + glGetFogFuncSGIS := SDL_GL_GetProcAddress( 'glGetFogFuncSGIS'); + + // GL_HP_image_transform + glImageTransformParameteriHP := SDL_GL_GetProcAddress( 'glImageTransformParameteriHP'); + glImageTransformParameterfHP := SDL_GL_GetProcAddress( 'glImageTransformParameterfHP'); + glImageTransformParameterivHP := SDL_GL_GetProcAddress( 'glImageTransformParameterivHP'); + glImageTransformParameterfvHP := SDL_GL_GetProcAddress( 'glImageTransformParameterfvHP'); + glGetImageTransformParameterivHP := SDL_GL_GetProcAddress( 'glGetImageTransformParameterivHP'); + glGetImageTransformParameterfvHP := SDL_GL_GetProcAddress( 'glGetImageTransformParameterfvHP'); + + // GL_EXT_color_subtable + glCopyColorSubTableEXT := SDL_GL_GetProcAddress( 'glCopyColorSubTableEXT'); + + // GL_PGI_misc_hints + glHintPGI := SDL_GL_GetProcAddress( 'glHintPGI'); + + // GL_EXT_paletted_texture + glGetColorTableParameterivEXT := SDL_GL_GetProcAddress( 'glGetColorTableParameterivEXT'); + glGetColorTableParameterfvEXT := SDL_GL_GetProcAddress( 'glGetColorTableParameterfvEXT'); + + // GL_SGIX_list_priority + glGetListParameterfvSGIX := SDL_GL_GetProcAddress( 'glGetListParameterfvSGIX'); + glGetListParameterivSGIX := SDL_GL_GetProcAddress( 'glGetListParameterivSGIX'); + glListParameterfSGIX := SDL_GL_GetProcAddress( 'glListParameterfSGIX'); + glListParameterfvSGIX := SDL_GL_GetProcAddress( 'glListParameterfvSGIX'); + glListParameteriSGIX := SDL_GL_GetProcAddress( 'glListParameteriSGIX'); + glListParameterivSGIX := SDL_GL_GetProcAddress( 'glListParameterivSGIX'); + + // GL_SGIX_fragment_lighting + glFragmentColorMaterialSGIX := SDL_GL_GetProcAddress( 'glFragmentColorMaterialSGIX'); + glFragmentLightfSGIX := SDL_GL_GetProcAddress( 'glFragmentLightfSGIX'); + glFragmentLightfvSGIX := SDL_GL_GetProcAddress( 'glFragmentLightfvSGIX'); + glFragmentLightiSGIX := SDL_GL_GetProcAddress( 'glFragmentLightiSGIX'); + glFragmentLightivSGIX := SDL_GL_GetProcAddress( 'glFragmentLightivSGIX'); + glFragmentLightModelfSGIX := SDL_GL_GetProcAddress( 'glFragmentLightModelfSGIX'); + glFragmentLightModelfvSGIX := SDL_GL_GetProcAddress( 'glFragmentLightModelfvSGIX'); + glFragmentLightModeliSGIX := SDL_GL_GetProcAddress( 'glFragmentLightModeliSGIX'); + glFragmentLightModelivSGIX := SDL_GL_GetProcAddress( 'glFragmentLightModelivSGIX'); + glFragmentMaterialfSGIX := SDL_GL_GetProcAddress( 'glFragmentMaterialfSGIX'); + glFragmentMaterialfvSGIX := SDL_GL_GetProcAddress( 'glFragmentMaterialfvSGIX'); + glFragmentMaterialiSGIX := SDL_GL_GetProcAddress( 'glFragmentMaterialiSGIX'); + glFragmentMaterialivSGIX := SDL_GL_GetProcAddress( 'glFragmentMaterialivSGIX'); + glGetFragmentLightfvSGIX := SDL_GL_GetProcAddress( 'glGetFragmentLightfvSGIX'); + glGetFragmentLightivSGIX := SDL_GL_GetProcAddress( 'glGetFragmentLightivSGIX'); + glGetFragmentMaterialfvSGIX := SDL_GL_GetProcAddress( 'glGetFragmentMaterialfvSGIX'); + glGetFragmentMaterialivSGIX := SDL_GL_GetProcAddress( 'glGetFragmentMaterialivSGIX'); + glLightEnviSGIX := SDL_GL_GetProcAddress( 'glLightEnviSGIX'); + + // GL_EXT_draw_range_elements + glDrawRangeElementsEXT := SDL_GL_GetProcAddress( 'glDrawRangeElementsEXT'); + + // GL_EXT_light_texture + glApplyTextureEXT := SDL_GL_GetProcAddress( 'glApplyTextureEXT'); + glTextureLightEXT := SDL_GL_GetProcAddress( 'glTextureLightEXT'); + glTextureMaterialEXT := SDL_GL_GetProcAddress( 'glTextureMaterialEXT'); + + // GL_SGIX_async + glAsyncMarkerSGIX := SDL_GL_GetProcAddress( 'glAsyncMarkerSGIX'); + glFinishAsyncSGIX := SDL_GL_GetProcAddress( 'glFinishAsyncSGIX'); + glPollAsyncSGIX := SDL_GL_GetProcAddress( 'glPollAsyncSGIX'); + glGenAsyncMarkersSGIX := SDL_GL_GetProcAddress( 'glGenAsyncMarkersSGIX'); + glDeleteAsyncMarkersSGIX := SDL_GL_GetProcAddress( 'glDeleteAsyncMarkersSGIX'); + glIsAsyncMarkerSGIX := SDL_GL_GetProcAddress( 'glIsAsyncMarkerSGIX'); + + // GL_INTEL_parallel_arrays + glVertexPointervINTEL := SDL_GL_GetProcAddress( 'glVertexPointervINTEL'); + glNormalPointervINTEL := SDL_GL_GetProcAddress( 'glNormalPointervINTEL'); + glColorPointervINTEL := SDL_GL_GetProcAddress( 'glColorPointervINTEL'); + glTexCoordPointervINTEL := SDL_GL_GetProcAddress( 'glTexCoordPointervINTEL'); + + // GL_EXT_pixel_transform + glPixelTransformParameteriEXT := SDL_GL_GetProcAddress( 'glPixelTransformParameteriEXT'); + glPixelTransformParameterfEXT := SDL_GL_GetProcAddress( 'glPixelTransformParameterfEXT'); + glPixelTransformParameterivEXT := SDL_GL_GetProcAddress( 'glPixelTransformParameterivEXT'); + glPixelTransformParameterfvEXT := SDL_GL_GetProcAddress( 'glPixelTransformParameterfvEXT'); + + // GL_EXT_secondary_color + glSecondaryColor3bEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3bEXT'); + glSecondaryColor3bvEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3bvEXT'); + glSecondaryColor3dEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3dEXT'); + glSecondaryColor3dvEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3dvEXT'); + glSecondaryColor3fEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3fEXT'); + glSecondaryColor3fvEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3fvEXT'); + glSecondaryColor3iEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3iEXT'); + glSecondaryColor3ivEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3ivEXT'); + glSecondaryColor3sEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3sEXT'); + glSecondaryColor3svEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3svEXT'); + glSecondaryColor3ubEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3ubEXT'); + glSecondaryColor3ubvEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3ubvEXT'); + glSecondaryColor3uiEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3uiEXT'); + glSecondaryColor3uivEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3uivEXT'); + glSecondaryColor3usEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3usEXT'); + glSecondaryColor3usvEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3usvEXT'); + glSecondaryColorPointerEXT := SDL_GL_GetProcAddress( 'glSecondaryColorPointerEXT'); + + // GL_EXT_texture_perturb_normal + glTextureNormalEXT := SDL_GL_GetProcAddress( 'glTextureNormalEXT'); + + // GL_EXT_multi_draw_arrays + glMultiDrawArraysEXT := SDL_GL_GetProcAddress( 'glMultiDrawArraysEXT'); + glMultiDrawElementsEXT := SDL_GL_GetProcAddress( 'glMultiDrawElementsEXT'); + + // GL_EXT_fog_coord + glFogCoordfEXT := SDL_GL_GetProcAddress( 'glFogCoordfEXT'); + glFogCoordfvEXT := SDL_GL_GetProcAddress( 'glFogCoordfvEXT'); + glFogCoorddEXT := SDL_GL_GetProcAddress( 'glFogCoorddEXT'); + glFogCoorddvEXT := SDL_GL_GetProcAddress( 'glFogCoorddvEXT'); + glFogCoordPointerEXT := SDL_GL_GetProcAddress( 'glFogCoordPointerEXT'); + + // GL_EXT_coordinate_frame + glTangent3bEXT := SDL_GL_GetProcAddress( 'glTangent3bEXT'); + glTangent3bvEXT := SDL_GL_GetProcAddress( 'glTangent3bvEXT'); + glTangent3dEXT := SDL_GL_GetProcAddress( 'glTangent3dEXT'); + glTangent3dvEXT := SDL_GL_GetProcAddress( 'glTangent3dvEXT'); + glTangent3fEXT := SDL_GL_GetProcAddress( 'glTangent3fEXT'); + glTangent3fvEXT := SDL_GL_GetProcAddress( 'glTangent3fvEXT'); + glTangent3iEXT := SDL_GL_GetProcAddress( 'glTangent3iEXT'); + glTangent3ivEXT := SDL_GL_GetProcAddress( 'glTangent3ivEXT'); + glTangent3sEXT := SDL_GL_GetProcAddress( 'glTangent3sEXT'); + glTangent3svEXT := SDL_GL_GetProcAddress( 'glTangent3svEXT'); + glBinormal3bEXT := SDL_GL_GetProcAddress( 'glBinormal3bEXT'); + glBinormal3bvEXT := SDL_GL_GetProcAddress( 'glBinormal3bvEXT'); + glBinormal3dEXT := SDL_GL_GetProcAddress( 'glBinormal3dEXT'); + glBinormal3dvEXT := SDL_GL_GetProcAddress( 'glBinormal3dvEXT'); + glBinormal3fEXT := SDL_GL_GetProcAddress( 'glBinormal3fEXT'); + glBinormal3fvEXT := SDL_GL_GetProcAddress( 'glBinormal3fvEXT'); + glBinormal3iEXT := SDL_GL_GetProcAddress( 'glBinormal3iEXT'); + glBinormal3ivEXT := SDL_GL_GetProcAddress( 'glBinormal3ivEXT'); + glBinormal3sEXT := SDL_GL_GetProcAddress( 'glBinormal3sEXT'); + glBinormal3svEXT := SDL_GL_GetProcAddress( 'glBinormal3svEXT'); + glTangentPointerEXT := SDL_GL_GetProcAddress( 'glTangentPointerEXT'); + glBinormalPointerEXT := SDL_GL_GetProcAddress( 'glBinormalPointerEXT'); + + // GL_SUNX_constant_data + glFinishTextureSUNX := SDL_GL_GetProcAddress( 'glFinishTextureSUNX'); + + // GL_SUN_global_alpha + glGlobalAlphaFactorbSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactorbSUN'); + glGlobalAlphaFactorsSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactorsSUN'); + glGlobalAlphaFactoriSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactoriSUN'); + glGlobalAlphaFactorfSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactorfSUN'); + glGlobalAlphaFactordSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactordSUN'); + glGlobalAlphaFactorubSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactorubSUN'); + glGlobalAlphaFactorusSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactorusSUN'); + glGlobalAlphaFactoruiSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactoruiSUN'); + + // GL_SUN_triangle_list + glReplacementCodeuiSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiSUN'); + glReplacementCodeusSUN := SDL_GL_GetProcAddress( 'glReplacementCodeusSUN'); + glReplacementCodeubSUN := SDL_GL_GetProcAddress( 'glReplacementCodeubSUN'); + glReplacementCodeuivSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuivSUN'); + glReplacementCodeusvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeusvSUN'); + glReplacementCodeubvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeubvSUN'); + glReplacementCodePointerSUN := SDL_GL_GetProcAddress( 'glReplacementCodePointerSUN'); + + // GL_SUN_vertex + glColor4ubVertex2fSUN := SDL_GL_GetProcAddress( 'glColor4ubVertex2fSUN'); + glColor4ubVertex2fvSUN := SDL_GL_GetProcAddress( 'glColor4ubVertex2fvSUN'); + glColor4ubVertex3fSUN := SDL_GL_GetProcAddress( 'glColor4ubVertex3fSUN'); + glColor4ubVertex3fvSUN := SDL_GL_GetProcAddress( 'glColor4ubVertex3fvSUN'); + glColor3fVertex3fSUN := SDL_GL_GetProcAddress( 'glColor3fVertex3fSUN'); + glColor3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glColor3fVertex3fvSUN'); + glNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glNormal3fVertex3fSUN'); + glNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glNormal3fVertex3fvSUN'); + glColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glColor4fNormal3fVertex3fSUN'); + glColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glColor4fNormal3fVertex3fvSUN'); + glTexCoord2fVertex3fSUN := SDL_GL_GetProcAddress( 'glTexCoord2fVertex3fSUN'); + glTexCoord2fVertex3fvSUN := SDL_GL_GetProcAddress( 'glTexCoord2fVertex3fvSUN'); + glTexCoord4fVertex4fSUN := SDL_GL_GetProcAddress( 'glTexCoord4fVertex4fSUN'); + glTexCoord4fVertex4fvSUN := SDL_GL_GetProcAddress( 'glTexCoord4fVertex4fvSUN'); + glTexCoord2fColor4ubVertex3fSUN := SDL_GL_GetProcAddress( 'glTexCoord2fColor4ubVertex3fSUN'); + glTexCoord2fColor4ubVertex3fvSUN := SDL_GL_GetProcAddress( 'glTexCoord2fColor4ubVertex3fvSUN'); + glTexCoord2fColor3fVertex3fSUN := SDL_GL_GetProcAddress( 'glTexCoord2fColor3fVertex3fSUN'); + glTexCoord2fColor3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glTexCoord2fColor3fVertex3fvSUN'); + glTexCoord2fNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glTexCoord2fNormal3fVertex3fSUN'); + glTexCoord2fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glTexCoord2fNormal3fVertex3fvSUN'); + glTexCoord2fColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glTexCoord2fColor4fNormal3fVertex3fSUN'); + glTexCoord2fColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glTexCoord2fColor4fNormal3fVertex3fvSUN'); + glTexCoord4fColor4fNormal3fVertex4fSUN := SDL_GL_GetProcAddress( 'glTexCoord4fColor4fNormal3fVertex4fSUN'); + glTexCoord4fColor4fNormal3fVertex4fvSUN := SDL_GL_GetProcAddress( 'glTexCoord4fColor4fNormal3fVertex4fvSUN'); + glReplacementCodeuiVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiVertex3fSUN'); + glReplacementCodeuiVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiVertex3fvSUN'); + glReplacementCodeuiColor4ubVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiColor4ubVertex3fSUN'); + glReplacementCodeuiColor4ubVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiColor4ubVertex3fvSUN'); + glReplacementCodeuiColor3fVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiColor3fVertex3fSUN'); + glReplacementCodeuiColor3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiColor3fVertex3fvSUN'); + glReplacementCodeuiNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiNormal3fVertex3fSUN'); + glReplacementCodeuiNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiNormal3fVertex3fvSUN'); + glReplacementCodeuiColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiColor4fNormal3fVertex3fSUN'); + glReplacementCodeuiColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiColor4fNormal3fVertex3fvSUN'); + glReplacementCodeuiTexCoord2fVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiTexCoord2fVertex3fSUN'); + glReplacementCodeuiTexCoord2fVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiTexCoord2fVertex3fvSUN'); + glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN'); + glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN'); + glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN'); + glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN'); + + // GL_EXT_blend_func_separate + glBlendFuncSeparateEXT := SDL_GL_GetProcAddress( 'glBlendFuncSeparateEXT'); + + // GL_EXT_vertex_weighting + glVertexWeightfEXT := SDL_GL_GetProcAddress( 'glVertexWeightfEXT'); + glVertexWeightfvEXT := SDL_GL_GetProcAddress( 'glVertexWeightfvEXT'); + glVertexWeightPointerEXT := SDL_GL_GetProcAddress( 'glVertexWeightPointerEXT'); + + // GL_NV_vertex_array_range + glFlushVertexArrayRangeNV := SDL_GL_GetProcAddress( 'glFlushVertexArrayRangeNV'); + glVertexArrayRangeNV := SDL_GL_GetProcAddress( 'glVertexArrayRangeNV'); + wglAllocateMemoryNV := SDL_GL_GetProcAddress( 'wglAllocateMemoryNV'); + wglFreeMemoryNV := SDL_GL_GetProcAddress( 'wglFreeMemoryNV'); + + // GL_NV_register_combiners + glCombinerParameterfvNV := SDL_GL_GetProcAddress( 'glCombinerParameterfvNV'); + glCombinerParameterfNV := SDL_GL_GetProcAddress( 'glCombinerParameterfNV'); + glCombinerParameterivNV := SDL_GL_GetProcAddress( 'glCombinerParameterivNV'); + glCombinerParameteriNV := SDL_GL_GetProcAddress( 'glCombinerParameteriNV'); + glCombinerInputNV := SDL_GL_GetProcAddress( 'glCombinerInputNV'); + glCombinerOutputNV := SDL_GL_GetProcAddress( 'glCombinerOutputNV'); + glFinalCombinerInputNV := SDL_GL_GetProcAddress( 'glFinalCombinerInputNV'); + glGetCombinerInputParameterfvNV := SDL_GL_GetProcAddress( 'glGetCombinerInputParameterfvNV'); + glGetCombinerInputParameterivNV := SDL_GL_GetProcAddress( 'glGetCombinerInputParameterivNV'); + glGetCombinerOutputParameterfvNV := SDL_GL_GetProcAddress( 'glGetCombinerOutputParameterfvNV'); + glGetCombinerOutputParameterivNV := SDL_GL_GetProcAddress( 'glGetCombinerOutputParameterivNV'); + glGetFinalCombinerInputParameterfvNV := SDL_GL_GetProcAddress( 'glGetFinalCombinerInputParameterfvNV'); + glGetFinalCombinerInputParameterivNV := SDL_GL_GetProcAddress( 'glGetFinalCombinerInputParameterivNV'); + + // GL_MESA_resize_buffers + glResizeBuffersMESA := SDL_GL_GetProcAddress( 'glResizeBuffersMESA'); + + // GL_MESA_window_pos + glWindowPos2dMESA := SDL_GL_GetProcAddress( 'glWindowPos2dMESA'); + glWindowPos2dvMESA := SDL_GL_GetProcAddress( 'glWindowPos2dvMESA'); + glWindowPos2fMESA := SDL_GL_GetProcAddress( 'glWindowPos2fMESA'); + glWindowPos2fvMESA := SDL_GL_GetProcAddress( 'glWindowPos2fvMESA'); + glWindowPos2iMESA := SDL_GL_GetProcAddress( 'glWindowPos2iMESA'); + glWindowPos2ivMESA := SDL_GL_GetProcAddress( 'glWindowPos2ivMESA'); + glWindowPos2sMESA := SDL_GL_GetProcAddress( 'glWindowPos2sMESA'); + glWindowPos2svMESA := SDL_GL_GetProcAddress( 'glWindowPos2svMESA'); + glWindowPos3dMESA := SDL_GL_GetProcAddress( 'glWindowPos3dMESA'); + glWindowPos3dvMESA := SDL_GL_GetProcAddress( 'glWindowPos3dvMESA'); + glWindowPos3fMESA := SDL_GL_GetProcAddress( 'glWindowPos3fMESA'); + glWindowPos3fvMESA := SDL_GL_GetProcAddress( 'glWindowPos3fvMESA'); + glWindowPos3iMESA := SDL_GL_GetProcAddress( 'glWindowPos3iMESA'); + glWindowPos3ivMESA := SDL_GL_GetProcAddress( 'glWindowPos3ivMESA'); + glWindowPos3sMESA := SDL_GL_GetProcAddress( 'glWindowPos3sMESA'); + glWindowPos3svMESA := SDL_GL_GetProcAddress( 'glWindowPos3svMESA'); + glWindowPos4dMESA := SDL_GL_GetProcAddress( 'glWindowPos4dMESA'); + glWindowPos4dvMESA := SDL_GL_GetProcAddress( 'glWindowPos4dvMESA'); + glWindowPos4fMESA := SDL_GL_GetProcAddress( 'glWindowPos4fMESA'); + glWindowPos4fvMESA := SDL_GL_GetProcAddress( 'glWindowPos4fvMESA'); + glWindowPos4iMESA := SDL_GL_GetProcAddress( 'glWindowPos4iMESA'); + glWindowPos4ivMESA := SDL_GL_GetProcAddress( 'glWindowPos4ivMESA'); + glWindowPos4sMESA := SDL_GL_GetProcAddress( 'glWindowPos4sMESA'); + glWindowPos4svMESA := SDL_GL_GetProcAddress( 'glWindowPos4svMESA'); + + // GL_IBM_multimode_draw_arrays + glMultiModeDrawArraysIBM := SDL_GL_GetProcAddress( 'glMultiModeDrawArraysIBM'); + glMultiModeDrawElementsIBM := SDL_GL_GetProcAddress( 'glMultiModeDrawElementsIBM'); + + // GL_IBM_vertex_array_lists + glColorPointerListIBM := SDL_GL_GetProcAddress( 'glColorPointerListIBM'); + glSecondaryColorPointerListIBM := SDL_GL_GetProcAddress( 'glSecondaryColorPointerListIBM'); + glEdgeFlagPointerListIBM := SDL_GL_GetProcAddress( 'glEdgeFlagPointerListIBM'); + glFogCoordPointerListIBM := SDL_GL_GetProcAddress( 'glFogCoordPointerListIBM'); + glIndexPointerListIBM := SDL_GL_GetProcAddress( 'glIndexPointerListIBM'); + glNormalPointerListIBM := SDL_GL_GetProcAddress( 'glNormalPointerListIBM'); + glTexCoordPointerListIBM := SDL_GL_GetProcAddress( 'glTexCoordPointerListIBM'); + glVertexPointerListIBM := SDL_GL_GetProcAddress( 'glVertexPointerListIBM'); + + // GL_3DFX_tbuffer + glTbufferMask3DFX := SDL_GL_GetProcAddress( 'glTbufferMask3DFX'); + + // GL_EXT_multisample + glSampleMaskEXT := SDL_GL_GetProcAddress( 'glSampleMaskEXT'); + glSamplePatternEXT := SDL_GL_GetProcAddress( 'glSamplePatternEXT'); + + // GL_SGIS_texture_color_mask + glTextureColorMaskSGIS := SDL_GL_GetProcAddress( 'glTextureColorMaskSGIS'); + + // GL_SGIX_igloo_interface + glIglooInterfaceSGIX := SDL_GL_GetProcAddress( 'glIglooInterfaceSGIX'); + + // GLU extensions + gluNurbsCallbackDataEXT := SDL_GL_GetProcAddress( 'gluNurbsCallbackDataEXT'); + gluNewNurbsTessellatorEXT := SDL_GL_GetProcAddress( 'gluNewNurbsTessellatorEXT'); + gluDeleteNurbsTessellatorEXT := SDL_GL_GetProcAddress( 'gluDeleteNurbsTessellatorEXT'); + + // GL_NV_vertex_program + glAreProgramsResidentNV := SDL_GL_GetProcAddress( 'glAreProgramsResidentNV'); + glBindProgramNV := SDL_GL_GetProcAddress( 'glBindProgramNV'); + glDeleteProgramsNV := SDL_GL_GetProcAddress( 'glDeleteProgramsNV'); + glExecuteProgramNV := SDL_GL_GetProcAddress( 'glExecuteProgramNV'); + glGenProgramsNV := SDL_GL_GetProcAddress( 'glGenProgramsNV'); + glGetProgramParameterdvNV := SDL_GL_GetProcAddress( 'glGetProgramParameterdvNV'); + glGetProgramParameterfvNV := SDL_GL_GetProcAddress( 'glGetProgramParameterfvNV'); + glGetProgramivNV := SDL_GL_GetProcAddress( 'glGetProgramivNV'); + glGetProgramStringNV := SDL_GL_GetProcAddress( 'glGetProgramStringNV'); + glGetTrackMatrixivNV := SDL_GL_GetProcAddress( 'glGetTrackMatrixivNV'); + glGetVertexAttribdvNV:= SDL_GL_GetProcAddress( 'glGetVertexAttribdvNV'); + glGetVertexAttribfvNV:= SDL_GL_GetProcAddress( 'glGetVertexAttribfvNV'); + glGetVertexAttribivNV:= SDL_GL_GetProcAddress( 'glGetVertexAttribivNV'); + glGetVertexAttribPointervNV := wglGetProcAddress ('glGetVertexAttribPointervNV'); + glIsProgramNV := SDL_GL_GetProcAddress( 'glIsProgramNV'); + glLoadProgramNV := SDL_GL_GetProcAddress( 'glLoadProgramNV'); + glProgramParameter4dNV := SDL_GL_GetProcAddress( 'glProgramParameter4dNV'); + glProgramParameter4dvNV := SDL_GL_GetProcAddress( 'glProgramParameter4dvNV'); + glProgramParameter4fNV := SDL_GL_GetProcAddress( 'glProgramParameter4fNV'); + glProgramParameter4fvNV := SDL_GL_GetProcAddress( 'glProgramParameter4fvNV'); + glProgramParameters4dvNV := wglGetProcAddress ('glProgramParameters4dvNV'); + glProgramParameters4fvNV := wglGetProcAddress ('glProgramParameters4fvNV'); + glRequestResidentProgramsNV := wglGetProcAddress ('glRequestResidentProgramsNV'); + glTrackMatrixNV := SDL_GL_GetProcAddress( 'glTrackMatrixNV'); + glVertexAttribPointerNV := SDL_GL_GetProcAddress( 'glVertexAttribPointerNV'); + glVertexAttrib1dNV := SDL_GL_GetProcAddress( 'glVertexAttrib1dNV'); + glVertexAttrib1dvNV := SDL_GL_GetProcAddress( 'glVertexAttrib1dvNV'); + glVertexAttrib1fNV := SDL_GL_GetProcAddress( 'glVertexAttrib1fNV'); + glVertexAttrib1fvNV := SDL_GL_GetProcAddress( 'glVertexAttrib1fvNV'); + glVertexAttrib1sNV := SDL_GL_GetProcAddress( 'glVertexAttrib1sNV'); + glVertexAttrib1svNV := SDL_GL_GetProcAddress( 'glVertexAttrib1svNV'); + glVertexAttrib2dNV := SDL_GL_GetProcAddress( 'glVertexAttrib2dNV'); + glVertexAttrib2dvNV := SDL_GL_GetProcAddress( 'glVertexAttrib2dvNV'); + glVertexAttrib2fNV := SDL_GL_GetProcAddress( 'glVertexAttrib2fNV'); + glVertexAttrib2fvNV := SDL_GL_GetProcAddress( 'glVertexAttrib2fvNV'); + glVertexAttrib2sNV := SDL_GL_GetProcAddress( 'glVertexAttrib2sNV'); + glVertexAttrib2svNV := SDL_GL_GetProcAddress( 'glVertexAttrib2svNV'); + glVertexAttrib3dNV := SDL_GL_GetProcAddress( 'glVertexAttrib3dNV'); + glVertexAttrib3dvNV := SDL_GL_GetProcAddress( 'glVertexAttrib3dvNV'); + glVertexAttrib3fNV := SDL_GL_GetProcAddress( 'glVertexAttrib3fNV'); + glVertexAttrib3fvNV := SDL_GL_GetProcAddress( 'glVertexAttrib3fvNV'); + glVertexAttrib3sNV := SDL_GL_GetProcAddress( 'glVertexAttrib3sNV'); + glVertexAttrib3svNV := SDL_GL_GetProcAddress( 'glVertexAttrib3svNV'); + glVertexAttrib4dNV := SDL_GL_GetProcAddress( 'glVertexAttrib4dNV'); + glVertexAttrib4dvNV := SDL_GL_GetProcAddress( 'glVertexAttrib4dvNV'); + glVertexAttrib4fNV := SDL_GL_GetProcAddress( 'glVertexAttrib4fNV'); + glVertexAttrib4fvNV := SDL_GL_GetProcAddress( 'glVertexAttrib4fvNV'); + glVertexAttrib4sNV := SDL_GL_GetProcAddress( 'glVertexAttrib4sNV'); + glVertexAttrib4svNV := SDL_GL_GetProcAddress( 'glVertexAttrib4svNV'); + glVertexAttrib4ubvNV := SDL_GL_GetProcAddress( 'glVertexAttrib4ubvNV'); + glVertexAttribs1dvNV := SDL_GL_GetProcAddress( 'glVertexAttribs1dvNV'); + glVertexAttribs1fvNV := SDL_GL_GetProcAddress( 'glVertexAttribs1fvNV'); + glVertexAttribs1svNV := SDL_GL_GetProcAddress( 'glVertexAttribs1svNV'); + glVertexAttribs2dvNV := SDL_GL_GetProcAddress( 'glVertexAttribs2dvNV'); + glVertexAttribs2fvNV := SDL_GL_GetProcAddress( 'glVertexAttribs2fvNV'); + glVertexAttribs2svNV := SDL_GL_GetProcAddress( 'glVertexAttribs2svNV'); + glVertexAttribs3dvNV := SDL_GL_GetProcAddress( 'glVertexAttribs3dvNV'); + glVertexAttribs3fvNV := SDL_GL_GetProcAddress( 'glVertexAttribs3fvNV'); + glVertexAttribs3svNV := SDL_GL_GetProcAddress( 'glVertexAttribs3svNV'); + glVertexAttribs4dvNV := SDL_GL_GetProcAddress( 'glVertexAttribs4dvNV'); + glVertexAttribs4fvNV := SDL_GL_GetProcAddress( 'glVertexAttribs4fvNV'); + glVertexAttribs4svNV := SDL_GL_GetProcAddress( 'glVertexAttribs4svNV'); + glVertexAttribs4ubvNV := SDL_GL_GetProcAddress( 'glVertexAttribs4ubvN'); + + // ARB wgl extensions + wglGetExtensionsStringARB := SDL_GL_GetProcAddress( 'wglGetExtensionsStringARB'); + wglGetPixelFormatAttribivARB := SDL_GL_GetProcAddress( 'wglGetPixelFormatAttribivARB'); + wglGetPixelFormatAttribfvARB := SDL_GL_GetProcAddress( 'wglGetPixelFormatAttribfvARB'); + wglChoosePixelFormatARB := SDL_GL_GetProcAddress( 'wglChoosePixelFormatARB'); + + // To get synchronized again, if this proc was called externally. + LastPixelFormat := 0; + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure TrimAndSplitVersionString(Buffer: String; var Max, Min: Integer); + +// Peels out the X.Y form from the given Buffer which must contain a version string like "text Minor.Major.Build text" +// at least however "Major.Minor". + +var + Separator: Integer; + +begin + try + // There must be at least one dot to separate major and minor version number. + Separator := Pos('.', Buffer); + // At least one number must be before and one after the dot. + if (Separator > 1) and (Separator < Length(Buffer)) and (Buffer[Separator - 1] in ['0'..'9']) and + (Buffer[Separator + 1] in ['0'..'9']) then + begin + // OK, it's a valid version string. Now remove unnecessary parts. + Dec(Separator); + // Find last non-numeric character before version number. + while (Separator > 0) and (Buffer[Separator] in ['0'..'9']) do + Dec(Separator); + // Delete leading characters which do not belong to the version string. + Delete(Buffer, 1, Separator); + Separator := Pos('.', Buffer) + 1; + // Find first non-numeric character after version number + while (Separator <= Length(Buffer)) and (Buffer[Separator] in ['0'..'9']) do + Inc(Separator); + // delete trailing characters not belonging to the version string + Delete(Buffer, Separator, 255); + // Now translate the numbers. + Separator := Pos('.', Buffer); // This is necessary because the buffer length might have changed. + Max := StrToInt(Copy(Buffer, 1, Separator - 1)); + Min := StrToInt(Copy(Buffer, Separator + 1, 255)); + end + else + Abort; + except + Min := 0; + Max := 0; + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure ReadImplementationProperties; + +var + Buffer: string; + MajorVersion, + MinorVersion: Integer; + + //--------------- local function -------------------------------------------- + + function CheckExtension(const Extension: string): Boolean; + + // Checks if the given Extension string is in Buffer. + + var + ExtPos: Integer; + + begin + // First find the position of the extension string as substring in Buffer. + ExtPos := Pos(Extension, Buffer); + Result := ExtPos > 0; + // Now check that it isn't only a substring of another extension. + if Result then + Result := ((ExtPos + Length(Extension) - 1) = Length(Buffer)) or + not (Buffer[ExtPos + Length(Extension)] in ['_', 'A'..'Z', 'a'..'z']); + end; + + //--------------- end local function ---------------------------------------- + +begin + // determine version of implementation + // GL + Buffer := glGetString(GL_VERSION); + TrimAndSplitVersionString(Buffer, Majorversion, MinorVersion); + GL_VERSION_1_0 := True; + GL_VERSION_1_1 := False; + GL_VERSION_1_2 := False; + if MajorVersion > 0 then + begin + if MinorVersion > 0 then + begin + GL_VERSION_1_1 := True; + if MinorVersion > 1 then + GL_VERSION_1_2 := True; + end; + end; + + // GLU + GLU_VERSION_1_1 := False; + GLU_VERSION_1_2 := False; + GLU_VERSION_1_3 := False; + // gluGetString is valid for version 1.1 or later + if Assigned(gluGetString) then + begin + Buffer := gluGetString(GLU_VERSION); + TrimAndSplitVersionString(Buffer, Majorversion, MinorVersion); + GLU_VERSION_1_1 := True; + if MinorVersion > 1 then + begin + GLU_VERSION_1_2 := True; + if MinorVersion > 2 then + GLU_VERSION_1_3 := True; + end; + end; + + // check supported extensions + // GL + Buffer := glGetString(GL_EXTENSIONS); + GL_3DFX_multisample :=CheckExtension('GL_3DFX_multisample'); + GL_3DFX_tbuffer := CheckExtension('GL_3DFX_tbuffer'); + GL_3DFX_texture_compression_FXT1 := CheckExtension('GL_3DFX_texture_compression_FXT1'); + + GL_APPLE_specular_vector := CheckExtension('GL_APPLE_specular_vector'); + GL_APPLE_transform_hint := CheckExtension('GL_APPLE_transform_hint'); + + GL_ARB_imaging := CheckExtension('GL_ARB_imaging'); + GL_ARB_multisample := CheckExtension('GL_ARB_multisample'); + GL_ARB_multitexture := CheckExtension('GL_ARB_multitexture'); + GL_ARB_texture_compression := CheckExtension('GL_ARB_texture_compression'); + GL_ARB_texture_cube_map := CheckExtension('GL_ARB_texture_cube_map'); + GL_ARB_transpose_matrix := CheckExtension('GL_ARB_transpose_matrix'); + GL_ARB_vertex_blend := CheckExtension('GL_ARB_vertex_blend'); + + GL_EXT_422_pixels := CheckExtension('GL_EXT_422_pixels'); + GL_EXT_abgr := CheckExtension('GL_EXT_abgr'); + GL_EXT_bgra := CheckExtension('GL_EXT_bgra'); + GL_EXT_blend_color := CheckExtension('GL_EXT_blend_color'); + GL_EXT_blend_func_separate := CheckExtension('GL_EXT_blend_func_separate'); + GL_EXT_blend_logic_op := CheckExtension('GL_EXT_blend_logic_op'); + GL_EXT_blend_minmax := CheckExtension('GL_EXT_blend_minmax'); + GL_EXT_blend_subtract := CheckExtension('GL_EXT_blend_subtract'); + GL_EXT_clip_volume_hint := CheckExtension('GL_EXT_clip_volume_hint'); + GL_EXT_cmyka := CheckExtension('GL_EXT_cmyka'); + GL_EXT_color_subtable := CheckExtension('GL_EXT_color_subtable'); + GL_EXT_compiled_vertex_array := CheckExtension('GL_EXT_compiled_vertex_array'); + GL_EXT_convolution := CheckExtension('GL_EXT_convolution'); + GL_EXT_coordinate_frame := CheckExtension('GL_EXT_coordinate_frame'); + GL_EXT_copy_texture := CheckExtension('GL_EXT_copy_texture'); + GL_EXT_cull_vertex := CheckExtension('GL_EXT_cull_vertex'); + GL_EXT_draw_range_elements := CheckExtension('GL_EXT_draw_range_elements'); + GL_EXT_fog_coord := CheckExtension('GL_EXT_fog_coord'); + GL_EXT_histogram := CheckExtension('GL_EXT_histogram'); + GL_EXT_index_array_formats := CheckExtension('GL_EXT_index_array_formats'); + GL_EXT_index_func := CheckExtension('GL_EXT_index_func'); + GL_EXT_index_material := CheckExtension('GL_EXT_index_material'); + GL_EXT_index_texture := CheckExtension('GL_EXT_index_texture'); + GL_EXT_light_max_exponent := CheckExtension('GL_EXT_light_max_exponent'); + GL_EXT_light_texture := CheckExtension('GL_EXT_light_texture'); + GL_EXT_misc_attribute := CheckExtension('GL_EXT_misc_attribute'); + GL_EXT_multi_draw_arrays := CheckExtension('GL_EXT_multi_draw_arrays'); + GL_EXT_multisample := CheckExtension('GL_EXT_multisample'); + GL_EXT_packed_pixels := CheckExtension('GL_EXT_packed_pixels'); + GL_EXT_paletted_texture := CheckExtension('GL_EXT_paletted_texture'); + GL_EXT_pixel_transform := CheckExtension('GL_EXT_pixel_transform'); + GL_EXT_point_parameters := CheckExtension('GL_EXT_point_parameters'); + GL_EXT_polygon_offset := CheckExtension('GL_EXT_polygon_offset'); + GL_EXT_rescale_normal := CheckExtension('GL_EXT_rescale_normal'); + GL_EXT_scene_marker := CheckExtension('GL_EXT_scene_marker'); + GL_EXT_secondary_color := CheckExtension('GL_EXT_secondary_color'); + GL_EXT_separate_specular_color := CheckExtension('GL_EXT_separate_specular_color'); + GL_EXT_shared_texture_palette := CheckExtension('GL_EXT_shared_texture_palette'); + GL_EXT_stencil_wrap := CheckExtension('GL_EXT_stencil_wrap'); + GL_EXT_subtexture := CheckExtension('GL_EXT_subtexture'); + GL_EXT_texture_color_table := CheckExtension('GL_EXT_texture_color_table'); + GL_EXT_texture_compression_s3tc := CheckExtension('GL_EXT_texture_compression_s3tc'); + GL_EXT_texture_cube_map := CheckExtension('GL_EXT_texture_cube_map'); + GL_EXT_texture_edge_clamp := CheckExtension('GL_EXT_texture_edge_clamp'); + GL_EXT_texture_env_add := CheckExtension('GL_EXT_texture_env_add'); + GL_EXT_texture_env_combine := CheckExtension('GL_EXT_texture_env_combine'); + GL_EXT_texture_filter_anisotropic := CheckExtension('GL_EXT_texture_filter_anisotropic'); + GL_EXT_texture_lod_bias := CheckExtension('GL_EXT_texture_lod_bias'); + GL_EXT_texture_object := CheckExtension('GL_EXT_texture_object'); + GL_EXT_texture_perturb_normal := CheckExtension('GL_EXT_texture_perturb_normal'); + GL_EXT_texture3D := CheckExtension('GL_EXT_texture3D'); + GL_EXT_vertex_array := CheckExtension('GL_EXT_vertex_array'); + GL_EXT_vertex_weighting := CheckExtension('GL_EXT_vertex_weighting'); + + GL_FfdMaskSGIX := CheckExtension('GL_FfdMaskSGIX'); + GL_HP_convolution_border_modes := CheckExtension('GL_HP_convolution_border_modes'); + GL_HP_image_transform := CheckExtension('GL_HP_image_transform'); + GL_HP_occlusion_test := CheckExtension('GL_HP_occlusion_test'); + GL_HP_texture_lighting := CheckExtension('GL_HP_texture_lighting'); + + GL_IBM_cull_vertex := CheckExtension('GL_IBM_cull_vertex'); + GL_IBM_multimode_draw_arrays := CheckExtension('GL_IBM_multimode_draw_arrays'); + GL_IBM_rasterpos_clip := CheckExtension('GL_IBM_rasterpos_clip'); + GL_IBM_vertex_array_lists := CheckExtension('GL_IBM_vertex_array_lists'); + + GL_INGR_color_clamp := CheckExtension('GL_INGR_color_clamp'); + GL_INGR_interlace_read := CheckExtension('GL_INGR_interlace_read'); + + GL_INTEL_parallel_arrays := CheckExtension('GL_INTEL_parallel_arrays'); + + GL_KTX_buffer_region := CheckExtension('GL_KTX_buffer_region'); + + GL_MESA_resize_buffers := CheckExtension('GL_MESA_resize_buffers'); + GL_MESA_window_pos := CheckExtension('GL_MESA_window_pos'); + + GL_NV_blend_square := CheckExtension('GL_NV_blend_square'); + GL_NV_fog_distance := CheckExtension('GL_NV_fog_distance'); + GL_NV_light_max_exponent := CheckExtension('GL_NV_light_max_exponent'); + GL_NV_register_combiners := CheckExtension('GL_NV_register_combiners'); + GL_NV_texgen_emboss := CheckExtension('GL_NV_texgen_emboss'); + GL_NV_texgen_reflection := CheckExtension('GL_NV_texgen_reflection'); + GL_NV_texture_env_combine4 := CheckExtension('GL_NV_texture_env_combine4'); + GL_NV_vertex_array_range := CheckExtension('GL_NV_vertex_array_range'); + GL_NV_vertex_program := CheckExtension('GL_NV_vertex_program'); + + GL_PGI_misc_hints := CheckExtension('GL_PGI_misc_hints'); + GL_PGI_vertex_hints := CheckExtension('GL_PGI_vertex_hints'); + + GL_REND_screen_coordinates := CheckExtension('GL_REND_screen_coordinates'); + + GL_SGI_color_matrix := CheckExtension('GL_SGI_color_matrix'); + GL_SGI_color_table := CheckExtension('GL_SGI_color_table'); + GL_SGI_depth_pass_instrument := CheckExtension('GL_SGI_depth_pass_instrument'); + + GL_SGIS_detail_texture := CheckExtension('GL_SGIS_detail_texture'); + GL_SGIS_fog_function := CheckExtension('GL_SGIS_fog_function'); + GL_SGIS_generate_mipmap := CheckExtension('GL_SGIS_generate_mipmap'); + GL_SGIS_multisample := CheckExtension('GL_SGIS_multisample'); + GL_SGIS_multitexture := CheckExtension('GL_SGIS_multitexture'); + GL_SGIS_pixel_texture := CheckExtension('GL_SGIS_pixel_texture'); + GL_SGIS_point_line_texgen := CheckExtension('GL_SGIS_point_line_texgen'); + GL_SGIS_point_parameters := CheckExtension('GL_SGIS_point_parameters'); + GL_SGIS_sharpen_texture := CheckExtension('GL_SGIS_sharpen_texture'); + GL_SGIS_texture_border_clamp := CheckExtension('GL_SGIS_texture_border_clamp'); + GL_SGIS_texture_color_mask := CheckExtension('GL_SGIS_texture_color_mask'); + GL_SGIS_texture_edge_clamp := CheckExtension('GL_SGIS_texture_edge_clamp'); + GL_SGIS_texture_filter4 := CheckExtension('GL_SGIS_texture_filter4'); + GL_SGIS_texture_lod := CheckExtension('GL_SGIS_texture_lod'); + GL_SGIS_texture_select := CheckExtension('GL_SGIS_texture_select'); + GL_SGIS_texture4D := CheckExtension('GL_SGIS_texture4D'); + + GL_SGIX_async := CheckExtension('GL_SGIX_async'); + GL_SGIX_async_histogram := CheckExtension('GL_SGIX_async_histogram'); + GL_SGIX_async_pixel := CheckExtension('GL_SGIX_async_pixel'); + GL_SGIX_blend_alpha_minmax := CheckExtension('GL_SGIX_blend_alpha_minmax'); + GL_SGIX_calligraphic_fragment := CheckExtension('GL_SGIX_calligraphic_fragment'); + GL_SGIX_clipmap := CheckExtension('GL_SGIX_clipmap'); + GL_SGIX_convolution_accuracy := CheckExtension('GL_SGIX_convolution_accuracy'); + GL_SGIX_depth_texture := CheckExtension('GL_SGIX_depth_texture'); + GL_SGIX_flush_raster := CheckExtension('GL_SGIX_flush_raster'); + GL_SGIX_fog_offset := CheckExtension('GL_SGIX_fog_offset'); + GL_SGIX_fog_scale := CheckExtension('GL_SGIX_fog_scale'); + GL_SGIX_fragment_lighting := CheckExtension('GL_SGIX_fragment_lighting'); + GL_SGIX_framezoom := CheckExtension('GL_SGIX_framezoom'); + GL_SGIX_igloo_interface := CheckExtension('GL_SGIX_igloo_interface'); + GL_SGIX_instruments := CheckExtension('GL_SGIX_instruments'); + GL_SGIX_interlace := CheckExtension('GL_SGIX_interlace'); + GL_SGIX_ir_instrument1 := CheckExtension('GL_SGIX_ir_instrument1'); + GL_SGIX_list_priority := CheckExtension('GL_SGIX_list_priority'); + GL_SGIX_pixel_texture := CheckExtension('GL_SGIX_pixel_texture'); + GL_SGIX_pixel_tiles := CheckExtension('GL_SGIX_pixel_tiles'); + GL_SGIX_polynomial_ffd := CheckExtension('GL_SGIX_polynomial_ffd'); + GL_SGIX_reference_plane := CheckExtension('GL_SGIX_reference_plane'); + GL_SGIX_resample := CheckExtension('GL_SGIX_resample'); + GL_SGIX_shadow := CheckExtension('GL_SGIX_shadow'); + GL_SGIX_shadow_ambient := CheckExtension('GL_SGIX_shadow_ambient'); + GL_SGIX_sprite := CheckExtension('GL_SGIX_sprite'); + GL_SGIX_subsample := CheckExtension('GL_SGIX_subsample'); + GL_SGIX_tag_sample_buffer := CheckExtension('GL_SGIX_tag_sample_buffer'); + GL_SGIX_texture_add_env := CheckExtension('GL_SGIX_texture_add_env'); + GL_SGIX_texture_lod_bias := CheckExtension('GL_SGIX_texture_lod_bias'); + GL_SGIX_texture_multi_buffer := CheckExtension('GL_SGIX_texture_multi_buffer'); + GL_SGIX_texture_scale_bias := CheckExtension('GL_SGIX_texture_scale_bias'); + GL_SGIX_vertex_preclip := CheckExtension('GL_SGIX_vertex_preclip'); + GL_SGIX_ycrcb := CheckExtension('GL_SGIX_ycrcb'); + GL_SGIX_ycrcba := CheckExtension('GL_SGIX_ycrcba'); + + GL_SUN_convolution_border_modes := CheckExtension('GL_SUN_convolution_border_modes'); + GL_SUN_global_alpha := CheckExtension('GL_SUN_global_alpha'); + GL_SUN_triangle_list := CheckExtension('GL_SUN_triangle_list'); + GL_SUN_vertex := CheckExtension('GL_SUN_vertex'); + + GL_SUNX_constant_data := CheckExtension('GL_SUNX_constant_data'); + + GL_WIN_phong_shading := CheckExtension('GL_WIN_phong_shading'); + GL_WIN_specular_fog := CheckExtension('GL_WIN_specular_fog'); + GL_WIN_swap_hint := CheckExtension('GL_WIN_swap_hint'); + + WGL_EXT_swap_control := CheckExtension('WGL_EXT_swap_control'); + WGL_ARB_extensions_string := CheckExtension('WGL_ARB_extensions_string'); + WGL_ARB_pixel_format := CheckExtension('WGL_ARB_pixel_format'); + + // GLU + Buffer := gluGetString(GLU_EXTENSIONS); + GLU_EXT_TEXTURE := CheckExtension('GLU_EXT_TEXTURE'); + GLU_EXT_object_space_tess := CheckExtension('GLU_EXT_object_space_tess'); + GLU_EXT_nurbs_tessellator := CheckExtension('GLU_EXT_nurbs_tessellator'); + + // ARB wgl extensions + if Assigned(wglGetExtensionsStringARB) then + begin + Buffer := wglGetExtensionsStringARB(wglGetCurrentDC); + WGL_ARB_extensions_string := CheckExtension('WGL_ARB_extensions_string'); + WGL_ARB_pixel_format := CheckExtension('WGL_ARB_pixel_format'); + end + else + begin + WGL_ARB_extensions_string := False; + WGL_ARB_pixel_format := False; + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function SetupPalette(DC: HDC; PFD: TPixelFormatDescriptor): HPalette; + +var + nColors, + I: Integer; + LogPalette: TMaxLogPalette; + RedMask, + GreenMask, + BlueMask: Byte; + +begin + nColors := 1 shl Pfd.cColorBits; + LogPalette.palVersion := $300; + LogPalette.palNumEntries := nColors; + RedMask := (1 shl Pfd.cRedBits ) - 1; + GreenMask := (1 shl Pfd.cGreenBits) - 1; + BlueMask := (1 shl Pfd.cBlueBits ) - 1; + with LogPalette, PFD do + for I := 0 to nColors - 1 do + begin + palPalEntry[I].peRed := (((I shr cRedShift ) and RedMask ) * 255) div RedMask; + palPalEntry[I].peGreen := (((I shr cGreenShift) and GreenMask) * 255) div GreenMask; + palPalEntry[I].peBlue := (((I shr cBlueShift ) and BlueMask ) * 255) div BlueMask; + palPalEntry[I].peFlags := 0; + end; + + Result := CreatePalette(PLogPalette(@LogPalette)^); + if Result <> 0 then + begin + SelectPalette(DC, Result, False); + RealizePalette(DC); + end + else + RaiseLastOSError; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function CreateRenderingContext(DC: HDC; Options: TRCOptions; ColorBits, StencilBits, AccumBits, AuxBuffers: Integer; + Layer: Integer; var Palette: HPALETTE): HGLRC; + +// Set the OpenGL properties required to draw to the given canvas and create a rendering context for it. + +const + MemoryDCs = [OBJ_MEMDC, OBJ_METADC, OBJ_ENHMETADC]; + +var + PFDescriptor: TPixelFormatDescriptor; + PixelFormat: Integer; + AType: DWORD; + +begin + FillChar(PFDescriptor, SizeOf(PFDescriptor), 0); + with PFDescriptor do + begin + nSize := SizeOf(PFDescriptor); + nVersion := 1; + dwFlags := PFD_SUPPORT_OPENGL; + AType := GetObjectType(DC); + if AType = 0 then + RaiseLastOSError; + + if AType in MemoryDCs then + dwFlags := dwFlags or PFD_DRAW_TO_BITMAP + else + dwFlags := dwFlags or PFD_DRAW_TO_WINDOW; + if opDoubleBuffered in Options then + dwFlags := dwFlags or PFD_DOUBLEBUFFER; + if opGDI in Options then + dwFlags := dwFlags or PFD_SUPPORT_GDI; + if opStereo in Options then + dwFlags := dwFlags or PFD_STEREO; + iPixelType := PFD_TYPE_RGBA; + cColorBits := ColorBits; + cDepthBits := 32; + cStencilBits := StencilBits; + cAccumBits := AccumBits; + cAuxBuffers := AuxBuffers; + if Layer = 0 then + iLayerType := PFD_MAIN_PLANE + else + if Layer > 0 then + iLayerType := PFD_OVERLAY_PLANE + else + iLayerType := Byte(PFD_UNDERLAY_PLANE); + end; + + // Just in case it didn't happen already. + if not InitOpenGL then + RaiseLastOSError; + PixelFormat := ChoosePixelFormat(DC, {$ifndef FPC}@{$endif}PFDescriptor); + if PixelFormat = 0 then + RaiseLastOSError; + + // NOTE: It is not allowed to change a pixel format of a device context once it has been set. + // Hence you may create more than one rendering context for one single device only if it + // uses the same pixel format as the first created RC. + if GetPixelFormat(DC) <> PixelFormat then + begin + if not SetPixelFormat(DC, PixelFormat, @PFDescriptor) then + RaiseLastOSError; + end; + + // Check the properties we just set. + DescribePixelFormat(DC, PixelFormat, SizeOf(PFDescriptor), PFDescriptor); + with PFDescriptor do + if (dwFlags and PFD_NEED_PALETTE) <> 0 then + Palette := SetupPalette(DC, PFDescriptor) + else + Palette := 0; + + Result := wglCreateLayerContext(DC, Layer); + if Result = 0 then + RaiseLastOSError + else + LastPixelFormat := 0; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure ActivateRenderingContext(DC: HDC; RC: HGLRC); + +var + PixelFormat: Integer; + +begin + Assert((DC <> 0), 'DC must not be 0'); + Assert((RC <> 0), 'RC must not be 0'); + + if ActivationRefCount = 0 then + begin + // Before activating the rendering context check if it is not already used by another thread. + with ContextList.LockList do + try + if IndexOf(Pointer(RC)) = -1 then + begin + if wglMakeCurrent(DC, RC) then + Add(Pointer(RC)) + else + ShowError(SMakeCurrentFailed); + end + else + ShowError(SRCAlreadyActive) + finally + ContextList.UnlockList; + end; + + Inc(ActivationRefCount); + + // The extension function addresses are unique for each pixel format. All rendering + // contexts of a given pixel format share the same extension function addresses. + PixelFormat := GetPixelFormat(DC); + if PixelFormat <> LastPixelFormat then + begin + ReadExtensions; + ReadImplementationProperties; + LastPixelFormat := PixelFormat; + end; + end + else + begin + Assert((wglGetCurrentDC = DC) and (wglGetCurrentContext = RC), 'Incoherent DC/RC pair.'); + Inc(ActivationRefCount); + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure DeactivateRenderingContext; + +begin + Assert(ActivationRefCount > 0, 'Unbalanced deactivation.'); + if ActivationRefCount > 0 then + begin + Dec(ActivationRefCount); + + if ActivationRefCount = 0 then + begin + // If the rendering context is no longer used then remove it from the context list to indicate + // it can now be used in any thread. + with ContextList.LockList do + try + Remove(Pointer(wglGetCurrentContext)); + if not wglMakeCurrent(0, 0) then + ShowError(SMakeCurrentFailed); + finally + ContextList.UnlockList; + end; + end; + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure DestroyRenderingContext(RC: HGLRC); + +// Used to destroy the given rendering context. Only contexts which are no longer in use by any thread can be deleted. + +begin + Assert((ActivationRefCount = 0), 'Active contexts cannot be deleted.'); + + with ContextList.LockList do + try + if not wglDeleteContext(RC) then + ShowError(SDeleteContextFailed); + if IndexOf(Pointer(RC)) > -1 then + ShowError(SContextInUse); + finally + ContextList.UnlockList; + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function CurrentDC: HDC; + +// Returns the device context which is used for the current rendering context of the caller thread. + +begin + Result := wglGetCurrentDC; +end; + +{$endif} + +//---------------------------------------------------------------------------------------------------------------------- + +procedure CloseOpenGL; +begin + if GLHandle <> INVALID_MODULEHANDLE then + begin + UnloadModule( GLHandle ); + GLHandle := INVALID_MODULEHANDLE; + end; + + if GLUHandle <> INVALID_MODULEHANDLE then + begin + UnloadModule( GLUHandle ); + GLUHandle := INVALID_MODULEHANDLE; + end; + + ClearProcAddresses; + ClearExtensions; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function InitOpenGL: Boolean; + +begin + if (GLHandle = INVALID_MODULEHANDLE) or (GLUHandle = INVALID_MODULEHANDLE) then + Result := InitOpenGLFromLibrary(PChar( SDefaultGLLibrary ), PChar( SDefaultGLULibrary ) ) + else + Result := True; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function InitOpenGLFromLibrary(GLName, GLUName: PChar): Boolean; + +begin + Result := False; + CloseOpenGL; + + LoadModule( GLHandle, GLName ); + LoadModule( GLUHandle, GLUName ); + + if (GLHandle <> INVALID_MODULEHANDLE) and (GLUHandle <> INVALID_MODULEHANDLE) then + begin + LoadProcAddresses; + Result := True; + end + else + begin + if GLHandle <> INVALID_MODULEHANDLE then + UnloadModule( GLHandle ); + + if GLUHandle <> INVALID_MODULEHANDLE then + UnloadModule( GLUHandle ); + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function IsOpenGLInitialized: Boolean; + +begin + Result := GLHandle <> INVALID_MODULEHANDLE; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure UnloadOpenGL; + +// compatibility routine + +begin + CloseOpenGL; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function LoadOpenGL: Boolean; + +// compatibility routine + +begin + Result := InitOpenGL; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function LoadOpenGLFromLibrary(GLName, GLUName: PChar): Boolean; + +// compatibility routine + +begin + Result := InitOpenGLFromLibrary(GLName, GLUName); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function IsOpenGLLoaded: Boolean; + +// compatibility routine + +begin + Result := GLHandle <> INVALID_MODULEHANDLE; +end; + +//---------------------------------------------------------------------------------------------------------------------- +{$ifdef FPC} +const Default8087CW: Word = $1332; + +{$ASMMODE INTEL} +procedure Set8087CW(NewCW: Word); Assembler; +asm + MOV Default8087CW, AX +end; +{$endif} + +//---------------------------------------------------------------------------------------------------------------------- + +initialization + ContextList := TThreadList.Create; + Set8087CW($133F); +finalization + CloseOpenGL; + ContextList.Free; + // We don't need to reset the FPU control word as the previous set call is process specific. +end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/opengl12.rst b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/opengl12.rst new file mode 100644 index 00000000..857993e7 --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/opengl12.rst @@ -0,0 +1,26 @@ + +# hash value = 79191886 +opengl12.srcalreadyactive='Rendering context already active in another th'+ +'read.' + + +# hash value = 191308692 +opengl12.smakecurrentfailed='wglMakeCurrent failed' + + +# hash value = 214729876 +opengl12.sdeletecontextfailed='wglDeleteContext failed' + + +# hash value = 230190814 +opengl12.scontextinuse='Cannot delete rendering context. It is still in u'+ +'se by another thread.' + + +# hash value = 168003996 +opengl12.sdefaultgllibrary='OpenGL32.dll' + + +# hash value = 140838716 +opengl12.sdefaultglulibrary='GLU32.dll' + diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/Readme.txt b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/Readme.txt new file mode 100644 index 00000000..76d63a9d --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/Readme.txt @@ -0,0 +1,27 @@ +Delphi interface unit for OpenGL version 1.2 compilable with Delphi 3-6 and Kylix. + +This unit is open source under the Mozilla Public License and +the original author is Dipl. Ing. Mike Lischke (public@lischke-online.de). + +You can obtain this unit also from the JEDI (Joint Endeavor of Delphi Innovators) +API page at www.delphi-jedi.org. + +Note for GLScene users: Eric Grange has provided a general vector types unit which +resolves conflicts for types which are defined in OpenGL12.pas as well as Geometry.pas. +This unit is located in the sub folder "GLScene AddOn". +Please add this unit to the uses clause of OpenGL12.pas and remove the few types which +are already declared in VectorTypes.pas. + +For tests and as starting point three demos are included into the package. Two of them (GLDiag and GLTest) +need the (also provided) simple OpenGL control GLControl (see "GLControl\Package"). + +- Basic is a very simple test program which only uses an empty form. +- GLTest (in GLControl) uses GLControl to show four rendering contexts simultanously. +- GLDiag is a diagnosis tool similar to DXDiag which shows some properties of the current + OpenGL driver implementation. + +Have fun and + +Ciao, Mike +www.lischke-online.de +www.delphi-unicode.net \ No newline at end of file diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/jedi-sdl.inc b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/jedi-sdl.inc new file mode 100644 index 00000000..48a789fd --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/jedi-sdl.inc @@ -0,0 +1,337 @@ +{ + $Id: jedi-sdl.inc,v 1.9 2004/12/23 23:42:17 savage Exp $ +} +{******************************************************************************} +{ } +{ Borland Delphi SDL - Simple DirectMedia Layer } +{ Global Conditional Definitions for JEDI-SDL cross-compilation } +{ } +{ } +{ The initial developer of this Pascal code was : } +{ Prof. Abimbola Olowofoyeku } +{ } +{ Portions created by Prof. Abimbola Olowofoyeku are } +{ Copyright (C) 2000 - 2100 Prof. Abimbola Olowofoyeku. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ Prof. Abimbola Olowofoyeku } +{ Dominqiue Louis } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ This code has been copied from... } +{ Global Conditional Definitions for Chief's UNZIP package } +{ By Prof. Abimbola Olowofoyeku (The African Chief) } +{ http://www.bigfoot.com/~African_Chief/ } +{ } +{ } +{ Requires } +{ -------- } +{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } +{ They are available from... } +{ http://www.libsdl.org . } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ 2003-04-03 DL - Initial addition } +{ } +{ 2003-04-07 DL - Added Macro ON derective for FPC and OpenGL and removed } +{ WEAKPACKAGE derective. WEAKPACKAGE should be set when } +{ appropriate. } +{ } +{ 2003-04-23 - DL : under instruction from Alexey Barkovoy I have added } +{ better TMT Pascal support and under instruction } +{ from Prof. Abimbola Olowofoyeku (The African Chief) } +{ I have added better Gnu Pascal support } +{ } +{ 2004-01-19 - DL : Under instruction from Marco van de Voort, I have added } +{ Better FPC support for FreeBSD. } +{ } +(* + $Log: jedi-sdl.inc,v $ + Revision 1.9 2004/12/23 23:42:17 savage + Applied Patches supplied by Michalis Kamburelis ( THANKS! ), for greater FreePascal compatability. + + Revision 1.8 2004/10/20 22:43:04 savage + Ensure that UNSAFE type warning are off in D9 as well + + Revision 1.7 2004/04/05 09:59:51 savage + Changes for FreePacal as suggested by Marco + + Revision 1.6 2004/03/31 22:18:15 savage + Small comment for turning off warning under GnuPascal + + Revision 1.5 2004/03/30 22:41:02 savage + Added extra commenting due to previous compiler directive + + Revision 1.4 2004/03/30 22:08:33 savage + Added Kylix Define + + Revision 1.3 2004/03/30 21:34:40 savage + {$H+} needed for FPC compatiblity + + Revision 1.2 2004/02/14 00:23:39 savage + As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. + +*) +{******************************************************************************} + +{.$define Debug} { uncomment for debugging } + +{$IFNDEF FPC} + {$IFDEF __GPC__} + {$I-} + {$W-} // turn off GPC warnings + {$X+} + {$ELSE} {__GPC__} + {$IFDEF Debug} + {$F+,D+,Q-,L+,R+,I-,S+,Y+,A+} + {$ELSE} + {$F+,Q-,R-,S-,I-,A+} + {$ENDIF} + {$ENDIF} {__GPC__} +{$ELSE} {FPC} + //{$M+} +{$ENDIF} {FPC} + +{$IFDEF LINUX} +{$DEFINE UNIX} +{$ENDIF} + +{$IFDEF ver70} + {$IFDEF Windows} + {$DEFINE Win16} + {$ENDIF Windows} + {$IFDEF MSDOS} + {$DEFINE NO_EXPORTS} + {$ENDIF MSDOS} + {$IFDEF DPMI} + {$DEFINE BP_DPMI} + {$ENDIF} + {$DEFINE OS_16_BIT} + {$DEFINE __OS_DOS__} +{$ENDIF ver70} + +{$IFDEF ver80} + {$DEFINE Delphi} {Delphi 1.x} + {$DEFINE Delphi16} + {$DEFINE Win16} + {$DEFINE OS_16_BIT} + {$DEFINE __OS_DOS__} +{$ENDIF ver80} + +{$IFDEF ver90} + {$DEFINE Delphi} {Delphi 2.x} + {$DEFINE Delphi32} +{$ENDIF ver90} + +{$IFDEF ver100} + {$DEFINE Delphi} {Delphi 3.x} + {$DEFINE Delphi32} + {$DEFINE WIN32} +{$ENDIF ver100} + +{$IFDEF ver93} + {$DEFINE Delphi} {C++ Builder 1.x} + {$DEFINE Delphi32} +{$ENDIF ver93} + +{$IFDEF ver110} + {$DEFINE Delphi} {C++ Builder 3.x} + {$DEFINE Delphi32} +{$ENDIF ver110} + +{$IFDEF ver120} + {$DEFINE Delphi} {Delphi 4.x} + {$DEFINE Delphi32} + {$DEFINE Has_Int64} +{$ENDIF ver120} + +{$IFDEF ver130} + {$DEFINE Delphi} {Delphi 5.x} + {$DEFINE Delphi32} + {$DEFINE Has_Int64} +{$ENDIF ver130} + +{$IFDEF ver140} + {$DEFINE Delphi} {Delphi 6.x} + {$DEFINE Delphi32} + {$DEFINE Has_Int64} +{$ENDIF ver140} + +{$IFDEF ver150} + {$DEFINE Delphi} {Delphi 7.x} + {$DEFINE Delphi32} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types in Delphi 7} + {$DEFINE Has_Int64} +{$ENDIF ver150} + +{$IFDEF ver160} + {$DEFINE Delphi} {Delphi 8??} + {$DEFINE Delphi32} + {$DEFINE Has_Int64} +{$ENDIF ver160} + +{$IFDEF ver170} + {$DEFINE Delphi} {Delphi 9??} + {$DEFINE Delphi32} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types in Delphi 7} + {$DEFINE Has_Int64} +{$ENDIF ver170} + +{$IFDEF UNIX} + {$ifdef VER150} + {$define KYLIX} + {$endif} + + {$ifdef VER140} + {$define KYLIX} + {$endif} + + {$ifdef VER140} + {$define KYLIX} + {$endif} +{$ENDIF UNIX} + +{$IFDEF VirtualPascal} { Virtual Pascal 2.x } + {$DEFINE Delphi} { Use Delphi Syntax } + {$DEFINE VP2} + {&Delphi+} +{$ENDIF VirtualPascal} + +{$IFDEF Delphi} + {$DEFINE Windows} + {$DEFINE USE_STDCALL} +{$ENDIF Delphi} + +{$IFDEF FPC} + {$MODE Delphi} { use Delphi compatibility mode } + {$H+} + {$PACKRECORDS 4} // Added for record + {$MACRO ON} // Added For OpenGL + {$THREADING on} + {$DEFINE Delphi} + {$DEFINE UseAT} + {$UNDEF USE_STDCALL} + {$DEFINE OS_BigMem} + {$DEFINE NO_EXPORTS} + {$DEFINE Has_Int64} + {$DEFINE NOCRT} + {$IFDEF unix} + {$DEFINE fpc_unix} + {$ELSE} + {$DEFINE __OS_DOS__} + {$ENDIF} + {$IFDEF WIN32} + {$DEFINE UseWin} + {$ENDIF} +{$ENDIF FPC} + +{$IFDEF Win16} + {$K+} {smart callbacks} +{$ENDIF Win16} + + {$IFDEF OS2} + {$UNDEF Windows} + {$DEFINE UseWin} + {$DEFINE OS_BigMem} + {$ENDIF OS2} + +{$IFDEF __GPC__} + {$UNDEF UseWin} + {$UNDEF USE_STDCALL} + {$DEFINE OS_BigMem} + {$DEFINE NO_EXPORTS} + {$DEFINE NOCRT} + {$DEFINE cdecl attribute(cdecl)} +{$ENDIF} + +{$IFDEF __TMT__} + {$DEFINE OS_BigMem} + {$DEFINE NO_EXPORTS} + {$DEFINE __OS_DOS__} + {$DEFINE UseAT} + {$IFNDEF MSDOS} + {$DEFINE USE_STDCALL} + {$ENDIF} + + {$IFDEF __WIN32__} + {$DEFINE Win32} + {$DEFINE UseWin} + {$DEFINE NOCRT} + {$DEFINE Win32} + {$IFNDEF __CON__} + {$DEFINE Windows} + {$ENDIF} + {$ENDIF} + + {$A+} // Word alignment data + {$OA+} // Objects and structures align +{$ENDIF} + +{$IFDEF Win32} + {$DEFINE OS_BigMem} +{$ELSE Win32} + {$IFDEF ver70} + {$DEFINE assembler} + {$ENDIF} { use 16-bit assembler! } +{$ENDIF Win32} + +{ ************************** dos/dos-like platforms **************} +{$IFDEF Windows} + {$DEFINE __OS_DOS__} + {$DEFINE UseWin} + {$DEFINE MSWINDOWS} +{$ENDIF Delphi} + +{$IFDEF OS2} + {$DEFINE __OS_DOS__} + {$DEFINE Can_Use_DLL} +{$ENDIF Delphi} + +{$IFDEF UseWin} + {$DEFINE Can_Use_DLL} +{$ENDIF} + +{$IFDEF Win16} + {$DEFINE Can_Use_DLL} +{$ENDIF} + +{$IFDEF BP_DPMI} + {$DEFINE Can_Use_DLL} +{$ENDIF} + +{$IFDEF USE_STDCALL} + {$IFNDEF __TMT__} + {$DEFINE BY_NAME} + {$ENDIF} +{$ENDIF} + +{$IFNDEF ver70} + {$UNDEF assembler} +{$ENDIF} diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/libxmlparser.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/libxmlparser.pas new file mode 100644 index 00000000..54841840 --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/libxmlparser.pas @@ -0,0 +1,2690 @@ +(** +=============================================================================================== +Name : LibXmlParser +=============================================================================================== +Project : All Projects +=============================================================================================== +Subject : Progressive XML Parser for all types of XML Files +=============================================================================================== +Author : Stefan Heymann + Eschenweg 3 + 72076 Tübingen + GERMANY + +E-Mail: stefan@destructor.de +URL: www.destructor.de +=============================================================================================== +Source, Legals ("Licence") +-------------------------- +The official site to get this parser is http://www.destructor.de/ + +Usage and Distribution of this Source Code is ruled by the +"Destructor.de Source code Licence" (DSL) which comes with this file or +can be downloaded at http://www.destructor.de/ + +IN SHORT: Usage and distribution of this source code is free. + You use it completely on your own risk. + +Postcardware +------------ +If you like this code, please send a postcard of your city to my above address. +=============================================================================================== +!!! All parts of this code which are not finished or not conforming exactly to + the XmlSpec are marked with three exclamation marks + +-!- Parts where the parser may be able to detect errors in the document's syntax are + marked with the dash-exlamation mark-dash sequence. +=============================================================================================== +Terminology: +------------ +- Start: Start of a buffer part +- Final: End (last character) of a buffer part +- DTD: Document Type Definition +- DTDc: Document Type Declaration +- XMLSpec: The current W3C XML Recommendation (version 1.0 as of 1998-02-10), Chapter No. +- Cur*: Fields concerning the "Current" part passed back by the "Scan" method +=============================================================================================== +Scanning the XML document +------------------------- +- Create TXmlParser Instance MyXml := TXmlParser.Create; +- Load XML Document MyXml.LoadFromFile (Filename); +- Start Scanning MyXml.StartScan; +- Scan Loop WHILE MyXml.Scan DO +- Test for Part Type CASE MyXml.CurPartType OF +- Handle Parts ... : ;;; +- Handle Parts ... : ;;; +- Handle Parts ... : ;;; + END; +- Destroy MyXml.Free; +=============================================================================================== +Loading the XML document +------------------------ +You can load the XML document from a file with the "LoadFromFile" method. +It is beyond the scope of this parser to perform HTTP or FTP accesses. If you want your +application to handle such requests (URLs), you can load the XML via HTTP or FTP or whatever +protocol and hand over the data buffer using the "LoadFromBuffer" or "SetBuffer" method. +"LoadFromBuffer" loads the internal buffer of TXmlParser with the given null-terminated +string, thereby creating a copy of that buffer. +"SetBuffer" just takes the pointer to another buffer, which means that the given +buffer pointer must be valid while the document is accessed via TXmlParser. +=============================================================================================== +Encodings: +---------- +This XML parser kind of "understands" the following encodings: +- UTF-8 +- ISO-8859-1 +- Windows-1252 + +Any flavor of multi-byte characters (and this includes UTF-16) is not supported. Sorry. + +Every string which has to be passed to the application passes the virtual method +"TranslateEncoding" which translates the string from the current encoding (stored in +"CurEncoding") into the encoding the application wishes to receive. +The "TranslateEncoding" method that is built into TXmlParser assumes that the application +wants to receive Windows ANSI (Windows-1252, about the same as ISO-8859-1) and is able +to convert UTF-8 and ISO-8859-1 encodings. +For other source and target encodings, you will have to override "TranslateEncoding". +=============================================================================================== +Buffer Handling +--------------- +- The document must be loaded completely into a piece of RAM +- All character positions are referenced by PChar pointers +- The TXmlParser instance can either "own" the buffer itself (then, FBufferSize is > 0) + or reference the buffer of another instance or object (then, FBuffersize is 0 and + FBuffer is not NIL) +- The Property DocBuffer passes back a pointer to the first byte of the document. If there + is no document stored (FBuffer is NIL), the DocBuffer returns a pointer to a NULL character. +=============================================================================================== +Whitespace Handling +------------------- +The TXmlParser property "PackSpaces" determines how Whitespace is returned in Text Content: +While PackSpaces is true, all leading and trailing whitespace characters are trimmed of, all +Whitespace is converted to Space #x20 characters and contiguous Whitespace characters are +compressed to one. +If the "Scan" method reports a ptContent part, the application can get the original text +with all whitespace characters by extracting the characters from "CurStart" to "CurFinal". +If the application detects an xml:space attribute, it can set "PackSpaces" accordingly or +use CurStart/CurFinal. +Please note that TXmlParser does _not_ normalize Line Breaks to single LineFeed characters +as the XmlSpec requires (XmlSpec 2.11). +The xml:space attribute is not handled by TXmlParser. This is on behalf of the application. +=============================================================================================== +Non-XML-Conforming +------------------ +TXmlParser does not conform 100 % exactly to the XmlSpec: +- UTF-16 is not supported (XmlSpec 2.2) + (Workaround: Convert UTF-16 to UTF-8 and hand the buffer over to TXmlParser) +- As the parser only works with single byte strings, all Unicode characters > 255 + can currently not be handled correctly. +- Line breaks are not normalized to single Linefeed #x0A characters (XmlSpec 2.11) + (Workaround: The Application can access the text contents on its own [CurStart, CurFinal], + thereby applying every normalization it wishes to) +- The attribute value normalization does not work exactly as defined in the + Second Edition of the XML 1.0 specification. +- See also the code parts marked with three consecutive exclamation marks. These are + parts which are not finished in the current code release. + +This list may be incomplete, so it may grow if I get to know any other points. +As work on the parser proceeds, this list may also shrink. +=============================================================================================== +Things Todo +----------- +- Introduce a new event/callback which is called when there is an unresolvable + entity or character reference +- Support Unicode +- Use Streams instead of reading the whole XML into memory +=============================================================================================== +Change History, Version numbers +------------------------------- +The Date is given in ISO Year-Month-Day (YYYY-MM-DD) order. +Versions are counted from 1.0.0 beginning with the version from 2000-03-16. +Unreleased versions don't get a version number. + +Date Author Version Changes +----------------------------------------------------------------------------------------------- +2000-03-16 HeySt 1.0.0 Start +2000-03-28 HeySt 1.0.1 Initial Publishing of TXmlParser on the destructor.de Web Site +2000-03-30 HeySt 1.0.2 TXmlParser.AnalyzeCData: Call "TranslateEncoding" for CurContent +2000-03-31 HeySt 1.0.3 Deleted the StrPosE function (was not needed anyway) +2000-04-04 HeySt 1.0.4 TDtdElementRec modified: Start/Final for all Elements; + Should be backwards compatible. + AnalyzeDtdc: Set CurPartType to ptDtdc +2000-04-23 HeySt 1.0.5 New class TObjectList. Eliminated reference to the Delphi 5 + "Contnrs" unit so LibXmlParser is Delphi 4 compatible. +2000-07-03 HeySt 1.0.6 TNvpNode: Added Constructor +2000-07-11 HeySt 1.0.7 Removed "Windows" from USES clause + Added three-exclamation-mark comments for Utf8ToAnsi/AnsiToUtf8 + Added three-exclamation-mark comments for CHR function calls +2000-07-23 HeySt 1.0.8 TXmlParser.Clear: CurAttr.Clear; EntityStack.Clear; + (This was not a bug; just defensive programming) +2000-07-29 HeySt 1.0.9 TNvpList: Added methods: Node(Index), Value(Index), Name(Index); +2000-10-07 HeySt Introduced Conditional Defines + Uses Contnrs unit and its TObjectList class again for + Delphi 5 and newer versions +2001-01-30 HeySt Introduced Version Numbering + Made LoadFromFile and LoadFromBuffer BOOLEAN functions + Introduced FileMode parameter for LoadFromFile + BugFix: TAttrList.Analyze: Must add CWhitespace to ExtractName call + Comments worked over +2001-02-28 HeySt 1.0.10 Completely worked over and tested the UTF-8 functions + Fixed a bug in TXmlParser.Scan which caused it to start over when it + was called after the end of scanning, resulting in an endless loop + TEntityStack is now a TObjectList instead of TList +2001-07-03 HeySt 1.0.11 Updated Compiler Version IFDEFs for Kylix +2001-07-11 HeySt 1.0.12 New TCustomXmlScanner component (taken over from LibXmlComps.pas) +2001-07-14 HeySt 1.0.13 Bugfix TCustomXmlScanner.FOnTranslateEncoding +2001-10-22 HeySt Don't clear CurName anymore when the parser finds a CDATA section. +2001-12-03 HeySt 1.0.14 TObjectList.Clear: Make call to INHERITED method (fixes a memory leak) +2001-12-05 HeySt 1.0.15 TObjectList.Clear: removed call to INHERITED method + TObjectList.Destroy: Inserted SetCapacity call. + Reduces need for frequent re-allocation of pointer buffer + Dedicated to my father, Theodor Heymann +2002-06-26 HeySt 1.0.16 TXmlParser.Scan: Fixed a bug with PIs whose name is beginning + with 'xml'. Thanks to Uwe Kamm for submitting this bug. + The CurEncoding property is now always in uppercase letters (the XML + spec wants it to be treated case independently so when it's uppercase + comparisons are faster) +2002-03-04 HeySt 1.0.17 Included an IFDEF for Delphi 7 (VER150) and Kylix + There is a new symbol HAS_CONTNRS_UNIT which is used now to + distinguish between IDEs which come with the Contnrs unit and + those that don't. +*) + +UNIT libxmlparser; + +{$I jedi-sdl.inc} + +{$ALIGN ON} + +INTERFACE + +USES + SysUtils, Classes, + (*$IFDEF HAS_CONTNRS_UNIT *) // The Contnrs Unit was introduced in Delphi 5 + Contnrs, + (*$ENDIF*) + Math; + +CONST + CVersion = '1.0.17'; // This variable will be updated for every release + // (I hope, I won't forget to do it everytime ...) + +TYPE + TPartType = // --- Document Part Types + (ptNone, // Nothing + ptXmlProlog, // XML Prolog XmlSpec 2.8 / 4.3.1 + ptComment, // Comment XmlSpec 2.5 + ptPI, // Processing Instruction XmlSpec 2.6 + ptDtdc, // Document Type Declaration XmlSpec 2.8 + ptStartTag, // Start Tag XmlSpec 3.1 + ptEmptyTag, // Empty-Element Tag XmlSpec 3.1 + ptEndTag, // End Tag XmlSpec 3.1 + ptContent, // Text Content between Tags + ptCData); // CDATA Section XmlSpec 2.7 + + TDtdElemType = // --- DTD Elements + (deElement, // !ELEMENT declaration + deAttList, // !ATTLIST declaration + deEntity, // !ENTITY declaration + deNotation, // !NOTATION declaration + dePI, // PI in DTD + deComment, // Comment in DTD + deError); // Error found in the DTD + +TYPE + TAttrList = CLASS; + TEntityStack = CLASS; + TNvpList = CLASS; + TElemDef = CLASS; + TElemList = CLASS; + TEntityDef = CLASS; + TNotationDef = CLASS; + + TDtdElementRec = RECORD // --- This Record is returned by the DTD parser callback function + Start, Final : PChar; // Start/End of the Element's Declaration + CASE ElementType : TDtdElemType OF // Type of the Element + deElement, // + deAttList : (ElemDef : TElemDef); // + deEntity : (EntityDef : TEntityDef); // + deNotation : (NotationDef : TNotationDef); // + dePI : (Target : PChar; // + Content : PChar; + AttrList : TAttrList); + deError : (Pos : PChar); // Error + // deComment : ((No additional fields here)); // + END; + + TXmlParser = CLASS // --- Internal Properties and Methods + PROTECTED + FBuffer : PChar; // NIL if there is no buffer available + FBufferSize : INTEGER; // 0 if the buffer is not owned by the Document instance + FSource : STRING; // Name of Source of document. Filename for Documents loaded with LoadFromFile + + FXmlVersion : STRING; // XML version from Document header. Default is '1.0' + FEncoding : STRING; // Encoding from Document header. Default is 'UTF-8' + FStandalone : BOOLEAN; // Standalone declaration from Document header. Default is 'yes' + FRootName : STRING; // Name of the Root Element (= DTD name) + FDtdcFinal : PChar; // Pointer to the '>' character terminating the DTD declaration + + FNormalize : BOOLEAN; // If true: Pack Whitespace and don't return empty contents + EntityStack : TEntityStack; // Entity Stack for Parameter and General Entities + FCurEncoding : STRING; // Current Encoding during parsing (always uppercase) + + PROCEDURE AnalyzeProlog; // Analyze XML Prolog or Text Declaration + PROCEDURE AnalyzeComment (Start : PChar; VAR Final : PChar); // Analyze Comments + PROCEDURE AnalyzePI (Start : PChar; VAR Final : PChar); // Analyze Processing Instructions (PI) + PROCEDURE AnalyzeDtdc; // Analyze Document Type Declaration + PROCEDURE AnalyzeDtdElements (Start : PChar; VAR Final : PChar); // Analyze DTD declarations + PROCEDURE AnalyzeTag; // Analyze Start/End/Empty-Element Tags + PROCEDURE AnalyzeCData; // Analyze CDATA Sections + PROCEDURE AnalyzeText (VAR IsDone : BOOLEAN); // Analyze Text Content between Tags + PROCEDURE AnalyzeElementDecl (Start : PChar; VAR Final : PChar); + PROCEDURE AnalyzeAttListDecl (Start : PChar; VAR Final : PChar); + PROCEDURE AnalyzeEntityDecl (Start : PChar; VAR Final : PChar); + PROCEDURE AnalyzeNotationDecl (Start : PChar; VAR Final : PChar); + + PROCEDURE PushPE (VAR Start : PChar); + PROCEDURE ReplaceCharacterEntities (VAR Str : STRING); + PROCEDURE ReplaceParameterEntities (VAR Str : STRING); + PROCEDURE ReplaceGeneralEntities (VAR Str : STRING); + + FUNCTION GetDocBuffer : PChar; // Returns FBuffer or a pointer to a NUL char if Buffer is empty + + PUBLIC // --- Document Properties + PROPERTY XmlVersion : STRING READ FXmlVersion; // XML version from the Document Prolog + PROPERTY Encoding : STRING READ FEncoding; // Document Encoding from Prolog + PROPERTY Standalone : BOOLEAN READ FStandalone; // Standalone Declaration from Prolog + PROPERTY RootName : STRING READ FRootName; // Name of the Root Element + PROPERTY Normalize : BOOLEAN READ FNormalize WRITE FNormalize; // True if Content is to be normalized + PROPERTY Source : STRING READ FSource; // Name of Document Source (Filename) + PROPERTY DocBuffer : PChar READ GetDocBuffer; // Returns document buffer + PUBLIC // --- DTD Objects + Elements : TElemList; // Elements: List of TElemDef (contains Attribute Definitions) + Entities : TNvpList; // General Entities: List of TEntityDef + ParEntities : TNvpList; // Parameter Entities: List of TEntityDef + Notations : TNvpList; // Notations: List of TNotationDef + PUBLIC + CONSTRUCTOR Create; + DESTRUCTOR Destroy; OVERRIDE; + + // --- Document Handling + FUNCTION LoadFromFile (Filename : STRING; + FileMode : INTEGER = fmOpenRead OR fmShareDenyNone) : BOOLEAN; + // Loads Document from given file + FUNCTION LoadFromBuffer (Buffer : PChar) : BOOLEAN; // Loads Document from another buffer + PROCEDURE SetBuffer (Buffer : PChar); // References another buffer + PROCEDURE Clear; // Clear Document + + PUBLIC + // --- Scanning through the document + CurPartType : TPartType; // Current Type + CurName : STRING; // Current Name + CurContent : STRING; // Current Normalized Content + CurStart : PChar; // Current First character + CurFinal : PChar; // Current Last character + CurAttr : TAttrList; // Current Attribute List + PROPERTY CurEncoding : STRING READ FCurEncoding; // Current Encoding + PROCEDURE StartScan; + FUNCTION Scan : BOOLEAN; + + // --- Events / Callbacks + FUNCTION LoadExternalEntity (SystemId, PublicId, + Notation : STRING) : TXmlParser; VIRTUAL; + FUNCTION TranslateEncoding (CONST Source : STRING) : STRING; VIRTUAL; + PROCEDURE DtdElementFound (DtdElementRec : TDtdElementRec); VIRTUAL; + END; + + TValueType = // --- Attribute Value Type + (vtNormal, // Normal specified Attribute + vtImplied, // #IMPLIED attribute value + vtFixed, // #FIXED attribute value + vtDefault); // Attribute value from default value in !ATTLIST declaration + + TAttrDefault = // --- Attribute Default Type + (adDefault, // Normal default value + adRequired, // #REQUIRED attribute + adImplied, // #IMPLIED attribute + adFixed); // #FIXED attribute + + TAttrType = // --- Type of attribute + (atUnknown, // Unknown type + atCData, // Character data only + atID, // ID + atIdRef, // ID Reference + atIdRefs, // Several ID References, separated by Whitespace + atEntity, // Name of an unparsed Entity + atEntities, // Several unparsed Entity names, separated by Whitespace + atNmToken, // Name Token + atNmTokens, // Several Name Tokens, separated by Whitespace + atNotation, // A selection of Notation names (Unparsed Entity) + atEnumeration); // Enumeration + + TElemType = // --- Element content type + (etEmpty, // Element is always empty + etAny, // Element can have any mixture of PCDATA and any elements + etChildren, // Element must contain only elements + etMixed); // Mixed PCDATA and elements + + (*$IFDEF HAS_CONTNRS_UNIT *) + TObjectList = Contnrs.TObjectList; // Re-Export this identifier + (*$ELSE *) + TObjectList = CLASS (TList) + DESTRUCTOR Destroy; OVERRIDE; + PROCEDURE Delete (Index : INTEGER); + PROCEDURE Clear; OVERRIDE; + END; + (*$ENDIF *) + + TNvpNode = CLASS // Name-Value Pair Node + Name : STRING; + Value : STRING; + CONSTRUCTOR Create (TheName : STRING = ''; TheValue : STRING = ''); + END; + + TNvpList = CLASS (TObjectList) // Name-Value Pair List + PROCEDURE Add (Node : TNvpNode); + FUNCTION Node (Name : STRING) : TNvpNode; OVERLOAD; + FUNCTION Node (Index : INTEGER) : TNvpNode; OVERLOAD; + FUNCTION Value (Name : STRING) : STRING; OVERLOAD; + FUNCTION Value (Index : INTEGER) : STRING; OVERLOAD; + FUNCTION Name (Index : INTEGER) : STRING; + END; + + TAttr = CLASS (TNvpNode) // Attribute of a Start-Tag or Empty-Element-Tag + ValueType : TValueType; + AttrType : TAttrType; + END; + + TAttrList = CLASS (TNvpList) // List of Attributes + PROCEDURE Analyze (Start : PChar; VAR Final : PChar); + END; + + TEntityStack = CLASS (TObjectList) // Stack where current position is stored before parsing entities + PROTECTED + Owner : TXmlParser; + PUBLIC + CONSTRUCTOR Create (TheOwner : TXmlParser); + PROCEDURE Push (LastPos : PChar); OVERLOAD; + PROCEDURE Push (Instance : TObject; LastPos : PChar); OVERLOAD; + FUNCTION Pop : PChar; // Returns next char or NIL if EOF is reached. Frees Instance. + END; + + TAttrDef = CLASS (TNvpNode) // Represents a '; + + // --- Name Constants for the above enumeration types + CPartType_Name : ARRAY [TPartType] OF STRING = + ('', 'XML Prolog', 'Comment', 'PI', + 'DTD Declaration', 'Start Tag', 'Empty Tag', 'End Tag', + 'Text', 'CDATA'); + CValueType_Name : ARRAY [TValueType] OF STRING = ('Normal', 'Implied', 'Fixed', 'Default'); + CAttrDefault_Name : ARRAY [TAttrDefault] OF STRING = ('Default', 'Required', 'Implied', 'Fixed'); + CElemType_Name : ARRAY [TElemType] OF STRING = ('Empty', 'Any', 'Childs only', 'Mixed'); + CAttrType_Name : ARRAY [TAttrType] OF STRING = ('Unknown', 'CDATA', + 'ID', 'IDREF', 'IDREFS', + 'ENTITY', 'ENTITIES', + 'NMTOKEN', 'NMTOKENS', + 'Notation', 'Enumeration'); + +FUNCTION ConvertWs (Source: STRING; PackWs: BOOLEAN) : STRING; // Convert WS to spaces #x20 +PROCEDURE SetStringSF (VAR S : STRING; BufferStart, BufferFinal : PChar); // SetString by Start/Final of buffer +FUNCTION StrSFPas (Start, Finish : PChar) : STRING; // Convert buffer part to Pascal string +FUNCTION TrimWs (Source : STRING) : STRING; // Trim Whitespace + +FUNCTION AnsiToUtf8 (Source : ANSISTRING) : STRING; // Convert Win-1252 to UTF-8 +FUNCTION Utf8ToAnsi (Source : STRING; UnknownChar : CHAR = '¿') : ANSISTRING; // Convert UTF-8 to Win-1252 + + +(* +=============================================================================================== +TCustomXmlScanner event based component wrapper for TXmlParser +=============================================================================================== +*) + +TYPE + TCustomXmlScanner = CLASS; + TXmlPrologEvent = PROCEDURE (Sender : TObject; XmlVersion, Encoding: STRING; Standalone : BOOLEAN) OF OBJECT; + TCommentEvent = PROCEDURE (Sender : TObject; Comment : STRING) OF OBJECT; + TPIEvent = PROCEDURE (Sender : TObject; Target, Content: STRING; Attributes : TAttrList) OF OBJECT; + TDtdEvent = PROCEDURE (Sender : TObject; RootElementName : STRING) OF OBJECT; + TStartTagEvent = PROCEDURE (Sender : TObject; TagName : STRING; Attributes : TAttrList) OF OBJECT; + TEndTagEvent = PROCEDURE (Sender : TObject; TagName : STRING) OF OBJECT; + TContentEvent = PROCEDURE (Sender : TObject; Content : STRING) OF OBJECT; + TElementEvent = PROCEDURE (Sender : TObject; ElemDef : TElemDef) OF OBJECT; + TEntityEvent = PROCEDURE (Sender : TObject; EntityDef : TEntityDef) OF OBJECT; + TNotationEvent = PROCEDURE (Sender : TObject; NotationDef : TNotationDef) OF OBJECT; + TErrorEvent = PROCEDURE (Sender : TObject; ErrorPos : PChar) OF OBJECT; + TExternalEvent = PROCEDURE (Sender : TObject; SystemId, PublicId, NotationId : STRING; + VAR Result : TXmlParser) OF OBJECT; + TEncodingEvent = FUNCTION (Sender : TObject; CurrentEncoding, Source : STRING) : STRING OF OBJECT; + + + TCustomXmlScanner = CLASS (TComponent) + PROTECTED + FXmlParser : TXmlParser; + FOnXmlProlog : TXmlPrologEvent; + FOnComment : TCommentEvent; + FOnPI : TPIEvent; + FOnDtdRead : TDtdEvent; + FOnStartTag : TStartTagEvent; + FOnEmptyTag : TStartTagEvent; + FOnEndTag : TEndTagEvent; + FOnContent : TContentEvent; + FOnCData : TContentEvent; + FOnElement : TElementEvent; + FOnAttList : TElementEvent; + FOnEntity : TEntityEvent; + FOnNotation : TNotationEvent; + FOnDtdError : TErrorEvent; + FOnLoadExternal : TExternalEvent; + FOnTranslateEncoding : TEncodingEvent; + FStopParser : BOOLEAN; + FUNCTION GetNormalize : BOOLEAN; + PROCEDURE SetNormalize (Value : BOOLEAN); + + PROCEDURE WhenXmlProlog(XmlVersion, Encoding: STRING; Standalone : BOOLEAN); VIRTUAL; + PROCEDURE WhenComment (Comment : STRING); VIRTUAL; + PROCEDURE WhenPI (Target, Content: STRING; Attributes : TAttrList); VIRTUAL; + PROCEDURE WhenDtdRead (RootElementName : STRING); VIRTUAL; + PROCEDURE WhenStartTag (TagName : STRING; Attributes : TAttrList); VIRTUAL; + PROCEDURE WhenEmptyTag (TagName : STRING; Attributes : TAttrList); VIRTUAL; + PROCEDURE WhenEndTag (TagName : STRING); VIRTUAL; + PROCEDURE WhenContent (Content : STRING); VIRTUAL; + PROCEDURE WhenCData (Content : STRING); VIRTUAL; + PROCEDURE WhenElement (ElemDef : TElemDef); VIRTUAL; + PROCEDURE WhenAttList (ElemDef : TElemDef); VIRTUAL; + PROCEDURE WhenEntity (EntityDef : TEntityDef); VIRTUAL; + PROCEDURE WhenNotation (NotationDef : TNotationDef); VIRTUAL; + PROCEDURE WhenDtdError (ErrorPos : PChar); VIRTUAL; + + PUBLIC + CONSTRUCTOR Create (AOwner: TComponent); OVERRIDE; + DESTRUCTOR Destroy; OVERRIDE; + + PROCEDURE LoadFromFile (Filename : TFilename); // Load XML Document from file + PROCEDURE LoadFromBuffer (Buffer : PChar); // Load XML Document from buffer + PROCEDURE SetBuffer (Buffer : PChar); // Refer to Buffer + FUNCTION GetFilename : TFilename; + + PROCEDURE Execute; // Perform scanning + + PROTECTED + PROPERTY XmlParser : TXmlParser READ FXmlParser; + PROPERTY StopParser : BOOLEAN READ FStopParser WRITE FStopParser; + PROPERTY Filename : TFilename READ GetFilename WRITE LoadFromFile; + PROPERTY Normalize : BOOLEAN READ GetNormalize WRITE SetNormalize; + PROPERTY OnXmlProlog : TXmlPrologEvent READ FOnXmlProlog WRITE FOnXmlProlog; + PROPERTY OnComment : TCommentEvent READ FOnComment WRITE FOnComment; + PROPERTY OnPI : TPIEvent READ FOnPI WRITE FOnPI; + PROPERTY OnDtdRead : TDtdEvent READ FOnDtdRead WRITE FOnDtdRead; + PROPERTY OnStartTag : TStartTagEvent READ FOnStartTag WRITE FOnStartTag; + PROPERTY OnEmptyTag : TStartTagEvent READ FOnEmptyTag WRITE FOnEmptyTag; + PROPERTY OnEndTag : TEndTagEvent READ FOnEndTag WRITE FOnEndTag; + PROPERTY OnContent : TContentEvent READ FOnContent WRITE FOnContent; + PROPERTY OnCData : TContentEvent READ FOnCData WRITE FOnCData; + PROPERTY OnElement : TElementEvent READ FOnElement WRITE FOnElement; + PROPERTY OnAttList : TElementEvent READ FOnAttList WRITE FOnAttList; + PROPERTY OnEntity : TEntityEvent READ FOnEntity WRITE FOnEntity; + PROPERTY OnNotation : TNotationEvent READ FOnNotation WRITE FOnNotation; + PROPERTY OnDtdError : TErrorEvent READ FOnDtdError WRITE FOnDtdError; + PROPERTY OnLoadExternal : TExternalEvent READ FOnLoadExternal WRITE FOnLoadExternal; + PROPERTY OnTranslateEncoding : TEncodingEvent READ FOnTranslateEncoding WRITE FOnTranslateEncoding; + END; + +(* +=============================================================================================== +IMPLEMENTATION +=============================================================================================== +*) + +IMPLEMENTATION + + +(* +=============================================================================================== +Unicode and UTF-8 stuff +=============================================================================================== +*) + +CONST + // --- Character Translation Table for Unicode <-> Win-1252 + WIN1252_UNICODE : ARRAY [$00..$FF] OF WORD = ( + $0000, $0001, $0002, $0003, $0004, $0005, $0006, $0007, $0008, $0009, + $000A, $000B, $000C, $000D, $000E, $000F, $0010, $0011, $0012, $0013, + $0014, $0015, $0016, $0017, $0018, $0019, $001A, $001B, $001C, $001D, + $001E, $001F, $0020, $0021, $0022, $0023, $0024, $0025, $0026, $0027, + $0028, $0029, $002A, $002B, $002C, $002D, $002E, $002F, $0030, $0031, + $0032, $0033, $0034, $0035, $0036, $0037, $0038, $0039, $003A, $003B, + $003C, $003D, $003E, $003F, $0040, $0041, $0042, $0043, $0044, $0045, + $0046, $0047, $0048, $0049, $004A, $004B, $004C, $004D, $004E, $004F, + $0050, $0051, $0052, $0053, $0054, $0055, $0056, $0057, $0058, $0059, + $005A, $005B, $005C, $005D, $005E, $005F, $0060, $0061, $0062, $0063, + $0064, $0065, $0066, $0067, $0068, $0069, $006A, $006B, $006C, $006D, + $006E, $006F, $0070, $0071, $0072, $0073, $0074, $0075, $0076, $0077, + $0078, $0079, $007A, $007B, $007C, $007D, $007E, $007F, + + $20AC, $0081, $201A, $0192, $201E, $2026, $2020, $2021, $02C6, $2030, + $0160, $2039, $0152, $008D, $017D, $008F, $0090, $2018, $2019, $201C, + $201D, $2022, $2013, $2014, $02DC, $2122, $0161, $203A, $0153, $009D, + $017E, $0178, $00A0, $00A1, $00A2, $00A3, $00A4, $00A5, $00A6, $00A7, + $00A8, $00A9, $00AA, $00AB, $00AC, $00AD, $00AE, $00AF, $00B0, $00B1, + $00B2, $00B3, $00B4, $00B5, $00B6, $00B7, $00B8, $00B9, $00BA, $00BB, + $00BC, $00BD, $00BE, $00BF, $00C0, $00C1, $00C2, $00C3, $00C4, $00C5, + $00C6, $00C7, $00C8, $00C9, $00CA, $00CB, $00CC, $00CD, $00CE, $00CF, + $00D0, $00D1, $00D2, $00D3, $00D4, $00D5, $00D6, $00D7, $00D8, $00D9, + $00DA, $00DB, $00DC, $00DD, $00DE, $00DF, $00E0, $00E1, $00E2, $00E3, + $00E4, $00E5, $00E6, $00E7, $00E8, $00E9, $00EA, $00EB, $00EC, $00ED, + $00EE, $00EF, $00F0, $00F1, $00F2, $00F3, $00F4, $00F5, $00F6, $00F7, + $00F8, $00F9, $00FA, $00FB, $00FC, $00FD, $00FE, $00FF); + +(* UTF-8 (somewhat simplified) + ----- + Character Range Byte sequence + --------------- -------------------------- (x=Bits from original character) + $0000..$007F 0xxxxxxx + $0080..$07FF 110xxxxx 10xxxxxx + $8000..$FFFF 1110xxxx 10xxxxxx 10xxxxxx + + Example + -------- + Transforming the Unicode character U+00E4 LATIN SMALL LETTER A WITH DIAERESIS ("ä"): + + ISO-8859-1, Decimal 228 + Win1252, Hex $E4 + ANSI Bin 1110 0100 + abcd efgh + + UTF-8 Binary 1100xxab 10cdefgh + Binary 11000011 10100100 + Hex $C3 $A4 + Decimal 195 164 + ANSI Ã ¤ *) + + +FUNCTION AnsiToUtf8 (Source : ANSISTRING) : STRING; + (* Converts the given Windows ANSI (Win1252) String to UTF-8. *) +VAR + I : INTEGER; // Loop counter + U : WORD; // Current Unicode value + Len : INTEGER; // Current real length of "Result" string +BEGIN + SetLength (Result, Length (Source) * 3); // Worst case + Len := 0; + FOR I := 1 TO Length (Source) DO BEGIN + U := WIN1252_UNICODE [ORD (Source [I])]; + CASE U OF + $0000..$007F : BEGIN + INC (Len); + Result [Len] := CHR (U); + END; + $0080..$07FF : BEGIN + INC (Len); + Result [Len] := CHR ($C0 OR (U SHR 6)); + INC (Len); + Result [Len] := CHR ($80 OR (U AND $3F)); + END; + $0800..$FFFF : BEGIN + INC (Len); + Result [Len] := CHR ($E0 OR (U SHR 12)); + INC (Len); + Result [Len] := CHR ($80 OR ((U SHR 6) AND $3F)); + INC (Len); + Result [Len] := CHR ($80 OR (U AND $3F)); + END; + END; + END; + SetLength (Result, Len); +END; + + +FUNCTION Utf8ToAnsi (Source : STRING; UnknownChar : CHAR = '¿') : ANSISTRING; + (* Converts the given UTF-8 String to Windows ANSI (Win-1252). + If a character can not be converted, the "UnknownChar" is inserted. *) +VAR + SourceLen : INTEGER; // Length of Source string + I, K : INTEGER; + A : BYTE; // Current ANSI character value + U : WORD; + Ch : CHAR; // Dest char + Len : INTEGER; // Current real length of "Result" string +BEGIN + SourceLen := Length (Source); + SetLength (Result, SourceLen); // Enough room to live + Len := 0; + I := 1; + WHILE I <= SourceLen DO BEGIN + A := ORD (Source [I]); + IF A < $80 THEN BEGIN // Range $0000..$007F + INC (Len); + Result [Len] := Source [I]; + INC (I); + END + ELSE BEGIN // Determine U, Inc I + IF (A AND $E0 = $C0) AND (I < SourceLen) THEN BEGIN // Range $0080..$07FF + U := (WORD (A AND $1F) SHL 6) OR (ORD (Source [I+1]) AND $3F); + INC (I, 2); + END + ELSE IF (A AND $F0 = $E0) AND (I < SourceLen-1) THEN BEGIN // Range $0800..$FFFF + U := (WORD (A AND $0F) SHL 12) OR + (WORD (ORD (Source [I+1]) AND $3F) SHL 6) OR + ( ORD (Source [I+2]) AND $3F); + INC (I, 3); + END + ELSE BEGIN // Unknown/unsupported + INC (I); + FOR K := 7 DOWNTO 0 DO + IF A AND (1 SHL K) = 0 THEN BEGIN + INC (I, (A SHR (K+1))-1); + BREAK; + END; + U := WIN1252_UNICODE [ORD (UnknownChar)]; + END; + Ch := UnknownChar; // Retrieve ANSI char + FOR A := $00 TO $FF DO + IF WIN1252_UNICODE [A] = U THEN BEGIN + Ch := CHR (A); + BREAK; + END; + INC (Len); + Result [Len] := Ch; + END; + END; + SetLength (Result, Len); +END; + + +(* +=============================================================================================== +"Special" Helper Functions + +Don't ask me why. But including these functions makes the parser *DRAMATICALLY* faster +on my K6-233 machine. You can test it yourself just by commenting them out. +They do exactly the same as the Assembler routines defined in SysUtils. +(This is where you can see how great the Delphi compiler really is. The compiled code is +faster than hand-coded assembler!) +=============================================================================================== +--> Just move this line below the StrScan function --> *) + + +FUNCTION StrPos (CONST Str, SearchStr : PChar) : PChar; + // Same functionality as SysUtils.StrPos +VAR + First : CHAR; + Len : INTEGER; +BEGIN + First := SearchStr^; + Len := StrLen (SearchStr); + Result := Str; + REPEAT + IF Result^ = First THEN + IF StrLComp (Result, SearchStr, Len) = 0 THEN BREAK; + IF Result^ = #0 THEN BEGIN + Result := NIL; + BREAK; + END; + INC (Result); + UNTIL FALSE; +END; + + +FUNCTION StrScan (CONST Start : PChar; CONST Ch : CHAR) : PChar; + // Same functionality as SysUtils.StrScan +BEGIN + Result := Start; + WHILE Result^ <> Ch DO BEGIN + IF Result^ = #0 THEN BEGIN + Result := NIL; + EXIT; + END; + INC (Result); + END; +END; + + +(* +=============================================================================================== +Helper Functions +=============================================================================================== +*) + +FUNCTION DelChars (Source : STRING; CharsToDelete : TCharset) : STRING; + // Delete all "CharsToDelete" from the string +VAR + I : INTEGER; +BEGIN + Result := Source; + FOR I := Length (Result) DOWNTO 1 DO + IF Result [I] IN CharsToDelete THEN + Delete (Result, I, 1); +END; + + +FUNCTION TrimWs (Source : STRING) : STRING; + // Trimms off Whitespace characters from both ends of the string +VAR + I : INTEGER; +BEGIN + // --- Trim Left + I := 1; + WHILE (I <= Length (Source)) AND (Source [I] IN CWhitespace) DO + INC (I); + Result := Copy (Source, I, MaxInt); + + // --- Trim Right + I := Length (Result); + WHILE (I > 1) AND (Result [I] IN CWhitespace) DO + DEC (I); + Delete (Result, I+1, Length (Result)-I); +END; + + +FUNCTION ConvertWs (Source: STRING; PackWs: BOOLEAN) : STRING; + // Converts all Whitespace characters to the Space #x20 character + // If "PackWs" is true, contiguous Whitespace characters are packed to one +VAR + I : INTEGER; +BEGIN + Result := Source; + FOR I := Length (Result) DOWNTO 1 DO + IF (Result [I] IN CWhitespace) THEN + IF PackWs AND (I > 1) AND (Result [I-1] IN CWhitespace) + THEN Delete (Result, I, 1) + ELSE Result [I] := #32; +END; + + +PROCEDURE SetStringSF (VAR S : STRING; BufferStart, BufferFinal : PChar); +BEGIN + SetString (S, BufferStart, BufferFinal-BufferStart+1); +END; + + +FUNCTION StrLPas (Start : PChar; Len : INTEGER) : STRING; +BEGIN + SetString (Result, Start, Len); +END; + + +FUNCTION StrSFPas (Start, Finish : PChar) : STRING; +BEGIN + SetString (Result, Start, Finish-Start+1); +END; + + +FUNCTION StrScanE (CONST Source : PChar; CONST CharToScanFor : CHAR) : PChar; + // If "CharToScanFor" is not found, StrScanE returns the last char of the + // buffer instead of NIL +BEGIN + Result := StrScan (Source, CharToScanFor); + IF Result = NIL THEN + Result := StrEnd (Source)-1; +END; + + +PROCEDURE ExtractName (Start : PChar; Terminators : TCharset; VAR Final : PChar); + (* Extracts the complete Name beginning at "Start". + It is assumed that the name is contained in Markup, so the '>' character is + always a Termination. + Start: IN Pointer to first char of name. Is always considered to be valid + Terminators: IN Characters which terminate the name + Final: OUT Pointer to last char of name *) +BEGIN + Final := Start+1; + Include (Terminators, #0); + Include (Terminators, '>'); + WHILE NOT (Final^ IN Terminators) DO + INC (Final); + DEC (Final); +END; + + +PROCEDURE ExtractQuote (Start : PChar; VAR Content : STRING; VAR Final : PChar); + (* Extract a string which is contained in single or double Quotes. + Start: IN Pointer to opening quote + Content: OUT The quoted string + Final: OUT Pointer to closing quote *) +BEGIN + Final := StrScan (Start+1, Start^); + IF Final = NIL THEN BEGIN + Final := StrEnd (Start+1)-1; + SetString (Content, Start+1, Final-Start); + END + ELSE + SetString (Content, Start+1, Final-1-Start); +END; + + +(* +=============================================================================================== +TEntityStackNode +This Node is pushed to the "Entity Stack" whenever the parser parses entity replacement text. +The "Instance" field holds the Instance pointer of an External Entity buffer. When it is +popped, the Instance is freed. +The "Encoding" field holds the name of the Encoding. External Parsed Entities may have +another encoding as the document entity (XmlSpec 4.3.3). So when there is an " 0 THEN BEGIN + ESN := TEntityStackNode (Items [Count-1]); + Result := ESN.LastPos; + IF ESN.Instance <> NIL THEN + ESN.Instance.Free; + IF ESN.Encoding <> '' THEN + Owner.FCurEncoding := ESN.Encoding; // Restore current Encoding + Delete (Count-1); + END + ELSE + Result := NIL; +END; + + +(* +=============================================================================================== +TExternalID +----------- +XmlSpec 4.2.2: ExternalID ::= 'SYSTEM' S SystemLiteral | + 'PUBLIC' S PubidLiteral S SystemLiteral +XmlSpec 4.7: PublicID ::= 'PUBLIC' S PubidLiteral +SystemLiteral and PubidLiteral are quoted +=============================================================================================== +*) + +TYPE + TExternalID = CLASS + PublicId : STRING; + SystemId : STRING; + Final : PChar; + CONSTRUCTOR Create (Start : PChar); + END; + +CONSTRUCTOR TExternalID.Create (Start : PChar); +BEGIN + INHERITED Create; + Final := Start; + IF StrLComp (Start, 'SYSTEM', 6) = 0 THEN BEGIN + WHILE NOT (Final^ IN (CQuoteChar + [#0, '>', '['])) DO INC (Final); + IF NOT (Final^ IN CQuoteChar) THEN EXIT; + ExtractQuote (Final, SystemID, Final); + END + ELSE IF StrLComp (Start, 'PUBLIC', 6) = 0 THEN BEGIN + WHILE NOT (Final^ IN (CQuoteChar + [#0, '>', '['])) DO INC (Final); + IF NOT (Final^ IN CQuoteChar) THEN EXIT; + ExtractQuote (Final, PublicID, Final); + INC (Final); + WHILE NOT (Final^ IN (CQuoteChar + [#0, '>', '['])) DO INC (Final); + IF NOT (Final^ IN CQuoteChar) THEN EXIT; + ExtractQuote (Final, SystemID, Final); + END; +END; + + +(* +=============================================================================================== +TXmlParser +=============================================================================================== +*) + +CONSTRUCTOR TXmlParser.Create; +BEGIN + INHERITED Create; + FBuffer := NIL; + FBufferSize := 0; + Elements := TElemList.Create; + Entities := TNvpList.Create; + ParEntities := TNvpList.Create; + Notations := TNvpList.Create; + CurAttr := TAttrList.Create; + EntityStack := TEntityStack.Create (Self); + Clear; +END; + + +DESTRUCTOR TXmlParser.Destroy; +BEGIN + Clear; + Elements.Free; + Entities.Free; + ParEntities.Free; + Notations.Free; + CurAttr.Free; + EntityStack.Free; + INHERITED Destroy; +END; + + +PROCEDURE TXmlParser.Clear; + // Free Buffer and clear all object attributes +BEGIN + IF (FBufferSize > 0) AND (FBuffer <> NIL) THEN + FreeMem (FBuffer); + FBuffer := NIL; + FBufferSize := 0; + FSource := ''; + FXmlVersion := ''; + FEncoding := ''; + FStandalone := FALSE; + FRootName := ''; + FDtdcFinal := NIL; + FNormalize := TRUE; + Elements.Clear; + Entities.Clear; + ParEntities.Clear; + Notations.Clear; + CurAttr.Clear; + EntityStack.Clear; +END; + + +FUNCTION TXmlParser.LoadFromFile (Filename : STRING; FileMode : INTEGER = fmOpenRead OR fmShareDenyNone) : BOOLEAN; + // Loads Document from given file + // Returns TRUE if successful +VAR + f : FILE; + ReadIn : INTEGER; + OldFileMode : INTEGER; +BEGIN + Result := FALSE; + Clear; + + // --- Open File + OldFileMode := SYSTEM.FileMode; + TRY + SYSTEM.FileMode := FileMode; + TRY + AssignFile (f, Filename); + Reset (f, 1); + EXCEPT + EXIT; + END; + + TRY + // --- Allocate Memory + TRY + FBufferSize := Filesize (f) + 1; + GetMem (FBuffer, FBufferSize); + EXCEPT + Clear; + EXIT; + END; + + // --- Read File + TRY + BlockRead (f, FBuffer^, FBufferSize, ReadIn); + (FBuffer+ReadIn)^ := #0; // NULL termination + EXCEPT + Clear; + EXIT; + END; + FINALLY + CloseFile (f); + END; + + FSource := Filename; + Result := TRUE; + + FINALLY + SYSTEM.FileMode := OldFileMode; + END; +END; + + +FUNCTION TXmlParser.LoadFromBuffer (Buffer : PChar) : BOOLEAN; + // Loads Document from another buffer + // Returns TRUE if successful + // The "Source" property becomes '' if successful +BEGIN + Result := FALSE; + Clear; + FBufferSize := StrLen (Buffer) + 1; + TRY + GetMem (FBuffer, FBufferSize); + EXCEPT + Clear; + EXIT; + END; + StrCopy (FBuffer, Buffer); + FSource := ''; + Result := TRUE; +END; + + +PROCEDURE TXmlParser.SetBuffer (Buffer : PChar); // References another buffer +BEGIN + Clear; + FBuffer := Buffer; + FBufferSize := 0; + FSource := ''; +END; + + +//----------------------------------------------------------------------------------------------- +// Scanning through the document +//----------------------------------------------------------------------------------------------- + +PROCEDURE TXmlParser.StartScan; +BEGIN + CurPartType := ptNone; + CurName := ''; + CurContent := ''; + CurStart := NIL; + CurFinal := NIL; + CurAttr.Clear; + EntityStack.Clear; +END; + + +FUNCTION TXmlParser.Scan : BOOLEAN; + // Scans the next Part + // Returns TRUE if a part could be found, FALSE if there is no part any more + // + // "IsDone" can be set to FALSE by AnalyzeText in order to go to the next part + // if there is no Content due to normalization +VAR + IsDone : BOOLEAN; +BEGIN + REPEAT + IsDone := TRUE; + + // --- Start of next Part + IF CurStart = NIL + THEN CurStart := DocBuffer + ELSE CurStart := CurFinal+1; + CurFinal := CurStart; + + // --- End of Document of Pop off a new part from the Entity stack? + IF CurStart^ = #0 THEN + CurStart := EntityStack.Pop; + + // --- No Document or End Of Document: Terminate Scan + IF (CurStart = NIL) OR (CurStart^ = #0) THEN BEGIN + CurStart := StrEnd (DocBuffer); + CurFinal := CurStart-1; + EntityStack.Clear; + Result := FALSE; + EXIT; + END; + + IF (StrLComp (CurStart, ''); + IF CurFinal <> NIL + THEN INC (CurFinal) + ELSE CurFinal := StrEnd (CurStart)-1; + FCurEncoding := AnsiUpperCase (CurAttr.Value ('encoding')); + IF FCurEncoding = '' THEN + FCurEncoding := 'UTF-8'; // Default XML Encoding is UTF-8 + CurPartType := ptXmlProlog; + CurName := ''; + CurContent := ''; +END; + + +PROCEDURE TXmlParser.AnalyzeComment (Start : PChar; VAR Final : PChar); + // Analyze Comments +BEGIN + Final := StrPos (Start+4, '-->'); + IF Final = NIL + THEN Final := StrEnd (Start)-1 + ELSE INC (Final, 2); + CurPartType := ptComment; +END; + + +PROCEDURE TXmlParser.AnalyzePI (Start : PChar; VAR Final : PChar); + // Analyze Processing Instructions (PI) + // This is also called for Character +VAR + F : PChar; +BEGIN + CurPartType := ptPI; + Final := StrPos (Start+2, '?>'); + IF Final = NIL + THEN Final := StrEnd (Start)-1 + ELSE INC (Final); + ExtractName (Start+2, CWhitespace + ['?', '>'], F); + SetStringSF (CurName, Start+2, F); + SetStringSF (CurContent, F+1, Final-2); + CurAttr.Analyze (F+1, F); +END; + + +PROCEDURE TXmlParser.AnalyzeDtdc; + (* Analyze Document Type Declaration + doctypedecl ::= '' + markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI | Comment + PEReference ::= '%' Name ';' + + elementdecl ::= '' + AttlistDecl ::= '' + EntityDecl ::= '' | + '' + NotationDecl ::= '' + PI ::= '' Char* )))? '?>' + Comment ::= '' *) +TYPE + TPhase = (phName, phDtd, phInternal, phFinishing); +VAR + Phase : TPhase; + F : PChar; + ExternalID : TExternalID; + ExternalDTD : TXmlParser; + DER : TDtdElementRec; +BEGIN + DER.Start := CurStart; + EntityStack.Clear; // Clear stack for Parameter Entities + CurPartType := ptDtdc; + + // --- Don't read DTDc twice + IF FDtdcFinal <> NIL THEN BEGIN + CurFinal := FDtdcFinal; + EXIT; + END; + + // --- Scan DTDc + CurFinal := CurStart + 9; // First char after '' : BREAK; + ELSE IF NOT (CurFinal^ IN CWhitespace) THEN BEGIN + CASE Phase OF + phName : IF (CurFinal^ IN CNameStart) THEN BEGIN + ExtractName (CurFinal, CWhitespace + ['[', '>'], F); + SetStringSF (FRootName, CurFinal, F); + CurFinal := F; + Phase := phDtd; + END; + phDtd : IF (StrLComp (CurFinal, 'SYSTEM', 6) = 0) OR + (StrLComp (CurFinal, 'PUBLIC', 6) = 0) THEN BEGIN + ExternalID := TExternalID.Create (CurFinal); + ExternalDTD := LoadExternalEntity (ExternalId.SystemId, ExternalID.PublicId, ''); + F := StrPos (ExternalDtd.DocBuffer, ' NIL THEN + AnalyzeDtdElements (F, F); + ExternalDTD.Free; + CurFinal := ExternalID.Final; + ExternalID.Free; + END; + ELSE BEGIN + DER.ElementType := deError; + DER.Pos := CurFinal; + DER.Final := CurFinal; + DtdElementFound (DER); + END; + END; + + END; + END; + INC (CurFinal); + UNTIL FALSE; + + CurPartType := ptDtdc; + CurName := ''; + CurContent := ''; + + // It is an error in the document if "EntityStack" is not empty now + IF EntityStack.Count > 0 THEN BEGIN + DER.ElementType := deError; + DER.Final := CurFinal; + DER.Pos := CurFinal; + DtdElementFound (DER); + END; + + EntityStack.Clear; // Clear stack for General Entities + FDtdcFinal := CurFinal; +END; + + +PROCEDURE TXmlParser.AnalyzeDtdElements (Start : PChar; VAR Final : PChar); + // Analyze the "Elements" of a DTD contained in the external or + // internal DTD subset. +VAR + DER : TDtdElementRec; +BEGIN + Final := Start; + REPEAT + CASE Final^ OF + '%' : BEGIN + PushPE (Final); + CONTINUE; + END; + #0 : IF EntityStack.Count = 0 THEN + BREAK + ELSE BEGIN + CurFinal := EntityStack.Pop; + CONTINUE; + END; + ']', + '>' : BREAK; + '<' : IF StrLComp (Final, ''); + + // --- Set Default Attribute values for nonexistent attributes + IF (CurPartType = ptStartTag) OR (CurPartType = ptEmptyTag) THEN BEGIN + ElemDef := Elements.Node (CurName); + IF ElemDef <> NIL THEN BEGIN + FOR I := 0 TO ElemDef.Count-1 DO BEGIN + AttrDef := TAttrDef (ElemDef [I]); + Attr := TAttr (CurAttr.Node (AttrDef.Name)); + IF (Attr = NIL) AND (AttrDef.Value <> '') THEN BEGIN + Attr := TAttr.Create (AttrDef.Name, AttrDef.Value); + Attr.ValueType := vtDefault; + CurAttr.Add (Attr); + END; + IF Attr <> NIL THEN BEGIN + CASE AttrDef.DefaultType OF + adDefault : ; + adRequired : ; // -!- It is an error in the document if "Attr.Value" is an empty string + adImplied : Attr.ValueType := vtImplied; + adFixed : BEGIN + Attr.ValueType := vtFixed; + Attr.Value := AttrDef.Value; + END; + END; + Attr.AttrType := AttrDef.AttrType; + END; + END; + END; + + // --- Normalize Attribute Values. XmlSpec: + // - a character reference is processed by appending the referenced character to the attribute value + // - an entity reference is processed by recursively processing the replacement text of the entity + // - a whitespace character (#x20, #xD, #xA, #x9) is processed by appending #x20 to the normalized value, + // except that only a single #x20 is appended for a "#xD#xA" sequence that is part of an external + // parsed entity or the literal entity value of an internal parsed entity + // - other characters are processed by appending them to the normalized value + // If the declared value is not CDATA, then the XML processor must further process the + // normalized attribute value by discarding any leading and trailing space (#x20) characters, + // and by replacing sequences of space (#x20) characters by a single space (#x20) character. + // All attributes for which no declaration has been read should be treated by a + // non-validating parser as if declared CDATA. + // !!! The XML 1.0 SE specification is somewhat different here + // This code does not conform exactly to this specification + FOR I := 0 TO CurAttr.Count-1 DO + WITH TAttr (CurAttr [I]) DO BEGIN + ReplaceGeneralEntities (Value); + ReplaceCharacterEntities (Value); + IF (AttrType <> atCData) AND (AttrType <> atUnknown) + THEN Value := TranslateEncoding (TrimWs (ConvertWs (Value, TRUE))) + ELSE Value := TranslateEncoding (ConvertWs (Value, FALSE)); + END; + END; +END; + + +PROCEDURE TXmlParser.AnalyzeCData; + // Analyze CDATA Sections +BEGIN + CurPartType := ptCData; + CurFinal := StrPos (CurStart, CDEnd); + IF CurFinal = NIL THEN BEGIN + CurFinal := StrEnd (CurStart)-1; + CurContent := TranslateEncoding (StrPas (CurStart+Length (CDStart))); + END + ELSE BEGIN + SetStringSF (CurContent, CurStart+Length (CDStart), CurFinal-1); + INC (CurFinal, Length (CDEnd)-1); + CurContent := TranslateEncoding (CurContent); + END; +END; + + +PROCEDURE TXmlParser.AnalyzeText (VAR IsDone : BOOLEAN); + (* Analyzes Text Content between Tags. CurFinal will point to the last content character. + Content ends at a '<' character or at the end of the document. + Entity References and Character Entity references are resolved. + If PackSpaces is TRUE, contiguous Whitespace Characters will be compressed to + one Space #x20 character, Whitespace at the beginning and end of content will + be trimmed off and content which is or becomes empty is not returned to + the application (in this case, "IsDone" is set to FALSE which causes the + Scan method to proceed directly to the next part. *) + + PROCEDURE ProcessEntity; + (* Is called if there is an ampsersand '&' character found in the document. + IN "CurFinal" points to the ampersand + OUT "CurFinal" points to the first character after the semi-colon ';' *) + VAR + P : PChar; + Name : STRING; + EntityDef : TEntityDef; + ExternalEntity : TXmlParser; + BEGIN + P := StrScan (CurFinal , ';'); + IF P <> NIL THEN BEGIN + SetStringSF (Name, CurFinal+1, P-1); + + // Is it a Character Entity? + IF (CurFinal+1)^ = '#' THEN BEGIN + IF UpCase ((CurFinal+2)^) = 'X' // !!! Can't use "CHR" for Unicode characters > 255: + THEN CurContent := CurContent + CHR (StrToIntDef ('$'+Copy (Name, 3, MaxInt), 32)) + ELSE CurContent := CurContent + CHR (StrToIntDef (Copy (Name, 2, MaxInt), 32)); + CurFinal := P+1; + EXIT; + END + + // Is it a Predefined Entity? + ELSE IF Name = 'lt' THEN BEGIN CurContent := CurContent + '<'; CurFinal := P+1; EXIT; END + ELSE IF Name = 'gt' THEN BEGIN CurContent := CurContent + '>'; CurFinal := P+1; EXIT; END + ELSE IF Name = 'amp' THEN BEGIN CurContent := CurContent + '&'; CurFinal := P+1; EXIT; END + ELSE IF Name = 'apos' THEN BEGIN CurContent := CurContent + ''''; CurFinal := P+1; EXIT; END + ELSE IF Name = 'quot' THEN BEGIN CurContent := CurContent + '"'; CurFinal := P+1; EXIT; END; + + // Replace with Entity from DTD + EntityDef := TEntityDef (Entities.Node (Name)); + IF EntityDef <> NIL THEN BEGIN + IF EntityDef.Value <> '' THEN BEGIN + EntityStack.Push (P+1); + CurFinal := PChar (EntityDef.Value); + END + ELSE BEGIN + ExternalEntity := LoadExternalEntity (EntityDef.SystemId, EntityDef.PublicId, EntityDef.NotationName); + EntityStack.Push (ExternalEntity, P+1); + CurFinal := ExternalEntity.DocBuffer; + END; + END + ELSE BEGIN + CurContent := CurContent + Name; + CurFinal := P+1; + END; + END + ELSE BEGIN + INC (CurFinal); + END; + END; + +VAR + C : INTEGER; +BEGIN + CurFinal := CurStart; + CurPartType := ptContent; + CurContent := ''; + C := 0; + REPEAT + CASE CurFinal^ OF + '&' : BEGIN + CurContent := CurContent + TranslateEncoding (StrLPas (CurFinal-C, C)); + C := 0; + ProcessEntity; + CONTINUE; + END; + #0 : BEGIN + IF EntityStack.Count = 0 THEN + BREAK + ELSE BEGIN + CurContent := CurContent + TranslateEncoding (StrLPas (CurFinal-C, C)); + C := 0; + CurFinal := EntityStack.Pop; + CONTINUE; + END; + END; + '<' : BREAK; + ELSE INC (C); + END; + INC (CurFinal); + UNTIL FALSE; + CurContent := CurContent + TranslateEncoding (StrLPas (CurFinal-C, C)); + DEC (CurFinal); + + IF FNormalize THEN BEGIN + CurContent := ConvertWs (TrimWs (CurContent), TRUE); + IsDone := CurContent <> ''; // IsDone will only get FALSE if PackSpaces is TRUE + END; +END; + + +PROCEDURE TXmlParser.AnalyzeElementDecl (Start : PChar; VAR Final : PChar); + (* Parse ' character + XmlSpec 3.2: + elementdecl ::= '' + contentspec ::= 'EMPTY' | 'ANY' | Mixed | children + Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*' | + '(' S? '#PCDATA' S? ')' + children ::= (choice | seq) ('?' | '*' | '+')? + choice ::= '(' S? cp ( S? '|' S? cp )* S? ')' + cp ::= (Name | choice | seq) ('?' | '*' | '+')? + seq ::= '(' S? cp ( S? ',' S? cp )* S? ')' + + More simply: + contentspec ::= EMPTY + ANY + '(#PCDATA)' + '(#PCDATA | A | B)*' + '(A, B, C)' + '(A | B | C)' + '(A?, B*, C+), + '(A, (B | C | D)* )' *) +VAR + Element : TElemDef; + Elem2 : TElemDef; + F : PChar; + DER : TDtdElementRec; +BEGIN + Element := TElemDef.Create; + Final := Start + 9; + DER.Start := Start; + REPEAT + IF Final^ = '>' THEN BREAK; + IF (Final^ IN CNameStart) AND (Element.Name = '') THEN BEGIN + ExtractName (Final, CWhitespace, F); + SetStringSF (Element.Name, Final, F); + Final := F; + F := StrScan (Final+1, '>'); + IF F = NIL THEN BEGIN + Element.Definition := STRING (Final); + Final := StrEnd (Final); + BREAK; + END + ELSE BEGIN + SetStringSF (Element.Definition, Final+1, F-1); + Final := F; + BREAK; + END; + END; + INC (Final); + UNTIL FALSE; + Element.Definition := DelChars (Element.Definition, CWhitespace); + ReplaceParameterEntities (Element.Definition); + IF Element.Definition = 'EMPTY' THEN Element.ElemType := etEmpty + ELSE IF Element.Definition = 'ANY' THEN Element.ElemType := etAny + ELSE IF Copy (Element.Definition, 1, 8) = '(#PCDATA' THEN Element.ElemType := etMixed + ELSE IF Copy (Element.Definition, 1, 1) = '(' THEN Element.ElemType := etChildren + ELSE Element.ElemType := etAny; + + Elem2 := Elements.Node (Element.Name); + IF Elem2 <> NIL THEN + Elements.Delete (Elements.IndexOf (Elem2)); + Elements.Add (Element); + Final := StrScanE (Final, '>'); + DER.ElementType := deElement; + DER.ElemDef := Element; + DER.Final := Final; + DtdElementFound (DER); +END; + + +PROCEDURE TXmlParser.AnalyzeAttListDecl (Start : PChar; VAR Final : PChar); + (* Parse ' character + XmlSpec 3.3: + AttlistDecl ::= '' + AttDef ::= S Name S AttType S DefaultDecl + AttType ::= StringType | TokenizedType | EnumeratedType + StringType ::= 'CDATA' + TokenizedType ::= 'ID' | 'IDREF' | 'IDREFS' | 'ENTITY' | 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS' + EnumeratedType ::= NotationType | Enumeration + NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')' + Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')' + DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue) + AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'" + Examples: + *) +TYPE + TPhase = (phElementName, phName, phType, phNotationContent, phDefault); +VAR + Phase : TPhase; + F : PChar; + ElementName : STRING; + ElemDef : TElemDef; + AttrDef : TAttrDef; + AttrDef2 : TAttrDef; + Strg : STRING; + DER : TDtdElementRec; +BEGIN + Final := Start + 9; // The character after ' : BREAK; + ELSE CASE Phase OF + phElementName : BEGIN + ExtractName (Final, CWhitespace + CQuoteChar + ['#'], F); + SetStringSF (ElementName, Final, F); + Final := F; + ElemDef := Elements.Node (ElementName); + IF ElemDef = NIL THEN BEGIN + ElemDef := TElemDef.Create; + ElemDef.Name := ElementName; + ElemDef.Definition := 'ANY'; + ElemDef.ElemType := etAny; + Elements.Add (ElemDef); + END; + Phase := phName; + END; + phName : BEGIN + AttrDef := TAttrDef.Create; + ExtractName (Final, CWhitespace + CQuoteChar + ['#'], F); + SetStringSF (AttrDef.Name, Final, F); + Final := F; + AttrDef2 := TAttrDef (ElemDef.Node (AttrDef.Name)); + IF AttrDef2 <> NIL THEN + ElemDef.Delete (ElemDef.IndexOf (AttrDef2)); + ElemDef.Add (AttrDef); + Phase := phType; + END; + phType : BEGIN + IF Final^ = '(' THEN BEGIN + F := StrScan (Final+1, ')'); + IF F <> NIL + THEN SetStringSF (AttrDef.TypeDef, Final+1, F-1) + ELSE AttrDef.TypeDef := STRING (Final+1); + AttrDef.TypeDef := DelChars (AttrDef.TypeDef, CWhitespace); + AttrDef.AttrType := atEnumeration; + ReplaceParameterEntities (AttrDef.TypeDef); + ReplaceCharacterEntities (AttrDef.TypeDef); + Phase := phDefault; + END + ELSE IF StrLComp (Final, 'NOTATION', 8) = 0 THEN BEGIN + INC (Final, 8); + AttrDef.AttrType := atNotation; + Phase := phNotationContent; + END + ELSE BEGIN + ExtractName (Final, CWhitespace+CQuoteChar+['#'], F); + SetStringSF (AttrDef.TypeDef, Final, F); + IF AttrDef.TypeDef = 'CDATA' THEN AttrDef.AttrType := atCData + ELSE IF AttrDef.TypeDef = 'ID' THEN AttrDef.AttrType := atId + ELSE IF AttrDef.TypeDef = 'IDREF' THEN AttrDef.AttrType := atIdRef + ELSE IF AttrDef.TypeDef = 'IDREFS' THEN AttrDef.AttrType := atIdRefs + ELSE IF AttrDef.TypeDef = 'ENTITY' THEN AttrDef.AttrType := atEntity + ELSE IF AttrDef.TypeDef = 'ENTITIES' THEN AttrDef.AttrType := atEntities + ELSE IF AttrDef.TypeDef = 'NMTOKEN' THEN AttrDef.AttrType := atNmToken + ELSE IF AttrDef.TypeDef = 'NMTOKENS' THEN AttrDef.AttrType := atNmTokens; + Phase := phDefault; + END + END; + phNotationContent : BEGIN + F := StrScan (Final, ')'); + IF F <> NIL THEN + SetStringSF (AttrDef.Notations, Final+1, F-1) + ELSE BEGIN + AttrDef.Notations := STRING (Final+1); + Final := StrEnd (Final); + END; + ReplaceParameterEntities (AttrDef.Notations); + AttrDef.Notations := DelChars (AttrDef.Notations, CWhitespace); + Phase := phDefault; + END; + phDefault : BEGIN + IF Final^ = '#' THEN BEGIN + ExtractName (Final, CWhiteSpace + CQuoteChar, F); + SetStringSF (Strg, Final, F); + Final := F; + ReplaceParameterEntities (Strg); + IF Strg = '#REQUIRED' THEN BEGIN AttrDef.DefaultType := adRequired; Phase := phName; END + ELSE IF Strg = '#IMPLIED' THEN BEGIN AttrDef.DefaultType := adImplied; Phase := phName; END + ELSE IF Strg = '#FIXED' THEN AttrDef.DefaultType := adFixed; + END + ELSE IF (Final^ IN CQuoteChar) THEN BEGIN + ExtractQuote (Final, AttrDef.Value, Final); + ReplaceParameterEntities (AttrDef.Value); + ReplaceCharacterEntities (AttrDef.Value); + Phase := phName; + END; + IF Phase = phName THEN BEGIN + AttrDef := NIL; + END; + END; + + END; + END; + INC (Final); + UNTIL FALSE; + + Final := StrScan (Final, '>'); + + DER.ElementType := deAttList; + DER.ElemDef := ElemDef; + DER.Final := Final; + DtdElementFound (DER); +END; + + +PROCEDURE TXmlParser.AnalyzeEntityDecl (Start : PChar; VAR Final : PChar); + (* Parse ' character + XmlSpec 4.2: + EntityDecl ::= '' | + '' + EntityDef ::= EntityValue | (ExternalID NDataDecl?) + PEDef ::= EntityValue | ExternalID + NDataDecl ::= S 'NDATA' S Name + EntityValue ::= '"' ([^%&"] | PEReference | EntityRef | CharRef)* '"' | + "'" ([^%&'] | PEReference | EntityRef | CharRef)* "'" + PEReference ::= '%' Name ';' + + Examples + + + + "> + + + Dies ist ein Test-Absatz

"> + *) +TYPE + TPhase = (phName, phContent, phNData, phNotationName, phFinalGT); +VAR + Phase : TPhase; + IsParamEntity : BOOLEAN; + F : PChar; + ExternalID : TExternalID; + EntityDef : TEntityDef; + EntityDef2 : TEntityDef; + DER : TDtdElementRec; +BEGIN + Final := Start + 8; // First char after ' : BREAK; + ELSE CASE Phase OF + phName : IF Final^ IN CNameStart THEN BEGIN + ExtractName (Final, CWhitespace + CQuoteChar, F); + SetStringSF (EntityDef.Name, Final, F); + Final := F; + Phase := phContent; + END; + phContent : IF Final^ IN CQuoteChar THEN BEGIN + ExtractQuote (Final, EntityDef.Value, Final); + Phase := phFinalGT; + END + ELSE IF (StrLComp (Final, 'SYSTEM', 6) = 0) OR + (StrLComp (Final, 'PUBLIC', 6) = 0) THEN BEGIN + ExternalID := TExternalID.Create (Final); + EntityDef.SystemId := ExternalID.SystemId; + EntityDef.PublicId := ExternalID.PublicId; + Final := ExternalID.Final; + Phase := phNData; + ExternalID.Free; + END; + phNData : IF StrLComp (Final, 'NDATA', 5) = 0 THEN BEGIN + INC (Final, 4); + Phase := phNotationName; + END; + phNotationName : IF Final^ IN CNameStart THEN BEGIN + ExtractName (Final, CWhitespace + ['>'], F); + SetStringSF (EntityDef.NotationName, Final, F); + Final := F; + Phase := phFinalGT; + END; + phFinalGT : ; // -!- There is an error in the document if this branch is called + END; + END; + INC (Final); + UNTIL FALSE; + IF IsParamEntity THEN BEGIN + EntityDef2 := TEntityDef (ParEntities.Node (EntityDef.Name)); + IF EntityDef2 <> NIL THEN + ParEntities.Delete (ParEntities.IndexOf (EntityDef2)); + ParEntities.Add (EntityDef); + ReplaceCharacterEntities (EntityDef.Value); + END + ELSE BEGIN + EntityDef2 := TEntityDef (Entities.Node (EntityDef.Name)); + IF EntityDef2 <> NIL THEN + Entities.Delete (Entities.IndexOf (EntityDef2)); + Entities.Add (EntityDef); + ReplaceParameterEntities (EntityDef.Value); // Create replacement texts (see XmlSpec 4.5) + ReplaceCharacterEntities (EntityDef.Value); + END; + Final := StrScanE (Final, '>'); + + DER.ElementType := deEntity; + DER.EntityDef := EntityDef; + DER.Final := Final; + DtdElementFound (DER); +END; + + +PROCEDURE TXmlParser.AnalyzeNotationDecl (Start : PChar; VAR Final : PChar); + // Parse ' character + // XmlSpec 4.7: NotationDecl ::= '' +TYPE + TPhase = (phName, phExtId, phEnd); +VAR + ExternalID : TExternalID; + Phase : TPhase; + F : PChar; + NotationDef : TNotationDef; + DER : TDtdElementRec; +BEGIN + Final := Start + 10; // Character after ', + #0 : BREAK; + ELSE CASE Phase OF + phName : BEGIN + ExtractName (Final, CWhitespace + ['>'], F); + SetStringSF (NotationDef.Name, Final, F); + Final := F; + Phase := phExtId; + END; + phExtId : BEGIN + ExternalID := TExternalID.Create (Final); + NotationDef.Value := ExternalID.SystemId; + NotationDef.PublicId := ExternalID.PublicId; + Final := ExternalId.Final; + ExternalId.Free; + Phase := phEnd; + END; + phEnd : ; // -!- There is an error in the document if this branch is called + END; + END; + INC (Final); + UNTIL FALSE; + Notations.Add (NotationDef); + Final := StrScanE (Final, '>'); + + DER.ElementType := deNotation; + DER.NotationDef := NotationDef; + DER.Final := Final; + DtdElementFound (DER); +END; + + +PROCEDURE TXmlParser.PushPE (VAR Start : PChar); + (* If there is a parameter entity reference found in the data stream, + the current position will be pushed to the entity stack. + Start: IN Pointer to the '%' character starting the PE reference + OUT Pointer to first character of PE replacement text *) +VAR + P : PChar; + EntityDef : TEntityDef; +BEGIN + P := StrScan (Start, ';'); + IF P <> NIL THEN BEGIN + EntityDef := TEntityDef (ParEntities.Node (StrSFPas (Start+1, P-1))); + IF EntityDef <> NIL THEN BEGIN + EntityStack.Push (P+1); + Start := PChar (EntityDef.Value); + END + ELSE + Start := P+1; + END; +END; + + +PROCEDURE TXmlParser.ReplaceCharacterEntities (VAR Str : STRING); + // Replaces all Character Entity References in the String +VAR + Start : INTEGER; + PAmp : PChar; + PSemi : PChar; + PosAmp : INTEGER; + Len : INTEGER; // Length of Entity Reference +BEGIN + IF Str = '' THEN EXIT; + Start := 1; + REPEAT + PAmp := StrPos (PChar (Str) + Start-1, '&#'); + IF PAmp = NIL THEN BREAK; + PSemi := StrScan (PAmp+2, ';'); + IF PSemi = NIL THEN BREAK; + PosAmp := PAmp - PChar (Str) + 1; + Len := PSemi-PAmp+1; + IF CompareText (Str [PosAmp+2], 'x') = 0 // !!! Can't use "CHR" for Unicode characters > 255 + THEN Str [PosAmp] := CHR (StrToIntDef ('$'+Copy (Str, PosAmp+3, Len-4), 0)) + ELSE Str [PosAmp] := CHR (StrToIntDef (Copy (Str, PosAmp+2, Len-3), 32)); + Delete (Str, PosAmp+1, Len-1); + Start := PosAmp + 1; + UNTIL FALSE; +END; + + +PROCEDURE TXmlParser.ReplaceParameterEntities (VAR Str : STRING); + // Recursively replaces all Parameter Entity References in the String + PROCEDURE ReplaceEntities (VAR Str : STRING); + VAR + Start : INTEGER; + PAmp : PChar; + PSemi : PChar; + PosAmp : INTEGER; + Len : INTEGER; + Entity : TEntityDef; + Repl : STRING; // Replacement + BEGIN + IF Str = '' THEN EXIT; + Start := 1; + REPEAT + PAmp := StrPos (PChar (Str)+Start-1, '%'); + IF PAmp = NIL THEN BREAK; + PSemi := StrScan (PAmp+2, ';'); + IF PSemi = NIL THEN BREAK; + PosAmp := PAmp - PChar (Str) + 1; + Len := PSemi-PAmp+1; + Entity := TEntityDef (ParEntities.Node (Copy (Str, PosAmp+1, Len-2))); + IF Entity <> NIL THEN BEGIN + Repl := Entity.Value; + ReplaceEntities (Repl); // Recursion + END + ELSE + Repl := Copy (Str, PosAmp, Len); + Delete (Str, PosAmp, Len); + Insert (Repl, Str, PosAmp); + Start := PosAmp + Length (Repl); + UNTIL FALSE; + END; +BEGIN + ReplaceEntities (Str); +END; + + +PROCEDURE TXmlParser.ReplaceGeneralEntities (VAR Str : STRING); + // Recursively replaces General Entity References in the String + PROCEDURE ReplaceEntities (VAR Str : STRING); + VAR + Start : INTEGER; + PAmp : PChar; + PSemi : PChar; + PosAmp : INTEGER; + Len : INTEGER; + EntityDef : TEntityDef; + EntName : STRING; + Repl : STRING; // Replacement + ExternalEntity : TXmlParser; + BEGIN + IF Str = '' THEN EXIT; + Start := 1; + REPEAT + PAmp := StrPos (PChar (Str)+Start-1, '&'); + IF PAmp = NIL THEN BREAK; + PSemi := StrScan (PAmp+2, ';'); + IF PSemi = NIL THEN BREAK; + PosAmp := PAmp - PChar (Str) + 1; + Len := PSemi-PAmp+1; + EntName := Copy (Str, PosAmp+1, Len-2); + IF EntName = 'lt' THEN Repl := '<' + ELSE IF EntName = 'gt' THEN Repl := '>' + ELSE IF EntName = 'amp' THEN Repl := '&' + ELSE IF EntName = 'apos' THEN Repl := '''' + ELSE IF EntName = 'quot' THEN Repl := '"' + ELSE BEGIN + EntityDef := TEntityDef (Entities.Node (EntName)); + IF EntityDef <> NIL THEN BEGIN + IF EntityDef.Value <> '' THEN // Internal Entity + Repl := EntityDef.Value + ELSE BEGIN // External Entity + ExternalEntity := LoadExternalEntity (EntityDef.SystemId, EntityDef.PublicId, EntityDef.NotationName); + Repl := StrPas (ExternalEntity.DocBuffer); // !!! What if it contains a Text Declaration? + ExternalEntity.Free; + END; + ReplaceEntities (Repl); // Recursion + END + ELSE + Repl := Copy (Str, PosAmp, Len); + END; + Delete (Str, PosAmp, Len); + Insert (Repl, Str, PosAmp); + Start := PosAmp + Length (Repl); + UNTIL FALSE; + END; +BEGIN + ReplaceEntities (Str); +END; + + +FUNCTION TXmlParser.LoadExternalEntity (SystemId, PublicId, Notation : STRING) : TXmlParser; + // This will be called whenever there is a Parsed External Entity or + // the DTD External Subset to be parsed. + // It has to create a TXmlParser instance and load the desired Entity. + // This instance of LoadExternalEntity assumes that "SystemId" is a valid + // file name (relative to the Document source) and loads this file using + // the LoadFromFile method. +VAR + Filename : STRING; +BEGIN + // --- Convert System ID to complete filename + Filename := StringReplace (SystemId, '/', '\', [rfReplaceAll]); + IF Copy (FSource, 1, 1) <> '<' THEN + IF (Copy (Filename, 1, 2) = '\\') OR (Copy (Filename, 2, 1) = ':') THEN + // Already has an absolute Path + ELSE BEGIN + Filename := ExtractFilePath (FSource) + Filename; + END; + + // --- Load the File + Result := TXmlParser.Create; + Result.LoadFromFile (Filename); +END; + + +FUNCTION TXmlParser.TranslateEncoding (CONST Source : STRING) : STRING; + // The member variable "CurEncoding" always holds the name of the current + // encoding, e.g. 'UTF-8' or 'ISO-8859-1'. + // This virtual method "TranslateEncoding" is responsible for translating + // the content passed in the "Source" parameter to the Encoding which + // is expected by the application. + // This instance of "TranlateEncoding" assumes that the Application expects + // Windows ANSI (Win1252) strings. It is able to transform UTF-8 or ISO-8859-1 + // encodings. + // If you want your application to understand or create other encodings, you + // override this function. +BEGIN + IF CurEncoding = 'UTF-8' + THEN Result := Utf8ToAnsi (Source) + ELSE Result := Source; +END; + + +PROCEDURE TXmlParser.DtdElementFound (DtdElementRec : TDtdElementRec); + // This method is called for every element which is found in the DTD + // declaration. The variant record TDtdElementRec is passed which + // holds informations about the element. + // You can override this function to handle DTD declarations. + // Note that when you parse the same Document instance a second time, + // the DTD will not get parsed again. +BEGIN +END; + + +FUNCTION TXmlParser.GetDocBuffer: PChar; + // Returns FBuffer or a pointer to a NUL char if Buffer is empty +BEGIN + IF FBuffer = NIL + THEN Result := #0 + ELSE Result := FBuffer; +END; + + +(*$IFNDEF HAS_CONTNRS_UNIT +=============================================================================================== +TObjectList +=============================================================================================== +*) + +DESTRUCTOR TObjectList.Destroy; +BEGIN + Clear; + SetCapacity(0); + INHERITED Destroy; +END; + + +PROCEDURE TObjectList.Delete (Index : INTEGER); +BEGIN + IF (Index < 0) OR (Index >= Count) THEN EXIT; + TObject (Items [Index]).Free; + INHERITED Delete (Index); +END; + + +PROCEDURE TObjectList.Clear; +BEGIN + WHILE Count > 0 DO + Delete (Count-1); +END; + +(*$ENDIF *) + +(* +=============================================================================================== +TNvpNode +-------- +Node base class for the TNvpList +=============================================================================================== +*) + +CONSTRUCTOR TNvpNode.Create (TheName, TheValue : STRING); +BEGIN + INHERITED Create; + Name := TheName; + Value := TheValue; +END; + + +(* +=============================================================================================== +TNvpList +-------- +A generic List of Name-Value Pairs, based on the TObjectList introduced in Delphi 5 +=============================================================================================== +*) + +PROCEDURE TNvpList.Add (Node : TNvpNode); +VAR + I : INTEGER; +BEGIN + FOR I := Count-1 DOWNTO 0 DO + IF Node.Name > TNvpNode (Items [I]).Name THEN BEGIN + Insert (I+1, Node); + EXIT; + END; + Insert (0, Node); +END; + + + +FUNCTION TNvpList.Node (Name : STRING) : TNvpNode; + // Binary search for Node +VAR + L, H : INTEGER; // Low, High Limit + T, C : INTEGER; // Test Index, Comparison result + Last : INTEGER; // Last Test Index +BEGIN + IF Count=0 THEN BEGIN + Result := NIL; + EXIT; + END; + + L := 0; + H := Count; + Last := -1; + REPEAT + T := (L+H) DIV 2; + IF T=Last THEN BREAK; + Result := TNvpNode (Items [T]); + C := CompareStr (Result.Name, Name); + IF C = 0 THEN EXIT + ELSE IF C < 0 THEN L := T + ELSE H := T; + Last := T; + UNTIL FALSE; + Result := NIL; +END; + + +FUNCTION TNvpList.Node (Index : INTEGER) : TNvpNode; +BEGIN + IF (Index < 0) OR (Index >= Count) + THEN Result := NIL + ELSE Result := TNvpNode (Items [Index]); +END; + + +FUNCTION TNvpList.Value (Name : STRING) : STRING; +VAR + Nvp : TNvpNode; +BEGIN + Nvp := TNvpNode (Node (Name)); + IF Nvp <> NIL + THEN Result := Nvp.Value + ELSE Result := ''; +END; + + +FUNCTION TNvpList.Value (Index : INTEGER) : STRING; +BEGIN + IF (Index < 0) OR (Index >= Count) + THEN Result := '' + ELSE Result := TNvpNode (Items [Index]).Value; +END; + + +FUNCTION TNvpList.Name (Index : INTEGER) : STRING; +BEGIN + IF (Index < 0) OR (Index >= Count) + THEN Result := '' + ELSE Result := TNvpNode (Items [Index]).Name; +END; + + +(* +=============================================================================================== +TAttrList +List of Attributes. The "Analyze" method extracts the Attributes from the given Buffer. +Is used for extraction of Attributes in Start-Tags, Empty-Element Tags and the "pseudo" +attributes in XML Prologs, Text Declarations and PIs. +=============================================================================================== +*) + +PROCEDURE TAttrList.Analyze (Start : PChar; VAR Final : PChar); + // Analyze the Buffer for Attribute=Name pairs. + // Terminates when there is a character which is not IN CNameStart + // (e.g. '?>' or '>' or '/>') +TYPE + TPhase = (phName, phEq, phValue); +VAR + Phase : TPhase; + F : PChar; + Name : STRING; + Value : STRING; + Attr : TAttr; +BEGIN + Clear; + Phase := phName; + Final := Start; + REPEAT + IF (Final^ = #0) OR (Final^ = '>') THEN BREAK; + IF NOT (Final^ IN CWhitespace) THEN + CASE Phase OF + phName : BEGIN + IF NOT (Final^ IN CNameStart) THEN EXIT; + ExtractName (Final, CWhitespace + ['=', '/'], F); + SetStringSF (Name, Final, F); + Final := F; + Phase := phEq; + END; + phEq : BEGIN + IF Final^ = '=' THEN + Phase := phValue + END; + phValue : BEGIN + IF Final^ IN CQuoteChar THEN BEGIN + ExtractQuote (Final, Value, F); + Attr := TAttr.Create; + Attr.Name := Name; + Attr.Value := Value; + Attr.ValueType := vtNormal; + Add (Attr); + Final := F; + Phase := phName; + END; + END; + END; + INC (Final); + UNTIL FALSE; +END; + + +(* +=============================================================================================== +TElemList +List of TElemDef nodes. +=============================================================================================== +*) + +FUNCTION TElemList.Node (Name : STRING) : TElemDef; + // Binary search for the Node with the given Name +VAR + L, H : INTEGER; // Low, High Limit + T, C : INTEGER; // Test Index, Comparison result + Last : INTEGER; // Last Test Index +BEGIN + IF Count=0 THEN BEGIN + Result := NIL; + EXIT; + END; + + L := 0; + H := Count; + Last := -1; + REPEAT + T := (L+H) DIV 2; + IF T=Last THEN BREAK; + Result := TElemDef (Items [T]); + C := CompareStr (Result.Name, Name); + IF C = 0 THEN EXIT + ELSE IF C < 0 THEN L := T + ELSE H := T; + Last := T; + UNTIL FALSE; + Result := NIL; +END; + + +PROCEDURE TElemList.Add (Node : TElemDef); +VAR + I : INTEGER; +BEGIN + FOR I := Count-1 DOWNTO 0 DO + IF Node.Name > TElemDef (Items [I]).Name THEN BEGIN + Insert (I+1, Node); + EXIT; + END; + Insert (0, Node); +END; + + +(* +=============================================================================================== +TScannerXmlParser +A TXmlParser descendant for the TCustomXmlScanner component +=============================================================================================== +*) + +TYPE + TScannerXmlParser = CLASS (TXmlParser) + Scanner : TCustomXmlScanner; + CONSTRUCTOR Create (TheScanner : TCustomXmlScanner); + FUNCTION LoadExternalEntity (SystemId, PublicId, + Notation : STRING) : TXmlParser; OVERRIDE; + FUNCTION TranslateEncoding (CONST Source : STRING) : STRING; OVERRIDE; + PROCEDURE DtdElementFound (DtdElementRec : TDtdElementRec); OVERRIDE; + END; + +CONSTRUCTOR TScannerXmlParser.Create (TheScanner : TCustomXmlScanner); +BEGIN + INHERITED Create; + Scanner := TheScanner; +END; + + +FUNCTION TScannerXmlParser.LoadExternalEntity (SystemId, PublicId, Notation : STRING) : TXmlParser; +BEGIN + IF Assigned (Scanner.FOnLoadExternal) + THEN Scanner.FOnLoadExternal (Scanner, SystemId, PublicId, Notation, Result) + ELSE Result := INHERITED LoadExternalEntity (SystemId, PublicId, Notation); +END; + + +FUNCTION TScannerXmlParser.TranslateEncoding (CONST Source : STRING) : STRING; +BEGIN + IF Assigned (Scanner.FOnTranslateEncoding) + THEN Result := Scanner.FOnTranslateEncoding (Scanner, CurEncoding, Source) + ELSE Result := INHERITED TranslateEncoding (Source); +END; + + +PROCEDURE TScannerXmlParser.DtdElementFound (DtdElementRec : TDtdElementRec); +BEGIN + WITH DtdElementRec DO + CASE ElementType OF + deElement : Scanner.WhenElement (ElemDef); + deAttList : Scanner.WhenAttList (ElemDef); + deEntity : Scanner.WhenEntity (EntityDef); + deNotation : Scanner.WhenNotation (NotationDef); + dePI : Scanner.WhenPI (STRING (Target), STRING (Content), AttrList); + deComment : Scanner.WhenComment (StrSFPas (Start, Final)); + deError : Scanner.WhenDtdError (Pos); + END; +END; + + +(* +=============================================================================================== +TCustomXmlScanner +=============================================================================================== +*) + +CONSTRUCTOR TCustomXmlScanner.Create (AOwner: TComponent); +BEGIN + INHERITED; + FXmlParser := TScannerXmlParser.Create (Self); +END; + + +DESTRUCTOR TCustomXmlScanner.Destroy; +BEGIN + FXmlParser.Free; + INHERITED; +END; + + +PROCEDURE TCustomXmlScanner.LoadFromFile (Filename : TFilename); + // Load XML Document from file +BEGIN + FXmlParser.LoadFromFile (Filename); +END; + + +PROCEDURE TCustomXmlScanner.LoadFromBuffer (Buffer : PChar); + // Load XML Document from buffer +BEGIN + FXmlParser.LoadFromBuffer (Buffer); +END; + + +PROCEDURE TCustomXmlScanner.SetBuffer (Buffer : PChar); + // Refer to Buffer +BEGIN + FXmlParser.SetBuffer (Buffer); +END; + + +FUNCTION TCustomXmlScanner.GetFilename : TFilename; +BEGIN + Result := FXmlParser.Source; +END; + + +FUNCTION TCustomXmlScanner.GetNormalize : BOOLEAN; +BEGIN + Result := FXmlParser.Normalize; +END; + + +PROCEDURE TCustomXmlScanner.SetNormalize (Value : BOOLEAN); +BEGIN + FXmlParser.Normalize := Value; +END; + + +PROCEDURE TCustomXmlScanner.WhenXmlProlog(XmlVersion, Encoding: STRING; Standalone : BOOLEAN); + // Is called when the parser has parsed the declaration of the prolog +BEGIN + IF Assigned (FOnXmlProlog) THEN FOnXmlProlog (Self, XmlVersion, Encoding, Standalone); +END; + + +PROCEDURE TCustomXmlScanner.WhenComment (Comment : STRING); + // Is called when the parser has parsed a +BEGIN + IF Assigned (FOnComment) THEN FOnComment (Self, Comment); +END; + + +PROCEDURE TCustomXmlScanner.WhenPI (Target, Content: STRING; Attributes : TAttrList); + // Is called when the parser has parsed a +BEGIN + IF Assigned (FOnPI) THEN FOnPI (Self, Target, Content, Attributes); +END; + + +PROCEDURE TCustomXmlScanner.WhenDtdRead (RootElementName : STRING); + // Is called when the parser has completely parsed the DTD +BEGIN + IF Assigned (FOnDtdRead) THEN FOnDtdRead (Self, RootElementName); +END; + + +PROCEDURE TCustomXmlScanner.WhenStartTag (TagName : STRING; Attributes : TAttrList); + // Is called when the parser has parsed a start tag like

+BEGIN + IF Assigned (FOnStartTag) THEN FOnStartTag (Self, TagName, Attributes); +END; + + +PROCEDURE TCustomXmlScanner.WhenEmptyTag (TagName : STRING; Attributes : TAttrList); + // Is called when the parser has parsed an Empty Element Tag like
+BEGIN + IF Assigned (FOnEmptyTag) THEN FOnEmptyTag (Self, TagName, Attributes); +END; + + +PROCEDURE TCustomXmlScanner.WhenEndTag (TagName : STRING); + // Is called when the parser has parsed an End Tag like

+BEGIN + IF Assigned (FOnEndTag) THEN FOnEndTag (Self, TagName); +END; + + +PROCEDURE TCustomXmlScanner.WhenContent (Content : STRING); + // Is called when the parser has parsed an element's text content +BEGIN + IF Assigned (FOnContent) THEN FOnContent (Self, Content); +END; + + +PROCEDURE TCustomXmlScanner.WhenCData (Content : STRING); + // Is called when the parser has parsed a CDATA section +BEGIN + IF Assigned (FOnCData) THEN FOnCData (Self, Content); +END; + + +PROCEDURE TCustomXmlScanner.WhenElement (ElemDef : TElemDef); + // Is called when the parser has parsed an definition + // inside the DTD +BEGIN + IF Assigned (FOnElement) THEN FOnElement (Self, ElemDef); +END; + + +PROCEDURE TCustomXmlScanner.WhenAttList (ElemDef : TElemDef); + // Is called when the parser has parsed an definition + // inside the DTD +BEGIN + IF Assigned (FOnAttList) THEN FOnAttList (Self, ElemDef); +END; + + +PROCEDURE TCustomXmlScanner.WhenEntity (EntityDef : TEntityDef); + // Is called when the parser has parsed an definition + // inside the DTD +BEGIN + IF Assigned (FOnEntity) THEN FOnEntity (Self, EntityDef); +END; + + +PROCEDURE TCustomXmlScanner.WhenNotation (NotationDef : TNotationDef); + // Is called when the parser has parsed a definition + // inside the DTD +BEGIN + IF Assigned (FOnNotation) THEN FOnNotation (Self, NotationDef); +END; + + +PROCEDURE TCustomXmlScanner.WhenDtdError (ErrorPos : PChar); + // Is called when the parser has found an Error in the DTD +BEGIN + IF Assigned (FOnDtdError) THEN FOnDtdError (Self, ErrorPos); +END; + + +PROCEDURE TCustomXmlScanner.Execute; + // Perform scanning + // Scanning is done synchronously, i.e. you can expect events to be triggered + // in the order of the XML data stream. Execute will finish when the whole XML + // document has been scanned or when the StopParser property has been set to TRUE. +BEGIN + FStopParser := FALSE; + FXmlParser.StartScan; + WHILE FXmlParser.Scan AND (NOT FStopParser) DO + CASE FXmlParser.CurPartType OF + ptNone : ; + ptXmlProlog : WhenXmlProlog (FXmlParser.XmlVersion, FXmlParser.Encoding, FXmlParser.Standalone); + ptComment : WhenComment (StrSFPas (FXmlParser.CurStart, FXmlParser.CurFinal)); + ptPI : WhenPI (FXmlParser.CurName, FXmlParser.CurContent, FXmlParser.CurAttr); + ptDtdc : WhenDtdRead (FXmlParser.RootName); + ptStartTag : WhenStartTag (FXmlParser.CurName, FXmlParser.CurAttr); + ptEmptyTag : WhenEmptyTag (FXmlParser.CurName, FXmlParser.CurAttr); + ptEndTag : WhenEndTag (FXmlParser.CurName); + ptContent : WhenContent (FXmlParser.CurContent); + ptCData : WhenCData (FXmlParser.CurContent); + END; +END; + + +END. diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/logger.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/logger.pas new file mode 100644 index 00000000..88bb1698 --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/logger.pas @@ -0,0 +1,176 @@ +unit logger; +{ + $Id: logger.pas,v 1.1 2004/02/05 00:08:20 savage Exp $ + +} +{******************************************************************************} +{ } +{ Error Logging Unit } +{ } +{ The initial developer of this Pascal code was : } +{ Dominique Louis } +{ } +{ Portions created by Dominique Louis are } +{ Copyright (C) 2000 - 2001 Dominique Louis. } +{ } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ Logging functions... } +{ } +{ } +{ Requires } +{ -------- } +{ SDL.dll on Windows platforms } +{ libSDL-1.1.so.0 on Linux platform } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ 2001 - DL : Initial creation } +{ 25/10/2001 - DRE : Added $M+ directive to allow published } +{ in classes. Added a compile directive } +{ around fmShareExclusive as this does not } +{ exist in Free Pascal } +{ } +{******************************************************************************} +{ + $Log: logger.pas,v $ + Revision 1.1 2004/02/05 00:08:20 savage + Module 1.0 release + + +} + +{$I jedi-sdl.inc} + +{$WEAKPACKAGEUNIT OFF} + +interface + +uses + Classes, + SysUtils; + +type + TLogger = class + private + FFileHandle : TextFile; + FApplicationName : string; + FApplicationPath : string; + protected + + public + constructor Create; + destructor Destroy; override; + function GetApplicationName: string; + function GetApplicationPath: string; + procedure LogError( ErrorMessage : string; Location : string ); + procedure LogWarning( WarningMessage : string; Location : string ); + procedure LogStatus( StatusMessage : string; Location : string ); + published + property ApplicationName : string read GetApplicationName; + property ApplicationPath : string read GetApplicationPath; + end; + +var + Log : TLogger; + +implementation + +{ TLogger } +constructor TLogger.Create; +begin + FApplicationName := ExtractFileName( ParamStr(0) ); + FApplicationPath := ExtractFilePath( ParamStr(0) ); + AssignFile( FFileHandle, FApplicationPath + ChangeFileExt( FApplicationName, '.log' ) ); + ReWrite( FFileHandle ); + (*inherited Create( FApplicationPath + ChangeFileExt( FApplicationName, '.log' ), + fmCreate {$IFNDEF FPC}or fmShareExclusive{$ENDIF} );*) +end; + +destructor TLogger.Destroy; +begin + CloseFile( FFileHandle ); + inherited; +end; + +function TLogger.GetApplicationName: string; +begin + result := FApplicationName; +end; + +function TLogger.GetApplicationPath: string; +begin + result := FApplicationPath; +end; + +procedure TLogger.LogError(ErrorMessage, Location: string); +var + S : string; +begin + S := '*** ERROR *** : @ ' + TimeToStr(Time) + ' MSG : ' + ErrorMessage + ' IN : ' + Location + #13#10; + WriteLn( FFileHandle, S ); + Flush( FFileHandle ); +end; + +procedure TLogger.LogStatus(StatusMessage, Location: string); +var + S : string; +begin + S := 'STATUS INFO : @ ' + TimeToStr(Time) + ' MSG : ' + StatusMessage + ' IN : ' + Location + #13#10; + WriteLn( FFileHandle, S ); + Flush( FFileHandle ); +end; + +procedure TLogger.LogWarning(WarningMessage, Location: string); +var + S : string; +begin + S := '=== WARNING === : @ ' + TimeToStr(Time) + ' MSG : ' + WarningMessage + ' IN : ' + Location + #13#10; + WriteLn( FFileHandle, S ); + Flush( FFileHandle ); +end; + +initialization +begin + Log := TLogger.Create; + Log.LogStatus( 'Starting Application', 'Initialization' ); +end; + +finalization +begin + Log.LogStatus( 'Terminating Application', 'Finalization' ); + Log.Free; + Log := nil; +end; + +end. + \ No newline at end of file diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/moduleloader.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/moduleloader.pas new file mode 100644 index 00000000..146e4b30 --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/moduleloader.pas @@ -0,0 +1,319 @@ +unit moduleloader; +{ + $Id: moduleloader.pas,v 1.4 2004/02/20 17:19:10 savage Exp $ + +} +{******************************************************************} +{ } +{ Project JEDI } +{ OS independent Dynamic Loading Helpers } +{ } +{ The initial developer of the this code is } +{ Robert Marquardt INVALID_MODULEHANDLE_VALUE; +end; + +// load the DLL file FileName +// LoadLibraryEx is used to get better control of the loading +// for the allowed values for flags see LoadLibraryEx documentation. + +function LoadModuleEx(var Module: TModuleHandle; FileName: PChar; Flags: Cardinal): Boolean; +begin + if Module = INVALID_MODULEHANDLE_VALUE then + Module := LoadLibraryEx( FileName, 0, Flags); + Result := Module <> INVALID_MODULEHANDLE_VALUE; +end; + +// unload a DLL loaded with LoadModule or LoadModuleEx +// The procedure will not try to unload a handle with +// value INVALID_MODULEHANDLE_VALUE and assigns this value +// to Module after unload. + +procedure UnloadModule(var Module: TModuleHandle); +begin + if Module <> INVALID_MODULEHANDLE_VALUE then + FreeLibrary(Module); + Module := INVALID_MODULEHANDLE_VALUE; +end; + +// returns the pointer to the symbol named SymbolName +// if it is exported from the DLL Module +// nil is returned if the symbol is not available + +function GetModuleSymbol(Module: TModuleHandle; SymbolName: PChar): Pointer; +begin + Result := nil; + if Module <> INVALID_MODULEHANDLE_VALUE then + Result := GetProcAddress(Module, SymbolName ); +end; + +// returns the pointer to the symbol named SymbolName +// if it is exported from the DLL Module +// nil is returned if the symbol is not available. +// as an extra the boolean variable Accu is updated +// by anding in the success of the function. +// This is very handy for rendering a global result +// when accessing a long list of symbols. + +function GetModuleSymbolEx(Module: TModuleHandle; SymbolName: PChar; var Accu: Boolean): Pointer; +begin + Result := nil; + if Module <> INVALID_MODULEHANDLE_VALUE then + Result := GetProcAddress(Module, SymbolName ); + Accu := Accu and (Result <> nil); +end; + +// get the value of variables exported from a DLL Module +// Delphi cannot access variables in a DLL directly, so +// this function allows to copy the data from the DLL. +// Beware! You are accessing the DLL memory image directly. +// Be sure to access a variable not a function and be sure +// to read the correct amount of data. + +function ReadModuleData(Module: TModuleHandle; SymbolName: PChar; var Buffer; Size: Cardinal): Boolean; +var + Sym: Pointer; +begin + Result := True; + Sym := GetModuleSymbolEx(Module, SymbolName, Result); + if Result then + Move(Sym^, Buffer, Size); +end; + +// set the value of variables exported from a DLL Module +// Delphi cannot access variables in a DLL directly, so +// this function allows to copy the data to the DLL! +// BEWARE! You are accessing the DLL memory image directly. +// Be sure to access a variable not a function and be sure +// to write the correct amount of data. +// The changes are not persistent. They get lost when the +// DLL is unloaded. + +function WriteModuleData(Module: TModuleHandle; SymbolName: PChar; var Buffer; Size: Cardinal): Boolean; +var + Sym: Pointer; +begin + Result := True; + Sym := GetModuleSymbolEx(Module, SymbolName, Result); + if Result then + Move(Buffer, Sym^, Size); +end; + +{$ENDIF} + +{$IFDEF Unix} +uses +{$ifdef Linux} + Types, + Libc; +{$else} + dl, + Types, + Baseunix, + Unix; +{$endif} +type + // Handle to a loaded .so + TModuleHandle = Pointer; + +const + // Value designating an unassigned TModuleHandle od a failed loading + INVALID_MODULEHANDLE_VALUE = TModuleHandle(nil); + +function LoadModule(var Module: TModuleHandle; FileName: PChar): Boolean; +function LoadModuleEx(var Module: TModuleHandle; FileName: PChar; Flags: Cardinal): Boolean; +procedure UnloadModule(var Module: TModuleHandle); +function GetModuleSymbol(Module: TModuleHandle; SymbolName: PChar): Pointer; +function GetModuleSymbolEx(Module: TModuleHandle; SymbolName: PChar; var Accu: Boolean): Pointer; +function ReadModuleData(Module: TModuleHandle; SymbolName: PChar; var Buffer; Size: Cardinal): Boolean; +function WriteModuleData(Module: TModuleHandle; SymbolName: PChar; var Buffer; Size: Cardinal): Boolean; + +implementation + +// load the .so file FileName +// the rules for FileName are those of dlopen() +// Returns: True = success, False = failure to load +// Assigns: the handle of the loaded .so to Module +// Warning: if Module has any other value than INVALID_MODULEHANDLE_VALUE +// on entry the function will do nothing but returning success. + +function LoadModule(var Module: TModuleHandle; FileName: PChar): Boolean; +begin + if Module = INVALID_MODULEHANDLE_VALUE then + Module := dlopen( FileName, RTLD_NOW); + Result := Module <> INVALID_MODULEHANDLE_VALUE; +end; + +// load the .so file FileName +// dlopen() with flags is used to get better control of the loading +// for the allowed values for flags see "man dlopen". + +function LoadModuleEx(var Module: TModuleHandle; FileName: PChar; Flags: Cardinal): Boolean; +begin + if Module = INVALID_MODULEHANDLE_VALUE then + Module := dlopen( FileName, Flags); + Result := Module <> INVALID_MODULEHANDLE_VALUE; +end; + +// unload a .so loaded with LoadModule or LoadModuleEx +// The procedure will not try to unload a handle with +// value INVALID_MODULEHANDLE_VALUE and assigns this value +// to Module after unload. + +procedure UnloadModule(var Module: TModuleHandle); +begin + if Module <> INVALID_MODULEHANDLE_VALUE then + dlclose(Module); + Module := INVALID_MODULEHANDLE_VALUE; +end; + +// returns the pointer to the symbol named SymbolName +// if it is exported from the .so Module +// nil is returned if the symbol is not available + +function GetModuleSymbol(Module: TModuleHandle; SymbolName: PChar): Pointer; +begin + Result := nil; + if Module <> INVALID_MODULEHANDLE_VALUE then + Result := dlsym(Module, SymbolName ); +end; + +// returns the pointer to the symbol named SymbolName +// if it is exported from the .so Module +// nil is returned if the symbol is not available. +// as an extra the boolean variable Accu is updated +// by anding in the success of the function. +// This is very handy for rendering a global result +// when accessing a long list of symbols. + +function GetModuleSymbolEx(Module: TModuleHandle; SymbolName: PChar; var Accu: Boolean): Pointer; +begin + Result := nil; + if Module <> INVALID_MODULEHANDLE_VALUE then + Result := dlsym(Module, SymbolName ); + Accu := Accu and (Result <> nil); +end; + +// get the value of variables exported from a .so Module +// Delphi cannot access variables in a .so directly, so +// this function allows to copy the data from the .so. +// Beware! You are accessing the .so memory image directly. +// Be sure to access a variable not a function and be sure +// to read the correct amount of data. + +function ReadModuleData(Module: TModuleHandle; SymbolName: PChar; var Buffer; Size: Cardinal): Boolean; +var + Sym: Pointer; +begin + Result := True; + Sym := GetModuleSymbolEx(Module, SymbolName, Result); + if Result then + Move(Sym^, Buffer, Size); +end; + +// set the value of variables exported from a .so Module +// Delphi cannot access variables in a .so directly, so +// this function allows to copy the data to the .so! +// BEWARE! You are accessing the .so memory image directly. +// Be sure to access a variable not a function and be sure +// to write the correct amount of data. +// The changes are not persistent. They get lost when the +// .so is unloaded. + +function WriteModuleData(Module: TModuleHandle; SymbolName: PChar; var Buffer; Size: Cardinal): Boolean; +var + Sym: Pointer; +begin + Result := True; + Sym := GetModuleSymbolEx(Module, SymbolName, Result); + if Result then + Move(Buffer, Sym^, Size); +end; +{$ENDIF} + +{$IFDEF __MACH__} // Mach definitions go here +{$ENDIF} + +end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/registryuserpreferences.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/registryuserpreferences.pas new file mode 100644 index 00000000..2d28a222 --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/registryuserpreferences.pas @@ -0,0 +1,229 @@ +unit registryuserpreferences; +{ + $Id: registryuserpreferences.pas,v 1.1 2004/09/30 22:35:47 savage Exp $ + +} +{******************************************************************************} +{ } +{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } +{ Wrapper class for Windows Register and INI Files } +{ } +{ The initial developer of this Pascal code was : } +{ Dominqiue Louis } +{ } +{ Portions created by Dominqiue Louis are } +{ Copyright (C) 2000 - 2001 Dominqiue Louis. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ } +{ } +{ } +{ } +{ } +{ } +{ } +{ Requires } +{ -------- } +{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } +{ They are available from... } +{ http://www.libsdl.org . } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ September 23 2004 - DL : Initial Creation } +{ + $Log: registryuserpreferences.pas,v $ + Revision 1.1 2004/09/30 22:35:47 savage + Changes, enhancements and additions as required to get SoAoS working. + + +} +{******************************************************************************} + +interface + +uses + {$IFDEF REG} + Registry, + {$ELSE} + IniFiles, + {$ENDIF} + Classes, + userpreferences; + +type + TRegistryUserPreferences = class( TUserPreferences ) + private + + protected + function GetSection( const Index : Integer ) : string; virtual; abstract; + function GetIdentifier( const Index : Integer ) : string; virtual; abstract; + function GetDefaultBoolean( const Index : Integer ) : Boolean; override; + function GetBoolean( const Index : Integer ) : Boolean; override; + procedure SetBoolean( const Index : Integer; const Value : Boolean ); override; + function GetDefaultDateTime( const Index : Integer ) : TDateTime; override; + function GetDateTime( const Index : Integer ) : TDateTime; override; + procedure SetDateTime( const Index : Integer; const Value : TDateTime ); override; + function GetDefaultInteger( const Index : Integer ) : Integer; override; + function GetInteger( const Index : Integer ) : Integer; override; + procedure SetInteger( const Index : Integer; const Value : Integer ); override; + function GetDefaultFloat( const Index : Integer ) : single; override; + function GetFloat( const Index : Integer ) : single; override; + procedure SetFloat( const Index : Integer; const Value : single ); override; + function GetDefaultString( const Index : Integer ) : string; override; + function GetString( const Index : Integer ) : string; override; + procedure SetString( const Index : Integer; const Value : string ); override; + public + Registry : {$IFDEF REG}TRegIniFile{$ELSE}TIniFile{$ENDIF}; + constructor Create( const FileName : string = '' ); reintroduce; + destructor Destroy; override; + procedure Update; override; + end; + +implementation + +uses + SysUtils; + +{ TRegistryUserPreferences } +constructor TRegistryUserPreferences.Create( const FileName : string ); +var + defFileName : string; +begin + inherited Create; + + if FileName <> '' then + defFileName := FileName + else + defFileName := ChangeFileExt( ParamStr( 0 ), '.ini' ); + + Registry := {$IFDEF REG}TRegIniFile{$ELSE}TIniFile{$ENDIF}.Create( defFileName ); +end; + +destructor TRegistryUserPreferences.Destroy; +begin + Update; + Registry.Free; + Registry := nil; + inherited; +end; + +function TRegistryUserPreferences.GetBoolean( const Index : Integer ) : Boolean; +begin + Result := Registry.ReadBool( GetSection( Index ), GetIdentifier( Index ), GetDefaultBoolean( Index ) ); +end; + +function TRegistryUserPreferences.GetDateTime( const Index : Integer ): TDateTime; +begin + Result := Registry.ReadDateTime( GetSection( Index ){$IFNDEF REG}, GetIdentifier( Index ), GetDefaultDateTime( Index ){$ENDIF} ); +end; + +function TRegistryUserPreferences.GetDefaultBoolean( const Index : Integer ) : Boolean; +begin + result := false; +end; + +function TRegistryUserPreferences.GetDefaultDateTime( const Index: Integer ) : TDateTime; +begin + result := Now; +end; + +function TRegistryUserPreferences.GetDefaultFloat( const Index: Integer ) : single; +begin + result := 0.0; +end; + +function TRegistryUserPreferences.GetDefaultInteger(const Index : Integer ) : Integer; +begin + result := 0; +end; + +function TRegistryUserPreferences.GetDefaultString( const Index : Integer ) : string; +begin + result := ''; +end; + +function TRegistryUserPreferences.GetFloat( const Index : Integer ): single; +begin + Result := Registry.ReadFloat( GetSection( Index ){$IFNDEF REG}, GetIdentifier( Index ), GetDefaultFloat( Index ){$ENDIF} ); +end; + +function TRegistryUserPreferences.GetInteger( const Index : Integer ) : Integer; +begin + Result := Registry.ReadInteger( GetSection( Index ), GetIdentifier( Index ), GetDefaultInteger( Index ) ); +end; + +function TRegistryUserPreferences.GetString( const Index : Integer ): string; +begin + Result := Registry.ReadString( GetSection( Index ), GetIdentifier( Index ), GetDefaultString( Index ) ); +end; + +procedure TRegistryUserPreferences.SetBoolean( const Index : Integer; const Value : Boolean ); +begin + Registry.WriteBool( GetSection( Index ), GetIdentifier( Index ), Value ); + inherited; +end; + +procedure TRegistryUserPreferences.SetDateTime( const Index: Integer; const Value: TDateTime ); +begin + Registry.WriteDateTime( GetSection( Index ){$IFNDEF REG}, GetIdentifier( Index ){$ENDIF}, Value ); + inherited; +end; + +procedure TRegistryUserPreferences.SetFloat(const Index: Integer; const Value: single); +begin + Registry.WriteFloat( GetSection( Index ){$IFNDEF REG}, GetIdentifier( Index ){$ENDIF}, Value ); + inherited; +end; + +procedure TRegistryUserPreferences.SetInteger( const Index, Value : Integer ); +begin + Registry.WriteInteger( GetSection( Index ), GetIdentifier( Index ), Value ); + inherited; +end; + +procedure TRegistryUserPreferences.SetString( const Index : Integer; const Value : string ); +begin + Registry.WriteString( GetSection( Index ), GetIdentifier( Index ), Value ); + inherited; +end; + +procedure TRegistryUserPreferences.Update; +begin + {$IFDEF REG} + Registry.CloseKey; + {$ELSE} + Registry.UpdateFile; + {$ENDIF} +end; + +end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdl.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdl.pas new file mode 100644 index 00000000..ad5d783a --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdl.pas @@ -0,0 +1,4118 @@ +unit sdl; +{ + $Id: sdl.pas,v 1.17 2005/01/03 18:40:59 savage Exp $ + +} +{******************************************************************************} +{ } +{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } +{ Conversion of the Simple DirectMedia Layer Headers } +{ } +{ Portions created by Sam Lantinga are } +{ Copyright (C) 1997-2004 Sam Lantinga } +{ 5635-34 Springhouse Dr. } +{ Pleasanton, CA 94588 (USA) } +{ } +{ All Rights Reserved. } +{ } +{ The original files are : SDL.h } +{ SDL_main.h } +{ SDL_types.h } +{ SDL_rwops.h } +{ SDL_timer.h } +{ SDL_audio.h } +{ SDL_cdrom.h } +{ SDL_joystick.h } +{ SDL_mouse.h } +{ SDL_keyboard.h } +{ SDL_events.h } +{ SDL_video.h } +{ SDL_byteorder.h } +{ SDL_version.h } +{ SDL_active.h } +{ SDL_thread.h } +{ SDL_mutex .h } +{ SDL_getenv.h } +{ SDL_loadso.h } +{ } +{ The initial developer of this Pascal code was : } +{ Dominqiue Louis } +{ } +{ Portions created by Dominqiue Louis are } +{ Copyright (C) 2000 - 2004 Dominqiue Louis. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ Tom Jones His Project inspired this conversion } +{ Matthias Thoma } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ } +{ } +{ } +{ } +{ } +{ } +{ } +{ Requires } +{ -------- } +{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } +{ They are available from... } +{ http://www.libsdl.org . } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ May 08 2001 - DL : Added Keyboard State Array ( See demos for how to } +{ use ) } +{ PKeyStateArr = ^TKeyStateArr; } +{ TKeyStateArr = array[0..65000] of UInt8; } +{ As most games will need it. } +{ } +{ April 02 2001 - DL : Added SDL_getenv.h definitions and tested version } +{ 1.2.0 compatability. } +{ } +{ March 13 2001 - MT : Added Linux compatibility. } +{ } +{ March 10 2001 - MT : Added externalsyms for DEFINES } +{ Changed the license header } +{ } +{ March 09 2001 - MT : Added Kylix Ifdefs/Deleted the uses mmsystem } +{ } +{ March 01 2001 - DL : Update conversion of version 1.1.8 } +{ } +{ July 22 2001 - DL : Added TUInt8Array and PUIntArray after suggestions } +{ from Matthias Thoma and Eric Grange. } +{ } +{ October 12 2001 - DL : Various changes as suggested by Matthias Thoma and } +{ David Acklam } +{ } +{ October 24 2001 - DL : Added FreePascal support as per suggestions from } +{ Dean Ellis. } +{ } +{ October 27 2001 - DL : Added SDL_BUTTON macro } +{ } +{ November 08 2001 - DL : Bug fix as pointed out by Puthoon. } +{ } +{ November 29 2001 - DL : Bug fix of SDL_SetGammaRamp as pointed out by Simon} +{ Rushton. } +{ } +{ November 30 2001 - DL : SDL_NOFRAME added as pointed out by Simon Rushton. } +{ } +{ December 11 2001 - DL : Added $WEAKPACKAGEUNIT ON to facilitate useage in } +{ Components } +{ } +{ January 05 2002 - DL : Added SDL_Swap32 function as suggested by Matthias } +{ Thoma and also made sure the _getenv from } +{ MSVCRT.DLL uses the right calling convention } +{ } +{ January 25 2002 - DL : Updated conversion of SDL_AddTimer & } +{ SDL_RemoveTimer as per suggestions from Matthias } +{ Thoma. } +{ } +{ January 27 2002 - DL : Commented out exported function putenv and getenv } +{ So that developers get used to using SDL_putenv } +{ SDL_getenv, as they are more portable } +{ } +{ March 05 2002 - DL : Added FreeAnNil procedure for Delphi 4 users. } +{ } +{ October 23 2002 - DL : Added Delphi 3 Define of Win32. } +{ If you intend to you Delphi 3... } +{ ( which is officially unsupported ) make sure you } +{ remove references to $EXTERNALSYM in this and other} +{ SDL files. } +{ } +{ November 29 2002 - DL : Fixed bug in Declaration of SDL_GetRGBA that was } +{ pointed out by Todd Lang } +{ } +{ April 03 2003 - DL : Added jedi-sdl.inc include file to support more } +{ Pascal compilers. Initial support is now included } +{ for GnuPascal, VirtualPascal, TMT and obviously } +{ continue support for Delphi Kylix and FreePascal. } +{ } +{ April 08 2003 - MK : Aka Mr Kroket - Added Better FPC support } +{ } +{ April 24 2003 - DL : under instruction from Alexey Barkovoy, I have added} +{ better TMT Pascal support and under instruction } +{ from Prof. Abimbola Olowofoyeku (The African Chief),} +{ I have added better Gnu Pascal support } +{ } +{ April 30 2003 - DL : under instruction from David Mears AKA } +{ Jason Siletto, I have added FPC Linux support. } +{ This was compiled with fpc 1.1, so remember to set } +{ include file path. ie. -Fi/usr/share/fpcsrc/rtl/* } +{ } +{ + $Log: sdl.pas,v $ + Revision 1.17 2005/01/03 18:40:59 savage + Updated Version number to reflect latest one + + Revision 1.16 2005/01/01 02:02:06 savage + Updated to v1.2.8 + + Revision 1.15 2004/12/24 18:57:11 savage + forgot to apply Michalis Kamburelis' patch to the implementation section. now fixed + + Revision 1.14 2004/12/23 23:42:18 savage + Applied Patches supplied by Michalis Kamburelis ( THANKS! ), for greater FreePascal compatability. + + Revision 1.13 2004/09/30 22:31:59 savage + Updated with slightly different header comments + + Revision 1.12 2004/09/12 21:52:58 savage + Slight changes to fix some issues with the sdl classes. + + Revision 1.11 2004/08/14 22:54:30 savage + Updated so that Library name defines are correctly defined for MacOS X. + + Revision 1.10 2004/07/20 23:57:33 savage + Thanks to Paul Toth for spotting an error in the SDL Audio Convertion structures. + In TSDL_AudioCVT the filters variable should point to and array of pointers and not what I had there previously. + + Revision 1.9 2004/07/03 22:07:22 savage + Added Bitwise Manipulation Functions for TSDL_VideoInfo struct. + + Revision 1.8 2004/05/10 14:10:03 savage + Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ). + + Revision 1.7 2004/04/13 09:32:08 savage + Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary. + + Revision 1.6 2004/04/01 20:53:23 savage + Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site. + + Revision 1.5 2004/02/22 15:32:10 savage + SDL_GetEnv Fix so it also works on FPC/Linux. Thanks to Rodrigo for pointing this out. + + Revision 1.4 2004/02/21 23:24:29 savage + SDL_GetEnv Fix so that it is not define twice for FPC. Thanks to Rene Hugentobler for pointing out this bug, + + Revision 1.3 2004/02/18 22:35:51 savage + Brought sdl.pas up to 1.2.7 compatability + Thus... + Added SDL_GL_STEREO, + SDL_GL_MULTISAMPLEBUFFERS, + SDL_GL_MULTISAMPLESAMPLES + + Add DLL/Shared object functions + function SDL_LoadObject( const sofile : PChar ) : Pointer; + + function SDL_LoadFunction( handle : Pointer; const name : PChar ) : Pointer; + + procedure SDL_UnloadObject( handle : Pointer ); + + Added function to create RWops from const memory: SDL_RWFromConstMem() + function SDL_RWFromConstMem(const mem: Pointer; size: Integer) : PSDL_RWops; + + Ported SDL_cpuinfo.h so Now you can test for Specific CPU types. + + Revision 1.2 2004/02/17 21:37:12 savage + Tidying up of units + + Revision 1.1 2004/02/05 00:08:20 savage + Module 1.0 release + +} +{******************************************************************************} + +{$I jedi-sdl.inc} + +{$ALIGN ON} + +interface + +uses +{$IFDEF __GPC__} + system, + gpc; +{$ENDIF} + +{$IFDEF WIN32} + {$IFNDEF __GPC__} + Windows; + {$ENDIF} +{$ENDIF} + +{$IFDEF UNIX} + {$IFDEF FPC} + {$IFDEF Ver1_0} + linux, + {$ELSE} + pthreads, + baseunix, + unix, + {$ENDIF} + x, + xlib; + {$ELSE} + Types, + Libc, + Xlib; + {$ENDIF} +{$ENDIF} + +{$IFDEF __MACH__} + GPCMacOSAll; +{$ENDIF} + +const +{$IFDEF WIN32} + SDLLibName = 'SDL.dll'; +{$ENDIF} + +{$IFDEF UNIX} +{$IFDEF DARWIN} + SDLLibName = 'libSDL.dylib'; +{$ELSE} + SDLLibName = 'libSDL.so'; +{$ENDIF} +{$ENDIF} + +{$IFDEF MACOS} + SDLLibName = 'SDL'; +{$ENDIF} + + // SDL.h constants + SDL_INIT_TIMER = $00000001; +{$EXTERNALSYM SDL_INIT_TIMER} + SDL_INIT_AUDIO = $00000010; +{$EXTERNALSYM SDL_INIT_AUDIO} + SDL_INIT_VIDEO = $00000020; +{$EXTERNALSYM SDL_INIT_VIDEO} + SDL_INIT_CDROM = $00000100; +{$EXTERNALSYM SDL_INIT_CDROM} + SDL_INIT_JOYSTICK = $00000200; +{$EXTERNALSYM SDL_INIT_JOYSTICK} + SDL_INIT_NOPARACHUTE = $00100000; // Don't catch fatal signals +{$EXTERNALSYM SDL_INIT_NOPARACHUTE} + SDL_INIT_EVENTTHREAD = $01000000; // Not supported on all OS's +{$EXTERNALSYM SDL_INIT_EVENTTHREAD} + SDL_INIT_EVERYTHING = $0000FFFF; +{$EXTERNALSYM SDL_INIT_EVERYTHING} + + // SDL_error.h constants + ERR_MAX_STRLEN = 128; +{$EXTERNALSYM ERR_MAX_STRLEN} + ERR_MAX_ARGS = 5; +{$EXTERNALSYM ERR_MAX_ARGS} + + // SDL_types.h constants + SDL_PRESSED = $01; +{$EXTERNALSYM SDL_PRESSED} + SDL_RELEASED = $00; +{$EXTERNALSYM SDL_RELEASED} + + // SDL_timer.h constants + // This is the OS scheduler timeslice, in milliseconds + SDL_TIMESLICE = 10; +{$EXTERNALSYM SDL_TIMESLICE} + // This is the maximum resolution of the SDL timer on all platforms + TIMER_RESOLUTION = 10; // Experimentally determined +{$EXTERNALSYM TIMER_RESOLUTION} + + // SDL_audio.h constants + AUDIO_U8 = $0008; // Unsigned 8-bit samples +{$EXTERNALSYM AUDIO_U8} + AUDIO_S8 = $8008; // Signed 8-bit samples +{$EXTERNALSYM AUDIO_S8} + AUDIO_U16LSB = $0010; // Unsigned 16-bit samples +{$EXTERNALSYM AUDIO_U16LSB} + AUDIO_S16LSB = $8010; // Signed 16-bit samples +{$EXTERNALSYM AUDIO_S16LSB} + AUDIO_U16MSB = $1010; // As above, but big-endian byte order +{$EXTERNALSYM AUDIO_U16MSB} + AUDIO_S16MSB = $9010; // As above, but big-endian byte order +{$EXTERNALSYM AUDIO_S16MSB} + AUDIO_U16 = AUDIO_U16LSB; +{$EXTERNALSYM AUDIO_U16} + AUDIO_S16 = AUDIO_S16LSB; +{$EXTERNALSYM AUDIO_S16} + + + // SDL_cdrom.h constants + // The maximum number of CD-ROM tracks on a disk + SDL_MAX_TRACKS = 99; +{$EXTERNALSYM SDL_MAX_TRACKS} + // The types of CD-ROM track possible + SDL_AUDIO_TRACK = $00; +{$EXTERNALSYM SDL_AUDIO_TRACK} + SDL_DATA_TRACK = $04; +{$EXTERNALSYM SDL_DATA_TRACK} + + // Conversion functions from frames to Minute/Second/Frames and vice versa + CD_FPS = 75; +{$EXTERNALSYM CD_FPS} + // SDL_byteorder.h constants + // The two types of endianness + SDL_LIL_ENDIAN = 1234; +{$EXTERNALSYM SDL_LIL_ENDIAN} + SDL_BIG_ENDIAN = 4321; +{$EXTERNALSYM SDL_BIG_ENDIAN} + +{$IFDEF IA32} + + SDL_BYTEORDER = SDL_LIL_ENDIAN; +{$EXTERNALSYM SDL_BYTEORDER} + // Native audio byte ordering + AUDIO_U16SYS = AUDIO_U16LSB; +{$EXTERNALSYM AUDIO_U16SYS} + AUDIO_S16SYS = AUDIO_S16LSB; +{$EXTERNALSYM AUDIO_S16SYS} + +{$ELSE} + + SDL_BYTEORDER = SDL_BIG_ENDIAN; +{$EXTERNALSYM SDL_BYTEORDER} + // Native audio byte ordering + AUDIO_U16SYS = AUDIO_U16MSB; +{$EXTERNALSYM AUDIO_U16SYS} + AUDIO_S16SYS = AUDIO_S16MSB; +{$EXTERNALSYM AUDIO_S16SYS} + +{$ENDIF} + + + SDL_MIX_MAXVOLUME = 128; +{$EXTERNALSYM SDL_MIX_MAXVOLUME} + + // SDL_joystick.h constants + MAX_JOYSTICKS = 2; // only 2 are supported in the multimedia API +{$EXTERNALSYM MAX_JOYSTICKS} + MAX_AXES = 6; // each joystick can have up to 6 axes +{$EXTERNALSYM MAX_AXES} + MAX_BUTTONS = 32; // and 32 buttons +{$EXTERNALSYM MAX_BUTTONS} + AXIS_MIN = -32768; // minimum value for axis coordinate +{$EXTERNALSYM AXIS_MIN} + AXIS_MAX = 32767; // maximum value for axis coordinate +{$EXTERNALSYM AXIS_MAX} + JOY_AXIS_THRESHOLD = (((AXIS_MAX) - (AXIS_MIN)) / 100); // 1% motion +{$EXTERNALSYM JOY_AXIS_THRESHOLD} + //JOY_BUTTON_FLAG(n) (1< } + + { Function prototype for the new timer callback function. + The callback function is passed the current timer interval and returns + the next timer interval. If the returned value is the same as the one + passed in, the periodic alarm continues, otherwise a new alarm is + scheduled. If the callback returns 0, the periodic alarm is cancelled. } + {$IFNDEF __GPC__} + TSDL_NewTimerCallback = function( interval: UInt32; param: Pointer ): UInt32; cdecl; + {$ELSE} + TSDL_NewTimerCallback = function( interval: UInt32; param: Pointer ): UInt32; + {$ENDIF} + + // Definition of the timer ID type + PSDL_TimerID = ^TSDL_TimerID; + TSDL_TimerID = record + interval: UInt32; + callback: TSDL_NewTimerCallback; + param: Pointer; + last_alarm: UInt32; + next: PSDL_TimerID; + end; + + {$IFNDEF __GPC__} + TSDL_AudioSpecCallback = procedure( userdata: Pointer; stream: PUInt8; len: Integer ); cdecl; + {$ELSE} + TSDL_AudioSpecCallback = procedure( userdata: Pointer; stream: PUInt8; len: Integer ); + {$ENDIF} + + // SDL_audio.h types + // The calculated values in this structure are calculated by SDL_OpenAudio() + PSDL_AudioSpec = ^TSDL_AudioSpec; + TSDL_AudioSpec = record + freq: Integer; // DSP frequency -- samples per second + format: UInt16; // Audio data format + channels: UInt8; // Number of channels: 1 mono, 2 stereo + silence: UInt8; // Audio buffer silence value (calculated) + samples: UInt16; // Audio buffer size in samples + padding: UInt16; // Necessary for some compile environments + size: UInt32; // Audio buffer size in bytes (calculated) + { This function is called when the audio device needs more data. + 'stream' is a pointer to the audio data buffer + 'len' is the length of that buffer in bytes. + Once the callback returns, the buffer will no longer be valid. + Stereo samples are stored in a LRLRLR ordering.} + callback: TSDL_AudioSpecCallback; + userdata: Pointer; + end; + + // A structure to hold a set of audio conversion filters and buffers + PSDL_AudioCVT = ^TSDL_AudioCVT; + + PSDL_AudioCVTFilter = ^TSDL_AudioCVTFilter; + TSDL_AudioCVTFilter = record + cvt: PSDL_AudioCVT; + format: UInt16; + end; + + PSDL_AudioCVTFilterArray = ^TSDL_AudioCVTFilterArray; + TSDL_AudioCVTFilterArray = array[0..9] of PSDL_AudioCVTFilter; + + TSDL_AudioCVT = record + needed: Integer; // Set to 1 if conversion possible + src_format: UInt16; // Source audio format + dst_format: UInt16; // Target audio format + rate_incr: double; // Rate conversion increment + buf: PUInt8; // Buffer to hold entire audio data + len: Integer; // Length of original audio buffer + len_cvt: Integer; // Length of converted audio buffer + len_mult: Integer; // buffer must be len*len_mult big + len_ratio: double; // Given len, final size is len*len_ratio + filters: TSDL_AudioCVTFilterArray; + filter_index: Integer; // Current audio conversion function + end; + + TSDL_Audiostatus = ( + SDL_AUDIO_STOPPED, + SDL_AUDIO_PLAYING, + SDL_AUDIO_PAUSED + ); + + // SDL_cdrom.h types + TSDL_CDStatus = ( + CD_ERROR, + CD_TRAYEMPTY, + CD_STOPPED, + CD_PLAYING, + CD_PAUSED ); + + PSDL_CDTrack = ^TSDL_CDTrack; + TSDL_CDTrack = record + id: UInt8; // Track number + type_: UInt8; // Data or audio track + unused: UInt16; + length: UInt32; // Length, in frames, of this track + offset: UInt32; // Offset, in frames, from start of disk + end; + + // This structure is only current as of the last call to SDL_CDStatus() + PSDL_CD = ^TSDL_CD; + TSDL_CD = record + id: Integer; // Private drive identifier + status: TSDL_CDStatus; // Current drive status + + // The rest of this structure is only valid if there's a CD in drive + numtracks: Integer; // Number of tracks on disk + cur_track: Integer; // Current track position + cur_frame: Integer; // Current frame offset within current track + track: array[0..SDL_MAX_TRACKS] of TSDL_CDTrack; + end; + + //SDL_joystick.h types + PTransAxis = ^TTransAxis; + TTransAxis = record + offset: Integer; + scale: single; + end; + + // The private structure used to keep track of a joystick + PJoystick_hwdata = ^TJoystick_hwdata; + TJoystick_hwdata = record + // joystick ID + id: Integer; + // values used to translate device-specific coordinates into SDL-standard ranges + transaxis: array[0..5] of TTransAxis; + end; + + PBallDelta = ^TBallDelta; + TBallDelta = record + dx: Integer; + dy: Integer; + end; // Current ball motion deltas + + // The SDL joystick structure + PSDL_Joystick = ^TSDL_Joystick; + TSDL_Joystick = record + index: UInt8; // Device index + name: PChar; // Joystick name - system dependent + + naxes: Integer; // Number of axis controls on the joystick + axes: PUInt16; // Current axis states + + nhats: Integer; // Number of hats on the joystick + hats: PUInt8; // Current hat states + + nballs: Integer; // Number of trackballs on the joystick + balls: PBallDelta; // Current ball motion deltas + + nbuttons: Integer; // Number of buttons on the joystick + buttons: PUInt8; // Current button states + + hwdata: PJoystick_hwdata; // Driver dependent information + + ref_count: Integer; // Reference count for multiple opens + end; + + // SDL_verion.h types + PSDL_version = ^TSDL_version; + TSDL_version = record + major: UInt8; + minor: UInt8; + patch: UInt8; + end; + + // SDL_keyboard.h types + TSDLKey = LongWord; + + TSDLMod = LongWord; + + PSDL_KeySym = ^TSDL_KeySym; + TSDL_KeySym = record + scancode: UInt8; // hardware specific scancode + sym: TSDLKey; // SDL virtual keysym + modifier: TSDLMod; // current key modifiers + unicode: UInt16; // translated character + end; + + // SDL_events.h types + {Checks the event queue for messages and optionally returns them. + If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to + the back of the event queue. + If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front + of the event queue, matching 'mask', will be returned and will not + be removed from the queue. + If 'action' is SDL_GETEVENT, up to 'numevents' events at the front + of the event queue, matching 'mask', will be returned and will be + removed from the queue. + This function returns the number of events actually stored, or -1 + if there was an error. This function is thread-safe. } + + TSDL_EventAction = (SDL_ADDEVENT, SDL_PEEKEVENT, SDL_GETEVENT); + + // Application visibility event structure + TSDL_ActiveEvent = record + type_: UInt8; // SDL_ACTIVEEVENT + gain: UInt8; // Whether given states were gained or lost (1/0) + state: UInt8; // A mask of the focus states + end; + + // Keyboard event structure + TSDL_KeyboardEvent = record + type_: UInt8; // SDL_KEYDOWN or SDL_KEYUP + which: UInt8; // The keyboard device index + state: UInt8; // SDL_PRESSED or SDL_RELEASED + keysym: TSDL_KeySym; + end; + + // Mouse motion event structure + TSDL_MouseMotionEvent = record + type_: UInt8; // SDL_MOUSEMOTION + which: UInt8; // The mouse device index + state: UInt8; // The current button state + x, y: UInt16; // The X/Y coordinates of the mouse + xrel: SInt16; // The relative motion in the X direction + yrel: SInt16; // The relative motion in the Y direction + end; + + // Mouse button event structure + TSDL_MouseButtonEvent = record + type_: UInt8; // SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP + which: UInt8; // The mouse device index + button: UInt8; // The mouse button index + state: UInt8; // SDL_PRESSED or SDL_RELEASED + x: UInt16; // The X coordinates of the mouse at press time + y: UInt16; // The Y coordinates of the mouse at press time + end; + + // Joystick axis motion event structure + TSDL_JoyAxisEvent = record + type_: UInt8; // SDL_JOYAXISMOTION + which: UInt8; // The joystick device index + axis: UInt8; // The joystick axis index + value: SInt16; // The axis value (range: -32768 to 32767) + end; + + // Joystick trackball motion event structure + TSDL_JoyBallEvent = record + type_: UInt8; // SDL_JOYAVBALLMOTION + which: UInt8; // The joystick device index + ball: UInt8; // The joystick trackball index + xrel: SInt16; // The relative motion in the X direction + yrel: SInt16; // The relative motion in the Y direction + end; + + // Joystick hat position change event structure + TSDL_JoyHatEvent = record + type_: UInt8; // SDL_JOYHATMOTION */ + which: UInt8; // The joystick device index */ + hat: UInt8; // The joystick hat index */ + value: UInt8; { The hat position value: + 8 1 2 + 7 0 3 + 6 5 4 + + Note that zero means the POV is centered. } + + end; + + // Joystick button event structure + TSDL_JoyButtonEvent = record + type_: UInt8; // SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP + which: UInt8; // The joystick device index + button: UInt8; // The joystick button index + state: UInt8; // SDL_PRESSED or SDL_RELEASED + end; + + { The "window resized" event + When you get this event, you are responsible for setting a new video + mode with the new width and height. } + TSDL_ResizeEvent = record + type_: UInt8; // SDL_VIDEORESIZE + w: Integer; // New width + h: Integer; // New height + end; + + // The "quit requested" event + PSDL_QuitEvent = ^TSDL_QuitEvent; + TSDL_QuitEvent = record + type_: UInt8; + end; + + // A user-defined event type + PSDL_UserEvent = ^TSDL_UserEvent; + TSDL_UserEvent = record + type_: UInt8; // SDL_USEREVENT through SDL_NUMEVENTS-1 + code: Integer; // User defined event code */ + data1: Pointer; // User defined data pointer */ + data2: Pointer; // User defined data pointer */ + end; + + // The "screen redraw" event + PSDL_ExposeEvent = ^TSDL_ExposeEvent; + TSDL_ExposeEvent = record + type_ : Uint8; // SDL_VIDEOEXPOSE + end; + + {$IFDEF Unix} + //These are the various supported subsystems under UNIX + TSDL_SysWm = ( SDL_SYSWM_X11 ) ; + {$ENDIF} + +// The windows custom event structure +{$IFDEF Win32} + PSDL_SysWMmsg = ^TSDL_SysWMmsg; + TSDL_SysWMmsg = record + version: TSDL_version; + h_wnd: HWND; // The window for the message + msg: UInt; // The type of message + w_Param: WPARAM; // WORD message parameter + lParam: LPARAM; // LONG message parameter + end; +{$ELSE} + +{$IFDEF Unix} +{ The Linux custom event structure } + PSDL_SysWMmsg = ^TSDL_SysWMmsg; + TSDL_SysWMmsg = record + version : TSDL_version; + subsystem : TSDL_SysWm; + {$IFDEF FPC} + event : TXEvent; + {$ELSE} + event : XEvent; + {$ENDIF} + end; +{$ELSE} +{ The generic custom event structure } + PSDL_SysWMmsg = ^TSDL_SysWMmsg; + TSDL_SysWMmsg = record + version: TSDL_version; + data: Integer; + end; +{$ENDIF} + +{$ENDIF} + +// The Windows custom window manager information structure +{$IFDEF Win32} + PSDL_SysWMinfo = ^TSDL_SysWMinfo; + TSDL_SysWMinfo = record + version : TSDL_version; + window : HWnd; // The display window + end; +{$ELSE} + +// The Linux custom window manager information structure +{$IFDEF Unix} + TX11 = record + display : PDisplay; // The X11 display + window : TWindow ; // The X11 display window */ + {* These locking functions should be called around + any X11 functions using the display variable. + They lock the event thread, so should not be + called around event functions or from event filters. + *} + lock_func : Pointer; + unlock_func : Pointer; + + // Introduced in SDL 1.0.2 + fswindow : TWindow ; // The X11 fullscreen window */ + wmwindow : TWindow ; // The X11 managed input window */ + end; + + PSDL_SysWMinfo = ^TSDL_SysWMinfo; + TSDL_SysWMinfo = record + version : TSDL_version ; + subsystem : TSDL_SysWm; + X11 : TX11; + end; +{$ELSE} + // The generic custom window manager information structure + PSDL_SysWMinfo = ^TSDL_SysWMinfo; + TSDL_SysWMinfo = record + version : TSDL_version ; + data : integer; + end; +{$ENDIF} + +{$ENDIF} + + PSDL_SysWMEvent = ^TSDL_SysWMEvent; + TSDL_SysWMEvent = record + type_: UInt8; + msg: PSDL_SysWMmsg; + end; + + PSDL_Event = ^TSDL_Event; + TSDL_Event = record + case UInt8 of + SDL_NOEVENT: (type_: byte); + SDL_ACTIVEEVENT: (active: TSDL_ActiveEvent); + SDL_KEYDOWN, SDL_KEYUP: (key: TSDL_KeyboardEvent); + SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent); + SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP: (button: TSDL_MouseButtonEvent ); + SDL_JOYAXISMOTION: (jaxis: TSDL_JoyAxisEvent ); + SDL_JOYBALLMOTION: (jball: TSDL_JoyBallEvent ); + SDL_JOYHATMOTION: (jhat: TSDL_JoyHatEvent ); + SDL_JOYBUTTONDOWN, SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent ); + SDL_VIDEORESIZE: (resize: TSDL_ResizeEvent ); + SDL_QUITEV: (quit: TSDL_QuitEvent ); + SDL_USEREVENT : ( user : TSDL_UserEvent ); + SDL_SYSWMEVENT: (syswm: TSDL_SysWMEvent ); + end; + + +{ This function sets up a filter to process all events before they + change internal state and are posted to the internal event queue. + + The filter is protypted as: } + {$IFNDEF __GPC__} + TSDL_EventFilter = function( event : PSDL_Event ): Integer; cdecl; + {$ELSE} + TSDL_EventFilter = function( event : PSDL_Event ): Integer; + {$ENDIF} + + // SDL_video.h types + // Useful data types + PPSDL_Rect = ^PSDL_Rect; + PSDL_Rect = ^TSDL_Rect; + TSDL_Rect = record + x, y: SInt16; + w, h: UInt16; + end; + + SDL_Rect = TSDL_Rect; +{$EXTERNALSYM SDL_Rect} + + PSDL_Color = ^TSDL_Color; + TSDL_Color = record + r: UInt8; + g: UInt8; + b: UInt8; + unused: UInt8; + end; + + PSDL_ColorArray = ^TSDL_ColorArray; + TSDL_ColorArray = array[0..65000] of TSDL_Color; + + PSDL_Palette = ^TSDL_Palette; + TSDL_Palette = record + ncolors: Integer; + colors: PSDL_ColorArray; + end; + + // Everything in the pixel format structure is read-only + PSDL_PixelFormat = ^TSDL_PixelFormat; + TSDL_PixelFormat = record + palette: PSDL_Palette; + BitsPerPixel: UInt8; + BytesPerPixel: UInt8; + Rloss: UInt8; + Gloss: UInt8; + Bloss: UInt8; + Aloss: UInt8; + Rshift: UInt8; + Gshift: UInt8; + Bshift: UInt8; + Ashift: UInt8; + RMask: UInt32; + GMask: UInt32; + BMask: UInt32; + AMask: UInt32; + colorkey: UInt32; // RGB color key information + alpha: UInt8; // Alpha value information (per-surface alpha) + end; + +{$IFDEF WIN32} + {PPrivate_hwdata = ^TPrivate_hwdata; + TPrivate_hwdata = record + dd_surface : IDIRECTDRAWSURFACE3; + dd_writebuf : IDIRECTDRAWSURFACE3; + end;} + {ELSE} +{$ENDIF} + + // The structure passed to the low level blit functions + PSDL_BlitInfo = ^TSDL_BlitInfo; + TSDL_BlitInfo = record + s_pixels: PUInt8; + s_width: Integer; + s_height: Integer; + s_skip: Integer; + d_pixels: PUInt8; + d_width: Integer; + d_height: Integer; + d_skip: Integer; + aux_data: Pointer; + src: PSDL_PixelFormat; + table: PUInt8; + dst: PSDL_PixelFormat; + end; + + // typedef for private surface blitting functions + PSDL_Surface = ^TSDL_Surface; + + {$IFNDEF __GPC__} + TSDL_Blit = function( src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect ): Integer; cdecl; + {$ELSE} + TSDL_Blit = function( src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect ): Integer; + {$ENDIF} + + // The type definition for the low level blit functions + //TSDL_LoBlit = procedure( info : PSDL_BlitInfo ); cdecl; + + // This is the private info structure for software accelerated blits + {PPrivate_swaccel = ^TPrivate_swaccel; + TPrivate_swaccel = record + blit : TSDL_LoBlit; + aux_data : Pointer; + end;} + + // Blit mapping definition + {PSDL_BlitMap = ^TSDL_BlitMap; + TSDL_BlitMap = record + dst : PSDL_Surface; + identity : Integer; + table : PUInt8; + hw_blit : TSDL_Blit; + sw_blit : TSDL_Blit; + hw_data : PPrivate_hwaccel; + sw_data : PPrivate_swaccel; + + // the version count matches the destination; mismatch indicates an invalid mapping + format_version : Cardinal; + end;} + + TSDL_Surface = record + flags: UInt32; // Read-only + format: PSDL_PixelFormat; // Read-only + w, h: Integer; // Read-only + pitch: UInt16; // Read-only + pixels: Pointer; // Read-write + offset: Integer; // Private + hwdata: Pointer; //TPrivate_hwdata; Hardware-specific surface info + + // clipping information: + clip_rect: TSDL_Rect; // Read-only + unused1: UInt32; // for binary compatibility + // Allow recursive locks + locked: UInt32; // Private + // info for fast blit mapping to other surfaces + Blitmap: Pointer; // PSDL_BlitMap; // Private + // format version, bumped at every change to invalidate blit maps + format_version: Cardinal; // Private + refcount: Integer; + end; + + // Useful for determining the video hardware capabilities + PSDL_VideoInfo = ^TSDL_VideoInfo; + TSDL_VideoInfo = record + hw_available: UInt8; // Hardware and WindowManager flags in first 2 bits ( see below ) + {hw_available: 1; // Can you create hardware surfaces + wm_available: 1; // Can you talk to a window manager? + UnusedBits1: 6;} + blit_hw: UInt8; // Blit Hardware flags. See below for which bits do what + {UnusedBits2: 1; + blit_hw: 1; // Flag:UInt32 Accelerated blits HW --> HW + blit_hw_CC: 1; // Flag:UInt32 Accelerated blits with Colorkey + blit_hw_A: 1; // Flag:UInt32 Accelerated blits with Alpha + blit_sw: 1; // Flag:UInt32 Accelerated blits SW --> HW + blit_sw_CC: 1; // Flag:UInt32 Accelerated blits with Colorkey + blit_sw_A: 1; // Flag:UInt32 Accelerated blits with Alpha + blit_fill: 1; // Flag:UInt32 Accelerated color fill} + UnusedBits3: UInt8; // Unused at this point + video_mem: UInt32; // The total amount of video memory (in K) + vfmt: PSDL_PixelFormat; // Value: The format of the video surface + end; + + // The YUV hardware video overlay + PSDL_Overlay = ^TSDL_Overlay; + TSDL_Overlay = record + format: UInt32; // Overlay format + w, h: Integer; // Width and height of overlay + planes: Integer; // Number of planes in the overlay. Usually either 1 or 3 + pitches: PUInt16; + // An array of pitches, one for each plane. Pitch is the length of a row in bytes. + pixels: PUInt8; + // An array of pointers to teh data of each plane. The overlay should be locked before these pointers are used. + hw_overlay: UInt32; + // This will be set to 1 if the overlay is hardware accelerated. + end; + + // Public enumeration for setting the OpenGL window attributes. + TSDL_GLAttr = ( + SDL_GL_RED_SIZE, + SDL_GL_GREEN_SIZE, + SDL_GL_BLUE_SIZE, + SDL_GL_ALPHA_SIZE, + SDL_GL_BUFFER_SIZE, + SDL_GL_DOUBLEBUFFER, + SDL_GL_DEPTH_SIZE, + SDL_GL_STENCIL_SIZE, + SDL_GL_ACCUM_RED_SIZE, + SDL_GL_ACCUM_GREEN_SIZE, + SDL_GL_ACCUM_BLUE_SIZE, + SDL_GL_ACCUM_ALPHA_SIZE, + SDL_GL_STEREO, + SDL_GL_MULTISAMPLEBUFFERS, + SDL_GL_MULTISAMPLESAMPLES); + + + + PSDL_Cursor = ^TSDL_Cursor; + TSDL_Cursor = record + area: TSDL_Rect; // The area of the mouse cursor + hot_x, hot_y: SInt16; // The "tip" of the cursor + data: PUInt8; // B/W cursor data + mask: PUInt8; // B/W cursor mask + save: array[1..2] of PUInt8; // Place to save cursor area + wm_cursor: Pointer; // Window-manager cursor + end; + +// SDL_mutex.h types + +{$IFDEF WIN32} + PSDL_Mutex = ^TSDL_Mutex; + TSDL_Mutex = record + id: THANDLE; + end; +{$ENDIF} + +{$IFDEF Unix} + PSDL_Mutex = ^TSDL_Mutex; + TSDL_mutex = record + id: pthread_mutex_t; +{$IFDEF PTHREAD_NO_RECURSIVE_MUTEX} + recursive: Integer; + owner: pthread_t; +{$ENDIF} + end; +{$ENDIF} + +{$IFDEF __MACH__} + {$define USE_NAMED_SEMAPHORES} + // Broken sem_getvalue() in MacOS X Public Beta */ + {$define BROKEN_SEMGETVALUE} +{$ENDIF} + +PSDL_semaphore = ^TSDL_semaphore; +{$IFDEF WIN32} + // Win32 or Machintosh + TSDL_semaphore = record + id: THANDLE; + count: UInt32; + end; +{$ELSE} + {$IFDEF FPC} + // This should be semaphore.h + __sem_lock_t = {packed} record { Not in header file - anonymous } + status: Longint; + spinlock: Integer; + end; + + sem_t = {packed} record + __sem_lock: __sem_lock_t; + __sem_value: Integer; + __sem_waiting: longint ; {_pthread_queue;} + end; + {$ENDIF} + + TSDL_semaphore = record + sem: Pointer; //PSem_t; + {$IFNDEF USE_NAMED_SEMAPHORES} + sem_data: Sem_t; + {$ENDIF} + + {$IFDEF BROKEN_SEMGETVALUE} + { This is a little hack for MacOS X - + It's not thread-safe, but it's better than nothing } + sem_value: Integer; + {$ENDIF} + end; +{$ENDIF} + + PSDL_Sem = ^TSDL_Sem; + TSDL_Sem = TSDL_Semaphore; + + PSDL_Cond = ^TSDL_Cond; + TSDL_Cond = record +{$IFDEF Unix} + cond: pthread_cond_t; +{$ELSE} + // Generic Cond structure + lock: PSDL_mutex; + waiting: Integer; + signals: Integer; + wait_sem: PSDL_Sem; + wait_done: PSDL_Sem; +{$ENDIF} + end; + + // SDL_thread.h types +{$IFDEF WIN32} + TSYS_ThreadHandle = THandle; +{$ENDIF} + +{$IFDEF Unix} + TSYS_ThreadHandle = pthread_t; +{$ENDIF} + + { This is the system-independent thread info structure } + PSDL_Thread = ^TSDL_Thread; + TSDL_Thread = record + threadid: UInt32; + handle: TSYS_ThreadHandle; + status: Integer; + errbuf: TSDL_Error; + data: Pointer; + end; + + // Helper Types + + // Keyboard State Array ( See demos for how to use ) + PKeyStateArr = ^TKeyStateArr; + TKeyStateArr = array[0..65000] of UInt8; + + // Types required so we don't need to use Windows.pas + PInteger = ^Integer; + PByte = ^Byte; + PWord = ^Word; + PLongWord = ^Longword; + + // General arrays + PByteArray = ^TByteArray; + TByteArray = array[0..32767] of Byte; + + PWordArray = ^TWordArray; + TWordArray = array[0..16383] of Word; + + PPoint = ^TPoint; + TPoint = record + x: Longint; + y: Longint; + end; + + PRect = ^TRect; + TRect = record + case Integer of + 0: (Left, Top, Right, Bottom: Integer); + 1: (TopLeft, BottomRight: TPoint); + end; + + { Generic procedure pointer } + TProcedure = procedure; + +{------------------------------------------------------------------------------} +{ initialization } +{------------------------------------------------------------------------------} + +{ This function loads the SDL dynamically linked library and initializes + the subsystems specified by 'flags' (and those satisfying dependencies) + Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup + signal handlers for some commonly ignored fatal signals (like SIGSEGV) } + +function SDL_Init( flags : UInt32 ) : Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_Init'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_Init} + +// This function initializes specific SDL subsystems +function SDL_InitSubSystem( flags : UInt32 ) : Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_InitSubSystem'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_InitSubSystem} + +// This function cleans up specific SDL subsystems +procedure SDL_QuitSubSystem( flags : UInt32 ); +cdecl; external {$IFDEF __GPC__}name 'SDL_QuitSubSystem'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_QuitSubSystem} + +{ This function returns mask of the specified subsystems which have + been initialized. + If 'flags' is 0, it returns a mask of all initialized subsystems. } + +function SDL_WasInit( flags : UInt32 ): UInt32; +cdecl; external {$IFDEF __GPC__}name 'SDL_WasInit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_WasInit} + +{ This function cleans up all initialized subsystems and unloads the + dynamically linked library. You should call it upon all exit conditions. } +procedure SDL_Quit; +cdecl; external {$IFDEF __GPC__}name 'SDL_Quit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_Quit} + +{$IFDEF WIN32} +// This should be called from your WinMain() function, if any +function SDL_RegisterApp(name: PChar; style: UInt32; h_Inst: Pointer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_RegisterApp'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_RegisterApp} +{$ENDIF} + +{$IFDEF __MACH__} +// This should be called from your main() function, if any +procedure SDL_InitQuickDraw( the_qd: QDGlobals ); +cdecl; external {$IFDEF __GPC__}name 'SDL_InitQuickDraw'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_InitQuickDraw} +{$ENDIF} + + +{------------------------------------------------------------------------------} +{ types } +{------------------------------------------------------------------------------} +// The number of elements in a table +function SDL_TableSize( table: PChar ): Integer; +{$EXTERNALSYM SDL_TABLESIZE} + + +{------------------------------------------------------------------------------} +{ error-handling } +{------------------------------------------------------------------------------} +// Public functions +function SDL_GetError: PChar; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetError'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetError} +procedure SDL_SetError(fmt: PChar); +cdecl; external {$IFDEF __GPC__}name 'SDL_SetError'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetError} +procedure SDL_ClearError; +cdecl; external {$IFDEF __GPC__}name 'SDL_ClearError'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_ClearError} + +{$IFNDEF WIN32} +procedure SDL_Error(Code: TSDL_errorcode); +cdecl; external {$IFDEF __GPC__}name 'SDL_Error'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_Error} +{$ENDIF} + +// Private error message function - used internally +procedure SDL_OutOfMemory; + +{------------------------------------------------------------------------------} +{ io handling } +{------------------------------------------------------------------------------} +// Functions to create SDL_RWops structures from various data sources + +function SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; +cdecl; external {$IFDEF __GPC__}name 'SDL_RWFromFile'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_RWFromFile} +procedure SDL_FreeRW(area: PSDL_RWops); +cdecl; external {$IFDEF __GPC__}name 'SDL_FreeRW'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_FreeRW} + +//fp is FILE *fp ??? +function SDL_RWFromFP(fp: Pointer; autoclose: Integer): PSDL_RWops; +cdecl; external {$IFDEF __GPC__}name 'SDL_RWFromFP'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_RWFromFP} +function SDL_RWFromMem(mem: Pointer; size: Integer): PSDL_RWops; +cdecl; external {$IFDEF __GPC__}name 'SDL_RWFromMem'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_RWFromMem} +function SDL_RWFromConstMem(const mem: Pointer; size: Integer) : PSDL_RWops; +cdecl; external {$IFDEF __GPC__}name 'SDL_RWFromConstMem'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_RWFromConstMem} +function SDL_AllocRW: PSDL_RWops; +cdecl; external {$IFDEF __GPC__}name 'SDL_AllocRW'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_AllocRW} + +function SDL_RWSeek(context: PSDL_RWops; offset: Integer; whence: Integer) : Integer; +{$EXTERNALSYM SDL_RWSeek} +function SDL_RWTell(context: PSDL_RWops): Integer; +{$EXTERNALSYM SDL_RWTell} +function SDL_RWRead(context: PSDL_RWops; ptr: Pointer; size: Integer; n : Integer): Integer; +{$EXTERNALSYM SDL_RWRead} +function SDL_RWWrite(context: PSDL_RWops; ptr: Pointer; size: Integer; n : Integer): Integer; +{$EXTERNALSYM SDL_RWWrite} +function SDL_RWClose(context: PSDL_RWops): Integer; +{$EXTERNALSYM SDL_RWClose} + +{------------------------------------------------------------------------------} +{ time-handling } +{------------------------------------------------------------------------------} + +{ Get the number of milliseconds since the SDL library initialization. } +{ Note that this value wraps if the program runs for more than ~49 days. } +function SDL_GetTicks: UInt32; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetTicks'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetTicks} + +// Wait a specified number of milliseconds before returning +procedure SDL_Delay(msec: UInt32); +cdecl; external {$IFDEF __GPC__}name 'SDL_Delay'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_Delay} + +{ Add a new timer to the pool of timers already running. } +{ Returns a timer ID, or NULL when an error occurs. } +function SDL_AddTimer(interval: UInt32; callback: TSDL_NewTimerCallback; param : Pointer): PSDL_TimerID; +cdecl; external {$IFDEF __GPC__}name 'SDL_AddTimer'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_AddTimer} + +{ Remove one of the multiple timers knowing its ID. } +{ Returns a boolean value indicating success. } +function SDL_RemoveTimer(t: PSDL_TimerID): TSDL_Bool; +cdecl; external {$IFDEF __GPC__}name 'SDL_RemoveTimer'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_RemoveTimer} + +function SDL_SetTimer(interval: UInt32; callback: TSDL_TimerCallback): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SetTimer'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetTimer} + +{------------------------------------------------------------------------------} +{ audio-routines } +{------------------------------------------------------------------------------} + +{ These functions are used internally, and should not be used unless you + have a specific need to specify the audio driver you want to use. + You should normally use SDL_Init() or SDL_InitSubSystem(). } + +function SDL_AudioInit(driver_name: PChar): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_AudioInit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_AudioInit} +procedure SDL_AudioQuit; +cdecl; external {$IFDEF __GPC__}name 'SDL_AudioQuit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_AudioQuit} + +{ This function fills the given character buffer with the name of the + current audio driver, and returns a Pointer to it if the audio driver has + been initialized. It returns NULL if no driver has been initialized. } + +function SDL_AudioDriverName(namebuf: PChar; maxlen: Integer): PChar; +cdecl; external {$IFDEF __GPC__}name 'SDL_AudioDriverName'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_AudioDriverName} + +{ This function opens the audio device with the desired parameters, and + returns 0 if successful, placing the actual hardware parameters in the + structure pointed to by 'obtained'. If 'obtained' is NULL, the audio + data passed to the callback function will be guaranteed to be in the + requested format, and will be automatically converted to the hardware + audio format if necessary. This function returns -1 if it failed + to open the audio device, or couldn't set up the audio thread. + + When filling in the desired audio spec structure, + 'desired->freq' should be the desired audio frequency in samples-per-second. + 'desired->format' should be the desired audio format. + 'desired->samples' is the desired size of the audio buffer, in samples. + This number should be a power of two, and may be adjusted by the audio + driver to a value more suitable for the hardware. Good values seem to + range between 512 and 8096 inclusive, depending on the application and + CPU speed. Smaller values yield faster response time, but can lead + to underflow if the application is doing heavy processing and cannot + fill the audio buffer in time. A stereo sample consists of both right + and left channels in LR ordering. + Note that the number of samples is directly related to time by the + following formula: ms = (samples*1000)/freq + 'desired->size' is the size in bytes of the audio buffer, and is + calculated by SDL_OpenAudio(). + 'desired->silence' is the value used to set the buffer to silence, + and is calculated by SDL_OpenAudio(). + 'desired->callback' should be set to a function that will be called + when the audio device is ready for more data. It is passed a pointer + to the audio buffer, and the length in bytes of the audio buffer. + This function usually runs in a separate thread, and so you should + protect data structures that it accesses by calling SDL_LockAudio() + and SDL_UnlockAudio() in your code. + 'desired->userdata' is passed as the first parameter to your callback + function. + + The audio device starts out playing silence when it's opened, and should + be enabled for playing by calling SDL_PauseAudio(0) when you are ready + for your audio callback function to be called. Since the audio driver + may modify the requested size of the audio buffer, you should allocate + any local mixing buffers after you open the audio device. } + +function SDL_OpenAudio(desired, obtained: PSDL_AudioSpec): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_OpenAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_OpenAudio} + +{ Get the current audio state: } +function SDL_GetAudioStatus: TSDL_Audiostatus; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetAudioStatus'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetAudioStatus} + +{ This function pauses and unpauses the audio callback processing. + It should be called with a parameter of 0 after opening the audio + device to start playing sound. This is so you can safely initialize + data for your callback function after opening the audio device. + Silence will be written to the audio device during the pause. } + +procedure SDL_PauseAudio(pause_on: Integer); +cdecl; external {$IFDEF __GPC__}name 'SDL_PauseAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_PauseAudio} + +{ This function loads a WAVE from the data source, automatically freeing + that source if 'freesrc' is non-zero. For example, to load a WAVE file, + you could do: + SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); + + If this function succeeds, it returns the given SDL_AudioSpec, + filled with the audio data format of the wave data, and sets + 'audio_buf' to a malloc()'d buffer containing the audio data, + and sets 'audio_len' to the length of that audio buffer, in bytes. + You need to free the audio buffer with SDL_FreeWAV() when you are + done with it. + + This function returns NULL and sets the SDL error message if the + wave file cannot be opened, uses an unknown data format, or is + corrupt. Currently raw and MS-ADPCM WAVE files are supported. } + +function SDL_LoadWAV_RW(src: PSDL_RWops; freesrc: Integer; spec: + PSDL_AudioSpec; audio_buf: PUInt8; audiolen: PUInt32): PSDL_AudioSpec; +cdecl; external {$IFDEF __GPC__}name 'SDL_LoadWAV_RW'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_LoadWAV_RW} + +// Compatibility convenience function -- loads a WAV from a file +function SDL_LoadWAV(filename: PChar; spec: PSDL_AudioSpec; audio_buf: + PUInt8; audiolen: PUInt32): PSDL_AudioSpec; +{$EXTERNALSYM SDL_LoadWAV} + +{ This function frees data previously allocated with SDL_LoadWAV_RW() } + +procedure SDL_FreeWAV(audio_buf: PUInt8); +cdecl; external {$IFDEF __GPC__}name 'SDL_FreeWAV'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_FreeWAV} + +{ This function takes a source format and rate and a destination format + and rate, and initializes the 'cvt' structure with information needed + by SDL_ConvertAudio() to convert a buffer of audio data from one format + to the other. + This function returns 0, or -1 if there was an error. } +function SDL_BuildAudioCVT(cvt: PSDL_AudioCVT; src_format: UInt16; + src_channels: UInt8; src_rate: Integer; dst_format: UInt16; dst_channels: UInt8; + dst_rate: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_BuildAudioCVT'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_BuildAudioCVT} + +{ Once you have initialized the 'cvt' structure using SDL_BuildAudioCVT(), + created an audio buffer cvt->buf, and filled it with cvt->len bytes of + audio data in the source format, this function will convert it in-place + to the desired format. + The data conversion may expand the size of the audio data, so the buffer + cvt->buf should be allocated after the cvt structure is initialized by + SDL_BuildAudioCVT(), and should be cvt->len*cvt->len_mult bytes long. } +function SDL_ConvertAudio(cvt: PSDL_AudioCVT): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_ConvertAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_ConvertAudio} + +{ This takes two audio buffers of the playing audio format and mixes + them, performing addition, volume adjustment, and overflow clipping. + The volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME + for full audio volume. Note this does not change hardware volume. + This is provided for convenience -- you can mix your own audio data. } + +procedure SDL_MixAudio(dst, src: PUInt8; len: UInt32; volume: Integer); +cdecl; external {$IFDEF __GPC__}name 'SDL_MixAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_MixAudio} + +{ The lock manipulated by these functions protects the callback function. + During a LockAudio/UnlockAudio pair, you can be guaranteed that the + callback function is not running. Do not call these from the callback + function or you will cause deadlock. } +procedure SDL_LockAudio; +cdecl; external {$IFDEF __GPC__}name 'SDL_LockAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_LockAudio} +procedure SDL_UnlockAudio; +cdecl; external {$IFDEF __GPC__}name 'SDL_UnlockAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_UnlockAudio} + +{ This function shuts down audio processing and closes the audio device. } + +procedure SDL_CloseAudio; +cdecl; external {$IFDEF __GPC__}name 'SDL_CloseAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CloseAudio} + +{------------------------------------------------------------------------------} +{ CD-routines } +{------------------------------------------------------------------------------} + +{ Returns the number of CD-ROM drives on the system, or -1 if + SDL_Init() has not been called with the SDL_INIT_CDROM flag. } + +function SDL_CDNumDrives: Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_CDNumDrives'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CDNumDrives} + +{ Returns a human-readable, system-dependent identifier for the CD-ROM. + Example: + "/dev/cdrom" + "E:" + "/dev/disk/ide/1/master" } + +function SDL_CDName(drive: Integer): PChar; +cdecl; external {$IFDEF __GPC__}name 'SDL_CDName'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CDName} + +{ Opens a CD-ROM drive for access. It returns a drive handle on success, + or NULL if the drive was invalid or busy. This newly opened CD-ROM + becomes the default CD used when other CD functions are passed a NULL + CD-ROM handle. + Drives are numbered starting with 0. Drive 0 is the system default CD-ROM. } + +function SDL_CDOpen(drive: Integer): PSDL_CD; +cdecl; external {$IFDEF __GPC__}name 'SDL_CDOpen'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CDOpen} + +{ This function returns the current status of the given drive. + If the drive has a CD in it, the table of contents of the CD and current + play position of the CD will be stored in the SDL_CD structure. } + +function SDL_CDStatus(cdrom: PSDL_CD): TSDL_CDStatus; +cdecl; external {$IFDEF __GPC__}name 'SDL_CDStatus'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CDStatus} + +{ Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks' + tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play + until the end of the CD. This function will skip data tracks. + This function should only be called after calling SDL_CDStatus() to + get track information about the CD. + + For example: + // Play entire CD: + if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) then + SDL_CDPlayTracks(cdrom, 0, 0, 0, 0); + // Play last track: + if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) then + begin + SDL_CDPlayTracks(cdrom, cdrom->numtracks-1, 0, 0, 0); + end; + + // Play first and second track and 10 seconds of third track: + if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) + SDL_CDPlayTracks(cdrom, 0, 0, 2, 10); + + This function returns 0, or -1 if there was an error. } + +function SDL_CDPlayTracks(cdrom: PSDL_CD; start_track: Integer; start_frame: + Integer; ntracks: Integer; nframes: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_CDPlayTracks'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CDPlayTracks} + + +{ Play the given CD starting at 'start' frame for 'length' frames. + It returns 0, or -1 if there was an error. } + +function SDL_CDPlay(cdrom: PSDL_CD; start: Integer; length: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_CDPlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CDPlay} + +// Pause play -- returns 0, or -1 on error +function SDL_CDPause(cdrom: PSDL_CD): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_CDPause'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CDPause} + +// Resume play -- returns 0, or -1 on error +function SDL_CDResume(cdrom: PSDL_CD): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_CDResume'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CDResume} + +// Stop play -- returns 0, or -1 on error +function SDL_CDStop(cdrom: PSDL_CD): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_CDStop'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CDStop} + +// Eject CD-ROM -- returns 0, or -1 on error +function SDL_CDEject(cdrom: PSDL_CD): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_CDEject'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CDEject} + +// Closes the handle for the CD-ROM drive +procedure SDL_CDClose(cdrom: PSDL_CD); +cdecl; external {$IFDEF __GPC__}name 'SDL_CDClose'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CDClose} + +// Given a status, returns true if there's a disk in the drive +function SDL_CDInDrive( status : TSDL_CDStatus ) : LongBool; +{$EXTERNALSYM SDL_CDInDrive} + +// Conversion functions from frames to Minute/Second/Frames and vice versa +procedure FRAMES_TO_MSF(frames: Integer; var M: Integer; var S: Integer; var + F: Integer); +{$EXTERNALSYM FRAMES_TO_MSF} +function MSF_TO_FRAMES(M: Integer; S: Integer; F: Integer): Integer; +{$EXTERNALSYM MSF_TO_FRAMES} + +{------------------------------------------------------------------------------} +{ JoyStick-routines } +{------------------------------------------------------------------------------} + +{ Count the number of joysticks attached to the system } +function SDL_NumJoysticks: Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_NumJoysticks'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_NumJoysticks} + +{ Get the implementation dependent name of a joystick. + This can be called before any joysticks are opened. + If no name can be found, this function returns NULL. } +function SDL_JoystickName(index: Integer): PChar; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickName'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickName} + +{ Open a joystick for use - the index passed as an argument refers to + the N'th joystick on the system. This index is the value which will + identify this joystick in future joystick events. + + This function returns a joystick identifier, or NULL if an error occurred. } +function SDL_JoystickOpen(index: Integer): PSDL_Joystick; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickOpen'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickOpen} + +{ Returns 1 if the joystick has been opened, or 0 if it has not. } +function SDL_JoystickOpened(index: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickOpened'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickOpened} + +{ Get the device index of an opened joystick. } +function SDL_JoystickIndex(joystick: PSDL_Joystick): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickIndex'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickIndex} + +{ Get the number of general axis controls on a joystick } +function SDL_JoystickNumAxes(joystick: PSDL_Joystick): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickNumAxes'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickNumAxes} + +{ Get the number of trackballs on a joystick + Joystick trackballs have only relative motion events associated + with them and their state cannot be polled. } +function SDL_JoystickNumBalls(joystick: PSDL_Joystick): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickNumBalls'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickNumBalls} + + +{ Get the number of POV hats on a joystick } +function SDL_JoystickNumHats(joystick: PSDL_Joystick): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickNumHats'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickNumHats} + +{ Get the number of buttons on a joystick } +function SDL_JoystickNumButtons(joystick: PSDL_Joystick): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickNumButtons'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickNumButtons} + +{ Update the current state of the open joysticks. + This is called automatically by the event loop if any joystick + events are enabled. } + +procedure SDL_JoystickUpdate; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickUpdate'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickUpdate;} + +{ Enable/disable joystick event polling. + If joystick events are disabled, you must call SDL_JoystickUpdate() + yourself and check the state of the joystick when you want joystick + information. + The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE. } + +function SDL_JoystickEventState(state: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickEventState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickEventState} + +{ Get the current state of an axis control on a joystick + The state is a value ranging from -32768 to 32767. + The axis indices start at index 0. } + +function SDL_JoystickGetAxis(joystick: PSDL_Joystick; axis: Integer) : SInt16; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickGetAxis'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickGetAxis} + +{ The hat indices start at index 0. } + +function SDL_JoystickGetHat(joystick: PSDL_Joystick; hat: Integer): UInt8; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickGetHat'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickGetHat} + +{ Get the ball axis change since the last poll + This returns 0, or -1 if you passed it invalid parameters. + The ball indices start at index 0. } + +function SDL_JoystickGetBall(joystick: PSDL_Joystick; ball: Integer; var dx: Integer; var dy: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickGetBall'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickGetBall} + +{ Get the current state of a button on a joystick + The button indices start at index 0. } +function SDL_JoystickGetButton( joystick: PSDL_Joystick; Button: Integer): UInt8; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickGetButton'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickGetButton} + +{ Close a joystick previously opened with SDL_JoystickOpen() } +procedure SDL_JoystickClose(joystick: PSDL_Joystick); +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickClose'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickClose} + +{------------------------------------------------------------------------------} +{ event-handling } +{------------------------------------------------------------------------------} + +{ Pumps the event loop, gathering events from the input devices. + This function updates the event queue and internal input device state. + This should only be run in the thread that sets the video mode. } + +procedure SDL_PumpEvents; +cdecl; external {$IFDEF __GPC__}name 'SDL_PumpEvents'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_PumpEvents;} + +{ Checks the event queue for messages and optionally returns them. + If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to + the back of the event queue. + If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front + of the event queue, matching 'mask', will be returned and will not + be removed from the queue. + If 'action' is SDL_GETEVENT, up to 'numevents' events at the front + of the event queue, matching 'mask', will be returned and will be + removed from the queue. + This function returns the number of events actually stored, or -1 + if there was an error. This function is thread-safe. } + +function SDL_PeepEvents(events: PSDL_Event; numevents: Integer; action: TSDL_eventaction; mask: UInt32): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_PeepEvents'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_PeepEvents} + +{ Polls for currently pending events, and returns 1 if there are any pending + events, or 0 if there are none available. If 'event' is not NULL, the next + event is removed from the queue and stored in that area. } + +function SDL_PollEvent(event: PSDL_Event): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_PollEvent'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_PollEvent} + +{ Waits indefinitely for the next available event, returning 1, or 0 if there + was an error while waiting for events. If 'event' is not NULL, the next + event is removed from the queue and stored in that area. } + +function SDL_WaitEvent(event: PSDL_Event): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_WaitEvent'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_WaitEvent} + +function SDL_PushEvent( event : PSDL_Event ) : Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_PushEvent'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_PushEvent} + +{ If the filter returns 1, then the event will be added to the internal queue. + If it returns 0, then the event will be dropped from the queue, but the + internal state will still be updated. This allows selective filtering of + dynamically arriving events. + + WARNING: Be very careful of what you do in the event filter function, as + it may run in a different thread! + + There is one caveat when dealing with the SDL_QUITEVENT event type. The + event filter is only called when the window manager desires to close the + application window. If the event filter returns 1, then the window will + be closed, otherwise the window will remain open if possible. + If the quit event is generated by an interrupt signal, it will bypass the + internal queue and be delivered to the application at the next event poll. } +procedure SDL_SetEventFilter( filter : TSDL_EventFilter ); +cdecl; external {$IFDEF __GPC__}name 'SDL_SetEventFilter'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetEventFilter} + +{ Return the current event filter - can be used to "chain" filters. + If there is no event filter set, this function returns NULL. } + +function SDL_GetEventFilter: TSDL_EventFilter; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetEventFilter'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetEventFilter} + +{ This function allows you to set the state of processing certain events. + If 'state' is set to SDL_IGNORE, that event will be automatically dropped + from the event queue and will not event be filtered. + If 'state' is set to SDL_ENABLE, that event will be processed normally. + If 'state' is set to SDL_QUERY, SDL_EventState() will return the + current processing state of the specified event. } + +function SDL_EventState(type_: UInt8; state: Integer): UInt8; +cdecl; external {$IFDEF __GPC__}name 'SDL_EventState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_EventState} + +{------------------------------------------------------------------------------} +{ Version Routines } +{------------------------------------------------------------------------------} + +{ This macro can be used to fill a version structure with the compile-time + version of the SDL library. } +procedure SDL_VERSION(var X: TSDL_Version); +{$EXTERNALSYM SDL_VERSION} + +{ This macro turns the version numbers into a numeric value: + (1,2,3) -> (1203) + This assumes that there will never be more than 100 patchlevels } + +function SDL_VERSIONNUM(X, Y, Z: Integer): Integer; +{$EXTERNALSYM SDL_VERSIONNUM} + +// This is the version number macro for the current SDL version +function SDL_COMPILEDVERSION: Integer; +{$EXTERNALSYM SDL_COMPILEDVERSION} + +// This macro will evaluate to true if compiled with SDL at least X.Y.Z +function SDL_VERSION_ATLEAST(X: Integer; Y: Integer; Z: Integer) : LongBool; +{$EXTERNALSYM SDL_VERSION_ATLEAST} + +{ This function gets the version of the dynamically linked SDL library. + it should NOT be used to fill a version structure, instead you should + use the SDL_Version() macro. } + +function SDL_Linked_Version: PSDL_version; +cdecl; external {$IFDEF __GPC__}name 'SDL_Linked_Version'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_Linked_Version} + +{------------------------------------------------------------------------------} +{ video } +{------------------------------------------------------------------------------} + +{ These functions are used internally, and should not be used unless you + have a specific need to specify the video driver you want to use. + You should normally use SDL_Init() or SDL_InitSubSystem(). + + SDL_VideoInit() initializes the video subsystem -- sets up a connection + to the window manager, etc, and determines the current video mode and + pixel format, but does not initialize a window or graphics mode. + Note that event handling is activated by this routine. + + If you use both sound and video in your application, you need to call + SDL_Init() before opening the sound device, otherwise under Win32 DirectX, + you won't be able to set full-screen display modes. } + +function SDL_VideoInit(driver_name: PChar; flags: UInt32): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_VideoInit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_VideoInit} +procedure SDL_VideoQuit; +cdecl; external {$IFDEF __GPC__}name 'SDL_VideoQuit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_VideoQuit} + +{ This function fills the given character buffer with the name of the + video driver, and returns a pointer to it if the video driver has + been initialized. It returns NULL if no driver has been initialized. } + +function SDL_VideoDriverName(namebuf: PChar; maxlen: Integer): PChar; +cdecl; external {$IFDEF __GPC__}name 'SDL_VideoDriverName'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_VideoDriverName} + +{ This function returns a pointer to the current display surface. + If SDL is doing format conversion on the display surface, this + function returns the publicly visible surface, not the real video + surface. } + +function SDL_GetVideoSurface: PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetVideoSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetVideoSurface} + +{ This function returns a read-only pointer to information about the + video hardware. If this is called before SDL_SetVideoMode(), the 'vfmt' + member of the returned structure will contain the pixel format of the + "best" video mode. } +function SDL_GetVideoInfo: PSDL_VideoInfo; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetVideoInfo'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetVideoInfo} + +{ Check to see if a particular video mode is supported. + It returns 0 if the requested mode is not supported under any bit depth, + or returns the bits-per-pixel of the closest available mode with the + given width and height. If this bits-per-pixel is different from the + one used when setting the video mode, SDL_SetVideoMode() will succeed, + but will emulate the requested bits-per-pixel with a shadow surface. + + The arguments to SDL_VideoModeOK() are the same ones you would pass to + SDL_SetVideoMode() } + +function SDL_VideoModeOK(width, height, bpp: Integer; flags: UInt32): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_VideoModeOK'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_VideoModeOK} + +{ Return a pointer to an array of available screen dimensions for the + given format and video flags, sorted largest to smallest. Returns + NULL if there are no dimensions available for a particular format, + or (SDL_Rect **)-1 if any dimension is okay for the given format. + + if 'format' is NULL, the mode list will be for the format given + by SDL_GetVideoInfo( ) - > vfmt } + +function SDL_ListModes(format: PSDL_PixelFormat; flags: UInt32): PPSDL_Rect; +cdecl; external {$IFDEF __GPC__}name 'SDL_ListModes'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_ListModes} + + +{ Set up a video mode with the specified width, height and bits-per-pixel. + + If 'bpp' is 0, it is treated as the current display bits per pixel. + + If SDL_ANYFORMAT is set in 'flags', the SDL library will try to set the + requested bits-per-pixel, but will return whatever video pixel format is + available. The default is to emulate the requested pixel format if it + is not natively available. + + If SDL_HWSURFACE is set in 'flags', the video surface will be placed in + video memory, if possible, and you may have to call SDL_LockSurface() + in order to access the raw framebuffer. Otherwise, the video surface + will be created in system memory. + + If SDL_ASYNCBLIT is set in 'flags', SDL will try to perform rectangle + updates asynchronously, but you must always lock before accessing pixels. + SDL will wait for updates to complete before returning from the lock. + + If SDL_HWPALETTE is set in 'flags', the SDL library will guarantee + that the colors set by SDL_SetColors() will be the colors you get. + Otherwise, in 8-bit mode, SDL_SetColors() may not be able to set all + of the colors exactly the way they are requested, and you should look + at the video surface structure to determine the actual palette. + If SDL cannot guarantee that the colors you request can be set, + i.e. if the colormap is shared, then the video surface may be created + under emulation in system memory, overriding the SDL_HWSURFACE flag. + + If SDL_FULLSCREEN is set in 'flags', the SDL library will try to set + a fullscreen video mode. The default is to create a windowed mode + if the current graphics system has a window manager. + If the SDL library is able to set a fullscreen video mode, this flag + will be set in the surface that is returned. + + If SDL_DOUBLEBUF is set in 'flags', the SDL library will try to set up + two surfaces in video memory and swap between them when you call + SDL_Flip(). This is usually slower than the normal single-buffering + scheme, but prevents "tearing" artifacts caused by modifying video + memory while the monitor is refreshing. It should only be used by + applications that redraw the entire screen on every update. + + This function returns the video framebuffer surface, or NULL if it fails. } + +function SDL_SetVideoMode(width, height, bpp: Integer; flags: UInt32): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'SDL_SetVideoMode'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetVideoMode} + + +{ Makes sure the given list of rectangles is updated on the given screen. + If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire + screen. + These functions should not be called while 'screen' is locked. } + +procedure SDL_UpdateRects(screen: PSDL_Surface; numrects: Integer; rects: PSDL_Rect); +cdecl; external {$IFDEF __GPC__}name 'SDL_UpdateRects'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_UpdateRects} +procedure SDL_UpdateRect(screen: PSDL_Surface; x, y: SInt32; w, h: UInt32); +cdecl; external {$IFDEF __GPC__}name 'SDL_UpdateRect'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_UpdateRect} + + +{ On hardware that supports double-buffering, this function sets up a flip + and returns. The hardware will wait for vertical retrace, and then swap + video buffers before the next video surface blit or lock will return. + On hardware that doesn not support double-buffering, this is equivalent + to calling SDL_UpdateRect(screen, 0, 0, 0, 0); + The SDL_DOUBLEBUF flag must have been passed to SDL_SetVideoMode() when + setting the video mode for this function to perform hardware flipping. + This function returns 0 if successful, or -1 if there was an error.} + +function SDL_Flip(screen: PSDL_Surface): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_Flip'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_Flip} + +{ Set the gamma correction for each of the color channels. + The gamma values range (approximately) between 0.1 and 10.0 + + If this function isn't supported directly by the hardware, it will + be emulated using gamma ramps, if available. If successful, this + function returns 0, otherwise it returns -1. } + +function SDL_SetGamma(redgamma: single; greengamma: single; bluegamma: single ): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SetGamma'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetGamma} + +{ Set the gamma translation table for the red, green, and blue channels + of the video hardware. Each table is an array of 256 16-bit quantities, + representing a mapping between the input and output for that channel. + The input is the index into the array, and the output is the 16-bit + gamma value at that index, scaled to the output color precision. + + You may pass NULL for any of the channels to leave it unchanged. + If the call succeeds, it will return 0. If the display driver or + hardware does not support gamma translation, or otherwise fails, + this function will return -1. } + +function SDL_SetGammaRamp( redtable: PUInt16; greentable: PUInt16; bluetable: PUInt16): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SetGammaRamp'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetGammaRamp} + +{ Retrieve the current values of the gamma translation tables. + + You must pass in valid pointers to arrays of 256 16-bit quantities. + Any of the pointers may be NULL to ignore that channel. + If the call succeeds, it will return 0. If the display driver or + hardware does not support gamma translation, or otherwise fails, + this function will return -1. } + +function SDL_GetGammaRamp( redtable: PUInt16; greentable: PUInt16; bluetable: PUInt16): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetGammaRamp'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetGammaRamp} + +{ Sets a portion of the colormap for the given 8-bit surface. If 'surface' + is not a palettized surface, this function does nothing, returning 0. + If all of the colors were set as passed to SDL_SetColors(), it will + return 1. If not all the color entries were set exactly as given, + it will return 0, and you should look at the surface palette to + determine the actual color palette. + + When 'surface' is the surface associated with the current display, the + display colormap will be updated with the requested colors. If + SDL_HWPALETTE was set in SDL_SetVideoMode() flags, SDL_SetColors() + will always return 1, and the palette is guaranteed to be set the way + you desire, even if the window colormap has to be warped or run under + emulation. } + + +function SDL_SetColors(surface: PSDL_Surface; colors: PSDL_Color; firstcolor : Integer; ncolors: Integer) : Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SetColors'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetColors} + +{ Sets a portion of the colormap for a given 8-bit surface. + 'flags' is one or both of: + SDL_LOGPAL -- set logical palette, which controls how blits are mapped + to/from the surface, + SDL_PHYSPAL -- set physical palette, which controls how pixels look on + the screen + Only screens have physical palettes. Separate change of physical/logical + palettes is only possible if the screen has SDL_HWPALETTE set. + + The return value is 1 if all colours could be set as requested, and 0 + otherwise. + + SDL_SetColors() is equivalent to calling this function with + flags = (SDL_LOGPAL or SDL_PHYSPAL). } + +function SDL_SetPalette(surface: PSDL_Surface; flags: Integer; colors: PSDL_Color; firstcolor: Integer; ncolors: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SetPalette'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetPalette} + +{ Maps an RGB triple to an opaque pixel value for a given pixel format } +function SDL_MapRGB(format: PSDL_PixelFormat; r: UInt8; g: UInt8; b: UInt8) : UInt32; +cdecl; external {$IFDEF __GPC__}name 'SDL_MapRGB'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_MapRGB} + +{ Maps an RGBA quadruple to a pixel value for a given pixel format } +function SDL_MapRGBA(format: PSDL_PixelFormat; r: UInt8; g: UInt8; b: UInt8; a: UInt8): UInt32; +cdecl; external {$IFDEF __GPC__}name 'SDL_MapRGBA'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_MapRGBA} + +{ Maps a pixel value into the RGB components for a given pixel format } +procedure SDL_GetRGB(pixel: UInt32; fmt: PSDL_PixelFormat; r: PUInt8; g: PUInt8; b: PUInt8); +cdecl; external {$IFDEF __GPC__}name 'SDL_GetRGB'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetRGB} + +{ Maps a pixel value into the RGBA components for a given pixel format } +procedure SDL_GetRGBA(pixel: UInt32; fmt: PSDL_PixelFormat; r: PUInt8; g: PUInt8; b: PUInt8; a: PUInt8); +cdecl; external {$IFDEF __GPC__}name 'SDL_GetRGBA'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetRGBA} + +{ Allocate and free an RGB surface (must be called after SDL_SetVideoMode) + If the depth is 4 or 8 bits, an empty palette is allocated for the surface. + If the depth is greater than 8 bits, the pixel format is set using the + flags '[RGB]mask'. + If the function runs out of memory, it will return NULL. + + The 'flags' tell what kind of surface to create. + SDL_SWSURFACE means that the surface should be created in system memory. + SDL_HWSURFACE means that the surface should be created in video memory, + with the same format as the display surface. This is useful for surfaces + that will not change much, to take advantage of hardware acceleration + when being blitted to the display surface. + SDL_ASYNCBLIT means that SDL will try to perform asynchronous blits with + this surface, but you must always lock it before accessing the pixels. + SDL will wait for current blits to finish before returning from the lock. + SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits. + If the hardware supports acceleration of colorkey blits between + two surfaces in video memory, SDL will try to place the surface in + video memory. If this isn't possible or if there is no hardware + acceleration available, the surface will be placed in system memory. + SDL_SRCALPHA means that the surface will be used for alpha blits and + if the hardware supports hardware acceleration of alpha blits between + two surfaces in video memory, to place the surface in video memory + if possible, otherwise it will be placed in system memory. + If the surface is created in video memory, blits will be _much_ faster, + but the surface format must be identical to the video surface format, + and the only way to access the pixels member of the surface is to use + the SDL_LockSurface() and SDL_UnlockSurface() calls. + If the requested surface actually resides in video memory, SDL_HWSURFACE + will be set in the flags member of the returned surface. If for some + reason the surface could not be placed in video memory, it will not have + the SDL_HWSURFACE flag set, and will be created in system memory instead. } + +function SDL_AllocSurface(flags: UInt32; width, height, depth: Integer; + RMask, GMask, BMask, AMask: UInt32): PSDL_Surface; +{$EXTERNALSYM SDL_AllocSurface} + +function SDL_CreateRGBSurface(flags: UInt32; width, height, depth: Integer; RMask, GMask, BMask, AMask: UInt32): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'SDL_CreateRGBSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CreateRGBSurface} + +function SDL_CreateRGBSurfaceFrom(pixels: Pointer; width, height, depth, pitch + : Integer; RMask, GMask, BMask, AMask: UInt32): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'SDL_CreateRGBSurfaceFrom'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CreateRGBSurfaceFrom} + +procedure SDL_FreeSurface(surface: PSDL_Surface); +cdecl; external {$IFDEF __GPC__}name 'SDL_FreeSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_FreeSurface} + +function SDL_MustLock(Surface: PSDL_Surface): Boolean; +{$EXTERNALSYM SDL_MustLock} +{ SDL_LockSurface() sets up a surface for directly accessing the pixels. + Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write + to and read from 'surface->pixels', using the pixel format stored in + 'surface->format'. Once you are done accessing the surface, you should + use SDL_UnlockSurface() to release it. + + Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates + to 0, then you can read and write to the surface at any time, and the + pixel format of the surface will not change. In particular, if the + SDL_HWSURFACE flag is not given when calling SDL_SetVideoMode(), you + will not need to lock the display surface before accessing it. + + No operating system or library calls should be made between lock/unlock + pairs, as critical system locks may be held during this time. + + SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. } +function SDL_LockSurface(surface: PSDL_Surface): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_LockSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_LockSurface} + +procedure SDL_UnlockSurface(surface: PSDL_Surface); +cdecl; external {$IFDEF __GPC__}name 'SDL_UnlockSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_UnlockSurface} + +{ Load a surface from a seekable SDL data source (memory or file.) + If 'freesrc' is non-zero, the source will be closed after being read. + Returns the new surface, or NULL if there was an error. + The new surface should be freed with SDL_FreeSurface(). } +function SDL_LoadBMP_RW(src: PSDL_RWops; freesrc: Integer): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'SDL_LoadBMP_RW'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_LoadBMP_RW} + +// Convenience macro -- load a surface from a file +function SDL_LoadBMP(filename: PChar): PSDL_Surface; +{$EXTERNALSYM SDL_LoadBMP} + +{ Save a surface to a seekable SDL data source (memory or file.) + If 'freedst' is non-zero, the source will be closed after being written. + Returns 0 if successful or -1 if there was an error. } + +function SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SaveBMP_RW'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SaveBMP_RW} + +// Convenience macro -- save a surface to a file +function SDL_SaveBMP(surface: PSDL_Surface; filename: PChar): Integer; +{$EXTERNALSYM SDL_SaveBMP} + +{ Sets the color key (transparent pixel) in a blittable surface. + If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL), + 'key' will be the transparent pixel in the source image of a blit. + SDL_RLEACCEL requests RLE acceleration for the surface if present, + and removes RLE acceleration if absent. + If 'flag' is 0, this function clears any current color key. + This function returns 0, or -1 if there was an error. } + +function SDL_SetColorKey(surface: PSDL_Surface; flag, key: UInt32) : Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SetColorKey'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetColorKey} + +{ This function sets the alpha value for the entire surface, as opposed to + using the alpha component of each pixel. This value measures the range + of transparency of the surface, 0 being completely transparent to 255 + being completely opaque. An 'alpha' value of 255 causes blits to be + opaque, the source pixels copied to the destination (the default). Note + that per-surface alpha can be combined with colorkey transparency. + + If 'flag' is 0, alpha blending is disabled for the surface. + If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface. + OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the + surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed. } + + +function SDL_SetAlpha(surface: PSDL_Surface; flag: UInt32; alpha: UInt8): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SetAlpha'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetAlpha} + +{ Sets the clipping rectangle for the destination surface in a blit. + + If the clip rectangle is NULL, clipping will be disabled. + If the clip rectangle doesn't intersect the surface, the function will + return SDL_FALSE and blits will be completely clipped. Otherwise the + function returns SDL_TRUE and blits to the surface will be clipped to + the intersection of the surface area and the clipping rectangle. + + Note that blits are automatically clipped to the edges of the source + and destination surfaces. } +procedure SDL_SetClipRect(surface: PSDL_Surface; rect: PSDL_Rect); cdecl; +external {$IFDEF __GPC__}name 'SDL_SetClipRect'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetClipRect} + +{ Gets the clipping rectangle for the destination surface in a blit. + 'rect' must be a pointer to a valid rectangle which will be filled + with the correct values. } +procedure SDL_GetClipRect(surface: PSDL_Surface; rect: PSDL_Rect); cdecl; +external {$IFDEF __GPC__}name 'SDL_GetClipRect'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetClipRect} + +{ Creates a new surface of the specified format, and then copies and maps + the given surface to it so the blit of the converted surface will be as + fast as possible. If this function fails, it returns NULL. + + The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those + semantics. You can also pass SDL_RLEACCEL in the flags parameter and + SDL will try to RLE accelerate colorkey and alpha blits in the resulting + surface. + + This function is used internally by SDL_DisplayFormat(). } + +function SDL_ConvertSurface(src: PSDL_Surface; fmt: PSDL_PixelFormat; flags: UInt32): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'SDL_ConvertSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_ConvertSurface} + +{ + This performs a fast blit from the source surface to the destination + surface. It assumes that the source and destination rectangles are + the same size. If either 'srcrect' or 'dstrect' are NULL, the entire + surface (src or dst) is copied. The final blit rectangles are saved + in 'srcrect' and 'dstrect' after all clipping is performed. + If the blit is successful, it returns 0, otherwise it returns -1. + + The blit function should not be called on a locked surface. + + The blit semantics for surfaces with and without alpha and colorkey + are defined as follows: + + RGBA->RGB: + SDL_SRCALPHA set: + alpha-blend (using alpha-channel). + SDL_SRCCOLORKEY ignored. + SDL_SRCALPHA not set: + copy RGB. + if SDL_SRCCOLORKEY set, only copy the pixels matching the + RGB values of the source colour key, ignoring alpha in the + comparison. + + RGB->RGBA: + SDL_SRCALPHA set: + alpha-blend (using the source per-surface alpha value); + set destination alpha to opaque. + SDL_SRCALPHA not set: + copy RGB, set destination alpha to opaque. + both: + if SDL_SRCCOLORKEY set, only copy the pixels matching the + source colour key. + + RGBA->RGBA: + SDL_SRCALPHA set: + alpha-blend (using the source alpha channel) the RGB values; + leave destination alpha untouched. [Note: is this correct?] + SDL_SRCCOLORKEY ignored. + SDL_SRCALPHA not set: + copy all of RGBA to the destination. + if SDL_SRCCOLORKEY set, only copy the pixels matching the + RGB values of the source colour key, ignoring alpha in the + comparison. + + RGB->RGB: + SDL_SRCALPHA set: + alpha-blend (using the source per-surface alpha value). + SDL_SRCALPHA not set: + copy RGB. + both: + if SDL_SRCCOLORKEY set, only copy the pixels matching the + source colour key. + + If either of the surfaces were in video memory, and the blit returns -2, + the video memory was lost, so it should be reloaded with artwork and + re-blitted: + while ( SDL_BlitSurface(image, imgrect, screen, dstrect) = -2 ) do + begin + while ( SDL_LockSurface(image) < 0 ) do + Sleep(10); + -- Write image pixels to image->pixels -- + SDL_UnlockSurface(image); + end; + + This happens under DirectX 5.0 when the system switches away from your + fullscreen application. The lock will also fail until you have access + to the video memory again. } + +{ You should call SDL_BlitSurface() unless you know exactly how SDL + blitting works internally and how to use the other blit functions. } + +function SDL_BlitSurface(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): Integer; +{$EXTERNALSYM SDL_BlitSurface} + +{ This is the public blit function, SDL_BlitSurface(), and it performs + rectangle validation and clipping before passing it to SDL_LowerBlit() } +function SDL_UpperBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_UpperBlit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_UpperBlit} + +{ This is a semi-private blit function and it performs low-level surface + blitting only. } +function SDL_LowerBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_LowerBlit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_LowerBlit} + +{ This function performs a fast fill of the given rectangle with 'color' + The given rectangle is clipped to the destination surface clip area + and the final fill rectangle is saved in the passed in pointer. + If 'dstrect' is NULL, the whole surface will be filled with 'color' + The color should be a pixel of the format used by the surface, and + can be generated by the SDL_MapRGB() function. + This function returns 0 on success, or -1 on error. } + +function SDL_FillRect(dst: PSDL_Surface; dstrect: PSDL_Rect; color: UInt32) : Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_FillRect'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_FillRect} + +{ This function takes a surface and copies it to a new surface of the + pixel format and colors of the video framebuffer, suitable for fast + blitting onto the display surface. It calls SDL_ConvertSurface() + + If you want to take advantage of hardware colorkey or alpha blit + acceleration, you should set the colorkey and alpha value before + calling this function. + + If the conversion fails or runs out of memory, it returns NULL } + +function SDL_DisplayFormat(surface: PSDL_Surface): PSDL_Surface; cdecl; +external {$IFDEF __GPC__}name 'SDL_DisplayFormat'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_DisplayFormat} + +{ This function takes a surface and copies it to a new surface of the + pixel format and colors of the video framebuffer (if possible), + suitable for fast alpha blitting onto the display surface. + The new surface will always have an alpha channel. + + If you want to take advantage of hardware colorkey or alpha blit + acceleration, you should set the colorkey and alpha value before + calling this function. + + If the conversion fails or runs out of memory, it returns NULL } + + +function SDL_DisplayFormatAlpha(surface: PSDL_Surface): PSDL_Surface; cdecl; +external {$IFDEF __GPC__}name 'SDL_DisplayFormatAlpha'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_DisplayFormatAlpha} + +//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +//* YUV video surface overlay functions */ +//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +{ This function creates a video output overlay + Calling the returned surface an overlay is something of a misnomer because + the contents of the display surface underneath the area where the overlay + is shown is undefined - it may be overwritten with the converted YUV data. } + +function SDL_CreateYUVOverlay(width: Integer; height: Integer; format: UInt32; display: PSDL_Surface): PSDL_Overlay; +cdecl; external {$IFDEF __GPC__}name 'SDL_CreateYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CreateYUVOverlay} + +// Lock an overlay for direct access, and unlock it when you are done +function SDL_LockYUVOverlay(Overlay: PSDL_Overlay): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_LockYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_LockYUVOverlay} + +procedure SDL_UnlockYUVOverlay(Overlay: PSDL_Overlay); cdecl; +external {$IFDEF __GPC__}name 'SDL_UnlockYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_UnlockYUVOverlay} + + +{ Blit a video overlay to the display surface. + The contents of the video surface underneath the blit destination are + not defined. + The width and height of the destination rectangle may be different from + that of the overlay, but currently only 2x scaling is supported. } + +function SDL_DisplayYUVOverlay(Overlay: PSDL_Overlay; dstrect: PSDL_Rect) : Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_DisplayYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_DisplayYUVOverlay} + +// Free a video overlay +procedure SDL_FreeYUVOverlay(Overlay: PSDL_Overlay); +cdecl; external {$IFDEF __GPC__}name 'SDL_FreeYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_FreeYUVOverlay} + +{------------------------------------------------------------------------------} +{ OpenGL Routines } +{------------------------------------------------------------------------------} + +{ Dynamically load a GL driver, if SDL is built with dynamic GL. + + SDL links normally with the OpenGL library on your system by default, + but you can compile it to dynamically load the GL driver at runtime. + If you do this, you need to retrieve all of the GL functions used in + your program from the dynamic library using SDL_GL_GetProcAddress(). + + This is disabled in default builds of SDL. } + + +function SDL_GL_LoadLibrary(filename: PChar): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_GL_LoadLibrary'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GL_LoadLibrary} + +{ Get the address of a GL function (for extension functions) } +function SDL_GL_GetProcAddress(procname: PChar) : Pointer; +cdecl; external {$IFDEF __GPC__}name 'SDL_GL_GetProcAddress'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GL_GetProcAddress} + +{ Set an attribute of the OpenGL subsystem before intialization. } +function SDL_GL_SetAttribute(attr: TSDL_GLAttr; value: Integer) : Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_GL_SetAttribute'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GL_SetAttribute} + +{ Get an attribute of the OpenGL subsystem from the windowing + interface, such as glX. This is of course different from getting + the values from SDL's internal OpenGL subsystem, which only + stores the values you request before initialization. + + Developers should track the values they pass into SDL_GL_SetAttribute + themselves if they want to retrieve these values. } + +function SDL_GL_GetAttribute(attr: TSDL_GLAttr; var value: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_GL_GetAttribute'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GL_GetAttribute} + +{ Swap the OpenGL buffers, if double-buffering is supported. } + +procedure SDL_GL_SwapBuffers; +cdecl; external {$IFDEF __GPC__}name 'SDL_GL_SwapBuffers'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GL_SwapBuffers;} + +{ Internal functions that should not be called unless you have read + and understood the source code for these functions. } + +procedure SDL_GL_UpdateRects(numrects: Integer; rects: PSDL_Rect); +cdecl; external {$IFDEF __GPC__}name 'SDL_GL_UpdateRects'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GL_UpdateRects} +procedure SDL_GL_Lock; +cdecl; external {$IFDEF __GPC__}name 'SDL_GL_Lock'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GL_Lock;} +procedure SDL_GL_Unlock; +cdecl; external {$IFDEF __GPC__}name 'SDL_GL_Unlock'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GL_Unlock;} + +{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} +{* These functions allow interaction with the window manager, if any. *} +{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} + +{ Sets/Gets the title and icon text of the display window } +procedure SDL_WM_GetCaption(var title : PChar; var icon : PChar); +cdecl; external {$IFDEF __GPC__}name 'SDL_WM_GetCaption'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_WM_GetCaption} +procedure SDL_WM_SetCaption( const title : PChar; const icon : PChar); +cdecl; external {$IFDEF __GPC__}name 'SDL_WM_SetCaption'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_WM_SetCaption} + +{ Sets the icon for the display window. + This function must be called before the first call to SDL_SetVideoMode(). + It takes an icon surface, and a mask in MSB format. + If 'mask' is NULL, the entire icon surface will be used as the icon. } +procedure SDL_WM_SetIcon(icon: PSDL_Surface; mask: UInt8); +cdecl; external {$IFDEF __GPC__}name 'SDL_WM_SetIcon'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_WM_SetIcon} + +{ This function iconifies the window, and returns 1 if it succeeded. + If the function succeeds, it generates an SDL_APPACTIVE loss event. + This function is a noop and returns 0 in non-windowed environments. } + +function SDL_WM_IconifyWindow: Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_WM_IconifyWindow'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_WM_IconifyWindow} + +{ Toggle fullscreen mode without changing the contents of the screen. + If the display surface does not require locking before accessing + the pixel information, then the memory pointers will not change. + + If this function was able to toggle fullscreen mode (change from + running in a window to fullscreen, or vice-versa), it will return 1. + If it is not implemented, or fails, it returns 0. + + The next call to SDL_SetVideoMode() will set the mode fullscreen + attribute based on the flags parameter - if SDL_FULLSCREEN is not + set, then the display will be windowed by default where supported. + + This is currently only implemented in the X11 video driver. } + +function SDL_WM_ToggleFullScreen(surface: PSDL_Surface): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_WM_ToggleFullScreen'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_WM_ToggleFullScreen} + +{ Grabbing means that the mouse is confined to the application window, + and nearly all keyboard input is passed directly to the application, + and not interpreted by a window manager, if any. } + +function SDL_WM_GrabInput(mode: TSDL_GrabMode): TSDL_GrabMode; +cdecl; external {$IFDEF __GPC__}name 'SDL_WM_GrabInput'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_WM_GrabInput} + +{------------------------------------------------------------------------------} +{ mouse-routines } +{------------------------------------------------------------------------------} + +{ Retrieve the current state of the mouse. + The current button state is returned as a button bitmask, which can + be tested using the SDL_BUTTON(X) macros, and x and y are set to the + current mouse cursor position. You can pass NULL for either x or y. } + +function SDL_GetMouseState(var x: Integer; var y: Integer): UInt8; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetMouseState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetMouseState} + +{ Retrieve the current state of the mouse. + The current button state is returned as a button bitmask, which can + be tested using the SDL_BUTTON(X) macros, and x and y are set to the + mouse deltas since the last call to SDL_GetRelativeMouseState(). } +function SDL_GetRelativeMouseState(var x: Integer; var y: Integer): UInt8; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetRelativeMouseState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetRelativeMouseState} + +{ Set the position of the mouse cursor (generates a mouse motion event) } +procedure SDL_WarpMouse(x, y: UInt16); +cdecl; external {$IFDEF __GPC__}name 'SDL_WarpMouse'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_WarpMouse} + +{ Create a cursor using the specified data and mask (in MSB format). + The cursor width must be a multiple of 8 bits. + + The cursor is created in black and white according to the following: + data mask resulting pixel on screen + 0 1 White + 1 1 Black + 0 0 Transparent + 1 0 Inverted color if possible, black if not. + + Cursors created with this function must be freed with SDL_FreeCursor(). } +function SDL_CreateCursor(data, mask: PUInt8; w, h, hot_x, hot_y: Integer): PSDL_Cursor; +cdecl; external {$IFDEF __GPC__}name 'SDL_CreateCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CreateCursor} + +{ Set the currently active cursor to the specified one. + If the cursor is currently visible, the change will be immediately + represented on the display. } +procedure SDL_SetCursor(cursor: PSDL_Cursor); +cdecl; external {$IFDEF __GPC__}name 'SDL_SetCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetCursor} + +{ Returns the currently active cursor. } +function SDL_GetCursor: PSDL_Cursor; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetCursor} + +{ Deallocates a cursor created with SDL_CreateCursor(). } +procedure SDL_FreeCursor(cursor: PSDL_Cursor); +cdecl; external {$IFDEF __GPC__}name 'SDL_FreeCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_FreeCursor} + +{ Toggle whether or not the cursor is shown on the screen. + The cursor start off displayed, but can be turned off. + SDL_ShowCursor() returns 1 if the cursor was being displayed + before the call, or 0 if it was not. You can query the current + state by passing a 'toggle' value of -1. } +function SDL_ShowCursor(toggle: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_ShowCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_ShowCursor} + +function SDL_BUTTON( Button : Integer ) : Integer; + +{------------------------------------------------------------------------------} +{ Keyboard-routines } +{------------------------------------------------------------------------------} + +{ Enable/Disable UNICODE translation of keyboard input. + This translation has some overhead, so translation defaults off. + If 'enable' is 1, translation is enabled. + If 'enable' is 0, translation is disabled. + If 'enable' is -1, the translation state is not changed. + It returns the previous state of keyboard translation. } +function SDL_EnableUNICODE(enable: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_EnableUNICODE'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_EnableUNICODE} + +{ If 'delay' is set to 0, keyboard repeat is disabled. } +function SDL_EnableKeyRepeat(delay: Integer; interval: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_EnableKeyRepeat'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_EnableKeyRepeat} + +{ Get a snapshot of the current state of the keyboard. + Returns an array of keystates, indexed by the SDLK_* syms. + Used: + + UInt8 *keystate = SDL_GetKeyState(NULL); + if ( keystate[SDLK_RETURN] ) ... is pressed } + +function SDL_GetKeyState(numkeys: PInt): PUInt8; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetKeyState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetKeyState} + +{ Get the current key modifier state } +function SDL_GetModState: TSDLMod; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetModState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetModState} + +{ Set the current key modifier state + This does not change the keyboard state, only the key modifier flags. } +procedure SDL_SetModState(modstate: TSDLMod); +cdecl; external {$IFDEF __GPC__}name 'SDL_SetModState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetModState} + +{ Get the name of an SDL virtual keysym } +function SDL_GetKeyName(key: TSDLKey): PChar; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetKeyName'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetKeyName} + +{------------------------------------------------------------------------------} +{ Active Routines } +{------------------------------------------------------------------------------} + +{ This function returns the current state of the application, which is a + bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and + SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to + see your application, otherwise it has been iconified or disabled. } + +function SDL_GetAppState: UInt8; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetAppState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetAppState} + + +{ Mutex functions } + +{ Create a mutex, initialized unlocked } + +function SDL_CreateMutex: PSDL_Mutex; +cdecl; external {$IFDEF __GPC__}name 'SDL_CreateMutex'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CreateMutex} + +{ Lock the mutex (Returns 0, or -1 on error) } + + function SDL_mutexP(mutex: PSDL_mutex): Integer; + cdecl; external {$IFDEF __GPC__}name 'SDL_mutexP'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{ $ EXTERNALSYM SDL_mutexP} + +function SDL_LockMutex(mutex: PSDL_mutex): Integer; +{$EXTERNALSYM SDL_LockMutex} + +{ Unlock the mutex (Returns 0, or -1 on error) } +function SDL_mutexV(mutex: PSDL_mutex): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_mutexV'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_mutexV} + +function SDL_UnlockMutex(mutex: PSDL_mutex): Integer; +{$EXTERNALSYM SDL_UnlockMutex} + +{ Destroy a mutex } +procedure SDL_DestroyMutex(mutex: PSDL_mutex); +cdecl; external {$IFDEF __GPC__}name 'SDL_DestroyMutex'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_DestroyMutex} + +{ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } +{ Semaphore functions } +{ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } +{ Create a semaphore, initialized with value, returns NULL on failure. } +function SDL_CreateSemaphore(initial_value: UInt32): PSDL_Sem; +cdecl; external {$IFDEF __GPC__}name 'SDL_CreateSemaphore'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CreateSemaphore} + + +{ Destroy a semaphore } +procedure SDL_DestroySemaphore(sem: PSDL_sem); +cdecl; external {$IFDEF __GPC__}name 'SDL_DestroySemaphore'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_DestroySemaphore} + +{ This function suspends the calling thread until the semaphore pointed + to by sem has a positive count. It then atomically decreases the semaphore + count. } + +function SDL_SemWait(sem: PSDL_sem): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SemWait'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SemWait} + +{ Non-blocking variant of SDL_SemWait(), returns 0 if the wait succeeds, + SDL_MUTEX_TIMEDOUT if the wait would block, and -1 on error. } + +function SDL_SemTryWait(sem: PSDL_sem): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SemTryWait'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SemTryWait} + +{ Variant of SDL_SemWait() with a timeout in milliseconds, returns 0 if + the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not succeed in + the allotted time, and -1 on error. + On some platforms this function is implemented by looping with a delay + of 1 ms, and so should be avoided if possible. } + +function SDL_SemWaitTimeout(sem: PSDL_sem; ms: UInt32): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SemWaitTimeout'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SemTryWait} + +{ Atomically increases the semaphore's count (not blocking), returns 0, + or -1 on error. } + +function SDL_SemPost(sem: PSDL_sem): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SemPost'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SemTryWait} + +{ Returns the current count of the semaphore } + +function SDL_SemValue(sem: PSDL_sem): UInt32; +cdecl; external {$IFDEF __GPC__}name 'SDL_SemValue'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SemValue} + +{ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } +{ Condition variable functions } +{ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } +{ Create a condition variable } +function SDL_CreateCond: PSDL_Cond; +cdecl; external {$IFDEF __GPC__}name 'SDL_CreateCond'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CreateCond} + +{ Destroy a condition variable } +procedure SDL_DestroyCond(cond: PSDL_Cond); +cdecl; external {$IFDEF __GPC__}name 'SDL_DestroyCond'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_DestroyCond} + +{ Restart one of the threads that are waiting on the condition variable, + returns 0 or -1 on error. } + +function SDL_CondSignal(cond: PSDL_cond): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_CondSignal'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CondSignal} + +{ Restart all threads that are waiting on the condition variable, + returns 0 or -1 on error. } + +function SDL_CondBroadcast(cond: PSDL_cond): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_CondBroadcast'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CondBroadcast} + + +{ Wait on the condition variable, unlocking the provided mutex. + The mutex must be locked before entering this function! + Returns 0 when it is signaled, or -1 on error. } + +function SDL_CondWait(cond: PSDL_cond; mut: PSDL_mutex): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_CondWait'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CondWait} + +{ Waits for at most 'ms' milliseconds, and returns 0 if the condition + variable is signaled, SDL_MUTEX_TIMEDOUT if the condition is not + signaled in the allotted time, and -1 on error. + On some platforms this function is implemented by looping with a delay + of 1 ms, and so should be avoided if possible. } + +function SDL_CondWaitTimeout(cond: PSDL_cond; mut: PSDL_mutex; ms: UInt32) : Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_CondWaitTimeout'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CondWaitTimeout} + +{ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } +{ Condition variable functions } +{ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } + +{ Create a thread } +function SDL_CreateThread(fn: PInt; data: Pointer): PSDL_Thread; +cdecl; external {$IFDEF __GPC__}name 'SDL_CreateThread'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CreateThread} + +{ Get the 32-bit thread identifier for the current thread } +function SDL_ThreadID: UInt32; +cdecl; external {$IFDEF __GPC__}name 'SDL_ThreadID'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_ThreadID} + +{ Get the 32-bit thread identifier for the specified thread, + equivalent to SDL_ThreadID() if the specified thread is NULL. } +function SDL_GetThreadID(thread: PSDL_Thread): UInt32; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetThreadID'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetThreadID} + +{ Wait for a thread to finish. + The return code for the thread function is placed in the area + pointed to by 'status', if 'status' is not NULL. } + +procedure SDL_WaitThread(thread: PSDL_Thread; var status: Integer); +cdecl; external {$IFDEF __GPC__}name 'SDL_WaitThread'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_WaitThread} + +{ Forcefully kill a thread without worrying about its state } +procedure SDL_KillThread(thread: PSDL_Thread); +cdecl; external {$IFDEF __GPC__}name 'SDL_KillThread'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_KillThread} + +{------------------------------------------------------------------------------} +{ Get Environment Routines } +{------------------------------------------------------------------------------} +{$IFDEF WIN32} +function _putenv( const variable : Pchar ): integer; +cdecl; +{$ENDIF} + +{$IFDEF Unix} +{$IFDEF FPC} +function _putenv( const variable : Pchar ): integer; +cdecl; external 'libc.so' name 'putenv'; +{$ENDIF} +{$ENDIF} + +{ Put a variable of the form "name=value" into the environment } +//function SDL_putenv(const variable: PChar): integer; cdecl; external {$IFDEF __GPC__}name 'SDL_Init'{$ELSE} SDLLibName{$ENDIF __GPC__}SDLLibName name ''; +function SDL_putenv(const variable: PChar): integer; +{$EXTERNALSYM SDL_putenv} + +// The following function has been commented out to encourage developers to use +// SDL_putenv as it it more portable +//function putenv(const variable: PChar): integer; +//{$EXTERNALSYM putenv} + +{$IFDEF WIN32} +{$IFNDEF __GPC__} +function getenv( const name : Pchar ): PChar; cdecl; +{$ENDIF} +{$ENDIF} + +{* Retrieve a variable named "name" from the environment } +//function SDL_getenv(const name: PChar): PChar; cdecl; external {$IFDEF __GPC__}name 'SDL_Init'{$ELSE} SDLLibName{$ENDIF __GPC__}SDLLibName name ''; +function SDL_getenv(const name: PChar): PChar; +{$EXTERNALSYM SDL_getenv} + +// The following function has been commented out to encourage developers to use +// SDL_getenv as it it more portable +//function getenv(const name: PChar): PChar; +//{$EXTERNALSYM getenv} + +{* + * This function gives you custom hooks into the window manager information. + * It fills the structure pointed to by 'info' with custom information and + * returns 1 if the function is implemented. If it's not implemented, or + * the version member of the 'info' structure is invalid, it returns 0. + *} +function SDL_GetWMInfo(info : PSDL_SysWMinfo) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetWMInfo'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetWMInfo} + +{------------------------------------------------------------------------------} + +//SDL_loadso.h +{* This function dynamically loads a shared object and returns a pointer + * to the object handle (or NULL if there was an error). + * The 'sofile' parameter is a system dependent name of the object file. + *} +function SDL_LoadObject( const sofile : PChar ) : Pointer; +cdecl; external {$IFDEF __GPC__}name 'SDL_LoadObject'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_LoadObject} + +{* Given an object handle, this function looks up the address of the + * named function in the shared object and returns it. This address + * is no longer valid after calling SDL_UnloadObject(). + *} +function SDL_LoadFunction( handle : Pointer; const name : PChar ) : Pointer; +cdecl; external {$IFDEF __GPC__}name 'SDL_LoadFunction'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_LoadFunction} + +{* Unload a shared object from memory *} +procedure SDL_UnloadObject( handle : Pointer ); +cdecl; external {$IFDEF __GPC__}name 'SDL_UnloadObject'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_UnloadObject} + + + +{------------------------------------------------------------------------------} + +function SDL_Swap32(D: Uint32): Uint32; +{$EXTERNALSYM SDL_Swap32} + +{ FreeAndNil frees the given TObject instance and sets the variable reference + to nil. Be careful to only pass TObjects to this routine. } +procedure FreeAndNil(var Obj); + +{ Exit procedure handling } + +{ AddExitProc adds the given procedure to the run-time library's exit + procedure list. When an application terminates, its exit procedures are + executed in reverse order of definition, i.e. the last procedure passed + to AddExitProc is the first one to get executed upon termination. } +procedure AddExitProc(Proc: TProcedure); + +// Bitwise Checking functions +function IsBitOn( value : integer; bit : Byte ) : boolean; + +function TurnBitOn( value : integer; bit : Byte ) : integer; + +function TurnBitOff( value : integer; bit : Byte ) : integer; + +implementation + +{$IFDEF __GPC__} + {$L 'sdl'} { link sdl.dll.a or libsdl.so or libsdl.a } +{$ENDIF} + +function SDL_TABLESIZE(table: PChar): Integer; +begin + Result := SizeOf(table) div SizeOf(table[0]); +end; + +procedure SDL_OutOfMemory; +begin + {$IFNDEF WIN32} + SDL_Error(SDL_ENOMEM); + {$ENDIF} +end; + +function SDL_RWSeek(context: PSDL_RWops; offset: Integer; whence: Integer) : Integer; +begin + Result := context^.seek(context, offset, whence); +end; + +function SDL_RWTell(context: PSDL_RWops): Integer; +begin + Result := context^.seek(context, 0, 1); +end; + +function SDL_RWRead(context: PSDL_RWops; ptr: Pointer; size: Integer; n: Integer): Integer; +begin + Result := context^.read(context, ptr, size, n); +end; + +function SDL_RWWrite(context: PSDL_RWops; ptr: Pointer; size: Integer; n: Integer): Integer; +begin + Result := context^.write(context, ptr, size, n); +end; + +function SDL_RWClose(context: PSDL_RWops): Integer; +begin + Result := context^.close(context); +end; + +function SDL_LoadWAV(filename: PChar; spec: PSDL_AudioSpec; audio_buf: PUInt8; audiolen: PUInt32): PSDL_AudioSpec; +begin + Result := SDL_LoadWAV_RW(SDL_RWFromFile(filename, 'rb'), 1, spec, audio_buf, audiolen); +end; + +function SDL_CDInDrive( status : TSDL_CDStatus ): LongBool; +begin + Result := ord( status ) > ord( CD_ERROR ); +end; + +procedure FRAMES_TO_MSF(frames: Integer; var M: Integer; var S: Integer; var + F: Integer); +var + value: Integer; +begin + value := frames; + F := value mod CD_FPS; + value := value div CD_FPS; + S := value mod 60; + value := value div 60; + M := value; +end; + +function MSF_TO_FRAMES(M: Integer; S: Integer; F: Integer): Integer; +begin + Result := M * 60 * CD_FPS + S * CD_FPS + F; +end; + +procedure SDL_VERSION(var X: TSDL_Version); +begin + X.major := SDL_MAJOR_VERSION; + X.minor := SDL_MINOR_VERSION; + X.patch := SDL_PATCHLEVEL; +end; + +function SDL_VERSIONNUM(X, Y, Z: Integer): Integer; +begin + Result := X * 1000 + Y * 100 + Z; +end; + +function SDL_COMPILEDVERSION: Integer; +begin + Result := SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL + ); +end; + +function SDL_VERSION_ATLEAST(X, Y, Z: Integer): LongBool; +begin + Result := (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)); +end; + +function SDL_LoadBMP(filename: PChar): PSDL_Surface; +begin + Result := SDL_LoadBMP_RW(SDL_RWFromFile(filename, 'rb'), 1); +end; + +function SDL_SaveBMP(surface: PSDL_Surface; filename: PChar): Integer; +begin + Result := SDL_SaveBMP_RW(surface, SDL_RWFromFile(filename, 'wb'), 1); +end; + +function SDL_BlitSurface(src: PSDL_Surface; srcrect: PSDL_Rect; dst: + PSDL_Surface; + dstrect: PSDL_Rect): Integer; +begin + Result := SDL_UpperBlit(src, srcrect, dst, dstrect); +end; + +function SDL_AllocSurface(flags: UInt32; width, height, depth: Integer; + RMask, GMask, BMask, AMask: UInt32): PSDL_Surface; +begin + Result := SDL_CreateRGBSurface(flags, width, height, depth, RMask, GMask, + BMask, AMask); +end; + +function SDL_MustLock(Surface: PSDL_Surface): Boolean; +begin + Result := ( ( surface^.offset <> 0 ) or + ( ( surface^.flags and ( SDL_HWSURFACE or SDL_ASYNCBLIT or SDL_RLEACCEL ) ) <> 0 ) ); +end; + +function SDL_LockMutex(mutex: PSDL_mutex): Integer; +begin + Result := SDL_mutexP(mutex); +end; + +function SDL_UnlockMutex(mutex: PSDL_mutex): Integer; +begin + Result := SDL_mutexV(mutex); +end; + +{$IFDEF WIN32} +function _putenv( const variable : Pchar ): Integer; +cdecl; external {$IFDEF __GPC__}name '_putenv'{$ELSE} 'MSVCRT.DLL'{$ENDIF __GPC__}; +{$ENDIF} + + +function SDL_putenv(const variable: PChar): Integer; +begin + {$IFDEF WIN32} + Result := _putenv(variable); + {$ENDIF} + + {$IFDEF UNIX} + {$IFDEF FPC} + Result := _putenv(variable); + {$ELSE} + Result := libc.putenv(variable); + {$ENDIF} + {$ENDIF} +end; + +{$IFDEF WIN32} +{$IFNDEF __GPC__} +function getenv( const name : Pchar ): PChar; +cdecl; external {$IFDEF __GPC__}name 'getenv'{$ELSE} 'MSVCRT.DLL'{$ENDIF}; +{$ENDIF} +{$ENDIF} + +function SDL_getenv(const name: PChar): PChar; +begin + {$IFDEF WIN32} + + {$IFDEF __GPC__} + Result := getenv( string( name ) ); + {$ELSE} + Result := getenv( name ); + {$ENDIF} + + {$ELSE} + + {$IFDEF UNIX} + + {$IFDEF FPC} + Result := fpgetenv(name); + {$ELSE} + Result := libc.getenv(name); + {$ENDIF} + + {$ENDIF} + + {$ENDIF} +end; + +function SDL_BUTTON( Button : Integer ) : Integer; +begin + Result := SDL_PRESSED shl ( Button - 1 ); +end; + +function SDL_Swap32(D: Uint32): Uint32; +begin + Result := ((D shl 24) or ((D shl 8) and $00FF0000) or ((D shr 8) and $0000FF00) or (D shr 24)); +end; + +procedure FreeAndNil(var Obj); +{$IFNDEF __GPC__} +{$IFNDEF __TMT__} +var + Temp: TObject; +{$ENDIF} +{$ENDIF} +begin +{$IFNDEF __GPC__} +{$IFNDEF __TMT__} + Temp := TObject(Obj); + Pointer(Obj) := nil; + Temp.Free; +{$ENDIF} +{$ENDIF} +end; + +{ Exit procedure handling } +type + PExitProcInfo = ^TExitProcInfo; + TExitProcInfo = record + Next: PExitProcInfo; + SaveExit: Pointer; + Proc: TProcedure; + end; + +var + ExitProcList: PExitProcInfo = nil; + +procedure DoExitProc; +var + P: PExitProcInfo; + Proc: TProcedure; +begin + P := ExitProcList; + ExitProcList := P^.Next; + ExitProc := P^.SaveExit; + Proc := P^.Proc; + Dispose(P); + Proc; +end; + +procedure AddExitProc(Proc: TProcedure); +var + P: PExitProcInfo; +begin + New(P); + P^.Next := ExitProcList; + P^.SaveExit := ExitProc; + P^.Proc := Proc; + ExitProcList := P; + ExitProc := @DoExitProc; +end; + +function IsBitOn( value : integer; bit : Byte ) : boolean; +begin + result := ( ( value and ( 1 shl bit ) ) <> 0 ); +end; + +function TurnBitOn( value : integer; bit : Byte ) : integer; +begin + result := ( value or ( 1 shl bit ) ); +end; + +function TurnBitOff( value : integer; bit : Byte ) : integer; +begin + result := ( value and not ( 1 shl bit ) ); +end; + +end. + + diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdl_cpuinfo.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdl_cpuinfo.pas new file mode 100644 index 00000000..bd371c55 --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdl_cpuinfo.pas @@ -0,0 +1,155 @@ +unit sdl_cpuinfo; +{ + $Id: sdl_cpuinfo.pas,v 1.2 2004/02/18 22:52:53 savage Exp $ + +} +{******************************************************************************} +{ } +{ Borland Delphi SDL - Simple DirectMedia Layer } +{ Conversion of the Simple DirectMedia Layer Headers } +{ } +{ Portions created by Sam Lantinga are } +{ Copyright (C) 1997-2004 Sam Lantinga } +{ 5635-34 Springhouse Dr. } +{ Pleasanton, CA 94588 (USA) } +{ } +{ All Rights Reserved. } +{ } +{ The original files are : SDL_cpuinfo.h } +{ } +{ The initial developer of this Pascal code was : } +{ Dominqiue Louis } +{ } +{ Portions created by Dominqiue Louis are } +{ Copyright (C) 2000 - 2004 Dominqiue Louis. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ } +{ } +{ } +{ } +{ } +{ } +{ } +{ Requires } +{ -------- } +{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } +{ They are available from... } +{ http://www.libsdl.org . } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ + $Log: sdl_cpuinfo.pas,v $ + Revision 1.2 2004/02/18 22:52:53 savage + Forgot to add jedi-sdl.inc file. It's there now. + + Revision 1.1 2004/02/18 22:35:54 savage + Brought sdl.pas up to 1.2.7 compatability + Thus... + Added SDL_GL_STEREO, + SDL_GL_MULTISAMPLEBUFFERS, + SDL_GL_MULTISAMPLESAMPLES + + Add DLL/Shared object functions + function SDL_LoadObject( const sofile : PChar ) : Pointer; + + function SDL_LoadFunction( handle : Pointer; const name : PChar ) : Pointer; + + procedure SDL_UnloadObject( handle : Pointer ); + + Added function to create RWops from const memory: SDL_RWFromConstMem() + function SDL_RWFromConstMem(const mem: Pointer; size: Integer) : PSDL_RWops; + + Ported SDL_cpuinfo.h so Now you can test for Specific CPU types. + + +} +{******************************************************************************} + +interface + +{$I jedi-sdl.inc} + +uses + sdl; + +{* This function returns true if the CPU has the RDTSC instruction + *} +function SDL_HasRDTSC : SDL_Bool; +cdecl; external {$IFDEF __GPC__}name 'SDL_HasRDTSC'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_HasRDTSC} + +{* This function returns true if the CPU has MMX features + *} +function SDL_HasMMX : SDL_Bool; +cdecl; external {$IFDEF __GPC__}name 'SDL_HasMMX'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_HasMMX} + +{* This function returns true if the CPU has MMX Ext. features + *} +function SDL_HasMMXExt : SDL_Bool; +cdecl; external {$IFDEF __GPC__}name 'SDL_HasMMXExt'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_HasMMXExt} + +{* This function returns true if the CPU has 3DNow features + *} +function SDL_Has3DNow : SDL_Bool; +cdecl; external {$IFDEF __GPC__}name 'SDL_Has3DNow'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_Has3DNow} + +{* This function returns true if the CPU has 3DNow! Ext. features + *} +function SDL_Has3DNowExt : SDL_Bool; +cdecl; external {$IFDEF __GPC__}name 'SDL_Has3DNowExt'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_Has3DNowExt} + +{* This function returns true if the CPU has SSE features + *} +function SDL_HasSSE : SDL_Bool; +cdecl; external {$IFDEF __GPC__}name 'SDL_HasSSE'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_HasSSE} + +{* This function returns true if the CPU has SSE2 features + *} +function SDL_HasSSE2 : SDL_Bool; +cdecl; external {$IFDEF __GPC__}name 'SDL_HasSSE2'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_HasSSE2} + +{* This function returns true if the CPU has AltiVec features + *} +function SDL_HasAltiVec : SDL_Bool; +cdecl; external {$IFDEF __GPC__}name 'SDL_HasAltiVec'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_HasAltiVec} + +implementation + +end. + \ No newline at end of file diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlgameinterface.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlgameinterface.pas new file mode 100644 index 00000000..f8bf902c --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlgameinterface.pas @@ -0,0 +1,195 @@ +unit sdlgameinterface; +{ + $Id: sdlgameinterface.pas,v 1.3 2004/10/17 18:41:49 savage Exp $ + +} +{******************************************************************************} +{ } +{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } +{ Game Interface Base class } +{ } +{ The initial developer of this Pascal code was : } +{ Dominqiue Louis } +{ } +{ Portions created by Dominqiue Louis are } +{ Copyright (C) 2000 - 2001 Dominqiue Louis. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ } +{ } +{ } +{ } +{ } +{ } +{ } +{ Requires } +{ -------- } +{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } +{ They are available from... } +{ http://www.libsdl.org . } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ September 23 2004 - DL : Initial Creation } +{ + $Log: sdlgameinterface.pas,v $ + Revision 1.3 2004/10/17 18:41:49 savage + Slight Change to allow Reseting of Input Event handlers + + Revision 1.2 2004/09/30 22:35:47 savage + Changes, enhancements and additions as required to get SoAoS working. + + +} +{******************************************************************************} + +interface + +uses + sdl, + sdlwindow; + +type + TGameInterfaceClass = class of TGameInterface; + + TGameInterface = class( TObject ) + private + FNextGameInterface : TGameInterfaceClass; + protected + Dragging : Boolean; + Loaded : Boolean; + procedure FreeSurfaces; virtual; + procedure Render; virtual; abstract; + procedure Close; virtual; + procedure Update( aElapsedTime : single ); virtual; + procedure MouseDown( Button : Integer; Shift: TSDLMod; MousePos : TPoint ); virtual; + procedure MouseMove( Shift: TSDLMod; CurrentPos : TPoint; RelativePos : TPoint ); virtual; + procedure MouseUp( Button : Integer; Shift: TSDLMod; MousePos : TPoint ); virtual; + procedure MouseWheelScroll( WheelDelta : Integer; Shift: TSDLMod; MousePos : TPoint ); virtual; + procedure KeyDown( var Key: TSDLKey; Shift: TSDLMod; unicode : UInt16 ); virtual; + public + MainWindow : TSDL2DWindow; + procedure ResetInputManager; + procedure LoadSurfaces; virtual; + function PointIsInRect( Point : TPoint; x, y, x1, y1 : integer ) : Boolean; + constructor Create( const aMainWindow : TSDL2DWindow ); + destructor Destroy; override; + property NextGameInterface : TGameInterfaceClass read FNextGameInterface write FNextGameInterface; + end; + +implementation + +{ TGameInterface } +procedure TGameInterface.Close; +begin + FNextGameInterface := nil; +end; + +constructor TGameInterface.Create( const aMainWindow : TSDL2DWindow ); +begin + inherited Create; + MainWindow := aMainWindow; + FNextGameInterface := TGameInterface; + ResetInputManager; +end; + +destructor TGameInterface.Destroy; +begin + if Loaded then + FreeSurfaces; + inherited; +end; + +procedure TGameInterface.FreeSurfaces; +begin + Loaded := False; +end; + +procedure TGameInterface.KeyDown(var Key: TSDLKey; Shift: TSDLMod; unicode: UInt16); +begin + +end; + +procedure TGameInterface.LoadSurfaces; +begin + Loaded := True; +end; + +procedure TGameInterface.MouseDown(Button: Integer; Shift: TSDLMod; MousePos: TPoint); +begin + Dragging := True; +end; + +procedure TGameInterface.MouseMove(Shift: TSDLMod; CurrentPos, RelativePos: TPoint); +begin + +end; + +procedure TGameInterface.MouseUp(Button: Integer; Shift: TSDLMod; MousePos: TPoint); +begin + Dragging := True; +end; + +procedure TGameInterface.MouseWheelScroll(WheelDelta: Integer; Shift: TSDLMod; MousePos: TPoint); +begin + +end; + +function TGameInterface.PointIsInRect( Point : TPoint; x, y, x1, y1: integer ): Boolean; +begin + if ( Point.x >= x ) + and ( Point.y >= y ) + and ( Point.x <= x1 ) + and ( Point.y <= y1 ) then + result := true + else + result := false; +end; + +procedure TGameInterface.ResetInputManager; +begin + MainWindow.InputManager.Mouse.OnMouseDown := MouseDown; + MainWindow.InputManager.Mouse.OnMouseMove := MouseMove; + MainWindow.InputManager.Mouse.OnMouseUp := MouseUp; + MainWindow.InputManager.Mouse.OnMouseWheel := MouseWheelScroll; + MainWindow.InputManager.KeyBoard.OnKeyDown := KeyDown; + MainWindow.OnRender := Render; + MainWindow.OnClose := Close; + MainWindow.OnUpdate := Update; +end; + +procedure TGameInterface.Update(aElapsedTime: single); +begin + +end; + +end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdli386utils.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdli386utils.pas new file mode 100644 index 00000000..9151168a --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdli386utils.pas @@ -0,0 +1,5236 @@ +unit sdli386utils; +{ + $Id: sdli386utils.pas,v 1.5 2004/06/02 19:38:53 savage Exp $ + +} +{******************************************************************************} +{ } +{ Borland Delphi SDL - Simple DirectMedia Layer } +{ SDL Utility functions } +{ } +{ } +{ The initial developer of this Pascal code was : } +{ Tom Jones } +{ } +{ Portions created by Tom Jones are } +{ Copyright (C) 2000 - 2001 Tom Jones. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ Dominique Louis } +{ Róbert Kisnémeth } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ Helper functions... } +{ } +{ } +{ Requires } +{ -------- } +{ SDL.dll on Windows platforms } +{ libSDL-1.1.so.0 on Linux platform } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ 2000 - TJ : Initial creation } +{ } +{ July 13 2001 - DL : Added PutPixel and GetPixel routines. } +{ } +{ Sept 14 2001 - RK : Added flipping routines. } +{ } +{ Sept 19 2001 - RK : Added PutPixel & line drawing & blitting with ADD } +{ effect. Fixed a bug in SDL_PutPixel & SDL_GetPixel } +{ Added PSDLRect() } +{ Sept 22 2001 - DL : Removed need for Windows.pas by defining types here} +{ Also removed by poor attempt or a dialog box } +{ } +{ Sept 25 2001 - RK : Added PixelTest, NewPutPixel, SubPixel, SubLine, } +{ SubSurface, MonoSurface & TexturedSurface } +{ } +{ Sept 26 2001 - DL : Made change so that it refers to native Pascal } +{ types rather that Windows types. This makes it more} +{ portable to Linix. } +{ } +{ Sept 27 2001 - RK : SDLUtils now can be compiled with FreePascal } +{ } +{ Oct 27 2001 - JF : Added ScrollY function } +{ } +{ Jan 21 2002 - RK : Added SDL_ZoomSurface and SDL_WarpSurface } +{ } +{ Mar 28 2002 - JF : Added SDL_RotateSurface } +{ } +{ May 13 2002 - RK : Improved SDL_FillRectAdd & SDL_FillRectSub } +{ } +{ May 27 2002 - YS : GradientFillRect function } +{ } +{ May 30 2002 - RK : Added SDL_2xBlit, SDL_Scanline2xBlit } +{ & SDL_50Scanline2xBlit } +{ } +{ June 12 2002 - RK : Added SDL_PixelTestSurfaceVsRect } +{ } +{ June 12 2002 - JF : Updated SDL_PixelTestSurfaceVsRect } +{ } +{ November 9 2002 - JF : Added Jason's boolean Surface functions } +{ } +{ December 10 2002 - DE : Added Dean's SDL_ClipLine function } +{ } +{******************************************************************************} +{ + $Log: sdli386utils.pas,v $ + Revision 1.5 2004/06/02 19:38:53 savage + Changes to SDL_GradientFillRect as suggested by + Ángel Eduardo García Hernández. Many thanks. + + Revision 1.4 2004/05/29 23:11:53 savage + Changes to SDL_ScaleSurfaceRect as suggested by + Ángel Eduardo García Hernández to fix a colour issue with the function. Many thanks. + + Revision 1.3 2004/02/20 22:04:11 savage + Added Changes as mentioned by Rodrigo "Rui" R. (1/2 RRC2Soft) to facilitate FPC compilation and it also works in Delphi. Also syncronized the funcitons so that they are identical to sdlutils.pas, when no assembly version is available. + + Revision 1.2 2004/02/14 00:23:39 savage + As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. + + Revision 1.1 2004/02/05 00:08:20 savage + Module 1.0 release + + +} + +interface + +{$i jedi-sdl.inc} + +uses +{$IFDEF UNIX} + Types, + Xlib, +{$ENDIF} + SysUtils, + sdl; + +type + TGradientStyle = ( gsHorizontal, gsVertical ); + + // Pixel procedures +function SDL_PixelTest( SrcSurface1 : PSDL_Surface; SrcRect1 : PSDL_Rect; SrcSurface2 : + PSDL_Surface; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : Boolean; + +function SDL_GetPixel( SrcSurface : PSDL_Surface; x : cardinal; y : cardinal ) : Uint32; + +procedure SDL_PutPixel( SrcSurface : PSDL_Surface; x : integer; y : integer; Color : + cardinal ); + +procedure SDL_AddPixel( SrcSurface : PSDL_Surface; x : integer; y : integer; Color : + cardinal ); + +procedure SDL_SubPixel( SrcSurface : PSDL_Surface; x : integer; y : integer; Color : + cardinal ); + +// Line procedures +procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal );overload; + +procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ; DashLength, DashSpace : byte ); overload; + +procedure SDL_AddLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ); + +procedure SDL_SubLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ); + +// Surface procedures +procedure SDL_AddSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DstSurface : PSDL_Surface; DestRect : PSDL_Rect ); + +procedure SDL_SubSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DstSurface : PSDL_Surface; DestRect : PSDL_Rect ); + +procedure SDL_MonoSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DstSurface : PSDL_Surface; DestRect : PSDL_Rect; Color : cardinal ); + +procedure SDL_TexturedSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DstSurface : PSDL_Surface; DestRect : PSDL_Rect; Texture : PSDL_Surface; + TextureRect : PSDL_Rect ); + +procedure SDL_ZoomSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; DstRect : PSDL_Rect ); + +procedure SDL_WarpSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; UL, UR, LR, LL : PPoint ); + +// Flip procedures +procedure SDL_FlipRectH( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); + +procedure SDL_FlipRectV( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); + +function PSDLRect( aLeft, aTop, aWidth, aHeight : integer ) : PSDL_Rect; + +function SDLRect( aLeft, aTop, aWidth, aHeight : integer ) : TSDL_Rect; overload; + +function SDLRect( aRect : TRect ) : TSDL_Rect; overload; + +function SDL_ScaleSurfaceRect( SrcSurface : PSDL_Surface; SrcX1, SrcY1, SrcW, SrcH, + Width, Height : integer ) : PSDL_Surface; + +procedure SDL_ScrollY( DstSurface : PSDL_Surface; DifY : integer ); + +procedure SDL_ScrollX( DstSurface : PSDL_Surface; DifX : integer ); + +procedure SDL_RotateDeg( DstSurface, SrcSurface : PSDL_Surface; SrcRect : + PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Integer ); + +procedure SDL_RotateRad( DstSurface, SrcSurface : PSDL_Surface; SrcRect : + PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Single ); + +function ValidateSurfaceRect( DstSurface : PSDL_Surface; dstrect : PSDL_Rect ) : TSDL_Rect; + +// Fill Rect routine +procedure SDL_FillRectAdd( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); + +procedure SDL_FillRectSub( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); + +procedure SDL_GradientFillRect( DstSurface : PSDL_Surface; const Rect : PSDL_Rect; const StartColor, EndColor : TSDL_Color; const Style : TGradientStyle ); + +// NOTE for All SDL_2xblit... function : the dest surface must be 2x of the source surface! +procedure SDL_2xBlit( Src, Dest : PSDL_Surface ); + +procedure SDL_Scanline2xBlit( Src, Dest : PSDL_Surface ); + +procedure SDL_50Scanline2xBlit( Src, Dest : PSDL_Surface ); + +function SDL_PixelTestSurfaceVsRect( SrcSurface1 : PSDL_Surface; SrcRect1 : +PSDL_Rect; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : +boolean; + +// Jason's boolean Surface functions +procedure SDL_ORSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); + +procedure SDL_ANDSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); + +procedure SDL_GTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); + +procedure SDL_LTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); + +function SDL_ClipLine(var x1,y1,x2,y2: Integer; ClipRect: PSDL_Rect) : boolean; + +implementation + +uses + Math; + +function SDL_PixelTest( SrcSurface1 : PSDL_Surface; SrcRect1 : PSDL_Rect; SrcSurface2 : + PSDL_Surface; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : boolean; +var + Src_Rect1, Src_Rect2 : TSDL_Rect; + right1, bottom1 : integer; + right2, bottom2 : integer; + Scan1Start, Scan2Start, ScanWidth, ScanHeight : cardinal; + Mod1, Mod2 : cardinal; + Addr1, Addr2 : cardinal; + BPP : cardinal; + Pitch1, Pitch2 : cardinal; + TransparentColor1, TransparentColor2 : cardinal; + tx, ty : cardinal; + StartTick : cardinal; + Color1, Color2 : cardinal; +begin + Result := false; + if SrcRect1 = nil then + begin + with Src_Rect1 do + begin + x := 0; + y := 0; + w := SrcSurface1.w; + h := SrcSurface1.h; + end; + end + else + Src_Rect1 := SrcRect1^; + if SrcRect2 = nil then + begin + with Src_Rect2 do + begin + x := 0; + y := 0; + w := SrcSurface2.w; + h := SrcSurface2.h; + end; + end + else + Src_Rect2 := SrcRect2^; + with Src_Rect1 do + begin + Right1 := Left1 + w; + Bottom1 := Top1 + h; + end; + with Src_Rect2 do + begin + Right2 := Left2 + w; + Bottom2 := Top2 + h; + end; + if ( Left1 >= Right2 ) or ( Right1 <= Left2 ) or ( Top1 >= Bottom2 ) or ( Bottom1 <= + Top2 ) then + exit; + if Left1 <= Left2 then + begin + // 1. left, 2. right + Scan1Start := Src_Rect1.x + Left2 - Left1; + Scan2Start := Src_Rect2.x; + ScanWidth := Right1 - Left2; + with Src_Rect2 do + if ScanWidth > w then + ScanWidth := w; + end + else + begin + // 1. right, 2. left + Scan1Start := Src_Rect1.x; + Scan2Start := Src_Rect2.x + Left1 - Left2; + ScanWidth := Right2 - Left1; + with Src_Rect1 do + if ScanWidth > w then + ScanWidth := w; + end; + with SrcSurface1^ do + begin + Pitch1 := Pitch; + Addr1 := cardinal( Pixels ); + inc( Addr1, Pitch1 * UInt32( Src_Rect1.y ) ); + with format^ do + begin + BPP := BytesPerPixel; + TransparentColor1 := colorkey; + end; + end; + with SrcSurface2^ do + begin + TransparentColor2 := format.colorkey; + Pitch2 := Pitch; + Addr2 := cardinal( Pixels ); + inc( Addr2, Pitch2 * UInt32( Src_Rect2.y ) ); + end; + Mod1 := Pitch1 - ( ScanWidth * BPP ); + Mod2 := Pitch2 - ( ScanWidth * BPP ); + inc( Addr1, BPP * Scan1Start ); + inc( Addr2, BPP * Scan2Start ); + if Top1 <= Top2 then + begin + // 1. up, 2. down + ScanHeight := Bottom1 - Top2; + if ScanHeight > Src_Rect2.h then + ScanHeight := Src_Rect2.h; + inc( Addr1, Pitch1 * UInt32( Top2 - Top1 ) ); + end + else + begin + // 1. down, 2. up + ScanHeight := Bottom2 - Top1; + if ScanHeight > Src_Rect1.h then + ScanHeight := Src_Rect1.h; + inc( Addr2, Pitch2 * UInt32( Top1 - Top2 ) ); + end; + case BPP of + 1 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PByte( Addr1 )^ <> TransparentColor1 ) and ( PByte( Addr2 )^ <> + TransparentColor2 ) then + begin + Result := true; + exit; + end; + inc( Addr1 ); + inc( Addr2 ); + end; + inc( Addr1, Mod1 ); + inc( Addr2, Mod2 ); + end; + 2 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PWord( Addr1 )^ <> TransparentColor1 ) and ( PWord( Addr2 )^ <> + TransparentColor2 ) then + begin + Result := true; + exit; + end; + inc( Addr1, 2 ); + inc( Addr2, 2 ); + end; + inc( Addr1, Mod1 ); + inc( Addr2, Mod2 ); + end; + 3 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + Color1 := PLongWord( Addr1 )^ and $00FFFFFF; + Color2 := PLongWord( Addr2 )^ and $00FFFFFF; + if ( Color1 <> TransparentColor1 ) and ( Color2 <> TransparentColor2 ) + then + begin + Result := true; + exit; + end; + inc( Addr1, 3 ); + inc( Addr2, 3 ); + end; + inc( Addr1, Mod1 ); + inc( Addr2, Mod2 ); + end; + 4 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PLongWord( Addr1 )^ <> TransparentColor1 ) and ( PLongWord( Addr2 )^ <> + TransparentColor2 ) then + begin + Result := true; + exit; + end; + inc( Addr1, 4 ); + inc( Addr2, 4 ); + end; + inc( Addr1, Mod1 ); + inc( Addr2, Mod2 ); + end; + end; +end; + +function SDL_GetPixel( SrcSurface : PSDL_Surface; x : cardinal; y : cardinal ) : Uint32; +var + bpp : UInt32; + p : PInteger; +begin + bpp := SrcSurface.format.BytesPerPixel; + // Here p is the address to the pixel we want to retrieve + p := Pointer( Uint32( SrcSurface.pixels ) + UInt32( y ) * SrcSurface.pitch + UInt32( x ) * + bpp ); + case bpp of + 1 : result := PUint8( p )^; + 2 : result := PUint16( p )^; + 3 : + if ( SDL_BYTEORDER = SDL_BIG_ENDIAN ) then + result := PUInt8Array( p )[ 0 ] shl 16 or PUInt8Array( p )[ 1 ] shl 8 or + PUInt8Array( p )[ 2 ] + else + result := PUInt8Array( p )[ 0 ] or PUInt8Array( p )[ 1 ] shl 8 or + PUInt8Array( p )[ 2 ] shl 16; + 4 : result := PUint32( p )^; + else + result := 0; // shouldn't happen, but avoids warnings + end; +end; + +procedure SDL_PutPixel( SrcSurface : PSDL_Surface; x : integer; y : integer; Color : + cardinal ); +var + Addr, Pitch, BPP : cardinal; +begin + Addr := cardinal( SrcSurface.Pixels ); + Pitch := SrcSurface.Pitch; + BPP := SrcSurface.format.BytesPerPixel; + asm + mov eax, y + mul Pitch // EAX := y * Pitch + add Addr, eax // Addr:= Addr + (y * Pitch) + mov eax, x + mov ecx, Color + cmp BPP, 1 + jne @Not1BPP + add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x + mov [eax], cl + jmp @Quit + @Not1BPP: + cmp BPP, 2 + jne @Not2BPP + mul BPP // EAX := x * BPP + add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x * BPP + mov [eax], cx + jmp @Quit + @Not2BPP: + cmp BPP, 3 + jne @Not3BPP + mul BPP // EAX := x * BPP + add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x * BPP + mov edx, [eax] + and edx, $ff000000 + or edx, ecx + mov [eax], edx + jmp @Quit + @Not3BPP: + mul BPP // EAX := x * BPP + add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x * BPP + mov [eax], ecx + @Quit: + end; +end; + +procedure SDL_AddPixel( SrcSurface : PSDL_Surface; x : integer; y : integer; Color : + cardinal ); +var + SrcColor, FinalColor : cardinal; + Addr, Pitch, Bits : cardinal; +begin + if Color = 0 then + exit; + Addr := cardinal( SrcSurface.Pixels ); + Pitch := SrcSurface.Pitch; + Bits := SrcSurface.format.BitsPerPixel; + asm + mov eax, y + mul Pitch // EAX := y * Pitch + add Addr, eax // Addr:= Addr + (y * Pitch) + mov eax, x + cmp Bits, 8 + jne @Not8bit + add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x + mov cl, [eax] + movzx ecx, cl + mov SrcColor, ecx + mov edx, Color + and ecx, 3 + and edx, 3 + add ecx, edx + cmp ecx, 3 + jbe @Skip1_8bit + mov ecx, 3 + @Skip1_8bit: + mov FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $1c + and edx, $1c + add ecx, edx + cmp ecx, $1c + jbe @Skip2_8bit + mov ecx, $1c + @Skip2_8bit: + or FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $e0 + and edx, $e0 + add ecx, edx + cmp ecx, $e0 + jbe @Skip3_8bit + mov ecx, $e0 + @Skip3_8bit: + or ecx, FinalColor + mov [eax], cl + jmp @Quit + @Not8bit: + cmp Bits, 15 + jne @Not15bit + shl eax, 1 + add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x * 2 + mov ecx, [eax] + and ecx, $00007fff + mov SrcColor, ecx + mov edx, Color + and ecx, $1f + and edx, $1f + add ecx, edx + cmp ecx, $1f + jbe @Skip1_15bit + mov ecx, $1f + @Skip1_15bit: + mov FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $03e0 + and edx, $03e0 + add ecx, edx + cmp ecx, $03e0 + jbe @Skip2_15bit + mov ecx, $03e0 + @Skip2_15bit: + or FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $7c00 + and edx, $7c00 + add ecx, edx + cmp ecx, $7c00 + jbe @Skip3_15bit + mov ecx, $7c00 + @Skip3_15bit: + or ecx, FinalColor + mov [eax], cx + jmp @Quit + @Not15Bit: + cmp Bits, 16 + jne @Not16bit + shl eax, 1 + add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x * 2 + mov ecx, [eax] + and ecx, $0000ffff + mov SrcColor, ecx + mov edx, Color + and ecx, $1f + and edx, $1f + add ecx, edx + cmp ecx, $1f + jbe @Skip1_16bit + mov ecx, $1f + @Skip1_16bit: + mov FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $07e0 + and edx, $07e0 + add ecx, edx + cmp ecx, $07e0 + jbe @Skip2_16bit + mov ecx, $07e0 + @Skip2_16bit: + or FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $f800 + and edx, $f800 + add ecx, edx + cmp ecx, $f800 + jbe @Skip3_16bit + mov ecx, $f800 + @Skip3_16bit: + or ecx, FinalColor + mov [eax], cx + jmp @Quit + @Not16Bit: + cmp Bits, 24 + jne @Not24bit + mov ecx, 0 + add ecx, eax + shl ecx, 1 + add ecx, eax + mov eax, ecx + jmp @32bit + @Not24bit: + shl eax, 2 + @32bit: + add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x * 2 + mov ecx, [eax] + mov FinalColor, ecx + and FinalColor, $ff000000 + and ecx, $00ffffff + mov SrcColor, ecx + mov edx, Color + and ecx, $000000ff + and edx, $000000ff + add ecx, edx + cmp ecx, $000000ff + jbe @Skip1_32bit + mov ecx, $000000ff + @Skip1_32bit: + or FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $0000ff00 + and edx, $0000ff00 + add ecx, edx + cmp ecx, $0000ff00 + jbe @Skip2_32bit + mov ecx, $0000ff00 + @Skip2_32bit: + or FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $00ff0000 + and edx, $00ff0000 + add ecx, edx + cmp ecx, $00ff0000 + jbe @Skip3_32bit + mov ecx, $00ff0000 + @Skip3_32bit: + or ecx, FinalColor + mov [eax], ecx + @Quit: + end; +end; + +procedure SDL_SubPixel( SrcSurface : PSDL_Surface; x : integer; y : integer; Color : + cardinal ); +var + SrcColor, FinalColor : cardinal; + Addr, Pitch, Bits : cardinal; +begin + if Color = 0 then + exit; + Addr := cardinal( SrcSurface.Pixels ); + Pitch := SrcSurface.Pitch; + Bits := SrcSurface.format.BitsPerPixel; + asm + mov eax, y + mul Pitch // EAX := y * Pitch + add Addr, eax // Addr:= Addr + (y * Pitch) + mov eax, x + cmp Bits, 8 + jne @Not8bit + add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x + mov cl, [eax] + movzx ecx, cl + mov SrcColor, ecx + mov edx, Color + and ecx, 3 + and edx, 3 + sub ecx, edx + jns @Skip1_8bit + mov ecx, 0 + @Skip1_8bit: + mov FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $1c + and edx, $1c + sub ecx, edx + jns @Skip2_8bit + mov ecx, 0 + @Skip2_8bit: + or FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $e0 + and edx, $e0 + sub ecx, edx + jns @Skip3_8bit + mov ecx, 0 + @Skip3_8bit: + or ecx, FinalColor + mov [eax], cl + jmp @Quit + @Not8bit: + cmp Bits, 15 + jne @Not15bit + shl eax, 1 + add eax, Addr + mov ecx, [eax] + and ecx, $00007fff + mov SrcColor, ecx + mov edx, Color + and ecx, $1f + and edx, $1f + sub ecx, edx + jns @Skip1_15bit + mov ecx, 0 + @Skip1_15bit: + mov FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $03e0 + and edx, $03e0 + sub ecx, edx + jns @Skip2_15bit + mov ecx, 0 + @Skip2_15bit: + or FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $7c00 + and edx, $7c00 + sub ecx, edx + jns @Skip3_15bit + mov ecx, 0 + @Skip3_15bit: + or ecx, FinalColor + mov [eax], cx + jmp @Quit + @Not15Bit: + cmp Bits, 16 + jne @Not16bit + shl eax, 1 + add eax, Addr + mov ecx, [eax] + and ecx, $0000ffff + mov SrcColor, ecx + mov edx, Color + and ecx, $1f + and edx, $1f + sub ecx, edx + jns @Skip1_16bit + mov ecx, 0 + @Skip1_16bit: + mov FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $07e0 + and edx, $07e0 + sub ecx, edx + jns @Skip2_16bit + mov ecx, 0 + @Skip2_16bit: + or FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $f800 + and edx, $f800 + sub ecx, edx + jns @Skip3_16bit + mov ecx, 0 + @Skip3_16bit: + or ecx, FinalColor + mov [eax], cx + jmp @Quit + @Not16Bit: + cmp Bits, 24 + jne @Not24bit + mov ecx, 0 + add ecx, eax + shl ecx, 1 + add ecx, eax + mov eax, ecx + jmp @32bit + @Not24bit: + shl eax, 2 + @32bit: + add eax, Addr + mov ecx, [eax] + mov FinalColor, ecx + and FinalColor, $ff000000 + and ecx, $00ffffff + mov SrcColor, ecx + mov edx, Color + and ecx, $000000ff + and edx, $000000ff + sub ecx, edx + jns @Skip1_32bit + mov ecx, 0 + @Skip1_32bit: + or FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $0000ff00 + and edx, $0000ff00 + sub ecx, edx + jns @Skip2_32bit + mov ecx, 0 + @Skip2_32bit: + or FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $00ff0000 + and edx, $00ff0000 + sub ecx, edx + jns @Skip3_32bit + mov ecx, 0 + @Skip3_32bit: + or ecx, FinalColor + mov [eax], ecx + @Quit: + end; +end; + +// Draw a line between x1,y1 and x2,y2 to the given surface +// NOTE: The surface must be locked before calling this! +procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ); +var + dx, dy, sdx, sdy, x, y, px, py : integer; +begin + dx := x2 - x1; + dy := y2 - y1; + if dx < 0 then + sdx := -1 + else + sdx := 1; + if dy < 0 then + sdy := -1 + else + sdy := 1; + dx := sdx * dx + 1; + dy := sdy * dy + 1; + x := 0; + y := 0; + px := x1; + py := y1; + if dx >= dy then + begin + for x := 0 to dx - 1 do + begin + SDL_PutPixel( DstSurface, px, py, Color ); + y := y + dy; + if y >= dx then + begin + y := y - dx; + py := py + sdy; + end; + px := px + sdx; + end; + end + else + begin + for y := 0 to dy - 1 do + begin + SDL_PutPixel( DstSurface, px, py, Color ); + x := x + dx; + if x >= dy then + begin + x := x - dy; + px := px + sdx; + end; + py := py + sdy; + end; + end; +end; + +// Draw a dashed line between x1,y1 and x2,y2 to the given surface +// NOTE: The surface must be locked before calling this! +procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ; DashLength, DashSpace : byte ); overload; +var + dx, dy, sdx, sdy, x, y, px, py, counter : integer; drawdash : boolean; +begin + counter := 0; + drawdash := true; //begin line drawing with dash + + //Avoid invalid user-passed dash parameters + if (DashLength < 1) + then DashLength := 1; + if (DashSpace < 1) + then DashSpace := 0; + + dx := x2 - x1; + dy := y2 - y1; + if dx < 0 then + sdx := -1 + else + sdx := 1; + if dy < 0 then + sdy := -1 + else + sdy := 1; + dx := sdx * dx + 1; + dy := sdy * dy + 1; + x := 0; + y := 0; + px := x1; + py := y1; + if dx >= dy then + begin + for x := 0 to dx - 1 do + begin + + //Alternate drawing dashes, or leaving spaces + if drawdash then + begin + SDL_PutPixel( DstSurface, px, py, Color ); + inc(counter); + if (counter > DashLength-1) and (DashSpace > 0) then + begin + drawdash := false; + counter := 0; + end; + end + else //space + begin + inc(counter); + if counter > DashSpace-1 then + begin + drawdash := true; + counter := 0; + end; + end; + + y := y + dy; + if y >= dx then + begin + y := y - dx; + py := py + sdy; + end; + px := px + sdx; + end; + end + else + begin + for y := 0 to dy - 1 do + begin + + //Alternate drawing dashes, or leaving spaces + if drawdash then + begin + SDL_PutPixel( DstSurface, px, py, Color ); + inc(counter); + if (counter > DashLength-1) and (DashSpace > 0) then + begin + drawdash := false; + counter := 0; + end; + end + else //space + begin + inc(counter); + if counter > DashSpace-1 then + begin + drawdash := true; + counter := 0; + end; + end; + + x := x + dx; + if x >= dy then + begin + x := x - dy; + px := px + sdx; + end; + py := py + sdy; + end; + end; +end; + +procedure SDL_AddLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ); +var + dx, dy, sdx, sdy, x, y, px, py : integer; +begin + dx := x2 - x1; + dy := y2 - y1; + if dx < 0 then + sdx := -1 + else + sdx := 1; + if dy < 0 then + sdy := -1 + else + sdy := 1; + dx := sdx * dx + 1; + dy := sdy * dy + 1; + x := 0; + y := 0; + px := x1; + py := y1; + if dx >= dy then + begin + for x := 0 to dx - 1 do + begin + SDL_AddPixel( DstSurface, px, py, Color ); + y := y + dy; + if y >= dx then + begin + y := y - dx; + py := py + sdy; + end; + px := px + sdx; + end; + end + else + begin + for y := 0 to dy - 1 do + begin + SDL_AddPixel( DstSurface, px, py, Color ); + x := x + dx; + if x >= dy then + begin + x := x - dy; + px := px + sdx; + end; + py := py + sdy; + end; + end; +end; + +procedure SDL_SubLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ); +var + dx, dy, sdx, sdy, x, y, px, py : integer; +begin + dx := x2 - x1; + dy := y2 - y1; + if dx < 0 then + sdx := -1 + else + sdx := 1; + if dy < 0 then + sdy := -1 + else + sdy := 1; + dx := sdx * dx + 1; + dy := sdy * dy + 1; + x := 0; + y := 0; + px := x1; + py := y1; + if dx >= dy then + begin + for x := 0 to dx - 1 do + begin + SDL_SubPixel( DstSurface, px, py, Color ); + y := y + dy; + if y >= dx then + begin + y := y - dx; + py := py + sdy; + end; + px := px + sdx; + end; + end + else + begin + for y := 0 to dy - 1 do + begin + SDL_SubPixel( DstSurface, px, py, Color ); + x := x + dx; + if x >= dy then + begin + x := x - dy; + px := px + sdx; + end; + py := py + sdy; + end; + end; +end; + +// This procedure works on 8, 15, 16, 24 and 32 bits color depth surfaces. +// In 8 bit color depth mode the procedure works with the default packed +// palette (RRRGGGBB). It handles all clipping. +procedure SDL_AddSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DstSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + // TransparentColor: cardinal; + _ebx, _esi, _edi, _esp : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DstSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DstSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DstSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + // TransparentColor := format.ColorKey; + end; + with DstSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DstSurface ); + case bits of + 8 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov al, [esi] // AL := source color + cmp al, 0 + je @SkipColor // if AL=0 or AL=transparent color then skip everything + mov esp, eax // ESP - source color + mov bl, [edi] // BL := destination color + mov dl, bl // DL := destination color + and ax, $03 // Adding BLUE + and bl, $03 + add al, bl + cmp al, $03 + jbe @Skip1 + mov al, $03 + @Skip1: + mov cl, al + mov eax, esp // Adding GREEN + mov bl, dl + and al, $1c + and bl, $1c + add al, bl + cmp al, $1c + jbe @Skip2 + mov al, $1c + @Skip2: + or cl, al + mov eax, esp // Adding RED + mov bl, dl + and ax, $e0 + and bx, $e0 + add ax, bx + cmp ax, $e0 + jbe @Skip3 + mov al, $e0 + @Skip3: + or cl, al + mov [edi], cl + @SkipColor: + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 15 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov ax, [esi] // AX := source color + cmp ax, 0 + je @SkipColor // if AX=0 then skip everything + mov esp, eax // ESP - source color + mov bx, [edi] // BX := destination color + mov dx, bx // DX := destination color + and ax, $001F // Adding BLUE + and bx, $001F + add ax, bx + cmp ax, $001F + jbe @Skip1 + mov ax, $001F + @Skip1: + mov cx, ax + mov eax, esp // Adding GREEN + mov bx, dx + and ax, $3E0 + and bx, $3E0 + add ax, bx + cmp ax, $3E0 + jbe @Skip2 + mov ax, $3E0 + @Skip2: + or cx, ax + mov eax, esp // Adding RED + mov bx, dx + and ax, $7C00 + and bx, $7C00 + add ax, bx + cmp ax, $7C00 + jbe @Skip3 + mov ax, $7C00 + @Skip3: + or cx, ax + mov [edi], cx + @SkipColor: + add esi, 2 + add edi, 2 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 16 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov ax, [esi] // AX := source color + cmp ax, 0 + je @SkipColor // if AX=0 then skip everything + mov esp, eax // ESP - source color + mov bx, [edi] // BX := destination color + mov dx, bx // DX := destination color + and ax, $1F // Adding BLUE + and bx, $1F + add ax, bx + cmp ax, $1F + jbe @Skip1 + mov ax, $1F + @Skip1: + mov cx, ax + mov eax, esp // Adding GREEN + mov bx, dx + and ax, $7E0 + and bx, $7E0 + add ax, bx + cmp ax, $7E0 + jbe @Skip2 + mov ax, $7E0 + @Skip2: + or cx, ax + mov eax, esp // Adding RED + mov bx, dx + and eax, $F800 + and ebx, $F800 + add eax, ebx + cmp eax, $F800 + jbe @Skip3 + mov ax, $F800 + @Skip3: + or cx, ax + mov [edi], cx + @SkipColor: + add esi, 2 + add edi, 2 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 24 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + add WorkX, ax // WorkX := Src.w * 2 + add WorkX, ax // WorkX := Src.w * 3 + @Loopx: + mov bl, [edi] // BX := destination color + mov al, [esi] // AX := source color + cmp al, 0 + je @Skip // if AL=0 then skip COMPONENT + mov ah, 0 // AX := COLOR COMPONENT + mov bh, 0 + add bx, ax + cmp bx, $00ff + jb @Skip + mov bl, $ff + @Skip: + mov [edi], bl + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 32 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + shl ax, 2 + mov WorkX, ax // WorkX := Src.w * 4 + @Loopx: + mov bl, [edi] // BX := destination color + mov al, [esi] // AX := source color + cmp al, 0 + je @Skip // if AL=0 then skip COMPONENT + mov ah, 0 // AX := COLOR COMPONENT + mov bh, 0 + add bx, ax + cmp bx, $00ff + jb @Skip + mov bl, $ff + @Skip: + mov [edi], bl + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DstSurface ); +end; + +procedure SDL_SubSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DstSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + _ebx, _esi, _edi, _esp : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DstSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DstSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DstSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + end; + with DstSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := DstSurface.Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DstSurface ); + case bits of + 8 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov al, [esi] // AL := source color + cmp al, 0 + je @SkipColor // if AL=0 then skip everything + mov esp, eax // ESP - source color + mov bl, [edi] // BL := destination color + mov dl, bl // DL := destination color + and al, $03 // Subtract BLUE + and bl, $03 + sub bl, al + jns @Skip1 + mov bl, 0 + @Skip1: + mov cl, bl + mov eax, esp // Subtract GREEN + mov bl, dl + and al, $1c + and bl, $1c + sub bl, al + jns @Skip2 + mov bl, 0 + @Skip2: + or cl, bl + mov eax, esp // Subtract RED + mov bl, dl + and ax, $e0 + and bx, $e0 + sub bx, ax + jns @Skip3 + mov bl, 0 + @Skip3: + or cl, bl + mov [edi], cl + @SkipColor: + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 15 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov ax, [esi] // AX := source color + cmp ax, 0 + je @SkipColor // if AX=0 then skip everything + mov esp, eax // ESP - source color + mov bx, [edi] // BX := destination color + mov dx, bx // DX := destination color + and ax, $001F // Subtract BLUE + and bx, $001F + sub bx, ax + jns @Skip1 + mov bx, 0 + @Skip1: + mov cx, bx + mov eax, esp // Subtract GREEN + mov bx, dx + and ax, $3E0 + and bx, $3E0 + sub bx, ax + jns @Skip2 + mov bx, 0 + @Skip2: + or cx, bx + mov eax, esp // Subtract RED + mov bx, dx + and ax, $7C00 + and bx, $7C00 + sub bx, ax + jns @Skip3 + mov bx, 0 + @Skip3: + or cx, bx + mov [edi], cx + @SkipColor: + add esi, 2 + add edi, 2 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 16 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov ax, [esi] // AX := source color + cmp ax, 0 + je @SkipColor // if AX=0 then skip everything + mov esp, eax // ESP - source color + mov bx, [edi] // BX := destination color + mov dx, bx // DX := destination color + and ax, $1F // Subtracting BLUE + and bx, $1F + sub bx, ax + jns @Skip1 + mov bx, 0 + @Skip1: + mov cx, bx + mov eax, esp // Adding GREEN + mov bx, dx + and ax, $7E0 + and bx, $7E0 + sub bx, ax + jns @Skip2 + mov bx, 0 + @Skip2: + or cx, bx + mov eax, esp // Adding RED + mov bx, dx + and eax, $F800 + and ebx, $F800 + sub ebx, eax + jns @Skip3 + mov bx, 0 + @Skip3: + or cx, bx + mov [edi], cx + @SkipColor: + add esi, 2 + add edi, 2 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 24 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + add WorkX, ax // WorkX := Src.w * 2 + add WorkX, ax // WorkX := Src.w * 3 + @Loopx: + mov bl, [edi] // BX := destination color + mov al, [esi] // AX := source color + cmp al, 0 + je @Skip // if AL=0 then skip COMPONENT + mov ah, 0 // AX := COLOR COMPONENT + mov bh, 0 + sub bx, ax + jns @Skip + mov bl, 0 + @Skip: + mov [edi], bl + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 32 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + shl ax, 2 + mov WorkX, ax // WorkX := Src.w * 4 + @Loopx: + mov bl, [edi] // BX := destination color + mov al, [esi] // AX := source color + cmp al, 0 + je @Skip // if AL=0 then skip COMPONENT + mov ah, 0 // AX := COLOR COMPONENT + mov bh, 0 + sub bx, ax + jns @Skip + mov bl, 0 + @Skip: + mov [edi], bl + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DstSurface ); +end; + +procedure SDL_MonoSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DstSurface : PSDL_Surface; DestRect : PSDL_Rect; Color : cardinal ); +var + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + _ebx, _esi, _edi, _esp : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + SrcTransparentColor : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DstSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DstSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DstSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + SrcTransparentColor := format.colorkey; + end; + with DstSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := DstSurface.Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DstSurface ); + case bits of + 8 : + asm + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + mov ecx, Color + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov al, [esi] // AL := source color + movzx eax, al + cmp eax, SrcTransparentColor + je @SkipColor // if AL=Transparent color then skip everything + mov [edi], cl + @SkipColor: + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + end; + 15, 16 : + asm + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + mov ecx, Color + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov ax, [esi] // AX := source color + movzx eax, ax + cmp eax, SrcTransparentColor + je @SkipColor // if AX=Transparent color then skip everything + mov [edi], cx + @SkipColor: + inc esi + inc esi + inc edi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + end; + 24 : + asm + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov _ebx, ebx + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + mov ecx, Color + and ecx, $00ffffff + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov eax, [esi] // EAX := source color + and eax, $00ffffff + cmp eax, SrcTransparentColor + je @SkipColor // if EAX=Transparent color then skip everything + mov ebx, [edi] + and ebx, $ff000000 + or ebx, ecx + mov [edi], ecx + @SkipColor: + add esi, 3 + add edi, 3 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp, _esp + mov edi, _edi + mov esi, _esi + mov ebx, _ebx + end; + 32 : + asm + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + mov ecx, Color + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov eax, [esi] // EAX := source color + cmp eax, SrcTransparentColor + je @SkipColor // if EAX=Transparent color then skip everything + mov [edi], ecx + @SkipColor: + add esi, 4 + add edi, 4 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp, _esp + mov edi, _edi + mov esi, _esi + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DstSurface ); +end; +// TextureRect.w and TextureRect.h are not used. +// The TextureSurface's size MUST larger than the drawing rectangle!!! + +procedure SDL_TexturedSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DstSurface : PSDL_Surface; DestRect : PSDL_Rect; Texture : PSDL_Surface; + TextureRect : PSDL_Rect ); +var + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr, TextAddr : cardinal; + _ebx, _esi, _edi, _esp : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod, TextMod : cardinal; + SrcTransparentColor : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DstSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DstSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DstSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + SrcTransparentColor := format.colorkey; + end; + with DstSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := DstSurface.Format.BitsPerPixel; + end; + with Texture^ do + begin + TextAddr := cardinal( Pixels ) + UInt32( TextureRect.y ) * Pitch + + UInt32( TextureRect.x ) * Format.BytesPerPixel; + TextMod := Pitch - Src.w * Format.BytesPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DstSurface ); + SDL_LockSurface( Texture ); + case bits of + 8 : + asm + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov _ebx, ebx + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ebx, TextAddr + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov al, [esi] // AL := source color + movzx eax, al + cmp eax, SrcTransparentColor + je @SkipColor // if AL=Transparent color then skip everything + mov al, [ebx] + mov [edi], al + @SkipColor: + inc esi + inc edi + inc ebx + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + add ebx, TextMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx, _ebx + end; + 15, 16 : + asm + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ecx, TextAddr + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov ax, [esi] // AL := source color + movzx eax, ax + cmp eax, SrcTransparentColor + je @SkipColor // if AL=Transparent color then skip everything + mov ax, [ecx] + mov [edi], ax + @SkipColor: + inc esi + inc esi + inc edi + inc edi + inc ecx + inc ecx + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + add ecx, TextMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + end; + 24 : + asm + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov _ebx, ebx + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ebx, TextAddr + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov eax, [esi] // AL := source color + and eax, $00ffffff + cmp eax, SrcTransparentColor + je @SkipColor // if AL=Transparent color then skip everything + mov eax, [ebx] + and eax, $00ffffff + mov ecx, [edi] + and ecx, $ff000000 + or ecx, eax + mov [edi], eax + @SkipColor: + add esi, 3 + add edi, 3 + add ebx, 3 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + add ebx, TextMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx, _ebx + end; + 32 : + asm + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ecx, TextAddr + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov eax, [esi] // AL := source color + cmp eax, SrcTransparentColor + je @SkipColor // if AL=Transparent color then skip everything + mov eax, [ecx] + mov [edi], eax + @SkipColor: + add esi, 4 + add edi, 4 + add ecx, 4 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + add ecx, TextMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DstSurface ); + SDL_UnlockSurface( Texture ); +end; + +procedure SDL_ZoomSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; DstRect : PSDL_Rect ); +var + xc, yc : cardinal; + rx, wx, ry, wy, ry16 : cardinal; + color : cardinal; + modx, mody : cardinal; +begin + // Warning! No checks for surface pointers!!! + if srcrect = nil then + srcrect := @SrcSurface.clip_rect; + if dstrect = nil then + dstrect := @DstSurface.clip_rect; + if SDL_MustLock( SrcSurface ) then + SDL_LockSurface( SrcSurface ); + if SDL_MustLock( DstSurface ) then + SDL_LockSurface( DstSurface ); + modx := trunc( ( srcrect.w / dstrect.w ) * 65536 ); + mody := trunc( ( srcrect.h / dstrect.h ) * 65536 ); + //rx := srcrect.x * 65536; + ry := srcrect.y * 65536; + wy := dstrect.y; + for yc := 0 to dstrect.h - 1 do + begin + rx := srcrect.x * 65536; + wx := dstrect.x; + ry16 := ry shr 16; + for xc := 0 to dstrect.w - 1 do + begin + color := SDL_GetPixel( SrcSurface, rx shr 16, ry16 ); + SDL_PutPixel( DstSurface, wx, wy, color ); + rx := rx + modx; + inc( wx ); + end; + ry := ry + mody; + inc( wy ); + end; + if SDL_MustLock( SrcSurface ) then + SDL_UnlockSurface( SrcSurface ); + if SDL_MustLock( DstSurface ) then + SDL_UnlockSurface( DstSurface ); +end; +// Re-map a rectangular area into an area defined by four vertices +// Converted from C to Pascal by KiCHY + +procedure SDL_WarpSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; UL, UR, LR, LL : PPoint ); +const + SHIFTS = 15; // Extend ints to limit round-off error (try 2 - 20) + THRESH = 1 shl SHIFTS; // Threshold for pixel size value + procedure CopySourceToDest( UL, UR, LR, LL : TPoint; x1, y1, x2, y2 : cardinal ); + var + tm, lm, rm, bm, m : TPoint; + mx, my : cardinal; + cr : cardinal; + begin + // Does the destination area specify a single pixel? + if ( ( abs( ul.x - ur.x ) < THRESH ) and + ( abs( ul.x - lr.x ) < THRESH ) and + ( abs( ul.x - ll.x ) < THRESH ) and + ( abs( ul.y - ur.y ) < THRESH ) and + ( abs( ul.y - lr.y ) < THRESH ) and + ( abs( ul.y - ll.y ) < THRESH ) ) then + begin // Yes + cr := SDL_GetPixel( SrcSurface, ( x1 shr SHIFTS ), ( y1 shr SHIFTS ) ); + SDL_PutPixel( DstSurface, ( ul.x shr SHIFTS ), ( ul.y shr SHIFTS ), cr ); + end + else + begin // No + // Quarter the source and the destination, and then recurse + tm.x := ( ul.x + ur.x ) shr 1; + tm.y := ( ul.y + ur.y ) shr 1; + bm.x := ( ll.x + lr.x ) shr 1; + bm.y := ( ll.y + lr.y ) shr 1; + lm.x := ( ul.x + ll.x ) shr 1; + lm.y := ( ul.y + ll.y ) shr 1; + rm.x := ( ur.x + lr.x ) shr 1; + rm.y := ( ur.y + lr.y ) shr 1; + m.x := ( tm.x + bm.x ) shr 1; + m.y := ( tm.y + bm.y ) shr 1; + mx := ( x1 + x2 ) shr 1; + my := ( y1 + y2 ) shr 1; + CopySourceToDest( ul, tm, m, lm, x1, y1, mx, my ); + CopySourceToDest( tm, ur, rm, m, mx, y1, x2, my ); + CopySourceToDest( m, rm, lr, bm, mx, my, x2, y2 ); + CopySourceToDest( lm, m, bm, ll, x1, my, mx, y2 ); + end; + end; +var + _UL, _UR, _LR, _LL : TPoint; + Rect_x, Rect_y, Rect_w, Rect_h : integer; +begin + if SDL_MustLock( SrcSurface ) then + SDL_LockSurface( SrcSurface ); + if SDL_MustLock( DstSurface ) then + SDL_LockSurface( DstSurface ); + if SrcRect = nil then + begin + Rect_x := 0; + Rect_y := 0; + Rect_w := ( SrcSurface.w - 1 ) shl SHIFTS; + Rect_h := ( SrcSurface.h - 1 ) shl SHIFTS; + end + else + begin + Rect_x := SrcRect.x; + Rect_y := SrcRect.y; + Rect_w := ( SrcRect.w - 1 ) shl SHIFTS; + Rect_h := ( SrcRect.h - 1 ) shl SHIFTS; + end; + // Shift all values to help reduce round-off error. + _ul.x := ul.x shl SHIFTS; + _ul.y := ul.y shl SHIFTS; + _ur.x := ur.x shl SHIFTS; + _ur.y := ur.y shl SHIFTS; + _lr.x := lr.x shl SHIFTS; + _lr.y := lr.y shl SHIFTS; + _ll.x := ll.x shl SHIFTS; + _ll.y := ll.y shl SHIFTS; + CopySourceToDest( _ul, _ur, _lr, _ll, Rect_x, Rect_y, Rect_w, Rect_h ); + if SDL_MustLock( SrcSurface ) then + SDL_UnlockSurface( SrcSurface ); + if SDL_MustLock( DstSurface ) then + SDL_UnlockSurface( DstSurface ); +end; + +// flips a rectangle vertically on given surface +procedure SDL_FlipRectV( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); +var + TmpRect : TSDL_Rect; + Locked : boolean; + y, FlipLength, RowLength : integer; + Row1, Row2 : Pointer; + OneRow : TByteArray; // Optimize it if you wish +begin + if DstSurface <> nil then + begin + if Rect = nil then + begin // if Rect=nil then we flip the whole surface + TmpRect := SDLRect( 0, 0, DstSurface.w, DstSurface.h ); + Rect := @TmpRect; + end; + FlipLength := Rect^.h shr 1 - 1; + RowLength := Rect^.w * DstSurface^.format.BytesPerPixel; + if SDL_MustLock( DstSurface ) then + begin + Locked := true; + SDL_LockSurface( DstSurface ); + end + else + Locked := false; + Row1 := pointer( cardinal( DstSurface^.Pixels ) + UInt32( Rect^.y ) * + DstSurface^.Pitch ); + Row2 := pointer( cardinal( DstSurface^.Pixels ) + ( UInt32( Rect^.y ) + Rect^.h - 1 ) + * DstSurface^.Pitch ); + for y := 0 to FlipLength do + begin + Move( Row1^, OneRow, RowLength ); + Move( Row2^, Row1^, RowLength ); + Move( OneRow, Row2^, RowLength ); + inc( cardinal( Row1 ), DstSurface^.Pitch ); + dec( cardinal( Row2 ), DstSurface^.Pitch ); + end; + if Locked then + SDL_UnlockSurface( DstSurface ); + end; +end; + +// flips a rectangle horizontally on given surface +procedure SDL_FlipRectH( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); +type + T24bit = packed array[ 0..2 ] of byte; + T24bitArray = packed array[ 0..8191 ] of T24bit; + P24bitArray = ^T24bitArray; + TLongWordArray = array[ 0..8191 ] of LongWord; + PLongWordArray = ^TLongWordArray; +var + TmpRect : TSDL_Rect; + Row8bit : PByteArray; + Row16bit : PWordArray; + Row24bit : P24bitArray; + Row32bit : PLongWordArray; + y, x, RightSide, FlipLength : integer; + Pixel : cardinal; + Pixel24 : T24bit; + Locked : boolean; +begin + if DstSurface <> nil then + begin + if Rect = nil then + begin + TmpRect := SDLRect( 0, 0, DstSurface.w, DstSurface.h ); + Rect := @TmpRect; + end; + FlipLength := Rect^.w shr 1 - 1; + if SDL_MustLock( DstSurface ) then + begin + Locked := true; + SDL_LockSurface( DstSurface ); + end + else + Locked := false; + case DstSurface^.format.BytesPerPixel of + 1 : + begin + Row8Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * + DstSurface^.pitch ); + for y := 1 to Rect^.h do + begin + RightSide := Rect^.w - 1; + for x := 0 to FlipLength do + begin + Pixel := Row8Bit^[ x ]; + Row8Bit^[ x ] := Row8Bit^[ RightSide ]; + Row8Bit^[ RightSide ] := Pixel; + dec( RightSide ); + end; + inc( cardinal( Row8Bit ), DstSurface^.pitch ); + end; + end; + 2 : + begin + Row16Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * + DstSurface^.pitch ); + for y := 1 to Rect^.h do + begin + RightSide := Rect^.w - 1; + for x := 0 to FlipLength do + begin + Pixel := Row16Bit^[ x ]; + Row16Bit^[ x ] := Row16Bit^[ RightSide ]; + Row16Bit^[ RightSide ] := Pixel; + dec( RightSide ); + end; + inc( cardinal( Row16Bit ), DstSurface^.pitch ); + end; + end; + 3 : + begin + Row24Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * + DstSurface^.pitch ); + for y := 1 to Rect^.h do + begin + RightSide := Rect^.w - 1; + for x := 0 to FlipLength do + begin + Pixel24 := Row24Bit^[ x ]; + Row24Bit^[ x ] := Row24Bit^[ RightSide ]; + Row24Bit^[ RightSide ] := Pixel24; + dec( RightSide ); + end; + inc( cardinal( Row24Bit ), DstSurface^.pitch ); + end; + end; + 4 : + begin + Row32Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * + DstSurface^.pitch ); + for y := 1 to Rect^.h do + begin + RightSide := Rect^.w - 1; + for x := 0 to FlipLength do + begin + Pixel := Row32Bit^[ x ]; + Row32Bit^[ x ] := Row32Bit^[ RightSide ]; + Row32Bit^[ RightSide ] := Pixel; + dec( RightSide ); + end; + inc( cardinal( Row32Bit ), DstSurface^.pitch ); + end; + end; + end; + if Locked then + SDL_UnlockSurface( DstSurface ); + end; +end; + +// Use with caution! The procedure allocates memory for TSDL_Rect and return with its pointer. +// But you MUST free it after you don't need it anymore!!! +function PSDLRect( aLeft, aTop, aWidth, aHeight : integer ) : PSDL_Rect; +var + Rect : PSDL_Rect; +begin + New( Rect ); + with Rect^ do + begin + x := aLeft; + y := aTop; + w := aWidth; + h := aHeight; + end; + Result := Rect; +end; + +function SDLRect( aLeft, aTop, aWidth, aHeight : integer ) : TSDL_Rect; +begin + with result do + begin + x := aLeft; + y := aTop; + w := aWidth; + h := aHeight; + end; +end; + +function SDLRect( aRect : TRect ) : TSDL_Rect; +begin + with aRect do + result := SDLRect( Left, Top, Right - Left, Bottom - Top ); +end; + +procedure SDL_Stretch8( Surface, Dst_Surface : PSDL_Surface; x1, x2, y1, y2, yr, yw, + depth : integer ); +var + dx, dy, e, d, dx2 : integer; + src_pitch, dst_pitch : uint16; + src_pixels, dst_pixels : PUint8; +begin + if ( yw >= dst_surface^.h ) then + exit; + dx := ( x2 - x1 ); + dy := ( y2 - y1 ); + dy := dy shl 1; + e := dy - dx; + dx2 := dx shl 1; + src_pitch := Surface^.pitch; + dst_pitch := dst_surface^.pitch; + src_pixels := PUint8( integer( Surface^.pixels ) + yr * src_pitch + y1 * depth ); + dst_pixels := PUint8( integer( dst_surface^.pixels ) + yw * dst_pitch + x1 * + depth ); + for d := 0 to dx - 1 do + begin + move( src_pixels^, dst_pixels^, depth ); + while ( e >= 0 ) do + begin + inc( src_pixels, depth ); + e := e - dx2; + end; + inc( dst_pixels, depth ); + e := e + dy; + end; +end; + +function sign( x : integer ) : integer; +begin + if x > 0 then + result := 1 + else + result := -1; +end; + +// Stretches a part of a surface +function SDL_ScaleSurfaceRect( SrcSurface : PSDL_Surface; SrcX1, SrcY1, SrcW, SrcH, + Width, Height : integer ) : PSDL_Surface; +var + dst_surface : PSDL_Surface; + dx, dy, e, d, dx2, srcx2, srcy2 : integer; + destx1, desty1 : integer; +begin + srcx2 := srcx1 + SrcW; + srcy2 := srcy1 + SrcH; + result := nil; + destx1 := 0; + desty1 := 0; + dx := abs( integer( Height - desty1 ) ); + dy := abs( integer( SrcY2 - SrcY1 ) ); + e := ( dy shl 1 ) - dx; + dx2 := dx shl 1; + dy := dy shl 1; + dst_surface := SDL_CreateRGBSurface( SDL_HWPALETTE, width - destx1, Height - + desty1, + SrcSurface^.Format^.BitsPerPixel, + SrcSurface^.Format^.RMask, + SrcSurface^.Format^.GMask, + SrcSurface^.Format^.BMask, + SrcSurface^.Format^.AMask ); + if ( dst_surface^.format^.BytesPerPixel = 1 ) then + SDL_SetColors( dst_surface, @SrcSurface^.format^.palette^.colors^[ 0 ], 0, 256 ); + SDL_SetColorKey( dst_surface, sdl_srccolorkey, SrcSurface^.format^.colorkey ); + if ( SDL_MustLock( dst_surface ) ) then + if ( SDL_LockSurface( dst_surface ) < 0 ) then + exit; + for d := 0 to dx - 1 do + begin + SDL_Stretch8( SrcSurface, dst_surface, destx1, Width, SrcX1, SrcX2, SrcY1, desty1, + SrcSurface^.format^.BytesPerPixel ); + while e >= 0 do + begin + inc( SrcY1 ); + e := e - dx2; + end; + inc( desty1 ); + e := e + dy; + end; + if SDL_MUSTLOCK( dst_surface ) then + SDL_UnlockSurface( dst_surface ); + result := dst_surface; +end; + +procedure SDL_ScrollY( DstSurface : PSDL_Surface; DifY : integer ); +var + r1, r2 : TSDL_Rect; + //buffer: PSDL_Surface; + YPos : Integer; +begin + if ( DstSurface <> nil ) and ( DifY <> 0 ) then + begin + //if DifY > 0 then // going up + //begin + ypos := 0; + r1.x := 0; + r2.x := 0; + r1.w := DstSurface.w; + r2.w := DstSurface.w; + r1.h := DifY; + r2.h := DifY; + while ypos < DstSurface.h do + begin + r1.y := ypos; + r2.y := ypos + DifY; + SDL_BlitSurface( DstSurface, @r2, DstSurface, @r1 ); + ypos := ypos + DifY; + end; + //end + //else + //begin // Going Down + //end; + end; +end; + +procedure SDL_ScrollX( DstSurface : PSDL_Surface; DifX : integer ); +var + r1, r2 : TSDL_Rect; + buffer : PSDL_Surface; +begin + if ( DstSurface <> nil ) and ( DifX <> 0 ) then + begin + buffer := SDL_CreateRGBSurface( SDL_HWSURFACE, ( DstSurface^.w - DifX ) * 2, + DstSurface^.h * 2, + DstSurface^.Format^.BitsPerPixel, + DstSurface^.Format^.RMask, + DstSurface^.Format^.GMask, + DstSurface^.Format^.BMask, + DstSurface^.Format^.AMask ); + if buffer <> nil then + begin + if ( buffer^.format^.BytesPerPixel = 1 ) then + SDL_SetColors( buffer, @DstSurface^.format^.palette^.colors^[ 0 ], 0, 256 ); + r1 := SDLRect( DifX, 0, buffer^.w, buffer^.h ); + r2 := SDLRect( 0, 0, buffer^.w, buffer^.h ); + SDL_BlitSurface( DstSurface, @r1, buffer, @r2 ); + SDL_BlitSurface( buffer, @r2, DstSurface, @r2 ); + SDL_FreeSurface( buffer ); + end; + end; +end; + +procedure SDL_RotateRad( DstSurface, SrcSurface : PSDL_Surface; SrcRect : + PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Single ); +var + aSin, aCos : Single; + MX, MY, DX, DY, NX, NY, SX, SY, OX, OY, Width, Height, TX, TY, RX, RY, ROX, ROY : Integer; + Colour, TempTransparentColour : UInt32; + MAXX, MAXY : Integer; +begin + // Rotate the surface to the target surface. + TempTransparentColour := SrcSurface.format.colorkey; + if srcRect.w > srcRect.h then + begin + Width := srcRect.w; + Height := srcRect.w; + end + else + begin + Width := srcRect.h; + Height := srcRect.h; + end; + + maxx := DstSurface.w; + maxy := DstSurface.h; + aCos := cos( Angle ); + aSin := sin( Angle ); + + Width := round( abs( srcrect.h * acos ) + abs( srcrect.w * asin ) ); + Height := round( abs( srcrect.h * asin ) + abs( srcrect.w * acos ) ); + + OX := Width div 2; + OY := Height div 2; ; + MX := ( srcRect.x + ( srcRect.x + srcRect.w ) ) div 2; + MY := ( srcRect.y + ( srcRect.y + srcRect.h ) ) div 2; + ROX := ( -( srcRect.w div 2 ) ) + Offsetx; + ROY := ( -( srcRect.h div 2 ) ) + OffsetY; + Tx := ox + round( ROX * aSin - ROY * aCos ); + Ty := oy + round( ROY * aSin + ROX * aCos ); + SX := 0; + for DX := DestX - TX to DestX - TX + ( width ) do + begin + Inc( SX ); + SY := 0; + for DY := DestY - TY to DestY - TY + ( Height ) do + begin + RX := SX - OX; + RY := SY - OY; + NX := round( mx + RX * aSin + RY * aCos ); // + NY := round( my + RY * aSin - RX * aCos ); // + // Used for testing only + //SDL_PutPixel(DstSurface.SDLSurfacePointer,DX,DY,0); + if ( ( DX > 0 ) and ( DX < MAXX ) ) and ( ( DY > 0 ) and ( DY < MAXY ) ) then + begin + if ( NX >= srcRect.x ) and ( NX <= srcRect.x + srcRect.w ) then + begin + if ( NY >= srcRect.y ) and ( NY <= srcRect.y + srcRect.h ) then + begin + Colour := SDL_GetPixel( SrcSurface, NX, NY ); + if Colour <> TempTransparentColour then + begin + SDL_PutPixel( DstSurface, DX, DY, Colour ); + end; + end; + end; + end; + inc( SY ); + end; + end; +end; + +procedure SDL_RotateDeg( DstSurface, SrcSurface : PSDL_Surface; SrcRect : + PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Integer ); +begin + SDL_RotateRad( DstSurface, SrcSurface, SrcRect, DestX, DestY, OffsetX, OffsetY, DegToRad( Angle ) ); +end; + +function ValidateSurfaceRect( DstSurface : PSDL_Surface; dstrect : PSDL_Rect ) : TSDL_Rect; +var + RealRect : TSDL_Rect; + OutOfRange : Boolean; +begin + OutOfRange := false; + if dstrect = nil then + begin + RealRect.x := 0; + RealRect.y := 0; + RealRect.w := DstSurface.w; + RealRect.h := DstSurface.h; + end + else + begin + if dstrect.x < DstSurface.w then + begin + RealRect.x := dstrect.x; + end + else if dstrect.x < 0 then + begin + realrect.x := 0; + end + else + begin + OutOfRange := True; + end; + if dstrect.y < DstSurface.h then + begin + RealRect.y := dstrect.y; + end + else if dstrect.y < 0 then + begin + realrect.y := 0; + end + else + begin + OutOfRange := True; + end; + if OutOfRange = False then + begin + if realrect.x + dstrect.w <= DstSurface.w then + begin + RealRect.w := dstrect.w; + end + else + begin + RealRect.w := dstrect.w - realrect.x; + end; + if realrect.y + dstrect.h <= DstSurface.h then + begin + RealRect.h := dstrect.h; + end + else + begin + RealRect.h := dstrect.h - realrect.y; + end; + end; + end; + if OutOfRange = False then + begin + result := realrect; + end + else + begin + realrect.w := 0; + realrect.h := 0; + realrect.x := 0; + realrect.y := 0; + result := realrect; + end; +end; + +procedure SDL_FillRectAdd( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); +var + RealRect : TSDL_Rect; + Addr : pointer; + ModX, BPP : cardinal; + x, y, R, G, B, SrcColor : cardinal; +begin + RealRect := ValidateSurfaceRect( DstSurface, DstRect ); + if ( RealRect.w > 0 ) and ( RealRect.h > 0 ) then + begin + SDL_LockSurface( DstSurface ); + BPP := DstSurface.format.BytesPerPixel; + with DstSurface^ do + begin + Addr := pointer( UInt32( pixels ) + UInt32( RealRect.y ) * pitch + UInt32( RealRect.x ) * BPP ); + ModX := Pitch - UInt32( RealRect.w ) * BPP; + end; + case DstSurface.format.BitsPerPixel of + 8 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $E0 + Color and $E0; + G := SrcColor and $1C + Color and $1C; + B := SrcColor and $03 + Color and $03; + if R > $E0 then + R := $E0; + if G > $1C then + G := $1C; + if B > $03 then + B := $03; + PUInt8( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 15 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $7C00 + Color and $7C00; + G := SrcColor and $03E0 + Color and $03E0; + B := SrcColor and $001F + Color and $001F; + if R > $7C00 then + R := $7C00; + if G > $03E0 then + G := $03E0; + if B > $001F then + B := $001F; + PUInt16( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 16 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $F800 + Color and $F800; + G := SrcColor and $07C0 + Color and $07C0; + B := SrcColor and $001F + Color and $001F; + if R > $F800 then + R := $F800; + if G > $07C0 then + G := $07C0; + if B > $001F then + B := $001F; + PUInt16( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 24 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $00FF0000 + Color and $00FF0000; + G := SrcColor and $0000FF00 + Color and $0000FF00; + B := SrcColor and $000000FF + Color and $000000FF; + if R > $FF0000 then + R := $FF0000; + if G > $00FF00 then + G := $00FF00; + if B > $0000FF then + B := $0000FF; + PUInt32( Addr )^ := SrcColor and $FF000000 or R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 32 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $00FF0000 + Color and $00FF0000; + G := SrcColor and $0000FF00 + Color and $0000FF00; + B := SrcColor and $000000FF + Color and $000000FF; + if R > $FF0000 then + R := $FF0000; + if G > $00FF00 then + G := $00FF00; + if B > $0000FF then + B := $0000FF; + PUInt32( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + end; + SDL_UnlockSurface( DstSurface ); + end; +end; + +procedure SDL_FillRectSub( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); +var + RealRect : TSDL_Rect; + Addr : pointer; + ModX, BPP : cardinal; + x, y, R, G, B, SrcColor : cardinal; +begin + RealRect := ValidateSurfaceRect( DstSurface, DstRect ); + if ( RealRect.w > 0 ) and ( RealRect.h > 0 ) then + begin + SDL_LockSurface( DstSurface ); + BPP := DstSurface.format.BytesPerPixel; + with DstSurface^ do + begin + Addr := pointer( UInt32( pixels ) + UInt32( RealRect.y ) * pitch + UInt32( RealRect.x ) * BPP ); + ModX := Pitch - UInt32( RealRect.w ) * BPP; + end; + case DstSurface.format.BitsPerPixel of + 8 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $E0 - Color and $E0; + G := SrcColor and $1C - Color and $1C; + B := SrcColor and $03 - Color and $03; + if R > $E0 then + R := 0; + if G > $1C then + G := 0; + if B > $03 then + B := 0; + PUInt8( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 15 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $7C00 - Color and $7C00; + G := SrcColor and $03E0 - Color and $03E0; + B := SrcColor and $001F - Color and $001F; + if R > $7C00 then + R := 0; + if G > $03E0 then + G := 0; + if B > $001F then + B := 0; + PUInt16( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 16 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $F800 - Color and $F800; + G := SrcColor and $07C0 - Color and $07C0; + B := SrcColor and $001F - Color and $001F; + if R > $F800 then + R := 0; + if G > $07C0 then + G := 0; + if B > $001F then + B := 0; + PUInt16( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 24 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $00FF0000 - Color and $00FF0000; + G := SrcColor and $0000FF00 - Color and $0000FF00; + B := SrcColor and $000000FF - Color and $000000FF; + if R > $FF0000 then + R := 0; + if G > $00FF00 then + G := 0; + if B > $0000FF then + B := 0; + PUInt32( Addr )^ := SrcColor and $FF000000 or R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 32 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $00FF0000 - Color and $00FF0000; + G := SrcColor and $0000FF00 - Color and $0000FF00; + B := SrcColor and $000000FF - Color and $000000FF; + if R > $FF0000 then + R := 0; + if G > $00FF00 then + G := 0; + if B > $0000FF then + B := 0; + PUInt32( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + end; + SDL_UnlockSurface( DstSurface ); + end; +end; + +procedure SDL_GradientFillRect( DstSurface : PSDL_Surface; const Rect : PSDL_Rect; const StartColor, EndColor : TSDL_Color; const Style : TGradientStyle ); +var + FBC : array[ 0..255 ] of Cardinal; + // temp vars + i, YR, YG, YB, SR, SG, SB, DR, DG, DB : Integer; + + TempStepV, TempStepH : Single; + TempLeft, TempTop, TempHeight, TempWidth : integer; + TempRect : TSDL_Rect; + +begin + // calc FBC + YR := StartColor.r; + YG := StartColor.g; + YB := StartColor.b; + SR := YR; + SG := YG; + SB := YB; + DR := EndColor.r - SR; + DG := EndColor.g - SG; + DB := EndColor.b - SB; + + for i := 0 to 255 do + begin + FBC[ i ] := SDL_MapRGB( DstSurface.format, YR, YG, YB ); + YR := SR + round( DR / 255 * i ); + YG := SG + round( DG / 255 * i ); + YB := SB + round( DB / 255 * i ); + end; + + // if aStyle = 1 then begin + TempStepH := Rect.w / 255; + TempStepV := Rect.h / 255; + TempHeight := Trunc( TempStepV + 1 ); + TempWidth := Trunc( TempStepH + 1 ); + TempTop := 0; + TempLeft := 0; + TempRect.x := Rect.x; + TempRect.y := Rect.y; + TempRect.h := Rect.h; + TempRect.w := Rect.w; + + case Style of + gsHorizontal : + begin + TempRect.h := TempHeight; + for i := 0 to 255 do + begin + TempRect.y := Rect.y + TempTop; + SDL_FillRect( DstSurface, @TempRect, FBC[ i ] ); + TempTop := Trunc( TempStepV * i ); + end; + end; + gsVertical : + begin + TempRect.w := TempWidth; + for i := 0 to 255 do + begin + TempRect.x := Rect.x + TempLeft; + SDL_FillRect( DstSurface, @TempRect, FBC[ i ] ); + TempLeft := Trunc( TempStepH * i ); + end; + end; + end; +end; + +procedure SDL_2xBlit( Src, Dest : PSDL_Surface ); +var + ReadAddr, WriteAddr, ReadRow, WriteRow : UInt32; + SrcPitch, DestPitch, x, y, w, h : UInt32; +begin + if ( Src = nil ) or ( Dest = nil ) then + exit; + if ( Src.w shl 1 ) < Dest.w then + exit; + if ( Src.h shl 1 ) < Dest.h then + exit; + + if SDL_MustLock( Src ) then + SDL_LockSurface( Src ); + if SDL_MustLock( Dest ) then + SDL_LockSurface( Dest ); + + ReadRow := UInt32( Src.Pixels ); + WriteRow := UInt32( Dest.Pixels ); + + SrcPitch := Src.pitch; + DestPitch := Dest.pitch; + + w := Src.w; + h := Src.h; + + case Src.format.BytesPerPixel of + 1 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + mov ebx, DestPitch + + @LoopX: + mov al, [ecx] // PUInt8(WriteAddr)^ := PUInt8(ReadAddr)^; + mov [edx], al + mov [edx + 1], al // PUInt8(WriteAddr + 1)^ := PUInt8(ReadAddr)^; + mov [edx + ebx], al // PUInt8(WriteAddr + DestPitch)^ := PUInt8(ReadAddr)^; + mov [edx + ebx + 1], al // PUInt8(WriteAddr + DestPitch + 1)^ := PUInt8(ReadAddr)^; + + inc ecx // inc(ReadAddr); + add edx, 2 // inc(WriteAddr, 2); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + 2 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + mov ebx, DestPitch + + @LoopX: + mov ax, [ecx] // PUInt16(WriteAddr)^ := PUInt16(ReadAddr)^; + mov [edx], ax + mov [edx + 2], ax // PUInt16(WriteAddr + 2)^ := PUInt16(ReadAddr)^; + mov [edx + ebx], ax // PUInt16(WriteAddr + DestPitch)^ := PUInt16(ReadAddr)^; + mov [edx + ebx + 2], ax // PUInt16(WriteAddr + DestPitch + 2)^ := PUInt16(ReadAddr)^; + + add ecx, 2 // inc(ReadAddr, 2); + add edx, 4 // inc(WriteAddr, 4); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + 3 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + mov ebx, DestPitch + + @LoopX: + mov eax, [ecx] // (PUInt32(WriteAddr)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + and eax, $00ffffff + and dword ptr [edx], $ff000000 + or [edx], eax + and dword ptr [edx + 3], $00ffffff // (PUInt32(WriteAddr + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + or [edx + 3], eax + and dword ptr [edx + ebx], $00ffffff // (PUInt32(WriteAddr + DestPitch)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + or [edx + ebx], eax + and dword ptr [edx + ebx + 3], $00ffffff // (PUInt32(WriteAddr + DestPitch + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + or [edx + ebx + 3], eax + + add ecx, 3 // inc(ReadAddr, 3); + add edx, 6 // inc(WriteAddr, 6); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + 4 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + mov ebx, DestPitch + + @LoopX: + mov eax, [ecx] // PUInt32(WriteAddr)^ := PUInt32(ReadAddr)^; + mov [edx], eax + mov [edx + 4], eax // PUInt32(WriteAddr + 4)^ := PUInt32(ReadAddr)^; + mov [edx + ebx], eax // PUInt32(WriteAddr + DestPitch)^ := PUInt32(ReadAddr)^; + mov [edx + ebx + 4], eax // PUInt32(WriteAddr + DestPitch + 4)^ := PUInt32(ReadAddr)^; + + add ecx, 4 // inc(ReadAddr, 4); + add edx, 8 // inc(WriteAddr, 8); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + end; + + if SDL_MustLock( Src ) then + SDL_UnlockSurface( Src ); + if SDL_MustLock( Dest ) then + SDL_UnlockSurface( Dest ); +end; + +procedure SDL_Scanline2xBlit( Src, Dest : PSDL_Surface ); +var + ReadAddr, WriteAddr, ReadRow, WriteRow : UInt32; + SrcPitch, DestPitch, x, y, w, h : UInt32; +begin + if ( Src = nil ) or ( Dest = nil ) then + exit; + if ( Src.w shl 1 ) < Dest.w then + exit; + if ( Src.h shl 1 ) < Dest.h then + exit; + + if SDL_MustLock( Src ) then + SDL_LockSurface( Src ); + if SDL_MustLock( Dest ) then + SDL_LockSurface( Dest ); + + ReadRow := UInt32( Src.Pixels ); + WriteRow := UInt32( Dest.Pixels ); + + SrcPitch := Src.pitch; + DestPitch := Dest.pitch; + + w := Src.w; + h := Src.h; + + case Src.format.BytesPerPixel of + 1 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + + @LoopX: + mov al, [ecx] // PUInt8(WriteAddr)^ := PUInt8(ReadAddr)^; + mov [edx], al + mov [edx + 1], al // PUInt8(WriteAddr + 1)^ := PUInt8(ReadAddr)^; + + inc ecx // inc(ReadAddr); + add edx, 2 // inc(WriteAddr, 2); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + 2 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + + @LoopX: + mov ax, [ecx] // PUInt16(WriteAddr)^ := PUInt16(ReadAddr)^; + mov [edx], ax + mov [edx + 2], eax // PUInt16(WriteAddr + 2)^ := PUInt16(ReadAddr)^; + + add ecx, 2 // inc(ReadAddr, 2); + add edx, 4 // inc(WriteAddr, 4); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + 3 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + + @LoopX: + mov eax, [ecx] // (PUInt32(WriteAddr)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + and eax, $00ffffff + and dword ptr [edx], $ff000000 + or [edx], eax + and dword ptr [edx + 3], $00ffffff // (PUInt32(WriteAddr + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + or [edx + 3], eax + + add ecx, 3 // inc(ReadAddr, 3); + add edx, 6 // inc(WriteAddr, 6); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + 4 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + + @LoopX: + mov eax, [ecx] // PUInt32(WriteAddr)^ := PUInt32(ReadAddr)^; + mov [edx], eax + mov [edx + 4], eax // PUInt32(WriteAddr + 4)^ := PUInt32(ReadAddr)^; + + add ecx, 4 // inc(ReadAddr, 4); + add edx, 8 // inc(WriteAddr, 8); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + end; + + if SDL_MustLock( Src ) then + SDL_UnlockSurface( Src ); + if SDL_MustLock( Dest ) then + SDL_UnlockSurface( Dest ); +end; + +procedure SDL_50Scanline2xBlit( Src, Dest : PSDL_Surface ); +var + ReadAddr, WriteAddr, ReadRow, WriteRow : UInt32; + SrcPitch, DestPitch, x, y, w, h : UInt32; +begin + if ( Src = nil ) or ( Dest = nil ) then + exit; + if ( Src.w shl 1 ) < Dest.w then + exit; + if ( Src.h shl 1 ) < Dest.h then + exit; + + if SDL_MustLock( Src ) then + SDL_LockSurface( Src ); + if SDL_MustLock( Dest ) then + SDL_LockSurface( Dest ); + + ReadRow := UInt32( Src.Pixels ); + WriteRow := UInt32( Dest.Pixels ); + + SrcPitch := Src.pitch; + DestPitch := Dest.pitch; + + w := Src.w; + h := Src.h; + + case Src.format.BitsPerPixel of + 8 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + mov ebx, DestPitch + + @LoopX: + mov al, [ecx] // PUInt8(WriteAddr)^ := PUInt8(ReadAddr)^; + mov [edx], al + mov [edx + 1], al // PUInt8(WriteAddr + 1)^ := PUInt8(ReadAddr)^; + shr al, 1 + and al, $6d + mov [edx + ebx], al // PUInt8(WriteAddr + DestPitch)^ := PUInt8(ReadAddr)^; + mov [edx + ebx + 1], al // PUInt8(WriteAddr + DestPitch + 1)^ := PUInt8(ReadAddr)^; + + inc ecx // inc(ReadAddr); + add edx, 2 // inc(WriteAddr, 2); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + 15 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + mov ebx, DestPitch + + @LoopX: + mov ax, [ecx] // PUInt16(WriteAddr)^ := PUInt16(ReadAddr)^; + mov [edx], ax + mov [edx + 2], ax // PUInt16(WriteAddr + 2)^ := PUInt16(ReadAddr)^; + shr ax, 1 + and ax, $3def + mov [edx + ebx], ax // PUInt16(WriteAddr + DestPitch)^ := PUInt16(ReadAddr)^; + mov [edx + ebx + 2], ax // PUInt16(WriteAddr + DestPitch + 2)^ := PUInt16(ReadAddr)^; + + add ecx, 2 // inc(ReadAddr, 2); + add edx, 4 // inc(WriteAddr, 4); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + 16 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + mov ebx, DestPitch + + @LoopX: + mov ax, [ecx] // PUInt16(WriteAddr)^ := PUInt16(ReadAddr)^; + mov [edx], ax + mov [edx + 2], ax // PUInt16(WriteAddr + 2)^ := PUInt16(ReadAddr)^; + shr ax, 1 + and ax, $7bef + mov [edx + ebx], ax // PUInt16(WriteAddr + DestPitch)^ := PUInt16(ReadAddr)^; + mov [edx + ebx + 2], ax // PUInt16(WriteAddr + DestPitch + 2)^ := PUInt16(ReadAddr)^; + + add ecx, 2 // inc(ReadAddr, 2); + add edx, 4 // inc(WriteAddr, 4); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + 24 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + mov ebx, DestPitch + + @LoopX: + mov eax, [ecx] // (PUInt32(WriteAddr)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + and eax, $00ffffff + and dword ptr [edx], $ff000000 + or [edx], eax + and dword ptr [edx + 3], $00ffffff // (PUInt32(WriteAddr + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + or [edx + 3], eax + shr eax, 1 + and eax, $007f7f7f + and dword ptr [edx + ebx], $00ffffff // (PUInt32(WriteAddr + DestPitch)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + or [edx + ebx], eax + and dword ptr [edx + ebx + 3], $00ffffff // (PUInt32(WriteAddr + DestPitch + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + or [edx + ebx + 3], eax + + add ecx, 3 // inc(ReadAddr, 3); + add edx, 6 // inc(WriteAddr, 6); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + 32 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + mov ebx, DestPitch + + @LoopX: + mov eax, [ecx] // PUInt32(WriteAddr)^ := PUInt32(ReadAddr)^; + mov [edx], eax + mov [edx + 4], eax // PUInt32(WriteAddr + 4)^ := PUInt32(ReadAddr)^; + shr eax, 1 + and eax, $7f7f7f7f + mov [edx + ebx], eax // PUInt32(WriteAddr + DestPitch)^ := PUInt32(ReadAddr)^; + mov [edx + ebx + 4], eax // PUInt32(WriteAddr + DestPitch + 4)^ := PUInt32(ReadAddr)^; + + add ecx, 4 // inc(ReadAddr, 4); + add edx, 8 // inc(WriteAddr, 8); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + end; + + if SDL_MustLock( Src ) then + SDL_UnlockSurface( Src ); + if SDL_MustLock( Dest ) then + SDL_UnlockSurface( Dest ); +end; + +function SDL_PixelTestSurfaceVsRect( SrcSurface1 : PSDL_Surface; SrcRect1 : PSDL_Rect; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : +boolean; +var + Src_Rect1, Src_Rect2 : TSDL_Rect; + right1, bottom1 : integer; + right2, bottom2 : integer; + Scan1Start, Scan2Start, ScanWidth, ScanHeight : cardinal; + Mod1: cardinal; + Addr1 : cardinal; + BPP : cardinal; + Pitch1 : cardinal; + TransparentColor1 : cardinal; + tx, ty : cardinal; + StartTick : cardinal; + Color1 : cardinal; +begin + Result := false; + if SrcRect1 = nil then + begin + with Src_Rect1 do + begin + x := 0; + y := 0; + w := SrcSurface1.w; + h := SrcSurface1.h; + end; + end + else + Src_Rect1 := SrcRect1^; + + Src_Rect2 := SrcRect2^; + with Src_Rect1 do + begin + Right1 := Left1 + w; + Bottom1 := Top1 + h; + end; + with Src_Rect2 do + begin + Right2 := Left2 + w; + Bottom2 := Top2 + h; + end; + if ( Left1 >= Right2 ) or ( Right1 <= Left2 ) or ( Top1 >= Bottom2 ) or ( +Bottom1 <= + Top2 ) then + exit; + if Left1 <= Left2 then + begin + // 1. left, 2. right + Scan1Start := Src_Rect1.x + Left2 - Left1; + Scan2Start := Src_Rect2.x; + ScanWidth := Right1 - Left2; + with Src_Rect2 do + if ScanWidth > w then + ScanWidth := w; + end + else + begin + // 1. right, 2. left + Scan1Start := Src_Rect1.x; + Scan2Start := Src_Rect2.x + Left1 - Left2; + ScanWidth := Right2 - Left1; + with Src_Rect1 do + if ScanWidth > w then + ScanWidth := w; + end; + with SrcSurface1^ do + begin + Pitch1 := Pitch; + Addr1 := cardinal( Pixels ); + inc( Addr1, Pitch1 * UInt32( Src_Rect1.y ) ); + with format^ do + begin + BPP := BytesPerPixel; + TransparentColor1 := colorkey; + end; + end; + + Mod1 := Pitch1 - ( ScanWidth * BPP ); + + inc( Addr1, BPP * Scan1Start ); + + if Top1 <= Top2 then + begin + // 1. up, 2. down + ScanHeight := Bottom1 - Top2; + if ScanHeight > Src_Rect2.h then + ScanHeight := Src_Rect2.h; + inc( Addr1, Pitch1 * UInt32( Top2 - Top1 ) ); + end + else + begin + // 1. down, 2. up + ScanHeight := Bottom2 - Top1; + if ScanHeight > Src_Rect1.h then + ScanHeight := Src_Rect1.h; + + end; + case BPP of + 1 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PByte( Addr1 )^ <> TransparentColor1 ) then + begin + Result := true; + exit; + end; + inc( Addr1 ); + + end; + inc( Addr1, Mod1 ); + + end; + 2 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PWord( Addr1 )^ <> TransparentColor1 ) then + begin + Result := true; + exit; + end; + inc( Addr1, 2 ); + + end; + inc( Addr1, Mod1 ); + + end; + 3 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + Color1 := PLongWord( Addr1 )^ and $00FFFFFF; + + if ( Color1 <> TransparentColor1 ) + then + begin + Result := true; + exit; + end; + inc( Addr1, 3 ); + + end; + inc( Addr1, Mod1 ); + + end; + 4 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PLongWord( Addr1 )^ <> TransparentColor1 ) then + begin + Result := true; + exit; + end; + inc( Addr1, 4 ); + + end; + inc( Addr1, Mod1 ); + + end; + end; +end; + +procedure SDL_ORSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr, TransparentColor : cardinal; + // TransparentColor: cardinal; + _ebx, _esi, _edi, _esp : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := Format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + WorkY := Src.h; + case bits of + 8 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov al, [esi] // AL := source color + cmp al, 0 + je @SkipColor // if AL=0 or AL=transparent color then skip everything + cmp al, byte ptr TransparentColor + je @SkipColor + or al, [edi] + mov [edi], al + @SkipColor: + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 15 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov ax, [esi] // AX := source color + cmp ax, 0 + je @SkipColor // if AX=0 then skip everything + cmp ax, word ptr TransparentColor + je @SkipColor + or ax, [edi] + mov [edi], ax + @SkipColor: + add esi, 2 + add edi, 2 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 16 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov ax, [esi] // AX := source color + cmp ax, 0 + je @SkipColor // if AX=0 then skip everything + cmp ax, word ptr TransparentColor + je @SkipColor + or ax, [edi] + mov [edi], ax + @SkipColor: + add esi, 2 + add edi, 2 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 24 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + add WorkX, ax // WorkX := Src.w * 2 + add WorkX, ax // WorkX := Src.w * 3 + @Loopx: + mov al, [esi] // AL := source color + or al, [edi] + mov [edi], al + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 32 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + shl ax, 2 + mov WorkX, ax // WorkX := Src.w * 4 + @Loopx: + mov al, [esi] // AL := source color + or al, [edi] + mov [edi], al + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); +end; + +procedure SDL_ANDSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr, TransparentColor : cardinal; + // TransparentColor: cardinal; + _ebx, _esi, _edi, _esp : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := Format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + WorkY := Src.h; + case bits of + 8 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov al, [esi] // AL := source color + cmp al, 0 + je @SkipColor // if AL=0 or AL=transparent color then skip everything + cmp al, byte ptr TransparentColor + je @SkipColor + and al, [edi] + mov [edi], al + @SkipColor: + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 15 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov ax, [esi] // AX := source color + cmp ax, 0 + je @SkipColor // if AX=0 then skip everything + cmp ax, word ptr TransparentColor + je @SkipColor + and ax, [edi] + mov [edi], ax + @SkipColor: + add esi, 2 + add edi, 2 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 16 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov ax, [esi] // AX := source color + cmp ax, 0 + je @SkipColor // if AX=0 then skip everything + cmp ax, word ptr TransparentColor + je @SkipColor + and ax, [edi] + mov [edi], ax + @SkipColor: + add esi, 2 + add edi, 2 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 24 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + add WorkX, ax // WorkX := Src.w * 2 + add WorkX, ax // WorkX := Src.w * 3 + @Loopx: + mov al, [esi] // AL := source color + and al, [edi] + mov [edi], al + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 32 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + shl ax, 2 + mov WorkX, ax // WorkX := Src.w * 4 + @Loopx: + mov al, [esi] // AL := source color + and al, [edi] + mov [edi], al + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); +end; + + +procedure SDL_GTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := Format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + WorkY := Src.h; + case bits of + 8 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt8( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt8( DestAddr )^; + if Pixel2 > 0 then + begin + if Pixel2 and $E0 > Pixel1 and $E0 then R := Pixel2 and $E0 else R := Pixel1 and $E0; + if Pixel2 and $1C > Pixel1 and $1C then G := Pixel2 and $1C else G := Pixel1 and $1C; + if Pixel2 and $03 > Pixel1 and $03 then B := Pixel2 and $03 else B := Pixel1 and $03; + + if R > $E0 then + R := $E0; + if G > $1C then + G := $1C; + if B > $03 then + B := $03; + PUInt8( DestAddr )^ := R or G or B; + end + else + PUInt8( DestAddr )^ := Pixel1; + end; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 15 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $7C00 > Pixel1 and $7C00 then R := Pixel2 and $7C00 else R := Pixel1 and $7C00; + if Pixel2 and $03E0 > Pixel1 and $03E0 then G := Pixel2 and $03E0 else G := Pixel1 and $03E0; + if Pixel2 and $001F > Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; + + PUInt16( DestAddr )^ := R or G or B; + end + else + PUInt16( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 16 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $F800 > Pixel1 and $F800 then R := Pixel2 and $F800 else R := Pixel1 and $F800; + if Pixel2 and $07E0 > Pixel1 and $07E0 then G := Pixel2 and $07E0 else G := Pixel1 and $07E0; + if Pixel2 and $001F > Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; + + PUInt16( DestAddr )^ := R or G or B; + end + else + PUInt16( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 24 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; + if Pixel2 > 0 then + begin + + if Pixel2 and $FF0000 > Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; + if Pixel2 and $00FF00 > Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; + if Pixel2 and $0000FF > Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; + + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or ( R or G or B ); + end + else + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or Pixel1; + end; + inc( SrcAddr, 3 ); + inc( DestAddr, 3 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 32 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $FF0000 > Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; + if Pixel2 and $00FF00 > Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; + if Pixel2 and $0000FF > Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; + + PUInt32( DestAddr )^ := R or G or B; + end + else + PUInt32( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 4 ); + inc( DestAddr, 4 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); +end; + + +procedure SDL_LTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := Format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + WorkY := Src.h; + case bits of + 8 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt8( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt8( DestAddr )^; + if Pixel2 > 0 then + begin + if Pixel2 and $E0 < Pixel1 and $E0 then R := Pixel2 and $E0 else R := Pixel1 and $E0; + if Pixel2 and $1C < Pixel1 and $1C then G := Pixel2 and $1C else G := Pixel1 and $1C; + if Pixel2 and $03 < Pixel1 and $03 then B := Pixel2 and $03 else B := Pixel1 and $03; + + if R > $E0 then + R := $E0; + if G > $1C then + G := $1C; + if B > $03 then + B := $03; + PUInt8( DestAddr )^ := R or G or B; + end + else + PUInt8( DestAddr )^ := Pixel1; + end; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 15 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $7C00 < Pixel1 and $7C00 then R := Pixel2 and $7C00 else R := Pixel1 and $7C00; + if Pixel2 and $03E0 < Pixel1 and $03E0 then G := Pixel2 and $03E0 else G := Pixel1 and $03E0; + if Pixel2 and $001F < Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; + + PUInt16( DestAddr )^ := R or G or B; + end + else + PUInt16( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 16 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $F800 < Pixel1 and $F800 then R := Pixel2 and $F800 else R := Pixel1 and $F800; + if Pixel2 and $07E0 < Pixel1 and $07E0 then G := Pixel2 and $07E0 else G := Pixel1 and $07E0; + if Pixel2 and $001F < Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; + + PUInt16( DestAddr )^ := R or G or B; + end + else + PUInt16( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 24 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; + if Pixel2 > 0 then + begin + + if Pixel2 and $FF0000 < Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; + if Pixel2 and $00FF00 < Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; + if Pixel2 and $0000FF < Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; + + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or ( R or G or B ); + end + else + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or Pixel1; + end; + inc( SrcAddr, 3 ); + inc( DestAddr, 3 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 32 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $FF0000 < Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; + if Pixel2 and $00FF00 < Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; + if Pixel2 and $0000FF < Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; + + PUInt32( DestAddr )^ := R or G or B; + end + else + PUInt32( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 4 ); + inc( DestAddr, 4 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); +end; + +function SDL_ClipLine(var x1,y1,x2,y2: Integer; ClipRect: PSDL_Rect) : boolean; +var tflag, flag1, flag2: word; + txy, xedge, yedge: Integer; + slope: single; + + function ClipCode(x,y: Integer): word; + begin + Result := 0; + if x < ClipRect.x then Result := 1; + if x >= ClipRect.w + ClipRect.x then Result := Result or 2; + if y < ClipRect.y then Result := Result or 4; + if y >= ClipRect.h + ClipRect.y then Result := Result or 8; + end; + +begin + flag1 := ClipCode(x1,y1); + flag2 := ClipCode(x2,y2); + result := true; + + while true do + begin + if (flag1 or flag2) = 0 then Exit; // all in + + if (flag1 and flag2) <> 0 then + begin + result := false; + Exit; // all out + end; + + if flag2 = 0 then + begin + txy := x1; x1 := x2; x2 := txy; + txy := y1; y1 := y2; y2 := txy; + tflag := flag1; flag1 := flag2; flag2 := tflag; + end; + + if (flag2 and 3) <> 0 then + begin + if (flag2 and 1) <> 0 then + xedge := ClipRect.x + else + xedge := ClipRect.w + ClipRect.x -1; // back 1 pixel otherwise we end up in a loop + + slope := (y2 - y1) / (x2 - x1); + y2 := y1 + Round(slope * (xedge - x1)); + x2 := xedge; + end + else + begin + if (flag2 and 4) <> 0 then + yedge := ClipRect.y + else + yedge := ClipRect.h + ClipRect.y -1; // up 1 pixel otherwise we end up in a loop + + slope := (x2 - x1) / (y2 - y1); + x2 := x1 + Round(slope * (yedge - y1)); + y2 := yedge; + end; + + flag2 := ClipCode(x2, y2); + end; +end; + +end. + + diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlinput.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlinput.pas new file mode 100644 index 00000000..2955d17a --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlinput.pas @@ -0,0 +1,692 @@ +unit sdlinput; +{ + $Id: sdlinput.pas,v 1.7 2004/09/30 22:32:04 savage Exp $ + +} +{******************************************************************************} +{ } +{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } +{ SDL Input Wrapper } +{ } +{ } +{ The initial developer of this Pascal code was : } +{ Dominique Louis } +{ } +{ Portions created by Dominique Louis are } +{ Copyright (C) 2003 - 2100 Dominique Louis. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ Dominique Louis } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ SDL Mouse, Keyboard and Joystick wrapper } +{ } +{ } +{ Requires } +{ -------- } +{ SDL.dll on Windows platforms } +{ libSDL-1.1.so.0 on Linux platform } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ March 12 2003 - DL : Initial creation } +{ } +{ February 02 2004 - DL : Added Custom Cursor Support to the Mouse class } +{ + $Log: sdlinput.pas,v $ + Revision 1.7 2004/09/30 22:32:04 savage + Updated with slightly different header comments + + Revision 1.6 2004/09/12 21:52:58 savage + Slight changes to fix some issues with the sdl classes. + + Revision 1.5 2004/05/10 21:11:49 savage + changes required to help get SoAoS off the ground. + + Revision 1.4 2004/05/03 22:38:40 savage + Added the ability to enable or disable certain inputs @ runtime. Basically it just does not call UpdateInput if Enabled = false. + Can also disable and enable input devices via the InputManager. + + Revision 1.3 2004/04/28 21:27:01 savage + Updated Joystick code and event handlers. Needs testing... + + Revision 1.2 2004/02/14 22:36:29 savage + Fixed inconsistencies of using LoadLibrary and LoadModule. + Now all units make use of LoadModule rather than LoadLibrary and other dynamic proc procedures. + + Revision 1.1 2004/02/05 00:08:20 savage + Module 1.0 release + + +} +{******************************************************************************} + +interface + +{$i jedi-sdl.inc} + +uses + Classes, + sdl; + +type + TSDLInputType = ( itJoystick , itKeyBoard, itMouse ); + TSDLInputTypes = set of TSDLInputType; + + TSDLCustomInput = class( TObject ) + private + FEnabled: Boolean; + public + constructor Create; + function UpdateInput( event: TSDL_EVENT ) : Boolean; virtual; abstract; + property Enabled : Boolean read FEnabled write FEnabled; + end; + + TSDLJoyAxisMoveEvent = procedure ( Which: UInt8; Axis: UInt8; Value: SInt16 ) {$IFNDEF NOT_OO}of object{$ENDIF}; + TSDLJoyBallMoveEvent = procedure ( Which: UInt8; Ball: UInt8; RelativePos: TPoint ) {$IFNDEF NOT_OO}of object{$ENDIF}; + TSDLJoyHatMoveEvent = procedure ( Which: UInt8; Hat: UInt8; Value: SInt16 ) {$IFNDEF NOT_OO}of object{$ENDIF}; + TSDLJoyButtonEvent = procedure ( Which: UInt8; Button: UInt8; State: SInt16 ) {$IFNDEF NOT_OO}of object{$ENDIF}; + + + TSDLJoyStick = class( TSDLCustomInput ) + private + FJoystick : PSDL_Joystick; + FJoystickIndex : Integer; + FJoyAxisMoveEvent : TSDLJoyAxisMoveEvent; + FJoyBallMoveEvent : TSDLJoyBallMoveEvent; + FJoyHatMoveEvent : TSDLJoyHatMoveEvent; + FJoyButtonDownEvent : TSDLJoyButtonEvent; + FJoyButtonUpEvent : TSDLJoyButtonEvent; + procedure DoAxisMove( Event : TSDL_Event ); + procedure DoBallMove( Event : TSDL_Event ); + procedure DoHatMove( Event : TSDL_Event ); + procedure DoButtonDown( Event : TSDL_Event ); + procedure DoButtonUp( Event : TSDL_Event ); + function GetName: PChar; + function GetNumAxes: integer; + function GetNumBalls: integer; + function GetNumButtons: integer; + function GetNumHats: integer; + public + constructor Create( Index : Integer ); + destructor Destroy; override; + procedure Open; + procedure Close; + function UpdateInput( Event: TSDL_EVENT ) : Boolean; override; + property Name : PChar read GetName; + property NumAxes : integer read GetNumAxes; + property NumBalls : integer read GetNumBalls; + property NumButtons : integer read GetNumButtons; + property NumHats : integer read GetNumHats; + property OnAxisMove : TSDLJoyAxisMoveEvent read FJoyAxisMoveEvent write FJoyAxisMoveEvent; + property OnBallMove : TSDLJoyBallMoveEvent read FJoyBallMoveEvent write FJoyBallMoveEvent; + property OnHatMove : TSDLJoyHatMoveEvent read FJoyHatMoveEvent write FJoyHatMoveEvent; + property OnButtonDown : TSDLJoyButtonEvent read FJoyButtonDownEvent write FJoyButtonDownEvent; + property OnButtonUp : TSDLJoyButtonEvent read FJoyButtonUpEvent write FJoyButtonUpEvent; + end; + + TSDLJoySticks = class( TObject ) + private + FNumOfJoySticks: Integer; + FJoyStickList : TList; + function GetJoyStick(Index: integer): TSDLJoyStick; + procedure SetJoyStick(Index: integer; const Value: TSDLJoyStick); + public + constructor Create; + destructor Destroy; override; + function UpdateInput( event: TSDL_EVENT ) : Boolean; + property NumOfJoySticks : Integer read FNumOfJoySticks write FNumOfJoySticks; + property JoySticks[ Index : integer ] : TSDLJoyStick read GetJoyStick write SetJoyStick; + end; + + TSDLKeyBoardEvent = procedure ( var Key: TSDLKey; Shift: TSDLMod; unicode : UInt16 ) {$IFNDEF NOT_OO}of object{$ENDIF}; + + TSDLKeyBoard = class( TSDLCustomInput ) + private + FKeys : PKeyStateArr; + FOnKeyUp: TSDLKeyBoardEvent; + FOnKeyDown: TSDLKeyBoardEvent; + procedure DoKeyDown( keysym : PSDL_keysym ); + procedure DoKeyUp( keysym : PSDL_keysym ); + public + function IsKeyDown( Key : TSDLKey ) : Boolean; + function IsKeyUp( Key : TSDLKey ) : Boolean; + function UpdateInput( event: TSDL_EVENT ) : Boolean; override; + property Keys : PKeyStateArr read FKeys write FKeys; + property OnKeyDown : TSDLKeyBoardEvent read FOnKeyDown write FOnKeyDown; + property OnKeyUp : TSDLKeyBoardEvent read FOnKeyUp write FOnKeyUp; + end; + + TSDLMouseButtonEvent = procedure ( Button : Integer; Shift: TSDLMod; MousePos : TPoint ) {$IFNDEF NOT_OO}of object{$ENDIF}; + TSDLMouseMoveEvent = procedure ( Shift: TSDLMod; CurrentPos : TPoint; RelativePos : TPoint ) {$IFNDEF NOT_OO}of object{$ENDIF}; + TSDLMouseWheelEvent = procedure ( WheelDelta : Integer; Shift: TSDLMod; MousePos : TPoint ) {$IFNDEF NOT_OO}of object{$ENDIF}; + + TSDLMouse = class( TSDLCustomInput ) + private + FDragging : Boolean; + FMousePos : TPoint; + FOnMouseUp: TSDLMouseButtonEvent; + FOnMouseDown: TSDLMouseButtonEvent; + FOnMouseMove: TSDLMouseMoveEvent; + FOnMouseWheel: TSDLMouseWheelEvent; + FCursor : PSDL_Cursor; // Cursor Pointer + procedure DoMouseMove( Event: TSDL_Event ); + procedure DoMouseDown( Event: TSDL_Event ); + procedure DoMouseUp( Event: TSDL_Event ); + procedure DoMouseWheelScroll( Event: TSDL_Event ); + function GetMousePosition: TPoint; + procedure SetMousePosition(const Value: TPoint); + public + destructor Destroy; override; + function UpdateInput( event: TSDL_EVENT ) : Boolean; override; + function MouseIsDown( Button : Integer ) : Boolean; + function MouseIsUp( Button : Integer ) : Boolean; + procedure SetCursor(data, mask: PUInt8; w, h, hot_x, hot_y: Integer); + procedure ShowCursor; + procedure HideCursor; + property OnMouseDown : TSDLMouseButtonEvent read FOnMouseDown write FOnMouseDown; + property OnMouseUp : TSDLMouseButtonEvent read FOnMouseUp write FOnMouseUp; + property OnMouseMove : TSDLMouseMoveEvent read FOnMouseMove write FOnMouseMove; + property OnMouseWheel : TSDLMouseWheelEvent read FOnMouseWheel write FOnMouseWheel; + property MousePosition : TPoint read GetMousePosition write SetMousePosition; + end; + + TSDLInputManager = class( TObject ) + private + FKeyBoard : TSDLKeyBoard; + FMouse : TSDLMouse; + FJoystick : TSDLJoysticks; + public + constructor Create( InitInputs : TSDLInputTypes ); + destructor Destroy; override; + procedure Disable( InitInputs : TSDLInputTypes; JoyStickNumber : Integer = 0 ); + procedure Enable( InitInputs : TSDLInputTypes; JoyStickNumber : Integer = 0 ); + function UpdateInputs( event: TSDL_EVENT ) : Boolean; + property KeyBoard : TSDLKeyBoard read FKeyBoard write FKeyBoard; + property Mouse : TSDLMouse read FMouse write FMouse; + property JoyStick : TSDLJoysticks read FJoyStick write FJoyStick; + end; + +implementation + +{ TSDLCustomInput } +constructor TSDLCustomInput.Create; +begin + inherited; + FEnabled := true; +end; + +{ TSDLJoysticks } +constructor TSDLJoysticks.Create; +var + i : integer; +begin + inherited; + if ( SDL_WasInit( SDL_INIT_JOYSTICK ) = 0 ) then + SDL_InitSubSystem( SDL_INIT_JOYSTICK ); + FNumOfJoySticks := SDL_NumJoysticks; + FJoyStickList := TList.Create; + for i := 0 to FNumOfJoySticks - 1 do + begin + FJoyStickList.Add( TSDLJoyStick.Create( i ) ); + end; +end; + +destructor TSDLJoysticks.Destroy; +var + i : integer; +begin + if FJoyStickList.Count > 0 then + begin + for i := 0 to FJoyStickList.Count - 1 do + begin + TSDLJoyStick( FJoyStickList.Items[i] ).Free; + end; + end; + SDL_QuitSubSystem( SDL_INIT_JOYSTICK ); + inherited; +end; + +function TSDLJoySticks.GetJoyStick(Index: integer): TSDLJoyStick; +begin + Result := TSDLJoyStick( FJoyStickList[ Index ] ); +end; + +procedure TSDLJoySticks.SetJoyStick(Index: integer; + const Value: TSDLJoyStick); +begin + FJoyStickList[ Index ] := @Value; +end; + +function TSDLJoysticks.UpdateInput(event: TSDL_EVENT): Boolean; +var + i : integer; +begin + result := false; + if FJoyStickList.Count > 0 then + begin + for i := 0 to FJoyStickList.Count - 1 do + begin + TSDLJoyStick( FJoyStickList.Items[i] ).UpdateInput( event ); + end; + end; +end; + +{ TSDLKeyBoard } +procedure TSDLKeyBoard.DoKeyDown(keysym: PSDL_keysym); +begin + if Assigned( FOnKeyDown ) then + FOnKeyDown( keysym.sym , keysym.modifier, keysym.unicode ); +end; + +procedure TSDLKeyBoard.DoKeyUp(keysym: PSDL_keysym); +begin + if Assigned( FOnKeyUp ) then + FOnKeyUp( keysym.sym , keysym.modifier, keysym.unicode ); +end; + +function TSDLKeyBoard.IsKeyDown( Key: TSDLKey ): Boolean; +begin + SDL_PumpEvents; + + // Populate Keys array + FKeys := PKeyStateArr( SDL_GetKeyState( nil ) ); + Result := ( FKeys[Key] = SDL_PRESSED ); +end; + +function TSDLKeyBoard.IsKeyUp( Key: TSDLKey ): Boolean; +begin + SDL_PumpEvents; + + // Populate Keys array + FKeys := PKeyStateArr( SDL_GetKeyState( nil ) ); + Result := ( FKeys[Key] = SDL_RELEASED ); +end; + +function TSDLKeyBoard.UpdateInput(event: TSDL_EVENT): Boolean; +begin + result := false; + if ( FEnabled ) then + begin + case event.type_ of + SDL_KEYDOWN : + begin + // handle key presses + DoKeyDown( @event.key.keysym ); + result := true; + end; + + SDL_KEYUP : + begin + // handle key releases + DoKeyUp( @event.key.keysym ); + result := true; + end; + end; + end; +end; + +{ TSDLMouse } +destructor TSDLMouse.Destroy; +begin + if FCursor <> nil then + SDL_FreeCursor( FCursor ); + inherited; +end; + +procedure TSDLMouse.DoMouseDown( Event: TSDL_Event ); +var + CurrentPos : TPoint; +begin + FDragging := true; + if Assigned( FOnMouseDown ) then + begin + CurrentPos.x := event.button.x; + CurrentPos.y := event.button.y; + FOnMouseDown( event.button.button, SDL_GetModState, CurrentPos ); + end; +end; + +procedure TSDLMouse.DoMouseMove( Event: TSDL_Event ); +var + CurrentPos, RelativePos : TPoint; +begin + if Assigned( FOnMouseMove ) then + begin + CurrentPos.x := event.motion.x; + CurrentPos.y := event.motion.y; + RelativePos.x := event.motion.xrel; + RelativePos.y := event.motion.yrel; + FOnMouseMove( SDL_GetModState, CurrentPos, RelativePos ); + end; +end; + +procedure TSDLMouse.DoMouseUp( event: TSDL_EVENT ); +var + Point : TPoint; +begin + FDragging := false; + if Assigned( FOnMouseUp ) then + begin + Point.x := event.button.x; + Point.y := event.button.y; + FOnMouseUp( event.button.button, SDL_GetModState, Point ); + end; +end; + +procedure TSDLMouse.DoMouseWheelScroll( event: TSDL_EVENT ); +var + Point : TPoint; +begin + if Assigned( FOnMouseWheel ) then + begin + Point.x := event.button.x; + Point.y := event.button.y; + if ( event.button.button = SDL_BUTTON_WHEELUP ) then + FOnMouseWheel( SDL_BUTTON_WHEELUP, SDL_GetModState, Point ) + else + FOnMouseWheel( SDL_BUTTON_WHEELDOWN, SDL_GetModState, Point ); + end; +end; + +function TSDLMouse.GetMousePosition: TPoint; +begin + SDL_PumpEvents; + + SDL_GetMouseState( FMousePos.X, FMousePos.Y ); + Result := FMousePos; +end; + +procedure TSDLMouse.HideCursor; +begin + SDL_ShowCursor( SDL_DISABLE ); +end; + +function TSDLMouse.MouseIsDown(Button: Integer): Boolean; +begin + SDL_PumpEvents; + + Result := ( SDL_GetMouseState( FMousePos.X, FMousePos.Y ) and SDL_BUTTON( Button ) = 0 ); +end; + +function TSDLMouse.MouseIsUp(Button: Integer): Boolean; +begin + SDL_PumpEvents; + + Result := not ( SDL_GetMouseState( FMousePos.X, FMousePos.Y ) and SDL_BUTTON( Button ) = 0 ); +end; + +procedure TSDLMouse.SetCursor(data, mask: PUInt8; w, h, hot_x, hot_y: Integer); +begin + if FCursor <> nil then + SDL_FreeCursor( FCursor ); + // create the cursor + FCursor := SDL_CreateCursor( data, mask, w, h, hot_x, hot_y ); + + // set the cursor + SDL_SetCursor( FCursor ); +end; + +procedure TSDLMouse.SetMousePosition(const Value: TPoint); +begin + SDL_WarpMouse( Value.x, Value.y ); +end; + +procedure TSDLMouse.ShowCursor; +begin + SDL_ShowCursor( SDL_ENABLE ); +end; + +function TSDLMouse.UpdateInput(event: TSDL_EVENT): Boolean; +begin + result := false; + if ( FEnabled ) then + begin + case event.type_ of + SDL_MOUSEMOTION : + begin + // handle Mouse Move + DoMouseMove( event ); + end; + + SDL_MOUSEBUTTONDOWN : + begin + // handle Mouse Down + if ( event.button.button = SDL_BUTTON_WHEELUP ) + or ( event.button.button = SDL_BUTTON_WHEELDOWN ) then + DoMouseWheelScroll( event ) + else + DoMouseDown( event ); + end; + + SDL_MOUSEBUTTONUP : + begin + // handle Mouse Up + if ( event.button.button = SDL_BUTTON_WHEELUP ) + or ( event.button.button = SDL_BUTTON_WHEELDOWN ) then + DoMouseWheelScroll( event ) + else + DoMouseUp( event ); + end; + end; + end; +end; + +{ TSDLInputManager } +constructor TSDLInputManager.Create(InitInputs: TSDLInputTypes); +begin + inherited Create; + if itJoystick in InitInputs then + FJoystick := TSDLJoysticks.Create; + + if itKeyBoard in InitInputs then + FKeyBoard := TSDLKeyBoard.Create; + + if itMouse in InitInputs then + FMouse := TSDLMouse.Create; +end; + +destructor TSDLInputManager.Destroy; +begin + if FJoystick <> nil then + FreeAndNil( FJoystick ); + if FKeyBoard <> nil then + FreeAndNil( FKeyBoard ); + if FMouse <> nil then + FreeAndNil( FMouse ); + inherited; +end; + +procedure TSDLInputManager.Disable( InitInputs : TSDLInputTypes; JoyStickNumber : Integer ); +begin + if itJoystick in InitInputs then + FJoystick.JoySticks[ JoyStickNumber ].Enabled := false; + + if itKeyBoard in InitInputs then + FKeyBoard.Enabled := false; + + if itMouse in InitInputs then + FMouse.Enabled := false; +end; + +procedure TSDLInputManager.Enable( InitInputs: TSDLInputTypes; JoyStickNumber: Integer ); +begin + if itJoystick in InitInputs then + FJoystick.JoySticks[ JoyStickNumber ].Enabled := true; + + if itKeyBoard in InitInputs then + FKeyBoard.Enabled := true; + + if itMouse in InitInputs then + FMouse.Enabled := true; +end; + +function TSDLInputManager.UpdateInputs( event: TSDL_EVENT ): Boolean; +begin + Result := false; + if ( FJoystick <> nil ) then + Result := FJoystick.UpdateInput( event ); + if ( FKeyBoard <> nil ) then + Result := FKeyBoard.UpdateInput( event ); + if ( FMouse <> nil ) then + Result := FMouse.UpdateInput( event ); +end; + +{ TSDLJoyStick } +procedure TSDLJoyStick.Close; +begin + SDL_JoystickClose( @FJoystick ); +end; + +constructor TSDLJoyStick.Create( Index : Integer ); +begin + inherited Create; + FJoystick := nil; + FJoystickIndex := Index; +end; + +destructor TSDLJoyStick.Destroy; +begin + if FJoystick <> nil then + Close; + inherited; +end; + +procedure TSDLJoyStick.DoAxisMove(Event: TSDL_Event); +begin + if Assigned( FJoyAxisMoveEvent ) then + begin + FJoyAxisMoveEvent( Event.jaxis.which, Event.jaxis.axis, Event.jaxis.value ); + end +end; + +procedure TSDLJoyStick.DoBallMove(Event: TSDL_Event); +var + BallPoint : TPoint; +begin + if Assigned( FJoyBallMoveEvent ) then + begin + BallPoint.x := Event.jball.xrel; + BallPoint.y := Event.jball.yrel; + FJoyBallMoveEvent( Event.jball.which, Event.jball.ball, BallPoint ); + end; +end; + +procedure TSDLJoyStick.DoButtonDown(Event: TSDL_Event); +begin + if Assigned( FJoyButtonDownEvent ) then + begin + if ( Event.jbutton.state = SDL_PRESSED ) then + FJoyButtonDownEvent( Event.jbutton.which, Event.jbutton.button, Event.jbutton.state ); + end; +end; + +procedure TSDLJoyStick.DoButtonUp(Event: TSDL_Event); +begin + if Assigned( FJoyButtonUpEvent ) then + begin + if ( Event.jbutton.state = SDL_RELEASED ) then + FJoyButtonUpEvent( Event.jbutton.which, Event.jbutton.button, Event.jbutton.state ); + end +end; + +procedure TSDLJoyStick.DoHatMove(Event: TSDL_Event); +begin + if Assigned( FJoyHatMoveEvent ) then + begin + FJoyHatMoveEvent( Event.jhat.which, Event.jhat.hat, Event.jhat.value ); + end; +end; + +function TSDLJoyStick.GetName: PChar; +begin + result := FJoystick.name; +end; + +function TSDLJoyStick.GetNumAxes: integer; +begin + result := FJoystick.naxes; +end; + +function TSDLJoyStick.GetNumBalls: integer; +begin + result := FJoystick.nballs; +end; + +function TSDLJoyStick.GetNumButtons: integer; +begin + result := FJoystick.nbuttons; +end; + +function TSDLJoyStick.GetNumHats: integer; +begin + result := FJoystick.nhats; +end; + +procedure TSDLJoyStick.Open; +begin + FJoystick := SDL_JoyStickOpen( FJoystickIndex ); +end; + +function TSDLJoyStick.UpdateInput(Event: TSDL_EVENT): Boolean; +begin + Result := false; + + if ( FEnabled ) then + begin + case event.type_ of + SDL_JOYAXISMOTION : + begin + DoAxisMove( Event ); + end; + + SDL_JOYBALLMOTION : + begin + DoBallMove( Event ); + end; + + SDL_JOYHATMOTION : + begin + DoHatMove( Event ); + end; + + SDL_JOYBUTTONDOWN : + begin + DoButtonDown( Event ); + end; + + SDL_JOYBUTTONUP : + begin + DoButtonUp( Event ); + end; + end; + end; +end; + +end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlstreams.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlstreams.pas new file mode 100644 index 00000000..64009176 --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlstreams.pas @@ -0,0 +1,216 @@ +unit sdlstreams; +{ + $Id: sdlstreams.pas,v 1.1 2004/02/05 00:08:20 savage Exp $ + +} +{******************************************************************} +{ } +{ SDL - Simple DirectMedia Layer } +{ Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga } +{ } +{ Portions created by Chris Bruner are } +{ Copyright (C) 2002 Chris Bruner. } +{ } +{ Contributor(s) } +{ -------------- } +{ } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/NPL/NPL-1_1Final.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ Shows how to use OpenGL to do 2D and 3D with the SDL libraries } +{ } +{ } +{ Requires } +{ -------- } +{ SDL runtime libary somewhere in your path } +{ The Latest SDL runtime can be found on http://www.libsdl.org } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ January 11 2002 - CB : Software embraced and extended by } +{ Chris Bruner of Crystal Software } +{ (Canada) Inc. } +{ } +{ February 11 2002 - DL : Added FreePascal support as suggested } +{ by "QuePasha Pepe" } +{ } +{******************************************************************} +{ + $Log: sdlstreams.pas,v $ + Revision 1.1 2004/02/05 00:08:20 savage + Module 1.0 release + + +} + +{$i jedi-sdl.inc} + +interface + +uses + Classes, + SysUtils, + sdl, + sdlutils; + +{$IFDEF FPC} +type + EinvalidContainer=class(Exception); + {$ENDIF} + +function LoadSDLBMPFromStream( Stream : TStream ) : PSDL_Surface; +procedure SaveSDLBMPToStream( SDL_Surface : PSDL_Surface; stream : TStream ); +function SDL_Swap16( D : UInt16 ) : Uint16; +function SDL_Swap32( D : UInt32 ) : Uint32; +function SDLStreamSetup( stream : TStream ) : PSDL_RWops; +// this only closes the SDL_RWops part of the stream, not the stream itself +procedure SDLStreamCloseRWops( SDL_RWops : PSDL_RWops ); + +implementation + +function SDL_Swap16( D : UInt16 ) : Uint16; +begin + Result := ( D shl 8 ) or ( D shr 8 ); +end; + +function SDL_Swap32( D : UInt32 ) : Uint32; +begin + Result := ( ( D shl 24 ) or ( ( D shl 8 ) and $00FF0000 ) or ( ( D shr 8 ) and $0000FF00 ) or ( D shr 24 ) ); +end; + +(*function SDL_Swap64(D : UInt64) : Uint64; +var hi,lo : Uint32; +begin + // Separate into high and low 32-bit resultues and swap them + lo := Uint32(D and $0FFFFFFFF); // bloody pascal is too tight in it's type checking! + D := D shr 32; + hi = Uint32((D and $FFFFFFFF)); + result = SDL_Swap32(lo); + result := result shl 32; + result := result or SDL_Swap32(hi); +end; +*) + +function SdlStreamSeek( context : PSDL_RWops; offset : Integer; whence : Integer ) : integer; cdecl; +var + stream : TStream; + origin : Word; +begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamSeek on nil' ); + case whence of + 0 : origin := soFromBeginning; // Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0. + 1 : origin := soFromCurrent; // Offset is from the current position in the resource. Seek moves to Position + Offset. + 2 : origin := soFromEnd; + else + origin := soFromBeginning; // just in case + end; + Result := stream.Seek( offset, origin ); +end; + +function SDLStreamWrite( context : PSDL_RWops; Ptr : Pointer; + size : Integer; num : Integer ) : Integer; cdecl; +var + stream : TStream; +begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamWrite on nil' ); + try + Result := stream.Write( Ptr^, Size * num ) div size; + except + Result := -1; + end; +end; + +function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : Integer; maxnum + : Integer ) : Integer; cdecl; +var + stream : TStream; +begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamRead on nil' ); + try + Result := stream.read( Ptr^, Size * maxnum ) div size; + except + Result := -1; + end; +end; + +function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl; +var + stream : TStream; +begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamClose on nil' ); + stream.Free; + Result := 1; +end; + +function SDLStreamSetup( stream : TStream ) : PSDL_RWops; +begin + result := SDL_AllocRW; + if ( result = nil ) then + raise EInvalidContainer.Create( 'could not create SDLStream on nil' ); + result.unknown := TUnknown( stream ); + result.seek := SDLStreamSeek; + result.read := SDLStreamRead; + result.write := SDLStreamWrite; + result.close := SDLStreamClose; + Result.type_ := 2; // TUnknown +end; + +// this only closes the SDL part of the stream, not the context + +procedure SDLStreamCloseRWops( SDL_RWops : PSDL_RWops ); +begin + SDL_FreeRW( SDL_RWops ); +end; + +function LoadSDLBMPFromStream( stream : TStream ) : PSDL_Surface; +var + SDL_RWops : PSDL_RWops; +begin + SDL_RWops := SDLStreamSetup( stream ); + result := SDL_LoadBMP_RW( SDL_RWops, 0 ); + SDLStreamCloseRWops( SDL_RWops ); +end; + +procedure SaveSDLBMPToStream( SDL_Surface : PSDL_Surface; stream : TStream ); +var + SDL_RWops : PSDL_RWops; +begin + SDL_RWops := SDLStreamSetup( stream ); + SDL_SaveBMP_RW( SDL_Surface, SDL_RWops, 0 ); + SDLStreamCloseRWops( SDL_RWops ); +end; + +end. + diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlticks.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlticks.pas new file mode 100644 index 00000000..4e91ecb8 --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlticks.pas @@ -0,0 +1,196 @@ +unit sdlticks; +{ + $Id: sdlticks.pas,v 1.1 2004/09/30 22:35:47 savage Exp $ + +} +{******************************************************************************} +{ } +{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } +{ SDL GetTicks Class Wrapper } +{ } +{ } +{ The initial developer of this Pascal code was : } +{ Dominique Louis } +{ } +{ Portions created by Dominique Louis are } +{ Copyright (C) 2004 - 2100 Dominique Louis. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ Dominique Louis } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ SDL Window Wrapper } +{ } +{ } +{ Requires } +{ -------- } +{ SDL.dll on Windows platforms } +{ libSDL-1.1.so.0 on Linux platform } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ } +{ September 23 2004 - DL : Initial Creation } +{ + $Log: sdlticks.pas,v $ + Revision 1.1 2004/09/30 22:35:47 savage + Changes, enhancements and additions as required to get SoAoS working. + + +} +{******************************************************************************} + +interface + +uses + sdl; + + +type + TSDLTicks = class + private + m_startTime : Int64; + m_ticksPerSecond : Int64; + s_lastTime : Int64; + + public + constructor Create; + destructor Destroy; override; // destructor + + {***************************************************************************** + Init + + If the hi-res timer is present, the tick rate is stored and the function + returns true. Otherwise, the function returns false, and the timer should + not be used. + *****************************************************************************} + function Init : boolean; + + function GetElapsedSeconds( elapsedFrames : Cardinal = 1 ) : single; + + {*************************************************************************** + GetFPS + + Returns the average frames per second over elapsedFrames, which defaults to + one. If this is not called every frame, the client should track the number + of frames itself, and reset the value after this is called. + ***************************************************************************} + function GetFPS( elapsedFrames : Cardinal = 1 ) : single; + + {*************************************************************************** + LockFPS + + Used to lock the frame rate to a set amount. This will block until enough + time has passed to ensure that the fps won't go over the requested amount. + Note that this can only keep the fps from going above the specified level; + it can still drop below it. It is assumed that if used, this function will + be called every frame. The value returned is the instantaneous fps, which + will be <= targetFPS. + ***************************************************************************} + function LockFPS( targetFPS : Byte ) : single; + end; + +implementation + +{ TSDLTicks } +constructor TSDLTicks.Create; +begin + +end; + +destructor TSDLTicks.Destroy; +begin + + inherited; +end; + +function TSDLTicks.GetElapsedSeconds( elapsedFrames: Cardinal ): single; +var + currentTime : Int64; +begin + // s_lastTime := m_startTime; + + currentTime := SDL_GetTicks; + //QueryPerformanceCounter( currentTime ); + + result := (currentTime - s_lastTime) / m_ticksPerSecond; + + // reset the timer + s_lastTime := currentTime; +end; + +function TSDLTicks.GetFPS( elapsedFrames: Cardinal ): single; +var + currentTime : integer; + fps : single; +begin + // s_lastTime := m_startTime; + + currentTime := SDL_GetTicks; + + fps := elapsedFrames * m_ticksPerSecond / ( currentTime - s_lastTime); + + // reset the timer + s_lastTime := currentTime; + + result := fps; +end; + +function TSDLTicks.Init: boolean; +begin + m_startTime := SDL_GetTicks; + s_lastTime := m_startTime; + m_ticksPerSecond := 1000; + result := true; +end; + +function TSDLTicks.LockFPS(targetFPS: Byte): single; +var + currentTime : integer; + fps : single; +begin + if (targetFPS = 0) then + targetFPS := 1; + + s_lastTime := m_startTime; + + // delay to maintain a constant frame rate + repeat + currentTime := SDL_GetTicks; + fps := m_ticksPerSecond / (currentTime - s_lastTime); + until (fps > targetFPS); + + // reset the timer + s_lastTime := m_startTime; + + result := fps; +end; + +end. + \ No newline at end of file diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlutils.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlutils.pas new file mode 100644 index 00000000..bef83cbc --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlutils.pas @@ -0,0 +1,4256 @@ +unit sdlutils; +{ + $Id: sdlutils.pas,v 1.4 2004/06/02 19:38:53 savage Exp $ + +} +{******************************************************************************} +{ } +{ Borland Delphi SDL - Simple DirectMedia Layer } +{ SDL Utility functions } +{ } +{ } +{ The initial developer of this Pascal code was : } +{ Tom Jones } +{ } +{ Portions created by Tom Jones are } +{ Copyright (C) 2000 - 2001 Tom Jones. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ Dominique Louis } +{ Róbert Kisnémeth } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ Helper functions... } +{ } +{ } +{ Requires } +{ -------- } +{ SDL.dll on Windows platforms } +{ libSDL-1.1.so.0 on Linux platform } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ 2000 - TJ : Initial creation } +{ } +{ July 13 2001 - DL : Added PutPixel and GetPixel routines. } +{ } +{ Sept 14 2001 - RK : Added flipping routines. } +{ } +{ Sept 19 2001 - RK : Added PutPixel & line drawing & blitting with ADD } +{ effect. Fixed a bug in SDL_PutPixel & SDL_GetPixel } +{ Added PSDLRect() } +{ Sept 22 2001 - DL : Removed need for Windows.pas by defining types here} +{ Also removed by poor attempt or a dialog box } +{ } +{ Sept 25 2001 - RK : Added PixelTest, NewPutPixel, SubPixel, SubLine, } +{ SubSurface, MonoSurface & TexturedSurface } +{ } +{ Sept 26 2001 - DL : Made change so that it refers to native Pascal } +{ types rather that Windows types. This makes it more} +{ portable to Linix. } +{ } +{ Sept 27 2001 - RK : SDLUtils now can be compiled with FreePascal } +{ } +{ Oct 27 2001 - JF : Added ScrollY function } +{ } +{ Jan 21 2002 - RK : Added SDL_ZoomSurface and SDL_WarpSurface } +{ } +{ Mar 28 2002 - JF : Added SDL_RotateSurface } +{ } +{ May 13 2002 - RK : Improved SDL_FillRectAdd & SDL_FillRectSub } +{ } +{ May 27 2002 - YS : GradientFillRect function } +{ } +{ May 30 2002 - RK : Added SDL_2xBlit, SDL_Scanline2xBlit } +{ & SDL_50Scanline2xBlit } +{ } +{ June 12 2002 - RK : Added SDL_PixelTestSurfaceVsRect } +{ } +{ June 12 2002 - JF : Updated SDL_PixelTestSurfaceVsRect } +{ } +{ November 9 2002 - JF : Added Jason's boolean Surface functions } +{ } +{ December 10 2002 - DE : Added Dean's SDL_ClipLine function } +{ } +{ April 26 2003 - SS : Incorporated JF's changes to SDL_ClipLine } +{ Fixed SDL_ClipLine bug for non-zero cliprect x, y } +{ Added overloaded SDL_DrawLine for dashed lines } +{ } +{******************************************************************************} +{ + $Log: sdlutils.pas,v $ + Revision 1.4 2004/06/02 19:38:53 savage + Changes to SDL_GradientFillRect as suggested by + Ángel Eduardo García Hernández. Many thanks. + + Revision 1.3 2004/05/29 23:11:54 savage + Changes to SDL_ScaleSurfaceRect as suggested by + Ángel Eduardo García Hernández to fix a colour issue with the function. Many thanks. + + Revision 1.2 2004/02/14 00:23:39 savage + As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. + + Revision 1.1 2004/02/05 00:08:20 savage + Module 1.0 release + + +} + +interface + +{$i jedi-sdl.inc} + +uses +{$IFDEF UNIX} + Types, + Xlib, +{$ENDIF} + SysUtils, + sdl; + +type + TGradientStyle = ( gsHorizontal, gsVertical ); + +// Pixel procedures +function SDL_PixelTest( SrcSurface1 : PSDL_Surface; SrcRect1 : PSDL_Rect; SrcSurface2 : + PSDL_Surface; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : Boolean; + +function SDL_GetPixel( SrcSurface : PSDL_Surface; x : integer; y : integer ) : Uint32; + +procedure SDL_PutPixel( DstSurface : PSDL_Surface; x : integer; y : integer; pixel : + Uint32 ); + +procedure SDL_AddPixel( DstSurface : PSDL_Surface; x : cardinal; y : cardinal; Color : + cardinal ); + +procedure SDL_SubPixel( DstSurface : PSDL_Surface; x : cardinal; y : cardinal; Color : + cardinal ); + +// Line procedures +procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ); overload; + +procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ; DashLength, DashSpace : byte ); overload; + +procedure SDL_AddLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ); + +procedure SDL_SubLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ); + +// Surface procedures +procedure SDL_AddSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); + +procedure SDL_SubSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); + +procedure SDL_MonoSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect; Color : cardinal ); + +procedure SDL_TexturedSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect; Texture : PSDL_Surface; + TextureRect : PSDL_Rect ); + +procedure SDL_ZoomSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; DstRect : PSDL_Rect ); + +procedure SDL_WarpSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; UL, UR, LR, LL : PPoint ); + +// Flip procedures +procedure SDL_FlipRectH( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); + +procedure SDL_FlipRectV( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); + +function PSDLRect( aLeft, aTop, aWidth, aHeight : integer ) : PSDL_Rect; + +function SDLRect( aLeft, aTop, aWidth, aHeight : integer ) : TSDL_Rect; overload; + +function SDLRect( aRect : TRect ) : TSDL_Rect; overload; + +function SDL_ScaleSurfaceRect( SrcSurface : PSDL_Surface; SrcX1, SrcY1, SrcW, SrcH, + Width, Height : integer ) : PSDL_Surface; + +procedure SDL_ScrollY( DstSurface : PSDL_Surface; DifY : integer ); + +procedure SDL_ScrollX( DstSurface : PSDL_Surface; DifX : integer ); + +procedure SDL_RotateDeg( DstSurface, SrcSurface : PSDL_Surface; SrcRect : + PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Integer ); + +procedure SDL_RotateRad( DstSurface, SrcSurface : PSDL_Surface; SrcRect : + PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Single ); + +function ValidateSurfaceRect( DstSurface : PSDL_Surface; dstrect : PSDL_Rect ) : TSDL_Rect; + +// Fill Rect routine +procedure SDL_FillRectAdd( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); + +procedure SDL_FillRectSub( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); + +procedure SDL_GradientFillRect( DstSurface : PSDL_Surface; const Rect : PSDL_Rect; const StartColor, EndColor : TSDL_Color; const Style : TGradientStyle ); + +// NOTE for All SDL_2xblit... function : the dest surface must be 2x of the source surface! +procedure SDL_2xBlit(Src, Dest: PSDL_Surface); + +procedure SDL_Scanline2xBlit(Src, Dest: PSDL_Surface); + +procedure SDL_50Scanline2xBlit(Src, Dest: PSDL_Surface); + +// +function SDL_PixelTestSurfaceVsRect( SrcSurface1 : PSDL_Surface; SrcRect1 : +PSDL_Rect; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : +boolean; + +// Jason's boolean Surface functions +procedure SDL_ORSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); + +procedure SDL_ANDSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); + + +procedure SDL_GTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); + +procedure SDL_LTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); + +function SDL_ClipLine(var x1,y1,x2,y2: Integer; ClipRect: PSDL_Rect) : boolean; + +implementation + +uses + Math; + +function SDL_PixelTest( SrcSurface1 : PSDL_Surface; SrcRect1 : PSDL_Rect; SrcSurface2 : + PSDL_Surface; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : boolean; +var + Src_Rect1, Src_Rect2 : TSDL_Rect; + right1, bottom1 : integer; + right2, bottom2 : integer; + Scan1Start, Scan2Start, ScanWidth, ScanHeight : cardinal; + Mod1, Mod2 : cardinal; + Addr1, Addr2 : cardinal; + BPP : cardinal; + Pitch1, Pitch2 : cardinal; + TransparentColor1, TransparentColor2 : cardinal; + tx, ty : cardinal; + StartTick : cardinal; + Color1, Color2 : cardinal; +begin + Result := false; + if SrcRect1 = nil then + begin + with Src_Rect1 do + begin + x := 0; + y := 0; + w := SrcSurface1.w; + h := SrcSurface1.h; + end; + end + else + Src_Rect1 := SrcRect1^; + if SrcRect2 = nil then + begin + with Src_Rect2 do + begin + x := 0; + y := 0; + w := SrcSurface2.w; + h := SrcSurface2.h; + end; + end + else + Src_Rect2 := SrcRect2^; + with Src_Rect1 do + begin + Right1 := Left1 + w; + Bottom1 := Top1 + h; + end; + with Src_Rect2 do + begin + Right2 := Left2 + w; + Bottom2 := Top2 + h; + end; + if ( Left1 >= Right2 ) or ( Right1 <= Left2 ) or ( Top1 >= Bottom2 ) or ( Bottom1 <= + Top2 ) then + exit; + if Left1 <= Left2 then + begin + // 1. left, 2. right + Scan1Start := Src_Rect1.x + Left2 - Left1; + Scan2Start := Src_Rect2.x; + ScanWidth := Right1 - Left2; + with Src_Rect2 do + if ScanWidth > w then + ScanWidth := w; + end + else + begin + // 1. right, 2. left + Scan1Start := Src_Rect1.x; + Scan2Start := Src_Rect2.x + Left1 - Left2; + ScanWidth := Right2 - Left1; + with Src_Rect1 do + if ScanWidth > w then + ScanWidth := w; + end; + with SrcSurface1^ do + begin + Pitch1 := Pitch; + Addr1 := cardinal( Pixels ); + inc( Addr1, Pitch1 * UInt32( Src_Rect1.y ) ); + with format^ do + begin + BPP := BytesPerPixel; + TransparentColor1 := colorkey; + end; + end; + with SrcSurface2^ do + begin + TransparentColor2 := format.colorkey; + Pitch2 := Pitch; + Addr2 := cardinal( Pixels ); + inc( Addr2, Pitch2 * UInt32( Src_Rect2.y ) ); + end; + Mod1 := Pitch1 - ( ScanWidth * BPP ); + Mod2 := Pitch2 - ( ScanWidth * BPP ); + inc( Addr1, BPP * Scan1Start ); + inc( Addr2, BPP * Scan2Start ); + if Top1 <= Top2 then + begin + // 1. up, 2. down + ScanHeight := Bottom1 - Top2; + if ScanHeight > Src_Rect2.h then + ScanHeight := Src_Rect2.h; + inc( Addr1, Pitch1 * UInt32( Top2 - Top1 ) ); + end + else + begin + // 1. down, 2. up + ScanHeight := Bottom2 - Top1; + if ScanHeight > Src_Rect1.h then + ScanHeight := Src_Rect1.h; + inc( Addr2, Pitch2 * UInt32( Top1 - Top2 ) ); + end; + case BPP of + 1 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PByte( Addr1 )^ <> TransparentColor1 ) and ( PByte( Addr2 )^ <> + TransparentColor2 ) then + begin + Result := true; + exit; + end; + inc( Addr1 ); + inc( Addr2 ); + end; + inc( Addr1, Mod1 ); + inc( Addr2, Mod2 ); + end; + 2 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PWord( Addr1 )^ <> TransparentColor1 ) and ( PWord( Addr2 )^ <> + TransparentColor2 ) then + begin + Result := true; + exit; + end; + inc( Addr1, 2 ); + inc( Addr2, 2 ); + end; + inc( Addr1, Mod1 ); + inc( Addr2, Mod2 ); + end; + 3 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + Color1 := PLongWord( Addr1 )^ and $00FFFFFF; + Color2 := PLongWord( Addr2 )^ and $00FFFFFF; + if ( Color1 <> TransparentColor1 ) and ( Color2 <> TransparentColor2 ) + then + begin + Result := true; + exit; + end; + inc( Addr1, 3 ); + inc( Addr2, 3 ); + end; + inc( Addr1, Mod1 ); + inc( Addr2, Mod2 ); + end; + 4 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PLongWord( Addr1 )^ <> TransparentColor1 ) and ( PLongWord( Addr2 )^ <> + TransparentColor2 ) then + begin + Result := true; + exit; + end; + inc( Addr1, 4 ); + inc( Addr2, 4 ); + end; + inc( Addr1, Mod1 ); + inc( Addr2, Mod2 ); + end; + end; +end; + +procedure SDL_AddPixel( DstSurface : PSDL_Surface; x : cardinal; y : cardinal; Color : + cardinal ); +var + SrcColor : cardinal; + Addr : cardinal; + R, G, B : cardinal; +begin + if Color = 0 then + exit; + with DstSurface^ do + begin + Addr := cardinal( Pixels ) + y * Pitch + x * format.BytesPerPixel; + SrcColor := PUInt32( Addr )^; + case format.BitsPerPixel of + 8 : + begin + R := SrcColor and $E0 + Color and $E0; + G := SrcColor and $1C + Color and $1C; + B := SrcColor and $03 + Color and $03; + if R > $E0 then + R := $E0; + if G > $1C then + G := $1C; + if B > $03 then + B := $03; + PUInt8( Addr )^ := R or G or B; + end; + 15 : + begin + R := SrcColor and $7C00 + Color and $7C00; + G := SrcColor and $03E0 + Color and $03E0; + B := SrcColor and $001F + Color and $001F; + if R > $7C00 then + R := $7C00; + if G > $03E0 then + G := $03E0; + if B > $001F then + B := $001F; + PUInt16( Addr )^ := R or G or B; + end; + 16 : + begin + R := SrcColor and $F800 + Color and $F800; + G := SrcColor and $07C0 + Color and $07C0; + B := SrcColor and $001F + Color and $001F; + if R > $F800 then + R := $F800; + if G > $07C0 then + G := $07C0; + if B > $001F then + B := $001F; + PUInt16( Addr )^ := R or G or B; + end; + 24 : + begin + R := SrcColor and $00FF0000 + Color and $00FF0000; + G := SrcColor and $0000FF00 + Color and $0000FF00; + B := SrcColor and $000000FF + Color and $000000FF; + if R > $FF0000 then + R := $FF0000; + if G > $00FF00 then + G := $00FF00; + if B > $0000FF then + B := $0000FF; + PUInt32( Addr )^ := SrcColor and $FF000000 or R or G or B; + end; + 32 : + begin + R := SrcColor and $00FF0000 + Color and $00FF0000; + G := SrcColor and $0000FF00 + Color and $0000FF00; + B := SrcColor and $000000FF + Color and $000000FF; + if R > $FF0000 then + R := $FF0000; + if G > $00FF00 then + G := $00FF00; + if B > $0000FF then + B := $0000FF; + PUInt32( Addr )^ := R or G or B; + end; + end; + end; +end; + +procedure SDL_SubPixel( DstSurface : PSDL_Surface; x : cardinal; y : cardinal; Color : + cardinal ); +var + SrcColor : cardinal; + Addr : cardinal; + R, G, B : cardinal; +begin + if Color = 0 then + exit; + with DstSurface^ do + begin + Addr := cardinal( Pixels ) + y * Pitch + x * format.BytesPerPixel; + SrcColor := PUInt32( Addr )^; + case format.BitsPerPixel of + 8 : + begin + R := SrcColor and $E0 - Color and $E0; + G := SrcColor and $1C - Color and $1C; + B := SrcColor and $03 - Color and $03; + if R > $E0 then + R := 0; + if G > $1C then + G := 0; + if B > $03 then + B := 0; + PUInt8( Addr )^ := R or G or B; + end; + 15 : + begin + R := SrcColor and $7C00 - Color and $7C00; + G := SrcColor and $03E0 - Color and $03E0; + B := SrcColor and $001F - Color and $001F; + if R > $7C00 then + R := 0; + if G > $03E0 then + G := 0; + if B > $001F then + B := 0; + PUInt16( Addr )^ := R or G or B; + end; + 16 : + begin + R := SrcColor and $F800 - Color and $F800; + G := SrcColor and $07C0 - Color and $07C0; + B := SrcColor and $001F - Color and $001F; + if R > $F800 then + R := 0; + if G > $07C0 then + G := 0; + if B > $001F then + B := 0; + PUInt16( Addr )^ := R or G or B; + end; + 24 : + begin + R := SrcColor and $00FF0000 - Color and $00FF0000; + G := SrcColor and $0000FF00 - Color and $0000FF00; + B := SrcColor and $000000FF - Color and $000000FF; + if R > $FF0000 then + R := 0; + if G > $00FF00 then + G := 0; + if B > $0000FF then + B := 0; + PUInt32( Addr )^ := SrcColor and $FF000000 or R or G or B; + end; + 32 : + begin + R := SrcColor and $00FF0000 - Color and $00FF0000; + G := SrcColor and $0000FF00 - Color and $0000FF00; + B := SrcColor and $000000FF - Color and $000000FF; + if R > $FF0000 then + R := 0; + if G > $00FF00 then + G := 0; + if B > $0000FF then + B := 0; + PUInt32( Addr )^ := R or G or B; + end; + end; + end; +end; +// This procedure works on 8, 15, 16, 24 and 32 bits color depth surfaces. +// In 8 bit color depth mode the procedure works with the default packed +// palette (RRRGGGBB). It handles all clipping. + +procedure SDL_AddSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := Format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + WorkY := Src.h; + case bits of + 8 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt8( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt8( DestAddr )^; + if Pixel2 > 0 then + begin + R := Pixel1 and $E0 + Pixel2 and $E0; + G := Pixel1 and $1C + Pixel2 and $1C; + B := Pixel1 and $03 + Pixel2 and $03; + if R > $E0 then + R := $E0; + if G > $1C then + G := $1C; + if B > $03 then + B := $03; + PUInt8( DestAddr )^ := R or G or B; + end + else + PUInt8( DestAddr )^ := Pixel1; + end; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 15 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + R := Pixel1 and $7C00 + Pixel2 and $7C00; + G := Pixel1 and $03E0 + Pixel2 and $03E0; + B := Pixel1 and $001F + Pixel2 and $001F; + if R > $7C00 then + R := $7C00; + if G > $03E0 then + G := $03E0; + if B > $001F then + B := $001F; + PUInt16( DestAddr )^ := R or G or B; + end + else + PUInt16( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 16 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + R := Pixel1 and $F800 + Pixel2 and $F800; + G := Pixel1 and $07E0 + Pixel2 and $07E0; + B := Pixel1 and $001F + Pixel2 and $001F; + if R > $F800 then + R := $F800; + if G > $07E0 then + G := $07E0; + if B > $001F then + B := $001F; + PUInt16( DestAddr )^ := R or G or B; + end + else + PUInt16( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 24 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; + if Pixel2 > 0 then + begin + R := Pixel1 and $FF0000 + Pixel2 and $FF0000; + G := Pixel1 and $00FF00 + Pixel2 and $00FF00; + B := Pixel1 and $0000FF + Pixel2 and $0000FF; + if R > $FF0000 then + R := $FF0000; + if G > $00FF00 then + G := $00FF00; + if B > $0000FF then + B := $0000FF; + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or ( R or G or B ); + end + else + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or Pixel1; + end; + inc( SrcAddr, 3 ); + inc( DestAddr, 3 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 32 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^; + if Pixel2 > 0 then + begin + R := Pixel1 and $FF0000 + Pixel2 and $FF0000; + G := Pixel1 and $00FF00 + Pixel2 and $00FF00; + B := Pixel1 and $0000FF + Pixel2 and $0000FF; + if R > $FF0000 then + R := $FF0000; + if G > $00FF00 then + G := $00FF00; + if B > $0000FF then + B := $0000FF; + PUInt32( DestAddr )^ := R or G or B; + end + else + PUInt32( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 4 ); + inc( DestAddr, 4 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); +end; + +procedure SDL_SubSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + _ebx, _esi, _edi, _esp : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := Format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := DestSurface.Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + WorkY := Src.h; + case bits of + 8 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt8( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt8( DestAddr )^; + if Pixel2 > 0 then + begin + R := Pixel2 and $E0 - Pixel1 and $E0; + G := Pixel2 and $1C - Pixel1 and $1C; + B := Pixel2 and $03 - Pixel1 and $03; + if R > $E0 then + R := 0; + if G > $1C then + G := 0; + if B > $03 then + B := 0; + PUInt8( DestAddr )^ := R or G or B; + end; + end; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 15 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + R := Pixel2 and $7C00 - Pixel1 and $7C00; + G := Pixel2 and $03E0 - Pixel1 and $03E0; + B := Pixel2 and $001F - Pixel1 and $001F; + if R > $7C00 then + R := 0; + if G > $03E0 then + G := 0; + if B > $001F then + B := 0; + PUInt16( DestAddr )^ := R or G or B; + end; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 16 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + R := Pixel2 and $F800 - Pixel1 and $F800; + G := Pixel2 and $07E0 - Pixel1 and $07E0; + B := Pixel2 and $001F - Pixel1 and $001F; + if R > $F800 then + R := 0; + if G > $07E0 then + G := 0; + if B > $001F then + B := 0; + PUInt16( DestAddr )^ := R or G or B; + end; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 24 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; + if Pixel2 > 0 then + begin + R := Pixel2 and $FF0000 - Pixel1 and $FF0000; + G := Pixel2 and $00FF00 - Pixel1 and $00FF00; + B := Pixel2 and $0000FF - Pixel1 and $0000FF; + if R > $FF0000 then + R := 0; + if G > $00FF00 then + G := 0; + if B > $0000FF then + B := 0; + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or ( R or G or B ); + end; + end; + inc( SrcAddr, 3 ); + inc( DestAddr, 3 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 32 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^; + if Pixel2 > 0 then + begin + R := Pixel2 and $FF0000 - Pixel1 and $FF0000; + G := Pixel2 and $00FF00 - Pixel1 and $00FF00; + B := Pixel2 and $0000FF - Pixel1 and $0000FF; + if R > $FF0000 then + R := 0; + if G > $00FF00 then + G := 0; + if B > $0000FF then + B := 0; + PUInt32( DestAddr )^ := R or G or B; + end + else + PUInt32( DestAddr )^ := Pixel2; + end; + inc( SrcAddr, 4 ); + inc( DestAddr, 4 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); +end; + +procedure SDL_MonoSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect; Color : cardinal ); +var + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + _ebx, _esi, _edi, _esp : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + TransparentColor, SrcColor : cardinal; + BPP : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := Format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + BPP := DestSurface.Format.BytesPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + WorkY := Src.h; + case BPP of + 1 : + begin + repeat + WorkX := Src.w; + repeat + SrcColor := PUInt8( SrcAddr )^; + if SrcColor <> TransparentColor then + PUInt8( DestAddr )^ := SrcColor; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 2 : + begin + repeat + WorkX := Src.w; + repeat + SrcColor := PUInt16( SrcAddr )^; + if SrcColor <> TransparentColor then + PUInt16( DestAddr )^ := SrcColor; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 3 : + begin + repeat + WorkX := Src.w; + repeat + SrcColor := PUInt32( SrcAddr )^ and $FFFFFF; + if SrcColor <> TransparentColor then + PUInt32( DestAddr )^ := ( PUInt32( DestAddr )^ and $FFFFFF ) or SrcColor; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 4 : + begin + repeat + WorkX := Src.w; + repeat + SrcColor := PUInt32( SrcAddr )^; + if SrcColor <> TransparentColor then + PUInt32( DestAddr )^ := SrcColor; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); +end; +// TextureRect.w and TextureRect.h are not used. +// The TextureSurface's size MUST larger than the drawing rectangle!!! + +procedure SDL_TexturedSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect; Texture : PSDL_Surface; + TextureRect : PSDL_Rect ); +var + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr, TextAddr : cardinal; + _ebx, _esi, _edi, _esp : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod, TextMod : cardinal; + SrcColor, TransparentColor, TextureColor : cardinal; + BPP : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + BPP := DestSurface.Format.BitsPerPixel; + end; + with Texture^ do + begin + TextAddr := cardinal( Pixels ) + UInt32( TextureRect.y ) * Pitch + + UInt32( TextureRect.x ) * Format.BytesPerPixel; + TextMod := Pitch - Src.w * Format.BytesPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + SDL_LockSurface( Texture ); + WorkY := Src.h; + case BPP of + 1 : + begin + repeat + WorkX := Src.w; + repeat + SrcColor := PUInt8( SrcAddr )^; + if SrcColor <> TransparentColor then + PUInt8( DestAddr )^ := PUint8( TextAddr )^; + inc( SrcAddr ); + inc( DestAddr ); + inc( TextAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + inc( TextAddr, TextMod ); + dec( WorkY ); + until WorkY = 0; + end; + 2 : + begin + repeat + WorkX := Src.w; + repeat + SrcColor := PUInt16( SrcAddr )^; + if SrcColor <> TransparentColor then + PUInt16( DestAddr )^ := PUInt16( TextAddr )^; + inc( SrcAddr ); + inc( DestAddr ); + inc( TextAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + inc( TextAddr, TextMod ); + dec( WorkY ); + until WorkY = 0; + end; + 3 : + begin + repeat + WorkX := Src.w; + repeat + SrcColor := PUInt32( SrcAddr )^ and $FFFFFF; + if SrcColor <> TransparentColor then + PUInt32( DestAddr )^ := ( PUInt32( DestAddr )^ and $FFFFFF ) or ( PUInt32( TextAddr )^ and $FFFFFF ); + inc( SrcAddr ); + inc( DestAddr ); + inc( TextAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + inc( TextAddr, TextMod ); + dec( WorkY ); + until WorkY = 0; + end; + 4 : + begin + repeat + WorkX := Src.w; + repeat + SrcColor := PUInt32( SrcAddr )^; + if SrcColor <> TransparentColor then + PUInt32( DestAddr )^ := PUInt32( TextAddr )^; + inc( SrcAddr ); + inc( DestAddr ); + inc( TextAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + inc( TextAddr, TextMod ); + dec( WorkY ); + until WorkY = 0; + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); + SDL_UnlockSurface( Texture ); +end; + +procedure SDL_ZoomSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; DstRect : PSDL_Rect ); +var + xc, yc : cardinal; + rx, wx, ry, wy, ry16 : cardinal; + color : cardinal; + modx, mody : cardinal; +begin + // Warning! No checks for surface pointers!!! + if srcrect = nil then + srcrect := @SrcSurface.clip_rect; + if dstrect = nil then + dstrect := @DstSurface.clip_rect; + if SDL_MustLock( SrcSurface ) then + SDL_LockSurface( SrcSurface ); + if SDL_MustLock( DstSurface ) then + SDL_LockSurface( DstSurface ); + modx := trunc( ( srcrect.w / dstrect.w ) * 65536 ); + mody := trunc( ( srcrect.h / dstrect.h ) * 65536 ); + //rx := srcrect.x * 65536; + ry := srcrect.y * 65536; + wy := dstrect.y; + for yc := 0 to dstrect.h - 1 do + begin + rx := srcrect.x * 65536; + wx := dstrect.x; + ry16 := ry shr 16; + for xc := 0 to dstrect.w - 1 do + begin + color := SDL_GetPixel( SrcSurface, rx shr 16, ry16 ); + SDL_PutPixel( DstSurface, wx, wy, color ); + rx := rx + modx; + inc( wx ); + end; + ry := ry + mody; + inc( wy ); + end; + if SDL_MustLock( SrcSurface ) then + SDL_UnlockSurface( SrcSurface ); + if SDL_MustLock( DstSurface ) then + SDL_UnlockSurface( DstSurface ); +end; +// Re-map a rectangular area into an area defined by four vertices +// Converted from C to Pascal by KiCHY + +procedure SDL_WarpSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; UL, UR, LR, LL : PPoint ); +const + SHIFTS = 15; // Extend ints to limit round-off error (try 2 - 20) + THRESH = 1 shl SHIFTS; // Threshold for pixel size value + procedure CopySourceToDest( UL, UR, LR, LL : TPoint; x1, y1, x2, y2 : cardinal ); + var + tm, lm, rm, bm, m : TPoint; + mx, my : cardinal; + cr : cardinal; + begin + // Does the destination area specify a single pixel? + if ( ( abs( ul.x - ur.x ) < THRESH ) and + ( abs( ul.x - lr.x ) < THRESH ) and + ( abs( ul.x - ll.x ) < THRESH ) and + ( abs( ul.y - ur.y ) < THRESH ) and + ( abs( ul.y - lr.y ) < THRESH ) and + ( abs( ul.y - ll.y ) < THRESH ) ) then + begin // Yes + cr := SDL_GetPixel( SrcSurface, ( x1 shr SHIFTS ), ( y1 shr SHIFTS ) ); + SDL_PutPixel( DstSurface, ( ul.x shr SHIFTS ), ( ul.y shr SHIFTS ), cr ); + end + else + begin // No + // Quarter the source and the destination, and then recurse + tm.x := ( ul.x + ur.x ) shr 1; + tm.y := ( ul.y + ur.y ) shr 1; + bm.x := ( ll.x + lr.x ) shr 1; + bm.y := ( ll.y + lr.y ) shr 1; + lm.x := ( ul.x + ll.x ) shr 1; + lm.y := ( ul.y + ll.y ) shr 1; + rm.x := ( ur.x + lr.x ) shr 1; + rm.y := ( ur.y + lr.y ) shr 1; + m.x := ( tm.x + bm.x ) shr 1; + m.y := ( tm.y + bm.y ) shr 1; + mx := ( x1 + x2 ) shr 1; + my := ( y1 + y2 ) shr 1; + CopySourceToDest( ul, tm, m, lm, x1, y1, mx, my ); + CopySourceToDest( tm, ur, rm, m, mx, y1, x2, my ); + CopySourceToDest( m, rm, lr, bm, mx, my, x2, y2 ); + CopySourceToDest( lm, m, bm, ll, x1, my, mx, y2 ); + end; + end; +var + _UL, _UR, _LR, _LL : TPoint; + Rect_x, Rect_y, Rect_w, Rect_h : integer; +begin + if SDL_MustLock( SrcSurface ) then + SDL_LockSurface( SrcSurface ); + if SDL_MustLock( DstSurface ) then + SDL_LockSurface( DstSurface ); + if SrcRect = nil then + begin + Rect_x := 0; + Rect_y := 0; + Rect_w := ( SrcSurface.w - 1 ) shl SHIFTS; + Rect_h := ( SrcSurface.h - 1 ) shl SHIFTS; + end + else + begin + Rect_x := SrcRect.x; + Rect_y := SrcRect.y; + Rect_w := ( SrcRect.w - 1 ) shl SHIFTS; + Rect_h := ( SrcRect.h - 1 ) shl SHIFTS; + end; + // Shift all values to help reduce round-off error. + _ul.x := ul.x shl SHIFTS; + _ul.y := ul.y shl SHIFTS; + _ur.x := ur.x shl SHIFTS; + _ur.y := ur.y shl SHIFTS; + _lr.x := lr.x shl SHIFTS; + _lr.y := lr.y shl SHIFTS; + _ll.x := ll.x shl SHIFTS; + _ll.y := ll.y shl SHIFTS; + CopySourceToDest( _ul, _ur, _lr, _ll, Rect_x, Rect_y, Rect_w, Rect_h ); + if SDL_MustLock( SrcSurface ) then + SDL_UnlockSurface( SrcSurface ); + if SDL_MustLock( DstSurface ) then + SDL_UnlockSurface( DstSurface ); +end; + +// Draw a line between x1,y1 and x2,y2 to the given surface +// NOTE: The surface must be locked before calling this! +procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ); +var + dx, dy, sdx, sdy, x, y, px, py : integer; +begin + dx := x2 - x1; + dy := y2 - y1; + if dx < 0 then + sdx := -1 + else + sdx := 1; + if dy < 0 then + sdy := -1 + else + sdy := 1; + dx := sdx * dx + 1; + dy := sdy * dy + 1; + x := 0; + y := 0; + px := x1; + py := y1; + if dx >= dy then + begin + for x := 0 to dx - 1 do + begin + SDL_PutPixel( DstSurface, px, py, Color ); + y := y + dy; + if y >= dx then + begin + y := y - dx; + py := py + sdy; + end; + px := px + sdx; + end; + end + else + begin + for y := 0 to dy - 1 do + begin + SDL_PutPixel( DstSurface, px, py, Color ); + x := x + dx; + if x >= dy then + begin + x := x - dy; + px := px + sdx; + end; + py := py + sdy; + end; + end; +end; + +// Draw a dashed line between x1,y1 and x2,y2 to the given surface +// NOTE: The surface must be locked before calling this! +procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ; DashLength, DashSpace : byte ); overload; +var + dx, dy, sdx, sdy, x, y, px, py, counter : integer; drawdash : boolean; +begin + counter := 0; + drawdash := true; //begin line drawing with dash + + //Avoid invalid user-passed dash parameters + if (DashLength < 1) + then DashLength := 1; + if (DashSpace < 1) + then DashSpace := 0; + + dx := x2 - x1; + dy := y2 - y1; + if dx < 0 then + sdx := -1 + else + sdx := 1; + if dy < 0 then + sdy := -1 + else + sdy := 1; + dx := sdx * dx + 1; + dy := sdy * dy + 1; + x := 0; + y := 0; + px := x1; + py := y1; + if dx >= dy then + begin + for x := 0 to dx - 1 do + begin + + //Alternate drawing dashes, or leaving spaces + if drawdash then + begin + SDL_PutPixel( DstSurface, px, py, Color ); + inc(counter); + if (counter > DashLength-1) and (DashSpace > 0) then + begin + drawdash := false; + counter := 0; + end; + end + else //space + begin + inc(counter); + if counter > DashSpace-1 then + begin + drawdash := true; + counter := 0; + end; + end; + + y := y + dy; + if y >= dx then + begin + y := y - dx; + py := py + sdy; + end; + px := px + sdx; + end; + end + else + begin + for y := 0 to dy - 1 do + begin + + //Alternate drawing dashes, or leaving spaces + if drawdash then + begin + SDL_PutPixel( DstSurface, px, py, Color ); + inc(counter); + if (counter > DashLength-1) and (DashSpace > 0) then + begin + drawdash := false; + counter := 0; + end; + end + else //space + begin + inc(counter); + if counter > DashSpace-1 then + begin + drawdash := true; + counter := 0; + end; + end; + + x := x + dx; + if x >= dy then + begin + x := x - dy; + px := px + sdx; + end; + py := py + sdy; + end; + end; +end; + +procedure SDL_AddLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ); +var + dx, dy, sdx, sdy, x, y, px, py : integer; +begin + dx := x2 - x1; + dy := y2 - y1; + if dx < 0 then + sdx := -1 + else + sdx := 1; + if dy < 0 then + sdy := -1 + else + sdy := 1; + dx := sdx * dx + 1; + dy := sdy * dy + 1; + x := 0; + y := 0; + px := x1; + py := y1; + if dx >= dy then + begin + for x := 0 to dx - 1 do + begin + SDL_AddPixel( DstSurface, px, py, Color ); + y := y + dy; + if y >= dx then + begin + y := y - dx; + py := py + sdy; + end; + px := px + sdx; + end; + end + else + begin + for y := 0 to dy - 1 do + begin + SDL_AddPixel( DstSurface, px, py, Color ); + x := x + dx; + if x >= dy then + begin + x := x - dy; + px := px + sdx; + end; + py := py + sdy; + end; + end; +end; + +procedure SDL_SubLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ); +var + dx, dy, sdx, sdy, x, y, px, py : integer; +begin + dx := x2 - x1; + dy := y2 - y1; + if dx < 0 then + sdx := -1 + else + sdx := 1; + if dy < 0 then + sdy := -1 + else + sdy := 1; + dx := sdx * dx + 1; + dy := sdy * dy + 1; + x := 0; + y := 0; + px := x1; + py := y1; + if dx >= dy then + begin + for x := 0 to dx - 1 do + begin + SDL_SubPixel( DstSurface, px, py, Color ); + y := y + dy; + if y >= dx then + begin + y := y - dx; + py := py + sdy; + end; + px := px + sdx; + end; + end + else + begin + for y := 0 to dy - 1 do + begin + SDL_SubPixel( DstSurface, px, py, Color ); + x := x + dx; + if x >= dy then + begin + x := x - dy; + px := px + sdx; + end; + py := py + sdy; + end; + end; +end; + +// flips a rectangle vertically on given surface +procedure SDL_FlipRectV( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); +var + TmpRect : TSDL_Rect; + Locked : boolean; + y, FlipLength, RowLength : integer; + Row1, Row2 : Pointer; + OneRow : TByteArray; // Optimize it if you wish +begin + if DstSurface <> nil then + begin + if Rect = nil then + begin // if Rect=nil then we flip the whole surface + TmpRect := SDLRect( 0, 0, DstSurface.w, DstSurface.h ); + Rect := @TmpRect; + end; + FlipLength := Rect^.h shr 1 - 1; + RowLength := Rect^.w * DstSurface^.format.BytesPerPixel; + if SDL_MustLock( DstSurface ) then + begin + Locked := true; + SDL_LockSurface( DstSurface ); + end + else + Locked := false; + Row1 := pointer( cardinal( DstSurface^.Pixels ) + UInt32( Rect^.y ) * + DstSurface^.Pitch ); + Row2 := pointer( cardinal( DstSurface^.Pixels ) + ( UInt32( Rect^.y ) + Rect^.h - 1 ) + * DstSurface^.Pitch ); + for y := 0 to FlipLength do + begin + Move( Row1^, OneRow, RowLength ); + Move( Row2^, Row1^, RowLength ); + Move( OneRow, Row2^, RowLength ); + inc( cardinal( Row1 ), DstSurface^.Pitch ); + dec( cardinal( Row2 ), DstSurface^.Pitch ); + end; + if Locked then + SDL_UnlockSurface( DstSurface ); + end; +end; + +// flips a rectangle horizontally on given surface +procedure SDL_FlipRectH( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); +type + T24bit = packed array[ 0..2 ] of byte; + T24bitArray = packed array[ 0..8191 ] of T24bit; + P24bitArray = ^T24bitArray; + TLongWordArray = array[ 0..8191 ] of LongWord; + PLongWordArray = ^TLongWordArray; +var + TmpRect : TSDL_Rect; + Row8bit : PByteArray; + Row16bit : PWordArray; + Row24bit : P24bitArray; + Row32bit : PLongWordArray; + y, x, RightSide, FlipLength : integer; + Pixel : cardinal; + Pixel24 : T24bit; + Locked : boolean; +begin + if DstSurface <> nil then + begin + if Rect = nil then + begin + TmpRect := SDLRect( 0, 0, DstSurface.w, DstSurface.h ); + Rect := @TmpRect; + end; + FlipLength := Rect^.w shr 1 - 1; + if SDL_MustLock( DstSurface ) then + begin + Locked := true; + SDL_LockSurface( DstSurface ); + end + else + Locked := false; + case DstSurface^.format.BytesPerPixel of + 1 : + begin + Row8Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * + DstSurface^.pitch ); + for y := 1 to Rect^.h do + begin + RightSide := Rect^.w - 1; + for x := 0 to FlipLength do + begin + Pixel := Row8Bit^[ x ]; + Row8Bit^[ x ] := Row8Bit^[ RightSide ]; + Row8Bit^[ RightSide ] := Pixel; + dec( RightSide ); + end; + inc( cardinal( Row8Bit ), DstSurface^.pitch ); + end; + end; + 2 : + begin + Row16Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * + DstSurface^.pitch ); + for y := 1 to Rect^.h do + begin + RightSide := Rect^.w - 1; + for x := 0 to FlipLength do + begin + Pixel := Row16Bit^[ x ]; + Row16Bit^[ x ] := Row16Bit^[ RightSide ]; + Row16Bit^[ RightSide ] := Pixel; + dec( RightSide ); + end; + inc( cardinal( Row16Bit ), DstSurface^.pitch ); + end; + end; + 3 : + begin + Row24Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * + DstSurface^.pitch ); + for y := 1 to Rect^.h do + begin + RightSide := Rect^.w - 1; + for x := 0 to FlipLength do + begin + Pixel24 := Row24Bit^[ x ]; + Row24Bit^[ x ] := Row24Bit^[ RightSide ]; + Row24Bit^[ RightSide ] := Pixel24; + dec( RightSide ); + end; + inc( cardinal( Row24Bit ), DstSurface^.pitch ); + end; + end; + 4 : + begin + Row32Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * + DstSurface^.pitch ); + for y := 1 to Rect^.h do + begin + RightSide := Rect^.w - 1; + for x := 0 to FlipLength do + begin + Pixel := Row32Bit^[ x ]; + Row32Bit^[ x ] := Row32Bit^[ RightSide ]; + Row32Bit^[ RightSide ] := Pixel; + dec( RightSide ); + end; + inc( cardinal( Row32Bit ), DstSurface^.pitch ); + end; + end; + end; + if Locked then + SDL_UnlockSurface( DstSurface ); + end; +end; + +// Use with caution! The procedure allocates memory for TSDL_Rect and return with its pointer. +// But you MUST free it after you don't need it anymore!!! +function PSDLRect( aLeft, aTop, aWidth, aHeight : integer ) : PSDL_Rect; +var + Rect : PSDL_Rect; +begin + New( Rect ); + with Rect^ do + begin + x := aLeft; + y := aTop; + w := aWidth; + h := aHeight; + end; + Result := Rect; +end; + +function SDLRect( aLeft, aTop, aWidth, aHeight : integer ) : TSDL_Rect; +begin + with result do + begin + x := aLeft; + y := aTop; + w := aWidth; + h := aHeight; + end; +end; + +function SDLRect( aRect : TRect ) : TSDL_Rect; +begin + with aRect do + result := SDLRect( Left, Top, Right - Left, Bottom - Top ); +end; + +procedure SDL_Stretch8( Surface, Dst_Surface : PSDL_Surface; x1, x2, y1, y2, yr, yw, + depth : integer ); +var + dx, dy, e, d, dx2 : integer; + src_pitch, dst_pitch : uint16; + src_pixels, dst_pixels : PUint8; +begin + if ( yw >= dst_surface^.h ) then + exit; + dx := ( x2 - x1 ); + dy := ( y2 - y1 ); + dy := dy shl 1; + e := dy - dx; + dx2 := dx shl 1; + src_pitch := Surface^.pitch; + dst_pitch := dst_surface^.pitch; + src_pixels := PUint8( integer( Surface^.pixels ) + yr * src_pitch + y1 * depth ); + dst_pixels := PUint8( integer( dst_surface^.pixels ) + yw * dst_pitch + x1 * + depth ); + for d := 0 to dx - 1 do + begin + move( src_pixels^, dst_pixels^, depth ); + while ( e >= 0 ) do + begin + inc( src_pixels, depth ); + e := e - dx2; + end; + inc( dst_pixels, depth ); + e := e + dy; + end; +end; + +function sign( x : integer ) : integer; +begin + if x > 0 then + result := 1 + else + result := -1; +end; + +// Stretches a part of a surface +function SDL_ScaleSurfaceRect( SrcSurface : PSDL_Surface; SrcX1, SrcY1, SrcW, SrcH, + Width, Height : integer ) : PSDL_Surface; +var + dst_surface : PSDL_Surface; + dx, dy, e, d, dx2, srcx2, srcy2 : integer; + destx1, desty1 : integer; +begin + srcx2 := srcx1 + SrcW; + srcy2 := srcy1 + SrcH; + result := nil; + destx1 := 0; + desty1 := 0; + dx := abs( integer( Height - desty1 ) ); + dy := abs( integer( SrcY2 - SrcY1 ) ); + e := ( dy shl 1 ) - dx; + dx2 := dx shl 1; + dy := dy shl 1; + dst_surface := SDL_CreateRGBSurface( SDL_HWPALETTE, width - destx1, Height - + desty1, + SrcSurface^.Format^.BitsPerPixel, + SrcSurface^.Format^.RMask, + SrcSurface^.Format^.GMask, + SrcSurface^.Format^.BMask, + SrcSurface^.Format^.AMask ); + if ( dst_surface^.format^.BytesPerPixel = 1 ) then + SDL_SetColors( dst_surface, @SrcSurface^.format^.palette^.colors^[ 0 ], 0, 256 ); + SDL_SetColorKey( dst_surface, sdl_srccolorkey, SrcSurface^.format^.colorkey ); + if ( SDL_MustLock( dst_surface ) ) then + if ( SDL_LockSurface( dst_surface ) < 0 ) then + exit; + for d := 0 to dx - 1 do + begin + SDL_Stretch8( SrcSurface, dst_surface, destx1, Width, SrcX1, SrcX2, SrcY1, desty1, + SrcSurface^.format^.BytesPerPixel ); + while e >= 0 do + begin + inc( SrcY1 ); + e := e - dx2; + end; + inc( desty1 ); + e := e + dy; + end; + if SDL_MUSTLOCK( dst_surface ) then + SDL_UnlockSurface( dst_surface ); + result := dst_surface; +end; + +procedure SDL_MoveLine( Surface : PSDL_Surface; x1, x2, y1, xofs, depth : integer ); +var + src_pixels, dst_pixels : PUint8; + i : integer; +begin + src_pixels := PUint8( integer( Surface^.pixels ) + Surface^.w * y1 * depth + x2 * + depth ); + dst_pixels := PUint8( integer( Surface^.pixels ) + Surface^.w * y1 * depth + ( x2 + + xofs ) * depth ); + for i := x2 downto x1 do + begin + move( src_pixels^, dst_pixels^, depth ); + dec( src_pixels ); + dec( dst_pixels ); + end; +end; +{ Return the pixel value at (x, y) +NOTE: The surface must be locked before calling this! } + +function SDL_GetPixel( SrcSurface : PSDL_Surface; x : integer; y : integer ) : Uint32; +var + bpp : UInt32; + p : PInteger; +begin + bpp := SrcSurface.format.BytesPerPixel; + // Here p is the address to the pixel we want to retrieve + p := Pointer( Uint32( SrcSurface.pixels ) + UInt32( y ) * SrcSurface.pitch + UInt32( x ) * + bpp ); + case bpp of + 1 : result := PUint8( p )^; + 2 : result := PUint16( p )^; + 3 : + if ( SDL_BYTEORDER = SDL_BIG_ENDIAN ) then + result := PUInt8Array( p )[ 0 ] shl 16 or PUInt8Array( p )[ 1 ] shl 8 or + PUInt8Array( p )[ 2 ] + else + result := PUInt8Array( p )[ 0 ] or PUInt8Array( p )[ 1 ] shl 8 or + PUInt8Array( p )[ 2 ] shl 16; + 4 : result := PUint32( p )^; + else + result := 0; // shouldn't happen, but avoids warnings + end; +end; +{ Set the pixel at (x, y) to the given value + NOTE: The surface must be locked before calling this! } + +procedure SDL_PutPixel( DstSurface : PSDL_Surface; x : integer; y : integer; pixel : + Uint32 ); +var + bpp : UInt32; + p : PInteger; +begin + bpp := DstSurface.format.BytesPerPixel; + p := Pointer( Uint32( DstSurface.pixels ) + UInt32( y ) * DstSurface.pitch + UInt32( x ) + * bpp ); + case bpp of + 1 : PUint8( p )^ := pixel; + 2 : PUint16( p )^ := pixel; + 3 : + if ( SDL_BYTEORDER = SDL_BIG_ENDIAN ) then + begin + PUInt8Array( p )[ 0 ] := ( pixel shr 16 ) and $FF; + PUInt8Array( p )[ 1 ] := ( pixel shr 8 ) and $FF; + PUInt8Array( p )[ 2 ] := pixel and $FF; + end + else + begin + PUInt8Array( p )[ 0 ] := pixel and $FF; + PUInt8Array( p )[ 1 ] := ( pixel shr 8 ) and $FF; + PUInt8Array( p )[ 2 ] := ( pixel shr 16 ) and $FF; + end; + 4 : + PUint32( p )^ := pixel; + end; +end; + +procedure SDL_ScrollY( DstSurface : PSDL_Surface; DifY : integer ); +var + r1, r2 : TSDL_Rect; + //buffer: PSDL_Surface; + YPos : Integer; +begin + if ( DstSurface <> nil ) and ( DifY <> 0 ) then + begin + //if DifY > 0 then // going up + //begin + ypos := 0; + r1.x := 0; + r2.x := 0; + r1.w := DstSurface.w; + r2.w := DstSurface.w; + r1.h := DifY; + r2.h := DifY; + while ypos < DstSurface.h do + begin + r1.y := ypos; + r2.y := ypos + DifY; + SDL_BlitSurface( DstSurface, @r2, DstSurface, @r1 ); + ypos := ypos + DifY; + end; + //end + //else + //begin // Going Down + //end; + end; +end; + +{procedure SDL_ScrollY(Surface: PSDL_Surface; DifY: integer); +var + r1, r2: TSDL_Rect; + buffer: PSDL_Surface; +begin + if (Surface <> nil) and (Dify <> 0) then + begin + buffer := SDL_CreateRGBSurface(SDL_HWSURFACE, (Surface^.w - DifY) * 2, + Surface^.h * 2, + Surface^.Format^.BitsPerPixel, 0, 0, 0, 0); + if buffer <> nil then + begin + if (buffer^.format^.BytesPerPixel = 1) then + SDL_SetColors(buffer, @Surface^.format^.palette^.colors^[0], 0, 256); + r1 := SDLRect(0, DifY, buffer^.w, buffer^.h); + r2 := SDLRect(0, 0, buffer^.w, buffer^.h); + SDL_BlitSurface(Surface, @r1, buffer, @r2); + SDL_BlitSurface(buffer, @r2, Surface, @r2); + SDL_FreeSurface(buffer); + end; + end; +end;} + +procedure SDL_ScrollX( DstSurface : PSDL_Surface; DifX : integer ); +var + r1, r2 : TSDL_Rect; + buffer : PSDL_Surface; +begin + if ( DstSurface <> nil ) and ( DifX <> 0 ) then + begin + buffer := SDL_CreateRGBSurface( SDL_HWSURFACE, ( DstSurface^.w - DifX ) * 2, + DstSurface^.h * 2, + DstSurface^.Format^.BitsPerPixel, + DstSurface^.Format^.RMask, + DstSurface^.Format^.GMask, + DstSurface^.Format^.BMask, + DstSurface^.Format^.AMask ); + if buffer <> nil then + begin + if ( buffer^.format^.BytesPerPixel = 1 ) then + SDL_SetColors( buffer, @DstSurface^.format^.palette^.colors^[ 0 ], 0, 256 ); + r1 := SDLRect( DifX, 0, buffer^.w, buffer^.h ); + r2 := SDLRect( 0, 0, buffer^.w, buffer^.h ); + SDL_BlitSurface( DstSurface, @r1, buffer, @r2 ); + SDL_BlitSurface( buffer, @r2, DstSurface, @r2 ); + SDL_FreeSurface( buffer ); + end; + end; +end; + +procedure SDL_RotateRad( DstSurface, SrcSurface : PSDL_Surface; SrcRect : + PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Single ); +var + aSin, aCos : Single; + MX, MY, DX, DY, NX, NY, SX, SY, OX, OY, Width, Height, TX, TY, RX, RY, ROX, ROY : Integer; + Colour, TempTransparentColour : UInt32; + MAXX, MAXY : Integer; +begin + // Rotate the surface to the target surface. + TempTransparentColour := SrcSurface.format.colorkey; + if srcRect.w > srcRect.h then + begin + Width := srcRect.w; + Height := srcRect.w; + end + else + begin + Width := srcRect.h; + Height := srcRect.h; + end; + + maxx := DstSurface.w; + maxy := DstSurface.h; + aCos := cos( Angle ); + aSin := sin( Angle ); + + Width := round( abs( srcrect.h * acos ) + abs( srcrect.w * asin ) ); + Height := round( abs( srcrect.h * asin ) + abs( srcrect.w * acos ) ); + + OX := Width div 2; + OY := Height div 2; ; + MX := ( srcRect.x + ( srcRect.x + srcRect.w ) ) div 2; + MY := ( srcRect.y + ( srcRect.y + srcRect.h ) ) div 2; + ROX := ( -( srcRect.w div 2 ) ) + Offsetx; + ROY := ( -( srcRect.h div 2 ) ) + OffsetY; + Tx := ox + round( ROX * aSin - ROY * aCos ); + Ty := oy + round( ROY * aSin + ROX * aCos ); + SX := 0; + for DX := DestX - TX to DestX - TX + ( width ) do + begin + Inc( SX ); + SY := 0; + for DY := DestY - TY to DestY - TY + ( Height ) do + begin + RX := SX - OX; + RY := SY - OY; + NX := round( mx + RX * aSin + RY * aCos ); // + NY := round( my + RY * aSin - RX * aCos ); // + // Used for testing only + //SDL_PutPixel(DestSurface.SDLSurfacePointer,DX,DY,0); + if ( ( DX > 0 ) and ( DX < MAXX ) ) and ( ( DY > 0 ) and ( DY < MAXY ) ) then + begin + if ( NX >= srcRect.x ) and ( NX <= srcRect.x + srcRect.w ) then + begin + if ( NY >= srcRect.y ) and ( NY <= srcRect.y + srcRect.h ) then + begin + Colour := SDL_GetPixel( SrcSurface, NX, NY ); + if Colour <> TempTransparentColour then + begin + SDL_PutPixel( DstSurface, DX, DY, Colour ); + end; + end; + end; + end; + inc( SY ); + end; + end; +end; + +procedure SDL_RotateDeg( DstSurface, SrcSurface : PSDL_Surface; SrcRect : + PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Integer ); +begin + SDL_RotateRad( DstSurface, SrcSurface, SrcRect, DestX, DestY, OffsetX, OffsetY, DegToRad( Angle ) ); +end; + +function ValidateSurfaceRect( DstSurface : PSDL_Surface; dstrect : PSDL_Rect ) : TSDL_Rect; +var + RealRect : TSDL_Rect; + OutOfRange : Boolean; +begin + OutOfRange := false; + if dstrect = nil then + begin + RealRect.x := 0; + RealRect.y := 0; + RealRect.w := DstSurface.w; + RealRect.h := DstSurface.h; + end + else + begin + if dstrect.x < DstSurface.w then + begin + RealRect.x := dstrect.x; + end + else if dstrect.x < 0 then + begin + realrect.x := 0; + end + else + begin + OutOfRange := True; + end; + if dstrect.y < DstSurface.h then + begin + RealRect.y := dstrect.y; + end + else if dstrect.y < 0 then + begin + realrect.y := 0; + end + else + begin + OutOfRange := True; + end; + if OutOfRange = False then + begin + if realrect.x + dstrect.w <= DstSurface.w then + begin + RealRect.w := dstrect.w; + end + else + begin + RealRect.w := dstrect.w - realrect.x; + end; + if realrect.y + dstrect.h <= DstSurface.h then + begin + RealRect.h := dstrect.h; + end + else + begin + RealRect.h := dstrect.h - realrect.y; + end; + end; + end; + if OutOfRange = False then + begin + result := realrect; + end + else + begin + realrect.w := 0; + realrect.h := 0; + realrect.x := 0; + realrect.y := 0; + result := realrect; + end; +end; + +procedure SDL_FillRectAdd( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); +var + RealRect : TSDL_Rect; + Addr : pointer; + ModX, BPP : cardinal; + x, y, R, G, B, SrcColor : cardinal; +begin + RealRect := ValidateSurfaceRect( DstSurface, DstRect ); + if ( RealRect.w > 0 ) and ( RealRect.h > 0 ) then + begin + SDL_LockSurface( DstSurface ); + BPP := DstSurface.format.BytesPerPixel; + with DstSurface^ do + begin + Addr := pointer( UInt32( pixels ) + UInt32( RealRect.y ) * pitch + UInt32( RealRect.x ) * BPP ); + ModX := Pitch - UInt32( RealRect.w ) * BPP; + end; + case DstSurface.format.BitsPerPixel of + 8 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $E0 + Color and $E0; + G := SrcColor and $1C + Color and $1C; + B := SrcColor and $03 + Color and $03; + if R > $E0 then + R := $E0; + if G > $1C then + G := $1C; + if B > $03 then + B := $03; + PUInt8( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 15 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $7C00 + Color and $7C00; + G := SrcColor and $03E0 + Color and $03E0; + B := SrcColor and $001F + Color and $001F; + if R > $7C00 then + R := $7C00; + if G > $03E0 then + G := $03E0; + if B > $001F then + B := $001F; + PUInt16( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 16 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $F800 + Color and $F800; + G := SrcColor and $07C0 + Color and $07C0; + B := SrcColor and $001F + Color and $001F; + if R > $F800 then + R := $F800; + if G > $07C0 then + G := $07C0; + if B > $001F then + B := $001F; + PUInt16( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 24 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $00FF0000 + Color and $00FF0000; + G := SrcColor and $0000FF00 + Color and $0000FF00; + B := SrcColor and $000000FF + Color and $000000FF; + if R > $FF0000 then + R := $FF0000; + if G > $00FF00 then + G := $00FF00; + if B > $0000FF then + B := $0000FF; + PUInt32( Addr )^ := SrcColor and $FF000000 or R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 32 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $00FF0000 + Color and $00FF0000; + G := SrcColor and $0000FF00 + Color and $0000FF00; + B := SrcColor and $000000FF + Color and $000000FF; + if R > $FF0000 then + R := $FF0000; + if G > $00FF00 then + G := $00FF00; + if B > $0000FF then + B := $0000FF; + PUInt32( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + end; + SDL_UnlockSurface( DstSurface ); + end; +end; + +procedure SDL_FillRectSub( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); +var + RealRect : TSDL_Rect; + Addr : pointer; + ModX, BPP : cardinal; + x, y, R, G, B, SrcColor : cardinal; +begin + RealRect := ValidateSurfaceRect( DstSurface, DstRect ); + if ( RealRect.w > 0 ) and ( RealRect.h > 0 ) then + begin + SDL_LockSurface( DstSurface ); + BPP := DstSurface.format.BytesPerPixel; + with DstSurface^ do + begin + Addr := pointer( UInt32( pixels ) + UInt32( RealRect.y ) * pitch + UInt32( RealRect.x ) * BPP ); + ModX := Pitch - UInt32( RealRect.w ) * BPP; + end; + case DstSurface.format.BitsPerPixel of + 8 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $E0 - Color and $E0; + G := SrcColor and $1C - Color and $1C; + B := SrcColor and $03 - Color and $03; + if R > $E0 then + R := 0; + if G > $1C then + G := 0; + if B > $03 then + B := 0; + PUInt8( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 15 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $7C00 - Color and $7C00; + G := SrcColor and $03E0 - Color and $03E0; + B := SrcColor and $001F - Color and $001F; + if R > $7C00 then + R := 0; + if G > $03E0 then + G := 0; + if B > $001F then + B := 0; + PUInt16( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 16 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $F800 - Color and $F800; + G := SrcColor and $07C0 - Color and $07C0; + B := SrcColor and $001F - Color and $001F; + if R > $F800 then + R := 0; + if G > $07C0 then + G := 0; + if B > $001F then + B := 0; + PUInt16( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 24 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $00FF0000 - Color and $00FF0000; + G := SrcColor and $0000FF00 - Color and $0000FF00; + B := SrcColor and $000000FF - Color and $000000FF; + if R > $FF0000 then + R := 0; + if G > $00FF00 then + G := 0; + if B > $0000FF then + B := 0; + PUInt32( Addr )^ := SrcColor and $FF000000 or R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 32 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $00FF0000 - Color and $00FF0000; + G := SrcColor and $0000FF00 - Color and $0000FF00; + B := SrcColor and $000000FF - Color and $000000FF; + if R > $FF0000 then + R := 0; + if G > $00FF00 then + G := 0; + if B > $0000FF then + B := 0; + PUInt32( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + end; + SDL_UnlockSurface( DstSurface ); + end; +end; + +procedure SDL_GradientFillRect( DstSurface : PSDL_Surface; const Rect : PSDL_Rect; const StartColor, EndColor : TSDL_Color; const Style : TGradientStyle ); +var + FBC : array[ 0..255 ] of Cardinal; + // temp vars + i, YR, YG, YB, SR, SG, SB, DR, DG, DB : Integer; + + TempStepV, TempStepH : Single; + TempLeft, TempTop, TempHeight, TempWidth : integer; + TempRect : TSDL_Rect; + +begin + // calc FBC + YR := StartColor.r; + YG := StartColor.g; + YB := StartColor.b; + SR := YR; + SG := YG; + SB := YB; + DR := EndColor.r - SR; + DG := EndColor.g - SG; + DB := EndColor.b - SB; + + for i := 0 to 255 do + begin + FBC[ i ] := SDL_MapRGB( DstSurface.format, YR, YG, YB ); + YR := SR + round( DR / 255 * i ); + YG := SG + round( DG / 255 * i ); + YB := SB + round( DB / 255 * i ); + end; + + // if aStyle = 1 then begin + TempStepH := Rect.w / 255; + TempStepV := Rect.h / 255; + TempHeight := Trunc( TempStepV + 1 ); + TempWidth := Trunc( TempStepH + 1 ); + TempTop := 0; + TempLeft := 0; + TempRect.x := Rect.x; + TempRect.y := Rect.y; + TempRect.h := Rect.h; + TempRect.w := Rect.w; + + case Style of + gsHorizontal : + begin + TempRect.h := TempHeight; + for i := 0 to 255 do + begin + TempRect.y := Rect.y + TempTop; + SDL_FillRect( DstSurface, @TempRect, FBC[ i ] ); + TempTop := Trunc( TempStepV * i ); + end; + end; + gsVertical : + begin + TempRect.w := TempWidth; + for i := 0 to 255 do + begin + TempRect.x := Rect.x + TempLeft; + SDL_FillRect( DstSurface, @TempRect, FBC[ i ] ); + TempLeft := Trunc( TempStepH * i ); + end; + end; + end; +end; + +procedure SDL_2xBlit(Src, Dest: PSDL_Surface); +var + ReadAddr, WriteAddr, ReadRow, WriteRow: UInt32; + SrcPitch, DestPitch, x, y: UInt32; +begin + if (Src = nil) or (Dest = nil) then + exit; + if (Src.w shl 1) < Dest.w then + exit; + if (Src.h shl 1) < Dest.h then + exit; + + if SDL_MustLock(Src) then + SDL_LockSurface(Src); + if SDL_MustLock(Dest) then + SDL_LockSurface(Dest); + + ReadRow := UInt32(Src.Pixels); + WriteRow := UInt32(Dest.Pixels); + + SrcPitch := Src.pitch; + DestPitch := Dest.pitch; + + case Src.format.BytesPerPixel of + 1: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt8(WriteAddr)^ := PUInt8(ReadAddr)^; + PUInt8(WriteAddr + 1)^ := PUInt8(ReadAddr)^; + PUInt8(WriteAddr + DestPitch)^ := PUInt8(ReadAddr)^; + PUInt8(WriteAddr + DestPitch + 1)^ := PUInt8(ReadAddr)^; + inc(ReadAddr); + inc(WriteAddr, 2); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + 2: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt16(WriteAddr)^ := PUInt16(ReadAddr)^; + PUInt16(WriteAddr + 2)^ := PUInt16(ReadAddr)^; + PUInt16(WriteAddr + DestPitch)^ := PUInt16(ReadAddr)^; + PUInt16(WriteAddr + DestPitch + 2)^ := PUInt16(ReadAddr)^; + inc(ReadAddr, 2); + inc(WriteAddr, 4); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + 3: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt32(WriteAddr)^ := (PUInt32(WriteAddr)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + PUInt32(WriteAddr + 3)^ := (PUInt32(WriteAddr + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + PUInt32(WriteAddr + DestPitch)^ := (PUInt32(WriteAddr + DestPitch)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + PUInt32(WriteAddr + DestPitch + 3)^ := (PUInt32(WriteAddr + DestPitch + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + inc(ReadAddr, 3); + inc(WriteAddr, 6); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + 4: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt32(WriteAddr)^ := PUInt32(ReadAddr)^; + PUInt32(WriteAddr + 4)^ := PUInt32(ReadAddr)^; + PUInt32(WriteAddr + DestPitch)^ := PUInt32(ReadAddr)^; + PUInt32(WriteAddr + DestPitch + 4)^ := PUInt32(ReadAddr)^; + inc(ReadAddr, 4); + inc(WriteAddr, 8); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + end; + + if SDL_MustLock(Src) then + SDL_UnlockSurface(Src); + if SDL_MustLock(Dest) then + SDL_UnlockSurface(Dest); +end; + +procedure SDL_Scanline2xBlit(Src, Dest: PSDL_Surface); +var + ReadAddr, WriteAddr, ReadRow, WriteRow: UInt32; + SrcPitch, DestPitch, x, y: UInt32; +begin + if (Src = nil) or (Dest = nil) then + exit; + if (Src.w shl 1) < Dest.w then + exit; + if (Src.h shl 1) < Dest.h then + exit; + + if SDL_MustLock(Src) then + SDL_LockSurface(Src); + if SDL_MustLock(Dest) then + SDL_LockSurface(Dest); + + ReadRow := UInt32(Src.Pixels); + WriteRow := UInt32(Dest.Pixels); + + SrcPitch := Src.pitch; + DestPitch := Dest.pitch; + + case Src.format.BytesPerPixel of + 1: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt8(WriteAddr)^ := PUInt8(ReadAddr)^; + PUInt8(WriteAddr + 1)^ := PUInt8(ReadAddr)^; + inc(ReadAddr); + inc(WriteAddr, 2); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + 2: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt16(WriteAddr)^ := PUInt16(ReadAddr)^; + PUInt16(WriteAddr + 2)^ := PUInt16(ReadAddr)^; + inc(ReadAddr, 2); + inc(WriteAddr, 4); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + 3: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt32(WriteAddr)^ := (PUInt32(WriteAddr)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + PUInt32(WriteAddr + 3)^ := (PUInt32(WriteAddr + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + inc(ReadAddr, 3); + inc(WriteAddr, 6); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + 4: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt32(WriteAddr)^ := PUInt32(ReadAddr)^; + PUInt32(WriteAddr + 4)^ := PUInt32(ReadAddr)^; + inc(ReadAddr, 4); + inc(WriteAddr, 8); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + end; + + if SDL_MustLock(Src) then + SDL_UnlockSurface(Src); + if SDL_MustLock(Dest) then + SDL_UnlockSurface(Dest); +end; + +procedure SDL_50Scanline2xBlit(Src, Dest: PSDL_Surface); +var + ReadAddr, WriteAddr, ReadRow, WriteRow: UInt32; + SrcPitch, DestPitch, x, y, Color: UInt32; +begin + if (Src = nil) or (Dest = nil) then + exit; + if (Src.w shl 1) < Dest.w then + exit; + if (Src.h shl 1) < Dest.h then + exit; + + if SDL_MustLock(Src) then + SDL_LockSurface(Src); + if SDL_MustLock(Dest) then + SDL_LockSurface(Dest); + + ReadRow := UInt32(Src.Pixels); + WriteRow := UInt32(Dest.Pixels); + + SrcPitch := Src.pitch; + DestPitch := Dest.pitch; + + case Src.format.BitsPerPixel of + 8: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + Color := PUInt8(ReadAddr)^; + PUInt8(WriteAddr)^ := Color; + PUInt8(WriteAddr + 1)^ := Color; + Color := (Color shr 1) and $6d; {%01101101} + PUInt8(WriteAddr + DestPitch)^ := Color; + PUInt8(WriteAddr + DestPitch + 1)^ := Color; + inc(ReadAddr); + inc(WriteAddr, 2); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + 15: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + Color := PUInt16(ReadAddr)^; + PUInt16(WriteAddr)^ := Color; + PUInt16(WriteAddr + 2)^ := Color; + Color := (Color shr 1) and $3def; {%0011110111101111} + PUInt16(WriteAddr + DestPitch)^ := Color; + PUInt16(WriteAddr + DestPitch + 2)^ := Color; + inc(ReadAddr, 2); + inc(WriteAddr, 4); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + 16: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + Color := PUInt16(ReadAddr)^; + PUInt16(WriteAddr)^ := Color; + PUInt16(WriteAddr + 2)^ := Color; + Color := (Color shr 1) and $7bef; {%0111101111101111} + PUInt16(WriteAddr + DestPitch)^ := Color; + PUInt16(WriteAddr + DestPitch + 2)^ := Color; + inc(ReadAddr, 2); + inc(WriteAddr, 4); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + 24: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + Color := (PUInt32(WriteAddr)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + PUInt32(WriteAddr)^ := Color; + PUInt32(WriteAddr + 3)^ := Color; + Color := (Color shr 1) and $007f7f7f; {%011111110111111101111111} + PUInt32(WriteAddr + DestPitch)^ := Color; + PUInt32(WriteAddr + DestPitch + 3)^ := Color; + inc(ReadAddr, 3); + inc(WriteAddr, 6); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + 32: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + Color := PUInt32(ReadAddr)^; + PUInt32(WriteAddr)^ := Color; + PUInt32(WriteAddr + 4)^ := Color; + Color := (Color shr 1) and $7f7f7f7f; + PUInt32(WriteAddr + DestPitch)^ := Color; + PUInt32(WriteAddr + DestPitch + 4)^ := Color; + inc(ReadAddr, 4); + inc(WriteAddr, 8); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + end; + + if SDL_MustLock(Src) then + SDL_UnlockSurface(Src); + if SDL_MustLock(Dest) then + SDL_UnlockSurface(Dest); +end; + +function SDL_PixelTestSurfaceVsRect( SrcSurface1 : PSDL_Surface; SrcRect1 : +PSDL_Rect; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : +boolean; +var + Src_Rect1, Src_Rect2 : TSDL_Rect; + right1, bottom1 : integer; + right2, bottom2 : integer; + Scan1Start, Scan2Start, ScanWidth, ScanHeight : cardinal; + Mod1: cardinal; + Addr1 : cardinal; + BPP : cardinal; + Pitch1 : cardinal; + TransparentColor1 : cardinal; + tx, ty : cardinal; + StartTick : cardinal; + Color1 : cardinal; +begin + Result := false; + if SrcRect1 = nil then + begin + with Src_Rect1 do + begin + x := 0; + y := 0; + w := SrcSurface1.w; + h := SrcSurface1.h; + end; + end + else + Src_Rect1 := SrcRect1^; + + Src_Rect2 := SrcRect2^; + with Src_Rect1 do + begin + Right1 := Left1 + w; + Bottom1 := Top1 + h; + end; + with Src_Rect2 do + begin + Right2 := Left2 + w; + Bottom2 := Top2 + h; + end; + if ( Left1 >= Right2 ) or ( Right1 <= Left2 ) or ( Top1 >= Bottom2 ) or ( +Bottom1 <= + Top2 ) then + exit; + if Left1 <= Left2 then + begin + // 1. left, 2. right + Scan1Start := Src_Rect1.x + Left2 - Left1; + Scan2Start := Src_Rect2.x; + ScanWidth := Right1 - Left2; + with Src_Rect2 do + if ScanWidth > w then + ScanWidth := w; + end + else + begin + // 1. right, 2. left + Scan1Start := Src_Rect1.x; + Scan2Start := Src_Rect2.x + Left1 - Left2; + ScanWidth := Right2 - Left1; + with Src_Rect1 do + if ScanWidth > w then + ScanWidth := w; + end; + with SrcSurface1^ do + begin + Pitch1 := Pitch; + Addr1 := cardinal( Pixels ); + inc( Addr1, Pitch1 * UInt32( Src_Rect1.y ) ); + with format^ do + begin + BPP := BytesPerPixel; + TransparentColor1 := colorkey; + end; + end; + + Mod1 := Pitch1 - ( ScanWidth * BPP ); + + inc( Addr1, BPP * Scan1Start ); + + if Top1 <= Top2 then + begin + // 1. up, 2. down + ScanHeight := Bottom1 - Top2; + if ScanHeight > Src_Rect2.h then + ScanHeight := Src_Rect2.h; + inc( Addr1, Pitch1 * UInt32( Top2 - Top1 ) ); + end + else + begin + // 1. down, 2. up + ScanHeight := Bottom2 - Top1; + if ScanHeight > Src_Rect1.h then + ScanHeight := Src_Rect1.h; + + end; + case BPP of + 1 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PByte( Addr1 )^ <> TransparentColor1 ) then + begin + Result := true; + exit; + end; + inc( Addr1 ); + + end; + inc( Addr1, Mod1 ); + + end; + 2 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PWord( Addr1 )^ <> TransparentColor1 ) then + begin + Result := true; + exit; + end; + inc( Addr1, 2 ); + + end; + inc( Addr1, Mod1 ); + + end; + 3 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + Color1 := PLongWord( Addr1 )^ and $00FFFFFF; + + if ( Color1 <> TransparentColor1 ) + then + begin + Result := true; + exit; + end; + inc( Addr1, 3 ); + + end; + inc( Addr1, Mod1 ); + + end; + 4 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PLongWord( Addr1 )^ <> TransparentColor1 ) then + begin + Result := true; + exit; + end; + inc( Addr1, 4 ); + + end; + inc( Addr1, Mod1 ); + + end; + end; +end; + +procedure SDL_ORSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := Format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + WorkY := Src.h; + case bits of + 8 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt8( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt8( DestAddr )^; + PUInt8( DestAddr )^ := Pixel2 OR Pixel1; + end; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 15 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + + PUInt16( DestAddr )^ := Pixel2 OR Pixel1; + + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 16 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + + PUInt16( DestAddr )^ := Pixel2 OR Pixel1; + + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 24 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; + + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or Pixel2 or Pixel1; + end; + inc( SrcAddr, 3 ); + inc( DestAddr, 3 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 32 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^; + + PUInt32( DestAddr )^ := Pixel2 or Pixel1; + end; + inc( SrcAddr, 4 ); + inc( DestAddr, 4 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); +end; + +procedure SDL_ANDSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := Format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + WorkY := Src.h; + case bits of + 8 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt8( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt8( DestAddr )^; + PUInt8( DestAddr )^ := Pixel2 and Pixel1; + end; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 15 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + + PUInt16( DestAddr )^ := Pixel2 and Pixel1; + + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 16 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + + PUInt16( DestAddr )^ := Pixel2 and Pixel1; + + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 24 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; + + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or Pixel2 and Pixel1; + end; + inc( SrcAddr, 3 ); + inc( DestAddr, 3 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 32 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^; + + PUInt32( DestAddr )^ := Pixel2 and Pixel1; + end; + inc( SrcAddr, 4 ); + inc( DestAddr, 4 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); +end; + + + +procedure SDL_GTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := Format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + WorkY := Src.h; + case bits of + 8 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt8( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt8( DestAddr )^; + if Pixel2 > 0 then + begin + if Pixel2 and $E0 > Pixel1 and $E0 then R := Pixel2 and $E0 else R := Pixel1 and $E0; + if Pixel2 and $1C > Pixel1 and $1C then G := Pixel2 and $1C else G := Pixel1 and $1C; + if Pixel2 and $03 > Pixel1 and $03 then B := Pixel2 and $03 else B := Pixel1 and $03; + + if R > $E0 then + R := $E0; + if G > $1C then + G := $1C; + if B > $03 then + B := $03; + PUInt8( DestAddr )^ := R or G or B; + end + else + PUInt8( DestAddr )^ := Pixel1; + end; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 15 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $7C00 > Pixel1 and $7C00 then R := Pixel2 and $7C00 else R := Pixel1 and $7C00; + if Pixel2 and $03E0 > Pixel1 and $03E0 then G := Pixel2 and $03E0 else G := Pixel1 and $03E0; + if Pixel2 and $001F > Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; + + PUInt16( DestAddr )^ := R or G or B; + end + else + PUInt16( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 16 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $F800 > Pixel1 and $F800 then R := Pixel2 and $F800 else R := Pixel1 and $F800; + if Pixel2 and $07E0 > Pixel1 and $07E0 then G := Pixel2 and $07E0 else G := Pixel1 and $07E0; + if Pixel2 and $001F > Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; + + PUInt16( DestAddr )^ := R or G or B; + end + else + PUInt16( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 24 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; + if Pixel2 > 0 then + begin + + if Pixel2 and $FF0000 > Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; + if Pixel2 and $00FF00 > Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; + if Pixel2 and $0000FF > Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; + + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or ( R or G or B ); + end + else + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or Pixel1; + end; + inc( SrcAddr, 3 ); + inc( DestAddr, 3 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 32 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $FF0000 > Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; + if Pixel2 and $00FF00 > Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; + if Pixel2 and $0000FF > Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; + + PUInt32( DestAddr )^ := R or G or B; + end + else + PUInt32( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 4 ); + inc( DestAddr, 4 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); +end; + + +procedure SDL_LTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := Format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + WorkY := Src.h; + case bits of + 8 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt8( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt8( DestAddr )^; + if Pixel2 > 0 then + begin + if Pixel2 and $E0 < Pixel1 and $E0 then R := Pixel2 and $E0 else R := Pixel1 and $E0; + if Pixel2 and $1C < Pixel1 and $1C then G := Pixel2 and $1C else G := Pixel1 and $1C; + if Pixel2 and $03 < Pixel1 and $03 then B := Pixel2 and $03 else B := Pixel1 and $03; + + if R > $E0 then + R := $E0; + if G > $1C then + G := $1C; + if B > $03 then + B := $03; + PUInt8( DestAddr )^ := R or G or B; + end + else + PUInt8( DestAddr )^ := Pixel1; + end; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 15 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $7C00 < Pixel1 and $7C00 then R := Pixel2 and $7C00 else R := Pixel1 and $7C00; + if Pixel2 and $03E0 < Pixel1 and $03E0 then G := Pixel2 and $03E0 else G := Pixel1 and $03E0; + if Pixel2 and $001F < Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; + + PUInt16( DestAddr )^ := R or G or B; + end + else + PUInt16( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 16 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $F800 < Pixel1 and $F800 then R := Pixel2 and $F800 else R := Pixel1 and $F800; + if Pixel2 and $07E0 < Pixel1 and $07E0 then G := Pixel2 and $07E0 else G := Pixel1 and $07E0; + if Pixel2 and $001F < Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; + + PUInt16( DestAddr )^ := R or G or B; + end + else + PUInt16( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 24 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; + if Pixel2 > 0 then + begin + + if Pixel2 and $FF0000 < Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; + if Pixel2 and $00FF00 < Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; + if Pixel2 and $0000FF < Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; + + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or ( R or G or B ); + end + else + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or Pixel1; + end; + inc( SrcAddr, 3 ); + inc( DestAddr, 3 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 32 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $FF0000 < Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; + if Pixel2 and $00FF00 < Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; + if Pixel2 and $0000FF < Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; + + PUInt32( DestAddr )^ := R or G or B; + end + else + PUInt32( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 4 ); + inc( DestAddr, 4 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); +end; + +// Will clip the x1,x2,y1,x2 params to the ClipRect provided +function SDL_ClipLine(var x1,y1,x2,y2: Integer; ClipRect: PSDL_Rect) : boolean; + var tflag, flag1, flag2: word; + txy, xedge, yedge: Integer; + slope: single; + + function ClipCode(x,y: Integer): word; + begin + Result := 0; + if x < ClipRect.x then Result := 1; + if x >= ClipRect.w + ClipRect.x then Result := Result or 2; + if y < ClipRect.y then Result := Result or 4; + if y >= ClipRect.h + ClipRect.y then Result := Result or 8; + end; + +begin + flag1 := ClipCode(x1,y1); + flag2 := ClipCode(x2,y2); + result := true; + + while true do + begin + if (flag1 or flag2) = 0 then Exit; // all in + + if (flag1 and flag2) <> 0 then + begin + result := false; + Exit; // all out + end; + + if flag2 = 0 then + begin + txy := x1; x1 := x2; x2 := txy; + txy := y1; y1 := y2; y2 := txy; + tflag := flag1; flag1 := flag2; flag2 := tflag; + end; + + if (flag2 and 3) <> 0 then + begin + if (flag2 and 1) <> 0 then + xedge := ClipRect.x + else + xedge := ClipRect.w + ClipRect.x -1; // back 1 pixel otherwise we end up in a loop + + slope := (y2 - y1) / (x2 - x1); + y2 := y1 + Round(slope * (xedge - x1)); + x2 := xedge; + end + else + begin + if (flag2 and 4) <> 0 then + yedge := ClipRect.y + else + yedge := ClipRect.h + ClipRect.y -1; // up 1 pixel otherwise we end up in a loop + + slope := (x2 - x1) / (y2 - y1); + x2 := x1 + Round(slope * (yedge - y1)); + y2 := yedge; + end; + + flag2 := ClipCode(x2, y2); + end; +end; + +end. + + diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlwindow.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlwindow.pas new file mode 100644 index 00000000..ef290071 --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlwindow.pas @@ -0,0 +1,564 @@ +unit sdlwindow; +{ + $Id: sdlwindow.pas,v 1.7 2004/09/30 22:35:47 savage Exp $ + +} +{******************************************************************************} +{ } +{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } +{ SDL Window Wrapper } +{ } +{ } +{ The initial developer of this Pascal code was : } +{ Dominique Louis } +{ } +{ Portions created by Dominique Louis are } +{ Copyright (C) 2004 - 2100 Dominique Louis. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ Dominique Louis } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ SDL Window Wrapper } +{ } +{ } +{ Requires } +{ -------- } +{ SDL.dll on Windows platforms } +{ libSDL-1.1.so.0 on Linux platform } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ January 31 2003 - DL : Initial creation } +{ } +{ + $Log: sdlwindow.pas,v $ + Revision 1.7 2004/09/30 22:35:47 savage + Changes, enhancements and additions as required to get SoAoS working. + + Revision 1.6 2004/09/12 21:52:58 savage + Slight changes to fix some issues with the sdl classes. + + Revision 1.5 2004/05/10 21:11:49 savage + changes required to help get SoAoS off the ground. + + Revision 1.4 2004/05/01 14:59:27 savage + Updated code + + Revision 1.3 2004/04/23 10:45:28 savage + Changes made by Dean Ellis to work more modularly. + + Revision 1.2 2004/03/31 10:06:41 savage + Changed so that it now compiles, but is untested. + + Revision 1.1 2004/02/05 00:08:20 savage + Module 1.0 release + +} +{******************************************************************************} + +interface + +{$i jedi-sdl.inc} + +uses + Classes, + sdl, + sdlinput, + sdlticks; + +type + TSDLNotifyEvent = procedure {$IFNDEF NOT_OO}of object{$ENDIF}; + TSDLUpdateEvent = procedure( aElapsedTime : single ) {$IFNDEF NOT_OO}of object{$ENDIF}; + TSDLResizeEvent = procedure( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 ) {$IFNDEF NOT_OO}of object{$ENDIF}; + TSDLUserEvent = procedure( aType : UInt8; aCode : integer; aData1 : Pointer; aData2 : Pointer ) {$IFNDEF NOT_OO}of object{$ENDIF}; + TSDLActiveEvent = procedure( aGain: UInt8; aState: UInt8 ) {$IFNDEF NOT_OO}of object{$ENDIF}; + + TSDLBaseWindow = class( TObject ) + private + FDisplaySurface : PSDL_Surface; + FVideoFlags : Uint32; + FOnDestroy: TSDLNotifyEvent; + FOnCreate: TSDLNotifyEvent; + FOnShow: TSDLNotifyEvent; + FOnResize: TSDLResizeEvent; + FOnUpdate: TSDLUpdateEvent; + FOnRender: TSDLNotifyEvent; + FOnClose: TSDLNotifyEvent; + FLoaded: Boolean; + FRendering: Boolean; + FHeight: integer; + FBitDepth: integer; + FWidth: integer; + FInputManager: TSDLInputManager; + FCaptionText : PChar; + FIconName : PChar; + FOnActive: TSDLActiveEvent; + FOnQuit: TSDLNotifyEvent; + FOnExpose: TSDLNotifyEvent; + FOnUser: TSDLUserEvent; + FTimer : TSDLTicks; + protected + procedure DoActive( aGain: UInt8; aState: UInt8 ); + procedure DoCreate; + procedure DoClose; + procedure DoDestroy; + procedure DoUpdate( aElapsedTime : single ); + procedure DoQuit; + procedure DoRender; + procedure DoResize( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 ); + procedure DoShow; + procedure DoUser( aType : UInt8; aCode : integer; aData1 : Pointer; aData2 : Pointer ); + procedure DoExpose; + procedure Render; virtual; + procedure Update( aElapsedTime : single ); virtual; + procedure InitialiseObjects; virtual; + procedure RestoreObjects; virtual; + procedure DeleteObjects; virtual; + function Flip : integer; virtual; + property OnActive : TSDLActiveEvent read FOnActive write FOnActive; + property OnClose: TSDLNotifyEvent read FOnClose write FOnClose; + property OnDestroy : TSDLNotifyEvent read FOnDestroy write FOnDestroy; + property OnCreate : TSDLNotifyEvent read FOnCreate write FOnCreate; + property OnUpdate: TSDLUpdateEvent read FOnUpdate write FOnUpdate; + property OnQuit : TSDLNotifyEvent read FOnQuit write FOnQuit; + property OnResize : TSDLResizeEvent read FOnResize write FOnResize; + property OnRender: TSDLNotifyEvent read FOnRender write FOnRender; + property OnShow : TSDLNotifyEvent read FOnShow write FOnShow; + property OnUser : TSDLUserEvent read FOnUser write FOnUser; + property OnExpose : TSDLNotifyEvent read FOnExpose write FOnExpose; + property DisplaySurface: PSDL_Surface read FDisplaySurface; + public + property InputManager : TSDLInputManager read FInputManager; + property Loaded : Boolean read FLoaded; + property Width : integer read FWidth; + property Height : integer read FHeight; + property BitDepth : integer read FBitDepth; + property Rendering : Boolean read FRendering write FRendering; + procedure SetCaption( const aCaptionText : string; const aIconName : string ); + procedure GetCaption( var aCaptionText : string; var aIconName : string ); + procedure SetIcon( aIcon : PSDL_Surface; aMask: UInt8 ); + procedure ActivateVideoMode; + constructor Create( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 ); virtual; + destructor Destroy; override; + procedure InitialiseEnvironment; + function Show : Boolean; virtual; + end; + + TSDL2DWindow = class( TSDLBaseWindow ) + public + constructor Create( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 = SDL_DOUBLEBUF or SDL_SWSURFACE); override; + procedure Render; override; + procedure Update( aElapsedTime : single ); override; + procedure InitialiseObjects; override; + procedure RestoreObjects; override; + procedure DeleteObjects; override; + function Flip : integer; override; + property OnCreate; + property OnDestroy; + property OnClose; + property OnShow; + property OnResize; + property OnRender; + property OnUpdate; + property DisplaySurface; + end; + + TSDL3DWindow = class( TSDLBaseWindow ) + public + constructor Create( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 = SDL_OPENGL or SDL_DOUBLEBUF); override; + function Flip : integer; override; + procedure Render; override; + procedure Update( aElapsedTime : single ); override; + procedure InitialiseObjects; override; + procedure RestoreObjects; override; + procedure DeleteObjects; override; + property OnCreate; + property OnDestroy; + property OnClose; + property OnShow; + property OnResize; + property OnRender; + property OnUpdate; + property DisplaySurface; + end; + + + +implementation + +uses + logger, + SysUtils; + +{ TSDLBaseWindow } +procedure TSDLBaseWindow.ActivateVideoMode; +begin + FDisplaySurface := SDL_SetVideoMode( FWidth, FHeight, FBitDepth, FVideoFlags); + if (FDisplaySurface = nil) then + begin + Log.LogError( Format('Could not set video mode: %s', [SDL_GetError]), 'Main'); + exit; + end; + + SetCaption( 'Made with JEDI-SDL', 'JEDI-SDL Icon' ); +end; + +constructor TSDLBaseWindow.Create( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 ); +begin + inherited Create; + SDL_Init(SDL_INIT_EVERYTHING); + FInputManager := TSDLInputManager.Create( [ itJoystick, itKeyBoard, itMouse ]); + FTimer := TSDLTicks.Create; + + FWidth := aWidth; + FHeight := aHeight; + FBitDepth := aBitDepth; + FVideoFlags := aVideoFlags; + + DoCreate; +end; + +procedure TSDLBaseWindow.DeleteObjects; +begin + FLoaded := False; +end; + +destructor TSDLBaseWindow.Destroy; +begin + DoDestroy; + if FLoaded then + DeleteObjects; + if FInputManager <> nil then + FreeAndNil( FInputManager ); + if FTimer <> nil then + FreeAndNil( FTimer ); + if FDisplaySurface <> nil then + SDL_FreeSurface( FDisplaySurface ); + inherited Destroy; + SDL_Quit; +end; + +procedure TSDLBaseWindow.DoActive(aGain, aState: UInt8); +begin + if Assigned( FOnActive ) then + begin + FOnActive( aGain, aState ); + end; +end; + +procedure TSDLBaseWindow.DoClose; +begin + if Assigned( FOnClose ) then + begin + FOnClose; + end; +end; + +procedure TSDLBaseWindow.DoCreate; +begin + if Assigned( FOnCreate ) then + begin + FOnCreate; + end; +end; + +procedure TSDLBaseWindow.DoDestroy; +begin + if Assigned( FOnDestroy ) then + begin + FOnDestroy; + end; +end; + +procedure TSDLBaseWindow.DoExpose; +begin + if Assigned( FOnExpose ) then + begin + FOnExpose; + end; +end; + +procedure TSDLBaseWindow.DoUpdate( aElapsedTime : single ); +begin + if Assigned( FOnUpdate ) then + begin + FOnUpdate( aElapsedTime ); + end; +end; + +procedure TSDLBaseWindow.DoQuit; +begin + FRendering := false; + if Assigned( FOnQuit ) then + begin + FOnQuit; + end; +end; + +procedure TSDLBaseWindow.DoRender; +begin + if Assigned( FOnRender ) then + begin + FOnRender; + end; +end; + +procedure TSDLBaseWindow.DoResize( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 ); +begin + // resize to the new size + SDL_FreeSurface(FDisplaySurface); + FWidth := aWidth; + FHeight := aHeight; + FBitDepth := aBitDepth; + FVideoFlags := aVideoFlags; + FDisplaySurface := SDL_SetVideoMode(aWidth, aHeight, aBitDepth, aVideoFlags); + if Assigned( FOnResize ) then + begin + FOnResize( aWidth, aHeight, aBitDepth, aVideoFlags ); + end; +end; + +procedure TSDLBaseWindow.DoShow; +begin + if Assigned( FOnShow ) then + begin + FOnShow; + end; +end; + +procedure TSDLBaseWindow.DoUser(aType: UInt8; aCode: integer; aData1, aData2: Pointer); +begin + if Assigned( FOnUser ) then + begin + FOnUser( aType, aCode, aData1, aData2 ); + end; +end; + +function TSDLBaseWindow.Flip : integer; +begin + result := 0; +end; + +procedure TSDLBaseWindow.GetCaption( var aCaptionText : string; var aIconName : string ); +begin + aCaptionText := string( FCaptionText ); + aIconName := string( FIconName ); +end; + +procedure TSDLBaseWindow.InitialiseEnvironment; +begin + InitialiseObjects; + RestoreObjects; +end; + +procedure TSDLBaseWindow.InitialiseObjects; +begin + FLoaded := True; +end; + +procedure TSDLBaseWindow.Update( aElapsedTime : single ); +begin + DoUpdate( aElapsedTime ); +end; + +procedure TSDLBaseWindow.Render; +begin + DoRender; +end; + +procedure TSDLBaseWindow.RestoreObjects; +begin + FLoaded := false; +end; + +procedure TSDLBaseWindow.SetCaption( const aCaptionText : string; const aIconName : string ); +begin + if FCaptionText <> aCaptionText then + begin + FCaptionText := PChar( aCaptionText ); + FIconName := PChar( aIconName ); + SDL_WM_SetCaption( FCaptionText, FIconName ); + end; +end; + +procedure TSDLBaseWindow.SetIcon(aIcon: PSDL_Surface; aMask: UInt8); +begin + SDL_WM_SetIcon( aIcon, aMask ); +end; + +function TSDLBaseWindow.Show : Boolean; +var + eBaseWindowEvent : TSDL_Event; +begin + DoShow; + + FTimer.Init; + + FRendering := true; + // repeat until we are told not to render + while FRendering do + begin + // wait for an event + while SDL_PollEvent( @eBaseWindowEvent ) > 0 do + begin + + // check for a quit event + case eBaseWindowEvent.type_ of + SDL_ACTIVEEVENT : + begin + DoActive( eBaseWindowEvent.active.gain, eBaseWindowEvent.active.state ); + end; + + SDL_QUITEV : + begin + DoQuit; + DoClose; + end; + + SDL_USEREVENT : + begin + DoUser( eBaseWindowEvent.user.type_, eBaseWindowEvent.user.code, eBaseWindowEvent.user.data1, eBaseWindowEvent.user.data2 ); + end; + + SDL_VIDEOEXPOSE : + begin + DoExpose; + end; + + SDL_VIDEORESIZE : + begin + DoResize( eBaseWindowEvent.resize.w, eBaseWindowEvent.resize.h, FDisplaySurface.format.BitsPerPixel, FVideoflags ); + end; + + + end; + InputManager.UpdateInputs( eBaseWindowEvent ); + end; + // Prepare the Next Frame + Update( FTimer.GetElapsedSeconds ); + // Display the Next Frame + Render; + // Flip the surfaces + Flip; + end; + + Result := FRendering; +end; + +{ TSDL2DWindow } + +constructor TSDL2DWindow.Create(aWidth, aHeight, aBitDepth: integer; aVideoFlags: Uint32); +begin + // make sure double buffer is always included in the video flags + inherited Create(aWidth,aHeight, aBitDepth, aVideoFlags or SDL_DOUBLEBUF); +end; + +procedure TSDL2DWindow.DeleteObjects; +begin + inherited; + +end; + +function TSDL2DWindow.Flip: integer; +begin + // let's show the back buffer + result := SDL_Flip( FDisplaySurface ); +end; + +procedure TSDL2DWindow.InitialiseObjects; +begin + inherited; + +end; + +procedure TSDL2DWindow.Update( aElapsedTime : single ); +begin + inherited; + +end; + +procedure TSDL2DWindow.Render; +begin + inherited; + +end; + +procedure TSDL2DWindow.RestoreObjects; +begin + inherited; + +end; + +{ TSDL3DWindow } + +constructor TSDL3DWindow.Create(aWidth, + aHeight, aBitDepth: integer; aVideoFlags: Uint32); +begin + // make sure opengl is always included in the video flags + inherited Create(aWidth,aHeight, aBitDepth, aVideoFlags or SDL_OPENGL or SDL_DOUBLEBUF); +end; + +procedure TSDL3DWindow.DeleteObjects; +begin + inherited; + +end; + +function TSDL3DWindow.Flip : integer; +begin + SDL_GL_SwapBuffers; + result := 0; +end; + +procedure TSDL3DWindow.InitialiseObjects; +begin + inherited; + +end; + +procedure TSDL3DWindow.Update( aElapsedTime : single ); +begin + inherited; + +end; + +procedure TSDL3DWindow.Render; +begin + inherited; + +end; + +procedure TSDL3DWindow.RestoreObjects; +begin + inherited; + +end; + +end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/userpreferences.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/userpreferences.pas new file mode 100644 index 00000000..97e26520 --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/userpreferences.pas @@ -0,0 +1,159 @@ +unit userpreferences; +{ + $Id: userpreferences.pas,v 1.1 2004/09/30 22:35:47 savage Exp $ + +} +{******************************************************************************} +{ } +{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } +{ Base Class for User Preferences } +{ } +{ The initial developer of this Pascal code was : } +{ Dominqiue Louis } +{ } +{ Portions created by Dominqiue Louis are } +{ Copyright (C) 2000 - 2001 Dominqiue Louis. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ } +{ } +{ } +{ } +{ } +{ } +{ } +{ Requires } +{ -------- } +{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } +{ They are available from... } +{ http://www.libsdl.org . } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ September 23 2004 - DL : Initial Creation } +{ + $Log: userpreferences.pas,v $ + Revision 1.1 2004/09/30 22:35:47 savage + Changes, enhancements and additions as required to get SoAoS working. + + +} +{******************************************************************************} + +interface + +uses + Classes; + +type + TUserPreferences = class + private + FAutoSave: Boolean; + procedure CheckAutoSave; + protected + function GetDefaultBoolean( const Index : Integer ) : Boolean; virtual; abstract; + function GetBoolean( const Index : Integer ) : Boolean; virtual; abstract; + procedure SetBoolean( const Index : Integer; const Value : Boolean ); virtual; + function GetDefaultDateTime( const Index : Integer ) : TDateTime; virtual; abstract; + function GetDateTime( const Index : Integer ) : TDateTime; virtual; abstract; + procedure SetDateTime( const Index : Integer; const Value : TDateTime ); virtual; + function GetDefaultInteger( const Index : Integer ) : Integer; virtual; abstract; + function GetInteger( const Index : Integer ) : Integer; virtual; abstract; + procedure SetInteger( const Index : Integer; const Value : Integer ); virtual; + function GetDefaultFloat( const Index : Integer ) : single; virtual; abstract; + function GetFloat( const Index : Integer ) : single; virtual; abstract; + procedure SetFloat( const Index : Integer; const Value : single ); virtual; + function GetDefaultString( const Index : Integer ) : string; virtual; abstract; + function GetString( const Index : Integer ) : string; virtual; abstract; + procedure SetString( const Index : Integer; const Value : string ); virtual; + function GetDefaultBinaryStream( const Index : Integer ) : TStream; virtual; abstract; + function GetBinaryStream( const Index : Integer ) : TStream; virtual; abstract; + procedure SetBinaryStream( const Index : Integer; const Value : TStream ); virtual; + public + procedure Update; virtual; abstract; + constructor Create; virtual; + destructor Destroy; override; + property AutoSave : Boolean read FAutoSave write FAutoSave; + end; + +implementation + +{ TUserPreferences } +procedure TUserPreferences.CheckAutoSave; +begin + if FAutoSave then + Update; +end; + +constructor TUserPreferences.Create; +begin + inherited; + FAutoSave := false; +end; + +destructor TUserPreferences.Destroy; +begin + + inherited; +end; + +procedure TUserPreferences.SetBinaryStream( const Index : Integer; const Value : TStream ); +begin + CheckAutoSave; +end; + +procedure TUserPreferences.SetBoolean(const Index: Integer; const Value: Boolean); +begin + CheckAutoSave; +end; + +procedure TUserPreferences.SetDateTime(const Index: Integer; const Value: TDateTime); +begin + CheckAutoSave; +end; + +procedure TUserPreferences.SetFloat(const Index: Integer; const Value: single); +begin + CheckAutoSave; +end; + +procedure TUserPreferences.SetInteger(const Index, Value: Integer); +begin + CheckAutoSave; +end; + +procedure TUserPreferences.SetString(const Index: Integer; const Value: string); +begin + CheckAutoSave; +end; + +end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL_Image/Pas/sdl_image.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL_Image/Pas/sdl_image.pas new file mode 100644 index 00000000..fecc0dbc --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/SDL_Image/Pas/sdl_image.pas @@ -0,0 +1,287 @@ +unit sdl_image; +{ + $Id: sdl_image.pas,v 1.7 2005/01/01 02:03:12 savage Exp $ + +} +{******************************************************************************} +{ } +{ Borland Delphi SDL_Image - An example image loading library for use } +{ with SDL } +{ Conversion of the Simple DirectMedia Layer Image Headers } +{ } +{ Portions created by Sam Lantinga are } +{ Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga } +{ 5635-34 Springhouse Dr. } +{ Pleasanton, CA 94588 (USA) } +{ } +{ All Rights Reserved. } +{ } +{ The original files are : SDL_image.h } +{ } +{ The initial developer of this Pascal code was : } +{ Matthias Thoma } +{ } +{ Portions created by Matthias Thoma are } +{ Copyright (C) 2000 - 2001 Matthias Thoma. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ Dominique Louis } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ A simple library to load images of various formats as SDL surfaces } +{ } +{ Requires } +{ -------- } +{ SDL.pas in your search path. } +{ } +{ Programming Notes } +{ ----------------- } +{ See the Aliens Demo on how to make use of this libaray } +{ } +{ Revision History } +{ ---------------- } +{ April 02 2001 - MT : Initial Translation } +{ } +{ May 08 2001 - DL : Added ExternalSym derectives and copyright header } +{ } +{ April 03 2003 - DL : Added jedi-sdl.inc include file to support more } +{ Pascal compilers. Initial support is now included } +{ for GnuPascal, VirtualPascal, TMT and obviously } +{ continue support for Delphi Kylix and FreePascal. } +{ } +{ April 08 2003 - MK : Aka Mr Kroket - Added Better FPC support } +{ } +{ April 24 2003 - DL : under instruction from Alexey Barkovoy, I have added} +{ better TMT Pascal support and under instruction } +{ from Prof. Abimbola Olowofoyeku (The African Chief),} +{ I have added better Gnu Pascal support } +{ } +{ April 30 2003 - DL : under instruction from David Mears AKA } +{ Jason Siletto, I have added FPC Linux support. } +{ This was compiled with fpc 1.1, so remember to set } +{ include file path. ie. -Fi/usr/share/fpcsrc/rtl/* } +{ } +{ + $Log: sdl_image.pas,v $ + Revision 1.7 2005/01/01 02:03:12 savage + Updated to v1.2.4 + + Revision 1.6 2004/08/14 22:54:30 savage + Updated so that Library name defines are correctly defined for MacOS X. + + Revision 1.5 2004/05/10 14:10:04 savage + Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ). + + Revision 1.4 2004/04/13 09:32:08 savage + Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary. + + Revision 1.3 2004/04/01 20:53:23 savage + Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site. + + Revision 1.2 2004/03/30 20:23:28 savage + Tidied up use of UNIX compiler directive. + + Revision 1.1 2004/02/14 23:35:42 savage + version 1 of sdl_image, sdl_mixer and smpeg. + + +} +{******************************************************************************} + +{$I jedi-sdl.inc} + +{$ALIGN ON} + +interface + +uses +{$IFDEF __GPC__} + gpc, +{$ENDIF} + sdl; + +const +{$IFDEF WIN32} + SDL_ImageLibName = 'SDL_Image.dll'; +{$ENDIF} + +{$IFDEF UNIX} +{$IFDEF DARWIN} + SDL_ImageLibName = 'libSDL_image.dylib'; +{$ELSE} + SDL_ImageLibName = 'libSDL_image.so'; +{$ENDIF} +{$ENDIF} + +{$IFDEF MACOS} + SDL_ImageLibName = 'SDL_image'; +{$ENDIF} + + // Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL + SDL_IMAGE_MAJOR_VERSION = 1; +{$EXTERNALSYM SDL_IMAGE_MAJOR_VERSION} + SDL_IMAGE_MINOR_VERSION = 2; +{$EXTERNALSYM SDL_IMAGE_MINOR_VERSION} + SDL_IMAGE_PATCHLEVEL = 4; +{$EXTERNALSYM SDL_IMAGE_PATCHLEVEL} + +{ This macro can be used to fill a version structure with the compile-time + version of the SDL_image library. } +procedure SDL_IMAGE_VERSION( var X : TSDL_Version ); +{$EXTERNALSYM SDL_IMAGE_VERSION} + +{ This function gets the version of the dynamically linked SDL_image library. + it should NOT be used to fill a version structure, instead you should + use the SDL_IMAGE_VERSION() macro. + } +function IMG_Linked_Version : PSDL_version; +external {$IFDEF __GPC__}name 'IMG_Linked_Version'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_Linked_Version} + +{ Load an image from an SDL data source. + The 'type' may be one of: "BMP", "GIF", "PNG", etc. + + If the image format supports a transparent pixel, SDL will set the + colorkey for the surface. You can enable RLE acceleration on the + surface afterwards by calling: + SDL_SetColorKey(image, SDL_RLEACCEL, image.format.colorkey); +} +function IMG_LoadTyped_RW(src: PSDL_RWops; freesrc: Integer; _type: PChar): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadTyped_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadTyped_RW} +{ Convenience functions } +function IMG_Load(const _file: PChar): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_Load'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_Load} +function IMG_Load_RW(src: PSDL_RWops; freesrc: Integer): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_Load_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_Load_RW} + +{ Invert the alpha of a surface for use with OpenGL + This function is now a no-op, and only provided for backwards compatibility. } +function IMG_InvertAlpha(_on: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_InvertAlpha'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_InvertAlpha} + +{ Functions to detect a file type, given a seekable source } +function IMG_isBMP(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isBMP'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isBMP} +function IMG_isPNM(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isPNM'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isPNM} +function IMG_isXPM(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isXPM'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isXPM} +function IMG_isXCF(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isXCF'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isXCF} +function IMG_isPCX(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isPCX'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isPCX} +function IMG_isGIF(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isGIF'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isGIF} +function IMG_isJPG(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isJPG'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isJPG} +function IMG_isTIF(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isTIF'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isTIF} +function IMG_isPNG(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isPNG'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isPNG} +function IMG_isLBM(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isLBM'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isLBM} + +{ Individual loading functions } +function IMG_LoadBMP_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadBMP_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadBMP_RW} +function IMG_LoadPNM_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadPNM_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadPNM_RW} +function IMG_LoadXPM_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadXPM_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadXPM_RW} +function IMG_LoadXCF_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadXCF_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadXCF_RW} +function IMG_LoadPCX_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadPCX_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadPCX_RW} +function IMG_LoadGIF_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadGIF_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadGIF_RW} +function IMG_LoadJPG_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadJPG_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadJPG_RW} +function IMG_LoadTIF_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadTIF_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadTIF_RW} +function IMG_LoadPNG_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadPNG_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadPNG_RW} +function IMG_LoadTGA_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadTGA_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadTGA_RW} +function IMG_LoadLBM_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadLBM_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadLBM_RW} + +{ used internally, NOT an exported function } +//function IMG_string_equals( const str1 : PChar; const str2 : PChar ) : integer; +//cdecl; external {$IFDEF __GPC__}name 'IMG_string_equals'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +//{ $ EXTERNALSYM IMG_string_equals} + +{ Error Macros } +{ We'll use SDL for reporting errors } +procedure IMG_SetError( fmt : PChar ); + +function IMG_GetError : PChar; + +implementation + +{$IFDEF __GPC__} + {$L 'sdl_image'} { link sdl_image.dll.a or libsdl_image.so or libsdl_image.a } +{$ENDIF} + +procedure SDL_IMAGE_VERSION( var X : TSDL_Version ); +begin + X.major := SDL_IMAGE_MAJOR_VERSION; + X.minor := SDL_IMAGE_MINOR_VERSION; + X.patch := SDL_IMAGE_PATCHLEVEL; +end; + +procedure IMG_SetError( fmt : PChar ); +begin + SDL_SetError( fmt ); +end; + +function IMG_GetError : PChar; +begin + result := SDL_GetError; +end; + +end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL_ttf/Pas/sdl_ttf.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL_ttf/Pas/sdl_ttf.pas new file mode 100644 index 00000000..eea69719 --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/SDL_ttf/Pas/sdl_ttf.pas @@ -0,0 +1,451 @@ +unit sdl_ttf; +{ + $Id: sdl_ttf.pas,v 1.10 2005/01/02 19:07:32 savage Exp $ + +} +{******************************************************************************} +{ } +{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } +{ Conversion of the Simple DirectMedia Layer Headers } +{ } +{ Portions created by Sam Lantinga are } +{ Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga } +{ 5635-34 Springhouse Dr. } +{ Pleasanton, CA 94588 (USA) } +{ } +{ All Rights Reserved. } +{ } +{ The original files are : SDL_ttf.h } +{ } +{ The initial developer of this Pascal code was : } +{ Dominqiue Louis } +{ } +{ Portions created by Dominqiue Louis are } +{ Copyright (C) 2000 - 2001 Dominqiue Louis. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ Tom Jones His Project inspired this conversion } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ } +{ } +{ } +{ } +{ } +{ } +{ } +{ Requires } +{ -------- } +{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } +{ They are available from... } +{ http://www.libsdl.org . } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ December 08 2002 - DL : Fixed definition of TTF_RenderUnicode_Solid } +{ } +{ April 03 2003 - DL : Added jedi-sdl.inc include file to support more } +{ Pascal compilers. Initial support is now included } +{ for GnuPascal, VirtualPascal, TMT and obviously } +{ continue support for Delphi Kylix and FreePascal. } +{ } +{ April 24 2003 - DL : under instruction from Alexey Barkovoy, I have added} +{ better TMT Pascal support and under instruction } +{ from Prof. Abimbola Olowofoyeku (The African Chief),} +{ I have added better Gnu Pascal support } +{ } +{ April 30 2003 - DL : under instruction from David Mears AKA } +{ Jason Siletto, I have added FPC Linux support. } +{ This was compiled with fpc 1.1, so remember to set } +{ include file path. ie. -Fi/usr/share/fpcsrc/rtl/* } +{ } +{ + $Log: sdl_ttf.pas,v $ + Revision 1.10 2005/01/02 19:07:32 savage + Slight bug fix to use LongInt instead of Long ( Thanks Michalis Kamburelis ) + + Revision 1.9 2005/01/01 02:15:20 savage + Updated to v2.0.7 + + Revision 1.8 2004/10/07 21:02:32 savage + Fix for FPC + + Revision 1.7 2004/09/30 22:39:50 savage + Added a true type font class which contains a wrap text function. + Changed the sdl_ttf.pas header to reflect the future of jedi-sdl. + + Revision 1.6 2004/08/14 22:54:30 savage + Updated so that Library name defines are correctly defined for MacOS X. + + Revision 1.5 2004/05/10 14:10:04 savage + Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ). + + Revision 1.4 2004/04/13 09:32:08 savage + Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary. + + Revision 1.3 2004/04/01 20:53:24 savage + Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site. + + Revision 1.2 2004/03/30 20:23:28 savage + Tidied up use of UNIX compiler directive. + + Revision 1.1 2004/02/16 22:16:40 savage + v1.0 changes + + +} +{******************************************************************************} + +{$I jedi-sdl.inc} + +{$ALIGN ON} + +interface + +uses +{$IFDEF __GPC__} + gpc, +{$ENDIF} + +{$IFDEF WIN32} + {$IFNDEF __GPC__} + Windows, + {$ENDIF} +{$ENDIF} + sdl; + +const +{$IFDEF WIN32} + SDLttfLibName = 'SDL_ttf.dll'; +{$ENDIF} + +{$IFDEF UNIX} +{$IFDEF DARWIN} + SDLttfLibName = 'libSDL_ttf.dylib'; +{$ELSE} + SDLttfLibName = 'libSDL_ttf.so'; +{$ENDIF} +{$ENDIF} + +{$IFDEF MACOS} + SDLttfLibName = 'SDL_ttf'; +{$ENDIF} + + {* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL *} + SDL_TTF_MAJOR_VERSION = 2; +{$EXTERNALSYM SDL_TTF_MAJOR_VERSION} + SDL_TTF_MINOR_VERSION = 0; +{$EXTERNALSYM SDL_TTF_MINOR_VERSION} + SDL_TTF_PATCHLEVEL = 7; +{$EXTERNALSYM SDL_TTF_PATCHLEVEL} + + // Backwards compatibility + TTF_MAJOR_VERSION = SDL_TTF_MAJOR_VERSION; + TTF_MINOR_VERSION = SDL_TTF_MINOR_VERSION; + TTF_PATCHLEVEL = SDL_TTF_PATCHLEVEL; + +{* + Set and retrieve the font style + This font style is implemented by modifying the font glyphs, and + doesn't reflect any inherent properties of the truetype font file. +*} + TTF_STYLE_NORMAL = $00; + TTF_STYLE_BOLD = $01; + TTF_STYLE_ITALIC = $02; + TTF_STYLE_UNDERLINE = $04; + +// ZERO WIDTH NO-BREAKSPACE (Unicode byte order mark) + UNICODE_BOM_NATIVE = $FEFF; + UNICODE_BOM_SWAPPED = $FFFE; + +type + PTTF_Font = ^TTTF_font; + TTTF_Font = record + end; + +{ This macro can be used to fill a version structure with the compile-time + version of the SDL_ttf library. } +procedure SDL_TTF_VERSION( var X : TSDL_version ); +{$EXTERNALSYM SDL_TTF_VERSION} + +{ This function gets the version of the dynamically linked SDL_ttf library. + It should NOT be used to fill a version structure, instead you should use the + SDL_TTF_VERSION() macro. } +function TTF_Linked_Version : PSDL_version; +cdecl; external {$IFDEF __GPC__}name 'TTF_Linked_Version'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_Linked_Version} + +{ This function tells the library whether UNICODE text is generally + byteswapped. A UNICODE BOM character in a string will override + this setting for the remainder of that string. +} +procedure TTF_ByteSwappedUNICODE( swapped : integer ); +cdecl; external {$IFDEF __GPC__}name 'TTF_ByteSwappedUNICODE'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_ByteSwappedUNICODE} + +//returns 0 on succes, -1 if error occurs +function TTF_Init : integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_Init'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_Init} + +{ + Open a font file and create a font of the specified point size. + Some .fon fonts will have several sizes embedded in the file, so the + point size becomes the index of choosing which size. If the value + is too high, the last indexed size will be the default. +} +function TTF_OpenFont( const filename : Pchar; ptsize : integer ) : PTTF_Font; +cdecl; external {$IFDEF __GPC__}name 'TTF_OpenFont'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_OpenFont} + +function TTF_OpenFontIndex( const filename : Pchar; ptsize : integer; index : Longint ): PTTF_Font; +cdecl; external {$IFDEF __GPC__}name 'TTF_OpenFontIndex'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_OpenFontIndex} + +function TTF_OpenFontRW( src : PSDL_RWops; freesrc : integer; ptsize : integer ): PTTF_Font; +cdecl; external {$IFDEF __GPC__}name 'TTF_OpenFontRW'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_OpenFontRW} + +function TTF_OpenFontIndexRW( src : PSDL_RWops; freesrc : integer; ptsize : integer; index : Longint ): PTTF_Font; +cdecl; external {$IFDEF __GPC__}name 'TTF_OpenFontIndexRW'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_OpenFontIndexRW} + +function TTF_GetFontStyle( font : PTTF_Font) : integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_GetFontStyle'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_GetFontStyle} + +procedure TTF_SetFontStyle( font : PTTF_Font; style : integer ); +cdecl; external {$IFDEF __GPC__}name 'TTF_SetFontStyle'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_SetFontStyle} + +{ Get the total height of the font - usually equal to point size } +function TTF_FontHeight( font : PTTF_Font ) : Integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_FontHeight'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_FontHeight} + +{ Get the offset from the baseline to the top of the font + This is a positive value, relative to the baseline. +} +function TTF_FontAscent( font : PTTF_Font ) : Integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_FontAscent'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_FontAscent} +{ Get the offset from the baseline to the bottom of the font + This is a negative value, relative to the baseline. +} +function TTF_FontDescent( font : PTTF_Font ) : Integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_FontDescent'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_FontDescent} + +{ Get the recommended spacing between lines of text for this font } +function TTF_FontLineSkip( font : PTTF_Font ): Integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_FontLineSkip'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_FontLineSkip} + +{ Get the number of faces of the font } +function TTF_FontFaces( font : PTTF_Font ) : Longint; +cdecl; external {$IFDEF __GPC__}name 'TTF_FontFaces'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_FontFaces} + +{ Get the font face attributes, if any } +function TTF_FontFaceIsFixedWidth( font : PTTF_Font ): Integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_FontFaceIsFixedWidth'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_FontFaceIsFixedWidth} + +function TTF_FontFaceFamilyName( font : PTTF_Font ): PChar; +cdecl; external {$IFDEF __GPC__}name 'TTF_FontFaceFamilyName'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_FontFaceFamilyName} + +function TTF_FontFaceStyleName( font : PTTF_Font ): PChar; +cdecl; external {$IFDEF __GPC__}name 'TTF_FontFaceStyleName'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_FontFaceStyleName} + +{ Get the metrics (dimensions) of a glyph } +function TTF_GlyphMetrics( font : PTTF_Font; ch : Uint16; + var minx : integer; var maxx : integer; + var miny : integer; var maxy : integer; + var advance : integer ): Integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_GlyphMetrics'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_GlyphMetrics} + +{ Get the dimensions of a rendered string of text } +function TTF_SizeText( font : PTTF_Font; const text : PChar; var w : integer; var y : integer ): Integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_SizeText'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_SizeText} + +function TTF_SizeUTF8( font : PTTF_Font; const text : PChar; var w : integer; var y : integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_SizeUTF8'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_SizeUTF8} + +function TTF_SizeUNICODE( font : PTTF_Font; const text : PUint16; var w : integer; var y : integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_SizeUNICODE'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_SizeUNICODE} + +{ Create an 8-bit palettized surface and render the given text at + fast quality with the given font and color. The 0 pixel is the + colorkey, giving a transparent background, and the 1 pixel is set + to the text color. + This function returns the new surface, or NULL if there was an error. +} +function TTF_RenderText_Solid( font : PTTF_Font; + const text : PChar; fg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderText_Solid'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderText_Solid} + +function TTF_RenderUTF8_Solid( font : PTTF_Font; + const text : PChar; fg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderUTF8_Solid'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderUTF8_Solid} + +function TTF_RenderUNICODE_Solid( font : PTTF_Font; + const text :PUint16; fg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderUNICODE_Solid'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderUNICODE_Solid} + +{ +Create an 8-bit palettized surface and render the given glyph at + fast quality with the given font and color. The 0 pixel is the + colorkey, giving a transparent background, and the 1 pixel is set + to the text color. The glyph is rendered without any padding or + centering in the X direction, and aligned normally in the Y direction. + This function returns the new surface, or NULL if there was an error. +} +function TTF_RenderGlyph_Solid( font : PTTF_Font; + ch : Uint16; fg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderGlyph_Solid'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderGlyph_Solid} + +{ Create an 8-bit palettized surface and render the given text at + high quality with the given font and colors. The 0 pixel is background, + while other pixels have varying degrees of the foreground color. + This function returns the new surface, or NULL if there was an error. +} +function TTF_RenderText_Shaded( font : PTTF_Font; + const text : PChar; fg : TSDL_Color; bg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderText_Shaded'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderText_Shaded} +function TTF_RenderUTF8_Shaded( font : PTTF_Font; + const text : PChar; fg : TSDL_Color; bg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderUTF8_Shaded'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderUTF8_Shaded} +function TTF_RenderUNICODE_Shaded( font : PTTF_Font; + const text : PUint16; fg : TSDL_Color; bg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderUNICODE_Shaded'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderUNICODE_Shaded} + +{ Create an 8-bit palettized surface and render the given glyph at + high quality with the given font and colors. The 0 pixel is background, + while other pixels have varying degrees of the foreground color. + The glyph is rendered without any padding or centering in the X + direction, and aligned normally in the Y direction. + This function returns the new surface, or NULL if there was an error. +} +function TTF_RenderGlyph_Shaded( font : PTTF_Font; ch : Uint16; fg : TSDL_Color; + bg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderGlyph_Shaded'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderGlyph_Shaded} + +{ Create a 32-bit ARGB surface and render the given text at high quality, + using alpha blending to dither the font with the given color. + This function returns the new surface, or NULL if there was an error. +} +function TTF_RenderText_Blended( font : PTTF_Font; + const text : PChar; fg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderText_Blended'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderText_Blended} +function TTF_RenderUTF8_Blended( font : PTTF_Font; + const text : PChar; fg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderUTF8_Blended'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderUTF8_Blended} +function TTF_RenderUNICODE_Blended( font : PTTF_Font; + const text: PUint16; fg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderUNICODE_Blended'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderUNICODE_Blended} + +{ Create a 32-bit ARGB surface and render the given glyph at high quality, + using alpha blending to dither the font with the given color. + The glyph is rendered without any padding or centering in the X + direction, and aligned normally in the Y direction. + This function returns the new surface, or NULL if there was an error. +} +function TTF_RenderGlyph_Blended( font : PTTF_Font; ch : Uint16; fg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderGlyph_Blended'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderGlyph_Blended} + +{ For compatibility with previous versions, here are the old functions } +{#define TTF_RenderText(font, text, fg, bg) + TTF_RenderText_Shaded(font, text, fg, bg) +#define TTF_RenderUTF8(font, text, fg, bg) + TTF_RenderUTF8_Shaded(font, text, fg, bg) +#define TTF_RenderUNICODE(font, text, fg, bg) + TTF_RenderUNICODE_Shaded(font, text, fg, bg)} + +{ Close an opened font file } +procedure TTF_CloseFont( font : PTTF_Font ); +cdecl; external {$IFDEF __GPC__}name 'TTF_CloseFont'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_CloseFont} + +//De-initialize TTF engine +procedure TTF_Quit; +cdecl; external {$IFDEF __GPC__}name 'TTF_Quit'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_Quit} + +// Check if the TTF engine is initialized +function TTF_WasInit : integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_WasInit'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_WasInit} + +// We'll use SDL for reporting errors +procedure TTF_SetError( fmt : PChar ); + +function TTF_GetError : PChar; + +implementation + +{$IFDEF __GPC__} + {$L 'sdl_ttf'} { link sdl_ttf.dll.a or libsdl_ttf.so or libsdl_ttf.a } +{$ENDIF} + +procedure SDL_TTF_VERSION( var X : TSDL_version ); +begin + X.major := SDL_TTF_MAJOR_VERSION; + X.minor := SDL_TTF_MINOR_VERSION; + X.patch := SDL_TTF_PATCHLEVEL; +end; + +procedure TTF_SetError( fmt : PChar ); +begin + SDL_SetError( fmt ); +end; + +function TTF_GetError : PChar; +begin + result := SDL_GetError; +end; + +end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL_ttf/Pas/sdltruetypefont.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL_ttf/Pas/sdltruetypefont.pas new file mode 100644 index 00000000..4b53ddd9 --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/SDL_ttf/Pas/sdltruetypefont.pas @@ -0,0 +1,437 @@ +unit sdltruetypefont; +{ + $Id: sdltruetypefont.pas,v 1.1 2004/09/30 22:39:50 savage Exp $ + +} +{******************************************************************************} +{ } +{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } +{ Wrapper class for SDL_ttf } +{ } +{ The initial developer of this Pascal code was : } +{ Dominqiue Louis } +{ } +{ Portions created by Dominqiue Louis are } +{ Copyright (C) 2000 - 2001 Dominqiue Louis. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ } +{ } +{ } +{ } +{ } +{ } +{ } +{ Requires } +{ -------- } +{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } +{ They are available from... } +{ http://www.libsdl.org . } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ September 23 2004 - DL : Initial Creation } +{ + $Log: sdltruetypefont.pas,v $ + Revision 1.1 2004/09/30 22:39:50 savage + Added a true type font class which contains a wrap text function. + Changed the sdl_ttf.pas header to reflect the future of jedi-sdl. + + +} +{******************************************************************************} + +interface + +uses + sdl, + sdl_ttf; + +type + TRenderType = ( rtLatin1, rtUTF8, rtUnicode ); + TSDLFontStyle = ( fsBold, fsItalic, fsUnderline, fsStrikeOut ); + + TSDLFontStyles = set of TSDLFontStyle; + + TTrueTypeFont = class( TObject ) + private + FFont : PTTF_Font; + FSolid : Boolean; + FBackGroundColour : TSDL_Color; + FForeGroundColour : TSDL_Color; + FRenderType : TRenderType; + FStyle : TSDLFontStyles; + FFontFile : string; + FFontSize : integer; + procedure PrepareFont; + protected + + public + constructor Create( aFontFile : string; aRenderStyle : TSDLFontStyles = [ ]; aFontSize : integer = 14 ); + destructor Destroy; override; + function DrawText( aText : WideString ) : PSDL_Surface; overload; + function DrawText( aText : WideString; aWidth, aHeight : Integer ) : PSDL_Surface; overload; + property BackGroundColour : TSDL_Color read FBackGroundColour write FBackGroundColour; + property ForeGroundColour : TSDL_Color read FForeGroundColour write FForeGroundColour; + property FontFile : string read FFontFile write FFontFile; + property RenderType : TRenderType read FRenderType write FRenderType; + property Solid : Boolean read FSolid write FSolid; + property Style : TSDLFontStyles read FStyle write FStyle; + property FontSize : integer read FFontSize write FFontSize; + end; + + +implementation + +uses + SysUtils; + +{ TTrueTypeFont } + +constructor TTrueTypeFont.Create( aFontFile : string; aRenderStyle : TSDLFontStyles; aFontSize : integer ); +begin + inherited Create; + if FileExists( aFontFile ) then + begin + FStyle := aRenderStyle; + FFontSize := aFontSize; + FSolid := false; + FBackGroundColour.r := 255; + FBackGroundColour.g := 255; + FBackGroundColour.b := 255; + FForeGroundColour.r := 0; + FForeGroundColour.g := 0; + FForeGroundColour.b := 0; + FRenderType := rtUTF8; + if ( TTF_Init >= 0 ) then + begin + FFontFile := aFontFile; + end + else + raise Exception.Create( 'Failed to Initialiase SDL_TTF' ); + end + else + raise Exception.Create( 'Font File does not exist' ); +end; + +destructor TTrueTypeFont.Destroy; +begin + if FFont <> nil then + TTF_CloseFont( FFont ); + TTF_Quit; + inherited; +end; + +function TTrueTypeFont.DrawText( aText : WideString ) : PSDL_Surface; +begin + PrepareFont; + + result := nil; + + case FRenderType of + rtLatin1 : + begin + if ( FSolid ) then + begin + result := TTF_RenderText_Solid( FFont, PChar( string( aText ) ), FForeGroundColour ); + end + else + begin + result := TTF_RenderText_Shaded( FFont, PChar( string( aText ) ), FForeGroundColour, FBackGroundColour ); + end; + end; + + rtUTF8 : + begin + if ( FSolid ) then + begin + result := TTF_RenderUTF8_Solid( FFont, PChar( string( aText ) ), FForeGroundColour ); + end + else + begin + result := TTF_RenderUTF8_Shaded( FFont, PChar( string( aText ) ), FForeGroundColour, FBackGroundColour ); + end; + end; + + rtUnicode : + begin + if ( FSolid ) then + begin + result := TTF_RenderUNICODE_Solid( FFont, PUInt16( aText ), FForeGroundColour ); + end + else + begin + result := TTF_RenderUNICODE_Shaded( FFont, PUInt16( aText ), FForeGroundColour, FBackGroundColour ); + end; + end; + end; +end; + +function TTrueTypeFont.DrawText( aText : WideString; aWidth, aHeight : Integer ) : PSDL_Surface; +var + textw, texth, i, yPos : integer; + strChopped : WideString; + SurfaceList : array of PSDL_Surface; + strlist : array of WideString; + ReturnedSurface : PSDL_Surface; + BltRect : TSDL_Rect; +begin + PrepareFont; + + // Do an initial check to see if it already fits + case FRenderType of + rtLatin1 : + begin + if TTF_SizeText( FFont, PChar( string( aText ) ), textw, texth ) = 0 then + begin + if ( textw < aWidth ) + and ( texth < aHeight ) then + begin + result := DrawText( aText ); + exit; + end + end; + end; + + rtUTF8 : + begin + if TTF_SizeUTF8( FFont, PChar( string( aText ) ), textw, texth ) = 0 then + begin + if ( textw < aWidth ) + and ( texth < aHeight ) then + begin + result := DrawText( aText ); + exit; + end + end; + end; + + rtUnicode : + begin + if TTF_SizeUNICODE( FFont, PUInt16( aText ), textw, texth ) = 0 then + begin + if ( textw < aWidth ) + and ( texth < aHeight ) then + begin + result := DrawText( aText ); + exit; + end + end; + end; + end; + + // Create the Surface we will be returning + ReturnedSurface := SDL_DisplayFormat( SDL_CreateRGBSurface( SDL_SRCCOLORKEY or SDL_RLEACCEL or SDL_HWACCEL, aWidth, aHeight, 16, 0, 0, 0, 0 ) ); + + // If we are still here there is some serious parsing to do + case FRenderType of + rtLatin1 : + begin + strChopped := aText; + i := Length( strChopped ); + while ( i <> 0 ) do + begin + if ( string( strChopped[ i ] ) <> ' ' ) and ( Integer( string( strChopped[ i ] ) ) <> 13 ) then + dec( i ) + else + begin + dec( i ); + strChopped := Copy( strChopped, 0, i ); + if TTF_SizeText( FFont, PChar( string( strChopped ) ), textw, texth ) = 0 then + begin + if ( textw < aWidth ) + and ( texth < aHeight ) then + begin + SetLength( strlist, Length( strlist ) + 1 ); + strlist[ Length( strlist ) - 1 ] := strChopped; + strChopped := Copy( aText, i + 2, Length( aText ) - ( i - 1 ) ); + i := Length( strChopped ); + if TTF_SizeText( FFont, PChar( string( strChopped ) ), textw, texth ) = 0 then + begin + SetLength( strlist, Length( strlist ) + 1 ); + strlist[ Length( strlist ) - 1 ] := strChopped; + break; + end; + end; + end; + end; + end; + SetLength( SurfaceList, Length( strlist ) ); + for i := Low( strlist ) to High( strlist ) do + begin + if ( FSolid ) then + begin + SurfaceList[ i ] := TTF_RenderText_Solid( FFont, PChar( string( strlist[ i ] ) ), FForeGroundColour ); + end + else + begin + SurfaceList[ i ] := TTF_RenderText_Shaded( FFont, PChar( string( strlist[ i ] ) ), FForeGroundColour, FBackGroundColour ); + end; + end; + end; + + rtUTF8 : + begin + strChopped := aText; + i := Length( strChopped ); + while ( i <> 0 ) do + begin + if ( string( strChopped[ i ] ) <> ' ' ) and ( Integer( string( strChopped[ i ] ) ) <> 13 ) then + dec( i ) + else + begin + dec( i ); + strChopped := Copy( strChopped, 0, i ); + if TTF_SizeUTF8( FFont, PChar( string( strChopped ) ), textw, texth ) = 0 then + begin + if ( textw < aWidth ) + and ( texth < aHeight ) then + begin + SetLength( strlist, Length( strlist ) + 1 ); + strlist[ Length( strlist ) - 1 ] := strChopped; + strChopped := Copy( aText, i + 2, Length( aText ) - ( i - 1 ) ); + i := Length( strChopped ); + if TTF_SizeUTF8( FFont, PChar( string( strChopped ) ), textw, texth ) = 0 then + begin + SetLength( strlist, Length( strlist ) + 1 ); + strlist[ Length( strlist ) - 1 ] := strChopped; + break; + end; + end; + end; + end; + end; + SetLength( SurfaceList, Length( strlist ) ); + for i := Low( strlist ) to High( strlist ) do + begin + if ( FSolid ) then + begin + SurfaceList[ i ] := TTF_RenderUTF8_Solid( FFont, PChar( string( strlist[ i ] ) ), FForeGroundColour ); + end + else + begin + SurfaceList[ i ] := TTF_RenderUTF8_Shaded( FFont, PChar( string( strlist[ i ] ) ), FForeGroundColour, FBackGroundColour ); + end; + end; + end; + + rtUnicode : + begin + strChopped := aText; + i := Length( strChopped ); + while ( i <> 0 ) do + begin + if ( string( strChopped[ i ] ) <> ' ' ) and ( Integer( string( strChopped[ i ] ) ) <> 13 ) then + dec( i ) + else + begin + dec( i ); + strChopped := Copy( strChopped, 0, i ); + if TTF_SizeUNICODE( FFont, PUInt16( strChopped ), textw, texth ) = 0 then + begin + if ( textw < aWidth ) + and ( texth < aHeight ) then + begin + SetLength( strlist, Length( strlist ) + 1 ); + strlist[ Length( strlist ) - 1 ] := strChopped; + strChopped := Copy( aText, i + 2, Length( aText ) - ( i - 1 ) ); + i := Length( strChopped ); + if TTF_SizeUNICODE( FFont, PUInt16( strChopped ), textw, texth ) = 0 then + begin + SetLength( strlist, Length( strlist ) + 1 ); + strlist[ Length( strlist ) - 1 ] := strChopped; + break; + end; + end; + end; + end; + end; + SetLength( SurfaceList, Length( strlist ) ); + for i := Low( strlist ) to High( strlist ) do + begin + if ( FSolid ) then + begin + SurfaceList[ i ] := TTF_RenderUNICODE_Solid( FFont, PUInt16( strlist[ i ] ), FForeGroundColour ); + end + else + begin + SurfaceList[ i ] := TTF_RenderUNICODE_Shaded( FFont, PUInt16( strlist[ i ] ), FForeGroundColour, FBackGroundColour ); + end; + end; + end; + end; + + // Now Draw the SurfaceList onto the resulting Surface + yPos := 6; + for i := Low( SurfaceList ) to High( SurfaceList ) do + begin + BltRect.x := 6; + BltRect.y := yPos; + BltRect.w := SurfaceList[ i ].w; + BltRect.h := SurfaceList[ i ].h; + SDL_BlitSurface( SurfaceList[ i ], nil, ReturnedSurface, @BltRect ); + yPos := yPos + TTF_FontHeight( FFont ); + end; + result := ReturnedSurface; + + for i := Low( SurfaceList ) to High( SurfaceList ) do + begin + SDL_FreeSurface( SurfaceList[ i ] ); + end; + SetLength( SurfaceList, 0 ); + SetLength( strlist, 0 ); +end; + +procedure TTrueTypeFont.PrepareFont; +var + renderstyle : integer; +begin + if FFont <> nil then + TTF_CloseFont( FFont ); + + FFont := TTF_OpenFont( PChar( FFontFile ), FFontSize ); + + renderstyle := TTF_STYLE_NORMAL; + if ( fsBold in FStyle ) then + renderstyle := renderstyle or TTF_STYLE_BOLD; + + if ( fsItalic in FStyle ) then + renderstyle := renderstyle or TTF_STYLE_ITALIC; + + if ( fsUnderline in FStyle ) then + renderstyle := renderstyle or TTF_STYLE_UNDERLINE; + + TTF_SetFontStyle( FFont, renderstyle ); +end; + +end. + diff --git a/Game/Code/lib/JEDI-SDLv1.0/fpc-install.sh b/Game/Code/lib/JEDI-SDLv1.0/fpc-install.sh new file mode 100644 index 00000000..ea6c4928 --- /dev/null +++ b/Game/Code/lib/JEDI-SDLv1.0/fpc-install.sh @@ -0,0 +1,252 @@ +#!/bin/sh +# +# FreePascal & Delphi Installation script for JEDI-SDL +# portions of which are based on the FreePascal install script +# Copyright 1996-2002 Michael Van Canneyt and Peter Vreman +# +# Copyright (c)2004-2100, JEDI-SDL Team +# All Rights Reserved +# +# Don NOT edit this file. +# Everything should be configuration while the script is running. +# +############################################################################ + +# Release Version +VERSION=1.0 + +# some useful functions +# ask displays 1st parameter, and ask new value for variable, whose name is +# in the second parameter. +ask () +{ +askvar=$2 +eval old=\$$askvar +eval echo -n \""$1 [$old] : "\" +read $askvar +eval test -z \"\$$askvar\" && eval $askvar=\'$old\' +} +# yesno gives 1 on no, 0 on yes $1 gives text to display. +yesno () +{ + while true; do + echo -n "$1 (Y/n) ? " + read ans + case X$ans in + X|Xy|XY) return 0;; + Xn|XN) return 1;; + esac + done +} + +# Untar files ($3,optional) from file ($1) to the given directory ($2) +unztar () +{ + tar -xzf $HERE/$1 --directory $2 $3 +} + +# Untar tar.gz file ($2) from file ($1) and untar result to the given directory ($3) +unztarfromtar () +{ + tar -xOf $HERE/$1 $2 | tar --directory $3 -xzf - +} +# Get file list from tar archive ($1) in variable ($2) +# optionally filter result through sed ($3) +listtarfiles () +{ + askvar=$2 + if [ ! -z $3 ]; then + list=`tar tvf $1 | awk '{ print $(NF) }' | sed -n /$3/p` + else + list=`tar tvf $1 | awk '{ print $(NF) }'` + fi + eval $askvar='$list' +} +# Make all the necessary directories to get $1 +makedirhierarch () +{ + OLDDIR=`pwd` + case $1 in + /*) cd /;; + esac + OLDIFS=$IFS;IFS=/;eval set $1; IFS=$OLDIFS + for i + do + test -d $i || mkdir $i || break + cd $i ||break + done + cd $OLDDIR +} + +# check to see if something is in the path +checkpath () +{ + ARG=$1 + OLDIFS=$IFS; IFS=":";eval set $PATH;IFS=$OLDIFS + for i + do + if [ $i = $ARG ]; then + return 0 + fi + done + return 1 +} + +# -------------------------------------------------------------------------- +# welcome message. +# + +clear +echo "This shell script will attempt to install the Free Pascal Compiler" +echo "version $VERSION with the items you select" +echo + +# Here we start the thing. +HERE=`pwd` + +# Install in /usr/local or /usr ? +if checkpath /usr/local/bin; then + PREFIX=/usr/local +else + PREFIX=/usr +fi +# If we can't write on prefix, select subdir of home dir +if [ ! -w $PREFIX ]; then + PREFIX=$HOME/JEDI-SDLv$VERSION +fi +ask "Install prefix (/usr or /usr/local) " PREFIX +makedirhierarch $PREFIX + +# Set some defaults. +LIBDIR=$PREFIX/lib/JEDI-SDL/$VERSION +SRCDIR=$PREFIX/src/JEDI-SDLv$VERSION +EXECDIR=$PREFIX/bin +OSNAME=`uname -s | tr A-Z a-z` + +BSDHIER=0 +case $OSNAME in +*bsd) + BSDHIER=1;; +esac + + +if [ "${BSDHIER}" = "1" ]; then +DOCDIR=$PREFIX/share/doc/JEDI-SDLv$VERSION +else +DOCDIR=$PREFIX/doc/JEDI-SDLv$VERSION +fi + +echo $DOCDIR + +DEMODIR=$PREFIX/demos + +# Install SDL headers +if yesno "Install SDL headers"; then + +fi + +# Install SDL_image headers +if yesno "Install SDL_image headers"; then + +fi + +# Install compiler/RTL. Mandatory. +echo Installing compiler and RTL ... +unztarfromtar binary.tar base${OSNAME}.tar.gz $PREFIX +rm -f $EXECDIR/ppc386 +ln -sf $LIBDIR/ppc386 $EXECDIR/ppc386 +echo Installing utilities... +unztarfromtar binary.tar util${OSNAME}.tar.gz $PREFIX +if yesno "Install FCL"; then + unztarfromtar binary.tar unitsfcl${OSNAME}.tar.gz $PREFIX +fi +if yesno "Install packages"; then + listtarfiles binary.tar packages units + for f in $packages + do + if [ $f != unitsfcl${OSNAME}.tar.gz ]; then + basename $f .tar.gz |\ + sed -e s/units// -e s/${OSNAME}// |\ + xargs echo Installing + unztarfromtar binary.tar $f $PREFIX + fi + done +fi +rm -f *${OSNAME}.tar.gz +echo Done. +echo + +# Install the sources. Optional. +if yesno "Install sources"; then + echo Installing sources in $SRCDIR ... + unztarfromtar sources.tar basesrc.tar.gz $PREFIX + if yesno "Install compiler source"; then + unztarfromtar sources.tar compilersrc.tar.gz $PREFIX + fi + if yesno "Install RTL source"; then + unztarfromtar sources.tar rtlsrc.tar.gz $PREFIX + fi + if yesno "Install FCL source"; then + unztarfromtar sources.tar fclsrc.tar.gz $PREFIX + fi + if yesno "Install IDE source"; then + unztarfromtar sources.tar idesrc.tar.gz $PREFIX + fi + if yesno "Install installer source"; then + unztarfromtar sources.tar installersrc.tar.gz $PREFIX + fi + if yesno "Install Packages source"; then + listtarfiles sources.tar packages units + for f in $packages + do + basename $f .tar.gz |\ + sed -e s/units// -e s/src// |\ + xargs echo Installing sources for + unztarfromtar sources.tar $f $PREFIX + done + fi + # rm -f *src.tar.gz + echo Done. +fi +echo + +# Install the documentation. Optional. +if yesno "Install documentation"; then + echo Installing documentation in $DOCDIR ... + unztar docs.tar.gz $DOCDIR + echo Done. +fi +echo + +# Install the demos. Optional. +if yesno "Install demos"; then + ask "Install demos in" DEMODIR + echo Installing demos in $DEMODIR ... + makedirhierarch $DEMODIR + unztar demo.tar.gz $DEMODIR + echo Done. +fi +echo + +# update fpc.cfg file +if yesno "Update fpc.cfg file automagically"; then + echo Updating fpc.cfg in $DOCDIR ... + echo + echo Done. +fi + +# update Borland IDE file +if yesno "Update the Kylix IDE automagically"; then + echo Updating the Kylix IDE in $DOCDIR ... + echo + echo Done. +fi + +$LIBDIR/samplecfg $LIBDIR + +# The End +echo +echo End of installation. +echo +echo Refer to the documentation for more information. +echo \ No newline at end of file diff --git a/Game/Code/lib/JEDI-SDLv1.0/placeholder.txt b/Game/Code/lib/JEDI-SDLv1.0/placeholder.txt deleted file mode 100644 index d4073d15..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/placeholder.txt +++ /dev/null @@ -1,4 +0,0 @@ -grab Jedi-sdl from : - http://sourceforge.net/projects/jedi-sdl - -and extract in this directory !! \ No newline at end of file -- cgit v1.2.3 From 1cec357365c6260da0667966460387aaffa76436 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 5 Feb 2008 11:27:22 +0000 Subject: renamed Jedi-SDL folder. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@810 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.dpr | 12 +- Game/Code/lib/JEDI-SDL/JEDI-SDL-README.txt | 242 + Game/Code/lib/JEDI-SDL/OpenGL/Pas/geometry.pas | 1994 ++++ Game/Code/lib/JEDI-SDL/OpenGL/Pas/gl.pas | 2294 +++++ Game/Code/lib/JEDI-SDL/OpenGL/Pas/glext.pas | 8527 +++++++++++++++++ Game/Code/lib/JEDI-SDL/OpenGL/Pas/glu.pas | 563 ++ Game/Code/lib/JEDI-SDL/OpenGL/Pas/glut.pas | 682 ++ Game/Code/lib/JEDI-SDL/OpenGL/Pas/glx.pas | 276 + Game/Code/lib/JEDI-SDL/OpenGL/Pas/opengl12.pas | 9967 ++++++++++++++++++++ Game/Code/lib/JEDI-SDL/OpenGL/Pas/opengl12.rst | 26 + Game/Code/lib/JEDI-SDL/SDL/Pas/Readme.txt | 27 + Game/Code/lib/JEDI-SDL/SDL/Pas/jedi-sdl.inc | 337 + Game/Code/lib/JEDI-SDL/SDL/Pas/libxmlparser.pas | 2690 ++++++ Game/Code/lib/JEDI-SDL/SDL/Pas/logger.pas | 176 + Game/Code/lib/JEDI-SDL/SDL/Pas/moduleloader.pas | 319 + .../JEDI-SDL/SDL/Pas/registryuserpreferences.pas | 229 + Game/Code/lib/JEDI-SDL/SDL/Pas/sdl.pas | 4118 ++++++++ Game/Code/lib/JEDI-SDL/SDL/Pas/sdl_cpuinfo.pas | 155 + .../Code/lib/JEDI-SDL/SDL/Pas/sdlgameinterface.pas | 195 + Game/Code/lib/JEDI-SDL/SDL/Pas/sdli386utils.pas | 5236 ++++++++++ Game/Code/lib/JEDI-SDL/SDL/Pas/sdlinput.pas | 692 ++ Game/Code/lib/JEDI-SDL/SDL/Pas/sdlstreams.pas | 216 + Game/Code/lib/JEDI-SDL/SDL/Pas/sdlticks.pas | 196 + Game/Code/lib/JEDI-SDL/SDL/Pas/sdlutils.pas | 4256 +++++++++ Game/Code/lib/JEDI-SDL/SDL/Pas/sdlwindow.pas | 564 ++ Game/Code/lib/JEDI-SDL/SDL/Pas/userpreferences.pas | 159 + Game/Code/lib/JEDI-SDL/SDL_Image/Pas/sdl_image.pas | 287 + Game/Code/lib/JEDI-SDL/SDL_ttf/Pas/sdl_ttf.pas | 451 + .../lib/JEDI-SDL/SDL_ttf/Pas/sdltruetypefont.pas | 437 + Game/Code/lib/JEDI-SDL/fpc-install.sh | 252 + Game/Code/lib/JEDI-SDLv1.0/JEDI-SDL-README.txt | 242 - Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/geometry.pas | 1994 ---- Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/gl.pas | 2294 ----- Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glext.pas | 8527 ----------------- Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glu.pas | 563 -- Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glut.pas | 682 -- Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glx.pas | 276 - Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/opengl12.pas | 9967 -------------------- Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/opengl12.rst | 26 - Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/Readme.txt | 27 - Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/jedi-sdl.inc | 337 - .../Code/lib/JEDI-SDLv1.0/SDL/Pas/libxmlparser.pas | 2690 ------ Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/logger.pas | 176 - .../Code/lib/JEDI-SDLv1.0/SDL/Pas/moduleloader.pas | 319 - .../SDL/Pas/registryuserpreferences.pas | 229 - Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdl.pas | 4118 -------- Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdl_cpuinfo.pas | 155 - .../lib/JEDI-SDLv1.0/SDL/Pas/sdlgameinterface.pas | 195 - .../Code/lib/JEDI-SDLv1.0/SDL/Pas/sdli386utils.pas | 5236 ---------- Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlinput.pas | 692 -- Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlstreams.pas | 216 - Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlticks.pas | 196 - Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlutils.pas | 4256 --------- Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlwindow.pas | 564 -- .../lib/JEDI-SDLv1.0/SDL/Pas/userpreferences.pas | 159 - .../lib/JEDI-SDLv1.0/SDL_Image/Pas/sdl_image.pas | 287 - Game/Code/lib/JEDI-SDLv1.0/SDL_ttf/Pas/sdl_ttf.pas | 451 - .../JEDI-SDLv1.0/SDL_ttf/Pas/sdltruetypefont.pas | 437 - Game/Code/lib/JEDI-SDLv1.0/fpc-install.sh | 252 - 59 files changed, 45569 insertions(+), 45569 deletions(-) create mode 100644 Game/Code/lib/JEDI-SDL/JEDI-SDL-README.txt create mode 100644 Game/Code/lib/JEDI-SDL/OpenGL/Pas/geometry.pas create mode 100644 Game/Code/lib/JEDI-SDL/OpenGL/Pas/gl.pas create mode 100644 Game/Code/lib/JEDI-SDL/OpenGL/Pas/glext.pas create mode 100644 Game/Code/lib/JEDI-SDL/OpenGL/Pas/glu.pas create mode 100644 Game/Code/lib/JEDI-SDL/OpenGL/Pas/glut.pas create mode 100644 Game/Code/lib/JEDI-SDL/OpenGL/Pas/glx.pas create mode 100644 Game/Code/lib/JEDI-SDL/OpenGL/Pas/opengl12.pas create mode 100644 Game/Code/lib/JEDI-SDL/OpenGL/Pas/opengl12.rst create mode 100644 Game/Code/lib/JEDI-SDL/SDL/Pas/Readme.txt create mode 100644 Game/Code/lib/JEDI-SDL/SDL/Pas/jedi-sdl.inc create mode 100644 Game/Code/lib/JEDI-SDL/SDL/Pas/libxmlparser.pas create mode 100644 Game/Code/lib/JEDI-SDL/SDL/Pas/logger.pas create mode 100644 Game/Code/lib/JEDI-SDL/SDL/Pas/moduleloader.pas create mode 100644 Game/Code/lib/JEDI-SDL/SDL/Pas/registryuserpreferences.pas create mode 100644 Game/Code/lib/JEDI-SDL/SDL/Pas/sdl.pas create mode 100644 Game/Code/lib/JEDI-SDL/SDL/Pas/sdl_cpuinfo.pas create mode 100644 Game/Code/lib/JEDI-SDL/SDL/Pas/sdlgameinterface.pas create mode 100644 Game/Code/lib/JEDI-SDL/SDL/Pas/sdli386utils.pas create mode 100644 Game/Code/lib/JEDI-SDL/SDL/Pas/sdlinput.pas create mode 100644 Game/Code/lib/JEDI-SDL/SDL/Pas/sdlstreams.pas create mode 100644 Game/Code/lib/JEDI-SDL/SDL/Pas/sdlticks.pas create mode 100644 Game/Code/lib/JEDI-SDL/SDL/Pas/sdlutils.pas create mode 100644 Game/Code/lib/JEDI-SDL/SDL/Pas/sdlwindow.pas create mode 100644 Game/Code/lib/JEDI-SDL/SDL/Pas/userpreferences.pas create mode 100644 Game/Code/lib/JEDI-SDL/SDL_Image/Pas/sdl_image.pas create mode 100644 Game/Code/lib/JEDI-SDL/SDL_ttf/Pas/sdl_ttf.pas create mode 100644 Game/Code/lib/JEDI-SDL/SDL_ttf/Pas/sdltruetypefont.pas create mode 100644 Game/Code/lib/JEDI-SDL/fpc-install.sh delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/JEDI-SDL-README.txt delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/geometry.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/gl.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glext.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glu.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glut.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glx.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/opengl12.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/opengl12.rst delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/Readme.txt delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/jedi-sdl.inc delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/libxmlparser.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/logger.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/moduleloader.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/registryuserpreferences.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdl.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdl_cpuinfo.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlgameinterface.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdli386utils.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlinput.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlstreams.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlticks.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlutils.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlwindow.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/userpreferences.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL_Image/Pas/sdl_image.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL_ttf/Pas/sdl_ttf.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/SDL_ttf/Pas/sdltruetypefont.pas delete mode 100644 Game/Code/lib/JEDI-SDLv1.0/fpc-install.sh (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index ca639d1e..e2242d1b 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -11,12 +11,12 @@ uses //------------------------------ //Includes - 3rd Party Libraries //------------------------------ - moduleloader in 'lib\JEDI-SDLv1.0\SDL\Pas\moduleloader.pas', - opengl12 in 'lib\JEDI-SDLv1.0\OpenGL\Pas\opengl12.pas', - sdl in 'lib\JEDI-SDLv1.0\SDL\Pas\sdl.pas', - sdl_image in 'lib\JEDI-SDLv1.0\SDL_Image\Pas\sdl_image.pas', - sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', - sdlutils in 'lib\JEDI-SDLv1.0\SDL\Pas\sdlutils.pas', + moduleloader in 'lib\JEDI-SDL\SDL\Pas\moduleloader.pas', + opengl12 in 'lib\JEDI-SDL\OpenGL\Pas\opengl12.pas', + sdl in 'lib\JEDI-SDL\SDL\Pas\sdl.pas', + sdl_image in 'lib\JEDI-SDL\SDL_Image\Pas\sdl_image.pas', + sdl_ttf in 'lib\JEDI-SDL\SDL_ttf\Pas\sdl_ttf.pas', + sdlutils in 'lib\JEDI-SDL\SDL\Pas\sdlutils.pas', {$ifdef UseBass} bass in 'lib\bass\delphi\bass.pas', diff --git a/Game/Code/lib/JEDI-SDL/JEDI-SDL-README.txt b/Game/Code/lib/JEDI-SDL/JEDI-SDL-README.txt new file mode 100644 index 00000000..968c5311 --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/JEDI-SDL-README.txt @@ -0,0 +1,242 @@ +This is the based on the SDL ( http://www.libsdl.org ) headers, and has been converted, comments and all, to the Pascal unit called sdl.pas. +Other conversions that have also been done are SDL_Mixer.h, SDL_Net.h, SDL_Image.h, SDL_ttf, SMPEG.h, SDL_sound and the SFont library, +which are all included in this distribution. + +It allows you to access all the functions within the SDL libraries under Windows, Linux and FreeBSD, so you can write cross-platform games or multimedia applications. + +Installation Instructions +------------------------- +Windows - We now have a semi-automated setup under Windows ( thanks to David House and the Jedi JCL team ). + Once you have extracted the zip file, simply double click on the "JEDISDLWin32Installer.exe" to have the correct paths added to your respective + IDEs. All IDEs from Delphi 4 - 7 are supported and it also adds a link to the .CHM help file under the Tools menu. + +Linux - Alternatively if you use Linux or want to to manually install the paths, then make sure you read the "Getting Started.html" file ( ideal for those who are new to JEDI-SDL ) and is now included as a guide to help getting everything setup for smooth compilation. + +Also included is a guide of how to use Sourceforge using TortoiseCVS under Windows ( Linux guide is under development ). +Both documents can be found in the "documentation" directory. + + +Release History +--------------- +1.0 : Yeah!! The Official v1.0 Release of JEDI-SDL!! + JEDI-SDL now updated to SDL v1.2.8, SDL_Image v1.2.4, SDL_Mixer v1.2.6, SDL_Net v1.2.1 & SDL_ttf v2.0.7 + Added Improved FreePascal, TMT Pascal and GnuPascal support as well as maintaining Delphi/Kylix support. + Fixed Various bugs as pointed out on the JEDI-SDL mailing list. + Added SDL_GL_STEREO, SDL_GL_MULTISAMPLEBUFFERS, SDL_GL_MULTISAMPLESAMPLES + +// DLL/Shared object functions +function SDL_LoadObject( const sofile : PChar ) : Pointer; + +function SDL_LoadFunction( handle : Pointer; const name : PChar ) : Pointer; + +procedure SDL_UnloadObject( handle : Pointer ); + +//Added function to create RWops from const memory: SDL_RWFromConstMem() +function SDL_RWFromConstMem(const mem: Pointer; size: Integer) : PSDL_RWops; + +//Added support for environment variables SDL_VIDEO_WINDOW_POS and SDL_VIDEO_CENTERED on Windows + + New Units : + ----------- + sdl_cpuinfo.pas - ported SDL_cpuinfo.h so Now you can test for Specific CPU types. + sdlinput.pas - Input wrapper class + sdlwindow.pas - Window wrapper class + sdltruetypefont.pas - True Type Font wrapper class + tcputils.pas - SDL_Net utility functions + sdlweb.pas - SDL_Net Web class + sdlwebhttp.pas - SDL_Net http protocol wrapper class + sdlwebftp.pas - SDL_Net ftp protocol wrapper class + + New 2D Demos : + -------------- + + + New 3D Demos : + -------------- + + + Other New Stuff : + ----------------- + + + +0.5 : The JEDI-SDL project is now also set up on Sourceforge ( http://sf.net/projects/jedi-sdl/ ) so the latest code is available from there. + Improved FreePascal support has been added. + Various bug fixes as pointed out on the JEDI-SDL mailing list. + SDL_Mixer has been updated to version 1.2.1 and includes an Effects API. + Demo directories are now split into 2D and 3D related sub-directories. + There are now both Kylix ( K prefix ) and Delphi ( D prefix ) project groups for all the demos. + They can be found in Demos and the 2D and 3D directories. + + New Units + --------- + SDLStreams.pas - Chris Bruner has created a wrapper that uses Streams to load BMPs + SDLUtils.pas - Pascal only version of some Utility functions + SDLi386Utils.pas - Intel Assembler versions of the SDLUtils.pas functions. + SDL_ttf.pas - Port of the SDL True Type font support unit. + SDL_Sound.pas - Port of the SDL Sound library ( untested ). + + New 2D Demos : + -------------- + Pan and Zoom Demo - How to Pan and Zoom an SDL surface. + Isometric Demo - I ported my old DelphiX isometric demo over to SDL. + TestTimer demo - Shows hows how to use AddTimer and RemoveTimer. + MpegPlayer - I have updated and improved Anders Ohlsson's CLX MPegPlayer and component and it now works + and installs into D4, D5, D6, D7, K1, K2 & K3. + Showfont - Demo to show how to us SDL_ttf.dll + SmpegPlayer - is a console MPEG player that use smpeg and SDL_Mixer + + New 3D Demos : + -------------- + DeathTruckTion 1.1 - A slightly updated version of this fully functional 3D network game. + TerrainDemo - Terrain demo ported from the book "OpenGL Game programming" by Hawkins and Astle. + TestGL - the standard SDL/OpenGL Test demo. Shows how to mix 2D and 3D rendering using OpenGL. + glfont - Demo to show how to us SDL_ttf with OpenGL. + Particle Engine - Ariel's OpenGL Particle Engine. + Picking - Phil Freeman's Picking Demo + Motion Blur - Phil Freeman's Motion Blur Demo + Dynamic Light - Phil Freeman's Dynamic Light Demo + Environment Map - Phil Freeman's Environment Map Demo + GLMovie - is an MPEG Player that uses OpenGL to render the movie. + NeHe - Quite a few more NeHe demos are now included. + + New Network Demos : + ------------------- + There are now 3 SDL_Net Server demos and 4 SDL_Client demos as submitted by Dean Ellis. + + +Beta 4 : The JEDI-SDL home page is now located @ http://www.delphi-jedi.org/Jedi:TEAM_SDL_HOME + All Demos ( including OpenGL Demos ) now compile under both Kylix and Delphi. + I have added quite a few more OpenGL examples, we are now up to Nehe tutorial 12. + All OpenGL demos also show how to handle Window resizing. + Included an OpenGL demo called Puntos by Gustavo Maximo. + Ported Jan Horn's OpenGL MetaBalls and also SkyBox demo to SDL. + Ported Ilkka Tuomioja's OpenGL Quake 2 Model Viewer/Animator to SDL. + NOTE : All OpenGL demos require OpenGL12.pas which can be found at... + http://www.lischke-online.de/Graphics.html#OpenGL12 + I also fixed a conversion bug to do with SDL_MustLock and also a conversion omission to do with various events. + Fixed a conversion bug with SDL_CDOpen ( as suggested on the mailing list ). + Added the GetPixel and PuxPixel functions to the SDLUtils.pas file. + Jason Farmer has donated SFont, a simple, yet effective Font library he converted for JEDI-SDL. + It contains 4 Demos show how to best use it. + Added TUInt8Array and PUIntArray to SDL.pas after suggestions from Matthias Thoma and Eric Grange. + In the file area of the JEDI-SDL mailing list ( http://groups.yahoo.com/group/JEDI-SDL/files/DTTSrc/ there + is a fully functional 3D network game called DeathTruckTion v1.0 written by the TNTeam that makes use of + JEDI-SDL and is just too big to include with this distribution but is well worth looking at as it works under Windows and Linux! + Gustavo Maxima is working on translating the JEDI-SDL Documentation to Spanish and Portugese. + The Mouse Demo has now been speeded up considerably and it is very responsive now. + Dean Ellis will provide steps on how to compile the demos using the Free Pascal compiler. + Jason Farmer and I are working on a series of Tutorials that should hopefully be out soon. + David Aclan has donated a SMpeg component that should work under Kylix. + Róbert Kisnémeth, has been hard at work, and has donated some new demos he has created with a SpriteEngine ( which he also donated ). + He has also donated a couple of games called BlitzBomber and Oxygene ( which uses the SpriteEngine ) and added a couple of useful + functions to SDLUtils.pas. + The Functions added are SDL_FlipV, SDL_FlipH, SDL_NewPutPixel ( assembler version ), SDL_AddPixel, SDL_SubPixel, SDL_DrawLine, SDL_AddLine, + SDL_SubLine, SDL_AddSurface, SDL_SubSurface, SDL_MonoSurface & SDL_TexturedSurface. + He has also donated a Font Blitting class and demo called SDL_MonoFonts which supports alignment like Left, Right and Center. + He and Thomas are also working on a GUI library. + Jason Farmer has donated a set of Image Filtering functions which add quite a few interesting effects. Check the SDL_Filter sub-directory for more + info. + Christian Hackbart also donated an OpenGL BlockOut clone. + + +Beta 3 : I have added conversions for SDL_env.h, SDL_Mixer.h and SDL_Net.h while Matthias Thoma has added conversions for SDL_Image.h and SMPEG.h. + This version is also SDL version 1.2.0 compliant. + This release also adds demos for the SDL_Image, SDL_Mixer and SDL_Net libraries. + There are now also some OpenGL demos that make some use of SDL as well as a demo on how to use the Mouse with Clickable regions. + A conversion bug, that was pointed out by Clem Vasseur, has also been fixed. + There is now a mailing list that has been set up at http://groups.yahoo.com/group/JEDI-SDL/join/ so we can all learn from each other how to use + these libraries. + Demos have not been unified into single .dpr files for each demo, thus showing how you would write a crossplatform game using only 1 .dpr file. + There is also a documentation directory that is currently in HTML format. All code examples in the documentation have been converted to Object + Pascal but are untested. + I Also fixed a few conversion bugs which I came across while converting the documentation. + +Beta 2 : I have added conversions for SDL_active.h, SDL_thread.h, SDL_mutex.h and + SDL_error.h, Matthias Thoma has added Linux Support and JEDI compliancy so these + units and examples are now x-platform and x-compiler compilable. + I also added Tom Jones' SDLUtils.pas file; + Matthias also cleaned up the 2 new demos and made them work on both Linux and + Windows. + +Beta 1 : Initial Release; + + +There are now 5 examples included with this JEDI-SDL distribution. +1. Is the TestWin application, which is based on the testwin application that comes with the SDL SDK, only my version has a gui front end to the options available and has been compiled under Delphi 4.03. It should be compatible with Delphi 3.0 onwards ( though Delphi 2 compatibility has not been tested ). + +2. A Plasma example which was converted from one found on the Demos page of the SDL site. + +3. A Voxel terrain following demo, which was converted from one found on the Demos page of the SDL site. This one should be of interest to others as it shows how to handle keyboard events when using SDL. + +4. A Mouse handling demo that shows how to use transparency and clickable regions. + +5. A Space Invaders style game called Aliens which shows the use of SDL, SDL_Image and SDL_Mixer. This game shows how to handle sound, keyboards and some basic collision detection. It is a conversion of one found on the SDL Demos page. + +There are also 14 OpenGL demos that are based on the NeHe tutorials . The other 3 OpenGL demos are Jan Horns' OpenGL demo, A Quake 2 Model viewer that I ported and a Demo by Gustavo Maxima called Puntos. + +If writing your own, just make sure that the SDL.pas file is in your projects path for compiling and that the SDL.dll file is in your path when running the compiled app. + +Please test these units and report problems to the JEDI-SDL mailing list @ http://groups.yahoo.com/group/JEDI-SDL/ outlining steps under which the error occurred. If you convert any more demos please send them to me so that I can +include them in the ditribution for others to learn from. + +Also if you are using these Units to write any games +please let me know about it so that I can post the information to the http://www.DelphiGamer.com site. + +The plan is to have this unit JEDI certified at some point so that it can be included on the Delphi and Kylix CDs, so all feedback is greatly welcomed. + +Compilers supported Tested +------------------- ------ +Delphi Yes +Kylix Yes +FreePascal Yes +TMT Pascal compiler Not Yet. +Virtual Pascal No +Gnu Pascal No + + + +Credits +------- +Matthias Thoma for is endless help with my conversion bugs. +Jason Farmer for donating the SFont Font Library. +Gustavo Maximo for the Puntos OpenGL Demo and work he is doing on the documentation +Róbert Kisnémeth for his numerous contributions +Chris Bruner for testing under Kylix +August Logan Bear Jr. for testing under Kylix +Dean Ellis for FreePascal Compiler compatability testing and SDL_Net demos and testing +David House for Windows Insaller and testing. +Romi Kuntsman for helping out on some OpenGL issues. +Everyone on the JEDI-SDL mailing list for their feedback and support. +Everyone on the Delphi-JEDI mailing for answering my conversion questions. +Tom Jones for inspiring this conversion. + +The JEDI-SDL Home page can be found @ http://www.delphi-jedi.org/Jedi:TEAM_SDL_HOME + +The JEDI-SDL source code archive can be found @ http://www.sf.net/projects/jedi-sdl/ + +The JEDI-SDL mailing list can be found @ http://groups.yahoo.com/group/JEDI-SDL/join/ + +The Latest Stable Release version of the JEDI-SDL.zip file can always be found on the Delphi-JEDI site + +The Latest Alpha/Unstable version can always be grabbed from the SourceForge CVS http://sourceforge.net/cvs/?group_id=43805 + + +Sincerely, + + + +Dominique Louis +Delphi Game Developer. +********************************************************* +** To Do Nothing is to Collaborate with the oppressor ** +** -------------------------------------------------- ** +********************************************************* +========================================================= +From . . . . . . . : Dominique Louis +Email. . . . . . . : Dominique@SavageSoftware.com.au +Company. . . . . . : Savage Software Solutions +Delphi Games Site. : http://www.DelphiGamer.com +Delphi JEDI Site . : http://www.delphi-jedi.org +========================================================= + diff --git a/Game/Code/lib/JEDI-SDL/OpenGL/Pas/geometry.pas b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/geometry.pas new file mode 100644 index 00000000..15783515 --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/geometry.pas @@ -0,0 +1,1994 @@ +unit geometry; +{ + $Id: geometry.pas,v 1.1 2004/03/30 21:53:54 savage Exp $ + +} + +// This unit contains many needed types, functions and procedures for +// quaternion, vector and matrix arithmetics. It is specifically designed +// for geometric calculations within R3 (affine vector space) +// and R4 (homogeneous vector space). +// +// Note: The terms 'affine' or 'affine coordinates' are not really correct here +// because an 'affine transformation' describes generally a transformation which leads +// to a uniquely solvable system of equations and has nothing to do with the dimensionality +// of a vector. One could use 'projective coordinates' but this is also not really correct +// and since I haven't found a better name (or even any correct one), 'affine' is as good +// as any other one. +// +// Identifiers containing no dimensionality (like affine or homogeneous) +// and no datatype (integer..extended) are supposed as R4 representation +// with 'single' floating point type (examples are TVector, TMatrix, +// and TQuaternion). The default data type is 'single' ('GLFloat' for OpenGL) +// and used in all routines (except conversions and trigonometric functions). +// +// Routines with an open array as argument can either take Func([1,2,3,4,..]) or Func(Vect). +// The latter is prefered, since no extra stack operations is required. +// Note: Be careful while passing open array elements! If you pass more elements +// than there's room in the result the behaviour will be unpredictable. +// +// If not otherwise stated, all angles are given in radians +// (instead of degrees). Use RadToDeg or DegToRad to convert between them. +// +// Geometry.pas was assembled from different sources (like GraphicGems) +// and relevant books or based on self written code, respectivly. +// +// Note: Some aspects need to be considered when using Delphi and pure +// assembler code. Delphi ensures that the direction flag is always +// cleared while entering a function and expects it cleared on return. +// This is in particular important in routines with (CPU) string commands (MOVSD etc.) +// The registers EDI, ESI and EBX (as well as the stack management +// registers EBP and ESP) must not be changed! EAX, ECX and EDX are +// freely available and mostly used for parameter. +// +// Version 2.5 +// last change : 04. January 2000 +// +// (c) Copyright 1999, Dipl. Ing. Mike Lischke (public@lischke-online.de) +{ + $Log: geometry.pas,v $ + Revision 1.1 2004/03/30 21:53:54 savage + Moved to it's own folder. + + Revision 1.1 2004/02/05 00:08:19 savage + Module 1.0 release + + +} + +interface + +{$I jedi-sdl.inc} + +type + // data types needed for 3D graphics calculation, + // included are 'C like' aliases for each type (to be + // conformal with OpenGL types) + + PByte = ^Byte; + PWord = ^Word; + PInteger = ^Integer; + PFloat = ^Single; + PDouble = ^Double; + PExtended = ^Extended; + PPointer = ^Pointer; + + // types to specify continous streams of a specific type + // switch off range checking to access values beyond the limits + PByteVector = ^TByteVector; + PByteArray = PByteVector; + TByteVector = array[0..0] of Byte; + + PWordVector = ^TWordVector; + PWordArray = PWordVector; // note: there's a same named type in SysUtils + TWordVector = array[0..0] of Word; + + PIntegerVector = ^TIntegerVector; + PIntegerArray = PIntegerVector; + TIntegerVector = array[0..0] of Integer; + + PFloatVector = ^TFloatVector; + PFloatArray = PFloatVector; + TFloatVector = array[0..0] of Single; + + PDoubleVector = ^TDoubleVector; + PDoubleArray = PDoubleVector; + TDoubleVector = array[0..0] of Double; + + PExtendedVector = ^TExtendedVector; + PExtendedArray = PExtendedVector; + TExtendedVector = array[0..0] of Extended; + + PPointerVector = ^TPointerVector; + PPointerArray = PPointerVector; + TPointerVector = array[0..0] of Pointer; + + PCardinalVector = ^TCardinalVector; + PCardinalArray = PCardinalVector; + TCardinalVector = array[0..0] of Cardinal; + + // common vector and matrix types with predefined limits + // indices correspond like: x -> 0 + // y -> 1 + // z -> 2 + // w -> 3 + + PHomogeneousByteVector = ^THomogeneousByteVector; + THomogeneousByteVector = array[0..3] of Byte; + TVector4b = THomogeneousByteVector; + + PHomogeneousWordVector = ^THomogeneousWordVector; + THomogeneousWordVector = array[0..3] of Word; + TVector4w = THomogeneousWordVector; + + PHomogeneousIntVector = ^THomogeneousIntVector; + THomogeneousIntVector = array[0..3] of Integer; + TVector4i = THomogeneousIntVector; + + PHomogeneousFltVector = ^THomogeneousFltVector; + THomogeneousFltVector = array[0..3] of Single; + TVector4f = THomogeneousFltVector; + + PHomogeneousDblVector = ^THomogeneousDblVector; + THomogeneousDblVector = array[0..3] of Double; + TVector4d = THomogeneousDblVector; + + PHomogeneousExtVector = ^THomogeneousExtVector; + THomogeneousExtVector = array[0..3] of Extended; + TVector4e = THomogeneousExtVector; + + PHomogeneousPtrVector = ^THomogeneousPtrVector; + THomogeneousPtrVector = array[0..3] of Pointer; + TVector4p = THomogeneousPtrVector; + + PAffineByteVector = ^TAffineByteVector; + TAffineByteVector = array[0..2] of Byte; + TVector3b = TAffineByteVector; + + PAffineWordVector = ^TAffineWordVector; + TAffineWordVector = array[0..2] of Word; + TVector3w = TAffineWordVector; + + PAffineIntVector = ^TAffineIntVector; + TAffineIntVector = array[0..2] of Integer; + TVector3i = TAffineIntVector; + + PAffineFltVector = ^TAffineFltVector; + TAffineFltVector = array[0..2] of Single; + TVector3f = TAffineFltVector; + + PAffineDblVector = ^TAffineDblVector; + TAffineDblVector = array[0..2] of Double; + TVector3d = TAffineDblVector; + + PAffineExtVector = ^TAffineExtVector; + TAffineExtVector = array[0..2] of Extended; + TVector3e = TAffineExtVector; + + PAffinePtrVector = ^TAffinePtrVector; + TAffinePtrVector = array[0..2] of Pointer; + TVector3p = TAffinePtrVector; + + // some simplified names + PVector = ^TVector; + TVector = THomogeneousFltVector; + + PHomogeneousVector = ^THomogeneousVector; + THomogeneousVector = THomogeneousFltVector; + + PAffineVector = ^TAffineVector; + TAffineVector = TAffineFltVector; + + // arrays of vectors + PVectorArray = ^TVectorArray; + TVectorArray = array[0..0] of TAffineVector; + + // matrices + THomogeneousByteMatrix = array[0..3] of THomogeneousByteVector; + TMatrix4b = THomogeneousByteMatrix; + + THomogeneousWordMatrix = array[0..3] of THomogeneousWordVector; + TMatrix4w = THomogeneousWordMatrix; + + THomogeneousIntMatrix = array[0..3] of THomogeneousIntVector; + TMatrix4i = THomogeneousIntMatrix; + + THomogeneousFltMatrix = array[0..3] of THomogeneousFltVector; + TMatrix4f = THomogeneousFltMatrix; + + THomogeneousDblMatrix = array[0..3] of THomogeneousDblVector; + TMatrix4d = THomogeneousDblMatrix; + + THomogeneousExtMatrix = array[0..3] of THomogeneousExtVector; + TMatrix4e = THomogeneousExtMatrix; + + TAffineByteMatrix = array[0..2] of TAffineByteVector; + TMatrix3b = TAffineByteMatrix; + + TAffineWordMatrix = array[0..2] of TAffineWordVector; + TMatrix3w = TAffineWordMatrix; + + TAffineIntMatrix = array[0..2] of TAffineIntVector; + TMatrix3i = TAffineIntMatrix; + + TAffineFltMatrix = array[0..2] of TAffineFltVector; + TMatrix3f = TAffineFltMatrix; + + TAffineDblMatrix = array[0..2] of TAffineDblVector; + TMatrix3d = TAffineDblMatrix; + + TAffineExtMatrix = array[0..2] of TAffineExtVector; + TMatrix3e = TAffineExtMatrix; + + // some simplified names + PMatrix = ^TMatrix; + TMatrix = THomogeneousFltMatrix; + + PHomogeneousMatrix = ^THomogeneousMatrix; + THomogeneousMatrix = THomogeneousFltMatrix; + + PAffineMatrix = ^TAffineMatrix; + TAffineMatrix = TAffineFltMatrix; + + // q = ([x, y, z], w) + TQuaternion = record + case Integer of + 0: + (ImagPart: TAffineVector; + RealPart: Single); + 1: + (Vector: TVector4f); + end; + + TRectangle = record + Left, + Top, + Width, + Height: Integer; + end; + + TTransType = (ttScaleX, ttScaleY, ttScaleZ, + ttShearXY, ttShearXZ, ttShearYZ, + ttRotateX, ttRotateY, ttRotateZ, + ttTranslateX, ttTranslateY, ttTranslateZ, + ttPerspectiveX, ttPerspectiveY, ttPerspectiveZ, ttPerspectiveW); + + // used to describe a sequence of transformations in following order: + // [Sx][Sy][Sz][ShearXY][ShearXZ][ShearZY][Rx][Ry][Rz][Tx][Ty][Tz][P(x,y,z,w)] + // constants are declared for easier access (see MatrixDecompose below) + TTransformations = array[TTransType] of Single; + + +const + // useful constants + + // standard vectors + XVector: TAffineVector = (1, 0, 0); + YVector: TAffineVector = (0, 1, 0); + ZVector: TAffineVector = (0, 0, 1); + NullVector: TAffineVector = (0, 0, 0); + + IdentityMatrix: TMatrix = ((1, 0, 0, 0), + (0, 1, 0, 0), + (0, 0, 1, 0), + (0, 0, 0, 1)); + EmptyMatrix: TMatrix = ((0, 0, 0, 0), + (0, 0, 0, 0), + (0, 0, 0, 0), + (0, 0, 0, 0)); + // some very small numbers + EPSILON = 1e-100; + EPSILON2 = 1e-50; + +//---------------------------------------------------------------------------------------------------------------------- + +// vector functions +function VectorAdd(V1, V2: TVector): TVector; +function VectorAffineAdd(V1, V2: TAffineVector): TAffineVector; +function VectorAffineCombine(V1, V2: TAffineVector; F1, F2: Single): TAffineVector; +function VectorAffineDotProduct(V1, V2: TAffineVector): Single; +function VectorAffineLerp(V1, V2: TAffineVector; t: Single): TAffineVector; +function VectorAffineSubtract(V1, V2: TAffineVector): TAffineVector; +function VectorAngle(V1, V2: TAffineVector): Single; +function VectorCombine(V1, V2: TVector; F1, F2: Single): TVector; +function VectorCrossProduct(V1, V2: TAffineVector): TAffineVector; +function VectorDotProduct(V1, V2: TVector): Single; +function VectorLength(V: array of Single): Single; +function VectorLerp(V1, V2: TVector; t: Single): TVector; +procedure VectorNegate(V: array of Single); +function VectorNorm(V: array of Single): Single; +function VectorNormalize(V: array of Single): Single; +function VectorPerpendicular(V, N: TAffineVector): TAffineVector; +function VectorReflect(V, N: TAffineVector): TAffineVector; +procedure VectorRotate(var Vector: TVector4f; Axis: TVector3f; Angle: Single); +procedure VectorScale(V: array of Single; Factor: Single); +function VectorSubtract(V1, V2: TVector): TVector; + +// matrix functions +function CreateRotationMatrixX(Sine, Cosine: Single): TMatrix; +function CreateRotationMatrixY(Sine, Cosine: Single): TMatrix; +function CreateRotationMatrixZ(Sine, Cosine: Single): TMatrix; +function CreateScaleMatrix(V: TAffineVector): TMatrix; +function CreateTranslationMatrix(V: TVector): TMatrix; +procedure MatrixAdjoint(var M: TMatrix); +function MatrixAffineDeterminant(M: TAffineMatrix): Single; +procedure MatrixAffineTranspose(var M: TAffineMatrix); +function MatrixDeterminant(M: TMatrix): Single; +procedure MatrixInvert(var M: TMatrix); +function MatrixMultiply(M1, M2: TMatrix): TMatrix; +procedure MatrixScale(var M: TMatrix; Factor: Single); +procedure MatrixTranspose(var M: TMatrix); + +// quaternion functions +function QuaternionConjugate(Q: TQuaternion): TQuaternion; +function QuaternionFromPoints(V1, V2: TAffineVector): TQuaternion; +function QuaternionMultiply(qL, qR: TQuaternion): TQuaternion; +function QuaternionSlerp(QStart, QEnd: TQuaternion; Spin: Integer; t: Single): TQuaternion; +function QuaternionToMatrix(Q: TQuaternion): TMatrix; +procedure QuaternionToPoints(Q: TQuaternion; var ArcFrom, ArcTo: TAffineVector); + +// mixed functions +function ConvertRotation(Angles: TAffineVector): TVector; +function CreateRotationMatrix(Axis: TVector3f; Angle: Single): TMatrix; +function MatrixDecompose(M: TMatrix; var Tran: TTransformations): Boolean; +function VectorAffineTransform(V: TAffineVector; M: TAffineMatrix): TAffineVector; +function VectorTransform(V: TVector4f; M: TMatrix): TVector4f; overload; +function VectorTransform(V: TVector3f; M: TMatrix): TVector3f; overload; + +// miscellaneous functions +function MakeAffineDblVector(V: array of Double): TAffineDblVector; +function MakeDblVector(V: array of Double): THomogeneousDblVector; +function MakeAffineVector(V: array of Single): TAffineVector; +function MakeQuaternion(Imag: array of Single; Real: Single): TQuaternion; +function MakeVector(V: array of Single): TVector; +function PointInPolygon(xp, yp : array of Single; x, y: Single): Boolean; +function VectorAffineDblToFlt(V: TAffineDblVector): TAffineVector; +function VectorDblToFlt(V: THomogeneousDblVector): THomogeneousVector; +function VectorAffineFltToDbl(V: TAffineVector): TAffineDblVector; +function VectorFltToDbl(V: TVector): THomogeneousDblVector; + +// trigonometric functions +function ArcCos(X: Extended): Extended; +function ArcSin(X: Extended): Extended; +function ArcTan2(Y, X: Extended): Extended; +function CoTan(X: Extended): Extended; +function DegToRad(Degrees: Extended): Extended; +function RadToDeg(Radians: Extended): Extended; +procedure SinCos(Theta: Extended; var Sin, Cos: Extended); +function Tan(X: Extended): Extended; + +// coordinate system manipulation functions +function Turn(Matrix: TMatrix; Angle: Single): TMatrix; overload; +function Turn(Matrix: TMatrix; MasterUp: TAffineVector; Angle: Single): TMatrix; overload; +function Pitch(Matrix: TMatrix; Angle: Single): TMatrix; overload; +function Pitch(Matrix: TMatrix; MasterRight: TAffineVector; Angle: Single): TMatrix; overload; +function Roll(Matrix: TMatrix; Angle: Single): TMatrix; overload; +function Roll(Matrix: TMatrix; MasterDirection: TAffineVector; Angle: Single): TMatrix; overload; + +//---------------------------------------------------------------------------------------------------------------------- + +implementation + +const + // FPU status flags (high order byte) + C0 = 1; + C1 = 2; + C2 = 4; + C3 = $40; + + // to be used as descriptive indices + X = 0; + Y = 1; + Z = 2; + W = 3; + +//----------------- trigonometric helper functions --------------------------------------------------------------------- + +function DegToRad(Degrees: Extended): Extended; + +begin + Result := Degrees * (PI / 180); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function RadToDeg(Radians: Extended): Extended; + +begin + Result := Radians * (180 / PI); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure SinCos(Theta: Extended; var Sin, Cos: Extended); assembler; register; + +// calculates sine and cosine from the given angle Theta +// EAX contains address of Sin +// EDX contains address of Cos +// Theta is passed over the stack + +asm + FLD Theta + FSINCOS + FSTP TBYTE PTR [EDX] // cosine + FSTP TBYTE PTR [EAX] // sine + FWAIT +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function ArcCos(X: Extended): Extended; + +begin + Result := ArcTan2(Sqrt(1 - X * X), X); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function ArcSin(X: Extended): Extended; + +begin + Result := ArcTan2(X, Sqrt(1 - X * X)) +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function ArcTan2(Y, X: Extended): Extended; + +asm + FLD Y + FLD X + FPATAN + FWAIT +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function Tan(X: Extended): Extended; + +asm + FLD X + FPTAN + FSTP ST(0) // FPTAN pushes 1.0 after result + FWAIT +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function CoTan(X: Extended): Extended; + +asm + FLD X + FPTAN + FDIVRP + FWAIT +end; + +//----------------- miscellaneous vector functions --------------------------------------------------------------------- + +function MakeAffineDblVector(V: array of Double): TAffineDblVector; assembler; + +// creates a vector from given values +// EAX contains address of V +// ECX contains address to result vector +// EDX contains highest index of V + +asm + PUSH EDI + PUSH ESI + MOV EDI, ECX + MOV ESI, EAX + MOV ECX, EDX + ADD ECX, 2 + REP MOVSD + POP ESI + POP EDI +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function MakeDblVector(V: array of Double): THomogeneousDblVector; assembler; + +// creates a vector from given values +// EAX contains address of V +// ECX contains address to result vector +// EDX contains highest index of V + +asm + PUSH EDI + PUSH ESI + MOV EDI, ECX + MOV ESI, EAX + MOV ECX, EDX + ADD ECX, 2 + REP MOVSD + POP ESI + POP EDI +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function MakeAffineVector(V: array of Single): TAffineVector; assembler; + +// creates a vector from given values +// EAX contains address of V +// ECX contains address to result vector +// EDX contains highest index of V + +asm + PUSH EDI + PUSH ESI + MOV EDI, ECX + MOV ESI, EAX + MOV ECX, EDX + INC ECX + CMP ECX, 3 + JB @@1 + MOV ECX, 3 +@@1: REP MOVSD // copy given values + MOV ECX, 2 + SUB ECX, EDX // determine missing entries + JS @@Finish + XOR EAX, EAX + REP STOSD // set remaining fields to 0 +@@Finish: POP ESI + POP EDI +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function MakeQuaternion(Imag: array of Single; Real: Single): TQuaternion; assembler; + +// creates a quaternion from the given values +// EAX contains address of Imag +// ECX contains address to result vector +// EDX contains highest index of Imag +// Real part is passed on the stack + +asm + PUSH EDI + PUSH ESI + MOV EDI, ECX + MOV ESI, EAX + MOV ECX, EDX + INC ECX + REP MOVSD + MOV EAX, [Real] + MOV [EDI], EAX + POP ESI + POP EDI +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function MakeVector(V: array of Single): TVector; assembler; + +// creates a vector from given values +// EAX contains address of V +// ECX contains address to result vector +// EDX contains highest index of V + +asm + PUSH EDI + PUSH ESI + MOV EDI, ECX + MOV ESI, EAX + MOV ECX, EDX + INC ECX + CMP ECX, 4 + JB @@1 + MOV ECX, 4 +@@1: REP MOVSD // copy given values + MOV ECX, 3 + SUB ECX, EDX // determine missing entries + JS @@Finish + XOR EAX, EAX + REP STOSD // set remaining fields to 0 +@@Finish: POP ESI + POP EDI +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorLength(V: array of Single): Single; assembler; + +// calculates the length of a vector following the equation: sqrt(x * x + y * y + ...) +// Note: The parameter of this function is declared as open array. Thus +// there's no restriction about the number of the components of the vector. +// +// EAX contains address of V +// EDX contains the highest index of V +// the result is returned in ST(0) + +asm + FLDZ // initialize sum +@@Loop: FLD DWORD PTR [EAX + 4 * EDX] // load a component + FMUL ST, ST + FADDP + SUB EDX, 1 + JNL @@Loop + FSQRT +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorAngle(V1, V2: TAffineVector): Single; assembler; + +// calculates the cosine of the angle between Vector1 and Vector2 +// Result = DotProduct(V1, V2) / (Length(V1) * Length(V2)) +// +// EAX contains address of Vector1 +// EDX contains address of Vector2 + +asm + FLD DWORD PTR [EAX] // V1[0] + FLD ST // double V1[0] + FMUL ST, ST // V1[0]^2 (prep. for divisor) + FLD DWORD PTR [EDX] // V2[0] + FMUL ST(2), ST // ST(2) := V1[0] * V2[0] + FMUL ST, ST // V2[0]^2 (prep. for divisor) + FLD DWORD PTR [EAX + 4] // V1[1] + FLD ST // double V1[1] + FMUL ST, ST // ST(0) := V1[1]^2 + FADDP ST(3), ST // ST(2) := V1[0]^2 + V1[1] * * 2 + FLD DWORD PTR [EDX + 4] // V2[1] + FMUL ST(1), ST // ST(1) := V1[1] * V2[1] + FMUL ST, ST // ST(0) := V2[1]^2 + FADDP ST(2), ST // ST(1) := V2[0]^2 + V2[1]^2 + FADDP ST(3), ST // ST(2) := V1[0] * V2[0] + V1[1] * V2[1] + FLD DWORD PTR [EAX + 8] // load V2[1] + FLD ST // same calcs go here + FMUL ST, ST // (compare above) + FADDP ST(3), ST + FLD DWORD PTR [EDX + 8] + FMUL ST(1), ST + FMUL ST, ST + FADDP ST(2), ST + FADDP ST(3), ST + FMULP // ST(0) := (V1[0]^2 + V1[1]^2 + V1[2]) * + // (V2[0]^2 + V2[1]^2 + V2[2]) + FSQRT // sqrt(ST(0)) + FDIVP // ST(0) := Result := ST(1) / ST(0) + // the result is expected in ST(0), if it's invalid, an error is raised +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorNorm(V: array of Single): Single; assembler; register; + +// calculates norm of a vector which is defined as norm = x * x + y * y + ... +// EAX contains address of V +// EDX contains highest index in V +// result is passed in ST(0) + +asm + FLDZ // initialize sum +@@Loop: FLD DWORD PTR [EAX + 4 * EDX] // load a component + FMUL ST, ST // make square + FADDP // add previous calculated sum + SUB EDX, 1 + JNL @@Loop +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorNormalize(V: array of Single): Single; assembler; register; + +// transforms a vector to unit length and return length +// EAX contains address of V +// EDX contains the highest index in V +// return former length of V in ST + +asm + PUSH EBX + MOV ECX, EDX // save size of V + CALL VectorLength // calculate length of vector + FTST // test if length = 0 + MOV EBX, EAX // save parameter address + FSTSW AX // get test result + TEST AH, C3 // check the test result + JNZ @@Finish + SUB EBX, 4 // simplyfied address calculation + INC ECX + FLD1 // calculate reciprocal of length + FDIV ST, ST(1) +@@1: FLD ST // double reciprocal + FMUL DWORD PTR [EBX + 4 * ECX] // scale component + WAIT + FSTP DWORD PTR [EBX + 4 * ECX] // store result + LOOP @@1 + FSTP ST // remove reciprocal from FPU stack +@@Finish: POP EBX +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorAffineSubtract(V1, V2: TAffineVector): TAffineVector; assembler; register; + +// returns v1 minus v2 +// EAX contains address of V1 +// EDX contains address of V2 +// ECX contains address of the result + +asm + {Result[X] := V1[X]-V2[X]; + Result[Y] := V1[Y]-V2[Y]; + Result[Z] := V1[Z]-V2[Z];} + + FLD DWORD PTR [EAX] + FSUB DWORD PTR [EDX] + FSTP DWORD PTR [ECX] + FLD DWORD PTR [EAX + 4] + FSUB DWORD PTR [EDX + 4] + FSTP DWORD PTR [ECX + 4] + FLD DWORD PTR [EAX + 8] + FSUB DWORD PTR [EDX + 8] + FSTP DWORD PTR [ECX + 8] +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorReflect(V, N: TAffineVector): TAffineVector; assembler; register; + +// reflects vector V against N (assumes N is normalized) +// EAX contains address of V +// EDX contains address of N +// ECX contains address of the result + +//var Dot : Single; + +asm + {Dot := VectorAffineDotProduct(V, N); + Result[X] := V[X]-2 * Dot * N[X]; + Result[Y] := V[Y]-2 * Dot * N[Y]; + Result[Z] := V[Z]-2 * Dot * N[Z];} + + CALL VectorAffineDotProduct // dot is now in ST(0) + FCHS // -dot + FADD ST, ST // -dot * 2 + FLD DWORD PTR [EDX] // ST := N[X] + FMUL ST, ST(1) // ST := -2 * dot * N[X] + FADD DWORD PTR[EAX] // ST := V[X] - 2 * dot * N[X] + FSTP DWORD PTR [ECX] // store result + FLD DWORD PTR [EDX + 4] // etc. + FMUL ST, ST(1) + FADD DWORD PTR[EAX + 4] + FSTP DWORD PTR [ECX + 4] + FLD DWORD PTR [EDX + 8] + FMUL ST, ST(1) + FADD DWORD PTR[EAX + 8] + FSTP DWORD PTR [ECX + 8] + FSTP ST // clean FPU stack +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure VectorRotate(var Vector: TVector4f; Axis: TVector3f; Angle: Single); + +// rotates Vector about Axis with Angle radiants + +var RotMatrix : TMatrix4f; + +begin + RotMatrix := CreateRotationMatrix(Axis, Angle); + Vector := VectorTransform(Vector, RotMatrix); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure VectorScale(V: array of Single; Factor: Single); assembler; register; + +// returns a vector scaled by a factor +// EAX contains address of V +// EDX contains highest index in V +// Factor is located on the stack + +asm + {for I := Low(V) to High(V) do V[I] := V[I] * Factor;} + + FLD DWORD PTR [Factor] // load factor +@@Loop: FLD DWORD PTR [EAX + 4 * EDX] // load a component + FMUL ST, ST(1) // multiply it with the factor + WAIT + FSTP DWORD PTR [EAX + 4 * EDX] // store the result + DEC EDX // do the entire array + JNS @@Loop + FSTP ST(0) // clean the FPU stack +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure VectorNegate(V: array of Single); assembler; register; + +// returns a negated vector +// EAX contains address of V +// EDX contains highest index in V + +asm + {V[X] := -V[X]; + V[Y] := -V[Y]; + V[Z] := -V[Z];} + +@@Loop: FLD DWORD PTR [EAX + 4 * EDX] + FCHS + WAIT + FSTP DWORD PTR [EAX + 4 * EDX] + DEC EDX + JNS @@Loop +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorAdd(V1, V2: TVector): TVector; register; + +// returns the sum of two vectors + +begin + Result[X] := V1[X] + V2[X]; + Result[Y] := V1[Y] + V2[Y]; + Result[Z] := V1[Z] + V2[Z]; + Result[W] := V1[W] + V2[W]; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorAffineAdd(V1, V2: TAffineVector): TAffineVector; register; + +// returns the sum of two vectors + +begin + Result[X] := V1[X] + V2[X]; + Result[Y] := V1[Y] + V2[Y]; + Result[Z] := V1[Z] + V2[Z]; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorSubtract(V1, V2: TVector): TVector; register; + +// returns the difference of two vectors + +begin + Result[X] := V1[X] - V2[X]; + Result[Y] := V1[Y] - V2[Y]; + Result[Z] := V1[Z] - V2[Z]; + Result[W] := V1[W] - V2[W]; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorDotProduct(V1, V2: TVector): Single; register; + +begin + Result := V1[X] * V2[X] + V1[Y] * V2[Y] + V1[Z] * V2[Z] + V1[W] * V2[W]; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorAffineDotProduct(V1, V2: TAffineVector): Single; assembler; register; + +// calculates the dot product between V1 and V2 +// EAX contains address of V1 +// EDX contains address of V2 +// result is stored in ST(0) + +asm + //Result := V1[X] * V2[X] + V1[Y] * V2[Y] + V1[Z] * V2[Z]; + + FLD DWORD PTR [EAX] + FMUL DWORD PTR [EDX] + FLD DWORD PTR [EAX + 4] + FMUL DWORD PTR [EDX + 4] + FADDP + FLD DWORD PTR [EAX + 8] + FMUL DWORD PTR [EDX + 8] + FADDP +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorCrossProduct(V1, V2: TAffineVector): TAffineVector; + +// calculates the cross product between vector 1 and 2, Temp is necessary because +// either V1 or V2 could also be the result vector +// +// EAX contains address of V1 +// EDX contains address of V2 +// ECX contains address of result + +var Temp: TAffineVector; + +asm + {Temp[X] := V1[Y] * V2[Z]-V1[Z] * V2[Y]; + Temp[Y] := V1[Z] * V2[X]-V1[X] * V2[Z]; + Temp[Z] := V1[X] * V2[Y]-V1[Y] * V2[X]; + Result := Temp;} + + PUSH EBX // save EBX, must be restored to original value + LEA EBX, [Temp] + FLD DWORD PTR [EDX + 8] // first load both vectors onto FPU register stack + FLD DWORD PTR [EDX + 4] + FLD DWORD PTR [EDX + 0] + FLD DWORD PTR [EAX + 8] + FLD DWORD PTR [EAX + 4] + FLD DWORD PTR [EAX + 0] + + FLD ST(1) // ST(0) := V1[Y] + FMUL ST, ST(6) // ST(0) := V1[Y] * V2[Z] + FLD ST(3) // ST(0) := V1[Z] + FMUL ST, ST(6) // ST(0) := V1[Z] * V2[Y] + FSUBP ST(1), ST // ST(0) := ST(1)-ST(0) + FSTP DWORD [EBX] // Temp[X] := ST(0) + FLD ST(2) // ST(0) := V1[Z] + FMUL ST, ST(4) // ST(0) := V1[Z] * V2[X] + FLD ST(1) // ST(0) := V1[X] + FMUL ST, ST(7) // ST(0) := V1[X] * V2[Z] + FSUBP ST(1), ST // ST(0) := ST(1)-ST(0) + FSTP DWORD [EBX + 4] // Temp[Y] := ST(0) + FLD ST // ST(0) := V1[X] + FMUL ST, ST(5) // ST(0) := V1[X] * V2[Y] + FLD ST(2) // ST(0) := V1[Y] + FMUL ST, ST(5) // ST(0) := V1[Y] * V2[X] + FSUBP ST(1), ST // ST(0) := ST(1)-ST(0) + FSTP DWORD [EBX + 8] // Temp[Z] := ST(0) + FSTP ST(0) // clear FPU register stack + FSTP ST(0) + FSTP ST(0) + FSTP ST(0) + FSTP ST(0) + FSTP ST(0) + MOV EAX, [EBX] // copy Temp to Result + MOV [ECX], EAX + MOV EAX, [EBX + 4] + MOV [ECX + 4], EAX + MOV EAX, [EBX + 8] + MOV [ECX + 8], EAX + POP EBX +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorPerpendicular(V, N: TAffineVector): TAffineVector; + +// calculates a vector perpendicular to N (N is assumed to be of unit length) +// subtract out any component parallel to N + +var Dot: Single; + +begin + Dot := VectorAffineDotProduct(V, N); + Result[X] := V[X]-Dot * N[X]; + Result[Y] := V[Y]-Dot * N[Y]; + Result[Z] := V[Z]-Dot * N[Z]; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorTransform(V: TVector4f; M: TMatrix): TVector4f; register; + +// transforms a homogeneous vector by multiplying it with a matrix + +var TV: TVector4f; + +begin + TV[X] := V[X] * M[X, X] + V[Y] * M[Y, X] + V[Z] * M[Z, X] + V[W] * M[W, X]; + TV[Y] := V[X] * M[X, Y] + V[Y] * M[Y, Y] + V[Z] * M[Z, Y] + V[W] * M[W, Y]; + TV[Z] := V[X] * M[X, Z] + V[Y] * M[Y, Z] + V[Z] * M[Z, Z] + V[W] * M[W, Z]; + TV[W] := V[X] * M[X, W] + V[Y] * M[Y, W] + V[Z] * M[Z, W] + V[W] * M[W, W]; + Result := TV +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorTransform(V: TVector3f; M: TMatrix): TVector3f; + +// transforms an affine vector by multiplying it with a (homogeneous) matrix + +var TV: TVector3f; + +begin + TV[X] := V[X] * M[X, X] + V[Y] * M[Y, X] + V[Z] * M[Z, X] + M[W, X]; + TV[Y] := V[X] * M[X, Y] + V[Y] * M[Y, Y] + V[Z] * M[Z, Y] + M[W, Y]; + TV[Z] := V[X] * M[X, Z] + V[Y] * M[Y, Z] + V[Z] * M[Z, Z] + M[W, Z]; + Result := TV; +end; + + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorAffineTransform(V: TAffineVector; M: TAffineMatrix): TAffineVector; register; + +// transforms an affine vector by multiplying it with a matrix + +var TV: TAffineVector; + +begin + TV[X] := V[X] * M[X, X] + V[Y] * M[Y, X] + V[Z] * M[Z, X]; + TV[Y] := V[X] * M[X, Y] + V[Y] * M[Y, Y] + V[Z] * M[Z, Y]; + TV[Z] := V[X] * M[X, Z] + V[Y] * M[Y, Z] + V[Z] * M[Z, Z]; + Result := TV; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function PointInPolygon(xp, yp : array of Single; x, y: Single): Boolean; + +// The code below is from Wm. Randolph Franklin +// with some minor modifications for speed. It returns 1 for strictly +// interior points, 0 for strictly exterior, and 0 or 1 for points on +// the boundary. +// This code is not yet tested! + +var I, J: Integer; + +begin + Result := False; + if High(XP) <> High(YP) then Exit; + J := High(XP); + for I := 0 to High(XP) do + begin + if ((((yp[I] <= y) and (y < yp[J])) or ((yp[J] <= y) and (y < yp[I]))) and + (x < (xp[J] - xp[I]) * (y - yp[I]) / (yp[J] - yp[I]) + xp[I])) + then Result := not Result; + J := I + 1; + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function QuaternionConjugate(Q: TQuaternion): TQuaternion; assembler; + +// returns the conjugate of a quaternion +// EAX contains address of Q +// EDX contains address of result + +asm + FLD DWORD PTR [EAX] + FCHS + WAIT + FSTP DWORD PTR [EDX] + FLD DWORD PTR [EAX + 4] + FCHS + WAIT + FSTP DWORD PTR [EDX + 4] + FLD DWORD PTR [EAX + 8] + FCHS + WAIT + FSTP DWORD PTR [EDX + 8] + MOV EAX, [EAX + 12] + MOV [EDX + 12], EAX +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function QuaternionFromPoints(V1, V2: TAffineVector): TQuaternion; assembler; + +// constructs a unit quaternion from two points on unit sphere +// EAX contains address of V1 +// ECX contains address to result +// EDX contains address of V2 + +asm + {Result.ImagPart := VectorCrossProduct(V1, V2); + Result.RealPart := Sqrt((VectorAffineDotProduct(V1, V2) + 1)/2);} + + PUSH EAX + CALL VectorCrossProduct // determine axis to rotate about + POP EAX + FLD1 // prepare next calculation + Call VectorAffineDotProduct // calculate cos(angle between V1 and V2) + FADD ST, ST(1) // transform angle to angle/2 by: cos(a/2)=sqrt((1 + cos(a))/2) + FXCH ST(1) + FADD ST, ST + FDIVP ST(1), ST + FSQRT + FSTP DWORD PTR [ECX + 12] // Result.RealPart := ST(0) +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function QuaternionMultiply(qL, qR: TQuaternion): TQuaternion; + +// Returns quaternion product qL * qR. Note: order is important! +// To combine rotations, use the product QuaternionMuliply(qSecond, qFirst), +// which gives the effect of rotating by qFirst then qSecond. + +var Temp : TQuaternion; + +begin + Temp.RealPart := qL.RealPart * qR.RealPart - qL.ImagPart[X] * qR.ImagPart[X] - + qL.ImagPart[Y] * qR.ImagPart[Y] - qL.ImagPart[Z] * qR.ImagPart[Z]; + Temp.ImagPart[X] := qL.RealPart * qR.ImagPart[X] + qL.ImagPart[X] * qR.RealPart + + qL.ImagPart[Y] * qR.ImagPart[Z] - qL.ImagPart[Z] * qR.ImagPart[Y]; + Temp.ImagPart[Y] := qL.RealPart * qR.ImagPart[Y] + qL.ImagPart[Y] * qR.RealPart + + qL.ImagPart[Z] * qR.ImagPart[X] - qL.ImagPart[X] * qR.ImagPart[Z]; + Temp.ImagPart[Z] := qL.RealPart * qR.ImagPart[Z] + qL.ImagPart[Z] * qR.RealPart + + qL.ImagPart[X] * qR.ImagPart[Y] - qL.ImagPart[Y] * qR.ImagPart[X]; + Result := Temp; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function QuaternionToMatrix(Q: TQuaternion): TMatrix; + +// Constructs rotation matrix from (possibly non-unit) quaternion. +// Assumes matrix is used to multiply column vector on the left: +// vnew = mat vold. Works correctly for right-handed coordinate system +// and right-handed rotations. + +// Essentially, this function is the same as CreateRotationMatrix and you can consider it as +// being for reference here. + +{var Norm, S, + XS, YS, ZS, + WX, WY, WZ, + XX, XY, XZ, + YY, YZ, ZZ : Single; + +begin + Norm := Q.Vector[X] * Q.Vector[X] + Q.Vector[Y] * Q.Vector[Y] + Q.Vector[Z] * Q.Vector[Z] + Q.RealPart * Q.RealPart; + if Norm > 0 then S := 2 / Norm + else S := 0; + + XS := Q.Vector[X] * S; YS := Q.Vector[Y] * S; ZS := Q.Vector[Z] * S; + WX := Q.RealPart * XS; WY := Q.RealPart * YS; WZ := Q.RealPart * ZS; + XX := Q.Vector[X] * XS; XY := Q.Vector[X] * YS; XZ := Q.Vector[X] * ZS; + YY := Q.Vector[Y] * YS; YZ := Q.Vector[Y] * ZS; ZZ := Q.Vector[Z] * ZS; + + Result[X, X] := 1 - (YY + ZZ); Result[Y, X] := XY + WZ; Result[Z, X] := XZ - WY; Result[W, X] := 0; + Result[X, Y] := XY - WZ; Result[Y, Y] := 1 - (XX + ZZ); Result[Z, Y] := YZ + WX; Result[W, Y] := 0; + Result[X, Z] := XZ + WY; Result[Y, Z] := YZ - WX; Result[Z, Z] := 1 - (XX + YY); Result[W, Z] := 0; + Result[X, W] := 0; Result[Y, W] := 0; Result[Z, W] := 0; Result[W, W] := 1;} + +var + V: TAffineVector; + SinA, CosA, + A, B, C: Extended; + +begin + V := Q.ImagPart; + VectorNormalize(V); + SinCos(Q.RealPart / 2, SinA, CosA); + A := V[X] * SinA; + B := V[Y] * SinA; + C := V[Z] * SinA; + + Result := IdentityMatrix; + Result[X, X] := 1 - 2 * B * B - 2 * C * C; + Result[X, Y] := 2 * A * B - 2 * CosA * C; + Result[X, Z] := 2 * A * C + 2 * CosA * B; + + Result[Y, X] := 2 * A * B + 2 * CosA * C; + Result[Y, Y] := 1 - 2 * A * A - 2 * C * C; + Result[Y, Z] := 2 * B * C - 2 * CosA * A; + + Result[Z, X] := 2 * A * C - 2 * CosA * B; + Result[Z, Y] := 2 * B * C + 2 * CosA * A; + Result[Z, Z] := 1 - 2 * A * A - 2 * B * B; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure QuaternionToPoints(Q: TQuaternion; var ArcFrom, ArcTo: TAffineVector); register; + +// converts a unit quaternion into two points on a unit sphere + +var S: Single; + +begin + S := Sqrt(Q.ImagPart[X] * Q.ImagPart[X] + Q.ImagPart[Y] * Q.ImagPart[Y]); + if S = 0 then ArcFrom := MakeAffineVector([0, 1, 0]) + else ArcFrom := MakeAffineVector([-Q.ImagPart[Y] / S, Q.ImagPart[X] / S, 0]); + ArcTo[X] := Q.RealPart * ArcFrom[X] - Q.ImagPart[Z] * ArcFrom[Y]; + ArcTo[Y] := Q.RealPart * ArcFrom[Y] + Q.ImagPart[Z] * ArcFrom[X]; + ArcTo[Z] := Q.ImagPart[X] * ArcFrom[Y] - Q.ImagPart[Y] * ArcFrom[X]; + if Q.RealPart < 0 then ArcFrom := MakeAffineVector([-ArcFrom[X], -ArcFrom[Y], 0]); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function MatrixAffineDeterminant(M: TAffineMatrix): Single; register; + +// determinant of a 3x3 matrix + +begin + Result := M[X, X] * (M[Y, Y] * M[Z, Z] - M[Z, Y] * M[Y, Z]) - + M[X, Y] * (M[Y, X] * M[Z, Z] - M[Z, X] * M[Y, Z]) + + M[X, Z] * (M[Y, X] * M[Z, Y] - M[Z, X] * M[Y, Y]); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function MatrixDetInternal(a1, a2, a3, b1, b2, b3, c1, c2, c3: Single): Single; + +// internal version for the determinant of a 3x3 matrix + +begin + Result := a1 * (b2 * c3 - b3 * c2) - + b1 * (a2 * c3 - a3 * c2) + + c1 * (a2 * b3 - a3 * b2); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure MatrixAdjoint(var M: TMatrix); register; + +// Adjoint of a 4x4 matrix - used in the computation of the inverse +// of a 4x4 matrix + +var a1, a2, a3, a4, + b1, b2, b3, b4, + c1, c2, c3, c4, + d1, d2, d3, d4: Single; + + +begin + a1 := M[X, X]; b1 := M[X, Y]; + c1 := M[X, Z]; d1 := M[X, W]; + a2 := M[Y, X]; b2 := M[Y, Y]; + c2 := M[Y, Z]; d2 := M[Y, W]; + a3 := M[Z, X]; b3 := M[Z, Y]; + c3 := M[Z, Z]; d3 := M[Z, W]; + a4 := M[W, X]; b4 := M[W, Y]; + c4 := M[W, Z]; d4 := M[W, W]; + + // row column labeling reversed since we transpose rows & columns + M[X, X] := MatrixDetInternal(b2, b3, b4, c2, c3, c4, d2, d3, d4); + M[Y, X] := -MatrixDetInternal(a2, a3, a4, c2, c3, c4, d2, d3, d4); + M[Z, X] := MatrixDetInternal(a2, a3, a4, b2, b3, b4, d2, d3, d4); + M[W, X] := -MatrixDetInternal(a2, a3, a4, b2, b3, b4, c2, c3, c4); + + M[X, Y] := -MatrixDetInternal(b1, b3, b4, c1, c3, c4, d1, d3, d4); + M[Y, Y] := MatrixDetInternal(a1, a3, a4, c1, c3, c4, d1, d3, d4); + M[Z, Y] := -MatrixDetInternal(a1, a3, a4, b1, b3, b4, d1, d3, d4); + M[W, Y] := MatrixDetInternal(a1, a3, a4, b1, b3, b4, c1, c3, c4); + + M[X, Z] := MatrixDetInternal(b1, b2, b4, c1, c2, c4, d1, d2, d4); + M[Y, Z] := -MatrixDetInternal(a1, a2, a4, c1, c2, c4, d1, d2, d4); + M[Z, Z] := MatrixDetInternal(a1, a2, a4, b1, b2, b4, d1, d2, d4); + M[W, Z] := -MatrixDetInternal(a1, a2, a4, b1, b2, b4, c1, c2, c4); + + M[X, W] := -MatrixDetInternal(b1, b2, b3, c1, c2, c3, d1, d2, d3); + M[Y, W] := MatrixDetInternal(a1, a2, a3, c1, c2, c3, d1, d2, d3); + M[Z, W] := -MatrixDetInternal(a1, a2, a3, b1, b2, b3, d1, d2, d3); + M[W, W] := MatrixDetInternal(a1, a2, a3, b1, b2, b3, c1, c2, c3); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function MatrixDeterminant(M: TMatrix): Single; register; + +// Determinant of a 4x4 matrix + +var a1, a2, a3, a4, + b1, b2, b3, b4, + c1, c2, c3, c4, + d1, d2, d3, d4 : Single; + +begin + a1 := M[X, X]; b1 := M[X, Y]; c1 := M[X, Z]; d1 := M[X, W]; + a2 := M[Y, X]; b2 := M[Y, Y]; c2 := M[Y, Z]; d2 := M[Y, W]; + a3 := M[Z, X]; b3 := M[Z, Y]; c3 := M[Z, Z]; d3 := M[Z, W]; + a4 := M[W, X]; b4 := M[W, Y]; c4 := M[W, Z]; d4 := M[W, W]; + + Result := a1 * MatrixDetInternal(b2, b3, b4, c2, c3, c4, d2, d3, d4) - + b1 * MatrixDetInternal(a2, a3, a4, c2, c3, c4, d2, d3, d4) + + c1 * MatrixDetInternal(a2, a3, a4, b2, b3, b4, d2, d3, d4) - + d1 * MatrixDetInternal(a2, a3, a4, b2, b3, b4, c2, c3, c4); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure MatrixScale(var M: TMatrix; Factor: Single); register; + +// multiplies all elements of a 4x4 matrix with a factor + +var I, J: Integer; + +begin + for I := 0 to 3 do + for J := 0 to 3 do M[I, J] := M[I, J] * Factor; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure MatrixInvert(var M: TMatrix); register; + +// finds the inverse of a 4x4 matrix + +var Det: Single; + +begin + Det := MatrixDeterminant(M); + if Abs(Det) < EPSILON then M := IdentityMatrix + else + begin + MatrixAdjoint(M); + MatrixScale(M, 1 / Det); + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure MatrixTranspose(var M: TMatrix); register; + +// computes transpose of 4x4 matrix + +var I, J: Integer; + TM: TMatrix; + +begin + for I := 0 to 3 do + for J := 0 to 3 do TM[J, I] := M[I, J]; + M := TM; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure MatrixAffineTranspose(var M: TAffineMatrix); register; + +// computes transpose of 3x3 matrix + +var I, J: Integer; + TM: TAffineMatrix; + +begin + for I := 0 to 2 do + for J := 0 to 2 do TM[J, I] := M[I, J]; + M := TM; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function MatrixMultiply(M1, M2: TMatrix): TMatrix; register; + +// multiplies two 4x4 matrices + +var I, J: Integer; + TM: TMatrix; + +begin + for I := 0 to 3 do + for J := 0 to 3 do + TM[I, J] := M1[I, X] * M2[X, J] + + M1[I, Y] * M2[Y, J] + + M1[I, Z] * M2[Z, J] + + M1[I, W] * M2[W, J]; + Result := TM; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function CreateRotationMatrix(Axis: TVector3f; Angle: Single): TMatrix; register; + +// Creates a rotation matrix along the given Axis by the given Angle in radians. + +var cosine, + sine, + Len, + one_minus_cosine: Extended; + +begin + SinCos(Angle, Sine, Cosine); + one_minus_cosine := 1 - cosine; + Len := VectorNormalize(Axis); + + if Len = 0 then Result := IdentityMatrix + else + begin + Result[X, X] := (one_minus_cosine * Sqr(Axis[0])) + Cosine; + Result[X, Y] := (one_minus_cosine * Axis[0] * Axis[1]) - (Axis[2] * Sine); + Result[X, Z] := (one_minus_cosine * Axis[2] * Axis[0]) + (Axis[1] * Sine); + Result[X, W] := 0; + + Result[Y, X] := (one_minus_cosine * Axis[0] * Axis[1]) + (Axis[2] * Sine); + Result[Y, Y] := (one_minus_cosine * Sqr(Axis[1])) + Cosine; + Result[Y, Z] := (one_minus_cosine * Axis[1] * Axis[2]) - (Axis[0] * Sine); + Result[Y, W] := 0; + + Result[Z, X] := (one_minus_cosine * Axis[2] * Axis[0]) - (Axis[1] * Sine); + Result[Z, Y] := (one_minus_cosine * Axis[1] * Axis[2]) + (Axis[0] * Sine); + Result[Z, Z] := (one_minus_cosine * Sqr(Axis[2])) + Cosine; + Result[Z, W] := 0; + + Result[W, X] := 0; + Result[W, Y] := 0; + Result[W, Z] := 0; + Result[W, W] := 1; + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function ConvertRotation(Angles: TAffineVector): TVector; register; + +{ Turn a triplet of rotations about x, y, and z (in that order) into an + equivalent rotation around a single axis (all in radians). + + Rotation of the Angle t about the axis (X, Y, Z) is given by: + + | X^2 + (1-X^2) Cos(t), XY(1-Cos(t)) + Z Sin(t), XZ(1-Cos(t))-Y Sin(t) | + M = | XY(1-Cos(t))-Z Sin(t), Y^2 + (1-Y^2) Cos(t), YZ(1-Cos(t)) + X Sin(t) | + | XZ(1-Cos(t)) + Y Sin(t), YZ(1-Cos(t))-X Sin(t), Z^2 + (1-Z^2) Cos(t) | + + Rotation about the three axes (Angles a1, a2, a3) can be represented as + the product of the individual rotation matrices: + + | 1 0 0 | | Cos(a2) 0 -Sin(a2) | | Cos(a3) Sin(a3) 0 | + | 0 Cos(a1) Sin(a1) | * | 0 1 0 | * | -Sin(a3) Cos(a3) 0 | + | 0 -Sin(a1) Cos(a1) | | Sin(a2) 0 Cos(a2) | | 0 0 1 | + Mx My Mz + + We now want to solve for X, Y, Z, and t given 9 equations in 4 unknowns. + Using the diagonal elements of the two matrices, we get: + + X^2 + (1-X^2) Cos(t) = M[0][0] + Y^2 + (1-Y^2) Cos(t) = M[1][1] + Z^2 + (1-Z^2) Cos(t) = M[2][2] + + Adding the three equations, we get: + + X^2 + Y^2 + Z^2 - (M[0][0] + M[1][1] + M[2][2]) = + - (3 - X^2 - Y^2 - Z^2) Cos(t) + + Since (X^2 + Y^2 + Z^2) = 1, we can rewrite as: + + Cos(t) = (1 - (M[0][0] + M[1][1] + M[2][2])) / 2 + + Solving for t, we get: + + t = Acos(((M[0][0] + M[1][1] + M[2][2]) - 1) / 2) + + We can substitute t into the equations for X^2, Y^2, and Z^2 above + to get the values for X, Y, and Z. To find the proper signs we note + that: + + 2 X Sin(t) = M[1][2] - M[2][1] + 2 Y Sin(t) = M[2][0] - M[0][2] + 2 Z Sin(t) = M[0][1] - M[1][0] +} + +var Axis1, Axis2: TVector3f; + M, M1, M2: TMatrix; + cost, cost1, + sint, + s1, s2, s3: Single; + I: Integer; + + +begin + // see if we are only rotating about a single Axis + if Abs(Angles[X]) < EPSILON then + begin + if Abs(Angles[Y]) < EPSILON then + begin + Result := MakeVector([0, 0, 1, Angles[Z]]); + Exit; + end + else + if Abs(Angles[Z]) < EPSILON then + begin + Result := MakeVector([0, 1, 0, Angles[Y]]); + Exit; + end + end + else + if (Abs(Angles[Y]) < EPSILON) and + (Abs(Angles[Z]) < EPSILON) then + begin + Result := MakeVector([1, 0, 0, Angles[X]]); + Exit; + end; + + // make the rotation matrix + Axis1 := MakeAffineVector([1, 0, 0]); + M := CreateRotationMatrix(Axis1, Angles[X]); + + Axis2 := MakeAffineVector([0, 1, 0]); + M2 := CreateRotationMatrix(Axis2, Angles[Y]); + M1 := MatrixMultiply(M, M2); + + Axis2 := MakeAffineVector([0, 0, 1]); + M2 := CreateRotationMatrix(Axis2, Angles[Z]); + M := MatrixMultiply(M1, M2); + + cost := ((M[X, X] + M[Y, Y] + M[Z, Z])-1) / 2; + if cost < -1 then cost := -1 + else + if cost > 1 - EPSILON then + begin + // Bad Angle - this would cause a crash + Result := MakeVector([1, 0, 0, 0]); + Exit; + end; + + cost1 := 1 - cost; + Result := Makevector([Sqrt((M[X, X]-cost) / cost1), + Sqrt((M[Y, Y]-cost) / cost1), + sqrt((M[Z, Z]-cost) / cost1), + arccos(cost)]); + + sint := 2 * Sqrt(1 - cost * cost); // This is actually 2 Sin(t) + + // Determine the proper signs + for I := 0 to 7 do + begin + if (I and 1) > 1 then s1 := -1 else s1 := 1; + if (I and 2) > 1 then s2 := -1 else s2 := 1; + if (I and 4) > 1 then s3 := -1 else s3 := 1; + if (Abs(s1 * Result[X] * sint-M[Y, Z] + M[Z, Y]) < EPSILON2) and + (Abs(s2 * Result[Y] * sint-M[Z, X] + M[X, Z]) < EPSILON2) and + (Abs(s3 * Result[Z] * sint-M[X, Y] + M[Y, X]) < EPSILON2) then + begin + // We found the right combination of signs + Result[X] := Result[X] * s1; + Result[Y] := Result[Y] * s2; + Result[Z] := Result[Z] * s3; + Exit; + end; + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function CreateRotationMatrixX(Sine, Cosine: Single): TMatrix; register; + +// creates matrix for rotation about x-axis + +begin + Result := EmptyMatrix; + Result[X, X] := 1; + Result[Y, Y] := Cosine; + Result[Y, Z] := Sine; + Result[Z, Y] := -Sine; + Result[Z, Z] := Cosine; + Result[W, W] := 1; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function CreateRotationMatrixY(Sine, Cosine: Single): TMatrix; register; + +// creates matrix for rotation about y-axis + +begin + Result := EmptyMatrix; + Result[X, X] := Cosine; + Result[X, Z] := -Sine; + Result[Y, Y] := 1; + Result[Z, X] := Sine; + Result[Z, Z] := Cosine; + Result[W, W] := 1; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function CreateRotationMatrixZ(Sine, Cosine: Single): TMatrix; register; + +// creates matrix for rotation about z-axis + +begin + Result := EmptyMatrix; + Result[X, X] := Cosine; + Result[X, Y] := Sine; + Result[Y, X] := -Sine; + Result[Y, Y] := Cosine; + Result[Z, Z] := 1; + Result[W, W] := 1; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function CreateScaleMatrix(V: TAffineVector): TMatrix; register; + +// creates scaling matrix + +begin + Result := IdentityMatrix; + Result[X, X] := V[X]; + Result[Y, Y] := V[Y]; + Result[Z, Z] := V[Z]; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function CreateTranslationMatrix(V: TVector): TMatrix; register; + +// creates translation matrix + +begin + Result := IdentityMatrix; + Result[W, X] := V[X]; + Result[W, Y] := V[Y]; + Result[W, Z] := V[Z]; + Result[W, W] := V[W]; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function Lerp(Start, Stop, t: Single): Single; + +// calculates linear interpolation between start and stop at point t + +begin + Result := Start + (Stop - Start) * t; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorAffineLerp(V1, V2: TAffineVector; t: Single): TAffineVector; + +// calculates linear interpolation between vector1 and vector2 at point t + +begin + Result[X] := Lerp(V1[X], V2[X], t); + Result[Y] := Lerp(V1[Y], V2[Y], t); + Result[Z] := Lerp(V1[Z], V2[Z], t); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorLerp(V1, V2: TVector; t: Single): TVector; + +// calculates linear interpolation between vector1 and vector2 at point t + +begin + Result[X] := Lerp(V1[X], V2[X], t); + Result[Y] := Lerp(V1[Y], V2[Y], t); + Result[Z] := Lerp(V1[Z], V2[Z], t); + Result[W] := Lerp(V1[W], V2[W], t); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function QuaternionSlerp(QStart, QEnd: TQuaternion; Spin: Integer; t: Single): TQuaternion; + +// spherical linear interpolation of unit quaternions with spins +// QStart, QEnd - start and end unit quaternions +// t - interpolation parameter (0 to 1) +// Spin - number of extra spin rotations to involve + +var beta, // complementary interp parameter + theta, // Angle between A and B + sint, cost, // sine, cosine of theta + phi: Single; // theta plus spins + bflip: Boolean; // use negativ t? + + +begin + // cosine theta + cost := VectorAngle(QStart.ImagPart, QEnd.ImagPart); + + // if QEnd is on opposite hemisphere from QStart, use -QEnd instead + if cost < 0 then + begin + cost := -cost; + bflip := True; + end + else bflip := False; + + // if QEnd is (within precision limits) the same as QStart, + // just linear interpolate between QStart and QEnd. + // Can't do spins, since we don't know what direction to spin. + + if (1 - cost) < EPSILON then beta := 1 - t + else + begin + // normal case + theta := arccos(cost); + phi := theta + Spin * Pi; + sint := sin(theta); + beta := sin(theta - t * phi) / sint; + t := sin(t * phi) / sint; + end; + + if bflip then t := -t; + + // interpolate + Result.ImagPart[X] := beta * QStart.ImagPart[X] + t * QEnd.ImagPart[X]; + Result.ImagPart[Y] := beta * QStart.ImagPart[Y] + t * QEnd.ImagPart[Y]; + Result.ImagPart[Z] := beta * QStart.ImagPart[Z] + t * QEnd.ImagPart[Z]; + Result.RealPart := beta * QStart.RealPart + t * QEnd.RealPart; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorAffineCombine(V1, V2: TAffineVector; F1, F2: Single): TAffineVector; + +// makes a linear combination of two vectors and return the result + +begin + Result[X] := (F1 * V1[X]) + (F2 * V2[X]); + Result[Y] := (F1 * V1[Y]) + (F2 * V2[Y]); + Result[Z] := (F1 * V1[Z]) + (F2 * V2[Z]); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorCombine(V1, V2: TVector; F1, F2: Single): TVector; + +// makes a linear combination of two vectors and return the result + +begin + Result[X] := (F1 * V1[X]) + (F2 * V2[X]); + Result[Y] := (F1 * V1[Y]) + (F2 * V2[Y]); + Result[Z] := (F1 * V1[Z]) + (F2 * V2[Z]); + Result[W] := (F1 * V1[W]) + (F2 * V2[W]); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function MatrixDecompose(M: TMatrix; var Tran: TTransformations): Boolean; register; + +// Author: Spencer W. Thomas, University of Michigan +// +// MatrixDecompose - Decompose a non-degenerated 4x4 transformation matrix into +// the sequence of transformations that produced it. +// +// The coefficient of each transformation is returned in the corresponding +// element of the vector Tran. +// +// Returns true upon success, false if the matrix is singular. + +var I, J: Integer; + LocMat, + pmat, + invpmat, + tinvpmat: TMatrix; + prhs, + psol: TVector; + Row: array[0..2] of TAffineVector; + +begin + Result := False; + locmat := M; + // normalize the matrix + if locmat[W, W] = 0 then Exit; + for I := 0 to 3 do + for J := 0 to 3 do + locmat[I, J] := locmat[I, J] / locmat[W, W]; + + // pmat is used to solve for perspective, but it also provides + // an easy way to test for singularity of the upper 3x3 component. + + pmat := locmat; + for I := 0 to 2 do pmat[I, W] := 0; + pmat[W, W] := 1; + + if MatrixDeterminant(pmat) = 0 then Exit; + + // First, isolate perspective. This is the messiest. + if (locmat[X, W] <> 0) or + (locmat[Y, W] <> 0) or + (locmat[Z, W] <> 0) then + begin + // prhs is the right hand side of the equation. + prhs[X] := locmat[X, W]; + prhs[Y] := locmat[Y, W]; + prhs[Z] := locmat[Z, W]; + prhs[W] := locmat[W, W]; + + // Solve the equation by inverting pmat and multiplying + // prhs by the inverse. (This is the easiest way, not + // necessarily the best.) + + invpmat := pmat; + MatrixInvert(invpmat); + MatrixTranspose(invpmat); + psol := VectorTransform(prhs, tinvpmat); + + // stuff the answer away + Tran[ttPerspectiveX] := psol[X]; + Tran[ttPerspectiveY] := psol[Y]; + Tran[ttPerspectiveZ] := psol[Z]; + Tran[ttPerspectiveW] := psol[W]; + + // clear the perspective partition + locmat[X, W] := 0; + locmat[Y, W] := 0; + locmat[Z, W] := 0; + locmat[W, W] := 1; + end + else + begin + // no perspective + Tran[ttPerspectiveX] := 0; + Tran[ttPerspectiveY] := 0; + Tran[ttPerspectiveZ] := 0; + Tran[ttPerspectiveW] := 0; + end; + + // next take care of translation (easy) + for I := 0 to 2 do + begin + Tran[TTransType(Ord(ttTranslateX) + I)] := locmat[W, I]; + locmat[W, I] := 0; + end; + + // now get scale and shear + for I := 0 to 2 do + begin + row[I, X] := locmat[I, X]; + row[I, Y] := locmat[I, Y]; + row[I, Z] := locmat[I, Z]; + end; + + // compute X scale factor and normalize first row + Tran[ttScaleX] := Sqr(VectorNormalize(row[0])); // ml: calculation optimized + + // compute XY shear factor and make 2nd row orthogonal to 1st + Tran[ttShearXY] := VectorAffineDotProduct(row[0], row[1]); + row[1] := VectorAffineCombine(row[1], row[0], 1, -Tran[ttShearXY]); + + // now, compute Y scale and normalize 2nd row + Tran[ttScaleY] := Sqr(VectorNormalize(row[1])); // ml: calculation optimized + Tran[ttShearXY] := Tran[ttShearXY]/Tran[ttScaleY]; + + // compute XZ and YZ shears, orthogonalize 3rd row + Tran[ttShearXZ] := VectorAffineDotProduct(row[0], row[2]); + row[2] := VectorAffineCombine(row[2], row[0], 1, -Tran[ttShearXZ]); + Tran[ttShearYZ] := VectorAffineDotProduct(row[1], row[2]); + row[2] := VectorAffineCombine(row[2], row[1], 1, -Tran[ttShearYZ]); + + // next, get Z scale and normalize 3rd row + Tran[ttScaleZ] := Sqr(VectorNormalize(row[1])); // (ML) calc. optimized + Tran[ttShearXZ] := Tran[ttShearXZ] / tran[ttScaleZ]; + Tran[ttShearYZ] := Tran[ttShearYZ] / Tran[ttScaleZ]; + + // At this point, the matrix (in rows[]) is orthonormal. + // Check for a coordinate system flip. If the determinant + // is -1, then negate the matrix and the scaling factors. + if VectorAffineDotProduct(row[0], VectorCrossProduct(row[1], row[2])) < 0 then + for I := 0 to 2 do + begin + Tran[TTransType(Ord(ttScaleX) + I)] := -Tran[TTransType(Ord(ttScaleX) + I)]; + row[I, X] := -row[I, X]; + row[I, Y] := -row[I, Y]; + row[I, Z] := -row[I, Z]; + end; + + // now, get the rotations out, as described in the gem + Tran[ttRotateY] := arcsin(-row[0, Z]); + if cos(Tran[ttRotateY]) <> 0 then + begin + Tran[ttRotateX] := arctan2(row[1, Z], row[2, Z]); + Tran[ttRotateZ] := arctan2(row[0, Y], row[0, X]); + end + else + begin + tran[ttRotateX] := arctan2(row[1, X], row[1, Y]); + tran[ttRotateZ] := 0; + end; + // All done! + Result := True; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorDblToFlt(V: THomogeneousDblVector): THomogeneousVector; assembler; + +// converts a vector containing double sized values into a vector with single sized values + +asm + FLD QWORD PTR [EAX] + FSTP DWORD PTR [EDX] + FLD QWORD PTR [EAX + 8] + FSTP DWORD PTR [EDX + 4] + FLD QWORD PTR [EAX + 16] + FSTP DWORD PTR [EDX + 8] + FLD QWORD PTR [EAX + 24] + FSTP DWORD PTR [EDX + 12] +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorAffineDblToFlt(V: TAffineDblVector): TAffineVector; assembler; + +// converts a vector containing double sized values into a vector with single sized values + +asm + FLD QWORD PTR [EAX] + FSTP DWORD PTR [EDX] + FLD QWORD PTR [EAX + 8] + FSTP DWORD PTR [EDX + 4] + FLD QWORD PTR [EAX + 16] + FSTP DWORD PTR [EDX + 8] +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorAffineFltToDbl(V: TAffineVector): TAffineDblVector; assembler; + +// converts a vector containing single sized values into a vector with double sized values + +asm + FLD DWORD PTR [EAX] + FSTP QWORD PTR [EDX] + FLD DWORD PTR [EAX + 8] + FSTP QWORD PTR [EDX + 4] + FLD DWORD PTR [EAX + 16] + FSTP QWORD PTR [EDX + 8] +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function VectorFltToDbl(V: TVector): THomogeneousDblVector; assembler; + +// converts a vector containing single sized values into a vector with double sized values + +asm + FLD DWORD PTR [EAX] + FSTP QWORD PTR [EDX] + FLD DWORD PTR [EAX + 8] + FSTP QWORD PTR [EDX + 4] + FLD DWORD PTR [EAX + 16] + FSTP QWORD PTR [EDX + 8] + FLD DWORD PTR [EAX + 24] + FSTP QWORD PTR [EDX + 12] +end; + +//----------------- coordinate system manipulation functions ----------------------------------------------------------- + +function Turn(Matrix: TMatrix; Angle: Single): TMatrix; + +// rotates the given coordinate system (represented by the matrix) around its Y-axis + +begin + Result := MatrixMultiply(Matrix, CreateRotationMatrix(MakeAffineVector(Matrix[1]), Angle)); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function Turn(Matrix: TMatrix; MasterUp: TAffineVector; Angle: Single): TMatrix; + +// rotates the given coordinate system (represented by the matrix) around MasterUp + +begin + Result := MatrixMultiply(Matrix, CreateRotationMatrix(MasterUp, Angle)); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function Pitch(Matrix: TMatrix; Angle: Single): TMatrix; + +// rotates the given coordinate system (represented by the matrix) around its X-axis + +begin + Result := MatrixMultiply(Matrix, CreateRotationMatrix(MakeAffineVector(Matrix[0]), Angle)); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function Pitch(Matrix: TMatrix; MasterRight: TAffineVector; Angle: Single): TMatrix; overload; + +// rotates the given coordinate system (represented by the matrix) around MasterRight + +begin + Result := MatrixMultiply(Matrix, CreateRotationMatrix(MasterRight, Angle)); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function Roll(Matrix: TMatrix; Angle: Single): TMatrix; + +// rotates the given coordinate system (represented by the matrix) around its Z-axis + +begin + Result := MatrixMultiply(Matrix, CreateRotationMatrix(MakeAffineVector(Matrix[2]), Angle)); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function Roll(Matrix: TMatrix; MasterDirection: TAffineVector; Angle: Single): TMatrix; overload; + +// rotates the given coordinate system (represented by the matrix) around MasterDirection + +begin + Result := MatrixMultiply(Matrix, CreateRotationMatrix(MasterDirection, Angle)); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +end. + + diff --git a/Game/Code/lib/JEDI-SDL/OpenGL/Pas/gl.pas b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/gl.pas new file mode 100644 index 00000000..aa0dd169 --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/gl.pas @@ -0,0 +1,2294 @@ +unit gl; +{ + $Id: gl.pas,v 1.2 2004/08/14 22:54:30 savage Exp $ + + Adaption of the delphi3d.net OpenGL units to FreePascal + Sebastian Guenther (sg@freepascal.org) in 2002 + These units are free to use +} + +(*++ BUILD Version: 0004 // Increment this if a change has global effects + +Copyright (c) 1985-96, Microsoft Corporation + +Module Name: + + gl.h + +Abstract: + + Procedure declarations, constant definitions and macros for the OpenGL + component. + +--*) + +(* +** Copyright 1996 Silicon Graphics, Inc. +** All Rights Reserved. +** +** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.; +** the contents of this file may not be disclosed to third parties, copied or +** duplicated in any form, in whole or in part, without the prior written +** permission of Silicon Graphics, Inc. +** +** RESTRICTED RIGHTS LEGEND: +** Use, duplication or disclosure by the Government is subject to restrictions +** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data +** and Computer Software clause at DFARS 252.227-7013, and/or in similar or +** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - +** rights reserved under the Copyright Laws of the United States. +*) + +{******************************************************************************} +{ } +{ Converted to Delphi by Tom Nuydens (tom@delphi3d.net) } +{ For the latest updates, visit Delphi3D: http://www.delphi3d.net } +{ } +{ Modified for Delphi/Kylix and FreePascal } +{ by Dominique Louis ( Dominique@Savagesoftware.com.au) } +{ For the latest updates, visit JEDI-SDL : http://www.sf.net/projects/jedi-sdl } +{ } +{******************************************************************************} + +{ + $Log: gl.pas,v $ + Revision 1.2 2004/08/14 22:54:30 savage + Updated so that Library name defines are correctly defined for MacOS X. + + Revision 1.1 2004/03/30 21:53:54 savage + Moved to it's own folder. + + Revision 1.4 2004/02/20 17:09:55 savage + Code tidied up in gl, glu and glut, while extensions in glext.pas are now loaded using SDL_GL_GetProcAddress, thus making it more cross-platform compatible, but now more tied to SDL. + + Revision 1.3 2004/02/14 00:23:39 savage + As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. + + Revision 1.2 2004/02/14 00:09:18 savage + Changed uses to now make use of moduleloader.pas rather than dllfuncs.pas + + Revision 1.1 2004/02/05 00:08:19 savage + Module 1.0 release + + Revision 1.6 2003/06/02 12:32:12 savage + Modified Sources to avoid warnings with Delphi by moving CVS Logging to the top of the header files. Hopefully CVS Logging still works. + +} + +interface + +{$I jedi-sdl.inc} + +uses +{$IFDEF __GPC__} + system, + gpc, +{$ENDIF} + +{$IFDEF WIN32} + Windows, +{$ENDIF} + moduleloader; + + +var + LibGL: TModuleHandle; + +type + GLenum = Cardinal; PGLenum = ^GLenum; + GLboolean = Byte; PGLboolean = ^GLboolean; + GLbitfield = Cardinal; PGLbitfield = ^GLbitfield; + GLbyte = ShortInt; PGLbyte = ^GLbyte; + GLshort = SmallInt; PGLshort = ^GLshort; + GLint = Integer; PGLint = ^GLint; + GLsizei = Integer; PGLsizei = ^GLsizei; + GLubyte = Byte; PGLubyte = ^GLubyte; + GLushort = Word; PGLushort = ^GLushort; + GLuint = Cardinal; PGLuint = ^GLuint; + GLfloat = Single; PGLfloat = ^GLfloat; + GLclampf = Single; PGLclampf = ^GLclampf; + GLdouble = Double; PGLdouble = ^GLdouble; + GLclampd = Double; PGLclampd = ^GLclampd; +{ GLvoid = void; } PGLvoid = Pointer; + +{******************************************************************************} + +const +{$IFDEF WIN32} + GLLibName = 'OpenGL32.dll'; +{$ENDIF} + +{$IFDEF UNIX} +{$IFDEF DARWIN} + GLLibName = 'libGL.dylib'; +{$ELSE} + GLLibName = 'libGL.so'; +{$ENDIF} +{$ENDIF} + + // Version + GL_VERSION_1_1 = 1; + + // AccumOp + GL_ACCUM = $0100; + GL_LOAD = $0101; + GL_RETURN = $0102; + GL_MULT = $0103; + GL_ADD = $0104; + + // AlphaFunction + GL_NEVER = $0200; + GL_LESS = $0201; + GL_EQUAL = $0202; + GL_LEQUAL = $0203; + GL_GREATER = $0204; + GL_NOTEQUAL = $0205; + GL_GEQUAL = $0206; + GL_ALWAYS = $0207; + + // AttribMask + GL_CURRENT_BIT = $00000001; + GL_POINT_BIT = $00000002; + GL_LINE_BIT = $00000004; + GL_POLYGON_BIT = $00000008; + GL_POLYGON_STIPPLE_BIT = $00000010; + GL_PIXEL_MODE_BIT = $00000020; + GL_LIGHTING_BIT = $00000040; + GL_FOG_BIT = $00000080; + GL_DEPTH_BUFFER_BIT = $00000100; + GL_ACCUM_BUFFER_BIT = $00000200; + GL_STENCIL_BUFFER_BIT = $00000400; + GL_VIEWPORT_BIT = $00000800; + GL_TRANSFORM_BIT = $00001000; + GL_ENABLE_BIT = $00002000; + GL_COLOR_BUFFER_BIT = $00004000; + GL_HINT_BIT = $00008000; + GL_EVAL_BIT = $00010000; + GL_LIST_BIT = $00020000; + GL_TEXTURE_BIT = $00040000; + GL_SCISSOR_BIT = $00080000; + GL_ALL_ATTRIB_BITS = $000FFFFF; + + // BeginMode + GL_POINTS = $0000; + GL_LINES = $0001; + GL_LINE_LOOP = $0002; + GL_LINE_STRIP = $0003; + GL_TRIANGLES = $0004; + GL_TRIANGLE_STRIP = $0005; + GL_TRIANGLE_FAN = $0006; + GL_QUADS = $0007; + GL_QUAD_STRIP = $0008; + GL_POLYGON = $0009; + + // BlendingFactorDest + GL_ZERO = 0; + GL_ONE = 1; + GL_SRC_COLOR = $0300; + GL_ONE_MINUS_SRC_COLOR = $0301; + GL_SRC_ALPHA = $0302; + GL_ONE_MINUS_SRC_ALPHA = $0303; + GL_DST_ALPHA = $0304; + GL_ONE_MINUS_DST_ALPHA = $0305; + + // BlendingFactorSrc + // GL_ZERO + // GL_ONE + GL_DST_COLOR = $0306; + GL_ONE_MINUS_DST_COLOR = $0307; + GL_SRC_ALPHA_SATURATE = $0308; + // GL_SRC_ALPHA + // GL_ONE_MINUS_SRC_ALPHA + // GL_DST_ALPHA + // GL_ONE_MINUS_DST_ALPHA + + // Boolean + GL_TRUE = 1; + GL_FALSE = 0; + + // ClearBufferMask + // GL_COLOR_BUFFER_BIT + // GL_ACCUM_BUFFER_BIT + // GL_STENCIL_BUFFER_BIT + // GL_DEPTH_BUFFER_BIT + + // ClientArrayType + // GL_VERTEX_ARRAY + // GL_NORMAL_ARRAY + // GL_COLOR_ARRAY + // GL_INDEX_ARRAY + // GL_TEXTURE_COORD_ARRAY + // GL_EDGE_FLAG_ARRAY + + // ClipPlaneName + GL_CLIP_PLANE0 = $3000; + GL_CLIP_PLANE1 = $3001; + GL_CLIP_PLANE2 = $3002; + GL_CLIP_PLANE3 = $3003; + GL_CLIP_PLANE4 = $3004; + GL_CLIP_PLANE5 = $3005; + + // ColorMaterialFace + // GL_FRONT + // GL_BACK + // GL_FRONT_AND_BACK + + // ColorMaterialParameter + // GL_AMBIENT + // GL_DIFFUSE + // GL_SPECULAR + // GL_EMISSION + // GL_AMBIENT_AND_DIFFUSE + + // ColorPointerType + // GL_BYTE + // GL_UNSIGNED_BYTE + // GL_SHORT + // GL_UNSIGNED_SHORT + // GL_INT + // GL_UNSIGNED_INT + // GL_FLOAT + // GL_DOUBLE + + // CullFaceMode + // GL_FRONT + // GL_BACK + // GL_FRONT_AND_BACK + + // DataType + GL_BYTE = $1400; + GL_UNSIGNED_BYTE = $1401; + GL_SHORT = $1402; + GL_UNSIGNED_SHORT = $1403; + GL_INT = $1404; + GL_UNSIGNED_INT = $1405; + GL_FLOAT = $1406; + GL_2_BYTES = $1407; + GL_3_BYTES = $1408; + GL_4_BYTES = $1409; + GL_DOUBLE = $140A; + + // DepthFunction + // GL_NEVER + // GL_LESS + // GL_EQUAL + // GL_LEQUAL + // GL_GREATER + // GL_NOTEQUAL + // GL_GEQUAL + // GL_ALWAYS + + // DrawBufferMode + GL_NONE = 0; + GL_FRONT_LEFT = $0400; + GL_FRONT_RIGHT = $0401; + GL_BACK_LEFT = $0402; + GL_BACK_RIGHT = $0403; + GL_FRONT = $0404; + GL_BACK = $0405; + GL_LEFT = $0406; + GL_RIGHT = $0407; + GL_FRONT_AND_BACK = $0408; + GL_AUX0 = $0409; + GL_AUX1 = $040A; + GL_AUX2 = $040B; + GL_AUX3 = $040C; + + // Enable + // GL_FOG + // GL_LIGHTING + // GL_TEXTURE_1D + // GL_TEXTURE_2D + // GL_LINE_STIPPLE + // GL_POLYGON_STIPPLE + // GL_CULL_FACE + // GL_ALPHA_TEST + // GL_BLEND + // GL_INDEX_LOGIC_OP + // GL_COLOR_LOGIC_OP + // GL_DITHER + // GL_STENCIL_TEST + // GL_DEPTH_TEST + // GL_CLIP_PLANE0 + // GL_CLIP_PLANE1 + // GL_CLIP_PLANE2 + // GL_CLIP_PLANE3 + // GL_CLIP_PLANE4 + // GL_CLIP_PLANE5 + // GL_LIGHT0 + // GL_LIGHT1 + // GL_LIGHT2 + // GL_LIGHT3 + // GL_LIGHT4 + // GL_LIGHT5 + // GL_LIGHT6 + // GL_LIGHT7 + // GL_TEXTURE_GEN_S + // GL_TEXTURE_GEN_T + // GL_TEXTURE_GEN_R + // GL_TEXTURE_GEN_Q + // GL_MAP1_VERTEX_3 + // GL_MAP1_VERTEX_4 + // GL_MAP1_COLOR_4 + // GL_MAP1_INDEX + // GL_MAP1_NORMAL + // GL_MAP1_TEXTURE_COORD_1 + // GL_MAP1_TEXTURE_COORD_2 + // GL_MAP1_TEXTURE_COORD_3 + // GL_MAP1_TEXTURE_COORD_4 + // GL_MAP2_VERTEX_3 + // GL_MAP2_VERTEX_4 + // GL_MAP2_COLOR_4 + // GL_MAP2_INDEX + // GL_MAP2_NORMAL + // GL_MAP2_TEXTURE_COORD_1 + // GL_MAP2_TEXTURE_COORD_2 + // GL_MAP2_TEXTURE_COORD_3 + // GL_MAP2_TEXTURE_COORD_4 + // GL_POINT_SMOOTH + // GL_LINE_SMOOTH + // GL_POLYGON_SMOOTH + // GL_SCISSOR_TEST + // GL_COLOR_MATERIAL + // GL_NORMALIZE + // GL_AUTO_NORMAL + // GL_VERTEX_ARRAY + // GL_NORMAL_ARRAY + // GL_COLOR_ARRAY + // GL_INDEX_ARRAY + // GL_TEXTURE_COORD_ARRAY + // GL_EDGE_FLAG_ARRAY + // GL_POLYGON_OFFSET_POINT + // GL_POLYGON_OFFSET_LINE + // GL_POLYGON_OFFSET_FILL + + // ErrorCode + GL_NO_ERROR = 0; + GL_INVALID_ENUM = $0500; + GL_INVALID_VALUE = $0501; + GL_INVALID_OPERATION = $0502; + GL_STACK_OVERFLOW = $0503; + GL_STACK_UNDERFLOW = $0504; + GL_OUT_OF_MEMORY = $0505; + + // FeedBackMode + GL_2D = $0600; + GL_3D = $0601; + GL_3D_COLOR = $0602; + GL_3D_COLOR_TEXTURE = $0603; + GL_4D_COLOR_TEXTURE = $0604; + + // FeedBackToken + GL_PASS_THROUGH_TOKEN = $0700; + GL_POINT_TOKEN = $0701; + GL_LINE_TOKEN = $0702; + GL_POLYGON_TOKEN = $0703; + GL_BITMAP_TOKEN = $0704; + GL_DRAW_PIXEL_TOKEN = $0705; + GL_COPY_PIXEL_TOKEN = $0706; + GL_LINE_RESET_TOKEN = $0707; + + // FogMode + // GL_LINEAR + GL_EXP = $0800; + GL_EXP2 = $0801; + + // FogParameter + // GL_FOG_COLOR + // GL_FOG_DENSITY + // GL_FOG_END + // GL_FOG_INDEX + // GL_FOG_MODE + // GL_FOG_START + + // FrontFaceDirection + GL_CW = $0900; + GL_CCW = $0901; + + // GetMapTarget + GL_COEFF = $0A00; + GL_ORDER = $0A01; + GL_DOMAIN = $0A02; + + // GetPixelMap + // GL_PIXEL_MAP_I_TO_I + // GL_PIXEL_MAP_S_TO_S + // GL_PIXEL_MAP_I_TO_R + // GL_PIXEL_MAP_I_TO_G + // GL_PIXEL_MAP_I_TO_B + // GL_PIXEL_MAP_I_TO_A + // GL_PIXEL_MAP_R_TO_R + // GL_PIXEL_MAP_G_TO_G + // GL_PIXEL_MAP_B_TO_B + // GL_PIXEL_MAP_A_TO_A + + // GetPointerTarget + // GL_VERTEX_ARRAY_POINTER + // GL_NORMAL_ARRAY_POINTER + // GL_COLOR_ARRAY_POINTER + // GL_INDEX_ARRAY_POINTER + // GL_TEXTURE_COORD_ARRAY_POINTER + // GL_EDGE_FLAG_ARRAY_POINTER + + // GetTarget + GL_CURRENT_COLOR = $0B00; + GL_CURRENT_INDEX = $0B01; + GL_CURRENT_NORMAL = $0B02; + GL_CURRENT_TEXTURE_COORDS = $0B03; + GL_CURRENT_RASTER_COLOR = $0B04; + GL_CURRENT_RASTER_INDEX = $0B05; + GL_CURRENT_RASTER_TEXTURE_COORDS = $0B06; + GL_CURRENT_RASTER_POSITION = $0B07; + GL_CURRENT_RASTER_POSITION_VALID = $0B08; + GL_CURRENT_RASTER_DISTANCE = $0B09; + GL_POINT_SMOOTH = $0B10; + GL_POINT_SIZE = $0B11; + GL_POINT_SIZE_RANGE = $0B12; + GL_POINT_SIZE_GRANULARITY = $0B13; + GL_LINE_SMOOTH = $0B20; + GL_LINE_WIDTH = $0B21; + GL_LINE_WIDTH_RANGE = $0B22; + GL_LINE_WIDTH_GRANULARITY = $0B23; + GL_LINE_STIPPLE = $0B24; + GL_LINE_STIPPLE_PATTERN = $0B25; + GL_LINE_STIPPLE_REPEAT = $0B26; + GL_LIST_MODE = $0B30; + GL_MAX_LIST_NESTING = $0B31; + GL_LIST_BASE = $0B32; + GL_LIST_INDEX = $0B33; + GL_POLYGON_MODE = $0B40; + GL_POLYGON_SMOOTH = $0B41; + GL_POLYGON_STIPPLE = $0B42; + GL_EDGE_FLAG = $0B43; + GL_CULL_FACE = $0B44; + GL_CULL_FACE_MODE = $0B45; + GL_FRONT_FACE = $0B46; + GL_LIGHTING = $0B50; + GL_LIGHT_MODEL_LOCAL_VIEWER = $0B51; + GL_LIGHT_MODEL_TWO_SIDE = $0B52; + GL_LIGHT_MODEL_AMBIENT = $0B53; + GL_SHADE_MODEL = $0B54; + GL_COLOR_MATERIAL_FACE = $0B55; + GL_COLOR_MATERIAL_PARAMETER = $0B56; + GL_COLOR_MATERIAL = $0B57; + GL_FOG = $0B60; + GL_FOG_INDEX = $0B61; + GL_FOG_DENSITY = $0B62; + GL_FOG_START = $0B63; + GL_FOG_END = $0B64; + GL_FOG_MODE = $0B65; + GL_FOG_COLOR = $0B66; + GL_DEPTH_RANGE = $0B70; + GL_DEPTH_TEST = $0B71; + GL_DEPTH_WRITEMASK = $0B72; + GL_DEPTH_CLEAR_VALUE = $0B73; + GL_DEPTH_FUNC = $0B74; + GL_ACCUM_CLEAR_VALUE = $0B80; + GL_STENCIL_TEST = $0B90; + GL_STENCIL_CLEAR_VALUE = $0B91; + GL_STENCIL_FUNC = $0B92; + GL_STENCIL_VALUE_MASK = $0B93; + GL_STENCIL_FAIL = $0B94; + GL_STENCIL_PASS_DEPTH_FAIL = $0B95; + GL_STENCIL_PASS_DEPTH_PASS = $0B96; + GL_STENCIL_REF = $0B97; + GL_STENCIL_WRITEMASK = $0B98; + GL_MATRIX_MODE = $0BA0; + GL_NORMALIZE = $0BA1; + GL_VIEWPORT = $0BA2; + GL_MODELVIEW_STACK_DEPTH = $0BA3; + GL_PROJECTION_STACK_DEPTH = $0BA4; + GL_TEXTURE_STACK_DEPTH = $0BA5; + GL_MODELVIEW_MATRIX = $0BA6; + GL_PROJECTION_MATRIX = $0BA7; + GL_TEXTURE_MATRIX = $0BA8; + GL_ATTRIB_STACK_DEPTH = $0BB0; + GL_CLIENT_ATTRIB_STACK_DEPTH = $0BB1; + GL_ALPHA_TEST = $0BC0; + GL_ALPHA_TEST_FUNC = $0BC1; + GL_ALPHA_TEST_REF = $0BC2; + GL_DITHER = $0BD0; + GL_BLEND_DST = $0BE0; + GL_BLEND_SRC = $0BE1; + GL_BLEND = $0BE2; + GL_LOGIC_OP_MODE = $0BF0; + GL_INDEX_LOGIC_OP = $0BF1; + GL_COLOR_LOGIC_OP = $0BF2; + GL_AUX_BUFFERS = $0C00; + GL_DRAW_BUFFER = $0C01; + GL_READ_BUFFER = $0C02; + GL_SCISSOR_BOX = $0C10; + GL_SCISSOR_TEST = $0C11; + GL_INDEX_CLEAR_VALUE = $0C20; + GL_INDEX_WRITEMASK = $0C21; + GL_COLOR_CLEAR_VALUE = $0C22; + GL_COLOR_WRITEMASK = $0C23; + GL_INDEX_MODE = $0C30; + GL_RGBA_MODE = $0C31; + GL_DOUBLEBUFFER = $0C32; + GL_STEREO = $0C33; + GL_RENDER_MODE = $0C40; + GL_PERSPECTIVE_CORRECTION_HINT = $0C50; + GL_POINT_SMOOTH_HINT = $0C51; + GL_LINE_SMOOTH_HINT = $0C52; + GL_POLYGON_SMOOTH_HINT = $0C53; + GL_FOG_HINT = $0C54; + GL_TEXTURE_GEN_S = $0C60; + GL_TEXTURE_GEN_T = $0C61; + GL_TEXTURE_GEN_R = $0C62; + GL_TEXTURE_GEN_Q = $0C63; + GL_PIXEL_MAP_I_TO_I = $0C70; + GL_PIXEL_MAP_S_TO_S = $0C71; + GL_PIXEL_MAP_I_TO_R = $0C72; + GL_PIXEL_MAP_I_TO_G = $0C73; + GL_PIXEL_MAP_I_TO_B = $0C74; + GL_PIXEL_MAP_I_TO_A = $0C75; + GL_PIXEL_MAP_R_TO_R = $0C76; + GL_PIXEL_MAP_G_TO_G = $0C77; + GL_PIXEL_MAP_B_TO_B = $0C78; + GL_PIXEL_MAP_A_TO_A = $0C79; + GL_PIXEL_MAP_I_TO_I_SIZE = $0CB0; + GL_PIXEL_MAP_S_TO_S_SIZE = $0CB1; + GL_PIXEL_MAP_I_TO_R_SIZE = $0CB2; + GL_PIXEL_MAP_I_TO_G_SIZE = $0CB3; + GL_PIXEL_MAP_I_TO_B_SIZE = $0CB4; + GL_PIXEL_MAP_I_TO_A_SIZE = $0CB5; + GL_PIXEL_MAP_R_TO_R_SIZE = $0CB6; + GL_PIXEL_MAP_G_TO_G_SIZE = $0CB7; + GL_PIXEL_MAP_B_TO_B_SIZE = $0CB8; + GL_PIXEL_MAP_A_TO_A_SIZE = $0CB9; + GL_UNPACK_SWAP_BYTES = $0CF0; + GL_UNPACK_LSB_FIRST = $0CF1; + GL_UNPACK_ROW_LENGTH = $0CF2; + GL_UNPACK_SKIP_ROWS = $0CF3; + GL_UNPACK_SKIP_PIXELS = $0CF4; + GL_UNPACK_ALIGNMENT = $0CF5; + GL_PACK_SWAP_BYTES = $0D00; + GL_PACK_LSB_FIRST = $0D01; + GL_PACK_ROW_LENGTH = $0D02; + GL_PACK_SKIP_ROWS = $0D03; + GL_PACK_SKIP_PIXELS = $0D04; + GL_PACK_ALIGNMENT = $0D05; + GL_MAP_COLOR = $0D10; + GL_MAP_STENCIL = $0D11; + GL_INDEX_SHIFT = $0D12; + GL_INDEX_OFFSET = $0D13; + GL_RED_SCALE = $0D14; + GL_RED_BIAS = $0D15; + GL_ZOOM_X = $0D16; + GL_ZOOM_Y = $0D17; + GL_GREEN_SCALE = $0D18; + GL_GREEN_BIAS = $0D19; + GL_BLUE_SCALE = $0D1A; + GL_BLUE_BIAS = $0D1B; + GL_ALPHA_SCALE = $0D1C; + GL_ALPHA_BIAS = $0D1D; + GL_DEPTH_SCALE = $0D1E; + GL_DEPTH_BIAS = $0D1F; + GL_MAX_EVAL_ORDER = $0D30; + GL_MAX_LIGHTS = $0D31; + GL_MAX_CLIP_PLANES = $0D32; + GL_MAX_TEXTURE_SIZE = $0D33; + GL_MAX_PIXEL_MAP_TABLE = $0D34; + GL_MAX_ATTRIB_STACK_DEPTH = $0D35; + GL_MAX_MODELVIEW_STACK_DEPTH = $0D36; + GL_MAX_NAME_STACK_DEPTH = $0D37; + GL_MAX_PROJECTION_STACK_DEPTH = $0D38; + GL_MAX_TEXTURE_STACK_DEPTH = $0D39; + GL_MAX_VIEWPORT_DIMS = $0D3A; + GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = $0D3B; + GL_SUBPIXEL_BITS = $0D50; + GL_INDEX_BITS = $0D51; + GL_RED_BITS = $0D52; + GL_GREEN_BITS = $0D53; + GL_BLUE_BITS = $0D54; + GL_ALPHA_BITS = $0D55; + GL_DEPTH_BITS = $0D56; + GL_STENCIL_BITS = $0D57; + GL_ACCUM_RED_BITS = $0D58; + GL_ACCUM_GREEN_BITS = $0D59; + GL_ACCUM_BLUE_BITS = $0D5A; + GL_ACCUM_ALPHA_BITS = $0D5B; + GL_NAME_STACK_DEPTH = $0D70; + GL_AUTO_NORMAL = $0D80; + GL_MAP1_COLOR_4 = $0D90; + GL_MAP1_INDEX = $0D91; + GL_MAP1_NORMAL = $0D92; + GL_MAP1_TEXTURE_COORD_1 = $0D93; + GL_MAP1_TEXTURE_COORD_2 = $0D94; + GL_MAP1_TEXTURE_COORD_3 = $0D95; + GL_MAP1_TEXTURE_COORD_4 = $0D96; + GL_MAP1_VERTEX_3 = $0D97; + GL_MAP1_VERTEX_4 = $0D98; + GL_MAP2_COLOR_4 = $0DB0; + GL_MAP2_INDEX = $0DB1; + GL_MAP2_NORMAL = $0DB2; + GL_MAP2_TEXTURE_COORD_1 = $0DB3; + GL_MAP2_TEXTURE_COORD_2 = $0DB4; + GL_MAP2_TEXTURE_COORD_3 = $0DB5; + GL_MAP2_TEXTURE_COORD_4 = $0DB6; + GL_MAP2_VERTEX_3 = $0DB7; + GL_MAP2_VERTEX_4 = $0DB8; + GL_MAP1_GRID_DOMAIN = $0DD0; + GL_MAP1_GRID_SEGMENTS = $0DD1; + GL_MAP2_GRID_DOMAIN = $0DD2; + GL_MAP2_GRID_SEGMENTS = $0DD3; + GL_TEXTURE_1D = $0DE0; + GL_TEXTURE_2D = $0DE1; + GL_FEEDBACK_BUFFER_POINTER = $0DF0; + GL_FEEDBACK_BUFFER_SIZE = $0DF1; + GL_FEEDBACK_BUFFER_TYPE = $0DF2; + GL_SELECTION_BUFFER_POINTER = $0DF3; + GL_SELECTION_BUFFER_SIZE = $0DF4; + // GL_TEXTURE_BINDING_1D + // GL_TEXTURE_BINDING_2D + // GL_VERTEX_ARRAY + // GL_NORMAL_ARRAY + // GL_COLOR_ARRAY + // GL_INDEX_ARRAY + // GL_TEXTURE_COORD_ARRAY + // GL_EDGE_FLAG_ARRAY + // GL_VERTEX_ARRAY_SIZE + // GL_VERTEX_ARRAY_TYPE + // GL_VERTEX_ARRAY_STRIDE + // GL_NORMAL_ARRAY_TYPE + // GL_NORMAL_ARRAY_STRIDE + // GL_COLOR_ARRAY_SIZE + // GL_COLOR_ARRAY_TYPE + // GL_COLOR_ARRAY_STRIDE + // GL_INDEX_ARRAY_TYPE + // GL_INDEX_ARRAY_STRIDE + // GL_TEXTURE_COORD_ARRAY_SIZE + // GL_TEXTURE_COORD_ARRAY_TYPE + // GL_TEXTURE_COORD_ARRAY_STRIDE + // GL_EDGE_FLAG_ARRAY_STRIDE + // GL_POLYGON_OFFSET_FACTOR + // GL_POLYGON_OFFSET_UNITS + + // GetTextureParameter + // GL_TEXTURE_MAG_FILTER + // GL_TEXTURE_MIN_FILTER + // GL_TEXTURE_WRAP_S + // GL_TEXTURE_WRAP_T + GL_TEXTURE_WIDTH = $1000; + GL_TEXTURE_HEIGHT = $1001; + GL_TEXTURE_INTERNAL_FORMAT = $1003; + GL_TEXTURE_BORDER_COLOR = $1004; + GL_TEXTURE_BORDER = $1005; + // GL_TEXTURE_RED_SIZE + // GL_TEXTURE_GREEN_SIZE + // GL_TEXTURE_BLUE_SIZE + // GL_TEXTURE_ALPHA_SIZE + // GL_TEXTURE_LUMINANCE_SIZE + // GL_TEXTURE_INTENSITY_SIZE + // GL_TEXTURE_PRIORITY + // GL_TEXTURE_RESIDENT + + // HintMode + GL_DONT_CARE = $1100; + GL_FASTEST = $1101; + GL_NICEST = $1102; + + // HintTarget + // GL_PERSPECTIVE_CORRECTION_HINT + // GL_POINT_SMOOTH_HINT + // GL_LINE_SMOOTH_HINT + // GL_POLYGON_SMOOTH_HINT + // GL_FOG_HINT + + // IndexPointerType + // GL_SHORT + // GL_INT + // GL_FLOAT + // GL_DOUBLE + + // LightModelParameter + // GL_LIGHT_MODEL_AMBIENT + // GL_LIGHT_MODEL_LOCAL_VIEWER + // GL_LIGHT_MODEL_TWO_SIDE + + // LightName + GL_LIGHT0 = $4000; + GL_LIGHT1 = $4001; + GL_LIGHT2 = $4002; + GL_LIGHT3 = $4003; + GL_LIGHT4 = $4004; + GL_LIGHT5 = $4005; + GL_LIGHT6 = $4006; + GL_LIGHT7 = $4007; + + // LightParameter + GL_AMBIENT = $1200; + GL_DIFFUSE = $1201; + GL_SPECULAR = $1202; + GL_POSITION = $1203; + GL_SPOT_DIRECTION = $1204; + GL_SPOT_EXPONENT = $1205; + GL_SPOT_CUTOFF = $1206; + GL_CONSTANT_ATTENUATION = $1207; + GL_LINEAR_ATTENUATION = $1208; + GL_QUADRATIC_ATTENUATION = $1209; + + // InterleavedArrays + // GL_V2F + // GL_V3F + // GL_C4UB_V2F + // GL_C4UB_V3F + // GL_C3F_V3F + // GL_N3F_V3F + // GL_C4F_N3F_V3F + // GL_T2F_V3F + // GL_T4F_V4F + // GL_T2F_C4UB_V3F + // GL_T2F_C3F_V3F + // GL_T2F_N3F_V3F + // GL_T2F_C4F_N3F_V3F + // GL_T4F_C4F_N3F_V4F + + // ListMode + GL_COMPILE = $1300; + GL_COMPILE_AND_EXECUTE = $1301; + + // ListNameType + // GL_BYTE + // GL_UNSIGNED_BYTE + // GL_SHORT + // GL_UNSIGNED_SHORT + // GL_INT + // GL_UNSIGNED_INT + // GL_FLOAT + // GL_2_BYTES + // GL_3_BYTES + // GL_4_BYTES + + // LogicOp + GL_CLEAR = $1500; + GL_AND = $1501; + GL_AND_REVERSE = $1502; + GL_COPY = $1503; + GL_AND_INVERTED = $1504; + GL_NOOP = $1505; + GL_XOR = $1506; + GL_OR = $1507; + GL_NOR = $1508; + GL_EQUIV = $1509; + GL_INVERT = $150A; + GL_OR_REVERSE = $150B; + GL_COPY_INVERTED = $150C; + GL_OR_INVERTED = $150D; + GL_NAND = $150E; + GL_SET = $150F; + + // MapTarget + // GL_MAP1_COLOR_4 + // GL_MAP1_INDEX + // GL_MAP1_NORMAL + // GL_MAP1_TEXTURE_COORD_1 + // GL_MAP1_TEXTURE_COORD_2 + // GL_MAP1_TEXTURE_COORD_3 + // GL_MAP1_TEXTURE_COORD_4 + // GL_MAP1_VERTEX_3 + // GL_MAP1_VERTEX_4 + // GL_MAP2_COLOR_4 + // GL_MAP2_INDEX + // GL_MAP2_NORMAL + // GL_MAP2_TEXTURE_COORD_1 + // GL_MAP2_TEXTURE_COORD_2 + // GL_MAP2_TEXTURE_COORD_3 + // GL_MAP2_TEXTURE_COORD_4 + // GL_MAP2_VERTEX_3 + // GL_MAP2_VERTEX_4 + + // MaterialFace + // GL_FRONT + // GL_BACK + // GL_FRONT_AND_BACK + + // MaterialParameter + GL_EMISSION = $1600; + GL_SHININESS = $1601; + GL_AMBIENT_AND_DIFFUSE = $1602; + GL_COLOR_INDEXES = $1603; + // GL_AMBIENT + // GL_DIFFUSE + // GL_SPECULAR + + // MatrixMode + GL_MODELVIEW = $1700; + GL_PROJECTION = $1701; + GL_TEXTURE = $1702; + + // MeshMode1 + // GL_POINT + // GL_LINE + + // MeshMode2 + // GL_POINT + // GL_LINE + // GL_FILL + + // NormalPointerType + // GL_BYTE + // GL_SHORT + // GL_INT + // GL_FLOAT + // GL_DOUBLE + + // PixelCopyType + GL_COLOR = $1800; + GL_DEPTH = $1801; + GL_STENCIL = $1802; + + // PixelFormat + GL_COLOR_INDEX = $1900; + GL_STENCIL_INDEX = $1901; + GL_DEPTH_COMPONENT = $1902; + GL_RED = $1903; + GL_GREEN = $1904; + GL_BLUE = $1905; + GL_ALPHA = $1906; + GL_RGB = $1907; + GL_RGBA = $1908; + GL_LUMINANCE = $1909; + GL_LUMINANCE_ALPHA = $190A; + + // PixelMap + // GL_PIXEL_MAP_I_TO_I + // GL_PIXEL_MAP_S_TO_S + // GL_PIXEL_MAP_I_TO_R + // GL_PIXEL_MAP_I_TO_G + // GL_PIXEL_MAP_I_TO_B + // GL_PIXEL_MAP_I_TO_A + // GL_PIXEL_MAP_R_TO_R + // GL_PIXEL_MAP_G_TO_G + // GL_PIXEL_MAP_B_TO_B + // GL_PIXEL_MAP_A_TO_A + + // PixelStore + // GL_UNPACK_SWAP_BYTES + // GL_UNPACK_LSB_FIRST + // GL_UNPACK_ROW_LENGTH + // GL_UNPACK_SKIP_ROWS + // GL_UNPACK_SKIP_PIXELS + // GL_UNPACK_ALIGNMENT + // GL_PACK_SWAP_BYTES + // GL_PACK_LSB_FIRST + // GL_PACK_ROW_LENGTH + // GL_PACK_SKIP_ROWS + // GL_PACK_SKIP_PIXELS + // GL_PACK_ALIGNMENT + + // PixelTransfer + // GL_MAP_COLOR + // GL_MAP_STENCIL + // GL_INDEX_SHIFT + // GL_INDEX_OFFSET + // GL_RED_SCALE + // GL_RED_BIAS + // GL_GREEN_SCALE + // GL_GREEN_BIAS + // GL_BLUE_SCALE + // GL_BLUE_BIAS + // GL_ALPHA_SCALE + // GL_ALPHA_BIAS + // GL_DEPTH_SCALE + // GL_DEPTH_BIAS + + // PixelType + GL_BITMAP = $1A00; + // GL_BYTE + // GL_UNSIGNED_BYTE + // GL_SHORT + // GL_UNSIGNED_SHORT + // GL_INT + // GL_UNSIGNED_INT + // GL_FLOAT + + // PolygonMode + GL_POINT = $1B00; + GL_LINE = $1B01; + GL_FILL = $1B02; + + // ReadBufferMode + // GL_FRONT_LEFT + // GL_FRONT_RIGHT + // GL_BACK_LEFT + // GL_BACK_RIGHT + // GL_FRONT + // GL_BACK + // GL_LEFT + // GL_RIGHT + // GL_AUX0 + // GL_AUX1 + // GL_AUX2 + // GL_AUX3 + + // RenderingMode + GL_RENDER = $1C00; + GL_FEEDBACK = $1C01; + GL_SELECT = $1C02; + + // ShadingModel + GL_FLAT = $1D00; + GL_SMOOTH = $1D01; + + // StencilFunction + // GL_NEVER + // GL_LESS + // GL_EQUAL + // GL_LEQUAL + // GL_GREATER + // GL_NOTEQUAL + // GL_GEQUAL + // GL_ALWAYS + + // StencilOp + // GL_ZERO + GL_KEEP = $1E00; + GL_REPLACE = $1E01; + GL_INCR = $1E02; + GL_DECR = $1E03; + // GL_INVERT + + // StringName + GL_VENDOR = $1F00; + GL_RENDERER = $1F01; + GL_VERSION = $1F02; + GL_EXTENSIONS = $1F03; + + // TextureCoordName + GL_S = $2000; + GL_T = $2001; + GL_R = $2002; + GL_Q = $2003; + + // TexCoordPointerType + // GL_SHORT + // GL_INT + // GL_FLOAT + // GL_DOUBLE + + // TextureEnvMode + GL_MODULATE = $2100; + GL_DECAL = $2101; + // GL_BLEND + // GL_REPLACE + + // TextureEnvParameter + GL_TEXTURE_ENV_MODE = $2200; + GL_TEXTURE_ENV_COLOR = $2201; + + // TextureEnvTarget + GL_TEXTURE_ENV = $2300; + + // TextureGenMode + GL_EYE_LINEAR = $2400; + GL_OBJECT_LINEAR = $2401; + GL_SPHERE_MAP = $2402; + + // TextureGenParameter + GL_TEXTURE_GEN_MODE = $2500; + GL_OBJECT_PLANE = $2501; + GL_EYE_PLANE = $2502; + + // TextureMagFilter + GL_NEAREST = $2600; + GL_LINEAR = $2601; + + // TextureMinFilter + // GL_NEAREST + // GL_LINEAR + GL_NEAREST_MIPMAP_NEAREST = $2700; + GL_LINEAR_MIPMAP_NEAREST = $2701; + GL_NEAREST_MIPMAP_LINEAR = $2702; + GL_LINEAR_MIPMAP_LINEAR = $2703; + + // TextureParameterName + GL_TEXTURE_MAG_FILTER = $2800; + GL_TEXTURE_MIN_FILTER = $2801; + GL_TEXTURE_WRAP_S = $2802; + GL_TEXTURE_WRAP_T = $2803; + // GL_TEXTURE_BORDER_COLOR + // GL_TEXTURE_PRIORITY + + // TextureTarget + // GL_TEXTURE_1D + // GL_TEXTURE_2D + // GL_PROXY_TEXTURE_1D + // GL_PROXY_TEXTURE_2D + + // TextureWrapMode + GL_CLAMP = $2900; + GL_REPEAT = $2901; + + // VertexPointerType + // GL_SHORT + // GL_INT + // GL_FLOAT + // GL_DOUBLE + + // ClientAttribMask + GL_CLIENT_PIXEL_STORE_BIT = $00000001; + GL_CLIENT_VERTEX_ARRAY_BIT = $00000002; + GL_CLIENT_ALL_ATTRIB_BITS = $FFFFFFFF; + + // polygon_offset + GL_POLYGON_OFFSET_FACTOR = $8038; + GL_POLYGON_OFFSET_UNITS = $2A00; + GL_POLYGON_OFFSET_POINT = $2A01; + GL_POLYGON_OFFSET_LINE = $2A02; + GL_POLYGON_OFFSET_FILL = $8037; + + // texture + GL_ALPHA4 = $803B; + GL_ALPHA8 = $803C; + GL_ALPHA12 = $803D; + GL_ALPHA16 = $803E; + GL_LUMINANCE4 = $803F; + GL_LUMINANCE8 = $8040; + GL_LUMINANCE12 = $8041; + GL_LUMINANCE16 = $8042; + GL_LUMINANCE4_ALPHA4 = $8043; + GL_LUMINANCE6_ALPHA2 = $8044; + GL_LUMINANCE8_ALPHA8 = $8045; + GL_LUMINANCE12_ALPHA4 = $8046; + GL_LUMINANCE12_ALPHA12 = $8047; + GL_LUMINANCE16_ALPHA16 = $8048; + GL_INTENSITY = $8049; + GL_INTENSITY4 = $804A; + GL_INTENSITY8 = $804B; + GL_INTENSITY12 = $804C; + GL_INTENSITY16 = $804D; + GL_R3_G3_B2 = $2A10; + GL_RGB4 = $804F; + GL_RGB5 = $8050; + GL_RGB8 = $8051; + GL_RGB10 = $8052; + GL_RGB12 = $8053; + GL_RGB16 = $8054; + GL_RGBA2 = $8055; + GL_RGBA4 = $8056; + GL_RGB5_A1 = $8057; + GL_RGBA8 = $8058; + GL_RGB10_A2 = $8059; + GL_RGBA12 = $805A; + GL_RGBA16 = $805B; + GL_TEXTURE_RED_SIZE = $805C; + GL_TEXTURE_GREEN_SIZE = $805D; + GL_TEXTURE_BLUE_SIZE = $805E; + GL_TEXTURE_ALPHA_SIZE = $805F; + GL_TEXTURE_LUMINANCE_SIZE = $8060; + GL_TEXTURE_INTENSITY_SIZE = $8061; + GL_PROXY_TEXTURE_1D = $8063; + GL_PROXY_TEXTURE_2D = $8064; + + // texture_object + GL_TEXTURE_PRIORITY = $8066; + GL_TEXTURE_RESIDENT = $8067; + GL_TEXTURE_BINDING_1D = $8068; + GL_TEXTURE_BINDING_2D = $8069; + + // vertex_array + GL_VERTEX_ARRAY = $8074; + GL_NORMAL_ARRAY = $8075; + GL_COLOR_ARRAY = $8076; + GL_INDEX_ARRAY = $8077; + GL_TEXTURE_COORD_ARRAY = $8078; + GL_EDGE_FLAG_ARRAY = $8079; + GL_VERTEX_ARRAY_SIZE = $807A; + GL_VERTEX_ARRAY_TYPE = $807B; + GL_VERTEX_ARRAY_STRIDE = $807C; + GL_NORMAL_ARRAY_TYPE = $807E; + GL_NORMAL_ARRAY_STRIDE = $807F; + GL_COLOR_ARRAY_SIZE = $8081; + GL_COLOR_ARRAY_TYPE = $8082; + GL_COLOR_ARRAY_STRIDE = $8083; + GL_INDEX_ARRAY_TYPE = $8085; + GL_INDEX_ARRAY_STRIDE = $8086; + GL_TEXTURE_COORD_ARRAY_SIZE = $8088; + GL_TEXTURE_COORD_ARRAY_TYPE = $8089; + GL_TEXTURE_COORD_ARRAY_STRIDE = $808A; + GL_EDGE_FLAG_ARRAY_STRIDE = $808C; + GL_VERTEX_ARRAY_POINTER = $808E; + GL_NORMAL_ARRAY_POINTER = $808F; + GL_COLOR_ARRAY_POINTER = $8090; + GL_INDEX_ARRAY_POINTER = $8091; + GL_TEXTURE_COORD_ARRAY_POINTER = $8092; + GL_EDGE_FLAG_ARRAY_POINTER = $8093; + GL_V2F = $2A20; + GL_V3F = $2A21; + GL_C4UB_V2F = $2A22; + GL_C4UB_V3F = $2A23; + GL_C3F_V3F = $2A24; + GL_N3F_V3F = $2A25; + GL_C4F_N3F_V3F = $2A26; + GL_T2F_V3F = $2A27; + GL_T4F_V4F = $2A28; + GL_T2F_C4UB_V3F = $2A29; + GL_T2F_C3F_V3F = $2A2A; + GL_T2F_N3F_V3F = $2A2B; + GL_T2F_C4F_N3F_V3F = $2A2C; + GL_T4F_C4F_N3F_V4F = $2A2D; + + // Extensions + GL_EXT_vertex_array = 1; + GL_WIN_swap_hint = 1; + GL_EXT_bgra = 1; + GL_EXT_paletted_texture = 1; + + // EXT_vertex_array + GL_VERTEX_ARRAY_EXT = $8074; + GL_NORMAL_ARRAY_EXT = $8075; + GL_COLOR_ARRAY_EXT = $8076; + GL_INDEX_ARRAY_EXT = $8077; + GL_TEXTURE_COORD_ARRAY_EXT = $8078; + GL_EDGE_FLAG_ARRAY_EXT = $8079; + GL_VERTEX_ARRAY_SIZE_EXT = $807A; + GL_VERTEX_ARRAY_TYPE_EXT = $807B; + GL_VERTEX_ARRAY_STRIDE_EXT = $807C; + GL_VERTEX_ARRAY_COUNT_EXT = $807D; + GL_NORMAL_ARRAY_TYPE_EXT = $807E; + GL_NORMAL_ARRAY_STRIDE_EXT = $807F; + GL_NORMAL_ARRAY_COUNT_EXT = $8080; + GL_COLOR_ARRAY_SIZE_EXT = $8081; + GL_COLOR_ARRAY_TYPE_EXT = $8082; + GL_COLOR_ARRAY_STRIDE_EXT = $8083; + GL_COLOR_ARRAY_COUNT_EXT = $8084; + GL_INDEX_ARRAY_TYPE_EXT = $8085; + GL_INDEX_ARRAY_STRIDE_EXT = $8086; + GL_INDEX_ARRAY_COUNT_EXT = $8087; + GL_TEXTURE_COORD_ARRAY_SIZE_EXT = $8088; + GL_TEXTURE_COORD_ARRAY_TYPE_EXT = $8089; + GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = $808A; + GL_TEXTURE_COORD_ARRAY_COUNT_EXT = $808B; + GL_EDGE_FLAG_ARRAY_STRIDE_EXT = $808C; + GL_EDGE_FLAG_ARRAY_COUNT_EXT = $808D; + GL_VERTEX_ARRAY_POINTER_EXT = $808E; + GL_NORMAL_ARRAY_POINTER_EXT = $808F; + GL_COLOR_ARRAY_POINTER_EXT = $8090; + GL_INDEX_ARRAY_POINTER_EXT = $8091; + GL_TEXTURE_COORD_ARRAY_POINTER_EXT = $8092; + GL_EDGE_FLAG_ARRAY_POINTER_EXT = $8093; + GL_DOUBLE_EXT = GL_DOUBLE; + + // EXT_bgra + GL_BGR_EXT = $80E0; + GL_BGRA_EXT = $80E1; + + // EXT_paletted_texture + + // These must match the GL_COLOR_TABLE_*_SGI enumerants + GL_COLOR_TABLE_FORMAT_EXT = $80D8; + GL_COLOR_TABLE_WIDTH_EXT = $80D9; + GL_COLOR_TABLE_RED_SIZE_EXT = $80DA; + GL_COLOR_TABLE_GREEN_SIZE_EXT = $80DB; + GL_COLOR_TABLE_BLUE_SIZE_EXT = $80DC; + GL_COLOR_TABLE_ALPHA_SIZE_EXT = $80DD; + GL_COLOR_TABLE_LUMINANCE_SIZE_EXT = $80DE; + GL_COLOR_TABLE_INTENSITY_SIZE_EXT = $80DF; + + GL_COLOR_INDEX1_EXT = $80E2; + GL_COLOR_INDEX2_EXT = $80E3; + GL_COLOR_INDEX4_EXT = $80E4; + GL_COLOR_INDEX8_EXT = $80E5; + GL_COLOR_INDEX12_EXT = $80E6; + GL_COLOR_INDEX16_EXT = $80E7; + + // For compatibility with OpenGL v1.0 + GL_LOGIC_OP = GL_INDEX_LOGIC_OP; + GL_TEXTURE_COMPONENTS = GL_TEXTURE_INTERNAL_FORMAT; + +{******************************************************************************} + +var + glAccum: procedure(op: GLenum; value: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glAlphaFunc: procedure(func: GLenum; ref: GLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glAreTexturesResident: function (n: GLsizei; const textures: PGLuint; residences: PGLboolean): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glArrayElement: procedure(i: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBegin: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindTexture: procedure(target: GLenum; texture: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBitmap: procedure (width, height: GLsizei; xorig, yorig: GLfloat; xmove, ymove: GLfloat; const bitmap: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBlendFunc: procedure(sfactor, dfactor: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCallList: procedure(list: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCallLists: procedure(n: GLsizei; atype: GLenum; const lists: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glClear: procedure(mask: GLbitfield); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glClearAccum: procedure(red, green, blue, alpha: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glClearColor: procedure(red, green, blue, alpha: GLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glClearDepth: procedure(depth: GLclampd); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glClearIndex: procedure(c: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glClearStencil: procedure(s: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glClipPlane: procedure(plane: GLenum; const equation: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3b: procedure(red, green, blue: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3bv: procedure(const v: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3d: procedure(red, green, blue: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3f: procedure(red, green, blue: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3i: procedure(red, green, blue: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3s: procedure(red, green, blue: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3ub: procedure(red, green, blue: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3ubv: procedure(const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3ui: procedure(red, green, blue: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3uiv: procedure(const v: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3us: procedure(red, green, blue: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3usv: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4b: procedure(red, green, blue, alpha: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4bv: procedure(const v: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4d: procedure(red, green, blue, alpha: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4f: procedure(red, green, blue, alpha: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4i: procedure(red, green, blue, alpha: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4s: procedure(red, green, blue, alpha: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4ub: procedure(red, green, blue, alpha: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4ubv: procedure(const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4ui: procedure(red, green, blue, alpha: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4uiv: procedure(const v: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4us: procedure(red, green, blue, alpha: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4usv: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorMask: procedure(red, green, blue, alpha: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorMaterial: procedure(face, mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorPointer: procedure(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyPixels: procedure(x, y: GLint; width, height: GLsizei; atype: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyTexImage1D: procedure (target: GLenum; level: GLint; internalFormat: GLenum; x, y: GLint; width: GLsizei; border: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyTexImage2D: procedure(target: GLenum; level: GLint; internalFormat: GLenum; x, y: GLint; width, height: GLsizei; border: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyTexSubImage1D: procedure(target: GLenum; level, xoffset, x, y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyTexSubImage2D: procedure(target: GLenum; level, xoffset, yoffset, x, y: GLint; width, height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCullFace: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteLists: procedure(list: GLuint; range: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteTextures: procedure(n: GLsizei; const textures: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDepthFunc: procedure(func: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDepthMask: procedure(flag: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDepthRange: procedure(zNear, zFar: GLclampd); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDisable: procedure(cap: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDisableClientState: procedure(aarray: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawArrays: procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawBuffer: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawElements: procedure(mode: GLenum; count: GLsizei; atype: GLenum; const indices: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawPixels: procedure(width, height: GLsizei; format, atype: GLenum; const pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEdgeFlag: procedure(flag: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEdgeFlagPointer: procedure(stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEdgeFlagv: procedure(const flag: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEnable: procedure(cap: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEnableClientState: procedure(aarray: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEnd: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEndList: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord1d: procedure(u: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord1dv: procedure(const u: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord1f: procedure(u: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord1fv: procedure(const u: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord2d: procedure(u, v: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord2dv: procedure(const u: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord2f: procedure(u, v: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord2fv: procedure(const u: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalMesh1: procedure(mode: GLenum; i1, i2: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalMesh2: procedure(mode: GLenum; i1, i2, j1, j2: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalPoint1: procedure(i: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalPoint2: procedure(i, j: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFeedbackBuffer: procedure(size: GLsizei; atype: GLenum; buffer: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFinish: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFlush: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogfv: procedure(pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogi: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogiv: procedure(pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFrontFace: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFrustum: procedure(left, right, bottom, top, zNear, zFar: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenLists: function(range: GLsizei): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenTextures: procedure(n: GLsizei; textures: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetBooleanv: procedure(pname: GLenum; params: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetClipPlane: procedure(plane: GLenum; equation: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetDoublev: procedure(pname: GLenum; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetError: function: GLenum; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetFloatv: procedure(pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetIntegerv: procedure(pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetLightfv: procedure(light, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetLightiv: procedure(light, pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapdv: procedure(target, query: GLenum; v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapfv: procedure(target, query: GLenum; v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapiv: procedure(target, query: GLenum; v: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMaterialfv: procedure(face, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMaterialiv: procedure(face, pname: GLenum; params: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPixelMapfv: procedure(map: GLenum; values: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPixelMapuiv: procedure(map: GLenum; values: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPixelMapusv: procedure(map: GLenum; values: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPointerv: procedure(pname: GLenum; params: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPolygonStipple: procedure(mask: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetString: function(name: GLenum): PChar; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexEnvfv: procedure(target, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexEnviv: procedure(target, pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexGendv: procedure(coord, pname: GLenum; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexGenfv: procedure(coord, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexGeniv: procedure(coord, pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexImage: procedure(target: GLenum; level: GLint; format: GLenum; atype: GLenum; pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexLevelParameterfv: procedure(target: GLenum; level: GLint; pname: GLenum; params: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexLevelParameteriv: procedure(target: GLenum; level: GLint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexParameterfv: procedure(target, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexParameteriv: procedure(target, pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glHint: procedure(target, mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexMask: procedure(mask: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexPointer: procedure(atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexd: procedure(c: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexdv: procedure(const c: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexf: procedure(c: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexfv: procedure(const c: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexi: procedure(c: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexiv: procedure(const c: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexs: procedure(c: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexsv: procedure(const c: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexub: procedure(c: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexubv: procedure(const c: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glInitNames: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glInterleavedArrays: procedure(format: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsEnabled: function(cap: GLenum): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsList: function(list: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsTexture: function(texture: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightModelf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightModelfv: procedure(pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightModeli: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightModeliv: procedure(pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightf: procedure(light, pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightfv: procedure(light, pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLighti: procedure(light, pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightiv: procedure(light, pname: GLenum; const params: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLineStipple: procedure(factor: GLint; pattern: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLineWidth: procedure(width: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glListBase: procedure(base: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadIdentity: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadMatrixd: procedure(const m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadMatrixf: procedure(const m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadName: procedure(name: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLogicOp: procedure(opcode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMap1d: procedure(target: GLenum; u1, u2: GLdouble; stride, order: GLint; const points: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMap1f: procedure(target: GLenum; u1, u2: GLfloat; stride, order: GLint; const points: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMap2d: procedure(target: GLenum; u1, u2: GLdouble; ustride, uorder: GLint; v1, v2: GLdouble; vstride, vorder: GLint; const points: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMap2f: procedure(target: GLenum; u1, u2: GLfloat; ustride, uorder: GLint; v1, v2: GLfloat; vstride, vorder: GLint; const points: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapGrid1d: procedure(un: GLint; u1, u2: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapGrid1f: procedure(un: GLint; u1, u2: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapGrid2d: procedure(un: GLint; u1, u2: GLdouble; vn: GLint; v1, v2: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapGrid2f: procedure(un: GLint; u1, u2: GLfloat; vn: GLint; v1, v2: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMaterialf: procedure(face, pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMaterialfv: procedure(face, pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMateriali: procedure(face, pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMaterialiv: procedure(face, pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMatrixMode: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultMatrixd: procedure(const m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultMatrixf: procedure(const m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNewList: procedure(list: GLuint; mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3b: procedure(nx, ny, nz: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3bv: procedure(const v: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3d: procedure(nx, ny, nz: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3f: procedure(nx, ny, nz: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3i: procedure(nx, ny, nz: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3s: procedure(nx, ny, nz: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalPointer: procedure(atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glOrtho: procedure(left, right, bottom, top, zNear, zFar: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPassThrough: procedure(token: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelMapfv: procedure(map: GLenum; mapsize: GLsizei; const values: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelMapuiv: procedure(map: GLenum; mapsize: GLsizei; const values: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelMapusv: procedure(map: GLenum; mapsize: GLsizei; const values: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelStoref: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelStorei: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelTransferf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelTransferi: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelZoom: procedure(xfactor, yfactor: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPointSize: procedure(size: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPolygonMode: procedure(face, mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPolygonOffset: procedure(factor, units: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPolygonStipple: procedure(const mask: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPopAttrib: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPopClientAttrib: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPopMatrix: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPopName: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPrioritizeTextures: procedure(n: GLsizei; const textures: PGLuint; const priorities: PGLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPushAttrib: procedure(mask: GLbitfield); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPushClientAttrib: procedure(mask: GLbitfield); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPushMatrix: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPushName: procedure(name: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2d: procedure(x, y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2f: procedure(x, y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2i: procedure(x, y: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2s: procedure(x, y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3d: procedure(x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3f: procedure(x, y, z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3i: procedure(x, y, z: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3s: procedure(x, y, z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4d: procedure(x, y, z, w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4f: procedure(x, y, z, w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4i: procedure(x, y, z, w: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4s: procedure(x, y, z, w: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReadBuffer: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReadPixels: procedure(x, y: GLint; width, height: GLsizei; format, atype: GLenum; pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRectd: procedure(x1, y1, x2, y2: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRectdv: procedure(const v1: PGLdouble; const v2: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRectf: procedure(x1, y1, x2, y2: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRectfv: procedure(const v1: PGLfloat; const v2: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRecti: procedure(x1, y1, x2, y2: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRectiv: procedure(const v1: PGLint; const v2: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRects: procedure(x1, y1, x2, y2: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRectsv: procedure(const v1: PGLshort; const v2: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRenderMode: function(mode: GLint): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRotated: procedure(angle, x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRotatef: procedure(angle, x, y, z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glScaled: procedure(x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glScalef: procedure(x, y, z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glScissor: procedure(x, y: GLint; width, height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSelectBuffer: procedure(size: GLsizei; buffer: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glShadeModel: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glStencilFunc: procedure(func: GLenum; ref: GLint; mask: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glStencilMask: procedure(mask: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glStencilOp: procedure(fail, zfail, zpass: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1d: procedure(s: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1f: procedure(s: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1i: procedure(s: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1s: procedure(s: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2d: procedure(s, t: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2f: procedure(s, t: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2i: procedure(s, t: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2s: procedure(s, t: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3d: procedure(s, t, r: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3f: procedure(s, t, r: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3i: procedure(s, t, r: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3s: procedure(s, t, r: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4d: procedure(s, t, r, q: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4f: procedure(s, t, r, q: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4i: procedure(s, t, r, q: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4s: procedure(s, t, r, q: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoordPointer: procedure(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexEnvf: procedure(target: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexEnvfv: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexEnvi: procedure(target: GLenum; pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexEnviv: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGend: procedure(coord: GLenum; pname: GLenum; param: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGendv: procedure(coord: GLenum; pname: GLenum; const params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGenf: procedure(coord: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGenfv: procedure(coord: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGeni: procedure(coord: GLenum; pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGeniv: procedure(coord: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexImage1D: procedure(target: GLenum; level, internalformat: GLint; width: GLsizei; border: GLint; format, atype: GLenum; const pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexImage2D: procedure(target: GLenum; level, internalformat: GLint; width, height: GLsizei; border: GLint; format, atype: GLenum; const pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexParameterf: procedure(target: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexParameterfv: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexParameteri: procedure(target: GLenum; pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexParameteriv: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexSubImage1D: procedure(target: GLenum; level, xoffset: GLint; width: GLsizei; format, atype: GLenum; const pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexSubImage2D: procedure(target: GLenum; level, xoffset, yoffset: GLint; width, height: GLsizei; format, atype: GLenum; const pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTranslated: procedure(x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTranslatef: procedure(x, y, z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2d: procedure(x, y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2f: procedure(x, y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2i: procedure(x, y: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2s: procedure(x, y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3d: procedure(x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3f: procedure(x, y, z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3i: procedure(x, y, z: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3s: procedure(x, y, z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4d: procedure(x, y, z, w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4f: procedure(x, y, z, w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4i: procedure(x, y, z, w: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4s: procedure(x, y, z, w: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexPointer: procedure(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glViewport: procedure(x, y: GLint; width, height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + {$IFDEF Win32} + ChoosePixelFormat: function(DC: HDC; p2: PPixelFormatDescriptor): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + {$ENDIF} + +type + // EXT_vertex_array + PFNGLARRAYELEMENTEXTPROC = procedure(i: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLDRAWARRAYSEXTPROC = procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLVERTEXPOINTEREXTPROC = procedure(size: GLint; atype: GLenum; + stride, count: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLNORMALPOINTEREXTPROC = procedure(atype: GLenum; stride, count: GLsizei; + const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLCOLORPOINTEREXTPROC = procedure(size: GLint; atype: GLenum; stride, count: GLsizei; + const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLINDEXPOINTEREXTPROC = procedure(atype: GLenum; stride, count: GLsizei; + const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLTEXCOORDPOINTEREXTPROC = procedure(size: GLint; atype: GLenum; + stride, count: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLEDGEFLAGPOINTEREXTPROC = procedure(stride, count: GLsizei; + const pointer: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLGETPOINTERVEXTPROC = procedure(pname: GLenum; params: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLARRAYELEMENTARRAYEXTPROC = procedure(mode: GLenum; count: GLsizei; + const pi: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + + // WIN_swap_hint + PFNGLADDSWAPHINTRECTWINPROC = procedure(x, y: GLint; width, height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + + // EXT_paletted_texture + PFNGLCOLORTABLEEXTPROC = procedure(target, internalFormat: GLenum; width: GLsizei; + format, atype: GLenum; const data: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLCOLORSUBTABLEEXTPROC = procedure(target: GLenum; start, count: GLsizei; + format, atype: GLenum; const data: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLGETCOLORTABLEEXTPROC = procedure(target, format, atype: GLenum; data: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLGETCOLORTABLEPARAMETERIVEXTPROC = procedure(target, pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLGETCOLORTABLEPARAMETERFVEXTPROC = procedure(target, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +procedure LoadOpenGL( const dll: PChar ); +procedure FreeOpenGL; + +implementation + +procedure FreeOpenGL; +begin + + @glAccum := nil; + @glAlphaFunc := nil; + @glAreTexturesResident := nil; + @glArrayElement := nil; + @glBegin := nil; + @glBindTexture := nil; + @glBitmap := nil; + @glBlendFunc := nil; + @glCallList := nil; + @glCallLists := nil; + @glClear := nil; + @glClearAccum := nil; + @glClearColor := nil; + @glClearDepth := nil; + @glClearIndex := nil; + @glClearStencil := nil; + @glClipPlane := nil; + @glColor3b := nil; + @glColor3bv := nil; + @glColor3d := nil; + @glColor3dv := nil; + @glColor3f := nil; + @glColor3fv := nil; + @glColor3i := nil; + @glColor3iv := nil; + @glColor3s := nil; + @glColor3sv := nil; + @glColor3ub := nil; + @glColor3ubv := nil; + @glColor3ui := nil; + @glColor3uiv := nil; + @glColor3us := nil; + @glColor3usv := nil; + @glColor4b := nil; + @glColor4bv := nil; + @glColor4d := nil; + @glColor4dv := nil; + @glColor4f := nil; + @glColor4fv := nil; + @glColor4i := nil; + @glColor4iv := nil; + @glColor4s := nil; + @glColor4sv := nil; + @glColor4ub := nil; + @glColor4ubv := nil; + @glColor4ui := nil; + @glColor4uiv := nil; + @glColor4us := nil; + @glColor4usv := nil; + @glColorMask := nil; + @glColorMaterial := nil; + @glColorPointer := nil; + @glCopyPixels := nil; + @glCopyTexImage1D := nil; + @glCopyTexImage2D := nil; + @glCopyTexSubImage1D := nil; + @glCopyTexSubImage2D := nil; + @glCullFace := nil; + @glDeleteLists := nil; + @glDeleteTextures := nil; + @glDepthFunc := nil; + @glDepthMask := nil; + @glDepthRange := nil; + @glDisable := nil; + @glDisableClientState := nil; + @glDrawArrays := nil; + @glDrawBuffer := nil; + @glDrawElements := nil; + @glDrawPixels := nil; + @glEdgeFlag := nil; + @glEdgeFlagPointer := nil; + @glEdgeFlagv := nil; + @glEnable := nil; + @glEnableClientState := nil; + @glEnd := nil; + @glEndList := nil; + @glEvalCoord1d := nil; + @glEvalCoord1dv := nil; + @glEvalCoord1f := nil; + @glEvalCoord1fv := nil; + @glEvalCoord2d := nil; + @glEvalCoord2dv := nil; + @glEvalCoord2f := nil; + @glEvalCoord2fv := nil; + @glEvalMesh1 := nil; + @glEvalMesh2 := nil; + @glEvalPoint1 := nil; + @glEvalPoint2 := nil; + @glFeedbackBuffer := nil; + @glFinish := nil; + @glFlush := nil; + @glFogf := nil; + @glFogfv := nil; + @glFogi := nil; + @glFogiv := nil; + @glFrontFace := nil; + @glFrustum := nil; + @glGenLists := nil; + @glGenTextures := nil; + @glGetBooleanv := nil; + @glGetClipPlane := nil; + @glGetDoublev := nil; + @glGetError := nil; + @glGetFloatv := nil; + @glGetIntegerv := nil; + @glGetLightfv := nil; + @glGetLightiv := nil; + @glGetMapdv := nil; + @glGetMapfv := nil; + @glGetMapiv := nil; + @glGetMaterialfv := nil; + @glGetMaterialiv := nil; + @glGetPixelMapfv := nil; + @glGetPixelMapuiv := nil; + @glGetPixelMapusv := nil; + @glGetPointerv := nil; + @glGetPolygonStipple := nil; + @glGetString := nil; + @glGetTexEnvfv := nil; + @glGetTexEnviv := nil; + @glGetTexGendv := nil; + @glGetTexGenfv := nil; + @glGetTexGeniv := nil; + @glGetTexImage := nil; + @glGetTexLevelParameterfv := nil; + @glGetTexLevelParameteriv := nil; + @glGetTexParameterfv := nil; + @glGetTexParameteriv := nil; + @glHint := nil; + @glIndexMask := nil; + @glIndexPointer := nil; + @glIndexd := nil; + @glIndexdv := nil; + @glIndexf := nil; + @glIndexfv := nil; + @glIndexi := nil; + @glIndexiv := nil; + @glIndexs := nil; + @glIndexsv := nil; + @glIndexub := nil; + @glIndexubv := nil; + @glInitNames := nil; + @glInterleavedArrays := nil; + @glIsEnabled := nil; + @glIsList := nil; + @glIsTexture := nil; + @glLightModelf := nil; + @glLightModelfv := nil; + @glLightModeli := nil; + @glLightModeliv := nil; + @glLightf := nil; + @glLightfv := nil; + @glLighti := nil; + @glLightiv := nil; + @glLineStipple := nil; + @glLineWidth := nil; + @glListBase := nil; + @glLoadIdentity := nil; + @glLoadMatrixd := nil; + @glLoadMatrixf := nil; + @glLoadName := nil; + @glLogicOp := nil; + @glMap1d := nil; + @glMap1f := nil; + @glMap2d := nil; + @glMap2f := nil; + @glMapGrid1d := nil; + @glMapGrid1f := nil; + @glMapGrid2d := nil; + @glMapGrid2f := nil; + @glMaterialf := nil; + @glMaterialfv := nil; + @glMateriali := nil; + @glMaterialiv := nil; + @glMatrixMode := nil; + @glMultMatrixd := nil; + @glMultMatrixf := nil; + @glNewList := nil; + @glNormal3b := nil; + @glNormal3bv := nil; + @glNormal3d := nil; + @glNormal3dv := nil; + @glNormal3f := nil; + @glNormal3fv := nil; + @glNormal3i := nil; + @glNormal3iv := nil; + @glNormal3s := nil; + @glNormal3sv := nil; + @glNormalPointer := nil; + @glOrtho := nil; + @glPassThrough := nil; + @glPixelMapfv := nil; + @glPixelMapuiv := nil; + @glPixelMapusv := nil; + @glPixelStoref := nil; + @glPixelStorei := nil; + @glPixelTransferf := nil; + @glPixelTransferi := nil; + @glPixelZoom := nil; + @glPointSize := nil; + @glPolygonMode := nil; + @glPolygonOffset := nil; + @glPolygonStipple := nil; + @glPopAttrib := nil; + @glPopClientAttrib := nil; + @glPopMatrix := nil; + @glPopName := nil; + @glPrioritizeTextures := nil; + @glPushAttrib := nil; + @glPushClientAttrib := nil; + @glPushMatrix := nil; + @glPushName := nil; + @glRasterPos2d := nil; + @glRasterPos2dv := nil; + @glRasterPos2f := nil; + @glRasterPos2fv := nil; + @glRasterPos2i := nil; + @glRasterPos2iv := nil; + @glRasterPos2s := nil; + @glRasterPos2sv := nil; + @glRasterPos3d := nil; + @glRasterPos3dv := nil; + @glRasterPos3f := nil; + @glRasterPos3fv := nil; + @glRasterPos3i := nil; + @glRasterPos3iv := nil; + @glRasterPos3s := nil; + @glRasterPos3sv := nil; + @glRasterPos4d := nil; + @glRasterPos4dv := nil; + @glRasterPos4f := nil; + @glRasterPos4fv := nil; + @glRasterPos4i := nil; + @glRasterPos4iv := nil; + @glRasterPos4s := nil; + @glRasterPos4sv := nil; + @glReadBuffer := nil; + @glReadPixels := nil; + @glRectd := nil; + @glRectdv := nil; + @glRectf := nil; + @glRectfv := nil; + @glRecti := nil; + @glRectiv := nil; + @glRects := nil; + @glRectsv := nil; + @glRenderMode := nil; + @glRotated := nil; + @glRotatef := nil; + @glScaled := nil; + @glScalef := nil; + @glScissor := nil; + @glSelectBuffer := nil; + @glShadeModel := nil; + @glStencilFunc := nil; + @glStencilMask := nil; + @glStencilOp := nil; + @glTexCoord1d := nil; + @glTexCoord1dv := nil; + @glTexCoord1f := nil; + @glTexCoord1fv := nil; + @glTexCoord1i := nil; + @glTexCoord1iv := nil; + @glTexCoord1s := nil; + @glTexCoord1sv := nil; + @glTexCoord2d := nil; + @glTexCoord2dv := nil; + @glTexCoord2f := nil; + @glTexCoord2fv := nil; + @glTexCoord2i := nil; + @glTexCoord2iv := nil; + @glTexCoord2s := nil; + @glTexCoord2sv := nil; + @glTexCoord3d := nil; + @glTexCoord3dv := nil; + @glTexCoord3f := nil; + @glTexCoord3fv := nil; + @glTexCoord3i := nil; + @glTexCoord3iv := nil; + @glTexCoord3s := nil; + @glTexCoord3sv := nil; + @glTexCoord4d := nil; + @glTexCoord4dv := nil; + @glTexCoord4f := nil; + @glTexCoord4fv := nil; + @glTexCoord4i := nil; + @glTexCoord4iv := nil; + @glTexCoord4s := nil; + @glTexCoord4sv := nil; + @glTexCoordPointer := nil; + @glTexEnvf := nil; + @glTexEnvfv := nil; + @glTexEnvi := nil; + @glTexEnviv := nil; + @glTexGend := nil; + @glTexGendv := nil; + @glTexGenf := nil; + @glTexGenfv := nil; + @glTexGeni := nil; + @glTexGeniv := nil; + @glTexImage1D := nil; + @glTexImage2D := nil; + @glTexParameterf := nil; + @glTexParameterfv := nil; + @glTexParameteri := nil; + @glTexParameteriv := nil; + @glTexSubImage1D := nil; + @glTexSubImage2D := nil; + @glTranslated := nil; + @glTranslatef := nil; + @glVertex2d := nil; + @glVertex2dv := nil; + @glVertex2f := nil; + @glVertex2fv := nil; + @glVertex2i := nil; + @glVertex2iv := nil; + @glVertex2s := nil; + @glVertex2sv := nil; + @glVertex3d := nil; + @glVertex3dv := nil; + @glVertex3f := nil; + @glVertex3fv := nil; + @glVertex3i := nil; + @glVertex3iv := nil; + @glVertex3s := nil; + @glVertex3sv := nil; + @glVertex4d := nil; + @glVertex4dv := nil; + @glVertex4f := nil; + @glVertex4fv := nil; + @glVertex4i := nil; + @glVertex4iv := nil; + @glVertex4s := nil; + @glVertex4sv := nil; + @glVertexPointer := nil; + @glViewport := nil; + {$IFDEF Win32} + @ChoosePixelFormat := nil; + {$ENDIF} + + UnLoadModule(LibGL); + +end; + +procedure LoadOpenGL(const dll: PChar); +begin + + FreeOpenGL; + + if LoadModule( LibGL, dll ) then + begin + @glAccum := GetModuleSymbol(LibGL, 'glAccum'); + @glAlphaFunc := GetModuleSymbol(LibGL, 'glAlphaFunc'); + @glAreTexturesResident := GetModuleSymbol(LibGL, 'glAreTexturesResident'); + @glArrayElement := GetModuleSymbol(LibGL, 'glArrayElement'); + @glBegin := GetModuleSymbol(LibGL, 'glBegin'); + @glBindTexture := GetModuleSymbol(LibGL, 'glBindTexture'); + @glBitmap := GetModuleSymbol(LibGL, 'glBitmap'); + @glBlendFunc := GetModuleSymbol(LibGL, 'glBlendFunc'); + @glCallList := GetModuleSymbol(LibGL, 'glCallList'); + @glCallLists := GetModuleSymbol(LibGL, 'glCallLists'); + @glClear := GetModuleSymbol(LibGL, 'glClear'); + @glClearAccum := GetModuleSymbol(LibGL, 'glClearAccum'); + @glClearColor := GetModuleSymbol(LibGL, 'glClearColor'); + @glClearDepth := GetModuleSymbol(LibGL, 'glClearDepth'); + @glClearIndex := GetModuleSymbol(LibGL, 'glClearIndex'); + @glClearStencil := GetModuleSymbol(LibGL, 'glClearStencil'); + @glClipPlane := GetModuleSymbol(LibGL, 'glClipPlane'); + @glColor3b := GetModuleSymbol(LibGL, 'glColor3b'); + @glColor3bv := GetModuleSymbol(LibGL, 'glColor3bv'); + @glColor3d := GetModuleSymbol(LibGL, 'glColor3d'); + @glColor3dv := GetModuleSymbol(LibGL, 'glColor3dv'); + @glColor3f := GetModuleSymbol(LibGL, 'glColor3f'); + @glColor3fv := GetModuleSymbol(LibGL, 'glColor3fv'); + @glColor3i := GetModuleSymbol(LibGL, 'glColor3i'); + @glColor3iv := GetModuleSymbol(LibGL, 'glColor3iv'); + @glColor3s := GetModuleSymbol(LibGL, 'glColor3s'); + @glColor3sv := GetModuleSymbol(LibGL, 'glColor3sv'); + @glColor3ub := GetModuleSymbol(LibGL, 'glColor3ub'); + @glColor3ubv := GetModuleSymbol(LibGL, 'glColor3ubv'); + @glColor3ui := GetModuleSymbol(LibGL, 'glColor3ui'); + @glColor3uiv := GetModuleSymbol(LibGL, 'glColor3uiv'); + @glColor3us := GetModuleSymbol(LibGL, 'glColor3us'); + @glColor3usv := GetModuleSymbol(LibGL, 'glColor3usv'); + @glColor4b := GetModuleSymbol(LibGL, 'glColor4b'); + @glColor4bv := GetModuleSymbol(LibGL, 'glColor4bv'); + @glColor4d := GetModuleSymbol(LibGL, 'glColor4d'); + @glColor4dv := GetModuleSymbol(LibGL, 'glColor4dv'); + @glColor4f := GetModuleSymbol(LibGL, 'glColor4f'); + @glColor4fv := GetModuleSymbol(LibGL, 'glColor4fv'); + @glColor4i := GetModuleSymbol(LibGL, 'glColor4i'); + @glColor4iv := GetModuleSymbol(LibGL, 'glColor4iv'); + @glColor4s := GetModuleSymbol(LibGL, 'glColor4s'); + @glColor4sv := GetModuleSymbol(LibGL, 'glColor4sv'); + @glColor4ub := GetModuleSymbol(LibGL, 'glColor4ub'); + @glColor4ubv := GetModuleSymbol(LibGL, 'glColor4ubv'); + @glColor4ui := GetModuleSymbol(LibGL, 'glColor4ui'); + @glColor4uiv := GetModuleSymbol(LibGL, 'glColor4uiv'); + @glColor4us := GetModuleSymbol(LibGL, 'glColor4us'); + @glColor4usv := GetModuleSymbol(LibGL, 'glColor4usv'); + @glColorMask := GetModuleSymbol(LibGL, 'glColorMask'); + @glColorMaterial := GetModuleSymbol(LibGL, 'glColorMaterial'); + @glColorPointer := GetModuleSymbol(LibGL, 'glColorPointer'); + @glCopyPixels := GetModuleSymbol(LibGL, 'glCopyPixels'); + @glCopyTexImage1D := GetModuleSymbol(LibGL, 'glCopyTexImage1D'); + @glCopyTexImage2D := GetModuleSymbol(LibGL, 'glCopyTexImage2D'); + @glCopyTexSubImage1D := GetModuleSymbol(LibGL, 'glCopyTexSubImage1D'); + @glCopyTexSubImage2D := GetModuleSymbol(LibGL, 'glCopyTexSubImage2D'); + @glCullFace := GetModuleSymbol(LibGL, 'glCullFace'); + @glDeleteLists := GetModuleSymbol(LibGL, 'glDeleteLists'); + @glDeleteTextures := GetModuleSymbol(LibGL, 'glDeleteTextures'); + @glDepthFunc := GetModuleSymbol(LibGL, 'glDepthFunc'); + @glDepthMask := GetModuleSymbol(LibGL, 'glDepthMask'); + @glDepthRange := GetModuleSymbol(LibGL, 'glDepthRange'); + @glDisable := GetModuleSymbol(LibGL, 'glDisable'); + @glDisableClientState := GetModuleSymbol(LibGL, 'glDisableClientState'); + @glDrawArrays := GetModuleSymbol(LibGL, 'glDrawArrays'); + @glDrawBuffer := GetModuleSymbol(LibGL, 'glDrawBuffer'); + @glDrawElements := GetModuleSymbol(LibGL, 'glDrawElements'); + @glDrawPixels := GetModuleSymbol(LibGL, 'glDrawPixels'); + @glEdgeFlag := GetModuleSymbol(LibGL, 'glEdgeFlag'); + @glEdgeFlagPointer := GetModuleSymbol(LibGL, 'glEdgeFlagPointer'); + @glEdgeFlagv := GetModuleSymbol(LibGL, 'glEdgeFlagv'); + @glEnable := GetModuleSymbol(LibGL, 'glEnable'); + @glEnableClientState := GetModuleSymbol(LibGL, 'glEnableClientState'); + @glEnd := GetModuleSymbol(LibGL, 'glEnd'); + @glEndList := GetModuleSymbol(LibGL, 'glEndList'); + @glEvalCoord1d := GetModuleSymbol(LibGL, 'glEvalCoord1d'); + @glEvalCoord1dv := GetModuleSymbol(LibGL, 'glEvalCoord1dv'); + @glEvalCoord1f := GetModuleSymbol(LibGL, 'glEvalCoord1f'); + @glEvalCoord1fv := GetModuleSymbol(LibGL, 'glEvalCoord1fv'); + @glEvalCoord2d := GetModuleSymbol(LibGL, 'glEvalCoord2d'); + @glEvalCoord2dv := GetModuleSymbol(LibGL, 'glEvalCoord2dv'); + @glEvalCoord2f := GetModuleSymbol(LibGL, 'glEvalCoord2f'); + @glEvalCoord2fv := GetModuleSymbol(LibGL, 'glEvalCoord2fv'); + @glEvalMesh1 := GetModuleSymbol(LibGL, 'glEvalMesh1'); + @glEvalMesh2 := GetModuleSymbol(LibGL, 'glEvalMesh2'); + @glEvalPoint1 := GetModuleSymbol(LibGL, 'glEvalPoint1'); + @glEvalPoint2 := GetModuleSymbol(LibGL, 'glEvalPoint2'); + @glFeedbackBuffer := GetModuleSymbol(LibGL, 'glFeedbackBuffer'); + @glFinish := GetModuleSymbol(LibGL, 'glFinish'); + @glFlush := GetModuleSymbol(LibGL, 'glFlush'); + @glFogf := GetModuleSymbol(LibGL, 'glFogf'); + @glFogfv := GetModuleSymbol(LibGL, 'glFogfv'); + @glFogi := GetModuleSymbol(LibGL, 'glFogi'); + @glFogiv := GetModuleSymbol(LibGL, 'glFogiv'); + @glFrontFace := GetModuleSymbol(LibGL, 'glFrontFace'); + @glFrustum := GetModuleSymbol(LibGL, 'glFrustum'); + @glGenLists := GetModuleSymbol(LibGL, 'glGenLists'); + @glGenTextures := GetModuleSymbol(LibGL, 'glGenTextures'); + @glGetBooleanv := GetModuleSymbol(LibGL, 'glGetBooleanv'); + @glGetClipPlane := GetModuleSymbol(LibGL, 'glGetClipPlane'); + @glGetDoublev := GetModuleSymbol(LibGL, 'glGetDoublev'); + @glGetError := GetModuleSymbol(LibGL, 'glGetError'); + @glGetFloatv := GetModuleSymbol(LibGL, 'glGetFloatv'); + @glGetIntegerv := GetModuleSymbol(LibGL, 'glGetIntegerv'); + @glGetLightfv := GetModuleSymbol(LibGL, 'glGetLightfv'); + @glGetLightiv := GetModuleSymbol(LibGL, 'glGetLightiv'); + @glGetMapdv := GetModuleSymbol(LibGL, 'glGetMapdv'); + @glGetMapfv := GetModuleSymbol(LibGL, 'glGetMapfv'); + @glGetMapiv := GetModuleSymbol(LibGL, 'glGetMapiv'); + @glGetMaterialfv := GetModuleSymbol(LibGL, 'glGetMaterialfv'); + @glGetMaterialiv := GetModuleSymbol(LibGL, 'glGetMaterialiv'); + @glGetPixelMapfv := GetModuleSymbol(LibGL, 'glGetPixelMapfv'); + @glGetPixelMapuiv := GetModuleSymbol(LibGL, 'glGetPixelMapuiv'); + @glGetPixelMapusv := GetModuleSymbol(LibGL, 'glGetPixelMapusv'); + @glGetPointerv := GetModuleSymbol(LibGL, 'glGetPointerv'); + @glGetPolygonStipple := GetModuleSymbol(LibGL, 'glGetPolygonStipple'); + @glGetString := GetModuleSymbol(LibGL, 'glGetString'); + @glGetTexEnvfv := GetModuleSymbol(LibGL, 'glGetTexEnvfv'); + @glGetTexEnviv := GetModuleSymbol(LibGL, 'glGetTexEnviv'); + @glGetTexGendv := GetModuleSymbol(LibGL, 'glGetTexGendv'); + @glGetTexGenfv := GetModuleSymbol(LibGL, 'glGetTexGenfv'); + @glGetTexGeniv := GetModuleSymbol(LibGL, 'glGetTexGeniv'); + @glGetTexImage := GetModuleSymbol(LibGL, 'glGetTexImage'); + @glGetTexLevelParameterfv := GetModuleSymbol(LibGL, 'glGetTexLevelParameterfv'); + @glGetTexLevelParameteriv := GetModuleSymbol(LibGL, 'glGetTexLevelParameteriv'); + @glGetTexParameterfv := GetModuleSymbol(LibGL, 'glGetTexParameterfv'); + @glGetTexParameteriv := GetModuleSymbol(LibGL, 'glGetTexParameteriv'); + @glHint := GetModuleSymbol(LibGL, 'glHint'); + @glIndexMask := GetModuleSymbol(LibGL, 'glIndexMask'); + @glIndexPointer := GetModuleSymbol(LibGL, 'glIndexPointer'); + @glIndexd := GetModuleSymbol(LibGL, 'glIndexd'); + @glIndexdv := GetModuleSymbol(LibGL, 'glIndexdv'); + @glIndexf := GetModuleSymbol(LibGL, 'glIndexf'); + @glIndexfv := GetModuleSymbol(LibGL, 'glIndexfv'); + @glIndexi := GetModuleSymbol(LibGL, 'glIndexi'); + @glIndexiv := GetModuleSymbol(LibGL, 'glIndexiv'); + @glIndexs := GetModuleSymbol(LibGL, 'glIndexs'); + @glIndexsv := GetModuleSymbol(LibGL, 'glIndexsv'); + @glIndexub := GetModuleSymbol(LibGL, 'glIndexub'); + @glIndexubv := GetModuleSymbol(LibGL, 'glIndexubv'); + @glInitNames := GetModuleSymbol(LibGL, 'glInitNames'); + @glInterleavedArrays := GetModuleSymbol(LibGL, 'glInterleavedArrays'); + @glIsEnabled := GetModuleSymbol(LibGL, 'glIsEnabled'); + @glIsList := GetModuleSymbol(LibGL, 'glIsList'); + @glIsTexture := GetModuleSymbol(LibGL, 'glIsTexture'); + @glLightModelf := GetModuleSymbol(LibGL, 'glLightModelf'); + @glLightModelfv := GetModuleSymbol(LibGL, 'glLightModelfv'); + @glLightModeli := GetModuleSymbol(LibGL, 'glLightModeli'); + @glLightModeliv := GetModuleSymbol(LibGL, 'glLightModeliv'); + @glLightf := GetModuleSymbol(LibGL, 'glLightf'); + @glLightfv := GetModuleSymbol(LibGL, 'glLightfv'); + @glLighti := GetModuleSymbol(LibGL, 'glLighti'); + @glLightiv := GetModuleSymbol(LibGL, 'glLightiv'); + @glLineStipple := GetModuleSymbol(LibGL, 'glLineStipple'); + @glLineWidth := GetModuleSymbol(LibGL, 'glLineWidth'); + @glListBase := GetModuleSymbol(LibGL, 'glListBase'); + @glLoadIdentity := GetModuleSymbol(LibGL, 'glLoadIdentity'); + @glLoadMatrixd := GetModuleSymbol(LibGL, 'glLoadMatrixd'); + @glLoadMatrixf := GetModuleSymbol(LibGL, 'glLoadMatrixf'); + @glLoadName := GetModuleSymbol(LibGL, 'glLoadName'); + @glLogicOp := GetModuleSymbol(LibGL, 'glLogicOp'); + @glMap1d := GetModuleSymbol(LibGL, 'glMap1d'); + @glMap1f := GetModuleSymbol(LibGL, 'glMap1f'); + @glMap2d := GetModuleSymbol(LibGL, 'glMap2d'); + @glMap2f := GetModuleSymbol(LibGL, 'glMap2f'); + @glMapGrid1d := GetModuleSymbol(LibGL, 'glMapGrid1d'); + @glMapGrid1f := GetModuleSymbol(LibGL, 'glMapGrid1f'); + @glMapGrid2d := GetModuleSymbol(LibGL, 'glMapGrid2d'); + @glMapGrid2f := GetModuleSymbol(LibGL, 'glMapGrid2f'); + @glMaterialf := GetModuleSymbol(LibGL, 'glMaterialf'); + @glMaterialfv := GetModuleSymbol(LibGL, 'glMaterialfv'); + @glMateriali := GetModuleSymbol(LibGL, 'glMateriali'); + @glMaterialiv := GetModuleSymbol(LibGL, 'glMaterialiv'); + @glMatrixMode := GetModuleSymbol(LibGL, 'glMatrixMode'); + @glMultMatrixd := GetModuleSymbol(LibGL, 'glMultMatrixd'); + @glMultMatrixf := GetModuleSymbol(LibGL, 'glMultMatrixf'); + @glNewList := GetModuleSymbol(LibGL, 'glNewList'); + @glNormal3b := GetModuleSymbol(LibGL, 'glNormal3b'); + @glNormal3bv := GetModuleSymbol(LibGL, 'glNormal3bv'); + @glNormal3d := GetModuleSymbol(LibGL, 'glNormal3d'); + @glNormal3dv := GetModuleSymbol(LibGL, 'glNormal3dv'); + @glNormal3f := GetModuleSymbol(LibGL, 'glNormal3f'); + @glNormal3fv := GetModuleSymbol(LibGL, 'glNormal3fv'); + @glNormal3i := GetModuleSymbol(LibGL, 'glNormal3i'); + @glNormal3iv := GetModuleSymbol(LibGL, 'glNormal3iv'); + @glNormal3s := GetModuleSymbol(LibGL, 'glNormal3s'); + @glNormal3sv := GetModuleSymbol(LibGL, 'glNormal3sv'); + @glNormalPointer := GetModuleSymbol(LibGL, 'glNormalPointer'); + @glOrtho := GetModuleSymbol(LibGL, 'glOrtho'); + @glPassThrough := GetModuleSymbol(LibGL, 'glPassThrough'); + @glPixelMapfv := GetModuleSymbol(LibGL, 'glPixelMapfv'); + @glPixelMapuiv := GetModuleSymbol(LibGL, 'glPixelMapuiv'); + @glPixelMapusv := GetModuleSymbol(LibGL, 'glPixelMapusv'); + @glPixelStoref := GetModuleSymbol(LibGL, 'glPixelStoref'); + @glPixelStorei := GetModuleSymbol(LibGL, 'glPixelStorei'); + @glPixelTransferf := GetModuleSymbol(LibGL, 'glPixelTransferf'); + @glPixelTransferi := GetModuleSymbol(LibGL, 'glPixelTransferi'); + @glPixelZoom := GetModuleSymbol(LibGL, 'glPixelZoom'); + @glPointSize := GetModuleSymbol(LibGL, 'glPointSize'); + @glPolygonMode := GetModuleSymbol(LibGL, 'glPolygonMode'); + @glPolygonOffset := GetModuleSymbol(LibGL, 'glPolygonOffset'); + @glPolygonStipple := GetModuleSymbol(LibGL, 'glPolygonStipple'); + @glPopAttrib := GetModuleSymbol(LibGL, 'glPopAttrib'); + @glPopClientAttrib := GetModuleSymbol(LibGL, 'glPopClientAttrib'); + @glPopMatrix := GetModuleSymbol(LibGL, 'glPopMatrix'); + @glPopName := GetModuleSymbol(LibGL, 'glPopName'); + @glPrioritizeTextures := GetModuleSymbol(LibGL, 'glPrioritizeTextures'); + @glPushAttrib := GetModuleSymbol(LibGL, 'glPushAttrib'); + @glPushClientAttrib := GetModuleSymbol(LibGL, 'glPushClientAttrib'); + @glPushMatrix := GetModuleSymbol(LibGL, 'glPushMatrix'); + @glPushName := GetModuleSymbol(LibGL, 'glPushName'); + @glRasterPos2d := GetModuleSymbol(LibGL, 'glRasterPos2d'); + @glRasterPos2dv := GetModuleSymbol(LibGL, 'glRasterPos2dv'); + @glRasterPos2f := GetModuleSymbol(LibGL, 'glRasterPos2f'); + @glRasterPos2fv := GetModuleSymbol(LibGL, 'glRasterPos2fv'); + @glRasterPos2i := GetModuleSymbol(LibGL, 'glRasterPos2i'); + @glRasterPos2iv := GetModuleSymbol(LibGL, 'glRasterPos2iv'); + @glRasterPos2s := GetModuleSymbol(LibGL, 'glRasterPos2s'); + @glRasterPos2sv := GetModuleSymbol(LibGL, 'glRasterPos2sv'); + @glRasterPos3d := GetModuleSymbol(LibGL, 'glRasterPos3d'); + @glRasterPos3dv := GetModuleSymbol(LibGL, 'glRasterPos3dv'); + @glRasterPos3f := GetModuleSymbol(LibGL, 'glRasterPos3f'); + @glRasterPos3fv := GetModuleSymbol(LibGL, 'glRasterPos3fv'); + @glRasterPos3i := GetModuleSymbol(LibGL, 'glRasterPos3i'); + @glRasterPos3iv := GetModuleSymbol(LibGL, 'glRasterPos3iv'); + @glRasterPos3s := GetModuleSymbol(LibGL, 'glRasterPos3s'); + @glRasterPos3sv := GetModuleSymbol(LibGL, 'glRasterPos3sv'); + @glRasterPos4d := GetModuleSymbol(LibGL, 'glRasterPos4d'); + @glRasterPos4dv := GetModuleSymbol(LibGL, 'glRasterPos4dv'); + @glRasterPos4f := GetModuleSymbol(LibGL, 'glRasterPos4f'); + @glRasterPos4fv := GetModuleSymbol(LibGL, 'glRasterPos4fv'); + @glRasterPos4i := GetModuleSymbol(LibGL, 'glRasterPos4i'); + @glRasterPos4iv := GetModuleSymbol(LibGL, 'glRasterPos4iv'); + @glRasterPos4s := GetModuleSymbol(LibGL, 'glRasterPos4s'); + @glRasterPos4sv := GetModuleSymbol(LibGL, 'glRasterPos4sv'); + @glReadBuffer := GetModuleSymbol(LibGL, 'glReadBuffer'); + @glReadPixels := GetModuleSymbol(LibGL, 'glReadPixels'); + @glRectd := GetModuleSymbol(LibGL, 'glRectd'); + @glRectdv := GetModuleSymbol(LibGL, 'glRectdv'); + @glRectf := GetModuleSymbol(LibGL, 'glRectf'); + @glRectfv := GetModuleSymbol(LibGL, 'glRectfv'); + @glRecti := GetModuleSymbol(LibGL, 'glRecti'); + @glRectiv := GetModuleSymbol(LibGL, 'glRectiv'); + @glRects := GetModuleSymbol(LibGL, 'glRects'); + @glRectsv := GetModuleSymbol(LibGL, 'glRectsv'); + @glRenderMode := GetModuleSymbol(LibGL, 'glRenderMode'); + @glRotated := GetModuleSymbol(LibGL, 'glRotated'); + @glRotatef := GetModuleSymbol(LibGL, 'glRotatef'); + @glScaled := GetModuleSymbol(LibGL, 'glScaled'); + @glScalef := GetModuleSymbol(LibGL, 'glScalef'); + @glScissor := GetModuleSymbol(LibGL, 'glScissor'); + @glSelectBuffer := GetModuleSymbol(LibGL, 'glSelectBuffer'); + @glShadeModel := GetModuleSymbol(LibGL, 'glShadeModel'); + @glStencilFunc := GetModuleSymbol(LibGL, 'glStencilFunc'); + @glStencilMask := GetModuleSymbol(LibGL, 'glStencilMask'); + @glStencilOp := GetModuleSymbol(LibGL, 'glStencilOp'); + @glTexCoord1d := GetModuleSymbol(LibGL, 'glTexCoord1d'); + @glTexCoord1dv := GetModuleSymbol(LibGL, 'glTexCoord1dv'); + @glTexCoord1f := GetModuleSymbol(LibGL, 'glTexCoord1f'); + @glTexCoord1fv := GetModuleSymbol(LibGL, 'glTexCoord1fv'); + @glTexCoord1i := GetModuleSymbol(LibGL, 'glTexCoord1i'); + @glTexCoord1iv := GetModuleSymbol(LibGL, 'glTexCoord1iv'); + @glTexCoord1s := GetModuleSymbol(LibGL, 'glTexCoord1s'); + @glTexCoord1sv := GetModuleSymbol(LibGL, 'glTexCoord1sv'); + @glTexCoord2d := GetModuleSymbol(LibGL, 'glTexCoord2d'); + @glTexCoord2dv := GetModuleSymbol(LibGL, 'glTexCoord2dv'); + @glTexCoord2f := GetModuleSymbol(LibGL, 'glTexCoord2f'); + @glTexCoord2fv := GetModuleSymbol(LibGL, 'glTexCoord2fv'); + @glTexCoord2i := GetModuleSymbol(LibGL, 'glTexCoord2i'); + @glTexCoord2iv := GetModuleSymbol(LibGL, 'glTexCoord2iv'); + @glTexCoord2s := GetModuleSymbol(LibGL, 'glTexCoord2s'); + @glTexCoord2sv := GetModuleSymbol(LibGL, 'glTexCoord2sv'); + @glTexCoord3d := GetModuleSymbol(LibGL, 'glTexCoord3d'); + @glTexCoord3dv := GetModuleSymbol(LibGL, 'glTexCoord3dv'); + @glTexCoord3f := GetModuleSymbol(LibGL, 'glTexCoord3f'); + @glTexCoord3fv := GetModuleSymbol(LibGL, 'glTexCoord3fv'); + @glTexCoord3i := GetModuleSymbol(LibGL, 'glTexCoord3i'); + @glTexCoord3iv := GetModuleSymbol(LibGL, 'glTexCoord3iv'); + @glTexCoord3s := GetModuleSymbol(LibGL, 'glTexCoord3s'); + @glTexCoord3sv := GetModuleSymbol(LibGL, 'glTexCoord3sv'); + @glTexCoord4d := GetModuleSymbol(LibGL, 'glTexCoord4d'); + @glTexCoord4dv := GetModuleSymbol(LibGL, 'glTexCoord4dv'); + @glTexCoord4f := GetModuleSymbol(LibGL, 'glTexCoord4f'); + @glTexCoord4fv := GetModuleSymbol(LibGL, 'glTexCoord4fv'); + @glTexCoord4i := GetModuleSymbol(LibGL, 'glTexCoord4i'); + @glTexCoord4iv := GetModuleSymbol(LibGL, 'glTexCoord4iv'); + @glTexCoord4s := GetModuleSymbol(LibGL, 'glTexCoord4s'); + @glTexCoord4sv := GetModuleSymbol(LibGL, 'glTexCoord4sv'); + @glTexCoordPointer := GetModuleSymbol(LibGL, 'glTexCoordPointer'); + @glTexEnvf := GetModuleSymbol(LibGL, 'glTexEnvf'); + @glTexEnvfv := GetModuleSymbol(LibGL, 'glTexEnvfv'); + @glTexEnvi := GetModuleSymbol(LibGL, 'glTexEnvi'); + @glTexEnviv := GetModuleSymbol(LibGL, 'glTexEnviv'); + @glTexGend := GetModuleSymbol(LibGL, 'glTexGend'); + @glTexGendv := GetModuleSymbol(LibGL, 'glTexGendv'); + @glTexGenf := GetModuleSymbol(LibGL, 'glTexGenf'); + @glTexGenfv := GetModuleSymbol(LibGL, 'glTexGenfv'); + @glTexGeni := GetModuleSymbol(LibGL, 'glTexGeni'); + @glTexGeniv := GetModuleSymbol(LibGL, 'glTexGeniv'); + @glTexImage1D := GetModuleSymbol(LibGL, 'glTexImage1D'); + @glTexImage2D := GetModuleSymbol(LibGL, 'glTexImage2D'); + @glTexParameterf := GetModuleSymbol(LibGL, 'glTexParameterf'); + @glTexParameterfv := GetModuleSymbol(LibGL, 'glTexParameterfv'); + @glTexParameteri := GetModuleSymbol(LibGL, 'glTexParameteri'); + @glTexParameteriv := GetModuleSymbol(LibGL, 'glTexParameteriv'); + @glTexSubImage1D := GetModuleSymbol(LibGL, 'glTexSubImage1D'); + @glTexSubImage2D := GetModuleSymbol(LibGL, 'glTexSubImage2D'); + @glTranslated := GetModuleSymbol(LibGL, 'glTranslated'); + @glTranslatef := GetModuleSymbol(LibGL, 'glTranslatef'); + @glVertex2d := GetModuleSymbol(LibGL, 'glVertex2d'); + @glVertex2dv := GetModuleSymbol(LibGL, 'glVertex2dv'); + @glVertex2f := GetModuleSymbol(LibGL, 'glVertex2f'); + @glVertex2fv := GetModuleSymbol(LibGL, 'glVertex2fv'); + @glVertex2i := GetModuleSymbol(LibGL, 'glVertex2i'); + @glVertex2iv := GetModuleSymbol(LibGL, 'glVertex2iv'); + @glVertex2s := GetModuleSymbol(LibGL, 'glVertex2s'); + @glVertex2sv := GetModuleSymbol(LibGL, 'glVertex2sv'); + @glVertex3d := GetModuleSymbol(LibGL, 'glVertex3d'); + @glVertex3dv := GetModuleSymbol(LibGL, 'glVertex3dv'); + @glVertex3f := GetModuleSymbol(LibGL, 'glVertex3f'); + @glVertex3fv := GetModuleSymbol(LibGL, 'glVertex3fv'); + @glVertex3i := GetModuleSymbol(LibGL, 'glVertex3i'); + @glVertex3iv := GetModuleSymbol(LibGL, 'glVertex3iv'); + @glVertex3s := GetModuleSymbol(LibGL, 'glVertex3s'); + @glVertex3sv := GetModuleSymbol(LibGL, 'glVertex3sv'); + @glVertex4d := GetModuleSymbol(LibGL, 'glVertex4d'); + @glVertex4dv := GetModuleSymbol(LibGL, 'glVertex4dv'); + @glVertex4f := GetModuleSymbol(LibGL, 'glVertex4f'); + @glVertex4fv := GetModuleSymbol(LibGL, 'glVertex4fv'); + @glVertex4i := GetModuleSymbol(LibGL, 'glVertex4i'); + @glVertex4iv := GetModuleSymbol(LibGL, 'glVertex4iv'); + @glVertex4s := GetModuleSymbol(LibGL, 'glVertex4s'); + @glVertex4sv := GetModuleSymbol(LibGL, 'glVertex4sv'); + @glVertexPointer := GetModuleSymbol(LibGL, 'glVertexPointer'); + @glViewport := GetModuleSymbol(LibGL, 'glViewport'); + + {$IFDEF WIN32} + @ChoosePixelFormat := GetModuleSymbol(LibGL, 'ChoosePixelFormat'); + if not Assigned(ChoosePixelFormat) then + {$IFNDEF FPC}@{$ENDIF}ChoosePixelFormat := @Windows.ChoosePixelFormat; + {$ENDIF} + end; +end; + +initialization + {$IFNDEF FPC} + {$IFNDEF __GPC__} + Set8087CW($133F); + {$ENDIF} + {$ENDIF} + + LoadOpenGL( GLLibName ); + +finalization + + FreeOpenGL; + +end. + diff --git a/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glext.pas b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glext.pas new file mode 100644 index 00000000..19ed2023 --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glext.pas @@ -0,0 +1,8527 @@ +unit glext; +{ + $Id: glext.pas,v 1.3 2004/08/24 19:33:06 savage Exp $ + +} +(************************************************** + * OpenGL extension loading library * + * Generated by MetaGLext, written by Tom Nuydens * + * (tom@delphi3d.net -- http://www.delphi3d.net * + **************************************************) + +{ + $Log: glext.pas,v $ + Revision 1.3 2004/08/24 19:33:06 savage + Removed declarations of SDL_GL_GetProcAddress as the correct ones are in sdl.pas. + + Revision 1.2 2004/08/09 00:38:01 savage + Updated to Tom's latest version. May contains bugs, but I hope not. + + Revision 1.1 2004/03/30 21:53:54 savage + Moved to it's own folder. + + Revision 1.6 2004/03/28 00:28:43 savage + Fixed some glSecondaryColor definitions... + + Revision 1.5 2004/02/20 17:18:16 savage + Forgot to prefix function pointer with @ for FPC and other Pascal compilers. + + Revision 1.4 2004/02/20 17:09:55 savage + Code tidied up in gl, glu and glut, while extensions in glext.pas are now loaded using SDL_GL_GetProcAddress, thus making it more cross-platform compatible, but now more tied to SDL. + + Revision 1.3 2004/02/14 22:36:29 savage + Fixed inconsistencies of using LoadLibrary and LoadModule. + Now all units make use of LoadModule rather than LoadLibrary and other dynamic proc procedures. + + Revision 1.2 2004/02/14 00:09:19 savage + Changed uses to now make use of moduleloader.pas rather than dllfuncs.pas + + Revision 1.1 2004/02/05 00:08:19 savage + Module 1.0 release + + Revision 1.7 2003/06/02 12:32:13 savage + Modified Sources to avoid warnings with Delphi by moving CVS Logging to the top of the header files. Hopefully CVS Logging still works. + +} + +interface + +{$I jedi-sdl.inc} + +uses + SysUtils, +{$IFDEF __GPC__} + gpc, +{$ENDIF} + +{$IFDEF WIN32} + Windows, +{$ENDIF} + moduleloader, + gl; + +// Test if the given extension name is present in the given extension string. +function glext_ExtensionSupported(const extension: PChar; const searchIn: PChar): Boolean; + +// Load the extension with the given name. +function glext_LoadExtension(ext: PChar): Boolean; + +// Some types that were introduced by extensions: +type + GLintptrARB = Integer; + PGLintptrARB = ^GLintptrARB; + + GLsizeiptrARB = Integer; + PGLsizeiptrARB = ^GLsizeiptrARB; + + GLcharARB = Char; + PGLcharARB = ^GLcharARB; + + GLhandleARB = Cardinal; + PGLhandleARB = ^GLhandleARB; + +//***** GL_version_1_2 *****// +const + GL_UNSIGNED_BYTE_3_3_2 = $8032; + GL_UNSIGNED_SHORT_4_4_4_4 = $8033; + GL_UNSIGNED_SHORT_5_5_5_1 = $8034; + GL_UNSIGNED_INT_8_8_8_8 = $8035; + GL_UNSIGNED_INT_10_10_10_2 = $8036; + GL_RESCALE_NORMAL = $803A; + GL_UNSIGNED_BYTE_2_3_3_REV = $8362; + GL_UNSIGNED_SHORT_5_6_5 = $8363; + GL_UNSIGNED_SHORT_5_6_5_REV = $8364; + GL_UNSIGNED_SHORT_4_4_4_4_REV = $8365; + GL_UNSIGNED_SHORT_1_5_5_5_REV = $8366; + GL_UNSIGNED_INT_8_8_8_8_REV = $8367; + GL_UNSIGNED_INT_2_10_10_10_REV = $8368; + GL_BGR = $80E0; + GL_BGRA = $80E1; + GL_MAX_ELEMENTS_VERTICES = $80E8; + GL_MAX_ELEMENTS_INDICES = $80E9; + GL_CLAMP_TO_EDGE = $812F; + GL_TEXTURE_MIN_LOD = $813A; + GL_TEXTURE_MAX_LOD = $813B; + GL_TEXTURE_BASE_LEVEL = $813C; + GL_TEXTURE_MAX_LEVEL = $813D; + GL_LIGHT_MODEL_COLOR_CONTROL = $81F8; + GL_SINGLE_COLOR = $81F9; + GL_SEPARATE_SPECULAR_COLOR = $81FA; + GL_SMOOTH_POINT_SIZE_RANGE = $0B12; + GL_SMOOTH_POINT_SIZE_GRANULARITY = $0B13; + GL_SMOOTH_LINE_WIDTH_RANGE = $0B22; + GL_SMOOTH_LINE_WIDTH_GRANULARITY = $0B23; + GL_ALIASED_POINT_SIZE_RANGE = $846D; + GL_ALIASED_LINE_WIDTH_RANGE = $846E; + GL_PACK_SKIP_IMAGES = $806B; + GL_PACK_IMAGE_HEIGHT = $806C; + GL_UNPACK_SKIP_IMAGES = $806D; + GL_UNPACK_IMAGE_HEIGHT = $806E; + GL_TEXTURE_3D = $806F; + GL_PROXY_TEXTURE_3D = $8070; + GL_TEXTURE_DEPTH = $8071; + GL_TEXTURE_WRAP_R = $8072; + GL_MAX_3D_TEXTURE_SIZE = $8073; +var + glDrawRangeElements: procedure(mode: GLenum; start: GLuint; _end: GLuint; count: GLsizei; _type: GLenum; const indices: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexImage3D: procedure(target: GLenum; level: GLint; internalformat: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexSubImage3D: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyTexSubImage3D: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; x: GLint; y: GLint; width: GLsizei; height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_version_1_2: Boolean; + +//***** GL_ARB_imaging *****// +const + GL_CONSTANT_COLOR = $8001; + GL_ONE_MINUS_CONSTANT_COLOR = $8002; + GL_CONSTANT_ALPHA = $8003; + GL_ONE_MINUS_CONSTANT_ALPHA = $8004; + GL_BLEND_COLOR = $8005; + GL_FUNC_ADD = $8006; + GL_MIN = $8007; + GL_MAX = $8008; + GL_BLEND_EQUATION = $8009; + GL_FUNC_SUBTRACT = $800A; + GL_FUNC_REVERSE_SUBTRACT = $800B; + GL_CONVOLUTION_1D = $8010; + GL_CONVOLUTION_2D = $8011; + GL_SEPARABLE_2D = $8012; + GL_CONVOLUTION_BORDER_MODE = $8013; + GL_CONVOLUTION_FILTER_SCALE = $8014; + GL_CONVOLUTION_FILTER_BIAS = $8015; + GL_REDUCE = $8016; + GL_CONVOLUTION_FORMAT = $8017; + GL_CONVOLUTION_WIDTH = $8018; + GL_CONVOLUTION_HEIGHT = $8019; + GL_MAX_CONVOLUTION_WIDTH = $801A; + GL_MAX_CONVOLUTION_HEIGHT = $801B; + GL_POST_CONVOLUTION_RED_SCALE = $801C; + GL_POST_CONVOLUTION_GREEN_SCALE = $801D; + GL_POST_CONVOLUTION_BLUE_SCALE = $801E; + GL_POST_CONVOLUTION_ALPHA_SCALE = $801F; + GL_POST_CONVOLUTION_RED_BIAS = $8020; + GL_POST_CONVOLUTION_GREEN_BIAS = $8021; + GL_POST_CONVOLUTION_BLUE_BIAS = $8022; + GL_POST_CONVOLUTION_ALPHA_BIAS = $8023; + GL_HISTOGRAM = $8024; + GL_PROXY_HISTOGRAM = $8025; + GL_HISTOGRAM_WIDTH = $8026; + GL_HISTOGRAM_FORMAT = $8027; + GL_HISTOGRAM_RED_SIZE = $8028; + GL_HISTOGRAM_GREEN_SIZE = $8029; + GL_HISTOGRAM_BLUE_SIZE = $802A; + GL_HISTOGRAM_ALPHA_SIZE = $802B; + GL_HISTOGRAM_LUMINANCE_SIZE = $802C; + GL_HISTOGRAM_SINK = $802D; + GL_MINMAX = $802E; + GL_MINMAX_FORMAT = $802F; + GL_MINMAX_SINK = $8030; + GL_TABLE_TOO_LARGE = $8031; + GL_COLOR_MATRIX = $80B1; + GL_COLOR_MATRIX_STACK_DEPTH = $80B2; + GL_MAX_COLOR_MATRIX_STACK_DEPTH = $80B3; + GL_POST_COLOR_MATRIX_RED_SCALE = $80B4; + GL_POST_COLOR_MATRIX_GREEN_SCALE = $80B5; + GL_POST_COLOR_MATRIX_BLUE_SCALE = $80B6; + GL_POST_COLOR_MATRIX_ALPHA_SCALE = $80B7; + GL_POST_COLOR_MATRIX_RED_BIAS = $80B8; + GL_POST_COLOR_MATRIX_GREEN_BIAS = $80B9; + GL_POST_COLOR_MATRIX_BLUE_BIAS = $80BA; + GL_POST_COLOR_MATIX_ALPHA_BIAS = $80BB; + GL_COLOR_TABLE = $80D0; + GL_POST_CONVOLUTION_COLOR_TABLE = $80D1; + GL_POST_COLOR_MATRIX_COLOR_TABLE = $80D2; + GL_PROXY_COLOR_TABLE = $80D3; + GL_PROXY_POST_CONVOLUTION_COLOR_TABLE = $80D4; + GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE = $80D5; + GL_COLOR_TABLE_SCALE = $80D6; + GL_COLOR_TABLE_BIAS = $80D7; + GL_COLOR_TABLE_FORMAT = $80D8; + GL_COLOR_TABLE_WIDTH = $80D9; + GL_COLOR_TABLE_RED_SIZE = $80DA; + GL_COLOR_TABLE_GREEN_SIZE = $80DB; + GL_COLOR_TABLE_BLUE_SIZE = $80DC; + GL_COLOR_TABLE_ALPHA_SIZE = $80DD; + GL_COLOR_TABLE_LUMINANCE_SIZE = $80DE; + GL_COLOR_TABLE_INTENSITY_SIZE = $80DF; + GL_IGNORE_BORDER = $8150; + GL_CONSTANT_BORDER = $8151; + GL_WRAP_BORDER = $8152; + GL_REPLICATE_BORDER = $8153; + GL_CONVOLUTION_BORDER_COLOR = $8154; +var + glColorTable: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const table: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorTableParameterfv: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorTableParameteriv: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyColorTable: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTable: procedure(target: GLenum; format: GLenum; _type: GLenum; table: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTableParameterfv: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTableParameteriv: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorSubTable: procedure(target: GLenum; start: GLsizei; count: GLsizei; format: GLenum; _type: GLenum; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyColorSubTable: procedure(target: GLenum; start: GLsizei; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionFilter1D: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionFilter2D: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameterf: procedure(target: GLenum; pname: GLenum; params: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameterfv: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameteri: procedure(target: GLenum; pname: GLenum; params: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameteriv: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyConvolutionFilter1D: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyConvolutionFilter2D: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei; height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetConvolutionFilter: procedure(target: GLenum; format: GLenum; _type: GLenum; image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetConvolutionParameterfv: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetConvolutionParameteriv: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetSeparableFilter: procedure(target: GLenum; format: GLenum; _type: GLenum; row: PGLvoid; column: PGLvoid; span: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSeparableFilter2D: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const row: PGLvoid; const column: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetHistogram: procedure(target: GLenum; reset: GLboolean; format: GLenum; _type: GLenum; values: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetHistogramParameterfv: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetHistogramParameteriv: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMinmax: procedure(target: GLenum; reset: GLboolean; format: GLenum; _type: GLenum; values: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMinmaxParameterfv: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMinmaxParameteriv: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glHistogram: procedure(target: GLenum; width: GLsizei; internalformat: GLenum; sink: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMinmax: procedure(target: GLenum; internalformat: GLenum; sink: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glResetHistogram: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glResetMinmax: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBlendEquation: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBlendColor: procedure(red: GLclampf; green: GLclampf; blue: GLclampf; alpha: GLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_imaging: Boolean; + +//***** GL_version_1_3 *****// +const + GL_TEXTURE0 = $84C0; + GL_TEXTURE1 = $84C1; + GL_TEXTURE2 = $84C2; + GL_TEXTURE3 = $84C3; + GL_TEXTURE4 = $84C4; + GL_TEXTURE5 = $84C5; + GL_TEXTURE6 = $84C6; + GL_TEXTURE7 = $84C7; + GL_TEXTURE8 = $84C8; + GL_TEXTURE9 = $84C9; + GL_TEXTURE10 = $84CA; + GL_TEXTURE11 = $84CB; + GL_TEXTURE12 = $84CC; + GL_TEXTURE13 = $84CD; + GL_TEXTURE14 = $84CE; + GL_TEXTURE15 = $84CF; + GL_TEXTURE16 = $84D0; + GL_TEXTURE17 = $84D1; + GL_TEXTURE18 = $84D2; + GL_TEXTURE19 = $84D3; + GL_TEXTURE20 = $84D4; + GL_TEXTURE21 = $84D5; + GL_TEXTURE22 = $84D6; + GL_TEXTURE23 = $84D7; + GL_TEXTURE24 = $84D8; + GL_TEXTURE25 = $84D9; + GL_TEXTURE26 = $84DA; + GL_TEXTURE27 = $84DB; + GL_TEXTURE28 = $84DC; + GL_TEXTURE29 = $84DD; + GL_TEXTURE30 = $84DE; + GL_TEXTURE31 = $84DF; + GL_ACTIVE_TEXTURE = $84E0; + GL_CLIENT_ACTIVE_TEXTURE = $84E1; + GL_MAX_TEXTURE_UNITS = $84E2; + GL_TRANSPOSE_MODELVIEW_MATRIX = $84E3; + GL_TRANSPOSE_PROJECTION_MATRIX = $84E4; + GL_TRANSPOSE_TEXTURE_MATRIX = $84E5; + GL_TRANSPOSE_COLOR_MATRIX = $84E6; + GL_MULTISAMPLE = $809D; + GL_SAMPLE_ALPHA_TO_COVERAGE = $809E; + GL_SAMPLE_ALPHA_TO_ONE = $809F; + GL_SAMPLE_COVERAGE = $80A0; + GL_SAMPLE_BUFFERS = $80A8; + GL_SAMPLES = $80A9; + GL_SAMPLE_COVERAGE_VALUE = $80AA; + GL_SAMPLE_COVERAGE_INVERT = $80AB; + GL_MULTISAMPLE_BIT = $20000000; + GL_NORMAL_MAP = $8511; + GL_REFLECTION_MAP = $8512; + GL_TEXTURE_CUBE_MAP = $8513; + GL_TEXTURE_BINDING_CUBE_MAP = $8514; + GL_TEXTURE_CUBE_MAP_POSITIVE_X = $8515; + GL_TEXTURE_CUBE_MAP_NEGATIVE_X = $8516; + GL_TEXTURE_CUBE_MAP_POSITIVE_Y = $8517; + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = $8518; + GL_TEXTURE_CUBE_MAP_POSITIVE_Z = $8519; + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = $851A; + GL_PROXY_TEXTURE_CUBE_MAP = $851B; + GL_MAX_CUBE_MAP_TEXTURE_SIZE = $851C; + GL_COMPRESSED_ALPHA = $84E9; + GL_COMPRESSED_LUMINANCE = $84EA; + GL_COMPRESSED_LUMINANCE_ALPHA = $84EB; + GL_COMPRESSED_INTENSITY = $84EC; + GL_COMPRESSED_RGB = $84ED; + GL_COMPRESSED_RGBA = $84EE; + GL_TEXTURE_COMPRESSION_HINT = $84EF; + GL_TEXTURE_COMPRESSED_IMAGE_SIZE = $86A0; + GL_TEXTURE_COMPRESSED = $86A1; + GL_NUM_COMPRESSED_TEXTURE_FORMATS = $86A2; + GL_COMPRESSED_TEXTURE_FORMATS = $86A3; + GL_CLAMP_TO_BORDER = $812D; + GL_CLAMP_TO_BORDER_SGIS = $812D; + GL_COMBINE = $8570; + GL_COMBINE_RGB = $8571; + GL_COMBINE_ALPHA = $8572; + GL_SOURCE0_RGB = $8580; + GL_SOURCE1_RGB = $8581; + GL_SOURCE2_RGB = $8582; + GL_SOURCE0_ALPHA = $8588; + GL_SOURCE1_ALPHA = $8589; + GL_SOURCE2_ALPHA = $858A; + GL_OPERAND0_RGB = $8590; + GL_OPERAND1_RGB = $8591; + GL_OPERAND2_RGB = $8592; + GL_OPERAND0_ALPHA = $8598; + GL_OPERAND1_ALPHA = $8599; + GL_OPERAND2_ALPHA = $859A; + GL_RGB_SCALE = $8573; + GL_ADD_SIGNED = $8574; + GL_INTERPOLATE = $8575; + GL_SUBTRACT = $84E7; + GL_CONSTANT = $8576; + GL_PRIMARY_COLOR = $8577; + GL_PREVIOUS = $8578; + GL_DOT3_RGB = $86AE; + GL_DOT3_RGBA = $86AF; +var + glActiveTexture: procedure(texture: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glClientActiveTexture: procedure(texture: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1d: procedure(target: GLenum; s: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1dv: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1f: procedure(target: GLenum; s: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1fv: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1i: procedure(target: GLenum; s: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1iv: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1s: procedure(target: GLenum; s: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1sv: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2d: procedure(target: GLenum; s: GLdouble; t: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2dv: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2f: procedure(target: GLenum; s: GLfloat; t: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2fv: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2i: procedure(target: GLenum; s: GLint; t: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2iv: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2s: procedure(target: GLenum; s: GLshort; t: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2sv: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3d: procedure(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3dv: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3f: procedure(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3fv: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3i: procedure(target: GLenum; s: GLint; t: GLint; r: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3iv: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3s: procedure(target: GLenum; s: GLshort; t: GLshort; r: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3sv: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4d: procedure(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble; q: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4dv: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4f: procedure(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat; q: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4fv: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4i: procedure(target: GLenum; s: GLint; t: GLint; r: GLint; q: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4iv: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4s: procedure(target: GLenum; s: GLshort; t: GLshort; r: GLshort; q: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4sv: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadTransposeMatrixf: procedure(const m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadTransposeMatrixd: procedure(const m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultTransposeMatrixf: procedure(const m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultTransposeMatrixd: procedure(const m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSampleCoverage: procedure(value: GLclampf; invert: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexImage3D: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexImage2D: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexImage1D: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexSubImage3D: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexSubImage2D: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; height: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexSubImage1D: procedure(target: GLenum; level: GLint; xoffset: GLint; width: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetCompressedTexImage: procedure(target: GLenum; level: GLint; img: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_version_1_3: Boolean; + +//***** GL_ARB_multitexture *****// +const + GL_TEXTURE0_ARB = $84C0; + GL_TEXTURE1_ARB = $84C1; + GL_TEXTURE2_ARB = $84C2; + GL_TEXTURE3_ARB = $84C3; + GL_TEXTURE4_ARB = $84C4; + GL_TEXTURE5_ARB = $84C5; + GL_TEXTURE6_ARB = $84C6; + GL_TEXTURE7_ARB = $84C7; + GL_TEXTURE8_ARB = $84C8; + GL_TEXTURE9_ARB = $84C9; + GL_TEXTURE10_ARB = $84CA; + GL_TEXTURE11_ARB = $84CB; + GL_TEXTURE12_ARB = $84CC; + GL_TEXTURE13_ARB = $84CD; + GL_TEXTURE14_ARB = $84CE; + GL_TEXTURE15_ARB = $84CF; + GL_TEXTURE16_ARB = $84D0; + GL_TEXTURE17_ARB = $84D1; + GL_TEXTURE18_ARB = $84D2; + GL_TEXTURE19_ARB = $84D3; + GL_TEXTURE20_ARB = $84D4; + GL_TEXTURE21_ARB = $84D5; + GL_TEXTURE22_ARB = $84D6; + GL_TEXTURE23_ARB = $84D7; + GL_TEXTURE24_ARB = $84D8; + GL_TEXTURE25_ARB = $84D9; + GL_TEXTURE26_ARB = $84DA; + GL_TEXTURE27_ARB = $84DB; + GL_TEXTURE28_ARB = $84DC; + GL_TEXTURE29_ARB = $84DD; + GL_TEXTURE30_ARB = $84DE; + GL_TEXTURE31_ARB = $84DF; + GL_ACTIVE_TEXTURE_ARB = $84E0; + GL_CLIENT_ACTIVE_TEXTURE_ARB = $84E1; + GL_MAX_TEXTURE_UNITS_ARB = $84E2; +var + glActiveTextureARB: procedure(texture: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glClientActiveTextureARB: procedure(texture: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1dARB: procedure(target: GLenum; s: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1dvARB: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1fARB: procedure(target: GLenum; s: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1fvARB: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1iARB: procedure(target: GLenum; s: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1ivARB: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1sARB: procedure(target: GLenum; s: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1svARB: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2dARB: procedure(target: GLenum; s: GLdouble; t: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2dvARB: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2fARB: procedure(target: GLenum; s: GLfloat; t: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2fvARB: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2iARB: procedure(target: GLenum; s: GLint; t: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2ivARB: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2sARB: procedure(target: GLenum; s: GLshort; t: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2svARB: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3dARB: procedure(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3dvARB: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3fARB: procedure(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3fvARB: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3iARB: procedure(target: GLenum; s: GLint; t: GLint; r: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3ivARB: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3sARB: procedure(target: GLenum; s: GLshort; t: GLshort; r: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3svARB: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4dARB: procedure(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble; q: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4dvARB: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4fARB: procedure(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat; q: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4fvARB: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4iARB: procedure(target: GLenum; s: GLint; t: GLint; r: GLint; q: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4ivARB: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4sARB: procedure(target: GLenum; s: GLshort; t: GLshort; r: GLshort; q: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4svARB: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_multitexture: Boolean; + +//***** GL_ARB_transpose_matrix *****// +const + GL_TRANSPOSE_MODELVIEW_MATRIX_ARB = $84E3; + GL_TRANSPOSE_PROJECTION_MATRIX_ARB = $84E4; + GL_TRANSPOSE_TEXTURE_MATRIX_ARB = $84E5; + GL_TRANSPOSE_COLOR_MATRIX_ARB = $84E6; +var + glLoadTransposeMatrixfARB: procedure(m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadTransposeMatrixdARB: procedure(m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultTransposeMatrixfARB: procedure(m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultTransposeMatrixdARB: procedure(m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_transpose_matrix: Boolean; + +//***** GL_ARB_multisample *****// +const + WGL_SAMPLE_BUFFERS_ARB = $2041; + WGL_SAMPLES_ARB = $2042; + GL_MULTISAMPLE_ARB = $809D; + GL_SAMPLE_ALPHA_TO_COVERAGE_ARB = $809E; + GL_SAMPLE_ALPHA_TO_ONE_ARB = $809F; + GL_SAMPLE_COVERAGE_ARB = $80A0; + GL_MULTISAMPLE_BIT_ARB = $20000000; + GL_SAMPLE_BUFFERS_ARB = $80A8; + GL_SAMPLES_ARB = $80A9; + GL_SAMPLE_COVERAGE_VALUE_ARB = $80AA; + GL_SAMPLE_COVERAGE_INVERT_ARB = $80AB; +var + glSampleCoverageARB: procedure(value: GLclampf; invert: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_multisample: Boolean; + +//***** GL_ARB_texture_env_add *****// + +function Load_GL_ARB_texture_env_add: Boolean; + +{$IFDEF Win32} +//***** WGL_ARB_extensions_string *****// +var + wglGetExtensionsStringARB: function(hdc: HDC): Pchar; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_ARB_extensions_string: Boolean; + +//***** WGL_ARB_buffer_region *****// +const + WGL_FRONT_COLOR_BUFFER_BIT_ARB = $0001; + WGL_BACK_COLOR_BUFFER_BIT_ARB = $0002; + WGL_DEPTH_BUFFER_BIT_ARB = $0004; + WGL_STENCIL_BUFFER_BIT_ARB = $0008; +var + wglCreateBufferRegionARB: function(hDC: HDC; iLayerPlane: GLint; uType: GLuint): THandle; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglDeleteBufferRegionARB: procedure(hRegion: THandle); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglSaveBufferRegionARB: function(hRegion: THandle; x: GLint; y: GLint; width: GLint; height: GLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglRestoreBufferRegionARB: function(hRegion: THandle; x: GLint; y: GLint; width: GLint; height: GLint; xSrc: GLint; ySrc: GLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_ARB_buffer_region: Boolean; +{$ENDIF} + +//***** GL_ARB_texture_cube_map *****// +const + GL_NORMAL_MAP_ARB = $8511; + GL_REFLECTION_MAP_ARB = $8512; + GL_TEXTURE_CUBE_MAP_ARB = $8513; + GL_TEXTURE_BINDING_CUBE_MAP_ARB = $8514; + GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = $8515; + GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = $8516; + GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = $8517; + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = $8518; + GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = $8519; + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = $851A; + GL_PROXY_TEXTURE_CUBE_MAP_ARB = $851B; + GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB = $851C; + +function Load_GL_ARB_texture_cube_map: Boolean; + +//***** GL_ARB_depth_texture *****// +const + GL_DEPTH_COMPONENT16_ARB = $81A5; + GL_DEPTH_COMPONENT24_ARB = $81A6; + GL_DEPTH_COMPONENT32_ARB = $81A7; + GL_TEXTURE_DEPTH_SIZE_ARB = $884A; + GL_DEPTH_TEXTURE_MODE_ARB = $884B; + +function Load_GL_ARB_depth_texture: Boolean; + +//***** GL_ARB_point_parameters *****// +const + GL_POINT_SIZE_MIN_ARB = $8126; + GL_POINT_SIZE_MAX_ARB = $8127; + GL_POINT_FADE_THRESHOLD_SIZE_ARB = $8128; + GL_POINT_DISTANCE_ATTENUATION_ARB = $8129; +var + glPointParameterfARB: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPointParameterfvARB: procedure(pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_point_parameters: Boolean; + +//***** GL_ARB_shadow *****// +const + GL_TEXTURE_COMPARE_MODE_ARB = $884C; + GL_TEXTURE_COMPARE_FUNC_ARB = $884D; + GL_COMPARE_R_TO_TEXTURE_ARB = $884E; + +function Load_GL_ARB_shadow: Boolean; + +//***** GL_ARB_shadow_ambient *****// +const + GL_TEXTURE_COMPARE_FAIL_VALUE_ARB = $80BF; + +function Load_GL_ARB_shadow_ambient: Boolean; + +//***** GL_ARB_texture_border_clamp *****// +const + GL_CLAMP_TO_BORDER_ARB = $812D; + +function Load_GL_ARB_texture_border_clamp: Boolean; + +//***** GL_ARB_texture_compression *****// +const + GL_COMPRESSED_ALPHA_ARB = $84E9; + GL_COMPRESSED_LUMINANCE_ARB = $84EA; + GL_COMPRESSED_LUMINANCE_ALPHA_ARB = $84EB; + GL_COMPRESSED_INTENSITY_ARB = $84EC; + GL_COMPRESSED_RGB_ARB = $84ED; + GL_COMPRESSED_RGBA_ARB = $84EE; + GL_TEXTURE_COMPRESSION_HINT_ARB = $84EF; + GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB = $86A0; + GL_TEXTURE_COMPRESSED_ARB = $86A1; + GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB = $86A2; + GL_COMPRESSED_TEXTURE_FORMATS_ARB = $86A3; +var + glCompressedTexImage3DARB: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexImage2DARB: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexImage1DARB: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexSubImage3DARB: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexSubImage2DARB: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; height: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexSubImage1DARB: procedure(target: GLenum; level: GLint; xoffset: GLint; width: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetCompressedTexImageARB: procedure(target: GLenum; lod: GLint; img: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_texture_compression: Boolean; + +//***** GL_ARB_texture_env_combine *****// +const + GL_COMBINE_ARB = $8570; + GL_COMBINE_RGB_ARB = $8571; + GL_COMBINE_ALPHA_ARB = $8572; + GL_SOURCE0_RGB_ARB = $8580; + GL_SOURCE1_RGB_ARB = $8581; + GL_SOURCE2_RGB_ARB = $8582; + GL_SOURCE0_ALPHA_ARB = $8588; + GL_SOURCE1_ALPHA_ARB = $8589; + GL_SOURCE2_ALPHA_ARB = $858A; + GL_OPERAND0_RGB_ARB = $8590; + GL_OPERAND1_RGB_ARB = $8591; + GL_OPERAND2_RGB_ARB = $8592; + GL_OPERAND0_ALPHA_ARB = $8598; + GL_OPERAND1_ALPHA_ARB = $8599; + GL_OPERAND2_ALPHA_ARB = $859A; + GL_RGB_SCALE_ARB = $8573; + GL_ADD_SIGNED_ARB = $8574; + GL_INTERPOLATE_ARB = $8575; + GL_SUBTRACT_ARB = $84E7; + GL_CONSTANT_ARB = $8576; + GL_PRIMARY_COLOR_ARB = $8577; + GL_PREVIOUS_ARB = $8578; + +function Load_GL_ARB_texture_env_combine: Boolean; + +//***** GL_ARB_texture_env_crossbar *****// + +function Load_GL_ARB_texture_env_crossbar: Boolean; + +//***** GL_ARB_texture_env_dot3 *****// +const + GL_DOT3_RGB_ARB = $86AE; + GL_DOT3_RGBA_ARB = $86AF; + +function Load_GL_ARB_texture_env_dot3: Boolean; + +//***** GL_ARB_texture_mirrored_repeat *****// +const + GL_MIRRORED_REPEAT_ARB = $8370; + +function Load_GL_ARB_texture_mirrored_repeat: Boolean; + +//***** GL_ARB_vertex_blend *****// +const + GL_MAX_VERTEX_UNITS_ARB = $86A4; + GL_ACTIVE_VERTEX_UNITS_ARB = $86A5; + GL_WEIGHT_SUM_UNITY_ARB = $86A6; + GL_VERTEX_BLEND_ARB = $86A7; + GL_MODELVIEW0_ARB = $1700; + GL_MODELVIEW1_ARB = $850A; + GL_MODELVIEW2_ARB = $8722; + GL_MODELVIEW3_ARB = $8723; + GL_MODELVIEW4_ARB = $8724; + GL_MODELVIEW5_ARB = $8725; + GL_MODELVIEW6_ARB = $8726; + GL_MODELVIEW7_ARB = $8727; + GL_MODELVIEW8_ARB = $8728; + GL_MODELVIEW9_ARB = $8729; + GL_MODELVIEW10_ARB = $872A; + GL_MODELVIEW11_ARB = $872B; + GL_MODELVIEW12_ARB = $872C; + GL_MODELVIEW13_ARB = $872D; + GL_MODELVIEW14_ARB = $872E; + GL_MODELVIEW15_ARB = $872F; + GL_MODELVIEW16_ARB = $8730; + GL_MODELVIEW17_ARB = $8731; + GL_MODELVIEW18_ARB = $8732; + GL_MODELVIEW19_ARB = $8733; + GL_MODELVIEW20_ARB = $8734; + GL_MODELVIEW21_ARB = $8735; + GL_MODELVIEW22_ARB = $8736; + GL_MODELVIEW23_ARB = $8737; + GL_MODELVIEW24_ARB = $8738; + GL_MODELVIEW25_ARB = $8739; + GL_MODELVIEW26_ARB = $873A; + GL_MODELVIEW27_ARB = $873B; + GL_MODELVIEW28_ARB = $873C; + GL_MODELVIEW29_ARB = $873D; + GL_MODELVIEW30_ARB = $873E; + GL_MODELVIEW31_ARB = $873F; + GL_CURRENT_WEIGHT_ARB = $86A8; + GL_WEIGHT_ARRAY_TYPE_ARB = $86A9; + GL_WEIGHT_ARRAY_STRIDE_ARB = $86AA; + GL_WEIGHT_ARRAY_SIZE_ARB = $86AB; + GL_WEIGHT_ARRAY_POINTER_ARB = $86AC; + GL_WEIGHT_ARRAY_ARB = $86AD; +var + glWeightbvARB: procedure(size: GLint; weights: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightsvARB: procedure(size: GLint; weights: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightivARB: procedure(size: GLint; weights: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightfvARB: procedure(size: GLint; weights: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightdvARB: procedure(size: GLint; weights: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightvARB: procedure(size: GLint; weights: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightubvARB: procedure(size: GLint; weights: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightusvARB: procedure(size: GLint; weights: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightuivARB: procedure(size: GLint; weights: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightPointerARB: procedure(size: GLint; _type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexBlendARB: procedure(count: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_vertex_blend: Boolean; + +//***** GL_ARB_vertex_program *****// +const + GL_VERTEX_PROGRAM_ARB = $8620; + GL_VERTEX_PROGRAM_POINT_SIZE_ARB = $8642; + GL_VERTEX_PROGRAM_TWO_SIDE_ARB = $8643; + GL_COLOR_SUM_ARB = $8458; + GL_PROGRAM_FORMAT_ASCII_ARB = $8875; + GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB = $8622; + GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB = $8623; + GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB = $8624; + GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB = $8625; + GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB = $886A; + GL_CURRENT_VERTEX_ATTRIB_ARB = $8626; + GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB = $8645; + GL_PROGRAM_LENGTH_ARB = $8627; + GL_PROGRAM_FORMAT_ARB = $8876; + GL_PROGRAM_BINDING_ARB = $8677; + GL_PROGRAM_INSTRUCTIONS_ARB = $88A0; + GL_MAX_PROGRAM_INSTRUCTIONS_ARB = $88A1; + GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB = $88A2; + GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB = $88A3; + GL_PROGRAM_TEMPORARIES_ARB = $88A4; + GL_MAX_PROGRAM_TEMPORARIES_ARB = $88A5; + GL_PROGRAM_NATIVE_TEMPORARIES_ARB = $88A6; + GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB = $88A7; + GL_PROGRAM_PARAMETERS_ARB = $88A8; + GL_MAX_PROGRAM_PARAMETERS_ARB = $88A9; + GL_PROGRAM_NATIVE_PARAMETERS_ARB = $88AA; + GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB = $88AB; + GL_PROGRAM_ATTRIBS_ARB = $88AC; + GL_MAX_PROGRAM_ATTRIBS_ARB = $88AD; + GL_PROGRAM_NATIVE_ATTRIBS_ARB = $88AE; + GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB = $88AF; + GL_PROGRAM_ADDRESS_REGISTERS_ARB = $88B0; + GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB = $88B1; + GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = $88B2; + GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = $88B3; + GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB = $88B4; + GL_MAX_PROGRAM_ENV_PARAMETERS_ARB = $88B5; + GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB = $88B6; + GL_PROGRAM_STRING_ARB = $8628; + GL_PROGRAM_ERROR_POSITION_ARB = $864B; + GL_CURRENT_MATRIX_ARB = $8641; + GL_TRANSPOSE_CURRENT_MATRIX_ARB = $88B7; + GL_CURRENT_MATRIX_STACK_DEPTH_ARB = $8640; + GL_MAX_VERTEX_ATTRIBS_ARB = $8869; + GL_MAX_PROGRAM_MATRICES_ARB = $862F; + GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB = $862E; + GL_PROGRAM_ERROR_STRING_ARB = $8874; + GL_MATRIX0_ARB = $88C0; + GL_MATRIX1_ARB = $88C1; + GL_MATRIX2_ARB = $88C2; + GL_MATRIX3_ARB = $88C3; + GL_MATRIX4_ARB = $88C4; + GL_MATRIX5_ARB = $88C5; + GL_MATRIX6_ARB = $88C6; + GL_MATRIX7_ARB = $88C7; + GL_MATRIX8_ARB = $88C8; + GL_MATRIX9_ARB = $88C9; + GL_MATRIX10_ARB = $88CA; + GL_MATRIX11_ARB = $88CB; + GL_MATRIX12_ARB = $88CC; + GL_MATRIX13_ARB = $88CD; + GL_MATRIX14_ARB = $88CE; + GL_MATRIX15_ARB = $88CF; + GL_MATRIX16_ARB = $88D0; + GL_MATRIX17_ARB = $88D1; + GL_MATRIX18_ARB = $88D2; + GL_MATRIX19_ARB = $88D3; + GL_MATRIX20_ARB = $88D4; + GL_MATRIX21_ARB = $88D5; + GL_MATRIX22_ARB = $88D6; + GL_MATRIX23_ARB = $88D7; + GL_MATRIX24_ARB = $88D8; + GL_MATRIX25_ARB = $88D9; + GL_MATRIX26_ARB = $88DA; + GL_MATRIX27_ARB = $88DB; + GL_MATRIX28_ARB = $88DC; + GL_MATRIX29_ARB = $88DD; + GL_MATRIX30_ARB = $88DE; + GL_MATRIX31_ARB = $88DF; +var + glVertexAttrib1sARB: procedure(index: GLuint; x: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1fARB: procedure(index: GLuint; x: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1dARB: procedure(index: GLuint; x: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2sARB: procedure(index: GLuint; x: GLshort; y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2fARB: procedure(index: GLuint; x: GLfloat; y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2dARB: procedure(index: GLuint; x: GLdouble; y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3sARB: procedure(index: GLuint; x: GLshort; y: GLshort; z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3fARB: procedure(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3dARB: procedure(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4sARB: procedure(index: GLuint; x: GLshort; y: GLshort; z: GLshort; w: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4fARB: procedure(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4dARB: procedure(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4NubARB: procedure(index: GLuint; x: GLubyte; y: GLubyte; z: GLubyte; w: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1svARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1fvARB: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1dvARB: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2svARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2fvARB: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2dvARB: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3svARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3fvARB: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3dvARB: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4bvARB: procedure(index: GLuint; const v: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4svARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4ivARB: procedure(index: GLuint; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4ubvARB: procedure(index: GLuint; const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4usvARB: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4uivARB: procedure(index: GLuint; const v: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4fvARB: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4dvARB: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4NbvARB: procedure(index: GLuint; const v: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4NsvARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4NivARB: procedure(index: GLuint; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4NubvARB: procedure(index: GLuint; const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4NusvARB: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4NuivARB: procedure(index: GLuint; const v: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribPointerARB: procedure(index: GLuint; size: GLint; _type: GLenum; normalized: GLboolean; stride: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEnableVertexAttribArrayARB: procedure(index: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDisableVertexAttribArrayARB: procedure(index: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramStringARB: procedure(target: GLenum; format: GLenum; len: GLsizei; const _string: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindProgramARB: procedure(target: GLenum; _program: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteProgramsARB: procedure(n: GLsizei; const programs: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenProgramsARB: procedure(n: GLsizei; programs: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramEnvParameter4dARB: procedure(target: GLenum; index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramEnvParameter4dvARB: procedure(target: GLenum; index: GLuint; const params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramEnvParameter4fARB: procedure(target: GLenum; index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramEnvParameter4fvARB: procedure(target: GLenum; index: GLuint; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramLocalParameter4dARB: procedure(target: GLenum; index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramLocalParameter4dvARB: procedure(target: GLenum; index: GLuint; const params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramLocalParameter4fARB: procedure(target: GLenum; index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramLocalParameter4fvARB: procedure(target: GLenum; index: GLuint; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramEnvParameterdvARB: procedure(target: GLenum; index: GLuint; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramEnvParameterfvARB: procedure(target: GLenum; index: GLuint; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramLocalParameterdvARB: procedure(target: GLenum; index: GLuint; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramLocalParameterfvARB: procedure(target: GLenum; index: GLuint; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramivARB: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramStringARB: procedure(target: GLenum; pname: GLenum; _string: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribdvARB: procedure(index: GLuint; pname: GLenum; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribfvARB: procedure(index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribivARB: procedure(index: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribPointervARB: procedure(index: GLuint; pname: GLenum; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsProgramARB: function(_program: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_vertex_program: Boolean; + +//***** GL_ARB_window_pos *****// +var + glWindowPos2dARB: procedure(x: GLdouble; y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2fARB: procedure(x: GLfloat; y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2iARB: procedure(x: GLint; y: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2sARB: procedure(x: GLshort; y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2dvARB: procedure(const p: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2fvARB: procedure(const p: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2ivARB: procedure(const p: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2svARB: procedure(const p: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3dARB: procedure(x: GLdouble; y: GLdouble; z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3fARB: procedure(x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3iARB: procedure(x: GLint; y: GLint; z: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3sARB: procedure(x: GLshort; y: GLshort; z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3dvARB: procedure(const p: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3fvARB: procedure(const p: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3ivARB: procedure(const p: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3svARB: procedure(const p: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_window_pos: Boolean; + +//***** GL_EXT_422_pixels *****// +const + GL_422_EXT = $80CC; + GL_422_REV_EXT = $80CD; + GL_422_AVERAGE_EXT = $80CE; + GL_422_REV_AVERAGE_EXT = $80CF; + +function Load_GL_EXT_422_pixels: Boolean; + +//***** GL_EXT_abgr *****// +const + GL_ABGR_EXT = $8000; + +function Load_GL_EXT_abgr: Boolean; + +//***** GL_EXT_bgra *****// +const + GL_BGR_EXT = $80E0; + GL_BGRA_EXT = $80E1; + +function Load_GL_EXT_bgra: Boolean; + +//***** GL_EXT_blend_color *****// +const + GL_CONSTANT_COLOR_EXT = $8001; + GL_ONE_MINUS_CONSTANT_COLOR_EXT = $8002; + GL_CONSTANT_ALPHA_EXT = $8003; + GL_ONE_MINUS_CONSTANT_ALPHA_EXT = $8004; + GL_BLEND_COLOR_EXT = $8005; +var + glBlendColorEXT: procedure(red: GLclampf; green: GLclampf; blue: GLclampf; alpha: GLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_blend_color: Boolean; + +//***** GL_EXT_blend_func_separate *****// +const + GL_BLEND_DST_RGB_EXT = $80C8; + GL_BLEND_SRC_RGB_EXT = $80C9; + GL_BLEND_DST_ALPHA_EXT = $80CA; + GL_BLEND_SRC_ALPHA_EXT = $80CB; +var + glBlendFuncSeparateEXT: procedure(sfactorRGB: GLenum; dfactorRGB: GLenum; sfactorAlpha: GLenum; dfactorAlpha: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_blend_func_separate: Boolean; + +//***** GL_EXT_blend_logic_op *****// + +function Load_GL_EXT_blend_logic_op: Boolean; + +//***** GL_EXT_blend_minmax *****// +const + GL_FUNC_ADD_EXT = $8006; + GL_MIN_EXT = $8007; + GL_MAX_EXT = $8008; + GL_BLEND_EQUATION_EXT = $8009; +var + glBlendEquationEXT: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_blend_minmax: Boolean; + +//***** GL_EXT_blend_subtract *****// +const + GL_FUNC_SUBTRACT_EXT = $800A; + GL_FUNC_REVERSE_SUBTRACT_EXT = $800B; + +function Load_GL_EXT_blend_subtract: Boolean; + +//***** GL_EXT_clip_volume_hint *****// +const + GL_CLIP_VOLUME_CLIPPING_HINT_EXT = $80F0; + +function Load_GL_EXT_clip_volume_hint: Boolean; + +//***** GL_EXT_color_subtable *****// +var + glColorSubTableEXT: procedure(target: GLenum; start: GLsizei; count: GLsizei; format: GLenum; _type: GLenum; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyColorSubTableEXT: procedure(target: GLenum; start: GLsizei; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_color_subtable: Boolean; + +//***** GL_EXT_compiled_vertex_array *****// +const + GL_ARRAY_ELEMENT_LOCK_FIRST_EXT = $81A8; + GL_ARRAY_ELEMENT_LOCK_COUNT_EXT = $81A9; +var + glLockArraysEXT: procedure(first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUnlockArraysEXT: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_compiled_vertex_array: Boolean; + +//***** GL_EXT_convolution *****// +const + GL_CONVOLUTION_1D_EXT = $8010; + GL_CONVOLUTION_2D_EXT = $8011; + GL_SEPARABLE_2D_EXT = $8012; + GL_CONVOLUTION_BORDER_MODE_EXT = $8013; + GL_CONVOLUTION_FILTER_SCALE_EXT = $8014; + GL_CONVOLUTION_FILTER_BIAS_EXT = $8015; + GL_REDUCE_EXT = $8016; + GL_CONVOLUTION_FORMAT_EXT = $8017; + GL_CONVOLUTION_WIDTH_EXT = $8018; + GL_CONVOLUTION_HEIGHT_EXT = $8019; + GL_MAX_CONVOLUTION_WIDTH_EXT = $801A; + GL_MAX_CONVOLUTION_HEIGHT_EXT = $801B; + GL_POST_CONVOLUTION_RED_SCALE_EXT = $801C; + GL_POST_CONVOLUTION_GREEN_SCALE_EXT = $801D; + GL_POST_CONVOLUTION_BLUE_SCALE_EXT = $801E; + GL_POST_CONVOLUTION_ALPHA_SCALE_EXT = $801F; + GL_POST_CONVOLUTION_RED_BIAS_EXT = $8020; + GL_POST_CONVOLUTION_GREEN_BIAS_EXT = $8021; + GL_POST_CONVOLUTION_BLUE_BIAS_EXT = $8022; + GL_POST_CONVOLUTION_ALPHA_BIAS_EXT = $8023; +var + glConvolutionFilter1DEXT: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionFilter2DEXT: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyConvolutionFilter1DEXT: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyConvolutionFilter2DEXT: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei; height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetConvolutionFilterEXT: procedure(target: GLenum; format: GLenum; _type: GLenum; image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSeparableFilter2DEXT: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const row: PGLvoid; const column: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetSeparableFilterEXT: procedure(target: GLenum; format: GLenum; _type: GLenum; row: PGLvoid; column: PGLvoid; span: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameteriEXT: procedure(target: GLenum; pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameterivEXT: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameterfEXT: procedure(target: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameterfvEXT: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetConvolutionParameterivEXT: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetConvolutionParameterfvEXT: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_convolution: Boolean; + +//***** GL_EXT_histogram *****// +const + GL_HISTOGRAM_EXT = $8024; + GL_PROXY_HISTOGRAM_EXT = $8025; + GL_HISTOGRAM_WIDTH_EXT = $8026; + GL_HISTOGRAM_FORMAT_EXT = $8027; + GL_HISTOGRAM_RED_SIZE_EXT = $8028; + GL_HISTOGRAM_GREEN_SIZE_EXT = $8029; + GL_HISTOGRAM_BLUE_SIZE_EXT = $802A; + GL_HISTOGRAM_ALPHA_SIZE_EXT = $802B; + GL_HISTOGRAM_LUMINANCE_SIZE_EXT = $802C; + GL_HISTOGRAM_SINK_EXT = $802D; + GL_MINMAX_EXT = $802E; + GL_MINMAX_FORMAT_EXT = $802F; + GL_MINMAX_SINK_EXT = $8030; +var + glHistogramEXT: procedure(target: GLenum; width: GLsizei; internalformat: GLenum; sink: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glResetHistogramEXT: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetHistogramEXT: procedure(target: GLenum; reset: GLboolean; format: GLenum; _type: GLenum; values: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetHistogramParameterivEXT: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetHistogramParameterfvEXT: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMinmaxEXT: procedure(target: GLenum; internalformat: GLenum; sink: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glResetMinmaxEXT: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMinmaxEXT: procedure(target: GLenum; reset: GLboolean; format: GLenum; _type: GLenum; values: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMinmaxParameterivEXT: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMinmaxParameterfvEXT: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_histogram: Boolean; + +//***** GL_EXT_multi_draw_arrays *****// +var + glMultiDrawArraysEXT: procedure(mode: GLenum; first: PGLint; count: PGLsizei; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiDrawElementsEXT: procedure(mode: GLenum; count: PGLsizei; _type: GLenum; const indices: PGLvoid; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_multi_draw_arrays: Boolean; + +//***** GL_EXT_packed_pixels *****// +const + GL_UNSIGNED_BYTE_3_3_2_EXT = $8032; + GL_UNSIGNED_SHORT_4_4_4_4_EXT = $8033; + GL_UNSIGNED_SHORT_5_5_5_1_EXT = $8034; + GL_UNSIGNED_INT_8_8_8_8_EXT = $8035; + GL_UNSIGNED_INT_10_10_10_2_EXT = $8036; + +function Load_GL_EXT_packed_pixels: Boolean; + +//***** GL_EXT_paletted_texture *****// +const + GL_COLOR_INDEX1_EXT = $80E2; + GL_COLOR_INDEX2_EXT = $80E3; + GL_COLOR_INDEX4_EXT = $80E4; + GL_COLOR_INDEX8_EXT = $80E5; + GL_COLOR_INDEX12_EXT = $80E6; + GL_COLOR_INDEX16_EXT = $80E7; + GL_COLOR_TABLE_FORMAT_EXT = $80D8; + GL_COLOR_TABLE_WIDTH_EXT = $80D9; + GL_COLOR_TABLE_RED_SIZE_EXT = $80DA; + GL_COLOR_TABLE_GREEN_SIZE_EXT = $80DB; + GL_COLOR_TABLE_BLUE_SIZE_EXT = $80DC; + GL_COLOR_TABLE_ALPHA_SIZE_EXT = $80DD; + GL_COLOR_TABLE_LUMINANCE_SIZE_EXT = $80DE; + GL_COLOR_TABLE_INTENSITY_SIZE_EXT = $80DF; + GL_TEXTURE_INDEX_SIZE_EXT = $80ED; + GL_TEXTURE_1D = $0DE0; + GL_TEXTURE_2D = $0DE1; + GL_TEXTURE_3D_EXT = $806F; + // GL_TEXTURE_CUBE_MAP_ARB { already defined } + GL_PROXY_TEXTURE_1D = $8063; + GL_PROXY_TEXTURE_2D = $8064; + GL_PROXY_TEXTURE_3D_EXT = $8070; + // GL_PROXY_TEXTURE_CUBE_MAP_ARB { already defined } + // GL_TEXTURE_1D { already defined } + // GL_TEXTURE_2D { already defined } + // GL_TEXTURE_3D_EXT { already defined } + // GL_TEXTURE_CUBE_MAP_ARB { already defined } +var + glColorTableEXT: procedure(target: GLenum; internalFormat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + // glColorSubTableEXT { already defined } + glGetColorTableEXT: procedure(target: GLenum; format: GLenum; _type: GLenum; data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTableParameterivEXT: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTableParameterfvEXT: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_paletted_texture: Boolean; + +//***** GL_EXT_point_parameters *****// +const + GL_POINT_SIZE_MIN_EXT = $8126; + GL_POINT_SIZE_MAX_EXT = $8127; + GL_POINT_FADE_THRESHOLD_SIZE_EXT = $8128; + GL_DISTANCE_ATTENUATION_EXT = $8129; +var + glPointParameterfEXT: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPointParameterfvEXT: procedure(pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_point_parameters: Boolean; + +//***** GL_EXT_polygon_offset *****// +const + GL_POLYGON_OFFSET_EXT = $8037; + GL_POLYGON_OFFSET_FACTOR_EXT = $8038; + GL_POLYGON_OFFSET_BIAS_EXT = $8039; +var + glPolygonOffsetEXT: procedure(factor: GLfloat; bias: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_polygon_offset: Boolean; + +//***** GL_EXT_separate_specular_color *****// +const + GL_LIGHT_MODEL_COLOR_CONTROL_EXT = $81F8; + GL_SINGLE_COLOR_EXT = $81F9; + GL_SEPARATE_SPECULAR_COLOR_EXT = $81FA; + +function Load_GL_EXT_separate_specular_color: Boolean; + +//***** GL_EXT_shadow_funcs *****// + +function Load_GL_EXT_shadow_funcs: Boolean; + +//***** GL_EXT_shared_texture_palette *****// +const + GL_SHARED_TEXTURE_PALETTE_EXT = $81FB; + +function Load_GL_EXT_shared_texture_palette: Boolean; + +//***** GL_EXT_stencil_two_side *****// +const + GL_STENCIL_TEST_TWO_SIDE_EXT = $8910; + GL_ACTIVE_STENCIL_FACE_EXT = $8911; +var + glActiveStencilFaceEXT: procedure(face: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_stencil_two_side: Boolean; + +//***** GL_EXT_stencil_wrap *****// +const + GL_INCR_WRAP_EXT = $8507; + GL_DECR_WRAP_EXT = $8508; + +function Load_GL_EXT_stencil_wrap: Boolean; + +//***** GL_EXT_subtexture *****// +var + glTexSubImage1DEXT: procedure(target: GLenum; level: GLint; xoffset: GLint; width: GLsizei; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexSubImage2DEXT: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexSubImage3DEXT: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_subtexture: Boolean; + +//***** GL_EXT_texture3D *****// +const + GL_PACK_SKIP_IMAGES_EXT = $806B; + GL_PACK_IMAGE_HEIGHT_EXT = $806C; + GL_UNPACK_SKIP_IMAGES_EXT = $806D; + GL_UNPACK_IMAGE_HEIGHT_EXT = $806E; + // GL_TEXTURE_3D_EXT { already defined } + // GL_PROXY_TEXTURE_3D_EXT { already defined } + GL_TEXTURE_DEPTH_EXT = $8071; + GL_TEXTURE_WRAP_R_EXT = $8072; + GL_MAX_3D_TEXTURE_SIZE_EXT = $8073; +var + glTexImage3DEXT: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_texture3D: Boolean; + +//***** GL_EXT_texture_compression_s3tc *****// +const + GL_COMPRESSED_RGB_S3TC_DXT1_EXT = $83F0; + GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = $83F1; + GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = $83F2; + GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = $83F3; + +function Load_GL_EXT_texture_compression_s3tc: Boolean; + +//***** GL_EXT_texture_env_add *****// + +function Load_GL_EXT_texture_env_add: Boolean; + +//***** GL_EXT_texture_env_combine *****// +const + GL_COMBINE_EXT = $8570; + GL_COMBINE_RGB_EXT = $8571; + GL_COMBINE_ALPHA_EXT = $8572; + GL_SOURCE0_RGB_EXT = $8580; + GL_SOURCE1_RGB_EXT = $8581; + GL_SOURCE2_RGB_EXT = $8582; + GL_SOURCE0_ALPHA_EXT = $8588; + GL_SOURCE1_ALPHA_EXT = $8589; + GL_SOURCE2_ALPHA_EXT = $858A; + GL_OPERAND0_RGB_EXT = $8590; + GL_OPERAND1_RGB_EXT = $8591; + GL_OPERAND2_RGB_EXT = $8592; + GL_OPERAND0_ALPHA_EXT = $8598; + GL_OPERAND1_ALPHA_EXT = $8599; + GL_OPERAND2_ALPHA_EXT = $859A; + GL_RGB_SCALE_EXT = $8573; + GL_ADD_SIGNED_EXT = $8574; + GL_INTERPOLATE_EXT = $8575; + GL_CONSTANT_EXT = $8576; + GL_PRIMARY_COLOR_EXT = $8577; + GL_PREVIOUS_EXT = $8578; + +function Load_GL_EXT_texture_env_combine: Boolean; + +//***** GL_EXT_texture_env_dot3 *****// +const + GL_DOT3_RGB_EXT = $8740; + GL_DOT3_RGBA_EXT = $8741; + +function Load_GL_EXT_texture_env_dot3: Boolean; + +//***** GL_EXT_texture_filter_anisotropic *****// +const + GL_TEXTURE_MAX_ANISOTROPY_EXT = $84FE; + GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = $84FF; + +function Load_GL_EXT_texture_filter_anisotropic: Boolean; + +//***** GL_EXT_texture_lod_bias *****// +const + GL_TEXTURE_FILTER_CONTROL_EXT = $8500; + GL_TEXTURE_LOD_BIAS_EXT = $8501; + GL_MAX_TEXTURE_LOD_BIAS_EXT = $84FD; + +function Load_GL_EXT_texture_lod_bias: Boolean; + +//***** GL_EXT_texture_object *****// +const + GL_TEXTURE_PRIORITY_EXT = $8066; + GL_TEXTURE_RESIDENT_EXT = $8067; + GL_TEXTURE_1D_BINDING_EXT = $8068; + GL_TEXTURE_2D_BINDING_EXT = $8069; + GL_TEXTURE_3D_BINDING_EXT = $806A; +var + glGenTexturesEXT: procedure(n: GLsizei; textures: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteTexturesEXT: procedure(n: GLsizei; const textures: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindTextureEXT: procedure(target: GLenum; texture: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPrioritizeTexturesEXT: procedure(n: GLsizei; const textures: PGLuint; const priorities: PGLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glAreTexturesResidentEXT: function(n: GLsizei; const textures: PGLuint; residences: PGLboolean): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsTextureEXT: function(texture: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_texture_object: Boolean; + +//***** GL_EXT_vertex_array *****// +const + GL_VERTEX_ARRAY_EXT = $8074; + GL_NORMAL_ARRAY_EXT = $8075; + GL_COLOR_ARRAY_EXT = $8076; + GL_INDEX_ARRAY_EXT = $8077; + GL_TEXTURE_COORD_ARRAY_EXT = $8078; + GL_EDGE_FLAG_ARRAY_EXT = $8079; + GL_DOUBLE_EXT = $140A; + GL_VERTEX_ARRAY_SIZE_EXT = $807A; + GL_VERTEX_ARRAY_TYPE_EXT = $807B; + GL_VERTEX_ARRAY_STRIDE_EXT = $807C; + GL_VERTEX_ARRAY_COUNT_EXT = $807D; + GL_NORMAL_ARRAY_TYPE_EXT = $807E; + GL_NORMAL_ARRAY_STRIDE_EXT = $807F; + GL_NORMAL_ARRAY_COUNT_EXT = $8080; + GL_COLOR_ARRAY_SIZE_EXT = $8081; + GL_COLOR_ARRAY_TYPE_EXT = $8082; + GL_COLOR_ARRAY_STRIDE_EXT = $8083; + GL_COLOR_ARRAY_COUNT_EXT = $8084; + GL_INDEX_ARRAY_TYPE_EXT = $8085; + GL_INDEX_ARRAY_STRIDE_EXT = $8086; + GL_INDEX_ARRAY_COUNT_EXT = $8087; + GL_TEXTURE_COORD_ARRAY_SIZE_EXT = $8088; + GL_TEXTURE_COORD_ARRAY_TYPE_EXT = $8089; + GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = $808A; + GL_TEXTURE_COORD_ARRAY_COUNT_EXT = $808B; + GL_EDGE_FLAG_ARRAY_STRIDE_EXT = $808C; + GL_EDGE_FLAG_ARRAY_COUNT_EXT = $808D; + GL_VERTEX_ARRAY_POINTER_EXT = $808E; + GL_NORMAL_ARRAY_POINTER_EXT = $808F; + GL_COLOR_ARRAY_POINTER_EXT = $8090; + GL_INDEX_ARRAY_POINTER_EXT = $8091; + GL_TEXTURE_COORD_ARRAY_POINTER_EXT = $8092; + GL_EDGE_FLAG_ARRAY_POINTER_EXT = $8093; +var + glArrayElementEXT: procedure(i: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawArraysEXT: procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalPointerEXT: procedure(_type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexPointerEXT: procedure(_type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoordPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEdgeFlagPointerEXT: procedure(stride: GLsizei; count: GLsizei; const pointer: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPointervEXT: procedure(pname: GLenum; params: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_vertex_array: Boolean; + +//***** GL_EXT_vertex_shader *****// +const + GL_VERTEX_SHADER_EXT = $8780; + GL_VARIANT_VALUE_EXT = $87E4; + GL_VARIANT_DATATYPE_EXT = $87E5; + GL_VARIANT_ARRAY_STRIDE_EXT = $87E6; + GL_VARIANT_ARRAY_TYPE_EXT = $87E7; + GL_VARIANT_ARRAY_EXT = $87E8; + GL_VARIANT_ARRAY_POINTER_EXT = $87E9; + GL_INVARIANT_VALUE_EXT = $87EA; + GL_INVARIANT_DATATYPE_EXT = $87EB; + GL_LOCAL_CONSTANT_VALUE_EXT = $87EC; + GL_LOCAL_CONSTANT_DATATYPE_EXT = $87ED; + GL_OP_INDEX_EXT = $8782; + GL_OP_NEGATE_EXT = $8783; + GL_OP_DOT3_EXT = $8784; + GL_OP_DOT4_EXT = $8785; + GL_OP_MUL_EXT = $8786; + GL_OP_ADD_EXT = $8787; + GL_OP_MADD_EXT = $8788; + GL_OP_FRAC_EXT = $8789; + GL_OP_MAX_EXT = $878A; + GL_OP_MIN_EXT = $878B; + GL_OP_SET_GE_EXT = $878C; + GL_OP_SET_LT_EXT = $878D; + GL_OP_CLAMP_EXT = $878E; + GL_OP_FLOOR_EXT = $878F; + GL_OP_ROUND_EXT = $8790; + GL_OP_EXP_BASE_2_EXT = $8791; + GL_OP_LOG_BASE_2_EXT = $8792; + GL_OP_POWER_EXT = $8793; + GL_OP_RECIP_EXT = $8794; + GL_OP_RECIP_SQRT_EXT = $8795; + GL_OP_SUB_EXT = $8796; + GL_OP_CROSS_PRODUCT_EXT = $8797; + GL_OP_MULTIPLY_MATRIX_EXT = $8798; + GL_OP_MOV_EXT = $8799; + GL_OUTPUT_VERTEX_EXT = $879A; + GL_OUTPUT_COLOR0_EXT = $879B; + GL_OUTPUT_COLOR1_EXT = $879C; + GL_OUTPUT_TEXTURE_COORD0_EXT = $879D; + GL_OUTPUT_TEXTURE_COORD1_EXT = $879E; + GL_OUTPUT_TEXTURE_COORD2_EXT = $879F; + GL_OUTPUT_TEXTURE_COORD3_EXT = $87A0; + GL_OUTPUT_TEXTURE_COORD4_EXT = $87A1; + GL_OUTPUT_TEXTURE_COORD5_EXT = $87A2; + GL_OUTPUT_TEXTURE_COORD6_EXT = $87A3; + GL_OUTPUT_TEXTURE_COORD7_EXT = $87A4; + GL_OUTPUT_TEXTURE_COORD8_EXT = $87A5; + GL_OUTPUT_TEXTURE_COORD9_EXT = $87A6; + GL_OUTPUT_TEXTURE_COORD10_EXT = $87A7; + GL_OUTPUT_TEXTURE_COORD11_EXT = $87A8; + GL_OUTPUT_TEXTURE_COORD12_EXT = $87A9; + GL_OUTPUT_TEXTURE_COORD13_EXT = $87AA; + GL_OUTPUT_TEXTURE_COORD14_EXT = $87AB; + GL_OUTPUT_TEXTURE_COORD15_EXT = $87AC; + GL_OUTPUT_TEXTURE_COORD16_EXT = $87AD; + GL_OUTPUT_TEXTURE_COORD17_EXT = $87AE; + GL_OUTPUT_TEXTURE_COORD18_EXT = $87AF; + GL_OUTPUT_TEXTURE_COORD19_EXT = $87B0; + GL_OUTPUT_TEXTURE_COORD20_EXT = $87B1; + GL_OUTPUT_TEXTURE_COORD21_EXT = $87B2; + GL_OUTPUT_TEXTURE_COORD22_EXT = $87B3; + GL_OUTPUT_TEXTURE_COORD23_EXT = $87B4; + GL_OUTPUT_TEXTURE_COORD24_EXT = $87B5; + GL_OUTPUT_TEXTURE_COORD25_EXT = $87B6; + GL_OUTPUT_TEXTURE_COORD26_EXT = $87B7; + GL_OUTPUT_TEXTURE_COORD27_EXT = $87B8; + GL_OUTPUT_TEXTURE_COORD28_EXT = $87B9; + GL_OUTPUT_TEXTURE_COORD29_EXT = $87BA; + GL_OUTPUT_TEXTURE_COORD30_EXT = $87BB; + GL_OUTPUT_TEXTURE_COORD31_EXT = $87BC; + GL_OUTPUT_FOG_EXT = $87BD; + GL_SCALAR_EXT = $87BE; + GL_VECTOR_EXT = $87BF; + GL_MATRIX_EXT = $87C0; + GL_VARIANT_EXT = $87C1; + GL_INVARIANT_EXT = $87C2; + GL_LOCAL_CONSTANT_EXT = $87C3; + GL_LOCAL_EXT = $87C4; + GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT = $87C5; + GL_MAX_VERTEX_SHADER_VARIANTS_EXT = $87C6; + GL_MAX_VERTEX_SHADER_INVARIANTS_EXT = $87C7; + GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = $87C8; + GL_MAX_VERTEX_SHADER_LOCALS_EXT = $87C9; + GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT = $87CA; + GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT = $87CB; + GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = $87CC; + GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT = $87CD; + GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT = $87CE; + GL_VERTEX_SHADER_INSTRUCTIONS_EXT = $87CF; + GL_VERTEX_SHADER_VARIANTS_EXT = $87D0; + GL_VERTEX_SHADER_INVARIANTS_EXT = $87D1; + GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = $87D2; + GL_VERTEX_SHADER_LOCALS_EXT = $87D3; + GL_VERTEX_SHADER_BINDING_EXT = $8781; + GL_VERTEX_SHADER_OPTIMIZED_EXT = $87D4; + GL_X_EXT = $87D5; + GL_Y_EXT = $87D6; + GL_Z_EXT = $87D7; + GL_W_EXT = $87D8; + GL_NEGATIVE_X_EXT = $87D9; + GL_NEGATIVE_Y_EXT = $87DA; + GL_NEGATIVE_Z_EXT = $87DB; + GL_NEGATIVE_W_EXT = $87DC; + GL_ZERO_EXT = $87DD; + GL_ONE_EXT = $87DE; + GL_NEGATIVE_ONE_EXT = $87DF; + GL_NORMALIZED_RANGE_EXT = $87E0; + GL_FULL_RANGE_EXT = $87E1; + GL_CURRENT_VERTEX_EXT = $87E2; + GL_MVP_MATRIX_EXT = $87E3; +var + glBeginVertexShaderEXT: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEndVertexShaderEXT: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindVertexShaderEXT: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenVertexShadersEXT: function(range: GLuint): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteVertexShaderEXT: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glShaderOp1EXT: procedure(op: GLenum; res: GLuint; arg1: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glShaderOp2EXT: procedure(op: GLenum; res: GLuint; arg1: GLuint; arg2: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glShaderOp3EXT: procedure(op: GLenum; res: GLuint; arg1: GLuint; arg2: GLuint; arg3: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSwizzleEXT: procedure(res: GLuint; _in: GLuint; outX: GLenum; outY: GLenum; outZ: GLenum; outW: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWriteMaskEXT: procedure(res: GLuint; _in: GLuint; outX: GLenum; outY: GLenum; outZ: GLenum; outW: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glInsertComponentEXT: procedure(res: GLuint; src: GLuint; num: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glExtractComponentEXT: procedure(res: GLuint; src: GLuint; num: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenSymbolsEXT: function(datatype: GLenum; storagetype: GLenum; range: GLenum; components: GLuint): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSetInvariantEXT: procedure(id: GLuint; _type: GLenum; addr: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSetLocalConstantEXT: procedure(id: GLuint; _type: GLenum; addr: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantbvEXT: procedure(id: GLuint; addr: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantsvEXT: procedure(id: GLuint; addr: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantivEXT: procedure(id: GLuint; addr: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantfvEXT: procedure(id: GLuint; addr: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantdvEXT: procedure(id: GLuint; addr: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantubvEXT: procedure(id: GLuint; addr: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantusvEXT: procedure(id: GLuint; addr: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantuivEXT: procedure(id: GLuint; addr: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantPointerEXT: procedure(id: GLuint; _type: GLenum; stride: GLuint; addr: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEnableVariantClientStateEXT: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDisableVariantClientStateEXT: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindLightParameterEXT: function(light: GLenum; value: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindMaterialParameterEXT: function(face: GLenum; value: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindTexGenParameterEXT: function(_unit: GLenum; coord: GLenum; value: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindTextureUnitParameterEXT: function(_unit: GLenum; value: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindParameterEXT: function(value: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsVariantEnabledEXT: function(id: GLuint; cap: GLenum): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVariantBooleanvEXT: procedure(id: GLuint; value: GLenum; data: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVariantIntegervEXT: procedure(id: GLuint; value: GLenum; data: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVariantFloatvEXT: procedure(id: GLuint; value: GLenum; data: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVariantPointervEXT: procedure(id: GLuint; value: GLenum; data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetInvariantBooleanvEXT: procedure(id: GLuint; value: GLenum; data: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetInvariantIntegervEXT: procedure(id: GLuint; value: GLenum; data: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetInvariantFloatvEXT: procedure(id: GLuint; value: GLenum; data: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetLocalConstantBooleanvEXT: procedure(id: GLuint; value: GLenum; data: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetLocalConstantIntegervEXT: procedure(id: GLuint; value: GLenum; data: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetLocalConstantFloatvEXT: procedure(id: GLuint; value: GLenum; data: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_vertex_shader: Boolean; + +//***** GL_EXT_vertex_weighting *****// +const + GL_VERTEX_WEIGHTING_EXT = $8509; + GL_MODELVIEW0_EXT = $1700; + GL_MODELVIEW1_EXT = $850A; + GL_MODELVIEW0_MATRIX_EXT = $0BA6; + GL_MODELVIEW1_MATRIX_EXT = $8506; + GL_CURRENT_VERTEX_WEIGHT_EXT = $850B; + GL_VERTEX_WEIGHT_ARRAY_EXT = $850C; + GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT = $850D; + GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT = $850E; + GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT = $850F; + GL_MODELVIEW0_STACK_DEPTH_EXT = $0BA3; + GL_MODELVIEW1_STACK_DEPTH_EXT = $8502; + GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT = $8510; +var + glVertexWeightfEXT: procedure(weight: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexWeightfvEXT: procedure(weight: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexWeightPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_vertex_weighting: Boolean; + +//***** GL_HP_occlusion_test *****// +const + GL_OCCLUSION_TEST_HP = $8165; + GL_OCCLUSION_TEST_RESULT_HP = $8166; + +function Load_GL_HP_occlusion_test: Boolean; + +//***** GL_NV_blend_square *****// + +function Load_GL_NV_blend_square: Boolean; + +//***** GL_NV_copy_depth_to_color *****// +const + GL_DEPTH_STENCIL_TO_RGBA_NV = $886E; + GL_DEPTH_STENCIL_TO_BGRA_NV = $886F; + +function Load_GL_NV_copy_depth_to_color: Boolean; + +//***** GL_NV_depth_clamp *****// +const + GL_DEPTH_CLAMP_NV = $864F; + +function Load_GL_NV_depth_clamp: Boolean; + +//***** GL_NV_evaluators *****// +const + GL_EVAL_2D_NV = $86C0; + GL_EVAL_TRIANGULAR_2D_NV = $86C1; + GL_MAP_TESSELLATION_NV = $86C2; + GL_MAP_ATTRIB_U_ORDER_NV = $86C3; + GL_MAP_ATTRIB_V_ORDER_NV = $86C4; + GL_EVAL_FRACTIONAL_TESSELLATION_NV = $86C5; + GL_EVAL_VERTEX_ATTRIB0_NV = $86C6; + GL_EVAL_VERTEX_ATTRIB1_NV = $86C7; + GL_EVAL_VERTEX_ATTRIB2_NV = $86C8; + GL_EVAL_VERTEX_ATTRIB3_NV = $86C9; + GL_EVAL_VERTEX_ATTRIB4_NV = $86CA; + GL_EVAL_VERTEX_ATTRIB5_NV = $86CB; + GL_EVAL_VERTEX_ATTRIB6_NV = $86CC; + GL_EVAL_VERTEX_ATTRIB7_NV = $86CD; + GL_EVAL_VERTEX_ATTRIB8_NV = $86CE; + GL_EVAL_VERTEX_ATTRIB9_NV = $86CF; + GL_EVAL_VERTEX_ATTRIB10_NV = $86D0; + GL_EVAL_VERTEX_ATTRIB11_NV = $86D1; + GL_EVAL_VERTEX_ATTRIB12_NV = $86D2; + GL_EVAL_VERTEX_ATTRIB13_NV = $86D3; + GL_EVAL_VERTEX_ATTRIB14_NV = $86D4; + GL_EVAL_VERTEX_ATTRIB15_NV = $86D5; + GL_MAX_MAP_TESSELLATION_NV = $86D6; + GL_MAX_RATIONAL_EVAL_ORDER_NV = $86D7; +var + glMapControlPointsNV: procedure(target: GLenum; index: GLuint; _type: GLenum; ustride: GLsizei; vstride: GLsizei; uorder: GLint; vorder: GLint; _packed: GLboolean; const points: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapParameterivNV: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapParameterfvNV: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapControlPointsNV: procedure(target: GLenum; index: GLuint; _type: GLenum; ustride: GLsizei; vstride: GLsizei; _packed: GLboolean; points: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapParameterivNV: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapParameterfvNV: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapAttribParameterivNV: procedure(target: GLenum; index: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapAttribParameterfvNV: procedure(target: GLenum; index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalMapsNV: procedure(target: GLenum; mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_NV_evaluators: Boolean; + +//***** GL_NV_fence *****// +const + GL_ALL_COMPLETED_NV = $84F2; + GL_FENCE_STATUS_NV = $84F3; + GL_FENCE_CONDITION_NV = $84F4; +var + glGenFencesNV: procedure(n: GLsizei; fences: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteFencesNV: procedure(n: GLsizei; const fences: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSetFenceNV: procedure(fence: GLuint; condition: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTestFenceNV: function(fence: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFinishFenceNV: procedure(fence: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsFenceNV: function(fence: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetFenceivNV: procedure(fence: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_NV_fence: Boolean; + +//***** GL_NV_fog_distance *****// +const + GL_FOG_DISTANCE_MODE_NV = $855A; + GL_EYE_RADIAL_NV = $855B; + GL_EYE_PLANE_ABSOLUTE_NV = $855C; + +function Load_GL_NV_fog_distance: Boolean; + +//***** GL_NV_light_max_exponent *****// +const + GL_MAX_SHININESS_NV = $8504; + GL_MAX_SPOT_EXPONENT_NV = $8505; + +function Load_GL_NV_light_max_exponent: Boolean; + +//***** GL_NV_multisample_filter_hint *****// +const + GL_MULTISAMPLE_FILTER_HINT_NV = $8534; + +function Load_GL_NV_multisample_filter_hint: Boolean; + +//***** GL_NV_occlusion_query *****// + // GL_OCCLUSION_TEST_HP { already defined } + // GL_OCCLUSION_TEST_RESULT_HP { already defined } +const + GL_PIXEL_COUNTER_BITS_NV = $8864; + GL_CURRENT_OCCLUSION_QUERY_ID_NV = $8865; + GL_PIXEL_COUNT_NV = $8866; + GL_PIXEL_COUNT_AVAILABLE_NV = $8867; +var + glGenOcclusionQueriesNV: procedure(n: GLsizei; ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteOcclusionQueriesNV: procedure(n: GLsizei; const ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsOcclusionQueryNV: function(id: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBeginOcclusionQueryNV: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEndOcclusionQueryNV: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetOcclusionQueryivNV: procedure(id: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetOcclusionQueryuivNV: procedure(id: GLuint; pname: GLenum; params: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_NV_occlusion_query: Boolean; + +//***** GL_NV_packed_depth_stencil *****// +const + GL_DEPTH_STENCIL_NV = $84F9; + GL_UNSIGNED_INT_24_8_NV = $84FA; + +function Load_GL_NV_packed_depth_stencil: Boolean; + +//***** GL_NV_point_sprite *****// +const + GL_POINT_SPRITE_NV = $8861; + GL_COORD_REPLACE_NV = $8862; + GL_POINT_SPRITE_R_MODE_NV = $8863; +var + glPointParameteriNV: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPointParameterivNV: procedure(pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_NV_point_sprite: Boolean; + +//***** GL_NV_register_combiners *****// +const + GL_REGISTER_COMBINERS_NV = $8522; + GL_COMBINER0_NV = $8550; + GL_COMBINER1_NV = $8551; + GL_COMBINER2_NV = $8552; + GL_COMBINER3_NV = $8553; + GL_COMBINER4_NV = $8554; + GL_COMBINER5_NV = $8555; + GL_COMBINER6_NV = $8556; + GL_COMBINER7_NV = $8557; + GL_VARIABLE_A_NV = $8523; + GL_VARIABLE_B_NV = $8524; + GL_VARIABLE_C_NV = $8525; + GL_VARIABLE_D_NV = $8526; + GL_VARIABLE_E_NV = $8527; + GL_VARIABLE_F_NV = $8528; + GL_VARIABLE_G_NV = $8529; + GL_CONSTANT_COLOR0_NV = $852A; + GL_CONSTANT_COLOR1_NV = $852B; + GL_PRIMARY_COLOR_NV = $852C; + GL_SECONDARY_COLOR_NV = $852D; + GL_SPARE0_NV = $852E; + GL_SPARE1_NV = $852F; + GL_UNSIGNED_IDENTITY_NV = $8536; + GL_UNSIGNED_INVERT_NV = $8537; + GL_EXPAND_NORMAL_NV = $8538; + GL_EXPAND_NEGATE_NV = $8539; + GL_HALF_BIAS_NORMAL_NV = $853A; + GL_HALF_BIAS_NEGATE_NV = $853B; + GL_SIGNED_IDENTITY_NV = $853C; + GL_SIGNED_NEGATE_NV = $853D; + GL_E_TIMES_F_NV = $8531; + GL_SPARE0_PLUS_SECONDARY_COLOR_NV = $8532; + GL_SCALE_BY_TWO_NV = $853E; + GL_SCALE_BY_FOUR_NV = $853F; + GL_SCALE_BY_ONE_HALF_NV = $8540; + GL_BIAS_BY_NEGATIVE_ONE_HALF_NV = $8541; + GL_DISCARD_NV = $8530; + GL_COMBINER_INPUT_NV = $8542; + GL_COMBINER_MAPPING_NV = $8543; + GL_COMBINER_COMPONENT_USAGE_NV = $8544; + GL_COMBINER_AB_DOT_PRODUCT_NV = $8545; + GL_COMBINER_CD_DOT_PRODUCT_NV = $8546; + GL_COMBINER_MUX_SUM_NV = $8547; + GL_COMBINER_SCALE_NV = $8548; + GL_COMBINER_BIAS_NV = $8549; + GL_COMBINER_AB_OUTPUT_NV = $854A; + GL_COMBINER_CD_OUTPUT_NV = $854B; + GL_COMBINER_SUM_OUTPUT_NV = $854C; + GL_NUM_GENERAL_COMBINERS_NV = $854E; + GL_COLOR_SUM_CLAMP_NV = $854F; + GL_MAX_GENERAL_COMBINERS_NV = $854D; +var + glCombinerParameterfvNV: procedure(pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCombinerParameterivNV: procedure(pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCombinerParameterfNV: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCombinerParameteriNV: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCombinerInputNV: procedure(stage: GLenum; portion: GLenum; variable: GLenum; input: GLenum; mapping: GLenum; componentUsage: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCombinerOutputNV: procedure(stage: GLenum; portion: GLenum; abOutput: GLenum; cdOutput: GLenum; sumOutput: GLenum; scale: GLenum; bias: GLenum; abDotProduct: GLboolean; cdDotProduct: GLboolean; muxSum: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFinalCombinerInputNV: procedure(variable: GLenum; input: GLenum; mapping: GLenum; componentUsage: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetCombinerInputParameterfvNV: procedure(stage: GLenum; portion: GLenum; variable: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetCombinerInputParameterivNV: procedure(stage: GLenum; portion: GLenum; variable: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetCombinerOutputParameterfvNV: procedure(stage: GLenum; portion: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetCombinerOutputParameterivNV: procedure(stage: GLenum; portion: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetFinalCombinerInputParameterfvNV: procedure(variable: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetFinalCombinerInputParameterivNV: procedure(variable: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_NV_register_combiners: Boolean; + +//***** GL_NV_register_combiners2 *****// +const + GL_PER_STAGE_CONSTANTS_NV = $8535; +var + glCombinerStageParameterfvNV: procedure(stage: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetCombinerStageParameterfvNV: procedure(stage: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_NV_register_combiners2: Boolean; + +//***** GL_NV_texgen_emboss *****// +const + GL_EMBOSS_MAP_NV = $855F; + GL_EMBOSS_LIGHT_NV = $855D; + GL_EMBOSS_CONSTANT_NV = $855E; + +function Load_GL_NV_texgen_emboss: Boolean; + +//***** GL_NV_texgen_reflection *****// +const + GL_NORMAL_MAP_NV = $8511; + GL_REFLECTION_MAP_NV = $8512; + +function Load_GL_NV_texgen_reflection: Boolean; + +//***** GL_NV_texture_compression_vtc *****// + // GL_COMPRESSED_RGB_S3TC_DXT1_EXT { already defined } + // GL_COMPRESSED_RGBA_S3TC_DXT1_EXT { already defined } + // GL_COMPRESSED_RGBA_S3TC_DXT3_EXT { already defined } + // GL_COMPRESSED_RGBA_S3TC_DXT5_EXT { already defined } + +function Load_GL_NV_texture_compression_vtc: Boolean; + +//***** GL_NV_texture_env_combine4 *****// +const + GL_COMBINE4_NV = $8503; + GL_SOURCE3_RGB_NV = $8583; + GL_SOURCE3_ALPHA_NV = $858B; + GL_OPERAND3_RGB_NV = $8593; + GL_OPERAND3_ALPHA_NV = $859B; + +function Load_GL_NV_texture_env_combine4: Boolean; + +//***** GL_NV_texture_rectangle *****// +const + GL_TEXTURE_RECTANGLE_NV = $84F5; + GL_TEXTURE_BINDING_RECTANGLE_NV = $84F6; + GL_PROXY_TEXTURE_RECTANGLE_NV = $84F7; + GL_MAX_RECTANGLE_TEXTURE_SIZE_NV = $84F8; + +function Load_GL_NV_texture_rectangle: Boolean; + +//***** GL_NV_texture_shader *****// +const + GL_TEXTURE_SHADER_NV = $86DE; + GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV = $86D9; + GL_SHADER_OPERATION_NV = $86DF; + GL_CULL_MODES_NV = $86E0; + GL_OFFSET_TEXTURE_MATRIX_NV = $86E1; + GL_OFFSET_TEXTURE_SCALE_NV = $86E2; + GL_OFFSET_TEXTURE_BIAS_NV = $86E3; + GL_PREVIOUS_TEXTURE_INPUT_NV = $86E4; + GL_CONST_EYE_NV = $86E5; + GL_SHADER_CONSISTENT_NV = $86DD; + GL_PASS_THROUGH_NV = $86E6; + GL_CULL_FRAGMENT_NV = $86E7; + GL_OFFSET_TEXTURE_2D_NV = $86E8; + GL_OFFSET_TEXTURE_RECTANGLE_NV = $864C; + GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV = $864D; + GL_DEPENDENT_AR_TEXTURE_2D_NV = $86E9; + GL_DEPENDENT_GB_TEXTURE_2D_NV = $86EA; + GL_DOT_PRODUCT_NV = $86EC; + GL_DOT_PRODUCT_DEPTH_REPLACE_NV = $86ED; + GL_DOT_PRODUCT_TEXTURE_2D_NV = $86EE; + GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV = $864E; + GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV = $86F0; + GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV = $86F1; + GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV = $86F2; + GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV = $86F3; + GL_HILO_NV = $86F4; + GL_DSDT_NV = $86F5; + GL_DSDT_MAG_NV = $86F6; + GL_DSDT_MAG_VIB_NV = $86F7; + GL_UNSIGNED_INT_S8_S8_8_8_NV = $86DA; + GL_UNSIGNED_INT_8_8_S8_S8_REV_NV = $86DB; + GL_SIGNED_RGBA_NV = $86FB; + GL_SIGNED_RGBA8_NV = $86FC; + GL_SIGNED_RGB_NV = $86FE; + GL_SIGNED_RGB8_NV = $86FF; + GL_SIGNED_LUMINANCE_NV = $8701; + GL_SIGNED_LUMINANCE8_NV = $8702; + GL_SIGNED_LUMINANCE_ALPHA_NV = $8703; + GL_SIGNED_LUMINANCE8_ALPHA8_NV = $8704; + GL_SIGNED_ALPHA_NV = $8705; + GL_SIGNED_ALPHA8_NV = $8706; + GL_SIGNED_INTENSITY_NV = $8707; + GL_SIGNED_INTENSITY8_NV = $8708; + GL_SIGNED_RGB_UNSIGNED_ALPHA_NV = $870C; + GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV = $870D; + GL_HILO16_NV = $86F8; + GL_SIGNED_HILO_NV = $86F9; + GL_SIGNED_HILO16_NV = $86FA; + GL_DSDT8_NV = $8709; + GL_DSDT8_MAG8_NV = $870A; + GL_DSDT_MAG_INTENSITY_NV = $86DC; + GL_DSDT8_MAG8_INTENSITY8_NV = $870B; + GL_HI_SCALE_NV = $870E; + GL_LO_SCALE_NV = $870F; + GL_DS_SCALE_NV = $8710; + GL_DT_SCALE_NV = $8711; + GL_MAGNITUDE_SCALE_NV = $8712; + GL_VIBRANCE_SCALE_NV = $8713; + GL_HI_BIAS_NV = $8714; + GL_LO_BIAS_NV = $8715; + GL_DS_BIAS_NV = $8716; + GL_DT_BIAS_NV = $8717; + GL_MAGNITUDE_BIAS_NV = $8718; + GL_VIBRANCE_BIAS_NV = $8719; + GL_TEXTURE_BORDER_VALUES_NV = $871A; + GL_TEXTURE_HI_SIZE_NV = $871B; + GL_TEXTURE_LO_SIZE_NV = $871C; + GL_TEXTURE_DS_SIZE_NV = $871D; + GL_TEXTURE_DT_SIZE_NV = $871E; + GL_TEXTURE_MAG_SIZE_NV = $871F; + +function Load_GL_NV_texture_shader: Boolean; + +//***** GL_NV_texture_shader2 *****// +const + GL_DOT_PRODUCT_TEXTURE_3D_NV = $86EF; + // GL_HILO_NV { already defined } + // GL_DSDT_NV { already defined } + // GL_DSDT_MAG_NV { already defined } + // GL_DSDT_MAG_VIB_NV { already defined } + // GL_UNSIGNED_INT_S8_S8_8_8_NV { already defined } + // GL_UNSIGNED_INT_8_8_S8_S8_REV_NV { already defined } + // GL_SIGNED_RGBA_NV { already defined } + // GL_SIGNED_RGBA8_NV { already defined } + // GL_SIGNED_RGB_NV { already defined } + // GL_SIGNED_RGB8_NV { already defined } + // GL_SIGNED_LUMINANCE_NV { already defined } + // GL_SIGNED_LUMINANCE8_NV { already defined } + // GL_SIGNED_LUMINANCE_ALPHA_NV { already defined } + // GL_SIGNED_LUMINANCE8_ALPHA8_NV { already defined } + // GL_SIGNED_ALPHA_NV { already defined } + // GL_SIGNED_ALPHA8_NV { already defined } + // GL_SIGNED_INTENSITY_NV { already defined } + // GL_SIGNED_INTENSITY8_NV { already defined } + // GL_SIGNED_RGB_UNSIGNED_ALPHA_NV { already defined } + // GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV { already defined } + // GL_HILO16_NV { already defined } + // GL_SIGNED_HILO_NV { already defined } + // GL_SIGNED_HILO16_NV { already defined } + // GL_DSDT8_NV { already defined } + // GL_DSDT8_MAG8_NV { already defined } + // GL_DSDT_MAG_INTENSITY_NV { already defined } + // GL_DSDT8_MAG8_INTENSITY8_NV { already defined } + +function Load_GL_NV_texture_shader2: Boolean; + +//***** GL_NV_texture_shader3 *****// +const + GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV = $8850; + GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV = $8851; + GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV = $8852; + GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV = $8853; + GL_OFFSET_HILO_TEXTURE_2D_NV = $8854; + GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV = $8855; + GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV = $8856; + GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV = $8857; + GL_DEPENDENT_HILO_TEXTURE_2D_NV = $8858; + GL_DEPENDENT_RGB_TEXTURE_3D_NV = $8859; + GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV = $885A; + GL_DOT_PRODUCT_PASS_THROUGH_NV = $885B; + GL_DOT_PRODUCT_TEXTURE_1D_NV = $885C; + GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV = $885D; + GL_HILO8_NV = $885E; + GL_SIGNED_HILO8_NV = $885F; + GL_FORCE_BLUE_TO_ONE_NV = $8860; + +function Load_GL_NV_texture_shader3: Boolean; + +//***** GL_NV_vertex_array_range *****// +const + GL_VERTEX_ARRAY_RANGE_NV = $851D; + GL_VERTEX_ARRAY_RANGE_LENGTH_NV = $851E; + GL_VERTEX_ARRAY_RANGE_VALID_NV = $851F; + GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV = $8520; + GL_VERTEX_ARRAY_RANGE_POINTER_NV = $8521; +var + glVertexArrayRangeNV: procedure(length: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFlushVertexArrayRangeNV: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} +{$IFDEF Win32} + wglAllocateMemoryNV: function(size: GLsizei; readFrequency: GLfloat; writeFrequency: GLfloat; priority: GLfloat): PGLvoid; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglFreeMemoryNV: procedure(pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} +{$ENDIF} + +function Load_GL_NV_vertex_array_range: Boolean; + +//***** GL_NV_vertex_array_range2 *****// +const + GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV = $8533; + +function Load_GL_NV_vertex_array_range2: Boolean; + +//***** GL_NV_vertex_program *****// +const + GL_VERTEX_PROGRAM_NV = $8620; + GL_VERTEX_PROGRAM_POINT_SIZE_NV = $8642; + GL_VERTEX_PROGRAM_TWO_SIDE_NV = $8643; + GL_VERTEX_STATE_PROGRAM_NV = $8621; + GL_ATTRIB_ARRAY_SIZE_NV = $8623; + GL_ATTRIB_ARRAY_STRIDE_NV = $8624; + GL_ATTRIB_ARRAY_TYPE_NV = $8625; + GL_CURRENT_ATTRIB_NV = $8626; + GL_PROGRAM_PARAMETER_NV = $8644; + GL_ATTRIB_ARRAY_POINTER_NV = $8645; + GL_PROGRAM_TARGET_NV = $8646; + GL_PROGRAM_LENGTH_NV = $8627; + GL_PROGRAM_RESIDENT_NV = $8647; + GL_PROGRAM_STRING_NV = $8628; + GL_TRACK_MATRIX_NV = $8648; + GL_TRACK_MATRIX_TRANSFORM_NV = $8649; + GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV = $862E; + GL_MAX_TRACK_MATRICES_NV = $862F; + GL_CURRENT_MATRIX_STACK_DEPTH_NV = $8640; + GL_CURRENT_MATRIX_NV = $8641; + GL_VERTEX_PROGRAM_BINDING_NV = $864A; + GL_PROGRAM_ERROR_POSITION_NV = $864B; + GL_MODELVIEW_PROJECTION_NV = $8629; + GL_MATRIX0_NV = $8630; + GL_MATRIX1_NV = $8631; + GL_MATRIX2_NV = $8632; + GL_MATRIX3_NV = $8633; + GL_MATRIX4_NV = $8634; + GL_MATRIX5_NV = $8635; + GL_MATRIX6_NV = $8636; + GL_MATRIX7_NV = $8637; + GL_IDENTITY_NV = $862A; + GL_INVERSE_NV = $862B; + GL_TRANSPOSE_NV = $862C; + GL_INVERSE_TRANSPOSE_NV = $862D; + GL_VERTEX_ATTRIB_ARRAY0_NV = $8650; + GL_VERTEX_ATTRIB_ARRAY1_NV = $8651; + GL_VERTEX_ATTRIB_ARRAY2_NV = $8652; + GL_VERTEX_ATTRIB_ARRAY3_NV = $8653; + GL_VERTEX_ATTRIB_ARRAY4_NV = $8654; + GL_VERTEX_ATTRIB_ARRAY5_NV = $8655; + GL_VERTEX_ATTRIB_ARRAY6_NV = $8656; + GL_VERTEX_ATTRIB_ARRAY7_NV = $8657; + GL_VERTEX_ATTRIB_ARRAY8_NV = $8658; + GL_VERTEX_ATTRIB_ARRAY9_NV = $8659; + GL_VERTEX_ATTRIB_ARRAY10_NV = $865A; + GL_VERTEX_ATTRIB_ARRAY11_NV = $865B; + GL_VERTEX_ATTRIB_ARRAY12_NV = $865C; + GL_VERTEX_ATTRIB_ARRAY13_NV = $865D; + GL_VERTEX_ATTRIB_ARRAY14_NV = $865E; + GL_VERTEX_ATTRIB_ARRAY15_NV = $865F; + GL_MAP1_VERTEX_ATTRIB0_4_NV = $8660; + GL_MAP1_VERTEX_ATTRIB1_4_NV = $8661; + GL_MAP1_VERTEX_ATTRIB2_4_NV = $8662; + GL_MAP1_VERTEX_ATTRIB3_4_NV = $8663; + GL_MAP1_VERTEX_ATTRIB4_4_NV = $8664; + GL_MAP1_VERTEX_ATTRIB5_4_NV = $8665; + GL_MAP1_VERTEX_ATTRIB6_4_NV = $8666; + GL_MAP1_VERTEX_ATTRIB7_4_NV = $8667; + GL_MAP1_VERTEX_ATTRIB8_4_NV = $8668; + GL_MAP1_VERTEX_ATTRIB9_4_NV = $8669; + GL_MAP1_VERTEX_ATTRIB10_4_NV = $866A; + GL_MAP1_VERTEX_ATTRIB11_4_NV = $866B; + GL_MAP1_VERTEX_ATTRIB12_4_NV = $866C; + GL_MAP1_VERTEX_ATTRIB13_4_NV = $866D; + GL_MAP1_VERTEX_ATTRIB14_4_NV = $866E; + GL_MAP1_VERTEX_ATTRIB15_4_NV = $866F; + GL_MAP2_VERTEX_ATTRIB0_4_NV = $8670; + GL_MAP2_VERTEX_ATTRIB1_4_NV = $8671; + GL_MAP2_VERTEX_ATTRIB2_4_NV = $8672; + GL_MAP2_VERTEX_ATTRIB3_4_NV = $8673; + GL_MAP2_VERTEX_ATTRIB4_4_NV = $8674; + GL_MAP2_VERTEX_ATTRIB5_4_NV = $8675; + GL_MAP2_VERTEX_ATTRIB6_4_NV = $8676; + GL_MAP2_VERTEX_ATTRIB7_4_NV = $8677; + GL_MAP2_VERTEX_ATTRIB8_4_NV = $8678; + GL_MAP2_VERTEX_ATTRIB9_4_NV = $8679; + GL_MAP2_VERTEX_ATTRIB10_4_NV = $867A; + GL_MAP2_VERTEX_ATTRIB11_4_NV = $867B; + GL_MAP2_VERTEX_ATTRIB12_4_NV = $867C; + GL_MAP2_VERTEX_ATTRIB13_4_NV = $867D; + GL_MAP2_VERTEX_ATTRIB14_4_NV = $867E; + GL_MAP2_VERTEX_ATTRIB15_4_NV = $867F; +var + glBindProgramNV: procedure(target: GLenum; id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteProgramsNV: procedure(n: GLsizei; const ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glExecuteProgramNV: procedure(target: GLenum; id: GLuint; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenProgramsNV: procedure(n: GLsizei; ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glAreProgramsResidentNV: function(n: GLsizei; const ids: PGLuint; residences: PGLboolean): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glRequestResidentProgramsNV: procedure(n: GLsizei; ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramParameterfvNV: procedure(target: GLenum; index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramParameterdvNV: procedure(target: GLenum; index: GLuint; pname: GLenum; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramivNV: procedure(id: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramStringNV: procedure(id: GLuint; pname: GLenum; _program: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTrackMatrixivNV: procedure(target: GLenum; address: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribdvNV: procedure(index: GLuint; pname: GLenum; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribfvNV: procedure(index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribivNV: procedure(index: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribPointervNV: procedure(index: GLuint; pname: GLenum; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsProgramNV: function(id: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadProgramNV: procedure(target: GLenum; id: GLuint; len: GLsizei; const _program: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramParameter4fNV: procedure(target: GLenum; index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramParameter4fvNV: procedure(target: GLenum; index: GLuint; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramParameters4dvNV: procedure(target: GLenum; index: GLuint; num: GLuint; const params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramParameters4fvNV: procedure(target: GLenum; index: GLuint; num: GLuint; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTrackMatrixNV: procedure(target: GLenum; address: GLuint; matrix: GLenum; transform: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribPointerNV: procedure(index: GLuint; size: GLint; _type: GLenum; stride: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1sNV: procedure(index: GLuint; x: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1fNV: procedure(index: GLuint; x: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1dNV: procedure(index: GLuint; x: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2sNV: procedure(index: GLuint; x: GLshort; y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2fNV: procedure(index: GLuint; x: GLfloat; y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2dNV: procedure(index: GLuint; x: GLdouble; y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3sNV: procedure(index: GLuint; x: GLshort; y: GLshort; z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3fNV: procedure(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3dNV: procedure(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4sNV: procedure(index: GLuint; x: GLshort; y: GLshort; z: GLshort; w: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4fNV: procedure(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4dNV: procedure(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4ubNV: procedure(index: GLuint; x: GLubyte; y: GLubyte; z: GLubyte; w: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1svNV: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1fvNV: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1dvNV: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2svNV: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2fvNV: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2dvNV: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3svNV: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3fvNV: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3dvNV: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4svNV: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4fvNV: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4dvNV: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4ubvNV: procedure(index: GLuint; const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs1svNV: procedure(index: GLuint; n: GLsizei; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs1fvNV: procedure(index: GLuint; n: GLsizei; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs1dvNV: procedure(index: GLuint; n: GLsizei; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs2svNV: procedure(index: GLuint; n: GLsizei; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs2fvNV: procedure(index: GLuint; n: GLsizei; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs2dvNV: procedure(index: GLuint; n: GLsizei; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs3svNV: procedure(index: GLuint; n: GLsizei; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs3fvNV: procedure(index: GLuint; n: GLsizei; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs3dvNV: procedure(index: GLuint; n: GLsizei; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs4svNV: procedure(index: GLuint; n: GLsizei; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs4fvNV: procedure(index: GLuint; n: GLsizei; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs4dvNV: procedure(index: GLuint; n: GLsizei; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs4ubvNV: procedure(index: GLuint; n: GLsizei; const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_NV_vertex_program: Boolean; + +//***** GL_NV_vertex_program1_1 *****// + +function Load_GL_NV_vertex_program1_1: Boolean; + +//***** GL_ATI_element_array *****// +const + GL_ELEMENT_ARRAY_ATI = $8768; + GL_ELEMENT_ARRAY_TYPE_ATI = $8769; + GL_ELEMENT_ARRAY_POINTER_ATI = $876A; +var + glElementPointerATI: procedure(_type: GLenum; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawElementArrayATI: procedure(mode: GLenum; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawRangeElementArrayATI: procedure(mode: GLenum; start: GLuint; _end: GLuint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ATI_element_array: Boolean; + +//***** GL_ATI_envmap_bumpmap *****// +const + GL_BUMP_ROT_MATRIX_ATI = $8775; + GL_BUMP_ROT_MATRIX_SIZE_ATI = $8776; + GL_BUMP_NUM_TEX_UNITS_ATI = $8777; + GL_BUMP_TEX_UNITS_ATI = $8778; + GL_DUDV_ATI = $8779; + GL_DU8DV8_ATI = $877A; + GL_BUMP_ENVMAP_ATI = $877B; + GL_BUMP_TARGET_ATI = $877C; +var + glTexBumpParameterivATI: procedure(pname: GLenum; param: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexBumpParameterfvATI: procedure(pname: GLenum; param: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexBumpParameterivATI: procedure(pname: GLenum; param: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexBumpParameterfvATI: procedure(pname: GLenum; param: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ATI_envmap_bumpmap: Boolean; + +//***** GL_ATI_fragment_shader *****// +const + GL_FRAGMENT_SHADER_ATI = $8920; + GL_REG_0_ATI = $8921; + GL_REG_1_ATI = $8922; + GL_REG_2_ATI = $8923; + GL_REG_3_ATI = $8924; + GL_REG_4_ATI = $8925; + GL_REG_5_ATI = $8926; + GL_CON_0_ATI = $8941; + GL_CON_1_ATI = $8942; + GL_CON_2_ATI = $8943; + GL_CON_3_ATI = $8944; + GL_CON_4_ATI = $8945; + GL_CON_5_ATI = $8946; + GL_CON_6_ATI = $8947; + GL_CON_7_ATI = $8948; + GL_MOV_ATI = $8961; + GL_ADD_ATI = $8963; + GL_MUL_ATI = $8964; + GL_SUB_ATI = $8965; + GL_DOT3_ATI = $8966; + GL_DOT4_ATI = $8967; + GL_MAD_ATI = $8968; + GL_LERP_ATI = $8969; + GL_CND_ATI = $896A; + GL_CND0_ATI = $896B; + GL_DOT2_ADD_ATI = $896C; + GL_SECONDARY_INTERPOLATOR_ATI = $896D; + GL_SWIZZLE_STR_ATI = $8976; + GL_SWIZZLE_STQ_ATI = $8977; + GL_SWIZZLE_STR_DR_ATI = $8978; + GL_SWIZZLE_STQ_DQ_ATI = $8979; + GL_RED_BIT_ATI = $0001; + GL_GREEN_BIT_ATI = $0002; + GL_BLUE_BIT_ATI = $0004; + GL_2X_BIT_ATI = $0001; + GL_4X_BIT_ATI = $0002; + GL_8X_BIT_ATI = $0004; + GL_HALF_BIT_ATI = $0008; + GL_QUARTER_BIT_ATI = $0010; + GL_EIGHTH_BIT_ATI = $0020; + GL_SATURATE_BIT_ATI = $0040; + // GL_2X_BIT_ATI { already defined } + GL_COMP_BIT_ATI = $0002; + GL_NEGATE_BIT_ATI = $0004; + GL_BIAS_BIT_ATI = $0008; +var + glGenFragmentShadersATI: function(range: GLuint): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindFragmentShaderATI: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteFragmentShaderATI: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBeginFragmentShaderATI: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEndFragmentShaderATI: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPassTexCoordATI: procedure(dst: GLuint; coord: GLuint; swizzle: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSampleMapATI: procedure(dst: GLuint; interp: GLuint; swizzle: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorFragmentOp1ATI: procedure(op: GLenum; dst: GLuint; dstMask: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorFragmentOp2ATI: procedure(op: GLenum; dst: GLuint; dstMask: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorFragmentOp3ATI: procedure(op: GLenum; dst: GLuint; dstMask: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint; arg3: GLuint; arg3Rep: GLuint; arg3Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glAlphaFragmentOp1ATI: procedure(op: GLenum; dst: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glAlphaFragmentOp2ATI: procedure(op: GLenum; dst: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glAlphaFragmentOp3ATI: procedure(op: GLenum; dst: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint; arg3: GLuint; arg3Rep: GLuint; arg3Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSetFragmentShaderConstantATI: procedure(dst: GLuint; const value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ATI_fragment_shader: Boolean; + +//***** GL_ATI_pn_triangles *****// +const + GL_PN_TRIANGLES_ATI = $87F0; + GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI = $87F1; + GL_PN_TRIANGLES_POINT_MODE_ATI = $87F2; + GL_PN_TRIANGLES_NORMAL_MODE_ATI = $87F3; + GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI = $87F4; + GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI = $87F5; + GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI = $87F6; + GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI = $87F7; + GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI = $87F8; +var + glPNTrianglesiATI: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPNTrianglesfATI: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ATI_pn_triangles: Boolean; + +//***** GL_ATI_texture_mirror_once *****// +const + GL_MIRROR_CLAMP_ATI = $8742; + GL_MIRROR_CLAMP_TO_EDGE_ATI = $8743; + +function Load_GL_ATI_texture_mirror_once: Boolean; + +//***** GL_ATI_vertex_array_object *****// +const + GL_STATIC_ATI = $8760; + GL_DYNAMIC_ATI = $8761; + GL_PRESERVE_ATI = $8762; + GL_DISCARD_ATI = $8763; + GL_OBJECT_BUFFER_SIZE_ATI = $8764; + GL_OBJECT_BUFFER_USAGE_ATI = $8765; + GL_ARRAY_OBJECT_BUFFER_ATI = $8766; + GL_ARRAY_OBJECT_OFFSET_ATI = $8767; +var + glNewObjectBufferATI: function(size: GLsizei; const pointer: PGLvoid; usage: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsObjectBufferATI: function(buffer: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUpdateObjectBufferATI: procedure(buffer: GLuint; offset: GLuint; size: GLsizei; const pointer: PGLvoid; preserve: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetObjectBufferfvATI: procedure(buffer: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetObjectBufferivATI: procedure(buffer: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteObjectBufferATI: procedure(buffer: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glArrayObjectATI: procedure(_array: GLenum; size: GLint; _type: GLenum; stride: GLsizei; buffer: GLuint; offset: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetArrayObjectfvATI: procedure(_array: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetArrayObjectivATI: procedure(_array: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantArrayObjectATI: procedure(id: GLuint; _type: GLenum; stride: GLsizei; buffer: GLuint; offset: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVariantArrayObjectfvATI: procedure(id: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVariantArrayObjectivATI: procedure(id: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ATI_vertex_array_object: Boolean; + +//***** GL_ATI_vertex_streams *****// +const + GL_MAX_VERTEX_STREAMS_ATI = $876B; + GL_VERTEX_STREAM0_ATI = $876C; + GL_VERTEX_STREAM1_ATI = $876D; + GL_VERTEX_STREAM2_ATI = $876E; + GL_VERTEX_STREAM3_ATI = $876F; + GL_VERTEX_STREAM4_ATI = $8770; + GL_VERTEX_STREAM5_ATI = $8771; + GL_VERTEX_STREAM6_ATI = $8772; + GL_VERTEX_STREAM7_ATI = $8773; + GL_VERTEX_SOURCE_ATI = $8774; +var + glVertexStream1s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream1i: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream1f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream1d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream1sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream1iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream1fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream1dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2i: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3i: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4i: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3b: procedure(stream: GLenum; coords: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3i: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3bv: procedure(stream: GLenum; coords: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glClientActiveVertexStream: procedure(stream: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexBlendEnvi: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexBlendEnvf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ATI_vertex_streams: Boolean; + +{$IFDEF Win32} +//***** WGL_I3D_image_buffer *****// +const + WGL_IMAGE_BUFFER_MIN_ACCESS_I3D = $0001; + WGL_IMAGE_BUFFER_LOCK_I3D = $0002; +var + wglCreateImageBufferI3D: function(hDC: HDC; dwSize: DWORD; uFlags: UINT): PGLvoid; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglDestroyImageBufferI3D: function(hDC: HDC; pAddress: PGLvoid): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglAssociateImageBufferEventsI3D: function(hdc: HDC; pEvent: PHandle; pAddress: PGLvoid; pSize: PDWORD; count: UINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglReleaseImageBufferEventsI3D: function(hdc: HDC; pAddress: PGLvoid; count: UINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_I3D_image_buffer: Boolean; + +//***** WGL_I3D_swap_frame_lock *****// +var + wglEnableFrameLockI3D: function(): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglDisableFrameLockI3D: function(): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglIsEnabledFrameLockI3D: function(pFlag: PBOOL): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglQueryFrameLockMasterI3D: function(pFlag: PBOOL): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_I3D_swap_frame_lock: Boolean; + +//***** WGL_I3D_swap_frame_usage *****// +var + wglGetFrameUsageI3D: function(pUsage: PGLfloat): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglBeginFrameTrackingI3D: function(): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglEndFrameTrackingI3D: function(): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglQueryFrameTrackingI3D: function(pFrameCount: PDWORD; pMissedFrames: PDWORD; pLastMissedUsage: PGLfloat): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_I3D_swap_frame_usage: Boolean; +{$ENDIF} + +//***** GL_3DFX_texture_compression_FXT1 *****// +const + GL_COMPRESSED_RGB_FXT1_3DFX = $86B0; + GL_COMPRESSED_RGBA_FXT1_3DFX = $86B1; + +function Load_GL_3DFX_texture_compression_FXT1: Boolean; + +//***** GL_IBM_cull_vertex *****// +const + GL_CULL_VERTEX_IBM = $1928A; + +function Load_GL_IBM_cull_vertex: Boolean; + +//***** GL_IBM_multimode_draw_arrays *****// +var + glMultiModeDrawArraysIBM: procedure(mode: PGLenum; first: PGLint; count: PGLsizei; primcount: GLsizei; modestride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiModeDrawElementsIBM: procedure(mode: PGLenum; count: PGLsizei; _type: GLenum; const indices: PGLvoid; primcount: GLsizei; modestride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_IBM_multimode_draw_arrays: Boolean; + +//***** GL_IBM_raster_pos_clip *****// +const + GL_RASTER_POSITION_UNCLIPPED_IBM = $19262; + +function Load_GL_IBM_raster_pos_clip: Boolean; + +//***** GL_IBM_texture_mirrored_repeat *****// +const + GL_MIRRORED_REPEAT_IBM = $8370; + +function Load_GL_IBM_texture_mirrored_repeat: Boolean; + +//***** GL_IBM_vertex_array_lists *****// +const + GL_VERTEX_ARRAY_LIST_IBM = $1929E; + GL_NORMAL_ARRAY_LIST_IBM = $1929F; + GL_COLOR_ARRAY_LIST_IBM = $192A0; + GL_INDEX_ARRAY_LIST_IBM = $192A1; + GL_TEXTURE_COORD_ARRAY_LIST_IBM = $192A2; + GL_EDGE_FLAG_ARRAY_LIST_IBM = $192A3; + GL_FOG_COORDINATE_ARRAY_LIST_IBM = $192A4; + GL_SECONDARY_COLOR_ARRAY_LIST_IBM = $192A5; + GL_VERTEX_ARRAY_LIST_STRIDE_IBM = $192A8; + GL_NORMAL_ARRAY_LIST_STRIDE_IBM = $192A9; + GL_COLOR_ARRAY_LIST_STRIDE_IBM = $192AA; + GL_INDEX_ARRAY_LIST_STRIDE_IBM = $192AB; + GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM = $192AC; + GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM = $192AD; + GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM = $192AE; + GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM = $192AF; +var + glColorPointerListIBM: procedure(size: GLint; _type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColorPointerListIBM: procedure(size: GLint; _type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEdgeFlagPointerListIBM: procedure(stride: GLint; const pointer: PGLboolean; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoordPointerListIBM: procedure(_type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalPointerListIBM: procedure(_type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoordPointerListIBM: procedure(size: GLint; _type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexPointerListIBM: procedure(size: GLint; _type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_IBM_vertex_array_lists: Boolean; + +//***** GL_MESA_resize_buffers *****// +var + glResizeBuffersMESA: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_MESA_resize_buffers: Boolean; + +//***** GL_MESA_window_pos *****// +var + glWindowPos2dMESA: procedure(x: GLdouble; y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2fMESA: procedure(x: GLfloat; y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2iMESA: procedure(x: GLint; y: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2sMESA: procedure(x: GLshort; y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2ivMESA: procedure(const p: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2svMESA: procedure(const p: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2fvMESA: procedure(const p: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2dvMESA: procedure(const p: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3iMESA: procedure(x: GLint; y: GLint; z: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3sMESA: procedure(x: GLshort; y: GLshort; z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3fMESA: procedure(x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3dMESA: procedure(x: GLdouble; y: GLdouble; z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3ivMESA: procedure(const p: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3svMESA: procedure(const p: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3fvMESA: procedure(const p: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3dvMESA: procedure(const p: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4iMESA: procedure(x: GLint; y: GLint; z: GLint; w: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4sMESA: procedure(x: GLshort; y: GLshort; z: GLshort; w: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4fMESA: procedure(x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4dMESA: procedure(x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4ivMESA: procedure(const p: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4svMESA: procedure(const p: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4fvMESA: procedure(const p: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4dvMESA: procedure(const p: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_MESA_window_pos: Boolean; + +//***** GL_OML_interlace *****// +const + GL_INTERLACE_OML = $8980; + GL_INTERLACE_READ_OML = $8981; + +function Load_GL_OML_interlace: Boolean; + +//***** GL_OML_resample *****// +const + GL_PACK_RESAMPLE_OML = $8984; + GL_UNPACK_RESAMPLE_OML = $8985; + GL_RESAMPLE_REPLICATE_OML = $8986; + GL_RESAMPLE_ZERO_FILL_OML = $8987; + GL_RESAMPLE_AVERAGE_OML = $8988; + GL_RESAMPLE_DECIMATE_OML = $8989; + // GL_RESAMPLE_AVERAGE_OML { already defined } + +function Load_GL_OML_resample: Boolean; + +//***** GL_OML_subsample *****// +const + GL_FORMAT_SUBSAMPLE_24_24_OML = $8982; + GL_FORMAT_SUBSAMPLE_244_244_OML = $8983; + +function Load_GL_OML_subsample: Boolean; + +//***** GL_SGIS_generate_mipmap *****// +const + GL_GENERATE_MIPMAP_SGIS = $8191; + GL_GENERATE_MIPMAP_HINT_SGIS = $8192; + +function Load_GL_SGIS_generate_mipmap: Boolean; + +//***** GL_SGIS_multisample *****// +const + GLX_SAMPLE_BUFFERS_SGIS = $186A0; + GLX_SAMPLES_SGIS = $186A1; + GL_MULTISAMPLE_SGIS = $809D; + GL_SAMPLE_ALPHA_TO_MASK_SGIS = $809E; + GL_SAMPLE_ALPHA_TO_ONE_SGIS = $809F; + GL_SAMPLE_MASK_SGIS = $80A0; + GL_MULTISAMPLE_BIT_EXT = $20000000; + GL_1PASS_SGIS = $80A1; + GL_2PASS_0_SGIS = $80A2; + GL_2PASS_1_SGIS = $80A3; + GL_4PASS_0_SGIS = $80A4; + GL_4PASS_1_SGIS = $80A5; + GL_4PASS_2_SGIS = $80A6; + GL_4PASS_3_SGIS = $80A7; + GL_SAMPLE_BUFFERS_SGIS = $80A8; + GL_SAMPLES_SGIS = $80A9; + GL_SAMPLE_MASK_VALUE_SGIS = $80AA; + GL_SAMPLE_MASK_INVERT_SGIS = $80AB; + GL_SAMPLE_PATTERN_SGIS = $80AC; +var + glSampleMaskSGIS: procedure(value: GLclampf; invert: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSamplePatternSGIS: procedure(pattern: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_SGIS_multisample: Boolean; + +//***** GL_SGIS_pixel_texture *****// +const + GL_PIXEL_TEXTURE_SGIS = $8353; + GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS = $8354; + GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS = $8355; + GL_PIXEL_GROUP_COLOR_SGIS = $8356; +var + glPixelTexGenParameteriSGIS: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelTexGenParameterfSGIS: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPixelTexGenParameterivSGIS: procedure(pname: GLenum; params: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPixelTexGenParameterfvSGIS: procedure(pname: GLenum; params: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_SGIS_pixel_texture: Boolean; + +//***** GL_SGIS_texture_border_clamp *****// + // GL_CLAMP_TO_BORDER_SGIS { already defined } + +function Load_GL_SGIS_texture_border_clamp: Boolean; + +//***** GL_SGIS_texture_color_mask *****// +const + GL_TEXTURE_COLOR_WRITEMASK_SGIS = $81EF; +var + glTextureColorMaskSGIS: procedure(r: GLboolean; g: GLboolean; b: GLboolean; a: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_SGIS_texture_color_mask: Boolean; + +//***** GL_SGIS_texture_edge_clamp *****// +const + GL_CLAMP_TO_EDGE_SGIS = $812F; + +function Load_GL_SGIS_texture_edge_clamp: Boolean; + +//***** GL_SGIS_texture_lod *****// +const + GL_TEXTURE_MIN_LOD_SGIS = $813A; + GL_TEXTURE_MAX_LOD_SGIS = $813B; + GL_TEXTURE_BASE_LEVEL_SGIS = $813C; + GL_TEXTURE_MAX_LEVEL_SGIS = $813D; + +function Load_GL_SGIS_texture_lod: Boolean; + +//***** GL_SGIS_depth_texture *****// +const + GL_DEPTH_COMPONENT16_SGIX = $81A5; + GL_DEPTH_COMPONENT24_SGIX = $81A6; + GL_DEPTH_COMPONENT32_SGIX = $81A7; + +function Load_GL_SGIS_depth_texture: Boolean; + +//***** GL_SGIX_fog_offset *****// +const + GL_FOG_OFFSET_SGIX = $8198; + GL_FOG_OFFSET_VALUE_SGIX = $8199; + +function Load_GL_SGIX_fog_offset: Boolean; + +//***** GL_SGIX_interlace *****// +const + GL_INTERLACE_SGIX = $8094; + +function Load_GL_SGIX_interlace: Boolean; + +//***** GL_SGIX_shadow_ambient *****// +const + GL_SHADOW_AMBIENT_SGIX = $80BF; + +function Load_GL_SGIX_shadow_ambient: Boolean; + +//***** GL_SGI_color_matrix *****// +const + GL_COLOR_MATRIX_SGI = $80B1; + GL_COLOR_MATRIX_STACK_DEPTH_SGI = $80B2; + GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI = $80B3; + GL_POST_COLOR_MATRIX_RED_SCALE_SGI = $80B4; + GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI = $80B5; + GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI = $80B6; + GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI = $80B7; + GL_POST_COLOR_MATRIX_RED_BIAS_SGI = $80B8; + GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI = $80B9; + GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI = $80BA; + GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI = $80BB; + +function Load_GL_SGI_color_matrix: Boolean; + +//***** GL_SGI_color_table *****// +const + GL_COLOR_TABLE_SGI = $80D0; + GL_POST_CONVOLUTION_COLOR_TABLE_SGI = $80D1; + GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI = $80D2; + GL_PROXY_COLOR_TABLE_SGI = $80D3; + GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI = $80D4; + GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI = $80D5; + GL_COLOR_TABLE_SCALE_SGI = $80D6; + GL_COLOR_TABLE_BIAS_SGI = $80D7; + GL_COLOR_TABLE_FORMAT_SGI = $80D8; + GL_COLOR_TABLE_WIDTH_SGI = $80D9; + GL_COLOR_TABLE_RED_SIZE_SGI = $80DA; + GL_COLOR_TABLE_GREEN_SIZE_SGI = $80DB; + GL_COLOR_TABLE_BLUE_SIZE_SGI = $80DC; + GL_COLOR_TABLE_ALPHA_SIZE_SGI = $80DD; + GL_COLOR_TABLE_LUMINANCE_SIZE_SGI = $80DE; + GL_COLOR_TABLE_INTENSITY_SIZE_SGI = $80DF; +var + glColorTableSGI: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const table: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyColorTableSGI: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorTableParameterivSGI: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorTableParameterfvSGI: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTableSGI: procedure(target: GLenum; format: GLenum; _type: GLenum; table: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTableParameterivSGI: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTableParameterfvSGI: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_SGI_color_table: Boolean; + +//***** GL_SGI_texture_color_table *****// +const + GL_TEXTURE_COLOR_TABLE_SGI = $80BC; + GL_PROXY_TEXTURE_COLOR_TABLE_SGI = $80BD; + +function Load_GL_SGI_texture_color_table: Boolean; + +//***** GL_SUN_vertex *****// +var + glColor4ubVertex2fSUN: procedure(r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4ubVertex2fvSUN: procedure(const c: PGLubyte; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4ubVertex3fSUN: procedure(r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4ubVertex3fvSUN: procedure(const c: PGLubyte; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3fVertex3fSUN: procedure(r: GLfloat; g: GLfloat; b: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3fVertex3fvSUN: procedure(const c: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3fVertex3fSUN: procedure(nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3fVertex3fvSUN: procedure(const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4fNormal3fVertex3fSUN: procedure(r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4fNormal3fVertex3fvSUN: procedure(const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fVertex3fSUN: procedure(s: GLfloat; t: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fVertex3fvSUN: procedure(const tc: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4fVertex4fSUN: procedure(s: GLfloat; t: GLfloat; p: GLfloat; q: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4fVertex4fvSUN: procedure(const tc: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fColor4ubVertex3fSUN: procedure(s: GLfloat; t: GLfloat; r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fColor4ubVertex3fvSUN: procedure(const tc: PGLfloat; const c: PGLubyte; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fColor3fVertex3fSUN: procedure(s: GLfloat; t: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fColor3fVertex3fvSUN: procedure(const tc: PGLfloat; const c: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fNormal3fVertex3fSUN: procedure(s: GLfloat; t: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fNormal3fVertex3fvSUN: procedure(const tc: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fColor4fNormal3fVertex3fSUN: procedure(s: GLfloat; t: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fColor4fNormal3fVertex3fvSUN: procedure(const tc: PGLfloat; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4fColor4fNormal3fVertex4fSUN: procedure(s: GLfloat; t: GLfloat; p: GLfloat; q: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4fColor4fNormal3fVertex4fvSUN: procedure(const tc: PGLfloat; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiVertex3fSUN: procedure(rc: GLuint; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiVertex3fvSUN: procedure(const rc: PGLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiColor4ubVertex3fSUN: procedure(rc: GLuint; r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiColor4ubVertex3fvSUN: procedure(const rc: PGLuint; const c: PGLubyte; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiColor3fVertex3fSUN: procedure(rc: GLuint; r: GLfloat; g: GLfloat; b: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiColor3fVertex3fvSUN: procedure(const rc: PGLuint; const c: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiNormal3fVertex3fSUN: procedure(rc: GLuint; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiNormal3fVertex3fvSUN: procedure(const rc: PGLuint; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiColor4fNormal3fVertex3fSUN: procedure(rc: GLuint; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiColor4fNormal3fVertex3fvSUN: procedure(const rc: PGLuint; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiTexCoord2fVertex3fSUN: procedure(rc: GLuint; s: GLfloat; t: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiTexCoord2fVertex3fvSUN: procedure(const rc: PGLuint; const tc: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN: procedure(rc: GLuint; s: GLfloat; t: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN: procedure(const rc: PGLuint; const tc: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN: procedure(rc: GLuint; s: GLfloat; t: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN: procedure(const rc: PGLuint; const tc: PGLfloat; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_SUN_vertex: Boolean; + +//***** GL_ARB_fragment_program *****// +const + GL_FRAGMENT_PROGRAM_ARB = $8804; + // GL_PROGRAM_FORMAT_ASCII_ARB { already defined } + // GL_PROGRAM_LENGTH_ARB { already defined } + // GL_PROGRAM_FORMAT_ARB { already defined } + // GL_PROGRAM_BINDING_ARB { already defined } + // GL_PROGRAM_INSTRUCTIONS_ARB { already defined } + // GL_MAX_PROGRAM_INSTRUCTIONS_ARB { already defined } + // GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB { already defined } + // GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB { already defined } + // GL_PROGRAM_TEMPORARIES_ARB { already defined } + // GL_MAX_PROGRAM_TEMPORARIES_ARB { already defined } + // GL_PROGRAM_NATIVE_TEMPORARIES_ARB { already defined } + // GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB { already defined } + // GL_PROGRAM_PARAMETERS_ARB { already defined } + // GL_MAX_PROGRAM_PARAMETERS_ARB { already defined } + // GL_PROGRAM_NATIVE_PARAMETERS_ARB { already defined } + // GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB { already defined } + // GL_PROGRAM_ATTRIBS_ARB { already defined } + // GL_MAX_PROGRAM_ATTRIBS_ARB { already defined } + // GL_PROGRAM_NATIVE_ATTRIBS_ARB { already defined } + // GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB { already defined } + // GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB { already defined } + // GL_MAX_PROGRAM_ENV_PARAMETERS_ARB { already defined } + // GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB { already defined } + GL_PROGRAM_ALU_INSTRUCTIONS_ARB = $8805; + GL_PROGRAM_TEX_INSTRUCTIONS_ARB = $8806; + GL_PROGRAM_TEX_INDIRECTIONS_ARB = $8807; + GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB = $8808; + GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB = $8809; + GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB = $880A; + GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB = $880B; + GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB = $880C; + GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB = $880D; + GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB = $880E; + GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB = $880F; + GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB = $8810; + // GL_PROGRAM_STRING_ARB { already defined } + // GL_PROGRAM_ERROR_POSITION_ARB { already defined } + // GL_CURRENT_MATRIX_ARB { already defined } + // GL_TRANSPOSE_CURRENT_MATRIX_ARB { already defined } + // GL_CURRENT_MATRIX_STACK_DEPTH_ARB { already defined } + // GL_MAX_PROGRAM_MATRICES_ARB { already defined } + // GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB { already defined } + GL_MAX_TEXTURE_COORDS_ARB = $8871; + GL_MAX_TEXTURE_IMAGE_UNITS_ARB = $8872; + // GL_PROGRAM_ERROR_STRING_ARB { already defined } + // GL_MATRIX0_ARB { already defined } + // GL_MATRIX1_ARB { already defined } + // GL_MATRIX2_ARB { already defined } + // GL_MATRIX3_ARB { already defined } + // GL_MATRIX4_ARB { already defined } + // GL_MATRIX5_ARB { already defined } + // GL_MATRIX6_ARB { already defined } + // GL_MATRIX7_ARB { already defined } + // GL_MATRIX8_ARB { already defined } + // GL_MATRIX9_ARB { already defined } + // GL_MATRIX10_ARB { already defined } + // GL_MATRIX11_ARB { already defined } + // GL_MATRIX12_ARB { already defined } + // GL_MATRIX13_ARB { already defined } + // GL_MATRIX14_ARB { already defined } + // GL_MATRIX15_ARB { already defined } + // GL_MATRIX16_ARB { already defined } + // GL_MATRIX17_ARB { already defined } + // GL_MATRIX18_ARB { already defined } + // GL_MATRIX19_ARB { already defined } + // GL_MATRIX20_ARB { already defined } + // GL_MATRIX21_ARB { already defined } + // GL_MATRIX22_ARB { already defined } + // GL_MATRIX23_ARB { already defined } + // GL_MATRIX24_ARB { already defined } + // GL_MATRIX25_ARB { already defined } + // GL_MATRIX26_ARB { already defined } + // GL_MATRIX27_ARB { already defined } + // GL_MATRIX28_ARB { already defined } + // GL_MATRIX29_ARB { already defined } + // GL_MATRIX30_ARB { already defined } + // GL_MATRIX31_ARB { already defined } + // glProgramStringARB { already defined } + // glBindProgramARB { already defined } + // glDeleteProgramsARB { already defined } + // glGenProgramsARB { already defined } + // glProgramEnvParameter4dARB { already defined } + // glProgramEnvParameter4dvARB { already defined } + // glProgramEnvParameter4fARB { already defined } + // glProgramEnvParameter4fvARB { already defined } + // glProgramLocalParameter4dARB { already defined } + // glProgramLocalParameter4dvARB { already defined } + // glProgramLocalParameter4fARB { already defined } + // glProgramLocalParameter4fvARB { already defined } + // glGetProgramEnvParameterdvARB { already defined } + // glGetProgramEnvParameterfvARB { already defined } + // glGetProgramLocalParameterdvARB { already defined } + // glGetProgramLocalParameterfvARB { already defined } + // glGetProgramivARB { already defined } + // glGetProgramStringARB { already defined } + // glIsProgramARB { already defined } + +function Load_GL_ARB_fragment_program: Boolean; + +//***** GL_ATI_text_fragment_shader *****// +const + GL_TEXT_FRAGMENT_SHADER_ATI = $8200; + +function Load_GL_ATI_text_fragment_shader: Boolean; + +//***** GL_APPLE_client_storage *****// +const + GL_UNPACK_CLIENT_STORAGE_APPLE = $85B2; + +function Load_GL_APPLE_client_storage: Boolean; + +//***** GL_APPLE_element_array *****// +const + GL_ELEMENT_ARRAY_APPLE = $8768; + GL_ELEMENT_ARRAY_TYPE_APPLE = $8769; + GL_ELEMENT_ARRAY_POINTER_APPLE = $876A; +var + glElementPointerAPPLE: procedure(_type: GLenum; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawElementArrayAPPLE: procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawRangeElementArrayAPPLE: procedure(mode: GLenum; start: GLuint; _end: GLuint; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiDrawElementArrayAPPLE: procedure(mode: GLenum; const first: PGLint; const count: PGLsizei; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiDrawRangeElementArrayAPPLE: procedure(mode: GLenum; start: GLuint; _end: GLuint; const first: PGLint; const count: PGLsizei; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_APPLE_element_array: Boolean; + +//***** GL_APPLE_fence *****// +const + GL_DRAW_PIXELS_APPLE = $8A0A; + GL_FENCE_APPLE = $8A0B; +var + glGenFencesAPPLE: procedure(n: GLsizei; fences: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteFencesAPPLE: procedure(n: GLsizei; const fences: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSetFenceAPPLE: procedure(fence: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsFenceAPPLE: function(fence: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTestFenceAPPLE: function(fence: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFinishFenceAPPLE: procedure(fence: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTestObjectAPPLE: function(_object: GLenum; name: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFinishObjectAPPLE: procedure(_object: GLenum; name: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_APPLE_fence: Boolean; + +//***** GL_APPLE_vertex_array_object *****// +const + GL_VERTEX_ARRAY_BINDING_APPLE = $85B5; +var + glBindVertexArrayAPPLE: procedure(_array: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteVertexArraysAPPLE: procedure(n: GLsizei; const arrays: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenVertexArraysAPPLE: procedure(n: GLsizei; const arrays: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsVertexArrayAPPLE: function(_array: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_APPLE_vertex_array_object: Boolean; + +//***** GL_APPLE_vertex_array_range *****// +const + GL_VERTEX_ARRAY_RANGE_APPLE = $851D; + GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE = $851E; + GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_APPLE = $8520; + GL_VERTEX_ARRAY_RANGE_POINTER_APPLE = $8521; + GL_VERTEX_ARRAY_STORAGE_HINT_APPLE = $851F; + GL_STORAGE_CACHED_APPLE = $85BE; + GL_STORAGE_SHARED_APPLE = $85BF; +var + glVertexArrayRangeAPPLE: procedure(length: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFlushVertexArrayRangeAPPLE: procedure(length: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexArrayParameteriAPPLE: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_APPLE_vertex_array_range: Boolean; + +{$IFDEF Win32} +//***** WGL_ARB_pixel_format *****// +const + WGL_NUMBER_PIXEL_FORMATS_ARB = $2000; + WGL_DRAW_TO_WINDOW_ARB = $2001; + WGL_DRAW_TO_BITMAP_ARB = $2002; + WGL_ACCELERATION_ARB = $2003; + WGL_NEED_PALETTE_ARB = $2004; + WGL_NEED_SYSTEM_PALETTE_ARB = $2005; + WGL_SWAP_LAYER_BUFFERS_ARB = $2006; + WGL_SWAP_METHOD_ARB = $2007; + WGL_NUMBER_OVERLAYS_ARB = $2008; + WGL_NUMBER_UNDERLAYS_ARB = $2009; + WGL_TRANSPARENT_ARB = $200A; + WGL_TRANSPARENT_RED_VALUE_ARB = $2037; + WGL_TRANSPARENT_GREEN_VALUE_ARB = $2038; + WGL_TRANSPARENT_BLUE_VALUE_ARB = $2039; + WGL_TRANSPARENT_ALPHA_VALUE_ARB = $203A; + WGL_TRANSPARENT_INDEX_VALUE_ARB = $203B; + WGL_SHARE_DEPTH_ARB = $200C; + WGL_SHARE_STENCIL_ARB = $200D; + WGL_SHARE_ACCUM_ARB = $200E; + WGL_SUPPORT_GDI_ARB = $200F; + WGL_SUPPORT_OPENGL_ARB = $2010; + WGL_DOUBLE_BUFFER_ARB = $2011; + WGL_STEREO_ARB = $2012; + WGL_PIXEL_TYPE_ARB = $2013; + WGL_COLOR_BITS_ARB = $2014; + WGL_RED_BITS_ARB = $2015; + WGL_RED_SHIFT_ARB = $2016; + WGL_GREEN_BITS_ARB = $2017; + WGL_GREEN_SHIFT_ARB = $2018; + WGL_BLUE_BITS_ARB = $2019; + WGL_BLUE_SHIFT_ARB = $201A; + WGL_ALPHA_BITS_ARB = $201B; + WGL_ALPHA_SHIFT_ARB = $201C; + WGL_ACCUM_BITS_ARB = $201D; + WGL_ACCUM_RED_BITS_ARB = $201E; + WGL_ACCUM_GREEN_BITS_ARB = $201F; + WGL_ACCUM_BLUE_BITS_ARB = $2020; + WGL_ACCUM_ALPHA_BITS_ARB = $2021; + WGL_DEPTH_BITS_ARB = $2022; + WGL_STENCIL_BITS_ARB = $2023; + WGL_AUX_BUFFERS_ARB = $2024; + WGL_NO_ACCELERATION_ARB = $2025; + WGL_GENERIC_ACCELERATION_ARB = $2026; + WGL_FULL_ACCELERATION_ARB = $2027; + WGL_SWAP_EXCHANGE_ARB = $2028; + WGL_SWAP_COPY_ARB = $2029; + WGL_SWAP_UNDEFINED_ARB = $202A; + WGL_TYPE_RGBA_ARB = $202B; + WGL_TYPE_COLORINDEX_ARB = $202C; +var + wglGetPixelFormatAttribivARB: function(hdc: HDC; iPixelFormat: GLint; iLayerPlane: GLint; nAttributes: GLuint; const piAttributes: PGLint; piValues: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetPixelFormatAttribfvARB: function(hdc: HDC; iPixelFormat: GLint; iLayerPlane: GLint; nAttributes: GLuint; const piAttributes: PGLint; pfValues: PGLfloat): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglChoosePixelFormatARB: function(hdc: HDC; const piAttribIList: PGLint; const pfAttribFList: PGLfloat; nMaxFormats: GLuint; piFormats: PGLint; nNumFormats: PGLuint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_ARB_pixel_format: Boolean; + +//***** WGL_ARB_make_current_read *****// +const + WGL_ERROR_INVALID_PIXEL_TYPE_ARB = $2043; + WGL_ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB = $2054; +var + wglMakeContextCurrentARB: function(hDrawDC: HDC; hReadDC: HDC; hglrc: HGLRC): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetCurrentReadDCARB: function(): HDC; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_ARB_make_current_read: Boolean; + +//***** WGL_ARB_pbuffer *****// +const + WGL_DRAW_TO_PBUFFER_ARB = $202D; + // WGL_DRAW_TO_PBUFFER_ARB { already defined } + WGL_MAX_PBUFFER_PIXELS_ARB = $202E; + WGL_MAX_PBUFFER_WIDTH_ARB = $202F; + WGL_MAX_PBUFFER_HEIGHT_ARB = $2030; + WGL_PBUFFER_LARGEST_ARB = $2033; + WGL_PBUFFER_WIDTH_ARB = $2034; + WGL_PBUFFER_HEIGHT_ARB = $2035; + WGL_PBUFFER_LOST_ARB = $2036; +var + wglCreatePbufferARB: function(hDC: HDC; iPixelFormat: GLint; iWidth: GLint; iHeight: GLint; const piAttribList: PGLint): THandle; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetPbufferDCARB: function(hPbuffer: THandle): HDC; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglReleasePbufferDCARB: function(hPbuffer: THandle; hDC: HDC): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglDestroyPbufferARB: function(hPbuffer: THandle): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglQueryPbufferARB: function(hPbuffer: THandle; iAttribute: GLint; piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_ARB_pbuffer: Boolean; + +//***** WGL_EXT_swap_control *****// +var + wglSwapIntervalEXT: function(interval: GLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetSwapIntervalEXT: function(): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_EXT_swap_control: Boolean; + +//***** WGL_ARB_render_texture *****// +const + WGL_BIND_TO_TEXTURE_RGB_ARB = $2070; + WGL_BIND_TO_TEXTURE_RGBA_ARB = $2071; + WGL_TEXTURE_FORMAT_ARB = $2072; + WGL_TEXTURE_TARGET_ARB = $2073; + WGL_MIPMAP_TEXTURE_ARB = $2074; + WGL_TEXTURE_RGB_ARB = $2075; + WGL_TEXTURE_RGBA_ARB = $2076; + WGL_NO_TEXTURE_ARB = $2077; + WGL_TEXTURE_CUBE_MAP_ARB = $2078; + WGL_TEXTURE_1D_ARB = $2079; + WGL_TEXTURE_2D_ARB = $207A; + // WGL_NO_TEXTURE_ARB { already defined } + WGL_MIPMAP_LEVEL_ARB = $207B; + WGL_CUBE_MAP_FACE_ARB = $207C; + WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = $207D; + WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = $207E; + WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = $207F; + WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = $2080; + WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = $2081; + WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = $2082; + WGL_FRONT_LEFT_ARB = $2083; + WGL_FRONT_RIGHT_ARB = $2084; + WGL_BACK_LEFT_ARB = $2085; + WGL_BACK_RIGHT_ARB = $2086; + WGL_AUX0_ARB = $2087; + WGL_AUX1_ARB = $2088; + WGL_AUX2_ARB = $2089; + WGL_AUX3_ARB = $208A; + WGL_AUX4_ARB = $208B; + WGL_AUX5_ARB = $208C; + WGL_AUX6_ARB = $208D; + WGL_AUX7_ARB = $208E; + WGL_AUX8_ARB = $208F; + WGL_AUX9_ARB = $2090; +var + wglBindTexImageARB: function(hPbuffer: THandle; iBuffer: GLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglReleaseTexImageARB: function(hPbuffer: THandle; iBuffer: GLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglSetPbufferAttribARB: function(hPbuffer: THandle; const piAttribList: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_ARB_render_texture: Boolean; + +//***** WGL_EXT_extensions_string *****// +var + wglGetExtensionsStringEXT: function(): Pchar; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_EXT_extensions_string: Boolean; + +//***** WGL_EXT_make_current_read *****// +var + wglMakeContextCurrentEXT: function(hDrawDC: HDC; hReadDC: HDC; hglrc: HGLRC): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetCurrentReadDCEXT: function(): HDC; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_EXT_make_current_read: Boolean; + +//***** WGL_EXT_pbuffer *****// +const + WGL_DRAW_TO_PBUFFER_EXT = $202D; + WGL_MAX_PBUFFER_PIXELS_EXT = $202E; + WGL_MAX_PBUFFER_WIDTH_EXT = $202F; + WGL_MAX_PBUFFER_HEIGHT_EXT = $2030; + WGL_OPTIMAL_PBUFFER_WIDTH_EXT = $2031; + WGL_OPTIMAL_PBUFFER_HEIGHT_EXT = $2032; + WGL_PBUFFER_LARGEST_EXT = $2033; + WGL_PBUFFER_WIDTH_EXT = $2034; + WGL_PBUFFER_HEIGHT_EXT = $2035; +var + wglCreatePbufferEXT: function(hDC: HDC; iPixelFormat: GLint; iWidth: GLint; iHeight: GLint; const piAttribList: PGLint): THandle; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetPbufferDCEXT: function(hPbuffer: THandle): HDC; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglReleasePbufferDCEXT: function(hPbuffer: THandle; hDC: HDC): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglDestroyPbufferEXT: function(hPbuffer: THandle): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglQueryPbufferEXT: function(hPbuffer: THandle; iAttribute: GLint; piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_EXT_pbuffer: Boolean; + +//***** WGL_EXT_pixel_format *****// +const + WGL_NUMBER_PIXEL_FORMATS_EXT = $2000; + WGL_DRAW_TO_WINDOW_EXT = $2001; + WGL_DRAW_TO_BITMAP_EXT = $2002; + WGL_ACCELERATION_EXT = $2003; + WGL_NEED_PALETTE_EXT = $2004; + WGL_NEED_SYSTEM_PALETTE_EXT = $2005; + WGL_SWAP_LAYER_BUFFERS_EXT = $2006; + WGL_SWAP_METHOD_EXT = $2007; + WGL_NUMBER_OVERLAYS_EXT = $2008; + WGL_NUMBER_UNDERLAYS_EXT = $2009; + WGL_TRANSPARENT_EXT = $200A; + WGL_TRANSPARENT_VALUE_EXT = $200B; + WGL_SHARE_DEPTH_EXT = $200C; + WGL_SHARE_STENCIL_EXT = $200D; + WGL_SHARE_ACCUM_EXT = $200E; + WGL_SUPPORT_GDI_EXT = $200F; + WGL_SUPPORT_OPENGL_EXT = $2010; + WGL_DOUBLE_BUFFER_EXT = $2011; + WGL_STEREO_EXT = $2012; + WGL_PIXEL_TYPE_EXT = $2013; + WGL_COLOR_BITS_EXT = $2014; + WGL_RED_BITS_EXT = $2015; + WGL_RED_SHIFT_EXT = $2016; + WGL_GREEN_BITS_EXT = $2017; + WGL_GREEN_SHIFT_EXT = $2018; + WGL_BLUE_BITS_EXT = $2019; + WGL_BLUE_SHIFT_EXT = $201A; + WGL_ALPHA_BITS_EXT = $201B; + WGL_ALPHA_SHIFT_EXT = $201C; + WGL_ACCUM_BITS_EXT = $201D; + WGL_ACCUM_RED_BITS_EXT = $201E; + WGL_ACCUM_GREEN_BITS_EXT = $201F; + WGL_ACCUM_BLUE_BITS_EXT = $2020; + WGL_ACCUM_ALPHA_BITS_EXT = $2021; + WGL_DEPTH_BITS_EXT = $2022; + WGL_STENCIL_BITS_EXT = $2023; + WGL_AUX_BUFFERS_EXT = $2024; + WGL_NO_ACCELERATION_EXT = $2025; + WGL_GENERIC_ACCELERATION_EXT = $2026; + WGL_FULL_ACCELERATION_EXT = $2027; + WGL_SWAP_EXCHANGE_EXT = $2028; + WGL_SWAP_COPY_EXT = $2029; + WGL_SWAP_UNDEFINED_EXT = $202A; + WGL_TYPE_RGBA_EXT = $202B; + WGL_TYPE_COLORINDEX_EXT = $202C; +var + wglGetPixelFormatAttribivEXT: function(hdc: HDC; iPixelFormat: GLint; iLayerPlane: GLint; nAttributes: GLuint; piAttributes: PGLint; piValues: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetPixelFormatAttribfvEXT: function(hdc: HDC; iPixelFormat: GLint; iLayerPlane: GLint; nAttributes: GLuint; piAttributes: PGLint; pfValues: PGLfloat): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglChoosePixelFormatEXT: function(hdc: HDC; const piAttribIList: PGLint; const pfAttribFList: PGLfloat; nMaxFormats: GLuint; piFormats: PGLint; nNumFormats: PGLuint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_EXT_pixel_format: Boolean; + +//***** WGL_I3D_digital_video_control *****// +const + WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D = $2050; + WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D = $2051; + WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D = $2052; + WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D = $2053; +var + wglGetDigitalVideoParametersI3D: function(hDC: HDC; iAttribute: GLint; piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglSetDigitalVideoParametersI3D: function(hDC: HDC; iAttribute: GLint; const piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_I3D_digital_video_control: Boolean; + +//***** WGL_I3D_gamma *****// +const + WGL_GAMMA_TABLE_SIZE_I3D = $204E; + WGL_GAMMA_EXCLUDE_DESKTOP_I3D = $204F; + // WGL_GAMMA_EXCLUDE_DESKTOP_I3D { already defined } +var + wglGetGammaTableParametersI3D: function(hDC: HDC; iAttribute: GLint; piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglSetGammaTableParametersI3D: function(hDC: HDC; iAttribute: GLint; const piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetGammaTableI3D: function(hDC: HDC; iEntries: GLint; puRed: PGLUSHORT; puGreen: PGLUSHORT; puBlue: PGLUSHORT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglSetGammaTableI3D: function(hDC: HDC; iEntries: GLint; const puRed: PGLUSHORT; const puGreen: PGLUSHORT; const puBlue: PGLUSHORT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_I3D_gamma: Boolean; + +//***** WGL_I3D_genlock *****// +const + WGL_GENLOCK_SOURCE_MULTIVIEW_I3D = $2044; + WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D = $2045; + WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D = $2046; + WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D = $2047; + WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D = $2048; + WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D = $2049; + WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D = $204A; + WGL_GENLOCK_SOURCE_EDGE_RISING_I3D = $204B; + WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D = $204C; +var + wglEnableGenlockI3D: function(hDC: HDC): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglDisableGenlockI3D: function(hDC: HDC): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglIsEnabledGenlockI3D: function(hDC: HDC; pFlag: PBOOL): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGenlockSourceI3D: function(hDC: HDC; uSource: GLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetGenlockSourceI3D: function(hDC: HDC; uSource: PGLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGenlockSourceEdgeI3D: function(hDC: HDC; uEdge: GLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetGenlockSourceEdgeI3D: function(hDC: HDC; uEdge: PGLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGenlockSampleRateI3D: function(hDC: HDC; uRate: GLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetGenlockSampleRateI3D: function(hDC: HDC; uRate: PGLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGenlockSourceDelayI3D: function(hDC: HDC; uDelay: GLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetGenlockSourceDelayI3D: function(hDC: HDC; uDelay: PGLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglQueryGenlockMaxSourceDelayI3D: function(hDC: HDC; uMaxLineDelay: PGLUINT; uMaxPixelDelay: PGLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_WGL_I3D_genlock: Boolean; +{$ENDIF} + +//***** GL_ARB_matrix_palette *****// +const + GL_MATRIX_PALETTE_ARB = $8840; + GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB = $8841; + GL_MAX_PALETTE_MATRICES_ARB = $8842; + GL_CURRENT_PALETTE_MATRIX_ARB = $8843; + GL_MATRIX_INDEX_ARRAY_ARB = $8844; + GL_CURRENT_MATRIX_INDEX_ARB = $8845; + GL_MATRIX_INDEX_ARRAY_SIZE_ARB = $8846; + GL_MATRIX_INDEX_ARRAY_TYPE_ARB = $8847; + GL_MATRIX_INDEX_ARRAY_STRIDE_ARB = $8848; + GL_MATRIX_INDEX_ARRAY_POINTER_ARB = $8849; +var + glCurrentPaletteMatrixARB: procedure(index: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMatrixIndexubvARB: procedure(size: GLint; indices: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMatrixIndexusvARB: procedure(size: GLint; indices: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMatrixIndexuivARB: procedure(size: GLint; indices: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMatrixIndexPointerARB: procedure(size: GLint; _type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_matrix_palette: Boolean; + +//***** GL_NV_element_array *****// +const + GL_ELEMENT_ARRAY_TYPE_NV = $8769; + GL_ELEMENT_ARRAY_POINTER_NV = $876A; +var + glElementPointerNV: procedure(_type: GLenum; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawElementArrayNV: procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawRangeElementArrayNV: procedure(mode: GLenum; start: GLuint; _end: GLuint; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiDrawElementArrayNV: procedure(mode: GLenum; const first: PGLint; const count: PGLsizei; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiDrawRangeElementArrayNV: procedure(mode: GLenum; start: GLuint; _end: GLuint; const first: PGLint; const count: PGLsizei; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_NV_element_array: Boolean; + +//***** GL_NV_float_buffer *****// +const + GL_FLOAT_R_NV = $8880; + GL_FLOAT_RG_NV = $8881; + GL_FLOAT_RGB_NV = $8882; + GL_FLOAT_RGBA_NV = $8883; + GL_FLOAT_R16_NV = $8884; + GL_FLOAT_R32_NV = $8885; + GL_FLOAT_RG16_NV = $8886; + GL_FLOAT_RG32_NV = $8887; + GL_FLOAT_RGB16_NV = $8888; + GL_FLOAT_RGB32_NV = $8889; + GL_FLOAT_RGBA16_NV = $888A; + GL_FLOAT_RGBA32_NV = $888B; + GL_TEXTURE_FLOAT_COMPONENTS_NV = $888C; + GL_FLOAT_CLEAR_COLOR_VALUE_NV = $888D; + GL_FLOAT_RGBA_MODE_NV = $888E; +{$IFDEF Win32} + WGL_FLOAT_COMPONENTS_NV = $20B0; + WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV = $20B1; + WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV = $20B2; + WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV = $20B3; + WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV = $20B4; + WGL_TEXTURE_FLOAT_R_NV = $20B5; + WGL_TEXTURE_FLOAT_RG_NV = $20B6; + WGL_TEXTURE_FLOAT_RGB_NV = $20B7; + WGL_TEXTURE_FLOAT_RGBA_NV = $20B8; +{$ENDIF} + +function Load_GL_NV_float_buffer: Boolean; + +//***** GL_NV_fragment_program *****// +const + GL_FRAGMENT_PROGRAM_NV = $8870; + GL_MAX_TEXTURE_COORDS_NV = $8871; + GL_MAX_TEXTURE_IMAGE_UNITS_NV = $8872; + GL_FRAGMENT_PROGRAM_BINDING_NV = $8873; + GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV = $8868; + GL_PROGRAM_ERROR_STRING_NV = $8874; +var + glProgramNamedParameter4fNV: procedure(id: GLuint; len: GLsizei; const name: PGLubyte; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramNamedParameter4dNV: procedure(id: GLuint; len: GLsizei; const name: PGLubyte; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramNamedParameterfvNV: procedure(id: GLuint; len: GLsizei; const name: PGLubyte; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramNamedParameterdvNV: procedure(id: GLuint; len: GLsizei; const name: PGLubyte; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + // glProgramLocalParameter4dARB { already defined } + // glProgramLocalParameter4dvARB { already defined } + // glProgramLocalParameter4fARB { already defined } + // glProgramLocalParameter4fvARB { already defined } + // glGetProgramLocalParameterdvARB { already defined } + // glGetProgramLocalParameterfvARB { already defined } + +function Load_GL_NV_fragment_program: Boolean; + +//***** GL_NV_primitive_restart *****// +const + GL_PRIMITIVE_RESTART_NV = $8558; + GL_PRIMITIVE_RESTART_INDEX_NV = $8559; +var + glPrimitiveRestartNV: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPrimitiveRestartIndexNV: procedure(index: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_NV_primitive_restart: Boolean; + +//***** GL_NV_vertex_program2 *****// + +function Load_GL_NV_vertex_program2: Boolean; + +//***** WGL_NV_render_texture_rectangle *****// +const + WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV = $20A0; + WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV = $20A1; + WGL_TEXTURE_RECTANGLE_NV = $20A2; + +function Load_WGL_NV_render_texture_rectangle: Boolean; + +//***** GL_NV_pixel_data_range *****// +const + GL_WRITE_PIXEL_DATA_RANGE_NV = $8878; + GL_READ_PIXEL_DATA_RANGE_NV = $8879; + GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV = $887A; + GL_READ_PIXEL_DATA_RANGE_LENGTH_NV = $887B; + GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV = $887C; + GL_READ_PIXEL_DATA_RANGE_POINTER_NV = $887D; +var + glPixelDataRangeNV: procedure(target: GLenum; length: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFlushPixelDataRangeNV: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + // wglAllocateMemoryNV { already defined } + // wglFreeMemoryNV { already defined } + +function Load_GL_NV_pixel_data_range: Boolean; + +//***** GL_EXT_texture_rectangle *****// +const + GL_TEXTURE_RECTANGLE_EXT = $84F5; + GL_TEXTURE_BINDING_RECTANGLE_EXT = $84F6; + GL_PROXY_TEXTURE_RECTANGLE_EXT = $84F7; + GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT = $84F8; + +function Load_GL_EXT_texture_rectangle: Boolean; + +//***** GL_S3_s3tc *****// +const + GL_RGB_S3TC = $83A0; + GL_RGB4_S3TC = $83A1; + GL_RGBA_S3TC = $83A2; + GL_RGBA4_S3TC = $83A3; + +function Load_GL_S3_s3tc: Boolean; + +//***** GL_ATI_draw_buffers *****// +const + GL_MAX_DRAW_BUFFERS_ATI = $8824; + GL_DRAW_BUFFER0_ATI = $8825; + GL_DRAW_BUFFER1_ATI = $8826; + GL_DRAW_BUFFER2_ATI = $8827; + GL_DRAW_BUFFER3_ATI = $8828; + GL_DRAW_BUFFER4_ATI = $8829; + GL_DRAW_BUFFER5_ATI = $882A; + GL_DRAW_BUFFER6_ATI = $882B; + GL_DRAW_BUFFER7_ATI = $882C; + GL_DRAW_BUFFER8_ATI = $882D; + GL_DRAW_BUFFER9_ATI = $882E; + GL_DRAW_BUFFER10_ATI = $882F; + GL_DRAW_BUFFER11_ATI = $8830; + GL_DRAW_BUFFER12_ATI = $8831; + GL_DRAW_BUFFER13_ATI = $8832; + GL_DRAW_BUFFER14_ATI = $8833; + GL_DRAW_BUFFER15_ATI = $8834; +var + glDrawBuffersATI: procedure(n: GLsizei; const bufs: PGLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ATI_draw_buffers: Boolean; + +//***** WGL_ATI_pixel_format_float *****// +const + WGL_RGBA_FLOAT_MODE_ATI = $8820; + WGL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI = $8835; + WGL_TYPE_RGBA_FLOAT_ATI = $21A0; + +function Load_WGL_ATI_pixel_format_float: Boolean; + +//***** GL_ATI_texture_env_combine3 *****// +const + GL_MODULATE_ADD_ATI = $8744; + GL_MODULATE_SIGNED_ADD_ATI = $8745; + GL_MODULATE_SUBTRACT_ATI = $8746; + +function Load_GL_ATI_texture_env_combine3: Boolean; + +//***** GL_ATI_texture_float *****// +const + GL_RGBA_FLOAT32_ATI = $8814; + GL_RGB_FLOAT32_ATI = $8815; + GL_ALPHA_FLOAT32_ATI = $8816; + GL_INTENSITY_FLOAT32_ATI = $8817; + GL_LUMINANCE_FLOAT32_ATI = $8818; + GL_LUMINANCE_ALPHA_FLOAT32_ATI = $8819; + GL_RGBA_FLOAT16_ATI = $881A; + GL_RGB_FLOAT16_ATI = $881B; + GL_ALPHA_FLOAT16_ATI = $881C; + GL_INTENSITY_FLOAT16_ATI = $881D; + GL_LUMINANCE_FLOAT16_ATI = $881E; + GL_LUMINANCE_ALPHA_FLOAT16_ATI = $881F; + +function Load_GL_ATI_texture_float: Boolean; + +//***** GL_NV_texture_expand_normal *****// +const + GL_TEXTURE_UNSIGNED_REMAP_MODE_NV = $888F; + +function Load_GL_NV_texture_expand_normal: Boolean; + +//***** GL_NV_half_float *****// +const + GL_HALF_FLOAT_NV = $140B; +var + glVertex2hNV: procedure(x: GLushort; y: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3hNV: procedure(x: GLushort; y: GLushort; z: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4hNV: procedure(x: GLushort; y: GLushort; z: GLushort; w: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3hNV: procedure(nx: GLushort; ny: GLushort; nz: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3hNV: procedure(red: GLushort; green: GLushort; blue: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4hNV: procedure(red: GLushort; green: GLushort; blue: GLushort; alpha: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1hNV: procedure(s: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2hNV: procedure(s: GLushort; t: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3hNV: procedure(s: GLushort; t: GLushort; r: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4hNV: procedure(s: GLushort; t: GLushort; r: GLushort; q: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1hNV: procedure(target: GLenum; s: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1hvNV: procedure(target: GLenum; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2hNV: procedure(target: GLenum; s: GLushort; t: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2hvNV: procedure(target: GLenum; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3hNV: procedure(target: GLenum; s: GLushort; t: GLushort; r: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3hvNV: procedure(target: GLenum; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4hNV: procedure(target: GLenum; s: GLushort; t: GLushort; r: GLushort; q: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4hvNV: procedure(target: GLenum; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoordhNV: procedure(fog: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoordhvNV: procedure(const fog: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3hNV: procedure(red: GLushort; green: GLushort; blue: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexWeighthNV: procedure(weight: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexWeighthvNV: procedure(const weight: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1hNV: procedure(index: GLuint; x: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1hvNV: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2hNV: procedure(index: GLuint; x: GLushort; y: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2hvNV: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3hNV: procedure(index: GLuint; x: GLushort; y: GLushort; z: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3hvNV: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4hNV: procedure(index: GLuint; x: GLushort; y: GLushort; z: GLushort; w: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4hvNV: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs1hvNV: procedure(index: GLuint; n: GLsizei; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs2hvNV: procedure(index: GLuint; n: GLsizei; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs3hvNV: procedure(index: GLuint; n: GLsizei; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs4hvNV: procedure(index: GLuint; n: GLsizei; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_NV_half_float: Boolean; + +//***** GL_ATI_map_object_buffer *****// +var + glMapObjectBufferATI: function(buffer: GLuint): PGLvoid; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUnmapObjectBufferATI: procedure(buffer: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ATI_map_object_buffer: Boolean; + +//***** GL_ATI_separate_stencil *****// +const + GL_KEEP = $1E00; + GL_ZERO = $0000; + GL_REPLACE = $1E01; + GL_INCR = $1E02; + GL_DECR = $1E03; + GL_INVERT = $150A; + GL_NEVER = $0200; + GL_LESS = $0201; + GL_LEQUAL = $0203; + GL_GREATER = $0204; + GL_GEQUAL = $0206; + GL_EQUAL = $0202; + GL_NOTEQUAL = $0205; + GL_ALWAYS = $0207; + GL_FRONT = $0404; + GL_BACK = $0405; + GL_FRONT_AND_BACK = $0408; + GL_STENCIL_BACK_FUNC_ATI = $8800; + GL_STENCIL_BACK_FAIL_ATI = $8801; + GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI = $8802; + GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI = $8803; +var + glStencilOpSeparateATI: procedure(face: GLenum; sfail: GLenum; dpfail: GLenum; dppass: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glStencilFuncSeparateATI: procedure(frontfunc: GLenum; backfunc: GLenum; ref: GLint; mask: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ATI_separate_stencil: Boolean; + +//***** GL_ATI_vertex_attrib_array_object *****// +var + glVertexAttribArrayObjectATI: procedure(index: GLuint; size: GLint; _type: GLenum; normalized: GLboolean; stride: GLsizei; buffer: GLuint; offset: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribArrayObjectfvATI: procedure(index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribArrayObjectivATI: procedure(index: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ATI_vertex_attrib_array_object: Boolean; + +//***** GL_ARB_vertex_buffer_object *****// +const + GL_ARRAY_BUFFER_ARB = $8892; + GL_ELEMENT_ARRAY_BUFFER_ARB = $8893; + GL_ARRAY_BUFFER_BINDING_ARB = $8894; + GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB = $8895; + GL_VERTEX_ARRAY_BUFFER_BINDING_ARB = $8896; + GL_NORMAL_ARRAY_BUFFER_BINDING_ARB = $8897; + GL_COLOR_ARRAY_BUFFER_BINDING_ARB = $8898; + GL_INDEX_ARRAY_BUFFER_BINDING_ARB = $8899; + GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB = $889A; + GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB = $889B; + GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB = $889C; + GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB = $889D; + GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB = $889E; + GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB = $889F; + GL_STREAM_DRAW_ARB = $88E0; + GL_STREAM_READ_ARB = $88E1; + GL_STREAM_COPY_ARB = $88E2; + GL_STATIC_DRAW_ARB = $88E4; + GL_STATIC_READ_ARB = $88E5; + GL_STATIC_COPY_ARB = $88E6; + GL_DYNAMIC_DRAW_ARB = $88E8; + GL_DYNAMIC_READ_ARB = $88E9; + GL_DYNAMIC_COPY_ARB = $88EA; + GL_READ_ONLY_ARB = $88B8; + GL_WRITE_ONLY_ARB = $88B9; + GL_READ_WRITE_ARB = $88BA; + GL_BUFFER_SIZE_ARB = $8764; + GL_BUFFER_USAGE_ARB = $8765; + GL_BUFFER_ACCESS_ARB = $88BB; + GL_BUFFER_MAPPED_ARB = $88BC; + GL_BUFFER_MAP_POINTER_ARB = $88BD; +var + glBindBufferARB: procedure(target: GLenum; buffer: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteBuffersARB: procedure(n: GLsizei; const buffers: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenBuffersARB: procedure(n: GLsizei; buffers: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsBufferARB: function(buffer: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBufferDataARB: procedure(target: GLenum; size: GLsizeiptrARB; const data: PGLvoid; usage: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBufferSubDataARB: procedure(target: GLenum; offset: GLintptrARB; size: GLsizeiptrARB; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetBufferSubDataARB: procedure(target: GLenum; offset: GLintptrARB; size: GLsizeiptrARB; data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapBufferARB: function(target: GLenum; access: GLenum): PGLvoid; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUnmapBufferARB: function(target: GLenum): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetBufferParameterivARB: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetBufferPointervARB: procedure(target: GLenum; pname: GLenum; params: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_vertex_buffer_object: Boolean; + +//***** GL_ARB_occlusion_query *****// +const + GL_SAMPLES_PASSED_ARB = $8914; + GL_QUERY_COUNTER_BITS_ARB = $8864; + GL_CURRENT_QUERY_ARB = $8865; + GL_QUERY_RESULT_ARB = $8866; + GL_QUERY_RESULT_AVAILABLE_ARB = $8867; +var + glGenQueriesARB: procedure(n: GLsizei; ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteQueriesARB: procedure(n: GLsizei; const ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsQueryARB: function(id: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBeginQueryARB: procedure(target: GLenum; id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glEndQueryARB: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetQueryivARB: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetQueryObjectivARB: procedure(id: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetQueryObjectuivARB: procedure(id: GLuint; pname: GLenum; params: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_occlusion_query: Boolean; + +//***** GL_ARB_shader_objects *****// +const + GL_PROGRAM_OBJECT_ARB = $8B40; + GL_OBJECT_TYPE_ARB = $8B4E; + GL_OBJECT_SUBTYPE_ARB = $8B4F; + GL_OBJECT_DELETE_STATUS_ARB = $8B80; + GL_OBJECT_COMPILE_STATUS_ARB = $8B81; + GL_OBJECT_LINK_STATUS_ARB = $8B82; + GL_OBJECT_VALIDATE_STATUS_ARB = $8B83; + GL_OBJECT_INFO_LOG_LENGTH_ARB = $8B84; + GL_OBJECT_ATTACHED_OBJECTS_ARB = $8B85; + GL_OBJECT_ACTIVE_UNIFORMS_ARB = $8B86; + GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB = $8B87; + GL_OBJECT_SHADER_SOURCE_LENGTH_ARB = $8B88; + GL_SHADER_OBJECT_ARB = $8B48; + GL_FLOAT = $1406; + GL_FLOAT_VEC2_ARB = $8B50; + GL_FLOAT_VEC3_ARB = $8B51; + GL_FLOAT_VEC4_ARB = $8B52; + GL_INT = $1404; + GL_INT_VEC2_ARB = $8B53; + GL_INT_VEC3_ARB = $8B54; + GL_INT_VEC4_ARB = $8B55; + GL_BOOL_ARB = $8B56; + GL_BOOL_VEC2_ARB = $8B57; + GL_BOOL_VEC3_ARB = $8B58; + GL_BOOL_VEC4_ARB = $8B59; + GL_FLOAT_MAT2_ARB = $8B5A; + GL_FLOAT_MAT3_ARB = $8B5B; + GL_FLOAT_MAT4_ARB = $8B5C; +var + glDeleteObjectARB: procedure(obj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetHandleARB: function(pname: GLenum): GLhandleARB; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDetachObjectARB: procedure(containerObj: GLhandleARB; attachedObj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCreateShaderObjectARB: function(shaderType: GLenum): GLhandleARB; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glShaderSourceARB: procedure(shaderObj: GLhandleARB; count: GLsizei; const _string: PGLvoid; const length: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompileShaderARB: procedure(shaderObj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCreateProgramObjectARB: function(): GLhandleARB; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glAttachObjectARB: procedure(containerObj: GLhandleARB; obj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLinkProgramARB: procedure(programObj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUseProgramObjectARB: procedure(programObj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glValidateProgramARB: procedure(programObj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform1fARB: procedure(location: GLint; v0: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform2fARB: procedure(location: GLint; v0: GLfloat; v1: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform3fARB: procedure(location: GLint; v0: GLfloat; v1: GLfloat; v2: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform4fARB: procedure(location: GLint; v0: GLfloat; v1: GLfloat; v2: GLfloat; v3: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform1iARB: procedure(location: GLint; v0: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform2iARB: procedure(location: GLint; v0: GLint; v1: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform3iARB: procedure(location: GLint; v0: GLint; v1: GLint; v2: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform4iARB: procedure(location: GLint; v0: GLint; v1: GLint; v2: GLint; v3: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform1fvARB: procedure(location: GLint; count: GLsizei; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform2fvARB: procedure(location: GLint; count: GLsizei; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform3fvARB: procedure(location: GLint; count: GLsizei; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform4fvARB: procedure(location: GLint; count: GLsizei; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform1ivARB: procedure(location: GLint; count: GLsizei; value: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform2ivARB: procedure(location: GLint; count: GLsizei; value: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform3ivARB: procedure(location: GLint; count: GLsizei; value: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform4ivARB: procedure(location: GLint; count: GLsizei; value: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniformMatrix2fvARB: procedure(location: GLint; count: GLsizei; transpose: GLboolean; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniformMatrix3fvARB: procedure(location: GLint; count: GLsizei; transpose: GLboolean; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniformMatrix4fvARB: procedure(location: GLint; count: GLsizei; transpose: GLboolean; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetObjectParameterfvARB: procedure(obj: GLhandleARB; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetObjectParameterivARB: procedure(obj: GLhandleARB; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetInfoLogARB: procedure(obj: GLhandleARB; maxLength: GLsizei; length: PGLsizei; infoLog: PGLcharARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetAttachedObjectsARB: procedure(containerObj: GLhandleARB; maxCount: GLsizei; count: PGLsizei; obj: PGLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetUniformLocationARB: function(programObj: GLhandleARB; const name: PGLcharARB): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetActiveUniformARB: procedure(programObj: GLhandleARB; index: GLuint; maxLength: GLsizei; length: PGLsizei; size: PGLint; _type: PGLenum; name: PGLcharARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetUniformfvARB: procedure(programObj: GLhandleARB; location: GLint; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetUniformivARB: procedure(programObj: GLhandleARB; location: GLint; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetShaderSourceARB: procedure(obj: GLhandleARB; maxLength: GLsizei; length: PGLsizei; source: PGLcharARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_shader_objects: Boolean; + +//***** GL_ARB_vertex_shader *****// +const + GL_VERTEX_SHADER_ARB = $8B31; + GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB = $8B4A; + GL_MAX_VARYING_FLOATS_ARB = $8B4B; + // GL_MAX_VERTEX_ATTRIBS_ARB { already defined } + // GL_MAX_TEXTURE_IMAGE_UNITS_ARB { already defined } + GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB = $8B4C; + GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB = $8B4D; + // GL_MAX_TEXTURE_COORDS_ARB { already defined } + // GL_VERTEX_PROGRAM_POINT_SIZE_ARB { already defined } + // GL_VERTEX_PROGRAM_TWO_SIDE_ARB { already defined } + // GL_OBJECT_TYPE_ARB { already defined } + // GL_OBJECT_SUBTYPE_ARB { already defined } + GL_OBJECT_ACTIVE_ATTRIBUTES_ARB = $8B89; + GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB = $8B8A; + // GL_SHADER_OBJECT_ARB { already defined } + // GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB { already defined } + // GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB { already defined } + // GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB { already defined } + // GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB { already defined } + // GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB { already defined } + // GL_CURRENT_VERTEX_ATTRIB_ARB { already defined } + // GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB { already defined } + // GL_FLOAT { already defined } + // GL_FLOAT_VEC2_ARB { already defined } + // GL_FLOAT_VEC3_ARB { already defined } + // GL_FLOAT_VEC4_ARB { already defined } + // GL_FLOAT_MAT2_ARB { already defined } + // GL_FLOAT_MAT3_ARB { already defined } + // GL_FLOAT_MAT4_ARB { already defined } + // glVertexAttrib1fARB { already defined } + // glVertexAttrib1sARB { already defined } + // glVertexAttrib1dARB { already defined } + // glVertexAttrib2fARB { already defined } + // glVertexAttrib2sARB { already defined } + // glVertexAttrib2dARB { already defined } + // glVertexAttrib3fARB { already defined } + // glVertexAttrib3sARB { already defined } + // glVertexAttrib3dARB { already defined } + // glVertexAttrib4fARB { already defined } + // glVertexAttrib4sARB { already defined } + // glVertexAttrib4dARB { already defined } + // glVertexAttrib4NubARB { already defined } + // glVertexAttrib1fvARB { already defined } + // glVertexAttrib1svARB { already defined } + // glVertexAttrib1dvARB { already defined } + // glVertexAttrib2fvARB { already defined } + // glVertexAttrib2svARB { already defined } + // glVertexAttrib2dvARB { already defined } + // glVertexAttrib3fvARB { already defined } + // glVertexAttrib3svARB { already defined } + // glVertexAttrib3dvARB { already defined } + // glVertexAttrib4fvARB { already defined } + // glVertexAttrib4svARB { already defined } + // glVertexAttrib4dvARB { already defined } + // glVertexAttrib4ivARB { already defined } + // glVertexAttrib4bvARB { already defined } + // glVertexAttrib4ubvARB { already defined } + // glVertexAttrib4usvARB { already defined } + // glVertexAttrib4uivARB { already defined } + // glVertexAttrib4NbvARB { already defined } + // glVertexAttrib4NsvARB { already defined } + // glVertexAttrib4NivARB { already defined } + // glVertexAttrib4NubvARB { already defined } + // glVertexAttrib4NusvARB { already defined } + // glVertexAttrib4NuivARB { already defined } + // glVertexAttribPointerARB { already defined } + // glEnableVertexAttribArrayARB { already defined } + // glDisableVertexAttribArrayARB { already defined } +var + glBindAttribLocationARB: procedure(programObj: GLhandleARB; index: GLuint; const name: PGLcharARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetActiveAttribARB: procedure(programObj: GLhandleARB; index: GLuint; maxLength: GLsizei; length: PGLsizei; size: PGLint; _type: PGLenum; name: PGLcharARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetAttribLocationARB: function(programObj: GLhandleARB; const name: PGLcharARB): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + // glGetVertexAttribdvARB { already defined } + // glGetVertexAttribfvARB { already defined } + // glGetVertexAttribivARB { already defined } + // glGetVertexAttribPointervARB { already defined } + +function Load_GL_ARB_vertex_shader: Boolean; + +//***** GL_ARB_fragment_shader *****// +const + GL_FRAGMENT_SHADER_ARB = $8B30; + GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB = $8B49; + // GL_MAX_TEXTURE_COORDS_ARB { already defined } + // GL_MAX_TEXTURE_IMAGE_UNITS_ARB { already defined } + // GL_OBJECT_TYPE_ARB { already defined } + // GL_OBJECT_SUBTYPE_ARB { already defined } + // GL_SHADER_OBJECT_ARB { already defined } + +function Load_GL_ARB_fragment_shader: Boolean; + +//***** GL_ARB_shading_language_100 *****// + +function Load_GL_ARB_shading_language_100: Boolean; + +//***** GL_ARB_texture_non_power_of_two *****// + +function Load_GL_ARB_texture_non_power_of_two: Boolean; + +//***** GL_ARB_point_sprite *****// +const + GL_POINT_SPRITE_ARB = $8861; + GL_COORD_REPLACE_ARB = $8862; + +function Load_GL_ARB_point_sprite: Boolean; + +//***** GL_EXT_depth_bounds_test *****// +const + GL_DEPTH_BOUNDS_TEST_EXT = $8890; + GL_DEPTH_BOUNDS_EXT = $8891; +var + glDepthBoundsEXT: procedure(zmin: GLclampd; zmax: GLclampd); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_depth_bounds_test: Boolean; + +//***** GL_EXT_secondary_color *****// +const + GL_COLOR_SUM_EXT = $8458; + GL_CURRENT_SECONDARY_COLOR_EXT = $8459; + GL_SECONDARY_COLOR_ARRAY_SIZE_EXT = $845A; + GL_SECONDARY_COLOR_ARRAY_TYPE_EXT = $845B; + GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT = $845C; + GL_SECONDARY_COLOR_ARRAY_POINTER_EXT = $845D; + GL_SECONDARY_COLOR_ARRAY_EXT = $845E; +var + glSecondaryColor3bEXT: procedure(r: GLbyte; g: GLbyte; b: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3sEXT: procedure(r: GLshort; g: GLshort; b: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3iEXT: procedure(r: GLint; g: GLint; b: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3fEXT: procedure(r: GLfloat; g: GLfloat; b: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3dEXT: procedure(r: GLdouble; g: GLdouble; b: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3ubEXT: procedure(r: GLubyte; g: GLubyte; b: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3usEXT: procedure(r: GLushort; g: GLushort; b: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3uiEXT: procedure(r: GLuint; g: GLuint; b: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3bvEXT: procedure(components: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3svEXT: procedure(components: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3ivEXT: procedure(components: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3fvEXT: procedure(components: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3dvEXT: procedure(components: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3ubvEXT: procedure(components: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3usvEXT: procedure(components: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3uivEXT: procedure(components: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColorPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_secondary_color: Boolean; + +//***** GL_EXT_texture_mirror_clamp *****// +const + GL_MIRROR_CLAMP_EXT = $8742; + GL_MIRROR_CLAMP_TO_EDGE_EXT = $8743; + GL_MIRROR_CLAMP_TO_BORDER_EXT = $8912; + +function Load_GL_EXT_texture_mirror_clamp: Boolean; + +//***** GL_EXT_blend_equation_separate *****// +const + GL_BLEND_EQUATION_RGB_EXT = $8009; + GL_BLEND_EQUATION_ALPHA_EXT = $883D; +var + glBlendEquationSeparateEXT: procedure(modeRGB: GLenum; modeAlpha: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_blend_equation_separate: Boolean; + +//***** GL_MESA_pack_invert *****// +const + GL_PACK_INVERT_MESA = $8758; + +function Load_GL_MESA_pack_invert: Boolean; + +//***** GL_MESA_ycbcr_texture *****// +const + GL_YCBCR_MESA = $8757; + GL_UNSIGNED_SHORT_8_8_MESA = $85BA; + GL_UNSIGNED_SHORT_8_8_REV_MESA = $85BB; + +function Load_GL_MESA_ycbcr_texture: Boolean; + +//***** GL_ARB_fragment_program_shadow *****// + +function Load_GL_ARB_fragment_program_shadow: Boolean; + +//***** GL_EXT_fog_coord *****// +const + GL_FOG_COORDINATE_SOURCE_EXT = $8450; + GL_FOG_COORDINATE_EXT = $8451; + GL_FRAGMENT_DEPTH_EXT = $8452; + GL_CURRENT_FOG_COORDINATE_EXT = $8453; + GL_FOG_COORDINATE_ARRAY_TYPE_EXT = $8454; + GL_FOG_COORDINATE_ARRAY_STRIDE_EXT = $8455; + GL_FOG_COORDINATE_ARRAY_POINTER_EXT = $8456; + GL_FOG_COORDINATE_ARRAY_EXT = $8457; +var + glFogCoordfEXT: procedure(coord: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoorddEXT: procedure(coord: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoordfvEXT: procedure(coord: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoorddvEXT: procedure(coord: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoordPointerEXT: procedure(_type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_fog_coord: Boolean; + +//***** GL_NV_fragment_program_option *****// + +function Load_GL_NV_fragment_program_option: Boolean; + +//***** GL_EXT_pixel_buffer_object *****// +const + GL_PIXEL_PACK_BUFFER_EXT = $88EB; + GL_PIXEL_UNPACK_BUFFER_EXT = $88EC; + GL_PIXEL_PACK_BUFFER_BINDING_EXT = $88ED; + GL_PIXEL_UNPACK_BUFFER_BINDING_EXT = $88EF; + +function Load_GL_EXT_pixel_buffer_object: Boolean; + +//***** GL_NV_fragment_program2 *****// +const + GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV = $88F4; + GL_MAX_PROGRAM_CALL_DEPTH_NV = $88F5; + GL_MAX_PROGRAM_IF_DEPTH_NV = $88F6; + GL_MAX_PROGRAM_LOOP_DEPTH_NV = $88F7; + GL_MAX_PROGRAM_LOOP_COUNT_NV = $88F8; + +function Load_GL_NV_fragment_program2: Boolean; + +//***** GL_NV_vertex_program2_option *****// + // GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV { already defined } + // GL_MAX_PROGRAM_CALL_DEPTH_NV { already defined } + +function Load_GL_NV_vertex_program2_option: Boolean; + +//***** GL_NV_vertex_program3 *****// + // GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB { already defined } + +function Load_GL_NV_vertex_program3: Boolean; + +implementation + +uses + sdl; + +function glext_ExtensionSupported(const extension: PChar; const searchIn: PChar): Boolean; +var + extensions: PChar; + start: PChar; + where, terminator: PChar; +begin + + if (Pos(' ', extension) <> 0) or (extension = '') then + begin + Result := FALSE; + Exit; + end; + + if searchIn = '' then + extensions := glGetString(GL_EXTENSIONS) + else + //StrLCopy( extensions, searchIn, StrLen(searchIn)+1 ); + extensions := searchIn; + start := extensions; + while TRUE do + begin + where := StrPos(start, extension ); + if where = nil then Break; + terminator := Pointer(Integer(where) + Integer( strlen( extension ) ) ); + if (where = start) or (PChar(Integer(where) - 1)^ = ' ') then + begin + if (terminator^ = ' ') or (terminator^ = #0) then + begin + Result := TRUE; + Exit; + end; + end; + start := terminator; + end; + Result := FALSE; + +end; + +function Load_GL_version_1_2: Boolean; +{var + extstring : PChar;} +begin + + Result := FALSE; + //extstring := glGetString( GL_EXTENSIONS ); + + @glCopyTexSubImage3D := SDL_GL_GetProcAddress('glCopyTexSubImage3D'); + if not Assigned(glCopyTexSubImage3D) then Exit; + @glDrawRangeElements := SDL_GL_GetProcAddress('glDrawRangeElements'); + if not Assigned(glDrawRangeElements) then Exit; + @glTexImage3D := SDL_GL_GetProcAddress('glTexImage3D'); + if not Assigned(glTexImage3D) then Exit; + @glTexSubImage3D := SDL_GL_GetProcAddress('glTexSubImage3D'); + if not Assigned(glTexSubImage3D) then Exit; + + Result := TRUE; + +end; + +function Load_GL_ARB_imaging: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_imaging', extstring) then + begin + @glColorTable := SDL_GL_GetProcAddress('glColorTable'); + if not Assigned(glColorTable) then Exit; + @glColorTableParameterfv := SDL_GL_GetProcAddress('glColorTableParameterfv'); + if not Assigned(glColorTableParameterfv) then Exit; + @glColorTableParameteriv := SDL_GL_GetProcAddress('glColorTableParameteriv'); + if not Assigned(glColorTableParameteriv) then Exit; + @glCopyColorTable := SDL_GL_GetProcAddress('glCopyColorTable'); + if not Assigned(glCopyColorTable) then Exit; + @glGetColorTable := SDL_GL_GetProcAddress('glGetColorTable'); + if not Assigned(glGetColorTable) then Exit; + @glGetColorTableParameterfv := SDL_GL_GetProcAddress('glGetColorTableParameterfv'); + if not Assigned(glGetColorTableParameterfv) then Exit; + @glGetColorTableParameteriv := SDL_GL_GetProcAddress('glGetColorTableParameteriv'); + if not Assigned(glGetColorTableParameteriv) then Exit; + @glColorSubTable := SDL_GL_GetProcAddress('glColorSubTable'); + if not Assigned(glColorSubTable) then Exit; + @glCopyColorSubTable := SDL_GL_GetProcAddress('glCopyColorSubTable'); + if not Assigned(glCopyColorSubTable) then Exit; + @glConvolutionFilter1D := SDL_GL_GetProcAddress('glConvolutionFilter1D'); + if not Assigned(glConvolutionFilter1D) then Exit; + @glConvolutionFilter2D := SDL_GL_GetProcAddress('glConvolutionFilter2D'); + if not Assigned(glConvolutionFilter2D) then Exit; + @glConvolutionParameterf := SDL_GL_GetProcAddress('glConvolutionParameterf'); + if not Assigned(glConvolutionParameterf) then Exit; + @glConvolutionParameterfv := SDL_GL_GetProcAddress('glConvolutionParameterfv'); + if not Assigned(glConvolutionParameterfv) then Exit; + @glConvolutionParameteri := SDL_GL_GetProcAddress('glConvolutionParameteri'); + if not Assigned(glConvolutionParameteri) then Exit; + @glConvolutionParameteriv := SDL_GL_GetProcAddress('glConvolutionParameteriv'); + if not Assigned(glConvolutionParameteriv) then Exit; + @glCopyConvolutionFilter1D := SDL_GL_GetProcAddress('glCopyConvolutionFilter1D'); + if not Assigned(glCopyConvolutionFilter1D) then Exit; + @glCopyConvolutionFilter2D := SDL_GL_GetProcAddress('glCopyConvolutionFilter2D'); + if not Assigned(glCopyConvolutionFilter2D) then Exit; + @glGetConvolutionFilter := SDL_GL_GetProcAddress('glGetConvolutionFilter'); + if not Assigned(glGetConvolutionFilter) then Exit; + @glGetConvolutionParameterfv := SDL_GL_GetProcAddress('glGetConvolutionParameterfv'); + if not Assigned(glGetConvolutionParameterfv) then Exit; + @glGetConvolutionParameteriv := SDL_GL_GetProcAddress('glGetConvolutionParameteriv'); + if not Assigned(glGetConvolutionParameteriv) then Exit; + @glGetSeparableFilter := SDL_GL_GetProcAddress('glGetSeparableFilter'); + if not Assigned(glGetSeparableFilter) then Exit; + @glSeparableFilter2D := SDL_GL_GetProcAddress('glSeparableFilter2D'); + if not Assigned(glSeparableFilter2D) then Exit; + @glGetHistogram := SDL_GL_GetProcAddress('glGetHistogram'); + if not Assigned(glGetHistogram) then Exit; + @glGetHistogramParameterfv := SDL_GL_GetProcAddress('glGetHistogramParameterfv'); + if not Assigned(glGetHistogramParameterfv) then Exit; + @glGetHistogramParameteriv := SDL_GL_GetProcAddress('glGetHistogramParameteriv'); + if not Assigned(glGetHistogramParameteriv) then Exit; + @glGetMinmax := SDL_GL_GetProcAddress('glGetMinmax'); + if not Assigned(glGetMinmax) then Exit; + @glGetMinmaxParameterfv := SDL_GL_GetProcAddress('glGetMinmaxParameterfv'); + if not Assigned(glGetMinmaxParameterfv) then Exit; + @glGetMinmaxParameteriv := SDL_GL_GetProcAddress('glGetMinmaxParameteriv'); + if not Assigned(glGetMinmaxParameteriv) then Exit; + @glHistogram := SDL_GL_GetProcAddress('glHistogram'); + if not Assigned(glHistogram) then Exit; + @glMinmax := SDL_GL_GetProcAddress('glMinmax'); + if not Assigned(glMinmax) then Exit; + @glResetHistogram := SDL_GL_GetProcAddress('glResetHistogram'); + if not Assigned(glResetHistogram) then Exit; + @glResetMinmax := SDL_GL_GetProcAddress('glResetMinmax'); + if not Assigned(glResetMinmax) then Exit; + @glBlendEquation := SDL_GL_GetProcAddress('glBlendEquation'); + if not Assigned(glBlendEquation) then Exit; + @glBlendColor := SDL_GL_GetProcAddress('glBlendColor'); + if not Assigned(glBlendColor) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_version_1_3: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + @glActiveTexture := SDL_GL_GetProcAddress('glActiveTexture'); + if not Assigned(glActiveTexture) then Exit; + @glClientActiveTexture := SDL_GL_GetProcAddress('glClientActiveTexture'); + if not Assigned(glClientActiveTexture) then Exit; + @glMultiTexCoord1d := SDL_GL_GetProcAddress('glMultiTexCoord1d'); + if not Assigned(glMultiTexCoord1d) then Exit; + @glMultiTexCoord1dv := SDL_GL_GetProcAddress('glMultiTexCoord1dv'); + if not Assigned(glMultiTexCoord1dv) then Exit; + @glMultiTexCoord1f := SDL_GL_GetProcAddress('glMultiTexCoord1f'); + if not Assigned(glMultiTexCoord1f) then Exit; + @glMultiTexCoord1fv := SDL_GL_GetProcAddress('glMultiTexCoord1fv'); + if not Assigned(glMultiTexCoord1fv) then Exit; + @glMultiTexCoord1i := SDL_GL_GetProcAddress('glMultiTexCoord1i'); + if not Assigned(glMultiTexCoord1i) then Exit; + @glMultiTexCoord1iv := SDL_GL_GetProcAddress('glMultiTexCoord1iv'); + if not Assigned(glMultiTexCoord1iv) then Exit; + @glMultiTexCoord1s := SDL_GL_GetProcAddress('glMultiTexCoord1s'); + if not Assigned(glMultiTexCoord1s) then Exit; + @glMultiTexCoord1sv := SDL_GL_GetProcAddress('glMultiTexCoord1sv'); + if not Assigned(glMultiTexCoord1sv) then Exit; + @glMultiTexCoord2d := SDL_GL_GetProcAddress('glMultiTexCoord2d'); + if not Assigned(glMultiTexCoord2d) then Exit; + @glMultiTexCoord2dv := SDL_GL_GetProcAddress('glMultiTexCoord2dv'); + if not Assigned(glMultiTexCoord2dv) then Exit; + @glMultiTexCoord2f := SDL_GL_GetProcAddress('glMultiTexCoord2f'); + if not Assigned(glMultiTexCoord2f) then Exit; + @glMultiTexCoord2fv := SDL_GL_GetProcAddress('glMultiTexCoord2fv'); + if not Assigned(glMultiTexCoord2fv) then Exit; + @glMultiTexCoord2i := SDL_GL_GetProcAddress('glMultiTexCoord2i'); + if not Assigned(glMultiTexCoord2i) then Exit; + @glMultiTexCoord2iv := SDL_GL_GetProcAddress('glMultiTexCoord2iv'); + if not Assigned(glMultiTexCoord2iv) then Exit; + @glMultiTexCoord2s := SDL_GL_GetProcAddress('glMultiTexCoord2s'); + if not Assigned(glMultiTexCoord2s) then Exit; + @glMultiTexCoord2sv := SDL_GL_GetProcAddress('glMultiTexCoord2sv'); + if not Assigned(glMultiTexCoord2sv) then Exit; + @glMultiTexCoord3d := SDL_GL_GetProcAddress('glMultiTexCoord3d'); + if not Assigned(glMultiTexCoord3d) then Exit; + @glMultiTexCoord3dv := SDL_GL_GetProcAddress('glMultiTexCoord3dv'); + if not Assigned(glMultiTexCoord3dv) then Exit; + @glMultiTexCoord3f := SDL_GL_GetProcAddress('glMultiTexCoord3f'); + if not Assigned(glMultiTexCoord3f) then Exit; + @glMultiTexCoord3fv := SDL_GL_GetProcAddress('glMultiTexCoord3fv'); + if not Assigned(glMultiTexCoord3fv) then Exit; + @glMultiTexCoord3i := SDL_GL_GetProcAddress('glMultiTexCoord3i'); + if not Assigned(glMultiTexCoord3i) then Exit; + @glMultiTexCoord3iv := SDL_GL_GetProcAddress('glMultiTexCoord3iv'); + if not Assigned(glMultiTexCoord3iv) then Exit; + @glMultiTexCoord3s := SDL_GL_GetProcAddress('glMultiTexCoord3s'); + if not Assigned(glMultiTexCoord3s) then Exit; + @glMultiTexCoord3sv := SDL_GL_GetProcAddress('glMultiTexCoord3sv'); + if not Assigned(glMultiTexCoord3sv) then Exit; + @glMultiTexCoord4d := SDL_GL_GetProcAddress('glMultiTexCoord4d'); + if not Assigned(glMultiTexCoord4d) then Exit; + @glMultiTexCoord4dv := SDL_GL_GetProcAddress('glMultiTexCoord4dv'); + if not Assigned(glMultiTexCoord4dv) then Exit; + @glMultiTexCoord4f := SDL_GL_GetProcAddress('glMultiTexCoord4f'); + if not Assigned(glMultiTexCoord4f) then Exit; + @glMultiTexCoord4fv := SDL_GL_GetProcAddress('glMultiTexCoord4fv'); + if not Assigned(glMultiTexCoord4fv) then Exit; + @glMultiTexCoord4i := SDL_GL_GetProcAddress('glMultiTexCoord4i'); + if not Assigned(glMultiTexCoord4i) then Exit; + @glMultiTexCoord4iv := SDL_GL_GetProcAddress('glMultiTexCoord4iv'); + if not Assigned(glMultiTexCoord4iv) then Exit; + @glMultiTexCoord4s := SDL_GL_GetProcAddress('glMultiTexCoord4s'); + if not Assigned(glMultiTexCoord4s) then Exit; + @glMultiTexCoord4sv := SDL_GL_GetProcAddress('glMultiTexCoord4sv'); + if not Assigned(glMultiTexCoord4sv) then Exit; + @glLoadTransposeMatrixf := SDL_GL_GetProcAddress('glLoadTransposeMatrixf'); + if not Assigned(glLoadTransposeMatrixf) then Exit; + @glLoadTransposeMatrixd := SDL_GL_GetProcAddress('glLoadTransposeMatrixd'); + if not Assigned(glLoadTransposeMatrixd) then Exit; + @glMultTransposeMatrixf := SDL_GL_GetProcAddress('glMultTransposeMatrixf'); + if not Assigned(glMultTransposeMatrixf) then Exit; + @glMultTransposeMatrixd := SDL_GL_GetProcAddress('glMultTransposeMatrixd'); + if not Assigned(glMultTransposeMatrixd) then Exit; + @glSampleCoverage := SDL_GL_GetProcAddress('glSampleCoverage'); + if not Assigned(glSampleCoverage) then Exit; + @glCompressedTexImage3D := SDL_GL_GetProcAddress('glCompressedTexImage3D'); + if not Assigned(glCompressedTexImage3D) then Exit; + @glCompressedTexImage2D := SDL_GL_GetProcAddress('glCompressedTexImage2D'); + if not Assigned(glCompressedTexImage2D) then Exit; + @glCompressedTexImage1D := SDL_GL_GetProcAddress('glCompressedTexImage1D'); + if not Assigned(glCompressedTexImage1D) then Exit; + @glCompressedTexSubImage3D := SDL_GL_GetProcAddress('glCompressedTexSubImage3D'); + if not Assigned(glCompressedTexSubImage3D) then Exit; + @glCompressedTexSubImage2D := SDL_GL_GetProcAddress('glCompressedTexSubImage2D'); + if not Assigned(glCompressedTexSubImage2D) then Exit; + @glCompressedTexSubImage1D := SDL_GL_GetProcAddress('glCompressedTexSubImage1D'); + if not Assigned(glCompressedTexSubImage1D) then Exit; + @glGetCompressedTexImage := SDL_GL_GetProcAddress('glGetCompressedTexImage'); + if not Assigned(glGetCompressedTexImage) then Exit; + Result := TRUE; + +end; + +function Load_GL_ARB_multitexture: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_multitexture', extstring) then + begin + @glActiveTextureARB := SDL_GL_GetProcAddress('glActiveTextureARB'); + if not Assigned(glActiveTextureARB) then Exit; + @glClientActiveTextureARB := SDL_GL_GetProcAddress('glClientActiveTextureARB'); + if not Assigned(glClientActiveTextureARB) then Exit; + @glMultiTexCoord1dARB := SDL_GL_GetProcAddress('glMultiTexCoord1dARB'); + if not Assigned(glMultiTexCoord1dARB) then Exit; + @glMultiTexCoord1dvARB := SDL_GL_GetProcAddress('glMultiTexCoord1dvARB'); + if not Assigned(glMultiTexCoord1dvARB) then Exit; + @glMultiTexCoord1fARB := SDL_GL_GetProcAddress('glMultiTexCoord1fARB'); + if not Assigned(glMultiTexCoord1fARB) then Exit; + @glMultiTexCoord1fvARB := SDL_GL_GetProcAddress('glMultiTexCoord1fvARB'); + if not Assigned(glMultiTexCoord1fvARB) then Exit; + @glMultiTexCoord1iARB := SDL_GL_GetProcAddress('glMultiTexCoord1iARB'); + if not Assigned(glMultiTexCoord1iARB) then Exit; + @glMultiTexCoord1ivARB := SDL_GL_GetProcAddress('glMultiTexCoord1ivARB'); + if not Assigned(glMultiTexCoord1ivARB) then Exit; + @glMultiTexCoord1sARB := SDL_GL_GetProcAddress('glMultiTexCoord1sARB'); + if not Assigned(glMultiTexCoord1sARB) then Exit; + @glMultiTexCoord1svARB := SDL_GL_GetProcAddress('glMultiTexCoord1svARB'); + if not Assigned(glMultiTexCoord1svARB) then Exit; + @glMultiTexCoord2dARB := SDL_GL_GetProcAddress('glMultiTexCoord2dARB'); + if not Assigned(glMultiTexCoord2dARB) then Exit; + @glMultiTexCoord2dvARB := SDL_GL_GetProcAddress('glMultiTexCoord2dvARB'); + if not Assigned(glMultiTexCoord2dvARB) then Exit; + @glMultiTexCoord2fARB := SDL_GL_GetProcAddress('glMultiTexCoord2fARB'); + if not Assigned(glMultiTexCoord2fARB) then Exit; + @glMultiTexCoord2fvARB := SDL_GL_GetProcAddress('glMultiTexCoord2fvARB'); + if not Assigned(glMultiTexCoord2fvARB) then Exit; + @glMultiTexCoord2iARB := SDL_GL_GetProcAddress('glMultiTexCoord2iARB'); + if not Assigned(glMultiTexCoord2iARB) then Exit; + @glMultiTexCoord2ivARB := SDL_GL_GetProcAddress('glMultiTexCoord2ivARB'); + if not Assigned(glMultiTexCoord2ivARB) then Exit; + @glMultiTexCoord2sARB := SDL_GL_GetProcAddress('glMultiTexCoord2sARB'); + if not Assigned(glMultiTexCoord2sARB) then Exit; + @glMultiTexCoord2svARB := SDL_GL_GetProcAddress('glMultiTexCoord2svARB'); + if not Assigned(glMultiTexCoord2svARB) then Exit; + @glMultiTexCoord3dARB := SDL_GL_GetProcAddress('glMultiTexCoord3dARB'); + if not Assigned(glMultiTexCoord3dARB) then Exit; + @glMultiTexCoord3dvARB := SDL_GL_GetProcAddress('glMultiTexCoord3dvARB'); + if not Assigned(glMultiTexCoord3dvARB) then Exit; + @glMultiTexCoord3fARB := SDL_GL_GetProcAddress('glMultiTexCoord3fARB'); + if not Assigned(glMultiTexCoord3fARB) then Exit; + @glMultiTexCoord3fvARB := SDL_GL_GetProcAddress('glMultiTexCoord3fvARB'); + if not Assigned(glMultiTexCoord3fvARB) then Exit; + @glMultiTexCoord3iARB := SDL_GL_GetProcAddress('glMultiTexCoord3iARB'); + if not Assigned(glMultiTexCoord3iARB) then Exit; + @glMultiTexCoord3ivARB := SDL_GL_GetProcAddress('glMultiTexCoord3ivARB'); + if not Assigned(glMultiTexCoord3ivARB) then Exit; + @glMultiTexCoord3sARB := SDL_GL_GetProcAddress('glMultiTexCoord3sARB'); + if not Assigned(glMultiTexCoord3sARB) then Exit; + @glMultiTexCoord3svARB := SDL_GL_GetProcAddress('glMultiTexCoord3svARB'); + if not Assigned(glMultiTexCoord3svARB) then Exit; + @glMultiTexCoord4dARB := SDL_GL_GetProcAddress('glMultiTexCoord4dARB'); + if not Assigned(glMultiTexCoord4dARB) then Exit; + @glMultiTexCoord4dvARB := SDL_GL_GetProcAddress('glMultiTexCoord4dvARB'); + if not Assigned(glMultiTexCoord4dvARB) then Exit; + @glMultiTexCoord4fARB := SDL_GL_GetProcAddress('glMultiTexCoord4fARB'); + if not Assigned(glMultiTexCoord4fARB) then Exit; + @glMultiTexCoord4fvARB := SDL_GL_GetProcAddress('glMultiTexCoord4fvARB'); + if not Assigned(glMultiTexCoord4fvARB) then Exit; + @glMultiTexCoord4iARB := SDL_GL_GetProcAddress('glMultiTexCoord4iARB'); + if not Assigned(glMultiTexCoord4iARB) then Exit; + @glMultiTexCoord4ivARB := SDL_GL_GetProcAddress('glMultiTexCoord4ivARB'); + if not Assigned(glMultiTexCoord4ivARB) then Exit; + @glMultiTexCoord4sARB := SDL_GL_GetProcAddress('glMultiTexCoord4sARB'); + if not Assigned(glMultiTexCoord4sARB) then Exit; + @glMultiTexCoord4svARB := SDL_GL_GetProcAddress('glMultiTexCoord4svARB'); + if not Assigned(glMultiTexCoord4svARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_transpose_matrix: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_transpose_matrix', extstring) then + begin + @glLoadTransposeMatrixfARB := SDL_GL_GetProcAddress('glLoadTransposeMatrixfARB'); + if not Assigned(glLoadTransposeMatrixfARB) then Exit; + @glLoadTransposeMatrixdARB := SDL_GL_GetProcAddress('glLoadTransposeMatrixdARB'); + if not Assigned(glLoadTransposeMatrixdARB) then Exit; + @glMultTransposeMatrixfARB := SDL_GL_GetProcAddress('glMultTransposeMatrixfARB'); + if not Assigned(glMultTransposeMatrixfARB) then Exit; + @glMultTransposeMatrixdARB := SDL_GL_GetProcAddress('glMultTransposeMatrixdARB'); + if not Assigned(glMultTransposeMatrixdARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_multisample: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_multisample', extstring) then + begin + @glSampleCoverageARB := SDL_GL_GetProcAddress('glSampleCoverageARB'); + if not Assigned(glSampleCoverageARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_texture_env_add: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_texture_env_add', extstring) then + begin + Result := TRUE; + end; + +end; + +{$IFDEF Win32} +function Load_WGL_ARB_extensions_string: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_ARB_extensions_string', extstring) then + begin + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_ARB_buffer_region: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_ARB_buffer_region', extstring) then + begin + @wglCreateBufferRegionARB := SDL_GL_GetProcAddress('wglCreateBufferRegionARB'); + if not Assigned(wglCreateBufferRegionARB) then Exit; + @wglDeleteBufferRegionARB := SDL_GL_GetProcAddress('wglDeleteBufferRegionARB'); + if not Assigned(wglDeleteBufferRegionARB) then Exit; + @wglSaveBufferRegionARB := SDL_GL_GetProcAddress('wglSaveBufferRegionARB'); + if not Assigned(wglSaveBufferRegionARB) then Exit; + @wglRestoreBufferRegionARB := SDL_GL_GetProcAddress('wglRestoreBufferRegionARB'); + if not Assigned(wglRestoreBufferRegionARB) then Exit; + Result := TRUE; + end; + +end; +{$ENDIF} + +function Load_GL_ARB_texture_cube_map: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_texture_cube_map', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_depth_texture: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_depth_texture', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_point_parameters: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_point_parameters', extstring) then + begin + @glPointParameterfARB := SDL_GL_GetProcAddress('glPointParameterfARB'); + if not Assigned(glPointParameterfARB) then Exit; + @glPointParameterfvARB := SDL_GL_GetProcAddress('glPointParameterfvARB'); + if not Assigned(glPointParameterfvARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_shadow: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_shadow', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_shadow_ambient: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_shadow_ambient', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_texture_border_clamp: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_texture_border_clamp', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_texture_compression: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_texture_compression', extstring) then + begin + @glCompressedTexImage3DARB := SDL_GL_GetProcAddress('glCompressedTexImage3DARB'); + if not Assigned(glCompressedTexImage3DARB) then Exit; + @glCompressedTexImage2DARB := SDL_GL_GetProcAddress('glCompressedTexImage2DARB'); + if not Assigned(glCompressedTexImage2DARB) then Exit; + @glCompressedTexImage1DARB := SDL_GL_GetProcAddress('glCompressedTexImage1DARB'); + if not Assigned(glCompressedTexImage1DARB) then Exit; + @glCompressedTexSubImage3DARB := SDL_GL_GetProcAddress('glCompressedTexSubImage3DARB'); + if not Assigned(glCompressedTexSubImage3DARB) then Exit; + @glCompressedTexSubImage2DARB := SDL_GL_GetProcAddress('glCompressedTexSubImage2DARB'); + if not Assigned(glCompressedTexSubImage2DARB) then Exit; + @glCompressedTexSubImage1DARB := SDL_GL_GetProcAddress('glCompressedTexSubImage1DARB'); + if not Assigned(glCompressedTexSubImage1DARB) then Exit; + @glGetCompressedTexImageARB := SDL_GL_GetProcAddress('glGetCompressedTexImageARB'); + if not Assigned(glGetCompressedTexImageARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_texture_env_combine: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_texture_env_combine', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_texture_env_crossbar: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_texture_env_crossbar', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_texture_env_dot3: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_texture_env_dot3', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_texture_mirrored_repeat: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_texture_mirrored_repeat', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_vertex_blend: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_vertex_blend', extstring) then + begin + @glWeightbvARB := SDL_GL_GetProcAddress('glWeightbvARB'); + if not Assigned(glWeightbvARB) then Exit; + @glWeightsvARB := SDL_GL_GetProcAddress('glWeightsvARB'); + if not Assigned(glWeightsvARB) then Exit; + @glWeightivARB := SDL_GL_GetProcAddress('glWeightivARB'); + if not Assigned(glWeightivARB) then Exit; + @glWeightfvARB := SDL_GL_GetProcAddress('glWeightfvARB'); + if not Assigned(glWeightfvARB) then Exit; + @glWeightdvARB := SDL_GL_GetProcAddress('glWeightdvARB'); + if not Assigned(glWeightdvARB) then Exit; + @glWeightvARB := SDL_GL_GetProcAddress('glWeightvARB'); + if not Assigned(glWeightvARB) then Exit; + @glWeightubvARB := SDL_GL_GetProcAddress('glWeightubvARB'); + if not Assigned(glWeightubvARB) then Exit; + @glWeightusvARB := SDL_GL_GetProcAddress('glWeightusvARB'); + if not Assigned(glWeightusvARB) then Exit; + @glWeightuivARB := SDL_GL_GetProcAddress('glWeightuivARB'); + if not Assigned(glWeightuivARB) then Exit; + @glWeightPointerARB := SDL_GL_GetProcAddress('glWeightPointerARB'); + if not Assigned(glWeightPointerARB) then Exit; + @glVertexBlendARB := SDL_GL_GetProcAddress('glVertexBlendARB'); + if not Assigned(glVertexBlendARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_vertex_program: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_vertex_program', extstring) then + begin + @glVertexAttrib1sARB := SDL_GL_GetProcAddress('glVertexAttrib1sARB'); + if not Assigned(glVertexAttrib1sARB) then Exit; + @glVertexAttrib1fARB := SDL_GL_GetProcAddress('glVertexAttrib1fARB'); + if not Assigned(glVertexAttrib1fARB) then Exit; + @glVertexAttrib1dARB := SDL_GL_GetProcAddress('glVertexAttrib1dARB'); + if not Assigned(glVertexAttrib1dARB) then Exit; + @glVertexAttrib2sARB := SDL_GL_GetProcAddress('glVertexAttrib2sARB'); + if not Assigned(glVertexAttrib2sARB) then Exit; + @glVertexAttrib2fARB := SDL_GL_GetProcAddress('glVertexAttrib2fARB'); + if not Assigned(glVertexAttrib2fARB) then Exit; + @glVertexAttrib2dARB := SDL_GL_GetProcAddress('glVertexAttrib2dARB'); + if not Assigned(glVertexAttrib2dARB) then Exit; + @glVertexAttrib3sARB := SDL_GL_GetProcAddress('glVertexAttrib3sARB'); + if not Assigned(glVertexAttrib3sARB) then Exit; + @glVertexAttrib3fARB := SDL_GL_GetProcAddress('glVertexAttrib3fARB'); + if not Assigned(glVertexAttrib3fARB) then Exit; + @glVertexAttrib3dARB := SDL_GL_GetProcAddress('glVertexAttrib3dARB'); + if not Assigned(glVertexAttrib3dARB) then Exit; + @glVertexAttrib4sARB := SDL_GL_GetProcAddress('glVertexAttrib4sARB'); + if not Assigned(glVertexAttrib4sARB) then Exit; + @glVertexAttrib4fARB := SDL_GL_GetProcAddress('glVertexAttrib4fARB'); + if not Assigned(glVertexAttrib4fARB) then Exit; + @glVertexAttrib4dARB := SDL_GL_GetProcAddress('glVertexAttrib4dARB'); + if not Assigned(glVertexAttrib4dARB) then Exit; + @glVertexAttrib4NubARB := SDL_GL_GetProcAddress('glVertexAttrib4NubARB'); + if not Assigned(glVertexAttrib4NubARB) then Exit; + @glVertexAttrib1svARB := SDL_GL_GetProcAddress('glVertexAttrib1svARB'); + if not Assigned(glVertexAttrib1svARB) then Exit; + @glVertexAttrib1fvARB := SDL_GL_GetProcAddress('glVertexAttrib1fvARB'); + if not Assigned(glVertexAttrib1fvARB) then Exit; + @glVertexAttrib1dvARB := SDL_GL_GetProcAddress('glVertexAttrib1dvARB'); + if not Assigned(glVertexAttrib1dvARB) then Exit; + @glVertexAttrib2svARB := SDL_GL_GetProcAddress('glVertexAttrib2svARB'); + if not Assigned(glVertexAttrib2svARB) then Exit; + @glVertexAttrib2fvARB := SDL_GL_GetProcAddress('glVertexAttrib2fvARB'); + if not Assigned(glVertexAttrib2fvARB) then Exit; + @glVertexAttrib2dvARB := SDL_GL_GetProcAddress('glVertexAttrib2dvARB'); + if not Assigned(glVertexAttrib2dvARB) then Exit; + @glVertexAttrib3svARB := SDL_GL_GetProcAddress('glVertexAttrib3svARB'); + if not Assigned(glVertexAttrib3svARB) then Exit; + @glVertexAttrib3fvARB := SDL_GL_GetProcAddress('glVertexAttrib3fvARB'); + if not Assigned(glVertexAttrib3fvARB) then Exit; + @glVertexAttrib3dvARB := SDL_GL_GetProcAddress('glVertexAttrib3dvARB'); + if not Assigned(glVertexAttrib3dvARB) then Exit; + @glVertexAttrib4bvARB := SDL_GL_GetProcAddress('glVertexAttrib4bvARB'); + if not Assigned(glVertexAttrib4bvARB) then Exit; + @glVertexAttrib4svARB := SDL_GL_GetProcAddress('glVertexAttrib4svARB'); + if not Assigned(glVertexAttrib4svARB) then Exit; + @glVertexAttrib4ivARB := SDL_GL_GetProcAddress('glVertexAttrib4ivARB'); + if not Assigned(glVertexAttrib4ivARB) then Exit; + @glVertexAttrib4ubvARB := SDL_GL_GetProcAddress('glVertexAttrib4ubvARB'); + if not Assigned(glVertexAttrib4ubvARB) then Exit; + @glVertexAttrib4usvARB := SDL_GL_GetProcAddress('glVertexAttrib4usvARB'); + if not Assigned(glVertexAttrib4usvARB) then Exit; + @glVertexAttrib4uivARB := SDL_GL_GetProcAddress('glVertexAttrib4uivARB'); + if not Assigned(glVertexAttrib4uivARB) then Exit; + @glVertexAttrib4fvARB := SDL_GL_GetProcAddress('glVertexAttrib4fvARB'); + if not Assigned(glVertexAttrib4fvARB) then Exit; + @glVertexAttrib4dvARB := SDL_GL_GetProcAddress('glVertexAttrib4dvARB'); + if not Assigned(glVertexAttrib4dvARB) then Exit; + @glVertexAttrib4NbvARB := SDL_GL_GetProcAddress('glVertexAttrib4NbvARB'); + if not Assigned(glVertexAttrib4NbvARB) then Exit; + @glVertexAttrib4NsvARB := SDL_GL_GetProcAddress('glVertexAttrib4NsvARB'); + if not Assigned(glVertexAttrib4NsvARB) then Exit; + @glVertexAttrib4NivARB := SDL_GL_GetProcAddress('glVertexAttrib4NivARB'); + if not Assigned(glVertexAttrib4NivARB) then Exit; + @glVertexAttrib4NubvARB := SDL_GL_GetProcAddress('glVertexAttrib4NubvARB'); + if not Assigned(glVertexAttrib4NubvARB) then Exit; + @glVertexAttrib4NusvARB := SDL_GL_GetProcAddress('glVertexAttrib4NusvARB'); + if not Assigned(glVertexAttrib4NusvARB) then Exit; + @glVertexAttrib4NuivARB := SDL_GL_GetProcAddress('glVertexAttrib4NuivARB'); + if not Assigned(glVertexAttrib4NuivARB) then Exit; + @glVertexAttribPointerARB := SDL_GL_GetProcAddress('glVertexAttribPointerARB'); + if not Assigned(glVertexAttribPointerARB) then Exit; + @glEnableVertexAttribArrayARB := SDL_GL_GetProcAddress('glEnableVertexAttribArrayARB'); + if not Assigned(glEnableVertexAttribArrayARB) then Exit; + @glDisableVertexAttribArrayARB := SDL_GL_GetProcAddress('glDisableVertexAttribArrayARB'); + if not Assigned(glDisableVertexAttribArrayARB) then Exit; + @glProgramStringARB := SDL_GL_GetProcAddress('glProgramStringARB'); + if not Assigned(glProgramStringARB) then Exit; + @glBindProgramARB := SDL_GL_GetProcAddress('glBindProgramARB'); + if not Assigned(glBindProgramARB) then Exit; + @glDeleteProgramsARB := SDL_GL_GetProcAddress('glDeleteProgramsARB'); + if not Assigned(glDeleteProgramsARB) then Exit; + @glGenProgramsARB := SDL_GL_GetProcAddress('glGenProgramsARB'); + if not Assigned(glGenProgramsARB) then Exit; + @glProgramEnvParameter4dARB := SDL_GL_GetProcAddress('glProgramEnvParameter4dARB'); + if not Assigned(glProgramEnvParameter4dARB) then Exit; + @glProgramEnvParameter4dvARB := SDL_GL_GetProcAddress('glProgramEnvParameter4dvARB'); + if not Assigned(glProgramEnvParameter4dvARB) then Exit; + @glProgramEnvParameter4fARB := SDL_GL_GetProcAddress('glProgramEnvParameter4fARB'); + if not Assigned(glProgramEnvParameter4fARB) then Exit; + @glProgramEnvParameter4fvARB := SDL_GL_GetProcAddress('glProgramEnvParameter4fvARB'); + if not Assigned(glProgramEnvParameter4fvARB) then Exit; + @glProgramLocalParameter4dARB := SDL_GL_GetProcAddress('glProgramLocalParameter4dARB'); + if not Assigned(glProgramLocalParameter4dARB) then Exit; + @glProgramLocalParameter4dvARB := SDL_GL_GetProcAddress('glProgramLocalParameter4dvARB'); + if not Assigned(glProgramLocalParameter4dvARB) then Exit; + @glProgramLocalParameter4fARB := SDL_GL_GetProcAddress('glProgramLocalParameter4fARB'); + if not Assigned(glProgramLocalParameter4fARB) then Exit; + @glProgramLocalParameter4fvARB := SDL_GL_GetProcAddress('glProgramLocalParameter4fvARB'); + if not Assigned(glProgramLocalParameter4fvARB) then Exit; + @glGetProgramEnvParameterdvARB := SDL_GL_GetProcAddress('glGetProgramEnvParameterdvARB'); + if not Assigned(glGetProgramEnvParameterdvARB) then Exit; + @glGetProgramEnvParameterfvARB := SDL_GL_GetProcAddress('glGetProgramEnvParameterfvARB'); + if not Assigned(glGetProgramEnvParameterfvARB) then Exit; + @glGetProgramLocalParameterdvARB := SDL_GL_GetProcAddress('glGetProgramLocalParameterdvARB'); + if not Assigned(glGetProgramLocalParameterdvARB) then Exit; + @glGetProgramLocalParameterfvARB := SDL_GL_GetProcAddress('glGetProgramLocalParameterfvARB'); + if not Assigned(glGetProgramLocalParameterfvARB) then Exit; + @glGetProgramivARB := SDL_GL_GetProcAddress('glGetProgramivARB'); + if not Assigned(glGetProgramivARB) then Exit; + @glGetProgramStringARB := SDL_GL_GetProcAddress('glGetProgramStringARB'); + if not Assigned(glGetProgramStringARB) then Exit; + @glGetVertexAttribdvARB := SDL_GL_GetProcAddress('glGetVertexAttribdvARB'); + if not Assigned(glGetVertexAttribdvARB) then Exit; + @glGetVertexAttribfvARB := SDL_GL_GetProcAddress('glGetVertexAttribfvARB'); + if not Assigned(glGetVertexAttribfvARB) then Exit; + @glGetVertexAttribivARB := SDL_GL_GetProcAddress('glGetVertexAttribivARB'); + if not Assigned(glGetVertexAttribivARB) then Exit; + @glGetVertexAttribPointervARB := SDL_GL_GetProcAddress('glGetVertexAttribPointervARB'); + if not Assigned(glGetVertexAttribPointervARB) then Exit; + @glIsProgramARB := SDL_GL_GetProcAddress('glIsProgramARB'); + if not Assigned(glIsProgramARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_window_pos: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_window_pos', extstring) then + begin + @glWindowPos2dARB := SDL_GL_GetProcAddress('glWindowPos2dARB'); + if not Assigned(glWindowPos2dARB) then Exit; + @glWindowPos2fARB := SDL_GL_GetProcAddress('glWindowPos2fARB'); + if not Assigned(glWindowPos2fARB) then Exit; + @glWindowPos2iARB := SDL_GL_GetProcAddress('glWindowPos2iARB'); + if not Assigned(glWindowPos2iARB) then Exit; + @glWindowPos2sARB := SDL_GL_GetProcAddress('glWindowPos2sARB'); + if not Assigned(glWindowPos2sARB) then Exit; + @glWindowPos2dvARB := SDL_GL_GetProcAddress('glWindowPos2dvARB'); + if not Assigned(glWindowPos2dvARB) then Exit; + @glWindowPos2fvARB := SDL_GL_GetProcAddress('glWindowPos2fvARB'); + if not Assigned(glWindowPos2fvARB) then Exit; + @glWindowPos2ivARB := SDL_GL_GetProcAddress('glWindowPos2ivARB'); + if not Assigned(glWindowPos2ivARB) then Exit; + @glWindowPos2svARB := SDL_GL_GetProcAddress('glWindowPos2svARB'); + if not Assigned(glWindowPos2svARB) then Exit; + @glWindowPos3dARB := SDL_GL_GetProcAddress('glWindowPos3dARB'); + if not Assigned(glWindowPos3dARB) then Exit; + @glWindowPos3fARB := SDL_GL_GetProcAddress('glWindowPos3fARB'); + if not Assigned(glWindowPos3fARB) then Exit; + @glWindowPos3iARB := SDL_GL_GetProcAddress('glWindowPos3iARB'); + if not Assigned(glWindowPos3iARB) then Exit; + @glWindowPos3sARB := SDL_GL_GetProcAddress('glWindowPos3sARB'); + if not Assigned(glWindowPos3sARB) then Exit; + @glWindowPos3dvARB := SDL_GL_GetProcAddress('glWindowPos3dvARB'); + if not Assigned(glWindowPos3dvARB) then Exit; + @glWindowPos3fvARB := SDL_GL_GetProcAddress('glWindowPos3fvARB'); + if not Assigned(glWindowPos3fvARB) then Exit; + @glWindowPos3ivARB := SDL_GL_GetProcAddress('glWindowPos3ivARB'); + if not Assigned(glWindowPos3ivARB) then Exit; + @glWindowPos3svARB := SDL_GL_GetProcAddress('glWindowPos3svARB'); + if not Assigned(glWindowPos3svARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_422_pixels: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_422_pixels', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_abgr: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_abgr', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_bgra: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_bgra', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_blend_color: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_blend_color', extstring) then + begin + @glBlendColorEXT := SDL_GL_GetProcAddress('glBlendColorEXT'); + if not Assigned(glBlendColorEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_blend_func_separate: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_blend_func_separate', extstring) then + begin + @glBlendFuncSeparateEXT := SDL_GL_GetProcAddress('glBlendFuncSeparateEXT'); + if not Assigned(glBlendFuncSeparateEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_blend_logic_op: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_blend_logic_op', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_blend_minmax: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_blend_minmax', extstring) then + begin + @glBlendEquationEXT := SDL_GL_GetProcAddress('glBlendEquationEXT'); + if not Assigned(glBlendEquationEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_blend_subtract: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_blend_subtract', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_clip_volume_hint: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_clip_volume_hint', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_color_subtable: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_color_subtable', extstring) then + begin + @glColorSubTableEXT := SDL_GL_GetProcAddress('glColorSubTableEXT'); + if not Assigned(glColorSubTableEXT) then Exit; + @glCopyColorSubTableEXT := SDL_GL_GetProcAddress('glCopyColorSubTableEXT'); + if not Assigned(glCopyColorSubTableEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_compiled_vertex_array: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_compiled_vertex_array', extstring) then + begin + @glLockArraysEXT := SDL_GL_GetProcAddress('glLockArraysEXT'); + if not Assigned(glLockArraysEXT) then Exit; + @glUnlockArraysEXT := SDL_GL_GetProcAddress('glUnlockArraysEXT'); + if not Assigned(glUnlockArraysEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_convolution: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_convolution', extstring) then + begin + @glConvolutionFilter1DEXT := SDL_GL_GetProcAddress('glConvolutionFilter1DEXT'); + if not Assigned(glConvolutionFilter1DEXT) then Exit; + @glConvolutionFilter2DEXT := SDL_GL_GetProcAddress('glConvolutionFilter2DEXT'); + if not Assigned(glConvolutionFilter2DEXT) then Exit; + @glCopyConvolutionFilter1DEXT := SDL_GL_GetProcAddress('glCopyConvolutionFilter1DEXT'); + if not Assigned(glCopyConvolutionFilter1DEXT) then Exit; + @glCopyConvolutionFilter2DEXT := SDL_GL_GetProcAddress('glCopyConvolutionFilter2DEXT'); + if not Assigned(glCopyConvolutionFilter2DEXT) then Exit; + @glGetConvolutionFilterEXT := SDL_GL_GetProcAddress('glGetConvolutionFilterEXT'); + if not Assigned(glGetConvolutionFilterEXT) then Exit; + @glSeparableFilter2DEXT := SDL_GL_GetProcAddress('glSeparableFilter2DEXT'); + if not Assigned(glSeparableFilter2DEXT) then Exit; + @glGetSeparableFilterEXT := SDL_GL_GetProcAddress('glGetSeparableFilterEXT'); + if not Assigned(glGetSeparableFilterEXT) then Exit; + @glConvolutionParameteriEXT := SDL_GL_GetProcAddress('glConvolutionParameteriEXT'); + if not Assigned(glConvolutionParameteriEXT) then Exit; + @glConvolutionParameterivEXT := SDL_GL_GetProcAddress('glConvolutionParameterivEXT'); + if not Assigned(glConvolutionParameterivEXT) then Exit; + @glConvolutionParameterfEXT := SDL_GL_GetProcAddress('glConvolutionParameterfEXT'); + if not Assigned(glConvolutionParameterfEXT) then Exit; + @glConvolutionParameterfvEXT := SDL_GL_GetProcAddress('glConvolutionParameterfvEXT'); + if not Assigned(glConvolutionParameterfvEXT) then Exit; + @glGetConvolutionParameterivEXT := SDL_GL_GetProcAddress('glGetConvolutionParameterivEXT'); + if not Assigned(glGetConvolutionParameterivEXT) then Exit; + @glGetConvolutionParameterfvEXT := SDL_GL_GetProcAddress('glGetConvolutionParameterfvEXT'); + if not Assigned(glGetConvolutionParameterfvEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_histogram: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_histogram', extstring) then + begin + @glHistogramEXT := SDL_GL_GetProcAddress('glHistogramEXT'); + if not Assigned(glHistogramEXT) then Exit; + @glResetHistogramEXT := SDL_GL_GetProcAddress('glResetHistogramEXT'); + if not Assigned(glResetHistogramEXT) then Exit; + @glGetHistogramEXT := SDL_GL_GetProcAddress('glGetHistogramEXT'); + if not Assigned(glGetHistogramEXT) then Exit; + @glGetHistogramParameterivEXT := SDL_GL_GetProcAddress('glGetHistogramParameterivEXT'); + if not Assigned(glGetHistogramParameterivEXT) then Exit; + @glGetHistogramParameterfvEXT := SDL_GL_GetProcAddress('glGetHistogramParameterfvEXT'); + if not Assigned(glGetHistogramParameterfvEXT) then Exit; + @glMinmaxEXT := SDL_GL_GetProcAddress('glMinmaxEXT'); + if not Assigned(glMinmaxEXT) then Exit; + @glResetMinmaxEXT := SDL_GL_GetProcAddress('glResetMinmaxEXT'); + if not Assigned(glResetMinmaxEXT) then Exit; + @glGetMinmaxEXT := SDL_GL_GetProcAddress('glGetMinmaxEXT'); + if not Assigned(glGetMinmaxEXT) then Exit; + @glGetMinmaxParameterivEXT := SDL_GL_GetProcAddress('glGetMinmaxParameterivEXT'); + if not Assigned(glGetMinmaxParameterivEXT) then Exit; + @glGetMinmaxParameterfvEXT := SDL_GL_GetProcAddress('glGetMinmaxParameterfvEXT'); + if not Assigned(glGetMinmaxParameterfvEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_multi_draw_arrays: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_multi_draw_arrays', extstring) then + begin + @glMultiDrawArraysEXT := SDL_GL_GetProcAddress('glMultiDrawArraysEXT'); + if not Assigned(glMultiDrawArraysEXT) then Exit; + @glMultiDrawElementsEXT := SDL_GL_GetProcAddress('glMultiDrawElementsEXT'); + if not Assigned(glMultiDrawElementsEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_packed_pixels: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_packed_pixels', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_paletted_texture: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_paletted_texture', extstring) then + begin + @glColorTableEXT := SDL_GL_GetProcAddress('glColorTableEXT'); + if not Assigned(glColorTableEXT) then Exit; + @glColorSubTableEXT := SDL_GL_GetProcAddress('glColorSubTableEXT'); + if not Assigned(glColorSubTableEXT) then Exit; + @glGetColorTableEXT := SDL_GL_GetProcAddress('glGetColorTableEXT'); + if not Assigned(glGetColorTableEXT) then Exit; + @glGetColorTableParameterivEXT := SDL_GL_GetProcAddress('glGetColorTableParameterivEXT'); + if not Assigned(glGetColorTableParameterivEXT) then Exit; + @glGetColorTableParameterfvEXT := SDL_GL_GetProcAddress('glGetColorTableParameterfvEXT'); + if not Assigned(glGetColorTableParameterfvEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_point_parameters: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_point_parameters', extstring) then + begin + @glPointParameterfEXT := SDL_GL_GetProcAddress('glPointParameterfEXT'); + if not Assigned(glPointParameterfEXT) then Exit; + @glPointParameterfvEXT := SDL_GL_GetProcAddress('glPointParameterfvEXT'); + if not Assigned(glPointParameterfvEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_polygon_offset: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_polygon_offset', extstring) then + begin + @glPolygonOffsetEXT := SDL_GL_GetProcAddress('glPolygonOffsetEXT'); + if not Assigned(glPolygonOffsetEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_separate_specular_color: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_separate_specular_color', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_shadow_funcs: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_shadow_funcs', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_shared_texture_palette: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_shared_texture_palette', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_stencil_two_side: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_stencil_two_side', extstring) then + begin + @glActiveStencilFaceEXT := SDL_GL_GetProcAddress('glActiveStencilFaceEXT'); + if not Assigned(glActiveStencilFaceEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_stencil_wrap: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_stencil_wrap', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_subtexture: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_subtexture', extstring) then + begin + @glTexSubImage1DEXT := SDL_GL_GetProcAddress('glTexSubImage1DEXT'); + if not Assigned(glTexSubImage1DEXT) then Exit; + @glTexSubImage2DEXT := SDL_GL_GetProcAddress('glTexSubImage2DEXT'); + if not Assigned(glTexSubImage2DEXT) then Exit; + @glTexSubImage3DEXT := SDL_GL_GetProcAddress('glTexSubImage3DEXT'); + if not Assigned(glTexSubImage3DEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_texture3D: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_texture3D', extstring) then + begin + glTexImage3DEXT := SDL_GL_GetProcAddress('glTexImage3DEXT'); + if not Assigned(glTexImage3DEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_texture_compression_s3tc: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_texture_compression_s3tc', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_texture_env_add: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_texture_env_add', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_texture_env_combine: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_texture_env_combine', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_texture_env_dot3: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_texture_env_dot3', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_texture_filter_anisotropic: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_texture_filter_anisotropic', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_texture_lod_bias: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_texture_lod_bias', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_texture_object: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_texture_object', extstring) then + begin + @glGenTexturesEXT := SDL_GL_GetProcAddress('glGenTexturesEXT'); + if not Assigned(glGenTexturesEXT) then Exit; + @glDeleteTexturesEXT := SDL_GL_GetProcAddress('glDeleteTexturesEXT'); + if not Assigned(glDeleteTexturesEXT) then Exit; + @glBindTextureEXT := SDL_GL_GetProcAddress('glBindTextureEXT'); + if not Assigned(glBindTextureEXT) then Exit; + @glPrioritizeTexturesEXT := SDL_GL_GetProcAddress('glPrioritizeTexturesEXT'); + if not Assigned(glPrioritizeTexturesEXT) then Exit; + @glAreTexturesResidentEXT := SDL_GL_GetProcAddress('glAreTexturesResidentEXT'); + if not Assigned(glAreTexturesResidentEXT) then Exit; + @glIsTextureEXT := SDL_GL_GetProcAddress('glIsTextureEXT'); + if not Assigned(glIsTextureEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_vertex_array: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_vertex_array', extstring) then + begin + @glArrayElementEXT := SDL_GL_GetProcAddress('glArrayElementEXT'); + if not Assigned(glArrayElementEXT) then Exit; + @glDrawArraysEXT := SDL_GL_GetProcAddress('glDrawArraysEXT'); + if not Assigned(glDrawArraysEXT) then Exit; + @glVertexPointerEXT := SDL_GL_GetProcAddress('glVertexPointerEXT'); + if not Assigned(glVertexPointerEXT) then Exit; + @glNormalPointerEXT := SDL_GL_GetProcAddress('glNormalPointerEXT'); + if not Assigned(glNormalPointerEXT) then Exit; + @glColorPointerEXT := SDL_GL_GetProcAddress('glColorPointerEXT'); + if not Assigned(glColorPointerEXT) then Exit; + @glIndexPointerEXT := SDL_GL_GetProcAddress('glIndexPointerEXT'); + if not Assigned(glIndexPointerEXT) then Exit; + @glTexCoordPointerEXT := SDL_GL_GetProcAddress('glTexCoordPointerEXT'); + if not Assigned(glTexCoordPointerEXT) then Exit; + @glEdgeFlagPointerEXT := SDL_GL_GetProcAddress('glEdgeFlagPointerEXT'); + if not Assigned(glEdgeFlagPointerEXT) then Exit; + @glGetPointervEXT := SDL_GL_GetProcAddress('glGetPointervEXT'); + if not Assigned(glGetPointervEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_vertex_shader: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_vertex_shader', extstring) then + begin + @glBeginVertexShaderEXT := SDL_GL_GetProcAddress('glBeginVertexShaderEXT'); + if not Assigned(glBeginVertexShaderEXT) then Exit; + @glEndVertexShaderEXT := SDL_GL_GetProcAddress('glEndVertexShaderEXT'); + if not Assigned(glEndVertexShaderEXT) then Exit; + @glBindVertexShaderEXT := SDL_GL_GetProcAddress('glBindVertexShaderEXT'); + if not Assigned(glBindVertexShaderEXT) then Exit; + @glGenVertexShadersEXT := SDL_GL_GetProcAddress('glGenVertexShadersEXT'); + if not Assigned(glGenVertexShadersEXT) then Exit; + @glDeleteVertexShaderEXT := SDL_GL_GetProcAddress('glDeleteVertexShaderEXT'); + if not Assigned(glDeleteVertexShaderEXT) then Exit; + @glShaderOp1EXT := SDL_GL_GetProcAddress('glShaderOp1EXT'); + if not Assigned(glShaderOp1EXT) then Exit; + @glShaderOp2EXT := SDL_GL_GetProcAddress('glShaderOp2EXT'); + if not Assigned(glShaderOp2EXT) then Exit; + @glShaderOp3EXT := SDL_GL_GetProcAddress('glShaderOp3EXT'); + if not Assigned(glShaderOp3EXT) then Exit; + @glSwizzleEXT := SDL_GL_GetProcAddress('glSwizzleEXT'); + if not Assigned(glSwizzleEXT) then Exit; + @glWriteMaskEXT := SDL_GL_GetProcAddress('glWriteMaskEXT'); + if not Assigned(glWriteMaskEXT) then Exit; + @glInsertComponentEXT := SDL_GL_GetProcAddress('glInsertComponentEXT'); + if not Assigned(glInsertComponentEXT) then Exit; + @glExtractComponentEXT := SDL_GL_GetProcAddress('glExtractComponentEXT'); + if not Assigned(glExtractComponentEXT) then Exit; + @glGenSymbolsEXT := SDL_GL_GetProcAddress('glGenSymbolsEXT'); + if not Assigned(glGenSymbolsEXT) then Exit; + @glSetInvariantEXT := SDL_GL_GetProcAddress('glSetInvariantEXT'); + if not Assigned(glSetInvariantEXT) then Exit; + @glSetLocalConstantEXT := SDL_GL_GetProcAddress('glSetLocalConstantEXT'); + if not Assigned(glSetLocalConstantEXT) then Exit; + @glVariantbvEXT := SDL_GL_GetProcAddress('glVariantbvEXT'); + if not Assigned(glVariantbvEXT) then Exit; + @glVariantsvEXT := SDL_GL_GetProcAddress('glVariantsvEXT'); + if not Assigned(glVariantsvEXT) then Exit; + @glVariantivEXT := SDL_GL_GetProcAddress('glVariantivEXT'); + if not Assigned(glVariantivEXT) then Exit; + @glVariantfvEXT := SDL_GL_GetProcAddress('glVariantfvEXT'); + if not Assigned(glVariantfvEXT) then Exit; + @glVariantdvEXT := SDL_GL_GetProcAddress('glVariantdvEXT'); + if not Assigned(glVariantdvEXT) then Exit; + @glVariantubvEXT := SDL_GL_GetProcAddress('glVariantubvEXT'); + if not Assigned(glVariantubvEXT) then Exit; + @glVariantusvEXT := SDL_GL_GetProcAddress('glVariantusvEXT'); + if not Assigned(glVariantusvEXT) then Exit; + @glVariantuivEXT := SDL_GL_GetProcAddress('glVariantuivEXT'); + if not Assigned(glVariantuivEXT) then Exit; + @glVariantPointerEXT := SDL_GL_GetProcAddress('glVariantPointerEXT'); + if not Assigned(glVariantPointerEXT) then Exit; + @glEnableVariantClientStateEXT := SDL_GL_GetProcAddress('glEnableVariantClientStateEXT'); + if not Assigned(glEnableVariantClientStateEXT) then Exit; + @glDisableVariantClientStateEXT := SDL_GL_GetProcAddress('glDisableVariantClientStateEXT'); + if not Assigned(glDisableVariantClientStateEXT) then Exit; + @glBindLightParameterEXT := SDL_GL_GetProcAddress('glBindLightParameterEXT'); + if not Assigned(glBindLightParameterEXT) then Exit; + @glBindMaterialParameterEXT := SDL_GL_GetProcAddress('glBindMaterialParameterEXT'); + if not Assigned(glBindMaterialParameterEXT) then Exit; + @glBindTexGenParameterEXT := SDL_GL_GetProcAddress('glBindTexGenParameterEXT'); + if not Assigned(glBindTexGenParameterEXT) then Exit; + @glBindTextureUnitParameterEXT := SDL_GL_GetProcAddress('glBindTextureUnitParameterEXT'); + if not Assigned(glBindTextureUnitParameterEXT) then Exit; + @glBindParameterEXT := SDL_GL_GetProcAddress('glBindParameterEXT'); + if not Assigned(glBindParameterEXT) then Exit; + @glIsVariantEnabledEXT := SDL_GL_GetProcAddress('glIsVariantEnabledEXT'); + if not Assigned(glIsVariantEnabledEXT) then Exit; + @glGetVariantBooleanvEXT := SDL_GL_GetProcAddress('glGetVariantBooleanvEXT'); + if not Assigned(glGetVariantBooleanvEXT) then Exit; + @glGetVariantIntegervEXT := SDL_GL_GetProcAddress('glGetVariantIntegervEXT'); + if not Assigned(glGetVariantIntegervEXT) then Exit; + @glGetVariantFloatvEXT := SDL_GL_GetProcAddress('glGetVariantFloatvEXT'); + if not Assigned(glGetVariantFloatvEXT) then Exit; + @glGetVariantPointervEXT := SDL_GL_GetProcAddress('glGetVariantPointervEXT'); + if not Assigned(glGetVariantPointervEXT) then Exit; + @glGetInvariantBooleanvEXT := SDL_GL_GetProcAddress('glGetInvariantBooleanvEXT'); + if not Assigned(glGetInvariantBooleanvEXT) then Exit; + @glGetInvariantIntegervEXT := SDL_GL_GetProcAddress('glGetInvariantIntegervEXT'); + if not Assigned(glGetInvariantIntegervEXT) then Exit; + @glGetInvariantFloatvEXT := SDL_GL_GetProcAddress('glGetInvariantFloatvEXT'); + if not Assigned(glGetInvariantFloatvEXT) then Exit; + @glGetLocalConstantBooleanvEXT := SDL_GL_GetProcAddress('glGetLocalConstantBooleanvEXT'); + if not Assigned(glGetLocalConstantBooleanvEXT) then Exit; + @glGetLocalConstantIntegervEXT := SDL_GL_GetProcAddress('glGetLocalConstantIntegervEXT'); + if not Assigned(glGetLocalConstantIntegervEXT) then Exit; + @glGetLocalConstantFloatvEXT := SDL_GL_GetProcAddress('glGetLocalConstantFloatvEXT'); + if not Assigned(glGetLocalConstantFloatvEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_vertex_weighting: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_vertex_weighting', extstring) then + begin + @glVertexWeightfEXT := SDL_GL_GetProcAddress('glVertexWeightfEXT'); + if not Assigned(glVertexWeightfEXT) then Exit; + @glVertexWeightfvEXT := SDL_GL_GetProcAddress('glVertexWeightfvEXT'); + if not Assigned(glVertexWeightfvEXT) then Exit; + @glVertexWeightPointerEXT := SDL_GL_GetProcAddress('glVertexWeightPointerEXT'); + if not Assigned(glVertexWeightPointerEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_HP_occlusion_test: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_HP_occlusion_test', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_blend_square: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_blend_square', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_copy_depth_to_color: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_copy_depth_to_color', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_depth_clamp: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_depth_clamp', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_evaluators: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_evaluators', extstring) then + begin + @glMapControlPointsNV := SDL_GL_GetProcAddress('glMapControlPointsNV'); + if not Assigned(glMapControlPointsNV) then Exit; + @glMapParameterivNV := SDL_GL_GetProcAddress('glMapParameterivNV'); + if not Assigned(glMapParameterivNV) then Exit; + @glMapParameterfvNV := SDL_GL_GetProcAddress('glMapParameterfvNV'); + if not Assigned(glMapParameterfvNV) then Exit; + @glGetMapControlPointsNV := SDL_GL_GetProcAddress('glGetMapControlPointsNV'); + if not Assigned(glGetMapControlPointsNV) then Exit; + @glGetMapParameterivNV := SDL_GL_GetProcAddress('glGetMapParameterivNV'); + if not Assigned(glGetMapParameterivNV) then Exit; + @glGetMapParameterfvNV := SDL_GL_GetProcAddress('glGetMapParameterfvNV'); + if not Assigned(glGetMapParameterfvNV) then Exit; + @glGetMapAttribParameterivNV := SDL_GL_GetProcAddress('glGetMapAttribParameterivNV'); + if not Assigned(glGetMapAttribParameterivNV) then Exit; + @glGetMapAttribParameterfvNV := SDL_GL_GetProcAddress('glGetMapAttribParameterfvNV'); + if not Assigned(glGetMapAttribParameterfvNV) then Exit; + @glEvalMapsNV := SDL_GL_GetProcAddress('glEvalMapsNV'); + if not Assigned(glEvalMapsNV) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_fence: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_fence', extstring) then + begin + @glGenFencesNV := SDL_GL_GetProcAddress('glGenFencesNV'); + if not Assigned(glGenFencesNV) then Exit; + @glDeleteFencesNV := SDL_GL_GetProcAddress('glDeleteFencesNV'); + if not Assigned(glDeleteFencesNV) then Exit; + @glSetFenceNV := SDL_GL_GetProcAddress('glSetFenceNV'); + if not Assigned(glSetFenceNV) then Exit; + @glTestFenceNV := SDL_GL_GetProcAddress('glTestFenceNV'); + if not Assigned(glTestFenceNV) then Exit; + @glFinishFenceNV := SDL_GL_GetProcAddress('glFinishFenceNV'); + if not Assigned(glFinishFenceNV) then Exit; + @glIsFenceNV := SDL_GL_GetProcAddress('glIsFenceNV'); + if not Assigned(glIsFenceNV) then Exit; + @glGetFenceivNV := SDL_GL_GetProcAddress('glGetFenceivNV'); + if not Assigned(glGetFenceivNV) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_fog_distance: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_fog_distance', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_light_max_exponent: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_light_max_exponent', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_multisample_filter_hint: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_multisample_filter_hint', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_occlusion_query: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_occlusion_query', extstring) then + begin + @glGenOcclusionQueriesNV := SDL_GL_GetProcAddress('glGenOcclusionQueriesNV'); + if not Assigned(glGenOcclusionQueriesNV) then Exit; + @glDeleteOcclusionQueriesNV := SDL_GL_GetProcAddress('glDeleteOcclusionQueriesNV'); + if not Assigned(glDeleteOcclusionQueriesNV) then Exit; + @glIsOcclusionQueryNV := SDL_GL_GetProcAddress('glIsOcclusionQueryNV'); + if not Assigned(glIsOcclusionQueryNV) then Exit; + @glBeginOcclusionQueryNV := SDL_GL_GetProcAddress('glBeginOcclusionQueryNV'); + if not Assigned(glBeginOcclusionQueryNV) then Exit; + @glEndOcclusionQueryNV := SDL_GL_GetProcAddress('glEndOcclusionQueryNV'); + if not Assigned(glEndOcclusionQueryNV) then Exit; + @glGetOcclusionQueryivNV := SDL_GL_GetProcAddress('glGetOcclusionQueryivNV'); + if not Assigned(glGetOcclusionQueryivNV) then Exit; + @glGetOcclusionQueryuivNV := SDL_GL_GetProcAddress('glGetOcclusionQueryuivNV'); + if not Assigned(glGetOcclusionQueryuivNV) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_packed_depth_stencil: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_packed_depth_stencil', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_point_sprite: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_point_sprite', extstring) then + begin + @glPointParameteriNV := SDL_GL_GetProcAddress('glPointParameteriNV'); + if not Assigned(glPointParameteriNV) then Exit; + @glPointParameterivNV := SDL_GL_GetProcAddress('glPointParameterivNV'); + if not Assigned(glPointParameterivNV) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_register_combiners: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_register_combiners', extstring) then + begin + @glCombinerParameterfvNV := SDL_GL_GetProcAddress('glCombinerParameterfvNV'); + if not Assigned(glCombinerParameterfvNV) then Exit; + @glCombinerParameterivNV := SDL_GL_GetProcAddress('glCombinerParameterivNV'); + if not Assigned(glCombinerParameterivNV) then Exit; + @glCombinerParameterfNV := SDL_GL_GetProcAddress('glCombinerParameterfNV'); + if not Assigned(glCombinerParameterfNV) then Exit; + @glCombinerParameteriNV := SDL_GL_GetProcAddress('glCombinerParameteriNV'); + if not Assigned(glCombinerParameteriNV) then Exit; + @glCombinerInputNV := SDL_GL_GetProcAddress('glCombinerInputNV'); + if not Assigned(glCombinerInputNV) then Exit; + @glCombinerOutputNV := SDL_GL_GetProcAddress('glCombinerOutputNV'); + if not Assigned(glCombinerOutputNV) then Exit; + @glFinalCombinerInputNV := SDL_GL_GetProcAddress('glFinalCombinerInputNV'); + if not Assigned(glFinalCombinerInputNV) then Exit; + @glGetCombinerInputParameterfvNV := SDL_GL_GetProcAddress('glGetCombinerInputParameterfvNV'); + if not Assigned(glGetCombinerInputParameterfvNV) then Exit; + @glGetCombinerInputParameterivNV := SDL_GL_GetProcAddress('glGetCombinerInputParameterivNV'); + if not Assigned(glGetCombinerInputParameterivNV) then Exit; + @glGetCombinerOutputParameterfvNV := SDL_GL_GetProcAddress('glGetCombinerOutputParameterfvNV'); + if not Assigned(glGetCombinerOutputParameterfvNV) then Exit; + @glGetCombinerOutputParameterivNV := SDL_GL_GetProcAddress('glGetCombinerOutputParameterivNV'); + if not Assigned(glGetCombinerOutputParameterivNV) then Exit; + @glGetFinalCombinerInputParameterfvNV := SDL_GL_GetProcAddress('glGetFinalCombinerInputParameterfvNV'); + if not Assigned(glGetFinalCombinerInputParameterfvNV) then Exit; + @glGetFinalCombinerInputParameterivNV := SDL_GL_GetProcAddress('glGetFinalCombinerInputParameterivNV'); + if not Assigned(glGetFinalCombinerInputParameterivNV) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_register_combiners2: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_register_combiners2', extstring) then + begin + @glCombinerStageParameterfvNV := SDL_GL_GetProcAddress('glCombinerStageParameterfvNV'); + if not Assigned(glCombinerStageParameterfvNV) then Exit; + @glGetCombinerStageParameterfvNV := SDL_GL_GetProcAddress('glGetCombinerStageParameterfvNV'); + if not Assigned(glGetCombinerStageParameterfvNV) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_texgen_emboss: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_texgen_emboss', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_texgen_reflection: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_texgen_reflection', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_texture_compression_vtc: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_texture_compression_vtc', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_texture_env_combine4: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_texture_env_combine4', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_texture_rectangle: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_texture_rectangle', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_texture_shader: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_texture_shader', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_texture_shader2: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_texture_shader2', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_texture_shader3: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_texture_shader3', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_vertex_array_range: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_vertex_array_range', extstring) then + begin + @glVertexArrayRangeNV := SDL_GL_GetProcAddress('glVertexArrayRangeNV'); + if not Assigned(glVertexArrayRangeNV) then Exit; + @glFlushVertexArrayRangeNV := SDL_GL_GetProcAddress('glFlushVertexArrayRangeNV'); + if not Assigned(glFlushVertexArrayRangeNV) then Exit; + {$IFDEF WIN32} + @wglAllocateMemoryNV := SDL_GL_GetProcAddress('wglAllocateMemoryNV'); + if not Assigned(wglAllocateMemoryNV) then Exit; + @wglFreeMemoryNV := SDL_GL_GetProcAddress('wglFreeMemoryNV'); + if not Assigned(wglFreeMemoryNV) then Exit; + {$ENDIF} + Result := TRUE; + end; + +end; + +function Load_GL_NV_vertex_array_range2: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_vertex_array_range2', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_vertex_program: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_vertex_program', extstring) then + begin + @glBindProgramNV := SDL_GL_GetProcAddress('glBindProgramNV'); + if not Assigned(glBindProgramNV) then Exit; + @glDeleteProgramsNV := SDL_GL_GetProcAddress('glDeleteProgramsNV'); + if not Assigned(glDeleteProgramsNV) then Exit; + @glExecuteProgramNV := SDL_GL_GetProcAddress('glExecuteProgramNV'); + if not Assigned(glExecuteProgramNV) then Exit; + @glGenProgramsNV := SDL_GL_GetProcAddress('glGenProgramsNV'); + if not Assigned(glGenProgramsNV) then Exit; + @glAreProgramsResidentNV := SDL_GL_GetProcAddress('glAreProgramsResidentNV'); + if not Assigned(glAreProgramsResidentNV) then Exit; + @glRequestResidentProgramsNV := SDL_GL_GetProcAddress('glRequestResidentProgramsNV'); + if not Assigned(glRequestResidentProgramsNV) then Exit; + @glGetProgramParameterfvNV := SDL_GL_GetProcAddress('glGetProgramParameterfvNV'); + if not Assigned(glGetProgramParameterfvNV) then Exit; + @glGetProgramParameterdvNV := SDL_GL_GetProcAddress('glGetProgramParameterdvNV'); + if not Assigned(glGetProgramParameterdvNV) then Exit; + @glGetProgramivNV := SDL_GL_GetProcAddress('glGetProgramivNV'); + if not Assigned(glGetProgramivNV) then Exit; + @glGetProgramStringNV := SDL_GL_GetProcAddress('glGetProgramStringNV'); + if not Assigned(glGetProgramStringNV) then Exit; + @glGetTrackMatrixivNV := SDL_GL_GetProcAddress('glGetTrackMatrixivNV'); + if not Assigned(glGetTrackMatrixivNV) then Exit; + @glGetVertexAttribdvNV := SDL_GL_GetProcAddress('glGetVertexAttribdvNV'); + if not Assigned(glGetVertexAttribdvNV) then Exit; + @glGetVertexAttribfvNV := SDL_GL_GetProcAddress('glGetVertexAttribfvNV'); + if not Assigned(glGetVertexAttribfvNV) then Exit; + @glGetVertexAttribivNV := SDL_GL_GetProcAddress('glGetVertexAttribivNV'); + if not Assigned(glGetVertexAttribivNV) then Exit; + @glGetVertexAttribPointervNV := SDL_GL_GetProcAddress('glGetVertexAttribPointervNV'); + if not Assigned(glGetVertexAttribPointervNV) then Exit; + @glIsProgramNV := SDL_GL_GetProcAddress('glIsProgramNV'); + if not Assigned(glIsProgramNV) then Exit; + @glLoadProgramNV := SDL_GL_GetProcAddress('glLoadProgramNV'); + if not Assigned(glLoadProgramNV) then Exit; + @glProgramParameter4fNV := SDL_GL_GetProcAddress('glProgramParameter4fNV'); + if not Assigned(glProgramParameter4fNV) then Exit; + @glProgramParameter4fvNV := SDL_GL_GetProcAddress('glProgramParameter4fvNV'); + if not Assigned(glProgramParameter4fvNV) then Exit; + @glProgramParameters4dvNV := SDL_GL_GetProcAddress('glProgramParameters4dvNV'); + if not Assigned(glProgramParameters4dvNV) then Exit; + @glProgramParameters4fvNV := SDL_GL_GetProcAddress('glProgramParameters4fvNV'); + if not Assigned(glProgramParameters4fvNV) then Exit; + @glTrackMatrixNV := SDL_GL_GetProcAddress('glTrackMatrixNV'); + if not Assigned(glTrackMatrixNV) then Exit; + @glVertexAttribPointerNV := SDL_GL_GetProcAddress('glVertexAttribPointerNV'); + if not Assigned(glVertexAttribPointerNV) then Exit; + @glVertexAttrib1sNV := SDL_GL_GetProcAddress('glVertexAttrib1sNV'); + if not Assigned(glVertexAttrib1sNV) then Exit; + @glVertexAttrib1fNV := SDL_GL_GetProcAddress('glVertexAttrib1fNV'); + if not Assigned(glVertexAttrib1fNV) then Exit; + @glVertexAttrib1dNV := SDL_GL_GetProcAddress('glVertexAttrib1dNV'); + if not Assigned(glVertexAttrib1dNV) then Exit; + @glVertexAttrib2sNV := SDL_GL_GetProcAddress('glVertexAttrib2sNV'); + if not Assigned(glVertexAttrib2sNV) then Exit; + @glVertexAttrib2fNV := SDL_GL_GetProcAddress('glVertexAttrib2fNV'); + if not Assigned(glVertexAttrib2fNV) then Exit; + @glVertexAttrib2dNV := SDL_GL_GetProcAddress('glVertexAttrib2dNV'); + if not Assigned(glVertexAttrib2dNV) then Exit; + @glVertexAttrib3sNV := SDL_GL_GetProcAddress('glVertexAttrib3sNV'); + if not Assigned(glVertexAttrib3sNV) then Exit; + @glVertexAttrib3fNV := SDL_GL_GetProcAddress('glVertexAttrib3fNV'); + if not Assigned(glVertexAttrib3fNV) then Exit; + @glVertexAttrib3dNV := SDL_GL_GetProcAddress('glVertexAttrib3dNV'); + if not Assigned(glVertexAttrib3dNV) then Exit; + @glVertexAttrib4sNV := SDL_GL_GetProcAddress('glVertexAttrib4sNV'); + if not Assigned(glVertexAttrib4sNV) then Exit; + @glVertexAttrib4fNV := SDL_GL_GetProcAddress('glVertexAttrib4fNV'); + if not Assigned(glVertexAttrib4fNV) then Exit; + @glVertexAttrib4dNV := SDL_GL_GetProcAddress('glVertexAttrib4dNV'); + if not Assigned(glVertexAttrib4dNV) then Exit; + @glVertexAttrib4ubNV := SDL_GL_GetProcAddress('glVertexAttrib4ubNV'); + if not Assigned(glVertexAttrib4ubNV) then Exit; + @glVertexAttrib1svNV := SDL_GL_GetProcAddress('glVertexAttrib1svNV'); + if not Assigned(glVertexAttrib1svNV) then Exit; + @glVertexAttrib1fvNV := SDL_GL_GetProcAddress('glVertexAttrib1fvNV'); + if not Assigned(glVertexAttrib1fvNV) then Exit; + @glVertexAttrib1dvNV := SDL_GL_GetProcAddress('glVertexAttrib1dvNV'); + if not Assigned(glVertexAttrib1dvNV) then Exit; + @glVertexAttrib2svNV := SDL_GL_GetProcAddress('glVertexAttrib2svNV'); + if not Assigned(glVertexAttrib2svNV) then Exit; + @glVertexAttrib2fvNV := SDL_GL_GetProcAddress('glVertexAttrib2fvNV'); + if not Assigned(glVertexAttrib2fvNV) then Exit; + @glVertexAttrib2dvNV := SDL_GL_GetProcAddress('glVertexAttrib2dvNV'); + if not Assigned(glVertexAttrib2dvNV) then Exit; + @glVertexAttrib3svNV := SDL_GL_GetProcAddress('glVertexAttrib3svNV'); + if not Assigned(glVertexAttrib3svNV) then Exit; + @glVertexAttrib3fvNV := SDL_GL_GetProcAddress('glVertexAttrib3fvNV'); + if not Assigned(glVertexAttrib3fvNV) then Exit; + @glVertexAttrib3dvNV := SDL_GL_GetProcAddress('glVertexAttrib3dvNV'); + if not Assigned(glVertexAttrib3dvNV) then Exit; + @glVertexAttrib4svNV := SDL_GL_GetProcAddress('glVertexAttrib4svNV'); + if not Assigned(glVertexAttrib4svNV) then Exit; + @glVertexAttrib4fvNV := SDL_GL_GetProcAddress('glVertexAttrib4fvNV'); + if not Assigned(glVertexAttrib4fvNV) then Exit; + @glVertexAttrib4dvNV := SDL_GL_GetProcAddress('glVertexAttrib4dvNV'); + if not Assigned(glVertexAttrib4dvNV) then Exit; + @glVertexAttrib4ubvNV := SDL_GL_GetProcAddress('glVertexAttrib4ubvNV'); + if not Assigned(glVertexAttrib4ubvNV) then Exit; + @glVertexAttribs1svNV := SDL_GL_GetProcAddress('glVertexAttribs1svNV'); + if not Assigned(glVertexAttribs1svNV) then Exit; + @glVertexAttribs1fvNV := SDL_GL_GetProcAddress('glVertexAttribs1fvNV'); + if not Assigned(glVertexAttribs1fvNV) then Exit; + @glVertexAttribs1dvNV := SDL_GL_GetProcAddress('glVertexAttribs1dvNV'); + if not Assigned(glVertexAttribs1dvNV) then Exit; + @glVertexAttribs2svNV := SDL_GL_GetProcAddress('glVertexAttribs2svNV'); + if not Assigned(glVertexAttribs2svNV) then Exit; + @glVertexAttribs2fvNV := SDL_GL_GetProcAddress('glVertexAttribs2fvNV'); + if not Assigned(glVertexAttribs2fvNV) then Exit; + @glVertexAttribs2dvNV := SDL_GL_GetProcAddress('glVertexAttribs2dvNV'); + if not Assigned(glVertexAttribs2dvNV) then Exit; + @glVertexAttribs3svNV := SDL_GL_GetProcAddress('glVertexAttribs3svNV'); + if not Assigned(glVertexAttribs3svNV) then Exit; + @glVertexAttribs3fvNV := SDL_GL_GetProcAddress('glVertexAttribs3fvNV'); + if not Assigned(glVertexAttribs3fvNV) then Exit; + @glVertexAttribs3dvNV := SDL_GL_GetProcAddress('glVertexAttribs3dvNV'); + if not Assigned(glVertexAttribs3dvNV) then Exit; + @glVertexAttribs4svNV := SDL_GL_GetProcAddress('glVertexAttribs4svNV'); + if not Assigned(glVertexAttribs4svNV) then Exit; + @glVertexAttribs4fvNV := SDL_GL_GetProcAddress('glVertexAttribs4fvNV'); + if not Assigned(glVertexAttribs4fvNV) then Exit; + @glVertexAttribs4dvNV := SDL_GL_GetProcAddress('glVertexAttribs4dvNV'); + if not Assigned(glVertexAttribs4dvNV) then Exit; + @glVertexAttribs4ubvNV := SDL_GL_GetProcAddress('glVertexAttribs4ubvNV'); + if not Assigned(glVertexAttribs4ubvNV) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_vertex_program1_1: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_vertex_program1_1', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ATI_element_array: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_element_array', extstring) then + begin + @glElementPointerATI := SDL_GL_GetProcAddress('glElementPointerATI'); + if not Assigned(glElementPointerATI) then Exit; + @glDrawElementArrayATI := SDL_GL_GetProcAddress('glDrawElementArrayATI'); + if not Assigned(glDrawElementArrayATI) then Exit; + @glDrawRangeElementArrayATI := SDL_GL_GetProcAddress('glDrawRangeElementArrayATI'); + if not Assigned(glDrawRangeElementArrayATI) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ATI_envmap_bumpmap: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_envmap_bumpmap', extstring) then + begin + @glTexBumpParameterivATI := SDL_GL_GetProcAddress('glTexBumpParameterivATI'); + if not Assigned(glTexBumpParameterivATI) then Exit; + @glTexBumpParameterfvATI := SDL_GL_GetProcAddress('glTexBumpParameterfvATI'); + if not Assigned(glTexBumpParameterfvATI) then Exit; + @glGetTexBumpParameterivATI := SDL_GL_GetProcAddress('glGetTexBumpParameterivATI'); + if not Assigned(glGetTexBumpParameterivATI) then Exit; + @glGetTexBumpParameterfvATI := SDL_GL_GetProcAddress('glGetTexBumpParameterfvATI'); + if not Assigned(glGetTexBumpParameterfvATI) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ATI_fragment_shader: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_fragment_shader', extstring) then + begin + @glGenFragmentShadersATI := SDL_GL_GetProcAddress('glGenFragmentShadersATI'); + if not Assigned(glGenFragmentShadersATI) then Exit; + @glBindFragmentShaderATI := SDL_GL_GetProcAddress('glBindFragmentShaderATI'); + if not Assigned(glBindFragmentShaderATI) then Exit; + @glDeleteFragmentShaderATI := SDL_GL_GetProcAddress('glDeleteFragmentShaderATI'); + if not Assigned(glDeleteFragmentShaderATI) then Exit; + @glBeginFragmentShaderATI := SDL_GL_GetProcAddress('glBeginFragmentShaderATI'); + if not Assigned(glBeginFragmentShaderATI) then Exit; + @glEndFragmentShaderATI := SDL_GL_GetProcAddress('glEndFragmentShaderATI'); + if not Assigned(glEndFragmentShaderATI) then Exit; + @glPassTexCoordATI := SDL_GL_GetProcAddress('glPassTexCoordATI'); + if not Assigned(glPassTexCoordATI) then Exit; + @glSampleMapATI := SDL_GL_GetProcAddress('glSampleMapATI'); + if not Assigned(glSampleMapATI) then Exit; + @glColorFragmentOp1ATI := SDL_GL_GetProcAddress('glColorFragmentOp1ATI'); + if not Assigned(glColorFragmentOp1ATI) then Exit; + @glColorFragmentOp2ATI := SDL_GL_GetProcAddress('glColorFragmentOp2ATI'); + if not Assigned(glColorFragmentOp2ATI) then Exit; + @glColorFragmentOp3ATI := SDL_GL_GetProcAddress('glColorFragmentOp3ATI'); + if not Assigned(glColorFragmentOp3ATI) then Exit; + @glAlphaFragmentOp1ATI := SDL_GL_GetProcAddress('glAlphaFragmentOp1ATI'); + if not Assigned(glAlphaFragmentOp1ATI) then Exit; + @glAlphaFragmentOp2ATI := SDL_GL_GetProcAddress('glAlphaFragmentOp2ATI'); + if not Assigned(glAlphaFragmentOp2ATI) then Exit; + @glAlphaFragmentOp3ATI := SDL_GL_GetProcAddress('glAlphaFragmentOp3ATI'); + if not Assigned(glAlphaFragmentOp3ATI) then Exit; + @glSetFragmentShaderConstantATI := SDL_GL_GetProcAddress('glSetFragmentShaderConstantATI'); + if not Assigned(glSetFragmentShaderConstantATI) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ATI_pn_triangles: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_pn_triangles', extstring) then + begin + @glPNTrianglesiATI := SDL_GL_GetProcAddress('glPNTrianglesiATI'); + if not Assigned(glPNTrianglesiATI) then Exit; + @glPNTrianglesfATI := SDL_GL_GetProcAddress('glPNTrianglesfATI'); + if not Assigned(glPNTrianglesfATI) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ATI_texture_mirror_once: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_texture_mirror_once', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ATI_vertex_array_object: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_vertex_array_object', extstring) then + begin + @glNewObjectBufferATI := SDL_GL_GetProcAddress('glNewObjectBufferATI'); + if not Assigned(glNewObjectBufferATI) then Exit; + @glIsObjectBufferATI := SDL_GL_GetProcAddress('glIsObjectBufferATI'); + if not Assigned(glIsObjectBufferATI) then Exit; + @glUpdateObjectBufferATI := SDL_GL_GetProcAddress('glUpdateObjectBufferATI'); + if not Assigned(glUpdateObjectBufferATI) then Exit; + @glGetObjectBufferfvATI := SDL_GL_GetProcAddress('glGetObjectBufferfvATI'); + if not Assigned(glGetObjectBufferfvATI) then Exit; + @glGetObjectBufferivATI := SDL_GL_GetProcAddress('glGetObjectBufferivATI'); + if not Assigned(glGetObjectBufferivATI) then Exit; + @glDeleteObjectBufferATI := SDL_GL_GetProcAddress('glDeleteObjectBufferATI'); + if not Assigned(glDeleteObjectBufferATI) then Exit; + @glArrayObjectATI := SDL_GL_GetProcAddress('glArrayObjectATI'); + if not Assigned(glArrayObjectATI) then Exit; + @glGetArrayObjectfvATI := SDL_GL_GetProcAddress('glGetArrayObjectfvATI'); + if not Assigned(glGetArrayObjectfvATI) then Exit; + @glGetArrayObjectivATI := SDL_GL_GetProcAddress('glGetArrayObjectivATI'); + if not Assigned(glGetArrayObjectivATI) then Exit; + @glVariantArrayObjectATI := SDL_GL_GetProcAddress('glVariantArrayObjectATI'); + if not Assigned(glVariantArrayObjectATI) then Exit; + @glGetVariantArrayObjectfvATI := SDL_GL_GetProcAddress('glGetVariantArrayObjectfvATI'); + if not Assigned(glGetVariantArrayObjectfvATI) then Exit; + @glGetVariantArrayObjectivATI := SDL_GL_GetProcAddress('glGetVariantArrayObjectivATI'); + if not Assigned(glGetVariantArrayObjectivATI) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ATI_vertex_streams: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_vertex_streams', extstring) then + begin + @glVertexStream1s := SDL_GL_GetProcAddress('glVertexStream1s'); + if not Assigned(glVertexStream1s) then Exit; + @glVertexStream1i := SDL_GL_GetProcAddress('glVertexStream1i'); + if not Assigned(glVertexStream1i) then Exit; + @glVertexStream1f := SDL_GL_GetProcAddress('glVertexStream1f'); + if not Assigned(glVertexStream1f) then Exit; + @glVertexStream1d := SDL_GL_GetProcAddress('glVertexStream1d'); + if not Assigned(glVertexStream1d) then Exit; + @glVertexStream1sv := SDL_GL_GetProcAddress('glVertexStream1sv'); + if not Assigned(glVertexStream1sv) then Exit; + @glVertexStream1iv := SDL_GL_GetProcAddress('glVertexStream1iv'); + if not Assigned(glVertexStream1iv) then Exit; + @glVertexStream1fv := SDL_GL_GetProcAddress('glVertexStream1fv'); + if not Assigned(glVertexStream1fv) then Exit; + @glVertexStream1dv := SDL_GL_GetProcAddress('glVertexStream1dv'); + if not Assigned(glVertexStream1dv) then Exit; + @glVertexStream2s := SDL_GL_GetProcAddress('glVertexStream2s'); + if not Assigned(glVertexStream2s) then Exit; + @glVertexStream2i := SDL_GL_GetProcAddress('glVertexStream2i'); + if not Assigned(glVertexStream2i) then Exit; + @glVertexStream2f := SDL_GL_GetProcAddress('glVertexStream2f'); + if not Assigned(glVertexStream2f) then Exit; + @glVertexStream2d := SDL_GL_GetProcAddress('glVertexStream2d'); + if not Assigned(glVertexStream2d) then Exit; + @glVertexStream2sv := SDL_GL_GetProcAddress('glVertexStream2sv'); + if not Assigned(glVertexStream2sv) then Exit; + @glVertexStream2iv := SDL_GL_GetProcAddress('glVertexStream2iv'); + if not Assigned(glVertexStream2iv) then Exit; + @glVertexStream2fv := SDL_GL_GetProcAddress('glVertexStream2fv'); + if not Assigned(glVertexStream2fv) then Exit; + @glVertexStream2dv := SDL_GL_GetProcAddress('glVertexStream2dv'); + if not Assigned(glVertexStream2dv) then Exit; + @glVertexStream3s := SDL_GL_GetProcAddress('glVertexStream3s'); + if not Assigned(glVertexStream3s) then Exit; + @glVertexStream3i := SDL_GL_GetProcAddress('glVertexStream3i'); + if not Assigned(glVertexStream3i) then Exit; + @glVertexStream3f := SDL_GL_GetProcAddress('glVertexStream3f'); + if not Assigned(glVertexStream3f) then Exit; + @glVertexStream3d := SDL_GL_GetProcAddress('glVertexStream3d'); + if not Assigned(glVertexStream3d) then Exit; + @glVertexStream3sv := SDL_GL_GetProcAddress('glVertexStream3sv'); + if not Assigned(glVertexStream3sv) then Exit; + @glVertexStream3iv := SDL_GL_GetProcAddress('glVertexStream3iv'); + if not Assigned(glVertexStream3iv) then Exit; + @glVertexStream3fv := SDL_GL_GetProcAddress('glVertexStream3fv'); + if not Assigned(glVertexStream3fv) then Exit; + @glVertexStream3dv := SDL_GL_GetProcAddress('glVertexStream3dv'); + if not Assigned(glVertexStream3dv) then Exit; + @glVertexStream4s := SDL_GL_GetProcAddress('glVertexStream4s'); + if not Assigned(glVertexStream4s) then Exit; + @glVertexStream4i := SDL_GL_GetProcAddress('glVertexStream4i'); + if not Assigned(glVertexStream4i) then Exit; + @glVertexStream4f := SDL_GL_GetProcAddress('glVertexStream4f'); + if not Assigned(glVertexStream4f) then Exit; + @glVertexStream4d := SDL_GL_GetProcAddress('glVertexStream4d'); + if not Assigned(glVertexStream4d) then Exit; + @glVertexStream4sv := SDL_GL_GetProcAddress('glVertexStream4sv'); + if not Assigned(glVertexStream4sv) then Exit; + @glVertexStream4iv := SDL_GL_GetProcAddress('glVertexStream4iv'); + if not Assigned(glVertexStream4iv) then Exit; + @glVertexStream4fv := SDL_GL_GetProcAddress('glVertexStream4fv'); + if not Assigned(glVertexStream4fv) then Exit; + @glVertexStream4dv := SDL_GL_GetProcAddress('glVertexStream4dv'); + if not Assigned(glVertexStream4dv) then Exit; + @glNormalStream3b := SDL_GL_GetProcAddress('glNormalStream3b'); + if not Assigned(glNormalStream3b) then Exit; + @glNormalStream3s := SDL_GL_GetProcAddress('glNormalStream3s'); + if not Assigned(glNormalStream3s) then Exit; + @glNormalStream3i := SDL_GL_GetProcAddress('glNormalStream3i'); + if not Assigned(glNormalStream3i) then Exit; + @glNormalStream3f := SDL_GL_GetProcAddress('glNormalStream3f'); + if not Assigned(glNormalStream3f) then Exit; + @glNormalStream3d := SDL_GL_GetProcAddress('glNormalStream3d'); + if not Assigned(glNormalStream3d) then Exit; + @glNormalStream3bv := SDL_GL_GetProcAddress('glNormalStream3bv'); + if not Assigned(glNormalStream3bv) then Exit; + @glNormalStream3sv := SDL_GL_GetProcAddress('glNormalStream3sv'); + if not Assigned(glNormalStream3sv) then Exit; + @glNormalStream3iv := SDL_GL_GetProcAddress('glNormalStream3iv'); + if not Assigned(glNormalStream3iv) then Exit; + @glNormalStream3fv := SDL_GL_GetProcAddress('glNormalStream3fv'); + if not Assigned(glNormalStream3fv) then Exit; + @glNormalStream3dv := SDL_GL_GetProcAddress('glNormalStream3dv'); + if not Assigned(glNormalStream3dv) then Exit; + @glClientActiveVertexStream := SDL_GL_GetProcAddress('glClientActiveVertexStream'); + if not Assigned(glClientActiveVertexStream) then Exit; + @glVertexBlendEnvi := SDL_GL_GetProcAddress('glVertexBlendEnvi'); + if not Assigned(glVertexBlendEnvi) then Exit; + @glVertexBlendEnvf := SDL_GL_GetProcAddress('glVertexBlendEnvf'); + if not Assigned(glVertexBlendEnvf) then Exit; + Result := TRUE; + end; + +end; + +{$IFDEF WIN32} +function Load_WGL_I3D_image_buffer: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_I3D_image_buffer', extstring) then + begin + @wglCreateImageBufferI3D := SDL_GL_GetProcAddress('wglCreateImageBufferI3D'); + if not Assigned(wglCreateImageBufferI3D) then Exit; + @wglDestroyImageBufferI3D := SDL_GL_GetProcAddress('wglDestroyImageBufferI3D'); + if not Assigned(wglDestroyImageBufferI3D) then Exit; + @wglAssociateImageBufferEventsI3D := SDL_GL_GetProcAddress('wglAssociateImageBufferEventsI3D'); + if not Assigned(wglAssociateImageBufferEventsI3D) then Exit; + @wglReleaseImageBufferEventsI3D := SDL_GL_GetProcAddress('wglReleaseImageBufferEventsI3D'); + if not Assigned(wglReleaseImageBufferEventsI3D) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_I3D_swap_frame_lock: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_I3D_swap_frame_lock', extstring) then + begin + @wglEnableFrameLockI3D := SDL_GL_GetProcAddress('wglEnableFrameLockI3D'); + if not Assigned(wglEnableFrameLockI3D) then Exit; + @wglDisableFrameLockI3D := SDL_GL_GetProcAddress('wglDisableFrameLockI3D'); + if not Assigned(wglDisableFrameLockI3D) then Exit; + @wglIsEnabledFrameLockI3D := SDL_GL_GetProcAddress('wglIsEnabledFrameLockI3D'); + if not Assigned(wglIsEnabledFrameLockI3D) then Exit; + @wglQueryFrameLockMasterI3D := SDL_GL_GetProcAddress('wglQueryFrameLockMasterI3D'); + if not Assigned(wglQueryFrameLockMasterI3D) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_I3D_swap_frame_usage: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_I3D_swap_frame_usage', extstring) then + begin + @wglGetFrameUsageI3D := SDL_GL_GetProcAddress('wglGetFrameUsageI3D'); + if not Assigned(wglGetFrameUsageI3D) then Exit; + @wglBeginFrameTrackingI3D := SDL_GL_GetProcAddress('wglBeginFrameTrackingI3D'); + if not Assigned(wglBeginFrameTrackingI3D) then Exit; + @wglEndFrameTrackingI3D := SDL_GL_GetProcAddress('wglEndFrameTrackingI3D'); + if not Assigned(wglEndFrameTrackingI3D) then Exit; + @wglQueryFrameTrackingI3D := SDL_GL_GetProcAddress('wglQueryFrameTrackingI3D'); + if not Assigned(wglQueryFrameTrackingI3D) then Exit; + Result := TRUE; + end; + +end; +{$ENDIF} + +function Load_GL_3DFX_texture_compression_FXT1: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_3DFX_texture_compression_FXT1', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_IBM_cull_vertex: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_IBM_cull_vertex', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_IBM_multimode_draw_arrays: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_IBM_multimode_draw_arrays', extstring) then + begin + @glMultiModeDrawArraysIBM := SDL_GL_GetProcAddress('glMultiModeDrawArraysIBM'); + if not Assigned(glMultiModeDrawArraysIBM) then Exit; + @glMultiModeDrawElementsIBM := SDL_GL_GetProcAddress('glMultiModeDrawElementsIBM'); + if not Assigned(glMultiModeDrawElementsIBM) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_IBM_raster_pos_clip: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_IBM_raster_pos_clip', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_IBM_texture_mirrored_repeat: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_IBM_texture_mirrored_repeat', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_IBM_vertex_array_lists: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_IBM_vertex_array_lists', extstring) then + begin + @glColorPointerListIBM := SDL_GL_GetProcAddress('glColorPointerListIBM'); + if not Assigned(glColorPointerListIBM) then Exit; + @glSecondaryColorPointerListIBM := SDL_GL_GetProcAddress('glSecondaryColorPointerListIBM'); + if not Assigned(glSecondaryColorPointerListIBM) then Exit; + @glEdgeFlagPointerListIBM := SDL_GL_GetProcAddress('glEdgeFlagPointerListIBM'); + if not Assigned(glEdgeFlagPointerListIBM) then Exit; + @glFogCoordPointerListIBM := SDL_GL_GetProcAddress('glFogCoordPointerListIBM'); + if not Assigned(glFogCoordPointerListIBM) then Exit; + @glNormalPointerListIBM := SDL_GL_GetProcAddress('glNormalPointerListIBM'); + if not Assigned(glNormalPointerListIBM) then Exit; + @glTexCoordPointerListIBM := SDL_GL_GetProcAddress('glTexCoordPointerListIBM'); + if not Assigned(glTexCoordPointerListIBM) then Exit; + @glVertexPointerListIBM := SDL_GL_GetProcAddress('glVertexPointerListIBM'); + if not Assigned(glVertexPointerListIBM) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_MESA_resize_buffers: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_MESA_resize_buffers', extstring) then + begin + @glResizeBuffersMESA := SDL_GL_GetProcAddress('glResizeBuffersMESA'); + if not Assigned(glResizeBuffersMESA) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_MESA_window_pos: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_MESA_window_pos', extstring) then + begin + @glWindowPos2dMESA := SDL_GL_GetProcAddress('glWindowPos2dMESA'); + if not Assigned(glWindowPos2dMESA) then Exit; + @glWindowPos2fMESA := SDL_GL_GetProcAddress('glWindowPos2fMESA'); + if not Assigned(glWindowPos2fMESA) then Exit; + @glWindowPos2iMESA := SDL_GL_GetProcAddress('glWindowPos2iMESA'); + if not Assigned(glWindowPos2iMESA) then Exit; + @glWindowPos2sMESA := SDL_GL_GetProcAddress('glWindowPos2sMESA'); + if not Assigned(glWindowPos2sMESA) then Exit; + @glWindowPos2ivMESA := SDL_GL_GetProcAddress('glWindowPos2ivMESA'); + if not Assigned(glWindowPos2ivMESA) then Exit; + @glWindowPos2svMESA := SDL_GL_GetProcAddress('glWindowPos2svMESA'); + if not Assigned(glWindowPos2svMESA) then Exit; + @glWindowPos2fvMESA := SDL_GL_GetProcAddress('glWindowPos2fvMESA'); + if not Assigned(glWindowPos2fvMESA) then Exit; + @glWindowPos2dvMESA := SDL_GL_GetProcAddress('glWindowPos2dvMESA'); + if not Assigned(glWindowPos2dvMESA) then Exit; + @glWindowPos3iMESA := SDL_GL_GetProcAddress('glWindowPos3iMESA'); + if not Assigned(glWindowPos3iMESA) then Exit; + @glWindowPos3sMESA := SDL_GL_GetProcAddress('glWindowPos3sMESA'); + if not Assigned(glWindowPos3sMESA) then Exit; + @glWindowPos3fMESA := SDL_GL_GetProcAddress('glWindowPos3fMESA'); + if not Assigned(glWindowPos3fMESA) then Exit; + @glWindowPos3dMESA := SDL_GL_GetProcAddress('glWindowPos3dMESA'); + if not Assigned(glWindowPos3dMESA) then Exit; + @glWindowPos3ivMESA := SDL_GL_GetProcAddress('glWindowPos3ivMESA'); + if not Assigned(glWindowPos3ivMESA) then Exit; + @glWindowPos3svMESA := SDL_GL_GetProcAddress('glWindowPos3svMESA'); + if not Assigned(glWindowPos3svMESA) then Exit; + @glWindowPos3fvMESA := SDL_GL_GetProcAddress('glWindowPos3fvMESA'); + if not Assigned(glWindowPos3fvMESA) then Exit; + @glWindowPos3dvMESA := SDL_GL_GetProcAddress('glWindowPos3dvMESA'); + if not Assigned(glWindowPos3dvMESA) then Exit; + @glWindowPos4iMESA := SDL_GL_GetProcAddress('glWindowPos4iMESA'); + if not Assigned(glWindowPos4iMESA) then Exit; + @glWindowPos4sMESA := SDL_GL_GetProcAddress('glWindowPos4sMESA'); + if not Assigned(glWindowPos4sMESA) then Exit; + @glWindowPos4fMESA := SDL_GL_GetProcAddress('glWindowPos4fMESA'); + if not Assigned(glWindowPos4fMESA) then Exit; + @glWindowPos4dMESA := SDL_GL_GetProcAddress('glWindowPos4dMESA'); + if not Assigned(glWindowPos4dMESA) then Exit; + @glWindowPos4ivMESA := SDL_GL_GetProcAddress('glWindowPos4ivMESA'); + if not Assigned(glWindowPos4ivMESA) then Exit; + @glWindowPos4svMESA := SDL_GL_GetProcAddress('glWindowPos4svMESA'); + if not Assigned(glWindowPos4svMESA) then Exit; + @glWindowPos4fvMESA := SDL_GL_GetProcAddress('glWindowPos4fvMESA'); + if not Assigned(glWindowPos4fvMESA) then Exit; + @glWindowPos4dvMESA := SDL_GL_GetProcAddress('glWindowPos4dvMESA'); + if not Assigned(glWindowPos4dvMESA) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_OML_interlace: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_OML_interlace', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_OML_resample: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_OML_resample', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_OML_subsample: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_OML_subsample', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_SGIS_generate_mipmap: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGIS_generate_mipmap', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_SGIS_multisample: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGIS_multisample', extstring) then + begin + @glSampleMaskSGIS := SDL_GL_GetProcAddress('glSampleMaskSGIS'); + if not Assigned(glSampleMaskSGIS) then Exit; + @glSamplePatternSGIS := SDL_GL_GetProcAddress('glSamplePatternSGIS'); + if not Assigned(glSamplePatternSGIS) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_SGIS_pixel_texture: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGIS_pixel_texture', extstring) then + begin + @glPixelTexGenParameteriSGIS := SDL_GL_GetProcAddress('glPixelTexGenParameteriSGIS'); + if not Assigned(glPixelTexGenParameteriSGIS) then Exit; + @glPixelTexGenParameterfSGIS := SDL_GL_GetProcAddress('glPixelTexGenParameterfSGIS'); + if not Assigned(glPixelTexGenParameterfSGIS) then Exit; + @glGetPixelTexGenParameterivSGIS := SDL_GL_GetProcAddress('glGetPixelTexGenParameterivSGIS'); + if not Assigned(glGetPixelTexGenParameterivSGIS) then Exit; + @glGetPixelTexGenParameterfvSGIS := SDL_GL_GetProcAddress('glGetPixelTexGenParameterfvSGIS'); + if not Assigned(glGetPixelTexGenParameterfvSGIS) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_SGIS_texture_border_clamp: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGIS_texture_border_clamp', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_SGIS_texture_color_mask: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGIS_texture_color_mask', extstring) then + begin + @glTextureColorMaskSGIS := SDL_GL_GetProcAddress('glTextureColorMaskSGIS'); + if not Assigned(glTextureColorMaskSGIS) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_SGIS_texture_edge_clamp: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGIS_texture_edge_clamp', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_SGIS_texture_lod: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGIS_texture_lod', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_SGIS_depth_texture: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGIS_depth_texture', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_SGIX_fog_offset: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGIX_fog_offset', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_SGIX_interlace: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGIX_interlace', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_SGIX_shadow_ambient: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGIX_shadow_ambient', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_SGI_color_matrix: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGI_color_matrix', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_SGI_color_table: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGI_color_table', extstring) then + begin + @glColorTableSGI := SDL_GL_GetProcAddress('glColorTableSGI'); + if not Assigned(glColorTableSGI) then Exit; + @glCopyColorTableSGI := SDL_GL_GetProcAddress('glCopyColorTableSGI'); + if not Assigned(glCopyColorTableSGI) then Exit; + @glColorTableParameterivSGI := SDL_GL_GetProcAddress('glColorTableParameterivSGI'); + if not Assigned(glColorTableParameterivSGI) then Exit; + @glColorTableParameterfvSGI := SDL_GL_GetProcAddress('glColorTableParameterfvSGI'); + if not Assigned(glColorTableParameterfvSGI) then Exit; + @glGetColorTableSGI := SDL_GL_GetProcAddress('glGetColorTableSGI'); + if not Assigned(glGetColorTableSGI) then Exit; + @glGetColorTableParameterivSGI := SDL_GL_GetProcAddress('glGetColorTableParameterivSGI'); + if not Assigned(glGetColorTableParameterivSGI) then Exit; + @glGetColorTableParameterfvSGI := SDL_GL_GetProcAddress('glGetColorTableParameterfvSGI'); + if not Assigned(glGetColorTableParameterfvSGI) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_SGI_texture_color_table: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SGI_texture_color_table', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_SUN_vertex: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_SUN_vertex', extstring) then + begin + @glColor4ubVertex2fSUN := SDL_GL_GetProcAddress('glColor4ubVertex2fSUN'); + if not Assigned(glColor4ubVertex2fSUN) then Exit; + @glColor4ubVertex2fvSUN := SDL_GL_GetProcAddress('glColor4ubVertex2fvSUN'); + if not Assigned(glColor4ubVertex2fvSUN) then Exit; + @glColor4ubVertex3fSUN := SDL_GL_GetProcAddress('glColor4ubVertex3fSUN'); + if not Assigned(glColor4ubVertex3fSUN) then Exit; + @glColor4ubVertex3fvSUN := SDL_GL_GetProcAddress('glColor4ubVertex3fvSUN'); + if not Assigned(glColor4ubVertex3fvSUN) then Exit; + @glColor3fVertex3fSUN := SDL_GL_GetProcAddress('glColor3fVertex3fSUN'); + if not Assigned(glColor3fVertex3fSUN) then Exit; + @glColor3fVertex3fvSUN := SDL_GL_GetProcAddress('glColor3fVertex3fvSUN'); + if not Assigned(glColor3fVertex3fvSUN) then Exit; + @glNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glNormal3fVertex3fSUN'); + if not Assigned(glNormal3fVertex3fSUN) then Exit; + @glNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glNormal3fVertex3fvSUN'); + if not Assigned(glNormal3fVertex3fvSUN) then Exit; + @glColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glColor4fNormal3fVertex3fSUN'); + if not Assigned(glColor4fNormal3fVertex3fSUN) then Exit; + @glColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glColor4fNormal3fVertex3fvSUN'); + if not Assigned(glColor4fNormal3fVertex3fvSUN) then Exit; + @glTexCoord2fVertex3fSUN := SDL_GL_GetProcAddress('glTexCoord2fVertex3fSUN'); + if not Assigned(glTexCoord2fVertex3fSUN) then Exit; + @glTexCoord2fVertex3fvSUN := SDL_GL_GetProcAddress('glTexCoord2fVertex3fvSUN'); + if not Assigned(glTexCoord2fVertex3fvSUN) then Exit; + @glTexCoord4fVertex4fSUN := SDL_GL_GetProcAddress('glTexCoord4fVertex4fSUN'); + if not Assigned(glTexCoord4fVertex4fSUN) then Exit; + @glTexCoord4fVertex4fvSUN := SDL_GL_GetProcAddress('glTexCoord4fVertex4fvSUN'); + if not Assigned(glTexCoord4fVertex4fvSUN) then Exit; + @glTexCoord2fColor4ubVertex3fSUN := SDL_GL_GetProcAddress('glTexCoord2fColor4ubVertex3fSUN'); + if not Assigned(glTexCoord2fColor4ubVertex3fSUN) then Exit; + @glTexCoord2fColor4ubVertex3fvSUN := SDL_GL_GetProcAddress('glTexCoord2fColor4ubVertex3fvSUN'); + if not Assigned(glTexCoord2fColor4ubVertex3fvSUN) then Exit; + @glTexCoord2fColor3fVertex3fSUN := SDL_GL_GetProcAddress('glTexCoord2fColor3fVertex3fSUN'); + if not Assigned(glTexCoord2fColor3fVertex3fSUN) then Exit; + @glTexCoord2fColor3fVertex3fvSUN := SDL_GL_GetProcAddress('glTexCoord2fColor3fVertex3fvSUN'); + if not Assigned(glTexCoord2fColor3fVertex3fvSUN) then Exit; + @glTexCoord2fNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glTexCoord2fNormal3fVertex3fSUN'); + if not Assigned(glTexCoord2fNormal3fVertex3fSUN) then Exit; + @glTexCoord2fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glTexCoord2fNormal3fVertex3fvSUN'); + if not Assigned(glTexCoord2fNormal3fVertex3fvSUN) then Exit; + @glTexCoord2fColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glTexCoord2fColor4fNormal3fVertex3fSUN'); + if not Assigned(glTexCoord2fColor4fNormal3fVertex3fSUN) then Exit; + @glTexCoord2fColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glTexCoord2fColor4fNormal3fVertex3fvSUN'); + if not Assigned(glTexCoord2fColor4fNormal3fVertex3fvSUN) then Exit; + @glTexCoord4fColor4fNormal3fVertex4fSUN := SDL_GL_GetProcAddress('glTexCoord4fColor4fNormal3fVertex4fSUN'); + if not Assigned(glTexCoord4fColor4fNormal3fVertex4fSUN) then Exit; + @glTexCoord4fColor4fNormal3fVertex4fvSUN := SDL_GL_GetProcAddress('glTexCoord4fColor4fNormal3fVertex4fvSUN'); + if not Assigned(glTexCoord4fColor4fNormal3fVertex4fvSUN) then Exit; + @glReplacementCodeuiVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiVertex3fSUN'); + if not Assigned(glReplacementCodeuiVertex3fSUN) then Exit; + @glReplacementCodeuiVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiVertex3fvSUN'); + if not Assigned(glReplacementCodeuiVertex3fvSUN) then Exit; + @glReplacementCodeuiColor4ubVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiColor4ubVertex3fSUN'); + if not Assigned(glReplacementCodeuiColor4ubVertex3fSUN) then Exit; + @glReplacementCodeuiColor4ubVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiColor4ubVertex3fvSUN'); + if not Assigned(glReplacementCodeuiColor4ubVertex3fvSUN) then Exit; + @glReplacementCodeuiColor3fVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiColor3fVertex3fSUN'); + if not Assigned(glReplacementCodeuiColor3fVertex3fSUN) then Exit; + @glReplacementCodeuiColor3fVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiColor3fVertex3fvSUN'); + if not Assigned(glReplacementCodeuiColor3fVertex3fvSUN) then Exit; + @glReplacementCodeuiNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiNormal3fVertex3fSUN'); + if not Assigned(glReplacementCodeuiNormal3fVertex3fSUN) then Exit; + @glReplacementCodeuiNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiNormal3fVertex3fvSUN'); + if not Assigned(glReplacementCodeuiNormal3fVertex3fvSUN) then Exit; + @glReplacementCodeuiColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiColor4fNormal3fVertex3fSUN'); + if not Assigned(glReplacementCodeuiColor4fNormal3fVertex3fSUN) then Exit; + @glReplacementCodeuiColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiColor4fNormal3fVertex3fvSUN'); + if not Assigned(glReplacementCodeuiColor4fNormal3fVertex3fvSUN) then Exit; + @glReplacementCodeuiTexCoord2fVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiTexCoord2fVertex3fSUN'); + if not Assigned(glReplacementCodeuiTexCoord2fVertex3fSUN) then Exit; + @glReplacementCodeuiTexCoord2fVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiTexCoord2fVertex3fvSUN'); + if not Assigned(glReplacementCodeuiTexCoord2fVertex3fvSUN) then Exit; + @glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN'); + if not Assigned(glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN) then Exit; + @glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN'); + if not Assigned(glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN) then Exit; + @glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN'); + if not Assigned(glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN) then Exit; + @glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN'); + if not Assigned(glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_fragment_program: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_fragment_program', extstring) then + begin + @glProgramStringARB := SDL_GL_GetProcAddress('glProgramStringARB'); + if not Assigned(glProgramStringARB) then Exit; + @glBindProgramARB := SDL_GL_GetProcAddress('glBindProgramARB'); + if not Assigned(glBindProgramARB) then Exit; + @glDeleteProgramsARB := SDL_GL_GetProcAddress('glDeleteProgramsARB'); + if not Assigned(glDeleteProgramsARB) then Exit; + @glGenProgramsARB := SDL_GL_GetProcAddress('glGenProgramsARB'); + if not Assigned(glGenProgramsARB) then Exit; + @glProgramEnvParameter4dARB := SDL_GL_GetProcAddress('glProgramEnvParameter4dARB'); + if not Assigned(glProgramEnvParameter4dARB) then Exit; + @glProgramEnvParameter4dvARB := SDL_GL_GetProcAddress('glProgramEnvParameter4dvARB'); + if not Assigned(glProgramEnvParameter4dvARB) then Exit; + @glProgramEnvParameter4fARB := SDL_GL_GetProcAddress('glProgramEnvParameter4fARB'); + if not Assigned(glProgramEnvParameter4fARB) then Exit; + @glProgramEnvParameter4fvARB := SDL_GL_GetProcAddress('glProgramEnvParameter4fvARB'); + if not Assigned(glProgramEnvParameter4fvARB) then Exit; + @glProgramLocalParameter4dARB := SDL_GL_GetProcAddress('glProgramLocalParameter4dARB'); + if not Assigned(glProgramLocalParameter4dARB) then Exit; + @glProgramLocalParameter4dvARB := SDL_GL_GetProcAddress('glProgramLocalParameter4dvARB'); + if not Assigned(glProgramLocalParameter4dvARB) then Exit; + @glProgramLocalParameter4fARB := SDL_GL_GetProcAddress('glProgramLocalParameter4fARB'); + if not Assigned(glProgramLocalParameter4fARB) then Exit; + @glProgramLocalParameter4fvARB := SDL_GL_GetProcAddress('glProgramLocalParameter4fvARB'); + if not Assigned(glProgramLocalParameter4fvARB) then Exit; + @glGetProgramEnvParameterdvARB := SDL_GL_GetProcAddress('glGetProgramEnvParameterdvARB'); + if not Assigned(glGetProgramEnvParameterdvARB) then Exit; + @glGetProgramEnvParameterfvARB := SDL_GL_GetProcAddress('glGetProgramEnvParameterfvARB'); + if not Assigned(glGetProgramEnvParameterfvARB) then Exit; + @glGetProgramLocalParameterdvARB := SDL_GL_GetProcAddress('glGetProgramLocalParameterdvARB'); + if not Assigned(glGetProgramLocalParameterdvARB) then Exit; + @glGetProgramLocalParameterfvARB := SDL_GL_GetProcAddress('glGetProgramLocalParameterfvARB'); + if not Assigned(glGetProgramLocalParameterfvARB) then Exit; + @glGetProgramivARB := SDL_GL_GetProcAddress('glGetProgramivARB'); + if not Assigned(glGetProgramivARB) then Exit; + @glGetProgramStringARB := SDL_GL_GetProcAddress('glGetProgramStringARB'); + if not Assigned(glGetProgramStringARB) then Exit; + @glIsProgramARB := SDL_GL_GetProcAddress('glIsProgramARB'); + if not Assigned(glIsProgramARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ATI_text_fragment_shader: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_text_fragment_shader', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_APPLE_client_storage: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_APPLE_client_storage', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_APPLE_element_array: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_APPLE_element_array', extstring) then + begin + @glElementPointerAPPLE := SDL_GL_GetProcAddress('glElementPointerAPPLE'); + if not Assigned(glElementPointerAPPLE) then Exit; + @glDrawElementArrayAPPLE := SDL_GL_GetProcAddress('glDrawElementArrayAPPLE'); + if not Assigned(glDrawElementArrayAPPLE) then Exit; + @glDrawRangeElementArrayAPPLE := SDL_GL_GetProcAddress('glDrawRangeElementArrayAPPLE'); + if not Assigned(glDrawRangeElementArrayAPPLE) then Exit; + @glMultiDrawElementArrayAPPLE := SDL_GL_GetProcAddress('glMultiDrawElementArrayAPPLE'); + if not Assigned(glMultiDrawElementArrayAPPLE) then Exit; + @glMultiDrawRangeElementArrayAPPLE := SDL_GL_GetProcAddress('glMultiDrawRangeElementArrayAPPLE'); + if not Assigned(glMultiDrawRangeElementArrayAPPLE) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_APPLE_fence: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_APPLE_fence', extstring) then + begin + @glGenFencesAPPLE := SDL_GL_GetProcAddress('glGenFencesAPPLE'); + if not Assigned(glGenFencesAPPLE) then Exit; + @glDeleteFencesAPPLE := SDL_GL_GetProcAddress('glDeleteFencesAPPLE'); + if not Assigned(glDeleteFencesAPPLE) then Exit; + @glSetFenceAPPLE := SDL_GL_GetProcAddress('glSetFenceAPPLE'); + if not Assigned(glSetFenceAPPLE) then Exit; + @glIsFenceAPPLE := SDL_GL_GetProcAddress('glIsFenceAPPLE'); + if not Assigned(glIsFenceAPPLE) then Exit; + @glTestFenceAPPLE := SDL_GL_GetProcAddress('glTestFenceAPPLE'); + if not Assigned(glTestFenceAPPLE) then Exit; + @glFinishFenceAPPLE := SDL_GL_GetProcAddress('glFinishFenceAPPLE'); + if not Assigned(glFinishFenceAPPLE) then Exit; + @glTestObjectAPPLE := SDL_GL_GetProcAddress('glTestObjectAPPLE'); + if not Assigned(glTestObjectAPPLE) then Exit; + @glFinishObjectAPPLE := SDL_GL_GetProcAddress('glFinishObjectAPPLE'); + if not Assigned(glFinishObjectAPPLE) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_APPLE_vertex_array_object: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_APPLE_vertex_array_object', extstring) then + begin + @glBindVertexArrayAPPLE := SDL_GL_GetProcAddress('glBindVertexArrayAPPLE'); + if not Assigned(glBindVertexArrayAPPLE) then Exit; + @glDeleteVertexArraysAPPLE := SDL_GL_GetProcAddress('glDeleteVertexArraysAPPLE'); + if not Assigned(glDeleteVertexArraysAPPLE) then Exit; + @glGenVertexArraysAPPLE := SDL_GL_GetProcAddress('glGenVertexArraysAPPLE'); + if not Assigned(glGenVertexArraysAPPLE) then Exit; + @glIsVertexArrayAPPLE := SDL_GL_GetProcAddress('glIsVertexArrayAPPLE'); + if not Assigned(glIsVertexArrayAPPLE) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_APPLE_vertex_array_range: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_APPLE_vertex_array_range', extstring) then + begin + @glVertexArrayRangeAPPLE := SDL_GL_GetProcAddress('glVertexArrayRangeAPPLE'); + if not Assigned(glVertexArrayRangeAPPLE) then Exit; + @glFlushVertexArrayRangeAPPLE := SDL_GL_GetProcAddress('glFlushVertexArrayRangeAPPLE'); + if not Assigned(glFlushVertexArrayRangeAPPLE) then Exit; + @glVertexArrayParameteriAPPLE := SDL_GL_GetProcAddress('glVertexArrayParameteriAPPLE'); + if not Assigned(glVertexArrayParameteriAPPLE) then Exit; + Result := TRUE; + end; + +end; + +{$IFDEF WIN32} +function Load_WGL_ARB_pixel_format: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_ARB_pixel_format', extstring) then + begin + @wglGetPixelFormatAttribivARB := SDL_GL_GetProcAddress('wglGetPixelFormatAttribivARB'); + if not Assigned(wglGetPixelFormatAttribivARB) then Exit; + @wglGetPixelFormatAttribfvARB := SDL_GL_GetProcAddress('wglGetPixelFormatAttribfvARB'); + if not Assigned(wglGetPixelFormatAttribfvARB) then Exit; + @wglChoosePixelFormatARB := SDL_GL_GetProcAddress('wglChoosePixelFormatARB'); + if not Assigned(wglChoosePixelFormatARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_ARB_make_current_read: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_ARB_make_current_read', extstring) then + begin + @wglMakeContextCurrentARB := SDL_GL_GetProcAddress('wglMakeContextCurrentARB'); + if not Assigned(wglMakeContextCurrentARB) then Exit; + @wglGetCurrentReadDCARB := SDL_GL_GetProcAddress('wglGetCurrentReadDCARB'); + if not Assigned(wglGetCurrentReadDCARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_ARB_pbuffer: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_ARB_pbuffer', extstring) then + begin + @wglCreatePbufferARB := SDL_GL_GetProcAddress('wglCreatePbufferARB'); + if not Assigned(wglCreatePbufferARB) then Exit; + @wglGetPbufferDCARB := SDL_GL_GetProcAddress('wglGetPbufferDCARB'); + if not Assigned(wglGetPbufferDCARB) then Exit; + @wglReleasePbufferDCARB := SDL_GL_GetProcAddress('wglReleasePbufferDCARB'); + if not Assigned(wglReleasePbufferDCARB) then Exit; + @wglDestroyPbufferARB := SDL_GL_GetProcAddress('wglDestroyPbufferARB'); + if not Assigned(wglDestroyPbufferARB) then Exit; + @wglQueryPbufferARB := SDL_GL_GetProcAddress('wglQueryPbufferARB'); + if not Assigned(wglQueryPbufferARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_EXT_swap_control: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_EXT_swap_control', extstring) then + begin + @wglSwapIntervalEXT := SDL_GL_GetProcAddress('wglSwapIntervalEXT'); + if not Assigned(wglSwapIntervalEXT) then Exit; + @wglGetSwapIntervalEXT := SDL_GL_GetProcAddress('wglGetSwapIntervalEXT'); + if not Assigned(wglGetSwapIntervalEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_ARB_render_texture: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_ARB_render_texture', extstring) then + begin + @wglBindTexImageARB := SDL_GL_GetProcAddress('wglBindTexImageARB'); + if not Assigned(wglBindTexImageARB) then Exit; + @wglReleaseTexImageARB := SDL_GL_GetProcAddress('wglReleaseTexImageARB'); + if not Assigned(wglReleaseTexImageARB) then Exit; + @wglSetPbufferAttribARB := SDL_GL_GetProcAddress('wglSetPbufferAttribARB'); + if not Assigned(wglSetPbufferAttribARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_EXT_extensions_string: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_EXT_extensions_string', extstring) then + begin + @wglGetExtensionsStringEXT := SDL_GL_GetProcAddress('wglGetExtensionsStringEXT'); + if not Assigned(wglGetExtensionsStringEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_EXT_make_current_read: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_EXT_make_current_read', extstring) then + begin + @wglMakeContextCurrentEXT := SDL_GL_GetProcAddress('wglMakeContextCurrentEXT'); + if not Assigned(wglMakeContextCurrentEXT) then Exit; + @wglGetCurrentReadDCEXT := SDL_GL_GetProcAddress('wglGetCurrentReadDCEXT'); + if not Assigned(wglGetCurrentReadDCEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_EXT_pbuffer: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_EXT_pbuffer', extstring) then + begin + @wglCreatePbufferEXT := SDL_GL_GetProcAddress('wglCreatePbufferEXT'); + if not Assigned(wglCreatePbufferEXT) then Exit; + @wglGetPbufferDCEXT := SDL_GL_GetProcAddress('wglGetPbufferDCEXT'); + if not Assigned(wglGetPbufferDCEXT) then Exit; + @wglReleasePbufferDCEXT := SDL_GL_GetProcAddress('wglReleasePbufferDCEXT'); + if not Assigned(wglReleasePbufferDCEXT) then Exit; + @wglDestroyPbufferEXT := SDL_GL_GetProcAddress('wglDestroyPbufferEXT'); + if not Assigned(wglDestroyPbufferEXT) then Exit; + @wglQueryPbufferEXT := SDL_GL_GetProcAddress('wglQueryPbufferEXT'); + if not Assigned(wglQueryPbufferEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_EXT_pixel_format: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_EXT_pixel_format', extstring) then + begin + @wglGetPixelFormatAttribivEXT := SDL_GL_GetProcAddress('wglGetPixelFormatAttribivEXT'); + if not Assigned(wglGetPixelFormatAttribivEXT) then Exit; + @wglGetPixelFormatAttribfvEXT := SDL_GL_GetProcAddress('wglGetPixelFormatAttribfvEXT'); + if not Assigned(wglGetPixelFormatAttribfvEXT) then Exit; + @wglChoosePixelFormatEXT := SDL_GL_GetProcAddress('wglChoosePixelFormatEXT'); + if not Assigned(wglChoosePixelFormatEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_I3D_digital_video_control: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_I3D_digital_video_control', extstring) then + begin + @wglGetDigitalVideoParametersI3D := SDL_GL_GetProcAddress('wglGetDigitalVideoParametersI3D'); + if not Assigned(wglGetDigitalVideoParametersI3D) then Exit; + @wglSetDigitalVideoParametersI3D := SDL_GL_GetProcAddress('wglSetDigitalVideoParametersI3D'); + if not Assigned(wglSetDigitalVideoParametersI3D) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_I3D_gamma: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_I3D_gamma', extstring) then + begin + @wglGetGammaTableParametersI3D := SDL_GL_GetProcAddress('wglGetGammaTableParametersI3D'); + if not Assigned(wglGetGammaTableParametersI3D) then Exit; + @wglSetGammaTableParametersI3D := SDL_GL_GetProcAddress('wglSetGammaTableParametersI3D'); + if not Assigned(wglSetGammaTableParametersI3D) then Exit; + @wglGetGammaTableI3D := SDL_GL_GetProcAddress('wglGetGammaTableI3D'); + if not Assigned(wglGetGammaTableI3D) then Exit; + @wglSetGammaTableI3D := SDL_GL_GetProcAddress('wglSetGammaTableI3D'); + if not Assigned(wglSetGammaTableI3D) then Exit; + Result := TRUE; + end; + +end; + +function Load_WGL_I3D_genlock: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_I3D_genlock', extstring) then + begin + @wglEnableGenlockI3D := SDL_GL_GetProcAddress('wglEnableGenlockI3D'); + if not Assigned(wglEnableGenlockI3D) then Exit; + @wglDisableGenlockI3D := SDL_GL_GetProcAddress('wglDisableGenlockI3D'); + if not Assigned(wglDisableGenlockI3D) then Exit; + @wglIsEnabledGenlockI3D := SDL_GL_GetProcAddress('wglIsEnabledGenlockI3D'); + if not Assigned(wglIsEnabledGenlockI3D) then Exit; + @wglGenlockSourceI3D := SDL_GL_GetProcAddress('wglGenlockSourceI3D'); + if not Assigned(wglGenlockSourceI3D) then Exit; + @wglGetGenlockSourceI3D := SDL_GL_GetProcAddress('wglGetGenlockSourceI3D'); + if not Assigned(wglGetGenlockSourceI3D) then Exit; + @wglGenlockSourceEdgeI3D := SDL_GL_GetProcAddress('wglGenlockSourceEdgeI3D'); + if not Assigned(wglGenlockSourceEdgeI3D) then Exit; + @wglGetGenlockSourceEdgeI3D := SDL_GL_GetProcAddress('wglGetGenlockSourceEdgeI3D'); + if not Assigned(wglGetGenlockSourceEdgeI3D) then Exit; + @wglGenlockSampleRateI3D := SDL_GL_GetProcAddress('wglGenlockSampleRateI3D'); + if not Assigned(wglGenlockSampleRateI3D) then Exit; + @wglGetGenlockSampleRateI3D := SDL_GL_GetProcAddress('wglGetGenlockSampleRateI3D'); + if not Assigned(wglGetGenlockSampleRateI3D) then Exit; + @wglGenlockSourceDelayI3D := SDL_GL_GetProcAddress('wglGenlockSourceDelayI3D'); + if not Assigned(wglGenlockSourceDelayI3D) then Exit; + @wglGetGenlockSourceDelayI3D := SDL_GL_GetProcAddress('wglGetGenlockSourceDelayI3D'); + if not Assigned(wglGetGenlockSourceDelayI3D) then Exit; + @wglQueryGenlockMaxSourceDelayI3D := SDL_GL_GetProcAddress('wglQueryGenlockMaxSourceDelayI3D'); + if not Assigned(wglQueryGenlockMaxSourceDelayI3D) then Exit; + Result := TRUE; + end; + +end; +{$ENDIF} + +function Load_GL_ARB_matrix_palette: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_matrix_palette', extstring) then + begin + @glCurrentPaletteMatrixARB := SDL_GL_GetProcAddress('glCurrentPaletteMatrixARB'); + if not Assigned(glCurrentPaletteMatrixARB) then Exit; + @glMatrixIndexubvARB := SDL_GL_GetProcAddress('glMatrixIndexubvARB'); + if not Assigned(glMatrixIndexubvARB) then Exit; + @glMatrixIndexusvARB := SDL_GL_GetProcAddress('glMatrixIndexusvARB'); + if not Assigned(glMatrixIndexusvARB) then Exit; + @glMatrixIndexuivARB := SDL_GL_GetProcAddress('glMatrixIndexuivARB'); + if not Assigned(glMatrixIndexuivARB) then Exit; + @glMatrixIndexPointerARB := SDL_GL_GetProcAddress('glMatrixIndexPointerARB'); + if not Assigned(glMatrixIndexPointerARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_element_array: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_element_array', extstring) then + begin + @glElementPointerNV := SDL_GL_GetProcAddress('glElementPointerNV'); + if not Assigned(glElementPointerNV) then Exit; + @glDrawElementArrayNV := SDL_GL_GetProcAddress('glDrawElementArrayNV'); + if not Assigned(glDrawElementArrayNV) then Exit; + @glDrawRangeElementArrayNV := SDL_GL_GetProcAddress('glDrawRangeElementArrayNV'); + if not Assigned(glDrawRangeElementArrayNV) then Exit; + @glMultiDrawElementArrayNV := SDL_GL_GetProcAddress('glMultiDrawElementArrayNV'); + if not Assigned(glMultiDrawElementArrayNV) then Exit; + @glMultiDrawRangeElementArrayNV := SDL_GL_GetProcAddress('glMultiDrawRangeElementArrayNV'); + if not Assigned(glMultiDrawRangeElementArrayNV) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_float_buffer: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_float_buffer', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_fragment_program: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_fragment_program', extstring) then + begin + @glProgramNamedParameter4fNV := SDL_GL_GetProcAddress('glProgramNamedParameter4fNV'); + if not Assigned(glProgramNamedParameter4fNV) then Exit; + @glProgramNamedParameter4dNV := SDL_GL_GetProcAddress('glProgramNamedParameter4dNV'); + if not Assigned(glProgramNamedParameter4dNV) then Exit; + @glGetProgramNamedParameterfvNV := SDL_GL_GetProcAddress('glGetProgramNamedParameterfvNV'); + if not Assigned(glGetProgramNamedParameterfvNV) then Exit; + @glGetProgramNamedParameterdvNV := SDL_GL_GetProcAddress('glGetProgramNamedParameterdvNV'); + if not Assigned(glGetProgramNamedParameterdvNV) then Exit; + @glProgramLocalParameter4dARB := SDL_GL_GetProcAddress('glProgramLocalParameter4dARB'); + if not Assigned(glProgramLocalParameter4dARB) then Exit; + @glProgramLocalParameter4dvARB := SDL_GL_GetProcAddress('glProgramLocalParameter4dvARB'); + if not Assigned(glProgramLocalParameter4dvARB) then Exit; + @glProgramLocalParameter4fARB := SDL_GL_GetProcAddress('glProgramLocalParameter4fARB'); + if not Assigned(glProgramLocalParameter4fARB) then Exit; + @glProgramLocalParameter4fvARB := SDL_GL_GetProcAddress('glProgramLocalParameter4fvARB'); + if not Assigned(glProgramLocalParameter4fvARB) then Exit; + @glGetProgramLocalParameterdvARB := SDL_GL_GetProcAddress('glGetProgramLocalParameterdvARB'); + if not Assigned(glGetProgramLocalParameterdvARB) then Exit; + @glGetProgramLocalParameterfvARB := SDL_GL_GetProcAddress('glGetProgramLocalParameterfvARB'); + if not Assigned(glGetProgramLocalParameterfvARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_primitive_restart: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_primitive_restart', extstring) then + begin + @glPrimitiveRestartNV := SDL_GL_GetProcAddress('glPrimitiveRestartNV'); + if not Assigned(glPrimitiveRestartNV) then Exit; + @glPrimitiveRestartIndexNV := SDL_GL_GetProcAddress('glPrimitiveRestartIndexNV'); + if not Assigned(glPrimitiveRestartIndexNV) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_vertex_program2: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_vertex_program2', extstring) then + begin + Result := TRUE; + end; + +end; + +{$IFDEF WIN32} +function Load_WGL_NV_render_texture_rectangle: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_NV_render_texture_rectangle', extstring) then + begin + Result := TRUE; + end; + +end; +{$ENDIF} + +function Load_GL_NV_pixel_data_range: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_pixel_data_range', extstring) then + begin + @glPixelDataRangeNV := SDL_GL_GetProcAddress('glPixelDataRangeNV'); + if not Assigned(glPixelDataRangeNV) then Exit; + @glFlushPixelDataRangeNV := SDL_GL_GetProcAddress('glFlushPixelDataRangeNV'); + if not Assigned(glFlushPixelDataRangeNV) then Exit; + {$IFDEF WIN32} + @wglAllocateMemoryNV := SDL_GL_GetProcAddress('wglAllocateMemoryNV'); + if not Assigned(wglAllocateMemoryNV) then Exit; + @wglFreeMemoryNV := SDL_GL_GetProcAddress('wglFreeMemoryNV'); + if not Assigned(wglFreeMemoryNV) then Exit; + {$ENDIF} + Result := TRUE; + end; + +end; + +function Load_GL_EXT_texture_rectangle: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_texture_rectangle', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_S3_s3tc: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_S3_s3tc', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ATI_draw_buffers: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_draw_buffers', extstring) then + begin + @glDrawBuffersATI := SDL_GL_GetProcAddress('glDrawBuffersATI'); + if not Assigned(glDrawBuffersATI) then Exit; + Result := TRUE; + end; + +end; + +{$IFDEF WIN32} +function Load_WGL_ATI_pixel_format_float: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); + if not Assigned(wglGetExtensionsStringARB) then Exit; + extstring := wglGetExtensionsStringARB(wglGetCurrentDC); + + if glext_ExtensionSupported('WGL_ATI_pixel_format_float', extstring) then + begin + Result := TRUE; + end; + +end; +{$ENDIF} + +function Load_GL_ATI_texture_env_combine3: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_texture_env_combine3', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ATI_texture_float: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_texture_float', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_texture_expand_normal: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_texture_expand_normal', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_half_float: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_half_float', extstring) then + begin + @glVertex2hNV := SDL_GL_GetProcAddress('glVertex2hNV'); + if not Assigned(glVertex2hNV) then Exit; + @glVertex2hvNV := SDL_GL_GetProcAddress('glVertex2hvNV'); + if not Assigned(glVertex2hvNV) then Exit; + @glVertex3hNV := SDL_GL_GetProcAddress('glVertex3hNV'); + if not Assigned(glVertex3hNV) then Exit; + @glVertex3hvNV := SDL_GL_GetProcAddress('glVertex3hvNV'); + if not Assigned(glVertex3hvNV) then Exit; + @glVertex4hNV := SDL_GL_GetProcAddress('glVertex4hNV'); + if not Assigned(glVertex4hNV) then Exit; + @glVertex4hvNV := SDL_GL_GetProcAddress('glVertex4hvNV'); + if not Assigned(glVertex4hvNV) then Exit; + @glNormal3hNV := SDL_GL_GetProcAddress('glNormal3hNV'); + if not Assigned(glNormal3hNV) then Exit; + @glNormal3hvNV := SDL_GL_GetProcAddress('glNormal3hvNV'); + if not Assigned(glNormal3hvNV) then Exit; + @glColor3hNV := SDL_GL_GetProcAddress('glColor3hNV'); + if not Assigned(glColor3hNV) then Exit; + @glColor3hvNV := SDL_GL_GetProcAddress('glColor3hvNV'); + if not Assigned(glColor3hvNV) then Exit; + @glColor4hNV := SDL_GL_GetProcAddress('glColor4hNV'); + if not Assigned(glColor4hNV) then Exit; + @glColor4hvNV := SDL_GL_GetProcAddress('glColor4hvNV'); + if not Assigned(glColor4hvNV) then Exit; + @glTexCoord1hNV := SDL_GL_GetProcAddress('glTexCoord1hNV'); + if not Assigned(glTexCoord1hNV) then Exit; + @glTexCoord1hvNV := SDL_GL_GetProcAddress('glTexCoord1hvNV'); + if not Assigned(glTexCoord1hvNV) then Exit; + @glTexCoord2hNV := SDL_GL_GetProcAddress('glTexCoord2hNV'); + if not Assigned(glTexCoord2hNV) then Exit; + @glTexCoord2hvNV := SDL_GL_GetProcAddress('glTexCoord2hvNV'); + if not Assigned(glTexCoord2hvNV) then Exit; + @glTexCoord3hNV := SDL_GL_GetProcAddress('glTexCoord3hNV'); + if not Assigned(glTexCoord3hNV) then Exit; + @glTexCoord3hvNV := SDL_GL_GetProcAddress('glTexCoord3hvNV'); + if not Assigned(glTexCoord3hvNV) then Exit; + @glTexCoord4hNV := SDL_GL_GetProcAddress('glTexCoord4hNV'); + if not Assigned(glTexCoord4hNV) then Exit; + @glTexCoord4hvNV := SDL_GL_GetProcAddress('glTexCoord4hvNV'); + if not Assigned(glTexCoord4hvNV) then Exit; + @glMultiTexCoord1hNV := SDL_GL_GetProcAddress('glMultiTexCoord1hNV'); + if not Assigned(glMultiTexCoord1hNV) then Exit; + @glMultiTexCoord1hvNV := SDL_GL_GetProcAddress('glMultiTexCoord1hvNV'); + if not Assigned(glMultiTexCoord1hvNV) then Exit; + @glMultiTexCoord2hNV := SDL_GL_GetProcAddress('glMultiTexCoord2hNV'); + if not Assigned(glMultiTexCoord2hNV) then Exit; + @glMultiTexCoord2hvNV := SDL_GL_GetProcAddress('glMultiTexCoord2hvNV'); + if not Assigned(glMultiTexCoord2hvNV) then Exit; + @glMultiTexCoord3hNV := SDL_GL_GetProcAddress('glMultiTexCoord3hNV'); + if not Assigned(glMultiTexCoord3hNV) then Exit; + @glMultiTexCoord3hvNV := SDL_GL_GetProcAddress('glMultiTexCoord3hvNV'); + if not Assigned(glMultiTexCoord3hvNV) then Exit; + @glMultiTexCoord4hNV := SDL_GL_GetProcAddress('glMultiTexCoord4hNV'); + if not Assigned(glMultiTexCoord4hNV) then Exit; + @glMultiTexCoord4hvNV := SDL_GL_GetProcAddress('glMultiTexCoord4hvNV'); + if not Assigned(glMultiTexCoord4hvNV) then Exit; + @glFogCoordhNV := SDL_GL_GetProcAddress('glFogCoordhNV'); + if not Assigned(glFogCoordhNV) then Exit; + @glFogCoordhvNV := SDL_GL_GetProcAddress('glFogCoordhvNV'); + if not Assigned(glFogCoordhvNV) then Exit; + @glSecondaryColor3hNV := SDL_GL_GetProcAddress('glSecondaryColor3hNV'); + if not Assigned(glSecondaryColor3hNV) then Exit; + @glSecondaryColor3hvNV := SDL_GL_GetProcAddress('glSecondaryColor3hvNV'); + if not Assigned(glSecondaryColor3hvNV) then Exit; + @glVertexWeighthNV := SDL_GL_GetProcAddress('glVertexWeighthNV'); + if not Assigned(glVertexWeighthNV) then Exit; + @glVertexWeighthvNV := SDL_GL_GetProcAddress('glVertexWeighthvNV'); + if not Assigned(glVertexWeighthvNV) then Exit; + @glVertexAttrib1hNV := SDL_GL_GetProcAddress('glVertexAttrib1hNV'); + if not Assigned(glVertexAttrib1hNV) then Exit; + @glVertexAttrib1hvNV := SDL_GL_GetProcAddress('glVertexAttrib1hvNV'); + if not Assigned(glVertexAttrib1hvNV) then Exit; + @glVertexAttrib2hNV := SDL_GL_GetProcAddress('glVertexAttrib2hNV'); + if not Assigned(glVertexAttrib2hNV) then Exit; + @glVertexAttrib2hvNV := SDL_GL_GetProcAddress('glVertexAttrib2hvNV'); + if not Assigned(glVertexAttrib2hvNV) then Exit; + @glVertexAttrib3hNV := SDL_GL_GetProcAddress('glVertexAttrib3hNV'); + if not Assigned(glVertexAttrib3hNV) then Exit; + @glVertexAttrib3hvNV := SDL_GL_GetProcAddress('glVertexAttrib3hvNV'); + if not Assigned(glVertexAttrib3hvNV) then Exit; + @glVertexAttrib4hNV := SDL_GL_GetProcAddress('glVertexAttrib4hNV'); + if not Assigned(glVertexAttrib4hNV) then Exit; + @glVertexAttrib4hvNV := SDL_GL_GetProcAddress('glVertexAttrib4hvNV'); + if not Assigned(glVertexAttrib4hvNV) then Exit; + @glVertexAttribs1hvNV := SDL_GL_GetProcAddress('glVertexAttribs1hvNV'); + if not Assigned(glVertexAttribs1hvNV) then Exit; + @glVertexAttribs2hvNV := SDL_GL_GetProcAddress('glVertexAttribs2hvNV'); + if not Assigned(glVertexAttribs2hvNV) then Exit; + @glVertexAttribs3hvNV := SDL_GL_GetProcAddress('glVertexAttribs3hvNV'); + if not Assigned(glVertexAttribs3hvNV) then Exit; + @glVertexAttribs4hvNV := SDL_GL_GetProcAddress('glVertexAttribs4hvNV'); + if not Assigned(glVertexAttribs4hvNV) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ATI_map_object_buffer: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_map_object_buffer', extstring) then + begin + @glMapObjectBufferATI := SDL_GL_GetProcAddress('glMapObjectBufferATI'); + if not Assigned(glMapObjectBufferATI) then Exit; + @glUnmapObjectBufferATI := SDL_GL_GetProcAddress('glUnmapObjectBufferATI'); + if not Assigned(glUnmapObjectBufferATI) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ATI_separate_stencil: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_separate_stencil', extstring) then + begin + @glStencilOpSeparateATI := SDL_GL_GetProcAddress('glStencilOpSeparateATI'); + if not Assigned(glStencilOpSeparateATI) then Exit; + @glStencilFuncSeparateATI := SDL_GL_GetProcAddress('glStencilFuncSeparateATI'); + if not Assigned(glStencilFuncSeparateATI) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ATI_vertex_attrib_array_object: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ATI_vertex_attrib_array_object', extstring) then + begin + @glVertexAttribArrayObjectATI := SDL_GL_GetProcAddress('glVertexAttribArrayObjectATI'); + if not Assigned(glVertexAttribArrayObjectATI) then Exit; + @glGetVertexAttribArrayObjectfvATI := SDL_GL_GetProcAddress('glGetVertexAttribArrayObjectfvATI'); + if not Assigned(glGetVertexAttribArrayObjectfvATI) then Exit; + @glGetVertexAttribArrayObjectivATI := SDL_GL_GetProcAddress('glGetVertexAttribArrayObjectivATI'); + if not Assigned(glGetVertexAttribArrayObjectivATI) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_vertex_buffer_object: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_vertex_buffer_object', extstring) then + begin + @glBindBufferARB := SDL_GL_GetProcAddress('glBindBufferARB'); + if not Assigned(glBindBufferARB) then Exit; + @glDeleteBuffersARB := SDL_GL_GetProcAddress('glDeleteBuffersARB'); + if not Assigned(glDeleteBuffersARB) then Exit; + @glGenBuffersARB := SDL_GL_GetProcAddress('glGenBuffersARB'); + if not Assigned(glGenBuffersARB) then Exit; + @glIsBufferARB := SDL_GL_GetProcAddress('glIsBufferARB'); + if not Assigned(glIsBufferARB) then Exit; + @glBufferDataARB := SDL_GL_GetProcAddress('glBufferDataARB'); + if not Assigned(glBufferDataARB) then Exit; + @glBufferSubDataARB := SDL_GL_GetProcAddress('glBufferSubDataARB'); + if not Assigned(glBufferSubDataARB) then Exit; + @glGetBufferSubDataARB := SDL_GL_GetProcAddress('glGetBufferSubDataARB'); + if not Assigned(glGetBufferSubDataARB) then Exit; + @glMapBufferARB := SDL_GL_GetProcAddress('glMapBufferARB'); + if not Assigned(glMapBufferARB) then Exit; + @glUnmapBufferARB := SDL_GL_GetProcAddress('glUnmapBufferARB'); + if not Assigned(glUnmapBufferARB) then Exit; + @glGetBufferParameterivARB := SDL_GL_GetProcAddress('glGetBufferParameterivARB'); + if not Assigned(glGetBufferParameterivARB) then Exit; + @glGetBufferPointervARB := SDL_GL_GetProcAddress('glGetBufferPointervARB'); + if not Assigned(glGetBufferPointervARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_occlusion_query: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_occlusion_query', extstring) then + begin + @glGenQueriesARB := SDL_GL_GetProcAddress('glGenQueriesARB'); + if not Assigned(glGenQueriesARB) then Exit; + @glDeleteQueriesARB := SDL_GL_GetProcAddress('glDeleteQueriesARB'); + if not Assigned(glDeleteQueriesARB) then Exit; + @glIsQueryARB := SDL_GL_GetProcAddress('glIsQueryARB'); + if not Assigned(glIsQueryARB) then Exit; + @glBeginQueryARB := SDL_GL_GetProcAddress('glBeginQueryARB'); + if not Assigned(glBeginQueryARB) then Exit; + @glEndQueryARB := SDL_GL_GetProcAddress('glEndQueryARB'); + if not Assigned(glEndQueryARB) then Exit; + @glGetQueryivARB := SDL_GL_GetProcAddress('glGetQueryivARB'); + if not Assigned(glGetQueryivARB) then Exit; + @glGetQueryObjectivARB := SDL_GL_GetProcAddress('glGetQueryObjectivARB'); + if not Assigned(glGetQueryObjectivARB) then Exit; + @glGetQueryObjectuivARB := SDL_GL_GetProcAddress('glGetQueryObjectuivARB'); + if not Assigned(glGetQueryObjectuivARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_shader_objects: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_shader_objects', extstring) then + begin + @glDeleteObjectARB := SDL_GL_GetProcAddress('glDeleteObjectARB'); + if not Assigned(glDeleteObjectARB) then Exit; + @glGetHandleARB := SDL_GL_GetProcAddress('glGetHandleARB'); + if not Assigned(glGetHandleARB) then Exit; + @glDetachObjectARB := SDL_GL_GetProcAddress('glDetachObjectARB'); + if not Assigned(glDetachObjectARB) then Exit; + @glCreateShaderObjectARB := SDL_GL_GetProcAddress('glCreateShaderObjectARB'); + if not Assigned(glCreateShaderObjectARB) then Exit; + @glShaderSourceARB := SDL_GL_GetProcAddress('glShaderSourceARB'); + if not Assigned(glShaderSourceARB) then Exit; + @glCompileShaderARB := SDL_GL_GetProcAddress('glCompileShaderARB'); + if not Assigned(glCompileShaderARB) then Exit; + @glCreateProgramObjectARB := SDL_GL_GetProcAddress('glCreateProgramObjectARB'); + if not Assigned(glCreateProgramObjectARB) then Exit; + @glAttachObjectARB := SDL_GL_GetProcAddress('glAttachObjectARB'); + if not Assigned(glAttachObjectARB) then Exit; + @glLinkProgramARB := SDL_GL_GetProcAddress('glLinkProgramARB'); + if not Assigned(glLinkProgramARB) then Exit; + @glUseProgramObjectARB := SDL_GL_GetProcAddress('glUseProgramObjectARB'); + if not Assigned(glUseProgramObjectARB) then Exit; + @glValidateProgramARB := SDL_GL_GetProcAddress('glValidateProgramARB'); + if not Assigned(glValidateProgramARB) then Exit; + @glUniform1fARB := SDL_GL_GetProcAddress('glUniform1fARB'); + if not Assigned(glUniform1fARB) then Exit; + @glUniform2fARB := SDL_GL_GetProcAddress('glUniform2fARB'); + if not Assigned(glUniform2fARB) then Exit; + @glUniform3fARB := SDL_GL_GetProcAddress('glUniform3fARB'); + if not Assigned(glUniform3fARB) then Exit; + @glUniform4fARB := SDL_GL_GetProcAddress('glUniform4fARB'); + if not Assigned(glUniform4fARB) then Exit; + @glUniform1iARB := SDL_GL_GetProcAddress('glUniform1iARB'); + if not Assigned(glUniform1iARB) then Exit; + @glUniform2iARB := SDL_GL_GetProcAddress('glUniform2iARB'); + if not Assigned(glUniform2iARB) then Exit; + @glUniform3iARB := SDL_GL_GetProcAddress('glUniform3iARB'); + if not Assigned(glUniform3iARB) then Exit; + @glUniform4iARB := SDL_GL_GetProcAddress('glUniform4iARB'); + if not Assigned(glUniform4iARB) then Exit; + @glUniform1fvARB := SDL_GL_GetProcAddress('glUniform1fvARB'); + if not Assigned(glUniform1fvARB) then Exit; + @glUniform2fvARB := SDL_GL_GetProcAddress('glUniform2fvARB'); + if not Assigned(glUniform2fvARB) then Exit; + @glUniform3fvARB := SDL_GL_GetProcAddress('glUniform3fvARB'); + if not Assigned(glUniform3fvARB) then Exit; + @glUniform4fvARB := SDL_GL_GetProcAddress('glUniform4fvARB'); + if not Assigned(glUniform4fvARB) then Exit; + @glUniform1ivARB := SDL_GL_GetProcAddress('glUniform1ivARB'); + if not Assigned(glUniform1ivARB) then Exit; + @glUniform2ivARB := SDL_GL_GetProcAddress('glUniform2ivARB'); + if not Assigned(glUniform2ivARB) then Exit; + @glUniform3ivARB := SDL_GL_GetProcAddress('glUniform3ivARB'); + if not Assigned(glUniform3ivARB) then Exit; + @glUniform4ivARB := SDL_GL_GetProcAddress('glUniform4ivARB'); + if not Assigned(glUniform4ivARB) then Exit; + @glUniformMatrix2fvARB := SDL_GL_GetProcAddress('glUniformMatrix2fvARB'); + if not Assigned(glUniformMatrix2fvARB) then Exit; + @glUniformMatrix3fvARB := SDL_GL_GetProcAddress('glUniformMatrix3fvARB'); + if not Assigned(glUniformMatrix3fvARB) then Exit; + @glUniformMatrix4fvARB := SDL_GL_GetProcAddress('glUniformMatrix4fvARB'); + if not Assigned(glUniformMatrix4fvARB) then Exit; + @glGetObjectParameterfvARB := SDL_GL_GetProcAddress('glGetObjectParameterfvARB'); + if not Assigned(glGetObjectParameterfvARB) then Exit; + @glGetObjectParameterivARB := SDL_GL_GetProcAddress('glGetObjectParameterivARB'); + if not Assigned(glGetObjectParameterivARB) then Exit; + @glGetInfoLogARB := SDL_GL_GetProcAddress('glGetInfoLogARB'); + if not Assigned(glGetInfoLogARB) then Exit; + @glGetAttachedObjectsARB := SDL_GL_GetProcAddress('glGetAttachedObjectsARB'); + if not Assigned(glGetAttachedObjectsARB) then Exit; + @glGetUniformLocationARB := SDL_GL_GetProcAddress('glGetUniformLocationARB'); + if not Assigned(glGetUniformLocationARB) then Exit; + @glGetActiveUniformARB := SDL_GL_GetProcAddress('glGetActiveUniformARB'); + if not Assigned(glGetActiveUniformARB) then Exit; + @glGetUniformfvARB := SDL_GL_GetProcAddress('glGetUniformfvARB'); + if not Assigned(glGetUniformfvARB) then Exit; + @glGetUniformivARB := SDL_GL_GetProcAddress('glGetUniformivARB'); + if not Assigned(glGetUniformivARB) then Exit; + @glGetShaderSourceARB := SDL_GL_GetProcAddress('glGetShaderSourceARB'); + if not Assigned(glGetShaderSourceARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_vertex_shader: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_vertex_shader', extstring) then + begin + @glVertexAttrib1fARB := SDL_GL_GetProcAddress('glVertexAttrib1fARB'); + if not Assigned(glVertexAttrib1fARB) then Exit; + @glVertexAttrib1sARB := SDL_GL_GetProcAddress('glVertexAttrib1sARB'); + if not Assigned(glVertexAttrib1sARB) then Exit; + @glVertexAttrib1dARB := SDL_GL_GetProcAddress('glVertexAttrib1dARB'); + if not Assigned(glVertexAttrib1dARB) then Exit; + @glVertexAttrib2fARB := SDL_GL_GetProcAddress('glVertexAttrib2fARB'); + if not Assigned(glVertexAttrib2fARB) then Exit; + @glVertexAttrib2sARB := SDL_GL_GetProcAddress('glVertexAttrib2sARB'); + if not Assigned(glVertexAttrib2sARB) then Exit; + @glVertexAttrib2dARB := SDL_GL_GetProcAddress('glVertexAttrib2dARB'); + if not Assigned(glVertexAttrib2dARB) then Exit; + @glVertexAttrib3fARB := SDL_GL_GetProcAddress('glVertexAttrib3fARB'); + if not Assigned(glVertexAttrib3fARB) then Exit; + @glVertexAttrib3sARB := SDL_GL_GetProcAddress('glVertexAttrib3sARB'); + if not Assigned(glVertexAttrib3sARB) then Exit; + @glVertexAttrib3dARB := SDL_GL_GetProcAddress('glVertexAttrib3dARB'); + if not Assigned(glVertexAttrib3dARB) then Exit; + @glVertexAttrib4fARB := SDL_GL_GetProcAddress('glVertexAttrib4fARB'); + if not Assigned(glVertexAttrib4fARB) then Exit; + @glVertexAttrib4sARB := SDL_GL_GetProcAddress('glVertexAttrib4sARB'); + if not Assigned(glVertexAttrib4sARB) then Exit; + @glVertexAttrib4dARB := SDL_GL_GetProcAddress('glVertexAttrib4dARB'); + if not Assigned(glVertexAttrib4dARB) then Exit; + @glVertexAttrib4NubARB := SDL_GL_GetProcAddress('glVertexAttrib4NubARB'); + if not Assigned(glVertexAttrib4NubARB) then Exit; + @glVertexAttrib1fvARB := SDL_GL_GetProcAddress('glVertexAttrib1fvARB'); + if not Assigned(glVertexAttrib1fvARB) then Exit; + @glVertexAttrib1svARB := SDL_GL_GetProcAddress('glVertexAttrib1svARB'); + if not Assigned(glVertexAttrib1svARB) then Exit; + @glVertexAttrib1dvARB := SDL_GL_GetProcAddress('glVertexAttrib1dvARB'); + if not Assigned(glVertexAttrib1dvARB) then Exit; + @glVertexAttrib2fvARB := SDL_GL_GetProcAddress('glVertexAttrib2fvARB'); + if not Assigned(glVertexAttrib2fvARB) then Exit; + @glVertexAttrib2svARB := SDL_GL_GetProcAddress('glVertexAttrib2svARB'); + if not Assigned(glVertexAttrib2svARB) then Exit; + @glVertexAttrib2dvARB := SDL_GL_GetProcAddress('glVertexAttrib2dvARB'); + if not Assigned(glVertexAttrib2dvARB) then Exit; + @glVertexAttrib3fvARB := SDL_GL_GetProcAddress('glVertexAttrib3fvARB'); + if not Assigned(glVertexAttrib3fvARB) then Exit; + @glVertexAttrib3svARB := SDL_GL_GetProcAddress('glVertexAttrib3svARB'); + if not Assigned(glVertexAttrib3svARB) then Exit; + @glVertexAttrib3dvARB := SDL_GL_GetProcAddress('glVertexAttrib3dvARB'); + if not Assigned(glVertexAttrib3dvARB) then Exit; + @glVertexAttrib4fvARB := SDL_GL_GetProcAddress('glVertexAttrib4fvARB'); + if not Assigned(glVertexAttrib4fvARB) then Exit; + @glVertexAttrib4svARB := SDL_GL_GetProcAddress('glVertexAttrib4svARB'); + if not Assigned(glVertexAttrib4svARB) then Exit; + @glVertexAttrib4dvARB := SDL_GL_GetProcAddress('glVertexAttrib4dvARB'); + if not Assigned(glVertexAttrib4dvARB) then Exit; + @glVertexAttrib4ivARB := SDL_GL_GetProcAddress('glVertexAttrib4ivARB'); + if not Assigned(glVertexAttrib4ivARB) then Exit; + @glVertexAttrib4bvARB := SDL_GL_GetProcAddress('glVertexAttrib4bvARB'); + if not Assigned(glVertexAttrib4bvARB) then Exit; + @glVertexAttrib4ubvARB := SDL_GL_GetProcAddress('glVertexAttrib4ubvARB'); + if not Assigned(glVertexAttrib4ubvARB) then Exit; + @glVertexAttrib4usvARB := SDL_GL_GetProcAddress('glVertexAttrib4usvARB'); + if not Assigned(glVertexAttrib4usvARB) then Exit; + @glVertexAttrib4uivARB := SDL_GL_GetProcAddress('glVertexAttrib4uivARB'); + if not Assigned(glVertexAttrib4uivARB) then Exit; + @glVertexAttrib4NbvARB := SDL_GL_GetProcAddress('glVertexAttrib4NbvARB'); + if not Assigned(glVertexAttrib4NbvARB) then Exit; + @glVertexAttrib4NsvARB := SDL_GL_GetProcAddress('glVertexAttrib4NsvARB'); + if not Assigned(glVertexAttrib4NsvARB) then Exit; + @glVertexAttrib4NivARB := SDL_GL_GetProcAddress('glVertexAttrib4NivARB'); + if not Assigned(glVertexAttrib4NivARB) then Exit; + @glVertexAttrib4NubvARB := SDL_GL_GetProcAddress('glVertexAttrib4NubvARB'); + if not Assigned(glVertexAttrib4NubvARB) then Exit; + @glVertexAttrib4NusvARB := SDL_GL_GetProcAddress('glVertexAttrib4NusvARB'); + if not Assigned(glVertexAttrib4NusvARB) then Exit; + @glVertexAttrib4NuivARB := SDL_GL_GetProcAddress('glVertexAttrib4NuivARB'); + if not Assigned(glVertexAttrib4NuivARB) then Exit; + @glVertexAttribPointerARB := SDL_GL_GetProcAddress('glVertexAttribPointerARB'); + if not Assigned(glVertexAttribPointerARB) then Exit; + @glEnableVertexAttribArrayARB := SDL_GL_GetProcAddress('glEnableVertexAttribArrayARB'); + if not Assigned(glEnableVertexAttribArrayARB) then Exit; + @glDisableVertexAttribArrayARB := SDL_GL_GetProcAddress('glDisableVertexAttribArrayARB'); + if not Assigned(glDisableVertexAttribArrayARB) then Exit; + @glBindAttribLocationARB := SDL_GL_GetProcAddress('glBindAttribLocationARB'); + if not Assigned(glBindAttribLocationARB) then Exit; + @glGetActiveAttribARB := SDL_GL_GetProcAddress('glGetActiveAttribARB'); + if not Assigned(glGetActiveAttribARB) then Exit; + @glGetAttribLocationARB := SDL_GL_GetProcAddress('glGetAttribLocationARB'); + if not Assigned(glGetAttribLocationARB) then Exit; + @glGetVertexAttribdvARB := SDL_GL_GetProcAddress('glGetVertexAttribdvARB'); + if not Assigned(glGetVertexAttribdvARB) then Exit; + @glGetVertexAttribfvARB := SDL_GL_GetProcAddress('glGetVertexAttribfvARB'); + if not Assigned(glGetVertexAttribfvARB) then Exit; + @glGetVertexAttribivARB := SDL_GL_GetProcAddress('glGetVertexAttribivARB'); + if not Assigned(glGetVertexAttribivARB) then Exit; + @glGetVertexAttribPointervARB := SDL_GL_GetProcAddress('glGetVertexAttribPointervARB'); + if not Assigned(glGetVertexAttribPointervARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_fragment_shader: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_fragment_shader', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_shading_language_100: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_shading_language_100', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_texture_non_power_of_two: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_texture_non_power_of_two', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_point_sprite: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_point_sprite', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_depth_bounds_test: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_depth_bounds_test', extstring) then + begin + @glDepthBoundsEXT := SDL_GL_GetProcAddress('glDepthBoundsEXT'); + if not Assigned(glDepthBoundsEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_secondary_color: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_secondary_color', extstring) then + begin + @glSecondaryColor3bEXT := SDL_GL_GetProcAddress('glSecondaryColor3bEXT'); + if not Assigned(glSecondaryColor3bEXT) then Exit; + @glSecondaryColor3sEXT := SDL_GL_GetProcAddress('glSecondaryColor3sEXT'); + if not Assigned(glSecondaryColor3sEXT) then Exit; + @glSecondaryColor3iEXT := SDL_GL_GetProcAddress('glSecondaryColor3iEXT'); + if not Assigned(glSecondaryColor3iEXT) then Exit; + @glSecondaryColor3fEXT := SDL_GL_GetProcAddress('glSecondaryColor3fEXT'); + if not Assigned(glSecondaryColor3fEXT) then Exit; + @glSecondaryColor3dEXT := SDL_GL_GetProcAddress('glSecondaryColor3dEXT'); + if not Assigned(glSecondaryColor3dEXT) then Exit; + @glSecondaryColor3ubEXT := SDL_GL_GetProcAddress('glSecondaryColor3ubEXT'); + if not Assigned(glSecondaryColor3ubEXT) then Exit; + @glSecondaryColor3usEXT := SDL_GL_GetProcAddress('glSecondaryColor3usEXT'); + if not Assigned(glSecondaryColor3usEXT) then Exit; + @glSecondaryColor3uiEXT := SDL_GL_GetProcAddress('glSecondaryColor3uiEXT'); + if not Assigned(glSecondaryColor3uiEXT) then Exit; + @glSecondaryColor3bvEXT := SDL_GL_GetProcAddress('glSecondaryColor3bvEXT'); + if not Assigned(glSecondaryColor3bvEXT) then Exit; + @glSecondaryColor3svEXT := SDL_GL_GetProcAddress('glSecondaryColor3svEXT'); + if not Assigned(glSecondaryColor3svEXT) then Exit; + @glSecondaryColor3ivEXT := SDL_GL_GetProcAddress('glSecondaryColor3ivEXT'); + if not Assigned(glSecondaryColor3ivEXT) then Exit; + @glSecondaryColor3fvEXT := SDL_GL_GetProcAddress('glSecondaryColor3fvEXT'); + if not Assigned(glSecondaryColor3fvEXT) then Exit; + @glSecondaryColor3dvEXT := SDL_GL_GetProcAddress('glSecondaryColor3dvEXT'); + if not Assigned(glSecondaryColor3dvEXT) then Exit; + @glSecondaryColor3ubvEXT := SDL_GL_GetProcAddress('glSecondaryColor3ubvEXT'); + if not Assigned(glSecondaryColor3ubvEXT) then Exit; + @glSecondaryColor3usvEXT := SDL_GL_GetProcAddress('glSecondaryColor3usvEXT'); + if not Assigned(glSecondaryColor3usvEXT) then Exit; + @glSecondaryColor3uivEXT := SDL_GL_GetProcAddress('glSecondaryColor3uivEXT'); + if not Assigned(glSecondaryColor3uivEXT) then Exit; + @glSecondaryColorPointerEXT := SDL_GL_GetProcAddress('glSecondaryColorPointerEXT'); + if not Assigned(glSecondaryColorPointerEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_EXT_texture_mirror_clamp: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_texture_mirror_clamp', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_blend_equation_separate: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_blend_equation_separate', extstring) then + begin + @glBlendEquationSeparateEXT := SDL_GL_GetProcAddress('glBlendEquationSeparateEXT'); + if not Assigned(glBlendEquationSeparateEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_MESA_pack_invert: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_MESA_pack_invert', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_MESA_ycbcr_texture: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_MESA_ycbcr_texture', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_fragment_program_shadow: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_ARB_fragment_program_shadow', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_fog_coord: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_fog_coord', extstring) then + begin + @glFogCoordfEXT := SDL_GL_GetProcAddress('glFogCoordfEXT'); + if not Assigned(glFogCoordfEXT) then Exit; + @glFogCoorddEXT := SDL_GL_GetProcAddress('glFogCoorddEXT'); + if not Assigned(glFogCoorddEXT) then Exit; + @glFogCoordfvEXT := SDL_GL_GetProcAddress('glFogCoordfvEXT'); + if not Assigned(glFogCoordfvEXT) then Exit; + @glFogCoorddvEXT := SDL_GL_GetProcAddress('glFogCoorddvEXT'); + if not Assigned(glFogCoorddvEXT) then Exit; + @glFogCoordPointerEXT := SDL_GL_GetProcAddress('glFogCoordPointerEXT'); + if not Assigned(glFogCoordPointerEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_NV_fragment_program_option: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_fragment_program_option', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_pixel_buffer_object: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_EXT_pixel_buffer_object', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_fragment_program2: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_fragment_program2', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_vertex_program2_option: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_vertex_program2_option', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_NV_vertex_program3: Boolean; +var + extstring : PChar; +begin + + Result := FALSE; + extstring := glGetString( GL_EXTENSIONS ); + + if glext_ExtensionSupported('GL_NV_vertex_program3', extstring) then + begin + Result := TRUE; + end; + +end; + +function glext_LoadExtension(ext: PChar): Boolean; +begin + + Result := FALSE; + + if ext = 'GL_version_1_2' then Result := Load_GL_version_1_2 + else if ext = 'GL_ARB_imaging' then Result := Load_GL_ARB_imaging + else if ext = 'GL_version_1_3' then Result := Load_GL_version_1_3 + else if ext = 'GL_ARB_multitexture' then Result := Load_GL_ARB_multitexture + else if ext = 'GL_ARB_transpose_matrix' then Result := Load_GL_ARB_transpose_matrix + else if ext = 'GL_ARB_multisample' then Result := Load_GL_ARB_multisample + else if ext = 'GL_ARB_texture_env_add' then Result := Load_GL_ARB_texture_env_add + {$IFDEF WIN32} + else if ext = 'WGL_ARB_extensions_string' then Result := Load_WGL_ARB_extensions_string + else if ext = 'WGL_ARB_buffer_region' then Result := Load_WGL_ARB_buffer_region + {$ENDIF} + else if ext = 'GL_ARB_texture_cube_map' then Result := Load_GL_ARB_texture_cube_map + else if ext = 'GL_ARB_depth_texture' then Result := Load_GL_ARB_depth_texture + else if ext = 'GL_ARB_point_parameters' then Result := Load_GL_ARB_point_parameters + else if ext = 'GL_ARB_shadow' then Result := Load_GL_ARB_shadow + else if ext = 'GL_ARB_shadow_ambient' then Result := Load_GL_ARB_shadow_ambient + else if ext = 'GL_ARB_texture_border_clamp' then Result := Load_GL_ARB_texture_border_clamp + else if ext = 'GL_ARB_texture_compression' then Result := Load_GL_ARB_texture_compression + else if ext = 'GL_ARB_texture_env_combine' then Result := Load_GL_ARB_texture_env_combine + else if ext = 'GL_ARB_texture_env_crossbar' then Result := Load_GL_ARB_texture_env_crossbar + else if ext = 'GL_ARB_texture_env_dot3' then Result := Load_GL_ARB_texture_env_dot3 + else if ext = 'GL_ARB_texture_mirrored_repeat' then Result := Load_GL_ARB_texture_mirrored_repeat + else if ext = 'GL_ARB_vertex_blend' then Result := Load_GL_ARB_vertex_blend + else if ext = 'GL_ARB_vertex_program' then Result := Load_GL_ARB_vertex_program + else if ext = 'GL_ARB_window_pos' then Result := Load_GL_ARB_window_pos + else if ext = 'GL_EXT_422_pixels' then Result := Load_GL_EXT_422_pixels + else if ext = 'GL_EXT_abgr' then Result := Load_GL_EXT_abgr + else if ext = 'GL_EXT_bgra' then Result := Load_GL_EXT_bgra + else if ext = 'GL_EXT_blend_color' then Result := Load_GL_EXT_blend_color + else if ext = 'GL_EXT_blend_func_separate' then Result := Load_GL_EXT_blend_func_separate + else if ext = 'GL_EXT_blend_logic_op' then Result := Load_GL_EXT_blend_logic_op + else if ext = 'GL_EXT_blend_minmax' then Result := Load_GL_EXT_blend_minmax + else if ext = 'GL_EXT_blend_subtract' then Result := Load_GL_EXT_blend_subtract + else if ext = 'GL_EXT_clip_volume_hint' then Result := Load_GL_EXT_clip_volume_hint + else if ext = 'GL_EXT_color_subtable' then Result := Load_GL_EXT_color_subtable + else if ext = 'GL_EXT_compiled_vertex_array' then Result := Load_GL_EXT_compiled_vertex_array + else if ext = 'GL_EXT_convolution' then Result := Load_GL_EXT_convolution + else if ext = 'GL_EXT_histogram' then Result := Load_GL_EXT_histogram + else if ext = 'GL_EXT_multi_draw_arrays' then Result := Load_GL_EXT_multi_draw_arrays + else if ext = 'GL_EXT_packed_pixels' then Result := Load_GL_EXT_packed_pixels + else if ext = 'GL_EXT_paletted_texture' then Result := Load_GL_EXT_paletted_texture + else if ext = 'GL_EXT_point_parameters' then Result := Load_GL_EXT_point_parameters + else if ext = 'GL_EXT_polygon_offset' then Result := Load_GL_EXT_polygon_offset + else if ext = 'GL_EXT_separate_specular_color' then Result := Load_GL_EXT_separate_specular_color + else if ext = 'GL_EXT_shadow_funcs' then Result := Load_GL_EXT_shadow_funcs + else if ext = 'GL_EXT_shared_texture_palette' then Result := Load_GL_EXT_shared_texture_palette + else if ext = 'GL_EXT_stencil_two_side' then Result := Load_GL_EXT_stencil_two_side + else if ext = 'GL_EXT_stencil_wrap' then Result := Load_GL_EXT_stencil_wrap + else if ext = 'GL_EXT_subtexture' then Result := Load_GL_EXT_subtexture + else if ext = 'GL_EXT_texture3D' then Result := Load_GL_EXT_texture3D + else if ext = 'GL_EXT_texture_compression_s3tc' then Result := Load_GL_EXT_texture_compression_s3tc + else if ext = 'GL_EXT_texture_env_add' then Result := Load_GL_EXT_texture_env_add + else if ext = 'GL_EXT_texture_env_combine' then Result := Load_GL_EXT_texture_env_combine + else if ext = 'GL_EXT_texture_env_dot3' then Result := Load_GL_EXT_texture_env_dot3 + else if ext = 'GL_EXT_texture_filter_anisotropic' then Result := Load_GL_EXT_texture_filter_anisotropic + else if ext = 'GL_EXT_texture_lod_bias' then Result := Load_GL_EXT_texture_lod_bias + else if ext = 'GL_EXT_texture_object' then Result := Load_GL_EXT_texture_object + else if ext = 'GL_EXT_vertex_array' then Result := Load_GL_EXT_vertex_array + else if ext = 'GL_EXT_vertex_shader' then Result := Load_GL_EXT_vertex_shader + else if ext = 'GL_EXT_vertex_weighting' then Result := Load_GL_EXT_vertex_weighting + else if ext = 'GL_HP_occlusion_test' then Result := Load_GL_HP_occlusion_test + else if ext = 'GL_NV_blend_square' then Result := Load_GL_NV_blend_square + else if ext = 'GL_NV_copy_depth_to_color' then Result := Load_GL_NV_copy_depth_to_color + else if ext = 'GL_NV_depth_clamp' then Result := Load_GL_NV_depth_clamp + else if ext = 'GL_NV_evaluators' then Result := Load_GL_NV_evaluators + else if ext = 'GL_NV_fence' then Result := Load_GL_NV_fence + else if ext = 'GL_NV_fog_distance' then Result := Load_GL_NV_fog_distance + else if ext = 'GL_NV_light_max_exponent' then Result := Load_GL_NV_light_max_exponent + else if ext = 'GL_NV_multisample_filter_hint' then Result := Load_GL_NV_multisample_filter_hint + else if ext = 'GL_NV_occlusion_query' then Result := Load_GL_NV_occlusion_query + else if ext = 'GL_NV_packed_depth_stencil' then Result := Load_GL_NV_packed_depth_stencil + else if ext = 'GL_NV_point_sprite' then Result := Load_GL_NV_point_sprite + else if ext = 'GL_NV_register_combiners' then Result := Load_GL_NV_register_combiners + else if ext = 'GL_NV_register_combiners2' then Result := Load_GL_NV_register_combiners2 + else if ext = 'GL_NV_texgen_emboss' then Result := Load_GL_NV_texgen_emboss + else if ext = 'GL_NV_texgen_reflection' then Result := Load_GL_NV_texgen_reflection + else if ext = 'GL_NV_texture_compression_vtc' then Result := Load_GL_NV_texture_compression_vtc + else if ext = 'GL_NV_texture_env_combine4' then Result := Load_GL_NV_texture_env_combine4 + else if ext = 'GL_NV_texture_rectangle' then Result := Load_GL_NV_texture_rectangle + else if ext = 'GL_NV_texture_shader' then Result := Load_GL_NV_texture_shader + else if ext = 'GL_NV_texture_shader2' then Result := Load_GL_NV_texture_shader2 + else if ext = 'GL_NV_texture_shader3' then Result := Load_GL_NV_texture_shader3 + else if ext = 'GL_NV_vertex_array_range' then Result := Load_GL_NV_vertex_array_range + else if ext = 'GL_NV_vertex_array_range2' then Result := Load_GL_NV_vertex_array_range2 + else if ext = 'GL_NV_vertex_program' then Result := Load_GL_NV_vertex_program + else if ext = 'GL_NV_vertex_program1_1' then Result := Load_GL_NV_vertex_program1_1 + else if ext = 'GL_ATI_element_array' then Result := Load_GL_ATI_element_array + else if ext = 'GL_ATI_envmap_bumpmap' then Result := Load_GL_ATI_envmap_bumpmap + else if ext = 'GL_ATI_fragment_shader' then Result := Load_GL_ATI_fragment_shader + else if ext = 'GL_ATI_pn_triangles' then Result := Load_GL_ATI_pn_triangles + else if ext = 'GL_ATI_texture_mirror_once' then Result := Load_GL_ATI_texture_mirror_once + else if ext = 'GL_ATI_vertex_array_object' then Result := Load_GL_ATI_vertex_array_object + else if ext = 'GL_ATI_vertex_streams' then Result := Load_GL_ATI_vertex_streams + {$IFDEF WIN32} + else if ext = 'WGL_I3D_image_buffer' then Result := Load_WGL_I3D_image_buffer + else if ext = 'WGL_I3D_swap_frame_lock' then Result := Load_WGL_I3D_swap_frame_lock + else if ext = 'WGL_I3D_swap_frame_usage' then Result := Load_WGL_I3D_swap_frame_usage + {$ENDIF} + else if ext = 'GL_3DFX_texture_compression_FXT1' then Result := Load_GL_3DFX_texture_compression_FXT1 + else if ext = 'GL_IBM_cull_vertex' then Result := Load_GL_IBM_cull_vertex + else if ext = 'GL_IBM_multimode_draw_arrays' then Result := Load_GL_IBM_multimode_draw_arrays + else if ext = 'GL_IBM_raster_pos_clip' then Result := Load_GL_IBM_raster_pos_clip + else if ext = 'GL_IBM_texture_mirrored_repeat' then Result := Load_GL_IBM_texture_mirrored_repeat + else if ext = 'GL_IBM_vertex_array_lists' then Result := Load_GL_IBM_vertex_array_lists + else if ext = 'GL_MESA_resize_buffers' then Result := Load_GL_MESA_resize_buffers + else if ext = 'GL_MESA_window_pos' then Result := Load_GL_MESA_window_pos + else if ext = 'GL_OML_interlace' then Result := Load_GL_OML_interlace + else if ext = 'GL_OML_resample' then Result := Load_GL_OML_resample + else if ext = 'GL_OML_subsample' then Result := Load_GL_OML_subsample + else if ext = 'GL_SGIS_generate_mipmap' then Result := Load_GL_SGIS_generate_mipmap + else if ext = 'GL_SGIS_multisample' then Result := Load_GL_SGIS_multisample + else if ext = 'GL_SGIS_pixel_texture' then Result := Load_GL_SGIS_pixel_texture + else if ext = 'GL_SGIS_texture_border_clamp' then Result := Load_GL_SGIS_texture_border_clamp + else if ext = 'GL_SGIS_texture_color_mask' then Result := Load_GL_SGIS_texture_color_mask + else if ext = 'GL_SGIS_texture_edge_clamp' then Result := Load_GL_SGIS_texture_edge_clamp + else if ext = 'GL_SGIS_texture_lod' then Result := Load_GL_SGIS_texture_lod + else if ext = 'GL_SGIS_depth_texture' then Result := Load_GL_SGIS_depth_texture + else if ext = 'GL_SGIX_fog_offset' then Result := Load_GL_SGIX_fog_offset + else if ext = 'GL_SGIX_interlace' then Result := Load_GL_SGIX_interlace + else if ext = 'GL_SGIX_shadow_ambient' then Result := Load_GL_SGIX_shadow_ambient + else if ext = 'GL_SGI_color_matrix' then Result := Load_GL_SGI_color_matrix + else if ext = 'GL_SGI_color_table' then Result := Load_GL_SGI_color_table + else if ext = 'GL_SGI_texture_color_table' then Result := Load_GL_SGI_texture_color_table + else if ext = 'GL_SUN_vertex' then Result := Load_GL_SUN_vertex + else if ext = 'GL_ARB_fragment_program' then Result := Load_GL_ARB_fragment_program + else if ext = 'GL_ATI_text_fragment_shader' then Result := Load_GL_ATI_text_fragment_shader + else if ext = 'GL_APPLE_client_storage' then Result := Load_GL_APPLE_client_storage + else if ext = 'GL_APPLE_element_array' then Result := Load_GL_APPLE_element_array + else if ext = 'GL_APPLE_fence' then Result := Load_GL_APPLE_fence + else if ext = 'GL_APPLE_vertex_array_object' then Result := Load_GL_APPLE_vertex_array_object + else if ext = 'GL_APPLE_vertex_array_range' then Result := Load_GL_APPLE_vertex_array_range + {$IFDEF WIN32} + else if ext = 'WGL_ARB_pixel_format' then Result := Load_WGL_ARB_pixel_format + else if ext = 'WGL_ARB_make_current_read' then Result := Load_WGL_ARB_make_current_read + else if ext = 'WGL_ARB_pbuffer' then Result := Load_WGL_ARB_pbuffer + else if ext = 'WGL_EXT_swap_control' then Result := Load_WGL_EXT_swap_control + else if ext = 'WGL_ARB_render_texture' then Result := Load_WGL_ARB_render_texture + else if ext = 'WGL_EXT_extensions_string' then Result := Load_WGL_EXT_extensions_string + else if ext = 'WGL_EXT_make_current_read' then Result := Load_WGL_EXT_make_current_read + else if ext = 'WGL_EXT_pbuffer' then Result := Load_WGL_EXT_pbuffer + else if ext = 'WGL_EXT_pixel_format' then Result := Load_WGL_EXT_pixel_format + else if ext = 'WGL_I3D_digital_video_control' then Result := Load_WGL_I3D_digital_video_control + else if ext = 'WGL_I3D_gamma' then Result := Load_WGL_I3D_gamma + else if ext = 'WGL_I3D_genlock' then Result := Load_WGL_I3D_genlock + {$ENDIF} + else if ext = 'GL_ARB_matrix_palette' then Result := Load_GL_ARB_matrix_palette + else if ext = 'GL_NV_element_array' then Result := Load_GL_NV_element_array + else if ext = 'GL_NV_float_buffer' then Result := Load_GL_NV_float_buffer + else if ext = 'GL_NV_fragment_program' then Result := Load_GL_NV_fragment_program + else if ext = 'GL_NV_primitive_restart' then Result := Load_GL_NV_primitive_restart + else if ext = 'GL_NV_vertex_program2' then Result := Load_GL_NV_vertex_program2 + {$IFDEF WIN32} + else if ext = 'WGL_NV_render_texture_rectangle' then Result := Load_WGL_NV_render_texture_rectangle + {$ENDIF} + else if ext = 'GL_NV_pixel_data_range' then Result := Load_GL_NV_pixel_data_range + else if ext = 'GL_EXT_texture_rectangle' then Result := Load_GL_EXT_texture_rectangle + else if ext = 'GL_S3_s3tc' then Result := Load_GL_S3_s3tc + else if ext = 'GL_ATI_draw_buffers' then Result := Load_GL_ATI_draw_buffers + {$IFDEF WIN32} + else if ext = 'WGL_ATI_pixel_format_float' then Result := Load_WGL_ATI_pixel_format_float + {$ENDIF} + else if ext = 'GL_ATI_texture_env_combine3' then Result := Load_GL_ATI_texture_env_combine3 + else if ext = 'GL_ATI_texture_float' then Result := Load_GL_ATI_texture_float + else if ext = 'GL_NV_texture_expand_normal' then Result := Load_GL_NV_texture_expand_normal + else if ext = 'GL_NV_half_float' then Result := Load_GL_NV_half_float + else if ext = 'GL_ATI_map_object_buffer' then Result := Load_GL_ATI_map_object_buffer + else if ext = 'GL_ATI_separate_stencil' then Result := Load_GL_ATI_separate_stencil + else if ext = 'GL_ATI_vertex_attrib_array_object' then Result := Load_GL_ATI_vertex_attrib_array_object + else if ext = 'GL_ARB_vertex_buffer_object' then Result := Load_GL_ARB_vertex_buffer_object + else if ext = 'GL_ARB_occlusion_query' then Result := Load_GL_ARB_occlusion_query + else if ext = 'GL_ARB_shader_objects' then Result := Load_GL_ARB_shader_objects + else if ext = 'GL_ARB_vertex_shader' then Result := Load_GL_ARB_vertex_shader + else if ext = 'GL_ARB_fragment_shader' then Result := Load_GL_ARB_fragment_shader + else if ext = 'GL_ARB_shading_language_100' then Result := Load_GL_ARB_shading_language_100 + else if ext = 'GL_ARB_texture_non_power_of_two' then Result := Load_GL_ARB_texture_non_power_of_two + else if ext = 'GL_ARB_point_sprite' then Result := Load_GL_ARB_point_sprite + else if ext = 'GL_EXT_depth_bounds_test' then Result := Load_GL_EXT_depth_bounds_test + else if ext = 'GL_EXT_secondary_color' then Result := Load_GL_EXT_secondary_color + else if ext = 'GL_EXT_texture_mirror_clamp' then Result := Load_GL_EXT_texture_mirror_clamp + else if ext = 'GL_EXT_blend_equation_separate' then Result := Load_GL_EXT_blend_equation_separate + else if ext = 'GL_MESA_pack_invert' then Result := Load_GL_MESA_pack_invert + else if ext = 'GL_MESA_ycbcr_texture' then Result := Load_GL_MESA_ycbcr_texture + else if ext = 'GL_ARB_fragment_program_shadow' then Result := Load_GL_ARB_fragment_program_shadow + else if ext = 'GL_EXT_fog_coord' then Result := Load_GL_EXT_fog_coord + else if ext = 'GL_NV_fragment_program_option' then Result := Load_GL_NV_fragment_program_option + else if ext = 'GL_EXT_pixel_buffer_object' then Result := Load_GL_EXT_pixel_buffer_object + else if ext = 'GL_NV_fragment_program2' then Result := Load_GL_NV_fragment_program2 + else if ext = 'GL_NV_vertex_program2_option' then Result := Load_GL_NV_vertex_program2_option + else if ext = 'GL_NV_vertex_program3' then Result := Load_GL_NV_vertex_program3 + +end; + +end. diff --git a/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glu.pas b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glu.pas new file mode 100644 index 00000000..fb48f65d --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glu.pas @@ -0,0 +1,563 @@ +unit glu; +{ + $Id: glu.pas,v 1.3 2004/10/07 21:01:29 savage Exp $ + + Adaption of the delphi3d.net OpenGL units to FreePascal + Sebastian Guenther (sg@freepascal.org) in 2002 + These units are free to use +} + +(*++ BUILD Version: 0004 // Increment this if a change has global effects + +Copyright (c) 1985-95, Microsoft Corporation + +Module Name: + + glu.h + +Abstract: + + Procedure declarations, constant definitions and macros for the OpenGL + Utility Library. + +--*) + +(* +** Copyright 1991-1993, Silicon Graphics, Inc. +** All Rights Reserved. +** +** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.; +** the contents of this file may not be disclosed to third parties, copied or +** duplicated in any form, in whole or in part, without the prior written +** permission of Silicon Graphics, Inc. +** +** RESTRICTED RIGHTS LEGEND: +** Use, duplication or disclosure by the Government is subject to restrictions +** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data +** and Computer Software clause at DFARS 252.227-7013, and/or in similar or +** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - +** rights reserved under the Copyright Laws of the United States. +*) + +(* +** Return the error string associated with a particular error code. +** This will return 0 for an invalid error code. +** +** The generic function prototype that can be compiled for ANSI or Unicode +** is defined as follows: +** +** LPCTSTR APIENTRY gluErrorStringWIN (GLenum errCode); +*) + +{******************************************************************************} +{ } +{ Converted to Delphi by Tom Nuydens (tom@delphi3d.net) } +{ For the latest updates, visit Delphi3D: http://www.delphi3d.net } +{ } +{ Modified for Delphi/Kylix and FreePascal } +{ by Dominique Louis ( Dominique@Savagesoftware.com.au) } +{ For the latest updates, visit JEDI-SDL : http://www.sf.net/projects/jedi-sdl } +{ } +{******************************************************************************} + +{ + $Log: glu.pas,v $ + Revision 1.3 2004/10/07 21:01:29 savage + Fix for FPC + + Revision 1.2 2004/08/14 22:54:30 savage + Updated so that Library name defines are correctly defined for MacOS X. + + Revision 1.1 2004/03/30 21:53:54 savage + Moved to it's own folder. + + Revision 1.4 2004/02/20 17:09:55 savage + Code tidied up in gl, glu and glut, while extensions in glext.pas are now loaded using SDL_GL_GetProcAddress, thus making it more cross-platform compatible, but now more tied to SDL. + + Revision 1.3 2004/02/14 00:23:39 savage + As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. + + Revision 1.2 2004/02/14 00:09:19 savage + Changed uses to now make use of moduleloader.pas rather than dllfuncs.pas + + Revision 1.1 2004/02/05 00:08:19 savage + Module 1.0 release + + Revision 1.4 2003/06/02 12:32:13 savage + Modified Sources to avoid warnings with Delphi by moving CVS Logging to the top of the header files. Hopefully CVS Logging still works. + + Revision 1.3 2003/05/29 22:55:00 savage + Make use of new DLLFunctions + + Revision 1.2 2003/05/27 09:39:53 savage + Added better Gnu Pascal support. + + Revision 1.1 2003/05/11 13:18:03 savage + Newest OpenGL Headers For Delphi, Kylix and FPC + + Revision 1.2 2002/10/13 14:36:47 sg + * Win32 fix: The OS symbol is called "Win32", not "Windows" + + Revision 1.1 2002/10/13 13:57:31 sg + * Finally, the new units are available: Match the C headers more closely; + support for OpenGL extensions, and much more. Based on the Delphi units + by Tom Nuydens of delphi3d.net + +} + +interface + +{$I jedi-sdl.inc} + +uses +{$IFDEF __GPC__} + gpc, +{$ENDIF} + moduleloader, + gl; + +const +{$IFDEF WIN32} + GLuLibName = 'glu32.dll'; +{$ENDIF} + +{$IFDEF UNIX} +{$IFDEF DARWIN} + GLuLibName = 'libGLU.dylib'; +{$ELSE} + GLuLibName = 'libGLU.so'; +{$ENDIF} +{$ENDIF} + +type + TViewPortArray = array [0..3] of GLint; + T16dArray = array [0..15] of GLdouble; + TCallBack = procedure; + T3dArray = array [0..2] of GLdouble; + T4pArray = array [0..3] of Pointer; + T4fArray = array [0..3] of GLfloat; + {$IFNDEF __GPC__} + PPointer = ^Pointer; + {$ENDIF} + +var + gluErrorString: function(errCode: GLenum): PGLubyte; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluErrorUnicodeStringEXT: function(errCode: GLenum): PWideChar; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluGetString: function(name: GLenum): PGLubyte; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluOrtho2D: procedure(left,right, bottom, top: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluPerspective: procedure(fovy, aspect, zNear, zFar: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluPickMatrix: procedure(x, y, width, height: GLdouble; viewport: TViewPortArray); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluLookAt: procedure(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluProject: function(objx, objy, objz: GLdouble; const modelMatrix, projMatrix: T16dArray; viewport: TViewPortArray; winx, winy, winz: PGLdouble): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluUnProject: function(winx, winy, winz: GLdouble; const modelMatrix, projMatrix: T16dArray; viewport: TViewPortArray; objx, objy, objz: PGLdouble): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluScaleImage: function(format: GLenum; widthin, heightin: GLint; typein: GLenum; const datain: Pointer; widthout, heightout: GLint; typeout: GLenum; dataout: Pointer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluBuild1DMipmaps: function(target: GLenum; components, width: GLint; format, atype: GLenum; const data: Pointer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluBuild2DMipmaps: function(target: GLenum; components, width, height: GLint; format, atype: GLenum; const data: Pointer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +type + GLUnurbs = record end; PGLUnurbs = ^GLUnurbs; + GLUquadric = record end; PGLUquadric = ^GLUquadric; + GLUtesselator = record end; PGLUtesselator = ^GLUtesselator; + + // backwards compatibility: + GLUnurbsObj = GLUnurbs; PGLUnurbsObj = PGLUnurbs; + GLUquadricObj = GLUquadric; PGLUquadricObj = PGLUquadric; + GLUtesselatorObj = GLUtesselator; PGLUtesselatorObj = PGLUtesselator; + GLUtriangulatorObj = GLUtesselator; PGLUtriangulatorObj = PGLUtesselator; + +var + gluNewQuadric: function: PGLUquadric; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluDeleteQuadric: procedure(state: PGLUquadric); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluQuadricNormals: procedure(quadObject: PGLUquadric; normals: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluQuadricTexture: procedure(quadObject: PGLUquadric; textureCoords: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluQuadricOrientation: procedure(quadObject: PGLUquadric; orientation: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluQuadricDrawStyle: procedure(quadObject: PGLUquadric; drawStyle: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluCylinder: procedure(qobj: PGLUquadric; baseRadius, topRadius, height: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluDisk: procedure(qobj: PGLUquadric; innerRadius, outerRadius: GLdouble; slices, loops: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluPartialDisk: procedure(qobj: PGLUquadric; innerRadius, outerRadius: GLdouble; slices, loops: GLint; startAngle, sweepAngle: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluSphere: procedure(qobj: PGLuquadric; radius: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluQuadricCallback: procedure(qobj: PGLUquadric; which: GLenum; fn: TCallBack); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluNewTess: function: PGLUtesselator; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluDeleteTess: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluTessBeginPolygon: procedure(tess: PGLUtesselator; polygon_data: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluTessBeginContour: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluTessVertex: procedure(tess: PGLUtesselator; coords: T3dArray; data: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluTessEndContour: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluTessEndPolygon: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluTessProperty: procedure(tess: PGLUtesselator; which: GLenum; value: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluTessNormal: procedure(tess: PGLUtesselator; x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluTessCallback: procedure(tess: PGLUtesselator; which: GLenum;fn: TCallBack); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluGetTessProperty: procedure(tess: PGLUtesselator; which: GLenum; value: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluNewNurbsRenderer: function: PGLUnurbs; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluDeleteNurbsRenderer: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluBeginSurface: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluBeginCurve: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluEndCurve: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluEndSurface: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluBeginTrim: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluEndTrim: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluPwlCurve: procedure(nobj: PGLUnurbs; count: GLint; aarray: PGLfloat; stride: GLint; atype: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluNurbsCurve: procedure(nobj: PGLUnurbs; nknots: GLint; knot: PGLfloat; stride: GLint; ctlarray: PGLfloat; order: GLint; atype: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluNurbsSurface: procedure(nobj: PGLUnurbs; sknot_count: GLint; sknot: PGLfloat; tknot_count: GLint; tknot: PGLfloat; s_stride, t_stride: GLint; ctlarray: PGLfloat; sorder, torder: GLint; atype: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluLoadSamplingMatrices: procedure(nobj: PGLUnurbs; const modelMatrix, projMatrix: T16dArray; viewport: TViewPortArray); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluNurbsProperty: procedure(nobj: PGLUnurbs; aproperty: GLenum; value: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluGetNurbsProperty: procedure(nobj: PGLUnurbs; aproperty: GLenum; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluNurbsCallback: procedure(nobj: PGLUnurbs; which: GLenum; fn: TCallBack); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +(**** Callback function prototypes ****) + +type + // gluQuadricCallback + GLUquadricErrorProc = procedure(p: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + + // gluTessCallback + GLUtessBeginProc = procedure(p: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessEdgeFlagProc = procedure(p: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessVertexProc = procedure(p: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessEndProc = procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessErrorProc = procedure(p: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessCombineProc = procedure(p1: T3dArray; p2: T4pArray; p3: T4fArray; p4: PPointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessBeginDataProc = procedure(p1: GLenum; p2: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessEdgeFlagDataProc = procedure(p1: GLboolean; p2: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessVertexDataProc = procedure(p1, p2: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessEndDataProc = procedure(p: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessErrorDataProc = procedure(p1: GLenum; p2: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessCombineDataProc = procedure(p1: T3dArray; p2: T4pArray; p3: T4fArray; + p4: PPointer; p5: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + + // gluNurbsCallback + GLUnurbsErrorProc = procedure(p: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + + +//*** Generic constants ****/ + +const + // Version + GLU_VERSION_1_1 = 1; + GLU_VERSION_1_2 = 1; + + // Errors: (return value 0 = no error) + GLU_INVALID_ENUM = 100900; + GLU_INVALID_VALUE = 100901; + GLU_OUT_OF_MEMORY = 100902; + GLU_INCOMPATIBLE_GL_VERSION = 100903; + + // StringName + GLU_VERSION = 100800; + GLU_EXTENSIONS = 100801; + + // Boolean + GLU_TRUE = GL_TRUE; + GLU_FALSE = GL_FALSE; + + + //*** Quadric constants ****/ + + // QuadricNormal + GLU_SMOOTH = 100000; + GLU_FLAT = 100001; + GLU_NONE = 100002; + + // QuadricDrawStyle + GLU_POINT = 100010; + GLU_LINE = 100011; + GLU_FILL = 100012; + GLU_SILHOUETTE = 100013; + + // QuadricOrientation + GLU_OUTSIDE = 100020; + GLU_INSIDE = 100021; + + // Callback types: + // GLU_ERROR = 100103; + + + //*** Tesselation constants ****/ + + GLU_TESS_MAX_COORD = 1.0e150; + + // TessProperty + GLU_TESS_WINDING_RULE = 100140; + GLU_TESS_BOUNDARY_ONLY = 100141; + GLU_TESS_TOLERANCE = 100142; + + // TessWinding + GLU_TESS_WINDING_ODD = 100130; + GLU_TESS_WINDING_NONZERO = 100131; + GLU_TESS_WINDING_POSITIVE = 100132; + GLU_TESS_WINDING_NEGATIVE = 100133; + GLU_TESS_WINDING_ABS_GEQ_TWO = 100134; + + // TessCallback + GLU_TESS_BEGIN = 100100; // void (CALLBACK*)(GLenum type) + GLU_TESS_VERTEX = 100101; // void (CALLBACK*)(void *data) + GLU_TESS_END = 100102; // void (CALLBACK*)(void) + GLU_TESS_ERROR = 100103; // void (CALLBACK*)(GLenum errno) + GLU_TESS_EDGE_FLAG = 100104; // void (CALLBACK*)(GLboolean boundaryEdge) + GLU_TESS_COMBINE = 100105; { void (CALLBACK*)(GLdouble coords[3], + void *data[4], + GLfloat weight[4], + void **dataOut) } + GLU_TESS_BEGIN_DATA = 100106; { void (CALLBACK*)(GLenum type, + void *polygon_data) } + GLU_TESS_VERTEX_DATA = 100107; { void (CALLBACK*)(void *data, + void *polygon_data) } + GLU_TESS_END_DATA = 100108; // void (CALLBACK*)(void *polygon_data) + GLU_TESS_ERROR_DATA = 100109; { void (CALLBACK*)(GLenum errno, + void *polygon_data) } + GLU_TESS_EDGE_FLAG_DATA = 100110; { void (CALLBACK*)(GLboolean boundaryEdge, + void *polygon_data) } + GLU_TESS_COMBINE_DATA = 100111; { void (CALLBACK*)(GLdouble coords[3], + void *data[4], + GLfloat weight[4], + void **dataOut, + void *polygon_data) } + + // TessError + GLU_TESS_ERROR1 = 100151; + GLU_TESS_ERROR2 = 100152; + GLU_TESS_ERROR3 = 100153; + GLU_TESS_ERROR4 = 100154; + GLU_TESS_ERROR5 = 100155; + GLU_TESS_ERROR6 = 100156; + GLU_TESS_ERROR7 = 100157; + GLU_TESS_ERROR8 = 100158; + + GLU_TESS_MISSING_BEGIN_POLYGON = GLU_TESS_ERROR1; + GLU_TESS_MISSING_BEGIN_CONTOUR = GLU_TESS_ERROR2; + GLU_TESS_MISSING_END_POLYGON = GLU_TESS_ERROR3; + GLU_TESS_MISSING_END_CONTOUR = GLU_TESS_ERROR4; + GLU_TESS_COORD_TOO_LARGE = GLU_TESS_ERROR5; + GLU_TESS_NEED_COMBINE_CALLBACK = GLU_TESS_ERROR6; + + //*** NURBS constants ****/ + + // NurbsProperty + GLU_AUTO_LOAD_MATRIX = 100200; + GLU_CULLING = 100201; + GLU_SAMPLING_TOLERANCE = 100203; + GLU_DISPLAY_MODE = 100204; + GLU_PARAMETRIC_TOLERANCE = 100202; + GLU_SAMPLING_METHOD = 100205; + GLU_U_STEP = 100206; + GLU_V_STEP = 100207; + + // NurbsSampling + GLU_PATH_LENGTH = 100215; + GLU_PARAMETRIC_ERROR = 100216; + GLU_DOMAIN_DISTANCE = 100217; + + + // NurbsTrim + GLU_MAP1_TRIM_2 = 100210; + GLU_MAP1_TRIM_3 = 100211; + + // NurbsDisplay + // GLU_FILL = 100012; + GLU_OUTLINE_POLYGON = 100240; + GLU_OUTLINE_PATCH = 100241; + + // NurbsCallback + // GLU_ERROR = 100103; + + // NurbsErrors + GLU_NURBS_ERROR1 = 100251; + GLU_NURBS_ERROR2 = 100252; + GLU_NURBS_ERROR3 = 100253; + GLU_NURBS_ERROR4 = 100254; + GLU_NURBS_ERROR5 = 100255; + GLU_NURBS_ERROR6 = 100256; + GLU_NURBS_ERROR7 = 100257; + GLU_NURBS_ERROR8 = 100258; + GLU_NURBS_ERROR9 = 100259; + GLU_NURBS_ERROR10 = 100260; + GLU_NURBS_ERROR11 = 100261; + GLU_NURBS_ERROR12 = 100262; + GLU_NURBS_ERROR13 = 100263; + GLU_NURBS_ERROR14 = 100264; + GLU_NURBS_ERROR15 = 100265; + GLU_NURBS_ERROR16 = 100266; + GLU_NURBS_ERROR17 = 100267; + GLU_NURBS_ERROR18 = 100268; + GLU_NURBS_ERROR19 = 100269; + GLU_NURBS_ERROR20 = 100270; + GLU_NURBS_ERROR21 = 100271; + GLU_NURBS_ERROR22 = 100272; + GLU_NURBS_ERROR23 = 100273; + GLU_NURBS_ERROR24 = 100274; + GLU_NURBS_ERROR25 = 100275; + GLU_NURBS_ERROR26 = 100276; + GLU_NURBS_ERROR27 = 100277; + GLU_NURBS_ERROR28 = 100278; + GLU_NURBS_ERROR29 = 100279; + GLU_NURBS_ERROR30 = 100280; + GLU_NURBS_ERROR31 = 100281; + GLU_NURBS_ERROR32 = 100282; + GLU_NURBS_ERROR33 = 100283; + GLU_NURBS_ERROR34 = 100284; + GLU_NURBS_ERROR35 = 100285; + GLU_NURBS_ERROR36 = 100286; + GLU_NURBS_ERROR37 = 100287; + +//*** Backwards compatibility for old tesselator ****/ + +var + gluBeginPolygon: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluNextContour: procedure(tess: PGLUtesselator; atype: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluEndPolygon: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +const + // Contours types -- obsolete! + GLU_CW = 100120; + GLU_CCW = 100121; + GLU_INTERIOR = 100122; + GLU_EXTERIOR = 100123; + GLU_UNKNOWN = 100124; + + // Names without "TESS_" prefix + GLU_BEGIN = GLU_TESS_BEGIN; + GLU_VERTEX = GLU_TESS_VERTEX; + GLU_END = GLU_TESS_END; + GLU_ERROR = GLU_TESS_ERROR; + GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG; + +procedure LoadGLu(const dll: PChar); +procedure FreeGLu; + +implementation + +var + LibGlu: TModuleHandle; + +procedure FreeGLu; +begin + + @gluErrorString := nil; + @gluErrorUnicodeStringEXT := nil; + @gluGetString := nil; + @gluOrtho2D := nil; + @gluPerspective := nil; + @gluPickMatrix := nil; + @gluLookAt := nil; + @gluProject := nil; + @gluUnProject := nil; + @gluScaleImage := nil; + @gluBuild1DMipmaps := nil; + @gluBuild2DMipmaps := nil; + @gluNewQuadric := nil; + @gluDeleteQuadric := nil; + @gluQuadricNormals := nil; + @gluQuadricTexture := nil; + @gluQuadricOrientation := nil; + @gluQuadricDrawStyle := nil; + @gluCylinder := nil; + @gluDisk := nil; + @gluPartialDisk := nil; + @gluSphere := nil; + @gluQuadricCallback := nil; + @gluNewTess := nil; + @gluDeleteTess := nil; + @gluTessBeginPolygon := nil; + @gluTessBeginContour := nil; + @gluTessVertex := nil; + @gluTessEndContour := nil; + @gluTessEndPolygon := nil; + @gluTessProperty := nil; + @gluTessNormal := nil; + @gluTessCallback := nil; + @gluGetTessProperty := nil; + @gluNewNurbsRenderer := nil; + @gluDeleteNurbsRenderer := nil; + @gluBeginSurface := nil; + @gluBeginCurve := nil; + @gluEndCurve := nil; + @gluEndSurface := nil; + @gluBeginTrim := nil; + @gluEndTrim := nil; + @gluPwlCurve := nil; + @gluNurbsCurve := nil; + @gluNurbsSurface := nil; + @gluLoadSamplingMatrices := nil; + @gluNurbsProperty := nil; + @gluGetNurbsProperty := nil; + @gluNurbsCallback := nil; + @gluBeginPolygon := nil; + @gluNextContour := nil; + @gluEndPolygon := nil; + + UnLoadModule(LibGlu); + +end; + +procedure LoadGLu(const dll: PChar); +begin + + FreeGLu; + + if LoadModule( LibGlu, dll ) then + begin + @gluErrorString := GetModuleSymbol(LibGlu, 'gluErrorString'); + @gluErrorUnicodeStringEXT := GetModuleSymbol(LibGlu, 'gluErrorUnicodeStringEXT'); + @gluGetString := GetModuleSymbol(LibGlu, 'gluGetString'); + @gluOrtho2D := GetModuleSymbol(LibGlu, 'gluOrtho2D'); + @gluPerspective := GetModuleSymbol(LibGlu, 'gluPerspective'); + @gluPickMatrix := GetModuleSymbol(LibGlu, 'gluPickMatrix'); + @gluLookAt := GetModuleSymbol(LibGlu, 'gluLookAt'); + @gluProject := GetModuleSymbol(LibGlu, 'gluProject'); + @gluUnProject := GetModuleSymbol(LibGlu, 'gluUnProject'); + @gluScaleImage := GetModuleSymbol(LibGlu, 'gluScaleImage'); + @gluBuild1DMipmaps := GetModuleSymbol(LibGlu, 'gluBuild1DMipmaps'); + @gluBuild2DMipmaps := GetModuleSymbol(LibGlu, 'gluBuild2DMipmaps'); + @gluNewQuadric := GetModuleSymbol(LibGlu, 'gluNewQuadric'); + @gluDeleteQuadric := GetModuleSymbol(LibGlu, 'gluDeleteQuadric'); + @gluQuadricNormals := GetModuleSymbol(LibGlu, 'gluQuadricNormals'); + @gluQuadricTexture := GetModuleSymbol(LibGlu, 'gluQuadricTexture'); + @gluQuadricOrientation := GetModuleSymbol(LibGlu, 'gluQuadricOrientation'); + @gluQuadricDrawStyle := GetModuleSymbol(LibGlu, 'gluQuadricDrawStyle'); + @gluCylinder := GetModuleSymbol(LibGlu, 'gluCylinder'); + @gluDisk := GetModuleSymbol(LibGlu, 'gluDisk'); + @gluPartialDisk := GetModuleSymbol(LibGlu, 'gluPartialDisk'); + @gluSphere := GetModuleSymbol(LibGlu, 'gluSphere'); + @gluQuadricCallback := GetModuleSymbol(LibGlu, 'gluQuadricCallback'); + @gluNewTess := GetModuleSymbol(LibGlu, 'gluNewTess'); + @gluDeleteTess := GetModuleSymbol(LibGlu, 'gluDeleteTess'); + @gluTessBeginPolygon := GetModuleSymbol(LibGlu, 'gluTessBeginPolygon'); + @gluTessBeginContour := GetModuleSymbol(LibGlu, 'gluTessBeginContour'); + @gluTessVertex := GetModuleSymbol(LibGlu, 'gluTessVertex'); + @gluTessEndContour := GetModuleSymbol(LibGlu, 'gluTessEndContour'); + @gluTessEndPolygon := GetModuleSymbol(LibGlu, 'gluTessEndPolygon'); + @gluTessProperty := GetModuleSymbol(LibGlu, 'gluTessProperty'); + @gluTessNormal := GetModuleSymbol(LibGlu, 'gluTessNormal'); + @gluTessCallback := GetModuleSymbol(LibGlu, 'gluTessCallback'); + @gluGetTessProperty := GetModuleSymbol(LibGlu, 'gluGetTessProperty'); + @gluNewNurbsRenderer := GetModuleSymbol(LibGlu, 'gluNewNurbsRenderer'); + @gluDeleteNurbsRenderer := GetModuleSymbol(LibGlu, 'gluDeleteNurbsRenderer'); + @gluBeginSurface := GetModuleSymbol(LibGlu, 'gluBeginSurface'); + @gluBeginCurve := GetModuleSymbol(LibGlu, 'gluBeginCurve'); + @gluEndCurve := GetModuleSymbol(LibGlu, 'gluEndCurve'); + @gluEndSurface := GetModuleSymbol(LibGlu, 'gluEndSurface'); + @gluBeginTrim := GetModuleSymbol(LibGlu, 'gluBeginTrim'); + @gluEndTrim := GetModuleSymbol(LibGlu, 'gluEndTrim'); + @gluPwlCurve := GetModuleSymbol(LibGlu, 'gluPwlCurve'); + @gluNurbsCurve := GetModuleSymbol(LibGlu, 'gluNurbsCurve'); + @gluNurbsSurface := GetModuleSymbol(LibGlu, 'gluNurbsSurface'); + @gluLoadSamplingMatrices := GetModuleSymbol(LibGlu, 'gluLoadSamplingMatrices'); + @gluNurbsProperty := GetModuleSymbol(LibGlu, 'gluNurbsProperty'); + @gluGetNurbsProperty := GetModuleSymbol(LibGlu, 'gluGetNurbsProperty'); + @gluNurbsCallback := GetModuleSymbol(LibGlu, 'gluNurbsCallback'); + + @gluBeginPolygon := GetModuleSymbol(LibGlu, 'gluBeginPolygon'); + @gluNextContour := GetModuleSymbol(LibGlu, 'gluNextContour'); + @gluEndPolygon := GetModuleSymbol(LibGlu, 'gluEndPolygon'); + end; +end; + +initialization + + LoadGLu( GLuLibName ); + +finalization + + FreeGLu; + +end. diff --git a/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glut.pas b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glut.pas new file mode 100644 index 00000000..2a882a20 --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glut.pas @@ -0,0 +1,682 @@ +unit glut; +{ + $Id: glut.pas,v 1.2 2004/08/14 22:54:30 savage Exp $ + + Adaption of the delphi3d.net OpenGL units to FreePascal + Sebastian Guenther (sg@freepascal.org) in 2002 + These units are free to use +} + +// Copyright (c) Mark J. Kilgard, 1994, 1995, 1996. */ + +(* This program is freely distributable without licensing fees and is + provided without guarantee or warrantee expressed or implied. This + program is -not- in the public domain. *) + +{******************************************************************************} +{ } +{ Converted to Delphi by Tom Nuydens (tom@delphi3d.net) } +{ For the latest updates, visit Delphi3D: http://www.delphi3d.net } +{ } +{ Modified for Delphi/Kylix and FreePascal } +{ by Dominique Louis ( Dominique@Savagesoftware.com.au) } +{ For the latest updates, visit JEDI-SDL : http://www.sf.net/projects/jedi-sdl } +{ } +{******************************************************************************} + +{ + $Log: glut.pas,v $ + Revision 1.2 2004/08/14 22:54:30 savage + Updated so that Library name defines are correctly defined for MacOS X. + + Revision 1.1 2004/03/30 21:53:54 savage + Moved to it's own folder. + + Revision 1.5 2004/02/20 17:09:55 savage + Code tidied up in gl, glu and glut, while extensions in glext.pas are now loaded using SDL_GL_GetProcAddress, thus making it more cross-platform compatible, but now more tied to SDL. + + Revision 1.4 2004/02/14 22:36:29 savage + Fixed inconsistencies of using LoadLibrary and LoadModule. + Now all units make use of LoadModule rather than LoadLibrary and other dynamic proc procedures. + + Revision 1.3 2004/02/14 00:23:39 savage + As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. + + Revision 1.2 2004/02/14 00:09:19 savage + Changed uses to now make use of moduleloader.pas rather than dllfuncs.pas + + Revision 1.1 2004/02/05 00:08:19 savage + Module 1.0 release + + Revision 1.4 2003/06/02 12:32:13 savage + Modified Sources to avoid warnings with Delphi by moving CVS Logging to the top of the header files. Hopefully CVS Logging still works. + +} + +interface + +{$I jedi-sdl.inc} + +uses +{$IFDEF __GPC__} + system, + gpc, +{$ENDIF} + +{$IFDEF WIN32} + Windows, +{$ENDIF} + moduleloader, + gl; + +type + {$IFNDEF __GPC__} + PInteger = ^Integer; + PPChar = ^PChar; + {$ENDIF} + TGlutVoidCallback = procedure; {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} + TGlut1IntCallback = procedure(value: Integer); {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} + TGlut2IntCallback = procedure(v1, v2: Integer); {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} + TGlut3IntCallback = procedure(v1, v2, v3: Integer); {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} + TGlut4IntCallback = procedure(v1, v2, v3, v4: Integer); {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} + TGlut1Char2IntCallback = procedure(c: Byte; v1, v2: Integer); {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} + +const +{$IFDEF WIN32} + GlutLibName = 'glut32.dll'; +{$ENDIF} + +{$IFDEF UNIX} +{$IFDEF DARWIN} + GlutLibName = 'libglut.dylib'; +{$ELSE} + GlutLibName = 'libglut.so'; +{$ENDIF} +{$ENDIF} + + GLUT_API_VERSION = 3; + GLUT_XLIB_IMPLEMENTATION = 12; + // Display mode bit masks. + GLUT_RGB = 0; + GLUT_RGBA = GLUT_RGB; + GLUT_INDEX = 1; + GLUT_SINGLE = 0; + GLUT_DOUBLE = 2; + GLUT_ACCUM = 4; + GLUT_ALPHA = 8; + GLUT_DEPTH = 16; + GLUT_STENCIL = 32; + GLUT_MULTISAMPLE = 128; + GLUT_STEREO = 256; + GLUT_LUMINANCE = 512; + + // Mouse buttons. + GLUT_LEFT_BUTTON = 0; + GLUT_MIDDLE_BUTTON = 1; + GLUT_RIGHT_BUTTON = 2; + + // Mouse button state. + GLUT_DOWN = 0; + GLUT_UP = 1; + + // function keys + GLUT_KEY_F1 = 1; + GLUT_KEY_F2 = 2; + GLUT_KEY_F3 = 3; + GLUT_KEY_F4 = 4; + GLUT_KEY_F5 = 5; + GLUT_KEY_F6 = 6; + GLUT_KEY_F7 = 7; + GLUT_KEY_F8 = 8; + GLUT_KEY_F9 = 9; + GLUT_KEY_F10 = 10; + GLUT_KEY_F11 = 11; + GLUT_KEY_F12 = 12; + // directional keys + GLUT_KEY_LEFT = 100; + GLUT_KEY_UP = 101; + GLUT_KEY_RIGHT = 102; + GLUT_KEY_DOWN = 103; + GLUT_KEY_PAGE_UP = 104; + GLUT_KEY_PAGE_DOWN = 105; + GLUT_KEY_HOME = 106; + GLUT_KEY_END = 107; + GLUT_KEY_INSERT = 108; + + // Entry/exit state. + GLUT_LEFT = 0; + GLUT_ENTERED = 1; + + // Menu usage state. + GLUT_MENU_NOT_IN_USE = 0; + GLUT_MENU_IN_USE = 1; + + // Visibility state. + GLUT_NOT_VISIBLE = 0; + GLUT_VISIBLE = 1; + + // Window status state. + GLUT_HIDDEN = 0; + GLUT_FULLY_RETAINED = 1; + GLUT_PARTIALLY_RETAINED = 2; + GLUT_FULLY_COVERED = 3; + + // Color index component selection values. + GLUT_RED = 0; + GLUT_GREEN = 1; + GLUT_BLUE = 2; + + // Layers for use. + GLUT_NORMAL = 0; + GLUT_OVERLAY = 1; + + // Stroke font constants (use these in GLUT program). + GLUT_STROKE_ROMAN = Pointer(0); + GLUT_STROKE_MONO_ROMAN = Pointer(1); + + // Bitmap font constants (use these in GLUT program). + GLUT_BITMAP_9_BY_15 = Pointer(2); + GLUT_BITMAP_8_BY_13 = Pointer(3); + GLUT_BITMAP_TIMES_ROMAN_10 = Pointer(4); + GLUT_BITMAP_TIMES_ROMAN_24 = Pointer(5); + GLUT_BITMAP_HELVETICA_10 = Pointer(6); + GLUT_BITMAP_HELVETICA_12 = Pointer(7); + GLUT_BITMAP_HELVETICA_18 = Pointer(8); + + // glutGet parameters. + GLUT_WINDOW_X = 100; + GLUT_WINDOW_Y = 101; + GLUT_WINDOW_WIDTH = 102; + GLUT_WINDOW_HEIGHT = 103; + GLUT_WINDOW_BUFFER_SIZE = 104; + GLUT_WINDOW_STENCIL_SIZE = 105; + GLUT_WINDOW_DEPTH_SIZE = 106; + GLUT_WINDOW_RED_SIZE = 107; + GLUT_WINDOW_GREEN_SIZE = 108; + GLUT_WINDOW_BLUE_SIZE = 109; + GLUT_WINDOW_ALPHA_SIZE = 110; + GLUT_WINDOW_ACCUM_RED_SIZE = 111; + GLUT_WINDOW_ACCUM_GREEN_SIZE = 112; + GLUT_WINDOW_ACCUM_BLUE_SIZE = 113; + GLUT_WINDOW_ACCUM_ALPHA_SIZE = 114; + GLUT_WINDOW_DOUBLEBUFFER = 115; + GLUT_WINDOW_RGBA = 116; + GLUT_WINDOW_PARENT = 117; + GLUT_WINDOW_NUM_CHILDREN = 118; + GLUT_WINDOW_COLORMAP_SIZE = 119; + GLUT_WINDOW_NUM_SAMPLES = 120; + GLUT_WINDOW_STEREO = 121; + GLUT_WINDOW_CURSOR = 122; + GLUT_SCREEN_WIDTH = 200; + GLUT_SCREEN_HEIGHT = 201; + GLUT_SCREEN_WIDTH_MM = 202; + GLUT_SCREEN_HEIGHT_MM = 203; + GLUT_MENU_NUM_ITEMS = 300; + GLUT_DISPLAY_MODE_POSSIBLE = 400; + GLUT_INIT_WINDOW_X = 500; + GLUT_INIT_WINDOW_Y = 501; + GLUT_INIT_WINDOW_WIDTH = 502; + GLUT_INIT_WINDOW_HEIGHT = 503; + GLUT_INIT_DISPLAY_MODE = 504; + GLUT_ELAPSED_TIME = 700; + + // glutDeviceGet parameters. + GLUT_HAS_KEYBOARD = 600; + GLUT_HAS_MOUSE = 601; + GLUT_HAS_SPACEBALL = 602; + GLUT_HAS_DIAL_AND_BUTTON_BOX = 603; + GLUT_HAS_TABLET = 604; + GLUT_NUM_MOUSE_BUTTONS = 605; + GLUT_NUM_SPACEBALL_BUTTONS = 606; + GLUT_NUM_BUTTON_BOX_BUTTONS = 607; + GLUT_NUM_DIALS = 608; + GLUT_NUM_TABLET_BUTTONS = 609; + + // glutLayerGet parameters. + GLUT_OVERLAY_POSSIBLE = 800; + GLUT_LAYER_IN_USE = 801; + GLUT_HAS_OVERLAY = 802; + GLUT_TRANSPARENT_INDEX = 803; + GLUT_NORMAL_DAMAGED = 804; + GLUT_OVERLAY_DAMAGED = 805; + + // glutVideoResizeGet parameters. + GLUT_VIDEO_RESIZE_POSSIBLE = 900; + GLUT_VIDEO_RESIZE_IN_USE = 901; + GLUT_VIDEO_RESIZE_X_DELTA = 902; + GLUT_VIDEO_RESIZE_Y_DELTA = 903; + GLUT_VIDEO_RESIZE_WIDTH_DELTA = 904; + GLUT_VIDEO_RESIZE_HEIGHT_DELTA = 905; + GLUT_VIDEO_RESIZE_X = 906; + GLUT_VIDEO_RESIZE_Y = 907; + GLUT_VIDEO_RESIZE_WIDTH = 908; + GLUT_VIDEO_RESIZE_HEIGHT = 909; + + // glutGetModifiers return mask. + GLUT_ACTIVE_SHIFT = 1; + GLUT_ACTIVE_CTRL = 2; + GLUT_ACTIVE_ALT = 4; + + // glutSetCursor parameters. + // Basic arrows. + GLUT_CURSOR_RIGHT_ARROW = 0; + GLUT_CURSOR_LEFT_ARROW = 1; + // Symbolic cursor shapes. + GLUT_CURSOR_INFO = 2; + GLUT_CURSOR_DESTROY = 3; + GLUT_CURSOR_HELP = 4; + GLUT_CURSOR_CYCLE = 5; + GLUT_CURSOR_SPRAY = 6; + GLUT_CURSOR_WAIT = 7; + GLUT_CURSOR_TEXT = 8; + GLUT_CURSOR_CROSSHAIR = 9; + // Directional cursors. + GLUT_CURSOR_UP_DOWN = 10; + GLUT_CURSOR_LEFT_RIGHT = 11; + // Sizing cursors. + GLUT_CURSOR_TOP_SIDE = 12; + GLUT_CURSOR_BOTTOM_SIDE = 13; + GLUT_CURSOR_LEFT_SIDE = 14; + GLUT_CURSOR_RIGHT_SIDE = 15; + GLUT_CURSOR_TOP_LEFT_CORNER = 16; + GLUT_CURSOR_TOP_RIGHT_CORNER = 17; + GLUT_CURSOR_BOTTOM_RIGHT_CORNER = 18; + GLUT_CURSOR_BOTTOM_LEFT_CORNER = 19; + // Inherit from parent window. + GLUT_CURSOR_INHERIT = 100; + // Blank cursor. + GLUT_CURSOR_NONE = 101; + // Fullscreen crosshair (if available). + GLUT_CURSOR_FULL_CROSSHAIR = 102; + + // GLUT game mode sub-API. + // glutGameModeGet. + GLUT_GAME_MODE_ACTIVE = 0; + GLUT_GAME_MODE_POSSIBLE = 1; + GLUT_GAME_MODE_WIDTH = 2; + GLUT_GAME_MODE_HEIGHT = 3; + GLUT_GAME_MODE_PIXEL_DEPTH = 4; + GLUT_GAME_MODE_REFRESH_RATE = 5; + GLUT_GAME_MODE_DISPLAY_CHANGED = 6; + +var +// GLUT initialization sub-API. + glutInit: procedure(argcp: PInteger; argv: PPChar); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutInitDisplayMode: procedure(mode: Word); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutInitDisplayString: procedure(const str: PChar); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutInitWindowPosition: procedure(x, y: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutInitWindowSize: procedure(width, height: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutMainLoop: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +// GLUT window sub-API. + glutCreateWindow: function(const title: PChar): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutCreateSubWindow: function(win, x, y, width, height: Integer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutDestroyWindow: procedure(win: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPostRedisplay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPostWindowRedisplay: procedure(win: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSwapBuffers: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutGetWindow: function: Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSetWindow: procedure(win: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSetWindowTitle: procedure(const title: PChar); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSetIconTitle: procedure(const title: PChar); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPositionWindow: procedure(x, y: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutReshapeWindow: procedure(width, height: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPopWindow: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPushWindow: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutIconifyWindow: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutShowWindow: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutHideWindow: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutFullScreen: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSetCursor: procedure(cursor: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWarpPointer: procedure(x, y: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +// GLUT overlay sub-API. + glutEstablishOverlay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutRemoveOverlay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutUseLayer: procedure(layer: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPostOverlayRedisplay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPostWindowOverlayRedisplay: procedure(win: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutShowOverlay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutHideOverlay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +// GLUT menu sub-API. + glutCreateMenu: function(callback: TGlut1IntCallback): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutDestroyMenu: procedure(menu: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutGetMenu: function: Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSetMenu: procedure(menu: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutAddMenuEntry: procedure(const caption: PChar; value: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutAddSubMenu: procedure(const caption: PChar; submenu: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutChangeToMenuEntry: procedure(item: Integer; const caption: PChar; value: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutChangeToSubMenu: procedure(item: Integer; const caption: PChar; submenu: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutRemoveMenuItem: procedure(item: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutAttachMenu: procedure(button: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutDetachMenu: procedure(button: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +// GLUTsub-API. + glutDisplayFunc: procedure(f: TGlutVoidCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutReshapeFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutKeyboardFunc: procedure(f: TGlut1Char2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutMouseFunc: procedure(f: TGlut4IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutMotionFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPassiveMotionFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutEntryFunc: procedure(f: TGlut1IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutVisibilityFunc: procedure(f: TGlut1IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutIdleFunc: procedure(f: TGlutVoidCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutTimerFunc: procedure(millis: Word; f: TGlut1IntCallback; value: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutMenuStateFunc: procedure(f: TGlut1IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSpecialFunc: procedure(f: TGlut3IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSpaceballMotionFunc: procedure(f: TGlut3IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSpaceballRotateFunc: procedure(f: TGlut3IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSpaceballButtonFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutButtonBoxFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutDialsFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutTabletMotionFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutTabletButtonFunc: procedure(f: TGlut4IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutMenuStatusFunc: procedure(f: TGlut3IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutOverlayDisplayFunc: procedure(f:TGlutVoidCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWindowStatusFunc: procedure(f: TGlut1IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +// GLUT color index sub-API. + glutSetColor: procedure(cell: Integer; red, green, blue: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutGetColor: function(ndx, component: Integer): GLfloat; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutCopyColormap: procedure(win: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +// GLUT state retrieval sub-API. + glutGet: function(t: GLenum): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutDeviceGet: function(t: GLenum): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +// GLUT extension support sub-API + glutExtensionSupported: function(const name: PChar): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutGetModifiers: function: Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutLayerGet: function(t: GLenum): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +// GLUT font sub-API + glutBitmapCharacter: procedure(font : pointer; character: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutBitmapWidth: function(font : pointer; character: Integer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutStrokeCharacter: procedure(font : pointer; character: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutStrokeWidth: function(font : pointer; character: Integer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutBitmapLength: function(font: pointer; const str: PChar): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutStrokeLength: function(font: pointer; const str: PChar): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +// GLUT pre-built models sub-API + glutWireSphere: procedure(radius: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidSphere: procedure(radius: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireCone: procedure(base, height: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidCone: procedure(base, height: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireCube: procedure(size: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidCube: procedure(size: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireTorus: procedure(innerRadius, outerRadius: GLdouble; sides, rings: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidTorus: procedure(innerRadius, outerRadius: GLdouble; sides, rings: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireDodecahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidDodecahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireTeapot: procedure(size: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidTeapot: procedure(size: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireOctahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidOctahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireTetrahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidTetrahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireIcosahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidIcosahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +// GLUT video resize sub-API. + glutVideoResizeGet: function(param: GLenum): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSetupVideoResizing: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutStopVideoResizing: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutVideoResize: procedure(x, y, width, height: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutVideoPan: procedure(x, y, width, height: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +// GLUT debugging sub-API. + glutReportErrors: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +var + //example glutGameModeString('1280x1024:32@75'); + glutGameModeString : procedure (const AString : PChar); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutEnterGameMode : function : integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutLeaveGameMode : procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutGameModeGet : function (mode : GLenum) : integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + +procedure LoadGlut(const dll: PChar); +procedure FreeGlut; + +implementation + +var + LibGLUT : TModuleHandle; + +procedure FreeGlut; +begin + + UnLoadModule( LibGLUT ); + + @glutInit := nil; + @glutInitDisplayMode := nil; + @glutInitDisplayString := nil; + @glutInitWindowPosition := nil; + @glutInitWindowSize := nil; + @glutMainLoop := nil; + @glutCreateWindow := nil; + @glutCreateSubWindow := nil; + @glutDestroyWindow := nil; + @glutPostRedisplay := nil; + @glutPostWindowRedisplay := nil; + @glutSwapBuffers := nil; + @glutGetWindow := nil; + @glutSetWindow := nil; + @glutSetWindowTitle := nil; + @glutSetIconTitle := nil; + @glutPositionWindow := nil; + @glutReshapeWindow := nil; + @glutPopWindow := nil; + @glutPushWindow := nil; + @glutIconifyWindow := nil; + @glutShowWindow := nil; + @glutHideWindow := nil; + @glutFullScreen := nil; + @glutSetCursor := nil; + @glutWarpPointer := nil; + @glutEstablishOverlay := nil; + @glutRemoveOverlay := nil; + @glutUseLayer := nil; + @glutPostOverlayRedisplay := nil; + @glutPostWindowOverlayRedisplay := nil; + @glutShowOverlay := nil; + @glutHideOverlay := nil; + @glutCreateMenu := nil; + @glutDestroyMenu := nil; + @glutGetMenu := nil; + @glutSetMenu := nil; + @glutAddMenuEntry := nil; + @glutAddSubMenu := nil; + @glutChangeToMenuEntry := nil; + @glutChangeToSubMenu := nil; + @glutRemoveMenuItem := nil; + @glutAttachMenu := nil; + @glutDetachMenu := nil; + @glutDisplayFunc := nil; + @glutReshapeFunc := nil; + @glutKeyboardFunc := nil; + @glutMouseFunc := nil; + @glutMotionFunc := nil; + @glutPassiveMotionFunc := nil; + @glutEntryFunc := nil; + @glutVisibilityFunc := nil; + @glutIdleFunc := nil; + @glutTimerFunc := nil; + @glutMenuStateFunc := nil; + @glutSpecialFunc := nil; + @glutSpaceballMotionFunc := nil; + @glutSpaceballRotateFunc := nil; + @glutSpaceballButtonFunc := nil; + @glutButtonBoxFunc := nil; + @glutDialsFunc := nil; + @glutTabletMotionFunc := nil; + @glutTabletButtonFunc := nil; + @glutMenuStatusFunc := nil; + @glutOverlayDisplayFunc := nil; + @glutWindowStatusFunc := nil; + @glutSetColor := nil; + @glutGetColor := nil; + @glutCopyColormap := nil; + @glutGet := nil; + @glutDeviceGet := nil; + @glutExtensionSupported := nil; + @glutGetModifiers := nil; + @glutLayerGet := nil; + @glutBitmapCharacter := nil; + @glutBitmapWidth := nil; + @glutStrokeCharacter := nil; + @glutStrokeWidth := nil; + @glutBitmapLength := nil; + @glutStrokeLength := nil; + @glutWireSphere := nil; + @glutSolidSphere := nil; + @glutWireCone := nil; + @glutSolidCone := nil; + @glutWireCube := nil; + @glutSolidCube := nil; + @glutWireTorus := nil; + @glutSolidTorus := nil; + @glutWireDodecahedron := nil; + @glutSolidDodecahedron := nil; + @glutWireTeapot := nil; + @glutSolidTeapot := nil; + @glutWireOctahedron := nil; + @glutSolidOctahedron := nil; + @glutWireTetrahedron := nil; + @glutSolidTetrahedron := nil; + @glutWireIcosahedron := nil; + @glutSolidIcosahedron := nil; + @glutVideoResizeGet := nil; + @glutSetupVideoResizing := nil; + @glutStopVideoResizing := nil; + @glutVideoResize := nil; + @glutVideoPan := nil; + @glutReportErrors := nil; + +end; + +procedure LoadGlut(const dll: PChar); +begin + + FreeGlut; + + if LoadModule( LibGLUT, dll ) then + begin + @glutInit := GetModuleSymbol(LibGLUT, 'glutInit'); + @glutInitDisplayMode := GetModuleSymbol(LibGLUT, 'glutInitDisplayMode'); + @glutInitDisplayString := GetModuleSymbol(LibGLUT, 'glutInitDisplayString'); + @glutInitWindowPosition := GetModuleSymbol(LibGLUT, 'glutInitWindowPosition'); + @glutInitWindowSize := GetModuleSymbol(LibGLUT, 'glutInitWindowSize'); + @glutMainLoop := GetModuleSymbol(LibGLUT, 'glutMainLoop'); + @glutCreateWindow := GetModuleSymbol(LibGLUT, 'glutCreateWindow'); + @glutCreateSubWindow := GetModuleSymbol(LibGLUT, 'glutCreateSubWindow'); + @glutDestroyWindow := GetModuleSymbol(LibGLUT, 'glutDestroyWindow'); + @glutPostRedisplay := GetModuleSymbol(LibGLUT, 'glutPostRedisplay'); + @glutPostWindowRedisplay := GetModuleSymbol(LibGLUT, 'glutPostWindowRedisplay'); + @glutSwapBuffers := GetModuleSymbol(LibGLUT, 'glutSwapBuffers'); + @glutGetWindow := GetModuleSymbol(LibGLUT, 'glutGetWindow'); + @glutSetWindow := GetModuleSymbol(LibGLUT, 'glutSetWindow'); + @glutSetWindowTitle := GetModuleSymbol(LibGLUT, 'glutSetWindowTitle'); + @glutSetIconTitle := GetModuleSymbol(LibGLUT, 'glutSetIconTitle'); + @glutPositionWindow := GetModuleSymbol(LibGLUT, 'glutPositionWindow'); + @glutReshapeWindow := GetModuleSymbol(LibGLUT, 'glutReshapeWindow'); + @glutPopWindow := GetModuleSymbol(LibGLUT, 'glutPopWindow'); + @glutPushWindow := GetModuleSymbol(LibGLUT, 'glutPushWindow'); + @glutIconifyWindow := GetModuleSymbol(LibGLUT, 'glutIconifyWindow'); + @glutShowWindow := GetModuleSymbol(LibGLUT, 'glutShowWindow'); + @glutHideWindow := GetModuleSymbol(LibGLUT, 'glutHideWindow'); + @glutFullScreen := GetModuleSymbol(LibGLUT, 'glutFullScreen'); + @glutSetCursor := GetModuleSymbol(LibGLUT, 'glutSetCursor'); + @glutWarpPointer := GetModuleSymbol(LibGLUT, 'glutWarpPointer'); + @glutEstablishOverlay := GetModuleSymbol(LibGLUT, 'glutEstablishOverlay'); + @glutRemoveOverlay := GetModuleSymbol(LibGLUT, 'glutRemoveOverlay'); + @glutUseLayer := GetModuleSymbol(LibGLUT, 'glutUseLayer'); + @glutPostOverlayRedisplay := GetModuleSymbol(LibGLUT, 'glutPostOverlayRedisplay'); + @glutPostWindowOverlayRedisplay := GetModuleSymbol(LibGLUT, 'glutPostWindowOverlayRedisplay'); + @glutShowOverlay := GetModuleSymbol(LibGLUT, 'glutShowOverlay'); + @glutHideOverlay := GetModuleSymbol(LibGLUT, 'glutHideOverlay'); + @glutCreateMenu := GetModuleSymbol(LibGLUT, 'glutCreateMenu'); + @glutDestroyMenu := GetModuleSymbol(LibGLUT, 'glutDestroyMenu'); + @glutGetMenu := GetModuleSymbol(LibGLUT, 'glutGetMenu'); + @glutSetMenu := GetModuleSymbol(LibGLUT, 'glutSetMenu'); + @glutAddMenuEntry := GetModuleSymbol(LibGLUT, 'glutAddMenuEntry'); + @glutAddSubMenu := GetModuleSymbol(LibGLUT, 'glutAddSubMenu'); + @glutChangeToMenuEntry := GetModuleSymbol(LibGLUT, 'glutChangeToMenuEntry'); + @glutChangeToSubMenu := GetModuleSymbol(LibGLUT, 'glutChangeToSubMenu'); + @glutRemoveMenuItem := GetModuleSymbol(LibGLUT, 'glutRemoveMenuItem'); + @glutAttachMenu := GetModuleSymbol(LibGLUT, 'glutAttachMenu'); + @glutDetachMenu := GetModuleSymbol(LibGLUT, 'glutDetachMenu'); + @glutDisplayFunc := GetModuleSymbol(LibGLUT, 'glutDisplayFunc'); + @glutReshapeFunc := GetModuleSymbol(LibGLUT, 'glutReshapeFunc'); + @glutKeyboardFunc := GetModuleSymbol(LibGLUT, 'glutKeyboardFunc'); + @glutMouseFunc := GetModuleSymbol(LibGLUT, 'glutMouseFunc'); + @glutMotionFunc := GetModuleSymbol(LibGLUT, 'glutMotionFunc'); + @glutPassiveMotionFunc := GetModuleSymbol(LibGLUT, 'glutPassiveMotionFunc'); + @glutEntryFunc := GetModuleSymbol(LibGLUT, 'glutEntryFunc'); + @glutVisibilityFunc := GetModuleSymbol(LibGLUT, 'glutVisibilityFunc'); + @glutIdleFunc := GetModuleSymbol(LibGLUT, 'glutIdleFunc'); + @glutTimerFunc := GetModuleSymbol(LibGLUT, 'glutTimerFunc'); + @glutMenuStateFunc := GetModuleSymbol(LibGLUT, 'glutMenuStateFunc'); + @glutSpecialFunc := GetModuleSymbol(LibGLUT, 'glutSpecialFunc'); + @glutSpaceballMotionFunc := GetModuleSymbol(LibGLUT, 'glutSpaceballMotionFunc'); + @glutSpaceballRotateFunc := GetModuleSymbol(LibGLUT, 'glutSpaceballRotateFunc'); + @glutSpaceballButtonFunc := GetModuleSymbol(LibGLUT, 'glutSpaceballButtonFunc'); + @glutButtonBoxFunc := GetModuleSymbol(LibGLUT, 'glutButtonBoxFunc'); + @glutDialsFunc := GetModuleSymbol(LibGLUT, 'glutDialsFunc'); + @glutTabletMotionFunc := GetModuleSymbol(LibGLUT, 'glutTabletMotionFunc'); + @glutTabletButtonFunc := GetModuleSymbol(LibGLUT, 'glutTabletButtonFunc'); + @glutMenuStatusFunc := GetModuleSymbol(LibGLUT, 'glutMenuStatusFunc'); + @glutOverlayDisplayFunc := GetModuleSymbol(LibGLUT, 'glutOverlayDisplayFunc'); + @glutWindowStatusFunc := GetModuleSymbol(LibGLUT, 'glutWindowStatusFunc'); + @glutSetColor := GetModuleSymbol(LibGLUT, 'glutSetColor'); + @glutGetColor := GetModuleSymbol(LibGLUT, 'glutGetColor'); + @glutCopyColormap := GetModuleSymbol(LibGLUT, 'glutCopyColormap'); + @glutGet := GetModuleSymbol(LibGLUT, 'glutGet'); + @glutDeviceGet := GetModuleSymbol(LibGLUT, 'glutDeviceGet'); + @glutExtensionSupported := GetModuleSymbol(LibGLUT, 'glutExtensionSupported'); + @glutGetModifiers := GetModuleSymbol(LibGLUT, 'glutGetModifiers'); + @glutLayerGet := GetModuleSymbol(LibGLUT, 'glutLayerGet'); + @glutBitmapCharacter := GetModuleSymbol(LibGLUT, 'glutBitmapCharacter'); + @glutBitmapWidth := GetModuleSymbol(LibGLUT, 'glutBitmapWidth'); + @glutStrokeCharacter := GetModuleSymbol(LibGLUT, 'glutStrokeCharacter'); + @glutStrokeWidth := GetModuleSymbol(LibGLUT, 'glutStrokeWidth'); + @glutBitmapLength := GetModuleSymbol(LibGLUT, 'glutBitmapLength'); + @glutStrokeLength := GetModuleSymbol(LibGLUT, 'glutStrokeLength'); + @glutWireSphere := GetModuleSymbol(LibGLUT, 'glutWireSphere'); + @glutSolidSphere := GetModuleSymbol(LibGLUT, 'glutSolidSphere'); + @glutWireCone := GetModuleSymbol(LibGLUT, 'glutWireCone'); + @glutSolidCone := GetModuleSymbol(LibGLUT, 'glutSolidCone'); + @glutWireCube := GetModuleSymbol(LibGLUT, 'glutWireCube'); + @glutSolidCube := GetModuleSymbol(LibGLUT, 'glutSolidCube'); + @glutWireTorus := GetModuleSymbol(LibGLUT, 'glutWireTorus'); + @glutSolidTorus := GetModuleSymbol(LibGLUT, 'glutSolidTorus'); + @glutWireDodecahedron := GetModuleSymbol(LibGLUT, 'glutWireDodecahedron'); + @glutSolidDodecahedron := GetModuleSymbol(LibGLUT, 'glutSolidDodecahedron'); + @glutWireTeapot := GetModuleSymbol(LibGLUT, 'glutWireTeapot'); + @glutSolidTeapot := GetModuleSymbol(LibGLUT, 'glutSolidTeapot'); + @glutWireOctahedron := GetModuleSymbol(LibGLUT, 'glutWireOctahedron'); + @glutSolidOctahedron := GetModuleSymbol(LibGLUT, 'glutSolidOctahedron'); + @glutWireTetrahedron := GetModuleSymbol(LibGLUT, 'glutWireTetrahedron'); + @glutSolidTetrahedron := GetModuleSymbol(LibGLUT, 'glutSolidTetrahedron'); + @glutWireIcosahedron := GetModuleSymbol(LibGLUT, 'glutWireIcosahedron'); + @glutSolidIcosahedron := GetModuleSymbol(LibGLUT, 'glutSolidIcosahedron'); + @glutVideoResizeGet := GetModuleSymbol(LibGLUT, 'glutVideoResizeGet'); + @glutSetupVideoResizing := GetModuleSymbol(LibGLUT, 'glutSetupVideoResizing'); + @glutStopVideoResizing := GetModuleSymbol(LibGLUT, 'glutStopVideoResizing'); + @glutVideoResize := GetModuleSymbol(LibGLUT, 'glutVideoResize'); + @glutVideoPan := GetModuleSymbol(LibGLUT, 'glutVideoPan'); + @glutReportErrors := GetModuleSymbol(LibGLUT, 'glutReportErrors'); + @glutGameModeString := GetModuleSymbol(LibGLUT, 'glutGameModeString'); + @glutEnterGameMode := GetModuleSymbol(LibGLUT, 'glutEnterGameMode'); + @glutLeaveGameMode := GetModuleSymbol(LibGLUT, 'glutLeaveGameMode'); + @glutGameModeGet := GetModuleSymbol(LibGLUT, 'glutGameModeGet'); + end; +end; + +initialization + LoadGlut( GlutLibName ); + +finalization + FreeGlut; + +end. diff --git a/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glx.pas b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glx.pas new file mode 100644 index 00000000..e478758f --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glx.pas @@ -0,0 +1,276 @@ +unit glx; +{ + $Id: glx.pas,v 1.1 2004/03/30 21:53:55 savage Exp $ + + Translation of the Mesa GLX headers for FreePascal + Copyright (C) 1999 Sebastian Guenther + + + Mesa 3-D graphics library + Version: 3.0 + Copyright (C) 1995-1998 Brian Paul + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +} + +// {$MODE delphi} // objfpc would not work because of direct proc var assignments + +{You have to enable Macros (compiler switch "-Sm") for compiling this unit! + This is necessary for supporting different platforms with different calling + conventions via a single unit.} + +{ + $Log: glx.pas,v $ + Revision 1.1 2004/03/30 21:53:55 savage + Moved to it's own folder. + + Revision 1.5 2004/02/15 22:48:35 savage + More FPC and FreeBSD support changes. + + Revision 1.4 2004/02/14 22:36:29 savage + Fixed inconsistencies of using LoadLibrary and LoadModule. + Now all units make use of LoadModule rather than LoadLibrary and other dynamic proc procedures. + + Revision 1.3 2004/02/14 00:23:39 savage + As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. + + Revision 1.2 2004/02/14 00:09:19 savage + Changed uses to now make use of moduleloader.pas rather than dllfuncs.pas + + Revision 1.1 2004/02/05 00:08:19 savage + Module 1.0 release + + Revision 1.1 2003/05/11 13:18:03 savage + Newest OpenGL Headers For Delphi, Kylix and FPC + + Revision 1.1 2002/10/13 13:57:31 sg + * Finally, the new units are available: Match the C headers more closely; + support for OpenGL extensions, and much more. Based on the Delphi units + by Tom Nuydens of delphi3d.net + +} + +interface + +{$I jedi-sdl.inc} + +//{$MACRO ON} + +{$IFDEF UNIX} + uses + {$IFDEF FPC} + x, + xlib, + xutil; + {$ELSE} + xlib; + {$ENDIF} + {$DEFINE HasGLX} // Activate GLX stuff +{$ELSE} + {$MESSAGE Unsupported platform.} +{$ENDIF} + +{$IFNDEF HasGLX} + {$MESSAGE GLX not present on this platform.} +{$ENDIF} + + +// ======================================================= +// Unit specific extensions +// ======================================================= + +// Note: Requires that the GL library has already been initialized +function InitGLX: Boolean; + +var + GLXDumpUnresolvedFunctions, + GLXInitialized: Boolean; + + +// ======================================================= +// GLX consts, types and functions +// ======================================================= + +// Tokens for glXChooseVisual and glXGetConfig: +const + GLX_USE_GL = 1; + GLX_BUFFER_SIZE = 2; + GLX_LEVEL = 3; + GLX_RGBA = 4; + GLX_DOUBLEBUFFER = 5; + GLX_STEREO = 6; + GLX_AUX_BUFFERS = 7; + GLX_RED_SIZE = 8; + GLX_GREEN_SIZE = 9; + GLX_BLUE_SIZE = 10; + GLX_ALPHA_SIZE = 11; + GLX_DEPTH_SIZE = 12; + GLX_STENCIL_SIZE = 13; + GLX_ACCUM_RED_SIZE = 14; + GLX_ACCUM_GREEN_SIZE = 15; + GLX_ACCUM_BLUE_SIZE = 16; + GLX_ACCUM_ALPHA_SIZE = 17; + + // GLX_EXT_visual_info extension + GLX_X_VISUAL_TYPE_EXT = $22; + GLX_TRANSPARENT_TYPE_EXT = $23; + GLX_TRANSPARENT_INDEX_VALUE_EXT = $24; + GLX_TRANSPARENT_RED_VALUE_EXT = $25; + GLX_TRANSPARENT_GREEN_VALUE_EXT = $26; + GLX_TRANSPARENT_BLUE_VALUE_EXT = $27; + GLX_TRANSPARENT_ALPHA_VALUE_EXT = $28; + + + // Error codes returned by glXGetConfig: + GLX_BAD_SCREEN = 1; + GLX_BAD_ATTRIBUTE = 2; + GLX_NO_EXTENSION = 3; + GLX_BAD_VISUAL = 4; + GLX_BAD_CONTEXT = 5; + GLX_BAD_VALUE = 6; + GLX_BAD_ENUM = 7; + + // GLX 1.1 and later: + GLX_VENDOR = 1; + GLX_VERSION = 2; + GLX_EXTENSIONS = 3; + + // GLX_visual_info extension + GLX_TRUE_COLOR_EXT = $8002; + GLX_DIRECT_COLOR_EXT = $8003; + GLX_PSEUDO_COLOR_EXT = $8004; + GLX_STATIC_COLOR_EXT = $8005; + GLX_GRAY_SCALE_EXT = $8006; + GLX_STATIC_GRAY_EXT = $8007; + GLX_NONE_EXT = $8000; + GLX_TRANSPARENT_RGB_EXT = $8008; + GLX_TRANSPARENT_INDEX_EXT = $8009; + +type + // From XLib: + {$IFNDEF FPC} + TXID = XID; + {$ENDIF} + XPixmap = TXID; + XFont = TXID; + XColormap = TXID; + + GLXContext = Pointer; + GLXPixmap = TXID; + GLXDrawable = TXID; + GLXContextID = TXID; + +var + glXChooseVisual: function(dpy: PDisplay; screen: Integer; var attribList: Integer): PXVisualInfo; cdecl; + glXCreateContext: function(dpy: PDisplay; vis: PXVisualInfo; shareList: GLXContext; direct: Boolean): GLXContext; cdecl; + glXDestroyContext: procedure(dpy: PDisplay; ctx: GLXContext); cdecl; + glXMakeCurrent: function(dpy: PDisplay; drawable: GLXDrawable; ctx: GLXContext): Boolean; cdecl; + glXCopyContext: procedure(dpy: PDisplay; src, dst: GLXContext; mask: LongWord); cdecl; + glXSwapBuffers: procedure(dpy: PDisplay; drawable: GLXDrawable); cdecl; + glXCreateGLXPixmap: function(dpy: PDisplay; visual: PXVisualInfo; pixmap: XPixmap): GLXPixmap; cdecl; + glXDestroyGLXPixmap: procedure(dpy: PDisplay; pixmap: GLXPixmap); cdecl; + glXQueryExtension: function(dpy: PDisplay; var errorb, event: Integer): Boolean; cdecl; + glXQueryVersion: function(dpy: PDisplay; var maj, min: Integer): Boolean; cdecl; + glXIsDirect: function(dpy: PDisplay; ctx: GLXContext): Boolean; cdecl; + glXGetConfig: function(dpy: PDisplay; visual: PXVisualInfo; attrib: Integer; var value: Integer): Integer; cdecl; + glXGetCurrentContext: function: GLXContext; cdecl; + glXGetCurrentDrawable: function: GLXDrawable; cdecl; + glXWaitGL: procedure; cdecl; + glXWaitX: procedure; cdecl; + glXUseXFont: procedure(font: XFont; first, count, list: Integer); cdecl; + + // GLX 1.1 and later + glXQueryExtensionsString: function(dpy: PDisplay; screen: Integer): PChar; cdecl; + glXQueryServerString: function(dpy: PDisplay; screen, name: Integer): PChar; cdecl; + glXGetClientString: function(dpy: PDisplay; name: Integer): PChar; cdecl; + + // Mesa GLX Extensions + glXCreateGLXPixmapMESA: function(dpy: PDisplay; visual: PXVisualInfo; pixmap: XPixmap; cmap: XColormap): GLXPixmap; cdecl; + glXReleaseBufferMESA: function(dpy: PDisplay; d: GLXDrawable): Boolean; cdecl; + glXCopySubBufferMESA: procedure(dpy: PDisplay; drawbale: GLXDrawable; x, y, width, height: Integer); cdecl; + glXGetVideoSyncSGI: function(var counter: LongWord): Integer; cdecl; + glXWaitVideoSyncSGI: function(divisor, remainder: Integer; var count: LongWord): Integer; cdecl; + + +// ======================================================= +// +// ======================================================= + +implementation + +uses + {$IFNDEF __GPC__} + SysUtils, + {$ENDIF} + moduleloader; + +(* {$LINKLIB m} *) + +var + libGLX: TModuleHandle; + +function InitGLXFromLibrary( dll : PChar ): Boolean; +begin + Result := False; + + if LoadModule( libGLX, dll ) then + exit; + + glXChooseVisual := GetModuleSymbol(libglx, 'glXChooseVisual'); + glXCreateContext := GetModuleSymbol(libglx, 'glXCreateContext'); + glXDestroyContext := GetModuleSymbol(libglx, 'glXDestroyContext'); + glXMakeCurrent := GetModuleSymbol(libglx, 'glXMakeCurrent'); + glXCopyContext := GetModuleSymbol(libglx, 'glXCopyContext'); + glXSwapBuffers := GetModuleSymbol(libglx, 'glXSwapBuffers'); + glXCreateGLXPixmap := GetModuleSymbol(libglx, 'glXCreateGLXPixmap'); + glXDestroyGLXPixmap := GetModuleSymbol(libglx, 'glXDestroyGLXPixmap'); + glXQueryExtension := GetModuleSymbol(libglx, 'glXQueryExtension'); + glXQueryVersion := GetModuleSymbol(libglx, 'glXQueryVersion'); + glXIsDirect := GetModuleSymbol(libglx, 'glXIsDirect'); + glXGetConfig := GetModuleSymbol(libglx, 'glXGetConfig'); + glXGetCurrentContext := GetModuleSymbol(libglx, 'glXGetCurrentContext'); + glXGetCurrentDrawable := GetModuleSymbol(libglx, 'glXGetCurrentDrawable'); + glXWaitGL := GetModuleSymbol(libglx, 'glXWaitGL'); + glXWaitX := GetModuleSymbol(libglx, 'glXWaitX'); + glXUseXFont := GetModuleSymbol(libglx, 'glXUseXFont'); + // GLX 1.1 and later + glXQueryExtensionsString := GetModuleSymbol(libglx, 'glXQueryExtensionsString'); + glXQueryServerString := GetModuleSymbol(libglx, 'glXQueryServerString'); + glXGetClientString := GetModuleSymbol(libglx, 'glXGetClientString'); + // Mesa GLX Extensions + glXCreateGLXPixmapMESA := GetModuleSymbol(libglx, 'glXCreateGLXPixmapMESA'); + glXReleaseBufferMESA := GetModuleSymbol(libglx, 'glXReleaseBufferMESA'); + glXCopySubBufferMESA := GetModuleSymbol(libglx, 'glXCopySubBufferMESA'); + glXGetVideoSyncSGI := GetModuleSymbol(libglx, 'glXGetVideoSyncSGI'); + glXWaitVideoSyncSGI := GetModuleSymbol(libglx, 'glXWaitVideoSyncSGI'); + + GLXInitialized := True; + Result := True; +end; + +function InitGLX: Boolean; +begin + Result := InitGLXFromLibrary('libGL.so') or + InitGLXFromLibrary('libGL.so.1') or + InitGLXFromLibrary('libMesaGL.so') or + InitGLXFromLibrary('libMesaGL.so.3'); +end; + + +initialization + InitGLX; +finalization + UnloadModule(libGLX); +end. diff --git a/Game/Code/lib/JEDI-SDL/OpenGL/Pas/opengl12.pas b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/opengl12.pas new file mode 100644 index 00000000..763edaee --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/opengl12.pas @@ -0,0 +1,9967 @@ +unit opengl12; +{ + $Id: opengl12.pas,v 1.2 2004/04/05 09:59:46 savage Exp $ + +} +{******************************************************************************} +{ } +{ Borland Delphi Runtime Library } +{ OpenGL interface unit } +{ } +{ } +{ This is an interface unit for the use of OpenGL from within Delphi and Kylix.} +{ It contains the translations of gl.h, glu.h, glx.h as well as context } +{ and extension management functions. } +{ } +{ The original Pascal code is: OpenGL12.pas } +{ The initial developer of the Pascal code is Mike Lischke } +{ } +{ } +{ Portions created by Microsoft are } +{ Copyright (C) 1995-2001 Microsoft Corporation. } +{ All Rights Reserved. } +{ } +{ Portions created by Silicon Graphics Incorporated are } +{ Copyright (C) 1995-2001 Silicon Graphics Incorporated } +{ All Rights Reserved. } +{ } +{ Portions created by NVidia are } +{ Copyright (C) 1995-2001 NVidia } +{ All Rights Reserved. } +{ } +{ Portions created by Brian Paul } +{ Copyright (C) 1995-2001 Brian Paul } +{ All Rights Reserved. } +{ } +{ } +{ The original file is: gl.h } +{ The original file is: glut.h } +{ The original file is: glx.h } +{ The original file is: glx.h } +{ } +{ Portions created by Mike Lischke are } +{ Copyright (C) 2001 Mike Lischke. } +{ } +{ Portions created by John O'Harrow are } +{ Copyright (C) 2001 John O'Harrow. } +{ } +{ Portions created by Eric Grange are } +{ Copyright (C) 2001 Eric Grange. } +{ } +{ Portions created by Olivier Chatelain } +{ Copyright (C) 2001 Olivier Chatelain. } +{ } +{ Portions created by Tom Nuydens } +{ Copyright (C) 2001 Tom Nuydens. } +{ } +{ Portions created by Matthias Thoma are } +{ Copyright (C) 2001 Matthias Thoma. } +{ } +{ Portions created by Sven Bobrowski are } +{ Copyright (C) 2001 Sven Bobrowski } +{ } +{ } +{ Obtained through: } +{ } +{ Joint Endeavour of Delphi Innovators (Project JEDI) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{******************************************************************************} + +//---------------------------------------------------------------------------------------------------------------------- +// +// This is an interface unit for the use of OpenGL from within Delphi and contains +// the translations of gl.h, glu.h as well as some support functions. +// OpenGL12.pas contains bug fixes and enhancements of Delphi's and other translations +// as well as support for extensions. +// +// NOTE: In order to fully support multi thread rendering it is necessary to hold all +// extension address in threadvars. For single threaded applications this would be an +// unnecessary time penalty, however. Hence there is a compiler switch to +// allow single threaded OpenGL application to use vars while multi threaded applications +// will use threadvars. By default the switch MULTITHREADOPENGL (see compiler switch under der interface keyword) +// is not active and must explicitly enabled to take effect. +// +//---------------------------------------------------------------------------------------------------------------------- +// +// function InitOpenGL: Boolean; +// Needed to load the OpenGL DLLs and all addresses of the standard functions. +// In case OpenGL is already initialized this function does nothing. No error +// is raised, if something goes wrong, but you need to inspect the result in order +// to know if all went okay. +// Result: True if successful or already loaded, False otherwise. +// +// function InitOpenGLFromLibrary(GL_Name, GLU_Name: String): Boolean; +// Same as InitOpenGL, but you can specify specific DLLs. Useful if you want to +// use different DLLs than the default ones. This function closes previously +// loaded DLLs before it tries to open the new libraries. +// Result: True if successful, False otherwise. +// +// procedure CloseOpenGL; +// Unloads the OpenGL DLLs and sets all function addresses to nil, including +// extensions. You can load and unload the DLLs as often as you like. +// +// procedure ClearExtensions; +// Sets all extension routines to nil. This is needed when you change the Pixelformat +// of your OpenGL window, since the availability of these routines changes from +// PixelFormat to Pixelformat (and also between various vendors). +// +// function CreateRenderingContext(DC: HDC; Options: TRCOptions; ColorBits, StencilBits, AccumBits, AuxBuffers: Integer; +// Layer: Integer; var Palette: HPALETTE): HGLRC; +// Sets up a pixel format and creates a new rendering context depending of the +// given parameters: +// DC - the device context for which the rc is to be created +// Options - options for the context, which the application would like to have +// (it is not guaranteed they will be available) +// ColorBits - the color depth of the device context (Note: Because of the internal DC handling of the VCL you +// should avoid using GetDeviceCaps for memory DCs which are members of a TBitmap class. +// Translate the Pixelformat member instead!) +// StencilBits - requested size of the stencil buffer +// AccumBits - requested size of the accumulation buffer +// AuxBuffers - requested number of auxiliary buffers +// Layer - ID for the layer for which the RC will be created (-1..-15 for underlay planes, 0 for main plane, +// 1..15 for overlay planes) +// Note: The layer handling is not yet complete as there is very few information +// available and (until now) no OpenGL implementation with layer support on the low budget market. +// Hence use 0 (for the main plane) as layer ID. +// Palette - Palette Handle created within function (need to use DeleteObject(Palette) to free this if <> 0) +// Result: the newly created context or 0 if setup failed +// +// procedure ActivateRenderingContext(DC: HDC; RC: HGLRC); +// Makes RC in DC 'current' (wglMakeCurrent(..)) and loads all extension addresses +// and flags if necessary. +// +// procedure DeactivateRenderingContext; +// Counterpart to ActivateRenderingContext. +// +// procedure DestroyRenderingContext(RC: HGLRC); +// RC will be destroyed and must be recreated if you want to use it again. +// +// procedure ReadExtensions; +// Determines which extensions for the current rendering context are available and +// loads their addresses. This procedure is called from ActivateRenderingContext +// if a new pixel format is used, but you can safely call it from where you want +// to actualize those values (under the condition that a rendering context MUST be +// active). +// +// procedure ReadImplementationProperties; +// Determines other properties of the OpenGL DLL (version, availability of extensions). +// Again, a valid rendering context must be active. +// +// function HasActiveContext: Boolean; +// Determines whether the calling thread has currently an active rendering context. +//---------------------------------------------------------------------------------------------------------------------- +// +// This translation is based on different sources: +// +// - first translation from Artemis Alliance Inc. +// - previous versions from Mike Lischke +// - Alexander Staubo +// - Borland OpenGL.pas (from Delphi 3) +// - Microsoft and SGI OpenGL header files +// - www.opengl.org, www.sgi.com/OpenGL +// - nVidia extension reference as of December 1999 +// - nVidia extension reference as of January 2001 +// - vertex_array_range sample by Tom Nuydens at Delphi3D +// - minor bug fixes and greatly extended by John O'Harrow (john@elmcrest.demon.co.uk) +// - initial context activation balancing by Eric Grange (egrange@infonie.fr) +// - additional nVidia extensions by Olivier Chatelain (Olivier.Chatelain@xitact.com) +// +// Contact: public@lischke-online.de, www.lischke-online.de +// +// Version: 1.2.11 +//---------------------------------------------------------------------------------------------------------------------- +// +// 12-Feb-2002 dml : +// - Further modifications to allow unit to compile under Free Pascal +// as suggested by "QuePasha Pepe" +// +// 25-OCT-2001 dre : +// - Made modifications to allow unit to compile under Free Pascal +// - added tMaxLogPalette declaration to Free Pascal +// - included fix to ReadExtensions +// - Added Set8088CW procedure +// +// 13-SEP-2001 ml: +// - added PWGLSwap etc. declarations for Delphi 3 +// 18-AUG-2001 ml: +// - multi thread support for function addresses (extensions) +// 28-JUL-2001 ml: +// - included original type names (+ $EXTERNALSYM directives) +// 10-JUL-2001 ml: +// - TGLubyte changed to UCHAR +// 05-JUL-2001 ml: +// - own exception type for OpenGL +// - TGLboolean is now of type BYTEBOOL +// 05-MAY-2001 ml: +// - correct tracking of RC creation and release as well as multithreaded RC activation +// - compatibility routines for users of other OpenGL unit variants +// - improved rendering context creation +// - bug fixes +// 01-MAY-2001 ml: +// - added more nVidia extensions +//---------------------------------------------------------------------------------------------------------------------- +{ April 03 2003 - DL : Added jedi-sdl.inc include file to support more } +{ Pascal compilers. Initial support is now included } +{ for GnuPascal, VirtualPascal, TMT and obviously } +{ continue support for Delphi Kylix and FreePascal. } +{ } +{ May 03 2003 - DL : under instruction from David Mears AKA } +{ Jason Siletto, I have added FPC Linux support. } +{ } +{******************************************************************************} +{ + $Log: opengl12.pas,v $ + Revision 1.2 2004/04/05 09:59:46 savage + Changes for FreePacal as suggested by Marco + + Revision 1.1 2004/03/30 21:53:55 savage + Moved to it's own folder. + + Revision 1.6 2004/02/20 17:26:19 savage + Extensions are now loaded using SDL_GL_GetProcAddress, thus making it more cross-platform compatible, but now more tied to SDL. + + Revision 1.5 2004/02/15 22:48:36 savage + More FPC and FreeBSD support changes. + + Revision 1.4 2004/02/14 22:36:29 savage + Fixed inconsistencies of using LoadLibrary and LoadModule. + Now all units make use of LoadModule rather than LoadLibrary and other dynamic proc procedures. + + Revision 1.3 2004/02/14 00:23:39 savage + As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. + + Revision 1.2 2004/02/14 00:09:19 savage + Changed uses to now make use of moduleloader.pas rather than dllfuncs.pas + + Revision 1.1 2004/02/05 00:08:20 savage + Module 1.0 release + + +} + +{$I jedi-sdl.inc} + +interface + +{.$define MULTITHREADOPENGL} + +uses +{$IFDEF __GPC__} + gpc; +{$ENDIF} + +{$IFDEF WIN32} + {$IFNDEF __GPC__} + Windows; + {$ENDIF} +{$ENDIF} + +{$IFDEF Unix} + {$IFDEF FPC} + {$IFDEF Ver1_0} + linux, + {$ELSE} + baseunix, + unix, + {$ENDIF} + x, + xlib, + xutil, + dl; + {$ELSE} + Types, + Libc, + Xlib; + {$ENDIF} +{$ENDIF} + +type + TRCOptions = set of ( opDoubleBuffered, opGDI, opStereo ); + + {$EXTERNALSYM GLenum} + GLenum = Cardinal; + TGLenum = Cardinal; + PGLenum = ^TGLenum; + + {$EXTERNALSYM GLboolean} + GLboolean = BYTEBOOL; + TGLboolean = BYTEBOOL; + PGLboolean = ^TGLboolean; + + {$EXTERNALSYM GLbitfield} + GLbitfield = Cardinal; + TGLbitfield = Cardinal; + PGLbitfield = ^TGLbitfield; + + {$EXTERNALSYM GLbyte} + GLbyte = ShortInt; + TGLbyte = ShortInt; + PGLbyte = ^TGLbyte; + + {$EXTERNALSYM GLshort} + GLshort = SmallInt; + TGLshort = SmallInt; + PGLshort = ^TGLshort; + + {$EXTERNALSYM GLint} + GLint = Integer; + TGLint = Integer; + PGLint = ^TGLint; + + {$EXTERNALSYM GLsizei} + GLsizei = Integer; + TGLsizei = Integer; + PGLsizei = ^TGLsizei; + + {$EXTERNALSYM GLubyte} + UCHAR = Byte; + GLubyte = UCHAR; + TGLubyte = UCHAR; + PGLubyte = ^TGLubyte; + + {$EXTERNALSYM GLushort} + GLushort = Word; + TGLushort = Word; + PGLushort = ^TGLushort; + + {$EXTERNALSYM GLuint} + GLuint = Cardinal; + TGLuint = Cardinal; + PGLuint = ^TGLuint; + + {$EXTERNALSYM GLfloat} + GLfloat = Single; + TGLfloat = Single; + PGLfloat = ^TGLfloat; + + {$EXTERNALSYM GLclampf} + GLclampf = Single; + TGLclampf = Single; + PGLclampf = ^TGLclampf; + + {$EXTERNALSYM GLdouble} + GLdouble = Double; + TGLdouble = Double; + PGLdouble = ^TGLdouble; + + {$EXTERNALSYM GLclampd} + GLclampd = Double; + TGLclampd = Double; + PGLclampd = ^TGLclampd; + + TVector3d = array[0..2] of GLdouble; + + TVector4i = array[0..3] of GLint; + TVector4f = array[0..3] of GLfloat; + TVector4p = array[0..3] of Pointer; + + TMatrix4f = array[0..3, 0..3] of GLfloat; + TMatrix4d = array[0..3, 0..3] of GLdouble; + + PPointer = ^Pointer; + +{$ifndef FPC} + {$ifdef MULTITHREADOPENGL} + threadvar + {$else} + var + {$endif} +{$else} +var +{$endif} + GL_VERSION_1_0, + GL_VERSION_1_1, + GL_VERSION_1_2, + GLU_VERSION_1_1, + GLU_VERSION_1_2, + GLU_VERSION_1_3: Boolean; + + // Extensions (gl) + GL_3DFX_multisample, + GL_3DFX_tbuffer, + GL_3DFX_texture_compression_FXT1, + + GL_APPLE_specular_vector, + GL_APPLE_transform_hint, + + GL_ARB_imaging, + GL_ARB_multisample, + GL_ARB_multitexture, + GL_ARB_texture_compression, + GL_ARB_texture_cube_map, + GL_ARB_transpose_matrix, + GL_ARB_vertex_blend, + + GL_EXT_422_pixels, + GL_EXT_abgr, + GL_EXT_bgra, + GL_EXT_blend_color, + GL_EXT_blend_func_separate, + GL_EXT_blend_logic_op, + GL_EXT_blend_minmax, + GL_EXT_blend_subtract, + GL_EXT_clip_volume_hint, + GL_EXT_cmyka, + GL_EXT_color_subtable, + GL_EXT_compiled_vertex_array, + GL_EXT_convolution, + GL_EXT_coordinate_frame, + GL_EXT_copy_texture, + GL_EXT_cull_vertex, + GL_EXT_draw_range_elements, + GL_EXT_fog_coord, + GL_EXT_histogram, + GL_EXT_index_array_formats, + GL_EXT_index_func, + GL_EXT_index_material, + GL_EXT_index_texture, + GL_EXT_light_max_exponent, + GL_EXT_light_texture, + GL_EXT_misc_attribute, + GL_EXT_multi_draw_arrays, + GL_EXT_multisample, + GL_EXT_packed_pixels, + GL_EXT_paletted_texture, + GL_EXT_pixel_transform, + GL_EXT_point_parameters, + GL_EXT_polygon_offset, + GL_EXT_rescale_normal, + GL_EXT_scene_marker, + GL_EXT_secondary_color, + GL_EXT_separate_specular_color, + GL_EXT_shared_texture_palette, + GL_EXT_stencil_wrap, + GL_EXT_subtexture, + GL_EXT_texture_color_table, + GL_EXT_texture_compression_s3tc, + GL_EXT_texture_cube_map, + GL_EXT_texture_edge_clamp, + GL_EXT_texture_env_add, + GL_EXT_texture_env_combine, + GL_EXT_texture_filter_anisotropic, + GL_EXT_texture_lod_bias, + GL_EXT_texture_object, + GL_EXT_texture_perturb_normal, + GL_EXT_texture3D, + GL_EXT_vertex_array, + GL_EXT_vertex_weighting, + + GL_FfdMaskSGIX, + GL_HP_convolution_border_modes, + GL_HP_image_transform, + GL_HP_occlusion_test, + GL_HP_texture_lighting, + + GL_IBM_cull_vertex, + GL_IBM_multimode_draw_arrays, + GL_IBM_rasterpos_clip, + GL_IBM_vertex_array_lists, + + GL_INGR_color_clamp, + GL_INGR_interlace_read, + + GL_INTEL_parallel_arrays, + + GL_KTX_buffer_region, + + GL_MESA_resize_buffers, + GL_MESA_window_pos, + + GL_NV_blend_square, + GL_NV_fog_distance, + GL_NV_light_max_exponent, + GL_NV_register_combiners, + GL_NV_texgen_emboss, + GL_NV_texgen_reflection, + GL_NV_texture_env_combine4, + GL_NV_vertex_array_range, + GL_NV_vertex_program, + + GL_PGI_misc_hints, + GL_PGI_vertex_hints, + + GL_REND_screen_coordinates, + + GL_SGI_color_matrix, + GL_SGI_color_table, + GL_SGI_depth_pass_instrument, + + GL_SGIS_detail_texture, + GL_SGIS_fog_function, + GL_SGIS_generate_mipmap, + GL_SGIS_multisample, + GL_SGIS_multitexture, + GL_SGIS_pixel_texture, + GL_SGIS_point_line_texgen, + GL_SGIS_point_parameters, + GL_SGIS_sharpen_texture, + GL_SGIS_texture_border_clamp, + GL_SGIS_texture_color_mask, + GL_SGIS_texture_edge_clamp, + GL_SGIS_texture_filter4, + GL_SGIS_texture_lod, + GL_SGIS_texture_select, + GL_SGIS_texture4D, + + GL_SGIX_async, + GL_SGIX_async_histogram, + GL_SGIX_async_pixel, + GL_SGIX_blend_alpha_minmax, + GL_SGIX_calligraphic_fragment, + GL_SGIX_clipmap, + GL_SGIX_convolution_accuracy, + GL_SGIX_depth_texture, + GL_SGIX_flush_raster, + GL_SGIX_fog_offset, + GL_SGIX_fog_scale, + GL_SGIX_fragment_lighting, + GL_SGIX_framezoom, + GL_SGIX_igloo_interface, + GL_SGIX_instruments, + GL_SGIX_interlace, + GL_SGIX_ir_instrument1, + GL_SGIX_list_priority, + GL_SGIX_pixel_texture, + GL_SGIX_pixel_tiles, + GL_SGIX_polynomial_ffd, + GL_SGIX_reference_plane, + GL_SGIX_resample, + GL_SGIX_shadow, + GL_SGIX_shadow_ambient, + GL_SGIX_sprite, + GL_SGIX_subsample, + GL_SGIX_tag_sample_buffer, + GL_SGIX_texture_add_env, + GL_SGIX_texture_lod_bias, + GL_SGIX_texture_multi_buffer, + GL_SGIX_texture_scale_bias, + GL_SGIX_vertex_preclip, + GL_SGIX_ycrcb, + GL_SGIX_ycrcba, + + GL_SUN_convolution_border_modes, + GL_SUN_global_alpha, + GL_SUN_triangle_list, + GL_SUN_vertex, + + GL_SUNX_constant_data, + + GL_WIN_phong_shading, + GL_WIN_specular_fog, + GL_WIN_swap_hint, + + WGL_EXT_swap_control, + WGL_ARB_extensions_string, + WGL_ARB_pixel_format, + + // Extensions (glu) + GLU_EXT_Texture, + GLU_EXT_object_space_tess, + GLU_EXT_nurbs_tessellator: Boolean; + +const + // ********** GL generic constants ********** + + // errors + GL_NO_ERROR = 0; + {$EXTERNALSYM GL_NO_ERROR} + GL_INVALID_ENUM = $0500; + {$EXTERNALSYM GL_INVALID_ENUM} + GL_INVALID_VALUE = $0501; + {$EXTERNALSYM GL_INVALID_VALUE} + GL_INVALID_OPERATION = $0502; + {$EXTERNALSYM GL_INVALID_OPERATION} + GL_STACK_OVERFLOW = $0503; + {$EXTERNALSYM GL_STACK_OVERFLOW} + GL_STACK_UNDERFLOW = $0504; + {$EXTERNALSYM GL_STACK_UNDERFLOW} + GL_OUT_OF_MEMORY = $0505; + {$EXTERNALSYM GL_STACK_UNDERFLOW} + + // attribute bits + GL_CURRENT_BIT = $00000001; + {$EXTERNALSYM GL_CURRENT_BIT} + GL_POINT_BIT = $00000002; + {$EXTERNALSYM GL_POINT_BIT} + GL_LINE_BIT = $00000004; + {$EXTERNALSYM GL_LINE_BIT} + GL_POLYGON_BIT = $00000008; + {$EXTERNALSYM GL_POLYGON_BIT} + GL_POLYGON_STIPPLE_BIT = $00000010; + {$EXTERNALSYM GL_POLYGON_STIPPLE_BIT} + GL_PIXEL_MODE_BIT = $00000020; + {$EXTERNALSYM GL_PIXEL_MODE_BIT} + GL_LIGHTING_BIT = $00000040; + {$EXTERNALSYM GL_LIGHTING_BIT} + GL_FOG_BIT = $00000080; + {$EXTERNALSYM GL_FOG_BIT} + GL_DEPTH_BUFFER_BIT = $00000100; + {$EXTERNALSYM GL_DEPTH_BUFFER_BIT} + GL_ACCUM_BUFFER_BIT = $00000200; + {$EXTERNALSYM GL_ACCUM_BUFFER_BIT} + GL_STENCIL_BUFFER_BIT = $00000400; + {$EXTERNALSYM GL_STENCIL_BUFFER_BIT} + GL_VIEWPORT_BIT = $00000800; + {$EXTERNALSYM GL_VIEWPORT_BIT} + GL_TRANSFORM_BIT = $00001000; + {$EXTERNALSYM GL_TRANSFORM_BIT} + GL_ENABLE_BIT = $00002000; + {$EXTERNALSYM GL_ENABLE_BIT} + GL_COLOR_BUFFER_BIT = $00004000; + {$EXTERNALSYM GL_COLOR_BUFFER_BIT} + GL_HINT_BIT = $00008000; + {$EXTERNALSYM GL_HINT_BIT} + GL_EVAL_BIT = $00010000; + {$EXTERNALSYM GL_EVAL_BIT} + GL_LIST_BIT = $00020000; + {$EXTERNALSYM GL_LIST_BIT} + GL_TEXTURE_BIT = $00040000; + {$EXTERNALSYM GL_TEXTURE_BIT} + GL_SCISSOR_BIT = $00080000; + {$EXTERNALSYM GL_SCISSOR_BIT} + GL_ALL_ATTRIB_BITS = $000FFFFF; + {$EXTERNALSYM GL_ALL_ATTRIB_BITS} + + // client attribute bits + GL_CLIENT_PIXEL_STORE_BIT = $00000001; + {$EXTERNALSYM GL_CLIENT_PIXEL_STORE_BIT} + GL_CLIENT_VERTEX_ARRAY_BIT = $00000002; + {$EXTERNALSYM GL_CLIENT_VERTEX_ARRAY_BIT} + GL_CLIENT_ALL_ATTRIB_BITS = $FFFFFFFF; + {$EXTERNALSYM GL_CLIENT_ALL_ATTRIB_BITS} + + // boolean values + GL_FALSE = Boolean( 0 ); + {$EXTERNALSYM GL_FALSE} + GL_TRUE = Boolean( 1 ); + {$EXTERNALSYM GL_TRUE} + + // primitives + GL_POINTS = $0000; + {$EXTERNALSYM GL_POINTS} + GL_LINES = $0001; + {$EXTERNALSYM GL_LINES} + GL_LINE_LOOP = $0002; + {$EXTERNALSYM GL_LINE_LOOP} + GL_LINE_STRIP = $0003; + {$EXTERNALSYM GL_LINE_STRIP} + GL_TRIANGLES = $0004; + {$EXTERNALSYM GL_TRIANGLES} + GL_TRIANGLE_STRIP = $0005; + {$EXTERNALSYM GL_TRIANGLE_STRIP} + GL_TRIANGLE_FAN = $0006; + {$EXTERNALSYM GL_TRIANGLE_FAN} + GL_QUADS = $0007; + {$EXTERNALSYM GL_QUADS} + GL_QUAD_STRIP = $0008; + {$EXTERNALSYM GL_QUAD_STRIP} + GL_POLYGON = $0009; + {$EXTERNALSYM GL_POLYGON} + + // blending + GL_ZERO = 0; + {$EXTERNALSYM GL_ZERO} + GL_ONE = 1; + {$EXTERNALSYM GL_ONE} + GL_SRC_COLOR = $0300; + {$EXTERNALSYM GL_SRC_COLOR} + GL_ONE_MINUS_SRC_COLOR = $0301; + {$EXTERNALSYM GL_ONE_MINUS_SRC_COLOR} + GL_SRC_ALPHA = $0302; + {$EXTERNALSYM GL_SRC_ALPHA} + GL_ONE_MINUS_SRC_ALPHA = $0303; + {$EXTERNALSYM GL_ONE_MINUS_SRC_ALPHA} + GL_DST_ALPHA = $0304; + {$EXTERNALSYM GL_DST_ALPHA} + GL_ONE_MINUS_DST_ALPHA = $0305; + {$EXTERNALSYM GL_ONE_MINUS_DST_ALPHA} + GL_DST_COLOR = $0306; + {$EXTERNALSYM GL_DST_COLOR} + GL_ONE_MINUS_DST_COLOR = $0307; + {$EXTERNALSYM GL_ONE_MINUS_DST_COLOR} + GL_SRC_ALPHA_SATURATE = $0308; + {$EXTERNALSYM GL_SRC_ALPHA_SATURATE} + GL_BLEND_DST = $0BE0; + {$EXTERNALSYM GL_BLEND_DST} + GL_BLEND_SRC = $0BE1; + {$EXTERNALSYM GL_BLEND_SRC} + GL_BLEND = $0BE2; + {$EXTERNALSYM GL_BLEND} + + // blending (GL 1.2 ARB imaging) + GL_BLEND_COLOR = $8005; + {$EXTERNALSYM GL_BLEND_COLOR} + GL_CONSTANT_COLOR = $8001; + {$EXTERNALSYM GL_CONSTANT_COLOR} + GL_ONE_MINUS_CONSTANT_COLOR = $8002; + {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_COLOR} + GL_CONSTANT_ALPHA = $8003; + {$EXTERNALSYM GL_CONSTANT_ALPHA} + GL_ONE_MINUS_CONSTANT_ALPHA = $8004; + {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_ALPHA} + GL_FUNC_ADD = $8006; + {$EXTERNALSYM GL_FUNC_ADD} + GL_MIN = $8007; + {$EXTERNALSYM GL_MIN} + GL_MAX = $8008; + {$EXTERNALSYM GL_MAX} + GL_FUNC_SUBTRACT = $800A; + {$EXTERNALSYM GL_FUNC_SUBTRACT} + GL_FUNC_REVERSE_SUBTRACT = $800B; + {$EXTERNALSYM GL_FUNC_REVERSE_SUBTRACT} + + // color table GL 1.2 ARB imaging + GL_COLOR_TABLE = $80D0; + {$EXTERNALSYM GL_COLOR_TABLE} + GL_POST_CONVOLUTION_COLOR_TABLE = $80D1; + {$EXTERNALSYM GL_POST_CONVOLUTION_COLOR_TABLE} + GL_POST_COLOR_MATRIX_COLOR_TABLE = $80D2; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_COLOR_TABLE} + GL_PROXY_COLOR_TABLE = $80D3; + {$EXTERNALSYM GL_PROXY_COLOR_TABLE} + GL_PROXY_POST_CONVOLUTION_COLOR_TABLE = $80D4; + {$EXTERNALSYM GL_PROXY_POST_CONVOLUTION_COLOR_TABLE} + GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE = $80D5; + {$EXTERNALSYM GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE} + GL_COLOR_TABLE_SCALE = $80D6; + {$EXTERNALSYM GL_COLOR_TABLE_SCALE} + GL_COLOR_TABLE_BIAS = $80D7; + {$EXTERNALSYM GL_COLOR_TABLE_BIAS} + GL_COLOR_TABLE_FORMAT = $80D8; + {$EXTERNALSYM GL_COLOR_TABLE_FORMAT} + GL_COLOR_TABLE_WIDTH = $80D9; + {$EXTERNALSYM GL_COLOR_TABLE_WIDTH} + GL_COLOR_TABLE_RED_SIZE = $80DA; + {$EXTERNALSYM GL_COLOR_TABLE_RED_SIZE} + GL_COLOR_TABLE_GREEN_SIZE = $80DB; + {$EXTERNALSYM GL_COLOR_TABLE_GREEN_SIZE} + GL_COLOR_TABLE_BLUE_SIZE = $80DC; + {$EXTERNALSYM GL_COLOR_TABLE_BLUE_SIZE} + GL_COLOR_TABLE_ALPHA_SIZE = $80DD; + {$EXTERNALSYM GL_COLOR_TABLE_ALPHA_SIZE} + GL_COLOR_TABLE_LUMINANCE_SIZE = $80DE; + {$EXTERNALSYM GL_COLOR_TABLE_LUMINANCE_SIZE} + GL_COLOR_TABLE_INTENSITY_SIZE = $80DF; + {$EXTERNALSYM GL_COLOR_TABLE_INTENSITY_SIZE} + + // convolutions GL 1.2 ARB imaging + GL_CONVOLUTION_1D = $8010; + {$EXTERNALSYM GL_CONVOLUTION_1D} + GL_CONVOLUTION_2D = $8011; + {$EXTERNALSYM GL_CONVOLUTION_2D} + GL_SEPARABLE_2D = $8012; + {$EXTERNALSYM GL_SEPARABLE_2D} + GL_CONVOLUTION_BORDER_MODE = $8013; + {$EXTERNALSYM GL_CONVOLUTION_BORDER_MODE} + GL_CONVOLUTION_FILTER_SCALE = $8014; + {$EXTERNALSYM GL_CONVOLUTION_FILTER_SCALE} + GL_CONVOLUTION_FILTER_BIAS = $8015; + {$EXTERNALSYM GL_CONVOLUTION_FILTER_BIAS} + GL_REDUCE = $8016; + {$EXTERNALSYM GL_REDUCE} + GL_CONVOLUTION_FORMAT = $8017; + {$EXTERNALSYM GL_CONVOLUTION_FORMAT} + GL_CONVOLUTION_WIDTH = $8018; + {$EXTERNALSYM GL_CONVOLUTION_WIDTH} + GL_CONVOLUTION_HEIGHT = $8019; + {$EXTERNALSYM GL_CONVOLUTION_HEIGHT} + GL_MAX_CONVOLUTION_WIDTH = $801A; + {$EXTERNALSYM GL_MAX_CONVOLUTION_WIDTH} + GL_MAX_CONVOLUTION_HEIGHT = $801B; + {$EXTERNALSYM GL_MAX_CONVOLUTION_HEIGHT} + GL_POST_CONVOLUTION_RED_SCALE = $801C; + {$EXTERNALSYM GL_POST_CONVOLUTION_RED_SCALE} + GL_POST_CONVOLUTION_GREEN_SCALE = $801D; + {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_SCALE} + GL_POST_CONVOLUTION_BLUE_SCALE = $801E; + {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_SCALE} + GL_POST_CONVOLUTION_ALPHA_SCALE = $801F; + {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_SCALE} + GL_POST_CONVOLUTION_RED_BIAS = $8020; + {$EXTERNALSYM GL_POST_CONVOLUTION_RED_BIAS} + GL_POST_CONVOLUTION_GREEN_BIAS = $8021; + {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_BIAS} + GL_POST_CONVOLUTION_BLUE_BIAS = $8022; + {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_BIAS} + GL_POST_CONVOLUTION_ALPHA_BIAS = $8023; + {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_BIAS} + + // histogram GL 1.2 ARB imaging + GL_HISTOGRAM = $8024; + {$EXTERNALSYM GL_HISTOGRAM} + GL_PROXY_HISTOGRAM = $8025; + {$EXTERNALSYM GL_PROXY_HISTOGRAM} + GL_HISTOGRAM_WIDTH = $8026; + {$EXTERNALSYM GL_HISTOGRAM_WIDTH} + GL_HISTOGRAM_FORMAT = $8027; + {$EXTERNALSYM GL_HISTOGRAM_FORMAT} + GL_HISTOGRAM_RED_SIZE = $8028; + {$EXTERNALSYM GL_HISTOGRAM_RED_SIZE} + GL_HISTOGRAM_GREEN_SIZE = $8029; + {$EXTERNALSYM GL_HISTOGRAM_GREEN_SIZE} + GL_HISTOGRAM_BLUE_SIZE = $802A; + {$EXTERNALSYM GL_HISTOGRAM_BLUE_SIZE} + GL_HISTOGRAM_ALPHA_SIZE = $802B; + {$EXTERNALSYM GL_HISTOGRAM_ALPHA_SIZE} + GL_HISTOGRAM_LUMINANCE_SIZE = $802C; + {$EXTERNALSYM GL_HISTOGRAM_LUMINANCE_SIZE} + GL_HISTOGRAM_SINK = $802D; + {$EXTERNALSYM GL_HISTOGRAM_SINK} + GL_MINMAX = $802E; + {$EXTERNALSYM GL_MINMAX} + GL_MINMAX_FORMAT = $802F; + {$EXTERNALSYM GL_MINMAX_FORMAT} + GL_MINMAX_SINK = $8030; + {$EXTERNALSYM GL_MINMAX_SINK} + + // buffers + GL_NONE = 0; + {$EXTERNALSYM GL_NONE} + GL_FRONT_LEFT = $0400; + {$EXTERNALSYM GL_FRONT_LEFT} + GL_FRONT_RIGHT = $0401; + {$EXTERNALSYM GL_FRONT_RIGHT} + GL_BACK_LEFT = $0402; + {$EXTERNALSYM GL_BACK_LEFT} + GL_BACK_RIGHT = $0403; + {$EXTERNALSYM GL_BACK_RIGHT} + GL_FRONT = $0404; + {$EXTERNALSYM GL_FRONT} + GL_BACK = $0405; + {$EXTERNALSYM GL_BACK} + GL_LEFT = $0406; + {$EXTERNALSYM GL_LEFT} + GL_RIGHT = $0407; + {$EXTERNALSYM GL_RIGHT} + GL_FRONT_AND_BACK = $0408; + {$EXTERNALSYM GL_FRONT_AND_BACK} + GL_AUX0 = $0409; + {$EXTERNALSYM GL_AUX0} + GL_AUX1 = $040A; + {$EXTERNALSYM GL_AUX1} + GL_AUX2 = $040B; + {$EXTERNALSYM GL_AUX2} + GL_AUX3 = $040C; + {$EXTERNALSYM GL_AUX3} + GL_AUX_BUFFERS = $0C00; + {$EXTERNALSYM GL_AUX_BUFFERS} + GL_DRAW_BUFFER = $0C01; + {$EXTERNALSYM GL_DRAW_BUFFER} + GL_READ_BUFFER = $0C02; + {$EXTERNALSYM GL_READ_BUFFER} + GL_DOUBLEBUFFER = $0C32; + {$EXTERNALSYM GL_DOUBLEBUFFER} + GL_STEREO = $0C33; + {$EXTERNALSYM GL_STEREO} + + // depth buffer + GL_DEPTH_RANGE = $0B70; + {$EXTERNALSYM GL_DEPTH_RANGE} + GL_DEPTH_TEST = $0B71; + {$EXTERNALSYM GL_DEPTH_TEST} + GL_DEPTH_WRITEMASK = $0B72; + {$EXTERNALSYM GL_DEPTH_WRITEMASK} + GL_DEPTH_CLEAR_VALUE = $0B73; + {$EXTERNALSYM GL_DEPTH_CLEAR_VALUE} + GL_DEPTH_FUNC = $0B74; + {$EXTERNALSYM GL_DEPTH_FUNC} + GL_NEVER = $0200; + {$EXTERNALSYM GL_NEVER} + GL_LESS = $0201; + {$EXTERNALSYM GL_LESS} + GL_EQUAL = $0202; + {$EXTERNALSYM GL_EQUAL} + GL_LEQUAL = $0203; + {$EXTERNALSYM GL_LEQUAL} + GL_GREATER = $0204; + {$EXTERNALSYM GL_GREATER} + GL_NOTEQUAL = $0205; + {$EXTERNALSYM GL_NOTEQUAL} + GL_GEQUAL = $0206; + {$EXTERNALSYM GL_GEQUAL} + GL_ALWAYS = $0207; + {$EXTERNALSYM GL_ALWAYS} + + // accumulation buffer + GL_ACCUM = $0100; + {$EXTERNALSYM GL_ACCUM} + GL_LOAD = $0101; + {$EXTERNALSYM GL_LOAD} + GL_RETURN = $0102; + {$EXTERNALSYM GL_RETURN} + GL_MULT = $0103; + {$EXTERNALSYM GL_MULT} + GL_ADD = $0104; + {$EXTERNALSYM GL_ADD} + GL_ACCUM_CLEAR_VALUE = $0B80; + {$EXTERNALSYM GL_ACCUM_CLEAR_VALUE} + + // feedback buffer + GL_FEEDBACK_BUFFER_POINTER = $0DF0; + {$EXTERNALSYM GL_FEEDBACK_BUFFER_POINTER} + GL_FEEDBACK_BUFFER_SIZE = $0DF1; + {$EXTERNALSYM GL_FEEDBACK_BUFFER_SIZE} + GL_FEEDBACK_BUFFER_TYPE = $0DF2; + {$EXTERNALSYM GL_FEEDBACK_BUFFER_TYPE} + + // feedback types + GL_2D = $0600; + {$EXTERNALSYM GL_2D} + GL_3D = $0601; + {$EXTERNALSYM GL_3D} + GL_3D_COLOR = $0602; + {$EXTERNALSYM GL_3D_COLOR} + GL_3D_COLOR_TEXTURE = $0603; + {$EXTERNALSYM GL_3D_COLOR_TEXTURE} + GL_4D_COLOR_TEXTURE = $0604; + {$EXTERNALSYM GL_4D_COLOR_TEXTURE} + + // feedback tokens + GL_PASS_THROUGH_TOKEN = $0700; + {$EXTERNALSYM GL_PASS_THROUGH_TOKEN} + GL_POINT_TOKEN = $0701; + {$EXTERNALSYM GL_POINT_TOKEN} + GL_LINE_TOKEN = $0702; + {$EXTERNALSYM GL_LINE_TOKEN} + GL_POLYGON_TOKEN = $0703; + {$EXTERNALSYM GL_POLYGON_TOKEN} + GL_BITMAP_TOKEN = $0704; + {$EXTERNALSYM GL_BITMAP_TOKEN} + GL_DRAW_PIXEL_TOKEN = $0705; + {$EXTERNALSYM GL_DRAW_PIXEL_TOKEN} + GL_COPY_PIXEL_TOKEN = $0706; + {$EXTERNALSYM GL_COPY_PIXEL_TOKEN} + GL_LINE_RESET_TOKEN = $0707; + {$EXTERNALSYM GL_LINE_RESET_TOKEN} + + // fog + GL_EXP = $0800; + {$EXTERNALSYM GL_EXP} + GL_EXP2 = $0801; + {$EXTERNALSYM GL_EXP2} + GL_FOG = $0B60; + {$EXTERNALSYM GL_FOG} + GL_FOG_INDEX = $0B61; + {$EXTERNALSYM GL_FOG_INDEX} + GL_FOG_DENSITY = $0B62; + {$EXTERNALSYM GL_FOG_DENSITY} + GL_FOG_START = $0B63; + {$EXTERNALSYM GL_FOG_START} + GL_FOG_END = $0B64; + {$EXTERNALSYM GL_FOG_END} + GL_FOG_MODE = $0B65; + {$EXTERNALSYM GL_FOG_MODE} + GL_FOG_COLOR = $0B66; + {$EXTERNALSYM GL_FOG_COLOR} + + // pixel mode, transfer + GL_PIXEL_MAP_I_TO_I = $0C70; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_I} + GL_PIXEL_MAP_S_TO_S = $0C71; + {$EXTERNALSYM GL_PIXEL_MAP_S_TO_S} + GL_PIXEL_MAP_I_TO_R = $0C72; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_R} + GL_PIXEL_MAP_I_TO_G = $0C73; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_G} + GL_PIXEL_MAP_I_TO_B = $0C74; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_B} + GL_PIXEL_MAP_I_TO_A = $0C75; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_A} + GL_PIXEL_MAP_R_TO_R = $0C76; + {$EXTERNALSYM GL_PIXEL_MAP_R_TO_R} + GL_PIXEL_MAP_G_TO_G = $0C77; + {$EXTERNALSYM GL_PIXEL_MAP_G_TO_G} + GL_PIXEL_MAP_B_TO_B = $0C78; + {$EXTERNALSYM GL_PIXEL_MAP_B_TO_B} + GL_PIXEL_MAP_A_TO_A = $0C79; + {$EXTERNALSYM GL_PIXEL_MAP_A_TO_A} + + // vertex arrays + GL_VERTEX_ARRAY_POINTER = $808E; + {$EXTERNALSYM GL_VERTEX_ARRAY_POINTER} + GL_NORMAL_ARRAY_POINTER = $808F; + {$EXTERNALSYM GL_NORMAL_ARRAY_POINTER} + GL_COLOR_ARRAY_POINTER = $8090; + {$EXTERNALSYM GL_COLOR_ARRAY_POINTER} + GL_INDEX_ARRAY_POINTER = $8091; + {$EXTERNALSYM GL_INDEX_ARRAY_POINTER} + GL_TEXTURE_COORD_ARRAY_POINTER = $8092; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_POINTER} + GL_EDGE_FLAG_ARRAY_POINTER = $8093; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_POINTER} + + // stenciling + GL_STENCIL_TEST = $0B90; + {$EXTERNALSYM GL_STENCIL_TEST} + GL_STENCIL_CLEAR_VALUE = $0B91; + {$EXTERNALSYM GL_STENCIL_CLEAR_VALUE} + GL_STENCIL_FUNC = $0B92; + {$EXTERNALSYM GL_STENCIL_FUNC} + GL_STENCIL_VALUE_MASK = $0B93; + {$EXTERNALSYM GL_STENCIL_VALUE_MASK} + GL_STENCIL_FAIL = $0B94; + {$EXTERNALSYM GL_STENCIL_FAIL} + GL_STENCIL_PASS_DEPTH_FAIL = $0B95; + {$EXTERNALSYM GL_STENCIL_PASS_DEPTH_FAIL} + GL_STENCIL_PASS_DEPTH_PASS = $0B96; + {$EXTERNALSYM GL_STENCIL_PASS_DEPTH_PASS} + GL_STENCIL_REF = $0B97; + {$EXTERNALSYM GL_STENCIL_REF} + GL_STENCIL_WRITEMASK = $0B98; + {$EXTERNALSYM GL_STENCIL_WRITEMASK} + GL_KEEP = $1E00; + {$EXTERNALSYM GL_KEEP} + GL_REPLACE = $1E01; + {$EXTERNALSYM GL_REPLACE} + GL_INCR = $1E02; + {$EXTERNALSYM GL_INCR} + GL_DECR = $1E03; + {$EXTERNALSYM GL_DECR} + + // color material + GL_COLOR_MATERIAL_FACE = $0B55; + {$EXTERNALSYM GL_COLOR_MATERIAL_FACE} + GL_COLOR_MATERIAL_PARAMETER = $0B56; + {$EXTERNALSYM GL_COLOR_MATERIAL_PARAMETER} + GL_COLOR_MATERIAL = $0B57; + {$EXTERNALSYM GL_COLOR_MATERIAL} + + // points + GL_POINT_SMOOTH = $0B10; + {$EXTERNALSYM GL_POINT_SMOOTH} + GL_POINT_SIZE = $0B11; + {$EXTERNALSYM GL_POINT_SIZE} + GL_POINT_SIZE_RANGE = $0B12; + {$EXTERNALSYM GL_POINT_SIZE_RANGE} + GL_POINT_SIZE_GRANULARITY = $0B13; + {$EXTERNALSYM GL_POINT_SIZE_GRANULARITY} + + // lines + GL_LINE_SMOOTH = $0B20; + {$EXTERNALSYM GL_LINE_SMOOTH} + GL_LINE_WIDTH = $0B21; + {$EXTERNALSYM GL_LINE_WIDTH} + GL_LINE_WIDTH_RANGE = $0B22; + {$EXTERNALSYM GL_LINE_WIDTH_RANGE} + GL_LINE_WIDTH_GRANULARITY = $0B23; + {$EXTERNALSYM GL_LINE_WIDTH_GRANULARITY} + GL_LINE_STIPPLE = $0B24; + {$EXTERNALSYM GL_LINE_STIPPLE} + GL_LINE_STIPPLE_PATTERN = $0B25; + {$EXTERNALSYM GL_LINE_STIPPLE_PATTERN} + GL_LINE_STIPPLE_REPEAT = $0B26; + {$EXTERNALSYM GL_LINE_STIPPLE_REPEAT} + + // polygons + GL_POLYGON_MODE = $0B40; + {$EXTERNALSYM GL_POLYGON_MODE} + GL_POLYGON_SMOOTH = $0B41; + {$EXTERNALSYM GL_POLYGON_SMOOTH} + GL_POLYGON_STIPPLE = $0B42; + {$EXTERNALSYM GL_POLYGON_STIPPLE} + GL_EDGE_FLAG = $0B43; + {$EXTERNALSYM GL_EDGE_FLAG} + GL_CULL_FACE = $0B44; + {$EXTERNALSYM GL_CULL_FACE} + GL_CULL_FACE_MODE = $0B45; + {$EXTERNALSYM GL_CULL_FACE_MODE} + GL_FRONT_FACE = $0B46; + {$EXTERNALSYM GL_FRONT_FACE} + GL_CW = $0900; + {$EXTERNALSYM GL_CW} + GL_CCW = $0901; + {$EXTERNALSYM GL_CCW} + GL_POINT = $1B00; + {$EXTERNALSYM GL_POINT} + GL_LINE = $1B01; + {$EXTERNALSYM GL_LINE} + GL_FILL = $1B02; + {$EXTERNALSYM GL_FILL} + + // display lists + GL_LIST_MODE = $0B30; + {$EXTERNALSYM GL_LIST_MODE} + GL_LIST_BASE = $0B32; + {$EXTERNALSYM GL_LIST_BASE} + GL_LIST_INDEX = $0B33; + {$EXTERNALSYM GL_LIST_INDEX} + GL_COMPILE = $1300; + {$EXTERNALSYM GL_COMPILE} + GL_COMPILE_AND_EXECUTE = $1301; + {$EXTERNALSYM GL_COMPILE_AND_EXECUTE} + + // lighting + GL_LIGHTING = $0B50; + {$EXTERNALSYM GL_LIGHTING} + GL_LIGHT_MODEL_LOCAL_VIEWER = $0B51; + {$EXTERNALSYM GL_LIGHT_MODEL_LOCAL_VIEWER} + GL_LIGHT_MODEL_TWO_SIDE = $0B52; + {$EXTERNALSYM GL_LIGHT_MODEL_TWO_SIDE} + GL_LIGHT_MODEL_AMBIENT = $0B53; + {$EXTERNALSYM GL_LIGHT_MODEL_AMBIENT} + GL_LIGHT_MODEL_COLOR_CONTROL = $81F8; // GL 1.2 + {$EXTERNALSYM GL_LIGHT_MODEL_COLOR_CONTROL} + GL_SHADE_MODEL = $0B54; + {$EXTERNALSYM GL_SHADE_MODEL} + GL_NORMALIZE = $0BA1; + {$EXTERNALSYM GL_NORMALIZE} + GL_AMBIENT = $1200; + {$EXTERNALSYM GL_AMBIENT} + GL_DIFFUSE = $1201; + {$EXTERNALSYM GL_DIFFUSE} + GL_SPECULAR = $1202; + {$EXTERNALSYM GL_SPECULAR} + GL_POSITION = $1203; + {$EXTERNALSYM GL_POSITION} + GL_SPOT_DIRECTION = $1204; + {$EXTERNALSYM GL_SPOT_DIRECTION} + GL_SPOT_EXPONENT = $1205; + {$EXTERNALSYM GL_SPOT_EXPONENT} + GL_SPOT_CUTOFF = $1206; + {$EXTERNALSYM GL_SPOT_CUTOFF} + GL_CONSTANT_ATTENUATION = $1207; + {$EXTERNALSYM GL_CONSTANT_ATTENUATION} + GL_LINEAR_ATTENUATION = $1208; + {$EXTERNALSYM GL_LINEAR_ATTENUATION} + GL_QUADRATIC_ATTENUATION = $1209; + {$EXTERNALSYM GL_QUADRATIC_ATTENUATION} + GL_EMISSION = $1600; + {$EXTERNALSYM GL_EMISSION} + GL_SHININESS = $1601; + {$EXTERNALSYM GL_SHININESS} + GL_AMBIENT_AND_DIFFUSE = $1602; + {$EXTERNALSYM GL_AMBIENT_AND_DIFFUSE} + GL_COLOR_INDEXES = $1603; + {$EXTERNALSYM GL_COLOR_INDEXES} + GL_FLAT = $1D00; + {$EXTERNALSYM GL_FLAT} + GL_SMOOTH = $1D01; + {$EXTERNALSYM GL_SMOOTH} + GL_LIGHT0 = $4000; + {$EXTERNALSYM GL_LIGHT0} + GL_LIGHT1 = $4001; + {$EXTERNALSYM GL_LIGHT1} + GL_LIGHT2 = $4002; + {$EXTERNALSYM GL_LIGHT2} + GL_LIGHT3 = $4003; + {$EXTERNALSYM GL_LIGHT3} + GL_LIGHT4 = $4004; + {$EXTERNALSYM GL_LIGHT4} + GL_LIGHT5 = $4005; + {$EXTERNALSYM GL_LIGHT5} + GL_LIGHT6 = $4006; + {$EXTERNALSYM GL_LIGHT6} + GL_LIGHT7 = $4007; + {$EXTERNALSYM GL_LIGHT7} + + // matrix modes + GL_MATRIX_MODE = $0BA0; + {$EXTERNALSYM GL_MATRIX_MODE} + GL_MODELVIEW = $1700; + {$EXTERNALSYM GL_MODELVIEW} + GL_PROJECTION = $1701; + {$EXTERNALSYM GL_PROJECTION} + GL_TEXTURE = $1702; + {$EXTERNALSYM GL_TEXTURE} + + // gets + GL_CURRENT_COLOR = $0B00; + {$EXTERNALSYM GL_CURRENT_COLOR} + GL_CURRENT_INDEX = $0B01; + {$EXTERNALSYM GL_CURRENT_INDEX} + GL_CURRENT_NORMAL = $0B02; + {$EXTERNALSYM GL_CURRENT_NORMAL} + GL_CURRENT_TEXTURE_COORDS = $0B03; + {$EXTERNALSYM GL_CURRENT_TEXTURE_COORDS} + GL_CURRENT_RASTER_COLOR = $0B04; + {$EXTERNALSYM GL_CURRENT_RASTER_COLOR} + GL_CURRENT_RASTER_INDEX = $0B05; + {$EXTERNALSYM GL_CURRENT_RASTER_INDEX} + GL_CURRENT_RASTER_TEXTURE_COORDS = $0B06; + {$EXTERNALSYM GL_CURRENT_RASTER_TEXTURE_COORDS} + GL_CURRENT_RASTER_POSITION = $0B07; + {$EXTERNALSYM GL_CURRENT_RASTER_POSITION} + GL_CURRENT_RASTER_POSITION_VALID = $0B08; + {$EXTERNALSYM GL_CURRENT_RASTER_POSITION_VALID} + GL_CURRENT_RASTER_DISTANCE = $0B09; + {$EXTERNALSYM GL_CURRENT_RASTER_DISTANCE} + GL_MAX_LIST_NESTING = $0B31; + {$EXTERNALSYM GL_MAX_LIST_NESTING} + GL_VIEWPORT = $0BA2; + {$EXTERNALSYM GL_VIEWPORT} + GL_MODELVIEW_STACK_DEPTH = $0BA3; + {$EXTERNALSYM GL_MODELVIEW_STACK_DEPTH} + GL_PROJECTION_STACK_DEPTH = $0BA4; + {$EXTERNALSYM GL_PROJECTION_STACK_DEPTH} + GL_TEXTURE_STACK_DEPTH = $0BA5; + {$EXTERNALSYM GL_TEXTURE_STACK_DEPTH} + GL_MODELVIEW_MATRIX = $0BA6; + {$EXTERNALSYM GL_MODELVIEW_MATRIX} + GL_PROJECTION_MATRIX = $0BA7; + {$EXTERNALSYM GL_PROJECTION_MATRIX} + GL_TEXTURE_MATRIX = $0BA8; + {$EXTERNALSYM GL_TEXTURE_MATRIX} + GL_ATTRIB_STACK_DEPTH = $0BB0; + {$EXTERNALSYM GL_ATTRIB_STACK_DEPTH} + GL_CLIENT_ATTRIB_STACK_DEPTH = $0BB1; + {$EXTERNALSYM GL_CLIENT_ATTRIB_STACK_DEPTH} + + GL_SINGLE_COLOR = $81F9; // GL 1.2 + {$EXTERNALSYM GL_SINGLE_COLOR} + GL_SEPARATE_SPECULAR_COLOR = $81FA; // GL 1.2 + {$EXTERNALSYM GL_SEPARATE_SPECULAR_COLOR} + + // alpha testing + GL_ALPHA_TEST = $0BC0; + {$EXTERNALSYM GL_ALPHA_TEST} + GL_ALPHA_TEST_FUNC = $0BC1; + {$EXTERNALSYM GL_ALPHA_TEST_FUNC} + GL_ALPHA_TEST_REF = $0BC2; + {$EXTERNALSYM GL_ALPHA_TEST_REF} + + GL_LOGIC_OP_MODE = $0BF0; + {$EXTERNALSYM GL_LOGIC_OP_MODE} + GL_INDEX_LOGIC_OP = $0BF1; + {$EXTERNALSYM GL_INDEX_LOGIC_OP} + GL_LOGIC_OP = $0BF1; + {$EXTERNALSYM GL_LOGIC_OP} + GL_COLOR_LOGIC_OP = $0BF2; + {$EXTERNALSYM GL_COLOR_LOGIC_OP} + GL_SCISSOR_BOX = $0C10; + {$EXTERNALSYM GL_SCISSOR_BOX} + GL_SCISSOR_TEST = $0C11; + {$EXTERNALSYM GL_SCISSOR_TEST} + GL_INDEX_CLEAR_VALUE = $0C20; + {$EXTERNALSYM GL_INDEX_CLEAR_VALUE} + GL_INDEX_WRITEMASK = $0C21; + {$EXTERNALSYM GL_INDEX_WRITEMASK} + GL_COLOR_CLEAR_VALUE = $0C22; + {$EXTERNALSYM GL_COLOR_CLEAR_VALUE} + GL_COLOR_WRITEMASK = $0C23; + {$EXTERNALSYM GL_COLOR_WRITEMASK} + GL_INDEX_MODE = $0C30; + {$EXTERNALSYM GL_INDEX_MODE} + GL_RGBA_MODE = $0C31; + {$EXTERNALSYM GL_RGBA_MODE} + GL_RENDER_MODE = $0C40; + {$EXTERNALSYM GL_RENDER_MODE} + GL_PERSPECTIVE_CORRECTION_HINT = $0C50; + {$EXTERNALSYM GL_PERSPECTIVE_CORRECTION_HINT} + GL_POINT_SMOOTH_HINT = $0C51; + {$EXTERNALSYM GL_POINT_SMOOTH_HINT} + GL_LINE_SMOOTH_HINT = $0C52; + {$EXTERNALSYM GL_LINE_SMOOTH_HINT} + GL_POLYGON_SMOOTH_HINT = $0C53; + {$EXTERNALSYM GL_POLYGON_SMOOTH_HINT} + GL_FOG_HINT = $0C54; + {$EXTERNALSYM GL_FOG_HINT} + GL_TEXTURE_GEN_S = $0C60; + {$EXTERNALSYM GL_TEXTURE_GEN_S} + GL_TEXTURE_GEN_T = $0C61; + {$EXTERNALSYM GL_TEXTURE_GEN_T} + GL_TEXTURE_GEN_R = $0C62; + {$EXTERNALSYM GL_TEXTURE_GEN_R} + GL_TEXTURE_GEN_Q = $0C63; + {$EXTERNALSYM GL_TEXTURE_GEN_Q} + GL_PIXEL_MAP_I_TO_I_SIZE = $0CB0; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_I_SIZE} + GL_PIXEL_MAP_S_TO_S_SIZE = $0CB1; + {$EXTERNALSYM GL_PIXEL_MAP_S_TO_S_SIZE} + GL_PIXEL_MAP_I_TO_R_SIZE = $0CB2; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_R_SIZE} + GL_PIXEL_MAP_I_TO_G_SIZE = $0CB3; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_G_SIZE} + GL_PIXEL_MAP_I_TO_B_SIZE = $0CB4; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_B_SIZE} + GL_PIXEL_MAP_I_TO_A_SIZE = $0CB5; + {$EXTERNALSYM GL_PIXEL_MAP_I_TO_A_SIZE} + GL_PIXEL_MAP_R_TO_R_SIZE = $0CB6; + {$EXTERNALSYM GL_PIXEL_MAP_R_TO_R_SIZE} + GL_PIXEL_MAP_G_TO_G_SIZE = $0CB7; + {$EXTERNALSYM GL_PIXEL_MAP_G_TO_G_SIZE} + GL_PIXEL_MAP_B_TO_B_SIZE = $0CB8; + {$EXTERNALSYM GL_PIXEL_MAP_B_TO_B_SIZE} + GL_PIXEL_MAP_A_TO_A_SIZE = $0CB9; + {$EXTERNALSYM GL_PIXEL_MAP_A_TO_A_SIZE} + GL_UNPACK_SWAP_BYTES = $0CF0; + {$EXTERNALSYM GL_UNPACK_SWAP_BYTES} + GL_UNPACK_LSB_FIRST = $0CF1; + {$EXTERNALSYM GL_UNPACK_LSB_FIRST} + GL_UNPACK_ROW_LENGTH = $0CF2; + {$EXTERNALSYM GL_UNPACK_ROW_LENGTH} + GL_UNPACK_SKIP_ROWS = $0CF3; + {$EXTERNALSYM GL_UNPACK_SKIP_ROWS} + GL_UNPACK_SKIP_PIXELS = $0CF4; + {$EXTERNALSYM GL_UNPACK_SKIP_PIXELS} + GL_UNPACK_ALIGNMENT = $0CF5; + {$EXTERNALSYM GL_UNPACK_ALIGNMENT} + GL_PACK_SWAP_BYTES = $0D00; + {$EXTERNALSYM GL_PACK_SWAP_BYTES} + GL_PACK_LSB_FIRST = $0D01; + {$EXTERNALSYM GL_PACK_LSB_FIRST} + GL_PACK_ROW_LENGTH = $0D02; + {$EXTERNALSYM GL_PACK_ROW_LENGTH} + GL_PACK_SKIP_ROWS = $0D03; + {$EXTERNALSYM GL_PACK_SKIP_ROWS} + GL_PACK_SKIP_PIXELS = $0D04; + {$EXTERNALSYM GL_PACK_SKIP_PIXELS} + GL_PACK_ALIGNMENT = $0D05; + {$EXTERNALSYM GL_PACK_ALIGNMENT} + GL_PACK_SKIP_IMAGES = $806B; // GL 1.2 + {$EXTERNALSYM GL_PACK_SKIP_IMAGES} + GL_PACK_IMAGE_HEIGHT = $806C; // GL 1.2 + {$EXTERNALSYM GL_PACK_IMAGE_HEIGHT} + GL_UNPACK_SKIP_IMAGES = $806D; // GL 1.2 + {$EXTERNALSYM GL_UNPACK_SKIP_IMAGES} + GL_UNPACK_IMAGE_HEIGHT = $806E; // GL 1.2 + {$EXTERNALSYM GL_UNPACK_IMAGE_HEIGHT} + GL_MAP_COLOR = $0D10; + {$EXTERNALSYM GL_MAP_COLOR} + GL_MAP_STENCIL = $0D11; + {$EXTERNALSYM GL_MAP_STENCIL} + GL_INDEX_SHIFT = $0D12; + {$EXTERNALSYM GL_INDEX_SHIFT} + GL_INDEX_OFFSET = $0D13; + {$EXTERNALSYM GL_INDEX_OFFSET} + GL_RED_SCALE = $0D14; + {$EXTERNALSYM GL_RED_SCALE} + GL_RED_BIAS = $0D15; + {$EXTERNALSYM GL_RED_BIAS} + GL_ZOOM_X = $0D16; + {$EXTERNALSYM GL_ZOOM_X} + GL_ZOOM_Y = $0D17; + {$EXTERNALSYM GL_ZOOM_Y} + GL_GREEN_SCALE = $0D18; + {$EXTERNALSYM GL_GREEN_SCALE} + GL_GREEN_BIAS = $0D19; + {$EXTERNALSYM GL_GREEN_BIAS} + GL_BLUE_SCALE = $0D1A; + {$EXTERNALSYM GL_BLUE_SCALE} + GL_BLUE_BIAS = $0D1B; + {$EXTERNALSYM GL_BLUE_BIAS} + GL_ALPHA_SCALE = $0D1C; + {$EXTERNALSYM GL_ALPHA_SCALE} + GL_ALPHA_BIAS = $0D1D; + {$EXTERNALSYM GL_ALPHA_BIAS} + GL_DEPTH_SCALE = $0D1E; + {$EXTERNALSYM GL_DEPTH_SCALE} + GL_DEPTH_BIAS = $0D1F; + {$EXTERNALSYM GL_DEPTH_BIAS} + GL_MAX_EVAL_ORDER = $0D30; + {$EXTERNALSYM GL_MAX_EVAL_ORDER} + GL_MAX_LIGHTS = $0D31; + {$EXTERNALSYM GL_MAX_LIGHTS} + GL_MAX_CLIP_PLANES = $0D32; + {$EXTERNALSYM GL_MAX_CLIP_PLANES} + GL_MAX_TEXTURE_SIZE = $0D33; + {$EXTERNALSYM GL_MAX_TEXTURE_SIZE} + GL_MAX_3D_TEXTURE_SIZE = $8073; // GL 1.2 + {$EXTERNALSYM GL_MAX_3D_TEXTURE_SIZE} + GL_MAX_PIXEL_MAP_TABLE = $0D34; + {$EXTERNALSYM GL_MAX_PIXEL_MAP_TABLE} + GL_MAX_ATTRIB_STACK_DEPTH = $0D35; + {$EXTERNALSYM GL_MAX_ATTRIB_STACK_DEPTH} + GL_MAX_MODELVIEW_STACK_DEPTH = $0D36; + {$EXTERNALSYM GL_MAX_MODELVIEW_STACK_DEPTH} + GL_MAX_NAME_STACK_DEPTH = $0D37; + {$EXTERNALSYM GL_MAX_NAME_STACK_DEPTH} + GL_MAX_PROJECTION_STACK_DEPTH = $0D38; + {$EXTERNALSYM GL_MAX_PROJECTION_STACK_DEPTH} + GL_MAX_TEXTURE_STACK_DEPTH = $0D39; + {$EXTERNALSYM GL_MAX_TEXTURE_STACK_DEPTH} + GL_MAX_VIEWPORT_DIMS = $0D3A; + {$EXTERNALSYM GL_MAX_VIEWPORT_DIMS} + GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = $0D3B; + {$EXTERNALSYM GL_MAX_CLIENT_ATTRIB_STACK_DEPTH} + GL_MAX_ELEMENTS_VERTICES = $80E8; // GL 1.2 + {$EXTERNALSYM GL_MAX_ELEMENTS_VERTICES} + GL_MAX_ELEMENTS_INDICES = $80E9; // GL 1.2 + {$EXTERNALSYM GL_MAX_ELEMENTS_INDICES} + GL_RESCALE_NORMAL = $803A; // GL 1.2 + {$EXTERNALSYM GL_RESCALE_NORMAL} + GL_SUBPIXEL_BITS = $0D50; + {$EXTERNALSYM GL_SUBPIXEL_BITS} + GL_INDEX_BITS = $0D51; + {$EXTERNALSYM GL_INDEX_BITS} + GL_RED_BITS = $0D52; + {$EXTERNALSYM GL_RED_BITS} + GL_GREEN_BITS = $0D53; + {$EXTERNALSYM GL_GREEN_BITS} + GL_BLUE_BITS = $0D54; + {$EXTERNALSYM GL_BLUE_BITS} + GL_ALPHA_BITS = $0D55; + {$EXTERNALSYM GL_ALPHA_BITS} + GL_DEPTH_BITS = $0D56; + {$EXTERNALSYM GL_DEPTH_BITS} + GL_STENCIL_BITS = $0D57; + {$EXTERNALSYM GL_STENCIL_BITS} + GL_ACCUM_RED_BITS = $0D58; + {$EXTERNALSYM GL_ACCUM_RED_BITS} + GL_ACCUM_GREEN_BITS = $0D59; + {$EXTERNALSYM GL_ACCUM_GREEN_BITS} + GL_ACCUM_BLUE_BITS = $0D5A; + {$EXTERNALSYM GL_ACCUM_BLUE_BITS} + GL_ACCUM_ALPHA_BITS = $0D5B; + {$EXTERNALSYM GL_ACCUM_ALPHA_BITS} + GL_NAME_STACK_DEPTH = $0D70; + {$EXTERNALSYM GL_NAME_STACK_DEPTH} + GL_AUTO_NORMAL = $0D80; + {$EXTERNALSYM GL_AUTO_NORMAL} + GL_MAP1_COLOR_4 = $0D90; + {$EXTERNALSYM GL_MAP1_COLOR_4} + GL_MAP1_INDEX = $0D91; + {$EXTERNALSYM GL_MAP1_INDEX} + GL_MAP1_NORMAL = $0D92; + {$EXTERNALSYM GL_MAP1_NORMAL} + GL_MAP1_TEXTURE_COORD_1 = $0D93; + {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_1} + GL_MAP1_TEXTURE_COORD_2 = $0D94; + {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_2} + GL_MAP1_TEXTURE_COORD_3 = $0D95; + {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_3} + GL_MAP1_TEXTURE_COORD_4 = $0D96; + {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_4} + GL_MAP1_VERTEX_3 = $0D97; + {$EXTERNALSYM GL_MAP1_VERTEX_3} + GL_MAP1_VERTEX_4 = $0D98; + {$EXTERNALSYM GL_MAP1_VERTEX_4} + GL_MAP2_COLOR_4 = $0DB0; + {$EXTERNALSYM GL_MAP2_COLOR_4} + GL_MAP2_INDEX = $0DB1; + {$EXTERNALSYM GL_MAP2_INDEX} + GL_MAP2_NORMAL = $0DB2; + {$EXTERNALSYM GL_MAP2_NORMAL} + GL_MAP2_TEXTURE_COORD_1 = $0DB3; + {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_1} + GL_MAP2_TEXTURE_COORD_2 = $0DB4; + {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_2} + GL_MAP2_TEXTURE_COORD_3 = $0DB5; + {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_3} + GL_MAP2_TEXTURE_COORD_4 = $0DB6; + {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_4} + GL_MAP2_VERTEX_3 = $0DB7; + {$EXTERNALSYM GL_MAP2_VERTEX_3} + GL_MAP2_VERTEX_4 = $0DB8; + {$EXTERNALSYM GL_MAP2_VERTEX_4} + GL_MAP1_GRID_DOMAIN = $0DD0; + {$EXTERNALSYM GL_MAP1_GRID_DOMAIN} + GL_MAP1_GRID_SEGMENTS = $0DD1; + {$EXTERNALSYM GL_MAP1_GRID_SEGMENTS} + GL_MAP2_GRID_DOMAIN = $0DD2; + {$EXTERNALSYM GL_MAP2_GRID_DOMAIN} + GL_MAP2_GRID_SEGMENTS = $0DD3; + {$EXTERNALSYM GL_MAP2_GRID_SEGMENTS} + GL_TEXTURE_1D = $0DE0; + {$EXTERNALSYM GL_TEXTURE_1D} + GL_TEXTURE_2D = $0DE1; + {$EXTERNALSYM GL_TEXTURE_2D} + GL_TEXTURE_3D = $806F; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_3D} + GL_SELECTION_BUFFER_POINTER = $0DF3; + {$EXTERNALSYM GL_SELECTION_BUFFER_POINTER} + GL_SELECTION_BUFFER_SIZE = $0DF4; + {$EXTERNALSYM GL_SELECTION_BUFFER_SIZE} + GL_POLYGON_OFFSET_UNITS = $2A00; + {$EXTERNALSYM GL_POLYGON_OFFSET_UNITS} + GL_POLYGON_OFFSET_POINT = $2A01; + {$EXTERNALSYM GL_POLYGON_OFFSET_POINT} + GL_POLYGON_OFFSET_LINE = $2A02; + {$EXTERNALSYM GL_POLYGON_OFFSET_LINE} + GL_POLYGON_OFFSET_FILL = $8037; + {$EXTERNALSYM GL_POLYGON_OFFSET_FILL} + GL_POLYGON_OFFSET_FACTOR = $8038; + {$EXTERNALSYM GL_POLYGON_OFFSET_FACTOR} + GL_TEXTURE_BINDING_1D = $8068; + {$EXTERNALSYM GL_TEXTURE_BINDING_1D} + GL_TEXTURE_BINDING_2D = $8069; + {$EXTERNALSYM GL_TEXTURE_BINDING_2D} + GL_VERTEX_ARRAY = $8074; + {$EXTERNALSYM GL_VERTEX_ARRAY} + GL_NORMAL_ARRAY = $8075; + {$EXTERNALSYM GL_NORMAL_ARRAY} + GL_COLOR_ARRAY = $8076; + {$EXTERNALSYM GL_COLOR_ARRAY} + GL_INDEX_ARRAY = $8077; + {$EXTERNALSYM GL_INDEX_ARRAY} + GL_TEXTURE_COORD_ARRAY = $8078; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY} + GL_EDGE_FLAG_ARRAY = $8079; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY} + GL_VERTEX_ARRAY_SIZE = $807A; + {$EXTERNALSYM GL_VERTEX_ARRAY_SIZE} + GL_VERTEX_ARRAY_TYPE = $807B; + {$EXTERNALSYM GL_VERTEX_ARRAY_TYPE} + GL_VERTEX_ARRAY_STRIDE = $807C; + {$EXTERNALSYM GL_VERTEX_ARRAY_STRIDE} + GL_NORMAL_ARRAY_TYPE = $807E; + {$EXTERNALSYM GL_NORMAL_ARRAY_TYPE} + GL_NORMAL_ARRAY_STRIDE = $807F; + {$EXTERNALSYM GL_NORMAL_ARRAY_STRIDE} + GL_COLOR_ARRAY_SIZE = $8081; + {$EXTERNALSYM GL_COLOR_ARRAY_SIZE} + GL_COLOR_ARRAY_TYPE = $8082; + {$EXTERNALSYM GL_COLOR_ARRAY_TYPE} + GL_COLOR_ARRAY_STRIDE = $8083; + {$EXTERNALSYM GL_COLOR_ARRAY_STRIDE} + GL_INDEX_ARRAY_TYPE = $8085; + {$EXTERNALSYM GL_INDEX_ARRAY_TYPE} + GL_INDEX_ARRAY_STRIDE = $8086; + {$EXTERNALSYM GL_INDEX_ARRAY_STRIDE} + GL_TEXTURE_COORD_ARRAY_SIZE = $8088; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_SIZE} + GL_TEXTURE_COORD_ARRAY_TYPE = $8089; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_TYPE} + GL_TEXTURE_COORD_ARRAY_STRIDE = $808A; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_STRIDE} + GL_EDGE_FLAG_ARRAY_STRIDE = $808C; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_STRIDE} + GL_COLOR_MATRIX = $80B1; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_COLOR_MATRIX} + GL_COLOR_MATRIX_STACK_DEPTH = $80B2; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_COLOR_MATRIX_STACK_DEPTH} + GL_MAX_COLOR_MATRIX_STACK_DEPTH = $80B3; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_MAX_COLOR_MATRIX_STACK_DEPTH} + GL_POST_COLOR_MATRIX_RED_SCALE = $80B4; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_SCALE} + GL_POST_COLOR_MATRIX_GREEN_SCALE = $80B5; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_SCALE} + GL_POST_COLOR_MATRIX_BLUE_SCALE = $80B6; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_SCALE} + GL_POST_COLOR_MATRIX_ALPHA_SCALE = $80B7; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_SCALE} + GL_POST_COLOR_MATRIX_RED_BIAS = $80B8; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_BIAS} + GL_POST_COLOR_MATRIX_GREEN_BIAS = $80B9; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_BIAS} + GL_POST_COLOR_MATRIX_BLUE_BIAS = $80BA; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_BIAS} + GL_POST_COLOR_MATRIX_ALPHA_BIAS = $80BB; // GL 1.2 ARB imaging + {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_BIAS} + + // evaluators + GL_COEFF = $0A00; + {$EXTERNALSYM GL_COEFF} + GL_ORDER = $0A01; + {$EXTERNALSYM GL_ORDER} + GL_DOMAIN = $0A02; + {$EXTERNALSYM GL_DOMAIN} + + // texture mapping + GL_TEXTURE_WIDTH = $1000; + {$EXTERNALSYM GL_TEXTURE_WIDTH} + GL_TEXTURE_HEIGHT = $1001; + {$EXTERNALSYM GL_TEXTURE_HEIGHT} + GL_TEXTURE_INTERNAL_FORMAT = $1003; + {$EXTERNALSYM GL_TEXTURE_INTERNAL_FORMAT} + GL_TEXTURE_COMPONENTS = $1003; + {$EXTERNALSYM GL_TEXTURE_COMPONENTS} + GL_TEXTURE_BORDER_COLOR = $1004; + {$EXTERNALSYM GL_TEXTURE_BORDER_COLOR} + GL_TEXTURE_BORDER = $1005; + {$EXTERNALSYM GL_TEXTURE_BORDER} + GL_TEXTURE_RED_SIZE = $805C; + {$EXTERNALSYM GL_TEXTURE_RED_SIZE} + GL_TEXTURE_GREEN_SIZE = $805D; + {$EXTERNALSYM GL_TEXTURE_GREEN_SIZE} + GL_TEXTURE_BLUE_SIZE = $805E; + {$EXTERNALSYM GL_TEXTURE_BLUE_SIZE} + GL_TEXTURE_ALPHA_SIZE = $805F; + {$EXTERNALSYM GL_TEXTURE_ALPHA_SIZE} + GL_TEXTURE_LUMINANCE_SIZE = $8060; + {$EXTERNALSYM GL_TEXTURE_LUMINANCE_SIZE} + GL_TEXTURE_INTENSITY_SIZE = $8061; + {$EXTERNALSYM GL_TEXTURE_INTENSITY_SIZE} + GL_TEXTURE_PRIORITY = $8066; + {$EXTERNALSYM GL_TEXTURE_PRIORITY} + GL_TEXTURE_RESIDENT = $8067; + {$EXTERNALSYM GL_TEXTURE_RESIDENT} + GL_BGR = $80E0; // v 1.2 + {$EXTERNALSYM GL_BGR} + GL_BGRA = $80E1; // v 1.2 + {$EXTERNALSYM GL_BGRA} + GL_S = $2000; + {$EXTERNALSYM GL_S} + GL_T = $2001; + {$EXTERNALSYM GL_T} + GL_R = $2002; + {$EXTERNALSYM GL_R} + GL_Q = $2003; + {$EXTERNALSYM GL_Q} + GL_MODULATE = $2100; + {$EXTERNALSYM GL_MODULATE} + GL_DECAL = $2101; + {$EXTERNALSYM GL_DECAL} + GL_TEXTURE_ENV_MODE = $2200; + {$EXTERNALSYM GL_TEXTURE_ENV_MODE} + GL_TEXTURE_ENV_COLOR = $2201; + {$EXTERNALSYM GL_TEXTURE_ENV_COLOR} + GL_TEXTURE_ENV = $2300; + {$EXTERNALSYM GL_TEXTURE_ENV} + GL_EYE_LINEAR = $2400; + {$EXTERNALSYM GL_EYE_LINEAR} + GL_OBJECT_LINEAR = $2401; + {$EXTERNALSYM GL_OBJECT_LINEAR} + GL_SPHERE_MAP = $2402; + {$EXTERNALSYM GL_SPHERE_MAP} + GL_TEXTURE_GEN_MODE = $2500; + {$EXTERNALSYM GL_TEXTURE_GEN_MODE} + GL_OBJECT_PLANE = $2501; + {$EXTERNALSYM GL_OBJECT_PLANE} + GL_EYE_PLANE = $2502; + {$EXTERNALSYM GL_EYE_PLANE} + GL_NEAREST = $2600; + {$EXTERNALSYM GL_NEAREST} + GL_LINEAR = $2601; + {$EXTERNALSYM GL_LINEAR} + GL_NEAREST_MIPMAP_NEAREST = $2700; + {$EXTERNALSYM GL_NEAREST_MIPMAP_NEAREST} + GL_LINEAR_MIPMAP_NEAREST = $2701; + {$EXTERNALSYM GL_LINEAR_MIPMAP_NEAREST} + GL_NEAREST_MIPMAP_LINEAR = $2702; + {$EXTERNALSYM GL_NEAREST_MIPMAP_LINEAR} + GL_LINEAR_MIPMAP_LINEAR = $2703; + {$EXTERNALSYM GL_LINEAR_MIPMAP_LINEAR} + GL_TEXTURE_MAG_FILTER = $2800; + {$EXTERNALSYM GL_TEXTURE_MAG_FILTER} + GL_TEXTURE_MIN_FILTER = $2801; + {$EXTERNALSYM GL_TEXTURE_MIN_FILTER} + GL_TEXTURE_WRAP_R = $8072; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_WRAP_R} + GL_TEXTURE_WRAP_S = $2802; + {$EXTERNALSYM GL_TEXTURE_WRAP_S} + GL_TEXTURE_WRAP_T = $2803; + {$EXTERNALSYM GL_TEXTURE_WRAP_T} + GL_CLAMP_TO_EDGE = $812F; // GL 1.2 + {$EXTERNALSYM GL_CLAMP_TO_EDGE} + GL_TEXTURE_MIN_LOD = $813A; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_MIN_LOD} + GL_TEXTURE_MAX_LOD = $813B; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_MAX_LOD} + GL_TEXTURE_BASE_LEVEL = $813C; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_BASE_LEVEL} + GL_TEXTURE_MAX_LEVEL = $813D; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_MAX_LEVEL} + GL_TEXTURE_DEPTH = $8071; // GL 1.2 + {$EXTERNALSYM GL_TEXTURE_DEPTH} + GL_PROXY_TEXTURE_1D = $8063; + {$EXTERNALSYM GL_PROXY_TEXTURE_1D} + GL_PROXY_TEXTURE_2D = $8064; + {$EXTERNALSYM GL_PROXY_TEXTURE_2D} + GL_PROXY_TEXTURE_3D = $8070; // GL 1.2 + {$EXTERNALSYM GL_PROXY_TEXTURE_3D} + GL_CLAMP = $2900; + {$EXTERNALSYM GL_CLAMP} + GL_REPEAT = $2901; + {$EXTERNALSYM GL_REPEAT} + + // hints + GL_DONT_CARE = $1100; + {$EXTERNALSYM GL_DONT_CARE} + GL_FASTEST = $1101; + {$EXTERNALSYM GL_FASTEST} + GL_NICEST = $1102; + {$EXTERNALSYM GL_NICEST} + + // data types + GL_BYTE = $1400; + {$EXTERNALSYM GL_BYTE} + GL_UNSIGNED_BYTE = $1401; + {$EXTERNALSYM GL_UNSIGNED_BYTE} + GL_SHORT = $1402; + {$EXTERNALSYM GL_SHORT} + GL_UNSIGNED_SHORT = $1403; + {$EXTERNALSYM GL_UNSIGNED_SHORT} + GL_INT = $1404; + {$EXTERNALSYM GL_INT} + GL_UNSIGNED_INT = $1405; + {$EXTERNALSYM GL_UNSIGNED_INT} + GL_FLOAT = $1406; + {$EXTERNALSYM GL_FLOAT} + GL_2_BYTES = $1407; + {$EXTERNALSYM GL_2_BYTES} + GL_3_BYTES = $1408; + {$EXTERNALSYM GL_3_BYTES} + GL_4_BYTES = $1409; + {$EXTERNALSYM GL_4_BYTES} + GL_DOUBLE = $140A; + {$EXTERNALSYM GL_DOUBLE} + GL_DOUBLE_EXT = $140A; + {$EXTERNALSYM GL_DOUBLE_EXT} + + // logic operations + GL_CLEAR = $1500; + {$EXTERNALSYM GL_CLEAR} + GL_AND = $1501; + {$EXTERNALSYM GL_AND} + GL_AND_REVERSE = $1502; + {$EXTERNALSYM GL_AND_REVERSE} + GL_COPY = $1503; + {$EXTERNALSYM GL_COPY} + GL_AND_INVERTED = $1504; + {$EXTERNALSYM GL_AND_INVERTED} + GL_NOOP = $1505; + {$EXTERNALSYM GL_NOOP} + GL_XOR = $1506; + {$EXTERNALSYM GL_XOR} + GL_OR = $1507; + {$EXTERNALSYM GL_OR} + GL_NOR = $1508; + {$EXTERNALSYM GL_NOR} + GL_EQUIV = $1509; + {$EXTERNALSYM GL_EQUIV} + GL_INVERT = $150A; + {$EXTERNALSYM GL_INVERT} + GL_OR_REVERSE = $150B; + {$EXTERNALSYM GL_OR_REVERSE} + GL_COPY_INVERTED = $150C; + {$EXTERNALSYM GL_COPY_INVERTED} + GL_OR_INVERTED = $150D; + {$EXTERNALSYM GL_OR_INVERTED} + GL_NAND = $150E; + {$EXTERNALSYM GL_NAND} + GL_SET = $150F; + {$EXTERNALSYM GL_SET} + + // PixelCopyType + GL_COLOR = $1800; + {$EXTERNALSYM GL_COLOR} + GL_DEPTH = $1801; + {$EXTERNALSYM GL_DEPTH} + GL_STENCIL = $1802; + {$EXTERNALSYM GL_STENCIL} + + // pixel formats + GL_COLOR_INDEX = $1900; + {$EXTERNALSYM GL_COLOR_INDEX} + GL_STENCIL_INDEX = $1901; + {$EXTERNALSYM GL_STENCIL_INDEX} + GL_DEPTH_COMPONENT = $1902; + {$EXTERNALSYM GL_DEPTH_COMPONENT} + GL_RED = $1903; + {$EXTERNALSYM GL_RED} + GL_GREEN = $1904; + {$EXTERNALSYM GL_GREEN} + GL_BLUE = $1905; + {$EXTERNALSYM GL_BLUE} + GL_ALPHA = $1906; + {$EXTERNALSYM GL_ALPHA} + GL_RGB = $1907; + {$EXTERNALSYM GL_RGB} + GL_RGBA = $1908; + {$EXTERNALSYM GL_RGBA} + GL_LUMINANCE = $1909; + {$EXTERNALSYM GL_LUMINANCE} + GL_LUMINANCE_ALPHA = $190A; + {$EXTERNALSYM GL_LUMINANCE_ALPHA} + + // pixel type + GL_BITMAP = $1A00; + {$EXTERNALSYM GL_BITMAP} + + // rendering modes + GL_RENDER = $1C00; + {$EXTERNALSYM GL_RENDER} + GL_FEEDBACK = $1C01; + {$EXTERNALSYM GL_FEEDBACK} + GL_SELECT = $1C02; + {$EXTERNALSYM GL_SELECT} + + // implementation strings + GL_VENDOR = $1F00; + {$EXTERNALSYM GL_VENDOR} + GL_RENDERER = $1F01; + {$EXTERNALSYM GL_RENDERER} + GL_VERSION = $1F02; + {$EXTERNALSYM GL_VERSION} + GL_EXTENSIONS = $1F03; + {$EXTERNALSYM GL_EXTENSIONS} + + // pixel formats + GL_R3_G3_B2 = $2A10; + {$EXTERNALSYM GL_R3_G3_B2} + GL_ALPHA4 = $803B; + {$EXTERNALSYM GL_ALPHA4} + GL_ALPHA8 = $803C; + {$EXTERNALSYM GL_ALPHA8} + GL_ALPHA12 = $803D; + {$EXTERNALSYM GL_ALPHA12} + GL_ALPHA16 = $803E; + {$EXTERNALSYM GL_ALPHA16} + GL_LUMINANCE4 = $803F; + {$EXTERNALSYM GL_LUMINANCE4} + GL_LUMINANCE8 = $8040; + {$EXTERNALSYM GL_LUMINANCE8} + GL_LUMINANCE12 = $8041; + {$EXTERNALSYM GL_LUMINANCE12} + GL_LUMINANCE16 = $8042; + {$EXTERNALSYM GL_LUMINANCE16} + GL_LUMINANCE4_ALPHA4 = $8043; + {$EXTERNALSYM GL_LUMINANCE4_ALPHA4} + GL_LUMINANCE6_ALPHA2 = $8044; + {$EXTERNALSYM GL_LUMINANCE6_ALPHA2} + GL_LUMINANCE8_ALPHA8 = $8045; + {$EXTERNALSYM GL_LUMINANCE8_ALPHA8} + GL_LUMINANCE12_ALPHA4 = $8046; + {$EXTERNALSYM GL_LUMINANCE12_ALPHA4} + GL_LUMINANCE12_ALPHA12 = $8047; + {$EXTERNALSYM GL_LUMINANCE12_ALPHA12} + GL_LUMINANCE16_ALPHA16 = $8048; + {$EXTERNALSYM GL_LUMINANCE16_ALPHA16} + GL_INTENSITY = $8049; + {$EXTERNALSYM GL_INTENSITY} + GL_INTENSITY4 = $804A; + {$EXTERNALSYM GL_INTENSITY4} + GL_INTENSITY8 = $804B; + {$EXTERNALSYM GL_INTENSITY8} + GL_INTENSITY12 = $804C; + {$EXTERNALSYM GL_INTENSITY12} + GL_INTENSITY16 = $804D; + {$EXTERNALSYM GL_INTENSITY16} + GL_RGB4 = $804F; + {$EXTERNALSYM GL_RGB4} + GL_RGB5 = $8050; + {$EXTERNALSYM GL_RGB5} + GL_RGB8 = $8051; + {$EXTERNALSYM GL_RGB8} + GL_RGB10 = $8052; + {$EXTERNALSYM GL_RGB10} + GL_RGB12 = $8053; + {$EXTERNALSYM GL_RGB12} + GL_RGB16 = $8054; + {$EXTERNALSYM GL_RGB16} + GL_RGBA2 = $8055; + {$EXTERNALSYM GL_RGBA2} + GL_RGBA4 = $8056; + {$EXTERNALSYM GL_RGBA4} + GL_RGB5_A1 = $8057; + {$EXTERNALSYM GL_RGB5_A1} + GL_RGBA8 = $8058; + {$EXTERNALSYM GL_RGBA8} + GL_RGB10_A2 = $8059; + {$EXTERNALSYM GL_RGB10_A2} + GL_RGBA12 = $805A; + {$EXTERNALSYM GL_RGBA12} + GL_RGBA16 = $805B; + {$EXTERNALSYM GL_RGBA16} + UNSIGNED_BYTE_3_3_2 = $8032; // GL 1.2 + {$EXTERNALSYM UNSIGNED_BYTE_3_3_2} + UNSIGNED_BYTE_2_3_3_REV = $8362; // GL 1.2 + {$EXTERNALSYM UNSIGNED_BYTE_2_3_3_REV} + UNSIGNED_SHORT_5_6_5 = $8363; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_5_6_5} + UNSIGNED_SHORT_5_6_5_REV = $8364; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_5_6_5_REV} + UNSIGNED_SHORT_4_4_4_4 = $8033; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_4_4_4_4} + UNSIGNED_SHORT_4_4_4_4_REV = $8365; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_4_4_4_4_REV} + UNSIGNED_SHORT_5_5_5_1 = $8034; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_5_5_5_1} + UNSIGNED_SHORT_1_5_5_5_REV = $8366; // GL 1.2 + {$EXTERNALSYM UNSIGNED_SHORT_1_5_5_5_REV} + UNSIGNED_INT_8_8_8_8 = $8035; // GL 1.2 + {$EXTERNALSYM UNSIGNED_INT_8_8_8_8} + UNSIGNED_INT_8_8_8_8_REV = $8367; // GL 1.2 + {$EXTERNALSYM UNSIGNED_INT_8_8_8_8_REV} + UNSIGNED_INT_10_10_10_2 = $8036; // GL 1.2 + {$EXTERNALSYM UNSIGNED_INT_10_10_10_2} + UNSIGNED_INT_2_10_10_10_REV = $8368; // GL 1.2 + {$EXTERNALSYM UNSIGNED_INT_2_10_10_10_REV} + + // interleaved arrays formats + GL_V2F = $2A20; + {$EXTERNALSYM GL_V2F} + GL_V3F = $2A21; + {$EXTERNALSYM GL_V3F} + GL_C4UB_V2F = $2A22; + {$EXTERNALSYM GL_C4UB_V2F} + GL_C4UB_V3F = $2A23; + {$EXTERNALSYM GL_C4UB_V3F} + GL_C3F_V3F = $2A24; + {$EXTERNALSYM GL_C3F_V3F} + GL_N3F_V3F = $2A25; + {$EXTERNALSYM GL_N3F_V3F} + GL_C4F_N3F_V3F = $2A26; + {$EXTERNALSYM GL_C4F_N3F_V3F} + GL_T2F_V3F = $2A27; + {$EXTERNALSYM GL_T2F_V3F} + GL_T4F_V4F = $2A28; + {$EXTERNALSYM GL_T4F_V4F} + GL_T2F_C4UB_V3F = $2A29; + {$EXTERNALSYM GL_T2F_C4UB_V3F} + GL_T2F_C3F_V3F = $2A2A; + {$EXTERNALSYM GL_T2F_C3F_V3F} + GL_T2F_N3F_V3F = $2A2B; + {$EXTERNALSYM GL_T2F_N3F_V3F} + GL_T2F_C4F_N3F_V3F = $2A2C; + {$EXTERNALSYM GL_T2F_C4F_N3F_V3F} + GL_T4F_C4F_N3F_V4F = $2A2D; + {$EXTERNALSYM GL_T4F_C4F_N3F_V4F} + + // clip planes + GL_CLIP_PLANE0 = $3000; + {$EXTERNALSYM GL_CLIP_PLANE0} + GL_CLIP_PLANE1 = $3001; + {$EXTERNALSYM GL_CLIP_PLANE1} + GL_CLIP_PLANE2 = $3002; + {$EXTERNALSYM GL_CLIP_PLANE2} + GL_CLIP_PLANE3 = $3003; + {$EXTERNALSYM GL_CLIP_PLANE3} + GL_CLIP_PLANE4 = $3004; + {$EXTERNALSYM GL_CLIP_PLANE4} + GL_CLIP_PLANE5 = $3005; + {$EXTERNALSYM GL_CLIP_PLANE5} + + // miscellaneous + GL_DITHER = $0BD0; + {$EXTERNALSYM GL_DITHER} + + // ----- extensions enumerants ----- + // EXT_abgr + GL_ABGR_EXT = $8000; + {$EXTERNALSYM GL_ABGR_EXT} + + // EXT_packed_pixels + GL_UNSIGNED_BYTE_3_3_2_EXT = $8032; + {$EXTERNALSYM GL_UNSIGNED_BYTE_3_3_2_EXT} + GL_UNSIGNED_SHORT_4_4_4_4_EXT = $8033; + {$EXTERNALSYM GL_UNSIGNED_SHORT_4_4_4_4_EXT} + GL_UNSIGNED_SHORT_5_5_5_1_EXT = $8034; + {$EXTERNALSYM GL_UNSIGNED_SHORT_5_5_5_1_EXT} + GL_UNSIGNED_INT_8_8_8_8_EXT = $8035; + {$EXTERNALSYM GL_UNSIGNED_INT_8_8_8_8_EXT} + GL_UNSIGNED_INT_10_10_10_2_EXT = $8036; + {$EXTERNALSYM GL_UNSIGNED_INT_10_10_10_2_EXT} + + // EXT_vertex_array + GL_VERTEX_ARRAY_EXT = $8074; + {$EXTERNALSYM GL_VERTEX_ARRAY_EXT} + GL_NORMAL_ARRAY_EXT = $8075; + {$EXTERNALSYM GL_NORMAL_ARRAY_EXT} + GL_COLOR_ARRAY_EXT = $8076; + {$EXTERNALSYM GL_COLOR_ARRAY_EXT} + GL_INDEX_ARRAY_EXT = $8077; + {$EXTERNALSYM GL_INDEX_ARRAY_EXT} + GL_TEXTURE_COORD_ARRAY_EXT = $8078; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_EXT} + GL_EDGE_FLAG_ARRAY_EXT = $8079; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_EXT} + GL_VERTEX_ARRAY_SIZE_EXT = $807A; + {$EXTERNALSYM GL_VERTEX_ARRAY_SIZE_EXT} + GL_VERTEX_ARRAY_TYPE_EXT = $807B; + {$EXTERNALSYM GL_VERTEX_ARRAY_TYPE_EXT} + GL_VERTEX_ARRAY_STRIDE_EXT = $807C; + {$EXTERNALSYM GL_VERTEX_ARRAY_STRIDE_EXT} + GL_VERTEX_ARRAY_COUNT_EXT = $807D; + {$EXTERNALSYM GL_VERTEX_ARRAY_COUNT_EXT} + GL_NORMAL_ARRAY_TYPE_EXT = $807E; + {$EXTERNALSYM GL_NORMAL_ARRAY_TYPE_EXT} + GL_NORMAL_ARRAY_STRIDE_EXT = $807F; + {$EXTERNALSYM GL_NORMAL_ARRAY_STRIDE_EXT} + GL_NORMAL_ARRAY_COUNT_EXT = $8080; + {$EXTERNALSYM GL_NORMAL_ARRAY_COUNT_EXT} + GL_COLOR_ARRAY_SIZE_EXT = $8081; + {$EXTERNALSYM GL_COLOR_ARRAY_SIZE_EXT} + GL_COLOR_ARRAY_TYPE_EXT = $8082; + {$EXTERNALSYM GL_COLOR_ARRAY_TYPE_EXT} + GL_COLOR_ARRAY_STRIDE_EXT = $8083; + {$EXTERNALSYM GL_COLOR_ARRAY_STRIDE_EXT} + GL_COLOR_ARRAY_COUNT_EXT = $8084; + {$EXTERNALSYM GL_COLOR_ARRAY_COUNT_EXT} + GL_INDEX_ARRAY_TYPE_EXT = $8085; + {$EXTERNALSYM GL_INDEX_ARRAY_TYPE_EXT} + GL_INDEX_ARRAY_STRIDE_EXT = $8086; + {$EXTERNALSYM GL_INDEX_ARRAY_STRIDE_EXT} + GL_INDEX_ARRAY_COUNT_EXT = $8087; + {$EXTERNALSYM GL_INDEX_ARRAY_COUNT_EXT} + GL_TEXTURE_COORD_ARRAY_SIZE_EXT = $8088; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_SIZE_EXT} + GL_TEXTURE_COORD_ARRAY_TYPE_EXT = $8089; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_TYPE_EXT} + GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = $808A; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_STRIDE_EXT} + GL_TEXTURE_COORD_ARRAY_COUNT_EXT = $808B; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_COUNT_EXT} + GL_EDGE_FLAG_ARRAY_STRIDE_EXT = $808C; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_STRIDE_EXT} + GL_EDGE_FLAG_ARRAY_COUNT_EXT = $808D; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_COUNT_EXT} + GL_VERTEX_ARRAY_POINTER_EXT = $808E; + {$EXTERNALSYM GL_VERTEX_ARRAY_POINTER_EXT} + GL_NORMAL_ARRAY_POINTER_EXT = $808F; + {$EXTERNALSYM GL_NORMAL_ARRAY_POINTER_EXT} + GL_COLOR_ARRAY_POINTER_EXT = $8090; + {$EXTERNALSYM GL_COLOR_ARRAY_POINTER_EXT} + GL_INDEX_ARRAY_POINTER_EXT = $8091; + {$EXTERNALSYM GL_INDEX_ARRAY_POINTER_EXT} + GL_TEXTURE_COORD_ARRAY_POINTER_EXT = $8092; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_POINTER_EXT} + GL_EDGE_FLAG_ARRAY_POINTER_EXT = $8093; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_POINTER_EXT} + + // EXT_color_table + GL_TABLE_TOO_LARGE_EXT = $8031; + {$EXTERNALSYM GL_TABLE_TOO_LARGE_EXT} + GL_COLOR_TABLE_EXT = $80D0; + {$EXTERNALSYM GL_COLOR_TABLE_EXT} + GL_POST_CONVOLUTION_COLOR_TABLE_EXT = $80D1; + {$EXTERNALSYM GL_POST_CONVOLUTION_COLOR_TABLE_EXT} + GL_POST_COLOR_MATRIX_COLOR_TABLE_EXT = $80D2; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_COLOR_TABLE_EXT} + GL_PROXY_COLOR_TABLE_EXT = $80D3; + {$EXTERNALSYM GL_PROXY_COLOR_TABLE_EXT} + GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_EXT = $80D4; + {$EXTERNALSYM GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_EXT} + GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_EXT = $80D5; + {$EXTERNALSYM GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_EXT} + GL_COLOR_TABLE_SCALE_EXT = $80D6; + {$EXTERNALSYM GL_COLOR_TABLE_SCALE_EXT} + GL_COLOR_TABLE_BIAS_EXT = $80D7; + {$EXTERNALSYM GL_COLOR_TABLE_BIAS_EXT} + GL_COLOR_TABLE_FORMAT_EXT = $80D8; + {$EXTERNALSYM GL_COLOR_TABLE_FORMAT_EXT} + GL_COLOR_TABLE_WIDTH_EXT = $80D9; + {$EXTERNALSYM GL_COLOR_TABLE_WIDTH_EXT} + GL_COLOR_TABLE_RED_SIZE_EXT = $80DA; + {$EXTERNALSYM GL_COLOR_TABLE_RED_SIZE_EXT} + GL_COLOR_TABLE_GREEN_SIZE_EXT = $80DB; + {$EXTERNALSYM GL_COLOR_TABLE_GREEN_SIZE_EXT} + GL_COLOR_TABLE_BLUE_SIZE_EXT = $80DC; + {$EXTERNALSYM GL_COLOR_TABLE_BLUE_SIZE_EXT} + GL_COLOR_TABLE_ALPHA_SIZE_EXT = $80DD; + {$EXTERNALSYM GL_COLOR_TABLE_ALPHA_SIZE_EXT} + GL_COLOR_TABLE_LUMINANCE_SIZE_EXT = $80DE; + {$EXTERNALSYM GL_COLOR_TABLE_LUMINANCE_SIZE_EXT} + GL_COLOR_TABLE_INTENSITY_SIZE_EXT = $80DF; + {$EXTERNALSYM GL_COLOR_TABLE_INTENSITY_SIZE_EXT} + + // EXT_bgra + GL_BGR_EXT = $80E0; + {$EXTERNALSYM GL_BGR_EXT} + GL_BGRA_EXT = $80E1; + {$EXTERNALSYM GL_BGRA_EXT} + + // EXT_paletted_texture + GL_COLOR_INDEX1_EXT = $80E2; + {$EXTERNALSYM GL_COLOR_INDEX1_EXT} + GL_COLOR_INDEX2_EXT = $80E3; + {$EXTERNALSYM GL_COLOR_INDEX2_EXT} + GL_COLOR_INDEX4_EXT = $80E4; + {$EXTERNALSYM GL_COLOR_INDEX4_EXT} + GL_COLOR_INDEX8_EXT = $80E5; + {$EXTERNALSYM GL_COLOR_INDEX8_EXT} + GL_COLOR_INDEX12_EXT = $80E6; + {$EXTERNALSYM GL_COLOR_INDEX12_EXT} + GL_COLOR_INDEX16_EXT = $80E7; + {$EXTERNALSYM GL_COLOR_INDEX16_EXT} + + // EXT_blend_color + GL_CONSTANT_COLOR_EXT = $8001; + {$EXTERNALSYM GL_CONSTANT_COLOR_EXT} + GL_ONE_MINUS_CONSTANT_COLOR_EXT = $8002; + {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_COLOR_EXT} + GL_CONSTANT_ALPHA_EXT = $8003; + {$EXTERNALSYM GL_CONSTANT_ALPHA_EXT} + GL_ONE_MINUS_CONSTANT_ALPHA_EXT = $8004; + {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_ALPHA_EXT} + GL_BLEND_COLOR_EXT = $8005; + {$EXTERNALSYM GL_BLEND_COLOR_EXT} + + // EXT_blend_minmax + GL_FUNC_ADD_EXT = $8006; + {$EXTERNALSYM GL_FUNC_ADD_EXT} + GL_MIN_EXT = $8007; + {$EXTERNALSYM GL_MIN_EXT} + GL_MAX_EXT = $8008; + {$EXTERNALSYM GL_MAX_EXT} + GL_BLEND_EQUATION_EXT = $8009; + {$EXTERNALSYM GL_BLEND_EQUATION_EXT} + + // EXT_blend_subtract + GL_FUNC_SUBTRACT_EXT = $800A; + {$EXTERNALSYM GL_FUNC_SUBTRACT_EXT} + GL_FUNC_REVERSE_SUBTRACT_EXT = $800B; + {$EXTERNALSYM GL_FUNC_REVERSE_SUBTRACT_EXT} + + // EXT_convolution + GL_CONVOLUTION_1D_EXT = $8010; + {$EXTERNALSYM GL_CONVOLUTION_1D_EXT} + GL_CONVOLUTION_2D_EXT = $8011; + {$EXTERNALSYM GL_CONVOLUTION_2D_EXT} + GL_SEPARABLE_2D_EXT = $8012; + {$EXTERNALSYM GL_SEPARABLE_2D_EXT} + GL_CONVOLUTION_BORDER_MODE_EXT = $8013; + {$EXTERNALSYM GL_CONVOLUTION_BORDER_MODE_EXT} + GL_CONVOLUTION_FILTER_SCALE_EXT = $8014; + {$EXTERNALSYM GL_CONVOLUTION_FILTER_SCALE_EXT} + GL_CONVOLUTION_FILTER_BIAS_EXT = $8015; + {$EXTERNALSYM GL_CONVOLUTION_FILTER_BIAS_EXT} + GL_REDUCE_EXT = $8016; + {$EXTERNALSYM GL_REDUCE_EXT} + GL_CONVOLUTION_FORMAT_EXT = $8017; + {$EXTERNALSYM GL_CONVOLUTION_FORMAT_EXT} + GL_CONVOLUTION_WIDTH_EXT = $8018; + {$EXTERNALSYM GL_CONVOLUTION_WIDTH_EXT} + GL_CONVOLUTION_HEIGHT_EXT = $8019; + {$EXTERNALSYM GL_CONVOLUTION_HEIGHT_EXT} + GL_MAX_CONVOLUTION_WIDTH_EXT = $801A; + {$EXTERNALSYM GL_MAX_CONVOLUTION_WIDTH_EXT} + GL_MAX_CONVOLUTION_HEIGHT_EXT = $801B; + {$EXTERNALSYM GL_MAX_CONVOLUTION_HEIGHT_EXT} + GL_POST_CONVOLUTION_RED_SCALE_EXT = $801C; + {$EXTERNALSYM GL_POST_CONVOLUTION_RED_SCALE_EXT} + GL_POST_CONVOLUTION_GREEN_SCALE_EXT = $801D; + {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_SCALE_EXT} + GL_POST_CONVOLUTION_BLUE_SCALE_EXT = $801E; + {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_SCALE_EXT} + GL_POST_CONVOLUTION_ALPHA_SCALE_EXT = $801F; + {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_SCALE_EXT} + GL_POST_CONVOLUTION_RED_BIAS_EXT = $8020; + {$EXTERNALSYM GL_POST_CONVOLUTION_RED_BIAS_EXT} + GL_POST_CONVOLUTION_GREEN_BIAS_EXT = $8021; + {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_BIAS_EXT} + GL_POST_CONVOLUTION_BLUE_BIAS_EXT = $8022; + {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_BIAS_EXT} + GL_POST_CONVOLUTION_ALPHA_BIAS_EXT = $8023; + {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_BIAS_EXT} + + // EXT_histogram + GL_HISTOGRAM_EXT = $8024; + {$EXTERNALSYM GL_HISTOGRAM_EXT} + GL_PROXY_HISTOGRAM_EXT = $8025; + {$EXTERNALSYM GL_PROXY_HISTOGRAM_EXT} + GL_HISTOGRAM_WIDTH_EXT = $8026; + {$EXTERNALSYM GL_HISTOGRAM_WIDTH_EXT} + GL_HISTOGRAM_FORMAT_EXT = $8027; + {$EXTERNALSYM GL_HISTOGRAM_FORMAT_EXT} + GL_HISTOGRAM_RED_SIZE_EXT = $8028; + {$EXTERNALSYM GL_HISTOGRAM_RED_SIZE_EXT} + GL_HISTOGRAM_GREEN_SIZE_EXT = $8029; + {$EXTERNALSYM GL_HISTOGRAM_GREEN_SIZE_EXT} + GL_HISTOGRAM_BLUE_SIZE_EXT = $802A; + {$EXTERNALSYM GL_HISTOGRAM_BLUE_SIZE_EXT} + GL_HISTOGRAM_ALPHA_SIZE_EXT = $802B; + {$EXTERNALSYM GL_HISTOGRAM_ALPHA_SIZE_EXT} + GL_HISTOGRAM_LUMINANCE_SIZE_EXT = $802C; + {$EXTERNALSYM GL_HISTOGRAM_LUMINANCE_SIZE_EXT} + GL_HISTOGRAM_SINK_EXT = $802D; + {$EXTERNALSYM GL_HISTOGRAM_SINK_EXT} + GL_MINMAX_EXT = $802E; + {$EXTERNALSYM GL_MINMAX_EXT} + GL_MINMAX_FORMAT_EXT = $802F; + {$EXTERNALSYM GL_MINMAX_FORMAT_EXT} + GL_MINMAX_SINK_EXT = $8030; + {$EXTERNALSYM GL_MINMAX_SINK_EXT} + + // EXT_polygon_offset + GL_POLYGON_OFFSET_EXT = $8037; + {$EXTERNALSYM GL_POLYGON_OFFSET_EXT} + GL_POLYGON_OFFSET_FACTOR_EXT = $8038; + {$EXTERNALSYM GL_POLYGON_OFFSET_FACTOR_EXT} + GL_POLYGON_OFFSET_BIAS_EXT = $8039; + {$EXTERNALSYM GL_POLYGON_OFFSET_BIAS_EXT} + + // EXT_texture + GL_ALPHA4_EXT = $803B; + {$EXTERNALSYM GL_ALPHA4_EXT} + GL_ALPHA8_EXT = $803C; + {$EXTERNALSYM GL_ALPHA8_EXT} + GL_ALPHA12_EXT = $803D; + {$EXTERNALSYM GL_ALPHA12_EXT} + GL_ALPHA16_EXT = $803E; + {$EXTERNALSYM GL_ALPHA16_EXT} + GL_LUMINANCE4_EXT = $803F; + {$EXTERNALSYM GL_LUMINANCE4_EXT} + GL_LUMINANCE8_EXT = $8040; + {$EXTERNALSYM GL_LUMINANCE8_EXT} + GL_LUMINANCE12_EXT = $8041; + {$EXTERNALSYM GL_LUMINANCE12_EXT} + GL_LUMINANCE16_EXT = $8042; + {$EXTERNALSYM GL_LUMINANCE16_EXT} + GL_LUMINANCE4_ALPHA4_EXT = $8043; + {$EXTERNALSYM GL_LUMINANCE4_ALPHA4_EXT} + GL_LUMINANCE6_ALPHA2_EXT = $8044; + {$EXTERNALSYM GL_LUMINANCE6_ALPHA2_EXT} + GL_LUMINANCE8_ALPHA8_EXT = $8045; + {$EXTERNALSYM GL_LUMINANCE8_ALPHA8_EXT} + GL_LUMINANCE12_ALPHA4_EXT = $8046; + {$EXTERNALSYM GL_LUMINANCE12_ALPHA4_EXT} + GL_LUMINANCE12_ALPHA12_EXT = $8047; + {$EXTERNALSYM GL_LUMINANCE12_ALPHA12_EXT} + GL_LUMINANCE16_ALPHA16_EXT = $8048; + {$EXTERNALSYM GL_LUMINANCE16_ALPHA16_EXT} + GL_INTENSITY_EXT = $8049; + {$EXTERNALSYM GL_INTENSITY_EXT} + GL_INTENSITY4_EXT = $804A; + {$EXTERNALSYM GL_INTENSITY4_EXT} + GL_INTENSITY8_EXT = $804B; + {$EXTERNALSYM GL_INTENSITY8_EXT} + GL_INTENSITY12_EXT = $804C; + {$EXTERNALSYM GL_INTENSITY12_EXT} + GL_INTENSITY16_EXT = $804D; + {$EXTERNALSYM GL_INTENSITY16_EXT} + GL_RGB2_EXT = $804E; + {$EXTERNALSYM GL_RGB2_EXT} + GL_RGB4_EXT = $804F; + {$EXTERNALSYM GL_RGB4_EXT} + GL_RGB5_EXT = $8050; + {$EXTERNALSYM GL_RGB5_EXT} + GL_RGB8_EXT = $8051; + {$EXTERNALSYM GL_RGB8_EXT} + GL_RGB10_EXT = $8052; + {$EXTERNALSYM GL_RGB10_EXT} + GL_RGB12_EXT = $8053; + {$EXTERNALSYM GL_RGB12_EXT} + GL_RGB16_EXT = $8054; + {$EXTERNALSYM GL_RGB16_EXT} + GL_RGBA2_EXT = $8055; + {$EXTERNALSYM GL_RGBA2_EXT} + GL_RGBA4_EXT = $8056; + {$EXTERNALSYM GL_RGBA4_EXT} + GL_RGB5_A1_EXT = $8057; + {$EXTERNALSYM GL_RGB5_A1_EXT} + GL_RGBA8_EXT = $8058; + {$EXTERNALSYM GL_RGBA8_EXT} + GL_RGB10_A2_EXT = $8059; + {$EXTERNALSYM GL_RGB10_A2_EXT} + GL_RGBA12_EXT = $805A; + {$EXTERNALSYM GL_RGBA12_EXT} + GL_RGBA16_EXT = $805B; + {$EXTERNALSYM GL_RGBA16_EXT} + GL_TEXTURE_RED_SIZE_EXT = $805C; + {$EXTERNALSYM GL_TEXTURE_RED_SIZE_EXT} + GL_TEXTURE_GREEN_SIZE_EXT = $805D; + {$EXTERNALSYM GL_TEXTURE_GREEN_SIZE_EXT} + GL_TEXTURE_BLUE_SIZE_EXT = $805E; + {$EXTERNALSYM GL_TEXTURE_BLUE_SIZE_EXT} + GL_TEXTURE_ALPHA_SIZE_EXT = $805F; + {$EXTERNALSYM GL_TEXTURE_ALPHA_SIZE_EXT} + GL_TEXTURE_LUMINANCE_SIZE_EXT = $8060; + {$EXTERNALSYM GL_TEXTURE_LUMINANCE_SIZE_EXT} + GL_TEXTURE_INTENSITY_SIZE_EXT = $8061; + {$EXTERNALSYM GL_TEXTURE_INTENSITY_SIZE_EXT} + GL_REPLACE_EXT = $8062; + {$EXTERNALSYM GL_REPLACE_EXT} + GL_PROXY_TEXTURE_1D_EXT = $8063; + {$EXTERNALSYM GL_PROXY_TEXTURE_1D_EXT} + GL_PROXY_TEXTURE_2D_EXT = $8064; + {$EXTERNALSYM GL_PROXY_TEXTURE_2D_EXT} + GL_TEXTURE_TOO_LARGE_EXT = $8065; + {$EXTERNALSYM GL_TEXTURE_TOO_LARGE_EXT} + + // EXT_texture_object + GL_TEXTURE_PRIORITY_EXT = $8066; + {$EXTERNALSYM GL_TEXTURE_PRIORITY_EXT} + GL_TEXTURE_RESIDENT_EXT = $8067; + {$EXTERNALSYM GL_TEXTURE_RESIDENT_EXT} + GL_TEXTURE_1D_BINDING_EXT = $8068; + {$EXTERNALSYM GL_TEXTURE_1D_BINDING_EXT} + GL_TEXTURE_2D_BINDING_EXT = $8069; + {$EXTERNALSYM GL_TEXTURE_2D_BINDING_EXT} + GL_TEXTURE_3D_BINDING_EXT = $806A; + {$EXTERNALSYM GL_TEXTURE_3D_BINDING_EXT} + + // EXT_texture3D + GL_PACK_SKIP_IMAGES_EXT = $806B; + {$EXTERNALSYM GL_PACK_SKIP_IMAGES_EXT} + GL_PACK_IMAGE_HEIGHT_EXT = $806C; + {$EXTERNALSYM GL_PACK_IMAGE_HEIGHT_EXT} + GL_UNPACK_SKIP_IMAGES_EXT = $806D; + {$EXTERNALSYM GL_UNPACK_SKIP_IMAGES_EXT} + GL_UNPACK_IMAGE_HEIGHT_EXT = $806E; + {$EXTERNALSYM GL_UNPACK_IMAGE_HEIGHT_EXT} + GL_TEXTURE_3D_EXT = $806F; + {$EXTERNALSYM GL_TEXTURE_3D_EXT} + GL_PROXY_TEXTURE_3D_EXT = $8070; + {$EXTERNALSYM GL_PROXY_TEXTURE_3D_EXT} + GL_TEXTURE_DEPTH_EXT = $8071; + {$EXTERNALSYM GL_TEXTURE_DEPTH_EXT} + GL_TEXTURE_WRAP_R_EXT = $8072; + {$EXTERNALSYM GL_TEXTURE_WRAP_R_EXT} + GL_MAX_3D_TEXTURE_SIZE_EXT = $8073; + {$EXTERNALSYM GL_MAX_3D_TEXTURE_SIZE_EXT} + + // SGI_color_matrix + GL_COLOR_MATRIX_SGI = $80B1; + {$EXTERNALSYM GL_COLOR_MATRIX_SGI} + GL_COLOR_MATRIX_STACK_DEPTH_SGI = $80B2; + {$EXTERNALSYM GL_COLOR_MATRIX_STACK_DEPTH_SGI} + GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI = $80B3; + {$EXTERNALSYM GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI} + GL_POST_COLOR_MATRIX_RED_SCALE_SGI = $80B4; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_SCALE_SGI} + GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI = $80B5; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI} + GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI = $80B6; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI} + GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI = $80B7; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI} + GL_POST_COLOR_MATRIX_RED_BIAS_SGI = $80B8; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_BIAS_SGI} + GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI = $80B9; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI} + GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI = $80BA; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI} + GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI = $80BB; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI} + + // SGI_texture_color_table + GL_TEXTURE_COLOR_TABLE_SGI = $80BC; + {$EXTERNALSYM GL_TEXTURE_COLOR_TABLE_SGI} + GL_PROXY_TEXTURE_COLOR_TABLE_SGI = $80BD; + {$EXTERNALSYM GL_PROXY_TEXTURE_COLOR_TABLE_SGI} + GL_TEXTURE_COLOR_TABLE_BIAS_SGI = $80BE; + {$EXTERNALSYM GL_TEXTURE_COLOR_TABLE_BIAS_SGI} + GL_TEXTURE_COLOR_TABLE_SCALE_SGI = $80BF; + {$EXTERNALSYM GL_TEXTURE_COLOR_TABLE_SCALE_SGI} + + // SGI_color_table + GL_COLOR_TABLE_SGI = $80D0; + {$EXTERNALSYM GL_COLOR_TABLE_SGI} + GL_POST_CONVOLUTION_COLOR_TABLE_SGI = $80D1; + {$EXTERNALSYM GL_POST_CONVOLUTION_COLOR_TABLE_SGI} + GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI = $80D2; + {$EXTERNALSYM GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI} + GL_PROXY_COLOR_TABLE_SGI = $80D3; + {$EXTERNALSYM GL_PROXY_COLOR_TABLE_SGI} + GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI = $80D4; + {$EXTERNALSYM GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI} + GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI = $80D5; + {$EXTERNALSYM GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI} + GL_COLOR_TABLE_SCALE_SGI = $80D6; + {$EXTERNALSYM GL_COLOR_TABLE_SCALE_SGI} + GL_COLOR_TABLE_BIAS_SGI = $80D7; + {$EXTERNALSYM GL_COLOR_TABLE_BIAS_SGI} + GL_COLOR_TABLE_FORMAT_SGI = $80D8; + {$EXTERNALSYM GL_COLOR_TABLE_FORMAT_SGI} + GL_COLOR_TABLE_WIDTH_SGI = $80D9; + {$EXTERNALSYM GL_COLOR_TABLE_WIDTH_SGI} + GL_COLOR_TABLE_RED_SIZE_SGI = $80DA; + {$EXTERNALSYM GL_COLOR_TABLE_RED_SIZE_SGI} + GL_COLOR_TABLE_GREEN_SIZE_SGI = $80DB; + {$EXTERNALSYM GL_COLOR_TABLE_GREEN_SIZE_SGI} + GL_COLOR_TABLE_BLUE_SIZE_SGI = $80DC; + {$EXTERNALSYM GL_COLOR_TABLE_BLUE_SIZE_SGI} + GL_COLOR_TABLE_ALPHA_SIZE_SGI = $80DD; + {$EXTERNALSYM GL_COLOR_TABLE_ALPHA_SIZE_SGI} + GL_COLOR_TABLE_LUMINANCE_SIZE_SGI = $80DE; + {$EXTERNALSYM GL_COLOR_TABLE_LUMINANCE_SIZE_SGI} + GL_COLOR_TABLE_INTENSITY_SIZE_SGI = $80DF; + {$EXTERNALSYM GL_COLOR_TABLE_INTENSITY_SIZE_SGI} + + // EXT_cmyka + GL_CMYK_EXT = $800C; + {$EXTERNALSYM GL_CMYK_EXT} + GL_CMYKA_EXT = $800D; + {$EXTERNALSYM GL_CMYKA_EXT} + GL_PACK_CMYK_HINT_EXT = $800E; + {$EXTERNALSYM GL_PACK_CMYK_HINT_EXT} + GL_UNPACK_CMYK_HINT_EXT = $800F; + {$EXTERNALSYM GL_UNPACK_CMYK_HINT_EXT} + + // EXT_rescale_normal + GL_RESCALE_NORMAL_EXT = $803A; + {$EXTERNALSYM GL_RESCALE_NORMAL_EXT} + + // EXT_clip_volume_hint + GL_CLIP_VOLUME_CLIPPING_HINT_EXT = $80F0; + {$EXTERNALSYM GL_CLIP_VOLUME_CLIPPING_HINT_EXT} + + // EXT_cull_vertex + GL_CULL_VERTEX_EXT = $81AA; + {$EXTERNALSYM GL_CULL_VERTEX_EXT} + GL_CULL_VERTEX_EYE_POSITION_EXT = $81AB; + {$EXTERNALSYM GL_CULL_VERTEX_EYE_POSITION_EXT} + GL_CULL_VERTEX_OBJECT_POSITION_EXT = $81AC; + {$EXTERNALSYM GL_CULL_VERTEX_OBJECT_POSITION_EXT} + + // EXT_index_array_formats + GL_IUI_V2F_EXT = $81AD; + {$EXTERNALSYM GL_IUI_V2F_EXT} + GL_IUI_V3F_EXT = $81AE; + {$EXTERNALSYM GL_IUI_V3F_EXT} + GL_IUI_N3F_V2F_EXT = $81AF; + {$EXTERNALSYM GL_IUI_N3F_V2F_EXT} + GL_IUI_N3F_V3F_EXT = $81B0; + {$EXTERNALSYM GL_IUI_N3F_V3F_EXT} + GL_T2F_IUI_V2F_EXT = $81B1; + {$EXTERNALSYM GL_T2F_IUI_V2F_EXT} + GL_T2F_IUI_V3F_EXT = $81B2; + {$EXTERNALSYM GL_T2F_IUI_V3F_EXT} + GL_T2F_IUI_N3F_V2F_EXT = $81B3; + {$EXTERNALSYM GL_T2F_IUI_N3F_V2F_EXT} + GL_T2F_IUI_N3F_V3F_EXT = $81B4; + {$EXTERNALSYM GL_T2F_IUI_N3F_V3F_EXT} + + // EXT_index_func + GL_INDEX_TEST_EXT = $81B5; + {$EXTERNALSYM GL_INDEX_TEST_EXT} + GL_INDEX_TEST_FUNC_EXT = $81B6; + {$EXTERNALSYM GL_INDEX_TEST_FUNC_EXT} + GL_INDEX_TEST_REF_EXT = $81B7; + {$EXTERNALSYM GL_INDEX_TEST_REF_EXT} + + // EXT_index_material + GL_INDEX_MATERIAL_EXT = $81B8; + {$EXTERNALSYM GL_INDEX_MATERIAL_EXT} + GL_INDEX_MATERIAL_PARAMETER_EXT = $81B9; + {$EXTERNALSYM GL_INDEX_MATERIAL_PARAMETER_EXT} + GL_INDEX_MATERIAL_FACE_EXT = $81BA; + {$EXTERNALSYM GL_INDEX_MATERIAL_FACE_EXT} + + // EXT_misc_attribute + GL_MISC_BIT_EXT = 0; // not yet defined + {$EXTERNALSYM GL_MISC_BIT_EXT} + + // EXT_scene_marker + GL_SCENE_REQUIRED_EXT = 0; // not yet defined + {$EXTERNALSYM GL_SCENE_REQUIRED_EXT} + + // EXT_shared_texture_palette + GL_SHARED_TEXTURE_PALETTE_EXT = $81FB; + {$EXTERNALSYM GL_SHARED_TEXTURE_PALETTE_EXT} + + // EXT_nurbs_tessellator + GLU_NURBS_MODE_EXT = 100160; + {$EXTERNALSYM GLU_NURBS_MODE_EXT} + GLU_NURBS_TESSELLATOR_EXT = 100161; + {$EXTERNALSYM GLU_NURBS_TESSELLATOR_EXT} + GLU_NURBS_RENDERER_EXT = 100162; + {$EXTERNALSYM GLU_NURBS_RENDERER_EXT} + GLU_NURBS_BEGIN_EXT = 100164; + {$EXTERNALSYM GLU_NURBS_BEGIN_EXT} + GLU_NURBS_VERTEX_EXT = 100165; + {$EXTERNALSYM GLU_NURBS_VERTEX_EXT} + GLU_NURBS_NORMAL_EXT = 100166; + {$EXTERNALSYM GLU_NURBS_NORMAL_EXT} + GLU_NURBS_COLOR_EXT = 100167; + {$EXTERNALSYM GLU_NURBS_COLOR_EXT} + GLU_NURBS_TEX_COORD_EXT = 100168; + {$EXTERNALSYM GLU_NURBS_TEX_COORD_EXT} + GLU_NURBS_END_EXT = 100169; + {$EXTERNALSYM GLU_NURBS_END_EXT} + GLU_NURBS_BEGIN_DATA_EXT = 100170; + {$EXTERNALSYM GLU_NURBS_BEGIN_DATA_EXT} + GLU_NURBS_VERTEX_DATA_EXT = 100171; + {$EXTERNALSYM GLU_NURBS_VERTEX_DATA_EXT} + GLU_NURBS_NORMAL_DATA_EXT = 100172; + {$EXTERNALSYM GLU_NURBS_NORMAL_DATA_EXT} + GLU_NURBS_COLOR_DATA_EXT = 100173; + {$EXTERNALSYM GLU_NURBS_COLOR_DATA_EXT} + GLU_NURBS_TEX_COORD_DATA_EXT = 100174; + {$EXTERNALSYM GLU_NURBS_TEX_COORD_DATA_EXT} + GLU_NURBS_END_DATA_EXT = 100175; + {$EXTERNALSYM GLU_NURBS_END_DATA_EXT} + + // EXT_object_space_tess + GLU_OBJECT_PARAMETRIC_ERROR_EXT = 100208; + {$EXTERNALSYM GLU_OBJECT_PARAMETRIC_ERROR_EXT} + GLU_OBJECT_PATH_LENGTH_EXT = 100209; + {$EXTERNALSYM GLU_OBJECT_PATH_LENGTH_EXT} + + // EXT_point_parameters + GL_POINT_SIZE_MIN_EXT = $8126; + {$EXTERNALSYM GL_POINT_SIZE_MIN_EXT} + GL_POINT_SIZE_MAX_EXT = $8127; + {$EXTERNALSYM GL_POINT_SIZE_MAX_EXT} + GL_POINT_FADE_THRESHOLD_SIZE_EXT = $8128; + {$EXTERNALSYM GL_POINT_FADE_THRESHOLD_SIZE_EXT} + GL_DISTANCE_ATTENUATION_EXT = $8129; + {$EXTERNALSYM GL_DISTANCE_ATTENUATION_EXT} + + // EXT_compiled_vertex_array + GL_ARRAY_ELEMENT_LOCK_FIRST_EXT = $81A8; + {$EXTERNALSYM GL_ARRAY_ELEMENT_LOCK_FIRST_EXT} + GL_ARRAY_ELEMENT_LOCK_COUNT_EXT = $81A9; + {$EXTERNALSYM GL_ARRAY_ELEMENT_LOCK_COUNT_EXT} + + // ARB_multitexture + GL_ACTIVE_TEXTURE_ARB = $84E0; + {$EXTERNALSYM GL_ACTIVE_TEXTURE_ARB} + GL_CLIENT_ACTIVE_TEXTURE_ARB = $84E1; + {$EXTERNALSYM GL_CLIENT_ACTIVE_TEXTURE_ARB} + GL_MAX_TEXTURE_UNITS_ARB = $84E2; + {$EXTERNALSYM GL_MAX_TEXTURE_UNITS_ARB} + GL_TEXTURE0_ARB = $84C0; + {$EXTERNALSYM GL_TEXTURE0_ARB} + GL_TEXTURE1_ARB = $84C1; + {$EXTERNALSYM GL_TEXTURE1_ARB} + GL_TEXTURE2_ARB = $84C2; + {$EXTERNALSYM GL_TEXTURE2_ARB} + GL_TEXTURE3_ARB = $84C3; + {$EXTERNALSYM GL_TEXTURE3_ARB} + GL_TEXTURE4_ARB = $84C4; + {$EXTERNALSYM GL_TEXTURE4_ARB} + GL_TEXTURE5_ARB = $84C5; + {$EXTERNALSYM GL_TEXTURE5_ARB} + GL_TEXTURE6_ARB = $84C6; + {$EXTERNALSYM GL_TEXTURE6_ARB} + GL_TEXTURE7_ARB = $84C7; + {$EXTERNALSYM GL_TEXTURE7_ARB} + GL_TEXTURE8_ARB = $84C8; + {$EXTERNALSYM GL_TEXTURE8_ARB} + GL_TEXTURE9_ARB = $84C9; + {$EXTERNALSYM GL_TEXTURE9_ARB} + GL_TEXTURE10_ARB = $84CA; + {$EXTERNALSYM GL_TEXTURE10_ARB} + GL_TEXTURE11_ARB = $84CB; + {$EXTERNALSYM GL_TEXTURE11_ARB} + GL_TEXTURE12_ARB = $84CC; + {$EXTERNALSYM GL_TEXTURE12_ARB} + GL_TEXTURE13_ARB = $84CD; + {$EXTERNALSYM GL_TEXTURE13_ARB} + GL_TEXTURE14_ARB = $84CE; + {$EXTERNALSYM GL_TEXTURE14_ARB} + GL_TEXTURE15_ARB = $84CF; + {$EXTERNALSYM GL_TEXTURE15_ARB} + GL_TEXTURE16_ARB = $84D0; + {$EXTERNALSYM GL_TEXTURE16_ARB} + GL_TEXTURE17_ARB = $84D1; + {$EXTERNALSYM GL_TEXTURE17_ARB} + GL_TEXTURE18_ARB = $84D2; + {$EXTERNALSYM GL_TEXTURE18_ARB} + GL_TEXTURE19_ARB = $84D3; + {$EXTERNALSYM GL_TEXTURE19_ARB} + GL_TEXTURE20_ARB = $84D4; + {$EXTERNALSYM GL_TEXTURE20_ARB} + GL_TEXTURE21_ARB = $84D5; + {$EXTERNALSYM GL_TEXTURE21_ARB} + GL_TEXTURE22_ARB = $84D6; + {$EXTERNALSYM GL_TEXTURE22_ARB} + GL_TEXTURE23_ARB = $84D7; + {$EXTERNALSYM GL_TEXTURE23_ARB} + GL_TEXTURE24_ARB = $84D8; + {$EXTERNALSYM GL_TEXTURE24_ARB} + GL_TEXTURE25_ARB = $84D9; + {$EXTERNALSYM GL_TEXTURE25_ARB} + GL_TEXTURE26_ARB = $84DA; + {$EXTERNALSYM GL_TEXTURE26_ARB} + GL_TEXTURE27_ARB = $84DB; + {$EXTERNALSYM GL_TEXTURE27_ARB} + GL_TEXTURE28_ARB = $84DC; + {$EXTERNALSYM GL_TEXTURE28_ARB} + GL_TEXTURE29_ARB = $84DD; + {$EXTERNALSYM GL_TEXTURE29_ARB} + GL_TEXTURE30_ARB = $84DE; + {$EXTERNALSYM GL_TEXTURE30_ARB} + GL_TEXTURE31_ARB = $84DF; + {$EXTERNALSYM GL_TEXTURE31_ARB} + + // EXT_stencil_wrap + GL_INCR_WRAP_EXT = $8507; + {$EXTERNALSYM GL_INCR_WRAP_EXT} + GL_DECR_WRAP_EXT = $8508; + {$EXTERNALSYM GL_DECR_WRAP_EXT} + + // NV_texgen_reflection + GL_NORMAL_MAP_NV = $8511; + {$EXTERNALSYM GL_NORMAL_MAP_NV} + GL_REFLECTION_MAP_NV = $8512; + {$EXTERNALSYM GL_REFLECTION_MAP_NV} + + // EXT_texture_env_combine + GL_COMBINE_EXT = $8570; + {$EXTERNALSYM GL_COMBINE_EXT} + GL_COMBINE_RGB_EXT = $8571; + {$EXTERNALSYM GL_COMBINE_RGB_EXT} + GL_COMBINE_ALPHA_EXT = $8572; + {$EXTERNALSYM GL_COMBINE_ALPHA_EXT} + GL_RGB_SCALE_EXT = $8573; + {$EXTERNALSYM GL_RGB_SCALE_EXT} + GL_ADD_SIGNED_EXT = $8574; + {$EXTERNALSYM GL_ADD_SIGNED_EXT} + GL_INTERPOLATE_EXT = $8575; + {$EXTERNALSYM GL_INTERPOLATE_EXT} + GL_CONSTANT_EXT = $8576; + {$EXTERNALSYM GL_CONSTANT_EXT} + GL_PRIMARY_COLOR_EXT = $8577; + {$EXTERNALSYM GL_PRIMARY_COLOR_EXT} + GL_PREVIOUS_EXT = $8578; + {$EXTERNALSYM GL_PREVIOUS_EXT} + GL_SOURCE0_RGB_EXT = $8580; + {$EXTERNALSYM GL_SOURCE0_RGB_EXT} + GL_SOURCE1_RGB_EXT = $8581; + {$EXTERNALSYM GL_SOURCE1_RGB_EXT} + GL_SOURCE2_RGB_EXT = $8582; + {$EXTERNALSYM GL_SOURCE2_RGB_EXT} + GL_SOURCE0_ALPHA_EXT = $8588; + {$EXTERNALSYM GL_SOURCE0_ALPHA_EXT} + GL_SOURCE1_ALPHA_EXT = $8589; + {$EXTERNALSYM GL_SOURCE1_ALPHA_EXT} + GL_SOURCE2_ALPHA_EXT = $858A; + {$EXTERNALSYM GL_SOURCE2_ALPHA_EXT} + GL_OPERAND0_RGB_EXT = $8590; + {$EXTERNALSYM GL_OPERAND0_RGB_EXT} + GL_OPERAND1_RGB_EXT = $8591; + {$EXTERNALSYM GL_OPERAND1_RGB_EXT} + GL_OPERAND2_RGB_EXT = $8592; + {$EXTERNALSYM GL_OPERAND2_RGB_EXT} + GL_OPERAND0_ALPHA_EXT = $8598; + {$EXTERNALSYM GL_OPERAND0_ALPHA_EXT} + GL_OPERAND1_ALPHA_EXT = $8599; + {$EXTERNALSYM GL_OPERAND1_ALPHA_EXT} + GL_OPERAND2_ALPHA_EXT = $859A; + {$EXTERNALSYM GL_OPERAND2_ALPHA_EXT} + + // NV_texture_env_combine4 + GL_COMBINE4_NV = $8503; + {$EXTERNALSYM GL_COMBINE4_NV} + GL_SOURCE3_RGB_NV = $8583; + {$EXTERNALSYM GL_SOURCE3_RGB_NV} + GL_SOURCE3_ALPHA_NV = $858B; + {$EXTERNALSYM GL_SOURCE3_ALPHA_NV} + GL_OPERAND3_RGB_NV = $8593; + {$EXTERNALSYM GL_OPERAND3_RGB_NV} + GL_OPERAND3_ALPHA_NV = $859B; + {$EXTERNALSYM GL_OPERAND3_ALPHA_NV} + + GL_BLEND_EQUATION = $8009; + {$EXTERNALSYM GL_BLEND_EQUATION} + GL_TABLE_TOO_LARGE = $8031; + {$EXTERNALSYM GL_TABLE_TOO_LARGE} + GL_UNSIGNED_BYTE_3_3_2 = $8032; + {$EXTERNALSYM GL_UNSIGNED_BYTE_3_3_2} + GL_UNSIGNED_SHORT_4_4_4_4 = $8033; + {$EXTERNALSYM GL_UNSIGNED_SHORT_4_4_4_4} + GL_UNSIGNED_SHORT_5_5_5_1 = $8034; + {$EXTERNALSYM GL_UNSIGNED_SHORT_5_5_5_1} + GL_UNSIGNED_INT_8_8_8_8 = $8035; + {$EXTERNALSYM GL_UNSIGNED_INT_8_8_8_8} + GL_UNSIGNED_INT_10_10_10_2 = $8036; + {$EXTERNALSYM GL_UNSIGNED_INT_10_10_10_2} + GL_UNSIGNED_BYTE_2_3_3_REV = $8362; + {$EXTERNALSYM GL_UNSIGNED_BYTE_2_3_3_REV} + GL_UNSIGNED_SHORT_5_6_5 = $8363; + {$EXTERNALSYM GL_UNSIGNED_SHORT_5_6_5} + GL_UNSIGNED_SHORT_5_6_5_REV = $8364; + {$EXTERNALSYM GL_UNSIGNED_SHORT_5_6_5_REV} + GL_UNSIGNED_SHORT_4_4_4_4_REV = $8365; + {$EXTERNALSYM GL_UNSIGNED_SHORT_4_4_4_4_REV} + GL_UNSIGNED_SHORT_1_5_5_5_REV = $8366; + {$EXTERNALSYM GL_UNSIGNED_SHORT_1_5_5_5_REV} + GL_UNSIGNED_INT_8_8_8_8_REV = $8367; + {$EXTERNALSYM GL_UNSIGNED_INT_8_8_8_8_REV} + GL_UNSIGNED_INT_2_10_10_10_REV = $8368; + {$EXTERNALSYM GL_UNSIGNED_INT_2_10_10_10_REV} + + // GL_ARB_transpose_matrix + GL_TRANSPOSE_MODELVIEW_MATRIX_ARB = $84E3; + {$EXTERNALSYM GL_TRANSPOSE_MODELVIEW_MATRIX_ARB} + GL_TRANSPOSE_PROJECTION_MATRIX_ARB = $84E4; + {$EXTERNALSYM GL_TRANSPOSE_PROJECTION_MATRIX_ARB} + GL_TRANSPOSE_TEXTURE_MATRIX_ARB = $84E5; + {$EXTERNALSYM GL_TRANSPOSE_TEXTURE_MATRIX_ARB} + GL_TRANSPOSE_COLOR_MATRIX_ARB = $84E6; + {$EXTERNALSYM GL_TRANSPOSE_COLOR_MATRIX_ARB} + + // GL_ARB_multisample + GL_MULTISAMPLE_ARB = $809D; + {$EXTERNALSYM GL_MULTISAMPLE_ARB} + GL_SAMPLE_ALPHA_TO_COVERAGE_ARB = $809E; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_COVERAGE_ARB} + GL_SAMPLE_ALPHA_TO_ONE_ARB = $809F; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_ONE_ARB} + GL_SAMPLE_COVERAGE_ARB = $80A0; + {$EXTERNALSYM GL_SAMPLE_COVERAGE_ARB} + GL_SAMPLE_BUFFERS_ARB = $80A8; + {$EXTERNALSYM GL_SAMPLE_BUFFERS_ARB} + GL_SAMPLES_ARB = $80A9; + {$EXTERNALSYM GL_SAMPLES_ARB} + GL_SAMPLE_COVERAGE_VALUE_ARB = $80AA; + {$EXTERNALSYM GL_SAMPLE_COVERAGE_VALUE_ARB} + GL_SAMPLE_COVERAGE_INVERT_ARB = $80AB; + {$EXTERNALSYM GL_SAMPLE_COVERAGE_INVERT_ARB} + GL_MULTISAMPLE_BIT_ARB = $20000000; + {$EXTERNALSYM GL_MULTISAMPLE_BIT_ARB} + GLX_SAMPLE_BUFFERS_ARB = 100000; + {$EXTERNALSYM GLX_SAMPLE_BUFFERS_ARB} + GLX_SAMPLES_ARB = 100001; + {$EXTERNALSYM GLX_SAMPLES_ARB} + WGL_SAMPLE_BUFFERS_ARB = $2041; + {$EXTERNALSYM WGL_SAMPLE_BUFFERS_ARB} + WGL_SAMPLES_ARB = $2042; + {$EXTERNALSYM WGL_SAMPLES_ARB} + + // GL_ARB_texture_cube_map + GL_NORMAL_MAP_ARB = $8511; + {$EXTERNALSYM GL_NORMAL_MAP_ARB} + GL_REFLECTION_MAP_ARB = $8512; + {$EXTERNALSYM GL_REFLECTION_MAP_ARB} + GL_TEXTURE_CUBE_MAP_ARB = $8513; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_ARB} + GL_TEXTURE_BINDING_CUBE_MAP_ARB = $8514; + {$EXTERNALSYM GL_TEXTURE_BINDING_CUBE_MAP_ARB} + GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = $8515; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB} + GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = $8516; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB} + GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = $8517; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB} + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = $8518; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB} + GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = $8519; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB} + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = $851A; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB} + GL_PROXY_TEXTURE_CUBE_MAP_ARB = $851B; + {$EXTERNALSYM GL_PROXY_TEXTURE_CUBE_MAP_ARB} + GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB = $851C; + {$EXTERNALSYM GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB} + + // GL_ARB_texture_compression + GL_COMPRESSED_ALPHA_ARB = $84E9; + {$EXTERNALSYM GL_COMPRESSED_ALPHA_ARB} + GL_COMPRESSED_LUMINANCE_ARB = $84EA; + {$EXTERNALSYM GL_COMPRESSED_LUMINANCE_ARB} + GL_COMPRESSED_LUMINANCE_ALPHA_ARB = $84EB; + {$EXTERNALSYM GL_COMPRESSED_LUMINANCE_ALPHA_ARB} + GL_COMPRESSED_INTENSITY_ARB = $84EC; + {$EXTERNALSYM GL_COMPRESSED_INTENSITY_ARB} + GL_COMPRESSED_RGB_ARB = $84ED; + {$EXTERNALSYM GL_COMPRESSED_RGB_ARB} + GL_COMPRESSED_RGBA_ARB = $84EE; + {$EXTERNALSYM GL_COMPRESSED_RGBA_ARB} + GL_TEXTURE_COMPRESSION_HINT_ARB = $84EF; + {$EXTERNALSYM GL_TEXTURE_COMPRESSION_HINT_ARB} + GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB = $86A0; + {$EXTERNALSYM GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB} + GL_TEXTURE_COMPRESSED_ARB = $86A1; + {$EXTERNALSYM GL_TEXTURE_COMPRESSED_ARB} + GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB = $86A2; + {$EXTERNALSYM GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB} + GL_COMPRESSED_TEXTURE_FORMATS_ARB = $86A3; + {$EXTERNALSYM GL_COMPRESSED_TEXTURE_FORMATS_ARB} + + // GL_ARB_vertex_blend + GL_MAX_VERTEX_UNITS_ARB = $86A4; + {$EXTERNALSYM GL_MAX_VERTEX_UNITS_ARB} + GL_ACTIVE_VERTEX_UNITS_ARB = $86A5; + {$EXTERNALSYM GL_ACTIVE_VERTEX_UNITS_ARB} + GL_WEIGHT_SUM_UNITY_ARB = $86A6; + {$EXTERNALSYM GL_WEIGHT_SUM_UNITY_ARB} + GL_VERTEX_BLEND_ARB = $86A7; + {$EXTERNALSYM GL_VERTEX_BLEND_ARB} + GL_CURRENT_WEIGHT_ARB = $86A8; + {$EXTERNALSYM GL_CURRENT_WEIGHT_ARB} + GL_WEIGHT_ARRAY_TYPE_ARB = $86A9; + {$EXTERNALSYM GL_WEIGHT_ARRAY_TYPE_ARB} + GL_WEIGHT_ARRAY_STRIDE_ARB = $86AA; + {$EXTERNALSYM GL_WEIGHT_ARRAY_STRIDE_ARB} + GL_WEIGHT_ARRAY_SIZE_ARB = $86AB; + {$EXTERNALSYM GL_WEIGHT_ARRAY_SIZE_ARB} + GL_WEIGHT_ARRAY_POINTER_ARB = $86AC; + {$EXTERNALSYM GL_WEIGHT_ARRAY_POINTER_ARB} + GL_WEIGHT_ARRAY_ARB = $86AD; + {$EXTERNALSYM GL_WEIGHT_ARRAY_ARB} + GL_MODELVIEW0_ARB = $1700; + {$EXTERNALSYM GL_MODELVIEW0_ARB} + GL_MODELVIEW1_ARB = $850A; + {$EXTERNALSYM GL_MODELVIEW1_ARB} + GL_MODELVIEW2_ARB = $8722; + {$EXTERNALSYM GL_MODELVIEW2_ARB} + GL_MODELVIEW3_ARB = $8723; + {$EXTERNALSYM GL_MODELVIEW3_ARB} + GL_MODELVIEW4_ARB = $8724; + {$EXTERNALSYM GL_MODELVIEW4_ARB} + GL_MODELVIEW5_ARB = $8725; + {$EXTERNALSYM GL_MODELVIEW5_ARB} + GL_MODELVIEW6_ARB = $8726; + {$EXTERNALSYM GL_MODELVIEW6_ARB} + GL_MODELVIEW7_ARB = $8727; + {$EXTERNALSYM GL_MODELVIEW7_ARB} + GL_MODELVIEW8_ARB = $8728; + {$EXTERNALSYM GL_MODELVIEW8_ARB} + GL_MODELVIEW9_ARB = $8729; + {$EXTERNALSYM GL_MODELVIEW9_ARB} + GL_MODELVIEW10_ARB = $872A; + {$EXTERNALSYM GL_MODELVIEW10_ARB} + GL_MODELVIEW11_ARB = $872B; + {$EXTERNALSYM GL_MODELVIEW11_ARB} + GL_MODELVIEW12_ARB = $872C; + {$EXTERNALSYM GL_MODELVIEW12_ARB} + GL_MODELVIEW13_ARB = $872D; + {$EXTERNALSYM GL_MODELVIEW13_ARB} + GL_MODELVIEW14_ARB = $872E; + {$EXTERNALSYM GL_MODELVIEW14_ARB} + GL_MODELVIEW15_ARB = $872F; + {$EXTERNALSYM GL_MODELVIEW15_ARB} + GL_MODELVIEW16_ARB = $8730; + {$EXTERNALSYM GL_MODELVIEW16_ARB} + GL_MODELVIEW17_ARB = $8731; + {$EXTERNALSYM GL_MODELVIEW17_ARB} + GL_MODELVIEW18_ARB = $8732; + {$EXTERNALSYM GL_MODELVIEW18_ARB} + GL_MODELVIEW19_ARB = $8733; + {$EXTERNALSYM GL_MODELVIEW19_ARB} + GL_MODELVIEW20_ARB = $8734; + {$EXTERNALSYM GL_MODELVIEW20_ARB} + GL_MODELVIEW21_ARB = $8735; + {$EXTERNALSYM GL_MODELVIEW21_ARB} + GL_MODELVIEW22_ARB = $8736; + {$EXTERNALSYM GL_MODELVIEW22_ARB} + GL_MODELVIEW23_ARB = $8737; + {$EXTERNALSYM GL_MODELVIEW23_ARB} + GL_MODELVIEW24_ARB = $8738; + {$EXTERNALSYM GL_MODELVIEW24_ARB} + GL_MODELVIEW25_ARB = $8739; + {$EXTERNALSYM GL_MODELVIEW25_ARB} + GL_MODELVIEW26_ARB = $873A; + {$EXTERNALSYM GL_MODELVIEW26_ARB} + GL_MODELVIEW27_ARB = $873B; + {$EXTERNALSYM GL_MODELVIEW27_ARB} + GL_MODELVIEW28_ARB = $873C; + {$EXTERNALSYM GL_MODELVIEW28_ARB} + GL_MODELVIEW29_ARB = $873D; + {$EXTERNALSYM GL_MODELVIEW29_ARB} + GL_MODELVIEW30_ARB = $873E; + {$EXTERNALSYM GL_MODELVIEW30_ARB} + GL_MODELVIEW31_ARB = $873F; + {$EXTERNALSYM GL_MODELVIEW31_ARB} + + // GL_SGIS_texture_filter4 + GL_FILTER4_SGIS = $8146; + {$EXTERNALSYM GL_FILTER4_SGIS} + GL_TEXTURE_FILTER4_SIZE_SGIS = $8147; + {$EXTERNALSYM GL_TEXTURE_FILTER4_SIZE_SGIS} + + // GL_SGIS_pixel_texture + GL_PIXEL_TEXTURE_SGIS = $8353; + {$EXTERNALSYM GL_PIXEL_TEXTURE_SGIS} + GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS = $8354; + {$EXTERNALSYM GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS} + GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS = $8355; + {$EXTERNALSYM GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS} + GL_PIXEL_GROUP_COLOR_SGIS = $8356; + {$EXTERNALSYM GL_PIXEL_GROUP_COLOR_SGIS} + + // GL_SGIX_pixel_texture + GL_PIXEL_TEX_GEN_SGIX = $8139; + {$EXTERNALSYM GL_PIXEL_TEX_GEN_SGIX} + GL_PIXEL_TEX_GEN_MODE_SGIX = $832B; + {$EXTERNALSYM GL_PIXEL_TEX_GEN_MODE_SGIX} + + // GL_SGIS_texture4D + GL_PACK_SKIP_VOLUMES_SGIS = $8130; + {$EXTERNALSYM GL_PACK_SKIP_VOLUMES_SGIS} + GL_PACK_IMAGE_DEPTH_SGIS = $8131; + {$EXTERNALSYM GL_PACK_IMAGE_DEPTH_SGIS} + GL_UNPACK_SKIP_VOLUMES_SGIS = $8132; + {$EXTERNALSYM GL_UNPACK_SKIP_VOLUMES_SGIS} + GL_UNPACK_IMAGE_DEPTH_SGIS = $8133; + {$EXTERNALSYM GL_UNPACK_IMAGE_DEPTH_SGIS} + GL_TEXTURE_4D_SGIS = $8134; + {$EXTERNALSYM GL_TEXTURE_4D_SGIS} + GL_PROXY_TEXTURE_4D_SGIS = $8135; + {$EXTERNALSYM GL_PROXY_TEXTURE_4D_SGIS} + GL_TEXTURE_4DSIZE_SGIS = $8136; + {$EXTERNALSYM GL_TEXTURE_4DSIZE_SGIS} + GL_TEXTURE_WRAP_Q_SGIS = $8137; + {$EXTERNALSYM GL_TEXTURE_WRAP_Q_SGIS} + GL_MAX_4D_TEXTURE_SIZE_SGIS = $8138; + {$EXTERNALSYM GL_MAX_4D_TEXTURE_SIZE_SGIS} + GL_TEXTURE_4D_BINDING_SGIS = $814F; + {$EXTERNALSYM GL_TEXTURE_4D_BINDING_SGIS} + + // GL_SGIS_detail_texture + GL_DETAIL_TEXTURE_2D_SGIS = $8095; + {$EXTERNALSYM GL_DETAIL_TEXTURE_2D_SGIS} + GL_DETAIL_TEXTURE_2D_BINDING_SGIS = $8096; + {$EXTERNALSYM GL_DETAIL_TEXTURE_2D_BINDING_SGIS} + GL_LINEAR_DETAIL_SGIS = $8097; + {$EXTERNALSYM GL_LINEAR_DETAIL_SGIS} + GL_LINEAR_DETAIL_ALPHA_SGIS = $8098; + {$EXTERNALSYM GL_LINEAR_DETAIL_ALPHA_SGIS} + GL_LINEAR_DETAIL_COLOR_SGIS = $8099; + {$EXTERNALSYM GL_LINEAR_DETAIL_COLOR_SGIS} + GL_DETAIL_TEXTURE_LEVEL_SGIS = $809A; + {$EXTERNALSYM GL_DETAIL_TEXTURE_LEVEL_SGIS} + GL_DETAIL_TEXTURE_MODE_SGIS = $809B; + {$EXTERNALSYM GL_DETAIL_TEXTURE_MODE_SGIS} + GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS = $809C; + {$EXTERNALSYM GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS} + + // GL_SGIS_sharpen_texture + GL_LINEAR_SHARPEN_SGIS = $80AD; + {$EXTERNALSYM GL_LINEAR_SHARPEN_SGIS} + GL_LINEAR_SHARPEN_ALPHA_SGIS = $80AE; + {$EXTERNALSYM GL_LINEAR_SHARPEN_ALPHA_SGIS} + GL_LINEAR_SHARPEN_COLOR_SGIS = $80AF; + {$EXTERNALSYM GL_LINEAR_SHARPEN_COLOR_SGIS} + GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS = $80B0; + {$EXTERNALSYM GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS} + + // GL_SGIS_texture_lod + GL_TEXTURE_MIN_LOD_SGIS = $813A; + {$EXTERNALSYM GL_TEXTURE_MIN_LOD_SGIS} + GL_TEXTURE_MAX_LOD_SGIS = $813B; + {$EXTERNALSYM GL_TEXTURE_MAX_LOD_SGIS} + GL_TEXTURE_BASE_LEVEL_SGIS = $813C; + {$EXTERNALSYM GL_TEXTURE_BASE_LEVEL_SGIS} + GL_TEXTURE_MAX_LEVEL_SGIS = $813D; + {$EXTERNALSYM GL_TEXTURE_MAX_LEVEL_SGIS} + + // GL_SGIS_multisample + GL_MULTISAMPLE_SGIS = $809D; + {$EXTERNALSYM GL_MULTISAMPLE_SGIS} + GL_SAMPLE_ALPHA_TO_MASK_SGIS = $809E; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_MASK_SGIS} + GL_SAMPLE_ALPHA_TO_ONE_SGIS = $809F; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_ONE_SGIS} + GL_SAMPLE_MASK_SGIS = $80A0; + {$EXTERNALSYM GL_SAMPLE_MASK_SGIS} + GL_1PASS_SGIS = $80A1; + {$EXTERNALSYM GL_1PASS_SGIS} + GL_2PASS_0_SGIS = $80A2; + {$EXTERNALSYM GL_2PASS_0_SGIS} + GL_2PASS_1_SGIS = $80A3; + {$EXTERNALSYM GL_2PASS_1_SGIS} + GL_4PASS_0_SGIS = $80A4; + {$EXTERNALSYM GL_4PASS_0_SGIS} + GL_4PASS_1_SGIS = $80A5; + {$EXTERNALSYM GL_4PASS_1_SGIS} + GL_4PASS_2_SGIS = $80A6; + {$EXTERNALSYM GL_4PASS_2_SGIS} + GL_4PASS_3_SGIS = $80A7; + {$EXTERNALSYM GL_4PASS_3_SGIS} + GL_SAMPLE_BUFFERS_SGIS = $80A8; + {$EXTERNALSYM GL_SAMPLE_BUFFERS_SGIS} + GL_SAMPLES_SGIS = $80A9; + {$EXTERNALSYM GL_SAMPLES_SGIS} + GL_SAMPLE_MASK_VALUE_SGIS = $80AA; + {$EXTERNALSYM GL_SAMPLE_MASK_VALUE_SGIS} + GL_SAMPLE_MASK_INVERT_SGIS = $80AB; + {$EXTERNALSYM GL_SAMPLE_MASK_INVERT_SGIS} + GL_SAMPLE_PATTERN_SGIS = $80AC; + {$EXTERNALSYM GL_SAMPLE_PATTERN_SGIS} + + // GL_SGIS_generate_mipmap + GL_GENERATE_MIPMAP_SGIS = $8191; + {$EXTERNALSYM GL_GENERATE_MIPMAP_SGIS} + GL_GENERATE_MIPMAP_HINT_SGIS = $8192; + {$EXTERNALSYM GL_GENERATE_MIPMAP_HINT_SGIS} + + // GL_SGIX_clipmap + GL_LINEAR_CLIPMAP_LINEAR_SGIX = $8170; + {$EXTERNALSYM GL_LINEAR_CLIPMAP_LINEAR_SGIX} + GL_TEXTURE_CLIPMAP_CENTER_SGIX = $8171; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_CENTER_SGIX} + GL_TEXTURE_CLIPMAP_FRAME_SGIX = $8172; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_FRAME_SGIX} + GL_TEXTURE_CLIPMAP_OFFSET_SGIX = $8173; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_OFFSET_SGIX} + GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX = $8174; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX} + GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX = $8175; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX} + GL_TEXTURE_CLIPMAP_DEPTH_SGIX = $8176; + {$EXTERNALSYM GL_TEXTURE_CLIPMAP_DEPTH_SGIX} + GL_MAX_CLIPMAP_DEPTH_SGIX = $8177; + {$EXTERNALSYM GL_MAX_CLIPMAP_DEPTH_SGIX} + GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX = $8178; + {$EXTERNALSYM GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX} + GL_NEAREST_CLIPMAP_NEAREST_SGIX = $844D; + {$EXTERNALSYM GL_NEAREST_CLIPMAP_NEAREST_SGIX} + GL_NEAREST_CLIPMAP_LINEAR_SGIX = $844E; + {$EXTERNALSYM GL_NEAREST_CLIPMAP_LINEAR_SGIX} + GL_LINEAR_CLIPMAP_NEAREST_SGIX = $844F; + {$EXTERNALSYM GL_LINEAR_CLIPMAP_NEAREST_SGIX} + + // GL_SGIX_shadow + GL_TEXTURE_COMPARE_SGIX = $819A; + {$EXTERNALSYM GL_TEXTURE_COMPARE_SGIX} + GL_TEXTURE_COMPARE_OPERATOR_SGIX = $819B; + {$EXTERNALSYM GL_TEXTURE_COMPARE_OPERATOR_SGIX} + GL_TEXTURE_LEQUAL_R_SGIX = $819C; + {$EXTERNALSYM GL_TEXTURE_LEQUAL_R_SGIX} + GL_TEXTURE_GEQUAL_R_SGIX = $819D; + {$EXTERNALSYM GL_TEXTURE_GEQUAL_R_SGIX} + + // GL_SGIS_texture_edge_clamp + GL_CLAMP_TO_EDGE_SGIS = $812F; + {$EXTERNALSYM GL_CLAMP_TO_EDGE_SGIS} + + // GL_SGIS_texture_border_clamp + GL_CLAMP_TO_BORDER_SGIS = $812D; + {$EXTERNALSYM GL_CLAMP_TO_BORDER_SGIS} + + // GL_SGIX_interlace + GL_INTERLACE_SGIX = $8094; + {$EXTERNALSYM GL_INTERLACE_SGIX} + + // GL_SGIX_pixel_tiles + GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX = $813E; + {$EXTERNALSYM GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX} + GL_PIXEL_TILE_CACHE_INCREMENT_SGIX = $813F; + {$EXTERNALSYM GL_PIXEL_TILE_CACHE_INCREMENT_SGIX} + GL_PIXEL_TILE_WIDTH_SGIX = $8140; + {$EXTERNALSYM GL_PIXEL_TILE_WIDTH_SGIX} + GL_PIXEL_TILE_HEIGHT_SGIX = $8141; + {$EXTERNALSYM GL_PIXEL_TILE_HEIGHT_SGIX} + GL_PIXEL_TILE_GRID_WIDTH_SGIX = $8142; + {$EXTERNALSYM GL_PIXEL_TILE_GRID_WIDTH_SGIX} + GL_PIXEL_TILE_GRID_HEIGHT_SGIX = $8143; + {$EXTERNALSYM GL_PIXEL_TILE_GRID_HEIGHT_SGIX} + GL_PIXEL_TILE_GRID_DEPTH_SGIX = $8144; + {$EXTERNALSYM GL_PIXEL_TILE_GRID_DEPTH_SGIX} + GL_PIXEL_TILE_CACHE_SIZE_SGIX = $8145; + {$EXTERNALSYM GL_PIXEL_TILE_CACHE_SIZE_SGIX} + + // GL_SGIS_texture_select + GL_DUAL_ALPHA4_SGIS = $8110; + {$EXTERNALSYM GL_DUAL_ALPHA4_SGIS} + GL_DUAL_ALPHA8_SGIS = $8111; + {$EXTERNALSYM GL_DUAL_ALPHA8_SGIS} + GL_DUAL_ALPHA12_SGIS = $8112; + {$EXTERNALSYM GL_DUAL_ALPHA12_SGIS} + GL_DUAL_ALPHA16_SGIS = $8113; + {$EXTERNALSYM GL_DUAL_ALPHA16_SGIS} + GL_DUAL_LUMINANCE4_SGIS = $8114; + {$EXTERNALSYM GL_DUAL_LUMINANCE4_SGIS} + GL_DUAL_LUMINANCE8_SGIS = $8115; + {$EXTERNALSYM GL_DUAL_LUMINANCE8_SGIS} + GL_DUAL_LUMINANCE12_SGIS = $8116; + {$EXTERNALSYM GL_DUAL_LUMINANCE12_SGIS} + GL_DUAL_LUMINANCE16_SGIS = $8117; + {$EXTERNALSYM GL_DUAL_LUMINANCE16_SGIS} + GL_DUAL_INTENSITY4_SGIS = $8118; + {$EXTERNALSYM GL_DUAL_INTENSITY4_SGIS} + GL_DUAL_INTENSITY8_SGIS = $8119; + {$EXTERNALSYM GL_DUAL_INTENSITY8_SGIS} + GL_DUAL_INTENSITY12_SGIS = $811A; + {$EXTERNALSYM GL_DUAL_INTENSITY12_SGIS} + GL_DUAL_INTENSITY16_SGIS = $811B; + {$EXTERNALSYM GL_DUAL_INTENSITY16_SGIS} + GL_DUAL_LUMINANCE_ALPHA4_SGIS = $811C; + {$EXTERNALSYM GL_DUAL_LUMINANCE_ALPHA4_SGIS} + GL_DUAL_LUMINANCE_ALPHA8_SGIS = $811D; + {$EXTERNALSYM GL_DUAL_LUMINANCE_ALPHA8_SGIS} + GL_QUAD_ALPHA4_SGIS = $811E; + {$EXTERNALSYM GL_QUAD_ALPHA4_SGIS} + GL_QUAD_ALPHA8_SGIS = $811F; + {$EXTERNALSYM GL_QUAD_ALPHA8_SGIS} + GL_QUAD_LUMINANCE4_SGIS = $8120; + {$EXTERNALSYM GL_QUAD_LUMINANCE4_SGIS} + GL_QUAD_LUMINANCE8_SGIS = $8121; + {$EXTERNALSYM GL_QUAD_LUMINANCE8_SGIS} + GL_QUAD_INTENSITY4_SGIS = $8122; + {$EXTERNALSYM GL_QUAD_INTENSITY4_SGIS} + GL_QUAD_INTENSITY8_SGIS = $8123; + {$EXTERNALSYM GL_QUAD_INTENSITY8_SGIS} + GL_DUAL_TEXTURE_SELECT_SGIS = $8124; + {$EXTERNALSYM GL_DUAL_TEXTURE_SELECT_SGIS} + GL_QUAD_TEXTURE_SELECT_SGIS = $8125; + {$EXTERNALSYM GL_QUAD_TEXTURE_SELECT_SGIS} + + // GL_SGIX_sprite + GL_SPRITE_SGIX = $8148; + {$EXTERNALSYM GL_SPRITE_SGIX} + GL_SPRITE_MODE_SGIX = $8149; + {$EXTERNALSYM GL_SPRITE_MODE_SGIX} + GL_SPRITE_AXIS_SGIX = $814A; + {$EXTERNALSYM GL_SPRITE_AXIS_SGIX} + GL_SPRITE_TRANSLATION_SGIX = $814B; + {$EXTERNALSYM GL_SPRITE_TRANSLATION_SGIX} + GL_SPRITE_AXIAL_SGIX = $814C; + {$EXTERNALSYM GL_SPRITE_AXIAL_SGIX} + GL_SPRITE_OBJECT_ALIGNED_SGIX = $814D; + {$EXTERNALSYM GL_SPRITE_OBJECT_ALIGNED_SGIX} + GL_SPRITE_EYE_ALIGNED_SGIX = $814E; + {$EXTERNALSYM GL_SPRITE_EYE_ALIGNED_SGIX} + + // GL_SGIX_texture_multi_buffer + GL_TEXTURE_MULTI_BUFFER_HINT_SGIX = $812E; + {$EXTERNALSYM GL_TEXTURE_MULTI_BUFFER_HINT_SGIX} + + // GL_SGIS_point_parameters + GL_POINT_SIZE_MIN_SGIS = $8126; + {$EXTERNALSYM GL_POINT_SIZE_MIN_SGIS} + GL_POINT_SIZE_MAX_SGIS = $8127; + {$EXTERNALSYM GL_POINT_SIZE_MAX_SGIS} + GL_POINT_FADE_THRESHOLD_SIZE_SGIS = $8128; + {$EXTERNALSYM GL_POINT_FADE_THRESHOLD_SIZE_SGIS} + GL_DISTANCE_ATTENUATION_SGIS = $8129; + {$EXTERNALSYM GL_DISTANCE_ATTENUATION_SGIS} + + // GL_SGIX_instruments + GL_INSTRUMENT_BUFFER_POINTER_SGIX = $8180; + {$EXTERNALSYM GL_INSTRUMENT_BUFFER_POINTER_SGIX} + GL_INSTRUMENT_MEASUREMENTS_SGIX = $8181; + {$EXTERNALSYM GL_INSTRUMENT_MEASUREMENTS_SGIX} + + // GL_SGIX_texture_scale_bias + GL_POST_TEXTURE_FILTER_BIAS_SGIX = $8179; + {$EXTERNALSYM GL_POST_TEXTURE_FILTER_BIAS_SGIX} + GL_POST_TEXTURE_FILTER_SCALE_SGIX = $817A; + {$EXTERNALSYM GL_POST_TEXTURE_FILTER_SCALE_SGIX} + GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX = $817B; + {$EXTERNALSYM GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX} + GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX = $817C; + {$EXTERNALSYM GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX} + + // GL_SGIX_framezoom + GL_FRAMEZOOM_SGIX = $818B; + {$EXTERNALSYM GL_FRAMEZOOM_SGIX} + GL_FRAMEZOOM_FACTOR_SGIX = $818C; + {$EXTERNALSYM GL_FRAMEZOOM_FACTOR_SGIX} + GL_MAX_FRAMEZOOM_FACTOR_SGIX = $818D; + {$EXTERNALSYM GL_MAX_FRAMEZOOM_FACTOR_SGIX} + + // GL_FfdMaskSGIX + GL_TEXTURE_DEFORMATION_BIT_SGIX = $00000001; + {$EXTERNALSYM GL_TEXTURE_DEFORMATION_BIT_SGIX} + GL_GEOMETRY_DEFORMATION_BIT_SGIX = $00000002; + {$EXTERNALSYM GL_GEOMETRY_DEFORMATION_BIT_SGIX} + + // GL_SGIX_polynomial_ffd + GL_GEOMETRY_DEFORMATION_SGIX = $8194; + {$EXTERNALSYM GL_GEOMETRY_DEFORMATION_SGIX} + GL_TEXTURE_DEFORMATION_SGIX = $8195; + {$EXTERNALSYM GL_TEXTURE_DEFORMATION_SGIX} + GL_DEFORMATIONS_MASK_SGIX = $8196; + {$EXTERNALSYM GL_DEFORMATIONS_MASK_SGIX} + GL_MAX_DEFORMATION_ORDER_SGIX = $8197; + {$EXTERNALSYM GL_MAX_DEFORMATION_ORDER_SGIX} + + // GL_SGIX_reference_plane + GL_REFERENCE_PLANE_SGIX = $817D; + {$EXTERNALSYM GL_REFERENCE_PLANE_SGIX} + GL_REFERENCE_PLANE_EQUATION_SGIX = $817E; + {$EXTERNALSYM GL_REFERENCE_PLANE_EQUATION_SGIX} + + // GL_SGIX_depth_texture + GL_DEPTH_COMPONENT16_SGIX = $81A5; + {$EXTERNALSYM GL_DEPTH_COMPONENT16_SGIX} + GL_DEPTH_COMPONENT24_SGIX = $81A6; + {$EXTERNALSYM GL_DEPTH_COMPONENT24_SGIX} + GL_DEPTH_COMPONENT32_SGIX = $81A7; + {$EXTERNALSYM GL_DEPTH_COMPONENT32_SGIX} + + // GL_SGIS_fog_function + GL_FOG_FUNC_SGIS = $812A; + {$EXTERNALSYM GL_FOG_FUNC_SGIS} + GL_FOG_FUNC_POINTS_SGIS = $812B; + {$EXTERNALSYM GL_FOG_FUNC_POINTS_SGIS} + GL_MAX_FOG_FUNC_POINTS_SGIS = $812C; + {$EXTERNALSYM GL_MAX_FOG_FUNC_POINTS_SGIS} + + // GL_SGIX_fog_offset + GL_FOG_OFFSET_SGIX = $8198; + {$EXTERNALSYM GL_FOG_OFFSET_SGIX} + GL_FOG_OFFSET_VALUE_SGIX = $8199; + {$EXTERNALSYM GL_FOG_OFFSET_VALUE_SGIX} + + // GL_HP_image_transform + GL_IMAGE_SCALE_X_HP = $8155; + {$EXTERNALSYM GL_IMAGE_SCALE_X_HP} + GL_IMAGE_SCALE_Y_HP = $8156; + {$EXTERNALSYM GL_IMAGE_SCALE_Y_HP} + GL_IMAGE_TRANSLATE_X_HP = $8157; + {$EXTERNALSYM GL_IMAGE_TRANSLATE_X_HP} + GL_IMAGE_TRANSLATE_Y_HP = $8158; + {$EXTERNALSYM GL_IMAGE_TRANSLATE_Y_HP} + GL_IMAGE_ROTATE_ANGLE_HP = $8159; + {$EXTERNALSYM GL_IMAGE_ROTATE_ANGLE_HP} + GL_IMAGE_ROTATE_ORIGIN_X_HP = $815A; + {$EXTERNALSYM GL_IMAGE_ROTATE_ORIGIN_X_HP} + GL_IMAGE_ROTATE_ORIGIN_Y_HP = $815B; + {$EXTERNALSYM GL_IMAGE_ROTATE_ORIGIN_Y_HP} + GL_IMAGE_MAG_FILTER_HP = $815C; + {$EXTERNALSYM GL_IMAGE_MAG_FILTER_HP} + GL_IMAGE_MIN_FILTER_HP = $815D; + {$EXTERNALSYM GL_IMAGE_MIN_FILTER_HP} + GL_IMAGE_CUBIC_WEIGHT_HP = $815E; + {$EXTERNALSYM GL_IMAGE_CUBIC_WEIGHT_HP} + GL_CUBIC_HP = $815F; + {$EXTERNALSYM GL_CUBIC_HP} + GL_AVERAGE_HP = $8160; + {$EXTERNALSYM GL_AVERAGE_HP} + GL_IMAGE_TRANSFORM_2D_HP = $8161; + {$EXTERNALSYM GL_IMAGE_TRANSFORM_2D_HP} + GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP = $8162; + {$EXTERNALSYM GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP} + GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP = $8163; + {$EXTERNALSYM GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP} + + // GL_HP_convolution_border_modes + GL_IGNORE_BORDER_HP = $8150; + {$EXTERNALSYM GL_IGNORE_BORDER_HP} + GL_CONSTANT_BORDER_HP = $8151; + {$EXTERNALSYM GL_CONSTANT_BORDER_HP} + GL_REPLICATE_BORDER_HP = $8153; + {$EXTERNALSYM GL_REPLICATE_BORDER_HP} + GL_CONVOLUTION_BORDER_COLOR_HP = $8154; + {$EXTERNALSYM GL_CONVOLUTION_BORDER_COLOR_HP} + + // GL_SGIX_texture_add_env + GL_TEXTURE_ENV_BIAS_SGIX = $80BE; + {$EXTERNALSYM GL_TEXTURE_ENV_BIAS_SGIX} + + // GL_PGI_vertex_hints + GL_VERTEX_DATA_HINT_PGI = $1A22A; + {$EXTERNALSYM GL_VERTEX_DATA_HINT_PGI} + GL_VERTEX_CONSISTENT_HINT_PGI = $1A22B; + {$EXTERNALSYM GL_VERTEX_CONSISTENT_HINT_PGI} + GL_MATERIAL_SIDE_HINT_PGI = $1A22C; + {$EXTERNALSYM GL_MATERIAL_SIDE_HINT_PGI} + GL_MAX_VERTEX_HINT_PGI = $1A22D; + {$EXTERNALSYM GL_MAX_VERTEX_HINT_PGI} + GL_COLOR3_BIT_PGI = $00010000; + {$EXTERNALSYM GL_COLOR3_BIT_PGI} + GL_COLOR4_BIT_PGI = $00020000; + {$EXTERNALSYM GL_COLOR4_BIT_PGI} + GL_EDGEFLAG_BIT_PGI = $00040000; + {$EXTERNALSYM GL_EDGEFLAG_BIT_PGI} + GL_INDEX_BIT_PGI = $00080000; + {$EXTERNALSYM GL_INDEX_BIT_PGI} + GL_MAT_AMBIENT_BIT_PGI = $00100000; + {$EXTERNALSYM GL_MAT_AMBIENT_BIT_PGI} + GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI = $00200000; + {$EXTERNALSYM GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI} + GL_MAT_DIFFUSE_BIT_PGI = $00400000; + {$EXTERNALSYM GL_MAT_DIFFUSE_BIT_PGI} + GL_MAT_EMISSION_BIT_PGI = $00800000; + {$EXTERNALSYM GL_MAT_EMISSION_BIT_PGI} + GL_MAT_COLOR_INDEXES_BIT_PGI = $01000000; + {$EXTERNALSYM GL_MAT_COLOR_INDEXES_BIT_PGI} + GL_MAT_SHININESS_BIT_PGI = $02000000; + {$EXTERNALSYM GL_MAT_SHININESS_BIT_PGI} + GL_MAT_SPECULAR_BIT_PGI = $04000000; + {$EXTERNALSYM GL_MAT_SPECULAR_BIT_PGI} + GL_NORMAL_BIT_PGI = $08000000; + {$EXTERNALSYM GL_NORMAL_BIT_PGI} + GL_TEXCOORD1_BIT_PGI = $10000000; + {$EXTERNALSYM GL_TEXCOORD1_BIT_PGI} + GL_TEXCOORD2_BIT_PGI = $20000000; + {$EXTERNALSYM GL_TEXCOORD2_BIT_PGI} + GL_TEXCOORD3_BIT_PGI = $40000000; + {$EXTERNALSYM GL_TEXCOORD3_BIT_PGI} + GL_TEXCOORD4_BIT_PGI = $80000000; + {$EXTERNALSYM GL_TEXCOORD4_BIT_PGI} + GL_VERTEX23_BIT_PGI = $00000004; + {$EXTERNALSYM GL_VERTEX23_BIT_PGI} + GL_VERTEX4_BIT_PGI = $00000008; + {$EXTERNALSYM GL_VERTEX4_BIT_PGI} + + // GL_PGI_misc_hints + GL_PREFER_DOUBLEBUFFER_HINT_PGI = $1A1F8; + {$EXTERNALSYM GL_PREFER_DOUBLEBUFFER_HINT_PGI} + GL_CONSERVE_MEMORY_HINT_PGI = $1A1FD; + {$EXTERNALSYM GL_CONSERVE_MEMORY_HINT_PGI} + GL_RECLAIM_MEMORY_HINT_PGI = $1A1FE; + {$EXTERNALSYM GL_RECLAIM_MEMORY_HINT_PGI} + GL_NATIVE_GRAPHICS_HANDLE_PGI = $1A202; + {$EXTERNALSYM GL_NATIVE_GRAPHICS_HANDLE_PGI} + GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI = $1A203; + {$EXTERNALSYM GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI} + GL_NATIVE_GRAPHICS_END_HINT_PGI = $1A204; + {$EXTERNALSYM GL_NATIVE_GRAPHICS_END_HINT_PGI} + GL_ALWAYS_FAST_HINT_PGI = $1A20C; + {$EXTERNALSYM GL_ALWAYS_FAST_HINT_PGI} + GL_ALWAYS_SOFT_HINT_PGI = $1A20D; + {$EXTERNALSYM GL_ALWAYS_SOFT_HINT_PGI} + GL_ALLOW_DRAW_OBJ_HINT_PGI = $1A20E; + {$EXTERNALSYM GL_ALLOW_DRAW_OBJ_HINT_PGI} + GL_ALLOW_DRAW_WIN_HINT_PGI = $1A20F; + {$EXTERNALSYM GL_ALLOW_DRAW_WIN_HINT_PGI} + GL_ALLOW_DRAW_FRG_HINT_PGI = $1A210; + {$EXTERNALSYM GL_ALLOW_DRAW_FRG_HINT_PGI} + GL_ALLOW_DRAW_MEM_HINT_PGI = $1A211; + {$EXTERNALSYM GL_ALLOW_DRAW_MEM_HINT_PGI} + GL_STRICT_DEPTHFUNC_HINT_PGI = $1A216; + {$EXTERNALSYM GL_STRICT_DEPTHFUNC_HINT_PGI} + GL_STRICT_LIGHTING_HINT_PGI = $1A217; + {$EXTERNALSYM GL_STRICT_LIGHTING_HINT_PGI} + GL_STRICT_SCISSOR_HINT_PGI = $1A218; + {$EXTERNALSYM GL_STRICT_SCISSOR_HINT_PGI} + GL_FULL_STIPPLE_HINT_PGI = $1A219; + {$EXTERNALSYM GL_FULL_STIPPLE_HINT_PGI} + GL_CLIP_NEAR_HINT_PGI = $1A220; + {$EXTERNALSYM GL_CLIP_NEAR_HINT_PGI} + GL_CLIP_FAR_HINT_PGI = $1A221; + {$EXTERNALSYM GL_CLIP_FAR_HINT_PGI} + GL_WIDE_LINE_HINT_PGI = $1A222; + {$EXTERNALSYM GL_WIDE_LINE_HINT_PGI} + GL_BACK_NORMALS_HINT_PGI = $1A223; + {$EXTERNALSYM GL_BACK_NORMALS_HINT_PGI} + + // GL_EXT_paletted_texture + GL_TEXTURE_INDEX_SIZE_EXT = $80ED; + {$EXTERNALSYM GL_TEXTURE_INDEX_SIZE_EXT} + + // GL_SGIX_list_priority + GL_LIST_PRIORITY_SGIX = $8182; + {$EXTERNALSYM GL_LIST_PRIORITY_SGIX} + + // GL_SGIX_ir_instrument1 + GL_IR_INSTRUMENT1_SGIX = $817F; + {$EXTERNALSYM GL_IR_INSTRUMENT1_SGIX} + + // GL_SGIX_calligraphic_fragment + GL_CALLIGRAPHIC_FRAGMENT_SGIX = $8183; + {$EXTERNALSYM GL_CALLIGRAPHIC_FRAGMENT_SGIX} + + // GL_SGIX_texture_lod_bias + GL_TEXTURE_LOD_BIAS_S_SGIX = $818E; + {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_S_SGIX} + GL_TEXTURE_LOD_BIAS_T_SGIX = $818F; + {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_T_SGIX} + GL_TEXTURE_LOD_BIAS_R_SGIX = $8190; + {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_R_SGIX} + + // GL_SGIX_shadow_ambient + GL_SHADOW_AMBIENT_SGIX = $80BF; + {$EXTERNALSYM GL_SHADOW_AMBIENT_SGIX} + + // GL_SGIX_ycrcb + GL_YCRCB_422_SGIX = $81BB; + {$EXTERNALSYM GL_YCRCB_422_SGIX} + GL_YCRCB_444_SGIX = $81BC; + {$EXTERNALSYM GL_YCRCB_444_SGIX} + + // GL_SGIX_fragment_lighting + GL_FRAGMENT_LIGHTING_SGIX = $8400; + {$EXTERNALSYM GL_FRAGMENT_LIGHTING_SGIX} + GL_FRAGMENT_COLOR_MATERIAL_SGIX = $8401; + {$EXTERNALSYM GL_FRAGMENT_COLOR_MATERIAL_SGIX} + GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX = $8402; + {$EXTERNALSYM GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX} + GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX = $8403; + {$EXTERNALSYM GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX} + GL_MAX_FRAGMENT_LIGHTS_SGIX = $8404; + {$EXTERNALSYM GL_MAX_FRAGMENT_LIGHTS_SGIX} + GL_MAX_ACTIVE_LIGHTS_SGIX = $8405; + {$EXTERNALSYM GL_MAX_ACTIVE_LIGHTS_SGIX} + GL_CURRENT_RASTER_NORMAL_SGIX = $8406; + {$EXTERNALSYM GL_CURRENT_RASTER_NORMAL_SGIX} + GL_LIGHT_ENV_MODE_SGIX = $8407; + {$EXTERNALSYM GL_LIGHT_ENV_MODE_SGIX} + GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX = $8408; + {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX} + GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX = $8409; + {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX} + GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX = $840A; + {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX} + GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX = $840B; + {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX} + GL_FRAGMENT_LIGHT0_SGIX = $840C; + {$EXTERNALSYM GL_FRAGMENT_LIGHT0_SGIX} + GL_FRAGMENT_LIGHT1_SGIX = $840D; + {$EXTERNALSYM GL_FRAGMENT_LIGHT1_SGIX} + GL_FRAGMENT_LIGHT2_SGIX = $840E; + {$EXTERNALSYM GL_FRAGMENT_LIGHT2_SGIX} + GL_FRAGMENT_LIGHT3_SGIX = $840F; + {$EXTERNALSYM GL_FRAGMENT_LIGHT3_SGIX} + GL_FRAGMENT_LIGHT4_SGIX = $8410; + {$EXTERNALSYM GL_FRAGMENT_LIGHT4_SGIX} + GL_FRAGMENT_LIGHT5_SGIX = $8411; + {$EXTERNALSYM GL_FRAGMENT_LIGHT5_SGIX} + GL_FRAGMENT_LIGHT6_SGIX = $8412; + {$EXTERNALSYM GL_FRAGMENT_LIGHT6_SGIX} + GL_FRAGMENT_LIGHT7_SGIX = $8413; + {$EXTERNALSYM GL_FRAGMENT_LIGHT7_SGIX} + + // GL_IBM_rasterpos_clip + GL_RASTER_POSITION_UNCLIPPED_IBM = $19262; + {$EXTERNALSYM GL_RASTER_POSITION_UNCLIPPED_IBM} + + // GL_HP_texture_lighting + GL_TEXTURE_LIGHTING_MODE_HP = $8167; + {$EXTERNALSYM GL_TEXTURE_LIGHTING_MODE_HP} + GL_TEXTURE_POST_SPECULAR_HP = $8168; + {$EXTERNALSYM GL_TEXTURE_POST_SPECULAR_HP} + GL_TEXTURE_PRE_SPECULAR_HP = $8169; + {$EXTERNALSYM GL_TEXTURE_PRE_SPECULAR_HP} + + // GL_EXT_draw_range_elements + GL_MAX_ELEMENTS_VERTICES_EXT = $80E8; + {$EXTERNALSYM GL_MAX_ELEMENTS_VERTICES_EXT} + GL_MAX_ELEMENTS_INDICES_EXT = $80E9; + {$EXTERNALSYM GL_MAX_ELEMENTS_INDICES_EXT} + + // GL_WIN_phong_shading + GL_PHONG_WIN = $80EA; + {$EXTERNALSYM GL_PHONG_WIN} + GL_PHONG_HINT_WIN = $80EB; + {$EXTERNALSYM GL_PHONG_HINT_WIN} + + // GL_WIN_specular_fog + GL_FOG_SPECULAR_TEXTURE_WIN = $80EC; + {$EXTERNALSYM GL_FOG_SPECULAR_TEXTURE_WIN} + + // GL_EXT_light_texture + GL_FRAGMENT_MATERIAL_EXT = $8349; + {$EXTERNALSYM GL_FRAGMENT_MATERIAL_EXT} + GL_FRAGMENT_NORMAL_EXT = $834A; + {$EXTERNALSYM GL_FRAGMENT_NORMAL_EXT} + GL_FRAGMENT_COLOR_EXT = $834C; + {$EXTERNALSYM GL_FRAGMENT_COLOR_EXT} + GL_ATTENUATION_EXT = $834D; + {$EXTERNALSYM GL_ATTENUATION_EXT} + GL_SHADOW_ATTENUATION_EXT = $834E; + {$EXTERNALSYM GL_SHADOW_ATTENUATION_EXT} + GL_TEXTURE_APPLICATION_MODE_EXT = $834F; + {$EXTERNALSYM GL_TEXTURE_APPLICATION_MODE_EXT} + GL_TEXTURE_LIGHT_EXT = $8350; + {$EXTERNALSYM GL_TEXTURE_LIGHT_EXT} + GL_TEXTURE_MATERIAL_FACE_EXT = $8351; + {$EXTERNALSYM GL_TEXTURE_MATERIAL_FACE_EXT} + GL_TEXTURE_MATERIAL_PARAMETER_EXT = $8352; + {$EXTERNALSYM GL_TEXTURE_MATERIAL_PARAMETER_EXT} + + // GL_SGIX_blend_alpha_minmax + GL_ALPHA_MIN_SGIX = $8320; + {$EXTERNALSYM GL_ALPHA_MIN_SGIX} + GL_ALPHA_MAX_SGIX = $8321; + {$EXTERNALSYM GL_ALPHA_MAX_SGIX} + + // GL_SGIX_async + GL_ASYNC_MARKER_SGIX = $8329; + {$EXTERNALSYM GL_ASYNC_MARKER_SGIX} + + // GL_SGIX_async_pixel + GL_ASYNC_TEX_IMAGE_SGIX = $835C; + {$EXTERNALSYM GL_ASYNC_TEX_IMAGE_SGIX} + GL_ASYNC_DRAW_PIXELS_SGIX = $835D; + {$EXTERNALSYM GL_ASYNC_DRAW_PIXELS_SGIX} + GL_ASYNC_READ_PIXELS_SGIX = $835E; + {$EXTERNALSYM GL_ASYNC_READ_PIXELS_SGIX} + GL_MAX_ASYNC_TEX_IMAGE_SGIX = $835F; + {$EXTERNALSYM GL_MAX_ASYNC_TEX_IMAGE_SGIX} + GL_MAX_ASYNC_DRAW_PIXELS_SGIX = $8360; + {$EXTERNALSYM GL_MAX_ASYNC_DRAW_PIXELS_SGIX} + GL_MAX_ASYNC_READ_PIXELS_SGIX = $8361; + {$EXTERNALSYM GL_MAX_ASYNC_READ_PIXELS_SGIX} + + // GL_SGIX_async_histogram + GL_ASYNC_HISTOGRAM_SGIX = $832C; + {$EXTERNALSYM GL_ASYNC_HISTOGRAM_SGIX} + GL_MAX_ASYNC_HISTOGRAM_SGIX = $832D; + {$EXTERNALSYM GL_MAX_ASYNC_HISTOGRAM_SGIX} + + // GL_INTEL_parallel_arrays + GL_PARALLEL_ARRAYS_INTEL = $83F4; + {$EXTERNALSYM GL_PARALLEL_ARRAYS_INTEL} + GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL = $83F5; + {$EXTERNALSYM GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL} + GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL = $83F6; + {$EXTERNALSYM GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL} + GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL = $83F7; + {$EXTERNALSYM GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL} + GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL = $83F8; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL} + + // GL_HP_occlusion_test + GL_OCCLUSION_TEST_HP = $8165; + {$EXTERNALSYM GL_OCCLUSION_TEST_HP} + GL_OCCLUSION_TEST_RESULT_HP = $8166; + {$EXTERNALSYM GL_OCCLUSION_TEST_RESULT_HP} + + // GL_EXT_pixel_transform + GL_PIXEL_TRANSFORM_2D_EXT = $8330; + {$EXTERNALSYM GL_PIXEL_TRANSFORM_2D_EXT} + GL_PIXEL_MAG_FILTER_EXT = $8331; + {$EXTERNALSYM GL_PIXEL_MAG_FILTER_EXT} + GL_PIXEL_MIN_FILTER_EXT = $8332; + {$EXTERNALSYM GL_PIXEL_MIN_FILTER_EXT} + GL_PIXEL_CUBIC_WEIGHT_EXT = $8333; + {$EXTERNALSYM GL_PIXEL_CUBIC_WEIGHT_EXT} + GL_CUBIC_EXT = $8334; + {$EXTERNALSYM GL_CUBIC_EXT} + GL_AVERAGE_EXT = $8335; + {$EXTERNALSYM GL_AVERAGE_EXT} + GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT = $8336; + {$EXTERNALSYM GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT} + GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT = $8337; + {$EXTERNALSYM GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT} + GL_PIXEL_TRANSFORM_2D_MATRIX_EXT = $8338; + {$EXTERNALSYM GL_PIXEL_TRANSFORM_2D_MATRIX_EXT} + + // GL_EXT_separate_specular_color + GL_LIGHT_MODEL_COLOR_CONTROL_EXT = $81F8; + {$EXTERNALSYM GL_LIGHT_MODEL_COLOR_CONTROL_EXT} + GL_SINGLE_COLOR_EXT = $81F9; + {$EXTERNALSYM GL_SINGLE_COLOR_EXT} + GL_SEPARATE_SPECULAR_COLOR_EXT = $81FA; + {$EXTERNALSYM GL_SEPARATE_SPECULAR_COLOR_EXT} + + // GL_EXT_secondary_color + GL_COLOR_SUM_EXT = $8458; + {$EXTERNALSYM GL_COLOR_SUM_EXT} + GL_CURRENT_SECONDARY_COLOR_EXT = $8459; + {$EXTERNALSYM GL_CURRENT_SECONDARY_COLOR_EXT} + GL_SECONDARY_COLOR_ARRAY_SIZE_EXT = $845A; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_SIZE_EXT} + GL_SECONDARY_COLOR_ARRAY_TYPE_EXT = $845B; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_TYPE_EXT} + GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT = $845C; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT} + GL_SECONDARY_COLOR_ARRAY_POINTER_EXT = $845D; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_POINTER_EXT} + GL_SECONDARY_COLOR_ARRAY_EXT = $845E; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_EXT} + + // GL_EXT_texture_perturb_normal + GL_PERTURB_EXT = $85AE; + {$EXTERNALSYM GL_PERTURB_EXT} + GL_TEXTURE_NORMAL_EXT = $85AF; + {$EXTERNALSYM GL_TEXTURE_NORMAL_EXT} + + // GL_EXT_fog_coord + GL_FOG_COORDINATE_SOURCE_EXT = $8450; + {$EXTERNALSYM GL_FOG_COORDINATE_SOURCE_EXT} + GL_FOG_COORDINATE_EXT = $8451; + {$EXTERNALSYM GL_FOG_COORDINATE_EXT} + GL_FRAGMENT_DEPTH_EXT = $8452; + {$EXTERNALSYM GL_FRAGMENT_DEPTH_EXT} + GL_CURRENT_FOG_COORDINATE_EXT = $8453; + {$EXTERNALSYM GL_CURRENT_FOG_COORDINATE_EXT} + GL_FOG_COORDINATE_ARRAY_TYPE_EXT = $8454; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_TYPE_EXT} + GL_FOG_COORDINATE_ARRAY_STRIDE_EXT = $8455; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_STRIDE_EXT} + GL_FOG_COORDINATE_ARRAY_POINTER_EXT = $8456; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_POINTER_EXT} + GL_FOG_COORDINATE_ARRAY_EXT = $8457; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_EXT} + + // GL_REND_screen_coordinates + GL_SCREEN_COORDINATES_REND = $8490; + {$EXTERNALSYM GL_SCREEN_COORDINATES_REND} + GL_INVERTED_SCREEN_W_REND = $8491; + {$EXTERNALSYM GL_INVERTED_SCREEN_W_REND} + + // GL_EXT_coordinate_frame + GL_TANGENT_ARRAY_EXT = $8439; + {$EXTERNALSYM GL_TANGENT_ARRAY_EXT} + GL_BINORMAL_ARRAY_EXT = $843A; + {$EXTERNALSYM GL_BINORMAL_ARRAY_EXT} + GL_CURRENT_TANGENT_EXT = $843B; + {$EXTERNALSYM GL_CURRENT_TANGENT_EXT} + GL_CURRENT_BINORMAL_EXT = $843C; + {$EXTERNALSYM GL_CURRENT_BINORMAL_EXT} + GL_TANGENT_ARRAY_TYPE_EXT = $843E; + {$EXTERNALSYM GL_TANGENT_ARRAY_TYPE_EXT} + GL_TANGENT_ARRAY_STRIDE_EXT = $843F; + {$EXTERNALSYM GL_TANGENT_ARRAY_STRIDE_EXT} + GL_BINORMAL_ARRAY_TYPE_EXT = $8440; + {$EXTERNALSYM GL_BINORMAL_ARRAY_TYPE_EXT} + GL_BINORMAL_ARRAY_STRIDE_EXT = $8441; + {$EXTERNALSYM GL_BINORMAL_ARRAY_STRIDE_EXT} + GL_TANGENT_ARRAY_POINTER_EXT = $8442; + {$EXTERNALSYM GL_TANGENT_ARRAY_POINTER_EXT} + GL_BINORMAL_ARRAY_POINTER_EXT = $8443; + {$EXTERNALSYM GL_BINORMAL_ARRAY_POINTER_EXT} + GL_MAP1_TANGENT_EXT = $8444; + {$EXTERNALSYM GL_MAP1_TANGENT_EXT} + GL_MAP2_TANGENT_EXT = $8445; + {$EXTERNALSYM GL_MAP2_TANGENT_EXT} + GL_MAP1_BINORMAL_EXT = $8446; + {$EXTERNALSYM GL_MAP1_BINORMAL_EXT} + GL_MAP2_BINORMAL_EXT = $8447; + {$EXTERNALSYM GL_MAP2_BINORMAL_EXT} + + // GL_EXT_texture_env_combine + GL_SOURCE3_RGB_EXT = $8583; + {$EXTERNALSYM GL_SOURCE3_RGB_EXT} + GL_SOURCE4_RGB_EXT = $8584; + {$EXTERNALSYM GL_SOURCE4_RGB_EXT} + GL_SOURCE5_RGB_EXT = $8585; + {$EXTERNALSYM GL_SOURCE5_RGB_EXT} + GL_SOURCE6_RGB_EXT = $8586; + {$EXTERNALSYM GL_SOURCE6_RGB_EXT} + GL_SOURCE7_RGB_EXT = $8587; + {$EXTERNALSYM GL_SOURCE7_RGB_EXT} + GL_SOURCE3_ALPHA_EXT = $858B; + {$EXTERNALSYM GL_SOURCE3_ALPHA_EXT} + GL_SOURCE4_ALPHA_EXT = $858C; + {$EXTERNALSYM GL_SOURCE4_ALPHA_EXT} + GL_SOURCE5_ALPHA_EXT = $858D; + {$EXTERNALSYM GL_SOURCE5_ALPHA_EXT} + GL_SOURCE6_ALPHA_EXT = $858E; + {$EXTERNALSYM GL_SOURCE6_ALPHA_EXT} + GL_SOURCE7_ALPHA_EXT = $858F; + {$EXTERNALSYM GL_SOURCE7_ALPHA_EXT} + GL_OPERAND3_RGB_EXT = $8593; + {$EXTERNALSYM GL_OPERAND3_RGB_EXT} + GL_OPERAND4_RGB_EXT = $8594; + {$EXTERNALSYM GL_OPERAND4_RGB_EXT} + GL_OPERAND5_RGB_EXT = $8595; + {$EXTERNALSYM GL_OPERAND5_RGB_EXT} + GL_OPERAND6_RGB_EXT = $8596; + {$EXTERNALSYM GL_OPERAND6_RGB_EXT} + GL_OPERAND7_RGB_EXT = $8597; + {$EXTERNALSYM GL_OPERAND7_RGB_EXT} + GL_OPERAND3_ALPHA_EXT = $859B; + {$EXTERNALSYM GL_OPERAND3_ALPHA_EXT} + GL_OPERAND4_ALPHA_EXT = $859C; + {$EXTERNALSYM GL_OPERAND4_ALPHA_EXT} + GL_OPERAND5_ALPHA_EXT = $859D; + {$EXTERNALSYM GL_OPERAND5_ALPHA_EXT} + GL_OPERAND6_ALPHA_EXT = $859E; + {$EXTERNALSYM GL_OPERAND6_ALPHA_EXT} + GL_OPERAND7_ALPHA_EXT = $859F; + {$EXTERNALSYM GL_OPERAND7_ALPHA_EXT} + + // GL_APPLE_specular_vector + GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE = $85B0; + {$EXTERNALSYM GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE} + + // GL_APPLE_transform_hint + GL_TRANSFORM_HINT_APPLE = $85B1; + {$EXTERNALSYM GL_TRANSFORM_HINT_APPLE} + + // GL_SGIX_fog_scale + GL_FOG_SCALE_SGIX = $81FC; + {$EXTERNALSYM GL_FOG_SCALE_SGIX} + GL_FOG_SCALE_VALUE_SGIX = $81FD; + {$EXTERNALSYM GL_FOG_SCALE_VALUE_SGIX} + + // GL_SUNX_constant_data + GL_UNPACK_CONSTANT_DATA_SUNX = $81D5; + {$EXTERNALSYM GL_UNPACK_CONSTANT_DATA_SUNX} + GL_TEXTURE_CONSTANT_DATA_SUNX = $81D6; + {$EXTERNALSYM GL_TEXTURE_CONSTANT_DATA_SUNX} + + // GL_SUN_global_alpha + GL_GLOBAL_ALPHA_SUN = $81D9; + {$EXTERNALSYM GL_GLOBAL_ALPHA_SUN} + GL_GLOBAL_ALPHA_FACTOR_SUN = $81DA; + {$EXTERNALSYM GL_GLOBAL_ALPHA_FACTOR_SUN} + + // GL_SUN_triangle_list + GL_RESTART_SUN = $01; + {$EXTERNALSYM GL_RESTART_SUN} + GL_REPLACE_MIDDLE_SUN = $02; + {$EXTERNALSYM GL_REPLACE_MIDDLE_SUN} + GL_REPLACE_OLDEST_SUN = $03; + {$EXTERNALSYM GL_REPLACE_OLDEST_SUN} + GL_TRIANGLE_LIST_SUN = $81D7; + {$EXTERNALSYM GL_TRIANGLE_LIST_SUN} + GL_REPLACEMENT_CODE_SUN = $81D8; + {$EXTERNALSYM GL_REPLACEMENT_CODE_SUN} + GL_REPLACEMENT_CODE_ARRAY_SUN = $85C0; + {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_SUN} + GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN = $85C1; + {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN} + GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN = $85C2; + {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN} + GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN = $85C3; + {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN} + GL_R1UI_V3F_SUN = $85C4; + {$EXTERNALSYM GL_R1UI_V3F_SUN} + GL_R1UI_C4UB_V3F_SUN = $85C5; + {$EXTERNALSYM GL_R1UI_C4UB_V3F_SUN} + GL_R1UI_C3F_V3F_SUN = $85C6; + {$EXTERNALSYM GL_R1UI_C3F_V3F_SUN} + GL_R1UI_N3F_V3F_SUN = $85C7; + {$EXTERNALSYM GL_R1UI_N3F_V3F_SUN} + GL_R1UI_C4F_N3F_V3F_SUN = $85C8; + {$EXTERNALSYM GL_R1UI_C4F_N3F_V3F_SUN} + GL_R1UI_T2F_V3F_SUN = $85C9; + {$EXTERNALSYM GL_R1UI_T2F_V3F_SUN} + GL_R1UI_T2F_N3F_V3F_SUN = $85CA; + {$EXTERNALSYM GL_R1UI_T2F_N3F_V3F_SUN} + GL_R1UI_T2F_C4F_N3F_V3F_SUN = $85CB; + {$EXTERNALSYM GL_R1UI_T2F_C4F_N3F_V3F_SUN} + + // GL_EXT_blend_func_separate + GL_BLEND_DST_RGB_EXT = $80C8; + {$EXTERNALSYM GL_BLEND_DST_RGB_EXT} + GL_BLEND_SRC_RGB_EXT = $80C9; + {$EXTERNALSYM GL_BLEND_SRC_RGB_EXT} + GL_BLEND_DST_ALPHA_EXT = $80CA; + {$EXTERNALSYM GL_BLEND_DST_ALPHA_EXT} + GL_BLEND_SRC_ALPHA_EXT = $80CB; + {$EXTERNALSYM GL_BLEND_SRC_ALPHA_EXT} + + // GL_INGR_color_clamp + GL_RED_MIN_CLAMP_INGR = $8560; + {$EXTERNALSYM GL_RED_MIN_CLAMP_INGR} + GL_GREEN_MIN_CLAMP_INGR = $8561; + {$EXTERNALSYM GL_GREEN_MIN_CLAMP_INGR} + GL_BLUE_MIN_CLAMP_INGR = $8562; + {$EXTERNALSYM GL_BLUE_MIN_CLAMP_INGR} + GL_ALPHA_MIN_CLAMP_INGR = $8563; + {$EXTERNALSYM GL_ALPHA_MIN_CLAMP_INGR} + GL_RED_MAX_CLAMP_INGR = $8564; + {$EXTERNALSYM GL_RED_MAX_CLAMP_INGR} + GL_GREEN_MAX_CLAMP_INGR = $8565; + {$EXTERNALSYM GL_GREEN_MAX_CLAMP_INGR} + GL_BLUE_MAX_CLAMP_INGR = $8566; + {$EXTERNALSYM GL_BLUE_MAX_CLAMP_INGR} + GL_ALPHA_MAX_CLAMP_INGR = $8567; + {$EXTERNALSYM GL_ALPHA_MAX_CLAMP_INGR} + + // GL_INGR_interlace_read + GL_INTERLACE_READ_INGR = $8568; + {$EXTERNALSYM GL_INTERLACE_READ_INGR} + + // GL_EXT_422_pixels + GL_422_EXT = $80CC; + {$EXTERNALSYM GL_422_EXT} + GL_422_REV_EXT = $80CD; + {$EXTERNALSYM GL_422_REV_EXT} + GL_422_AVERAGE_EXT = $80CE; + {$EXTERNALSYM GL_422_AVERAGE_EXT} + GL_422_REV_AVERAGE_EXT = $80CF; + {$EXTERNALSYM GL_422_REV_AVERAGE_EXT} + + // GL_EXT_texture_cube_map + GL_NORMAL_MAP_EXT = $8511; + {$EXTERNALSYM GL_NORMAL_MAP_EXT} + GL_REFLECTION_MAP_EXT = $8512; + {$EXTERNALSYM GL_REFLECTION_MAP_EXT} + GL_TEXTURE_CUBE_MAP_EXT = $8513; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_EXT} + GL_TEXTURE_BINDING_CUBE_MAP_EXT = $8514; + {$EXTERNALSYM GL_TEXTURE_BINDING_CUBE_MAP_EXT} + GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT = $8515; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT} + GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT = $8516; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT} + GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT = $8517; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT} + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT = $8518; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT} + GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT = $8519; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT} + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT = $851A; + {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT} + GL_PROXY_TEXTURE_CUBE_MAP_EXT = $851B; + {$EXTERNALSYM GL_PROXY_TEXTURE_CUBE_MAP_EXT} + GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT = $851C; + {$EXTERNALSYM GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT} + + // GL_SUN_convolution_border_modes + GL_WRAP_BORDER_SUN = $81D4; + {$EXTERNALSYM GL_WRAP_BORDER_SUN} + + // GL_EXT_texture_lod_bias + GL_MAX_TEXTURE_LOD_BIAS_EXT = $84FD; + {$EXTERNALSYM GL_MAX_TEXTURE_LOD_BIAS_EXT} + GL_TEXTURE_FILTER_CONTROL_EXT = $8500; + {$EXTERNALSYM GL_TEXTURE_FILTER_CONTROL_EXT} + GL_TEXTURE_LOD_BIAS_EXT = $8501; + {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_EXT} + + // GL_EXT_texture_filter_anisotropic + GL_TEXTURE_MAX_ANISOTROPY_EXT = $84FE; + {$EXTERNALSYM GL_TEXTURE_MAX_ANISOTROPY_EXT} + GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = $84FF; + {$EXTERNALSYM GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT} + + // GL_EXT_vertex_weighting + GL_MODELVIEW0_STACK_DEPTH_EXT = GL_MODELVIEW_STACK_DEPTH; + {$EXTERNALSYM GL_MODELVIEW0_STACK_DEPTH_EXT} + GL_MODELVIEW1_STACK_DEPTH_EXT = $8502; + {$EXTERNALSYM GL_MODELVIEW1_STACK_DEPTH_EXT} + GL_MODELVIEW0_MATRIX_EXT = GL_MODELVIEW_MATRIX; + {$EXTERNALSYM GL_MODELVIEW0_MATRIX_EXT} + GL_MODELVIEW_MATRIX1_EXT = $8506; + {$EXTERNALSYM GL_MODELVIEW_MATRIX1_EXT} + GL_VERTEX_WEIGHTING_EXT = $8509; + {$EXTERNALSYM GL_VERTEX_WEIGHTING_EXT} + GL_MODELVIEW0_EXT = GL_MODELVIEW; + {$EXTERNALSYM GL_MODELVIEW0_EXT} + GL_MODELVIEW1_EXT = $850A; + {$EXTERNALSYM GL_MODELVIEW1_EXT} + GL_CURRENT_VERTEX_WEIGHT_EXT = $850B; + {$EXTERNALSYM GL_CURRENT_VERTEX_WEIGHT_EXT} + GL_VERTEX_WEIGHT_ARRAY_EXT = $850C; + {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_EXT} + GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT = $850D; + {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT} + GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT = $850E; + {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT} + GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT = $850F; + {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT} + GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT = $8510; + {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT} + + // GL_NV_light_max_exponent + GL_MAX_SHININESS_NV = $8504; + {$EXTERNALSYM GL_MAX_SHININESS_NV} + GL_MAX_SPOT_EXPONENT_NV = $8505; + {$EXTERNALSYM GL_MAX_SPOT_EXPONENT_NV} + + // GL_NV_vertex_array_range + GL_VERTEX_ARRAY_RANGE_NV = $851D; + {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_NV} + GL_VERTEX_ARRAY_RANGE_LENGTH_NV = $851E; + {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_LENGTH_NV} + GL_VERTEX_ARRAY_RANGE_VALID_NV = $851F; + {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_VALID_NV} + GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV = $8520; + {$EXTERNALSYM GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV} + GL_VERTEX_ARRAY_RANGE_POINTER_NV = $8521; + {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_POINTER_NV} + + // GL_NV_register_combiners + GL_REGISTER_COMBINERS_NV = $8522; + {$EXTERNALSYM GL_REGISTER_COMBINERS_NV} + GL_VARIABLE_A_NV = $8523; + {$EXTERNALSYM GL_VARIABLE_A_NV} + GL_VARIABLE_B_NV = $8524; + {$EXTERNALSYM GL_VARIABLE_B_NV} + GL_VARIABLE_C_NV = $8525; + {$EXTERNALSYM GL_VARIABLE_C_NV} + GL_VARIABLE_D_NV = $8526; + {$EXTERNALSYM GL_VARIABLE_D_NV} + GL_VARIABLE_E_NV = $8527; + {$EXTERNALSYM GL_VARIABLE_E_NV} + GL_VARIABLE_F_NV = $8528; + {$EXTERNALSYM GL_VARIABLE_F_NV} + GL_VARIABLE_G_NV = $8529; + {$EXTERNALSYM GL_VARIABLE_G_NV} + GL_CONSTANT_COLOR0_NV = $852A; + {$EXTERNALSYM GL_CONSTANT_COLOR0_NV} + GL_CONSTANT_COLOR1_NV = $852B; + {$EXTERNALSYM GL_CONSTANT_COLOR1_NV} + GL_PRIMARY_COLOR_NV = $852C; + {$EXTERNALSYM GL_PRIMARY_COLOR_NV} + GL_SECONDARY_COLOR_NV = $852D; + {$EXTERNALSYM GL_SECONDARY_COLOR_NV} + GL_SPARE0_NV = $852E; + {$EXTERNALSYM GL_SPARE0_NV} + GL_SPARE1_NV = $852F; + {$EXTERNALSYM GL_SPARE1_NV} + GL_DISCARD_NV = $8530; + {$EXTERNALSYM GL_DISCARD_NV} + GL_E_TIMES_F_NV = $8531; + {$EXTERNALSYM GL_E_TIMES_F_NV} + GL_SPARE0_PLUS_SECONDARY_COLOR_NV = $8532; + {$EXTERNALSYM GL_SPARE0_PLUS_SECONDARY_COLOR_NV} + GL_UNSIGNED_IDENTITY_NV = $8536; + {$EXTERNALSYM GL_UNSIGNED_IDENTITY_NV} + GL_UNSIGNED_INVERT_NV = $8537; + {$EXTERNALSYM GL_UNSIGNED_INVERT_NV} + GL_EXPAND_NORMAL_NV = $8538; + {$EXTERNALSYM GL_EXPAND_NORMAL_NV} + GL_EXPAND_NEGATE_NV = $8539; + {$EXTERNALSYM GL_EXPAND_NEGATE_NV} + GL_HALF_BIAS_NORMAL_NV = $853A; + {$EXTERNALSYM GL_HALF_BIAS_NORMAL_NV} + GL_HALF_BIAS_NEGATE_NV = $853B; + {$EXTERNALSYM GL_HALF_BIAS_NEGATE_NV} + GL_SIGNED_IDENTITY_NV = $853C; + {$EXTERNALSYM GL_SIGNED_IDENTITY_NV} + GL_SIGNED_NEGATE_NV = $853D; + {$EXTERNALSYM GL_SIGNED_NEGATE_NV} + GL_SCALE_BY_TWO_NV = $853E; + {$EXTERNALSYM GL_SCALE_BY_TWO_NV} + GL_SCALE_BY_FOUR_NV = $853F; + {$EXTERNALSYM GL_SCALE_BY_FOUR_NV} + GL_SCALE_BY_ONE_HALF_NV = $8540; + {$EXTERNALSYM GL_SCALE_BY_ONE_HALF_NV} + GL_BIAS_BY_NEGATIVE_ONE_HALF_NV = $8541; + {$EXTERNALSYM GL_BIAS_BY_NEGATIVE_ONE_HALF_NV} + GL_COMBINER_INPUT_NV = $8542; + {$EXTERNALSYM GL_COMBINER_INPUT_NV} + GL_COMBINER_MAPPING_NV = $8543; + {$EXTERNALSYM GL_COMBINER_MAPPING_NV} + GL_COMBINER_COMPONENT_USAGE_NV = $8544; + {$EXTERNALSYM GL_COMBINER_COMPONENT_USAGE_NV} + GL_COMBINER_AB_DOT_PRODUCT_NV = $8545; + {$EXTERNALSYM GL_COMBINER_AB_DOT_PRODUCT_NV} + GL_COMBINER_CD_DOT_PRODUCT_NV = $8546; + {$EXTERNALSYM GL_COMBINER_CD_DOT_PRODUCT_NV} + GL_COMBINER_MUX_SUM_NV = $8547; + {$EXTERNALSYM GL_COMBINER_MUX_SUM_NV} + GL_COMBINER_SCALE_NV = $8548; + {$EXTERNALSYM GL_COMBINER_SCALE_NV} + GL_COMBINER_BIAS_NV = $8549; + {$EXTERNALSYM GL_COMBINER_BIAS_NV} + GL_COMBINER_AB_OUTPUT_NV = $854A; + {$EXTERNALSYM GL_COMBINER_AB_OUTPUT_NV} + GL_COMBINER_CD_OUTPUT_NV = $854B; + {$EXTERNALSYM GL_COMBINER_CD_OUTPUT_NV} + GL_COMBINER_SUM_OUTPUT_NV = $854C; + {$EXTERNALSYM GL_COMBINER_SUM_OUTPUT_NV} + GL_MAX_GENERAL_COMBINERS_NV = $854D; + {$EXTERNALSYM GL_MAX_GENERAL_COMBINERS_NV} + GL_NUM_GENERAL_COMBINERS_NV = $854E; + {$EXTERNALSYM GL_NUM_GENERAL_COMBINERS_NV} + GL_COLOR_SUM_CLAMP_NV = $854F; + {$EXTERNALSYM GL_COLOR_SUM_CLAMP_NV} + GL_COMBINER0_NV = $8550; + {$EXTERNALSYM GL_COMBINER0_NV} + GL_COMBINER1_NV = $8551; + {$EXTERNALSYM GL_COMBINER1_NV} + GL_COMBINER2_NV = $8552; + {$EXTERNALSYM GL_COMBINER2_NV} + GL_COMBINER3_NV = $8553; + {$EXTERNALSYM GL_COMBINER3_NV} + GL_COMBINER4_NV = $8554; + {$EXTERNALSYM GL_COMBINER4_NV} + GL_COMBINER5_NV = $8555; + {$EXTERNALSYM GL_COMBINER5_NV} + GL_COMBINER6_NV = $8556; + {$EXTERNALSYM GL_COMBINER6_NV} + GL_COMBINER7_NV = $8557; + {$EXTERNALSYM GL_COMBINER7_NV} + + // GL_NV_fog_distance + GL_FOG_DISTANCE_MODE_NV = $855A; + {$EXTERNALSYM GL_FOG_DISTANCE_MODE_NV} + GL_EYE_RADIAL_NV = $855B; + {$EXTERNALSYM GL_EYE_RADIAL_NV} + GL_EYE_PLANE_ABSOLUTE_NV = $855C; + {$EXTERNALSYM GL_EYE_PLANE_ABSOLUTE_NV} + + // GL_NV_texgen_emboss + GL_EMBOSS_LIGHT_NV = $855D; + {$EXTERNALSYM GL_EMBOSS_LIGHT_NV} + GL_EMBOSS_CONSTANT_NV = $855E; + {$EXTERNALSYM GL_EMBOSS_CONSTANT_NV} + GL_EMBOSS_MAP_NV = $855F; + {$EXTERNALSYM GL_EMBOSS_MAP_NV} + + // GL_EXT_texture_compression_s3tc + GL_COMPRESSED_RGB_S3TC_DXT1_EXT = $83F0; + {$EXTERNALSYM GL_COMPRESSED_RGB_S3TC_DXT1_EXT} + GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = $83F1; + {$EXTERNALSYM GL_COMPRESSED_RGBA_S3TC_DXT1_EXT} + GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = $83F2; + {$EXTERNALSYM GL_COMPRESSED_RGBA_S3TC_DXT3_EXT} + GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = $83F3; + {$EXTERNALSYM GL_COMPRESSED_RGBA_S3TC_DXT5_EXT} + + // GL_IBM_cull_vertex + GL_CULL_VERTEX_IBM = 103050; + {$EXTERNALSYM GL_CULL_VERTEX_IBM} + + // GL_IBM_vertex_array_lists + GL_VERTEX_ARRAY_LIST_IBM = 103070; + {$EXTERNALSYM GL_VERTEX_ARRAY_LIST_IBM} + GL_NORMAL_ARRAY_LIST_IBM = 103071; + {$EXTERNALSYM GL_NORMAL_ARRAY_LIST_IBM} + GL_COLOR_ARRAY_LIST_IBM = 103072; + {$EXTERNALSYM GL_COLOR_ARRAY_LIST_IBM} + GL_INDEX_ARRAY_LIST_IBM = 103073; + {$EXTERNALSYM GL_INDEX_ARRAY_LIST_IBM} + GL_TEXTURE_COORD_ARRAY_LIST_IBM = 103074; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_LIST_IBM} + GL_EDGE_FLAG_ARRAY_LIST_IBM = 103075; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_LIST_IBM} + GL_FOG_COORDINATE_ARRAY_LIST_IBM = 103076; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_LIST_IBM} + GL_SECONDARY_COLOR_ARRAY_LIST_IBM = 103077; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_LIST_IBM} + GL_VERTEX_ARRAY_LIST_STRIDE_IBM = 103080; + {$EXTERNALSYM GL_VERTEX_ARRAY_LIST_STRIDE_IBM} + GL_NORMAL_ARRAY_LIST_STRIDE_IBM = 103081; + {$EXTERNALSYM GL_NORMAL_ARRAY_LIST_STRIDE_IBM} + GL_COLOR_ARRAY_LIST_STRIDE_IBM = 103082; + {$EXTERNALSYM GL_COLOR_ARRAY_LIST_STRIDE_IBM} + GL_INDEX_ARRAY_LIST_STRIDE_IBM = 103083; + {$EXTERNALSYM GL_INDEX_ARRAY_LIST_STRIDE_IBM} + GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM = 103084; + {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM} + GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM = 103085; + {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM} + GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM = 103086; + {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM} + GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM = 103087; + {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM} + + // GL_SGIX_subsample + GL_PACK_SUBSAMPLE_RATE_SGIX = $85A0; + {$EXTERNALSYM GL_PACK_SUBSAMPLE_RATE_SGIX} + GL_UNPACK_SUBSAMPLE_RATE_SGIX = $85A1; + {$EXTERNALSYM GL_UNPACK_SUBSAMPLE_RATE_SGIX} + GL_PIXEL_SUBSAMPLE_4444_SGIX = $85A2; + {$EXTERNALSYM GL_PIXEL_SUBSAMPLE_4444_SGIX} + GL_PIXEL_SUBSAMPLE_2424_SGIX = $85A3; + {$EXTERNALSYM GL_PIXEL_SUBSAMPLE_2424_SGIX} + GL_PIXEL_SUBSAMPLE_4242_SGIX = $85A4; + {$EXTERNALSYM GL_PIXEL_SUBSAMPLE_4242_SGIX} + + // GL_SGIX_ycrcba + GL_YCRCB_SGIX = $8318; + {$EXTERNALSYM GL_YCRCB_SGIX} + GL_YCRCBA_SGIX = $8319; + {$EXTERNALSYM GL_YCRCBA_SGIX} + + // GL_SGI_depth_pass_instrument + GL_DEPTH_PASS_INSTRUMENT_SGIX = $8310; + {$EXTERNALSYM GL_DEPTH_PASS_INSTRUMENT_SGIX} + GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX = $8311; + {$EXTERNALSYM GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX} + GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX = $8312; + {$EXTERNALSYM GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX} + + // GL_3DFX_texture_compression_FXT1 + GL_COMPRESSED_RGB_FXT1_3DFX = $86B0; + {$EXTERNALSYM GL_COMPRESSED_RGB_FXT1_3DFX} + GL_COMPRESSED_RGBA_FXT1_3DFX = $86B1; + {$EXTERNALSYM GL_COMPRESSED_RGBA_FXT1_3DFX} + + // GL_3DFX_multisample + GL_MULTISAMPLE_3DFX = $86B2; + {$EXTERNALSYM GL_MULTISAMPLE_3DFX} + GL_SAMPLE_BUFFERS_3DFX = $86B3; + {$EXTERNALSYM GL_SAMPLE_BUFFERS_3DFX} + GL_SAMPLES_3DFX = $86B4; + {$EXTERNALSYM GL_SAMPLES_3DFX} + GL_MULTISAMPLE_BIT_3DFX = $20000000; + {$EXTERNALSYM GL_MULTISAMPLE_BIT_3DFX} + + // GL_EXT_multisample + GL_MULTISAMPLE_EXT = $809D; + {$EXTERNALSYM GL_MULTISAMPLE_EXT} + GL_SAMPLE_ALPHA_TO_MASK_EXT = $809E; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_MASK_EXT} + GL_SAMPLE_ALPHA_TO_ONE_EXT = $809F; + {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_ONE_EXT} + GL_SAMPLE_MASK_EXT = $80A0; + {$EXTERNALSYM GL_SAMPLE_MASK_EXT} + GL_1PASS_EXT = $80A1; + {$EXTERNALSYM GL_1PASS_EXT} + GL_2PASS_0_EXT = $80A2; + {$EXTERNALSYM GL_2PASS_0_EXT} + GL_2PASS_1_EXT = $80A3; + {$EXTERNALSYM GL_2PASS_1_EXT} + GL_4PASS_0_EXT = $80A4; + {$EXTERNALSYM GL_4PASS_0_EXT} + GL_4PASS_1_EXT = $80A5; + {$EXTERNALSYM GL_4PASS_1_EXT} + GL_4PASS_2_EXT = $80A6; + {$EXTERNALSYM GL_4PASS_2_EXT} + GL_4PASS_3_EXT = $80A7; + {$EXTERNALSYM GL_4PASS_3_EXT} + GL_SAMPLE_BUFFERS_EXT = $80A8; + {$EXTERNALSYM GL_SAMPLE_BUFFERS_EXT} + GL_SAMPLES_EXT = $80A9; + {$EXTERNALSYM GL_SAMPLES_EXT} + GL_SAMPLE_MASK_VALUE_EXT = $80AA; + {$EXTERNALSYM GL_SAMPLE_MASK_VALUE_EXT} + GL_SAMPLE_MASK_INVERT_EXT = $80AB; + {$EXTERNALSYM GL_SAMPLE_MASK_INVERT_EXT} + GL_SAMPLE_PATTERN_EXT = $80AC; + {$EXTERNALSYM GL_SAMPLE_PATTERN_EXT} + + // GL_SGIX_vertex_preclip + GL_VERTEX_PRECLIP_SGIX = $83EE; + {$EXTERNALSYM GL_VERTEX_PRECLIP_SGIX} + GL_VERTEX_PRECLIP_HINT_SGIX = $83EF; + {$EXTERNALSYM GL_VERTEX_PRECLIP_HINT_SGIX} + + // GL_SGIX_convolution_accuracy + GL_CONVOLUTION_HINT_SGIX = $8316; + {$EXTERNALSYM GL_CONVOLUTION_HINT_SGIX} + + // GL_SGIX_resample + GL_PACK_RESAMPLE_SGIX = $842C; + {$EXTERNALSYM GL_PACK_RESAMPLE_SGIX} + GL_UNPACK_RESAMPLE_SGIX = $842D; + {$EXTERNALSYM GL_UNPACK_RESAMPLE_SGIX} + GL_RESAMPLE_REPLICATE_SGIX = $842E; + {$EXTERNALSYM GL_RESAMPLE_REPLICATE_SGIX} + GL_RESAMPLE_ZERO_FILL_SGIX = $842F; + {$EXTERNALSYM GL_RESAMPLE_ZERO_FILL_SGIX} + GL_RESAMPLE_DECIMATE_SGIX = $8430; + {$EXTERNALSYM GL_RESAMPLE_DECIMATE_SGIX} + + // GL_SGIS_point_line_texgen + GL_EYE_DISTANCE_TO_POINT_SGIS = $81F0; + {$EXTERNALSYM GL_EYE_DISTANCE_TO_POINT_SGIS} + GL_OBJECT_DISTANCE_TO_POINT_SGIS = $81F1; + {$EXTERNALSYM GL_OBJECT_DISTANCE_TO_POINT_SGIS} + GL_EYE_DISTANCE_TO_LINE_SGIS = $81F2; + {$EXTERNALSYM GL_EYE_DISTANCE_TO_LINE_SGIS} + GL_OBJECT_DISTANCE_TO_LINE_SGIS = $81F3; + {$EXTERNALSYM GL_OBJECT_DISTANCE_TO_LINE_SGIS} + GL_EYE_POINT_SGIS = $81F4; + {$EXTERNALSYM GL_EYE_POINT_SGIS} + GL_OBJECT_POINT_SGIS = $81F5; + {$EXTERNALSYM GL_OBJECT_POINT_SGIS} + GL_EYE_LINE_SGIS = $81F6; + {$EXTERNALSYM GL_EYE_LINE_SGIS} + GL_OBJECT_LINE_SGIS = $81F7; + {$EXTERNALSYM GL_OBJECT_LINE_SGIS} + + // GL_SGIS_texture_color_mask + GL_TEXTURE_COLOR_WRITEMASK_SGIS = $81EF; + {$EXTERNALSYM GL_TEXTURE_COLOR_WRITEMASK_SGIS} + + // GL_NV_vertex_program + GL_VERTEX_PROGRAM_NV = $8620; + {$EXTERNALSYM GL_VERTEX_PROGRAM_NV} + GL_VERTEX_STATE_PROGRAM_NV = $8621; + {$EXTERNALSYM GL_VERTEX_STATE_PROGRAM_NV} + GL_ATTRIB_ARRAY_SIZE_NV = $8623; + {$EXTERNALSYM GL_ATTRIB_ARRAY_SIZE_NV} + GL_ATTRIB_ARRAY_STRIDE_NV = $8624; + {$EXTERNALSYM GL_ATTRIB_ARRAY_STRIDE_NV} + GL_ATTRIB_ARRAY_TYPE_NV = $8625; + {$EXTERNALSYM GL_ATTRIB_ARRAY_TYPE_NV} + GL_CURRENT_ATTRIB_NV = $8626; + {$EXTERNALSYM GL_CURRENT_ATTRIB_NV} + GL_PROGRAM_LENGTH_NV = $8627; + {$EXTERNALSYM GL_PROGRAM_LENGTH_NV} + GL_PROGRAM_STRING_NV = $8628; + {$EXTERNALSYM GL_PROGRAM_STRING_NV} + GL_MODELVIEW_PROJECTION_NV = $8629; + {$EXTERNALSYM GL_MODELVIEW_PROJECTION_NV} + GL_IDENTITY_NV = $862A; + {$EXTERNALSYM GL_IDENTITY_NV} + GL_INVERSE_NV = $862B; + {$EXTERNALSYM GL_INVERSE_NV} + GL_TRANSPOSE_NV = $862C; + {$EXTERNALSYM GL_TRANSPOSE_NV} + GL_INVERSE_TRANSPOSE_NV = $862D; + {$EXTERNALSYM GL_INVERSE_TRANSPOSE_NV} + GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV = $862E; + {$EXTERNALSYM GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV} + GL_MAX_TRACK_MATRICES_NV = $862F; + {$EXTERNALSYM GL_MAX_TRACK_MATRICES_NV} + GL_MATRIX0_NV = $8630; + {$EXTERNALSYM GL_MATRIX0_NV} + GL_MATRIX1_NV = $8631; + {$EXTERNALSYM GL_MATRIX1_NV} + GL_MATRIX2_NV = $8632; + {$EXTERNALSYM GL_MATRIX2_NV} + GL_MATRIX3_NV = $8633; + {$EXTERNALSYM GL_MATRIX3_NV} + GL_MATRIX4_NV = $8634; + {$EXTERNALSYM GL_MATRIX4_NV} + GL_MATRIX5_NV = $8635; + {$EXTERNALSYM GL_MATRIX5_NV} + GL_MATRIX6_NV = $8636; + {$EXTERNALSYM GL_MATRIX6_NV} + GL_MATRIX7_NV = $8637; + {$EXTERNALSYM GL_MATRIX7_NV} + GL_CURRENT_MATRIX_STACK_DEPTH_NV = $8640; + {$EXTERNALSYM GL_CURRENT_MATRIX_STACK_DEPTH_NV} + GL_CURRENT_MATRIX_NV = $8641; + {$EXTERNALSYM GL_CURRENT_MATRIX_NV} + GL_VERTEX_PROGRAM_POINT_SIZE_NV = $8642; + {$EXTERNALSYM GL_VERTEX_PROGRAM_POINT_SIZE_NV} + GL_VERTEX_PROGRAM_TWO_SIDE_NV = $8643; + {$EXTERNALSYM GL_VERTEX_PROGRAM_TWO_SIDE_NV} + GL_PROGRAM_PARAMETER_NV = $8644; + {$EXTERNALSYM GL_PROGRAM_PARAMETER_NV} + GL_ATTRIB_ARRAY_POINTER_NV = $8645; + {$EXTERNALSYM GL_ATTRIB_ARRAY_POINTER_NV} + GL_PROGRAM_TARGET_NV = $8646; + {$EXTERNALSYM GL_PROGRAM_TARGET_NV} + GL_PROGRAM_RESIDENT_NV = $8647; + {$EXTERNALSYM GL_PROGRAM_RESIDENT_NV} + GL_TRACK_MATRIX_NV = $8648; + {$EXTERNALSYM GL_TRACK_MATRIX_NV} + GL_TRACK_MATRIX_TRANSFORM_NV = $8649; + {$EXTERNALSYM GL_TRACK_MATRIX_TRANSFORM_NV} + GL_VERTEX_PROGRAM_BINDING_NV = $864A; + {$EXTERNALSYM GL_VERTEX_PROGRAM_BINDING_NV} + GL_PROGRAM_ERROR_POSITION_NV = $864B; + {$EXTERNALSYM GL_PROGRAM_ERROR_POSITION_NV} + GL_VERTEX_ATTRIB_ARRAY0_NV = $8650; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY0_NV} + GL_VERTEX_ATTRIB_ARRAY1_NV = $8651; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY1_NV} + GL_VERTEX_ATTRIB_ARRAY2_NV = $8652; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY2_NV} + GL_VERTEX_ATTRIB_ARRAY3_NV = $8653; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY3_NV} + GL_VERTEX_ATTRIB_ARRAY4_NV = $8654; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY4_NV} + GL_VERTEX_ATTRIB_ARRAY5_NV = $8655; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY5_NV} + GL_VERTEX_ATTRIB_ARRAY6_NV = $8656; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY6_NV} + GL_VERTEX_ATTRIB_ARRAY7_NV = $8657; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY7_NV} + GL_VERTEX_ATTRIB_ARRAY8_NV = $8658; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY8_NV} + GL_VERTEX_ATTRIB_ARRAY9_NV = $8659; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY9_NV} + GL_VERTEX_ATTRIB_ARRAY10_NV = $865A; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY10_NV} + GL_VERTEX_ATTRIB_ARRAY11_NV = $865B; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY11_NV} + GL_VERTEX_ATTRIB_ARRAY12_NV = $865C; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY12_NV} + GL_VERTEX_ATTRIB_ARRAY13_NV = $865D; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY13_NV} + GL_VERTEX_ATTRIB_ARRAY14_NV = $865E; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY14_NV} + GL_VERTEX_ATTRIB_ARRAY15_NV = $865F; + {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY15_NV} + GL_MAP1_VERTEX_ATTRIB0_4_NV = $8660; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB0_4_NV} + GL_MAP1_VERTEX_ATTRIB1_4_NV = $8661; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB1_4_NV} + GL_MAP1_VERTEX_ATTRIB2_4_NV = $8662; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB2_4_NV} + GL_MAP1_VERTEX_ATTRIB3_4_NV = $8663; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB3_4_NV} + GL_MAP1_VERTEX_ATTRIB4_4_NV = $8664; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB4_4_NV} + GL_MAP1_VERTEX_ATTRIB5_4_NV = $8665; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB5_4_NV} + GL_MAP1_VERTEX_ATTRIB6_4_NV = $8666; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB6_4_NV} + GL_MAP1_VERTEX_ATTRIB7_4_NV = $8667; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB7_4_NV} + GL_MAP1_VERTEX_ATTRIB8_4_NV = $8668; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB8_4_NV} + GL_MAP1_VERTEX_ATTRIB9_4_NV = $8669; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB9_4_NV} + GL_MAP1_VERTEX_ATTRIB10_4_NV = $866A; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB10_4_NV} + GL_MAP1_VERTEX_ATTRIB11_4_NV = $866B; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB11_4_NV} + GL_MAP1_VERTEX_ATTRIB12_4_NV = $866C; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB12_4_NV} + GL_MAP1_VERTEX_ATTRIB13_4_NV = $866D; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB13_4_NV} + GL_MAP1_VERTEX_ATTRIB14_4_NV = $866E; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB14_4_NV} + GL_MAP1_VERTEX_ATTRIB15_4_NV = $866F; + {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB15_4_NV} + GL_MAP2_VERTEX_ATTRIB0_4_NV = $8670; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB0_4_NV} + GL_MAP2_VERTEX_ATTRIB1_4_NV = $8671; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB1_4_NV} + GL_MAP2_VERTEX_ATTRIB2_4_NV = $8672; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB2_4_NV} + GL_MAP2_VERTEX_ATTRIB3_4_NV = $8673; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB3_4_NV} + GL_MAP2_VERTEX_ATTRIB4_4_NV = $8674; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB4_4_NV} + GL_MAP2_VERTEX_ATTRIB5_4_NV = $8675; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB5_4_NV} + GL_MAP2_VERTEX_ATTRIB6_4_NV = $8676; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB6_4_NV} + GL_MAP2_VERTEX_ATTRIB7_4_NV = $8677; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB7_4_NV} + GL_MAP2_VERTEX_ATTRIB8_4_NV = $8678; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB8_4_NV} + GL_MAP2_VERTEX_ATTRIB9_4_NV = $8679; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB9_4_NV} + GL_MAP2_VERTEX_ATTRIB10_4_NV = $867A; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB10_4_NV} + GL_MAP2_VERTEX_ATTRIB11_4_NV = $867B; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB11_4_NV} + GL_MAP2_VERTEX_ATTRIB12_4_NV = $867C; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB12_4_NV} + GL_MAP2_VERTEX_ATTRIB13_4_NV = $867D; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB13_4_NV} + GL_MAP2_VERTEX_ATTRIB14_4_NV = $867E; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB14_4_NV} + GL_MAP2_VERTEX_ATTRIB15_4_NV = $867F; + {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB15_4_NV} + + // WGL_ARB_pixel_format + WGL_NUMBER_PIXEL_FORMATS_ARB = $2000; + {$EXTERNALSYM WGL_NUMBER_PIXEL_FORMATS_ARB} + WGL_DRAW_TO_WINDOW_ARB = $2001; + {$EXTERNALSYM WGL_DRAW_TO_WINDOW_ARB} + WGL_DRAW_TO_BITMAP_ARB = $2002; + {$EXTERNALSYM WGL_DRAW_TO_BITMAP_ARB} + WGL_ACCELERATION_ARB = $2003; + {$EXTERNALSYM WGL_ACCELERATION_ARB} + WGL_NEED_PALETTE_ARB = $2004; + {$EXTERNALSYM WGL_NEED_PALETTE_ARB} + WGL_NEED_SYSTEM_PALETTE_ARB = $2005; + {$EXTERNALSYM WGL_NEED_SYSTEM_PALETTE_ARB} + WGL_SWAP_LAYER_BUFFERS_ARB = $2006; + {$EXTERNALSYM WGL_SWAP_LAYER_BUFFERS_ARB} + WGL_SWAP_METHOD_ARB = $2007; + {$EXTERNALSYM WGL_SWAP_METHOD_ARB} + WGL_NUMBER_OVERLAYS_ARB = $2008; + {$EXTERNALSYM WGL_NUMBER_OVERLAYS_ARB} + WGL_NUMBER_UNDERLAYS_ARB = $2009; + {$EXTERNALSYM WGL_NUMBER_UNDERLAYS_ARB} + WGL_TRANSPARENT_ARB = $200A; + {$EXTERNALSYM WGL_TRANSPARENT_ARB} + WGL_TRANSPARENT_RED_VALUE_ARB = $2037; + {$EXTERNALSYM WGL_TRANSPARENT_RED_VALUE_ARB} + WGL_TRANSPARENT_GREEN_VALUE_ARB = $2038; + {$EXTERNALSYM WGL_TRANSPARENT_GREEN_VALUE_ARB} + WGL_TRANSPARENT_BLUE_VALUE_ARB = $2039; + {$EXTERNALSYM WGL_TRANSPARENT_BLUE_VALUE_ARB} + WGL_TRANSPARENT_ALPHA_VALUE_ARB = $203A; + {$EXTERNALSYM WGL_TRANSPARENT_ALPHA_VALUE_ARB} + WGL_TRANSPARENT_INDEX_VALUE_ARB = $203B; + {$EXTERNALSYM WGL_TRANSPARENT_INDEX_VALUE_ARB} + WGL_SHARE_DEPTH_ARB = $200C; + {$EXTERNALSYM WGL_SHARE_DEPTH_ARB} + WGL_SHARE_STENCIL_ARB = $200D; + {$EXTERNALSYM WGL_SHARE_STENCIL_ARB} + WGL_SHARE_ACCUM_ARB = $200E; + {$EXTERNALSYM WGL_SHARE_ACCUM_ARB} + WGL_SUPPORT_GDI_ARB = $200F; + {$EXTERNALSYM WGL_SUPPORT_GDI_ARB} + WGL_SUPPORT_OPENGL_ARB = $2010; + {$EXTERNALSYM WGL_SUPPORT_OPENGL_ARB} + WGL_DOUBLE_BUFFER_ARB = $2011; + {$EXTERNALSYM WGL_DOUBLE_BUFFER_ARB} + WGL_STEREO_ARB = $2012; + {$EXTERNALSYM WGL_STEREO_ARB} + WGL_PIXEL_TYPE_ARB = $2013; + {$EXTERNALSYM WGL_PIXEL_TYPE_ARB} + WGL_COLOR_BITS_ARB = $2014; + {$EXTERNALSYM WGL_COLOR_BITS_ARB} + WGL_RED_BITS_ARB = $2015; + {$EXTERNALSYM WGL_RED_BITS_ARB} + WGL_RED_SHIFT_ARB = $2016; + {$EXTERNALSYM WGL_RED_SHIFT_ARB} + WGL_GREEN_BITS_ARB = $2017; + {$EXTERNALSYM WGL_GREEN_BITS_ARB} + WGL_GREEN_SHIFT_ARB = $2018; + {$EXTERNALSYM WGL_GREEN_SHIFT_ARB} + WGL_BLUE_BITS_ARB = $2019; + {$EXTERNALSYM WGL_BLUE_BITS_ARB} + WGL_BLUE_SHIFT_ARB = $201A; + {$EXTERNALSYM WGL_BLUE_SHIFT_ARB} + WGL_ALPHA_BITS_ARB = $201B; + {$EXTERNALSYM WGL_ALPHA_BITS_ARB} + WGL_ALPHA_SHIFT_ARB = $201C; + {$EXTERNALSYM WGL_ALPHA_SHIFT_ARB} + WGL_ACCUM_BITS_ARB = $201D; + {$EXTERNALSYM WGL_ACCUM_BITS_ARB} + WGL_ACCUM_RED_BITS_ARB = $201E; + {$EXTERNALSYM WGL_ACCUM_RED_BITS_ARB} + WGL_ACCUM_GREEN_BITS_ARB = $201F; + {$EXTERNALSYM WGL_ACCUM_GREEN_BITS_ARB} + WGL_ACCUM_BLUE_BITS_ARB = $2020; + {$EXTERNALSYM WGL_ACCUM_BLUE_BITS_ARB} + WGL_ACCUM_ALPHA_BITS_ARB = $2021; + {$EXTERNALSYM WGL_ACCUM_ALPHA_BITS_ARB} + WGL_DEPTH_BITS_ARB = $2022; + {$EXTERNALSYM WGL_DEPTH_BITS_ARB} + WGL_STENCIL_BITS_ARB = $2023; + {$EXTERNALSYM WGL_STENCIL_BITS_ARB} + WGL_AUX_BUFFERS_ARB = $2024; + {$EXTERNALSYM WGL_AUX_BUFFERS_ARB} + WGL_NO_ACCELERATION_ARB = $2025; + {$EXTERNALSYM WGL_NO_ACCELERATION_ARB} + WGL_GENERIC_ACCELERATION_ARB = $2026; + {$EXTERNALSYM WGL_GENERIC_ACCELERATION_ARB} + WGL_FULL_ACCELERATION_ARB = $2027; + {$EXTERNALSYM WGL_FULL_ACCELERATION_ARB} + WGL_SWAP_EXCHANGE_ARB = $2028; + {$EXTERNALSYM WGL_SWAP_EXCHANGE_ARB} + WGL_SWAP_COPY_ARB = $2029; + {$EXTERNALSYM WGL_SWAP_COPY_ARB} + WGL_SWAP_UNDEFINED_ARB = $202A; + {$EXTERNALSYM WGL_SWAP_UNDEFINED_ARB} + WGL_TYPE_RGBA_ARB = $202B; + {$EXTERNALSYM WGL_TYPE_RGBA_ARB} + WGL_TYPE_COLORINDEX_ARB = $202C; + {$EXTERNALSYM WGL_TYPE_COLORINDEX_ARB} + + + // ********** GLU generic constants ********** + + // Errors: (return value 0 = no error) + GLU_INVALID_ENUM = 100900; + {$EXTERNALSYM GLU_INVALID_ENUM} + GLU_INVALID_VALUE = 100901; + {$EXTERNALSYM GLU_INVALID_VALUE} + GLU_OUT_OF_MEMORY = 100902; + {$EXTERNALSYM GLU_OUT_OF_MEMORY} + GLU_INCOMPATIBLE_GL_VERSION = 100903; + {$EXTERNALSYM GLU_INCOMPATIBLE_GL_VERSION} + + // StringName + GLU_VERSION = 100800; + {$EXTERNALSYM GLU_VERSION} + GLU_EXTENSIONS = 100801; + {$EXTERNALSYM GLU_EXTENSIONS} + + // Boolean + GLU_TRUE = GL_TRUE; + {$EXTERNALSYM GLU_TRUE} + GLU_FALSE = GL_FALSE; + {$EXTERNALSYM GLU_FALSE} + + // Quadric constants + // QuadricNormal + GLU_SMOOTH = 100000; + {$EXTERNALSYM GLU_SMOOTH} + GLU_FLAT = 100001; + {$EXTERNALSYM GLU_FLAT} + GLU_NONE = 100002; + {$EXTERNALSYM GLU_NONE} + + // QuadricDrawStyle + GLU_POINT = 100010; + {$EXTERNALSYM GLU_POINT} + GLU_LINE = 100011; + {$EXTERNALSYM GLU_LINE} + GLU_FILL = 100012; + {$EXTERNALSYM GLU_FILL} + GLU_SILHOUETTE = 100013; + {$EXTERNALSYM GLU_SILHOUETTE} + + // QuadricOrientation + GLU_OUTSIDE = 100020; + {$EXTERNALSYM GLU_OUTSIDE} + GLU_INSIDE = 100021; + {$EXTERNALSYM GLU_INSIDE} + + // Tesselation constants + GLU_TESS_MAX_COORD = 1.0e150; + {$EXTERNALSYM GLU_TESS_MAX_COORD} + + // TessProperty + GLU_TESS_WINDING_RULE = 100140; + {$EXTERNALSYM GLU_TESS_WINDING_RULE} + GLU_TESS_BOUNDARY_ONLY = 100141; + {$EXTERNALSYM GLU_TESS_BOUNDARY_ONLY} + GLU_TESS_TOLERANCE = 100142; + {$EXTERNALSYM GLU_TESS_TOLERANCE} + + // TessWinding + GLU_TESS_WINDING_ODD = 100130; + {$EXTERNALSYM GLU_TESS_WINDING_ODD} + GLU_TESS_WINDING_NONZERO = 100131; + {$EXTERNALSYM GLU_TESS_WINDING_NONZERO} + GLU_TESS_WINDING_POSITIVE = 100132; + {$EXTERNALSYM GLU_TESS_WINDING_POSITIVE} + GLU_TESS_WINDING_NEGATIVE = 100133; + {$EXTERNALSYM GLU_TESS_WINDING_NEGATIVE} + GLU_TESS_WINDING_ABS_GEQ_TWO = 100134; + {$EXTERNALSYM GLU_TESS_WINDING_ABS_GEQ_TWO} + + // TessCallback + GLU_TESS_BEGIN = 100100; // TGLUTessBeginProc + {$EXTERNALSYM GLU_TESS_BEGIN} + GLU_TESS_VERTEX = 100101; // TGLUTessVertexProc + {$EXTERNALSYM GLU_TESS_VERTEX} + GLU_TESS_END = 100102; // TGLUTessEndProc + {$EXTERNALSYM GLU_TESS_END} + GLU_TESS_ERROR = 100103; // TGLUTessErrorProc + {$EXTERNALSYM GLU_TESS_ERROR} + GLU_TESS_EDGE_FLAG = 100104; // TGLUTessEdgeFlagProc + {$EXTERNALSYM GLU_TESS_EDGE_FLAG} + GLU_TESS_COMBINE = 100105; // TGLUTessCombineProc + {$EXTERNALSYM GLU_TESS_COMBINE} + GLU_TESS_BEGIN_DATA = 100106; // TGLUTessBeginDataProc + {$EXTERNALSYM GLU_TESS_BEGIN_DATA} + GLU_TESS_VERTEX_DATA = 100107; // TGLUTessVertexDataProc + {$EXTERNALSYM GLU_TESS_VERTEX_DATA} + GLU_TESS_END_DATA = 100108; // TGLUTessEndDataProc + {$EXTERNALSYM GLU_TESS_END_DATA} + GLU_TESS_ERROR_DATA = 100109; // TGLUTessErrorDataProc + {$EXTERNALSYM GLU_TESS_ERROR_DATA} + GLU_TESS_EDGE_FLAG_DATA = 100110; // TGLUTessEdgeFlagDataProc + {$EXTERNALSYM GLU_TESS_EDGE_FLAG_DATA} + GLU_TESS_COMBINE_DATA = 100111; // TGLUTessCombineDataProc + {$EXTERNALSYM GLU_TESS_COMBINE_DATA} + + // TessError + GLU_TESS_ERROR1 = 100151; + {$EXTERNALSYM GLU_TESS_ERROR1} + GLU_TESS_ERROR2 = 100152; + {$EXTERNALSYM GLU_TESS_ERROR2} + GLU_TESS_ERROR3 = 100153; + {$EXTERNALSYM GLU_TESS_ERROR3} + GLU_TESS_ERROR4 = 100154; + {$EXTERNALSYM GLU_TESS_ERROR4} + GLU_TESS_ERROR5 = 100155; + {$EXTERNALSYM GLU_TESS_ERROR5} + GLU_TESS_ERROR6 = 100156; + {$EXTERNALSYM GLU_TESS_ERROR6} + GLU_TESS_ERROR7 = 100157; + {$EXTERNALSYM GLU_TESS_ERROR7} + GLU_TESS_ERROR8 = 100158; + {$EXTERNALSYM GLU_TESS_ERROR8} + + GLU_TESS_MISSING_BEGIN_POLYGON = GLU_TESS_ERROR1; + {$EXTERNALSYM GLU_TESS_MISSING_BEGIN_POLYGON} + GLU_TESS_MISSING_BEGIN_CONTOUR = GLU_TESS_ERROR2; + {$EXTERNALSYM GLU_TESS_MISSING_BEGIN_CONTOUR} + GLU_TESS_MISSING_END_POLYGON = GLU_TESS_ERROR3; + {$EXTERNALSYM GLU_TESS_MISSING_END_POLYGON} + GLU_TESS_MISSING_END_CONTOUR = GLU_TESS_ERROR4; + {$EXTERNALSYM GLU_TESS_MISSING_END_CONTOUR} + GLU_TESS_COORD_TOO_LARGE = GLU_TESS_ERROR5; + {$EXTERNALSYM GLU_TESS_COORD_TOO_LARGE} + GLU_TESS_NEED_COMBINE_CALLBACK = GLU_TESS_ERROR6; + {$EXTERNALSYM GLU_TESS_NEED_COMBINE_CALLBACK} + + // NURBS constants + + // NurbsProperty + GLU_AUTO_LOAD_MATRIX = 100200; + {$EXTERNALSYM GLU_AUTO_LOAD_MATRIX} + GLU_CULLING = 100201; + {$EXTERNALSYM GLU_CULLING} + GLU_SAMPLING_TOLERANCE = 100203; + {$EXTERNALSYM GLU_SAMPLING_TOLERANCE} + GLU_DISPLAY_MODE = 100204; + {$EXTERNALSYM GLU_DISPLAY_MODE} + GLU_PARAMETRIC_TOLERANCE = 100202; + {$EXTERNALSYM GLU_PARAMETRIC_TOLERANCE} + GLU_SAMPLING_METHOD = 100205; + {$EXTERNALSYM GLU_SAMPLING_METHOD} + GLU_U_STEP = 100206; + {$EXTERNALSYM GLU_U_STEP} + GLU_V_STEP = 100207; + {$EXTERNALSYM GLU_V_STEP} + + // NurbsSampling + GLU_PATH_LENGTH = 100215; + {$EXTERNALSYM GLU_PATH_LENGTH} + GLU_PARAMETRIC_ERROR = 100216; + {$EXTERNALSYM GLU_PARAMETRIC_ERROR} + GLU_DOMAIN_DISTANCE = 100217; + {$EXTERNALSYM GLU_DOMAIN_DISTANCE} + + // NurbsTrim + GLU_MAP1_TRIM_2 = 100210; + {$EXTERNALSYM GLU_MAP1_TRIM_2} + GLU_MAP1_TRIM_3 = 100211; + {$EXTERNALSYM GLU_MAP1_TRIM_3} + + // NurbsDisplay + GLU_OUTLINE_POLYGON = 100240; + {$EXTERNALSYM GLU_OUTLINE_POLYGON} + GLU_OUTLINE_PATCH = 100241; + {$EXTERNALSYM GLU_OUTLINE_PATCH} + + // NurbsErrors + GLU_NURBS_ERROR1 = 100251; + {$EXTERNALSYM GLU_NURBS_ERROR1} + GLU_NURBS_ERROR2 = 100252; + {$EXTERNALSYM GLU_NURBS_ERROR2} + GLU_NURBS_ERROR3 = 100253; + {$EXTERNALSYM GLU_NURBS_ERROR3} + GLU_NURBS_ERROR4 = 100254; + {$EXTERNALSYM GLU_NURBS_ERROR4} + GLU_NURBS_ERROR5 = 100255; + {$EXTERNALSYM GLU_NURBS_ERROR5} + GLU_NURBS_ERROR6 = 100256; + {$EXTERNALSYM GLU_NURBS_ERROR6} + GLU_NURBS_ERROR7 = 100257; + {$EXTERNALSYM GLU_NURBS_ERROR7} + GLU_NURBS_ERROR8 = 100258; + {$EXTERNALSYM GLU_NURBS_ERROR8} + GLU_NURBS_ERROR9 = 100259; + {$EXTERNALSYM GLU_NURBS_ERROR9} + GLU_NURBS_ERROR10 = 100260; + {$EXTERNALSYM GLU_NURBS_ERROR10} + GLU_NURBS_ERROR11 = 100261; + {$EXTERNALSYM GLU_NURBS_ERROR11} + GLU_NURBS_ERROR12 = 100262; + {$EXTERNALSYM GLU_NURBS_ERROR12} + GLU_NURBS_ERROR13 = 100263; + {$EXTERNALSYM GLU_NURBS_ERROR13} + GLU_NURBS_ERROR14 = 100264; + {$EXTERNALSYM GLU_NURBS_ERROR14} + GLU_NURBS_ERROR15 = 100265; + {$EXTERNALSYM GLU_NURBS_ERROR15} + GLU_NURBS_ERROR16 = 100266; + {$EXTERNALSYM GLU_NURBS_ERROR16} + GLU_NURBS_ERROR17 = 100267; + {$EXTERNALSYM GLU_NURBS_ERROR17} + GLU_NURBS_ERROR18 = 100268; + {$EXTERNALSYM GLU_NURBS_ERROR18} + GLU_NURBS_ERROR19 = 100269; + {$EXTERNALSYM GLU_NURBS_ERROR19} + GLU_NURBS_ERROR20 = 100270; + {$EXTERNALSYM GLU_NURBS_ERROR20} + GLU_NURBS_ERROR21 = 100271; + {$EXTERNALSYM GLU_NURBS_ERROR21} + GLU_NURBS_ERROR22 = 100272; + {$EXTERNALSYM GLU_NURBS_ERROR22} + GLU_NURBS_ERROR23 = 100273; + {$EXTERNALSYM GLU_NURBS_ERROR23} + GLU_NURBS_ERROR24 = 100274; + {$EXTERNALSYM GLU_NURBS_ERROR24} + GLU_NURBS_ERROR25 = 100275; + {$EXTERNALSYM GLU_NURBS_ERROR25} + GLU_NURBS_ERROR26 = 100276; + {$EXTERNALSYM GLU_NURBS_ERROR26} + GLU_NURBS_ERROR27 = 100277; + {$EXTERNALSYM GLU_NURBS_ERROR27} + GLU_NURBS_ERROR28 = 100278; + {$EXTERNALSYM GLU_NURBS_ERROR28} + GLU_NURBS_ERROR29 = 100279; + {$EXTERNALSYM GLU_NURBS_ERROR29} + GLU_NURBS_ERROR30 = 100280; + {$EXTERNALSYM GLU_NURBS_ERROR30} + GLU_NURBS_ERROR31 = 100281; + {$EXTERNALSYM GLU_NURBS_ERROR31} + GLU_NURBS_ERROR32 = 100282; + {$EXTERNALSYM GLU_NURBS_ERROR32} + GLU_NURBS_ERROR33 = 100283; + {$EXTERNALSYM GLU_NURBS_ERROR33} + GLU_NURBS_ERROR34 = 100284; + {$EXTERNALSYM GLU_NURBS_ERROR34} + GLU_NURBS_ERROR35 = 100285; + {$EXTERNALSYM GLU_NURBS_ERROR35} + GLU_NURBS_ERROR36 = 100286; + {$EXTERNALSYM GLU_NURBS_ERROR36} + GLU_NURBS_ERROR37 = 100287; + {$EXTERNALSYM GLU_NURBS_ERROR37} + + // Contours types -- obsolete! + GLU_CW = 100120; + {$EXTERNALSYM GLU_CW} + GLU_CCW = 100121; + {$EXTERNALSYM GLU_CCW} + GLU_INTERIOR = 100122; + {$EXTERNALSYM GLU_INTERIOR} + GLU_EXTERIOR = 100123; + {$EXTERNALSYM GLU_EXTERIOR} + GLU_UNKNOWN = 100124; + {$EXTERNALSYM GLU_UNKNOWN} + + // Names without "TESS_" prefix + GLU_BEGIN = GLU_TESS_BEGIN; + {$EXTERNALSYM GLU_BEGIN} + GLU_VERTEX = GLU_TESS_VERTEX; + {$EXTERNALSYM GLU_VERTEX} + GLU_END = GLU_TESS_END; + {$EXTERNALSYM GLU_END} + GLU_ERROR = GLU_TESS_ERROR; + {$EXTERNALSYM GLU_ERROR} + GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG; + {$EXTERNALSYM GLU_EDGE_FLAG} + + GLX_VERSION_1_1 = 1; + GLX_VERSION_1_2 = 1; + GLX_VERSION_1_3 = 1; + GLX_EXTENSION_NAME = 'GLX'; + {$EXTERNALSYM GLX_EXTENSION_NAME} + GLX_USE_GL = 1; + {$EXTERNALSYM GLX_USE_GL} + GLX_BUFFER_SIZE = 2; + {$EXTERNALSYM GLX_BUFFER_SIZE} + GLX_LEVEL = 3; + {$EXTERNALSYM GLX_LEVEL} + GLX_RGBA = 4; + {$EXTERNALSYM GLX_RGBA} + GLX_DOUBLEBUFFER = 5; + {$EXTERNALSYM GLX_DOUBLEBUFFER} + GLX_STEREO = 6; + {$EXTERNALSYM GLX_STEREO} + GLX_AUX_BUFFERS = 7; + {$EXTERNALSYM GLX_AUX_BUFFERS} + GLX_RED_SIZE = 8; + {$EXTERNALSYM GLX_RED_SIZE} + GLX_GREEN_SIZE = 9; + {$EXTERNALSYM GLX_GREEN_SIZE} + GLX_BLUE_SIZE = 10; + {$EXTERNALSYM GLX_BLUE_SIZE} + GLX_ALPHA_SIZE = 11; + {$EXTERNALSYM GLX_ALPHA_SIZE} + GLX_DEPTH_SIZE = 12; + {$EXTERNALSYM GLX_DEPTH_SIZE} + GLX_STENCIL_SIZE = 13; + {$EXTERNALSYM GLX_STENCIL_SIZE} + GLX_ACCUM_RED_SIZE = 14; + {$EXTERNALSYM GLX_ACCUM_RED_SIZE} + GLX_ACCUM_GREEN_SIZE = 15; + {$EXTERNALSYM GLX_ACCUM_GREEN_SIZE} + GLX_ACCUM_BLUE_SIZE = 16; + {$EXTERNALSYM GLX_ACCUM_BLUE_SIZE} + GLX_ACCUM_ALPHA_SIZE = 17; + {$EXTERNALSYM GLX_ACCUM_ALPHA_SIZE} + + // Error codes returned by glXGetConfig: + GLX_BAD_SCREEN = 1; + {$EXTERNALSYM GLX_BAD_SCREEN} + GLX_BAD_ATTRIBUTE = 2; + {$EXTERNALSYM GLX_BAD_ATTRIBUTE} + GLX_NO_EXTENSION = 3; + {$EXTERNALSYM GLX_NO_EXTENSION} + GLX_BAD_VISUAL = 4; + {$EXTERNALSYM GLX_BAD_VISUAL} + GLX_BAD_CONTEXT = 5; + {$EXTERNALSYM GLX_BAD_CONTEXT} + GLX_BAD_VALUE = 6; + {$EXTERNALSYM GLX_BAD_VALUE} + GLX_BAD_ENUM = 7; + {$EXTERNALSYM GLX_BAD_ENUM} + + // GLX 1.1 and later: + GLX_VENDOR = 1; + {$EXTERNALSYM GLX_VENDOR} + GLX_VERSION = 2; + {$EXTERNALSYM GLX_VERSION} + GLX_EXTENSIONS = 3; + {$EXTERNALSYM GLX_EXTENSIONS} + + // GLX 1.3 and later: + GLX_CONFIG_CAVEAT = $20; + {$EXTERNALSYM GLX_CONFIG_CAVEAT} + GLX_DONT_CARE = $FFFFFFFF; + {$EXTERNALSYM GLX_DONT_CARE} + GLX_SLOW_CONFIG = $8001; + {$EXTERNALSYM GLX_SLOW_CONFIG} + GLX_NON_CONFORMANT_CONFIG = $800D; + {$EXTERNALSYM GLX_NON_CONFORMANT_CONFIG} + GLX_X_VISUAL_TYPE = $22; + {$EXTERNALSYM GLX_X_VISUAL_TYPE} + GLX_TRANSPARENT_TYPE = $23; + {$EXTERNALSYM GLX_TRANSPARENT_TYPE} + GLX_TRANSPARENT_INDEX_VALUE = $24; + {$EXTERNALSYM GLX_TRANSPARENT_INDEX_VALUE} + GLX_TRANSPARENT_RED_VALUE = $25; + {$EXTERNALSYM GLX_TRANSPARENT_RED_VALUE} + GLX_TRANSPARENT_GREEN_VALUE = $26; + {$EXTERNALSYM GLX_TRANSPARENT_GREEN_VALUE} + GLX_TRANSPARENT_BLUE_VALUE = $27; + {$EXTERNALSYM GLX_TRANSPARENT_BLUE_VALUE} + GLX_TRANSPARENT_ALPHA_VALUE = $28; + {$EXTERNALSYM GLX_TRANSPARENT_ALPHA_VALUE} + GLX_MAX_PBUFFER_WIDTH = $8016; + {$EXTERNALSYM GLX_MAX_PBUFFER_WIDTH} + GLX_MAX_PBUFFER_HEIGHT = $8017; + {$EXTERNALSYM GLX_MAX_PBUFFER_HEIGHT} + GLX_MAX_PBUFFER_PIXELS = $8018; + {$EXTERNALSYM GLX_MAX_PBUFFER_PIXELS} + GLX_PRESERVED_CONTENTS = $801B; + {$EXTERNALSYM GLX_PRESERVED_CONTENTS} + GLX_LARGEST_BUFFER = $801C; + {$EXTERNALSYM GLX_LARGEST_BUFFER} + GLX_DRAWABLE_TYPE = $8010; + {$EXTERNALSYM GLX_DRAWABLE_TYPE} + GLX_FBCONFIG_ID = $8013; + {$EXTERNALSYM GLX_FBCONFIG_ID} + GLX_VISUAL_ID = $800B; + {$EXTERNALSYM GLX_VISUAL_ID} + GLX_WINDOW_BIT = $00000001; + {$EXTERNALSYM GLX_WINDOW_BIT} + GLX_PIXMAP_BIT = $00000002; + {$EXTERNALSYM GLX_PIXMAP_BIT} + GLX_PBUFFER_BIT = $00000004; + {$EXTERNALSYM GLX_PBUFFER_BIT} + GLX_AUX_BUFFERS_BIT = $00000010; + {$EXTERNALSYM GLX_AUX_BUFFERS_BIT} + GLX_FRONT_LEFT_BUFFER_BIT = $00000001; + {$EXTERNALSYM GLX_FRONT_LEFT_BUFFER_BIT} + GLX_FRONT_RIGHT_BUFFER_BIT = $00000002; + {$EXTERNALSYM GLX_FRONT_RIGHT_BUFFER_BIT} + GLX_BACK_LEFT_BUFFER_BIT = $00000004; + {$EXTERNALSYM GLX_BACK_LEFT_BUFFER_BIT} + GLX_BACK_RIGHT_BUFFER_BIT = $00000008; + {$EXTERNALSYM GLX_BACK_RIGHT_BUFFER_BIT} + GLX_DEPTH_BUFFER_BIT = $00000020; + {$EXTERNALSYM GLX_DEPTH_BUFFER_BIT} + GLX_STENCIL_BUFFER_BIT = $00000040; + {$EXTERNALSYM GLX_STENCIL_BUFFER_BIT} + GLX_ACCUM_BUFFER_BIT = $00000080; + {$EXTERNALSYM GLX_ACCUM_BUFFER_BIT} + GLX_RENDER_TYPE = $8011; + {$EXTERNALSYM GLX_RENDER_TYPE} + GLX_X_RENDERABLE = $8012; + {$EXTERNALSYM GLX_X_RENDERABLE} + GLX_NONE = $8000; + {$EXTERNALSYM GLX_NONE} + GLX_TRUE_COLOR = $8002; + {$EXTERNALSYM GLX_TRUE_COLOR} + GLX_DIRECT_COLOR = $8003; + {$EXTERNALSYM GLX_DIRECT_COLOR} + GLX_PSEUDO_COLOR = $8004; + {$EXTERNALSYM GLX_PSEUDO_COLOR} + GLX_STATIC_COLOR = $8005; + {$EXTERNALSYM GLX_STATIC_COLOR} + GLX_GRAY_SCALE = $8006; + {$EXTERNALSYM GLX_GRAY_SCALE} + GLX_STATIC_GRAY = $8007; + {$EXTERNALSYM GLX_STATIC_GRAY} + GLX_TRANSPARENT_INDEX = $8009; + {$EXTERNALSYM GLX_TRANSPARENT_INDEX} + GLX_COLOR_INDEX_TYPE = $8015; + {$EXTERNALSYM GLX_COLOR_INDEX_TYPE} + GLX_COLOR_INDEX_BIT = $00000002; + {$EXTERNALSYM GLX_COLOR_INDEX_BIT} + GLX_SCREEN = $800C; + {$EXTERNALSYM GLX_SCREEN} + GLX_PBUFFER_CLOBBER_MASK = $08000000; + {$EXTERNALSYM GLX_PBUFFER_CLOBBER_MASK} + GLX_DAMAGED = $8020; + {$EXTERNALSYM GLX_DAMAGED} + GLX_SAVED = $8021; + {$EXTERNALSYM GLX_SAVED} + GLX_WINDOW = $8022; + {$EXTERNALSYM GLX_WINDOW} + GLX_PBUFFER = $8023; + {$EXTERNALSYM GLX_PBUFFER} + GLX_EXT_visual_info = 1; + {$EXTERNALSYM GLX_EXT_visual_info} + GLX_X_VISUAL_TYPE_EXT = $22; + {$EXTERNALSYM GLX_X_VISUAL_TYPE_EXT} + GLX_TRANSPARENT_TYPE_EXT = $23; + {$EXTERNALSYM GLX_TRANSPARENT_TYPE_EXT} + GLX_TRANSPARENT_INDEX_VALUE_EXT = $24; + {$EXTERNALSYM GLX_TRANSPARENT_INDEX_VALUE_EXT} + GLX_TRANSPARENT_RED_VALUE_EXT = $25; + {$EXTERNALSYM GLX_TRANSPARENT_RED_VALUE_EXT} + GLX_TRANSPARENT_GREEN_VALUE_EXT = $26; + {$EXTERNALSYM GLX_TRANSPARENT_GREEN_VALUE_EXT} + GLX_TRANSPARENT_BLUE_VALUE_EXT = $27; + {$EXTERNALSYM GLX_TRANSPARENT_BLUE_VALUE_EXT} + GLX_TRANSPARENT_ALPHA_VALUE_EXT = $28; + {$EXTERNALSYM GLX_TRANSPARENT_ALPHA_VALUE_EXT} + GLX_TRUE_COLOR_EXT = $8002; + {$EXTERNALSYM GLX_TRUE_COLOR_EXT} + GLX_DIRECT_COLOR_EXT = $8003; + {$EXTERNALSYM GLX_DIRECT_COLOR_EXT} + GLX_PSEUDO_COLOR_EXT = $8004; + {$EXTERNALSYM GLX_PSEUDO_COLOR_EXT} + GLX_STATIC_COLOR_EXT = $8005; + {$EXTERNALSYM GLX_STATIC_COLOR_EXT} + GLX_GRAY_SCALE_EXT = $8006; + {$EXTERNALSYM GLX_GRAY_SCALE_EXT} + GLX_STATIC_GRAY_EXT = $8007; + {$EXTERNALSYM GLX_STATIC_GRAY_EXT} + GLX_NONE_EXT = $8000; + {$EXTERNALSYM GLX_NONE_EXT} + GLX_TRANSPARENT_RGB_EXT = $8008; + {$EXTERNALSYM GLX_TRANSPARENT_RGB_EXT} + GLX_TRANSPARENT_INDEX_EXT = $8009; + {$EXTERNALSYM GLX_TRANSPARENT_INDEX_EXT} + GLX_VISUAL_CAVEAT_EXT = $20; + {$EXTERNALSYM GLX_VISUAL_CAVEAT_EXT} + GLX_SLOW_VISUAL_EXT = $8001; + {$EXTERNALSYM GLX_SLOW_VISUAL_EXT} + GLX_NON_CONFORMANT_VISUAL_EXT = $800D; + {$EXTERNALSYM GLX_NON_CONFORMANT_VISUAL_EXT} + GLX_SHARE_CONTEXT_EXT = $800A; + {$EXTERNALSYM GLX_SHARE_CONTEXT_EXT} + GLX_VISUAL_ID_EXT = $800B; + {$EXTERNALSYM GLX_VISUAL_ID_EXT} + GLX_SCREEN_EXT = $800C; + {$EXTERNALSYM GLX_SCREEN_EXT} + GLX_3DFX_WINDOW_MODE_MESA = $1; + {$EXTERNALSYM GLX_3DFX_WINDOW_MODE_MESA} + GLX_3DFX_FULLSCREEN_MODE_MESA = $2; + {$EXTERNALSYM GLX_3DFX_FULLSCREEN_MODE_MESA} + + +type + // GLU types + TGLUNurbs = record end; + TGLUQuadric = record end; + TGLUTesselator = record end; + + PGLUNurbs = ^TGLUNurbs; + PGLUQuadric = ^TGLUQuadric; + PGLUTesselator = ^TGLUTesselator; + + // backwards compatibility + TGLUNurbsObj = TGLUNurbs; + TGLUQuadricObj = TGLUQuadric; + TGLUTesselatorObj = TGLUTesselator; + TGLUTriangulatorObj = TGLUTesselator; + + PGLUNurbsObj = PGLUNurbs; + PGLUQuadricObj = PGLUQuadric; + PGLUTesselatorObj = PGLUTesselator; + PGLUTriangulatorObj = PGLUTesselator; + + {$IFDEF FPC} + {$IFDEF UNIX} + PALETTEENTRY = record + peRed : BYTE; + peGreen : BYTE; + peBlue : BYTE; + peFlags : BYTE; + end; + LPPALETTEENTRY = ^PALETTEENTRY; + tagPALETTEENTRY = PALETTEENTRY; + TPaletteEntry = PALETTEENTRY; + PPALETTEENTRY = ^PALETTEENTRY; + xid = txid; + pixmap = tpixmap; + font = tfont; + window = twindow; + colormap = tcolormap; + {$ENDIF} + + PMaxLogPalette = ^TMaxLogPalette; + TMaxLogPalette = packed record + palversion : word; + palnumentries : word; + palpalentry : array[byte] of TPaletteEntry; + end; + + {$ifdef WIN32} // If Windows + PWGLSwap = ^TWGLSwap; + {$EXTERNALSYM _WGLSWAP} + _WGLSWAP = packed record + hdc: HDC; + uiFlags: Cardinal; + end; + TWGLSwap = _WGLSWAP; + {$EXTERNALSYM WGLSWAP} + WGLSWAP = _WGLSWAP; + {$endif WIN32} + + {$ENDIF} + + {$ifdef VER100} // Delphi 3 + PWGLSwap = ^TWGLSwap; + {$EXTERNALSYM _WGLSWAP} + _WGLSWAP = packed record + hdc: HDC; + uiFlags: Cardinal; + end; + TWGLSwap = _WGLSWAP; + {$EXTERNALSYM WGLSWAP} + WGLSWAP = _WGLSWAP; + {$endif VER100} + + // Callback function prototypes + // GLUQuadricCallback + TGLUQuadricErrorProc = procedure(errorCode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + + // GLUTessCallback + TGLUTessBeginProc = procedure(AType: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + TGLUTessEdgeFlagProc = procedure(Flag: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + TGLUTessVertexProc = procedure(VertexData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + TGLUTessEndProc = procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + TGLUTessErrorProc = procedure(ErrNo: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + TGLUTessCombineProc = procedure(Coords: TVector3d; VertexData: TVector4p; Weight: TVector4f; OutData: PPointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + TGLUTessBeginDataProc = procedure(AType: TGLEnum; UserData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + TGLUTessEdgeFlagDataProc = procedure(Flag: TGLboolean; UserData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + TGLUTessVertexDataProc = procedure(VertexData: Pointer; UserData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + TGLUTessEndDataProc = procedure(UserData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + TGLUTessErrorDataProc = procedure(ErrNo: TGLEnum; UserData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + TGLUTessCombineDataProc = procedure(Coords: TVector3d; VertexData: TVector4p; Weight: TVector4f; OutData: PPointer; UserData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + + // GLUNurbsCallback + TGLUNurbsErrorProc = procedure(ErrorCode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + +var + // GL functions and procedures + glAccum: procedure(op: TGLuint; value: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glAccum} + glAlphaFunc: procedure(func: TGLEnum; ref: TGLclampf); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glAlphaFunc} + glAreTexturesResident: function(n: TGLsizei; Textures: PGLuint; residences: PGLboolean): TGLboolean; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glAreTexturesResident} + glArrayElement: procedure(i: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glArrayElement} + glBegin: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBegin} + glBindTexture: procedure(target: TGLEnum; texture: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBindTexture} + glBitmap: procedure(width: TGLsizei; height: TGLsizei; xorig, yorig: TGLfloat; xmove: TGLfloat; ymove: TGLfloat; bitmap: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBitmap} + glBlendFunc: procedure(sfactor: TGLEnum; dfactor: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBlendFunc} + glCallList: procedure(list: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCallList} + glCallLists: procedure(n: TGLsizei; atype: TGLEnum; lists: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCallLists} + glClear: procedure(mask: TGLbitfield); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glClear} + glClearAccum: procedure(red, green, blue, alpha: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glClearAccum} + glClearColor: procedure(red, green, blue, alpha: TGLclampf); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glClearColor} + glClearDepth: procedure(depth: TGLclampd); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glClearDepth} + glClearIndex: procedure(c: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glClearIndex} + glClearStencil: procedure(s: TGLint ); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glClearStencil} + glClipPlane: procedure(plane: TGLEnum; equation: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glClipPlane} + glColor3b: procedure(red, green, blue: TGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3b} + glColor3bv: procedure(v: PGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3bv} + glColor3d: procedure(red, green, blue: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3d} + glColor3dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3dv} + glColor3f: procedure(red, green, blue: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3f} + glColor3fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3fv} + glColor3i: procedure(red, green, blue: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3i} + glColor3iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3iv} + glColor3s: procedure(red, green, blue: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3s} + glColor3sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3sv} + glColor3ub: procedure(red, green, blue: TGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3ub} + glColor3ubv: procedure(v: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3ubv} + glColor3ui: procedure(red, green, blue: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3ui} + glColor3uiv: procedure(v: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3uiv} + glColor3us: procedure(red, green, blue: TGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3us} + glColor3usv: procedure(v: PGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3usv} + glColor4b: procedure(red, green, blue, alpha: TGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4b} + glColor4bv: procedure(v: PGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4bv} + glColor4d: procedure(red, green, blue, alpha: TGLdouble ); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4d} + glColor4dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4dv} + glColor4f: procedure(red, green, blue, alpha: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4f} + glColor4fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4fv} + glColor4i: procedure(red, green, blue, alpha: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4i} + glColor4iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4iv} + glColor4s: procedure(red, green, blue, alpha: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4s} + glColor4sv: procedure(v: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4sv} + glColor4ub: procedure(red, green, blue, alpha: TGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4ub} + glColor4ubv: procedure(v: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4ubv} + glColor4ui: procedure(red, green, blue, alpha: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4ui} + glColor4uiv: procedure(v: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4uiv} + glColor4us: procedure(red, green, blue, alpha: TGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4us} + glColor4usv: procedure(v: PGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4usv} + glColorMask: procedure(red, green, blue, alpha: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorMask} + glColorMaterial: procedure(face: TGLEnum; mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorMaterial} + glColorPointer: procedure(size: TGLint; atype: TGLEnum; stride: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorPointer} + glCopyPixels: procedure(x, y: TGLint; width, height: TGLsizei; atype: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyPixels} + glCopyTexImage1D: procedure(target: TGLEnum; level: TGLint; internalFormat: TGLEnum; x, y: TGLint; width: TGLsizei; border: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyTexImage1D} + glCopyTexImage2D: procedure(target: TGLEnum; level: TGLint; internalFormat: TGLEnum; x, y: TGLint; width, height: TGLsizei; border: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyTexImage2D} + glCopyTexSubImage1D: procedure(target: TGLEnum; level, xoffset, x, y: TGLint; width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyTexSubImage1D} + glCopyTexSubImage2D: procedure(target: TGLEnum; level, xoffset, yoffset, x, y: TGLint; width, height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyTexSubImage2D} + glCullFace: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCullFace} + glDeleteLists: procedure(list: TGLuint; range: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDeleteLists} + glDeleteTextures: procedure(n: TGLsizei; textures: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDeleteTextures} + glDepthFunc: procedure(func: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDepthFunc} + glDepthMask: procedure(flag: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDepthMask} + glDepthRange: procedure(zNear, zFar: TGLclampd); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDepthRange} + glDisable: procedure(cap: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDisable} + glDisableClientState: procedure(aarray: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDisableClientState} + glDrawArrays: procedure(mode: TGLEnum; first: TGLint; count: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDrawArrays} + glDrawBuffer: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDrawBuffer} + glDrawElements: procedure(mode: TGLEnum; count: TGLsizei; atype: TGLEnum; indices: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDrawElements} + glDrawPixels: procedure(width, height: TGLsizei; format, atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDrawPixels} + glEdgeFlag: procedure(flag: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEdgeFlag} + glEdgeFlagPointer: procedure(stride: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEdgeFlagPointer} + glEdgeFlagv: procedure(flag: PGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEdgeFlagv} + glEnable: procedure(cap: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEnable} + glEnableClientState: procedure(aarray: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEnableClientState} + glEnd: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEnd} + glEndList: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEndList} + glEvalCoord1d: procedure(u: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalCoord1d} + glEvalCoord1dv: procedure(u: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalCoord1dv} + glEvalCoord1f: procedure(u: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalCoord1f} + glEvalCoord1fv: procedure(u: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalCoord1fv} + glEvalCoord2d: procedure(u: TGLdouble; v: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalCoord2d} + glEvalCoord2dv: procedure(u: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalCoord2dv} + glEvalCoord2f: procedure(u, v: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalCoord2f} + glEvalCoord2fv: procedure(u: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalCoord2fv} + glEvalMesh1: procedure(mode: TGLEnum; i1, i2: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalMesh1} + glEvalMesh2: procedure(mode: TGLEnum; i1, i2, j1, j2: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalMesh2} + glEvalPoint1: procedure(i: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalPoint1} + glEvalPoint2: procedure(i, j: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEvalPoint2} + glFeedbackBuffer: procedure(size: TGLsizei; atype: TGLEnum; buffer: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFeedbackBuffer} + glFinish: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFinish} + glFlush: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFlush} + glFogf: procedure(pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFogf} + glFogfv: procedure(pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFogfv} + glFogi: procedure(pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFogi} + glFogiv: procedure(pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFogiv} + glFrontFace: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFrontFace} + glFrustum: procedure(left, right, bottom, top, zNear, zFar: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFrustum} + glGenLists: function(range: TGLsizei): TGLuint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGenLists} + glGenTextures: procedure(n: TGLsizei; textures: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGenTextures} + glGetBooleanv: procedure(pname: TGLEnum; params: PGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetBooleanv} + glGetClipPlane: procedure(plane: TGLEnum; equation: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetClipPlane} + glGetDoublev: procedure(pname: TGLEnum; params: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetDoublev} + glGetError: function: TGLuint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetError} + glGetFloatv: procedure(pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetFloatv} + glGetIntegerv: procedure(pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetIntegerv} + glGetLightfv: procedure(light, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetLightfv} + glGetLightiv: procedure(light, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetLightiv} + glGetMapdv: procedure(target, query: TGLEnum; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetMapdv} + glGetMapfv: procedure(target, query: TGLEnum; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetMapfv} + glGetMapiv: procedure(target, query: TGLEnum; v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetMapiv} + glGetMaterialfv: procedure(face, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetMaterialfv} + glGetMaterialiv: procedure(face, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetMaterialiv} + glGetPixelMapfv: procedure(map: TGLEnum; values: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetPixelMapfv} + glGetPixelMapuiv: procedure(map: TGLEnum; values: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetPixelMapuiv} + glGetPixelMapusv: procedure(map: TGLEnum; values: PGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetPixelMapusv} + glGetPointerv: procedure(pname: TGLEnum; var params); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetPointerv} + glGetPolygonStipple: procedure(mask: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetPolygonStipple} + glGetString: function(name: TGLEnum): PChar; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetString} + glGetTexEnvfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTexEnvfv} + glGetTexEnviv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTexEnviv} + glGetTexGendv: procedure(coord, pname: TGLEnum; params: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTexGendv} + glGetTexGenfv: procedure(coord, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTexGenfv} + glGetTexGeniv: procedure(coord, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTexGeniv} + glGetTexImage: procedure(target: TGLEnum; level: TGLint; format, atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTexImage} + glGetTexLevelParameterfv: procedure(target: TGLEnum; level: TGLint; pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTexLevelParameterfv} + glGetTexLevelParameteriv: procedure(target: TGLEnum; level: TGLint; pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTexLevelParameteriv} + glGetTexParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTexParameterfv} + glGetTexParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTexParameteriv} + glHint: procedure(target, mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glHint} + glIndexMask: procedure(mask: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexMask} + glIndexPointer: procedure(atype: TGLEnum; stride: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexPointer} + glIndexd: procedure(c: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexd} + glIndexdv: procedure(c: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexdv} + glIndexf: procedure(c: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexf} + glIndexfv: procedure(c: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexfv} + glIndexi: procedure(c: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexi} + glIndexiv: procedure(c: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexiv} + glIndexs: procedure(c: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexs} + glIndexsv: procedure(c: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexsv} + glIndexub: procedure(c: TGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexub} + glIndexubv: procedure(c: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexubv} + glInitNames: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glInitNames} + glInterleavedArrays: procedure(format: TGLEnum; stride: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glInterleavedArrays} + glIsEnabled: function(cap: TGLEnum): TGLboolean; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIsEnabled} + glIsList: function(list: TGLuint): TGLboolean; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIsList} + glIsTexture: function(texture: TGLuint): TGLboolean; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIsTexture} + glLightModelf: procedure(pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLightModelf} + glLightModelfv: procedure(pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLightModelfv} + glLightModeli: procedure(pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLightModeli} + glLightModeliv: procedure(pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLightModeliv} + glLightf: procedure(light, pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLightf} + glLightfv: procedure(light, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLightfv} + glLighti: procedure(light, pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLighti} + glLightiv: procedure(light, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLightiv} + glLineStipple: procedure(factor: TGLint; pattern: TGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLineStipple} + glLineWidth: procedure(width: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLineWidth} + glListBase: procedure(base: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glListBase} + glLoadIdentity: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLoadIdentity} + glLoadMatrixd: procedure(m: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLoadMatrixd} + glLoadMatrixf: procedure(m: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLoadMatrixf} + glLoadName: procedure(name: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLoadName} + glLogicOp: procedure(opcode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLogicOp} + glMap1d: procedure(target: TGLEnum; u1, u2: TGLdouble; stride, order: TGLint; points: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMap1d} + glMap1f: procedure(target: TGLEnum; u1, u2: TGLfloat; stride, order: TGLint; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMap1f} + glMap2d: procedure(target: TGLEnum; u1, u2: TGLdouble; ustride, uorder: TGLint; v1, v2: TGLdouble; vstride, + vorder: TGLint; points: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMap2d} + glMap2f: procedure(target: TGLEnum; u1, u2: TGLfloat; ustride, uorder: TGLint; v1, v2: TGLfloat; vstride, + vorder: TGLint; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMap2f} + glMapGrid1d: procedure(un: TGLint; u1, u2: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMapGrid1d} + glMapGrid1f: procedure(un: TGLint; u1, u2: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMapGrid1f} + glMapGrid2d: procedure(un: TGLint; u1, u2: TGLdouble; vn: TGLint; v1, v2: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMapGrid2d} + glMapGrid2f: procedure(un: TGLint; u1, u2: TGLfloat; vn: TGLint; v1, v2: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMapGrid2f} + glMaterialf: procedure(face, pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMaterialf} + glMaterialfv: procedure(face, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMaterialfv} + glMateriali: procedure(face, pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMateriali} + glMaterialiv: procedure(face, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMaterialiv} + glMatrixMode: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMatrixMode} + glMultMatrixd: procedure(m: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultMatrixd} + glMultMatrixf: procedure(m: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultMatrixf} + glNewList: procedure(list: TGLuint; mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNewList} + glNormal3b: procedure(nx, ny, nz: TGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3b} + glNormal3bv: procedure(v: PGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3bv} + glNormal3d: procedure(nx, ny, nz: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3d} + glNormal3dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3dv} + glNormal3f: procedure(nx, ny, nz: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3f} + glNormal3fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3fv} + glNormal3i: procedure(nx, ny, nz: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3i} + glNormal3iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3iv} + glNormal3s: procedure(nx, ny, nz: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3s} + glNormal3sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3sv} + glNormalPointer: procedure(atype: TGLEnum; stride: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormalPointer} + glOrtho: procedure(left, right, bottom, top, zNear, zFar: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glOrtho} + glPassThrough: procedure(token: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPassThrough} + glPixelMapfv: procedure(map: TGLEnum; mapsize: TGLsizei; values: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelMapfv} + glPixelMapuiv: procedure(map: TGLEnum; mapsize: TGLsizei; values: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelMapuiv} + glPixelMapusv: procedure(map: TGLEnum; mapsize: TGLsizei; values: PGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelMapusv} + glPixelStoref: procedure(pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelStoref} + glPixelStorei: procedure(pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelStorei} + glPixelTransferf: procedure(pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelTransferf} + glPixelTransferi: procedure(pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelTransferi} + glPixelZoom: procedure(xfactor, yfactor: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelZoom} + glPointSize: procedure(size: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPointSize} + glPolygonMode: procedure(face, mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPolygonMode} + glPolygonOffset: procedure(factor, units: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPolygonOffset} + glPolygonStipple: procedure(mask: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPolygonStipple} + glPopAttrib: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPopAttrib} + glPopClientAttrib: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPopClientAttrib} + glPopMatrix: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPopMatrix} + glPopName: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPopName} + glPrioritizeTextures: procedure(n: TGLsizei; textures: PGLuint; priorities: PGLclampf); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPrioritizeTextures} + glPushAttrib: procedure(mask: TGLbitfield); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPushAttrib} + glPushClientAttrib: procedure(mask: TGLbitfield); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPushClientAttrib} + glPushMatrix: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPushMatrix} + glPushName: procedure(name: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPushName} + glRasterPos2d: procedure(x, y: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos2d} + glRasterPos2dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos2dv} + glRasterPos2f: procedure(x, y: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos2f} + glRasterPos2fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos2fv} + glRasterPos2i: procedure(x, y: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos2i} + glRasterPos2iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos2iv} + glRasterPos2s: procedure(x, y: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos2s} + glRasterPos2sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos2sv} + glRasterPos3d: procedure(x, y, z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos3d} + glRasterPos3dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos3dv} + glRasterPos3f: procedure(x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos3f} + glRasterPos3fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos3fv} + glRasterPos3i: procedure(x, y, z: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos3i} + glRasterPos3iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos3iv} + glRasterPos3s: procedure(x, y, z: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos3s} + glRasterPos3sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos3sv} + glRasterPos4d: procedure(x, y, z, w: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos4d} + glRasterPos4dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos4dv} + glRasterPos4f: procedure(x, y, z, w: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos4f} + glRasterPos4fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos4fv} + glRasterPos4i: procedure(x, y, z, w: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos4i} + glRasterPos4iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos4iv} + glRasterPos4s: procedure(x, y, z, w: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos4s} + glRasterPos4sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRasterPos4sv} + glReadBuffer: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReadBuffer} + glReadPixels: procedure(x, y: TGLint; width, height: TGLsizei; format, atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReadPixels} + glRectd: procedure(x1, y1, x2, y2: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRectd} + glRectdv: procedure(v1, v2: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRectdv} + glRectf: procedure(x1, y1, x2, y2: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRectf} + glRectfv: procedure(v1, v2: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRectfv} + glRecti: procedure(x1, y1, x2, y2: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRecti} + glRectiv: procedure(v1, v2: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRectiv} + glRects: procedure(x1, y1, x2, y2: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRects} + glRectsv: procedure(v1, v2: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRectsv} + glRenderMode: function(mode: TGLEnum): TGLint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRenderMode} + glRotated: procedure(angle, x, y, z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRotated} + glRotatef: procedure(angle, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRotatef} + glScaled: procedure(x, y, z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glScaled} + glScalef: procedure(x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glScalef} + glScissor: procedure(x, y: TGLint; width, height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glScissor} + glSelectBuffer: procedure(size: TGLsizei; buffer: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSelectBuffer} + glShadeModel: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glShadeModel} + glStencilFunc: procedure(func: TGLEnum; ref: TGLint; mask: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glStencilFunc} + glStencilMask: procedure(mask: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glStencilMask} + glStencilOp: procedure(fail, zfail, zpass: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glStencilOp} + glTexCoord1d: procedure(s: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord1d} + glTexCoord1dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord1dv} + glTexCoord1f: procedure(s: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord1f} + glTexCoord1fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord1fv} + glTexCoord1i: procedure(s: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord1i} + glTexCoord1iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord1iv} + glTexCoord1s: procedure(s: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord1s} + glTexCoord1sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord1sv} + glTexCoord2d: procedure(s, t: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2d} + glTexCoord2dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2dv} + glTexCoord2f: procedure(s, t: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2f} + glTexCoord2fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2fv} + glTexCoord2i: procedure(s, t: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2i} + glTexCoord2iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2iv} + glTexCoord2s: procedure(s, t: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2s} + glTexCoord2sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2sv} + glTexCoord3d: procedure(s, t, r: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord3d} + glTexCoord3dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord3dv} + glTexCoord3f: procedure(s, t, r: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord3f} + glTexCoord3fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord3fv} + glTexCoord3i: procedure(s, t, r: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord3i} + glTexCoord3iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord3iv} + glTexCoord3s: procedure(s, t, r: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord3s} + glTexCoord3sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord3sv} + glTexCoord4d: procedure(s, t, r, q: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4d} + glTexCoord4dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4dv} + glTexCoord4f: procedure(s, t, r, q: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4f} + glTexCoord4fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4fv} + glTexCoord4i: procedure(s, t, r, q: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4i} + glTexCoord4iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4iv} + glTexCoord4s: procedure(s, t, r, q: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4s} + glTexCoord4sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4sv} + glTexCoordPointer: procedure(size: TGLint; atype: TGLEnum; stride: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoordPointer} + glTexEnvf: procedure(target, pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexEnvf} + glTexEnvfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexEnvfv} + glTexEnvi: procedure(target, pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexEnvi} + glTexEnviv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexEnviv} + glTexGend: procedure(coord, pname: TGLEnum; param: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexGend} + glTexGendv: procedure(coord, pname: TGLEnum; params: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexGendv} + glTexGenf: procedure(coord, pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexGenf} + glTexGenfv: procedure(coord, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexGenfv} + glTexGeni: procedure(coord, pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexGeni} + glTexGeniv: procedure(coord, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexGeniv} + glTexImage1D: procedure(target: TGLEnum; level, internalformat: TGLint; width: TGLsizei; border: TGLint; format, + atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexImage1D} + glTexImage2D: procedure(target: TGLEnum; level, internalformat: TGLint; width, height: TGLsizei; border: TGLint; + format, atype: TGLEnum; Pixels:Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexImage2D} + glTexParameterf: procedure(target, pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexParameterf} + glTexParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexParameterfv} + glTexParameteri: procedure(target, pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexParameteri} + glTexParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexParameteriv} + glTexSubImage1D: procedure(target: TGLEnum; level, xoffset: TGLint; width: TGLsizei; format, atype: TGLEnum; + pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexSubImage1D} + glTexSubImage2D: procedure(target: TGLEnum; level, xoffset, yoffset: TGLint; width, height: TGLsizei; format, + atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexSubImage2D} + glTranslated: procedure(x, y, z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTranslated} + glTranslatef: procedure(x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTranslatef} + glVertex2d: procedure(x, y: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex2d} + glVertex2dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex2dv} + glVertex2f: procedure(x, y: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex2f} + glVertex2fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex2fv} + glVertex2i: procedure(x, y: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex2i} + glVertex2iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex2iv} + glVertex2s: procedure(x, y: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex2s} + glVertex2sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex2sv} + glVertex3d: procedure(x, y, z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex3d} + glVertex3dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex3dv} + glVertex3f: procedure(x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex3f} + glVertex3fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex3fv} + glVertex3i: procedure(x, y, z: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex3i} + glVertex3iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex3iv} + glVertex3s: procedure(x, y, z: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex3s} + glVertex3sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex3sv} + glVertex4d: procedure(x, y, z, w: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex4d} + glVertex4dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex4dv} + glVertex4f: procedure(x, y, z, w: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex4f} + glVertex4fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex4fv} + glVertex4i: procedure(x, y, z, w: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex4i} + glVertex4iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex4iv} + glVertex4s: procedure(x, y, z, w: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex4s} + glVertex4sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertex4sv} + glVertexPointer: procedure(size: TGLint; atype: TGLEnum; stride: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexPointer} + glViewport: procedure(x, y: TGLint; width, height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glViewport} + + // GL 1.2 + glDrawRangeElements: procedure(mode: TGLEnum; Astart, Aend: TGLuint; count: TGLsizei; Atype: TGLEnum; + indices: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDrawRangeElements} + glTexImage3D: procedure(target: TGLEnum; level: TGLint; internalformat: TGLEnum; width, height, depth: TGLsizei; + border: TGLint; format: TGLEnum; Atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexImage3D} + + // GL 1.2 ARB imaging + glBlendColor: procedure(red, green, blue, alpha: TGLclampf); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBlendColor} + glBlendEquation: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBlendEquation} + glColorSubTable: procedure(target: TGLEnum; start, count: TGLsizei; format, Atype: TGLEnum; data: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorSubTable} + glCopyColorSubTable: procedure(target: TGLEnum; start: TGLsizei; x, y: TGLint; width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyColorSubTable} + glColorTable: procedure(target, internalformat: TGLEnum; width: TGLsizei; format, Atype: TGLEnum; + table: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorTable} + glCopyColorTable: procedure(target, internalformat: TGLEnum; x, y: TGLint; width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyColorTable} + glColorTableParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorTableParameteriv} + glColorTableParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorTableParameterfv} + glGetColorTable: procedure(target, format, Atype: TGLEnum; table: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetColorTable} + glGetColorTableParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetColorTableParameteriv} + glGetColorTableParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetColorTableParameterfv} + glConvolutionFilter1D: procedure(target, internalformat: TGLEnum; width: TGLsizei; format, Atype: TGLEnum; + image: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionFilter1D} + glConvolutionFilter2D: procedure(target, internalformat: TGLEnum; width, height: TGLsizei; format, Atype: TGLEnum; + image: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionFilter2D} + glCopyConvolutionFilter1D: procedure(target, internalformat: TGLEnum; x, y: TGLint; width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyConvolutionFilter1D} + glCopyConvolutionFilter2D: procedure(target, internalformat: TGLEnum; x, y: TGLint; width, height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyConvolutionFilter2D} + glGetConvolutionFilter: procedure(target, internalformat, Atype: TGLEnum; image: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetConvolutionFilter} + glSeparableFilter2D: procedure(target, internalformat: TGLEnum; width, height: TGLsizei; format, Atype: TGLEnum; row, + column: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSeparableFilter2D} + glGetSeparableFilter: procedure(target, format, Atype: TGLEnum; row, column, span: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetSeparableFilter} + glConvolutionParameteri: procedure(target, pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionParameteri} + glConvolutionParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionParameteriv} + glConvolutionParameterf: procedure(target, pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionParameterf} + glConvolutionParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionParameterfv} + glGetConvolutionParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetConvolutionParameteriv} + glGetConvolutionParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetConvolutionParameterfv} + glHistogram: procedure(target: TGLEnum; width: TGLsizei; internalformat: TGLEnum; sink: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glHistogram} + glResetHistogram: procedure(target: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glResetHistogram} + glGetHistogram: procedure(target: TGLEnum; reset: TGLboolean; format, Atype: TGLEnum; values: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetHistogram} + glGetHistogramParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetHistogramParameteriv} + glGetHistogramParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetHistogramParameterfv} + glMinmax: procedure(target, internalformat: TGLEnum; sink: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMinmax} + glResetMinmax: procedure(target: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glResetMinmax} + glGetMinmax: procedure(target: TGLEnum; reset: TGLboolean; format, Atype: TGLEnum; values: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetMinmax} + glGetMinmaxParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetMinmaxParameteriv} + glGetMinmaxParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetMinmaxParameterfv} + + // GL utility functions and procedures + gluErrorString: function(errCode: TGLEnum): PChar; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluErrorString} + gluGetString: function(name: TGLEnum): PChar; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluGetString} + gluOrtho2D: procedure(left, right, bottom, top: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluOrtho2D} + gluPerspective: procedure(fovy, aspect, zNear, zFar: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluPerspective} + gluPickMatrix: procedure(x, y, width, height: TGLdouble; viewport: TVector4i); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluPickMatrix} + gluLookAt: procedure(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluLookAt} + gluProject: function(objx, objy, objz: TGLdouble; modelMatrix: TMatrix4d; projMatrix: TMatrix4d; viewport: TVector4i; + winx, winy, winz: PGLdouble): TGLint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluProject} + gluUnProject: function(winx, winy, winz: TGLdouble; modelMatrix: TMatrix4d; projMatrix: TMatrix4d; viewport: TVector4i; + objx, objy, objz: PGLdouble): TGLint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluUnProject} + gluScaleImage: function(format: TGLEnum; widthin, heightin: TGLint; typein: TGLEnum; datain: Pointer; widthout, + heightout: TGLint; typeout: TGLEnum; dataout: Pointer): TGLint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluScaleImage} + gluBuild1DMipmaps: function(target: TGLEnum; components, width: TGLint; format, atype: TGLEnum; + data: Pointer): TGLint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluBuild1DMipmaps} + gluBuild2DMipmaps: function(target: TGLEnum; components, width, height: TGLint; format, atype: TGLEnum; + Data: Pointer): TGLint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluBuild2DMipmaps} + gluNewQuadric: function: PGLUquadric; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluNewQuadric} + gluDeleteQuadric: procedure(state: PGLUquadric); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluDeleteQuadric} + gluQuadricNormals: procedure(quadObject: PGLUquadric; normals: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluQuadricNormals} + gluQuadricTexture: procedure(quadObject: PGLUquadric; textureCoords: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluQuadricTexture} + gluQuadricOrientation: procedure(quadObject: PGLUquadric; orientation: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluQuadricOrientation} + gluQuadricDrawStyle: procedure(quadObject: PGLUquadric; drawStyle: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluQuadricDrawStyle} + gluCylinder: procedure(quadObject: PGLUquadric; baseRadius, topRadius, height: TGLdouble; slices, + stacks: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluCylinder} + gluDisk: procedure(quadObject: PGLUquadric; innerRadius, outerRadius: TGLdouble; slices, loops: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluDisk} + gluPartialDisk: procedure(quadObject: PGLUquadric; innerRadius, outerRadius: TGLdouble; slices, loops: TGLint; + startAngle, sweepAngle: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluPartialDisk} + gluSphere: procedure(quadObject: PGLUquadric; radius: TGLdouble; slices, stacks: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluSphere} + gluQuadricCallback: procedure(quadObject: PGLUquadric; which: TGLEnum; fn: TGLUQuadricErrorProc); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluQuadricCallback} + gluNewTess: function: PGLUtesselator; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluNewTess} + gluDeleteTess: procedure(tess: PGLUtesselator); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluDeleteTess} + gluTessBeginPolygon: procedure(tess: PGLUtesselator; polygon_data: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluTessBeginPolygon} + gluTessBeginContour: procedure(tess: PGLUtesselator); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluTessBeginContour} + gluTessVertex: procedure(tess: PGLUtesselator; coords: TVector3d; data: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluTessVertex} + gluTessEndContour: procedure(tess: PGLUtesselator); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluTessEndContour} + gluTessEndPolygon: procedure(tess: PGLUtesselator); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluTessEndPolygon} + gluTessProperty: procedure(tess: PGLUtesselator; which: TGLEnum; value: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluTessProperty} + gluTessNormal: procedure(tess: PGLUtesselator; x, y, z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluTessNormal} + gluTessCallback: procedure(tess: PGLUtesselator; which: TGLEnum; fn: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluTessCallback} + gluGetTessProperty: procedure(tess: PGLUtesselator; which: TGLEnum; value: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluGetTessProperty} + gluNewNurbsRenderer: function: PGLUnurbs; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluNewNurbsRenderer} + gluDeleteNurbsRenderer: procedure(nobj: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluDeleteNurbsRenderer} + gluBeginSurface: procedure(nobj: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluBeginSurface} + gluBeginCurve: procedure(nobj: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluBeginCurve} + gluEndCurve: procedure(nobj: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluEndCurve} + gluEndSurface: procedure(nobj: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluEndSurface} + gluBeginTrim: procedure(nobj: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluBeginTrim} + gluEndTrim: procedure(nobj: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluEndTrim} + gluPwlCurve: procedure(nobj: PGLUnurbs; count: TGLint; points: PGLfloat; stride: TGLint; atype: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluPwlCurve} + gluNurbsCurve: procedure(nobj: PGLUnurbs; nknots: TGLint; knot: PGLfloat; stride: TGLint; ctlarray: PGLfloat; order: TGLint; atype: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluNurbsCurve} + gluNurbsSurface: procedure(nobj: PGLUnurbs; sknot_count: TGLint; sknot: PGLfloat; tknot_count: TGLint; tknot: PGLfloat; s_stride, t_stride: TGLint; ctlarray: PGLfloat; sorder, torder: TGLint; atype: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluNurbsSurface} + gluLoadSamplingMatrices: procedure(nobj: PGLUnurbs; modelMatrix, projMatrix: TMatrix4f; viewport: TVector4i); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluLoadSamplingMatrices} + gluNurbsProperty: procedure(nobj: PGLUnurbs; aproperty: TGLEnum; value: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluNurbsProperty} + gluGetNurbsProperty: procedure(nobj: PGLUnurbs; aproperty: TGLEnum; value: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluGetNurbsProperty} + gluNurbsCallback: procedure(nobj: PGLUnurbs; which: TGLEnum; fn: TGLUNurbsErrorProc); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluNurbsCallback} + gluBeginPolygon: procedure(tess: PGLUtesselator); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluBeginPolygon} + gluNextContour: procedure(tess: PGLUtesselator; atype: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluNextContour} + gluEndPolygon: procedure(tess: PGLUtesselator); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluEndPolygon} + + // window support functions + {$ifdef Win32} + wglGetProcAddress: function(ProcName: PChar): Pointer; stdcall; + {$EXTERNALSYM wglGetProcAddress} + wglCopyContext: function(p1: HGLRC; p2: HGLRC; p3: Cardinal): BOOL; stdcall; + {$EXTERNALSYM wglCopyContext} + wglCreateContext: function(DC: HDC): HGLRC; stdcall; + {$EXTERNALSYM wglCreateContext} + wglCreateLayerContext: function(p1: HDC; p2: Integer): HGLRC; stdcall; + {$EXTERNALSYM wglCreateLayerContext} + wglDeleteContext: function(p1: HGLRC): BOOL; stdcall; + {$EXTERNALSYM wglDeleteContext} + wglDescribeLayerPlane:function(p1: HDC; p2, p3: Integer; p4: Cardinal; var p5: TLayerPlaneDescriptor): BOOL; stdcall; + {$EXTERNALSYM wglDescribeLayerPlane} + wglGetCurrentContext: function: HGLRC; stdcall; + {$EXTERNALSYM wglGetCurrentContext} + wglGetCurrentDC: function: HDC; stdcall; + {$EXTERNALSYM wglGetCurrentDC} + wglGetLayerPaletteEntries: function(p1: HDC; p2, p3, p4: Integer; var pcr): Integer; stdcall; + {$EXTERNALSYM wglGetLayerPaletteEntries} + wglMakeCurrent: function(DC: HDC; p2: HGLRC): BOOL; stdcall; + {$EXTERNALSYM wglMakeCurrent} + wglRealizeLayerPalette: function(p1: HDC; p2: Integer; p3: BOOL): BOOL; stdcall; + {$EXTERNALSYM wglRealizeLayerPalette} + wglSetLayerPaletteEntries: function(p1: HDC; p2, p3, p4: Integer; var pcr): Integer; stdcall; + {$EXTERNALSYM wglSetLayerPaletteEntries} + wglShareLists: function(p1, p2: HGLRC): BOOL; stdcall; + {$EXTERNALSYM wglShareLists} + wglSwapLayerBuffers: function(p1: HDC; p2: Cardinal): BOOL; stdcall; + {$EXTERNALSYM wglSwapLayerBuffers} + wglSwapMultipleBuffers: function(p1: Cardinal; const p2: PWGLSwap): DWORD; stdcall; + {$EXTERNALSYM wglSwapMultipleBuffers} + wglUseFontBitmapsA: function(DC: HDC; p2, p3, p4: DWORD): BOOL; stdcall; + {$EXTERNALSYM wglUseFontBitmapsA} + wglUseFontOutlinesA: function (p1: HDC; p2, p3, p4: DWORD; p5, p6: Single; p7: Integer; p8: PGlyphMetricsFloat): BOOL; stdcall; + {$EXTERNALSYM wglUseFontOutlinesA} + wglUseFontBitmapsW: function(DC: HDC; p2, p3, p4: DWORD): BOOL; stdcall; + {$EXTERNALSYM wglUseFontBitmapsW} + wglUseFontOutlinesW: function (p1: HDC; p2, p3, p4: DWORD; p5, p6: Single; p7: Integer; p8: PGlyphMetricsFloat): BOOL; stdcall; + {$EXTERNALSYM wglUseFontOutlinesW} + wglUseFontBitmaps: function(DC: HDC; p2, p3, p4: DWORD): BOOL; stdcall; + {$EXTERNALSYM wglUseFontBitmaps} + wglUseFontOutlines: function(p1: HDC; p2, p3, p4: DWORD; p5, p6: Single; p7: Integer; p8: PGlyphMetricsFloat): BOOL; stdcall; + {$EXTERNALSYM wglUseFontOutlines} + + // ARB wgl extensions + wglGetExtensionsStringARB: function(DC: HDC): PChar; stdcall; + {$EXTERNALSYM wglGetExtensionsStringARB} + wglGetPixelFormatAttribivARB: function(DC: HDC; iPixelFormat, iLayerPlane: Integer; nAttributes: Cardinal; + const piAttributes: PInteger; piValues : PInteger) : BOOL; stdcall; + {$EXTERNALSYM wglGetPixelFormatAttribivARB} + wglGetPixelFormatAttribfvARB: function(DC: HDC; iPixelFormat, iLayerPlane: Integer; nAttributes: Cardinal; + const piAttributes: PInteger; piValues: PGLFloat) : BOOL; stdcall; + {$EXTERNALSYM wglGetPixelFormatAttribfvARB} + wglChoosePixelFormatARB: function(DC: HDC; const piAttribIList: PInteger; const pfAttribFList: PGLFloat; + nMaxFormats: Cardinal; piFormats: PInteger; nNumFormats: PCardinal) : BOOL; stdcall; + {$EXTERNALSYM wglChoosePixelFormatARB} + {$endif} + + // ARB_multitexture + glMultiTexCoord1dARB: procedure(target: TGLenum; s: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord1dARB} + glMultiTexCoord1dVARB: procedure(target: TGLenum; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord1dVARB} + glMultiTexCoord1fARBP: procedure(target: TGLenum; s: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord1fARBP} + glMultiTexCoord1fVARB: procedure(target: TGLenum; v: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord1fVARB} + glMultiTexCoord1iARB: procedure(target: TGLenum; s: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord1iARB} + glMultiTexCoord1iVARB: procedure(target: TGLenum; v: PGLInt); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord1iVARB} + glMultiTexCoord1sARBP: procedure(target: TGLenum; s: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord1sARBP} + glMultiTexCoord1sVARB: procedure(target: TGLenum; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord1sVARB} + glMultiTexCoord2dARB: procedure(target: TGLenum; s, t: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord2dARB} + glMultiTexCoord2dvARB: procedure(target: TGLenum; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord2dvARB} + glMultiTexCoord2fARB: procedure(target: TGLenum; s, t: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord2fARB} + glMultiTexCoord2fvARB: procedure(target: TGLenum; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord2fvARB} + glMultiTexCoord2iARB: procedure(target: TGLenum; s, t: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord2iARB} + glMultiTexCoord2ivARB: procedure(target: TGLenum; v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord2ivARB} + glMultiTexCoord2sARB: procedure(target: TGLenum; s, t: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord2sARB} + glMultiTexCoord2svARB: procedure(target: TGLenum; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord2svARB} + glMultiTexCoord3dARB: procedure(target: TGLenum; s, t, r: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord3dARB} + glMultiTexCoord3dvARB: procedure(target: TGLenum; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord3dvARB} + glMultiTexCoord3fARB: procedure(target: TGLenum; s, t, r: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord3fARB} + glMultiTexCoord3fvARB: procedure(target: TGLenum; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord3fvARB} + glMultiTexCoord3iARB: procedure(target: TGLenum; s, t, r: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord3iARB} + glMultiTexCoord3ivARB: procedure(target: TGLenum; v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord3ivARB} + glMultiTexCoord3sARB: procedure(target: TGLenum; s, t, r: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord3sARB} + glMultiTexCoord3svARB: procedure(target: TGLenum; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord3svARB} + glMultiTexCoord4dARB: procedure(target: TGLenum; s, t, r, q: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord4dARB} + glMultiTexCoord4dvARB: procedure(target: TGLenum; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord4dvARB} + glMultiTexCoord4fARB: procedure(target: TGLenum; s, t, r, q: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord4fARB} + glMultiTexCoord4fvARB: procedure(target: TGLenum; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord4fvARB} + glMultiTexCoord4iARB: procedure(target: TGLenum; s, t, r, q: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord4iARB} + glMultiTexCoord4ivARB: procedure(target: TGLenum; v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord4ivARB} + glMultiTexCoord4sARB: procedure(target: TGLenum; s, t, r, q: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord4sARB} + glMultiTexCoord4svARB: procedure(target: TGLenum; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiTexCoord4svARB} + glActiveTextureARB: procedure(target: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glActiveTextureARB} + glClientActiveTextureARB: procedure(target: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glClientActiveTextureARB} + + // GLU extensions + gluNurbsCallbackDataEXT: procedure(nurb: PGLUnurbs; userData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluNurbsCallbackDataEXT} + gluNewNurbsTessellatorEXT: function: PGLUnurbs; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluNewNurbsTessellatorEXT} + gluDeleteNurbsTessellatorEXT: procedure(nurb: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM gluDeleteNurbsTessellatorEXT} + +{$ifndef FPC} + {$ifdef MULTITHREADOPENGL} + threadvar + {$else} + var + {$endif} +{$else} +var +{$endif} + // Extension functions + glAreTexturesResidentEXT: function(n: TGLsizei; textures: PGLuint; residences: PGLBoolean): TGLboolean; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glAreTexturesResidentEXT} + glArrayElementArrayEXT: procedure(mode: TGLEnum; count: TGLsizei; pi: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glArrayElementArrayEXT} + glBeginSceneEXT: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBeginSceneEXT} + glBindTextureEXT: procedure(target: TGLEnum; texture: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBindTextureEXT} + glColorTableEXT: procedure(target, internalFormat: TGLEnum; width: TGLsizei; format, atype: TGLEnum; data: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorTableEXT} + glColorSubTableExt: procedure(target: TGLEnum; start, count: TGLsizei; format, atype: TGLEnum; data: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorSubTableExt} + glCopyTexImage1DEXT: procedure(target: TGLEnum; level: TGLint; internalFormat: TGLEnum; x, y: TGLint; width: TGLsizei; border: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyTexImage1DEXT} + glCopyTexSubImage1DEXT: procedure(target: TGLEnum; level, xoffset, x, y: TGLint; width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyTexSubImage1DEXT} + glCopyTexImage2DEXT: procedure(target: TGLEnum; level: TGLint; internalFormat: TGLEnum; x, y: TGLint; width, height: TGLsizei; border: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyTexImage2DEXT} + glCopyTexSubImage2DEXT: procedure(target: TGLEnum; level, xoffset, yoffset, x, y: TGLint; width, height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyTexSubImage2DEXT} + glCopyTexSubImage3DEXT: procedure(target: TGLEnum; level, xoffset, yoffset, zoffset, x, y: TGLint; width, height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyTexSubImage3DEXT} + glDeleteTexturesEXT: procedure(n: TGLsizei; textures: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDeleteTexturesEXT} + glEndSceneEXT: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEndSceneEXT} + glGenTexturesEXT: procedure(n: TGLsizei; textures: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGenTexturesEXT} + glGetColorTableEXT: procedure(target, format, atype: TGLEnum; data: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetColorTableEXT} + glGetColorTablePameterfvEXT: procedure(target, pname: TGLEnum; params: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetColorTablePameterfvEXT} + glGetColorTablePameterivEXT: procedure(target, pname: TGLEnum; params: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetColorTablePameterivEXT} + glIndexFuncEXT: procedure(func: TGLEnum; ref: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexFuncEXT} + glIndexMaterialEXT: procedure(face: TGLEnum; mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexMaterialEXT} + glIsTextureEXT: function(texture: TGLuint): TGLboolean; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIsTextureEXT} + glLockArraysEXT: procedure(first: TGLint; count: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLockArraysEXT} + glPolygonOffsetEXT: procedure(factor, bias: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPolygonOffsetEXT} + glPrioritizeTexturesEXT: procedure(n: TGLsizei; textures: PGLuint; priorities: PGLclampf); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPrioritizeTexturesEXT} + glTexSubImage1DEXT: procedure(target: TGLEnum; level, xoffset: TGLint; width: TGLsizei; format, Atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexSubImage1DEXT} + glTexSubImage2DEXT: procedure(target: TGLEnum; level, xoffset, yoffset: TGLint; width, height: TGLsizei; format, Atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexSubImage2DEXT} + glTexSubImage3DEXT: procedure(target: TGLEnum; level, xoffset, yoffset, zoffset: TGLint; width, height, depth: TGLsizei; format, Atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexSubImage3DEXT} + glUnlockArraysEXT: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glUnlockArraysEXT} + + // EXT_vertex_array + glArrayElementEXT: procedure(I: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glArrayElementEXT} + glColorPointerEXT: procedure(size: TGLInt; atype: TGLenum; stride, count: TGLsizei; data: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorPointerEXT} + glDrawArraysEXT: procedure(mode: TGLenum; first: TGLInt; count: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDrawArraysEXT} + glEdgeFlagPointerEXT: procedure(stride, count: TGLsizei; data: PGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEdgeFlagPointerEXT} + glGetPointervEXT: procedure(pname: TGLEnum; var params); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetPointervEXT} + glIndexPointerEXT: procedure(AType: TGLEnum; stride, count: TGLsizei; P: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexPointerEXT} + glNormalPointerEXT: procedure(AType: TGLsizei; stride, count: TGLsizei; P: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormalPointerEXT} + glTexCoordPointerEXT: procedure(size: TGLint; AType: TGLenum; stride, count: TGLsizei; P: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoordPointerEXT} + glVertexPointerEXT: procedure(size: TGLint; AType: TGLenum; stride, count: TGLsizei; P: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexPointerEXT} + + // EXT_compiled_vertex_array + glLockArrayEXT: procedure(first: TGLint; count: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLockArrayEXT} + glUnlockArrayEXT: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glUnlockArrayEXT} + + // EXT_cull_vertex + glCullParameterdvEXT: procedure(pname: TGLenum; params: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCullParameterdvEXT} + glCullParameterfvEXT: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCullParameterfvEXT} + + // WIN_swap_hint + glAddSwapHintRectWIN: procedure(x, y: TGLint; width, height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glAddSwapHintRectWIN} + + // EXT_point_parameter + glPointParameterfEXT: procedure(pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPointParameterfEXT} + glPointParameterfvEXT: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPointParameterfvEXT} + + // GL_ARB_transpose_matrix + glLoadTransposeMatrixfARB: procedure(m: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLoadTransposeMatrixfARB} + glLoadTransposeMatrixdARB: procedure(m: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLoadTransposeMatrixdARB} + glMultTransposeMatrixfARB: procedure(m: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultTransposeMatrixfARB} + glMultTransposeMatrixdARB: procedure(m: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultTransposeMatrixdARB} + + // GL_ARB_multisample + glSampleCoverageARB: procedure(Value: TGLclampf; invert: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSampleCoverageARB} + glSamplePassARB: procedure(pass: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSamplePassARB} + + // GL_ARB_texture_compression + glCompressedTexImage3DARB: procedure(target: TGLenum; level: TGLint; internalformat: TGLenum; Width, Height, depth: TGLsizei; border: TGLint; imageSize: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCompressedTexImage3DARB} + glCompressedTexImage2DARB: procedure(target: TGLenum; level: TGLint; internalformat: TGLenum; Width, Height: TGLsizei; border: TGLint; imageSize: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCompressedTexImage2DARB} + glCompressedTexImage1DARB: procedure(target: TGLenum; level: TGLint; internalformat: TGLenum; Width: TGLsizei; border: TGLint; imageSize: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCompressedTexImage1DARB} + glCompressedTexSubImage3DARB: procedure(target: TGLenum; level: TGLint; xoffset, yoffset, zoffset: TGLint; width, height, depth: TGLsizei; Format: TGLenum; imageSize: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCompressedTexSubImage3DARB} + glCompressedTexSubImage2DARB: procedure(target: TGLenum; level: TGLint; xoffset, yoffset: TGLint; width, height: TGLsizei; Format: TGLenum; imageSize: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCompressedTexSubImage2DARB} + glCompressedTexSubImage1DARB: procedure(target: TGLenum; level: TGLint; xoffset: TGLint; width: TGLsizei; Format: TGLenum; imageSize: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCompressedTexSubImage1DARB} + glGetCompressedTexImageARB: procedure(target: TGLenum; level: TGLint; img: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetCompressedTexImageARB} + + // GL_EXT_blend_color + glBlendColorEXT: procedure(red, green, blue: TGLclampf; alpha: TGLclampf); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBlendColorEXT} + + // GL_EXT_texture3D + glTexImage3DEXT: procedure(target: TGLenum; level: TGLint; internalformat: TGLenum; width, height, depth: TGLsizei; border: TGLint; Format, AType: TGLenum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexImage3DEXT} + + // GL_SGIS_texture_filter4 + glGetTexFilterFuncSGIS: procedure(target, Filter: TGLenum; weights: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTexFilterFuncSGIS} + glTexFilterFuncSGIS: procedure(target, Filter: TGLenum; n: TGLsizei; weights: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexFilterFuncSGIS} + + // GL_EXT_histogram + glGetHistogramEXT: procedure(target: TGLenum; reset: TGLboolean; Format, AType: TGLenum; values: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetHistogramEXT} + glGetHistogramParameterfvEXT: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetHistogramParameterfvEXT} + glGetHistogramParameterivEXT: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetHistogramParameterivEXT} + glGetMinmaxEXT: procedure(target: TGLenum; reset: TGLboolean; Format, AType: TGLenum; values: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetMinmaxEXT} + glGetMinmaxParameterfvEXT: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetMinmaxParameterfvEXT} + glGetMinmaxParameterivEXT: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetMinmaxParameterivEXT} + glHistogramEXT: procedure(target: TGLenum; Width: TGLsizei; internalformat: TGLenum; sink: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glHistogramEXT} + glMinmaxEXT: procedure(target, internalformat: TGLenum; sink: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMinmaxEXT} + glResetHistogramEXT: procedure(target: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glResetHistogramEXT} + glResetMinmaxEXT: procedure(target: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glResetMinmaxEXT} + + // GL_EXT_convolution + glConvolutionFilter1DEXT: procedure(target, internalformat: TGLenum; Width: TGLsizei; Format, AType: TGLenum; image: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionFilter1DEXT} + glConvolutionFilter2DEXT: procedure(target, internalformat: TGLenum; Width, Height: TGLsizei; Format, AType: TGLenum; image: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionFilter2DEXT} + glConvolutionParameterfEXT: procedure(target, pname: TGLenum; params: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionParameterfEXT} + glConvolutionParameterfvEXT: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionParameterfvEXT} + glConvolutionParameteriEXT: procedure(target, pname: TGLenum; params: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionParameteriEXT} + glConvolutionParameterivEXT: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glConvolutionParameterivEXT} + glCopyConvolutionFilter1DEXT: procedure(target, internalformat: TGLenum; x, y: TGLint; Width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyConvolutionFilter1DEXT} + glCopyConvolutionFilter2DEXT: procedure(target, internalformat: TGLenum; x, y: TGLint; Width, Height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyConvolutionFilter2DEXT} + glGetConvolutionFilterEXT: procedure(target, Format, AType: TGLenum; image: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetConvolutionFilterEXT} + glGetConvolutionParameterfvEXT: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetConvolutionParameterfvEXT} + glGetConvolutionParameterivEXT: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetConvolutionParameterivEXT} + glGetSeparableFilterEXT: procedure(target, Format, AType: TGLenum; row, column, span: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetSeparableFilterEXT} + glSeparableFilter2DEXT: procedure(target, internalformat: TGLenum; Width, Height: TGLsizei; Format, AType: TGLenum; row, column: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSeparableFilter2DEXT} + + // GL_SGI_color_table + glColorTableSGI: procedure(target, internalformat: TGLenum; Width: TGLsizei; Format, AType: TGLenum; Table: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorTableSGI} + glColorTableParameterfvSGI: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorTableParameterfvSGI} + glColorTableParameterivSGI: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorTableParameterivSGI} + glCopyColorTableSGI: procedure(target, internalformat: TGLenum; x, y: TGLint; Width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyColorTableSGI} + glGetColorTableSGI: procedure(target, Format, AType: TGLenum; Table: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetColorTableSGI} + glGetColorTableParameterfvSGI: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetColorTableParameterfvSGI} + glGetColorTableParameterivSGI: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetColorTableParameterivSGI} + + // GL_SGIX_pixel_texture + glPixelTexGenSGIX: procedure(mode: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelTexGenSGIX} + + // GL_SGIS_pixel_texture + glPixelTexGenParameteriSGIS: procedure(pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelTexGenParameteriSGIS} + glPixelTexGenParameterivSGIS: procedure(pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelTexGenParameterivSGIS} + glPixelTexGenParameterfSGIS: procedure(pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelTexGenParameterfSGIS} + glPixelTexGenParameterfvSGIS: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelTexGenParameterfvSGIS} + glGetPixelTexGenParameterivSGIS: procedure(pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetPixelTexGenParameterivSGIS} + glGetPixelTexGenParameterfvSGIS: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetPixelTexGenParameterfvSGIS} + + // GL_SGIS_texture4D + glTexImage4DSGIS: procedure(target: TGLenum; level: TGLint; internalformat: TGLenum; Width, Height, depth, size4d: TGLsizei; border: TGLint; Format, AType: TGLenum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexImage4DSGIS} + glTexSubImage4DSGIS: procedure(target: TGLenum; level, xoffset, yoffset, zoffset, woffset: TGLint; Width, Height, depth, size4d: TGLsizei; Format, AType: TGLenum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexSubImage4DSGIS} + + // GL_SGIS_detail_texture + glDetailTexFuncSGIS: procedure(target: TGLenum; n: TGLsizei; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDetailTexFuncSGIS} + glGetDetailTexFuncSGIS: procedure(target: TGLenum; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetDetailTexFuncSGIS} + + // GL_SGIS_sharpen_texture + glSharpenTexFuncSGIS: procedure(target: TGLenum; n: TGLsizei; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSharpenTexFuncSGIS} + glGetSharpenTexFuncSGIS: procedure(target: TGLenum; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetSharpenTexFuncSGIS} + + // GL_SGIS_multisample + glSampleMaskSGIS: procedure(Value: TGLclampf; invert: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSampleMaskSGIS} + glSamplePatternSGIS: procedure(pattern: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSamplePatternSGIS} + + // GL_EXT_blend_minmax + glBlendEquationEXT: procedure(mode: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBlendEquationEXT} + + // GL_SGIX_sprite + glSpriteParameterfSGIX: procedure(pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSpriteParameterfSGIX} + glSpriteParameterfvSGIX: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSpriteParameterfvSGIX} + glSpriteParameteriSGIX: procedure(pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSpriteParameteriSGIX} + glSpriteParameterivSGIX: procedure(pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSpriteParameterivSGIX} + + // GL_EXT_point_parameters + glPointParameterfSGIS: procedure(pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPointParameterfSGIS} + glPointParameterfvSGIS: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPointParameterfvSGIS} + + // GL_SGIX_instruments + glGetInstrumentsSGIX: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetInstrumentsSGIX} + glInstrumentsBufferSGIX: procedure(Size: TGLsizei; buffer: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glInstrumentsBufferSGIX} + glPollInstrumentsSGIX: procedure(marker_p: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPollInstrumentsSGIX} + glReadInstrumentsSGIX: procedure(marker: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReadInstrumentsSGIX} + glStartInstrumentsSGIX: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glStartInstrumentsSGIX} + glStopInstrumentsSGIX: procedure(marker: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glStopInstrumentsSGIX} + + // GL_SGIX_framezoom + glFrameZoomSGIX: procedure(factor: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFrameZoomSGIX} + + // GL_SGIX_tag_sample_buffer + glTagSampleBufferSGIX: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTagSampleBufferSGIX} + + // GL_SGIX_polynomial_ffd + glDeformationMap3dSGIX: procedure(target: TGLenum; u1, u2: TGLdouble; ustride, uorder: TGLint; v1, v2: TGLdouble; vstride, vorder: TGLint; w1, w2: TGLdouble; wstride, worder: TGLint; points: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDeformationMap3dSGIX} + glDeformationMap3fSGIX: procedure(target: TGLenum; u1, u2: TGLfloat; ustride, uorder: TGLint; v1, v2: TGLfloat; vstride, vorder: TGLint; w1, w2: TGLfloat; wstride, worder: TGLint; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDeformationMap3fSGIX} + glDeformSGIX: procedure(mask: TGLbitfield); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDeformSGIX} + glLoadIdentityDeformationMapSGIX: procedure(mask: TGLbitfield); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLoadIdentityDeformationMapSGIX} + + // GL_SGIX_reference_plane + glReferencePlaneSGIX: procedure(equation: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReferencePlaneSGIX} + + // GL_SGIX_flush_raster + glFlushRasterSGIX: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFlushRasterSGIX} + + // GL_SGIS_fog_function + glFogFuncSGIS: procedure(n: TGLsizei; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFogFuncSGIS} + glGetFogFuncSGIS: procedure(points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetFogFuncSGIS} + + // GL_HP_image_transform + glImageTransformParameteriHP: procedure(target, pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glImageTransformParameteriHP} + glImageTransformParameterfHP: procedure(target, pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glImageTransformParameterfHP} + glImageTransformParameterivHP: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glImageTransformParameterivHP} + glImageTransformParameterfvHP: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glImageTransformParameterfvHP} + glGetImageTransformParameterivHP: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetImageTransformParameterivHP} + glGetImageTransformParameterfvHP: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetImageTransformParameterfvHP} + + // GL_EXT_color_subtable + glCopyColorSubTableEXT: procedure(target: TGLenum; start: TGLsizei; x, y: TGLint; Width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCopyColorSubTableEXT} + + // GL_PGI_misc_hints + glHintPGI: procedure(target: TGLenum; mode: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glHintPGI} + + // GL_EXT_paletted_texture + glGetColorTableParameterivEXT: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetColorTableParameterivEXT} + glGetColorTableParameterfvEXT: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetColorTableParameterfvEXT} + + // GL_SGIX_list_priority + glGetListParameterfvSGIX: procedure(list: TGLuint; pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetListParameterfvSGIX} + glGetListParameterivSGIX: procedure(list: TGLuint; pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetListParameterivSGIX} + glListParameterfSGIX: procedure(list: TGLuint; pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glListParameterfSGIX} + glListParameterfvSGIX: procedure(list: TGLuint; pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glListParameterfvSGIX} + glListParameteriSGIX: procedure(list: TGLuint; pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glListParameteriSGIX} + glListParameterivSGIX: procedure(list: TGLuint; pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glListParameterivSGIX} + + // GL_SGIX_fragment_lighting + glFragmentColorMaterialSGIX: procedure(face, mode: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentColorMaterialSGIX} + glFragmentLightfSGIX: procedure(light, pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentLightfSGIX} + glFragmentLightfvSGIX: procedure(light, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentLightfvSGIX} + glFragmentLightiSGIX: procedure(light, pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentLightiSGIX} + glFragmentLightivSGIX: procedure(light, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentLightivSGIX} + glFragmentLightModelfSGIX: procedure(pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentLightModelfSGIX} + glFragmentLightModelfvSGIX: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentLightModelfvSGIX} + glFragmentLightModeliSGIX: procedure(pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentLightModeliSGIX} + glFragmentLightModelivSGIX: procedure(pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentLightModelivSGIX} + glFragmentMaterialfSGIX: procedure(face, pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentMaterialfSGIX} + glFragmentMaterialfvSGIX: procedure(face, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentMaterialfvSGIX} + glFragmentMaterialiSGIX: procedure(face, pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentMaterialiSGIX} + glFragmentMaterialivSGIX: procedure(face, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFragmentMaterialivSGIX} + glGetFragmentLightfvSGIX: procedure(light, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetFragmentLightfvSGIX} + glGetFragmentLightivSGIX: procedure(light, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetFragmentLightivSGIX} + glGetFragmentMaterialfvSGIX: procedure(face, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetFragmentMaterialfvSGIX} + glGetFragmentMaterialivSGIX: procedure(face, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetFragmentMaterialivSGIX} + glLightEnviSGIX: procedure(pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLightEnviSGIX} + + // GL_EXT_draw_range_elements + glDrawRangeElementsEXT: procedure(mode: TGLenum; start, Aend: TGLuint; Count: TGLsizei; Atype: TGLenum; indices: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDrawRangeElementsEXT} + + // GL_EXT_light_texture + glApplyTextureEXT: procedure(mode: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glApplyTextureEXT} + glTextureLightEXT: procedure(pname: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTextureLightEXT} + glTextureMaterialEXT: procedure(face, mode: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTextureMaterialEXT} + + // GL_SGIX_async + glAsyncMarkerSGIX: procedure(marker: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glAsyncMarkerSGIX} + glFinishAsyncSGIX: procedure(markerp: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFinishAsyncSGIX} + glPollAsyncSGIX: procedure(markerp: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPollAsyncSGIX} + glGenAsyncMarkersSGIX: procedure(range: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGenAsyncMarkersSGIX} + glDeleteAsyncMarkersSGIX: procedure(marker: TGLuint; range: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDeleteAsyncMarkersSGIX} + glIsAsyncMarkerSGIX: procedure(marker: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIsAsyncMarkerSGIX} + + // GL_INTEL_parallel_arrays + glVertexPointervINTEL: procedure(size: TGLint; Atype: TGLenum; var P); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexPointervINTEL} + glNormalPointervINTEL: procedure(Atype: TGLenum; var P); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormalPointervINTEL} + glColorPointervINTEL: procedure(size: TGLint; Atype: TGLenum; var P); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorPointervINTEL} + glTexCoordPointervINTEL: procedure(size: TGLint; Atype: TGLenum; var P); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoordPointervINTEL} + + // GL_EXT_pixel_transform + glPixelTransformParameteriEXT: procedure(target, pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelTransformParameteriEXT} + glPixelTransformParameterfEXT: procedure(target, pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelTransformParameterfEXT} + glPixelTransformParameterivEXT: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelTransformParameterivEXT} + glPixelTransformParameterfvEXT: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glPixelTransformParameterfvEXT} + + // GL_EXT_secondary_color + glSecondaryColor3bEXT: procedure(red, green, blue: TGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3bEXT} + glSecondaryColor3bvEXT: procedure(v: PGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3bvEXT} + glSecondaryColor3dEXT: procedure(red, green, blue: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3dEXT} + glSecondaryColor3dvEXT: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3dvEXT} + glSecondaryColor3fEXT: procedure(red, green, blue: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3fEXT} + glSecondaryColor3fvEXT: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3fvEXT} + glSecondaryColor3iEXT: procedure(red, green, blue: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3iEXT} + glSecondaryColor3ivEXT: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3ivEXT} + + glSecondaryColor3sEXT: procedure(red, green, blue: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3sEXT} + glSecondaryColor3svEXT: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3svEXT} + glSecondaryColor3ubEXT: procedure(red, green, blue: TGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3ubEXT} + glSecondaryColor3ubvEXT: procedure(v: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3ubvEXT} + glSecondaryColor3uiEXT: procedure(red, green, blue: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3uiEXT} + glSecondaryColor3uivEXT: procedure(v: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3uivEXT} + glSecondaryColor3usEXT: procedure(red, green, blue: TGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3usEXT} + glSecondaryColor3usvEXT: procedure(v: PGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColor3usvEXT} + glSecondaryColorPointerEXT: procedure(Size: TGLint; Atype: TGLenum; stride: TGLsizei; p: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColorPointerEXT} + + // GL_EXT_texture_perturb_normal + glTextureNormalEXT: procedure(mode: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTextureNormalEXT} + + // GL_EXT_multi_draw_arrays + glMultiDrawArraysEXT: procedure(mode: TGLenum; First: PGLint; Count: PGLsizei; primcount: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiDrawArraysEXT} + glMultiDrawElementsEXT: procedure(mode: TGLenum; Count: PGLsizei; AType: TGLenum; var indices; primcount: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiDrawElementsEXT} + + // GL_EXT_fog_coord + glFogCoordfEXT: procedure(coord: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFogCoordfEXT} + glFogCoordfvEXT: procedure(coord: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFogCoordfvEXT} + glFogCoorddEXT: procedure(coord: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFogCoorddEXT} + glFogCoorddvEXT: procedure(coord: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFogCoorddvEXT} + glFogCoordPointerEXT: procedure(AType: TGLenum; stride: TGLsizei; p: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFogCoordPointerEXT} + + // GL_EXT_coordinate_frame + glTangent3bEXT: procedure(tx, ty, tz: TGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTangent3bEXT} + glTangent3bvEXT: procedure(v: PGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTangent3bvEXT} + glTangent3dEXT: procedure(tx, ty, tz: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTangent3dEXT} + glTangent3dvEXT: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTangent3dvEXT} + glTangent3fEXT: procedure(tx, ty, tz: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTangent3fEXT} + glTangent3fvEXT: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTangent3fvEXT} + glTangent3iEXT: procedure(tx, ty, tz: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTangent3iEXT} + glTangent3ivEXT: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTangent3ivEXT} + glTangent3sEXT: procedure(tx, ty, tz: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTangent3sEXT} + glTangent3svEXT: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTangent3svEXT} + + glBinormal3bEXT: procedure(bx, by, bz: TGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBinormal3bEXT} + glBinormal3bvEXT: procedure(v: PGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBinormal3bvEXT} + glBinormal3dEXT: procedure(bx, by, bz: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBinormal3dEXT} + glBinormal3dvEXT: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBinormal3dvEXT} + glBinormal3fEXT: procedure(bx, by, bz: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBinormal3fEXT} + glBinormal3fvEXT: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBinormal3fvEXT} + glBinormal3iEXT: procedure(bx, by, bz: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBinormal3iEXT} + glBinormal3ivEXT: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBinormal3ivEXT} + glBinormal3sEXT: procedure(bx, by, bz: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBinormal3sEXT} + glBinormal3svEXT: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBinormal3svEXT} + glTangentPointerEXT: procedure(Atype: TGLenum; stride: TGLsizei; p: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTangentPointerEXT} + glBinormalPointerEXT: procedure(Atype: TGLenum; stride: TGLsizei; p: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBinormalPointerEXT} + + // GL_SUNX_constant_data + glFinishTextureSUNX: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFinishTextureSUNX} + + // GL_SUN_global_alpha + glGlobalAlphaFactorbSUN: procedure(factor: TGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGlobalAlphaFactorbSUN} + glGlobalAlphaFactorsSUN: procedure(factor: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGlobalAlphaFactorsSUN} + glGlobalAlphaFactoriSUN: procedure(factor: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGlobalAlphaFactoriSUN} + glGlobalAlphaFactorfSUN: procedure(factor: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGlobalAlphaFactorfSUN} + glGlobalAlphaFactordSUN: procedure(factor: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGlobalAlphaFactordSUN} + glGlobalAlphaFactorubSUN: procedure(factor: TGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGlobalAlphaFactorubSUN} + glGlobalAlphaFactorusSUN: procedure(factor: TGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGlobalAlphaFactorusSUN} + glGlobalAlphaFactoruiSUN: procedure(factor: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGlobalAlphaFactoruiSUN} + + // GL_SUN_triangle_list + glReplacementCodeuiSUN: procedure(code: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiSUN} + glReplacementCodeusSUN: procedure(code: TGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeusSUN} + glReplacementCodeubSUN: procedure(code: TGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeubSUN} + glReplacementCodeuivSUN: procedure(code: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuivSUN} + glReplacementCodeusvSUN: procedure(code: PGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeusvSUN} + glReplacementCodeubvSUN: procedure(code: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeubvSUN} + glReplacementCodePointerSUN: procedure(Atype: TGLenum; stride: TGLsizei; var p); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodePointerSUN} + + // GL_SUN_vertex + glColor4ubVertex2fSUN: procedure(r, g, b, a: TGLubyte; x, y: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4ubVertex2fSUN} + glColor4ubVertex2fvSUN: procedure(c: PGLubyte; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4ubVertex2fvSUN} + glColor4ubVertex3fSUN: procedure(r, g, b, a: TGLubyte; x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4ubVertex3fSUN} + glColor4ubVertex3fvSUN: procedure(c: PGLubyte; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4ubVertex3fvSUN} + glColor3fVertex3fSUN: procedure(r, g, b, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3fVertex3fSUN} + glColor3fVertex3fvSUN: procedure(c, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor3fVertex3fvSUN} + glNormal3fVertex3fSUN: procedure(nx, ny, nz: TGLfloat; x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3fVertex3fSUN} + glNormal3fVertex3fvSUN: procedure(n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormal3fVertex3fvSUN} + glColor4fNormal3fVertex3fSUN: procedure(r, g, b, a, nx, ny, nz, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4fNormal3fVertex3fSUN} + glColor4fNormal3fVertex3fvSUN: procedure(c, n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColor4fNormal3fVertex3fvSUN} + glTexCoord2fVertex3fSUN: procedure(s, t, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2fVertex3fSUN} + glTexCoord2fVertex3fvSUN: procedure(tc, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2fVertex3fvSUN} + glTexCoord4fVertex4fSUN: procedure(s, t, p, q, x, y, z, w: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4fVertex4fSUN} + glTexCoord4fVertex4fvSUN: procedure(tc, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4fVertex4fvSUN} + glTexCoord2fColor4ubVertex3fSUN: procedure(s, t, r, g, b, a, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2fColor4ubVertex3fSUN} + glTexCoord2fColor4ubVertex3fvSUN: procedure(tc: PGLfloat; c: PGLubyte; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2fColor4ubVertex3fvSUN} + glTexCoord2fColor3fVertex3fSUN: procedure(s, t, r, g, b, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2fColor3fVertex3fSUN} + glTexCoord2fColor3fVertex3fvSUN: procedure(tc, c, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2fColor3fVertex3fvSUN} + glTexCoord2fNormal3fVertex3fSUN: procedure(s, t, nx, ny, nz, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2fNormal3fVertex3fSUN} + glTexCoord2fNormal3fVertex3fvSUN: procedure(tc, n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2fNormal3fVertex3fvSUN} + glTexCoord2fColor4fNormal3fVertex3fSUN: procedure(s, t, r, g, b, a, nx, ny, nz, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2fColor4fNormal3fVertex3fSUN} + glTexCoord2fColor4fNormal3fVertex3fvSUN: procedure(tc, c, n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord2fColor4fNormal3fVertex3fvSUN} + glTexCoord4fColor4fNormal3fVertex4fSUN: procedure(s, t, p, q, r, g, b, a, nx, ny, nz, x, y, z, w: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4fColor4fNormal3fVertex4fSUN} + glTexCoord4fColor4fNormal3fVertex4fvSUN: procedure(tc, c, n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoord4fColor4fNormal3fVertex4fvSUN} + glReplacementCodeuiVertex3fSUN: procedure(rc: TGLenum; x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiVertex3fSUN} + glReplacementCodeuiVertex3fvSUN: procedure(rc: PGLenum; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiVertex3fvSUN} + glReplacementCodeuiColor4ubVertex3fSUN: procedure(rc: TGLenum; r, g, b, a: TGLubyte; x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiColor4ubVertex3fSUN} + glReplacementCodeuiColor4ubVertex3fvSUN: procedure(rc: PGLenum; c: PGLubyte; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiColor4ubVertex3fvSUN} + glReplacementCodeuiColor3fVertex3fSUN: procedure(rc: TGLenum; r, g, b, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiColor3fVertex3fSUN} + glReplacementCodeuiColor3fVertex3fvSUN: procedure(rc: PGLenum; c, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiColor3fVertex3fvSUN} + glReplacementCodeuiNormal3fVertex3fSUN: procedure(rc: TGLenum; nx, ny, nz, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiNormal3fVertex3fSUN} + glReplacementCodeuiNormal3fVertex3fvSUN: procedure(rc: PGLenum; n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiNormal3fVertex3fvSUN} + glReplacementCodeuiColor4fNormal3fVertex3fSUN: procedure(rc: TGLenum; r, g, b, a, nx, ny, nz, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiColor4fNormal3fVertex3fSUN} + glReplacementCodeuiColor4fNormal3fVertex3fvSUN: procedure(rc: PGLenum; c, n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiColor4fNormal3fVertex3fvSUN} + glReplacementCodeuiTexCoord2fVertex3fSUN: procedure(rc: TGLenum; s, t, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiTexCoord2fVertex3fSUN} + glReplacementCodeuiTexCoord2fVertex3fvSUN: procedure(rc: PGLenum; tc, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiTexCoord2fVertex3fvSUN} + glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN: procedure(rc: TGLenum; s, t, nx, ny, nz, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN} + glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN: procedure(rc: PGLenum; tc, n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN} + glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN: procedure(rc: TGLenum; s, t, r, g, b, a, nx, ny, nz, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN} + glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN: procedure(rc: PGLenum; tc, c, n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN} + + // GL_EXT_blend_func_separate + glBlendFuncSeparateEXT: procedure(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBlendFuncSeparateEXT} + + // GL_EXT_vertex_weighting + glVertexWeightfEXT: procedure(weight: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexWeightfEXT} + glVertexWeightfvEXT: procedure(weight: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexWeightfvEXT} + glVertexWeightPointerEXT: procedure(Size: TGLsizei; Atype: TGLenum; stride: TGLsizei; p: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexWeightPointerEXT} + + // GL_NV_vertex_array_range + glFlushVertexArrayRangeNV: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFlushVertexArrayRangeNV} + glVertexArrayRangeNV: procedure(Size: TGLsizei; p: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexArrayRangeNV} + wglAllocateMemoryNV: function(size: TGLsizei; readFrequency, writeFrequency, priority: Single): Pointer; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM wglAllocateMemoryNV} + wglFreeMemoryNV: procedure(ptr: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM wglFreeMemoryNV} + + // GL_NV_register_combiners + glCombinerParameterfvNV: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCombinerParameterfvNV} + glCombinerParameterfNV: procedure(pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCombinerParameterfNV} + glCombinerParameterivNV: procedure(pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCombinerParameterivNV} + glCombinerParameteriNV: procedure(pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCombinerParameteriNV} + glCombinerInputNV: procedure(stage, portion, variable, input, mapping, componentUsage: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCombinerInputNV} + glCombinerOutputNV: procedure(stage, portion, abOutput, cdOutput, sumOutput, scale, bias: TGLenum; abDotProduct, cdDotProduct, muxSum: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glCombinerOutputNV} + glFinalCombinerInputNV: procedure(variable, input, mapping, componentUsage: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFinalCombinerInputNV} + glGetCombinerInputParameterfvNV: procedure(stage, portion, variable, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetCombinerInputParameterfvNV} + glGetCombinerInputParameterivNV: procedure(stage, portion, variable, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetCombinerInputParameterivNV} + glGetCombinerOutputParameterfvNV: procedure(stage, portion, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetCombinerOutputParameterfvNV} + glGetCombinerOutputParameterivNV: procedure(stage, portion, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetCombinerOutputParameterivNV} + glGetFinalCombinerInputParameterfvNV: procedure(variable, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetFinalCombinerInputParameterfvNV} + glGetFinalCombinerInputParameterivNV: procedure(variable, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetFinalCombinerInputParameterivNV} + + // GL_MESA_resize_buffers + glResizeBuffersMESA: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glResizeBuffersMESA} + + // GL_MESA_window_pos + glWindowPos2dMESA: procedure(x, y: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos2dMESA} + glWindowPos2dvMESA: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos2dvMESA} + glWindowPos2fMESA: procedure(x, y: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos2fMESA} + glWindowPos2fvMESA: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos2fvMESA} + glWindowPos2iMESA: procedure(x, y: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos2iMESA} + glWindowPos2ivMESA: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos2ivMESA} + glWindowPos2sMESA: procedure(x, y: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos2sMESA} + glWindowPos2svMESA: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos2svMESA} + glWindowPos3dMESA: procedure(x, y, z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos3dMESA} + glWindowPos3dvMESA: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos3dvMESA} + glWindowPos3fMESA: procedure(x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos3fMESA} + glWindowPos3fvMESA: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos3fvMESA} + glWindowPos3iMESA: procedure(x, y, z: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos3iMESA} + glWindowPos3ivMESA: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos3ivMESA} + glWindowPos3sMESA: procedure(x, y, z: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos3sMESA} + glWindowPos3svMESA: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos3svMESA} + glWindowPos4dMESA: procedure(x, y, z, w: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos4dMESA} + glWindowPos4dvMESA: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos4dvMESA} + glWindowPos4fMESA: procedure(x, y, z, w: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos4fMESA} + glWindowPos4fvMESA: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos4fvMESA} + glWindowPos4iMESA: procedure(x, y, z, w: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos4iMESA} + glWindowPos4ivMESA: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos4ivMESA} + glWindowPos4sMESA: procedure(x, y, z, w: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos4sMESA} + glWindowPos4svMESA: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glWindowPos4svMESA} + + // GL_IBM_multimode_draw_arrays + glMultiModeDrawArraysIBM: procedure(mode: TGLenum; First: PGLint; Count: PGLsizei; primcount: TGLsizei; modestride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiModeDrawArraysIBM} + glMultiModeDrawElementsIBM: procedure(mode: PGLenum; Count: PGLsizei; Atype: TGLenum; var indices; primcount: TGLsizei; modestride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glMultiModeDrawElementsIBM} + + // GL_IBM_vertex_array_lists + glColorPointerListIBM: procedure(Size: TGLint; Atype: TGLenum; stride: TGLint; var p; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glColorPointerListIBM} + glSecondaryColorPointerListIBM: procedure(Size: TGLint; Atype: TGLenum; stride: TGLint; var p; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSecondaryColorPointerListIBM} + glEdgeFlagPointerListIBM: procedure(stride: TGLint; var p: PGLboolean; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glEdgeFlagPointerListIBM} + glFogCoordPointerListIBM: procedure(Atype: TGLenum; stride: TGLint; var p; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glFogCoordPointerListIBM} + glIndexPointerListIBM: procedure(Atype: TGLenum; stride: TGLint; var p; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIndexPointerListIBM} + glNormalPointerListIBM: procedure(Atype: TGLenum; stride: TGLint; var p; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glNormalPointerListIBM} + glTexCoordPointerListIBM: procedure(Size: TGLint; Atype: TGLenum; stride: TGLint; var p; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTexCoordPointerListIBM} + glVertexPointerListIBM: procedure(Size: TGLint; Atype: TGLenum; stride: TGLint; var p; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexPointerListIBM} + + // GL_3DFX_tbuffer + glTbufferMask3DFX: procedure(mask: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTbufferMask3DFX} + + // GL_EXT_multisample + glSampleMaskEXT: procedure(Value: TGLclampf; invert: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSampleMaskEXT} + glSamplePatternEXT: procedure(pattern: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glSamplePatternEXT} + + // GL_SGIS_texture_color_mask + glTextureColorMaskSGIS: procedure(red, green, blue, alpha: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTextureColorMaskSGIS} + + // GL_SGIX_igloo_interface + glIglooInterfaceSGIX: procedure(pname: TGLenum; params: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIglooInterfaceSGIX} + + // GL_NV_vertex_program + glAreProgramsResidentNV: procedure(n: TGLSizei; programs: PGLuint; residences: PGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glAreProgramsResidentNV} + glBindProgramNV: procedure(target: TGLenum; id: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glBindProgramNV} + glDeleteProgramsNV: procedure(n: TGLSizei; programs: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glDeleteProgramsNV} + glExecuteProgramNV: procedure(target: TGLenum; id: TGLuint; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glExecuteProgramNV} + glGenProgramsNV: procedure(n: TGLSizei; programs: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGenProgramsNV} + glGetProgramParameterdvNV: procedure (target: TGLenum; index: TGLuint; pname: TGLenum; params: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetProgramParameterdvNV} + glGetProgramParameterfvNV: procedure (target: TGLenum; index: TGLuint; pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetProgramParameterfvNV} + glGetProgramivNV: procedure (id: TGLuint; pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetProgramivNV} + glGetProgramStringNV: procedure (id: TGLuint; pname: TGLenum; programIdx: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetProgramStringNV} + glGetTrackMatrixivNV: procedure (target: TGLenum; address: TGLuint; pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetTrackMatrixivNV} + glGetVertexAttribdvNV: procedure (index: TGLuint; pname: TGLenum; params: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetVertexAttribdvNV} + glGetVertexAttribfvNV: procedure (index: TGLuint; pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetVertexAttribfvNV} + glGetVertexAttribivNV: procedure (index: TGLuint; pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetVertexAttribivNV} + glGetVertexAttribPointervNV: procedure (index: TGLuint; pname: TGLenum; pointer: PPointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glGetVertexAttribPointervNV} + glIsProgramNV: function (id: TGLuint): TGLboolean; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glIsProgramNV} + glLoadProgramNV: procedure (target: TGLenum; id: TGLuint; len: TGLSizei; programIdx: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glLoadProgramNV} + glProgramParameter4dNV: procedure (target: TGLenum; index: TGLuint; x, y, z, w: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glProgramParameter4dNV} + glProgramParameter4dvNV: procedure (target: TGLenum; index: TGLuint; v: PGLdouble ); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glProgramParameter4dvNV} + glProgramParameter4fNV: procedure (target: TGLenum; index: TGLuint; x, y, z, w: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glProgramParameter4fNV} + glProgramParameter4fvNV: procedure (target: TGLenum; index: TGLuint; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glProgramParameter4fvNV} + glProgramParameters4dvNV: procedure (target: TGLenum; index: TGLuint; count: TGLSizei; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glProgramParameters4dvNV} + glProgramParameters4fvNV: procedure (target: TGLenum; index: TGLuint; count: TGLSizei; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glProgramParameters4fvNV} + glRequestResidentProgramsNV: procedure (n: TGLSizei; programs: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glRequestResidentProgramsNV} + glTrackMatrixNV: procedure (target: TGLenum; address: TGLuint; matrix: TGLenum; transform: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glTrackMatrixNV} + glVertexAttribPointerNV: procedure (index: TGLuint; fsize: TGLint; vertextype: TGLenum; stride: TGLSizei; pointer: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribPointerNV} + glVertexAttrib1dNV: procedure (index: TGLuint; x: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib1dNV} + glVertexAttrib1dvNV: procedure (index: TGLuint; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib1dvNV} + glVertexAttrib1fNV: procedure (index: TGLuint; x: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib1fNV} + glVertexAttrib1fvNV: procedure (index: TGLuint; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib1fvNV} + glVertexAttrib1sNV: procedure (index: TGLuint; x: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib1sNV} + glVertexAttrib1svNV: procedure (index: TGLuint; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib1svNV} + glVertexAttrib2dNV: procedure (index: TGLuint; x: TGLdouble; y: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib2dNV} + glVertexAttrib2dvNV: procedure (index: TGLuint; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib2dvNV} + glVertexAttrib2fNV: procedure (index: TGLuint; x: TGLfloat; y: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib2fNV} + glVertexAttrib2fvNV: procedure (index: TGLuint; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib2fvNV} + glVertexAttrib2sNV: procedure (index: TGLuint; x: TGLshort; y: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib2sNV} + glVertexAttrib2svNV: procedure (index: TGLuint; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib2svNV} + glVertexAttrib3dNV: procedure (index: TGLuint; x: TGLdouble; y: TGLdouble; z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib3dNV} + glVertexAttrib3dvNV: procedure (index: TGLuint; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib3dvNV} + glVertexAttrib3fNV: procedure (index: TGLuint; x: TGLfloat; y: TGLfloat; z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib3fNV} + glVertexAttrib3fvNV: procedure (index: TGLuint; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib3fvNV} + glVertexAttrib3sNV: procedure (index: TGLuint; x: TGLshort; y: TGLshort; z: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib3sNV} + glVertexAttrib3svNV: procedure (index: TGLuint; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib3svNV} + glVertexAttrib4dNV: procedure (index: TGLuint; x: TGLdouble; y: TGLdouble; z: TGLdouble; w: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib4dNV} + glVertexAttrib4dvNV: procedure (index: TGLuint; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib4dvNV} + glVertexAttrib4fNV: procedure(index: TGLuint; x: TGLfloat; y: TGLfloat; z: TGLfloat; w: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib4fNV} + glVertexAttrib4fvNV: procedure(index: TGLuint; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib4fvNV} + glVertexAttrib4sNV: procedure (index: TGLuint; x: TGLshort; y: TGLshort; z: TGLdouble; w: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib4sNV} + glVertexAttrib4svNV: procedure (index: TGLuint; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib4svNV} + glVertexAttrib4ubvNV: procedure (index: TGLuint; v: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttrib4ubvNV} + glVertexAttribs1dvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs1dvNV} + glVertexAttribs1fvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs1fvNV} + glVertexAttribs1svNV: procedure (index: TGLuint; count: TGLSizei; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs1svNV} + glVertexAttribs2dvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs2dvNV} + glVertexAttribs2fvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs2fvNV} + glVertexAttribs2svNV: procedure (index: TGLuint; count: TGLSizei; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs2svNV} + glVertexAttribs3dvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs3dvNV} + glVertexAttribs3fvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs3fvNV} + glVertexAttribs3svNV: procedure (index: TGLuint; count: TGLSizei; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs3svNV} + glVertexAttribs4dvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs4dvNV} + glVertexAttribs4fvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs4fvNV} + glVertexAttribs4svNV: procedure (index: TGLuint; count: TGLSizei; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs4svNV} + glVertexAttribs4ubvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} + {$EXTERNALSYM glVertexAttribs4ubvNV} + +{$ifdef UNIX} +type + GLXContext = Pointer; + GLXPixmap = XID; + GLXDrawable = XID; + + // GLX 1.3 and later + GLXFBConfig = Pointer; + GLXFBConfigID = XID; + GLXContextID = XID; + GLXWindow = XID; + GLXPbuffer = XID; + +var + glXChooseVisual: function(dpy: PDisplay; screen: TGLint; attribList: PGLint): PXVisualInfo; cdecl; + {$EXTERNALSYM glXChooseVisual} + glXCreateContext: function(dpy: PDisplay; vis: PXVisualInfo; shareList: GLXContext; direct: TGLboolean): GLXContext; cdecl; + {$EXTERNALSYM glXCreateContext} + glXDestroyContext: procedure(dpy: PDisplay; ctx: GLXContext); cdecl; + {$EXTERNALSYM glXDestroyContext} + glXMakeCurrent: function(dpy: PDisplay; drawable: GLXDrawable; ctx: GLXContext): TGLboolean; cdecl; + {$EXTERNALSYM glXMakeCurrent} + glXCopyContext: procedure(dpy: PDisplay; src: GLXContext; dst: GLXContext; mask: TGLuint); cdecl; + {$EXTERNALSYM glXCopyContext} + glXSwapBuffers: procedure(dpy: PDisplay; drawable: GLXDrawable); cdecl; + {$EXTERNALSYM glXSwapBuffers} + glXCreateGLXPixmap: function(dpy: PDisplay; visual: PXVisualInfo; pixmap: Pixmap): GLXPixmap; cdecl; + {$EXTERNALSYM glXCreateGLXPixmap} + glXDestroyGLXPixmap: procedure(dpy: PDisplay; pixmap: GLXPixmap); cdecl; + {$EXTERNALSYM glXDestroyGLXPixmap} + glXQueryExtension: function(dpy: PDisplay; errorb: PGLInt; event: PGLInt): TGLboolean; cdecl; + {$EXTERNALSYM glXQueryExtension} + glXQueryVersion: function(dpy: PDisplay; maj: PGLInt; min: PGLINT): TGLboolean; cdecl; + {$EXTERNALSYM glXQueryVersion} + glXIsDirect: function(dpy: PDisplay; ctx: GLXContext): TGLboolean; cdecl; + {$EXTERNALSYM glXIsDirect} + glXGetConfig: function(dpy: PDisplay; visual: PXVisualInfo; attrib: TGLInt; value: PGLInt): TGLInt; cdecl; + {$EXTERNALSYM glXGetConfig} + glXGetCurrentContext: function: GLXContext; cdecl; + {$EXTERNALSYM glXGetCurrentContext} + glXGetCurrentDrawable: function: GLXDrawable; cdecl; + {$EXTERNALSYM glXGetCurrentDrawable} + glXWaitGL: procedure; cdecl; + {$EXTERNALSYM glXWaitGL} + glXWaitX: procedure; cdecl; + {$EXTERNALSYM glXWaitX} + glXUseXFont: procedure(font: Font; first: TGLInt; count: TGLInt; list: TGLint); cdecl; + {$EXTERNALSYM glXUseXFont} + + // GLX 1.1 and later + glXQueryExtensionsString: function(dpy: PDisplay; screen: TGLInt): PChar; cdecl; + {$EXTERNALSYM glXQueryExtensionsString} + glXQueryServerString: function(dpy: PDisplay; screen: TGLInt; name: TGLInt): PChar; cdecl; + {$EXTERNALSYM glXQueryServerString} + glXGetClientString: function(dpy: PDisplay; name: TGLInt): PChar; cdecl; + {$EXTERNALSYM glXGetClientString} + + // GLX 1.2 and later + glXGetCurrentDisplay: function: PDisplay; cdecl; + {$EXTERNALSYM glXGetCurrentDisplay} + + // GLX 1.3 and later + glXChooseFBConfig: function(dpy: PDisplay; screen: TGLInt; attribList: PGLInt; nitems: PGLInt): GLXFBConfig; cdecl; + {$EXTERNALSYM glXChooseFBConfig} + glXGetFBConfigAttrib: function(dpy: PDisplay; config: GLXFBConfig; attribute: TGLInt; value: PGLInt): TGLInt; cdecl; + {$EXTERNALSYM glXGetFBConfigAttrib} + glXGetFBConfigs: function(dpy: PDisplay; screen: TGLInt; nelements: PGLInt): GLXFBConfig; cdecl; + {$EXTERNALSYM glXGetFBConfigs} + glXGetVisualFromFBConfig: function(dpy: PDisplay; config: GLXFBConfig): PXVisualInfo; cdecl; + {$EXTERNALSYM glXGetVisualFromFBConfig} + glXCreateWindow: function(dpy: PDisplay; config: GLXFBConfig; win: Window; const attribList: PGLInt): GLXWindow; cdecl; + {$EXTERNALSYM glXCreateWindow} + glXDestroyWindow: procedure(dpy: PDisplay; window: GLXWindow); cdecl; + {$EXTERNALSYM glXDestroyWindow} + glXCreatePixmap: function(dpy: PDisplay; config: GLXFBConfig; pixmap: Pixmap; attribList: PGLInt): GLXPixmap; cdecl; + {$EXTERNALSYM glXCreatePixmap} + glXDestroyPixmap: procedure(dpy: PDisplay; pixmap: GLXPixmap); cdecl; + {$EXTERNALSYM glXDestroyPixmap} + glXCreatePbuffer: function(dpy: PDisplay; config: GLXFBConfig; attribList: PGLInt): GLXPBuffer; cdecl; + {$EXTERNALSYM glXCreatePbuffer} + glXDestroyPbuffer: procedure(dpy: PDisplay; pbuf: GLXPBuffer); cdecl; + {$EXTERNALSYM glXDestroyPbuffer} + glXQueryDrawable: procedure(dpy: PDisplay; draw: GLXDrawable; attribute: TGLInt; value: PGLuint); cdecl; + {$EXTERNALSYM glXQueryDrawable} + glXCreateNewContext: function(dpy: PDisplay; config: GLXFBConfig; renderType: TGLInt; shareList: GLXContext; direct: TGLboolean): GLXContext; cdecl; + {$EXTERNALSYM glXCreateNewContext} + glXMakeContextCurrent: function(dpy: PDisplay; draw: GLXDrawable; read: GLXDrawable; ctx: GLXContext): TGLboolean; cdecl; + {$EXTERNALSYM glXMakeContextCurrent} + glXGetCurrentReadDrawable: function: GLXDrawable; cdecl; + {$EXTERNALSYM glXGetCurrentReadDrawable} + glXQueryContext: function(dpy: PDisplay; ctx: GLXContext; attribute: TGLInt; value: PGLInt): TGLInt; cdecl; + {$EXTERNALSYM glXQueryContext} + glXSelectEvent: procedure(dpy: PDisplay; drawable: GLXDrawable; mask: TGLsizei); cdecl; + {$EXTERNALSYM glXSelectEvent} + glXGetSelectedEvent: procedure(dpy: PDisplay; drawable: GLXDrawable; mask: TGLsizei); cdecl; + {$EXTERNALSYM glXGetSelectedEvent} + glXGetVideoSyncSGI: function(count: PGLuint): TGLInt; cdecl; + {$EXTERNALSYM glXGetVideoSyncSGI} + glXWaitVideoSyncSGI: function(divisor: TGLInt; remainder: TGLInt; count: PGLuint): TGLInt; cdecl; + {$EXTERNALSYM glXWaitVideoSyncSGI} + glXFreeContextEXT: procedure(dpy: PDisplay; context: GLXContext); cdecl; + {$EXTERNALSYM glXFreeContextEXT} + glXGetContextIDEXT: function(const context: GLXContext): GLXContextID; cdecl; + {$EXTERNALSYM glXGetContextIDEXT} + glXGetCurrentDisplayEXT: function: PDisplay; cdecl; + {$EXTERNALSYM glXGetCurrentDisplayEXT} + glXImportContextEXT: function(dpy: PDisplay; contextID: GLXContextID): GLXContext; cdecl; + {$EXTERNALSYM glXImportContextEXT} + glXQueryContextInfoEXT: function(dpy: PDisplay; context: GLXContext; attribute: TGLInt; value: PGLInt): TGLInt; cdecl; + {$EXTERNALSYM glXQueryContextInfoEXT} + glXCopySubBufferMESA: procedure(dpy: PDisplay; drawable: GLXDrawable; x: TGLInt; y: TGLInt; width: TGLInt; height: TGLInt); cdecl; + {$EXTERNALSYM glXCopySubBufferMESA} + glXCreateGLXPixmapMESA: function(dpy: PDisplay; visual: PXVisualInfo; pixmap: Pixmap; cmap: Colormap): GLXPixmap; cdecl; + {$EXTERNALSYM glXCreateGLXPixmapMESA} + glXReleaseBuffersMESA: function(dpy: PDisplay; d: GLXDrawable): TGLboolean; cdecl; + {$EXTERNALSYM glXReleaseBuffersMESA} + glXSet3DfxModeMESA: function(mode: TGLint): TGLboolean; cdecl; + {$EXTERNALSYM glXSet3DfxModeMESA} +{$endif} + + +//---------------------------------------------------------------------------------------------------------------------- + +procedure CloseOpenGL; +function InitOpenGL: Boolean; +function InitOpenGLFromLibrary(GLName, GLUName: PChar): Boolean; +function IsOpenGLInitialized: Boolean; + +// Compatibility routines +procedure UnloadOpenGL; +function LoadOpenGL: Boolean; +function LoadOpenGLFromLibrary(GLName, GLUName: PChar): Boolean; +function IsOpenGLLoaded: Boolean; + +{$ifdef Win32} +procedure ActivateRenderingContext(DC: HDC; RC: HGLRC); +function CreateRenderingContext(DC: HDC; Options: TRCOptions; ColorBits, StencilBits, AccumBits, AuxBuffers: Integer; Layer: Integer; var Palette: HPALETTE): HGLRC; +function CurrentDC: HDC; +procedure DeactivateRenderingContext; +procedure DestroyRenderingContext(RC: HGLRC); +procedure ClearExtensions; +function HasActiveContext: Boolean; +procedure ReadExtensions; +procedure ReadImplementationProperties; +{$endif} + +//---------------------------------------------------------------------------------------------------------------------- + +implementation + +uses + SysUtils, + Classes, + sdl, + moduleloader; + +type + EOpenGLException = class(Exception); + +{$ifndef FPC} +threadvar +{$else} +var +{$endif} + LastPixelFormat: Integer; + ActivationRefCount: Integer; + +{$ifdef Win32} +const + INVALID_MODULEHANDLE = 0; + +var + GLHandle: TModuleHandle; + GLUHandle: TModuleHandle; +{$endif} + +{$ifdef UNIX} +const + INVALID_MODULEHANDLE = nil; + +var + GLHandle: TModuleHandle; + GLUHandle: TModuleHandle; +{$endif} + + // The context list is used to determine if a context is active already in any thread. + ContextList: TThreadList; + +resourcestring + SRCAlreadyActive = 'Rendering context already active in another thread.'; + SMakeCurrentFailed = 'wglMakeCurrent failed'; + SDeleteContextFailed = 'wglDeleteContext failed'; + SContextInUse = 'Cannot delete rendering context. It is still in use by another thread.'; + +{$ifdef Win32} + SDefaultGLLibrary = 'OpenGL32.dll'; + SDefaultGLULibrary = 'GLU32.dll'; +{$endif} + +{$ifdef UNIX} + SDefaultGLLibrary = 'libGL.so'; + SDefaultGLULibrary = 'libGLU.so'; +{$endif} + +//---------------------------------------------------------------------------------------------------------------------- + +procedure ShowError(const Message: string); + +begin + raise EOpenGLException.Create(Message); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +{$ifndef VER140} + +procedure RaiseLastOSError; +begin + {$ifndef FPC} + RaiseLastWin32Error; + {$endif} +end; + +{$endif VER140} + +//---------------------------------------------------------------------------------------------------------------------- + +procedure ClearProcAddresses; + +begin + glAccum := nil; + glAlphaFunc := nil; + glAreTexturesResident := nil; + glArrayElement := nil; + glBegin := nil; + glBindTexture := nil; + glBitmap := nil; + glBlendFunc := nil; + glCallList := nil; + glCallLists := nil; + glClear := nil; + glClearAccum := nil; + glClearColor := nil; + glClearDepth := nil; + glClearIndex := nil; + glClearStencil := nil; + glClipPlane := nil; + glColor3b := nil; + glColor3bv := nil; + glColor3d := nil; + glColor3dv := nil; + glColor3f := nil; + glColor3fv := nil; + glColor3i := nil; + glColor3iv := nil; + glColor3s := nil; + glColor3sv := nil; + glColor3ub := nil; + glColor3ubv := nil; + glColor3ui := nil; + glColor3uiv := nil; + glColor3us := nil; + glColor3usv := nil; + glColor4b := nil; + glColor4bv := nil; + glColor4d := nil; + glColor4dv := nil; + glColor4f := nil; + glColor4fv := nil; + glColor4i := nil; + glColor4iv := nil; + glColor4s := nil; + glColor4sv := nil; + glColor4ub := nil; + glColor4ubv := nil; + glColor4ui := nil; + glColor4uiv := nil; + glColor4us := nil; + glColor4usv := nil; + glColorMask := nil; + glColorMaterial := nil; + glColorPointer := nil; + glCopyPixels := nil; + glCopyTexImage1D := nil; + glCopyTexImage2D := nil; + glCopyTexSubImage1D := nil; + glCopyTexSubImage2D := nil; + glCullFace := nil; + glDeleteLists := nil; + glDeleteTextures := nil; + glDepthFunc := nil; + glDepthMask := nil; + glDepthRange := nil; + glDisable := nil; + glDisableClientState := nil; + glDrawArrays := nil; + glDrawBuffer := nil; + glDrawElements := nil; + glDrawPixels := nil; + glEdgeFlag := nil; + glEdgeFlagPointer := nil; + glEdgeFlagv := nil; + glEnable := nil; + glEnableClientState := nil; + glEnd := nil; + glEndList := nil; + glEvalCoord1d := nil; + glEvalCoord1dv := nil; + glEvalCoord1f := nil; + glEvalCoord1fv := nil; + glEvalCoord2d := nil; + glEvalCoord2dv := nil; + glEvalCoord2f := nil; + glEvalCoord2fv := nil; + glEvalMesh1 := nil; + glEvalMesh2 := nil; + glEvalPoint1 := nil; + glEvalPoint2 := nil; + glFeedbackBuffer := nil; + glFinish := nil; + glFlush := nil; + glFogf := nil; + glFogfv := nil; + glFogi := nil; + glFogiv := nil; + glFrontFace := nil; + glFrustum := nil; + glGenLists := nil; + glGenTextures := nil; + glGetBooleanv := nil; + glGetClipPlane := nil; + glGetDoublev := nil; + glGetError := nil; + glGetFloatv := nil; + glGetIntegerv := nil; + glGetLightfv := nil; + glGetLightiv := nil; + glGetMapdv := nil; + glGetMapfv := nil; + glGetMapiv := nil; + glGetMaterialfv := nil; + glGetMaterialiv := nil; + glGetPixelMapfv := nil; + glGetPixelMapuiv := nil; + glGetPixelMapusv := nil; + glGetPointerv := nil; + glGetPolygonStipple := nil; + glGetString := nil; + glGetTexEnvfv := nil; + glGetTexEnviv := nil; + glGetTexGendv := nil; + glGetTexGenfv := nil; + glGetTexGeniv := nil; + glGetTexImage := nil; + glGetTexLevelParameterfv := nil; + glGetTexLevelParameteriv := nil; + glGetTexParameterfv := nil; + glGetTexParameteriv := nil; + glHint := nil; + glIndexMask := nil; + glIndexPointer := nil; + glIndexd := nil; + glIndexdv := nil; + glIndexf := nil; + glIndexfv := nil; + glIndexi := nil; + glIndexiv := nil; + glIndexs := nil; + glIndexsv := nil; + glIndexub := nil; + glIndexubv := nil; + glInitNames := nil; + glInterleavedArrays := nil; + glIsEnabled := nil; + glIsList := nil; + glIsTexture := nil; + glLightModelf := nil; + glLightModelfv := nil; + glLightModeli := nil; + glLightModeliv := nil; + glLightf := nil; + glLightfv := nil; + glLighti := nil; + glLightiv := nil; + glLineStipple := nil; + glLineWidth := nil; + glListBase := nil; + glLoadIdentity := nil; + glLoadMatrixd := nil; + glLoadMatrixf := nil; + glLoadName := nil; + glLogicOp := nil; + glMap1d := nil; + glMap1f := nil; + glMap2d := nil; + glMap2f := nil; + glMapGrid1d := nil; + glMapGrid1f := nil; + glMapGrid2d := nil; + glMapGrid2f := nil; + glMaterialf := nil; + glMaterialfv := nil; + glMateriali := nil; + glMaterialiv := nil; + glMatrixMode := nil; + glMultMatrixd := nil; + glMultMatrixf := nil; + glNewList := nil; + glNormal3b := nil; + glNormal3bv := nil; + glNormal3d := nil; + glNormal3dv := nil; + glNormal3f := nil; + glNormal3fv := nil; + glNormal3i := nil; + glNormal3iv := nil; + glNormal3s := nil; + glNormal3sv := nil; + glNormalPointer := nil; + glOrtho := nil; + glPassThrough := nil; + glPixelMapfv := nil; + glPixelMapuiv := nil; + glPixelMapusv := nil; + glPixelStoref := nil; + glPixelStorei := nil; + glPixelTransferf := nil; + glPixelTransferi := nil; + glPixelZoom := nil; + glPointSize := nil; + glPolygonMode := nil; + glPolygonOffset := nil; + glPolygonStipple := nil; + glPopAttrib := nil; + glPopClientAttrib := nil; + glPopMatrix := nil; + glPopName := nil; + glPrioritizeTextures := nil; + glPushAttrib := nil; + glPushClientAttrib := nil; + glPushMatrix := nil; + glPushName := nil; + glRasterPos2d := nil; + glRasterPos2dv := nil; + glRasterPos2f := nil; + glRasterPos2fv := nil; + glRasterPos2i := nil; + glRasterPos2iv := nil; + glRasterPos2s := nil; + glRasterPos2sv := nil; + glRasterPos3d := nil; + glRasterPos3dv := nil; + glRasterPos3f := nil; + glRasterPos3fv := nil; + glRasterPos3i := nil; + glRasterPos3iv := nil; + glRasterPos3s := nil; + glRasterPos3sv := nil; + glRasterPos4d := nil; + glRasterPos4dv := nil; + glRasterPos4f := nil; + glRasterPos4fv := nil; + glRasterPos4i := nil; + glRasterPos4iv := nil; + glRasterPos4s := nil; + glRasterPos4sv := nil; + glReadBuffer := nil; + glReadPixels := nil; + glRectd := nil; + glRectdv := nil; + glRectf := nil; + glRectfv := nil; + glRecti := nil; + glRectiv := nil; + glRects := nil; + glRectsv := nil; + glRenderMode := nil; + glRotated := nil; + glRotatef := nil; + glScaled := nil; + glScalef := nil; + glScissor := nil; + glSelectBuffer := nil; + glShadeModel := nil; + glStencilFunc := nil; + glStencilMask := nil; + glStencilOp := nil; + glTexCoord1d := nil; + glTexCoord1dv := nil; + glTexCoord1f := nil; + glTexCoord1fv := nil; + glTexCoord1i := nil; + glTexCoord1iv := nil; + glTexCoord1s := nil; + glTexCoord1sv := nil; + glTexCoord2d := nil; + glTexCoord2dv := nil; + glTexCoord2f := nil; + glTexCoord2fv := nil; + glTexCoord2i := nil; + glTexCoord2iv := nil; + glTexCoord2s := nil; + glTexCoord2sv := nil; + glTexCoord3d := nil; + glTexCoord3dv := nil; + glTexCoord3f := nil; + glTexCoord3fv := nil; + glTexCoord3i := nil; + glTexCoord3iv := nil; + glTexCoord3s := nil; + glTexCoord3sv := nil; + glTexCoord4d := nil; + glTexCoord4dv := nil; + glTexCoord4f := nil; + glTexCoord4fv := nil; + glTexCoord4i := nil; + glTexCoord4iv := nil; + glTexCoord4s := nil; + glTexCoord4sv := nil; + glTexCoordPointer := nil; + glTexEnvf := nil; + glTexEnvfv := nil; + glTexEnvi := nil; + glTexEnviv := nil; + glTexGend := nil; + glTexGendv := nil; + glTexGenf := nil; + glTexGenfv := nil; + glTexGeni := nil; + glTexGeniv := nil; + glTexImage1D := nil; + glTexImage2D := nil; + glTexParameterf := nil; + glTexParameterfv := nil; + glTexParameteri := nil; + glTexParameteriv := nil; + glTexSubImage1D := nil; + glTexSubImage2D := nil; + glTranslated := nil; + glTranslatef := nil; + glVertex2d := nil; + glVertex2dv := nil; + glVertex2f := nil; + glVertex2fv := nil; + glVertex2i := nil; + glVertex2iv := nil; + glVertex2s := nil; + glVertex2sv := nil; + glVertex3d := nil; + glVertex3dv := nil; + glVertex3f := nil; + glVertex3fv := nil; + glVertex3i := nil; + glVertex3iv := nil; + glVertex3s := nil; + glVertex3sv := nil; + glVertex4d := nil; + glVertex4dv := nil; + glVertex4f := nil; + glVertex4fv := nil; + glVertex4i := nil; + glVertex4iv := nil; + glVertex4s := nil; + glVertex4sv := nil; + glVertexPointer := nil; + glViewport := nil; + + {$ifdef Win32} + wglGetProcAddress := nil; + wglCopyContext := nil; + wglCreateContext := nil; + wglCreateLayerContext := nil; + wglDeleteContext := nil; + wglDescribeLayerPlane := nil; + wglGetCurrentContext := nil; + wglGetCurrentDC := nil; + wglGetLayerPaletteEntries := nil; + wglMakeCurrent := nil; + wglRealizeLayerPalette := nil; + wglSetLayerPaletteEntries := nil; + wglShareLists := nil; + wglSwapLayerBuffers := nil; + wglSwapMultipleBuffers := nil; + wglUseFontBitmapsA := nil; + wglUseFontOutlinesA := nil; + wglUseFontBitmapsW := nil; + wglUseFontOutlinesW := nil; + wglUseFontBitmaps := nil; + wglUseFontOutlines := nil; + {$endif} + + // GL 1.2 + glDrawRangeElements := nil; + glTexImage3D := nil; + + // GL 1.2 ARB imaging + glBlendColor := nil; + glBlendEquation := nil; + glColorSubTable := nil; + glCopyColorSubTable := nil; + glColorTable := nil; + glCopyColorTable := nil; + glColorTableParameteriv := nil; + glColorTableParameterfv := nil; + glGetColorTable := nil; + glGetColorTableParameteriv := nil; + glGetColorTableParameterfv := nil; + glConvolutionFilter1D := nil; + glConvolutionFilter2D := nil; + glCopyConvolutionFilter1D := nil; + glCopyConvolutionFilter2D := nil; + glGetConvolutionFilter := nil; + glSeparableFilter2D := nil; + glGetSeparableFilter := nil; + glConvolutionParameteri := nil; + glConvolutionParameteriv := nil; + glConvolutionParameterf := nil; + glConvolutionParameterfv := nil; + glGetConvolutionParameteriv := nil; + glGetConvolutionParameterfv := nil; + glHistogram := nil; + glResetHistogram := nil; + glGetHistogram := nil; + glGetHistogramParameteriv := nil; + glGetHistogramParameterfv := nil; + glMinmax := nil; + glResetMinmax := nil; + glGetMinmax := nil; + glGetMinmaxParameteriv := nil; + glGetMinmaxParameterfv := nil; + + // GLX + {$ifdef UNIX} + glXChooseVisual := nil; + glXCreateContext := nil; + glXDestroyContext := nil; + glXMakeCurrent := nil; + glXCopyContext := nil; + glXSwapBuffers := nil; + glXCreateGLXPixmap := nil; + glXDestroyGLXPixmap := nil; + glXQueryExtension := nil; + glXQueryVersion := nil; + glXIsDirect := nil; + glXGetConfig := nil; + glXGetCurrentContext := nil; + glXGetCurrentDrawable := nil; + glXWaitGL := nil; + glXWaitX := nil; + glXUseXFont := nil; + + // GLX 1.1 and later + glXQueryExtensionsString := nil; + glXQueryServerString := nil; + glXGetClientString := nil; + + // GLX 1.2 and later + glXGetCurrentDisplay := nil; + + // GLX 1.3 and later + glXChooseFBConfig := nil; + glXGetFBConfigAttrib := nil; + glXGetFBConfigs := nil; + glXGetVisualFromFBConfig := nil; + glXCreateWindow := nil; + glXDestroyWindow := nil; + glXCreatePixmap := nil; + glXDestroyPixmap := nil; + glXCreatePbuffer := nil; + glXDestroyPbuffer := nil; + glXQueryDrawable := nil; + glXCreateNewContext := nil; + glXMakeContextCurrent := nil; + glXGetCurrentReadDrawable := nil; + glXQueryContext := nil; + glXSelectEvent := nil; + glXGetSelectedEvent := nil; + glXGetVideoSyncSGI := nil; + glXWaitVideoSyncSGI := nil; + glXFreeContextEXT := nil; + glXGetContextIDEXT := nil; + glXGetCurrentDisplayEXT := nil; + glXImportContextEXT := nil; + glXQueryContextInfoEXT := nil; + glXCopySubBufferMESA := nil; + glXCreateGLXPixmapMESA := nil; + glXReleaseBuffersMESA := nil; + glXSet3DfxModeMESA := nil; + {$endif} +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure LoadProcAddresses; +begin + if GLHandle <> INVALID_MODULEHANDLE then + begin + glAccum := GetModuleSymbol( GLHandle, 'glAccum'); + glAlphaFunc := GetModuleSymbol( GLHandle, 'glAlphaFunc'); + glAreTexturesResident := GetModuleSymbol( GLHandle, 'glAreTexturesResident'); + glArrayElement := GetModuleSymbol( GLHandle, 'glArrayElement'); + glBegin := GetModuleSymbol( GLHandle, 'glBegin'); + glBindTexture := GetModuleSymbol( GLHandle, 'glBindTexture'); + glBitmap := GetModuleSymbol( GLHandle, 'glBitmap'); + glBlendFunc := GetModuleSymbol( GLHandle, 'glBlendFunc'); + glCallList := GetModuleSymbol( GLHandle, 'glCallList'); + glCallLists := GetModuleSymbol( GLHandle, 'glCallLists'); + glClear := GetModuleSymbol( GLHandle, 'glClear'); + glClearAccum := GetModuleSymbol( GLHandle, 'glClearAccum'); + glClearColor := GetModuleSymbol( GLHandle, 'glClearColor'); + glClearDepth := GetModuleSymbol( GLHandle, 'glClearDepth'); + glClearIndex := GetModuleSymbol( GLHandle, 'glClearIndex'); + glClearStencil := GetModuleSymbol( GLHandle, 'glClearStencil'); + glClipPlane := GetModuleSymbol( GLHandle, 'glClipPlane'); + glColor3b := GetModuleSymbol( GLHandle, 'glColor3b'); + glColor3bv := GetModuleSymbol( GLHandle, 'glColor3bv'); + glColor3d := GetModuleSymbol( GLHandle, 'glColor3d'); + glColor3dv := GetModuleSymbol( GLHandle, 'glColor3dv'); + glColor3f := GetModuleSymbol( GLHandle, 'glColor3f'); + glColor3fv := GetModuleSymbol( GLHandle, 'glColor3fv'); + glColor3i := GetModuleSymbol( GLHandle, 'glColor3i'); + glColor3iv := GetModuleSymbol( GLHandle, 'glColor3iv'); + glColor3s := GetModuleSymbol( GLHandle, 'glColor3s'); + glColor3sv := GetModuleSymbol( GLHandle, 'glColor3sv'); + glColor3ub := GetModuleSymbol( GLHandle, 'glColor3ub'); + glColor3ubv := GetModuleSymbol( GLHandle, 'glColor3ubv'); + glColor3ui := GetModuleSymbol( GLHandle, 'glColor3ui'); + glColor3uiv := GetModuleSymbol( GLHandle, 'glColor3uiv'); + glColor3us := GetModuleSymbol( GLHandle, 'glColor3us'); + glColor3usv := GetModuleSymbol( GLHandle, 'glColor3usv'); + glColor4b := GetModuleSymbol( GLHandle, 'glColor4b'); + glColor4bv := GetModuleSymbol( GLHandle, 'glColor4bv'); + glColor4d := GetModuleSymbol( GLHandle, 'glColor4d'); + glColor4dv := GetModuleSymbol( GLHandle, 'glColor4dv'); + glColor4f := GetModuleSymbol( GLHandle, 'glColor4f'); + glColor4fv := GetModuleSymbol( GLHandle, 'glColor4fv'); + glColor4i := GetModuleSymbol( GLHandle, 'glColor4i'); + glColor4iv := GetModuleSymbol( GLHandle, 'glColor4iv'); + glColor4s := GetModuleSymbol( GLHandle, 'glColor4s'); + glColor4sv := GetModuleSymbol( GLHandle, 'glColor4sv'); + glColor4ub := GetModuleSymbol( GLHandle, 'glColor4ub'); + glColor4ubv := GetModuleSymbol( GLHandle, 'glColor4ubv'); + glColor4ui := GetModuleSymbol( GLHandle, 'glColor4ui'); + glColor4uiv := GetModuleSymbol( GLHandle, 'glColor4uiv'); + glColor4us := GetModuleSymbol( GLHandle, 'glColor4us'); + glColor4usv := GetModuleSymbol( GLHandle, 'glColor4usv'); + glColorMask := GetModuleSymbol( GLHandle, 'glColorMask'); + glColorMaterial := GetModuleSymbol( GLHandle, 'glColorMaterial'); + glColorPointer := GetModuleSymbol( GLHandle, 'glColorPointer'); + glCopyPixels := GetModuleSymbol( GLHandle, 'glCopyPixels'); + glCopyTexImage1D := GetModuleSymbol( GLHandle, 'glCopyTexImage1D'); + glCopyTexImage2D := GetModuleSymbol( GLHandle, 'glCopyTexImage2D'); + glCopyTexSubImage1D := GetModuleSymbol( GLHandle, 'glCopyTexSubImage1D'); + glCopyTexSubImage2D := GetModuleSymbol( GLHandle, 'glCopyTexSubImage2D'); + glCullFace := GetModuleSymbol( GLHandle, 'glCullFace'); + glDeleteLists := GetModuleSymbol( GLHandle, 'glDeleteLists'); + glDeleteTextures := GetModuleSymbol( GLHandle, 'glDeleteTextures'); + glDepthFunc := GetModuleSymbol( GLHandle, 'glDepthFunc'); + glDepthMask := GetModuleSymbol( GLHandle, 'glDepthMask'); + glDepthRange := GetModuleSymbol( GLHandle, 'glDepthRange'); + glDisable := GetModuleSymbol( GLHandle, 'glDisable'); + glDisableClientState := GetModuleSymbol( GLHandle, 'glDisableClientState'); + glDrawArrays := GetModuleSymbol( GLHandle, 'glDrawArrays'); + glDrawBuffer := GetModuleSymbol( GLHandle, 'glDrawBuffer'); + glDrawElements := GetModuleSymbol( GLHandle, 'glDrawElements'); + glDrawPixels := GetModuleSymbol( GLHandle, 'glDrawPixels'); + glEdgeFlag := GetModuleSymbol( GLHandle, 'glEdgeFlag'); + glEdgeFlagPointer := GetModuleSymbol( GLHandle, 'glEdgeFlagPointer'); + glEdgeFlagv := GetModuleSymbol( GLHandle, 'glEdgeFlagv'); + glEnable := GetModuleSymbol( GLHandle, 'glEnable'); + glEnableClientState := GetModuleSymbol( GLHandle, 'glEnableClientState'); + glEnd := GetModuleSymbol( GLHandle, 'glEnd'); + glEndList := GetModuleSymbol( GLHandle, 'glEndList'); + glEvalCoord1d := GetModuleSymbol( GLHandle, 'glEvalCoord1d'); + glEvalCoord1dv := GetModuleSymbol( GLHandle, 'glEvalCoord1dv'); + glEvalCoord1f := GetModuleSymbol( GLHandle, 'glEvalCoord1f'); + glEvalCoord1fv := GetModuleSymbol( GLHandle, 'glEvalCoord1fv'); + glEvalCoord2d := GetModuleSymbol( GLHandle, 'glEvalCoord2d'); + glEvalCoord2dv := GetModuleSymbol( GLHandle, 'glEvalCoord2dv'); + glEvalCoord2f := GetModuleSymbol( GLHandle, 'glEvalCoord2f'); + glEvalCoord2fv := GetModuleSymbol( GLHandle, 'glEvalCoord2fv'); + glEvalMesh1 := GetModuleSymbol( GLHandle, 'glEvalMesh1'); + glEvalMesh2 := GetModuleSymbol( GLHandle, 'glEvalMesh2'); + glEvalPoint1 := GetModuleSymbol( GLHandle, 'glEvalPoint1'); + glEvalPoint2 := GetModuleSymbol( GLHandle, 'glEvalPoint2'); + glFeedbackBuffer := GetModuleSymbol( GLHandle, 'glFeedbackBuffer'); + glFinish := GetModuleSymbol( GLHandle, 'glFinish'); + glFlush := GetModuleSymbol( GLHandle, 'glFlush'); + glFogf := GetModuleSymbol( GLHandle, 'glFogf'); + glFogfv := GetModuleSymbol( GLHandle, 'glFogfv'); + glFogi := GetModuleSymbol( GLHandle, 'glFogi'); + glFogiv := GetModuleSymbol( GLHandle, 'glFogiv'); + glFrontFace := GetModuleSymbol( GLHandle, 'glFrontFace'); + glFrustum := GetModuleSymbol( GLHandle, 'glFrustum'); + glGenLists := GetModuleSymbol( GLHandle, 'glGenLists'); + glGenTextures := GetModuleSymbol( GLHandle, 'glGenTextures'); + glGetBooleanv := GetModuleSymbol( GLHandle, 'glGetBooleanv'); + glGetClipPlane := GetModuleSymbol( GLHandle, 'glGetClipPlane'); + glGetDoublev := GetModuleSymbol( GLHandle, 'glGetDoublev'); + glGetError := GetModuleSymbol( GLHandle, 'glGetError'); + glGetFloatv := GetModuleSymbol( GLHandle, 'glGetFloatv'); + glGetIntegerv := GetModuleSymbol( GLHandle, 'glGetIntegerv'); + glGetLightfv := GetModuleSymbol( GLHandle, 'glGetLightfv'); + glGetLightiv := GetModuleSymbol( GLHandle, 'glGetLightiv'); + glGetMapdv := GetModuleSymbol( GLHandle, 'glGetMapdv'); + glGetMapfv := GetModuleSymbol( GLHandle, 'glGetMapfv'); + glGetMapiv := GetModuleSymbol( GLHandle, 'glGetMapiv'); + glGetMaterialfv := GetModuleSymbol( GLHandle, 'glGetMaterialfv'); + glGetMaterialiv := GetModuleSymbol( GLHandle, 'glGetMaterialiv'); + glGetPixelMapfv := GetModuleSymbol( GLHandle, 'glGetPixelMapfv'); + glGetPixelMapuiv := GetModuleSymbol( GLHandle, 'glGetPixelMapuiv'); + glGetPixelMapusv := GetModuleSymbol( GLHandle, 'glGetPixelMapusv'); + glGetPointerv := GetModuleSymbol( GLHandle, 'glGetPointerv'); + glGetPolygonStipple := GetModuleSymbol( GLHandle, 'glGetPolygonStipple'); + glGetString := GetModuleSymbol( GLHandle, 'glGetString'); + glGetTexEnvfv := GetModuleSymbol( GLHandle, 'glGetTexEnvfv'); + glGetTexEnviv := GetModuleSymbol( GLHandle, 'glGetTexEnviv'); + glGetTexGendv := GetModuleSymbol( GLHandle, 'glGetTexGendv'); + glGetTexGenfv := GetModuleSymbol( GLHandle, 'glGetTexGenfv'); + glGetTexGeniv := GetModuleSymbol( GLHandle, 'glGetTexGeniv'); + glGetTexImage := GetModuleSymbol( GLHandle, 'glGetTexImage'); + glGetTexLevelParameterfv := GetModuleSymbol( GLHandle, 'glGetTexLevelParameterfv'); + glGetTexLevelParameteriv := GetModuleSymbol( GLHandle, 'glGetTexLevelParameteriv'); + glGetTexParameterfv := GetModuleSymbol( GLHandle, 'glGetTexParameterfv'); + glGetTexParameteriv := GetModuleSymbol( GLHandle, 'glGetTexParameteriv'); + glHint := GetModuleSymbol( GLHandle, 'glHint'); + glIndexMask := GetModuleSymbol( GLHandle, 'glIndexMask'); + glIndexPointer := GetModuleSymbol( GLHandle, 'glIndexPointer'); + glIndexd := GetModuleSymbol( GLHandle, 'glIndexd'); + glIndexdv := GetModuleSymbol( GLHandle, 'glIndexdv'); + glIndexf := GetModuleSymbol( GLHandle, 'glIndexf'); + glIndexfv := GetModuleSymbol( GLHandle, 'glIndexfv'); + glIndexi := GetModuleSymbol( GLHandle, 'glIndexi'); + glIndexiv := GetModuleSymbol( GLHandle, 'glIndexiv'); + glIndexs := GetModuleSymbol( GLHandle, 'glIndexs'); + glIndexsv := GetModuleSymbol( GLHandle, 'glIndexsv'); + glIndexub := GetModuleSymbol( GLHandle, 'glIndexub'); + glIndexubv := GetModuleSymbol( GLHandle, 'glIndexubv'); + glInitNames := GetModuleSymbol( GLHandle, 'glInitNames'); + glInterleavedArrays := GetModuleSymbol( GLHandle, 'glInterleavedArrays'); + glIsEnabled := GetModuleSymbol( GLHandle, 'glIsEnabled'); + glIsList := GetModuleSymbol( GLHandle, 'glIsList'); + glIsTexture := GetModuleSymbol( GLHandle, 'glIsTexture'); + glLightModelf := GetModuleSymbol( GLHandle, 'glLightModelf'); + glLightModelfv := GetModuleSymbol( GLHandle, 'glLightModelfv'); + glLightModeli := GetModuleSymbol( GLHandle, 'glLightModeli'); + glLightModeliv := GetModuleSymbol( GLHandle, 'glLightModeliv'); + glLightf := GetModuleSymbol( GLHandle, 'glLightf'); + glLightfv := GetModuleSymbol( GLHandle, 'glLightfv'); + glLighti := GetModuleSymbol( GLHandle, 'glLighti'); + glLightiv := GetModuleSymbol( GLHandle, 'glLightiv'); + glLineStipple := GetModuleSymbol( GLHandle, 'glLineStipple'); + glLineWidth := GetModuleSymbol( GLHandle, 'glLineWidth'); + glListBase := GetModuleSymbol( GLHandle, 'glListBase'); + glLoadIdentity := GetModuleSymbol( GLHandle, 'glLoadIdentity'); + glLoadMatrixd := GetModuleSymbol( GLHandle, 'glLoadMatrixd'); + glLoadMatrixf := GetModuleSymbol( GLHandle, 'glLoadMatrixf'); + glLoadName := GetModuleSymbol( GLHandle, 'glLoadName'); + glLogicOp := GetModuleSymbol( GLHandle, 'glLogicOp'); + glMap1d := GetModuleSymbol( GLHandle, 'glMap1d'); + glMap1f := GetModuleSymbol( GLHandle, 'glMap1f'); + glMap2d := GetModuleSymbol( GLHandle, 'glMap2d'); + glMap2f := GetModuleSymbol( GLHandle, 'glMap2f'); + glMapGrid1d := GetModuleSymbol( GLHandle, 'glMapGrid1d'); + glMapGrid1f := GetModuleSymbol( GLHandle, 'glMapGrid1f'); + glMapGrid2d := GetModuleSymbol( GLHandle, 'glMapGrid2d'); + glMapGrid2f := GetModuleSymbol( GLHandle, 'glMapGrid2f'); + glMaterialf := GetModuleSymbol( GLHandle, 'glMaterialf'); + glMaterialfv := GetModuleSymbol( GLHandle, 'glMaterialfv'); + glMateriali := GetModuleSymbol( GLHandle, 'glMateriali'); + glMaterialiv := GetModuleSymbol( GLHandle, 'glMaterialiv'); + glMatrixMode := GetModuleSymbol( GLHandle, 'glMatrixMode'); + glMultMatrixd := GetModuleSymbol( GLHandle, 'glMultMatrixd'); + glMultMatrixf := GetModuleSymbol( GLHandle, 'glMultMatrixf'); + glNewList := GetModuleSymbol( GLHandle, 'glNewList'); + glNormal3b := GetModuleSymbol( GLHandle, 'glNormal3b'); + glNormal3bv := GetModuleSymbol( GLHandle, 'glNormal3bv'); + glNormal3d := GetModuleSymbol( GLHandle, 'glNormal3d'); + glNormal3dv := GetModuleSymbol( GLHandle, 'glNormal3dv'); + glNormal3f := GetModuleSymbol( GLHandle, 'glNormal3f'); + glNormal3fv := GetModuleSymbol( GLHandle, 'glNormal3fv'); + glNormal3i := GetModuleSymbol( GLHandle, 'glNormal3i'); + glNormal3iv := GetModuleSymbol( GLHandle, 'glNormal3iv'); + glNormal3s := GetModuleSymbol( GLHandle, 'glNormal3s'); + glNormal3sv := GetModuleSymbol( GLHandle, 'glNormal3sv'); + glNormalPointer := GetModuleSymbol( GLHandle, 'glNormalPointer'); + glOrtho := GetModuleSymbol( GLHandle, 'glOrtho'); + glPassThrough := GetModuleSymbol( GLHandle, 'glPassThrough'); + glPixelMapfv := GetModuleSymbol( GLHandle, 'glPixelMapfv'); + glPixelMapuiv := GetModuleSymbol( GLHandle, 'glPixelMapuiv'); + glPixelMapusv := GetModuleSymbol( GLHandle, 'glPixelMapusv'); + glPixelStoref := GetModuleSymbol( GLHandle, 'glPixelStoref'); + glPixelStorei := GetModuleSymbol( GLHandle, 'glPixelStorei'); + glPixelTransferf := GetModuleSymbol( GLHandle, 'glPixelTransferf'); + glPixelTransferi := GetModuleSymbol( GLHandle, 'glPixelTransferi'); + glPixelZoom := GetModuleSymbol( GLHandle, 'glPixelZoom'); + glPointSize := GetModuleSymbol( GLHandle, 'glPointSize'); + glPolygonMode := GetModuleSymbol( GLHandle, 'glPolygonMode'); + glPolygonOffset := GetModuleSymbol( GLHandle, 'glPolygonOffset'); + glPolygonStipple := GetModuleSymbol( GLHandle, 'glPolygonStipple'); + glPopAttrib := GetModuleSymbol( GLHandle, 'glPopAttrib'); + glPopClientAttrib := GetModuleSymbol( GLHandle, 'glPopClientAttrib'); + glPopMatrix := GetModuleSymbol( GLHandle, 'glPopMatrix'); + glPopName := GetModuleSymbol( GLHandle, 'glPopName'); + glPrioritizeTextures := GetModuleSymbol( GLHandle, 'glPrioritizeTextures'); + glPushAttrib := GetModuleSymbol( GLHandle, 'glPushAttrib'); + glPushClientAttrib := GetModuleSymbol( GLHandle, 'glPushClientAttrib'); + glPushMatrix := GetModuleSymbol( GLHandle, 'glPushMatrix'); + glPushName := GetModuleSymbol( GLHandle, 'glPushName'); + glRasterPos2d := GetModuleSymbol( GLHandle, 'glRasterPos2d'); + glRasterPos2dv := GetModuleSymbol( GLHandle, 'glRasterPos2dv'); + glRasterPos2f := GetModuleSymbol( GLHandle, 'glRasterPos2f'); + glRasterPos2fv := GetModuleSymbol( GLHandle, 'glRasterPos2fv'); + glRasterPos2i := GetModuleSymbol( GLHandle, 'glRasterPos2i'); + glRasterPos2iv := GetModuleSymbol( GLHandle, 'glRasterPos2iv'); + glRasterPos2s := GetModuleSymbol( GLHandle, 'glRasterPos2s'); + glRasterPos2sv := GetModuleSymbol( GLHandle, 'glRasterPos2sv'); + glRasterPos3d := GetModuleSymbol( GLHandle, 'glRasterPos3d'); + glRasterPos3dv := GetModuleSymbol( GLHandle, 'glRasterPos3dv'); + glRasterPos3f := GetModuleSymbol( GLHandle, 'glRasterPos3f'); + glRasterPos3fv := GetModuleSymbol( GLHandle, 'glRasterPos3fv'); + glRasterPos3i := GetModuleSymbol( GLHandle, 'glRasterPos3i'); + glRasterPos3iv := GetModuleSymbol( GLHandle, 'glRasterPos3iv'); + glRasterPos3s := GetModuleSymbol( GLHandle, 'glRasterPos3s'); + glRasterPos3sv := GetModuleSymbol( GLHandle, 'glRasterPos3sv'); + glRasterPos4d := GetModuleSymbol( GLHandle, 'glRasterPos4d'); + glRasterPos4dv := GetModuleSymbol( GLHandle, 'glRasterPos4dv'); + glRasterPos4f := GetModuleSymbol( GLHandle, 'glRasterPos4f'); + glRasterPos4fv := GetModuleSymbol( GLHandle, 'glRasterPos4fv'); + glRasterPos4i := GetModuleSymbol( GLHandle, 'glRasterPos4i'); + glRasterPos4iv := GetModuleSymbol( GLHandle, 'glRasterPos4iv'); + glRasterPos4s := GetModuleSymbol( GLHandle, 'glRasterPos4s'); + glRasterPos4sv := GetModuleSymbol( GLHandle, 'glRasterPos4sv'); + glReadBuffer := GetModuleSymbol( GLHandle, 'glReadBuffer'); + glReadPixels := GetModuleSymbol( GLHandle, 'glReadPixels'); + glRectd := GetModuleSymbol( GLHandle, 'glRectd'); + glRectdv := GetModuleSymbol( GLHandle, 'glRectdv'); + glRectf := GetModuleSymbol( GLHandle, 'glRectf'); + glRectfv := GetModuleSymbol( GLHandle, 'glRectfv'); + glRecti := GetModuleSymbol( GLHandle, 'glRecti'); + glRectiv := GetModuleSymbol( GLHandle, 'glRectiv'); + glRects := GetModuleSymbol( GLHandle, 'glRects'); + glRectsv := GetModuleSymbol( GLHandle, 'glRectsv'); + glRenderMode := GetModuleSymbol( GLHandle, 'glRenderMode'); + glRotated := GetModuleSymbol( GLHandle, 'glRotated'); + glRotatef := GetModuleSymbol( GLHandle, 'glRotatef'); + glScaled := GetModuleSymbol( GLHandle, 'glScaled'); + glScalef := GetModuleSymbol( GLHandle, 'glScalef'); + glScissor := GetModuleSymbol( GLHandle, 'glScissor'); + glSelectBuffer := GetModuleSymbol( GLHandle, 'glSelectBuffer'); + glShadeModel := GetModuleSymbol( GLHandle, 'glShadeModel'); + glStencilFunc := GetModuleSymbol( GLHandle, 'glStencilFunc'); + glStencilMask := GetModuleSymbol( GLHandle, 'glStencilMask'); + glStencilOp := GetModuleSymbol( GLHandle, 'glStencilOp'); + glTexCoord1d := GetModuleSymbol( GLHandle, 'glTexCoord1d'); + glTexCoord1dv := GetModuleSymbol( GLHandle, 'glTexCoord1dv'); + glTexCoord1f := GetModuleSymbol( GLHandle, 'glTexCoord1f'); + glTexCoord1fv := GetModuleSymbol( GLHandle, 'glTexCoord1fv'); + glTexCoord1i := GetModuleSymbol( GLHandle, 'glTexCoord1i'); + glTexCoord1iv := GetModuleSymbol( GLHandle, 'glTexCoord1iv'); + glTexCoord1s := GetModuleSymbol( GLHandle, 'glTexCoord1s'); + glTexCoord1sv := GetModuleSymbol( GLHandle, 'glTexCoord1sv'); + glTexCoord2d := GetModuleSymbol( GLHandle, 'glTexCoord2d'); + glTexCoord2dv := GetModuleSymbol( GLHandle, 'glTexCoord2dv'); + glTexCoord2f := GetModuleSymbol( GLHandle, 'glTexCoord2f'); + glTexCoord2fv := GetModuleSymbol( GLHandle, 'glTexCoord2fv'); + glTexCoord2i := GetModuleSymbol( GLHandle, 'glTexCoord2i'); + glTexCoord2iv := GetModuleSymbol( GLHandle, 'glTexCoord2iv'); + glTexCoord2s := GetModuleSymbol( GLHandle, 'glTexCoord2s'); + glTexCoord2sv := GetModuleSymbol( GLHandle, 'glTexCoord2sv'); + glTexCoord3d := GetModuleSymbol( GLHandle, 'glTexCoord3d'); + glTexCoord3dv := GetModuleSymbol( GLHandle, 'glTexCoord3dv'); + glTexCoord3f := GetModuleSymbol( GLHandle, 'glTexCoord3f'); + glTexCoord3fv := GetModuleSymbol( GLHandle, 'glTexCoord3fv'); + glTexCoord3i := GetModuleSymbol( GLHandle, 'glTexCoord3i'); + glTexCoord3iv := GetModuleSymbol( GLHandle, 'glTexCoord3iv'); + glTexCoord3s := GetModuleSymbol( GLHandle, 'glTexCoord3s'); + glTexCoord3sv := GetModuleSymbol( GLHandle, 'glTexCoord3sv'); + glTexCoord4d := GetModuleSymbol( GLHandle, 'glTexCoord4d'); + glTexCoord4dv := GetModuleSymbol( GLHandle, 'glTexCoord4dv'); + glTexCoord4f := GetModuleSymbol( GLHandle, 'glTexCoord4f'); + glTexCoord4fv := GetModuleSymbol( GLHandle, 'glTexCoord4fv'); + glTexCoord4i := GetModuleSymbol( GLHandle, 'glTexCoord4i'); + glTexCoord4iv := GetModuleSymbol( GLHandle, 'glTexCoord4iv'); + glTexCoord4s := GetModuleSymbol( GLHandle, 'glTexCoord4s'); + glTexCoord4sv := GetModuleSymbol( GLHandle, 'glTexCoord4sv'); + glTexCoordPointer := GetModuleSymbol( GLHandle, 'glTexCoordPointer'); + glTexEnvf := GetModuleSymbol( GLHandle, 'glTexEnvf'); + glTexEnvfv := GetModuleSymbol( GLHandle, 'glTexEnvfv'); + glTexEnvi := GetModuleSymbol( GLHandle, 'glTexEnvi'); + glTexEnviv := GetModuleSymbol( GLHandle, 'glTexEnviv'); + glTexGend := GetModuleSymbol( GLHandle, 'glTexGend'); + glTexGendv := GetModuleSymbol( GLHandle, 'glTexGendv'); + glTexGenf := GetModuleSymbol( GLHandle, 'glTexGenf'); + glTexGenfv := GetModuleSymbol( GLHandle, 'glTexGenfv'); + glTexGeni := GetModuleSymbol( GLHandle, 'glTexGeni'); + glTexGeniv := GetModuleSymbol( GLHandle, 'glTexGeniv'); + glTexImage1D := GetModuleSymbol( GLHandle, 'glTexImage1D'); + glTexImage2D := GetModuleSymbol( GLHandle, 'glTexImage2D'); + glTexParameterf := GetModuleSymbol( GLHandle, 'glTexParameterf'); + glTexParameterfv := GetModuleSymbol( GLHandle, 'glTexParameterfv'); + glTexParameteri := GetModuleSymbol( GLHandle, 'glTexParameteri'); + glTexParameteriv := GetModuleSymbol( GLHandle, 'glTexParameteriv'); + glTexSubImage1D := GetModuleSymbol( GLHandle, 'glTexSubImage1D'); + glTexSubImage2D := GetModuleSymbol( GLHandle, 'glTexSubImage2D'); + glTranslated := GetModuleSymbol( GLHandle, 'glTranslated'); + glTranslatef := GetModuleSymbol( GLHandle, 'glTranslatef'); + glVertex2d := GetModuleSymbol( GLHandle, 'glVertex2d'); + glVertex2dv := GetModuleSymbol( GLHandle, 'glVertex2dv'); + glVertex2f := GetModuleSymbol( GLHandle, 'glVertex2f'); + glVertex2fv := GetModuleSymbol( GLHandle, 'glVertex2fv'); + glVertex2i := GetModuleSymbol( GLHandle, 'glVertex2i'); + glVertex2iv := GetModuleSymbol( GLHandle, 'glVertex2iv'); + glVertex2s := GetModuleSymbol( GLHandle, 'glVertex2s'); + glVertex2sv := GetModuleSymbol( GLHandle, 'glVertex2sv'); + glVertex3d := GetModuleSymbol( GLHandle, 'glVertex3d'); + glVertex3dv := GetModuleSymbol( GLHandle, 'glVertex3dv'); + glVertex3f := GetModuleSymbol( GLHandle, 'glVertex3f'); + glVertex3fv := GetModuleSymbol( GLHandle, 'glVertex3fv'); + glVertex3i := GetModuleSymbol( GLHandle, 'glVertex3i'); + glVertex3iv := GetModuleSymbol( GLHandle, 'glVertex3iv'); + glVertex3s := GetModuleSymbol( GLHandle, 'glVertex3s'); + glVertex3sv := GetModuleSymbol( GLHandle, 'glVertex3sv'); + glVertex4d := GetModuleSymbol( GLHandle, 'glVertex4d'); + glVertex4dv := GetModuleSymbol( GLHandle, 'glVertex4dv'); + glVertex4f := GetModuleSymbol( GLHandle, 'glVertex4f'); + glVertex4fv := GetModuleSymbol( GLHandle, 'glVertex4fv'); + glVertex4i := GetModuleSymbol( GLHandle, 'glVertex4i'); + glVertex4iv := GetModuleSymbol( GLHandle, 'glVertex4iv'); + glVertex4s := GetModuleSymbol( GLHandle, 'glVertex4s'); + glVertex4sv := GetModuleSymbol( GLHandle, 'glVertex4sv'); + glVertexPointer := GetModuleSymbol( GLHandle, 'glVertexPointer'); + glViewport := GetModuleSymbol( GLHandle, 'glViewport'); + + // window support routines + {$ifdef Win32} + wglGetProcAddress := GetModuleSymbol( GLHandle, 'wglGetProcAddress'); + wglCopyContext := GetModuleSymbol( GLHandle, 'wglCopyContext'); + wglCreateContext := GetModuleSymbol( GLHandle, 'wglCreateContext'); + wglCreateLayerContext := GetModuleSymbol( GLHandle, 'wglCreateLayerContext'); + wglDeleteContext := GetModuleSymbol( GLHandle, 'wglDeleteContext'); + wglDescribeLayerPlane := GetModuleSymbol( GLHandle, 'wglDescribeLayerPlane'); + wglGetCurrentContext := GetModuleSymbol( GLHandle, 'wglGetCurrentContext'); + wglGetCurrentDC := GetModuleSymbol( GLHandle, 'wglGetCurrentDC'); + wglGetLayerPaletteEntries := GetModuleSymbol( GLHandle, 'wglGetLayerPaletteEntries'); + wglMakeCurrent := GetModuleSymbol( GLHandle, 'wglMakeCurrent'); + wglRealizeLayerPalette := GetModuleSymbol( GLHandle, 'wglRealizeLayerPalette'); + wglSetLayerPaletteEntries := GetModuleSymbol( GLHandle, 'wglSetLayerPaletteEntries'); + wglShareLists := GetModuleSymbol( GLHandle, 'wglShareLists'); + wglSwapLayerBuffers := GetModuleSymbol( GLHandle, 'wglSwapLayerBuffers'); + wglSwapMultipleBuffers := GetModuleSymbol( GLHandle, 'wglSwapMultipleBuffers'); + wglUseFontBitmapsA := GetModuleSymbol( GLHandle, 'wglUseFontBitmapsA'); + wglUseFontOutlinesA := GetModuleSymbol( GLHandle, 'wglUseFontOutlinesA'); + wglUseFontBitmapsW := GetModuleSymbol( GLHandle, 'wglUseFontBitmapsW'); + wglUseFontOutlinesW := GetModuleSymbol( GLHandle, 'wglUseFontOutlinesW'); + wglUseFontBitmaps := GetModuleSymbol( GLHandle, 'wglUseFontBitmapsA'); + wglUseFontOutlines := GetModuleSymbol( GLHandle, 'wglUseFontOutlinesA'); + {$endif} + + // GL 1.2 + glDrawRangeElements := GetModuleSymbol( GLHandle, 'glDrawRangeElements'); + glTexImage3D := GetModuleSymbol( GLHandle, 'glTexImage3D'); + + // GL 1.2 ARB imaging + glBlendColor := GetModuleSymbol( GLHandle, 'glBlendColor'); + glBlendEquation := GetModuleSymbol( GLHandle, 'glBlendEquation'); + glColorSubTable := GetModuleSymbol( GLHandle, 'glColorSubTable'); + glCopyColorSubTable := GetModuleSymbol( GLHandle, 'glCopyColorSubTable'); + glColorTable := GetModuleSymbol( GLHandle, 'glCopyColorSubTable'); + glCopyColorTable := GetModuleSymbol( GLHandle, 'glCopyColorTable'); + glColorTableParameteriv := GetModuleSymbol( GLHandle, 'glColorTableParameteriv'); + glColorTableParameterfv := GetModuleSymbol( GLHandle, 'glColorTableParameterfv'); + glGetColorTable := GetModuleSymbol( GLHandle, 'glGetColorTable'); + glGetColorTableParameteriv := GetModuleSymbol( GLHandle, 'glGetColorTableParameteriv'); + glGetColorTableParameterfv := GetModuleSymbol( GLHandle, 'glGetColorTableParameterfv'); + glConvolutionFilter1D := GetModuleSymbol( GLHandle, 'glConvolutionFilter1D'); + glConvolutionFilter2D := GetModuleSymbol( GLHandle, 'glConvolutionFilter2D'); + glCopyConvolutionFilter1D := GetModuleSymbol( GLHandle, 'glCopyConvolutionFilter1D'); + glCopyConvolutionFilter2D := GetModuleSymbol( GLHandle, 'glCopyConvolutionFilter2D'); + glGetConvolutionFilter := GetModuleSymbol( GLHandle, 'glGetConvolutionFilter'); + glSeparableFilter2D := GetModuleSymbol( GLHandle, 'glSeparableFilter2D'); + glGetSeparableFilter := GetModuleSymbol( GLHandle, 'glGetSeparableFilter'); + glConvolutionParameteri := GetModuleSymbol( GLHandle, 'glConvolutionParameteri'); + glConvolutionParameteriv := GetModuleSymbol( GLHandle, 'glConvolutionParameteriv'); + glConvolutionParameterf := GetModuleSymbol( GLHandle, 'glConvolutionParameterf'); + glConvolutionParameterfv := GetModuleSymbol( GLHandle, 'glConvolutionParameterfv'); + glGetConvolutionParameteriv := GetModuleSymbol( GLHandle, 'glGetConvolutionParameteriv'); + glGetConvolutionParameterfv := GetModuleSymbol( GLHandle, 'glGetConvolutionParameterfv'); + glHistogram := GetModuleSymbol( GLHandle, 'glHistogram'); + glResetHistogram := GetModuleSymbol( GLHandle, 'glResetHistogram'); + glGetHistogram := GetModuleSymbol( GLHandle, 'glGetHistogram'); + glGetHistogramParameteriv := GetModuleSymbol( GLHandle, 'glGetHistogramParameteriv'); + glGetHistogramParameterfv := GetModuleSymbol( GLHandle, 'glGetHistogramParameterfv'); + glMinmax := GetModuleSymbol( GLHandle, 'glMinmax'); + glResetMinmax := GetModuleSymbol( GLHandle, 'glResetMinmax'); + glGetMinmax := GetModuleSymbol( GLHandle, 'glGetMinmax'); + glGetMinmaxParameteriv := GetModuleSymbol( GLHandle, 'glGetMinmaxParameteriv'); + glGetMinmaxParameterfv := GetModuleSymbol( GLHandle, 'glGetMinmaxParameterfv'); + + {$ifdef UNIX} + glXChooseVisual := GetModuleSymbol( GLHandle, 'glXChooseVisual'); + glXCreateContext := GetModuleSymbol( GLHandle, 'glXCreateContext'); + glXDestroyContext := GetModuleSymbol( GLHandle, 'glXDestroyContext'); + glXMakeCurrent := GetModuleSymbol( GLHandle, 'glXMakeCurrent'); + glXCopyContext := GetModuleSymbol( GLHandle, 'glXCopyContext'); + glXSwapBuffers := GetModuleSymbol( GLHandle, 'glXSwapBuffers'); + glXCreateGLXPixmap := GetModuleSymbol( GLHandle, 'glXCreateGLXPixmap'); + glXDestroyGLXPixmap := GetModuleSymbol( GLHandle, 'glXDestroyGLXPixmap'); + glXQueryExtension := GetModuleSymbol( GLHandle, 'glXQueryExtension'); + glXQueryVersion := GetModuleSymbol( GLHandle, 'glXQueryVersion'); + glXIsDirect := GetModuleSymbol( GLHandle, 'glXIsDirect'); + glXGetConfig := GetModuleSymbol( GLHandle, 'glXGetConfig'); + glXGetCurrentContext := GetModuleSymbol( GLHandle, 'glXGetCurrentContext'); + glXGetCurrentDrawable := GetModuleSymbol( GLHandle, 'glXGetCurrentDrawable'); + glXWaitGL := GetModuleSymbol( GLHandle, 'glXWaitGL'); + glXWaitX := GetModuleSymbol( GLHandle, 'glXWaitX'); + glXUseXFont := GetModuleSymbol( GLHandle, 'glXUseXFont'); + glXQueryExtensionsString := GetModuleSymbol( GLHandle, 'glXQueryExtensionsString'); + glXQueryServerString := GetModuleSymbol( GLHandle, 'glXQueryServerString'); + glXGetClientString := GetModuleSymbol( GLHandle, 'glXGetClientString'); + glXGetCurrentDisplay := GetModuleSymbol( GLHandle, 'glXGetCurrentDisplay'); + glXChooseFBConfig := GetModuleSymbol( GLHandle, 'glXChooseFBConfig'); + glXGetFBConfigAttrib := GetModuleSymbol( GLHandle, 'glXGetFBConfigAttrib'); + glXGetFBConfigs := GetModuleSymbol( GLHandle, 'glXGetFBConfigs'); + glXGetVisualFromFBConfig := GetModuleSymbol( GLHandle, 'glXGetVisualFromFBConfig'); + glXCreateWindow := GetModuleSymbol( GLHandle, 'glXCreateWindow'); + glXDestroyWindow := GetModuleSymbol( GLHandle, 'glXDestroyWindow'); + glXCreatePixmap := GetModuleSymbol( GLHandle, 'glXCreatePixmap'); + glXDestroyPixmap := GetModuleSymbol( GLHandle, 'glXDestroyPixmap'); + glXCreatePbuffer := GetModuleSymbol( GLHandle, 'glXCreatePbuffer'); + glXDestroyPbuffer := GetModuleSymbol( GLHandle, 'glXDestroyPbuffer'); + glXQueryDrawable := GetModuleSymbol( GLHandle, 'glXQueryDrawable'); + glXCreateNewContext := GetModuleSymbol( GLHandle, 'glXCreateNewContext'); + glXMakeContextCurrent := GetModuleSymbol( GLHandle, 'glXMakeContextCurrent'); + glXGetCurrentReadDrawable := GetModuleSymbol( GLHandle, 'glXGetCurrentReadDrawable'); + glXQueryContext := GetModuleSymbol( GLHandle, 'glXQueryContext'); + glXSelectEvent := GetModuleSymbol( GLHandle, 'glXSelectEvent'); + glXGetSelectedEvent := GetModuleSymbol( GLHandle, 'glXGetSelectedEvent'); + glXGetVideoSyncSGI := GetModuleSymbol( GLHandle, 'glXGetVideoSyncSGI'); + glXWaitVideoSyncSGI := GetModuleSymbol( GLHandle, 'glXWaitVideoSyncSGI'); + glXFreeContextEXT := GetModuleSymbol( GLHandle, 'glXFreeContextEXT'); + glXGetContextIDEXT := GetModuleSymbol( GLHandle, 'glXGetContextIDEXT'); + glXGetCurrentDisplayEXT := GetModuleSymbol( GLHandle, 'glXGetCurrentDisplayEXT'); + glXImportContextEXT := GetModuleSymbol( GLHandle, 'glXImportContextEXT'); + glXQueryContextInfoEXT := GetModuleSymbol( GLHandle, 'glXQueryContextInfoEXT'); + glXCopySubBufferMESA := GetModuleSymbol( GLHandle, 'glXCopySubBufferMESA'); + glXCreateGLXPixmapMESA := GetModuleSymbol( GLHandle, 'glXCreateGLXPixmapMESA'); + glXReleaseBuffersMESA := GetModuleSymbol( GLHandle, 'glXReleaseBuffersMESA'); + glXSet3DfxModeMESA := GetModuleSymbol( GLHandle, 'glXSet3DfxModeMESA'); + {$endif} + end; + + if GLUHandle <> INVALID_MODULEHANDLE then + begin + GLHandle := TModuleHandle(GLUHandle); // Kylix compatiblilty trick + + gluBeginCurve := GetModuleSymbol( GLUHandle, 'gluBeginCurve'); + gluBeginPolygon := GetModuleSymbol( GLUHandle, 'gluBeginPolygon'); + gluBeginSurface := GetModuleSymbol( GLUHandle, 'gluBeginSurface'); + gluBeginTrim := GetModuleSymbol( GLUHandle, 'gluBeginTrim'); + gluBuild1DMipmaps := GetModuleSymbol( GLUHandle, 'gluBuild1DMipmaps'); + gluBuild2DMipmaps := GetModuleSymbol( GLUHandle, 'gluBuild2DMipmaps'); + gluCylinder := GetModuleSymbol( GLUHandle, 'gluCylinder'); + gluDeleteNurbsRenderer := GetModuleSymbol( GLUHandle, 'gluDeleteNurbsRenderer'); + gluDeleteQuadric := GetModuleSymbol( GLUHandle, 'gluDeleteQuadric'); + gluDeleteTess := GetModuleSymbol( GLUHandle, 'gluDeleteTess'); + gluDisk := GetModuleSymbol( GLUHandle, 'gluDisk'); + gluEndCurve := GetModuleSymbol( GLUHandle, 'gluEndCurve'); + gluEndPolygon := GetModuleSymbol( GLUHandle, 'gluEndPolygon'); + gluEndSurface := GetModuleSymbol( GLUHandle, 'gluEndSurface'); + gluEndTrim := GetModuleSymbol( GLUHandle, 'gluEndTrim'); + gluErrorString := GetModuleSymbol( GLUHandle, 'gluErrorString'); + gluGetNurbsProperty := GetModuleSymbol( GLUHandle, 'gluGetNurbsProperty'); + gluGetString := GetModuleSymbol( GLUHandle, 'gluGetString'); + gluGetTessProperty := GetModuleSymbol( GLUHandle, 'gluGetTessProperty'); + gluLoadSamplingMatrices := GetModuleSymbol( GLUHandle, 'gluLoadSamplingMatrices'); + gluLookAt := GetModuleSymbol( GLUHandle, 'gluLookAt'); + gluNewNurbsRenderer := GetModuleSymbol( GLUHandle, 'gluNewNurbsRenderer'); + gluNewQuadric := GetModuleSymbol( GLUHandle, 'gluNewQuadric'); + gluNewTess := GetModuleSymbol( GLUHandle, 'gluNewTess'); + gluNextContour := GetModuleSymbol( GLUHandle, 'gluNextContour'); + gluNurbsCallback := GetModuleSymbol( GLUHandle, 'gluNurbsCallback'); + gluNurbsCurve := GetModuleSymbol( GLUHandle, 'gluNurbsCurve'); + gluNurbsProperty := GetModuleSymbol( GLUHandle, 'gluNurbsProperty'); + gluNurbsSurface := GetModuleSymbol( GLUHandle, 'gluNurbsSurface'); + gluOrtho2D := GetModuleSymbol( GLUHandle, 'gluOrtho2D'); + gluPartialDisk := GetModuleSymbol( GLUHandle, 'gluPartialDisk'); + gluPerspective := GetModuleSymbol( GLUHandle, 'gluPerspective'); + gluPickMatrix := GetModuleSymbol( GLUHandle, 'gluPickMatrix'); + gluProject := GetModuleSymbol( GLUHandle, 'gluProject'); + gluPwlCurve := GetModuleSymbol( GLUHandle, 'gluPwlCurve'); + gluQuadricCallback := GetModuleSymbol( GLUHandle, 'gluQuadricCallback'); + gluQuadricDrawStyle := GetModuleSymbol( GLUHandle, 'gluQuadricDrawStyle'); + gluQuadricNormals := GetModuleSymbol( GLUHandle, 'gluQuadricNormals'); + gluQuadricOrientation := GetModuleSymbol( GLUHandle, 'gluQuadricOrientation'); + gluQuadricTexture := GetModuleSymbol( GLUHandle, 'gluQuadricTexture'); + gluScaleImage := GetModuleSymbol( GLUHandle, 'gluScaleImage'); + gluSphere := GetModuleSymbol( GLUHandle, 'gluSphere'); + gluTessBeginContour := GetModuleSymbol( GLUHandle, 'gluTessBeginContour'); + gluTessBeginPolygon := GetModuleSymbol( GLUHandle, 'gluTessBeginPolygon'); + gluTessCallback := GetModuleSymbol( GLUHandle, 'gluTessCallback'); + gluTessEndContour := GetModuleSymbol( GLUHandle, 'gluTessEndContour'); + gluTessEndPolygon := GetModuleSymbol( GLUHandle, 'gluTessEndPolygon'); + gluTessNormal := GetModuleSymbol( GLUHandle, 'gluTessNormal'); + gluTessProperty := GetModuleSymbol( GLUHandle, 'gluTessProperty'); + gluTessVertex := GetModuleSymbol( GLUHandle, 'gluTessVertex'); + gluUnProject := GetModuleSymbol( GLUHandle, 'gluUnProject'); + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure ClearExtensions; + +begin + glArrayElementEXT := nil; + glDrawArraysEXT := nil; + glVertexPointerEXT := nil; + glNormalPointerEXT := nil; + glColorPointerEXT := nil; + glIndexPointerEXT := nil; + glTexCoordPointerEXT := nil; + glEdgeFlagPointerEXT := nil; + glGetPointervEXT := nil; + glArrayElementArrayEXT := nil; + glAddSwapHintRectWIN := nil; + glColorTableEXT := nil; + glColorSubTableEXT := nil; + glGetColorTableEXT := nil; + glGetColorTablePameterivEXT := nil; + glGetColorTablePameterfvEXT := nil; + gluNurbsCallbackDataEXT := nil; + gluNewNurbsTessellatorEXT := nil; + gluDeleteNurbsTessellatorEXT := nil; + glLockArraysEXT := nil; + glUnlockArraysEXT := nil; + glCopyTexImage1DEXT := nil; + glCopyTexSubImage1DEXT := nil; + glCopyTexImage2DEXT := nil; + glCopyTexSubImage2DEXT := nil; + glCopyTexSubImage3DEXT := nil; + glCullParameterfvEXT := nil; + glCullParameterdvEXT := nil; + glIndexFuncEXT := nil; + glIndexMaterialEXT := nil; + glPolygonOffsetEXT := nil; + glTexSubImage1DEXT := nil; + glTexSubImage2DEXT := nil; + glTexSubImage3DEXT := nil; + glGenTexturesEXT := nil; + glDeleteTexturesEXT := nil; + glBindTextureEXT := nil; + glPrioritizeTexturesEXT := nil; + glAreTexturesResidentEXT := nil; + glIsTextureEXT := nil; + + glMultiTexCoord1dARB := nil; + glMultiTexCoord1dVARB := nil; + glMultiTexCoord1fARBP := nil; + glMultiTexCoord1fVARB := nil; + glMultiTexCoord1iARB := nil; + glMultiTexCoord1iVARB := nil; + glMultiTexCoord1sARBP := nil; + glMultiTexCoord1sVARB := nil; + glMultiTexCoord2dARB := nil; + glMultiTexCoord2dvARB := nil; + glMultiTexCoord2fARB := nil; + glMultiTexCoord2fvARB := nil; + glMultiTexCoord2iARB := nil; + glMultiTexCoord2ivARB := nil; + glMultiTexCoord2sARB := nil; + glMultiTexCoord2svARB := nil; + glMultiTexCoord3dARB := nil; + glMultiTexCoord3dvARB := nil; + glMultiTexCoord3fARB := nil; + glMultiTexCoord3fvARB := nil; + glMultiTexCoord3iARB := nil; + glMultiTexCoord3ivARB := nil; + glMultiTexCoord3sARB := nil; + glMultiTexCoord3svARB := nil; + glMultiTexCoord4dARB := nil; + glMultiTexCoord4dvARB := nil; + glMultiTexCoord4fARB := nil; + glMultiTexCoord4fvARB := nil; + glMultiTexCoord4iARB := nil; + glMultiTexCoord4ivARB := nil; + glMultiTexCoord4sARB := nil; + glMultiTexCoord4svARB := nil; + glActiveTextureARB := nil; + glClientActiveTextureARB := nil; + + // EXT_compiled_vertex_array + glLockArrayEXT := nil; + glUnlockArrayEXT := nil; + + // EXT_cull_vertex + glCullParameterdvEXT := nil; + glCullParameterfvEXT := nil; + + // WIN_swap_hint + glAddSwapHintRectWIN := nil; + + // EXT_point_parameter + glPointParameterfEXT := nil; + glPointParameterfvEXT := nil; + + // GL_ARB_transpose_matrix + glLoadTransposeMatrixfARB := nil; + glLoadTransposeMatrixdARB := nil; + glMultTransposeMatrixfARB := nil; + glMultTransposeMatrixdARB := nil; + + glSampleCoverageARB := nil; + glSamplePassARB := nil; + + // GL_ARB_multisample + glCompressedTexImage3DARB := nil; + glCompressedTexImage2DARB := nil; + glCompressedTexImage1DARB := nil; + glCompressedTexSubImage3DARB := nil; + glCompressedTexSubImage2DARB := nil; + glCompressedTexSubImage1DARB := nil; + glGetCompressedTexImageARB := nil; + + // GL_EXT_blend_color + glBlendColorEXT := nil; + + // GL_EXT_texture3D + glTexImage3DEXT := nil; + + // GL_SGIS_texture_filter4 + glGetTexFilterFuncSGIS := nil; + glTexFilterFuncSGIS := nil; + + // GL_EXT_histogram + glGetHistogramEXT := nil; + glGetHistogramParameterfvEXT := nil; + glGetHistogramParameterivEXT := nil; + glGetMinmaxEXT := nil; + glGetMinmaxParameterfvEXT := nil; + glGetMinmaxParameterivEXT := nil; + glHistogramEXT := nil; + glMinmaxEXT := nil; + glResetHistogramEXT := nil; + glResetMinmaxEXT := nil; + + // GL_EXT_convolution + glConvolutionFilter1DEXT := nil; + glConvolutionFilter2DEXT := nil; + glConvolutionParameterfEXT := nil; + glConvolutionParameterfvEXT := nil; + glConvolutionParameteriEXT := nil; + glConvolutionParameterivEXT := nil; + glCopyConvolutionFilter1DEXT := nil; + glCopyConvolutionFilter2DEXT := nil; + glGetConvolutionFilterEXT := nil; + glGetConvolutionParameterfvEXT := nil; + glGetConvolutionParameterivEXT := nil; + glGetSeparableFilterEXT := nil; + glSeparableFilter2DEXT := nil; + + // GL_SGI_color_table + glColorTableSGI := nil; + glColorTableParameterfvSGI := nil; + glColorTableParameterivSGI := nil; + glCopyColorTableSGI := nil; + glGetColorTableSGI := nil; + glGetColorTableParameterfvSGI := nil; + glGetColorTableParameterivSGI := nil; + + // GL_SGIX_pixel_texture + glPixelTexGenSGIX := nil; + + // GL_SGIS_pixel_texture + glPixelTexGenParameteriSGIS := nil; + glPixelTexGenParameterivSGIS := nil; + glPixelTexGenParameterfSGIS := nil; + glPixelTexGenParameterfvSGIS := nil; + glGetPixelTexGenParameterivSGIS := nil; + glGetPixelTexGenParameterfvSGIS := nil; + + // GL_SGIS_texture4D + glTexImage4DSGIS := nil; + glTexSubImage4DSGIS := nil; + + // GL_SGIS_detail_texture + glDetailTexFuncSGIS := nil; + glGetDetailTexFuncSGIS := nil; + + // GL_SGIS_sharpen_texture + glSharpenTexFuncSGIS := nil; + glGetSharpenTexFuncSGIS := nil; + + // GL_SGIS_multisample + glSampleMaskSGIS := nil; + glSamplePatternSGIS := nil; + + // GL_EXT_blend_minmax + glBlendEquationEXT := nil; + + // GL_SGIX_sprite + glSpriteParameterfSGIX := nil; + glSpriteParameterfvSGIX := nil; + glSpriteParameteriSGIX := nil; + glSpriteParameterivSGIX := nil; + + // GL_EXT_point_parameters + glPointParameterfSGIS := nil; + glPointParameterfvSGIS := nil; + + // GL_SGIX_instruments + glGetInstrumentsSGIX := nil; + glInstrumentsBufferSGIX := nil; + glPollInstrumentsSGIX := nil; + glReadInstrumentsSGIX := nil; + glStartInstrumentsSGIX := nil; + glStopInstrumentsSGIX := nil; + + // GL_SGIX_framezoom + glFrameZoomSGIX := nil; + + // GL_SGIX_tag_sample_buffer + glTagSampleBufferSGIX := nil; + + // GL_SGIX_polynomial_ffd + glDeformationMap3dSGIX := nil; + glDeformationMap3fSGIX := nil; + glDeformSGIX := nil; + glLoadIdentityDeformationMapSGIX := nil; + + // GL_SGIX_reference_plane + glReferencePlaneSGIX := nil; + + // GL_SGIX_flush_raster + glFlushRasterSGIX := nil; + + // GL_SGIS_fog_function + glFogFuncSGIS := nil; + glGetFogFuncSGIS := nil; + + // GL_HP_image_transform + glImageTransformParameteriHP := nil; + glImageTransformParameterfHP := nil; + glImageTransformParameterivHP := nil; + glImageTransformParameterfvHP := nil; + glGetImageTransformParameterivHP := nil; + glGetImageTransformParameterfvHP := nil; + + // GL_EXT_color_subtable + glCopyColorSubTableEXT := nil; + + // GL_PGI_misc_hints + glHintPGI := nil; + + // GL_EXT_paletted_texture + glGetColorTableParameterivEXT := nil; + glGetColorTableParameterfvEXT := nil; + + // GL_SGIX_list_priority + glGetListParameterfvSGIX := nil; + glGetListParameterivSGIX := nil; + glListParameterfSGIX := nil; + glListParameterfvSGIX := nil; + glListParameteriSGIX := nil; + glListParameterivSGIX := nil; + + // GL_SGIX_fragment_lighting + glFragmentColorMaterialSGIX := nil; + glFragmentLightfSGIX := nil; + glFragmentLightfvSGIX := nil; + glFragmentLightiSGIX := nil; + glFragmentLightivSGIX := nil; + glFragmentLightModelfSGIX := nil; + glFragmentLightModelfvSGIX := nil; + glFragmentLightModeliSGIX := nil; + glFragmentLightModelivSGIX := nil; + glFragmentMaterialfSGIX := nil; + glFragmentMaterialfvSGIX := nil; + glFragmentMaterialiSGIX := nil; + glFragmentMaterialivSGIX := nil; + glGetFragmentLightfvSGIX := nil; + glGetFragmentLightivSGIX := nil; + glGetFragmentMaterialfvSGIX := nil; + glGetFragmentMaterialivSGIX := nil; + glLightEnviSGIX := nil; + + // GL_EXT_draw_range_elements + glDrawRangeElementsEXT := nil; + + // GL_EXT_light_texture + glApplyTextureEXT := nil; + glTextureLightEXT := nil; + glTextureMaterialEXT := nil; + + // GL_SGIX_async + glAsyncMarkerSGIX := nil; + glFinishAsyncSGIX := nil; + glPollAsyncSGIX := nil; + glGenAsyncMarkersSGIX := nil; + glDeleteAsyncMarkersSGIX := nil; + glIsAsyncMarkerSGIX := nil; + + // GL_INTEL_parallel_arrays + glVertexPointervINTEL := nil; + glNormalPointervINTEL := nil; + glColorPointervINTEL := nil; + glTexCoordPointervINTEL := nil; + + // GL_EXT_pixel_transform + glPixelTransformParameteriEXT := nil; + glPixelTransformParameterfEXT := nil; + glPixelTransformParameterivEXT := nil; + glPixelTransformParameterfvEXT := nil; + + // GL_EXT_secondary_color + glSecondaryColor3bEXT := nil; + glSecondaryColor3bvEXT := nil; + glSecondaryColor3dEXT := nil; + glSecondaryColor3dvEXT := nil; + glSecondaryColor3fEXT := nil; + glSecondaryColor3fvEXT := nil; + glSecondaryColor3iEXT := nil; + glSecondaryColor3ivEXT := nil; + glSecondaryColor3sEXT := nil; + glSecondaryColor3svEXT := nil; + glSecondaryColor3ubEXT := nil; + glSecondaryColor3ubvEXT := nil; + glSecondaryColor3uiEXT := nil; + glSecondaryColor3uivEXT := nil; + glSecondaryColor3usEXT := nil; + glSecondaryColor3usvEXT := nil; + glSecondaryColorPointerEXT := nil; + + // GL_EXT_texture_perturb_normal + glTextureNormalEXT := nil; + + // GL_EXT_multi_draw_arrays + glMultiDrawArraysEXT := nil; + glMultiDrawElementsEXT := nil; + + // GL_EXT_fog_coord + glFogCoordfEXT := nil; + glFogCoordfvEXT := nil; + glFogCoorddEXT := nil; + glFogCoorddvEXT := nil; + glFogCoordPointerEXT := nil; + + // GL_EXT_coordinate_frame + glTangent3bEXT := nil; + glTangent3bvEXT := nil; + glTangent3dEXT := nil; + glTangent3dvEXT := nil; + glTangent3fEXT := nil; + glTangent3fvEXT := nil; + glTangent3iEXT := nil; + glTangent3ivEXT := nil; + glTangent3sEXT := nil; + glTangent3svEXT := nil; + glBinormal3bEXT := nil; + glBinormal3bvEXT := nil; + glBinormal3dEXT := nil; + glBinormal3dvEXT := nil; + glBinormal3fEXT := nil; + glBinormal3fvEXT := nil; + glBinormal3iEXT := nil; + glBinormal3ivEXT := nil; + glBinormal3sEXT := nil; + glBinormal3svEXT := nil; + glTangentPointerEXT := nil; + glBinormalPointerEXT := nil; + + // GL_SUNX_constant_data + glFinishTextureSUNX := nil; + + // GL_SUN_global_alpha + glGlobalAlphaFactorbSUN := nil; + glGlobalAlphaFactorsSUN := nil; + glGlobalAlphaFactoriSUN := nil; + glGlobalAlphaFactorfSUN := nil; + glGlobalAlphaFactordSUN := nil; + glGlobalAlphaFactorubSUN := nil; + glGlobalAlphaFactorusSUN := nil; + glGlobalAlphaFactoruiSUN := nil; + + // GL_SUN_triangle_list + glReplacementCodeuiSUN := nil; + glReplacementCodeusSUN := nil; + glReplacementCodeubSUN := nil; + glReplacementCodeuivSUN := nil; + glReplacementCodeusvSUN := nil; + glReplacementCodeubvSUN := nil; + glReplacementCodePointerSUN := nil; + + // GL_SUN_vertex + glColor4ubVertex2fSUN := nil; + glColor4ubVertex2fvSUN := nil; + glColor4ubVertex3fSUN := nil; + glColor4ubVertex3fvSUN := nil; + glColor3fVertex3fSUN := nil; + glColor3fVertex3fvSUN := nil; + glNormal3fVertex3fSUN := nil; + glNormal3fVertex3fvSUN := nil; + glColor4fNormal3fVertex3fSUN := nil; + glColor4fNormal3fVertex3fvSUN := nil; + glTexCoord2fVertex3fSUN := nil; + glTexCoord2fVertex3fvSUN := nil; + glTexCoord4fVertex4fSUN := nil; + glTexCoord4fVertex4fvSUN := nil; + glTexCoord2fColor4ubVertex3fSUN := nil; + glTexCoord2fColor4ubVertex3fvSUN := nil; + glTexCoord2fColor3fVertex3fSUN := nil; + glTexCoord2fColor3fVertex3fvSUN := nil; + glTexCoord2fNormal3fVertex3fSUN := nil; + glTexCoord2fNormal3fVertex3fvSUN := nil; + glTexCoord2fColor4fNormal3fVertex3fSUN := nil; + glTexCoord2fColor4fNormal3fVertex3fvSUN := nil; + glTexCoord4fColor4fNormal3fVertex4fSUN := nil; + glTexCoord4fColor4fNormal3fVertex4fvSUN := nil; + glReplacementCodeuiVertex3fSUN := nil; + glReplacementCodeuiVertex3fvSUN := nil; + glReplacementCodeuiColor4ubVertex3fSUN := nil; + glReplacementCodeuiColor4ubVertex3fvSUN := nil; + glReplacementCodeuiColor3fVertex3fSUN := nil; + glReplacementCodeuiColor3fVertex3fvSUN := nil; + glReplacementCodeuiNormal3fVertex3fSUN := nil; + glReplacementCodeuiNormal3fVertex3fvSUN := nil; + glReplacementCodeuiColor4fNormal3fVertex3fSUN := nil; + glReplacementCodeuiColor4fNormal3fVertex3fvSUN := nil; + glReplacementCodeuiTexCoord2fVertex3fSUN := nil; + glReplacementCodeuiTexCoord2fVertex3fvSUN := nil; + glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN := nil; + glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN := nil; + glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN := nil; + glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN := nil; + + // GL_EXT_blend_func_separate + glBlendFuncSeparateEXT := nil; + + // GL_EXT_vertex_weighting + glVertexWeightfEXT := nil; + glVertexWeightfvEXT := nil; + glVertexWeightPointerEXT := nil; + + // GL_NV_vertex_array_range + glFlushVertexArrayRangeNV := nil; + glVertexArrayRangeNV := nil; + wglAllocateMemoryNV := nil; + wglFreeMemoryNV := nil; + + // GL_NV_register_combiners + glCombinerParameterfvNV := nil; + glCombinerParameterfNV := nil; + glCombinerParameterivNV := nil; + glCombinerParameteriNV := nil; + glCombinerInputNV := nil; + glCombinerOutputNV := nil; + glFinalCombinerInputNV := nil; + glGetCombinerInputParameterfvNV := nil; + glGetCombinerInputParameterivNV := nil; + glGetCombinerOutputParameterfvNV := nil; + glGetCombinerOutputParameterivNV := nil; + glGetFinalCombinerInputParameterfvNV := nil; + glGetFinalCombinerInputParameterivNV := nil; + + // GL_MESA_resize_buffers + glResizeBuffersMESA := nil; + + // GL_MESA_window_pos + glWindowPos2dMESA := nil; + glWindowPos2dvMESA := nil; + glWindowPos2fMESA := nil; + glWindowPos2fvMESA := nil; + glWindowPos2iMESA := nil; + glWindowPos2ivMESA := nil; + glWindowPos2sMESA := nil; + glWindowPos2svMESA := nil; + glWindowPos3dMESA := nil; + glWindowPos3dvMESA := nil; + glWindowPos3fMESA := nil; + glWindowPos3fvMESA := nil; + glWindowPos3iMESA := nil; + glWindowPos3ivMESA := nil; + glWindowPos3sMESA := nil; + glWindowPos3svMESA := nil; + glWindowPos4dMESA := nil; + glWindowPos4dvMESA := nil; + glWindowPos4fMESA := nil; + glWindowPos4fvMESA := nil; + glWindowPos4iMESA := nil; + glWindowPos4ivMESA := nil; + glWindowPos4sMESA := nil; + glWindowPos4svMESA := nil; + + // GL_IBM_multimode_draw_arrays + glMultiModeDrawArraysIBM := nil; + glMultiModeDrawElementsIBM := nil; + + // GL_IBM_vertex_array_lists + glColorPointerListIBM := nil; + glSecondaryColorPointerListIBM := nil; + glEdgeFlagPointerListIBM := nil; + glFogCoordPointerListIBM := nil; + glIndexPointerListIBM := nil; + glNormalPointerListIBM := nil; + glTexCoordPointerListIBM := nil; + glVertexPointerListIBM := nil; + + // GL_3DFX_tbuffer + glTbufferMask3DFX := nil; + + // GL_EXT_multisample + glSampleMaskEXT := nil; + glSamplePatternEXT := nil; + + // GL_SGIS_texture_color_mask + glTextureColorMaskSGIS := nil; + + // GL_SGIX_igloo_interface + glIglooInterfaceSGIX := nil; + + // GLU extensions + gluNurbsCallbackDataEXT := nil; + gluNewNurbsTessellatorEXT := nil; + gluDeleteNurbsTessellatorEXT := nil; + + // GL_NV_vertex_program + glAreProgramsResidentNV := nil; + glBindProgramNV := nil; + glDeleteProgramsNV := nil; + glExecuteProgramNV := nil; + glGenProgramsNV := nil; + glGetProgramParameterdvNV := nil; + glGetProgramParameterfvNV := nil; + glGetProgramivNV := nil; + glGetProgramStringNV := nil; + glGetTrackMatrixivNV := nil; + glGetVertexAttribdvNV:= nil; + glGetVertexAttribfvNV:= nil; + glGetVertexAttribivNV:= nil; + glGetVertexAttribPointervNV := nil; + glIsProgramNV := nil; + glLoadProgramNV := nil; + glProgramParameter4dNV := nil; + glProgramParameter4dvNV := nil; + glProgramParameter4fNV := nil; + glProgramParameter4fvNV := nil; + glProgramParameters4dvNV := nil; + glProgramParameters4fvNV := nil; + glRequestResidentProgramsNV := nil; + glTrackMatrixNV := nil; + glVertexAttribPointerNV := nil; + glVertexAttrib1dNV := nil; + glVertexAttrib1dvNV := nil; + glVertexAttrib1fNV := nil; + glVertexAttrib1fvNV := nil; + glVertexAttrib1sNV := nil; + glVertexAttrib1svNV := nil; + glVertexAttrib2dNV := nil; + glVertexAttrib2dvNV := nil; + glVertexAttrib2fNV := nil; + glVertexAttrib2fvNV := nil; + glVertexAttrib2sNV := nil; + glVertexAttrib2svNV := nil; + glVertexAttrib3dNV := nil; + glVertexAttrib3dvNV := nil; + glVertexAttrib3fNV := nil; + glVertexAttrib3fvNV := nil; + glVertexAttrib3sNV := nil; + glVertexAttrib3svNV := nil; + glVertexAttrib4dNV := nil; + glVertexAttrib4dvNV := nil; + glVertexAttrib4fNV := nil; + glVertexAttrib4fvNV := nil; + glVertexAttrib4sNV := nil; + glVertexAttrib4svNV := nil; + glVertexAttrib4ubvNV := nil; + glVertexAttribs1dvNV := nil; + glVertexAttribs1fvNV := nil; + glVertexAttribs1svNV := nil; + glVertexAttribs2dvNV := nil; + glVertexAttribs2fvNV := nil; + glVertexAttribs2svNV := nil; + glVertexAttribs3dvNV := nil; + glVertexAttribs3fvNV := nil; + glVertexAttribs3svNV := nil; + glVertexAttribs4dvNV := nil; + glVertexAttribs4fvNV := nil; + glVertexAttribs4svNV := nil; + glVertexAttribs4ubvNV := nil; + + LastPixelFormat := 0; // to get synchronized again, if this proc was called from outside +end; + +//---------------------------------------------------------------------------------------------------------------------- + +{$ifdef Win32} + +function HasActiveContext: Boolean; + +// Returns True if the caller thread has an active (current) rendering context. + +begin + Result := ActivationRefCount > 0; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure ReadExtensions; +begin + if GLHandle <> INVALID_MODULEHANDLE then + begin + // GL extensions + glArrayElementArrayEXT := SDL_GL_GetProcAddress( 'glArrayElementArrayEXT'); + glColorTableEXT := SDL_GL_GetProcAddress( 'glColorTableEXT'); + glColorSubTableEXT := SDL_GL_GetProcAddress( 'glColorSubTableEXT'); + glGetColorTableEXT := SDL_GL_GetProcAddress( 'glGetColorTableEXT'); + glGetColorTablePameterivEXT := SDL_GL_GetProcAddress( 'glGetColorTablePameterivEXT'); + glGetColorTablePameterfvEXT := SDL_GL_GetProcAddress( 'glGetColorTablePameterfvEXT'); + glLockArraysEXT := SDL_GL_GetProcAddress( 'glLockArraysEXT'); + glUnlockArraysEXT := SDL_GL_GetProcAddress( 'glUnlockArraysEXT'); + glCopyTexImage1DEXT := SDL_GL_GetProcAddress( 'glCopyTexImage1DEXT'); + glCopyTexSubImage1DEXT := SDL_GL_GetProcAddress( 'glCopyTexSubImage1DEXT'); + glCopyTexImage2DEXT := SDL_GL_GetProcAddress( 'glCopyTexImage2DEXT'); + glCopyTexSubImage2DEXT := SDL_GL_GetProcAddress( 'glCopyTexSubImage2DEXT'); + glCopyTexSubImage3DEXT := SDL_GL_GetProcAddress( 'glCopyTexSubImage3DEXT'); + glIndexFuncEXT := GetModuleSymbol( GLHandle, 'glIndexFuncEXT'); + glIndexMaterialEXT := SDL_GL_GetProcAddress( 'glIndexMaterialEXT'); + glPolygonOffsetEXT := SDL_GL_GetProcAddress( 'glPolygonOffsetEXT'); + glTexSubImage1dEXT := SDL_GL_GetProcAddress( 'glTexSubImage1DEXT'); + glTexSubImage2dEXT := SDL_GL_GetProcAddress( 'glTexSubImage2DEXT'); + glTexSubImage3dEXT := SDL_GL_GetProcAddress( 'glTexSubImage3DEXT'); + glGenTexturesEXT := SDL_GL_GetProcAddress( 'glGenTexturesEXT'); + glDeleteTexturesEXT := SDL_GL_GetProcAddress( 'glDeleteTexturesEXT'); + glBindTextureEXT := SDL_GL_GetProcAddress( 'glBindTextureEXT'); + glPrioritizeTexturesEXT := SDL_GL_GetProcAddress( 'glPrioritizeTexturesEXT'); + glAreTexturesResidentEXT := SDL_GL_GetProcAddress( 'glAreTexturesResidentEXT'); + glIsTextureEXT := GetModuleSymbol( GLHandle, 'glIsTextureEXT'); + + // EXT_vertex_array + glArrayElementEXT := SDL_GL_GetProcAddress( 'glArrayElementEXT'); + glColorPointerEXT := SDL_GL_GetProcAddress( 'glColorPointerEXT'); + glDrawArraysEXT := SDL_GL_GetProcAddress( 'glDrawArraysEXT'); + glEdgeFlagPointerEXT := SDL_GL_GetProcAddress( 'glEdgeFlagPointerEXT'); + glGetPointervEXT := SDL_GL_GetProcAddress( 'glGetPointervEXT'); + glIndexPointerEXT := SDL_GL_GetProcAddress( 'glIndexPointerEXT'); + glNormalPointerEXT := SDL_GL_GetProcAddress( 'glNormalPointerEXT'); + glTexCoordPointerEXT := SDL_GL_GetProcAddress( 'glTexCoordPointerEXT'); + glVertexPointerEXT := SDL_GL_GetProcAddress( 'glVertexPointerEXT'); + + // ARB_multitexture + glMultiTexCoord1dARB := SDL_GL_GetProcAddress( 'glMultiTexCoord1dARB'); + glMultiTexCoord1dVARB := SDL_GL_GetProcAddress( 'glMultiTexCoord1dVARB'); + glMultiTexCoord1fARBP := SDL_GL_GetProcAddress( 'glMultiTexCoord1fARBP'); + glMultiTexCoord1fVARB := SDL_GL_GetProcAddress( 'glMultiTexCoord1fVARB'); + glMultiTexCoord1iARB := SDL_GL_GetProcAddress( 'glMultiTexCoord1iARB'); + glMultiTexCoord1iVARB := SDL_GL_GetProcAddress( 'glMultiTexCoord1iVARB'); + glMultiTexCoord1sARBP := SDL_GL_GetProcAddress( 'glMultiTexCoord1sARBP'); + glMultiTexCoord1sVARB := SDL_GL_GetProcAddress( 'glMultiTexCoord1sVARB'); + glMultiTexCoord2dARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2dARB'); + glMultiTexCoord2dvARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2dvARB'); + glMultiTexCoord2fARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2fARB'); + glMultiTexCoord2fvARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2fvARB'); + glMultiTexCoord2iARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2iARB'); + glMultiTexCoord2ivARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2ivARB'); + glMultiTexCoord2sARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2sARB'); + glMultiTexCoord2svARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2svARB'); + glMultiTexCoord3dARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3dARB'); + glMultiTexCoord3dvARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3dvARB'); + glMultiTexCoord3fARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3fARB'); + glMultiTexCoord3fvARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3fvARB'); + glMultiTexCoord3iARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3iARB'); + glMultiTexCoord3ivARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3ivARB'); + glMultiTexCoord3sARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3sARB'); + glMultiTexCoord3svARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3svARB'); + glMultiTexCoord4dARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4dARB'); + glMultiTexCoord4dvARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4dvARB'); + glMultiTexCoord4fARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4fARB'); + glMultiTexCoord4fvARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4fvARB'); + glMultiTexCoord4iARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4iARB'); + glMultiTexCoord4ivARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4ivARB'); + glMultiTexCoord4sARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4sARB'); + glMultiTexCoord4svARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4svARB'); + glActiveTextureARB := SDL_GL_GetProcAddress( 'glActiveTextureARB'); + glClientActiveTextureARB := SDL_GL_GetProcAddress( 'glClientActiveTextureARB'); + + // EXT_compiled_vertex_array + glLockArrayEXT := SDL_GL_GetProcAddress( 'glLockArrayEXT'); + glUnlockArrayEXT := SDL_GL_GetProcAddress( 'glUnlockArrayEXT'); + + // EXT_cull_vertex + glCullParameterdvEXT := SDL_GL_GetProcAddress( 'glCullParameterdvEXT'); + glCullParameterfvEXT := SDL_GL_GetProcAddress( 'glCullParameterfvEXT'); + + // WIN_swap_hint + glAddSwapHintRectWIN := SDL_GL_GetProcAddress( 'glAddSwapHintRectWIN'); + + // EXT_point_parameter + glPointParameterfEXT := SDL_GL_GetProcAddress( 'glPointParameterfEXT'); + glPointParameterfvEXT := SDL_GL_GetProcAddress( 'glPointParameterfvEXT'); + + // GL_ARB_transpose_matrix + glLoadTransposeMatrixfARB := SDL_GL_GetProcAddress( 'glLoadTransposeMatrixfARB'); + glLoadTransposeMatrixdARB := SDL_GL_GetProcAddress( 'glLoadTransposeMatrixdARB'); + glMultTransposeMatrixfARB := SDL_GL_GetProcAddress( 'glMultTransposeMatrixfARB'); + glMultTransposeMatrixdARB := SDL_GL_GetProcAddress( 'glMultTransposeMatrixdARB'); + + glSampleCoverageARB := SDL_GL_GetProcAddress( 'glSampleCoverageARB'); + glSamplePassARB := SDL_GL_GetProcAddress( 'glSamplePassARB'); + + // GL_ARB_multisample + glCompressedTexImage3DARB := SDL_GL_GetProcAddress( 'glCompressedTexImage3DARB'); + glCompressedTexImage2DARB := SDL_GL_GetProcAddress( 'glCompressedTexImage2DARB'); + glCompressedTexImage1DARB := SDL_GL_GetProcAddress( 'glCompressedTexImage1DARB'); + glCompressedTexSubImage3DARB := SDL_GL_GetProcAddress( 'glCompressedTexSubImage3DARB'); + glCompressedTexSubImage2DARB := SDL_GL_GetProcAddress( 'glCompressedTexSubImage2DARB'); + glCompressedTexSubImage1DARB := SDL_GL_GetProcAddress( 'glCompressedTexSubImage1DARB'); + glGetCompressedTexImageARB := SDL_GL_GetProcAddress( 'glGetCompressedTexImageARB'); + + // GL_EXT_blend_color + glBlendColorEXT := SDL_GL_GetProcAddress( 'glBlendColorEXT'); + + // GL_EXT_texture3D + glTexImage3DEXT := SDL_GL_GetProcAddress( 'glTexImage3DEXT'); + + // GL_SGIS_texture_filter4 + glGetTexFilterFuncSGIS := SDL_GL_GetProcAddress( 'glGetTexFilterFuncSGIS'); + glTexFilterFuncSGIS := SDL_GL_GetProcAddress( 'glTexFilterFuncSGIS'); + + // GL_EXT_histogram + glGetHistogramEXT := SDL_GL_GetProcAddress( 'glGetHistogramEXT'); + glGetHistogramParameterfvEXT := SDL_GL_GetProcAddress( 'glGetHistogramParameterfvEXT'); + glGetHistogramParameterivEXT := SDL_GL_GetProcAddress( 'glGetHistogramParameterivEXT'); + glGetMinmaxEXT := SDL_GL_GetProcAddress( 'glGetMinmaxEXT'); + glGetMinmaxParameterfvEXT := SDL_GL_GetProcAddress( 'glGetMinmaxParameterfvEXT'); + glGetMinmaxParameterivEXT := SDL_GL_GetProcAddress( 'glGetMinmaxParameterivEXT'); + glHistogramEXT := SDL_GL_GetProcAddress( 'glHistogramEXT'); + glMinmaxEXT := SDL_GL_GetProcAddress( 'glMinmaxEXT'); + glResetHistogramEXT := SDL_GL_GetProcAddress( 'glResetHistogramEXT'); + glResetMinmaxEXT := SDL_GL_GetProcAddress( 'glResetMinmaxEXT'); + + // GL_EXT_convolution + glConvolutionFilter1DEXT := SDL_GL_GetProcAddress( 'glConvolutionFilter1DEXT'); + glConvolutionFilter2DEXT := SDL_GL_GetProcAddress( 'glConvolutionFilter2DEXT'); + glConvolutionParameterfEXT := SDL_GL_GetProcAddress( 'glConvolutionParameterfEXT'); + glConvolutionParameterfvEXT := SDL_GL_GetProcAddress( 'glConvolutionParameterfvEXT'); + glConvolutionParameteriEXT := SDL_GL_GetProcAddress( 'glConvolutionParameteriEXT'); + glConvolutionParameterivEXT := SDL_GL_GetProcAddress( 'glConvolutionParameterivEXT'); + glCopyConvolutionFilter1DEXT := SDL_GL_GetProcAddress( 'glCopyConvolutionFilter1DEXT'); + glCopyConvolutionFilter2DEXT := SDL_GL_GetProcAddress( 'glCopyConvolutionFilter2DEXT'); + glGetConvolutionFilterEXT := SDL_GL_GetProcAddress( 'glGetConvolutionFilterEXT'); + glGetConvolutionParameterfvEXT := SDL_GL_GetProcAddress( 'glGetConvolutionParameterfvEXT'); + glGetConvolutionParameterivEXT := SDL_GL_GetProcAddress( 'glGetConvolutionParameterivEXT'); + glGetSeparableFilterEXT := SDL_GL_GetProcAddress( 'glGetSeparableFilterEXT'); + glSeparableFilter2DEXT := SDL_GL_GetProcAddress( 'glSeparableFilter2DEXT'); + + // GL_SGI_color_table + glColorTableSGI := SDL_GL_GetProcAddress( 'glColorTableSGI'); + glColorTableParameterfvSGI := SDL_GL_GetProcAddress( 'glColorTableParameterfvSGI'); + glColorTableParameterivSGI := SDL_GL_GetProcAddress( 'glColorTableParameterivSGI'); + glCopyColorTableSGI := SDL_GL_GetProcAddress( 'glCopyColorTableSGI'); + glGetColorTableSGI := SDL_GL_GetProcAddress( 'glGetColorTableSGI'); + glGetColorTableParameterfvSGI := SDL_GL_GetProcAddress( 'glGetColorTableParameterfvSGI'); + glGetColorTableParameterivSGI := SDL_GL_GetProcAddress( 'glGetColorTableParameterivSGI'); + + // GL_SGIX_pixel_texture + glPixelTexGenSGIX := SDL_GL_GetProcAddress( 'glPixelTexGenSGIX'); + + // GL_SGIS_pixel_texture + glPixelTexGenParameteriSGIS := SDL_GL_GetProcAddress( 'glPixelTexGenParameteriSGIS'); + glPixelTexGenParameterivSGIS := SDL_GL_GetProcAddress( 'glPixelTexGenParameterivSGIS'); + glPixelTexGenParameterfSGIS := SDL_GL_GetProcAddress( 'glPixelTexGenParameterfSGIS'); + glPixelTexGenParameterfvSGIS := SDL_GL_GetProcAddress( 'glPixelTexGenParameterfvSGIS'); + glGetPixelTexGenParameterivSGIS := SDL_GL_GetProcAddress( 'glGetPixelTexGenParameterivSGIS'); + glGetPixelTexGenParameterfvSGIS := SDL_GL_GetProcAddress( 'glGetPixelTexGenParameterfvSGIS'); + + // GL_SGIS_texture4D + glTexImage4DSGIS := SDL_GL_GetProcAddress( 'glTexImage4DSGIS'); + glTexSubImage4DSGIS := SDL_GL_GetProcAddress( 'glTexSubImage4DSGIS'); + + // GL_SGIS_detail_texture + glDetailTexFuncSGIS := SDL_GL_GetProcAddress( 'glDetailTexFuncSGIS'); + glGetDetailTexFuncSGIS := SDL_GL_GetProcAddress( 'glGetDetailTexFuncSGIS'); + + // GL_SGIS_sharpen_texture + glSharpenTexFuncSGIS := SDL_GL_GetProcAddress( 'glSharpenTexFuncSGIS'); + glGetSharpenTexFuncSGIS := SDL_GL_GetProcAddress( 'glGetSharpenTexFuncSGIS'); + + // GL_SGIS_multisample + glSampleMaskSGIS := SDL_GL_GetProcAddress( 'glSampleMaskSGIS'); + glSamplePatternSGIS := SDL_GL_GetProcAddress( 'glSamplePatternSGIS'); + + // GL_EXT_blend_minmax + glBlendEquationEXT := SDL_GL_GetProcAddress( 'glBlendEquationEXT'); + + // GL_SGIX_sprite + glSpriteParameterfSGIX := SDL_GL_GetProcAddress( 'glSpriteParameterfSGIX'); + glSpriteParameterfvSGIX := SDL_GL_GetProcAddress( 'glSpriteParameterfvSGIX'); + glSpriteParameteriSGIX := SDL_GL_GetProcAddress( 'glSpriteParameteriSGIX'); + glSpriteParameterivSGIX := SDL_GL_GetProcAddress( 'glSpriteParameterivSGIX'); + + // GL_EXT_point_parameters + glPointParameterfSGIS := SDL_GL_GetProcAddress( 'glPointParameterfSGIS'); + glPointParameterfvSGIS := SDL_GL_GetProcAddress( 'glPointParameterfvSGIS'); + + // GL_SGIX_instruments + glGetInstrumentsSGIX := SDL_GL_GetProcAddress( 'glGetInstrumentsSGIX'); + glInstrumentsBufferSGIX := SDL_GL_GetProcAddress( 'glInstrumentsBufferSGIX'); + glPollInstrumentsSGIX := SDL_GL_GetProcAddress( 'glPollInstrumentsSGIX'); + glReadInstrumentsSGIX := SDL_GL_GetProcAddress( 'glReadInstrumentsSGIX'); + glStartInstrumentsSGIX := SDL_GL_GetProcAddress( 'glStartInstrumentsSGIX'); + glStopInstrumentsSGIX := SDL_GL_GetProcAddress( 'glStopInstrumentsSGIX'); + + // GL_SGIX_framezoom + glFrameZoomSGIX := SDL_GL_GetProcAddress( 'glFrameZoomSGIX'); + + // GL_SGIX_tag_sample_buffer + glTagSampleBufferSGIX := SDL_GL_GetProcAddress( 'glTagSampleBufferSGIX'); + + // GL_SGIX_polynomial_ffd + glDeformationMap3dSGIX := SDL_GL_GetProcAddress( 'glDeformationMap3dSGIX'); + glDeformationMap3fSGIX := SDL_GL_GetProcAddress( 'glDeformationMap3fSGIX'); + glDeformSGIX := SDL_GL_GetProcAddress( 'glDeformSGIX'); + glLoadIdentityDeformationMapSGIX := SDL_GL_GetProcAddress( 'glLoadIdentityDeformationMapSGIX'); + + // GL_SGIX_reference_plane + glReferencePlaneSGIX := SDL_GL_GetProcAddress( 'glReferencePlaneSGIX'); + + // GL_SGIX_flush_raster + glFlushRasterSGIX := SDL_GL_GetProcAddress( 'glFlushRasterSGIX'); + + // GL_SGIS_fog_function + glFogFuncSGIS := SDL_GL_GetProcAddress( 'glFogFuncSGIS'); + glGetFogFuncSGIS := SDL_GL_GetProcAddress( 'glGetFogFuncSGIS'); + + // GL_HP_image_transform + glImageTransformParameteriHP := SDL_GL_GetProcAddress( 'glImageTransformParameteriHP'); + glImageTransformParameterfHP := SDL_GL_GetProcAddress( 'glImageTransformParameterfHP'); + glImageTransformParameterivHP := SDL_GL_GetProcAddress( 'glImageTransformParameterivHP'); + glImageTransformParameterfvHP := SDL_GL_GetProcAddress( 'glImageTransformParameterfvHP'); + glGetImageTransformParameterivHP := SDL_GL_GetProcAddress( 'glGetImageTransformParameterivHP'); + glGetImageTransformParameterfvHP := SDL_GL_GetProcAddress( 'glGetImageTransformParameterfvHP'); + + // GL_EXT_color_subtable + glCopyColorSubTableEXT := SDL_GL_GetProcAddress( 'glCopyColorSubTableEXT'); + + // GL_PGI_misc_hints + glHintPGI := SDL_GL_GetProcAddress( 'glHintPGI'); + + // GL_EXT_paletted_texture + glGetColorTableParameterivEXT := SDL_GL_GetProcAddress( 'glGetColorTableParameterivEXT'); + glGetColorTableParameterfvEXT := SDL_GL_GetProcAddress( 'glGetColorTableParameterfvEXT'); + + // GL_SGIX_list_priority + glGetListParameterfvSGIX := SDL_GL_GetProcAddress( 'glGetListParameterfvSGIX'); + glGetListParameterivSGIX := SDL_GL_GetProcAddress( 'glGetListParameterivSGIX'); + glListParameterfSGIX := SDL_GL_GetProcAddress( 'glListParameterfSGIX'); + glListParameterfvSGIX := SDL_GL_GetProcAddress( 'glListParameterfvSGIX'); + glListParameteriSGIX := SDL_GL_GetProcAddress( 'glListParameteriSGIX'); + glListParameterivSGIX := SDL_GL_GetProcAddress( 'glListParameterivSGIX'); + + // GL_SGIX_fragment_lighting + glFragmentColorMaterialSGIX := SDL_GL_GetProcAddress( 'glFragmentColorMaterialSGIX'); + glFragmentLightfSGIX := SDL_GL_GetProcAddress( 'glFragmentLightfSGIX'); + glFragmentLightfvSGIX := SDL_GL_GetProcAddress( 'glFragmentLightfvSGIX'); + glFragmentLightiSGIX := SDL_GL_GetProcAddress( 'glFragmentLightiSGIX'); + glFragmentLightivSGIX := SDL_GL_GetProcAddress( 'glFragmentLightivSGIX'); + glFragmentLightModelfSGIX := SDL_GL_GetProcAddress( 'glFragmentLightModelfSGIX'); + glFragmentLightModelfvSGIX := SDL_GL_GetProcAddress( 'glFragmentLightModelfvSGIX'); + glFragmentLightModeliSGIX := SDL_GL_GetProcAddress( 'glFragmentLightModeliSGIX'); + glFragmentLightModelivSGIX := SDL_GL_GetProcAddress( 'glFragmentLightModelivSGIX'); + glFragmentMaterialfSGIX := SDL_GL_GetProcAddress( 'glFragmentMaterialfSGIX'); + glFragmentMaterialfvSGIX := SDL_GL_GetProcAddress( 'glFragmentMaterialfvSGIX'); + glFragmentMaterialiSGIX := SDL_GL_GetProcAddress( 'glFragmentMaterialiSGIX'); + glFragmentMaterialivSGIX := SDL_GL_GetProcAddress( 'glFragmentMaterialivSGIX'); + glGetFragmentLightfvSGIX := SDL_GL_GetProcAddress( 'glGetFragmentLightfvSGIX'); + glGetFragmentLightivSGIX := SDL_GL_GetProcAddress( 'glGetFragmentLightivSGIX'); + glGetFragmentMaterialfvSGIX := SDL_GL_GetProcAddress( 'glGetFragmentMaterialfvSGIX'); + glGetFragmentMaterialivSGIX := SDL_GL_GetProcAddress( 'glGetFragmentMaterialivSGIX'); + glLightEnviSGIX := SDL_GL_GetProcAddress( 'glLightEnviSGIX'); + + // GL_EXT_draw_range_elements + glDrawRangeElementsEXT := SDL_GL_GetProcAddress( 'glDrawRangeElementsEXT'); + + // GL_EXT_light_texture + glApplyTextureEXT := SDL_GL_GetProcAddress( 'glApplyTextureEXT'); + glTextureLightEXT := SDL_GL_GetProcAddress( 'glTextureLightEXT'); + glTextureMaterialEXT := SDL_GL_GetProcAddress( 'glTextureMaterialEXT'); + + // GL_SGIX_async + glAsyncMarkerSGIX := SDL_GL_GetProcAddress( 'glAsyncMarkerSGIX'); + glFinishAsyncSGIX := SDL_GL_GetProcAddress( 'glFinishAsyncSGIX'); + glPollAsyncSGIX := SDL_GL_GetProcAddress( 'glPollAsyncSGIX'); + glGenAsyncMarkersSGIX := SDL_GL_GetProcAddress( 'glGenAsyncMarkersSGIX'); + glDeleteAsyncMarkersSGIX := SDL_GL_GetProcAddress( 'glDeleteAsyncMarkersSGIX'); + glIsAsyncMarkerSGIX := SDL_GL_GetProcAddress( 'glIsAsyncMarkerSGIX'); + + // GL_INTEL_parallel_arrays + glVertexPointervINTEL := SDL_GL_GetProcAddress( 'glVertexPointervINTEL'); + glNormalPointervINTEL := SDL_GL_GetProcAddress( 'glNormalPointervINTEL'); + glColorPointervINTEL := SDL_GL_GetProcAddress( 'glColorPointervINTEL'); + glTexCoordPointervINTEL := SDL_GL_GetProcAddress( 'glTexCoordPointervINTEL'); + + // GL_EXT_pixel_transform + glPixelTransformParameteriEXT := SDL_GL_GetProcAddress( 'glPixelTransformParameteriEXT'); + glPixelTransformParameterfEXT := SDL_GL_GetProcAddress( 'glPixelTransformParameterfEXT'); + glPixelTransformParameterivEXT := SDL_GL_GetProcAddress( 'glPixelTransformParameterivEXT'); + glPixelTransformParameterfvEXT := SDL_GL_GetProcAddress( 'glPixelTransformParameterfvEXT'); + + // GL_EXT_secondary_color + glSecondaryColor3bEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3bEXT'); + glSecondaryColor3bvEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3bvEXT'); + glSecondaryColor3dEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3dEXT'); + glSecondaryColor3dvEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3dvEXT'); + glSecondaryColor3fEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3fEXT'); + glSecondaryColor3fvEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3fvEXT'); + glSecondaryColor3iEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3iEXT'); + glSecondaryColor3ivEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3ivEXT'); + glSecondaryColor3sEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3sEXT'); + glSecondaryColor3svEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3svEXT'); + glSecondaryColor3ubEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3ubEXT'); + glSecondaryColor3ubvEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3ubvEXT'); + glSecondaryColor3uiEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3uiEXT'); + glSecondaryColor3uivEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3uivEXT'); + glSecondaryColor3usEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3usEXT'); + glSecondaryColor3usvEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3usvEXT'); + glSecondaryColorPointerEXT := SDL_GL_GetProcAddress( 'glSecondaryColorPointerEXT'); + + // GL_EXT_texture_perturb_normal + glTextureNormalEXT := SDL_GL_GetProcAddress( 'glTextureNormalEXT'); + + // GL_EXT_multi_draw_arrays + glMultiDrawArraysEXT := SDL_GL_GetProcAddress( 'glMultiDrawArraysEXT'); + glMultiDrawElementsEXT := SDL_GL_GetProcAddress( 'glMultiDrawElementsEXT'); + + // GL_EXT_fog_coord + glFogCoordfEXT := SDL_GL_GetProcAddress( 'glFogCoordfEXT'); + glFogCoordfvEXT := SDL_GL_GetProcAddress( 'glFogCoordfvEXT'); + glFogCoorddEXT := SDL_GL_GetProcAddress( 'glFogCoorddEXT'); + glFogCoorddvEXT := SDL_GL_GetProcAddress( 'glFogCoorddvEXT'); + glFogCoordPointerEXT := SDL_GL_GetProcAddress( 'glFogCoordPointerEXT'); + + // GL_EXT_coordinate_frame + glTangent3bEXT := SDL_GL_GetProcAddress( 'glTangent3bEXT'); + glTangent3bvEXT := SDL_GL_GetProcAddress( 'glTangent3bvEXT'); + glTangent3dEXT := SDL_GL_GetProcAddress( 'glTangent3dEXT'); + glTangent3dvEXT := SDL_GL_GetProcAddress( 'glTangent3dvEXT'); + glTangent3fEXT := SDL_GL_GetProcAddress( 'glTangent3fEXT'); + glTangent3fvEXT := SDL_GL_GetProcAddress( 'glTangent3fvEXT'); + glTangent3iEXT := SDL_GL_GetProcAddress( 'glTangent3iEXT'); + glTangent3ivEXT := SDL_GL_GetProcAddress( 'glTangent3ivEXT'); + glTangent3sEXT := SDL_GL_GetProcAddress( 'glTangent3sEXT'); + glTangent3svEXT := SDL_GL_GetProcAddress( 'glTangent3svEXT'); + glBinormal3bEXT := SDL_GL_GetProcAddress( 'glBinormal3bEXT'); + glBinormal3bvEXT := SDL_GL_GetProcAddress( 'glBinormal3bvEXT'); + glBinormal3dEXT := SDL_GL_GetProcAddress( 'glBinormal3dEXT'); + glBinormal3dvEXT := SDL_GL_GetProcAddress( 'glBinormal3dvEXT'); + glBinormal3fEXT := SDL_GL_GetProcAddress( 'glBinormal3fEXT'); + glBinormal3fvEXT := SDL_GL_GetProcAddress( 'glBinormal3fvEXT'); + glBinormal3iEXT := SDL_GL_GetProcAddress( 'glBinormal3iEXT'); + glBinormal3ivEXT := SDL_GL_GetProcAddress( 'glBinormal3ivEXT'); + glBinormal3sEXT := SDL_GL_GetProcAddress( 'glBinormal3sEXT'); + glBinormal3svEXT := SDL_GL_GetProcAddress( 'glBinormal3svEXT'); + glTangentPointerEXT := SDL_GL_GetProcAddress( 'glTangentPointerEXT'); + glBinormalPointerEXT := SDL_GL_GetProcAddress( 'glBinormalPointerEXT'); + + // GL_SUNX_constant_data + glFinishTextureSUNX := SDL_GL_GetProcAddress( 'glFinishTextureSUNX'); + + // GL_SUN_global_alpha + glGlobalAlphaFactorbSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactorbSUN'); + glGlobalAlphaFactorsSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactorsSUN'); + glGlobalAlphaFactoriSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactoriSUN'); + glGlobalAlphaFactorfSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactorfSUN'); + glGlobalAlphaFactordSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactordSUN'); + glGlobalAlphaFactorubSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactorubSUN'); + glGlobalAlphaFactorusSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactorusSUN'); + glGlobalAlphaFactoruiSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactoruiSUN'); + + // GL_SUN_triangle_list + glReplacementCodeuiSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiSUN'); + glReplacementCodeusSUN := SDL_GL_GetProcAddress( 'glReplacementCodeusSUN'); + glReplacementCodeubSUN := SDL_GL_GetProcAddress( 'glReplacementCodeubSUN'); + glReplacementCodeuivSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuivSUN'); + glReplacementCodeusvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeusvSUN'); + glReplacementCodeubvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeubvSUN'); + glReplacementCodePointerSUN := SDL_GL_GetProcAddress( 'glReplacementCodePointerSUN'); + + // GL_SUN_vertex + glColor4ubVertex2fSUN := SDL_GL_GetProcAddress( 'glColor4ubVertex2fSUN'); + glColor4ubVertex2fvSUN := SDL_GL_GetProcAddress( 'glColor4ubVertex2fvSUN'); + glColor4ubVertex3fSUN := SDL_GL_GetProcAddress( 'glColor4ubVertex3fSUN'); + glColor4ubVertex3fvSUN := SDL_GL_GetProcAddress( 'glColor4ubVertex3fvSUN'); + glColor3fVertex3fSUN := SDL_GL_GetProcAddress( 'glColor3fVertex3fSUN'); + glColor3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glColor3fVertex3fvSUN'); + glNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glNormal3fVertex3fSUN'); + glNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glNormal3fVertex3fvSUN'); + glColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glColor4fNormal3fVertex3fSUN'); + glColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glColor4fNormal3fVertex3fvSUN'); + glTexCoord2fVertex3fSUN := SDL_GL_GetProcAddress( 'glTexCoord2fVertex3fSUN'); + glTexCoord2fVertex3fvSUN := SDL_GL_GetProcAddress( 'glTexCoord2fVertex3fvSUN'); + glTexCoord4fVertex4fSUN := SDL_GL_GetProcAddress( 'glTexCoord4fVertex4fSUN'); + glTexCoord4fVertex4fvSUN := SDL_GL_GetProcAddress( 'glTexCoord4fVertex4fvSUN'); + glTexCoord2fColor4ubVertex3fSUN := SDL_GL_GetProcAddress( 'glTexCoord2fColor4ubVertex3fSUN'); + glTexCoord2fColor4ubVertex3fvSUN := SDL_GL_GetProcAddress( 'glTexCoord2fColor4ubVertex3fvSUN'); + glTexCoord2fColor3fVertex3fSUN := SDL_GL_GetProcAddress( 'glTexCoord2fColor3fVertex3fSUN'); + glTexCoord2fColor3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glTexCoord2fColor3fVertex3fvSUN'); + glTexCoord2fNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glTexCoord2fNormal3fVertex3fSUN'); + glTexCoord2fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glTexCoord2fNormal3fVertex3fvSUN'); + glTexCoord2fColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glTexCoord2fColor4fNormal3fVertex3fSUN'); + glTexCoord2fColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glTexCoord2fColor4fNormal3fVertex3fvSUN'); + glTexCoord4fColor4fNormal3fVertex4fSUN := SDL_GL_GetProcAddress( 'glTexCoord4fColor4fNormal3fVertex4fSUN'); + glTexCoord4fColor4fNormal3fVertex4fvSUN := SDL_GL_GetProcAddress( 'glTexCoord4fColor4fNormal3fVertex4fvSUN'); + glReplacementCodeuiVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiVertex3fSUN'); + glReplacementCodeuiVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiVertex3fvSUN'); + glReplacementCodeuiColor4ubVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiColor4ubVertex3fSUN'); + glReplacementCodeuiColor4ubVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiColor4ubVertex3fvSUN'); + glReplacementCodeuiColor3fVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiColor3fVertex3fSUN'); + glReplacementCodeuiColor3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiColor3fVertex3fvSUN'); + glReplacementCodeuiNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiNormal3fVertex3fSUN'); + glReplacementCodeuiNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiNormal3fVertex3fvSUN'); + glReplacementCodeuiColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiColor4fNormal3fVertex3fSUN'); + glReplacementCodeuiColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiColor4fNormal3fVertex3fvSUN'); + glReplacementCodeuiTexCoord2fVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiTexCoord2fVertex3fSUN'); + glReplacementCodeuiTexCoord2fVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiTexCoord2fVertex3fvSUN'); + glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN'); + glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN'); + glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN'); + glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN'); + + // GL_EXT_blend_func_separate + glBlendFuncSeparateEXT := SDL_GL_GetProcAddress( 'glBlendFuncSeparateEXT'); + + // GL_EXT_vertex_weighting + glVertexWeightfEXT := SDL_GL_GetProcAddress( 'glVertexWeightfEXT'); + glVertexWeightfvEXT := SDL_GL_GetProcAddress( 'glVertexWeightfvEXT'); + glVertexWeightPointerEXT := SDL_GL_GetProcAddress( 'glVertexWeightPointerEXT'); + + // GL_NV_vertex_array_range + glFlushVertexArrayRangeNV := SDL_GL_GetProcAddress( 'glFlushVertexArrayRangeNV'); + glVertexArrayRangeNV := SDL_GL_GetProcAddress( 'glVertexArrayRangeNV'); + wglAllocateMemoryNV := SDL_GL_GetProcAddress( 'wglAllocateMemoryNV'); + wglFreeMemoryNV := SDL_GL_GetProcAddress( 'wglFreeMemoryNV'); + + // GL_NV_register_combiners + glCombinerParameterfvNV := SDL_GL_GetProcAddress( 'glCombinerParameterfvNV'); + glCombinerParameterfNV := SDL_GL_GetProcAddress( 'glCombinerParameterfNV'); + glCombinerParameterivNV := SDL_GL_GetProcAddress( 'glCombinerParameterivNV'); + glCombinerParameteriNV := SDL_GL_GetProcAddress( 'glCombinerParameteriNV'); + glCombinerInputNV := SDL_GL_GetProcAddress( 'glCombinerInputNV'); + glCombinerOutputNV := SDL_GL_GetProcAddress( 'glCombinerOutputNV'); + glFinalCombinerInputNV := SDL_GL_GetProcAddress( 'glFinalCombinerInputNV'); + glGetCombinerInputParameterfvNV := SDL_GL_GetProcAddress( 'glGetCombinerInputParameterfvNV'); + glGetCombinerInputParameterivNV := SDL_GL_GetProcAddress( 'glGetCombinerInputParameterivNV'); + glGetCombinerOutputParameterfvNV := SDL_GL_GetProcAddress( 'glGetCombinerOutputParameterfvNV'); + glGetCombinerOutputParameterivNV := SDL_GL_GetProcAddress( 'glGetCombinerOutputParameterivNV'); + glGetFinalCombinerInputParameterfvNV := SDL_GL_GetProcAddress( 'glGetFinalCombinerInputParameterfvNV'); + glGetFinalCombinerInputParameterivNV := SDL_GL_GetProcAddress( 'glGetFinalCombinerInputParameterivNV'); + + // GL_MESA_resize_buffers + glResizeBuffersMESA := SDL_GL_GetProcAddress( 'glResizeBuffersMESA'); + + // GL_MESA_window_pos + glWindowPos2dMESA := SDL_GL_GetProcAddress( 'glWindowPos2dMESA'); + glWindowPos2dvMESA := SDL_GL_GetProcAddress( 'glWindowPos2dvMESA'); + glWindowPos2fMESA := SDL_GL_GetProcAddress( 'glWindowPos2fMESA'); + glWindowPos2fvMESA := SDL_GL_GetProcAddress( 'glWindowPos2fvMESA'); + glWindowPos2iMESA := SDL_GL_GetProcAddress( 'glWindowPos2iMESA'); + glWindowPos2ivMESA := SDL_GL_GetProcAddress( 'glWindowPos2ivMESA'); + glWindowPos2sMESA := SDL_GL_GetProcAddress( 'glWindowPos2sMESA'); + glWindowPos2svMESA := SDL_GL_GetProcAddress( 'glWindowPos2svMESA'); + glWindowPos3dMESA := SDL_GL_GetProcAddress( 'glWindowPos3dMESA'); + glWindowPos3dvMESA := SDL_GL_GetProcAddress( 'glWindowPos3dvMESA'); + glWindowPos3fMESA := SDL_GL_GetProcAddress( 'glWindowPos3fMESA'); + glWindowPos3fvMESA := SDL_GL_GetProcAddress( 'glWindowPos3fvMESA'); + glWindowPos3iMESA := SDL_GL_GetProcAddress( 'glWindowPos3iMESA'); + glWindowPos3ivMESA := SDL_GL_GetProcAddress( 'glWindowPos3ivMESA'); + glWindowPos3sMESA := SDL_GL_GetProcAddress( 'glWindowPos3sMESA'); + glWindowPos3svMESA := SDL_GL_GetProcAddress( 'glWindowPos3svMESA'); + glWindowPos4dMESA := SDL_GL_GetProcAddress( 'glWindowPos4dMESA'); + glWindowPos4dvMESA := SDL_GL_GetProcAddress( 'glWindowPos4dvMESA'); + glWindowPos4fMESA := SDL_GL_GetProcAddress( 'glWindowPos4fMESA'); + glWindowPos4fvMESA := SDL_GL_GetProcAddress( 'glWindowPos4fvMESA'); + glWindowPos4iMESA := SDL_GL_GetProcAddress( 'glWindowPos4iMESA'); + glWindowPos4ivMESA := SDL_GL_GetProcAddress( 'glWindowPos4ivMESA'); + glWindowPos4sMESA := SDL_GL_GetProcAddress( 'glWindowPos4sMESA'); + glWindowPos4svMESA := SDL_GL_GetProcAddress( 'glWindowPos4svMESA'); + + // GL_IBM_multimode_draw_arrays + glMultiModeDrawArraysIBM := SDL_GL_GetProcAddress( 'glMultiModeDrawArraysIBM'); + glMultiModeDrawElementsIBM := SDL_GL_GetProcAddress( 'glMultiModeDrawElementsIBM'); + + // GL_IBM_vertex_array_lists + glColorPointerListIBM := SDL_GL_GetProcAddress( 'glColorPointerListIBM'); + glSecondaryColorPointerListIBM := SDL_GL_GetProcAddress( 'glSecondaryColorPointerListIBM'); + glEdgeFlagPointerListIBM := SDL_GL_GetProcAddress( 'glEdgeFlagPointerListIBM'); + glFogCoordPointerListIBM := SDL_GL_GetProcAddress( 'glFogCoordPointerListIBM'); + glIndexPointerListIBM := SDL_GL_GetProcAddress( 'glIndexPointerListIBM'); + glNormalPointerListIBM := SDL_GL_GetProcAddress( 'glNormalPointerListIBM'); + glTexCoordPointerListIBM := SDL_GL_GetProcAddress( 'glTexCoordPointerListIBM'); + glVertexPointerListIBM := SDL_GL_GetProcAddress( 'glVertexPointerListIBM'); + + // GL_3DFX_tbuffer + glTbufferMask3DFX := SDL_GL_GetProcAddress( 'glTbufferMask3DFX'); + + // GL_EXT_multisample + glSampleMaskEXT := SDL_GL_GetProcAddress( 'glSampleMaskEXT'); + glSamplePatternEXT := SDL_GL_GetProcAddress( 'glSamplePatternEXT'); + + // GL_SGIS_texture_color_mask + glTextureColorMaskSGIS := SDL_GL_GetProcAddress( 'glTextureColorMaskSGIS'); + + // GL_SGIX_igloo_interface + glIglooInterfaceSGIX := SDL_GL_GetProcAddress( 'glIglooInterfaceSGIX'); + + // GLU extensions + gluNurbsCallbackDataEXT := SDL_GL_GetProcAddress( 'gluNurbsCallbackDataEXT'); + gluNewNurbsTessellatorEXT := SDL_GL_GetProcAddress( 'gluNewNurbsTessellatorEXT'); + gluDeleteNurbsTessellatorEXT := SDL_GL_GetProcAddress( 'gluDeleteNurbsTessellatorEXT'); + + // GL_NV_vertex_program + glAreProgramsResidentNV := SDL_GL_GetProcAddress( 'glAreProgramsResidentNV'); + glBindProgramNV := SDL_GL_GetProcAddress( 'glBindProgramNV'); + glDeleteProgramsNV := SDL_GL_GetProcAddress( 'glDeleteProgramsNV'); + glExecuteProgramNV := SDL_GL_GetProcAddress( 'glExecuteProgramNV'); + glGenProgramsNV := SDL_GL_GetProcAddress( 'glGenProgramsNV'); + glGetProgramParameterdvNV := SDL_GL_GetProcAddress( 'glGetProgramParameterdvNV'); + glGetProgramParameterfvNV := SDL_GL_GetProcAddress( 'glGetProgramParameterfvNV'); + glGetProgramivNV := SDL_GL_GetProcAddress( 'glGetProgramivNV'); + glGetProgramStringNV := SDL_GL_GetProcAddress( 'glGetProgramStringNV'); + glGetTrackMatrixivNV := SDL_GL_GetProcAddress( 'glGetTrackMatrixivNV'); + glGetVertexAttribdvNV:= SDL_GL_GetProcAddress( 'glGetVertexAttribdvNV'); + glGetVertexAttribfvNV:= SDL_GL_GetProcAddress( 'glGetVertexAttribfvNV'); + glGetVertexAttribivNV:= SDL_GL_GetProcAddress( 'glGetVertexAttribivNV'); + glGetVertexAttribPointervNV := wglGetProcAddress ('glGetVertexAttribPointervNV'); + glIsProgramNV := SDL_GL_GetProcAddress( 'glIsProgramNV'); + glLoadProgramNV := SDL_GL_GetProcAddress( 'glLoadProgramNV'); + glProgramParameter4dNV := SDL_GL_GetProcAddress( 'glProgramParameter4dNV'); + glProgramParameter4dvNV := SDL_GL_GetProcAddress( 'glProgramParameter4dvNV'); + glProgramParameter4fNV := SDL_GL_GetProcAddress( 'glProgramParameter4fNV'); + glProgramParameter4fvNV := SDL_GL_GetProcAddress( 'glProgramParameter4fvNV'); + glProgramParameters4dvNV := wglGetProcAddress ('glProgramParameters4dvNV'); + glProgramParameters4fvNV := wglGetProcAddress ('glProgramParameters4fvNV'); + glRequestResidentProgramsNV := wglGetProcAddress ('glRequestResidentProgramsNV'); + glTrackMatrixNV := SDL_GL_GetProcAddress( 'glTrackMatrixNV'); + glVertexAttribPointerNV := SDL_GL_GetProcAddress( 'glVertexAttribPointerNV'); + glVertexAttrib1dNV := SDL_GL_GetProcAddress( 'glVertexAttrib1dNV'); + glVertexAttrib1dvNV := SDL_GL_GetProcAddress( 'glVertexAttrib1dvNV'); + glVertexAttrib1fNV := SDL_GL_GetProcAddress( 'glVertexAttrib1fNV'); + glVertexAttrib1fvNV := SDL_GL_GetProcAddress( 'glVertexAttrib1fvNV'); + glVertexAttrib1sNV := SDL_GL_GetProcAddress( 'glVertexAttrib1sNV'); + glVertexAttrib1svNV := SDL_GL_GetProcAddress( 'glVertexAttrib1svNV'); + glVertexAttrib2dNV := SDL_GL_GetProcAddress( 'glVertexAttrib2dNV'); + glVertexAttrib2dvNV := SDL_GL_GetProcAddress( 'glVertexAttrib2dvNV'); + glVertexAttrib2fNV := SDL_GL_GetProcAddress( 'glVertexAttrib2fNV'); + glVertexAttrib2fvNV := SDL_GL_GetProcAddress( 'glVertexAttrib2fvNV'); + glVertexAttrib2sNV := SDL_GL_GetProcAddress( 'glVertexAttrib2sNV'); + glVertexAttrib2svNV := SDL_GL_GetProcAddress( 'glVertexAttrib2svNV'); + glVertexAttrib3dNV := SDL_GL_GetProcAddress( 'glVertexAttrib3dNV'); + glVertexAttrib3dvNV := SDL_GL_GetProcAddress( 'glVertexAttrib3dvNV'); + glVertexAttrib3fNV := SDL_GL_GetProcAddress( 'glVertexAttrib3fNV'); + glVertexAttrib3fvNV := SDL_GL_GetProcAddress( 'glVertexAttrib3fvNV'); + glVertexAttrib3sNV := SDL_GL_GetProcAddress( 'glVertexAttrib3sNV'); + glVertexAttrib3svNV := SDL_GL_GetProcAddress( 'glVertexAttrib3svNV'); + glVertexAttrib4dNV := SDL_GL_GetProcAddress( 'glVertexAttrib4dNV'); + glVertexAttrib4dvNV := SDL_GL_GetProcAddress( 'glVertexAttrib4dvNV'); + glVertexAttrib4fNV := SDL_GL_GetProcAddress( 'glVertexAttrib4fNV'); + glVertexAttrib4fvNV := SDL_GL_GetProcAddress( 'glVertexAttrib4fvNV'); + glVertexAttrib4sNV := SDL_GL_GetProcAddress( 'glVertexAttrib4sNV'); + glVertexAttrib4svNV := SDL_GL_GetProcAddress( 'glVertexAttrib4svNV'); + glVertexAttrib4ubvNV := SDL_GL_GetProcAddress( 'glVertexAttrib4ubvNV'); + glVertexAttribs1dvNV := SDL_GL_GetProcAddress( 'glVertexAttribs1dvNV'); + glVertexAttribs1fvNV := SDL_GL_GetProcAddress( 'glVertexAttribs1fvNV'); + glVertexAttribs1svNV := SDL_GL_GetProcAddress( 'glVertexAttribs1svNV'); + glVertexAttribs2dvNV := SDL_GL_GetProcAddress( 'glVertexAttribs2dvNV'); + glVertexAttribs2fvNV := SDL_GL_GetProcAddress( 'glVertexAttribs2fvNV'); + glVertexAttribs2svNV := SDL_GL_GetProcAddress( 'glVertexAttribs2svNV'); + glVertexAttribs3dvNV := SDL_GL_GetProcAddress( 'glVertexAttribs3dvNV'); + glVertexAttribs3fvNV := SDL_GL_GetProcAddress( 'glVertexAttribs3fvNV'); + glVertexAttribs3svNV := SDL_GL_GetProcAddress( 'glVertexAttribs3svNV'); + glVertexAttribs4dvNV := SDL_GL_GetProcAddress( 'glVertexAttribs4dvNV'); + glVertexAttribs4fvNV := SDL_GL_GetProcAddress( 'glVertexAttribs4fvNV'); + glVertexAttribs4svNV := SDL_GL_GetProcAddress( 'glVertexAttribs4svNV'); + glVertexAttribs4ubvNV := SDL_GL_GetProcAddress( 'glVertexAttribs4ubvN'); + + // ARB wgl extensions + wglGetExtensionsStringARB := SDL_GL_GetProcAddress( 'wglGetExtensionsStringARB'); + wglGetPixelFormatAttribivARB := SDL_GL_GetProcAddress( 'wglGetPixelFormatAttribivARB'); + wglGetPixelFormatAttribfvARB := SDL_GL_GetProcAddress( 'wglGetPixelFormatAttribfvARB'); + wglChoosePixelFormatARB := SDL_GL_GetProcAddress( 'wglChoosePixelFormatARB'); + + // To get synchronized again, if this proc was called externally. + LastPixelFormat := 0; + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure TrimAndSplitVersionString(Buffer: String; var Max, Min: Integer); + +// Peels out the X.Y form from the given Buffer which must contain a version string like "text Minor.Major.Build text" +// at least however "Major.Minor". + +var + Separator: Integer; + +begin + try + // There must be at least one dot to separate major and minor version number. + Separator := Pos('.', Buffer); + // At least one number must be before and one after the dot. + if (Separator > 1) and (Separator < Length(Buffer)) and (Buffer[Separator - 1] in ['0'..'9']) and + (Buffer[Separator + 1] in ['0'..'9']) then + begin + // OK, it's a valid version string. Now remove unnecessary parts. + Dec(Separator); + // Find last non-numeric character before version number. + while (Separator > 0) and (Buffer[Separator] in ['0'..'9']) do + Dec(Separator); + // Delete leading characters which do not belong to the version string. + Delete(Buffer, 1, Separator); + Separator := Pos('.', Buffer) + 1; + // Find first non-numeric character after version number + while (Separator <= Length(Buffer)) and (Buffer[Separator] in ['0'..'9']) do + Inc(Separator); + // delete trailing characters not belonging to the version string + Delete(Buffer, Separator, 255); + // Now translate the numbers. + Separator := Pos('.', Buffer); // This is necessary because the buffer length might have changed. + Max := StrToInt(Copy(Buffer, 1, Separator - 1)); + Min := StrToInt(Copy(Buffer, Separator + 1, 255)); + end + else + Abort; + except + Min := 0; + Max := 0; + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure ReadImplementationProperties; + +var + Buffer: string; + MajorVersion, + MinorVersion: Integer; + + //--------------- local function -------------------------------------------- + + function CheckExtension(const Extension: string): Boolean; + + // Checks if the given Extension string is in Buffer. + + var + ExtPos: Integer; + + begin + // First find the position of the extension string as substring in Buffer. + ExtPos := Pos(Extension, Buffer); + Result := ExtPos > 0; + // Now check that it isn't only a substring of another extension. + if Result then + Result := ((ExtPos + Length(Extension) - 1) = Length(Buffer)) or + not (Buffer[ExtPos + Length(Extension)] in ['_', 'A'..'Z', 'a'..'z']); + end; + + //--------------- end local function ---------------------------------------- + +begin + // determine version of implementation + // GL + Buffer := glGetString(GL_VERSION); + TrimAndSplitVersionString(Buffer, Majorversion, MinorVersion); + GL_VERSION_1_0 := True; + GL_VERSION_1_1 := False; + GL_VERSION_1_2 := False; + if MajorVersion > 0 then + begin + if MinorVersion > 0 then + begin + GL_VERSION_1_1 := True; + if MinorVersion > 1 then + GL_VERSION_1_2 := True; + end; + end; + + // GLU + GLU_VERSION_1_1 := False; + GLU_VERSION_1_2 := False; + GLU_VERSION_1_3 := False; + // gluGetString is valid for version 1.1 or later + if Assigned(gluGetString) then + begin + Buffer := gluGetString(GLU_VERSION); + TrimAndSplitVersionString(Buffer, Majorversion, MinorVersion); + GLU_VERSION_1_1 := True; + if MinorVersion > 1 then + begin + GLU_VERSION_1_2 := True; + if MinorVersion > 2 then + GLU_VERSION_1_3 := True; + end; + end; + + // check supported extensions + // GL + Buffer := glGetString(GL_EXTENSIONS); + GL_3DFX_multisample :=CheckExtension('GL_3DFX_multisample'); + GL_3DFX_tbuffer := CheckExtension('GL_3DFX_tbuffer'); + GL_3DFX_texture_compression_FXT1 := CheckExtension('GL_3DFX_texture_compression_FXT1'); + + GL_APPLE_specular_vector := CheckExtension('GL_APPLE_specular_vector'); + GL_APPLE_transform_hint := CheckExtension('GL_APPLE_transform_hint'); + + GL_ARB_imaging := CheckExtension('GL_ARB_imaging'); + GL_ARB_multisample := CheckExtension('GL_ARB_multisample'); + GL_ARB_multitexture := CheckExtension('GL_ARB_multitexture'); + GL_ARB_texture_compression := CheckExtension('GL_ARB_texture_compression'); + GL_ARB_texture_cube_map := CheckExtension('GL_ARB_texture_cube_map'); + GL_ARB_transpose_matrix := CheckExtension('GL_ARB_transpose_matrix'); + GL_ARB_vertex_blend := CheckExtension('GL_ARB_vertex_blend'); + + GL_EXT_422_pixels := CheckExtension('GL_EXT_422_pixels'); + GL_EXT_abgr := CheckExtension('GL_EXT_abgr'); + GL_EXT_bgra := CheckExtension('GL_EXT_bgra'); + GL_EXT_blend_color := CheckExtension('GL_EXT_blend_color'); + GL_EXT_blend_func_separate := CheckExtension('GL_EXT_blend_func_separate'); + GL_EXT_blend_logic_op := CheckExtension('GL_EXT_blend_logic_op'); + GL_EXT_blend_minmax := CheckExtension('GL_EXT_blend_minmax'); + GL_EXT_blend_subtract := CheckExtension('GL_EXT_blend_subtract'); + GL_EXT_clip_volume_hint := CheckExtension('GL_EXT_clip_volume_hint'); + GL_EXT_cmyka := CheckExtension('GL_EXT_cmyka'); + GL_EXT_color_subtable := CheckExtension('GL_EXT_color_subtable'); + GL_EXT_compiled_vertex_array := CheckExtension('GL_EXT_compiled_vertex_array'); + GL_EXT_convolution := CheckExtension('GL_EXT_convolution'); + GL_EXT_coordinate_frame := CheckExtension('GL_EXT_coordinate_frame'); + GL_EXT_copy_texture := CheckExtension('GL_EXT_copy_texture'); + GL_EXT_cull_vertex := CheckExtension('GL_EXT_cull_vertex'); + GL_EXT_draw_range_elements := CheckExtension('GL_EXT_draw_range_elements'); + GL_EXT_fog_coord := CheckExtension('GL_EXT_fog_coord'); + GL_EXT_histogram := CheckExtension('GL_EXT_histogram'); + GL_EXT_index_array_formats := CheckExtension('GL_EXT_index_array_formats'); + GL_EXT_index_func := CheckExtension('GL_EXT_index_func'); + GL_EXT_index_material := CheckExtension('GL_EXT_index_material'); + GL_EXT_index_texture := CheckExtension('GL_EXT_index_texture'); + GL_EXT_light_max_exponent := CheckExtension('GL_EXT_light_max_exponent'); + GL_EXT_light_texture := CheckExtension('GL_EXT_light_texture'); + GL_EXT_misc_attribute := CheckExtension('GL_EXT_misc_attribute'); + GL_EXT_multi_draw_arrays := CheckExtension('GL_EXT_multi_draw_arrays'); + GL_EXT_multisample := CheckExtension('GL_EXT_multisample'); + GL_EXT_packed_pixels := CheckExtension('GL_EXT_packed_pixels'); + GL_EXT_paletted_texture := CheckExtension('GL_EXT_paletted_texture'); + GL_EXT_pixel_transform := CheckExtension('GL_EXT_pixel_transform'); + GL_EXT_point_parameters := CheckExtension('GL_EXT_point_parameters'); + GL_EXT_polygon_offset := CheckExtension('GL_EXT_polygon_offset'); + GL_EXT_rescale_normal := CheckExtension('GL_EXT_rescale_normal'); + GL_EXT_scene_marker := CheckExtension('GL_EXT_scene_marker'); + GL_EXT_secondary_color := CheckExtension('GL_EXT_secondary_color'); + GL_EXT_separate_specular_color := CheckExtension('GL_EXT_separate_specular_color'); + GL_EXT_shared_texture_palette := CheckExtension('GL_EXT_shared_texture_palette'); + GL_EXT_stencil_wrap := CheckExtension('GL_EXT_stencil_wrap'); + GL_EXT_subtexture := CheckExtension('GL_EXT_subtexture'); + GL_EXT_texture_color_table := CheckExtension('GL_EXT_texture_color_table'); + GL_EXT_texture_compression_s3tc := CheckExtension('GL_EXT_texture_compression_s3tc'); + GL_EXT_texture_cube_map := CheckExtension('GL_EXT_texture_cube_map'); + GL_EXT_texture_edge_clamp := CheckExtension('GL_EXT_texture_edge_clamp'); + GL_EXT_texture_env_add := CheckExtension('GL_EXT_texture_env_add'); + GL_EXT_texture_env_combine := CheckExtension('GL_EXT_texture_env_combine'); + GL_EXT_texture_filter_anisotropic := CheckExtension('GL_EXT_texture_filter_anisotropic'); + GL_EXT_texture_lod_bias := CheckExtension('GL_EXT_texture_lod_bias'); + GL_EXT_texture_object := CheckExtension('GL_EXT_texture_object'); + GL_EXT_texture_perturb_normal := CheckExtension('GL_EXT_texture_perturb_normal'); + GL_EXT_texture3D := CheckExtension('GL_EXT_texture3D'); + GL_EXT_vertex_array := CheckExtension('GL_EXT_vertex_array'); + GL_EXT_vertex_weighting := CheckExtension('GL_EXT_vertex_weighting'); + + GL_FfdMaskSGIX := CheckExtension('GL_FfdMaskSGIX'); + GL_HP_convolution_border_modes := CheckExtension('GL_HP_convolution_border_modes'); + GL_HP_image_transform := CheckExtension('GL_HP_image_transform'); + GL_HP_occlusion_test := CheckExtension('GL_HP_occlusion_test'); + GL_HP_texture_lighting := CheckExtension('GL_HP_texture_lighting'); + + GL_IBM_cull_vertex := CheckExtension('GL_IBM_cull_vertex'); + GL_IBM_multimode_draw_arrays := CheckExtension('GL_IBM_multimode_draw_arrays'); + GL_IBM_rasterpos_clip := CheckExtension('GL_IBM_rasterpos_clip'); + GL_IBM_vertex_array_lists := CheckExtension('GL_IBM_vertex_array_lists'); + + GL_INGR_color_clamp := CheckExtension('GL_INGR_color_clamp'); + GL_INGR_interlace_read := CheckExtension('GL_INGR_interlace_read'); + + GL_INTEL_parallel_arrays := CheckExtension('GL_INTEL_parallel_arrays'); + + GL_KTX_buffer_region := CheckExtension('GL_KTX_buffer_region'); + + GL_MESA_resize_buffers := CheckExtension('GL_MESA_resize_buffers'); + GL_MESA_window_pos := CheckExtension('GL_MESA_window_pos'); + + GL_NV_blend_square := CheckExtension('GL_NV_blend_square'); + GL_NV_fog_distance := CheckExtension('GL_NV_fog_distance'); + GL_NV_light_max_exponent := CheckExtension('GL_NV_light_max_exponent'); + GL_NV_register_combiners := CheckExtension('GL_NV_register_combiners'); + GL_NV_texgen_emboss := CheckExtension('GL_NV_texgen_emboss'); + GL_NV_texgen_reflection := CheckExtension('GL_NV_texgen_reflection'); + GL_NV_texture_env_combine4 := CheckExtension('GL_NV_texture_env_combine4'); + GL_NV_vertex_array_range := CheckExtension('GL_NV_vertex_array_range'); + GL_NV_vertex_program := CheckExtension('GL_NV_vertex_program'); + + GL_PGI_misc_hints := CheckExtension('GL_PGI_misc_hints'); + GL_PGI_vertex_hints := CheckExtension('GL_PGI_vertex_hints'); + + GL_REND_screen_coordinates := CheckExtension('GL_REND_screen_coordinates'); + + GL_SGI_color_matrix := CheckExtension('GL_SGI_color_matrix'); + GL_SGI_color_table := CheckExtension('GL_SGI_color_table'); + GL_SGI_depth_pass_instrument := CheckExtension('GL_SGI_depth_pass_instrument'); + + GL_SGIS_detail_texture := CheckExtension('GL_SGIS_detail_texture'); + GL_SGIS_fog_function := CheckExtension('GL_SGIS_fog_function'); + GL_SGIS_generate_mipmap := CheckExtension('GL_SGIS_generate_mipmap'); + GL_SGIS_multisample := CheckExtension('GL_SGIS_multisample'); + GL_SGIS_multitexture := CheckExtension('GL_SGIS_multitexture'); + GL_SGIS_pixel_texture := CheckExtension('GL_SGIS_pixel_texture'); + GL_SGIS_point_line_texgen := CheckExtension('GL_SGIS_point_line_texgen'); + GL_SGIS_point_parameters := CheckExtension('GL_SGIS_point_parameters'); + GL_SGIS_sharpen_texture := CheckExtension('GL_SGIS_sharpen_texture'); + GL_SGIS_texture_border_clamp := CheckExtension('GL_SGIS_texture_border_clamp'); + GL_SGIS_texture_color_mask := CheckExtension('GL_SGIS_texture_color_mask'); + GL_SGIS_texture_edge_clamp := CheckExtension('GL_SGIS_texture_edge_clamp'); + GL_SGIS_texture_filter4 := CheckExtension('GL_SGIS_texture_filter4'); + GL_SGIS_texture_lod := CheckExtension('GL_SGIS_texture_lod'); + GL_SGIS_texture_select := CheckExtension('GL_SGIS_texture_select'); + GL_SGIS_texture4D := CheckExtension('GL_SGIS_texture4D'); + + GL_SGIX_async := CheckExtension('GL_SGIX_async'); + GL_SGIX_async_histogram := CheckExtension('GL_SGIX_async_histogram'); + GL_SGIX_async_pixel := CheckExtension('GL_SGIX_async_pixel'); + GL_SGIX_blend_alpha_minmax := CheckExtension('GL_SGIX_blend_alpha_minmax'); + GL_SGIX_calligraphic_fragment := CheckExtension('GL_SGIX_calligraphic_fragment'); + GL_SGIX_clipmap := CheckExtension('GL_SGIX_clipmap'); + GL_SGIX_convolution_accuracy := CheckExtension('GL_SGIX_convolution_accuracy'); + GL_SGIX_depth_texture := CheckExtension('GL_SGIX_depth_texture'); + GL_SGIX_flush_raster := CheckExtension('GL_SGIX_flush_raster'); + GL_SGIX_fog_offset := CheckExtension('GL_SGIX_fog_offset'); + GL_SGIX_fog_scale := CheckExtension('GL_SGIX_fog_scale'); + GL_SGIX_fragment_lighting := CheckExtension('GL_SGIX_fragment_lighting'); + GL_SGIX_framezoom := CheckExtension('GL_SGIX_framezoom'); + GL_SGIX_igloo_interface := CheckExtension('GL_SGIX_igloo_interface'); + GL_SGIX_instruments := CheckExtension('GL_SGIX_instruments'); + GL_SGIX_interlace := CheckExtension('GL_SGIX_interlace'); + GL_SGIX_ir_instrument1 := CheckExtension('GL_SGIX_ir_instrument1'); + GL_SGIX_list_priority := CheckExtension('GL_SGIX_list_priority'); + GL_SGIX_pixel_texture := CheckExtension('GL_SGIX_pixel_texture'); + GL_SGIX_pixel_tiles := CheckExtension('GL_SGIX_pixel_tiles'); + GL_SGIX_polynomial_ffd := CheckExtension('GL_SGIX_polynomial_ffd'); + GL_SGIX_reference_plane := CheckExtension('GL_SGIX_reference_plane'); + GL_SGIX_resample := CheckExtension('GL_SGIX_resample'); + GL_SGIX_shadow := CheckExtension('GL_SGIX_shadow'); + GL_SGIX_shadow_ambient := CheckExtension('GL_SGIX_shadow_ambient'); + GL_SGIX_sprite := CheckExtension('GL_SGIX_sprite'); + GL_SGIX_subsample := CheckExtension('GL_SGIX_subsample'); + GL_SGIX_tag_sample_buffer := CheckExtension('GL_SGIX_tag_sample_buffer'); + GL_SGIX_texture_add_env := CheckExtension('GL_SGIX_texture_add_env'); + GL_SGIX_texture_lod_bias := CheckExtension('GL_SGIX_texture_lod_bias'); + GL_SGIX_texture_multi_buffer := CheckExtension('GL_SGIX_texture_multi_buffer'); + GL_SGIX_texture_scale_bias := CheckExtension('GL_SGIX_texture_scale_bias'); + GL_SGIX_vertex_preclip := CheckExtension('GL_SGIX_vertex_preclip'); + GL_SGIX_ycrcb := CheckExtension('GL_SGIX_ycrcb'); + GL_SGIX_ycrcba := CheckExtension('GL_SGIX_ycrcba'); + + GL_SUN_convolution_border_modes := CheckExtension('GL_SUN_convolution_border_modes'); + GL_SUN_global_alpha := CheckExtension('GL_SUN_global_alpha'); + GL_SUN_triangle_list := CheckExtension('GL_SUN_triangle_list'); + GL_SUN_vertex := CheckExtension('GL_SUN_vertex'); + + GL_SUNX_constant_data := CheckExtension('GL_SUNX_constant_data'); + + GL_WIN_phong_shading := CheckExtension('GL_WIN_phong_shading'); + GL_WIN_specular_fog := CheckExtension('GL_WIN_specular_fog'); + GL_WIN_swap_hint := CheckExtension('GL_WIN_swap_hint'); + + WGL_EXT_swap_control := CheckExtension('WGL_EXT_swap_control'); + WGL_ARB_extensions_string := CheckExtension('WGL_ARB_extensions_string'); + WGL_ARB_pixel_format := CheckExtension('WGL_ARB_pixel_format'); + + // GLU + Buffer := gluGetString(GLU_EXTENSIONS); + GLU_EXT_TEXTURE := CheckExtension('GLU_EXT_TEXTURE'); + GLU_EXT_object_space_tess := CheckExtension('GLU_EXT_object_space_tess'); + GLU_EXT_nurbs_tessellator := CheckExtension('GLU_EXT_nurbs_tessellator'); + + // ARB wgl extensions + if Assigned(wglGetExtensionsStringARB) then + begin + Buffer := wglGetExtensionsStringARB(wglGetCurrentDC); + WGL_ARB_extensions_string := CheckExtension('WGL_ARB_extensions_string'); + WGL_ARB_pixel_format := CheckExtension('WGL_ARB_pixel_format'); + end + else + begin + WGL_ARB_extensions_string := False; + WGL_ARB_pixel_format := False; + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function SetupPalette(DC: HDC; PFD: TPixelFormatDescriptor): HPalette; + +var + nColors, + I: Integer; + LogPalette: TMaxLogPalette; + RedMask, + GreenMask, + BlueMask: Byte; + +begin + nColors := 1 shl Pfd.cColorBits; + LogPalette.palVersion := $300; + LogPalette.palNumEntries := nColors; + RedMask := (1 shl Pfd.cRedBits ) - 1; + GreenMask := (1 shl Pfd.cGreenBits) - 1; + BlueMask := (1 shl Pfd.cBlueBits ) - 1; + with LogPalette, PFD do + for I := 0 to nColors - 1 do + begin + palPalEntry[I].peRed := (((I shr cRedShift ) and RedMask ) * 255) div RedMask; + palPalEntry[I].peGreen := (((I shr cGreenShift) and GreenMask) * 255) div GreenMask; + palPalEntry[I].peBlue := (((I shr cBlueShift ) and BlueMask ) * 255) div BlueMask; + palPalEntry[I].peFlags := 0; + end; + + Result := CreatePalette(PLogPalette(@LogPalette)^); + if Result <> 0 then + begin + SelectPalette(DC, Result, False); + RealizePalette(DC); + end + else + RaiseLastOSError; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function CreateRenderingContext(DC: HDC; Options: TRCOptions; ColorBits, StencilBits, AccumBits, AuxBuffers: Integer; + Layer: Integer; var Palette: HPALETTE): HGLRC; + +// Set the OpenGL properties required to draw to the given canvas and create a rendering context for it. + +const + MemoryDCs = [OBJ_MEMDC, OBJ_METADC, OBJ_ENHMETADC]; + +var + PFDescriptor: TPixelFormatDescriptor; + PixelFormat: Integer; + AType: DWORD; + +begin + FillChar(PFDescriptor, SizeOf(PFDescriptor), 0); + with PFDescriptor do + begin + nSize := SizeOf(PFDescriptor); + nVersion := 1; + dwFlags := PFD_SUPPORT_OPENGL; + AType := GetObjectType(DC); + if AType = 0 then + RaiseLastOSError; + + if AType in MemoryDCs then + dwFlags := dwFlags or PFD_DRAW_TO_BITMAP + else + dwFlags := dwFlags or PFD_DRAW_TO_WINDOW; + if opDoubleBuffered in Options then + dwFlags := dwFlags or PFD_DOUBLEBUFFER; + if opGDI in Options then + dwFlags := dwFlags or PFD_SUPPORT_GDI; + if opStereo in Options then + dwFlags := dwFlags or PFD_STEREO; + iPixelType := PFD_TYPE_RGBA; + cColorBits := ColorBits; + cDepthBits := 32; + cStencilBits := StencilBits; + cAccumBits := AccumBits; + cAuxBuffers := AuxBuffers; + if Layer = 0 then + iLayerType := PFD_MAIN_PLANE + else + if Layer > 0 then + iLayerType := PFD_OVERLAY_PLANE + else + iLayerType := Byte(PFD_UNDERLAY_PLANE); + end; + + // Just in case it didn't happen already. + if not InitOpenGL then + RaiseLastOSError; + PixelFormat := ChoosePixelFormat(DC, {$ifndef FPC}@{$endif}PFDescriptor); + if PixelFormat = 0 then + RaiseLastOSError; + + // NOTE: It is not allowed to change a pixel format of a device context once it has been set. + // Hence you may create more than one rendering context for one single device only if it + // uses the same pixel format as the first created RC. + if GetPixelFormat(DC) <> PixelFormat then + begin + if not SetPixelFormat(DC, PixelFormat, @PFDescriptor) then + RaiseLastOSError; + end; + + // Check the properties we just set. + DescribePixelFormat(DC, PixelFormat, SizeOf(PFDescriptor), PFDescriptor); + with PFDescriptor do + if (dwFlags and PFD_NEED_PALETTE) <> 0 then + Palette := SetupPalette(DC, PFDescriptor) + else + Palette := 0; + + Result := wglCreateLayerContext(DC, Layer); + if Result = 0 then + RaiseLastOSError + else + LastPixelFormat := 0; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure ActivateRenderingContext(DC: HDC; RC: HGLRC); + +var + PixelFormat: Integer; + +begin + Assert((DC <> 0), 'DC must not be 0'); + Assert((RC <> 0), 'RC must not be 0'); + + if ActivationRefCount = 0 then + begin + // Before activating the rendering context check if it is not already used by another thread. + with ContextList.LockList do + try + if IndexOf(Pointer(RC)) = -1 then + begin + if wglMakeCurrent(DC, RC) then + Add(Pointer(RC)) + else + ShowError(SMakeCurrentFailed); + end + else + ShowError(SRCAlreadyActive) + finally + ContextList.UnlockList; + end; + + Inc(ActivationRefCount); + + // The extension function addresses are unique for each pixel format. All rendering + // contexts of a given pixel format share the same extension function addresses. + PixelFormat := GetPixelFormat(DC); + if PixelFormat <> LastPixelFormat then + begin + ReadExtensions; + ReadImplementationProperties; + LastPixelFormat := PixelFormat; + end; + end + else + begin + Assert((wglGetCurrentDC = DC) and (wglGetCurrentContext = RC), 'Incoherent DC/RC pair.'); + Inc(ActivationRefCount); + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure DeactivateRenderingContext; + +begin + Assert(ActivationRefCount > 0, 'Unbalanced deactivation.'); + if ActivationRefCount > 0 then + begin + Dec(ActivationRefCount); + + if ActivationRefCount = 0 then + begin + // If the rendering context is no longer used then remove it from the context list to indicate + // it can now be used in any thread. + with ContextList.LockList do + try + Remove(Pointer(wglGetCurrentContext)); + if not wglMakeCurrent(0, 0) then + ShowError(SMakeCurrentFailed); + finally + ContextList.UnlockList; + end; + end; + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure DestroyRenderingContext(RC: HGLRC); + +// Used to destroy the given rendering context. Only contexts which are no longer in use by any thread can be deleted. + +begin + Assert((ActivationRefCount = 0), 'Active contexts cannot be deleted.'); + + with ContextList.LockList do + try + if not wglDeleteContext(RC) then + ShowError(SDeleteContextFailed); + if IndexOf(Pointer(RC)) > -1 then + ShowError(SContextInUse); + finally + ContextList.UnlockList; + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function CurrentDC: HDC; + +// Returns the device context which is used for the current rendering context of the caller thread. + +begin + Result := wglGetCurrentDC; +end; + +{$endif} + +//---------------------------------------------------------------------------------------------------------------------- + +procedure CloseOpenGL; +begin + if GLHandle <> INVALID_MODULEHANDLE then + begin + UnloadModule( GLHandle ); + GLHandle := INVALID_MODULEHANDLE; + end; + + if GLUHandle <> INVALID_MODULEHANDLE then + begin + UnloadModule( GLUHandle ); + GLUHandle := INVALID_MODULEHANDLE; + end; + + ClearProcAddresses; + ClearExtensions; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function InitOpenGL: Boolean; + +begin + if (GLHandle = INVALID_MODULEHANDLE) or (GLUHandle = INVALID_MODULEHANDLE) then + Result := InitOpenGLFromLibrary(PChar( SDefaultGLLibrary ), PChar( SDefaultGLULibrary ) ) + else + Result := True; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function InitOpenGLFromLibrary(GLName, GLUName: PChar): Boolean; + +begin + Result := False; + CloseOpenGL; + + LoadModule( GLHandle, GLName ); + LoadModule( GLUHandle, GLUName ); + + if (GLHandle <> INVALID_MODULEHANDLE) and (GLUHandle <> INVALID_MODULEHANDLE) then + begin + LoadProcAddresses; + Result := True; + end + else + begin + if GLHandle <> INVALID_MODULEHANDLE then + UnloadModule( GLHandle ); + + if GLUHandle <> INVALID_MODULEHANDLE then + UnloadModule( GLUHandle ); + end; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function IsOpenGLInitialized: Boolean; + +begin + Result := GLHandle <> INVALID_MODULEHANDLE; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +procedure UnloadOpenGL; + +// compatibility routine + +begin + CloseOpenGL; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function LoadOpenGL: Boolean; + +// compatibility routine + +begin + Result := InitOpenGL; +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function LoadOpenGLFromLibrary(GLName, GLUName: PChar): Boolean; + +// compatibility routine + +begin + Result := InitOpenGLFromLibrary(GLName, GLUName); +end; + +//---------------------------------------------------------------------------------------------------------------------- + +function IsOpenGLLoaded: Boolean; + +// compatibility routine + +begin + Result := GLHandle <> INVALID_MODULEHANDLE; +end; + +//---------------------------------------------------------------------------------------------------------------------- +{$ifdef FPC} +const Default8087CW: Word = $1332; + +{$ASMMODE INTEL} +procedure Set8087CW(NewCW: Word); Assembler; +asm + MOV Default8087CW, AX +end; +{$endif} + +//---------------------------------------------------------------------------------------------------------------------- + +initialization + ContextList := TThreadList.Create; + Set8087CW($133F); +finalization + CloseOpenGL; + ContextList.Free; + // We don't need to reset the FPU control word as the previous set call is process specific. +end. diff --git a/Game/Code/lib/JEDI-SDL/OpenGL/Pas/opengl12.rst b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/opengl12.rst new file mode 100644 index 00000000..857993e7 --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/opengl12.rst @@ -0,0 +1,26 @@ + +# hash value = 79191886 +opengl12.srcalreadyactive='Rendering context already active in another th'+ +'read.' + + +# hash value = 191308692 +opengl12.smakecurrentfailed='wglMakeCurrent failed' + + +# hash value = 214729876 +opengl12.sdeletecontextfailed='wglDeleteContext failed' + + +# hash value = 230190814 +opengl12.scontextinuse='Cannot delete rendering context. It is still in u'+ +'se by another thread.' + + +# hash value = 168003996 +opengl12.sdefaultgllibrary='OpenGL32.dll' + + +# hash value = 140838716 +opengl12.sdefaultglulibrary='GLU32.dll' + diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/Readme.txt b/Game/Code/lib/JEDI-SDL/SDL/Pas/Readme.txt new file mode 100644 index 00000000..76d63a9d --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/Readme.txt @@ -0,0 +1,27 @@ +Delphi interface unit for OpenGL version 1.2 compilable with Delphi 3-6 and Kylix. + +This unit is open source under the Mozilla Public License and +the original author is Dipl. Ing. Mike Lischke (public@lischke-online.de). + +You can obtain this unit also from the JEDI (Joint Endeavor of Delphi Innovators) +API page at www.delphi-jedi.org. + +Note for GLScene users: Eric Grange has provided a general vector types unit which +resolves conflicts for types which are defined in OpenGL12.pas as well as Geometry.pas. +This unit is located in the sub folder "GLScene AddOn". +Please add this unit to the uses clause of OpenGL12.pas and remove the few types which +are already declared in VectorTypes.pas. + +For tests and as starting point three demos are included into the package. Two of them (GLDiag and GLTest) +need the (also provided) simple OpenGL control GLControl (see "GLControl\Package"). + +- Basic is a very simple test program which only uses an empty form. +- GLTest (in GLControl) uses GLControl to show four rendering contexts simultanously. +- GLDiag is a diagnosis tool similar to DXDiag which shows some properties of the current + OpenGL driver implementation. + +Have fun and + +Ciao, Mike +www.lischke-online.de +www.delphi-unicode.net \ No newline at end of file diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/jedi-sdl.inc b/Game/Code/lib/JEDI-SDL/SDL/Pas/jedi-sdl.inc new file mode 100644 index 00000000..48a789fd --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/jedi-sdl.inc @@ -0,0 +1,337 @@ +{ + $Id: jedi-sdl.inc,v 1.9 2004/12/23 23:42:17 savage Exp $ +} +{******************************************************************************} +{ } +{ Borland Delphi SDL - Simple DirectMedia Layer } +{ Global Conditional Definitions for JEDI-SDL cross-compilation } +{ } +{ } +{ The initial developer of this Pascal code was : } +{ Prof. Abimbola Olowofoyeku } +{ } +{ Portions created by Prof. Abimbola Olowofoyeku are } +{ Copyright (C) 2000 - 2100 Prof. Abimbola Olowofoyeku. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ Prof. Abimbola Olowofoyeku } +{ Dominqiue Louis } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ This code has been copied from... } +{ Global Conditional Definitions for Chief's UNZIP package } +{ By Prof. Abimbola Olowofoyeku (The African Chief) } +{ http://www.bigfoot.com/~African_Chief/ } +{ } +{ } +{ Requires } +{ -------- } +{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } +{ They are available from... } +{ http://www.libsdl.org . } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ 2003-04-03 DL - Initial addition } +{ } +{ 2003-04-07 DL - Added Macro ON derective for FPC and OpenGL and removed } +{ WEAKPACKAGE derective. WEAKPACKAGE should be set when } +{ appropriate. } +{ } +{ 2003-04-23 - DL : under instruction from Alexey Barkovoy I have added } +{ better TMT Pascal support and under instruction } +{ from Prof. Abimbola Olowofoyeku (The African Chief) } +{ I have added better Gnu Pascal support } +{ } +{ 2004-01-19 - DL : Under instruction from Marco van de Voort, I have added } +{ Better FPC support for FreeBSD. } +{ } +(* + $Log: jedi-sdl.inc,v $ + Revision 1.9 2004/12/23 23:42:17 savage + Applied Patches supplied by Michalis Kamburelis ( THANKS! ), for greater FreePascal compatability. + + Revision 1.8 2004/10/20 22:43:04 savage + Ensure that UNSAFE type warning are off in D9 as well + + Revision 1.7 2004/04/05 09:59:51 savage + Changes for FreePacal as suggested by Marco + + Revision 1.6 2004/03/31 22:18:15 savage + Small comment for turning off warning under GnuPascal + + Revision 1.5 2004/03/30 22:41:02 savage + Added extra commenting due to previous compiler directive + + Revision 1.4 2004/03/30 22:08:33 savage + Added Kylix Define + + Revision 1.3 2004/03/30 21:34:40 savage + {$H+} needed for FPC compatiblity + + Revision 1.2 2004/02/14 00:23:39 savage + As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. + +*) +{******************************************************************************} + +{.$define Debug} { uncomment for debugging } + +{$IFNDEF FPC} + {$IFDEF __GPC__} + {$I-} + {$W-} // turn off GPC warnings + {$X+} + {$ELSE} {__GPC__} + {$IFDEF Debug} + {$F+,D+,Q-,L+,R+,I-,S+,Y+,A+} + {$ELSE} + {$F+,Q-,R-,S-,I-,A+} + {$ENDIF} + {$ENDIF} {__GPC__} +{$ELSE} {FPC} + //{$M+} +{$ENDIF} {FPC} + +{$IFDEF LINUX} +{$DEFINE UNIX} +{$ENDIF} + +{$IFDEF ver70} + {$IFDEF Windows} + {$DEFINE Win16} + {$ENDIF Windows} + {$IFDEF MSDOS} + {$DEFINE NO_EXPORTS} + {$ENDIF MSDOS} + {$IFDEF DPMI} + {$DEFINE BP_DPMI} + {$ENDIF} + {$DEFINE OS_16_BIT} + {$DEFINE __OS_DOS__} +{$ENDIF ver70} + +{$IFDEF ver80} + {$DEFINE Delphi} {Delphi 1.x} + {$DEFINE Delphi16} + {$DEFINE Win16} + {$DEFINE OS_16_BIT} + {$DEFINE __OS_DOS__} +{$ENDIF ver80} + +{$IFDEF ver90} + {$DEFINE Delphi} {Delphi 2.x} + {$DEFINE Delphi32} +{$ENDIF ver90} + +{$IFDEF ver100} + {$DEFINE Delphi} {Delphi 3.x} + {$DEFINE Delphi32} + {$DEFINE WIN32} +{$ENDIF ver100} + +{$IFDEF ver93} + {$DEFINE Delphi} {C++ Builder 1.x} + {$DEFINE Delphi32} +{$ENDIF ver93} + +{$IFDEF ver110} + {$DEFINE Delphi} {C++ Builder 3.x} + {$DEFINE Delphi32} +{$ENDIF ver110} + +{$IFDEF ver120} + {$DEFINE Delphi} {Delphi 4.x} + {$DEFINE Delphi32} + {$DEFINE Has_Int64} +{$ENDIF ver120} + +{$IFDEF ver130} + {$DEFINE Delphi} {Delphi 5.x} + {$DEFINE Delphi32} + {$DEFINE Has_Int64} +{$ENDIF ver130} + +{$IFDEF ver140} + {$DEFINE Delphi} {Delphi 6.x} + {$DEFINE Delphi32} + {$DEFINE Has_Int64} +{$ENDIF ver140} + +{$IFDEF ver150} + {$DEFINE Delphi} {Delphi 7.x} + {$DEFINE Delphi32} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types in Delphi 7} + {$DEFINE Has_Int64} +{$ENDIF ver150} + +{$IFDEF ver160} + {$DEFINE Delphi} {Delphi 8??} + {$DEFINE Delphi32} + {$DEFINE Has_Int64} +{$ENDIF ver160} + +{$IFDEF ver170} + {$DEFINE Delphi} {Delphi 9??} + {$DEFINE Delphi32} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types in Delphi 7} + {$DEFINE Has_Int64} +{$ENDIF ver170} + +{$IFDEF UNIX} + {$ifdef VER150} + {$define KYLIX} + {$endif} + + {$ifdef VER140} + {$define KYLIX} + {$endif} + + {$ifdef VER140} + {$define KYLIX} + {$endif} +{$ENDIF UNIX} + +{$IFDEF VirtualPascal} { Virtual Pascal 2.x } + {$DEFINE Delphi} { Use Delphi Syntax } + {$DEFINE VP2} + {&Delphi+} +{$ENDIF VirtualPascal} + +{$IFDEF Delphi} + {$DEFINE Windows} + {$DEFINE USE_STDCALL} +{$ENDIF Delphi} + +{$IFDEF FPC} + {$MODE Delphi} { use Delphi compatibility mode } + {$H+} + {$PACKRECORDS 4} // Added for record + {$MACRO ON} // Added For OpenGL + {$THREADING on} + {$DEFINE Delphi} + {$DEFINE UseAT} + {$UNDEF USE_STDCALL} + {$DEFINE OS_BigMem} + {$DEFINE NO_EXPORTS} + {$DEFINE Has_Int64} + {$DEFINE NOCRT} + {$IFDEF unix} + {$DEFINE fpc_unix} + {$ELSE} + {$DEFINE __OS_DOS__} + {$ENDIF} + {$IFDEF WIN32} + {$DEFINE UseWin} + {$ENDIF} +{$ENDIF FPC} + +{$IFDEF Win16} + {$K+} {smart callbacks} +{$ENDIF Win16} + + {$IFDEF OS2} + {$UNDEF Windows} + {$DEFINE UseWin} + {$DEFINE OS_BigMem} + {$ENDIF OS2} + +{$IFDEF __GPC__} + {$UNDEF UseWin} + {$UNDEF USE_STDCALL} + {$DEFINE OS_BigMem} + {$DEFINE NO_EXPORTS} + {$DEFINE NOCRT} + {$DEFINE cdecl attribute(cdecl)} +{$ENDIF} + +{$IFDEF __TMT__} + {$DEFINE OS_BigMem} + {$DEFINE NO_EXPORTS} + {$DEFINE __OS_DOS__} + {$DEFINE UseAT} + {$IFNDEF MSDOS} + {$DEFINE USE_STDCALL} + {$ENDIF} + + {$IFDEF __WIN32__} + {$DEFINE Win32} + {$DEFINE UseWin} + {$DEFINE NOCRT} + {$DEFINE Win32} + {$IFNDEF __CON__} + {$DEFINE Windows} + {$ENDIF} + {$ENDIF} + + {$A+} // Word alignment data + {$OA+} // Objects and structures align +{$ENDIF} + +{$IFDEF Win32} + {$DEFINE OS_BigMem} +{$ELSE Win32} + {$IFDEF ver70} + {$DEFINE assembler} + {$ENDIF} { use 16-bit assembler! } +{$ENDIF Win32} + +{ ************************** dos/dos-like platforms **************} +{$IFDEF Windows} + {$DEFINE __OS_DOS__} + {$DEFINE UseWin} + {$DEFINE MSWINDOWS} +{$ENDIF Delphi} + +{$IFDEF OS2} + {$DEFINE __OS_DOS__} + {$DEFINE Can_Use_DLL} +{$ENDIF Delphi} + +{$IFDEF UseWin} + {$DEFINE Can_Use_DLL} +{$ENDIF} + +{$IFDEF Win16} + {$DEFINE Can_Use_DLL} +{$ENDIF} + +{$IFDEF BP_DPMI} + {$DEFINE Can_Use_DLL} +{$ENDIF} + +{$IFDEF USE_STDCALL} + {$IFNDEF __TMT__} + {$DEFINE BY_NAME} + {$ENDIF} +{$ENDIF} + +{$IFNDEF ver70} + {$UNDEF assembler} +{$ENDIF} diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/libxmlparser.pas b/Game/Code/lib/JEDI-SDL/SDL/Pas/libxmlparser.pas new file mode 100644 index 00000000..54841840 --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/libxmlparser.pas @@ -0,0 +1,2690 @@ +(** +=============================================================================================== +Name : LibXmlParser +=============================================================================================== +Project : All Projects +=============================================================================================== +Subject : Progressive XML Parser for all types of XML Files +=============================================================================================== +Author : Stefan Heymann + Eschenweg 3 + 72076 Tübingen + GERMANY + +E-Mail: stefan@destructor.de +URL: www.destructor.de +=============================================================================================== +Source, Legals ("Licence") +-------------------------- +The official site to get this parser is http://www.destructor.de/ + +Usage and Distribution of this Source Code is ruled by the +"Destructor.de Source code Licence" (DSL) which comes with this file or +can be downloaded at http://www.destructor.de/ + +IN SHORT: Usage and distribution of this source code is free. + You use it completely on your own risk. + +Postcardware +------------ +If you like this code, please send a postcard of your city to my above address. +=============================================================================================== +!!! All parts of this code which are not finished or not conforming exactly to + the XmlSpec are marked with three exclamation marks + +-!- Parts where the parser may be able to detect errors in the document's syntax are + marked with the dash-exlamation mark-dash sequence. +=============================================================================================== +Terminology: +------------ +- Start: Start of a buffer part +- Final: End (last character) of a buffer part +- DTD: Document Type Definition +- DTDc: Document Type Declaration +- XMLSpec: The current W3C XML Recommendation (version 1.0 as of 1998-02-10), Chapter No. +- Cur*: Fields concerning the "Current" part passed back by the "Scan" method +=============================================================================================== +Scanning the XML document +------------------------- +- Create TXmlParser Instance MyXml := TXmlParser.Create; +- Load XML Document MyXml.LoadFromFile (Filename); +- Start Scanning MyXml.StartScan; +- Scan Loop WHILE MyXml.Scan DO +- Test for Part Type CASE MyXml.CurPartType OF +- Handle Parts ... : ;;; +- Handle Parts ... : ;;; +- Handle Parts ... : ;;; + END; +- Destroy MyXml.Free; +=============================================================================================== +Loading the XML document +------------------------ +You can load the XML document from a file with the "LoadFromFile" method. +It is beyond the scope of this parser to perform HTTP or FTP accesses. If you want your +application to handle such requests (URLs), you can load the XML via HTTP or FTP or whatever +protocol and hand over the data buffer using the "LoadFromBuffer" or "SetBuffer" method. +"LoadFromBuffer" loads the internal buffer of TXmlParser with the given null-terminated +string, thereby creating a copy of that buffer. +"SetBuffer" just takes the pointer to another buffer, which means that the given +buffer pointer must be valid while the document is accessed via TXmlParser. +=============================================================================================== +Encodings: +---------- +This XML parser kind of "understands" the following encodings: +- UTF-8 +- ISO-8859-1 +- Windows-1252 + +Any flavor of multi-byte characters (and this includes UTF-16) is not supported. Sorry. + +Every string which has to be passed to the application passes the virtual method +"TranslateEncoding" which translates the string from the current encoding (stored in +"CurEncoding") into the encoding the application wishes to receive. +The "TranslateEncoding" method that is built into TXmlParser assumes that the application +wants to receive Windows ANSI (Windows-1252, about the same as ISO-8859-1) and is able +to convert UTF-8 and ISO-8859-1 encodings. +For other source and target encodings, you will have to override "TranslateEncoding". +=============================================================================================== +Buffer Handling +--------------- +- The document must be loaded completely into a piece of RAM +- All character positions are referenced by PChar pointers +- The TXmlParser instance can either "own" the buffer itself (then, FBufferSize is > 0) + or reference the buffer of another instance or object (then, FBuffersize is 0 and + FBuffer is not NIL) +- The Property DocBuffer passes back a pointer to the first byte of the document. If there + is no document stored (FBuffer is NIL), the DocBuffer returns a pointer to a NULL character. +=============================================================================================== +Whitespace Handling +------------------- +The TXmlParser property "PackSpaces" determines how Whitespace is returned in Text Content: +While PackSpaces is true, all leading and trailing whitespace characters are trimmed of, all +Whitespace is converted to Space #x20 characters and contiguous Whitespace characters are +compressed to one. +If the "Scan" method reports a ptContent part, the application can get the original text +with all whitespace characters by extracting the characters from "CurStart" to "CurFinal". +If the application detects an xml:space attribute, it can set "PackSpaces" accordingly or +use CurStart/CurFinal. +Please note that TXmlParser does _not_ normalize Line Breaks to single LineFeed characters +as the XmlSpec requires (XmlSpec 2.11). +The xml:space attribute is not handled by TXmlParser. This is on behalf of the application. +=============================================================================================== +Non-XML-Conforming +------------------ +TXmlParser does not conform 100 % exactly to the XmlSpec: +- UTF-16 is not supported (XmlSpec 2.2) + (Workaround: Convert UTF-16 to UTF-8 and hand the buffer over to TXmlParser) +- As the parser only works with single byte strings, all Unicode characters > 255 + can currently not be handled correctly. +- Line breaks are not normalized to single Linefeed #x0A characters (XmlSpec 2.11) + (Workaround: The Application can access the text contents on its own [CurStart, CurFinal], + thereby applying every normalization it wishes to) +- The attribute value normalization does not work exactly as defined in the + Second Edition of the XML 1.0 specification. +- See also the code parts marked with three consecutive exclamation marks. These are + parts which are not finished in the current code release. + +This list may be incomplete, so it may grow if I get to know any other points. +As work on the parser proceeds, this list may also shrink. +=============================================================================================== +Things Todo +----------- +- Introduce a new event/callback which is called when there is an unresolvable + entity or character reference +- Support Unicode +- Use Streams instead of reading the whole XML into memory +=============================================================================================== +Change History, Version numbers +------------------------------- +The Date is given in ISO Year-Month-Day (YYYY-MM-DD) order. +Versions are counted from 1.0.0 beginning with the version from 2000-03-16. +Unreleased versions don't get a version number. + +Date Author Version Changes +----------------------------------------------------------------------------------------------- +2000-03-16 HeySt 1.0.0 Start +2000-03-28 HeySt 1.0.1 Initial Publishing of TXmlParser on the destructor.de Web Site +2000-03-30 HeySt 1.0.2 TXmlParser.AnalyzeCData: Call "TranslateEncoding" for CurContent +2000-03-31 HeySt 1.0.3 Deleted the StrPosE function (was not needed anyway) +2000-04-04 HeySt 1.0.4 TDtdElementRec modified: Start/Final for all Elements; + Should be backwards compatible. + AnalyzeDtdc: Set CurPartType to ptDtdc +2000-04-23 HeySt 1.0.5 New class TObjectList. Eliminated reference to the Delphi 5 + "Contnrs" unit so LibXmlParser is Delphi 4 compatible. +2000-07-03 HeySt 1.0.6 TNvpNode: Added Constructor +2000-07-11 HeySt 1.0.7 Removed "Windows" from USES clause + Added three-exclamation-mark comments for Utf8ToAnsi/AnsiToUtf8 + Added three-exclamation-mark comments for CHR function calls +2000-07-23 HeySt 1.0.8 TXmlParser.Clear: CurAttr.Clear; EntityStack.Clear; + (This was not a bug; just defensive programming) +2000-07-29 HeySt 1.0.9 TNvpList: Added methods: Node(Index), Value(Index), Name(Index); +2000-10-07 HeySt Introduced Conditional Defines + Uses Contnrs unit and its TObjectList class again for + Delphi 5 and newer versions +2001-01-30 HeySt Introduced Version Numbering + Made LoadFromFile and LoadFromBuffer BOOLEAN functions + Introduced FileMode parameter for LoadFromFile + BugFix: TAttrList.Analyze: Must add CWhitespace to ExtractName call + Comments worked over +2001-02-28 HeySt 1.0.10 Completely worked over and tested the UTF-8 functions + Fixed a bug in TXmlParser.Scan which caused it to start over when it + was called after the end of scanning, resulting in an endless loop + TEntityStack is now a TObjectList instead of TList +2001-07-03 HeySt 1.0.11 Updated Compiler Version IFDEFs for Kylix +2001-07-11 HeySt 1.0.12 New TCustomXmlScanner component (taken over from LibXmlComps.pas) +2001-07-14 HeySt 1.0.13 Bugfix TCustomXmlScanner.FOnTranslateEncoding +2001-10-22 HeySt Don't clear CurName anymore when the parser finds a CDATA section. +2001-12-03 HeySt 1.0.14 TObjectList.Clear: Make call to INHERITED method (fixes a memory leak) +2001-12-05 HeySt 1.0.15 TObjectList.Clear: removed call to INHERITED method + TObjectList.Destroy: Inserted SetCapacity call. + Reduces need for frequent re-allocation of pointer buffer + Dedicated to my father, Theodor Heymann +2002-06-26 HeySt 1.0.16 TXmlParser.Scan: Fixed a bug with PIs whose name is beginning + with 'xml'. Thanks to Uwe Kamm for submitting this bug. + The CurEncoding property is now always in uppercase letters (the XML + spec wants it to be treated case independently so when it's uppercase + comparisons are faster) +2002-03-04 HeySt 1.0.17 Included an IFDEF for Delphi 7 (VER150) and Kylix + There is a new symbol HAS_CONTNRS_UNIT which is used now to + distinguish between IDEs which come with the Contnrs unit and + those that don't. +*) + +UNIT libxmlparser; + +{$I jedi-sdl.inc} + +{$ALIGN ON} + +INTERFACE + +USES + SysUtils, Classes, + (*$IFDEF HAS_CONTNRS_UNIT *) // The Contnrs Unit was introduced in Delphi 5 + Contnrs, + (*$ENDIF*) + Math; + +CONST + CVersion = '1.0.17'; // This variable will be updated for every release + // (I hope, I won't forget to do it everytime ...) + +TYPE + TPartType = // --- Document Part Types + (ptNone, // Nothing + ptXmlProlog, // XML Prolog XmlSpec 2.8 / 4.3.1 + ptComment, // Comment XmlSpec 2.5 + ptPI, // Processing Instruction XmlSpec 2.6 + ptDtdc, // Document Type Declaration XmlSpec 2.8 + ptStartTag, // Start Tag XmlSpec 3.1 + ptEmptyTag, // Empty-Element Tag XmlSpec 3.1 + ptEndTag, // End Tag XmlSpec 3.1 + ptContent, // Text Content between Tags + ptCData); // CDATA Section XmlSpec 2.7 + + TDtdElemType = // --- DTD Elements + (deElement, // !ELEMENT declaration + deAttList, // !ATTLIST declaration + deEntity, // !ENTITY declaration + deNotation, // !NOTATION declaration + dePI, // PI in DTD + deComment, // Comment in DTD + deError); // Error found in the DTD + +TYPE + TAttrList = CLASS; + TEntityStack = CLASS; + TNvpList = CLASS; + TElemDef = CLASS; + TElemList = CLASS; + TEntityDef = CLASS; + TNotationDef = CLASS; + + TDtdElementRec = RECORD // --- This Record is returned by the DTD parser callback function + Start, Final : PChar; // Start/End of the Element's Declaration + CASE ElementType : TDtdElemType OF // Type of the Element + deElement, // + deAttList : (ElemDef : TElemDef); // + deEntity : (EntityDef : TEntityDef); // + deNotation : (NotationDef : TNotationDef); // + dePI : (Target : PChar; // + Content : PChar; + AttrList : TAttrList); + deError : (Pos : PChar); // Error + // deComment : ((No additional fields here)); // + END; + + TXmlParser = CLASS // --- Internal Properties and Methods + PROTECTED + FBuffer : PChar; // NIL if there is no buffer available + FBufferSize : INTEGER; // 0 if the buffer is not owned by the Document instance + FSource : STRING; // Name of Source of document. Filename for Documents loaded with LoadFromFile + + FXmlVersion : STRING; // XML version from Document header. Default is '1.0' + FEncoding : STRING; // Encoding from Document header. Default is 'UTF-8' + FStandalone : BOOLEAN; // Standalone declaration from Document header. Default is 'yes' + FRootName : STRING; // Name of the Root Element (= DTD name) + FDtdcFinal : PChar; // Pointer to the '>' character terminating the DTD declaration + + FNormalize : BOOLEAN; // If true: Pack Whitespace and don't return empty contents + EntityStack : TEntityStack; // Entity Stack for Parameter and General Entities + FCurEncoding : STRING; // Current Encoding during parsing (always uppercase) + + PROCEDURE AnalyzeProlog; // Analyze XML Prolog or Text Declaration + PROCEDURE AnalyzeComment (Start : PChar; VAR Final : PChar); // Analyze Comments + PROCEDURE AnalyzePI (Start : PChar; VAR Final : PChar); // Analyze Processing Instructions (PI) + PROCEDURE AnalyzeDtdc; // Analyze Document Type Declaration + PROCEDURE AnalyzeDtdElements (Start : PChar; VAR Final : PChar); // Analyze DTD declarations + PROCEDURE AnalyzeTag; // Analyze Start/End/Empty-Element Tags + PROCEDURE AnalyzeCData; // Analyze CDATA Sections + PROCEDURE AnalyzeText (VAR IsDone : BOOLEAN); // Analyze Text Content between Tags + PROCEDURE AnalyzeElementDecl (Start : PChar; VAR Final : PChar); + PROCEDURE AnalyzeAttListDecl (Start : PChar; VAR Final : PChar); + PROCEDURE AnalyzeEntityDecl (Start : PChar; VAR Final : PChar); + PROCEDURE AnalyzeNotationDecl (Start : PChar; VAR Final : PChar); + + PROCEDURE PushPE (VAR Start : PChar); + PROCEDURE ReplaceCharacterEntities (VAR Str : STRING); + PROCEDURE ReplaceParameterEntities (VAR Str : STRING); + PROCEDURE ReplaceGeneralEntities (VAR Str : STRING); + + FUNCTION GetDocBuffer : PChar; // Returns FBuffer or a pointer to a NUL char if Buffer is empty + + PUBLIC // --- Document Properties + PROPERTY XmlVersion : STRING READ FXmlVersion; // XML version from the Document Prolog + PROPERTY Encoding : STRING READ FEncoding; // Document Encoding from Prolog + PROPERTY Standalone : BOOLEAN READ FStandalone; // Standalone Declaration from Prolog + PROPERTY RootName : STRING READ FRootName; // Name of the Root Element + PROPERTY Normalize : BOOLEAN READ FNormalize WRITE FNormalize; // True if Content is to be normalized + PROPERTY Source : STRING READ FSource; // Name of Document Source (Filename) + PROPERTY DocBuffer : PChar READ GetDocBuffer; // Returns document buffer + PUBLIC // --- DTD Objects + Elements : TElemList; // Elements: List of TElemDef (contains Attribute Definitions) + Entities : TNvpList; // General Entities: List of TEntityDef + ParEntities : TNvpList; // Parameter Entities: List of TEntityDef + Notations : TNvpList; // Notations: List of TNotationDef + PUBLIC + CONSTRUCTOR Create; + DESTRUCTOR Destroy; OVERRIDE; + + // --- Document Handling + FUNCTION LoadFromFile (Filename : STRING; + FileMode : INTEGER = fmOpenRead OR fmShareDenyNone) : BOOLEAN; + // Loads Document from given file + FUNCTION LoadFromBuffer (Buffer : PChar) : BOOLEAN; // Loads Document from another buffer + PROCEDURE SetBuffer (Buffer : PChar); // References another buffer + PROCEDURE Clear; // Clear Document + + PUBLIC + // --- Scanning through the document + CurPartType : TPartType; // Current Type + CurName : STRING; // Current Name + CurContent : STRING; // Current Normalized Content + CurStart : PChar; // Current First character + CurFinal : PChar; // Current Last character + CurAttr : TAttrList; // Current Attribute List + PROPERTY CurEncoding : STRING READ FCurEncoding; // Current Encoding + PROCEDURE StartScan; + FUNCTION Scan : BOOLEAN; + + // --- Events / Callbacks + FUNCTION LoadExternalEntity (SystemId, PublicId, + Notation : STRING) : TXmlParser; VIRTUAL; + FUNCTION TranslateEncoding (CONST Source : STRING) : STRING; VIRTUAL; + PROCEDURE DtdElementFound (DtdElementRec : TDtdElementRec); VIRTUAL; + END; + + TValueType = // --- Attribute Value Type + (vtNormal, // Normal specified Attribute + vtImplied, // #IMPLIED attribute value + vtFixed, // #FIXED attribute value + vtDefault); // Attribute value from default value in !ATTLIST declaration + + TAttrDefault = // --- Attribute Default Type + (adDefault, // Normal default value + adRequired, // #REQUIRED attribute + adImplied, // #IMPLIED attribute + adFixed); // #FIXED attribute + + TAttrType = // --- Type of attribute + (atUnknown, // Unknown type + atCData, // Character data only + atID, // ID + atIdRef, // ID Reference + atIdRefs, // Several ID References, separated by Whitespace + atEntity, // Name of an unparsed Entity + atEntities, // Several unparsed Entity names, separated by Whitespace + atNmToken, // Name Token + atNmTokens, // Several Name Tokens, separated by Whitespace + atNotation, // A selection of Notation names (Unparsed Entity) + atEnumeration); // Enumeration + + TElemType = // --- Element content type + (etEmpty, // Element is always empty + etAny, // Element can have any mixture of PCDATA and any elements + etChildren, // Element must contain only elements + etMixed); // Mixed PCDATA and elements + + (*$IFDEF HAS_CONTNRS_UNIT *) + TObjectList = Contnrs.TObjectList; // Re-Export this identifier + (*$ELSE *) + TObjectList = CLASS (TList) + DESTRUCTOR Destroy; OVERRIDE; + PROCEDURE Delete (Index : INTEGER); + PROCEDURE Clear; OVERRIDE; + END; + (*$ENDIF *) + + TNvpNode = CLASS // Name-Value Pair Node + Name : STRING; + Value : STRING; + CONSTRUCTOR Create (TheName : STRING = ''; TheValue : STRING = ''); + END; + + TNvpList = CLASS (TObjectList) // Name-Value Pair List + PROCEDURE Add (Node : TNvpNode); + FUNCTION Node (Name : STRING) : TNvpNode; OVERLOAD; + FUNCTION Node (Index : INTEGER) : TNvpNode; OVERLOAD; + FUNCTION Value (Name : STRING) : STRING; OVERLOAD; + FUNCTION Value (Index : INTEGER) : STRING; OVERLOAD; + FUNCTION Name (Index : INTEGER) : STRING; + END; + + TAttr = CLASS (TNvpNode) // Attribute of a Start-Tag or Empty-Element-Tag + ValueType : TValueType; + AttrType : TAttrType; + END; + + TAttrList = CLASS (TNvpList) // List of Attributes + PROCEDURE Analyze (Start : PChar; VAR Final : PChar); + END; + + TEntityStack = CLASS (TObjectList) // Stack where current position is stored before parsing entities + PROTECTED + Owner : TXmlParser; + PUBLIC + CONSTRUCTOR Create (TheOwner : TXmlParser); + PROCEDURE Push (LastPos : PChar); OVERLOAD; + PROCEDURE Push (Instance : TObject; LastPos : PChar); OVERLOAD; + FUNCTION Pop : PChar; // Returns next char or NIL if EOF is reached. Frees Instance. + END; + + TAttrDef = CLASS (TNvpNode) // Represents a '; + + // --- Name Constants for the above enumeration types + CPartType_Name : ARRAY [TPartType] OF STRING = + ('', 'XML Prolog', 'Comment', 'PI', + 'DTD Declaration', 'Start Tag', 'Empty Tag', 'End Tag', + 'Text', 'CDATA'); + CValueType_Name : ARRAY [TValueType] OF STRING = ('Normal', 'Implied', 'Fixed', 'Default'); + CAttrDefault_Name : ARRAY [TAttrDefault] OF STRING = ('Default', 'Required', 'Implied', 'Fixed'); + CElemType_Name : ARRAY [TElemType] OF STRING = ('Empty', 'Any', 'Childs only', 'Mixed'); + CAttrType_Name : ARRAY [TAttrType] OF STRING = ('Unknown', 'CDATA', + 'ID', 'IDREF', 'IDREFS', + 'ENTITY', 'ENTITIES', + 'NMTOKEN', 'NMTOKENS', + 'Notation', 'Enumeration'); + +FUNCTION ConvertWs (Source: STRING; PackWs: BOOLEAN) : STRING; // Convert WS to spaces #x20 +PROCEDURE SetStringSF (VAR S : STRING; BufferStart, BufferFinal : PChar); // SetString by Start/Final of buffer +FUNCTION StrSFPas (Start, Finish : PChar) : STRING; // Convert buffer part to Pascal string +FUNCTION TrimWs (Source : STRING) : STRING; // Trim Whitespace + +FUNCTION AnsiToUtf8 (Source : ANSISTRING) : STRING; // Convert Win-1252 to UTF-8 +FUNCTION Utf8ToAnsi (Source : STRING; UnknownChar : CHAR = '¿') : ANSISTRING; // Convert UTF-8 to Win-1252 + + +(* +=============================================================================================== +TCustomXmlScanner event based component wrapper for TXmlParser +=============================================================================================== +*) + +TYPE + TCustomXmlScanner = CLASS; + TXmlPrologEvent = PROCEDURE (Sender : TObject; XmlVersion, Encoding: STRING; Standalone : BOOLEAN) OF OBJECT; + TCommentEvent = PROCEDURE (Sender : TObject; Comment : STRING) OF OBJECT; + TPIEvent = PROCEDURE (Sender : TObject; Target, Content: STRING; Attributes : TAttrList) OF OBJECT; + TDtdEvent = PROCEDURE (Sender : TObject; RootElementName : STRING) OF OBJECT; + TStartTagEvent = PROCEDURE (Sender : TObject; TagName : STRING; Attributes : TAttrList) OF OBJECT; + TEndTagEvent = PROCEDURE (Sender : TObject; TagName : STRING) OF OBJECT; + TContentEvent = PROCEDURE (Sender : TObject; Content : STRING) OF OBJECT; + TElementEvent = PROCEDURE (Sender : TObject; ElemDef : TElemDef) OF OBJECT; + TEntityEvent = PROCEDURE (Sender : TObject; EntityDef : TEntityDef) OF OBJECT; + TNotationEvent = PROCEDURE (Sender : TObject; NotationDef : TNotationDef) OF OBJECT; + TErrorEvent = PROCEDURE (Sender : TObject; ErrorPos : PChar) OF OBJECT; + TExternalEvent = PROCEDURE (Sender : TObject; SystemId, PublicId, NotationId : STRING; + VAR Result : TXmlParser) OF OBJECT; + TEncodingEvent = FUNCTION (Sender : TObject; CurrentEncoding, Source : STRING) : STRING OF OBJECT; + + + TCustomXmlScanner = CLASS (TComponent) + PROTECTED + FXmlParser : TXmlParser; + FOnXmlProlog : TXmlPrologEvent; + FOnComment : TCommentEvent; + FOnPI : TPIEvent; + FOnDtdRead : TDtdEvent; + FOnStartTag : TStartTagEvent; + FOnEmptyTag : TStartTagEvent; + FOnEndTag : TEndTagEvent; + FOnContent : TContentEvent; + FOnCData : TContentEvent; + FOnElement : TElementEvent; + FOnAttList : TElementEvent; + FOnEntity : TEntityEvent; + FOnNotation : TNotationEvent; + FOnDtdError : TErrorEvent; + FOnLoadExternal : TExternalEvent; + FOnTranslateEncoding : TEncodingEvent; + FStopParser : BOOLEAN; + FUNCTION GetNormalize : BOOLEAN; + PROCEDURE SetNormalize (Value : BOOLEAN); + + PROCEDURE WhenXmlProlog(XmlVersion, Encoding: STRING; Standalone : BOOLEAN); VIRTUAL; + PROCEDURE WhenComment (Comment : STRING); VIRTUAL; + PROCEDURE WhenPI (Target, Content: STRING; Attributes : TAttrList); VIRTUAL; + PROCEDURE WhenDtdRead (RootElementName : STRING); VIRTUAL; + PROCEDURE WhenStartTag (TagName : STRING; Attributes : TAttrList); VIRTUAL; + PROCEDURE WhenEmptyTag (TagName : STRING; Attributes : TAttrList); VIRTUAL; + PROCEDURE WhenEndTag (TagName : STRING); VIRTUAL; + PROCEDURE WhenContent (Content : STRING); VIRTUAL; + PROCEDURE WhenCData (Content : STRING); VIRTUAL; + PROCEDURE WhenElement (ElemDef : TElemDef); VIRTUAL; + PROCEDURE WhenAttList (ElemDef : TElemDef); VIRTUAL; + PROCEDURE WhenEntity (EntityDef : TEntityDef); VIRTUAL; + PROCEDURE WhenNotation (NotationDef : TNotationDef); VIRTUAL; + PROCEDURE WhenDtdError (ErrorPos : PChar); VIRTUAL; + + PUBLIC + CONSTRUCTOR Create (AOwner: TComponent); OVERRIDE; + DESTRUCTOR Destroy; OVERRIDE; + + PROCEDURE LoadFromFile (Filename : TFilename); // Load XML Document from file + PROCEDURE LoadFromBuffer (Buffer : PChar); // Load XML Document from buffer + PROCEDURE SetBuffer (Buffer : PChar); // Refer to Buffer + FUNCTION GetFilename : TFilename; + + PROCEDURE Execute; // Perform scanning + + PROTECTED + PROPERTY XmlParser : TXmlParser READ FXmlParser; + PROPERTY StopParser : BOOLEAN READ FStopParser WRITE FStopParser; + PROPERTY Filename : TFilename READ GetFilename WRITE LoadFromFile; + PROPERTY Normalize : BOOLEAN READ GetNormalize WRITE SetNormalize; + PROPERTY OnXmlProlog : TXmlPrologEvent READ FOnXmlProlog WRITE FOnXmlProlog; + PROPERTY OnComment : TCommentEvent READ FOnComment WRITE FOnComment; + PROPERTY OnPI : TPIEvent READ FOnPI WRITE FOnPI; + PROPERTY OnDtdRead : TDtdEvent READ FOnDtdRead WRITE FOnDtdRead; + PROPERTY OnStartTag : TStartTagEvent READ FOnStartTag WRITE FOnStartTag; + PROPERTY OnEmptyTag : TStartTagEvent READ FOnEmptyTag WRITE FOnEmptyTag; + PROPERTY OnEndTag : TEndTagEvent READ FOnEndTag WRITE FOnEndTag; + PROPERTY OnContent : TContentEvent READ FOnContent WRITE FOnContent; + PROPERTY OnCData : TContentEvent READ FOnCData WRITE FOnCData; + PROPERTY OnElement : TElementEvent READ FOnElement WRITE FOnElement; + PROPERTY OnAttList : TElementEvent READ FOnAttList WRITE FOnAttList; + PROPERTY OnEntity : TEntityEvent READ FOnEntity WRITE FOnEntity; + PROPERTY OnNotation : TNotationEvent READ FOnNotation WRITE FOnNotation; + PROPERTY OnDtdError : TErrorEvent READ FOnDtdError WRITE FOnDtdError; + PROPERTY OnLoadExternal : TExternalEvent READ FOnLoadExternal WRITE FOnLoadExternal; + PROPERTY OnTranslateEncoding : TEncodingEvent READ FOnTranslateEncoding WRITE FOnTranslateEncoding; + END; + +(* +=============================================================================================== +IMPLEMENTATION +=============================================================================================== +*) + +IMPLEMENTATION + + +(* +=============================================================================================== +Unicode and UTF-8 stuff +=============================================================================================== +*) + +CONST + // --- Character Translation Table for Unicode <-> Win-1252 + WIN1252_UNICODE : ARRAY [$00..$FF] OF WORD = ( + $0000, $0001, $0002, $0003, $0004, $0005, $0006, $0007, $0008, $0009, + $000A, $000B, $000C, $000D, $000E, $000F, $0010, $0011, $0012, $0013, + $0014, $0015, $0016, $0017, $0018, $0019, $001A, $001B, $001C, $001D, + $001E, $001F, $0020, $0021, $0022, $0023, $0024, $0025, $0026, $0027, + $0028, $0029, $002A, $002B, $002C, $002D, $002E, $002F, $0030, $0031, + $0032, $0033, $0034, $0035, $0036, $0037, $0038, $0039, $003A, $003B, + $003C, $003D, $003E, $003F, $0040, $0041, $0042, $0043, $0044, $0045, + $0046, $0047, $0048, $0049, $004A, $004B, $004C, $004D, $004E, $004F, + $0050, $0051, $0052, $0053, $0054, $0055, $0056, $0057, $0058, $0059, + $005A, $005B, $005C, $005D, $005E, $005F, $0060, $0061, $0062, $0063, + $0064, $0065, $0066, $0067, $0068, $0069, $006A, $006B, $006C, $006D, + $006E, $006F, $0070, $0071, $0072, $0073, $0074, $0075, $0076, $0077, + $0078, $0079, $007A, $007B, $007C, $007D, $007E, $007F, + + $20AC, $0081, $201A, $0192, $201E, $2026, $2020, $2021, $02C6, $2030, + $0160, $2039, $0152, $008D, $017D, $008F, $0090, $2018, $2019, $201C, + $201D, $2022, $2013, $2014, $02DC, $2122, $0161, $203A, $0153, $009D, + $017E, $0178, $00A0, $00A1, $00A2, $00A3, $00A4, $00A5, $00A6, $00A7, + $00A8, $00A9, $00AA, $00AB, $00AC, $00AD, $00AE, $00AF, $00B0, $00B1, + $00B2, $00B3, $00B4, $00B5, $00B6, $00B7, $00B8, $00B9, $00BA, $00BB, + $00BC, $00BD, $00BE, $00BF, $00C0, $00C1, $00C2, $00C3, $00C4, $00C5, + $00C6, $00C7, $00C8, $00C9, $00CA, $00CB, $00CC, $00CD, $00CE, $00CF, + $00D0, $00D1, $00D2, $00D3, $00D4, $00D5, $00D6, $00D7, $00D8, $00D9, + $00DA, $00DB, $00DC, $00DD, $00DE, $00DF, $00E0, $00E1, $00E2, $00E3, + $00E4, $00E5, $00E6, $00E7, $00E8, $00E9, $00EA, $00EB, $00EC, $00ED, + $00EE, $00EF, $00F0, $00F1, $00F2, $00F3, $00F4, $00F5, $00F6, $00F7, + $00F8, $00F9, $00FA, $00FB, $00FC, $00FD, $00FE, $00FF); + +(* UTF-8 (somewhat simplified) + ----- + Character Range Byte sequence + --------------- -------------------------- (x=Bits from original character) + $0000..$007F 0xxxxxxx + $0080..$07FF 110xxxxx 10xxxxxx + $8000..$FFFF 1110xxxx 10xxxxxx 10xxxxxx + + Example + -------- + Transforming the Unicode character U+00E4 LATIN SMALL LETTER A WITH DIAERESIS ("ä"): + + ISO-8859-1, Decimal 228 + Win1252, Hex $E4 + ANSI Bin 1110 0100 + abcd efgh + + UTF-8 Binary 1100xxab 10cdefgh + Binary 11000011 10100100 + Hex $C3 $A4 + Decimal 195 164 + ANSI Ã ¤ *) + + +FUNCTION AnsiToUtf8 (Source : ANSISTRING) : STRING; + (* Converts the given Windows ANSI (Win1252) String to UTF-8. *) +VAR + I : INTEGER; // Loop counter + U : WORD; // Current Unicode value + Len : INTEGER; // Current real length of "Result" string +BEGIN + SetLength (Result, Length (Source) * 3); // Worst case + Len := 0; + FOR I := 1 TO Length (Source) DO BEGIN + U := WIN1252_UNICODE [ORD (Source [I])]; + CASE U OF + $0000..$007F : BEGIN + INC (Len); + Result [Len] := CHR (U); + END; + $0080..$07FF : BEGIN + INC (Len); + Result [Len] := CHR ($C0 OR (U SHR 6)); + INC (Len); + Result [Len] := CHR ($80 OR (U AND $3F)); + END; + $0800..$FFFF : BEGIN + INC (Len); + Result [Len] := CHR ($E0 OR (U SHR 12)); + INC (Len); + Result [Len] := CHR ($80 OR ((U SHR 6) AND $3F)); + INC (Len); + Result [Len] := CHR ($80 OR (U AND $3F)); + END; + END; + END; + SetLength (Result, Len); +END; + + +FUNCTION Utf8ToAnsi (Source : STRING; UnknownChar : CHAR = '¿') : ANSISTRING; + (* Converts the given UTF-8 String to Windows ANSI (Win-1252). + If a character can not be converted, the "UnknownChar" is inserted. *) +VAR + SourceLen : INTEGER; // Length of Source string + I, K : INTEGER; + A : BYTE; // Current ANSI character value + U : WORD; + Ch : CHAR; // Dest char + Len : INTEGER; // Current real length of "Result" string +BEGIN + SourceLen := Length (Source); + SetLength (Result, SourceLen); // Enough room to live + Len := 0; + I := 1; + WHILE I <= SourceLen DO BEGIN + A := ORD (Source [I]); + IF A < $80 THEN BEGIN // Range $0000..$007F + INC (Len); + Result [Len] := Source [I]; + INC (I); + END + ELSE BEGIN // Determine U, Inc I + IF (A AND $E0 = $C0) AND (I < SourceLen) THEN BEGIN // Range $0080..$07FF + U := (WORD (A AND $1F) SHL 6) OR (ORD (Source [I+1]) AND $3F); + INC (I, 2); + END + ELSE IF (A AND $F0 = $E0) AND (I < SourceLen-1) THEN BEGIN // Range $0800..$FFFF + U := (WORD (A AND $0F) SHL 12) OR + (WORD (ORD (Source [I+1]) AND $3F) SHL 6) OR + ( ORD (Source [I+2]) AND $3F); + INC (I, 3); + END + ELSE BEGIN // Unknown/unsupported + INC (I); + FOR K := 7 DOWNTO 0 DO + IF A AND (1 SHL K) = 0 THEN BEGIN + INC (I, (A SHR (K+1))-1); + BREAK; + END; + U := WIN1252_UNICODE [ORD (UnknownChar)]; + END; + Ch := UnknownChar; // Retrieve ANSI char + FOR A := $00 TO $FF DO + IF WIN1252_UNICODE [A] = U THEN BEGIN + Ch := CHR (A); + BREAK; + END; + INC (Len); + Result [Len] := Ch; + END; + END; + SetLength (Result, Len); +END; + + +(* +=============================================================================================== +"Special" Helper Functions + +Don't ask me why. But including these functions makes the parser *DRAMATICALLY* faster +on my K6-233 machine. You can test it yourself just by commenting them out. +They do exactly the same as the Assembler routines defined in SysUtils. +(This is where you can see how great the Delphi compiler really is. The compiled code is +faster than hand-coded assembler!) +=============================================================================================== +--> Just move this line below the StrScan function --> *) + + +FUNCTION StrPos (CONST Str, SearchStr : PChar) : PChar; + // Same functionality as SysUtils.StrPos +VAR + First : CHAR; + Len : INTEGER; +BEGIN + First := SearchStr^; + Len := StrLen (SearchStr); + Result := Str; + REPEAT + IF Result^ = First THEN + IF StrLComp (Result, SearchStr, Len) = 0 THEN BREAK; + IF Result^ = #0 THEN BEGIN + Result := NIL; + BREAK; + END; + INC (Result); + UNTIL FALSE; +END; + + +FUNCTION StrScan (CONST Start : PChar; CONST Ch : CHAR) : PChar; + // Same functionality as SysUtils.StrScan +BEGIN + Result := Start; + WHILE Result^ <> Ch DO BEGIN + IF Result^ = #0 THEN BEGIN + Result := NIL; + EXIT; + END; + INC (Result); + END; +END; + + +(* +=============================================================================================== +Helper Functions +=============================================================================================== +*) + +FUNCTION DelChars (Source : STRING; CharsToDelete : TCharset) : STRING; + // Delete all "CharsToDelete" from the string +VAR + I : INTEGER; +BEGIN + Result := Source; + FOR I := Length (Result) DOWNTO 1 DO + IF Result [I] IN CharsToDelete THEN + Delete (Result, I, 1); +END; + + +FUNCTION TrimWs (Source : STRING) : STRING; + // Trimms off Whitespace characters from both ends of the string +VAR + I : INTEGER; +BEGIN + // --- Trim Left + I := 1; + WHILE (I <= Length (Source)) AND (Source [I] IN CWhitespace) DO + INC (I); + Result := Copy (Source, I, MaxInt); + + // --- Trim Right + I := Length (Result); + WHILE (I > 1) AND (Result [I] IN CWhitespace) DO + DEC (I); + Delete (Result, I+1, Length (Result)-I); +END; + + +FUNCTION ConvertWs (Source: STRING; PackWs: BOOLEAN) : STRING; + // Converts all Whitespace characters to the Space #x20 character + // If "PackWs" is true, contiguous Whitespace characters are packed to one +VAR + I : INTEGER; +BEGIN + Result := Source; + FOR I := Length (Result) DOWNTO 1 DO + IF (Result [I] IN CWhitespace) THEN + IF PackWs AND (I > 1) AND (Result [I-1] IN CWhitespace) + THEN Delete (Result, I, 1) + ELSE Result [I] := #32; +END; + + +PROCEDURE SetStringSF (VAR S : STRING; BufferStart, BufferFinal : PChar); +BEGIN + SetString (S, BufferStart, BufferFinal-BufferStart+1); +END; + + +FUNCTION StrLPas (Start : PChar; Len : INTEGER) : STRING; +BEGIN + SetString (Result, Start, Len); +END; + + +FUNCTION StrSFPas (Start, Finish : PChar) : STRING; +BEGIN + SetString (Result, Start, Finish-Start+1); +END; + + +FUNCTION StrScanE (CONST Source : PChar; CONST CharToScanFor : CHAR) : PChar; + // If "CharToScanFor" is not found, StrScanE returns the last char of the + // buffer instead of NIL +BEGIN + Result := StrScan (Source, CharToScanFor); + IF Result = NIL THEN + Result := StrEnd (Source)-1; +END; + + +PROCEDURE ExtractName (Start : PChar; Terminators : TCharset; VAR Final : PChar); + (* Extracts the complete Name beginning at "Start". + It is assumed that the name is contained in Markup, so the '>' character is + always a Termination. + Start: IN Pointer to first char of name. Is always considered to be valid + Terminators: IN Characters which terminate the name + Final: OUT Pointer to last char of name *) +BEGIN + Final := Start+1; + Include (Terminators, #0); + Include (Terminators, '>'); + WHILE NOT (Final^ IN Terminators) DO + INC (Final); + DEC (Final); +END; + + +PROCEDURE ExtractQuote (Start : PChar; VAR Content : STRING; VAR Final : PChar); + (* Extract a string which is contained in single or double Quotes. + Start: IN Pointer to opening quote + Content: OUT The quoted string + Final: OUT Pointer to closing quote *) +BEGIN + Final := StrScan (Start+1, Start^); + IF Final = NIL THEN BEGIN + Final := StrEnd (Start+1)-1; + SetString (Content, Start+1, Final-Start); + END + ELSE + SetString (Content, Start+1, Final-1-Start); +END; + + +(* +=============================================================================================== +TEntityStackNode +This Node is pushed to the "Entity Stack" whenever the parser parses entity replacement text. +The "Instance" field holds the Instance pointer of an External Entity buffer. When it is +popped, the Instance is freed. +The "Encoding" field holds the name of the Encoding. External Parsed Entities may have +another encoding as the document entity (XmlSpec 4.3.3). So when there is an " 0 THEN BEGIN + ESN := TEntityStackNode (Items [Count-1]); + Result := ESN.LastPos; + IF ESN.Instance <> NIL THEN + ESN.Instance.Free; + IF ESN.Encoding <> '' THEN + Owner.FCurEncoding := ESN.Encoding; // Restore current Encoding + Delete (Count-1); + END + ELSE + Result := NIL; +END; + + +(* +=============================================================================================== +TExternalID +----------- +XmlSpec 4.2.2: ExternalID ::= 'SYSTEM' S SystemLiteral | + 'PUBLIC' S PubidLiteral S SystemLiteral +XmlSpec 4.7: PublicID ::= 'PUBLIC' S PubidLiteral +SystemLiteral and PubidLiteral are quoted +=============================================================================================== +*) + +TYPE + TExternalID = CLASS + PublicId : STRING; + SystemId : STRING; + Final : PChar; + CONSTRUCTOR Create (Start : PChar); + END; + +CONSTRUCTOR TExternalID.Create (Start : PChar); +BEGIN + INHERITED Create; + Final := Start; + IF StrLComp (Start, 'SYSTEM', 6) = 0 THEN BEGIN + WHILE NOT (Final^ IN (CQuoteChar + [#0, '>', '['])) DO INC (Final); + IF NOT (Final^ IN CQuoteChar) THEN EXIT; + ExtractQuote (Final, SystemID, Final); + END + ELSE IF StrLComp (Start, 'PUBLIC', 6) = 0 THEN BEGIN + WHILE NOT (Final^ IN (CQuoteChar + [#0, '>', '['])) DO INC (Final); + IF NOT (Final^ IN CQuoteChar) THEN EXIT; + ExtractQuote (Final, PublicID, Final); + INC (Final); + WHILE NOT (Final^ IN (CQuoteChar + [#0, '>', '['])) DO INC (Final); + IF NOT (Final^ IN CQuoteChar) THEN EXIT; + ExtractQuote (Final, SystemID, Final); + END; +END; + + +(* +=============================================================================================== +TXmlParser +=============================================================================================== +*) + +CONSTRUCTOR TXmlParser.Create; +BEGIN + INHERITED Create; + FBuffer := NIL; + FBufferSize := 0; + Elements := TElemList.Create; + Entities := TNvpList.Create; + ParEntities := TNvpList.Create; + Notations := TNvpList.Create; + CurAttr := TAttrList.Create; + EntityStack := TEntityStack.Create (Self); + Clear; +END; + + +DESTRUCTOR TXmlParser.Destroy; +BEGIN + Clear; + Elements.Free; + Entities.Free; + ParEntities.Free; + Notations.Free; + CurAttr.Free; + EntityStack.Free; + INHERITED Destroy; +END; + + +PROCEDURE TXmlParser.Clear; + // Free Buffer and clear all object attributes +BEGIN + IF (FBufferSize > 0) AND (FBuffer <> NIL) THEN + FreeMem (FBuffer); + FBuffer := NIL; + FBufferSize := 0; + FSource := ''; + FXmlVersion := ''; + FEncoding := ''; + FStandalone := FALSE; + FRootName := ''; + FDtdcFinal := NIL; + FNormalize := TRUE; + Elements.Clear; + Entities.Clear; + ParEntities.Clear; + Notations.Clear; + CurAttr.Clear; + EntityStack.Clear; +END; + + +FUNCTION TXmlParser.LoadFromFile (Filename : STRING; FileMode : INTEGER = fmOpenRead OR fmShareDenyNone) : BOOLEAN; + // Loads Document from given file + // Returns TRUE if successful +VAR + f : FILE; + ReadIn : INTEGER; + OldFileMode : INTEGER; +BEGIN + Result := FALSE; + Clear; + + // --- Open File + OldFileMode := SYSTEM.FileMode; + TRY + SYSTEM.FileMode := FileMode; + TRY + AssignFile (f, Filename); + Reset (f, 1); + EXCEPT + EXIT; + END; + + TRY + // --- Allocate Memory + TRY + FBufferSize := Filesize (f) + 1; + GetMem (FBuffer, FBufferSize); + EXCEPT + Clear; + EXIT; + END; + + // --- Read File + TRY + BlockRead (f, FBuffer^, FBufferSize, ReadIn); + (FBuffer+ReadIn)^ := #0; // NULL termination + EXCEPT + Clear; + EXIT; + END; + FINALLY + CloseFile (f); + END; + + FSource := Filename; + Result := TRUE; + + FINALLY + SYSTEM.FileMode := OldFileMode; + END; +END; + + +FUNCTION TXmlParser.LoadFromBuffer (Buffer : PChar) : BOOLEAN; + // Loads Document from another buffer + // Returns TRUE if successful + // The "Source" property becomes '' if successful +BEGIN + Result := FALSE; + Clear; + FBufferSize := StrLen (Buffer) + 1; + TRY + GetMem (FBuffer, FBufferSize); + EXCEPT + Clear; + EXIT; + END; + StrCopy (FBuffer, Buffer); + FSource := ''; + Result := TRUE; +END; + + +PROCEDURE TXmlParser.SetBuffer (Buffer : PChar); // References another buffer +BEGIN + Clear; + FBuffer := Buffer; + FBufferSize := 0; + FSource := ''; +END; + + +//----------------------------------------------------------------------------------------------- +// Scanning through the document +//----------------------------------------------------------------------------------------------- + +PROCEDURE TXmlParser.StartScan; +BEGIN + CurPartType := ptNone; + CurName := ''; + CurContent := ''; + CurStart := NIL; + CurFinal := NIL; + CurAttr.Clear; + EntityStack.Clear; +END; + + +FUNCTION TXmlParser.Scan : BOOLEAN; + // Scans the next Part + // Returns TRUE if a part could be found, FALSE if there is no part any more + // + // "IsDone" can be set to FALSE by AnalyzeText in order to go to the next part + // if there is no Content due to normalization +VAR + IsDone : BOOLEAN; +BEGIN + REPEAT + IsDone := TRUE; + + // --- Start of next Part + IF CurStart = NIL + THEN CurStart := DocBuffer + ELSE CurStart := CurFinal+1; + CurFinal := CurStart; + + // --- End of Document of Pop off a new part from the Entity stack? + IF CurStart^ = #0 THEN + CurStart := EntityStack.Pop; + + // --- No Document or End Of Document: Terminate Scan + IF (CurStart = NIL) OR (CurStart^ = #0) THEN BEGIN + CurStart := StrEnd (DocBuffer); + CurFinal := CurStart-1; + EntityStack.Clear; + Result := FALSE; + EXIT; + END; + + IF (StrLComp (CurStart, ''); + IF CurFinal <> NIL + THEN INC (CurFinal) + ELSE CurFinal := StrEnd (CurStart)-1; + FCurEncoding := AnsiUpperCase (CurAttr.Value ('encoding')); + IF FCurEncoding = '' THEN + FCurEncoding := 'UTF-8'; // Default XML Encoding is UTF-8 + CurPartType := ptXmlProlog; + CurName := ''; + CurContent := ''; +END; + + +PROCEDURE TXmlParser.AnalyzeComment (Start : PChar; VAR Final : PChar); + // Analyze Comments +BEGIN + Final := StrPos (Start+4, '-->'); + IF Final = NIL + THEN Final := StrEnd (Start)-1 + ELSE INC (Final, 2); + CurPartType := ptComment; +END; + + +PROCEDURE TXmlParser.AnalyzePI (Start : PChar; VAR Final : PChar); + // Analyze Processing Instructions (PI) + // This is also called for Character +VAR + F : PChar; +BEGIN + CurPartType := ptPI; + Final := StrPos (Start+2, '?>'); + IF Final = NIL + THEN Final := StrEnd (Start)-1 + ELSE INC (Final); + ExtractName (Start+2, CWhitespace + ['?', '>'], F); + SetStringSF (CurName, Start+2, F); + SetStringSF (CurContent, F+1, Final-2); + CurAttr.Analyze (F+1, F); +END; + + +PROCEDURE TXmlParser.AnalyzeDtdc; + (* Analyze Document Type Declaration + doctypedecl ::= '' + markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI | Comment + PEReference ::= '%' Name ';' + + elementdecl ::= '' + AttlistDecl ::= '' + EntityDecl ::= '' | + '' + NotationDecl ::= '' + PI ::= '' Char* )))? '?>' + Comment ::= '' *) +TYPE + TPhase = (phName, phDtd, phInternal, phFinishing); +VAR + Phase : TPhase; + F : PChar; + ExternalID : TExternalID; + ExternalDTD : TXmlParser; + DER : TDtdElementRec; +BEGIN + DER.Start := CurStart; + EntityStack.Clear; // Clear stack for Parameter Entities + CurPartType := ptDtdc; + + // --- Don't read DTDc twice + IF FDtdcFinal <> NIL THEN BEGIN + CurFinal := FDtdcFinal; + EXIT; + END; + + // --- Scan DTDc + CurFinal := CurStart + 9; // First char after '' : BREAK; + ELSE IF NOT (CurFinal^ IN CWhitespace) THEN BEGIN + CASE Phase OF + phName : IF (CurFinal^ IN CNameStart) THEN BEGIN + ExtractName (CurFinal, CWhitespace + ['[', '>'], F); + SetStringSF (FRootName, CurFinal, F); + CurFinal := F; + Phase := phDtd; + END; + phDtd : IF (StrLComp (CurFinal, 'SYSTEM', 6) = 0) OR + (StrLComp (CurFinal, 'PUBLIC', 6) = 0) THEN BEGIN + ExternalID := TExternalID.Create (CurFinal); + ExternalDTD := LoadExternalEntity (ExternalId.SystemId, ExternalID.PublicId, ''); + F := StrPos (ExternalDtd.DocBuffer, ' NIL THEN + AnalyzeDtdElements (F, F); + ExternalDTD.Free; + CurFinal := ExternalID.Final; + ExternalID.Free; + END; + ELSE BEGIN + DER.ElementType := deError; + DER.Pos := CurFinal; + DER.Final := CurFinal; + DtdElementFound (DER); + END; + END; + + END; + END; + INC (CurFinal); + UNTIL FALSE; + + CurPartType := ptDtdc; + CurName := ''; + CurContent := ''; + + // It is an error in the document if "EntityStack" is not empty now + IF EntityStack.Count > 0 THEN BEGIN + DER.ElementType := deError; + DER.Final := CurFinal; + DER.Pos := CurFinal; + DtdElementFound (DER); + END; + + EntityStack.Clear; // Clear stack for General Entities + FDtdcFinal := CurFinal; +END; + + +PROCEDURE TXmlParser.AnalyzeDtdElements (Start : PChar; VAR Final : PChar); + // Analyze the "Elements" of a DTD contained in the external or + // internal DTD subset. +VAR + DER : TDtdElementRec; +BEGIN + Final := Start; + REPEAT + CASE Final^ OF + '%' : BEGIN + PushPE (Final); + CONTINUE; + END; + #0 : IF EntityStack.Count = 0 THEN + BREAK + ELSE BEGIN + CurFinal := EntityStack.Pop; + CONTINUE; + END; + ']', + '>' : BREAK; + '<' : IF StrLComp (Final, ''); + + // --- Set Default Attribute values for nonexistent attributes + IF (CurPartType = ptStartTag) OR (CurPartType = ptEmptyTag) THEN BEGIN + ElemDef := Elements.Node (CurName); + IF ElemDef <> NIL THEN BEGIN + FOR I := 0 TO ElemDef.Count-1 DO BEGIN + AttrDef := TAttrDef (ElemDef [I]); + Attr := TAttr (CurAttr.Node (AttrDef.Name)); + IF (Attr = NIL) AND (AttrDef.Value <> '') THEN BEGIN + Attr := TAttr.Create (AttrDef.Name, AttrDef.Value); + Attr.ValueType := vtDefault; + CurAttr.Add (Attr); + END; + IF Attr <> NIL THEN BEGIN + CASE AttrDef.DefaultType OF + adDefault : ; + adRequired : ; // -!- It is an error in the document if "Attr.Value" is an empty string + adImplied : Attr.ValueType := vtImplied; + adFixed : BEGIN + Attr.ValueType := vtFixed; + Attr.Value := AttrDef.Value; + END; + END; + Attr.AttrType := AttrDef.AttrType; + END; + END; + END; + + // --- Normalize Attribute Values. XmlSpec: + // - a character reference is processed by appending the referenced character to the attribute value + // - an entity reference is processed by recursively processing the replacement text of the entity + // - a whitespace character (#x20, #xD, #xA, #x9) is processed by appending #x20 to the normalized value, + // except that only a single #x20 is appended for a "#xD#xA" sequence that is part of an external + // parsed entity or the literal entity value of an internal parsed entity + // - other characters are processed by appending them to the normalized value + // If the declared value is not CDATA, then the XML processor must further process the + // normalized attribute value by discarding any leading and trailing space (#x20) characters, + // and by replacing sequences of space (#x20) characters by a single space (#x20) character. + // All attributes for which no declaration has been read should be treated by a + // non-validating parser as if declared CDATA. + // !!! The XML 1.0 SE specification is somewhat different here + // This code does not conform exactly to this specification + FOR I := 0 TO CurAttr.Count-1 DO + WITH TAttr (CurAttr [I]) DO BEGIN + ReplaceGeneralEntities (Value); + ReplaceCharacterEntities (Value); + IF (AttrType <> atCData) AND (AttrType <> atUnknown) + THEN Value := TranslateEncoding (TrimWs (ConvertWs (Value, TRUE))) + ELSE Value := TranslateEncoding (ConvertWs (Value, FALSE)); + END; + END; +END; + + +PROCEDURE TXmlParser.AnalyzeCData; + // Analyze CDATA Sections +BEGIN + CurPartType := ptCData; + CurFinal := StrPos (CurStart, CDEnd); + IF CurFinal = NIL THEN BEGIN + CurFinal := StrEnd (CurStart)-1; + CurContent := TranslateEncoding (StrPas (CurStart+Length (CDStart))); + END + ELSE BEGIN + SetStringSF (CurContent, CurStart+Length (CDStart), CurFinal-1); + INC (CurFinal, Length (CDEnd)-1); + CurContent := TranslateEncoding (CurContent); + END; +END; + + +PROCEDURE TXmlParser.AnalyzeText (VAR IsDone : BOOLEAN); + (* Analyzes Text Content between Tags. CurFinal will point to the last content character. + Content ends at a '<' character or at the end of the document. + Entity References and Character Entity references are resolved. + If PackSpaces is TRUE, contiguous Whitespace Characters will be compressed to + one Space #x20 character, Whitespace at the beginning and end of content will + be trimmed off and content which is or becomes empty is not returned to + the application (in this case, "IsDone" is set to FALSE which causes the + Scan method to proceed directly to the next part. *) + + PROCEDURE ProcessEntity; + (* Is called if there is an ampsersand '&' character found in the document. + IN "CurFinal" points to the ampersand + OUT "CurFinal" points to the first character after the semi-colon ';' *) + VAR + P : PChar; + Name : STRING; + EntityDef : TEntityDef; + ExternalEntity : TXmlParser; + BEGIN + P := StrScan (CurFinal , ';'); + IF P <> NIL THEN BEGIN + SetStringSF (Name, CurFinal+1, P-1); + + // Is it a Character Entity? + IF (CurFinal+1)^ = '#' THEN BEGIN + IF UpCase ((CurFinal+2)^) = 'X' // !!! Can't use "CHR" for Unicode characters > 255: + THEN CurContent := CurContent + CHR (StrToIntDef ('$'+Copy (Name, 3, MaxInt), 32)) + ELSE CurContent := CurContent + CHR (StrToIntDef (Copy (Name, 2, MaxInt), 32)); + CurFinal := P+1; + EXIT; + END + + // Is it a Predefined Entity? + ELSE IF Name = 'lt' THEN BEGIN CurContent := CurContent + '<'; CurFinal := P+1; EXIT; END + ELSE IF Name = 'gt' THEN BEGIN CurContent := CurContent + '>'; CurFinal := P+1; EXIT; END + ELSE IF Name = 'amp' THEN BEGIN CurContent := CurContent + '&'; CurFinal := P+1; EXIT; END + ELSE IF Name = 'apos' THEN BEGIN CurContent := CurContent + ''''; CurFinal := P+1; EXIT; END + ELSE IF Name = 'quot' THEN BEGIN CurContent := CurContent + '"'; CurFinal := P+1; EXIT; END; + + // Replace with Entity from DTD + EntityDef := TEntityDef (Entities.Node (Name)); + IF EntityDef <> NIL THEN BEGIN + IF EntityDef.Value <> '' THEN BEGIN + EntityStack.Push (P+1); + CurFinal := PChar (EntityDef.Value); + END + ELSE BEGIN + ExternalEntity := LoadExternalEntity (EntityDef.SystemId, EntityDef.PublicId, EntityDef.NotationName); + EntityStack.Push (ExternalEntity, P+1); + CurFinal := ExternalEntity.DocBuffer; + END; + END + ELSE BEGIN + CurContent := CurContent + Name; + CurFinal := P+1; + END; + END + ELSE BEGIN + INC (CurFinal); + END; + END; + +VAR + C : INTEGER; +BEGIN + CurFinal := CurStart; + CurPartType := ptContent; + CurContent := ''; + C := 0; + REPEAT + CASE CurFinal^ OF + '&' : BEGIN + CurContent := CurContent + TranslateEncoding (StrLPas (CurFinal-C, C)); + C := 0; + ProcessEntity; + CONTINUE; + END; + #0 : BEGIN + IF EntityStack.Count = 0 THEN + BREAK + ELSE BEGIN + CurContent := CurContent + TranslateEncoding (StrLPas (CurFinal-C, C)); + C := 0; + CurFinal := EntityStack.Pop; + CONTINUE; + END; + END; + '<' : BREAK; + ELSE INC (C); + END; + INC (CurFinal); + UNTIL FALSE; + CurContent := CurContent + TranslateEncoding (StrLPas (CurFinal-C, C)); + DEC (CurFinal); + + IF FNormalize THEN BEGIN + CurContent := ConvertWs (TrimWs (CurContent), TRUE); + IsDone := CurContent <> ''; // IsDone will only get FALSE if PackSpaces is TRUE + END; +END; + + +PROCEDURE TXmlParser.AnalyzeElementDecl (Start : PChar; VAR Final : PChar); + (* Parse ' character + XmlSpec 3.2: + elementdecl ::= '' + contentspec ::= 'EMPTY' | 'ANY' | Mixed | children + Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*' | + '(' S? '#PCDATA' S? ')' + children ::= (choice | seq) ('?' | '*' | '+')? + choice ::= '(' S? cp ( S? '|' S? cp )* S? ')' + cp ::= (Name | choice | seq) ('?' | '*' | '+')? + seq ::= '(' S? cp ( S? ',' S? cp )* S? ')' + + More simply: + contentspec ::= EMPTY + ANY + '(#PCDATA)' + '(#PCDATA | A | B)*' + '(A, B, C)' + '(A | B | C)' + '(A?, B*, C+), + '(A, (B | C | D)* )' *) +VAR + Element : TElemDef; + Elem2 : TElemDef; + F : PChar; + DER : TDtdElementRec; +BEGIN + Element := TElemDef.Create; + Final := Start + 9; + DER.Start := Start; + REPEAT + IF Final^ = '>' THEN BREAK; + IF (Final^ IN CNameStart) AND (Element.Name = '') THEN BEGIN + ExtractName (Final, CWhitespace, F); + SetStringSF (Element.Name, Final, F); + Final := F; + F := StrScan (Final+1, '>'); + IF F = NIL THEN BEGIN + Element.Definition := STRING (Final); + Final := StrEnd (Final); + BREAK; + END + ELSE BEGIN + SetStringSF (Element.Definition, Final+1, F-1); + Final := F; + BREAK; + END; + END; + INC (Final); + UNTIL FALSE; + Element.Definition := DelChars (Element.Definition, CWhitespace); + ReplaceParameterEntities (Element.Definition); + IF Element.Definition = 'EMPTY' THEN Element.ElemType := etEmpty + ELSE IF Element.Definition = 'ANY' THEN Element.ElemType := etAny + ELSE IF Copy (Element.Definition, 1, 8) = '(#PCDATA' THEN Element.ElemType := etMixed + ELSE IF Copy (Element.Definition, 1, 1) = '(' THEN Element.ElemType := etChildren + ELSE Element.ElemType := etAny; + + Elem2 := Elements.Node (Element.Name); + IF Elem2 <> NIL THEN + Elements.Delete (Elements.IndexOf (Elem2)); + Elements.Add (Element); + Final := StrScanE (Final, '>'); + DER.ElementType := deElement; + DER.ElemDef := Element; + DER.Final := Final; + DtdElementFound (DER); +END; + + +PROCEDURE TXmlParser.AnalyzeAttListDecl (Start : PChar; VAR Final : PChar); + (* Parse ' character + XmlSpec 3.3: + AttlistDecl ::= '' + AttDef ::= S Name S AttType S DefaultDecl + AttType ::= StringType | TokenizedType | EnumeratedType + StringType ::= 'CDATA' + TokenizedType ::= 'ID' | 'IDREF' | 'IDREFS' | 'ENTITY' | 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS' + EnumeratedType ::= NotationType | Enumeration + NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')' + Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')' + DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue) + AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'" + Examples: + *) +TYPE + TPhase = (phElementName, phName, phType, phNotationContent, phDefault); +VAR + Phase : TPhase; + F : PChar; + ElementName : STRING; + ElemDef : TElemDef; + AttrDef : TAttrDef; + AttrDef2 : TAttrDef; + Strg : STRING; + DER : TDtdElementRec; +BEGIN + Final := Start + 9; // The character after ' : BREAK; + ELSE CASE Phase OF + phElementName : BEGIN + ExtractName (Final, CWhitespace + CQuoteChar + ['#'], F); + SetStringSF (ElementName, Final, F); + Final := F; + ElemDef := Elements.Node (ElementName); + IF ElemDef = NIL THEN BEGIN + ElemDef := TElemDef.Create; + ElemDef.Name := ElementName; + ElemDef.Definition := 'ANY'; + ElemDef.ElemType := etAny; + Elements.Add (ElemDef); + END; + Phase := phName; + END; + phName : BEGIN + AttrDef := TAttrDef.Create; + ExtractName (Final, CWhitespace + CQuoteChar + ['#'], F); + SetStringSF (AttrDef.Name, Final, F); + Final := F; + AttrDef2 := TAttrDef (ElemDef.Node (AttrDef.Name)); + IF AttrDef2 <> NIL THEN + ElemDef.Delete (ElemDef.IndexOf (AttrDef2)); + ElemDef.Add (AttrDef); + Phase := phType; + END; + phType : BEGIN + IF Final^ = '(' THEN BEGIN + F := StrScan (Final+1, ')'); + IF F <> NIL + THEN SetStringSF (AttrDef.TypeDef, Final+1, F-1) + ELSE AttrDef.TypeDef := STRING (Final+1); + AttrDef.TypeDef := DelChars (AttrDef.TypeDef, CWhitespace); + AttrDef.AttrType := atEnumeration; + ReplaceParameterEntities (AttrDef.TypeDef); + ReplaceCharacterEntities (AttrDef.TypeDef); + Phase := phDefault; + END + ELSE IF StrLComp (Final, 'NOTATION', 8) = 0 THEN BEGIN + INC (Final, 8); + AttrDef.AttrType := atNotation; + Phase := phNotationContent; + END + ELSE BEGIN + ExtractName (Final, CWhitespace+CQuoteChar+['#'], F); + SetStringSF (AttrDef.TypeDef, Final, F); + IF AttrDef.TypeDef = 'CDATA' THEN AttrDef.AttrType := atCData + ELSE IF AttrDef.TypeDef = 'ID' THEN AttrDef.AttrType := atId + ELSE IF AttrDef.TypeDef = 'IDREF' THEN AttrDef.AttrType := atIdRef + ELSE IF AttrDef.TypeDef = 'IDREFS' THEN AttrDef.AttrType := atIdRefs + ELSE IF AttrDef.TypeDef = 'ENTITY' THEN AttrDef.AttrType := atEntity + ELSE IF AttrDef.TypeDef = 'ENTITIES' THEN AttrDef.AttrType := atEntities + ELSE IF AttrDef.TypeDef = 'NMTOKEN' THEN AttrDef.AttrType := atNmToken + ELSE IF AttrDef.TypeDef = 'NMTOKENS' THEN AttrDef.AttrType := atNmTokens; + Phase := phDefault; + END + END; + phNotationContent : BEGIN + F := StrScan (Final, ')'); + IF F <> NIL THEN + SetStringSF (AttrDef.Notations, Final+1, F-1) + ELSE BEGIN + AttrDef.Notations := STRING (Final+1); + Final := StrEnd (Final); + END; + ReplaceParameterEntities (AttrDef.Notations); + AttrDef.Notations := DelChars (AttrDef.Notations, CWhitespace); + Phase := phDefault; + END; + phDefault : BEGIN + IF Final^ = '#' THEN BEGIN + ExtractName (Final, CWhiteSpace + CQuoteChar, F); + SetStringSF (Strg, Final, F); + Final := F; + ReplaceParameterEntities (Strg); + IF Strg = '#REQUIRED' THEN BEGIN AttrDef.DefaultType := adRequired; Phase := phName; END + ELSE IF Strg = '#IMPLIED' THEN BEGIN AttrDef.DefaultType := adImplied; Phase := phName; END + ELSE IF Strg = '#FIXED' THEN AttrDef.DefaultType := adFixed; + END + ELSE IF (Final^ IN CQuoteChar) THEN BEGIN + ExtractQuote (Final, AttrDef.Value, Final); + ReplaceParameterEntities (AttrDef.Value); + ReplaceCharacterEntities (AttrDef.Value); + Phase := phName; + END; + IF Phase = phName THEN BEGIN + AttrDef := NIL; + END; + END; + + END; + END; + INC (Final); + UNTIL FALSE; + + Final := StrScan (Final, '>'); + + DER.ElementType := deAttList; + DER.ElemDef := ElemDef; + DER.Final := Final; + DtdElementFound (DER); +END; + + +PROCEDURE TXmlParser.AnalyzeEntityDecl (Start : PChar; VAR Final : PChar); + (* Parse ' character + XmlSpec 4.2: + EntityDecl ::= '' | + '' + EntityDef ::= EntityValue | (ExternalID NDataDecl?) + PEDef ::= EntityValue | ExternalID + NDataDecl ::= S 'NDATA' S Name + EntityValue ::= '"' ([^%&"] | PEReference | EntityRef | CharRef)* '"' | + "'" ([^%&'] | PEReference | EntityRef | CharRef)* "'" + PEReference ::= '%' Name ';' + + Examples + + + + "> + + + Dies ist ein Test-Absatz

"> + *) +TYPE + TPhase = (phName, phContent, phNData, phNotationName, phFinalGT); +VAR + Phase : TPhase; + IsParamEntity : BOOLEAN; + F : PChar; + ExternalID : TExternalID; + EntityDef : TEntityDef; + EntityDef2 : TEntityDef; + DER : TDtdElementRec; +BEGIN + Final := Start + 8; // First char after ' : BREAK; + ELSE CASE Phase OF + phName : IF Final^ IN CNameStart THEN BEGIN + ExtractName (Final, CWhitespace + CQuoteChar, F); + SetStringSF (EntityDef.Name, Final, F); + Final := F; + Phase := phContent; + END; + phContent : IF Final^ IN CQuoteChar THEN BEGIN + ExtractQuote (Final, EntityDef.Value, Final); + Phase := phFinalGT; + END + ELSE IF (StrLComp (Final, 'SYSTEM', 6) = 0) OR + (StrLComp (Final, 'PUBLIC', 6) = 0) THEN BEGIN + ExternalID := TExternalID.Create (Final); + EntityDef.SystemId := ExternalID.SystemId; + EntityDef.PublicId := ExternalID.PublicId; + Final := ExternalID.Final; + Phase := phNData; + ExternalID.Free; + END; + phNData : IF StrLComp (Final, 'NDATA', 5) = 0 THEN BEGIN + INC (Final, 4); + Phase := phNotationName; + END; + phNotationName : IF Final^ IN CNameStart THEN BEGIN + ExtractName (Final, CWhitespace + ['>'], F); + SetStringSF (EntityDef.NotationName, Final, F); + Final := F; + Phase := phFinalGT; + END; + phFinalGT : ; // -!- There is an error in the document if this branch is called + END; + END; + INC (Final); + UNTIL FALSE; + IF IsParamEntity THEN BEGIN + EntityDef2 := TEntityDef (ParEntities.Node (EntityDef.Name)); + IF EntityDef2 <> NIL THEN + ParEntities.Delete (ParEntities.IndexOf (EntityDef2)); + ParEntities.Add (EntityDef); + ReplaceCharacterEntities (EntityDef.Value); + END + ELSE BEGIN + EntityDef2 := TEntityDef (Entities.Node (EntityDef.Name)); + IF EntityDef2 <> NIL THEN + Entities.Delete (Entities.IndexOf (EntityDef2)); + Entities.Add (EntityDef); + ReplaceParameterEntities (EntityDef.Value); // Create replacement texts (see XmlSpec 4.5) + ReplaceCharacterEntities (EntityDef.Value); + END; + Final := StrScanE (Final, '>'); + + DER.ElementType := deEntity; + DER.EntityDef := EntityDef; + DER.Final := Final; + DtdElementFound (DER); +END; + + +PROCEDURE TXmlParser.AnalyzeNotationDecl (Start : PChar; VAR Final : PChar); + // Parse ' character + // XmlSpec 4.7: NotationDecl ::= '' +TYPE + TPhase = (phName, phExtId, phEnd); +VAR + ExternalID : TExternalID; + Phase : TPhase; + F : PChar; + NotationDef : TNotationDef; + DER : TDtdElementRec; +BEGIN + Final := Start + 10; // Character after ', + #0 : BREAK; + ELSE CASE Phase OF + phName : BEGIN + ExtractName (Final, CWhitespace + ['>'], F); + SetStringSF (NotationDef.Name, Final, F); + Final := F; + Phase := phExtId; + END; + phExtId : BEGIN + ExternalID := TExternalID.Create (Final); + NotationDef.Value := ExternalID.SystemId; + NotationDef.PublicId := ExternalID.PublicId; + Final := ExternalId.Final; + ExternalId.Free; + Phase := phEnd; + END; + phEnd : ; // -!- There is an error in the document if this branch is called + END; + END; + INC (Final); + UNTIL FALSE; + Notations.Add (NotationDef); + Final := StrScanE (Final, '>'); + + DER.ElementType := deNotation; + DER.NotationDef := NotationDef; + DER.Final := Final; + DtdElementFound (DER); +END; + + +PROCEDURE TXmlParser.PushPE (VAR Start : PChar); + (* If there is a parameter entity reference found in the data stream, + the current position will be pushed to the entity stack. + Start: IN Pointer to the '%' character starting the PE reference + OUT Pointer to first character of PE replacement text *) +VAR + P : PChar; + EntityDef : TEntityDef; +BEGIN + P := StrScan (Start, ';'); + IF P <> NIL THEN BEGIN + EntityDef := TEntityDef (ParEntities.Node (StrSFPas (Start+1, P-1))); + IF EntityDef <> NIL THEN BEGIN + EntityStack.Push (P+1); + Start := PChar (EntityDef.Value); + END + ELSE + Start := P+1; + END; +END; + + +PROCEDURE TXmlParser.ReplaceCharacterEntities (VAR Str : STRING); + // Replaces all Character Entity References in the String +VAR + Start : INTEGER; + PAmp : PChar; + PSemi : PChar; + PosAmp : INTEGER; + Len : INTEGER; // Length of Entity Reference +BEGIN + IF Str = '' THEN EXIT; + Start := 1; + REPEAT + PAmp := StrPos (PChar (Str) + Start-1, '&#'); + IF PAmp = NIL THEN BREAK; + PSemi := StrScan (PAmp+2, ';'); + IF PSemi = NIL THEN BREAK; + PosAmp := PAmp - PChar (Str) + 1; + Len := PSemi-PAmp+1; + IF CompareText (Str [PosAmp+2], 'x') = 0 // !!! Can't use "CHR" for Unicode characters > 255 + THEN Str [PosAmp] := CHR (StrToIntDef ('$'+Copy (Str, PosAmp+3, Len-4), 0)) + ELSE Str [PosAmp] := CHR (StrToIntDef (Copy (Str, PosAmp+2, Len-3), 32)); + Delete (Str, PosAmp+1, Len-1); + Start := PosAmp + 1; + UNTIL FALSE; +END; + + +PROCEDURE TXmlParser.ReplaceParameterEntities (VAR Str : STRING); + // Recursively replaces all Parameter Entity References in the String + PROCEDURE ReplaceEntities (VAR Str : STRING); + VAR + Start : INTEGER; + PAmp : PChar; + PSemi : PChar; + PosAmp : INTEGER; + Len : INTEGER; + Entity : TEntityDef; + Repl : STRING; // Replacement + BEGIN + IF Str = '' THEN EXIT; + Start := 1; + REPEAT + PAmp := StrPos (PChar (Str)+Start-1, '%'); + IF PAmp = NIL THEN BREAK; + PSemi := StrScan (PAmp+2, ';'); + IF PSemi = NIL THEN BREAK; + PosAmp := PAmp - PChar (Str) + 1; + Len := PSemi-PAmp+1; + Entity := TEntityDef (ParEntities.Node (Copy (Str, PosAmp+1, Len-2))); + IF Entity <> NIL THEN BEGIN + Repl := Entity.Value; + ReplaceEntities (Repl); // Recursion + END + ELSE + Repl := Copy (Str, PosAmp, Len); + Delete (Str, PosAmp, Len); + Insert (Repl, Str, PosAmp); + Start := PosAmp + Length (Repl); + UNTIL FALSE; + END; +BEGIN + ReplaceEntities (Str); +END; + + +PROCEDURE TXmlParser.ReplaceGeneralEntities (VAR Str : STRING); + // Recursively replaces General Entity References in the String + PROCEDURE ReplaceEntities (VAR Str : STRING); + VAR + Start : INTEGER; + PAmp : PChar; + PSemi : PChar; + PosAmp : INTEGER; + Len : INTEGER; + EntityDef : TEntityDef; + EntName : STRING; + Repl : STRING; // Replacement + ExternalEntity : TXmlParser; + BEGIN + IF Str = '' THEN EXIT; + Start := 1; + REPEAT + PAmp := StrPos (PChar (Str)+Start-1, '&'); + IF PAmp = NIL THEN BREAK; + PSemi := StrScan (PAmp+2, ';'); + IF PSemi = NIL THEN BREAK; + PosAmp := PAmp - PChar (Str) + 1; + Len := PSemi-PAmp+1; + EntName := Copy (Str, PosAmp+1, Len-2); + IF EntName = 'lt' THEN Repl := '<' + ELSE IF EntName = 'gt' THEN Repl := '>' + ELSE IF EntName = 'amp' THEN Repl := '&' + ELSE IF EntName = 'apos' THEN Repl := '''' + ELSE IF EntName = 'quot' THEN Repl := '"' + ELSE BEGIN + EntityDef := TEntityDef (Entities.Node (EntName)); + IF EntityDef <> NIL THEN BEGIN + IF EntityDef.Value <> '' THEN // Internal Entity + Repl := EntityDef.Value + ELSE BEGIN // External Entity + ExternalEntity := LoadExternalEntity (EntityDef.SystemId, EntityDef.PublicId, EntityDef.NotationName); + Repl := StrPas (ExternalEntity.DocBuffer); // !!! What if it contains a Text Declaration? + ExternalEntity.Free; + END; + ReplaceEntities (Repl); // Recursion + END + ELSE + Repl := Copy (Str, PosAmp, Len); + END; + Delete (Str, PosAmp, Len); + Insert (Repl, Str, PosAmp); + Start := PosAmp + Length (Repl); + UNTIL FALSE; + END; +BEGIN + ReplaceEntities (Str); +END; + + +FUNCTION TXmlParser.LoadExternalEntity (SystemId, PublicId, Notation : STRING) : TXmlParser; + // This will be called whenever there is a Parsed External Entity or + // the DTD External Subset to be parsed. + // It has to create a TXmlParser instance and load the desired Entity. + // This instance of LoadExternalEntity assumes that "SystemId" is a valid + // file name (relative to the Document source) and loads this file using + // the LoadFromFile method. +VAR + Filename : STRING; +BEGIN + // --- Convert System ID to complete filename + Filename := StringReplace (SystemId, '/', '\', [rfReplaceAll]); + IF Copy (FSource, 1, 1) <> '<' THEN + IF (Copy (Filename, 1, 2) = '\\') OR (Copy (Filename, 2, 1) = ':') THEN + // Already has an absolute Path + ELSE BEGIN + Filename := ExtractFilePath (FSource) + Filename; + END; + + // --- Load the File + Result := TXmlParser.Create; + Result.LoadFromFile (Filename); +END; + + +FUNCTION TXmlParser.TranslateEncoding (CONST Source : STRING) : STRING; + // The member variable "CurEncoding" always holds the name of the current + // encoding, e.g. 'UTF-8' or 'ISO-8859-1'. + // This virtual method "TranslateEncoding" is responsible for translating + // the content passed in the "Source" parameter to the Encoding which + // is expected by the application. + // This instance of "TranlateEncoding" assumes that the Application expects + // Windows ANSI (Win1252) strings. It is able to transform UTF-8 or ISO-8859-1 + // encodings. + // If you want your application to understand or create other encodings, you + // override this function. +BEGIN + IF CurEncoding = 'UTF-8' + THEN Result := Utf8ToAnsi (Source) + ELSE Result := Source; +END; + + +PROCEDURE TXmlParser.DtdElementFound (DtdElementRec : TDtdElementRec); + // This method is called for every element which is found in the DTD + // declaration. The variant record TDtdElementRec is passed which + // holds informations about the element. + // You can override this function to handle DTD declarations. + // Note that when you parse the same Document instance a second time, + // the DTD will not get parsed again. +BEGIN +END; + + +FUNCTION TXmlParser.GetDocBuffer: PChar; + // Returns FBuffer or a pointer to a NUL char if Buffer is empty +BEGIN + IF FBuffer = NIL + THEN Result := #0 + ELSE Result := FBuffer; +END; + + +(*$IFNDEF HAS_CONTNRS_UNIT +=============================================================================================== +TObjectList +=============================================================================================== +*) + +DESTRUCTOR TObjectList.Destroy; +BEGIN + Clear; + SetCapacity(0); + INHERITED Destroy; +END; + + +PROCEDURE TObjectList.Delete (Index : INTEGER); +BEGIN + IF (Index < 0) OR (Index >= Count) THEN EXIT; + TObject (Items [Index]).Free; + INHERITED Delete (Index); +END; + + +PROCEDURE TObjectList.Clear; +BEGIN + WHILE Count > 0 DO + Delete (Count-1); +END; + +(*$ENDIF *) + +(* +=============================================================================================== +TNvpNode +-------- +Node base class for the TNvpList +=============================================================================================== +*) + +CONSTRUCTOR TNvpNode.Create (TheName, TheValue : STRING); +BEGIN + INHERITED Create; + Name := TheName; + Value := TheValue; +END; + + +(* +=============================================================================================== +TNvpList +-------- +A generic List of Name-Value Pairs, based on the TObjectList introduced in Delphi 5 +=============================================================================================== +*) + +PROCEDURE TNvpList.Add (Node : TNvpNode); +VAR + I : INTEGER; +BEGIN + FOR I := Count-1 DOWNTO 0 DO + IF Node.Name > TNvpNode (Items [I]).Name THEN BEGIN + Insert (I+1, Node); + EXIT; + END; + Insert (0, Node); +END; + + + +FUNCTION TNvpList.Node (Name : STRING) : TNvpNode; + // Binary search for Node +VAR + L, H : INTEGER; // Low, High Limit + T, C : INTEGER; // Test Index, Comparison result + Last : INTEGER; // Last Test Index +BEGIN + IF Count=0 THEN BEGIN + Result := NIL; + EXIT; + END; + + L := 0; + H := Count; + Last := -1; + REPEAT + T := (L+H) DIV 2; + IF T=Last THEN BREAK; + Result := TNvpNode (Items [T]); + C := CompareStr (Result.Name, Name); + IF C = 0 THEN EXIT + ELSE IF C < 0 THEN L := T + ELSE H := T; + Last := T; + UNTIL FALSE; + Result := NIL; +END; + + +FUNCTION TNvpList.Node (Index : INTEGER) : TNvpNode; +BEGIN + IF (Index < 0) OR (Index >= Count) + THEN Result := NIL + ELSE Result := TNvpNode (Items [Index]); +END; + + +FUNCTION TNvpList.Value (Name : STRING) : STRING; +VAR + Nvp : TNvpNode; +BEGIN + Nvp := TNvpNode (Node (Name)); + IF Nvp <> NIL + THEN Result := Nvp.Value + ELSE Result := ''; +END; + + +FUNCTION TNvpList.Value (Index : INTEGER) : STRING; +BEGIN + IF (Index < 0) OR (Index >= Count) + THEN Result := '' + ELSE Result := TNvpNode (Items [Index]).Value; +END; + + +FUNCTION TNvpList.Name (Index : INTEGER) : STRING; +BEGIN + IF (Index < 0) OR (Index >= Count) + THEN Result := '' + ELSE Result := TNvpNode (Items [Index]).Name; +END; + + +(* +=============================================================================================== +TAttrList +List of Attributes. The "Analyze" method extracts the Attributes from the given Buffer. +Is used for extraction of Attributes in Start-Tags, Empty-Element Tags and the "pseudo" +attributes in XML Prologs, Text Declarations and PIs. +=============================================================================================== +*) + +PROCEDURE TAttrList.Analyze (Start : PChar; VAR Final : PChar); + // Analyze the Buffer for Attribute=Name pairs. + // Terminates when there is a character which is not IN CNameStart + // (e.g. '?>' or '>' or '/>') +TYPE + TPhase = (phName, phEq, phValue); +VAR + Phase : TPhase; + F : PChar; + Name : STRING; + Value : STRING; + Attr : TAttr; +BEGIN + Clear; + Phase := phName; + Final := Start; + REPEAT + IF (Final^ = #0) OR (Final^ = '>') THEN BREAK; + IF NOT (Final^ IN CWhitespace) THEN + CASE Phase OF + phName : BEGIN + IF NOT (Final^ IN CNameStart) THEN EXIT; + ExtractName (Final, CWhitespace + ['=', '/'], F); + SetStringSF (Name, Final, F); + Final := F; + Phase := phEq; + END; + phEq : BEGIN + IF Final^ = '=' THEN + Phase := phValue + END; + phValue : BEGIN + IF Final^ IN CQuoteChar THEN BEGIN + ExtractQuote (Final, Value, F); + Attr := TAttr.Create; + Attr.Name := Name; + Attr.Value := Value; + Attr.ValueType := vtNormal; + Add (Attr); + Final := F; + Phase := phName; + END; + END; + END; + INC (Final); + UNTIL FALSE; +END; + + +(* +=============================================================================================== +TElemList +List of TElemDef nodes. +=============================================================================================== +*) + +FUNCTION TElemList.Node (Name : STRING) : TElemDef; + // Binary search for the Node with the given Name +VAR + L, H : INTEGER; // Low, High Limit + T, C : INTEGER; // Test Index, Comparison result + Last : INTEGER; // Last Test Index +BEGIN + IF Count=0 THEN BEGIN + Result := NIL; + EXIT; + END; + + L := 0; + H := Count; + Last := -1; + REPEAT + T := (L+H) DIV 2; + IF T=Last THEN BREAK; + Result := TElemDef (Items [T]); + C := CompareStr (Result.Name, Name); + IF C = 0 THEN EXIT + ELSE IF C < 0 THEN L := T + ELSE H := T; + Last := T; + UNTIL FALSE; + Result := NIL; +END; + + +PROCEDURE TElemList.Add (Node : TElemDef); +VAR + I : INTEGER; +BEGIN + FOR I := Count-1 DOWNTO 0 DO + IF Node.Name > TElemDef (Items [I]).Name THEN BEGIN + Insert (I+1, Node); + EXIT; + END; + Insert (0, Node); +END; + + +(* +=============================================================================================== +TScannerXmlParser +A TXmlParser descendant for the TCustomXmlScanner component +=============================================================================================== +*) + +TYPE + TScannerXmlParser = CLASS (TXmlParser) + Scanner : TCustomXmlScanner; + CONSTRUCTOR Create (TheScanner : TCustomXmlScanner); + FUNCTION LoadExternalEntity (SystemId, PublicId, + Notation : STRING) : TXmlParser; OVERRIDE; + FUNCTION TranslateEncoding (CONST Source : STRING) : STRING; OVERRIDE; + PROCEDURE DtdElementFound (DtdElementRec : TDtdElementRec); OVERRIDE; + END; + +CONSTRUCTOR TScannerXmlParser.Create (TheScanner : TCustomXmlScanner); +BEGIN + INHERITED Create; + Scanner := TheScanner; +END; + + +FUNCTION TScannerXmlParser.LoadExternalEntity (SystemId, PublicId, Notation : STRING) : TXmlParser; +BEGIN + IF Assigned (Scanner.FOnLoadExternal) + THEN Scanner.FOnLoadExternal (Scanner, SystemId, PublicId, Notation, Result) + ELSE Result := INHERITED LoadExternalEntity (SystemId, PublicId, Notation); +END; + + +FUNCTION TScannerXmlParser.TranslateEncoding (CONST Source : STRING) : STRING; +BEGIN + IF Assigned (Scanner.FOnTranslateEncoding) + THEN Result := Scanner.FOnTranslateEncoding (Scanner, CurEncoding, Source) + ELSE Result := INHERITED TranslateEncoding (Source); +END; + + +PROCEDURE TScannerXmlParser.DtdElementFound (DtdElementRec : TDtdElementRec); +BEGIN + WITH DtdElementRec DO + CASE ElementType OF + deElement : Scanner.WhenElement (ElemDef); + deAttList : Scanner.WhenAttList (ElemDef); + deEntity : Scanner.WhenEntity (EntityDef); + deNotation : Scanner.WhenNotation (NotationDef); + dePI : Scanner.WhenPI (STRING (Target), STRING (Content), AttrList); + deComment : Scanner.WhenComment (StrSFPas (Start, Final)); + deError : Scanner.WhenDtdError (Pos); + END; +END; + + +(* +=============================================================================================== +TCustomXmlScanner +=============================================================================================== +*) + +CONSTRUCTOR TCustomXmlScanner.Create (AOwner: TComponent); +BEGIN + INHERITED; + FXmlParser := TScannerXmlParser.Create (Self); +END; + + +DESTRUCTOR TCustomXmlScanner.Destroy; +BEGIN + FXmlParser.Free; + INHERITED; +END; + + +PROCEDURE TCustomXmlScanner.LoadFromFile (Filename : TFilename); + // Load XML Document from file +BEGIN + FXmlParser.LoadFromFile (Filename); +END; + + +PROCEDURE TCustomXmlScanner.LoadFromBuffer (Buffer : PChar); + // Load XML Document from buffer +BEGIN + FXmlParser.LoadFromBuffer (Buffer); +END; + + +PROCEDURE TCustomXmlScanner.SetBuffer (Buffer : PChar); + // Refer to Buffer +BEGIN + FXmlParser.SetBuffer (Buffer); +END; + + +FUNCTION TCustomXmlScanner.GetFilename : TFilename; +BEGIN + Result := FXmlParser.Source; +END; + + +FUNCTION TCustomXmlScanner.GetNormalize : BOOLEAN; +BEGIN + Result := FXmlParser.Normalize; +END; + + +PROCEDURE TCustomXmlScanner.SetNormalize (Value : BOOLEAN); +BEGIN + FXmlParser.Normalize := Value; +END; + + +PROCEDURE TCustomXmlScanner.WhenXmlProlog(XmlVersion, Encoding: STRING; Standalone : BOOLEAN); + // Is called when the parser has parsed the declaration of the prolog +BEGIN + IF Assigned (FOnXmlProlog) THEN FOnXmlProlog (Self, XmlVersion, Encoding, Standalone); +END; + + +PROCEDURE TCustomXmlScanner.WhenComment (Comment : STRING); + // Is called when the parser has parsed a +BEGIN + IF Assigned (FOnComment) THEN FOnComment (Self, Comment); +END; + + +PROCEDURE TCustomXmlScanner.WhenPI (Target, Content: STRING; Attributes : TAttrList); + // Is called when the parser has parsed a +BEGIN + IF Assigned (FOnPI) THEN FOnPI (Self, Target, Content, Attributes); +END; + + +PROCEDURE TCustomXmlScanner.WhenDtdRead (RootElementName : STRING); + // Is called when the parser has completely parsed the DTD +BEGIN + IF Assigned (FOnDtdRead) THEN FOnDtdRead (Self, RootElementName); +END; + + +PROCEDURE TCustomXmlScanner.WhenStartTag (TagName : STRING; Attributes : TAttrList); + // Is called when the parser has parsed a start tag like

+BEGIN + IF Assigned (FOnStartTag) THEN FOnStartTag (Self, TagName, Attributes); +END; + + +PROCEDURE TCustomXmlScanner.WhenEmptyTag (TagName : STRING; Attributes : TAttrList); + // Is called when the parser has parsed an Empty Element Tag like
+BEGIN + IF Assigned (FOnEmptyTag) THEN FOnEmptyTag (Self, TagName, Attributes); +END; + + +PROCEDURE TCustomXmlScanner.WhenEndTag (TagName : STRING); + // Is called when the parser has parsed an End Tag like

+BEGIN + IF Assigned (FOnEndTag) THEN FOnEndTag (Self, TagName); +END; + + +PROCEDURE TCustomXmlScanner.WhenContent (Content : STRING); + // Is called when the parser has parsed an element's text content +BEGIN + IF Assigned (FOnContent) THEN FOnContent (Self, Content); +END; + + +PROCEDURE TCustomXmlScanner.WhenCData (Content : STRING); + // Is called when the parser has parsed a CDATA section +BEGIN + IF Assigned (FOnCData) THEN FOnCData (Self, Content); +END; + + +PROCEDURE TCustomXmlScanner.WhenElement (ElemDef : TElemDef); + // Is called when the parser has parsed an definition + // inside the DTD +BEGIN + IF Assigned (FOnElement) THEN FOnElement (Self, ElemDef); +END; + + +PROCEDURE TCustomXmlScanner.WhenAttList (ElemDef : TElemDef); + // Is called when the parser has parsed an definition + // inside the DTD +BEGIN + IF Assigned (FOnAttList) THEN FOnAttList (Self, ElemDef); +END; + + +PROCEDURE TCustomXmlScanner.WhenEntity (EntityDef : TEntityDef); + // Is called when the parser has parsed an definition + // inside the DTD +BEGIN + IF Assigned (FOnEntity) THEN FOnEntity (Self, EntityDef); +END; + + +PROCEDURE TCustomXmlScanner.WhenNotation (NotationDef : TNotationDef); + // Is called when the parser has parsed a definition + // inside the DTD +BEGIN + IF Assigned (FOnNotation) THEN FOnNotation (Self, NotationDef); +END; + + +PROCEDURE TCustomXmlScanner.WhenDtdError (ErrorPos : PChar); + // Is called when the parser has found an Error in the DTD +BEGIN + IF Assigned (FOnDtdError) THEN FOnDtdError (Self, ErrorPos); +END; + + +PROCEDURE TCustomXmlScanner.Execute; + // Perform scanning + // Scanning is done synchronously, i.e. you can expect events to be triggered + // in the order of the XML data stream. Execute will finish when the whole XML + // document has been scanned or when the StopParser property has been set to TRUE. +BEGIN + FStopParser := FALSE; + FXmlParser.StartScan; + WHILE FXmlParser.Scan AND (NOT FStopParser) DO + CASE FXmlParser.CurPartType OF + ptNone : ; + ptXmlProlog : WhenXmlProlog (FXmlParser.XmlVersion, FXmlParser.Encoding, FXmlParser.Standalone); + ptComment : WhenComment (StrSFPas (FXmlParser.CurStart, FXmlParser.CurFinal)); + ptPI : WhenPI (FXmlParser.CurName, FXmlParser.CurContent, FXmlParser.CurAttr); + ptDtdc : WhenDtdRead (FXmlParser.RootName); + ptStartTag : WhenStartTag (FXmlParser.CurName, FXmlParser.CurAttr); + ptEmptyTag : WhenEmptyTag (FXmlParser.CurName, FXmlParser.CurAttr); + ptEndTag : WhenEndTag (FXmlParser.CurName); + ptContent : WhenContent (FXmlParser.CurContent); + ptCData : WhenCData (FXmlParser.CurContent); + END; +END; + + +END. diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/logger.pas b/Game/Code/lib/JEDI-SDL/SDL/Pas/logger.pas new file mode 100644 index 00000000..88bb1698 --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/logger.pas @@ -0,0 +1,176 @@ +unit logger; +{ + $Id: logger.pas,v 1.1 2004/02/05 00:08:20 savage Exp $ + +} +{******************************************************************************} +{ } +{ Error Logging Unit } +{ } +{ The initial developer of this Pascal code was : } +{ Dominique Louis } +{ } +{ Portions created by Dominique Louis are } +{ Copyright (C) 2000 - 2001 Dominique Louis. } +{ } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ Logging functions... } +{ } +{ } +{ Requires } +{ -------- } +{ SDL.dll on Windows platforms } +{ libSDL-1.1.so.0 on Linux platform } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ 2001 - DL : Initial creation } +{ 25/10/2001 - DRE : Added $M+ directive to allow published } +{ in classes. Added a compile directive } +{ around fmShareExclusive as this does not } +{ exist in Free Pascal } +{ } +{******************************************************************************} +{ + $Log: logger.pas,v $ + Revision 1.1 2004/02/05 00:08:20 savage + Module 1.0 release + + +} + +{$I jedi-sdl.inc} + +{$WEAKPACKAGEUNIT OFF} + +interface + +uses + Classes, + SysUtils; + +type + TLogger = class + private + FFileHandle : TextFile; + FApplicationName : string; + FApplicationPath : string; + protected + + public + constructor Create; + destructor Destroy; override; + function GetApplicationName: string; + function GetApplicationPath: string; + procedure LogError( ErrorMessage : string; Location : string ); + procedure LogWarning( WarningMessage : string; Location : string ); + procedure LogStatus( StatusMessage : string; Location : string ); + published + property ApplicationName : string read GetApplicationName; + property ApplicationPath : string read GetApplicationPath; + end; + +var + Log : TLogger; + +implementation + +{ TLogger } +constructor TLogger.Create; +begin + FApplicationName := ExtractFileName( ParamStr(0) ); + FApplicationPath := ExtractFilePath( ParamStr(0) ); + AssignFile( FFileHandle, FApplicationPath + ChangeFileExt( FApplicationName, '.log' ) ); + ReWrite( FFileHandle ); + (*inherited Create( FApplicationPath + ChangeFileExt( FApplicationName, '.log' ), + fmCreate {$IFNDEF FPC}or fmShareExclusive{$ENDIF} );*) +end; + +destructor TLogger.Destroy; +begin + CloseFile( FFileHandle ); + inherited; +end; + +function TLogger.GetApplicationName: string; +begin + result := FApplicationName; +end; + +function TLogger.GetApplicationPath: string; +begin + result := FApplicationPath; +end; + +procedure TLogger.LogError(ErrorMessage, Location: string); +var + S : string; +begin + S := '*** ERROR *** : @ ' + TimeToStr(Time) + ' MSG : ' + ErrorMessage + ' IN : ' + Location + #13#10; + WriteLn( FFileHandle, S ); + Flush( FFileHandle ); +end; + +procedure TLogger.LogStatus(StatusMessage, Location: string); +var + S : string; +begin + S := 'STATUS INFO : @ ' + TimeToStr(Time) + ' MSG : ' + StatusMessage + ' IN : ' + Location + #13#10; + WriteLn( FFileHandle, S ); + Flush( FFileHandle ); +end; + +procedure TLogger.LogWarning(WarningMessage, Location: string); +var + S : string; +begin + S := '=== WARNING === : @ ' + TimeToStr(Time) + ' MSG : ' + WarningMessage + ' IN : ' + Location + #13#10; + WriteLn( FFileHandle, S ); + Flush( FFileHandle ); +end; + +initialization +begin + Log := TLogger.Create; + Log.LogStatus( 'Starting Application', 'Initialization' ); +end; + +finalization +begin + Log.LogStatus( 'Terminating Application', 'Finalization' ); + Log.Free; + Log := nil; +end; + +end. + \ No newline at end of file diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/moduleloader.pas b/Game/Code/lib/JEDI-SDL/SDL/Pas/moduleloader.pas new file mode 100644 index 00000000..146e4b30 --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/moduleloader.pas @@ -0,0 +1,319 @@ +unit moduleloader; +{ + $Id: moduleloader.pas,v 1.4 2004/02/20 17:19:10 savage Exp $ + +} +{******************************************************************} +{ } +{ Project JEDI } +{ OS independent Dynamic Loading Helpers } +{ } +{ The initial developer of the this code is } +{ Robert Marquardt INVALID_MODULEHANDLE_VALUE; +end; + +// load the DLL file FileName +// LoadLibraryEx is used to get better control of the loading +// for the allowed values for flags see LoadLibraryEx documentation. + +function LoadModuleEx(var Module: TModuleHandle; FileName: PChar; Flags: Cardinal): Boolean; +begin + if Module = INVALID_MODULEHANDLE_VALUE then + Module := LoadLibraryEx( FileName, 0, Flags); + Result := Module <> INVALID_MODULEHANDLE_VALUE; +end; + +// unload a DLL loaded with LoadModule or LoadModuleEx +// The procedure will not try to unload a handle with +// value INVALID_MODULEHANDLE_VALUE and assigns this value +// to Module after unload. + +procedure UnloadModule(var Module: TModuleHandle); +begin + if Module <> INVALID_MODULEHANDLE_VALUE then + FreeLibrary(Module); + Module := INVALID_MODULEHANDLE_VALUE; +end; + +// returns the pointer to the symbol named SymbolName +// if it is exported from the DLL Module +// nil is returned if the symbol is not available + +function GetModuleSymbol(Module: TModuleHandle; SymbolName: PChar): Pointer; +begin + Result := nil; + if Module <> INVALID_MODULEHANDLE_VALUE then + Result := GetProcAddress(Module, SymbolName ); +end; + +// returns the pointer to the symbol named SymbolName +// if it is exported from the DLL Module +// nil is returned if the symbol is not available. +// as an extra the boolean variable Accu is updated +// by anding in the success of the function. +// This is very handy for rendering a global result +// when accessing a long list of symbols. + +function GetModuleSymbolEx(Module: TModuleHandle; SymbolName: PChar; var Accu: Boolean): Pointer; +begin + Result := nil; + if Module <> INVALID_MODULEHANDLE_VALUE then + Result := GetProcAddress(Module, SymbolName ); + Accu := Accu and (Result <> nil); +end; + +// get the value of variables exported from a DLL Module +// Delphi cannot access variables in a DLL directly, so +// this function allows to copy the data from the DLL. +// Beware! You are accessing the DLL memory image directly. +// Be sure to access a variable not a function and be sure +// to read the correct amount of data. + +function ReadModuleData(Module: TModuleHandle; SymbolName: PChar; var Buffer; Size: Cardinal): Boolean; +var + Sym: Pointer; +begin + Result := True; + Sym := GetModuleSymbolEx(Module, SymbolName, Result); + if Result then + Move(Sym^, Buffer, Size); +end; + +// set the value of variables exported from a DLL Module +// Delphi cannot access variables in a DLL directly, so +// this function allows to copy the data to the DLL! +// BEWARE! You are accessing the DLL memory image directly. +// Be sure to access a variable not a function and be sure +// to write the correct amount of data. +// The changes are not persistent. They get lost when the +// DLL is unloaded. + +function WriteModuleData(Module: TModuleHandle; SymbolName: PChar; var Buffer; Size: Cardinal): Boolean; +var + Sym: Pointer; +begin + Result := True; + Sym := GetModuleSymbolEx(Module, SymbolName, Result); + if Result then + Move(Buffer, Sym^, Size); +end; + +{$ENDIF} + +{$IFDEF Unix} +uses +{$ifdef Linux} + Types, + Libc; +{$else} + dl, + Types, + Baseunix, + Unix; +{$endif} +type + // Handle to a loaded .so + TModuleHandle = Pointer; + +const + // Value designating an unassigned TModuleHandle od a failed loading + INVALID_MODULEHANDLE_VALUE = TModuleHandle(nil); + +function LoadModule(var Module: TModuleHandle; FileName: PChar): Boolean; +function LoadModuleEx(var Module: TModuleHandle; FileName: PChar; Flags: Cardinal): Boolean; +procedure UnloadModule(var Module: TModuleHandle); +function GetModuleSymbol(Module: TModuleHandle; SymbolName: PChar): Pointer; +function GetModuleSymbolEx(Module: TModuleHandle; SymbolName: PChar; var Accu: Boolean): Pointer; +function ReadModuleData(Module: TModuleHandle; SymbolName: PChar; var Buffer; Size: Cardinal): Boolean; +function WriteModuleData(Module: TModuleHandle; SymbolName: PChar; var Buffer; Size: Cardinal): Boolean; + +implementation + +// load the .so file FileName +// the rules for FileName are those of dlopen() +// Returns: True = success, False = failure to load +// Assigns: the handle of the loaded .so to Module +// Warning: if Module has any other value than INVALID_MODULEHANDLE_VALUE +// on entry the function will do nothing but returning success. + +function LoadModule(var Module: TModuleHandle; FileName: PChar): Boolean; +begin + if Module = INVALID_MODULEHANDLE_VALUE then + Module := dlopen( FileName, RTLD_NOW); + Result := Module <> INVALID_MODULEHANDLE_VALUE; +end; + +// load the .so file FileName +// dlopen() with flags is used to get better control of the loading +// for the allowed values for flags see "man dlopen". + +function LoadModuleEx(var Module: TModuleHandle; FileName: PChar; Flags: Cardinal): Boolean; +begin + if Module = INVALID_MODULEHANDLE_VALUE then + Module := dlopen( FileName, Flags); + Result := Module <> INVALID_MODULEHANDLE_VALUE; +end; + +// unload a .so loaded with LoadModule or LoadModuleEx +// The procedure will not try to unload a handle with +// value INVALID_MODULEHANDLE_VALUE and assigns this value +// to Module after unload. + +procedure UnloadModule(var Module: TModuleHandle); +begin + if Module <> INVALID_MODULEHANDLE_VALUE then + dlclose(Module); + Module := INVALID_MODULEHANDLE_VALUE; +end; + +// returns the pointer to the symbol named SymbolName +// if it is exported from the .so Module +// nil is returned if the symbol is not available + +function GetModuleSymbol(Module: TModuleHandle; SymbolName: PChar): Pointer; +begin + Result := nil; + if Module <> INVALID_MODULEHANDLE_VALUE then + Result := dlsym(Module, SymbolName ); +end; + +// returns the pointer to the symbol named SymbolName +// if it is exported from the .so Module +// nil is returned if the symbol is not available. +// as an extra the boolean variable Accu is updated +// by anding in the success of the function. +// This is very handy for rendering a global result +// when accessing a long list of symbols. + +function GetModuleSymbolEx(Module: TModuleHandle; SymbolName: PChar; var Accu: Boolean): Pointer; +begin + Result := nil; + if Module <> INVALID_MODULEHANDLE_VALUE then + Result := dlsym(Module, SymbolName ); + Accu := Accu and (Result <> nil); +end; + +// get the value of variables exported from a .so Module +// Delphi cannot access variables in a .so directly, so +// this function allows to copy the data from the .so. +// Beware! You are accessing the .so memory image directly. +// Be sure to access a variable not a function and be sure +// to read the correct amount of data. + +function ReadModuleData(Module: TModuleHandle; SymbolName: PChar; var Buffer; Size: Cardinal): Boolean; +var + Sym: Pointer; +begin + Result := True; + Sym := GetModuleSymbolEx(Module, SymbolName, Result); + if Result then + Move(Sym^, Buffer, Size); +end; + +// set the value of variables exported from a .so Module +// Delphi cannot access variables in a .so directly, so +// this function allows to copy the data to the .so! +// BEWARE! You are accessing the .so memory image directly. +// Be sure to access a variable not a function and be sure +// to write the correct amount of data. +// The changes are not persistent. They get lost when the +// .so is unloaded. + +function WriteModuleData(Module: TModuleHandle; SymbolName: PChar; var Buffer; Size: Cardinal): Boolean; +var + Sym: Pointer; +begin + Result := True; + Sym := GetModuleSymbolEx(Module, SymbolName, Result); + if Result then + Move(Buffer, Sym^, Size); +end; +{$ENDIF} + +{$IFDEF __MACH__} // Mach definitions go here +{$ENDIF} + +end. diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/registryuserpreferences.pas b/Game/Code/lib/JEDI-SDL/SDL/Pas/registryuserpreferences.pas new file mode 100644 index 00000000..2d28a222 --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/registryuserpreferences.pas @@ -0,0 +1,229 @@ +unit registryuserpreferences; +{ + $Id: registryuserpreferences.pas,v 1.1 2004/09/30 22:35:47 savage Exp $ + +} +{******************************************************************************} +{ } +{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } +{ Wrapper class for Windows Register and INI Files } +{ } +{ The initial developer of this Pascal code was : } +{ Dominqiue Louis } +{ } +{ Portions created by Dominqiue Louis are } +{ Copyright (C) 2000 - 2001 Dominqiue Louis. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ } +{ } +{ } +{ } +{ } +{ } +{ } +{ Requires } +{ -------- } +{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } +{ They are available from... } +{ http://www.libsdl.org . } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ September 23 2004 - DL : Initial Creation } +{ + $Log: registryuserpreferences.pas,v $ + Revision 1.1 2004/09/30 22:35:47 savage + Changes, enhancements and additions as required to get SoAoS working. + + +} +{******************************************************************************} + +interface + +uses + {$IFDEF REG} + Registry, + {$ELSE} + IniFiles, + {$ENDIF} + Classes, + userpreferences; + +type + TRegistryUserPreferences = class( TUserPreferences ) + private + + protected + function GetSection( const Index : Integer ) : string; virtual; abstract; + function GetIdentifier( const Index : Integer ) : string; virtual; abstract; + function GetDefaultBoolean( const Index : Integer ) : Boolean; override; + function GetBoolean( const Index : Integer ) : Boolean; override; + procedure SetBoolean( const Index : Integer; const Value : Boolean ); override; + function GetDefaultDateTime( const Index : Integer ) : TDateTime; override; + function GetDateTime( const Index : Integer ) : TDateTime; override; + procedure SetDateTime( const Index : Integer; const Value : TDateTime ); override; + function GetDefaultInteger( const Index : Integer ) : Integer; override; + function GetInteger( const Index : Integer ) : Integer; override; + procedure SetInteger( const Index : Integer; const Value : Integer ); override; + function GetDefaultFloat( const Index : Integer ) : single; override; + function GetFloat( const Index : Integer ) : single; override; + procedure SetFloat( const Index : Integer; const Value : single ); override; + function GetDefaultString( const Index : Integer ) : string; override; + function GetString( const Index : Integer ) : string; override; + procedure SetString( const Index : Integer; const Value : string ); override; + public + Registry : {$IFDEF REG}TRegIniFile{$ELSE}TIniFile{$ENDIF}; + constructor Create( const FileName : string = '' ); reintroduce; + destructor Destroy; override; + procedure Update; override; + end; + +implementation + +uses + SysUtils; + +{ TRegistryUserPreferences } +constructor TRegistryUserPreferences.Create( const FileName : string ); +var + defFileName : string; +begin + inherited Create; + + if FileName <> '' then + defFileName := FileName + else + defFileName := ChangeFileExt( ParamStr( 0 ), '.ini' ); + + Registry := {$IFDEF REG}TRegIniFile{$ELSE}TIniFile{$ENDIF}.Create( defFileName ); +end; + +destructor TRegistryUserPreferences.Destroy; +begin + Update; + Registry.Free; + Registry := nil; + inherited; +end; + +function TRegistryUserPreferences.GetBoolean( const Index : Integer ) : Boolean; +begin + Result := Registry.ReadBool( GetSection( Index ), GetIdentifier( Index ), GetDefaultBoolean( Index ) ); +end; + +function TRegistryUserPreferences.GetDateTime( const Index : Integer ): TDateTime; +begin + Result := Registry.ReadDateTime( GetSection( Index ){$IFNDEF REG}, GetIdentifier( Index ), GetDefaultDateTime( Index ){$ENDIF} ); +end; + +function TRegistryUserPreferences.GetDefaultBoolean( const Index : Integer ) : Boolean; +begin + result := false; +end; + +function TRegistryUserPreferences.GetDefaultDateTime( const Index: Integer ) : TDateTime; +begin + result := Now; +end; + +function TRegistryUserPreferences.GetDefaultFloat( const Index: Integer ) : single; +begin + result := 0.0; +end; + +function TRegistryUserPreferences.GetDefaultInteger(const Index : Integer ) : Integer; +begin + result := 0; +end; + +function TRegistryUserPreferences.GetDefaultString( const Index : Integer ) : string; +begin + result := ''; +end; + +function TRegistryUserPreferences.GetFloat( const Index : Integer ): single; +begin + Result := Registry.ReadFloat( GetSection( Index ){$IFNDEF REG}, GetIdentifier( Index ), GetDefaultFloat( Index ){$ENDIF} ); +end; + +function TRegistryUserPreferences.GetInteger( const Index : Integer ) : Integer; +begin + Result := Registry.ReadInteger( GetSection( Index ), GetIdentifier( Index ), GetDefaultInteger( Index ) ); +end; + +function TRegistryUserPreferences.GetString( const Index : Integer ): string; +begin + Result := Registry.ReadString( GetSection( Index ), GetIdentifier( Index ), GetDefaultString( Index ) ); +end; + +procedure TRegistryUserPreferences.SetBoolean( const Index : Integer; const Value : Boolean ); +begin + Registry.WriteBool( GetSection( Index ), GetIdentifier( Index ), Value ); + inherited; +end; + +procedure TRegistryUserPreferences.SetDateTime( const Index: Integer; const Value: TDateTime ); +begin + Registry.WriteDateTime( GetSection( Index ){$IFNDEF REG}, GetIdentifier( Index ){$ENDIF}, Value ); + inherited; +end; + +procedure TRegistryUserPreferences.SetFloat(const Index: Integer; const Value: single); +begin + Registry.WriteFloat( GetSection( Index ){$IFNDEF REG}, GetIdentifier( Index ){$ENDIF}, Value ); + inherited; +end; + +procedure TRegistryUserPreferences.SetInteger( const Index, Value : Integer ); +begin + Registry.WriteInteger( GetSection( Index ), GetIdentifier( Index ), Value ); + inherited; +end; + +procedure TRegistryUserPreferences.SetString( const Index : Integer; const Value : string ); +begin + Registry.WriteString( GetSection( Index ), GetIdentifier( Index ), Value ); + inherited; +end; + +procedure TRegistryUserPreferences.Update; +begin + {$IFDEF REG} + Registry.CloseKey; + {$ELSE} + Registry.UpdateFile; + {$ENDIF} +end; + +end. diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/sdl.pas b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdl.pas new file mode 100644 index 00000000..ad5d783a --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdl.pas @@ -0,0 +1,4118 @@ +unit sdl; +{ + $Id: sdl.pas,v 1.17 2005/01/03 18:40:59 savage Exp $ + +} +{******************************************************************************} +{ } +{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } +{ Conversion of the Simple DirectMedia Layer Headers } +{ } +{ Portions created by Sam Lantinga are } +{ Copyright (C) 1997-2004 Sam Lantinga } +{ 5635-34 Springhouse Dr. } +{ Pleasanton, CA 94588 (USA) } +{ } +{ All Rights Reserved. } +{ } +{ The original files are : SDL.h } +{ SDL_main.h } +{ SDL_types.h } +{ SDL_rwops.h } +{ SDL_timer.h } +{ SDL_audio.h } +{ SDL_cdrom.h } +{ SDL_joystick.h } +{ SDL_mouse.h } +{ SDL_keyboard.h } +{ SDL_events.h } +{ SDL_video.h } +{ SDL_byteorder.h } +{ SDL_version.h } +{ SDL_active.h } +{ SDL_thread.h } +{ SDL_mutex .h } +{ SDL_getenv.h } +{ SDL_loadso.h } +{ } +{ The initial developer of this Pascal code was : } +{ Dominqiue Louis } +{ } +{ Portions created by Dominqiue Louis are } +{ Copyright (C) 2000 - 2004 Dominqiue Louis. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ Tom Jones His Project inspired this conversion } +{ Matthias Thoma } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ } +{ } +{ } +{ } +{ } +{ } +{ } +{ Requires } +{ -------- } +{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } +{ They are available from... } +{ http://www.libsdl.org . } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ May 08 2001 - DL : Added Keyboard State Array ( See demos for how to } +{ use ) } +{ PKeyStateArr = ^TKeyStateArr; } +{ TKeyStateArr = array[0..65000] of UInt8; } +{ As most games will need it. } +{ } +{ April 02 2001 - DL : Added SDL_getenv.h definitions and tested version } +{ 1.2.0 compatability. } +{ } +{ March 13 2001 - MT : Added Linux compatibility. } +{ } +{ March 10 2001 - MT : Added externalsyms for DEFINES } +{ Changed the license header } +{ } +{ March 09 2001 - MT : Added Kylix Ifdefs/Deleted the uses mmsystem } +{ } +{ March 01 2001 - DL : Update conversion of version 1.1.8 } +{ } +{ July 22 2001 - DL : Added TUInt8Array and PUIntArray after suggestions } +{ from Matthias Thoma and Eric Grange. } +{ } +{ October 12 2001 - DL : Various changes as suggested by Matthias Thoma and } +{ David Acklam } +{ } +{ October 24 2001 - DL : Added FreePascal support as per suggestions from } +{ Dean Ellis. } +{ } +{ October 27 2001 - DL : Added SDL_BUTTON macro } +{ } +{ November 08 2001 - DL : Bug fix as pointed out by Puthoon. } +{ } +{ November 29 2001 - DL : Bug fix of SDL_SetGammaRamp as pointed out by Simon} +{ Rushton. } +{ } +{ November 30 2001 - DL : SDL_NOFRAME added as pointed out by Simon Rushton. } +{ } +{ December 11 2001 - DL : Added $WEAKPACKAGEUNIT ON to facilitate useage in } +{ Components } +{ } +{ January 05 2002 - DL : Added SDL_Swap32 function as suggested by Matthias } +{ Thoma and also made sure the _getenv from } +{ MSVCRT.DLL uses the right calling convention } +{ } +{ January 25 2002 - DL : Updated conversion of SDL_AddTimer & } +{ SDL_RemoveTimer as per suggestions from Matthias } +{ Thoma. } +{ } +{ January 27 2002 - DL : Commented out exported function putenv and getenv } +{ So that developers get used to using SDL_putenv } +{ SDL_getenv, as they are more portable } +{ } +{ March 05 2002 - DL : Added FreeAnNil procedure for Delphi 4 users. } +{ } +{ October 23 2002 - DL : Added Delphi 3 Define of Win32. } +{ If you intend to you Delphi 3... } +{ ( which is officially unsupported ) make sure you } +{ remove references to $EXTERNALSYM in this and other} +{ SDL files. } +{ } +{ November 29 2002 - DL : Fixed bug in Declaration of SDL_GetRGBA that was } +{ pointed out by Todd Lang } +{ } +{ April 03 2003 - DL : Added jedi-sdl.inc include file to support more } +{ Pascal compilers. Initial support is now included } +{ for GnuPascal, VirtualPascal, TMT and obviously } +{ continue support for Delphi Kylix and FreePascal. } +{ } +{ April 08 2003 - MK : Aka Mr Kroket - Added Better FPC support } +{ } +{ April 24 2003 - DL : under instruction from Alexey Barkovoy, I have added} +{ better TMT Pascal support and under instruction } +{ from Prof. Abimbola Olowofoyeku (The African Chief),} +{ I have added better Gnu Pascal support } +{ } +{ April 30 2003 - DL : under instruction from David Mears AKA } +{ Jason Siletto, I have added FPC Linux support. } +{ This was compiled with fpc 1.1, so remember to set } +{ include file path. ie. -Fi/usr/share/fpcsrc/rtl/* } +{ } +{ + $Log: sdl.pas,v $ + Revision 1.17 2005/01/03 18:40:59 savage + Updated Version number to reflect latest one + + Revision 1.16 2005/01/01 02:02:06 savage + Updated to v1.2.8 + + Revision 1.15 2004/12/24 18:57:11 savage + forgot to apply Michalis Kamburelis' patch to the implementation section. now fixed + + Revision 1.14 2004/12/23 23:42:18 savage + Applied Patches supplied by Michalis Kamburelis ( THANKS! ), for greater FreePascal compatability. + + Revision 1.13 2004/09/30 22:31:59 savage + Updated with slightly different header comments + + Revision 1.12 2004/09/12 21:52:58 savage + Slight changes to fix some issues with the sdl classes. + + Revision 1.11 2004/08/14 22:54:30 savage + Updated so that Library name defines are correctly defined for MacOS X. + + Revision 1.10 2004/07/20 23:57:33 savage + Thanks to Paul Toth for spotting an error in the SDL Audio Convertion structures. + In TSDL_AudioCVT the filters variable should point to and array of pointers and not what I had there previously. + + Revision 1.9 2004/07/03 22:07:22 savage + Added Bitwise Manipulation Functions for TSDL_VideoInfo struct. + + Revision 1.8 2004/05/10 14:10:03 savage + Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ). + + Revision 1.7 2004/04/13 09:32:08 savage + Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary. + + Revision 1.6 2004/04/01 20:53:23 savage + Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site. + + Revision 1.5 2004/02/22 15:32:10 savage + SDL_GetEnv Fix so it also works on FPC/Linux. Thanks to Rodrigo for pointing this out. + + Revision 1.4 2004/02/21 23:24:29 savage + SDL_GetEnv Fix so that it is not define twice for FPC. Thanks to Rene Hugentobler for pointing out this bug, + + Revision 1.3 2004/02/18 22:35:51 savage + Brought sdl.pas up to 1.2.7 compatability + Thus... + Added SDL_GL_STEREO, + SDL_GL_MULTISAMPLEBUFFERS, + SDL_GL_MULTISAMPLESAMPLES + + Add DLL/Shared object functions + function SDL_LoadObject( const sofile : PChar ) : Pointer; + + function SDL_LoadFunction( handle : Pointer; const name : PChar ) : Pointer; + + procedure SDL_UnloadObject( handle : Pointer ); + + Added function to create RWops from const memory: SDL_RWFromConstMem() + function SDL_RWFromConstMem(const mem: Pointer; size: Integer) : PSDL_RWops; + + Ported SDL_cpuinfo.h so Now you can test for Specific CPU types. + + Revision 1.2 2004/02/17 21:37:12 savage + Tidying up of units + + Revision 1.1 2004/02/05 00:08:20 savage + Module 1.0 release + +} +{******************************************************************************} + +{$I jedi-sdl.inc} + +{$ALIGN ON} + +interface + +uses +{$IFDEF __GPC__} + system, + gpc; +{$ENDIF} + +{$IFDEF WIN32} + {$IFNDEF __GPC__} + Windows; + {$ENDIF} +{$ENDIF} + +{$IFDEF UNIX} + {$IFDEF FPC} + {$IFDEF Ver1_0} + linux, + {$ELSE} + pthreads, + baseunix, + unix, + {$ENDIF} + x, + xlib; + {$ELSE} + Types, + Libc, + Xlib; + {$ENDIF} +{$ENDIF} + +{$IFDEF __MACH__} + GPCMacOSAll; +{$ENDIF} + +const +{$IFDEF WIN32} + SDLLibName = 'SDL.dll'; +{$ENDIF} + +{$IFDEF UNIX} +{$IFDEF DARWIN} + SDLLibName = 'libSDL.dylib'; +{$ELSE} + SDLLibName = 'libSDL.so'; +{$ENDIF} +{$ENDIF} + +{$IFDEF MACOS} + SDLLibName = 'SDL'; +{$ENDIF} + + // SDL.h constants + SDL_INIT_TIMER = $00000001; +{$EXTERNALSYM SDL_INIT_TIMER} + SDL_INIT_AUDIO = $00000010; +{$EXTERNALSYM SDL_INIT_AUDIO} + SDL_INIT_VIDEO = $00000020; +{$EXTERNALSYM SDL_INIT_VIDEO} + SDL_INIT_CDROM = $00000100; +{$EXTERNALSYM SDL_INIT_CDROM} + SDL_INIT_JOYSTICK = $00000200; +{$EXTERNALSYM SDL_INIT_JOYSTICK} + SDL_INIT_NOPARACHUTE = $00100000; // Don't catch fatal signals +{$EXTERNALSYM SDL_INIT_NOPARACHUTE} + SDL_INIT_EVENTTHREAD = $01000000; // Not supported on all OS's +{$EXTERNALSYM SDL_INIT_EVENTTHREAD} + SDL_INIT_EVERYTHING = $0000FFFF; +{$EXTERNALSYM SDL_INIT_EVERYTHING} + + // SDL_error.h constants + ERR_MAX_STRLEN = 128; +{$EXTERNALSYM ERR_MAX_STRLEN} + ERR_MAX_ARGS = 5; +{$EXTERNALSYM ERR_MAX_ARGS} + + // SDL_types.h constants + SDL_PRESSED = $01; +{$EXTERNALSYM SDL_PRESSED} + SDL_RELEASED = $00; +{$EXTERNALSYM SDL_RELEASED} + + // SDL_timer.h constants + // This is the OS scheduler timeslice, in milliseconds + SDL_TIMESLICE = 10; +{$EXTERNALSYM SDL_TIMESLICE} + // This is the maximum resolution of the SDL timer on all platforms + TIMER_RESOLUTION = 10; // Experimentally determined +{$EXTERNALSYM TIMER_RESOLUTION} + + // SDL_audio.h constants + AUDIO_U8 = $0008; // Unsigned 8-bit samples +{$EXTERNALSYM AUDIO_U8} + AUDIO_S8 = $8008; // Signed 8-bit samples +{$EXTERNALSYM AUDIO_S8} + AUDIO_U16LSB = $0010; // Unsigned 16-bit samples +{$EXTERNALSYM AUDIO_U16LSB} + AUDIO_S16LSB = $8010; // Signed 16-bit samples +{$EXTERNALSYM AUDIO_S16LSB} + AUDIO_U16MSB = $1010; // As above, but big-endian byte order +{$EXTERNALSYM AUDIO_U16MSB} + AUDIO_S16MSB = $9010; // As above, but big-endian byte order +{$EXTERNALSYM AUDIO_S16MSB} + AUDIO_U16 = AUDIO_U16LSB; +{$EXTERNALSYM AUDIO_U16} + AUDIO_S16 = AUDIO_S16LSB; +{$EXTERNALSYM AUDIO_S16} + + + // SDL_cdrom.h constants + // The maximum number of CD-ROM tracks on a disk + SDL_MAX_TRACKS = 99; +{$EXTERNALSYM SDL_MAX_TRACKS} + // The types of CD-ROM track possible + SDL_AUDIO_TRACK = $00; +{$EXTERNALSYM SDL_AUDIO_TRACK} + SDL_DATA_TRACK = $04; +{$EXTERNALSYM SDL_DATA_TRACK} + + // Conversion functions from frames to Minute/Second/Frames and vice versa + CD_FPS = 75; +{$EXTERNALSYM CD_FPS} + // SDL_byteorder.h constants + // The two types of endianness + SDL_LIL_ENDIAN = 1234; +{$EXTERNALSYM SDL_LIL_ENDIAN} + SDL_BIG_ENDIAN = 4321; +{$EXTERNALSYM SDL_BIG_ENDIAN} + +{$IFDEF IA32} + + SDL_BYTEORDER = SDL_LIL_ENDIAN; +{$EXTERNALSYM SDL_BYTEORDER} + // Native audio byte ordering + AUDIO_U16SYS = AUDIO_U16LSB; +{$EXTERNALSYM AUDIO_U16SYS} + AUDIO_S16SYS = AUDIO_S16LSB; +{$EXTERNALSYM AUDIO_S16SYS} + +{$ELSE} + + SDL_BYTEORDER = SDL_BIG_ENDIAN; +{$EXTERNALSYM SDL_BYTEORDER} + // Native audio byte ordering + AUDIO_U16SYS = AUDIO_U16MSB; +{$EXTERNALSYM AUDIO_U16SYS} + AUDIO_S16SYS = AUDIO_S16MSB; +{$EXTERNALSYM AUDIO_S16SYS} + +{$ENDIF} + + + SDL_MIX_MAXVOLUME = 128; +{$EXTERNALSYM SDL_MIX_MAXVOLUME} + + // SDL_joystick.h constants + MAX_JOYSTICKS = 2; // only 2 are supported in the multimedia API +{$EXTERNALSYM MAX_JOYSTICKS} + MAX_AXES = 6; // each joystick can have up to 6 axes +{$EXTERNALSYM MAX_AXES} + MAX_BUTTONS = 32; // and 32 buttons +{$EXTERNALSYM MAX_BUTTONS} + AXIS_MIN = -32768; // minimum value for axis coordinate +{$EXTERNALSYM AXIS_MIN} + AXIS_MAX = 32767; // maximum value for axis coordinate +{$EXTERNALSYM AXIS_MAX} + JOY_AXIS_THRESHOLD = (((AXIS_MAX) - (AXIS_MIN)) / 100); // 1% motion +{$EXTERNALSYM JOY_AXIS_THRESHOLD} + //JOY_BUTTON_FLAG(n) (1< } + + { Function prototype for the new timer callback function. + The callback function is passed the current timer interval and returns + the next timer interval. If the returned value is the same as the one + passed in, the periodic alarm continues, otherwise a new alarm is + scheduled. If the callback returns 0, the periodic alarm is cancelled. } + {$IFNDEF __GPC__} + TSDL_NewTimerCallback = function( interval: UInt32; param: Pointer ): UInt32; cdecl; + {$ELSE} + TSDL_NewTimerCallback = function( interval: UInt32; param: Pointer ): UInt32; + {$ENDIF} + + // Definition of the timer ID type + PSDL_TimerID = ^TSDL_TimerID; + TSDL_TimerID = record + interval: UInt32; + callback: TSDL_NewTimerCallback; + param: Pointer; + last_alarm: UInt32; + next: PSDL_TimerID; + end; + + {$IFNDEF __GPC__} + TSDL_AudioSpecCallback = procedure( userdata: Pointer; stream: PUInt8; len: Integer ); cdecl; + {$ELSE} + TSDL_AudioSpecCallback = procedure( userdata: Pointer; stream: PUInt8; len: Integer ); + {$ENDIF} + + // SDL_audio.h types + // The calculated values in this structure are calculated by SDL_OpenAudio() + PSDL_AudioSpec = ^TSDL_AudioSpec; + TSDL_AudioSpec = record + freq: Integer; // DSP frequency -- samples per second + format: UInt16; // Audio data format + channels: UInt8; // Number of channels: 1 mono, 2 stereo + silence: UInt8; // Audio buffer silence value (calculated) + samples: UInt16; // Audio buffer size in samples + padding: UInt16; // Necessary for some compile environments + size: UInt32; // Audio buffer size in bytes (calculated) + { This function is called when the audio device needs more data. + 'stream' is a pointer to the audio data buffer + 'len' is the length of that buffer in bytes. + Once the callback returns, the buffer will no longer be valid. + Stereo samples are stored in a LRLRLR ordering.} + callback: TSDL_AudioSpecCallback; + userdata: Pointer; + end; + + // A structure to hold a set of audio conversion filters and buffers + PSDL_AudioCVT = ^TSDL_AudioCVT; + + PSDL_AudioCVTFilter = ^TSDL_AudioCVTFilter; + TSDL_AudioCVTFilter = record + cvt: PSDL_AudioCVT; + format: UInt16; + end; + + PSDL_AudioCVTFilterArray = ^TSDL_AudioCVTFilterArray; + TSDL_AudioCVTFilterArray = array[0..9] of PSDL_AudioCVTFilter; + + TSDL_AudioCVT = record + needed: Integer; // Set to 1 if conversion possible + src_format: UInt16; // Source audio format + dst_format: UInt16; // Target audio format + rate_incr: double; // Rate conversion increment + buf: PUInt8; // Buffer to hold entire audio data + len: Integer; // Length of original audio buffer + len_cvt: Integer; // Length of converted audio buffer + len_mult: Integer; // buffer must be len*len_mult big + len_ratio: double; // Given len, final size is len*len_ratio + filters: TSDL_AudioCVTFilterArray; + filter_index: Integer; // Current audio conversion function + end; + + TSDL_Audiostatus = ( + SDL_AUDIO_STOPPED, + SDL_AUDIO_PLAYING, + SDL_AUDIO_PAUSED + ); + + // SDL_cdrom.h types + TSDL_CDStatus = ( + CD_ERROR, + CD_TRAYEMPTY, + CD_STOPPED, + CD_PLAYING, + CD_PAUSED ); + + PSDL_CDTrack = ^TSDL_CDTrack; + TSDL_CDTrack = record + id: UInt8; // Track number + type_: UInt8; // Data or audio track + unused: UInt16; + length: UInt32; // Length, in frames, of this track + offset: UInt32; // Offset, in frames, from start of disk + end; + + // This structure is only current as of the last call to SDL_CDStatus() + PSDL_CD = ^TSDL_CD; + TSDL_CD = record + id: Integer; // Private drive identifier + status: TSDL_CDStatus; // Current drive status + + // The rest of this structure is only valid if there's a CD in drive + numtracks: Integer; // Number of tracks on disk + cur_track: Integer; // Current track position + cur_frame: Integer; // Current frame offset within current track + track: array[0..SDL_MAX_TRACKS] of TSDL_CDTrack; + end; + + //SDL_joystick.h types + PTransAxis = ^TTransAxis; + TTransAxis = record + offset: Integer; + scale: single; + end; + + // The private structure used to keep track of a joystick + PJoystick_hwdata = ^TJoystick_hwdata; + TJoystick_hwdata = record + // joystick ID + id: Integer; + // values used to translate device-specific coordinates into SDL-standard ranges + transaxis: array[0..5] of TTransAxis; + end; + + PBallDelta = ^TBallDelta; + TBallDelta = record + dx: Integer; + dy: Integer; + end; // Current ball motion deltas + + // The SDL joystick structure + PSDL_Joystick = ^TSDL_Joystick; + TSDL_Joystick = record + index: UInt8; // Device index + name: PChar; // Joystick name - system dependent + + naxes: Integer; // Number of axis controls on the joystick + axes: PUInt16; // Current axis states + + nhats: Integer; // Number of hats on the joystick + hats: PUInt8; // Current hat states + + nballs: Integer; // Number of trackballs on the joystick + balls: PBallDelta; // Current ball motion deltas + + nbuttons: Integer; // Number of buttons on the joystick + buttons: PUInt8; // Current button states + + hwdata: PJoystick_hwdata; // Driver dependent information + + ref_count: Integer; // Reference count for multiple opens + end; + + // SDL_verion.h types + PSDL_version = ^TSDL_version; + TSDL_version = record + major: UInt8; + minor: UInt8; + patch: UInt8; + end; + + // SDL_keyboard.h types + TSDLKey = LongWord; + + TSDLMod = LongWord; + + PSDL_KeySym = ^TSDL_KeySym; + TSDL_KeySym = record + scancode: UInt8; // hardware specific scancode + sym: TSDLKey; // SDL virtual keysym + modifier: TSDLMod; // current key modifiers + unicode: UInt16; // translated character + end; + + // SDL_events.h types + {Checks the event queue for messages and optionally returns them. + If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to + the back of the event queue. + If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front + of the event queue, matching 'mask', will be returned and will not + be removed from the queue. + If 'action' is SDL_GETEVENT, up to 'numevents' events at the front + of the event queue, matching 'mask', will be returned and will be + removed from the queue. + This function returns the number of events actually stored, or -1 + if there was an error. This function is thread-safe. } + + TSDL_EventAction = (SDL_ADDEVENT, SDL_PEEKEVENT, SDL_GETEVENT); + + // Application visibility event structure + TSDL_ActiveEvent = record + type_: UInt8; // SDL_ACTIVEEVENT + gain: UInt8; // Whether given states were gained or lost (1/0) + state: UInt8; // A mask of the focus states + end; + + // Keyboard event structure + TSDL_KeyboardEvent = record + type_: UInt8; // SDL_KEYDOWN or SDL_KEYUP + which: UInt8; // The keyboard device index + state: UInt8; // SDL_PRESSED or SDL_RELEASED + keysym: TSDL_KeySym; + end; + + // Mouse motion event structure + TSDL_MouseMotionEvent = record + type_: UInt8; // SDL_MOUSEMOTION + which: UInt8; // The mouse device index + state: UInt8; // The current button state + x, y: UInt16; // The X/Y coordinates of the mouse + xrel: SInt16; // The relative motion in the X direction + yrel: SInt16; // The relative motion in the Y direction + end; + + // Mouse button event structure + TSDL_MouseButtonEvent = record + type_: UInt8; // SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP + which: UInt8; // The mouse device index + button: UInt8; // The mouse button index + state: UInt8; // SDL_PRESSED or SDL_RELEASED + x: UInt16; // The X coordinates of the mouse at press time + y: UInt16; // The Y coordinates of the mouse at press time + end; + + // Joystick axis motion event structure + TSDL_JoyAxisEvent = record + type_: UInt8; // SDL_JOYAXISMOTION + which: UInt8; // The joystick device index + axis: UInt8; // The joystick axis index + value: SInt16; // The axis value (range: -32768 to 32767) + end; + + // Joystick trackball motion event structure + TSDL_JoyBallEvent = record + type_: UInt8; // SDL_JOYAVBALLMOTION + which: UInt8; // The joystick device index + ball: UInt8; // The joystick trackball index + xrel: SInt16; // The relative motion in the X direction + yrel: SInt16; // The relative motion in the Y direction + end; + + // Joystick hat position change event structure + TSDL_JoyHatEvent = record + type_: UInt8; // SDL_JOYHATMOTION */ + which: UInt8; // The joystick device index */ + hat: UInt8; // The joystick hat index */ + value: UInt8; { The hat position value: + 8 1 2 + 7 0 3 + 6 5 4 + + Note that zero means the POV is centered. } + + end; + + // Joystick button event structure + TSDL_JoyButtonEvent = record + type_: UInt8; // SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP + which: UInt8; // The joystick device index + button: UInt8; // The joystick button index + state: UInt8; // SDL_PRESSED or SDL_RELEASED + end; + + { The "window resized" event + When you get this event, you are responsible for setting a new video + mode with the new width and height. } + TSDL_ResizeEvent = record + type_: UInt8; // SDL_VIDEORESIZE + w: Integer; // New width + h: Integer; // New height + end; + + // The "quit requested" event + PSDL_QuitEvent = ^TSDL_QuitEvent; + TSDL_QuitEvent = record + type_: UInt8; + end; + + // A user-defined event type + PSDL_UserEvent = ^TSDL_UserEvent; + TSDL_UserEvent = record + type_: UInt8; // SDL_USEREVENT through SDL_NUMEVENTS-1 + code: Integer; // User defined event code */ + data1: Pointer; // User defined data pointer */ + data2: Pointer; // User defined data pointer */ + end; + + // The "screen redraw" event + PSDL_ExposeEvent = ^TSDL_ExposeEvent; + TSDL_ExposeEvent = record + type_ : Uint8; // SDL_VIDEOEXPOSE + end; + + {$IFDEF Unix} + //These are the various supported subsystems under UNIX + TSDL_SysWm = ( SDL_SYSWM_X11 ) ; + {$ENDIF} + +// The windows custom event structure +{$IFDEF Win32} + PSDL_SysWMmsg = ^TSDL_SysWMmsg; + TSDL_SysWMmsg = record + version: TSDL_version; + h_wnd: HWND; // The window for the message + msg: UInt; // The type of message + w_Param: WPARAM; // WORD message parameter + lParam: LPARAM; // LONG message parameter + end; +{$ELSE} + +{$IFDEF Unix} +{ The Linux custom event structure } + PSDL_SysWMmsg = ^TSDL_SysWMmsg; + TSDL_SysWMmsg = record + version : TSDL_version; + subsystem : TSDL_SysWm; + {$IFDEF FPC} + event : TXEvent; + {$ELSE} + event : XEvent; + {$ENDIF} + end; +{$ELSE} +{ The generic custom event structure } + PSDL_SysWMmsg = ^TSDL_SysWMmsg; + TSDL_SysWMmsg = record + version: TSDL_version; + data: Integer; + end; +{$ENDIF} + +{$ENDIF} + +// The Windows custom window manager information structure +{$IFDEF Win32} + PSDL_SysWMinfo = ^TSDL_SysWMinfo; + TSDL_SysWMinfo = record + version : TSDL_version; + window : HWnd; // The display window + end; +{$ELSE} + +// The Linux custom window manager information structure +{$IFDEF Unix} + TX11 = record + display : PDisplay; // The X11 display + window : TWindow ; // The X11 display window */ + {* These locking functions should be called around + any X11 functions using the display variable. + They lock the event thread, so should not be + called around event functions or from event filters. + *} + lock_func : Pointer; + unlock_func : Pointer; + + // Introduced in SDL 1.0.2 + fswindow : TWindow ; // The X11 fullscreen window */ + wmwindow : TWindow ; // The X11 managed input window */ + end; + + PSDL_SysWMinfo = ^TSDL_SysWMinfo; + TSDL_SysWMinfo = record + version : TSDL_version ; + subsystem : TSDL_SysWm; + X11 : TX11; + end; +{$ELSE} + // The generic custom window manager information structure + PSDL_SysWMinfo = ^TSDL_SysWMinfo; + TSDL_SysWMinfo = record + version : TSDL_version ; + data : integer; + end; +{$ENDIF} + +{$ENDIF} + + PSDL_SysWMEvent = ^TSDL_SysWMEvent; + TSDL_SysWMEvent = record + type_: UInt8; + msg: PSDL_SysWMmsg; + end; + + PSDL_Event = ^TSDL_Event; + TSDL_Event = record + case UInt8 of + SDL_NOEVENT: (type_: byte); + SDL_ACTIVEEVENT: (active: TSDL_ActiveEvent); + SDL_KEYDOWN, SDL_KEYUP: (key: TSDL_KeyboardEvent); + SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent); + SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP: (button: TSDL_MouseButtonEvent ); + SDL_JOYAXISMOTION: (jaxis: TSDL_JoyAxisEvent ); + SDL_JOYBALLMOTION: (jball: TSDL_JoyBallEvent ); + SDL_JOYHATMOTION: (jhat: TSDL_JoyHatEvent ); + SDL_JOYBUTTONDOWN, SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent ); + SDL_VIDEORESIZE: (resize: TSDL_ResizeEvent ); + SDL_QUITEV: (quit: TSDL_QuitEvent ); + SDL_USEREVENT : ( user : TSDL_UserEvent ); + SDL_SYSWMEVENT: (syswm: TSDL_SysWMEvent ); + end; + + +{ This function sets up a filter to process all events before they + change internal state and are posted to the internal event queue. + + The filter is protypted as: } + {$IFNDEF __GPC__} + TSDL_EventFilter = function( event : PSDL_Event ): Integer; cdecl; + {$ELSE} + TSDL_EventFilter = function( event : PSDL_Event ): Integer; + {$ENDIF} + + // SDL_video.h types + // Useful data types + PPSDL_Rect = ^PSDL_Rect; + PSDL_Rect = ^TSDL_Rect; + TSDL_Rect = record + x, y: SInt16; + w, h: UInt16; + end; + + SDL_Rect = TSDL_Rect; +{$EXTERNALSYM SDL_Rect} + + PSDL_Color = ^TSDL_Color; + TSDL_Color = record + r: UInt8; + g: UInt8; + b: UInt8; + unused: UInt8; + end; + + PSDL_ColorArray = ^TSDL_ColorArray; + TSDL_ColorArray = array[0..65000] of TSDL_Color; + + PSDL_Palette = ^TSDL_Palette; + TSDL_Palette = record + ncolors: Integer; + colors: PSDL_ColorArray; + end; + + // Everything in the pixel format structure is read-only + PSDL_PixelFormat = ^TSDL_PixelFormat; + TSDL_PixelFormat = record + palette: PSDL_Palette; + BitsPerPixel: UInt8; + BytesPerPixel: UInt8; + Rloss: UInt8; + Gloss: UInt8; + Bloss: UInt8; + Aloss: UInt8; + Rshift: UInt8; + Gshift: UInt8; + Bshift: UInt8; + Ashift: UInt8; + RMask: UInt32; + GMask: UInt32; + BMask: UInt32; + AMask: UInt32; + colorkey: UInt32; // RGB color key information + alpha: UInt8; // Alpha value information (per-surface alpha) + end; + +{$IFDEF WIN32} + {PPrivate_hwdata = ^TPrivate_hwdata; + TPrivate_hwdata = record + dd_surface : IDIRECTDRAWSURFACE3; + dd_writebuf : IDIRECTDRAWSURFACE3; + end;} + {ELSE} +{$ENDIF} + + // The structure passed to the low level blit functions + PSDL_BlitInfo = ^TSDL_BlitInfo; + TSDL_BlitInfo = record + s_pixels: PUInt8; + s_width: Integer; + s_height: Integer; + s_skip: Integer; + d_pixels: PUInt8; + d_width: Integer; + d_height: Integer; + d_skip: Integer; + aux_data: Pointer; + src: PSDL_PixelFormat; + table: PUInt8; + dst: PSDL_PixelFormat; + end; + + // typedef for private surface blitting functions + PSDL_Surface = ^TSDL_Surface; + + {$IFNDEF __GPC__} + TSDL_Blit = function( src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect ): Integer; cdecl; + {$ELSE} + TSDL_Blit = function( src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect ): Integer; + {$ENDIF} + + // The type definition for the low level blit functions + //TSDL_LoBlit = procedure( info : PSDL_BlitInfo ); cdecl; + + // This is the private info structure for software accelerated blits + {PPrivate_swaccel = ^TPrivate_swaccel; + TPrivate_swaccel = record + blit : TSDL_LoBlit; + aux_data : Pointer; + end;} + + // Blit mapping definition + {PSDL_BlitMap = ^TSDL_BlitMap; + TSDL_BlitMap = record + dst : PSDL_Surface; + identity : Integer; + table : PUInt8; + hw_blit : TSDL_Blit; + sw_blit : TSDL_Blit; + hw_data : PPrivate_hwaccel; + sw_data : PPrivate_swaccel; + + // the version count matches the destination; mismatch indicates an invalid mapping + format_version : Cardinal; + end;} + + TSDL_Surface = record + flags: UInt32; // Read-only + format: PSDL_PixelFormat; // Read-only + w, h: Integer; // Read-only + pitch: UInt16; // Read-only + pixels: Pointer; // Read-write + offset: Integer; // Private + hwdata: Pointer; //TPrivate_hwdata; Hardware-specific surface info + + // clipping information: + clip_rect: TSDL_Rect; // Read-only + unused1: UInt32; // for binary compatibility + // Allow recursive locks + locked: UInt32; // Private + // info for fast blit mapping to other surfaces + Blitmap: Pointer; // PSDL_BlitMap; // Private + // format version, bumped at every change to invalidate blit maps + format_version: Cardinal; // Private + refcount: Integer; + end; + + // Useful for determining the video hardware capabilities + PSDL_VideoInfo = ^TSDL_VideoInfo; + TSDL_VideoInfo = record + hw_available: UInt8; // Hardware and WindowManager flags in first 2 bits ( see below ) + {hw_available: 1; // Can you create hardware surfaces + wm_available: 1; // Can you talk to a window manager? + UnusedBits1: 6;} + blit_hw: UInt8; // Blit Hardware flags. See below for which bits do what + {UnusedBits2: 1; + blit_hw: 1; // Flag:UInt32 Accelerated blits HW --> HW + blit_hw_CC: 1; // Flag:UInt32 Accelerated blits with Colorkey + blit_hw_A: 1; // Flag:UInt32 Accelerated blits with Alpha + blit_sw: 1; // Flag:UInt32 Accelerated blits SW --> HW + blit_sw_CC: 1; // Flag:UInt32 Accelerated blits with Colorkey + blit_sw_A: 1; // Flag:UInt32 Accelerated blits with Alpha + blit_fill: 1; // Flag:UInt32 Accelerated color fill} + UnusedBits3: UInt8; // Unused at this point + video_mem: UInt32; // The total amount of video memory (in K) + vfmt: PSDL_PixelFormat; // Value: The format of the video surface + end; + + // The YUV hardware video overlay + PSDL_Overlay = ^TSDL_Overlay; + TSDL_Overlay = record + format: UInt32; // Overlay format + w, h: Integer; // Width and height of overlay + planes: Integer; // Number of planes in the overlay. Usually either 1 or 3 + pitches: PUInt16; + // An array of pitches, one for each plane. Pitch is the length of a row in bytes. + pixels: PUInt8; + // An array of pointers to teh data of each plane. The overlay should be locked before these pointers are used. + hw_overlay: UInt32; + // This will be set to 1 if the overlay is hardware accelerated. + end; + + // Public enumeration for setting the OpenGL window attributes. + TSDL_GLAttr = ( + SDL_GL_RED_SIZE, + SDL_GL_GREEN_SIZE, + SDL_GL_BLUE_SIZE, + SDL_GL_ALPHA_SIZE, + SDL_GL_BUFFER_SIZE, + SDL_GL_DOUBLEBUFFER, + SDL_GL_DEPTH_SIZE, + SDL_GL_STENCIL_SIZE, + SDL_GL_ACCUM_RED_SIZE, + SDL_GL_ACCUM_GREEN_SIZE, + SDL_GL_ACCUM_BLUE_SIZE, + SDL_GL_ACCUM_ALPHA_SIZE, + SDL_GL_STEREO, + SDL_GL_MULTISAMPLEBUFFERS, + SDL_GL_MULTISAMPLESAMPLES); + + + + PSDL_Cursor = ^TSDL_Cursor; + TSDL_Cursor = record + area: TSDL_Rect; // The area of the mouse cursor + hot_x, hot_y: SInt16; // The "tip" of the cursor + data: PUInt8; // B/W cursor data + mask: PUInt8; // B/W cursor mask + save: array[1..2] of PUInt8; // Place to save cursor area + wm_cursor: Pointer; // Window-manager cursor + end; + +// SDL_mutex.h types + +{$IFDEF WIN32} + PSDL_Mutex = ^TSDL_Mutex; + TSDL_Mutex = record + id: THANDLE; + end; +{$ENDIF} + +{$IFDEF Unix} + PSDL_Mutex = ^TSDL_Mutex; + TSDL_mutex = record + id: pthread_mutex_t; +{$IFDEF PTHREAD_NO_RECURSIVE_MUTEX} + recursive: Integer; + owner: pthread_t; +{$ENDIF} + end; +{$ENDIF} + +{$IFDEF __MACH__} + {$define USE_NAMED_SEMAPHORES} + // Broken sem_getvalue() in MacOS X Public Beta */ + {$define BROKEN_SEMGETVALUE} +{$ENDIF} + +PSDL_semaphore = ^TSDL_semaphore; +{$IFDEF WIN32} + // Win32 or Machintosh + TSDL_semaphore = record + id: THANDLE; + count: UInt32; + end; +{$ELSE} + {$IFDEF FPC} + // This should be semaphore.h + __sem_lock_t = {packed} record { Not in header file - anonymous } + status: Longint; + spinlock: Integer; + end; + + sem_t = {packed} record + __sem_lock: __sem_lock_t; + __sem_value: Integer; + __sem_waiting: longint ; {_pthread_queue;} + end; + {$ENDIF} + + TSDL_semaphore = record + sem: Pointer; //PSem_t; + {$IFNDEF USE_NAMED_SEMAPHORES} + sem_data: Sem_t; + {$ENDIF} + + {$IFDEF BROKEN_SEMGETVALUE} + { This is a little hack for MacOS X - + It's not thread-safe, but it's better than nothing } + sem_value: Integer; + {$ENDIF} + end; +{$ENDIF} + + PSDL_Sem = ^TSDL_Sem; + TSDL_Sem = TSDL_Semaphore; + + PSDL_Cond = ^TSDL_Cond; + TSDL_Cond = record +{$IFDEF Unix} + cond: pthread_cond_t; +{$ELSE} + // Generic Cond structure + lock: PSDL_mutex; + waiting: Integer; + signals: Integer; + wait_sem: PSDL_Sem; + wait_done: PSDL_Sem; +{$ENDIF} + end; + + // SDL_thread.h types +{$IFDEF WIN32} + TSYS_ThreadHandle = THandle; +{$ENDIF} + +{$IFDEF Unix} + TSYS_ThreadHandle = pthread_t; +{$ENDIF} + + { This is the system-independent thread info structure } + PSDL_Thread = ^TSDL_Thread; + TSDL_Thread = record + threadid: UInt32; + handle: TSYS_ThreadHandle; + status: Integer; + errbuf: TSDL_Error; + data: Pointer; + end; + + // Helper Types + + // Keyboard State Array ( See demos for how to use ) + PKeyStateArr = ^TKeyStateArr; + TKeyStateArr = array[0..65000] of UInt8; + + // Types required so we don't need to use Windows.pas + PInteger = ^Integer; + PByte = ^Byte; + PWord = ^Word; + PLongWord = ^Longword; + + // General arrays + PByteArray = ^TByteArray; + TByteArray = array[0..32767] of Byte; + + PWordArray = ^TWordArray; + TWordArray = array[0..16383] of Word; + + PPoint = ^TPoint; + TPoint = record + x: Longint; + y: Longint; + end; + + PRect = ^TRect; + TRect = record + case Integer of + 0: (Left, Top, Right, Bottom: Integer); + 1: (TopLeft, BottomRight: TPoint); + end; + + { Generic procedure pointer } + TProcedure = procedure; + +{------------------------------------------------------------------------------} +{ initialization } +{------------------------------------------------------------------------------} + +{ This function loads the SDL dynamically linked library and initializes + the subsystems specified by 'flags' (and those satisfying dependencies) + Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup + signal handlers for some commonly ignored fatal signals (like SIGSEGV) } + +function SDL_Init( flags : UInt32 ) : Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_Init'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_Init} + +// This function initializes specific SDL subsystems +function SDL_InitSubSystem( flags : UInt32 ) : Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_InitSubSystem'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_InitSubSystem} + +// This function cleans up specific SDL subsystems +procedure SDL_QuitSubSystem( flags : UInt32 ); +cdecl; external {$IFDEF __GPC__}name 'SDL_QuitSubSystem'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_QuitSubSystem} + +{ This function returns mask of the specified subsystems which have + been initialized. + If 'flags' is 0, it returns a mask of all initialized subsystems. } + +function SDL_WasInit( flags : UInt32 ): UInt32; +cdecl; external {$IFDEF __GPC__}name 'SDL_WasInit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_WasInit} + +{ This function cleans up all initialized subsystems and unloads the + dynamically linked library. You should call it upon all exit conditions. } +procedure SDL_Quit; +cdecl; external {$IFDEF __GPC__}name 'SDL_Quit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_Quit} + +{$IFDEF WIN32} +// This should be called from your WinMain() function, if any +function SDL_RegisterApp(name: PChar; style: UInt32; h_Inst: Pointer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_RegisterApp'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_RegisterApp} +{$ENDIF} + +{$IFDEF __MACH__} +// This should be called from your main() function, if any +procedure SDL_InitQuickDraw( the_qd: QDGlobals ); +cdecl; external {$IFDEF __GPC__}name 'SDL_InitQuickDraw'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_InitQuickDraw} +{$ENDIF} + + +{------------------------------------------------------------------------------} +{ types } +{------------------------------------------------------------------------------} +// The number of elements in a table +function SDL_TableSize( table: PChar ): Integer; +{$EXTERNALSYM SDL_TABLESIZE} + + +{------------------------------------------------------------------------------} +{ error-handling } +{------------------------------------------------------------------------------} +// Public functions +function SDL_GetError: PChar; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetError'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetError} +procedure SDL_SetError(fmt: PChar); +cdecl; external {$IFDEF __GPC__}name 'SDL_SetError'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetError} +procedure SDL_ClearError; +cdecl; external {$IFDEF __GPC__}name 'SDL_ClearError'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_ClearError} + +{$IFNDEF WIN32} +procedure SDL_Error(Code: TSDL_errorcode); +cdecl; external {$IFDEF __GPC__}name 'SDL_Error'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_Error} +{$ENDIF} + +// Private error message function - used internally +procedure SDL_OutOfMemory; + +{------------------------------------------------------------------------------} +{ io handling } +{------------------------------------------------------------------------------} +// Functions to create SDL_RWops structures from various data sources + +function SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; +cdecl; external {$IFDEF __GPC__}name 'SDL_RWFromFile'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_RWFromFile} +procedure SDL_FreeRW(area: PSDL_RWops); +cdecl; external {$IFDEF __GPC__}name 'SDL_FreeRW'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_FreeRW} + +//fp is FILE *fp ??? +function SDL_RWFromFP(fp: Pointer; autoclose: Integer): PSDL_RWops; +cdecl; external {$IFDEF __GPC__}name 'SDL_RWFromFP'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_RWFromFP} +function SDL_RWFromMem(mem: Pointer; size: Integer): PSDL_RWops; +cdecl; external {$IFDEF __GPC__}name 'SDL_RWFromMem'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_RWFromMem} +function SDL_RWFromConstMem(const mem: Pointer; size: Integer) : PSDL_RWops; +cdecl; external {$IFDEF __GPC__}name 'SDL_RWFromConstMem'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_RWFromConstMem} +function SDL_AllocRW: PSDL_RWops; +cdecl; external {$IFDEF __GPC__}name 'SDL_AllocRW'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_AllocRW} + +function SDL_RWSeek(context: PSDL_RWops; offset: Integer; whence: Integer) : Integer; +{$EXTERNALSYM SDL_RWSeek} +function SDL_RWTell(context: PSDL_RWops): Integer; +{$EXTERNALSYM SDL_RWTell} +function SDL_RWRead(context: PSDL_RWops; ptr: Pointer; size: Integer; n : Integer): Integer; +{$EXTERNALSYM SDL_RWRead} +function SDL_RWWrite(context: PSDL_RWops; ptr: Pointer; size: Integer; n : Integer): Integer; +{$EXTERNALSYM SDL_RWWrite} +function SDL_RWClose(context: PSDL_RWops): Integer; +{$EXTERNALSYM SDL_RWClose} + +{------------------------------------------------------------------------------} +{ time-handling } +{------------------------------------------------------------------------------} + +{ Get the number of milliseconds since the SDL library initialization. } +{ Note that this value wraps if the program runs for more than ~49 days. } +function SDL_GetTicks: UInt32; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetTicks'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetTicks} + +// Wait a specified number of milliseconds before returning +procedure SDL_Delay(msec: UInt32); +cdecl; external {$IFDEF __GPC__}name 'SDL_Delay'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_Delay} + +{ Add a new timer to the pool of timers already running. } +{ Returns a timer ID, or NULL when an error occurs. } +function SDL_AddTimer(interval: UInt32; callback: TSDL_NewTimerCallback; param : Pointer): PSDL_TimerID; +cdecl; external {$IFDEF __GPC__}name 'SDL_AddTimer'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_AddTimer} + +{ Remove one of the multiple timers knowing its ID. } +{ Returns a boolean value indicating success. } +function SDL_RemoveTimer(t: PSDL_TimerID): TSDL_Bool; +cdecl; external {$IFDEF __GPC__}name 'SDL_RemoveTimer'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_RemoveTimer} + +function SDL_SetTimer(interval: UInt32; callback: TSDL_TimerCallback): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SetTimer'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetTimer} + +{------------------------------------------------------------------------------} +{ audio-routines } +{------------------------------------------------------------------------------} + +{ These functions are used internally, and should not be used unless you + have a specific need to specify the audio driver you want to use. + You should normally use SDL_Init() or SDL_InitSubSystem(). } + +function SDL_AudioInit(driver_name: PChar): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_AudioInit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_AudioInit} +procedure SDL_AudioQuit; +cdecl; external {$IFDEF __GPC__}name 'SDL_AudioQuit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_AudioQuit} + +{ This function fills the given character buffer with the name of the + current audio driver, and returns a Pointer to it if the audio driver has + been initialized. It returns NULL if no driver has been initialized. } + +function SDL_AudioDriverName(namebuf: PChar; maxlen: Integer): PChar; +cdecl; external {$IFDEF __GPC__}name 'SDL_AudioDriverName'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_AudioDriverName} + +{ This function opens the audio device with the desired parameters, and + returns 0 if successful, placing the actual hardware parameters in the + structure pointed to by 'obtained'. If 'obtained' is NULL, the audio + data passed to the callback function will be guaranteed to be in the + requested format, and will be automatically converted to the hardware + audio format if necessary. This function returns -1 if it failed + to open the audio device, or couldn't set up the audio thread. + + When filling in the desired audio spec structure, + 'desired->freq' should be the desired audio frequency in samples-per-second. + 'desired->format' should be the desired audio format. + 'desired->samples' is the desired size of the audio buffer, in samples. + This number should be a power of two, and may be adjusted by the audio + driver to a value more suitable for the hardware. Good values seem to + range between 512 and 8096 inclusive, depending on the application and + CPU speed. Smaller values yield faster response time, but can lead + to underflow if the application is doing heavy processing and cannot + fill the audio buffer in time. A stereo sample consists of both right + and left channels in LR ordering. + Note that the number of samples is directly related to time by the + following formula: ms = (samples*1000)/freq + 'desired->size' is the size in bytes of the audio buffer, and is + calculated by SDL_OpenAudio(). + 'desired->silence' is the value used to set the buffer to silence, + and is calculated by SDL_OpenAudio(). + 'desired->callback' should be set to a function that will be called + when the audio device is ready for more data. It is passed a pointer + to the audio buffer, and the length in bytes of the audio buffer. + This function usually runs in a separate thread, and so you should + protect data structures that it accesses by calling SDL_LockAudio() + and SDL_UnlockAudio() in your code. + 'desired->userdata' is passed as the first parameter to your callback + function. + + The audio device starts out playing silence when it's opened, and should + be enabled for playing by calling SDL_PauseAudio(0) when you are ready + for your audio callback function to be called. Since the audio driver + may modify the requested size of the audio buffer, you should allocate + any local mixing buffers after you open the audio device. } + +function SDL_OpenAudio(desired, obtained: PSDL_AudioSpec): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_OpenAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_OpenAudio} + +{ Get the current audio state: } +function SDL_GetAudioStatus: TSDL_Audiostatus; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetAudioStatus'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetAudioStatus} + +{ This function pauses and unpauses the audio callback processing. + It should be called with a parameter of 0 after opening the audio + device to start playing sound. This is so you can safely initialize + data for your callback function after opening the audio device. + Silence will be written to the audio device during the pause. } + +procedure SDL_PauseAudio(pause_on: Integer); +cdecl; external {$IFDEF __GPC__}name 'SDL_PauseAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_PauseAudio} + +{ This function loads a WAVE from the data source, automatically freeing + that source if 'freesrc' is non-zero. For example, to load a WAVE file, + you could do: + SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); + + If this function succeeds, it returns the given SDL_AudioSpec, + filled with the audio data format of the wave data, and sets + 'audio_buf' to a malloc()'d buffer containing the audio data, + and sets 'audio_len' to the length of that audio buffer, in bytes. + You need to free the audio buffer with SDL_FreeWAV() when you are + done with it. + + This function returns NULL and sets the SDL error message if the + wave file cannot be opened, uses an unknown data format, or is + corrupt. Currently raw and MS-ADPCM WAVE files are supported. } + +function SDL_LoadWAV_RW(src: PSDL_RWops; freesrc: Integer; spec: + PSDL_AudioSpec; audio_buf: PUInt8; audiolen: PUInt32): PSDL_AudioSpec; +cdecl; external {$IFDEF __GPC__}name 'SDL_LoadWAV_RW'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_LoadWAV_RW} + +// Compatibility convenience function -- loads a WAV from a file +function SDL_LoadWAV(filename: PChar; spec: PSDL_AudioSpec; audio_buf: + PUInt8; audiolen: PUInt32): PSDL_AudioSpec; +{$EXTERNALSYM SDL_LoadWAV} + +{ This function frees data previously allocated with SDL_LoadWAV_RW() } + +procedure SDL_FreeWAV(audio_buf: PUInt8); +cdecl; external {$IFDEF __GPC__}name 'SDL_FreeWAV'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_FreeWAV} + +{ This function takes a source format and rate and a destination format + and rate, and initializes the 'cvt' structure with information needed + by SDL_ConvertAudio() to convert a buffer of audio data from one format + to the other. + This function returns 0, or -1 if there was an error. } +function SDL_BuildAudioCVT(cvt: PSDL_AudioCVT; src_format: UInt16; + src_channels: UInt8; src_rate: Integer; dst_format: UInt16; dst_channels: UInt8; + dst_rate: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_BuildAudioCVT'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_BuildAudioCVT} + +{ Once you have initialized the 'cvt' structure using SDL_BuildAudioCVT(), + created an audio buffer cvt->buf, and filled it with cvt->len bytes of + audio data in the source format, this function will convert it in-place + to the desired format. + The data conversion may expand the size of the audio data, so the buffer + cvt->buf should be allocated after the cvt structure is initialized by + SDL_BuildAudioCVT(), and should be cvt->len*cvt->len_mult bytes long. } +function SDL_ConvertAudio(cvt: PSDL_AudioCVT): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_ConvertAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_ConvertAudio} + +{ This takes two audio buffers of the playing audio format and mixes + them, performing addition, volume adjustment, and overflow clipping. + The volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME + for full audio volume. Note this does not change hardware volume. + This is provided for convenience -- you can mix your own audio data. } + +procedure SDL_MixAudio(dst, src: PUInt8; len: UInt32; volume: Integer); +cdecl; external {$IFDEF __GPC__}name 'SDL_MixAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_MixAudio} + +{ The lock manipulated by these functions protects the callback function. + During a LockAudio/UnlockAudio pair, you can be guaranteed that the + callback function is not running. Do not call these from the callback + function or you will cause deadlock. } +procedure SDL_LockAudio; +cdecl; external {$IFDEF __GPC__}name 'SDL_LockAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_LockAudio} +procedure SDL_UnlockAudio; +cdecl; external {$IFDEF __GPC__}name 'SDL_UnlockAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_UnlockAudio} + +{ This function shuts down audio processing and closes the audio device. } + +procedure SDL_CloseAudio; +cdecl; external {$IFDEF __GPC__}name 'SDL_CloseAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CloseAudio} + +{------------------------------------------------------------------------------} +{ CD-routines } +{------------------------------------------------------------------------------} + +{ Returns the number of CD-ROM drives on the system, or -1 if + SDL_Init() has not been called with the SDL_INIT_CDROM flag. } + +function SDL_CDNumDrives: Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_CDNumDrives'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CDNumDrives} + +{ Returns a human-readable, system-dependent identifier for the CD-ROM. + Example: + "/dev/cdrom" + "E:" + "/dev/disk/ide/1/master" } + +function SDL_CDName(drive: Integer): PChar; +cdecl; external {$IFDEF __GPC__}name 'SDL_CDName'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CDName} + +{ Opens a CD-ROM drive for access. It returns a drive handle on success, + or NULL if the drive was invalid or busy. This newly opened CD-ROM + becomes the default CD used when other CD functions are passed a NULL + CD-ROM handle. + Drives are numbered starting with 0. Drive 0 is the system default CD-ROM. } + +function SDL_CDOpen(drive: Integer): PSDL_CD; +cdecl; external {$IFDEF __GPC__}name 'SDL_CDOpen'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CDOpen} + +{ This function returns the current status of the given drive. + If the drive has a CD in it, the table of contents of the CD and current + play position of the CD will be stored in the SDL_CD structure. } + +function SDL_CDStatus(cdrom: PSDL_CD): TSDL_CDStatus; +cdecl; external {$IFDEF __GPC__}name 'SDL_CDStatus'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CDStatus} + +{ Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks' + tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play + until the end of the CD. This function will skip data tracks. + This function should only be called after calling SDL_CDStatus() to + get track information about the CD. + + For example: + // Play entire CD: + if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) then + SDL_CDPlayTracks(cdrom, 0, 0, 0, 0); + // Play last track: + if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) then + begin + SDL_CDPlayTracks(cdrom, cdrom->numtracks-1, 0, 0, 0); + end; + + // Play first and second track and 10 seconds of third track: + if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) + SDL_CDPlayTracks(cdrom, 0, 0, 2, 10); + + This function returns 0, or -1 if there was an error. } + +function SDL_CDPlayTracks(cdrom: PSDL_CD; start_track: Integer; start_frame: + Integer; ntracks: Integer; nframes: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_CDPlayTracks'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CDPlayTracks} + + +{ Play the given CD starting at 'start' frame for 'length' frames. + It returns 0, or -1 if there was an error. } + +function SDL_CDPlay(cdrom: PSDL_CD; start: Integer; length: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_CDPlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CDPlay} + +// Pause play -- returns 0, or -1 on error +function SDL_CDPause(cdrom: PSDL_CD): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_CDPause'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CDPause} + +// Resume play -- returns 0, or -1 on error +function SDL_CDResume(cdrom: PSDL_CD): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_CDResume'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CDResume} + +// Stop play -- returns 0, or -1 on error +function SDL_CDStop(cdrom: PSDL_CD): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_CDStop'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CDStop} + +// Eject CD-ROM -- returns 0, or -1 on error +function SDL_CDEject(cdrom: PSDL_CD): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_CDEject'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CDEject} + +// Closes the handle for the CD-ROM drive +procedure SDL_CDClose(cdrom: PSDL_CD); +cdecl; external {$IFDEF __GPC__}name 'SDL_CDClose'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CDClose} + +// Given a status, returns true if there's a disk in the drive +function SDL_CDInDrive( status : TSDL_CDStatus ) : LongBool; +{$EXTERNALSYM SDL_CDInDrive} + +// Conversion functions from frames to Minute/Second/Frames and vice versa +procedure FRAMES_TO_MSF(frames: Integer; var M: Integer; var S: Integer; var + F: Integer); +{$EXTERNALSYM FRAMES_TO_MSF} +function MSF_TO_FRAMES(M: Integer; S: Integer; F: Integer): Integer; +{$EXTERNALSYM MSF_TO_FRAMES} + +{------------------------------------------------------------------------------} +{ JoyStick-routines } +{------------------------------------------------------------------------------} + +{ Count the number of joysticks attached to the system } +function SDL_NumJoysticks: Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_NumJoysticks'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_NumJoysticks} + +{ Get the implementation dependent name of a joystick. + This can be called before any joysticks are opened. + If no name can be found, this function returns NULL. } +function SDL_JoystickName(index: Integer): PChar; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickName'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickName} + +{ Open a joystick for use - the index passed as an argument refers to + the N'th joystick on the system. This index is the value which will + identify this joystick in future joystick events. + + This function returns a joystick identifier, or NULL if an error occurred. } +function SDL_JoystickOpen(index: Integer): PSDL_Joystick; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickOpen'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickOpen} + +{ Returns 1 if the joystick has been opened, or 0 if it has not. } +function SDL_JoystickOpened(index: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickOpened'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickOpened} + +{ Get the device index of an opened joystick. } +function SDL_JoystickIndex(joystick: PSDL_Joystick): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickIndex'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickIndex} + +{ Get the number of general axis controls on a joystick } +function SDL_JoystickNumAxes(joystick: PSDL_Joystick): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickNumAxes'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickNumAxes} + +{ Get the number of trackballs on a joystick + Joystick trackballs have only relative motion events associated + with them and their state cannot be polled. } +function SDL_JoystickNumBalls(joystick: PSDL_Joystick): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickNumBalls'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickNumBalls} + + +{ Get the number of POV hats on a joystick } +function SDL_JoystickNumHats(joystick: PSDL_Joystick): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickNumHats'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickNumHats} + +{ Get the number of buttons on a joystick } +function SDL_JoystickNumButtons(joystick: PSDL_Joystick): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickNumButtons'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickNumButtons} + +{ Update the current state of the open joysticks. + This is called automatically by the event loop if any joystick + events are enabled. } + +procedure SDL_JoystickUpdate; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickUpdate'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickUpdate;} + +{ Enable/disable joystick event polling. + If joystick events are disabled, you must call SDL_JoystickUpdate() + yourself and check the state of the joystick when you want joystick + information. + The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE. } + +function SDL_JoystickEventState(state: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickEventState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickEventState} + +{ Get the current state of an axis control on a joystick + The state is a value ranging from -32768 to 32767. + The axis indices start at index 0. } + +function SDL_JoystickGetAxis(joystick: PSDL_Joystick; axis: Integer) : SInt16; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickGetAxis'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickGetAxis} + +{ The hat indices start at index 0. } + +function SDL_JoystickGetHat(joystick: PSDL_Joystick; hat: Integer): UInt8; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickGetHat'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickGetHat} + +{ Get the ball axis change since the last poll + This returns 0, or -1 if you passed it invalid parameters. + The ball indices start at index 0. } + +function SDL_JoystickGetBall(joystick: PSDL_Joystick; ball: Integer; var dx: Integer; var dy: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickGetBall'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickGetBall} + +{ Get the current state of a button on a joystick + The button indices start at index 0. } +function SDL_JoystickGetButton( joystick: PSDL_Joystick; Button: Integer): UInt8; +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickGetButton'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickGetButton} + +{ Close a joystick previously opened with SDL_JoystickOpen() } +procedure SDL_JoystickClose(joystick: PSDL_Joystick); +cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickClose'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_JoystickClose} + +{------------------------------------------------------------------------------} +{ event-handling } +{------------------------------------------------------------------------------} + +{ Pumps the event loop, gathering events from the input devices. + This function updates the event queue and internal input device state. + This should only be run in the thread that sets the video mode. } + +procedure SDL_PumpEvents; +cdecl; external {$IFDEF __GPC__}name 'SDL_PumpEvents'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_PumpEvents;} + +{ Checks the event queue for messages and optionally returns them. + If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to + the back of the event queue. + If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front + of the event queue, matching 'mask', will be returned and will not + be removed from the queue. + If 'action' is SDL_GETEVENT, up to 'numevents' events at the front + of the event queue, matching 'mask', will be returned and will be + removed from the queue. + This function returns the number of events actually stored, or -1 + if there was an error. This function is thread-safe. } + +function SDL_PeepEvents(events: PSDL_Event; numevents: Integer; action: TSDL_eventaction; mask: UInt32): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_PeepEvents'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_PeepEvents} + +{ Polls for currently pending events, and returns 1 if there are any pending + events, or 0 if there are none available. If 'event' is not NULL, the next + event is removed from the queue and stored in that area. } + +function SDL_PollEvent(event: PSDL_Event): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_PollEvent'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_PollEvent} + +{ Waits indefinitely for the next available event, returning 1, or 0 if there + was an error while waiting for events. If 'event' is not NULL, the next + event is removed from the queue and stored in that area. } + +function SDL_WaitEvent(event: PSDL_Event): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_WaitEvent'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_WaitEvent} + +function SDL_PushEvent( event : PSDL_Event ) : Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_PushEvent'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_PushEvent} + +{ If the filter returns 1, then the event will be added to the internal queue. + If it returns 0, then the event will be dropped from the queue, but the + internal state will still be updated. This allows selective filtering of + dynamically arriving events. + + WARNING: Be very careful of what you do in the event filter function, as + it may run in a different thread! + + There is one caveat when dealing with the SDL_QUITEVENT event type. The + event filter is only called when the window manager desires to close the + application window. If the event filter returns 1, then the window will + be closed, otherwise the window will remain open if possible. + If the quit event is generated by an interrupt signal, it will bypass the + internal queue and be delivered to the application at the next event poll. } +procedure SDL_SetEventFilter( filter : TSDL_EventFilter ); +cdecl; external {$IFDEF __GPC__}name 'SDL_SetEventFilter'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetEventFilter} + +{ Return the current event filter - can be used to "chain" filters. + If there is no event filter set, this function returns NULL. } + +function SDL_GetEventFilter: TSDL_EventFilter; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetEventFilter'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetEventFilter} + +{ This function allows you to set the state of processing certain events. + If 'state' is set to SDL_IGNORE, that event will be automatically dropped + from the event queue and will not event be filtered. + If 'state' is set to SDL_ENABLE, that event will be processed normally. + If 'state' is set to SDL_QUERY, SDL_EventState() will return the + current processing state of the specified event. } + +function SDL_EventState(type_: UInt8; state: Integer): UInt8; +cdecl; external {$IFDEF __GPC__}name 'SDL_EventState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_EventState} + +{------------------------------------------------------------------------------} +{ Version Routines } +{------------------------------------------------------------------------------} + +{ This macro can be used to fill a version structure with the compile-time + version of the SDL library. } +procedure SDL_VERSION(var X: TSDL_Version); +{$EXTERNALSYM SDL_VERSION} + +{ This macro turns the version numbers into a numeric value: + (1,2,3) -> (1203) + This assumes that there will never be more than 100 patchlevels } + +function SDL_VERSIONNUM(X, Y, Z: Integer): Integer; +{$EXTERNALSYM SDL_VERSIONNUM} + +// This is the version number macro for the current SDL version +function SDL_COMPILEDVERSION: Integer; +{$EXTERNALSYM SDL_COMPILEDVERSION} + +// This macro will evaluate to true if compiled with SDL at least X.Y.Z +function SDL_VERSION_ATLEAST(X: Integer; Y: Integer; Z: Integer) : LongBool; +{$EXTERNALSYM SDL_VERSION_ATLEAST} + +{ This function gets the version of the dynamically linked SDL library. + it should NOT be used to fill a version structure, instead you should + use the SDL_Version() macro. } + +function SDL_Linked_Version: PSDL_version; +cdecl; external {$IFDEF __GPC__}name 'SDL_Linked_Version'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_Linked_Version} + +{------------------------------------------------------------------------------} +{ video } +{------------------------------------------------------------------------------} + +{ These functions are used internally, and should not be used unless you + have a specific need to specify the video driver you want to use. + You should normally use SDL_Init() or SDL_InitSubSystem(). + + SDL_VideoInit() initializes the video subsystem -- sets up a connection + to the window manager, etc, and determines the current video mode and + pixel format, but does not initialize a window or graphics mode. + Note that event handling is activated by this routine. + + If you use both sound and video in your application, you need to call + SDL_Init() before opening the sound device, otherwise under Win32 DirectX, + you won't be able to set full-screen display modes. } + +function SDL_VideoInit(driver_name: PChar; flags: UInt32): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_VideoInit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_VideoInit} +procedure SDL_VideoQuit; +cdecl; external {$IFDEF __GPC__}name 'SDL_VideoQuit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_VideoQuit} + +{ This function fills the given character buffer with the name of the + video driver, and returns a pointer to it if the video driver has + been initialized. It returns NULL if no driver has been initialized. } + +function SDL_VideoDriverName(namebuf: PChar; maxlen: Integer): PChar; +cdecl; external {$IFDEF __GPC__}name 'SDL_VideoDriverName'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_VideoDriverName} + +{ This function returns a pointer to the current display surface. + If SDL is doing format conversion on the display surface, this + function returns the publicly visible surface, not the real video + surface. } + +function SDL_GetVideoSurface: PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetVideoSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetVideoSurface} + +{ This function returns a read-only pointer to information about the + video hardware. If this is called before SDL_SetVideoMode(), the 'vfmt' + member of the returned structure will contain the pixel format of the + "best" video mode. } +function SDL_GetVideoInfo: PSDL_VideoInfo; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetVideoInfo'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetVideoInfo} + +{ Check to see if a particular video mode is supported. + It returns 0 if the requested mode is not supported under any bit depth, + or returns the bits-per-pixel of the closest available mode with the + given width and height. If this bits-per-pixel is different from the + one used when setting the video mode, SDL_SetVideoMode() will succeed, + but will emulate the requested bits-per-pixel with a shadow surface. + + The arguments to SDL_VideoModeOK() are the same ones you would pass to + SDL_SetVideoMode() } + +function SDL_VideoModeOK(width, height, bpp: Integer; flags: UInt32): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_VideoModeOK'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_VideoModeOK} + +{ Return a pointer to an array of available screen dimensions for the + given format and video flags, sorted largest to smallest. Returns + NULL if there are no dimensions available for a particular format, + or (SDL_Rect **)-1 if any dimension is okay for the given format. + + if 'format' is NULL, the mode list will be for the format given + by SDL_GetVideoInfo( ) - > vfmt } + +function SDL_ListModes(format: PSDL_PixelFormat; flags: UInt32): PPSDL_Rect; +cdecl; external {$IFDEF __GPC__}name 'SDL_ListModes'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_ListModes} + + +{ Set up a video mode with the specified width, height and bits-per-pixel. + + If 'bpp' is 0, it is treated as the current display bits per pixel. + + If SDL_ANYFORMAT is set in 'flags', the SDL library will try to set the + requested bits-per-pixel, but will return whatever video pixel format is + available. The default is to emulate the requested pixel format if it + is not natively available. + + If SDL_HWSURFACE is set in 'flags', the video surface will be placed in + video memory, if possible, and you may have to call SDL_LockSurface() + in order to access the raw framebuffer. Otherwise, the video surface + will be created in system memory. + + If SDL_ASYNCBLIT is set in 'flags', SDL will try to perform rectangle + updates asynchronously, but you must always lock before accessing pixels. + SDL will wait for updates to complete before returning from the lock. + + If SDL_HWPALETTE is set in 'flags', the SDL library will guarantee + that the colors set by SDL_SetColors() will be the colors you get. + Otherwise, in 8-bit mode, SDL_SetColors() may not be able to set all + of the colors exactly the way they are requested, and you should look + at the video surface structure to determine the actual palette. + If SDL cannot guarantee that the colors you request can be set, + i.e. if the colormap is shared, then the video surface may be created + under emulation in system memory, overriding the SDL_HWSURFACE flag. + + If SDL_FULLSCREEN is set in 'flags', the SDL library will try to set + a fullscreen video mode. The default is to create a windowed mode + if the current graphics system has a window manager. + If the SDL library is able to set a fullscreen video mode, this flag + will be set in the surface that is returned. + + If SDL_DOUBLEBUF is set in 'flags', the SDL library will try to set up + two surfaces in video memory and swap between them when you call + SDL_Flip(). This is usually slower than the normal single-buffering + scheme, but prevents "tearing" artifacts caused by modifying video + memory while the monitor is refreshing. It should only be used by + applications that redraw the entire screen on every update. + + This function returns the video framebuffer surface, or NULL if it fails. } + +function SDL_SetVideoMode(width, height, bpp: Integer; flags: UInt32): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'SDL_SetVideoMode'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetVideoMode} + + +{ Makes sure the given list of rectangles is updated on the given screen. + If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire + screen. + These functions should not be called while 'screen' is locked. } + +procedure SDL_UpdateRects(screen: PSDL_Surface; numrects: Integer; rects: PSDL_Rect); +cdecl; external {$IFDEF __GPC__}name 'SDL_UpdateRects'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_UpdateRects} +procedure SDL_UpdateRect(screen: PSDL_Surface; x, y: SInt32; w, h: UInt32); +cdecl; external {$IFDEF __GPC__}name 'SDL_UpdateRect'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_UpdateRect} + + +{ On hardware that supports double-buffering, this function sets up a flip + and returns. The hardware will wait for vertical retrace, and then swap + video buffers before the next video surface blit or lock will return. + On hardware that doesn not support double-buffering, this is equivalent + to calling SDL_UpdateRect(screen, 0, 0, 0, 0); + The SDL_DOUBLEBUF flag must have been passed to SDL_SetVideoMode() when + setting the video mode for this function to perform hardware flipping. + This function returns 0 if successful, or -1 if there was an error.} + +function SDL_Flip(screen: PSDL_Surface): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_Flip'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_Flip} + +{ Set the gamma correction for each of the color channels. + The gamma values range (approximately) between 0.1 and 10.0 + + If this function isn't supported directly by the hardware, it will + be emulated using gamma ramps, if available. If successful, this + function returns 0, otherwise it returns -1. } + +function SDL_SetGamma(redgamma: single; greengamma: single; bluegamma: single ): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SetGamma'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetGamma} + +{ Set the gamma translation table for the red, green, and blue channels + of the video hardware. Each table is an array of 256 16-bit quantities, + representing a mapping between the input and output for that channel. + The input is the index into the array, and the output is the 16-bit + gamma value at that index, scaled to the output color precision. + + You may pass NULL for any of the channels to leave it unchanged. + If the call succeeds, it will return 0. If the display driver or + hardware does not support gamma translation, or otherwise fails, + this function will return -1. } + +function SDL_SetGammaRamp( redtable: PUInt16; greentable: PUInt16; bluetable: PUInt16): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SetGammaRamp'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetGammaRamp} + +{ Retrieve the current values of the gamma translation tables. + + You must pass in valid pointers to arrays of 256 16-bit quantities. + Any of the pointers may be NULL to ignore that channel. + If the call succeeds, it will return 0. If the display driver or + hardware does not support gamma translation, or otherwise fails, + this function will return -1. } + +function SDL_GetGammaRamp( redtable: PUInt16; greentable: PUInt16; bluetable: PUInt16): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetGammaRamp'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetGammaRamp} + +{ Sets a portion of the colormap for the given 8-bit surface. If 'surface' + is not a palettized surface, this function does nothing, returning 0. + If all of the colors were set as passed to SDL_SetColors(), it will + return 1. If not all the color entries were set exactly as given, + it will return 0, and you should look at the surface palette to + determine the actual color palette. + + When 'surface' is the surface associated with the current display, the + display colormap will be updated with the requested colors. If + SDL_HWPALETTE was set in SDL_SetVideoMode() flags, SDL_SetColors() + will always return 1, and the palette is guaranteed to be set the way + you desire, even if the window colormap has to be warped or run under + emulation. } + + +function SDL_SetColors(surface: PSDL_Surface; colors: PSDL_Color; firstcolor : Integer; ncolors: Integer) : Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SetColors'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetColors} + +{ Sets a portion of the colormap for a given 8-bit surface. + 'flags' is one or both of: + SDL_LOGPAL -- set logical palette, which controls how blits are mapped + to/from the surface, + SDL_PHYSPAL -- set physical palette, which controls how pixels look on + the screen + Only screens have physical palettes. Separate change of physical/logical + palettes is only possible if the screen has SDL_HWPALETTE set. + + The return value is 1 if all colours could be set as requested, and 0 + otherwise. + + SDL_SetColors() is equivalent to calling this function with + flags = (SDL_LOGPAL or SDL_PHYSPAL). } + +function SDL_SetPalette(surface: PSDL_Surface; flags: Integer; colors: PSDL_Color; firstcolor: Integer; ncolors: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SetPalette'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetPalette} + +{ Maps an RGB triple to an opaque pixel value for a given pixel format } +function SDL_MapRGB(format: PSDL_PixelFormat; r: UInt8; g: UInt8; b: UInt8) : UInt32; +cdecl; external {$IFDEF __GPC__}name 'SDL_MapRGB'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_MapRGB} + +{ Maps an RGBA quadruple to a pixel value for a given pixel format } +function SDL_MapRGBA(format: PSDL_PixelFormat; r: UInt8; g: UInt8; b: UInt8; a: UInt8): UInt32; +cdecl; external {$IFDEF __GPC__}name 'SDL_MapRGBA'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_MapRGBA} + +{ Maps a pixel value into the RGB components for a given pixel format } +procedure SDL_GetRGB(pixel: UInt32; fmt: PSDL_PixelFormat; r: PUInt8; g: PUInt8; b: PUInt8); +cdecl; external {$IFDEF __GPC__}name 'SDL_GetRGB'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetRGB} + +{ Maps a pixel value into the RGBA components for a given pixel format } +procedure SDL_GetRGBA(pixel: UInt32; fmt: PSDL_PixelFormat; r: PUInt8; g: PUInt8; b: PUInt8; a: PUInt8); +cdecl; external {$IFDEF __GPC__}name 'SDL_GetRGBA'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetRGBA} + +{ Allocate and free an RGB surface (must be called after SDL_SetVideoMode) + If the depth is 4 or 8 bits, an empty palette is allocated for the surface. + If the depth is greater than 8 bits, the pixel format is set using the + flags '[RGB]mask'. + If the function runs out of memory, it will return NULL. + + The 'flags' tell what kind of surface to create. + SDL_SWSURFACE means that the surface should be created in system memory. + SDL_HWSURFACE means that the surface should be created in video memory, + with the same format as the display surface. This is useful for surfaces + that will not change much, to take advantage of hardware acceleration + when being blitted to the display surface. + SDL_ASYNCBLIT means that SDL will try to perform asynchronous blits with + this surface, but you must always lock it before accessing the pixels. + SDL will wait for current blits to finish before returning from the lock. + SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits. + If the hardware supports acceleration of colorkey blits between + two surfaces in video memory, SDL will try to place the surface in + video memory. If this isn't possible or if there is no hardware + acceleration available, the surface will be placed in system memory. + SDL_SRCALPHA means that the surface will be used for alpha blits and + if the hardware supports hardware acceleration of alpha blits between + two surfaces in video memory, to place the surface in video memory + if possible, otherwise it will be placed in system memory. + If the surface is created in video memory, blits will be _much_ faster, + but the surface format must be identical to the video surface format, + and the only way to access the pixels member of the surface is to use + the SDL_LockSurface() and SDL_UnlockSurface() calls. + If the requested surface actually resides in video memory, SDL_HWSURFACE + will be set in the flags member of the returned surface. If for some + reason the surface could not be placed in video memory, it will not have + the SDL_HWSURFACE flag set, and will be created in system memory instead. } + +function SDL_AllocSurface(flags: UInt32; width, height, depth: Integer; + RMask, GMask, BMask, AMask: UInt32): PSDL_Surface; +{$EXTERNALSYM SDL_AllocSurface} + +function SDL_CreateRGBSurface(flags: UInt32; width, height, depth: Integer; RMask, GMask, BMask, AMask: UInt32): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'SDL_CreateRGBSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CreateRGBSurface} + +function SDL_CreateRGBSurfaceFrom(pixels: Pointer; width, height, depth, pitch + : Integer; RMask, GMask, BMask, AMask: UInt32): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'SDL_CreateRGBSurfaceFrom'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CreateRGBSurfaceFrom} + +procedure SDL_FreeSurface(surface: PSDL_Surface); +cdecl; external {$IFDEF __GPC__}name 'SDL_FreeSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_FreeSurface} + +function SDL_MustLock(Surface: PSDL_Surface): Boolean; +{$EXTERNALSYM SDL_MustLock} +{ SDL_LockSurface() sets up a surface for directly accessing the pixels. + Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write + to and read from 'surface->pixels', using the pixel format stored in + 'surface->format'. Once you are done accessing the surface, you should + use SDL_UnlockSurface() to release it. + + Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates + to 0, then you can read and write to the surface at any time, and the + pixel format of the surface will not change. In particular, if the + SDL_HWSURFACE flag is not given when calling SDL_SetVideoMode(), you + will not need to lock the display surface before accessing it. + + No operating system or library calls should be made between lock/unlock + pairs, as critical system locks may be held during this time. + + SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. } +function SDL_LockSurface(surface: PSDL_Surface): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_LockSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_LockSurface} + +procedure SDL_UnlockSurface(surface: PSDL_Surface); +cdecl; external {$IFDEF __GPC__}name 'SDL_UnlockSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_UnlockSurface} + +{ Load a surface from a seekable SDL data source (memory or file.) + If 'freesrc' is non-zero, the source will be closed after being read. + Returns the new surface, or NULL if there was an error. + The new surface should be freed with SDL_FreeSurface(). } +function SDL_LoadBMP_RW(src: PSDL_RWops; freesrc: Integer): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'SDL_LoadBMP_RW'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_LoadBMP_RW} + +// Convenience macro -- load a surface from a file +function SDL_LoadBMP(filename: PChar): PSDL_Surface; +{$EXTERNALSYM SDL_LoadBMP} + +{ Save a surface to a seekable SDL data source (memory or file.) + If 'freedst' is non-zero, the source will be closed after being written. + Returns 0 if successful or -1 if there was an error. } + +function SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SaveBMP_RW'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SaveBMP_RW} + +// Convenience macro -- save a surface to a file +function SDL_SaveBMP(surface: PSDL_Surface; filename: PChar): Integer; +{$EXTERNALSYM SDL_SaveBMP} + +{ Sets the color key (transparent pixel) in a blittable surface. + If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL), + 'key' will be the transparent pixel in the source image of a blit. + SDL_RLEACCEL requests RLE acceleration for the surface if present, + and removes RLE acceleration if absent. + If 'flag' is 0, this function clears any current color key. + This function returns 0, or -1 if there was an error. } + +function SDL_SetColorKey(surface: PSDL_Surface; flag, key: UInt32) : Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SetColorKey'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetColorKey} + +{ This function sets the alpha value for the entire surface, as opposed to + using the alpha component of each pixel. This value measures the range + of transparency of the surface, 0 being completely transparent to 255 + being completely opaque. An 'alpha' value of 255 causes blits to be + opaque, the source pixels copied to the destination (the default). Note + that per-surface alpha can be combined with colorkey transparency. + + If 'flag' is 0, alpha blending is disabled for the surface. + If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface. + OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the + surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed. } + + +function SDL_SetAlpha(surface: PSDL_Surface; flag: UInt32; alpha: UInt8): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SetAlpha'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetAlpha} + +{ Sets the clipping rectangle for the destination surface in a blit. + + If the clip rectangle is NULL, clipping will be disabled. + If the clip rectangle doesn't intersect the surface, the function will + return SDL_FALSE and blits will be completely clipped. Otherwise the + function returns SDL_TRUE and blits to the surface will be clipped to + the intersection of the surface area and the clipping rectangle. + + Note that blits are automatically clipped to the edges of the source + and destination surfaces. } +procedure SDL_SetClipRect(surface: PSDL_Surface; rect: PSDL_Rect); cdecl; +external {$IFDEF __GPC__}name 'SDL_SetClipRect'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetClipRect} + +{ Gets the clipping rectangle for the destination surface in a blit. + 'rect' must be a pointer to a valid rectangle which will be filled + with the correct values. } +procedure SDL_GetClipRect(surface: PSDL_Surface; rect: PSDL_Rect); cdecl; +external {$IFDEF __GPC__}name 'SDL_GetClipRect'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetClipRect} + +{ Creates a new surface of the specified format, and then copies and maps + the given surface to it so the blit of the converted surface will be as + fast as possible. If this function fails, it returns NULL. + + The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those + semantics. You can also pass SDL_RLEACCEL in the flags parameter and + SDL will try to RLE accelerate colorkey and alpha blits in the resulting + surface. + + This function is used internally by SDL_DisplayFormat(). } + +function SDL_ConvertSurface(src: PSDL_Surface; fmt: PSDL_PixelFormat; flags: UInt32): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'SDL_ConvertSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_ConvertSurface} + +{ + This performs a fast blit from the source surface to the destination + surface. It assumes that the source and destination rectangles are + the same size. If either 'srcrect' or 'dstrect' are NULL, the entire + surface (src or dst) is copied. The final blit rectangles are saved + in 'srcrect' and 'dstrect' after all clipping is performed. + If the blit is successful, it returns 0, otherwise it returns -1. + + The blit function should not be called on a locked surface. + + The blit semantics for surfaces with and without alpha and colorkey + are defined as follows: + + RGBA->RGB: + SDL_SRCALPHA set: + alpha-blend (using alpha-channel). + SDL_SRCCOLORKEY ignored. + SDL_SRCALPHA not set: + copy RGB. + if SDL_SRCCOLORKEY set, only copy the pixels matching the + RGB values of the source colour key, ignoring alpha in the + comparison. + + RGB->RGBA: + SDL_SRCALPHA set: + alpha-blend (using the source per-surface alpha value); + set destination alpha to opaque. + SDL_SRCALPHA not set: + copy RGB, set destination alpha to opaque. + both: + if SDL_SRCCOLORKEY set, only copy the pixels matching the + source colour key. + + RGBA->RGBA: + SDL_SRCALPHA set: + alpha-blend (using the source alpha channel) the RGB values; + leave destination alpha untouched. [Note: is this correct?] + SDL_SRCCOLORKEY ignored. + SDL_SRCALPHA not set: + copy all of RGBA to the destination. + if SDL_SRCCOLORKEY set, only copy the pixels matching the + RGB values of the source colour key, ignoring alpha in the + comparison. + + RGB->RGB: + SDL_SRCALPHA set: + alpha-blend (using the source per-surface alpha value). + SDL_SRCALPHA not set: + copy RGB. + both: + if SDL_SRCCOLORKEY set, only copy the pixels matching the + source colour key. + + If either of the surfaces were in video memory, and the blit returns -2, + the video memory was lost, so it should be reloaded with artwork and + re-blitted: + while ( SDL_BlitSurface(image, imgrect, screen, dstrect) = -2 ) do + begin + while ( SDL_LockSurface(image) < 0 ) do + Sleep(10); + -- Write image pixels to image->pixels -- + SDL_UnlockSurface(image); + end; + + This happens under DirectX 5.0 when the system switches away from your + fullscreen application. The lock will also fail until you have access + to the video memory again. } + +{ You should call SDL_BlitSurface() unless you know exactly how SDL + blitting works internally and how to use the other blit functions. } + +function SDL_BlitSurface(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): Integer; +{$EXTERNALSYM SDL_BlitSurface} + +{ This is the public blit function, SDL_BlitSurface(), and it performs + rectangle validation and clipping before passing it to SDL_LowerBlit() } +function SDL_UpperBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_UpperBlit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_UpperBlit} + +{ This is a semi-private blit function and it performs low-level surface + blitting only. } +function SDL_LowerBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_LowerBlit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_LowerBlit} + +{ This function performs a fast fill of the given rectangle with 'color' + The given rectangle is clipped to the destination surface clip area + and the final fill rectangle is saved in the passed in pointer. + If 'dstrect' is NULL, the whole surface will be filled with 'color' + The color should be a pixel of the format used by the surface, and + can be generated by the SDL_MapRGB() function. + This function returns 0 on success, or -1 on error. } + +function SDL_FillRect(dst: PSDL_Surface; dstrect: PSDL_Rect; color: UInt32) : Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_FillRect'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_FillRect} + +{ This function takes a surface and copies it to a new surface of the + pixel format and colors of the video framebuffer, suitable for fast + blitting onto the display surface. It calls SDL_ConvertSurface() + + If you want to take advantage of hardware colorkey or alpha blit + acceleration, you should set the colorkey and alpha value before + calling this function. + + If the conversion fails or runs out of memory, it returns NULL } + +function SDL_DisplayFormat(surface: PSDL_Surface): PSDL_Surface; cdecl; +external {$IFDEF __GPC__}name 'SDL_DisplayFormat'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_DisplayFormat} + +{ This function takes a surface and copies it to a new surface of the + pixel format and colors of the video framebuffer (if possible), + suitable for fast alpha blitting onto the display surface. + The new surface will always have an alpha channel. + + If you want to take advantage of hardware colorkey or alpha blit + acceleration, you should set the colorkey and alpha value before + calling this function. + + If the conversion fails or runs out of memory, it returns NULL } + + +function SDL_DisplayFormatAlpha(surface: PSDL_Surface): PSDL_Surface; cdecl; +external {$IFDEF __GPC__}name 'SDL_DisplayFormatAlpha'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_DisplayFormatAlpha} + +//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +//* YUV video surface overlay functions */ +//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +{ This function creates a video output overlay + Calling the returned surface an overlay is something of a misnomer because + the contents of the display surface underneath the area where the overlay + is shown is undefined - it may be overwritten with the converted YUV data. } + +function SDL_CreateYUVOverlay(width: Integer; height: Integer; format: UInt32; display: PSDL_Surface): PSDL_Overlay; +cdecl; external {$IFDEF __GPC__}name 'SDL_CreateYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CreateYUVOverlay} + +// Lock an overlay for direct access, and unlock it when you are done +function SDL_LockYUVOverlay(Overlay: PSDL_Overlay): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_LockYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_LockYUVOverlay} + +procedure SDL_UnlockYUVOverlay(Overlay: PSDL_Overlay); cdecl; +external {$IFDEF __GPC__}name 'SDL_UnlockYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_UnlockYUVOverlay} + + +{ Blit a video overlay to the display surface. + The contents of the video surface underneath the blit destination are + not defined. + The width and height of the destination rectangle may be different from + that of the overlay, but currently only 2x scaling is supported. } + +function SDL_DisplayYUVOverlay(Overlay: PSDL_Overlay; dstrect: PSDL_Rect) : Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_DisplayYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_DisplayYUVOverlay} + +// Free a video overlay +procedure SDL_FreeYUVOverlay(Overlay: PSDL_Overlay); +cdecl; external {$IFDEF __GPC__}name 'SDL_FreeYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_FreeYUVOverlay} + +{------------------------------------------------------------------------------} +{ OpenGL Routines } +{------------------------------------------------------------------------------} + +{ Dynamically load a GL driver, if SDL is built with dynamic GL. + + SDL links normally with the OpenGL library on your system by default, + but you can compile it to dynamically load the GL driver at runtime. + If you do this, you need to retrieve all of the GL functions used in + your program from the dynamic library using SDL_GL_GetProcAddress(). + + This is disabled in default builds of SDL. } + + +function SDL_GL_LoadLibrary(filename: PChar): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_GL_LoadLibrary'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GL_LoadLibrary} + +{ Get the address of a GL function (for extension functions) } +function SDL_GL_GetProcAddress(procname: PChar) : Pointer; +cdecl; external {$IFDEF __GPC__}name 'SDL_GL_GetProcAddress'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GL_GetProcAddress} + +{ Set an attribute of the OpenGL subsystem before intialization. } +function SDL_GL_SetAttribute(attr: TSDL_GLAttr; value: Integer) : Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_GL_SetAttribute'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GL_SetAttribute} + +{ Get an attribute of the OpenGL subsystem from the windowing + interface, such as glX. This is of course different from getting + the values from SDL's internal OpenGL subsystem, which only + stores the values you request before initialization. + + Developers should track the values they pass into SDL_GL_SetAttribute + themselves if they want to retrieve these values. } + +function SDL_GL_GetAttribute(attr: TSDL_GLAttr; var value: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_GL_GetAttribute'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GL_GetAttribute} + +{ Swap the OpenGL buffers, if double-buffering is supported. } + +procedure SDL_GL_SwapBuffers; +cdecl; external {$IFDEF __GPC__}name 'SDL_GL_SwapBuffers'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GL_SwapBuffers;} + +{ Internal functions that should not be called unless you have read + and understood the source code for these functions. } + +procedure SDL_GL_UpdateRects(numrects: Integer; rects: PSDL_Rect); +cdecl; external {$IFDEF __GPC__}name 'SDL_GL_UpdateRects'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GL_UpdateRects} +procedure SDL_GL_Lock; +cdecl; external {$IFDEF __GPC__}name 'SDL_GL_Lock'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GL_Lock;} +procedure SDL_GL_Unlock; +cdecl; external {$IFDEF __GPC__}name 'SDL_GL_Unlock'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GL_Unlock;} + +{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} +{* These functions allow interaction with the window manager, if any. *} +{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} + +{ Sets/Gets the title and icon text of the display window } +procedure SDL_WM_GetCaption(var title : PChar; var icon : PChar); +cdecl; external {$IFDEF __GPC__}name 'SDL_WM_GetCaption'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_WM_GetCaption} +procedure SDL_WM_SetCaption( const title : PChar; const icon : PChar); +cdecl; external {$IFDEF __GPC__}name 'SDL_WM_SetCaption'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_WM_SetCaption} + +{ Sets the icon for the display window. + This function must be called before the first call to SDL_SetVideoMode(). + It takes an icon surface, and a mask in MSB format. + If 'mask' is NULL, the entire icon surface will be used as the icon. } +procedure SDL_WM_SetIcon(icon: PSDL_Surface; mask: UInt8); +cdecl; external {$IFDEF __GPC__}name 'SDL_WM_SetIcon'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_WM_SetIcon} + +{ This function iconifies the window, and returns 1 if it succeeded. + If the function succeeds, it generates an SDL_APPACTIVE loss event. + This function is a noop and returns 0 in non-windowed environments. } + +function SDL_WM_IconifyWindow: Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_WM_IconifyWindow'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_WM_IconifyWindow} + +{ Toggle fullscreen mode without changing the contents of the screen. + If the display surface does not require locking before accessing + the pixel information, then the memory pointers will not change. + + If this function was able to toggle fullscreen mode (change from + running in a window to fullscreen, or vice-versa), it will return 1. + If it is not implemented, or fails, it returns 0. + + The next call to SDL_SetVideoMode() will set the mode fullscreen + attribute based on the flags parameter - if SDL_FULLSCREEN is not + set, then the display will be windowed by default where supported. + + This is currently only implemented in the X11 video driver. } + +function SDL_WM_ToggleFullScreen(surface: PSDL_Surface): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_WM_ToggleFullScreen'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_WM_ToggleFullScreen} + +{ Grabbing means that the mouse is confined to the application window, + and nearly all keyboard input is passed directly to the application, + and not interpreted by a window manager, if any. } + +function SDL_WM_GrabInput(mode: TSDL_GrabMode): TSDL_GrabMode; +cdecl; external {$IFDEF __GPC__}name 'SDL_WM_GrabInput'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_WM_GrabInput} + +{------------------------------------------------------------------------------} +{ mouse-routines } +{------------------------------------------------------------------------------} + +{ Retrieve the current state of the mouse. + The current button state is returned as a button bitmask, which can + be tested using the SDL_BUTTON(X) macros, and x and y are set to the + current mouse cursor position. You can pass NULL for either x or y. } + +function SDL_GetMouseState(var x: Integer; var y: Integer): UInt8; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetMouseState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetMouseState} + +{ Retrieve the current state of the mouse. + The current button state is returned as a button bitmask, which can + be tested using the SDL_BUTTON(X) macros, and x and y are set to the + mouse deltas since the last call to SDL_GetRelativeMouseState(). } +function SDL_GetRelativeMouseState(var x: Integer; var y: Integer): UInt8; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetRelativeMouseState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetRelativeMouseState} + +{ Set the position of the mouse cursor (generates a mouse motion event) } +procedure SDL_WarpMouse(x, y: UInt16); +cdecl; external {$IFDEF __GPC__}name 'SDL_WarpMouse'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_WarpMouse} + +{ Create a cursor using the specified data and mask (in MSB format). + The cursor width must be a multiple of 8 bits. + + The cursor is created in black and white according to the following: + data mask resulting pixel on screen + 0 1 White + 1 1 Black + 0 0 Transparent + 1 0 Inverted color if possible, black if not. + + Cursors created with this function must be freed with SDL_FreeCursor(). } +function SDL_CreateCursor(data, mask: PUInt8; w, h, hot_x, hot_y: Integer): PSDL_Cursor; +cdecl; external {$IFDEF __GPC__}name 'SDL_CreateCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CreateCursor} + +{ Set the currently active cursor to the specified one. + If the cursor is currently visible, the change will be immediately + represented on the display. } +procedure SDL_SetCursor(cursor: PSDL_Cursor); +cdecl; external {$IFDEF __GPC__}name 'SDL_SetCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetCursor} + +{ Returns the currently active cursor. } +function SDL_GetCursor: PSDL_Cursor; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetCursor} + +{ Deallocates a cursor created with SDL_CreateCursor(). } +procedure SDL_FreeCursor(cursor: PSDL_Cursor); +cdecl; external {$IFDEF __GPC__}name 'SDL_FreeCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_FreeCursor} + +{ Toggle whether or not the cursor is shown on the screen. + The cursor start off displayed, but can be turned off. + SDL_ShowCursor() returns 1 if the cursor was being displayed + before the call, or 0 if it was not. You can query the current + state by passing a 'toggle' value of -1. } +function SDL_ShowCursor(toggle: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_ShowCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_ShowCursor} + +function SDL_BUTTON( Button : Integer ) : Integer; + +{------------------------------------------------------------------------------} +{ Keyboard-routines } +{------------------------------------------------------------------------------} + +{ Enable/Disable UNICODE translation of keyboard input. + This translation has some overhead, so translation defaults off. + If 'enable' is 1, translation is enabled. + If 'enable' is 0, translation is disabled. + If 'enable' is -1, the translation state is not changed. + It returns the previous state of keyboard translation. } +function SDL_EnableUNICODE(enable: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_EnableUNICODE'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_EnableUNICODE} + +{ If 'delay' is set to 0, keyboard repeat is disabled. } +function SDL_EnableKeyRepeat(delay: Integer; interval: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_EnableKeyRepeat'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_EnableKeyRepeat} + +{ Get a snapshot of the current state of the keyboard. + Returns an array of keystates, indexed by the SDLK_* syms. + Used: + + UInt8 *keystate = SDL_GetKeyState(NULL); + if ( keystate[SDLK_RETURN] ) ... is pressed } + +function SDL_GetKeyState(numkeys: PInt): PUInt8; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetKeyState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetKeyState} + +{ Get the current key modifier state } +function SDL_GetModState: TSDLMod; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetModState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetModState} + +{ Set the current key modifier state + This does not change the keyboard state, only the key modifier flags. } +procedure SDL_SetModState(modstate: TSDLMod); +cdecl; external {$IFDEF __GPC__}name 'SDL_SetModState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SetModState} + +{ Get the name of an SDL virtual keysym } +function SDL_GetKeyName(key: TSDLKey): PChar; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetKeyName'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetKeyName} + +{------------------------------------------------------------------------------} +{ Active Routines } +{------------------------------------------------------------------------------} + +{ This function returns the current state of the application, which is a + bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and + SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to + see your application, otherwise it has been iconified or disabled. } + +function SDL_GetAppState: UInt8; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetAppState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetAppState} + + +{ Mutex functions } + +{ Create a mutex, initialized unlocked } + +function SDL_CreateMutex: PSDL_Mutex; +cdecl; external {$IFDEF __GPC__}name 'SDL_CreateMutex'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CreateMutex} + +{ Lock the mutex (Returns 0, or -1 on error) } + + function SDL_mutexP(mutex: PSDL_mutex): Integer; + cdecl; external {$IFDEF __GPC__}name 'SDL_mutexP'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{ $ EXTERNALSYM SDL_mutexP} + +function SDL_LockMutex(mutex: PSDL_mutex): Integer; +{$EXTERNALSYM SDL_LockMutex} + +{ Unlock the mutex (Returns 0, or -1 on error) } +function SDL_mutexV(mutex: PSDL_mutex): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_mutexV'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_mutexV} + +function SDL_UnlockMutex(mutex: PSDL_mutex): Integer; +{$EXTERNALSYM SDL_UnlockMutex} + +{ Destroy a mutex } +procedure SDL_DestroyMutex(mutex: PSDL_mutex); +cdecl; external {$IFDEF __GPC__}name 'SDL_DestroyMutex'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_DestroyMutex} + +{ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } +{ Semaphore functions } +{ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } +{ Create a semaphore, initialized with value, returns NULL on failure. } +function SDL_CreateSemaphore(initial_value: UInt32): PSDL_Sem; +cdecl; external {$IFDEF __GPC__}name 'SDL_CreateSemaphore'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CreateSemaphore} + + +{ Destroy a semaphore } +procedure SDL_DestroySemaphore(sem: PSDL_sem); +cdecl; external {$IFDEF __GPC__}name 'SDL_DestroySemaphore'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_DestroySemaphore} + +{ This function suspends the calling thread until the semaphore pointed + to by sem has a positive count. It then atomically decreases the semaphore + count. } + +function SDL_SemWait(sem: PSDL_sem): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SemWait'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SemWait} + +{ Non-blocking variant of SDL_SemWait(), returns 0 if the wait succeeds, + SDL_MUTEX_TIMEDOUT if the wait would block, and -1 on error. } + +function SDL_SemTryWait(sem: PSDL_sem): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SemTryWait'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SemTryWait} + +{ Variant of SDL_SemWait() with a timeout in milliseconds, returns 0 if + the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not succeed in + the allotted time, and -1 on error. + On some platforms this function is implemented by looping with a delay + of 1 ms, and so should be avoided if possible. } + +function SDL_SemWaitTimeout(sem: PSDL_sem; ms: UInt32): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SemWaitTimeout'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SemTryWait} + +{ Atomically increases the semaphore's count (not blocking), returns 0, + or -1 on error. } + +function SDL_SemPost(sem: PSDL_sem): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_SemPost'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SemTryWait} + +{ Returns the current count of the semaphore } + +function SDL_SemValue(sem: PSDL_sem): UInt32; +cdecl; external {$IFDEF __GPC__}name 'SDL_SemValue'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_SemValue} + +{ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } +{ Condition variable functions } +{ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } +{ Create a condition variable } +function SDL_CreateCond: PSDL_Cond; +cdecl; external {$IFDEF __GPC__}name 'SDL_CreateCond'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CreateCond} + +{ Destroy a condition variable } +procedure SDL_DestroyCond(cond: PSDL_Cond); +cdecl; external {$IFDEF __GPC__}name 'SDL_DestroyCond'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_DestroyCond} + +{ Restart one of the threads that are waiting on the condition variable, + returns 0 or -1 on error. } + +function SDL_CondSignal(cond: PSDL_cond): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_CondSignal'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CondSignal} + +{ Restart all threads that are waiting on the condition variable, + returns 0 or -1 on error. } + +function SDL_CondBroadcast(cond: PSDL_cond): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_CondBroadcast'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CondBroadcast} + + +{ Wait on the condition variable, unlocking the provided mutex. + The mutex must be locked before entering this function! + Returns 0 when it is signaled, or -1 on error. } + +function SDL_CondWait(cond: PSDL_cond; mut: PSDL_mutex): Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_CondWait'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CondWait} + +{ Waits for at most 'ms' milliseconds, and returns 0 if the condition + variable is signaled, SDL_MUTEX_TIMEDOUT if the condition is not + signaled in the allotted time, and -1 on error. + On some platforms this function is implemented by looping with a delay + of 1 ms, and so should be avoided if possible. } + +function SDL_CondWaitTimeout(cond: PSDL_cond; mut: PSDL_mutex; ms: UInt32) : Integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_CondWaitTimeout'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CondWaitTimeout} + +{ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } +{ Condition variable functions } +{ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } + +{ Create a thread } +function SDL_CreateThread(fn: PInt; data: Pointer): PSDL_Thread; +cdecl; external {$IFDEF __GPC__}name 'SDL_CreateThread'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_CreateThread} + +{ Get the 32-bit thread identifier for the current thread } +function SDL_ThreadID: UInt32; +cdecl; external {$IFDEF __GPC__}name 'SDL_ThreadID'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_ThreadID} + +{ Get the 32-bit thread identifier for the specified thread, + equivalent to SDL_ThreadID() if the specified thread is NULL. } +function SDL_GetThreadID(thread: PSDL_Thread): UInt32; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetThreadID'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetThreadID} + +{ Wait for a thread to finish. + The return code for the thread function is placed in the area + pointed to by 'status', if 'status' is not NULL. } + +procedure SDL_WaitThread(thread: PSDL_Thread; var status: Integer); +cdecl; external {$IFDEF __GPC__}name 'SDL_WaitThread'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_WaitThread} + +{ Forcefully kill a thread without worrying about its state } +procedure SDL_KillThread(thread: PSDL_Thread); +cdecl; external {$IFDEF __GPC__}name 'SDL_KillThread'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_KillThread} + +{------------------------------------------------------------------------------} +{ Get Environment Routines } +{------------------------------------------------------------------------------} +{$IFDEF WIN32} +function _putenv( const variable : Pchar ): integer; +cdecl; +{$ENDIF} + +{$IFDEF Unix} +{$IFDEF FPC} +function _putenv( const variable : Pchar ): integer; +cdecl; external 'libc.so' name 'putenv'; +{$ENDIF} +{$ENDIF} + +{ Put a variable of the form "name=value" into the environment } +//function SDL_putenv(const variable: PChar): integer; cdecl; external {$IFDEF __GPC__}name 'SDL_Init'{$ELSE} SDLLibName{$ENDIF __GPC__}SDLLibName name ''; +function SDL_putenv(const variable: PChar): integer; +{$EXTERNALSYM SDL_putenv} + +// The following function has been commented out to encourage developers to use +// SDL_putenv as it it more portable +//function putenv(const variable: PChar): integer; +//{$EXTERNALSYM putenv} + +{$IFDEF WIN32} +{$IFNDEF __GPC__} +function getenv( const name : Pchar ): PChar; cdecl; +{$ENDIF} +{$ENDIF} + +{* Retrieve a variable named "name" from the environment } +//function SDL_getenv(const name: PChar): PChar; cdecl; external {$IFDEF __GPC__}name 'SDL_Init'{$ELSE} SDLLibName{$ENDIF __GPC__}SDLLibName name ''; +function SDL_getenv(const name: PChar): PChar; +{$EXTERNALSYM SDL_getenv} + +// The following function has been commented out to encourage developers to use +// SDL_getenv as it it more portable +//function getenv(const name: PChar): PChar; +//{$EXTERNALSYM getenv} + +{* + * This function gives you custom hooks into the window manager information. + * It fills the structure pointed to by 'info' with custom information and + * returns 1 if the function is implemented. If it's not implemented, or + * the version member of the 'info' structure is invalid, it returns 0. + *} +function SDL_GetWMInfo(info : PSDL_SysWMinfo) : integer; +cdecl; external {$IFDEF __GPC__}name 'SDL_GetWMInfo'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_GetWMInfo} + +{------------------------------------------------------------------------------} + +//SDL_loadso.h +{* This function dynamically loads a shared object and returns a pointer + * to the object handle (or NULL if there was an error). + * The 'sofile' parameter is a system dependent name of the object file. + *} +function SDL_LoadObject( const sofile : PChar ) : Pointer; +cdecl; external {$IFDEF __GPC__}name 'SDL_LoadObject'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_LoadObject} + +{* Given an object handle, this function looks up the address of the + * named function in the shared object and returns it. This address + * is no longer valid after calling SDL_UnloadObject(). + *} +function SDL_LoadFunction( handle : Pointer; const name : PChar ) : Pointer; +cdecl; external {$IFDEF __GPC__}name 'SDL_LoadFunction'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_LoadFunction} + +{* Unload a shared object from memory *} +procedure SDL_UnloadObject( handle : Pointer ); +cdecl; external {$IFDEF __GPC__}name 'SDL_UnloadObject'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_UnloadObject} + + + +{------------------------------------------------------------------------------} + +function SDL_Swap32(D: Uint32): Uint32; +{$EXTERNALSYM SDL_Swap32} + +{ FreeAndNil frees the given TObject instance and sets the variable reference + to nil. Be careful to only pass TObjects to this routine. } +procedure FreeAndNil(var Obj); + +{ Exit procedure handling } + +{ AddExitProc adds the given procedure to the run-time library's exit + procedure list. When an application terminates, its exit procedures are + executed in reverse order of definition, i.e. the last procedure passed + to AddExitProc is the first one to get executed upon termination. } +procedure AddExitProc(Proc: TProcedure); + +// Bitwise Checking functions +function IsBitOn( value : integer; bit : Byte ) : boolean; + +function TurnBitOn( value : integer; bit : Byte ) : integer; + +function TurnBitOff( value : integer; bit : Byte ) : integer; + +implementation + +{$IFDEF __GPC__} + {$L 'sdl'} { link sdl.dll.a or libsdl.so or libsdl.a } +{$ENDIF} + +function SDL_TABLESIZE(table: PChar): Integer; +begin + Result := SizeOf(table) div SizeOf(table[0]); +end; + +procedure SDL_OutOfMemory; +begin + {$IFNDEF WIN32} + SDL_Error(SDL_ENOMEM); + {$ENDIF} +end; + +function SDL_RWSeek(context: PSDL_RWops; offset: Integer; whence: Integer) : Integer; +begin + Result := context^.seek(context, offset, whence); +end; + +function SDL_RWTell(context: PSDL_RWops): Integer; +begin + Result := context^.seek(context, 0, 1); +end; + +function SDL_RWRead(context: PSDL_RWops; ptr: Pointer; size: Integer; n: Integer): Integer; +begin + Result := context^.read(context, ptr, size, n); +end; + +function SDL_RWWrite(context: PSDL_RWops; ptr: Pointer; size: Integer; n: Integer): Integer; +begin + Result := context^.write(context, ptr, size, n); +end; + +function SDL_RWClose(context: PSDL_RWops): Integer; +begin + Result := context^.close(context); +end; + +function SDL_LoadWAV(filename: PChar; spec: PSDL_AudioSpec; audio_buf: PUInt8; audiolen: PUInt32): PSDL_AudioSpec; +begin + Result := SDL_LoadWAV_RW(SDL_RWFromFile(filename, 'rb'), 1, spec, audio_buf, audiolen); +end; + +function SDL_CDInDrive( status : TSDL_CDStatus ): LongBool; +begin + Result := ord( status ) > ord( CD_ERROR ); +end; + +procedure FRAMES_TO_MSF(frames: Integer; var M: Integer; var S: Integer; var + F: Integer); +var + value: Integer; +begin + value := frames; + F := value mod CD_FPS; + value := value div CD_FPS; + S := value mod 60; + value := value div 60; + M := value; +end; + +function MSF_TO_FRAMES(M: Integer; S: Integer; F: Integer): Integer; +begin + Result := M * 60 * CD_FPS + S * CD_FPS + F; +end; + +procedure SDL_VERSION(var X: TSDL_Version); +begin + X.major := SDL_MAJOR_VERSION; + X.minor := SDL_MINOR_VERSION; + X.patch := SDL_PATCHLEVEL; +end; + +function SDL_VERSIONNUM(X, Y, Z: Integer): Integer; +begin + Result := X * 1000 + Y * 100 + Z; +end; + +function SDL_COMPILEDVERSION: Integer; +begin + Result := SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL + ); +end; + +function SDL_VERSION_ATLEAST(X, Y, Z: Integer): LongBool; +begin + Result := (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)); +end; + +function SDL_LoadBMP(filename: PChar): PSDL_Surface; +begin + Result := SDL_LoadBMP_RW(SDL_RWFromFile(filename, 'rb'), 1); +end; + +function SDL_SaveBMP(surface: PSDL_Surface; filename: PChar): Integer; +begin + Result := SDL_SaveBMP_RW(surface, SDL_RWFromFile(filename, 'wb'), 1); +end; + +function SDL_BlitSurface(src: PSDL_Surface; srcrect: PSDL_Rect; dst: + PSDL_Surface; + dstrect: PSDL_Rect): Integer; +begin + Result := SDL_UpperBlit(src, srcrect, dst, dstrect); +end; + +function SDL_AllocSurface(flags: UInt32; width, height, depth: Integer; + RMask, GMask, BMask, AMask: UInt32): PSDL_Surface; +begin + Result := SDL_CreateRGBSurface(flags, width, height, depth, RMask, GMask, + BMask, AMask); +end; + +function SDL_MustLock(Surface: PSDL_Surface): Boolean; +begin + Result := ( ( surface^.offset <> 0 ) or + ( ( surface^.flags and ( SDL_HWSURFACE or SDL_ASYNCBLIT or SDL_RLEACCEL ) ) <> 0 ) ); +end; + +function SDL_LockMutex(mutex: PSDL_mutex): Integer; +begin + Result := SDL_mutexP(mutex); +end; + +function SDL_UnlockMutex(mutex: PSDL_mutex): Integer; +begin + Result := SDL_mutexV(mutex); +end; + +{$IFDEF WIN32} +function _putenv( const variable : Pchar ): Integer; +cdecl; external {$IFDEF __GPC__}name '_putenv'{$ELSE} 'MSVCRT.DLL'{$ENDIF __GPC__}; +{$ENDIF} + + +function SDL_putenv(const variable: PChar): Integer; +begin + {$IFDEF WIN32} + Result := _putenv(variable); + {$ENDIF} + + {$IFDEF UNIX} + {$IFDEF FPC} + Result := _putenv(variable); + {$ELSE} + Result := libc.putenv(variable); + {$ENDIF} + {$ENDIF} +end; + +{$IFDEF WIN32} +{$IFNDEF __GPC__} +function getenv( const name : Pchar ): PChar; +cdecl; external {$IFDEF __GPC__}name 'getenv'{$ELSE} 'MSVCRT.DLL'{$ENDIF}; +{$ENDIF} +{$ENDIF} + +function SDL_getenv(const name: PChar): PChar; +begin + {$IFDEF WIN32} + + {$IFDEF __GPC__} + Result := getenv( string( name ) ); + {$ELSE} + Result := getenv( name ); + {$ENDIF} + + {$ELSE} + + {$IFDEF UNIX} + + {$IFDEF FPC} + Result := fpgetenv(name); + {$ELSE} + Result := libc.getenv(name); + {$ENDIF} + + {$ENDIF} + + {$ENDIF} +end; + +function SDL_BUTTON( Button : Integer ) : Integer; +begin + Result := SDL_PRESSED shl ( Button - 1 ); +end; + +function SDL_Swap32(D: Uint32): Uint32; +begin + Result := ((D shl 24) or ((D shl 8) and $00FF0000) or ((D shr 8) and $0000FF00) or (D shr 24)); +end; + +procedure FreeAndNil(var Obj); +{$IFNDEF __GPC__} +{$IFNDEF __TMT__} +var + Temp: TObject; +{$ENDIF} +{$ENDIF} +begin +{$IFNDEF __GPC__} +{$IFNDEF __TMT__} + Temp := TObject(Obj); + Pointer(Obj) := nil; + Temp.Free; +{$ENDIF} +{$ENDIF} +end; + +{ Exit procedure handling } +type + PExitProcInfo = ^TExitProcInfo; + TExitProcInfo = record + Next: PExitProcInfo; + SaveExit: Pointer; + Proc: TProcedure; + end; + +var + ExitProcList: PExitProcInfo = nil; + +procedure DoExitProc; +var + P: PExitProcInfo; + Proc: TProcedure; +begin + P := ExitProcList; + ExitProcList := P^.Next; + ExitProc := P^.SaveExit; + Proc := P^.Proc; + Dispose(P); + Proc; +end; + +procedure AddExitProc(Proc: TProcedure); +var + P: PExitProcInfo; +begin + New(P); + P^.Next := ExitProcList; + P^.SaveExit := ExitProc; + P^.Proc := Proc; + ExitProcList := P; + ExitProc := @DoExitProc; +end; + +function IsBitOn( value : integer; bit : Byte ) : boolean; +begin + result := ( ( value and ( 1 shl bit ) ) <> 0 ); +end; + +function TurnBitOn( value : integer; bit : Byte ) : integer; +begin + result := ( value or ( 1 shl bit ) ); +end; + +function TurnBitOff( value : integer; bit : Byte ) : integer; +begin + result := ( value and not ( 1 shl bit ) ); +end; + +end. + + diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/sdl_cpuinfo.pas b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdl_cpuinfo.pas new file mode 100644 index 00000000..bd371c55 --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdl_cpuinfo.pas @@ -0,0 +1,155 @@ +unit sdl_cpuinfo; +{ + $Id: sdl_cpuinfo.pas,v 1.2 2004/02/18 22:52:53 savage Exp $ + +} +{******************************************************************************} +{ } +{ Borland Delphi SDL - Simple DirectMedia Layer } +{ Conversion of the Simple DirectMedia Layer Headers } +{ } +{ Portions created by Sam Lantinga are } +{ Copyright (C) 1997-2004 Sam Lantinga } +{ 5635-34 Springhouse Dr. } +{ Pleasanton, CA 94588 (USA) } +{ } +{ All Rights Reserved. } +{ } +{ The original files are : SDL_cpuinfo.h } +{ } +{ The initial developer of this Pascal code was : } +{ Dominqiue Louis } +{ } +{ Portions created by Dominqiue Louis are } +{ Copyright (C) 2000 - 2004 Dominqiue Louis. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ } +{ } +{ } +{ } +{ } +{ } +{ } +{ Requires } +{ -------- } +{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } +{ They are available from... } +{ http://www.libsdl.org . } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ + $Log: sdl_cpuinfo.pas,v $ + Revision 1.2 2004/02/18 22:52:53 savage + Forgot to add jedi-sdl.inc file. It's there now. + + Revision 1.1 2004/02/18 22:35:54 savage + Brought sdl.pas up to 1.2.7 compatability + Thus... + Added SDL_GL_STEREO, + SDL_GL_MULTISAMPLEBUFFERS, + SDL_GL_MULTISAMPLESAMPLES + + Add DLL/Shared object functions + function SDL_LoadObject( const sofile : PChar ) : Pointer; + + function SDL_LoadFunction( handle : Pointer; const name : PChar ) : Pointer; + + procedure SDL_UnloadObject( handle : Pointer ); + + Added function to create RWops from const memory: SDL_RWFromConstMem() + function SDL_RWFromConstMem(const mem: Pointer; size: Integer) : PSDL_RWops; + + Ported SDL_cpuinfo.h so Now you can test for Specific CPU types. + + +} +{******************************************************************************} + +interface + +{$I jedi-sdl.inc} + +uses + sdl; + +{* This function returns true if the CPU has the RDTSC instruction + *} +function SDL_HasRDTSC : SDL_Bool; +cdecl; external {$IFDEF __GPC__}name 'SDL_HasRDTSC'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_HasRDTSC} + +{* This function returns true if the CPU has MMX features + *} +function SDL_HasMMX : SDL_Bool; +cdecl; external {$IFDEF __GPC__}name 'SDL_HasMMX'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_HasMMX} + +{* This function returns true if the CPU has MMX Ext. features + *} +function SDL_HasMMXExt : SDL_Bool; +cdecl; external {$IFDEF __GPC__}name 'SDL_HasMMXExt'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_HasMMXExt} + +{* This function returns true if the CPU has 3DNow features + *} +function SDL_Has3DNow : SDL_Bool; +cdecl; external {$IFDEF __GPC__}name 'SDL_Has3DNow'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_Has3DNow} + +{* This function returns true if the CPU has 3DNow! Ext. features + *} +function SDL_Has3DNowExt : SDL_Bool; +cdecl; external {$IFDEF __GPC__}name 'SDL_Has3DNowExt'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_Has3DNowExt} + +{* This function returns true if the CPU has SSE features + *} +function SDL_HasSSE : SDL_Bool; +cdecl; external {$IFDEF __GPC__}name 'SDL_HasSSE'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_HasSSE} + +{* This function returns true if the CPU has SSE2 features + *} +function SDL_HasSSE2 : SDL_Bool; +cdecl; external {$IFDEF __GPC__}name 'SDL_HasSSE2'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_HasSSE2} + +{* This function returns true if the CPU has AltiVec features + *} +function SDL_HasAltiVec : SDL_Bool; +cdecl; external {$IFDEF __GPC__}name 'SDL_HasAltiVec'{$ELSE} SDLLibName{$ENDIF __GPC__}; +{$EXTERNALSYM SDL_HasAltiVec} + +implementation + +end. + \ No newline at end of file diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlgameinterface.pas b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlgameinterface.pas new file mode 100644 index 00000000..f8bf902c --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlgameinterface.pas @@ -0,0 +1,195 @@ +unit sdlgameinterface; +{ + $Id: sdlgameinterface.pas,v 1.3 2004/10/17 18:41:49 savage Exp $ + +} +{******************************************************************************} +{ } +{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } +{ Game Interface Base class } +{ } +{ The initial developer of this Pascal code was : } +{ Dominqiue Louis } +{ } +{ Portions created by Dominqiue Louis are } +{ Copyright (C) 2000 - 2001 Dominqiue Louis. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ } +{ } +{ } +{ } +{ } +{ } +{ } +{ Requires } +{ -------- } +{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } +{ They are available from... } +{ http://www.libsdl.org . } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ September 23 2004 - DL : Initial Creation } +{ + $Log: sdlgameinterface.pas,v $ + Revision 1.3 2004/10/17 18:41:49 savage + Slight Change to allow Reseting of Input Event handlers + + Revision 1.2 2004/09/30 22:35:47 savage + Changes, enhancements and additions as required to get SoAoS working. + + +} +{******************************************************************************} + +interface + +uses + sdl, + sdlwindow; + +type + TGameInterfaceClass = class of TGameInterface; + + TGameInterface = class( TObject ) + private + FNextGameInterface : TGameInterfaceClass; + protected + Dragging : Boolean; + Loaded : Boolean; + procedure FreeSurfaces; virtual; + procedure Render; virtual; abstract; + procedure Close; virtual; + procedure Update( aElapsedTime : single ); virtual; + procedure MouseDown( Button : Integer; Shift: TSDLMod; MousePos : TPoint ); virtual; + procedure MouseMove( Shift: TSDLMod; CurrentPos : TPoint; RelativePos : TPoint ); virtual; + procedure MouseUp( Button : Integer; Shift: TSDLMod; MousePos : TPoint ); virtual; + procedure MouseWheelScroll( WheelDelta : Integer; Shift: TSDLMod; MousePos : TPoint ); virtual; + procedure KeyDown( var Key: TSDLKey; Shift: TSDLMod; unicode : UInt16 ); virtual; + public + MainWindow : TSDL2DWindow; + procedure ResetInputManager; + procedure LoadSurfaces; virtual; + function PointIsInRect( Point : TPoint; x, y, x1, y1 : integer ) : Boolean; + constructor Create( const aMainWindow : TSDL2DWindow ); + destructor Destroy; override; + property NextGameInterface : TGameInterfaceClass read FNextGameInterface write FNextGameInterface; + end; + +implementation + +{ TGameInterface } +procedure TGameInterface.Close; +begin + FNextGameInterface := nil; +end; + +constructor TGameInterface.Create( const aMainWindow : TSDL2DWindow ); +begin + inherited Create; + MainWindow := aMainWindow; + FNextGameInterface := TGameInterface; + ResetInputManager; +end; + +destructor TGameInterface.Destroy; +begin + if Loaded then + FreeSurfaces; + inherited; +end; + +procedure TGameInterface.FreeSurfaces; +begin + Loaded := False; +end; + +procedure TGameInterface.KeyDown(var Key: TSDLKey; Shift: TSDLMod; unicode: UInt16); +begin + +end; + +procedure TGameInterface.LoadSurfaces; +begin + Loaded := True; +end; + +procedure TGameInterface.MouseDown(Button: Integer; Shift: TSDLMod; MousePos: TPoint); +begin + Dragging := True; +end; + +procedure TGameInterface.MouseMove(Shift: TSDLMod; CurrentPos, RelativePos: TPoint); +begin + +end; + +procedure TGameInterface.MouseUp(Button: Integer; Shift: TSDLMod; MousePos: TPoint); +begin + Dragging := True; +end; + +procedure TGameInterface.MouseWheelScroll(WheelDelta: Integer; Shift: TSDLMod; MousePos: TPoint); +begin + +end; + +function TGameInterface.PointIsInRect( Point : TPoint; x, y, x1, y1: integer ): Boolean; +begin + if ( Point.x >= x ) + and ( Point.y >= y ) + and ( Point.x <= x1 ) + and ( Point.y <= y1 ) then + result := true + else + result := false; +end; + +procedure TGameInterface.ResetInputManager; +begin + MainWindow.InputManager.Mouse.OnMouseDown := MouseDown; + MainWindow.InputManager.Mouse.OnMouseMove := MouseMove; + MainWindow.InputManager.Mouse.OnMouseUp := MouseUp; + MainWindow.InputManager.Mouse.OnMouseWheel := MouseWheelScroll; + MainWindow.InputManager.KeyBoard.OnKeyDown := KeyDown; + MainWindow.OnRender := Render; + MainWindow.OnClose := Close; + MainWindow.OnUpdate := Update; +end; + +procedure TGameInterface.Update(aElapsedTime: single); +begin + +end; + +end. diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/sdli386utils.pas b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdli386utils.pas new file mode 100644 index 00000000..9151168a --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdli386utils.pas @@ -0,0 +1,5236 @@ +unit sdli386utils; +{ + $Id: sdli386utils.pas,v 1.5 2004/06/02 19:38:53 savage Exp $ + +} +{******************************************************************************} +{ } +{ Borland Delphi SDL - Simple DirectMedia Layer } +{ SDL Utility functions } +{ } +{ } +{ The initial developer of this Pascal code was : } +{ Tom Jones } +{ } +{ Portions created by Tom Jones are } +{ Copyright (C) 2000 - 2001 Tom Jones. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ Dominique Louis } +{ Róbert Kisnémeth } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ Helper functions... } +{ } +{ } +{ Requires } +{ -------- } +{ SDL.dll on Windows platforms } +{ libSDL-1.1.so.0 on Linux platform } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ 2000 - TJ : Initial creation } +{ } +{ July 13 2001 - DL : Added PutPixel and GetPixel routines. } +{ } +{ Sept 14 2001 - RK : Added flipping routines. } +{ } +{ Sept 19 2001 - RK : Added PutPixel & line drawing & blitting with ADD } +{ effect. Fixed a bug in SDL_PutPixel & SDL_GetPixel } +{ Added PSDLRect() } +{ Sept 22 2001 - DL : Removed need for Windows.pas by defining types here} +{ Also removed by poor attempt or a dialog box } +{ } +{ Sept 25 2001 - RK : Added PixelTest, NewPutPixel, SubPixel, SubLine, } +{ SubSurface, MonoSurface & TexturedSurface } +{ } +{ Sept 26 2001 - DL : Made change so that it refers to native Pascal } +{ types rather that Windows types. This makes it more} +{ portable to Linix. } +{ } +{ Sept 27 2001 - RK : SDLUtils now can be compiled with FreePascal } +{ } +{ Oct 27 2001 - JF : Added ScrollY function } +{ } +{ Jan 21 2002 - RK : Added SDL_ZoomSurface and SDL_WarpSurface } +{ } +{ Mar 28 2002 - JF : Added SDL_RotateSurface } +{ } +{ May 13 2002 - RK : Improved SDL_FillRectAdd & SDL_FillRectSub } +{ } +{ May 27 2002 - YS : GradientFillRect function } +{ } +{ May 30 2002 - RK : Added SDL_2xBlit, SDL_Scanline2xBlit } +{ & SDL_50Scanline2xBlit } +{ } +{ June 12 2002 - RK : Added SDL_PixelTestSurfaceVsRect } +{ } +{ June 12 2002 - JF : Updated SDL_PixelTestSurfaceVsRect } +{ } +{ November 9 2002 - JF : Added Jason's boolean Surface functions } +{ } +{ December 10 2002 - DE : Added Dean's SDL_ClipLine function } +{ } +{******************************************************************************} +{ + $Log: sdli386utils.pas,v $ + Revision 1.5 2004/06/02 19:38:53 savage + Changes to SDL_GradientFillRect as suggested by + Ángel Eduardo García Hernández. Many thanks. + + Revision 1.4 2004/05/29 23:11:53 savage + Changes to SDL_ScaleSurfaceRect as suggested by + Ángel Eduardo García Hernández to fix a colour issue with the function. Many thanks. + + Revision 1.3 2004/02/20 22:04:11 savage + Added Changes as mentioned by Rodrigo "Rui" R. (1/2 RRC2Soft) to facilitate FPC compilation and it also works in Delphi. Also syncronized the funcitons so that they are identical to sdlutils.pas, when no assembly version is available. + + Revision 1.2 2004/02/14 00:23:39 savage + As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. + + Revision 1.1 2004/02/05 00:08:20 savage + Module 1.0 release + + +} + +interface + +{$i jedi-sdl.inc} + +uses +{$IFDEF UNIX} + Types, + Xlib, +{$ENDIF} + SysUtils, + sdl; + +type + TGradientStyle = ( gsHorizontal, gsVertical ); + + // Pixel procedures +function SDL_PixelTest( SrcSurface1 : PSDL_Surface; SrcRect1 : PSDL_Rect; SrcSurface2 : + PSDL_Surface; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : Boolean; + +function SDL_GetPixel( SrcSurface : PSDL_Surface; x : cardinal; y : cardinal ) : Uint32; + +procedure SDL_PutPixel( SrcSurface : PSDL_Surface; x : integer; y : integer; Color : + cardinal ); + +procedure SDL_AddPixel( SrcSurface : PSDL_Surface; x : integer; y : integer; Color : + cardinal ); + +procedure SDL_SubPixel( SrcSurface : PSDL_Surface; x : integer; y : integer; Color : + cardinal ); + +// Line procedures +procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal );overload; + +procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ; DashLength, DashSpace : byte ); overload; + +procedure SDL_AddLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ); + +procedure SDL_SubLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ); + +// Surface procedures +procedure SDL_AddSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DstSurface : PSDL_Surface; DestRect : PSDL_Rect ); + +procedure SDL_SubSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DstSurface : PSDL_Surface; DestRect : PSDL_Rect ); + +procedure SDL_MonoSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DstSurface : PSDL_Surface; DestRect : PSDL_Rect; Color : cardinal ); + +procedure SDL_TexturedSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DstSurface : PSDL_Surface; DestRect : PSDL_Rect; Texture : PSDL_Surface; + TextureRect : PSDL_Rect ); + +procedure SDL_ZoomSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; DstRect : PSDL_Rect ); + +procedure SDL_WarpSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; UL, UR, LR, LL : PPoint ); + +// Flip procedures +procedure SDL_FlipRectH( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); + +procedure SDL_FlipRectV( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); + +function PSDLRect( aLeft, aTop, aWidth, aHeight : integer ) : PSDL_Rect; + +function SDLRect( aLeft, aTop, aWidth, aHeight : integer ) : TSDL_Rect; overload; + +function SDLRect( aRect : TRect ) : TSDL_Rect; overload; + +function SDL_ScaleSurfaceRect( SrcSurface : PSDL_Surface; SrcX1, SrcY1, SrcW, SrcH, + Width, Height : integer ) : PSDL_Surface; + +procedure SDL_ScrollY( DstSurface : PSDL_Surface; DifY : integer ); + +procedure SDL_ScrollX( DstSurface : PSDL_Surface; DifX : integer ); + +procedure SDL_RotateDeg( DstSurface, SrcSurface : PSDL_Surface; SrcRect : + PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Integer ); + +procedure SDL_RotateRad( DstSurface, SrcSurface : PSDL_Surface; SrcRect : + PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Single ); + +function ValidateSurfaceRect( DstSurface : PSDL_Surface; dstrect : PSDL_Rect ) : TSDL_Rect; + +// Fill Rect routine +procedure SDL_FillRectAdd( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); + +procedure SDL_FillRectSub( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); + +procedure SDL_GradientFillRect( DstSurface : PSDL_Surface; const Rect : PSDL_Rect; const StartColor, EndColor : TSDL_Color; const Style : TGradientStyle ); + +// NOTE for All SDL_2xblit... function : the dest surface must be 2x of the source surface! +procedure SDL_2xBlit( Src, Dest : PSDL_Surface ); + +procedure SDL_Scanline2xBlit( Src, Dest : PSDL_Surface ); + +procedure SDL_50Scanline2xBlit( Src, Dest : PSDL_Surface ); + +function SDL_PixelTestSurfaceVsRect( SrcSurface1 : PSDL_Surface; SrcRect1 : +PSDL_Rect; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : +boolean; + +// Jason's boolean Surface functions +procedure SDL_ORSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); + +procedure SDL_ANDSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); + +procedure SDL_GTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); + +procedure SDL_LTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); + +function SDL_ClipLine(var x1,y1,x2,y2: Integer; ClipRect: PSDL_Rect) : boolean; + +implementation + +uses + Math; + +function SDL_PixelTest( SrcSurface1 : PSDL_Surface; SrcRect1 : PSDL_Rect; SrcSurface2 : + PSDL_Surface; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : boolean; +var + Src_Rect1, Src_Rect2 : TSDL_Rect; + right1, bottom1 : integer; + right2, bottom2 : integer; + Scan1Start, Scan2Start, ScanWidth, ScanHeight : cardinal; + Mod1, Mod2 : cardinal; + Addr1, Addr2 : cardinal; + BPP : cardinal; + Pitch1, Pitch2 : cardinal; + TransparentColor1, TransparentColor2 : cardinal; + tx, ty : cardinal; + StartTick : cardinal; + Color1, Color2 : cardinal; +begin + Result := false; + if SrcRect1 = nil then + begin + with Src_Rect1 do + begin + x := 0; + y := 0; + w := SrcSurface1.w; + h := SrcSurface1.h; + end; + end + else + Src_Rect1 := SrcRect1^; + if SrcRect2 = nil then + begin + with Src_Rect2 do + begin + x := 0; + y := 0; + w := SrcSurface2.w; + h := SrcSurface2.h; + end; + end + else + Src_Rect2 := SrcRect2^; + with Src_Rect1 do + begin + Right1 := Left1 + w; + Bottom1 := Top1 + h; + end; + with Src_Rect2 do + begin + Right2 := Left2 + w; + Bottom2 := Top2 + h; + end; + if ( Left1 >= Right2 ) or ( Right1 <= Left2 ) or ( Top1 >= Bottom2 ) or ( Bottom1 <= + Top2 ) then + exit; + if Left1 <= Left2 then + begin + // 1. left, 2. right + Scan1Start := Src_Rect1.x + Left2 - Left1; + Scan2Start := Src_Rect2.x; + ScanWidth := Right1 - Left2; + with Src_Rect2 do + if ScanWidth > w then + ScanWidth := w; + end + else + begin + // 1. right, 2. left + Scan1Start := Src_Rect1.x; + Scan2Start := Src_Rect2.x + Left1 - Left2; + ScanWidth := Right2 - Left1; + with Src_Rect1 do + if ScanWidth > w then + ScanWidth := w; + end; + with SrcSurface1^ do + begin + Pitch1 := Pitch; + Addr1 := cardinal( Pixels ); + inc( Addr1, Pitch1 * UInt32( Src_Rect1.y ) ); + with format^ do + begin + BPP := BytesPerPixel; + TransparentColor1 := colorkey; + end; + end; + with SrcSurface2^ do + begin + TransparentColor2 := format.colorkey; + Pitch2 := Pitch; + Addr2 := cardinal( Pixels ); + inc( Addr2, Pitch2 * UInt32( Src_Rect2.y ) ); + end; + Mod1 := Pitch1 - ( ScanWidth * BPP ); + Mod2 := Pitch2 - ( ScanWidth * BPP ); + inc( Addr1, BPP * Scan1Start ); + inc( Addr2, BPP * Scan2Start ); + if Top1 <= Top2 then + begin + // 1. up, 2. down + ScanHeight := Bottom1 - Top2; + if ScanHeight > Src_Rect2.h then + ScanHeight := Src_Rect2.h; + inc( Addr1, Pitch1 * UInt32( Top2 - Top1 ) ); + end + else + begin + // 1. down, 2. up + ScanHeight := Bottom2 - Top1; + if ScanHeight > Src_Rect1.h then + ScanHeight := Src_Rect1.h; + inc( Addr2, Pitch2 * UInt32( Top1 - Top2 ) ); + end; + case BPP of + 1 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PByte( Addr1 )^ <> TransparentColor1 ) and ( PByte( Addr2 )^ <> + TransparentColor2 ) then + begin + Result := true; + exit; + end; + inc( Addr1 ); + inc( Addr2 ); + end; + inc( Addr1, Mod1 ); + inc( Addr2, Mod2 ); + end; + 2 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PWord( Addr1 )^ <> TransparentColor1 ) and ( PWord( Addr2 )^ <> + TransparentColor2 ) then + begin + Result := true; + exit; + end; + inc( Addr1, 2 ); + inc( Addr2, 2 ); + end; + inc( Addr1, Mod1 ); + inc( Addr2, Mod2 ); + end; + 3 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + Color1 := PLongWord( Addr1 )^ and $00FFFFFF; + Color2 := PLongWord( Addr2 )^ and $00FFFFFF; + if ( Color1 <> TransparentColor1 ) and ( Color2 <> TransparentColor2 ) + then + begin + Result := true; + exit; + end; + inc( Addr1, 3 ); + inc( Addr2, 3 ); + end; + inc( Addr1, Mod1 ); + inc( Addr2, Mod2 ); + end; + 4 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PLongWord( Addr1 )^ <> TransparentColor1 ) and ( PLongWord( Addr2 )^ <> + TransparentColor2 ) then + begin + Result := true; + exit; + end; + inc( Addr1, 4 ); + inc( Addr2, 4 ); + end; + inc( Addr1, Mod1 ); + inc( Addr2, Mod2 ); + end; + end; +end; + +function SDL_GetPixel( SrcSurface : PSDL_Surface; x : cardinal; y : cardinal ) : Uint32; +var + bpp : UInt32; + p : PInteger; +begin + bpp := SrcSurface.format.BytesPerPixel; + // Here p is the address to the pixel we want to retrieve + p := Pointer( Uint32( SrcSurface.pixels ) + UInt32( y ) * SrcSurface.pitch + UInt32( x ) * + bpp ); + case bpp of + 1 : result := PUint8( p )^; + 2 : result := PUint16( p )^; + 3 : + if ( SDL_BYTEORDER = SDL_BIG_ENDIAN ) then + result := PUInt8Array( p )[ 0 ] shl 16 or PUInt8Array( p )[ 1 ] shl 8 or + PUInt8Array( p )[ 2 ] + else + result := PUInt8Array( p )[ 0 ] or PUInt8Array( p )[ 1 ] shl 8 or + PUInt8Array( p )[ 2 ] shl 16; + 4 : result := PUint32( p )^; + else + result := 0; // shouldn't happen, but avoids warnings + end; +end; + +procedure SDL_PutPixel( SrcSurface : PSDL_Surface; x : integer; y : integer; Color : + cardinal ); +var + Addr, Pitch, BPP : cardinal; +begin + Addr := cardinal( SrcSurface.Pixels ); + Pitch := SrcSurface.Pitch; + BPP := SrcSurface.format.BytesPerPixel; + asm + mov eax, y + mul Pitch // EAX := y * Pitch + add Addr, eax // Addr:= Addr + (y * Pitch) + mov eax, x + mov ecx, Color + cmp BPP, 1 + jne @Not1BPP + add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x + mov [eax], cl + jmp @Quit + @Not1BPP: + cmp BPP, 2 + jne @Not2BPP + mul BPP // EAX := x * BPP + add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x * BPP + mov [eax], cx + jmp @Quit + @Not2BPP: + cmp BPP, 3 + jne @Not3BPP + mul BPP // EAX := x * BPP + add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x * BPP + mov edx, [eax] + and edx, $ff000000 + or edx, ecx + mov [eax], edx + jmp @Quit + @Not3BPP: + mul BPP // EAX := x * BPP + add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x * BPP + mov [eax], ecx + @Quit: + end; +end; + +procedure SDL_AddPixel( SrcSurface : PSDL_Surface; x : integer; y : integer; Color : + cardinal ); +var + SrcColor, FinalColor : cardinal; + Addr, Pitch, Bits : cardinal; +begin + if Color = 0 then + exit; + Addr := cardinal( SrcSurface.Pixels ); + Pitch := SrcSurface.Pitch; + Bits := SrcSurface.format.BitsPerPixel; + asm + mov eax, y + mul Pitch // EAX := y * Pitch + add Addr, eax // Addr:= Addr + (y * Pitch) + mov eax, x + cmp Bits, 8 + jne @Not8bit + add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x + mov cl, [eax] + movzx ecx, cl + mov SrcColor, ecx + mov edx, Color + and ecx, 3 + and edx, 3 + add ecx, edx + cmp ecx, 3 + jbe @Skip1_8bit + mov ecx, 3 + @Skip1_8bit: + mov FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $1c + and edx, $1c + add ecx, edx + cmp ecx, $1c + jbe @Skip2_8bit + mov ecx, $1c + @Skip2_8bit: + or FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $e0 + and edx, $e0 + add ecx, edx + cmp ecx, $e0 + jbe @Skip3_8bit + mov ecx, $e0 + @Skip3_8bit: + or ecx, FinalColor + mov [eax], cl + jmp @Quit + @Not8bit: + cmp Bits, 15 + jne @Not15bit + shl eax, 1 + add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x * 2 + mov ecx, [eax] + and ecx, $00007fff + mov SrcColor, ecx + mov edx, Color + and ecx, $1f + and edx, $1f + add ecx, edx + cmp ecx, $1f + jbe @Skip1_15bit + mov ecx, $1f + @Skip1_15bit: + mov FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $03e0 + and edx, $03e0 + add ecx, edx + cmp ecx, $03e0 + jbe @Skip2_15bit + mov ecx, $03e0 + @Skip2_15bit: + or FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $7c00 + and edx, $7c00 + add ecx, edx + cmp ecx, $7c00 + jbe @Skip3_15bit + mov ecx, $7c00 + @Skip3_15bit: + or ecx, FinalColor + mov [eax], cx + jmp @Quit + @Not15Bit: + cmp Bits, 16 + jne @Not16bit + shl eax, 1 + add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x * 2 + mov ecx, [eax] + and ecx, $0000ffff + mov SrcColor, ecx + mov edx, Color + and ecx, $1f + and edx, $1f + add ecx, edx + cmp ecx, $1f + jbe @Skip1_16bit + mov ecx, $1f + @Skip1_16bit: + mov FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $07e0 + and edx, $07e0 + add ecx, edx + cmp ecx, $07e0 + jbe @Skip2_16bit + mov ecx, $07e0 + @Skip2_16bit: + or FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $f800 + and edx, $f800 + add ecx, edx + cmp ecx, $f800 + jbe @Skip3_16bit + mov ecx, $f800 + @Skip3_16bit: + or ecx, FinalColor + mov [eax], cx + jmp @Quit + @Not16Bit: + cmp Bits, 24 + jne @Not24bit + mov ecx, 0 + add ecx, eax + shl ecx, 1 + add ecx, eax + mov eax, ecx + jmp @32bit + @Not24bit: + shl eax, 2 + @32bit: + add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x * 2 + mov ecx, [eax] + mov FinalColor, ecx + and FinalColor, $ff000000 + and ecx, $00ffffff + mov SrcColor, ecx + mov edx, Color + and ecx, $000000ff + and edx, $000000ff + add ecx, edx + cmp ecx, $000000ff + jbe @Skip1_32bit + mov ecx, $000000ff + @Skip1_32bit: + or FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $0000ff00 + and edx, $0000ff00 + add ecx, edx + cmp ecx, $0000ff00 + jbe @Skip2_32bit + mov ecx, $0000ff00 + @Skip2_32bit: + or FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $00ff0000 + and edx, $00ff0000 + add ecx, edx + cmp ecx, $00ff0000 + jbe @Skip3_32bit + mov ecx, $00ff0000 + @Skip3_32bit: + or ecx, FinalColor + mov [eax], ecx + @Quit: + end; +end; + +procedure SDL_SubPixel( SrcSurface : PSDL_Surface; x : integer; y : integer; Color : + cardinal ); +var + SrcColor, FinalColor : cardinal; + Addr, Pitch, Bits : cardinal; +begin + if Color = 0 then + exit; + Addr := cardinal( SrcSurface.Pixels ); + Pitch := SrcSurface.Pitch; + Bits := SrcSurface.format.BitsPerPixel; + asm + mov eax, y + mul Pitch // EAX := y * Pitch + add Addr, eax // Addr:= Addr + (y * Pitch) + mov eax, x + cmp Bits, 8 + jne @Not8bit + add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x + mov cl, [eax] + movzx ecx, cl + mov SrcColor, ecx + mov edx, Color + and ecx, 3 + and edx, 3 + sub ecx, edx + jns @Skip1_8bit + mov ecx, 0 + @Skip1_8bit: + mov FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $1c + and edx, $1c + sub ecx, edx + jns @Skip2_8bit + mov ecx, 0 + @Skip2_8bit: + or FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $e0 + and edx, $e0 + sub ecx, edx + jns @Skip3_8bit + mov ecx, 0 + @Skip3_8bit: + or ecx, FinalColor + mov [eax], cl + jmp @Quit + @Not8bit: + cmp Bits, 15 + jne @Not15bit + shl eax, 1 + add eax, Addr + mov ecx, [eax] + and ecx, $00007fff + mov SrcColor, ecx + mov edx, Color + and ecx, $1f + and edx, $1f + sub ecx, edx + jns @Skip1_15bit + mov ecx, 0 + @Skip1_15bit: + mov FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $03e0 + and edx, $03e0 + sub ecx, edx + jns @Skip2_15bit + mov ecx, 0 + @Skip2_15bit: + or FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $7c00 + and edx, $7c00 + sub ecx, edx + jns @Skip3_15bit + mov ecx, 0 + @Skip3_15bit: + or ecx, FinalColor + mov [eax], cx + jmp @Quit + @Not15Bit: + cmp Bits, 16 + jne @Not16bit + shl eax, 1 + add eax, Addr + mov ecx, [eax] + and ecx, $0000ffff + mov SrcColor, ecx + mov edx, Color + and ecx, $1f + and edx, $1f + sub ecx, edx + jns @Skip1_16bit + mov ecx, 0 + @Skip1_16bit: + mov FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $07e0 + and edx, $07e0 + sub ecx, edx + jns @Skip2_16bit + mov ecx, 0 + @Skip2_16bit: + or FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $f800 + and edx, $f800 + sub ecx, edx + jns @Skip3_16bit + mov ecx, 0 + @Skip3_16bit: + or ecx, FinalColor + mov [eax], cx + jmp @Quit + @Not16Bit: + cmp Bits, 24 + jne @Not24bit + mov ecx, 0 + add ecx, eax + shl ecx, 1 + add ecx, eax + mov eax, ecx + jmp @32bit + @Not24bit: + shl eax, 2 + @32bit: + add eax, Addr + mov ecx, [eax] + mov FinalColor, ecx + and FinalColor, $ff000000 + and ecx, $00ffffff + mov SrcColor, ecx + mov edx, Color + and ecx, $000000ff + and edx, $000000ff + sub ecx, edx + jns @Skip1_32bit + mov ecx, 0 + @Skip1_32bit: + or FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $0000ff00 + and edx, $0000ff00 + sub ecx, edx + jns @Skip2_32bit + mov ecx, 0 + @Skip2_32bit: + or FinalColor, ecx + mov ecx, SrcColor + mov edx, Color + and ecx, $00ff0000 + and edx, $00ff0000 + sub ecx, edx + jns @Skip3_32bit + mov ecx, 0 + @Skip3_32bit: + or ecx, FinalColor + mov [eax], ecx + @Quit: + end; +end; + +// Draw a line between x1,y1 and x2,y2 to the given surface +// NOTE: The surface must be locked before calling this! +procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ); +var + dx, dy, sdx, sdy, x, y, px, py : integer; +begin + dx := x2 - x1; + dy := y2 - y1; + if dx < 0 then + sdx := -1 + else + sdx := 1; + if dy < 0 then + sdy := -1 + else + sdy := 1; + dx := sdx * dx + 1; + dy := sdy * dy + 1; + x := 0; + y := 0; + px := x1; + py := y1; + if dx >= dy then + begin + for x := 0 to dx - 1 do + begin + SDL_PutPixel( DstSurface, px, py, Color ); + y := y + dy; + if y >= dx then + begin + y := y - dx; + py := py + sdy; + end; + px := px + sdx; + end; + end + else + begin + for y := 0 to dy - 1 do + begin + SDL_PutPixel( DstSurface, px, py, Color ); + x := x + dx; + if x >= dy then + begin + x := x - dy; + px := px + sdx; + end; + py := py + sdy; + end; + end; +end; + +// Draw a dashed line between x1,y1 and x2,y2 to the given surface +// NOTE: The surface must be locked before calling this! +procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ; DashLength, DashSpace : byte ); overload; +var + dx, dy, sdx, sdy, x, y, px, py, counter : integer; drawdash : boolean; +begin + counter := 0; + drawdash := true; //begin line drawing with dash + + //Avoid invalid user-passed dash parameters + if (DashLength < 1) + then DashLength := 1; + if (DashSpace < 1) + then DashSpace := 0; + + dx := x2 - x1; + dy := y2 - y1; + if dx < 0 then + sdx := -1 + else + sdx := 1; + if dy < 0 then + sdy := -1 + else + sdy := 1; + dx := sdx * dx + 1; + dy := sdy * dy + 1; + x := 0; + y := 0; + px := x1; + py := y1; + if dx >= dy then + begin + for x := 0 to dx - 1 do + begin + + //Alternate drawing dashes, or leaving spaces + if drawdash then + begin + SDL_PutPixel( DstSurface, px, py, Color ); + inc(counter); + if (counter > DashLength-1) and (DashSpace > 0) then + begin + drawdash := false; + counter := 0; + end; + end + else //space + begin + inc(counter); + if counter > DashSpace-1 then + begin + drawdash := true; + counter := 0; + end; + end; + + y := y + dy; + if y >= dx then + begin + y := y - dx; + py := py + sdy; + end; + px := px + sdx; + end; + end + else + begin + for y := 0 to dy - 1 do + begin + + //Alternate drawing dashes, or leaving spaces + if drawdash then + begin + SDL_PutPixel( DstSurface, px, py, Color ); + inc(counter); + if (counter > DashLength-1) and (DashSpace > 0) then + begin + drawdash := false; + counter := 0; + end; + end + else //space + begin + inc(counter); + if counter > DashSpace-1 then + begin + drawdash := true; + counter := 0; + end; + end; + + x := x + dx; + if x >= dy then + begin + x := x - dy; + px := px + sdx; + end; + py := py + sdy; + end; + end; +end; + +procedure SDL_AddLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ); +var + dx, dy, sdx, sdy, x, y, px, py : integer; +begin + dx := x2 - x1; + dy := y2 - y1; + if dx < 0 then + sdx := -1 + else + sdx := 1; + if dy < 0 then + sdy := -1 + else + sdy := 1; + dx := sdx * dx + 1; + dy := sdy * dy + 1; + x := 0; + y := 0; + px := x1; + py := y1; + if dx >= dy then + begin + for x := 0 to dx - 1 do + begin + SDL_AddPixel( DstSurface, px, py, Color ); + y := y + dy; + if y >= dx then + begin + y := y - dx; + py := py + sdy; + end; + px := px + sdx; + end; + end + else + begin + for y := 0 to dy - 1 do + begin + SDL_AddPixel( DstSurface, px, py, Color ); + x := x + dx; + if x >= dy then + begin + x := x - dy; + px := px + sdx; + end; + py := py + sdy; + end; + end; +end; + +procedure SDL_SubLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ); +var + dx, dy, sdx, sdy, x, y, px, py : integer; +begin + dx := x2 - x1; + dy := y2 - y1; + if dx < 0 then + sdx := -1 + else + sdx := 1; + if dy < 0 then + sdy := -1 + else + sdy := 1; + dx := sdx * dx + 1; + dy := sdy * dy + 1; + x := 0; + y := 0; + px := x1; + py := y1; + if dx >= dy then + begin + for x := 0 to dx - 1 do + begin + SDL_SubPixel( DstSurface, px, py, Color ); + y := y + dy; + if y >= dx then + begin + y := y - dx; + py := py + sdy; + end; + px := px + sdx; + end; + end + else + begin + for y := 0 to dy - 1 do + begin + SDL_SubPixel( DstSurface, px, py, Color ); + x := x + dx; + if x >= dy then + begin + x := x - dy; + px := px + sdx; + end; + py := py + sdy; + end; + end; +end; + +// This procedure works on 8, 15, 16, 24 and 32 bits color depth surfaces. +// In 8 bit color depth mode the procedure works with the default packed +// palette (RRRGGGBB). It handles all clipping. +procedure SDL_AddSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DstSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + // TransparentColor: cardinal; + _ebx, _esi, _edi, _esp : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DstSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DstSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DstSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + // TransparentColor := format.ColorKey; + end; + with DstSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DstSurface ); + case bits of + 8 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov al, [esi] // AL := source color + cmp al, 0 + je @SkipColor // if AL=0 or AL=transparent color then skip everything + mov esp, eax // ESP - source color + mov bl, [edi] // BL := destination color + mov dl, bl // DL := destination color + and ax, $03 // Adding BLUE + and bl, $03 + add al, bl + cmp al, $03 + jbe @Skip1 + mov al, $03 + @Skip1: + mov cl, al + mov eax, esp // Adding GREEN + mov bl, dl + and al, $1c + and bl, $1c + add al, bl + cmp al, $1c + jbe @Skip2 + mov al, $1c + @Skip2: + or cl, al + mov eax, esp // Adding RED + mov bl, dl + and ax, $e0 + and bx, $e0 + add ax, bx + cmp ax, $e0 + jbe @Skip3 + mov al, $e0 + @Skip3: + or cl, al + mov [edi], cl + @SkipColor: + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 15 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov ax, [esi] // AX := source color + cmp ax, 0 + je @SkipColor // if AX=0 then skip everything + mov esp, eax // ESP - source color + mov bx, [edi] // BX := destination color + mov dx, bx // DX := destination color + and ax, $001F // Adding BLUE + and bx, $001F + add ax, bx + cmp ax, $001F + jbe @Skip1 + mov ax, $001F + @Skip1: + mov cx, ax + mov eax, esp // Adding GREEN + mov bx, dx + and ax, $3E0 + and bx, $3E0 + add ax, bx + cmp ax, $3E0 + jbe @Skip2 + mov ax, $3E0 + @Skip2: + or cx, ax + mov eax, esp // Adding RED + mov bx, dx + and ax, $7C00 + and bx, $7C00 + add ax, bx + cmp ax, $7C00 + jbe @Skip3 + mov ax, $7C00 + @Skip3: + or cx, ax + mov [edi], cx + @SkipColor: + add esi, 2 + add edi, 2 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 16 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov ax, [esi] // AX := source color + cmp ax, 0 + je @SkipColor // if AX=0 then skip everything + mov esp, eax // ESP - source color + mov bx, [edi] // BX := destination color + mov dx, bx // DX := destination color + and ax, $1F // Adding BLUE + and bx, $1F + add ax, bx + cmp ax, $1F + jbe @Skip1 + mov ax, $1F + @Skip1: + mov cx, ax + mov eax, esp // Adding GREEN + mov bx, dx + and ax, $7E0 + and bx, $7E0 + add ax, bx + cmp ax, $7E0 + jbe @Skip2 + mov ax, $7E0 + @Skip2: + or cx, ax + mov eax, esp // Adding RED + mov bx, dx + and eax, $F800 + and ebx, $F800 + add eax, ebx + cmp eax, $F800 + jbe @Skip3 + mov ax, $F800 + @Skip3: + or cx, ax + mov [edi], cx + @SkipColor: + add esi, 2 + add edi, 2 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 24 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + add WorkX, ax // WorkX := Src.w * 2 + add WorkX, ax // WorkX := Src.w * 3 + @Loopx: + mov bl, [edi] // BX := destination color + mov al, [esi] // AX := source color + cmp al, 0 + je @Skip // if AL=0 then skip COMPONENT + mov ah, 0 // AX := COLOR COMPONENT + mov bh, 0 + add bx, ax + cmp bx, $00ff + jb @Skip + mov bl, $ff + @Skip: + mov [edi], bl + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 32 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + shl ax, 2 + mov WorkX, ax // WorkX := Src.w * 4 + @Loopx: + mov bl, [edi] // BX := destination color + mov al, [esi] // AX := source color + cmp al, 0 + je @Skip // if AL=0 then skip COMPONENT + mov ah, 0 // AX := COLOR COMPONENT + mov bh, 0 + add bx, ax + cmp bx, $00ff + jb @Skip + mov bl, $ff + @Skip: + mov [edi], bl + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DstSurface ); +end; + +procedure SDL_SubSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DstSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + _ebx, _esi, _edi, _esp : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DstSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DstSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DstSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + end; + with DstSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := DstSurface.Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DstSurface ); + case bits of + 8 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov al, [esi] // AL := source color + cmp al, 0 + je @SkipColor // if AL=0 then skip everything + mov esp, eax // ESP - source color + mov bl, [edi] // BL := destination color + mov dl, bl // DL := destination color + and al, $03 // Subtract BLUE + and bl, $03 + sub bl, al + jns @Skip1 + mov bl, 0 + @Skip1: + mov cl, bl + mov eax, esp // Subtract GREEN + mov bl, dl + and al, $1c + and bl, $1c + sub bl, al + jns @Skip2 + mov bl, 0 + @Skip2: + or cl, bl + mov eax, esp // Subtract RED + mov bl, dl + and ax, $e0 + and bx, $e0 + sub bx, ax + jns @Skip3 + mov bl, 0 + @Skip3: + or cl, bl + mov [edi], cl + @SkipColor: + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 15 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov ax, [esi] // AX := source color + cmp ax, 0 + je @SkipColor // if AX=0 then skip everything + mov esp, eax // ESP - source color + mov bx, [edi] // BX := destination color + mov dx, bx // DX := destination color + and ax, $001F // Subtract BLUE + and bx, $001F + sub bx, ax + jns @Skip1 + mov bx, 0 + @Skip1: + mov cx, bx + mov eax, esp // Subtract GREEN + mov bx, dx + and ax, $3E0 + and bx, $3E0 + sub bx, ax + jns @Skip2 + mov bx, 0 + @Skip2: + or cx, bx + mov eax, esp // Subtract RED + mov bx, dx + and ax, $7C00 + and bx, $7C00 + sub bx, ax + jns @Skip3 + mov bx, 0 + @Skip3: + or cx, bx + mov [edi], cx + @SkipColor: + add esi, 2 + add edi, 2 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 16 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov ax, [esi] // AX := source color + cmp ax, 0 + je @SkipColor // if AX=0 then skip everything + mov esp, eax // ESP - source color + mov bx, [edi] // BX := destination color + mov dx, bx // DX := destination color + and ax, $1F // Subtracting BLUE + and bx, $1F + sub bx, ax + jns @Skip1 + mov bx, 0 + @Skip1: + mov cx, bx + mov eax, esp // Adding GREEN + mov bx, dx + and ax, $7E0 + and bx, $7E0 + sub bx, ax + jns @Skip2 + mov bx, 0 + @Skip2: + or cx, bx + mov eax, esp // Adding RED + mov bx, dx + and eax, $F800 + and ebx, $F800 + sub ebx, eax + jns @Skip3 + mov bx, 0 + @Skip3: + or cx, bx + mov [edi], cx + @SkipColor: + add esi, 2 + add edi, 2 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 24 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + add WorkX, ax // WorkX := Src.w * 2 + add WorkX, ax // WorkX := Src.w * 3 + @Loopx: + mov bl, [edi] // BX := destination color + mov al, [esi] // AX := source color + cmp al, 0 + je @Skip // if AL=0 then skip COMPONENT + mov ah, 0 // AX := COLOR COMPONENT + mov bh, 0 + sub bx, ax + jns @Skip + mov bl, 0 + @Skip: + mov [edi], bl + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 32 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + shl ax, 2 + mov WorkX, ax // WorkX := Src.w * 4 + @Loopx: + mov bl, [edi] // BX := destination color + mov al, [esi] // AX := source color + cmp al, 0 + je @Skip // if AL=0 then skip COMPONENT + mov ah, 0 // AX := COLOR COMPONENT + mov bh, 0 + sub bx, ax + jns @Skip + mov bl, 0 + @Skip: + mov [edi], bl + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DstSurface ); +end; + +procedure SDL_MonoSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DstSurface : PSDL_Surface; DestRect : PSDL_Rect; Color : cardinal ); +var + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + _ebx, _esi, _edi, _esp : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + SrcTransparentColor : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DstSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DstSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DstSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + SrcTransparentColor := format.colorkey; + end; + with DstSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := DstSurface.Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DstSurface ); + case bits of + 8 : + asm + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + mov ecx, Color + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov al, [esi] // AL := source color + movzx eax, al + cmp eax, SrcTransparentColor + je @SkipColor // if AL=Transparent color then skip everything + mov [edi], cl + @SkipColor: + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + end; + 15, 16 : + asm + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + mov ecx, Color + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov ax, [esi] // AX := source color + movzx eax, ax + cmp eax, SrcTransparentColor + je @SkipColor // if AX=Transparent color then skip everything + mov [edi], cx + @SkipColor: + inc esi + inc esi + inc edi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + end; + 24 : + asm + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov _ebx, ebx + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + mov ecx, Color + and ecx, $00ffffff + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov eax, [esi] // EAX := source color + and eax, $00ffffff + cmp eax, SrcTransparentColor + je @SkipColor // if EAX=Transparent color then skip everything + mov ebx, [edi] + and ebx, $ff000000 + or ebx, ecx + mov [edi], ecx + @SkipColor: + add esi, 3 + add edi, 3 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp, _esp + mov edi, _edi + mov esi, _esi + mov ebx, _ebx + end; + 32 : + asm + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + mov ecx, Color + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov eax, [esi] // EAX := source color + cmp eax, SrcTransparentColor + je @SkipColor // if EAX=Transparent color then skip everything + mov [edi], ecx + @SkipColor: + add esi, 4 + add edi, 4 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp, _esp + mov edi, _edi + mov esi, _esi + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DstSurface ); +end; +// TextureRect.w and TextureRect.h are not used. +// The TextureSurface's size MUST larger than the drawing rectangle!!! + +procedure SDL_TexturedSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DstSurface : PSDL_Surface; DestRect : PSDL_Rect; Texture : PSDL_Surface; + TextureRect : PSDL_Rect ); +var + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr, TextAddr : cardinal; + _ebx, _esi, _edi, _esp : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod, TextMod : cardinal; + SrcTransparentColor : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DstSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DstSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DstSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + SrcTransparentColor := format.colorkey; + end; + with DstSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := DstSurface.Format.BitsPerPixel; + end; + with Texture^ do + begin + TextAddr := cardinal( Pixels ) + UInt32( TextureRect.y ) * Pitch + + UInt32( TextureRect.x ) * Format.BytesPerPixel; + TextMod := Pitch - Src.w * Format.BytesPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DstSurface ); + SDL_LockSurface( Texture ); + case bits of + 8 : + asm + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov _ebx, ebx + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ebx, TextAddr + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov al, [esi] // AL := source color + movzx eax, al + cmp eax, SrcTransparentColor + je @SkipColor // if AL=Transparent color then skip everything + mov al, [ebx] + mov [edi], al + @SkipColor: + inc esi + inc edi + inc ebx + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + add ebx, TextMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx, _ebx + end; + 15, 16 : + asm + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ecx, TextAddr + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov ax, [esi] // AL := source color + movzx eax, ax + cmp eax, SrcTransparentColor + je @SkipColor // if AL=Transparent color then skip everything + mov ax, [ecx] + mov [edi], ax + @SkipColor: + inc esi + inc esi + inc edi + inc edi + inc ecx + inc ecx + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + add ecx, TextMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + end; + 24 : + asm + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov _ebx, ebx + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ebx, TextAddr + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov eax, [esi] // AL := source color + and eax, $00ffffff + cmp eax, SrcTransparentColor + je @SkipColor // if AL=Transparent color then skip everything + mov eax, [ebx] + and eax, $00ffffff + mov ecx, [edi] + and ecx, $ff000000 + or ecx, eax + mov [edi], eax + @SkipColor: + add esi, 3 + add edi, 3 + add ebx, 3 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + add ebx, TextMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx, _ebx + end; + 32 : + asm + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ecx, TextAddr + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov eax, [esi] // AL := source color + cmp eax, SrcTransparentColor + je @SkipColor // if AL=Transparent color then skip everything + mov eax, [ecx] + mov [edi], eax + @SkipColor: + add esi, 4 + add edi, 4 + add ecx, 4 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + add ecx, TextMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DstSurface ); + SDL_UnlockSurface( Texture ); +end; + +procedure SDL_ZoomSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; DstRect : PSDL_Rect ); +var + xc, yc : cardinal; + rx, wx, ry, wy, ry16 : cardinal; + color : cardinal; + modx, mody : cardinal; +begin + // Warning! No checks for surface pointers!!! + if srcrect = nil then + srcrect := @SrcSurface.clip_rect; + if dstrect = nil then + dstrect := @DstSurface.clip_rect; + if SDL_MustLock( SrcSurface ) then + SDL_LockSurface( SrcSurface ); + if SDL_MustLock( DstSurface ) then + SDL_LockSurface( DstSurface ); + modx := trunc( ( srcrect.w / dstrect.w ) * 65536 ); + mody := trunc( ( srcrect.h / dstrect.h ) * 65536 ); + //rx := srcrect.x * 65536; + ry := srcrect.y * 65536; + wy := dstrect.y; + for yc := 0 to dstrect.h - 1 do + begin + rx := srcrect.x * 65536; + wx := dstrect.x; + ry16 := ry shr 16; + for xc := 0 to dstrect.w - 1 do + begin + color := SDL_GetPixel( SrcSurface, rx shr 16, ry16 ); + SDL_PutPixel( DstSurface, wx, wy, color ); + rx := rx + modx; + inc( wx ); + end; + ry := ry + mody; + inc( wy ); + end; + if SDL_MustLock( SrcSurface ) then + SDL_UnlockSurface( SrcSurface ); + if SDL_MustLock( DstSurface ) then + SDL_UnlockSurface( DstSurface ); +end; +// Re-map a rectangular area into an area defined by four vertices +// Converted from C to Pascal by KiCHY + +procedure SDL_WarpSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; UL, UR, LR, LL : PPoint ); +const + SHIFTS = 15; // Extend ints to limit round-off error (try 2 - 20) + THRESH = 1 shl SHIFTS; // Threshold for pixel size value + procedure CopySourceToDest( UL, UR, LR, LL : TPoint; x1, y1, x2, y2 : cardinal ); + var + tm, lm, rm, bm, m : TPoint; + mx, my : cardinal; + cr : cardinal; + begin + // Does the destination area specify a single pixel? + if ( ( abs( ul.x - ur.x ) < THRESH ) and + ( abs( ul.x - lr.x ) < THRESH ) and + ( abs( ul.x - ll.x ) < THRESH ) and + ( abs( ul.y - ur.y ) < THRESH ) and + ( abs( ul.y - lr.y ) < THRESH ) and + ( abs( ul.y - ll.y ) < THRESH ) ) then + begin // Yes + cr := SDL_GetPixel( SrcSurface, ( x1 shr SHIFTS ), ( y1 shr SHIFTS ) ); + SDL_PutPixel( DstSurface, ( ul.x shr SHIFTS ), ( ul.y shr SHIFTS ), cr ); + end + else + begin // No + // Quarter the source and the destination, and then recurse + tm.x := ( ul.x + ur.x ) shr 1; + tm.y := ( ul.y + ur.y ) shr 1; + bm.x := ( ll.x + lr.x ) shr 1; + bm.y := ( ll.y + lr.y ) shr 1; + lm.x := ( ul.x + ll.x ) shr 1; + lm.y := ( ul.y + ll.y ) shr 1; + rm.x := ( ur.x + lr.x ) shr 1; + rm.y := ( ur.y + lr.y ) shr 1; + m.x := ( tm.x + bm.x ) shr 1; + m.y := ( tm.y + bm.y ) shr 1; + mx := ( x1 + x2 ) shr 1; + my := ( y1 + y2 ) shr 1; + CopySourceToDest( ul, tm, m, lm, x1, y1, mx, my ); + CopySourceToDest( tm, ur, rm, m, mx, y1, x2, my ); + CopySourceToDest( m, rm, lr, bm, mx, my, x2, y2 ); + CopySourceToDest( lm, m, bm, ll, x1, my, mx, y2 ); + end; + end; +var + _UL, _UR, _LR, _LL : TPoint; + Rect_x, Rect_y, Rect_w, Rect_h : integer; +begin + if SDL_MustLock( SrcSurface ) then + SDL_LockSurface( SrcSurface ); + if SDL_MustLock( DstSurface ) then + SDL_LockSurface( DstSurface ); + if SrcRect = nil then + begin + Rect_x := 0; + Rect_y := 0; + Rect_w := ( SrcSurface.w - 1 ) shl SHIFTS; + Rect_h := ( SrcSurface.h - 1 ) shl SHIFTS; + end + else + begin + Rect_x := SrcRect.x; + Rect_y := SrcRect.y; + Rect_w := ( SrcRect.w - 1 ) shl SHIFTS; + Rect_h := ( SrcRect.h - 1 ) shl SHIFTS; + end; + // Shift all values to help reduce round-off error. + _ul.x := ul.x shl SHIFTS; + _ul.y := ul.y shl SHIFTS; + _ur.x := ur.x shl SHIFTS; + _ur.y := ur.y shl SHIFTS; + _lr.x := lr.x shl SHIFTS; + _lr.y := lr.y shl SHIFTS; + _ll.x := ll.x shl SHIFTS; + _ll.y := ll.y shl SHIFTS; + CopySourceToDest( _ul, _ur, _lr, _ll, Rect_x, Rect_y, Rect_w, Rect_h ); + if SDL_MustLock( SrcSurface ) then + SDL_UnlockSurface( SrcSurface ); + if SDL_MustLock( DstSurface ) then + SDL_UnlockSurface( DstSurface ); +end; + +// flips a rectangle vertically on given surface +procedure SDL_FlipRectV( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); +var + TmpRect : TSDL_Rect; + Locked : boolean; + y, FlipLength, RowLength : integer; + Row1, Row2 : Pointer; + OneRow : TByteArray; // Optimize it if you wish +begin + if DstSurface <> nil then + begin + if Rect = nil then + begin // if Rect=nil then we flip the whole surface + TmpRect := SDLRect( 0, 0, DstSurface.w, DstSurface.h ); + Rect := @TmpRect; + end; + FlipLength := Rect^.h shr 1 - 1; + RowLength := Rect^.w * DstSurface^.format.BytesPerPixel; + if SDL_MustLock( DstSurface ) then + begin + Locked := true; + SDL_LockSurface( DstSurface ); + end + else + Locked := false; + Row1 := pointer( cardinal( DstSurface^.Pixels ) + UInt32( Rect^.y ) * + DstSurface^.Pitch ); + Row2 := pointer( cardinal( DstSurface^.Pixels ) + ( UInt32( Rect^.y ) + Rect^.h - 1 ) + * DstSurface^.Pitch ); + for y := 0 to FlipLength do + begin + Move( Row1^, OneRow, RowLength ); + Move( Row2^, Row1^, RowLength ); + Move( OneRow, Row2^, RowLength ); + inc( cardinal( Row1 ), DstSurface^.Pitch ); + dec( cardinal( Row2 ), DstSurface^.Pitch ); + end; + if Locked then + SDL_UnlockSurface( DstSurface ); + end; +end; + +// flips a rectangle horizontally on given surface +procedure SDL_FlipRectH( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); +type + T24bit = packed array[ 0..2 ] of byte; + T24bitArray = packed array[ 0..8191 ] of T24bit; + P24bitArray = ^T24bitArray; + TLongWordArray = array[ 0..8191 ] of LongWord; + PLongWordArray = ^TLongWordArray; +var + TmpRect : TSDL_Rect; + Row8bit : PByteArray; + Row16bit : PWordArray; + Row24bit : P24bitArray; + Row32bit : PLongWordArray; + y, x, RightSide, FlipLength : integer; + Pixel : cardinal; + Pixel24 : T24bit; + Locked : boolean; +begin + if DstSurface <> nil then + begin + if Rect = nil then + begin + TmpRect := SDLRect( 0, 0, DstSurface.w, DstSurface.h ); + Rect := @TmpRect; + end; + FlipLength := Rect^.w shr 1 - 1; + if SDL_MustLock( DstSurface ) then + begin + Locked := true; + SDL_LockSurface( DstSurface ); + end + else + Locked := false; + case DstSurface^.format.BytesPerPixel of + 1 : + begin + Row8Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * + DstSurface^.pitch ); + for y := 1 to Rect^.h do + begin + RightSide := Rect^.w - 1; + for x := 0 to FlipLength do + begin + Pixel := Row8Bit^[ x ]; + Row8Bit^[ x ] := Row8Bit^[ RightSide ]; + Row8Bit^[ RightSide ] := Pixel; + dec( RightSide ); + end; + inc( cardinal( Row8Bit ), DstSurface^.pitch ); + end; + end; + 2 : + begin + Row16Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * + DstSurface^.pitch ); + for y := 1 to Rect^.h do + begin + RightSide := Rect^.w - 1; + for x := 0 to FlipLength do + begin + Pixel := Row16Bit^[ x ]; + Row16Bit^[ x ] := Row16Bit^[ RightSide ]; + Row16Bit^[ RightSide ] := Pixel; + dec( RightSide ); + end; + inc( cardinal( Row16Bit ), DstSurface^.pitch ); + end; + end; + 3 : + begin + Row24Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * + DstSurface^.pitch ); + for y := 1 to Rect^.h do + begin + RightSide := Rect^.w - 1; + for x := 0 to FlipLength do + begin + Pixel24 := Row24Bit^[ x ]; + Row24Bit^[ x ] := Row24Bit^[ RightSide ]; + Row24Bit^[ RightSide ] := Pixel24; + dec( RightSide ); + end; + inc( cardinal( Row24Bit ), DstSurface^.pitch ); + end; + end; + 4 : + begin + Row32Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * + DstSurface^.pitch ); + for y := 1 to Rect^.h do + begin + RightSide := Rect^.w - 1; + for x := 0 to FlipLength do + begin + Pixel := Row32Bit^[ x ]; + Row32Bit^[ x ] := Row32Bit^[ RightSide ]; + Row32Bit^[ RightSide ] := Pixel; + dec( RightSide ); + end; + inc( cardinal( Row32Bit ), DstSurface^.pitch ); + end; + end; + end; + if Locked then + SDL_UnlockSurface( DstSurface ); + end; +end; + +// Use with caution! The procedure allocates memory for TSDL_Rect and return with its pointer. +// But you MUST free it after you don't need it anymore!!! +function PSDLRect( aLeft, aTop, aWidth, aHeight : integer ) : PSDL_Rect; +var + Rect : PSDL_Rect; +begin + New( Rect ); + with Rect^ do + begin + x := aLeft; + y := aTop; + w := aWidth; + h := aHeight; + end; + Result := Rect; +end; + +function SDLRect( aLeft, aTop, aWidth, aHeight : integer ) : TSDL_Rect; +begin + with result do + begin + x := aLeft; + y := aTop; + w := aWidth; + h := aHeight; + end; +end; + +function SDLRect( aRect : TRect ) : TSDL_Rect; +begin + with aRect do + result := SDLRect( Left, Top, Right - Left, Bottom - Top ); +end; + +procedure SDL_Stretch8( Surface, Dst_Surface : PSDL_Surface; x1, x2, y1, y2, yr, yw, + depth : integer ); +var + dx, dy, e, d, dx2 : integer; + src_pitch, dst_pitch : uint16; + src_pixels, dst_pixels : PUint8; +begin + if ( yw >= dst_surface^.h ) then + exit; + dx := ( x2 - x1 ); + dy := ( y2 - y1 ); + dy := dy shl 1; + e := dy - dx; + dx2 := dx shl 1; + src_pitch := Surface^.pitch; + dst_pitch := dst_surface^.pitch; + src_pixels := PUint8( integer( Surface^.pixels ) + yr * src_pitch + y1 * depth ); + dst_pixels := PUint8( integer( dst_surface^.pixels ) + yw * dst_pitch + x1 * + depth ); + for d := 0 to dx - 1 do + begin + move( src_pixels^, dst_pixels^, depth ); + while ( e >= 0 ) do + begin + inc( src_pixels, depth ); + e := e - dx2; + end; + inc( dst_pixels, depth ); + e := e + dy; + end; +end; + +function sign( x : integer ) : integer; +begin + if x > 0 then + result := 1 + else + result := -1; +end; + +// Stretches a part of a surface +function SDL_ScaleSurfaceRect( SrcSurface : PSDL_Surface; SrcX1, SrcY1, SrcW, SrcH, + Width, Height : integer ) : PSDL_Surface; +var + dst_surface : PSDL_Surface; + dx, dy, e, d, dx2, srcx2, srcy2 : integer; + destx1, desty1 : integer; +begin + srcx2 := srcx1 + SrcW; + srcy2 := srcy1 + SrcH; + result := nil; + destx1 := 0; + desty1 := 0; + dx := abs( integer( Height - desty1 ) ); + dy := abs( integer( SrcY2 - SrcY1 ) ); + e := ( dy shl 1 ) - dx; + dx2 := dx shl 1; + dy := dy shl 1; + dst_surface := SDL_CreateRGBSurface( SDL_HWPALETTE, width - destx1, Height - + desty1, + SrcSurface^.Format^.BitsPerPixel, + SrcSurface^.Format^.RMask, + SrcSurface^.Format^.GMask, + SrcSurface^.Format^.BMask, + SrcSurface^.Format^.AMask ); + if ( dst_surface^.format^.BytesPerPixel = 1 ) then + SDL_SetColors( dst_surface, @SrcSurface^.format^.palette^.colors^[ 0 ], 0, 256 ); + SDL_SetColorKey( dst_surface, sdl_srccolorkey, SrcSurface^.format^.colorkey ); + if ( SDL_MustLock( dst_surface ) ) then + if ( SDL_LockSurface( dst_surface ) < 0 ) then + exit; + for d := 0 to dx - 1 do + begin + SDL_Stretch8( SrcSurface, dst_surface, destx1, Width, SrcX1, SrcX2, SrcY1, desty1, + SrcSurface^.format^.BytesPerPixel ); + while e >= 0 do + begin + inc( SrcY1 ); + e := e - dx2; + end; + inc( desty1 ); + e := e + dy; + end; + if SDL_MUSTLOCK( dst_surface ) then + SDL_UnlockSurface( dst_surface ); + result := dst_surface; +end; + +procedure SDL_ScrollY( DstSurface : PSDL_Surface; DifY : integer ); +var + r1, r2 : TSDL_Rect; + //buffer: PSDL_Surface; + YPos : Integer; +begin + if ( DstSurface <> nil ) and ( DifY <> 0 ) then + begin + //if DifY > 0 then // going up + //begin + ypos := 0; + r1.x := 0; + r2.x := 0; + r1.w := DstSurface.w; + r2.w := DstSurface.w; + r1.h := DifY; + r2.h := DifY; + while ypos < DstSurface.h do + begin + r1.y := ypos; + r2.y := ypos + DifY; + SDL_BlitSurface( DstSurface, @r2, DstSurface, @r1 ); + ypos := ypos + DifY; + end; + //end + //else + //begin // Going Down + //end; + end; +end; + +procedure SDL_ScrollX( DstSurface : PSDL_Surface; DifX : integer ); +var + r1, r2 : TSDL_Rect; + buffer : PSDL_Surface; +begin + if ( DstSurface <> nil ) and ( DifX <> 0 ) then + begin + buffer := SDL_CreateRGBSurface( SDL_HWSURFACE, ( DstSurface^.w - DifX ) * 2, + DstSurface^.h * 2, + DstSurface^.Format^.BitsPerPixel, + DstSurface^.Format^.RMask, + DstSurface^.Format^.GMask, + DstSurface^.Format^.BMask, + DstSurface^.Format^.AMask ); + if buffer <> nil then + begin + if ( buffer^.format^.BytesPerPixel = 1 ) then + SDL_SetColors( buffer, @DstSurface^.format^.palette^.colors^[ 0 ], 0, 256 ); + r1 := SDLRect( DifX, 0, buffer^.w, buffer^.h ); + r2 := SDLRect( 0, 0, buffer^.w, buffer^.h ); + SDL_BlitSurface( DstSurface, @r1, buffer, @r2 ); + SDL_BlitSurface( buffer, @r2, DstSurface, @r2 ); + SDL_FreeSurface( buffer ); + end; + end; +end; + +procedure SDL_RotateRad( DstSurface, SrcSurface : PSDL_Surface; SrcRect : + PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Single ); +var + aSin, aCos : Single; + MX, MY, DX, DY, NX, NY, SX, SY, OX, OY, Width, Height, TX, TY, RX, RY, ROX, ROY : Integer; + Colour, TempTransparentColour : UInt32; + MAXX, MAXY : Integer; +begin + // Rotate the surface to the target surface. + TempTransparentColour := SrcSurface.format.colorkey; + if srcRect.w > srcRect.h then + begin + Width := srcRect.w; + Height := srcRect.w; + end + else + begin + Width := srcRect.h; + Height := srcRect.h; + end; + + maxx := DstSurface.w; + maxy := DstSurface.h; + aCos := cos( Angle ); + aSin := sin( Angle ); + + Width := round( abs( srcrect.h * acos ) + abs( srcrect.w * asin ) ); + Height := round( abs( srcrect.h * asin ) + abs( srcrect.w * acos ) ); + + OX := Width div 2; + OY := Height div 2; ; + MX := ( srcRect.x + ( srcRect.x + srcRect.w ) ) div 2; + MY := ( srcRect.y + ( srcRect.y + srcRect.h ) ) div 2; + ROX := ( -( srcRect.w div 2 ) ) + Offsetx; + ROY := ( -( srcRect.h div 2 ) ) + OffsetY; + Tx := ox + round( ROX * aSin - ROY * aCos ); + Ty := oy + round( ROY * aSin + ROX * aCos ); + SX := 0; + for DX := DestX - TX to DestX - TX + ( width ) do + begin + Inc( SX ); + SY := 0; + for DY := DestY - TY to DestY - TY + ( Height ) do + begin + RX := SX - OX; + RY := SY - OY; + NX := round( mx + RX * aSin + RY * aCos ); // + NY := round( my + RY * aSin - RX * aCos ); // + // Used for testing only + //SDL_PutPixel(DstSurface.SDLSurfacePointer,DX,DY,0); + if ( ( DX > 0 ) and ( DX < MAXX ) ) and ( ( DY > 0 ) and ( DY < MAXY ) ) then + begin + if ( NX >= srcRect.x ) and ( NX <= srcRect.x + srcRect.w ) then + begin + if ( NY >= srcRect.y ) and ( NY <= srcRect.y + srcRect.h ) then + begin + Colour := SDL_GetPixel( SrcSurface, NX, NY ); + if Colour <> TempTransparentColour then + begin + SDL_PutPixel( DstSurface, DX, DY, Colour ); + end; + end; + end; + end; + inc( SY ); + end; + end; +end; + +procedure SDL_RotateDeg( DstSurface, SrcSurface : PSDL_Surface; SrcRect : + PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Integer ); +begin + SDL_RotateRad( DstSurface, SrcSurface, SrcRect, DestX, DestY, OffsetX, OffsetY, DegToRad( Angle ) ); +end; + +function ValidateSurfaceRect( DstSurface : PSDL_Surface; dstrect : PSDL_Rect ) : TSDL_Rect; +var + RealRect : TSDL_Rect; + OutOfRange : Boolean; +begin + OutOfRange := false; + if dstrect = nil then + begin + RealRect.x := 0; + RealRect.y := 0; + RealRect.w := DstSurface.w; + RealRect.h := DstSurface.h; + end + else + begin + if dstrect.x < DstSurface.w then + begin + RealRect.x := dstrect.x; + end + else if dstrect.x < 0 then + begin + realrect.x := 0; + end + else + begin + OutOfRange := True; + end; + if dstrect.y < DstSurface.h then + begin + RealRect.y := dstrect.y; + end + else if dstrect.y < 0 then + begin + realrect.y := 0; + end + else + begin + OutOfRange := True; + end; + if OutOfRange = False then + begin + if realrect.x + dstrect.w <= DstSurface.w then + begin + RealRect.w := dstrect.w; + end + else + begin + RealRect.w := dstrect.w - realrect.x; + end; + if realrect.y + dstrect.h <= DstSurface.h then + begin + RealRect.h := dstrect.h; + end + else + begin + RealRect.h := dstrect.h - realrect.y; + end; + end; + end; + if OutOfRange = False then + begin + result := realrect; + end + else + begin + realrect.w := 0; + realrect.h := 0; + realrect.x := 0; + realrect.y := 0; + result := realrect; + end; +end; + +procedure SDL_FillRectAdd( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); +var + RealRect : TSDL_Rect; + Addr : pointer; + ModX, BPP : cardinal; + x, y, R, G, B, SrcColor : cardinal; +begin + RealRect := ValidateSurfaceRect( DstSurface, DstRect ); + if ( RealRect.w > 0 ) and ( RealRect.h > 0 ) then + begin + SDL_LockSurface( DstSurface ); + BPP := DstSurface.format.BytesPerPixel; + with DstSurface^ do + begin + Addr := pointer( UInt32( pixels ) + UInt32( RealRect.y ) * pitch + UInt32( RealRect.x ) * BPP ); + ModX := Pitch - UInt32( RealRect.w ) * BPP; + end; + case DstSurface.format.BitsPerPixel of + 8 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $E0 + Color and $E0; + G := SrcColor and $1C + Color and $1C; + B := SrcColor and $03 + Color and $03; + if R > $E0 then + R := $E0; + if G > $1C then + G := $1C; + if B > $03 then + B := $03; + PUInt8( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 15 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $7C00 + Color and $7C00; + G := SrcColor and $03E0 + Color and $03E0; + B := SrcColor and $001F + Color and $001F; + if R > $7C00 then + R := $7C00; + if G > $03E0 then + G := $03E0; + if B > $001F then + B := $001F; + PUInt16( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 16 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $F800 + Color and $F800; + G := SrcColor and $07C0 + Color and $07C0; + B := SrcColor and $001F + Color and $001F; + if R > $F800 then + R := $F800; + if G > $07C0 then + G := $07C0; + if B > $001F then + B := $001F; + PUInt16( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 24 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $00FF0000 + Color and $00FF0000; + G := SrcColor and $0000FF00 + Color and $0000FF00; + B := SrcColor and $000000FF + Color and $000000FF; + if R > $FF0000 then + R := $FF0000; + if G > $00FF00 then + G := $00FF00; + if B > $0000FF then + B := $0000FF; + PUInt32( Addr )^ := SrcColor and $FF000000 or R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 32 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $00FF0000 + Color and $00FF0000; + G := SrcColor and $0000FF00 + Color and $0000FF00; + B := SrcColor and $000000FF + Color and $000000FF; + if R > $FF0000 then + R := $FF0000; + if G > $00FF00 then + G := $00FF00; + if B > $0000FF then + B := $0000FF; + PUInt32( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + end; + SDL_UnlockSurface( DstSurface ); + end; +end; + +procedure SDL_FillRectSub( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); +var + RealRect : TSDL_Rect; + Addr : pointer; + ModX, BPP : cardinal; + x, y, R, G, B, SrcColor : cardinal; +begin + RealRect := ValidateSurfaceRect( DstSurface, DstRect ); + if ( RealRect.w > 0 ) and ( RealRect.h > 0 ) then + begin + SDL_LockSurface( DstSurface ); + BPP := DstSurface.format.BytesPerPixel; + with DstSurface^ do + begin + Addr := pointer( UInt32( pixels ) + UInt32( RealRect.y ) * pitch + UInt32( RealRect.x ) * BPP ); + ModX := Pitch - UInt32( RealRect.w ) * BPP; + end; + case DstSurface.format.BitsPerPixel of + 8 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $E0 - Color and $E0; + G := SrcColor and $1C - Color and $1C; + B := SrcColor and $03 - Color and $03; + if R > $E0 then + R := 0; + if G > $1C then + G := 0; + if B > $03 then + B := 0; + PUInt8( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 15 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $7C00 - Color and $7C00; + G := SrcColor and $03E0 - Color and $03E0; + B := SrcColor and $001F - Color and $001F; + if R > $7C00 then + R := 0; + if G > $03E0 then + G := 0; + if B > $001F then + B := 0; + PUInt16( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 16 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $F800 - Color and $F800; + G := SrcColor and $07C0 - Color and $07C0; + B := SrcColor and $001F - Color and $001F; + if R > $F800 then + R := 0; + if G > $07C0 then + G := 0; + if B > $001F then + B := 0; + PUInt16( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 24 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $00FF0000 - Color and $00FF0000; + G := SrcColor and $0000FF00 - Color and $0000FF00; + B := SrcColor and $000000FF - Color and $000000FF; + if R > $FF0000 then + R := 0; + if G > $00FF00 then + G := 0; + if B > $0000FF then + B := 0; + PUInt32( Addr )^ := SrcColor and $FF000000 or R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 32 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $00FF0000 - Color and $00FF0000; + G := SrcColor and $0000FF00 - Color and $0000FF00; + B := SrcColor and $000000FF - Color and $000000FF; + if R > $FF0000 then + R := 0; + if G > $00FF00 then + G := 0; + if B > $0000FF then + B := 0; + PUInt32( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + end; + SDL_UnlockSurface( DstSurface ); + end; +end; + +procedure SDL_GradientFillRect( DstSurface : PSDL_Surface; const Rect : PSDL_Rect; const StartColor, EndColor : TSDL_Color; const Style : TGradientStyle ); +var + FBC : array[ 0..255 ] of Cardinal; + // temp vars + i, YR, YG, YB, SR, SG, SB, DR, DG, DB : Integer; + + TempStepV, TempStepH : Single; + TempLeft, TempTop, TempHeight, TempWidth : integer; + TempRect : TSDL_Rect; + +begin + // calc FBC + YR := StartColor.r; + YG := StartColor.g; + YB := StartColor.b; + SR := YR; + SG := YG; + SB := YB; + DR := EndColor.r - SR; + DG := EndColor.g - SG; + DB := EndColor.b - SB; + + for i := 0 to 255 do + begin + FBC[ i ] := SDL_MapRGB( DstSurface.format, YR, YG, YB ); + YR := SR + round( DR / 255 * i ); + YG := SG + round( DG / 255 * i ); + YB := SB + round( DB / 255 * i ); + end; + + // if aStyle = 1 then begin + TempStepH := Rect.w / 255; + TempStepV := Rect.h / 255; + TempHeight := Trunc( TempStepV + 1 ); + TempWidth := Trunc( TempStepH + 1 ); + TempTop := 0; + TempLeft := 0; + TempRect.x := Rect.x; + TempRect.y := Rect.y; + TempRect.h := Rect.h; + TempRect.w := Rect.w; + + case Style of + gsHorizontal : + begin + TempRect.h := TempHeight; + for i := 0 to 255 do + begin + TempRect.y := Rect.y + TempTop; + SDL_FillRect( DstSurface, @TempRect, FBC[ i ] ); + TempTop := Trunc( TempStepV * i ); + end; + end; + gsVertical : + begin + TempRect.w := TempWidth; + for i := 0 to 255 do + begin + TempRect.x := Rect.x + TempLeft; + SDL_FillRect( DstSurface, @TempRect, FBC[ i ] ); + TempLeft := Trunc( TempStepH * i ); + end; + end; + end; +end; + +procedure SDL_2xBlit( Src, Dest : PSDL_Surface ); +var + ReadAddr, WriteAddr, ReadRow, WriteRow : UInt32; + SrcPitch, DestPitch, x, y, w, h : UInt32; +begin + if ( Src = nil ) or ( Dest = nil ) then + exit; + if ( Src.w shl 1 ) < Dest.w then + exit; + if ( Src.h shl 1 ) < Dest.h then + exit; + + if SDL_MustLock( Src ) then + SDL_LockSurface( Src ); + if SDL_MustLock( Dest ) then + SDL_LockSurface( Dest ); + + ReadRow := UInt32( Src.Pixels ); + WriteRow := UInt32( Dest.Pixels ); + + SrcPitch := Src.pitch; + DestPitch := Dest.pitch; + + w := Src.w; + h := Src.h; + + case Src.format.BytesPerPixel of + 1 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + mov ebx, DestPitch + + @LoopX: + mov al, [ecx] // PUInt8(WriteAddr)^ := PUInt8(ReadAddr)^; + mov [edx], al + mov [edx + 1], al // PUInt8(WriteAddr + 1)^ := PUInt8(ReadAddr)^; + mov [edx + ebx], al // PUInt8(WriteAddr + DestPitch)^ := PUInt8(ReadAddr)^; + mov [edx + ebx + 1], al // PUInt8(WriteAddr + DestPitch + 1)^ := PUInt8(ReadAddr)^; + + inc ecx // inc(ReadAddr); + add edx, 2 // inc(WriteAddr, 2); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + 2 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + mov ebx, DestPitch + + @LoopX: + mov ax, [ecx] // PUInt16(WriteAddr)^ := PUInt16(ReadAddr)^; + mov [edx], ax + mov [edx + 2], ax // PUInt16(WriteAddr + 2)^ := PUInt16(ReadAddr)^; + mov [edx + ebx], ax // PUInt16(WriteAddr + DestPitch)^ := PUInt16(ReadAddr)^; + mov [edx + ebx + 2], ax // PUInt16(WriteAddr + DestPitch + 2)^ := PUInt16(ReadAddr)^; + + add ecx, 2 // inc(ReadAddr, 2); + add edx, 4 // inc(WriteAddr, 4); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + 3 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + mov ebx, DestPitch + + @LoopX: + mov eax, [ecx] // (PUInt32(WriteAddr)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + and eax, $00ffffff + and dword ptr [edx], $ff000000 + or [edx], eax + and dword ptr [edx + 3], $00ffffff // (PUInt32(WriteAddr + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + or [edx + 3], eax + and dword ptr [edx + ebx], $00ffffff // (PUInt32(WriteAddr + DestPitch)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + or [edx + ebx], eax + and dword ptr [edx + ebx + 3], $00ffffff // (PUInt32(WriteAddr + DestPitch + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + or [edx + ebx + 3], eax + + add ecx, 3 // inc(ReadAddr, 3); + add edx, 6 // inc(WriteAddr, 6); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + 4 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + mov ebx, DestPitch + + @LoopX: + mov eax, [ecx] // PUInt32(WriteAddr)^ := PUInt32(ReadAddr)^; + mov [edx], eax + mov [edx + 4], eax // PUInt32(WriteAddr + 4)^ := PUInt32(ReadAddr)^; + mov [edx + ebx], eax // PUInt32(WriteAddr + DestPitch)^ := PUInt32(ReadAddr)^; + mov [edx + ebx + 4], eax // PUInt32(WriteAddr + DestPitch + 4)^ := PUInt32(ReadAddr)^; + + add ecx, 4 // inc(ReadAddr, 4); + add edx, 8 // inc(WriteAddr, 8); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + end; + + if SDL_MustLock( Src ) then + SDL_UnlockSurface( Src ); + if SDL_MustLock( Dest ) then + SDL_UnlockSurface( Dest ); +end; + +procedure SDL_Scanline2xBlit( Src, Dest : PSDL_Surface ); +var + ReadAddr, WriteAddr, ReadRow, WriteRow : UInt32; + SrcPitch, DestPitch, x, y, w, h : UInt32; +begin + if ( Src = nil ) or ( Dest = nil ) then + exit; + if ( Src.w shl 1 ) < Dest.w then + exit; + if ( Src.h shl 1 ) < Dest.h then + exit; + + if SDL_MustLock( Src ) then + SDL_LockSurface( Src ); + if SDL_MustLock( Dest ) then + SDL_LockSurface( Dest ); + + ReadRow := UInt32( Src.Pixels ); + WriteRow := UInt32( Dest.Pixels ); + + SrcPitch := Src.pitch; + DestPitch := Dest.pitch; + + w := Src.w; + h := Src.h; + + case Src.format.BytesPerPixel of + 1 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + + @LoopX: + mov al, [ecx] // PUInt8(WriteAddr)^ := PUInt8(ReadAddr)^; + mov [edx], al + mov [edx + 1], al // PUInt8(WriteAddr + 1)^ := PUInt8(ReadAddr)^; + + inc ecx // inc(ReadAddr); + add edx, 2 // inc(WriteAddr, 2); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + 2 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + + @LoopX: + mov ax, [ecx] // PUInt16(WriteAddr)^ := PUInt16(ReadAddr)^; + mov [edx], ax + mov [edx + 2], eax // PUInt16(WriteAddr + 2)^ := PUInt16(ReadAddr)^; + + add ecx, 2 // inc(ReadAddr, 2); + add edx, 4 // inc(WriteAddr, 4); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + 3 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + + @LoopX: + mov eax, [ecx] // (PUInt32(WriteAddr)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + and eax, $00ffffff + and dword ptr [edx], $ff000000 + or [edx], eax + and dword ptr [edx + 3], $00ffffff // (PUInt32(WriteAddr + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + or [edx + 3], eax + + add ecx, 3 // inc(ReadAddr, 3); + add edx, 6 // inc(WriteAddr, 6); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + 4 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + + @LoopX: + mov eax, [ecx] // PUInt32(WriteAddr)^ := PUInt32(ReadAddr)^; + mov [edx], eax + mov [edx + 4], eax // PUInt32(WriteAddr + 4)^ := PUInt32(ReadAddr)^; + + add ecx, 4 // inc(ReadAddr, 4); + add edx, 8 // inc(WriteAddr, 8); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + end; + + if SDL_MustLock( Src ) then + SDL_UnlockSurface( Src ); + if SDL_MustLock( Dest ) then + SDL_UnlockSurface( Dest ); +end; + +procedure SDL_50Scanline2xBlit( Src, Dest : PSDL_Surface ); +var + ReadAddr, WriteAddr, ReadRow, WriteRow : UInt32; + SrcPitch, DestPitch, x, y, w, h : UInt32; +begin + if ( Src = nil ) or ( Dest = nil ) then + exit; + if ( Src.w shl 1 ) < Dest.w then + exit; + if ( Src.h shl 1 ) < Dest.h then + exit; + + if SDL_MustLock( Src ) then + SDL_LockSurface( Src ); + if SDL_MustLock( Dest ) then + SDL_LockSurface( Dest ); + + ReadRow := UInt32( Src.Pixels ); + WriteRow := UInt32( Dest.Pixels ); + + SrcPitch := Src.pitch; + DestPitch := Dest.pitch; + + w := Src.w; + h := Src.h; + + case Src.format.BitsPerPixel of + 8 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + mov ebx, DestPitch + + @LoopX: + mov al, [ecx] // PUInt8(WriteAddr)^ := PUInt8(ReadAddr)^; + mov [edx], al + mov [edx + 1], al // PUInt8(WriteAddr + 1)^ := PUInt8(ReadAddr)^; + shr al, 1 + and al, $6d + mov [edx + ebx], al // PUInt8(WriteAddr + DestPitch)^ := PUInt8(ReadAddr)^; + mov [edx + ebx + 1], al // PUInt8(WriteAddr + DestPitch + 1)^ := PUInt8(ReadAddr)^; + + inc ecx // inc(ReadAddr); + add edx, 2 // inc(WriteAddr, 2); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + 15 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + mov ebx, DestPitch + + @LoopX: + mov ax, [ecx] // PUInt16(WriteAddr)^ := PUInt16(ReadAddr)^; + mov [edx], ax + mov [edx + 2], ax // PUInt16(WriteAddr + 2)^ := PUInt16(ReadAddr)^; + shr ax, 1 + and ax, $3def + mov [edx + ebx], ax // PUInt16(WriteAddr + DestPitch)^ := PUInt16(ReadAddr)^; + mov [edx + ebx + 2], ax // PUInt16(WriteAddr + DestPitch + 2)^ := PUInt16(ReadAddr)^; + + add ecx, 2 // inc(ReadAddr, 2); + add edx, 4 // inc(WriteAddr, 4); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + 16 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + mov ebx, DestPitch + + @LoopX: + mov ax, [ecx] // PUInt16(WriteAddr)^ := PUInt16(ReadAddr)^; + mov [edx], ax + mov [edx + 2], ax // PUInt16(WriteAddr + 2)^ := PUInt16(ReadAddr)^; + shr ax, 1 + and ax, $7bef + mov [edx + ebx], ax // PUInt16(WriteAddr + DestPitch)^ := PUInt16(ReadAddr)^; + mov [edx + ebx + 2], ax // PUInt16(WriteAddr + DestPitch + 2)^ := PUInt16(ReadAddr)^; + + add ecx, 2 // inc(ReadAddr, 2); + add edx, 4 // inc(WriteAddr, 4); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + 24 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + mov ebx, DestPitch + + @LoopX: + mov eax, [ecx] // (PUInt32(WriteAddr)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + and eax, $00ffffff + and dword ptr [edx], $ff000000 + or [edx], eax + and dword ptr [edx + 3], $00ffffff // (PUInt32(WriteAddr + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + or [edx + 3], eax + shr eax, 1 + and eax, $007f7f7f + and dword ptr [edx + ebx], $00ffffff // (PUInt32(WriteAddr + DestPitch)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + or [edx + ebx], eax + and dword ptr [edx + ebx + 3], $00ffffff // (PUInt32(WriteAddr + DestPitch + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + or [edx + ebx + 3], eax + + add ecx, 3 // inc(ReadAddr, 3); + add edx, 6 // inc(WriteAddr, 6); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + 32 : + asm + push ebx + mov eax, h // for y := 1 to Src.h do + mov y, eax + @LoopY: + mov eax, ReadRow // ReadAddr := ReadRow; + mov ReadAddr, eax + + mov eax, WriteRow // WriteAddr := WriteRow; + mov WriteAddr, eax + + mov eax, w // for x := 1 to Src.w do + mov x, eax + + mov ecx, ReadAddr + mov edx, WriteAddr + mov ebx, DestPitch + + @LoopX: + mov eax, [ecx] // PUInt32(WriteAddr)^ := PUInt32(ReadAddr)^; + mov [edx], eax + mov [edx + 4], eax // PUInt32(WriteAddr + 4)^ := PUInt32(ReadAddr)^; + shr eax, 1 + and eax, $7f7f7f7f + mov [edx + ebx], eax // PUInt32(WriteAddr + DestPitch)^ := PUInt32(ReadAddr)^; + mov [edx + ebx + 4], eax // PUInt32(WriteAddr + DestPitch + 4)^ := PUInt32(ReadAddr)^; + + add ecx, 4 // inc(ReadAddr, 4); + add edx, 8 // inc(WriteAddr, 8); + + dec x + jnz @LoopX + + mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); + add ReadRow, eax + + mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); + add WriteRow, eax + add WriteRow, eax + + dec y + jnz @LoopY + pop ebx + end; + end; + + if SDL_MustLock( Src ) then + SDL_UnlockSurface( Src ); + if SDL_MustLock( Dest ) then + SDL_UnlockSurface( Dest ); +end; + +function SDL_PixelTestSurfaceVsRect( SrcSurface1 : PSDL_Surface; SrcRect1 : PSDL_Rect; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : +boolean; +var + Src_Rect1, Src_Rect2 : TSDL_Rect; + right1, bottom1 : integer; + right2, bottom2 : integer; + Scan1Start, Scan2Start, ScanWidth, ScanHeight : cardinal; + Mod1: cardinal; + Addr1 : cardinal; + BPP : cardinal; + Pitch1 : cardinal; + TransparentColor1 : cardinal; + tx, ty : cardinal; + StartTick : cardinal; + Color1 : cardinal; +begin + Result := false; + if SrcRect1 = nil then + begin + with Src_Rect1 do + begin + x := 0; + y := 0; + w := SrcSurface1.w; + h := SrcSurface1.h; + end; + end + else + Src_Rect1 := SrcRect1^; + + Src_Rect2 := SrcRect2^; + with Src_Rect1 do + begin + Right1 := Left1 + w; + Bottom1 := Top1 + h; + end; + with Src_Rect2 do + begin + Right2 := Left2 + w; + Bottom2 := Top2 + h; + end; + if ( Left1 >= Right2 ) or ( Right1 <= Left2 ) or ( Top1 >= Bottom2 ) or ( +Bottom1 <= + Top2 ) then + exit; + if Left1 <= Left2 then + begin + // 1. left, 2. right + Scan1Start := Src_Rect1.x + Left2 - Left1; + Scan2Start := Src_Rect2.x; + ScanWidth := Right1 - Left2; + with Src_Rect2 do + if ScanWidth > w then + ScanWidth := w; + end + else + begin + // 1. right, 2. left + Scan1Start := Src_Rect1.x; + Scan2Start := Src_Rect2.x + Left1 - Left2; + ScanWidth := Right2 - Left1; + with Src_Rect1 do + if ScanWidth > w then + ScanWidth := w; + end; + with SrcSurface1^ do + begin + Pitch1 := Pitch; + Addr1 := cardinal( Pixels ); + inc( Addr1, Pitch1 * UInt32( Src_Rect1.y ) ); + with format^ do + begin + BPP := BytesPerPixel; + TransparentColor1 := colorkey; + end; + end; + + Mod1 := Pitch1 - ( ScanWidth * BPP ); + + inc( Addr1, BPP * Scan1Start ); + + if Top1 <= Top2 then + begin + // 1. up, 2. down + ScanHeight := Bottom1 - Top2; + if ScanHeight > Src_Rect2.h then + ScanHeight := Src_Rect2.h; + inc( Addr1, Pitch1 * UInt32( Top2 - Top1 ) ); + end + else + begin + // 1. down, 2. up + ScanHeight := Bottom2 - Top1; + if ScanHeight > Src_Rect1.h then + ScanHeight := Src_Rect1.h; + + end; + case BPP of + 1 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PByte( Addr1 )^ <> TransparentColor1 ) then + begin + Result := true; + exit; + end; + inc( Addr1 ); + + end; + inc( Addr1, Mod1 ); + + end; + 2 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PWord( Addr1 )^ <> TransparentColor1 ) then + begin + Result := true; + exit; + end; + inc( Addr1, 2 ); + + end; + inc( Addr1, Mod1 ); + + end; + 3 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + Color1 := PLongWord( Addr1 )^ and $00FFFFFF; + + if ( Color1 <> TransparentColor1 ) + then + begin + Result := true; + exit; + end; + inc( Addr1, 3 ); + + end; + inc( Addr1, Mod1 ); + + end; + 4 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PLongWord( Addr1 )^ <> TransparentColor1 ) then + begin + Result := true; + exit; + end; + inc( Addr1, 4 ); + + end; + inc( Addr1, Mod1 ); + + end; + end; +end; + +procedure SDL_ORSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr, TransparentColor : cardinal; + // TransparentColor: cardinal; + _ebx, _esi, _edi, _esp : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := Format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + WorkY := Src.h; + case bits of + 8 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov al, [esi] // AL := source color + cmp al, 0 + je @SkipColor // if AL=0 or AL=transparent color then skip everything + cmp al, byte ptr TransparentColor + je @SkipColor + or al, [edi] + mov [edi], al + @SkipColor: + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 15 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov ax, [esi] // AX := source color + cmp ax, 0 + je @SkipColor // if AX=0 then skip everything + cmp ax, word ptr TransparentColor + je @SkipColor + or ax, [edi] + mov [edi], ax + @SkipColor: + add esi, 2 + add edi, 2 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 16 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov ax, [esi] // AX := source color + cmp ax, 0 + je @SkipColor // if AX=0 then skip everything + cmp ax, word ptr TransparentColor + je @SkipColor + or ax, [edi] + mov [edi], ax + @SkipColor: + add esi, 2 + add edi, 2 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 24 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + add WorkX, ax // WorkX := Src.w * 2 + add WorkX, ax // WorkX := Src.w * 3 + @Loopx: + mov al, [esi] // AL := source color + or al, [edi] + mov [edi], al + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 32 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + shl ax, 2 + mov WorkX, ax // WorkX := Src.w * 4 + @Loopx: + mov al, [esi] // AL := source color + or al, [edi] + mov [edi], al + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); +end; + +procedure SDL_ANDSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr, TransparentColor : cardinal; + // TransparentColor: cardinal; + _ebx, _esi, _edi, _esp : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := Format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + WorkY := Src.h; + case bits of + 8 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov al, [esi] // AL := source color + cmp al, 0 + je @SkipColor // if AL=0 or AL=transparent color then skip everything + cmp al, byte ptr TransparentColor + je @SkipColor + and al, [edi] + mov [edi], al + @SkipColor: + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 15 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov ax, [esi] // AX := source color + cmp ax, 0 + je @SkipColor // if AX=0 then skip everything + cmp ax, word ptr TransparentColor + je @SkipColor + and ax, [edi] + mov [edi], ax + @SkipColor: + add esi, 2 + add edi, 2 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 16 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + @Loopx: + mov ax, [esi] // AX := source color + cmp ax, 0 + je @SkipColor // if AX=0 then skip everything + cmp ax, word ptr TransparentColor + je @SkipColor + and ax, [edi] + mov [edi], ax + @SkipColor: + add esi, 2 + add edi, 2 + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 24 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + mov WorkX, ax // WorkX := Src.w + add WorkX, ax // WorkX := Src.w * 2 + add WorkX, ax // WorkX := Src.w * 3 + @Loopx: + mov al, [esi] // AL := source color + and al, [edi] + mov [edi], al + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + 32 : + asm + mov _ebx, ebx + mov _esi, esi + mov _edi, edi + mov _esp, esp + mov esi, SrcAddr // ESI - Source Offset + mov edi, DestAddr // EDI - Destination Offset + mov ax, Src.h // WorkY := Src.h + mov WorkY, ax + @LoopY: + mov ax, Src.w + shl ax, 2 + mov WorkX, ax // WorkX := Src.w * 4 + @Loopx: + mov al, [esi] // AL := source color + and al, [edi] + mov [edi], al + inc esi + inc edi + dec WorkX + jnz @LoopX + add esi, SrcMod + add edi, DestMod + dec WorkY + jnz @LoopY + mov esp,_esp + mov edi,_edi + mov esi,_esi + mov ebx,_ebx + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); +end; + + +procedure SDL_GTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := Format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + WorkY := Src.h; + case bits of + 8 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt8( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt8( DestAddr )^; + if Pixel2 > 0 then + begin + if Pixel2 and $E0 > Pixel1 and $E0 then R := Pixel2 and $E0 else R := Pixel1 and $E0; + if Pixel2 and $1C > Pixel1 and $1C then G := Pixel2 and $1C else G := Pixel1 and $1C; + if Pixel2 and $03 > Pixel1 and $03 then B := Pixel2 and $03 else B := Pixel1 and $03; + + if R > $E0 then + R := $E0; + if G > $1C then + G := $1C; + if B > $03 then + B := $03; + PUInt8( DestAddr )^ := R or G or B; + end + else + PUInt8( DestAddr )^ := Pixel1; + end; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 15 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $7C00 > Pixel1 and $7C00 then R := Pixel2 and $7C00 else R := Pixel1 and $7C00; + if Pixel2 and $03E0 > Pixel1 and $03E0 then G := Pixel2 and $03E0 else G := Pixel1 and $03E0; + if Pixel2 and $001F > Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; + + PUInt16( DestAddr )^ := R or G or B; + end + else + PUInt16( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 16 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $F800 > Pixel1 and $F800 then R := Pixel2 and $F800 else R := Pixel1 and $F800; + if Pixel2 and $07E0 > Pixel1 and $07E0 then G := Pixel2 and $07E0 else G := Pixel1 and $07E0; + if Pixel2 and $001F > Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; + + PUInt16( DestAddr )^ := R or G or B; + end + else + PUInt16( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 24 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; + if Pixel2 > 0 then + begin + + if Pixel2 and $FF0000 > Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; + if Pixel2 and $00FF00 > Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; + if Pixel2 and $0000FF > Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; + + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or ( R or G or B ); + end + else + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or Pixel1; + end; + inc( SrcAddr, 3 ); + inc( DestAddr, 3 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 32 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $FF0000 > Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; + if Pixel2 and $00FF00 > Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; + if Pixel2 and $0000FF > Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; + + PUInt32( DestAddr )^ := R or G or B; + end + else + PUInt32( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 4 ); + inc( DestAddr, 4 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); +end; + + +procedure SDL_LTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := Format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + WorkY := Src.h; + case bits of + 8 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt8( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt8( DestAddr )^; + if Pixel2 > 0 then + begin + if Pixel2 and $E0 < Pixel1 and $E0 then R := Pixel2 and $E0 else R := Pixel1 and $E0; + if Pixel2 and $1C < Pixel1 and $1C then G := Pixel2 and $1C else G := Pixel1 and $1C; + if Pixel2 and $03 < Pixel1 and $03 then B := Pixel2 and $03 else B := Pixel1 and $03; + + if R > $E0 then + R := $E0; + if G > $1C then + G := $1C; + if B > $03 then + B := $03; + PUInt8( DestAddr )^ := R or G or B; + end + else + PUInt8( DestAddr )^ := Pixel1; + end; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 15 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $7C00 < Pixel1 and $7C00 then R := Pixel2 and $7C00 else R := Pixel1 and $7C00; + if Pixel2 and $03E0 < Pixel1 and $03E0 then G := Pixel2 and $03E0 else G := Pixel1 and $03E0; + if Pixel2 and $001F < Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; + + PUInt16( DestAddr )^ := R or G or B; + end + else + PUInt16( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 16 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $F800 < Pixel1 and $F800 then R := Pixel2 and $F800 else R := Pixel1 and $F800; + if Pixel2 and $07E0 < Pixel1 and $07E0 then G := Pixel2 and $07E0 else G := Pixel1 and $07E0; + if Pixel2 and $001F < Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; + + PUInt16( DestAddr )^ := R or G or B; + end + else + PUInt16( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 24 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; + if Pixel2 > 0 then + begin + + if Pixel2 and $FF0000 < Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; + if Pixel2 and $00FF00 < Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; + if Pixel2 and $0000FF < Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; + + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or ( R or G or B ); + end + else + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or Pixel1; + end; + inc( SrcAddr, 3 ); + inc( DestAddr, 3 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 32 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $FF0000 < Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; + if Pixel2 and $00FF00 < Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; + if Pixel2 and $0000FF < Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; + + PUInt32( DestAddr )^ := R or G or B; + end + else + PUInt32( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 4 ); + inc( DestAddr, 4 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); +end; + +function SDL_ClipLine(var x1,y1,x2,y2: Integer; ClipRect: PSDL_Rect) : boolean; +var tflag, flag1, flag2: word; + txy, xedge, yedge: Integer; + slope: single; + + function ClipCode(x,y: Integer): word; + begin + Result := 0; + if x < ClipRect.x then Result := 1; + if x >= ClipRect.w + ClipRect.x then Result := Result or 2; + if y < ClipRect.y then Result := Result or 4; + if y >= ClipRect.h + ClipRect.y then Result := Result or 8; + end; + +begin + flag1 := ClipCode(x1,y1); + flag2 := ClipCode(x2,y2); + result := true; + + while true do + begin + if (flag1 or flag2) = 0 then Exit; // all in + + if (flag1 and flag2) <> 0 then + begin + result := false; + Exit; // all out + end; + + if flag2 = 0 then + begin + txy := x1; x1 := x2; x2 := txy; + txy := y1; y1 := y2; y2 := txy; + tflag := flag1; flag1 := flag2; flag2 := tflag; + end; + + if (flag2 and 3) <> 0 then + begin + if (flag2 and 1) <> 0 then + xedge := ClipRect.x + else + xedge := ClipRect.w + ClipRect.x -1; // back 1 pixel otherwise we end up in a loop + + slope := (y2 - y1) / (x2 - x1); + y2 := y1 + Round(slope * (xedge - x1)); + x2 := xedge; + end + else + begin + if (flag2 and 4) <> 0 then + yedge := ClipRect.y + else + yedge := ClipRect.h + ClipRect.y -1; // up 1 pixel otherwise we end up in a loop + + slope := (x2 - x1) / (y2 - y1); + x2 := x1 + Round(slope * (yedge - y1)); + y2 := yedge; + end; + + flag2 := ClipCode(x2, y2); + end; +end; + +end. + + diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlinput.pas b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlinput.pas new file mode 100644 index 00000000..2955d17a --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlinput.pas @@ -0,0 +1,692 @@ +unit sdlinput; +{ + $Id: sdlinput.pas,v 1.7 2004/09/30 22:32:04 savage Exp $ + +} +{******************************************************************************} +{ } +{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } +{ SDL Input Wrapper } +{ } +{ } +{ The initial developer of this Pascal code was : } +{ Dominique Louis } +{ } +{ Portions created by Dominique Louis are } +{ Copyright (C) 2003 - 2100 Dominique Louis. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ Dominique Louis } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ SDL Mouse, Keyboard and Joystick wrapper } +{ } +{ } +{ Requires } +{ -------- } +{ SDL.dll on Windows platforms } +{ libSDL-1.1.so.0 on Linux platform } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ March 12 2003 - DL : Initial creation } +{ } +{ February 02 2004 - DL : Added Custom Cursor Support to the Mouse class } +{ + $Log: sdlinput.pas,v $ + Revision 1.7 2004/09/30 22:32:04 savage + Updated with slightly different header comments + + Revision 1.6 2004/09/12 21:52:58 savage + Slight changes to fix some issues with the sdl classes. + + Revision 1.5 2004/05/10 21:11:49 savage + changes required to help get SoAoS off the ground. + + Revision 1.4 2004/05/03 22:38:40 savage + Added the ability to enable or disable certain inputs @ runtime. Basically it just does not call UpdateInput if Enabled = false. + Can also disable and enable input devices via the InputManager. + + Revision 1.3 2004/04/28 21:27:01 savage + Updated Joystick code and event handlers. Needs testing... + + Revision 1.2 2004/02/14 22:36:29 savage + Fixed inconsistencies of using LoadLibrary and LoadModule. + Now all units make use of LoadModule rather than LoadLibrary and other dynamic proc procedures. + + Revision 1.1 2004/02/05 00:08:20 savage + Module 1.0 release + + +} +{******************************************************************************} + +interface + +{$i jedi-sdl.inc} + +uses + Classes, + sdl; + +type + TSDLInputType = ( itJoystick , itKeyBoard, itMouse ); + TSDLInputTypes = set of TSDLInputType; + + TSDLCustomInput = class( TObject ) + private + FEnabled: Boolean; + public + constructor Create; + function UpdateInput( event: TSDL_EVENT ) : Boolean; virtual; abstract; + property Enabled : Boolean read FEnabled write FEnabled; + end; + + TSDLJoyAxisMoveEvent = procedure ( Which: UInt8; Axis: UInt8; Value: SInt16 ) {$IFNDEF NOT_OO}of object{$ENDIF}; + TSDLJoyBallMoveEvent = procedure ( Which: UInt8; Ball: UInt8; RelativePos: TPoint ) {$IFNDEF NOT_OO}of object{$ENDIF}; + TSDLJoyHatMoveEvent = procedure ( Which: UInt8; Hat: UInt8; Value: SInt16 ) {$IFNDEF NOT_OO}of object{$ENDIF}; + TSDLJoyButtonEvent = procedure ( Which: UInt8; Button: UInt8; State: SInt16 ) {$IFNDEF NOT_OO}of object{$ENDIF}; + + + TSDLJoyStick = class( TSDLCustomInput ) + private + FJoystick : PSDL_Joystick; + FJoystickIndex : Integer; + FJoyAxisMoveEvent : TSDLJoyAxisMoveEvent; + FJoyBallMoveEvent : TSDLJoyBallMoveEvent; + FJoyHatMoveEvent : TSDLJoyHatMoveEvent; + FJoyButtonDownEvent : TSDLJoyButtonEvent; + FJoyButtonUpEvent : TSDLJoyButtonEvent; + procedure DoAxisMove( Event : TSDL_Event ); + procedure DoBallMove( Event : TSDL_Event ); + procedure DoHatMove( Event : TSDL_Event ); + procedure DoButtonDown( Event : TSDL_Event ); + procedure DoButtonUp( Event : TSDL_Event ); + function GetName: PChar; + function GetNumAxes: integer; + function GetNumBalls: integer; + function GetNumButtons: integer; + function GetNumHats: integer; + public + constructor Create( Index : Integer ); + destructor Destroy; override; + procedure Open; + procedure Close; + function UpdateInput( Event: TSDL_EVENT ) : Boolean; override; + property Name : PChar read GetName; + property NumAxes : integer read GetNumAxes; + property NumBalls : integer read GetNumBalls; + property NumButtons : integer read GetNumButtons; + property NumHats : integer read GetNumHats; + property OnAxisMove : TSDLJoyAxisMoveEvent read FJoyAxisMoveEvent write FJoyAxisMoveEvent; + property OnBallMove : TSDLJoyBallMoveEvent read FJoyBallMoveEvent write FJoyBallMoveEvent; + property OnHatMove : TSDLJoyHatMoveEvent read FJoyHatMoveEvent write FJoyHatMoveEvent; + property OnButtonDown : TSDLJoyButtonEvent read FJoyButtonDownEvent write FJoyButtonDownEvent; + property OnButtonUp : TSDLJoyButtonEvent read FJoyButtonUpEvent write FJoyButtonUpEvent; + end; + + TSDLJoySticks = class( TObject ) + private + FNumOfJoySticks: Integer; + FJoyStickList : TList; + function GetJoyStick(Index: integer): TSDLJoyStick; + procedure SetJoyStick(Index: integer; const Value: TSDLJoyStick); + public + constructor Create; + destructor Destroy; override; + function UpdateInput( event: TSDL_EVENT ) : Boolean; + property NumOfJoySticks : Integer read FNumOfJoySticks write FNumOfJoySticks; + property JoySticks[ Index : integer ] : TSDLJoyStick read GetJoyStick write SetJoyStick; + end; + + TSDLKeyBoardEvent = procedure ( var Key: TSDLKey; Shift: TSDLMod; unicode : UInt16 ) {$IFNDEF NOT_OO}of object{$ENDIF}; + + TSDLKeyBoard = class( TSDLCustomInput ) + private + FKeys : PKeyStateArr; + FOnKeyUp: TSDLKeyBoardEvent; + FOnKeyDown: TSDLKeyBoardEvent; + procedure DoKeyDown( keysym : PSDL_keysym ); + procedure DoKeyUp( keysym : PSDL_keysym ); + public + function IsKeyDown( Key : TSDLKey ) : Boolean; + function IsKeyUp( Key : TSDLKey ) : Boolean; + function UpdateInput( event: TSDL_EVENT ) : Boolean; override; + property Keys : PKeyStateArr read FKeys write FKeys; + property OnKeyDown : TSDLKeyBoardEvent read FOnKeyDown write FOnKeyDown; + property OnKeyUp : TSDLKeyBoardEvent read FOnKeyUp write FOnKeyUp; + end; + + TSDLMouseButtonEvent = procedure ( Button : Integer; Shift: TSDLMod; MousePos : TPoint ) {$IFNDEF NOT_OO}of object{$ENDIF}; + TSDLMouseMoveEvent = procedure ( Shift: TSDLMod; CurrentPos : TPoint; RelativePos : TPoint ) {$IFNDEF NOT_OO}of object{$ENDIF}; + TSDLMouseWheelEvent = procedure ( WheelDelta : Integer; Shift: TSDLMod; MousePos : TPoint ) {$IFNDEF NOT_OO}of object{$ENDIF}; + + TSDLMouse = class( TSDLCustomInput ) + private + FDragging : Boolean; + FMousePos : TPoint; + FOnMouseUp: TSDLMouseButtonEvent; + FOnMouseDown: TSDLMouseButtonEvent; + FOnMouseMove: TSDLMouseMoveEvent; + FOnMouseWheel: TSDLMouseWheelEvent; + FCursor : PSDL_Cursor; // Cursor Pointer + procedure DoMouseMove( Event: TSDL_Event ); + procedure DoMouseDown( Event: TSDL_Event ); + procedure DoMouseUp( Event: TSDL_Event ); + procedure DoMouseWheelScroll( Event: TSDL_Event ); + function GetMousePosition: TPoint; + procedure SetMousePosition(const Value: TPoint); + public + destructor Destroy; override; + function UpdateInput( event: TSDL_EVENT ) : Boolean; override; + function MouseIsDown( Button : Integer ) : Boolean; + function MouseIsUp( Button : Integer ) : Boolean; + procedure SetCursor(data, mask: PUInt8; w, h, hot_x, hot_y: Integer); + procedure ShowCursor; + procedure HideCursor; + property OnMouseDown : TSDLMouseButtonEvent read FOnMouseDown write FOnMouseDown; + property OnMouseUp : TSDLMouseButtonEvent read FOnMouseUp write FOnMouseUp; + property OnMouseMove : TSDLMouseMoveEvent read FOnMouseMove write FOnMouseMove; + property OnMouseWheel : TSDLMouseWheelEvent read FOnMouseWheel write FOnMouseWheel; + property MousePosition : TPoint read GetMousePosition write SetMousePosition; + end; + + TSDLInputManager = class( TObject ) + private + FKeyBoard : TSDLKeyBoard; + FMouse : TSDLMouse; + FJoystick : TSDLJoysticks; + public + constructor Create( InitInputs : TSDLInputTypes ); + destructor Destroy; override; + procedure Disable( InitInputs : TSDLInputTypes; JoyStickNumber : Integer = 0 ); + procedure Enable( InitInputs : TSDLInputTypes; JoyStickNumber : Integer = 0 ); + function UpdateInputs( event: TSDL_EVENT ) : Boolean; + property KeyBoard : TSDLKeyBoard read FKeyBoard write FKeyBoard; + property Mouse : TSDLMouse read FMouse write FMouse; + property JoyStick : TSDLJoysticks read FJoyStick write FJoyStick; + end; + +implementation + +{ TSDLCustomInput } +constructor TSDLCustomInput.Create; +begin + inherited; + FEnabled := true; +end; + +{ TSDLJoysticks } +constructor TSDLJoysticks.Create; +var + i : integer; +begin + inherited; + if ( SDL_WasInit( SDL_INIT_JOYSTICK ) = 0 ) then + SDL_InitSubSystem( SDL_INIT_JOYSTICK ); + FNumOfJoySticks := SDL_NumJoysticks; + FJoyStickList := TList.Create; + for i := 0 to FNumOfJoySticks - 1 do + begin + FJoyStickList.Add( TSDLJoyStick.Create( i ) ); + end; +end; + +destructor TSDLJoysticks.Destroy; +var + i : integer; +begin + if FJoyStickList.Count > 0 then + begin + for i := 0 to FJoyStickList.Count - 1 do + begin + TSDLJoyStick( FJoyStickList.Items[i] ).Free; + end; + end; + SDL_QuitSubSystem( SDL_INIT_JOYSTICK ); + inherited; +end; + +function TSDLJoySticks.GetJoyStick(Index: integer): TSDLJoyStick; +begin + Result := TSDLJoyStick( FJoyStickList[ Index ] ); +end; + +procedure TSDLJoySticks.SetJoyStick(Index: integer; + const Value: TSDLJoyStick); +begin + FJoyStickList[ Index ] := @Value; +end; + +function TSDLJoysticks.UpdateInput(event: TSDL_EVENT): Boolean; +var + i : integer; +begin + result := false; + if FJoyStickList.Count > 0 then + begin + for i := 0 to FJoyStickList.Count - 1 do + begin + TSDLJoyStick( FJoyStickList.Items[i] ).UpdateInput( event ); + end; + end; +end; + +{ TSDLKeyBoard } +procedure TSDLKeyBoard.DoKeyDown(keysym: PSDL_keysym); +begin + if Assigned( FOnKeyDown ) then + FOnKeyDown( keysym.sym , keysym.modifier, keysym.unicode ); +end; + +procedure TSDLKeyBoard.DoKeyUp(keysym: PSDL_keysym); +begin + if Assigned( FOnKeyUp ) then + FOnKeyUp( keysym.sym , keysym.modifier, keysym.unicode ); +end; + +function TSDLKeyBoard.IsKeyDown( Key: TSDLKey ): Boolean; +begin + SDL_PumpEvents; + + // Populate Keys array + FKeys := PKeyStateArr( SDL_GetKeyState( nil ) ); + Result := ( FKeys[Key] = SDL_PRESSED ); +end; + +function TSDLKeyBoard.IsKeyUp( Key: TSDLKey ): Boolean; +begin + SDL_PumpEvents; + + // Populate Keys array + FKeys := PKeyStateArr( SDL_GetKeyState( nil ) ); + Result := ( FKeys[Key] = SDL_RELEASED ); +end; + +function TSDLKeyBoard.UpdateInput(event: TSDL_EVENT): Boolean; +begin + result := false; + if ( FEnabled ) then + begin + case event.type_ of + SDL_KEYDOWN : + begin + // handle key presses + DoKeyDown( @event.key.keysym ); + result := true; + end; + + SDL_KEYUP : + begin + // handle key releases + DoKeyUp( @event.key.keysym ); + result := true; + end; + end; + end; +end; + +{ TSDLMouse } +destructor TSDLMouse.Destroy; +begin + if FCursor <> nil then + SDL_FreeCursor( FCursor ); + inherited; +end; + +procedure TSDLMouse.DoMouseDown( Event: TSDL_Event ); +var + CurrentPos : TPoint; +begin + FDragging := true; + if Assigned( FOnMouseDown ) then + begin + CurrentPos.x := event.button.x; + CurrentPos.y := event.button.y; + FOnMouseDown( event.button.button, SDL_GetModState, CurrentPos ); + end; +end; + +procedure TSDLMouse.DoMouseMove( Event: TSDL_Event ); +var + CurrentPos, RelativePos : TPoint; +begin + if Assigned( FOnMouseMove ) then + begin + CurrentPos.x := event.motion.x; + CurrentPos.y := event.motion.y; + RelativePos.x := event.motion.xrel; + RelativePos.y := event.motion.yrel; + FOnMouseMove( SDL_GetModState, CurrentPos, RelativePos ); + end; +end; + +procedure TSDLMouse.DoMouseUp( event: TSDL_EVENT ); +var + Point : TPoint; +begin + FDragging := false; + if Assigned( FOnMouseUp ) then + begin + Point.x := event.button.x; + Point.y := event.button.y; + FOnMouseUp( event.button.button, SDL_GetModState, Point ); + end; +end; + +procedure TSDLMouse.DoMouseWheelScroll( event: TSDL_EVENT ); +var + Point : TPoint; +begin + if Assigned( FOnMouseWheel ) then + begin + Point.x := event.button.x; + Point.y := event.button.y; + if ( event.button.button = SDL_BUTTON_WHEELUP ) then + FOnMouseWheel( SDL_BUTTON_WHEELUP, SDL_GetModState, Point ) + else + FOnMouseWheel( SDL_BUTTON_WHEELDOWN, SDL_GetModState, Point ); + end; +end; + +function TSDLMouse.GetMousePosition: TPoint; +begin + SDL_PumpEvents; + + SDL_GetMouseState( FMousePos.X, FMousePos.Y ); + Result := FMousePos; +end; + +procedure TSDLMouse.HideCursor; +begin + SDL_ShowCursor( SDL_DISABLE ); +end; + +function TSDLMouse.MouseIsDown(Button: Integer): Boolean; +begin + SDL_PumpEvents; + + Result := ( SDL_GetMouseState( FMousePos.X, FMousePos.Y ) and SDL_BUTTON( Button ) = 0 ); +end; + +function TSDLMouse.MouseIsUp(Button: Integer): Boolean; +begin + SDL_PumpEvents; + + Result := not ( SDL_GetMouseState( FMousePos.X, FMousePos.Y ) and SDL_BUTTON( Button ) = 0 ); +end; + +procedure TSDLMouse.SetCursor(data, mask: PUInt8; w, h, hot_x, hot_y: Integer); +begin + if FCursor <> nil then + SDL_FreeCursor( FCursor ); + // create the cursor + FCursor := SDL_CreateCursor( data, mask, w, h, hot_x, hot_y ); + + // set the cursor + SDL_SetCursor( FCursor ); +end; + +procedure TSDLMouse.SetMousePosition(const Value: TPoint); +begin + SDL_WarpMouse( Value.x, Value.y ); +end; + +procedure TSDLMouse.ShowCursor; +begin + SDL_ShowCursor( SDL_ENABLE ); +end; + +function TSDLMouse.UpdateInput(event: TSDL_EVENT): Boolean; +begin + result := false; + if ( FEnabled ) then + begin + case event.type_ of + SDL_MOUSEMOTION : + begin + // handle Mouse Move + DoMouseMove( event ); + end; + + SDL_MOUSEBUTTONDOWN : + begin + // handle Mouse Down + if ( event.button.button = SDL_BUTTON_WHEELUP ) + or ( event.button.button = SDL_BUTTON_WHEELDOWN ) then + DoMouseWheelScroll( event ) + else + DoMouseDown( event ); + end; + + SDL_MOUSEBUTTONUP : + begin + // handle Mouse Up + if ( event.button.button = SDL_BUTTON_WHEELUP ) + or ( event.button.button = SDL_BUTTON_WHEELDOWN ) then + DoMouseWheelScroll( event ) + else + DoMouseUp( event ); + end; + end; + end; +end; + +{ TSDLInputManager } +constructor TSDLInputManager.Create(InitInputs: TSDLInputTypes); +begin + inherited Create; + if itJoystick in InitInputs then + FJoystick := TSDLJoysticks.Create; + + if itKeyBoard in InitInputs then + FKeyBoard := TSDLKeyBoard.Create; + + if itMouse in InitInputs then + FMouse := TSDLMouse.Create; +end; + +destructor TSDLInputManager.Destroy; +begin + if FJoystick <> nil then + FreeAndNil( FJoystick ); + if FKeyBoard <> nil then + FreeAndNil( FKeyBoard ); + if FMouse <> nil then + FreeAndNil( FMouse ); + inherited; +end; + +procedure TSDLInputManager.Disable( InitInputs : TSDLInputTypes; JoyStickNumber : Integer ); +begin + if itJoystick in InitInputs then + FJoystick.JoySticks[ JoyStickNumber ].Enabled := false; + + if itKeyBoard in InitInputs then + FKeyBoard.Enabled := false; + + if itMouse in InitInputs then + FMouse.Enabled := false; +end; + +procedure TSDLInputManager.Enable( InitInputs: TSDLInputTypes; JoyStickNumber: Integer ); +begin + if itJoystick in InitInputs then + FJoystick.JoySticks[ JoyStickNumber ].Enabled := true; + + if itKeyBoard in InitInputs then + FKeyBoard.Enabled := true; + + if itMouse in InitInputs then + FMouse.Enabled := true; +end; + +function TSDLInputManager.UpdateInputs( event: TSDL_EVENT ): Boolean; +begin + Result := false; + if ( FJoystick <> nil ) then + Result := FJoystick.UpdateInput( event ); + if ( FKeyBoard <> nil ) then + Result := FKeyBoard.UpdateInput( event ); + if ( FMouse <> nil ) then + Result := FMouse.UpdateInput( event ); +end; + +{ TSDLJoyStick } +procedure TSDLJoyStick.Close; +begin + SDL_JoystickClose( @FJoystick ); +end; + +constructor TSDLJoyStick.Create( Index : Integer ); +begin + inherited Create; + FJoystick := nil; + FJoystickIndex := Index; +end; + +destructor TSDLJoyStick.Destroy; +begin + if FJoystick <> nil then + Close; + inherited; +end; + +procedure TSDLJoyStick.DoAxisMove(Event: TSDL_Event); +begin + if Assigned( FJoyAxisMoveEvent ) then + begin + FJoyAxisMoveEvent( Event.jaxis.which, Event.jaxis.axis, Event.jaxis.value ); + end +end; + +procedure TSDLJoyStick.DoBallMove(Event: TSDL_Event); +var + BallPoint : TPoint; +begin + if Assigned( FJoyBallMoveEvent ) then + begin + BallPoint.x := Event.jball.xrel; + BallPoint.y := Event.jball.yrel; + FJoyBallMoveEvent( Event.jball.which, Event.jball.ball, BallPoint ); + end; +end; + +procedure TSDLJoyStick.DoButtonDown(Event: TSDL_Event); +begin + if Assigned( FJoyButtonDownEvent ) then + begin + if ( Event.jbutton.state = SDL_PRESSED ) then + FJoyButtonDownEvent( Event.jbutton.which, Event.jbutton.button, Event.jbutton.state ); + end; +end; + +procedure TSDLJoyStick.DoButtonUp(Event: TSDL_Event); +begin + if Assigned( FJoyButtonUpEvent ) then + begin + if ( Event.jbutton.state = SDL_RELEASED ) then + FJoyButtonUpEvent( Event.jbutton.which, Event.jbutton.button, Event.jbutton.state ); + end +end; + +procedure TSDLJoyStick.DoHatMove(Event: TSDL_Event); +begin + if Assigned( FJoyHatMoveEvent ) then + begin + FJoyHatMoveEvent( Event.jhat.which, Event.jhat.hat, Event.jhat.value ); + end; +end; + +function TSDLJoyStick.GetName: PChar; +begin + result := FJoystick.name; +end; + +function TSDLJoyStick.GetNumAxes: integer; +begin + result := FJoystick.naxes; +end; + +function TSDLJoyStick.GetNumBalls: integer; +begin + result := FJoystick.nballs; +end; + +function TSDLJoyStick.GetNumButtons: integer; +begin + result := FJoystick.nbuttons; +end; + +function TSDLJoyStick.GetNumHats: integer; +begin + result := FJoystick.nhats; +end; + +procedure TSDLJoyStick.Open; +begin + FJoystick := SDL_JoyStickOpen( FJoystickIndex ); +end; + +function TSDLJoyStick.UpdateInput(Event: TSDL_EVENT): Boolean; +begin + Result := false; + + if ( FEnabled ) then + begin + case event.type_ of + SDL_JOYAXISMOTION : + begin + DoAxisMove( Event ); + end; + + SDL_JOYBALLMOTION : + begin + DoBallMove( Event ); + end; + + SDL_JOYHATMOTION : + begin + DoHatMove( Event ); + end; + + SDL_JOYBUTTONDOWN : + begin + DoButtonDown( Event ); + end; + + SDL_JOYBUTTONUP : + begin + DoButtonUp( Event ); + end; + end; + end; +end; + +end. diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlstreams.pas b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlstreams.pas new file mode 100644 index 00000000..64009176 --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlstreams.pas @@ -0,0 +1,216 @@ +unit sdlstreams; +{ + $Id: sdlstreams.pas,v 1.1 2004/02/05 00:08:20 savage Exp $ + +} +{******************************************************************} +{ } +{ SDL - Simple DirectMedia Layer } +{ Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga } +{ } +{ Portions created by Chris Bruner are } +{ Copyright (C) 2002 Chris Bruner. } +{ } +{ Contributor(s) } +{ -------------- } +{ } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/NPL/NPL-1_1Final.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ Shows how to use OpenGL to do 2D and 3D with the SDL libraries } +{ } +{ } +{ Requires } +{ -------- } +{ SDL runtime libary somewhere in your path } +{ The Latest SDL runtime can be found on http://www.libsdl.org } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ January 11 2002 - CB : Software embraced and extended by } +{ Chris Bruner of Crystal Software } +{ (Canada) Inc. } +{ } +{ February 11 2002 - DL : Added FreePascal support as suggested } +{ by "QuePasha Pepe" } +{ } +{******************************************************************} +{ + $Log: sdlstreams.pas,v $ + Revision 1.1 2004/02/05 00:08:20 savage + Module 1.0 release + + +} + +{$i jedi-sdl.inc} + +interface + +uses + Classes, + SysUtils, + sdl, + sdlutils; + +{$IFDEF FPC} +type + EinvalidContainer=class(Exception); + {$ENDIF} + +function LoadSDLBMPFromStream( Stream : TStream ) : PSDL_Surface; +procedure SaveSDLBMPToStream( SDL_Surface : PSDL_Surface; stream : TStream ); +function SDL_Swap16( D : UInt16 ) : Uint16; +function SDL_Swap32( D : UInt32 ) : Uint32; +function SDLStreamSetup( stream : TStream ) : PSDL_RWops; +// this only closes the SDL_RWops part of the stream, not the stream itself +procedure SDLStreamCloseRWops( SDL_RWops : PSDL_RWops ); + +implementation + +function SDL_Swap16( D : UInt16 ) : Uint16; +begin + Result := ( D shl 8 ) or ( D shr 8 ); +end; + +function SDL_Swap32( D : UInt32 ) : Uint32; +begin + Result := ( ( D shl 24 ) or ( ( D shl 8 ) and $00FF0000 ) or ( ( D shr 8 ) and $0000FF00 ) or ( D shr 24 ) ); +end; + +(*function SDL_Swap64(D : UInt64) : Uint64; +var hi,lo : Uint32; +begin + // Separate into high and low 32-bit resultues and swap them + lo := Uint32(D and $0FFFFFFFF); // bloody pascal is too tight in it's type checking! + D := D shr 32; + hi = Uint32((D and $FFFFFFFF)); + result = SDL_Swap32(lo); + result := result shl 32; + result := result or SDL_Swap32(hi); +end; +*) + +function SdlStreamSeek( context : PSDL_RWops; offset : Integer; whence : Integer ) : integer; cdecl; +var + stream : TStream; + origin : Word; +begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamSeek on nil' ); + case whence of + 0 : origin := soFromBeginning; // Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0. + 1 : origin := soFromCurrent; // Offset is from the current position in the resource. Seek moves to Position + Offset. + 2 : origin := soFromEnd; + else + origin := soFromBeginning; // just in case + end; + Result := stream.Seek( offset, origin ); +end; + +function SDLStreamWrite( context : PSDL_RWops; Ptr : Pointer; + size : Integer; num : Integer ) : Integer; cdecl; +var + stream : TStream; +begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamWrite on nil' ); + try + Result := stream.Write( Ptr^, Size * num ) div size; + except + Result := -1; + end; +end; + +function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : Integer; maxnum + : Integer ) : Integer; cdecl; +var + stream : TStream; +begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamRead on nil' ); + try + Result := stream.read( Ptr^, Size * maxnum ) div size; + except + Result := -1; + end; +end; + +function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl; +var + stream : TStream; +begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamClose on nil' ); + stream.Free; + Result := 1; +end; + +function SDLStreamSetup( stream : TStream ) : PSDL_RWops; +begin + result := SDL_AllocRW; + if ( result = nil ) then + raise EInvalidContainer.Create( 'could not create SDLStream on nil' ); + result.unknown := TUnknown( stream ); + result.seek := SDLStreamSeek; + result.read := SDLStreamRead; + result.write := SDLStreamWrite; + result.close := SDLStreamClose; + Result.type_ := 2; // TUnknown +end; + +// this only closes the SDL part of the stream, not the context + +procedure SDLStreamCloseRWops( SDL_RWops : PSDL_RWops ); +begin + SDL_FreeRW( SDL_RWops ); +end; + +function LoadSDLBMPFromStream( stream : TStream ) : PSDL_Surface; +var + SDL_RWops : PSDL_RWops; +begin + SDL_RWops := SDLStreamSetup( stream ); + result := SDL_LoadBMP_RW( SDL_RWops, 0 ); + SDLStreamCloseRWops( SDL_RWops ); +end; + +procedure SaveSDLBMPToStream( SDL_Surface : PSDL_Surface; stream : TStream ); +var + SDL_RWops : PSDL_RWops; +begin + SDL_RWops := SDLStreamSetup( stream ); + SDL_SaveBMP_RW( SDL_Surface, SDL_RWops, 0 ); + SDLStreamCloseRWops( SDL_RWops ); +end; + +end. + diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlticks.pas b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlticks.pas new file mode 100644 index 00000000..4e91ecb8 --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlticks.pas @@ -0,0 +1,196 @@ +unit sdlticks; +{ + $Id: sdlticks.pas,v 1.1 2004/09/30 22:35:47 savage Exp $ + +} +{******************************************************************************} +{ } +{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } +{ SDL GetTicks Class Wrapper } +{ } +{ } +{ The initial developer of this Pascal code was : } +{ Dominique Louis } +{ } +{ Portions created by Dominique Louis are } +{ Copyright (C) 2004 - 2100 Dominique Louis. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ Dominique Louis } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ SDL Window Wrapper } +{ } +{ } +{ Requires } +{ -------- } +{ SDL.dll on Windows platforms } +{ libSDL-1.1.so.0 on Linux platform } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ } +{ September 23 2004 - DL : Initial Creation } +{ + $Log: sdlticks.pas,v $ + Revision 1.1 2004/09/30 22:35:47 savage + Changes, enhancements and additions as required to get SoAoS working. + + +} +{******************************************************************************} + +interface + +uses + sdl; + + +type + TSDLTicks = class + private + m_startTime : Int64; + m_ticksPerSecond : Int64; + s_lastTime : Int64; + + public + constructor Create; + destructor Destroy; override; // destructor + + {***************************************************************************** + Init + + If the hi-res timer is present, the tick rate is stored and the function + returns true. Otherwise, the function returns false, and the timer should + not be used. + *****************************************************************************} + function Init : boolean; + + function GetElapsedSeconds( elapsedFrames : Cardinal = 1 ) : single; + + {*************************************************************************** + GetFPS + + Returns the average frames per second over elapsedFrames, which defaults to + one. If this is not called every frame, the client should track the number + of frames itself, and reset the value after this is called. + ***************************************************************************} + function GetFPS( elapsedFrames : Cardinal = 1 ) : single; + + {*************************************************************************** + LockFPS + + Used to lock the frame rate to a set amount. This will block until enough + time has passed to ensure that the fps won't go over the requested amount. + Note that this can only keep the fps from going above the specified level; + it can still drop below it. It is assumed that if used, this function will + be called every frame. The value returned is the instantaneous fps, which + will be <= targetFPS. + ***************************************************************************} + function LockFPS( targetFPS : Byte ) : single; + end; + +implementation + +{ TSDLTicks } +constructor TSDLTicks.Create; +begin + +end; + +destructor TSDLTicks.Destroy; +begin + + inherited; +end; + +function TSDLTicks.GetElapsedSeconds( elapsedFrames: Cardinal ): single; +var + currentTime : Int64; +begin + // s_lastTime := m_startTime; + + currentTime := SDL_GetTicks; + //QueryPerformanceCounter( currentTime ); + + result := (currentTime - s_lastTime) / m_ticksPerSecond; + + // reset the timer + s_lastTime := currentTime; +end; + +function TSDLTicks.GetFPS( elapsedFrames: Cardinal ): single; +var + currentTime : integer; + fps : single; +begin + // s_lastTime := m_startTime; + + currentTime := SDL_GetTicks; + + fps := elapsedFrames * m_ticksPerSecond / ( currentTime - s_lastTime); + + // reset the timer + s_lastTime := currentTime; + + result := fps; +end; + +function TSDLTicks.Init: boolean; +begin + m_startTime := SDL_GetTicks; + s_lastTime := m_startTime; + m_ticksPerSecond := 1000; + result := true; +end; + +function TSDLTicks.LockFPS(targetFPS: Byte): single; +var + currentTime : integer; + fps : single; +begin + if (targetFPS = 0) then + targetFPS := 1; + + s_lastTime := m_startTime; + + // delay to maintain a constant frame rate + repeat + currentTime := SDL_GetTicks; + fps := m_ticksPerSecond / (currentTime - s_lastTime); + until (fps > targetFPS); + + // reset the timer + s_lastTime := m_startTime; + + result := fps; +end; + +end. + \ No newline at end of file diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlutils.pas b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlutils.pas new file mode 100644 index 00000000..bef83cbc --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlutils.pas @@ -0,0 +1,4256 @@ +unit sdlutils; +{ + $Id: sdlutils.pas,v 1.4 2004/06/02 19:38:53 savage Exp $ + +} +{******************************************************************************} +{ } +{ Borland Delphi SDL - Simple DirectMedia Layer } +{ SDL Utility functions } +{ } +{ } +{ The initial developer of this Pascal code was : } +{ Tom Jones } +{ } +{ Portions created by Tom Jones are } +{ Copyright (C) 2000 - 2001 Tom Jones. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ Dominique Louis } +{ Róbert Kisnémeth } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ Helper functions... } +{ } +{ } +{ Requires } +{ -------- } +{ SDL.dll on Windows platforms } +{ libSDL-1.1.so.0 on Linux platform } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ 2000 - TJ : Initial creation } +{ } +{ July 13 2001 - DL : Added PutPixel and GetPixel routines. } +{ } +{ Sept 14 2001 - RK : Added flipping routines. } +{ } +{ Sept 19 2001 - RK : Added PutPixel & line drawing & blitting with ADD } +{ effect. Fixed a bug in SDL_PutPixel & SDL_GetPixel } +{ Added PSDLRect() } +{ Sept 22 2001 - DL : Removed need for Windows.pas by defining types here} +{ Also removed by poor attempt or a dialog box } +{ } +{ Sept 25 2001 - RK : Added PixelTest, NewPutPixel, SubPixel, SubLine, } +{ SubSurface, MonoSurface & TexturedSurface } +{ } +{ Sept 26 2001 - DL : Made change so that it refers to native Pascal } +{ types rather that Windows types. This makes it more} +{ portable to Linix. } +{ } +{ Sept 27 2001 - RK : SDLUtils now can be compiled with FreePascal } +{ } +{ Oct 27 2001 - JF : Added ScrollY function } +{ } +{ Jan 21 2002 - RK : Added SDL_ZoomSurface and SDL_WarpSurface } +{ } +{ Mar 28 2002 - JF : Added SDL_RotateSurface } +{ } +{ May 13 2002 - RK : Improved SDL_FillRectAdd & SDL_FillRectSub } +{ } +{ May 27 2002 - YS : GradientFillRect function } +{ } +{ May 30 2002 - RK : Added SDL_2xBlit, SDL_Scanline2xBlit } +{ & SDL_50Scanline2xBlit } +{ } +{ June 12 2002 - RK : Added SDL_PixelTestSurfaceVsRect } +{ } +{ June 12 2002 - JF : Updated SDL_PixelTestSurfaceVsRect } +{ } +{ November 9 2002 - JF : Added Jason's boolean Surface functions } +{ } +{ December 10 2002 - DE : Added Dean's SDL_ClipLine function } +{ } +{ April 26 2003 - SS : Incorporated JF's changes to SDL_ClipLine } +{ Fixed SDL_ClipLine bug for non-zero cliprect x, y } +{ Added overloaded SDL_DrawLine for dashed lines } +{ } +{******************************************************************************} +{ + $Log: sdlutils.pas,v $ + Revision 1.4 2004/06/02 19:38:53 savage + Changes to SDL_GradientFillRect as suggested by + Ángel Eduardo García Hernández. Many thanks. + + Revision 1.3 2004/05/29 23:11:54 savage + Changes to SDL_ScaleSurfaceRect as suggested by + Ángel Eduardo García Hernández to fix a colour issue with the function. Many thanks. + + Revision 1.2 2004/02/14 00:23:39 savage + As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. + + Revision 1.1 2004/02/05 00:08:20 savage + Module 1.0 release + + +} + +interface + +{$i jedi-sdl.inc} + +uses +{$IFDEF UNIX} + Types, + Xlib, +{$ENDIF} + SysUtils, + sdl; + +type + TGradientStyle = ( gsHorizontal, gsVertical ); + +// Pixel procedures +function SDL_PixelTest( SrcSurface1 : PSDL_Surface; SrcRect1 : PSDL_Rect; SrcSurface2 : + PSDL_Surface; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : Boolean; + +function SDL_GetPixel( SrcSurface : PSDL_Surface; x : integer; y : integer ) : Uint32; + +procedure SDL_PutPixel( DstSurface : PSDL_Surface; x : integer; y : integer; pixel : + Uint32 ); + +procedure SDL_AddPixel( DstSurface : PSDL_Surface; x : cardinal; y : cardinal; Color : + cardinal ); + +procedure SDL_SubPixel( DstSurface : PSDL_Surface; x : cardinal; y : cardinal; Color : + cardinal ); + +// Line procedures +procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ); overload; + +procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ; DashLength, DashSpace : byte ); overload; + +procedure SDL_AddLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ); + +procedure SDL_SubLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ); + +// Surface procedures +procedure SDL_AddSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); + +procedure SDL_SubSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); + +procedure SDL_MonoSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect; Color : cardinal ); + +procedure SDL_TexturedSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect; Texture : PSDL_Surface; + TextureRect : PSDL_Rect ); + +procedure SDL_ZoomSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; DstRect : PSDL_Rect ); + +procedure SDL_WarpSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; UL, UR, LR, LL : PPoint ); + +// Flip procedures +procedure SDL_FlipRectH( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); + +procedure SDL_FlipRectV( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); + +function PSDLRect( aLeft, aTop, aWidth, aHeight : integer ) : PSDL_Rect; + +function SDLRect( aLeft, aTop, aWidth, aHeight : integer ) : TSDL_Rect; overload; + +function SDLRect( aRect : TRect ) : TSDL_Rect; overload; + +function SDL_ScaleSurfaceRect( SrcSurface : PSDL_Surface; SrcX1, SrcY1, SrcW, SrcH, + Width, Height : integer ) : PSDL_Surface; + +procedure SDL_ScrollY( DstSurface : PSDL_Surface; DifY : integer ); + +procedure SDL_ScrollX( DstSurface : PSDL_Surface; DifX : integer ); + +procedure SDL_RotateDeg( DstSurface, SrcSurface : PSDL_Surface; SrcRect : + PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Integer ); + +procedure SDL_RotateRad( DstSurface, SrcSurface : PSDL_Surface; SrcRect : + PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Single ); + +function ValidateSurfaceRect( DstSurface : PSDL_Surface; dstrect : PSDL_Rect ) : TSDL_Rect; + +// Fill Rect routine +procedure SDL_FillRectAdd( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); + +procedure SDL_FillRectSub( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); + +procedure SDL_GradientFillRect( DstSurface : PSDL_Surface; const Rect : PSDL_Rect; const StartColor, EndColor : TSDL_Color; const Style : TGradientStyle ); + +// NOTE for All SDL_2xblit... function : the dest surface must be 2x of the source surface! +procedure SDL_2xBlit(Src, Dest: PSDL_Surface); + +procedure SDL_Scanline2xBlit(Src, Dest: PSDL_Surface); + +procedure SDL_50Scanline2xBlit(Src, Dest: PSDL_Surface); + +// +function SDL_PixelTestSurfaceVsRect( SrcSurface1 : PSDL_Surface; SrcRect1 : +PSDL_Rect; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : +boolean; + +// Jason's boolean Surface functions +procedure SDL_ORSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); + +procedure SDL_ANDSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); + + +procedure SDL_GTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); + +procedure SDL_LTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); + +function SDL_ClipLine(var x1,y1,x2,y2: Integer; ClipRect: PSDL_Rect) : boolean; + +implementation + +uses + Math; + +function SDL_PixelTest( SrcSurface1 : PSDL_Surface; SrcRect1 : PSDL_Rect; SrcSurface2 : + PSDL_Surface; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : boolean; +var + Src_Rect1, Src_Rect2 : TSDL_Rect; + right1, bottom1 : integer; + right2, bottom2 : integer; + Scan1Start, Scan2Start, ScanWidth, ScanHeight : cardinal; + Mod1, Mod2 : cardinal; + Addr1, Addr2 : cardinal; + BPP : cardinal; + Pitch1, Pitch2 : cardinal; + TransparentColor1, TransparentColor2 : cardinal; + tx, ty : cardinal; + StartTick : cardinal; + Color1, Color2 : cardinal; +begin + Result := false; + if SrcRect1 = nil then + begin + with Src_Rect1 do + begin + x := 0; + y := 0; + w := SrcSurface1.w; + h := SrcSurface1.h; + end; + end + else + Src_Rect1 := SrcRect1^; + if SrcRect2 = nil then + begin + with Src_Rect2 do + begin + x := 0; + y := 0; + w := SrcSurface2.w; + h := SrcSurface2.h; + end; + end + else + Src_Rect2 := SrcRect2^; + with Src_Rect1 do + begin + Right1 := Left1 + w; + Bottom1 := Top1 + h; + end; + with Src_Rect2 do + begin + Right2 := Left2 + w; + Bottom2 := Top2 + h; + end; + if ( Left1 >= Right2 ) or ( Right1 <= Left2 ) or ( Top1 >= Bottom2 ) or ( Bottom1 <= + Top2 ) then + exit; + if Left1 <= Left2 then + begin + // 1. left, 2. right + Scan1Start := Src_Rect1.x + Left2 - Left1; + Scan2Start := Src_Rect2.x; + ScanWidth := Right1 - Left2; + with Src_Rect2 do + if ScanWidth > w then + ScanWidth := w; + end + else + begin + // 1. right, 2. left + Scan1Start := Src_Rect1.x; + Scan2Start := Src_Rect2.x + Left1 - Left2; + ScanWidth := Right2 - Left1; + with Src_Rect1 do + if ScanWidth > w then + ScanWidth := w; + end; + with SrcSurface1^ do + begin + Pitch1 := Pitch; + Addr1 := cardinal( Pixels ); + inc( Addr1, Pitch1 * UInt32( Src_Rect1.y ) ); + with format^ do + begin + BPP := BytesPerPixel; + TransparentColor1 := colorkey; + end; + end; + with SrcSurface2^ do + begin + TransparentColor2 := format.colorkey; + Pitch2 := Pitch; + Addr2 := cardinal( Pixels ); + inc( Addr2, Pitch2 * UInt32( Src_Rect2.y ) ); + end; + Mod1 := Pitch1 - ( ScanWidth * BPP ); + Mod2 := Pitch2 - ( ScanWidth * BPP ); + inc( Addr1, BPP * Scan1Start ); + inc( Addr2, BPP * Scan2Start ); + if Top1 <= Top2 then + begin + // 1. up, 2. down + ScanHeight := Bottom1 - Top2; + if ScanHeight > Src_Rect2.h then + ScanHeight := Src_Rect2.h; + inc( Addr1, Pitch1 * UInt32( Top2 - Top1 ) ); + end + else + begin + // 1. down, 2. up + ScanHeight := Bottom2 - Top1; + if ScanHeight > Src_Rect1.h then + ScanHeight := Src_Rect1.h; + inc( Addr2, Pitch2 * UInt32( Top1 - Top2 ) ); + end; + case BPP of + 1 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PByte( Addr1 )^ <> TransparentColor1 ) and ( PByte( Addr2 )^ <> + TransparentColor2 ) then + begin + Result := true; + exit; + end; + inc( Addr1 ); + inc( Addr2 ); + end; + inc( Addr1, Mod1 ); + inc( Addr2, Mod2 ); + end; + 2 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PWord( Addr1 )^ <> TransparentColor1 ) and ( PWord( Addr2 )^ <> + TransparentColor2 ) then + begin + Result := true; + exit; + end; + inc( Addr1, 2 ); + inc( Addr2, 2 ); + end; + inc( Addr1, Mod1 ); + inc( Addr2, Mod2 ); + end; + 3 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + Color1 := PLongWord( Addr1 )^ and $00FFFFFF; + Color2 := PLongWord( Addr2 )^ and $00FFFFFF; + if ( Color1 <> TransparentColor1 ) and ( Color2 <> TransparentColor2 ) + then + begin + Result := true; + exit; + end; + inc( Addr1, 3 ); + inc( Addr2, 3 ); + end; + inc( Addr1, Mod1 ); + inc( Addr2, Mod2 ); + end; + 4 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PLongWord( Addr1 )^ <> TransparentColor1 ) and ( PLongWord( Addr2 )^ <> + TransparentColor2 ) then + begin + Result := true; + exit; + end; + inc( Addr1, 4 ); + inc( Addr2, 4 ); + end; + inc( Addr1, Mod1 ); + inc( Addr2, Mod2 ); + end; + end; +end; + +procedure SDL_AddPixel( DstSurface : PSDL_Surface; x : cardinal; y : cardinal; Color : + cardinal ); +var + SrcColor : cardinal; + Addr : cardinal; + R, G, B : cardinal; +begin + if Color = 0 then + exit; + with DstSurface^ do + begin + Addr := cardinal( Pixels ) + y * Pitch + x * format.BytesPerPixel; + SrcColor := PUInt32( Addr )^; + case format.BitsPerPixel of + 8 : + begin + R := SrcColor and $E0 + Color and $E0; + G := SrcColor and $1C + Color and $1C; + B := SrcColor and $03 + Color and $03; + if R > $E0 then + R := $E0; + if G > $1C then + G := $1C; + if B > $03 then + B := $03; + PUInt8( Addr )^ := R or G or B; + end; + 15 : + begin + R := SrcColor and $7C00 + Color and $7C00; + G := SrcColor and $03E0 + Color and $03E0; + B := SrcColor and $001F + Color and $001F; + if R > $7C00 then + R := $7C00; + if G > $03E0 then + G := $03E0; + if B > $001F then + B := $001F; + PUInt16( Addr )^ := R or G or B; + end; + 16 : + begin + R := SrcColor and $F800 + Color and $F800; + G := SrcColor and $07C0 + Color and $07C0; + B := SrcColor and $001F + Color and $001F; + if R > $F800 then + R := $F800; + if G > $07C0 then + G := $07C0; + if B > $001F then + B := $001F; + PUInt16( Addr )^ := R or G or B; + end; + 24 : + begin + R := SrcColor and $00FF0000 + Color and $00FF0000; + G := SrcColor and $0000FF00 + Color and $0000FF00; + B := SrcColor and $000000FF + Color and $000000FF; + if R > $FF0000 then + R := $FF0000; + if G > $00FF00 then + G := $00FF00; + if B > $0000FF then + B := $0000FF; + PUInt32( Addr )^ := SrcColor and $FF000000 or R or G or B; + end; + 32 : + begin + R := SrcColor and $00FF0000 + Color and $00FF0000; + G := SrcColor and $0000FF00 + Color and $0000FF00; + B := SrcColor and $000000FF + Color and $000000FF; + if R > $FF0000 then + R := $FF0000; + if G > $00FF00 then + G := $00FF00; + if B > $0000FF then + B := $0000FF; + PUInt32( Addr )^ := R or G or B; + end; + end; + end; +end; + +procedure SDL_SubPixel( DstSurface : PSDL_Surface; x : cardinal; y : cardinal; Color : + cardinal ); +var + SrcColor : cardinal; + Addr : cardinal; + R, G, B : cardinal; +begin + if Color = 0 then + exit; + with DstSurface^ do + begin + Addr := cardinal( Pixels ) + y * Pitch + x * format.BytesPerPixel; + SrcColor := PUInt32( Addr )^; + case format.BitsPerPixel of + 8 : + begin + R := SrcColor and $E0 - Color and $E0; + G := SrcColor and $1C - Color and $1C; + B := SrcColor and $03 - Color and $03; + if R > $E0 then + R := 0; + if G > $1C then + G := 0; + if B > $03 then + B := 0; + PUInt8( Addr )^ := R or G or B; + end; + 15 : + begin + R := SrcColor and $7C00 - Color and $7C00; + G := SrcColor and $03E0 - Color and $03E0; + B := SrcColor and $001F - Color and $001F; + if R > $7C00 then + R := 0; + if G > $03E0 then + G := 0; + if B > $001F then + B := 0; + PUInt16( Addr )^ := R or G or B; + end; + 16 : + begin + R := SrcColor and $F800 - Color and $F800; + G := SrcColor and $07C0 - Color and $07C0; + B := SrcColor and $001F - Color and $001F; + if R > $F800 then + R := 0; + if G > $07C0 then + G := 0; + if B > $001F then + B := 0; + PUInt16( Addr )^ := R or G or B; + end; + 24 : + begin + R := SrcColor and $00FF0000 - Color and $00FF0000; + G := SrcColor and $0000FF00 - Color and $0000FF00; + B := SrcColor and $000000FF - Color and $000000FF; + if R > $FF0000 then + R := 0; + if G > $00FF00 then + G := 0; + if B > $0000FF then + B := 0; + PUInt32( Addr )^ := SrcColor and $FF000000 or R or G or B; + end; + 32 : + begin + R := SrcColor and $00FF0000 - Color and $00FF0000; + G := SrcColor and $0000FF00 - Color and $0000FF00; + B := SrcColor and $000000FF - Color and $000000FF; + if R > $FF0000 then + R := 0; + if G > $00FF00 then + G := 0; + if B > $0000FF then + B := 0; + PUInt32( Addr )^ := R or G or B; + end; + end; + end; +end; +// This procedure works on 8, 15, 16, 24 and 32 bits color depth surfaces. +// In 8 bit color depth mode the procedure works with the default packed +// palette (RRRGGGBB). It handles all clipping. + +procedure SDL_AddSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := Format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + WorkY := Src.h; + case bits of + 8 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt8( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt8( DestAddr )^; + if Pixel2 > 0 then + begin + R := Pixel1 and $E0 + Pixel2 and $E0; + G := Pixel1 and $1C + Pixel2 and $1C; + B := Pixel1 and $03 + Pixel2 and $03; + if R > $E0 then + R := $E0; + if G > $1C then + G := $1C; + if B > $03 then + B := $03; + PUInt8( DestAddr )^ := R or G or B; + end + else + PUInt8( DestAddr )^ := Pixel1; + end; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 15 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + R := Pixel1 and $7C00 + Pixel2 and $7C00; + G := Pixel1 and $03E0 + Pixel2 and $03E0; + B := Pixel1 and $001F + Pixel2 and $001F; + if R > $7C00 then + R := $7C00; + if G > $03E0 then + G := $03E0; + if B > $001F then + B := $001F; + PUInt16( DestAddr )^ := R or G or B; + end + else + PUInt16( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 16 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + R := Pixel1 and $F800 + Pixel2 and $F800; + G := Pixel1 and $07E0 + Pixel2 and $07E0; + B := Pixel1 and $001F + Pixel2 and $001F; + if R > $F800 then + R := $F800; + if G > $07E0 then + G := $07E0; + if B > $001F then + B := $001F; + PUInt16( DestAddr )^ := R or G or B; + end + else + PUInt16( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 24 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; + if Pixel2 > 0 then + begin + R := Pixel1 and $FF0000 + Pixel2 and $FF0000; + G := Pixel1 and $00FF00 + Pixel2 and $00FF00; + B := Pixel1 and $0000FF + Pixel2 and $0000FF; + if R > $FF0000 then + R := $FF0000; + if G > $00FF00 then + G := $00FF00; + if B > $0000FF then + B := $0000FF; + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or ( R or G or B ); + end + else + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or Pixel1; + end; + inc( SrcAddr, 3 ); + inc( DestAddr, 3 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 32 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^; + if Pixel2 > 0 then + begin + R := Pixel1 and $FF0000 + Pixel2 and $FF0000; + G := Pixel1 and $00FF00 + Pixel2 and $00FF00; + B := Pixel1 and $0000FF + Pixel2 and $0000FF; + if R > $FF0000 then + R := $FF0000; + if G > $00FF00 then + G := $00FF00; + if B > $0000FF then + B := $0000FF; + PUInt32( DestAddr )^ := R or G or B; + end + else + PUInt32( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 4 ); + inc( DestAddr, 4 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); +end; + +procedure SDL_SubSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + _ebx, _esi, _edi, _esp : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := Format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := DestSurface.Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + WorkY := Src.h; + case bits of + 8 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt8( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt8( DestAddr )^; + if Pixel2 > 0 then + begin + R := Pixel2 and $E0 - Pixel1 and $E0; + G := Pixel2 and $1C - Pixel1 and $1C; + B := Pixel2 and $03 - Pixel1 and $03; + if R > $E0 then + R := 0; + if G > $1C then + G := 0; + if B > $03 then + B := 0; + PUInt8( DestAddr )^ := R or G or B; + end; + end; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 15 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + R := Pixel2 and $7C00 - Pixel1 and $7C00; + G := Pixel2 and $03E0 - Pixel1 and $03E0; + B := Pixel2 and $001F - Pixel1 and $001F; + if R > $7C00 then + R := 0; + if G > $03E0 then + G := 0; + if B > $001F then + B := 0; + PUInt16( DestAddr )^ := R or G or B; + end; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 16 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + R := Pixel2 and $F800 - Pixel1 and $F800; + G := Pixel2 and $07E0 - Pixel1 and $07E0; + B := Pixel2 and $001F - Pixel1 and $001F; + if R > $F800 then + R := 0; + if G > $07E0 then + G := 0; + if B > $001F then + B := 0; + PUInt16( DestAddr )^ := R or G or B; + end; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 24 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; + if Pixel2 > 0 then + begin + R := Pixel2 and $FF0000 - Pixel1 and $FF0000; + G := Pixel2 and $00FF00 - Pixel1 and $00FF00; + B := Pixel2 and $0000FF - Pixel1 and $0000FF; + if R > $FF0000 then + R := 0; + if G > $00FF00 then + G := 0; + if B > $0000FF then + B := 0; + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or ( R or G or B ); + end; + end; + inc( SrcAddr, 3 ); + inc( DestAddr, 3 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 32 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^; + if Pixel2 > 0 then + begin + R := Pixel2 and $FF0000 - Pixel1 and $FF0000; + G := Pixel2 and $00FF00 - Pixel1 and $00FF00; + B := Pixel2 and $0000FF - Pixel1 and $0000FF; + if R > $FF0000 then + R := 0; + if G > $00FF00 then + G := 0; + if B > $0000FF then + B := 0; + PUInt32( DestAddr )^ := R or G or B; + end + else + PUInt32( DestAddr )^ := Pixel2; + end; + inc( SrcAddr, 4 ); + inc( DestAddr, 4 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); +end; + +procedure SDL_MonoSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect; Color : cardinal ); +var + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + _ebx, _esi, _edi, _esp : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + TransparentColor, SrcColor : cardinal; + BPP : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := Format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + BPP := DestSurface.Format.BytesPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + WorkY := Src.h; + case BPP of + 1 : + begin + repeat + WorkX := Src.w; + repeat + SrcColor := PUInt8( SrcAddr )^; + if SrcColor <> TransparentColor then + PUInt8( DestAddr )^ := SrcColor; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 2 : + begin + repeat + WorkX := Src.w; + repeat + SrcColor := PUInt16( SrcAddr )^; + if SrcColor <> TransparentColor then + PUInt16( DestAddr )^ := SrcColor; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 3 : + begin + repeat + WorkX := Src.w; + repeat + SrcColor := PUInt32( SrcAddr )^ and $FFFFFF; + if SrcColor <> TransparentColor then + PUInt32( DestAddr )^ := ( PUInt32( DestAddr )^ and $FFFFFF ) or SrcColor; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 4 : + begin + repeat + WorkX := Src.w; + repeat + SrcColor := PUInt32( SrcAddr )^; + if SrcColor <> TransparentColor then + PUInt32( DestAddr )^ := SrcColor; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); +end; +// TextureRect.w and TextureRect.h are not used. +// The TextureSurface's size MUST larger than the drawing rectangle!!! + +procedure SDL_TexturedSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect; Texture : PSDL_Surface; + TextureRect : PSDL_Rect ); +var + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr, TextAddr : cardinal; + _ebx, _esi, _edi, _esp : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod, TextMod : cardinal; + SrcColor, TransparentColor, TextureColor : cardinal; + BPP : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + BPP := DestSurface.Format.BitsPerPixel; + end; + with Texture^ do + begin + TextAddr := cardinal( Pixels ) + UInt32( TextureRect.y ) * Pitch + + UInt32( TextureRect.x ) * Format.BytesPerPixel; + TextMod := Pitch - Src.w * Format.BytesPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + SDL_LockSurface( Texture ); + WorkY := Src.h; + case BPP of + 1 : + begin + repeat + WorkX := Src.w; + repeat + SrcColor := PUInt8( SrcAddr )^; + if SrcColor <> TransparentColor then + PUInt8( DestAddr )^ := PUint8( TextAddr )^; + inc( SrcAddr ); + inc( DestAddr ); + inc( TextAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + inc( TextAddr, TextMod ); + dec( WorkY ); + until WorkY = 0; + end; + 2 : + begin + repeat + WorkX := Src.w; + repeat + SrcColor := PUInt16( SrcAddr )^; + if SrcColor <> TransparentColor then + PUInt16( DestAddr )^ := PUInt16( TextAddr )^; + inc( SrcAddr ); + inc( DestAddr ); + inc( TextAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + inc( TextAddr, TextMod ); + dec( WorkY ); + until WorkY = 0; + end; + 3 : + begin + repeat + WorkX := Src.w; + repeat + SrcColor := PUInt32( SrcAddr )^ and $FFFFFF; + if SrcColor <> TransparentColor then + PUInt32( DestAddr )^ := ( PUInt32( DestAddr )^ and $FFFFFF ) or ( PUInt32( TextAddr )^ and $FFFFFF ); + inc( SrcAddr ); + inc( DestAddr ); + inc( TextAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + inc( TextAddr, TextMod ); + dec( WorkY ); + until WorkY = 0; + end; + 4 : + begin + repeat + WorkX := Src.w; + repeat + SrcColor := PUInt32( SrcAddr )^; + if SrcColor <> TransparentColor then + PUInt32( DestAddr )^ := PUInt32( TextAddr )^; + inc( SrcAddr ); + inc( DestAddr ); + inc( TextAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + inc( TextAddr, TextMod ); + dec( WorkY ); + until WorkY = 0; + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); + SDL_UnlockSurface( Texture ); +end; + +procedure SDL_ZoomSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; DstRect : PSDL_Rect ); +var + xc, yc : cardinal; + rx, wx, ry, wy, ry16 : cardinal; + color : cardinal; + modx, mody : cardinal; +begin + // Warning! No checks for surface pointers!!! + if srcrect = nil then + srcrect := @SrcSurface.clip_rect; + if dstrect = nil then + dstrect := @DstSurface.clip_rect; + if SDL_MustLock( SrcSurface ) then + SDL_LockSurface( SrcSurface ); + if SDL_MustLock( DstSurface ) then + SDL_LockSurface( DstSurface ); + modx := trunc( ( srcrect.w / dstrect.w ) * 65536 ); + mody := trunc( ( srcrect.h / dstrect.h ) * 65536 ); + //rx := srcrect.x * 65536; + ry := srcrect.y * 65536; + wy := dstrect.y; + for yc := 0 to dstrect.h - 1 do + begin + rx := srcrect.x * 65536; + wx := dstrect.x; + ry16 := ry shr 16; + for xc := 0 to dstrect.w - 1 do + begin + color := SDL_GetPixel( SrcSurface, rx shr 16, ry16 ); + SDL_PutPixel( DstSurface, wx, wy, color ); + rx := rx + modx; + inc( wx ); + end; + ry := ry + mody; + inc( wy ); + end; + if SDL_MustLock( SrcSurface ) then + SDL_UnlockSurface( SrcSurface ); + if SDL_MustLock( DstSurface ) then + SDL_UnlockSurface( DstSurface ); +end; +// Re-map a rectangular area into an area defined by four vertices +// Converted from C to Pascal by KiCHY + +procedure SDL_WarpSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; UL, UR, LR, LL : PPoint ); +const + SHIFTS = 15; // Extend ints to limit round-off error (try 2 - 20) + THRESH = 1 shl SHIFTS; // Threshold for pixel size value + procedure CopySourceToDest( UL, UR, LR, LL : TPoint; x1, y1, x2, y2 : cardinal ); + var + tm, lm, rm, bm, m : TPoint; + mx, my : cardinal; + cr : cardinal; + begin + // Does the destination area specify a single pixel? + if ( ( abs( ul.x - ur.x ) < THRESH ) and + ( abs( ul.x - lr.x ) < THRESH ) and + ( abs( ul.x - ll.x ) < THRESH ) and + ( abs( ul.y - ur.y ) < THRESH ) and + ( abs( ul.y - lr.y ) < THRESH ) and + ( abs( ul.y - ll.y ) < THRESH ) ) then + begin // Yes + cr := SDL_GetPixel( SrcSurface, ( x1 shr SHIFTS ), ( y1 shr SHIFTS ) ); + SDL_PutPixel( DstSurface, ( ul.x shr SHIFTS ), ( ul.y shr SHIFTS ), cr ); + end + else + begin // No + // Quarter the source and the destination, and then recurse + tm.x := ( ul.x + ur.x ) shr 1; + tm.y := ( ul.y + ur.y ) shr 1; + bm.x := ( ll.x + lr.x ) shr 1; + bm.y := ( ll.y + lr.y ) shr 1; + lm.x := ( ul.x + ll.x ) shr 1; + lm.y := ( ul.y + ll.y ) shr 1; + rm.x := ( ur.x + lr.x ) shr 1; + rm.y := ( ur.y + lr.y ) shr 1; + m.x := ( tm.x + bm.x ) shr 1; + m.y := ( tm.y + bm.y ) shr 1; + mx := ( x1 + x2 ) shr 1; + my := ( y1 + y2 ) shr 1; + CopySourceToDest( ul, tm, m, lm, x1, y1, mx, my ); + CopySourceToDest( tm, ur, rm, m, mx, y1, x2, my ); + CopySourceToDest( m, rm, lr, bm, mx, my, x2, y2 ); + CopySourceToDest( lm, m, bm, ll, x1, my, mx, y2 ); + end; + end; +var + _UL, _UR, _LR, _LL : TPoint; + Rect_x, Rect_y, Rect_w, Rect_h : integer; +begin + if SDL_MustLock( SrcSurface ) then + SDL_LockSurface( SrcSurface ); + if SDL_MustLock( DstSurface ) then + SDL_LockSurface( DstSurface ); + if SrcRect = nil then + begin + Rect_x := 0; + Rect_y := 0; + Rect_w := ( SrcSurface.w - 1 ) shl SHIFTS; + Rect_h := ( SrcSurface.h - 1 ) shl SHIFTS; + end + else + begin + Rect_x := SrcRect.x; + Rect_y := SrcRect.y; + Rect_w := ( SrcRect.w - 1 ) shl SHIFTS; + Rect_h := ( SrcRect.h - 1 ) shl SHIFTS; + end; + // Shift all values to help reduce round-off error. + _ul.x := ul.x shl SHIFTS; + _ul.y := ul.y shl SHIFTS; + _ur.x := ur.x shl SHIFTS; + _ur.y := ur.y shl SHIFTS; + _lr.x := lr.x shl SHIFTS; + _lr.y := lr.y shl SHIFTS; + _ll.x := ll.x shl SHIFTS; + _ll.y := ll.y shl SHIFTS; + CopySourceToDest( _ul, _ur, _lr, _ll, Rect_x, Rect_y, Rect_w, Rect_h ); + if SDL_MustLock( SrcSurface ) then + SDL_UnlockSurface( SrcSurface ); + if SDL_MustLock( DstSurface ) then + SDL_UnlockSurface( DstSurface ); +end; + +// Draw a line between x1,y1 and x2,y2 to the given surface +// NOTE: The surface must be locked before calling this! +procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ); +var + dx, dy, sdx, sdy, x, y, px, py : integer; +begin + dx := x2 - x1; + dy := y2 - y1; + if dx < 0 then + sdx := -1 + else + sdx := 1; + if dy < 0 then + sdy := -1 + else + sdy := 1; + dx := sdx * dx + 1; + dy := sdy * dy + 1; + x := 0; + y := 0; + px := x1; + py := y1; + if dx >= dy then + begin + for x := 0 to dx - 1 do + begin + SDL_PutPixel( DstSurface, px, py, Color ); + y := y + dy; + if y >= dx then + begin + y := y - dx; + py := py + sdy; + end; + px := px + sdx; + end; + end + else + begin + for y := 0 to dy - 1 do + begin + SDL_PutPixel( DstSurface, px, py, Color ); + x := x + dx; + if x >= dy then + begin + x := x - dy; + px := px + sdx; + end; + py := py + sdy; + end; + end; +end; + +// Draw a dashed line between x1,y1 and x2,y2 to the given surface +// NOTE: The surface must be locked before calling this! +procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ; DashLength, DashSpace : byte ); overload; +var + dx, dy, sdx, sdy, x, y, px, py, counter : integer; drawdash : boolean; +begin + counter := 0; + drawdash := true; //begin line drawing with dash + + //Avoid invalid user-passed dash parameters + if (DashLength < 1) + then DashLength := 1; + if (DashSpace < 1) + then DashSpace := 0; + + dx := x2 - x1; + dy := y2 - y1; + if dx < 0 then + sdx := -1 + else + sdx := 1; + if dy < 0 then + sdy := -1 + else + sdy := 1; + dx := sdx * dx + 1; + dy := sdy * dy + 1; + x := 0; + y := 0; + px := x1; + py := y1; + if dx >= dy then + begin + for x := 0 to dx - 1 do + begin + + //Alternate drawing dashes, or leaving spaces + if drawdash then + begin + SDL_PutPixel( DstSurface, px, py, Color ); + inc(counter); + if (counter > DashLength-1) and (DashSpace > 0) then + begin + drawdash := false; + counter := 0; + end; + end + else //space + begin + inc(counter); + if counter > DashSpace-1 then + begin + drawdash := true; + counter := 0; + end; + end; + + y := y + dy; + if y >= dx then + begin + y := y - dx; + py := py + sdy; + end; + px := px + sdx; + end; + end + else + begin + for y := 0 to dy - 1 do + begin + + //Alternate drawing dashes, or leaving spaces + if drawdash then + begin + SDL_PutPixel( DstSurface, px, py, Color ); + inc(counter); + if (counter > DashLength-1) and (DashSpace > 0) then + begin + drawdash := false; + counter := 0; + end; + end + else //space + begin + inc(counter); + if counter > DashSpace-1 then + begin + drawdash := true; + counter := 0; + end; + end; + + x := x + dx; + if x >= dy then + begin + x := x - dy; + px := px + sdx; + end; + py := py + sdy; + end; + end; +end; + +procedure SDL_AddLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ); +var + dx, dy, sdx, sdy, x, y, px, py : integer; +begin + dx := x2 - x1; + dy := y2 - y1; + if dx < 0 then + sdx := -1 + else + sdx := 1; + if dy < 0 then + sdy := -1 + else + sdy := 1; + dx := sdx * dx + 1; + dy := sdy * dy + 1; + x := 0; + y := 0; + px := x1; + py := y1; + if dx >= dy then + begin + for x := 0 to dx - 1 do + begin + SDL_AddPixel( DstSurface, px, py, Color ); + y := y + dy; + if y >= dx then + begin + y := y - dx; + py := py + sdy; + end; + px := px + sdx; + end; + end + else + begin + for y := 0 to dy - 1 do + begin + SDL_AddPixel( DstSurface, px, py, Color ); + x := x + dx; + if x >= dy then + begin + x := x - dy; + px := px + sdx; + end; + py := py + sdy; + end; + end; +end; + +procedure SDL_SubLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : + cardinal ); +var + dx, dy, sdx, sdy, x, y, px, py : integer; +begin + dx := x2 - x1; + dy := y2 - y1; + if dx < 0 then + sdx := -1 + else + sdx := 1; + if dy < 0 then + sdy := -1 + else + sdy := 1; + dx := sdx * dx + 1; + dy := sdy * dy + 1; + x := 0; + y := 0; + px := x1; + py := y1; + if dx >= dy then + begin + for x := 0 to dx - 1 do + begin + SDL_SubPixel( DstSurface, px, py, Color ); + y := y + dy; + if y >= dx then + begin + y := y - dx; + py := py + sdy; + end; + px := px + sdx; + end; + end + else + begin + for y := 0 to dy - 1 do + begin + SDL_SubPixel( DstSurface, px, py, Color ); + x := x + dx; + if x >= dy then + begin + x := x - dy; + px := px + sdx; + end; + py := py + sdy; + end; + end; +end; + +// flips a rectangle vertically on given surface +procedure SDL_FlipRectV( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); +var + TmpRect : TSDL_Rect; + Locked : boolean; + y, FlipLength, RowLength : integer; + Row1, Row2 : Pointer; + OneRow : TByteArray; // Optimize it if you wish +begin + if DstSurface <> nil then + begin + if Rect = nil then + begin // if Rect=nil then we flip the whole surface + TmpRect := SDLRect( 0, 0, DstSurface.w, DstSurface.h ); + Rect := @TmpRect; + end; + FlipLength := Rect^.h shr 1 - 1; + RowLength := Rect^.w * DstSurface^.format.BytesPerPixel; + if SDL_MustLock( DstSurface ) then + begin + Locked := true; + SDL_LockSurface( DstSurface ); + end + else + Locked := false; + Row1 := pointer( cardinal( DstSurface^.Pixels ) + UInt32( Rect^.y ) * + DstSurface^.Pitch ); + Row2 := pointer( cardinal( DstSurface^.Pixels ) + ( UInt32( Rect^.y ) + Rect^.h - 1 ) + * DstSurface^.Pitch ); + for y := 0 to FlipLength do + begin + Move( Row1^, OneRow, RowLength ); + Move( Row2^, Row1^, RowLength ); + Move( OneRow, Row2^, RowLength ); + inc( cardinal( Row1 ), DstSurface^.Pitch ); + dec( cardinal( Row2 ), DstSurface^.Pitch ); + end; + if Locked then + SDL_UnlockSurface( DstSurface ); + end; +end; + +// flips a rectangle horizontally on given surface +procedure SDL_FlipRectH( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); +type + T24bit = packed array[ 0..2 ] of byte; + T24bitArray = packed array[ 0..8191 ] of T24bit; + P24bitArray = ^T24bitArray; + TLongWordArray = array[ 0..8191 ] of LongWord; + PLongWordArray = ^TLongWordArray; +var + TmpRect : TSDL_Rect; + Row8bit : PByteArray; + Row16bit : PWordArray; + Row24bit : P24bitArray; + Row32bit : PLongWordArray; + y, x, RightSide, FlipLength : integer; + Pixel : cardinal; + Pixel24 : T24bit; + Locked : boolean; +begin + if DstSurface <> nil then + begin + if Rect = nil then + begin + TmpRect := SDLRect( 0, 0, DstSurface.w, DstSurface.h ); + Rect := @TmpRect; + end; + FlipLength := Rect^.w shr 1 - 1; + if SDL_MustLock( DstSurface ) then + begin + Locked := true; + SDL_LockSurface( DstSurface ); + end + else + Locked := false; + case DstSurface^.format.BytesPerPixel of + 1 : + begin + Row8Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * + DstSurface^.pitch ); + for y := 1 to Rect^.h do + begin + RightSide := Rect^.w - 1; + for x := 0 to FlipLength do + begin + Pixel := Row8Bit^[ x ]; + Row8Bit^[ x ] := Row8Bit^[ RightSide ]; + Row8Bit^[ RightSide ] := Pixel; + dec( RightSide ); + end; + inc( cardinal( Row8Bit ), DstSurface^.pitch ); + end; + end; + 2 : + begin + Row16Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * + DstSurface^.pitch ); + for y := 1 to Rect^.h do + begin + RightSide := Rect^.w - 1; + for x := 0 to FlipLength do + begin + Pixel := Row16Bit^[ x ]; + Row16Bit^[ x ] := Row16Bit^[ RightSide ]; + Row16Bit^[ RightSide ] := Pixel; + dec( RightSide ); + end; + inc( cardinal( Row16Bit ), DstSurface^.pitch ); + end; + end; + 3 : + begin + Row24Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * + DstSurface^.pitch ); + for y := 1 to Rect^.h do + begin + RightSide := Rect^.w - 1; + for x := 0 to FlipLength do + begin + Pixel24 := Row24Bit^[ x ]; + Row24Bit^[ x ] := Row24Bit^[ RightSide ]; + Row24Bit^[ RightSide ] := Pixel24; + dec( RightSide ); + end; + inc( cardinal( Row24Bit ), DstSurface^.pitch ); + end; + end; + 4 : + begin + Row32Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * + DstSurface^.pitch ); + for y := 1 to Rect^.h do + begin + RightSide := Rect^.w - 1; + for x := 0 to FlipLength do + begin + Pixel := Row32Bit^[ x ]; + Row32Bit^[ x ] := Row32Bit^[ RightSide ]; + Row32Bit^[ RightSide ] := Pixel; + dec( RightSide ); + end; + inc( cardinal( Row32Bit ), DstSurface^.pitch ); + end; + end; + end; + if Locked then + SDL_UnlockSurface( DstSurface ); + end; +end; + +// Use with caution! The procedure allocates memory for TSDL_Rect and return with its pointer. +// But you MUST free it after you don't need it anymore!!! +function PSDLRect( aLeft, aTop, aWidth, aHeight : integer ) : PSDL_Rect; +var + Rect : PSDL_Rect; +begin + New( Rect ); + with Rect^ do + begin + x := aLeft; + y := aTop; + w := aWidth; + h := aHeight; + end; + Result := Rect; +end; + +function SDLRect( aLeft, aTop, aWidth, aHeight : integer ) : TSDL_Rect; +begin + with result do + begin + x := aLeft; + y := aTop; + w := aWidth; + h := aHeight; + end; +end; + +function SDLRect( aRect : TRect ) : TSDL_Rect; +begin + with aRect do + result := SDLRect( Left, Top, Right - Left, Bottom - Top ); +end; + +procedure SDL_Stretch8( Surface, Dst_Surface : PSDL_Surface; x1, x2, y1, y2, yr, yw, + depth : integer ); +var + dx, dy, e, d, dx2 : integer; + src_pitch, dst_pitch : uint16; + src_pixels, dst_pixels : PUint8; +begin + if ( yw >= dst_surface^.h ) then + exit; + dx := ( x2 - x1 ); + dy := ( y2 - y1 ); + dy := dy shl 1; + e := dy - dx; + dx2 := dx shl 1; + src_pitch := Surface^.pitch; + dst_pitch := dst_surface^.pitch; + src_pixels := PUint8( integer( Surface^.pixels ) + yr * src_pitch + y1 * depth ); + dst_pixels := PUint8( integer( dst_surface^.pixels ) + yw * dst_pitch + x1 * + depth ); + for d := 0 to dx - 1 do + begin + move( src_pixels^, dst_pixels^, depth ); + while ( e >= 0 ) do + begin + inc( src_pixels, depth ); + e := e - dx2; + end; + inc( dst_pixels, depth ); + e := e + dy; + end; +end; + +function sign( x : integer ) : integer; +begin + if x > 0 then + result := 1 + else + result := -1; +end; + +// Stretches a part of a surface +function SDL_ScaleSurfaceRect( SrcSurface : PSDL_Surface; SrcX1, SrcY1, SrcW, SrcH, + Width, Height : integer ) : PSDL_Surface; +var + dst_surface : PSDL_Surface; + dx, dy, e, d, dx2, srcx2, srcy2 : integer; + destx1, desty1 : integer; +begin + srcx2 := srcx1 + SrcW; + srcy2 := srcy1 + SrcH; + result := nil; + destx1 := 0; + desty1 := 0; + dx := abs( integer( Height - desty1 ) ); + dy := abs( integer( SrcY2 - SrcY1 ) ); + e := ( dy shl 1 ) - dx; + dx2 := dx shl 1; + dy := dy shl 1; + dst_surface := SDL_CreateRGBSurface( SDL_HWPALETTE, width - destx1, Height - + desty1, + SrcSurface^.Format^.BitsPerPixel, + SrcSurface^.Format^.RMask, + SrcSurface^.Format^.GMask, + SrcSurface^.Format^.BMask, + SrcSurface^.Format^.AMask ); + if ( dst_surface^.format^.BytesPerPixel = 1 ) then + SDL_SetColors( dst_surface, @SrcSurface^.format^.palette^.colors^[ 0 ], 0, 256 ); + SDL_SetColorKey( dst_surface, sdl_srccolorkey, SrcSurface^.format^.colorkey ); + if ( SDL_MustLock( dst_surface ) ) then + if ( SDL_LockSurface( dst_surface ) < 0 ) then + exit; + for d := 0 to dx - 1 do + begin + SDL_Stretch8( SrcSurface, dst_surface, destx1, Width, SrcX1, SrcX2, SrcY1, desty1, + SrcSurface^.format^.BytesPerPixel ); + while e >= 0 do + begin + inc( SrcY1 ); + e := e - dx2; + end; + inc( desty1 ); + e := e + dy; + end; + if SDL_MUSTLOCK( dst_surface ) then + SDL_UnlockSurface( dst_surface ); + result := dst_surface; +end; + +procedure SDL_MoveLine( Surface : PSDL_Surface; x1, x2, y1, xofs, depth : integer ); +var + src_pixels, dst_pixels : PUint8; + i : integer; +begin + src_pixels := PUint8( integer( Surface^.pixels ) + Surface^.w * y1 * depth + x2 * + depth ); + dst_pixels := PUint8( integer( Surface^.pixels ) + Surface^.w * y1 * depth + ( x2 + + xofs ) * depth ); + for i := x2 downto x1 do + begin + move( src_pixels^, dst_pixels^, depth ); + dec( src_pixels ); + dec( dst_pixels ); + end; +end; +{ Return the pixel value at (x, y) +NOTE: The surface must be locked before calling this! } + +function SDL_GetPixel( SrcSurface : PSDL_Surface; x : integer; y : integer ) : Uint32; +var + bpp : UInt32; + p : PInteger; +begin + bpp := SrcSurface.format.BytesPerPixel; + // Here p is the address to the pixel we want to retrieve + p := Pointer( Uint32( SrcSurface.pixels ) + UInt32( y ) * SrcSurface.pitch + UInt32( x ) * + bpp ); + case bpp of + 1 : result := PUint8( p )^; + 2 : result := PUint16( p )^; + 3 : + if ( SDL_BYTEORDER = SDL_BIG_ENDIAN ) then + result := PUInt8Array( p )[ 0 ] shl 16 or PUInt8Array( p )[ 1 ] shl 8 or + PUInt8Array( p )[ 2 ] + else + result := PUInt8Array( p )[ 0 ] or PUInt8Array( p )[ 1 ] shl 8 or + PUInt8Array( p )[ 2 ] shl 16; + 4 : result := PUint32( p )^; + else + result := 0; // shouldn't happen, but avoids warnings + end; +end; +{ Set the pixel at (x, y) to the given value + NOTE: The surface must be locked before calling this! } + +procedure SDL_PutPixel( DstSurface : PSDL_Surface; x : integer; y : integer; pixel : + Uint32 ); +var + bpp : UInt32; + p : PInteger; +begin + bpp := DstSurface.format.BytesPerPixel; + p := Pointer( Uint32( DstSurface.pixels ) + UInt32( y ) * DstSurface.pitch + UInt32( x ) + * bpp ); + case bpp of + 1 : PUint8( p )^ := pixel; + 2 : PUint16( p )^ := pixel; + 3 : + if ( SDL_BYTEORDER = SDL_BIG_ENDIAN ) then + begin + PUInt8Array( p )[ 0 ] := ( pixel shr 16 ) and $FF; + PUInt8Array( p )[ 1 ] := ( pixel shr 8 ) and $FF; + PUInt8Array( p )[ 2 ] := pixel and $FF; + end + else + begin + PUInt8Array( p )[ 0 ] := pixel and $FF; + PUInt8Array( p )[ 1 ] := ( pixel shr 8 ) and $FF; + PUInt8Array( p )[ 2 ] := ( pixel shr 16 ) and $FF; + end; + 4 : + PUint32( p )^ := pixel; + end; +end; + +procedure SDL_ScrollY( DstSurface : PSDL_Surface; DifY : integer ); +var + r1, r2 : TSDL_Rect; + //buffer: PSDL_Surface; + YPos : Integer; +begin + if ( DstSurface <> nil ) and ( DifY <> 0 ) then + begin + //if DifY > 0 then // going up + //begin + ypos := 0; + r1.x := 0; + r2.x := 0; + r1.w := DstSurface.w; + r2.w := DstSurface.w; + r1.h := DifY; + r2.h := DifY; + while ypos < DstSurface.h do + begin + r1.y := ypos; + r2.y := ypos + DifY; + SDL_BlitSurface( DstSurface, @r2, DstSurface, @r1 ); + ypos := ypos + DifY; + end; + //end + //else + //begin // Going Down + //end; + end; +end; + +{procedure SDL_ScrollY(Surface: PSDL_Surface; DifY: integer); +var + r1, r2: TSDL_Rect; + buffer: PSDL_Surface; +begin + if (Surface <> nil) and (Dify <> 0) then + begin + buffer := SDL_CreateRGBSurface(SDL_HWSURFACE, (Surface^.w - DifY) * 2, + Surface^.h * 2, + Surface^.Format^.BitsPerPixel, 0, 0, 0, 0); + if buffer <> nil then + begin + if (buffer^.format^.BytesPerPixel = 1) then + SDL_SetColors(buffer, @Surface^.format^.palette^.colors^[0], 0, 256); + r1 := SDLRect(0, DifY, buffer^.w, buffer^.h); + r2 := SDLRect(0, 0, buffer^.w, buffer^.h); + SDL_BlitSurface(Surface, @r1, buffer, @r2); + SDL_BlitSurface(buffer, @r2, Surface, @r2); + SDL_FreeSurface(buffer); + end; + end; +end;} + +procedure SDL_ScrollX( DstSurface : PSDL_Surface; DifX : integer ); +var + r1, r2 : TSDL_Rect; + buffer : PSDL_Surface; +begin + if ( DstSurface <> nil ) and ( DifX <> 0 ) then + begin + buffer := SDL_CreateRGBSurface( SDL_HWSURFACE, ( DstSurface^.w - DifX ) * 2, + DstSurface^.h * 2, + DstSurface^.Format^.BitsPerPixel, + DstSurface^.Format^.RMask, + DstSurface^.Format^.GMask, + DstSurface^.Format^.BMask, + DstSurface^.Format^.AMask ); + if buffer <> nil then + begin + if ( buffer^.format^.BytesPerPixel = 1 ) then + SDL_SetColors( buffer, @DstSurface^.format^.palette^.colors^[ 0 ], 0, 256 ); + r1 := SDLRect( DifX, 0, buffer^.w, buffer^.h ); + r2 := SDLRect( 0, 0, buffer^.w, buffer^.h ); + SDL_BlitSurface( DstSurface, @r1, buffer, @r2 ); + SDL_BlitSurface( buffer, @r2, DstSurface, @r2 ); + SDL_FreeSurface( buffer ); + end; + end; +end; + +procedure SDL_RotateRad( DstSurface, SrcSurface : PSDL_Surface; SrcRect : + PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Single ); +var + aSin, aCos : Single; + MX, MY, DX, DY, NX, NY, SX, SY, OX, OY, Width, Height, TX, TY, RX, RY, ROX, ROY : Integer; + Colour, TempTransparentColour : UInt32; + MAXX, MAXY : Integer; +begin + // Rotate the surface to the target surface. + TempTransparentColour := SrcSurface.format.colorkey; + if srcRect.w > srcRect.h then + begin + Width := srcRect.w; + Height := srcRect.w; + end + else + begin + Width := srcRect.h; + Height := srcRect.h; + end; + + maxx := DstSurface.w; + maxy := DstSurface.h; + aCos := cos( Angle ); + aSin := sin( Angle ); + + Width := round( abs( srcrect.h * acos ) + abs( srcrect.w * asin ) ); + Height := round( abs( srcrect.h * asin ) + abs( srcrect.w * acos ) ); + + OX := Width div 2; + OY := Height div 2; ; + MX := ( srcRect.x + ( srcRect.x + srcRect.w ) ) div 2; + MY := ( srcRect.y + ( srcRect.y + srcRect.h ) ) div 2; + ROX := ( -( srcRect.w div 2 ) ) + Offsetx; + ROY := ( -( srcRect.h div 2 ) ) + OffsetY; + Tx := ox + round( ROX * aSin - ROY * aCos ); + Ty := oy + round( ROY * aSin + ROX * aCos ); + SX := 0; + for DX := DestX - TX to DestX - TX + ( width ) do + begin + Inc( SX ); + SY := 0; + for DY := DestY - TY to DestY - TY + ( Height ) do + begin + RX := SX - OX; + RY := SY - OY; + NX := round( mx + RX * aSin + RY * aCos ); // + NY := round( my + RY * aSin - RX * aCos ); // + // Used for testing only + //SDL_PutPixel(DestSurface.SDLSurfacePointer,DX,DY,0); + if ( ( DX > 0 ) and ( DX < MAXX ) ) and ( ( DY > 0 ) and ( DY < MAXY ) ) then + begin + if ( NX >= srcRect.x ) and ( NX <= srcRect.x + srcRect.w ) then + begin + if ( NY >= srcRect.y ) and ( NY <= srcRect.y + srcRect.h ) then + begin + Colour := SDL_GetPixel( SrcSurface, NX, NY ); + if Colour <> TempTransparentColour then + begin + SDL_PutPixel( DstSurface, DX, DY, Colour ); + end; + end; + end; + end; + inc( SY ); + end; + end; +end; + +procedure SDL_RotateDeg( DstSurface, SrcSurface : PSDL_Surface; SrcRect : + PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Integer ); +begin + SDL_RotateRad( DstSurface, SrcSurface, SrcRect, DestX, DestY, OffsetX, OffsetY, DegToRad( Angle ) ); +end; + +function ValidateSurfaceRect( DstSurface : PSDL_Surface; dstrect : PSDL_Rect ) : TSDL_Rect; +var + RealRect : TSDL_Rect; + OutOfRange : Boolean; +begin + OutOfRange := false; + if dstrect = nil then + begin + RealRect.x := 0; + RealRect.y := 0; + RealRect.w := DstSurface.w; + RealRect.h := DstSurface.h; + end + else + begin + if dstrect.x < DstSurface.w then + begin + RealRect.x := dstrect.x; + end + else if dstrect.x < 0 then + begin + realrect.x := 0; + end + else + begin + OutOfRange := True; + end; + if dstrect.y < DstSurface.h then + begin + RealRect.y := dstrect.y; + end + else if dstrect.y < 0 then + begin + realrect.y := 0; + end + else + begin + OutOfRange := True; + end; + if OutOfRange = False then + begin + if realrect.x + dstrect.w <= DstSurface.w then + begin + RealRect.w := dstrect.w; + end + else + begin + RealRect.w := dstrect.w - realrect.x; + end; + if realrect.y + dstrect.h <= DstSurface.h then + begin + RealRect.h := dstrect.h; + end + else + begin + RealRect.h := dstrect.h - realrect.y; + end; + end; + end; + if OutOfRange = False then + begin + result := realrect; + end + else + begin + realrect.w := 0; + realrect.h := 0; + realrect.x := 0; + realrect.y := 0; + result := realrect; + end; +end; + +procedure SDL_FillRectAdd( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); +var + RealRect : TSDL_Rect; + Addr : pointer; + ModX, BPP : cardinal; + x, y, R, G, B, SrcColor : cardinal; +begin + RealRect := ValidateSurfaceRect( DstSurface, DstRect ); + if ( RealRect.w > 0 ) and ( RealRect.h > 0 ) then + begin + SDL_LockSurface( DstSurface ); + BPP := DstSurface.format.BytesPerPixel; + with DstSurface^ do + begin + Addr := pointer( UInt32( pixels ) + UInt32( RealRect.y ) * pitch + UInt32( RealRect.x ) * BPP ); + ModX := Pitch - UInt32( RealRect.w ) * BPP; + end; + case DstSurface.format.BitsPerPixel of + 8 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $E0 + Color and $E0; + G := SrcColor and $1C + Color and $1C; + B := SrcColor and $03 + Color and $03; + if R > $E0 then + R := $E0; + if G > $1C then + G := $1C; + if B > $03 then + B := $03; + PUInt8( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 15 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $7C00 + Color and $7C00; + G := SrcColor and $03E0 + Color and $03E0; + B := SrcColor and $001F + Color and $001F; + if R > $7C00 then + R := $7C00; + if G > $03E0 then + G := $03E0; + if B > $001F then + B := $001F; + PUInt16( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 16 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $F800 + Color and $F800; + G := SrcColor and $07C0 + Color and $07C0; + B := SrcColor and $001F + Color and $001F; + if R > $F800 then + R := $F800; + if G > $07C0 then + G := $07C0; + if B > $001F then + B := $001F; + PUInt16( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 24 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $00FF0000 + Color and $00FF0000; + G := SrcColor and $0000FF00 + Color and $0000FF00; + B := SrcColor and $000000FF + Color and $000000FF; + if R > $FF0000 then + R := $FF0000; + if G > $00FF00 then + G := $00FF00; + if B > $0000FF then + B := $0000FF; + PUInt32( Addr )^ := SrcColor and $FF000000 or R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 32 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $00FF0000 + Color and $00FF0000; + G := SrcColor and $0000FF00 + Color and $0000FF00; + B := SrcColor and $000000FF + Color and $000000FF; + if R > $FF0000 then + R := $FF0000; + if G > $00FF00 then + G := $00FF00; + if B > $0000FF then + B := $0000FF; + PUInt32( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + end; + SDL_UnlockSurface( DstSurface ); + end; +end; + +procedure SDL_FillRectSub( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); +var + RealRect : TSDL_Rect; + Addr : pointer; + ModX, BPP : cardinal; + x, y, R, G, B, SrcColor : cardinal; +begin + RealRect := ValidateSurfaceRect( DstSurface, DstRect ); + if ( RealRect.w > 0 ) and ( RealRect.h > 0 ) then + begin + SDL_LockSurface( DstSurface ); + BPP := DstSurface.format.BytesPerPixel; + with DstSurface^ do + begin + Addr := pointer( UInt32( pixels ) + UInt32( RealRect.y ) * pitch + UInt32( RealRect.x ) * BPP ); + ModX := Pitch - UInt32( RealRect.w ) * BPP; + end; + case DstSurface.format.BitsPerPixel of + 8 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $E0 - Color and $E0; + G := SrcColor and $1C - Color and $1C; + B := SrcColor and $03 - Color and $03; + if R > $E0 then + R := 0; + if G > $1C then + G := 0; + if B > $03 then + B := 0; + PUInt8( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 15 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $7C00 - Color and $7C00; + G := SrcColor and $03E0 - Color and $03E0; + B := SrcColor and $001F - Color and $001F; + if R > $7C00 then + R := 0; + if G > $03E0 then + G := 0; + if B > $001F then + B := 0; + PUInt16( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 16 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $F800 - Color and $F800; + G := SrcColor and $07C0 - Color and $07C0; + B := SrcColor and $001F - Color and $001F; + if R > $F800 then + R := 0; + if G > $07C0 then + G := 0; + if B > $001F then + B := 0; + PUInt16( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 24 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $00FF0000 - Color and $00FF0000; + G := SrcColor and $0000FF00 - Color and $0000FF00; + B := SrcColor and $000000FF - Color and $000000FF; + if R > $FF0000 then + R := 0; + if G > $00FF00 then + G := 0; + if B > $0000FF then + B := 0; + PUInt32( Addr )^ := SrcColor and $FF000000 or R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + 32 : + begin + for y := 0 to RealRect.h - 1 do + begin + for x := 0 to RealRect.w - 1 do + begin + SrcColor := PUInt32( Addr )^; + R := SrcColor and $00FF0000 - Color and $00FF0000; + G := SrcColor and $0000FF00 - Color and $0000FF00; + B := SrcColor and $000000FF - Color and $000000FF; + if R > $FF0000 then + R := 0; + if G > $00FF00 then + G := 0; + if B > $0000FF then + B := 0; + PUInt32( Addr )^ := R or G or B; + inc( UInt32( Addr ), BPP ); + end; + inc( UInt32( Addr ), ModX ); + end; + end; + end; + SDL_UnlockSurface( DstSurface ); + end; +end; + +procedure SDL_GradientFillRect( DstSurface : PSDL_Surface; const Rect : PSDL_Rect; const StartColor, EndColor : TSDL_Color; const Style : TGradientStyle ); +var + FBC : array[ 0..255 ] of Cardinal; + // temp vars + i, YR, YG, YB, SR, SG, SB, DR, DG, DB : Integer; + + TempStepV, TempStepH : Single; + TempLeft, TempTop, TempHeight, TempWidth : integer; + TempRect : TSDL_Rect; + +begin + // calc FBC + YR := StartColor.r; + YG := StartColor.g; + YB := StartColor.b; + SR := YR; + SG := YG; + SB := YB; + DR := EndColor.r - SR; + DG := EndColor.g - SG; + DB := EndColor.b - SB; + + for i := 0 to 255 do + begin + FBC[ i ] := SDL_MapRGB( DstSurface.format, YR, YG, YB ); + YR := SR + round( DR / 255 * i ); + YG := SG + round( DG / 255 * i ); + YB := SB + round( DB / 255 * i ); + end; + + // if aStyle = 1 then begin + TempStepH := Rect.w / 255; + TempStepV := Rect.h / 255; + TempHeight := Trunc( TempStepV + 1 ); + TempWidth := Trunc( TempStepH + 1 ); + TempTop := 0; + TempLeft := 0; + TempRect.x := Rect.x; + TempRect.y := Rect.y; + TempRect.h := Rect.h; + TempRect.w := Rect.w; + + case Style of + gsHorizontal : + begin + TempRect.h := TempHeight; + for i := 0 to 255 do + begin + TempRect.y := Rect.y + TempTop; + SDL_FillRect( DstSurface, @TempRect, FBC[ i ] ); + TempTop := Trunc( TempStepV * i ); + end; + end; + gsVertical : + begin + TempRect.w := TempWidth; + for i := 0 to 255 do + begin + TempRect.x := Rect.x + TempLeft; + SDL_FillRect( DstSurface, @TempRect, FBC[ i ] ); + TempLeft := Trunc( TempStepH * i ); + end; + end; + end; +end; + +procedure SDL_2xBlit(Src, Dest: PSDL_Surface); +var + ReadAddr, WriteAddr, ReadRow, WriteRow: UInt32; + SrcPitch, DestPitch, x, y: UInt32; +begin + if (Src = nil) or (Dest = nil) then + exit; + if (Src.w shl 1) < Dest.w then + exit; + if (Src.h shl 1) < Dest.h then + exit; + + if SDL_MustLock(Src) then + SDL_LockSurface(Src); + if SDL_MustLock(Dest) then + SDL_LockSurface(Dest); + + ReadRow := UInt32(Src.Pixels); + WriteRow := UInt32(Dest.Pixels); + + SrcPitch := Src.pitch; + DestPitch := Dest.pitch; + + case Src.format.BytesPerPixel of + 1: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt8(WriteAddr)^ := PUInt8(ReadAddr)^; + PUInt8(WriteAddr + 1)^ := PUInt8(ReadAddr)^; + PUInt8(WriteAddr + DestPitch)^ := PUInt8(ReadAddr)^; + PUInt8(WriteAddr + DestPitch + 1)^ := PUInt8(ReadAddr)^; + inc(ReadAddr); + inc(WriteAddr, 2); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + 2: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt16(WriteAddr)^ := PUInt16(ReadAddr)^; + PUInt16(WriteAddr + 2)^ := PUInt16(ReadAddr)^; + PUInt16(WriteAddr + DestPitch)^ := PUInt16(ReadAddr)^; + PUInt16(WriteAddr + DestPitch + 2)^ := PUInt16(ReadAddr)^; + inc(ReadAddr, 2); + inc(WriteAddr, 4); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + 3: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt32(WriteAddr)^ := (PUInt32(WriteAddr)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + PUInt32(WriteAddr + 3)^ := (PUInt32(WriteAddr + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + PUInt32(WriteAddr + DestPitch)^ := (PUInt32(WriteAddr + DestPitch)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + PUInt32(WriteAddr + DestPitch + 3)^ := (PUInt32(WriteAddr + DestPitch + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + inc(ReadAddr, 3); + inc(WriteAddr, 6); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + 4: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt32(WriteAddr)^ := PUInt32(ReadAddr)^; + PUInt32(WriteAddr + 4)^ := PUInt32(ReadAddr)^; + PUInt32(WriteAddr + DestPitch)^ := PUInt32(ReadAddr)^; + PUInt32(WriteAddr + DestPitch + 4)^ := PUInt32(ReadAddr)^; + inc(ReadAddr, 4); + inc(WriteAddr, 8); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + end; + + if SDL_MustLock(Src) then + SDL_UnlockSurface(Src); + if SDL_MustLock(Dest) then + SDL_UnlockSurface(Dest); +end; + +procedure SDL_Scanline2xBlit(Src, Dest: PSDL_Surface); +var + ReadAddr, WriteAddr, ReadRow, WriteRow: UInt32; + SrcPitch, DestPitch, x, y: UInt32; +begin + if (Src = nil) or (Dest = nil) then + exit; + if (Src.w shl 1) < Dest.w then + exit; + if (Src.h shl 1) < Dest.h then + exit; + + if SDL_MustLock(Src) then + SDL_LockSurface(Src); + if SDL_MustLock(Dest) then + SDL_LockSurface(Dest); + + ReadRow := UInt32(Src.Pixels); + WriteRow := UInt32(Dest.Pixels); + + SrcPitch := Src.pitch; + DestPitch := Dest.pitch; + + case Src.format.BytesPerPixel of + 1: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt8(WriteAddr)^ := PUInt8(ReadAddr)^; + PUInt8(WriteAddr + 1)^ := PUInt8(ReadAddr)^; + inc(ReadAddr); + inc(WriteAddr, 2); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + 2: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt16(WriteAddr)^ := PUInt16(ReadAddr)^; + PUInt16(WriteAddr + 2)^ := PUInt16(ReadAddr)^; + inc(ReadAddr, 2); + inc(WriteAddr, 4); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + 3: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt32(WriteAddr)^ := (PUInt32(WriteAddr)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + PUInt32(WriteAddr + 3)^ := (PUInt32(WriteAddr + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + inc(ReadAddr, 3); + inc(WriteAddr, 6); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + 4: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt32(WriteAddr)^ := PUInt32(ReadAddr)^; + PUInt32(WriteAddr + 4)^ := PUInt32(ReadAddr)^; + inc(ReadAddr, 4); + inc(WriteAddr, 8); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + end; + + if SDL_MustLock(Src) then + SDL_UnlockSurface(Src); + if SDL_MustLock(Dest) then + SDL_UnlockSurface(Dest); +end; + +procedure SDL_50Scanline2xBlit(Src, Dest: PSDL_Surface); +var + ReadAddr, WriteAddr, ReadRow, WriteRow: UInt32; + SrcPitch, DestPitch, x, y, Color: UInt32; +begin + if (Src = nil) or (Dest = nil) then + exit; + if (Src.w shl 1) < Dest.w then + exit; + if (Src.h shl 1) < Dest.h then + exit; + + if SDL_MustLock(Src) then + SDL_LockSurface(Src); + if SDL_MustLock(Dest) then + SDL_LockSurface(Dest); + + ReadRow := UInt32(Src.Pixels); + WriteRow := UInt32(Dest.Pixels); + + SrcPitch := Src.pitch; + DestPitch := Dest.pitch; + + case Src.format.BitsPerPixel of + 8: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + Color := PUInt8(ReadAddr)^; + PUInt8(WriteAddr)^ := Color; + PUInt8(WriteAddr + 1)^ := Color; + Color := (Color shr 1) and $6d; {%01101101} + PUInt8(WriteAddr + DestPitch)^ := Color; + PUInt8(WriteAddr + DestPitch + 1)^ := Color; + inc(ReadAddr); + inc(WriteAddr, 2); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + 15: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + Color := PUInt16(ReadAddr)^; + PUInt16(WriteAddr)^ := Color; + PUInt16(WriteAddr + 2)^ := Color; + Color := (Color shr 1) and $3def; {%0011110111101111} + PUInt16(WriteAddr + DestPitch)^ := Color; + PUInt16(WriteAddr + DestPitch + 2)^ := Color; + inc(ReadAddr, 2); + inc(WriteAddr, 4); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + 16: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + Color := PUInt16(ReadAddr)^; + PUInt16(WriteAddr)^ := Color; + PUInt16(WriteAddr + 2)^ := Color; + Color := (Color shr 1) and $7bef; {%0111101111101111} + PUInt16(WriteAddr + DestPitch)^ := Color; + PUInt16(WriteAddr + DestPitch + 2)^ := Color; + inc(ReadAddr, 2); + inc(WriteAddr, 4); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + 24: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + Color := (PUInt32(WriteAddr)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); + PUInt32(WriteAddr)^ := Color; + PUInt32(WriteAddr + 3)^ := Color; + Color := (Color shr 1) and $007f7f7f; {%011111110111111101111111} + PUInt32(WriteAddr + DestPitch)^ := Color; + PUInt32(WriteAddr + DestPitch + 3)^ := Color; + inc(ReadAddr, 3); + inc(WriteAddr, 6); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + 32: for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + Color := PUInt32(ReadAddr)^; + PUInt32(WriteAddr)^ := Color; + PUInt32(WriteAddr + 4)^ := Color; + Color := (Color shr 1) and $7f7f7f7f; + PUInt32(WriteAddr + DestPitch)^ := Color; + PUInt32(WriteAddr + DestPitch + 4)^ := Color; + inc(ReadAddr, 4); + inc(WriteAddr, 8); + end; + inc(UInt32(ReadRow), SrcPitch); + inc(UInt32(WriteRow), DestPitch * 2); + end; + end; + + if SDL_MustLock(Src) then + SDL_UnlockSurface(Src); + if SDL_MustLock(Dest) then + SDL_UnlockSurface(Dest); +end; + +function SDL_PixelTestSurfaceVsRect( SrcSurface1 : PSDL_Surface; SrcRect1 : +PSDL_Rect; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : +boolean; +var + Src_Rect1, Src_Rect2 : TSDL_Rect; + right1, bottom1 : integer; + right2, bottom2 : integer; + Scan1Start, Scan2Start, ScanWidth, ScanHeight : cardinal; + Mod1: cardinal; + Addr1 : cardinal; + BPP : cardinal; + Pitch1 : cardinal; + TransparentColor1 : cardinal; + tx, ty : cardinal; + StartTick : cardinal; + Color1 : cardinal; +begin + Result := false; + if SrcRect1 = nil then + begin + with Src_Rect1 do + begin + x := 0; + y := 0; + w := SrcSurface1.w; + h := SrcSurface1.h; + end; + end + else + Src_Rect1 := SrcRect1^; + + Src_Rect2 := SrcRect2^; + with Src_Rect1 do + begin + Right1 := Left1 + w; + Bottom1 := Top1 + h; + end; + with Src_Rect2 do + begin + Right2 := Left2 + w; + Bottom2 := Top2 + h; + end; + if ( Left1 >= Right2 ) or ( Right1 <= Left2 ) or ( Top1 >= Bottom2 ) or ( +Bottom1 <= + Top2 ) then + exit; + if Left1 <= Left2 then + begin + // 1. left, 2. right + Scan1Start := Src_Rect1.x + Left2 - Left1; + Scan2Start := Src_Rect2.x; + ScanWidth := Right1 - Left2; + with Src_Rect2 do + if ScanWidth > w then + ScanWidth := w; + end + else + begin + // 1. right, 2. left + Scan1Start := Src_Rect1.x; + Scan2Start := Src_Rect2.x + Left1 - Left2; + ScanWidth := Right2 - Left1; + with Src_Rect1 do + if ScanWidth > w then + ScanWidth := w; + end; + with SrcSurface1^ do + begin + Pitch1 := Pitch; + Addr1 := cardinal( Pixels ); + inc( Addr1, Pitch1 * UInt32( Src_Rect1.y ) ); + with format^ do + begin + BPP := BytesPerPixel; + TransparentColor1 := colorkey; + end; + end; + + Mod1 := Pitch1 - ( ScanWidth * BPP ); + + inc( Addr1, BPP * Scan1Start ); + + if Top1 <= Top2 then + begin + // 1. up, 2. down + ScanHeight := Bottom1 - Top2; + if ScanHeight > Src_Rect2.h then + ScanHeight := Src_Rect2.h; + inc( Addr1, Pitch1 * UInt32( Top2 - Top1 ) ); + end + else + begin + // 1. down, 2. up + ScanHeight := Bottom2 - Top1; + if ScanHeight > Src_Rect1.h then + ScanHeight := Src_Rect1.h; + + end; + case BPP of + 1 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PByte( Addr1 )^ <> TransparentColor1 ) then + begin + Result := true; + exit; + end; + inc( Addr1 ); + + end; + inc( Addr1, Mod1 ); + + end; + 2 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PWord( Addr1 )^ <> TransparentColor1 ) then + begin + Result := true; + exit; + end; + inc( Addr1, 2 ); + + end; + inc( Addr1, Mod1 ); + + end; + 3 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + Color1 := PLongWord( Addr1 )^ and $00FFFFFF; + + if ( Color1 <> TransparentColor1 ) + then + begin + Result := true; + exit; + end; + inc( Addr1, 3 ); + + end; + inc( Addr1, Mod1 ); + + end; + 4 : + for ty := 1 to ScanHeight do + begin + for tx := 1 to ScanWidth do + begin + if ( PLongWord( Addr1 )^ <> TransparentColor1 ) then + begin + Result := true; + exit; + end; + inc( Addr1, 4 ); + + end; + inc( Addr1, Mod1 ); + + end; + end; +end; + +procedure SDL_ORSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := Format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + WorkY := Src.h; + case bits of + 8 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt8( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt8( DestAddr )^; + PUInt8( DestAddr )^ := Pixel2 OR Pixel1; + end; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 15 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + + PUInt16( DestAddr )^ := Pixel2 OR Pixel1; + + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 16 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + + PUInt16( DestAddr )^ := Pixel2 OR Pixel1; + + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 24 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; + + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or Pixel2 or Pixel1; + end; + inc( SrcAddr, 3 ); + inc( DestAddr, 3 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 32 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^; + + PUInt32( DestAddr )^ := Pixel2 or Pixel1; + end; + inc( SrcAddr, 4 ); + inc( DestAddr, 4 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); +end; + +procedure SDL_ANDSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := Format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + WorkY := Src.h; + case bits of + 8 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt8( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt8( DestAddr )^; + PUInt8( DestAddr )^ := Pixel2 and Pixel1; + end; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 15 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + + PUInt16( DestAddr )^ := Pixel2 and Pixel1; + + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 16 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + + PUInt16( DestAddr )^ := Pixel2 and Pixel1; + + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 24 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; + + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or Pixel2 and Pixel1; + end; + inc( SrcAddr, 3 ); + inc( DestAddr, 3 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 32 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^; + + PUInt32( DestAddr )^ := Pixel2 and Pixel1; + end; + inc( SrcAddr, 4 ); + inc( DestAddr, 4 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); +end; + + + +procedure SDL_GTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := Format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + WorkY := Src.h; + case bits of + 8 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt8( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt8( DestAddr )^; + if Pixel2 > 0 then + begin + if Pixel2 and $E0 > Pixel1 and $E0 then R := Pixel2 and $E0 else R := Pixel1 and $E0; + if Pixel2 and $1C > Pixel1 and $1C then G := Pixel2 and $1C else G := Pixel1 and $1C; + if Pixel2 and $03 > Pixel1 and $03 then B := Pixel2 and $03 else B := Pixel1 and $03; + + if R > $E0 then + R := $E0; + if G > $1C then + G := $1C; + if B > $03 then + B := $03; + PUInt8( DestAddr )^ := R or G or B; + end + else + PUInt8( DestAddr )^ := Pixel1; + end; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 15 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $7C00 > Pixel1 and $7C00 then R := Pixel2 and $7C00 else R := Pixel1 and $7C00; + if Pixel2 and $03E0 > Pixel1 and $03E0 then G := Pixel2 and $03E0 else G := Pixel1 and $03E0; + if Pixel2 and $001F > Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; + + PUInt16( DestAddr )^ := R or G or B; + end + else + PUInt16( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 16 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $F800 > Pixel1 and $F800 then R := Pixel2 and $F800 else R := Pixel1 and $F800; + if Pixel2 and $07E0 > Pixel1 and $07E0 then G := Pixel2 and $07E0 else G := Pixel1 and $07E0; + if Pixel2 and $001F > Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; + + PUInt16( DestAddr )^ := R or G or B; + end + else + PUInt16( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 24 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; + if Pixel2 > 0 then + begin + + if Pixel2 and $FF0000 > Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; + if Pixel2 and $00FF00 > Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; + if Pixel2 and $0000FF > Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; + + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or ( R or G or B ); + end + else + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or Pixel1; + end; + inc( SrcAddr, 3 ); + inc( DestAddr, 3 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 32 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $FF0000 > Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; + if Pixel2 and $00FF00 > Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; + if Pixel2 and $0000FF > Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; + + PUInt32( DestAddr )^ := R or G or B; + end + else + PUInt32( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 4 ); + inc( DestAddr, 4 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); +end; + + +procedure SDL_LTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; + DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); +var + R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; + Src, Dest : TSDL_Rect; + Diff : integer; + SrcAddr, DestAddr : cardinal; + WorkX, WorkY : word; + SrcMod, DestMod : cardinal; + Bits : cardinal; +begin + if ( SrcSurface = nil ) or ( DestSurface = nil ) then + exit; // Remove this to make it faster + if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then + exit; // Remove this to make it faster + if SrcRect = nil then + begin + with Src do + begin + x := 0; + y := 0; + w := SrcSurface.w; + h := SrcSurface.h; + end; + end + else + Src := SrcRect^; + if DestRect = nil then + begin + Dest.x := 0; + Dest.y := 0; + end + else + Dest := DestRect^; + Dest.w := Src.w; + Dest.h := Src.h; + with DestSurface.Clip_Rect do + begin + // Source's right side is greater than the dest.cliprect + if Dest.x + Src.w > x + w then + begin + smallint( Src.w ) := x + w - Dest.x; + smallint( Dest.w ) := x + w - Dest.x; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's bottom side is greater than the dest.clip + if Dest.y + Src.h > y + h then + begin + smallint( Src.h ) := y + h - Dest.y; + smallint( Dest.h ) := y + h - Dest.y; + if smallint( Dest.h ) < 1 then + exit; + end; + // Source's left side is less than the dest.clip + if Dest.x < x then + begin + Diff := x - Dest.x; + Src.x := Src.x + Diff; + smallint( Src.w ) := smallint( Src.w ) - Diff; + Dest.x := x; + smallint( Dest.w ) := smallint( Dest.w ) - Diff; + if smallint( Dest.w ) < 1 then + exit; + end; + // Source's Top side is less than the dest.clip + if Dest.y < y then + begin + Diff := y - Dest.y; + Src.y := Src.y + Diff; + smallint( Src.h ) := smallint( Src.h ) - Diff; + Dest.y := y; + smallint( Dest.h ) := smallint( Dest.h ) - Diff; + if smallint( Dest.h ) < 1 then + exit; + end; + end; + with SrcSurface^ do + begin + SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * + Format.BytesPerPixel; + SrcMod := Pitch - Src.w * Format.BytesPerPixel; + TransparentColor := Format.colorkey; + end; + with DestSurface^ do + begin + DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * + Format.BytesPerPixel; + DestMod := Pitch - Dest.w * Format.BytesPerPixel; + Bits := Format.BitsPerPixel; + end; + SDL_LockSurface( SrcSurface ); + SDL_LockSurface( DestSurface ); + WorkY := Src.h; + case bits of + 8 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt8( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt8( DestAddr )^; + if Pixel2 > 0 then + begin + if Pixel2 and $E0 < Pixel1 and $E0 then R := Pixel2 and $E0 else R := Pixel1 and $E0; + if Pixel2 and $1C < Pixel1 and $1C then G := Pixel2 and $1C else G := Pixel1 and $1C; + if Pixel2 and $03 < Pixel1 and $03 then B := Pixel2 and $03 else B := Pixel1 and $03; + + if R > $E0 then + R := $E0; + if G > $1C then + G := $1C; + if B > $03 then + B := $03; + PUInt8( DestAddr )^ := R or G or B; + end + else + PUInt8( DestAddr )^ := Pixel1; + end; + inc( SrcAddr ); + inc( DestAddr ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 15 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $7C00 < Pixel1 and $7C00 then R := Pixel2 and $7C00 else R := Pixel1 and $7C00; + if Pixel2 and $03E0 < Pixel1 and $03E0 then G := Pixel2 and $03E0 else G := Pixel1 and $03E0; + if Pixel2 and $001F < Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; + + PUInt16( DestAddr )^ := R or G or B; + end + else + PUInt16( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 16 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt16( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt16( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $F800 < Pixel1 and $F800 then R := Pixel2 and $F800 else R := Pixel1 and $F800; + if Pixel2 and $07E0 < Pixel1 and $07E0 then G := Pixel2 and $07E0 else G := Pixel1 and $07E0; + if Pixel2 and $001F < Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; + + PUInt16( DestAddr )^ := R or G or B; + end + else + PUInt16( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 2 ); + inc( DestAddr, 2 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 24 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; + if Pixel2 > 0 then + begin + + if Pixel2 and $FF0000 < Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; + if Pixel2 and $00FF00 < Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; + if Pixel2 and $0000FF < Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; + + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or ( R or G or B ); + end + else + PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or Pixel1; + end; + inc( SrcAddr, 3 ); + inc( DestAddr, 3 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + 32 : + begin + repeat + WorkX := Src.w; + repeat + Pixel1 := PUInt32( SrcAddr )^; + if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then + begin + Pixel2 := PUInt32( DestAddr )^; + if Pixel2 > 0 then + begin + + if Pixel2 and $FF0000 < Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; + if Pixel2 and $00FF00 < Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; + if Pixel2 and $0000FF < Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; + + PUInt32( DestAddr )^ := R or G or B; + end + else + PUInt32( DestAddr )^ := Pixel1; + end; + inc( SrcAddr, 4 ); + inc( DestAddr, 4 ); + dec( WorkX ); + until WorkX = 0; + inc( SrcAddr, SrcMod ); + inc( DestAddr, DestMod ); + dec( WorkY ); + until WorkY = 0; + end; + end; + SDL_UnlockSurface( SrcSurface ); + SDL_UnlockSurface( DestSurface ); +end; + +// Will clip the x1,x2,y1,x2 params to the ClipRect provided +function SDL_ClipLine(var x1,y1,x2,y2: Integer; ClipRect: PSDL_Rect) : boolean; + var tflag, flag1, flag2: word; + txy, xedge, yedge: Integer; + slope: single; + + function ClipCode(x,y: Integer): word; + begin + Result := 0; + if x < ClipRect.x then Result := 1; + if x >= ClipRect.w + ClipRect.x then Result := Result or 2; + if y < ClipRect.y then Result := Result or 4; + if y >= ClipRect.h + ClipRect.y then Result := Result or 8; + end; + +begin + flag1 := ClipCode(x1,y1); + flag2 := ClipCode(x2,y2); + result := true; + + while true do + begin + if (flag1 or flag2) = 0 then Exit; // all in + + if (flag1 and flag2) <> 0 then + begin + result := false; + Exit; // all out + end; + + if flag2 = 0 then + begin + txy := x1; x1 := x2; x2 := txy; + txy := y1; y1 := y2; y2 := txy; + tflag := flag1; flag1 := flag2; flag2 := tflag; + end; + + if (flag2 and 3) <> 0 then + begin + if (flag2 and 1) <> 0 then + xedge := ClipRect.x + else + xedge := ClipRect.w + ClipRect.x -1; // back 1 pixel otherwise we end up in a loop + + slope := (y2 - y1) / (x2 - x1); + y2 := y1 + Round(slope * (xedge - x1)); + x2 := xedge; + end + else + begin + if (flag2 and 4) <> 0 then + yedge := ClipRect.y + else + yedge := ClipRect.h + ClipRect.y -1; // up 1 pixel otherwise we end up in a loop + + slope := (x2 - x1) / (y2 - y1); + x2 := x1 + Round(slope * (yedge - y1)); + y2 := yedge; + end; + + flag2 := ClipCode(x2, y2); + end; +end; + +end. + + diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlwindow.pas b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlwindow.pas new file mode 100644 index 00000000..ef290071 --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlwindow.pas @@ -0,0 +1,564 @@ +unit sdlwindow; +{ + $Id: sdlwindow.pas,v 1.7 2004/09/30 22:35:47 savage Exp $ + +} +{******************************************************************************} +{ } +{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } +{ SDL Window Wrapper } +{ } +{ } +{ The initial developer of this Pascal code was : } +{ Dominique Louis } +{ } +{ Portions created by Dominique Louis are } +{ Copyright (C) 2004 - 2100 Dominique Louis. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ Dominique Louis } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ SDL Window Wrapper } +{ } +{ } +{ Requires } +{ -------- } +{ SDL.dll on Windows platforms } +{ libSDL-1.1.so.0 on Linux platform } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ January 31 2003 - DL : Initial creation } +{ } +{ + $Log: sdlwindow.pas,v $ + Revision 1.7 2004/09/30 22:35:47 savage + Changes, enhancements and additions as required to get SoAoS working. + + Revision 1.6 2004/09/12 21:52:58 savage + Slight changes to fix some issues with the sdl classes. + + Revision 1.5 2004/05/10 21:11:49 savage + changes required to help get SoAoS off the ground. + + Revision 1.4 2004/05/01 14:59:27 savage + Updated code + + Revision 1.3 2004/04/23 10:45:28 savage + Changes made by Dean Ellis to work more modularly. + + Revision 1.2 2004/03/31 10:06:41 savage + Changed so that it now compiles, but is untested. + + Revision 1.1 2004/02/05 00:08:20 savage + Module 1.0 release + +} +{******************************************************************************} + +interface + +{$i jedi-sdl.inc} + +uses + Classes, + sdl, + sdlinput, + sdlticks; + +type + TSDLNotifyEvent = procedure {$IFNDEF NOT_OO}of object{$ENDIF}; + TSDLUpdateEvent = procedure( aElapsedTime : single ) {$IFNDEF NOT_OO}of object{$ENDIF}; + TSDLResizeEvent = procedure( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 ) {$IFNDEF NOT_OO}of object{$ENDIF}; + TSDLUserEvent = procedure( aType : UInt8; aCode : integer; aData1 : Pointer; aData2 : Pointer ) {$IFNDEF NOT_OO}of object{$ENDIF}; + TSDLActiveEvent = procedure( aGain: UInt8; aState: UInt8 ) {$IFNDEF NOT_OO}of object{$ENDIF}; + + TSDLBaseWindow = class( TObject ) + private + FDisplaySurface : PSDL_Surface; + FVideoFlags : Uint32; + FOnDestroy: TSDLNotifyEvent; + FOnCreate: TSDLNotifyEvent; + FOnShow: TSDLNotifyEvent; + FOnResize: TSDLResizeEvent; + FOnUpdate: TSDLUpdateEvent; + FOnRender: TSDLNotifyEvent; + FOnClose: TSDLNotifyEvent; + FLoaded: Boolean; + FRendering: Boolean; + FHeight: integer; + FBitDepth: integer; + FWidth: integer; + FInputManager: TSDLInputManager; + FCaptionText : PChar; + FIconName : PChar; + FOnActive: TSDLActiveEvent; + FOnQuit: TSDLNotifyEvent; + FOnExpose: TSDLNotifyEvent; + FOnUser: TSDLUserEvent; + FTimer : TSDLTicks; + protected + procedure DoActive( aGain: UInt8; aState: UInt8 ); + procedure DoCreate; + procedure DoClose; + procedure DoDestroy; + procedure DoUpdate( aElapsedTime : single ); + procedure DoQuit; + procedure DoRender; + procedure DoResize( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 ); + procedure DoShow; + procedure DoUser( aType : UInt8; aCode : integer; aData1 : Pointer; aData2 : Pointer ); + procedure DoExpose; + procedure Render; virtual; + procedure Update( aElapsedTime : single ); virtual; + procedure InitialiseObjects; virtual; + procedure RestoreObjects; virtual; + procedure DeleteObjects; virtual; + function Flip : integer; virtual; + property OnActive : TSDLActiveEvent read FOnActive write FOnActive; + property OnClose: TSDLNotifyEvent read FOnClose write FOnClose; + property OnDestroy : TSDLNotifyEvent read FOnDestroy write FOnDestroy; + property OnCreate : TSDLNotifyEvent read FOnCreate write FOnCreate; + property OnUpdate: TSDLUpdateEvent read FOnUpdate write FOnUpdate; + property OnQuit : TSDLNotifyEvent read FOnQuit write FOnQuit; + property OnResize : TSDLResizeEvent read FOnResize write FOnResize; + property OnRender: TSDLNotifyEvent read FOnRender write FOnRender; + property OnShow : TSDLNotifyEvent read FOnShow write FOnShow; + property OnUser : TSDLUserEvent read FOnUser write FOnUser; + property OnExpose : TSDLNotifyEvent read FOnExpose write FOnExpose; + property DisplaySurface: PSDL_Surface read FDisplaySurface; + public + property InputManager : TSDLInputManager read FInputManager; + property Loaded : Boolean read FLoaded; + property Width : integer read FWidth; + property Height : integer read FHeight; + property BitDepth : integer read FBitDepth; + property Rendering : Boolean read FRendering write FRendering; + procedure SetCaption( const aCaptionText : string; const aIconName : string ); + procedure GetCaption( var aCaptionText : string; var aIconName : string ); + procedure SetIcon( aIcon : PSDL_Surface; aMask: UInt8 ); + procedure ActivateVideoMode; + constructor Create( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 ); virtual; + destructor Destroy; override; + procedure InitialiseEnvironment; + function Show : Boolean; virtual; + end; + + TSDL2DWindow = class( TSDLBaseWindow ) + public + constructor Create( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 = SDL_DOUBLEBUF or SDL_SWSURFACE); override; + procedure Render; override; + procedure Update( aElapsedTime : single ); override; + procedure InitialiseObjects; override; + procedure RestoreObjects; override; + procedure DeleteObjects; override; + function Flip : integer; override; + property OnCreate; + property OnDestroy; + property OnClose; + property OnShow; + property OnResize; + property OnRender; + property OnUpdate; + property DisplaySurface; + end; + + TSDL3DWindow = class( TSDLBaseWindow ) + public + constructor Create( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 = SDL_OPENGL or SDL_DOUBLEBUF); override; + function Flip : integer; override; + procedure Render; override; + procedure Update( aElapsedTime : single ); override; + procedure InitialiseObjects; override; + procedure RestoreObjects; override; + procedure DeleteObjects; override; + property OnCreate; + property OnDestroy; + property OnClose; + property OnShow; + property OnResize; + property OnRender; + property OnUpdate; + property DisplaySurface; + end; + + + +implementation + +uses + logger, + SysUtils; + +{ TSDLBaseWindow } +procedure TSDLBaseWindow.ActivateVideoMode; +begin + FDisplaySurface := SDL_SetVideoMode( FWidth, FHeight, FBitDepth, FVideoFlags); + if (FDisplaySurface = nil) then + begin + Log.LogError( Format('Could not set video mode: %s', [SDL_GetError]), 'Main'); + exit; + end; + + SetCaption( 'Made with JEDI-SDL', 'JEDI-SDL Icon' ); +end; + +constructor TSDLBaseWindow.Create( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 ); +begin + inherited Create; + SDL_Init(SDL_INIT_EVERYTHING); + FInputManager := TSDLInputManager.Create( [ itJoystick, itKeyBoard, itMouse ]); + FTimer := TSDLTicks.Create; + + FWidth := aWidth; + FHeight := aHeight; + FBitDepth := aBitDepth; + FVideoFlags := aVideoFlags; + + DoCreate; +end; + +procedure TSDLBaseWindow.DeleteObjects; +begin + FLoaded := False; +end; + +destructor TSDLBaseWindow.Destroy; +begin + DoDestroy; + if FLoaded then + DeleteObjects; + if FInputManager <> nil then + FreeAndNil( FInputManager ); + if FTimer <> nil then + FreeAndNil( FTimer ); + if FDisplaySurface <> nil then + SDL_FreeSurface( FDisplaySurface ); + inherited Destroy; + SDL_Quit; +end; + +procedure TSDLBaseWindow.DoActive(aGain, aState: UInt8); +begin + if Assigned( FOnActive ) then + begin + FOnActive( aGain, aState ); + end; +end; + +procedure TSDLBaseWindow.DoClose; +begin + if Assigned( FOnClose ) then + begin + FOnClose; + end; +end; + +procedure TSDLBaseWindow.DoCreate; +begin + if Assigned( FOnCreate ) then + begin + FOnCreate; + end; +end; + +procedure TSDLBaseWindow.DoDestroy; +begin + if Assigned( FOnDestroy ) then + begin + FOnDestroy; + end; +end; + +procedure TSDLBaseWindow.DoExpose; +begin + if Assigned( FOnExpose ) then + begin + FOnExpose; + end; +end; + +procedure TSDLBaseWindow.DoUpdate( aElapsedTime : single ); +begin + if Assigned( FOnUpdate ) then + begin + FOnUpdate( aElapsedTime ); + end; +end; + +procedure TSDLBaseWindow.DoQuit; +begin + FRendering := false; + if Assigned( FOnQuit ) then + begin + FOnQuit; + end; +end; + +procedure TSDLBaseWindow.DoRender; +begin + if Assigned( FOnRender ) then + begin + FOnRender; + end; +end; + +procedure TSDLBaseWindow.DoResize( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 ); +begin + // resize to the new size + SDL_FreeSurface(FDisplaySurface); + FWidth := aWidth; + FHeight := aHeight; + FBitDepth := aBitDepth; + FVideoFlags := aVideoFlags; + FDisplaySurface := SDL_SetVideoMode(aWidth, aHeight, aBitDepth, aVideoFlags); + if Assigned( FOnResize ) then + begin + FOnResize( aWidth, aHeight, aBitDepth, aVideoFlags ); + end; +end; + +procedure TSDLBaseWindow.DoShow; +begin + if Assigned( FOnShow ) then + begin + FOnShow; + end; +end; + +procedure TSDLBaseWindow.DoUser(aType: UInt8; aCode: integer; aData1, aData2: Pointer); +begin + if Assigned( FOnUser ) then + begin + FOnUser( aType, aCode, aData1, aData2 ); + end; +end; + +function TSDLBaseWindow.Flip : integer; +begin + result := 0; +end; + +procedure TSDLBaseWindow.GetCaption( var aCaptionText : string; var aIconName : string ); +begin + aCaptionText := string( FCaptionText ); + aIconName := string( FIconName ); +end; + +procedure TSDLBaseWindow.InitialiseEnvironment; +begin + InitialiseObjects; + RestoreObjects; +end; + +procedure TSDLBaseWindow.InitialiseObjects; +begin + FLoaded := True; +end; + +procedure TSDLBaseWindow.Update( aElapsedTime : single ); +begin + DoUpdate( aElapsedTime ); +end; + +procedure TSDLBaseWindow.Render; +begin + DoRender; +end; + +procedure TSDLBaseWindow.RestoreObjects; +begin + FLoaded := false; +end; + +procedure TSDLBaseWindow.SetCaption( const aCaptionText : string; const aIconName : string ); +begin + if FCaptionText <> aCaptionText then + begin + FCaptionText := PChar( aCaptionText ); + FIconName := PChar( aIconName ); + SDL_WM_SetCaption( FCaptionText, FIconName ); + end; +end; + +procedure TSDLBaseWindow.SetIcon(aIcon: PSDL_Surface; aMask: UInt8); +begin + SDL_WM_SetIcon( aIcon, aMask ); +end; + +function TSDLBaseWindow.Show : Boolean; +var + eBaseWindowEvent : TSDL_Event; +begin + DoShow; + + FTimer.Init; + + FRendering := true; + // repeat until we are told not to render + while FRendering do + begin + // wait for an event + while SDL_PollEvent( @eBaseWindowEvent ) > 0 do + begin + + // check for a quit event + case eBaseWindowEvent.type_ of + SDL_ACTIVEEVENT : + begin + DoActive( eBaseWindowEvent.active.gain, eBaseWindowEvent.active.state ); + end; + + SDL_QUITEV : + begin + DoQuit; + DoClose; + end; + + SDL_USEREVENT : + begin + DoUser( eBaseWindowEvent.user.type_, eBaseWindowEvent.user.code, eBaseWindowEvent.user.data1, eBaseWindowEvent.user.data2 ); + end; + + SDL_VIDEOEXPOSE : + begin + DoExpose; + end; + + SDL_VIDEORESIZE : + begin + DoResize( eBaseWindowEvent.resize.w, eBaseWindowEvent.resize.h, FDisplaySurface.format.BitsPerPixel, FVideoflags ); + end; + + + end; + InputManager.UpdateInputs( eBaseWindowEvent ); + end; + // Prepare the Next Frame + Update( FTimer.GetElapsedSeconds ); + // Display the Next Frame + Render; + // Flip the surfaces + Flip; + end; + + Result := FRendering; +end; + +{ TSDL2DWindow } + +constructor TSDL2DWindow.Create(aWidth, aHeight, aBitDepth: integer; aVideoFlags: Uint32); +begin + // make sure double buffer is always included in the video flags + inherited Create(aWidth,aHeight, aBitDepth, aVideoFlags or SDL_DOUBLEBUF); +end; + +procedure TSDL2DWindow.DeleteObjects; +begin + inherited; + +end; + +function TSDL2DWindow.Flip: integer; +begin + // let's show the back buffer + result := SDL_Flip( FDisplaySurface ); +end; + +procedure TSDL2DWindow.InitialiseObjects; +begin + inherited; + +end; + +procedure TSDL2DWindow.Update( aElapsedTime : single ); +begin + inherited; + +end; + +procedure TSDL2DWindow.Render; +begin + inherited; + +end; + +procedure TSDL2DWindow.RestoreObjects; +begin + inherited; + +end; + +{ TSDL3DWindow } + +constructor TSDL3DWindow.Create(aWidth, + aHeight, aBitDepth: integer; aVideoFlags: Uint32); +begin + // make sure opengl is always included in the video flags + inherited Create(aWidth,aHeight, aBitDepth, aVideoFlags or SDL_OPENGL or SDL_DOUBLEBUF); +end; + +procedure TSDL3DWindow.DeleteObjects; +begin + inherited; + +end; + +function TSDL3DWindow.Flip : integer; +begin + SDL_GL_SwapBuffers; + result := 0; +end; + +procedure TSDL3DWindow.InitialiseObjects; +begin + inherited; + +end; + +procedure TSDL3DWindow.Update( aElapsedTime : single ); +begin + inherited; + +end; + +procedure TSDL3DWindow.Render; +begin + inherited; + +end; + +procedure TSDL3DWindow.RestoreObjects; +begin + inherited; + +end; + +end. diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/userpreferences.pas b/Game/Code/lib/JEDI-SDL/SDL/Pas/userpreferences.pas new file mode 100644 index 00000000..97e26520 --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/userpreferences.pas @@ -0,0 +1,159 @@ +unit userpreferences; +{ + $Id: userpreferences.pas,v 1.1 2004/09/30 22:35:47 savage Exp $ + +} +{******************************************************************************} +{ } +{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } +{ Base Class for User Preferences } +{ } +{ The initial developer of this Pascal code was : } +{ Dominqiue Louis } +{ } +{ Portions created by Dominqiue Louis are } +{ Copyright (C) 2000 - 2001 Dominqiue Louis. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ } +{ } +{ } +{ } +{ } +{ } +{ } +{ Requires } +{ -------- } +{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } +{ They are available from... } +{ http://www.libsdl.org . } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ September 23 2004 - DL : Initial Creation } +{ + $Log: userpreferences.pas,v $ + Revision 1.1 2004/09/30 22:35:47 savage + Changes, enhancements and additions as required to get SoAoS working. + + +} +{******************************************************************************} + +interface + +uses + Classes; + +type + TUserPreferences = class + private + FAutoSave: Boolean; + procedure CheckAutoSave; + protected + function GetDefaultBoolean( const Index : Integer ) : Boolean; virtual; abstract; + function GetBoolean( const Index : Integer ) : Boolean; virtual; abstract; + procedure SetBoolean( const Index : Integer; const Value : Boolean ); virtual; + function GetDefaultDateTime( const Index : Integer ) : TDateTime; virtual; abstract; + function GetDateTime( const Index : Integer ) : TDateTime; virtual; abstract; + procedure SetDateTime( const Index : Integer; const Value : TDateTime ); virtual; + function GetDefaultInteger( const Index : Integer ) : Integer; virtual; abstract; + function GetInteger( const Index : Integer ) : Integer; virtual; abstract; + procedure SetInteger( const Index : Integer; const Value : Integer ); virtual; + function GetDefaultFloat( const Index : Integer ) : single; virtual; abstract; + function GetFloat( const Index : Integer ) : single; virtual; abstract; + procedure SetFloat( const Index : Integer; const Value : single ); virtual; + function GetDefaultString( const Index : Integer ) : string; virtual; abstract; + function GetString( const Index : Integer ) : string; virtual; abstract; + procedure SetString( const Index : Integer; const Value : string ); virtual; + function GetDefaultBinaryStream( const Index : Integer ) : TStream; virtual; abstract; + function GetBinaryStream( const Index : Integer ) : TStream; virtual; abstract; + procedure SetBinaryStream( const Index : Integer; const Value : TStream ); virtual; + public + procedure Update; virtual; abstract; + constructor Create; virtual; + destructor Destroy; override; + property AutoSave : Boolean read FAutoSave write FAutoSave; + end; + +implementation + +{ TUserPreferences } +procedure TUserPreferences.CheckAutoSave; +begin + if FAutoSave then + Update; +end; + +constructor TUserPreferences.Create; +begin + inherited; + FAutoSave := false; +end; + +destructor TUserPreferences.Destroy; +begin + + inherited; +end; + +procedure TUserPreferences.SetBinaryStream( const Index : Integer; const Value : TStream ); +begin + CheckAutoSave; +end; + +procedure TUserPreferences.SetBoolean(const Index: Integer; const Value: Boolean); +begin + CheckAutoSave; +end; + +procedure TUserPreferences.SetDateTime(const Index: Integer; const Value: TDateTime); +begin + CheckAutoSave; +end; + +procedure TUserPreferences.SetFloat(const Index: Integer; const Value: single); +begin + CheckAutoSave; +end; + +procedure TUserPreferences.SetInteger(const Index, Value: Integer); +begin + CheckAutoSave; +end; + +procedure TUserPreferences.SetString(const Index: Integer; const Value: string); +begin + CheckAutoSave; +end; + +end. diff --git a/Game/Code/lib/JEDI-SDL/SDL_Image/Pas/sdl_image.pas b/Game/Code/lib/JEDI-SDL/SDL_Image/Pas/sdl_image.pas new file mode 100644 index 00000000..fecc0dbc --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/SDL_Image/Pas/sdl_image.pas @@ -0,0 +1,287 @@ +unit sdl_image; +{ + $Id: sdl_image.pas,v 1.7 2005/01/01 02:03:12 savage Exp $ + +} +{******************************************************************************} +{ } +{ Borland Delphi SDL_Image - An example image loading library for use } +{ with SDL } +{ Conversion of the Simple DirectMedia Layer Image Headers } +{ } +{ Portions created by Sam Lantinga are } +{ Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga } +{ 5635-34 Springhouse Dr. } +{ Pleasanton, CA 94588 (USA) } +{ } +{ All Rights Reserved. } +{ } +{ The original files are : SDL_image.h } +{ } +{ The initial developer of this Pascal code was : } +{ Matthias Thoma } +{ } +{ Portions created by Matthias Thoma are } +{ Copyright (C) 2000 - 2001 Matthias Thoma. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ Dominique Louis } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ A simple library to load images of various formats as SDL surfaces } +{ } +{ Requires } +{ -------- } +{ SDL.pas in your search path. } +{ } +{ Programming Notes } +{ ----------------- } +{ See the Aliens Demo on how to make use of this libaray } +{ } +{ Revision History } +{ ---------------- } +{ April 02 2001 - MT : Initial Translation } +{ } +{ May 08 2001 - DL : Added ExternalSym derectives and copyright header } +{ } +{ April 03 2003 - DL : Added jedi-sdl.inc include file to support more } +{ Pascal compilers. Initial support is now included } +{ for GnuPascal, VirtualPascal, TMT and obviously } +{ continue support for Delphi Kylix and FreePascal. } +{ } +{ April 08 2003 - MK : Aka Mr Kroket - Added Better FPC support } +{ } +{ April 24 2003 - DL : under instruction from Alexey Barkovoy, I have added} +{ better TMT Pascal support and under instruction } +{ from Prof. Abimbola Olowofoyeku (The African Chief),} +{ I have added better Gnu Pascal support } +{ } +{ April 30 2003 - DL : under instruction from David Mears AKA } +{ Jason Siletto, I have added FPC Linux support. } +{ This was compiled with fpc 1.1, so remember to set } +{ include file path. ie. -Fi/usr/share/fpcsrc/rtl/* } +{ } +{ + $Log: sdl_image.pas,v $ + Revision 1.7 2005/01/01 02:03:12 savage + Updated to v1.2.4 + + Revision 1.6 2004/08/14 22:54:30 savage + Updated so that Library name defines are correctly defined for MacOS X. + + Revision 1.5 2004/05/10 14:10:04 savage + Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ). + + Revision 1.4 2004/04/13 09:32:08 savage + Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary. + + Revision 1.3 2004/04/01 20:53:23 savage + Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site. + + Revision 1.2 2004/03/30 20:23:28 savage + Tidied up use of UNIX compiler directive. + + Revision 1.1 2004/02/14 23:35:42 savage + version 1 of sdl_image, sdl_mixer and smpeg. + + +} +{******************************************************************************} + +{$I jedi-sdl.inc} + +{$ALIGN ON} + +interface + +uses +{$IFDEF __GPC__} + gpc, +{$ENDIF} + sdl; + +const +{$IFDEF WIN32} + SDL_ImageLibName = 'SDL_Image.dll'; +{$ENDIF} + +{$IFDEF UNIX} +{$IFDEF DARWIN} + SDL_ImageLibName = 'libSDL_image.dylib'; +{$ELSE} + SDL_ImageLibName = 'libSDL_image.so'; +{$ENDIF} +{$ENDIF} + +{$IFDEF MACOS} + SDL_ImageLibName = 'SDL_image'; +{$ENDIF} + + // Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL + SDL_IMAGE_MAJOR_VERSION = 1; +{$EXTERNALSYM SDL_IMAGE_MAJOR_VERSION} + SDL_IMAGE_MINOR_VERSION = 2; +{$EXTERNALSYM SDL_IMAGE_MINOR_VERSION} + SDL_IMAGE_PATCHLEVEL = 4; +{$EXTERNALSYM SDL_IMAGE_PATCHLEVEL} + +{ This macro can be used to fill a version structure with the compile-time + version of the SDL_image library. } +procedure SDL_IMAGE_VERSION( var X : TSDL_Version ); +{$EXTERNALSYM SDL_IMAGE_VERSION} + +{ This function gets the version of the dynamically linked SDL_image library. + it should NOT be used to fill a version structure, instead you should + use the SDL_IMAGE_VERSION() macro. + } +function IMG_Linked_Version : PSDL_version; +external {$IFDEF __GPC__}name 'IMG_Linked_Version'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_Linked_Version} + +{ Load an image from an SDL data source. + The 'type' may be one of: "BMP", "GIF", "PNG", etc. + + If the image format supports a transparent pixel, SDL will set the + colorkey for the surface. You can enable RLE acceleration on the + surface afterwards by calling: + SDL_SetColorKey(image, SDL_RLEACCEL, image.format.colorkey); +} +function IMG_LoadTyped_RW(src: PSDL_RWops; freesrc: Integer; _type: PChar): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadTyped_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadTyped_RW} +{ Convenience functions } +function IMG_Load(const _file: PChar): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_Load'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_Load} +function IMG_Load_RW(src: PSDL_RWops; freesrc: Integer): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_Load_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_Load_RW} + +{ Invert the alpha of a surface for use with OpenGL + This function is now a no-op, and only provided for backwards compatibility. } +function IMG_InvertAlpha(_on: Integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_InvertAlpha'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_InvertAlpha} + +{ Functions to detect a file type, given a seekable source } +function IMG_isBMP(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isBMP'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isBMP} +function IMG_isPNM(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isPNM'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isPNM} +function IMG_isXPM(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isXPM'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isXPM} +function IMG_isXCF(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isXCF'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isXCF} +function IMG_isPCX(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isPCX'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isPCX} +function IMG_isGIF(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isGIF'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isGIF} +function IMG_isJPG(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isJPG'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isJPG} +function IMG_isTIF(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isTIF'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isTIF} +function IMG_isPNG(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isPNG'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isPNG} +function IMG_isLBM(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isLBM'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isLBM} + +{ Individual loading functions } +function IMG_LoadBMP_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadBMP_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadBMP_RW} +function IMG_LoadPNM_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadPNM_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadPNM_RW} +function IMG_LoadXPM_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadXPM_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadXPM_RW} +function IMG_LoadXCF_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadXCF_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadXCF_RW} +function IMG_LoadPCX_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadPCX_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadPCX_RW} +function IMG_LoadGIF_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadGIF_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadGIF_RW} +function IMG_LoadJPG_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadJPG_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadJPG_RW} +function IMG_LoadTIF_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadTIF_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadTIF_RW} +function IMG_LoadPNG_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadPNG_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadPNG_RW} +function IMG_LoadTGA_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadTGA_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadTGA_RW} +function IMG_LoadLBM_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadLBM_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadLBM_RW} + +{ used internally, NOT an exported function } +//function IMG_string_equals( const str1 : PChar; const str2 : PChar ) : integer; +//cdecl; external {$IFDEF __GPC__}name 'IMG_string_equals'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +//{ $ EXTERNALSYM IMG_string_equals} + +{ Error Macros } +{ We'll use SDL for reporting errors } +procedure IMG_SetError( fmt : PChar ); + +function IMG_GetError : PChar; + +implementation + +{$IFDEF __GPC__} + {$L 'sdl_image'} { link sdl_image.dll.a or libsdl_image.so or libsdl_image.a } +{$ENDIF} + +procedure SDL_IMAGE_VERSION( var X : TSDL_Version ); +begin + X.major := SDL_IMAGE_MAJOR_VERSION; + X.minor := SDL_IMAGE_MINOR_VERSION; + X.patch := SDL_IMAGE_PATCHLEVEL; +end; + +procedure IMG_SetError( fmt : PChar ); +begin + SDL_SetError( fmt ); +end; + +function IMG_GetError : PChar; +begin + result := SDL_GetError; +end; + +end. diff --git a/Game/Code/lib/JEDI-SDL/SDL_ttf/Pas/sdl_ttf.pas b/Game/Code/lib/JEDI-SDL/SDL_ttf/Pas/sdl_ttf.pas new file mode 100644 index 00000000..eea69719 --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/SDL_ttf/Pas/sdl_ttf.pas @@ -0,0 +1,451 @@ +unit sdl_ttf; +{ + $Id: sdl_ttf.pas,v 1.10 2005/01/02 19:07:32 savage Exp $ + +} +{******************************************************************************} +{ } +{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } +{ Conversion of the Simple DirectMedia Layer Headers } +{ } +{ Portions created by Sam Lantinga are } +{ Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga } +{ 5635-34 Springhouse Dr. } +{ Pleasanton, CA 94588 (USA) } +{ } +{ All Rights Reserved. } +{ } +{ The original files are : SDL_ttf.h } +{ } +{ The initial developer of this Pascal code was : } +{ Dominqiue Louis } +{ } +{ Portions created by Dominqiue Louis are } +{ Copyright (C) 2000 - 2001 Dominqiue Louis. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ Tom Jones His Project inspired this conversion } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ } +{ } +{ } +{ } +{ } +{ } +{ } +{ Requires } +{ -------- } +{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } +{ They are available from... } +{ http://www.libsdl.org . } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ December 08 2002 - DL : Fixed definition of TTF_RenderUnicode_Solid } +{ } +{ April 03 2003 - DL : Added jedi-sdl.inc include file to support more } +{ Pascal compilers. Initial support is now included } +{ for GnuPascal, VirtualPascal, TMT and obviously } +{ continue support for Delphi Kylix and FreePascal. } +{ } +{ April 24 2003 - DL : under instruction from Alexey Barkovoy, I have added} +{ better TMT Pascal support and under instruction } +{ from Prof. Abimbola Olowofoyeku (The African Chief),} +{ I have added better Gnu Pascal support } +{ } +{ April 30 2003 - DL : under instruction from David Mears AKA } +{ Jason Siletto, I have added FPC Linux support. } +{ This was compiled with fpc 1.1, so remember to set } +{ include file path. ie. -Fi/usr/share/fpcsrc/rtl/* } +{ } +{ + $Log: sdl_ttf.pas,v $ + Revision 1.10 2005/01/02 19:07:32 savage + Slight bug fix to use LongInt instead of Long ( Thanks Michalis Kamburelis ) + + Revision 1.9 2005/01/01 02:15:20 savage + Updated to v2.0.7 + + Revision 1.8 2004/10/07 21:02:32 savage + Fix for FPC + + Revision 1.7 2004/09/30 22:39:50 savage + Added a true type font class which contains a wrap text function. + Changed the sdl_ttf.pas header to reflect the future of jedi-sdl. + + Revision 1.6 2004/08/14 22:54:30 savage + Updated so that Library name defines are correctly defined for MacOS X. + + Revision 1.5 2004/05/10 14:10:04 savage + Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ). + + Revision 1.4 2004/04/13 09:32:08 savage + Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary. + + Revision 1.3 2004/04/01 20:53:24 savage + Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site. + + Revision 1.2 2004/03/30 20:23:28 savage + Tidied up use of UNIX compiler directive. + + Revision 1.1 2004/02/16 22:16:40 savage + v1.0 changes + + +} +{******************************************************************************} + +{$I jedi-sdl.inc} + +{$ALIGN ON} + +interface + +uses +{$IFDEF __GPC__} + gpc, +{$ENDIF} + +{$IFDEF WIN32} + {$IFNDEF __GPC__} + Windows, + {$ENDIF} +{$ENDIF} + sdl; + +const +{$IFDEF WIN32} + SDLttfLibName = 'SDL_ttf.dll'; +{$ENDIF} + +{$IFDEF UNIX} +{$IFDEF DARWIN} + SDLttfLibName = 'libSDL_ttf.dylib'; +{$ELSE} + SDLttfLibName = 'libSDL_ttf.so'; +{$ENDIF} +{$ENDIF} + +{$IFDEF MACOS} + SDLttfLibName = 'SDL_ttf'; +{$ENDIF} + + {* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL *} + SDL_TTF_MAJOR_VERSION = 2; +{$EXTERNALSYM SDL_TTF_MAJOR_VERSION} + SDL_TTF_MINOR_VERSION = 0; +{$EXTERNALSYM SDL_TTF_MINOR_VERSION} + SDL_TTF_PATCHLEVEL = 7; +{$EXTERNALSYM SDL_TTF_PATCHLEVEL} + + // Backwards compatibility + TTF_MAJOR_VERSION = SDL_TTF_MAJOR_VERSION; + TTF_MINOR_VERSION = SDL_TTF_MINOR_VERSION; + TTF_PATCHLEVEL = SDL_TTF_PATCHLEVEL; + +{* + Set and retrieve the font style + This font style is implemented by modifying the font glyphs, and + doesn't reflect any inherent properties of the truetype font file. +*} + TTF_STYLE_NORMAL = $00; + TTF_STYLE_BOLD = $01; + TTF_STYLE_ITALIC = $02; + TTF_STYLE_UNDERLINE = $04; + +// ZERO WIDTH NO-BREAKSPACE (Unicode byte order mark) + UNICODE_BOM_NATIVE = $FEFF; + UNICODE_BOM_SWAPPED = $FFFE; + +type + PTTF_Font = ^TTTF_font; + TTTF_Font = record + end; + +{ This macro can be used to fill a version structure with the compile-time + version of the SDL_ttf library. } +procedure SDL_TTF_VERSION( var X : TSDL_version ); +{$EXTERNALSYM SDL_TTF_VERSION} + +{ This function gets the version of the dynamically linked SDL_ttf library. + It should NOT be used to fill a version structure, instead you should use the + SDL_TTF_VERSION() macro. } +function TTF_Linked_Version : PSDL_version; +cdecl; external {$IFDEF __GPC__}name 'TTF_Linked_Version'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_Linked_Version} + +{ This function tells the library whether UNICODE text is generally + byteswapped. A UNICODE BOM character in a string will override + this setting for the remainder of that string. +} +procedure TTF_ByteSwappedUNICODE( swapped : integer ); +cdecl; external {$IFDEF __GPC__}name 'TTF_ByteSwappedUNICODE'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_ByteSwappedUNICODE} + +//returns 0 on succes, -1 if error occurs +function TTF_Init : integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_Init'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_Init} + +{ + Open a font file and create a font of the specified point size. + Some .fon fonts will have several sizes embedded in the file, so the + point size becomes the index of choosing which size. If the value + is too high, the last indexed size will be the default. +} +function TTF_OpenFont( const filename : Pchar; ptsize : integer ) : PTTF_Font; +cdecl; external {$IFDEF __GPC__}name 'TTF_OpenFont'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_OpenFont} + +function TTF_OpenFontIndex( const filename : Pchar; ptsize : integer; index : Longint ): PTTF_Font; +cdecl; external {$IFDEF __GPC__}name 'TTF_OpenFontIndex'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_OpenFontIndex} + +function TTF_OpenFontRW( src : PSDL_RWops; freesrc : integer; ptsize : integer ): PTTF_Font; +cdecl; external {$IFDEF __GPC__}name 'TTF_OpenFontRW'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_OpenFontRW} + +function TTF_OpenFontIndexRW( src : PSDL_RWops; freesrc : integer; ptsize : integer; index : Longint ): PTTF_Font; +cdecl; external {$IFDEF __GPC__}name 'TTF_OpenFontIndexRW'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_OpenFontIndexRW} + +function TTF_GetFontStyle( font : PTTF_Font) : integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_GetFontStyle'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_GetFontStyle} + +procedure TTF_SetFontStyle( font : PTTF_Font; style : integer ); +cdecl; external {$IFDEF __GPC__}name 'TTF_SetFontStyle'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_SetFontStyle} + +{ Get the total height of the font - usually equal to point size } +function TTF_FontHeight( font : PTTF_Font ) : Integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_FontHeight'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_FontHeight} + +{ Get the offset from the baseline to the top of the font + This is a positive value, relative to the baseline. +} +function TTF_FontAscent( font : PTTF_Font ) : Integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_FontAscent'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_FontAscent} +{ Get the offset from the baseline to the bottom of the font + This is a negative value, relative to the baseline. +} +function TTF_FontDescent( font : PTTF_Font ) : Integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_FontDescent'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_FontDescent} + +{ Get the recommended spacing between lines of text for this font } +function TTF_FontLineSkip( font : PTTF_Font ): Integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_FontLineSkip'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_FontLineSkip} + +{ Get the number of faces of the font } +function TTF_FontFaces( font : PTTF_Font ) : Longint; +cdecl; external {$IFDEF __GPC__}name 'TTF_FontFaces'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_FontFaces} + +{ Get the font face attributes, if any } +function TTF_FontFaceIsFixedWidth( font : PTTF_Font ): Integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_FontFaceIsFixedWidth'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_FontFaceIsFixedWidth} + +function TTF_FontFaceFamilyName( font : PTTF_Font ): PChar; +cdecl; external {$IFDEF __GPC__}name 'TTF_FontFaceFamilyName'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_FontFaceFamilyName} + +function TTF_FontFaceStyleName( font : PTTF_Font ): PChar; +cdecl; external {$IFDEF __GPC__}name 'TTF_FontFaceStyleName'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_FontFaceStyleName} + +{ Get the metrics (dimensions) of a glyph } +function TTF_GlyphMetrics( font : PTTF_Font; ch : Uint16; + var minx : integer; var maxx : integer; + var miny : integer; var maxy : integer; + var advance : integer ): Integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_GlyphMetrics'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_GlyphMetrics} + +{ Get the dimensions of a rendered string of text } +function TTF_SizeText( font : PTTF_Font; const text : PChar; var w : integer; var y : integer ): Integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_SizeText'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_SizeText} + +function TTF_SizeUTF8( font : PTTF_Font; const text : PChar; var w : integer; var y : integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_SizeUTF8'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_SizeUTF8} + +function TTF_SizeUNICODE( font : PTTF_Font; const text : PUint16; var w : integer; var y : integer): Integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_SizeUNICODE'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_SizeUNICODE} + +{ Create an 8-bit palettized surface and render the given text at + fast quality with the given font and color. The 0 pixel is the + colorkey, giving a transparent background, and the 1 pixel is set + to the text color. + This function returns the new surface, or NULL if there was an error. +} +function TTF_RenderText_Solid( font : PTTF_Font; + const text : PChar; fg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderText_Solid'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderText_Solid} + +function TTF_RenderUTF8_Solid( font : PTTF_Font; + const text : PChar; fg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderUTF8_Solid'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderUTF8_Solid} + +function TTF_RenderUNICODE_Solid( font : PTTF_Font; + const text :PUint16; fg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderUNICODE_Solid'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderUNICODE_Solid} + +{ +Create an 8-bit palettized surface and render the given glyph at + fast quality with the given font and color. The 0 pixel is the + colorkey, giving a transparent background, and the 1 pixel is set + to the text color. The glyph is rendered without any padding or + centering in the X direction, and aligned normally in the Y direction. + This function returns the new surface, or NULL if there was an error. +} +function TTF_RenderGlyph_Solid( font : PTTF_Font; + ch : Uint16; fg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderGlyph_Solid'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderGlyph_Solid} + +{ Create an 8-bit palettized surface and render the given text at + high quality with the given font and colors. The 0 pixel is background, + while other pixels have varying degrees of the foreground color. + This function returns the new surface, or NULL if there was an error. +} +function TTF_RenderText_Shaded( font : PTTF_Font; + const text : PChar; fg : TSDL_Color; bg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderText_Shaded'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderText_Shaded} +function TTF_RenderUTF8_Shaded( font : PTTF_Font; + const text : PChar; fg : TSDL_Color; bg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderUTF8_Shaded'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderUTF8_Shaded} +function TTF_RenderUNICODE_Shaded( font : PTTF_Font; + const text : PUint16; fg : TSDL_Color; bg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderUNICODE_Shaded'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderUNICODE_Shaded} + +{ Create an 8-bit palettized surface and render the given glyph at + high quality with the given font and colors. The 0 pixel is background, + while other pixels have varying degrees of the foreground color. + The glyph is rendered without any padding or centering in the X + direction, and aligned normally in the Y direction. + This function returns the new surface, or NULL if there was an error. +} +function TTF_RenderGlyph_Shaded( font : PTTF_Font; ch : Uint16; fg : TSDL_Color; + bg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderGlyph_Shaded'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderGlyph_Shaded} + +{ Create a 32-bit ARGB surface and render the given text at high quality, + using alpha blending to dither the font with the given color. + This function returns the new surface, or NULL if there was an error. +} +function TTF_RenderText_Blended( font : PTTF_Font; + const text : PChar; fg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderText_Blended'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderText_Blended} +function TTF_RenderUTF8_Blended( font : PTTF_Font; + const text : PChar; fg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderUTF8_Blended'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderUTF8_Blended} +function TTF_RenderUNICODE_Blended( font : PTTF_Font; + const text: PUint16; fg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderUNICODE_Blended'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderUNICODE_Blended} + +{ Create a 32-bit ARGB surface and render the given glyph at high quality, + using alpha blending to dither the font with the given color. + The glyph is rendered without any padding or centering in the X + direction, and aligned normally in the Y direction. + This function returns the new surface, or NULL if there was an error. +} +function TTF_RenderGlyph_Blended( font : PTTF_Font; ch : Uint16; fg : TSDL_Color ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'TTF_RenderGlyph_Blended'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_RenderGlyph_Blended} + +{ For compatibility with previous versions, here are the old functions } +{#define TTF_RenderText(font, text, fg, bg) + TTF_RenderText_Shaded(font, text, fg, bg) +#define TTF_RenderUTF8(font, text, fg, bg) + TTF_RenderUTF8_Shaded(font, text, fg, bg) +#define TTF_RenderUNICODE(font, text, fg, bg) + TTF_RenderUNICODE_Shaded(font, text, fg, bg)} + +{ Close an opened font file } +procedure TTF_CloseFont( font : PTTF_Font ); +cdecl; external {$IFDEF __GPC__}name 'TTF_CloseFont'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_CloseFont} + +//De-initialize TTF engine +procedure TTF_Quit; +cdecl; external {$IFDEF __GPC__}name 'TTF_Quit'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_Quit} + +// Check if the TTF engine is initialized +function TTF_WasInit : integer; +cdecl; external {$IFDEF __GPC__}name 'TTF_WasInit'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; +{$EXTERNALSYM TTF_WasInit} + +// We'll use SDL for reporting errors +procedure TTF_SetError( fmt : PChar ); + +function TTF_GetError : PChar; + +implementation + +{$IFDEF __GPC__} + {$L 'sdl_ttf'} { link sdl_ttf.dll.a or libsdl_ttf.so or libsdl_ttf.a } +{$ENDIF} + +procedure SDL_TTF_VERSION( var X : TSDL_version ); +begin + X.major := SDL_TTF_MAJOR_VERSION; + X.minor := SDL_TTF_MINOR_VERSION; + X.patch := SDL_TTF_PATCHLEVEL; +end; + +procedure TTF_SetError( fmt : PChar ); +begin + SDL_SetError( fmt ); +end; + +function TTF_GetError : PChar; +begin + result := SDL_GetError; +end; + +end. diff --git a/Game/Code/lib/JEDI-SDL/SDL_ttf/Pas/sdltruetypefont.pas b/Game/Code/lib/JEDI-SDL/SDL_ttf/Pas/sdltruetypefont.pas new file mode 100644 index 00000000..4b53ddd9 --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/SDL_ttf/Pas/sdltruetypefont.pas @@ -0,0 +1,437 @@ +unit sdltruetypefont; +{ + $Id: sdltruetypefont.pas,v 1.1 2004/09/30 22:39:50 savage Exp $ + +} +{******************************************************************************} +{ } +{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } +{ Wrapper class for SDL_ttf } +{ } +{ The initial developer of this Pascal code was : } +{ Dominqiue Louis } +{ } +{ Portions created by Dominqiue Louis are } +{ Copyright (C) 2000 - 2001 Dominqiue Louis. } +{ } +{ } +{ Contributor(s) } +{ -------------- } +{ } +{ } +{ Obtained through: } +{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } +{ } +{ You may retrieve the latest version of this file at the Project } +{ JEDI home page, located at http://delphi-jedi.org } +{ } +{ The contents of this file are used with permission, subject to } +{ the Mozilla Public License Version 1.1 (the "License"); you may } +{ not use this file except in compliance with the License. You may } +{ obtain a copy of the License at } +{ http://www.mozilla.org/MPL/MPL-1.1.html } +{ } +{ Software distributed under the License is distributed on an } +{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } +{ implied. See the License for the specific language governing } +{ rights and limitations under the License. } +{ } +{ Description } +{ ----------- } +{ } +{ } +{ } +{ } +{ } +{ } +{ } +{ Requires } +{ -------- } +{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } +{ They are available from... } +{ http://www.libsdl.org . } +{ } +{ Programming Notes } +{ ----------------- } +{ } +{ } +{ } +{ } +{ Revision History } +{ ---------------- } +{ September 23 2004 - DL : Initial Creation } +{ + $Log: sdltruetypefont.pas,v $ + Revision 1.1 2004/09/30 22:39:50 savage + Added a true type font class which contains a wrap text function. + Changed the sdl_ttf.pas header to reflect the future of jedi-sdl. + + +} +{******************************************************************************} + +interface + +uses + sdl, + sdl_ttf; + +type + TRenderType = ( rtLatin1, rtUTF8, rtUnicode ); + TSDLFontStyle = ( fsBold, fsItalic, fsUnderline, fsStrikeOut ); + + TSDLFontStyles = set of TSDLFontStyle; + + TTrueTypeFont = class( TObject ) + private + FFont : PTTF_Font; + FSolid : Boolean; + FBackGroundColour : TSDL_Color; + FForeGroundColour : TSDL_Color; + FRenderType : TRenderType; + FStyle : TSDLFontStyles; + FFontFile : string; + FFontSize : integer; + procedure PrepareFont; + protected + + public + constructor Create( aFontFile : string; aRenderStyle : TSDLFontStyles = [ ]; aFontSize : integer = 14 ); + destructor Destroy; override; + function DrawText( aText : WideString ) : PSDL_Surface; overload; + function DrawText( aText : WideString; aWidth, aHeight : Integer ) : PSDL_Surface; overload; + property BackGroundColour : TSDL_Color read FBackGroundColour write FBackGroundColour; + property ForeGroundColour : TSDL_Color read FForeGroundColour write FForeGroundColour; + property FontFile : string read FFontFile write FFontFile; + property RenderType : TRenderType read FRenderType write FRenderType; + property Solid : Boolean read FSolid write FSolid; + property Style : TSDLFontStyles read FStyle write FStyle; + property FontSize : integer read FFontSize write FFontSize; + end; + + +implementation + +uses + SysUtils; + +{ TTrueTypeFont } + +constructor TTrueTypeFont.Create( aFontFile : string; aRenderStyle : TSDLFontStyles; aFontSize : integer ); +begin + inherited Create; + if FileExists( aFontFile ) then + begin + FStyle := aRenderStyle; + FFontSize := aFontSize; + FSolid := false; + FBackGroundColour.r := 255; + FBackGroundColour.g := 255; + FBackGroundColour.b := 255; + FForeGroundColour.r := 0; + FForeGroundColour.g := 0; + FForeGroundColour.b := 0; + FRenderType := rtUTF8; + if ( TTF_Init >= 0 ) then + begin + FFontFile := aFontFile; + end + else + raise Exception.Create( 'Failed to Initialiase SDL_TTF' ); + end + else + raise Exception.Create( 'Font File does not exist' ); +end; + +destructor TTrueTypeFont.Destroy; +begin + if FFont <> nil then + TTF_CloseFont( FFont ); + TTF_Quit; + inherited; +end; + +function TTrueTypeFont.DrawText( aText : WideString ) : PSDL_Surface; +begin + PrepareFont; + + result := nil; + + case FRenderType of + rtLatin1 : + begin + if ( FSolid ) then + begin + result := TTF_RenderText_Solid( FFont, PChar( string( aText ) ), FForeGroundColour ); + end + else + begin + result := TTF_RenderText_Shaded( FFont, PChar( string( aText ) ), FForeGroundColour, FBackGroundColour ); + end; + end; + + rtUTF8 : + begin + if ( FSolid ) then + begin + result := TTF_RenderUTF8_Solid( FFont, PChar( string( aText ) ), FForeGroundColour ); + end + else + begin + result := TTF_RenderUTF8_Shaded( FFont, PChar( string( aText ) ), FForeGroundColour, FBackGroundColour ); + end; + end; + + rtUnicode : + begin + if ( FSolid ) then + begin + result := TTF_RenderUNICODE_Solid( FFont, PUInt16( aText ), FForeGroundColour ); + end + else + begin + result := TTF_RenderUNICODE_Shaded( FFont, PUInt16( aText ), FForeGroundColour, FBackGroundColour ); + end; + end; + end; +end; + +function TTrueTypeFont.DrawText( aText : WideString; aWidth, aHeight : Integer ) : PSDL_Surface; +var + textw, texth, i, yPos : integer; + strChopped : WideString; + SurfaceList : array of PSDL_Surface; + strlist : array of WideString; + ReturnedSurface : PSDL_Surface; + BltRect : TSDL_Rect; +begin + PrepareFont; + + // Do an initial check to see if it already fits + case FRenderType of + rtLatin1 : + begin + if TTF_SizeText( FFont, PChar( string( aText ) ), textw, texth ) = 0 then + begin + if ( textw < aWidth ) + and ( texth < aHeight ) then + begin + result := DrawText( aText ); + exit; + end + end; + end; + + rtUTF8 : + begin + if TTF_SizeUTF8( FFont, PChar( string( aText ) ), textw, texth ) = 0 then + begin + if ( textw < aWidth ) + and ( texth < aHeight ) then + begin + result := DrawText( aText ); + exit; + end + end; + end; + + rtUnicode : + begin + if TTF_SizeUNICODE( FFont, PUInt16( aText ), textw, texth ) = 0 then + begin + if ( textw < aWidth ) + and ( texth < aHeight ) then + begin + result := DrawText( aText ); + exit; + end + end; + end; + end; + + // Create the Surface we will be returning + ReturnedSurface := SDL_DisplayFormat( SDL_CreateRGBSurface( SDL_SRCCOLORKEY or SDL_RLEACCEL or SDL_HWACCEL, aWidth, aHeight, 16, 0, 0, 0, 0 ) ); + + // If we are still here there is some serious parsing to do + case FRenderType of + rtLatin1 : + begin + strChopped := aText; + i := Length( strChopped ); + while ( i <> 0 ) do + begin + if ( string( strChopped[ i ] ) <> ' ' ) and ( Integer( string( strChopped[ i ] ) ) <> 13 ) then + dec( i ) + else + begin + dec( i ); + strChopped := Copy( strChopped, 0, i ); + if TTF_SizeText( FFont, PChar( string( strChopped ) ), textw, texth ) = 0 then + begin + if ( textw < aWidth ) + and ( texth < aHeight ) then + begin + SetLength( strlist, Length( strlist ) + 1 ); + strlist[ Length( strlist ) - 1 ] := strChopped; + strChopped := Copy( aText, i + 2, Length( aText ) - ( i - 1 ) ); + i := Length( strChopped ); + if TTF_SizeText( FFont, PChar( string( strChopped ) ), textw, texth ) = 0 then + begin + SetLength( strlist, Length( strlist ) + 1 ); + strlist[ Length( strlist ) - 1 ] := strChopped; + break; + end; + end; + end; + end; + end; + SetLength( SurfaceList, Length( strlist ) ); + for i := Low( strlist ) to High( strlist ) do + begin + if ( FSolid ) then + begin + SurfaceList[ i ] := TTF_RenderText_Solid( FFont, PChar( string( strlist[ i ] ) ), FForeGroundColour ); + end + else + begin + SurfaceList[ i ] := TTF_RenderText_Shaded( FFont, PChar( string( strlist[ i ] ) ), FForeGroundColour, FBackGroundColour ); + end; + end; + end; + + rtUTF8 : + begin + strChopped := aText; + i := Length( strChopped ); + while ( i <> 0 ) do + begin + if ( string( strChopped[ i ] ) <> ' ' ) and ( Integer( string( strChopped[ i ] ) ) <> 13 ) then + dec( i ) + else + begin + dec( i ); + strChopped := Copy( strChopped, 0, i ); + if TTF_SizeUTF8( FFont, PChar( string( strChopped ) ), textw, texth ) = 0 then + begin + if ( textw < aWidth ) + and ( texth < aHeight ) then + begin + SetLength( strlist, Length( strlist ) + 1 ); + strlist[ Length( strlist ) - 1 ] := strChopped; + strChopped := Copy( aText, i + 2, Length( aText ) - ( i - 1 ) ); + i := Length( strChopped ); + if TTF_SizeUTF8( FFont, PChar( string( strChopped ) ), textw, texth ) = 0 then + begin + SetLength( strlist, Length( strlist ) + 1 ); + strlist[ Length( strlist ) - 1 ] := strChopped; + break; + end; + end; + end; + end; + end; + SetLength( SurfaceList, Length( strlist ) ); + for i := Low( strlist ) to High( strlist ) do + begin + if ( FSolid ) then + begin + SurfaceList[ i ] := TTF_RenderUTF8_Solid( FFont, PChar( string( strlist[ i ] ) ), FForeGroundColour ); + end + else + begin + SurfaceList[ i ] := TTF_RenderUTF8_Shaded( FFont, PChar( string( strlist[ i ] ) ), FForeGroundColour, FBackGroundColour ); + end; + end; + end; + + rtUnicode : + begin + strChopped := aText; + i := Length( strChopped ); + while ( i <> 0 ) do + begin + if ( string( strChopped[ i ] ) <> ' ' ) and ( Integer( string( strChopped[ i ] ) ) <> 13 ) then + dec( i ) + else + begin + dec( i ); + strChopped := Copy( strChopped, 0, i ); + if TTF_SizeUNICODE( FFont, PUInt16( strChopped ), textw, texth ) = 0 then + begin + if ( textw < aWidth ) + and ( texth < aHeight ) then + begin + SetLength( strlist, Length( strlist ) + 1 ); + strlist[ Length( strlist ) - 1 ] := strChopped; + strChopped := Copy( aText, i + 2, Length( aText ) - ( i - 1 ) ); + i := Length( strChopped ); + if TTF_SizeUNICODE( FFont, PUInt16( strChopped ), textw, texth ) = 0 then + begin + SetLength( strlist, Length( strlist ) + 1 ); + strlist[ Length( strlist ) - 1 ] := strChopped; + break; + end; + end; + end; + end; + end; + SetLength( SurfaceList, Length( strlist ) ); + for i := Low( strlist ) to High( strlist ) do + begin + if ( FSolid ) then + begin + SurfaceList[ i ] := TTF_RenderUNICODE_Solid( FFont, PUInt16( strlist[ i ] ), FForeGroundColour ); + end + else + begin + SurfaceList[ i ] := TTF_RenderUNICODE_Shaded( FFont, PUInt16( strlist[ i ] ), FForeGroundColour, FBackGroundColour ); + end; + end; + end; + end; + + // Now Draw the SurfaceList onto the resulting Surface + yPos := 6; + for i := Low( SurfaceList ) to High( SurfaceList ) do + begin + BltRect.x := 6; + BltRect.y := yPos; + BltRect.w := SurfaceList[ i ].w; + BltRect.h := SurfaceList[ i ].h; + SDL_BlitSurface( SurfaceList[ i ], nil, ReturnedSurface, @BltRect ); + yPos := yPos + TTF_FontHeight( FFont ); + end; + result := ReturnedSurface; + + for i := Low( SurfaceList ) to High( SurfaceList ) do + begin + SDL_FreeSurface( SurfaceList[ i ] ); + end; + SetLength( SurfaceList, 0 ); + SetLength( strlist, 0 ); +end; + +procedure TTrueTypeFont.PrepareFont; +var + renderstyle : integer; +begin + if FFont <> nil then + TTF_CloseFont( FFont ); + + FFont := TTF_OpenFont( PChar( FFontFile ), FFontSize ); + + renderstyle := TTF_STYLE_NORMAL; + if ( fsBold in FStyle ) then + renderstyle := renderstyle or TTF_STYLE_BOLD; + + if ( fsItalic in FStyle ) then + renderstyle := renderstyle or TTF_STYLE_ITALIC; + + if ( fsUnderline in FStyle ) then + renderstyle := renderstyle or TTF_STYLE_UNDERLINE; + + TTF_SetFontStyle( FFont, renderstyle ); +end; + +end. + diff --git a/Game/Code/lib/JEDI-SDL/fpc-install.sh b/Game/Code/lib/JEDI-SDL/fpc-install.sh new file mode 100644 index 00000000..ea6c4928 --- /dev/null +++ b/Game/Code/lib/JEDI-SDL/fpc-install.sh @@ -0,0 +1,252 @@ +#!/bin/sh +# +# FreePascal & Delphi Installation script for JEDI-SDL +# portions of which are based on the FreePascal install script +# Copyright 1996-2002 Michael Van Canneyt and Peter Vreman +# +# Copyright (c)2004-2100, JEDI-SDL Team +# All Rights Reserved +# +# Don NOT edit this file. +# Everything should be configuration while the script is running. +# +############################################################################ + +# Release Version +VERSION=1.0 + +# some useful functions +# ask displays 1st parameter, and ask new value for variable, whose name is +# in the second parameter. +ask () +{ +askvar=$2 +eval old=\$$askvar +eval echo -n \""$1 [$old] : "\" +read $askvar +eval test -z \"\$$askvar\" && eval $askvar=\'$old\' +} +# yesno gives 1 on no, 0 on yes $1 gives text to display. +yesno () +{ + while true; do + echo -n "$1 (Y/n) ? " + read ans + case X$ans in + X|Xy|XY) return 0;; + Xn|XN) return 1;; + esac + done +} + +# Untar files ($3,optional) from file ($1) to the given directory ($2) +unztar () +{ + tar -xzf $HERE/$1 --directory $2 $3 +} + +# Untar tar.gz file ($2) from file ($1) and untar result to the given directory ($3) +unztarfromtar () +{ + tar -xOf $HERE/$1 $2 | tar --directory $3 -xzf - +} +# Get file list from tar archive ($1) in variable ($2) +# optionally filter result through sed ($3) +listtarfiles () +{ + askvar=$2 + if [ ! -z $3 ]; then + list=`tar tvf $1 | awk '{ print $(NF) }' | sed -n /$3/p` + else + list=`tar tvf $1 | awk '{ print $(NF) }'` + fi + eval $askvar='$list' +} +# Make all the necessary directories to get $1 +makedirhierarch () +{ + OLDDIR=`pwd` + case $1 in + /*) cd /;; + esac + OLDIFS=$IFS;IFS=/;eval set $1; IFS=$OLDIFS + for i + do + test -d $i || mkdir $i || break + cd $i ||break + done + cd $OLDDIR +} + +# check to see if something is in the path +checkpath () +{ + ARG=$1 + OLDIFS=$IFS; IFS=":";eval set $PATH;IFS=$OLDIFS + for i + do + if [ $i = $ARG ]; then + return 0 + fi + done + return 1 +} + +# -------------------------------------------------------------------------- +# welcome message. +# + +clear +echo "This shell script will attempt to install the Free Pascal Compiler" +echo "version $VERSION with the items you select" +echo + +# Here we start the thing. +HERE=`pwd` + +# Install in /usr/local or /usr ? +if checkpath /usr/local/bin; then + PREFIX=/usr/local +else + PREFIX=/usr +fi +# If we can't write on prefix, select subdir of home dir +if [ ! -w $PREFIX ]; then + PREFIX=$HOME/JEDI-SDLv$VERSION +fi +ask "Install prefix (/usr or /usr/local) " PREFIX +makedirhierarch $PREFIX + +# Set some defaults. +LIBDIR=$PREFIX/lib/JEDI-SDL/$VERSION +SRCDIR=$PREFIX/src/JEDI-SDLv$VERSION +EXECDIR=$PREFIX/bin +OSNAME=`uname -s | tr A-Z a-z` + +BSDHIER=0 +case $OSNAME in +*bsd) + BSDHIER=1;; +esac + + +if [ "${BSDHIER}" = "1" ]; then +DOCDIR=$PREFIX/share/doc/JEDI-SDLv$VERSION +else +DOCDIR=$PREFIX/doc/JEDI-SDLv$VERSION +fi + +echo $DOCDIR + +DEMODIR=$PREFIX/demos + +# Install SDL headers +if yesno "Install SDL headers"; then + +fi + +# Install SDL_image headers +if yesno "Install SDL_image headers"; then + +fi + +# Install compiler/RTL. Mandatory. +echo Installing compiler and RTL ... +unztarfromtar binary.tar base${OSNAME}.tar.gz $PREFIX +rm -f $EXECDIR/ppc386 +ln -sf $LIBDIR/ppc386 $EXECDIR/ppc386 +echo Installing utilities... +unztarfromtar binary.tar util${OSNAME}.tar.gz $PREFIX +if yesno "Install FCL"; then + unztarfromtar binary.tar unitsfcl${OSNAME}.tar.gz $PREFIX +fi +if yesno "Install packages"; then + listtarfiles binary.tar packages units + for f in $packages + do + if [ $f != unitsfcl${OSNAME}.tar.gz ]; then + basename $f .tar.gz |\ + sed -e s/units// -e s/${OSNAME}// |\ + xargs echo Installing + unztarfromtar binary.tar $f $PREFIX + fi + done +fi +rm -f *${OSNAME}.tar.gz +echo Done. +echo + +# Install the sources. Optional. +if yesno "Install sources"; then + echo Installing sources in $SRCDIR ... + unztarfromtar sources.tar basesrc.tar.gz $PREFIX + if yesno "Install compiler source"; then + unztarfromtar sources.tar compilersrc.tar.gz $PREFIX + fi + if yesno "Install RTL source"; then + unztarfromtar sources.tar rtlsrc.tar.gz $PREFIX + fi + if yesno "Install FCL source"; then + unztarfromtar sources.tar fclsrc.tar.gz $PREFIX + fi + if yesno "Install IDE source"; then + unztarfromtar sources.tar idesrc.tar.gz $PREFIX + fi + if yesno "Install installer source"; then + unztarfromtar sources.tar installersrc.tar.gz $PREFIX + fi + if yesno "Install Packages source"; then + listtarfiles sources.tar packages units + for f in $packages + do + basename $f .tar.gz |\ + sed -e s/units// -e s/src// |\ + xargs echo Installing sources for + unztarfromtar sources.tar $f $PREFIX + done + fi + # rm -f *src.tar.gz + echo Done. +fi +echo + +# Install the documentation. Optional. +if yesno "Install documentation"; then + echo Installing documentation in $DOCDIR ... + unztar docs.tar.gz $DOCDIR + echo Done. +fi +echo + +# Install the demos. Optional. +if yesno "Install demos"; then + ask "Install demos in" DEMODIR + echo Installing demos in $DEMODIR ... + makedirhierarch $DEMODIR + unztar demo.tar.gz $DEMODIR + echo Done. +fi +echo + +# update fpc.cfg file +if yesno "Update fpc.cfg file automagically"; then + echo Updating fpc.cfg in $DOCDIR ... + echo + echo Done. +fi + +# update Borland IDE file +if yesno "Update the Kylix IDE automagically"; then + echo Updating the Kylix IDE in $DOCDIR ... + echo + echo Done. +fi + +$LIBDIR/samplecfg $LIBDIR + +# The End +echo +echo End of installation. +echo +echo Refer to the documentation for more information. +echo \ No newline at end of file diff --git a/Game/Code/lib/JEDI-SDLv1.0/JEDI-SDL-README.txt b/Game/Code/lib/JEDI-SDLv1.0/JEDI-SDL-README.txt deleted file mode 100644 index 968c5311..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/JEDI-SDL-README.txt +++ /dev/null @@ -1,242 +0,0 @@ -This is the based on the SDL ( http://www.libsdl.org ) headers, and has been converted, comments and all, to the Pascal unit called sdl.pas. -Other conversions that have also been done are SDL_Mixer.h, SDL_Net.h, SDL_Image.h, SDL_ttf, SMPEG.h, SDL_sound and the SFont library, -which are all included in this distribution. - -It allows you to access all the functions within the SDL libraries under Windows, Linux and FreeBSD, so you can write cross-platform games or multimedia applications. - -Installation Instructions -------------------------- -Windows - We now have a semi-automated setup under Windows ( thanks to David House and the Jedi JCL team ). - Once you have extracted the zip file, simply double click on the "JEDISDLWin32Installer.exe" to have the correct paths added to your respective - IDEs. All IDEs from Delphi 4 - 7 are supported and it also adds a link to the .CHM help file under the Tools menu. - -Linux - Alternatively if you use Linux or want to to manually install the paths, then make sure you read the "Getting Started.html" file ( ideal for those who are new to JEDI-SDL ) and is now included as a guide to help getting everything setup for smooth compilation. - -Also included is a guide of how to use Sourceforge using TortoiseCVS under Windows ( Linux guide is under development ). -Both documents can be found in the "documentation" directory. - - -Release History ---------------- -1.0 : Yeah!! The Official v1.0 Release of JEDI-SDL!! - JEDI-SDL now updated to SDL v1.2.8, SDL_Image v1.2.4, SDL_Mixer v1.2.6, SDL_Net v1.2.1 & SDL_ttf v2.0.7 - Added Improved FreePascal, TMT Pascal and GnuPascal support as well as maintaining Delphi/Kylix support. - Fixed Various bugs as pointed out on the JEDI-SDL mailing list. - Added SDL_GL_STEREO, SDL_GL_MULTISAMPLEBUFFERS, SDL_GL_MULTISAMPLESAMPLES - -// DLL/Shared object functions -function SDL_LoadObject( const sofile : PChar ) : Pointer; - -function SDL_LoadFunction( handle : Pointer; const name : PChar ) : Pointer; - -procedure SDL_UnloadObject( handle : Pointer ); - -//Added function to create RWops from const memory: SDL_RWFromConstMem() -function SDL_RWFromConstMem(const mem: Pointer; size: Integer) : PSDL_RWops; - -//Added support for environment variables SDL_VIDEO_WINDOW_POS and SDL_VIDEO_CENTERED on Windows - - New Units : - ----------- - sdl_cpuinfo.pas - ported SDL_cpuinfo.h so Now you can test for Specific CPU types. - sdlinput.pas - Input wrapper class - sdlwindow.pas - Window wrapper class - sdltruetypefont.pas - True Type Font wrapper class - tcputils.pas - SDL_Net utility functions - sdlweb.pas - SDL_Net Web class - sdlwebhttp.pas - SDL_Net http protocol wrapper class - sdlwebftp.pas - SDL_Net ftp protocol wrapper class - - New 2D Demos : - -------------- - - - New 3D Demos : - -------------- - - - Other New Stuff : - ----------------- - - - -0.5 : The JEDI-SDL project is now also set up on Sourceforge ( http://sf.net/projects/jedi-sdl/ ) so the latest code is available from there. - Improved FreePascal support has been added. - Various bug fixes as pointed out on the JEDI-SDL mailing list. - SDL_Mixer has been updated to version 1.2.1 and includes an Effects API. - Demo directories are now split into 2D and 3D related sub-directories. - There are now both Kylix ( K prefix ) and Delphi ( D prefix ) project groups for all the demos. - They can be found in Demos and the 2D and 3D directories. - - New Units - --------- - SDLStreams.pas - Chris Bruner has created a wrapper that uses Streams to load BMPs - SDLUtils.pas - Pascal only version of some Utility functions - SDLi386Utils.pas - Intel Assembler versions of the SDLUtils.pas functions. - SDL_ttf.pas - Port of the SDL True Type font support unit. - SDL_Sound.pas - Port of the SDL Sound library ( untested ). - - New 2D Demos : - -------------- - Pan and Zoom Demo - How to Pan and Zoom an SDL surface. - Isometric Demo - I ported my old DelphiX isometric demo over to SDL. - TestTimer demo - Shows hows how to use AddTimer and RemoveTimer. - MpegPlayer - I have updated and improved Anders Ohlsson's CLX MPegPlayer and component and it now works - and installs into D4, D5, D6, D7, K1, K2 & K3. - Showfont - Demo to show how to us SDL_ttf.dll - SmpegPlayer - is a console MPEG player that use smpeg and SDL_Mixer - - New 3D Demos : - -------------- - DeathTruckTion 1.1 - A slightly updated version of this fully functional 3D network game. - TerrainDemo - Terrain demo ported from the book "OpenGL Game programming" by Hawkins and Astle. - TestGL - the standard SDL/OpenGL Test demo. Shows how to mix 2D and 3D rendering using OpenGL. - glfont - Demo to show how to us SDL_ttf with OpenGL. - Particle Engine - Ariel's OpenGL Particle Engine. - Picking - Phil Freeman's Picking Demo - Motion Blur - Phil Freeman's Motion Blur Demo - Dynamic Light - Phil Freeman's Dynamic Light Demo - Environment Map - Phil Freeman's Environment Map Demo - GLMovie - is an MPEG Player that uses OpenGL to render the movie. - NeHe - Quite a few more NeHe demos are now included. - - New Network Demos : - ------------------- - There are now 3 SDL_Net Server demos and 4 SDL_Client demos as submitted by Dean Ellis. - - -Beta 4 : The JEDI-SDL home page is now located @ http://www.delphi-jedi.org/Jedi:TEAM_SDL_HOME - All Demos ( including OpenGL Demos ) now compile under both Kylix and Delphi. - I have added quite a few more OpenGL examples, we are now up to Nehe tutorial 12. - All OpenGL demos also show how to handle Window resizing. - Included an OpenGL demo called Puntos by Gustavo Maximo. - Ported Jan Horn's OpenGL MetaBalls and also SkyBox demo to SDL. - Ported Ilkka Tuomioja's OpenGL Quake 2 Model Viewer/Animator to SDL. - NOTE : All OpenGL demos require OpenGL12.pas which can be found at... - http://www.lischke-online.de/Graphics.html#OpenGL12 - I also fixed a conversion bug to do with SDL_MustLock and also a conversion omission to do with various events. - Fixed a conversion bug with SDL_CDOpen ( as suggested on the mailing list ). - Added the GetPixel and PuxPixel functions to the SDLUtils.pas file. - Jason Farmer has donated SFont, a simple, yet effective Font library he converted for JEDI-SDL. - It contains 4 Demos show how to best use it. - Added TUInt8Array and PUIntArray to SDL.pas after suggestions from Matthias Thoma and Eric Grange. - In the file area of the JEDI-SDL mailing list ( http://groups.yahoo.com/group/JEDI-SDL/files/DTTSrc/ there - is a fully functional 3D network game called DeathTruckTion v1.0 written by the TNTeam that makes use of - JEDI-SDL and is just too big to include with this distribution but is well worth looking at as it works under Windows and Linux! - Gustavo Maxima is working on translating the JEDI-SDL Documentation to Spanish and Portugese. - The Mouse Demo has now been speeded up considerably and it is very responsive now. - Dean Ellis will provide steps on how to compile the demos using the Free Pascal compiler. - Jason Farmer and I are working on a series of Tutorials that should hopefully be out soon. - David Aclan has donated a SMpeg component that should work under Kylix. - Róbert Kisnémeth, has been hard at work, and has donated some new demos he has created with a SpriteEngine ( which he also donated ). - He has also donated a couple of games called BlitzBomber and Oxygene ( which uses the SpriteEngine ) and added a couple of useful - functions to SDLUtils.pas. - The Functions added are SDL_FlipV, SDL_FlipH, SDL_NewPutPixel ( assembler version ), SDL_AddPixel, SDL_SubPixel, SDL_DrawLine, SDL_AddLine, - SDL_SubLine, SDL_AddSurface, SDL_SubSurface, SDL_MonoSurface & SDL_TexturedSurface. - He has also donated a Font Blitting class and demo called SDL_MonoFonts which supports alignment like Left, Right and Center. - He and Thomas are also working on a GUI library. - Jason Farmer has donated a set of Image Filtering functions which add quite a few interesting effects. Check the SDL_Filter sub-directory for more - info. - Christian Hackbart also donated an OpenGL BlockOut clone. - - -Beta 3 : I have added conversions for SDL_env.h, SDL_Mixer.h and SDL_Net.h while Matthias Thoma has added conversions for SDL_Image.h and SMPEG.h. - This version is also SDL version 1.2.0 compliant. - This release also adds demos for the SDL_Image, SDL_Mixer and SDL_Net libraries. - There are now also some OpenGL demos that make some use of SDL as well as a demo on how to use the Mouse with Clickable regions. - A conversion bug, that was pointed out by Clem Vasseur, has also been fixed. - There is now a mailing list that has been set up at http://groups.yahoo.com/group/JEDI-SDL/join/ so we can all learn from each other how to use - these libraries. - Demos have not been unified into single .dpr files for each demo, thus showing how you would write a crossplatform game using only 1 .dpr file. - There is also a documentation directory that is currently in HTML format. All code examples in the documentation have been converted to Object - Pascal but are untested. - I Also fixed a few conversion bugs which I came across while converting the documentation. - -Beta 2 : I have added conversions for SDL_active.h, SDL_thread.h, SDL_mutex.h and - SDL_error.h, Matthias Thoma has added Linux Support and JEDI compliancy so these - units and examples are now x-platform and x-compiler compilable. - I also added Tom Jones' SDLUtils.pas file; - Matthias also cleaned up the 2 new demos and made them work on both Linux and - Windows. - -Beta 1 : Initial Release; - - -There are now 5 examples included with this JEDI-SDL distribution. -1. Is the TestWin application, which is based on the testwin application that comes with the SDL SDK, only my version has a gui front end to the options available and has been compiled under Delphi 4.03. It should be compatible with Delphi 3.0 onwards ( though Delphi 2 compatibility has not been tested ). - -2. A Plasma example which was converted from one found on the Demos page of the SDL site. - -3. A Voxel terrain following demo, which was converted from one found on the Demos page of the SDL site. This one should be of interest to others as it shows how to handle keyboard events when using SDL. - -4. A Mouse handling demo that shows how to use transparency and clickable regions. - -5. A Space Invaders style game called Aliens which shows the use of SDL, SDL_Image and SDL_Mixer. This game shows how to handle sound, keyboards and some basic collision detection. It is a conversion of one found on the SDL Demos page. - -There are also 14 OpenGL demos that are based on the NeHe tutorials . The other 3 OpenGL demos are Jan Horns' OpenGL demo, A Quake 2 Model viewer that I ported and a Demo by Gustavo Maxima called Puntos. - -If writing your own, just make sure that the SDL.pas file is in your projects path for compiling and that the SDL.dll file is in your path when running the compiled app. - -Please test these units and report problems to the JEDI-SDL mailing list @ http://groups.yahoo.com/group/JEDI-SDL/ outlining steps under which the error occurred. If you convert any more demos please send them to me so that I can -include them in the ditribution for others to learn from. - -Also if you are using these Units to write any games -please let me know about it so that I can post the information to the http://www.DelphiGamer.com site. - -The plan is to have this unit JEDI certified at some point so that it can be included on the Delphi and Kylix CDs, so all feedback is greatly welcomed. - -Compilers supported Tested -------------------- ------ -Delphi Yes -Kylix Yes -FreePascal Yes -TMT Pascal compiler Not Yet. -Virtual Pascal No -Gnu Pascal No - - - -Credits -------- -Matthias Thoma for is endless help with my conversion bugs. -Jason Farmer for donating the SFont Font Library. -Gustavo Maximo for the Puntos OpenGL Demo and work he is doing on the documentation -Róbert Kisnémeth for his numerous contributions -Chris Bruner for testing under Kylix -August Logan Bear Jr. for testing under Kylix -Dean Ellis for FreePascal Compiler compatability testing and SDL_Net demos and testing -David House for Windows Insaller and testing. -Romi Kuntsman for helping out on some OpenGL issues. -Everyone on the JEDI-SDL mailing list for their feedback and support. -Everyone on the Delphi-JEDI mailing for answering my conversion questions. -Tom Jones for inspiring this conversion. - -The JEDI-SDL Home page can be found @ http://www.delphi-jedi.org/Jedi:TEAM_SDL_HOME - -The JEDI-SDL source code archive can be found @ http://www.sf.net/projects/jedi-sdl/ - -The JEDI-SDL mailing list can be found @ http://groups.yahoo.com/group/JEDI-SDL/join/ - -The Latest Stable Release version of the JEDI-SDL.zip file can always be found on the Delphi-JEDI site - -The Latest Alpha/Unstable version can always be grabbed from the SourceForge CVS http://sourceforge.net/cvs/?group_id=43805 - - -Sincerely, - - - -Dominique Louis -Delphi Game Developer. -********************************************************* -** To Do Nothing is to Collaborate with the oppressor ** -** -------------------------------------------------- ** -********************************************************* -========================================================= -From . . . . . . . : Dominique Louis -Email. . . . . . . : Dominique@SavageSoftware.com.au -Company. . . . . . : Savage Software Solutions -Delphi Games Site. : http://www.DelphiGamer.com -Delphi JEDI Site . : http://www.delphi-jedi.org -========================================================= - diff --git a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/geometry.pas b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/geometry.pas deleted file mode 100644 index 15783515..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/geometry.pas +++ /dev/null @@ -1,1994 +0,0 @@ -unit geometry; -{ - $Id: geometry.pas,v 1.1 2004/03/30 21:53:54 savage Exp $ - -} - -// This unit contains many needed types, functions and procedures for -// quaternion, vector and matrix arithmetics. It is specifically designed -// for geometric calculations within R3 (affine vector space) -// and R4 (homogeneous vector space). -// -// Note: The terms 'affine' or 'affine coordinates' are not really correct here -// because an 'affine transformation' describes generally a transformation which leads -// to a uniquely solvable system of equations and has nothing to do with the dimensionality -// of a vector. One could use 'projective coordinates' but this is also not really correct -// and since I haven't found a better name (or even any correct one), 'affine' is as good -// as any other one. -// -// Identifiers containing no dimensionality (like affine or homogeneous) -// and no datatype (integer..extended) are supposed as R4 representation -// with 'single' floating point type (examples are TVector, TMatrix, -// and TQuaternion). The default data type is 'single' ('GLFloat' for OpenGL) -// and used in all routines (except conversions and trigonometric functions). -// -// Routines with an open array as argument can either take Func([1,2,3,4,..]) or Func(Vect). -// The latter is prefered, since no extra stack operations is required. -// Note: Be careful while passing open array elements! If you pass more elements -// than there's room in the result the behaviour will be unpredictable. -// -// If not otherwise stated, all angles are given in radians -// (instead of degrees). Use RadToDeg or DegToRad to convert between them. -// -// Geometry.pas was assembled from different sources (like GraphicGems) -// and relevant books or based on self written code, respectivly. -// -// Note: Some aspects need to be considered when using Delphi and pure -// assembler code. Delphi ensures that the direction flag is always -// cleared while entering a function and expects it cleared on return. -// This is in particular important in routines with (CPU) string commands (MOVSD etc.) -// The registers EDI, ESI and EBX (as well as the stack management -// registers EBP and ESP) must not be changed! EAX, ECX and EDX are -// freely available and mostly used for parameter. -// -// Version 2.5 -// last change : 04. January 2000 -// -// (c) Copyright 1999, Dipl. Ing. Mike Lischke (public@lischke-online.de) -{ - $Log: geometry.pas,v $ - Revision 1.1 2004/03/30 21:53:54 savage - Moved to it's own folder. - - Revision 1.1 2004/02/05 00:08:19 savage - Module 1.0 release - - -} - -interface - -{$I jedi-sdl.inc} - -type - // data types needed for 3D graphics calculation, - // included are 'C like' aliases for each type (to be - // conformal with OpenGL types) - - PByte = ^Byte; - PWord = ^Word; - PInteger = ^Integer; - PFloat = ^Single; - PDouble = ^Double; - PExtended = ^Extended; - PPointer = ^Pointer; - - // types to specify continous streams of a specific type - // switch off range checking to access values beyond the limits - PByteVector = ^TByteVector; - PByteArray = PByteVector; - TByteVector = array[0..0] of Byte; - - PWordVector = ^TWordVector; - PWordArray = PWordVector; // note: there's a same named type in SysUtils - TWordVector = array[0..0] of Word; - - PIntegerVector = ^TIntegerVector; - PIntegerArray = PIntegerVector; - TIntegerVector = array[0..0] of Integer; - - PFloatVector = ^TFloatVector; - PFloatArray = PFloatVector; - TFloatVector = array[0..0] of Single; - - PDoubleVector = ^TDoubleVector; - PDoubleArray = PDoubleVector; - TDoubleVector = array[0..0] of Double; - - PExtendedVector = ^TExtendedVector; - PExtendedArray = PExtendedVector; - TExtendedVector = array[0..0] of Extended; - - PPointerVector = ^TPointerVector; - PPointerArray = PPointerVector; - TPointerVector = array[0..0] of Pointer; - - PCardinalVector = ^TCardinalVector; - PCardinalArray = PCardinalVector; - TCardinalVector = array[0..0] of Cardinal; - - // common vector and matrix types with predefined limits - // indices correspond like: x -> 0 - // y -> 1 - // z -> 2 - // w -> 3 - - PHomogeneousByteVector = ^THomogeneousByteVector; - THomogeneousByteVector = array[0..3] of Byte; - TVector4b = THomogeneousByteVector; - - PHomogeneousWordVector = ^THomogeneousWordVector; - THomogeneousWordVector = array[0..3] of Word; - TVector4w = THomogeneousWordVector; - - PHomogeneousIntVector = ^THomogeneousIntVector; - THomogeneousIntVector = array[0..3] of Integer; - TVector4i = THomogeneousIntVector; - - PHomogeneousFltVector = ^THomogeneousFltVector; - THomogeneousFltVector = array[0..3] of Single; - TVector4f = THomogeneousFltVector; - - PHomogeneousDblVector = ^THomogeneousDblVector; - THomogeneousDblVector = array[0..3] of Double; - TVector4d = THomogeneousDblVector; - - PHomogeneousExtVector = ^THomogeneousExtVector; - THomogeneousExtVector = array[0..3] of Extended; - TVector4e = THomogeneousExtVector; - - PHomogeneousPtrVector = ^THomogeneousPtrVector; - THomogeneousPtrVector = array[0..3] of Pointer; - TVector4p = THomogeneousPtrVector; - - PAffineByteVector = ^TAffineByteVector; - TAffineByteVector = array[0..2] of Byte; - TVector3b = TAffineByteVector; - - PAffineWordVector = ^TAffineWordVector; - TAffineWordVector = array[0..2] of Word; - TVector3w = TAffineWordVector; - - PAffineIntVector = ^TAffineIntVector; - TAffineIntVector = array[0..2] of Integer; - TVector3i = TAffineIntVector; - - PAffineFltVector = ^TAffineFltVector; - TAffineFltVector = array[0..2] of Single; - TVector3f = TAffineFltVector; - - PAffineDblVector = ^TAffineDblVector; - TAffineDblVector = array[0..2] of Double; - TVector3d = TAffineDblVector; - - PAffineExtVector = ^TAffineExtVector; - TAffineExtVector = array[0..2] of Extended; - TVector3e = TAffineExtVector; - - PAffinePtrVector = ^TAffinePtrVector; - TAffinePtrVector = array[0..2] of Pointer; - TVector3p = TAffinePtrVector; - - // some simplified names - PVector = ^TVector; - TVector = THomogeneousFltVector; - - PHomogeneousVector = ^THomogeneousVector; - THomogeneousVector = THomogeneousFltVector; - - PAffineVector = ^TAffineVector; - TAffineVector = TAffineFltVector; - - // arrays of vectors - PVectorArray = ^TVectorArray; - TVectorArray = array[0..0] of TAffineVector; - - // matrices - THomogeneousByteMatrix = array[0..3] of THomogeneousByteVector; - TMatrix4b = THomogeneousByteMatrix; - - THomogeneousWordMatrix = array[0..3] of THomogeneousWordVector; - TMatrix4w = THomogeneousWordMatrix; - - THomogeneousIntMatrix = array[0..3] of THomogeneousIntVector; - TMatrix4i = THomogeneousIntMatrix; - - THomogeneousFltMatrix = array[0..3] of THomogeneousFltVector; - TMatrix4f = THomogeneousFltMatrix; - - THomogeneousDblMatrix = array[0..3] of THomogeneousDblVector; - TMatrix4d = THomogeneousDblMatrix; - - THomogeneousExtMatrix = array[0..3] of THomogeneousExtVector; - TMatrix4e = THomogeneousExtMatrix; - - TAffineByteMatrix = array[0..2] of TAffineByteVector; - TMatrix3b = TAffineByteMatrix; - - TAffineWordMatrix = array[0..2] of TAffineWordVector; - TMatrix3w = TAffineWordMatrix; - - TAffineIntMatrix = array[0..2] of TAffineIntVector; - TMatrix3i = TAffineIntMatrix; - - TAffineFltMatrix = array[0..2] of TAffineFltVector; - TMatrix3f = TAffineFltMatrix; - - TAffineDblMatrix = array[0..2] of TAffineDblVector; - TMatrix3d = TAffineDblMatrix; - - TAffineExtMatrix = array[0..2] of TAffineExtVector; - TMatrix3e = TAffineExtMatrix; - - // some simplified names - PMatrix = ^TMatrix; - TMatrix = THomogeneousFltMatrix; - - PHomogeneousMatrix = ^THomogeneousMatrix; - THomogeneousMatrix = THomogeneousFltMatrix; - - PAffineMatrix = ^TAffineMatrix; - TAffineMatrix = TAffineFltMatrix; - - // q = ([x, y, z], w) - TQuaternion = record - case Integer of - 0: - (ImagPart: TAffineVector; - RealPart: Single); - 1: - (Vector: TVector4f); - end; - - TRectangle = record - Left, - Top, - Width, - Height: Integer; - end; - - TTransType = (ttScaleX, ttScaleY, ttScaleZ, - ttShearXY, ttShearXZ, ttShearYZ, - ttRotateX, ttRotateY, ttRotateZ, - ttTranslateX, ttTranslateY, ttTranslateZ, - ttPerspectiveX, ttPerspectiveY, ttPerspectiveZ, ttPerspectiveW); - - // used to describe a sequence of transformations in following order: - // [Sx][Sy][Sz][ShearXY][ShearXZ][ShearZY][Rx][Ry][Rz][Tx][Ty][Tz][P(x,y,z,w)] - // constants are declared for easier access (see MatrixDecompose below) - TTransformations = array[TTransType] of Single; - - -const - // useful constants - - // standard vectors - XVector: TAffineVector = (1, 0, 0); - YVector: TAffineVector = (0, 1, 0); - ZVector: TAffineVector = (0, 0, 1); - NullVector: TAffineVector = (0, 0, 0); - - IdentityMatrix: TMatrix = ((1, 0, 0, 0), - (0, 1, 0, 0), - (0, 0, 1, 0), - (0, 0, 0, 1)); - EmptyMatrix: TMatrix = ((0, 0, 0, 0), - (0, 0, 0, 0), - (0, 0, 0, 0), - (0, 0, 0, 0)); - // some very small numbers - EPSILON = 1e-100; - EPSILON2 = 1e-50; - -//---------------------------------------------------------------------------------------------------------------------- - -// vector functions -function VectorAdd(V1, V2: TVector): TVector; -function VectorAffineAdd(V1, V2: TAffineVector): TAffineVector; -function VectorAffineCombine(V1, V2: TAffineVector; F1, F2: Single): TAffineVector; -function VectorAffineDotProduct(V1, V2: TAffineVector): Single; -function VectorAffineLerp(V1, V2: TAffineVector; t: Single): TAffineVector; -function VectorAffineSubtract(V1, V2: TAffineVector): TAffineVector; -function VectorAngle(V1, V2: TAffineVector): Single; -function VectorCombine(V1, V2: TVector; F1, F2: Single): TVector; -function VectorCrossProduct(V1, V2: TAffineVector): TAffineVector; -function VectorDotProduct(V1, V2: TVector): Single; -function VectorLength(V: array of Single): Single; -function VectorLerp(V1, V2: TVector; t: Single): TVector; -procedure VectorNegate(V: array of Single); -function VectorNorm(V: array of Single): Single; -function VectorNormalize(V: array of Single): Single; -function VectorPerpendicular(V, N: TAffineVector): TAffineVector; -function VectorReflect(V, N: TAffineVector): TAffineVector; -procedure VectorRotate(var Vector: TVector4f; Axis: TVector3f; Angle: Single); -procedure VectorScale(V: array of Single; Factor: Single); -function VectorSubtract(V1, V2: TVector): TVector; - -// matrix functions -function CreateRotationMatrixX(Sine, Cosine: Single): TMatrix; -function CreateRotationMatrixY(Sine, Cosine: Single): TMatrix; -function CreateRotationMatrixZ(Sine, Cosine: Single): TMatrix; -function CreateScaleMatrix(V: TAffineVector): TMatrix; -function CreateTranslationMatrix(V: TVector): TMatrix; -procedure MatrixAdjoint(var M: TMatrix); -function MatrixAffineDeterminant(M: TAffineMatrix): Single; -procedure MatrixAffineTranspose(var M: TAffineMatrix); -function MatrixDeterminant(M: TMatrix): Single; -procedure MatrixInvert(var M: TMatrix); -function MatrixMultiply(M1, M2: TMatrix): TMatrix; -procedure MatrixScale(var M: TMatrix; Factor: Single); -procedure MatrixTranspose(var M: TMatrix); - -// quaternion functions -function QuaternionConjugate(Q: TQuaternion): TQuaternion; -function QuaternionFromPoints(V1, V2: TAffineVector): TQuaternion; -function QuaternionMultiply(qL, qR: TQuaternion): TQuaternion; -function QuaternionSlerp(QStart, QEnd: TQuaternion; Spin: Integer; t: Single): TQuaternion; -function QuaternionToMatrix(Q: TQuaternion): TMatrix; -procedure QuaternionToPoints(Q: TQuaternion; var ArcFrom, ArcTo: TAffineVector); - -// mixed functions -function ConvertRotation(Angles: TAffineVector): TVector; -function CreateRotationMatrix(Axis: TVector3f; Angle: Single): TMatrix; -function MatrixDecompose(M: TMatrix; var Tran: TTransformations): Boolean; -function VectorAffineTransform(V: TAffineVector; M: TAffineMatrix): TAffineVector; -function VectorTransform(V: TVector4f; M: TMatrix): TVector4f; overload; -function VectorTransform(V: TVector3f; M: TMatrix): TVector3f; overload; - -// miscellaneous functions -function MakeAffineDblVector(V: array of Double): TAffineDblVector; -function MakeDblVector(V: array of Double): THomogeneousDblVector; -function MakeAffineVector(V: array of Single): TAffineVector; -function MakeQuaternion(Imag: array of Single; Real: Single): TQuaternion; -function MakeVector(V: array of Single): TVector; -function PointInPolygon(xp, yp : array of Single; x, y: Single): Boolean; -function VectorAffineDblToFlt(V: TAffineDblVector): TAffineVector; -function VectorDblToFlt(V: THomogeneousDblVector): THomogeneousVector; -function VectorAffineFltToDbl(V: TAffineVector): TAffineDblVector; -function VectorFltToDbl(V: TVector): THomogeneousDblVector; - -// trigonometric functions -function ArcCos(X: Extended): Extended; -function ArcSin(X: Extended): Extended; -function ArcTan2(Y, X: Extended): Extended; -function CoTan(X: Extended): Extended; -function DegToRad(Degrees: Extended): Extended; -function RadToDeg(Radians: Extended): Extended; -procedure SinCos(Theta: Extended; var Sin, Cos: Extended); -function Tan(X: Extended): Extended; - -// coordinate system manipulation functions -function Turn(Matrix: TMatrix; Angle: Single): TMatrix; overload; -function Turn(Matrix: TMatrix; MasterUp: TAffineVector; Angle: Single): TMatrix; overload; -function Pitch(Matrix: TMatrix; Angle: Single): TMatrix; overload; -function Pitch(Matrix: TMatrix; MasterRight: TAffineVector; Angle: Single): TMatrix; overload; -function Roll(Matrix: TMatrix; Angle: Single): TMatrix; overload; -function Roll(Matrix: TMatrix; MasterDirection: TAffineVector; Angle: Single): TMatrix; overload; - -//---------------------------------------------------------------------------------------------------------------------- - -implementation - -const - // FPU status flags (high order byte) - C0 = 1; - C1 = 2; - C2 = 4; - C3 = $40; - - // to be used as descriptive indices - X = 0; - Y = 1; - Z = 2; - W = 3; - -//----------------- trigonometric helper functions --------------------------------------------------------------------- - -function DegToRad(Degrees: Extended): Extended; - -begin - Result := Degrees * (PI / 180); -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function RadToDeg(Radians: Extended): Extended; - -begin - Result := Radians * (180 / PI); -end; - -//---------------------------------------------------------------------------------------------------------------------- - -procedure SinCos(Theta: Extended; var Sin, Cos: Extended); assembler; register; - -// calculates sine and cosine from the given angle Theta -// EAX contains address of Sin -// EDX contains address of Cos -// Theta is passed over the stack - -asm - FLD Theta - FSINCOS - FSTP TBYTE PTR [EDX] // cosine - FSTP TBYTE PTR [EAX] // sine - FWAIT -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function ArcCos(X: Extended): Extended; - -begin - Result := ArcTan2(Sqrt(1 - X * X), X); -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function ArcSin(X: Extended): Extended; - -begin - Result := ArcTan2(X, Sqrt(1 - X * X)) -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function ArcTan2(Y, X: Extended): Extended; - -asm - FLD Y - FLD X - FPATAN - FWAIT -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function Tan(X: Extended): Extended; - -asm - FLD X - FPTAN - FSTP ST(0) // FPTAN pushes 1.0 after result - FWAIT -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function CoTan(X: Extended): Extended; - -asm - FLD X - FPTAN - FDIVRP - FWAIT -end; - -//----------------- miscellaneous vector functions --------------------------------------------------------------------- - -function MakeAffineDblVector(V: array of Double): TAffineDblVector; assembler; - -// creates a vector from given values -// EAX contains address of V -// ECX contains address to result vector -// EDX contains highest index of V - -asm - PUSH EDI - PUSH ESI - MOV EDI, ECX - MOV ESI, EAX - MOV ECX, EDX - ADD ECX, 2 - REP MOVSD - POP ESI - POP EDI -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function MakeDblVector(V: array of Double): THomogeneousDblVector; assembler; - -// creates a vector from given values -// EAX contains address of V -// ECX contains address to result vector -// EDX contains highest index of V - -asm - PUSH EDI - PUSH ESI - MOV EDI, ECX - MOV ESI, EAX - MOV ECX, EDX - ADD ECX, 2 - REP MOVSD - POP ESI - POP EDI -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function MakeAffineVector(V: array of Single): TAffineVector; assembler; - -// creates a vector from given values -// EAX contains address of V -// ECX contains address to result vector -// EDX contains highest index of V - -asm - PUSH EDI - PUSH ESI - MOV EDI, ECX - MOV ESI, EAX - MOV ECX, EDX - INC ECX - CMP ECX, 3 - JB @@1 - MOV ECX, 3 -@@1: REP MOVSD // copy given values - MOV ECX, 2 - SUB ECX, EDX // determine missing entries - JS @@Finish - XOR EAX, EAX - REP STOSD // set remaining fields to 0 -@@Finish: POP ESI - POP EDI -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function MakeQuaternion(Imag: array of Single; Real: Single): TQuaternion; assembler; - -// creates a quaternion from the given values -// EAX contains address of Imag -// ECX contains address to result vector -// EDX contains highest index of Imag -// Real part is passed on the stack - -asm - PUSH EDI - PUSH ESI - MOV EDI, ECX - MOV ESI, EAX - MOV ECX, EDX - INC ECX - REP MOVSD - MOV EAX, [Real] - MOV [EDI], EAX - POP ESI - POP EDI -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function MakeVector(V: array of Single): TVector; assembler; - -// creates a vector from given values -// EAX contains address of V -// ECX contains address to result vector -// EDX contains highest index of V - -asm - PUSH EDI - PUSH ESI - MOV EDI, ECX - MOV ESI, EAX - MOV ECX, EDX - INC ECX - CMP ECX, 4 - JB @@1 - MOV ECX, 4 -@@1: REP MOVSD // copy given values - MOV ECX, 3 - SUB ECX, EDX // determine missing entries - JS @@Finish - XOR EAX, EAX - REP STOSD // set remaining fields to 0 -@@Finish: POP ESI - POP EDI -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorLength(V: array of Single): Single; assembler; - -// calculates the length of a vector following the equation: sqrt(x * x + y * y + ...) -// Note: The parameter of this function is declared as open array. Thus -// there's no restriction about the number of the components of the vector. -// -// EAX contains address of V -// EDX contains the highest index of V -// the result is returned in ST(0) - -asm - FLDZ // initialize sum -@@Loop: FLD DWORD PTR [EAX + 4 * EDX] // load a component - FMUL ST, ST - FADDP - SUB EDX, 1 - JNL @@Loop - FSQRT -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorAngle(V1, V2: TAffineVector): Single; assembler; - -// calculates the cosine of the angle between Vector1 and Vector2 -// Result = DotProduct(V1, V2) / (Length(V1) * Length(V2)) -// -// EAX contains address of Vector1 -// EDX contains address of Vector2 - -asm - FLD DWORD PTR [EAX] // V1[0] - FLD ST // double V1[0] - FMUL ST, ST // V1[0]^2 (prep. for divisor) - FLD DWORD PTR [EDX] // V2[0] - FMUL ST(2), ST // ST(2) := V1[0] * V2[0] - FMUL ST, ST // V2[0]^2 (prep. for divisor) - FLD DWORD PTR [EAX + 4] // V1[1] - FLD ST // double V1[1] - FMUL ST, ST // ST(0) := V1[1]^2 - FADDP ST(3), ST // ST(2) := V1[0]^2 + V1[1] * * 2 - FLD DWORD PTR [EDX + 4] // V2[1] - FMUL ST(1), ST // ST(1) := V1[1] * V2[1] - FMUL ST, ST // ST(0) := V2[1]^2 - FADDP ST(2), ST // ST(1) := V2[0]^2 + V2[1]^2 - FADDP ST(3), ST // ST(2) := V1[0] * V2[0] + V1[1] * V2[1] - FLD DWORD PTR [EAX + 8] // load V2[1] - FLD ST // same calcs go here - FMUL ST, ST // (compare above) - FADDP ST(3), ST - FLD DWORD PTR [EDX + 8] - FMUL ST(1), ST - FMUL ST, ST - FADDP ST(2), ST - FADDP ST(3), ST - FMULP // ST(0) := (V1[0]^2 + V1[1]^2 + V1[2]) * - // (V2[0]^2 + V2[1]^2 + V2[2]) - FSQRT // sqrt(ST(0)) - FDIVP // ST(0) := Result := ST(1) / ST(0) - // the result is expected in ST(0), if it's invalid, an error is raised -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorNorm(V: array of Single): Single; assembler; register; - -// calculates norm of a vector which is defined as norm = x * x + y * y + ... -// EAX contains address of V -// EDX contains highest index in V -// result is passed in ST(0) - -asm - FLDZ // initialize sum -@@Loop: FLD DWORD PTR [EAX + 4 * EDX] // load a component - FMUL ST, ST // make square - FADDP // add previous calculated sum - SUB EDX, 1 - JNL @@Loop -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorNormalize(V: array of Single): Single; assembler; register; - -// transforms a vector to unit length and return length -// EAX contains address of V -// EDX contains the highest index in V -// return former length of V in ST - -asm - PUSH EBX - MOV ECX, EDX // save size of V - CALL VectorLength // calculate length of vector - FTST // test if length = 0 - MOV EBX, EAX // save parameter address - FSTSW AX // get test result - TEST AH, C3 // check the test result - JNZ @@Finish - SUB EBX, 4 // simplyfied address calculation - INC ECX - FLD1 // calculate reciprocal of length - FDIV ST, ST(1) -@@1: FLD ST // double reciprocal - FMUL DWORD PTR [EBX + 4 * ECX] // scale component - WAIT - FSTP DWORD PTR [EBX + 4 * ECX] // store result - LOOP @@1 - FSTP ST // remove reciprocal from FPU stack -@@Finish: POP EBX -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorAffineSubtract(V1, V2: TAffineVector): TAffineVector; assembler; register; - -// returns v1 minus v2 -// EAX contains address of V1 -// EDX contains address of V2 -// ECX contains address of the result - -asm - {Result[X] := V1[X]-V2[X]; - Result[Y] := V1[Y]-V2[Y]; - Result[Z] := V1[Z]-V2[Z];} - - FLD DWORD PTR [EAX] - FSUB DWORD PTR [EDX] - FSTP DWORD PTR [ECX] - FLD DWORD PTR [EAX + 4] - FSUB DWORD PTR [EDX + 4] - FSTP DWORD PTR [ECX + 4] - FLD DWORD PTR [EAX + 8] - FSUB DWORD PTR [EDX + 8] - FSTP DWORD PTR [ECX + 8] -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorReflect(V, N: TAffineVector): TAffineVector; assembler; register; - -// reflects vector V against N (assumes N is normalized) -// EAX contains address of V -// EDX contains address of N -// ECX contains address of the result - -//var Dot : Single; - -asm - {Dot := VectorAffineDotProduct(V, N); - Result[X] := V[X]-2 * Dot * N[X]; - Result[Y] := V[Y]-2 * Dot * N[Y]; - Result[Z] := V[Z]-2 * Dot * N[Z];} - - CALL VectorAffineDotProduct // dot is now in ST(0) - FCHS // -dot - FADD ST, ST // -dot * 2 - FLD DWORD PTR [EDX] // ST := N[X] - FMUL ST, ST(1) // ST := -2 * dot * N[X] - FADD DWORD PTR[EAX] // ST := V[X] - 2 * dot * N[X] - FSTP DWORD PTR [ECX] // store result - FLD DWORD PTR [EDX + 4] // etc. - FMUL ST, ST(1) - FADD DWORD PTR[EAX + 4] - FSTP DWORD PTR [ECX + 4] - FLD DWORD PTR [EDX + 8] - FMUL ST, ST(1) - FADD DWORD PTR[EAX + 8] - FSTP DWORD PTR [ECX + 8] - FSTP ST // clean FPU stack -end; - -//---------------------------------------------------------------------------------------------------------------------- - -procedure VectorRotate(var Vector: TVector4f; Axis: TVector3f; Angle: Single); - -// rotates Vector about Axis with Angle radiants - -var RotMatrix : TMatrix4f; - -begin - RotMatrix := CreateRotationMatrix(Axis, Angle); - Vector := VectorTransform(Vector, RotMatrix); -end; - -//---------------------------------------------------------------------------------------------------------------------- - -procedure VectorScale(V: array of Single; Factor: Single); assembler; register; - -// returns a vector scaled by a factor -// EAX contains address of V -// EDX contains highest index in V -// Factor is located on the stack - -asm - {for I := Low(V) to High(V) do V[I] := V[I] * Factor;} - - FLD DWORD PTR [Factor] // load factor -@@Loop: FLD DWORD PTR [EAX + 4 * EDX] // load a component - FMUL ST, ST(1) // multiply it with the factor - WAIT - FSTP DWORD PTR [EAX + 4 * EDX] // store the result - DEC EDX // do the entire array - JNS @@Loop - FSTP ST(0) // clean the FPU stack -end; - -//---------------------------------------------------------------------------------------------------------------------- - -procedure VectorNegate(V: array of Single); assembler; register; - -// returns a negated vector -// EAX contains address of V -// EDX contains highest index in V - -asm - {V[X] := -V[X]; - V[Y] := -V[Y]; - V[Z] := -V[Z];} - -@@Loop: FLD DWORD PTR [EAX + 4 * EDX] - FCHS - WAIT - FSTP DWORD PTR [EAX + 4 * EDX] - DEC EDX - JNS @@Loop -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorAdd(V1, V2: TVector): TVector; register; - -// returns the sum of two vectors - -begin - Result[X] := V1[X] + V2[X]; - Result[Y] := V1[Y] + V2[Y]; - Result[Z] := V1[Z] + V2[Z]; - Result[W] := V1[W] + V2[W]; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorAffineAdd(V1, V2: TAffineVector): TAffineVector; register; - -// returns the sum of two vectors - -begin - Result[X] := V1[X] + V2[X]; - Result[Y] := V1[Y] + V2[Y]; - Result[Z] := V1[Z] + V2[Z]; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorSubtract(V1, V2: TVector): TVector; register; - -// returns the difference of two vectors - -begin - Result[X] := V1[X] - V2[X]; - Result[Y] := V1[Y] - V2[Y]; - Result[Z] := V1[Z] - V2[Z]; - Result[W] := V1[W] - V2[W]; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorDotProduct(V1, V2: TVector): Single; register; - -begin - Result := V1[X] * V2[X] + V1[Y] * V2[Y] + V1[Z] * V2[Z] + V1[W] * V2[W]; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorAffineDotProduct(V1, V2: TAffineVector): Single; assembler; register; - -// calculates the dot product between V1 and V2 -// EAX contains address of V1 -// EDX contains address of V2 -// result is stored in ST(0) - -asm - //Result := V1[X] * V2[X] + V1[Y] * V2[Y] + V1[Z] * V2[Z]; - - FLD DWORD PTR [EAX] - FMUL DWORD PTR [EDX] - FLD DWORD PTR [EAX + 4] - FMUL DWORD PTR [EDX + 4] - FADDP - FLD DWORD PTR [EAX + 8] - FMUL DWORD PTR [EDX + 8] - FADDP -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorCrossProduct(V1, V2: TAffineVector): TAffineVector; - -// calculates the cross product between vector 1 and 2, Temp is necessary because -// either V1 or V2 could also be the result vector -// -// EAX contains address of V1 -// EDX contains address of V2 -// ECX contains address of result - -var Temp: TAffineVector; - -asm - {Temp[X] := V1[Y] * V2[Z]-V1[Z] * V2[Y]; - Temp[Y] := V1[Z] * V2[X]-V1[X] * V2[Z]; - Temp[Z] := V1[X] * V2[Y]-V1[Y] * V2[X]; - Result := Temp;} - - PUSH EBX // save EBX, must be restored to original value - LEA EBX, [Temp] - FLD DWORD PTR [EDX + 8] // first load both vectors onto FPU register stack - FLD DWORD PTR [EDX + 4] - FLD DWORD PTR [EDX + 0] - FLD DWORD PTR [EAX + 8] - FLD DWORD PTR [EAX + 4] - FLD DWORD PTR [EAX + 0] - - FLD ST(1) // ST(0) := V1[Y] - FMUL ST, ST(6) // ST(0) := V1[Y] * V2[Z] - FLD ST(3) // ST(0) := V1[Z] - FMUL ST, ST(6) // ST(0) := V1[Z] * V2[Y] - FSUBP ST(1), ST // ST(0) := ST(1)-ST(0) - FSTP DWORD [EBX] // Temp[X] := ST(0) - FLD ST(2) // ST(0) := V1[Z] - FMUL ST, ST(4) // ST(0) := V1[Z] * V2[X] - FLD ST(1) // ST(0) := V1[X] - FMUL ST, ST(7) // ST(0) := V1[X] * V2[Z] - FSUBP ST(1), ST // ST(0) := ST(1)-ST(0) - FSTP DWORD [EBX + 4] // Temp[Y] := ST(0) - FLD ST // ST(0) := V1[X] - FMUL ST, ST(5) // ST(0) := V1[X] * V2[Y] - FLD ST(2) // ST(0) := V1[Y] - FMUL ST, ST(5) // ST(0) := V1[Y] * V2[X] - FSUBP ST(1), ST // ST(0) := ST(1)-ST(0) - FSTP DWORD [EBX + 8] // Temp[Z] := ST(0) - FSTP ST(0) // clear FPU register stack - FSTP ST(0) - FSTP ST(0) - FSTP ST(0) - FSTP ST(0) - FSTP ST(0) - MOV EAX, [EBX] // copy Temp to Result - MOV [ECX], EAX - MOV EAX, [EBX + 4] - MOV [ECX + 4], EAX - MOV EAX, [EBX + 8] - MOV [ECX + 8], EAX - POP EBX -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorPerpendicular(V, N: TAffineVector): TAffineVector; - -// calculates a vector perpendicular to N (N is assumed to be of unit length) -// subtract out any component parallel to N - -var Dot: Single; - -begin - Dot := VectorAffineDotProduct(V, N); - Result[X] := V[X]-Dot * N[X]; - Result[Y] := V[Y]-Dot * N[Y]; - Result[Z] := V[Z]-Dot * N[Z]; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorTransform(V: TVector4f; M: TMatrix): TVector4f; register; - -// transforms a homogeneous vector by multiplying it with a matrix - -var TV: TVector4f; - -begin - TV[X] := V[X] * M[X, X] + V[Y] * M[Y, X] + V[Z] * M[Z, X] + V[W] * M[W, X]; - TV[Y] := V[X] * M[X, Y] + V[Y] * M[Y, Y] + V[Z] * M[Z, Y] + V[W] * M[W, Y]; - TV[Z] := V[X] * M[X, Z] + V[Y] * M[Y, Z] + V[Z] * M[Z, Z] + V[W] * M[W, Z]; - TV[W] := V[X] * M[X, W] + V[Y] * M[Y, W] + V[Z] * M[Z, W] + V[W] * M[W, W]; - Result := TV -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorTransform(V: TVector3f; M: TMatrix): TVector3f; - -// transforms an affine vector by multiplying it with a (homogeneous) matrix - -var TV: TVector3f; - -begin - TV[X] := V[X] * M[X, X] + V[Y] * M[Y, X] + V[Z] * M[Z, X] + M[W, X]; - TV[Y] := V[X] * M[X, Y] + V[Y] * M[Y, Y] + V[Z] * M[Z, Y] + M[W, Y]; - TV[Z] := V[X] * M[X, Z] + V[Y] * M[Y, Z] + V[Z] * M[Z, Z] + M[W, Z]; - Result := TV; -end; - - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorAffineTransform(V: TAffineVector; M: TAffineMatrix): TAffineVector; register; - -// transforms an affine vector by multiplying it with a matrix - -var TV: TAffineVector; - -begin - TV[X] := V[X] * M[X, X] + V[Y] * M[Y, X] + V[Z] * M[Z, X]; - TV[Y] := V[X] * M[X, Y] + V[Y] * M[Y, Y] + V[Z] * M[Z, Y]; - TV[Z] := V[X] * M[X, Z] + V[Y] * M[Y, Z] + V[Z] * M[Z, Z]; - Result := TV; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function PointInPolygon(xp, yp : array of Single; x, y: Single): Boolean; - -// The code below is from Wm. Randolph Franklin -// with some minor modifications for speed. It returns 1 for strictly -// interior points, 0 for strictly exterior, and 0 or 1 for points on -// the boundary. -// This code is not yet tested! - -var I, J: Integer; - -begin - Result := False; - if High(XP) <> High(YP) then Exit; - J := High(XP); - for I := 0 to High(XP) do - begin - if ((((yp[I] <= y) and (y < yp[J])) or ((yp[J] <= y) and (y < yp[I]))) and - (x < (xp[J] - xp[I]) * (y - yp[I]) / (yp[J] - yp[I]) + xp[I])) - then Result := not Result; - J := I + 1; - end; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function QuaternionConjugate(Q: TQuaternion): TQuaternion; assembler; - -// returns the conjugate of a quaternion -// EAX contains address of Q -// EDX contains address of result - -asm - FLD DWORD PTR [EAX] - FCHS - WAIT - FSTP DWORD PTR [EDX] - FLD DWORD PTR [EAX + 4] - FCHS - WAIT - FSTP DWORD PTR [EDX + 4] - FLD DWORD PTR [EAX + 8] - FCHS - WAIT - FSTP DWORD PTR [EDX + 8] - MOV EAX, [EAX + 12] - MOV [EDX + 12], EAX -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function QuaternionFromPoints(V1, V2: TAffineVector): TQuaternion; assembler; - -// constructs a unit quaternion from two points on unit sphere -// EAX contains address of V1 -// ECX contains address to result -// EDX contains address of V2 - -asm - {Result.ImagPart := VectorCrossProduct(V1, V2); - Result.RealPart := Sqrt((VectorAffineDotProduct(V1, V2) + 1)/2);} - - PUSH EAX - CALL VectorCrossProduct // determine axis to rotate about - POP EAX - FLD1 // prepare next calculation - Call VectorAffineDotProduct // calculate cos(angle between V1 and V2) - FADD ST, ST(1) // transform angle to angle/2 by: cos(a/2)=sqrt((1 + cos(a))/2) - FXCH ST(1) - FADD ST, ST - FDIVP ST(1), ST - FSQRT - FSTP DWORD PTR [ECX + 12] // Result.RealPart := ST(0) -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function QuaternionMultiply(qL, qR: TQuaternion): TQuaternion; - -// Returns quaternion product qL * qR. Note: order is important! -// To combine rotations, use the product QuaternionMuliply(qSecond, qFirst), -// which gives the effect of rotating by qFirst then qSecond. - -var Temp : TQuaternion; - -begin - Temp.RealPart := qL.RealPart * qR.RealPart - qL.ImagPart[X] * qR.ImagPart[X] - - qL.ImagPart[Y] * qR.ImagPart[Y] - qL.ImagPart[Z] * qR.ImagPart[Z]; - Temp.ImagPart[X] := qL.RealPart * qR.ImagPart[X] + qL.ImagPart[X] * qR.RealPart + - qL.ImagPart[Y] * qR.ImagPart[Z] - qL.ImagPart[Z] * qR.ImagPart[Y]; - Temp.ImagPart[Y] := qL.RealPart * qR.ImagPart[Y] + qL.ImagPart[Y] * qR.RealPart + - qL.ImagPart[Z] * qR.ImagPart[X] - qL.ImagPart[X] * qR.ImagPart[Z]; - Temp.ImagPart[Z] := qL.RealPart * qR.ImagPart[Z] + qL.ImagPart[Z] * qR.RealPart + - qL.ImagPart[X] * qR.ImagPart[Y] - qL.ImagPart[Y] * qR.ImagPart[X]; - Result := Temp; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function QuaternionToMatrix(Q: TQuaternion): TMatrix; - -// Constructs rotation matrix from (possibly non-unit) quaternion. -// Assumes matrix is used to multiply column vector on the left: -// vnew = mat vold. Works correctly for right-handed coordinate system -// and right-handed rotations. - -// Essentially, this function is the same as CreateRotationMatrix and you can consider it as -// being for reference here. - -{var Norm, S, - XS, YS, ZS, - WX, WY, WZ, - XX, XY, XZ, - YY, YZ, ZZ : Single; - -begin - Norm := Q.Vector[X] * Q.Vector[X] + Q.Vector[Y] * Q.Vector[Y] + Q.Vector[Z] * Q.Vector[Z] + Q.RealPart * Q.RealPart; - if Norm > 0 then S := 2 / Norm - else S := 0; - - XS := Q.Vector[X] * S; YS := Q.Vector[Y] * S; ZS := Q.Vector[Z] * S; - WX := Q.RealPart * XS; WY := Q.RealPart * YS; WZ := Q.RealPart * ZS; - XX := Q.Vector[X] * XS; XY := Q.Vector[X] * YS; XZ := Q.Vector[X] * ZS; - YY := Q.Vector[Y] * YS; YZ := Q.Vector[Y] * ZS; ZZ := Q.Vector[Z] * ZS; - - Result[X, X] := 1 - (YY + ZZ); Result[Y, X] := XY + WZ; Result[Z, X] := XZ - WY; Result[W, X] := 0; - Result[X, Y] := XY - WZ; Result[Y, Y] := 1 - (XX + ZZ); Result[Z, Y] := YZ + WX; Result[W, Y] := 0; - Result[X, Z] := XZ + WY; Result[Y, Z] := YZ - WX; Result[Z, Z] := 1 - (XX + YY); Result[W, Z] := 0; - Result[X, W] := 0; Result[Y, W] := 0; Result[Z, W] := 0; Result[W, W] := 1;} - -var - V: TAffineVector; - SinA, CosA, - A, B, C: Extended; - -begin - V := Q.ImagPart; - VectorNormalize(V); - SinCos(Q.RealPart / 2, SinA, CosA); - A := V[X] * SinA; - B := V[Y] * SinA; - C := V[Z] * SinA; - - Result := IdentityMatrix; - Result[X, X] := 1 - 2 * B * B - 2 * C * C; - Result[X, Y] := 2 * A * B - 2 * CosA * C; - Result[X, Z] := 2 * A * C + 2 * CosA * B; - - Result[Y, X] := 2 * A * B + 2 * CosA * C; - Result[Y, Y] := 1 - 2 * A * A - 2 * C * C; - Result[Y, Z] := 2 * B * C - 2 * CosA * A; - - Result[Z, X] := 2 * A * C - 2 * CosA * B; - Result[Z, Y] := 2 * B * C + 2 * CosA * A; - Result[Z, Z] := 1 - 2 * A * A - 2 * B * B; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -procedure QuaternionToPoints(Q: TQuaternion; var ArcFrom, ArcTo: TAffineVector); register; - -// converts a unit quaternion into two points on a unit sphere - -var S: Single; - -begin - S := Sqrt(Q.ImagPart[X] * Q.ImagPart[X] + Q.ImagPart[Y] * Q.ImagPart[Y]); - if S = 0 then ArcFrom := MakeAffineVector([0, 1, 0]) - else ArcFrom := MakeAffineVector([-Q.ImagPart[Y] / S, Q.ImagPart[X] / S, 0]); - ArcTo[X] := Q.RealPart * ArcFrom[X] - Q.ImagPart[Z] * ArcFrom[Y]; - ArcTo[Y] := Q.RealPart * ArcFrom[Y] + Q.ImagPart[Z] * ArcFrom[X]; - ArcTo[Z] := Q.ImagPart[X] * ArcFrom[Y] - Q.ImagPart[Y] * ArcFrom[X]; - if Q.RealPart < 0 then ArcFrom := MakeAffineVector([-ArcFrom[X], -ArcFrom[Y], 0]); -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function MatrixAffineDeterminant(M: TAffineMatrix): Single; register; - -// determinant of a 3x3 matrix - -begin - Result := M[X, X] * (M[Y, Y] * M[Z, Z] - M[Z, Y] * M[Y, Z]) - - M[X, Y] * (M[Y, X] * M[Z, Z] - M[Z, X] * M[Y, Z]) + - M[X, Z] * (M[Y, X] * M[Z, Y] - M[Z, X] * M[Y, Y]); -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function MatrixDetInternal(a1, a2, a3, b1, b2, b3, c1, c2, c3: Single): Single; - -// internal version for the determinant of a 3x3 matrix - -begin - Result := a1 * (b2 * c3 - b3 * c2) - - b1 * (a2 * c3 - a3 * c2) + - c1 * (a2 * b3 - a3 * b2); -end; - -//---------------------------------------------------------------------------------------------------------------------- - -procedure MatrixAdjoint(var M: TMatrix); register; - -// Adjoint of a 4x4 matrix - used in the computation of the inverse -// of a 4x4 matrix - -var a1, a2, a3, a4, - b1, b2, b3, b4, - c1, c2, c3, c4, - d1, d2, d3, d4: Single; - - -begin - a1 := M[X, X]; b1 := M[X, Y]; - c1 := M[X, Z]; d1 := M[X, W]; - a2 := M[Y, X]; b2 := M[Y, Y]; - c2 := M[Y, Z]; d2 := M[Y, W]; - a3 := M[Z, X]; b3 := M[Z, Y]; - c3 := M[Z, Z]; d3 := M[Z, W]; - a4 := M[W, X]; b4 := M[W, Y]; - c4 := M[W, Z]; d4 := M[W, W]; - - // row column labeling reversed since we transpose rows & columns - M[X, X] := MatrixDetInternal(b2, b3, b4, c2, c3, c4, d2, d3, d4); - M[Y, X] := -MatrixDetInternal(a2, a3, a4, c2, c3, c4, d2, d3, d4); - M[Z, X] := MatrixDetInternal(a2, a3, a4, b2, b3, b4, d2, d3, d4); - M[W, X] := -MatrixDetInternal(a2, a3, a4, b2, b3, b4, c2, c3, c4); - - M[X, Y] := -MatrixDetInternal(b1, b3, b4, c1, c3, c4, d1, d3, d4); - M[Y, Y] := MatrixDetInternal(a1, a3, a4, c1, c3, c4, d1, d3, d4); - M[Z, Y] := -MatrixDetInternal(a1, a3, a4, b1, b3, b4, d1, d3, d4); - M[W, Y] := MatrixDetInternal(a1, a3, a4, b1, b3, b4, c1, c3, c4); - - M[X, Z] := MatrixDetInternal(b1, b2, b4, c1, c2, c4, d1, d2, d4); - M[Y, Z] := -MatrixDetInternal(a1, a2, a4, c1, c2, c4, d1, d2, d4); - M[Z, Z] := MatrixDetInternal(a1, a2, a4, b1, b2, b4, d1, d2, d4); - M[W, Z] := -MatrixDetInternal(a1, a2, a4, b1, b2, b4, c1, c2, c4); - - M[X, W] := -MatrixDetInternal(b1, b2, b3, c1, c2, c3, d1, d2, d3); - M[Y, W] := MatrixDetInternal(a1, a2, a3, c1, c2, c3, d1, d2, d3); - M[Z, W] := -MatrixDetInternal(a1, a2, a3, b1, b2, b3, d1, d2, d3); - M[W, W] := MatrixDetInternal(a1, a2, a3, b1, b2, b3, c1, c2, c3); -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function MatrixDeterminant(M: TMatrix): Single; register; - -// Determinant of a 4x4 matrix - -var a1, a2, a3, a4, - b1, b2, b3, b4, - c1, c2, c3, c4, - d1, d2, d3, d4 : Single; - -begin - a1 := M[X, X]; b1 := M[X, Y]; c1 := M[X, Z]; d1 := M[X, W]; - a2 := M[Y, X]; b2 := M[Y, Y]; c2 := M[Y, Z]; d2 := M[Y, W]; - a3 := M[Z, X]; b3 := M[Z, Y]; c3 := M[Z, Z]; d3 := M[Z, W]; - a4 := M[W, X]; b4 := M[W, Y]; c4 := M[W, Z]; d4 := M[W, W]; - - Result := a1 * MatrixDetInternal(b2, b3, b4, c2, c3, c4, d2, d3, d4) - - b1 * MatrixDetInternal(a2, a3, a4, c2, c3, c4, d2, d3, d4) + - c1 * MatrixDetInternal(a2, a3, a4, b2, b3, b4, d2, d3, d4) - - d1 * MatrixDetInternal(a2, a3, a4, b2, b3, b4, c2, c3, c4); -end; - -//---------------------------------------------------------------------------------------------------------------------- - -procedure MatrixScale(var M: TMatrix; Factor: Single); register; - -// multiplies all elements of a 4x4 matrix with a factor - -var I, J: Integer; - -begin - for I := 0 to 3 do - for J := 0 to 3 do M[I, J] := M[I, J] * Factor; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -procedure MatrixInvert(var M: TMatrix); register; - -// finds the inverse of a 4x4 matrix - -var Det: Single; - -begin - Det := MatrixDeterminant(M); - if Abs(Det) < EPSILON then M := IdentityMatrix - else - begin - MatrixAdjoint(M); - MatrixScale(M, 1 / Det); - end; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -procedure MatrixTranspose(var M: TMatrix); register; - -// computes transpose of 4x4 matrix - -var I, J: Integer; - TM: TMatrix; - -begin - for I := 0 to 3 do - for J := 0 to 3 do TM[J, I] := M[I, J]; - M := TM; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -procedure MatrixAffineTranspose(var M: TAffineMatrix); register; - -// computes transpose of 3x3 matrix - -var I, J: Integer; - TM: TAffineMatrix; - -begin - for I := 0 to 2 do - for J := 0 to 2 do TM[J, I] := M[I, J]; - M := TM; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function MatrixMultiply(M1, M2: TMatrix): TMatrix; register; - -// multiplies two 4x4 matrices - -var I, J: Integer; - TM: TMatrix; - -begin - for I := 0 to 3 do - for J := 0 to 3 do - TM[I, J] := M1[I, X] * M2[X, J] + - M1[I, Y] * M2[Y, J] + - M1[I, Z] * M2[Z, J] + - M1[I, W] * M2[W, J]; - Result := TM; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function CreateRotationMatrix(Axis: TVector3f; Angle: Single): TMatrix; register; - -// Creates a rotation matrix along the given Axis by the given Angle in radians. - -var cosine, - sine, - Len, - one_minus_cosine: Extended; - -begin - SinCos(Angle, Sine, Cosine); - one_minus_cosine := 1 - cosine; - Len := VectorNormalize(Axis); - - if Len = 0 then Result := IdentityMatrix - else - begin - Result[X, X] := (one_minus_cosine * Sqr(Axis[0])) + Cosine; - Result[X, Y] := (one_minus_cosine * Axis[0] * Axis[1]) - (Axis[2] * Sine); - Result[X, Z] := (one_minus_cosine * Axis[2] * Axis[0]) + (Axis[1] * Sine); - Result[X, W] := 0; - - Result[Y, X] := (one_minus_cosine * Axis[0] * Axis[1]) + (Axis[2] * Sine); - Result[Y, Y] := (one_minus_cosine * Sqr(Axis[1])) + Cosine; - Result[Y, Z] := (one_minus_cosine * Axis[1] * Axis[2]) - (Axis[0] * Sine); - Result[Y, W] := 0; - - Result[Z, X] := (one_minus_cosine * Axis[2] * Axis[0]) - (Axis[1] * Sine); - Result[Z, Y] := (one_minus_cosine * Axis[1] * Axis[2]) + (Axis[0] * Sine); - Result[Z, Z] := (one_minus_cosine * Sqr(Axis[2])) + Cosine; - Result[Z, W] := 0; - - Result[W, X] := 0; - Result[W, Y] := 0; - Result[W, Z] := 0; - Result[W, W] := 1; - end; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function ConvertRotation(Angles: TAffineVector): TVector; register; - -{ Turn a triplet of rotations about x, y, and z (in that order) into an - equivalent rotation around a single axis (all in radians). - - Rotation of the Angle t about the axis (X, Y, Z) is given by: - - | X^2 + (1-X^2) Cos(t), XY(1-Cos(t)) + Z Sin(t), XZ(1-Cos(t))-Y Sin(t) | - M = | XY(1-Cos(t))-Z Sin(t), Y^2 + (1-Y^2) Cos(t), YZ(1-Cos(t)) + X Sin(t) | - | XZ(1-Cos(t)) + Y Sin(t), YZ(1-Cos(t))-X Sin(t), Z^2 + (1-Z^2) Cos(t) | - - Rotation about the three axes (Angles a1, a2, a3) can be represented as - the product of the individual rotation matrices: - - | 1 0 0 | | Cos(a2) 0 -Sin(a2) | | Cos(a3) Sin(a3) 0 | - | 0 Cos(a1) Sin(a1) | * | 0 1 0 | * | -Sin(a3) Cos(a3) 0 | - | 0 -Sin(a1) Cos(a1) | | Sin(a2) 0 Cos(a2) | | 0 0 1 | - Mx My Mz - - We now want to solve for X, Y, Z, and t given 9 equations in 4 unknowns. - Using the diagonal elements of the two matrices, we get: - - X^2 + (1-X^2) Cos(t) = M[0][0] - Y^2 + (1-Y^2) Cos(t) = M[1][1] - Z^2 + (1-Z^2) Cos(t) = M[2][2] - - Adding the three equations, we get: - - X^2 + Y^2 + Z^2 - (M[0][0] + M[1][1] + M[2][2]) = - - (3 - X^2 - Y^2 - Z^2) Cos(t) - - Since (X^2 + Y^2 + Z^2) = 1, we can rewrite as: - - Cos(t) = (1 - (M[0][0] + M[1][1] + M[2][2])) / 2 - - Solving for t, we get: - - t = Acos(((M[0][0] + M[1][1] + M[2][2]) - 1) / 2) - - We can substitute t into the equations for X^2, Y^2, and Z^2 above - to get the values for X, Y, and Z. To find the proper signs we note - that: - - 2 X Sin(t) = M[1][2] - M[2][1] - 2 Y Sin(t) = M[2][0] - M[0][2] - 2 Z Sin(t) = M[0][1] - M[1][0] -} - -var Axis1, Axis2: TVector3f; - M, M1, M2: TMatrix; - cost, cost1, - sint, - s1, s2, s3: Single; - I: Integer; - - -begin - // see if we are only rotating about a single Axis - if Abs(Angles[X]) < EPSILON then - begin - if Abs(Angles[Y]) < EPSILON then - begin - Result := MakeVector([0, 0, 1, Angles[Z]]); - Exit; - end - else - if Abs(Angles[Z]) < EPSILON then - begin - Result := MakeVector([0, 1, 0, Angles[Y]]); - Exit; - end - end - else - if (Abs(Angles[Y]) < EPSILON) and - (Abs(Angles[Z]) < EPSILON) then - begin - Result := MakeVector([1, 0, 0, Angles[X]]); - Exit; - end; - - // make the rotation matrix - Axis1 := MakeAffineVector([1, 0, 0]); - M := CreateRotationMatrix(Axis1, Angles[X]); - - Axis2 := MakeAffineVector([0, 1, 0]); - M2 := CreateRotationMatrix(Axis2, Angles[Y]); - M1 := MatrixMultiply(M, M2); - - Axis2 := MakeAffineVector([0, 0, 1]); - M2 := CreateRotationMatrix(Axis2, Angles[Z]); - M := MatrixMultiply(M1, M2); - - cost := ((M[X, X] + M[Y, Y] + M[Z, Z])-1) / 2; - if cost < -1 then cost := -1 - else - if cost > 1 - EPSILON then - begin - // Bad Angle - this would cause a crash - Result := MakeVector([1, 0, 0, 0]); - Exit; - end; - - cost1 := 1 - cost; - Result := Makevector([Sqrt((M[X, X]-cost) / cost1), - Sqrt((M[Y, Y]-cost) / cost1), - sqrt((M[Z, Z]-cost) / cost1), - arccos(cost)]); - - sint := 2 * Sqrt(1 - cost * cost); // This is actually 2 Sin(t) - - // Determine the proper signs - for I := 0 to 7 do - begin - if (I and 1) > 1 then s1 := -1 else s1 := 1; - if (I and 2) > 1 then s2 := -1 else s2 := 1; - if (I and 4) > 1 then s3 := -1 else s3 := 1; - if (Abs(s1 * Result[X] * sint-M[Y, Z] + M[Z, Y]) < EPSILON2) and - (Abs(s2 * Result[Y] * sint-M[Z, X] + M[X, Z]) < EPSILON2) and - (Abs(s3 * Result[Z] * sint-M[X, Y] + M[Y, X]) < EPSILON2) then - begin - // We found the right combination of signs - Result[X] := Result[X] * s1; - Result[Y] := Result[Y] * s2; - Result[Z] := Result[Z] * s3; - Exit; - end; - end; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function CreateRotationMatrixX(Sine, Cosine: Single): TMatrix; register; - -// creates matrix for rotation about x-axis - -begin - Result := EmptyMatrix; - Result[X, X] := 1; - Result[Y, Y] := Cosine; - Result[Y, Z] := Sine; - Result[Z, Y] := -Sine; - Result[Z, Z] := Cosine; - Result[W, W] := 1; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function CreateRotationMatrixY(Sine, Cosine: Single): TMatrix; register; - -// creates matrix for rotation about y-axis - -begin - Result := EmptyMatrix; - Result[X, X] := Cosine; - Result[X, Z] := -Sine; - Result[Y, Y] := 1; - Result[Z, X] := Sine; - Result[Z, Z] := Cosine; - Result[W, W] := 1; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function CreateRotationMatrixZ(Sine, Cosine: Single): TMatrix; register; - -// creates matrix for rotation about z-axis - -begin - Result := EmptyMatrix; - Result[X, X] := Cosine; - Result[X, Y] := Sine; - Result[Y, X] := -Sine; - Result[Y, Y] := Cosine; - Result[Z, Z] := 1; - Result[W, W] := 1; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function CreateScaleMatrix(V: TAffineVector): TMatrix; register; - -// creates scaling matrix - -begin - Result := IdentityMatrix; - Result[X, X] := V[X]; - Result[Y, Y] := V[Y]; - Result[Z, Z] := V[Z]; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function CreateTranslationMatrix(V: TVector): TMatrix; register; - -// creates translation matrix - -begin - Result := IdentityMatrix; - Result[W, X] := V[X]; - Result[W, Y] := V[Y]; - Result[W, Z] := V[Z]; - Result[W, W] := V[W]; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function Lerp(Start, Stop, t: Single): Single; - -// calculates linear interpolation between start and stop at point t - -begin - Result := Start + (Stop - Start) * t; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorAffineLerp(V1, V2: TAffineVector; t: Single): TAffineVector; - -// calculates linear interpolation between vector1 and vector2 at point t - -begin - Result[X] := Lerp(V1[X], V2[X], t); - Result[Y] := Lerp(V1[Y], V2[Y], t); - Result[Z] := Lerp(V1[Z], V2[Z], t); -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorLerp(V1, V2: TVector; t: Single): TVector; - -// calculates linear interpolation between vector1 and vector2 at point t - -begin - Result[X] := Lerp(V1[X], V2[X], t); - Result[Y] := Lerp(V1[Y], V2[Y], t); - Result[Z] := Lerp(V1[Z], V2[Z], t); - Result[W] := Lerp(V1[W], V2[W], t); -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function QuaternionSlerp(QStart, QEnd: TQuaternion; Spin: Integer; t: Single): TQuaternion; - -// spherical linear interpolation of unit quaternions with spins -// QStart, QEnd - start and end unit quaternions -// t - interpolation parameter (0 to 1) -// Spin - number of extra spin rotations to involve - -var beta, // complementary interp parameter - theta, // Angle between A and B - sint, cost, // sine, cosine of theta - phi: Single; // theta plus spins - bflip: Boolean; // use negativ t? - - -begin - // cosine theta - cost := VectorAngle(QStart.ImagPart, QEnd.ImagPart); - - // if QEnd is on opposite hemisphere from QStart, use -QEnd instead - if cost < 0 then - begin - cost := -cost; - bflip := True; - end - else bflip := False; - - // if QEnd is (within precision limits) the same as QStart, - // just linear interpolate between QStart and QEnd. - // Can't do spins, since we don't know what direction to spin. - - if (1 - cost) < EPSILON then beta := 1 - t - else - begin - // normal case - theta := arccos(cost); - phi := theta + Spin * Pi; - sint := sin(theta); - beta := sin(theta - t * phi) / sint; - t := sin(t * phi) / sint; - end; - - if bflip then t := -t; - - // interpolate - Result.ImagPart[X] := beta * QStart.ImagPart[X] + t * QEnd.ImagPart[X]; - Result.ImagPart[Y] := beta * QStart.ImagPart[Y] + t * QEnd.ImagPart[Y]; - Result.ImagPart[Z] := beta * QStart.ImagPart[Z] + t * QEnd.ImagPart[Z]; - Result.RealPart := beta * QStart.RealPart + t * QEnd.RealPart; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorAffineCombine(V1, V2: TAffineVector; F1, F2: Single): TAffineVector; - -// makes a linear combination of two vectors and return the result - -begin - Result[X] := (F1 * V1[X]) + (F2 * V2[X]); - Result[Y] := (F1 * V1[Y]) + (F2 * V2[Y]); - Result[Z] := (F1 * V1[Z]) + (F2 * V2[Z]); -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorCombine(V1, V2: TVector; F1, F2: Single): TVector; - -// makes a linear combination of two vectors and return the result - -begin - Result[X] := (F1 * V1[X]) + (F2 * V2[X]); - Result[Y] := (F1 * V1[Y]) + (F2 * V2[Y]); - Result[Z] := (F1 * V1[Z]) + (F2 * V2[Z]); - Result[W] := (F1 * V1[W]) + (F2 * V2[W]); -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function MatrixDecompose(M: TMatrix; var Tran: TTransformations): Boolean; register; - -// Author: Spencer W. Thomas, University of Michigan -// -// MatrixDecompose - Decompose a non-degenerated 4x4 transformation matrix into -// the sequence of transformations that produced it. -// -// The coefficient of each transformation is returned in the corresponding -// element of the vector Tran. -// -// Returns true upon success, false if the matrix is singular. - -var I, J: Integer; - LocMat, - pmat, - invpmat, - tinvpmat: TMatrix; - prhs, - psol: TVector; - Row: array[0..2] of TAffineVector; - -begin - Result := False; - locmat := M; - // normalize the matrix - if locmat[W, W] = 0 then Exit; - for I := 0 to 3 do - for J := 0 to 3 do - locmat[I, J] := locmat[I, J] / locmat[W, W]; - - // pmat is used to solve for perspective, but it also provides - // an easy way to test for singularity of the upper 3x3 component. - - pmat := locmat; - for I := 0 to 2 do pmat[I, W] := 0; - pmat[W, W] := 1; - - if MatrixDeterminant(pmat) = 0 then Exit; - - // First, isolate perspective. This is the messiest. - if (locmat[X, W] <> 0) or - (locmat[Y, W] <> 0) or - (locmat[Z, W] <> 0) then - begin - // prhs is the right hand side of the equation. - prhs[X] := locmat[X, W]; - prhs[Y] := locmat[Y, W]; - prhs[Z] := locmat[Z, W]; - prhs[W] := locmat[W, W]; - - // Solve the equation by inverting pmat and multiplying - // prhs by the inverse. (This is the easiest way, not - // necessarily the best.) - - invpmat := pmat; - MatrixInvert(invpmat); - MatrixTranspose(invpmat); - psol := VectorTransform(prhs, tinvpmat); - - // stuff the answer away - Tran[ttPerspectiveX] := psol[X]; - Tran[ttPerspectiveY] := psol[Y]; - Tran[ttPerspectiveZ] := psol[Z]; - Tran[ttPerspectiveW] := psol[W]; - - // clear the perspective partition - locmat[X, W] := 0; - locmat[Y, W] := 0; - locmat[Z, W] := 0; - locmat[W, W] := 1; - end - else - begin - // no perspective - Tran[ttPerspectiveX] := 0; - Tran[ttPerspectiveY] := 0; - Tran[ttPerspectiveZ] := 0; - Tran[ttPerspectiveW] := 0; - end; - - // next take care of translation (easy) - for I := 0 to 2 do - begin - Tran[TTransType(Ord(ttTranslateX) + I)] := locmat[W, I]; - locmat[W, I] := 0; - end; - - // now get scale and shear - for I := 0 to 2 do - begin - row[I, X] := locmat[I, X]; - row[I, Y] := locmat[I, Y]; - row[I, Z] := locmat[I, Z]; - end; - - // compute X scale factor and normalize first row - Tran[ttScaleX] := Sqr(VectorNormalize(row[0])); // ml: calculation optimized - - // compute XY shear factor and make 2nd row orthogonal to 1st - Tran[ttShearXY] := VectorAffineDotProduct(row[0], row[1]); - row[1] := VectorAffineCombine(row[1], row[0], 1, -Tran[ttShearXY]); - - // now, compute Y scale and normalize 2nd row - Tran[ttScaleY] := Sqr(VectorNormalize(row[1])); // ml: calculation optimized - Tran[ttShearXY] := Tran[ttShearXY]/Tran[ttScaleY]; - - // compute XZ and YZ shears, orthogonalize 3rd row - Tran[ttShearXZ] := VectorAffineDotProduct(row[0], row[2]); - row[2] := VectorAffineCombine(row[2], row[0], 1, -Tran[ttShearXZ]); - Tran[ttShearYZ] := VectorAffineDotProduct(row[1], row[2]); - row[2] := VectorAffineCombine(row[2], row[1], 1, -Tran[ttShearYZ]); - - // next, get Z scale and normalize 3rd row - Tran[ttScaleZ] := Sqr(VectorNormalize(row[1])); // (ML) calc. optimized - Tran[ttShearXZ] := Tran[ttShearXZ] / tran[ttScaleZ]; - Tran[ttShearYZ] := Tran[ttShearYZ] / Tran[ttScaleZ]; - - // At this point, the matrix (in rows[]) is orthonormal. - // Check for a coordinate system flip. If the determinant - // is -1, then negate the matrix and the scaling factors. - if VectorAffineDotProduct(row[0], VectorCrossProduct(row[1], row[2])) < 0 then - for I := 0 to 2 do - begin - Tran[TTransType(Ord(ttScaleX) + I)] := -Tran[TTransType(Ord(ttScaleX) + I)]; - row[I, X] := -row[I, X]; - row[I, Y] := -row[I, Y]; - row[I, Z] := -row[I, Z]; - end; - - // now, get the rotations out, as described in the gem - Tran[ttRotateY] := arcsin(-row[0, Z]); - if cos(Tran[ttRotateY]) <> 0 then - begin - Tran[ttRotateX] := arctan2(row[1, Z], row[2, Z]); - Tran[ttRotateZ] := arctan2(row[0, Y], row[0, X]); - end - else - begin - tran[ttRotateX] := arctan2(row[1, X], row[1, Y]); - tran[ttRotateZ] := 0; - end; - // All done! - Result := True; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorDblToFlt(V: THomogeneousDblVector): THomogeneousVector; assembler; - -// converts a vector containing double sized values into a vector with single sized values - -asm - FLD QWORD PTR [EAX] - FSTP DWORD PTR [EDX] - FLD QWORD PTR [EAX + 8] - FSTP DWORD PTR [EDX + 4] - FLD QWORD PTR [EAX + 16] - FSTP DWORD PTR [EDX + 8] - FLD QWORD PTR [EAX + 24] - FSTP DWORD PTR [EDX + 12] -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorAffineDblToFlt(V: TAffineDblVector): TAffineVector; assembler; - -// converts a vector containing double sized values into a vector with single sized values - -asm - FLD QWORD PTR [EAX] - FSTP DWORD PTR [EDX] - FLD QWORD PTR [EAX + 8] - FSTP DWORD PTR [EDX + 4] - FLD QWORD PTR [EAX + 16] - FSTP DWORD PTR [EDX + 8] -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorAffineFltToDbl(V: TAffineVector): TAffineDblVector; assembler; - -// converts a vector containing single sized values into a vector with double sized values - -asm - FLD DWORD PTR [EAX] - FSTP QWORD PTR [EDX] - FLD DWORD PTR [EAX + 8] - FSTP QWORD PTR [EDX + 4] - FLD DWORD PTR [EAX + 16] - FSTP QWORD PTR [EDX + 8] -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function VectorFltToDbl(V: TVector): THomogeneousDblVector; assembler; - -// converts a vector containing single sized values into a vector with double sized values - -asm - FLD DWORD PTR [EAX] - FSTP QWORD PTR [EDX] - FLD DWORD PTR [EAX + 8] - FSTP QWORD PTR [EDX + 4] - FLD DWORD PTR [EAX + 16] - FSTP QWORD PTR [EDX + 8] - FLD DWORD PTR [EAX + 24] - FSTP QWORD PTR [EDX + 12] -end; - -//----------------- coordinate system manipulation functions ----------------------------------------------------------- - -function Turn(Matrix: TMatrix; Angle: Single): TMatrix; - -// rotates the given coordinate system (represented by the matrix) around its Y-axis - -begin - Result := MatrixMultiply(Matrix, CreateRotationMatrix(MakeAffineVector(Matrix[1]), Angle)); -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function Turn(Matrix: TMatrix; MasterUp: TAffineVector; Angle: Single): TMatrix; - -// rotates the given coordinate system (represented by the matrix) around MasterUp - -begin - Result := MatrixMultiply(Matrix, CreateRotationMatrix(MasterUp, Angle)); -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function Pitch(Matrix: TMatrix; Angle: Single): TMatrix; - -// rotates the given coordinate system (represented by the matrix) around its X-axis - -begin - Result := MatrixMultiply(Matrix, CreateRotationMatrix(MakeAffineVector(Matrix[0]), Angle)); -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function Pitch(Matrix: TMatrix; MasterRight: TAffineVector; Angle: Single): TMatrix; overload; - -// rotates the given coordinate system (represented by the matrix) around MasterRight - -begin - Result := MatrixMultiply(Matrix, CreateRotationMatrix(MasterRight, Angle)); -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function Roll(Matrix: TMatrix; Angle: Single): TMatrix; - -// rotates the given coordinate system (represented by the matrix) around its Z-axis - -begin - Result := MatrixMultiply(Matrix, CreateRotationMatrix(MakeAffineVector(Matrix[2]), Angle)); -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function Roll(Matrix: TMatrix; MasterDirection: TAffineVector; Angle: Single): TMatrix; overload; - -// rotates the given coordinate system (represented by the matrix) around MasterDirection - -begin - Result := MatrixMultiply(Matrix, CreateRotationMatrix(MasterDirection, Angle)); -end; - -//---------------------------------------------------------------------------------------------------------------------- - -end. - - diff --git a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/gl.pas b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/gl.pas deleted file mode 100644 index aa0dd169..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/gl.pas +++ /dev/null @@ -1,2294 +0,0 @@ -unit gl; -{ - $Id: gl.pas,v 1.2 2004/08/14 22:54:30 savage Exp $ - - Adaption of the delphi3d.net OpenGL units to FreePascal - Sebastian Guenther (sg@freepascal.org) in 2002 - These units are free to use -} - -(*++ BUILD Version: 0004 // Increment this if a change has global effects - -Copyright (c) 1985-96, Microsoft Corporation - -Module Name: - - gl.h - -Abstract: - - Procedure declarations, constant definitions and macros for the OpenGL - component. - ---*) - -(* -** Copyright 1996 Silicon Graphics, Inc. -** All Rights Reserved. -** -** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.; -** the contents of this file may not be disclosed to third parties, copied or -** duplicated in any form, in whole or in part, without the prior written -** permission of Silicon Graphics, Inc. -** -** RESTRICTED RIGHTS LEGEND: -** Use, duplication or disclosure by the Government is subject to restrictions -** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data -** and Computer Software clause at DFARS 252.227-7013, and/or in similar or -** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - -** rights reserved under the Copyright Laws of the United States. -*) - -{******************************************************************************} -{ } -{ Converted to Delphi by Tom Nuydens (tom@delphi3d.net) } -{ For the latest updates, visit Delphi3D: http://www.delphi3d.net } -{ } -{ Modified for Delphi/Kylix and FreePascal } -{ by Dominique Louis ( Dominique@Savagesoftware.com.au) } -{ For the latest updates, visit JEDI-SDL : http://www.sf.net/projects/jedi-sdl } -{ } -{******************************************************************************} - -{ - $Log: gl.pas,v $ - Revision 1.2 2004/08/14 22:54:30 savage - Updated so that Library name defines are correctly defined for MacOS X. - - Revision 1.1 2004/03/30 21:53:54 savage - Moved to it's own folder. - - Revision 1.4 2004/02/20 17:09:55 savage - Code tidied up in gl, glu and glut, while extensions in glext.pas are now loaded using SDL_GL_GetProcAddress, thus making it more cross-platform compatible, but now more tied to SDL. - - Revision 1.3 2004/02/14 00:23:39 savage - As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. - - Revision 1.2 2004/02/14 00:09:18 savage - Changed uses to now make use of moduleloader.pas rather than dllfuncs.pas - - Revision 1.1 2004/02/05 00:08:19 savage - Module 1.0 release - - Revision 1.6 2003/06/02 12:32:12 savage - Modified Sources to avoid warnings with Delphi by moving CVS Logging to the top of the header files. Hopefully CVS Logging still works. - -} - -interface - -{$I jedi-sdl.inc} - -uses -{$IFDEF __GPC__} - system, - gpc, -{$ENDIF} - -{$IFDEF WIN32} - Windows, -{$ENDIF} - moduleloader; - - -var - LibGL: TModuleHandle; - -type - GLenum = Cardinal; PGLenum = ^GLenum; - GLboolean = Byte; PGLboolean = ^GLboolean; - GLbitfield = Cardinal; PGLbitfield = ^GLbitfield; - GLbyte = ShortInt; PGLbyte = ^GLbyte; - GLshort = SmallInt; PGLshort = ^GLshort; - GLint = Integer; PGLint = ^GLint; - GLsizei = Integer; PGLsizei = ^GLsizei; - GLubyte = Byte; PGLubyte = ^GLubyte; - GLushort = Word; PGLushort = ^GLushort; - GLuint = Cardinal; PGLuint = ^GLuint; - GLfloat = Single; PGLfloat = ^GLfloat; - GLclampf = Single; PGLclampf = ^GLclampf; - GLdouble = Double; PGLdouble = ^GLdouble; - GLclampd = Double; PGLclampd = ^GLclampd; -{ GLvoid = void; } PGLvoid = Pointer; - -{******************************************************************************} - -const -{$IFDEF WIN32} - GLLibName = 'OpenGL32.dll'; -{$ENDIF} - -{$IFDEF UNIX} -{$IFDEF DARWIN} - GLLibName = 'libGL.dylib'; -{$ELSE} - GLLibName = 'libGL.so'; -{$ENDIF} -{$ENDIF} - - // Version - GL_VERSION_1_1 = 1; - - // AccumOp - GL_ACCUM = $0100; - GL_LOAD = $0101; - GL_RETURN = $0102; - GL_MULT = $0103; - GL_ADD = $0104; - - // AlphaFunction - GL_NEVER = $0200; - GL_LESS = $0201; - GL_EQUAL = $0202; - GL_LEQUAL = $0203; - GL_GREATER = $0204; - GL_NOTEQUAL = $0205; - GL_GEQUAL = $0206; - GL_ALWAYS = $0207; - - // AttribMask - GL_CURRENT_BIT = $00000001; - GL_POINT_BIT = $00000002; - GL_LINE_BIT = $00000004; - GL_POLYGON_BIT = $00000008; - GL_POLYGON_STIPPLE_BIT = $00000010; - GL_PIXEL_MODE_BIT = $00000020; - GL_LIGHTING_BIT = $00000040; - GL_FOG_BIT = $00000080; - GL_DEPTH_BUFFER_BIT = $00000100; - GL_ACCUM_BUFFER_BIT = $00000200; - GL_STENCIL_BUFFER_BIT = $00000400; - GL_VIEWPORT_BIT = $00000800; - GL_TRANSFORM_BIT = $00001000; - GL_ENABLE_BIT = $00002000; - GL_COLOR_BUFFER_BIT = $00004000; - GL_HINT_BIT = $00008000; - GL_EVAL_BIT = $00010000; - GL_LIST_BIT = $00020000; - GL_TEXTURE_BIT = $00040000; - GL_SCISSOR_BIT = $00080000; - GL_ALL_ATTRIB_BITS = $000FFFFF; - - // BeginMode - GL_POINTS = $0000; - GL_LINES = $0001; - GL_LINE_LOOP = $0002; - GL_LINE_STRIP = $0003; - GL_TRIANGLES = $0004; - GL_TRIANGLE_STRIP = $0005; - GL_TRIANGLE_FAN = $0006; - GL_QUADS = $0007; - GL_QUAD_STRIP = $0008; - GL_POLYGON = $0009; - - // BlendingFactorDest - GL_ZERO = 0; - GL_ONE = 1; - GL_SRC_COLOR = $0300; - GL_ONE_MINUS_SRC_COLOR = $0301; - GL_SRC_ALPHA = $0302; - GL_ONE_MINUS_SRC_ALPHA = $0303; - GL_DST_ALPHA = $0304; - GL_ONE_MINUS_DST_ALPHA = $0305; - - // BlendingFactorSrc - // GL_ZERO - // GL_ONE - GL_DST_COLOR = $0306; - GL_ONE_MINUS_DST_COLOR = $0307; - GL_SRC_ALPHA_SATURATE = $0308; - // GL_SRC_ALPHA - // GL_ONE_MINUS_SRC_ALPHA - // GL_DST_ALPHA - // GL_ONE_MINUS_DST_ALPHA - - // Boolean - GL_TRUE = 1; - GL_FALSE = 0; - - // ClearBufferMask - // GL_COLOR_BUFFER_BIT - // GL_ACCUM_BUFFER_BIT - // GL_STENCIL_BUFFER_BIT - // GL_DEPTH_BUFFER_BIT - - // ClientArrayType - // GL_VERTEX_ARRAY - // GL_NORMAL_ARRAY - // GL_COLOR_ARRAY - // GL_INDEX_ARRAY - // GL_TEXTURE_COORD_ARRAY - // GL_EDGE_FLAG_ARRAY - - // ClipPlaneName - GL_CLIP_PLANE0 = $3000; - GL_CLIP_PLANE1 = $3001; - GL_CLIP_PLANE2 = $3002; - GL_CLIP_PLANE3 = $3003; - GL_CLIP_PLANE4 = $3004; - GL_CLIP_PLANE5 = $3005; - - // ColorMaterialFace - // GL_FRONT - // GL_BACK - // GL_FRONT_AND_BACK - - // ColorMaterialParameter - // GL_AMBIENT - // GL_DIFFUSE - // GL_SPECULAR - // GL_EMISSION - // GL_AMBIENT_AND_DIFFUSE - - // ColorPointerType - // GL_BYTE - // GL_UNSIGNED_BYTE - // GL_SHORT - // GL_UNSIGNED_SHORT - // GL_INT - // GL_UNSIGNED_INT - // GL_FLOAT - // GL_DOUBLE - - // CullFaceMode - // GL_FRONT - // GL_BACK - // GL_FRONT_AND_BACK - - // DataType - GL_BYTE = $1400; - GL_UNSIGNED_BYTE = $1401; - GL_SHORT = $1402; - GL_UNSIGNED_SHORT = $1403; - GL_INT = $1404; - GL_UNSIGNED_INT = $1405; - GL_FLOAT = $1406; - GL_2_BYTES = $1407; - GL_3_BYTES = $1408; - GL_4_BYTES = $1409; - GL_DOUBLE = $140A; - - // DepthFunction - // GL_NEVER - // GL_LESS - // GL_EQUAL - // GL_LEQUAL - // GL_GREATER - // GL_NOTEQUAL - // GL_GEQUAL - // GL_ALWAYS - - // DrawBufferMode - GL_NONE = 0; - GL_FRONT_LEFT = $0400; - GL_FRONT_RIGHT = $0401; - GL_BACK_LEFT = $0402; - GL_BACK_RIGHT = $0403; - GL_FRONT = $0404; - GL_BACK = $0405; - GL_LEFT = $0406; - GL_RIGHT = $0407; - GL_FRONT_AND_BACK = $0408; - GL_AUX0 = $0409; - GL_AUX1 = $040A; - GL_AUX2 = $040B; - GL_AUX3 = $040C; - - // Enable - // GL_FOG - // GL_LIGHTING - // GL_TEXTURE_1D - // GL_TEXTURE_2D - // GL_LINE_STIPPLE - // GL_POLYGON_STIPPLE - // GL_CULL_FACE - // GL_ALPHA_TEST - // GL_BLEND - // GL_INDEX_LOGIC_OP - // GL_COLOR_LOGIC_OP - // GL_DITHER - // GL_STENCIL_TEST - // GL_DEPTH_TEST - // GL_CLIP_PLANE0 - // GL_CLIP_PLANE1 - // GL_CLIP_PLANE2 - // GL_CLIP_PLANE3 - // GL_CLIP_PLANE4 - // GL_CLIP_PLANE5 - // GL_LIGHT0 - // GL_LIGHT1 - // GL_LIGHT2 - // GL_LIGHT3 - // GL_LIGHT4 - // GL_LIGHT5 - // GL_LIGHT6 - // GL_LIGHT7 - // GL_TEXTURE_GEN_S - // GL_TEXTURE_GEN_T - // GL_TEXTURE_GEN_R - // GL_TEXTURE_GEN_Q - // GL_MAP1_VERTEX_3 - // GL_MAP1_VERTEX_4 - // GL_MAP1_COLOR_4 - // GL_MAP1_INDEX - // GL_MAP1_NORMAL - // GL_MAP1_TEXTURE_COORD_1 - // GL_MAP1_TEXTURE_COORD_2 - // GL_MAP1_TEXTURE_COORD_3 - // GL_MAP1_TEXTURE_COORD_4 - // GL_MAP2_VERTEX_3 - // GL_MAP2_VERTEX_4 - // GL_MAP2_COLOR_4 - // GL_MAP2_INDEX - // GL_MAP2_NORMAL - // GL_MAP2_TEXTURE_COORD_1 - // GL_MAP2_TEXTURE_COORD_2 - // GL_MAP2_TEXTURE_COORD_3 - // GL_MAP2_TEXTURE_COORD_4 - // GL_POINT_SMOOTH - // GL_LINE_SMOOTH - // GL_POLYGON_SMOOTH - // GL_SCISSOR_TEST - // GL_COLOR_MATERIAL - // GL_NORMALIZE - // GL_AUTO_NORMAL - // GL_VERTEX_ARRAY - // GL_NORMAL_ARRAY - // GL_COLOR_ARRAY - // GL_INDEX_ARRAY - // GL_TEXTURE_COORD_ARRAY - // GL_EDGE_FLAG_ARRAY - // GL_POLYGON_OFFSET_POINT - // GL_POLYGON_OFFSET_LINE - // GL_POLYGON_OFFSET_FILL - - // ErrorCode - GL_NO_ERROR = 0; - GL_INVALID_ENUM = $0500; - GL_INVALID_VALUE = $0501; - GL_INVALID_OPERATION = $0502; - GL_STACK_OVERFLOW = $0503; - GL_STACK_UNDERFLOW = $0504; - GL_OUT_OF_MEMORY = $0505; - - // FeedBackMode - GL_2D = $0600; - GL_3D = $0601; - GL_3D_COLOR = $0602; - GL_3D_COLOR_TEXTURE = $0603; - GL_4D_COLOR_TEXTURE = $0604; - - // FeedBackToken - GL_PASS_THROUGH_TOKEN = $0700; - GL_POINT_TOKEN = $0701; - GL_LINE_TOKEN = $0702; - GL_POLYGON_TOKEN = $0703; - GL_BITMAP_TOKEN = $0704; - GL_DRAW_PIXEL_TOKEN = $0705; - GL_COPY_PIXEL_TOKEN = $0706; - GL_LINE_RESET_TOKEN = $0707; - - // FogMode - // GL_LINEAR - GL_EXP = $0800; - GL_EXP2 = $0801; - - // FogParameter - // GL_FOG_COLOR - // GL_FOG_DENSITY - // GL_FOG_END - // GL_FOG_INDEX - // GL_FOG_MODE - // GL_FOG_START - - // FrontFaceDirection - GL_CW = $0900; - GL_CCW = $0901; - - // GetMapTarget - GL_COEFF = $0A00; - GL_ORDER = $0A01; - GL_DOMAIN = $0A02; - - // GetPixelMap - // GL_PIXEL_MAP_I_TO_I - // GL_PIXEL_MAP_S_TO_S - // GL_PIXEL_MAP_I_TO_R - // GL_PIXEL_MAP_I_TO_G - // GL_PIXEL_MAP_I_TO_B - // GL_PIXEL_MAP_I_TO_A - // GL_PIXEL_MAP_R_TO_R - // GL_PIXEL_MAP_G_TO_G - // GL_PIXEL_MAP_B_TO_B - // GL_PIXEL_MAP_A_TO_A - - // GetPointerTarget - // GL_VERTEX_ARRAY_POINTER - // GL_NORMAL_ARRAY_POINTER - // GL_COLOR_ARRAY_POINTER - // GL_INDEX_ARRAY_POINTER - // GL_TEXTURE_COORD_ARRAY_POINTER - // GL_EDGE_FLAG_ARRAY_POINTER - - // GetTarget - GL_CURRENT_COLOR = $0B00; - GL_CURRENT_INDEX = $0B01; - GL_CURRENT_NORMAL = $0B02; - GL_CURRENT_TEXTURE_COORDS = $0B03; - GL_CURRENT_RASTER_COLOR = $0B04; - GL_CURRENT_RASTER_INDEX = $0B05; - GL_CURRENT_RASTER_TEXTURE_COORDS = $0B06; - GL_CURRENT_RASTER_POSITION = $0B07; - GL_CURRENT_RASTER_POSITION_VALID = $0B08; - GL_CURRENT_RASTER_DISTANCE = $0B09; - GL_POINT_SMOOTH = $0B10; - GL_POINT_SIZE = $0B11; - GL_POINT_SIZE_RANGE = $0B12; - GL_POINT_SIZE_GRANULARITY = $0B13; - GL_LINE_SMOOTH = $0B20; - GL_LINE_WIDTH = $0B21; - GL_LINE_WIDTH_RANGE = $0B22; - GL_LINE_WIDTH_GRANULARITY = $0B23; - GL_LINE_STIPPLE = $0B24; - GL_LINE_STIPPLE_PATTERN = $0B25; - GL_LINE_STIPPLE_REPEAT = $0B26; - GL_LIST_MODE = $0B30; - GL_MAX_LIST_NESTING = $0B31; - GL_LIST_BASE = $0B32; - GL_LIST_INDEX = $0B33; - GL_POLYGON_MODE = $0B40; - GL_POLYGON_SMOOTH = $0B41; - GL_POLYGON_STIPPLE = $0B42; - GL_EDGE_FLAG = $0B43; - GL_CULL_FACE = $0B44; - GL_CULL_FACE_MODE = $0B45; - GL_FRONT_FACE = $0B46; - GL_LIGHTING = $0B50; - GL_LIGHT_MODEL_LOCAL_VIEWER = $0B51; - GL_LIGHT_MODEL_TWO_SIDE = $0B52; - GL_LIGHT_MODEL_AMBIENT = $0B53; - GL_SHADE_MODEL = $0B54; - GL_COLOR_MATERIAL_FACE = $0B55; - GL_COLOR_MATERIAL_PARAMETER = $0B56; - GL_COLOR_MATERIAL = $0B57; - GL_FOG = $0B60; - GL_FOG_INDEX = $0B61; - GL_FOG_DENSITY = $0B62; - GL_FOG_START = $0B63; - GL_FOG_END = $0B64; - GL_FOG_MODE = $0B65; - GL_FOG_COLOR = $0B66; - GL_DEPTH_RANGE = $0B70; - GL_DEPTH_TEST = $0B71; - GL_DEPTH_WRITEMASK = $0B72; - GL_DEPTH_CLEAR_VALUE = $0B73; - GL_DEPTH_FUNC = $0B74; - GL_ACCUM_CLEAR_VALUE = $0B80; - GL_STENCIL_TEST = $0B90; - GL_STENCIL_CLEAR_VALUE = $0B91; - GL_STENCIL_FUNC = $0B92; - GL_STENCIL_VALUE_MASK = $0B93; - GL_STENCIL_FAIL = $0B94; - GL_STENCIL_PASS_DEPTH_FAIL = $0B95; - GL_STENCIL_PASS_DEPTH_PASS = $0B96; - GL_STENCIL_REF = $0B97; - GL_STENCIL_WRITEMASK = $0B98; - GL_MATRIX_MODE = $0BA0; - GL_NORMALIZE = $0BA1; - GL_VIEWPORT = $0BA2; - GL_MODELVIEW_STACK_DEPTH = $0BA3; - GL_PROJECTION_STACK_DEPTH = $0BA4; - GL_TEXTURE_STACK_DEPTH = $0BA5; - GL_MODELVIEW_MATRIX = $0BA6; - GL_PROJECTION_MATRIX = $0BA7; - GL_TEXTURE_MATRIX = $0BA8; - GL_ATTRIB_STACK_DEPTH = $0BB0; - GL_CLIENT_ATTRIB_STACK_DEPTH = $0BB1; - GL_ALPHA_TEST = $0BC0; - GL_ALPHA_TEST_FUNC = $0BC1; - GL_ALPHA_TEST_REF = $0BC2; - GL_DITHER = $0BD0; - GL_BLEND_DST = $0BE0; - GL_BLEND_SRC = $0BE1; - GL_BLEND = $0BE2; - GL_LOGIC_OP_MODE = $0BF0; - GL_INDEX_LOGIC_OP = $0BF1; - GL_COLOR_LOGIC_OP = $0BF2; - GL_AUX_BUFFERS = $0C00; - GL_DRAW_BUFFER = $0C01; - GL_READ_BUFFER = $0C02; - GL_SCISSOR_BOX = $0C10; - GL_SCISSOR_TEST = $0C11; - GL_INDEX_CLEAR_VALUE = $0C20; - GL_INDEX_WRITEMASK = $0C21; - GL_COLOR_CLEAR_VALUE = $0C22; - GL_COLOR_WRITEMASK = $0C23; - GL_INDEX_MODE = $0C30; - GL_RGBA_MODE = $0C31; - GL_DOUBLEBUFFER = $0C32; - GL_STEREO = $0C33; - GL_RENDER_MODE = $0C40; - GL_PERSPECTIVE_CORRECTION_HINT = $0C50; - GL_POINT_SMOOTH_HINT = $0C51; - GL_LINE_SMOOTH_HINT = $0C52; - GL_POLYGON_SMOOTH_HINT = $0C53; - GL_FOG_HINT = $0C54; - GL_TEXTURE_GEN_S = $0C60; - GL_TEXTURE_GEN_T = $0C61; - GL_TEXTURE_GEN_R = $0C62; - GL_TEXTURE_GEN_Q = $0C63; - GL_PIXEL_MAP_I_TO_I = $0C70; - GL_PIXEL_MAP_S_TO_S = $0C71; - GL_PIXEL_MAP_I_TO_R = $0C72; - GL_PIXEL_MAP_I_TO_G = $0C73; - GL_PIXEL_MAP_I_TO_B = $0C74; - GL_PIXEL_MAP_I_TO_A = $0C75; - GL_PIXEL_MAP_R_TO_R = $0C76; - GL_PIXEL_MAP_G_TO_G = $0C77; - GL_PIXEL_MAP_B_TO_B = $0C78; - GL_PIXEL_MAP_A_TO_A = $0C79; - GL_PIXEL_MAP_I_TO_I_SIZE = $0CB0; - GL_PIXEL_MAP_S_TO_S_SIZE = $0CB1; - GL_PIXEL_MAP_I_TO_R_SIZE = $0CB2; - GL_PIXEL_MAP_I_TO_G_SIZE = $0CB3; - GL_PIXEL_MAP_I_TO_B_SIZE = $0CB4; - GL_PIXEL_MAP_I_TO_A_SIZE = $0CB5; - GL_PIXEL_MAP_R_TO_R_SIZE = $0CB6; - GL_PIXEL_MAP_G_TO_G_SIZE = $0CB7; - GL_PIXEL_MAP_B_TO_B_SIZE = $0CB8; - GL_PIXEL_MAP_A_TO_A_SIZE = $0CB9; - GL_UNPACK_SWAP_BYTES = $0CF0; - GL_UNPACK_LSB_FIRST = $0CF1; - GL_UNPACK_ROW_LENGTH = $0CF2; - GL_UNPACK_SKIP_ROWS = $0CF3; - GL_UNPACK_SKIP_PIXELS = $0CF4; - GL_UNPACK_ALIGNMENT = $0CF5; - GL_PACK_SWAP_BYTES = $0D00; - GL_PACK_LSB_FIRST = $0D01; - GL_PACK_ROW_LENGTH = $0D02; - GL_PACK_SKIP_ROWS = $0D03; - GL_PACK_SKIP_PIXELS = $0D04; - GL_PACK_ALIGNMENT = $0D05; - GL_MAP_COLOR = $0D10; - GL_MAP_STENCIL = $0D11; - GL_INDEX_SHIFT = $0D12; - GL_INDEX_OFFSET = $0D13; - GL_RED_SCALE = $0D14; - GL_RED_BIAS = $0D15; - GL_ZOOM_X = $0D16; - GL_ZOOM_Y = $0D17; - GL_GREEN_SCALE = $0D18; - GL_GREEN_BIAS = $0D19; - GL_BLUE_SCALE = $0D1A; - GL_BLUE_BIAS = $0D1B; - GL_ALPHA_SCALE = $0D1C; - GL_ALPHA_BIAS = $0D1D; - GL_DEPTH_SCALE = $0D1E; - GL_DEPTH_BIAS = $0D1F; - GL_MAX_EVAL_ORDER = $0D30; - GL_MAX_LIGHTS = $0D31; - GL_MAX_CLIP_PLANES = $0D32; - GL_MAX_TEXTURE_SIZE = $0D33; - GL_MAX_PIXEL_MAP_TABLE = $0D34; - GL_MAX_ATTRIB_STACK_DEPTH = $0D35; - GL_MAX_MODELVIEW_STACK_DEPTH = $0D36; - GL_MAX_NAME_STACK_DEPTH = $0D37; - GL_MAX_PROJECTION_STACK_DEPTH = $0D38; - GL_MAX_TEXTURE_STACK_DEPTH = $0D39; - GL_MAX_VIEWPORT_DIMS = $0D3A; - GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = $0D3B; - GL_SUBPIXEL_BITS = $0D50; - GL_INDEX_BITS = $0D51; - GL_RED_BITS = $0D52; - GL_GREEN_BITS = $0D53; - GL_BLUE_BITS = $0D54; - GL_ALPHA_BITS = $0D55; - GL_DEPTH_BITS = $0D56; - GL_STENCIL_BITS = $0D57; - GL_ACCUM_RED_BITS = $0D58; - GL_ACCUM_GREEN_BITS = $0D59; - GL_ACCUM_BLUE_BITS = $0D5A; - GL_ACCUM_ALPHA_BITS = $0D5B; - GL_NAME_STACK_DEPTH = $0D70; - GL_AUTO_NORMAL = $0D80; - GL_MAP1_COLOR_4 = $0D90; - GL_MAP1_INDEX = $0D91; - GL_MAP1_NORMAL = $0D92; - GL_MAP1_TEXTURE_COORD_1 = $0D93; - GL_MAP1_TEXTURE_COORD_2 = $0D94; - GL_MAP1_TEXTURE_COORD_3 = $0D95; - GL_MAP1_TEXTURE_COORD_4 = $0D96; - GL_MAP1_VERTEX_3 = $0D97; - GL_MAP1_VERTEX_4 = $0D98; - GL_MAP2_COLOR_4 = $0DB0; - GL_MAP2_INDEX = $0DB1; - GL_MAP2_NORMAL = $0DB2; - GL_MAP2_TEXTURE_COORD_1 = $0DB3; - GL_MAP2_TEXTURE_COORD_2 = $0DB4; - GL_MAP2_TEXTURE_COORD_3 = $0DB5; - GL_MAP2_TEXTURE_COORD_4 = $0DB6; - GL_MAP2_VERTEX_3 = $0DB7; - GL_MAP2_VERTEX_4 = $0DB8; - GL_MAP1_GRID_DOMAIN = $0DD0; - GL_MAP1_GRID_SEGMENTS = $0DD1; - GL_MAP2_GRID_DOMAIN = $0DD2; - GL_MAP2_GRID_SEGMENTS = $0DD3; - GL_TEXTURE_1D = $0DE0; - GL_TEXTURE_2D = $0DE1; - GL_FEEDBACK_BUFFER_POINTER = $0DF0; - GL_FEEDBACK_BUFFER_SIZE = $0DF1; - GL_FEEDBACK_BUFFER_TYPE = $0DF2; - GL_SELECTION_BUFFER_POINTER = $0DF3; - GL_SELECTION_BUFFER_SIZE = $0DF4; - // GL_TEXTURE_BINDING_1D - // GL_TEXTURE_BINDING_2D - // GL_VERTEX_ARRAY - // GL_NORMAL_ARRAY - // GL_COLOR_ARRAY - // GL_INDEX_ARRAY - // GL_TEXTURE_COORD_ARRAY - // GL_EDGE_FLAG_ARRAY - // GL_VERTEX_ARRAY_SIZE - // GL_VERTEX_ARRAY_TYPE - // GL_VERTEX_ARRAY_STRIDE - // GL_NORMAL_ARRAY_TYPE - // GL_NORMAL_ARRAY_STRIDE - // GL_COLOR_ARRAY_SIZE - // GL_COLOR_ARRAY_TYPE - // GL_COLOR_ARRAY_STRIDE - // GL_INDEX_ARRAY_TYPE - // GL_INDEX_ARRAY_STRIDE - // GL_TEXTURE_COORD_ARRAY_SIZE - // GL_TEXTURE_COORD_ARRAY_TYPE - // GL_TEXTURE_COORD_ARRAY_STRIDE - // GL_EDGE_FLAG_ARRAY_STRIDE - // GL_POLYGON_OFFSET_FACTOR - // GL_POLYGON_OFFSET_UNITS - - // GetTextureParameter - // GL_TEXTURE_MAG_FILTER - // GL_TEXTURE_MIN_FILTER - // GL_TEXTURE_WRAP_S - // GL_TEXTURE_WRAP_T - GL_TEXTURE_WIDTH = $1000; - GL_TEXTURE_HEIGHT = $1001; - GL_TEXTURE_INTERNAL_FORMAT = $1003; - GL_TEXTURE_BORDER_COLOR = $1004; - GL_TEXTURE_BORDER = $1005; - // GL_TEXTURE_RED_SIZE - // GL_TEXTURE_GREEN_SIZE - // GL_TEXTURE_BLUE_SIZE - // GL_TEXTURE_ALPHA_SIZE - // GL_TEXTURE_LUMINANCE_SIZE - // GL_TEXTURE_INTENSITY_SIZE - // GL_TEXTURE_PRIORITY - // GL_TEXTURE_RESIDENT - - // HintMode - GL_DONT_CARE = $1100; - GL_FASTEST = $1101; - GL_NICEST = $1102; - - // HintTarget - // GL_PERSPECTIVE_CORRECTION_HINT - // GL_POINT_SMOOTH_HINT - // GL_LINE_SMOOTH_HINT - // GL_POLYGON_SMOOTH_HINT - // GL_FOG_HINT - - // IndexPointerType - // GL_SHORT - // GL_INT - // GL_FLOAT - // GL_DOUBLE - - // LightModelParameter - // GL_LIGHT_MODEL_AMBIENT - // GL_LIGHT_MODEL_LOCAL_VIEWER - // GL_LIGHT_MODEL_TWO_SIDE - - // LightName - GL_LIGHT0 = $4000; - GL_LIGHT1 = $4001; - GL_LIGHT2 = $4002; - GL_LIGHT3 = $4003; - GL_LIGHT4 = $4004; - GL_LIGHT5 = $4005; - GL_LIGHT6 = $4006; - GL_LIGHT7 = $4007; - - // LightParameter - GL_AMBIENT = $1200; - GL_DIFFUSE = $1201; - GL_SPECULAR = $1202; - GL_POSITION = $1203; - GL_SPOT_DIRECTION = $1204; - GL_SPOT_EXPONENT = $1205; - GL_SPOT_CUTOFF = $1206; - GL_CONSTANT_ATTENUATION = $1207; - GL_LINEAR_ATTENUATION = $1208; - GL_QUADRATIC_ATTENUATION = $1209; - - // InterleavedArrays - // GL_V2F - // GL_V3F - // GL_C4UB_V2F - // GL_C4UB_V3F - // GL_C3F_V3F - // GL_N3F_V3F - // GL_C4F_N3F_V3F - // GL_T2F_V3F - // GL_T4F_V4F - // GL_T2F_C4UB_V3F - // GL_T2F_C3F_V3F - // GL_T2F_N3F_V3F - // GL_T2F_C4F_N3F_V3F - // GL_T4F_C4F_N3F_V4F - - // ListMode - GL_COMPILE = $1300; - GL_COMPILE_AND_EXECUTE = $1301; - - // ListNameType - // GL_BYTE - // GL_UNSIGNED_BYTE - // GL_SHORT - // GL_UNSIGNED_SHORT - // GL_INT - // GL_UNSIGNED_INT - // GL_FLOAT - // GL_2_BYTES - // GL_3_BYTES - // GL_4_BYTES - - // LogicOp - GL_CLEAR = $1500; - GL_AND = $1501; - GL_AND_REVERSE = $1502; - GL_COPY = $1503; - GL_AND_INVERTED = $1504; - GL_NOOP = $1505; - GL_XOR = $1506; - GL_OR = $1507; - GL_NOR = $1508; - GL_EQUIV = $1509; - GL_INVERT = $150A; - GL_OR_REVERSE = $150B; - GL_COPY_INVERTED = $150C; - GL_OR_INVERTED = $150D; - GL_NAND = $150E; - GL_SET = $150F; - - // MapTarget - // GL_MAP1_COLOR_4 - // GL_MAP1_INDEX - // GL_MAP1_NORMAL - // GL_MAP1_TEXTURE_COORD_1 - // GL_MAP1_TEXTURE_COORD_2 - // GL_MAP1_TEXTURE_COORD_3 - // GL_MAP1_TEXTURE_COORD_4 - // GL_MAP1_VERTEX_3 - // GL_MAP1_VERTEX_4 - // GL_MAP2_COLOR_4 - // GL_MAP2_INDEX - // GL_MAP2_NORMAL - // GL_MAP2_TEXTURE_COORD_1 - // GL_MAP2_TEXTURE_COORD_2 - // GL_MAP2_TEXTURE_COORD_3 - // GL_MAP2_TEXTURE_COORD_4 - // GL_MAP2_VERTEX_3 - // GL_MAP2_VERTEX_4 - - // MaterialFace - // GL_FRONT - // GL_BACK - // GL_FRONT_AND_BACK - - // MaterialParameter - GL_EMISSION = $1600; - GL_SHININESS = $1601; - GL_AMBIENT_AND_DIFFUSE = $1602; - GL_COLOR_INDEXES = $1603; - // GL_AMBIENT - // GL_DIFFUSE - // GL_SPECULAR - - // MatrixMode - GL_MODELVIEW = $1700; - GL_PROJECTION = $1701; - GL_TEXTURE = $1702; - - // MeshMode1 - // GL_POINT - // GL_LINE - - // MeshMode2 - // GL_POINT - // GL_LINE - // GL_FILL - - // NormalPointerType - // GL_BYTE - // GL_SHORT - // GL_INT - // GL_FLOAT - // GL_DOUBLE - - // PixelCopyType - GL_COLOR = $1800; - GL_DEPTH = $1801; - GL_STENCIL = $1802; - - // PixelFormat - GL_COLOR_INDEX = $1900; - GL_STENCIL_INDEX = $1901; - GL_DEPTH_COMPONENT = $1902; - GL_RED = $1903; - GL_GREEN = $1904; - GL_BLUE = $1905; - GL_ALPHA = $1906; - GL_RGB = $1907; - GL_RGBA = $1908; - GL_LUMINANCE = $1909; - GL_LUMINANCE_ALPHA = $190A; - - // PixelMap - // GL_PIXEL_MAP_I_TO_I - // GL_PIXEL_MAP_S_TO_S - // GL_PIXEL_MAP_I_TO_R - // GL_PIXEL_MAP_I_TO_G - // GL_PIXEL_MAP_I_TO_B - // GL_PIXEL_MAP_I_TO_A - // GL_PIXEL_MAP_R_TO_R - // GL_PIXEL_MAP_G_TO_G - // GL_PIXEL_MAP_B_TO_B - // GL_PIXEL_MAP_A_TO_A - - // PixelStore - // GL_UNPACK_SWAP_BYTES - // GL_UNPACK_LSB_FIRST - // GL_UNPACK_ROW_LENGTH - // GL_UNPACK_SKIP_ROWS - // GL_UNPACK_SKIP_PIXELS - // GL_UNPACK_ALIGNMENT - // GL_PACK_SWAP_BYTES - // GL_PACK_LSB_FIRST - // GL_PACK_ROW_LENGTH - // GL_PACK_SKIP_ROWS - // GL_PACK_SKIP_PIXELS - // GL_PACK_ALIGNMENT - - // PixelTransfer - // GL_MAP_COLOR - // GL_MAP_STENCIL - // GL_INDEX_SHIFT - // GL_INDEX_OFFSET - // GL_RED_SCALE - // GL_RED_BIAS - // GL_GREEN_SCALE - // GL_GREEN_BIAS - // GL_BLUE_SCALE - // GL_BLUE_BIAS - // GL_ALPHA_SCALE - // GL_ALPHA_BIAS - // GL_DEPTH_SCALE - // GL_DEPTH_BIAS - - // PixelType - GL_BITMAP = $1A00; - // GL_BYTE - // GL_UNSIGNED_BYTE - // GL_SHORT - // GL_UNSIGNED_SHORT - // GL_INT - // GL_UNSIGNED_INT - // GL_FLOAT - - // PolygonMode - GL_POINT = $1B00; - GL_LINE = $1B01; - GL_FILL = $1B02; - - // ReadBufferMode - // GL_FRONT_LEFT - // GL_FRONT_RIGHT - // GL_BACK_LEFT - // GL_BACK_RIGHT - // GL_FRONT - // GL_BACK - // GL_LEFT - // GL_RIGHT - // GL_AUX0 - // GL_AUX1 - // GL_AUX2 - // GL_AUX3 - - // RenderingMode - GL_RENDER = $1C00; - GL_FEEDBACK = $1C01; - GL_SELECT = $1C02; - - // ShadingModel - GL_FLAT = $1D00; - GL_SMOOTH = $1D01; - - // StencilFunction - // GL_NEVER - // GL_LESS - // GL_EQUAL - // GL_LEQUAL - // GL_GREATER - // GL_NOTEQUAL - // GL_GEQUAL - // GL_ALWAYS - - // StencilOp - // GL_ZERO - GL_KEEP = $1E00; - GL_REPLACE = $1E01; - GL_INCR = $1E02; - GL_DECR = $1E03; - // GL_INVERT - - // StringName - GL_VENDOR = $1F00; - GL_RENDERER = $1F01; - GL_VERSION = $1F02; - GL_EXTENSIONS = $1F03; - - // TextureCoordName - GL_S = $2000; - GL_T = $2001; - GL_R = $2002; - GL_Q = $2003; - - // TexCoordPointerType - // GL_SHORT - // GL_INT - // GL_FLOAT - // GL_DOUBLE - - // TextureEnvMode - GL_MODULATE = $2100; - GL_DECAL = $2101; - // GL_BLEND - // GL_REPLACE - - // TextureEnvParameter - GL_TEXTURE_ENV_MODE = $2200; - GL_TEXTURE_ENV_COLOR = $2201; - - // TextureEnvTarget - GL_TEXTURE_ENV = $2300; - - // TextureGenMode - GL_EYE_LINEAR = $2400; - GL_OBJECT_LINEAR = $2401; - GL_SPHERE_MAP = $2402; - - // TextureGenParameter - GL_TEXTURE_GEN_MODE = $2500; - GL_OBJECT_PLANE = $2501; - GL_EYE_PLANE = $2502; - - // TextureMagFilter - GL_NEAREST = $2600; - GL_LINEAR = $2601; - - // TextureMinFilter - // GL_NEAREST - // GL_LINEAR - GL_NEAREST_MIPMAP_NEAREST = $2700; - GL_LINEAR_MIPMAP_NEAREST = $2701; - GL_NEAREST_MIPMAP_LINEAR = $2702; - GL_LINEAR_MIPMAP_LINEAR = $2703; - - // TextureParameterName - GL_TEXTURE_MAG_FILTER = $2800; - GL_TEXTURE_MIN_FILTER = $2801; - GL_TEXTURE_WRAP_S = $2802; - GL_TEXTURE_WRAP_T = $2803; - // GL_TEXTURE_BORDER_COLOR - // GL_TEXTURE_PRIORITY - - // TextureTarget - // GL_TEXTURE_1D - // GL_TEXTURE_2D - // GL_PROXY_TEXTURE_1D - // GL_PROXY_TEXTURE_2D - - // TextureWrapMode - GL_CLAMP = $2900; - GL_REPEAT = $2901; - - // VertexPointerType - // GL_SHORT - // GL_INT - // GL_FLOAT - // GL_DOUBLE - - // ClientAttribMask - GL_CLIENT_PIXEL_STORE_BIT = $00000001; - GL_CLIENT_VERTEX_ARRAY_BIT = $00000002; - GL_CLIENT_ALL_ATTRIB_BITS = $FFFFFFFF; - - // polygon_offset - GL_POLYGON_OFFSET_FACTOR = $8038; - GL_POLYGON_OFFSET_UNITS = $2A00; - GL_POLYGON_OFFSET_POINT = $2A01; - GL_POLYGON_OFFSET_LINE = $2A02; - GL_POLYGON_OFFSET_FILL = $8037; - - // texture - GL_ALPHA4 = $803B; - GL_ALPHA8 = $803C; - GL_ALPHA12 = $803D; - GL_ALPHA16 = $803E; - GL_LUMINANCE4 = $803F; - GL_LUMINANCE8 = $8040; - GL_LUMINANCE12 = $8041; - GL_LUMINANCE16 = $8042; - GL_LUMINANCE4_ALPHA4 = $8043; - GL_LUMINANCE6_ALPHA2 = $8044; - GL_LUMINANCE8_ALPHA8 = $8045; - GL_LUMINANCE12_ALPHA4 = $8046; - GL_LUMINANCE12_ALPHA12 = $8047; - GL_LUMINANCE16_ALPHA16 = $8048; - GL_INTENSITY = $8049; - GL_INTENSITY4 = $804A; - GL_INTENSITY8 = $804B; - GL_INTENSITY12 = $804C; - GL_INTENSITY16 = $804D; - GL_R3_G3_B2 = $2A10; - GL_RGB4 = $804F; - GL_RGB5 = $8050; - GL_RGB8 = $8051; - GL_RGB10 = $8052; - GL_RGB12 = $8053; - GL_RGB16 = $8054; - GL_RGBA2 = $8055; - GL_RGBA4 = $8056; - GL_RGB5_A1 = $8057; - GL_RGBA8 = $8058; - GL_RGB10_A2 = $8059; - GL_RGBA12 = $805A; - GL_RGBA16 = $805B; - GL_TEXTURE_RED_SIZE = $805C; - GL_TEXTURE_GREEN_SIZE = $805D; - GL_TEXTURE_BLUE_SIZE = $805E; - GL_TEXTURE_ALPHA_SIZE = $805F; - GL_TEXTURE_LUMINANCE_SIZE = $8060; - GL_TEXTURE_INTENSITY_SIZE = $8061; - GL_PROXY_TEXTURE_1D = $8063; - GL_PROXY_TEXTURE_2D = $8064; - - // texture_object - GL_TEXTURE_PRIORITY = $8066; - GL_TEXTURE_RESIDENT = $8067; - GL_TEXTURE_BINDING_1D = $8068; - GL_TEXTURE_BINDING_2D = $8069; - - // vertex_array - GL_VERTEX_ARRAY = $8074; - GL_NORMAL_ARRAY = $8075; - GL_COLOR_ARRAY = $8076; - GL_INDEX_ARRAY = $8077; - GL_TEXTURE_COORD_ARRAY = $8078; - GL_EDGE_FLAG_ARRAY = $8079; - GL_VERTEX_ARRAY_SIZE = $807A; - GL_VERTEX_ARRAY_TYPE = $807B; - GL_VERTEX_ARRAY_STRIDE = $807C; - GL_NORMAL_ARRAY_TYPE = $807E; - GL_NORMAL_ARRAY_STRIDE = $807F; - GL_COLOR_ARRAY_SIZE = $8081; - GL_COLOR_ARRAY_TYPE = $8082; - GL_COLOR_ARRAY_STRIDE = $8083; - GL_INDEX_ARRAY_TYPE = $8085; - GL_INDEX_ARRAY_STRIDE = $8086; - GL_TEXTURE_COORD_ARRAY_SIZE = $8088; - GL_TEXTURE_COORD_ARRAY_TYPE = $8089; - GL_TEXTURE_COORD_ARRAY_STRIDE = $808A; - GL_EDGE_FLAG_ARRAY_STRIDE = $808C; - GL_VERTEX_ARRAY_POINTER = $808E; - GL_NORMAL_ARRAY_POINTER = $808F; - GL_COLOR_ARRAY_POINTER = $8090; - GL_INDEX_ARRAY_POINTER = $8091; - GL_TEXTURE_COORD_ARRAY_POINTER = $8092; - GL_EDGE_FLAG_ARRAY_POINTER = $8093; - GL_V2F = $2A20; - GL_V3F = $2A21; - GL_C4UB_V2F = $2A22; - GL_C4UB_V3F = $2A23; - GL_C3F_V3F = $2A24; - GL_N3F_V3F = $2A25; - GL_C4F_N3F_V3F = $2A26; - GL_T2F_V3F = $2A27; - GL_T4F_V4F = $2A28; - GL_T2F_C4UB_V3F = $2A29; - GL_T2F_C3F_V3F = $2A2A; - GL_T2F_N3F_V3F = $2A2B; - GL_T2F_C4F_N3F_V3F = $2A2C; - GL_T4F_C4F_N3F_V4F = $2A2D; - - // Extensions - GL_EXT_vertex_array = 1; - GL_WIN_swap_hint = 1; - GL_EXT_bgra = 1; - GL_EXT_paletted_texture = 1; - - // EXT_vertex_array - GL_VERTEX_ARRAY_EXT = $8074; - GL_NORMAL_ARRAY_EXT = $8075; - GL_COLOR_ARRAY_EXT = $8076; - GL_INDEX_ARRAY_EXT = $8077; - GL_TEXTURE_COORD_ARRAY_EXT = $8078; - GL_EDGE_FLAG_ARRAY_EXT = $8079; - GL_VERTEX_ARRAY_SIZE_EXT = $807A; - GL_VERTEX_ARRAY_TYPE_EXT = $807B; - GL_VERTEX_ARRAY_STRIDE_EXT = $807C; - GL_VERTEX_ARRAY_COUNT_EXT = $807D; - GL_NORMAL_ARRAY_TYPE_EXT = $807E; - GL_NORMAL_ARRAY_STRIDE_EXT = $807F; - GL_NORMAL_ARRAY_COUNT_EXT = $8080; - GL_COLOR_ARRAY_SIZE_EXT = $8081; - GL_COLOR_ARRAY_TYPE_EXT = $8082; - GL_COLOR_ARRAY_STRIDE_EXT = $8083; - GL_COLOR_ARRAY_COUNT_EXT = $8084; - GL_INDEX_ARRAY_TYPE_EXT = $8085; - GL_INDEX_ARRAY_STRIDE_EXT = $8086; - GL_INDEX_ARRAY_COUNT_EXT = $8087; - GL_TEXTURE_COORD_ARRAY_SIZE_EXT = $8088; - GL_TEXTURE_COORD_ARRAY_TYPE_EXT = $8089; - GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = $808A; - GL_TEXTURE_COORD_ARRAY_COUNT_EXT = $808B; - GL_EDGE_FLAG_ARRAY_STRIDE_EXT = $808C; - GL_EDGE_FLAG_ARRAY_COUNT_EXT = $808D; - GL_VERTEX_ARRAY_POINTER_EXT = $808E; - GL_NORMAL_ARRAY_POINTER_EXT = $808F; - GL_COLOR_ARRAY_POINTER_EXT = $8090; - GL_INDEX_ARRAY_POINTER_EXT = $8091; - GL_TEXTURE_COORD_ARRAY_POINTER_EXT = $8092; - GL_EDGE_FLAG_ARRAY_POINTER_EXT = $8093; - GL_DOUBLE_EXT = GL_DOUBLE; - - // EXT_bgra - GL_BGR_EXT = $80E0; - GL_BGRA_EXT = $80E1; - - // EXT_paletted_texture - - // These must match the GL_COLOR_TABLE_*_SGI enumerants - GL_COLOR_TABLE_FORMAT_EXT = $80D8; - GL_COLOR_TABLE_WIDTH_EXT = $80D9; - GL_COLOR_TABLE_RED_SIZE_EXT = $80DA; - GL_COLOR_TABLE_GREEN_SIZE_EXT = $80DB; - GL_COLOR_TABLE_BLUE_SIZE_EXT = $80DC; - GL_COLOR_TABLE_ALPHA_SIZE_EXT = $80DD; - GL_COLOR_TABLE_LUMINANCE_SIZE_EXT = $80DE; - GL_COLOR_TABLE_INTENSITY_SIZE_EXT = $80DF; - - GL_COLOR_INDEX1_EXT = $80E2; - GL_COLOR_INDEX2_EXT = $80E3; - GL_COLOR_INDEX4_EXT = $80E4; - GL_COLOR_INDEX8_EXT = $80E5; - GL_COLOR_INDEX12_EXT = $80E6; - GL_COLOR_INDEX16_EXT = $80E7; - - // For compatibility with OpenGL v1.0 - GL_LOGIC_OP = GL_INDEX_LOGIC_OP; - GL_TEXTURE_COMPONENTS = GL_TEXTURE_INTERNAL_FORMAT; - -{******************************************************************************} - -var - glAccum: procedure(op: GLenum; value: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glAlphaFunc: procedure(func: GLenum; ref: GLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glAreTexturesResident: function (n: GLsizei; const textures: PGLuint; residences: PGLboolean): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glArrayElement: procedure(i: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBegin: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBindTexture: procedure(target: GLenum; texture: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBitmap: procedure (width, height: GLsizei; xorig, yorig: GLfloat; xmove, ymove: GLfloat; const bitmap: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBlendFunc: procedure(sfactor, dfactor: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCallList: procedure(list: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCallLists: procedure(n: GLsizei; atype: GLenum; const lists: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glClear: procedure(mask: GLbitfield); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glClearAccum: procedure(red, green, blue, alpha: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glClearColor: procedure(red, green, blue, alpha: GLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glClearDepth: procedure(depth: GLclampd); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glClearIndex: procedure(c: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glClearStencil: procedure(s: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glClipPlane: procedure(plane: GLenum; const equation: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3b: procedure(red, green, blue: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3bv: procedure(const v: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3d: procedure(red, green, blue: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3f: procedure(red, green, blue: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3i: procedure(red, green, blue: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3s: procedure(red, green, blue: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3ub: procedure(red, green, blue: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3ubv: procedure(const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3ui: procedure(red, green, blue: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3uiv: procedure(const v: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3us: procedure(red, green, blue: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3usv: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4b: procedure(red, green, blue, alpha: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4bv: procedure(const v: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4d: procedure(red, green, blue, alpha: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4f: procedure(red, green, blue, alpha: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4i: procedure(red, green, blue, alpha: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4s: procedure(red, green, blue, alpha: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4ub: procedure(red, green, blue, alpha: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4ubv: procedure(const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4ui: procedure(red, green, blue, alpha: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4uiv: procedure(const v: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4us: procedure(red, green, blue, alpha: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4usv: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorMask: procedure(red, green, blue, alpha: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorMaterial: procedure(face, mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorPointer: procedure(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyPixels: procedure(x, y: GLint; width, height: GLsizei; atype: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyTexImage1D: procedure (target: GLenum; level: GLint; internalFormat: GLenum; x, y: GLint; width: GLsizei; border: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyTexImage2D: procedure(target: GLenum; level: GLint; internalFormat: GLenum; x, y: GLint; width, height: GLsizei; border: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyTexSubImage1D: procedure(target: GLenum; level, xoffset, x, y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyTexSubImage2D: procedure(target: GLenum; level, xoffset, yoffset, x, y: GLint; width, height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCullFace: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteLists: procedure(list: GLuint; range: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteTextures: procedure(n: GLsizei; const textures: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDepthFunc: procedure(func: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDepthMask: procedure(flag: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDepthRange: procedure(zNear, zFar: GLclampd); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDisable: procedure(cap: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDisableClientState: procedure(aarray: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDrawArrays: procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDrawBuffer: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDrawElements: procedure(mode: GLenum; count: GLsizei; atype: GLenum; const indices: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDrawPixels: procedure(width, height: GLsizei; format, atype: GLenum; const pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEdgeFlag: procedure(flag: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEdgeFlagPointer: procedure(stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEdgeFlagv: procedure(const flag: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEnable: procedure(cap: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEnableClientState: procedure(aarray: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEnd: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEndList: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalCoord1d: procedure(u: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalCoord1dv: procedure(const u: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalCoord1f: procedure(u: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalCoord1fv: procedure(const u: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalCoord2d: procedure(u, v: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalCoord2dv: procedure(const u: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalCoord2f: procedure(u, v: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalCoord2fv: procedure(const u: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalMesh1: procedure(mode: GLenum; i1, i2: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalMesh2: procedure(mode: GLenum; i1, i2, j1, j2: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalPoint1: procedure(i: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalPoint2: procedure(i, j: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFeedbackBuffer: procedure(size: GLsizei; atype: GLenum; buffer: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFinish: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFlush: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFogf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFogfv: procedure(pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFogi: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFogiv: procedure(pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFrontFace: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFrustum: procedure(left, right, bottom, top, zNear, zFar: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGenLists: function(range: GLsizei): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGenTextures: procedure(n: GLsizei; textures: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetBooleanv: procedure(pname: GLenum; params: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetClipPlane: procedure(plane: GLenum; equation: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetDoublev: procedure(pname: GLenum; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetError: function: GLenum; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetFloatv: procedure(pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetIntegerv: procedure(pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetLightfv: procedure(light, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetLightiv: procedure(light, pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMapdv: procedure(target, query: GLenum; v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMapfv: procedure(target, query: GLenum; v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMapiv: procedure(target, query: GLenum; v: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMaterialfv: procedure(face, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMaterialiv: procedure(face, pname: GLenum; params: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetPixelMapfv: procedure(map: GLenum; values: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetPixelMapuiv: procedure(map: GLenum; values: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetPixelMapusv: procedure(map: GLenum; values: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetPointerv: procedure(pname: GLenum; params: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetPolygonStipple: procedure(mask: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetString: function(name: GLenum): PChar; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexEnvfv: procedure(target, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexEnviv: procedure(target, pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexGendv: procedure(coord, pname: GLenum; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexGenfv: procedure(coord, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexGeniv: procedure(coord, pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexImage: procedure(target: GLenum; level: GLint; format: GLenum; atype: GLenum; pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexLevelParameterfv: procedure(target: GLenum; level: GLint; pname: GLenum; params: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexLevelParameteriv: procedure(target: GLenum; level: GLint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexParameterfv: procedure(target, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexParameteriv: procedure(target, pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glHint: procedure(target, mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexMask: procedure(mask: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexPointer: procedure(atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexd: procedure(c: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexdv: procedure(const c: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexf: procedure(c: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexfv: procedure(const c: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexi: procedure(c: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexiv: procedure(const c: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexs: procedure(c: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexsv: procedure(const c: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexub: procedure(c: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexubv: procedure(const c: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glInitNames: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glInterleavedArrays: procedure(format: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsEnabled: function(cap: GLenum): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsList: function(list: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsTexture: function(texture: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLightModelf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLightModelfv: procedure(pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLightModeli: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLightModeliv: procedure(pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLightf: procedure(light, pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLightfv: procedure(light, pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLighti: procedure(light, pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLightiv: procedure(light, pname: GLenum; const params: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLineStipple: procedure(factor: GLint; pattern: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLineWidth: procedure(width: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glListBase: procedure(base: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLoadIdentity: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLoadMatrixd: procedure(const m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLoadMatrixf: procedure(const m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLoadName: procedure(name: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLogicOp: procedure(opcode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMap1d: procedure(target: GLenum; u1, u2: GLdouble; stride, order: GLint; const points: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMap1f: procedure(target: GLenum; u1, u2: GLfloat; stride, order: GLint; const points: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMap2d: procedure(target: GLenum; u1, u2: GLdouble; ustride, uorder: GLint; v1, v2: GLdouble; vstride, vorder: GLint; const points: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMap2f: procedure(target: GLenum; u1, u2: GLfloat; ustride, uorder: GLint; v1, v2: GLfloat; vstride, vorder: GLint; const points: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMapGrid1d: procedure(un: GLint; u1, u2: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMapGrid1f: procedure(un: GLint; u1, u2: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMapGrid2d: procedure(un: GLint; u1, u2: GLdouble; vn: GLint; v1, v2: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMapGrid2f: procedure(un: GLint; u1, u2: GLfloat; vn: GLint; v1, v2: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMaterialf: procedure(face, pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMaterialfv: procedure(face, pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMateriali: procedure(face, pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMaterialiv: procedure(face, pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMatrixMode: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultMatrixd: procedure(const m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultMatrixf: procedure(const m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNewList: procedure(list: GLuint; mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3b: procedure(nx, ny, nz: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3bv: procedure(const v: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3d: procedure(nx, ny, nz: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3f: procedure(nx, ny, nz: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3i: procedure(nx, ny, nz: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3s: procedure(nx, ny, nz: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalPointer: procedure(atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glOrtho: procedure(left, right, bottom, top, zNear, zFar: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPassThrough: procedure(token: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPixelMapfv: procedure(map: GLenum; mapsize: GLsizei; const values: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPixelMapuiv: procedure(map: GLenum; mapsize: GLsizei; const values: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPixelMapusv: procedure(map: GLenum; mapsize: GLsizei; const values: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPixelStoref: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPixelStorei: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPixelTransferf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPixelTransferi: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPixelZoom: procedure(xfactor, yfactor: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPointSize: procedure(size: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPolygonMode: procedure(face, mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPolygonOffset: procedure(factor, units: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPolygonStipple: procedure(const mask: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPopAttrib: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPopClientAttrib: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPopMatrix: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPopName: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPrioritizeTextures: procedure(n: GLsizei; const textures: PGLuint; const priorities: PGLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPushAttrib: procedure(mask: GLbitfield); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPushClientAttrib: procedure(mask: GLbitfield); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPushMatrix: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPushName: procedure(name: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos2d: procedure(x, y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos2dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos2f: procedure(x, y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos2fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos2i: procedure(x, y: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos2iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos2s: procedure(x, y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos2sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos3d: procedure(x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos3dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos3f: procedure(x, y, z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos3fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos3i: procedure(x, y, z: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos3iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos3s: procedure(x, y, z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos3sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos4d: procedure(x, y, z, w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos4dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos4f: procedure(x, y, z, w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos4fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos4i: procedure(x, y, z, w: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos4iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos4s: procedure(x, y, z, w: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos4sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReadBuffer: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReadPixels: procedure(x, y: GLint; width, height: GLsizei; format, atype: GLenum; pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRectd: procedure(x1, y1, x2, y2: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRectdv: procedure(const v1: PGLdouble; const v2: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRectf: procedure(x1, y1, x2, y2: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRectfv: procedure(const v1: PGLfloat; const v2: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRecti: procedure(x1, y1, x2, y2: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRectiv: procedure(const v1: PGLint; const v2: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRects: procedure(x1, y1, x2, y2: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRectsv: procedure(const v1: PGLshort; const v2: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRenderMode: function(mode: GLint): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRotated: procedure(angle, x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRotatef: procedure(angle, x, y, z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glScaled: procedure(x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glScalef: procedure(x, y, z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glScissor: procedure(x, y: GLint; width, height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSelectBuffer: procedure(size: GLsizei; buffer: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glShadeModel: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glStencilFunc: procedure(func: GLenum; ref: GLint; mask: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glStencilMask: procedure(mask: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glStencilOp: procedure(fail, zfail, zpass: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord1d: procedure(s: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord1dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord1f: procedure(s: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord1fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord1i: procedure(s: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord1iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord1s: procedure(s: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord1sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2d: procedure(s, t: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2f: procedure(s, t: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2i: procedure(s, t: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2s: procedure(s, t: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord3d: procedure(s, t, r: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord3dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord3f: procedure(s, t, r: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord3fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord3i: procedure(s, t, r: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord3iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord3s: procedure(s, t, r: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord3sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4d: procedure(s, t, r, q: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4f: procedure(s, t, r, q: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4i: procedure(s, t, r, q: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4s: procedure(s, t, r, q: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoordPointer: procedure(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexEnvf: procedure(target: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexEnvfv: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexEnvi: procedure(target: GLenum; pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexEnviv: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexGend: procedure(coord: GLenum; pname: GLenum; param: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexGendv: procedure(coord: GLenum; pname: GLenum; const params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexGenf: procedure(coord: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexGenfv: procedure(coord: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexGeni: procedure(coord: GLenum; pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexGeniv: procedure(coord: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexImage1D: procedure(target: GLenum; level, internalformat: GLint; width: GLsizei; border: GLint; format, atype: GLenum; const pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexImage2D: procedure(target: GLenum; level, internalformat: GLint; width, height: GLsizei; border: GLint; format, atype: GLenum; const pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexParameterf: procedure(target: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexParameterfv: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexParameteri: procedure(target: GLenum; pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexParameteriv: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexSubImage1D: procedure(target: GLenum; level, xoffset: GLint; width: GLsizei; format, atype: GLenum; const pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexSubImage2D: procedure(target: GLenum; level, xoffset, yoffset: GLint; width, height: GLsizei; format, atype: GLenum; const pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTranslated: procedure(x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTranslatef: procedure(x, y, z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex2d: procedure(x, y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex2dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex2f: procedure(x, y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex2fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex2i: procedure(x, y: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex2iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex2s: procedure(x, y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex2sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex3d: procedure(x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex3dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex3f: procedure(x, y, z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex3fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex3i: procedure(x, y, z: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex3iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex3s: procedure(x, y, z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex3sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex4d: procedure(x, y, z, w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex4dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex4f: procedure(x, y, z, w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex4fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex4i: procedure(x, y, z, w: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex4iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex4s: procedure(x, y, z, w: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex4sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexPointer: procedure(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glViewport: procedure(x, y: GLint; width, height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - {$IFDEF Win32} - ChoosePixelFormat: function(DC: HDC; p2: PPixelFormatDescriptor): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - {$ENDIF} - -type - // EXT_vertex_array - PFNGLARRAYELEMENTEXTPROC = procedure(i: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - PFNGLDRAWARRAYSEXTPROC = procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - PFNGLVERTEXPOINTEREXTPROC = procedure(size: GLint; atype: GLenum; - stride, count: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - PFNGLNORMALPOINTEREXTPROC = procedure(atype: GLenum; stride, count: GLsizei; - const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - PFNGLCOLORPOINTEREXTPROC = procedure(size: GLint; atype: GLenum; stride, count: GLsizei; - const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - PFNGLINDEXPOINTEREXTPROC = procedure(atype: GLenum; stride, count: GLsizei; - const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - PFNGLTEXCOORDPOINTEREXTPROC = procedure(size: GLint; atype: GLenum; - stride, count: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - PFNGLEDGEFLAGPOINTEREXTPROC = procedure(stride, count: GLsizei; - const pointer: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - PFNGLGETPOINTERVEXTPROC = procedure(pname: GLenum; params: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - PFNGLARRAYELEMENTARRAYEXTPROC = procedure(mode: GLenum; count: GLsizei; - const pi: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - - // WIN_swap_hint - PFNGLADDSWAPHINTRECTWINPROC = procedure(x, y: GLint; width, height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - - // EXT_paletted_texture - PFNGLCOLORTABLEEXTPROC = procedure(target, internalFormat: GLenum; width: GLsizei; - format, atype: GLenum; const data: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - PFNGLCOLORSUBTABLEEXTPROC = procedure(target: GLenum; start, count: GLsizei; - format, atype: GLenum; const data: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - PFNGLGETCOLORTABLEEXTPROC = procedure(target, format, atype: GLenum; data: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - PFNGLGETCOLORTABLEPARAMETERIVEXTPROC = procedure(target, pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - PFNGLGETCOLORTABLEPARAMETERFVEXTPROC = procedure(target, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -procedure LoadOpenGL( const dll: PChar ); -procedure FreeOpenGL; - -implementation - -procedure FreeOpenGL; -begin - - @glAccum := nil; - @glAlphaFunc := nil; - @glAreTexturesResident := nil; - @glArrayElement := nil; - @glBegin := nil; - @glBindTexture := nil; - @glBitmap := nil; - @glBlendFunc := nil; - @glCallList := nil; - @glCallLists := nil; - @glClear := nil; - @glClearAccum := nil; - @glClearColor := nil; - @glClearDepth := nil; - @glClearIndex := nil; - @glClearStencil := nil; - @glClipPlane := nil; - @glColor3b := nil; - @glColor3bv := nil; - @glColor3d := nil; - @glColor3dv := nil; - @glColor3f := nil; - @glColor3fv := nil; - @glColor3i := nil; - @glColor3iv := nil; - @glColor3s := nil; - @glColor3sv := nil; - @glColor3ub := nil; - @glColor3ubv := nil; - @glColor3ui := nil; - @glColor3uiv := nil; - @glColor3us := nil; - @glColor3usv := nil; - @glColor4b := nil; - @glColor4bv := nil; - @glColor4d := nil; - @glColor4dv := nil; - @glColor4f := nil; - @glColor4fv := nil; - @glColor4i := nil; - @glColor4iv := nil; - @glColor4s := nil; - @glColor4sv := nil; - @glColor4ub := nil; - @glColor4ubv := nil; - @glColor4ui := nil; - @glColor4uiv := nil; - @glColor4us := nil; - @glColor4usv := nil; - @glColorMask := nil; - @glColorMaterial := nil; - @glColorPointer := nil; - @glCopyPixels := nil; - @glCopyTexImage1D := nil; - @glCopyTexImage2D := nil; - @glCopyTexSubImage1D := nil; - @glCopyTexSubImage2D := nil; - @glCullFace := nil; - @glDeleteLists := nil; - @glDeleteTextures := nil; - @glDepthFunc := nil; - @glDepthMask := nil; - @glDepthRange := nil; - @glDisable := nil; - @glDisableClientState := nil; - @glDrawArrays := nil; - @glDrawBuffer := nil; - @glDrawElements := nil; - @glDrawPixels := nil; - @glEdgeFlag := nil; - @glEdgeFlagPointer := nil; - @glEdgeFlagv := nil; - @glEnable := nil; - @glEnableClientState := nil; - @glEnd := nil; - @glEndList := nil; - @glEvalCoord1d := nil; - @glEvalCoord1dv := nil; - @glEvalCoord1f := nil; - @glEvalCoord1fv := nil; - @glEvalCoord2d := nil; - @glEvalCoord2dv := nil; - @glEvalCoord2f := nil; - @glEvalCoord2fv := nil; - @glEvalMesh1 := nil; - @glEvalMesh2 := nil; - @glEvalPoint1 := nil; - @glEvalPoint2 := nil; - @glFeedbackBuffer := nil; - @glFinish := nil; - @glFlush := nil; - @glFogf := nil; - @glFogfv := nil; - @glFogi := nil; - @glFogiv := nil; - @glFrontFace := nil; - @glFrustum := nil; - @glGenLists := nil; - @glGenTextures := nil; - @glGetBooleanv := nil; - @glGetClipPlane := nil; - @glGetDoublev := nil; - @glGetError := nil; - @glGetFloatv := nil; - @glGetIntegerv := nil; - @glGetLightfv := nil; - @glGetLightiv := nil; - @glGetMapdv := nil; - @glGetMapfv := nil; - @glGetMapiv := nil; - @glGetMaterialfv := nil; - @glGetMaterialiv := nil; - @glGetPixelMapfv := nil; - @glGetPixelMapuiv := nil; - @glGetPixelMapusv := nil; - @glGetPointerv := nil; - @glGetPolygonStipple := nil; - @glGetString := nil; - @glGetTexEnvfv := nil; - @glGetTexEnviv := nil; - @glGetTexGendv := nil; - @glGetTexGenfv := nil; - @glGetTexGeniv := nil; - @glGetTexImage := nil; - @glGetTexLevelParameterfv := nil; - @glGetTexLevelParameteriv := nil; - @glGetTexParameterfv := nil; - @glGetTexParameteriv := nil; - @glHint := nil; - @glIndexMask := nil; - @glIndexPointer := nil; - @glIndexd := nil; - @glIndexdv := nil; - @glIndexf := nil; - @glIndexfv := nil; - @glIndexi := nil; - @glIndexiv := nil; - @glIndexs := nil; - @glIndexsv := nil; - @glIndexub := nil; - @glIndexubv := nil; - @glInitNames := nil; - @glInterleavedArrays := nil; - @glIsEnabled := nil; - @glIsList := nil; - @glIsTexture := nil; - @glLightModelf := nil; - @glLightModelfv := nil; - @glLightModeli := nil; - @glLightModeliv := nil; - @glLightf := nil; - @glLightfv := nil; - @glLighti := nil; - @glLightiv := nil; - @glLineStipple := nil; - @glLineWidth := nil; - @glListBase := nil; - @glLoadIdentity := nil; - @glLoadMatrixd := nil; - @glLoadMatrixf := nil; - @glLoadName := nil; - @glLogicOp := nil; - @glMap1d := nil; - @glMap1f := nil; - @glMap2d := nil; - @glMap2f := nil; - @glMapGrid1d := nil; - @glMapGrid1f := nil; - @glMapGrid2d := nil; - @glMapGrid2f := nil; - @glMaterialf := nil; - @glMaterialfv := nil; - @glMateriali := nil; - @glMaterialiv := nil; - @glMatrixMode := nil; - @glMultMatrixd := nil; - @glMultMatrixf := nil; - @glNewList := nil; - @glNormal3b := nil; - @glNormal3bv := nil; - @glNormal3d := nil; - @glNormal3dv := nil; - @glNormal3f := nil; - @glNormal3fv := nil; - @glNormal3i := nil; - @glNormal3iv := nil; - @glNormal3s := nil; - @glNormal3sv := nil; - @glNormalPointer := nil; - @glOrtho := nil; - @glPassThrough := nil; - @glPixelMapfv := nil; - @glPixelMapuiv := nil; - @glPixelMapusv := nil; - @glPixelStoref := nil; - @glPixelStorei := nil; - @glPixelTransferf := nil; - @glPixelTransferi := nil; - @glPixelZoom := nil; - @glPointSize := nil; - @glPolygonMode := nil; - @glPolygonOffset := nil; - @glPolygonStipple := nil; - @glPopAttrib := nil; - @glPopClientAttrib := nil; - @glPopMatrix := nil; - @glPopName := nil; - @glPrioritizeTextures := nil; - @glPushAttrib := nil; - @glPushClientAttrib := nil; - @glPushMatrix := nil; - @glPushName := nil; - @glRasterPos2d := nil; - @glRasterPos2dv := nil; - @glRasterPos2f := nil; - @glRasterPos2fv := nil; - @glRasterPos2i := nil; - @glRasterPos2iv := nil; - @glRasterPos2s := nil; - @glRasterPos2sv := nil; - @glRasterPos3d := nil; - @glRasterPos3dv := nil; - @glRasterPos3f := nil; - @glRasterPos3fv := nil; - @glRasterPos3i := nil; - @glRasterPos3iv := nil; - @glRasterPos3s := nil; - @glRasterPos3sv := nil; - @glRasterPos4d := nil; - @glRasterPos4dv := nil; - @glRasterPos4f := nil; - @glRasterPos4fv := nil; - @glRasterPos4i := nil; - @glRasterPos4iv := nil; - @glRasterPos4s := nil; - @glRasterPos4sv := nil; - @glReadBuffer := nil; - @glReadPixels := nil; - @glRectd := nil; - @glRectdv := nil; - @glRectf := nil; - @glRectfv := nil; - @glRecti := nil; - @glRectiv := nil; - @glRects := nil; - @glRectsv := nil; - @glRenderMode := nil; - @glRotated := nil; - @glRotatef := nil; - @glScaled := nil; - @glScalef := nil; - @glScissor := nil; - @glSelectBuffer := nil; - @glShadeModel := nil; - @glStencilFunc := nil; - @glStencilMask := nil; - @glStencilOp := nil; - @glTexCoord1d := nil; - @glTexCoord1dv := nil; - @glTexCoord1f := nil; - @glTexCoord1fv := nil; - @glTexCoord1i := nil; - @glTexCoord1iv := nil; - @glTexCoord1s := nil; - @glTexCoord1sv := nil; - @glTexCoord2d := nil; - @glTexCoord2dv := nil; - @glTexCoord2f := nil; - @glTexCoord2fv := nil; - @glTexCoord2i := nil; - @glTexCoord2iv := nil; - @glTexCoord2s := nil; - @glTexCoord2sv := nil; - @glTexCoord3d := nil; - @glTexCoord3dv := nil; - @glTexCoord3f := nil; - @glTexCoord3fv := nil; - @glTexCoord3i := nil; - @glTexCoord3iv := nil; - @glTexCoord3s := nil; - @glTexCoord3sv := nil; - @glTexCoord4d := nil; - @glTexCoord4dv := nil; - @glTexCoord4f := nil; - @glTexCoord4fv := nil; - @glTexCoord4i := nil; - @glTexCoord4iv := nil; - @glTexCoord4s := nil; - @glTexCoord4sv := nil; - @glTexCoordPointer := nil; - @glTexEnvf := nil; - @glTexEnvfv := nil; - @glTexEnvi := nil; - @glTexEnviv := nil; - @glTexGend := nil; - @glTexGendv := nil; - @glTexGenf := nil; - @glTexGenfv := nil; - @glTexGeni := nil; - @glTexGeniv := nil; - @glTexImage1D := nil; - @glTexImage2D := nil; - @glTexParameterf := nil; - @glTexParameterfv := nil; - @glTexParameteri := nil; - @glTexParameteriv := nil; - @glTexSubImage1D := nil; - @glTexSubImage2D := nil; - @glTranslated := nil; - @glTranslatef := nil; - @glVertex2d := nil; - @glVertex2dv := nil; - @glVertex2f := nil; - @glVertex2fv := nil; - @glVertex2i := nil; - @glVertex2iv := nil; - @glVertex2s := nil; - @glVertex2sv := nil; - @glVertex3d := nil; - @glVertex3dv := nil; - @glVertex3f := nil; - @glVertex3fv := nil; - @glVertex3i := nil; - @glVertex3iv := nil; - @glVertex3s := nil; - @glVertex3sv := nil; - @glVertex4d := nil; - @glVertex4dv := nil; - @glVertex4f := nil; - @glVertex4fv := nil; - @glVertex4i := nil; - @glVertex4iv := nil; - @glVertex4s := nil; - @glVertex4sv := nil; - @glVertexPointer := nil; - @glViewport := nil; - {$IFDEF Win32} - @ChoosePixelFormat := nil; - {$ENDIF} - - UnLoadModule(LibGL); - -end; - -procedure LoadOpenGL(const dll: PChar); -begin - - FreeOpenGL; - - if LoadModule( LibGL, dll ) then - begin - @glAccum := GetModuleSymbol(LibGL, 'glAccum'); - @glAlphaFunc := GetModuleSymbol(LibGL, 'glAlphaFunc'); - @glAreTexturesResident := GetModuleSymbol(LibGL, 'glAreTexturesResident'); - @glArrayElement := GetModuleSymbol(LibGL, 'glArrayElement'); - @glBegin := GetModuleSymbol(LibGL, 'glBegin'); - @glBindTexture := GetModuleSymbol(LibGL, 'glBindTexture'); - @glBitmap := GetModuleSymbol(LibGL, 'glBitmap'); - @glBlendFunc := GetModuleSymbol(LibGL, 'glBlendFunc'); - @glCallList := GetModuleSymbol(LibGL, 'glCallList'); - @glCallLists := GetModuleSymbol(LibGL, 'glCallLists'); - @glClear := GetModuleSymbol(LibGL, 'glClear'); - @glClearAccum := GetModuleSymbol(LibGL, 'glClearAccum'); - @glClearColor := GetModuleSymbol(LibGL, 'glClearColor'); - @glClearDepth := GetModuleSymbol(LibGL, 'glClearDepth'); - @glClearIndex := GetModuleSymbol(LibGL, 'glClearIndex'); - @glClearStencil := GetModuleSymbol(LibGL, 'glClearStencil'); - @glClipPlane := GetModuleSymbol(LibGL, 'glClipPlane'); - @glColor3b := GetModuleSymbol(LibGL, 'glColor3b'); - @glColor3bv := GetModuleSymbol(LibGL, 'glColor3bv'); - @glColor3d := GetModuleSymbol(LibGL, 'glColor3d'); - @glColor3dv := GetModuleSymbol(LibGL, 'glColor3dv'); - @glColor3f := GetModuleSymbol(LibGL, 'glColor3f'); - @glColor3fv := GetModuleSymbol(LibGL, 'glColor3fv'); - @glColor3i := GetModuleSymbol(LibGL, 'glColor3i'); - @glColor3iv := GetModuleSymbol(LibGL, 'glColor3iv'); - @glColor3s := GetModuleSymbol(LibGL, 'glColor3s'); - @glColor3sv := GetModuleSymbol(LibGL, 'glColor3sv'); - @glColor3ub := GetModuleSymbol(LibGL, 'glColor3ub'); - @glColor3ubv := GetModuleSymbol(LibGL, 'glColor3ubv'); - @glColor3ui := GetModuleSymbol(LibGL, 'glColor3ui'); - @glColor3uiv := GetModuleSymbol(LibGL, 'glColor3uiv'); - @glColor3us := GetModuleSymbol(LibGL, 'glColor3us'); - @glColor3usv := GetModuleSymbol(LibGL, 'glColor3usv'); - @glColor4b := GetModuleSymbol(LibGL, 'glColor4b'); - @glColor4bv := GetModuleSymbol(LibGL, 'glColor4bv'); - @glColor4d := GetModuleSymbol(LibGL, 'glColor4d'); - @glColor4dv := GetModuleSymbol(LibGL, 'glColor4dv'); - @glColor4f := GetModuleSymbol(LibGL, 'glColor4f'); - @glColor4fv := GetModuleSymbol(LibGL, 'glColor4fv'); - @glColor4i := GetModuleSymbol(LibGL, 'glColor4i'); - @glColor4iv := GetModuleSymbol(LibGL, 'glColor4iv'); - @glColor4s := GetModuleSymbol(LibGL, 'glColor4s'); - @glColor4sv := GetModuleSymbol(LibGL, 'glColor4sv'); - @glColor4ub := GetModuleSymbol(LibGL, 'glColor4ub'); - @glColor4ubv := GetModuleSymbol(LibGL, 'glColor4ubv'); - @glColor4ui := GetModuleSymbol(LibGL, 'glColor4ui'); - @glColor4uiv := GetModuleSymbol(LibGL, 'glColor4uiv'); - @glColor4us := GetModuleSymbol(LibGL, 'glColor4us'); - @glColor4usv := GetModuleSymbol(LibGL, 'glColor4usv'); - @glColorMask := GetModuleSymbol(LibGL, 'glColorMask'); - @glColorMaterial := GetModuleSymbol(LibGL, 'glColorMaterial'); - @glColorPointer := GetModuleSymbol(LibGL, 'glColorPointer'); - @glCopyPixels := GetModuleSymbol(LibGL, 'glCopyPixels'); - @glCopyTexImage1D := GetModuleSymbol(LibGL, 'glCopyTexImage1D'); - @glCopyTexImage2D := GetModuleSymbol(LibGL, 'glCopyTexImage2D'); - @glCopyTexSubImage1D := GetModuleSymbol(LibGL, 'glCopyTexSubImage1D'); - @glCopyTexSubImage2D := GetModuleSymbol(LibGL, 'glCopyTexSubImage2D'); - @glCullFace := GetModuleSymbol(LibGL, 'glCullFace'); - @glDeleteLists := GetModuleSymbol(LibGL, 'glDeleteLists'); - @glDeleteTextures := GetModuleSymbol(LibGL, 'glDeleteTextures'); - @glDepthFunc := GetModuleSymbol(LibGL, 'glDepthFunc'); - @glDepthMask := GetModuleSymbol(LibGL, 'glDepthMask'); - @glDepthRange := GetModuleSymbol(LibGL, 'glDepthRange'); - @glDisable := GetModuleSymbol(LibGL, 'glDisable'); - @glDisableClientState := GetModuleSymbol(LibGL, 'glDisableClientState'); - @glDrawArrays := GetModuleSymbol(LibGL, 'glDrawArrays'); - @glDrawBuffer := GetModuleSymbol(LibGL, 'glDrawBuffer'); - @glDrawElements := GetModuleSymbol(LibGL, 'glDrawElements'); - @glDrawPixels := GetModuleSymbol(LibGL, 'glDrawPixels'); - @glEdgeFlag := GetModuleSymbol(LibGL, 'glEdgeFlag'); - @glEdgeFlagPointer := GetModuleSymbol(LibGL, 'glEdgeFlagPointer'); - @glEdgeFlagv := GetModuleSymbol(LibGL, 'glEdgeFlagv'); - @glEnable := GetModuleSymbol(LibGL, 'glEnable'); - @glEnableClientState := GetModuleSymbol(LibGL, 'glEnableClientState'); - @glEnd := GetModuleSymbol(LibGL, 'glEnd'); - @glEndList := GetModuleSymbol(LibGL, 'glEndList'); - @glEvalCoord1d := GetModuleSymbol(LibGL, 'glEvalCoord1d'); - @glEvalCoord1dv := GetModuleSymbol(LibGL, 'glEvalCoord1dv'); - @glEvalCoord1f := GetModuleSymbol(LibGL, 'glEvalCoord1f'); - @glEvalCoord1fv := GetModuleSymbol(LibGL, 'glEvalCoord1fv'); - @glEvalCoord2d := GetModuleSymbol(LibGL, 'glEvalCoord2d'); - @glEvalCoord2dv := GetModuleSymbol(LibGL, 'glEvalCoord2dv'); - @glEvalCoord2f := GetModuleSymbol(LibGL, 'glEvalCoord2f'); - @glEvalCoord2fv := GetModuleSymbol(LibGL, 'glEvalCoord2fv'); - @glEvalMesh1 := GetModuleSymbol(LibGL, 'glEvalMesh1'); - @glEvalMesh2 := GetModuleSymbol(LibGL, 'glEvalMesh2'); - @glEvalPoint1 := GetModuleSymbol(LibGL, 'glEvalPoint1'); - @glEvalPoint2 := GetModuleSymbol(LibGL, 'glEvalPoint2'); - @glFeedbackBuffer := GetModuleSymbol(LibGL, 'glFeedbackBuffer'); - @glFinish := GetModuleSymbol(LibGL, 'glFinish'); - @glFlush := GetModuleSymbol(LibGL, 'glFlush'); - @glFogf := GetModuleSymbol(LibGL, 'glFogf'); - @glFogfv := GetModuleSymbol(LibGL, 'glFogfv'); - @glFogi := GetModuleSymbol(LibGL, 'glFogi'); - @glFogiv := GetModuleSymbol(LibGL, 'glFogiv'); - @glFrontFace := GetModuleSymbol(LibGL, 'glFrontFace'); - @glFrustum := GetModuleSymbol(LibGL, 'glFrustum'); - @glGenLists := GetModuleSymbol(LibGL, 'glGenLists'); - @glGenTextures := GetModuleSymbol(LibGL, 'glGenTextures'); - @glGetBooleanv := GetModuleSymbol(LibGL, 'glGetBooleanv'); - @glGetClipPlane := GetModuleSymbol(LibGL, 'glGetClipPlane'); - @glGetDoublev := GetModuleSymbol(LibGL, 'glGetDoublev'); - @glGetError := GetModuleSymbol(LibGL, 'glGetError'); - @glGetFloatv := GetModuleSymbol(LibGL, 'glGetFloatv'); - @glGetIntegerv := GetModuleSymbol(LibGL, 'glGetIntegerv'); - @glGetLightfv := GetModuleSymbol(LibGL, 'glGetLightfv'); - @glGetLightiv := GetModuleSymbol(LibGL, 'glGetLightiv'); - @glGetMapdv := GetModuleSymbol(LibGL, 'glGetMapdv'); - @glGetMapfv := GetModuleSymbol(LibGL, 'glGetMapfv'); - @glGetMapiv := GetModuleSymbol(LibGL, 'glGetMapiv'); - @glGetMaterialfv := GetModuleSymbol(LibGL, 'glGetMaterialfv'); - @glGetMaterialiv := GetModuleSymbol(LibGL, 'glGetMaterialiv'); - @glGetPixelMapfv := GetModuleSymbol(LibGL, 'glGetPixelMapfv'); - @glGetPixelMapuiv := GetModuleSymbol(LibGL, 'glGetPixelMapuiv'); - @glGetPixelMapusv := GetModuleSymbol(LibGL, 'glGetPixelMapusv'); - @glGetPointerv := GetModuleSymbol(LibGL, 'glGetPointerv'); - @glGetPolygonStipple := GetModuleSymbol(LibGL, 'glGetPolygonStipple'); - @glGetString := GetModuleSymbol(LibGL, 'glGetString'); - @glGetTexEnvfv := GetModuleSymbol(LibGL, 'glGetTexEnvfv'); - @glGetTexEnviv := GetModuleSymbol(LibGL, 'glGetTexEnviv'); - @glGetTexGendv := GetModuleSymbol(LibGL, 'glGetTexGendv'); - @glGetTexGenfv := GetModuleSymbol(LibGL, 'glGetTexGenfv'); - @glGetTexGeniv := GetModuleSymbol(LibGL, 'glGetTexGeniv'); - @glGetTexImage := GetModuleSymbol(LibGL, 'glGetTexImage'); - @glGetTexLevelParameterfv := GetModuleSymbol(LibGL, 'glGetTexLevelParameterfv'); - @glGetTexLevelParameteriv := GetModuleSymbol(LibGL, 'glGetTexLevelParameteriv'); - @glGetTexParameterfv := GetModuleSymbol(LibGL, 'glGetTexParameterfv'); - @glGetTexParameteriv := GetModuleSymbol(LibGL, 'glGetTexParameteriv'); - @glHint := GetModuleSymbol(LibGL, 'glHint'); - @glIndexMask := GetModuleSymbol(LibGL, 'glIndexMask'); - @glIndexPointer := GetModuleSymbol(LibGL, 'glIndexPointer'); - @glIndexd := GetModuleSymbol(LibGL, 'glIndexd'); - @glIndexdv := GetModuleSymbol(LibGL, 'glIndexdv'); - @glIndexf := GetModuleSymbol(LibGL, 'glIndexf'); - @glIndexfv := GetModuleSymbol(LibGL, 'glIndexfv'); - @glIndexi := GetModuleSymbol(LibGL, 'glIndexi'); - @glIndexiv := GetModuleSymbol(LibGL, 'glIndexiv'); - @glIndexs := GetModuleSymbol(LibGL, 'glIndexs'); - @glIndexsv := GetModuleSymbol(LibGL, 'glIndexsv'); - @glIndexub := GetModuleSymbol(LibGL, 'glIndexub'); - @glIndexubv := GetModuleSymbol(LibGL, 'glIndexubv'); - @glInitNames := GetModuleSymbol(LibGL, 'glInitNames'); - @glInterleavedArrays := GetModuleSymbol(LibGL, 'glInterleavedArrays'); - @glIsEnabled := GetModuleSymbol(LibGL, 'glIsEnabled'); - @glIsList := GetModuleSymbol(LibGL, 'glIsList'); - @glIsTexture := GetModuleSymbol(LibGL, 'glIsTexture'); - @glLightModelf := GetModuleSymbol(LibGL, 'glLightModelf'); - @glLightModelfv := GetModuleSymbol(LibGL, 'glLightModelfv'); - @glLightModeli := GetModuleSymbol(LibGL, 'glLightModeli'); - @glLightModeliv := GetModuleSymbol(LibGL, 'glLightModeliv'); - @glLightf := GetModuleSymbol(LibGL, 'glLightf'); - @glLightfv := GetModuleSymbol(LibGL, 'glLightfv'); - @glLighti := GetModuleSymbol(LibGL, 'glLighti'); - @glLightiv := GetModuleSymbol(LibGL, 'glLightiv'); - @glLineStipple := GetModuleSymbol(LibGL, 'glLineStipple'); - @glLineWidth := GetModuleSymbol(LibGL, 'glLineWidth'); - @glListBase := GetModuleSymbol(LibGL, 'glListBase'); - @glLoadIdentity := GetModuleSymbol(LibGL, 'glLoadIdentity'); - @glLoadMatrixd := GetModuleSymbol(LibGL, 'glLoadMatrixd'); - @glLoadMatrixf := GetModuleSymbol(LibGL, 'glLoadMatrixf'); - @glLoadName := GetModuleSymbol(LibGL, 'glLoadName'); - @glLogicOp := GetModuleSymbol(LibGL, 'glLogicOp'); - @glMap1d := GetModuleSymbol(LibGL, 'glMap1d'); - @glMap1f := GetModuleSymbol(LibGL, 'glMap1f'); - @glMap2d := GetModuleSymbol(LibGL, 'glMap2d'); - @glMap2f := GetModuleSymbol(LibGL, 'glMap2f'); - @glMapGrid1d := GetModuleSymbol(LibGL, 'glMapGrid1d'); - @glMapGrid1f := GetModuleSymbol(LibGL, 'glMapGrid1f'); - @glMapGrid2d := GetModuleSymbol(LibGL, 'glMapGrid2d'); - @glMapGrid2f := GetModuleSymbol(LibGL, 'glMapGrid2f'); - @glMaterialf := GetModuleSymbol(LibGL, 'glMaterialf'); - @glMaterialfv := GetModuleSymbol(LibGL, 'glMaterialfv'); - @glMateriali := GetModuleSymbol(LibGL, 'glMateriali'); - @glMaterialiv := GetModuleSymbol(LibGL, 'glMaterialiv'); - @glMatrixMode := GetModuleSymbol(LibGL, 'glMatrixMode'); - @glMultMatrixd := GetModuleSymbol(LibGL, 'glMultMatrixd'); - @glMultMatrixf := GetModuleSymbol(LibGL, 'glMultMatrixf'); - @glNewList := GetModuleSymbol(LibGL, 'glNewList'); - @glNormal3b := GetModuleSymbol(LibGL, 'glNormal3b'); - @glNormal3bv := GetModuleSymbol(LibGL, 'glNormal3bv'); - @glNormal3d := GetModuleSymbol(LibGL, 'glNormal3d'); - @glNormal3dv := GetModuleSymbol(LibGL, 'glNormal3dv'); - @glNormal3f := GetModuleSymbol(LibGL, 'glNormal3f'); - @glNormal3fv := GetModuleSymbol(LibGL, 'glNormal3fv'); - @glNormal3i := GetModuleSymbol(LibGL, 'glNormal3i'); - @glNormal3iv := GetModuleSymbol(LibGL, 'glNormal3iv'); - @glNormal3s := GetModuleSymbol(LibGL, 'glNormal3s'); - @glNormal3sv := GetModuleSymbol(LibGL, 'glNormal3sv'); - @glNormalPointer := GetModuleSymbol(LibGL, 'glNormalPointer'); - @glOrtho := GetModuleSymbol(LibGL, 'glOrtho'); - @glPassThrough := GetModuleSymbol(LibGL, 'glPassThrough'); - @glPixelMapfv := GetModuleSymbol(LibGL, 'glPixelMapfv'); - @glPixelMapuiv := GetModuleSymbol(LibGL, 'glPixelMapuiv'); - @glPixelMapusv := GetModuleSymbol(LibGL, 'glPixelMapusv'); - @glPixelStoref := GetModuleSymbol(LibGL, 'glPixelStoref'); - @glPixelStorei := GetModuleSymbol(LibGL, 'glPixelStorei'); - @glPixelTransferf := GetModuleSymbol(LibGL, 'glPixelTransferf'); - @glPixelTransferi := GetModuleSymbol(LibGL, 'glPixelTransferi'); - @glPixelZoom := GetModuleSymbol(LibGL, 'glPixelZoom'); - @glPointSize := GetModuleSymbol(LibGL, 'glPointSize'); - @glPolygonMode := GetModuleSymbol(LibGL, 'glPolygonMode'); - @glPolygonOffset := GetModuleSymbol(LibGL, 'glPolygonOffset'); - @glPolygonStipple := GetModuleSymbol(LibGL, 'glPolygonStipple'); - @glPopAttrib := GetModuleSymbol(LibGL, 'glPopAttrib'); - @glPopClientAttrib := GetModuleSymbol(LibGL, 'glPopClientAttrib'); - @glPopMatrix := GetModuleSymbol(LibGL, 'glPopMatrix'); - @glPopName := GetModuleSymbol(LibGL, 'glPopName'); - @glPrioritizeTextures := GetModuleSymbol(LibGL, 'glPrioritizeTextures'); - @glPushAttrib := GetModuleSymbol(LibGL, 'glPushAttrib'); - @glPushClientAttrib := GetModuleSymbol(LibGL, 'glPushClientAttrib'); - @glPushMatrix := GetModuleSymbol(LibGL, 'glPushMatrix'); - @glPushName := GetModuleSymbol(LibGL, 'glPushName'); - @glRasterPos2d := GetModuleSymbol(LibGL, 'glRasterPos2d'); - @glRasterPos2dv := GetModuleSymbol(LibGL, 'glRasterPos2dv'); - @glRasterPos2f := GetModuleSymbol(LibGL, 'glRasterPos2f'); - @glRasterPos2fv := GetModuleSymbol(LibGL, 'glRasterPos2fv'); - @glRasterPos2i := GetModuleSymbol(LibGL, 'glRasterPos2i'); - @glRasterPos2iv := GetModuleSymbol(LibGL, 'glRasterPos2iv'); - @glRasterPos2s := GetModuleSymbol(LibGL, 'glRasterPos2s'); - @glRasterPos2sv := GetModuleSymbol(LibGL, 'glRasterPos2sv'); - @glRasterPos3d := GetModuleSymbol(LibGL, 'glRasterPos3d'); - @glRasterPos3dv := GetModuleSymbol(LibGL, 'glRasterPos3dv'); - @glRasterPos3f := GetModuleSymbol(LibGL, 'glRasterPos3f'); - @glRasterPos3fv := GetModuleSymbol(LibGL, 'glRasterPos3fv'); - @glRasterPos3i := GetModuleSymbol(LibGL, 'glRasterPos3i'); - @glRasterPos3iv := GetModuleSymbol(LibGL, 'glRasterPos3iv'); - @glRasterPos3s := GetModuleSymbol(LibGL, 'glRasterPos3s'); - @glRasterPos3sv := GetModuleSymbol(LibGL, 'glRasterPos3sv'); - @glRasterPos4d := GetModuleSymbol(LibGL, 'glRasterPos4d'); - @glRasterPos4dv := GetModuleSymbol(LibGL, 'glRasterPos4dv'); - @glRasterPos4f := GetModuleSymbol(LibGL, 'glRasterPos4f'); - @glRasterPos4fv := GetModuleSymbol(LibGL, 'glRasterPos4fv'); - @glRasterPos4i := GetModuleSymbol(LibGL, 'glRasterPos4i'); - @glRasterPos4iv := GetModuleSymbol(LibGL, 'glRasterPos4iv'); - @glRasterPos4s := GetModuleSymbol(LibGL, 'glRasterPos4s'); - @glRasterPos4sv := GetModuleSymbol(LibGL, 'glRasterPos4sv'); - @glReadBuffer := GetModuleSymbol(LibGL, 'glReadBuffer'); - @glReadPixels := GetModuleSymbol(LibGL, 'glReadPixels'); - @glRectd := GetModuleSymbol(LibGL, 'glRectd'); - @glRectdv := GetModuleSymbol(LibGL, 'glRectdv'); - @glRectf := GetModuleSymbol(LibGL, 'glRectf'); - @glRectfv := GetModuleSymbol(LibGL, 'glRectfv'); - @glRecti := GetModuleSymbol(LibGL, 'glRecti'); - @glRectiv := GetModuleSymbol(LibGL, 'glRectiv'); - @glRects := GetModuleSymbol(LibGL, 'glRects'); - @glRectsv := GetModuleSymbol(LibGL, 'glRectsv'); - @glRenderMode := GetModuleSymbol(LibGL, 'glRenderMode'); - @glRotated := GetModuleSymbol(LibGL, 'glRotated'); - @glRotatef := GetModuleSymbol(LibGL, 'glRotatef'); - @glScaled := GetModuleSymbol(LibGL, 'glScaled'); - @glScalef := GetModuleSymbol(LibGL, 'glScalef'); - @glScissor := GetModuleSymbol(LibGL, 'glScissor'); - @glSelectBuffer := GetModuleSymbol(LibGL, 'glSelectBuffer'); - @glShadeModel := GetModuleSymbol(LibGL, 'glShadeModel'); - @glStencilFunc := GetModuleSymbol(LibGL, 'glStencilFunc'); - @glStencilMask := GetModuleSymbol(LibGL, 'glStencilMask'); - @glStencilOp := GetModuleSymbol(LibGL, 'glStencilOp'); - @glTexCoord1d := GetModuleSymbol(LibGL, 'glTexCoord1d'); - @glTexCoord1dv := GetModuleSymbol(LibGL, 'glTexCoord1dv'); - @glTexCoord1f := GetModuleSymbol(LibGL, 'glTexCoord1f'); - @glTexCoord1fv := GetModuleSymbol(LibGL, 'glTexCoord1fv'); - @glTexCoord1i := GetModuleSymbol(LibGL, 'glTexCoord1i'); - @glTexCoord1iv := GetModuleSymbol(LibGL, 'glTexCoord1iv'); - @glTexCoord1s := GetModuleSymbol(LibGL, 'glTexCoord1s'); - @glTexCoord1sv := GetModuleSymbol(LibGL, 'glTexCoord1sv'); - @glTexCoord2d := GetModuleSymbol(LibGL, 'glTexCoord2d'); - @glTexCoord2dv := GetModuleSymbol(LibGL, 'glTexCoord2dv'); - @glTexCoord2f := GetModuleSymbol(LibGL, 'glTexCoord2f'); - @glTexCoord2fv := GetModuleSymbol(LibGL, 'glTexCoord2fv'); - @glTexCoord2i := GetModuleSymbol(LibGL, 'glTexCoord2i'); - @glTexCoord2iv := GetModuleSymbol(LibGL, 'glTexCoord2iv'); - @glTexCoord2s := GetModuleSymbol(LibGL, 'glTexCoord2s'); - @glTexCoord2sv := GetModuleSymbol(LibGL, 'glTexCoord2sv'); - @glTexCoord3d := GetModuleSymbol(LibGL, 'glTexCoord3d'); - @glTexCoord3dv := GetModuleSymbol(LibGL, 'glTexCoord3dv'); - @glTexCoord3f := GetModuleSymbol(LibGL, 'glTexCoord3f'); - @glTexCoord3fv := GetModuleSymbol(LibGL, 'glTexCoord3fv'); - @glTexCoord3i := GetModuleSymbol(LibGL, 'glTexCoord3i'); - @glTexCoord3iv := GetModuleSymbol(LibGL, 'glTexCoord3iv'); - @glTexCoord3s := GetModuleSymbol(LibGL, 'glTexCoord3s'); - @glTexCoord3sv := GetModuleSymbol(LibGL, 'glTexCoord3sv'); - @glTexCoord4d := GetModuleSymbol(LibGL, 'glTexCoord4d'); - @glTexCoord4dv := GetModuleSymbol(LibGL, 'glTexCoord4dv'); - @glTexCoord4f := GetModuleSymbol(LibGL, 'glTexCoord4f'); - @glTexCoord4fv := GetModuleSymbol(LibGL, 'glTexCoord4fv'); - @glTexCoord4i := GetModuleSymbol(LibGL, 'glTexCoord4i'); - @glTexCoord4iv := GetModuleSymbol(LibGL, 'glTexCoord4iv'); - @glTexCoord4s := GetModuleSymbol(LibGL, 'glTexCoord4s'); - @glTexCoord4sv := GetModuleSymbol(LibGL, 'glTexCoord4sv'); - @glTexCoordPointer := GetModuleSymbol(LibGL, 'glTexCoordPointer'); - @glTexEnvf := GetModuleSymbol(LibGL, 'glTexEnvf'); - @glTexEnvfv := GetModuleSymbol(LibGL, 'glTexEnvfv'); - @glTexEnvi := GetModuleSymbol(LibGL, 'glTexEnvi'); - @glTexEnviv := GetModuleSymbol(LibGL, 'glTexEnviv'); - @glTexGend := GetModuleSymbol(LibGL, 'glTexGend'); - @glTexGendv := GetModuleSymbol(LibGL, 'glTexGendv'); - @glTexGenf := GetModuleSymbol(LibGL, 'glTexGenf'); - @glTexGenfv := GetModuleSymbol(LibGL, 'glTexGenfv'); - @glTexGeni := GetModuleSymbol(LibGL, 'glTexGeni'); - @glTexGeniv := GetModuleSymbol(LibGL, 'glTexGeniv'); - @glTexImage1D := GetModuleSymbol(LibGL, 'glTexImage1D'); - @glTexImage2D := GetModuleSymbol(LibGL, 'glTexImage2D'); - @glTexParameterf := GetModuleSymbol(LibGL, 'glTexParameterf'); - @glTexParameterfv := GetModuleSymbol(LibGL, 'glTexParameterfv'); - @glTexParameteri := GetModuleSymbol(LibGL, 'glTexParameteri'); - @glTexParameteriv := GetModuleSymbol(LibGL, 'glTexParameteriv'); - @glTexSubImage1D := GetModuleSymbol(LibGL, 'glTexSubImage1D'); - @glTexSubImage2D := GetModuleSymbol(LibGL, 'glTexSubImage2D'); - @glTranslated := GetModuleSymbol(LibGL, 'glTranslated'); - @glTranslatef := GetModuleSymbol(LibGL, 'glTranslatef'); - @glVertex2d := GetModuleSymbol(LibGL, 'glVertex2d'); - @glVertex2dv := GetModuleSymbol(LibGL, 'glVertex2dv'); - @glVertex2f := GetModuleSymbol(LibGL, 'glVertex2f'); - @glVertex2fv := GetModuleSymbol(LibGL, 'glVertex2fv'); - @glVertex2i := GetModuleSymbol(LibGL, 'glVertex2i'); - @glVertex2iv := GetModuleSymbol(LibGL, 'glVertex2iv'); - @glVertex2s := GetModuleSymbol(LibGL, 'glVertex2s'); - @glVertex2sv := GetModuleSymbol(LibGL, 'glVertex2sv'); - @glVertex3d := GetModuleSymbol(LibGL, 'glVertex3d'); - @glVertex3dv := GetModuleSymbol(LibGL, 'glVertex3dv'); - @glVertex3f := GetModuleSymbol(LibGL, 'glVertex3f'); - @glVertex3fv := GetModuleSymbol(LibGL, 'glVertex3fv'); - @glVertex3i := GetModuleSymbol(LibGL, 'glVertex3i'); - @glVertex3iv := GetModuleSymbol(LibGL, 'glVertex3iv'); - @glVertex3s := GetModuleSymbol(LibGL, 'glVertex3s'); - @glVertex3sv := GetModuleSymbol(LibGL, 'glVertex3sv'); - @glVertex4d := GetModuleSymbol(LibGL, 'glVertex4d'); - @glVertex4dv := GetModuleSymbol(LibGL, 'glVertex4dv'); - @glVertex4f := GetModuleSymbol(LibGL, 'glVertex4f'); - @glVertex4fv := GetModuleSymbol(LibGL, 'glVertex4fv'); - @glVertex4i := GetModuleSymbol(LibGL, 'glVertex4i'); - @glVertex4iv := GetModuleSymbol(LibGL, 'glVertex4iv'); - @glVertex4s := GetModuleSymbol(LibGL, 'glVertex4s'); - @glVertex4sv := GetModuleSymbol(LibGL, 'glVertex4sv'); - @glVertexPointer := GetModuleSymbol(LibGL, 'glVertexPointer'); - @glViewport := GetModuleSymbol(LibGL, 'glViewport'); - - {$IFDEF WIN32} - @ChoosePixelFormat := GetModuleSymbol(LibGL, 'ChoosePixelFormat'); - if not Assigned(ChoosePixelFormat) then - {$IFNDEF FPC}@{$ENDIF}ChoosePixelFormat := @Windows.ChoosePixelFormat; - {$ENDIF} - end; -end; - -initialization - {$IFNDEF FPC} - {$IFNDEF __GPC__} - Set8087CW($133F); - {$ENDIF} - {$ENDIF} - - LoadOpenGL( GLLibName ); - -finalization - - FreeOpenGL; - -end. - diff --git a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glext.pas b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glext.pas deleted file mode 100644 index 19ed2023..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glext.pas +++ /dev/null @@ -1,8527 +0,0 @@ -unit glext; -{ - $Id: glext.pas,v 1.3 2004/08/24 19:33:06 savage Exp $ - -} -(************************************************** - * OpenGL extension loading library * - * Generated by MetaGLext, written by Tom Nuydens * - * (tom@delphi3d.net -- http://www.delphi3d.net * - **************************************************) - -{ - $Log: glext.pas,v $ - Revision 1.3 2004/08/24 19:33:06 savage - Removed declarations of SDL_GL_GetProcAddress as the correct ones are in sdl.pas. - - Revision 1.2 2004/08/09 00:38:01 savage - Updated to Tom's latest version. May contains bugs, but I hope not. - - Revision 1.1 2004/03/30 21:53:54 savage - Moved to it's own folder. - - Revision 1.6 2004/03/28 00:28:43 savage - Fixed some glSecondaryColor definitions... - - Revision 1.5 2004/02/20 17:18:16 savage - Forgot to prefix function pointer with @ for FPC and other Pascal compilers. - - Revision 1.4 2004/02/20 17:09:55 savage - Code tidied up in gl, glu and glut, while extensions in glext.pas are now loaded using SDL_GL_GetProcAddress, thus making it more cross-platform compatible, but now more tied to SDL. - - Revision 1.3 2004/02/14 22:36:29 savage - Fixed inconsistencies of using LoadLibrary and LoadModule. - Now all units make use of LoadModule rather than LoadLibrary and other dynamic proc procedures. - - Revision 1.2 2004/02/14 00:09:19 savage - Changed uses to now make use of moduleloader.pas rather than dllfuncs.pas - - Revision 1.1 2004/02/05 00:08:19 savage - Module 1.0 release - - Revision 1.7 2003/06/02 12:32:13 savage - Modified Sources to avoid warnings with Delphi by moving CVS Logging to the top of the header files. Hopefully CVS Logging still works. - -} - -interface - -{$I jedi-sdl.inc} - -uses - SysUtils, -{$IFDEF __GPC__} - gpc, -{$ENDIF} - -{$IFDEF WIN32} - Windows, -{$ENDIF} - moduleloader, - gl; - -// Test if the given extension name is present in the given extension string. -function glext_ExtensionSupported(const extension: PChar; const searchIn: PChar): Boolean; - -// Load the extension with the given name. -function glext_LoadExtension(ext: PChar): Boolean; - -// Some types that were introduced by extensions: -type - GLintptrARB = Integer; - PGLintptrARB = ^GLintptrARB; - - GLsizeiptrARB = Integer; - PGLsizeiptrARB = ^GLsizeiptrARB; - - GLcharARB = Char; - PGLcharARB = ^GLcharARB; - - GLhandleARB = Cardinal; - PGLhandleARB = ^GLhandleARB; - -//***** GL_version_1_2 *****// -const - GL_UNSIGNED_BYTE_3_3_2 = $8032; - GL_UNSIGNED_SHORT_4_4_4_4 = $8033; - GL_UNSIGNED_SHORT_5_5_5_1 = $8034; - GL_UNSIGNED_INT_8_8_8_8 = $8035; - GL_UNSIGNED_INT_10_10_10_2 = $8036; - GL_RESCALE_NORMAL = $803A; - GL_UNSIGNED_BYTE_2_3_3_REV = $8362; - GL_UNSIGNED_SHORT_5_6_5 = $8363; - GL_UNSIGNED_SHORT_5_6_5_REV = $8364; - GL_UNSIGNED_SHORT_4_4_4_4_REV = $8365; - GL_UNSIGNED_SHORT_1_5_5_5_REV = $8366; - GL_UNSIGNED_INT_8_8_8_8_REV = $8367; - GL_UNSIGNED_INT_2_10_10_10_REV = $8368; - GL_BGR = $80E0; - GL_BGRA = $80E1; - GL_MAX_ELEMENTS_VERTICES = $80E8; - GL_MAX_ELEMENTS_INDICES = $80E9; - GL_CLAMP_TO_EDGE = $812F; - GL_TEXTURE_MIN_LOD = $813A; - GL_TEXTURE_MAX_LOD = $813B; - GL_TEXTURE_BASE_LEVEL = $813C; - GL_TEXTURE_MAX_LEVEL = $813D; - GL_LIGHT_MODEL_COLOR_CONTROL = $81F8; - GL_SINGLE_COLOR = $81F9; - GL_SEPARATE_SPECULAR_COLOR = $81FA; - GL_SMOOTH_POINT_SIZE_RANGE = $0B12; - GL_SMOOTH_POINT_SIZE_GRANULARITY = $0B13; - GL_SMOOTH_LINE_WIDTH_RANGE = $0B22; - GL_SMOOTH_LINE_WIDTH_GRANULARITY = $0B23; - GL_ALIASED_POINT_SIZE_RANGE = $846D; - GL_ALIASED_LINE_WIDTH_RANGE = $846E; - GL_PACK_SKIP_IMAGES = $806B; - GL_PACK_IMAGE_HEIGHT = $806C; - GL_UNPACK_SKIP_IMAGES = $806D; - GL_UNPACK_IMAGE_HEIGHT = $806E; - GL_TEXTURE_3D = $806F; - GL_PROXY_TEXTURE_3D = $8070; - GL_TEXTURE_DEPTH = $8071; - GL_TEXTURE_WRAP_R = $8072; - GL_MAX_3D_TEXTURE_SIZE = $8073; -var - glDrawRangeElements: procedure(mode: GLenum; start: GLuint; _end: GLuint; count: GLsizei; _type: GLenum; const indices: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexImage3D: procedure(target: GLenum; level: GLint; internalformat: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexSubImage3D: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyTexSubImage3D: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; x: GLint; y: GLint; width: GLsizei; height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_version_1_2: Boolean; - -//***** GL_ARB_imaging *****// -const - GL_CONSTANT_COLOR = $8001; - GL_ONE_MINUS_CONSTANT_COLOR = $8002; - GL_CONSTANT_ALPHA = $8003; - GL_ONE_MINUS_CONSTANT_ALPHA = $8004; - GL_BLEND_COLOR = $8005; - GL_FUNC_ADD = $8006; - GL_MIN = $8007; - GL_MAX = $8008; - GL_BLEND_EQUATION = $8009; - GL_FUNC_SUBTRACT = $800A; - GL_FUNC_REVERSE_SUBTRACT = $800B; - GL_CONVOLUTION_1D = $8010; - GL_CONVOLUTION_2D = $8011; - GL_SEPARABLE_2D = $8012; - GL_CONVOLUTION_BORDER_MODE = $8013; - GL_CONVOLUTION_FILTER_SCALE = $8014; - GL_CONVOLUTION_FILTER_BIAS = $8015; - GL_REDUCE = $8016; - GL_CONVOLUTION_FORMAT = $8017; - GL_CONVOLUTION_WIDTH = $8018; - GL_CONVOLUTION_HEIGHT = $8019; - GL_MAX_CONVOLUTION_WIDTH = $801A; - GL_MAX_CONVOLUTION_HEIGHT = $801B; - GL_POST_CONVOLUTION_RED_SCALE = $801C; - GL_POST_CONVOLUTION_GREEN_SCALE = $801D; - GL_POST_CONVOLUTION_BLUE_SCALE = $801E; - GL_POST_CONVOLUTION_ALPHA_SCALE = $801F; - GL_POST_CONVOLUTION_RED_BIAS = $8020; - GL_POST_CONVOLUTION_GREEN_BIAS = $8021; - GL_POST_CONVOLUTION_BLUE_BIAS = $8022; - GL_POST_CONVOLUTION_ALPHA_BIAS = $8023; - GL_HISTOGRAM = $8024; - GL_PROXY_HISTOGRAM = $8025; - GL_HISTOGRAM_WIDTH = $8026; - GL_HISTOGRAM_FORMAT = $8027; - GL_HISTOGRAM_RED_SIZE = $8028; - GL_HISTOGRAM_GREEN_SIZE = $8029; - GL_HISTOGRAM_BLUE_SIZE = $802A; - GL_HISTOGRAM_ALPHA_SIZE = $802B; - GL_HISTOGRAM_LUMINANCE_SIZE = $802C; - GL_HISTOGRAM_SINK = $802D; - GL_MINMAX = $802E; - GL_MINMAX_FORMAT = $802F; - GL_MINMAX_SINK = $8030; - GL_TABLE_TOO_LARGE = $8031; - GL_COLOR_MATRIX = $80B1; - GL_COLOR_MATRIX_STACK_DEPTH = $80B2; - GL_MAX_COLOR_MATRIX_STACK_DEPTH = $80B3; - GL_POST_COLOR_MATRIX_RED_SCALE = $80B4; - GL_POST_COLOR_MATRIX_GREEN_SCALE = $80B5; - GL_POST_COLOR_MATRIX_BLUE_SCALE = $80B6; - GL_POST_COLOR_MATRIX_ALPHA_SCALE = $80B7; - GL_POST_COLOR_MATRIX_RED_BIAS = $80B8; - GL_POST_COLOR_MATRIX_GREEN_BIAS = $80B9; - GL_POST_COLOR_MATRIX_BLUE_BIAS = $80BA; - GL_POST_COLOR_MATIX_ALPHA_BIAS = $80BB; - GL_COLOR_TABLE = $80D0; - GL_POST_CONVOLUTION_COLOR_TABLE = $80D1; - GL_POST_COLOR_MATRIX_COLOR_TABLE = $80D2; - GL_PROXY_COLOR_TABLE = $80D3; - GL_PROXY_POST_CONVOLUTION_COLOR_TABLE = $80D4; - GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE = $80D5; - GL_COLOR_TABLE_SCALE = $80D6; - GL_COLOR_TABLE_BIAS = $80D7; - GL_COLOR_TABLE_FORMAT = $80D8; - GL_COLOR_TABLE_WIDTH = $80D9; - GL_COLOR_TABLE_RED_SIZE = $80DA; - GL_COLOR_TABLE_GREEN_SIZE = $80DB; - GL_COLOR_TABLE_BLUE_SIZE = $80DC; - GL_COLOR_TABLE_ALPHA_SIZE = $80DD; - GL_COLOR_TABLE_LUMINANCE_SIZE = $80DE; - GL_COLOR_TABLE_INTENSITY_SIZE = $80DF; - GL_IGNORE_BORDER = $8150; - GL_CONSTANT_BORDER = $8151; - GL_WRAP_BORDER = $8152; - GL_REPLICATE_BORDER = $8153; - GL_CONVOLUTION_BORDER_COLOR = $8154; -var - glColorTable: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const table: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorTableParameterfv: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorTableParameteriv: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyColorTable: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetColorTable: procedure(target: GLenum; format: GLenum; _type: GLenum; table: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetColorTableParameterfv: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetColorTableParameteriv: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorSubTable: procedure(target: GLenum; start: GLsizei; count: GLsizei; format: GLenum; _type: GLenum; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyColorSubTable: procedure(target: GLenum; start: GLsizei; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glConvolutionFilter1D: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glConvolutionFilter2D: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glConvolutionParameterf: procedure(target: GLenum; pname: GLenum; params: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glConvolutionParameterfv: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glConvolutionParameteri: procedure(target: GLenum; pname: GLenum; params: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glConvolutionParameteriv: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyConvolutionFilter1D: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyConvolutionFilter2D: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei; height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetConvolutionFilter: procedure(target: GLenum; format: GLenum; _type: GLenum; image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetConvolutionParameterfv: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetConvolutionParameteriv: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetSeparableFilter: procedure(target: GLenum; format: GLenum; _type: GLenum; row: PGLvoid; column: PGLvoid; span: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSeparableFilter2D: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const row: PGLvoid; const column: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetHistogram: procedure(target: GLenum; reset: GLboolean; format: GLenum; _type: GLenum; values: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetHistogramParameterfv: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetHistogramParameteriv: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMinmax: procedure(target: GLenum; reset: GLboolean; format: GLenum; _type: GLenum; values: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMinmaxParameterfv: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMinmaxParameteriv: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glHistogram: procedure(target: GLenum; width: GLsizei; internalformat: GLenum; sink: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMinmax: procedure(target: GLenum; internalformat: GLenum; sink: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glResetHistogram: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glResetMinmax: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBlendEquation: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBlendColor: procedure(red: GLclampf; green: GLclampf; blue: GLclampf; alpha: GLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ARB_imaging: Boolean; - -//***** GL_version_1_3 *****// -const - GL_TEXTURE0 = $84C0; - GL_TEXTURE1 = $84C1; - GL_TEXTURE2 = $84C2; - GL_TEXTURE3 = $84C3; - GL_TEXTURE4 = $84C4; - GL_TEXTURE5 = $84C5; - GL_TEXTURE6 = $84C6; - GL_TEXTURE7 = $84C7; - GL_TEXTURE8 = $84C8; - GL_TEXTURE9 = $84C9; - GL_TEXTURE10 = $84CA; - GL_TEXTURE11 = $84CB; - GL_TEXTURE12 = $84CC; - GL_TEXTURE13 = $84CD; - GL_TEXTURE14 = $84CE; - GL_TEXTURE15 = $84CF; - GL_TEXTURE16 = $84D0; - GL_TEXTURE17 = $84D1; - GL_TEXTURE18 = $84D2; - GL_TEXTURE19 = $84D3; - GL_TEXTURE20 = $84D4; - GL_TEXTURE21 = $84D5; - GL_TEXTURE22 = $84D6; - GL_TEXTURE23 = $84D7; - GL_TEXTURE24 = $84D8; - GL_TEXTURE25 = $84D9; - GL_TEXTURE26 = $84DA; - GL_TEXTURE27 = $84DB; - GL_TEXTURE28 = $84DC; - GL_TEXTURE29 = $84DD; - GL_TEXTURE30 = $84DE; - GL_TEXTURE31 = $84DF; - GL_ACTIVE_TEXTURE = $84E0; - GL_CLIENT_ACTIVE_TEXTURE = $84E1; - GL_MAX_TEXTURE_UNITS = $84E2; - GL_TRANSPOSE_MODELVIEW_MATRIX = $84E3; - GL_TRANSPOSE_PROJECTION_MATRIX = $84E4; - GL_TRANSPOSE_TEXTURE_MATRIX = $84E5; - GL_TRANSPOSE_COLOR_MATRIX = $84E6; - GL_MULTISAMPLE = $809D; - GL_SAMPLE_ALPHA_TO_COVERAGE = $809E; - GL_SAMPLE_ALPHA_TO_ONE = $809F; - GL_SAMPLE_COVERAGE = $80A0; - GL_SAMPLE_BUFFERS = $80A8; - GL_SAMPLES = $80A9; - GL_SAMPLE_COVERAGE_VALUE = $80AA; - GL_SAMPLE_COVERAGE_INVERT = $80AB; - GL_MULTISAMPLE_BIT = $20000000; - GL_NORMAL_MAP = $8511; - GL_REFLECTION_MAP = $8512; - GL_TEXTURE_CUBE_MAP = $8513; - GL_TEXTURE_BINDING_CUBE_MAP = $8514; - GL_TEXTURE_CUBE_MAP_POSITIVE_X = $8515; - GL_TEXTURE_CUBE_MAP_NEGATIVE_X = $8516; - GL_TEXTURE_CUBE_MAP_POSITIVE_Y = $8517; - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = $8518; - GL_TEXTURE_CUBE_MAP_POSITIVE_Z = $8519; - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = $851A; - GL_PROXY_TEXTURE_CUBE_MAP = $851B; - GL_MAX_CUBE_MAP_TEXTURE_SIZE = $851C; - GL_COMPRESSED_ALPHA = $84E9; - GL_COMPRESSED_LUMINANCE = $84EA; - GL_COMPRESSED_LUMINANCE_ALPHA = $84EB; - GL_COMPRESSED_INTENSITY = $84EC; - GL_COMPRESSED_RGB = $84ED; - GL_COMPRESSED_RGBA = $84EE; - GL_TEXTURE_COMPRESSION_HINT = $84EF; - GL_TEXTURE_COMPRESSED_IMAGE_SIZE = $86A0; - GL_TEXTURE_COMPRESSED = $86A1; - GL_NUM_COMPRESSED_TEXTURE_FORMATS = $86A2; - GL_COMPRESSED_TEXTURE_FORMATS = $86A3; - GL_CLAMP_TO_BORDER = $812D; - GL_CLAMP_TO_BORDER_SGIS = $812D; - GL_COMBINE = $8570; - GL_COMBINE_RGB = $8571; - GL_COMBINE_ALPHA = $8572; - GL_SOURCE0_RGB = $8580; - GL_SOURCE1_RGB = $8581; - GL_SOURCE2_RGB = $8582; - GL_SOURCE0_ALPHA = $8588; - GL_SOURCE1_ALPHA = $8589; - GL_SOURCE2_ALPHA = $858A; - GL_OPERAND0_RGB = $8590; - GL_OPERAND1_RGB = $8591; - GL_OPERAND2_RGB = $8592; - GL_OPERAND0_ALPHA = $8598; - GL_OPERAND1_ALPHA = $8599; - GL_OPERAND2_ALPHA = $859A; - GL_RGB_SCALE = $8573; - GL_ADD_SIGNED = $8574; - GL_INTERPOLATE = $8575; - GL_SUBTRACT = $84E7; - GL_CONSTANT = $8576; - GL_PRIMARY_COLOR = $8577; - GL_PREVIOUS = $8578; - GL_DOT3_RGB = $86AE; - GL_DOT3_RGBA = $86AF; -var - glActiveTexture: procedure(texture: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glClientActiveTexture: procedure(texture: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1d: procedure(target: GLenum; s: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1dv: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1f: procedure(target: GLenum; s: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1fv: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1i: procedure(target: GLenum; s: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1iv: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1s: procedure(target: GLenum; s: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1sv: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2d: procedure(target: GLenum; s: GLdouble; t: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2dv: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2f: procedure(target: GLenum; s: GLfloat; t: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2fv: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2i: procedure(target: GLenum; s: GLint; t: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2iv: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2s: procedure(target: GLenum; s: GLshort; t: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2sv: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3d: procedure(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3dv: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3f: procedure(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3fv: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3i: procedure(target: GLenum; s: GLint; t: GLint; r: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3iv: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3s: procedure(target: GLenum; s: GLshort; t: GLshort; r: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3sv: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4d: procedure(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble; q: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4dv: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4f: procedure(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat; q: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4fv: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4i: procedure(target: GLenum; s: GLint; t: GLint; r: GLint; q: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4iv: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4s: procedure(target: GLenum; s: GLshort; t: GLshort; r: GLshort; q: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4sv: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLoadTransposeMatrixf: procedure(const m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLoadTransposeMatrixd: procedure(const m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultTransposeMatrixf: procedure(const m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultTransposeMatrixd: procedure(const m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSampleCoverage: procedure(value: GLclampf; invert: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompressedTexImage3D: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompressedTexImage2D: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompressedTexImage1D: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompressedTexSubImage3D: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompressedTexSubImage2D: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; height: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompressedTexSubImage1D: procedure(target: GLenum; level: GLint; xoffset: GLint; width: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetCompressedTexImage: procedure(target: GLenum; level: GLint; img: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_version_1_3: Boolean; - -//***** GL_ARB_multitexture *****// -const - GL_TEXTURE0_ARB = $84C0; - GL_TEXTURE1_ARB = $84C1; - GL_TEXTURE2_ARB = $84C2; - GL_TEXTURE3_ARB = $84C3; - GL_TEXTURE4_ARB = $84C4; - GL_TEXTURE5_ARB = $84C5; - GL_TEXTURE6_ARB = $84C6; - GL_TEXTURE7_ARB = $84C7; - GL_TEXTURE8_ARB = $84C8; - GL_TEXTURE9_ARB = $84C9; - GL_TEXTURE10_ARB = $84CA; - GL_TEXTURE11_ARB = $84CB; - GL_TEXTURE12_ARB = $84CC; - GL_TEXTURE13_ARB = $84CD; - GL_TEXTURE14_ARB = $84CE; - GL_TEXTURE15_ARB = $84CF; - GL_TEXTURE16_ARB = $84D0; - GL_TEXTURE17_ARB = $84D1; - GL_TEXTURE18_ARB = $84D2; - GL_TEXTURE19_ARB = $84D3; - GL_TEXTURE20_ARB = $84D4; - GL_TEXTURE21_ARB = $84D5; - GL_TEXTURE22_ARB = $84D6; - GL_TEXTURE23_ARB = $84D7; - GL_TEXTURE24_ARB = $84D8; - GL_TEXTURE25_ARB = $84D9; - GL_TEXTURE26_ARB = $84DA; - GL_TEXTURE27_ARB = $84DB; - GL_TEXTURE28_ARB = $84DC; - GL_TEXTURE29_ARB = $84DD; - GL_TEXTURE30_ARB = $84DE; - GL_TEXTURE31_ARB = $84DF; - GL_ACTIVE_TEXTURE_ARB = $84E0; - GL_CLIENT_ACTIVE_TEXTURE_ARB = $84E1; - GL_MAX_TEXTURE_UNITS_ARB = $84E2; -var - glActiveTextureARB: procedure(texture: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glClientActiveTextureARB: procedure(texture: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1dARB: procedure(target: GLenum; s: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1dvARB: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1fARB: procedure(target: GLenum; s: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1fvARB: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1iARB: procedure(target: GLenum; s: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1ivARB: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1sARB: procedure(target: GLenum; s: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1svARB: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2dARB: procedure(target: GLenum; s: GLdouble; t: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2dvARB: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2fARB: procedure(target: GLenum; s: GLfloat; t: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2fvARB: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2iARB: procedure(target: GLenum; s: GLint; t: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2ivARB: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2sARB: procedure(target: GLenum; s: GLshort; t: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2svARB: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3dARB: procedure(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3dvARB: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3fARB: procedure(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3fvARB: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3iARB: procedure(target: GLenum; s: GLint; t: GLint; r: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3ivARB: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3sARB: procedure(target: GLenum; s: GLshort; t: GLshort; r: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3svARB: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4dARB: procedure(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble; q: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4dvARB: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4fARB: procedure(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat; q: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4fvARB: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4iARB: procedure(target: GLenum; s: GLint; t: GLint; r: GLint; q: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4ivARB: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4sARB: procedure(target: GLenum; s: GLshort; t: GLshort; r: GLshort; q: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4svARB: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ARB_multitexture: Boolean; - -//***** GL_ARB_transpose_matrix *****// -const - GL_TRANSPOSE_MODELVIEW_MATRIX_ARB = $84E3; - GL_TRANSPOSE_PROJECTION_MATRIX_ARB = $84E4; - GL_TRANSPOSE_TEXTURE_MATRIX_ARB = $84E5; - GL_TRANSPOSE_COLOR_MATRIX_ARB = $84E6; -var - glLoadTransposeMatrixfARB: procedure(m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLoadTransposeMatrixdARB: procedure(m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultTransposeMatrixfARB: procedure(m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultTransposeMatrixdARB: procedure(m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ARB_transpose_matrix: Boolean; - -//***** GL_ARB_multisample *****// -const - WGL_SAMPLE_BUFFERS_ARB = $2041; - WGL_SAMPLES_ARB = $2042; - GL_MULTISAMPLE_ARB = $809D; - GL_SAMPLE_ALPHA_TO_COVERAGE_ARB = $809E; - GL_SAMPLE_ALPHA_TO_ONE_ARB = $809F; - GL_SAMPLE_COVERAGE_ARB = $80A0; - GL_MULTISAMPLE_BIT_ARB = $20000000; - GL_SAMPLE_BUFFERS_ARB = $80A8; - GL_SAMPLES_ARB = $80A9; - GL_SAMPLE_COVERAGE_VALUE_ARB = $80AA; - GL_SAMPLE_COVERAGE_INVERT_ARB = $80AB; -var - glSampleCoverageARB: procedure(value: GLclampf; invert: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ARB_multisample: Boolean; - -//***** GL_ARB_texture_env_add *****// - -function Load_GL_ARB_texture_env_add: Boolean; - -{$IFDEF Win32} -//***** WGL_ARB_extensions_string *****// -var - wglGetExtensionsStringARB: function(hdc: HDC): Pchar; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_WGL_ARB_extensions_string: Boolean; - -//***** WGL_ARB_buffer_region *****// -const - WGL_FRONT_COLOR_BUFFER_BIT_ARB = $0001; - WGL_BACK_COLOR_BUFFER_BIT_ARB = $0002; - WGL_DEPTH_BUFFER_BIT_ARB = $0004; - WGL_STENCIL_BUFFER_BIT_ARB = $0008; -var - wglCreateBufferRegionARB: function(hDC: HDC; iLayerPlane: GLint; uType: GLuint): THandle; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglDeleteBufferRegionARB: procedure(hRegion: THandle); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglSaveBufferRegionARB: function(hRegion: THandle; x: GLint; y: GLint; width: GLint; height: GLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglRestoreBufferRegionARB: function(hRegion: THandle; x: GLint; y: GLint; width: GLint; height: GLint; xSrc: GLint; ySrc: GLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_WGL_ARB_buffer_region: Boolean; -{$ENDIF} - -//***** GL_ARB_texture_cube_map *****// -const - GL_NORMAL_MAP_ARB = $8511; - GL_REFLECTION_MAP_ARB = $8512; - GL_TEXTURE_CUBE_MAP_ARB = $8513; - GL_TEXTURE_BINDING_CUBE_MAP_ARB = $8514; - GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = $8515; - GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = $8516; - GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = $8517; - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = $8518; - GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = $8519; - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = $851A; - GL_PROXY_TEXTURE_CUBE_MAP_ARB = $851B; - GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB = $851C; - -function Load_GL_ARB_texture_cube_map: Boolean; - -//***** GL_ARB_depth_texture *****// -const - GL_DEPTH_COMPONENT16_ARB = $81A5; - GL_DEPTH_COMPONENT24_ARB = $81A6; - GL_DEPTH_COMPONENT32_ARB = $81A7; - GL_TEXTURE_DEPTH_SIZE_ARB = $884A; - GL_DEPTH_TEXTURE_MODE_ARB = $884B; - -function Load_GL_ARB_depth_texture: Boolean; - -//***** GL_ARB_point_parameters *****// -const - GL_POINT_SIZE_MIN_ARB = $8126; - GL_POINT_SIZE_MAX_ARB = $8127; - GL_POINT_FADE_THRESHOLD_SIZE_ARB = $8128; - GL_POINT_DISTANCE_ATTENUATION_ARB = $8129; -var - glPointParameterfARB: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPointParameterfvARB: procedure(pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ARB_point_parameters: Boolean; - -//***** GL_ARB_shadow *****// -const - GL_TEXTURE_COMPARE_MODE_ARB = $884C; - GL_TEXTURE_COMPARE_FUNC_ARB = $884D; - GL_COMPARE_R_TO_TEXTURE_ARB = $884E; - -function Load_GL_ARB_shadow: Boolean; - -//***** GL_ARB_shadow_ambient *****// -const - GL_TEXTURE_COMPARE_FAIL_VALUE_ARB = $80BF; - -function Load_GL_ARB_shadow_ambient: Boolean; - -//***** GL_ARB_texture_border_clamp *****// -const - GL_CLAMP_TO_BORDER_ARB = $812D; - -function Load_GL_ARB_texture_border_clamp: Boolean; - -//***** GL_ARB_texture_compression *****// -const - GL_COMPRESSED_ALPHA_ARB = $84E9; - GL_COMPRESSED_LUMINANCE_ARB = $84EA; - GL_COMPRESSED_LUMINANCE_ALPHA_ARB = $84EB; - GL_COMPRESSED_INTENSITY_ARB = $84EC; - GL_COMPRESSED_RGB_ARB = $84ED; - GL_COMPRESSED_RGBA_ARB = $84EE; - GL_TEXTURE_COMPRESSION_HINT_ARB = $84EF; - GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB = $86A0; - GL_TEXTURE_COMPRESSED_ARB = $86A1; - GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB = $86A2; - GL_COMPRESSED_TEXTURE_FORMATS_ARB = $86A3; -var - glCompressedTexImage3DARB: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompressedTexImage2DARB: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompressedTexImage1DARB: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompressedTexSubImage3DARB: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompressedTexSubImage2DARB: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; height: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompressedTexSubImage1DARB: procedure(target: GLenum; level: GLint; xoffset: GLint; width: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetCompressedTexImageARB: procedure(target: GLenum; lod: GLint; img: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ARB_texture_compression: Boolean; - -//***** GL_ARB_texture_env_combine *****// -const - GL_COMBINE_ARB = $8570; - GL_COMBINE_RGB_ARB = $8571; - GL_COMBINE_ALPHA_ARB = $8572; - GL_SOURCE0_RGB_ARB = $8580; - GL_SOURCE1_RGB_ARB = $8581; - GL_SOURCE2_RGB_ARB = $8582; - GL_SOURCE0_ALPHA_ARB = $8588; - GL_SOURCE1_ALPHA_ARB = $8589; - GL_SOURCE2_ALPHA_ARB = $858A; - GL_OPERAND0_RGB_ARB = $8590; - GL_OPERAND1_RGB_ARB = $8591; - GL_OPERAND2_RGB_ARB = $8592; - GL_OPERAND0_ALPHA_ARB = $8598; - GL_OPERAND1_ALPHA_ARB = $8599; - GL_OPERAND2_ALPHA_ARB = $859A; - GL_RGB_SCALE_ARB = $8573; - GL_ADD_SIGNED_ARB = $8574; - GL_INTERPOLATE_ARB = $8575; - GL_SUBTRACT_ARB = $84E7; - GL_CONSTANT_ARB = $8576; - GL_PRIMARY_COLOR_ARB = $8577; - GL_PREVIOUS_ARB = $8578; - -function Load_GL_ARB_texture_env_combine: Boolean; - -//***** GL_ARB_texture_env_crossbar *****// - -function Load_GL_ARB_texture_env_crossbar: Boolean; - -//***** GL_ARB_texture_env_dot3 *****// -const - GL_DOT3_RGB_ARB = $86AE; - GL_DOT3_RGBA_ARB = $86AF; - -function Load_GL_ARB_texture_env_dot3: Boolean; - -//***** GL_ARB_texture_mirrored_repeat *****// -const - GL_MIRRORED_REPEAT_ARB = $8370; - -function Load_GL_ARB_texture_mirrored_repeat: Boolean; - -//***** GL_ARB_vertex_blend *****// -const - GL_MAX_VERTEX_UNITS_ARB = $86A4; - GL_ACTIVE_VERTEX_UNITS_ARB = $86A5; - GL_WEIGHT_SUM_UNITY_ARB = $86A6; - GL_VERTEX_BLEND_ARB = $86A7; - GL_MODELVIEW0_ARB = $1700; - GL_MODELVIEW1_ARB = $850A; - GL_MODELVIEW2_ARB = $8722; - GL_MODELVIEW3_ARB = $8723; - GL_MODELVIEW4_ARB = $8724; - GL_MODELVIEW5_ARB = $8725; - GL_MODELVIEW6_ARB = $8726; - GL_MODELVIEW7_ARB = $8727; - GL_MODELVIEW8_ARB = $8728; - GL_MODELVIEW9_ARB = $8729; - GL_MODELVIEW10_ARB = $872A; - GL_MODELVIEW11_ARB = $872B; - GL_MODELVIEW12_ARB = $872C; - GL_MODELVIEW13_ARB = $872D; - GL_MODELVIEW14_ARB = $872E; - GL_MODELVIEW15_ARB = $872F; - GL_MODELVIEW16_ARB = $8730; - GL_MODELVIEW17_ARB = $8731; - GL_MODELVIEW18_ARB = $8732; - GL_MODELVIEW19_ARB = $8733; - GL_MODELVIEW20_ARB = $8734; - GL_MODELVIEW21_ARB = $8735; - GL_MODELVIEW22_ARB = $8736; - GL_MODELVIEW23_ARB = $8737; - GL_MODELVIEW24_ARB = $8738; - GL_MODELVIEW25_ARB = $8739; - GL_MODELVIEW26_ARB = $873A; - GL_MODELVIEW27_ARB = $873B; - GL_MODELVIEW28_ARB = $873C; - GL_MODELVIEW29_ARB = $873D; - GL_MODELVIEW30_ARB = $873E; - GL_MODELVIEW31_ARB = $873F; - GL_CURRENT_WEIGHT_ARB = $86A8; - GL_WEIGHT_ARRAY_TYPE_ARB = $86A9; - GL_WEIGHT_ARRAY_STRIDE_ARB = $86AA; - GL_WEIGHT_ARRAY_SIZE_ARB = $86AB; - GL_WEIGHT_ARRAY_POINTER_ARB = $86AC; - GL_WEIGHT_ARRAY_ARB = $86AD; -var - glWeightbvARB: procedure(size: GLint; weights: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWeightsvARB: procedure(size: GLint; weights: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWeightivARB: procedure(size: GLint; weights: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWeightfvARB: procedure(size: GLint; weights: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWeightdvARB: procedure(size: GLint; weights: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWeightvARB: procedure(size: GLint; weights: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWeightubvARB: procedure(size: GLint; weights: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWeightusvARB: procedure(size: GLint; weights: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWeightuivARB: procedure(size: GLint; weights: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWeightPointerARB: procedure(size: GLint; _type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexBlendARB: procedure(count: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ARB_vertex_blend: Boolean; - -//***** GL_ARB_vertex_program *****// -const - GL_VERTEX_PROGRAM_ARB = $8620; - GL_VERTEX_PROGRAM_POINT_SIZE_ARB = $8642; - GL_VERTEX_PROGRAM_TWO_SIDE_ARB = $8643; - GL_COLOR_SUM_ARB = $8458; - GL_PROGRAM_FORMAT_ASCII_ARB = $8875; - GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB = $8622; - GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB = $8623; - GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB = $8624; - GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB = $8625; - GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB = $886A; - GL_CURRENT_VERTEX_ATTRIB_ARB = $8626; - GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB = $8645; - GL_PROGRAM_LENGTH_ARB = $8627; - GL_PROGRAM_FORMAT_ARB = $8876; - GL_PROGRAM_BINDING_ARB = $8677; - GL_PROGRAM_INSTRUCTIONS_ARB = $88A0; - GL_MAX_PROGRAM_INSTRUCTIONS_ARB = $88A1; - GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB = $88A2; - GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB = $88A3; - GL_PROGRAM_TEMPORARIES_ARB = $88A4; - GL_MAX_PROGRAM_TEMPORARIES_ARB = $88A5; - GL_PROGRAM_NATIVE_TEMPORARIES_ARB = $88A6; - GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB = $88A7; - GL_PROGRAM_PARAMETERS_ARB = $88A8; - GL_MAX_PROGRAM_PARAMETERS_ARB = $88A9; - GL_PROGRAM_NATIVE_PARAMETERS_ARB = $88AA; - GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB = $88AB; - GL_PROGRAM_ATTRIBS_ARB = $88AC; - GL_MAX_PROGRAM_ATTRIBS_ARB = $88AD; - GL_PROGRAM_NATIVE_ATTRIBS_ARB = $88AE; - GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB = $88AF; - GL_PROGRAM_ADDRESS_REGISTERS_ARB = $88B0; - GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB = $88B1; - GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = $88B2; - GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = $88B3; - GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB = $88B4; - GL_MAX_PROGRAM_ENV_PARAMETERS_ARB = $88B5; - GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB = $88B6; - GL_PROGRAM_STRING_ARB = $8628; - GL_PROGRAM_ERROR_POSITION_ARB = $864B; - GL_CURRENT_MATRIX_ARB = $8641; - GL_TRANSPOSE_CURRENT_MATRIX_ARB = $88B7; - GL_CURRENT_MATRIX_STACK_DEPTH_ARB = $8640; - GL_MAX_VERTEX_ATTRIBS_ARB = $8869; - GL_MAX_PROGRAM_MATRICES_ARB = $862F; - GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB = $862E; - GL_PROGRAM_ERROR_STRING_ARB = $8874; - GL_MATRIX0_ARB = $88C0; - GL_MATRIX1_ARB = $88C1; - GL_MATRIX2_ARB = $88C2; - GL_MATRIX3_ARB = $88C3; - GL_MATRIX4_ARB = $88C4; - GL_MATRIX5_ARB = $88C5; - GL_MATRIX6_ARB = $88C6; - GL_MATRIX7_ARB = $88C7; - GL_MATRIX8_ARB = $88C8; - GL_MATRIX9_ARB = $88C9; - GL_MATRIX10_ARB = $88CA; - GL_MATRIX11_ARB = $88CB; - GL_MATRIX12_ARB = $88CC; - GL_MATRIX13_ARB = $88CD; - GL_MATRIX14_ARB = $88CE; - GL_MATRIX15_ARB = $88CF; - GL_MATRIX16_ARB = $88D0; - GL_MATRIX17_ARB = $88D1; - GL_MATRIX18_ARB = $88D2; - GL_MATRIX19_ARB = $88D3; - GL_MATRIX20_ARB = $88D4; - GL_MATRIX21_ARB = $88D5; - GL_MATRIX22_ARB = $88D6; - GL_MATRIX23_ARB = $88D7; - GL_MATRIX24_ARB = $88D8; - GL_MATRIX25_ARB = $88D9; - GL_MATRIX26_ARB = $88DA; - GL_MATRIX27_ARB = $88DB; - GL_MATRIX28_ARB = $88DC; - GL_MATRIX29_ARB = $88DD; - GL_MATRIX30_ARB = $88DE; - GL_MATRIX31_ARB = $88DF; -var - glVertexAttrib1sARB: procedure(index: GLuint; x: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1fARB: procedure(index: GLuint; x: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1dARB: procedure(index: GLuint; x: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2sARB: procedure(index: GLuint; x: GLshort; y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2fARB: procedure(index: GLuint; x: GLfloat; y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2dARB: procedure(index: GLuint; x: GLdouble; y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3sARB: procedure(index: GLuint; x: GLshort; y: GLshort; z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3fARB: procedure(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3dARB: procedure(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4sARB: procedure(index: GLuint; x: GLshort; y: GLshort; z: GLshort; w: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4fARB: procedure(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4dARB: procedure(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4NubARB: procedure(index: GLuint; x: GLubyte; y: GLubyte; z: GLubyte; w: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1svARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1fvARB: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1dvARB: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2svARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2fvARB: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2dvARB: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3svARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3fvARB: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3dvARB: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4bvARB: procedure(index: GLuint; const v: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4svARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4ivARB: procedure(index: GLuint; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4ubvARB: procedure(index: GLuint; const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4usvARB: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4uivARB: procedure(index: GLuint; const v: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4fvARB: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4dvARB: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4NbvARB: procedure(index: GLuint; const v: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4NsvARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4NivARB: procedure(index: GLuint; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4NubvARB: procedure(index: GLuint; const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4NusvARB: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4NuivARB: procedure(index: GLuint; const v: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribPointerARB: procedure(index: GLuint; size: GLint; _type: GLenum; normalized: GLboolean; stride: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEnableVertexAttribArrayARB: procedure(index: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDisableVertexAttribArrayARB: procedure(index: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramStringARB: procedure(target: GLenum; format: GLenum; len: GLsizei; const _string: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBindProgramARB: procedure(target: GLenum; _program: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteProgramsARB: procedure(n: GLsizei; const programs: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGenProgramsARB: procedure(n: GLsizei; programs: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramEnvParameter4dARB: procedure(target: GLenum; index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramEnvParameter4dvARB: procedure(target: GLenum; index: GLuint; const params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramEnvParameter4fARB: procedure(target: GLenum; index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramEnvParameter4fvARB: procedure(target: GLenum; index: GLuint; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramLocalParameter4dARB: procedure(target: GLenum; index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramLocalParameter4dvARB: procedure(target: GLenum; index: GLuint; const params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramLocalParameter4fARB: procedure(target: GLenum; index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramLocalParameter4fvARB: procedure(target: GLenum; index: GLuint; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramEnvParameterdvARB: procedure(target: GLenum; index: GLuint; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramEnvParameterfvARB: procedure(target: GLenum; index: GLuint; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramLocalParameterdvARB: procedure(target: GLenum; index: GLuint; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramLocalParameterfvARB: procedure(target: GLenum; index: GLuint; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramivARB: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramStringARB: procedure(target: GLenum; pname: GLenum; _string: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVertexAttribdvARB: procedure(index: GLuint; pname: GLenum; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVertexAttribfvARB: procedure(index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVertexAttribivARB: procedure(index: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVertexAttribPointervARB: procedure(index: GLuint; pname: GLenum; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsProgramARB: function(_program: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ARB_vertex_program: Boolean; - -//***** GL_ARB_window_pos *****// -var - glWindowPos2dARB: procedure(x: GLdouble; y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2fARB: procedure(x: GLfloat; y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2iARB: procedure(x: GLint; y: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2sARB: procedure(x: GLshort; y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2dvARB: procedure(const p: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2fvARB: procedure(const p: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2ivARB: procedure(const p: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2svARB: procedure(const p: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3dARB: procedure(x: GLdouble; y: GLdouble; z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3fARB: procedure(x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3iARB: procedure(x: GLint; y: GLint; z: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3sARB: procedure(x: GLshort; y: GLshort; z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3dvARB: procedure(const p: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3fvARB: procedure(const p: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3ivARB: procedure(const p: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3svARB: procedure(const p: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ARB_window_pos: Boolean; - -//***** GL_EXT_422_pixels *****// -const - GL_422_EXT = $80CC; - GL_422_REV_EXT = $80CD; - GL_422_AVERAGE_EXT = $80CE; - GL_422_REV_AVERAGE_EXT = $80CF; - -function Load_GL_EXT_422_pixels: Boolean; - -//***** GL_EXT_abgr *****// -const - GL_ABGR_EXT = $8000; - -function Load_GL_EXT_abgr: Boolean; - -//***** GL_EXT_bgra *****// -const - GL_BGR_EXT = $80E0; - GL_BGRA_EXT = $80E1; - -function Load_GL_EXT_bgra: Boolean; - -//***** GL_EXT_blend_color *****// -const - GL_CONSTANT_COLOR_EXT = $8001; - GL_ONE_MINUS_CONSTANT_COLOR_EXT = $8002; - GL_CONSTANT_ALPHA_EXT = $8003; - GL_ONE_MINUS_CONSTANT_ALPHA_EXT = $8004; - GL_BLEND_COLOR_EXT = $8005; -var - glBlendColorEXT: procedure(red: GLclampf; green: GLclampf; blue: GLclampf; alpha: GLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_EXT_blend_color: Boolean; - -//***** GL_EXT_blend_func_separate *****// -const - GL_BLEND_DST_RGB_EXT = $80C8; - GL_BLEND_SRC_RGB_EXT = $80C9; - GL_BLEND_DST_ALPHA_EXT = $80CA; - GL_BLEND_SRC_ALPHA_EXT = $80CB; -var - glBlendFuncSeparateEXT: procedure(sfactorRGB: GLenum; dfactorRGB: GLenum; sfactorAlpha: GLenum; dfactorAlpha: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_EXT_blend_func_separate: Boolean; - -//***** GL_EXT_blend_logic_op *****// - -function Load_GL_EXT_blend_logic_op: Boolean; - -//***** GL_EXT_blend_minmax *****// -const - GL_FUNC_ADD_EXT = $8006; - GL_MIN_EXT = $8007; - GL_MAX_EXT = $8008; - GL_BLEND_EQUATION_EXT = $8009; -var - glBlendEquationEXT: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_EXT_blend_minmax: Boolean; - -//***** GL_EXT_blend_subtract *****// -const - GL_FUNC_SUBTRACT_EXT = $800A; - GL_FUNC_REVERSE_SUBTRACT_EXT = $800B; - -function Load_GL_EXT_blend_subtract: Boolean; - -//***** GL_EXT_clip_volume_hint *****// -const - GL_CLIP_VOLUME_CLIPPING_HINT_EXT = $80F0; - -function Load_GL_EXT_clip_volume_hint: Boolean; - -//***** GL_EXT_color_subtable *****// -var - glColorSubTableEXT: procedure(target: GLenum; start: GLsizei; count: GLsizei; format: GLenum; _type: GLenum; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyColorSubTableEXT: procedure(target: GLenum; start: GLsizei; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_EXT_color_subtable: Boolean; - -//***** GL_EXT_compiled_vertex_array *****// -const - GL_ARRAY_ELEMENT_LOCK_FIRST_EXT = $81A8; - GL_ARRAY_ELEMENT_LOCK_COUNT_EXT = $81A9; -var - glLockArraysEXT: procedure(first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUnlockArraysEXT: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_EXT_compiled_vertex_array: Boolean; - -//***** GL_EXT_convolution *****// -const - GL_CONVOLUTION_1D_EXT = $8010; - GL_CONVOLUTION_2D_EXT = $8011; - GL_SEPARABLE_2D_EXT = $8012; - GL_CONVOLUTION_BORDER_MODE_EXT = $8013; - GL_CONVOLUTION_FILTER_SCALE_EXT = $8014; - GL_CONVOLUTION_FILTER_BIAS_EXT = $8015; - GL_REDUCE_EXT = $8016; - GL_CONVOLUTION_FORMAT_EXT = $8017; - GL_CONVOLUTION_WIDTH_EXT = $8018; - GL_CONVOLUTION_HEIGHT_EXT = $8019; - GL_MAX_CONVOLUTION_WIDTH_EXT = $801A; - GL_MAX_CONVOLUTION_HEIGHT_EXT = $801B; - GL_POST_CONVOLUTION_RED_SCALE_EXT = $801C; - GL_POST_CONVOLUTION_GREEN_SCALE_EXT = $801D; - GL_POST_CONVOLUTION_BLUE_SCALE_EXT = $801E; - GL_POST_CONVOLUTION_ALPHA_SCALE_EXT = $801F; - GL_POST_CONVOLUTION_RED_BIAS_EXT = $8020; - GL_POST_CONVOLUTION_GREEN_BIAS_EXT = $8021; - GL_POST_CONVOLUTION_BLUE_BIAS_EXT = $8022; - GL_POST_CONVOLUTION_ALPHA_BIAS_EXT = $8023; -var - glConvolutionFilter1DEXT: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glConvolutionFilter2DEXT: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyConvolutionFilter1DEXT: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyConvolutionFilter2DEXT: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei; height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetConvolutionFilterEXT: procedure(target: GLenum; format: GLenum; _type: GLenum; image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSeparableFilter2DEXT: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const row: PGLvoid; const column: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetSeparableFilterEXT: procedure(target: GLenum; format: GLenum; _type: GLenum; row: PGLvoid; column: PGLvoid; span: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glConvolutionParameteriEXT: procedure(target: GLenum; pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glConvolutionParameterivEXT: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glConvolutionParameterfEXT: procedure(target: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glConvolutionParameterfvEXT: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetConvolutionParameterivEXT: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetConvolutionParameterfvEXT: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_EXT_convolution: Boolean; - -//***** GL_EXT_histogram *****// -const - GL_HISTOGRAM_EXT = $8024; - GL_PROXY_HISTOGRAM_EXT = $8025; - GL_HISTOGRAM_WIDTH_EXT = $8026; - GL_HISTOGRAM_FORMAT_EXT = $8027; - GL_HISTOGRAM_RED_SIZE_EXT = $8028; - GL_HISTOGRAM_GREEN_SIZE_EXT = $8029; - GL_HISTOGRAM_BLUE_SIZE_EXT = $802A; - GL_HISTOGRAM_ALPHA_SIZE_EXT = $802B; - GL_HISTOGRAM_LUMINANCE_SIZE_EXT = $802C; - GL_HISTOGRAM_SINK_EXT = $802D; - GL_MINMAX_EXT = $802E; - GL_MINMAX_FORMAT_EXT = $802F; - GL_MINMAX_SINK_EXT = $8030; -var - glHistogramEXT: procedure(target: GLenum; width: GLsizei; internalformat: GLenum; sink: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glResetHistogramEXT: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetHistogramEXT: procedure(target: GLenum; reset: GLboolean; format: GLenum; _type: GLenum; values: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetHistogramParameterivEXT: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetHistogramParameterfvEXT: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMinmaxEXT: procedure(target: GLenum; internalformat: GLenum; sink: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glResetMinmaxEXT: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMinmaxEXT: procedure(target: GLenum; reset: GLboolean; format: GLenum; _type: GLenum; values: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMinmaxParameterivEXT: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMinmaxParameterfvEXT: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_EXT_histogram: Boolean; - -//***** GL_EXT_multi_draw_arrays *****// -var - glMultiDrawArraysEXT: procedure(mode: GLenum; first: PGLint; count: PGLsizei; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiDrawElementsEXT: procedure(mode: GLenum; count: PGLsizei; _type: GLenum; const indices: PGLvoid; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_EXT_multi_draw_arrays: Boolean; - -//***** GL_EXT_packed_pixels *****// -const - GL_UNSIGNED_BYTE_3_3_2_EXT = $8032; - GL_UNSIGNED_SHORT_4_4_4_4_EXT = $8033; - GL_UNSIGNED_SHORT_5_5_5_1_EXT = $8034; - GL_UNSIGNED_INT_8_8_8_8_EXT = $8035; - GL_UNSIGNED_INT_10_10_10_2_EXT = $8036; - -function Load_GL_EXT_packed_pixels: Boolean; - -//***** GL_EXT_paletted_texture *****// -const - GL_COLOR_INDEX1_EXT = $80E2; - GL_COLOR_INDEX2_EXT = $80E3; - GL_COLOR_INDEX4_EXT = $80E4; - GL_COLOR_INDEX8_EXT = $80E5; - GL_COLOR_INDEX12_EXT = $80E6; - GL_COLOR_INDEX16_EXT = $80E7; - GL_COLOR_TABLE_FORMAT_EXT = $80D8; - GL_COLOR_TABLE_WIDTH_EXT = $80D9; - GL_COLOR_TABLE_RED_SIZE_EXT = $80DA; - GL_COLOR_TABLE_GREEN_SIZE_EXT = $80DB; - GL_COLOR_TABLE_BLUE_SIZE_EXT = $80DC; - GL_COLOR_TABLE_ALPHA_SIZE_EXT = $80DD; - GL_COLOR_TABLE_LUMINANCE_SIZE_EXT = $80DE; - GL_COLOR_TABLE_INTENSITY_SIZE_EXT = $80DF; - GL_TEXTURE_INDEX_SIZE_EXT = $80ED; - GL_TEXTURE_1D = $0DE0; - GL_TEXTURE_2D = $0DE1; - GL_TEXTURE_3D_EXT = $806F; - // GL_TEXTURE_CUBE_MAP_ARB { already defined } - GL_PROXY_TEXTURE_1D = $8063; - GL_PROXY_TEXTURE_2D = $8064; - GL_PROXY_TEXTURE_3D_EXT = $8070; - // GL_PROXY_TEXTURE_CUBE_MAP_ARB { already defined } - // GL_TEXTURE_1D { already defined } - // GL_TEXTURE_2D { already defined } - // GL_TEXTURE_3D_EXT { already defined } - // GL_TEXTURE_CUBE_MAP_ARB { already defined } -var - glColorTableEXT: procedure(target: GLenum; internalFormat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - // glColorSubTableEXT { already defined } - glGetColorTableEXT: procedure(target: GLenum; format: GLenum; _type: GLenum; data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetColorTableParameterivEXT: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetColorTableParameterfvEXT: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_EXT_paletted_texture: Boolean; - -//***** GL_EXT_point_parameters *****// -const - GL_POINT_SIZE_MIN_EXT = $8126; - GL_POINT_SIZE_MAX_EXT = $8127; - GL_POINT_FADE_THRESHOLD_SIZE_EXT = $8128; - GL_DISTANCE_ATTENUATION_EXT = $8129; -var - glPointParameterfEXT: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPointParameterfvEXT: procedure(pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_EXT_point_parameters: Boolean; - -//***** GL_EXT_polygon_offset *****// -const - GL_POLYGON_OFFSET_EXT = $8037; - GL_POLYGON_OFFSET_FACTOR_EXT = $8038; - GL_POLYGON_OFFSET_BIAS_EXT = $8039; -var - glPolygonOffsetEXT: procedure(factor: GLfloat; bias: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_EXT_polygon_offset: Boolean; - -//***** GL_EXT_separate_specular_color *****// -const - GL_LIGHT_MODEL_COLOR_CONTROL_EXT = $81F8; - GL_SINGLE_COLOR_EXT = $81F9; - GL_SEPARATE_SPECULAR_COLOR_EXT = $81FA; - -function Load_GL_EXT_separate_specular_color: Boolean; - -//***** GL_EXT_shadow_funcs *****// - -function Load_GL_EXT_shadow_funcs: Boolean; - -//***** GL_EXT_shared_texture_palette *****// -const - GL_SHARED_TEXTURE_PALETTE_EXT = $81FB; - -function Load_GL_EXT_shared_texture_palette: Boolean; - -//***** GL_EXT_stencil_two_side *****// -const - GL_STENCIL_TEST_TWO_SIDE_EXT = $8910; - GL_ACTIVE_STENCIL_FACE_EXT = $8911; -var - glActiveStencilFaceEXT: procedure(face: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_EXT_stencil_two_side: Boolean; - -//***** GL_EXT_stencil_wrap *****// -const - GL_INCR_WRAP_EXT = $8507; - GL_DECR_WRAP_EXT = $8508; - -function Load_GL_EXT_stencil_wrap: Boolean; - -//***** GL_EXT_subtexture *****// -var - glTexSubImage1DEXT: procedure(target: GLenum; level: GLint; xoffset: GLint; width: GLsizei; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexSubImage2DEXT: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexSubImage3DEXT: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_EXT_subtexture: Boolean; - -//***** GL_EXT_texture3D *****// -const - GL_PACK_SKIP_IMAGES_EXT = $806B; - GL_PACK_IMAGE_HEIGHT_EXT = $806C; - GL_UNPACK_SKIP_IMAGES_EXT = $806D; - GL_UNPACK_IMAGE_HEIGHT_EXT = $806E; - // GL_TEXTURE_3D_EXT { already defined } - // GL_PROXY_TEXTURE_3D_EXT { already defined } - GL_TEXTURE_DEPTH_EXT = $8071; - GL_TEXTURE_WRAP_R_EXT = $8072; - GL_MAX_3D_TEXTURE_SIZE_EXT = $8073; -var - glTexImage3DEXT: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_EXT_texture3D: Boolean; - -//***** GL_EXT_texture_compression_s3tc *****// -const - GL_COMPRESSED_RGB_S3TC_DXT1_EXT = $83F0; - GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = $83F1; - GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = $83F2; - GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = $83F3; - -function Load_GL_EXT_texture_compression_s3tc: Boolean; - -//***** GL_EXT_texture_env_add *****// - -function Load_GL_EXT_texture_env_add: Boolean; - -//***** GL_EXT_texture_env_combine *****// -const - GL_COMBINE_EXT = $8570; - GL_COMBINE_RGB_EXT = $8571; - GL_COMBINE_ALPHA_EXT = $8572; - GL_SOURCE0_RGB_EXT = $8580; - GL_SOURCE1_RGB_EXT = $8581; - GL_SOURCE2_RGB_EXT = $8582; - GL_SOURCE0_ALPHA_EXT = $8588; - GL_SOURCE1_ALPHA_EXT = $8589; - GL_SOURCE2_ALPHA_EXT = $858A; - GL_OPERAND0_RGB_EXT = $8590; - GL_OPERAND1_RGB_EXT = $8591; - GL_OPERAND2_RGB_EXT = $8592; - GL_OPERAND0_ALPHA_EXT = $8598; - GL_OPERAND1_ALPHA_EXT = $8599; - GL_OPERAND2_ALPHA_EXT = $859A; - GL_RGB_SCALE_EXT = $8573; - GL_ADD_SIGNED_EXT = $8574; - GL_INTERPOLATE_EXT = $8575; - GL_CONSTANT_EXT = $8576; - GL_PRIMARY_COLOR_EXT = $8577; - GL_PREVIOUS_EXT = $8578; - -function Load_GL_EXT_texture_env_combine: Boolean; - -//***** GL_EXT_texture_env_dot3 *****// -const - GL_DOT3_RGB_EXT = $8740; - GL_DOT3_RGBA_EXT = $8741; - -function Load_GL_EXT_texture_env_dot3: Boolean; - -//***** GL_EXT_texture_filter_anisotropic *****// -const - GL_TEXTURE_MAX_ANISOTROPY_EXT = $84FE; - GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = $84FF; - -function Load_GL_EXT_texture_filter_anisotropic: Boolean; - -//***** GL_EXT_texture_lod_bias *****// -const - GL_TEXTURE_FILTER_CONTROL_EXT = $8500; - GL_TEXTURE_LOD_BIAS_EXT = $8501; - GL_MAX_TEXTURE_LOD_BIAS_EXT = $84FD; - -function Load_GL_EXT_texture_lod_bias: Boolean; - -//***** GL_EXT_texture_object *****// -const - GL_TEXTURE_PRIORITY_EXT = $8066; - GL_TEXTURE_RESIDENT_EXT = $8067; - GL_TEXTURE_1D_BINDING_EXT = $8068; - GL_TEXTURE_2D_BINDING_EXT = $8069; - GL_TEXTURE_3D_BINDING_EXT = $806A; -var - glGenTexturesEXT: procedure(n: GLsizei; textures: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteTexturesEXT: procedure(n: GLsizei; const textures: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBindTextureEXT: procedure(target: GLenum; texture: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPrioritizeTexturesEXT: procedure(n: GLsizei; const textures: PGLuint; const priorities: PGLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glAreTexturesResidentEXT: function(n: GLsizei; const textures: PGLuint; residences: PGLboolean): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsTextureEXT: function(texture: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_EXT_texture_object: Boolean; - -//***** GL_EXT_vertex_array *****// -const - GL_VERTEX_ARRAY_EXT = $8074; - GL_NORMAL_ARRAY_EXT = $8075; - GL_COLOR_ARRAY_EXT = $8076; - GL_INDEX_ARRAY_EXT = $8077; - GL_TEXTURE_COORD_ARRAY_EXT = $8078; - GL_EDGE_FLAG_ARRAY_EXT = $8079; - GL_DOUBLE_EXT = $140A; - GL_VERTEX_ARRAY_SIZE_EXT = $807A; - GL_VERTEX_ARRAY_TYPE_EXT = $807B; - GL_VERTEX_ARRAY_STRIDE_EXT = $807C; - GL_VERTEX_ARRAY_COUNT_EXT = $807D; - GL_NORMAL_ARRAY_TYPE_EXT = $807E; - GL_NORMAL_ARRAY_STRIDE_EXT = $807F; - GL_NORMAL_ARRAY_COUNT_EXT = $8080; - GL_COLOR_ARRAY_SIZE_EXT = $8081; - GL_COLOR_ARRAY_TYPE_EXT = $8082; - GL_COLOR_ARRAY_STRIDE_EXT = $8083; - GL_COLOR_ARRAY_COUNT_EXT = $8084; - GL_INDEX_ARRAY_TYPE_EXT = $8085; - GL_INDEX_ARRAY_STRIDE_EXT = $8086; - GL_INDEX_ARRAY_COUNT_EXT = $8087; - GL_TEXTURE_COORD_ARRAY_SIZE_EXT = $8088; - GL_TEXTURE_COORD_ARRAY_TYPE_EXT = $8089; - GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = $808A; - GL_TEXTURE_COORD_ARRAY_COUNT_EXT = $808B; - GL_EDGE_FLAG_ARRAY_STRIDE_EXT = $808C; - GL_EDGE_FLAG_ARRAY_COUNT_EXT = $808D; - GL_VERTEX_ARRAY_POINTER_EXT = $808E; - GL_NORMAL_ARRAY_POINTER_EXT = $808F; - GL_COLOR_ARRAY_POINTER_EXT = $8090; - GL_INDEX_ARRAY_POINTER_EXT = $8091; - GL_TEXTURE_COORD_ARRAY_POINTER_EXT = $8092; - GL_EDGE_FLAG_ARRAY_POINTER_EXT = $8093; -var - glArrayElementEXT: procedure(i: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDrawArraysEXT: procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalPointerEXT: procedure(_type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexPointerEXT: procedure(_type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoordPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEdgeFlagPointerEXT: procedure(stride: GLsizei; count: GLsizei; const pointer: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetPointervEXT: procedure(pname: GLenum; params: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_EXT_vertex_array: Boolean; - -//***** GL_EXT_vertex_shader *****// -const - GL_VERTEX_SHADER_EXT = $8780; - GL_VARIANT_VALUE_EXT = $87E4; - GL_VARIANT_DATATYPE_EXT = $87E5; - GL_VARIANT_ARRAY_STRIDE_EXT = $87E6; - GL_VARIANT_ARRAY_TYPE_EXT = $87E7; - GL_VARIANT_ARRAY_EXT = $87E8; - GL_VARIANT_ARRAY_POINTER_EXT = $87E9; - GL_INVARIANT_VALUE_EXT = $87EA; - GL_INVARIANT_DATATYPE_EXT = $87EB; - GL_LOCAL_CONSTANT_VALUE_EXT = $87EC; - GL_LOCAL_CONSTANT_DATATYPE_EXT = $87ED; - GL_OP_INDEX_EXT = $8782; - GL_OP_NEGATE_EXT = $8783; - GL_OP_DOT3_EXT = $8784; - GL_OP_DOT4_EXT = $8785; - GL_OP_MUL_EXT = $8786; - GL_OP_ADD_EXT = $8787; - GL_OP_MADD_EXT = $8788; - GL_OP_FRAC_EXT = $8789; - GL_OP_MAX_EXT = $878A; - GL_OP_MIN_EXT = $878B; - GL_OP_SET_GE_EXT = $878C; - GL_OP_SET_LT_EXT = $878D; - GL_OP_CLAMP_EXT = $878E; - GL_OP_FLOOR_EXT = $878F; - GL_OP_ROUND_EXT = $8790; - GL_OP_EXP_BASE_2_EXT = $8791; - GL_OP_LOG_BASE_2_EXT = $8792; - GL_OP_POWER_EXT = $8793; - GL_OP_RECIP_EXT = $8794; - GL_OP_RECIP_SQRT_EXT = $8795; - GL_OP_SUB_EXT = $8796; - GL_OP_CROSS_PRODUCT_EXT = $8797; - GL_OP_MULTIPLY_MATRIX_EXT = $8798; - GL_OP_MOV_EXT = $8799; - GL_OUTPUT_VERTEX_EXT = $879A; - GL_OUTPUT_COLOR0_EXT = $879B; - GL_OUTPUT_COLOR1_EXT = $879C; - GL_OUTPUT_TEXTURE_COORD0_EXT = $879D; - GL_OUTPUT_TEXTURE_COORD1_EXT = $879E; - GL_OUTPUT_TEXTURE_COORD2_EXT = $879F; - GL_OUTPUT_TEXTURE_COORD3_EXT = $87A0; - GL_OUTPUT_TEXTURE_COORD4_EXT = $87A1; - GL_OUTPUT_TEXTURE_COORD5_EXT = $87A2; - GL_OUTPUT_TEXTURE_COORD6_EXT = $87A3; - GL_OUTPUT_TEXTURE_COORD7_EXT = $87A4; - GL_OUTPUT_TEXTURE_COORD8_EXT = $87A5; - GL_OUTPUT_TEXTURE_COORD9_EXT = $87A6; - GL_OUTPUT_TEXTURE_COORD10_EXT = $87A7; - GL_OUTPUT_TEXTURE_COORD11_EXT = $87A8; - GL_OUTPUT_TEXTURE_COORD12_EXT = $87A9; - GL_OUTPUT_TEXTURE_COORD13_EXT = $87AA; - GL_OUTPUT_TEXTURE_COORD14_EXT = $87AB; - GL_OUTPUT_TEXTURE_COORD15_EXT = $87AC; - GL_OUTPUT_TEXTURE_COORD16_EXT = $87AD; - GL_OUTPUT_TEXTURE_COORD17_EXT = $87AE; - GL_OUTPUT_TEXTURE_COORD18_EXT = $87AF; - GL_OUTPUT_TEXTURE_COORD19_EXT = $87B0; - GL_OUTPUT_TEXTURE_COORD20_EXT = $87B1; - GL_OUTPUT_TEXTURE_COORD21_EXT = $87B2; - GL_OUTPUT_TEXTURE_COORD22_EXT = $87B3; - GL_OUTPUT_TEXTURE_COORD23_EXT = $87B4; - GL_OUTPUT_TEXTURE_COORD24_EXT = $87B5; - GL_OUTPUT_TEXTURE_COORD25_EXT = $87B6; - GL_OUTPUT_TEXTURE_COORD26_EXT = $87B7; - GL_OUTPUT_TEXTURE_COORD27_EXT = $87B8; - GL_OUTPUT_TEXTURE_COORD28_EXT = $87B9; - GL_OUTPUT_TEXTURE_COORD29_EXT = $87BA; - GL_OUTPUT_TEXTURE_COORD30_EXT = $87BB; - GL_OUTPUT_TEXTURE_COORD31_EXT = $87BC; - GL_OUTPUT_FOG_EXT = $87BD; - GL_SCALAR_EXT = $87BE; - GL_VECTOR_EXT = $87BF; - GL_MATRIX_EXT = $87C0; - GL_VARIANT_EXT = $87C1; - GL_INVARIANT_EXT = $87C2; - GL_LOCAL_CONSTANT_EXT = $87C3; - GL_LOCAL_EXT = $87C4; - GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT = $87C5; - GL_MAX_VERTEX_SHADER_VARIANTS_EXT = $87C6; - GL_MAX_VERTEX_SHADER_INVARIANTS_EXT = $87C7; - GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = $87C8; - GL_MAX_VERTEX_SHADER_LOCALS_EXT = $87C9; - GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT = $87CA; - GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT = $87CB; - GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = $87CC; - GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT = $87CD; - GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT = $87CE; - GL_VERTEX_SHADER_INSTRUCTIONS_EXT = $87CF; - GL_VERTEX_SHADER_VARIANTS_EXT = $87D0; - GL_VERTEX_SHADER_INVARIANTS_EXT = $87D1; - GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = $87D2; - GL_VERTEX_SHADER_LOCALS_EXT = $87D3; - GL_VERTEX_SHADER_BINDING_EXT = $8781; - GL_VERTEX_SHADER_OPTIMIZED_EXT = $87D4; - GL_X_EXT = $87D5; - GL_Y_EXT = $87D6; - GL_Z_EXT = $87D7; - GL_W_EXT = $87D8; - GL_NEGATIVE_X_EXT = $87D9; - GL_NEGATIVE_Y_EXT = $87DA; - GL_NEGATIVE_Z_EXT = $87DB; - GL_NEGATIVE_W_EXT = $87DC; - GL_ZERO_EXT = $87DD; - GL_ONE_EXT = $87DE; - GL_NEGATIVE_ONE_EXT = $87DF; - GL_NORMALIZED_RANGE_EXT = $87E0; - GL_FULL_RANGE_EXT = $87E1; - GL_CURRENT_VERTEX_EXT = $87E2; - GL_MVP_MATRIX_EXT = $87E3; -var - glBeginVertexShaderEXT: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEndVertexShaderEXT: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBindVertexShaderEXT: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGenVertexShadersEXT: function(range: GLuint): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteVertexShaderEXT: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glShaderOp1EXT: procedure(op: GLenum; res: GLuint; arg1: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glShaderOp2EXT: procedure(op: GLenum; res: GLuint; arg1: GLuint; arg2: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glShaderOp3EXT: procedure(op: GLenum; res: GLuint; arg1: GLuint; arg2: GLuint; arg3: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSwizzleEXT: procedure(res: GLuint; _in: GLuint; outX: GLenum; outY: GLenum; outZ: GLenum; outW: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWriteMaskEXT: procedure(res: GLuint; _in: GLuint; outX: GLenum; outY: GLenum; outZ: GLenum; outW: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glInsertComponentEXT: procedure(res: GLuint; src: GLuint; num: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glExtractComponentEXT: procedure(res: GLuint; src: GLuint; num: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGenSymbolsEXT: function(datatype: GLenum; storagetype: GLenum; range: GLenum; components: GLuint): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSetInvariantEXT: procedure(id: GLuint; _type: GLenum; addr: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSetLocalConstantEXT: procedure(id: GLuint; _type: GLenum; addr: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVariantbvEXT: procedure(id: GLuint; addr: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVariantsvEXT: procedure(id: GLuint; addr: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVariantivEXT: procedure(id: GLuint; addr: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVariantfvEXT: procedure(id: GLuint; addr: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVariantdvEXT: procedure(id: GLuint; addr: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVariantubvEXT: procedure(id: GLuint; addr: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVariantusvEXT: procedure(id: GLuint; addr: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVariantuivEXT: procedure(id: GLuint; addr: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVariantPointerEXT: procedure(id: GLuint; _type: GLenum; stride: GLuint; addr: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEnableVariantClientStateEXT: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDisableVariantClientStateEXT: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBindLightParameterEXT: function(light: GLenum; value: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBindMaterialParameterEXT: function(face: GLenum; value: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBindTexGenParameterEXT: function(_unit: GLenum; coord: GLenum; value: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBindTextureUnitParameterEXT: function(_unit: GLenum; value: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBindParameterEXT: function(value: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsVariantEnabledEXT: function(id: GLuint; cap: GLenum): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVariantBooleanvEXT: procedure(id: GLuint; value: GLenum; data: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVariantIntegervEXT: procedure(id: GLuint; value: GLenum; data: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVariantFloatvEXT: procedure(id: GLuint; value: GLenum; data: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVariantPointervEXT: procedure(id: GLuint; value: GLenum; data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetInvariantBooleanvEXT: procedure(id: GLuint; value: GLenum; data: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetInvariantIntegervEXT: procedure(id: GLuint; value: GLenum; data: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetInvariantFloatvEXT: procedure(id: GLuint; value: GLenum; data: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetLocalConstantBooleanvEXT: procedure(id: GLuint; value: GLenum; data: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetLocalConstantIntegervEXT: procedure(id: GLuint; value: GLenum; data: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetLocalConstantFloatvEXT: procedure(id: GLuint; value: GLenum; data: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_EXT_vertex_shader: Boolean; - -//***** GL_EXT_vertex_weighting *****// -const - GL_VERTEX_WEIGHTING_EXT = $8509; - GL_MODELVIEW0_EXT = $1700; - GL_MODELVIEW1_EXT = $850A; - GL_MODELVIEW0_MATRIX_EXT = $0BA6; - GL_MODELVIEW1_MATRIX_EXT = $8506; - GL_CURRENT_VERTEX_WEIGHT_EXT = $850B; - GL_VERTEX_WEIGHT_ARRAY_EXT = $850C; - GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT = $850D; - GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT = $850E; - GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT = $850F; - GL_MODELVIEW0_STACK_DEPTH_EXT = $0BA3; - GL_MODELVIEW1_STACK_DEPTH_EXT = $8502; - GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT = $8510; -var - glVertexWeightfEXT: procedure(weight: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexWeightfvEXT: procedure(weight: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexWeightPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_EXT_vertex_weighting: Boolean; - -//***** GL_HP_occlusion_test *****// -const - GL_OCCLUSION_TEST_HP = $8165; - GL_OCCLUSION_TEST_RESULT_HP = $8166; - -function Load_GL_HP_occlusion_test: Boolean; - -//***** GL_NV_blend_square *****// - -function Load_GL_NV_blend_square: Boolean; - -//***** GL_NV_copy_depth_to_color *****// -const - GL_DEPTH_STENCIL_TO_RGBA_NV = $886E; - GL_DEPTH_STENCIL_TO_BGRA_NV = $886F; - -function Load_GL_NV_copy_depth_to_color: Boolean; - -//***** GL_NV_depth_clamp *****// -const - GL_DEPTH_CLAMP_NV = $864F; - -function Load_GL_NV_depth_clamp: Boolean; - -//***** GL_NV_evaluators *****// -const - GL_EVAL_2D_NV = $86C0; - GL_EVAL_TRIANGULAR_2D_NV = $86C1; - GL_MAP_TESSELLATION_NV = $86C2; - GL_MAP_ATTRIB_U_ORDER_NV = $86C3; - GL_MAP_ATTRIB_V_ORDER_NV = $86C4; - GL_EVAL_FRACTIONAL_TESSELLATION_NV = $86C5; - GL_EVAL_VERTEX_ATTRIB0_NV = $86C6; - GL_EVAL_VERTEX_ATTRIB1_NV = $86C7; - GL_EVAL_VERTEX_ATTRIB2_NV = $86C8; - GL_EVAL_VERTEX_ATTRIB3_NV = $86C9; - GL_EVAL_VERTEX_ATTRIB4_NV = $86CA; - GL_EVAL_VERTEX_ATTRIB5_NV = $86CB; - GL_EVAL_VERTEX_ATTRIB6_NV = $86CC; - GL_EVAL_VERTEX_ATTRIB7_NV = $86CD; - GL_EVAL_VERTEX_ATTRIB8_NV = $86CE; - GL_EVAL_VERTEX_ATTRIB9_NV = $86CF; - GL_EVAL_VERTEX_ATTRIB10_NV = $86D0; - GL_EVAL_VERTEX_ATTRIB11_NV = $86D1; - GL_EVAL_VERTEX_ATTRIB12_NV = $86D2; - GL_EVAL_VERTEX_ATTRIB13_NV = $86D3; - GL_EVAL_VERTEX_ATTRIB14_NV = $86D4; - GL_EVAL_VERTEX_ATTRIB15_NV = $86D5; - GL_MAX_MAP_TESSELLATION_NV = $86D6; - GL_MAX_RATIONAL_EVAL_ORDER_NV = $86D7; -var - glMapControlPointsNV: procedure(target: GLenum; index: GLuint; _type: GLenum; ustride: GLsizei; vstride: GLsizei; uorder: GLint; vorder: GLint; _packed: GLboolean; const points: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMapParameterivNV: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMapParameterfvNV: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMapControlPointsNV: procedure(target: GLenum; index: GLuint; _type: GLenum; ustride: GLsizei; vstride: GLsizei; _packed: GLboolean; points: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMapParameterivNV: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMapParameterfvNV: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMapAttribParameterivNV: procedure(target: GLenum; index: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMapAttribParameterfvNV: procedure(target: GLenum; index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalMapsNV: procedure(target: GLenum; mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_NV_evaluators: Boolean; - -//***** GL_NV_fence *****// -const - GL_ALL_COMPLETED_NV = $84F2; - GL_FENCE_STATUS_NV = $84F3; - GL_FENCE_CONDITION_NV = $84F4; -var - glGenFencesNV: procedure(n: GLsizei; fences: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteFencesNV: procedure(n: GLsizei; const fences: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSetFenceNV: procedure(fence: GLuint; condition: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTestFenceNV: function(fence: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFinishFenceNV: procedure(fence: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsFenceNV: function(fence: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetFenceivNV: procedure(fence: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_NV_fence: Boolean; - -//***** GL_NV_fog_distance *****// -const - GL_FOG_DISTANCE_MODE_NV = $855A; - GL_EYE_RADIAL_NV = $855B; - GL_EYE_PLANE_ABSOLUTE_NV = $855C; - -function Load_GL_NV_fog_distance: Boolean; - -//***** GL_NV_light_max_exponent *****// -const - GL_MAX_SHININESS_NV = $8504; - GL_MAX_SPOT_EXPONENT_NV = $8505; - -function Load_GL_NV_light_max_exponent: Boolean; - -//***** GL_NV_multisample_filter_hint *****// -const - GL_MULTISAMPLE_FILTER_HINT_NV = $8534; - -function Load_GL_NV_multisample_filter_hint: Boolean; - -//***** GL_NV_occlusion_query *****// - // GL_OCCLUSION_TEST_HP { already defined } - // GL_OCCLUSION_TEST_RESULT_HP { already defined } -const - GL_PIXEL_COUNTER_BITS_NV = $8864; - GL_CURRENT_OCCLUSION_QUERY_ID_NV = $8865; - GL_PIXEL_COUNT_NV = $8866; - GL_PIXEL_COUNT_AVAILABLE_NV = $8867; -var - glGenOcclusionQueriesNV: procedure(n: GLsizei; ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteOcclusionQueriesNV: procedure(n: GLsizei; const ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsOcclusionQueryNV: function(id: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBeginOcclusionQueryNV: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEndOcclusionQueryNV: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetOcclusionQueryivNV: procedure(id: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetOcclusionQueryuivNV: procedure(id: GLuint; pname: GLenum; params: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_NV_occlusion_query: Boolean; - -//***** GL_NV_packed_depth_stencil *****// -const - GL_DEPTH_STENCIL_NV = $84F9; - GL_UNSIGNED_INT_24_8_NV = $84FA; - -function Load_GL_NV_packed_depth_stencil: Boolean; - -//***** GL_NV_point_sprite *****// -const - GL_POINT_SPRITE_NV = $8861; - GL_COORD_REPLACE_NV = $8862; - GL_POINT_SPRITE_R_MODE_NV = $8863; -var - glPointParameteriNV: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPointParameterivNV: procedure(pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_NV_point_sprite: Boolean; - -//***** GL_NV_register_combiners *****// -const - GL_REGISTER_COMBINERS_NV = $8522; - GL_COMBINER0_NV = $8550; - GL_COMBINER1_NV = $8551; - GL_COMBINER2_NV = $8552; - GL_COMBINER3_NV = $8553; - GL_COMBINER4_NV = $8554; - GL_COMBINER5_NV = $8555; - GL_COMBINER6_NV = $8556; - GL_COMBINER7_NV = $8557; - GL_VARIABLE_A_NV = $8523; - GL_VARIABLE_B_NV = $8524; - GL_VARIABLE_C_NV = $8525; - GL_VARIABLE_D_NV = $8526; - GL_VARIABLE_E_NV = $8527; - GL_VARIABLE_F_NV = $8528; - GL_VARIABLE_G_NV = $8529; - GL_CONSTANT_COLOR0_NV = $852A; - GL_CONSTANT_COLOR1_NV = $852B; - GL_PRIMARY_COLOR_NV = $852C; - GL_SECONDARY_COLOR_NV = $852D; - GL_SPARE0_NV = $852E; - GL_SPARE1_NV = $852F; - GL_UNSIGNED_IDENTITY_NV = $8536; - GL_UNSIGNED_INVERT_NV = $8537; - GL_EXPAND_NORMAL_NV = $8538; - GL_EXPAND_NEGATE_NV = $8539; - GL_HALF_BIAS_NORMAL_NV = $853A; - GL_HALF_BIAS_NEGATE_NV = $853B; - GL_SIGNED_IDENTITY_NV = $853C; - GL_SIGNED_NEGATE_NV = $853D; - GL_E_TIMES_F_NV = $8531; - GL_SPARE0_PLUS_SECONDARY_COLOR_NV = $8532; - GL_SCALE_BY_TWO_NV = $853E; - GL_SCALE_BY_FOUR_NV = $853F; - GL_SCALE_BY_ONE_HALF_NV = $8540; - GL_BIAS_BY_NEGATIVE_ONE_HALF_NV = $8541; - GL_DISCARD_NV = $8530; - GL_COMBINER_INPUT_NV = $8542; - GL_COMBINER_MAPPING_NV = $8543; - GL_COMBINER_COMPONENT_USAGE_NV = $8544; - GL_COMBINER_AB_DOT_PRODUCT_NV = $8545; - GL_COMBINER_CD_DOT_PRODUCT_NV = $8546; - GL_COMBINER_MUX_SUM_NV = $8547; - GL_COMBINER_SCALE_NV = $8548; - GL_COMBINER_BIAS_NV = $8549; - GL_COMBINER_AB_OUTPUT_NV = $854A; - GL_COMBINER_CD_OUTPUT_NV = $854B; - GL_COMBINER_SUM_OUTPUT_NV = $854C; - GL_NUM_GENERAL_COMBINERS_NV = $854E; - GL_COLOR_SUM_CLAMP_NV = $854F; - GL_MAX_GENERAL_COMBINERS_NV = $854D; -var - glCombinerParameterfvNV: procedure(pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCombinerParameterivNV: procedure(pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCombinerParameterfNV: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCombinerParameteriNV: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCombinerInputNV: procedure(stage: GLenum; portion: GLenum; variable: GLenum; input: GLenum; mapping: GLenum; componentUsage: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCombinerOutputNV: procedure(stage: GLenum; portion: GLenum; abOutput: GLenum; cdOutput: GLenum; sumOutput: GLenum; scale: GLenum; bias: GLenum; abDotProduct: GLboolean; cdDotProduct: GLboolean; muxSum: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFinalCombinerInputNV: procedure(variable: GLenum; input: GLenum; mapping: GLenum; componentUsage: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetCombinerInputParameterfvNV: procedure(stage: GLenum; portion: GLenum; variable: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetCombinerInputParameterivNV: procedure(stage: GLenum; portion: GLenum; variable: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetCombinerOutputParameterfvNV: procedure(stage: GLenum; portion: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetCombinerOutputParameterivNV: procedure(stage: GLenum; portion: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetFinalCombinerInputParameterfvNV: procedure(variable: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetFinalCombinerInputParameterivNV: procedure(variable: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_NV_register_combiners: Boolean; - -//***** GL_NV_register_combiners2 *****// -const - GL_PER_STAGE_CONSTANTS_NV = $8535; -var - glCombinerStageParameterfvNV: procedure(stage: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetCombinerStageParameterfvNV: procedure(stage: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_NV_register_combiners2: Boolean; - -//***** GL_NV_texgen_emboss *****// -const - GL_EMBOSS_MAP_NV = $855F; - GL_EMBOSS_LIGHT_NV = $855D; - GL_EMBOSS_CONSTANT_NV = $855E; - -function Load_GL_NV_texgen_emboss: Boolean; - -//***** GL_NV_texgen_reflection *****// -const - GL_NORMAL_MAP_NV = $8511; - GL_REFLECTION_MAP_NV = $8512; - -function Load_GL_NV_texgen_reflection: Boolean; - -//***** GL_NV_texture_compression_vtc *****// - // GL_COMPRESSED_RGB_S3TC_DXT1_EXT { already defined } - // GL_COMPRESSED_RGBA_S3TC_DXT1_EXT { already defined } - // GL_COMPRESSED_RGBA_S3TC_DXT3_EXT { already defined } - // GL_COMPRESSED_RGBA_S3TC_DXT5_EXT { already defined } - -function Load_GL_NV_texture_compression_vtc: Boolean; - -//***** GL_NV_texture_env_combine4 *****// -const - GL_COMBINE4_NV = $8503; - GL_SOURCE3_RGB_NV = $8583; - GL_SOURCE3_ALPHA_NV = $858B; - GL_OPERAND3_RGB_NV = $8593; - GL_OPERAND3_ALPHA_NV = $859B; - -function Load_GL_NV_texture_env_combine4: Boolean; - -//***** GL_NV_texture_rectangle *****// -const - GL_TEXTURE_RECTANGLE_NV = $84F5; - GL_TEXTURE_BINDING_RECTANGLE_NV = $84F6; - GL_PROXY_TEXTURE_RECTANGLE_NV = $84F7; - GL_MAX_RECTANGLE_TEXTURE_SIZE_NV = $84F8; - -function Load_GL_NV_texture_rectangle: Boolean; - -//***** GL_NV_texture_shader *****// -const - GL_TEXTURE_SHADER_NV = $86DE; - GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV = $86D9; - GL_SHADER_OPERATION_NV = $86DF; - GL_CULL_MODES_NV = $86E0; - GL_OFFSET_TEXTURE_MATRIX_NV = $86E1; - GL_OFFSET_TEXTURE_SCALE_NV = $86E2; - GL_OFFSET_TEXTURE_BIAS_NV = $86E3; - GL_PREVIOUS_TEXTURE_INPUT_NV = $86E4; - GL_CONST_EYE_NV = $86E5; - GL_SHADER_CONSISTENT_NV = $86DD; - GL_PASS_THROUGH_NV = $86E6; - GL_CULL_FRAGMENT_NV = $86E7; - GL_OFFSET_TEXTURE_2D_NV = $86E8; - GL_OFFSET_TEXTURE_RECTANGLE_NV = $864C; - GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV = $864D; - GL_DEPENDENT_AR_TEXTURE_2D_NV = $86E9; - GL_DEPENDENT_GB_TEXTURE_2D_NV = $86EA; - GL_DOT_PRODUCT_NV = $86EC; - GL_DOT_PRODUCT_DEPTH_REPLACE_NV = $86ED; - GL_DOT_PRODUCT_TEXTURE_2D_NV = $86EE; - GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV = $864E; - GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV = $86F0; - GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV = $86F1; - GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV = $86F2; - GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV = $86F3; - GL_HILO_NV = $86F4; - GL_DSDT_NV = $86F5; - GL_DSDT_MAG_NV = $86F6; - GL_DSDT_MAG_VIB_NV = $86F7; - GL_UNSIGNED_INT_S8_S8_8_8_NV = $86DA; - GL_UNSIGNED_INT_8_8_S8_S8_REV_NV = $86DB; - GL_SIGNED_RGBA_NV = $86FB; - GL_SIGNED_RGBA8_NV = $86FC; - GL_SIGNED_RGB_NV = $86FE; - GL_SIGNED_RGB8_NV = $86FF; - GL_SIGNED_LUMINANCE_NV = $8701; - GL_SIGNED_LUMINANCE8_NV = $8702; - GL_SIGNED_LUMINANCE_ALPHA_NV = $8703; - GL_SIGNED_LUMINANCE8_ALPHA8_NV = $8704; - GL_SIGNED_ALPHA_NV = $8705; - GL_SIGNED_ALPHA8_NV = $8706; - GL_SIGNED_INTENSITY_NV = $8707; - GL_SIGNED_INTENSITY8_NV = $8708; - GL_SIGNED_RGB_UNSIGNED_ALPHA_NV = $870C; - GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV = $870D; - GL_HILO16_NV = $86F8; - GL_SIGNED_HILO_NV = $86F9; - GL_SIGNED_HILO16_NV = $86FA; - GL_DSDT8_NV = $8709; - GL_DSDT8_MAG8_NV = $870A; - GL_DSDT_MAG_INTENSITY_NV = $86DC; - GL_DSDT8_MAG8_INTENSITY8_NV = $870B; - GL_HI_SCALE_NV = $870E; - GL_LO_SCALE_NV = $870F; - GL_DS_SCALE_NV = $8710; - GL_DT_SCALE_NV = $8711; - GL_MAGNITUDE_SCALE_NV = $8712; - GL_VIBRANCE_SCALE_NV = $8713; - GL_HI_BIAS_NV = $8714; - GL_LO_BIAS_NV = $8715; - GL_DS_BIAS_NV = $8716; - GL_DT_BIAS_NV = $8717; - GL_MAGNITUDE_BIAS_NV = $8718; - GL_VIBRANCE_BIAS_NV = $8719; - GL_TEXTURE_BORDER_VALUES_NV = $871A; - GL_TEXTURE_HI_SIZE_NV = $871B; - GL_TEXTURE_LO_SIZE_NV = $871C; - GL_TEXTURE_DS_SIZE_NV = $871D; - GL_TEXTURE_DT_SIZE_NV = $871E; - GL_TEXTURE_MAG_SIZE_NV = $871F; - -function Load_GL_NV_texture_shader: Boolean; - -//***** GL_NV_texture_shader2 *****// -const - GL_DOT_PRODUCT_TEXTURE_3D_NV = $86EF; - // GL_HILO_NV { already defined } - // GL_DSDT_NV { already defined } - // GL_DSDT_MAG_NV { already defined } - // GL_DSDT_MAG_VIB_NV { already defined } - // GL_UNSIGNED_INT_S8_S8_8_8_NV { already defined } - // GL_UNSIGNED_INT_8_8_S8_S8_REV_NV { already defined } - // GL_SIGNED_RGBA_NV { already defined } - // GL_SIGNED_RGBA8_NV { already defined } - // GL_SIGNED_RGB_NV { already defined } - // GL_SIGNED_RGB8_NV { already defined } - // GL_SIGNED_LUMINANCE_NV { already defined } - // GL_SIGNED_LUMINANCE8_NV { already defined } - // GL_SIGNED_LUMINANCE_ALPHA_NV { already defined } - // GL_SIGNED_LUMINANCE8_ALPHA8_NV { already defined } - // GL_SIGNED_ALPHA_NV { already defined } - // GL_SIGNED_ALPHA8_NV { already defined } - // GL_SIGNED_INTENSITY_NV { already defined } - // GL_SIGNED_INTENSITY8_NV { already defined } - // GL_SIGNED_RGB_UNSIGNED_ALPHA_NV { already defined } - // GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV { already defined } - // GL_HILO16_NV { already defined } - // GL_SIGNED_HILO_NV { already defined } - // GL_SIGNED_HILO16_NV { already defined } - // GL_DSDT8_NV { already defined } - // GL_DSDT8_MAG8_NV { already defined } - // GL_DSDT_MAG_INTENSITY_NV { already defined } - // GL_DSDT8_MAG8_INTENSITY8_NV { already defined } - -function Load_GL_NV_texture_shader2: Boolean; - -//***** GL_NV_texture_shader3 *****// -const - GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV = $8850; - GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV = $8851; - GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV = $8852; - GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV = $8853; - GL_OFFSET_HILO_TEXTURE_2D_NV = $8854; - GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV = $8855; - GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV = $8856; - GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV = $8857; - GL_DEPENDENT_HILO_TEXTURE_2D_NV = $8858; - GL_DEPENDENT_RGB_TEXTURE_3D_NV = $8859; - GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV = $885A; - GL_DOT_PRODUCT_PASS_THROUGH_NV = $885B; - GL_DOT_PRODUCT_TEXTURE_1D_NV = $885C; - GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV = $885D; - GL_HILO8_NV = $885E; - GL_SIGNED_HILO8_NV = $885F; - GL_FORCE_BLUE_TO_ONE_NV = $8860; - -function Load_GL_NV_texture_shader3: Boolean; - -//***** GL_NV_vertex_array_range *****// -const - GL_VERTEX_ARRAY_RANGE_NV = $851D; - GL_VERTEX_ARRAY_RANGE_LENGTH_NV = $851E; - GL_VERTEX_ARRAY_RANGE_VALID_NV = $851F; - GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV = $8520; - GL_VERTEX_ARRAY_RANGE_POINTER_NV = $8521; -var - glVertexArrayRangeNV: procedure(length: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFlushVertexArrayRangeNV: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} -{$IFDEF Win32} - wglAllocateMemoryNV: function(size: GLsizei; readFrequency: GLfloat; writeFrequency: GLfloat; priority: GLfloat): PGLvoid; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglFreeMemoryNV: procedure(pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} -{$ENDIF} - -function Load_GL_NV_vertex_array_range: Boolean; - -//***** GL_NV_vertex_array_range2 *****// -const - GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV = $8533; - -function Load_GL_NV_vertex_array_range2: Boolean; - -//***** GL_NV_vertex_program *****// -const - GL_VERTEX_PROGRAM_NV = $8620; - GL_VERTEX_PROGRAM_POINT_SIZE_NV = $8642; - GL_VERTEX_PROGRAM_TWO_SIDE_NV = $8643; - GL_VERTEX_STATE_PROGRAM_NV = $8621; - GL_ATTRIB_ARRAY_SIZE_NV = $8623; - GL_ATTRIB_ARRAY_STRIDE_NV = $8624; - GL_ATTRIB_ARRAY_TYPE_NV = $8625; - GL_CURRENT_ATTRIB_NV = $8626; - GL_PROGRAM_PARAMETER_NV = $8644; - GL_ATTRIB_ARRAY_POINTER_NV = $8645; - GL_PROGRAM_TARGET_NV = $8646; - GL_PROGRAM_LENGTH_NV = $8627; - GL_PROGRAM_RESIDENT_NV = $8647; - GL_PROGRAM_STRING_NV = $8628; - GL_TRACK_MATRIX_NV = $8648; - GL_TRACK_MATRIX_TRANSFORM_NV = $8649; - GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV = $862E; - GL_MAX_TRACK_MATRICES_NV = $862F; - GL_CURRENT_MATRIX_STACK_DEPTH_NV = $8640; - GL_CURRENT_MATRIX_NV = $8641; - GL_VERTEX_PROGRAM_BINDING_NV = $864A; - GL_PROGRAM_ERROR_POSITION_NV = $864B; - GL_MODELVIEW_PROJECTION_NV = $8629; - GL_MATRIX0_NV = $8630; - GL_MATRIX1_NV = $8631; - GL_MATRIX2_NV = $8632; - GL_MATRIX3_NV = $8633; - GL_MATRIX4_NV = $8634; - GL_MATRIX5_NV = $8635; - GL_MATRIX6_NV = $8636; - GL_MATRIX7_NV = $8637; - GL_IDENTITY_NV = $862A; - GL_INVERSE_NV = $862B; - GL_TRANSPOSE_NV = $862C; - GL_INVERSE_TRANSPOSE_NV = $862D; - GL_VERTEX_ATTRIB_ARRAY0_NV = $8650; - GL_VERTEX_ATTRIB_ARRAY1_NV = $8651; - GL_VERTEX_ATTRIB_ARRAY2_NV = $8652; - GL_VERTEX_ATTRIB_ARRAY3_NV = $8653; - GL_VERTEX_ATTRIB_ARRAY4_NV = $8654; - GL_VERTEX_ATTRIB_ARRAY5_NV = $8655; - GL_VERTEX_ATTRIB_ARRAY6_NV = $8656; - GL_VERTEX_ATTRIB_ARRAY7_NV = $8657; - GL_VERTEX_ATTRIB_ARRAY8_NV = $8658; - GL_VERTEX_ATTRIB_ARRAY9_NV = $8659; - GL_VERTEX_ATTRIB_ARRAY10_NV = $865A; - GL_VERTEX_ATTRIB_ARRAY11_NV = $865B; - GL_VERTEX_ATTRIB_ARRAY12_NV = $865C; - GL_VERTEX_ATTRIB_ARRAY13_NV = $865D; - GL_VERTEX_ATTRIB_ARRAY14_NV = $865E; - GL_VERTEX_ATTRIB_ARRAY15_NV = $865F; - GL_MAP1_VERTEX_ATTRIB0_4_NV = $8660; - GL_MAP1_VERTEX_ATTRIB1_4_NV = $8661; - GL_MAP1_VERTEX_ATTRIB2_4_NV = $8662; - GL_MAP1_VERTEX_ATTRIB3_4_NV = $8663; - GL_MAP1_VERTEX_ATTRIB4_4_NV = $8664; - GL_MAP1_VERTEX_ATTRIB5_4_NV = $8665; - GL_MAP1_VERTEX_ATTRIB6_4_NV = $8666; - GL_MAP1_VERTEX_ATTRIB7_4_NV = $8667; - GL_MAP1_VERTEX_ATTRIB8_4_NV = $8668; - GL_MAP1_VERTEX_ATTRIB9_4_NV = $8669; - GL_MAP1_VERTEX_ATTRIB10_4_NV = $866A; - GL_MAP1_VERTEX_ATTRIB11_4_NV = $866B; - GL_MAP1_VERTEX_ATTRIB12_4_NV = $866C; - GL_MAP1_VERTEX_ATTRIB13_4_NV = $866D; - GL_MAP1_VERTEX_ATTRIB14_4_NV = $866E; - GL_MAP1_VERTEX_ATTRIB15_4_NV = $866F; - GL_MAP2_VERTEX_ATTRIB0_4_NV = $8670; - GL_MAP2_VERTEX_ATTRIB1_4_NV = $8671; - GL_MAP2_VERTEX_ATTRIB2_4_NV = $8672; - GL_MAP2_VERTEX_ATTRIB3_4_NV = $8673; - GL_MAP2_VERTEX_ATTRIB4_4_NV = $8674; - GL_MAP2_VERTEX_ATTRIB5_4_NV = $8675; - GL_MAP2_VERTEX_ATTRIB6_4_NV = $8676; - GL_MAP2_VERTEX_ATTRIB7_4_NV = $8677; - GL_MAP2_VERTEX_ATTRIB8_4_NV = $8678; - GL_MAP2_VERTEX_ATTRIB9_4_NV = $8679; - GL_MAP2_VERTEX_ATTRIB10_4_NV = $867A; - GL_MAP2_VERTEX_ATTRIB11_4_NV = $867B; - GL_MAP2_VERTEX_ATTRIB12_4_NV = $867C; - GL_MAP2_VERTEX_ATTRIB13_4_NV = $867D; - GL_MAP2_VERTEX_ATTRIB14_4_NV = $867E; - GL_MAP2_VERTEX_ATTRIB15_4_NV = $867F; -var - glBindProgramNV: procedure(target: GLenum; id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteProgramsNV: procedure(n: GLsizei; const ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glExecuteProgramNV: procedure(target: GLenum; id: GLuint; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGenProgramsNV: procedure(n: GLsizei; ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glAreProgramsResidentNV: function(n: GLsizei; const ids: PGLuint; residences: PGLboolean): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRequestResidentProgramsNV: procedure(n: GLsizei; ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramParameterfvNV: procedure(target: GLenum; index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramParameterdvNV: procedure(target: GLenum; index: GLuint; pname: GLenum; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramivNV: procedure(id: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramStringNV: procedure(id: GLuint; pname: GLenum; _program: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTrackMatrixivNV: procedure(target: GLenum; address: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVertexAttribdvNV: procedure(index: GLuint; pname: GLenum; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVertexAttribfvNV: procedure(index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVertexAttribivNV: procedure(index: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVertexAttribPointervNV: procedure(index: GLuint; pname: GLenum; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsProgramNV: function(id: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLoadProgramNV: procedure(target: GLenum; id: GLuint; len: GLsizei; const _program: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramParameter4fNV: procedure(target: GLenum; index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramParameter4fvNV: procedure(target: GLenum; index: GLuint; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramParameters4dvNV: procedure(target: GLenum; index: GLuint; num: GLuint; const params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramParameters4fvNV: procedure(target: GLenum; index: GLuint; num: GLuint; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTrackMatrixNV: procedure(target: GLenum; address: GLuint; matrix: GLenum; transform: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribPointerNV: procedure(index: GLuint; size: GLint; _type: GLenum; stride: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1sNV: procedure(index: GLuint; x: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1fNV: procedure(index: GLuint; x: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1dNV: procedure(index: GLuint; x: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2sNV: procedure(index: GLuint; x: GLshort; y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2fNV: procedure(index: GLuint; x: GLfloat; y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2dNV: procedure(index: GLuint; x: GLdouble; y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3sNV: procedure(index: GLuint; x: GLshort; y: GLshort; z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3fNV: procedure(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3dNV: procedure(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4sNV: procedure(index: GLuint; x: GLshort; y: GLshort; z: GLshort; w: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4fNV: procedure(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4dNV: procedure(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4ubNV: procedure(index: GLuint; x: GLubyte; y: GLubyte; z: GLubyte; w: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1svNV: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1fvNV: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1dvNV: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2svNV: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2fvNV: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2dvNV: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3svNV: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3fvNV: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3dvNV: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4svNV: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4fvNV: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4dvNV: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4ubvNV: procedure(index: GLuint; const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs1svNV: procedure(index: GLuint; n: GLsizei; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs1fvNV: procedure(index: GLuint; n: GLsizei; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs1dvNV: procedure(index: GLuint; n: GLsizei; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs2svNV: procedure(index: GLuint; n: GLsizei; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs2fvNV: procedure(index: GLuint; n: GLsizei; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs2dvNV: procedure(index: GLuint; n: GLsizei; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs3svNV: procedure(index: GLuint; n: GLsizei; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs3fvNV: procedure(index: GLuint; n: GLsizei; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs3dvNV: procedure(index: GLuint; n: GLsizei; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs4svNV: procedure(index: GLuint; n: GLsizei; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs4fvNV: procedure(index: GLuint; n: GLsizei; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs4dvNV: procedure(index: GLuint; n: GLsizei; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs4ubvNV: procedure(index: GLuint; n: GLsizei; const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_NV_vertex_program: Boolean; - -//***** GL_NV_vertex_program1_1 *****// - -function Load_GL_NV_vertex_program1_1: Boolean; - -//***** GL_ATI_element_array *****// -const - GL_ELEMENT_ARRAY_ATI = $8768; - GL_ELEMENT_ARRAY_TYPE_ATI = $8769; - GL_ELEMENT_ARRAY_POINTER_ATI = $876A; -var - glElementPointerATI: procedure(_type: GLenum; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDrawElementArrayATI: procedure(mode: GLenum; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDrawRangeElementArrayATI: procedure(mode: GLenum; start: GLuint; _end: GLuint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ATI_element_array: Boolean; - -//***** GL_ATI_envmap_bumpmap *****// -const - GL_BUMP_ROT_MATRIX_ATI = $8775; - GL_BUMP_ROT_MATRIX_SIZE_ATI = $8776; - GL_BUMP_NUM_TEX_UNITS_ATI = $8777; - GL_BUMP_TEX_UNITS_ATI = $8778; - GL_DUDV_ATI = $8779; - GL_DU8DV8_ATI = $877A; - GL_BUMP_ENVMAP_ATI = $877B; - GL_BUMP_TARGET_ATI = $877C; -var - glTexBumpParameterivATI: procedure(pname: GLenum; param: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexBumpParameterfvATI: procedure(pname: GLenum; param: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexBumpParameterivATI: procedure(pname: GLenum; param: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexBumpParameterfvATI: procedure(pname: GLenum; param: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ATI_envmap_bumpmap: Boolean; - -//***** GL_ATI_fragment_shader *****// -const - GL_FRAGMENT_SHADER_ATI = $8920; - GL_REG_0_ATI = $8921; - GL_REG_1_ATI = $8922; - GL_REG_2_ATI = $8923; - GL_REG_3_ATI = $8924; - GL_REG_4_ATI = $8925; - GL_REG_5_ATI = $8926; - GL_CON_0_ATI = $8941; - GL_CON_1_ATI = $8942; - GL_CON_2_ATI = $8943; - GL_CON_3_ATI = $8944; - GL_CON_4_ATI = $8945; - GL_CON_5_ATI = $8946; - GL_CON_6_ATI = $8947; - GL_CON_7_ATI = $8948; - GL_MOV_ATI = $8961; - GL_ADD_ATI = $8963; - GL_MUL_ATI = $8964; - GL_SUB_ATI = $8965; - GL_DOT3_ATI = $8966; - GL_DOT4_ATI = $8967; - GL_MAD_ATI = $8968; - GL_LERP_ATI = $8969; - GL_CND_ATI = $896A; - GL_CND0_ATI = $896B; - GL_DOT2_ADD_ATI = $896C; - GL_SECONDARY_INTERPOLATOR_ATI = $896D; - GL_SWIZZLE_STR_ATI = $8976; - GL_SWIZZLE_STQ_ATI = $8977; - GL_SWIZZLE_STR_DR_ATI = $8978; - GL_SWIZZLE_STQ_DQ_ATI = $8979; - GL_RED_BIT_ATI = $0001; - GL_GREEN_BIT_ATI = $0002; - GL_BLUE_BIT_ATI = $0004; - GL_2X_BIT_ATI = $0001; - GL_4X_BIT_ATI = $0002; - GL_8X_BIT_ATI = $0004; - GL_HALF_BIT_ATI = $0008; - GL_QUARTER_BIT_ATI = $0010; - GL_EIGHTH_BIT_ATI = $0020; - GL_SATURATE_BIT_ATI = $0040; - // GL_2X_BIT_ATI { already defined } - GL_COMP_BIT_ATI = $0002; - GL_NEGATE_BIT_ATI = $0004; - GL_BIAS_BIT_ATI = $0008; -var - glGenFragmentShadersATI: function(range: GLuint): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBindFragmentShaderATI: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteFragmentShaderATI: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBeginFragmentShaderATI: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEndFragmentShaderATI: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPassTexCoordATI: procedure(dst: GLuint; coord: GLuint; swizzle: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSampleMapATI: procedure(dst: GLuint; interp: GLuint; swizzle: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorFragmentOp1ATI: procedure(op: GLenum; dst: GLuint; dstMask: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorFragmentOp2ATI: procedure(op: GLenum; dst: GLuint; dstMask: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorFragmentOp3ATI: procedure(op: GLenum; dst: GLuint; dstMask: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint; arg3: GLuint; arg3Rep: GLuint; arg3Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glAlphaFragmentOp1ATI: procedure(op: GLenum; dst: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glAlphaFragmentOp2ATI: procedure(op: GLenum; dst: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glAlphaFragmentOp3ATI: procedure(op: GLenum; dst: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint; arg3: GLuint; arg3Rep: GLuint; arg3Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSetFragmentShaderConstantATI: procedure(dst: GLuint; const value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ATI_fragment_shader: Boolean; - -//***** GL_ATI_pn_triangles *****// -const - GL_PN_TRIANGLES_ATI = $87F0; - GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI = $87F1; - GL_PN_TRIANGLES_POINT_MODE_ATI = $87F2; - GL_PN_TRIANGLES_NORMAL_MODE_ATI = $87F3; - GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI = $87F4; - GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI = $87F5; - GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI = $87F6; - GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI = $87F7; - GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI = $87F8; -var - glPNTrianglesiATI: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPNTrianglesfATI: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ATI_pn_triangles: Boolean; - -//***** GL_ATI_texture_mirror_once *****// -const - GL_MIRROR_CLAMP_ATI = $8742; - GL_MIRROR_CLAMP_TO_EDGE_ATI = $8743; - -function Load_GL_ATI_texture_mirror_once: Boolean; - -//***** GL_ATI_vertex_array_object *****// -const - GL_STATIC_ATI = $8760; - GL_DYNAMIC_ATI = $8761; - GL_PRESERVE_ATI = $8762; - GL_DISCARD_ATI = $8763; - GL_OBJECT_BUFFER_SIZE_ATI = $8764; - GL_OBJECT_BUFFER_USAGE_ATI = $8765; - GL_ARRAY_OBJECT_BUFFER_ATI = $8766; - GL_ARRAY_OBJECT_OFFSET_ATI = $8767; -var - glNewObjectBufferATI: function(size: GLsizei; const pointer: PGLvoid; usage: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsObjectBufferATI: function(buffer: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUpdateObjectBufferATI: procedure(buffer: GLuint; offset: GLuint; size: GLsizei; const pointer: PGLvoid; preserve: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetObjectBufferfvATI: procedure(buffer: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetObjectBufferivATI: procedure(buffer: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteObjectBufferATI: procedure(buffer: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glArrayObjectATI: procedure(_array: GLenum; size: GLint; _type: GLenum; stride: GLsizei; buffer: GLuint; offset: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetArrayObjectfvATI: procedure(_array: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetArrayObjectivATI: procedure(_array: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVariantArrayObjectATI: procedure(id: GLuint; _type: GLenum; stride: GLsizei; buffer: GLuint; offset: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVariantArrayObjectfvATI: procedure(id: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVariantArrayObjectivATI: procedure(id: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ATI_vertex_array_object: Boolean; - -//***** GL_ATI_vertex_streams *****// -const - GL_MAX_VERTEX_STREAMS_ATI = $876B; - GL_VERTEX_STREAM0_ATI = $876C; - GL_VERTEX_STREAM1_ATI = $876D; - GL_VERTEX_STREAM2_ATI = $876E; - GL_VERTEX_STREAM3_ATI = $876F; - GL_VERTEX_STREAM4_ATI = $8770; - GL_VERTEX_STREAM5_ATI = $8771; - GL_VERTEX_STREAM6_ATI = $8772; - GL_VERTEX_STREAM7_ATI = $8773; - GL_VERTEX_SOURCE_ATI = $8774; -var - glVertexStream1s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream1i: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream1f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream1d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream1sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream1iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream1fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream1dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream2s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream2i: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream2f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream2d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream2sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream2iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream2fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream2dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream3s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream3i: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream3f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream3d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream3sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream3iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream3fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream3dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream4s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream4i: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream4f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream4d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream4sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream4iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream4fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream4dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalStream3b: procedure(stream: GLenum; coords: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalStream3s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalStream3i: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalStream3f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalStream3d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalStream3bv: procedure(stream: GLenum; coords: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalStream3sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalStream3iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalStream3fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalStream3dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glClientActiveVertexStream: procedure(stream: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexBlendEnvi: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexBlendEnvf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ATI_vertex_streams: Boolean; - -{$IFDEF Win32} -//***** WGL_I3D_image_buffer *****// -const - WGL_IMAGE_BUFFER_MIN_ACCESS_I3D = $0001; - WGL_IMAGE_BUFFER_LOCK_I3D = $0002; -var - wglCreateImageBufferI3D: function(hDC: HDC; dwSize: DWORD; uFlags: UINT): PGLvoid; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglDestroyImageBufferI3D: function(hDC: HDC; pAddress: PGLvoid): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglAssociateImageBufferEventsI3D: function(hdc: HDC; pEvent: PHandle; pAddress: PGLvoid; pSize: PDWORD; count: UINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglReleaseImageBufferEventsI3D: function(hdc: HDC; pAddress: PGLvoid; count: UINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_WGL_I3D_image_buffer: Boolean; - -//***** WGL_I3D_swap_frame_lock *****// -var - wglEnableFrameLockI3D: function(): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglDisableFrameLockI3D: function(): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglIsEnabledFrameLockI3D: function(pFlag: PBOOL): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglQueryFrameLockMasterI3D: function(pFlag: PBOOL): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_WGL_I3D_swap_frame_lock: Boolean; - -//***** WGL_I3D_swap_frame_usage *****// -var - wglGetFrameUsageI3D: function(pUsage: PGLfloat): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglBeginFrameTrackingI3D: function(): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglEndFrameTrackingI3D: function(): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglQueryFrameTrackingI3D: function(pFrameCount: PDWORD; pMissedFrames: PDWORD; pLastMissedUsage: PGLfloat): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_WGL_I3D_swap_frame_usage: Boolean; -{$ENDIF} - -//***** GL_3DFX_texture_compression_FXT1 *****// -const - GL_COMPRESSED_RGB_FXT1_3DFX = $86B0; - GL_COMPRESSED_RGBA_FXT1_3DFX = $86B1; - -function Load_GL_3DFX_texture_compression_FXT1: Boolean; - -//***** GL_IBM_cull_vertex *****// -const - GL_CULL_VERTEX_IBM = $1928A; - -function Load_GL_IBM_cull_vertex: Boolean; - -//***** GL_IBM_multimode_draw_arrays *****// -var - glMultiModeDrawArraysIBM: procedure(mode: PGLenum; first: PGLint; count: PGLsizei; primcount: GLsizei; modestride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiModeDrawElementsIBM: procedure(mode: PGLenum; count: PGLsizei; _type: GLenum; const indices: PGLvoid; primcount: GLsizei; modestride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_IBM_multimode_draw_arrays: Boolean; - -//***** GL_IBM_raster_pos_clip *****// -const - GL_RASTER_POSITION_UNCLIPPED_IBM = $19262; - -function Load_GL_IBM_raster_pos_clip: Boolean; - -//***** GL_IBM_texture_mirrored_repeat *****// -const - GL_MIRRORED_REPEAT_IBM = $8370; - -function Load_GL_IBM_texture_mirrored_repeat: Boolean; - -//***** GL_IBM_vertex_array_lists *****// -const - GL_VERTEX_ARRAY_LIST_IBM = $1929E; - GL_NORMAL_ARRAY_LIST_IBM = $1929F; - GL_COLOR_ARRAY_LIST_IBM = $192A0; - GL_INDEX_ARRAY_LIST_IBM = $192A1; - GL_TEXTURE_COORD_ARRAY_LIST_IBM = $192A2; - GL_EDGE_FLAG_ARRAY_LIST_IBM = $192A3; - GL_FOG_COORDINATE_ARRAY_LIST_IBM = $192A4; - GL_SECONDARY_COLOR_ARRAY_LIST_IBM = $192A5; - GL_VERTEX_ARRAY_LIST_STRIDE_IBM = $192A8; - GL_NORMAL_ARRAY_LIST_STRIDE_IBM = $192A9; - GL_COLOR_ARRAY_LIST_STRIDE_IBM = $192AA; - GL_INDEX_ARRAY_LIST_STRIDE_IBM = $192AB; - GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM = $192AC; - GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM = $192AD; - GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM = $192AE; - GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM = $192AF; -var - glColorPointerListIBM: procedure(size: GLint; _type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColorPointerListIBM: procedure(size: GLint; _type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEdgeFlagPointerListIBM: procedure(stride: GLint; const pointer: PGLboolean; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFogCoordPointerListIBM: procedure(_type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalPointerListIBM: procedure(_type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoordPointerListIBM: procedure(size: GLint; _type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexPointerListIBM: procedure(size: GLint; _type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_IBM_vertex_array_lists: Boolean; - -//***** GL_MESA_resize_buffers *****// -var - glResizeBuffersMESA: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_MESA_resize_buffers: Boolean; - -//***** GL_MESA_window_pos *****// -var - glWindowPos2dMESA: procedure(x: GLdouble; y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2fMESA: procedure(x: GLfloat; y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2iMESA: procedure(x: GLint; y: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2sMESA: procedure(x: GLshort; y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2ivMESA: procedure(const p: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2svMESA: procedure(const p: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2fvMESA: procedure(const p: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2dvMESA: procedure(const p: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3iMESA: procedure(x: GLint; y: GLint; z: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3sMESA: procedure(x: GLshort; y: GLshort; z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3fMESA: procedure(x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3dMESA: procedure(x: GLdouble; y: GLdouble; z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3ivMESA: procedure(const p: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3svMESA: procedure(const p: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3fvMESA: procedure(const p: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3dvMESA: procedure(const p: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos4iMESA: procedure(x: GLint; y: GLint; z: GLint; w: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos4sMESA: procedure(x: GLshort; y: GLshort; z: GLshort; w: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos4fMESA: procedure(x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos4dMESA: procedure(x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos4ivMESA: procedure(const p: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos4svMESA: procedure(const p: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos4fvMESA: procedure(const p: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos4dvMESA: procedure(const p: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_MESA_window_pos: Boolean; - -//***** GL_OML_interlace *****// -const - GL_INTERLACE_OML = $8980; - GL_INTERLACE_READ_OML = $8981; - -function Load_GL_OML_interlace: Boolean; - -//***** GL_OML_resample *****// -const - GL_PACK_RESAMPLE_OML = $8984; - GL_UNPACK_RESAMPLE_OML = $8985; - GL_RESAMPLE_REPLICATE_OML = $8986; - GL_RESAMPLE_ZERO_FILL_OML = $8987; - GL_RESAMPLE_AVERAGE_OML = $8988; - GL_RESAMPLE_DECIMATE_OML = $8989; - // GL_RESAMPLE_AVERAGE_OML { already defined } - -function Load_GL_OML_resample: Boolean; - -//***** GL_OML_subsample *****// -const - GL_FORMAT_SUBSAMPLE_24_24_OML = $8982; - GL_FORMAT_SUBSAMPLE_244_244_OML = $8983; - -function Load_GL_OML_subsample: Boolean; - -//***** GL_SGIS_generate_mipmap *****// -const - GL_GENERATE_MIPMAP_SGIS = $8191; - GL_GENERATE_MIPMAP_HINT_SGIS = $8192; - -function Load_GL_SGIS_generate_mipmap: Boolean; - -//***** GL_SGIS_multisample *****// -const - GLX_SAMPLE_BUFFERS_SGIS = $186A0; - GLX_SAMPLES_SGIS = $186A1; - GL_MULTISAMPLE_SGIS = $809D; - GL_SAMPLE_ALPHA_TO_MASK_SGIS = $809E; - GL_SAMPLE_ALPHA_TO_ONE_SGIS = $809F; - GL_SAMPLE_MASK_SGIS = $80A0; - GL_MULTISAMPLE_BIT_EXT = $20000000; - GL_1PASS_SGIS = $80A1; - GL_2PASS_0_SGIS = $80A2; - GL_2PASS_1_SGIS = $80A3; - GL_4PASS_0_SGIS = $80A4; - GL_4PASS_1_SGIS = $80A5; - GL_4PASS_2_SGIS = $80A6; - GL_4PASS_3_SGIS = $80A7; - GL_SAMPLE_BUFFERS_SGIS = $80A8; - GL_SAMPLES_SGIS = $80A9; - GL_SAMPLE_MASK_VALUE_SGIS = $80AA; - GL_SAMPLE_MASK_INVERT_SGIS = $80AB; - GL_SAMPLE_PATTERN_SGIS = $80AC; -var - glSampleMaskSGIS: procedure(value: GLclampf; invert: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSamplePatternSGIS: procedure(pattern: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_SGIS_multisample: Boolean; - -//***** GL_SGIS_pixel_texture *****// -const - GL_PIXEL_TEXTURE_SGIS = $8353; - GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS = $8354; - GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS = $8355; - GL_PIXEL_GROUP_COLOR_SGIS = $8356; -var - glPixelTexGenParameteriSGIS: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPixelTexGenParameterfSGIS: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetPixelTexGenParameterivSGIS: procedure(pname: GLenum; params: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetPixelTexGenParameterfvSGIS: procedure(pname: GLenum; params: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_SGIS_pixel_texture: Boolean; - -//***** GL_SGIS_texture_border_clamp *****// - // GL_CLAMP_TO_BORDER_SGIS { already defined } - -function Load_GL_SGIS_texture_border_clamp: Boolean; - -//***** GL_SGIS_texture_color_mask *****// -const - GL_TEXTURE_COLOR_WRITEMASK_SGIS = $81EF; -var - glTextureColorMaskSGIS: procedure(r: GLboolean; g: GLboolean; b: GLboolean; a: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_SGIS_texture_color_mask: Boolean; - -//***** GL_SGIS_texture_edge_clamp *****// -const - GL_CLAMP_TO_EDGE_SGIS = $812F; - -function Load_GL_SGIS_texture_edge_clamp: Boolean; - -//***** GL_SGIS_texture_lod *****// -const - GL_TEXTURE_MIN_LOD_SGIS = $813A; - GL_TEXTURE_MAX_LOD_SGIS = $813B; - GL_TEXTURE_BASE_LEVEL_SGIS = $813C; - GL_TEXTURE_MAX_LEVEL_SGIS = $813D; - -function Load_GL_SGIS_texture_lod: Boolean; - -//***** GL_SGIS_depth_texture *****// -const - GL_DEPTH_COMPONENT16_SGIX = $81A5; - GL_DEPTH_COMPONENT24_SGIX = $81A6; - GL_DEPTH_COMPONENT32_SGIX = $81A7; - -function Load_GL_SGIS_depth_texture: Boolean; - -//***** GL_SGIX_fog_offset *****// -const - GL_FOG_OFFSET_SGIX = $8198; - GL_FOG_OFFSET_VALUE_SGIX = $8199; - -function Load_GL_SGIX_fog_offset: Boolean; - -//***** GL_SGIX_interlace *****// -const - GL_INTERLACE_SGIX = $8094; - -function Load_GL_SGIX_interlace: Boolean; - -//***** GL_SGIX_shadow_ambient *****// -const - GL_SHADOW_AMBIENT_SGIX = $80BF; - -function Load_GL_SGIX_shadow_ambient: Boolean; - -//***** GL_SGI_color_matrix *****// -const - GL_COLOR_MATRIX_SGI = $80B1; - GL_COLOR_MATRIX_STACK_DEPTH_SGI = $80B2; - GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI = $80B3; - GL_POST_COLOR_MATRIX_RED_SCALE_SGI = $80B4; - GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI = $80B5; - GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI = $80B6; - GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI = $80B7; - GL_POST_COLOR_MATRIX_RED_BIAS_SGI = $80B8; - GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI = $80B9; - GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI = $80BA; - GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI = $80BB; - -function Load_GL_SGI_color_matrix: Boolean; - -//***** GL_SGI_color_table *****// -const - GL_COLOR_TABLE_SGI = $80D0; - GL_POST_CONVOLUTION_COLOR_TABLE_SGI = $80D1; - GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI = $80D2; - GL_PROXY_COLOR_TABLE_SGI = $80D3; - GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI = $80D4; - GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI = $80D5; - GL_COLOR_TABLE_SCALE_SGI = $80D6; - GL_COLOR_TABLE_BIAS_SGI = $80D7; - GL_COLOR_TABLE_FORMAT_SGI = $80D8; - GL_COLOR_TABLE_WIDTH_SGI = $80D9; - GL_COLOR_TABLE_RED_SIZE_SGI = $80DA; - GL_COLOR_TABLE_GREEN_SIZE_SGI = $80DB; - GL_COLOR_TABLE_BLUE_SIZE_SGI = $80DC; - GL_COLOR_TABLE_ALPHA_SIZE_SGI = $80DD; - GL_COLOR_TABLE_LUMINANCE_SIZE_SGI = $80DE; - GL_COLOR_TABLE_INTENSITY_SIZE_SGI = $80DF; -var - glColorTableSGI: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const table: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyColorTableSGI: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorTableParameterivSGI: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorTableParameterfvSGI: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetColorTableSGI: procedure(target: GLenum; format: GLenum; _type: GLenum; table: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetColorTableParameterivSGI: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetColorTableParameterfvSGI: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_SGI_color_table: Boolean; - -//***** GL_SGI_texture_color_table *****// -const - GL_TEXTURE_COLOR_TABLE_SGI = $80BC; - GL_PROXY_TEXTURE_COLOR_TABLE_SGI = $80BD; - -function Load_GL_SGI_texture_color_table: Boolean; - -//***** GL_SUN_vertex *****// -var - glColor4ubVertex2fSUN: procedure(r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4ubVertex2fvSUN: procedure(const c: PGLubyte; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4ubVertex3fSUN: procedure(r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4ubVertex3fvSUN: procedure(const c: PGLubyte; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3fVertex3fSUN: procedure(r: GLfloat; g: GLfloat; b: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3fVertex3fvSUN: procedure(const c: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3fVertex3fSUN: procedure(nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3fVertex3fvSUN: procedure(const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4fNormal3fVertex3fSUN: procedure(r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4fNormal3fVertex3fvSUN: procedure(const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2fVertex3fSUN: procedure(s: GLfloat; t: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2fVertex3fvSUN: procedure(const tc: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4fVertex4fSUN: procedure(s: GLfloat; t: GLfloat; p: GLfloat; q: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4fVertex4fvSUN: procedure(const tc: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2fColor4ubVertex3fSUN: procedure(s: GLfloat; t: GLfloat; r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2fColor4ubVertex3fvSUN: procedure(const tc: PGLfloat; const c: PGLubyte; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2fColor3fVertex3fSUN: procedure(s: GLfloat; t: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2fColor3fVertex3fvSUN: procedure(const tc: PGLfloat; const c: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2fNormal3fVertex3fSUN: procedure(s: GLfloat; t: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2fNormal3fVertex3fvSUN: procedure(const tc: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2fColor4fNormal3fVertex3fSUN: procedure(s: GLfloat; t: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2fColor4fNormal3fVertex3fvSUN: procedure(const tc: PGLfloat; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4fColor4fNormal3fVertex4fSUN: procedure(s: GLfloat; t: GLfloat; p: GLfloat; q: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4fColor4fNormal3fVertex4fvSUN: procedure(const tc: PGLfloat; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiVertex3fSUN: procedure(rc: GLuint; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiVertex3fvSUN: procedure(const rc: PGLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiColor4ubVertex3fSUN: procedure(rc: GLuint; r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiColor4ubVertex3fvSUN: procedure(const rc: PGLuint; const c: PGLubyte; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiColor3fVertex3fSUN: procedure(rc: GLuint; r: GLfloat; g: GLfloat; b: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiColor3fVertex3fvSUN: procedure(const rc: PGLuint; const c: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiNormal3fVertex3fSUN: procedure(rc: GLuint; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiNormal3fVertex3fvSUN: procedure(const rc: PGLuint; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiColor4fNormal3fVertex3fSUN: procedure(rc: GLuint; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiColor4fNormal3fVertex3fvSUN: procedure(const rc: PGLuint; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiTexCoord2fVertex3fSUN: procedure(rc: GLuint; s: GLfloat; t: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiTexCoord2fVertex3fvSUN: procedure(const rc: PGLuint; const tc: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN: procedure(rc: GLuint; s: GLfloat; t: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN: procedure(const rc: PGLuint; const tc: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN: procedure(rc: GLuint; s: GLfloat; t: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN: procedure(const rc: PGLuint; const tc: PGLfloat; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_SUN_vertex: Boolean; - -//***** GL_ARB_fragment_program *****// -const - GL_FRAGMENT_PROGRAM_ARB = $8804; - // GL_PROGRAM_FORMAT_ASCII_ARB { already defined } - // GL_PROGRAM_LENGTH_ARB { already defined } - // GL_PROGRAM_FORMAT_ARB { already defined } - // GL_PROGRAM_BINDING_ARB { already defined } - // GL_PROGRAM_INSTRUCTIONS_ARB { already defined } - // GL_MAX_PROGRAM_INSTRUCTIONS_ARB { already defined } - // GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB { already defined } - // GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB { already defined } - // GL_PROGRAM_TEMPORARIES_ARB { already defined } - // GL_MAX_PROGRAM_TEMPORARIES_ARB { already defined } - // GL_PROGRAM_NATIVE_TEMPORARIES_ARB { already defined } - // GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB { already defined } - // GL_PROGRAM_PARAMETERS_ARB { already defined } - // GL_MAX_PROGRAM_PARAMETERS_ARB { already defined } - // GL_PROGRAM_NATIVE_PARAMETERS_ARB { already defined } - // GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB { already defined } - // GL_PROGRAM_ATTRIBS_ARB { already defined } - // GL_MAX_PROGRAM_ATTRIBS_ARB { already defined } - // GL_PROGRAM_NATIVE_ATTRIBS_ARB { already defined } - // GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB { already defined } - // GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB { already defined } - // GL_MAX_PROGRAM_ENV_PARAMETERS_ARB { already defined } - // GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB { already defined } - GL_PROGRAM_ALU_INSTRUCTIONS_ARB = $8805; - GL_PROGRAM_TEX_INSTRUCTIONS_ARB = $8806; - GL_PROGRAM_TEX_INDIRECTIONS_ARB = $8807; - GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB = $8808; - GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB = $8809; - GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB = $880A; - GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB = $880B; - GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB = $880C; - GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB = $880D; - GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB = $880E; - GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB = $880F; - GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB = $8810; - // GL_PROGRAM_STRING_ARB { already defined } - // GL_PROGRAM_ERROR_POSITION_ARB { already defined } - // GL_CURRENT_MATRIX_ARB { already defined } - // GL_TRANSPOSE_CURRENT_MATRIX_ARB { already defined } - // GL_CURRENT_MATRIX_STACK_DEPTH_ARB { already defined } - // GL_MAX_PROGRAM_MATRICES_ARB { already defined } - // GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB { already defined } - GL_MAX_TEXTURE_COORDS_ARB = $8871; - GL_MAX_TEXTURE_IMAGE_UNITS_ARB = $8872; - // GL_PROGRAM_ERROR_STRING_ARB { already defined } - // GL_MATRIX0_ARB { already defined } - // GL_MATRIX1_ARB { already defined } - // GL_MATRIX2_ARB { already defined } - // GL_MATRIX3_ARB { already defined } - // GL_MATRIX4_ARB { already defined } - // GL_MATRIX5_ARB { already defined } - // GL_MATRIX6_ARB { already defined } - // GL_MATRIX7_ARB { already defined } - // GL_MATRIX8_ARB { already defined } - // GL_MATRIX9_ARB { already defined } - // GL_MATRIX10_ARB { already defined } - // GL_MATRIX11_ARB { already defined } - // GL_MATRIX12_ARB { already defined } - // GL_MATRIX13_ARB { already defined } - // GL_MATRIX14_ARB { already defined } - // GL_MATRIX15_ARB { already defined } - // GL_MATRIX16_ARB { already defined } - // GL_MATRIX17_ARB { already defined } - // GL_MATRIX18_ARB { already defined } - // GL_MATRIX19_ARB { already defined } - // GL_MATRIX20_ARB { already defined } - // GL_MATRIX21_ARB { already defined } - // GL_MATRIX22_ARB { already defined } - // GL_MATRIX23_ARB { already defined } - // GL_MATRIX24_ARB { already defined } - // GL_MATRIX25_ARB { already defined } - // GL_MATRIX26_ARB { already defined } - // GL_MATRIX27_ARB { already defined } - // GL_MATRIX28_ARB { already defined } - // GL_MATRIX29_ARB { already defined } - // GL_MATRIX30_ARB { already defined } - // GL_MATRIX31_ARB { already defined } - // glProgramStringARB { already defined } - // glBindProgramARB { already defined } - // glDeleteProgramsARB { already defined } - // glGenProgramsARB { already defined } - // glProgramEnvParameter4dARB { already defined } - // glProgramEnvParameter4dvARB { already defined } - // glProgramEnvParameter4fARB { already defined } - // glProgramEnvParameter4fvARB { already defined } - // glProgramLocalParameter4dARB { already defined } - // glProgramLocalParameter4dvARB { already defined } - // glProgramLocalParameter4fARB { already defined } - // glProgramLocalParameter4fvARB { already defined } - // glGetProgramEnvParameterdvARB { already defined } - // glGetProgramEnvParameterfvARB { already defined } - // glGetProgramLocalParameterdvARB { already defined } - // glGetProgramLocalParameterfvARB { already defined } - // glGetProgramivARB { already defined } - // glGetProgramStringARB { already defined } - // glIsProgramARB { already defined } - -function Load_GL_ARB_fragment_program: Boolean; - -//***** GL_ATI_text_fragment_shader *****// -const - GL_TEXT_FRAGMENT_SHADER_ATI = $8200; - -function Load_GL_ATI_text_fragment_shader: Boolean; - -//***** GL_APPLE_client_storage *****// -const - GL_UNPACK_CLIENT_STORAGE_APPLE = $85B2; - -function Load_GL_APPLE_client_storage: Boolean; - -//***** GL_APPLE_element_array *****// -const - GL_ELEMENT_ARRAY_APPLE = $8768; - GL_ELEMENT_ARRAY_TYPE_APPLE = $8769; - GL_ELEMENT_ARRAY_POINTER_APPLE = $876A; -var - glElementPointerAPPLE: procedure(_type: GLenum; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDrawElementArrayAPPLE: procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDrawRangeElementArrayAPPLE: procedure(mode: GLenum; start: GLuint; _end: GLuint; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiDrawElementArrayAPPLE: procedure(mode: GLenum; const first: PGLint; const count: PGLsizei; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiDrawRangeElementArrayAPPLE: procedure(mode: GLenum; start: GLuint; _end: GLuint; const first: PGLint; const count: PGLsizei; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_APPLE_element_array: Boolean; - -//***** GL_APPLE_fence *****// -const - GL_DRAW_PIXELS_APPLE = $8A0A; - GL_FENCE_APPLE = $8A0B; -var - glGenFencesAPPLE: procedure(n: GLsizei; fences: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteFencesAPPLE: procedure(n: GLsizei; const fences: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSetFenceAPPLE: procedure(fence: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsFenceAPPLE: function(fence: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTestFenceAPPLE: function(fence: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFinishFenceAPPLE: procedure(fence: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTestObjectAPPLE: function(_object: GLenum; name: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFinishObjectAPPLE: procedure(_object: GLenum; name: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_APPLE_fence: Boolean; - -//***** GL_APPLE_vertex_array_object *****// -const - GL_VERTEX_ARRAY_BINDING_APPLE = $85B5; -var - glBindVertexArrayAPPLE: procedure(_array: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteVertexArraysAPPLE: procedure(n: GLsizei; const arrays: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGenVertexArraysAPPLE: procedure(n: GLsizei; const arrays: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsVertexArrayAPPLE: function(_array: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_APPLE_vertex_array_object: Boolean; - -//***** GL_APPLE_vertex_array_range *****// -const - GL_VERTEX_ARRAY_RANGE_APPLE = $851D; - GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE = $851E; - GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_APPLE = $8520; - GL_VERTEX_ARRAY_RANGE_POINTER_APPLE = $8521; - GL_VERTEX_ARRAY_STORAGE_HINT_APPLE = $851F; - GL_STORAGE_CACHED_APPLE = $85BE; - GL_STORAGE_SHARED_APPLE = $85BF; -var - glVertexArrayRangeAPPLE: procedure(length: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFlushVertexArrayRangeAPPLE: procedure(length: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexArrayParameteriAPPLE: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_APPLE_vertex_array_range: Boolean; - -{$IFDEF Win32} -//***** WGL_ARB_pixel_format *****// -const - WGL_NUMBER_PIXEL_FORMATS_ARB = $2000; - WGL_DRAW_TO_WINDOW_ARB = $2001; - WGL_DRAW_TO_BITMAP_ARB = $2002; - WGL_ACCELERATION_ARB = $2003; - WGL_NEED_PALETTE_ARB = $2004; - WGL_NEED_SYSTEM_PALETTE_ARB = $2005; - WGL_SWAP_LAYER_BUFFERS_ARB = $2006; - WGL_SWAP_METHOD_ARB = $2007; - WGL_NUMBER_OVERLAYS_ARB = $2008; - WGL_NUMBER_UNDERLAYS_ARB = $2009; - WGL_TRANSPARENT_ARB = $200A; - WGL_TRANSPARENT_RED_VALUE_ARB = $2037; - WGL_TRANSPARENT_GREEN_VALUE_ARB = $2038; - WGL_TRANSPARENT_BLUE_VALUE_ARB = $2039; - WGL_TRANSPARENT_ALPHA_VALUE_ARB = $203A; - WGL_TRANSPARENT_INDEX_VALUE_ARB = $203B; - WGL_SHARE_DEPTH_ARB = $200C; - WGL_SHARE_STENCIL_ARB = $200D; - WGL_SHARE_ACCUM_ARB = $200E; - WGL_SUPPORT_GDI_ARB = $200F; - WGL_SUPPORT_OPENGL_ARB = $2010; - WGL_DOUBLE_BUFFER_ARB = $2011; - WGL_STEREO_ARB = $2012; - WGL_PIXEL_TYPE_ARB = $2013; - WGL_COLOR_BITS_ARB = $2014; - WGL_RED_BITS_ARB = $2015; - WGL_RED_SHIFT_ARB = $2016; - WGL_GREEN_BITS_ARB = $2017; - WGL_GREEN_SHIFT_ARB = $2018; - WGL_BLUE_BITS_ARB = $2019; - WGL_BLUE_SHIFT_ARB = $201A; - WGL_ALPHA_BITS_ARB = $201B; - WGL_ALPHA_SHIFT_ARB = $201C; - WGL_ACCUM_BITS_ARB = $201D; - WGL_ACCUM_RED_BITS_ARB = $201E; - WGL_ACCUM_GREEN_BITS_ARB = $201F; - WGL_ACCUM_BLUE_BITS_ARB = $2020; - WGL_ACCUM_ALPHA_BITS_ARB = $2021; - WGL_DEPTH_BITS_ARB = $2022; - WGL_STENCIL_BITS_ARB = $2023; - WGL_AUX_BUFFERS_ARB = $2024; - WGL_NO_ACCELERATION_ARB = $2025; - WGL_GENERIC_ACCELERATION_ARB = $2026; - WGL_FULL_ACCELERATION_ARB = $2027; - WGL_SWAP_EXCHANGE_ARB = $2028; - WGL_SWAP_COPY_ARB = $2029; - WGL_SWAP_UNDEFINED_ARB = $202A; - WGL_TYPE_RGBA_ARB = $202B; - WGL_TYPE_COLORINDEX_ARB = $202C; -var - wglGetPixelFormatAttribivARB: function(hdc: HDC; iPixelFormat: GLint; iLayerPlane: GLint; nAttributes: GLuint; const piAttributes: PGLint; piValues: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetPixelFormatAttribfvARB: function(hdc: HDC; iPixelFormat: GLint; iLayerPlane: GLint; nAttributes: GLuint; const piAttributes: PGLint; pfValues: PGLfloat): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglChoosePixelFormatARB: function(hdc: HDC; const piAttribIList: PGLint; const pfAttribFList: PGLfloat; nMaxFormats: GLuint; piFormats: PGLint; nNumFormats: PGLuint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_WGL_ARB_pixel_format: Boolean; - -//***** WGL_ARB_make_current_read *****// -const - WGL_ERROR_INVALID_PIXEL_TYPE_ARB = $2043; - WGL_ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB = $2054; -var - wglMakeContextCurrentARB: function(hDrawDC: HDC; hReadDC: HDC; hglrc: HGLRC): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetCurrentReadDCARB: function(): HDC; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_WGL_ARB_make_current_read: Boolean; - -//***** WGL_ARB_pbuffer *****// -const - WGL_DRAW_TO_PBUFFER_ARB = $202D; - // WGL_DRAW_TO_PBUFFER_ARB { already defined } - WGL_MAX_PBUFFER_PIXELS_ARB = $202E; - WGL_MAX_PBUFFER_WIDTH_ARB = $202F; - WGL_MAX_PBUFFER_HEIGHT_ARB = $2030; - WGL_PBUFFER_LARGEST_ARB = $2033; - WGL_PBUFFER_WIDTH_ARB = $2034; - WGL_PBUFFER_HEIGHT_ARB = $2035; - WGL_PBUFFER_LOST_ARB = $2036; -var - wglCreatePbufferARB: function(hDC: HDC; iPixelFormat: GLint; iWidth: GLint; iHeight: GLint; const piAttribList: PGLint): THandle; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetPbufferDCARB: function(hPbuffer: THandle): HDC; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglReleasePbufferDCARB: function(hPbuffer: THandle; hDC: HDC): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglDestroyPbufferARB: function(hPbuffer: THandle): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglQueryPbufferARB: function(hPbuffer: THandle; iAttribute: GLint; piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_WGL_ARB_pbuffer: Boolean; - -//***** WGL_EXT_swap_control *****// -var - wglSwapIntervalEXT: function(interval: GLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetSwapIntervalEXT: function(): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_WGL_EXT_swap_control: Boolean; - -//***** WGL_ARB_render_texture *****// -const - WGL_BIND_TO_TEXTURE_RGB_ARB = $2070; - WGL_BIND_TO_TEXTURE_RGBA_ARB = $2071; - WGL_TEXTURE_FORMAT_ARB = $2072; - WGL_TEXTURE_TARGET_ARB = $2073; - WGL_MIPMAP_TEXTURE_ARB = $2074; - WGL_TEXTURE_RGB_ARB = $2075; - WGL_TEXTURE_RGBA_ARB = $2076; - WGL_NO_TEXTURE_ARB = $2077; - WGL_TEXTURE_CUBE_MAP_ARB = $2078; - WGL_TEXTURE_1D_ARB = $2079; - WGL_TEXTURE_2D_ARB = $207A; - // WGL_NO_TEXTURE_ARB { already defined } - WGL_MIPMAP_LEVEL_ARB = $207B; - WGL_CUBE_MAP_FACE_ARB = $207C; - WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = $207D; - WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = $207E; - WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = $207F; - WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = $2080; - WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = $2081; - WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = $2082; - WGL_FRONT_LEFT_ARB = $2083; - WGL_FRONT_RIGHT_ARB = $2084; - WGL_BACK_LEFT_ARB = $2085; - WGL_BACK_RIGHT_ARB = $2086; - WGL_AUX0_ARB = $2087; - WGL_AUX1_ARB = $2088; - WGL_AUX2_ARB = $2089; - WGL_AUX3_ARB = $208A; - WGL_AUX4_ARB = $208B; - WGL_AUX5_ARB = $208C; - WGL_AUX6_ARB = $208D; - WGL_AUX7_ARB = $208E; - WGL_AUX8_ARB = $208F; - WGL_AUX9_ARB = $2090; -var - wglBindTexImageARB: function(hPbuffer: THandle; iBuffer: GLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglReleaseTexImageARB: function(hPbuffer: THandle; iBuffer: GLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglSetPbufferAttribARB: function(hPbuffer: THandle; const piAttribList: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_WGL_ARB_render_texture: Boolean; - -//***** WGL_EXT_extensions_string *****// -var - wglGetExtensionsStringEXT: function(): Pchar; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_WGL_EXT_extensions_string: Boolean; - -//***** WGL_EXT_make_current_read *****// -var - wglMakeContextCurrentEXT: function(hDrawDC: HDC; hReadDC: HDC; hglrc: HGLRC): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetCurrentReadDCEXT: function(): HDC; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_WGL_EXT_make_current_read: Boolean; - -//***** WGL_EXT_pbuffer *****// -const - WGL_DRAW_TO_PBUFFER_EXT = $202D; - WGL_MAX_PBUFFER_PIXELS_EXT = $202E; - WGL_MAX_PBUFFER_WIDTH_EXT = $202F; - WGL_MAX_PBUFFER_HEIGHT_EXT = $2030; - WGL_OPTIMAL_PBUFFER_WIDTH_EXT = $2031; - WGL_OPTIMAL_PBUFFER_HEIGHT_EXT = $2032; - WGL_PBUFFER_LARGEST_EXT = $2033; - WGL_PBUFFER_WIDTH_EXT = $2034; - WGL_PBUFFER_HEIGHT_EXT = $2035; -var - wglCreatePbufferEXT: function(hDC: HDC; iPixelFormat: GLint; iWidth: GLint; iHeight: GLint; const piAttribList: PGLint): THandle; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetPbufferDCEXT: function(hPbuffer: THandle): HDC; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglReleasePbufferDCEXT: function(hPbuffer: THandle; hDC: HDC): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglDestroyPbufferEXT: function(hPbuffer: THandle): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglQueryPbufferEXT: function(hPbuffer: THandle; iAttribute: GLint; piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_WGL_EXT_pbuffer: Boolean; - -//***** WGL_EXT_pixel_format *****// -const - WGL_NUMBER_PIXEL_FORMATS_EXT = $2000; - WGL_DRAW_TO_WINDOW_EXT = $2001; - WGL_DRAW_TO_BITMAP_EXT = $2002; - WGL_ACCELERATION_EXT = $2003; - WGL_NEED_PALETTE_EXT = $2004; - WGL_NEED_SYSTEM_PALETTE_EXT = $2005; - WGL_SWAP_LAYER_BUFFERS_EXT = $2006; - WGL_SWAP_METHOD_EXT = $2007; - WGL_NUMBER_OVERLAYS_EXT = $2008; - WGL_NUMBER_UNDERLAYS_EXT = $2009; - WGL_TRANSPARENT_EXT = $200A; - WGL_TRANSPARENT_VALUE_EXT = $200B; - WGL_SHARE_DEPTH_EXT = $200C; - WGL_SHARE_STENCIL_EXT = $200D; - WGL_SHARE_ACCUM_EXT = $200E; - WGL_SUPPORT_GDI_EXT = $200F; - WGL_SUPPORT_OPENGL_EXT = $2010; - WGL_DOUBLE_BUFFER_EXT = $2011; - WGL_STEREO_EXT = $2012; - WGL_PIXEL_TYPE_EXT = $2013; - WGL_COLOR_BITS_EXT = $2014; - WGL_RED_BITS_EXT = $2015; - WGL_RED_SHIFT_EXT = $2016; - WGL_GREEN_BITS_EXT = $2017; - WGL_GREEN_SHIFT_EXT = $2018; - WGL_BLUE_BITS_EXT = $2019; - WGL_BLUE_SHIFT_EXT = $201A; - WGL_ALPHA_BITS_EXT = $201B; - WGL_ALPHA_SHIFT_EXT = $201C; - WGL_ACCUM_BITS_EXT = $201D; - WGL_ACCUM_RED_BITS_EXT = $201E; - WGL_ACCUM_GREEN_BITS_EXT = $201F; - WGL_ACCUM_BLUE_BITS_EXT = $2020; - WGL_ACCUM_ALPHA_BITS_EXT = $2021; - WGL_DEPTH_BITS_EXT = $2022; - WGL_STENCIL_BITS_EXT = $2023; - WGL_AUX_BUFFERS_EXT = $2024; - WGL_NO_ACCELERATION_EXT = $2025; - WGL_GENERIC_ACCELERATION_EXT = $2026; - WGL_FULL_ACCELERATION_EXT = $2027; - WGL_SWAP_EXCHANGE_EXT = $2028; - WGL_SWAP_COPY_EXT = $2029; - WGL_SWAP_UNDEFINED_EXT = $202A; - WGL_TYPE_RGBA_EXT = $202B; - WGL_TYPE_COLORINDEX_EXT = $202C; -var - wglGetPixelFormatAttribivEXT: function(hdc: HDC; iPixelFormat: GLint; iLayerPlane: GLint; nAttributes: GLuint; piAttributes: PGLint; piValues: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetPixelFormatAttribfvEXT: function(hdc: HDC; iPixelFormat: GLint; iLayerPlane: GLint; nAttributes: GLuint; piAttributes: PGLint; pfValues: PGLfloat): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglChoosePixelFormatEXT: function(hdc: HDC; const piAttribIList: PGLint; const pfAttribFList: PGLfloat; nMaxFormats: GLuint; piFormats: PGLint; nNumFormats: PGLuint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_WGL_EXT_pixel_format: Boolean; - -//***** WGL_I3D_digital_video_control *****// -const - WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D = $2050; - WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D = $2051; - WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D = $2052; - WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D = $2053; -var - wglGetDigitalVideoParametersI3D: function(hDC: HDC; iAttribute: GLint; piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglSetDigitalVideoParametersI3D: function(hDC: HDC; iAttribute: GLint; const piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_WGL_I3D_digital_video_control: Boolean; - -//***** WGL_I3D_gamma *****// -const - WGL_GAMMA_TABLE_SIZE_I3D = $204E; - WGL_GAMMA_EXCLUDE_DESKTOP_I3D = $204F; - // WGL_GAMMA_EXCLUDE_DESKTOP_I3D { already defined } -var - wglGetGammaTableParametersI3D: function(hDC: HDC; iAttribute: GLint; piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglSetGammaTableParametersI3D: function(hDC: HDC; iAttribute: GLint; const piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetGammaTableI3D: function(hDC: HDC; iEntries: GLint; puRed: PGLUSHORT; puGreen: PGLUSHORT; puBlue: PGLUSHORT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglSetGammaTableI3D: function(hDC: HDC; iEntries: GLint; const puRed: PGLUSHORT; const puGreen: PGLUSHORT; const puBlue: PGLUSHORT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_WGL_I3D_gamma: Boolean; - -//***** WGL_I3D_genlock *****// -const - WGL_GENLOCK_SOURCE_MULTIVIEW_I3D = $2044; - WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D = $2045; - WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D = $2046; - WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D = $2047; - WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D = $2048; - WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D = $2049; - WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D = $204A; - WGL_GENLOCK_SOURCE_EDGE_RISING_I3D = $204B; - WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D = $204C; -var - wglEnableGenlockI3D: function(hDC: HDC): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglDisableGenlockI3D: function(hDC: HDC): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglIsEnabledGenlockI3D: function(hDC: HDC; pFlag: PBOOL): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGenlockSourceI3D: function(hDC: HDC; uSource: GLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetGenlockSourceI3D: function(hDC: HDC; uSource: PGLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGenlockSourceEdgeI3D: function(hDC: HDC; uEdge: GLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetGenlockSourceEdgeI3D: function(hDC: HDC; uEdge: PGLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGenlockSampleRateI3D: function(hDC: HDC; uRate: GLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetGenlockSampleRateI3D: function(hDC: HDC; uRate: PGLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGenlockSourceDelayI3D: function(hDC: HDC; uDelay: GLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetGenlockSourceDelayI3D: function(hDC: HDC; uDelay: PGLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglQueryGenlockMaxSourceDelayI3D: function(hDC: HDC; uMaxLineDelay: PGLUINT; uMaxPixelDelay: PGLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_WGL_I3D_genlock: Boolean; -{$ENDIF} - -//***** GL_ARB_matrix_palette *****// -const - GL_MATRIX_PALETTE_ARB = $8840; - GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB = $8841; - GL_MAX_PALETTE_MATRICES_ARB = $8842; - GL_CURRENT_PALETTE_MATRIX_ARB = $8843; - GL_MATRIX_INDEX_ARRAY_ARB = $8844; - GL_CURRENT_MATRIX_INDEX_ARB = $8845; - GL_MATRIX_INDEX_ARRAY_SIZE_ARB = $8846; - GL_MATRIX_INDEX_ARRAY_TYPE_ARB = $8847; - GL_MATRIX_INDEX_ARRAY_STRIDE_ARB = $8848; - GL_MATRIX_INDEX_ARRAY_POINTER_ARB = $8849; -var - glCurrentPaletteMatrixARB: procedure(index: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMatrixIndexubvARB: procedure(size: GLint; indices: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMatrixIndexusvARB: procedure(size: GLint; indices: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMatrixIndexuivARB: procedure(size: GLint; indices: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMatrixIndexPointerARB: procedure(size: GLint; _type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ARB_matrix_palette: Boolean; - -//***** GL_NV_element_array *****// -const - GL_ELEMENT_ARRAY_TYPE_NV = $8769; - GL_ELEMENT_ARRAY_POINTER_NV = $876A; -var - glElementPointerNV: procedure(_type: GLenum; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDrawElementArrayNV: procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDrawRangeElementArrayNV: procedure(mode: GLenum; start: GLuint; _end: GLuint; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiDrawElementArrayNV: procedure(mode: GLenum; const first: PGLint; const count: PGLsizei; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiDrawRangeElementArrayNV: procedure(mode: GLenum; start: GLuint; _end: GLuint; const first: PGLint; const count: PGLsizei; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_NV_element_array: Boolean; - -//***** GL_NV_float_buffer *****// -const - GL_FLOAT_R_NV = $8880; - GL_FLOAT_RG_NV = $8881; - GL_FLOAT_RGB_NV = $8882; - GL_FLOAT_RGBA_NV = $8883; - GL_FLOAT_R16_NV = $8884; - GL_FLOAT_R32_NV = $8885; - GL_FLOAT_RG16_NV = $8886; - GL_FLOAT_RG32_NV = $8887; - GL_FLOAT_RGB16_NV = $8888; - GL_FLOAT_RGB32_NV = $8889; - GL_FLOAT_RGBA16_NV = $888A; - GL_FLOAT_RGBA32_NV = $888B; - GL_TEXTURE_FLOAT_COMPONENTS_NV = $888C; - GL_FLOAT_CLEAR_COLOR_VALUE_NV = $888D; - GL_FLOAT_RGBA_MODE_NV = $888E; -{$IFDEF Win32} - WGL_FLOAT_COMPONENTS_NV = $20B0; - WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV = $20B1; - WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV = $20B2; - WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV = $20B3; - WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV = $20B4; - WGL_TEXTURE_FLOAT_R_NV = $20B5; - WGL_TEXTURE_FLOAT_RG_NV = $20B6; - WGL_TEXTURE_FLOAT_RGB_NV = $20B7; - WGL_TEXTURE_FLOAT_RGBA_NV = $20B8; -{$ENDIF} - -function Load_GL_NV_float_buffer: Boolean; - -//***** GL_NV_fragment_program *****// -const - GL_FRAGMENT_PROGRAM_NV = $8870; - GL_MAX_TEXTURE_COORDS_NV = $8871; - GL_MAX_TEXTURE_IMAGE_UNITS_NV = $8872; - GL_FRAGMENT_PROGRAM_BINDING_NV = $8873; - GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV = $8868; - GL_PROGRAM_ERROR_STRING_NV = $8874; -var - glProgramNamedParameter4fNV: procedure(id: GLuint; len: GLsizei; const name: PGLubyte; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramNamedParameter4dNV: procedure(id: GLuint; len: GLsizei; const name: PGLubyte; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramNamedParameterfvNV: procedure(id: GLuint; len: GLsizei; const name: PGLubyte; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramNamedParameterdvNV: procedure(id: GLuint; len: GLsizei; const name: PGLubyte; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - // glProgramLocalParameter4dARB { already defined } - // glProgramLocalParameter4dvARB { already defined } - // glProgramLocalParameter4fARB { already defined } - // glProgramLocalParameter4fvARB { already defined } - // glGetProgramLocalParameterdvARB { already defined } - // glGetProgramLocalParameterfvARB { already defined } - -function Load_GL_NV_fragment_program: Boolean; - -//***** GL_NV_primitive_restart *****// -const - GL_PRIMITIVE_RESTART_NV = $8558; - GL_PRIMITIVE_RESTART_INDEX_NV = $8559; -var - glPrimitiveRestartNV: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPrimitiveRestartIndexNV: procedure(index: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_NV_primitive_restart: Boolean; - -//***** GL_NV_vertex_program2 *****// - -function Load_GL_NV_vertex_program2: Boolean; - -//***** WGL_NV_render_texture_rectangle *****// -const - WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV = $20A0; - WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV = $20A1; - WGL_TEXTURE_RECTANGLE_NV = $20A2; - -function Load_WGL_NV_render_texture_rectangle: Boolean; - -//***** GL_NV_pixel_data_range *****// -const - GL_WRITE_PIXEL_DATA_RANGE_NV = $8878; - GL_READ_PIXEL_DATA_RANGE_NV = $8879; - GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV = $887A; - GL_READ_PIXEL_DATA_RANGE_LENGTH_NV = $887B; - GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV = $887C; - GL_READ_PIXEL_DATA_RANGE_POINTER_NV = $887D; -var - glPixelDataRangeNV: procedure(target: GLenum; length: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFlushPixelDataRangeNV: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - // wglAllocateMemoryNV { already defined } - // wglFreeMemoryNV { already defined } - -function Load_GL_NV_pixel_data_range: Boolean; - -//***** GL_EXT_texture_rectangle *****// -const - GL_TEXTURE_RECTANGLE_EXT = $84F5; - GL_TEXTURE_BINDING_RECTANGLE_EXT = $84F6; - GL_PROXY_TEXTURE_RECTANGLE_EXT = $84F7; - GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT = $84F8; - -function Load_GL_EXT_texture_rectangle: Boolean; - -//***** GL_S3_s3tc *****// -const - GL_RGB_S3TC = $83A0; - GL_RGB4_S3TC = $83A1; - GL_RGBA_S3TC = $83A2; - GL_RGBA4_S3TC = $83A3; - -function Load_GL_S3_s3tc: Boolean; - -//***** GL_ATI_draw_buffers *****// -const - GL_MAX_DRAW_BUFFERS_ATI = $8824; - GL_DRAW_BUFFER0_ATI = $8825; - GL_DRAW_BUFFER1_ATI = $8826; - GL_DRAW_BUFFER2_ATI = $8827; - GL_DRAW_BUFFER3_ATI = $8828; - GL_DRAW_BUFFER4_ATI = $8829; - GL_DRAW_BUFFER5_ATI = $882A; - GL_DRAW_BUFFER6_ATI = $882B; - GL_DRAW_BUFFER7_ATI = $882C; - GL_DRAW_BUFFER8_ATI = $882D; - GL_DRAW_BUFFER9_ATI = $882E; - GL_DRAW_BUFFER10_ATI = $882F; - GL_DRAW_BUFFER11_ATI = $8830; - GL_DRAW_BUFFER12_ATI = $8831; - GL_DRAW_BUFFER13_ATI = $8832; - GL_DRAW_BUFFER14_ATI = $8833; - GL_DRAW_BUFFER15_ATI = $8834; -var - glDrawBuffersATI: procedure(n: GLsizei; const bufs: PGLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ATI_draw_buffers: Boolean; - -//***** WGL_ATI_pixel_format_float *****// -const - WGL_RGBA_FLOAT_MODE_ATI = $8820; - WGL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI = $8835; - WGL_TYPE_RGBA_FLOAT_ATI = $21A0; - -function Load_WGL_ATI_pixel_format_float: Boolean; - -//***** GL_ATI_texture_env_combine3 *****// -const - GL_MODULATE_ADD_ATI = $8744; - GL_MODULATE_SIGNED_ADD_ATI = $8745; - GL_MODULATE_SUBTRACT_ATI = $8746; - -function Load_GL_ATI_texture_env_combine3: Boolean; - -//***** GL_ATI_texture_float *****// -const - GL_RGBA_FLOAT32_ATI = $8814; - GL_RGB_FLOAT32_ATI = $8815; - GL_ALPHA_FLOAT32_ATI = $8816; - GL_INTENSITY_FLOAT32_ATI = $8817; - GL_LUMINANCE_FLOAT32_ATI = $8818; - GL_LUMINANCE_ALPHA_FLOAT32_ATI = $8819; - GL_RGBA_FLOAT16_ATI = $881A; - GL_RGB_FLOAT16_ATI = $881B; - GL_ALPHA_FLOAT16_ATI = $881C; - GL_INTENSITY_FLOAT16_ATI = $881D; - GL_LUMINANCE_FLOAT16_ATI = $881E; - GL_LUMINANCE_ALPHA_FLOAT16_ATI = $881F; - -function Load_GL_ATI_texture_float: Boolean; - -//***** GL_NV_texture_expand_normal *****// -const - GL_TEXTURE_UNSIGNED_REMAP_MODE_NV = $888F; - -function Load_GL_NV_texture_expand_normal: Boolean; - -//***** GL_NV_half_float *****// -const - GL_HALF_FLOAT_NV = $140B; -var - glVertex2hNV: procedure(x: GLushort; y: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex2hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex3hNV: procedure(x: GLushort; y: GLushort; z: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex3hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex4hNV: procedure(x: GLushort; y: GLushort; z: GLushort; w: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex4hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3hNV: procedure(nx: GLushort; ny: GLushort; nz: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3hNV: procedure(red: GLushort; green: GLushort; blue: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4hNV: procedure(red: GLushort; green: GLushort; blue: GLushort; alpha: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord1hNV: procedure(s: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord1hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2hNV: procedure(s: GLushort; t: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord3hNV: procedure(s: GLushort; t: GLushort; r: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord3hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4hNV: procedure(s: GLushort; t: GLushort; r: GLushort; q: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1hNV: procedure(target: GLenum; s: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1hvNV: procedure(target: GLenum; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2hNV: procedure(target: GLenum; s: GLushort; t: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2hvNV: procedure(target: GLenum; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3hNV: procedure(target: GLenum; s: GLushort; t: GLushort; r: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3hvNV: procedure(target: GLenum; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4hNV: procedure(target: GLenum; s: GLushort; t: GLushort; r: GLushort; q: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4hvNV: procedure(target: GLenum; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFogCoordhNV: procedure(fog: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFogCoordhvNV: procedure(const fog: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3hNV: procedure(red: GLushort; green: GLushort; blue: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexWeighthNV: procedure(weight: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexWeighthvNV: procedure(const weight: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1hNV: procedure(index: GLuint; x: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1hvNV: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2hNV: procedure(index: GLuint; x: GLushort; y: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2hvNV: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3hNV: procedure(index: GLuint; x: GLushort; y: GLushort; z: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3hvNV: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4hNV: procedure(index: GLuint; x: GLushort; y: GLushort; z: GLushort; w: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4hvNV: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs1hvNV: procedure(index: GLuint; n: GLsizei; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs2hvNV: procedure(index: GLuint; n: GLsizei; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs3hvNV: procedure(index: GLuint; n: GLsizei; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs4hvNV: procedure(index: GLuint; n: GLsizei; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_NV_half_float: Boolean; - -//***** GL_ATI_map_object_buffer *****// -var - glMapObjectBufferATI: function(buffer: GLuint): PGLvoid; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUnmapObjectBufferATI: procedure(buffer: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ATI_map_object_buffer: Boolean; - -//***** GL_ATI_separate_stencil *****// -const - GL_KEEP = $1E00; - GL_ZERO = $0000; - GL_REPLACE = $1E01; - GL_INCR = $1E02; - GL_DECR = $1E03; - GL_INVERT = $150A; - GL_NEVER = $0200; - GL_LESS = $0201; - GL_LEQUAL = $0203; - GL_GREATER = $0204; - GL_GEQUAL = $0206; - GL_EQUAL = $0202; - GL_NOTEQUAL = $0205; - GL_ALWAYS = $0207; - GL_FRONT = $0404; - GL_BACK = $0405; - GL_FRONT_AND_BACK = $0408; - GL_STENCIL_BACK_FUNC_ATI = $8800; - GL_STENCIL_BACK_FAIL_ATI = $8801; - GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI = $8802; - GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI = $8803; -var - glStencilOpSeparateATI: procedure(face: GLenum; sfail: GLenum; dpfail: GLenum; dppass: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glStencilFuncSeparateATI: procedure(frontfunc: GLenum; backfunc: GLenum; ref: GLint; mask: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ATI_separate_stencil: Boolean; - -//***** GL_ATI_vertex_attrib_array_object *****// -var - glVertexAttribArrayObjectATI: procedure(index: GLuint; size: GLint; _type: GLenum; normalized: GLboolean; stride: GLsizei; buffer: GLuint; offset: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVertexAttribArrayObjectfvATI: procedure(index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVertexAttribArrayObjectivATI: procedure(index: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ATI_vertex_attrib_array_object: Boolean; - -//***** GL_ARB_vertex_buffer_object *****// -const - GL_ARRAY_BUFFER_ARB = $8892; - GL_ELEMENT_ARRAY_BUFFER_ARB = $8893; - GL_ARRAY_BUFFER_BINDING_ARB = $8894; - GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB = $8895; - GL_VERTEX_ARRAY_BUFFER_BINDING_ARB = $8896; - GL_NORMAL_ARRAY_BUFFER_BINDING_ARB = $8897; - GL_COLOR_ARRAY_BUFFER_BINDING_ARB = $8898; - GL_INDEX_ARRAY_BUFFER_BINDING_ARB = $8899; - GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB = $889A; - GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB = $889B; - GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB = $889C; - GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB = $889D; - GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB = $889E; - GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB = $889F; - GL_STREAM_DRAW_ARB = $88E0; - GL_STREAM_READ_ARB = $88E1; - GL_STREAM_COPY_ARB = $88E2; - GL_STATIC_DRAW_ARB = $88E4; - GL_STATIC_READ_ARB = $88E5; - GL_STATIC_COPY_ARB = $88E6; - GL_DYNAMIC_DRAW_ARB = $88E8; - GL_DYNAMIC_READ_ARB = $88E9; - GL_DYNAMIC_COPY_ARB = $88EA; - GL_READ_ONLY_ARB = $88B8; - GL_WRITE_ONLY_ARB = $88B9; - GL_READ_WRITE_ARB = $88BA; - GL_BUFFER_SIZE_ARB = $8764; - GL_BUFFER_USAGE_ARB = $8765; - GL_BUFFER_ACCESS_ARB = $88BB; - GL_BUFFER_MAPPED_ARB = $88BC; - GL_BUFFER_MAP_POINTER_ARB = $88BD; -var - glBindBufferARB: procedure(target: GLenum; buffer: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteBuffersARB: procedure(n: GLsizei; const buffers: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGenBuffersARB: procedure(n: GLsizei; buffers: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsBufferARB: function(buffer: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBufferDataARB: procedure(target: GLenum; size: GLsizeiptrARB; const data: PGLvoid; usage: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBufferSubDataARB: procedure(target: GLenum; offset: GLintptrARB; size: GLsizeiptrARB; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetBufferSubDataARB: procedure(target: GLenum; offset: GLintptrARB; size: GLsizeiptrARB; data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMapBufferARB: function(target: GLenum; access: GLenum): PGLvoid; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUnmapBufferARB: function(target: GLenum): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetBufferParameterivARB: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetBufferPointervARB: procedure(target: GLenum; pname: GLenum; params: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ARB_vertex_buffer_object: Boolean; - -//***** GL_ARB_occlusion_query *****// -const - GL_SAMPLES_PASSED_ARB = $8914; - GL_QUERY_COUNTER_BITS_ARB = $8864; - GL_CURRENT_QUERY_ARB = $8865; - GL_QUERY_RESULT_ARB = $8866; - GL_QUERY_RESULT_AVAILABLE_ARB = $8867; -var - glGenQueriesARB: procedure(n: GLsizei; ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteQueriesARB: procedure(n: GLsizei; const ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsQueryARB: function(id: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBeginQueryARB: procedure(target: GLenum; id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEndQueryARB: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetQueryivARB: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetQueryObjectivARB: procedure(id: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetQueryObjectuivARB: procedure(id: GLuint; pname: GLenum; params: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ARB_occlusion_query: Boolean; - -//***** GL_ARB_shader_objects *****// -const - GL_PROGRAM_OBJECT_ARB = $8B40; - GL_OBJECT_TYPE_ARB = $8B4E; - GL_OBJECT_SUBTYPE_ARB = $8B4F; - GL_OBJECT_DELETE_STATUS_ARB = $8B80; - GL_OBJECT_COMPILE_STATUS_ARB = $8B81; - GL_OBJECT_LINK_STATUS_ARB = $8B82; - GL_OBJECT_VALIDATE_STATUS_ARB = $8B83; - GL_OBJECT_INFO_LOG_LENGTH_ARB = $8B84; - GL_OBJECT_ATTACHED_OBJECTS_ARB = $8B85; - GL_OBJECT_ACTIVE_UNIFORMS_ARB = $8B86; - GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB = $8B87; - GL_OBJECT_SHADER_SOURCE_LENGTH_ARB = $8B88; - GL_SHADER_OBJECT_ARB = $8B48; - GL_FLOAT = $1406; - GL_FLOAT_VEC2_ARB = $8B50; - GL_FLOAT_VEC3_ARB = $8B51; - GL_FLOAT_VEC4_ARB = $8B52; - GL_INT = $1404; - GL_INT_VEC2_ARB = $8B53; - GL_INT_VEC3_ARB = $8B54; - GL_INT_VEC4_ARB = $8B55; - GL_BOOL_ARB = $8B56; - GL_BOOL_VEC2_ARB = $8B57; - GL_BOOL_VEC3_ARB = $8B58; - GL_BOOL_VEC4_ARB = $8B59; - GL_FLOAT_MAT2_ARB = $8B5A; - GL_FLOAT_MAT3_ARB = $8B5B; - GL_FLOAT_MAT4_ARB = $8B5C; -var - glDeleteObjectARB: procedure(obj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetHandleARB: function(pname: GLenum): GLhandleARB; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDetachObjectARB: procedure(containerObj: GLhandleARB; attachedObj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCreateShaderObjectARB: function(shaderType: GLenum): GLhandleARB; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glShaderSourceARB: procedure(shaderObj: GLhandleARB; count: GLsizei; const _string: PGLvoid; const length: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompileShaderARB: procedure(shaderObj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCreateProgramObjectARB: function(): GLhandleARB; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glAttachObjectARB: procedure(containerObj: GLhandleARB; obj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLinkProgramARB: procedure(programObj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUseProgramObjectARB: procedure(programObj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glValidateProgramARB: procedure(programObj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform1fARB: procedure(location: GLint; v0: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform2fARB: procedure(location: GLint; v0: GLfloat; v1: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform3fARB: procedure(location: GLint; v0: GLfloat; v1: GLfloat; v2: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform4fARB: procedure(location: GLint; v0: GLfloat; v1: GLfloat; v2: GLfloat; v3: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform1iARB: procedure(location: GLint; v0: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform2iARB: procedure(location: GLint; v0: GLint; v1: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform3iARB: procedure(location: GLint; v0: GLint; v1: GLint; v2: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform4iARB: procedure(location: GLint; v0: GLint; v1: GLint; v2: GLint; v3: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform1fvARB: procedure(location: GLint; count: GLsizei; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform2fvARB: procedure(location: GLint; count: GLsizei; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform3fvARB: procedure(location: GLint; count: GLsizei; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform4fvARB: procedure(location: GLint; count: GLsizei; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform1ivARB: procedure(location: GLint; count: GLsizei; value: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform2ivARB: procedure(location: GLint; count: GLsizei; value: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform3ivARB: procedure(location: GLint; count: GLsizei; value: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform4ivARB: procedure(location: GLint; count: GLsizei; value: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniformMatrix2fvARB: procedure(location: GLint; count: GLsizei; transpose: GLboolean; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniformMatrix3fvARB: procedure(location: GLint; count: GLsizei; transpose: GLboolean; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniformMatrix4fvARB: procedure(location: GLint; count: GLsizei; transpose: GLboolean; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetObjectParameterfvARB: procedure(obj: GLhandleARB; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetObjectParameterivARB: procedure(obj: GLhandleARB; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetInfoLogARB: procedure(obj: GLhandleARB; maxLength: GLsizei; length: PGLsizei; infoLog: PGLcharARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetAttachedObjectsARB: procedure(containerObj: GLhandleARB; maxCount: GLsizei; count: PGLsizei; obj: PGLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetUniformLocationARB: function(programObj: GLhandleARB; const name: PGLcharARB): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetActiveUniformARB: procedure(programObj: GLhandleARB; index: GLuint; maxLength: GLsizei; length: PGLsizei; size: PGLint; _type: PGLenum; name: PGLcharARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetUniformfvARB: procedure(programObj: GLhandleARB; location: GLint; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetUniformivARB: procedure(programObj: GLhandleARB; location: GLint; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetShaderSourceARB: procedure(obj: GLhandleARB; maxLength: GLsizei; length: PGLsizei; source: PGLcharARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_ARB_shader_objects: Boolean; - -//***** GL_ARB_vertex_shader *****// -const - GL_VERTEX_SHADER_ARB = $8B31; - GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB = $8B4A; - GL_MAX_VARYING_FLOATS_ARB = $8B4B; - // GL_MAX_VERTEX_ATTRIBS_ARB { already defined } - // GL_MAX_TEXTURE_IMAGE_UNITS_ARB { already defined } - GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB = $8B4C; - GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB = $8B4D; - // GL_MAX_TEXTURE_COORDS_ARB { already defined } - // GL_VERTEX_PROGRAM_POINT_SIZE_ARB { already defined } - // GL_VERTEX_PROGRAM_TWO_SIDE_ARB { already defined } - // GL_OBJECT_TYPE_ARB { already defined } - // GL_OBJECT_SUBTYPE_ARB { already defined } - GL_OBJECT_ACTIVE_ATTRIBUTES_ARB = $8B89; - GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB = $8B8A; - // GL_SHADER_OBJECT_ARB { already defined } - // GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB { already defined } - // GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB { already defined } - // GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB { already defined } - // GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB { already defined } - // GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB { already defined } - // GL_CURRENT_VERTEX_ATTRIB_ARB { already defined } - // GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB { already defined } - // GL_FLOAT { already defined } - // GL_FLOAT_VEC2_ARB { already defined } - // GL_FLOAT_VEC3_ARB { already defined } - // GL_FLOAT_VEC4_ARB { already defined } - // GL_FLOAT_MAT2_ARB { already defined } - // GL_FLOAT_MAT3_ARB { already defined } - // GL_FLOAT_MAT4_ARB { already defined } - // glVertexAttrib1fARB { already defined } - // glVertexAttrib1sARB { already defined } - // glVertexAttrib1dARB { already defined } - // glVertexAttrib2fARB { already defined } - // glVertexAttrib2sARB { already defined } - // glVertexAttrib2dARB { already defined } - // glVertexAttrib3fARB { already defined } - // glVertexAttrib3sARB { already defined } - // glVertexAttrib3dARB { already defined } - // glVertexAttrib4fARB { already defined } - // glVertexAttrib4sARB { already defined } - // glVertexAttrib4dARB { already defined } - // glVertexAttrib4NubARB { already defined } - // glVertexAttrib1fvARB { already defined } - // glVertexAttrib1svARB { already defined } - // glVertexAttrib1dvARB { already defined } - // glVertexAttrib2fvARB { already defined } - // glVertexAttrib2svARB { already defined } - // glVertexAttrib2dvARB { already defined } - // glVertexAttrib3fvARB { already defined } - // glVertexAttrib3svARB { already defined } - // glVertexAttrib3dvARB { already defined } - // glVertexAttrib4fvARB { already defined } - // glVertexAttrib4svARB { already defined } - // glVertexAttrib4dvARB { already defined } - // glVertexAttrib4ivARB { already defined } - // glVertexAttrib4bvARB { already defined } - // glVertexAttrib4ubvARB { already defined } - // glVertexAttrib4usvARB { already defined } - // glVertexAttrib4uivARB { already defined } - // glVertexAttrib4NbvARB { already defined } - // glVertexAttrib4NsvARB { already defined } - // glVertexAttrib4NivARB { already defined } - // glVertexAttrib4NubvARB { already defined } - // glVertexAttrib4NusvARB { already defined } - // glVertexAttrib4NuivARB { already defined } - // glVertexAttribPointerARB { already defined } - // glEnableVertexAttribArrayARB { already defined } - // glDisableVertexAttribArrayARB { already defined } -var - glBindAttribLocationARB: procedure(programObj: GLhandleARB; index: GLuint; const name: PGLcharARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetActiveAttribARB: procedure(programObj: GLhandleARB; index: GLuint; maxLength: GLsizei; length: PGLsizei; size: PGLint; _type: PGLenum; name: PGLcharARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetAttribLocationARB: function(programObj: GLhandleARB; const name: PGLcharARB): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - // glGetVertexAttribdvARB { already defined } - // glGetVertexAttribfvARB { already defined } - // glGetVertexAttribivARB { already defined } - // glGetVertexAttribPointervARB { already defined } - -function Load_GL_ARB_vertex_shader: Boolean; - -//***** GL_ARB_fragment_shader *****// -const - GL_FRAGMENT_SHADER_ARB = $8B30; - GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB = $8B49; - // GL_MAX_TEXTURE_COORDS_ARB { already defined } - // GL_MAX_TEXTURE_IMAGE_UNITS_ARB { already defined } - // GL_OBJECT_TYPE_ARB { already defined } - // GL_OBJECT_SUBTYPE_ARB { already defined } - // GL_SHADER_OBJECT_ARB { already defined } - -function Load_GL_ARB_fragment_shader: Boolean; - -//***** GL_ARB_shading_language_100 *****// - -function Load_GL_ARB_shading_language_100: Boolean; - -//***** GL_ARB_texture_non_power_of_two *****// - -function Load_GL_ARB_texture_non_power_of_two: Boolean; - -//***** GL_ARB_point_sprite *****// -const - GL_POINT_SPRITE_ARB = $8861; - GL_COORD_REPLACE_ARB = $8862; - -function Load_GL_ARB_point_sprite: Boolean; - -//***** GL_EXT_depth_bounds_test *****// -const - GL_DEPTH_BOUNDS_TEST_EXT = $8890; - GL_DEPTH_BOUNDS_EXT = $8891; -var - glDepthBoundsEXT: procedure(zmin: GLclampd; zmax: GLclampd); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_EXT_depth_bounds_test: Boolean; - -//***** GL_EXT_secondary_color *****// -const - GL_COLOR_SUM_EXT = $8458; - GL_CURRENT_SECONDARY_COLOR_EXT = $8459; - GL_SECONDARY_COLOR_ARRAY_SIZE_EXT = $845A; - GL_SECONDARY_COLOR_ARRAY_TYPE_EXT = $845B; - GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT = $845C; - GL_SECONDARY_COLOR_ARRAY_POINTER_EXT = $845D; - GL_SECONDARY_COLOR_ARRAY_EXT = $845E; -var - glSecondaryColor3bEXT: procedure(r: GLbyte; g: GLbyte; b: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3sEXT: procedure(r: GLshort; g: GLshort; b: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3iEXT: procedure(r: GLint; g: GLint; b: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3fEXT: procedure(r: GLfloat; g: GLfloat; b: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3dEXT: procedure(r: GLdouble; g: GLdouble; b: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3ubEXT: procedure(r: GLubyte; g: GLubyte; b: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3usEXT: procedure(r: GLushort; g: GLushort; b: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3uiEXT: procedure(r: GLuint; g: GLuint; b: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3bvEXT: procedure(components: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3svEXT: procedure(components: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3ivEXT: procedure(components: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3fvEXT: procedure(components: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3dvEXT: procedure(components: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3ubvEXT: procedure(components: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3usvEXT: procedure(components: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3uivEXT: procedure(components: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColorPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_EXT_secondary_color: Boolean; - -//***** GL_EXT_texture_mirror_clamp *****// -const - GL_MIRROR_CLAMP_EXT = $8742; - GL_MIRROR_CLAMP_TO_EDGE_EXT = $8743; - GL_MIRROR_CLAMP_TO_BORDER_EXT = $8912; - -function Load_GL_EXT_texture_mirror_clamp: Boolean; - -//***** GL_EXT_blend_equation_separate *****// -const - GL_BLEND_EQUATION_RGB_EXT = $8009; - GL_BLEND_EQUATION_ALPHA_EXT = $883D; -var - glBlendEquationSeparateEXT: procedure(modeRGB: GLenum; modeAlpha: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_EXT_blend_equation_separate: Boolean; - -//***** GL_MESA_pack_invert *****// -const - GL_PACK_INVERT_MESA = $8758; - -function Load_GL_MESA_pack_invert: Boolean; - -//***** GL_MESA_ycbcr_texture *****// -const - GL_YCBCR_MESA = $8757; - GL_UNSIGNED_SHORT_8_8_MESA = $85BA; - GL_UNSIGNED_SHORT_8_8_REV_MESA = $85BB; - -function Load_GL_MESA_ycbcr_texture: Boolean; - -//***** GL_ARB_fragment_program_shadow *****// - -function Load_GL_ARB_fragment_program_shadow: Boolean; - -//***** GL_EXT_fog_coord *****// -const - GL_FOG_COORDINATE_SOURCE_EXT = $8450; - GL_FOG_COORDINATE_EXT = $8451; - GL_FRAGMENT_DEPTH_EXT = $8452; - GL_CURRENT_FOG_COORDINATE_EXT = $8453; - GL_FOG_COORDINATE_ARRAY_TYPE_EXT = $8454; - GL_FOG_COORDINATE_ARRAY_STRIDE_EXT = $8455; - GL_FOG_COORDINATE_ARRAY_POINTER_EXT = $8456; - GL_FOG_COORDINATE_ARRAY_EXT = $8457; -var - glFogCoordfEXT: procedure(coord: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFogCoorddEXT: procedure(coord: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFogCoordfvEXT: procedure(coord: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFogCoorddvEXT: procedure(coord: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFogCoordPointerEXT: procedure(_type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -function Load_GL_EXT_fog_coord: Boolean; - -//***** GL_NV_fragment_program_option *****// - -function Load_GL_NV_fragment_program_option: Boolean; - -//***** GL_EXT_pixel_buffer_object *****// -const - GL_PIXEL_PACK_BUFFER_EXT = $88EB; - GL_PIXEL_UNPACK_BUFFER_EXT = $88EC; - GL_PIXEL_PACK_BUFFER_BINDING_EXT = $88ED; - GL_PIXEL_UNPACK_BUFFER_BINDING_EXT = $88EF; - -function Load_GL_EXT_pixel_buffer_object: Boolean; - -//***** GL_NV_fragment_program2 *****// -const - GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV = $88F4; - GL_MAX_PROGRAM_CALL_DEPTH_NV = $88F5; - GL_MAX_PROGRAM_IF_DEPTH_NV = $88F6; - GL_MAX_PROGRAM_LOOP_DEPTH_NV = $88F7; - GL_MAX_PROGRAM_LOOP_COUNT_NV = $88F8; - -function Load_GL_NV_fragment_program2: Boolean; - -//***** GL_NV_vertex_program2_option *****// - // GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV { already defined } - // GL_MAX_PROGRAM_CALL_DEPTH_NV { already defined } - -function Load_GL_NV_vertex_program2_option: Boolean; - -//***** GL_NV_vertex_program3 *****// - // GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB { already defined } - -function Load_GL_NV_vertex_program3: Boolean; - -implementation - -uses - sdl; - -function glext_ExtensionSupported(const extension: PChar; const searchIn: PChar): Boolean; -var - extensions: PChar; - start: PChar; - where, terminator: PChar; -begin - - if (Pos(' ', extension) <> 0) or (extension = '') then - begin - Result := FALSE; - Exit; - end; - - if searchIn = '' then - extensions := glGetString(GL_EXTENSIONS) - else - //StrLCopy( extensions, searchIn, StrLen(searchIn)+1 ); - extensions := searchIn; - start := extensions; - while TRUE do - begin - where := StrPos(start, extension ); - if where = nil then Break; - terminator := Pointer(Integer(where) + Integer( strlen( extension ) ) ); - if (where = start) or (PChar(Integer(where) - 1)^ = ' ') then - begin - if (terminator^ = ' ') or (terminator^ = #0) then - begin - Result := TRUE; - Exit; - end; - end; - start := terminator; - end; - Result := FALSE; - -end; - -function Load_GL_version_1_2: Boolean; -{var - extstring : PChar;} -begin - - Result := FALSE; - //extstring := glGetString( GL_EXTENSIONS ); - - @glCopyTexSubImage3D := SDL_GL_GetProcAddress('glCopyTexSubImage3D'); - if not Assigned(glCopyTexSubImage3D) then Exit; - @glDrawRangeElements := SDL_GL_GetProcAddress('glDrawRangeElements'); - if not Assigned(glDrawRangeElements) then Exit; - @glTexImage3D := SDL_GL_GetProcAddress('glTexImage3D'); - if not Assigned(glTexImage3D) then Exit; - @glTexSubImage3D := SDL_GL_GetProcAddress('glTexSubImage3D'); - if not Assigned(glTexSubImage3D) then Exit; - - Result := TRUE; - -end; - -function Load_GL_ARB_imaging: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_imaging', extstring) then - begin - @glColorTable := SDL_GL_GetProcAddress('glColorTable'); - if not Assigned(glColorTable) then Exit; - @glColorTableParameterfv := SDL_GL_GetProcAddress('glColorTableParameterfv'); - if not Assigned(glColorTableParameterfv) then Exit; - @glColorTableParameteriv := SDL_GL_GetProcAddress('glColorTableParameteriv'); - if not Assigned(glColorTableParameteriv) then Exit; - @glCopyColorTable := SDL_GL_GetProcAddress('glCopyColorTable'); - if not Assigned(glCopyColorTable) then Exit; - @glGetColorTable := SDL_GL_GetProcAddress('glGetColorTable'); - if not Assigned(glGetColorTable) then Exit; - @glGetColorTableParameterfv := SDL_GL_GetProcAddress('glGetColorTableParameterfv'); - if not Assigned(glGetColorTableParameterfv) then Exit; - @glGetColorTableParameteriv := SDL_GL_GetProcAddress('glGetColorTableParameteriv'); - if not Assigned(glGetColorTableParameteriv) then Exit; - @glColorSubTable := SDL_GL_GetProcAddress('glColorSubTable'); - if not Assigned(glColorSubTable) then Exit; - @glCopyColorSubTable := SDL_GL_GetProcAddress('glCopyColorSubTable'); - if not Assigned(glCopyColorSubTable) then Exit; - @glConvolutionFilter1D := SDL_GL_GetProcAddress('glConvolutionFilter1D'); - if not Assigned(glConvolutionFilter1D) then Exit; - @glConvolutionFilter2D := SDL_GL_GetProcAddress('glConvolutionFilter2D'); - if not Assigned(glConvolutionFilter2D) then Exit; - @glConvolutionParameterf := SDL_GL_GetProcAddress('glConvolutionParameterf'); - if not Assigned(glConvolutionParameterf) then Exit; - @glConvolutionParameterfv := SDL_GL_GetProcAddress('glConvolutionParameterfv'); - if not Assigned(glConvolutionParameterfv) then Exit; - @glConvolutionParameteri := SDL_GL_GetProcAddress('glConvolutionParameteri'); - if not Assigned(glConvolutionParameteri) then Exit; - @glConvolutionParameteriv := SDL_GL_GetProcAddress('glConvolutionParameteriv'); - if not Assigned(glConvolutionParameteriv) then Exit; - @glCopyConvolutionFilter1D := SDL_GL_GetProcAddress('glCopyConvolutionFilter1D'); - if not Assigned(glCopyConvolutionFilter1D) then Exit; - @glCopyConvolutionFilter2D := SDL_GL_GetProcAddress('glCopyConvolutionFilter2D'); - if not Assigned(glCopyConvolutionFilter2D) then Exit; - @glGetConvolutionFilter := SDL_GL_GetProcAddress('glGetConvolutionFilter'); - if not Assigned(glGetConvolutionFilter) then Exit; - @glGetConvolutionParameterfv := SDL_GL_GetProcAddress('glGetConvolutionParameterfv'); - if not Assigned(glGetConvolutionParameterfv) then Exit; - @glGetConvolutionParameteriv := SDL_GL_GetProcAddress('glGetConvolutionParameteriv'); - if not Assigned(glGetConvolutionParameteriv) then Exit; - @glGetSeparableFilter := SDL_GL_GetProcAddress('glGetSeparableFilter'); - if not Assigned(glGetSeparableFilter) then Exit; - @glSeparableFilter2D := SDL_GL_GetProcAddress('glSeparableFilter2D'); - if not Assigned(glSeparableFilter2D) then Exit; - @glGetHistogram := SDL_GL_GetProcAddress('glGetHistogram'); - if not Assigned(glGetHistogram) then Exit; - @glGetHistogramParameterfv := SDL_GL_GetProcAddress('glGetHistogramParameterfv'); - if not Assigned(glGetHistogramParameterfv) then Exit; - @glGetHistogramParameteriv := SDL_GL_GetProcAddress('glGetHistogramParameteriv'); - if not Assigned(glGetHistogramParameteriv) then Exit; - @glGetMinmax := SDL_GL_GetProcAddress('glGetMinmax'); - if not Assigned(glGetMinmax) then Exit; - @glGetMinmaxParameterfv := SDL_GL_GetProcAddress('glGetMinmaxParameterfv'); - if not Assigned(glGetMinmaxParameterfv) then Exit; - @glGetMinmaxParameteriv := SDL_GL_GetProcAddress('glGetMinmaxParameteriv'); - if not Assigned(glGetMinmaxParameteriv) then Exit; - @glHistogram := SDL_GL_GetProcAddress('glHistogram'); - if not Assigned(glHistogram) then Exit; - @glMinmax := SDL_GL_GetProcAddress('glMinmax'); - if not Assigned(glMinmax) then Exit; - @glResetHistogram := SDL_GL_GetProcAddress('glResetHistogram'); - if not Assigned(glResetHistogram) then Exit; - @glResetMinmax := SDL_GL_GetProcAddress('glResetMinmax'); - if not Assigned(glResetMinmax) then Exit; - @glBlendEquation := SDL_GL_GetProcAddress('glBlendEquation'); - if not Assigned(glBlendEquation) then Exit; - @glBlendColor := SDL_GL_GetProcAddress('glBlendColor'); - if not Assigned(glBlendColor) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_version_1_3: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - @glActiveTexture := SDL_GL_GetProcAddress('glActiveTexture'); - if not Assigned(glActiveTexture) then Exit; - @glClientActiveTexture := SDL_GL_GetProcAddress('glClientActiveTexture'); - if not Assigned(glClientActiveTexture) then Exit; - @glMultiTexCoord1d := SDL_GL_GetProcAddress('glMultiTexCoord1d'); - if not Assigned(glMultiTexCoord1d) then Exit; - @glMultiTexCoord1dv := SDL_GL_GetProcAddress('glMultiTexCoord1dv'); - if not Assigned(glMultiTexCoord1dv) then Exit; - @glMultiTexCoord1f := SDL_GL_GetProcAddress('glMultiTexCoord1f'); - if not Assigned(glMultiTexCoord1f) then Exit; - @glMultiTexCoord1fv := SDL_GL_GetProcAddress('glMultiTexCoord1fv'); - if not Assigned(glMultiTexCoord1fv) then Exit; - @glMultiTexCoord1i := SDL_GL_GetProcAddress('glMultiTexCoord1i'); - if not Assigned(glMultiTexCoord1i) then Exit; - @glMultiTexCoord1iv := SDL_GL_GetProcAddress('glMultiTexCoord1iv'); - if not Assigned(glMultiTexCoord1iv) then Exit; - @glMultiTexCoord1s := SDL_GL_GetProcAddress('glMultiTexCoord1s'); - if not Assigned(glMultiTexCoord1s) then Exit; - @glMultiTexCoord1sv := SDL_GL_GetProcAddress('glMultiTexCoord1sv'); - if not Assigned(glMultiTexCoord1sv) then Exit; - @glMultiTexCoord2d := SDL_GL_GetProcAddress('glMultiTexCoord2d'); - if not Assigned(glMultiTexCoord2d) then Exit; - @glMultiTexCoord2dv := SDL_GL_GetProcAddress('glMultiTexCoord2dv'); - if not Assigned(glMultiTexCoord2dv) then Exit; - @glMultiTexCoord2f := SDL_GL_GetProcAddress('glMultiTexCoord2f'); - if not Assigned(glMultiTexCoord2f) then Exit; - @glMultiTexCoord2fv := SDL_GL_GetProcAddress('glMultiTexCoord2fv'); - if not Assigned(glMultiTexCoord2fv) then Exit; - @glMultiTexCoord2i := SDL_GL_GetProcAddress('glMultiTexCoord2i'); - if not Assigned(glMultiTexCoord2i) then Exit; - @glMultiTexCoord2iv := SDL_GL_GetProcAddress('glMultiTexCoord2iv'); - if not Assigned(glMultiTexCoord2iv) then Exit; - @glMultiTexCoord2s := SDL_GL_GetProcAddress('glMultiTexCoord2s'); - if not Assigned(glMultiTexCoord2s) then Exit; - @glMultiTexCoord2sv := SDL_GL_GetProcAddress('glMultiTexCoord2sv'); - if not Assigned(glMultiTexCoord2sv) then Exit; - @glMultiTexCoord3d := SDL_GL_GetProcAddress('glMultiTexCoord3d'); - if not Assigned(glMultiTexCoord3d) then Exit; - @glMultiTexCoord3dv := SDL_GL_GetProcAddress('glMultiTexCoord3dv'); - if not Assigned(glMultiTexCoord3dv) then Exit; - @glMultiTexCoord3f := SDL_GL_GetProcAddress('glMultiTexCoord3f'); - if not Assigned(glMultiTexCoord3f) then Exit; - @glMultiTexCoord3fv := SDL_GL_GetProcAddress('glMultiTexCoord3fv'); - if not Assigned(glMultiTexCoord3fv) then Exit; - @glMultiTexCoord3i := SDL_GL_GetProcAddress('glMultiTexCoord3i'); - if not Assigned(glMultiTexCoord3i) then Exit; - @glMultiTexCoord3iv := SDL_GL_GetProcAddress('glMultiTexCoord3iv'); - if not Assigned(glMultiTexCoord3iv) then Exit; - @glMultiTexCoord3s := SDL_GL_GetProcAddress('glMultiTexCoord3s'); - if not Assigned(glMultiTexCoord3s) then Exit; - @glMultiTexCoord3sv := SDL_GL_GetProcAddress('glMultiTexCoord3sv'); - if not Assigned(glMultiTexCoord3sv) then Exit; - @glMultiTexCoord4d := SDL_GL_GetProcAddress('glMultiTexCoord4d'); - if not Assigned(glMultiTexCoord4d) then Exit; - @glMultiTexCoord4dv := SDL_GL_GetProcAddress('glMultiTexCoord4dv'); - if not Assigned(glMultiTexCoord4dv) then Exit; - @glMultiTexCoord4f := SDL_GL_GetProcAddress('glMultiTexCoord4f'); - if not Assigned(glMultiTexCoord4f) then Exit; - @glMultiTexCoord4fv := SDL_GL_GetProcAddress('glMultiTexCoord4fv'); - if not Assigned(glMultiTexCoord4fv) then Exit; - @glMultiTexCoord4i := SDL_GL_GetProcAddress('glMultiTexCoord4i'); - if not Assigned(glMultiTexCoord4i) then Exit; - @glMultiTexCoord4iv := SDL_GL_GetProcAddress('glMultiTexCoord4iv'); - if not Assigned(glMultiTexCoord4iv) then Exit; - @glMultiTexCoord4s := SDL_GL_GetProcAddress('glMultiTexCoord4s'); - if not Assigned(glMultiTexCoord4s) then Exit; - @glMultiTexCoord4sv := SDL_GL_GetProcAddress('glMultiTexCoord4sv'); - if not Assigned(glMultiTexCoord4sv) then Exit; - @glLoadTransposeMatrixf := SDL_GL_GetProcAddress('glLoadTransposeMatrixf'); - if not Assigned(glLoadTransposeMatrixf) then Exit; - @glLoadTransposeMatrixd := SDL_GL_GetProcAddress('glLoadTransposeMatrixd'); - if not Assigned(glLoadTransposeMatrixd) then Exit; - @glMultTransposeMatrixf := SDL_GL_GetProcAddress('glMultTransposeMatrixf'); - if not Assigned(glMultTransposeMatrixf) then Exit; - @glMultTransposeMatrixd := SDL_GL_GetProcAddress('glMultTransposeMatrixd'); - if not Assigned(glMultTransposeMatrixd) then Exit; - @glSampleCoverage := SDL_GL_GetProcAddress('glSampleCoverage'); - if not Assigned(glSampleCoverage) then Exit; - @glCompressedTexImage3D := SDL_GL_GetProcAddress('glCompressedTexImage3D'); - if not Assigned(glCompressedTexImage3D) then Exit; - @glCompressedTexImage2D := SDL_GL_GetProcAddress('glCompressedTexImage2D'); - if not Assigned(glCompressedTexImage2D) then Exit; - @glCompressedTexImage1D := SDL_GL_GetProcAddress('glCompressedTexImage1D'); - if not Assigned(glCompressedTexImage1D) then Exit; - @glCompressedTexSubImage3D := SDL_GL_GetProcAddress('glCompressedTexSubImage3D'); - if not Assigned(glCompressedTexSubImage3D) then Exit; - @glCompressedTexSubImage2D := SDL_GL_GetProcAddress('glCompressedTexSubImage2D'); - if not Assigned(glCompressedTexSubImage2D) then Exit; - @glCompressedTexSubImage1D := SDL_GL_GetProcAddress('glCompressedTexSubImage1D'); - if not Assigned(glCompressedTexSubImage1D) then Exit; - @glGetCompressedTexImage := SDL_GL_GetProcAddress('glGetCompressedTexImage'); - if not Assigned(glGetCompressedTexImage) then Exit; - Result := TRUE; - -end; - -function Load_GL_ARB_multitexture: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_multitexture', extstring) then - begin - @glActiveTextureARB := SDL_GL_GetProcAddress('glActiveTextureARB'); - if not Assigned(glActiveTextureARB) then Exit; - @glClientActiveTextureARB := SDL_GL_GetProcAddress('glClientActiveTextureARB'); - if not Assigned(glClientActiveTextureARB) then Exit; - @glMultiTexCoord1dARB := SDL_GL_GetProcAddress('glMultiTexCoord1dARB'); - if not Assigned(glMultiTexCoord1dARB) then Exit; - @glMultiTexCoord1dvARB := SDL_GL_GetProcAddress('glMultiTexCoord1dvARB'); - if not Assigned(glMultiTexCoord1dvARB) then Exit; - @glMultiTexCoord1fARB := SDL_GL_GetProcAddress('glMultiTexCoord1fARB'); - if not Assigned(glMultiTexCoord1fARB) then Exit; - @glMultiTexCoord1fvARB := SDL_GL_GetProcAddress('glMultiTexCoord1fvARB'); - if not Assigned(glMultiTexCoord1fvARB) then Exit; - @glMultiTexCoord1iARB := SDL_GL_GetProcAddress('glMultiTexCoord1iARB'); - if not Assigned(glMultiTexCoord1iARB) then Exit; - @glMultiTexCoord1ivARB := SDL_GL_GetProcAddress('glMultiTexCoord1ivARB'); - if not Assigned(glMultiTexCoord1ivARB) then Exit; - @glMultiTexCoord1sARB := SDL_GL_GetProcAddress('glMultiTexCoord1sARB'); - if not Assigned(glMultiTexCoord1sARB) then Exit; - @glMultiTexCoord1svARB := SDL_GL_GetProcAddress('glMultiTexCoord1svARB'); - if not Assigned(glMultiTexCoord1svARB) then Exit; - @glMultiTexCoord2dARB := SDL_GL_GetProcAddress('glMultiTexCoord2dARB'); - if not Assigned(glMultiTexCoord2dARB) then Exit; - @glMultiTexCoord2dvARB := SDL_GL_GetProcAddress('glMultiTexCoord2dvARB'); - if not Assigned(glMultiTexCoord2dvARB) then Exit; - @glMultiTexCoord2fARB := SDL_GL_GetProcAddress('glMultiTexCoord2fARB'); - if not Assigned(glMultiTexCoord2fARB) then Exit; - @glMultiTexCoord2fvARB := SDL_GL_GetProcAddress('glMultiTexCoord2fvARB'); - if not Assigned(glMultiTexCoord2fvARB) then Exit; - @glMultiTexCoord2iARB := SDL_GL_GetProcAddress('glMultiTexCoord2iARB'); - if not Assigned(glMultiTexCoord2iARB) then Exit; - @glMultiTexCoord2ivARB := SDL_GL_GetProcAddress('glMultiTexCoord2ivARB'); - if not Assigned(glMultiTexCoord2ivARB) then Exit; - @glMultiTexCoord2sARB := SDL_GL_GetProcAddress('glMultiTexCoord2sARB'); - if not Assigned(glMultiTexCoord2sARB) then Exit; - @glMultiTexCoord2svARB := SDL_GL_GetProcAddress('glMultiTexCoord2svARB'); - if not Assigned(glMultiTexCoord2svARB) then Exit; - @glMultiTexCoord3dARB := SDL_GL_GetProcAddress('glMultiTexCoord3dARB'); - if not Assigned(glMultiTexCoord3dARB) then Exit; - @glMultiTexCoord3dvARB := SDL_GL_GetProcAddress('glMultiTexCoord3dvARB'); - if not Assigned(glMultiTexCoord3dvARB) then Exit; - @glMultiTexCoord3fARB := SDL_GL_GetProcAddress('glMultiTexCoord3fARB'); - if not Assigned(glMultiTexCoord3fARB) then Exit; - @glMultiTexCoord3fvARB := SDL_GL_GetProcAddress('glMultiTexCoord3fvARB'); - if not Assigned(glMultiTexCoord3fvARB) then Exit; - @glMultiTexCoord3iARB := SDL_GL_GetProcAddress('glMultiTexCoord3iARB'); - if not Assigned(glMultiTexCoord3iARB) then Exit; - @glMultiTexCoord3ivARB := SDL_GL_GetProcAddress('glMultiTexCoord3ivARB'); - if not Assigned(glMultiTexCoord3ivARB) then Exit; - @glMultiTexCoord3sARB := SDL_GL_GetProcAddress('glMultiTexCoord3sARB'); - if not Assigned(glMultiTexCoord3sARB) then Exit; - @glMultiTexCoord3svARB := SDL_GL_GetProcAddress('glMultiTexCoord3svARB'); - if not Assigned(glMultiTexCoord3svARB) then Exit; - @glMultiTexCoord4dARB := SDL_GL_GetProcAddress('glMultiTexCoord4dARB'); - if not Assigned(glMultiTexCoord4dARB) then Exit; - @glMultiTexCoord4dvARB := SDL_GL_GetProcAddress('glMultiTexCoord4dvARB'); - if not Assigned(glMultiTexCoord4dvARB) then Exit; - @glMultiTexCoord4fARB := SDL_GL_GetProcAddress('glMultiTexCoord4fARB'); - if not Assigned(glMultiTexCoord4fARB) then Exit; - @glMultiTexCoord4fvARB := SDL_GL_GetProcAddress('glMultiTexCoord4fvARB'); - if not Assigned(glMultiTexCoord4fvARB) then Exit; - @glMultiTexCoord4iARB := SDL_GL_GetProcAddress('glMultiTexCoord4iARB'); - if not Assigned(glMultiTexCoord4iARB) then Exit; - @glMultiTexCoord4ivARB := SDL_GL_GetProcAddress('glMultiTexCoord4ivARB'); - if not Assigned(glMultiTexCoord4ivARB) then Exit; - @glMultiTexCoord4sARB := SDL_GL_GetProcAddress('glMultiTexCoord4sARB'); - if not Assigned(glMultiTexCoord4sARB) then Exit; - @glMultiTexCoord4svARB := SDL_GL_GetProcAddress('glMultiTexCoord4svARB'); - if not Assigned(glMultiTexCoord4svARB) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_ARB_transpose_matrix: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_transpose_matrix', extstring) then - begin - @glLoadTransposeMatrixfARB := SDL_GL_GetProcAddress('glLoadTransposeMatrixfARB'); - if not Assigned(glLoadTransposeMatrixfARB) then Exit; - @glLoadTransposeMatrixdARB := SDL_GL_GetProcAddress('glLoadTransposeMatrixdARB'); - if not Assigned(glLoadTransposeMatrixdARB) then Exit; - @glMultTransposeMatrixfARB := SDL_GL_GetProcAddress('glMultTransposeMatrixfARB'); - if not Assigned(glMultTransposeMatrixfARB) then Exit; - @glMultTransposeMatrixdARB := SDL_GL_GetProcAddress('glMultTransposeMatrixdARB'); - if not Assigned(glMultTransposeMatrixdARB) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_ARB_multisample: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_multisample', extstring) then - begin - @glSampleCoverageARB := SDL_GL_GetProcAddress('glSampleCoverageARB'); - if not Assigned(glSampleCoverageARB) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_ARB_texture_env_add: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_texture_env_add', extstring) then - begin - Result := TRUE; - end; - -end; - -{$IFDEF Win32} -function Load_WGL_ARB_extensions_string: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); - if not Assigned(wglGetExtensionsStringARB) then Exit; - extstring := wglGetExtensionsStringARB(wglGetCurrentDC); - - if glext_ExtensionSupported('WGL_ARB_extensions_string', extstring) then - begin - @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); - if not Assigned(wglGetExtensionsStringARB) then Exit; - Result := TRUE; - end; - -end; - -function Load_WGL_ARB_buffer_region: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); - if not Assigned(wglGetExtensionsStringARB) then Exit; - extstring := wglGetExtensionsStringARB(wglGetCurrentDC); - - if glext_ExtensionSupported('WGL_ARB_buffer_region', extstring) then - begin - @wglCreateBufferRegionARB := SDL_GL_GetProcAddress('wglCreateBufferRegionARB'); - if not Assigned(wglCreateBufferRegionARB) then Exit; - @wglDeleteBufferRegionARB := SDL_GL_GetProcAddress('wglDeleteBufferRegionARB'); - if not Assigned(wglDeleteBufferRegionARB) then Exit; - @wglSaveBufferRegionARB := SDL_GL_GetProcAddress('wglSaveBufferRegionARB'); - if not Assigned(wglSaveBufferRegionARB) then Exit; - @wglRestoreBufferRegionARB := SDL_GL_GetProcAddress('wglRestoreBufferRegionARB'); - if not Assigned(wglRestoreBufferRegionARB) then Exit; - Result := TRUE; - end; - -end; -{$ENDIF} - -function Load_GL_ARB_texture_cube_map: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_texture_cube_map', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_ARB_depth_texture: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_depth_texture', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_ARB_point_parameters: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_point_parameters', extstring) then - begin - @glPointParameterfARB := SDL_GL_GetProcAddress('glPointParameterfARB'); - if not Assigned(glPointParameterfARB) then Exit; - @glPointParameterfvARB := SDL_GL_GetProcAddress('glPointParameterfvARB'); - if not Assigned(glPointParameterfvARB) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_ARB_shadow: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_shadow', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_ARB_shadow_ambient: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_shadow_ambient', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_ARB_texture_border_clamp: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_texture_border_clamp', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_ARB_texture_compression: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_texture_compression', extstring) then - begin - @glCompressedTexImage3DARB := SDL_GL_GetProcAddress('glCompressedTexImage3DARB'); - if not Assigned(glCompressedTexImage3DARB) then Exit; - @glCompressedTexImage2DARB := SDL_GL_GetProcAddress('glCompressedTexImage2DARB'); - if not Assigned(glCompressedTexImage2DARB) then Exit; - @glCompressedTexImage1DARB := SDL_GL_GetProcAddress('glCompressedTexImage1DARB'); - if not Assigned(glCompressedTexImage1DARB) then Exit; - @glCompressedTexSubImage3DARB := SDL_GL_GetProcAddress('glCompressedTexSubImage3DARB'); - if not Assigned(glCompressedTexSubImage3DARB) then Exit; - @glCompressedTexSubImage2DARB := SDL_GL_GetProcAddress('glCompressedTexSubImage2DARB'); - if not Assigned(glCompressedTexSubImage2DARB) then Exit; - @glCompressedTexSubImage1DARB := SDL_GL_GetProcAddress('glCompressedTexSubImage1DARB'); - if not Assigned(glCompressedTexSubImage1DARB) then Exit; - @glGetCompressedTexImageARB := SDL_GL_GetProcAddress('glGetCompressedTexImageARB'); - if not Assigned(glGetCompressedTexImageARB) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_ARB_texture_env_combine: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_texture_env_combine', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_ARB_texture_env_crossbar: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_texture_env_crossbar', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_ARB_texture_env_dot3: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_texture_env_dot3', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_ARB_texture_mirrored_repeat: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_texture_mirrored_repeat', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_ARB_vertex_blend: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_vertex_blend', extstring) then - begin - @glWeightbvARB := SDL_GL_GetProcAddress('glWeightbvARB'); - if not Assigned(glWeightbvARB) then Exit; - @glWeightsvARB := SDL_GL_GetProcAddress('glWeightsvARB'); - if not Assigned(glWeightsvARB) then Exit; - @glWeightivARB := SDL_GL_GetProcAddress('glWeightivARB'); - if not Assigned(glWeightivARB) then Exit; - @glWeightfvARB := SDL_GL_GetProcAddress('glWeightfvARB'); - if not Assigned(glWeightfvARB) then Exit; - @glWeightdvARB := SDL_GL_GetProcAddress('glWeightdvARB'); - if not Assigned(glWeightdvARB) then Exit; - @glWeightvARB := SDL_GL_GetProcAddress('glWeightvARB'); - if not Assigned(glWeightvARB) then Exit; - @glWeightubvARB := SDL_GL_GetProcAddress('glWeightubvARB'); - if not Assigned(glWeightubvARB) then Exit; - @glWeightusvARB := SDL_GL_GetProcAddress('glWeightusvARB'); - if not Assigned(glWeightusvARB) then Exit; - @glWeightuivARB := SDL_GL_GetProcAddress('glWeightuivARB'); - if not Assigned(glWeightuivARB) then Exit; - @glWeightPointerARB := SDL_GL_GetProcAddress('glWeightPointerARB'); - if not Assigned(glWeightPointerARB) then Exit; - @glVertexBlendARB := SDL_GL_GetProcAddress('glVertexBlendARB'); - if not Assigned(glVertexBlendARB) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_ARB_vertex_program: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_vertex_program', extstring) then - begin - @glVertexAttrib1sARB := SDL_GL_GetProcAddress('glVertexAttrib1sARB'); - if not Assigned(glVertexAttrib1sARB) then Exit; - @glVertexAttrib1fARB := SDL_GL_GetProcAddress('glVertexAttrib1fARB'); - if not Assigned(glVertexAttrib1fARB) then Exit; - @glVertexAttrib1dARB := SDL_GL_GetProcAddress('glVertexAttrib1dARB'); - if not Assigned(glVertexAttrib1dARB) then Exit; - @glVertexAttrib2sARB := SDL_GL_GetProcAddress('glVertexAttrib2sARB'); - if not Assigned(glVertexAttrib2sARB) then Exit; - @glVertexAttrib2fARB := SDL_GL_GetProcAddress('glVertexAttrib2fARB'); - if not Assigned(glVertexAttrib2fARB) then Exit; - @glVertexAttrib2dARB := SDL_GL_GetProcAddress('glVertexAttrib2dARB'); - if not Assigned(glVertexAttrib2dARB) then Exit; - @glVertexAttrib3sARB := SDL_GL_GetProcAddress('glVertexAttrib3sARB'); - if not Assigned(glVertexAttrib3sARB) then Exit; - @glVertexAttrib3fARB := SDL_GL_GetProcAddress('glVertexAttrib3fARB'); - if not Assigned(glVertexAttrib3fARB) then Exit; - @glVertexAttrib3dARB := SDL_GL_GetProcAddress('glVertexAttrib3dARB'); - if not Assigned(glVertexAttrib3dARB) then Exit; - @glVertexAttrib4sARB := SDL_GL_GetProcAddress('glVertexAttrib4sARB'); - if not Assigned(glVertexAttrib4sARB) then Exit; - @glVertexAttrib4fARB := SDL_GL_GetProcAddress('glVertexAttrib4fARB'); - if not Assigned(glVertexAttrib4fARB) then Exit; - @glVertexAttrib4dARB := SDL_GL_GetProcAddress('glVertexAttrib4dARB'); - if not Assigned(glVertexAttrib4dARB) then Exit; - @glVertexAttrib4NubARB := SDL_GL_GetProcAddress('glVertexAttrib4NubARB'); - if not Assigned(glVertexAttrib4NubARB) then Exit; - @glVertexAttrib1svARB := SDL_GL_GetProcAddress('glVertexAttrib1svARB'); - if not Assigned(glVertexAttrib1svARB) then Exit; - @glVertexAttrib1fvARB := SDL_GL_GetProcAddress('glVertexAttrib1fvARB'); - if not Assigned(glVertexAttrib1fvARB) then Exit; - @glVertexAttrib1dvARB := SDL_GL_GetProcAddress('glVertexAttrib1dvARB'); - if not Assigned(glVertexAttrib1dvARB) then Exit; - @glVertexAttrib2svARB := SDL_GL_GetProcAddress('glVertexAttrib2svARB'); - if not Assigned(glVertexAttrib2svARB) then Exit; - @glVertexAttrib2fvARB := SDL_GL_GetProcAddress('glVertexAttrib2fvARB'); - if not Assigned(glVertexAttrib2fvARB) then Exit; - @glVertexAttrib2dvARB := SDL_GL_GetProcAddress('glVertexAttrib2dvARB'); - if not Assigned(glVertexAttrib2dvARB) then Exit; - @glVertexAttrib3svARB := SDL_GL_GetProcAddress('glVertexAttrib3svARB'); - if not Assigned(glVertexAttrib3svARB) then Exit; - @glVertexAttrib3fvARB := SDL_GL_GetProcAddress('glVertexAttrib3fvARB'); - if not Assigned(glVertexAttrib3fvARB) then Exit; - @glVertexAttrib3dvARB := SDL_GL_GetProcAddress('glVertexAttrib3dvARB'); - if not Assigned(glVertexAttrib3dvARB) then Exit; - @glVertexAttrib4bvARB := SDL_GL_GetProcAddress('glVertexAttrib4bvARB'); - if not Assigned(glVertexAttrib4bvARB) then Exit; - @glVertexAttrib4svARB := SDL_GL_GetProcAddress('glVertexAttrib4svARB'); - if not Assigned(glVertexAttrib4svARB) then Exit; - @glVertexAttrib4ivARB := SDL_GL_GetProcAddress('glVertexAttrib4ivARB'); - if not Assigned(glVertexAttrib4ivARB) then Exit; - @glVertexAttrib4ubvARB := SDL_GL_GetProcAddress('glVertexAttrib4ubvARB'); - if not Assigned(glVertexAttrib4ubvARB) then Exit; - @glVertexAttrib4usvARB := SDL_GL_GetProcAddress('glVertexAttrib4usvARB'); - if not Assigned(glVertexAttrib4usvARB) then Exit; - @glVertexAttrib4uivARB := SDL_GL_GetProcAddress('glVertexAttrib4uivARB'); - if not Assigned(glVertexAttrib4uivARB) then Exit; - @glVertexAttrib4fvARB := SDL_GL_GetProcAddress('glVertexAttrib4fvARB'); - if not Assigned(glVertexAttrib4fvARB) then Exit; - @glVertexAttrib4dvARB := SDL_GL_GetProcAddress('glVertexAttrib4dvARB'); - if not Assigned(glVertexAttrib4dvARB) then Exit; - @glVertexAttrib4NbvARB := SDL_GL_GetProcAddress('glVertexAttrib4NbvARB'); - if not Assigned(glVertexAttrib4NbvARB) then Exit; - @glVertexAttrib4NsvARB := SDL_GL_GetProcAddress('glVertexAttrib4NsvARB'); - if not Assigned(glVertexAttrib4NsvARB) then Exit; - @glVertexAttrib4NivARB := SDL_GL_GetProcAddress('glVertexAttrib4NivARB'); - if not Assigned(glVertexAttrib4NivARB) then Exit; - @glVertexAttrib4NubvARB := SDL_GL_GetProcAddress('glVertexAttrib4NubvARB'); - if not Assigned(glVertexAttrib4NubvARB) then Exit; - @glVertexAttrib4NusvARB := SDL_GL_GetProcAddress('glVertexAttrib4NusvARB'); - if not Assigned(glVertexAttrib4NusvARB) then Exit; - @glVertexAttrib4NuivARB := SDL_GL_GetProcAddress('glVertexAttrib4NuivARB'); - if not Assigned(glVertexAttrib4NuivARB) then Exit; - @glVertexAttribPointerARB := SDL_GL_GetProcAddress('glVertexAttribPointerARB'); - if not Assigned(glVertexAttribPointerARB) then Exit; - @glEnableVertexAttribArrayARB := SDL_GL_GetProcAddress('glEnableVertexAttribArrayARB'); - if not Assigned(glEnableVertexAttribArrayARB) then Exit; - @glDisableVertexAttribArrayARB := SDL_GL_GetProcAddress('glDisableVertexAttribArrayARB'); - if not Assigned(glDisableVertexAttribArrayARB) then Exit; - @glProgramStringARB := SDL_GL_GetProcAddress('glProgramStringARB'); - if not Assigned(glProgramStringARB) then Exit; - @glBindProgramARB := SDL_GL_GetProcAddress('glBindProgramARB'); - if not Assigned(glBindProgramARB) then Exit; - @glDeleteProgramsARB := SDL_GL_GetProcAddress('glDeleteProgramsARB'); - if not Assigned(glDeleteProgramsARB) then Exit; - @glGenProgramsARB := SDL_GL_GetProcAddress('glGenProgramsARB'); - if not Assigned(glGenProgramsARB) then Exit; - @glProgramEnvParameter4dARB := SDL_GL_GetProcAddress('glProgramEnvParameter4dARB'); - if not Assigned(glProgramEnvParameter4dARB) then Exit; - @glProgramEnvParameter4dvARB := SDL_GL_GetProcAddress('glProgramEnvParameter4dvARB'); - if not Assigned(glProgramEnvParameter4dvARB) then Exit; - @glProgramEnvParameter4fARB := SDL_GL_GetProcAddress('glProgramEnvParameter4fARB'); - if not Assigned(glProgramEnvParameter4fARB) then Exit; - @glProgramEnvParameter4fvARB := SDL_GL_GetProcAddress('glProgramEnvParameter4fvARB'); - if not Assigned(glProgramEnvParameter4fvARB) then Exit; - @glProgramLocalParameter4dARB := SDL_GL_GetProcAddress('glProgramLocalParameter4dARB'); - if not Assigned(glProgramLocalParameter4dARB) then Exit; - @glProgramLocalParameter4dvARB := SDL_GL_GetProcAddress('glProgramLocalParameter4dvARB'); - if not Assigned(glProgramLocalParameter4dvARB) then Exit; - @glProgramLocalParameter4fARB := SDL_GL_GetProcAddress('glProgramLocalParameter4fARB'); - if not Assigned(glProgramLocalParameter4fARB) then Exit; - @glProgramLocalParameter4fvARB := SDL_GL_GetProcAddress('glProgramLocalParameter4fvARB'); - if not Assigned(glProgramLocalParameter4fvARB) then Exit; - @glGetProgramEnvParameterdvARB := SDL_GL_GetProcAddress('glGetProgramEnvParameterdvARB'); - if not Assigned(glGetProgramEnvParameterdvARB) then Exit; - @glGetProgramEnvParameterfvARB := SDL_GL_GetProcAddress('glGetProgramEnvParameterfvARB'); - if not Assigned(glGetProgramEnvParameterfvARB) then Exit; - @glGetProgramLocalParameterdvARB := SDL_GL_GetProcAddress('glGetProgramLocalParameterdvARB'); - if not Assigned(glGetProgramLocalParameterdvARB) then Exit; - @glGetProgramLocalParameterfvARB := SDL_GL_GetProcAddress('glGetProgramLocalParameterfvARB'); - if not Assigned(glGetProgramLocalParameterfvARB) then Exit; - @glGetProgramivARB := SDL_GL_GetProcAddress('glGetProgramivARB'); - if not Assigned(glGetProgramivARB) then Exit; - @glGetProgramStringARB := SDL_GL_GetProcAddress('glGetProgramStringARB'); - if not Assigned(glGetProgramStringARB) then Exit; - @glGetVertexAttribdvARB := SDL_GL_GetProcAddress('glGetVertexAttribdvARB'); - if not Assigned(glGetVertexAttribdvARB) then Exit; - @glGetVertexAttribfvARB := SDL_GL_GetProcAddress('glGetVertexAttribfvARB'); - if not Assigned(glGetVertexAttribfvARB) then Exit; - @glGetVertexAttribivARB := SDL_GL_GetProcAddress('glGetVertexAttribivARB'); - if not Assigned(glGetVertexAttribivARB) then Exit; - @glGetVertexAttribPointervARB := SDL_GL_GetProcAddress('glGetVertexAttribPointervARB'); - if not Assigned(glGetVertexAttribPointervARB) then Exit; - @glIsProgramARB := SDL_GL_GetProcAddress('glIsProgramARB'); - if not Assigned(glIsProgramARB) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_ARB_window_pos: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_window_pos', extstring) then - begin - @glWindowPos2dARB := SDL_GL_GetProcAddress('glWindowPos2dARB'); - if not Assigned(glWindowPos2dARB) then Exit; - @glWindowPos2fARB := SDL_GL_GetProcAddress('glWindowPos2fARB'); - if not Assigned(glWindowPos2fARB) then Exit; - @glWindowPos2iARB := SDL_GL_GetProcAddress('glWindowPos2iARB'); - if not Assigned(glWindowPos2iARB) then Exit; - @glWindowPos2sARB := SDL_GL_GetProcAddress('glWindowPos2sARB'); - if not Assigned(glWindowPos2sARB) then Exit; - @glWindowPos2dvARB := SDL_GL_GetProcAddress('glWindowPos2dvARB'); - if not Assigned(glWindowPos2dvARB) then Exit; - @glWindowPos2fvARB := SDL_GL_GetProcAddress('glWindowPos2fvARB'); - if not Assigned(glWindowPos2fvARB) then Exit; - @glWindowPos2ivARB := SDL_GL_GetProcAddress('glWindowPos2ivARB'); - if not Assigned(glWindowPos2ivARB) then Exit; - @glWindowPos2svARB := SDL_GL_GetProcAddress('glWindowPos2svARB'); - if not Assigned(glWindowPos2svARB) then Exit; - @glWindowPos3dARB := SDL_GL_GetProcAddress('glWindowPos3dARB'); - if not Assigned(glWindowPos3dARB) then Exit; - @glWindowPos3fARB := SDL_GL_GetProcAddress('glWindowPos3fARB'); - if not Assigned(glWindowPos3fARB) then Exit; - @glWindowPos3iARB := SDL_GL_GetProcAddress('glWindowPos3iARB'); - if not Assigned(glWindowPos3iARB) then Exit; - @glWindowPos3sARB := SDL_GL_GetProcAddress('glWindowPos3sARB'); - if not Assigned(glWindowPos3sARB) then Exit; - @glWindowPos3dvARB := SDL_GL_GetProcAddress('glWindowPos3dvARB'); - if not Assigned(glWindowPos3dvARB) then Exit; - @glWindowPos3fvARB := SDL_GL_GetProcAddress('glWindowPos3fvARB'); - if not Assigned(glWindowPos3fvARB) then Exit; - @glWindowPos3ivARB := SDL_GL_GetProcAddress('glWindowPos3ivARB'); - if not Assigned(glWindowPos3ivARB) then Exit; - @glWindowPos3svARB := SDL_GL_GetProcAddress('glWindowPos3svARB'); - if not Assigned(glWindowPos3svARB) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_EXT_422_pixels: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_422_pixels', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_EXT_abgr: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_abgr', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_EXT_bgra: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_bgra', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_EXT_blend_color: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_blend_color', extstring) then - begin - @glBlendColorEXT := SDL_GL_GetProcAddress('glBlendColorEXT'); - if not Assigned(glBlendColorEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_EXT_blend_func_separate: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_blend_func_separate', extstring) then - begin - @glBlendFuncSeparateEXT := SDL_GL_GetProcAddress('glBlendFuncSeparateEXT'); - if not Assigned(glBlendFuncSeparateEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_EXT_blend_logic_op: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_blend_logic_op', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_EXT_blend_minmax: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_blend_minmax', extstring) then - begin - @glBlendEquationEXT := SDL_GL_GetProcAddress('glBlendEquationEXT'); - if not Assigned(glBlendEquationEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_EXT_blend_subtract: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_blend_subtract', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_EXT_clip_volume_hint: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_clip_volume_hint', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_EXT_color_subtable: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_color_subtable', extstring) then - begin - @glColorSubTableEXT := SDL_GL_GetProcAddress('glColorSubTableEXT'); - if not Assigned(glColorSubTableEXT) then Exit; - @glCopyColorSubTableEXT := SDL_GL_GetProcAddress('glCopyColorSubTableEXT'); - if not Assigned(glCopyColorSubTableEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_EXT_compiled_vertex_array: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_compiled_vertex_array', extstring) then - begin - @glLockArraysEXT := SDL_GL_GetProcAddress('glLockArraysEXT'); - if not Assigned(glLockArraysEXT) then Exit; - @glUnlockArraysEXT := SDL_GL_GetProcAddress('glUnlockArraysEXT'); - if not Assigned(glUnlockArraysEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_EXT_convolution: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_convolution', extstring) then - begin - @glConvolutionFilter1DEXT := SDL_GL_GetProcAddress('glConvolutionFilter1DEXT'); - if not Assigned(glConvolutionFilter1DEXT) then Exit; - @glConvolutionFilter2DEXT := SDL_GL_GetProcAddress('glConvolutionFilter2DEXT'); - if not Assigned(glConvolutionFilter2DEXT) then Exit; - @glCopyConvolutionFilter1DEXT := SDL_GL_GetProcAddress('glCopyConvolutionFilter1DEXT'); - if not Assigned(glCopyConvolutionFilter1DEXT) then Exit; - @glCopyConvolutionFilter2DEXT := SDL_GL_GetProcAddress('glCopyConvolutionFilter2DEXT'); - if not Assigned(glCopyConvolutionFilter2DEXT) then Exit; - @glGetConvolutionFilterEXT := SDL_GL_GetProcAddress('glGetConvolutionFilterEXT'); - if not Assigned(glGetConvolutionFilterEXT) then Exit; - @glSeparableFilter2DEXT := SDL_GL_GetProcAddress('glSeparableFilter2DEXT'); - if not Assigned(glSeparableFilter2DEXT) then Exit; - @glGetSeparableFilterEXT := SDL_GL_GetProcAddress('glGetSeparableFilterEXT'); - if not Assigned(glGetSeparableFilterEXT) then Exit; - @glConvolutionParameteriEXT := SDL_GL_GetProcAddress('glConvolutionParameteriEXT'); - if not Assigned(glConvolutionParameteriEXT) then Exit; - @glConvolutionParameterivEXT := SDL_GL_GetProcAddress('glConvolutionParameterivEXT'); - if not Assigned(glConvolutionParameterivEXT) then Exit; - @glConvolutionParameterfEXT := SDL_GL_GetProcAddress('glConvolutionParameterfEXT'); - if not Assigned(glConvolutionParameterfEXT) then Exit; - @glConvolutionParameterfvEXT := SDL_GL_GetProcAddress('glConvolutionParameterfvEXT'); - if not Assigned(glConvolutionParameterfvEXT) then Exit; - @glGetConvolutionParameterivEXT := SDL_GL_GetProcAddress('glGetConvolutionParameterivEXT'); - if not Assigned(glGetConvolutionParameterivEXT) then Exit; - @glGetConvolutionParameterfvEXT := SDL_GL_GetProcAddress('glGetConvolutionParameterfvEXT'); - if not Assigned(glGetConvolutionParameterfvEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_EXT_histogram: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_histogram', extstring) then - begin - @glHistogramEXT := SDL_GL_GetProcAddress('glHistogramEXT'); - if not Assigned(glHistogramEXT) then Exit; - @glResetHistogramEXT := SDL_GL_GetProcAddress('glResetHistogramEXT'); - if not Assigned(glResetHistogramEXT) then Exit; - @glGetHistogramEXT := SDL_GL_GetProcAddress('glGetHistogramEXT'); - if not Assigned(glGetHistogramEXT) then Exit; - @glGetHistogramParameterivEXT := SDL_GL_GetProcAddress('glGetHistogramParameterivEXT'); - if not Assigned(glGetHistogramParameterivEXT) then Exit; - @glGetHistogramParameterfvEXT := SDL_GL_GetProcAddress('glGetHistogramParameterfvEXT'); - if not Assigned(glGetHistogramParameterfvEXT) then Exit; - @glMinmaxEXT := SDL_GL_GetProcAddress('glMinmaxEXT'); - if not Assigned(glMinmaxEXT) then Exit; - @glResetMinmaxEXT := SDL_GL_GetProcAddress('glResetMinmaxEXT'); - if not Assigned(glResetMinmaxEXT) then Exit; - @glGetMinmaxEXT := SDL_GL_GetProcAddress('glGetMinmaxEXT'); - if not Assigned(glGetMinmaxEXT) then Exit; - @glGetMinmaxParameterivEXT := SDL_GL_GetProcAddress('glGetMinmaxParameterivEXT'); - if not Assigned(glGetMinmaxParameterivEXT) then Exit; - @glGetMinmaxParameterfvEXT := SDL_GL_GetProcAddress('glGetMinmaxParameterfvEXT'); - if not Assigned(glGetMinmaxParameterfvEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_EXT_multi_draw_arrays: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_multi_draw_arrays', extstring) then - begin - @glMultiDrawArraysEXT := SDL_GL_GetProcAddress('glMultiDrawArraysEXT'); - if not Assigned(glMultiDrawArraysEXT) then Exit; - @glMultiDrawElementsEXT := SDL_GL_GetProcAddress('glMultiDrawElementsEXT'); - if not Assigned(glMultiDrawElementsEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_EXT_packed_pixels: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_packed_pixels', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_EXT_paletted_texture: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_paletted_texture', extstring) then - begin - @glColorTableEXT := SDL_GL_GetProcAddress('glColorTableEXT'); - if not Assigned(glColorTableEXT) then Exit; - @glColorSubTableEXT := SDL_GL_GetProcAddress('glColorSubTableEXT'); - if not Assigned(glColorSubTableEXT) then Exit; - @glGetColorTableEXT := SDL_GL_GetProcAddress('glGetColorTableEXT'); - if not Assigned(glGetColorTableEXT) then Exit; - @glGetColorTableParameterivEXT := SDL_GL_GetProcAddress('glGetColorTableParameterivEXT'); - if not Assigned(glGetColorTableParameterivEXT) then Exit; - @glGetColorTableParameterfvEXT := SDL_GL_GetProcAddress('glGetColorTableParameterfvEXT'); - if not Assigned(glGetColorTableParameterfvEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_EXT_point_parameters: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_point_parameters', extstring) then - begin - @glPointParameterfEXT := SDL_GL_GetProcAddress('glPointParameterfEXT'); - if not Assigned(glPointParameterfEXT) then Exit; - @glPointParameterfvEXT := SDL_GL_GetProcAddress('glPointParameterfvEXT'); - if not Assigned(glPointParameterfvEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_EXT_polygon_offset: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_polygon_offset', extstring) then - begin - @glPolygonOffsetEXT := SDL_GL_GetProcAddress('glPolygonOffsetEXT'); - if not Assigned(glPolygonOffsetEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_EXT_separate_specular_color: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_separate_specular_color', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_EXT_shadow_funcs: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_shadow_funcs', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_EXT_shared_texture_palette: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_shared_texture_palette', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_EXT_stencil_two_side: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_stencil_two_side', extstring) then - begin - @glActiveStencilFaceEXT := SDL_GL_GetProcAddress('glActiveStencilFaceEXT'); - if not Assigned(glActiveStencilFaceEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_EXT_stencil_wrap: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_stencil_wrap', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_EXT_subtexture: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_subtexture', extstring) then - begin - @glTexSubImage1DEXT := SDL_GL_GetProcAddress('glTexSubImage1DEXT'); - if not Assigned(glTexSubImage1DEXT) then Exit; - @glTexSubImage2DEXT := SDL_GL_GetProcAddress('glTexSubImage2DEXT'); - if not Assigned(glTexSubImage2DEXT) then Exit; - @glTexSubImage3DEXT := SDL_GL_GetProcAddress('glTexSubImage3DEXT'); - if not Assigned(glTexSubImage3DEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_EXT_texture3D: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_texture3D', extstring) then - begin - glTexImage3DEXT := SDL_GL_GetProcAddress('glTexImage3DEXT'); - if not Assigned(glTexImage3DEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_EXT_texture_compression_s3tc: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_texture_compression_s3tc', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_EXT_texture_env_add: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_texture_env_add', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_EXT_texture_env_combine: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_texture_env_combine', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_EXT_texture_env_dot3: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_texture_env_dot3', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_EXT_texture_filter_anisotropic: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_texture_filter_anisotropic', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_EXT_texture_lod_bias: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_texture_lod_bias', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_EXT_texture_object: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_texture_object', extstring) then - begin - @glGenTexturesEXT := SDL_GL_GetProcAddress('glGenTexturesEXT'); - if not Assigned(glGenTexturesEXT) then Exit; - @glDeleteTexturesEXT := SDL_GL_GetProcAddress('glDeleteTexturesEXT'); - if not Assigned(glDeleteTexturesEXT) then Exit; - @glBindTextureEXT := SDL_GL_GetProcAddress('glBindTextureEXT'); - if not Assigned(glBindTextureEXT) then Exit; - @glPrioritizeTexturesEXT := SDL_GL_GetProcAddress('glPrioritizeTexturesEXT'); - if not Assigned(glPrioritizeTexturesEXT) then Exit; - @glAreTexturesResidentEXT := SDL_GL_GetProcAddress('glAreTexturesResidentEXT'); - if not Assigned(glAreTexturesResidentEXT) then Exit; - @glIsTextureEXT := SDL_GL_GetProcAddress('glIsTextureEXT'); - if not Assigned(glIsTextureEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_EXT_vertex_array: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_vertex_array', extstring) then - begin - @glArrayElementEXT := SDL_GL_GetProcAddress('glArrayElementEXT'); - if not Assigned(glArrayElementEXT) then Exit; - @glDrawArraysEXT := SDL_GL_GetProcAddress('glDrawArraysEXT'); - if not Assigned(glDrawArraysEXT) then Exit; - @glVertexPointerEXT := SDL_GL_GetProcAddress('glVertexPointerEXT'); - if not Assigned(glVertexPointerEXT) then Exit; - @glNormalPointerEXT := SDL_GL_GetProcAddress('glNormalPointerEXT'); - if not Assigned(glNormalPointerEXT) then Exit; - @glColorPointerEXT := SDL_GL_GetProcAddress('glColorPointerEXT'); - if not Assigned(glColorPointerEXT) then Exit; - @glIndexPointerEXT := SDL_GL_GetProcAddress('glIndexPointerEXT'); - if not Assigned(glIndexPointerEXT) then Exit; - @glTexCoordPointerEXT := SDL_GL_GetProcAddress('glTexCoordPointerEXT'); - if not Assigned(glTexCoordPointerEXT) then Exit; - @glEdgeFlagPointerEXT := SDL_GL_GetProcAddress('glEdgeFlagPointerEXT'); - if not Assigned(glEdgeFlagPointerEXT) then Exit; - @glGetPointervEXT := SDL_GL_GetProcAddress('glGetPointervEXT'); - if not Assigned(glGetPointervEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_EXT_vertex_shader: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_vertex_shader', extstring) then - begin - @glBeginVertexShaderEXT := SDL_GL_GetProcAddress('glBeginVertexShaderEXT'); - if not Assigned(glBeginVertexShaderEXT) then Exit; - @glEndVertexShaderEXT := SDL_GL_GetProcAddress('glEndVertexShaderEXT'); - if not Assigned(glEndVertexShaderEXT) then Exit; - @glBindVertexShaderEXT := SDL_GL_GetProcAddress('glBindVertexShaderEXT'); - if not Assigned(glBindVertexShaderEXT) then Exit; - @glGenVertexShadersEXT := SDL_GL_GetProcAddress('glGenVertexShadersEXT'); - if not Assigned(glGenVertexShadersEXT) then Exit; - @glDeleteVertexShaderEXT := SDL_GL_GetProcAddress('glDeleteVertexShaderEXT'); - if not Assigned(glDeleteVertexShaderEXT) then Exit; - @glShaderOp1EXT := SDL_GL_GetProcAddress('glShaderOp1EXT'); - if not Assigned(glShaderOp1EXT) then Exit; - @glShaderOp2EXT := SDL_GL_GetProcAddress('glShaderOp2EXT'); - if not Assigned(glShaderOp2EXT) then Exit; - @glShaderOp3EXT := SDL_GL_GetProcAddress('glShaderOp3EXT'); - if not Assigned(glShaderOp3EXT) then Exit; - @glSwizzleEXT := SDL_GL_GetProcAddress('glSwizzleEXT'); - if not Assigned(glSwizzleEXT) then Exit; - @glWriteMaskEXT := SDL_GL_GetProcAddress('glWriteMaskEXT'); - if not Assigned(glWriteMaskEXT) then Exit; - @glInsertComponentEXT := SDL_GL_GetProcAddress('glInsertComponentEXT'); - if not Assigned(glInsertComponentEXT) then Exit; - @glExtractComponentEXT := SDL_GL_GetProcAddress('glExtractComponentEXT'); - if not Assigned(glExtractComponentEXT) then Exit; - @glGenSymbolsEXT := SDL_GL_GetProcAddress('glGenSymbolsEXT'); - if not Assigned(glGenSymbolsEXT) then Exit; - @glSetInvariantEXT := SDL_GL_GetProcAddress('glSetInvariantEXT'); - if not Assigned(glSetInvariantEXT) then Exit; - @glSetLocalConstantEXT := SDL_GL_GetProcAddress('glSetLocalConstantEXT'); - if not Assigned(glSetLocalConstantEXT) then Exit; - @glVariantbvEXT := SDL_GL_GetProcAddress('glVariantbvEXT'); - if not Assigned(glVariantbvEXT) then Exit; - @glVariantsvEXT := SDL_GL_GetProcAddress('glVariantsvEXT'); - if not Assigned(glVariantsvEXT) then Exit; - @glVariantivEXT := SDL_GL_GetProcAddress('glVariantivEXT'); - if not Assigned(glVariantivEXT) then Exit; - @glVariantfvEXT := SDL_GL_GetProcAddress('glVariantfvEXT'); - if not Assigned(glVariantfvEXT) then Exit; - @glVariantdvEXT := SDL_GL_GetProcAddress('glVariantdvEXT'); - if not Assigned(glVariantdvEXT) then Exit; - @glVariantubvEXT := SDL_GL_GetProcAddress('glVariantubvEXT'); - if not Assigned(glVariantubvEXT) then Exit; - @glVariantusvEXT := SDL_GL_GetProcAddress('glVariantusvEXT'); - if not Assigned(glVariantusvEXT) then Exit; - @glVariantuivEXT := SDL_GL_GetProcAddress('glVariantuivEXT'); - if not Assigned(glVariantuivEXT) then Exit; - @glVariantPointerEXT := SDL_GL_GetProcAddress('glVariantPointerEXT'); - if not Assigned(glVariantPointerEXT) then Exit; - @glEnableVariantClientStateEXT := SDL_GL_GetProcAddress('glEnableVariantClientStateEXT'); - if not Assigned(glEnableVariantClientStateEXT) then Exit; - @glDisableVariantClientStateEXT := SDL_GL_GetProcAddress('glDisableVariantClientStateEXT'); - if not Assigned(glDisableVariantClientStateEXT) then Exit; - @glBindLightParameterEXT := SDL_GL_GetProcAddress('glBindLightParameterEXT'); - if not Assigned(glBindLightParameterEXT) then Exit; - @glBindMaterialParameterEXT := SDL_GL_GetProcAddress('glBindMaterialParameterEXT'); - if not Assigned(glBindMaterialParameterEXT) then Exit; - @glBindTexGenParameterEXT := SDL_GL_GetProcAddress('glBindTexGenParameterEXT'); - if not Assigned(glBindTexGenParameterEXT) then Exit; - @glBindTextureUnitParameterEXT := SDL_GL_GetProcAddress('glBindTextureUnitParameterEXT'); - if not Assigned(glBindTextureUnitParameterEXT) then Exit; - @glBindParameterEXT := SDL_GL_GetProcAddress('glBindParameterEXT'); - if not Assigned(glBindParameterEXT) then Exit; - @glIsVariantEnabledEXT := SDL_GL_GetProcAddress('glIsVariantEnabledEXT'); - if not Assigned(glIsVariantEnabledEXT) then Exit; - @glGetVariantBooleanvEXT := SDL_GL_GetProcAddress('glGetVariantBooleanvEXT'); - if not Assigned(glGetVariantBooleanvEXT) then Exit; - @glGetVariantIntegervEXT := SDL_GL_GetProcAddress('glGetVariantIntegervEXT'); - if not Assigned(glGetVariantIntegervEXT) then Exit; - @glGetVariantFloatvEXT := SDL_GL_GetProcAddress('glGetVariantFloatvEXT'); - if not Assigned(glGetVariantFloatvEXT) then Exit; - @glGetVariantPointervEXT := SDL_GL_GetProcAddress('glGetVariantPointervEXT'); - if not Assigned(glGetVariantPointervEXT) then Exit; - @glGetInvariantBooleanvEXT := SDL_GL_GetProcAddress('glGetInvariantBooleanvEXT'); - if not Assigned(glGetInvariantBooleanvEXT) then Exit; - @glGetInvariantIntegervEXT := SDL_GL_GetProcAddress('glGetInvariantIntegervEXT'); - if not Assigned(glGetInvariantIntegervEXT) then Exit; - @glGetInvariantFloatvEXT := SDL_GL_GetProcAddress('glGetInvariantFloatvEXT'); - if not Assigned(glGetInvariantFloatvEXT) then Exit; - @glGetLocalConstantBooleanvEXT := SDL_GL_GetProcAddress('glGetLocalConstantBooleanvEXT'); - if not Assigned(glGetLocalConstantBooleanvEXT) then Exit; - @glGetLocalConstantIntegervEXT := SDL_GL_GetProcAddress('glGetLocalConstantIntegervEXT'); - if not Assigned(glGetLocalConstantIntegervEXT) then Exit; - @glGetLocalConstantFloatvEXT := SDL_GL_GetProcAddress('glGetLocalConstantFloatvEXT'); - if not Assigned(glGetLocalConstantFloatvEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_EXT_vertex_weighting: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_vertex_weighting', extstring) then - begin - @glVertexWeightfEXT := SDL_GL_GetProcAddress('glVertexWeightfEXT'); - if not Assigned(glVertexWeightfEXT) then Exit; - @glVertexWeightfvEXT := SDL_GL_GetProcAddress('glVertexWeightfvEXT'); - if not Assigned(glVertexWeightfvEXT) then Exit; - @glVertexWeightPointerEXT := SDL_GL_GetProcAddress('glVertexWeightPointerEXT'); - if not Assigned(glVertexWeightPointerEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_HP_occlusion_test: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_HP_occlusion_test', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_blend_square: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_blend_square', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_copy_depth_to_color: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_copy_depth_to_color', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_depth_clamp: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_depth_clamp', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_evaluators: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_evaluators', extstring) then - begin - @glMapControlPointsNV := SDL_GL_GetProcAddress('glMapControlPointsNV'); - if not Assigned(glMapControlPointsNV) then Exit; - @glMapParameterivNV := SDL_GL_GetProcAddress('glMapParameterivNV'); - if not Assigned(glMapParameterivNV) then Exit; - @glMapParameterfvNV := SDL_GL_GetProcAddress('glMapParameterfvNV'); - if not Assigned(glMapParameterfvNV) then Exit; - @glGetMapControlPointsNV := SDL_GL_GetProcAddress('glGetMapControlPointsNV'); - if not Assigned(glGetMapControlPointsNV) then Exit; - @glGetMapParameterivNV := SDL_GL_GetProcAddress('glGetMapParameterivNV'); - if not Assigned(glGetMapParameterivNV) then Exit; - @glGetMapParameterfvNV := SDL_GL_GetProcAddress('glGetMapParameterfvNV'); - if not Assigned(glGetMapParameterfvNV) then Exit; - @glGetMapAttribParameterivNV := SDL_GL_GetProcAddress('glGetMapAttribParameterivNV'); - if not Assigned(glGetMapAttribParameterivNV) then Exit; - @glGetMapAttribParameterfvNV := SDL_GL_GetProcAddress('glGetMapAttribParameterfvNV'); - if not Assigned(glGetMapAttribParameterfvNV) then Exit; - @glEvalMapsNV := SDL_GL_GetProcAddress('glEvalMapsNV'); - if not Assigned(glEvalMapsNV) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_NV_fence: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_fence', extstring) then - begin - @glGenFencesNV := SDL_GL_GetProcAddress('glGenFencesNV'); - if not Assigned(glGenFencesNV) then Exit; - @glDeleteFencesNV := SDL_GL_GetProcAddress('glDeleteFencesNV'); - if not Assigned(glDeleteFencesNV) then Exit; - @glSetFenceNV := SDL_GL_GetProcAddress('glSetFenceNV'); - if not Assigned(glSetFenceNV) then Exit; - @glTestFenceNV := SDL_GL_GetProcAddress('glTestFenceNV'); - if not Assigned(glTestFenceNV) then Exit; - @glFinishFenceNV := SDL_GL_GetProcAddress('glFinishFenceNV'); - if not Assigned(glFinishFenceNV) then Exit; - @glIsFenceNV := SDL_GL_GetProcAddress('glIsFenceNV'); - if not Assigned(glIsFenceNV) then Exit; - @glGetFenceivNV := SDL_GL_GetProcAddress('glGetFenceivNV'); - if not Assigned(glGetFenceivNV) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_NV_fog_distance: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_fog_distance', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_light_max_exponent: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_light_max_exponent', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_multisample_filter_hint: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_multisample_filter_hint', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_occlusion_query: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_occlusion_query', extstring) then - begin - @glGenOcclusionQueriesNV := SDL_GL_GetProcAddress('glGenOcclusionQueriesNV'); - if not Assigned(glGenOcclusionQueriesNV) then Exit; - @glDeleteOcclusionQueriesNV := SDL_GL_GetProcAddress('glDeleteOcclusionQueriesNV'); - if not Assigned(glDeleteOcclusionQueriesNV) then Exit; - @glIsOcclusionQueryNV := SDL_GL_GetProcAddress('glIsOcclusionQueryNV'); - if not Assigned(glIsOcclusionQueryNV) then Exit; - @glBeginOcclusionQueryNV := SDL_GL_GetProcAddress('glBeginOcclusionQueryNV'); - if not Assigned(glBeginOcclusionQueryNV) then Exit; - @glEndOcclusionQueryNV := SDL_GL_GetProcAddress('glEndOcclusionQueryNV'); - if not Assigned(glEndOcclusionQueryNV) then Exit; - @glGetOcclusionQueryivNV := SDL_GL_GetProcAddress('glGetOcclusionQueryivNV'); - if not Assigned(glGetOcclusionQueryivNV) then Exit; - @glGetOcclusionQueryuivNV := SDL_GL_GetProcAddress('glGetOcclusionQueryuivNV'); - if not Assigned(glGetOcclusionQueryuivNV) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_NV_packed_depth_stencil: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_packed_depth_stencil', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_point_sprite: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_point_sprite', extstring) then - begin - @glPointParameteriNV := SDL_GL_GetProcAddress('glPointParameteriNV'); - if not Assigned(glPointParameteriNV) then Exit; - @glPointParameterivNV := SDL_GL_GetProcAddress('glPointParameterivNV'); - if not Assigned(glPointParameterivNV) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_NV_register_combiners: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_register_combiners', extstring) then - begin - @glCombinerParameterfvNV := SDL_GL_GetProcAddress('glCombinerParameterfvNV'); - if not Assigned(glCombinerParameterfvNV) then Exit; - @glCombinerParameterivNV := SDL_GL_GetProcAddress('glCombinerParameterivNV'); - if not Assigned(glCombinerParameterivNV) then Exit; - @glCombinerParameterfNV := SDL_GL_GetProcAddress('glCombinerParameterfNV'); - if not Assigned(glCombinerParameterfNV) then Exit; - @glCombinerParameteriNV := SDL_GL_GetProcAddress('glCombinerParameteriNV'); - if not Assigned(glCombinerParameteriNV) then Exit; - @glCombinerInputNV := SDL_GL_GetProcAddress('glCombinerInputNV'); - if not Assigned(glCombinerInputNV) then Exit; - @glCombinerOutputNV := SDL_GL_GetProcAddress('glCombinerOutputNV'); - if not Assigned(glCombinerOutputNV) then Exit; - @glFinalCombinerInputNV := SDL_GL_GetProcAddress('glFinalCombinerInputNV'); - if not Assigned(glFinalCombinerInputNV) then Exit; - @glGetCombinerInputParameterfvNV := SDL_GL_GetProcAddress('glGetCombinerInputParameterfvNV'); - if not Assigned(glGetCombinerInputParameterfvNV) then Exit; - @glGetCombinerInputParameterivNV := SDL_GL_GetProcAddress('glGetCombinerInputParameterivNV'); - if not Assigned(glGetCombinerInputParameterivNV) then Exit; - @glGetCombinerOutputParameterfvNV := SDL_GL_GetProcAddress('glGetCombinerOutputParameterfvNV'); - if not Assigned(glGetCombinerOutputParameterfvNV) then Exit; - @glGetCombinerOutputParameterivNV := SDL_GL_GetProcAddress('glGetCombinerOutputParameterivNV'); - if not Assigned(glGetCombinerOutputParameterivNV) then Exit; - @glGetFinalCombinerInputParameterfvNV := SDL_GL_GetProcAddress('glGetFinalCombinerInputParameterfvNV'); - if not Assigned(glGetFinalCombinerInputParameterfvNV) then Exit; - @glGetFinalCombinerInputParameterivNV := SDL_GL_GetProcAddress('glGetFinalCombinerInputParameterivNV'); - if not Assigned(glGetFinalCombinerInputParameterivNV) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_NV_register_combiners2: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_register_combiners2', extstring) then - begin - @glCombinerStageParameterfvNV := SDL_GL_GetProcAddress('glCombinerStageParameterfvNV'); - if not Assigned(glCombinerStageParameterfvNV) then Exit; - @glGetCombinerStageParameterfvNV := SDL_GL_GetProcAddress('glGetCombinerStageParameterfvNV'); - if not Assigned(glGetCombinerStageParameterfvNV) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_NV_texgen_emboss: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_texgen_emboss', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_texgen_reflection: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_texgen_reflection', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_texture_compression_vtc: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_texture_compression_vtc', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_texture_env_combine4: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_texture_env_combine4', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_texture_rectangle: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_texture_rectangle', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_texture_shader: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_texture_shader', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_texture_shader2: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_texture_shader2', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_texture_shader3: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_texture_shader3', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_vertex_array_range: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_vertex_array_range', extstring) then - begin - @glVertexArrayRangeNV := SDL_GL_GetProcAddress('glVertexArrayRangeNV'); - if not Assigned(glVertexArrayRangeNV) then Exit; - @glFlushVertexArrayRangeNV := SDL_GL_GetProcAddress('glFlushVertexArrayRangeNV'); - if not Assigned(glFlushVertexArrayRangeNV) then Exit; - {$IFDEF WIN32} - @wglAllocateMemoryNV := SDL_GL_GetProcAddress('wglAllocateMemoryNV'); - if not Assigned(wglAllocateMemoryNV) then Exit; - @wglFreeMemoryNV := SDL_GL_GetProcAddress('wglFreeMemoryNV'); - if not Assigned(wglFreeMemoryNV) then Exit; - {$ENDIF} - Result := TRUE; - end; - -end; - -function Load_GL_NV_vertex_array_range2: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_vertex_array_range2', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_vertex_program: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_vertex_program', extstring) then - begin - @glBindProgramNV := SDL_GL_GetProcAddress('glBindProgramNV'); - if not Assigned(glBindProgramNV) then Exit; - @glDeleteProgramsNV := SDL_GL_GetProcAddress('glDeleteProgramsNV'); - if not Assigned(glDeleteProgramsNV) then Exit; - @glExecuteProgramNV := SDL_GL_GetProcAddress('glExecuteProgramNV'); - if not Assigned(glExecuteProgramNV) then Exit; - @glGenProgramsNV := SDL_GL_GetProcAddress('glGenProgramsNV'); - if not Assigned(glGenProgramsNV) then Exit; - @glAreProgramsResidentNV := SDL_GL_GetProcAddress('glAreProgramsResidentNV'); - if not Assigned(glAreProgramsResidentNV) then Exit; - @glRequestResidentProgramsNV := SDL_GL_GetProcAddress('glRequestResidentProgramsNV'); - if not Assigned(glRequestResidentProgramsNV) then Exit; - @glGetProgramParameterfvNV := SDL_GL_GetProcAddress('glGetProgramParameterfvNV'); - if not Assigned(glGetProgramParameterfvNV) then Exit; - @glGetProgramParameterdvNV := SDL_GL_GetProcAddress('glGetProgramParameterdvNV'); - if not Assigned(glGetProgramParameterdvNV) then Exit; - @glGetProgramivNV := SDL_GL_GetProcAddress('glGetProgramivNV'); - if not Assigned(glGetProgramivNV) then Exit; - @glGetProgramStringNV := SDL_GL_GetProcAddress('glGetProgramStringNV'); - if not Assigned(glGetProgramStringNV) then Exit; - @glGetTrackMatrixivNV := SDL_GL_GetProcAddress('glGetTrackMatrixivNV'); - if not Assigned(glGetTrackMatrixivNV) then Exit; - @glGetVertexAttribdvNV := SDL_GL_GetProcAddress('glGetVertexAttribdvNV'); - if not Assigned(glGetVertexAttribdvNV) then Exit; - @glGetVertexAttribfvNV := SDL_GL_GetProcAddress('glGetVertexAttribfvNV'); - if not Assigned(glGetVertexAttribfvNV) then Exit; - @glGetVertexAttribivNV := SDL_GL_GetProcAddress('glGetVertexAttribivNV'); - if not Assigned(glGetVertexAttribivNV) then Exit; - @glGetVertexAttribPointervNV := SDL_GL_GetProcAddress('glGetVertexAttribPointervNV'); - if not Assigned(glGetVertexAttribPointervNV) then Exit; - @glIsProgramNV := SDL_GL_GetProcAddress('glIsProgramNV'); - if not Assigned(glIsProgramNV) then Exit; - @glLoadProgramNV := SDL_GL_GetProcAddress('glLoadProgramNV'); - if not Assigned(glLoadProgramNV) then Exit; - @glProgramParameter4fNV := SDL_GL_GetProcAddress('glProgramParameter4fNV'); - if not Assigned(glProgramParameter4fNV) then Exit; - @glProgramParameter4fvNV := SDL_GL_GetProcAddress('glProgramParameter4fvNV'); - if not Assigned(glProgramParameter4fvNV) then Exit; - @glProgramParameters4dvNV := SDL_GL_GetProcAddress('glProgramParameters4dvNV'); - if not Assigned(glProgramParameters4dvNV) then Exit; - @glProgramParameters4fvNV := SDL_GL_GetProcAddress('glProgramParameters4fvNV'); - if not Assigned(glProgramParameters4fvNV) then Exit; - @glTrackMatrixNV := SDL_GL_GetProcAddress('glTrackMatrixNV'); - if not Assigned(glTrackMatrixNV) then Exit; - @glVertexAttribPointerNV := SDL_GL_GetProcAddress('glVertexAttribPointerNV'); - if not Assigned(glVertexAttribPointerNV) then Exit; - @glVertexAttrib1sNV := SDL_GL_GetProcAddress('glVertexAttrib1sNV'); - if not Assigned(glVertexAttrib1sNV) then Exit; - @glVertexAttrib1fNV := SDL_GL_GetProcAddress('glVertexAttrib1fNV'); - if not Assigned(glVertexAttrib1fNV) then Exit; - @glVertexAttrib1dNV := SDL_GL_GetProcAddress('glVertexAttrib1dNV'); - if not Assigned(glVertexAttrib1dNV) then Exit; - @glVertexAttrib2sNV := SDL_GL_GetProcAddress('glVertexAttrib2sNV'); - if not Assigned(glVertexAttrib2sNV) then Exit; - @glVertexAttrib2fNV := SDL_GL_GetProcAddress('glVertexAttrib2fNV'); - if not Assigned(glVertexAttrib2fNV) then Exit; - @glVertexAttrib2dNV := SDL_GL_GetProcAddress('glVertexAttrib2dNV'); - if not Assigned(glVertexAttrib2dNV) then Exit; - @glVertexAttrib3sNV := SDL_GL_GetProcAddress('glVertexAttrib3sNV'); - if not Assigned(glVertexAttrib3sNV) then Exit; - @glVertexAttrib3fNV := SDL_GL_GetProcAddress('glVertexAttrib3fNV'); - if not Assigned(glVertexAttrib3fNV) then Exit; - @glVertexAttrib3dNV := SDL_GL_GetProcAddress('glVertexAttrib3dNV'); - if not Assigned(glVertexAttrib3dNV) then Exit; - @glVertexAttrib4sNV := SDL_GL_GetProcAddress('glVertexAttrib4sNV'); - if not Assigned(glVertexAttrib4sNV) then Exit; - @glVertexAttrib4fNV := SDL_GL_GetProcAddress('glVertexAttrib4fNV'); - if not Assigned(glVertexAttrib4fNV) then Exit; - @glVertexAttrib4dNV := SDL_GL_GetProcAddress('glVertexAttrib4dNV'); - if not Assigned(glVertexAttrib4dNV) then Exit; - @glVertexAttrib4ubNV := SDL_GL_GetProcAddress('glVertexAttrib4ubNV'); - if not Assigned(glVertexAttrib4ubNV) then Exit; - @glVertexAttrib1svNV := SDL_GL_GetProcAddress('glVertexAttrib1svNV'); - if not Assigned(glVertexAttrib1svNV) then Exit; - @glVertexAttrib1fvNV := SDL_GL_GetProcAddress('glVertexAttrib1fvNV'); - if not Assigned(glVertexAttrib1fvNV) then Exit; - @glVertexAttrib1dvNV := SDL_GL_GetProcAddress('glVertexAttrib1dvNV'); - if not Assigned(glVertexAttrib1dvNV) then Exit; - @glVertexAttrib2svNV := SDL_GL_GetProcAddress('glVertexAttrib2svNV'); - if not Assigned(glVertexAttrib2svNV) then Exit; - @glVertexAttrib2fvNV := SDL_GL_GetProcAddress('glVertexAttrib2fvNV'); - if not Assigned(glVertexAttrib2fvNV) then Exit; - @glVertexAttrib2dvNV := SDL_GL_GetProcAddress('glVertexAttrib2dvNV'); - if not Assigned(glVertexAttrib2dvNV) then Exit; - @glVertexAttrib3svNV := SDL_GL_GetProcAddress('glVertexAttrib3svNV'); - if not Assigned(glVertexAttrib3svNV) then Exit; - @glVertexAttrib3fvNV := SDL_GL_GetProcAddress('glVertexAttrib3fvNV'); - if not Assigned(glVertexAttrib3fvNV) then Exit; - @glVertexAttrib3dvNV := SDL_GL_GetProcAddress('glVertexAttrib3dvNV'); - if not Assigned(glVertexAttrib3dvNV) then Exit; - @glVertexAttrib4svNV := SDL_GL_GetProcAddress('glVertexAttrib4svNV'); - if not Assigned(glVertexAttrib4svNV) then Exit; - @glVertexAttrib4fvNV := SDL_GL_GetProcAddress('glVertexAttrib4fvNV'); - if not Assigned(glVertexAttrib4fvNV) then Exit; - @glVertexAttrib4dvNV := SDL_GL_GetProcAddress('glVertexAttrib4dvNV'); - if not Assigned(glVertexAttrib4dvNV) then Exit; - @glVertexAttrib4ubvNV := SDL_GL_GetProcAddress('glVertexAttrib4ubvNV'); - if not Assigned(glVertexAttrib4ubvNV) then Exit; - @glVertexAttribs1svNV := SDL_GL_GetProcAddress('glVertexAttribs1svNV'); - if not Assigned(glVertexAttribs1svNV) then Exit; - @glVertexAttribs1fvNV := SDL_GL_GetProcAddress('glVertexAttribs1fvNV'); - if not Assigned(glVertexAttribs1fvNV) then Exit; - @glVertexAttribs1dvNV := SDL_GL_GetProcAddress('glVertexAttribs1dvNV'); - if not Assigned(glVertexAttribs1dvNV) then Exit; - @glVertexAttribs2svNV := SDL_GL_GetProcAddress('glVertexAttribs2svNV'); - if not Assigned(glVertexAttribs2svNV) then Exit; - @glVertexAttribs2fvNV := SDL_GL_GetProcAddress('glVertexAttribs2fvNV'); - if not Assigned(glVertexAttribs2fvNV) then Exit; - @glVertexAttribs2dvNV := SDL_GL_GetProcAddress('glVertexAttribs2dvNV'); - if not Assigned(glVertexAttribs2dvNV) then Exit; - @glVertexAttribs3svNV := SDL_GL_GetProcAddress('glVertexAttribs3svNV'); - if not Assigned(glVertexAttribs3svNV) then Exit; - @glVertexAttribs3fvNV := SDL_GL_GetProcAddress('glVertexAttribs3fvNV'); - if not Assigned(glVertexAttribs3fvNV) then Exit; - @glVertexAttribs3dvNV := SDL_GL_GetProcAddress('glVertexAttribs3dvNV'); - if not Assigned(glVertexAttribs3dvNV) then Exit; - @glVertexAttribs4svNV := SDL_GL_GetProcAddress('glVertexAttribs4svNV'); - if not Assigned(glVertexAttribs4svNV) then Exit; - @glVertexAttribs4fvNV := SDL_GL_GetProcAddress('glVertexAttribs4fvNV'); - if not Assigned(glVertexAttribs4fvNV) then Exit; - @glVertexAttribs4dvNV := SDL_GL_GetProcAddress('glVertexAttribs4dvNV'); - if not Assigned(glVertexAttribs4dvNV) then Exit; - @glVertexAttribs4ubvNV := SDL_GL_GetProcAddress('glVertexAttribs4ubvNV'); - if not Assigned(glVertexAttribs4ubvNV) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_NV_vertex_program1_1: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_vertex_program1_1', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_ATI_element_array: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ATI_element_array', extstring) then - begin - @glElementPointerATI := SDL_GL_GetProcAddress('glElementPointerATI'); - if not Assigned(glElementPointerATI) then Exit; - @glDrawElementArrayATI := SDL_GL_GetProcAddress('glDrawElementArrayATI'); - if not Assigned(glDrawElementArrayATI) then Exit; - @glDrawRangeElementArrayATI := SDL_GL_GetProcAddress('glDrawRangeElementArrayATI'); - if not Assigned(glDrawRangeElementArrayATI) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_ATI_envmap_bumpmap: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ATI_envmap_bumpmap', extstring) then - begin - @glTexBumpParameterivATI := SDL_GL_GetProcAddress('glTexBumpParameterivATI'); - if not Assigned(glTexBumpParameterivATI) then Exit; - @glTexBumpParameterfvATI := SDL_GL_GetProcAddress('glTexBumpParameterfvATI'); - if not Assigned(glTexBumpParameterfvATI) then Exit; - @glGetTexBumpParameterivATI := SDL_GL_GetProcAddress('glGetTexBumpParameterivATI'); - if not Assigned(glGetTexBumpParameterivATI) then Exit; - @glGetTexBumpParameterfvATI := SDL_GL_GetProcAddress('glGetTexBumpParameterfvATI'); - if not Assigned(glGetTexBumpParameterfvATI) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_ATI_fragment_shader: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ATI_fragment_shader', extstring) then - begin - @glGenFragmentShadersATI := SDL_GL_GetProcAddress('glGenFragmentShadersATI'); - if not Assigned(glGenFragmentShadersATI) then Exit; - @glBindFragmentShaderATI := SDL_GL_GetProcAddress('glBindFragmentShaderATI'); - if not Assigned(glBindFragmentShaderATI) then Exit; - @glDeleteFragmentShaderATI := SDL_GL_GetProcAddress('glDeleteFragmentShaderATI'); - if not Assigned(glDeleteFragmentShaderATI) then Exit; - @glBeginFragmentShaderATI := SDL_GL_GetProcAddress('glBeginFragmentShaderATI'); - if not Assigned(glBeginFragmentShaderATI) then Exit; - @glEndFragmentShaderATI := SDL_GL_GetProcAddress('glEndFragmentShaderATI'); - if not Assigned(glEndFragmentShaderATI) then Exit; - @glPassTexCoordATI := SDL_GL_GetProcAddress('glPassTexCoordATI'); - if not Assigned(glPassTexCoordATI) then Exit; - @glSampleMapATI := SDL_GL_GetProcAddress('glSampleMapATI'); - if not Assigned(glSampleMapATI) then Exit; - @glColorFragmentOp1ATI := SDL_GL_GetProcAddress('glColorFragmentOp1ATI'); - if not Assigned(glColorFragmentOp1ATI) then Exit; - @glColorFragmentOp2ATI := SDL_GL_GetProcAddress('glColorFragmentOp2ATI'); - if not Assigned(glColorFragmentOp2ATI) then Exit; - @glColorFragmentOp3ATI := SDL_GL_GetProcAddress('glColorFragmentOp3ATI'); - if not Assigned(glColorFragmentOp3ATI) then Exit; - @glAlphaFragmentOp1ATI := SDL_GL_GetProcAddress('glAlphaFragmentOp1ATI'); - if not Assigned(glAlphaFragmentOp1ATI) then Exit; - @glAlphaFragmentOp2ATI := SDL_GL_GetProcAddress('glAlphaFragmentOp2ATI'); - if not Assigned(glAlphaFragmentOp2ATI) then Exit; - @glAlphaFragmentOp3ATI := SDL_GL_GetProcAddress('glAlphaFragmentOp3ATI'); - if not Assigned(glAlphaFragmentOp3ATI) then Exit; - @glSetFragmentShaderConstantATI := SDL_GL_GetProcAddress('glSetFragmentShaderConstantATI'); - if not Assigned(glSetFragmentShaderConstantATI) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_ATI_pn_triangles: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ATI_pn_triangles', extstring) then - begin - @glPNTrianglesiATI := SDL_GL_GetProcAddress('glPNTrianglesiATI'); - if not Assigned(glPNTrianglesiATI) then Exit; - @glPNTrianglesfATI := SDL_GL_GetProcAddress('glPNTrianglesfATI'); - if not Assigned(glPNTrianglesfATI) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_ATI_texture_mirror_once: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ATI_texture_mirror_once', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_ATI_vertex_array_object: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ATI_vertex_array_object', extstring) then - begin - @glNewObjectBufferATI := SDL_GL_GetProcAddress('glNewObjectBufferATI'); - if not Assigned(glNewObjectBufferATI) then Exit; - @glIsObjectBufferATI := SDL_GL_GetProcAddress('glIsObjectBufferATI'); - if not Assigned(glIsObjectBufferATI) then Exit; - @glUpdateObjectBufferATI := SDL_GL_GetProcAddress('glUpdateObjectBufferATI'); - if not Assigned(glUpdateObjectBufferATI) then Exit; - @glGetObjectBufferfvATI := SDL_GL_GetProcAddress('glGetObjectBufferfvATI'); - if not Assigned(glGetObjectBufferfvATI) then Exit; - @glGetObjectBufferivATI := SDL_GL_GetProcAddress('glGetObjectBufferivATI'); - if not Assigned(glGetObjectBufferivATI) then Exit; - @glDeleteObjectBufferATI := SDL_GL_GetProcAddress('glDeleteObjectBufferATI'); - if not Assigned(glDeleteObjectBufferATI) then Exit; - @glArrayObjectATI := SDL_GL_GetProcAddress('glArrayObjectATI'); - if not Assigned(glArrayObjectATI) then Exit; - @glGetArrayObjectfvATI := SDL_GL_GetProcAddress('glGetArrayObjectfvATI'); - if not Assigned(glGetArrayObjectfvATI) then Exit; - @glGetArrayObjectivATI := SDL_GL_GetProcAddress('glGetArrayObjectivATI'); - if not Assigned(glGetArrayObjectivATI) then Exit; - @glVariantArrayObjectATI := SDL_GL_GetProcAddress('glVariantArrayObjectATI'); - if not Assigned(glVariantArrayObjectATI) then Exit; - @glGetVariantArrayObjectfvATI := SDL_GL_GetProcAddress('glGetVariantArrayObjectfvATI'); - if not Assigned(glGetVariantArrayObjectfvATI) then Exit; - @glGetVariantArrayObjectivATI := SDL_GL_GetProcAddress('glGetVariantArrayObjectivATI'); - if not Assigned(glGetVariantArrayObjectivATI) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_ATI_vertex_streams: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ATI_vertex_streams', extstring) then - begin - @glVertexStream1s := SDL_GL_GetProcAddress('glVertexStream1s'); - if not Assigned(glVertexStream1s) then Exit; - @glVertexStream1i := SDL_GL_GetProcAddress('glVertexStream1i'); - if not Assigned(glVertexStream1i) then Exit; - @glVertexStream1f := SDL_GL_GetProcAddress('glVertexStream1f'); - if not Assigned(glVertexStream1f) then Exit; - @glVertexStream1d := SDL_GL_GetProcAddress('glVertexStream1d'); - if not Assigned(glVertexStream1d) then Exit; - @glVertexStream1sv := SDL_GL_GetProcAddress('glVertexStream1sv'); - if not Assigned(glVertexStream1sv) then Exit; - @glVertexStream1iv := SDL_GL_GetProcAddress('glVertexStream1iv'); - if not Assigned(glVertexStream1iv) then Exit; - @glVertexStream1fv := SDL_GL_GetProcAddress('glVertexStream1fv'); - if not Assigned(glVertexStream1fv) then Exit; - @glVertexStream1dv := SDL_GL_GetProcAddress('glVertexStream1dv'); - if not Assigned(glVertexStream1dv) then Exit; - @glVertexStream2s := SDL_GL_GetProcAddress('glVertexStream2s'); - if not Assigned(glVertexStream2s) then Exit; - @glVertexStream2i := SDL_GL_GetProcAddress('glVertexStream2i'); - if not Assigned(glVertexStream2i) then Exit; - @glVertexStream2f := SDL_GL_GetProcAddress('glVertexStream2f'); - if not Assigned(glVertexStream2f) then Exit; - @glVertexStream2d := SDL_GL_GetProcAddress('glVertexStream2d'); - if not Assigned(glVertexStream2d) then Exit; - @glVertexStream2sv := SDL_GL_GetProcAddress('glVertexStream2sv'); - if not Assigned(glVertexStream2sv) then Exit; - @glVertexStream2iv := SDL_GL_GetProcAddress('glVertexStream2iv'); - if not Assigned(glVertexStream2iv) then Exit; - @glVertexStream2fv := SDL_GL_GetProcAddress('glVertexStream2fv'); - if not Assigned(glVertexStream2fv) then Exit; - @glVertexStream2dv := SDL_GL_GetProcAddress('glVertexStream2dv'); - if not Assigned(glVertexStream2dv) then Exit; - @glVertexStream3s := SDL_GL_GetProcAddress('glVertexStream3s'); - if not Assigned(glVertexStream3s) then Exit; - @glVertexStream3i := SDL_GL_GetProcAddress('glVertexStream3i'); - if not Assigned(glVertexStream3i) then Exit; - @glVertexStream3f := SDL_GL_GetProcAddress('glVertexStream3f'); - if not Assigned(glVertexStream3f) then Exit; - @glVertexStream3d := SDL_GL_GetProcAddress('glVertexStream3d'); - if not Assigned(glVertexStream3d) then Exit; - @glVertexStream3sv := SDL_GL_GetProcAddress('glVertexStream3sv'); - if not Assigned(glVertexStream3sv) then Exit; - @glVertexStream3iv := SDL_GL_GetProcAddress('glVertexStream3iv'); - if not Assigned(glVertexStream3iv) then Exit; - @glVertexStream3fv := SDL_GL_GetProcAddress('glVertexStream3fv'); - if not Assigned(glVertexStream3fv) then Exit; - @glVertexStream3dv := SDL_GL_GetProcAddress('glVertexStream3dv'); - if not Assigned(glVertexStream3dv) then Exit; - @glVertexStream4s := SDL_GL_GetProcAddress('glVertexStream4s'); - if not Assigned(glVertexStream4s) then Exit; - @glVertexStream4i := SDL_GL_GetProcAddress('glVertexStream4i'); - if not Assigned(glVertexStream4i) then Exit; - @glVertexStream4f := SDL_GL_GetProcAddress('glVertexStream4f'); - if not Assigned(glVertexStream4f) then Exit; - @glVertexStream4d := SDL_GL_GetProcAddress('glVertexStream4d'); - if not Assigned(glVertexStream4d) then Exit; - @glVertexStream4sv := SDL_GL_GetProcAddress('glVertexStream4sv'); - if not Assigned(glVertexStream4sv) then Exit; - @glVertexStream4iv := SDL_GL_GetProcAddress('glVertexStream4iv'); - if not Assigned(glVertexStream4iv) then Exit; - @glVertexStream4fv := SDL_GL_GetProcAddress('glVertexStream4fv'); - if not Assigned(glVertexStream4fv) then Exit; - @glVertexStream4dv := SDL_GL_GetProcAddress('glVertexStream4dv'); - if not Assigned(glVertexStream4dv) then Exit; - @glNormalStream3b := SDL_GL_GetProcAddress('glNormalStream3b'); - if not Assigned(glNormalStream3b) then Exit; - @glNormalStream3s := SDL_GL_GetProcAddress('glNormalStream3s'); - if not Assigned(glNormalStream3s) then Exit; - @glNormalStream3i := SDL_GL_GetProcAddress('glNormalStream3i'); - if not Assigned(glNormalStream3i) then Exit; - @glNormalStream3f := SDL_GL_GetProcAddress('glNormalStream3f'); - if not Assigned(glNormalStream3f) then Exit; - @glNormalStream3d := SDL_GL_GetProcAddress('glNormalStream3d'); - if not Assigned(glNormalStream3d) then Exit; - @glNormalStream3bv := SDL_GL_GetProcAddress('glNormalStream3bv'); - if not Assigned(glNormalStream3bv) then Exit; - @glNormalStream3sv := SDL_GL_GetProcAddress('glNormalStream3sv'); - if not Assigned(glNormalStream3sv) then Exit; - @glNormalStream3iv := SDL_GL_GetProcAddress('glNormalStream3iv'); - if not Assigned(glNormalStream3iv) then Exit; - @glNormalStream3fv := SDL_GL_GetProcAddress('glNormalStream3fv'); - if not Assigned(glNormalStream3fv) then Exit; - @glNormalStream3dv := SDL_GL_GetProcAddress('glNormalStream3dv'); - if not Assigned(glNormalStream3dv) then Exit; - @glClientActiveVertexStream := SDL_GL_GetProcAddress('glClientActiveVertexStream'); - if not Assigned(glClientActiveVertexStream) then Exit; - @glVertexBlendEnvi := SDL_GL_GetProcAddress('glVertexBlendEnvi'); - if not Assigned(glVertexBlendEnvi) then Exit; - @glVertexBlendEnvf := SDL_GL_GetProcAddress('glVertexBlendEnvf'); - if not Assigned(glVertexBlendEnvf) then Exit; - Result := TRUE; - end; - -end; - -{$IFDEF WIN32} -function Load_WGL_I3D_image_buffer: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); - if not Assigned(wglGetExtensionsStringARB) then Exit; - extstring := wglGetExtensionsStringARB(wglGetCurrentDC); - - if glext_ExtensionSupported('WGL_I3D_image_buffer', extstring) then - begin - @wglCreateImageBufferI3D := SDL_GL_GetProcAddress('wglCreateImageBufferI3D'); - if not Assigned(wglCreateImageBufferI3D) then Exit; - @wglDestroyImageBufferI3D := SDL_GL_GetProcAddress('wglDestroyImageBufferI3D'); - if not Assigned(wglDestroyImageBufferI3D) then Exit; - @wglAssociateImageBufferEventsI3D := SDL_GL_GetProcAddress('wglAssociateImageBufferEventsI3D'); - if not Assigned(wglAssociateImageBufferEventsI3D) then Exit; - @wglReleaseImageBufferEventsI3D := SDL_GL_GetProcAddress('wglReleaseImageBufferEventsI3D'); - if not Assigned(wglReleaseImageBufferEventsI3D) then Exit; - Result := TRUE; - end; - -end; - -function Load_WGL_I3D_swap_frame_lock: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); - if not Assigned(wglGetExtensionsStringARB) then Exit; - extstring := wglGetExtensionsStringARB(wglGetCurrentDC); - - if glext_ExtensionSupported('WGL_I3D_swap_frame_lock', extstring) then - begin - @wglEnableFrameLockI3D := SDL_GL_GetProcAddress('wglEnableFrameLockI3D'); - if not Assigned(wglEnableFrameLockI3D) then Exit; - @wglDisableFrameLockI3D := SDL_GL_GetProcAddress('wglDisableFrameLockI3D'); - if not Assigned(wglDisableFrameLockI3D) then Exit; - @wglIsEnabledFrameLockI3D := SDL_GL_GetProcAddress('wglIsEnabledFrameLockI3D'); - if not Assigned(wglIsEnabledFrameLockI3D) then Exit; - @wglQueryFrameLockMasterI3D := SDL_GL_GetProcAddress('wglQueryFrameLockMasterI3D'); - if not Assigned(wglQueryFrameLockMasterI3D) then Exit; - Result := TRUE; - end; - -end; - -function Load_WGL_I3D_swap_frame_usage: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); - if not Assigned(wglGetExtensionsStringARB) then Exit; - extstring := wglGetExtensionsStringARB(wglGetCurrentDC); - - if glext_ExtensionSupported('WGL_I3D_swap_frame_usage', extstring) then - begin - @wglGetFrameUsageI3D := SDL_GL_GetProcAddress('wglGetFrameUsageI3D'); - if not Assigned(wglGetFrameUsageI3D) then Exit; - @wglBeginFrameTrackingI3D := SDL_GL_GetProcAddress('wglBeginFrameTrackingI3D'); - if not Assigned(wglBeginFrameTrackingI3D) then Exit; - @wglEndFrameTrackingI3D := SDL_GL_GetProcAddress('wglEndFrameTrackingI3D'); - if not Assigned(wglEndFrameTrackingI3D) then Exit; - @wglQueryFrameTrackingI3D := SDL_GL_GetProcAddress('wglQueryFrameTrackingI3D'); - if not Assigned(wglQueryFrameTrackingI3D) then Exit; - Result := TRUE; - end; - -end; -{$ENDIF} - -function Load_GL_3DFX_texture_compression_FXT1: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_3DFX_texture_compression_FXT1', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_IBM_cull_vertex: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_IBM_cull_vertex', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_IBM_multimode_draw_arrays: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_IBM_multimode_draw_arrays', extstring) then - begin - @glMultiModeDrawArraysIBM := SDL_GL_GetProcAddress('glMultiModeDrawArraysIBM'); - if not Assigned(glMultiModeDrawArraysIBM) then Exit; - @glMultiModeDrawElementsIBM := SDL_GL_GetProcAddress('glMultiModeDrawElementsIBM'); - if not Assigned(glMultiModeDrawElementsIBM) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_IBM_raster_pos_clip: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_IBM_raster_pos_clip', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_IBM_texture_mirrored_repeat: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_IBM_texture_mirrored_repeat', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_IBM_vertex_array_lists: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_IBM_vertex_array_lists', extstring) then - begin - @glColorPointerListIBM := SDL_GL_GetProcAddress('glColorPointerListIBM'); - if not Assigned(glColorPointerListIBM) then Exit; - @glSecondaryColorPointerListIBM := SDL_GL_GetProcAddress('glSecondaryColorPointerListIBM'); - if not Assigned(glSecondaryColorPointerListIBM) then Exit; - @glEdgeFlagPointerListIBM := SDL_GL_GetProcAddress('glEdgeFlagPointerListIBM'); - if not Assigned(glEdgeFlagPointerListIBM) then Exit; - @glFogCoordPointerListIBM := SDL_GL_GetProcAddress('glFogCoordPointerListIBM'); - if not Assigned(glFogCoordPointerListIBM) then Exit; - @glNormalPointerListIBM := SDL_GL_GetProcAddress('glNormalPointerListIBM'); - if not Assigned(glNormalPointerListIBM) then Exit; - @glTexCoordPointerListIBM := SDL_GL_GetProcAddress('glTexCoordPointerListIBM'); - if not Assigned(glTexCoordPointerListIBM) then Exit; - @glVertexPointerListIBM := SDL_GL_GetProcAddress('glVertexPointerListIBM'); - if not Assigned(glVertexPointerListIBM) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_MESA_resize_buffers: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_MESA_resize_buffers', extstring) then - begin - @glResizeBuffersMESA := SDL_GL_GetProcAddress('glResizeBuffersMESA'); - if not Assigned(glResizeBuffersMESA) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_MESA_window_pos: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_MESA_window_pos', extstring) then - begin - @glWindowPos2dMESA := SDL_GL_GetProcAddress('glWindowPos2dMESA'); - if not Assigned(glWindowPos2dMESA) then Exit; - @glWindowPos2fMESA := SDL_GL_GetProcAddress('glWindowPos2fMESA'); - if not Assigned(glWindowPos2fMESA) then Exit; - @glWindowPos2iMESA := SDL_GL_GetProcAddress('glWindowPos2iMESA'); - if not Assigned(glWindowPos2iMESA) then Exit; - @glWindowPos2sMESA := SDL_GL_GetProcAddress('glWindowPos2sMESA'); - if not Assigned(glWindowPos2sMESA) then Exit; - @glWindowPos2ivMESA := SDL_GL_GetProcAddress('glWindowPos2ivMESA'); - if not Assigned(glWindowPos2ivMESA) then Exit; - @glWindowPos2svMESA := SDL_GL_GetProcAddress('glWindowPos2svMESA'); - if not Assigned(glWindowPos2svMESA) then Exit; - @glWindowPos2fvMESA := SDL_GL_GetProcAddress('glWindowPos2fvMESA'); - if not Assigned(glWindowPos2fvMESA) then Exit; - @glWindowPos2dvMESA := SDL_GL_GetProcAddress('glWindowPos2dvMESA'); - if not Assigned(glWindowPos2dvMESA) then Exit; - @glWindowPos3iMESA := SDL_GL_GetProcAddress('glWindowPos3iMESA'); - if not Assigned(glWindowPos3iMESA) then Exit; - @glWindowPos3sMESA := SDL_GL_GetProcAddress('glWindowPos3sMESA'); - if not Assigned(glWindowPos3sMESA) then Exit; - @glWindowPos3fMESA := SDL_GL_GetProcAddress('glWindowPos3fMESA'); - if not Assigned(glWindowPos3fMESA) then Exit; - @glWindowPos3dMESA := SDL_GL_GetProcAddress('glWindowPos3dMESA'); - if not Assigned(glWindowPos3dMESA) then Exit; - @glWindowPos3ivMESA := SDL_GL_GetProcAddress('glWindowPos3ivMESA'); - if not Assigned(glWindowPos3ivMESA) then Exit; - @glWindowPos3svMESA := SDL_GL_GetProcAddress('glWindowPos3svMESA'); - if not Assigned(glWindowPos3svMESA) then Exit; - @glWindowPos3fvMESA := SDL_GL_GetProcAddress('glWindowPos3fvMESA'); - if not Assigned(glWindowPos3fvMESA) then Exit; - @glWindowPos3dvMESA := SDL_GL_GetProcAddress('glWindowPos3dvMESA'); - if not Assigned(glWindowPos3dvMESA) then Exit; - @glWindowPos4iMESA := SDL_GL_GetProcAddress('glWindowPos4iMESA'); - if not Assigned(glWindowPos4iMESA) then Exit; - @glWindowPos4sMESA := SDL_GL_GetProcAddress('glWindowPos4sMESA'); - if not Assigned(glWindowPos4sMESA) then Exit; - @glWindowPos4fMESA := SDL_GL_GetProcAddress('glWindowPos4fMESA'); - if not Assigned(glWindowPos4fMESA) then Exit; - @glWindowPos4dMESA := SDL_GL_GetProcAddress('glWindowPos4dMESA'); - if not Assigned(glWindowPos4dMESA) then Exit; - @glWindowPos4ivMESA := SDL_GL_GetProcAddress('glWindowPos4ivMESA'); - if not Assigned(glWindowPos4ivMESA) then Exit; - @glWindowPos4svMESA := SDL_GL_GetProcAddress('glWindowPos4svMESA'); - if not Assigned(glWindowPos4svMESA) then Exit; - @glWindowPos4fvMESA := SDL_GL_GetProcAddress('glWindowPos4fvMESA'); - if not Assigned(glWindowPos4fvMESA) then Exit; - @glWindowPos4dvMESA := SDL_GL_GetProcAddress('glWindowPos4dvMESA'); - if not Assigned(glWindowPos4dvMESA) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_OML_interlace: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_OML_interlace', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_OML_resample: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_OML_resample', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_OML_subsample: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_OML_subsample', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_SGIS_generate_mipmap: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_SGIS_generate_mipmap', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_SGIS_multisample: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_SGIS_multisample', extstring) then - begin - @glSampleMaskSGIS := SDL_GL_GetProcAddress('glSampleMaskSGIS'); - if not Assigned(glSampleMaskSGIS) then Exit; - @glSamplePatternSGIS := SDL_GL_GetProcAddress('glSamplePatternSGIS'); - if not Assigned(glSamplePatternSGIS) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_SGIS_pixel_texture: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_SGIS_pixel_texture', extstring) then - begin - @glPixelTexGenParameteriSGIS := SDL_GL_GetProcAddress('glPixelTexGenParameteriSGIS'); - if not Assigned(glPixelTexGenParameteriSGIS) then Exit; - @glPixelTexGenParameterfSGIS := SDL_GL_GetProcAddress('glPixelTexGenParameterfSGIS'); - if not Assigned(glPixelTexGenParameterfSGIS) then Exit; - @glGetPixelTexGenParameterivSGIS := SDL_GL_GetProcAddress('glGetPixelTexGenParameterivSGIS'); - if not Assigned(glGetPixelTexGenParameterivSGIS) then Exit; - @glGetPixelTexGenParameterfvSGIS := SDL_GL_GetProcAddress('glGetPixelTexGenParameterfvSGIS'); - if not Assigned(glGetPixelTexGenParameterfvSGIS) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_SGIS_texture_border_clamp: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_SGIS_texture_border_clamp', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_SGIS_texture_color_mask: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_SGIS_texture_color_mask', extstring) then - begin - @glTextureColorMaskSGIS := SDL_GL_GetProcAddress('glTextureColorMaskSGIS'); - if not Assigned(glTextureColorMaskSGIS) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_SGIS_texture_edge_clamp: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_SGIS_texture_edge_clamp', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_SGIS_texture_lod: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_SGIS_texture_lod', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_SGIS_depth_texture: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_SGIS_depth_texture', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_SGIX_fog_offset: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_SGIX_fog_offset', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_SGIX_interlace: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_SGIX_interlace', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_SGIX_shadow_ambient: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_SGIX_shadow_ambient', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_SGI_color_matrix: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_SGI_color_matrix', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_SGI_color_table: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_SGI_color_table', extstring) then - begin - @glColorTableSGI := SDL_GL_GetProcAddress('glColorTableSGI'); - if not Assigned(glColorTableSGI) then Exit; - @glCopyColorTableSGI := SDL_GL_GetProcAddress('glCopyColorTableSGI'); - if not Assigned(glCopyColorTableSGI) then Exit; - @glColorTableParameterivSGI := SDL_GL_GetProcAddress('glColorTableParameterivSGI'); - if not Assigned(glColorTableParameterivSGI) then Exit; - @glColorTableParameterfvSGI := SDL_GL_GetProcAddress('glColorTableParameterfvSGI'); - if not Assigned(glColorTableParameterfvSGI) then Exit; - @glGetColorTableSGI := SDL_GL_GetProcAddress('glGetColorTableSGI'); - if not Assigned(glGetColorTableSGI) then Exit; - @glGetColorTableParameterivSGI := SDL_GL_GetProcAddress('glGetColorTableParameterivSGI'); - if not Assigned(glGetColorTableParameterivSGI) then Exit; - @glGetColorTableParameterfvSGI := SDL_GL_GetProcAddress('glGetColorTableParameterfvSGI'); - if not Assigned(glGetColorTableParameterfvSGI) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_SGI_texture_color_table: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_SGI_texture_color_table', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_SUN_vertex: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_SUN_vertex', extstring) then - begin - @glColor4ubVertex2fSUN := SDL_GL_GetProcAddress('glColor4ubVertex2fSUN'); - if not Assigned(glColor4ubVertex2fSUN) then Exit; - @glColor4ubVertex2fvSUN := SDL_GL_GetProcAddress('glColor4ubVertex2fvSUN'); - if not Assigned(glColor4ubVertex2fvSUN) then Exit; - @glColor4ubVertex3fSUN := SDL_GL_GetProcAddress('glColor4ubVertex3fSUN'); - if not Assigned(glColor4ubVertex3fSUN) then Exit; - @glColor4ubVertex3fvSUN := SDL_GL_GetProcAddress('glColor4ubVertex3fvSUN'); - if not Assigned(glColor4ubVertex3fvSUN) then Exit; - @glColor3fVertex3fSUN := SDL_GL_GetProcAddress('glColor3fVertex3fSUN'); - if not Assigned(glColor3fVertex3fSUN) then Exit; - @glColor3fVertex3fvSUN := SDL_GL_GetProcAddress('glColor3fVertex3fvSUN'); - if not Assigned(glColor3fVertex3fvSUN) then Exit; - @glNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glNormal3fVertex3fSUN'); - if not Assigned(glNormal3fVertex3fSUN) then Exit; - @glNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glNormal3fVertex3fvSUN'); - if not Assigned(glNormal3fVertex3fvSUN) then Exit; - @glColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glColor4fNormal3fVertex3fSUN'); - if not Assigned(glColor4fNormal3fVertex3fSUN) then Exit; - @glColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glColor4fNormal3fVertex3fvSUN'); - if not Assigned(glColor4fNormal3fVertex3fvSUN) then Exit; - @glTexCoord2fVertex3fSUN := SDL_GL_GetProcAddress('glTexCoord2fVertex3fSUN'); - if not Assigned(glTexCoord2fVertex3fSUN) then Exit; - @glTexCoord2fVertex3fvSUN := SDL_GL_GetProcAddress('glTexCoord2fVertex3fvSUN'); - if not Assigned(glTexCoord2fVertex3fvSUN) then Exit; - @glTexCoord4fVertex4fSUN := SDL_GL_GetProcAddress('glTexCoord4fVertex4fSUN'); - if not Assigned(glTexCoord4fVertex4fSUN) then Exit; - @glTexCoord4fVertex4fvSUN := SDL_GL_GetProcAddress('glTexCoord4fVertex4fvSUN'); - if not Assigned(glTexCoord4fVertex4fvSUN) then Exit; - @glTexCoord2fColor4ubVertex3fSUN := SDL_GL_GetProcAddress('glTexCoord2fColor4ubVertex3fSUN'); - if not Assigned(glTexCoord2fColor4ubVertex3fSUN) then Exit; - @glTexCoord2fColor4ubVertex3fvSUN := SDL_GL_GetProcAddress('glTexCoord2fColor4ubVertex3fvSUN'); - if not Assigned(glTexCoord2fColor4ubVertex3fvSUN) then Exit; - @glTexCoord2fColor3fVertex3fSUN := SDL_GL_GetProcAddress('glTexCoord2fColor3fVertex3fSUN'); - if not Assigned(glTexCoord2fColor3fVertex3fSUN) then Exit; - @glTexCoord2fColor3fVertex3fvSUN := SDL_GL_GetProcAddress('glTexCoord2fColor3fVertex3fvSUN'); - if not Assigned(glTexCoord2fColor3fVertex3fvSUN) then Exit; - @glTexCoord2fNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glTexCoord2fNormal3fVertex3fSUN'); - if not Assigned(glTexCoord2fNormal3fVertex3fSUN) then Exit; - @glTexCoord2fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glTexCoord2fNormal3fVertex3fvSUN'); - if not Assigned(glTexCoord2fNormal3fVertex3fvSUN) then Exit; - @glTexCoord2fColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glTexCoord2fColor4fNormal3fVertex3fSUN'); - if not Assigned(glTexCoord2fColor4fNormal3fVertex3fSUN) then Exit; - @glTexCoord2fColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glTexCoord2fColor4fNormal3fVertex3fvSUN'); - if not Assigned(glTexCoord2fColor4fNormal3fVertex3fvSUN) then Exit; - @glTexCoord4fColor4fNormal3fVertex4fSUN := SDL_GL_GetProcAddress('glTexCoord4fColor4fNormal3fVertex4fSUN'); - if not Assigned(glTexCoord4fColor4fNormal3fVertex4fSUN) then Exit; - @glTexCoord4fColor4fNormal3fVertex4fvSUN := SDL_GL_GetProcAddress('glTexCoord4fColor4fNormal3fVertex4fvSUN'); - if not Assigned(glTexCoord4fColor4fNormal3fVertex4fvSUN) then Exit; - @glReplacementCodeuiVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiVertex3fSUN'); - if not Assigned(glReplacementCodeuiVertex3fSUN) then Exit; - @glReplacementCodeuiVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiVertex3fvSUN'); - if not Assigned(glReplacementCodeuiVertex3fvSUN) then Exit; - @glReplacementCodeuiColor4ubVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiColor4ubVertex3fSUN'); - if not Assigned(glReplacementCodeuiColor4ubVertex3fSUN) then Exit; - @glReplacementCodeuiColor4ubVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiColor4ubVertex3fvSUN'); - if not Assigned(glReplacementCodeuiColor4ubVertex3fvSUN) then Exit; - @glReplacementCodeuiColor3fVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiColor3fVertex3fSUN'); - if not Assigned(glReplacementCodeuiColor3fVertex3fSUN) then Exit; - @glReplacementCodeuiColor3fVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiColor3fVertex3fvSUN'); - if not Assigned(glReplacementCodeuiColor3fVertex3fvSUN) then Exit; - @glReplacementCodeuiNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiNormal3fVertex3fSUN'); - if not Assigned(glReplacementCodeuiNormal3fVertex3fSUN) then Exit; - @glReplacementCodeuiNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiNormal3fVertex3fvSUN'); - if not Assigned(glReplacementCodeuiNormal3fVertex3fvSUN) then Exit; - @glReplacementCodeuiColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiColor4fNormal3fVertex3fSUN'); - if not Assigned(glReplacementCodeuiColor4fNormal3fVertex3fSUN) then Exit; - @glReplacementCodeuiColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiColor4fNormal3fVertex3fvSUN'); - if not Assigned(glReplacementCodeuiColor4fNormal3fVertex3fvSUN) then Exit; - @glReplacementCodeuiTexCoord2fVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiTexCoord2fVertex3fSUN'); - if not Assigned(glReplacementCodeuiTexCoord2fVertex3fSUN) then Exit; - @glReplacementCodeuiTexCoord2fVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiTexCoord2fVertex3fvSUN'); - if not Assigned(glReplacementCodeuiTexCoord2fVertex3fvSUN) then Exit; - @glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN'); - if not Assigned(glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN) then Exit; - @glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN'); - if not Assigned(glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN) then Exit; - @glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress('glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN'); - if not Assigned(glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN) then Exit; - @glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress('glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN'); - if not Assigned(glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_ARB_fragment_program: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_fragment_program', extstring) then - begin - @glProgramStringARB := SDL_GL_GetProcAddress('glProgramStringARB'); - if not Assigned(glProgramStringARB) then Exit; - @glBindProgramARB := SDL_GL_GetProcAddress('glBindProgramARB'); - if not Assigned(glBindProgramARB) then Exit; - @glDeleteProgramsARB := SDL_GL_GetProcAddress('glDeleteProgramsARB'); - if not Assigned(glDeleteProgramsARB) then Exit; - @glGenProgramsARB := SDL_GL_GetProcAddress('glGenProgramsARB'); - if not Assigned(glGenProgramsARB) then Exit; - @glProgramEnvParameter4dARB := SDL_GL_GetProcAddress('glProgramEnvParameter4dARB'); - if not Assigned(glProgramEnvParameter4dARB) then Exit; - @glProgramEnvParameter4dvARB := SDL_GL_GetProcAddress('glProgramEnvParameter4dvARB'); - if not Assigned(glProgramEnvParameter4dvARB) then Exit; - @glProgramEnvParameter4fARB := SDL_GL_GetProcAddress('glProgramEnvParameter4fARB'); - if not Assigned(glProgramEnvParameter4fARB) then Exit; - @glProgramEnvParameter4fvARB := SDL_GL_GetProcAddress('glProgramEnvParameter4fvARB'); - if not Assigned(glProgramEnvParameter4fvARB) then Exit; - @glProgramLocalParameter4dARB := SDL_GL_GetProcAddress('glProgramLocalParameter4dARB'); - if not Assigned(glProgramLocalParameter4dARB) then Exit; - @glProgramLocalParameter4dvARB := SDL_GL_GetProcAddress('glProgramLocalParameter4dvARB'); - if not Assigned(glProgramLocalParameter4dvARB) then Exit; - @glProgramLocalParameter4fARB := SDL_GL_GetProcAddress('glProgramLocalParameter4fARB'); - if not Assigned(glProgramLocalParameter4fARB) then Exit; - @glProgramLocalParameter4fvARB := SDL_GL_GetProcAddress('glProgramLocalParameter4fvARB'); - if not Assigned(glProgramLocalParameter4fvARB) then Exit; - @glGetProgramEnvParameterdvARB := SDL_GL_GetProcAddress('glGetProgramEnvParameterdvARB'); - if not Assigned(glGetProgramEnvParameterdvARB) then Exit; - @glGetProgramEnvParameterfvARB := SDL_GL_GetProcAddress('glGetProgramEnvParameterfvARB'); - if not Assigned(glGetProgramEnvParameterfvARB) then Exit; - @glGetProgramLocalParameterdvARB := SDL_GL_GetProcAddress('glGetProgramLocalParameterdvARB'); - if not Assigned(glGetProgramLocalParameterdvARB) then Exit; - @glGetProgramLocalParameterfvARB := SDL_GL_GetProcAddress('glGetProgramLocalParameterfvARB'); - if not Assigned(glGetProgramLocalParameterfvARB) then Exit; - @glGetProgramivARB := SDL_GL_GetProcAddress('glGetProgramivARB'); - if not Assigned(glGetProgramivARB) then Exit; - @glGetProgramStringARB := SDL_GL_GetProcAddress('glGetProgramStringARB'); - if not Assigned(glGetProgramStringARB) then Exit; - @glIsProgramARB := SDL_GL_GetProcAddress('glIsProgramARB'); - if not Assigned(glIsProgramARB) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_ATI_text_fragment_shader: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ATI_text_fragment_shader', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_APPLE_client_storage: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_APPLE_client_storage', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_APPLE_element_array: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_APPLE_element_array', extstring) then - begin - @glElementPointerAPPLE := SDL_GL_GetProcAddress('glElementPointerAPPLE'); - if not Assigned(glElementPointerAPPLE) then Exit; - @glDrawElementArrayAPPLE := SDL_GL_GetProcAddress('glDrawElementArrayAPPLE'); - if not Assigned(glDrawElementArrayAPPLE) then Exit; - @glDrawRangeElementArrayAPPLE := SDL_GL_GetProcAddress('glDrawRangeElementArrayAPPLE'); - if not Assigned(glDrawRangeElementArrayAPPLE) then Exit; - @glMultiDrawElementArrayAPPLE := SDL_GL_GetProcAddress('glMultiDrawElementArrayAPPLE'); - if not Assigned(glMultiDrawElementArrayAPPLE) then Exit; - @glMultiDrawRangeElementArrayAPPLE := SDL_GL_GetProcAddress('glMultiDrawRangeElementArrayAPPLE'); - if not Assigned(glMultiDrawRangeElementArrayAPPLE) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_APPLE_fence: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_APPLE_fence', extstring) then - begin - @glGenFencesAPPLE := SDL_GL_GetProcAddress('glGenFencesAPPLE'); - if not Assigned(glGenFencesAPPLE) then Exit; - @glDeleteFencesAPPLE := SDL_GL_GetProcAddress('glDeleteFencesAPPLE'); - if not Assigned(glDeleteFencesAPPLE) then Exit; - @glSetFenceAPPLE := SDL_GL_GetProcAddress('glSetFenceAPPLE'); - if not Assigned(glSetFenceAPPLE) then Exit; - @glIsFenceAPPLE := SDL_GL_GetProcAddress('glIsFenceAPPLE'); - if not Assigned(glIsFenceAPPLE) then Exit; - @glTestFenceAPPLE := SDL_GL_GetProcAddress('glTestFenceAPPLE'); - if not Assigned(glTestFenceAPPLE) then Exit; - @glFinishFenceAPPLE := SDL_GL_GetProcAddress('glFinishFenceAPPLE'); - if not Assigned(glFinishFenceAPPLE) then Exit; - @glTestObjectAPPLE := SDL_GL_GetProcAddress('glTestObjectAPPLE'); - if not Assigned(glTestObjectAPPLE) then Exit; - @glFinishObjectAPPLE := SDL_GL_GetProcAddress('glFinishObjectAPPLE'); - if not Assigned(glFinishObjectAPPLE) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_APPLE_vertex_array_object: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_APPLE_vertex_array_object', extstring) then - begin - @glBindVertexArrayAPPLE := SDL_GL_GetProcAddress('glBindVertexArrayAPPLE'); - if not Assigned(glBindVertexArrayAPPLE) then Exit; - @glDeleteVertexArraysAPPLE := SDL_GL_GetProcAddress('glDeleteVertexArraysAPPLE'); - if not Assigned(glDeleteVertexArraysAPPLE) then Exit; - @glGenVertexArraysAPPLE := SDL_GL_GetProcAddress('glGenVertexArraysAPPLE'); - if not Assigned(glGenVertexArraysAPPLE) then Exit; - @glIsVertexArrayAPPLE := SDL_GL_GetProcAddress('glIsVertexArrayAPPLE'); - if not Assigned(glIsVertexArrayAPPLE) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_APPLE_vertex_array_range: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_APPLE_vertex_array_range', extstring) then - begin - @glVertexArrayRangeAPPLE := SDL_GL_GetProcAddress('glVertexArrayRangeAPPLE'); - if not Assigned(glVertexArrayRangeAPPLE) then Exit; - @glFlushVertexArrayRangeAPPLE := SDL_GL_GetProcAddress('glFlushVertexArrayRangeAPPLE'); - if not Assigned(glFlushVertexArrayRangeAPPLE) then Exit; - @glVertexArrayParameteriAPPLE := SDL_GL_GetProcAddress('glVertexArrayParameteriAPPLE'); - if not Assigned(glVertexArrayParameteriAPPLE) then Exit; - Result := TRUE; - end; - -end; - -{$IFDEF WIN32} -function Load_WGL_ARB_pixel_format: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); - if not Assigned(wglGetExtensionsStringARB) then Exit; - extstring := wglGetExtensionsStringARB(wglGetCurrentDC); - - if glext_ExtensionSupported('WGL_ARB_pixel_format', extstring) then - begin - @wglGetPixelFormatAttribivARB := SDL_GL_GetProcAddress('wglGetPixelFormatAttribivARB'); - if not Assigned(wglGetPixelFormatAttribivARB) then Exit; - @wglGetPixelFormatAttribfvARB := SDL_GL_GetProcAddress('wglGetPixelFormatAttribfvARB'); - if not Assigned(wglGetPixelFormatAttribfvARB) then Exit; - @wglChoosePixelFormatARB := SDL_GL_GetProcAddress('wglChoosePixelFormatARB'); - if not Assigned(wglChoosePixelFormatARB) then Exit; - Result := TRUE; - end; - -end; - -function Load_WGL_ARB_make_current_read: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); - if not Assigned(wglGetExtensionsStringARB) then Exit; - extstring := wglGetExtensionsStringARB(wglGetCurrentDC); - - if glext_ExtensionSupported('WGL_ARB_make_current_read', extstring) then - begin - @wglMakeContextCurrentARB := SDL_GL_GetProcAddress('wglMakeContextCurrentARB'); - if not Assigned(wglMakeContextCurrentARB) then Exit; - @wglGetCurrentReadDCARB := SDL_GL_GetProcAddress('wglGetCurrentReadDCARB'); - if not Assigned(wglGetCurrentReadDCARB) then Exit; - Result := TRUE; - end; - -end; - -function Load_WGL_ARB_pbuffer: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); - if not Assigned(wglGetExtensionsStringARB) then Exit; - extstring := wglGetExtensionsStringARB(wglGetCurrentDC); - - if glext_ExtensionSupported('WGL_ARB_pbuffer', extstring) then - begin - @wglCreatePbufferARB := SDL_GL_GetProcAddress('wglCreatePbufferARB'); - if not Assigned(wglCreatePbufferARB) then Exit; - @wglGetPbufferDCARB := SDL_GL_GetProcAddress('wglGetPbufferDCARB'); - if not Assigned(wglGetPbufferDCARB) then Exit; - @wglReleasePbufferDCARB := SDL_GL_GetProcAddress('wglReleasePbufferDCARB'); - if not Assigned(wglReleasePbufferDCARB) then Exit; - @wglDestroyPbufferARB := SDL_GL_GetProcAddress('wglDestroyPbufferARB'); - if not Assigned(wglDestroyPbufferARB) then Exit; - @wglQueryPbufferARB := SDL_GL_GetProcAddress('wglQueryPbufferARB'); - if not Assigned(wglQueryPbufferARB) then Exit; - Result := TRUE; - end; - -end; - -function Load_WGL_EXT_swap_control: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); - if not Assigned(wglGetExtensionsStringARB) then Exit; - extstring := wglGetExtensionsStringARB(wglGetCurrentDC); - - if glext_ExtensionSupported('WGL_EXT_swap_control', extstring) then - begin - @wglSwapIntervalEXT := SDL_GL_GetProcAddress('wglSwapIntervalEXT'); - if not Assigned(wglSwapIntervalEXT) then Exit; - @wglGetSwapIntervalEXT := SDL_GL_GetProcAddress('wglGetSwapIntervalEXT'); - if not Assigned(wglGetSwapIntervalEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_WGL_ARB_render_texture: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); - if not Assigned(wglGetExtensionsStringARB) then Exit; - extstring := wglGetExtensionsStringARB(wglGetCurrentDC); - - if glext_ExtensionSupported('WGL_ARB_render_texture', extstring) then - begin - @wglBindTexImageARB := SDL_GL_GetProcAddress('wglBindTexImageARB'); - if not Assigned(wglBindTexImageARB) then Exit; - @wglReleaseTexImageARB := SDL_GL_GetProcAddress('wglReleaseTexImageARB'); - if not Assigned(wglReleaseTexImageARB) then Exit; - @wglSetPbufferAttribARB := SDL_GL_GetProcAddress('wglSetPbufferAttribARB'); - if not Assigned(wglSetPbufferAttribARB) then Exit; - Result := TRUE; - end; - -end; - -function Load_WGL_EXT_extensions_string: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); - if not Assigned(wglGetExtensionsStringARB) then Exit; - extstring := wglGetExtensionsStringARB(wglGetCurrentDC); - - if glext_ExtensionSupported('WGL_EXT_extensions_string', extstring) then - begin - @wglGetExtensionsStringEXT := SDL_GL_GetProcAddress('wglGetExtensionsStringEXT'); - if not Assigned(wglGetExtensionsStringEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_WGL_EXT_make_current_read: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); - if not Assigned(wglGetExtensionsStringARB) then Exit; - extstring := wglGetExtensionsStringARB(wglGetCurrentDC); - - if glext_ExtensionSupported('WGL_EXT_make_current_read', extstring) then - begin - @wglMakeContextCurrentEXT := SDL_GL_GetProcAddress('wglMakeContextCurrentEXT'); - if not Assigned(wglMakeContextCurrentEXT) then Exit; - @wglGetCurrentReadDCEXT := SDL_GL_GetProcAddress('wglGetCurrentReadDCEXT'); - if not Assigned(wglGetCurrentReadDCEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_WGL_EXT_pbuffer: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); - if not Assigned(wglGetExtensionsStringARB) then Exit; - extstring := wglGetExtensionsStringARB(wglGetCurrentDC); - - if glext_ExtensionSupported('WGL_EXT_pbuffer', extstring) then - begin - @wglCreatePbufferEXT := SDL_GL_GetProcAddress('wglCreatePbufferEXT'); - if not Assigned(wglCreatePbufferEXT) then Exit; - @wglGetPbufferDCEXT := SDL_GL_GetProcAddress('wglGetPbufferDCEXT'); - if not Assigned(wglGetPbufferDCEXT) then Exit; - @wglReleasePbufferDCEXT := SDL_GL_GetProcAddress('wglReleasePbufferDCEXT'); - if not Assigned(wglReleasePbufferDCEXT) then Exit; - @wglDestroyPbufferEXT := SDL_GL_GetProcAddress('wglDestroyPbufferEXT'); - if not Assigned(wglDestroyPbufferEXT) then Exit; - @wglQueryPbufferEXT := SDL_GL_GetProcAddress('wglQueryPbufferEXT'); - if not Assigned(wglQueryPbufferEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_WGL_EXT_pixel_format: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); - if not Assigned(wglGetExtensionsStringARB) then Exit; - extstring := wglGetExtensionsStringARB(wglGetCurrentDC); - - if glext_ExtensionSupported('WGL_EXT_pixel_format', extstring) then - begin - @wglGetPixelFormatAttribivEXT := SDL_GL_GetProcAddress('wglGetPixelFormatAttribivEXT'); - if not Assigned(wglGetPixelFormatAttribivEXT) then Exit; - @wglGetPixelFormatAttribfvEXT := SDL_GL_GetProcAddress('wglGetPixelFormatAttribfvEXT'); - if not Assigned(wglGetPixelFormatAttribfvEXT) then Exit; - @wglChoosePixelFormatEXT := SDL_GL_GetProcAddress('wglChoosePixelFormatEXT'); - if not Assigned(wglChoosePixelFormatEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_WGL_I3D_digital_video_control: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); - if not Assigned(wglGetExtensionsStringARB) then Exit; - extstring := wglGetExtensionsStringARB(wglGetCurrentDC); - - if glext_ExtensionSupported('WGL_I3D_digital_video_control', extstring) then - begin - @wglGetDigitalVideoParametersI3D := SDL_GL_GetProcAddress('wglGetDigitalVideoParametersI3D'); - if not Assigned(wglGetDigitalVideoParametersI3D) then Exit; - @wglSetDigitalVideoParametersI3D := SDL_GL_GetProcAddress('wglSetDigitalVideoParametersI3D'); - if not Assigned(wglSetDigitalVideoParametersI3D) then Exit; - Result := TRUE; - end; - -end; - -function Load_WGL_I3D_gamma: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); - if not Assigned(wglGetExtensionsStringARB) then Exit; - extstring := wglGetExtensionsStringARB(wglGetCurrentDC); - - if glext_ExtensionSupported('WGL_I3D_gamma', extstring) then - begin - @wglGetGammaTableParametersI3D := SDL_GL_GetProcAddress('wglGetGammaTableParametersI3D'); - if not Assigned(wglGetGammaTableParametersI3D) then Exit; - @wglSetGammaTableParametersI3D := SDL_GL_GetProcAddress('wglSetGammaTableParametersI3D'); - if not Assigned(wglSetGammaTableParametersI3D) then Exit; - @wglGetGammaTableI3D := SDL_GL_GetProcAddress('wglGetGammaTableI3D'); - if not Assigned(wglGetGammaTableI3D) then Exit; - @wglSetGammaTableI3D := SDL_GL_GetProcAddress('wglSetGammaTableI3D'); - if not Assigned(wglSetGammaTableI3D) then Exit; - Result := TRUE; - end; - -end; - -function Load_WGL_I3D_genlock: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); - if not Assigned(wglGetExtensionsStringARB) then Exit; - extstring := wglGetExtensionsStringARB(wglGetCurrentDC); - - if glext_ExtensionSupported('WGL_I3D_genlock', extstring) then - begin - @wglEnableGenlockI3D := SDL_GL_GetProcAddress('wglEnableGenlockI3D'); - if not Assigned(wglEnableGenlockI3D) then Exit; - @wglDisableGenlockI3D := SDL_GL_GetProcAddress('wglDisableGenlockI3D'); - if not Assigned(wglDisableGenlockI3D) then Exit; - @wglIsEnabledGenlockI3D := SDL_GL_GetProcAddress('wglIsEnabledGenlockI3D'); - if not Assigned(wglIsEnabledGenlockI3D) then Exit; - @wglGenlockSourceI3D := SDL_GL_GetProcAddress('wglGenlockSourceI3D'); - if not Assigned(wglGenlockSourceI3D) then Exit; - @wglGetGenlockSourceI3D := SDL_GL_GetProcAddress('wglGetGenlockSourceI3D'); - if not Assigned(wglGetGenlockSourceI3D) then Exit; - @wglGenlockSourceEdgeI3D := SDL_GL_GetProcAddress('wglGenlockSourceEdgeI3D'); - if not Assigned(wglGenlockSourceEdgeI3D) then Exit; - @wglGetGenlockSourceEdgeI3D := SDL_GL_GetProcAddress('wglGetGenlockSourceEdgeI3D'); - if not Assigned(wglGetGenlockSourceEdgeI3D) then Exit; - @wglGenlockSampleRateI3D := SDL_GL_GetProcAddress('wglGenlockSampleRateI3D'); - if not Assigned(wglGenlockSampleRateI3D) then Exit; - @wglGetGenlockSampleRateI3D := SDL_GL_GetProcAddress('wglGetGenlockSampleRateI3D'); - if not Assigned(wglGetGenlockSampleRateI3D) then Exit; - @wglGenlockSourceDelayI3D := SDL_GL_GetProcAddress('wglGenlockSourceDelayI3D'); - if not Assigned(wglGenlockSourceDelayI3D) then Exit; - @wglGetGenlockSourceDelayI3D := SDL_GL_GetProcAddress('wglGetGenlockSourceDelayI3D'); - if not Assigned(wglGetGenlockSourceDelayI3D) then Exit; - @wglQueryGenlockMaxSourceDelayI3D := SDL_GL_GetProcAddress('wglQueryGenlockMaxSourceDelayI3D'); - if not Assigned(wglQueryGenlockMaxSourceDelayI3D) then Exit; - Result := TRUE; - end; - -end; -{$ENDIF} - -function Load_GL_ARB_matrix_palette: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_matrix_palette', extstring) then - begin - @glCurrentPaletteMatrixARB := SDL_GL_GetProcAddress('glCurrentPaletteMatrixARB'); - if not Assigned(glCurrentPaletteMatrixARB) then Exit; - @glMatrixIndexubvARB := SDL_GL_GetProcAddress('glMatrixIndexubvARB'); - if not Assigned(glMatrixIndexubvARB) then Exit; - @glMatrixIndexusvARB := SDL_GL_GetProcAddress('glMatrixIndexusvARB'); - if not Assigned(glMatrixIndexusvARB) then Exit; - @glMatrixIndexuivARB := SDL_GL_GetProcAddress('glMatrixIndexuivARB'); - if not Assigned(glMatrixIndexuivARB) then Exit; - @glMatrixIndexPointerARB := SDL_GL_GetProcAddress('glMatrixIndexPointerARB'); - if not Assigned(glMatrixIndexPointerARB) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_NV_element_array: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_element_array', extstring) then - begin - @glElementPointerNV := SDL_GL_GetProcAddress('glElementPointerNV'); - if not Assigned(glElementPointerNV) then Exit; - @glDrawElementArrayNV := SDL_GL_GetProcAddress('glDrawElementArrayNV'); - if not Assigned(glDrawElementArrayNV) then Exit; - @glDrawRangeElementArrayNV := SDL_GL_GetProcAddress('glDrawRangeElementArrayNV'); - if not Assigned(glDrawRangeElementArrayNV) then Exit; - @glMultiDrawElementArrayNV := SDL_GL_GetProcAddress('glMultiDrawElementArrayNV'); - if not Assigned(glMultiDrawElementArrayNV) then Exit; - @glMultiDrawRangeElementArrayNV := SDL_GL_GetProcAddress('glMultiDrawRangeElementArrayNV'); - if not Assigned(glMultiDrawRangeElementArrayNV) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_NV_float_buffer: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_float_buffer', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_fragment_program: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_fragment_program', extstring) then - begin - @glProgramNamedParameter4fNV := SDL_GL_GetProcAddress('glProgramNamedParameter4fNV'); - if not Assigned(glProgramNamedParameter4fNV) then Exit; - @glProgramNamedParameter4dNV := SDL_GL_GetProcAddress('glProgramNamedParameter4dNV'); - if not Assigned(glProgramNamedParameter4dNV) then Exit; - @glGetProgramNamedParameterfvNV := SDL_GL_GetProcAddress('glGetProgramNamedParameterfvNV'); - if not Assigned(glGetProgramNamedParameterfvNV) then Exit; - @glGetProgramNamedParameterdvNV := SDL_GL_GetProcAddress('glGetProgramNamedParameterdvNV'); - if not Assigned(glGetProgramNamedParameterdvNV) then Exit; - @glProgramLocalParameter4dARB := SDL_GL_GetProcAddress('glProgramLocalParameter4dARB'); - if not Assigned(glProgramLocalParameter4dARB) then Exit; - @glProgramLocalParameter4dvARB := SDL_GL_GetProcAddress('glProgramLocalParameter4dvARB'); - if not Assigned(glProgramLocalParameter4dvARB) then Exit; - @glProgramLocalParameter4fARB := SDL_GL_GetProcAddress('glProgramLocalParameter4fARB'); - if not Assigned(glProgramLocalParameter4fARB) then Exit; - @glProgramLocalParameter4fvARB := SDL_GL_GetProcAddress('glProgramLocalParameter4fvARB'); - if not Assigned(glProgramLocalParameter4fvARB) then Exit; - @glGetProgramLocalParameterdvARB := SDL_GL_GetProcAddress('glGetProgramLocalParameterdvARB'); - if not Assigned(glGetProgramLocalParameterdvARB) then Exit; - @glGetProgramLocalParameterfvARB := SDL_GL_GetProcAddress('glGetProgramLocalParameterfvARB'); - if not Assigned(glGetProgramLocalParameterfvARB) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_NV_primitive_restart: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_primitive_restart', extstring) then - begin - @glPrimitiveRestartNV := SDL_GL_GetProcAddress('glPrimitiveRestartNV'); - if not Assigned(glPrimitiveRestartNV) then Exit; - @glPrimitiveRestartIndexNV := SDL_GL_GetProcAddress('glPrimitiveRestartIndexNV'); - if not Assigned(glPrimitiveRestartIndexNV) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_NV_vertex_program2: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_vertex_program2', extstring) then - begin - Result := TRUE; - end; - -end; - -{$IFDEF WIN32} -function Load_WGL_NV_render_texture_rectangle: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); - if not Assigned(wglGetExtensionsStringARB) then Exit; - extstring := wglGetExtensionsStringARB(wglGetCurrentDC); - - if glext_ExtensionSupported('WGL_NV_render_texture_rectangle', extstring) then - begin - Result := TRUE; - end; - -end; -{$ENDIF} - -function Load_GL_NV_pixel_data_range: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_pixel_data_range', extstring) then - begin - @glPixelDataRangeNV := SDL_GL_GetProcAddress('glPixelDataRangeNV'); - if not Assigned(glPixelDataRangeNV) then Exit; - @glFlushPixelDataRangeNV := SDL_GL_GetProcAddress('glFlushPixelDataRangeNV'); - if not Assigned(glFlushPixelDataRangeNV) then Exit; - {$IFDEF WIN32} - @wglAllocateMemoryNV := SDL_GL_GetProcAddress('wglAllocateMemoryNV'); - if not Assigned(wglAllocateMemoryNV) then Exit; - @wglFreeMemoryNV := SDL_GL_GetProcAddress('wglFreeMemoryNV'); - if not Assigned(wglFreeMemoryNV) then Exit; - {$ENDIF} - Result := TRUE; - end; - -end; - -function Load_GL_EXT_texture_rectangle: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_texture_rectangle', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_S3_s3tc: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_S3_s3tc', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_ATI_draw_buffers: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ATI_draw_buffers', extstring) then - begin - @glDrawBuffersATI := SDL_GL_GetProcAddress('glDrawBuffersATI'); - if not Assigned(glDrawBuffersATI) then Exit; - Result := TRUE; - end; - -end; - -{$IFDEF WIN32} -function Load_WGL_ATI_pixel_format_float: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - @wglGetExtensionsStringARB := SDL_GL_GetProcAddress('wglGetExtensionsStringARB'); - if not Assigned(wglGetExtensionsStringARB) then Exit; - extstring := wglGetExtensionsStringARB(wglGetCurrentDC); - - if glext_ExtensionSupported('WGL_ATI_pixel_format_float', extstring) then - begin - Result := TRUE; - end; - -end; -{$ENDIF} - -function Load_GL_ATI_texture_env_combine3: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ATI_texture_env_combine3', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_ATI_texture_float: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ATI_texture_float', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_texture_expand_normal: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_texture_expand_normal', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_half_float: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_half_float', extstring) then - begin - @glVertex2hNV := SDL_GL_GetProcAddress('glVertex2hNV'); - if not Assigned(glVertex2hNV) then Exit; - @glVertex2hvNV := SDL_GL_GetProcAddress('glVertex2hvNV'); - if not Assigned(glVertex2hvNV) then Exit; - @glVertex3hNV := SDL_GL_GetProcAddress('glVertex3hNV'); - if not Assigned(glVertex3hNV) then Exit; - @glVertex3hvNV := SDL_GL_GetProcAddress('glVertex3hvNV'); - if not Assigned(glVertex3hvNV) then Exit; - @glVertex4hNV := SDL_GL_GetProcAddress('glVertex4hNV'); - if not Assigned(glVertex4hNV) then Exit; - @glVertex4hvNV := SDL_GL_GetProcAddress('glVertex4hvNV'); - if not Assigned(glVertex4hvNV) then Exit; - @glNormal3hNV := SDL_GL_GetProcAddress('glNormal3hNV'); - if not Assigned(glNormal3hNV) then Exit; - @glNormal3hvNV := SDL_GL_GetProcAddress('glNormal3hvNV'); - if not Assigned(glNormal3hvNV) then Exit; - @glColor3hNV := SDL_GL_GetProcAddress('glColor3hNV'); - if not Assigned(glColor3hNV) then Exit; - @glColor3hvNV := SDL_GL_GetProcAddress('glColor3hvNV'); - if not Assigned(glColor3hvNV) then Exit; - @glColor4hNV := SDL_GL_GetProcAddress('glColor4hNV'); - if not Assigned(glColor4hNV) then Exit; - @glColor4hvNV := SDL_GL_GetProcAddress('glColor4hvNV'); - if not Assigned(glColor4hvNV) then Exit; - @glTexCoord1hNV := SDL_GL_GetProcAddress('glTexCoord1hNV'); - if not Assigned(glTexCoord1hNV) then Exit; - @glTexCoord1hvNV := SDL_GL_GetProcAddress('glTexCoord1hvNV'); - if not Assigned(glTexCoord1hvNV) then Exit; - @glTexCoord2hNV := SDL_GL_GetProcAddress('glTexCoord2hNV'); - if not Assigned(glTexCoord2hNV) then Exit; - @glTexCoord2hvNV := SDL_GL_GetProcAddress('glTexCoord2hvNV'); - if not Assigned(glTexCoord2hvNV) then Exit; - @glTexCoord3hNV := SDL_GL_GetProcAddress('glTexCoord3hNV'); - if not Assigned(glTexCoord3hNV) then Exit; - @glTexCoord3hvNV := SDL_GL_GetProcAddress('glTexCoord3hvNV'); - if not Assigned(glTexCoord3hvNV) then Exit; - @glTexCoord4hNV := SDL_GL_GetProcAddress('glTexCoord4hNV'); - if not Assigned(glTexCoord4hNV) then Exit; - @glTexCoord4hvNV := SDL_GL_GetProcAddress('glTexCoord4hvNV'); - if not Assigned(glTexCoord4hvNV) then Exit; - @glMultiTexCoord1hNV := SDL_GL_GetProcAddress('glMultiTexCoord1hNV'); - if not Assigned(glMultiTexCoord1hNV) then Exit; - @glMultiTexCoord1hvNV := SDL_GL_GetProcAddress('glMultiTexCoord1hvNV'); - if not Assigned(glMultiTexCoord1hvNV) then Exit; - @glMultiTexCoord2hNV := SDL_GL_GetProcAddress('glMultiTexCoord2hNV'); - if not Assigned(glMultiTexCoord2hNV) then Exit; - @glMultiTexCoord2hvNV := SDL_GL_GetProcAddress('glMultiTexCoord2hvNV'); - if not Assigned(glMultiTexCoord2hvNV) then Exit; - @glMultiTexCoord3hNV := SDL_GL_GetProcAddress('glMultiTexCoord3hNV'); - if not Assigned(glMultiTexCoord3hNV) then Exit; - @glMultiTexCoord3hvNV := SDL_GL_GetProcAddress('glMultiTexCoord3hvNV'); - if not Assigned(glMultiTexCoord3hvNV) then Exit; - @glMultiTexCoord4hNV := SDL_GL_GetProcAddress('glMultiTexCoord4hNV'); - if not Assigned(glMultiTexCoord4hNV) then Exit; - @glMultiTexCoord4hvNV := SDL_GL_GetProcAddress('glMultiTexCoord4hvNV'); - if not Assigned(glMultiTexCoord4hvNV) then Exit; - @glFogCoordhNV := SDL_GL_GetProcAddress('glFogCoordhNV'); - if not Assigned(glFogCoordhNV) then Exit; - @glFogCoordhvNV := SDL_GL_GetProcAddress('glFogCoordhvNV'); - if not Assigned(glFogCoordhvNV) then Exit; - @glSecondaryColor3hNV := SDL_GL_GetProcAddress('glSecondaryColor3hNV'); - if not Assigned(glSecondaryColor3hNV) then Exit; - @glSecondaryColor3hvNV := SDL_GL_GetProcAddress('glSecondaryColor3hvNV'); - if not Assigned(glSecondaryColor3hvNV) then Exit; - @glVertexWeighthNV := SDL_GL_GetProcAddress('glVertexWeighthNV'); - if not Assigned(glVertexWeighthNV) then Exit; - @glVertexWeighthvNV := SDL_GL_GetProcAddress('glVertexWeighthvNV'); - if not Assigned(glVertexWeighthvNV) then Exit; - @glVertexAttrib1hNV := SDL_GL_GetProcAddress('glVertexAttrib1hNV'); - if not Assigned(glVertexAttrib1hNV) then Exit; - @glVertexAttrib1hvNV := SDL_GL_GetProcAddress('glVertexAttrib1hvNV'); - if not Assigned(glVertexAttrib1hvNV) then Exit; - @glVertexAttrib2hNV := SDL_GL_GetProcAddress('glVertexAttrib2hNV'); - if not Assigned(glVertexAttrib2hNV) then Exit; - @glVertexAttrib2hvNV := SDL_GL_GetProcAddress('glVertexAttrib2hvNV'); - if not Assigned(glVertexAttrib2hvNV) then Exit; - @glVertexAttrib3hNV := SDL_GL_GetProcAddress('glVertexAttrib3hNV'); - if not Assigned(glVertexAttrib3hNV) then Exit; - @glVertexAttrib3hvNV := SDL_GL_GetProcAddress('glVertexAttrib3hvNV'); - if not Assigned(glVertexAttrib3hvNV) then Exit; - @glVertexAttrib4hNV := SDL_GL_GetProcAddress('glVertexAttrib4hNV'); - if not Assigned(glVertexAttrib4hNV) then Exit; - @glVertexAttrib4hvNV := SDL_GL_GetProcAddress('glVertexAttrib4hvNV'); - if not Assigned(glVertexAttrib4hvNV) then Exit; - @glVertexAttribs1hvNV := SDL_GL_GetProcAddress('glVertexAttribs1hvNV'); - if not Assigned(glVertexAttribs1hvNV) then Exit; - @glVertexAttribs2hvNV := SDL_GL_GetProcAddress('glVertexAttribs2hvNV'); - if not Assigned(glVertexAttribs2hvNV) then Exit; - @glVertexAttribs3hvNV := SDL_GL_GetProcAddress('glVertexAttribs3hvNV'); - if not Assigned(glVertexAttribs3hvNV) then Exit; - @glVertexAttribs4hvNV := SDL_GL_GetProcAddress('glVertexAttribs4hvNV'); - if not Assigned(glVertexAttribs4hvNV) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_ATI_map_object_buffer: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ATI_map_object_buffer', extstring) then - begin - @glMapObjectBufferATI := SDL_GL_GetProcAddress('glMapObjectBufferATI'); - if not Assigned(glMapObjectBufferATI) then Exit; - @glUnmapObjectBufferATI := SDL_GL_GetProcAddress('glUnmapObjectBufferATI'); - if not Assigned(glUnmapObjectBufferATI) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_ATI_separate_stencil: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ATI_separate_stencil', extstring) then - begin - @glStencilOpSeparateATI := SDL_GL_GetProcAddress('glStencilOpSeparateATI'); - if not Assigned(glStencilOpSeparateATI) then Exit; - @glStencilFuncSeparateATI := SDL_GL_GetProcAddress('glStencilFuncSeparateATI'); - if not Assigned(glStencilFuncSeparateATI) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_ATI_vertex_attrib_array_object: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ATI_vertex_attrib_array_object', extstring) then - begin - @glVertexAttribArrayObjectATI := SDL_GL_GetProcAddress('glVertexAttribArrayObjectATI'); - if not Assigned(glVertexAttribArrayObjectATI) then Exit; - @glGetVertexAttribArrayObjectfvATI := SDL_GL_GetProcAddress('glGetVertexAttribArrayObjectfvATI'); - if not Assigned(glGetVertexAttribArrayObjectfvATI) then Exit; - @glGetVertexAttribArrayObjectivATI := SDL_GL_GetProcAddress('glGetVertexAttribArrayObjectivATI'); - if not Assigned(glGetVertexAttribArrayObjectivATI) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_ARB_vertex_buffer_object: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_vertex_buffer_object', extstring) then - begin - @glBindBufferARB := SDL_GL_GetProcAddress('glBindBufferARB'); - if not Assigned(glBindBufferARB) then Exit; - @glDeleteBuffersARB := SDL_GL_GetProcAddress('glDeleteBuffersARB'); - if not Assigned(glDeleteBuffersARB) then Exit; - @glGenBuffersARB := SDL_GL_GetProcAddress('glGenBuffersARB'); - if not Assigned(glGenBuffersARB) then Exit; - @glIsBufferARB := SDL_GL_GetProcAddress('glIsBufferARB'); - if not Assigned(glIsBufferARB) then Exit; - @glBufferDataARB := SDL_GL_GetProcAddress('glBufferDataARB'); - if not Assigned(glBufferDataARB) then Exit; - @glBufferSubDataARB := SDL_GL_GetProcAddress('glBufferSubDataARB'); - if not Assigned(glBufferSubDataARB) then Exit; - @glGetBufferSubDataARB := SDL_GL_GetProcAddress('glGetBufferSubDataARB'); - if not Assigned(glGetBufferSubDataARB) then Exit; - @glMapBufferARB := SDL_GL_GetProcAddress('glMapBufferARB'); - if not Assigned(glMapBufferARB) then Exit; - @glUnmapBufferARB := SDL_GL_GetProcAddress('glUnmapBufferARB'); - if not Assigned(glUnmapBufferARB) then Exit; - @glGetBufferParameterivARB := SDL_GL_GetProcAddress('glGetBufferParameterivARB'); - if not Assigned(glGetBufferParameterivARB) then Exit; - @glGetBufferPointervARB := SDL_GL_GetProcAddress('glGetBufferPointervARB'); - if not Assigned(glGetBufferPointervARB) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_ARB_occlusion_query: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_occlusion_query', extstring) then - begin - @glGenQueriesARB := SDL_GL_GetProcAddress('glGenQueriesARB'); - if not Assigned(glGenQueriesARB) then Exit; - @glDeleteQueriesARB := SDL_GL_GetProcAddress('glDeleteQueriesARB'); - if not Assigned(glDeleteQueriesARB) then Exit; - @glIsQueryARB := SDL_GL_GetProcAddress('glIsQueryARB'); - if not Assigned(glIsQueryARB) then Exit; - @glBeginQueryARB := SDL_GL_GetProcAddress('glBeginQueryARB'); - if not Assigned(glBeginQueryARB) then Exit; - @glEndQueryARB := SDL_GL_GetProcAddress('glEndQueryARB'); - if not Assigned(glEndQueryARB) then Exit; - @glGetQueryivARB := SDL_GL_GetProcAddress('glGetQueryivARB'); - if not Assigned(glGetQueryivARB) then Exit; - @glGetQueryObjectivARB := SDL_GL_GetProcAddress('glGetQueryObjectivARB'); - if not Assigned(glGetQueryObjectivARB) then Exit; - @glGetQueryObjectuivARB := SDL_GL_GetProcAddress('glGetQueryObjectuivARB'); - if not Assigned(glGetQueryObjectuivARB) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_ARB_shader_objects: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_shader_objects', extstring) then - begin - @glDeleteObjectARB := SDL_GL_GetProcAddress('glDeleteObjectARB'); - if not Assigned(glDeleteObjectARB) then Exit; - @glGetHandleARB := SDL_GL_GetProcAddress('glGetHandleARB'); - if not Assigned(glGetHandleARB) then Exit; - @glDetachObjectARB := SDL_GL_GetProcAddress('glDetachObjectARB'); - if not Assigned(glDetachObjectARB) then Exit; - @glCreateShaderObjectARB := SDL_GL_GetProcAddress('glCreateShaderObjectARB'); - if not Assigned(glCreateShaderObjectARB) then Exit; - @glShaderSourceARB := SDL_GL_GetProcAddress('glShaderSourceARB'); - if not Assigned(glShaderSourceARB) then Exit; - @glCompileShaderARB := SDL_GL_GetProcAddress('glCompileShaderARB'); - if not Assigned(glCompileShaderARB) then Exit; - @glCreateProgramObjectARB := SDL_GL_GetProcAddress('glCreateProgramObjectARB'); - if not Assigned(glCreateProgramObjectARB) then Exit; - @glAttachObjectARB := SDL_GL_GetProcAddress('glAttachObjectARB'); - if not Assigned(glAttachObjectARB) then Exit; - @glLinkProgramARB := SDL_GL_GetProcAddress('glLinkProgramARB'); - if not Assigned(glLinkProgramARB) then Exit; - @glUseProgramObjectARB := SDL_GL_GetProcAddress('glUseProgramObjectARB'); - if not Assigned(glUseProgramObjectARB) then Exit; - @glValidateProgramARB := SDL_GL_GetProcAddress('glValidateProgramARB'); - if not Assigned(glValidateProgramARB) then Exit; - @glUniform1fARB := SDL_GL_GetProcAddress('glUniform1fARB'); - if not Assigned(glUniform1fARB) then Exit; - @glUniform2fARB := SDL_GL_GetProcAddress('glUniform2fARB'); - if not Assigned(glUniform2fARB) then Exit; - @glUniform3fARB := SDL_GL_GetProcAddress('glUniform3fARB'); - if not Assigned(glUniform3fARB) then Exit; - @glUniform4fARB := SDL_GL_GetProcAddress('glUniform4fARB'); - if not Assigned(glUniform4fARB) then Exit; - @glUniform1iARB := SDL_GL_GetProcAddress('glUniform1iARB'); - if not Assigned(glUniform1iARB) then Exit; - @glUniform2iARB := SDL_GL_GetProcAddress('glUniform2iARB'); - if not Assigned(glUniform2iARB) then Exit; - @glUniform3iARB := SDL_GL_GetProcAddress('glUniform3iARB'); - if not Assigned(glUniform3iARB) then Exit; - @glUniform4iARB := SDL_GL_GetProcAddress('glUniform4iARB'); - if not Assigned(glUniform4iARB) then Exit; - @glUniform1fvARB := SDL_GL_GetProcAddress('glUniform1fvARB'); - if not Assigned(glUniform1fvARB) then Exit; - @glUniform2fvARB := SDL_GL_GetProcAddress('glUniform2fvARB'); - if not Assigned(glUniform2fvARB) then Exit; - @glUniform3fvARB := SDL_GL_GetProcAddress('glUniform3fvARB'); - if not Assigned(glUniform3fvARB) then Exit; - @glUniform4fvARB := SDL_GL_GetProcAddress('glUniform4fvARB'); - if not Assigned(glUniform4fvARB) then Exit; - @glUniform1ivARB := SDL_GL_GetProcAddress('glUniform1ivARB'); - if not Assigned(glUniform1ivARB) then Exit; - @glUniform2ivARB := SDL_GL_GetProcAddress('glUniform2ivARB'); - if not Assigned(glUniform2ivARB) then Exit; - @glUniform3ivARB := SDL_GL_GetProcAddress('glUniform3ivARB'); - if not Assigned(glUniform3ivARB) then Exit; - @glUniform4ivARB := SDL_GL_GetProcAddress('glUniform4ivARB'); - if not Assigned(glUniform4ivARB) then Exit; - @glUniformMatrix2fvARB := SDL_GL_GetProcAddress('glUniformMatrix2fvARB'); - if not Assigned(glUniformMatrix2fvARB) then Exit; - @glUniformMatrix3fvARB := SDL_GL_GetProcAddress('glUniformMatrix3fvARB'); - if not Assigned(glUniformMatrix3fvARB) then Exit; - @glUniformMatrix4fvARB := SDL_GL_GetProcAddress('glUniformMatrix4fvARB'); - if not Assigned(glUniformMatrix4fvARB) then Exit; - @glGetObjectParameterfvARB := SDL_GL_GetProcAddress('glGetObjectParameterfvARB'); - if not Assigned(glGetObjectParameterfvARB) then Exit; - @glGetObjectParameterivARB := SDL_GL_GetProcAddress('glGetObjectParameterivARB'); - if not Assigned(glGetObjectParameterivARB) then Exit; - @glGetInfoLogARB := SDL_GL_GetProcAddress('glGetInfoLogARB'); - if not Assigned(glGetInfoLogARB) then Exit; - @glGetAttachedObjectsARB := SDL_GL_GetProcAddress('glGetAttachedObjectsARB'); - if not Assigned(glGetAttachedObjectsARB) then Exit; - @glGetUniformLocationARB := SDL_GL_GetProcAddress('glGetUniformLocationARB'); - if not Assigned(glGetUniformLocationARB) then Exit; - @glGetActiveUniformARB := SDL_GL_GetProcAddress('glGetActiveUniformARB'); - if not Assigned(glGetActiveUniformARB) then Exit; - @glGetUniformfvARB := SDL_GL_GetProcAddress('glGetUniformfvARB'); - if not Assigned(glGetUniformfvARB) then Exit; - @glGetUniformivARB := SDL_GL_GetProcAddress('glGetUniformivARB'); - if not Assigned(glGetUniformivARB) then Exit; - @glGetShaderSourceARB := SDL_GL_GetProcAddress('glGetShaderSourceARB'); - if not Assigned(glGetShaderSourceARB) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_ARB_vertex_shader: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_vertex_shader', extstring) then - begin - @glVertexAttrib1fARB := SDL_GL_GetProcAddress('glVertexAttrib1fARB'); - if not Assigned(glVertexAttrib1fARB) then Exit; - @glVertexAttrib1sARB := SDL_GL_GetProcAddress('glVertexAttrib1sARB'); - if not Assigned(glVertexAttrib1sARB) then Exit; - @glVertexAttrib1dARB := SDL_GL_GetProcAddress('glVertexAttrib1dARB'); - if not Assigned(glVertexAttrib1dARB) then Exit; - @glVertexAttrib2fARB := SDL_GL_GetProcAddress('glVertexAttrib2fARB'); - if not Assigned(glVertexAttrib2fARB) then Exit; - @glVertexAttrib2sARB := SDL_GL_GetProcAddress('glVertexAttrib2sARB'); - if not Assigned(glVertexAttrib2sARB) then Exit; - @glVertexAttrib2dARB := SDL_GL_GetProcAddress('glVertexAttrib2dARB'); - if not Assigned(glVertexAttrib2dARB) then Exit; - @glVertexAttrib3fARB := SDL_GL_GetProcAddress('glVertexAttrib3fARB'); - if not Assigned(glVertexAttrib3fARB) then Exit; - @glVertexAttrib3sARB := SDL_GL_GetProcAddress('glVertexAttrib3sARB'); - if not Assigned(glVertexAttrib3sARB) then Exit; - @glVertexAttrib3dARB := SDL_GL_GetProcAddress('glVertexAttrib3dARB'); - if not Assigned(glVertexAttrib3dARB) then Exit; - @glVertexAttrib4fARB := SDL_GL_GetProcAddress('glVertexAttrib4fARB'); - if not Assigned(glVertexAttrib4fARB) then Exit; - @glVertexAttrib4sARB := SDL_GL_GetProcAddress('glVertexAttrib4sARB'); - if not Assigned(glVertexAttrib4sARB) then Exit; - @glVertexAttrib4dARB := SDL_GL_GetProcAddress('glVertexAttrib4dARB'); - if not Assigned(glVertexAttrib4dARB) then Exit; - @glVertexAttrib4NubARB := SDL_GL_GetProcAddress('glVertexAttrib4NubARB'); - if not Assigned(glVertexAttrib4NubARB) then Exit; - @glVertexAttrib1fvARB := SDL_GL_GetProcAddress('glVertexAttrib1fvARB'); - if not Assigned(glVertexAttrib1fvARB) then Exit; - @glVertexAttrib1svARB := SDL_GL_GetProcAddress('glVertexAttrib1svARB'); - if not Assigned(glVertexAttrib1svARB) then Exit; - @glVertexAttrib1dvARB := SDL_GL_GetProcAddress('glVertexAttrib1dvARB'); - if not Assigned(glVertexAttrib1dvARB) then Exit; - @glVertexAttrib2fvARB := SDL_GL_GetProcAddress('glVertexAttrib2fvARB'); - if not Assigned(glVertexAttrib2fvARB) then Exit; - @glVertexAttrib2svARB := SDL_GL_GetProcAddress('glVertexAttrib2svARB'); - if not Assigned(glVertexAttrib2svARB) then Exit; - @glVertexAttrib2dvARB := SDL_GL_GetProcAddress('glVertexAttrib2dvARB'); - if not Assigned(glVertexAttrib2dvARB) then Exit; - @glVertexAttrib3fvARB := SDL_GL_GetProcAddress('glVertexAttrib3fvARB'); - if not Assigned(glVertexAttrib3fvARB) then Exit; - @glVertexAttrib3svARB := SDL_GL_GetProcAddress('glVertexAttrib3svARB'); - if not Assigned(glVertexAttrib3svARB) then Exit; - @glVertexAttrib3dvARB := SDL_GL_GetProcAddress('glVertexAttrib3dvARB'); - if not Assigned(glVertexAttrib3dvARB) then Exit; - @glVertexAttrib4fvARB := SDL_GL_GetProcAddress('glVertexAttrib4fvARB'); - if not Assigned(glVertexAttrib4fvARB) then Exit; - @glVertexAttrib4svARB := SDL_GL_GetProcAddress('glVertexAttrib4svARB'); - if not Assigned(glVertexAttrib4svARB) then Exit; - @glVertexAttrib4dvARB := SDL_GL_GetProcAddress('glVertexAttrib4dvARB'); - if not Assigned(glVertexAttrib4dvARB) then Exit; - @glVertexAttrib4ivARB := SDL_GL_GetProcAddress('glVertexAttrib4ivARB'); - if not Assigned(glVertexAttrib4ivARB) then Exit; - @glVertexAttrib4bvARB := SDL_GL_GetProcAddress('glVertexAttrib4bvARB'); - if not Assigned(glVertexAttrib4bvARB) then Exit; - @glVertexAttrib4ubvARB := SDL_GL_GetProcAddress('glVertexAttrib4ubvARB'); - if not Assigned(glVertexAttrib4ubvARB) then Exit; - @glVertexAttrib4usvARB := SDL_GL_GetProcAddress('glVertexAttrib4usvARB'); - if not Assigned(glVertexAttrib4usvARB) then Exit; - @glVertexAttrib4uivARB := SDL_GL_GetProcAddress('glVertexAttrib4uivARB'); - if not Assigned(glVertexAttrib4uivARB) then Exit; - @glVertexAttrib4NbvARB := SDL_GL_GetProcAddress('glVertexAttrib4NbvARB'); - if not Assigned(glVertexAttrib4NbvARB) then Exit; - @glVertexAttrib4NsvARB := SDL_GL_GetProcAddress('glVertexAttrib4NsvARB'); - if not Assigned(glVertexAttrib4NsvARB) then Exit; - @glVertexAttrib4NivARB := SDL_GL_GetProcAddress('glVertexAttrib4NivARB'); - if not Assigned(glVertexAttrib4NivARB) then Exit; - @glVertexAttrib4NubvARB := SDL_GL_GetProcAddress('glVertexAttrib4NubvARB'); - if not Assigned(glVertexAttrib4NubvARB) then Exit; - @glVertexAttrib4NusvARB := SDL_GL_GetProcAddress('glVertexAttrib4NusvARB'); - if not Assigned(glVertexAttrib4NusvARB) then Exit; - @glVertexAttrib4NuivARB := SDL_GL_GetProcAddress('glVertexAttrib4NuivARB'); - if not Assigned(glVertexAttrib4NuivARB) then Exit; - @glVertexAttribPointerARB := SDL_GL_GetProcAddress('glVertexAttribPointerARB'); - if not Assigned(glVertexAttribPointerARB) then Exit; - @glEnableVertexAttribArrayARB := SDL_GL_GetProcAddress('glEnableVertexAttribArrayARB'); - if not Assigned(glEnableVertexAttribArrayARB) then Exit; - @glDisableVertexAttribArrayARB := SDL_GL_GetProcAddress('glDisableVertexAttribArrayARB'); - if not Assigned(glDisableVertexAttribArrayARB) then Exit; - @glBindAttribLocationARB := SDL_GL_GetProcAddress('glBindAttribLocationARB'); - if not Assigned(glBindAttribLocationARB) then Exit; - @glGetActiveAttribARB := SDL_GL_GetProcAddress('glGetActiveAttribARB'); - if not Assigned(glGetActiveAttribARB) then Exit; - @glGetAttribLocationARB := SDL_GL_GetProcAddress('glGetAttribLocationARB'); - if not Assigned(glGetAttribLocationARB) then Exit; - @glGetVertexAttribdvARB := SDL_GL_GetProcAddress('glGetVertexAttribdvARB'); - if not Assigned(glGetVertexAttribdvARB) then Exit; - @glGetVertexAttribfvARB := SDL_GL_GetProcAddress('glGetVertexAttribfvARB'); - if not Assigned(glGetVertexAttribfvARB) then Exit; - @glGetVertexAttribivARB := SDL_GL_GetProcAddress('glGetVertexAttribivARB'); - if not Assigned(glGetVertexAttribivARB) then Exit; - @glGetVertexAttribPointervARB := SDL_GL_GetProcAddress('glGetVertexAttribPointervARB'); - if not Assigned(glGetVertexAttribPointervARB) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_ARB_fragment_shader: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_fragment_shader', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_ARB_shading_language_100: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_shading_language_100', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_ARB_texture_non_power_of_two: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_texture_non_power_of_two', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_ARB_point_sprite: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_point_sprite', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_EXT_depth_bounds_test: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_depth_bounds_test', extstring) then - begin - @glDepthBoundsEXT := SDL_GL_GetProcAddress('glDepthBoundsEXT'); - if not Assigned(glDepthBoundsEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_EXT_secondary_color: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_secondary_color', extstring) then - begin - @glSecondaryColor3bEXT := SDL_GL_GetProcAddress('glSecondaryColor3bEXT'); - if not Assigned(glSecondaryColor3bEXT) then Exit; - @glSecondaryColor3sEXT := SDL_GL_GetProcAddress('glSecondaryColor3sEXT'); - if not Assigned(glSecondaryColor3sEXT) then Exit; - @glSecondaryColor3iEXT := SDL_GL_GetProcAddress('glSecondaryColor3iEXT'); - if not Assigned(glSecondaryColor3iEXT) then Exit; - @glSecondaryColor3fEXT := SDL_GL_GetProcAddress('glSecondaryColor3fEXT'); - if not Assigned(glSecondaryColor3fEXT) then Exit; - @glSecondaryColor3dEXT := SDL_GL_GetProcAddress('glSecondaryColor3dEXT'); - if not Assigned(glSecondaryColor3dEXT) then Exit; - @glSecondaryColor3ubEXT := SDL_GL_GetProcAddress('glSecondaryColor3ubEXT'); - if not Assigned(glSecondaryColor3ubEXT) then Exit; - @glSecondaryColor3usEXT := SDL_GL_GetProcAddress('glSecondaryColor3usEXT'); - if not Assigned(glSecondaryColor3usEXT) then Exit; - @glSecondaryColor3uiEXT := SDL_GL_GetProcAddress('glSecondaryColor3uiEXT'); - if not Assigned(glSecondaryColor3uiEXT) then Exit; - @glSecondaryColor3bvEXT := SDL_GL_GetProcAddress('glSecondaryColor3bvEXT'); - if not Assigned(glSecondaryColor3bvEXT) then Exit; - @glSecondaryColor3svEXT := SDL_GL_GetProcAddress('glSecondaryColor3svEXT'); - if not Assigned(glSecondaryColor3svEXT) then Exit; - @glSecondaryColor3ivEXT := SDL_GL_GetProcAddress('glSecondaryColor3ivEXT'); - if not Assigned(glSecondaryColor3ivEXT) then Exit; - @glSecondaryColor3fvEXT := SDL_GL_GetProcAddress('glSecondaryColor3fvEXT'); - if not Assigned(glSecondaryColor3fvEXT) then Exit; - @glSecondaryColor3dvEXT := SDL_GL_GetProcAddress('glSecondaryColor3dvEXT'); - if not Assigned(glSecondaryColor3dvEXT) then Exit; - @glSecondaryColor3ubvEXT := SDL_GL_GetProcAddress('glSecondaryColor3ubvEXT'); - if not Assigned(glSecondaryColor3ubvEXT) then Exit; - @glSecondaryColor3usvEXT := SDL_GL_GetProcAddress('glSecondaryColor3usvEXT'); - if not Assigned(glSecondaryColor3usvEXT) then Exit; - @glSecondaryColor3uivEXT := SDL_GL_GetProcAddress('glSecondaryColor3uivEXT'); - if not Assigned(glSecondaryColor3uivEXT) then Exit; - @glSecondaryColorPointerEXT := SDL_GL_GetProcAddress('glSecondaryColorPointerEXT'); - if not Assigned(glSecondaryColorPointerEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_EXT_texture_mirror_clamp: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_texture_mirror_clamp', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_EXT_blend_equation_separate: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_blend_equation_separate', extstring) then - begin - @glBlendEquationSeparateEXT := SDL_GL_GetProcAddress('glBlendEquationSeparateEXT'); - if not Assigned(glBlendEquationSeparateEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_MESA_pack_invert: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_MESA_pack_invert', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_MESA_ycbcr_texture: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_MESA_ycbcr_texture', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_ARB_fragment_program_shadow: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_ARB_fragment_program_shadow', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_EXT_fog_coord: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_fog_coord', extstring) then - begin - @glFogCoordfEXT := SDL_GL_GetProcAddress('glFogCoordfEXT'); - if not Assigned(glFogCoordfEXT) then Exit; - @glFogCoorddEXT := SDL_GL_GetProcAddress('glFogCoorddEXT'); - if not Assigned(glFogCoorddEXT) then Exit; - @glFogCoordfvEXT := SDL_GL_GetProcAddress('glFogCoordfvEXT'); - if not Assigned(glFogCoordfvEXT) then Exit; - @glFogCoorddvEXT := SDL_GL_GetProcAddress('glFogCoorddvEXT'); - if not Assigned(glFogCoorddvEXT) then Exit; - @glFogCoordPointerEXT := SDL_GL_GetProcAddress('glFogCoordPointerEXT'); - if not Assigned(glFogCoordPointerEXT) then Exit; - Result := TRUE; - end; - -end; - -function Load_GL_NV_fragment_program_option: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_fragment_program_option', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_EXT_pixel_buffer_object: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_EXT_pixel_buffer_object', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_fragment_program2: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_fragment_program2', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_vertex_program2_option: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_vertex_program2_option', extstring) then - begin - Result := TRUE; - end; - -end; - -function Load_GL_NV_vertex_program3: Boolean; -var - extstring : PChar; -begin - - Result := FALSE; - extstring := glGetString( GL_EXTENSIONS ); - - if glext_ExtensionSupported('GL_NV_vertex_program3', extstring) then - begin - Result := TRUE; - end; - -end; - -function glext_LoadExtension(ext: PChar): Boolean; -begin - - Result := FALSE; - - if ext = 'GL_version_1_2' then Result := Load_GL_version_1_2 - else if ext = 'GL_ARB_imaging' then Result := Load_GL_ARB_imaging - else if ext = 'GL_version_1_3' then Result := Load_GL_version_1_3 - else if ext = 'GL_ARB_multitexture' then Result := Load_GL_ARB_multitexture - else if ext = 'GL_ARB_transpose_matrix' then Result := Load_GL_ARB_transpose_matrix - else if ext = 'GL_ARB_multisample' then Result := Load_GL_ARB_multisample - else if ext = 'GL_ARB_texture_env_add' then Result := Load_GL_ARB_texture_env_add - {$IFDEF WIN32} - else if ext = 'WGL_ARB_extensions_string' then Result := Load_WGL_ARB_extensions_string - else if ext = 'WGL_ARB_buffer_region' then Result := Load_WGL_ARB_buffer_region - {$ENDIF} - else if ext = 'GL_ARB_texture_cube_map' then Result := Load_GL_ARB_texture_cube_map - else if ext = 'GL_ARB_depth_texture' then Result := Load_GL_ARB_depth_texture - else if ext = 'GL_ARB_point_parameters' then Result := Load_GL_ARB_point_parameters - else if ext = 'GL_ARB_shadow' then Result := Load_GL_ARB_shadow - else if ext = 'GL_ARB_shadow_ambient' then Result := Load_GL_ARB_shadow_ambient - else if ext = 'GL_ARB_texture_border_clamp' then Result := Load_GL_ARB_texture_border_clamp - else if ext = 'GL_ARB_texture_compression' then Result := Load_GL_ARB_texture_compression - else if ext = 'GL_ARB_texture_env_combine' then Result := Load_GL_ARB_texture_env_combine - else if ext = 'GL_ARB_texture_env_crossbar' then Result := Load_GL_ARB_texture_env_crossbar - else if ext = 'GL_ARB_texture_env_dot3' then Result := Load_GL_ARB_texture_env_dot3 - else if ext = 'GL_ARB_texture_mirrored_repeat' then Result := Load_GL_ARB_texture_mirrored_repeat - else if ext = 'GL_ARB_vertex_blend' then Result := Load_GL_ARB_vertex_blend - else if ext = 'GL_ARB_vertex_program' then Result := Load_GL_ARB_vertex_program - else if ext = 'GL_ARB_window_pos' then Result := Load_GL_ARB_window_pos - else if ext = 'GL_EXT_422_pixels' then Result := Load_GL_EXT_422_pixels - else if ext = 'GL_EXT_abgr' then Result := Load_GL_EXT_abgr - else if ext = 'GL_EXT_bgra' then Result := Load_GL_EXT_bgra - else if ext = 'GL_EXT_blend_color' then Result := Load_GL_EXT_blend_color - else if ext = 'GL_EXT_blend_func_separate' then Result := Load_GL_EXT_blend_func_separate - else if ext = 'GL_EXT_blend_logic_op' then Result := Load_GL_EXT_blend_logic_op - else if ext = 'GL_EXT_blend_minmax' then Result := Load_GL_EXT_blend_minmax - else if ext = 'GL_EXT_blend_subtract' then Result := Load_GL_EXT_blend_subtract - else if ext = 'GL_EXT_clip_volume_hint' then Result := Load_GL_EXT_clip_volume_hint - else if ext = 'GL_EXT_color_subtable' then Result := Load_GL_EXT_color_subtable - else if ext = 'GL_EXT_compiled_vertex_array' then Result := Load_GL_EXT_compiled_vertex_array - else if ext = 'GL_EXT_convolution' then Result := Load_GL_EXT_convolution - else if ext = 'GL_EXT_histogram' then Result := Load_GL_EXT_histogram - else if ext = 'GL_EXT_multi_draw_arrays' then Result := Load_GL_EXT_multi_draw_arrays - else if ext = 'GL_EXT_packed_pixels' then Result := Load_GL_EXT_packed_pixels - else if ext = 'GL_EXT_paletted_texture' then Result := Load_GL_EXT_paletted_texture - else if ext = 'GL_EXT_point_parameters' then Result := Load_GL_EXT_point_parameters - else if ext = 'GL_EXT_polygon_offset' then Result := Load_GL_EXT_polygon_offset - else if ext = 'GL_EXT_separate_specular_color' then Result := Load_GL_EXT_separate_specular_color - else if ext = 'GL_EXT_shadow_funcs' then Result := Load_GL_EXT_shadow_funcs - else if ext = 'GL_EXT_shared_texture_palette' then Result := Load_GL_EXT_shared_texture_palette - else if ext = 'GL_EXT_stencil_two_side' then Result := Load_GL_EXT_stencil_two_side - else if ext = 'GL_EXT_stencil_wrap' then Result := Load_GL_EXT_stencil_wrap - else if ext = 'GL_EXT_subtexture' then Result := Load_GL_EXT_subtexture - else if ext = 'GL_EXT_texture3D' then Result := Load_GL_EXT_texture3D - else if ext = 'GL_EXT_texture_compression_s3tc' then Result := Load_GL_EXT_texture_compression_s3tc - else if ext = 'GL_EXT_texture_env_add' then Result := Load_GL_EXT_texture_env_add - else if ext = 'GL_EXT_texture_env_combine' then Result := Load_GL_EXT_texture_env_combine - else if ext = 'GL_EXT_texture_env_dot3' then Result := Load_GL_EXT_texture_env_dot3 - else if ext = 'GL_EXT_texture_filter_anisotropic' then Result := Load_GL_EXT_texture_filter_anisotropic - else if ext = 'GL_EXT_texture_lod_bias' then Result := Load_GL_EXT_texture_lod_bias - else if ext = 'GL_EXT_texture_object' then Result := Load_GL_EXT_texture_object - else if ext = 'GL_EXT_vertex_array' then Result := Load_GL_EXT_vertex_array - else if ext = 'GL_EXT_vertex_shader' then Result := Load_GL_EXT_vertex_shader - else if ext = 'GL_EXT_vertex_weighting' then Result := Load_GL_EXT_vertex_weighting - else if ext = 'GL_HP_occlusion_test' then Result := Load_GL_HP_occlusion_test - else if ext = 'GL_NV_blend_square' then Result := Load_GL_NV_blend_square - else if ext = 'GL_NV_copy_depth_to_color' then Result := Load_GL_NV_copy_depth_to_color - else if ext = 'GL_NV_depth_clamp' then Result := Load_GL_NV_depth_clamp - else if ext = 'GL_NV_evaluators' then Result := Load_GL_NV_evaluators - else if ext = 'GL_NV_fence' then Result := Load_GL_NV_fence - else if ext = 'GL_NV_fog_distance' then Result := Load_GL_NV_fog_distance - else if ext = 'GL_NV_light_max_exponent' then Result := Load_GL_NV_light_max_exponent - else if ext = 'GL_NV_multisample_filter_hint' then Result := Load_GL_NV_multisample_filter_hint - else if ext = 'GL_NV_occlusion_query' then Result := Load_GL_NV_occlusion_query - else if ext = 'GL_NV_packed_depth_stencil' then Result := Load_GL_NV_packed_depth_stencil - else if ext = 'GL_NV_point_sprite' then Result := Load_GL_NV_point_sprite - else if ext = 'GL_NV_register_combiners' then Result := Load_GL_NV_register_combiners - else if ext = 'GL_NV_register_combiners2' then Result := Load_GL_NV_register_combiners2 - else if ext = 'GL_NV_texgen_emboss' then Result := Load_GL_NV_texgen_emboss - else if ext = 'GL_NV_texgen_reflection' then Result := Load_GL_NV_texgen_reflection - else if ext = 'GL_NV_texture_compression_vtc' then Result := Load_GL_NV_texture_compression_vtc - else if ext = 'GL_NV_texture_env_combine4' then Result := Load_GL_NV_texture_env_combine4 - else if ext = 'GL_NV_texture_rectangle' then Result := Load_GL_NV_texture_rectangle - else if ext = 'GL_NV_texture_shader' then Result := Load_GL_NV_texture_shader - else if ext = 'GL_NV_texture_shader2' then Result := Load_GL_NV_texture_shader2 - else if ext = 'GL_NV_texture_shader3' then Result := Load_GL_NV_texture_shader3 - else if ext = 'GL_NV_vertex_array_range' then Result := Load_GL_NV_vertex_array_range - else if ext = 'GL_NV_vertex_array_range2' then Result := Load_GL_NV_vertex_array_range2 - else if ext = 'GL_NV_vertex_program' then Result := Load_GL_NV_vertex_program - else if ext = 'GL_NV_vertex_program1_1' then Result := Load_GL_NV_vertex_program1_1 - else if ext = 'GL_ATI_element_array' then Result := Load_GL_ATI_element_array - else if ext = 'GL_ATI_envmap_bumpmap' then Result := Load_GL_ATI_envmap_bumpmap - else if ext = 'GL_ATI_fragment_shader' then Result := Load_GL_ATI_fragment_shader - else if ext = 'GL_ATI_pn_triangles' then Result := Load_GL_ATI_pn_triangles - else if ext = 'GL_ATI_texture_mirror_once' then Result := Load_GL_ATI_texture_mirror_once - else if ext = 'GL_ATI_vertex_array_object' then Result := Load_GL_ATI_vertex_array_object - else if ext = 'GL_ATI_vertex_streams' then Result := Load_GL_ATI_vertex_streams - {$IFDEF WIN32} - else if ext = 'WGL_I3D_image_buffer' then Result := Load_WGL_I3D_image_buffer - else if ext = 'WGL_I3D_swap_frame_lock' then Result := Load_WGL_I3D_swap_frame_lock - else if ext = 'WGL_I3D_swap_frame_usage' then Result := Load_WGL_I3D_swap_frame_usage - {$ENDIF} - else if ext = 'GL_3DFX_texture_compression_FXT1' then Result := Load_GL_3DFX_texture_compression_FXT1 - else if ext = 'GL_IBM_cull_vertex' then Result := Load_GL_IBM_cull_vertex - else if ext = 'GL_IBM_multimode_draw_arrays' then Result := Load_GL_IBM_multimode_draw_arrays - else if ext = 'GL_IBM_raster_pos_clip' then Result := Load_GL_IBM_raster_pos_clip - else if ext = 'GL_IBM_texture_mirrored_repeat' then Result := Load_GL_IBM_texture_mirrored_repeat - else if ext = 'GL_IBM_vertex_array_lists' then Result := Load_GL_IBM_vertex_array_lists - else if ext = 'GL_MESA_resize_buffers' then Result := Load_GL_MESA_resize_buffers - else if ext = 'GL_MESA_window_pos' then Result := Load_GL_MESA_window_pos - else if ext = 'GL_OML_interlace' then Result := Load_GL_OML_interlace - else if ext = 'GL_OML_resample' then Result := Load_GL_OML_resample - else if ext = 'GL_OML_subsample' then Result := Load_GL_OML_subsample - else if ext = 'GL_SGIS_generate_mipmap' then Result := Load_GL_SGIS_generate_mipmap - else if ext = 'GL_SGIS_multisample' then Result := Load_GL_SGIS_multisample - else if ext = 'GL_SGIS_pixel_texture' then Result := Load_GL_SGIS_pixel_texture - else if ext = 'GL_SGIS_texture_border_clamp' then Result := Load_GL_SGIS_texture_border_clamp - else if ext = 'GL_SGIS_texture_color_mask' then Result := Load_GL_SGIS_texture_color_mask - else if ext = 'GL_SGIS_texture_edge_clamp' then Result := Load_GL_SGIS_texture_edge_clamp - else if ext = 'GL_SGIS_texture_lod' then Result := Load_GL_SGIS_texture_lod - else if ext = 'GL_SGIS_depth_texture' then Result := Load_GL_SGIS_depth_texture - else if ext = 'GL_SGIX_fog_offset' then Result := Load_GL_SGIX_fog_offset - else if ext = 'GL_SGIX_interlace' then Result := Load_GL_SGIX_interlace - else if ext = 'GL_SGIX_shadow_ambient' then Result := Load_GL_SGIX_shadow_ambient - else if ext = 'GL_SGI_color_matrix' then Result := Load_GL_SGI_color_matrix - else if ext = 'GL_SGI_color_table' then Result := Load_GL_SGI_color_table - else if ext = 'GL_SGI_texture_color_table' then Result := Load_GL_SGI_texture_color_table - else if ext = 'GL_SUN_vertex' then Result := Load_GL_SUN_vertex - else if ext = 'GL_ARB_fragment_program' then Result := Load_GL_ARB_fragment_program - else if ext = 'GL_ATI_text_fragment_shader' then Result := Load_GL_ATI_text_fragment_shader - else if ext = 'GL_APPLE_client_storage' then Result := Load_GL_APPLE_client_storage - else if ext = 'GL_APPLE_element_array' then Result := Load_GL_APPLE_element_array - else if ext = 'GL_APPLE_fence' then Result := Load_GL_APPLE_fence - else if ext = 'GL_APPLE_vertex_array_object' then Result := Load_GL_APPLE_vertex_array_object - else if ext = 'GL_APPLE_vertex_array_range' then Result := Load_GL_APPLE_vertex_array_range - {$IFDEF WIN32} - else if ext = 'WGL_ARB_pixel_format' then Result := Load_WGL_ARB_pixel_format - else if ext = 'WGL_ARB_make_current_read' then Result := Load_WGL_ARB_make_current_read - else if ext = 'WGL_ARB_pbuffer' then Result := Load_WGL_ARB_pbuffer - else if ext = 'WGL_EXT_swap_control' then Result := Load_WGL_EXT_swap_control - else if ext = 'WGL_ARB_render_texture' then Result := Load_WGL_ARB_render_texture - else if ext = 'WGL_EXT_extensions_string' then Result := Load_WGL_EXT_extensions_string - else if ext = 'WGL_EXT_make_current_read' then Result := Load_WGL_EXT_make_current_read - else if ext = 'WGL_EXT_pbuffer' then Result := Load_WGL_EXT_pbuffer - else if ext = 'WGL_EXT_pixel_format' then Result := Load_WGL_EXT_pixel_format - else if ext = 'WGL_I3D_digital_video_control' then Result := Load_WGL_I3D_digital_video_control - else if ext = 'WGL_I3D_gamma' then Result := Load_WGL_I3D_gamma - else if ext = 'WGL_I3D_genlock' then Result := Load_WGL_I3D_genlock - {$ENDIF} - else if ext = 'GL_ARB_matrix_palette' then Result := Load_GL_ARB_matrix_palette - else if ext = 'GL_NV_element_array' then Result := Load_GL_NV_element_array - else if ext = 'GL_NV_float_buffer' then Result := Load_GL_NV_float_buffer - else if ext = 'GL_NV_fragment_program' then Result := Load_GL_NV_fragment_program - else if ext = 'GL_NV_primitive_restart' then Result := Load_GL_NV_primitive_restart - else if ext = 'GL_NV_vertex_program2' then Result := Load_GL_NV_vertex_program2 - {$IFDEF WIN32} - else if ext = 'WGL_NV_render_texture_rectangle' then Result := Load_WGL_NV_render_texture_rectangle - {$ENDIF} - else if ext = 'GL_NV_pixel_data_range' then Result := Load_GL_NV_pixel_data_range - else if ext = 'GL_EXT_texture_rectangle' then Result := Load_GL_EXT_texture_rectangle - else if ext = 'GL_S3_s3tc' then Result := Load_GL_S3_s3tc - else if ext = 'GL_ATI_draw_buffers' then Result := Load_GL_ATI_draw_buffers - {$IFDEF WIN32} - else if ext = 'WGL_ATI_pixel_format_float' then Result := Load_WGL_ATI_pixel_format_float - {$ENDIF} - else if ext = 'GL_ATI_texture_env_combine3' then Result := Load_GL_ATI_texture_env_combine3 - else if ext = 'GL_ATI_texture_float' then Result := Load_GL_ATI_texture_float - else if ext = 'GL_NV_texture_expand_normal' then Result := Load_GL_NV_texture_expand_normal - else if ext = 'GL_NV_half_float' then Result := Load_GL_NV_half_float - else if ext = 'GL_ATI_map_object_buffer' then Result := Load_GL_ATI_map_object_buffer - else if ext = 'GL_ATI_separate_stencil' then Result := Load_GL_ATI_separate_stencil - else if ext = 'GL_ATI_vertex_attrib_array_object' then Result := Load_GL_ATI_vertex_attrib_array_object - else if ext = 'GL_ARB_vertex_buffer_object' then Result := Load_GL_ARB_vertex_buffer_object - else if ext = 'GL_ARB_occlusion_query' then Result := Load_GL_ARB_occlusion_query - else if ext = 'GL_ARB_shader_objects' then Result := Load_GL_ARB_shader_objects - else if ext = 'GL_ARB_vertex_shader' then Result := Load_GL_ARB_vertex_shader - else if ext = 'GL_ARB_fragment_shader' then Result := Load_GL_ARB_fragment_shader - else if ext = 'GL_ARB_shading_language_100' then Result := Load_GL_ARB_shading_language_100 - else if ext = 'GL_ARB_texture_non_power_of_two' then Result := Load_GL_ARB_texture_non_power_of_two - else if ext = 'GL_ARB_point_sprite' then Result := Load_GL_ARB_point_sprite - else if ext = 'GL_EXT_depth_bounds_test' then Result := Load_GL_EXT_depth_bounds_test - else if ext = 'GL_EXT_secondary_color' then Result := Load_GL_EXT_secondary_color - else if ext = 'GL_EXT_texture_mirror_clamp' then Result := Load_GL_EXT_texture_mirror_clamp - else if ext = 'GL_EXT_blend_equation_separate' then Result := Load_GL_EXT_blend_equation_separate - else if ext = 'GL_MESA_pack_invert' then Result := Load_GL_MESA_pack_invert - else if ext = 'GL_MESA_ycbcr_texture' then Result := Load_GL_MESA_ycbcr_texture - else if ext = 'GL_ARB_fragment_program_shadow' then Result := Load_GL_ARB_fragment_program_shadow - else if ext = 'GL_EXT_fog_coord' then Result := Load_GL_EXT_fog_coord - else if ext = 'GL_NV_fragment_program_option' then Result := Load_GL_NV_fragment_program_option - else if ext = 'GL_EXT_pixel_buffer_object' then Result := Load_GL_EXT_pixel_buffer_object - else if ext = 'GL_NV_fragment_program2' then Result := Load_GL_NV_fragment_program2 - else if ext = 'GL_NV_vertex_program2_option' then Result := Load_GL_NV_vertex_program2_option - else if ext = 'GL_NV_vertex_program3' then Result := Load_GL_NV_vertex_program3 - -end; - -end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glu.pas b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glu.pas deleted file mode 100644 index fb48f65d..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glu.pas +++ /dev/null @@ -1,563 +0,0 @@ -unit glu; -{ - $Id: glu.pas,v 1.3 2004/10/07 21:01:29 savage Exp $ - - Adaption of the delphi3d.net OpenGL units to FreePascal - Sebastian Guenther (sg@freepascal.org) in 2002 - These units are free to use -} - -(*++ BUILD Version: 0004 // Increment this if a change has global effects - -Copyright (c) 1985-95, Microsoft Corporation - -Module Name: - - glu.h - -Abstract: - - Procedure declarations, constant definitions and macros for the OpenGL - Utility Library. - ---*) - -(* -** Copyright 1991-1993, Silicon Graphics, Inc. -** All Rights Reserved. -** -** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.; -** the contents of this file may not be disclosed to third parties, copied or -** duplicated in any form, in whole or in part, without the prior written -** permission of Silicon Graphics, Inc. -** -** RESTRICTED RIGHTS LEGEND: -** Use, duplication or disclosure by the Government is subject to restrictions -** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data -** and Computer Software clause at DFARS 252.227-7013, and/or in similar or -** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - -** rights reserved under the Copyright Laws of the United States. -*) - -(* -** Return the error string associated with a particular error code. -** This will return 0 for an invalid error code. -** -** The generic function prototype that can be compiled for ANSI or Unicode -** is defined as follows: -** -** LPCTSTR APIENTRY gluErrorStringWIN (GLenum errCode); -*) - -{******************************************************************************} -{ } -{ Converted to Delphi by Tom Nuydens (tom@delphi3d.net) } -{ For the latest updates, visit Delphi3D: http://www.delphi3d.net } -{ } -{ Modified for Delphi/Kylix and FreePascal } -{ by Dominique Louis ( Dominique@Savagesoftware.com.au) } -{ For the latest updates, visit JEDI-SDL : http://www.sf.net/projects/jedi-sdl } -{ } -{******************************************************************************} - -{ - $Log: glu.pas,v $ - Revision 1.3 2004/10/07 21:01:29 savage - Fix for FPC - - Revision 1.2 2004/08/14 22:54:30 savage - Updated so that Library name defines are correctly defined for MacOS X. - - Revision 1.1 2004/03/30 21:53:54 savage - Moved to it's own folder. - - Revision 1.4 2004/02/20 17:09:55 savage - Code tidied up in gl, glu and glut, while extensions in glext.pas are now loaded using SDL_GL_GetProcAddress, thus making it more cross-platform compatible, but now more tied to SDL. - - Revision 1.3 2004/02/14 00:23:39 savage - As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. - - Revision 1.2 2004/02/14 00:09:19 savage - Changed uses to now make use of moduleloader.pas rather than dllfuncs.pas - - Revision 1.1 2004/02/05 00:08:19 savage - Module 1.0 release - - Revision 1.4 2003/06/02 12:32:13 savage - Modified Sources to avoid warnings with Delphi by moving CVS Logging to the top of the header files. Hopefully CVS Logging still works. - - Revision 1.3 2003/05/29 22:55:00 savage - Make use of new DLLFunctions - - Revision 1.2 2003/05/27 09:39:53 savage - Added better Gnu Pascal support. - - Revision 1.1 2003/05/11 13:18:03 savage - Newest OpenGL Headers For Delphi, Kylix and FPC - - Revision 1.2 2002/10/13 14:36:47 sg - * Win32 fix: The OS symbol is called "Win32", not "Windows" - - Revision 1.1 2002/10/13 13:57:31 sg - * Finally, the new units are available: Match the C headers more closely; - support for OpenGL extensions, and much more. Based on the Delphi units - by Tom Nuydens of delphi3d.net - -} - -interface - -{$I jedi-sdl.inc} - -uses -{$IFDEF __GPC__} - gpc, -{$ENDIF} - moduleloader, - gl; - -const -{$IFDEF WIN32} - GLuLibName = 'glu32.dll'; -{$ENDIF} - -{$IFDEF UNIX} -{$IFDEF DARWIN} - GLuLibName = 'libGLU.dylib'; -{$ELSE} - GLuLibName = 'libGLU.so'; -{$ENDIF} -{$ENDIF} - -type - TViewPortArray = array [0..3] of GLint; - T16dArray = array [0..15] of GLdouble; - TCallBack = procedure; - T3dArray = array [0..2] of GLdouble; - T4pArray = array [0..3] of Pointer; - T4fArray = array [0..3] of GLfloat; - {$IFNDEF __GPC__} - PPointer = ^Pointer; - {$ENDIF} - -var - gluErrorString: function(errCode: GLenum): PGLubyte; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluErrorUnicodeStringEXT: function(errCode: GLenum): PWideChar; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluGetString: function(name: GLenum): PGLubyte; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluOrtho2D: procedure(left,right, bottom, top: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluPerspective: procedure(fovy, aspect, zNear, zFar: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluPickMatrix: procedure(x, y, width, height: GLdouble; viewport: TViewPortArray); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluLookAt: procedure(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluProject: function(objx, objy, objz: GLdouble; const modelMatrix, projMatrix: T16dArray; viewport: TViewPortArray; winx, winy, winz: PGLdouble): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluUnProject: function(winx, winy, winz: GLdouble; const modelMatrix, projMatrix: T16dArray; viewport: TViewPortArray; objx, objy, objz: PGLdouble): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluScaleImage: function(format: GLenum; widthin, heightin: GLint; typein: GLenum; const datain: Pointer; widthout, heightout: GLint; typeout: GLenum; dataout: Pointer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluBuild1DMipmaps: function(target: GLenum; components, width: GLint; format, atype: GLenum; const data: Pointer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluBuild2DMipmaps: function(target: GLenum; components, width, height: GLint; format, atype: GLenum; const data: Pointer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -type - GLUnurbs = record end; PGLUnurbs = ^GLUnurbs; - GLUquadric = record end; PGLUquadric = ^GLUquadric; - GLUtesselator = record end; PGLUtesselator = ^GLUtesselator; - - // backwards compatibility: - GLUnurbsObj = GLUnurbs; PGLUnurbsObj = PGLUnurbs; - GLUquadricObj = GLUquadric; PGLUquadricObj = PGLUquadric; - GLUtesselatorObj = GLUtesselator; PGLUtesselatorObj = PGLUtesselator; - GLUtriangulatorObj = GLUtesselator; PGLUtriangulatorObj = PGLUtesselator; - -var - gluNewQuadric: function: PGLUquadric; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluDeleteQuadric: procedure(state: PGLUquadric); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluQuadricNormals: procedure(quadObject: PGLUquadric; normals: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluQuadricTexture: procedure(quadObject: PGLUquadric; textureCoords: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluQuadricOrientation: procedure(quadObject: PGLUquadric; orientation: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluQuadricDrawStyle: procedure(quadObject: PGLUquadric; drawStyle: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluCylinder: procedure(qobj: PGLUquadric; baseRadius, topRadius, height: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluDisk: procedure(qobj: PGLUquadric; innerRadius, outerRadius: GLdouble; slices, loops: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluPartialDisk: procedure(qobj: PGLUquadric; innerRadius, outerRadius: GLdouble; slices, loops: GLint; startAngle, sweepAngle: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluSphere: procedure(qobj: PGLuquadric; radius: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluQuadricCallback: procedure(qobj: PGLUquadric; which: GLenum; fn: TCallBack); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluNewTess: function: PGLUtesselator; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluDeleteTess: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluTessBeginPolygon: procedure(tess: PGLUtesselator; polygon_data: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluTessBeginContour: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluTessVertex: procedure(tess: PGLUtesselator; coords: T3dArray; data: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluTessEndContour: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluTessEndPolygon: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluTessProperty: procedure(tess: PGLUtesselator; which: GLenum; value: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluTessNormal: procedure(tess: PGLUtesselator; x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluTessCallback: procedure(tess: PGLUtesselator; which: GLenum;fn: TCallBack); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluGetTessProperty: procedure(tess: PGLUtesselator; which: GLenum; value: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluNewNurbsRenderer: function: PGLUnurbs; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluDeleteNurbsRenderer: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluBeginSurface: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluBeginCurve: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluEndCurve: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluEndSurface: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluBeginTrim: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluEndTrim: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluPwlCurve: procedure(nobj: PGLUnurbs; count: GLint; aarray: PGLfloat; stride: GLint; atype: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluNurbsCurve: procedure(nobj: PGLUnurbs; nknots: GLint; knot: PGLfloat; stride: GLint; ctlarray: PGLfloat; order: GLint; atype: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluNurbsSurface: procedure(nobj: PGLUnurbs; sknot_count: GLint; sknot: PGLfloat; tknot_count: GLint; tknot: PGLfloat; s_stride, t_stride: GLint; ctlarray: PGLfloat; sorder, torder: GLint; atype: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluLoadSamplingMatrices: procedure(nobj: PGLUnurbs; const modelMatrix, projMatrix: T16dArray; viewport: TViewPortArray); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluNurbsProperty: procedure(nobj: PGLUnurbs; aproperty: GLenum; value: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluGetNurbsProperty: procedure(nobj: PGLUnurbs; aproperty: GLenum; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluNurbsCallback: procedure(nobj: PGLUnurbs; which: GLenum; fn: TCallBack); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -(**** Callback function prototypes ****) - -type - // gluQuadricCallback - GLUquadricErrorProc = procedure(p: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - - // gluTessCallback - GLUtessBeginProc = procedure(p: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - GLUtessEdgeFlagProc = procedure(p: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - GLUtessVertexProc = procedure(p: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - GLUtessEndProc = procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - GLUtessErrorProc = procedure(p: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - GLUtessCombineProc = procedure(p1: T3dArray; p2: T4pArray; p3: T4fArray; p4: PPointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - GLUtessBeginDataProc = procedure(p1: GLenum; p2: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - GLUtessEdgeFlagDataProc = procedure(p1: GLboolean; p2: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - GLUtessVertexDataProc = procedure(p1, p2: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - GLUtessEndDataProc = procedure(p: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - GLUtessErrorDataProc = procedure(p1: GLenum; p2: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - GLUtessCombineDataProc = procedure(p1: T3dArray; p2: T4pArray; p3: T4fArray; - p4: PPointer; p5: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - - // gluNurbsCallback - GLUnurbsErrorProc = procedure(p: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - - -//*** Generic constants ****/ - -const - // Version - GLU_VERSION_1_1 = 1; - GLU_VERSION_1_2 = 1; - - // Errors: (return value 0 = no error) - GLU_INVALID_ENUM = 100900; - GLU_INVALID_VALUE = 100901; - GLU_OUT_OF_MEMORY = 100902; - GLU_INCOMPATIBLE_GL_VERSION = 100903; - - // StringName - GLU_VERSION = 100800; - GLU_EXTENSIONS = 100801; - - // Boolean - GLU_TRUE = GL_TRUE; - GLU_FALSE = GL_FALSE; - - - //*** Quadric constants ****/ - - // QuadricNormal - GLU_SMOOTH = 100000; - GLU_FLAT = 100001; - GLU_NONE = 100002; - - // QuadricDrawStyle - GLU_POINT = 100010; - GLU_LINE = 100011; - GLU_FILL = 100012; - GLU_SILHOUETTE = 100013; - - // QuadricOrientation - GLU_OUTSIDE = 100020; - GLU_INSIDE = 100021; - - // Callback types: - // GLU_ERROR = 100103; - - - //*** Tesselation constants ****/ - - GLU_TESS_MAX_COORD = 1.0e150; - - // TessProperty - GLU_TESS_WINDING_RULE = 100140; - GLU_TESS_BOUNDARY_ONLY = 100141; - GLU_TESS_TOLERANCE = 100142; - - // TessWinding - GLU_TESS_WINDING_ODD = 100130; - GLU_TESS_WINDING_NONZERO = 100131; - GLU_TESS_WINDING_POSITIVE = 100132; - GLU_TESS_WINDING_NEGATIVE = 100133; - GLU_TESS_WINDING_ABS_GEQ_TWO = 100134; - - // TessCallback - GLU_TESS_BEGIN = 100100; // void (CALLBACK*)(GLenum type) - GLU_TESS_VERTEX = 100101; // void (CALLBACK*)(void *data) - GLU_TESS_END = 100102; // void (CALLBACK*)(void) - GLU_TESS_ERROR = 100103; // void (CALLBACK*)(GLenum errno) - GLU_TESS_EDGE_FLAG = 100104; // void (CALLBACK*)(GLboolean boundaryEdge) - GLU_TESS_COMBINE = 100105; { void (CALLBACK*)(GLdouble coords[3], - void *data[4], - GLfloat weight[4], - void **dataOut) } - GLU_TESS_BEGIN_DATA = 100106; { void (CALLBACK*)(GLenum type, - void *polygon_data) } - GLU_TESS_VERTEX_DATA = 100107; { void (CALLBACK*)(void *data, - void *polygon_data) } - GLU_TESS_END_DATA = 100108; // void (CALLBACK*)(void *polygon_data) - GLU_TESS_ERROR_DATA = 100109; { void (CALLBACK*)(GLenum errno, - void *polygon_data) } - GLU_TESS_EDGE_FLAG_DATA = 100110; { void (CALLBACK*)(GLboolean boundaryEdge, - void *polygon_data) } - GLU_TESS_COMBINE_DATA = 100111; { void (CALLBACK*)(GLdouble coords[3], - void *data[4], - GLfloat weight[4], - void **dataOut, - void *polygon_data) } - - // TessError - GLU_TESS_ERROR1 = 100151; - GLU_TESS_ERROR2 = 100152; - GLU_TESS_ERROR3 = 100153; - GLU_TESS_ERROR4 = 100154; - GLU_TESS_ERROR5 = 100155; - GLU_TESS_ERROR6 = 100156; - GLU_TESS_ERROR7 = 100157; - GLU_TESS_ERROR8 = 100158; - - GLU_TESS_MISSING_BEGIN_POLYGON = GLU_TESS_ERROR1; - GLU_TESS_MISSING_BEGIN_CONTOUR = GLU_TESS_ERROR2; - GLU_TESS_MISSING_END_POLYGON = GLU_TESS_ERROR3; - GLU_TESS_MISSING_END_CONTOUR = GLU_TESS_ERROR4; - GLU_TESS_COORD_TOO_LARGE = GLU_TESS_ERROR5; - GLU_TESS_NEED_COMBINE_CALLBACK = GLU_TESS_ERROR6; - - //*** NURBS constants ****/ - - // NurbsProperty - GLU_AUTO_LOAD_MATRIX = 100200; - GLU_CULLING = 100201; - GLU_SAMPLING_TOLERANCE = 100203; - GLU_DISPLAY_MODE = 100204; - GLU_PARAMETRIC_TOLERANCE = 100202; - GLU_SAMPLING_METHOD = 100205; - GLU_U_STEP = 100206; - GLU_V_STEP = 100207; - - // NurbsSampling - GLU_PATH_LENGTH = 100215; - GLU_PARAMETRIC_ERROR = 100216; - GLU_DOMAIN_DISTANCE = 100217; - - - // NurbsTrim - GLU_MAP1_TRIM_2 = 100210; - GLU_MAP1_TRIM_3 = 100211; - - // NurbsDisplay - // GLU_FILL = 100012; - GLU_OUTLINE_POLYGON = 100240; - GLU_OUTLINE_PATCH = 100241; - - // NurbsCallback - // GLU_ERROR = 100103; - - // NurbsErrors - GLU_NURBS_ERROR1 = 100251; - GLU_NURBS_ERROR2 = 100252; - GLU_NURBS_ERROR3 = 100253; - GLU_NURBS_ERROR4 = 100254; - GLU_NURBS_ERROR5 = 100255; - GLU_NURBS_ERROR6 = 100256; - GLU_NURBS_ERROR7 = 100257; - GLU_NURBS_ERROR8 = 100258; - GLU_NURBS_ERROR9 = 100259; - GLU_NURBS_ERROR10 = 100260; - GLU_NURBS_ERROR11 = 100261; - GLU_NURBS_ERROR12 = 100262; - GLU_NURBS_ERROR13 = 100263; - GLU_NURBS_ERROR14 = 100264; - GLU_NURBS_ERROR15 = 100265; - GLU_NURBS_ERROR16 = 100266; - GLU_NURBS_ERROR17 = 100267; - GLU_NURBS_ERROR18 = 100268; - GLU_NURBS_ERROR19 = 100269; - GLU_NURBS_ERROR20 = 100270; - GLU_NURBS_ERROR21 = 100271; - GLU_NURBS_ERROR22 = 100272; - GLU_NURBS_ERROR23 = 100273; - GLU_NURBS_ERROR24 = 100274; - GLU_NURBS_ERROR25 = 100275; - GLU_NURBS_ERROR26 = 100276; - GLU_NURBS_ERROR27 = 100277; - GLU_NURBS_ERROR28 = 100278; - GLU_NURBS_ERROR29 = 100279; - GLU_NURBS_ERROR30 = 100280; - GLU_NURBS_ERROR31 = 100281; - GLU_NURBS_ERROR32 = 100282; - GLU_NURBS_ERROR33 = 100283; - GLU_NURBS_ERROR34 = 100284; - GLU_NURBS_ERROR35 = 100285; - GLU_NURBS_ERROR36 = 100286; - GLU_NURBS_ERROR37 = 100287; - -//*** Backwards compatibility for old tesselator ****/ - -var - gluBeginPolygon: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluNextContour: procedure(tess: PGLUtesselator; atype: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluEndPolygon: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -const - // Contours types -- obsolete! - GLU_CW = 100120; - GLU_CCW = 100121; - GLU_INTERIOR = 100122; - GLU_EXTERIOR = 100123; - GLU_UNKNOWN = 100124; - - // Names without "TESS_" prefix - GLU_BEGIN = GLU_TESS_BEGIN; - GLU_VERTEX = GLU_TESS_VERTEX; - GLU_END = GLU_TESS_END; - GLU_ERROR = GLU_TESS_ERROR; - GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG; - -procedure LoadGLu(const dll: PChar); -procedure FreeGLu; - -implementation - -var - LibGlu: TModuleHandle; - -procedure FreeGLu; -begin - - @gluErrorString := nil; - @gluErrorUnicodeStringEXT := nil; - @gluGetString := nil; - @gluOrtho2D := nil; - @gluPerspective := nil; - @gluPickMatrix := nil; - @gluLookAt := nil; - @gluProject := nil; - @gluUnProject := nil; - @gluScaleImage := nil; - @gluBuild1DMipmaps := nil; - @gluBuild2DMipmaps := nil; - @gluNewQuadric := nil; - @gluDeleteQuadric := nil; - @gluQuadricNormals := nil; - @gluQuadricTexture := nil; - @gluQuadricOrientation := nil; - @gluQuadricDrawStyle := nil; - @gluCylinder := nil; - @gluDisk := nil; - @gluPartialDisk := nil; - @gluSphere := nil; - @gluQuadricCallback := nil; - @gluNewTess := nil; - @gluDeleteTess := nil; - @gluTessBeginPolygon := nil; - @gluTessBeginContour := nil; - @gluTessVertex := nil; - @gluTessEndContour := nil; - @gluTessEndPolygon := nil; - @gluTessProperty := nil; - @gluTessNormal := nil; - @gluTessCallback := nil; - @gluGetTessProperty := nil; - @gluNewNurbsRenderer := nil; - @gluDeleteNurbsRenderer := nil; - @gluBeginSurface := nil; - @gluBeginCurve := nil; - @gluEndCurve := nil; - @gluEndSurface := nil; - @gluBeginTrim := nil; - @gluEndTrim := nil; - @gluPwlCurve := nil; - @gluNurbsCurve := nil; - @gluNurbsSurface := nil; - @gluLoadSamplingMatrices := nil; - @gluNurbsProperty := nil; - @gluGetNurbsProperty := nil; - @gluNurbsCallback := nil; - @gluBeginPolygon := nil; - @gluNextContour := nil; - @gluEndPolygon := nil; - - UnLoadModule(LibGlu); - -end; - -procedure LoadGLu(const dll: PChar); -begin - - FreeGLu; - - if LoadModule( LibGlu, dll ) then - begin - @gluErrorString := GetModuleSymbol(LibGlu, 'gluErrorString'); - @gluErrorUnicodeStringEXT := GetModuleSymbol(LibGlu, 'gluErrorUnicodeStringEXT'); - @gluGetString := GetModuleSymbol(LibGlu, 'gluGetString'); - @gluOrtho2D := GetModuleSymbol(LibGlu, 'gluOrtho2D'); - @gluPerspective := GetModuleSymbol(LibGlu, 'gluPerspective'); - @gluPickMatrix := GetModuleSymbol(LibGlu, 'gluPickMatrix'); - @gluLookAt := GetModuleSymbol(LibGlu, 'gluLookAt'); - @gluProject := GetModuleSymbol(LibGlu, 'gluProject'); - @gluUnProject := GetModuleSymbol(LibGlu, 'gluUnProject'); - @gluScaleImage := GetModuleSymbol(LibGlu, 'gluScaleImage'); - @gluBuild1DMipmaps := GetModuleSymbol(LibGlu, 'gluBuild1DMipmaps'); - @gluBuild2DMipmaps := GetModuleSymbol(LibGlu, 'gluBuild2DMipmaps'); - @gluNewQuadric := GetModuleSymbol(LibGlu, 'gluNewQuadric'); - @gluDeleteQuadric := GetModuleSymbol(LibGlu, 'gluDeleteQuadric'); - @gluQuadricNormals := GetModuleSymbol(LibGlu, 'gluQuadricNormals'); - @gluQuadricTexture := GetModuleSymbol(LibGlu, 'gluQuadricTexture'); - @gluQuadricOrientation := GetModuleSymbol(LibGlu, 'gluQuadricOrientation'); - @gluQuadricDrawStyle := GetModuleSymbol(LibGlu, 'gluQuadricDrawStyle'); - @gluCylinder := GetModuleSymbol(LibGlu, 'gluCylinder'); - @gluDisk := GetModuleSymbol(LibGlu, 'gluDisk'); - @gluPartialDisk := GetModuleSymbol(LibGlu, 'gluPartialDisk'); - @gluSphere := GetModuleSymbol(LibGlu, 'gluSphere'); - @gluQuadricCallback := GetModuleSymbol(LibGlu, 'gluQuadricCallback'); - @gluNewTess := GetModuleSymbol(LibGlu, 'gluNewTess'); - @gluDeleteTess := GetModuleSymbol(LibGlu, 'gluDeleteTess'); - @gluTessBeginPolygon := GetModuleSymbol(LibGlu, 'gluTessBeginPolygon'); - @gluTessBeginContour := GetModuleSymbol(LibGlu, 'gluTessBeginContour'); - @gluTessVertex := GetModuleSymbol(LibGlu, 'gluTessVertex'); - @gluTessEndContour := GetModuleSymbol(LibGlu, 'gluTessEndContour'); - @gluTessEndPolygon := GetModuleSymbol(LibGlu, 'gluTessEndPolygon'); - @gluTessProperty := GetModuleSymbol(LibGlu, 'gluTessProperty'); - @gluTessNormal := GetModuleSymbol(LibGlu, 'gluTessNormal'); - @gluTessCallback := GetModuleSymbol(LibGlu, 'gluTessCallback'); - @gluGetTessProperty := GetModuleSymbol(LibGlu, 'gluGetTessProperty'); - @gluNewNurbsRenderer := GetModuleSymbol(LibGlu, 'gluNewNurbsRenderer'); - @gluDeleteNurbsRenderer := GetModuleSymbol(LibGlu, 'gluDeleteNurbsRenderer'); - @gluBeginSurface := GetModuleSymbol(LibGlu, 'gluBeginSurface'); - @gluBeginCurve := GetModuleSymbol(LibGlu, 'gluBeginCurve'); - @gluEndCurve := GetModuleSymbol(LibGlu, 'gluEndCurve'); - @gluEndSurface := GetModuleSymbol(LibGlu, 'gluEndSurface'); - @gluBeginTrim := GetModuleSymbol(LibGlu, 'gluBeginTrim'); - @gluEndTrim := GetModuleSymbol(LibGlu, 'gluEndTrim'); - @gluPwlCurve := GetModuleSymbol(LibGlu, 'gluPwlCurve'); - @gluNurbsCurve := GetModuleSymbol(LibGlu, 'gluNurbsCurve'); - @gluNurbsSurface := GetModuleSymbol(LibGlu, 'gluNurbsSurface'); - @gluLoadSamplingMatrices := GetModuleSymbol(LibGlu, 'gluLoadSamplingMatrices'); - @gluNurbsProperty := GetModuleSymbol(LibGlu, 'gluNurbsProperty'); - @gluGetNurbsProperty := GetModuleSymbol(LibGlu, 'gluGetNurbsProperty'); - @gluNurbsCallback := GetModuleSymbol(LibGlu, 'gluNurbsCallback'); - - @gluBeginPolygon := GetModuleSymbol(LibGlu, 'gluBeginPolygon'); - @gluNextContour := GetModuleSymbol(LibGlu, 'gluNextContour'); - @gluEndPolygon := GetModuleSymbol(LibGlu, 'gluEndPolygon'); - end; -end; - -initialization - - LoadGLu( GLuLibName ); - -finalization - - FreeGLu; - -end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glut.pas b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glut.pas deleted file mode 100644 index 2a882a20..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glut.pas +++ /dev/null @@ -1,682 +0,0 @@ -unit glut; -{ - $Id: glut.pas,v 1.2 2004/08/14 22:54:30 savage Exp $ - - Adaption of the delphi3d.net OpenGL units to FreePascal - Sebastian Guenther (sg@freepascal.org) in 2002 - These units are free to use -} - -// Copyright (c) Mark J. Kilgard, 1994, 1995, 1996. */ - -(* This program is freely distributable without licensing fees and is - provided without guarantee or warrantee expressed or implied. This - program is -not- in the public domain. *) - -{******************************************************************************} -{ } -{ Converted to Delphi by Tom Nuydens (tom@delphi3d.net) } -{ For the latest updates, visit Delphi3D: http://www.delphi3d.net } -{ } -{ Modified for Delphi/Kylix and FreePascal } -{ by Dominique Louis ( Dominique@Savagesoftware.com.au) } -{ For the latest updates, visit JEDI-SDL : http://www.sf.net/projects/jedi-sdl } -{ } -{******************************************************************************} - -{ - $Log: glut.pas,v $ - Revision 1.2 2004/08/14 22:54:30 savage - Updated so that Library name defines are correctly defined for MacOS X. - - Revision 1.1 2004/03/30 21:53:54 savage - Moved to it's own folder. - - Revision 1.5 2004/02/20 17:09:55 savage - Code tidied up in gl, glu and glut, while extensions in glext.pas are now loaded using SDL_GL_GetProcAddress, thus making it more cross-platform compatible, but now more tied to SDL. - - Revision 1.4 2004/02/14 22:36:29 savage - Fixed inconsistencies of using LoadLibrary and LoadModule. - Now all units make use of LoadModule rather than LoadLibrary and other dynamic proc procedures. - - Revision 1.3 2004/02/14 00:23:39 savage - As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. - - Revision 1.2 2004/02/14 00:09:19 savage - Changed uses to now make use of moduleloader.pas rather than dllfuncs.pas - - Revision 1.1 2004/02/05 00:08:19 savage - Module 1.0 release - - Revision 1.4 2003/06/02 12:32:13 savage - Modified Sources to avoid warnings with Delphi by moving CVS Logging to the top of the header files. Hopefully CVS Logging still works. - -} - -interface - -{$I jedi-sdl.inc} - -uses -{$IFDEF __GPC__} - system, - gpc, -{$ENDIF} - -{$IFDEF WIN32} - Windows, -{$ENDIF} - moduleloader, - gl; - -type - {$IFNDEF __GPC__} - PInteger = ^Integer; - PPChar = ^PChar; - {$ENDIF} - TGlutVoidCallback = procedure; {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} - TGlut1IntCallback = procedure(value: Integer); {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} - TGlut2IntCallback = procedure(v1, v2: Integer); {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} - TGlut3IntCallback = procedure(v1, v2, v3: Integer); {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} - TGlut4IntCallback = procedure(v1, v2, v3, v4: Integer); {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} - TGlut1Char2IntCallback = procedure(c: Byte; v1, v2: Integer); {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} - -const -{$IFDEF WIN32} - GlutLibName = 'glut32.dll'; -{$ENDIF} - -{$IFDEF UNIX} -{$IFDEF DARWIN} - GlutLibName = 'libglut.dylib'; -{$ELSE} - GlutLibName = 'libglut.so'; -{$ENDIF} -{$ENDIF} - - GLUT_API_VERSION = 3; - GLUT_XLIB_IMPLEMENTATION = 12; - // Display mode bit masks. - GLUT_RGB = 0; - GLUT_RGBA = GLUT_RGB; - GLUT_INDEX = 1; - GLUT_SINGLE = 0; - GLUT_DOUBLE = 2; - GLUT_ACCUM = 4; - GLUT_ALPHA = 8; - GLUT_DEPTH = 16; - GLUT_STENCIL = 32; - GLUT_MULTISAMPLE = 128; - GLUT_STEREO = 256; - GLUT_LUMINANCE = 512; - - // Mouse buttons. - GLUT_LEFT_BUTTON = 0; - GLUT_MIDDLE_BUTTON = 1; - GLUT_RIGHT_BUTTON = 2; - - // Mouse button state. - GLUT_DOWN = 0; - GLUT_UP = 1; - - // function keys - GLUT_KEY_F1 = 1; - GLUT_KEY_F2 = 2; - GLUT_KEY_F3 = 3; - GLUT_KEY_F4 = 4; - GLUT_KEY_F5 = 5; - GLUT_KEY_F6 = 6; - GLUT_KEY_F7 = 7; - GLUT_KEY_F8 = 8; - GLUT_KEY_F9 = 9; - GLUT_KEY_F10 = 10; - GLUT_KEY_F11 = 11; - GLUT_KEY_F12 = 12; - // directional keys - GLUT_KEY_LEFT = 100; - GLUT_KEY_UP = 101; - GLUT_KEY_RIGHT = 102; - GLUT_KEY_DOWN = 103; - GLUT_KEY_PAGE_UP = 104; - GLUT_KEY_PAGE_DOWN = 105; - GLUT_KEY_HOME = 106; - GLUT_KEY_END = 107; - GLUT_KEY_INSERT = 108; - - // Entry/exit state. - GLUT_LEFT = 0; - GLUT_ENTERED = 1; - - // Menu usage state. - GLUT_MENU_NOT_IN_USE = 0; - GLUT_MENU_IN_USE = 1; - - // Visibility state. - GLUT_NOT_VISIBLE = 0; - GLUT_VISIBLE = 1; - - // Window status state. - GLUT_HIDDEN = 0; - GLUT_FULLY_RETAINED = 1; - GLUT_PARTIALLY_RETAINED = 2; - GLUT_FULLY_COVERED = 3; - - // Color index component selection values. - GLUT_RED = 0; - GLUT_GREEN = 1; - GLUT_BLUE = 2; - - // Layers for use. - GLUT_NORMAL = 0; - GLUT_OVERLAY = 1; - - // Stroke font constants (use these in GLUT program). - GLUT_STROKE_ROMAN = Pointer(0); - GLUT_STROKE_MONO_ROMAN = Pointer(1); - - // Bitmap font constants (use these in GLUT program). - GLUT_BITMAP_9_BY_15 = Pointer(2); - GLUT_BITMAP_8_BY_13 = Pointer(3); - GLUT_BITMAP_TIMES_ROMAN_10 = Pointer(4); - GLUT_BITMAP_TIMES_ROMAN_24 = Pointer(5); - GLUT_BITMAP_HELVETICA_10 = Pointer(6); - GLUT_BITMAP_HELVETICA_12 = Pointer(7); - GLUT_BITMAP_HELVETICA_18 = Pointer(8); - - // glutGet parameters. - GLUT_WINDOW_X = 100; - GLUT_WINDOW_Y = 101; - GLUT_WINDOW_WIDTH = 102; - GLUT_WINDOW_HEIGHT = 103; - GLUT_WINDOW_BUFFER_SIZE = 104; - GLUT_WINDOW_STENCIL_SIZE = 105; - GLUT_WINDOW_DEPTH_SIZE = 106; - GLUT_WINDOW_RED_SIZE = 107; - GLUT_WINDOW_GREEN_SIZE = 108; - GLUT_WINDOW_BLUE_SIZE = 109; - GLUT_WINDOW_ALPHA_SIZE = 110; - GLUT_WINDOW_ACCUM_RED_SIZE = 111; - GLUT_WINDOW_ACCUM_GREEN_SIZE = 112; - GLUT_WINDOW_ACCUM_BLUE_SIZE = 113; - GLUT_WINDOW_ACCUM_ALPHA_SIZE = 114; - GLUT_WINDOW_DOUBLEBUFFER = 115; - GLUT_WINDOW_RGBA = 116; - GLUT_WINDOW_PARENT = 117; - GLUT_WINDOW_NUM_CHILDREN = 118; - GLUT_WINDOW_COLORMAP_SIZE = 119; - GLUT_WINDOW_NUM_SAMPLES = 120; - GLUT_WINDOW_STEREO = 121; - GLUT_WINDOW_CURSOR = 122; - GLUT_SCREEN_WIDTH = 200; - GLUT_SCREEN_HEIGHT = 201; - GLUT_SCREEN_WIDTH_MM = 202; - GLUT_SCREEN_HEIGHT_MM = 203; - GLUT_MENU_NUM_ITEMS = 300; - GLUT_DISPLAY_MODE_POSSIBLE = 400; - GLUT_INIT_WINDOW_X = 500; - GLUT_INIT_WINDOW_Y = 501; - GLUT_INIT_WINDOW_WIDTH = 502; - GLUT_INIT_WINDOW_HEIGHT = 503; - GLUT_INIT_DISPLAY_MODE = 504; - GLUT_ELAPSED_TIME = 700; - - // glutDeviceGet parameters. - GLUT_HAS_KEYBOARD = 600; - GLUT_HAS_MOUSE = 601; - GLUT_HAS_SPACEBALL = 602; - GLUT_HAS_DIAL_AND_BUTTON_BOX = 603; - GLUT_HAS_TABLET = 604; - GLUT_NUM_MOUSE_BUTTONS = 605; - GLUT_NUM_SPACEBALL_BUTTONS = 606; - GLUT_NUM_BUTTON_BOX_BUTTONS = 607; - GLUT_NUM_DIALS = 608; - GLUT_NUM_TABLET_BUTTONS = 609; - - // glutLayerGet parameters. - GLUT_OVERLAY_POSSIBLE = 800; - GLUT_LAYER_IN_USE = 801; - GLUT_HAS_OVERLAY = 802; - GLUT_TRANSPARENT_INDEX = 803; - GLUT_NORMAL_DAMAGED = 804; - GLUT_OVERLAY_DAMAGED = 805; - - // glutVideoResizeGet parameters. - GLUT_VIDEO_RESIZE_POSSIBLE = 900; - GLUT_VIDEO_RESIZE_IN_USE = 901; - GLUT_VIDEO_RESIZE_X_DELTA = 902; - GLUT_VIDEO_RESIZE_Y_DELTA = 903; - GLUT_VIDEO_RESIZE_WIDTH_DELTA = 904; - GLUT_VIDEO_RESIZE_HEIGHT_DELTA = 905; - GLUT_VIDEO_RESIZE_X = 906; - GLUT_VIDEO_RESIZE_Y = 907; - GLUT_VIDEO_RESIZE_WIDTH = 908; - GLUT_VIDEO_RESIZE_HEIGHT = 909; - - // glutGetModifiers return mask. - GLUT_ACTIVE_SHIFT = 1; - GLUT_ACTIVE_CTRL = 2; - GLUT_ACTIVE_ALT = 4; - - // glutSetCursor parameters. - // Basic arrows. - GLUT_CURSOR_RIGHT_ARROW = 0; - GLUT_CURSOR_LEFT_ARROW = 1; - // Symbolic cursor shapes. - GLUT_CURSOR_INFO = 2; - GLUT_CURSOR_DESTROY = 3; - GLUT_CURSOR_HELP = 4; - GLUT_CURSOR_CYCLE = 5; - GLUT_CURSOR_SPRAY = 6; - GLUT_CURSOR_WAIT = 7; - GLUT_CURSOR_TEXT = 8; - GLUT_CURSOR_CROSSHAIR = 9; - // Directional cursors. - GLUT_CURSOR_UP_DOWN = 10; - GLUT_CURSOR_LEFT_RIGHT = 11; - // Sizing cursors. - GLUT_CURSOR_TOP_SIDE = 12; - GLUT_CURSOR_BOTTOM_SIDE = 13; - GLUT_CURSOR_LEFT_SIDE = 14; - GLUT_CURSOR_RIGHT_SIDE = 15; - GLUT_CURSOR_TOP_LEFT_CORNER = 16; - GLUT_CURSOR_TOP_RIGHT_CORNER = 17; - GLUT_CURSOR_BOTTOM_RIGHT_CORNER = 18; - GLUT_CURSOR_BOTTOM_LEFT_CORNER = 19; - // Inherit from parent window. - GLUT_CURSOR_INHERIT = 100; - // Blank cursor. - GLUT_CURSOR_NONE = 101; - // Fullscreen crosshair (if available). - GLUT_CURSOR_FULL_CROSSHAIR = 102; - - // GLUT game mode sub-API. - // glutGameModeGet. - GLUT_GAME_MODE_ACTIVE = 0; - GLUT_GAME_MODE_POSSIBLE = 1; - GLUT_GAME_MODE_WIDTH = 2; - GLUT_GAME_MODE_HEIGHT = 3; - GLUT_GAME_MODE_PIXEL_DEPTH = 4; - GLUT_GAME_MODE_REFRESH_RATE = 5; - GLUT_GAME_MODE_DISPLAY_CHANGED = 6; - -var -// GLUT initialization sub-API. - glutInit: procedure(argcp: PInteger; argv: PPChar); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutInitDisplayMode: procedure(mode: Word); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutInitDisplayString: procedure(const str: PChar); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutInitWindowPosition: procedure(x, y: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutInitWindowSize: procedure(width, height: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutMainLoop: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -// GLUT window sub-API. - glutCreateWindow: function(const title: PChar): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutCreateSubWindow: function(win, x, y, width, height: Integer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutDestroyWindow: procedure(win: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutPostRedisplay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutPostWindowRedisplay: procedure(win: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSwapBuffers: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutGetWindow: function: Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSetWindow: procedure(win: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSetWindowTitle: procedure(const title: PChar); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSetIconTitle: procedure(const title: PChar); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutPositionWindow: procedure(x, y: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutReshapeWindow: procedure(width, height: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutPopWindow: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutPushWindow: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutIconifyWindow: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutShowWindow: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutHideWindow: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutFullScreen: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSetCursor: procedure(cursor: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutWarpPointer: procedure(x, y: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -// GLUT overlay sub-API. - glutEstablishOverlay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutRemoveOverlay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutUseLayer: procedure(layer: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutPostOverlayRedisplay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutPostWindowOverlayRedisplay: procedure(win: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutShowOverlay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutHideOverlay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -// GLUT menu sub-API. - glutCreateMenu: function(callback: TGlut1IntCallback): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutDestroyMenu: procedure(menu: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutGetMenu: function: Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSetMenu: procedure(menu: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutAddMenuEntry: procedure(const caption: PChar; value: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutAddSubMenu: procedure(const caption: PChar; submenu: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutChangeToMenuEntry: procedure(item: Integer; const caption: PChar; value: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutChangeToSubMenu: procedure(item: Integer; const caption: PChar; submenu: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutRemoveMenuItem: procedure(item: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutAttachMenu: procedure(button: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutDetachMenu: procedure(button: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -// GLUTsub-API. - glutDisplayFunc: procedure(f: TGlutVoidCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutReshapeFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutKeyboardFunc: procedure(f: TGlut1Char2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutMouseFunc: procedure(f: TGlut4IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutMotionFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutPassiveMotionFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutEntryFunc: procedure(f: TGlut1IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutVisibilityFunc: procedure(f: TGlut1IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutIdleFunc: procedure(f: TGlutVoidCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutTimerFunc: procedure(millis: Word; f: TGlut1IntCallback; value: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutMenuStateFunc: procedure(f: TGlut1IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSpecialFunc: procedure(f: TGlut3IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSpaceballMotionFunc: procedure(f: TGlut3IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSpaceballRotateFunc: procedure(f: TGlut3IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSpaceballButtonFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutButtonBoxFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutDialsFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutTabletMotionFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutTabletButtonFunc: procedure(f: TGlut4IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutMenuStatusFunc: procedure(f: TGlut3IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutOverlayDisplayFunc: procedure(f:TGlutVoidCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutWindowStatusFunc: procedure(f: TGlut1IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -// GLUT color index sub-API. - glutSetColor: procedure(cell: Integer; red, green, blue: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutGetColor: function(ndx, component: Integer): GLfloat; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutCopyColormap: procedure(win: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -// GLUT state retrieval sub-API. - glutGet: function(t: GLenum): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutDeviceGet: function(t: GLenum): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -// GLUT extension support sub-API - glutExtensionSupported: function(const name: PChar): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutGetModifiers: function: Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutLayerGet: function(t: GLenum): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -// GLUT font sub-API - glutBitmapCharacter: procedure(font : pointer; character: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutBitmapWidth: function(font : pointer; character: Integer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutStrokeCharacter: procedure(font : pointer; character: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutStrokeWidth: function(font : pointer; character: Integer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutBitmapLength: function(font: pointer; const str: PChar): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutStrokeLength: function(font: pointer; const str: PChar): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -// GLUT pre-built models sub-API - glutWireSphere: procedure(radius: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSolidSphere: procedure(radius: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutWireCone: procedure(base, height: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSolidCone: procedure(base, height: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutWireCube: procedure(size: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSolidCube: procedure(size: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutWireTorus: procedure(innerRadius, outerRadius: GLdouble; sides, rings: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSolidTorus: procedure(innerRadius, outerRadius: GLdouble; sides, rings: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutWireDodecahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSolidDodecahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutWireTeapot: procedure(size: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSolidTeapot: procedure(size: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutWireOctahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSolidOctahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutWireTetrahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSolidTetrahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutWireIcosahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSolidIcosahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -// GLUT video resize sub-API. - glutVideoResizeGet: function(param: GLenum): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSetupVideoResizing: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutStopVideoResizing: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutVideoResize: procedure(x, y, width, height: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutVideoPan: procedure(x, y, width, height: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -// GLUT debugging sub-API. - glutReportErrors: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -var - //example glutGameModeString('1280x1024:32@75'); - glutGameModeString : procedure (const AString : PChar); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutEnterGameMode : function : integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutLeaveGameMode : procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutGameModeGet : function (mode : GLenum) : integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - -procedure LoadGlut(const dll: PChar); -procedure FreeGlut; - -implementation - -var - LibGLUT : TModuleHandle; - -procedure FreeGlut; -begin - - UnLoadModule( LibGLUT ); - - @glutInit := nil; - @glutInitDisplayMode := nil; - @glutInitDisplayString := nil; - @glutInitWindowPosition := nil; - @glutInitWindowSize := nil; - @glutMainLoop := nil; - @glutCreateWindow := nil; - @glutCreateSubWindow := nil; - @glutDestroyWindow := nil; - @glutPostRedisplay := nil; - @glutPostWindowRedisplay := nil; - @glutSwapBuffers := nil; - @glutGetWindow := nil; - @glutSetWindow := nil; - @glutSetWindowTitle := nil; - @glutSetIconTitle := nil; - @glutPositionWindow := nil; - @glutReshapeWindow := nil; - @glutPopWindow := nil; - @glutPushWindow := nil; - @glutIconifyWindow := nil; - @glutShowWindow := nil; - @glutHideWindow := nil; - @glutFullScreen := nil; - @glutSetCursor := nil; - @glutWarpPointer := nil; - @glutEstablishOverlay := nil; - @glutRemoveOverlay := nil; - @glutUseLayer := nil; - @glutPostOverlayRedisplay := nil; - @glutPostWindowOverlayRedisplay := nil; - @glutShowOverlay := nil; - @glutHideOverlay := nil; - @glutCreateMenu := nil; - @glutDestroyMenu := nil; - @glutGetMenu := nil; - @glutSetMenu := nil; - @glutAddMenuEntry := nil; - @glutAddSubMenu := nil; - @glutChangeToMenuEntry := nil; - @glutChangeToSubMenu := nil; - @glutRemoveMenuItem := nil; - @glutAttachMenu := nil; - @glutDetachMenu := nil; - @glutDisplayFunc := nil; - @glutReshapeFunc := nil; - @glutKeyboardFunc := nil; - @glutMouseFunc := nil; - @glutMotionFunc := nil; - @glutPassiveMotionFunc := nil; - @glutEntryFunc := nil; - @glutVisibilityFunc := nil; - @glutIdleFunc := nil; - @glutTimerFunc := nil; - @glutMenuStateFunc := nil; - @glutSpecialFunc := nil; - @glutSpaceballMotionFunc := nil; - @glutSpaceballRotateFunc := nil; - @glutSpaceballButtonFunc := nil; - @glutButtonBoxFunc := nil; - @glutDialsFunc := nil; - @glutTabletMotionFunc := nil; - @glutTabletButtonFunc := nil; - @glutMenuStatusFunc := nil; - @glutOverlayDisplayFunc := nil; - @glutWindowStatusFunc := nil; - @glutSetColor := nil; - @glutGetColor := nil; - @glutCopyColormap := nil; - @glutGet := nil; - @glutDeviceGet := nil; - @glutExtensionSupported := nil; - @glutGetModifiers := nil; - @glutLayerGet := nil; - @glutBitmapCharacter := nil; - @glutBitmapWidth := nil; - @glutStrokeCharacter := nil; - @glutStrokeWidth := nil; - @glutBitmapLength := nil; - @glutStrokeLength := nil; - @glutWireSphere := nil; - @glutSolidSphere := nil; - @glutWireCone := nil; - @glutSolidCone := nil; - @glutWireCube := nil; - @glutSolidCube := nil; - @glutWireTorus := nil; - @glutSolidTorus := nil; - @glutWireDodecahedron := nil; - @glutSolidDodecahedron := nil; - @glutWireTeapot := nil; - @glutSolidTeapot := nil; - @glutWireOctahedron := nil; - @glutSolidOctahedron := nil; - @glutWireTetrahedron := nil; - @glutSolidTetrahedron := nil; - @glutWireIcosahedron := nil; - @glutSolidIcosahedron := nil; - @glutVideoResizeGet := nil; - @glutSetupVideoResizing := nil; - @glutStopVideoResizing := nil; - @glutVideoResize := nil; - @glutVideoPan := nil; - @glutReportErrors := nil; - -end; - -procedure LoadGlut(const dll: PChar); -begin - - FreeGlut; - - if LoadModule( LibGLUT, dll ) then - begin - @glutInit := GetModuleSymbol(LibGLUT, 'glutInit'); - @glutInitDisplayMode := GetModuleSymbol(LibGLUT, 'glutInitDisplayMode'); - @glutInitDisplayString := GetModuleSymbol(LibGLUT, 'glutInitDisplayString'); - @glutInitWindowPosition := GetModuleSymbol(LibGLUT, 'glutInitWindowPosition'); - @glutInitWindowSize := GetModuleSymbol(LibGLUT, 'glutInitWindowSize'); - @glutMainLoop := GetModuleSymbol(LibGLUT, 'glutMainLoop'); - @glutCreateWindow := GetModuleSymbol(LibGLUT, 'glutCreateWindow'); - @glutCreateSubWindow := GetModuleSymbol(LibGLUT, 'glutCreateSubWindow'); - @glutDestroyWindow := GetModuleSymbol(LibGLUT, 'glutDestroyWindow'); - @glutPostRedisplay := GetModuleSymbol(LibGLUT, 'glutPostRedisplay'); - @glutPostWindowRedisplay := GetModuleSymbol(LibGLUT, 'glutPostWindowRedisplay'); - @glutSwapBuffers := GetModuleSymbol(LibGLUT, 'glutSwapBuffers'); - @glutGetWindow := GetModuleSymbol(LibGLUT, 'glutGetWindow'); - @glutSetWindow := GetModuleSymbol(LibGLUT, 'glutSetWindow'); - @glutSetWindowTitle := GetModuleSymbol(LibGLUT, 'glutSetWindowTitle'); - @glutSetIconTitle := GetModuleSymbol(LibGLUT, 'glutSetIconTitle'); - @glutPositionWindow := GetModuleSymbol(LibGLUT, 'glutPositionWindow'); - @glutReshapeWindow := GetModuleSymbol(LibGLUT, 'glutReshapeWindow'); - @glutPopWindow := GetModuleSymbol(LibGLUT, 'glutPopWindow'); - @glutPushWindow := GetModuleSymbol(LibGLUT, 'glutPushWindow'); - @glutIconifyWindow := GetModuleSymbol(LibGLUT, 'glutIconifyWindow'); - @glutShowWindow := GetModuleSymbol(LibGLUT, 'glutShowWindow'); - @glutHideWindow := GetModuleSymbol(LibGLUT, 'glutHideWindow'); - @glutFullScreen := GetModuleSymbol(LibGLUT, 'glutFullScreen'); - @glutSetCursor := GetModuleSymbol(LibGLUT, 'glutSetCursor'); - @glutWarpPointer := GetModuleSymbol(LibGLUT, 'glutWarpPointer'); - @glutEstablishOverlay := GetModuleSymbol(LibGLUT, 'glutEstablishOverlay'); - @glutRemoveOverlay := GetModuleSymbol(LibGLUT, 'glutRemoveOverlay'); - @glutUseLayer := GetModuleSymbol(LibGLUT, 'glutUseLayer'); - @glutPostOverlayRedisplay := GetModuleSymbol(LibGLUT, 'glutPostOverlayRedisplay'); - @glutPostWindowOverlayRedisplay := GetModuleSymbol(LibGLUT, 'glutPostWindowOverlayRedisplay'); - @glutShowOverlay := GetModuleSymbol(LibGLUT, 'glutShowOverlay'); - @glutHideOverlay := GetModuleSymbol(LibGLUT, 'glutHideOverlay'); - @glutCreateMenu := GetModuleSymbol(LibGLUT, 'glutCreateMenu'); - @glutDestroyMenu := GetModuleSymbol(LibGLUT, 'glutDestroyMenu'); - @glutGetMenu := GetModuleSymbol(LibGLUT, 'glutGetMenu'); - @glutSetMenu := GetModuleSymbol(LibGLUT, 'glutSetMenu'); - @glutAddMenuEntry := GetModuleSymbol(LibGLUT, 'glutAddMenuEntry'); - @glutAddSubMenu := GetModuleSymbol(LibGLUT, 'glutAddSubMenu'); - @glutChangeToMenuEntry := GetModuleSymbol(LibGLUT, 'glutChangeToMenuEntry'); - @glutChangeToSubMenu := GetModuleSymbol(LibGLUT, 'glutChangeToSubMenu'); - @glutRemoveMenuItem := GetModuleSymbol(LibGLUT, 'glutRemoveMenuItem'); - @glutAttachMenu := GetModuleSymbol(LibGLUT, 'glutAttachMenu'); - @glutDetachMenu := GetModuleSymbol(LibGLUT, 'glutDetachMenu'); - @glutDisplayFunc := GetModuleSymbol(LibGLUT, 'glutDisplayFunc'); - @glutReshapeFunc := GetModuleSymbol(LibGLUT, 'glutReshapeFunc'); - @glutKeyboardFunc := GetModuleSymbol(LibGLUT, 'glutKeyboardFunc'); - @glutMouseFunc := GetModuleSymbol(LibGLUT, 'glutMouseFunc'); - @glutMotionFunc := GetModuleSymbol(LibGLUT, 'glutMotionFunc'); - @glutPassiveMotionFunc := GetModuleSymbol(LibGLUT, 'glutPassiveMotionFunc'); - @glutEntryFunc := GetModuleSymbol(LibGLUT, 'glutEntryFunc'); - @glutVisibilityFunc := GetModuleSymbol(LibGLUT, 'glutVisibilityFunc'); - @glutIdleFunc := GetModuleSymbol(LibGLUT, 'glutIdleFunc'); - @glutTimerFunc := GetModuleSymbol(LibGLUT, 'glutTimerFunc'); - @glutMenuStateFunc := GetModuleSymbol(LibGLUT, 'glutMenuStateFunc'); - @glutSpecialFunc := GetModuleSymbol(LibGLUT, 'glutSpecialFunc'); - @glutSpaceballMotionFunc := GetModuleSymbol(LibGLUT, 'glutSpaceballMotionFunc'); - @glutSpaceballRotateFunc := GetModuleSymbol(LibGLUT, 'glutSpaceballRotateFunc'); - @glutSpaceballButtonFunc := GetModuleSymbol(LibGLUT, 'glutSpaceballButtonFunc'); - @glutButtonBoxFunc := GetModuleSymbol(LibGLUT, 'glutButtonBoxFunc'); - @glutDialsFunc := GetModuleSymbol(LibGLUT, 'glutDialsFunc'); - @glutTabletMotionFunc := GetModuleSymbol(LibGLUT, 'glutTabletMotionFunc'); - @glutTabletButtonFunc := GetModuleSymbol(LibGLUT, 'glutTabletButtonFunc'); - @glutMenuStatusFunc := GetModuleSymbol(LibGLUT, 'glutMenuStatusFunc'); - @glutOverlayDisplayFunc := GetModuleSymbol(LibGLUT, 'glutOverlayDisplayFunc'); - @glutWindowStatusFunc := GetModuleSymbol(LibGLUT, 'glutWindowStatusFunc'); - @glutSetColor := GetModuleSymbol(LibGLUT, 'glutSetColor'); - @glutGetColor := GetModuleSymbol(LibGLUT, 'glutGetColor'); - @glutCopyColormap := GetModuleSymbol(LibGLUT, 'glutCopyColormap'); - @glutGet := GetModuleSymbol(LibGLUT, 'glutGet'); - @glutDeviceGet := GetModuleSymbol(LibGLUT, 'glutDeviceGet'); - @glutExtensionSupported := GetModuleSymbol(LibGLUT, 'glutExtensionSupported'); - @glutGetModifiers := GetModuleSymbol(LibGLUT, 'glutGetModifiers'); - @glutLayerGet := GetModuleSymbol(LibGLUT, 'glutLayerGet'); - @glutBitmapCharacter := GetModuleSymbol(LibGLUT, 'glutBitmapCharacter'); - @glutBitmapWidth := GetModuleSymbol(LibGLUT, 'glutBitmapWidth'); - @glutStrokeCharacter := GetModuleSymbol(LibGLUT, 'glutStrokeCharacter'); - @glutStrokeWidth := GetModuleSymbol(LibGLUT, 'glutStrokeWidth'); - @glutBitmapLength := GetModuleSymbol(LibGLUT, 'glutBitmapLength'); - @glutStrokeLength := GetModuleSymbol(LibGLUT, 'glutStrokeLength'); - @glutWireSphere := GetModuleSymbol(LibGLUT, 'glutWireSphere'); - @glutSolidSphere := GetModuleSymbol(LibGLUT, 'glutSolidSphere'); - @glutWireCone := GetModuleSymbol(LibGLUT, 'glutWireCone'); - @glutSolidCone := GetModuleSymbol(LibGLUT, 'glutSolidCone'); - @glutWireCube := GetModuleSymbol(LibGLUT, 'glutWireCube'); - @glutSolidCube := GetModuleSymbol(LibGLUT, 'glutSolidCube'); - @glutWireTorus := GetModuleSymbol(LibGLUT, 'glutWireTorus'); - @glutSolidTorus := GetModuleSymbol(LibGLUT, 'glutSolidTorus'); - @glutWireDodecahedron := GetModuleSymbol(LibGLUT, 'glutWireDodecahedron'); - @glutSolidDodecahedron := GetModuleSymbol(LibGLUT, 'glutSolidDodecahedron'); - @glutWireTeapot := GetModuleSymbol(LibGLUT, 'glutWireTeapot'); - @glutSolidTeapot := GetModuleSymbol(LibGLUT, 'glutSolidTeapot'); - @glutWireOctahedron := GetModuleSymbol(LibGLUT, 'glutWireOctahedron'); - @glutSolidOctahedron := GetModuleSymbol(LibGLUT, 'glutSolidOctahedron'); - @glutWireTetrahedron := GetModuleSymbol(LibGLUT, 'glutWireTetrahedron'); - @glutSolidTetrahedron := GetModuleSymbol(LibGLUT, 'glutSolidTetrahedron'); - @glutWireIcosahedron := GetModuleSymbol(LibGLUT, 'glutWireIcosahedron'); - @glutSolidIcosahedron := GetModuleSymbol(LibGLUT, 'glutSolidIcosahedron'); - @glutVideoResizeGet := GetModuleSymbol(LibGLUT, 'glutVideoResizeGet'); - @glutSetupVideoResizing := GetModuleSymbol(LibGLUT, 'glutSetupVideoResizing'); - @glutStopVideoResizing := GetModuleSymbol(LibGLUT, 'glutStopVideoResizing'); - @glutVideoResize := GetModuleSymbol(LibGLUT, 'glutVideoResize'); - @glutVideoPan := GetModuleSymbol(LibGLUT, 'glutVideoPan'); - @glutReportErrors := GetModuleSymbol(LibGLUT, 'glutReportErrors'); - @glutGameModeString := GetModuleSymbol(LibGLUT, 'glutGameModeString'); - @glutEnterGameMode := GetModuleSymbol(LibGLUT, 'glutEnterGameMode'); - @glutLeaveGameMode := GetModuleSymbol(LibGLUT, 'glutLeaveGameMode'); - @glutGameModeGet := GetModuleSymbol(LibGLUT, 'glutGameModeGet'); - end; -end; - -initialization - LoadGlut( GlutLibName ); - -finalization - FreeGlut; - -end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glx.pas b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glx.pas deleted file mode 100644 index e478758f..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/glx.pas +++ /dev/null @@ -1,276 +0,0 @@ -unit glx; -{ - $Id: glx.pas,v 1.1 2004/03/30 21:53:55 savage Exp $ - - Translation of the Mesa GLX headers for FreePascal - Copyright (C) 1999 Sebastian Guenther - - - Mesa 3-D graphics library - Version: 3.0 - Copyright (C) 1995-1998 Brian Paul - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -} - -// {$MODE delphi} // objfpc would not work because of direct proc var assignments - -{You have to enable Macros (compiler switch "-Sm") for compiling this unit! - This is necessary for supporting different platforms with different calling - conventions via a single unit.} - -{ - $Log: glx.pas,v $ - Revision 1.1 2004/03/30 21:53:55 savage - Moved to it's own folder. - - Revision 1.5 2004/02/15 22:48:35 savage - More FPC and FreeBSD support changes. - - Revision 1.4 2004/02/14 22:36:29 savage - Fixed inconsistencies of using LoadLibrary and LoadModule. - Now all units make use of LoadModule rather than LoadLibrary and other dynamic proc procedures. - - Revision 1.3 2004/02/14 00:23:39 savage - As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. - - Revision 1.2 2004/02/14 00:09:19 savage - Changed uses to now make use of moduleloader.pas rather than dllfuncs.pas - - Revision 1.1 2004/02/05 00:08:19 savage - Module 1.0 release - - Revision 1.1 2003/05/11 13:18:03 savage - Newest OpenGL Headers For Delphi, Kylix and FPC - - Revision 1.1 2002/10/13 13:57:31 sg - * Finally, the new units are available: Match the C headers more closely; - support for OpenGL extensions, and much more. Based on the Delphi units - by Tom Nuydens of delphi3d.net - -} - -interface - -{$I jedi-sdl.inc} - -//{$MACRO ON} - -{$IFDEF UNIX} - uses - {$IFDEF FPC} - x, - xlib, - xutil; - {$ELSE} - xlib; - {$ENDIF} - {$DEFINE HasGLX} // Activate GLX stuff -{$ELSE} - {$MESSAGE Unsupported platform.} -{$ENDIF} - -{$IFNDEF HasGLX} - {$MESSAGE GLX not present on this platform.} -{$ENDIF} - - -// ======================================================= -// Unit specific extensions -// ======================================================= - -// Note: Requires that the GL library has already been initialized -function InitGLX: Boolean; - -var - GLXDumpUnresolvedFunctions, - GLXInitialized: Boolean; - - -// ======================================================= -// GLX consts, types and functions -// ======================================================= - -// Tokens for glXChooseVisual and glXGetConfig: -const - GLX_USE_GL = 1; - GLX_BUFFER_SIZE = 2; - GLX_LEVEL = 3; - GLX_RGBA = 4; - GLX_DOUBLEBUFFER = 5; - GLX_STEREO = 6; - GLX_AUX_BUFFERS = 7; - GLX_RED_SIZE = 8; - GLX_GREEN_SIZE = 9; - GLX_BLUE_SIZE = 10; - GLX_ALPHA_SIZE = 11; - GLX_DEPTH_SIZE = 12; - GLX_STENCIL_SIZE = 13; - GLX_ACCUM_RED_SIZE = 14; - GLX_ACCUM_GREEN_SIZE = 15; - GLX_ACCUM_BLUE_SIZE = 16; - GLX_ACCUM_ALPHA_SIZE = 17; - - // GLX_EXT_visual_info extension - GLX_X_VISUAL_TYPE_EXT = $22; - GLX_TRANSPARENT_TYPE_EXT = $23; - GLX_TRANSPARENT_INDEX_VALUE_EXT = $24; - GLX_TRANSPARENT_RED_VALUE_EXT = $25; - GLX_TRANSPARENT_GREEN_VALUE_EXT = $26; - GLX_TRANSPARENT_BLUE_VALUE_EXT = $27; - GLX_TRANSPARENT_ALPHA_VALUE_EXT = $28; - - - // Error codes returned by glXGetConfig: - GLX_BAD_SCREEN = 1; - GLX_BAD_ATTRIBUTE = 2; - GLX_NO_EXTENSION = 3; - GLX_BAD_VISUAL = 4; - GLX_BAD_CONTEXT = 5; - GLX_BAD_VALUE = 6; - GLX_BAD_ENUM = 7; - - // GLX 1.1 and later: - GLX_VENDOR = 1; - GLX_VERSION = 2; - GLX_EXTENSIONS = 3; - - // GLX_visual_info extension - GLX_TRUE_COLOR_EXT = $8002; - GLX_DIRECT_COLOR_EXT = $8003; - GLX_PSEUDO_COLOR_EXT = $8004; - GLX_STATIC_COLOR_EXT = $8005; - GLX_GRAY_SCALE_EXT = $8006; - GLX_STATIC_GRAY_EXT = $8007; - GLX_NONE_EXT = $8000; - GLX_TRANSPARENT_RGB_EXT = $8008; - GLX_TRANSPARENT_INDEX_EXT = $8009; - -type - // From XLib: - {$IFNDEF FPC} - TXID = XID; - {$ENDIF} - XPixmap = TXID; - XFont = TXID; - XColormap = TXID; - - GLXContext = Pointer; - GLXPixmap = TXID; - GLXDrawable = TXID; - GLXContextID = TXID; - -var - glXChooseVisual: function(dpy: PDisplay; screen: Integer; var attribList: Integer): PXVisualInfo; cdecl; - glXCreateContext: function(dpy: PDisplay; vis: PXVisualInfo; shareList: GLXContext; direct: Boolean): GLXContext; cdecl; - glXDestroyContext: procedure(dpy: PDisplay; ctx: GLXContext); cdecl; - glXMakeCurrent: function(dpy: PDisplay; drawable: GLXDrawable; ctx: GLXContext): Boolean; cdecl; - glXCopyContext: procedure(dpy: PDisplay; src, dst: GLXContext; mask: LongWord); cdecl; - glXSwapBuffers: procedure(dpy: PDisplay; drawable: GLXDrawable); cdecl; - glXCreateGLXPixmap: function(dpy: PDisplay; visual: PXVisualInfo; pixmap: XPixmap): GLXPixmap; cdecl; - glXDestroyGLXPixmap: procedure(dpy: PDisplay; pixmap: GLXPixmap); cdecl; - glXQueryExtension: function(dpy: PDisplay; var errorb, event: Integer): Boolean; cdecl; - glXQueryVersion: function(dpy: PDisplay; var maj, min: Integer): Boolean; cdecl; - glXIsDirect: function(dpy: PDisplay; ctx: GLXContext): Boolean; cdecl; - glXGetConfig: function(dpy: PDisplay; visual: PXVisualInfo; attrib: Integer; var value: Integer): Integer; cdecl; - glXGetCurrentContext: function: GLXContext; cdecl; - glXGetCurrentDrawable: function: GLXDrawable; cdecl; - glXWaitGL: procedure; cdecl; - glXWaitX: procedure; cdecl; - glXUseXFont: procedure(font: XFont; first, count, list: Integer); cdecl; - - // GLX 1.1 and later - glXQueryExtensionsString: function(dpy: PDisplay; screen: Integer): PChar; cdecl; - glXQueryServerString: function(dpy: PDisplay; screen, name: Integer): PChar; cdecl; - glXGetClientString: function(dpy: PDisplay; name: Integer): PChar; cdecl; - - // Mesa GLX Extensions - glXCreateGLXPixmapMESA: function(dpy: PDisplay; visual: PXVisualInfo; pixmap: XPixmap; cmap: XColormap): GLXPixmap; cdecl; - glXReleaseBufferMESA: function(dpy: PDisplay; d: GLXDrawable): Boolean; cdecl; - glXCopySubBufferMESA: procedure(dpy: PDisplay; drawbale: GLXDrawable; x, y, width, height: Integer); cdecl; - glXGetVideoSyncSGI: function(var counter: LongWord): Integer; cdecl; - glXWaitVideoSyncSGI: function(divisor, remainder: Integer; var count: LongWord): Integer; cdecl; - - -// ======================================================= -// -// ======================================================= - -implementation - -uses - {$IFNDEF __GPC__} - SysUtils, - {$ENDIF} - moduleloader; - -(* {$LINKLIB m} *) - -var - libGLX: TModuleHandle; - -function InitGLXFromLibrary( dll : PChar ): Boolean; -begin - Result := False; - - if LoadModule( libGLX, dll ) then - exit; - - glXChooseVisual := GetModuleSymbol(libglx, 'glXChooseVisual'); - glXCreateContext := GetModuleSymbol(libglx, 'glXCreateContext'); - glXDestroyContext := GetModuleSymbol(libglx, 'glXDestroyContext'); - glXMakeCurrent := GetModuleSymbol(libglx, 'glXMakeCurrent'); - glXCopyContext := GetModuleSymbol(libglx, 'glXCopyContext'); - glXSwapBuffers := GetModuleSymbol(libglx, 'glXSwapBuffers'); - glXCreateGLXPixmap := GetModuleSymbol(libglx, 'glXCreateGLXPixmap'); - glXDestroyGLXPixmap := GetModuleSymbol(libglx, 'glXDestroyGLXPixmap'); - glXQueryExtension := GetModuleSymbol(libglx, 'glXQueryExtension'); - glXQueryVersion := GetModuleSymbol(libglx, 'glXQueryVersion'); - glXIsDirect := GetModuleSymbol(libglx, 'glXIsDirect'); - glXGetConfig := GetModuleSymbol(libglx, 'glXGetConfig'); - glXGetCurrentContext := GetModuleSymbol(libglx, 'glXGetCurrentContext'); - glXGetCurrentDrawable := GetModuleSymbol(libglx, 'glXGetCurrentDrawable'); - glXWaitGL := GetModuleSymbol(libglx, 'glXWaitGL'); - glXWaitX := GetModuleSymbol(libglx, 'glXWaitX'); - glXUseXFont := GetModuleSymbol(libglx, 'glXUseXFont'); - // GLX 1.1 and later - glXQueryExtensionsString := GetModuleSymbol(libglx, 'glXQueryExtensionsString'); - glXQueryServerString := GetModuleSymbol(libglx, 'glXQueryServerString'); - glXGetClientString := GetModuleSymbol(libglx, 'glXGetClientString'); - // Mesa GLX Extensions - glXCreateGLXPixmapMESA := GetModuleSymbol(libglx, 'glXCreateGLXPixmapMESA'); - glXReleaseBufferMESA := GetModuleSymbol(libglx, 'glXReleaseBufferMESA'); - glXCopySubBufferMESA := GetModuleSymbol(libglx, 'glXCopySubBufferMESA'); - glXGetVideoSyncSGI := GetModuleSymbol(libglx, 'glXGetVideoSyncSGI'); - glXWaitVideoSyncSGI := GetModuleSymbol(libglx, 'glXWaitVideoSyncSGI'); - - GLXInitialized := True; - Result := True; -end; - -function InitGLX: Boolean; -begin - Result := InitGLXFromLibrary('libGL.so') or - InitGLXFromLibrary('libGL.so.1') or - InitGLXFromLibrary('libMesaGL.so') or - InitGLXFromLibrary('libMesaGL.so.3'); -end; - - -initialization - InitGLX; -finalization - UnloadModule(libGLX); -end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/opengl12.pas b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/opengl12.pas deleted file mode 100644 index 763edaee..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/opengl12.pas +++ /dev/null @@ -1,9967 +0,0 @@ -unit opengl12; -{ - $Id: opengl12.pas,v 1.2 2004/04/05 09:59:46 savage Exp $ - -} -{******************************************************************************} -{ } -{ Borland Delphi Runtime Library } -{ OpenGL interface unit } -{ } -{ } -{ This is an interface unit for the use of OpenGL from within Delphi and Kylix.} -{ It contains the translations of gl.h, glu.h, glx.h as well as context } -{ and extension management functions. } -{ } -{ The original Pascal code is: OpenGL12.pas } -{ The initial developer of the Pascal code is Mike Lischke } -{ } -{ } -{ Portions created by Microsoft are } -{ Copyright (C) 1995-2001 Microsoft Corporation. } -{ All Rights Reserved. } -{ } -{ Portions created by Silicon Graphics Incorporated are } -{ Copyright (C) 1995-2001 Silicon Graphics Incorporated } -{ All Rights Reserved. } -{ } -{ Portions created by NVidia are } -{ Copyright (C) 1995-2001 NVidia } -{ All Rights Reserved. } -{ } -{ Portions created by Brian Paul } -{ Copyright (C) 1995-2001 Brian Paul } -{ All Rights Reserved. } -{ } -{ } -{ The original file is: gl.h } -{ The original file is: glut.h } -{ The original file is: glx.h } -{ The original file is: glx.h } -{ } -{ Portions created by Mike Lischke are } -{ Copyright (C) 2001 Mike Lischke. } -{ } -{ Portions created by John O'Harrow are } -{ Copyright (C) 2001 John O'Harrow. } -{ } -{ Portions created by Eric Grange are } -{ Copyright (C) 2001 Eric Grange. } -{ } -{ Portions created by Olivier Chatelain } -{ Copyright (C) 2001 Olivier Chatelain. } -{ } -{ Portions created by Tom Nuydens } -{ Copyright (C) 2001 Tom Nuydens. } -{ } -{ Portions created by Matthias Thoma are } -{ Copyright (C) 2001 Matthias Thoma. } -{ } -{ Portions created by Sven Bobrowski are } -{ Copyright (C) 2001 Sven Bobrowski } -{ } -{ } -{ Obtained through: } -{ } -{ Joint Endeavour of Delphi Innovators (Project JEDI) } -{ } -{ You may retrieve the latest version of this file at the Project } -{ JEDI home page, located at http://delphi-jedi.org } -{ } -{ The contents of this file are used with permission, subject to } -{ the Mozilla Public License Version 1.1 (the "License"); you may } -{ not use this file except in compliance with the License. You may } -{ obtain a copy of the License at } -{ http://www.mozilla.org/MPL/MPL-1.1.html } -{ } -{ Software distributed under the License is distributed on an } -{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } -{ implied. See the License for the specific language governing } -{ rights and limitations under the License. } -{ } -{******************************************************************************} - -//---------------------------------------------------------------------------------------------------------------------- -// -// This is an interface unit for the use of OpenGL from within Delphi and contains -// the translations of gl.h, glu.h as well as some support functions. -// OpenGL12.pas contains bug fixes and enhancements of Delphi's and other translations -// as well as support for extensions. -// -// NOTE: In order to fully support multi thread rendering it is necessary to hold all -// extension address in threadvars. For single threaded applications this would be an -// unnecessary time penalty, however. Hence there is a compiler switch to -// allow single threaded OpenGL application to use vars while multi threaded applications -// will use threadvars. By default the switch MULTITHREADOPENGL (see compiler switch under der interface keyword) -// is not active and must explicitly enabled to take effect. -// -//---------------------------------------------------------------------------------------------------------------------- -// -// function InitOpenGL: Boolean; -// Needed to load the OpenGL DLLs and all addresses of the standard functions. -// In case OpenGL is already initialized this function does nothing. No error -// is raised, if something goes wrong, but you need to inspect the result in order -// to know if all went okay. -// Result: True if successful or already loaded, False otherwise. -// -// function InitOpenGLFromLibrary(GL_Name, GLU_Name: String): Boolean; -// Same as InitOpenGL, but you can specify specific DLLs. Useful if you want to -// use different DLLs than the default ones. This function closes previously -// loaded DLLs before it tries to open the new libraries. -// Result: True if successful, False otherwise. -// -// procedure CloseOpenGL; -// Unloads the OpenGL DLLs and sets all function addresses to nil, including -// extensions. You can load and unload the DLLs as often as you like. -// -// procedure ClearExtensions; -// Sets all extension routines to nil. This is needed when you change the Pixelformat -// of your OpenGL window, since the availability of these routines changes from -// PixelFormat to Pixelformat (and also between various vendors). -// -// function CreateRenderingContext(DC: HDC; Options: TRCOptions; ColorBits, StencilBits, AccumBits, AuxBuffers: Integer; -// Layer: Integer; var Palette: HPALETTE): HGLRC; -// Sets up a pixel format and creates a new rendering context depending of the -// given parameters: -// DC - the device context for which the rc is to be created -// Options - options for the context, which the application would like to have -// (it is not guaranteed they will be available) -// ColorBits - the color depth of the device context (Note: Because of the internal DC handling of the VCL you -// should avoid using GetDeviceCaps for memory DCs which are members of a TBitmap class. -// Translate the Pixelformat member instead!) -// StencilBits - requested size of the stencil buffer -// AccumBits - requested size of the accumulation buffer -// AuxBuffers - requested number of auxiliary buffers -// Layer - ID for the layer for which the RC will be created (-1..-15 for underlay planes, 0 for main plane, -// 1..15 for overlay planes) -// Note: The layer handling is not yet complete as there is very few information -// available and (until now) no OpenGL implementation with layer support on the low budget market. -// Hence use 0 (for the main plane) as layer ID. -// Palette - Palette Handle created within function (need to use DeleteObject(Palette) to free this if <> 0) -// Result: the newly created context or 0 if setup failed -// -// procedure ActivateRenderingContext(DC: HDC; RC: HGLRC); -// Makes RC in DC 'current' (wglMakeCurrent(..)) and loads all extension addresses -// and flags if necessary. -// -// procedure DeactivateRenderingContext; -// Counterpart to ActivateRenderingContext. -// -// procedure DestroyRenderingContext(RC: HGLRC); -// RC will be destroyed and must be recreated if you want to use it again. -// -// procedure ReadExtensions; -// Determines which extensions for the current rendering context are available and -// loads their addresses. This procedure is called from ActivateRenderingContext -// if a new pixel format is used, but you can safely call it from where you want -// to actualize those values (under the condition that a rendering context MUST be -// active). -// -// procedure ReadImplementationProperties; -// Determines other properties of the OpenGL DLL (version, availability of extensions). -// Again, a valid rendering context must be active. -// -// function HasActiveContext: Boolean; -// Determines whether the calling thread has currently an active rendering context. -//---------------------------------------------------------------------------------------------------------------------- -// -// This translation is based on different sources: -// -// - first translation from Artemis Alliance Inc. -// - previous versions from Mike Lischke -// - Alexander Staubo -// - Borland OpenGL.pas (from Delphi 3) -// - Microsoft and SGI OpenGL header files -// - www.opengl.org, www.sgi.com/OpenGL -// - nVidia extension reference as of December 1999 -// - nVidia extension reference as of January 2001 -// - vertex_array_range sample by Tom Nuydens at Delphi3D -// - minor bug fixes and greatly extended by John O'Harrow (john@elmcrest.demon.co.uk) -// - initial context activation balancing by Eric Grange (egrange@infonie.fr) -// - additional nVidia extensions by Olivier Chatelain (Olivier.Chatelain@xitact.com) -// -// Contact: public@lischke-online.de, www.lischke-online.de -// -// Version: 1.2.11 -//---------------------------------------------------------------------------------------------------------------------- -// -// 12-Feb-2002 dml : -// - Further modifications to allow unit to compile under Free Pascal -// as suggested by "QuePasha Pepe" -// -// 25-OCT-2001 dre : -// - Made modifications to allow unit to compile under Free Pascal -// - added tMaxLogPalette declaration to Free Pascal -// - included fix to ReadExtensions -// - Added Set8088CW procedure -// -// 13-SEP-2001 ml: -// - added PWGLSwap etc. declarations for Delphi 3 -// 18-AUG-2001 ml: -// - multi thread support for function addresses (extensions) -// 28-JUL-2001 ml: -// - included original type names (+ $EXTERNALSYM directives) -// 10-JUL-2001 ml: -// - TGLubyte changed to UCHAR -// 05-JUL-2001 ml: -// - own exception type for OpenGL -// - TGLboolean is now of type BYTEBOOL -// 05-MAY-2001 ml: -// - correct tracking of RC creation and release as well as multithreaded RC activation -// - compatibility routines for users of other OpenGL unit variants -// - improved rendering context creation -// - bug fixes -// 01-MAY-2001 ml: -// - added more nVidia extensions -//---------------------------------------------------------------------------------------------------------------------- -{ April 03 2003 - DL : Added jedi-sdl.inc include file to support more } -{ Pascal compilers. Initial support is now included } -{ for GnuPascal, VirtualPascal, TMT and obviously } -{ continue support for Delphi Kylix and FreePascal. } -{ } -{ May 03 2003 - DL : under instruction from David Mears AKA } -{ Jason Siletto, I have added FPC Linux support. } -{ } -{******************************************************************************} -{ - $Log: opengl12.pas,v $ - Revision 1.2 2004/04/05 09:59:46 savage - Changes for FreePacal as suggested by Marco - - Revision 1.1 2004/03/30 21:53:55 savage - Moved to it's own folder. - - Revision 1.6 2004/02/20 17:26:19 savage - Extensions are now loaded using SDL_GL_GetProcAddress, thus making it more cross-platform compatible, but now more tied to SDL. - - Revision 1.5 2004/02/15 22:48:36 savage - More FPC and FreeBSD support changes. - - Revision 1.4 2004/02/14 22:36:29 savage - Fixed inconsistencies of using LoadLibrary and LoadModule. - Now all units make use of LoadModule rather than LoadLibrary and other dynamic proc procedures. - - Revision 1.3 2004/02/14 00:23:39 savage - As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. - - Revision 1.2 2004/02/14 00:09:19 savage - Changed uses to now make use of moduleloader.pas rather than dllfuncs.pas - - Revision 1.1 2004/02/05 00:08:20 savage - Module 1.0 release - - -} - -{$I jedi-sdl.inc} - -interface - -{.$define MULTITHREADOPENGL} - -uses -{$IFDEF __GPC__} - gpc; -{$ENDIF} - -{$IFDEF WIN32} - {$IFNDEF __GPC__} - Windows; - {$ENDIF} -{$ENDIF} - -{$IFDEF Unix} - {$IFDEF FPC} - {$IFDEF Ver1_0} - linux, - {$ELSE} - baseunix, - unix, - {$ENDIF} - x, - xlib, - xutil, - dl; - {$ELSE} - Types, - Libc, - Xlib; - {$ENDIF} -{$ENDIF} - -type - TRCOptions = set of ( opDoubleBuffered, opGDI, opStereo ); - - {$EXTERNALSYM GLenum} - GLenum = Cardinal; - TGLenum = Cardinal; - PGLenum = ^TGLenum; - - {$EXTERNALSYM GLboolean} - GLboolean = BYTEBOOL; - TGLboolean = BYTEBOOL; - PGLboolean = ^TGLboolean; - - {$EXTERNALSYM GLbitfield} - GLbitfield = Cardinal; - TGLbitfield = Cardinal; - PGLbitfield = ^TGLbitfield; - - {$EXTERNALSYM GLbyte} - GLbyte = ShortInt; - TGLbyte = ShortInt; - PGLbyte = ^TGLbyte; - - {$EXTERNALSYM GLshort} - GLshort = SmallInt; - TGLshort = SmallInt; - PGLshort = ^TGLshort; - - {$EXTERNALSYM GLint} - GLint = Integer; - TGLint = Integer; - PGLint = ^TGLint; - - {$EXTERNALSYM GLsizei} - GLsizei = Integer; - TGLsizei = Integer; - PGLsizei = ^TGLsizei; - - {$EXTERNALSYM GLubyte} - UCHAR = Byte; - GLubyte = UCHAR; - TGLubyte = UCHAR; - PGLubyte = ^TGLubyte; - - {$EXTERNALSYM GLushort} - GLushort = Word; - TGLushort = Word; - PGLushort = ^TGLushort; - - {$EXTERNALSYM GLuint} - GLuint = Cardinal; - TGLuint = Cardinal; - PGLuint = ^TGLuint; - - {$EXTERNALSYM GLfloat} - GLfloat = Single; - TGLfloat = Single; - PGLfloat = ^TGLfloat; - - {$EXTERNALSYM GLclampf} - GLclampf = Single; - TGLclampf = Single; - PGLclampf = ^TGLclampf; - - {$EXTERNALSYM GLdouble} - GLdouble = Double; - TGLdouble = Double; - PGLdouble = ^TGLdouble; - - {$EXTERNALSYM GLclampd} - GLclampd = Double; - TGLclampd = Double; - PGLclampd = ^TGLclampd; - - TVector3d = array[0..2] of GLdouble; - - TVector4i = array[0..3] of GLint; - TVector4f = array[0..3] of GLfloat; - TVector4p = array[0..3] of Pointer; - - TMatrix4f = array[0..3, 0..3] of GLfloat; - TMatrix4d = array[0..3, 0..3] of GLdouble; - - PPointer = ^Pointer; - -{$ifndef FPC} - {$ifdef MULTITHREADOPENGL} - threadvar - {$else} - var - {$endif} -{$else} -var -{$endif} - GL_VERSION_1_0, - GL_VERSION_1_1, - GL_VERSION_1_2, - GLU_VERSION_1_1, - GLU_VERSION_1_2, - GLU_VERSION_1_3: Boolean; - - // Extensions (gl) - GL_3DFX_multisample, - GL_3DFX_tbuffer, - GL_3DFX_texture_compression_FXT1, - - GL_APPLE_specular_vector, - GL_APPLE_transform_hint, - - GL_ARB_imaging, - GL_ARB_multisample, - GL_ARB_multitexture, - GL_ARB_texture_compression, - GL_ARB_texture_cube_map, - GL_ARB_transpose_matrix, - GL_ARB_vertex_blend, - - GL_EXT_422_pixels, - GL_EXT_abgr, - GL_EXT_bgra, - GL_EXT_blend_color, - GL_EXT_blend_func_separate, - GL_EXT_blend_logic_op, - GL_EXT_blend_minmax, - GL_EXT_blend_subtract, - GL_EXT_clip_volume_hint, - GL_EXT_cmyka, - GL_EXT_color_subtable, - GL_EXT_compiled_vertex_array, - GL_EXT_convolution, - GL_EXT_coordinate_frame, - GL_EXT_copy_texture, - GL_EXT_cull_vertex, - GL_EXT_draw_range_elements, - GL_EXT_fog_coord, - GL_EXT_histogram, - GL_EXT_index_array_formats, - GL_EXT_index_func, - GL_EXT_index_material, - GL_EXT_index_texture, - GL_EXT_light_max_exponent, - GL_EXT_light_texture, - GL_EXT_misc_attribute, - GL_EXT_multi_draw_arrays, - GL_EXT_multisample, - GL_EXT_packed_pixels, - GL_EXT_paletted_texture, - GL_EXT_pixel_transform, - GL_EXT_point_parameters, - GL_EXT_polygon_offset, - GL_EXT_rescale_normal, - GL_EXT_scene_marker, - GL_EXT_secondary_color, - GL_EXT_separate_specular_color, - GL_EXT_shared_texture_palette, - GL_EXT_stencil_wrap, - GL_EXT_subtexture, - GL_EXT_texture_color_table, - GL_EXT_texture_compression_s3tc, - GL_EXT_texture_cube_map, - GL_EXT_texture_edge_clamp, - GL_EXT_texture_env_add, - GL_EXT_texture_env_combine, - GL_EXT_texture_filter_anisotropic, - GL_EXT_texture_lod_bias, - GL_EXT_texture_object, - GL_EXT_texture_perturb_normal, - GL_EXT_texture3D, - GL_EXT_vertex_array, - GL_EXT_vertex_weighting, - - GL_FfdMaskSGIX, - GL_HP_convolution_border_modes, - GL_HP_image_transform, - GL_HP_occlusion_test, - GL_HP_texture_lighting, - - GL_IBM_cull_vertex, - GL_IBM_multimode_draw_arrays, - GL_IBM_rasterpos_clip, - GL_IBM_vertex_array_lists, - - GL_INGR_color_clamp, - GL_INGR_interlace_read, - - GL_INTEL_parallel_arrays, - - GL_KTX_buffer_region, - - GL_MESA_resize_buffers, - GL_MESA_window_pos, - - GL_NV_blend_square, - GL_NV_fog_distance, - GL_NV_light_max_exponent, - GL_NV_register_combiners, - GL_NV_texgen_emboss, - GL_NV_texgen_reflection, - GL_NV_texture_env_combine4, - GL_NV_vertex_array_range, - GL_NV_vertex_program, - - GL_PGI_misc_hints, - GL_PGI_vertex_hints, - - GL_REND_screen_coordinates, - - GL_SGI_color_matrix, - GL_SGI_color_table, - GL_SGI_depth_pass_instrument, - - GL_SGIS_detail_texture, - GL_SGIS_fog_function, - GL_SGIS_generate_mipmap, - GL_SGIS_multisample, - GL_SGIS_multitexture, - GL_SGIS_pixel_texture, - GL_SGIS_point_line_texgen, - GL_SGIS_point_parameters, - GL_SGIS_sharpen_texture, - GL_SGIS_texture_border_clamp, - GL_SGIS_texture_color_mask, - GL_SGIS_texture_edge_clamp, - GL_SGIS_texture_filter4, - GL_SGIS_texture_lod, - GL_SGIS_texture_select, - GL_SGIS_texture4D, - - GL_SGIX_async, - GL_SGIX_async_histogram, - GL_SGIX_async_pixel, - GL_SGIX_blend_alpha_minmax, - GL_SGIX_calligraphic_fragment, - GL_SGIX_clipmap, - GL_SGIX_convolution_accuracy, - GL_SGIX_depth_texture, - GL_SGIX_flush_raster, - GL_SGIX_fog_offset, - GL_SGIX_fog_scale, - GL_SGIX_fragment_lighting, - GL_SGIX_framezoom, - GL_SGIX_igloo_interface, - GL_SGIX_instruments, - GL_SGIX_interlace, - GL_SGIX_ir_instrument1, - GL_SGIX_list_priority, - GL_SGIX_pixel_texture, - GL_SGIX_pixel_tiles, - GL_SGIX_polynomial_ffd, - GL_SGIX_reference_plane, - GL_SGIX_resample, - GL_SGIX_shadow, - GL_SGIX_shadow_ambient, - GL_SGIX_sprite, - GL_SGIX_subsample, - GL_SGIX_tag_sample_buffer, - GL_SGIX_texture_add_env, - GL_SGIX_texture_lod_bias, - GL_SGIX_texture_multi_buffer, - GL_SGIX_texture_scale_bias, - GL_SGIX_vertex_preclip, - GL_SGIX_ycrcb, - GL_SGIX_ycrcba, - - GL_SUN_convolution_border_modes, - GL_SUN_global_alpha, - GL_SUN_triangle_list, - GL_SUN_vertex, - - GL_SUNX_constant_data, - - GL_WIN_phong_shading, - GL_WIN_specular_fog, - GL_WIN_swap_hint, - - WGL_EXT_swap_control, - WGL_ARB_extensions_string, - WGL_ARB_pixel_format, - - // Extensions (glu) - GLU_EXT_Texture, - GLU_EXT_object_space_tess, - GLU_EXT_nurbs_tessellator: Boolean; - -const - // ********** GL generic constants ********** - - // errors - GL_NO_ERROR = 0; - {$EXTERNALSYM GL_NO_ERROR} - GL_INVALID_ENUM = $0500; - {$EXTERNALSYM GL_INVALID_ENUM} - GL_INVALID_VALUE = $0501; - {$EXTERNALSYM GL_INVALID_VALUE} - GL_INVALID_OPERATION = $0502; - {$EXTERNALSYM GL_INVALID_OPERATION} - GL_STACK_OVERFLOW = $0503; - {$EXTERNALSYM GL_STACK_OVERFLOW} - GL_STACK_UNDERFLOW = $0504; - {$EXTERNALSYM GL_STACK_UNDERFLOW} - GL_OUT_OF_MEMORY = $0505; - {$EXTERNALSYM GL_STACK_UNDERFLOW} - - // attribute bits - GL_CURRENT_BIT = $00000001; - {$EXTERNALSYM GL_CURRENT_BIT} - GL_POINT_BIT = $00000002; - {$EXTERNALSYM GL_POINT_BIT} - GL_LINE_BIT = $00000004; - {$EXTERNALSYM GL_LINE_BIT} - GL_POLYGON_BIT = $00000008; - {$EXTERNALSYM GL_POLYGON_BIT} - GL_POLYGON_STIPPLE_BIT = $00000010; - {$EXTERNALSYM GL_POLYGON_STIPPLE_BIT} - GL_PIXEL_MODE_BIT = $00000020; - {$EXTERNALSYM GL_PIXEL_MODE_BIT} - GL_LIGHTING_BIT = $00000040; - {$EXTERNALSYM GL_LIGHTING_BIT} - GL_FOG_BIT = $00000080; - {$EXTERNALSYM GL_FOG_BIT} - GL_DEPTH_BUFFER_BIT = $00000100; - {$EXTERNALSYM GL_DEPTH_BUFFER_BIT} - GL_ACCUM_BUFFER_BIT = $00000200; - {$EXTERNALSYM GL_ACCUM_BUFFER_BIT} - GL_STENCIL_BUFFER_BIT = $00000400; - {$EXTERNALSYM GL_STENCIL_BUFFER_BIT} - GL_VIEWPORT_BIT = $00000800; - {$EXTERNALSYM GL_VIEWPORT_BIT} - GL_TRANSFORM_BIT = $00001000; - {$EXTERNALSYM GL_TRANSFORM_BIT} - GL_ENABLE_BIT = $00002000; - {$EXTERNALSYM GL_ENABLE_BIT} - GL_COLOR_BUFFER_BIT = $00004000; - {$EXTERNALSYM GL_COLOR_BUFFER_BIT} - GL_HINT_BIT = $00008000; - {$EXTERNALSYM GL_HINT_BIT} - GL_EVAL_BIT = $00010000; - {$EXTERNALSYM GL_EVAL_BIT} - GL_LIST_BIT = $00020000; - {$EXTERNALSYM GL_LIST_BIT} - GL_TEXTURE_BIT = $00040000; - {$EXTERNALSYM GL_TEXTURE_BIT} - GL_SCISSOR_BIT = $00080000; - {$EXTERNALSYM GL_SCISSOR_BIT} - GL_ALL_ATTRIB_BITS = $000FFFFF; - {$EXTERNALSYM GL_ALL_ATTRIB_BITS} - - // client attribute bits - GL_CLIENT_PIXEL_STORE_BIT = $00000001; - {$EXTERNALSYM GL_CLIENT_PIXEL_STORE_BIT} - GL_CLIENT_VERTEX_ARRAY_BIT = $00000002; - {$EXTERNALSYM GL_CLIENT_VERTEX_ARRAY_BIT} - GL_CLIENT_ALL_ATTRIB_BITS = $FFFFFFFF; - {$EXTERNALSYM GL_CLIENT_ALL_ATTRIB_BITS} - - // boolean values - GL_FALSE = Boolean( 0 ); - {$EXTERNALSYM GL_FALSE} - GL_TRUE = Boolean( 1 ); - {$EXTERNALSYM GL_TRUE} - - // primitives - GL_POINTS = $0000; - {$EXTERNALSYM GL_POINTS} - GL_LINES = $0001; - {$EXTERNALSYM GL_LINES} - GL_LINE_LOOP = $0002; - {$EXTERNALSYM GL_LINE_LOOP} - GL_LINE_STRIP = $0003; - {$EXTERNALSYM GL_LINE_STRIP} - GL_TRIANGLES = $0004; - {$EXTERNALSYM GL_TRIANGLES} - GL_TRIANGLE_STRIP = $0005; - {$EXTERNALSYM GL_TRIANGLE_STRIP} - GL_TRIANGLE_FAN = $0006; - {$EXTERNALSYM GL_TRIANGLE_FAN} - GL_QUADS = $0007; - {$EXTERNALSYM GL_QUADS} - GL_QUAD_STRIP = $0008; - {$EXTERNALSYM GL_QUAD_STRIP} - GL_POLYGON = $0009; - {$EXTERNALSYM GL_POLYGON} - - // blending - GL_ZERO = 0; - {$EXTERNALSYM GL_ZERO} - GL_ONE = 1; - {$EXTERNALSYM GL_ONE} - GL_SRC_COLOR = $0300; - {$EXTERNALSYM GL_SRC_COLOR} - GL_ONE_MINUS_SRC_COLOR = $0301; - {$EXTERNALSYM GL_ONE_MINUS_SRC_COLOR} - GL_SRC_ALPHA = $0302; - {$EXTERNALSYM GL_SRC_ALPHA} - GL_ONE_MINUS_SRC_ALPHA = $0303; - {$EXTERNALSYM GL_ONE_MINUS_SRC_ALPHA} - GL_DST_ALPHA = $0304; - {$EXTERNALSYM GL_DST_ALPHA} - GL_ONE_MINUS_DST_ALPHA = $0305; - {$EXTERNALSYM GL_ONE_MINUS_DST_ALPHA} - GL_DST_COLOR = $0306; - {$EXTERNALSYM GL_DST_COLOR} - GL_ONE_MINUS_DST_COLOR = $0307; - {$EXTERNALSYM GL_ONE_MINUS_DST_COLOR} - GL_SRC_ALPHA_SATURATE = $0308; - {$EXTERNALSYM GL_SRC_ALPHA_SATURATE} - GL_BLEND_DST = $0BE0; - {$EXTERNALSYM GL_BLEND_DST} - GL_BLEND_SRC = $0BE1; - {$EXTERNALSYM GL_BLEND_SRC} - GL_BLEND = $0BE2; - {$EXTERNALSYM GL_BLEND} - - // blending (GL 1.2 ARB imaging) - GL_BLEND_COLOR = $8005; - {$EXTERNALSYM GL_BLEND_COLOR} - GL_CONSTANT_COLOR = $8001; - {$EXTERNALSYM GL_CONSTANT_COLOR} - GL_ONE_MINUS_CONSTANT_COLOR = $8002; - {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_COLOR} - GL_CONSTANT_ALPHA = $8003; - {$EXTERNALSYM GL_CONSTANT_ALPHA} - GL_ONE_MINUS_CONSTANT_ALPHA = $8004; - {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_ALPHA} - GL_FUNC_ADD = $8006; - {$EXTERNALSYM GL_FUNC_ADD} - GL_MIN = $8007; - {$EXTERNALSYM GL_MIN} - GL_MAX = $8008; - {$EXTERNALSYM GL_MAX} - GL_FUNC_SUBTRACT = $800A; - {$EXTERNALSYM GL_FUNC_SUBTRACT} - GL_FUNC_REVERSE_SUBTRACT = $800B; - {$EXTERNALSYM GL_FUNC_REVERSE_SUBTRACT} - - // color table GL 1.2 ARB imaging - GL_COLOR_TABLE = $80D0; - {$EXTERNALSYM GL_COLOR_TABLE} - GL_POST_CONVOLUTION_COLOR_TABLE = $80D1; - {$EXTERNALSYM GL_POST_CONVOLUTION_COLOR_TABLE} - GL_POST_COLOR_MATRIX_COLOR_TABLE = $80D2; - {$EXTERNALSYM GL_POST_COLOR_MATRIX_COLOR_TABLE} - GL_PROXY_COLOR_TABLE = $80D3; - {$EXTERNALSYM GL_PROXY_COLOR_TABLE} - GL_PROXY_POST_CONVOLUTION_COLOR_TABLE = $80D4; - {$EXTERNALSYM GL_PROXY_POST_CONVOLUTION_COLOR_TABLE} - GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE = $80D5; - {$EXTERNALSYM GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE} - GL_COLOR_TABLE_SCALE = $80D6; - {$EXTERNALSYM GL_COLOR_TABLE_SCALE} - GL_COLOR_TABLE_BIAS = $80D7; - {$EXTERNALSYM GL_COLOR_TABLE_BIAS} - GL_COLOR_TABLE_FORMAT = $80D8; - {$EXTERNALSYM GL_COLOR_TABLE_FORMAT} - GL_COLOR_TABLE_WIDTH = $80D9; - {$EXTERNALSYM GL_COLOR_TABLE_WIDTH} - GL_COLOR_TABLE_RED_SIZE = $80DA; - {$EXTERNALSYM GL_COLOR_TABLE_RED_SIZE} - GL_COLOR_TABLE_GREEN_SIZE = $80DB; - {$EXTERNALSYM GL_COLOR_TABLE_GREEN_SIZE} - GL_COLOR_TABLE_BLUE_SIZE = $80DC; - {$EXTERNALSYM GL_COLOR_TABLE_BLUE_SIZE} - GL_COLOR_TABLE_ALPHA_SIZE = $80DD; - {$EXTERNALSYM GL_COLOR_TABLE_ALPHA_SIZE} - GL_COLOR_TABLE_LUMINANCE_SIZE = $80DE; - {$EXTERNALSYM GL_COLOR_TABLE_LUMINANCE_SIZE} - GL_COLOR_TABLE_INTENSITY_SIZE = $80DF; - {$EXTERNALSYM GL_COLOR_TABLE_INTENSITY_SIZE} - - // convolutions GL 1.2 ARB imaging - GL_CONVOLUTION_1D = $8010; - {$EXTERNALSYM GL_CONVOLUTION_1D} - GL_CONVOLUTION_2D = $8011; - {$EXTERNALSYM GL_CONVOLUTION_2D} - GL_SEPARABLE_2D = $8012; - {$EXTERNALSYM GL_SEPARABLE_2D} - GL_CONVOLUTION_BORDER_MODE = $8013; - {$EXTERNALSYM GL_CONVOLUTION_BORDER_MODE} - GL_CONVOLUTION_FILTER_SCALE = $8014; - {$EXTERNALSYM GL_CONVOLUTION_FILTER_SCALE} - GL_CONVOLUTION_FILTER_BIAS = $8015; - {$EXTERNALSYM GL_CONVOLUTION_FILTER_BIAS} - GL_REDUCE = $8016; - {$EXTERNALSYM GL_REDUCE} - GL_CONVOLUTION_FORMAT = $8017; - {$EXTERNALSYM GL_CONVOLUTION_FORMAT} - GL_CONVOLUTION_WIDTH = $8018; - {$EXTERNALSYM GL_CONVOLUTION_WIDTH} - GL_CONVOLUTION_HEIGHT = $8019; - {$EXTERNALSYM GL_CONVOLUTION_HEIGHT} - GL_MAX_CONVOLUTION_WIDTH = $801A; - {$EXTERNALSYM GL_MAX_CONVOLUTION_WIDTH} - GL_MAX_CONVOLUTION_HEIGHT = $801B; - {$EXTERNALSYM GL_MAX_CONVOLUTION_HEIGHT} - GL_POST_CONVOLUTION_RED_SCALE = $801C; - {$EXTERNALSYM GL_POST_CONVOLUTION_RED_SCALE} - GL_POST_CONVOLUTION_GREEN_SCALE = $801D; - {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_SCALE} - GL_POST_CONVOLUTION_BLUE_SCALE = $801E; - {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_SCALE} - GL_POST_CONVOLUTION_ALPHA_SCALE = $801F; - {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_SCALE} - GL_POST_CONVOLUTION_RED_BIAS = $8020; - {$EXTERNALSYM GL_POST_CONVOLUTION_RED_BIAS} - GL_POST_CONVOLUTION_GREEN_BIAS = $8021; - {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_BIAS} - GL_POST_CONVOLUTION_BLUE_BIAS = $8022; - {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_BIAS} - GL_POST_CONVOLUTION_ALPHA_BIAS = $8023; - {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_BIAS} - - // histogram GL 1.2 ARB imaging - GL_HISTOGRAM = $8024; - {$EXTERNALSYM GL_HISTOGRAM} - GL_PROXY_HISTOGRAM = $8025; - {$EXTERNALSYM GL_PROXY_HISTOGRAM} - GL_HISTOGRAM_WIDTH = $8026; - {$EXTERNALSYM GL_HISTOGRAM_WIDTH} - GL_HISTOGRAM_FORMAT = $8027; - {$EXTERNALSYM GL_HISTOGRAM_FORMAT} - GL_HISTOGRAM_RED_SIZE = $8028; - {$EXTERNALSYM GL_HISTOGRAM_RED_SIZE} - GL_HISTOGRAM_GREEN_SIZE = $8029; - {$EXTERNALSYM GL_HISTOGRAM_GREEN_SIZE} - GL_HISTOGRAM_BLUE_SIZE = $802A; - {$EXTERNALSYM GL_HISTOGRAM_BLUE_SIZE} - GL_HISTOGRAM_ALPHA_SIZE = $802B; - {$EXTERNALSYM GL_HISTOGRAM_ALPHA_SIZE} - GL_HISTOGRAM_LUMINANCE_SIZE = $802C; - {$EXTERNALSYM GL_HISTOGRAM_LUMINANCE_SIZE} - GL_HISTOGRAM_SINK = $802D; - {$EXTERNALSYM GL_HISTOGRAM_SINK} - GL_MINMAX = $802E; - {$EXTERNALSYM GL_MINMAX} - GL_MINMAX_FORMAT = $802F; - {$EXTERNALSYM GL_MINMAX_FORMAT} - GL_MINMAX_SINK = $8030; - {$EXTERNALSYM GL_MINMAX_SINK} - - // buffers - GL_NONE = 0; - {$EXTERNALSYM GL_NONE} - GL_FRONT_LEFT = $0400; - {$EXTERNALSYM GL_FRONT_LEFT} - GL_FRONT_RIGHT = $0401; - {$EXTERNALSYM GL_FRONT_RIGHT} - GL_BACK_LEFT = $0402; - {$EXTERNALSYM GL_BACK_LEFT} - GL_BACK_RIGHT = $0403; - {$EXTERNALSYM GL_BACK_RIGHT} - GL_FRONT = $0404; - {$EXTERNALSYM GL_FRONT} - GL_BACK = $0405; - {$EXTERNALSYM GL_BACK} - GL_LEFT = $0406; - {$EXTERNALSYM GL_LEFT} - GL_RIGHT = $0407; - {$EXTERNALSYM GL_RIGHT} - GL_FRONT_AND_BACK = $0408; - {$EXTERNALSYM GL_FRONT_AND_BACK} - GL_AUX0 = $0409; - {$EXTERNALSYM GL_AUX0} - GL_AUX1 = $040A; - {$EXTERNALSYM GL_AUX1} - GL_AUX2 = $040B; - {$EXTERNALSYM GL_AUX2} - GL_AUX3 = $040C; - {$EXTERNALSYM GL_AUX3} - GL_AUX_BUFFERS = $0C00; - {$EXTERNALSYM GL_AUX_BUFFERS} - GL_DRAW_BUFFER = $0C01; - {$EXTERNALSYM GL_DRAW_BUFFER} - GL_READ_BUFFER = $0C02; - {$EXTERNALSYM GL_READ_BUFFER} - GL_DOUBLEBUFFER = $0C32; - {$EXTERNALSYM GL_DOUBLEBUFFER} - GL_STEREO = $0C33; - {$EXTERNALSYM GL_STEREO} - - // depth buffer - GL_DEPTH_RANGE = $0B70; - {$EXTERNALSYM GL_DEPTH_RANGE} - GL_DEPTH_TEST = $0B71; - {$EXTERNALSYM GL_DEPTH_TEST} - GL_DEPTH_WRITEMASK = $0B72; - {$EXTERNALSYM GL_DEPTH_WRITEMASK} - GL_DEPTH_CLEAR_VALUE = $0B73; - {$EXTERNALSYM GL_DEPTH_CLEAR_VALUE} - GL_DEPTH_FUNC = $0B74; - {$EXTERNALSYM GL_DEPTH_FUNC} - GL_NEVER = $0200; - {$EXTERNALSYM GL_NEVER} - GL_LESS = $0201; - {$EXTERNALSYM GL_LESS} - GL_EQUAL = $0202; - {$EXTERNALSYM GL_EQUAL} - GL_LEQUAL = $0203; - {$EXTERNALSYM GL_LEQUAL} - GL_GREATER = $0204; - {$EXTERNALSYM GL_GREATER} - GL_NOTEQUAL = $0205; - {$EXTERNALSYM GL_NOTEQUAL} - GL_GEQUAL = $0206; - {$EXTERNALSYM GL_GEQUAL} - GL_ALWAYS = $0207; - {$EXTERNALSYM GL_ALWAYS} - - // accumulation buffer - GL_ACCUM = $0100; - {$EXTERNALSYM GL_ACCUM} - GL_LOAD = $0101; - {$EXTERNALSYM GL_LOAD} - GL_RETURN = $0102; - {$EXTERNALSYM GL_RETURN} - GL_MULT = $0103; - {$EXTERNALSYM GL_MULT} - GL_ADD = $0104; - {$EXTERNALSYM GL_ADD} - GL_ACCUM_CLEAR_VALUE = $0B80; - {$EXTERNALSYM GL_ACCUM_CLEAR_VALUE} - - // feedback buffer - GL_FEEDBACK_BUFFER_POINTER = $0DF0; - {$EXTERNALSYM GL_FEEDBACK_BUFFER_POINTER} - GL_FEEDBACK_BUFFER_SIZE = $0DF1; - {$EXTERNALSYM GL_FEEDBACK_BUFFER_SIZE} - GL_FEEDBACK_BUFFER_TYPE = $0DF2; - {$EXTERNALSYM GL_FEEDBACK_BUFFER_TYPE} - - // feedback types - GL_2D = $0600; - {$EXTERNALSYM GL_2D} - GL_3D = $0601; - {$EXTERNALSYM GL_3D} - GL_3D_COLOR = $0602; - {$EXTERNALSYM GL_3D_COLOR} - GL_3D_COLOR_TEXTURE = $0603; - {$EXTERNALSYM GL_3D_COLOR_TEXTURE} - GL_4D_COLOR_TEXTURE = $0604; - {$EXTERNALSYM GL_4D_COLOR_TEXTURE} - - // feedback tokens - GL_PASS_THROUGH_TOKEN = $0700; - {$EXTERNALSYM GL_PASS_THROUGH_TOKEN} - GL_POINT_TOKEN = $0701; - {$EXTERNALSYM GL_POINT_TOKEN} - GL_LINE_TOKEN = $0702; - {$EXTERNALSYM GL_LINE_TOKEN} - GL_POLYGON_TOKEN = $0703; - {$EXTERNALSYM GL_POLYGON_TOKEN} - GL_BITMAP_TOKEN = $0704; - {$EXTERNALSYM GL_BITMAP_TOKEN} - GL_DRAW_PIXEL_TOKEN = $0705; - {$EXTERNALSYM GL_DRAW_PIXEL_TOKEN} - GL_COPY_PIXEL_TOKEN = $0706; - {$EXTERNALSYM GL_COPY_PIXEL_TOKEN} - GL_LINE_RESET_TOKEN = $0707; - {$EXTERNALSYM GL_LINE_RESET_TOKEN} - - // fog - GL_EXP = $0800; - {$EXTERNALSYM GL_EXP} - GL_EXP2 = $0801; - {$EXTERNALSYM GL_EXP2} - GL_FOG = $0B60; - {$EXTERNALSYM GL_FOG} - GL_FOG_INDEX = $0B61; - {$EXTERNALSYM GL_FOG_INDEX} - GL_FOG_DENSITY = $0B62; - {$EXTERNALSYM GL_FOG_DENSITY} - GL_FOG_START = $0B63; - {$EXTERNALSYM GL_FOG_START} - GL_FOG_END = $0B64; - {$EXTERNALSYM GL_FOG_END} - GL_FOG_MODE = $0B65; - {$EXTERNALSYM GL_FOG_MODE} - GL_FOG_COLOR = $0B66; - {$EXTERNALSYM GL_FOG_COLOR} - - // pixel mode, transfer - GL_PIXEL_MAP_I_TO_I = $0C70; - {$EXTERNALSYM GL_PIXEL_MAP_I_TO_I} - GL_PIXEL_MAP_S_TO_S = $0C71; - {$EXTERNALSYM GL_PIXEL_MAP_S_TO_S} - GL_PIXEL_MAP_I_TO_R = $0C72; - {$EXTERNALSYM GL_PIXEL_MAP_I_TO_R} - GL_PIXEL_MAP_I_TO_G = $0C73; - {$EXTERNALSYM GL_PIXEL_MAP_I_TO_G} - GL_PIXEL_MAP_I_TO_B = $0C74; - {$EXTERNALSYM GL_PIXEL_MAP_I_TO_B} - GL_PIXEL_MAP_I_TO_A = $0C75; - {$EXTERNALSYM GL_PIXEL_MAP_I_TO_A} - GL_PIXEL_MAP_R_TO_R = $0C76; - {$EXTERNALSYM GL_PIXEL_MAP_R_TO_R} - GL_PIXEL_MAP_G_TO_G = $0C77; - {$EXTERNALSYM GL_PIXEL_MAP_G_TO_G} - GL_PIXEL_MAP_B_TO_B = $0C78; - {$EXTERNALSYM GL_PIXEL_MAP_B_TO_B} - GL_PIXEL_MAP_A_TO_A = $0C79; - {$EXTERNALSYM GL_PIXEL_MAP_A_TO_A} - - // vertex arrays - GL_VERTEX_ARRAY_POINTER = $808E; - {$EXTERNALSYM GL_VERTEX_ARRAY_POINTER} - GL_NORMAL_ARRAY_POINTER = $808F; - {$EXTERNALSYM GL_NORMAL_ARRAY_POINTER} - GL_COLOR_ARRAY_POINTER = $8090; - {$EXTERNALSYM GL_COLOR_ARRAY_POINTER} - GL_INDEX_ARRAY_POINTER = $8091; - {$EXTERNALSYM GL_INDEX_ARRAY_POINTER} - GL_TEXTURE_COORD_ARRAY_POINTER = $8092; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_POINTER} - GL_EDGE_FLAG_ARRAY_POINTER = $8093; - {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_POINTER} - - // stenciling - GL_STENCIL_TEST = $0B90; - {$EXTERNALSYM GL_STENCIL_TEST} - GL_STENCIL_CLEAR_VALUE = $0B91; - {$EXTERNALSYM GL_STENCIL_CLEAR_VALUE} - GL_STENCIL_FUNC = $0B92; - {$EXTERNALSYM GL_STENCIL_FUNC} - GL_STENCIL_VALUE_MASK = $0B93; - {$EXTERNALSYM GL_STENCIL_VALUE_MASK} - GL_STENCIL_FAIL = $0B94; - {$EXTERNALSYM GL_STENCIL_FAIL} - GL_STENCIL_PASS_DEPTH_FAIL = $0B95; - {$EXTERNALSYM GL_STENCIL_PASS_DEPTH_FAIL} - GL_STENCIL_PASS_DEPTH_PASS = $0B96; - {$EXTERNALSYM GL_STENCIL_PASS_DEPTH_PASS} - GL_STENCIL_REF = $0B97; - {$EXTERNALSYM GL_STENCIL_REF} - GL_STENCIL_WRITEMASK = $0B98; - {$EXTERNALSYM GL_STENCIL_WRITEMASK} - GL_KEEP = $1E00; - {$EXTERNALSYM GL_KEEP} - GL_REPLACE = $1E01; - {$EXTERNALSYM GL_REPLACE} - GL_INCR = $1E02; - {$EXTERNALSYM GL_INCR} - GL_DECR = $1E03; - {$EXTERNALSYM GL_DECR} - - // color material - GL_COLOR_MATERIAL_FACE = $0B55; - {$EXTERNALSYM GL_COLOR_MATERIAL_FACE} - GL_COLOR_MATERIAL_PARAMETER = $0B56; - {$EXTERNALSYM GL_COLOR_MATERIAL_PARAMETER} - GL_COLOR_MATERIAL = $0B57; - {$EXTERNALSYM GL_COLOR_MATERIAL} - - // points - GL_POINT_SMOOTH = $0B10; - {$EXTERNALSYM GL_POINT_SMOOTH} - GL_POINT_SIZE = $0B11; - {$EXTERNALSYM GL_POINT_SIZE} - GL_POINT_SIZE_RANGE = $0B12; - {$EXTERNALSYM GL_POINT_SIZE_RANGE} - GL_POINT_SIZE_GRANULARITY = $0B13; - {$EXTERNALSYM GL_POINT_SIZE_GRANULARITY} - - // lines - GL_LINE_SMOOTH = $0B20; - {$EXTERNALSYM GL_LINE_SMOOTH} - GL_LINE_WIDTH = $0B21; - {$EXTERNALSYM GL_LINE_WIDTH} - GL_LINE_WIDTH_RANGE = $0B22; - {$EXTERNALSYM GL_LINE_WIDTH_RANGE} - GL_LINE_WIDTH_GRANULARITY = $0B23; - {$EXTERNALSYM GL_LINE_WIDTH_GRANULARITY} - GL_LINE_STIPPLE = $0B24; - {$EXTERNALSYM GL_LINE_STIPPLE} - GL_LINE_STIPPLE_PATTERN = $0B25; - {$EXTERNALSYM GL_LINE_STIPPLE_PATTERN} - GL_LINE_STIPPLE_REPEAT = $0B26; - {$EXTERNALSYM GL_LINE_STIPPLE_REPEAT} - - // polygons - GL_POLYGON_MODE = $0B40; - {$EXTERNALSYM GL_POLYGON_MODE} - GL_POLYGON_SMOOTH = $0B41; - {$EXTERNALSYM GL_POLYGON_SMOOTH} - GL_POLYGON_STIPPLE = $0B42; - {$EXTERNALSYM GL_POLYGON_STIPPLE} - GL_EDGE_FLAG = $0B43; - {$EXTERNALSYM GL_EDGE_FLAG} - GL_CULL_FACE = $0B44; - {$EXTERNALSYM GL_CULL_FACE} - GL_CULL_FACE_MODE = $0B45; - {$EXTERNALSYM GL_CULL_FACE_MODE} - GL_FRONT_FACE = $0B46; - {$EXTERNALSYM GL_FRONT_FACE} - GL_CW = $0900; - {$EXTERNALSYM GL_CW} - GL_CCW = $0901; - {$EXTERNALSYM GL_CCW} - GL_POINT = $1B00; - {$EXTERNALSYM GL_POINT} - GL_LINE = $1B01; - {$EXTERNALSYM GL_LINE} - GL_FILL = $1B02; - {$EXTERNALSYM GL_FILL} - - // display lists - GL_LIST_MODE = $0B30; - {$EXTERNALSYM GL_LIST_MODE} - GL_LIST_BASE = $0B32; - {$EXTERNALSYM GL_LIST_BASE} - GL_LIST_INDEX = $0B33; - {$EXTERNALSYM GL_LIST_INDEX} - GL_COMPILE = $1300; - {$EXTERNALSYM GL_COMPILE} - GL_COMPILE_AND_EXECUTE = $1301; - {$EXTERNALSYM GL_COMPILE_AND_EXECUTE} - - // lighting - GL_LIGHTING = $0B50; - {$EXTERNALSYM GL_LIGHTING} - GL_LIGHT_MODEL_LOCAL_VIEWER = $0B51; - {$EXTERNALSYM GL_LIGHT_MODEL_LOCAL_VIEWER} - GL_LIGHT_MODEL_TWO_SIDE = $0B52; - {$EXTERNALSYM GL_LIGHT_MODEL_TWO_SIDE} - GL_LIGHT_MODEL_AMBIENT = $0B53; - {$EXTERNALSYM GL_LIGHT_MODEL_AMBIENT} - GL_LIGHT_MODEL_COLOR_CONTROL = $81F8; // GL 1.2 - {$EXTERNALSYM GL_LIGHT_MODEL_COLOR_CONTROL} - GL_SHADE_MODEL = $0B54; - {$EXTERNALSYM GL_SHADE_MODEL} - GL_NORMALIZE = $0BA1; - {$EXTERNALSYM GL_NORMALIZE} - GL_AMBIENT = $1200; - {$EXTERNALSYM GL_AMBIENT} - GL_DIFFUSE = $1201; - {$EXTERNALSYM GL_DIFFUSE} - GL_SPECULAR = $1202; - {$EXTERNALSYM GL_SPECULAR} - GL_POSITION = $1203; - {$EXTERNALSYM GL_POSITION} - GL_SPOT_DIRECTION = $1204; - {$EXTERNALSYM GL_SPOT_DIRECTION} - GL_SPOT_EXPONENT = $1205; - {$EXTERNALSYM GL_SPOT_EXPONENT} - GL_SPOT_CUTOFF = $1206; - {$EXTERNALSYM GL_SPOT_CUTOFF} - GL_CONSTANT_ATTENUATION = $1207; - {$EXTERNALSYM GL_CONSTANT_ATTENUATION} - GL_LINEAR_ATTENUATION = $1208; - {$EXTERNALSYM GL_LINEAR_ATTENUATION} - GL_QUADRATIC_ATTENUATION = $1209; - {$EXTERNALSYM GL_QUADRATIC_ATTENUATION} - GL_EMISSION = $1600; - {$EXTERNALSYM GL_EMISSION} - GL_SHININESS = $1601; - {$EXTERNALSYM GL_SHININESS} - GL_AMBIENT_AND_DIFFUSE = $1602; - {$EXTERNALSYM GL_AMBIENT_AND_DIFFUSE} - GL_COLOR_INDEXES = $1603; - {$EXTERNALSYM GL_COLOR_INDEXES} - GL_FLAT = $1D00; - {$EXTERNALSYM GL_FLAT} - GL_SMOOTH = $1D01; - {$EXTERNALSYM GL_SMOOTH} - GL_LIGHT0 = $4000; - {$EXTERNALSYM GL_LIGHT0} - GL_LIGHT1 = $4001; - {$EXTERNALSYM GL_LIGHT1} - GL_LIGHT2 = $4002; - {$EXTERNALSYM GL_LIGHT2} - GL_LIGHT3 = $4003; - {$EXTERNALSYM GL_LIGHT3} - GL_LIGHT4 = $4004; - {$EXTERNALSYM GL_LIGHT4} - GL_LIGHT5 = $4005; - {$EXTERNALSYM GL_LIGHT5} - GL_LIGHT6 = $4006; - {$EXTERNALSYM GL_LIGHT6} - GL_LIGHT7 = $4007; - {$EXTERNALSYM GL_LIGHT7} - - // matrix modes - GL_MATRIX_MODE = $0BA0; - {$EXTERNALSYM GL_MATRIX_MODE} - GL_MODELVIEW = $1700; - {$EXTERNALSYM GL_MODELVIEW} - GL_PROJECTION = $1701; - {$EXTERNALSYM GL_PROJECTION} - GL_TEXTURE = $1702; - {$EXTERNALSYM GL_TEXTURE} - - // gets - GL_CURRENT_COLOR = $0B00; - {$EXTERNALSYM GL_CURRENT_COLOR} - GL_CURRENT_INDEX = $0B01; - {$EXTERNALSYM GL_CURRENT_INDEX} - GL_CURRENT_NORMAL = $0B02; - {$EXTERNALSYM GL_CURRENT_NORMAL} - GL_CURRENT_TEXTURE_COORDS = $0B03; - {$EXTERNALSYM GL_CURRENT_TEXTURE_COORDS} - GL_CURRENT_RASTER_COLOR = $0B04; - {$EXTERNALSYM GL_CURRENT_RASTER_COLOR} - GL_CURRENT_RASTER_INDEX = $0B05; - {$EXTERNALSYM GL_CURRENT_RASTER_INDEX} - GL_CURRENT_RASTER_TEXTURE_COORDS = $0B06; - {$EXTERNALSYM GL_CURRENT_RASTER_TEXTURE_COORDS} - GL_CURRENT_RASTER_POSITION = $0B07; - {$EXTERNALSYM GL_CURRENT_RASTER_POSITION} - GL_CURRENT_RASTER_POSITION_VALID = $0B08; - {$EXTERNALSYM GL_CURRENT_RASTER_POSITION_VALID} - GL_CURRENT_RASTER_DISTANCE = $0B09; - {$EXTERNALSYM GL_CURRENT_RASTER_DISTANCE} - GL_MAX_LIST_NESTING = $0B31; - {$EXTERNALSYM GL_MAX_LIST_NESTING} - GL_VIEWPORT = $0BA2; - {$EXTERNALSYM GL_VIEWPORT} - GL_MODELVIEW_STACK_DEPTH = $0BA3; - {$EXTERNALSYM GL_MODELVIEW_STACK_DEPTH} - GL_PROJECTION_STACK_DEPTH = $0BA4; - {$EXTERNALSYM GL_PROJECTION_STACK_DEPTH} - GL_TEXTURE_STACK_DEPTH = $0BA5; - {$EXTERNALSYM GL_TEXTURE_STACK_DEPTH} - GL_MODELVIEW_MATRIX = $0BA6; - {$EXTERNALSYM GL_MODELVIEW_MATRIX} - GL_PROJECTION_MATRIX = $0BA7; - {$EXTERNALSYM GL_PROJECTION_MATRIX} - GL_TEXTURE_MATRIX = $0BA8; - {$EXTERNALSYM GL_TEXTURE_MATRIX} - GL_ATTRIB_STACK_DEPTH = $0BB0; - {$EXTERNALSYM GL_ATTRIB_STACK_DEPTH} - GL_CLIENT_ATTRIB_STACK_DEPTH = $0BB1; - {$EXTERNALSYM GL_CLIENT_ATTRIB_STACK_DEPTH} - - GL_SINGLE_COLOR = $81F9; // GL 1.2 - {$EXTERNALSYM GL_SINGLE_COLOR} - GL_SEPARATE_SPECULAR_COLOR = $81FA; // GL 1.2 - {$EXTERNALSYM GL_SEPARATE_SPECULAR_COLOR} - - // alpha testing - GL_ALPHA_TEST = $0BC0; - {$EXTERNALSYM GL_ALPHA_TEST} - GL_ALPHA_TEST_FUNC = $0BC1; - {$EXTERNALSYM GL_ALPHA_TEST_FUNC} - GL_ALPHA_TEST_REF = $0BC2; - {$EXTERNALSYM GL_ALPHA_TEST_REF} - - GL_LOGIC_OP_MODE = $0BF0; - {$EXTERNALSYM GL_LOGIC_OP_MODE} - GL_INDEX_LOGIC_OP = $0BF1; - {$EXTERNALSYM GL_INDEX_LOGIC_OP} - GL_LOGIC_OP = $0BF1; - {$EXTERNALSYM GL_LOGIC_OP} - GL_COLOR_LOGIC_OP = $0BF2; - {$EXTERNALSYM GL_COLOR_LOGIC_OP} - GL_SCISSOR_BOX = $0C10; - {$EXTERNALSYM GL_SCISSOR_BOX} - GL_SCISSOR_TEST = $0C11; - {$EXTERNALSYM GL_SCISSOR_TEST} - GL_INDEX_CLEAR_VALUE = $0C20; - {$EXTERNALSYM GL_INDEX_CLEAR_VALUE} - GL_INDEX_WRITEMASK = $0C21; - {$EXTERNALSYM GL_INDEX_WRITEMASK} - GL_COLOR_CLEAR_VALUE = $0C22; - {$EXTERNALSYM GL_COLOR_CLEAR_VALUE} - GL_COLOR_WRITEMASK = $0C23; - {$EXTERNALSYM GL_COLOR_WRITEMASK} - GL_INDEX_MODE = $0C30; - {$EXTERNALSYM GL_INDEX_MODE} - GL_RGBA_MODE = $0C31; - {$EXTERNALSYM GL_RGBA_MODE} - GL_RENDER_MODE = $0C40; - {$EXTERNALSYM GL_RENDER_MODE} - GL_PERSPECTIVE_CORRECTION_HINT = $0C50; - {$EXTERNALSYM GL_PERSPECTIVE_CORRECTION_HINT} - GL_POINT_SMOOTH_HINT = $0C51; - {$EXTERNALSYM GL_POINT_SMOOTH_HINT} - GL_LINE_SMOOTH_HINT = $0C52; - {$EXTERNALSYM GL_LINE_SMOOTH_HINT} - GL_POLYGON_SMOOTH_HINT = $0C53; - {$EXTERNALSYM GL_POLYGON_SMOOTH_HINT} - GL_FOG_HINT = $0C54; - {$EXTERNALSYM GL_FOG_HINT} - GL_TEXTURE_GEN_S = $0C60; - {$EXTERNALSYM GL_TEXTURE_GEN_S} - GL_TEXTURE_GEN_T = $0C61; - {$EXTERNALSYM GL_TEXTURE_GEN_T} - GL_TEXTURE_GEN_R = $0C62; - {$EXTERNALSYM GL_TEXTURE_GEN_R} - GL_TEXTURE_GEN_Q = $0C63; - {$EXTERNALSYM GL_TEXTURE_GEN_Q} - GL_PIXEL_MAP_I_TO_I_SIZE = $0CB0; - {$EXTERNALSYM GL_PIXEL_MAP_I_TO_I_SIZE} - GL_PIXEL_MAP_S_TO_S_SIZE = $0CB1; - {$EXTERNALSYM GL_PIXEL_MAP_S_TO_S_SIZE} - GL_PIXEL_MAP_I_TO_R_SIZE = $0CB2; - {$EXTERNALSYM GL_PIXEL_MAP_I_TO_R_SIZE} - GL_PIXEL_MAP_I_TO_G_SIZE = $0CB3; - {$EXTERNALSYM GL_PIXEL_MAP_I_TO_G_SIZE} - GL_PIXEL_MAP_I_TO_B_SIZE = $0CB4; - {$EXTERNALSYM GL_PIXEL_MAP_I_TO_B_SIZE} - GL_PIXEL_MAP_I_TO_A_SIZE = $0CB5; - {$EXTERNALSYM GL_PIXEL_MAP_I_TO_A_SIZE} - GL_PIXEL_MAP_R_TO_R_SIZE = $0CB6; - {$EXTERNALSYM GL_PIXEL_MAP_R_TO_R_SIZE} - GL_PIXEL_MAP_G_TO_G_SIZE = $0CB7; - {$EXTERNALSYM GL_PIXEL_MAP_G_TO_G_SIZE} - GL_PIXEL_MAP_B_TO_B_SIZE = $0CB8; - {$EXTERNALSYM GL_PIXEL_MAP_B_TO_B_SIZE} - GL_PIXEL_MAP_A_TO_A_SIZE = $0CB9; - {$EXTERNALSYM GL_PIXEL_MAP_A_TO_A_SIZE} - GL_UNPACK_SWAP_BYTES = $0CF0; - {$EXTERNALSYM GL_UNPACK_SWAP_BYTES} - GL_UNPACK_LSB_FIRST = $0CF1; - {$EXTERNALSYM GL_UNPACK_LSB_FIRST} - GL_UNPACK_ROW_LENGTH = $0CF2; - {$EXTERNALSYM GL_UNPACK_ROW_LENGTH} - GL_UNPACK_SKIP_ROWS = $0CF3; - {$EXTERNALSYM GL_UNPACK_SKIP_ROWS} - GL_UNPACK_SKIP_PIXELS = $0CF4; - {$EXTERNALSYM GL_UNPACK_SKIP_PIXELS} - GL_UNPACK_ALIGNMENT = $0CF5; - {$EXTERNALSYM GL_UNPACK_ALIGNMENT} - GL_PACK_SWAP_BYTES = $0D00; - {$EXTERNALSYM GL_PACK_SWAP_BYTES} - GL_PACK_LSB_FIRST = $0D01; - {$EXTERNALSYM GL_PACK_LSB_FIRST} - GL_PACK_ROW_LENGTH = $0D02; - {$EXTERNALSYM GL_PACK_ROW_LENGTH} - GL_PACK_SKIP_ROWS = $0D03; - {$EXTERNALSYM GL_PACK_SKIP_ROWS} - GL_PACK_SKIP_PIXELS = $0D04; - {$EXTERNALSYM GL_PACK_SKIP_PIXELS} - GL_PACK_ALIGNMENT = $0D05; - {$EXTERNALSYM GL_PACK_ALIGNMENT} - GL_PACK_SKIP_IMAGES = $806B; // GL 1.2 - {$EXTERNALSYM GL_PACK_SKIP_IMAGES} - GL_PACK_IMAGE_HEIGHT = $806C; // GL 1.2 - {$EXTERNALSYM GL_PACK_IMAGE_HEIGHT} - GL_UNPACK_SKIP_IMAGES = $806D; // GL 1.2 - {$EXTERNALSYM GL_UNPACK_SKIP_IMAGES} - GL_UNPACK_IMAGE_HEIGHT = $806E; // GL 1.2 - {$EXTERNALSYM GL_UNPACK_IMAGE_HEIGHT} - GL_MAP_COLOR = $0D10; - {$EXTERNALSYM GL_MAP_COLOR} - GL_MAP_STENCIL = $0D11; - {$EXTERNALSYM GL_MAP_STENCIL} - GL_INDEX_SHIFT = $0D12; - {$EXTERNALSYM GL_INDEX_SHIFT} - GL_INDEX_OFFSET = $0D13; - {$EXTERNALSYM GL_INDEX_OFFSET} - GL_RED_SCALE = $0D14; - {$EXTERNALSYM GL_RED_SCALE} - GL_RED_BIAS = $0D15; - {$EXTERNALSYM GL_RED_BIAS} - GL_ZOOM_X = $0D16; - {$EXTERNALSYM GL_ZOOM_X} - GL_ZOOM_Y = $0D17; - {$EXTERNALSYM GL_ZOOM_Y} - GL_GREEN_SCALE = $0D18; - {$EXTERNALSYM GL_GREEN_SCALE} - GL_GREEN_BIAS = $0D19; - {$EXTERNALSYM GL_GREEN_BIAS} - GL_BLUE_SCALE = $0D1A; - {$EXTERNALSYM GL_BLUE_SCALE} - GL_BLUE_BIAS = $0D1B; - {$EXTERNALSYM GL_BLUE_BIAS} - GL_ALPHA_SCALE = $0D1C; - {$EXTERNALSYM GL_ALPHA_SCALE} - GL_ALPHA_BIAS = $0D1D; - {$EXTERNALSYM GL_ALPHA_BIAS} - GL_DEPTH_SCALE = $0D1E; - {$EXTERNALSYM GL_DEPTH_SCALE} - GL_DEPTH_BIAS = $0D1F; - {$EXTERNALSYM GL_DEPTH_BIAS} - GL_MAX_EVAL_ORDER = $0D30; - {$EXTERNALSYM GL_MAX_EVAL_ORDER} - GL_MAX_LIGHTS = $0D31; - {$EXTERNALSYM GL_MAX_LIGHTS} - GL_MAX_CLIP_PLANES = $0D32; - {$EXTERNALSYM GL_MAX_CLIP_PLANES} - GL_MAX_TEXTURE_SIZE = $0D33; - {$EXTERNALSYM GL_MAX_TEXTURE_SIZE} - GL_MAX_3D_TEXTURE_SIZE = $8073; // GL 1.2 - {$EXTERNALSYM GL_MAX_3D_TEXTURE_SIZE} - GL_MAX_PIXEL_MAP_TABLE = $0D34; - {$EXTERNALSYM GL_MAX_PIXEL_MAP_TABLE} - GL_MAX_ATTRIB_STACK_DEPTH = $0D35; - {$EXTERNALSYM GL_MAX_ATTRIB_STACK_DEPTH} - GL_MAX_MODELVIEW_STACK_DEPTH = $0D36; - {$EXTERNALSYM GL_MAX_MODELVIEW_STACK_DEPTH} - GL_MAX_NAME_STACK_DEPTH = $0D37; - {$EXTERNALSYM GL_MAX_NAME_STACK_DEPTH} - GL_MAX_PROJECTION_STACK_DEPTH = $0D38; - {$EXTERNALSYM GL_MAX_PROJECTION_STACK_DEPTH} - GL_MAX_TEXTURE_STACK_DEPTH = $0D39; - {$EXTERNALSYM GL_MAX_TEXTURE_STACK_DEPTH} - GL_MAX_VIEWPORT_DIMS = $0D3A; - {$EXTERNALSYM GL_MAX_VIEWPORT_DIMS} - GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = $0D3B; - {$EXTERNALSYM GL_MAX_CLIENT_ATTRIB_STACK_DEPTH} - GL_MAX_ELEMENTS_VERTICES = $80E8; // GL 1.2 - {$EXTERNALSYM GL_MAX_ELEMENTS_VERTICES} - GL_MAX_ELEMENTS_INDICES = $80E9; // GL 1.2 - {$EXTERNALSYM GL_MAX_ELEMENTS_INDICES} - GL_RESCALE_NORMAL = $803A; // GL 1.2 - {$EXTERNALSYM GL_RESCALE_NORMAL} - GL_SUBPIXEL_BITS = $0D50; - {$EXTERNALSYM GL_SUBPIXEL_BITS} - GL_INDEX_BITS = $0D51; - {$EXTERNALSYM GL_INDEX_BITS} - GL_RED_BITS = $0D52; - {$EXTERNALSYM GL_RED_BITS} - GL_GREEN_BITS = $0D53; - {$EXTERNALSYM GL_GREEN_BITS} - GL_BLUE_BITS = $0D54; - {$EXTERNALSYM GL_BLUE_BITS} - GL_ALPHA_BITS = $0D55; - {$EXTERNALSYM GL_ALPHA_BITS} - GL_DEPTH_BITS = $0D56; - {$EXTERNALSYM GL_DEPTH_BITS} - GL_STENCIL_BITS = $0D57; - {$EXTERNALSYM GL_STENCIL_BITS} - GL_ACCUM_RED_BITS = $0D58; - {$EXTERNALSYM GL_ACCUM_RED_BITS} - GL_ACCUM_GREEN_BITS = $0D59; - {$EXTERNALSYM GL_ACCUM_GREEN_BITS} - GL_ACCUM_BLUE_BITS = $0D5A; - {$EXTERNALSYM GL_ACCUM_BLUE_BITS} - GL_ACCUM_ALPHA_BITS = $0D5B; - {$EXTERNALSYM GL_ACCUM_ALPHA_BITS} - GL_NAME_STACK_DEPTH = $0D70; - {$EXTERNALSYM GL_NAME_STACK_DEPTH} - GL_AUTO_NORMAL = $0D80; - {$EXTERNALSYM GL_AUTO_NORMAL} - GL_MAP1_COLOR_4 = $0D90; - {$EXTERNALSYM GL_MAP1_COLOR_4} - GL_MAP1_INDEX = $0D91; - {$EXTERNALSYM GL_MAP1_INDEX} - GL_MAP1_NORMAL = $0D92; - {$EXTERNALSYM GL_MAP1_NORMAL} - GL_MAP1_TEXTURE_COORD_1 = $0D93; - {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_1} - GL_MAP1_TEXTURE_COORD_2 = $0D94; - {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_2} - GL_MAP1_TEXTURE_COORD_3 = $0D95; - {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_3} - GL_MAP1_TEXTURE_COORD_4 = $0D96; - {$EXTERNALSYM GL_MAP1_TEXTURE_COORD_4} - GL_MAP1_VERTEX_3 = $0D97; - {$EXTERNALSYM GL_MAP1_VERTEX_3} - GL_MAP1_VERTEX_4 = $0D98; - {$EXTERNALSYM GL_MAP1_VERTEX_4} - GL_MAP2_COLOR_4 = $0DB0; - {$EXTERNALSYM GL_MAP2_COLOR_4} - GL_MAP2_INDEX = $0DB1; - {$EXTERNALSYM GL_MAP2_INDEX} - GL_MAP2_NORMAL = $0DB2; - {$EXTERNALSYM GL_MAP2_NORMAL} - GL_MAP2_TEXTURE_COORD_1 = $0DB3; - {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_1} - GL_MAP2_TEXTURE_COORD_2 = $0DB4; - {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_2} - GL_MAP2_TEXTURE_COORD_3 = $0DB5; - {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_3} - GL_MAP2_TEXTURE_COORD_4 = $0DB6; - {$EXTERNALSYM GL_MAP2_TEXTURE_COORD_4} - GL_MAP2_VERTEX_3 = $0DB7; - {$EXTERNALSYM GL_MAP2_VERTEX_3} - GL_MAP2_VERTEX_4 = $0DB8; - {$EXTERNALSYM GL_MAP2_VERTEX_4} - GL_MAP1_GRID_DOMAIN = $0DD0; - {$EXTERNALSYM GL_MAP1_GRID_DOMAIN} - GL_MAP1_GRID_SEGMENTS = $0DD1; - {$EXTERNALSYM GL_MAP1_GRID_SEGMENTS} - GL_MAP2_GRID_DOMAIN = $0DD2; - {$EXTERNALSYM GL_MAP2_GRID_DOMAIN} - GL_MAP2_GRID_SEGMENTS = $0DD3; - {$EXTERNALSYM GL_MAP2_GRID_SEGMENTS} - GL_TEXTURE_1D = $0DE0; - {$EXTERNALSYM GL_TEXTURE_1D} - GL_TEXTURE_2D = $0DE1; - {$EXTERNALSYM GL_TEXTURE_2D} - GL_TEXTURE_3D = $806F; // GL 1.2 - {$EXTERNALSYM GL_TEXTURE_3D} - GL_SELECTION_BUFFER_POINTER = $0DF3; - {$EXTERNALSYM GL_SELECTION_BUFFER_POINTER} - GL_SELECTION_BUFFER_SIZE = $0DF4; - {$EXTERNALSYM GL_SELECTION_BUFFER_SIZE} - GL_POLYGON_OFFSET_UNITS = $2A00; - {$EXTERNALSYM GL_POLYGON_OFFSET_UNITS} - GL_POLYGON_OFFSET_POINT = $2A01; - {$EXTERNALSYM GL_POLYGON_OFFSET_POINT} - GL_POLYGON_OFFSET_LINE = $2A02; - {$EXTERNALSYM GL_POLYGON_OFFSET_LINE} - GL_POLYGON_OFFSET_FILL = $8037; - {$EXTERNALSYM GL_POLYGON_OFFSET_FILL} - GL_POLYGON_OFFSET_FACTOR = $8038; - {$EXTERNALSYM GL_POLYGON_OFFSET_FACTOR} - GL_TEXTURE_BINDING_1D = $8068; - {$EXTERNALSYM GL_TEXTURE_BINDING_1D} - GL_TEXTURE_BINDING_2D = $8069; - {$EXTERNALSYM GL_TEXTURE_BINDING_2D} - GL_VERTEX_ARRAY = $8074; - {$EXTERNALSYM GL_VERTEX_ARRAY} - GL_NORMAL_ARRAY = $8075; - {$EXTERNALSYM GL_NORMAL_ARRAY} - GL_COLOR_ARRAY = $8076; - {$EXTERNALSYM GL_COLOR_ARRAY} - GL_INDEX_ARRAY = $8077; - {$EXTERNALSYM GL_INDEX_ARRAY} - GL_TEXTURE_COORD_ARRAY = $8078; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY} - GL_EDGE_FLAG_ARRAY = $8079; - {$EXTERNALSYM GL_EDGE_FLAG_ARRAY} - GL_VERTEX_ARRAY_SIZE = $807A; - {$EXTERNALSYM GL_VERTEX_ARRAY_SIZE} - GL_VERTEX_ARRAY_TYPE = $807B; - {$EXTERNALSYM GL_VERTEX_ARRAY_TYPE} - GL_VERTEX_ARRAY_STRIDE = $807C; - {$EXTERNALSYM GL_VERTEX_ARRAY_STRIDE} - GL_NORMAL_ARRAY_TYPE = $807E; - {$EXTERNALSYM GL_NORMAL_ARRAY_TYPE} - GL_NORMAL_ARRAY_STRIDE = $807F; - {$EXTERNALSYM GL_NORMAL_ARRAY_STRIDE} - GL_COLOR_ARRAY_SIZE = $8081; - {$EXTERNALSYM GL_COLOR_ARRAY_SIZE} - GL_COLOR_ARRAY_TYPE = $8082; - {$EXTERNALSYM GL_COLOR_ARRAY_TYPE} - GL_COLOR_ARRAY_STRIDE = $8083; - {$EXTERNALSYM GL_COLOR_ARRAY_STRIDE} - GL_INDEX_ARRAY_TYPE = $8085; - {$EXTERNALSYM GL_INDEX_ARRAY_TYPE} - GL_INDEX_ARRAY_STRIDE = $8086; - {$EXTERNALSYM GL_INDEX_ARRAY_STRIDE} - GL_TEXTURE_COORD_ARRAY_SIZE = $8088; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_SIZE} - GL_TEXTURE_COORD_ARRAY_TYPE = $8089; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_TYPE} - GL_TEXTURE_COORD_ARRAY_STRIDE = $808A; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_STRIDE} - GL_EDGE_FLAG_ARRAY_STRIDE = $808C; - {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_STRIDE} - GL_COLOR_MATRIX = $80B1; // GL 1.2 ARB imaging - {$EXTERNALSYM GL_COLOR_MATRIX} - GL_COLOR_MATRIX_STACK_DEPTH = $80B2; // GL 1.2 ARB imaging - {$EXTERNALSYM GL_COLOR_MATRIX_STACK_DEPTH} - GL_MAX_COLOR_MATRIX_STACK_DEPTH = $80B3; // GL 1.2 ARB imaging - {$EXTERNALSYM GL_MAX_COLOR_MATRIX_STACK_DEPTH} - GL_POST_COLOR_MATRIX_RED_SCALE = $80B4; // GL 1.2 ARB imaging - {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_SCALE} - GL_POST_COLOR_MATRIX_GREEN_SCALE = $80B5; // GL 1.2 ARB imaging - {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_SCALE} - GL_POST_COLOR_MATRIX_BLUE_SCALE = $80B6; // GL 1.2 ARB imaging - {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_SCALE} - GL_POST_COLOR_MATRIX_ALPHA_SCALE = $80B7; // GL 1.2 ARB imaging - {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_SCALE} - GL_POST_COLOR_MATRIX_RED_BIAS = $80B8; // GL 1.2 ARB imaging - {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_BIAS} - GL_POST_COLOR_MATRIX_GREEN_BIAS = $80B9; // GL 1.2 ARB imaging - {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_BIAS} - GL_POST_COLOR_MATRIX_BLUE_BIAS = $80BA; // GL 1.2 ARB imaging - {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_BIAS} - GL_POST_COLOR_MATRIX_ALPHA_BIAS = $80BB; // GL 1.2 ARB imaging - {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_BIAS} - - // evaluators - GL_COEFF = $0A00; - {$EXTERNALSYM GL_COEFF} - GL_ORDER = $0A01; - {$EXTERNALSYM GL_ORDER} - GL_DOMAIN = $0A02; - {$EXTERNALSYM GL_DOMAIN} - - // texture mapping - GL_TEXTURE_WIDTH = $1000; - {$EXTERNALSYM GL_TEXTURE_WIDTH} - GL_TEXTURE_HEIGHT = $1001; - {$EXTERNALSYM GL_TEXTURE_HEIGHT} - GL_TEXTURE_INTERNAL_FORMAT = $1003; - {$EXTERNALSYM GL_TEXTURE_INTERNAL_FORMAT} - GL_TEXTURE_COMPONENTS = $1003; - {$EXTERNALSYM GL_TEXTURE_COMPONENTS} - GL_TEXTURE_BORDER_COLOR = $1004; - {$EXTERNALSYM GL_TEXTURE_BORDER_COLOR} - GL_TEXTURE_BORDER = $1005; - {$EXTERNALSYM GL_TEXTURE_BORDER} - GL_TEXTURE_RED_SIZE = $805C; - {$EXTERNALSYM GL_TEXTURE_RED_SIZE} - GL_TEXTURE_GREEN_SIZE = $805D; - {$EXTERNALSYM GL_TEXTURE_GREEN_SIZE} - GL_TEXTURE_BLUE_SIZE = $805E; - {$EXTERNALSYM GL_TEXTURE_BLUE_SIZE} - GL_TEXTURE_ALPHA_SIZE = $805F; - {$EXTERNALSYM GL_TEXTURE_ALPHA_SIZE} - GL_TEXTURE_LUMINANCE_SIZE = $8060; - {$EXTERNALSYM GL_TEXTURE_LUMINANCE_SIZE} - GL_TEXTURE_INTENSITY_SIZE = $8061; - {$EXTERNALSYM GL_TEXTURE_INTENSITY_SIZE} - GL_TEXTURE_PRIORITY = $8066; - {$EXTERNALSYM GL_TEXTURE_PRIORITY} - GL_TEXTURE_RESIDENT = $8067; - {$EXTERNALSYM GL_TEXTURE_RESIDENT} - GL_BGR = $80E0; // v 1.2 - {$EXTERNALSYM GL_BGR} - GL_BGRA = $80E1; // v 1.2 - {$EXTERNALSYM GL_BGRA} - GL_S = $2000; - {$EXTERNALSYM GL_S} - GL_T = $2001; - {$EXTERNALSYM GL_T} - GL_R = $2002; - {$EXTERNALSYM GL_R} - GL_Q = $2003; - {$EXTERNALSYM GL_Q} - GL_MODULATE = $2100; - {$EXTERNALSYM GL_MODULATE} - GL_DECAL = $2101; - {$EXTERNALSYM GL_DECAL} - GL_TEXTURE_ENV_MODE = $2200; - {$EXTERNALSYM GL_TEXTURE_ENV_MODE} - GL_TEXTURE_ENV_COLOR = $2201; - {$EXTERNALSYM GL_TEXTURE_ENV_COLOR} - GL_TEXTURE_ENV = $2300; - {$EXTERNALSYM GL_TEXTURE_ENV} - GL_EYE_LINEAR = $2400; - {$EXTERNALSYM GL_EYE_LINEAR} - GL_OBJECT_LINEAR = $2401; - {$EXTERNALSYM GL_OBJECT_LINEAR} - GL_SPHERE_MAP = $2402; - {$EXTERNALSYM GL_SPHERE_MAP} - GL_TEXTURE_GEN_MODE = $2500; - {$EXTERNALSYM GL_TEXTURE_GEN_MODE} - GL_OBJECT_PLANE = $2501; - {$EXTERNALSYM GL_OBJECT_PLANE} - GL_EYE_PLANE = $2502; - {$EXTERNALSYM GL_EYE_PLANE} - GL_NEAREST = $2600; - {$EXTERNALSYM GL_NEAREST} - GL_LINEAR = $2601; - {$EXTERNALSYM GL_LINEAR} - GL_NEAREST_MIPMAP_NEAREST = $2700; - {$EXTERNALSYM GL_NEAREST_MIPMAP_NEAREST} - GL_LINEAR_MIPMAP_NEAREST = $2701; - {$EXTERNALSYM GL_LINEAR_MIPMAP_NEAREST} - GL_NEAREST_MIPMAP_LINEAR = $2702; - {$EXTERNALSYM GL_NEAREST_MIPMAP_LINEAR} - GL_LINEAR_MIPMAP_LINEAR = $2703; - {$EXTERNALSYM GL_LINEAR_MIPMAP_LINEAR} - GL_TEXTURE_MAG_FILTER = $2800; - {$EXTERNALSYM GL_TEXTURE_MAG_FILTER} - GL_TEXTURE_MIN_FILTER = $2801; - {$EXTERNALSYM GL_TEXTURE_MIN_FILTER} - GL_TEXTURE_WRAP_R = $8072; // GL 1.2 - {$EXTERNALSYM GL_TEXTURE_WRAP_R} - GL_TEXTURE_WRAP_S = $2802; - {$EXTERNALSYM GL_TEXTURE_WRAP_S} - GL_TEXTURE_WRAP_T = $2803; - {$EXTERNALSYM GL_TEXTURE_WRAP_T} - GL_CLAMP_TO_EDGE = $812F; // GL 1.2 - {$EXTERNALSYM GL_CLAMP_TO_EDGE} - GL_TEXTURE_MIN_LOD = $813A; // GL 1.2 - {$EXTERNALSYM GL_TEXTURE_MIN_LOD} - GL_TEXTURE_MAX_LOD = $813B; // GL 1.2 - {$EXTERNALSYM GL_TEXTURE_MAX_LOD} - GL_TEXTURE_BASE_LEVEL = $813C; // GL 1.2 - {$EXTERNALSYM GL_TEXTURE_BASE_LEVEL} - GL_TEXTURE_MAX_LEVEL = $813D; // GL 1.2 - {$EXTERNALSYM GL_TEXTURE_MAX_LEVEL} - GL_TEXTURE_DEPTH = $8071; // GL 1.2 - {$EXTERNALSYM GL_TEXTURE_DEPTH} - GL_PROXY_TEXTURE_1D = $8063; - {$EXTERNALSYM GL_PROXY_TEXTURE_1D} - GL_PROXY_TEXTURE_2D = $8064; - {$EXTERNALSYM GL_PROXY_TEXTURE_2D} - GL_PROXY_TEXTURE_3D = $8070; // GL 1.2 - {$EXTERNALSYM GL_PROXY_TEXTURE_3D} - GL_CLAMP = $2900; - {$EXTERNALSYM GL_CLAMP} - GL_REPEAT = $2901; - {$EXTERNALSYM GL_REPEAT} - - // hints - GL_DONT_CARE = $1100; - {$EXTERNALSYM GL_DONT_CARE} - GL_FASTEST = $1101; - {$EXTERNALSYM GL_FASTEST} - GL_NICEST = $1102; - {$EXTERNALSYM GL_NICEST} - - // data types - GL_BYTE = $1400; - {$EXTERNALSYM GL_BYTE} - GL_UNSIGNED_BYTE = $1401; - {$EXTERNALSYM GL_UNSIGNED_BYTE} - GL_SHORT = $1402; - {$EXTERNALSYM GL_SHORT} - GL_UNSIGNED_SHORT = $1403; - {$EXTERNALSYM GL_UNSIGNED_SHORT} - GL_INT = $1404; - {$EXTERNALSYM GL_INT} - GL_UNSIGNED_INT = $1405; - {$EXTERNALSYM GL_UNSIGNED_INT} - GL_FLOAT = $1406; - {$EXTERNALSYM GL_FLOAT} - GL_2_BYTES = $1407; - {$EXTERNALSYM GL_2_BYTES} - GL_3_BYTES = $1408; - {$EXTERNALSYM GL_3_BYTES} - GL_4_BYTES = $1409; - {$EXTERNALSYM GL_4_BYTES} - GL_DOUBLE = $140A; - {$EXTERNALSYM GL_DOUBLE} - GL_DOUBLE_EXT = $140A; - {$EXTERNALSYM GL_DOUBLE_EXT} - - // logic operations - GL_CLEAR = $1500; - {$EXTERNALSYM GL_CLEAR} - GL_AND = $1501; - {$EXTERNALSYM GL_AND} - GL_AND_REVERSE = $1502; - {$EXTERNALSYM GL_AND_REVERSE} - GL_COPY = $1503; - {$EXTERNALSYM GL_COPY} - GL_AND_INVERTED = $1504; - {$EXTERNALSYM GL_AND_INVERTED} - GL_NOOP = $1505; - {$EXTERNALSYM GL_NOOP} - GL_XOR = $1506; - {$EXTERNALSYM GL_XOR} - GL_OR = $1507; - {$EXTERNALSYM GL_OR} - GL_NOR = $1508; - {$EXTERNALSYM GL_NOR} - GL_EQUIV = $1509; - {$EXTERNALSYM GL_EQUIV} - GL_INVERT = $150A; - {$EXTERNALSYM GL_INVERT} - GL_OR_REVERSE = $150B; - {$EXTERNALSYM GL_OR_REVERSE} - GL_COPY_INVERTED = $150C; - {$EXTERNALSYM GL_COPY_INVERTED} - GL_OR_INVERTED = $150D; - {$EXTERNALSYM GL_OR_INVERTED} - GL_NAND = $150E; - {$EXTERNALSYM GL_NAND} - GL_SET = $150F; - {$EXTERNALSYM GL_SET} - - // PixelCopyType - GL_COLOR = $1800; - {$EXTERNALSYM GL_COLOR} - GL_DEPTH = $1801; - {$EXTERNALSYM GL_DEPTH} - GL_STENCIL = $1802; - {$EXTERNALSYM GL_STENCIL} - - // pixel formats - GL_COLOR_INDEX = $1900; - {$EXTERNALSYM GL_COLOR_INDEX} - GL_STENCIL_INDEX = $1901; - {$EXTERNALSYM GL_STENCIL_INDEX} - GL_DEPTH_COMPONENT = $1902; - {$EXTERNALSYM GL_DEPTH_COMPONENT} - GL_RED = $1903; - {$EXTERNALSYM GL_RED} - GL_GREEN = $1904; - {$EXTERNALSYM GL_GREEN} - GL_BLUE = $1905; - {$EXTERNALSYM GL_BLUE} - GL_ALPHA = $1906; - {$EXTERNALSYM GL_ALPHA} - GL_RGB = $1907; - {$EXTERNALSYM GL_RGB} - GL_RGBA = $1908; - {$EXTERNALSYM GL_RGBA} - GL_LUMINANCE = $1909; - {$EXTERNALSYM GL_LUMINANCE} - GL_LUMINANCE_ALPHA = $190A; - {$EXTERNALSYM GL_LUMINANCE_ALPHA} - - // pixel type - GL_BITMAP = $1A00; - {$EXTERNALSYM GL_BITMAP} - - // rendering modes - GL_RENDER = $1C00; - {$EXTERNALSYM GL_RENDER} - GL_FEEDBACK = $1C01; - {$EXTERNALSYM GL_FEEDBACK} - GL_SELECT = $1C02; - {$EXTERNALSYM GL_SELECT} - - // implementation strings - GL_VENDOR = $1F00; - {$EXTERNALSYM GL_VENDOR} - GL_RENDERER = $1F01; - {$EXTERNALSYM GL_RENDERER} - GL_VERSION = $1F02; - {$EXTERNALSYM GL_VERSION} - GL_EXTENSIONS = $1F03; - {$EXTERNALSYM GL_EXTENSIONS} - - // pixel formats - GL_R3_G3_B2 = $2A10; - {$EXTERNALSYM GL_R3_G3_B2} - GL_ALPHA4 = $803B; - {$EXTERNALSYM GL_ALPHA4} - GL_ALPHA8 = $803C; - {$EXTERNALSYM GL_ALPHA8} - GL_ALPHA12 = $803D; - {$EXTERNALSYM GL_ALPHA12} - GL_ALPHA16 = $803E; - {$EXTERNALSYM GL_ALPHA16} - GL_LUMINANCE4 = $803F; - {$EXTERNALSYM GL_LUMINANCE4} - GL_LUMINANCE8 = $8040; - {$EXTERNALSYM GL_LUMINANCE8} - GL_LUMINANCE12 = $8041; - {$EXTERNALSYM GL_LUMINANCE12} - GL_LUMINANCE16 = $8042; - {$EXTERNALSYM GL_LUMINANCE16} - GL_LUMINANCE4_ALPHA4 = $8043; - {$EXTERNALSYM GL_LUMINANCE4_ALPHA4} - GL_LUMINANCE6_ALPHA2 = $8044; - {$EXTERNALSYM GL_LUMINANCE6_ALPHA2} - GL_LUMINANCE8_ALPHA8 = $8045; - {$EXTERNALSYM GL_LUMINANCE8_ALPHA8} - GL_LUMINANCE12_ALPHA4 = $8046; - {$EXTERNALSYM GL_LUMINANCE12_ALPHA4} - GL_LUMINANCE12_ALPHA12 = $8047; - {$EXTERNALSYM GL_LUMINANCE12_ALPHA12} - GL_LUMINANCE16_ALPHA16 = $8048; - {$EXTERNALSYM GL_LUMINANCE16_ALPHA16} - GL_INTENSITY = $8049; - {$EXTERNALSYM GL_INTENSITY} - GL_INTENSITY4 = $804A; - {$EXTERNALSYM GL_INTENSITY4} - GL_INTENSITY8 = $804B; - {$EXTERNALSYM GL_INTENSITY8} - GL_INTENSITY12 = $804C; - {$EXTERNALSYM GL_INTENSITY12} - GL_INTENSITY16 = $804D; - {$EXTERNALSYM GL_INTENSITY16} - GL_RGB4 = $804F; - {$EXTERNALSYM GL_RGB4} - GL_RGB5 = $8050; - {$EXTERNALSYM GL_RGB5} - GL_RGB8 = $8051; - {$EXTERNALSYM GL_RGB8} - GL_RGB10 = $8052; - {$EXTERNALSYM GL_RGB10} - GL_RGB12 = $8053; - {$EXTERNALSYM GL_RGB12} - GL_RGB16 = $8054; - {$EXTERNALSYM GL_RGB16} - GL_RGBA2 = $8055; - {$EXTERNALSYM GL_RGBA2} - GL_RGBA4 = $8056; - {$EXTERNALSYM GL_RGBA4} - GL_RGB5_A1 = $8057; - {$EXTERNALSYM GL_RGB5_A1} - GL_RGBA8 = $8058; - {$EXTERNALSYM GL_RGBA8} - GL_RGB10_A2 = $8059; - {$EXTERNALSYM GL_RGB10_A2} - GL_RGBA12 = $805A; - {$EXTERNALSYM GL_RGBA12} - GL_RGBA16 = $805B; - {$EXTERNALSYM GL_RGBA16} - UNSIGNED_BYTE_3_3_2 = $8032; // GL 1.2 - {$EXTERNALSYM UNSIGNED_BYTE_3_3_2} - UNSIGNED_BYTE_2_3_3_REV = $8362; // GL 1.2 - {$EXTERNALSYM UNSIGNED_BYTE_2_3_3_REV} - UNSIGNED_SHORT_5_6_5 = $8363; // GL 1.2 - {$EXTERNALSYM UNSIGNED_SHORT_5_6_5} - UNSIGNED_SHORT_5_6_5_REV = $8364; // GL 1.2 - {$EXTERNALSYM UNSIGNED_SHORT_5_6_5_REV} - UNSIGNED_SHORT_4_4_4_4 = $8033; // GL 1.2 - {$EXTERNALSYM UNSIGNED_SHORT_4_4_4_4} - UNSIGNED_SHORT_4_4_4_4_REV = $8365; // GL 1.2 - {$EXTERNALSYM UNSIGNED_SHORT_4_4_4_4_REV} - UNSIGNED_SHORT_5_5_5_1 = $8034; // GL 1.2 - {$EXTERNALSYM UNSIGNED_SHORT_5_5_5_1} - UNSIGNED_SHORT_1_5_5_5_REV = $8366; // GL 1.2 - {$EXTERNALSYM UNSIGNED_SHORT_1_5_5_5_REV} - UNSIGNED_INT_8_8_8_8 = $8035; // GL 1.2 - {$EXTERNALSYM UNSIGNED_INT_8_8_8_8} - UNSIGNED_INT_8_8_8_8_REV = $8367; // GL 1.2 - {$EXTERNALSYM UNSIGNED_INT_8_8_8_8_REV} - UNSIGNED_INT_10_10_10_2 = $8036; // GL 1.2 - {$EXTERNALSYM UNSIGNED_INT_10_10_10_2} - UNSIGNED_INT_2_10_10_10_REV = $8368; // GL 1.2 - {$EXTERNALSYM UNSIGNED_INT_2_10_10_10_REV} - - // interleaved arrays formats - GL_V2F = $2A20; - {$EXTERNALSYM GL_V2F} - GL_V3F = $2A21; - {$EXTERNALSYM GL_V3F} - GL_C4UB_V2F = $2A22; - {$EXTERNALSYM GL_C4UB_V2F} - GL_C4UB_V3F = $2A23; - {$EXTERNALSYM GL_C4UB_V3F} - GL_C3F_V3F = $2A24; - {$EXTERNALSYM GL_C3F_V3F} - GL_N3F_V3F = $2A25; - {$EXTERNALSYM GL_N3F_V3F} - GL_C4F_N3F_V3F = $2A26; - {$EXTERNALSYM GL_C4F_N3F_V3F} - GL_T2F_V3F = $2A27; - {$EXTERNALSYM GL_T2F_V3F} - GL_T4F_V4F = $2A28; - {$EXTERNALSYM GL_T4F_V4F} - GL_T2F_C4UB_V3F = $2A29; - {$EXTERNALSYM GL_T2F_C4UB_V3F} - GL_T2F_C3F_V3F = $2A2A; - {$EXTERNALSYM GL_T2F_C3F_V3F} - GL_T2F_N3F_V3F = $2A2B; - {$EXTERNALSYM GL_T2F_N3F_V3F} - GL_T2F_C4F_N3F_V3F = $2A2C; - {$EXTERNALSYM GL_T2F_C4F_N3F_V3F} - GL_T4F_C4F_N3F_V4F = $2A2D; - {$EXTERNALSYM GL_T4F_C4F_N3F_V4F} - - // clip planes - GL_CLIP_PLANE0 = $3000; - {$EXTERNALSYM GL_CLIP_PLANE0} - GL_CLIP_PLANE1 = $3001; - {$EXTERNALSYM GL_CLIP_PLANE1} - GL_CLIP_PLANE2 = $3002; - {$EXTERNALSYM GL_CLIP_PLANE2} - GL_CLIP_PLANE3 = $3003; - {$EXTERNALSYM GL_CLIP_PLANE3} - GL_CLIP_PLANE4 = $3004; - {$EXTERNALSYM GL_CLIP_PLANE4} - GL_CLIP_PLANE5 = $3005; - {$EXTERNALSYM GL_CLIP_PLANE5} - - // miscellaneous - GL_DITHER = $0BD0; - {$EXTERNALSYM GL_DITHER} - - // ----- extensions enumerants ----- - // EXT_abgr - GL_ABGR_EXT = $8000; - {$EXTERNALSYM GL_ABGR_EXT} - - // EXT_packed_pixels - GL_UNSIGNED_BYTE_3_3_2_EXT = $8032; - {$EXTERNALSYM GL_UNSIGNED_BYTE_3_3_2_EXT} - GL_UNSIGNED_SHORT_4_4_4_4_EXT = $8033; - {$EXTERNALSYM GL_UNSIGNED_SHORT_4_4_4_4_EXT} - GL_UNSIGNED_SHORT_5_5_5_1_EXT = $8034; - {$EXTERNALSYM GL_UNSIGNED_SHORT_5_5_5_1_EXT} - GL_UNSIGNED_INT_8_8_8_8_EXT = $8035; - {$EXTERNALSYM GL_UNSIGNED_INT_8_8_8_8_EXT} - GL_UNSIGNED_INT_10_10_10_2_EXT = $8036; - {$EXTERNALSYM GL_UNSIGNED_INT_10_10_10_2_EXT} - - // EXT_vertex_array - GL_VERTEX_ARRAY_EXT = $8074; - {$EXTERNALSYM GL_VERTEX_ARRAY_EXT} - GL_NORMAL_ARRAY_EXT = $8075; - {$EXTERNALSYM GL_NORMAL_ARRAY_EXT} - GL_COLOR_ARRAY_EXT = $8076; - {$EXTERNALSYM GL_COLOR_ARRAY_EXT} - GL_INDEX_ARRAY_EXT = $8077; - {$EXTERNALSYM GL_INDEX_ARRAY_EXT} - GL_TEXTURE_COORD_ARRAY_EXT = $8078; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_EXT} - GL_EDGE_FLAG_ARRAY_EXT = $8079; - {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_EXT} - GL_VERTEX_ARRAY_SIZE_EXT = $807A; - {$EXTERNALSYM GL_VERTEX_ARRAY_SIZE_EXT} - GL_VERTEX_ARRAY_TYPE_EXT = $807B; - {$EXTERNALSYM GL_VERTEX_ARRAY_TYPE_EXT} - GL_VERTEX_ARRAY_STRIDE_EXT = $807C; - {$EXTERNALSYM GL_VERTEX_ARRAY_STRIDE_EXT} - GL_VERTEX_ARRAY_COUNT_EXT = $807D; - {$EXTERNALSYM GL_VERTEX_ARRAY_COUNT_EXT} - GL_NORMAL_ARRAY_TYPE_EXT = $807E; - {$EXTERNALSYM GL_NORMAL_ARRAY_TYPE_EXT} - GL_NORMAL_ARRAY_STRIDE_EXT = $807F; - {$EXTERNALSYM GL_NORMAL_ARRAY_STRIDE_EXT} - GL_NORMAL_ARRAY_COUNT_EXT = $8080; - {$EXTERNALSYM GL_NORMAL_ARRAY_COUNT_EXT} - GL_COLOR_ARRAY_SIZE_EXT = $8081; - {$EXTERNALSYM GL_COLOR_ARRAY_SIZE_EXT} - GL_COLOR_ARRAY_TYPE_EXT = $8082; - {$EXTERNALSYM GL_COLOR_ARRAY_TYPE_EXT} - GL_COLOR_ARRAY_STRIDE_EXT = $8083; - {$EXTERNALSYM GL_COLOR_ARRAY_STRIDE_EXT} - GL_COLOR_ARRAY_COUNT_EXT = $8084; - {$EXTERNALSYM GL_COLOR_ARRAY_COUNT_EXT} - GL_INDEX_ARRAY_TYPE_EXT = $8085; - {$EXTERNALSYM GL_INDEX_ARRAY_TYPE_EXT} - GL_INDEX_ARRAY_STRIDE_EXT = $8086; - {$EXTERNALSYM GL_INDEX_ARRAY_STRIDE_EXT} - GL_INDEX_ARRAY_COUNT_EXT = $8087; - {$EXTERNALSYM GL_INDEX_ARRAY_COUNT_EXT} - GL_TEXTURE_COORD_ARRAY_SIZE_EXT = $8088; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_SIZE_EXT} - GL_TEXTURE_COORD_ARRAY_TYPE_EXT = $8089; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_TYPE_EXT} - GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = $808A; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_STRIDE_EXT} - GL_TEXTURE_COORD_ARRAY_COUNT_EXT = $808B; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_COUNT_EXT} - GL_EDGE_FLAG_ARRAY_STRIDE_EXT = $808C; - {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_STRIDE_EXT} - GL_EDGE_FLAG_ARRAY_COUNT_EXT = $808D; - {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_COUNT_EXT} - GL_VERTEX_ARRAY_POINTER_EXT = $808E; - {$EXTERNALSYM GL_VERTEX_ARRAY_POINTER_EXT} - GL_NORMAL_ARRAY_POINTER_EXT = $808F; - {$EXTERNALSYM GL_NORMAL_ARRAY_POINTER_EXT} - GL_COLOR_ARRAY_POINTER_EXT = $8090; - {$EXTERNALSYM GL_COLOR_ARRAY_POINTER_EXT} - GL_INDEX_ARRAY_POINTER_EXT = $8091; - {$EXTERNALSYM GL_INDEX_ARRAY_POINTER_EXT} - GL_TEXTURE_COORD_ARRAY_POINTER_EXT = $8092; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_POINTER_EXT} - GL_EDGE_FLAG_ARRAY_POINTER_EXT = $8093; - {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_POINTER_EXT} - - // EXT_color_table - GL_TABLE_TOO_LARGE_EXT = $8031; - {$EXTERNALSYM GL_TABLE_TOO_LARGE_EXT} - GL_COLOR_TABLE_EXT = $80D0; - {$EXTERNALSYM GL_COLOR_TABLE_EXT} - GL_POST_CONVOLUTION_COLOR_TABLE_EXT = $80D1; - {$EXTERNALSYM GL_POST_CONVOLUTION_COLOR_TABLE_EXT} - GL_POST_COLOR_MATRIX_COLOR_TABLE_EXT = $80D2; - {$EXTERNALSYM GL_POST_COLOR_MATRIX_COLOR_TABLE_EXT} - GL_PROXY_COLOR_TABLE_EXT = $80D3; - {$EXTERNALSYM GL_PROXY_COLOR_TABLE_EXT} - GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_EXT = $80D4; - {$EXTERNALSYM GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_EXT} - GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_EXT = $80D5; - {$EXTERNALSYM GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_EXT} - GL_COLOR_TABLE_SCALE_EXT = $80D6; - {$EXTERNALSYM GL_COLOR_TABLE_SCALE_EXT} - GL_COLOR_TABLE_BIAS_EXT = $80D7; - {$EXTERNALSYM GL_COLOR_TABLE_BIAS_EXT} - GL_COLOR_TABLE_FORMAT_EXT = $80D8; - {$EXTERNALSYM GL_COLOR_TABLE_FORMAT_EXT} - GL_COLOR_TABLE_WIDTH_EXT = $80D9; - {$EXTERNALSYM GL_COLOR_TABLE_WIDTH_EXT} - GL_COLOR_TABLE_RED_SIZE_EXT = $80DA; - {$EXTERNALSYM GL_COLOR_TABLE_RED_SIZE_EXT} - GL_COLOR_TABLE_GREEN_SIZE_EXT = $80DB; - {$EXTERNALSYM GL_COLOR_TABLE_GREEN_SIZE_EXT} - GL_COLOR_TABLE_BLUE_SIZE_EXT = $80DC; - {$EXTERNALSYM GL_COLOR_TABLE_BLUE_SIZE_EXT} - GL_COLOR_TABLE_ALPHA_SIZE_EXT = $80DD; - {$EXTERNALSYM GL_COLOR_TABLE_ALPHA_SIZE_EXT} - GL_COLOR_TABLE_LUMINANCE_SIZE_EXT = $80DE; - {$EXTERNALSYM GL_COLOR_TABLE_LUMINANCE_SIZE_EXT} - GL_COLOR_TABLE_INTENSITY_SIZE_EXT = $80DF; - {$EXTERNALSYM GL_COLOR_TABLE_INTENSITY_SIZE_EXT} - - // EXT_bgra - GL_BGR_EXT = $80E0; - {$EXTERNALSYM GL_BGR_EXT} - GL_BGRA_EXT = $80E1; - {$EXTERNALSYM GL_BGRA_EXT} - - // EXT_paletted_texture - GL_COLOR_INDEX1_EXT = $80E2; - {$EXTERNALSYM GL_COLOR_INDEX1_EXT} - GL_COLOR_INDEX2_EXT = $80E3; - {$EXTERNALSYM GL_COLOR_INDEX2_EXT} - GL_COLOR_INDEX4_EXT = $80E4; - {$EXTERNALSYM GL_COLOR_INDEX4_EXT} - GL_COLOR_INDEX8_EXT = $80E5; - {$EXTERNALSYM GL_COLOR_INDEX8_EXT} - GL_COLOR_INDEX12_EXT = $80E6; - {$EXTERNALSYM GL_COLOR_INDEX12_EXT} - GL_COLOR_INDEX16_EXT = $80E7; - {$EXTERNALSYM GL_COLOR_INDEX16_EXT} - - // EXT_blend_color - GL_CONSTANT_COLOR_EXT = $8001; - {$EXTERNALSYM GL_CONSTANT_COLOR_EXT} - GL_ONE_MINUS_CONSTANT_COLOR_EXT = $8002; - {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_COLOR_EXT} - GL_CONSTANT_ALPHA_EXT = $8003; - {$EXTERNALSYM GL_CONSTANT_ALPHA_EXT} - GL_ONE_MINUS_CONSTANT_ALPHA_EXT = $8004; - {$EXTERNALSYM GL_ONE_MINUS_CONSTANT_ALPHA_EXT} - GL_BLEND_COLOR_EXT = $8005; - {$EXTERNALSYM GL_BLEND_COLOR_EXT} - - // EXT_blend_minmax - GL_FUNC_ADD_EXT = $8006; - {$EXTERNALSYM GL_FUNC_ADD_EXT} - GL_MIN_EXT = $8007; - {$EXTERNALSYM GL_MIN_EXT} - GL_MAX_EXT = $8008; - {$EXTERNALSYM GL_MAX_EXT} - GL_BLEND_EQUATION_EXT = $8009; - {$EXTERNALSYM GL_BLEND_EQUATION_EXT} - - // EXT_blend_subtract - GL_FUNC_SUBTRACT_EXT = $800A; - {$EXTERNALSYM GL_FUNC_SUBTRACT_EXT} - GL_FUNC_REVERSE_SUBTRACT_EXT = $800B; - {$EXTERNALSYM GL_FUNC_REVERSE_SUBTRACT_EXT} - - // EXT_convolution - GL_CONVOLUTION_1D_EXT = $8010; - {$EXTERNALSYM GL_CONVOLUTION_1D_EXT} - GL_CONVOLUTION_2D_EXT = $8011; - {$EXTERNALSYM GL_CONVOLUTION_2D_EXT} - GL_SEPARABLE_2D_EXT = $8012; - {$EXTERNALSYM GL_SEPARABLE_2D_EXT} - GL_CONVOLUTION_BORDER_MODE_EXT = $8013; - {$EXTERNALSYM GL_CONVOLUTION_BORDER_MODE_EXT} - GL_CONVOLUTION_FILTER_SCALE_EXT = $8014; - {$EXTERNALSYM GL_CONVOLUTION_FILTER_SCALE_EXT} - GL_CONVOLUTION_FILTER_BIAS_EXT = $8015; - {$EXTERNALSYM GL_CONVOLUTION_FILTER_BIAS_EXT} - GL_REDUCE_EXT = $8016; - {$EXTERNALSYM GL_REDUCE_EXT} - GL_CONVOLUTION_FORMAT_EXT = $8017; - {$EXTERNALSYM GL_CONVOLUTION_FORMAT_EXT} - GL_CONVOLUTION_WIDTH_EXT = $8018; - {$EXTERNALSYM GL_CONVOLUTION_WIDTH_EXT} - GL_CONVOLUTION_HEIGHT_EXT = $8019; - {$EXTERNALSYM GL_CONVOLUTION_HEIGHT_EXT} - GL_MAX_CONVOLUTION_WIDTH_EXT = $801A; - {$EXTERNALSYM GL_MAX_CONVOLUTION_WIDTH_EXT} - GL_MAX_CONVOLUTION_HEIGHT_EXT = $801B; - {$EXTERNALSYM GL_MAX_CONVOLUTION_HEIGHT_EXT} - GL_POST_CONVOLUTION_RED_SCALE_EXT = $801C; - {$EXTERNALSYM GL_POST_CONVOLUTION_RED_SCALE_EXT} - GL_POST_CONVOLUTION_GREEN_SCALE_EXT = $801D; - {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_SCALE_EXT} - GL_POST_CONVOLUTION_BLUE_SCALE_EXT = $801E; - {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_SCALE_EXT} - GL_POST_CONVOLUTION_ALPHA_SCALE_EXT = $801F; - {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_SCALE_EXT} - GL_POST_CONVOLUTION_RED_BIAS_EXT = $8020; - {$EXTERNALSYM GL_POST_CONVOLUTION_RED_BIAS_EXT} - GL_POST_CONVOLUTION_GREEN_BIAS_EXT = $8021; - {$EXTERNALSYM GL_POST_CONVOLUTION_GREEN_BIAS_EXT} - GL_POST_CONVOLUTION_BLUE_BIAS_EXT = $8022; - {$EXTERNALSYM GL_POST_CONVOLUTION_BLUE_BIAS_EXT} - GL_POST_CONVOLUTION_ALPHA_BIAS_EXT = $8023; - {$EXTERNALSYM GL_POST_CONVOLUTION_ALPHA_BIAS_EXT} - - // EXT_histogram - GL_HISTOGRAM_EXT = $8024; - {$EXTERNALSYM GL_HISTOGRAM_EXT} - GL_PROXY_HISTOGRAM_EXT = $8025; - {$EXTERNALSYM GL_PROXY_HISTOGRAM_EXT} - GL_HISTOGRAM_WIDTH_EXT = $8026; - {$EXTERNALSYM GL_HISTOGRAM_WIDTH_EXT} - GL_HISTOGRAM_FORMAT_EXT = $8027; - {$EXTERNALSYM GL_HISTOGRAM_FORMAT_EXT} - GL_HISTOGRAM_RED_SIZE_EXT = $8028; - {$EXTERNALSYM GL_HISTOGRAM_RED_SIZE_EXT} - GL_HISTOGRAM_GREEN_SIZE_EXT = $8029; - {$EXTERNALSYM GL_HISTOGRAM_GREEN_SIZE_EXT} - GL_HISTOGRAM_BLUE_SIZE_EXT = $802A; - {$EXTERNALSYM GL_HISTOGRAM_BLUE_SIZE_EXT} - GL_HISTOGRAM_ALPHA_SIZE_EXT = $802B; - {$EXTERNALSYM GL_HISTOGRAM_ALPHA_SIZE_EXT} - GL_HISTOGRAM_LUMINANCE_SIZE_EXT = $802C; - {$EXTERNALSYM GL_HISTOGRAM_LUMINANCE_SIZE_EXT} - GL_HISTOGRAM_SINK_EXT = $802D; - {$EXTERNALSYM GL_HISTOGRAM_SINK_EXT} - GL_MINMAX_EXT = $802E; - {$EXTERNALSYM GL_MINMAX_EXT} - GL_MINMAX_FORMAT_EXT = $802F; - {$EXTERNALSYM GL_MINMAX_FORMAT_EXT} - GL_MINMAX_SINK_EXT = $8030; - {$EXTERNALSYM GL_MINMAX_SINK_EXT} - - // EXT_polygon_offset - GL_POLYGON_OFFSET_EXT = $8037; - {$EXTERNALSYM GL_POLYGON_OFFSET_EXT} - GL_POLYGON_OFFSET_FACTOR_EXT = $8038; - {$EXTERNALSYM GL_POLYGON_OFFSET_FACTOR_EXT} - GL_POLYGON_OFFSET_BIAS_EXT = $8039; - {$EXTERNALSYM GL_POLYGON_OFFSET_BIAS_EXT} - - // EXT_texture - GL_ALPHA4_EXT = $803B; - {$EXTERNALSYM GL_ALPHA4_EXT} - GL_ALPHA8_EXT = $803C; - {$EXTERNALSYM GL_ALPHA8_EXT} - GL_ALPHA12_EXT = $803D; - {$EXTERNALSYM GL_ALPHA12_EXT} - GL_ALPHA16_EXT = $803E; - {$EXTERNALSYM GL_ALPHA16_EXT} - GL_LUMINANCE4_EXT = $803F; - {$EXTERNALSYM GL_LUMINANCE4_EXT} - GL_LUMINANCE8_EXT = $8040; - {$EXTERNALSYM GL_LUMINANCE8_EXT} - GL_LUMINANCE12_EXT = $8041; - {$EXTERNALSYM GL_LUMINANCE12_EXT} - GL_LUMINANCE16_EXT = $8042; - {$EXTERNALSYM GL_LUMINANCE16_EXT} - GL_LUMINANCE4_ALPHA4_EXT = $8043; - {$EXTERNALSYM GL_LUMINANCE4_ALPHA4_EXT} - GL_LUMINANCE6_ALPHA2_EXT = $8044; - {$EXTERNALSYM GL_LUMINANCE6_ALPHA2_EXT} - GL_LUMINANCE8_ALPHA8_EXT = $8045; - {$EXTERNALSYM GL_LUMINANCE8_ALPHA8_EXT} - GL_LUMINANCE12_ALPHA4_EXT = $8046; - {$EXTERNALSYM GL_LUMINANCE12_ALPHA4_EXT} - GL_LUMINANCE12_ALPHA12_EXT = $8047; - {$EXTERNALSYM GL_LUMINANCE12_ALPHA12_EXT} - GL_LUMINANCE16_ALPHA16_EXT = $8048; - {$EXTERNALSYM GL_LUMINANCE16_ALPHA16_EXT} - GL_INTENSITY_EXT = $8049; - {$EXTERNALSYM GL_INTENSITY_EXT} - GL_INTENSITY4_EXT = $804A; - {$EXTERNALSYM GL_INTENSITY4_EXT} - GL_INTENSITY8_EXT = $804B; - {$EXTERNALSYM GL_INTENSITY8_EXT} - GL_INTENSITY12_EXT = $804C; - {$EXTERNALSYM GL_INTENSITY12_EXT} - GL_INTENSITY16_EXT = $804D; - {$EXTERNALSYM GL_INTENSITY16_EXT} - GL_RGB2_EXT = $804E; - {$EXTERNALSYM GL_RGB2_EXT} - GL_RGB4_EXT = $804F; - {$EXTERNALSYM GL_RGB4_EXT} - GL_RGB5_EXT = $8050; - {$EXTERNALSYM GL_RGB5_EXT} - GL_RGB8_EXT = $8051; - {$EXTERNALSYM GL_RGB8_EXT} - GL_RGB10_EXT = $8052; - {$EXTERNALSYM GL_RGB10_EXT} - GL_RGB12_EXT = $8053; - {$EXTERNALSYM GL_RGB12_EXT} - GL_RGB16_EXT = $8054; - {$EXTERNALSYM GL_RGB16_EXT} - GL_RGBA2_EXT = $8055; - {$EXTERNALSYM GL_RGBA2_EXT} - GL_RGBA4_EXT = $8056; - {$EXTERNALSYM GL_RGBA4_EXT} - GL_RGB5_A1_EXT = $8057; - {$EXTERNALSYM GL_RGB5_A1_EXT} - GL_RGBA8_EXT = $8058; - {$EXTERNALSYM GL_RGBA8_EXT} - GL_RGB10_A2_EXT = $8059; - {$EXTERNALSYM GL_RGB10_A2_EXT} - GL_RGBA12_EXT = $805A; - {$EXTERNALSYM GL_RGBA12_EXT} - GL_RGBA16_EXT = $805B; - {$EXTERNALSYM GL_RGBA16_EXT} - GL_TEXTURE_RED_SIZE_EXT = $805C; - {$EXTERNALSYM GL_TEXTURE_RED_SIZE_EXT} - GL_TEXTURE_GREEN_SIZE_EXT = $805D; - {$EXTERNALSYM GL_TEXTURE_GREEN_SIZE_EXT} - GL_TEXTURE_BLUE_SIZE_EXT = $805E; - {$EXTERNALSYM GL_TEXTURE_BLUE_SIZE_EXT} - GL_TEXTURE_ALPHA_SIZE_EXT = $805F; - {$EXTERNALSYM GL_TEXTURE_ALPHA_SIZE_EXT} - GL_TEXTURE_LUMINANCE_SIZE_EXT = $8060; - {$EXTERNALSYM GL_TEXTURE_LUMINANCE_SIZE_EXT} - GL_TEXTURE_INTENSITY_SIZE_EXT = $8061; - {$EXTERNALSYM GL_TEXTURE_INTENSITY_SIZE_EXT} - GL_REPLACE_EXT = $8062; - {$EXTERNALSYM GL_REPLACE_EXT} - GL_PROXY_TEXTURE_1D_EXT = $8063; - {$EXTERNALSYM GL_PROXY_TEXTURE_1D_EXT} - GL_PROXY_TEXTURE_2D_EXT = $8064; - {$EXTERNALSYM GL_PROXY_TEXTURE_2D_EXT} - GL_TEXTURE_TOO_LARGE_EXT = $8065; - {$EXTERNALSYM GL_TEXTURE_TOO_LARGE_EXT} - - // EXT_texture_object - GL_TEXTURE_PRIORITY_EXT = $8066; - {$EXTERNALSYM GL_TEXTURE_PRIORITY_EXT} - GL_TEXTURE_RESIDENT_EXT = $8067; - {$EXTERNALSYM GL_TEXTURE_RESIDENT_EXT} - GL_TEXTURE_1D_BINDING_EXT = $8068; - {$EXTERNALSYM GL_TEXTURE_1D_BINDING_EXT} - GL_TEXTURE_2D_BINDING_EXT = $8069; - {$EXTERNALSYM GL_TEXTURE_2D_BINDING_EXT} - GL_TEXTURE_3D_BINDING_EXT = $806A; - {$EXTERNALSYM GL_TEXTURE_3D_BINDING_EXT} - - // EXT_texture3D - GL_PACK_SKIP_IMAGES_EXT = $806B; - {$EXTERNALSYM GL_PACK_SKIP_IMAGES_EXT} - GL_PACK_IMAGE_HEIGHT_EXT = $806C; - {$EXTERNALSYM GL_PACK_IMAGE_HEIGHT_EXT} - GL_UNPACK_SKIP_IMAGES_EXT = $806D; - {$EXTERNALSYM GL_UNPACK_SKIP_IMAGES_EXT} - GL_UNPACK_IMAGE_HEIGHT_EXT = $806E; - {$EXTERNALSYM GL_UNPACK_IMAGE_HEIGHT_EXT} - GL_TEXTURE_3D_EXT = $806F; - {$EXTERNALSYM GL_TEXTURE_3D_EXT} - GL_PROXY_TEXTURE_3D_EXT = $8070; - {$EXTERNALSYM GL_PROXY_TEXTURE_3D_EXT} - GL_TEXTURE_DEPTH_EXT = $8071; - {$EXTERNALSYM GL_TEXTURE_DEPTH_EXT} - GL_TEXTURE_WRAP_R_EXT = $8072; - {$EXTERNALSYM GL_TEXTURE_WRAP_R_EXT} - GL_MAX_3D_TEXTURE_SIZE_EXT = $8073; - {$EXTERNALSYM GL_MAX_3D_TEXTURE_SIZE_EXT} - - // SGI_color_matrix - GL_COLOR_MATRIX_SGI = $80B1; - {$EXTERNALSYM GL_COLOR_MATRIX_SGI} - GL_COLOR_MATRIX_STACK_DEPTH_SGI = $80B2; - {$EXTERNALSYM GL_COLOR_MATRIX_STACK_DEPTH_SGI} - GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI = $80B3; - {$EXTERNALSYM GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI} - GL_POST_COLOR_MATRIX_RED_SCALE_SGI = $80B4; - {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_SCALE_SGI} - GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI = $80B5; - {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI} - GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI = $80B6; - {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI} - GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI = $80B7; - {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI} - GL_POST_COLOR_MATRIX_RED_BIAS_SGI = $80B8; - {$EXTERNALSYM GL_POST_COLOR_MATRIX_RED_BIAS_SGI} - GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI = $80B9; - {$EXTERNALSYM GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI} - GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI = $80BA; - {$EXTERNALSYM GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI} - GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI = $80BB; - {$EXTERNALSYM GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI} - - // SGI_texture_color_table - GL_TEXTURE_COLOR_TABLE_SGI = $80BC; - {$EXTERNALSYM GL_TEXTURE_COLOR_TABLE_SGI} - GL_PROXY_TEXTURE_COLOR_TABLE_SGI = $80BD; - {$EXTERNALSYM GL_PROXY_TEXTURE_COLOR_TABLE_SGI} - GL_TEXTURE_COLOR_TABLE_BIAS_SGI = $80BE; - {$EXTERNALSYM GL_TEXTURE_COLOR_TABLE_BIAS_SGI} - GL_TEXTURE_COLOR_TABLE_SCALE_SGI = $80BF; - {$EXTERNALSYM GL_TEXTURE_COLOR_TABLE_SCALE_SGI} - - // SGI_color_table - GL_COLOR_TABLE_SGI = $80D0; - {$EXTERNALSYM GL_COLOR_TABLE_SGI} - GL_POST_CONVOLUTION_COLOR_TABLE_SGI = $80D1; - {$EXTERNALSYM GL_POST_CONVOLUTION_COLOR_TABLE_SGI} - GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI = $80D2; - {$EXTERNALSYM GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI} - GL_PROXY_COLOR_TABLE_SGI = $80D3; - {$EXTERNALSYM GL_PROXY_COLOR_TABLE_SGI} - GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI = $80D4; - {$EXTERNALSYM GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI} - GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI = $80D5; - {$EXTERNALSYM GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI} - GL_COLOR_TABLE_SCALE_SGI = $80D6; - {$EXTERNALSYM GL_COLOR_TABLE_SCALE_SGI} - GL_COLOR_TABLE_BIAS_SGI = $80D7; - {$EXTERNALSYM GL_COLOR_TABLE_BIAS_SGI} - GL_COLOR_TABLE_FORMAT_SGI = $80D8; - {$EXTERNALSYM GL_COLOR_TABLE_FORMAT_SGI} - GL_COLOR_TABLE_WIDTH_SGI = $80D9; - {$EXTERNALSYM GL_COLOR_TABLE_WIDTH_SGI} - GL_COLOR_TABLE_RED_SIZE_SGI = $80DA; - {$EXTERNALSYM GL_COLOR_TABLE_RED_SIZE_SGI} - GL_COLOR_TABLE_GREEN_SIZE_SGI = $80DB; - {$EXTERNALSYM GL_COLOR_TABLE_GREEN_SIZE_SGI} - GL_COLOR_TABLE_BLUE_SIZE_SGI = $80DC; - {$EXTERNALSYM GL_COLOR_TABLE_BLUE_SIZE_SGI} - GL_COLOR_TABLE_ALPHA_SIZE_SGI = $80DD; - {$EXTERNALSYM GL_COLOR_TABLE_ALPHA_SIZE_SGI} - GL_COLOR_TABLE_LUMINANCE_SIZE_SGI = $80DE; - {$EXTERNALSYM GL_COLOR_TABLE_LUMINANCE_SIZE_SGI} - GL_COLOR_TABLE_INTENSITY_SIZE_SGI = $80DF; - {$EXTERNALSYM GL_COLOR_TABLE_INTENSITY_SIZE_SGI} - - // EXT_cmyka - GL_CMYK_EXT = $800C; - {$EXTERNALSYM GL_CMYK_EXT} - GL_CMYKA_EXT = $800D; - {$EXTERNALSYM GL_CMYKA_EXT} - GL_PACK_CMYK_HINT_EXT = $800E; - {$EXTERNALSYM GL_PACK_CMYK_HINT_EXT} - GL_UNPACK_CMYK_HINT_EXT = $800F; - {$EXTERNALSYM GL_UNPACK_CMYK_HINT_EXT} - - // EXT_rescale_normal - GL_RESCALE_NORMAL_EXT = $803A; - {$EXTERNALSYM GL_RESCALE_NORMAL_EXT} - - // EXT_clip_volume_hint - GL_CLIP_VOLUME_CLIPPING_HINT_EXT = $80F0; - {$EXTERNALSYM GL_CLIP_VOLUME_CLIPPING_HINT_EXT} - - // EXT_cull_vertex - GL_CULL_VERTEX_EXT = $81AA; - {$EXTERNALSYM GL_CULL_VERTEX_EXT} - GL_CULL_VERTEX_EYE_POSITION_EXT = $81AB; - {$EXTERNALSYM GL_CULL_VERTEX_EYE_POSITION_EXT} - GL_CULL_VERTEX_OBJECT_POSITION_EXT = $81AC; - {$EXTERNALSYM GL_CULL_VERTEX_OBJECT_POSITION_EXT} - - // EXT_index_array_formats - GL_IUI_V2F_EXT = $81AD; - {$EXTERNALSYM GL_IUI_V2F_EXT} - GL_IUI_V3F_EXT = $81AE; - {$EXTERNALSYM GL_IUI_V3F_EXT} - GL_IUI_N3F_V2F_EXT = $81AF; - {$EXTERNALSYM GL_IUI_N3F_V2F_EXT} - GL_IUI_N3F_V3F_EXT = $81B0; - {$EXTERNALSYM GL_IUI_N3F_V3F_EXT} - GL_T2F_IUI_V2F_EXT = $81B1; - {$EXTERNALSYM GL_T2F_IUI_V2F_EXT} - GL_T2F_IUI_V3F_EXT = $81B2; - {$EXTERNALSYM GL_T2F_IUI_V3F_EXT} - GL_T2F_IUI_N3F_V2F_EXT = $81B3; - {$EXTERNALSYM GL_T2F_IUI_N3F_V2F_EXT} - GL_T2F_IUI_N3F_V3F_EXT = $81B4; - {$EXTERNALSYM GL_T2F_IUI_N3F_V3F_EXT} - - // EXT_index_func - GL_INDEX_TEST_EXT = $81B5; - {$EXTERNALSYM GL_INDEX_TEST_EXT} - GL_INDEX_TEST_FUNC_EXT = $81B6; - {$EXTERNALSYM GL_INDEX_TEST_FUNC_EXT} - GL_INDEX_TEST_REF_EXT = $81B7; - {$EXTERNALSYM GL_INDEX_TEST_REF_EXT} - - // EXT_index_material - GL_INDEX_MATERIAL_EXT = $81B8; - {$EXTERNALSYM GL_INDEX_MATERIAL_EXT} - GL_INDEX_MATERIAL_PARAMETER_EXT = $81B9; - {$EXTERNALSYM GL_INDEX_MATERIAL_PARAMETER_EXT} - GL_INDEX_MATERIAL_FACE_EXT = $81BA; - {$EXTERNALSYM GL_INDEX_MATERIAL_FACE_EXT} - - // EXT_misc_attribute - GL_MISC_BIT_EXT = 0; // not yet defined - {$EXTERNALSYM GL_MISC_BIT_EXT} - - // EXT_scene_marker - GL_SCENE_REQUIRED_EXT = 0; // not yet defined - {$EXTERNALSYM GL_SCENE_REQUIRED_EXT} - - // EXT_shared_texture_palette - GL_SHARED_TEXTURE_PALETTE_EXT = $81FB; - {$EXTERNALSYM GL_SHARED_TEXTURE_PALETTE_EXT} - - // EXT_nurbs_tessellator - GLU_NURBS_MODE_EXT = 100160; - {$EXTERNALSYM GLU_NURBS_MODE_EXT} - GLU_NURBS_TESSELLATOR_EXT = 100161; - {$EXTERNALSYM GLU_NURBS_TESSELLATOR_EXT} - GLU_NURBS_RENDERER_EXT = 100162; - {$EXTERNALSYM GLU_NURBS_RENDERER_EXT} - GLU_NURBS_BEGIN_EXT = 100164; - {$EXTERNALSYM GLU_NURBS_BEGIN_EXT} - GLU_NURBS_VERTEX_EXT = 100165; - {$EXTERNALSYM GLU_NURBS_VERTEX_EXT} - GLU_NURBS_NORMAL_EXT = 100166; - {$EXTERNALSYM GLU_NURBS_NORMAL_EXT} - GLU_NURBS_COLOR_EXT = 100167; - {$EXTERNALSYM GLU_NURBS_COLOR_EXT} - GLU_NURBS_TEX_COORD_EXT = 100168; - {$EXTERNALSYM GLU_NURBS_TEX_COORD_EXT} - GLU_NURBS_END_EXT = 100169; - {$EXTERNALSYM GLU_NURBS_END_EXT} - GLU_NURBS_BEGIN_DATA_EXT = 100170; - {$EXTERNALSYM GLU_NURBS_BEGIN_DATA_EXT} - GLU_NURBS_VERTEX_DATA_EXT = 100171; - {$EXTERNALSYM GLU_NURBS_VERTEX_DATA_EXT} - GLU_NURBS_NORMAL_DATA_EXT = 100172; - {$EXTERNALSYM GLU_NURBS_NORMAL_DATA_EXT} - GLU_NURBS_COLOR_DATA_EXT = 100173; - {$EXTERNALSYM GLU_NURBS_COLOR_DATA_EXT} - GLU_NURBS_TEX_COORD_DATA_EXT = 100174; - {$EXTERNALSYM GLU_NURBS_TEX_COORD_DATA_EXT} - GLU_NURBS_END_DATA_EXT = 100175; - {$EXTERNALSYM GLU_NURBS_END_DATA_EXT} - - // EXT_object_space_tess - GLU_OBJECT_PARAMETRIC_ERROR_EXT = 100208; - {$EXTERNALSYM GLU_OBJECT_PARAMETRIC_ERROR_EXT} - GLU_OBJECT_PATH_LENGTH_EXT = 100209; - {$EXTERNALSYM GLU_OBJECT_PATH_LENGTH_EXT} - - // EXT_point_parameters - GL_POINT_SIZE_MIN_EXT = $8126; - {$EXTERNALSYM GL_POINT_SIZE_MIN_EXT} - GL_POINT_SIZE_MAX_EXT = $8127; - {$EXTERNALSYM GL_POINT_SIZE_MAX_EXT} - GL_POINT_FADE_THRESHOLD_SIZE_EXT = $8128; - {$EXTERNALSYM GL_POINT_FADE_THRESHOLD_SIZE_EXT} - GL_DISTANCE_ATTENUATION_EXT = $8129; - {$EXTERNALSYM GL_DISTANCE_ATTENUATION_EXT} - - // EXT_compiled_vertex_array - GL_ARRAY_ELEMENT_LOCK_FIRST_EXT = $81A8; - {$EXTERNALSYM GL_ARRAY_ELEMENT_LOCK_FIRST_EXT} - GL_ARRAY_ELEMENT_LOCK_COUNT_EXT = $81A9; - {$EXTERNALSYM GL_ARRAY_ELEMENT_LOCK_COUNT_EXT} - - // ARB_multitexture - GL_ACTIVE_TEXTURE_ARB = $84E0; - {$EXTERNALSYM GL_ACTIVE_TEXTURE_ARB} - GL_CLIENT_ACTIVE_TEXTURE_ARB = $84E1; - {$EXTERNALSYM GL_CLIENT_ACTIVE_TEXTURE_ARB} - GL_MAX_TEXTURE_UNITS_ARB = $84E2; - {$EXTERNALSYM GL_MAX_TEXTURE_UNITS_ARB} - GL_TEXTURE0_ARB = $84C0; - {$EXTERNALSYM GL_TEXTURE0_ARB} - GL_TEXTURE1_ARB = $84C1; - {$EXTERNALSYM GL_TEXTURE1_ARB} - GL_TEXTURE2_ARB = $84C2; - {$EXTERNALSYM GL_TEXTURE2_ARB} - GL_TEXTURE3_ARB = $84C3; - {$EXTERNALSYM GL_TEXTURE3_ARB} - GL_TEXTURE4_ARB = $84C4; - {$EXTERNALSYM GL_TEXTURE4_ARB} - GL_TEXTURE5_ARB = $84C5; - {$EXTERNALSYM GL_TEXTURE5_ARB} - GL_TEXTURE6_ARB = $84C6; - {$EXTERNALSYM GL_TEXTURE6_ARB} - GL_TEXTURE7_ARB = $84C7; - {$EXTERNALSYM GL_TEXTURE7_ARB} - GL_TEXTURE8_ARB = $84C8; - {$EXTERNALSYM GL_TEXTURE8_ARB} - GL_TEXTURE9_ARB = $84C9; - {$EXTERNALSYM GL_TEXTURE9_ARB} - GL_TEXTURE10_ARB = $84CA; - {$EXTERNALSYM GL_TEXTURE10_ARB} - GL_TEXTURE11_ARB = $84CB; - {$EXTERNALSYM GL_TEXTURE11_ARB} - GL_TEXTURE12_ARB = $84CC; - {$EXTERNALSYM GL_TEXTURE12_ARB} - GL_TEXTURE13_ARB = $84CD; - {$EXTERNALSYM GL_TEXTURE13_ARB} - GL_TEXTURE14_ARB = $84CE; - {$EXTERNALSYM GL_TEXTURE14_ARB} - GL_TEXTURE15_ARB = $84CF; - {$EXTERNALSYM GL_TEXTURE15_ARB} - GL_TEXTURE16_ARB = $84D0; - {$EXTERNALSYM GL_TEXTURE16_ARB} - GL_TEXTURE17_ARB = $84D1; - {$EXTERNALSYM GL_TEXTURE17_ARB} - GL_TEXTURE18_ARB = $84D2; - {$EXTERNALSYM GL_TEXTURE18_ARB} - GL_TEXTURE19_ARB = $84D3; - {$EXTERNALSYM GL_TEXTURE19_ARB} - GL_TEXTURE20_ARB = $84D4; - {$EXTERNALSYM GL_TEXTURE20_ARB} - GL_TEXTURE21_ARB = $84D5; - {$EXTERNALSYM GL_TEXTURE21_ARB} - GL_TEXTURE22_ARB = $84D6; - {$EXTERNALSYM GL_TEXTURE22_ARB} - GL_TEXTURE23_ARB = $84D7; - {$EXTERNALSYM GL_TEXTURE23_ARB} - GL_TEXTURE24_ARB = $84D8; - {$EXTERNALSYM GL_TEXTURE24_ARB} - GL_TEXTURE25_ARB = $84D9; - {$EXTERNALSYM GL_TEXTURE25_ARB} - GL_TEXTURE26_ARB = $84DA; - {$EXTERNALSYM GL_TEXTURE26_ARB} - GL_TEXTURE27_ARB = $84DB; - {$EXTERNALSYM GL_TEXTURE27_ARB} - GL_TEXTURE28_ARB = $84DC; - {$EXTERNALSYM GL_TEXTURE28_ARB} - GL_TEXTURE29_ARB = $84DD; - {$EXTERNALSYM GL_TEXTURE29_ARB} - GL_TEXTURE30_ARB = $84DE; - {$EXTERNALSYM GL_TEXTURE30_ARB} - GL_TEXTURE31_ARB = $84DF; - {$EXTERNALSYM GL_TEXTURE31_ARB} - - // EXT_stencil_wrap - GL_INCR_WRAP_EXT = $8507; - {$EXTERNALSYM GL_INCR_WRAP_EXT} - GL_DECR_WRAP_EXT = $8508; - {$EXTERNALSYM GL_DECR_WRAP_EXT} - - // NV_texgen_reflection - GL_NORMAL_MAP_NV = $8511; - {$EXTERNALSYM GL_NORMAL_MAP_NV} - GL_REFLECTION_MAP_NV = $8512; - {$EXTERNALSYM GL_REFLECTION_MAP_NV} - - // EXT_texture_env_combine - GL_COMBINE_EXT = $8570; - {$EXTERNALSYM GL_COMBINE_EXT} - GL_COMBINE_RGB_EXT = $8571; - {$EXTERNALSYM GL_COMBINE_RGB_EXT} - GL_COMBINE_ALPHA_EXT = $8572; - {$EXTERNALSYM GL_COMBINE_ALPHA_EXT} - GL_RGB_SCALE_EXT = $8573; - {$EXTERNALSYM GL_RGB_SCALE_EXT} - GL_ADD_SIGNED_EXT = $8574; - {$EXTERNALSYM GL_ADD_SIGNED_EXT} - GL_INTERPOLATE_EXT = $8575; - {$EXTERNALSYM GL_INTERPOLATE_EXT} - GL_CONSTANT_EXT = $8576; - {$EXTERNALSYM GL_CONSTANT_EXT} - GL_PRIMARY_COLOR_EXT = $8577; - {$EXTERNALSYM GL_PRIMARY_COLOR_EXT} - GL_PREVIOUS_EXT = $8578; - {$EXTERNALSYM GL_PREVIOUS_EXT} - GL_SOURCE0_RGB_EXT = $8580; - {$EXTERNALSYM GL_SOURCE0_RGB_EXT} - GL_SOURCE1_RGB_EXT = $8581; - {$EXTERNALSYM GL_SOURCE1_RGB_EXT} - GL_SOURCE2_RGB_EXT = $8582; - {$EXTERNALSYM GL_SOURCE2_RGB_EXT} - GL_SOURCE0_ALPHA_EXT = $8588; - {$EXTERNALSYM GL_SOURCE0_ALPHA_EXT} - GL_SOURCE1_ALPHA_EXT = $8589; - {$EXTERNALSYM GL_SOURCE1_ALPHA_EXT} - GL_SOURCE2_ALPHA_EXT = $858A; - {$EXTERNALSYM GL_SOURCE2_ALPHA_EXT} - GL_OPERAND0_RGB_EXT = $8590; - {$EXTERNALSYM GL_OPERAND0_RGB_EXT} - GL_OPERAND1_RGB_EXT = $8591; - {$EXTERNALSYM GL_OPERAND1_RGB_EXT} - GL_OPERAND2_RGB_EXT = $8592; - {$EXTERNALSYM GL_OPERAND2_RGB_EXT} - GL_OPERAND0_ALPHA_EXT = $8598; - {$EXTERNALSYM GL_OPERAND0_ALPHA_EXT} - GL_OPERAND1_ALPHA_EXT = $8599; - {$EXTERNALSYM GL_OPERAND1_ALPHA_EXT} - GL_OPERAND2_ALPHA_EXT = $859A; - {$EXTERNALSYM GL_OPERAND2_ALPHA_EXT} - - // NV_texture_env_combine4 - GL_COMBINE4_NV = $8503; - {$EXTERNALSYM GL_COMBINE4_NV} - GL_SOURCE3_RGB_NV = $8583; - {$EXTERNALSYM GL_SOURCE3_RGB_NV} - GL_SOURCE3_ALPHA_NV = $858B; - {$EXTERNALSYM GL_SOURCE3_ALPHA_NV} - GL_OPERAND3_RGB_NV = $8593; - {$EXTERNALSYM GL_OPERAND3_RGB_NV} - GL_OPERAND3_ALPHA_NV = $859B; - {$EXTERNALSYM GL_OPERAND3_ALPHA_NV} - - GL_BLEND_EQUATION = $8009; - {$EXTERNALSYM GL_BLEND_EQUATION} - GL_TABLE_TOO_LARGE = $8031; - {$EXTERNALSYM GL_TABLE_TOO_LARGE} - GL_UNSIGNED_BYTE_3_3_2 = $8032; - {$EXTERNALSYM GL_UNSIGNED_BYTE_3_3_2} - GL_UNSIGNED_SHORT_4_4_4_4 = $8033; - {$EXTERNALSYM GL_UNSIGNED_SHORT_4_4_4_4} - GL_UNSIGNED_SHORT_5_5_5_1 = $8034; - {$EXTERNALSYM GL_UNSIGNED_SHORT_5_5_5_1} - GL_UNSIGNED_INT_8_8_8_8 = $8035; - {$EXTERNALSYM GL_UNSIGNED_INT_8_8_8_8} - GL_UNSIGNED_INT_10_10_10_2 = $8036; - {$EXTERNALSYM GL_UNSIGNED_INT_10_10_10_2} - GL_UNSIGNED_BYTE_2_3_3_REV = $8362; - {$EXTERNALSYM GL_UNSIGNED_BYTE_2_3_3_REV} - GL_UNSIGNED_SHORT_5_6_5 = $8363; - {$EXTERNALSYM GL_UNSIGNED_SHORT_5_6_5} - GL_UNSIGNED_SHORT_5_6_5_REV = $8364; - {$EXTERNALSYM GL_UNSIGNED_SHORT_5_6_5_REV} - GL_UNSIGNED_SHORT_4_4_4_4_REV = $8365; - {$EXTERNALSYM GL_UNSIGNED_SHORT_4_4_4_4_REV} - GL_UNSIGNED_SHORT_1_5_5_5_REV = $8366; - {$EXTERNALSYM GL_UNSIGNED_SHORT_1_5_5_5_REV} - GL_UNSIGNED_INT_8_8_8_8_REV = $8367; - {$EXTERNALSYM GL_UNSIGNED_INT_8_8_8_8_REV} - GL_UNSIGNED_INT_2_10_10_10_REV = $8368; - {$EXTERNALSYM GL_UNSIGNED_INT_2_10_10_10_REV} - - // GL_ARB_transpose_matrix - GL_TRANSPOSE_MODELVIEW_MATRIX_ARB = $84E3; - {$EXTERNALSYM GL_TRANSPOSE_MODELVIEW_MATRIX_ARB} - GL_TRANSPOSE_PROJECTION_MATRIX_ARB = $84E4; - {$EXTERNALSYM GL_TRANSPOSE_PROJECTION_MATRIX_ARB} - GL_TRANSPOSE_TEXTURE_MATRIX_ARB = $84E5; - {$EXTERNALSYM GL_TRANSPOSE_TEXTURE_MATRIX_ARB} - GL_TRANSPOSE_COLOR_MATRIX_ARB = $84E6; - {$EXTERNALSYM GL_TRANSPOSE_COLOR_MATRIX_ARB} - - // GL_ARB_multisample - GL_MULTISAMPLE_ARB = $809D; - {$EXTERNALSYM GL_MULTISAMPLE_ARB} - GL_SAMPLE_ALPHA_TO_COVERAGE_ARB = $809E; - {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_COVERAGE_ARB} - GL_SAMPLE_ALPHA_TO_ONE_ARB = $809F; - {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_ONE_ARB} - GL_SAMPLE_COVERAGE_ARB = $80A0; - {$EXTERNALSYM GL_SAMPLE_COVERAGE_ARB} - GL_SAMPLE_BUFFERS_ARB = $80A8; - {$EXTERNALSYM GL_SAMPLE_BUFFERS_ARB} - GL_SAMPLES_ARB = $80A9; - {$EXTERNALSYM GL_SAMPLES_ARB} - GL_SAMPLE_COVERAGE_VALUE_ARB = $80AA; - {$EXTERNALSYM GL_SAMPLE_COVERAGE_VALUE_ARB} - GL_SAMPLE_COVERAGE_INVERT_ARB = $80AB; - {$EXTERNALSYM GL_SAMPLE_COVERAGE_INVERT_ARB} - GL_MULTISAMPLE_BIT_ARB = $20000000; - {$EXTERNALSYM GL_MULTISAMPLE_BIT_ARB} - GLX_SAMPLE_BUFFERS_ARB = 100000; - {$EXTERNALSYM GLX_SAMPLE_BUFFERS_ARB} - GLX_SAMPLES_ARB = 100001; - {$EXTERNALSYM GLX_SAMPLES_ARB} - WGL_SAMPLE_BUFFERS_ARB = $2041; - {$EXTERNALSYM WGL_SAMPLE_BUFFERS_ARB} - WGL_SAMPLES_ARB = $2042; - {$EXTERNALSYM WGL_SAMPLES_ARB} - - // GL_ARB_texture_cube_map - GL_NORMAL_MAP_ARB = $8511; - {$EXTERNALSYM GL_NORMAL_MAP_ARB} - GL_REFLECTION_MAP_ARB = $8512; - {$EXTERNALSYM GL_REFLECTION_MAP_ARB} - GL_TEXTURE_CUBE_MAP_ARB = $8513; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_ARB} - GL_TEXTURE_BINDING_CUBE_MAP_ARB = $8514; - {$EXTERNALSYM GL_TEXTURE_BINDING_CUBE_MAP_ARB} - GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = $8515; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB} - GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = $8516; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB} - GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = $8517; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB} - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = $8518; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB} - GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = $8519; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB} - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = $851A; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB} - GL_PROXY_TEXTURE_CUBE_MAP_ARB = $851B; - {$EXTERNALSYM GL_PROXY_TEXTURE_CUBE_MAP_ARB} - GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB = $851C; - {$EXTERNALSYM GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB} - - // GL_ARB_texture_compression - GL_COMPRESSED_ALPHA_ARB = $84E9; - {$EXTERNALSYM GL_COMPRESSED_ALPHA_ARB} - GL_COMPRESSED_LUMINANCE_ARB = $84EA; - {$EXTERNALSYM GL_COMPRESSED_LUMINANCE_ARB} - GL_COMPRESSED_LUMINANCE_ALPHA_ARB = $84EB; - {$EXTERNALSYM GL_COMPRESSED_LUMINANCE_ALPHA_ARB} - GL_COMPRESSED_INTENSITY_ARB = $84EC; - {$EXTERNALSYM GL_COMPRESSED_INTENSITY_ARB} - GL_COMPRESSED_RGB_ARB = $84ED; - {$EXTERNALSYM GL_COMPRESSED_RGB_ARB} - GL_COMPRESSED_RGBA_ARB = $84EE; - {$EXTERNALSYM GL_COMPRESSED_RGBA_ARB} - GL_TEXTURE_COMPRESSION_HINT_ARB = $84EF; - {$EXTERNALSYM GL_TEXTURE_COMPRESSION_HINT_ARB} - GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB = $86A0; - {$EXTERNALSYM GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB} - GL_TEXTURE_COMPRESSED_ARB = $86A1; - {$EXTERNALSYM GL_TEXTURE_COMPRESSED_ARB} - GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB = $86A2; - {$EXTERNALSYM GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB} - GL_COMPRESSED_TEXTURE_FORMATS_ARB = $86A3; - {$EXTERNALSYM GL_COMPRESSED_TEXTURE_FORMATS_ARB} - - // GL_ARB_vertex_blend - GL_MAX_VERTEX_UNITS_ARB = $86A4; - {$EXTERNALSYM GL_MAX_VERTEX_UNITS_ARB} - GL_ACTIVE_VERTEX_UNITS_ARB = $86A5; - {$EXTERNALSYM GL_ACTIVE_VERTEX_UNITS_ARB} - GL_WEIGHT_SUM_UNITY_ARB = $86A6; - {$EXTERNALSYM GL_WEIGHT_SUM_UNITY_ARB} - GL_VERTEX_BLEND_ARB = $86A7; - {$EXTERNALSYM GL_VERTEX_BLEND_ARB} - GL_CURRENT_WEIGHT_ARB = $86A8; - {$EXTERNALSYM GL_CURRENT_WEIGHT_ARB} - GL_WEIGHT_ARRAY_TYPE_ARB = $86A9; - {$EXTERNALSYM GL_WEIGHT_ARRAY_TYPE_ARB} - GL_WEIGHT_ARRAY_STRIDE_ARB = $86AA; - {$EXTERNALSYM GL_WEIGHT_ARRAY_STRIDE_ARB} - GL_WEIGHT_ARRAY_SIZE_ARB = $86AB; - {$EXTERNALSYM GL_WEIGHT_ARRAY_SIZE_ARB} - GL_WEIGHT_ARRAY_POINTER_ARB = $86AC; - {$EXTERNALSYM GL_WEIGHT_ARRAY_POINTER_ARB} - GL_WEIGHT_ARRAY_ARB = $86AD; - {$EXTERNALSYM GL_WEIGHT_ARRAY_ARB} - GL_MODELVIEW0_ARB = $1700; - {$EXTERNALSYM GL_MODELVIEW0_ARB} - GL_MODELVIEW1_ARB = $850A; - {$EXTERNALSYM GL_MODELVIEW1_ARB} - GL_MODELVIEW2_ARB = $8722; - {$EXTERNALSYM GL_MODELVIEW2_ARB} - GL_MODELVIEW3_ARB = $8723; - {$EXTERNALSYM GL_MODELVIEW3_ARB} - GL_MODELVIEW4_ARB = $8724; - {$EXTERNALSYM GL_MODELVIEW4_ARB} - GL_MODELVIEW5_ARB = $8725; - {$EXTERNALSYM GL_MODELVIEW5_ARB} - GL_MODELVIEW6_ARB = $8726; - {$EXTERNALSYM GL_MODELVIEW6_ARB} - GL_MODELVIEW7_ARB = $8727; - {$EXTERNALSYM GL_MODELVIEW7_ARB} - GL_MODELVIEW8_ARB = $8728; - {$EXTERNALSYM GL_MODELVIEW8_ARB} - GL_MODELVIEW9_ARB = $8729; - {$EXTERNALSYM GL_MODELVIEW9_ARB} - GL_MODELVIEW10_ARB = $872A; - {$EXTERNALSYM GL_MODELVIEW10_ARB} - GL_MODELVIEW11_ARB = $872B; - {$EXTERNALSYM GL_MODELVIEW11_ARB} - GL_MODELVIEW12_ARB = $872C; - {$EXTERNALSYM GL_MODELVIEW12_ARB} - GL_MODELVIEW13_ARB = $872D; - {$EXTERNALSYM GL_MODELVIEW13_ARB} - GL_MODELVIEW14_ARB = $872E; - {$EXTERNALSYM GL_MODELVIEW14_ARB} - GL_MODELVIEW15_ARB = $872F; - {$EXTERNALSYM GL_MODELVIEW15_ARB} - GL_MODELVIEW16_ARB = $8730; - {$EXTERNALSYM GL_MODELVIEW16_ARB} - GL_MODELVIEW17_ARB = $8731; - {$EXTERNALSYM GL_MODELVIEW17_ARB} - GL_MODELVIEW18_ARB = $8732; - {$EXTERNALSYM GL_MODELVIEW18_ARB} - GL_MODELVIEW19_ARB = $8733; - {$EXTERNALSYM GL_MODELVIEW19_ARB} - GL_MODELVIEW20_ARB = $8734; - {$EXTERNALSYM GL_MODELVIEW20_ARB} - GL_MODELVIEW21_ARB = $8735; - {$EXTERNALSYM GL_MODELVIEW21_ARB} - GL_MODELVIEW22_ARB = $8736; - {$EXTERNALSYM GL_MODELVIEW22_ARB} - GL_MODELVIEW23_ARB = $8737; - {$EXTERNALSYM GL_MODELVIEW23_ARB} - GL_MODELVIEW24_ARB = $8738; - {$EXTERNALSYM GL_MODELVIEW24_ARB} - GL_MODELVIEW25_ARB = $8739; - {$EXTERNALSYM GL_MODELVIEW25_ARB} - GL_MODELVIEW26_ARB = $873A; - {$EXTERNALSYM GL_MODELVIEW26_ARB} - GL_MODELVIEW27_ARB = $873B; - {$EXTERNALSYM GL_MODELVIEW27_ARB} - GL_MODELVIEW28_ARB = $873C; - {$EXTERNALSYM GL_MODELVIEW28_ARB} - GL_MODELVIEW29_ARB = $873D; - {$EXTERNALSYM GL_MODELVIEW29_ARB} - GL_MODELVIEW30_ARB = $873E; - {$EXTERNALSYM GL_MODELVIEW30_ARB} - GL_MODELVIEW31_ARB = $873F; - {$EXTERNALSYM GL_MODELVIEW31_ARB} - - // GL_SGIS_texture_filter4 - GL_FILTER4_SGIS = $8146; - {$EXTERNALSYM GL_FILTER4_SGIS} - GL_TEXTURE_FILTER4_SIZE_SGIS = $8147; - {$EXTERNALSYM GL_TEXTURE_FILTER4_SIZE_SGIS} - - // GL_SGIS_pixel_texture - GL_PIXEL_TEXTURE_SGIS = $8353; - {$EXTERNALSYM GL_PIXEL_TEXTURE_SGIS} - GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS = $8354; - {$EXTERNALSYM GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS} - GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS = $8355; - {$EXTERNALSYM GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS} - GL_PIXEL_GROUP_COLOR_SGIS = $8356; - {$EXTERNALSYM GL_PIXEL_GROUP_COLOR_SGIS} - - // GL_SGIX_pixel_texture - GL_PIXEL_TEX_GEN_SGIX = $8139; - {$EXTERNALSYM GL_PIXEL_TEX_GEN_SGIX} - GL_PIXEL_TEX_GEN_MODE_SGIX = $832B; - {$EXTERNALSYM GL_PIXEL_TEX_GEN_MODE_SGIX} - - // GL_SGIS_texture4D - GL_PACK_SKIP_VOLUMES_SGIS = $8130; - {$EXTERNALSYM GL_PACK_SKIP_VOLUMES_SGIS} - GL_PACK_IMAGE_DEPTH_SGIS = $8131; - {$EXTERNALSYM GL_PACK_IMAGE_DEPTH_SGIS} - GL_UNPACK_SKIP_VOLUMES_SGIS = $8132; - {$EXTERNALSYM GL_UNPACK_SKIP_VOLUMES_SGIS} - GL_UNPACK_IMAGE_DEPTH_SGIS = $8133; - {$EXTERNALSYM GL_UNPACK_IMAGE_DEPTH_SGIS} - GL_TEXTURE_4D_SGIS = $8134; - {$EXTERNALSYM GL_TEXTURE_4D_SGIS} - GL_PROXY_TEXTURE_4D_SGIS = $8135; - {$EXTERNALSYM GL_PROXY_TEXTURE_4D_SGIS} - GL_TEXTURE_4DSIZE_SGIS = $8136; - {$EXTERNALSYM GL_TEXTURE_4DSIZE_SGIS} - GL_TEXTURE_WRAP_Q_SGIS = $8137; - {$EXTERNALSYM GL_TEXTURE_WRAP_Q_SGIS} - GL_MAX_4D_TEXTURE_SIZE_SGIS = $8138; - {$EXTERNALSYM GL_MAX_4D_TEXTURE_SIZE_SGIS} - GL_TEXTURE_4D_BINDING_SGIS = $814F; - {$EXTERNALSYM GL_TEXTURE_4D_BINDING_SGIS} - - // GL_SGIS_detail_texture - GL_DETAIL_TEXTURE_2D_SGIS = $8095; - {$EXTERNALSYM GL_DETAIL_TEXTURE_2D_SGIS} - GL_DETAIL_TEXTURE_2D_BINDING_SGIS = $8096; - {$EXTERNALSYM GL_DETAIL_TEXTURE_2D_BINDING_SGIS} - GL_LINEAR_DETAIL_SGIS = $8097; - {$EXTERNALSYM GL_LINEAR_DETAIL_SGIS} - GL_LINEAR_DETAIL_ALPHA_SGIS = $8098; - {$EXTERNALSYM GL_LINEAR_DETAIL_ALPHA_SGIS} - GL_LINEAR_DETAIL_COLOR_SGIS = $8099; - {$EXTERNALSYM GL_LINEAR_DETAIL_COLOR_SGIS} - GL_DETAIL_TEXTURE_LEVEL_SGIS = $809A; - {$EXTERNALSYM GL_DETAIL_TEXTURE_LEVEL_SGIS} - GL_DETAIL_TEXTURE_MODE_SGIS = $809B; - {$EXTERNALSYM GL_DETAIL_TEXTURE_MODE_SGIS} - GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS = $809C; - {$EXTERNALSYM GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS} - - // GL_SGIS_sharpen_texture - GL_LINEAR_SHARPEN_SGIS = $80AD; - {$EXTERNALSYM GL_LINEAR_SHARPEN_SGIS} - GL_LINEAR_SHARPEN_ALPHA_SGIS = $80AE; - {$EXTERNALSYM GL_LINEAR_SHARPEN_ALPHA_SGIS} - GL_LINEAR_SHARPEN_COLOR_SGIS = $80AF; - {$EXTERNALSYM GL_LINEAR_SHARPEN_COLOR_SGIS} - GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS = $80B0; - {$EXTERNALSYM GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS} - - // GL_SGIS_texture_lod - GL_TEXTURE_MIN_LOD_SGIS = $813A; - {$EXTERNALSYM GL_TEXTURE_MIN_LOD_SGIS} - GL_TEXTURE_MAX_LOD_SGIS = $813B; - {$EXTERNALSYM GL_TEXTURE_MAX_LOD_SGIS} - GL_TEXTURE_BASE_LEVEL_SGIS = $813C; - {$EXTERNALSYM GL_TEXTURE_BASE_LEVEL_SGIS} - GL_TEXTURE_MAX_LEVEL_SGIS = $813D; - {$EXTERNALSYM GL_TEXTURE_MAX_LEVEL_SGIS} - - // GL_SGIS_multisample - GL_MULTISAMPLE_SGIS = $809D; - {$EXTERNALSYM GL_MULTISAMPLE_SGIS} - GL_SAMPLE_ALPHA_TO_MASK_SGIS = $809E; - {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_MASK_SGIS} - GL_SAMPLE_ALPHA_TO_ONE_SGIS = $809F; - {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_ONE_SGIS} - GL_SAMPLE_MASK_SGIS = $80A0; - {$EXTERNALSYM GL_SAMPLE_MASK_SGIS} - GL_1PASS_SGIS = $80A1; - {$EXTERNALSYM GL_1PASS_SGIS} - GL_2PASS_0_SGIS = $80A2; - {$EXTERNALSYM GL_2PASS_0_SGIS} - GL_2PASS_1_SGIS = $80A3; - {$EXTERNALSYM GL_2PASS_1_SGIS} - GL_4PASS_0_SGIS = $80A4; - {$EXTERNALSYM GL_4PASS_0_SGIS} - GL_4PASS_1_SGIS = $80A5; - {$EXTERNALSYM GL_4PASS_1_SGIS} - GL_4PASS_2_SGIS = $80A6; - {$EXTERNALSYM GL_4PASS_2_SGIS} - GL_4PASS_3_SGIS = $80A7; - {$EXTERNALSYM GL_4PASS_3_SGIS} - GL_SAMPLE_BUFFERS_SGIS = $80A8; - {$EXTERNALSYM GL_SAMPLE_BUFFERS_SGIS} - GL_SAMPLES_SGIS = $80A9; - {$EXTERNALSYM GL_SAMPLES_SGIS} - GL_SAMPLE_MASK_VALUE_SGIS = $80AA; - {$EXTERNALSYM GL_SAMPLE_MASK_VALUE_SGIS} - GL_SAMPLE_MASK_INVERT_SGIS = $80AB; - {$EXTERNALSYM GL_SAMPLE_MASK_INVERT_SGIS} - GL_SAMPLE_PATTERN_SGIS = $80AC; - {$EXTERNALSYM GL_SAMPLE_PATTERN_SGIS} - - // GL_SGIS_generate_mipmap - GL_GENERATE_MIPMAP_SGIS = $8191; - {$EXTERNALSYM GL_GENERATE_MIPMAP_SGIS} - GL_GENERATE_MIPMAP_HINT_SGIS = $8192; - {$EXTERNALSYM GL_GENERATE_MIPMAP_HINT_SGIS} - - // GL_SGIX_clipmap - GL_LINEAR_CLIPMAP_LINEAR_SGIX = $8170; - {$EXTERNALSYM GL_LINEAR_CLIPMAP_LINEAR_SGIX} - GL_TEXTURE_CLIPMAP_CENTER_SGIX = $8171; - {$EXTERNALSYM GL_TEXTURE_CLIPMAP_CENTER_SGIX} - GL_TEXTURE_CLIPMAP_FRAME_SGIX = $8172; - {$EXTERNALSYM GL_TEXTURE_CLIPMAP_FRAME_SGIX} - GL_TEXTURE_CLIPMAP_OFFSET_SGIX = $8173; - {$EXTERNALSYM GL_TEXTURE_CLIPMAP_OFFSET_SGIX} - GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX = $8174; - {$EXTERNALSYM GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX} - GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX = $8175; - {$EXTERNALSYM GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX} - GL_TEXTURE_CLIPMAP_DEPTH_SGIX = $8176; - {$EXTERNALSYM GL_TEXTURE_CLIPMAP_DEPTH_SGIX} - GL_MAX_CLIPMAP_DEPTH_SGIX = $8177; - {$EXTERNALSYM GL_MAX_CLIPMAP_DEPTH_SGIX} - GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX = $8178; - {$EXTERNALSYM GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX} - GL_NEAREST_CLIPMAP_NEAREST_SGIX = $844D; - {$EXTERNALSYM GL_NEAREST_CLIPMAP_NEAREST_SGIX} - GL_NEAREST_CLIPMAP_LINEAR_SGIX = $844E; - {$EXTERNALSYM GL_NEAREST_CLIPMAP_LINEAR_SGIX} - GL_LINEAR_CLIPMAP_NEAREST_SGIX = $844F; - {$EXTERNALSYM GL_LINEAR_CLIPMAP_NEAREST_SGIX} - - // GL_SGIX_shadow - GL_TEXTURE_COMPARE_SGIX = $819A; - {$EXTERNALSYM GL_TEXTURE_COMPARE_SGIX} - GL_TEXTURE_COMPARE_OPERATOR_SGIX = $819B; - {$EXTERNALSYM GL_TEXTURE_COMPARE_OPERATOR_SGIX} - GL_TEXTURE_LEQUAL_R_SGIX = $819C; - {$EXTERNALSYM GL_TEXTURE_LEQUAL_R_SGIX} - GL_TEXTURE_GEQUAL_R_SGIX = $819D; - {$EXTERNALSYM GL_TEXTURE_GEQUAL_R_SGIX} - - // GL_SGIS_texture_edge_clamp - GL_CLAMP_TO_EDGE_SGIS = $812F; - {$EXTERNALSYM GL_CLAMP_TO_EDGE_SGIS} - - // GL_SGIS_texture_border_clamp - GL_CLAMP_TO_BORDER_SGIS = $812D; - {$EXTERNALSYM GL_CLAMP_TO_BORDER_SGIS} - - // GL_SGIX_interlace - GL_INTERLACE_SGIX = $8094; - {$EXTERNALSYM GL_INTERLACE_SGIX} - - // GL_SGIX_pixel_tiles - GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX = $813E; - {$EXTERNALSYM GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX} - GL_PIXEL_TILE_CACHE_INCREMENT_SGIX = $813F; - {$EXTERNALSYM GL_PIXEL_TILE_CACHE_INCREMENT_SGIX} - GL_PIXEL_TILE_WIDTH_SGIX = $8140; - {$EXTERNALSYM GL_PIXEL_TILE_WIDTH_SGIX} - GL_PIXEL_TILE_HEIGHT_SGIX = $8141; - {$EXTERNALSYM GL_PIXEL_TILE_HEIGHT_SGIX} - GL_PIXEL_TILE_GRID_WIDTH_SGIX = $8142; - {$EXTERNALSYM GL_PIXEL_TILE_GRID_WIDTH_SGIX} - GL_PIXEL_TILE_GRID_HEIGHT_SGIX = $8143; - {$EXTERNALSYM GL_PIXEL_TILE_GRID_HEIGHT_SGIX} - GL_PIXEL_TILE_GRID_DEPTH_SGIX = $8144; - {$EXTERNALSYM GL_PIXEL_TILE_GRID_DEPTH_SGIX} - GL_PIXEL_TILE_CACHE_SIZE_SGIX = $8145; - {$EXTERNALSYM GL_PIXEL_TILE_CACHE_SIZE_SGIX} - - // GL_SGIS_texture_select - GL_DUAL_ALPHA4_SGIS = $8110; - {$EXTERNALSYM GL_DUAL_ALPHA4_SGIS} - GL_DUAL_ALPHA8_SGIS = $8111; - {$EXTERNALSYM GL_DUAL_ALPHA8_SGIS} - GL_DUAL_ALPHA12_SGIS = $8112; - {$EXTERNALSYM GL_DUAL_ALPHA12_SGIS} - GL_DUAL_ALPHA16_SGIS = $8113; - {$EXTERNALSYM GL_DUAL_ALPHA16_SGIS} - GL_DUAL_LUMINANCE4_SGIS = $8114; - {$EXTERNALSYM GL_DUAL_LUMINANCE4_SGIS} - GL_DUAL_LUMINANCE8_SGIS = $8115; - {$EXTERNALSYM GL_DUAL_LUMINANCE8_SGIS} - GL_DUAL_LUMINANCE12_SGIS = $8116; - {$EXTERNALSYM GL_DUAL_LUMINANCE12_SGIS} - GL_DUAL_LUMINANCE16_SGIS = $8117; - {$EXTERNALSYM GL_DUAL_LUMINANCE16_SGIS} - GL_DUAL_INTENSITY4_SGIS = $8118; - {$EXTERNALSYM GL_DUAL_INTENSITY4_SGIS} - GL_DUAL_INTENSITY8_SGIS = $8119; - {$EXTERNALSYM GL_DUAL_INTENSITY8_SGIS} - GL_DUAL_INTENSITY12_SGIS = $811A; - {$EXTERNALSYM GL_DUAL_INTENSITY12_SGIS} - GL_DUAL_INTENSITY16_SGIS = $811B; - {$EXTERNALSYM GL_DUAL_INTENSITY16_SGIS} - GL_DUAL_LUMINANCE_ALPHA4_SGIS = $811C; - {$EXTERNALSYM GL_DUAL_LUMINANCE_ALPHA4_SGIS} - GL_DUAL_LUMINANCE_ALPHA8_SGIS = $811D; - {$EXTERNALSYM GL_DUAL_LUMINANCE_ALPHA8_SGIS} - GL_QUAD_ALPHA4_SGIS = $811E; - {$EXTERNALSYM GL_QUAD_ALPHA4_SGIS} - GL_QUAD_ALPHA8_SGIS = $811F; - {$EXTERNALSYM GL_QUAD_ALPHA8_SGIS} - GL_QUAD_LUMINANCE4_SGIS = $8120; - {$EXTERNALSYM GL_QUAD_LUMINANCE4_SGIS} - GL_QUAD_LUMINANCE8_SGIS = $8121; - {$EXTERNALSYM GL_QUAD_LUMINANCE8_SGIS} - GL_QUAD_INTENSITY4_SGIS = $8122; - {$EXTERNALSYM GL_QUAD_INTENSITY4_SGIS} - GL_QUAD_INTENSITY8_SGIS = $8123; - {$EXTERNALSYM GL_QUAD_INTENSITY8_SGIS} - GL_DUAL_TEXTURE_SELECT_SGIS = $8124; - {$EXTERNALSYM GL_DUAL_TEXTURE_SELECT_SGIS} - GL_QUAD_TEXTURE_SELECT_SGIS = $8125; - {$EXTERNALSYM GL_QUAD_TEXTURE_SELECT_SGIS} - - // GL_SGIX_sprite - GL_SPRITE_SGIX = $8148; - {$EXTERNALSYM GL_SPRITE_SGIX} - GL_SPRITE_MODE_SGIX = $8149; - {$EXTERNALSYM GL_SPRITE_MODE_SGIX} - GL_SPRITE_AXIS_SGIX = $814A; - {$EXTERNALSYM GL_SPRITE_AXIS_SGIX} - GL_SPRITE_TRANSLATION_SGIX = $814B; - {$EXTERNALSYM GL_SPRITE_TRANSLATION_SGIX} - GL_SPRITE_AXIAL_SGIX = $814C; - {$EXTERNALSYM GL_SPRITE_AXIAL_SGIX} - GL_SPRITE_OBJECT_ALIGNED_SGIX = $814D; - {$EXTERNALSYM GL_SPRITE_OBJECT_ALIGNED_SGIX} - GL_SPRITE_EYE_ALIGNED_SGIX = $814E; - {$EXTERNALSYM GL_SPRITE_EYE_ALIGNED_SGIX} - - // GL_SGIX_texture_multi_buffer - GL_TEXTURE_MULTI_BUFFER_HINT_SGIX = $812E; - {$EXTERNALSYM GL_TEXTURE_MULTI_BUFFER_HINT_SGIX} - - // GL_SGIS_point_parameters - GL_POINT_SIZE_MIN_SGIS = $8126; - {$EXTERNALSYM GL_POINT_SIZE_MIN_SGIS} - GL_POINT_SIZE_MAX_SGIS = $8127; - {$EXTERNALSYM GL_POINT_SIZE_MAX_SGIS} - GL_POINT_FADE_THRESHOLD_SIZE_SGIS = $8128; - {$EXTERNALSYM GL_POINT_FADE_THRESHOLD_SIZE_SGIS} - GL_DISTANCE_ATTENUATION_SGIS = $8129; - {$EXTERNALSYM GL_DISTANCE_ATTENUATION_SGIS} - - // GL_SGIX_instruments - GL_INSTRUMENT_BUFFER_POINTER_SGIX = $8180; - {$EXTERNALSYM GL_INSTRUMENT_BUFFER_POINTER_SGIX} - GL_INSTRUMENT_MEASUREMENTS_SGIX = $8181; - {$EXTERNALSYM GL_INSTRUMENT_MEASUREMENTS_SGIX} - - // GL_SGIX_texture_scale_bias - GL_POST_TEXTURE_FILTER_BIAS_SGIX = $8179; - {$EXTERNALSYM GL_POST_TEXTURE_FILTER_BIAS_SGIX} - GL_POST_TEXTURE_FILTER_SCALE_SGIX = $817A; - {$EXTERNALSYM GL_POST_TEXTURE_FILTER_SCALE_SGIX} - GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX = $817B; - {$EXTERNALSYM GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX} - GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX = $817C; - {$EXTERNALSYM GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX} - - // GL_SGIX_framezoom - GL_FRAMEZOOM_SGIX = $818B; - {$EXTERNALSYM GL_FRAMEZOOM_SGIX} - GL_FRAMEZOOM_FACTOR_SGIX = $818C; - {$EXTERNALSYM GL_FRAMEZOOM_FACTOR_SGIX} - GL_MAX_FRAMEZOOM_FACTOR_SGIX = $818D; - {$EXTERNALSYM GL_MAX_FRAMEZOOM_FACTOR_SGIX} - - // GL_FfdMaskSGIX - GL_TEXTURE_DEFORMATION_BIT_SGIX = $00000001; - {$EXTERNALSYM GL_TEXTURE_DEFORMATION_BIT_SGIX} - GL_GEOMETRY_DEFORMATION_BIT_SGIX = $00000002; - {$EXTERNALSYM GL_GEOMETRY_DEFORMATION_BIT_SGIX} - - // GL_SGIX_polynomial_ffd - GL_GEOMETRY_DEFORMATION_SGIX = $8194; - {$EXTERNALSYM GL_GEOMETRY_DEFORMATION_SGIX} - GL_TEXTURE_DEFORMATION_SGIX = $8195; - {$EXTERNALSYM GL_TEXTURE_DEFORMATION_SGIX} - GL_DEFORMATIONS_MASK_SGIX = $8196; - {$EXTERNALSYM GL_DEFORMATIONS_MASK_SGIX} - GL_MAX_DEFORMATION_ORDER_SGIX = $8197; - {$EXTERNALSYM GL_MAX_DEFORMATION_ORDER_SGIX} - - // GL_SGIX_reference_plane - GL_REFERENCE_PLANE_SGIX = $817D; - {$EXTERNALSYM GL_REFERENCE_PLANE_SGIX} - GL_REFERENCE_PLANE_EQUATION_SGIX = $817E; - {$EXTERNALSYM GL_REFERENCE_PLANE_EQUATION_SGIX} - - // GL_SGIX_depth_texture - GL_DEPTH_COMPONENT16_SGIX = $81A5; - {$EXTERNALSYM GL_DEPTH_COMPONENT16_SGIX} - GL_DEPTH_COMPONENT24_SGIX = $81A6; - {$EXTERNALSYM GL_DEPTH_COMPONENT24_SGIX} - GL_DEPTH_COMPONENT32_SGIX = $81A7; - {$EXTERNALSYM GL_DEPTH_COMPONENT32_SGIX} - - // GL_SGIS_fog_function - GL_FOG_FUNC_SGIS = $812A; - {$EXTERNALSYM GL_FOG_FUNC_SGIS} - GL_FOG_FUNC_POINTS_SGIS = $812B; - {$EXTERNALSYM GL_FOG_FUNC_POINTS_SGIS} - GL_MAX_FOG_FUNC_POINTS_SGIS = $812C; - {$EXTERNALSYM GL_MAX_FOG_FUNC_POINTS_SGIS} - - // GL_SGIX_fog_offset - GL_FOG_OFFSET_SGIX = $8198; - {$EXTERNALSYM GL_FOG_OFFSET_SGIX} - GL_FOG_OFFSET_VALUE_SGIX = $8199; - {$EXTERNALSYM GL_FOG_OFFSET_VALUE_SGIX} - - // GL_HP_image_transform - GL_IMAGE_SCALE_X_HP = $8155; - {$EXTERNALSYM GL_IMAGE_SCALE_X_HP} - GL_IMAGE_SCALE_Y_HP = $8156; - {$EXTERNALSYM GL_IMAGE_SCALE_Y_HP} - GL_IMAGE_TRANSLATE_X_HP = $8157; - {$EXTERNALSYM GL_IMAGE_TRANSLATE_X_HP} - GL_IMAGE_TRANSLATE_Y_HP = $8158; - {$EXTERNALSYM GL_IMAGE_TRANSLATE_Y_HP} - GL_IMAGE_ROTATE_ANGLE_HP = $8159; - {$EXTERNALSYM GL_IMAGE_ROTATE_ANGLE_HP} - GL_IMAGE_ROTATE_ORIGIN_X_HP = $815A; - {$EXTERNALSYM GL_IMAGE_ROTATE_ORIGIN_X_HP} - GL_IMAGE_ROTATE_ORIGIN_Y_HP = $815B; - {$EXTERNALSYM GL_IMAGE_ROTATE_ORIGIN_Y_HP} - GL_IMAGE_MAG_FILTER_HP = $815C; - {$EXTERNALSYM GL_IMAGE_MAG_FILTER_HP} - GL_IMAGE_MIN_FILTER_HP = $815D; - {$EXTERNALSYM GL_IMAGE_MIN_FILTER_HP} - GL_IMAGE_CUBIC_WEIGHT_HP = $815E; - {$EXTERNALSYM GL_IMAGE_CUBIC_WEIGHT_HP} - GL_CUBIC_HP = $815F; - {$EXTERNALSYM GL_CUBIC_HP} - GL_AVERAGE_HP = $8160; - {$EXTERNALSYM GL_AVERAGE_HP} - GL_IMAGE_TRANSFORM_2D_HP = $8161; - {$EXTERNALSYM GL_IMAGE_TRANSFORM_2D_HP} - GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP = $8162; - {$EXTERNALSYM GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP} - GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP = $8163; - {$EXTERNALSYM GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP} - - // GL_HP_convolution_border_modes - GL_IGNORE_BORDER_HP = $8150; - {$EXTERNALSYM GL_IGNORE_BORDER_HP} - GL_CONSTANT_BORDER_HP = $8151; - {$EXTERNALSYM GL_CONSTANT_BORDER_HP} - GL_REPLICATE_BORDER_HP = $8153; - {$EXTERNALSYM GL_REPLICATE_BORDER_HP} - GL_CONVOLUTION_BORDER_COLOR_HP = $8154; - {$EXTERNALSYM GL_CONVOLUTION_BORDER_COLOR_HP} - - // GL_SGIX_texture_add_env - GL_TEXTURE_ENV_BIAS_SGIX = $80BE; - {$EXTERNALSYM GL_TEXTURE_ENV_BIAS_SGIX} - - // GL_PGI_vertex_hints - GL_VERTEX_DATA_HINT_PGI = $1A22A; - {$EXTERNALSYM GL_VERTEX_DATA_HINT_PGI} - GL_VERTEX_CONSISTENT_HINT_PGI = $1A22B; - {$EXTERNALSYM GL_VERTEX_CONSISTENT_HINT_PGI} - GL_MATERIAL_SIDE_HINT_PGI = $1A22C; - {$EXTERNALSYM GL_MATERIAL_SIDE_HINT_PGI} - GL_MAX_VERTEX_HINT_PGI = $1A22D; - {$EXTERNALSYM GL_MAX_VERTEX_HINT_PGI} - GL_COLOR3_BIT_PGI = $00010000; - {$EXTERNALSYM GL_COLOR3_BIT_PGI} - GL_COLOR4_BIT_PGI = $00020000; - {$EXTERNALSYM GL_COLOR4_BIT_PGI} - GL_EDGEFLAG_BIT_PGI = $00040000; - {$EXTERNALSYM GL_EDGEFLAG_BIT_PGI} - GL_INDEX_BIT_PGI = $00080000; - {$EXTERNALSYM GL_INDEX_BIT_PGI} - GL_MAT_AMBIENT_BIT_PGI = $00100000; - {$EXTERNALSYM GL_MAT_AMBIENT_BIT_PGI} - GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI = $00200000; - {$EXTERNALSYM GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI} - GL_MAT_DIFFUSE_BIT_PGI = $00400000; - {$EXTERNALSYM GL_MAT_DIFFUSE_BIT_PGI} - GL_MAT_EMISSION_BIT_PGI = $00800000; - {$EXTERNALSYM GL_MAT_EMISSION_BIT_PGI} - GL_MAT_COLOR_INDEXES_BIT_PGI = $01000000; - {$EXTERNALSYM GL_MAT_COLOR_INDEXES_BIT_PGI} - GL_MAT_SHININESS_BIT_PGI = $02000000; - {$EXTERNALSYM GL_MAT_SHININESS_BIT_PGI} - GL_MAT_SPECULAR_BIT_PGI = $04000000; - {$EXTERNALSYM GL_MAT_SPECULAR_BIT_PGI} - GL_NORMAL_BIT_PGI = $08000000; - {$EXTERNALSYM GL_NORMAL_BIT_PGI} - GL_TEXCOORD1_BIT_PGI = $10000000; - {$EXTERNALSYM GL_TEXCOORD1_BIT_PGI} - GL_TEXCOORD2_BIT_PGI = $20000000; - {$EXTERNALSYM GL_TEXCOORD2_BIT_PGI} - GL_TEXCOORD3_BIT_PGI = $40000000; - {$EXTERNALSYM GL_TEXCOORD3_BIT_PGI} - GL_TEXCOORD4_BIT_PGI = $80000000; - {$EXTERNALSYM GL_TEXCOORD4_BIT_PGI} - GL_VERTEX23_BIT_PGI = $00000004; - {$EXTERNALSYM GL_VERTEX23_BIT_PGI} - GL_VERTEX4_BIT_PGI = $00000008; - {$EXTERNALSYM GL_VERTEX4_BIT_PGI} - - // GL_PGI_misc_hints - GL_PREFER_DOUBLEBUFFER_HINT_PGI = $1A1F8; - {$EXTERNALSYM GL_PREFER_DOUBLEBUFFER_HINT_PGI} - GL_CONSERVE_MEMORY_HINT_PGI = $1A1FD; - {$EXTERNALSYM GL_CONSERVE_MEMORY_HINT_PGI} - GL_RECLAIM_MEMORY_HINT_PGI = $1A1FE; - {$EXTERNALSYM GL_RECLAIM_MEMORY_HINT_PGI} - GL_NATIVE_GRAPHICS_HANDLE_PGI = $1A202; - {$EXTERNALSYM GL_NATIVE_GRAPHICS_HANDLE_PGI} - GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI = $1A203; - {$EXTERNALSYM GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI} - GL_NATIVE_GRAPHICS_END_HINT_PGI = $1A204; - {$EXTERNALSYM GL_NATIVE_GRAPHICS_END_HINT_PGI} - GL_ALWAYS_FAST_HINT_PGI = $1A20C; - {$EXTERNALSYM GL_ALWAYS_FAST_HINT_PGI} - GL_ALWAYS_SOFT_HINT_PGI = $1A20D; - {$EXTERNALSYM GL_ALWAYS_SOFT_HINT_PGI} - GL_ALLOW_DRAW_OBJ_HINT_PGI = $1A20E; - {$EXTERNALSYM GL_ALLOW_DRAW_OBJ_HINT_PGI} - GL_ALLOW_DRAW_WIN_HINT_PGI = $1A20F; - {$EXTERNALSYM GL_ALLOW_DRAW_WIN_HINT_PGI} - GL_ALLOW_DRAW_FRG_HINT_PGI = $1A210; - {$EXTERNALSYM GL_ALLOW_DRAW_FRG_HINT_PGI} - GL_ALLOW_DRAW_MEM_HINT_PGI = $1A211; - {$EXTERNALSYM GL_ALLOW_DRAW_MEM_HINT_PGI} - GL_STRICT_DEPTHFUNC_HINT_PGI = $1A216; - {$EXTERNALSYM GL_STRICT_DEPTHFUNC_HINT_PGI} - GL_STRICT_LIGHTING_HINT_PGI = $1A217; - {$EXTERNALSYM GL_STRICT_LIGHTING_HINT_PGI} - GL_STRICT_SCISSOR_HINT_PGI = $1A218; - {$EXTERNALSYM GL_STRICT_SCISSOR_HINT_PGI} - GL_FULL_STIPPLE_HINT_PGI = $1A219; - {$EXTERNALSYM GL_FULL_STIPPLE_HINT_PGI} - GL_CLIP_NEAR_HINT_PGI = $1A220; - {$EXTERNALSYM GL_CLIP_NEAR_HINT_PGI} - GL_CLIP_FAR_HINT_PGI = $1A221; - {$EXTERNALSYM GL_CLIP_FAR_HINT_PGI} - GL_WIDE_LINE_HINT_PGI = $1A222; - {$EXTERNALSYM GL_WIDE_LINE_HINT_PGI} - GL_BACK_NORMALS_HINT_PGI = $1A223; - {$EXTERNALSYM GL_BACK_NORMALS_HINT_PGI} - - // GL_EXT_paletted_texture - GL_TEXTURE_INDEX_SIZE_EXT = $80ED; - {$EXTERNALSYM GL_TEXTURE_INDEX_SIZE_EXT} - - // GL_SGIX_list_priority - GL_LIST_PRIORITY_SGIX = $8182; - {$EXTERNALSYM GL_LIST_PRIORITY_SGIX} - - // GL_SGIX_ir_instrument1 - GL_IR_INSTRUMENT1_SGIX = $817F; - {$EXTERNALSYM GL_IR_INSTRUMENT1_SGIX} - - // GL_SGIX_calligraphic_fragment - GL_CALLIGRAPHIC_FRAGMENT_SGIX = $8183; - {$EXTERNALSYM GL_CALLIGRAPHIC_FRAGMENT_SGIX} - - // GL_SGIX_texture_lod_bias - GL_TEXTURE_LOD_BIAS_S_SGIX = $818E; - {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_S_SGIX} - GL_TEXTURE_LOD_BIAS_T_SGIX = $818F; - {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_T_SGIX} - GL_TEXTURE_LOD_BIAS_R_SGIX = $8190; - {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_R_SGIX} - - // GL_SGIX_shadow_ambient - GL_SHADOW_AMBIENT_SGIX = $80BF; - {$EXTERNALSYM GL_SHADOW_AMBIENT_SGIX} - - // GL_SGIX_ycrcb - GL_YCRCB_422_SGIX = $81BB; - {$EXTERNALSYM GL_YCRCB_422_SGIX} - GL_YCRCB_444_SGIX = $81BC; - {$EXTERNALSYM GL_YCRCB_444_SGIX} - - // GL_SGIX_fragment_lighting - GL_FRAGMENT_LIGHTING_SGIX = $8400; - {$EXTERNALSYM GL_FRAGMENT_LIGHTING_SGIX} - GL_FRAGMENT_COLOR_MATERIAL_SGIX = $8401; - {$EXTERNALSYM GL_FRAGMENT_COLOR_MATERIAL_SGIX} - GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX = $8402; - {$EXTERNALSYM GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX} - GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX = $8403; - {$EXTERNALSYM GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX} - GL_MAX_FRAGMENT_LIGHTS_SGIX = $8404; - {$EXTERNALSYM GL_MAX_FRAGMENT_LIGHTS_SGIX} - GL_MAX_ACTIVE_LIGHTS_SGIX = $8405; - {$EXTERNALSYM GL_MAX_ACTIVE_LIGHTS_SGIX} - GL_CURRENT_RASTER_NORMAL_SGIX = $8406; - {$EXTERNALSYM GL_CURRENT_RASTER_NORMAL_SGIX} - GL_LIGHT_ENV_MODE_SGIX = $8407; - {$EXTERNALSYM GL_LIGHT_ENV_MODE_SGIX} - GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX = $8408; - {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX} - GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX = $8409; - {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX} - GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX = $840A; - {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX} - GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX = $840B; - {$EXTERNALSYM GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX} - GL_FRAGMENT_LIGHT0_SGIX = $840C; - {$EXTERNALSYM GL_FRAGMENT_LIGHT0_SGIX} - GL_FRAGMENT_LIGHT1_SGIX = $840D; - {$EXTERNALSYM GL_FRAGMENT_LIGHT1_SGIX} - GL_FRAGMENT_LIGHT2_SGIX = $840E; - {$EXTERNALSYM GL_FRAGMENT_LIGHT2_SGIX} - GL_FRAGMENT_LIGHT3_SGIX = $840F; - {$EXTERNALSYM GL_FRAGMENT_LIGHT3_SGIX} - GL_FRAGMENT_LIGHT4_SGIX = $8410; - {$EXTERNALSYM GL_FRAGMENT_LIGHT4_SGIX} - GL_FRAGMENT_LIGHT5_SGIX = $8411; - {$EXTERNALSYM GL_FRAGMENT_LIGHT5_SGIX} - GL_FRAGMENT_LIGHT6_SGIX = $8412; - {$EXTERNALSYM GL_FRAGMENT_LIGHT6_SGIX} - GL_FRAGMENT_LIGHT7_SGIX = $8413; - {$EXTERNALSYM GL_FRAGMENT_LIGHT7_SGIX} - - // GL_IBM_rasterpos_clip - GL_RASTER_POSITION_UNCLIPPED_IBM = $19262; - {$EXTERNALSYM GL_RASTER_POSITION_UNCLIPPED_IBM} - - // GL_HP_texture_lighting - GL_TEXTURE_LIGHTING_MODE_HP = $8167; - {$EXTERNALSYM GL_TEXTURE_LIGHTING_MODE_HP} - GL_TEXTURE_POST_SPECULAR_HP = $8168; - {$EXTERNALSYM GL_TEXTURE_POST_SPECULAR_HP} - GL_TEXTURE_PRE_SPECULAR_HP = $8169; - {$EXTERNALSYM GL_TEXTURE_PRE_SPECULAR_HP} - - // GL_EXT_draw_range_elements - GL_MAX_ELEMENTS_VERTICES_EXT = $80E8; - {$EXTERNALSYM GL_MAX_ELEMENTS_VERTICES_EXT} - GL_MAX_ELEMENTS_INDICES_EXT = $80E9; - {$EXTERNALSYM GL_MAX_ELEMENTS_INDICES_EXT} - - // GL_WIN_phong_shading - GL_PHONG_WIN = $80EA; - {$EXTERNALSYM GL_PHONG_WIN} - GL_PHONG_HINT_WIN = $80EB; - {$EXTERNALSYM GL_PHONG_HINT_WIN} - - // GL_WIN_specular_fog - GL_FOG_SPECULAR_TEXTURE_WIN = $80EC; - {$EXTERNALSYM GL_FOG_SPECULAR_TEXTURE_WIN} - - // GL_EXT_light_texture - GL_FRAGMENT_MATERIAL_EXT = $8349; - {$EXTERNALSYM GL_FRAGMENT_MATERIAL_EXT} - GL_FRAGMENT_NORMAL_EXT = $834A; - {$EXTERNALSYM GL_FRAGMENT_NORMAL_EXT} - GL_FRAGMENT_COLOR_EXT = $834C; - {$EXTERNALSYM GL_FRAGMENT_COLOR_EXT} - GL_ATTENUATION_EXT = $834D; - {$EXTERNALSYM GL_ATTENUATION_EXT} - GL_SHADOW_ATTENUATION_EXT = $834E; - {$EXTERNALSYM GL_SHADOW_ATTENUATION_EXT} - GL_TEXTURE_APPLICATION_MODE_EXT = $834F; - {$EXTERNALSYM GL_TEXTURE_APPLICATION_MODE_EXT} - GL_TEXTURE_LIGHT_EXT = $8350; - {$EXTERNALSYM GL_TEXTURE_LIGHT_EXT} - GL_TEXTURE_MATERIAL_FACE_EXT = $8351; - {$EXTERNALSYM GL_TEXTURE_MATERIAL_FACE_EXT} - GL_TEXTURE_MATERIAL_PARAMETER_EXT = $8352; - {$EXTERNALSYM GL_TEXTURE_MATERIAL_PARAMETER_EXT} - - // GL_SGIX_blend_alpha_minmax - GL_ALPHA_MIN_SGIX = $8320; - {$EXTERNALSYM GL_ALPHA_MIN_SGIX} - GL_ALPHA_MAX_SGIX = $8321; - {$EXTERNALSYM GL_ALPHA_MAX_SGIX} - - // GL_SGIX_async - GL_ASYNC_MARKER_SGIX = $8329; - {$EXTERNALSYM GL_ASYNC_MARKER_SGIX} - - // GL_SGIX_async_pixel - GL_ASYNC_TEX_IMAGE_SGIX = $835C; - {$EXTERNALSYM GL_ASYNC_TEX_IMAGE_SGIX} - GL_ASYNC_DRAW_PIXELS_SGIX = $835D; - {$EXTERNALSYM GL_ASYNC_DRAW_PIXELS_SGIX} - GL_ASYNC_READ_PIXELS_SGIX = $835E; - {$EXTERNALSYM GL_ASYNC_READ_PIXELS_SGIX} - GL_MAX_ASYNC_TEX_IMAGE_SGIX = $835F; - {$EXTERNALSYM GL_MAX_ASYNC_TEX_IMAGE_SGIX} - GL_MAX_ASYNC_DRAW_PIXELS_SGIX = $8360; - {$EXTERNALSYM GL_MAX_ASYNC_DRAW_PIXELS_SGIX} - GL_MAX_ASYNC_READ_PIXELS_SGIX = $8361; - {$EXTERNALSYM GL_MAX_ASYNC_READ_PIXELS_SGIX} - - // GL_SGIX_async_histogram - GL_ASYNC_HISTOGRAM_SGIX = $832C; - {$EXTERNALSYM GL_ASYNC_HISTOGRAM_SGIX} - GL_MAX_ASYNC_HISTOGRAM_SGIX = $832D; - {$EXTERNALSYM GL_MAX_ASYNC_HISTOGRAM_SGIX} - - // GL_INTEL_parallel_arrays - GL_PARALLEL_ARRAYS_INTEL = $83F4; - {$EXTERNALSYM GL_PARALLEL_ARRAYS_INTEL} - GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL = $83F5; - {$EXTERNALSYM GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL} - GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL = $83F6; - {$EXTERNALSYM GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL} - GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL = $83F7; - {$EXTERNALSYM GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL} - GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL = $83F8; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL} - - // GL_HP_occlusion_test - GL_OCCLUSION_TEST_HP = $8165; - {$EXTERNALSYM GL_OCCLUSION_TEST_HP} - GL_OCCLUSION_TEST_RESULT_HP = $8166; - {$EXTERNALSYM GL_OCCLUSION_TEST_RESULT_HP} - - // GL_EXT_pixel_transform - GL_PIXEL_TRANSFORM_2D_EXT = $8330; - {$EXTERNALSYM GL_PIXEL_TRANSFORM_2D_EXT} - GL_PIXEL_MAG_FILTER_EXT = $8331; - {$EXTERNALSYM GL_PIXEL_MAG_FILTER_EXT} - GL_PIXEL_MIN_FILTER_EXT = $8332; - {$EXTERNALSYM GL_PIXEL_MIN_FILTER_EXT} - GL_PIXEL_CUBIC_WEIGHT_EXT = $8333; - {$EXTERNALSYM GL_PIXEL_CUBIC_WEIGHT_EXT} - GL_CUBIC_EXT = $8334; - {$EXTERNALSYM GL_CUBIC_EXT} - GL_AVERAGE_EXT = $8335; - {$EXTERNALSYM GL_AVERAGE_EXT} - GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT = $8336; - {$EXTERNALSYM GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT} - GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT = $8337; - {$EXTERNALSYM GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT} - GL_PIXEL_TRANSFORM_2D_MATRIX_EXT = $8338; - {$EXTERNALSYM GL_PIXEL_TRANSFORM_2D_MATRIX_EXT} - - // GL_EXT_separate_specular_color - GL_LIGHT_MODEL_COLOR_CONTROL_EXT = $81F8; - {$EXTERNALSYM GL_LIGHT_MODEL_COLOR_CONTROL_EXT} - GL_SINGLE_COLOR_EXT = $81F9; - {$EXTERNALSYM GL_SINGLE_COLOR_EXT} - GL_SEPARATE_SPECULAR_COLOR_EXT = $81FA; - {$EXTERNALSYM GL_SEPARATE_SPECULAR_COLOR_EXT} - - // GL_EXT_secondary_color - GL_COLOR_SUM_EXT = $8458; - {$EXTERNALSYM GL_COLOR_SUM_EXT} - GL_CURRENT_SECONDARY_COLOR_EXT = $8459; - {$EXTERNALSYM GL_CURRENT_SECONDARY_COLOR_EXT} - GL_SECONDARY_COLOR_ARRAY_SIZE_EXT = $845A; - {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_SIZE_EXT} - GL_SECONDARY_COLOR_ARRAY_TYPE_EXT = $845B; - {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_TYPE_EXT} - GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT = $845C; - {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT} - GL_SECONDARY_COLOR_ARRAY_POINTER_EXT = $845D; - {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_POINTER_EXT} - GL_SECONDARY_COLOR_ARRAY_EXT = $845E; - {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_EXT} - - // GL_EXT_texture_perturb_normal - GL_PERTURB_EXT = $85AE; - {$EXTERNALSYM GL_PERTURB_EXT} - GL_TEXTURE_NORMAL_EXT = $85AF; - {$EXTERNALSYM GL_TEXTURE_NORMAL_EXT} - - // GL_EXT_fog_coord - GL_FOG_COORDINATE_SOURCE_EXT = $8450; - {$EXTERNALSYM GL_FOG_COORDINATE_SOURCE_EXT} - GL_FOG_COORDINATE_EXT = $8451; - {$EXTERNALSYM GL_FOG_COORDINATE_EXT} - GL_FRAGMENT_DEPTH_EXT = $8452; - {$EXTERNALSYM GL_FRAGMENT_DEPTH_EXT} - GL_CURRENT_FOG_COORDINATE_EXT = $8453; - {$EXTERNALSYM GL_CURRENT_FOG_COORDINATE_EXT} - GL_FOG_COORDINATE_ARRAY_TYPE_EXT = $8454; - {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_TYPE_EXT} - GL_FOG_COORDINATE_ARRAY_STRIDE_EXT = $8455; - {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_STRIDE_EXT} - GL_FOG_COORDINATE_ARRAY_POINTER_EXT = $8456; - {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_POINTER_EXT} - GL_FOG_COORDINATE_ARRAY_EXT = $8457; - {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_EXT} - - // GL_REND_screen_coordinates - GL_SCREEN_COORDINATES_REND = $8490; - {$EXTERNALSYM GL_SCREEN_COORDINATES_REND} - GL_INVERTED_SCREEN_W_REND = $8491; - {$EXTERNALSYM GL_INVERTED_SCREEN_W_REND} - - // GL_EXT_coordinate_frame - GL_TANGENT_ARRAY_EXT = $8439; - {$EXTERNALSYM GL_TANGENT_ARRAY_EXT} - GL_BINORMAL_ARRAY_EXT = $843A; - {$EXTERNALSYM GL_BINORMAL_ARRAY_EXT} - GL_CURRENT_TANGENT_EXT = $843B; - {$EXTERNALSYM GL_CURRENT_TANGENT_EXT} - GL_CURRENT_BINORMAL_EXT = $843C; - {$EXTERNALSYM GL_CURRENT_BINORMAL_EXT} - GL_TANGENT_ARRAY_TYPE_EXT = $843E; - {$EXTERNALSYM GL_TANGENT_ARRAY_TYPE_EXT} - GL_TANGENT_ARRAY_STRIDE_EXT = $843F; - {$EXTERNALSYM GL_TANGENT_ARRAY_STRIDE_EXT} - GL_BINORMAL_ARRAY_TYPE_EXT = $8440; - {$EXTERNALSYM GL_BINORMAL_ARRAY_TYPE_EXT} - GL_BINORMAL_ARRAY_STRIDE_EXT = $8441; - {$EXTERNALSYM GL_BINORMAL_ARRAY_STRIDE_EXT} - GL_TANGENT_ARRAY_POINTER_EXT = $8442; - {$EXTERNALSYM GL_TANGENT_ARRAY_POINTER_EXT} - GL_BINORMAL_ARRAY_POINTER_EXT = $8443; - {$EXTERNALSYM GL_BINORMAL_ARRAY_POINTER_EXT} - GL_MAP1_TANGENT_EXT = $8444; - {$EXTERNALSYM GL_MAP1_TANGENT_EXT} - GL_MAP2_TANGENT_EXT = $8445; - {$EXTERNALSYM GL_MAP2_TANGENT_EXT} - GL_MAP1_BINORMAL_EXT = $8446; - {$EXTERNALSYM GL_MAP1_BINORMAL_EXT} - GL_MAP2_BINORMAL_EXT = $8447; - {$EXTERNALSYM GL_MAP2_BINORMAL_EXT} - - // GL_EXT_texture_env_combine - GL_SOURCE3_RGB_EXT = $8583; - {$EXTERNALSYM GL_SOURCE3_RGB_EXT} - GL_SOURCE4_RGB_EXT = $8584; - {$EXTERNALSYM GL_SOURCE4_RGB_EXT} - GL_SOURCE5_RGB_EXT = $8585; - {$EXTERNALSYM GL_SOURCE5_RGB_EXT} - GL_SOURCE6_RGB_EXT = $8586; - {$EXTERNALSYM GL_SOURCE6_RGB_EXT} - GL_SOURCE7_RGB_EXT = $8587; - {$EXTERNALSYM GL_SOURCE7_RGB_EXT} - GL_SOURCE3_ALPHA_EXT = $858B; - {$EXTERNALSYM GL_SOURCE3_ALPHA_EXT} - GL_SOURCE4_ALPHA_EXT = $858C; - {$EXTERNALSYM GL_SOURCE4_ALPHA_EXT} - GL_SOURCE5_ALPHA_EXT = $858D; - {$EXTERNALSYM GL_SOURCE5_ALPHA_EXT} - GL_SOURCE6_ALPHA_EXT = $858E; - {$EXTERNALSYM GL_SOURCE6_ALPHA_EXT} - GL_SOURCE7_ALPHA_EXT = $858F; - {$EXTERNALSYM GL_SOURCE7_ALPHA_EXT} - GL_OPERAND3_RGB_EXT = $8593; - {$EXTERNALSYM GL_OPERAND3_RGB_EXT} - GL_OPERAND4_RGB_EXT = $8594; - {$EXTERNALSYM GL_OPERAND4_RGB_EXT} - GL_OPERAND5_RGB_EXT = $8595; - {$EXTERNALSYM GL_OPERAND5_RGB_EXT} - GL_OPERAND6_RGB_EXT = $8596; - {$EXTERNALSYM GL_OPERAND6_RGB_EXT} - GL_OPERAND7_RGB_EXT = $8597; - {$EXTERNALSYM GL_OPERAND7_RGB_EXT} - GL_OPERAND3_ALPHA_EXT = $859B; - {$EXTERNALSYM GL_OPERAND3_ALPHA_EXT} - GL_OPERAND4_ALPHA_EXT = $859C; - {$EXTERNALSYM GL_OPERAND4_ALPHA_EXT} - GL_OPERAND5_ALPHA_EXT = $859D; - {$EXTERNALSYM GL_OPERAND5_ALPHA_EXT} - GL_OPERAND6_ALPHA_EXT = $859E; - {$EXTERNALSYM GL_OPERAND6_ALPHA_EXT} - GL_OPERAND7_ALPHA_EXT = $859F; - {$EXTERNALSYM GL_OPERAND7_ALPHA_EXT} - - // GL_APPLE_specular_vector - GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE = $85B0; - {$EXTERNALSYM GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE} - - // GL_APPLE_transform_hint - GL_TRANSFORM_HINT_APPLE = $85B1; - {$EXTERNALSYM GL_TRANSFORM_HINT_APPLE} - - // GL_SGIX_fog_scale - GL_FOG_SCALE_SGIX = $81FC; - {$EXTERNALSYM GL_FOG_SCALE_SGIX} - GL_FOG_SCALE_VALUE_SGIX = $81FD; - {$EXTERNALSYM GL_FOG_SCALE_VALUE_SGIX} - - // GL_SUNX_constant_data - GL_UNPACK_CONSTANT_DATA_SUNX = $81D5; - {$EXTERNALSYM GL_UNPACK_CONSTANT_DATA_SUNX} - GL_TEXTURE_CONSTANT_DATA_SUNX = $81D6; - {$EXTERNALSYM GL_TEXTURE_CONSTANT_DATA_SUNX} - - // GL_SUN_global_alpha - GL_GLOBAL_ALPHA_SUN = $81D9; - {$EXTERNALSYM GL_GLOBAL_ALPHA_SUN} - GL_GLOBAL_ALPHA_FACTOR_SUN = $81DA; - {$EXTERNALSYM GL_GLOBAL_ALPHA_FACTOR_SUN} - - // GL_SUN_triangle_list - GL_RESTART_SUN = $01; - {$EXTERNALSYM GL_RESTART_SUN} - GL_REPLACE_MIDDLE_SUN = $02; - {$EXTERNALSYM GL_REPLACE_MIDDLE_SUN} - GL_REPLACE_OLDEST_SUN = $03; - {$EXTERNALSYM GL_REPLACE_OLDEST_SUN} - GL_TRIANGLE_LIST_SUN = $81D7; - {$EXTERNALSYM GL_TRIANGLE_LIST_SUN} - GL_REPLACEMENT_CODE_SUN = $81D8; - {$EXTERNALSYM GL_REPLACEMENT_CODE_SUN} - GL_REPLACEMENT_CODE_ARRAY_SUN = $85C0; - {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_SUN} - GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN = $85C1; - {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN} - GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN = $85C2; - {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN} - GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN = $85C3; - {$EXTERNALSYM GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN} - GL_R1UI_V3F_SUN = $85C4; - {$EXTERNALSYM GL_R1UI_V3F_SUN} - GL_R1UI_C4UB_V3F_SUN = $85C5; - {$EXTERNALSYM GL_R1UI_C4UB_V3F_SUN} - GL_R1UI_C3F_V3F_SUN = $85C6; - {$EXTERNALSYM GL_R1UI_C3F_V3F_SUN} - GL_R1UI_N3F_V3F_SUN = $85C7; - {$EXTERNALSYM GL_R1UI_N3F_V3F_SUN} - GL_R1UI_C4F_N3F_V3F_SUN = $85C8; - {$EXTERNALSYM GL_R1UI_C4F_N3F_V3F_SUN} - GL_R1UI_T2F_V3F_SUN = $85C9; - {$EXTERNALSYM GL_R1UI_T2F_V3F_SUN} - GL_R1UI_T2F_N3F_V3F_SUN = $85CA; - {$EXTERNALSYM GL_R1UI_T2F_N3F_V3F_SUN} - GL_R1UI_T2F_C4F_N3F_V3F_SUN = $85CB; - {$EXTERNALSYM GL_R1UI_T2F_C4F_N3F_V3F_SUN} - - // GL_EXT_blend_func_separate - GL_BLEND_DST_RGB_EXT = $80C8; - {$EXTERNALSYM GL_BLEND_DST_RGB_EXT} - GL_BLEND_SRC_RGB_EXT = $80C9; - {$EXTERNALSYM GL_BLEND_SRC_RGB_EXT} - GL_BLEND_DST_ALPHA_EXT = $80CA; - {$EXTERNALSYM GL_BLEND_DST_ALPHA_EXT} - GL_BLEND_SRC_ALPHA_EXT = $80CB; - {$EXTERNALSYM GL_BLEND_SRC_ALPHA_EXT} - - // GL_INGR_color_clamp - GL_RED_MIN_CLAMP_INGR = $8560; - {$EXTERNALSYM GL_RED_MIN_CLAMP_INGR} - GL_GREEN_MIN_CLAMP_INGR = $8561; - {$EXTERNALSYM GL_GREEN_MIN_CLAMP_INGR} - GL_BLUE_MIN_CLAMP_INGR = $8562; - {$EXTERNALSYM GL_BLUE_MIN_CLAMP_INGR} - GL_ALPHA_MIN_CLAMP_INGR = $8563; - {$EXTERNALSYM GL_ALPHA_MIN_CLAMP_INGR} - GL_RED_MAX_CLAMP_INGR = $8564; - {$EXTERNALSYM GL_RED_MAX_CLAMP_INGR} - GL_GREEN_MAX_CLAMP_INGR = $8565; - {$EXTERNALSYM GL_GREEN_MAX_CLAMP_INGR} - GL_BLUE_MAX_CLAMP_INGR = $8566; - {$EXTERNALSYM GL_BLUE_MAX_CLAMP_INGR} - GL_ALPHA_MAX_CLAMP_INGR = $8567; - {$EXTERNALSYM GL_ALPHA_MAX_CLAMP_INGR} - - // GL_INGR_interlace_read - GL_INTERLACE_READ_INGR = $8568; - {$EXTERNALSYM GL_INTERLACE_READ_INGR} - - // GL_EXT_422_pixels - GL_422_EXT = $80CC; - {$EXTERNALSYM GL_422_EXT} - GL_422_REV_EXT = $80CD; - {$EXTERNALSYM GL_422_REV_EXT} - GL_422_AVERAGE_EXT = $80CE; - {$EXTERNALSYM GL_422_AVERAGE_EXT} - GL_422_REV_AVERAGE_EXT = $80CF; - {$EXTERNALSYM GL_422_REV_AVERAGE_EXT} - - // GL_EXT_texture_cube_map - GL_NORMAL_MAP_EXT = $8511; - {$EXTERNALSYM GL_NORMAL_MAP_EXT} - GL_REFLECTION_MAP_EXT = $8512; - {$EXTERNALSYM GL_REFLECTION_MAP_EXT} - GL_TEXTURE_CUBE_MAP_EXT = $8513; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_EXT} - GL_TEXTURE_BINDING_CUBE_MAP_EXT = $8514; - {$EXTERNALSYM GL_TEXTURE_BINDING_CUBE_MAP_EXT} - GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT = $8515; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT} - GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT = $8516; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT} - GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT = $8517; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT} - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT = $8518; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT} - GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT = $8519; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT} - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT = $851A; - {$EXTERNALSYM GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT} - GL_PROXY_TEXTURE_CUBE_MAP_EXT = $851B; - {$EXTERNALSYM GL_PROXY_TEXTURE_CUBE_MAP_EXT} - GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT = $851C; - {$EXTERNALSYM GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT} - - // GL_SUN_convolution_border_modes - GL_WRAP_BORDER_SUN = $81D4; - {$EXTERNALSYM GL_WRAP_BORDER_SUN} - - // GL_EXT_texture_lod_bias - GL_MAX_TEXTURE_LOD_BIAS_EXT = $84FD; - {$EXTERNALSYM GL_MAX_TEXTURE_LOD_BIAS_EXT} - GL_TEXTURE_FILTER_CONTROL_EXT = $8500; - {$EXTERNALSYM GL_TEXTURE_FILTER_CONTROL_EXT} - GL_TEXTURE_LOD_BIAS_EXT = $8501; - {$EXTERNALSYM GL_TEXTURE_LOD_BIAS_EXT} - - // GL_EXT_texture_filter_anisotropic - GL_TEXTURE_MAX_ANISOTROPY_EXT = $84FE; - {$EXTERNALSYM GL_TEXTURE_MAX_ANISOTROPY_EXT} - GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = $84FF; - {$EXTERNALSYM GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT} - - // GL_EXT_vertex_weighting - GL_MODELVIEW0_STACK_DEPTH_EXT = GL_MODELVIEW_STACK_DEPTH; - {$EXTERNALSYM GL_MODELVIEW0_STACK_DEPTH_EXT} - GL_MODELVIEW1_STACK_DEPTH_EXT = $8502; - {$EXTERNALSYM GL_MODELVIEW1_STACK_DEPTH_EXT} - GL_MODELVIEW0_MATRIX_EXT = GL_MODELVIEW_MATRIX; - {$EXTERNALSYM GL_MODELVIEW0_MATRIX_EXT} - GL_MODELVIEW_MATRIX1_EXT = $8506; - {$EXTERNALSYM GL_MODELVIEW_MATRIX1_EXT} - GL_VERTEX_WEIGHTING_EXT = $8509; - {$EXTERNALSYM GL_VERTEX_WEIGHTING_EXT} - GL_MODELVIEW0_EXT = GL_MODELVIEW; - {$EXTERNALSYM GL_MODELVIEW0_EXT} - GL_MODELVIEW1_EXT = $850A; - {$EXTERNALSYM GL_MODELVIEW1_EXT} - GL_CURRENT_VERTEX_WEIGHT_EXT = $850B; - {$EXTERNALSYM GL_CURRENT_VERTEX_WEIGHT_EXT} - GL_VERTEX_WEIGHT_ARRAY_EXT = $850C; - {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_EXT} - GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT = $850D; - {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT} - GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT = $850E; - {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT} - GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT = $850F; - {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT} - GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT = $8510; - {$EXTERNALSYM GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT} - - // GL_NV_light_max_exponent - GL_MAX_SHININESS_NV = $8504; - {$EXTERNALSYM GL_MAX_SHININESS_NV} - GL_MAX_SPOT_EXPONENT_NV = $8505; - {$EXTERNALSYM GL_MAX_SPOT_EXPONENT_NV} - - // GL_NV_vertex_array_range - GL_VERTEX_ARRAY_RANGE_NV = $851D; - {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_NV} - GL_VERTEX_ARRAY_RANGE_LENGTH_NV = $851E; - {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_LENGTH_NV} - GL_VERTEX_ARRAY_RANGE_VALID_NV = $851F; - {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_VALID_NV} - GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV = $8520; - {$EXTERNALSYM GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV} - GL_VERTEX_ARRAY_RANGE_POINTER_NV = $8521; - {$EXTERNALSYM GL_VERTEX_ARRAY_RANGE_POINTER_NV} - - // GL_NV_register_combiners - GL_REGISTER_COMBINERS_NV = $8522; - {$EXTERNALSYM GL_REGISTER_COMBINERS_NV} - GL_VARIABLE_A_NV = $8523; - {$EXTERNALSYM GL_VARIABLE_A_NV} - GL_VARIABLE_B_NV = $8524; - {$EXTERNALSYM GL_VARIABLE_B_NV} - GL_VARIABLE_C_NV = $8525; - {$EXTERNALSYM GL_VARIABLE_C_NV} - GL_VARIABLE_D_NV = $8526; - {$EXTERNALSYM GL_VARIABLE_D_NV} - GL_VARIABLE_E_NV = $8527; - {$EXTERNALSYM GL_VARIABLE_E_NV} - GL_VARIABLE_F_NV = $8528; - {$EXTERNALSYM GL_VARIABLE_F_NV} - GL_VARIABLE_G_NV = $8529; - {$EXTERNALSYM GL_VARIABLE_G_NV} - GL_CONSTANT_COLOR0_NV = $852A; - {$EXTERNALSYM GL_CONSTANT_COLOR0_NV} - GL_CONSTANT_COLOR1_NV = $852B; - {$EXTERNALSYM GL_CONSTANT_COLOR1_NV} - GL_PRIMARY_COLOR_NV = $852C; - {$EXTERNALSYM GL_PRIMARY_COLOR_NV} - GL_SECONDARY_COLOR_NV = $852D; - {$EXTERNALSYM GL_SECONDARY_COLOR_NV} - GL_SPARE0_NV = $852E; - {$EXTERNALSYM GL_SPARE0_NV} - GL_SPARE1_NV = $852F; - {$EXTERNALSYM GL_SPARE1_NV} - GL_DISCARD_NV = $8530; - {$EXTERNALSYM GL_DISCARD_NV} - GL_E_TIMES_F_NV = $8531; - {$EXTERNALSYM GL_E_TIMES_F_NV} - GL_SPARE0_PLUS_SECONDARY_COLOR_NV = $8532; - {$EXTERNALSYM GL_SPARE0_PLUS_SECONDARY_COLOR_NV} - GL_UNSIGNED_IDENTITY_NV = $8536; - {$EXTERNALSYM GL_UNSIGNED_IDENTITY_NV} - GL_UNSIGNED_INVERT_NV = $8537; - {$EXTERNALSYM GL_UNSIGNED_INVERT_NV} - GL_EXPAND_NORMAL_NV = $8538; - {$EXTERNALSYM GL_EXPAND_NORMAL_NV} - GL_EXPAND_NEGATE_NV = $8539; - {$EXTERNALSYM GL_EXPAND_NEGATE_NV} - GL_HALF_BIAS_NORMAL_NV = $853A; - {$EXTERNALSYM GL_HALF_BIAS_NORMAL_NV} - GL_HALF_BIAS_NEGATE_NV = $853B; - {$EXTERNALSYM GL_HALF_BIAS_NEGATE_NV} - GL_SIGNED_IDENTITY_NV = $853C; - {$EXTERNALSYM GL_SIGNED_IDENTITY_NV} - GL_SIGNED_NEGATE_NV = $853D; - {$EXTERNALSYM GL_SIGNED_NEGATE_NV} - GL_SCALE_BY_TWO_NV = $853E; - {$EXTERNALSYM GL_SCALE_BY_TWO_NV} - GL_SCALE_BY_FOUR_NV = $853F; - {$EXTERNALSYM GL_SCALE_BY_FOUR_NV} - GL_SCALE_BY_ONE_HALF_NV = $8540; - {$EXTERNALSYM GL_SCALE_BY_ONE_HALF_NV} - GL_BIAS_BY_NEGATIVE_ONE_HALF_NV = $8541; - {$EXTERNALSYM GL_BIAS_BY_NEGATIVE_ONE_HALF_NV} - GL_COMBINER_INPUT_NV = $8542; - {$EXTERNALSYM GL_COMBINER_INPUT_NV} - GL_COMBINER_MAPPING_NV = $8543; - {$EXTERNALSYM GL_COMBINER_MAPPING_NV} - GL_COMBINER_COMPONENT_USAGE_NV = $8544; - {$EXTERNALSYM GL_COMBINER_COMPONENT_USAGE_NV} - GL_COMBINER_AB_DOT_PRODUCT_NV = $8545; - {$EXTERNALSYM GL_COMBINER_AB_DOT_PRODUCT_NV} - GL_COMBINER_CD_DOT_PRODUCT_NV = $8546; - {$EXTERNALSYM GL_COMBINER_CD_DOT_PRODUCT_NV} - GL_COMBINER_MUX_SUM_NV = $8547; - {$EXTERNALSYM GL_COMBINER_MUX_SUM_NV} - GL_COMBINER_SCALE_NV = $8548; - {$EXTERNALSYM GL_COMBINER_SCALE_NV} - GL_COMBINER_BIAS_NV = $8549; - {$EXTERNALSYM GL_COMBINER_BIAS_NV} - GL_COMBINER_AB_OUTPUT_NV = $854A; - {$EXTERNALSYM GL_COMBINER_AB_OUTPUT_NV} - GL_COMBINER_CD_OUTPUT_NV = $854B; - {$EXTERNALSYM GL_COMBINER_CD_OUTPUT_NV} - GL_COMBINER_SUM_OUTPUT_NV = $854C; - {$EXTERNALSYM GL_COMBINER_SUM_OUTPUT_NV} - GL_MAX_GENERAL_COMBINERS_NV = $854D; - {$EXTERNALSYM GL_MAX_GENERAL_COMBINERS_NV} - GL_NUM_GENERAL_COMBINERS_NV = $854E; - {$EXTERNALSYM GL_NUM_GENERAL_COMBINERS_NV} - GL_COLOR_SUM_CLAMP_NV = $854F; - {$EXTERNALSYM GL_COLOR_SUM_CLAMP_NV} - GL_COMBINER0_NV = $8550; - {$EXTERNALSYM GL_COMBINER0_NV} - GL_COMBINER1_NV = $8551; - {$EXTERNALSYM GL_COMBINER1_NV} - GL_COMBINER2_NV = $8552; - {$EXTERNALSYM GL_COMBINER2_NV} - GL_COMBINER3_NV = $8553; - {$EXTERNALSYM GL_COMBINER3_NV} - GL_COMBINER4_NV = $8554; - {$EXTERNALSYM GL_COMBINER4_NV} - GL_COMBINER5_NV = $8555; - {$EXTERNALSYM GL_COMBINER5_NV} - GL_COMBINER6_NV = $8556; - {$EXTERNALSYM GL_COMBINER6_NV} - GL_COMBINER7_NV = $8557; - {$EXTERNALSYM GL_COMBINER7_NV} - - // GL_NV_fog_distance - GL_FOG_DISTANCE_MODE_NV = $855A; - {$EXTERNALSYM GL_FOG_DISTANCE_MODE_NV} - GL_EYE_RADIAL_NV = $855B; - {$EXTERNALSYM GL_EYE_RADIAL_NV} - GL_EYE_PLANE_ABSOLUTE_NV = $855C; - {$EXTERNALSYM GL_EYE_PLANE_ABSOLUTE_NV} - - // GL_NV_texgen_emboss - GL_EMBOSS_LIGHT_NV = $855D; - {$EXTERNALSYM GL_EMBOSS_LIGHT_NV} - GL_EMBOSS_CONSTANT_NV = $855E; - {$EXTERNALSYM GL_EMBOSS_CONSTANT_NV} - GL_EMBOSS_MAP_NV = $855F; - {$EXTERNALSYM GL_EMBOSS_MAP_NV} - - // GL_EXT_texture_compression_s3tc - GL_COMPRESSED_RGB_S3TC_DXT1_EXT = $83F0; - {$EXTERNALSYM GL_COMPRESSED_RGB_S3TC_DXT1_EXT} - GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = $83F1; - {$EXTERNALSYM GL_COMPRESSED_RGBA_S3TC_DXT1_EXT} - GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = $83F2; - {$EXTERNALSYM GL_COMPRESSED_RGBA_S3TC_DXT3_EXT} - GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = $83F3; - {$EXTERNALSYM GL_COMPRESSED_RGBA_S3TC_DXT5_EXT} - - // GL_IBM_cull_vertex - GL_CULL_VERTEX_IBM = 103050; - {$EXTERNALSYM GL_CULL_VERTEX_IBM} - - // GL_IBM_vertex_array_lists - GL_VERTEX_ARRAY_LIST_IBM = 103070; - {$EXTERNALSYM GL_VERTEX_ARRAY_LIST_IBM} - GL_NORMAL_ARRAY_LIST_IBM = 103071; - {$EXTERNALSYM GL_NORMAL_ARRAY_LIST_IBM} - GL_COLOR_ARRAY_LIST_IBM = 103072; - {$EXTERNALSYM GL_COLOR_ARRAY_LIST_IBM} - GL_INDEX_ARRAY_LIST_IBM = 103073; - {$EXTERNALSYM GL_INDEX_ARRAY_LIST_IBM} - GL_TEXTURE_COORD_ARRAY_LIST_IBM = 103074; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_LIST_IBM} - GL_EDGE_FLAG_ARRAY_LIST_IBM = 103075; - {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_LIST_IBM} - GL_FOG_COORDINATE_ARRAY_LIST_IBM = 103076; - {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_LIST_IBM} - GL_SECONDARY_COLOR_ARRAY_LIST_IBM = 103077; - {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_LIST_IBM} - GL_VERTEX_ARRAY_LIST_STRIDE_IBM = 103080; - {$EXTERNALSYM GL_VERTEX_ARRAY_LIST_STRIDE_IBM} - GL_NORMAL_ARRAY_LIST_STRIDE_IBM = 103081; - {$EXTERNALSYM GL_NORMAL_ARRAY_LIST_STRIDE_IBM} - GL_COLOR_ARRAY_LIST_STRIDE_IBM = 103082; - {$EXTERNALSYM GL_COLOR_ARRAY_LIST_STRIDE_IBM} - GL_INDEX_ARRAY_LIST_STRIDE_IBM = 103083; - {$EXTERNALSYM GL_INDEX_ARRAY_LIST_STRIDE_IBM} - GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM = 103084; - {$EXTERNALSYM GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM} - GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM = 103085; - {$EXTERNALSYM GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM} - GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM = 103086; - {$EXTERNALSYM GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM} - GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM = 103087; - {$EXTERNALSYM GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM} - - // GL_SGIX_subsample - GL_PACK_SUBSAMPLE_RATE_SGIX = $85A0; - {$EXTERNALSYM GL_PACK_SUBSAMPLE_RATE_SGIX} - GL_UNPACK_SUBSAMPLE_RATE_SGIX = $85A1; - {$EXTERNALSYM GL_UNPACK_SUBSAMPLE_RATE_SGIX} - GL_PIXEL_SUBSAMPLE_4444_SGIX = $85A2; - {$EXTERNALSYM GL_PIXEL_SUBSAMPLE_4444_SGIX} - GL_PIXEL_SUBSAMPLE_2424_SGIX = $85A3; - {$EXTERNALSYM GL_PIXEL_SUBSAMPLE_2424_SGIX} - GL_PIXEL_SUBSAMPLE_4242_SGIX = $85A4; - {$EXTERNALSYM GL_PIXEL_SUBSAMPLE_4242_SGIX} - - // GL_SGIX_ycrcba - GL_YCRCB_SGIX = $8318; - {$EXTERNALSYM GL_YCRCB_SGIX} - GL_YCRCBA_SGIX = $8319; - {$EXTERNALSYM GL_YCRCBA_SGIX} - - // GL_SGI_depth_pass_instrument - GL_DEPTH_PASS_INSTRUMENT_SGIX = $8310; - {$EXTERNALSYM GL_DEPTH_PASS_INSTRUMENT_SGIX} - GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX = $8311; - {$EXTERNALSYM GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX} - GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX = $8312; - {$EXTERNALSYM GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX} - - // GL_3DFX_texture_compression_FXT1 - GL_COMPRESSED_RGB_FXT1_3DFX = $86B0; - {$EXTERNALSYM GL_COMPRESSED_RGB_FXT1_3DFX} - GL_COMPRESSED_RGBA_FXT1_3DFX = $86B1; - {$EXTERNALSYM GL_COMPRESSED_RGBA_FXT1_3DFX} - - // GL_3DFX_multisample - GL_MULTISAMPLE_3DFX = $86B2; - {$EXTERNALSYM GL_MULTISAMPLE_3DFX} - GL_SAMPLE_BUFFERS_3DFX = $86B3; - {$EXTERNALSYM GL_SAMPLE_BUFFERS_3DFX} - GL_SAMPLES_3DFX = $86B4; - {$EXTERNALSYM GL_SAMPLES_3DFX} - GL_MULTISAMPLE_BIT_3DFX = $20000000; - {$EXTERNALSYM GL_MULTISAMPLE_BIT_3DFX} - - // GL_EXT_multisample - GL_MULTISAMPLE_EXT = $809D; - {$EXTERNALSYM GL_MULTISAMPLE_EXT} - GL_SAMPLE_ALPHA_TO_MASK_EXT = $809E; - {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_MASK_EXT} - GL_SAMPLE_ALPHA_TO_ONE_EXT = $809F; - {$EXTERNALSYM GL_SAMPLE_ALPHA_TO_ONE_EXT} - GL_SAMPLE_MASK_EXT = $80A0; - {$EXTERNALSYM GL_SAMPLE_MASK_EXT} - GL_1PASS_EXT = $80A1; - {$EXTERNALSYM GL_1PASS_EXT} - GL_2PASS_0_EXT = $80A2; - {$EXTERNALSYM GL_2PASS_0_EXT} - GL_2PASS_1_EXT = $80A3; - {$EXTERNALSYM GL_2PASS_1_EXT} - GL_4PASS_0_EXT = $80A4; - {$EXTERNALSYM GL_4PASS_0_EXT} - GL_4PASS_1_EXT = $80A5; - {$EXTERNALSYM GL_4PASS_1_EXT} - GL_4PASS_2_EXT = $80A6; - {$EXTERNALSYM GL_4PASS_2_EXT} - GL_4PASS_3_EXT = $80A7; - {$EXTERNALSYM GL_4PASS_3_EXT} - GL_SAMPLE_BUFFERS_EXT = $80A8; - {$EXTERNALSYM GL_SAMPLE_BUFFERS_EXT} - GL_SAMPLES_EXT = $80A9; - {$EXTERNALSYM GL_SAMPLES_EXT} - GL_SAMPLE_MASK_VALUE_EXT = $80AA; - {$EXTERNALSYM GL_SAMPLE_MASK_VALUE_EXT} - GL_SAMPLE_MASK_INVERT_EXT = $80AB; - {$EXTERNALSYM GL_SAMPLE_MASK_INVERT_EXT} - GL_SAMPLE_PATTERN_EXT = $80AC; - {$EXTERNALSYM GL_SAMPLE_PATTERN_EXT} - - // GL_SGIX_vertex_preclip - GL_VERTEX_PRECLIP_SGIX = $83EE; - {$EXTERNALSYM GL_VERTEX_PRECLIP_SGIX} - GL_VERTEX_PRECLIP_HINT_SGIX = $83EF; - {$EXTERNALSYM GL_VERTEX_PRECLIP_HINT_SGIX} - - // GL_SGIX_convolution_accuracy - GL_CONVOLUTION_HINT_SGIX = $8316; - {$EXTERNALSYM GL_CONVOLUTION_HINT_SGIX} - - // GL_SGIX_resample - GL_PACK_RESAMPLE_SGIX = $842C; - {$EXTERNALSYM GL_PACK_RESAMPLE_SGIX} - GL_UNPACK_RESAMPLE_SGIX = $842D; - {$EXTERNALSYM GL_UNPACK_RESAMPLE_SGIX} - GL_RESAMPLE_REPLICATE_SGIX = $842E; - {$EXTERNALSYM GL_RESAMPLE_REPLICATE_SGIX} - GL_RESAMPLE_ZERO_FILL_SGIX = $842F; - {$EXTERNALSYM GL_RESAMPLE_ZERO_FILL_SGIX} - GL_RESAMPLE_DECIMATE_SGIX = $8430; - {$EXTERNALSYM GL_RESAMPLE_DECIMATE_SGIX} - - // GL_SGIS_point_line_texgen - GL_EYE_DISTANCE_TO_POINT_SGIS = $81F0; - {$EXTERNALSYM GL_EYE_DISTANCE_TO_POINT_SGIS} - GL_OBJECT_DISTANCE_TO_POINT_SGIS = $81F1; - {$EXTERNALSYM GL_OBJECT_DISTANCE_TO_POINT_SGIS} - GL_EYE_DISTANCE_TO_LINE_SGIS = $81F2; - {$EXTERNALSYM GL_EYE_DISTANCE_TO_LINE_SGIS} - GL_OBJECT_DISTANCE_TO_LINE_SGIS = $81F3; - {$EXTERNALSYM GL_OBJECT_DISTANCE_TO_LINE_SGIS} - GL_EYE_POINT_SGIS = $81F4; - {$EXTERNALSYM GL_EYE_POINT_SGIS} - GL_OBJECT_POINT_SGIS = $81F5; - {$EXTERNALSYM GL_OBJECT_POINT_SGIS} - GL_EYE_LINE_SGIS = $81F6; - {$EXTERNALSYM GL_EYE_LINE_SGIS} - GL_OBJECT_LINE_SGIS = $81F7; - {$EXTERNALSYM GL_OBJECT_LINE_SGIS} - - // GL_SGIS_texture_color_mask - GL_TEXTURE_COLOR_WRITEMASK_SGIS = $81EF; - {$EXTERNALSYM GL_TEXTURE_COLOR_WRITEMASK_SGIS} - - // GL_NV_vertex_program - GL_VERTEX_PROGRAM_NV = $8620; - {$EXTERNALSYM GL_VERTEX_PROGRAM_NV} - GL_VERTEX_STATE_PROGRAM_NV = $8621; - {$EXTERNALSYM GL_VERTEX_STATE_PROGRAM_NV} - GL_ATTRIB_ARRAY_SIZE_NV = $8623; - {$EXTERNALSYM GL_ATTRIB_ARRAY_SIZE_NV} - GL_ATTRIB_ARRAY_STRIDE_NV = $8624; - {$EXTERNALSYM GL_ATTRIB_ARRAY_STRIDE_NV} - GL_ATTRIB_ARRAY_TYPE_NV = $8625; - {$EXTERNALSYM GL_ATTRIB_ARRAY_TYPE_NV} - GL_CURRENT_ATTRIB_NV = $8626; - {$EXTERNALSYM GL_CURRENT_ATTRIB_NV} - GL_PROGRAM_LENGTH_NV = $8627; - {$EXTERNALSYM GL_PROGRAM_LENGTH_NV} - GL_PROGRAM_STRING_NV = $8628; - {$EXTERNALSYM GL_PROGRAM_STRING_NV} - GL_MODELVIEW_PROJECTION_NV = $8629; - {$EXTERNALSYM GL_MODELVIEW_PROJECTION_NV} - GL_IDENTITY_NV = $862A; - {$EXTERNALSYM GL_IDENTITY_NV} - GL_INVERSE_NV = $862B; - {$EXTERNALSYM GL_INVERSE_NV} - GL_TRANSPOSE_NV = $862C; - {$EXTERNALSYM GL_TRANSPOSE_NV} - GL_INVERSE_TRANSPOSE_NV = $862D; - {$EXTERNALSYM GL_INVERSE_TRANSPOSE_NV} - GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV = $862E; - {$EXTERNALSYM GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV} - GL_MAX_TRACK_MATRICES_NV = $862F; - {$EXTERNALSYM GL_MAX_TRACK_MATRICES_NV} - GL_MATRIX0_NV = $8630; - {$EXTERNALSYM GL_MATRIX0_NV} - GL_MATRIX1_NV = $8631; - {$EXTERNALSYM GL_MATRIX1_NV} - GL_MATRIX2_NV = $8632; - {$EXTERNALSYM GL_MATRIX2_NV} - GL_MATRIX3_NV = $8633; - {$EXTERNALSYM GL_MATRIX3_NV} - GL_MATRIX4_NV = $8634; - {$EXTERNALSYM GL_MATRIX4_NV} - GL_MATRIX5_NV = $8635; - {$EXTERNALSYM GL_MATRIX5_NV} - GL_MATRIX6_NV = $8636; - {$EXTERNALSYM GL_MATRIX6_NV} - GL_MATRIX7_NV = $8637; - {$EXTERNALSYM GL_MATRIX7_NV} - GL_CURRENT_MATRIX_STACK_DEPTH_NV = $8640; - {$EXTERNALSYM GL_CURRENT_MATRIX_STACK_DEPTH_NV} - GL_CURRENT_MATRIX_NV = $8641; - {$EXTERNALSYM GL_CURRENT_MATRIX_NV} - GL_VERTEX_PROGRAM_POINT_SIZE_NV = $8642; - {$EXTERNALSYM GL_VERTEX_PROGRAM_POINT_SIZE_NV} - GL_VERTEX_PROGRAM_TWO_SIDE_NV = $8643; - {$EXTERNALSYM GL_VERTEX_PROGRAM_TWO_SIDE_NV} - GL_PROGRAM_PARAMETER_NV = $8644; - {$EXTERNALSYM GL_PROGRAM_PARAMETER_NV} - GL_ATTRIB_ARRAY_POINTER_NV = $8645; - {$EXTERNALSYM GL_ATTRIB_ARRAY_POINTER_NV} - GL_PROGRAM_TARGET_NV = $8646; - {$EXTERNALSYM GL_PROGRAM_TARGET_NV} - GL_PROGRAM_RESIDENT_NV = $8647; - {$EXTERNALSYM GL_PROGRAM_RESIDENT_NV} - GL_TRACK_MATRIX_NV = $8648; - {$EXTERNALSYM GL_TRACK_MATRIX_NV} - GL_TRACK_MATRIX_TRANSFORM_NV = $8649; - {$EXTERNALSYM GL_TRACK_MATRIX_TRANSFORM_NV} - GL_VERTEX_PROGRAM_BINDING_NV = $864A; - {$EXTERNALSYM GL_VERTEX_PROGRAM_BINDING_NV} - GL_PROGRAM_ERROR_POSITION_NV = $864B; - {$EXTERNALSYM GL_PROGRAM_ERROR_POSITION_NV} - GL_VERTEX_ATTRIB_ARRAY0_NV = $8650; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY0_NV} - GL_VERTEX_ATTRIB_ARRAY1_NV = $8651; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY1_NV} - GL_VERTEX_ATTRIB_ARRAY2_NV = $8652; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY2_NV} - GL_VERTEX_ATTRIB_ARRAY3_NV = $8653; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY3_NV} - GL_VERTEX_ATTRIB_ARRAY4_NV = $8654; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY4_NV} - GL_VERTEX_ATTRIB_ARRAY5_NV = $8655; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY5_NV} - GL_VERTEX_ATTRIB_ARRAY6_NV = $8656; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY6_NV} - GL_VERTEX_ATTRIB_ARRAY7_NV = $8657; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY7_NV} - GL_VERTEX_ATTRIB_ARRAY8_NV = $8658; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY8_NV} - GL_VERTEX_ATTRIB_ARRAY9_NV = $8659; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY9_NV} - GL_VERTEX_ATTRIB_ARRAY10_NV = $865A; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY10_NV} - GL_VERTEX_ATTRIB_ARRAY11_NV = $865B; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY11_NV} - GL_VERTEX_ATTRIB_ARRAY12_NV = $865C; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY12_NV} - GL_VERTEX_ATTRIB_ARRAY13_NV = $865D; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY13_NV} - GL_VERTEX_ATTRIB_ARRAY14_NV = $865E; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY14_NV} - GL_VERTEX_ATTRIB_ARRAY15_NV = $865F; - {$EXTERNALSYM GL_VERTEX_ATTRIB_ARRAY15_NV} - GL_MAP1_VERTEX_ATTRIB0_4_NV = $8660; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB0_4_NV} - GL_MAP1_VERTEX_ATTRIB1_4_NV = $8661; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB1_4_NV} - GL_MAP1_VERTEX_ATTRIB2_4_NV = $8662; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB2_4_NV} - GL_MAP1_VERTEX_ATTRIB3_4_NV = $8663; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB3_4_NV} - GL_MAP1_VERTEX_ATTRIB4_4_NV = $8664; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB4_4_NV} - GL_MAP1_VERTEX_ATTRIB5_4_NV = $8665; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB5_4_NV} - GL_MAP1_VERTEX_ATTRIB6_4_NV = $8666; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB6_4_NV} - GL_MAP1_VERTEX_ATTRIB7_4_NV = $8667; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB7_4_NV} - GL_MAP1_VERTEX_ATTRIB8_4_NV = $8668; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB8_4_NV} - GL_MAP1_VERTEX_ATTRIB9_4_NV = $8669; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB9_4_NV} - GL_MAP1_VERTEX_ATTRIB10_4_NV = $866A; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB10_4_NV} - GL_MAP1_VERTEX_ATTRIB11_4_NV = $866B; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB11_4_NV} - GL_MAP1_VERTEX_ATTRIB12_4_NV = $866C; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB12_4_NV} - GL_MAP1_VERTEX_ATTRIB13_4_NV = $866D; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB13_4_NV} - GL_MAP1_VERTEX_ATTRIB14_4_NV = $866E; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB14_4_NV} - GL_MAP1_VERTEX_ATTRIB15_4_NV = $866F; - {$EXTERNALSYM GL_MAP1_VERTEX_ATTRIB15_4_NV} - GL_MAP2_VERTEX_ATTRIB0_4_NV = $8670; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB0_4_NV} - GL_MAP2_VERTEX_ATTRIB1_4_NV = $8671; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB1_4_NV} - GL_MAP2_VERTEX_ATTRIB2_4_NV = $8672; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB2_4_NV} - GL_MAP2_VERTEX_ATTRIB3_4_NV = $8673; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB3_4_NV} - GL_MAP2_VERTEX_ATTRIB4_4_NV = $8674; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB4_4_NV} - GL_MAP2_VERTEX_ATTRIB5_4_NV = $8675; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB5_4_NV} - GL_MAP2_VERTEX_ATTRIB6_4_NV = $8676; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB6_4_NV} - GL_MAP2_VERTEX_ATTRIB7_4_NV = $8677; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB7_4_NV} - GL_MAP2_VERTEX_ATTRIB8_4_NV = $8678; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB8_4_NV} - GL_MAP2_VERTEX_ATTRIB9_4_NV = $8679; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB9_4_NV} - GL_MAP2_VERTEX_ATTRIB10_4_NV = $867A; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB10_4_NV} - GL_MAP2_VERTEX_ATTRIB11_4_NV = $867B; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB11_4_NV} - GL_MAP2_VERTEX_ATTRIB12_4_NV = $867C; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB12_4_NV} - GL_MAP2_VERTEX_ATTRIB13_4_NV = $867D; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB13_4_NV} - GL_MAP2_VERTEX_ATTRIB14_4_NV = $867E; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB14_4_NV} - GL_MAP2_VERTEX_ATTRIB15_4_NV = $867F; - {$EXTERNALSYM GL_MAP2_VERTEX_ATTRIB15_4_NV} - - // WGL_ARB_pixel_format - WGL_NUMBER_PIXEL_FORMATS_ARB = $2000; - {$EXTERNALSYM WGL_NUMBER_PIXEL_FORMATS_ARB} - WGL_DRAW_TO_WINDOW_ARB = $2001; - {$EXTERNALSYM WGL_DRAW_TO_WINDOW_ARB} - WGL_DRAW_TO_BITMAP_ARB = $2002; - {$EXTERNALSYM WGL_DRAW_TO_BITMAP_ARB} - WGL_ACCELERATION_ARB = $2003; - {$EXTERNALSYM WGL_ACCELERATION_ARB} - WGL_NEED_PALETTE_ARB = $2004; - {$EXTERNALSYM WGL_NEED_PALETTE_ARB} - WGL_NEED_SYSTEM_PALETTE_ARB = $2005; - {$EXTERNALSYM WGL_NEED_SYSTEM_PALETTE_ARB} - WGL_SWAP_LAYER_BUFFERS_ARB = $2006; - {$EXTERNALSYM WGL_SWAP_LAYER_BUFFERS_ARB} - WGL_SWAP_METHOD_ARB = $2007; - {$EXTERNALSYM WGL_SWAP_METHOD_ARB} - WGL_NUMBER_OVERLAYS_ARB = $2008; - {$EXTERNALSYM WGL_NUMBER_OVERLAYS_ARB} - WGL_NUMBER_UNDERLAYS_ARB = $2009; - {$EXTERNALSYM WGL_NUMBER_UNDERLAYS_ARB} - WGL_TRANSPARENT_ARB = $200A; - {$EXTERNALSYM WGL_TRANSPARENT_ARB} - WGL_TRANSPARENT_RED_VALUE_ARB = $2037; - {$EXTERNALSYM WGL_TRANSPARENT_RED_VALUE_ARB} - WGL_TRANSPARENT_GREEN_VALUE_ARB = $2038; - {$EXTERNALSYM WGL_TRANSPARENT_GREEN_VALUE_ARB} - WGL_TRANSPARENT_BLUE_VALUE_ARB = $2039; - {$EXTERNALSYM WGL_TRANSPARENT_BLUE_VALUE_ARB} - WGL_TRANSPARENT_ALPHA_VALUE_ARB = $203A; - {$EXTERNALSYM WGL_TRANSPARENT_ALPHA_VALUE_ARB} - WGL_TRANSPARENT_INDEX_VALUE_ARB = $203B; - {$EXTERNALSYM WGL_TRANSPARENT_INDEX_VALUE_ARB} - WGL_SHARE_DEPTH_ARB = $200C; - {$EXTERNALSYM WGL_SHARE_DEPTH_ARB} - WGL_SHARE_STENCIL_ARB = $200D; - {$EXTERNALSYM WGL_SHARE_STENCIL_ARB} - WGL_SHARE_ACCUM_ARB = $200E; - {$EXTERNALSYM WGL_SHARE_ACCUM_ARB} - WGL_SUPPORT_GDI_ARB = $200F; - {$EXTERNALSYM WGL_SUPPORT_GDI_ARB} - WGL_SUPPORT_OPENGL_ARB = $2010; - {$EXTERNALSYM WGL_SUPPORT_OPENGL_ARB} - WGL_DOUBLE_BUFFER_ARB = $2011; - {$EXTERNALSYM WGL_DOUBLE_BUFFER_ARB} - WGL_STEREO_ARB = $2012; - {$EXTERNALSYM WGL_STEREO_ARB} - WGL_PIXEL_TYPE_ARB = $2013; - {$EXTERNALSYM WGL_PIXEL_TYPE_ARB} - WGL_COLOR_BITS_ARB = $2014; - {$EXTERNALSYM WGL_COLOR_BITS_ARB} - WGL_RED_BITS_ARB = $2015; - {$EXTERNALSYM WGL_RED_BITS_ARB} - WGL_RED_SHIFT_ARB = $2016; - {$EXTERNALSYM WGL_RED_SHIFT_ARB} - WGL_GREEN_BITS_ARB = $2017; - {$EXTERNALSYM WGL_GREEN_BITS_ARB} - WGL_GREEN_SHIFT_ARB = $2018; - {$EXTERNALSYM WGL_GREEN_SHIFT_ARB} - WGL_BLUE_BITS_ARB = $2019; - {$EXTERNALSYM WGL_BLUE_BITS_ARB} - WGL_BLUE_SHIFT_ARB = $201A; - {$EXTERNALSYM WGL_BLUE_SHIFT_ARB} - WGL_ALPHA_BITS_ARB = $201B; - {$EXTERNALSYM WGL_ALPHA_BITS_ARB} - WGL_ALPHA_SHIFT_ARB = $201C; - {$EXTERNALSYM WGL_ALPHA_SHIFT_ARB} - WGL_ACCUM_BITS_ARB = $201D; - {$EXTERNALSYM WGL_ACCUM_BITS_ARB} - WGL_ACCUM_RED_BITS_ARB = $201E; - {$EXTERNALSYM WGL_ACCUM_RED_BITS_ARB} - WGL_ACCUM_GREEN_BITS_ARB = $201F; - {$EXTERNALSYM WGL_ACCUM_GREEN_BITS_ARB} - WGL_ACCUM_BLUE_BITS_ARB = $2020; - {$EXTERNALSYM WGL_ACCUM_BLUE_BITS_ARB} - WGL_ACCUM_ALPHA_BITS_ARB = $2021; - {$EXTERNALSYM WGL_ACCUM_ALPHA_BITS_ARB} - WGL_DEPTH_BITS_ARB = $2022; - {$EXTERNALSYM WGL_DEPTH_BITS_ARB} - WGL_STENCIL_BITS_ARB = $2023; - {$EXTERNALSYM WGL_STENCIL_BITS_ARB} - WGL_AUX_BUFFERS_ARB = $2024; - {$EXTERNALSYM WGL_AUX_BUFFERS_ARB} - WGL_NO_ACCELERATION_ARB = $2025; - {$EXTERNALSYM WGL_NO_ACCELERATION_ARB} - WGL_GENERIC_ACCELERATION_ARB = $2026; - {$EXTERNALSYM WGL_GENERIC_ACCELERATION_ARB} - WGL_FULL_ACCELERATION_ARB = $2027; - {$EXTERNALSYM WGL_FULL_ACCELERATION_ARB} - WGL_SWAP_EXCHANGE_ARB = $2028; - {$EXTERNALSYM WGL_SWAP_EXCHANGE_ARB} - WGL_SWAP_COPY_ARB = $2029; - {$EXTERNALSYM WGL_SWAP_COPY_ARB} - WGL_SWAP_UNDEFINED_ARB = $202A; - {$EXTERNALSYM WGL_SWAP_UNDEFINED_ARB} - WGL_TYPE_RGBA_ARB = $202B; - {$EXTERNALSYM WGL_TYPE_RGBA_ARB} - WGL_TYPE_COLORINDEX_ARB = $202C; - {$EXTERNALSYM WGL_TYPE_COLORINDEX_ARB} - - - // ********** GLU generic constants ********** - - // Errors: (return value 0 = no error) - GLU_INVALID_ENUM = 100900; - {$EXTERNALSYM GLU_INVALID_ENUM} - GLU_INVALID_VALUE = 100901; - {$EXTERNALSYM GLU_INVALID_VALUE} - GLU_OUT_OF_MEMORY = 100902; - {$EXTERNALSYM GLU_OUT_OF_MEMORY} - GLU_INCOMPATIBLE_GL_VERSION = 100903; - {$EXTERNALSYM GLU_INCOMPATIBLE_GL_VERSION} - - // StringName - GLU_VERSION = 100800; - {$EXTERNALSYM GLU_VERSION} - GLU_EXTENSIONS = 100801; - {$EXTERNALSYM GLU_EXTENSIONS} - - // Boolean - GLU_TRUE = GL_TRUE; - {$EXTERNALSYM GLU_TRUE} - GLU_FALSE = GL_FALSE; - {$EXTERNALSYM GLU_FALSE} - - // Quadric constants - // QuadricNormal - GLU_SMOOTH = 100000; - {$EXTERNALSYM GLU_SMOOTH} - GLU_FLAT = 100001; - {$EXTERNALSYM GLU_FLAT} - GLU_NONE = 100002; - {$EXTERNALSYM GLU_NONE} - - // QuadricDrawStyle - GLU_POINT = 100010; - {$EXTERNALSYM GLU_POINT} - GLU_LINE = 100011; - {$EXTERNALSYM GLU_LINE} - GLU_FILL = 100012; - {$EXTERNALSYM GLU_FILL} - GLU_SILHOUETTE = 100013; - {$EXTERNALSYM GLU_SILHOUETTE} - - // QuadricOrientation - GLU_OUTSIDE = 100020; - {$EXTERNALSYM GLU_OUTSIDE} - GLU_INSIDE = 100021; - {$EXTERNALSYM GLU_INSIDE} - - // Tesselation constants - GLU_TESS_MAX_COORD = 1.0e150; - {$EXTERNALSYM GLU_TESS_MAX_COORD} - - // TessProperty - GLU_TESS_WINDING_RULE = 100140; - {$EXTERNALSYM GLU_TESS_WINDING_RULE} - GLU_TESS_BOUNDARY_ONLY = 100141; - {$EXTERNALSYM GLU_TESS_BOUNDARY_ONLY} - GLU_TESS_TOLERANCE = 100142; - {$EXTERNALSYM GLU_TESS_TOLERANCE} - - // TessWinding - GLU_TESS_WINDING_ODD = 100130; - {$EXTERNALSYM GLU_TESS_WINDING_ODD} - GLU_TESS_WINDING_NONZERO = 100131; - {$EXTERNALSYM GLU_TESS_WINDING_NONZERO} - GLU_TESS_WINDING_POSITIVE = 100132; - {$EXTERNALSYM GLU_TESS_WINDING_POSITIVE} - GLU_TESS_WINDING_NEGATIVE = 100133; - {$EXTERNALSYM GLU_TESS_WINDING_NEGATIVE} - GLU_TESS_WINDING_ABS_GEQ_TWO = 100134; - {$EXTERNALSYM GLU_TESS_WINDING_ABS_GEQ_TWO} - - // TessCallback - GLU_TESS_BEGIN = 100100; // TGLUTessBeginProc - {$EXTERNALSYM GLU_TESS_BEGIN} - GLU_TESS_VERTEX = 100101; // TGLUTessVertexProc - {$EXTERNALSYM GLU_TESS_VERTEX} - GLU_TESS_END = 100102; // TGLUTessEndProc - {$EXTERNALSYM GLU_TESS_END} - GLU_TESS_ERROR = 100103; // TGLUTessErrorProc - {$EXTERNALSYM GLU_TESS_ERROR} - GLU_TESS_EDGE_FLAG = 100104; // TGLUTessEdgeFlagProc - {$EXTERNALSYM GLU_TESS_EDGE_FLAG} - GLU_TESS_COMBINE = 100105; // TGLUTessCombineProc - {$EXTERNALSYM GLU_TESS_COMBINE} - GLU_TESS_BEGIN_DATA = 100106; // TGLUTessBeginDataProc - {$EXTERNALSYM GLU_TESS_BEGIN_DATA} - GLU_TESS_VERTEX_DATA = 100107; // TGLUTessVertexDataProc - {$EXTERNALSYM GLU_TESS_VERTEX_DATA} - GLU_TESS_END_DATA = 100108; // TGLUTessEndDataProc - {$EXTERNALSYM GLU_TESS_END_DATA} - GLU_TESS_ERROR_DATA = 100109; // TGLUTessErrorDataProc - {$EXTERNALSYM GLU_TESS_ERROR_DATA} - GLU_TESS_EDGE_FLAG_DATA = 100110; // TGLUTessEdgeFlagDataProc - {$EXTERNALSYM GLU_TESS_EDGE_FLAG_DATA} - GLU_TESS_COMBINE_DATA = 100111; // TGLUTessCombineDataProc - {$EXTERNALSYM GLU_TESS_COMBINE_DATA} - - // TessError - GLU_TESS_ERROR1 = 100151; - {$EXTERNALSYM GLU_TESS_ERROR1} - GLU_TESS_ERROR2 = 100152; - {$EXTERNALSYM GLU_TESS_ERROR2} - GLU_TESS_ERROR3 = 100153; - {$EXTERNALSYM GLU_TESS_ERROR3} - GLU_TESS_ERROR4 = 100154; - {$EXTERNALSYM GLU_TESS_ERROR4} - GLU_TESS_ERROR5 = 100155; - {$EXTERNALSYM GLU_TESS_ERROR5} - GLU_TESS_ERROR6 = 100156; - {$EXTERNALSYM GLU_TESS_ERROR6} - GLU_TESS_ERROR7 = 100157; - {$EXTERNALSYM GLU_TESS_ERROR7} - GLU_TESS_ERROR8 = 100158; - {$EXTERNALSYM GLU_TESS_ERROR8} - - GLU_TESS_MISSING_BEGIN_POLYGON = GLU_TESS_ERROR1; - {$EXTERNALSYM GLU_TESS_MISSING_BEGIN_POLYGON} - GLU_TESS_MISSING_BEGIN_CONTOUR = GLU_TESS_ERROR2; - {$EXTERNALSYM GLU_TESS_MISSING_BEGIN_CONTOUR} - GLU_TESS_MISSING_END_POLYGON = GLU_TESS_ERROR3; - {$EXTERNALSYM GLU_TESS_MISSING_END_POLYGON} - GLU_TESS_MISSING_END_CONTOUR = GLU_TESS_ERROR4; - {$EXTERNALSYM GLU_TESS_MISSING_END_CONTOUR} - GLU_TESS_COORD_TOO_LARGE = GLU_TESS_ERROR5; - {$EXTERNALSYM GLU_TESS_COORD_TOO_LARGE} - GLU_TESS_NEED_COMBINE_CALLBACK = GLU_TESS_ERROR6; - {$EXTERNALSYM GLU_TESS_NEED_COMBINE_CALLBACK} - - // NURBS constants - - // NurbsProperty - GLU_AUTO_LOAD_MATRIX = 100200; - {$EXTERNALSYM GLU_AUTO_LOAD_MATRIX} - GLU_CULLING = 100201; - {$EXTERNALSYM GLU_CULLING} - GLU_SAMPLING_TOLERANCE = 100203; - {$EXTERNALSYM GLU_SAMPLING_TOLERANCE} - GLU_DISPLAY_MODE = 100204; - {$EXTERNALSYM GLU_DISPLAY_MODE} - GLU_PARAMETRIC_TOLERANCE = 100202; - {$EXTERNALSYM GLU_PARAMETRIC_TOLERANCE} - GLU_SAMPLING_METHOD = 100205; - {$EXTERNALSYM GLU_SAMPLING_METHOD} - GLU_U_STEP = 100206; - {$EXTERNALSYM GLU_U_STEP} - GLU_V_STEP = 100207; - {$EXTERNALSYM GLU_V_STEP} - - // NurbsSampling - GLU_PATH_LENGTH = 100215; - {$EXTERNALSYM GLU_PATH_LENGTH} - GLU_PARAMETRIC_ERROR = 100216; - {$EXTERNALSYM GLU_PARAMETRIC_ERROR} - GLU_DOMAIN_DISTANCE = 100217; - {$EXTERNALSYM GLU_DOMAIN_DISTANCE} - - // NurbsTrim - GLU_MAP1_TRIM_2 = 100210; - {$EXTERNALSYM GLU_MAP1_TRIM_2} - GLU_MAP1_TRIM_3 = 100211; - {$EXTERNALSYM GLU_MAP1_TRIM_3} - - // NurbsDisplay - GLU_OUTLINE_POLYGON = 100240; - {$EXTERNALSYM GLU_OUTLINE_POLYGON} - GLU_OUTLINE_PATCH = 100241; - {$EXTERNALSYM GLU_OUTLINE_PATCH} - - // NurbsErrors - GLU_NURBS_ERROR1 = 100251; - {$EXTERNALSYM GLU_NURBS_ERROR1} - GLU_NURBS_ERROR2 = 100252; - {$EXTERNALSYM GLU_NURBS_ERROR2} - GLU_NURBS_ERROR3 = 100253; - {$EXTERNALSYM GLU_NURBS_ERROR3} - GLU_NURBS_ERROR4 = 100254; - {$EXTERNALSYM GLU_NURBS_ERROR4} - GLU_NURBS_ERROR5 = 100255; - {$EXTERNALSYM GLU_NURBS_ERROR5} - GLU_NURBS_ERROR6 = 100256; - {$EXTERNALSYM GLU_NURBS_ERROR6} - GLU_NURBS_ERROR7 = 100257; - {$EXTERNALSYM GLU_NURBS_ERROR7} - GLU_NURBS_ERROR8 = 100258; - {$EXTERNALSYM GLU_NURBS_ERROR8} - GLU_NURBS_ERROR9 = 100259; - {$EXTERNALSYM GLU_NURBS_ERROR9} - GLU_NURBS_ERROR10 = 100260; - {$EXTERNALSYM GLU_NURBS_ERROR10} - GLU_NURBS_ERROR11 = 100261; - {$EXTERNALSYM GLU_NURBS_ERROR11} - GLU_NURBS_ERROR12 = 100262; - {$EXTERNALSYM GLU_NURBS_ERROR12} - GLU_NURBS_ERROR13 = 100263; - {$EXTERNALSYM GLU_NURBS_ERROR13} - GLU_NURBS_ERROR14 = 100264; - {$EXTERNALSYM GLU_NURBS_ERROR14} - GLU_NURBS_ERROR15 = 100265; - {$EXTERNALSYM GLU_NURBS_ERROR15} - GLU_NURBS_ERROR16 = 100266; - {$EXTERNALSYM GLU_NURBS_ERROR16} - GLU_NURBS_ERROR17 = 100267; - {$EXTERNALSYM GLU_NURBS_ERROR17} - GLU_NURBS_ERROR18 = 100268; - {$EXTERNALSYM GLU_NURBS_ERROR18} - GLU_NURBS_ERROR19 = 100269; - {$EXTERNALSYM GLU_NURBS_ERROR19} - GLU_NURBS_ERROR20 = 100270; - {$EXTERNALSYM GLU_NURBS_ERROR20} - GLU_NURBS_ERROR21 = 100271; - {$EXTERNALSYM GLU_NURBS_ERROR21} - GLU_NURBS_ERROR22 = 100272; - {$EXTERNALSYM GLU_NURBS_ERROR22} - GLU_NURBS_ERROR23 = 100273; - {$EXTERNALSYM GLU_NURBS_ERROR23} - GLU_NURBS_ERROR24 = 100274; - {$EXTERNALSYM GLU_NURBS_ERROR24} - GLU_NURBS_ERROR25 = 100275; - {$EXTERNALSYM GLU_NURBS_ERROR25} - GLU_NURBS_ERROR26 = 100276; - {$EXTERNALSYM GLU_NURBS_ERROR26} - GLU_NURBS_ERROR27 = 100277; - {$EXTERNALSYM GLU_NURBS_ERROR27} - GLU_NURBS_ERROR28 = 100278; - {$EXTERNALSYM GLU_NURBS_ERROR28} - GLU_NURBS_ERROR29 = 100279; - {$EXTERNALSYM GLU_NURBS_ERROR29} - GLU_NURBS_ERROR30 = 100280; - {$EXTERNALSYM GLU_NURBS_ERROR30} - GLU_NURBS_ERROR31 = 100281; - {$EXTERNALSYM GLU_NURBS_ERROR31} - GLU_NURBS_ERROR32 = 100282; - {$EXTERNALSYM GLU_NURBS_ERROR32} - GLU_NURBS_ERROR33 = 100283; - {$EXTERNALSYM GLU_NURBS_ERROR33} - GLU_NURBS_ERROR34 = 100284; - {$EXTERNALSYM GLU_NURBS_ERROR34} - GLU_NURBS_ERROR35 = 100285; - {$EXTERNALSYM GLU_NURBS_ERROR35} - GLU_NURBS_ERROR36 = 100286; - {$EXTERNALSYM GLU_NURBS_ERROR36} - GLU_NURBS_ERROR37 = 100287; - {$EXTERNALSYM GLU_NURBS_ERROR37} - - // Contours types -- obsolete! - GLU_CW = 100120; - {$EXTERNALSYM GLU_CW} - GLU_CCW = 100121; - {$EXTERNALSYM GLU_CCW} - GLU_INTERIOR = 100122; - {$EXTERNALSYM GLU_INTERIOR} - GLU_EXTERIOR = 100123; - {$EXTERNALSYM GLU_EXTERIOR} - GLU_UNKNOWN = 100124; - {$EXTERNALSYM GLU_UNKNOWN} - - // Names without "TESS_" prefix - GLU_BEGIN = GLU_TESS_BEGIN; - {$EXTERNALSYM GLU_BEGIN} - GLU_VERTEX = GLU_TESS_VERTEX; - {$EXTERNALSYM GLU_VERTEX} - GLU_END = GLU_TESS_END; - {$EXTERNALSYM GLU_END} - GLU_ERROR = GLU_TESS_ERROR; - {$EXTERNALSYM GLU_ERROR} - GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG; - {$EXTERNALSYM GLU_EDGE_FLAG} - - GLX_VERSION_1_1 = 1; - GLX_VERSION_1_2 = 1; - GLX_VERSION_1_3 = 1; - GLX_EXTENSION_NAME = 'GLX'; - {$EXTERNALSYM GLX_EXTENSION_NAME} - GLX_USE_GL = 1; - {$EXTERNALSYM GLX_USE_GL} - GLX_BUFFER_SIZE = 2; - {$EXTERNALSYM GLX_BUFFER_SIZE} - GLX_LEVEL = 3; - {$EXTERNALSYM GLX_LEVEL} - GLX_RGBA = 4; - {$EXTERNALSYM GLX_RGBA} - GLX_DOUBLEBUFFER = 5; - {$EXTERNALSYM GLX_DOUBLEBUFFER} - GLX_STEREO = 6; - {$EXTERNALSYM GLX_STEREO} - GLX_AUX_BUFFERS = 7; - {$EXTERNALSYM GLX_AUX_BUFFERS} - GLX_RED_SIZE = 8; - {$EXTERNALSYM GLX_RED_SIZE} - GLX_GREEN_SIZE = 9; - {$EXTERNALSYM GLX_GREEN_SIZE} - GLX_BLUE_SIZE = 10; - {$EXTERNALSYM GLX_BLUE_SIZE} - GLX_ALPHA_SIZE = 11; - {$EXTERNALSYM GLX_ALPHA_SIZE} - GLX_DEPTH_SIZE = 12; - {$EXTERNALSYM GLX_DEPTH_SIZE} - GLX_STENCIL_SIZE = 13; - {$EXTERNALSYM GLX_STENCIL_SIZE} - GLX_ACCUM_RED_SIZE = 14; - {$EXTERNALSYM GLX_ACCUM_RED_SIZE} - GLX_ACCUM_GREEN_SIZE = 15; - {$EXTERNALSYM GLX_ACCUM_GREEN_SIZE} - GLX_ACCUM_BLUE_SIZE = 16; - {$EXTERNALSYM GLX_ACCUM_BLUE_SIZE} - GLX_ACCUM_ALPHA_SIZE = 17; - {$EXTERNALSYM GLX_ACCUM_ALPHA_SIZE} - - // Error codes returned by glXGetConfig: - GLX_BAD_SCREEN = 1; - {$EXTERNALSYM GLX_BAD_SCREEN} - GLX_BAD_ATTRIBUTE = 2; - {$EXTERNALSYM GLX_BAD_ATTRIBUTE} - GLX_NO_EXTENSION = 3; - {$EXTERNALSYM GLX_NO_EXTENSION} - GLX_BAD_VISUAL = 4; - {$EXTERNALSYM GLX_BAD_VISUAL} - GLX_BAD_CONTEXT = 5; - {$EXTERNALSYM GLX_BAD_CONTEXT} - GLX_BAD_VALUE = 6; - {$EXTERNALSYM GLX_BAD_VALUE} - GLX_BAD_ENUM = 7; - {$EXTERNALSYM GLX_BAD_ENUM} - - // GLX 1.1 and later: - GLX_VENDOR = 1; - {$EXTERNALSYM GLX_VENDOR} - GLX_VERSION = 2; - {$EXTERNALSYM GLX_VERSION} - GLX_EXTENSIONS = 3; - {$EXTERNALSYM GLX_EXTENSIONS} - - // GLX 1.3 and later: - GLX_CONFIG_CAVEAT = $20; - {$EXTERNALSYM GLX_CONFIG_CAVEAT} - GLX_DONT_CARE = $FFFFFFFF; - {$EXTERNALSYM GLX_DONT_CARE} - GLX_SLOW_CONFIG = $8001; - {$EXTERNALSYM GLX_SLOW_CONFIG} - GLX_NON_CONFORMANT_CONFIG = $800D; - {$EXTERNALSYM GLX_NON_CONFORMANT_CONFIG} - GLX_X_VISUAL_TYPE = $22; - {$EXTERNALSYM GLX_X_VISUAL_TYPE} - GLX_TRANSPARENT_TYPE = $23; - {$EXTERNALSYM GLX_TRANSPARENT_TYPE} - GLX_TRANSPARENT_INDEX_VALUE = $24; - {$EXTERNALSYM GLX_TRANSPARENT_INDEX_VALUE} - GLX_TRANSPARENT_RED_VALUE = $25; - {$EXTERNALSYM GLX_TRANSPARENT_RED_VALUE} - GLX_TRANSPARENT_GREEN_VALUE = $26; - {$EXTERNALSYM GLX_TRANSPARENT_GREEN_VALUE} - GLX_TRANSPARENT_BLUE_VALUE = $27; - {$EXTERNALSYM GLX_TRANSPARENT_BLUE_VALUE} - GLX_TRANSPARENT_ALPHA_VALUE = $28; - {$EXTERNALSYM GLX_TRANSPARENT_ALPHA_VALUE} - GLX_MAX_PBUFFER_WIDTH = $8016; - {$EXTERNALSYM GLX_MAX_PBUFFER_WIDTH} - GLX_MAX_PBUFFER_HEIGHT = $8017; - {$EXTERNALSYM GLX_MAX_PBUFFER_HEIGHT} - GLX_MAX_PBUFFER_PIXELS = $8018; - {$EXTERNALSYM GLX_MAX_PBUFFER_PIXELS} - GLX_PRESERVED_CONTENTS = $801B; - {$EXTERNALSYM GLX_PRESERVED_CONTENTS} - GLX_LARGEST_BUFFER = $801C; - {$EXTERNALSYM GLX_LARGEST_BUFFER} - GLX_DRAWABLE_TYPE = $8010; - {$EXTERNALSYM GLX_DRAWABLE_TYPE} - GLX_FBCONFIG_ID = $8013; - {$EXTERNALSYM GLX_FBCONFIG_ID} - GLX_VISUAL_ID = $800B; - {$EXTERNALSYM GLX_VISUAL_ID} - GLX_WINDOW_BIT = $00000001; - {$EXTERNALSYM GLX_WINDOW_BIT} - GLX_PIXMAP_BIT = $00000002; - {$EXTERNALSYM GLX_PIXMAP_BIT} - GLX_PBUFFER_BIT = $00000004; - {$EXTERNALSYM GLX_PBUFFER_BIT} - GLX_AUX_BUFFERS_BIT = $00000010; - {$EXTERNALSYM GLX_AUX_BUFFERS_BIT} - GLX_FRONT_LEFT_BUFFER_BIT = $00000001; - {$EXTERNALSYM GLX_FRONT_LEFT_BUFFER_BIT} - GLX_FRONT_RIGHT_BUFFER_BIT = $00000002; - {$EXTERNALSYM GLX_FRONT_RIGHT_BUFFER_BIT} - GLX_BACK_LEFT_BUFFER_BIT = $00000004; - {$EXTERNALSYM GLX_BACK_LEFT_BUFFER_BIT} - GLX_BACK_RIGHT_BUFFER_BIT = $00000008; - {$EXTERNALSYM GLX_BACK_RIGHT_BUFFER_BIT} - GLX_DEPTH_BUFFER_BIT = $00000020; - {$EXTERNALSYM GLX_DEPTH_BUFFER_BIT} - GLX_STENCIL_BUFFER_BIT = $00000040; - {$EXTERNALSYM GLX_STENCIL_BUFFER_BIT} - GLX_ACCUM_BUFFER_BIT = $00000080; - {$EXTERNALSYM GLX_ACCUM_BUFFER_BIT} - GLX_RENDER_TYPE = $8011; - {$EXTERNALSYM GLX_RENDER_TYPE} - GLX_X_RENDERABLE = $8012; - {$EXTERNALSYM GLX_X_RENDERABLE} - GLX_NONE = $8000; - {$EXTERNALSYM GLX_NONE} - GLX_TRUE_COLOR = $8002; - {$EXTERNALSYM GLX_TRUE_COLOR} - GLX_DIRECT_COLOR = $8003; - {$EXTERNALSYM GLX_DIRECT_COLOR} - GLX_PSEUDO_COLOR = $8004; - {$EXTERNALSYM GLX_PSEUDO_COLOR} - GLX_STATIC_COLOR = $8005; - {$EXTERNALSYM GLX_STATIC_COLOR} - GLX_GRAY_SCALE = $8006; - {$EXTERNALSYM GLX_GRAY_SCALE} - GLX_STATIC_GRAY = $8007; - {$EXTERNALSYM GLX_STATIC_GRAY} - GLX_TRANSPARENT_INDEX = $8009; - {$EXTERNALSYM GLX_TRANSPARENT_INDEX} - GLX_COLOR_INDEX_TYPE = $8015; - {$EXTERNALSYM GLX_COLOR_INDEX_TYPE} - GLX_COLOR_INDEX_BIT = $00000002; - {$EXTERNALSYM GLX_COLOR_INDEX_BIT} - GLX_SCREEN = $800C; - {$EXTERNALSYM GLX_SCREEN} - GLX_PBUFFER_CLOBBER_MASK = $08000000; - {$EXTERNALSYM GLX_PBUFFER_CLOBBER_MASK} - GLX_DAMAGED = $8020; - {$EXTERNALSYM GLX_DAMAGED} - GLX_SAVED = $8021; - {$EXTERNALSYM GLX_SAVED} - GLX_WINDOW = $8022; - {$EXTERNALSYM GLX_WINDOW} - GLX_PBUFFER = $8023; - {$EXTERNALSYM GLX_PBUFFER} - GLX_EXT_visual_info = 1; - {$EXTERNALSYM GLX_EXT_visual_info} - GLX_X_VISUAL_TYPE_EXT = $22; - {$EXTERNALSYM GLX_X_VISUAL_TYPE_EXT} - GLX_TRANSPARENT_TYPE_EXT = $23; - {$EXTERNALSYM GLX_TRANSPARENT_TYPE_EXT} - GLX_TRANSPARENT_INDEX_VALUE_EXT = $24; - {$EXTERNALSYM GLX_TRANSPARENT_INDEX_VALUE_EXT} - GLX_TRANSPARENT_RED_VALUE_EXT = $25; - {$EXTERNALSYM GLX_TRANSPARENT_RED_VALUE_EXT} - GLX_TRANSPARENT_GREEN_VALUE_EXT = $26; - {$EXTERNALSYM GLX_TRANSPARENT_GREEN_VALUE_EXT} - GLX_TRANSPARENT_BLUE_VALUE_EXT = $27; - {$EXTERNALSYM GLX_TRANSPARENT_BLUE_VALUE_EXT} - GLX_TRANSPARENT_ALPHA_VALUE_EXT = $28; - {$EXTERNALSYM GLX_TRANSPARENT_ALPHA_VALUE_EXT} - GLX_TRUE_COLOR_EXT = $8002; - {$EXTERNALSYM GLX_TRUE_COLOR_EXT} - GLX_DIRECT_COLOR_EXT = $8003; - {$EXTERNALSYM GLX_DIRECT_COLOR_EXT} - GLX_PSEUDO_COLOR_EXT = $8004; - {$EXTERNALSYM GLX_PSEUDO_COLOR_EXT} - GLX_STATIC_COLOR_EXT = $8005; - {$EXTERNALSYM GLX_STATIC_COLOR_EXT} - GLX_GRAY_SCALE_EXT = $8006; - {$EXTERNALSYM GLX_GRAY_SCALE_EXT} - GLX_STATIC_GRAY_EXT = $8007; - {$EXTERNALSYM GLX_STATIC_GRAY_EXT} - GLX_NONE_EXT = $8000; - {$EXTERNALSYM GLX_NONE_EXT} - GLX_TRANSPARENT_RGB_EXT = $8008; - {$EXTERNALSYM GLX_TRANSPARENT_RGB_EXT} - GLX_TRANSPARENT_INDEX_EXT = $8009; - {$EXTERNALSYM GLX_TRANSPARENT_INDEX_EXT} - GLX_VISUAL_CAVEAT_EXT = $20; - {$EXTERNALSYM GLX_VISUAL_CAVEAT_EXT} - GLX_SLOW_VISUAL_EXT = $8001; - {$EXTERNALSYM GLX_SLOW_VISUAL_EXT} - GLX_NON_CONFORMANT_VISUAL_EXT = $800D; - {$EXTERNALSYM GLX_NON_CONFORMANT_VISUAL_EXT} - GLX_SHARE_CONTEXT_EXT = $800A; - {$EXTERNALSYM GLX_SHARE_CONTEXT_EXT} - GLX_VISUAL_ID_EXT = $800B; - {$EXTERNALSYM GLX_VISUAL_ID_EXT} - GLX_SCREEN_EXT = $800C; - {$EXTERNALSYM GLX_SCREEN_EXT} - GLX_3DFX_WINDOW_MODE_MESA = $1; - {$EXTERNALSYM GLX_3DFX_WINDOW_MODE_MESA} - GLX_3DFX_FULLSCREEN_MODE_MESA = $2; - {$EXTERNALSYM GLX_3DFX_FULLSCREEN_MODE_MESA} - - -type - // GLU types - TGLUNurbs = record end; - TGLUQuadric = record end; - TGLUTesselator = record end; - - PGLUNurbs = ^TGLUNurbs; - PGLUQuadric = ^TGLUQuadric; - PGLUTesselator = ^TGLUTesselator; - - // backwards compatibility - TGLUNurbsObj = TGLUNurbs; - TGLUQuadricObj = TGLUQuadric; - TGLUTesselatorObj = TGLUTesselator; - TGLUTriangulatorObj = TGLUTesselator; - - PGLUNurbsObj = PGLUNurbs; - PGLUQuadricObj = PGLUQuadric; - PGLUTesselatorObj = PGLUTesselator; - PGLUTriangulatorObj = PGLUTesselator; - - {$IFDEF FPC} - {$IFDEF UNIX} - PALETTEENTRY = record - peRed : BYTE; - peGreen : BYTE; - peBlue : BYTE; - peFlags : BYTE; - end; - LPPALETTEENTRY = ^PALETTEENTRY; - tagPALETTEENTRY = PALETTEENTRY; - TPaletteEntry = PALETTEENTRY; - PPALETTEENTRY = ^PALETTEENTRY; - xid = txid; - pixmap = tpixmap; - font = tfont; - window = twindow; - colormap = tcolormap; - {$ENDIF} - - PMaxLogPalette = ^TMaxLogPalette; - TMaxLogPalette = packed record - palversion : word; - palnumentries : word; - palpalentry : array[byte] of TPaletteEntry; - end; - - {$ifdef WIN32} // If Windows - PWGLSwap = ^TWGLSwap; - {$EXTERNALSYM _WGLSWAP} - _WGLSWAP = packed record - hdc: HDC; - uiFlags: Cardinal; - end; - TWGLSwap = _WGLSWAP; - {$EXTERNALSYM WGLSWAP} - WGLSWAP = _WGLSWAP; - {$endif WIN32} - - {$ENDIF} - - {$ifdef VER100} // Delphi 3 - PWGLSwap = ^TWGLSwap; - {$EXTERNALSYM _WGLSWAP} - _WGLSWAP = packed record - hdc: HDC; - uiFlags: Cardinal; - end; - TWGLSwap = _WGLSWAP; - {$EXTERNALSYM WGLSWAP} - WGLSWAP = _WGLSWAP; - {$endif VER100} - - // Callback function prototypes - // GLUQuadricCallback - TGLUQuadricErrorProc = procedure(errorCode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - - // GLUTessCallback - TGLUTessBeginProc = procedure(AType: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - TGLUTessEdgeFlagProc = procedure(Flag: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - TGLUTessVertexProc = procedure(VertexData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - TGLUTessEndProc = procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - TGLUTessErrorProc = procedure(ErrNo: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - TGLUTessCombineProc = procedure(Coords: TVector3d; VertexData: TVector4p; Weight: TVector4f; OutData: PPointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - TGLUTessBeginDataProc = procedure(AType: TGLEnum; UserData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - TGLUTessEdgeFlagDataProc = procedure(Flag: TGLboolean; UserData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - TGLUTessVertexDataProc = procedure(VertexData: Pointer; UserData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - TGLUTessEndDataProc = procedure(UserData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - TGLUTessErrorDataProc = procedure(ErrNo: TGLEnum; UserData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - TGLUTessCombineDataProc = procedure(Coords: TVector3d; VertexData: TVector4p; Weight: TVector4f; OutData: PPointer; UserData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - - // GLUNurbsCallback - TGLUNurbsErrorProc = procedure(ErrorCode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - -var - // GL functions and procedures - glAccum: procedure(op: TGLuint; value: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glAccum} - glAlphaFunc: procedure(func: TGLEnum; ref: TGLclampf); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glAlphaFunc} - glAreTexturesResident: function(n: TGLsizei; Textures: PGLuint; residences: PGLboolean): TGLboolean; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glAreTexturesResident} - glArrayElement: procedure(i: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glArrayElement} - glBegin: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBegin} - glBindTexture: procedure(target: TGLEnum; texture: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBindTexture} - glBitmap: procedure(width: TGLsizei; height: TGLsizei; xorig, yorig: TGLfloat; xmove: TGLfloat; ymove: TGLfloat; bitmap: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBitmap} - glBlendFunc: procedure(sfactor: TGLEnum; dfactor: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBlendFunc} - glCallList: procedure(list: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCallList} - glCallLists: procedure(n: TGLsizei; atype: TGLEnum; lists: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCallLists} - glClear: procedure(mask: TGLbitfield); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glClear} - glClearAccum: procedure(red, green, blue, alpha: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glClearAccum} - glClearColor: procedure(red, green, blue, alpha: TGLclampf); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glClearColor} - glClearDepth: procedure(depth: TGLclampd); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glClearDepth} - glClearIndex: procedure(c: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glClearIndex} - glClearStencil: procedure(s: TGLint ); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glClearStencil} - glClipPlane: procedure(plane: TGLEnum; equation: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glClipPlane} - glColor3b: procedure(red, green, blue: TGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor3b} - glColor3bv: procedure(v: PGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor3bv} - glColor3d: procedure(red, green, blue: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor3d} - glColor3dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor3dv} - glColor3f: procedure(red, green, blue: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor3f} - glColor3fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor3fv} - glColor3i: procedure(red, green, blue: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor3i} - glColor3iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor3iv} - glColor3s: procedure(red, green, blue: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor3s} - glColor3sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor3sv} - glColor3ub: procedure(red, green, blue: TGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor3ub} - glColor3ubv: procedure(v: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor3ubv} - glColor3ui: procedure(red, green, blue: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor3ui} - glColor3uiv: procedure(v: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor3uiv} - glColor3us: procedure(red, green, blue: TGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor3us} - glColor3usv: procedure(v: PGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor3usv} - glColor4b: procedure(red, green, blue, alpha: TGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor4b} - glColor4bv: procedure(v: PGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor4bv} - glColor4d: procedure(red, green, blue, alpha: TGLdouble ); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor4d} - glColor4dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor4dv} - glColor4f: procedure(red, green, blue, alpha: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor4f} - glColor4fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor4fv} - glColor4i: procedure(red, green, blue, alpha: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor4i} - glColor4iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor4iv} - glColor4s: procedure(red, green, blue, alpha: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor4s} - glColor4sv: procedure(v: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor4sv} - glColor4ub: procedure(red, green, blue, alpha: TGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor4ub} - glColor4ubv: procedure(v: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor4ubv} - glColor4ui: procedure(red, green, blue, alpha: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor4ui} - glColor4uiv: procedure(v: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor4uiv} - glColor4us: procedure(red, green, blue, alpha: TGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor4us} - glColor4usv: procedure(v: PGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor4usv} - glColorMask: procedure(red, green, blue, alpha: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColorMask} - glColorMaterial: procedure(face: TGLEnum; mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColorMaterial} - glColorPointer: procedure(size: TGLint; atype: TGLEnum; stride: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColorPointer} - glCopyPixels: procedure(x, y: TGLint; width, height: TGLsizei; atype: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCopyPixels} - glCopyTexImage1D: procedure(target: TGLEnum; level: TGLint; internalFormat: TGLEnum; x, y: TGLint; width: TGLsizei; border: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCopyTexImage1D} - glCopyTexImage2D: procedure(target: TGLEnum; level: TGLint; internalFormat: TGLEnum; x, y: TGLint; width, height: TGLsizei; border: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCopyTexImage2D} - glCopyTexSubImage1D: procedure(target: TGLEnum; level, xoffset, x, y: TGLint; width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCopyTexSubImage1D} - glCopyTexSubImage2D: procedure(target: TGLEnum; level, xoffset, yoffset, x, y: TGLint; width, height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCopyTexSubImage2D} - glCullFace: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCullFace} - glDeleteLists: procedure(list: TGLuint; range: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glDeleteLists} - glDeleteTextures: procedure(n: TGLsizei; textures: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glDeleteTextures} - glDepthFunc: procedure(func: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glDepthFunc} - glDepthMask: procedure(flag: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glDepthMask} - glDepthRange: procedure(zNear, zFar: TGLclampd); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glDepthRange} - glDisable: procedure(cap: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glDisable} - glDisableClientState: procedure(aarray: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glDisableClientState} - glDrawArrays: procedure(mode: TGLEnum; first: TGLint; count: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glDrawArrays} - glDrawBuffer: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glDrawBuffer} - glDrawElements: procedure(mode: TGLEnum; count: TGLsizei; atype: TGLEnum; indices: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glDrawElements} - glDrawPixels: procedure(width, height: TGLsizei; format, atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glDrawPixels} - glEdgeFlag: procedure(flag: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glEdgeFlag} - glEdgeFlagPointer: procedure(stride: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glEdgeFlagPointer} - glEdgeFlagv: procedure(flag: PGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glEdgeFlagv} - glEnable: procedure(cap: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glEnable} - glEnableClientState: procedure(aarray: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glEnableClientState} - glEnd: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glEnd} - glEndList: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glEndList} - glEvalCoord1d: procedure(u: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glEvalCoord1d} - glEvalCoord1dv: procedure(u: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glEvalCoord1dv} - glEvalCoord1f: procedure(u: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glEvalCoord1f} - glEvalCoord1fv: procedure(u: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glEvalCoord1fv} - glEvalCoord2d: procedure(u: TGLdouble; v: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glEvalCoord2d} - glEvalCoord2dv: procedure(u: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glEvalCoord2dv} - glEvalCoord2f: procedure(u, v: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glEvalCoord2f} - glEvalCoord2fv: procedure(u: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glEvalCoord2fv} - glEvalMesh1: procedure(mode: TGLEnum; i1, i2: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glEvalMesh1} - glEvalMesh2: procedure(mode: TGLEnum; i1, i2, j1, j2: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glEvalMesh2} - glEvalPoint1: procedure(i: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glEvalPoint1} - glEvalPoint2: procedure(i, j: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glEvalPoint2} - glFeedbackBuffer: procedure(size: TGLsizei; atype: TGLEnum; buffer: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFeedbackBuffer} - glFinish: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFinish} - glFlush: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFlush} - glFogf: procedure(pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFogf} - glFogfv: procedure(pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFogfv} - glFogi: procedure(pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFogi} - glFogiv: procedure(pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFogiv} - glFrontFace: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFrontFace} - glFrustum: procedure(left, right, bottom, top, zNear, zFar: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFrustum} - glGenLists: function(range: TGLsizei): TGLuint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGenLists} - glGenTextures: procedure(n: TGLsizei; textures: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGenTextures} - glGetBooleanv: procedure(pname: TGLEnum; params: PGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetBooleanv} - glGetClipPlane: procedure(plane: TGLEnum; equation: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetClipPlane} - glGetDoublev: procedure(pname: TGLEnum; params: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetDoublev} - glGetError: function: TGLuint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetError} - glGetFloatv: procedure(pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetFloatv} - glGetIntegerv: procedure(pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetIntegerv} - glGetLightfv: procedure(light, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetLightfv} - glGetLightiv: procedure(light, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetLightiv} - glGetMapdv: procedure(target, query: TGLEnum; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetMapdv} - glGetMapfv: procedure(target, query: TGLEnum; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetMapfv} - glGetMapiv: procedure(target, query: TGLEnum; v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetMapiv} - glGetMaterialfv: procedure(face, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetMaterialfv} - glGetMaterialiv: procedure(face, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetMaterialiv} - glGetPixelMapfv: procedure(map: TGLEnum; values: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetPixelMapfv} - glGetPixelMapuiv: procedure(map: TGLEnum; values: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetPixelMapuiv} - glGetPixelMapusv: procedure(map: TGLEnum; values: PGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetPixelMapusv} - glGetPointerv: procedure(pname: TGLEnum; var params); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetPointerv} - glGetPolygonStipple: procedure(mask: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetPolygonStipple} - glGetString: function(name: TGLEnum): PChar; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetString} - glGetTexEnvfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetTexEnvfv} - glGetTexEnviv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetTexEnviv} - glGetTexGendv: procedure(coord, pname: TGLEnum; params: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetTexGendv} - glGetTexGenfv: procedure(coord, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetTexGenfv} - glGetTexGeniv: procedure(coord, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetTexGeniv} - glGetTexImage: procedure(target: TGLEnum; level: TGLint; format, atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetTexImage} - glGetTexLevelParameterfv: procedure(target: TGLEnum; level: TGLint; pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetTexLevelParameterfv} - glGetTexLevelParameteriv: procedure(target: TGLEnum; level: TGLint; pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetTexLevelParameteriv} - glGetTexParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetTexParameterfv} - glGetTexParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetTexParameteriv} - glHint: procedure(target, mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glHint} - glIndexMask: procedure(mask: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIndexMask} - glIndexPointer: procedure(atype: TGLEnum; stride: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIndexPointer} - glIndexd: procedure(c: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIndexd} - glIndexdv: procedure(c: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIndexdv} - glIndexf: procedure(c: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIndexf} - glIndexfv: procedure(c: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIndexfv} - glIndexi: procedure(c: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIndexi} - glIndexiv: procedure(c: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIndexiv} - glIndexs: procedure(c: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIndexs} - glIndexsv: procedure(c: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIndexsv} - glIndexub: procedure(c: TGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIndexub} - glIndexubv: procedure(c: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIndexubv} - glInitNames: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glInitNames} - glInterleavedArrays: procedure(format: TGLEnum; stride: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glInterleavedArrays} - glIsEnabled: function(cap: TGLEnum): TGLboolean; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIsEnabled} - glIsList: function(list: TGLuint): TGLboolean; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIsList} - glIsTexture: function(texture: TGLuint): TGLboolean; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIsTexture} - glLightModelf: procedure(pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glLightModelf} - glLightModelfv: procedure(pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glLightModelfv} - glLightModeli: procedure(pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glLightModeli} - glLightModeliv: procedure(pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glLightModeliv} - glLightf: procedure(light, pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glLightf} - glLightfv: procedure(light, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glLightfv} - glLighti: procedure(light, pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glLighti} - glLightiv: procedure(light, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glLightiv} - glLineStipple: procedure(factor: TGLint; pattern: TGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glLineStipple} - glLineWidth: procedure(width: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glLineWidth} - glListBase: procedure(base: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glListBase} - glLoadIdentity: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glLoadIdentity} - glLoadMatrixd: procedure(m: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glLoadMatrixd} - glLoadMatrixf: procedure(m: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glLoadMatrixf} - glLoadName: procedure(name: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glLoadName} - glLogicOp: procedure(opcode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glLogicOp} - glMap1d: procedure(target: TGLEnum; u1, u2: TGLdouble; stride, order: TGLint; points: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMap1d} - glMap1f: procedure(target: TGLEnum; u1, u2: TGLfloat; stride, order: TGLint; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMap1f} - glMap2d: procedure(target: TGLEnum; u1, u2: TGLdouble; ustride, uorder: TGLint; v1, v2: TGLdouble; vstride, - vorder: TGLint; points: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMap2d} - glMap2f: procedure(target: TGLEnum; u1, u2: TGLfloat; ustride, uorder: TGLint; v1, v2: TGLfloat; vstride, - vorder: TGLint; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMap2f} - glMapGrid1d: procedure(un: TGLint; u1, u2: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMapGrid1d} - glMapGrid1f: procedure(un: TGLint; u1, u2: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMapGrid1f} - glMapGrid2d: procedure(un: TGLint; u1, u2: TGLdouble; vn: TGLint; v1, v2: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMapGrid2d} - glMapGrid2f: procedure(un: TGLint; u1, u2: TGLfloat; vn: TGLint; v1, v2: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMapGrid2f} - glMaterialf: procedure(face, pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMaterialf} - glMaterialfv: procedure(face, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMaterialfv} - glMateriali: procedure(face, pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMateriali} - glMaterialiv: procedure(face, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMaterialiv} - glMatrixMode: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMatrixMode} - glMultMatrixd: procedure(m: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultMatrixd} - glMultMatrixf: procedure(m: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultMatrixf} - glNewList: procedure(list: TGLuint; mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glNewList} - glNormal3b: procedure(nx, ny, nz: TGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glNormal3b} - glNormal3bv: procedure(v: PGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glNormal3bv} - glNormal3d: procedure(nx, ny, nz: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glNormal3d} - glNormal3dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glNormal3dv} - glNormal3f: procedure(nx, ny, nz: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glNormal3f} - glNormal3fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glNormal3fv} - glNormal3i: procedure(nx, ny, nz: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glNormal3i} - glNormal3iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glNormal3iv} - glNormal3s: procedure(nx, ny, nz: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glNormal3s} - glNormal3sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glNormal3sv} - glNormalPointer: procedure(atype: TGLEnum; stride: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glNormalPointer} - glOrtho: procedure(left, right, bottom, top, zNear, zFar: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glOrtho} - glPassThrough: procedure(token: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPassThrough} - glPixelMapfv: procedure(map: TGLEnum; mapsize: TGLsizei; values: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPixelMapfv} - glPixelMapuiv: procedure(map: TGLEnum; mapsize: TGLsizei; values: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPixelMapuiv} - glPixelMapusv: procedure(map: TGLEnum; mapsize: TGLsizei; values: PGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPixelMapusv} - glPixelStoref: procedure(pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPixelStoref} - glPixelStorei: procedure(pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPixelStorei} - glPixelTransferf: procedure(pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPixelTransferf} - glPixelTransferi: procedure(pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPixelTransferi} - glPixelZoom: procedure(xfactor, yfactor: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPixelZoom} - glPointSize: procedure(size: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPointSize} - glPolygonMode: procedure(face, mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPolygonMode} - glPolygonOffset: procedure(factor, units: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPolygonOffset} - glPolygonStipple: procedure(mask: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPolygonStipple} - glPopAttrib: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPopAttrib} - glPopClientAttrib: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPopClientAttrib} - glPopMatrix: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPopMatrix} - glPopName: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPopName} - glPrioritizeTextures: procedure(n: TGLsizei; textures: PGLuint; priorities: PGLclampf); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPrioritizeTextures} - glPushAttrib: procedure(mask: TGLbitfield); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPushAttrib} - glPushClientAttrib: procedure(mask: TGLbitfield); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPushClientAttrib} - glPushMatrix: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPushMatrix} - glPushName: procedure(name: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPushName} - glRasterPos2d: procedure(x, y: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos2d} - glRasterPos2dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos2dv} - glRasterPos2f: procedure(x, y: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos2f} - glRasterPos2fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos2fv} - glRasterPos2i: procedure(x, y: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos2i} - glRasterPos2iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos2iv} - glRasterPos2s: procedure(x, y: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos2s} - glRasterPos2sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos2sv} - glRasterPos3d: procedure(x, y, z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos3d} - glRasterPos3dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos3dv} - glRasterPos3f: procedure(x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos3f} - glRasterPos3fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos3fv} - glRasterPos3i: procedure(x, y, z: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos3i} - glRasterPos3iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos3iv} - glRasterPos3s: procedure(x, y, z: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos3s} - glRasterPos3sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos3sv} - glRasterPos4d: procedure(x, y, z, w: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos4d} - glRasterPos4dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos4dv} - glRasterPos4f: procedure(x, y, z, w: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos4f} - glRasterPos4fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos4fv} - glRasterPos4i: procedure(x, y, z, w: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos4i} - glRasterPos4iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos4iv} - glRasterPos4s: procedure(x, y, z, w: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos4s} - glRasterPos4sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRasterPos4sv} - glReadBuffer: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReadBuffer} - glReadPixels: procedure(x, y: TGLint; width, height: TGLsizei; format, atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReadPixels} - glRectd: procedure(x1, y1, x2, y2: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRectd} - glRectdv: procedure(v1, v2: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRectdv} - glRectf: procedure(x1, y1, x2, y2: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRectf} - glRectfv: procedure(v1, v2: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRectfv} - glRecti: procedure(x1, y1, x2, y2: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRecti} - glRectiv: procedure(v1, v2: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRectiv} - glRects: procedure(x1, y1, x2, y2: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRects} - glRectsv: procedure(v1, v2: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRectsv} - glRenderMode: function(mode: TGLEnum): TGLint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRenderMode} - glRotated: procedure(angle, x, y, z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRotated} - glRotatef: procedure(angle, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRotatef} - glScaled: procedure(x, y, z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glScaled} - glScalef: procedure(x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glScalef} - glScissor: procedure(x, y: TGLint; width, height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glScissor} - glSelectBuffer: procedure(size: TGLsizei; buffer: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSelectBuffer} - glShadeModel: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glShadeModel} - glStencilFunc: procedure(func: TGLEnum; ref: TGLint; mask: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glStencilFunc} - glStencilMask: procedure(mask: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glStencilMask} - glStencilOp: procedure(fail, zfail, zpass: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glStencilOp} - glTexCoord1d: procedure(s: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord1d} - glTexCoord1dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord1dv} - glTexCoord1f: procedure(s: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord1f} - glTexCoord1fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord1fv} - glTexCoord1i: procedure(s: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord1i} - glTexCoord1iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord1iv} - glTexCoord1s: procedure(s: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord1s} - glTexCoord1sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord1sv} - glTexCoord2d: procedure(s, t: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord2d} - glTexCoord2dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord2dv} - glTexCoord2f: procedure(s, t: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord2f} - glTexCoord2fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord2fv} - glTexCoord2i: procedure(s, t: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord2i} - glTexCoord2iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord2iv} - glTexCoord2s: procedure(s, t: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord2s} - glTexCoord2sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord2sv} - glTexCoord3d: procedure(s, t, r: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord3d} - glTexCoord3dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord3dv} - glTexCoord3f: procedure(s, t, r: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord3f} - glTexCoord3fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord3fv} - glTexCoord3i: procedure(s, t, r: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord3i} - glTexCoord3iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord3iv} - glTexCoord3s: procedure(s, t, r: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord3s} - glTexCoord3sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord3sv} - glTexCoord4d: procedure(s, t, r, q: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord4d} - glTexCoord4dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord4dv} - glTexCoord4f: procedure(s, t, r, q: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord4f} - glTexCoord4fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord4fv} - glTexCoord4i: procedure(s, t, r, q: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord4i} - glTexCoord4iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord4iv} - glTexCoord4s: procedure(s, t, r, q: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord4s} - glTexCoord4sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord4sv} - glTexCoordPointer: procedure(size: TGLint; atype: TGLEnum; stride: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoordPointer} - glTexEnvf: procedure(target, pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexEnvf} - glTexEnvfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexEnvfv} - glTexEnvi: procedure(target, pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexEnvi} - glTexEnviv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexEnviv} - glTexGend: procedure(coord, pname: TGLEnum; param: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexGend} - glTexGendv: procedure(coord, pname: TGLEnum; params: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexGendv} - glTexGenf: procedure(coord, pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexGenf} - glTexGenfv: procedure(coord, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexGenfv} - glTexGeni: procedure(coord, pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexGeni} - glTexGeniv: procedure(coord, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexGeniv} - glTexImage1D: procedure(target: TGLEnum; level, internalformat: TGLint; width: TGLsizei; border: TGLint; format, - atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexImage1D} - glTexImage2D: procedure(target: TGLEnum; level, internalformat: TGLint; width, height: TGLsizei; border: TGLint; - format, atype: TGLEnum; Pixels:Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexImage2D} - glTexParameterf: procedure(target, pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexParameterf} - glTexParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexParameterfv} - glTexParameteri: procedure(target, pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexParameteri} - glTexParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexParameteriv} - glTexSubImage1D: procedure(target: TGLEnum; level, xoffset: TGLint; width: TGLsizei; format, atype: TGLEnum; - pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexSubImage1D} - glTexSubImage2D: procedure(target: TGLEnum; level, xoffset, yoffset: TGLint; width, height: TGLsizei; format, - atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexSubImage2D} - glTranslated: procedure(x, y, z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTranslated} - glTranslatef: procedure(x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTranslatef} - glVertex2d: procedure(x, y: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex2d} - glVertex2dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex2dv} - glVertex2f: procedure(x, y: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex2f} - glVertex2fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex2fv} - glVertex2i: procedure(x, y: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex2i} - glVertex2iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex2iv} - glVertex2s: procedure(x, y: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex2s} - glVertex2sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex2sv} - glVertex3d: procedure(x, y, z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex3d} - glVertex3dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex3dv} - glVertex3f: procedure(x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex3f} - glVertex3fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex3fv} - glVertex3i: procedure(x, y, z: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex3i} - glVertex3iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex3iv} - glVertex3s: procedure(x, y, z: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex3s} - glVertex3sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex3sv} - glVertex4d: procedure(x, y, z, w: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex4d} - glVertex4dv: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex4dv} - glVertex4f: procedure(x, y, z, w: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex4f} - glVertex4fv: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex4fv} - glVertex4i: procedure(x, y, z, w: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex4i} - glVertex4iv: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex4iv} - glVertex4s: procedure(x, y, z, w: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex4s} - glVertex4sv: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertex4sv} - glVertexPointer: procedure(size: TGLint; atype: TGLEnum; stride: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexPointer} - glViewport: procedure(x, y: TGLint; width, height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glViewport} - - // GL 1.2 - glDrawRangeElements: procedure(mode: TGLEnum; Astart, Aend: TGLuint; count: TGLsizei; Atype: TGLEnum; - indices: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glDrawRangeElements} - glTexImage3D: procedure(target: TGLEnum; level: TGLint; internalformat: TGLEnum; width, height, depth: TGLsizei; - border: TGLint; format: TGLEnum; Atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexImage3D} - - // GL 1.2 ARB imaging - glBlendColor: procedure(red, green, blue, alpha: TGLclampf); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBlendColor} - glBlendEquation: procedure(mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBlendEquation} - glColorSubTable: procedure(target: TGLEnum; start, count: TGLsizei; format, Atype: TGLEnum; data: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColorSubTable} - glCopyColorSubTable: procedure(target: TGLEnum; start: TGLsizei; x, y: TGLint; width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCopyColorSubTable} - glColorTable: procedure(target, internalformat: TGLEnum; width: TGLsizei; format, Atype: TGLEnum; - table: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColorTable} - glCopyColorTable: procedure(target, internalformat: TGLEnum; x, y: TGLint; width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCopyColorTable} - glColorTableParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColorTableParameteriv} - glColorTableParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColorTableParameterfv} - glGetColorTable: procedure(target, format, Atype: TGLEnum; table: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetColorTable} - glGetColorTableParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetColorTableParameteriv} - glGetColorTableParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetColorTableParameterfv} - glConvolutionFilter1D: procedure(target, internalformat: TGLEnum; width: TGLsizei; format, Atype: TGLEnum; - image: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glConvolutionFilter1D} - glConvolutionFilter2D: procedure(target, internalformat: TGLEnum; width, height: TGLsizei; format, Atype: TGLEnum; - image: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glConvolutionFilter2D} - glCopyConvolutionFilter1D: procedure(target, internalformat: TGLEnum; x, y: TGLint; width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCopyConvolutionFilter1D} - glCopyConvolutionFilter2D: procedure(target, internalformat: TGLEnum; x, y: TGLint; width, height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCopyConvolutionFilter2D} - glGetConvolutionFilter: procedure(target, internalformat, Atype: TGLEnum; image: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetConvolutionFilter} - glSeparableFilter2D: procedure(target, internalformat: TGLEnum; width, height: TGLsizei; format, Atype: TGLEnum; row, - column: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSeparableFilter2D} - glGetSeparableFilter: procedure(target, format, Atype: TGLEnum; row, column, span: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetSeparableFilter} - glConvolutionParameteri: procedure(target, pname: TGLEnum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glConvolutionParameteri} - glConvolutionParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glConvolutionParameteriv} - glConvolutionParameterf: procedure(target, pname: TGLEnum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glConvolutionParameterf} - glConvolutionParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glConvolutionParameterfv} - glGetConvolutionParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetConvolutionParameteriv} - glGetConvolutionParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetConvolutionParameterfv} - glHistogram: procedure(target: TGLEnum; width: TGLsizei; internalformat: TGLEnum; sink: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glHistogram} - glResetHistogram: procedure(target: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glResetHistogram} - glGetHistogram: procedure(target: TGLEnum; reset: TGLboolean; format, Atype: TGLEnum; values: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetHistogram} - glGetHistogramParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetHistogramParameteriv} - glGetHistogramParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetHistogramParameterfv} - glMinmax: procedure(target, internalformat: TGLEnum; sink: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMinmax} - glResetMinmax: procedure(target: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glResetMinmax} - glGetMinmax: procedure(target: TGLEnum; reset: TGLboolean; format, Atype: TGLEnum; values: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetMinmax} - glGetMinmaxParameteriv: procedure(target, pname: TGLEnum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetMinmaxParameteriv} - glGetMinmaxParameterfv: procedure(target, pname: TGLEnum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetMinmaxParameterfv} - - // GL utility functions and procedures - gluErrorString: function(errCode: TGLEnum): PChar; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluErrorString} - gluGetString: function(name: TGLEnum): PChar; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluGetString} - gluOrtho2D: procedure(left, right, bottom, top: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluOrtho2D} - gluPerspective: procedure(fovy, aspect, zNear, zFar: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluPerspective} - gluPickMatrix: procedure(x, y, width, height: TGLdouble; viewport: TVector4i); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluPickMatrix} - gluLookAt: procedure(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluLookAt} - gluProject: function(objx, objy, objz: TGLdouble; modelMatrix: TMatrix4d; projMatrix: TMatrix4d; viewport: TVector4i; - winx, winy, winz: PGLdouble): TGLint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluProject} - gluUnProject: function(winx, winy, winz: TGLdouble; modelMatrix: TMatrix4d; projMatrix: TMatrix4d; viewport: TVector4i; - objx, objy, objz: PGLdouble): TGLint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluUnProject} - gluScaleImage: function(format: TGLEnum; widthin, heightin: TGLint; typein: TGLEnum; datain: Pointer; widthout, - heightout: TGLint; typeout: TGLEnum; dataout: Pointer): TGLint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluScaleImage} - gluBuild1DMipmaps: function(target: TGLEnum; components, width: TGLint; format, atype: TGLEnum; - data: Pointer): TGLint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluBuild1DMipmaps} - gluBuild2DMipmaps: function(target: TGLEnum; components, width, height: TGLint; format, atype: TGLEnum; - Data: Pointer): TGLint; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluBuild2DMipmaps} - gluNewQuadric: function: PGLUquadric; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluNewQuadric} - gluDeleteQuadric: procedure(state: PGLUquadric); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluDeleteQuadric} - gluQuadricNormals: procedure(quadObject: PGLUquadric; normals: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluQuadricNormals} - gluQuadricTexture: procedure(quadObject: PGLUquadric; textureCoords: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluQuadricTexture} - gluQuadricOrientation: procedure(quadObject: PGLUquadric; orientation: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluQuadricOrientation} - gluQuadricDrawStyle: procedure(quadObject: PGLUquadric; drawStyle: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluQuadricDrawStyle} - gluCylinder: procedure(quadObject: PGLUquadric; baseRadius, topRadius, height: TGLdouble; slices, - stacks: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluCylinder} - gluDisk: procedure(quadObject: PGLUquadric; innerRadius, outerRadius: TGLdouble; slices, loops: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluDisk} - gluPartialDisk: procedure(quadObject: PGLUquadric; innerRadius, outerRadius: TGLdouble; slices, loops: TGLint; - startAngle, sweepAngle: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluPartialDisk} - gluSphere: procedure(quadObject: PGLUquadric; radius: TGLdouble; slices, stacks: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluSphere} - gluQuadricCallback: procedure(quadObject: PGLUquadric; which: TGLEnum; fn: TGLUQuadricErrorProc); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluQuadricCallback} - gluNewTess: function: PGLUtesselator; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluNewTess} - gluDeleteTess: procedure(tess: PGLUtesselator); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluDeleteTess} - gluTessBeginPolygon: procedure(tess: PGLUtesselator; polygon_data: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluTessBeginPolygon} - gluTessBeginContour: procedure(tess: PGLUtesselator); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluTessBeginContour} - gluTessVertex: procedure(tess: PGLUtesselator; coords: TVector3d; data: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluTessVertex} - gluTessEndContour: procedure(tess: PGLUtesselator); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluTessEndContour} - gluTessEndPolygon: procedure(tess: PGLUtesselator); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluTessEndPolygon} - gluTessProperty: procedure(tess: PGLUtesselator; which: TGLEnum; value: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluTessProperty} - gluTessNormal: procedure(tess: PGLUtesselator; x, y, z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluTessNormal} - gluTessCallback: procedure(tess: PGLUtesselator; which: TGLEnum; fn: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluTessCallback} - gluGetTessProperty: procedure(tess: PGLUtesselator; which: TGLEnum; value: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluGetTessProperty} - gluNewNurbsRenderer: function: PGLUnurbs; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluNewNurbsRenderer} - gluDeleteNurbsRenderer: procedure(nobj: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluDeleteNurbsRenderer} - gluBeginSurface: procedure(nobj: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluBeginSurface} - gluBeginCurve: procedure(nobj: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluBeginCurve} - gluEndCurve: procedure(nobj: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluEndCurve} - gluEndSurface: procedure(nobj: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluEndSurface} - gluBeginTrim: procedure(nobj: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluBeginTrim} - gluEndTrim: procedure(nobj: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluEndTrim} - gluPwlCurve: procedure(nobj: PGLUnurbs; count: TGLint; points: PGLfloat; stride: TGLint; atype: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluPwlCurve} - gluNurbsCurve: procedure(nobj: PGLUnurbs; nknots: TGLint; knot: PGLfloat; stride: TGLint; ctlarray: PGLfloat; order: TGLint; atype: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluNurbsCurve} - gluNurbsSurface: procedure(nobj: PGLUnurbs; sknot_count: TGLint; sknot: PGLfloat; tknot_count: TGLint; tknot: PGLfloat; s_stride, t_stride: TGLint; ctlarray: PGLfloat; sorder, torder: TGLint; atype: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluNurbsSurface} - gluLoadSamplingMatrices: procedure(nobj: PGLUnurbs; modelMatrix, projMatrix: TMatrix4f; viewport: TVector4i); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluLoadSamplingMatrices} - gluNurbsProperty: procedure(nobj: PGLUnurbs; aproperty: TGLEnum; value: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluNurbsProperty} - gluGetNurbsProperty: procedure(nobj: PGLUnurbs; aproperty: TGLEnum; value: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluGetNurbsProperty} - gluNurbsCallback: procedure(nobj: PGLUnurbs; which: TGLEnum; fn: TGLUNurbsErrorProc); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluNurbsCallback} - gluBeginPolygon: procedure(tess: PGLUtesselator); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluBeginPolygon} - gluNextContour: procedure(tess: PGLUtesselator; atype: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluNextContour} - gluEndPolygon: procedure(tess: PGLUtesselator); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluEndPolygon} - - // window support functions - {$ifdef Win32} - wglGetProcAddress: function(ProcName: PChar): Pointer; stdcall; - {$EXTERNALSYM wglGetProcAddress} - wglCopyContext: function(p1: HGLRC; p2: HGLRC; p3: Cardinal): BOOL; stdcall; - {$EXTERNALSYM wglCopyContext} - wglCreateContext: function(DC: HDC): HGLRC; stdcall; - {$EXTERNALSYM wglCreateContext} - wglCreateLayerContext: function(p1: HDC; p2: Integer): HGLRC; stdcall; - {$EXTERNALSYM wglCreateLayerContext} - wglDeleteContext: function(p1: HGLRC): BOOL; stdcall; - {$EXTERNALSYM wglDeleteContext} - wglDescribeLayerPlane:function(p1: HDC; p2, p3: Integer; p4: Cardinal; var p5: TLayerPlaneDescriptor): BOOL; stdcall; - {$EXTERNALSYM wglDescribeLayerPlane} - wglGetCurrentContext: function: HGLRC; stdcall; - {$EXTERNALSYM wglGetCurrentContext} - wglGetCurrentDC: function: HDC; stdcall; - {$EXTERNALSYM wglGetCurrentDC} - wglGetLayerPaletteEntries: function(p1: HDC; p2, p3, p4: Integer; var pcr): Integer; stdcall; - {$EXTERNALSYM wglGetLayerPaletteEntries} - wglMakeCurrent: function(DC: HDC; p2: HGLRC): BOOL; stdcall; - {$EXTERNALSYM wglMakeCurrent} - wglRealizeLayerPalette: function(p1: HDC; p2: Integer; p3: BOOL): BOOL; stdcall; - {$EXTERNALSYM wglRealizeLayerPalette} - wglSetLayerPaletteEntries: function(p1: HDC; p2, p3, p4: Integer; var pcr): Integer; stdcall; - {$EXTERNALSYM wglSetLayerPaletteEntries} - wglShareLists: function(p1, p2: HGLRC): BOOL; stdcall; - {$EXTERNALSYM wglShareLists} - wglSwapLayerBuffers: function(p1: HDC; p2: Cardinal): BOOL; stdcall; - {$EXTERNALSYM wglSwapLayerBuffers} - wglSwapMultipleBuffers: function(p1: Cardinal; const p2: PWGLSwap): DWORD; stdcall; - {$EXTERNALSYM wglSwapMultipleBuffers} - wglUseFontBitmapsA: function(DC: HDC; p2, p3, p4: DWORD): BOOL; stdcall; - {$EXTERNALSYM wglUseFontBitmapsA} - wglUseFontOutlinesA: function (p1: HDC; p2, p3, p4: DWORD; p5, p6: Single; p7: Integer; p8: PGlyphMetricsFloat): BOOL; stdcall; - {$EXTERNALSYM wglUseFontOutlinesA} - wglUseFontBitmapsW: function(DC: HDC; p2, p3, p4: DWORD): BOOL; stdcall; - {$EXTERNALSYM wglUseFontBitmapsW} - wglUseFontOutlinesW: function (p1: HDC; p2, p3, p4: DWORD; p5, p6: Single; p7: Integer; p8: PGlyphMetricsFloat): BOOL; stdcall; - {$EXTERNALSYM wglUseFontOutlinesW} - wglUseFontBitmaps: function(DC: HDC; p2, p3, p4: DWORD): BOOL; stdcall; - {$EXTERNALSYM wglUseFontBitmaps} - wglUseFontOutlines: function(p1: HDC; p2, p3, p4: DWORD; p5, p6: Single; p7: Integer; p8: PGlyphMetricsFloat): BOOL; stdcall; - {$EXTERNALSYM wglUseFontOutlines} - - // ARB wgl extensions - wglGetExtensionsStringARB: function(DC: HDC): PChar; stdcall; - {$EXTERNALSYM wglGetExtensionsStringARB} - wglGetPixelFormatAttribivARB: function(DC: HDC; iPixelFormat, iLayerPlane: Integer; nAttributes: Cardinal; - const piAttributes: PInteger; piValues : PInteger) : BOOL; stdcall; - {$EXTERNALSYM wglGetPixelFormatAttribivARB} - wglGetPixelFormatAttribfvARB: function(DC: HDC; iPixelFormat, iLayerPlane: Integer; nAttributes: Cardinal; - const piAttributes: PInteger; piValues: PGLFloat) : BOOL; stdcall; - {$EXTERNALSYM wglGetPixelFormatAttribfvARB} - wglChoosePixelFormatARB: function(DC: HDC; const piAttribIList: PInteger; const pfAttribFList: PGLFloat; - nMaxFormats: Cardinal; piFormats: PInteger; nNumFormats: PCardinal) : BOOL; stdcall; - {$EXTERNALSYM wglChoosePixelFormatARB} - {$endif} - - // ARB_multitexture - glMultiTexCoord1dARB: procedure(target: TGLenum; s: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord1dARB} - glMultiTexCoord1dVARB: procedure(target: TGLenum; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord1dVARB} - glMultiTexCoord1fARBP: procedure(target: TGLenum; s: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord1fARBP} - glMultiTexCoord1fVARB: procedure(target: TGLenum; v: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord1fVARB} - glMultiTexCoord1iARB: procedure(target: TGLenum; s: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord1iARB} - glMultiTexCoord1iVARB: procedure(target: TGLenum; v: PGLInt); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord1iVARB} - glMultiTexCoord1sARBP: procedure(target: TGLenum; s: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord1sARBP} - glMultiTexCoord1sVARB: procedure(target: TGLenum; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord1sVARB} - glMultiTexCoord2dARB: procedure(target: TGLenum; s, t: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord2dARB} - glMultiTexCoord2dvARB: procedure(target: TGLenum; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord2dvARB} - glMultiTexCoord2fARB: procedure(target: TGLenum; s, t: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord2fARB} - glMultiTexCoord2fvARB: procedure(target: TGLenum; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord2fvARB} - glMultiTexCoord2iARB: procedure(target: TGLenum; s, t: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord2iARB} - glMultiTexCoord2ivARB: procedure(target: TGLenum; v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord2ivARB} - glMultiTexCoord2sARB: procedure(target: TGLenum; s, t: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord2sARB} - glMultiTexCoord2svARB: procedure(target: TGLenum; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord2svARB} - glMultiTexCoord3dARB: procedure(target: TGLenum; s, t, r: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord3dARB} - glMultiTexCoord3dvARB: procedure(target: TGLenum; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord3dvARB} - glMultiTexCoord3fARB: procedure(target: TGLenum; s, t, r: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord3fARB} - glMultiTexCoord3fvARB: procedure(target: TGLenum; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord3fvARB} - glMultiTexCoord3iARB: procedure(target: TGLenum; s, t, r: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord3iARB} - glMultiTexCoord3ivARB: procedure(target: TGLenum; v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord3ivARB} - glMultiTexCoord3sARB: procedure(target: TGLenum; s, t, r: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord3sARB} - glMultiTexCoord3svARB: procedure(target: TGLenum; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord3svARB} - glMultiTexCoord4dARB: procedure(target: TGLenum; s, t, r, q: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord4dARB} - glMultiTexCoord4dvARB: procedure(target: TGLenum; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord4dvARB} - glMultiTexCoord4fARB: procedure(target: TGLenum; s, t, r, q: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord4fARB} - glMultiTexCoord4fvARB: procedure(target: TGLenum; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord4fvARB} - glMultiTexCoord4iARB: procedure(target: TGLenum; s, t, r, q: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord4iARB} - glMultiTexCoord4ivARB: procedure(target: TGLenum; v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord4ivARB} - glMultiTexCoord4sARB: procedure(target: TGLenum; s, t, r, q: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord4sARB} - glMultiTexCoord4svARB: procedure(target: TGLenum; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiTexCoord4svARB} - glActiveTextureARB: procedure(target: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glActiveTextureARB} - glClientActiveTextureARB: procedure(target: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glClientActiveTextureARB} - - // GLU extensions - gluNurbsCallbackDataEXT: procedure(nurb: PGLUnurbs; userData: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluNurbsCallbackDataEXT} - gluNewNurbsTessellatorEXT: function: PGLUnurbs; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluNewNurbsTessellatorEXT} - gluDeleteNurbsTessellatorEXT: procedure(nurb: PGLUnurbs); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM gluDeleteNurbsTessellatorEXT} - -{$ifndef FPC} - {$ifdef MULTITHREADOPENGL} - threadvar - {$else} - var - {$endif} -{$else} -var -{$endif} - // Extension functions - glAreTexturesResidentEXT: function(n: TGLsizei; textures: PGLuint; residences: PGLBoolean): TGLboolean; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glAreTexturesResidentEXT} - glArrayElementArrayEXT: procedure(mode: TGLEnum; count: TGLsizei; pi: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glArrayElementArrayEXT} - glBeginSceneEXT: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBeginSceneEXT} - glBindTextureEXT: procedure(target: TGLEnum; texture: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBindTextureEXT} - glColorTableEXT: procedure(target, internalFormat: TGLEnum; width: TGLsizei; format, atype: TGLEnum; data: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColorTableEXT} - glColorSubTableExt: procedure(target: TGLEnum; start, count: TGLsizei; format, atype: TGLEnum; data: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColorSubTableExt} - glCopyTexImage1DEXT: procedure(target: TGLEnum; level: TGLint; internalFormat: TGLEnum; x, y: TGLint; width: TGLsizei; border: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCopyTexImage1DEXT} - glCopyTexSubImage1DEXT: procedure(target: TGLEnum; level, xoffset, x, y: TGLint; width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCopyTexSubImage1DEXT} - glCopyTexImage2DEXT: procedure(target: TGLEnum; level: TGLint; internalFormat: TGLEnum; x, y: TGLint; width, height: TGLsizei; border: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCopyTexImage2DEXT} - glCopyTexSubImage2DEXT: procedure(target: TGLEnum; level, xoffset, yoffset, x, y: TGLint; width, height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCopyTexSubImage2DEXT} - glCopyTexSubImage3DEXT: procedure(target: TGLEnum; level, xoffset, yoffset, zoffset, x, y: TGLint; width, height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCopyTexSubImage3DEXT} - glDeleteTexturesEXT: procedure(n: TGLsizei; textures: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glDeleteTexturesEXT} - glEndSceneEXT: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glEndSceneEXT} - glGenTexturesEXT: procedure(n: TGLsizei; textures: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGenTexturesEXT} - glGetColorTableEXT: procedure(target, format, atype: TGLEnum; data: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetColorTableEXT} - glGetColorTablePameterfvEXT: procedure(target, pname: TGLEnum; params: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetColorTablePameterfvEXT} - glGetColorTablePameterivEXT: procedure(target, pname: TGLEnum; params: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetColorTablePameterivEXT} - glIndexFuncEXT: procedure(func: TGLEnum; ref: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIndexFuncEXT} - glIndexMaterialEXT: procedure(face: TGLEnum; mode: TGLEnum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIndexMaterialEXT} - glIsTextureEXT: function(texture: TGLuint): TGLboolean; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIsTextureEXT} - glLockArraysEXT: procedure(first: TGLint; count: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glLockArraysEXT} - glPolygonOffsetEXT: procedure(factor, bias: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPolygonOffsetEXT} - glPrioritizeTexturesEXT: procedure(n: TGLsizei; textures: PGLuint; priorities: PGLclampf); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPrioritizeTexturesEXT} - glTexSubImage1DEXT: procedure(target: TGLEnum; level, xoffset: TGLint; width: TGLsizei; format, Atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexSubImage1DEXT} - glTexSubImage2DEXT: procedure(target: TGLEnum; level, xoffset, yoffset: TGLint; width, height: TGLsizei; format, Atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexSubImage2DEXT} - glTexSubImage3DEXT: procedure(target: TGLEnum; level, xoffset, yoffset, zoffset: TGLint; width, height, depth: TGLsizei; format, Atype: TGLEnum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexSubImage3DEXT} - glUnlockArraysEXT: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glUnlockArraysEXT} - - // EXT_vertex_array - glArrayElementEXT: procedure(I: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glArrayElementEXT} - glColorPointerEXT: procedure(size: TGLInt; atype: TGLenum; stride, count: TGLsizei; data: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColorPointerEXT} - glDrawArraysEXT: procedure(mode: TGLenum; first: TGLInt; count: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glDrawArraysEXT} - glEdgeFlagPointerEXT: procedure(stride, count: TGLsizei; data: PGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glEdgeFlagPointerEXT} - glGetPointervEXT: procedure(pname: TGLEnum; var params); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetPointervEXT} - glIndexPointerEXT: procedure(AType: TGLEnum; stride, count: TGLsizei; P: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIndexPointerEXT} - glNormalPointerEXT: procedure(AType: TGLsizei; stride, count: TGLsizei; P: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glNormalPointerEXT} - glTexCoordPointerEXT: procedure(size: TGLint; AType: TGLenum; stride, count: TGLsizei; P: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoordPointerEXT} - glVertexPointerEXT: procedure(size: TGLint; AType: TGLenum; stride, count: TGLsizei; P: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexPointerEXT} - - // EXT_compiled_vertex_array - glLockArrayEXT: procedure(first: TGLint; count: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glLockArrayEXT} - glUnlockArrayEXT: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glUnlockArrayEXT} - - // EXT_cull_vertex - glCullParameterdvEXT: procedure(pname: TGLenum; params: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCullParameterdvEXT} - glCullParameterfvEXT: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCullParameterfvEXT} - - // WIN_swap_hint - glAddSwapHintRectWIN: procedure(x, y: TGLint; width, height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glAddSwapHintRectWIN} - - // EXT_point_parameter - glPointParameterfEXT: procedure(pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPointParameterfEXT} - glPointParameterfvEXT: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPointParameterfvEXT} - - // GL_ARB_transpose_matrix - glLoadTransposeMatrixfARB: procedure(m: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glLoadTransposeMatrixfARB} - glLoadTransposeMatrixdARB: procedure(m: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glLoadTransposeMatrixdARB} - glMultTransposeMatrixfARB: procedure(m: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultTransposeMatrixfARB} - glMultTransposeMatrixdARB: procedure(m: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultTransposeMatrixdARB} - - // GL_ARB_multisample - glSampleCoverageARB: procedure(Value: TGLclampf; invert: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSampleCoverageARB} - glSamplePassARB: procedure(pass: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSamplePassARB} - - // GL_ARB_texture_compression - glCompressedTexImage3DARB: procedure(target: TGLenum; level: TGLint; internalformat: TGLenum; Width, Height, depth: TGLsizei; border: TGLint; imageSize: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCompressedTexImage3DARB} - glCompressedTexImage2DARB: procedure(target: TGLenum; level: TGLint; internalformat: TGLenum; Width, Height: TGLsizei; border: TGLint; imageSize: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCompressedTexImage2DARB} - glCompressedTexImage1DARB: procedure(target: TGLenum; level: TGLint; internalformat: TGLenum; Width: TGLsizei; border: TGLint; imageSize: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCompressedTexImage1DARB} - glCompressedTexSubImage3DARB: procedure(target: TGLenum; level: TGLint; xoffset, yoffset, zoffset: TGLint; width, height, depth: TGLsizei; Format: TGLenum; imageSize: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCompressedTexSubImage3DARB} - glCompressedTexSubImage2DARB: procedure(target: TGLenum; level: TGLint; xoffset, yoffset: TGLint; width, height: TGLsizei; Format: TGLenum; imageSize: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCompressedTexSubImage2DARB} - glCompressedTexSubImage1DARB: procedure(target: TGLenum; level: TGLint; xoffset: TGLint; width: TGLsizei; Format: TGLenum; imageSize: TGLsizei; data: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCompressedTexSubImage1DARB} - glGetCompressedTexImageARB: procedure(target: TGLenum; level: TGLint; img: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetCompressedTexImageARB} - - // GL_EXT_blend_color - glBlendColorEXT: procedure(red, green, blue: TGLclampf; alpha: TGLclampf); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBlendColorEXT} - - // GL_EXT_texture3D - glTexImage3DEXT: procedure(target: TGLenum; level: TGLint; internalformat: TGLenum; width, height, depth: TGLsizei; border: TGLint; Format, AType: TGLenum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexImage3DEXT} - - // GL_SGIS_texture_filter4 - glGetTexFilterFuncSGIS: procedure(target, Filter: TGLenum; weights: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetTexFilterFuncSGIS} - glTexFilterFuncSGIS: procedure(target, Filter: TGLenum; n: TGLsizei; weights: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexFilterFuncSGIS} - - // GL_EXT_histogram - glGetHistogramEXT: procedure(target: TGLenum; reset: TGLboolean; Format, AType: TGLenum; values: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetHistogramEXT} - glGetHistogramParameterfvEXT: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetHistogramParameterfvEXT} - glGetHistogramParameterivEXT: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetHistogramParameterivEXT} - glGetMinmaxEXT: procedure(target: TGLenum; reset: TGLboolean; Format, AType: TGLenum; values: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetMinmaxEXT} - glGetMinmaxParameterfvEXT: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetMinmaxParameterfvEXT} - glGetMinmaxParameterivEXT: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetMinmaxParameterivEXT} - glHistogramEXT: procedure(target: TGLenum; Width: TGLsizei; internalformat: TGLenum; sink: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glHistogramEXT} - glMinmaxEXT: procedure(target, internalformat: TGLenum; sink: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMinmaxEXT} - glResetHistogramEXT: procedure(target: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glResetHistogramEXT} - glResetMinmaxEXT: procedure(target: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glResetMinmaxEXT} - - // GL_EXT_convolution - glConvolutionFilter1DEXT: procedure(target, internalformat: TGLenum; Width: TGLsizei; Format, AType: TGLenum; image: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glConvolutionFilter1DEXT} - glConvolutionFilter2DEXT: procedure(target, internalformat: TGLenum; Width, Height: TGLsizei; Format, AType: TGLenum; image: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glConvolutionFilter2DEXT} - glConvolutionParameterfEXT: procedure(target, pname: TGLenum; params: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glConvolutionParameterfEXT} - glConvolutionParameterfvEXT: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glConvolutionParameterfvEXT} - glConvolutionParameteriEXT: procedure(target, pname: TGLenum; params: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glConvolutionParameteriEXT} - glConvolutionParameterivEXT: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glConvolutionParameterivEXT} - glCopyConvolutionFilter1DEXT: procedure(target, internalformat: TGLenum; x, y: TGLint; Width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCopyConvolutionFilter1DEXT} - glCopyConvolutionFilter2DEXT: procedure(target, internalformat: TGLenum; x, y: TGLint; Width, Height: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCopyConvolutionFilter2DEXT} - glGetConvolutionFilterEXT: procedure(target, Format, AType: TGLenum; image: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetConvolutionFilterEXT} - glGetConvolutionParameterfvEXT: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetConvolutionParameterfvEXT} - glGetConvolutionParameterivEXT: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetConvolutionParameterivEXT} - glGetSeparableFilterEXT: procedure(target, Format, AType: TGLenum; row, column, span: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetSeparableFilterEXT} - glSeparableFilter2DEXT: procedure(target, internalformat: TGLenum; Width, Height: TGLsizei; Format, AType: TGLenum; row, column: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSeparableFilter2DEXT} - - // GL_SGI_color_table - glColorTableSGI: procedure(target, internalformat: TGLenum; Width: TGLsizei; Format, AType: TGLenum; Table: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColorTableSGI} - glColorTableParameterfvSGI: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColorTableParameterfvSGI} - glColorTableParameterivSGI: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColorTableParameterivSGI} - glCopyColorTableSGI: procedure(target, internalformat: TGLenum; x, y: TGLint; Width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCopyColorTableSGI} - glGetColorTableSGI: procedure(target, Format, AType: TGLenum; Table: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetColorTableSGI} - glGetColorTableParameterfvSGI: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetColorTableParameterfvSGI} - glGetColorTableParameterivSGI: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetColorTableParameterivSGI} - - // GL_SGIX_pixel_texture - glPixelTexGenSGIX: procedure(mode: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPixelTexGenSGIX} - - // GL_SGIS_pixel_texture - glPixelTexGenParameteriSGIS: procedure(pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPixelTexGenParameteriSGIS} - glPixelTexGenParameterivSGIS: procedure(pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPixelTexGenParameterivSGIS} - glPixelTexGenParameterfSGIS: procedure(pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPixelTexGenParameterfSGIS} - glPixelTexGenParameterfvSGIS: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPixelTexGenParameterfvSGIS} - glGetPixelTexGenParameterivSGIS: procedure(pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetPixelTexGenParameterivSGIS} - glGetPixelTexGenParameterfvSGIS: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetPixelTexGenParameterfvSGIS} - - // GL_SGIS_texture4D - glTexImage4DSGIS: procedure(target: TGLenum; level: TGLint; internalformat: TGLenum; Width, Height, depth, size4d: TGLsizei; border: TGLint; Format, AType: TGLenum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexImage4DSGIS} - glTexSubImage4DSGIS: procedure(target: TGLenum; level, xoffset, yoffset, zoffset, woffset: TGLint; Width, Height, depth, size4d: TGLsizei; Format, AType: TGLenum; pixels: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexSubImage4DSGIS} - - // GL_SGIS_detail_texture - glDetailTexFuncSGIS: procedure(target: TGLenum; n: TGLsizei; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glDetailTexFuncSGIS} - glGetDetailTexFuncSGIS: procedure(target: TGLenum; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetDetailTexFuncSGIS} - - // GL_SGIS_sharpen_texture - glSharpenTexFuncSGIS: procedure(target: TGLenum; n: TGLsizei; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSharpenTexFuncSGIS} - glGetSharpenTexFuncSGIS: procedure(target: TGLenum; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetSharpenTexFuncSGIS} - - // GL_SGIS_multisample - glSampleMaskSGIS: procedure(Value: TGLclampf; invert: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSampleMaskSGIS} - glSamplePatternSGIS: procedure(pattern: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSamplePatternSGIS} - - // GL_EXT_blend_minmax - glBlendEquationEXT: procedure(mode: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBlendEquationEXT} - - // GL_SGIX_sprite - glSpriteParameterfSGIX: procedure(pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSpriteParameterfSGIX} - glSpriteParameterfvSGIX: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSpriteParameterfvSGIX} - glSpriteParameteriSGIX: procedure(pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSpriteParameteriSGIX} - glSpriteParameterivSGIX: procedure(pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSpriteParameterivSGIX} - - // GL_EXT_point_parameters - glPointParameterfSGIS: procedure(pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPointParameterfSGIS} - glPointParameterfvSGIS: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPointParameterfvSGIS} - - // GL_SGIX_instruments - glGetInstrumentsSGIX: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetInstrumentsSGIX} - glInstrumentsBufferSGIX: procedure(Size: TGLsizei; buffer: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glInstrumentsBufferSGIX} - glPollInstrumentsSGIX: procedure(marker_p: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPollInstrumentsSGIX} - glReadInstrumentsSGIX: procedure(marker: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReadInstrumentsSGIX} - glStartInstrumentsSGIX: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glStartInstrumentsSGIX} - glStopInstrumentsSGIX: procedure(marker: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glStopInstrumentsSGIX} - - // GL_SGIX_framezoom - glFrameZoomSGIX: procedure(factor: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFrameZoomSGIX} - - // GL_SGIX_tag_sample_buffer - glTagSampleBufferSGIX: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTagSampleBufferSGIX} - - // GL_SGIX_polynomial_ffd - glDeformationMap3dSGIX: procedure(target: TGLenum; u1, u2: TGLdouble; ustride, uorder: TGLint; v1, v2: TGLdouble; vstride, vorder: TGLint; w1, w2: TGLdouble; wstride, worder: TGLint; points: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glDeformationMap3dSGIX} - glDeformationMap3fSGIX: procedure(target: TGLenum; u1, u2: TGLfloat; ustride, uorder: TGLint; v1, v2: TGLfloat; vstride, vorder: TGLint; w1, w2: TGLfloat; wstride, worder: TGLint; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glDeformationMap3fSGIX} - glDeformSGIX: procedure(mask: TGLbitfield); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glDeformSGIX} - glLoadIdentityDeformationMapSGIX: procedure(mask: TGLbitfield); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glLoadIdentityDeformationMapSGIX} - - // GL_SGIX_reference_plane - glReferencePlaneSGIX: procedure(equation: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReferencePlaneSGIX} - - // GL_SGIX_flush_raster - glFlushRasterSGIX: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFlushRasterSGIX} - - // GL_SGIS_fog_function - glFogFuncSGIS: procedure(n: TGLsizei; points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFogFuncSGIS} - glGetFogFuncSGIS: procedure(points: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetFogFuncSGIS} - - // GL_HP_image_transform - glImageTransformParameteriHP: procedure(target, pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glImageTransformParameteriHP} - glImageTransformParameterfHP: procedure(target, pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glImageTransformParameterfHP} - glImageTransformParameterivHP: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glImageTransformParameterivHP} - glImageTransformParameterfvHP: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glImageTransformParameterfvHP} - glGetImageTransformParameterivHP: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetImageTransformParameterivHP} - glGetImageTransformParameterfvHP: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetImageTransformParameterfvHP} - - // GL_EXT_color_subtable - glCopyColorSubTableEXT: procedure(target: TGLenum; start: TGLsizei; x, y: TGLint; Width: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCopyColorSubTableEXT} - - // GL_PGI_misc_hints - glHintPGI: procedure(target: TGLenum; mode: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glHintPGI} - - // GL_EXT_paletted_texture - glGetColorTableParameterivEXT: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetColorTableParameterivEXT} - glGetColorTableParameterfvEXT: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetColorTableParameterfvEXT} - - // GL_SGIX_list_priority - glGetListParameterfvSGIX: procedure(list: TGLuint; pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetListParameterfvSGIX} - glGetListParameterivSGIX: procedure(list: TGLuint; pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetListParameterivSGIX} - glListParameterfSGIX: procedure(list: TGLuint; pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glListParameterfSGIX} - glListParameterfvSGIX: procedure(list: TGLuint; pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glListParameterfvSGIX} - glListParameteriSGIX: procedure(list: TGLuint; pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glListParameteriSGIX} - glListParameterivSGIX: procedure(list: TGLuint; pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glListParameterivSGIX} - - // GL_SGIX_fragment_lighting - glFragmentColorMaterialSGIX: procedure(face, mode: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFragmentColorMaterialSGIX} - glFragmentLightfSGIX: procedure(light, pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFragmentLightfSGIX} - glFragmentLightfvSGIX: procedure(light, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFragmentLightfvSGIX} - glFragmentLightiSGIX: procedure(light, pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFragmentLightiSGIX} - glFragmentLightivSGIX: procedure(light, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFragmentLightivSGIX} - glFragmentLightModelfSGIX: procedure(pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFragmentLightModelfSGIX} - glFragmentLightModelfvSGIX: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFragmentLightModelfvSGIX} - glFragmentLightModeliSGIX: procedure(pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFragmentLightModeliSGIX} - glFragmentLightModelivSGIX: procedure(pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFragmentLightModelivSGIX} - glFragmentMaterialfSGIX: procedure(face, pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFragmentMaterialfSGIX} - glFragmentMaterialfvSGIX: procedure(face, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFragmentMaterialfvSGIX} - glFragmentMaterialiSGIX: procedure(face, pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFragmentMaterialiSGIX} - glFragmentMaterialivSGIX: procedure(face, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFragmentMaterialivSGIX} - glGetFragmentLightfvSGIX: procedure(light, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetFragmentLightfvSGIX} - glGetFragmentLightivSGIX: procedure(light, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetFragmentLightivSGIX} - glGetFragmentMaterialfvSGIX: procedure(face, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetFragmentMaterialfvSGIX} - glGetFragmentMaterialivSGIX: procedure(face, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetFragmentMaterialivSGIX} - glLightEnviSGIX: procedure(pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glLightEnviSGIX} - - // GL_EXT_draw_range_elements - glDrawRangeElementsEXT: procedure(mode: TGLenum; start, Aend: TGLuint; Count: TGLsizei; Atype: TGLenum; indices: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glDrawRangeElementsEXT} - - // GL_EXT_light_texture - glApplyTextureEXT: procedure(mode: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glApplyTextureEXT} - glTextureLightEXT: procedure(pname: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTextureLightEXT} - glTextureMaterialEXT: procedure(face, mode: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTextureMaterialEXT} - - // GL_SGIX_async - glAsyncMarkerSGIX: procedure(marker: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glAsyncMarkerSGIX} - glFinishAsyncSGIX: procedure(markerp: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFinishAsyncSGIX} - glPollAsyncSGIX: procedure(markerp: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPollAsyncSGIX} - glGenAsyncMarkersSGIX: procedure(range: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGenAsyncMarkersSGIX} - glDeleteAsyncMarkersSGIX: procedure(marker: TGLuint; range: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glDeleteAsyncMarkersSGIX} - glIsAsyncMarkerSGIX: procedure(marker: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIsAsyncMarkerSGIX} - - // GL_INTEL_parallel_arrays - glVertexPointervINTEL: procedure(size: TGLint; Atype: TGLenum; var P); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexPointervINTEL} - glNormalPointervINTEL: procedure(Atype: TGLenum; var P); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glNormalPointervINTEL} - glColorPointervINTEL: procedure(size: TGLint; Atype: TGLenum; var P); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColorPointervINTEL} - glTexCoordPointervINTEL: procedure(size: TGLint; Atype: TGLenum; var P); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoordPointervINTEL} - - // GL_EXT_pixel_transform - glPixelTransformParameteriEXT: procedure(target, pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPixelTransformParameteriEXT} - glPixelTransformParameterfEXT: procedure(target, pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPixelTransformParameterfEXT} - glPixelTransformParameterivEXT: procedure(target, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPixelTransformParameterivEXT} - glPixelTransformParameterfvEXT: procedure(target, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glPixelTransformParameterfvEXT} - - // GL_EXT_secondary_color - glSecondaryColor3bEXT: procedure(red, green, blue: TGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSecondaryColor3bEXT} - glSecondaryColor3bvEXT: procedure(v: PGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSecondaryColor3bvEXT} - glSecondaryColor3dEXT: procedure(red, green, blue: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSecondaryColor3dEXT} - glSecondaryColor3dvEXT: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSecondaryColor3dvEXT} - glSecondaryColor3fEXT: procedure(red, green, blue: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSecondaryColor3fEXT} - glSecondaryColor3fvEXT: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSecondaryColor3fvEXT} - glSecondaryColor3iEXT: procedure(red, green, blue: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSecondaryColor3iEXT} - glSecondaryColor3ivEXT: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSecondaryColor3ivEXT} - - glSecondaryColor3sEXT: procedure(red, green, blue: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSecondaryColor3sEXT} - glSecondaryColor3svEXT: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSecondaryColor3svEXT} - glSecondaryColor3ubEXT: procedure(red, green, blue: TGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSecondaryColor3ubEXT} - glSecondaryColor3ubvEXT: procedure(v: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSecondaryColor3ubvEXT} - glSecondaryColor3uiEXT: procedure(red, green, blue: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSecondaryColor3uiEXT} - glSecondaryColor3uivEXT: procedure(v: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSecondaryColor3uivEXT} - glSecondaryColor3usEXT: procedure(red, green, blue: TGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSecondaryColor3usEXT} - glSecondaryColor3usvEXT: procedure(v: PGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSecondaryColor3usvEXT} - glSecondaryColorPointerEXT: procedure(Size: TGLint; Atype: TGLenum; stride: TGLsizei; p: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSecondaryColorPointerEXT} - - // GL_EXT_texture_perturb_normal - glTextureNormalEXT: procedure(mode: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTextureNormalEXT} - - // GL_EXT_multi_draw_arrays - glMultiDrawArraysEXT: procedure(mode: TGLenum; First: PGLint; Count: PGLsizei; primcount: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiDrawArraysEXT} - glMultiDrawElementsEXT: procedure(mode: TGLenum; Count: PGLsizei; AType: TGLenum; var indices; primcount: TGLsizei); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiDrawElementsEXT} - - // GL_EXT_fog_coord - glFogCoordfEXT: procedure(coord: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFogCoordfEXT} - glFogCoordfvEXT: procedure(coord: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFogCoordfvEXT} - glFogCoorddEXT: procedure(coord: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFogCoorddEXT} - glFogCoorddvEXT: procedure(coord: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFogCoorddvEXT} - glFogCoordPointerEXT: procedure(AType: TGLenum; stride: TGLsizei; p: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFogCoordPointerEXT} - - // GL_EXT_coordinate_frame - glTangent3bEXT: procedure(tx, ty, tz: TGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTangent3bEXT} - glTangent3bvEXT: procedure(v: PGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTangent3bvEXT} - glTangent3dEXT: procedure(tx, ty, tz: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTangent3dEXT} - glTangent3dvEXT: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTangent3dvEXT} - glTangent3fEXT: procedure(tx, ty, tz: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTangent3fEXT} - glTangent3fvEXT: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTangent3fvEXT} - glTangent3iEXT: procedure(tx, ty, tz: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTangent3iEXT} - glTangent3ivEXT: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTangent3ivEXT} - glTangent3sEXT: procedure(tx, ty, tz: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTangent3sEXT} - glTangent3svEXT: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTangent3svEXT} - - glBinormal3bEXT: procedure(bx, by, bz: TGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBinormal3bEXT} - glBinormal3bvEXT: procedure(v: PGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBinormal3bvEXT} - glBinormal3dEXT: procedure(bx, by, bz: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBinormal3dEXT} - glBinormal3dvEXT: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBinormal3dvEXT} - glBinormal3fEXT: procedure(bx, by, bz: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBinormal3fEXT} - glBinormal3fvEXT: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBinormal3fvEXT} - glBinormal3iEXT: procedure(bx, by, bz: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBinormal3iEXT} - glBinormal3ivEXT: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBinormal3ivEXT} - glBinormal3sEXT: procedure(bx, by, bz: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBinormal3sEXT} - glBinormal3svEXT: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBinormal3svEXT} - glTangentPointerEXT: procedure(Atype: TGLenum; stride: TGLsizei; p: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTangentPointerEXT} - glBinormalPointerEXT: procedure(Atype: TGLenum; stride: TGLsizei; p: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBinormalPointerEXT} - - // GL_SUNX_constant_data - glFinishTextureSUNX: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFinishTextureSUNX} - - // GL_SUN_global_alpha - glGlobalAlphaFactorbSUN: procedure(factor: TGLbyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGlobalAlphaFactorbSUN} - glGlobalAlphaFactorsSUN: procedure(factor: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGlobalAlphaFactorsSUN} - glGlobalAlphaFactoriSUN: procedure(factor: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGlobalAlphaFactoriSUN} - glGlobalAlphaFactorfSUN: procedure(factor: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGlobalAlphaFactorfSUN} - glGlobalAlphaFactordSUN: procedure(factor: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGlobalAlphaFactordSUN} - glGlobalAlphaFactorubSUN: procedure(factor: TGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGlobalAlphaFactorubSUN} - glGlobalAlphaFactorusSUN: procedure(factor: TGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGlobalAlphaFactorusSUN} - glGlobalAlphaFactoruiSUN: procedure(factor: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGlobalAlphaFactoruiSUN} - - // GL_SUN_triangle_list - glReplacementCodeuiSUN: procedure(code: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodeuiSUN} - glReplacementCodeusSUN: procedure(code: TGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodeusSUN} - glReplacementCodeubSUN: procedure(code: TGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodeubSUN} - glReplacementCodeuivSUN: procedure(code: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodeuivSUN} - glReplacementCodeusvSUN: procedure(code: PGLushort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodeusvSUN} - glReplacementCodeubvSUN: procedure(code: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodeubvSUN} - glReplacementCodePointerSUN: procedure(Atype: TGLenum; stride: TGLsizei; var p); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodePointerSUN} - - // GL_SUN_vertex - glColor4ubVertex2fSUN: procedure(r, g, b, a: TGLubyte; x, y: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor4ubVertex2fSUN} - glColor4ubVertex2fvSUN: procedure(c: PGLubyte; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor4ubVertex2fvSUN} - glColor4ubVertex3fSUN: procedure(r, g, b, a: TGLubyte; x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor4ubVertex3fSUN} - glColor4ubVertex3fvSUN: procedure(c: PGLubyte; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor4ubVertex3fvSUN} - glColor3fVertex3fSUN: procedure(r, g, b, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor3fVertex3fSUN} - glColor3fVertex3fvSUN: procedure(c, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor3fVertex3fvSUN} - glNormal3fVertex3fSUN: procedure(nx, ny, nz: TGLfloat; x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glNormal3fVertex3fSUN} - glNormal3fVertex3fvSUN: procedure(n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glNormal3fVertex3fvSUN} - glColor4fNormal3fVertex3fSUN: procedure(r, g, b, a, nx, ny, nz, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor4fNormal3fVertex3fSUN} - glColor4fNormal3fVertex3fvSUN: procedure(c, n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColor4fNormal3fVertex3fvSUN} - glTexCoord2fVertex3fSUN: procedure(s, t, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord2fVertex3fSUN} - glTexCoord2fVertex3fvSUN: procedure(tc, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord2fVertex3fvSUN} - glTexCoord4fVertex4fSUN: procedure(s, t, p, q, x, y, z, w: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord4fVertex4fSUN} - glTexCoord4fVertex4fvSUN: procedure(tc, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord4fVertex4fvSUN} - glTexCoord2fColor4ubVertex3fSUN: procedure(s, t, r, g, b, a, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord2fColor4ubVertex3fSUN} - glTexCoord2fColor4ubVertex3fvSUN: procedure(tc: PGLfloat; c: PGLubyte; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord2fColor4ubVertex3fvSUN} - glTexCoord2fColor3fVertex3fSUN: procedure(s, t, r, g, b, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord2fColor3fVertex3fSUN} - glTexCoord2fColor3fVertex3fvSUN: procedure(tc, c, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord2fColor3fVertex3fvSUN} - glTexCoord2fNormal3fVertex3fSUN: procedure(s, t, nx, ny, nz, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord2fNormal3fVertex3fSUN} - glTexCoord2fNormal3fVertex3fvSUN: procedure(tc, n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord2fNormal3fVertex3fvSUN} - glTexCoord2fColor4fNormal3fVertex3fSUN: procedure(s, t, r, g, b, a, nx, ny, nz, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord2fColor4fNormal3fVertex3fSUN} - glTexCoord2fColor4fNormal3fVertex3fvSUN: procedure(tc, c, n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord2fColor4fNormal3fVertex3fvSUN} - glTexCoord4fColor4fNormal3fVertex4fSUN: procedure(s, t, p, q, r, g, b, a, nx, ny, nz, x, y, z, w: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord4fColor4fNormal3fVertex4fSUN} - glTexCoord4fColor4fNormal3fVertex4fvSUN: procedure(tc, c, n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoord4fColor4fNormal3fVertex4fvSUN} - glReplacementCodeuiVertex3fSUN: procedure(rc: TGLenum; x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodeuiVertex3fSUN} - glReplacementCodeuiVertex3fvSUN: procedure(rc: PGLenum; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodeuiVertex3fvSUN} - glReplacementCodeuiColor4ubVertex3fSUN: procedure(rc: TGLenum; r, g, b, a: TGLubyte; x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodeuiColor4ubVertex3fSUN} - glReplacementCodeuiColor4ubVertex3fvSUN: procedure(rc: PGLenum; c: PGLubyte; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodeuiColor4ubVertex3fvSUN} - glReplacementCodeuiColor3fVertex3fSUN: procedure(rc: TGLenum; r, g, b, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodeuiColor3fVertex3fSUN} - glReplacementCodeuiColor3fVertex3fvSUN: procedure(rc: PGLenum; c, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodeuiColor3fVertex3fvSUN} - glReplacementCodeuiNormal3fVertex3fSUN: procedure(rc: TGLenum; nx, ny, nz, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodeuiNormal3fVertex3fSUN} - glReplacementCodeuiNormal3fVertex3fvSUN: procedure(rc: PGLenum; n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodeuiNormal3fVertex3fvSUN} - glReplacementCodeuiColor4fNormal3fVertex3fSUN: procedure(rc: TGLenum; r, g, b, a, nx, ny, nz, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodeuiColor4fNormal3fVertex3fSUN} - glReplacementCodeuiColor4fNormal3fVertex3fvSUN: procedure(rc: PGLenum; c, n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodeuiColor4fNormal3fVertex3fvSUN} - glReplacementCodeuiTexCoord2fVertex3fSUN: procedure(rc: TGLenum; s, t, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodeuiTexCoord2fVertex3fSUN} - glReplacementCodeuiTexCoord2fVertex3fvSUN: procedure(rc: PGLenum; tc, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodeuiTexCoord2fVertex3fvSUN} - glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN: procedure(rc: TGLenum; s, t, nx, ny, nz, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN} - glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN: procedure(rc: PGLenum; tc, n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN} - glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN: procedure(rc: TGLenum; s, t, r, g, b, a, nx, ny, nz, x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN} - glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN: procedure(rc: PGLenum; tc, c, n, v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN} - - // GL_EXT_blend_func_separate - glBlendFuncSeparateEXT: procedure(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBlendFuncSeparateEXT} - - // GL_EXT_vertex_weighting - glVertexWeightfEXT: procedure(weight: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexWeightfEXT} - glVertexWeightfvEXT: procedure(weight: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexWeightfvEXT} - glVertexWeightPointerEXT: procedure(Size: TGLsizei; Atype: TGLenum; stride: TGLsizei; p: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexWeightPointerEXT} - - // GL_NV_vertex_array_range - glFlushVertexArrayRangeNV: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFlushVertexArrayRangeNV} - glVertexArrayRangeNV: procedure(Size: TGLsizei; p: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexArrayRangeNV} - wglAllocateMemoryNV: function(size: TGLsizei; readFrequency, writeFrequency, priority: Single): Pointer; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM wglAllocateMemoryNV} - wglFreeMemoryNV: procedure(ptr: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM wglFreeMemoryNV} - - // GL_NV_register_combiners - glCombinerParameterfvNV: procedure(pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCombinerParameterfvNV} - glCombinerParameterfNV: procedure(pname: TGLenum; param: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCombinerParameterfNV} - glCombinerParameterivNV: procedure(pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCombinerParameterivNV} - glCombinerParameteriNV: procedure(pname: TGLenum; param: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCombinerParameteriNV} - glCombinerInputNV: procedure(stage, portion, variable, input, mapping, componentUsage: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCombinerInputNV} - glCombinerOutputNV: procedure(stage, portion, abOutput, cdOutput, sumOutput, scale, bias: TGLenum; abDotProduct, cdDotProduct, muxSum: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glCombinerOutputNV} - glFinalCombinerInputNV: procedure(variable, input, mapping, componentUsage: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFinalCombinerInputNV} - glGetCombinerInputParameterfvNV: procedure(stage, portion, variable, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetCombinerInputParameterfvNV} - glGetCombinerInputParameterivNV: procedure(stage, portion, variable, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetCombinerInputParameterivNV} - glGetCombinerOutputParameterfvNV: procedure(stage, portion, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetCombinerOutputParameterfvNV} - glGetCombinerOutputParameterivNV: procedure(stage, portion, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetCombinerOutputParameterivNV} - glGetFinalCombinerInputParameterfvNV: procedure(variable, pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetFinalCombinerInputParameterfvNV} - glGetFinalCombinerInputParameterivNV: procedure(variable, pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetFinalCombinerInputParameterivNV} - - // GL_MESA_resize_buffers - glResizeBuffersMESA: procedure; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glResizeBuffersMESA} - - // GL_MESA_window_pos - glWindowPos2dMESA: procedure(x, y: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos2dMESA} - glWindowPos2dvMESA: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos2dvMESA} - glWindowPos2fMESA: procedure(x, y: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos2fMESA} - glWindowPos2fvMESA: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos2fvMESA} - glWindowPos2iMESA: procedure(x, y: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos2iMESA} - glWindowPos2ivMESA: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos2ivMESA} - glWindowPos2sMESA: procedure(x, y: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos2sMESA} - glWindowPos2svMESA: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos2svMESA} - glWindowPos3dMESA: procedure(x, y, z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos3dMESA} - glWindowPos3dvMESA: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos3dvMESA} - glWindowPos3fMESA: procedure(x, y, z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos3fMESA} - glWindowPos3fvMESA: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos3fvMESA} - glWindowPos3iMESA: procedure(x, y, z: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos3iMESA} - glWindowPos3ivMESA: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos3ivMESA} - glWindowPos3sMESA: procedure(x, y, z: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos3sMESA} - glWindowPos3svMESA: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos3svMESA} - glWindowPos4dMESA: procedure(x, y, z, w: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos4dMESA} - glWindowPos4dvMESA: procedure(v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos4dvMESA} - glWindowPos4fMESA: procedure(x, y, z, w: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos4fMESA} - glWindowPos4fvMESA: procedure(v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos4fvMESA} - glWindowPos4iMESA: procedure(x, y, z, w: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos4iMESA} - glWindowPos4ivMESA: procedure(v: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos4ivMESA} - glWindowPos4sMESA: procedure(x, y, z, w: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos4sMESA} - glWindowPos4svMESA: procedure(v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glWindowPos4svMESA} - - // GL_IBM_multimode_draw_arrays - glMultiModeDrawArraysIBM: procedure(mode: TGLenum; First: PGLint; Count: PGLsizei; primcount: TGLsizei; modestride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiModeDrawArraysIBM} - glMultiModeDrawElementsIBM: procedure(mode: PGLenum; Count: PGLsizei; Atype: TGLenum; var indices; primcount: TGLsizei; modestride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glMultiModeDrawElementsIBM} - - // GL_IBM_vertex_array_lists - glColorPointerListIBM: procedure(Size: TGLint; Atype: TGLenum; stride: TGLint; var p; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glColorPointerListIBM} - glSecondaryColorPointerListIBM: procedure(Size: TGLint; Atype: TGLenum; stride: TGLint; var p; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSecondaryColorPointerListIBM} - glEdgeFlagPointerListIBM: procedure(stride: TGLint; var p: PGLboolean; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glEdgeFlagPointerListIBM} - glFogCoordPointerListIBM: procedure(Atype: TGLenum; stride: TGLint; var p; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glFogCoordPointerListIBM} - glIndexPointerListIBM: procedure(Atype: TGLenum; stride: TGLint; var p; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIndexPointerListIBM} - glNormalPointerListIBM: procedure(Atype: TGLenum; stride: TGLint; var p; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glNormalPointerListIBM} - glTexCoordPointerListIBM: procedure(Size: TGLint; Atype: TGLenum; stride: TGLint; var p; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTexCoordPointerListIBM} - glVertexPointerListIBM: procedure(Size: TGLint; Atype: TGLenum; stride: TGLint; var p; ptrstride: TGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexPointerListIBM} - - // GL_3DFX_tbuffer - glTbufferMask3DFX: procedure(mask: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTbufferMask3DFX} - - // GL_EXT_multisample - glSampleMaskEXT: procedure(Value: TGLclampf; invert: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSampleMaskEXT} - glSamplePatternEXT: procedure(pattern: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glSamplePatternEXT} - - // GL_SGIS_texture_color_mask - glTextureColorMaskSGIS: procedure(red, green, blue, alpha: TGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTextureColorMaskSGIS} - - // GL_SGIX_igloo_interface - glIglooInterfaceSGIX: procedure(pname: TGLenum; params: pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIglooInterfaceSGIX} - - // GL_NV_vertex_program - glAreProgramsResidentNV: procedure(n: TGLSizei; programs: PGLuint; residences: PGLboolean); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glAreProgramsResidentNV} - glBindProgramNV: procedure(target: TGLenum; id: TGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glBindProgramNV} - glDeleteProgramsNV: procedure(n: TGLSizei; programs: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glDeleteProgramsNV} - glExecuteProgramNV: procedure(target: TGLenum; id: TGLuint; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glExecuteProgramNV} - glGenProgramsNV: procedure(n: TGLSizei; programs: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGenProgramsNV} - glGetProgramParameterdvNV: procedure (target: TGLenum; index: TGLuint; pname: TGLenum; params: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetProgramParameterdvNV} - glGetProgramParameterfvNV: procedure (target: TGLenum; index: TGLuint; pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetProgramParameterfvNV} - glGetProgramivNV: procedure (id: TGLuint; pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetProgramivNV} - glGetProgramStringNV: procedure (id: TGLuint; pname: TGLenum; programIdx: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetProgramStringNV} - glGetTrackMatrixivNV: procedure (target: TGLenum; address: TGLuint; pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetTrackMatrixivNV} - glGetVertexAttribdvNV: procedure (index: TGLuint; pname: TGLenum; params: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetVertexAttribdvNV} - glGetVertexAttribfvNV: procedure (index: TGLuint; pname: TGLenum; params: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetVertexAttribfvNV} - glGetVertexAttribivNV: procedure (index: TGLuint; pname: TGLenum; params: PGLint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetVertexAttribivNV} - glGetVertexAttribPointervNV: procedure (index: TGLuint; pname: TGLenum; pointer: PPointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glGetVertexAttribPointervNV} - glIsProgramNV: function (id: TGLuint): TGLboolean; {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glIsProgramNV} - glLoadProgramNV: procedure (target: TGLenum; id: TGLuint; len: TGLSizei; programIdx: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glLoadProgramNV} - glProgramParameter4dNV: procedure (target: TGLenum; index: TGLuint; x, y, z, w: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glProgramParameter4dNV} - glProgramParameter4dvNV: procedure (target: TGLenum; index: TGLuint; v: PGLdouble ); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glProgramParameter4dvNV} - glProgramParameter4fNV: procedure (target: TGLenum; index: TGLuint; x, y, z, w: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glProgramParameter4fNV} - glProgramParameter4fvNV: procedure (target: TGLenum; index: TGLuint; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glProgramParameter4fvNV} - glProgramParameters4dvNV: procedure (target: TGLenum; index: TGLuint; count: TGLSizei; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glProgramParameters4dvNV} - glProgramParameters4fvNV: procedure (target: TGLenum; index: TGLuint; count: TGLSizei; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glProgramParameters4fvNV} - glRequestResidentProgramsNV: procedure (n: TGLSizei; programs: PGLuint); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glRequestResidentProgramsNV} - glTrackMatrixNV: procedure (target: TGLenum; address: TGLuint; matrix: TGLenum; transform: TGLenum); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glTrackMatrixNV} - glVertexAttribPointerNV: procedure (index: TGLuint; fsize: TGLint; vertextype: TGLenum; stride: TGLSizei; pointer: Pointer); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttribPointerNV} - glVertexAttrib1dNV: procedure (index: TGLuint; x: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib1dNV} - glVertexAttrib1dvNV: procedure (index: TGLuint; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib1dvNV} - glVertexAttrib1fNV: procedure (index: TGLuint; x: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib1fNV} - glVertexAttrib1fvNV: procedure (index: TGLuint; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib1fvNV} - glVertexAttrib1sNV: procedure (index: TGLuint; x: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib1sNV} - glVertexAttrib1svNV: procedure (index: TGLuint; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib1svNV} - glVertexAttrib2dNV: procedure (index: TGLuint; x: TGLdouble; y: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib2dNV} - glVertexAttrib2dvNV: procedure (index: TGLuint; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib2dvNV} - glVertexAttrib2fNV: procedure (index: TGLuint; x: TGLfloat; y: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib2fNV} - glVertexAttrib2fvNV: procedure (index: TGLuint; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib2fvNV} - glVertexAttrib2sNV: procedure (index: TGLuint; x: TGLshort; y: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib2sNV} - glVertexAttrib2svNV: procedure (index: TGLuint; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib2svNV} - glVertexAttrib3dNV: procedure (index: TGLuint; x: TGLdouble; y: TGLdouble; z: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib3dNV} - glVertexAttrib3dvNV: procedure (index: TGLuint; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib3dvNV} - glVertexAttrib3fNV: procedure (index: TGLuint; x: TGLfloat; y: TGLfloat; z: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib3fNV} - glVertexAttrib3fvNV: procedure (index: TGLuint; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib3fvNV} - glVertexAttrib3sNV: procedure (index: TGLuint; x: TGLshort; y: TGLshort; z: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib3sNV} - glVertexAttrib3svNV: procedure (index: TGLuint; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib3svNV} - glVertexAttrib4dNV: procedure (index: TGLuint; x: TGLdouble; y: TGLdouble; z: TGLdouble; w: TGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib4dNV} - glVertexAttrib4dvNV: procedure (index: TGLuint; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib4dvNV} - glVertexAttrib4fNV: procedure(index: TGLuint; x: TGLfloat; y: TGLfloat; z: TGLfloat; w: TGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib4fNV} - glVertexAttrib4fvNV: procedure(index: TGLuint; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib4fvNV} - glVertexAttrib4sNV: procedure (index: TGLuint; x: TGLshort; y: TGLshort; z: TGLdouble; w: TGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib4sNV} - glVertexAttrib4svNV: procedure (index: TGLuint; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib4svNV} - glVertexAttrib4ubvNV: procedure (index: TGLuint; v: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttrib4ubvNV} - glVertexAttribs1dvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttribs1dvNV} - glVertexAttribs1fvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttribs1fvNV} - glVertexAttribs1svNV: procedure (index: TGLuint; count: TGLSizei; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttribs1svNV} - glVertexAttribs2dvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttribs2dvNV} - glVertexAttribs2fvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttribs2fvNV} - glVertexAttribs2svNV: procedure (index: TGLuint; count: TGLSizei; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttribs2svNV} - glVertexAttribs3dvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttribs3dvNV} - glVertexAttribs3fvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttribs3fvNV} - glVertexAttribs3svNV: procedure (index: TGLuint; count: TGLSizei; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttribs3svNV} - glVertexAttribs4dvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLdouble); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttribs4dvNV} - glVertexAttribs4fvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLfloat); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttribs4fvNV} - glVertexAttribs4svNV: procedure (index: TGLuint; count: TGLSizei; v: PGLshort); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttribs4svNV} - glVertexAttribs4ubvNV: procedure (index: TGLuint; count: TGLSizei; v: PGLubyte); {$ifdef Win32} stdcall; {$endif} {$ifdef UNIX} cdecl; {$endif} - {$EXTERNALSYM glVertexAttribs4ubvNV} - -{$ifdef UNIX} -type - GLXContext = Pointer; - GLXPixmap = XID; - GLXDrawable = XID; - - // GLX 1.3 and later - GLXFBConfig = Pointer; - GLXFBConfigID = XID; - GLXContextID = XID; - GLXWindow = XID; - GLXPbuffer = XID; - -var - glXChooseVisual: function(dpy: PDisplay; screen: TGLint; attribList: PGLint): PXVisualInfo; cdecl; - {$EXTERNALSYM glXChooseVisual} - glXCreateContext: function(dpy: PDisplay; vis: PXVisualInfo; shareList: GLXContext; direct: TGLboolean): GLXContext; cdecl; - {$EXTERNALSYM glXCreateContext} - glXDestroyContext: procedure(dpy: PDisplay; ctx: GLXContext); cdecl; - {$EXTERNALSYM glXDestroyContext} - glXMakeCurrent: function(dpy: PDisplay; drawable: GLXDrawable; ctx: GLXContext): TGLboolean; cdecl; - {$EXTERNALSYM glXMakeCurrent} - glXCopyContext: procedure(dpy: PDisplay; src: GLXContext; dst: GLXContext; mask: TGLuint); cdecl; - {$EXTERNALSYM glXCopyContext} - glXSwapBuffers: procedure(dpy: PDisplay; drawable: GLXDrawable); cdecl; - {$EXTERNALSYM glXSwapBuffers} - glXCreateGLXPixmap: function(dpy: PDisplay; visual: PXVisualInfo; pixmap: Pixmap): GLXPixmap; cdecl; - {$EXTERNALSYM glXCreateGLXPixmap} - glXDestroyGLXPixmap: procedure(dpy: PDisplay; pixmap: GLXPixmap); cdecl; - {$EXTERNALSYM glXDestroyGLXPixmap} - glXQueryExtension: function(dpy: PDisplay; errorb: PGLInt; event: PGLInt): TGLboolean; cdecl; - {$EXTERNALSYM glXQueryExtension} - glXQueryVersion: function(dpy: PDisplay; maj: PGLInt; min: PGLINT): TGLboolean; cdecl; - {$EXTERNALSYM glXQueryVersion} - glXIsDirect: function(dpy: PDisplay; ctx: GLXContext): TGLboolean; cdecl; - {$EXTERNALSYM glXIsDirect} - glXGetConfig: function(dpy: PDisplay; visual: PXVisualInfo; attrib: TGLInt; value: PGLInt): TGLInt; cdecl; - {$EXTERNALSYM glXGetConfig} - glXGetCurrentContext: function: GLXContext; cdecl; - {$EXTERNALSYM glXGetCurrentContext} - glXGetCurrentDrawable: function: GLXDrawable; cdecl; - {$EXTERNALSYM glXGetCurrentDrawable} - glXWaitGL: procedure; cdecl; - {$EXTERNALSYM glXWaitGL} - glXWaitX: procedure; cdecl; - {$EXTERNALSYM glXWaitX} - glXUseXFont: procedure(font: Font; first: TGLInt; count: TGLInt; list: TGLint); cdecl; - {$EXTERNALSYM glXUseXFont} - - // GLX 1.1 and later - glXQueryExtensionsString: function(dpy: PDisplay; screen: TGLInt): PChar; cdecl; - {$EXTERNALSYM glXQueryExtensionsString} - glXQueryServerString: function(dpy: PDisplay; screen: TGLInt; name: TGLInt): PChar; cdecl; - {$EXTERNALSYM glXQueryServerString} - glXGetClientString: function(dpy: PDisplay; name: TGLInt): PChar; cdecl; - {$EXTERNALSYM glXGetClientString} - - // GLX 1.2 and later - glXGetCurrentDisplay: function: PDisplay; cdecl; - {$EXTERNALSYM glXGetCurrentDisplay} - - // GLX 1.3 and later - glXChooseFBConfig: function(dpy: PDisplay; screen: TGLInt; attribList: PGLInt; nitems: PGLInt): GLXFBConfig; cdecl; - {$EXTERNALSYM glXChooseFBConfig} - glXGetFBConfigAttrib: function(dpy: PDisplay; config: GLXFBConfig; attribute: TGLInt; value: PGLInt): TGLInt; cdecl; - {$EXTERNALSYM glXGetFBConfigAttrib} - glXGetFBConfigs: function(dpy: PDisplay; screen: TGLInt; nelements: PGLInt): GLXFBConfig; cdecl; - {$EXTERNALSYM glXGetFBConfigs} - glXGetVisualFromFBConfig: function(dpy: PDisplay; config: GLXFBConfig): PXVisualInfo; cdecl; - {$EXTERNALSYM glXGetVisualFromFBConfig} - glXCreateWindow: function(dpy: PDisplay; config: GLXFBConfig; win: Window; const attribList: PGLInt): GLXWindow; cdecl; - {$EXTERNALSYM glXCreateWindow} - glXDestroyWindow: procedure(dpy: PDisplay; window: GLXWindow); cdecl; - {$EXTERNALSYM glXDestroyWindow} - glXCreatePixmap: function(dpy: PDisplay; config: GLXFBConfig; pixmap: Pixmap; attribList: PGLInt): GLXPixmap; cdecl; - {$EXTERNALSYM glXCreatePixmap} - glXDestroyPixmap: procedure(dpy: PDisplay; pixmap: GLXPixmap); cdecl; - {$EXTERNALSYM glXDestroyPixmap} - glXCreatePbuffer: function(dpy: PDisplay; config: GLXFBConfig; attribList: PGLInt): GLXPBuffer; cdecl; - {$EXTERNALSYM glXCreatePbuffer} - glXDestroyPbuffer: procedure(dpy: PDisplay; pbuf: GLXPBuffer); cdecl; - {$EXTERNALSYM glXDestroyPbuffer} - glXQueryDrawable: procedure(dpy: PDisplay; draw: GLXDrawable; attribute: TGLInt; value: PGLuint); cdecl; - {$EXTERNALSYM glXQueryDrawable} - glXCreateNewContext: function(dpy: PDisplay; config: GLXFBConfig; renderType: TGLInt; shareList: GLXContext; direct: TGLboolean): GLXContext; cdecl; - {$EXTERNALSYM glXCreateNewContext} - glXMakeContextCurrent: function(dpy: PDisplay; draw: GLXDrawable; read: GLXDrawable; ctx: GLXContext): TGLboolean; cdecl; - {$EXTERNALSYM glXMakeContextCurrent} - glXGetCurrentReadDrawable: function: GLXDrawable; cdecl; - {$EXTERNALSYM glXGetCurrentReadDrawable} - glXQueryContext: function(dpy: PDisplay; ctx: GLXContext; attribute: TGLInt; value: PGLInt): TGLInt; cdecl; - {$EXTERNALSYM glXQueryContext} - glXSelectEvent: procedure(dpy: PDisplay; drawable: GLXDrawable; mask: TGLsizei); cdecl; - {$EXTERNALSYM glXSelectEvent} - glXGetSelectedEvent: procedure(dpy: PDisplay; drawable: GLXDrawable; mask: TGLsizei); cdecl; - {$EXTERNALSYM glXGetSelectedEvent} - glXGetVideoSyncSGI: function(count: PGLuint): TGLInt; cdecl; - {$EXTERNALSYM glXGetVideoSyncSGI} - glXWaitVideoSyncSGI: function(divisor: TGLInt; remainder: TGLInt; count: PGLuint): TGLInt; cdecl; - {$EXTERNALSYM glXWaitVideoSyncSGI} - glXFreeContextEXT: procedure(dpy: PDisplay; context: GLXContext); cdecl; - {$EXTERNALSYM glXFreeContextEXT} - glXGetContextIDEXT: function(const context: GLXContext): GLXContextID; cdecl; - {$EXTERNALSYM glXGetContextIDEXT} - glXGetCurrentDisplayEXT: function: PDisplay; cdecl; - {$EXTERNALSYM glXGetCurrentDisplayEXT} - glXImportContextEXT: function(dpy: PDisplay; contextID: GLXContextID): GLXContext; cdecl; - {$EXTERNALSYM glXImportContextEXT} - glXQueryContextInfoEXT: function(dpy: PDisplay; context: GLXContext; attribute: TGLInt; value: PGLInt): TGLInt; cdecl; - {$EXTERNALSYM glXQueryContextInfoEXT} - glXCopySubBufferMESA: procedure(dpy: PDisplay; drawable: GLXDrawable; x: TGLInt; y: TGLInt; width: TGLInt; height: TGLInt); cdecl; - {$EXTERNALSYM glXCopySubBufferMESA} - glXCreateGLXPixmapMESA: function(dpy: PDisplay; visual: PXVisualInfo; pixmap: Pixmap; cmap: Colormap): GLXPixmap; cdecl; - {$EXTERNALSYM glXCreateGLXPixmapMESA} - glXReleaseBuffersMESA: function(dpy: PDisplay; d: GLXDrawable): TGLboolean; cdecl; - {$EXTERNALSYM glXReleaseBuffersMESA} - glXSet3DfxModeMESA: function(mode: TGLint): TGLboolean; cdecl; - {$EXTERNALSYM glXSet3DfxModeMESA} -{$endif} - - -//---------------------------------------------------------------------------------------------------------------------- - -procedure CloseOpenGL; -function InitOpenGL: Boolean; -function InitOpenGLFromLibrary(GLName, GLUName: PChar): Boolean; -function IsOpenGLInitialized: Boolean; - -// Compatibility routines -procedure UnloadOpenGL; -function LoadOpenGL: Boolean; -function LoadOpenGLFromLibrary(GLName, GLUName: PChar): Boolean; -function IsOpenGLLoaded: Boolean; - -{$ifdef Win32} -procedure ActivateRenderingContext(DC: HDC; RC: HGLRC); -function CreateRenderingContext(DC: HDC; Options: TRCOptions; ColorBits, StencilBits, AccumBits, AuxBuffers: Integer; Layer: Integer; var Palette: HPALETTE): HGLRC; -function CurrentDC: HDC; -procedure DeactivateRenderingContext; -procedure DestroyRenderingContext(RC: HGLRC); -procedure ClearExtensions; -function HasActiveContext: Boolean; -procedure ReadExtensions; -procedure ReadImplementationProperties; -{$endif} - -//---------------------------------------------------------------------------------------------------------------------- - -implementation - -uses - SysUtils, - Classes, - sdl, - moduleloader; - -type - EOpenGLException = class(Exception); - -{$ifndef FPC} -threadvar -{$else} -var -{$endif} - LastPixelFormat: Integer; - ActivationRefCount: Integer; - -{$ifdef Win32} -const - INVALID_MODULEHANDLE = 0; - -var - GLHandle: TModuleHandle; - GLUHandle: TModuleHandle; -{$endif} - -{$ifdef UNIX} -const - INVALID_MODULEHANDLE = nil; - -var - GLHandle: TModuleHandle; - GLUHandle: TModuleHandle; -{$endif} - - // The context list is used to determine if a context is active already in any thread. - ContextList: TThreadList; - -resourcestring - SRCAlreadyActive = 'Rendering context already active in another thread.'; - SMakeCurrentFailed = 'wglMakeCurrent failed'; - SDeleteContextFailed = 'wglDeleteContext failed'; - SContextInUse = 'Cannot delete rendering context. It is still in use by another thread.'; - -{$ifdef Win32} - SDefaultGLLibrary = 'OpenGL32.dll'; - SDefaultGLULibrary = 'GLU32.dll'; -{$endif} - -{$ifdef UNIX} - SDefaultGLLibrary = 'libGL.so'; - SDefaultGLULibrary = 'libGLU.so'; -{$endif} - -//---------------------------------------------------------------------------------------------------------------------- - -procedure ShowError(const Message: string); - -begin - raise EOpenGLException.Create(Message); -end; - -//---------------------------------------------------------------------------------------------------------------------- - -{$ifndef VER140} - -procedure RaiseLastOSError; -begin - {$ifndef FPC} - RaiseLastWin32Error; - {$endif} -end; - -{$endif VER140} - -//---------------------------------------------------------------------------------------------------------------------- - -procedure ClearProcAddresses; - -begin - glAccum := nil; - glAlphaFunc := nil; - glAreTexturesResident := nil; - glArrayElement := nil; - glBegin := nil; - glBindTexture := nil; - glBitmap := nil; - glBlendFunc := nil; - glCallList := nil; - glCallLists := nil; - glClear := nil; - glClearAccum := nil; - glClearColor := nil; - glClearDepth := nil; - glClearIndex := nil; - glClearStencil := nil; - glClipPlane := nil; - glColor3b := nil; - glColor3bv := nil; - glColor3d := nil; - glColor3dv := nil; - glColor3f := nil; - glColor3fv := nil; - glColor3i := nil; - glColor3iv := nil; - glColor3s := nil; - glColor3sv := nil; - glColor3ub := nil; - glColor3ubv := nil; - glColor3ui := nil; - glColor3uiv := nil; - glColor3us := nil; - glColor3usv := nil; - glColor4b := nil; - glColor4bv := nil; - glColor4d := nil; - glColor4dv := nil; - glColor4f := nil; - glColor4fv := nil; - glColor4i := nil; - glColor4iv := nil; - glColor4s := nil; - glColor4sv := nil; - glColor4ub := nil; - glColor4ubv := nil; - glColor4ui := nil; - glColor4uiv := nil; - glColor4us := nil; - glColor4usv := nil; - glColorMask := nil; - glColorMaterial := nil; - glColorPointer := nil; - glCopyPixels := nil; - glCopyTexImage1D := nil; - glCopyTexImage2D := nil; - glCopyTexSubImage1D := nil; - glCopyTexSubImage2D := nil; - glCullFace := nil; - glDeleteLists := nil; - glDeleteTextures := nil; - glDepthFunc := nil; - glDepthMask := nil; - glDepthRange := nil; - glDisable := nil; - glDisableClientState := nil; - glDrawArrays := nil; - glDrawBuffer := nil; - glDrawElements := nil; - glDrawPixels := nil; - glEdgeFlag := nil; - glEdgeFlagPointer := nil; - glEdgeFlagv := nil; - glEnable := nil; - glEnableClientState := nil; - glEnd := nil; - glEndList := nil; - glEvalCoord1d := nil; - glEvalCoord1dv := nil; - glEvalCoord1f := nil; - glEvalCoord1fv := nil; - glEvalCoord2d := nil; - glEvalCoord2dv := nil; - glEvalCoord2f := nil; - glEvalCoord2fv := nil; - glEvalMesh1 := nil; - glEvalMesh2 := nil; - glEvalPoint1 := nil; - glEvalPoint2 := nil; - glFeedbackBuffer := nil; - glFinish := nil; - glFlush := nil; - glFogf := nil; - glFogfv := nil; - glFogi := nil; - glFogiv := nil; - glFrontFace := nil; - glFrustum := nil; - glGenLists := nil; - glGenTextures := nil; - glGetBooleanv := nil; - glGetClipPlane := nil; - glGetDoublev := nil; - glGetError := nil; - glGetFloatv := nil; - glGetIntegerv := nil; - glGetLightfv := nil; - glGetLightiv := nil; - glGetMapdv := nil; - glGetMapfv := nil; - glGetMapiv := nil; - glGetMaterialfv := nil; - glGetMaterialiv := nil; - glGetPixelMapfv := nil; - glGetPixelMapuiv := nil; - glGetPixelMapusv := nil; - glGetPointerv := nil; - glGetPolygonStipple := nil; - glGetString := nil; - glGetTexEnvfv := nil; - glGetTexEnviv := nil; - glGetTexGendv := nil; - glGetTexGenfv := nil; - glGetTexGeniv := nil; - glGetTexImage := nil; - glGetTexLevelParameterfv := nil; - glGetTexLevelParameteriv := nil; - glGetTexParameterfv := nil; - glGetTexParameteriv := nil; - glHint := nil; - glIndexMask := nil; - glIndexPointer := nil; - glIndexd := nil; - glIndexdv := nil; - glIndexf := nil; - glIndexfv := nil; - glIndexi := nil; - glIndexiv := nil; - glIndexs := nil; - glIndexsv := nil; - glIndexub := nil; - glIndexubv := nil; - glInitNames := nil; - glInterleavedArrays := nil; - glIsEnabled := nil; - glIsList := nil; - glIsTexture := nil; - glLightModelf := nil; - glLightModelfv := nil; - glLightModeli := nil; - glLightModeliv := nil; - glLightf := nil; - glLightfv := nil; - glLighti := nil; - glLightiv := nil; - glLineStipple := nil; - glLineWidth := nil; - glListBase := nil; - glLoadIdentity := nil; - glLoadMatrixd := nil; - glLoadMatrixf := nil; - glLoadName := nil; - glLogicOp := nil; - glMap1d := nil; - glMap1f := nil; - glMap2d := nil; - glMap2f := nil; - glMapGrid1d := nil; - glMapGrid1f := nil; - glMapGrid2d := nil; - glMapGrid2f := nil; - glMaterialf := nil; - glMaterialfv := nil; - glMateriali := nil; - glMaterialiv := nil; - glMatrixMode := nil; - glMultMatrixd := nil; - glMultMatrixf := nil; - glNewList := nil; - glNormal3b := nil; - glNormal3bv := nil; - glNormal3d := nil; - glNormal3dv := nil; - glNormal3f := nil; - glNormal3fv := nil; - glNormal3i := nil; - glNormal3iv := nil; - glNormal3s := nil; - glNormal3sv := nil; - glNormalPointer := nil; - glOrtho := nil; - glPassThrough := nil; - glPixelMapfv := nil; - glPixelMapuiv := nil; - glPixelMapusv := nil; - glPixelStoref := nil; - glPixelStorei := nil; - glPixelTransferf := nil; - glPixelTransferi := nil; - glPixelZoom := nil; - glPointSize := nil; - glPolygonMode := nil; - glPolygonOffset := nil; - glPolygonStipple := nil; - glPopAttrib := nil; - glPopClientAttrib := nil; - glPopMatrix := nil; - glPopName := nil; - glPrioritizeTextures := nil; - glPushAttrib := nil; - glPushClientAttrib := nil; - glPushMatrix := nil; - glPushName := nil; - glRasterPos2d := nil; - glRasterPos2dv := nil; - glRasterPos2f := nil; - glRasterPos2fv := nil; - glRasterPos2i := nil; - glRasterPos2iv := nil; - glRasterPos2s := nil; - glRasterPos2sv := nil; - glRasterPos3d := nil; - glRasterPos3dv := nil; - glRasterPos3f := nil; - glRasterPos3fv := nil; - glRasterPos3i := nil; - glRasterPos3iv := nil; - glRasterPos3s := nil; - glRasterPos3sv := nil; - glRasterPos4d := nil; - glRasterPos4dv := nil; - glRasterPos4f := nil; - glRasterPos4fv := nil; - glRasterPos4i := nil; - glRasterPos4iv := nil; - glRasterPos4s := nil; - glRasterPos4sv := nil; - glReadBuffer := nil; - glReadPixels := nil; - glRectd := nil; - glRectdv := nil; - glRectf := nil; - glRectfv := nil; - glRecti := nil; - glRectiv := nil; - glRects := nil; - glRectsv := nil; - glRenderMode := nil; - glRotated := nil; - glRotatef := nil; - glScaled := nil; - glScalef := nil; - glScissor := nil; - glSelectBuffer := nil; - glShadeModel := nil; - glStencilFunc := nil; - glStencilMask := nil; - glStencilOp := nil; - glTexCoord1d := nil; - glTexCoord1dv := nil; - glTexCoord1f := nil; - glTexCoord1fv := nil; - glTexCoord1i := nil; - glTexCoord1iv := nil; - glTexCoord1s := nil; - glTexCoord1sv := nil; - glTexCoord2d := nil; - glTexCoord2dv := nil; - glTexCoord2f := nil; - glTexCoord2fv := nil; - glTexCoord2i := nil; - glTexCoord2iv := nil; - glTexCoord2s := nil; - glTexCoord2sv := nil; - glTexCoord3d := nil; - glTexCoord3dv := nil; - glTexCoord3f := nil; - glTexCoord3fv := nil; - glTexCoord3i := nil; - glTexCoord3iv := nil; - glTexCoord3s := nil; - glTexCoord3sv := nil; - glTexCoord4d := nil; - glTexCoord4dv := nil; - glTexCoord4f := nil; - glTexCoord4fv := nil; - glTexCoord4i := nil; - glTexCoord4iv := nil; - glTexCoord4s := nil; - glTexCoord4sv := nil; - glTexCoordPointer := nil; - glTexEnvf := nil; - glTexEnvfv := nil; - glTexEnvi := nil; - glTexEnviv := nil; - glTexGend := nil; - glTexGendv := nil; - glTexGenf := nil; - glTexGenfv := nil; - glTexGeni := nil; - glTexGeniv := nil; - glTexImage1D := nil; - glTexImage2D := nil; - glTexParameterf := nil; - glTexParameterfv := nil; - glTexParameteri := nil; - glTexParameteriv := nil; - glTexSubImage1D := nil; - glTexSubImage2D := nil; - glTranslated := nil; - glTranslatef := nil; - glVertex2d := nil; - glVertex2dv := nil; - glVertex2f := nil; - glVertex2fv := nil; - glVertex2i := nil; - glVertex2iv := nil; - glVertex2s := nil; - glVertex2sv := nil; - glVertex3d := nil; - glVertex3dv := nil; - glVertex3f := nil; - glVertex3fv := nil; - glVertex3i := nil; - glVertex3iv := nil; - glVertex3s := nil; - glVertex3sv := nil; - glVertex4d := nil; - glVertex4dv := nil; - glVertex4f := nil; - glVertex4fv := nil; - glVertex4i := nil; - glVertex4iv := nil; - glVertex4s := nil; - glVertex4sv := nil; - glVertexPointer := nil; - glViewport := nil; - - {$ifdef Win32} - wglGetProcAddress := nil; - wglCopyContext := nil; - wglCreateContext := nil; - wglCreateLayerContext := nil; - wglDeleteContext := nil; - wglDescribeLayerPlane := nil; - wglGetCurrentContext := nil; - wglGetCurrentDC := nil; - wglGetLayerPaletteEntries := nil; - wglMakeCurrent := nil; - wglRealizeLayerPalette := nil; - wglSetLayerPaletteEntries := nil; - wglShareLists := nil; - wglSwapLayerBuffers := nil; - wglSwapMultipleBuffers := nil; - wglUseFontBitmapsA := nil; - wglUseFontOutlinesA := nil; - wglUseFontBitmapsW := nil; - wglUseFontOutlinesW := nil; - wglUseFontBitmaps := nil; - wglUseFontOutlines := nil; - {$endif} - - // GL 1.2 - glDrawRangeElements := nil; - glTexImage3D := nil; - - // GL 1.2 ARB imaging - glBlendColor := nil; - glBlendEquation := nil; - glColorSubTable := nil; - glCopyColorSubTable := nil; - glColorTable := nil; - glCopyColorTable := nil; - glColorTableParameteriv := nil; - glColorTableParameterfv := nil; - glGetColorTable := nil; - glGetColorTableParameteriv := nil; - glGetColorTableParameterfv := nil; - glConvolutionFilter1D := nil; - glConvolutionFilter2D := nil; - glCopyConvolutionFilter1D := nil; - glCopyConvolutionFilter2D := nil; - glGetConvolutionFilter := nil; - glSeparableFilter2D := nil; - glGetSeparableFilter := nil; - glConvolutionParameteri := nil; - glConvolutionParameteriv := nil; - glConvolutionParameterf := nil; - glConvolutionParameterfv := nil; - glGetConvolutionParameteriv := nil; - glGetConvolutionParameterfv := nil; - glHistogram := nil; - glResetHistogram := nil; - glGetHistogram := nil; - glGetHistogramParameteriv := nil; - glGetHistogramParameterfv := nil; - glMinmax := nil; - glResetMinmax := nil; - glGetMinmax := nil; - glGetMinmaxParameteriv := nil; - glGetMinmaxParameterfv := nil; - - // GLX - {$ifdef UNIX} - glXChooseVisual := nil; - glXCreateContext := nil; - glXDestroyContext := nil; - glXMakeCurrent := nil; - glXCopyContext := nil; - glXSwapBuffers := nil; - glXCreateGLXPixmap := nil; - glXDestroyGLXPixmap := nil; - glXQueryExtension := nil; - glXQueryVersion := nil; - glXIsDirect := nil; - glXGetConfig := nil; - glXGetCurrentContext := nil; - glXGetCurrentDrawable := nil; - glXWaitGL := nil; - glXWaitX := nil; - glXUseXFont := nil; - - // GLX 1.1 and later - glXQueryExtensionsString := nil; - glXQueryServerString := nil; - glXGetClientString := nil; - - // GLX 1.2 and later - glXGetCurrentDisplay := nil; - - // GLX 1.3 and later - glXChooseFBConfig := nil; - glXGetFBConfigAttrib := nil; - glXGetFBConfigs := nil; - glXGetVisualFromFBConfig := nil; - glXCreateWindow := nil; - glXDestroyWindow := nil; - glXCreatePixmap := nil; - glXDestroyPixmap := nil; - glXCreatePbuffer := nil; - glXDestroyPbuffer := nil; - glXQueryDrawable := nil; - glXCreateNewContext := nil; - glXMakeContextCurrent := nil; - glXGetCurrentReadDrawable := nil; - glXQueryContext := nil; - glXSelectEvent := nil; - glXGetSelectedEvent := nil; - glXGetVideoSyncSGI := nil; - glXWaitVideoSyncSGI := nil; - glXFreeContextEXT := nil; - glXGetContextIDEXT := nil; - glXGetCurrentDisplayEXT := nil; - glXImportContextEXT := nil; - glXQueryContextInfoEXT := nil; - glXCopySubBufferMESA := nil; - glXCreateGLXPixmapMESA := nil; - glXReleaseBuffersMESA := nil; - glXSet3DfxModeMESA := nil; - {$endif} -end; - -//---------------------------------------------------------------------------------------------------------------------- - -procedure LoadProcAddresses; -begin - if GLHandle <> INVALID_MODULEHANDLE then - begin - glAccum := GetModuleSymbol( GLHandle, 'glAccum'); - glAlphaFunc := GetModuleSymbol( GLHandle, 'glAlphaFunc'); - glAreTexturesResident := GetModuleSymbol( GLHandle, 'glAreTexturesResident'); - glArrayElement := GetModuleSymbol( GLHandle, 'glArrayElement'); - glBegin := GetModuleSymbol( GLHandle, 'glBegin'); - glBindTexture := GetModuleSymbol( GLHandle, 'glBindTexture'); - glBitmap := GetModuleSymbol( GLHandle, 'glBitmap'); - glBlendFunc := GetModuleSymbol( GLHandle, 'glBlendFunc'); - glCallList := GetModuleSymbol( GLHandle, 'glCallList'); - glCallLists := GetModuleSymbol( GLHandle, 'glCallLists'); - glClear := GetModuleSymbol( GLHandle, 'glClear'); - glClearAccum := GetModuleSymbol( GLHandle, 'glClearAccum'); - glClearColor := GetModuleSymbol( GLHandle, 'glClearColor'); - glClearDepth := GetModuleSymbol( GLHandle, 'glClearDepth'); - glClearIndex := GetModuleSymbol( GLHandle, 'glClearIndex'); - glClearStencil := GetModuleSymbol( GLHandle, 'glClearStencil'); - glClipPlane := GetModuleSymbol( GLHandle, 'glClipPlane'); - glColor3b := GetModuleSymbol( GLHandle, 'glColor3b'); - glColor3bv := GetModuleSymbol( GLHandle, 'glColor3bv'); - glColor3d := GetModuleSymbol( GLHandle, 'glColor3d'); - glColor3dv := GetModuleSymbol( GLHandle, 'glColor3dv'); - glColor3f := GetModuleSymbol( GLHandle, 'glColor3f'); - glColor3fv := GetModuleSymbol( GLHandle, 'glColor3fv'); - glColor3i := GetModuleSymbol( GLHandle, 'glColor3i'); - glColor3iv := GetModuleSymbol( GLHandle, 'glColor3iv'); - glColor3s := GetModuleSymbol( GLHandle, 'glColor3s'); - glColor3sv := GetModuleSymbol( GLHandle, 'glColor3sv'); - glColor3ub := GetModuleSymbol( GLHandle, 'glColor3ub'); - glColor3ubv := GetModuleSymbol( GLHandle, 'glColor3ubv'); - glColor3ui := GetModuleSymbol( GLHandle, 'glColor3ui'); - glColor3uiv := GetModuleSymbol( GLHandle, 'glColor3uiv'); - glColor3us := GetModuleSymbol( GLHandle, 'glColor3us'); - glColor3usv := GetModuleSymbol( GLHandle, 'glColor3usv'); - glColor4b := GetModuleSymbol( GLHandle, 'glColor4b'); - glColor4bv := GetModuleSymbol( GLHandle, 'glColor4bv'); - glColor4d := GetModuleSymbol( GLHandle, 'glColor4d'); - glColor4dv := GetModuleSymbol( GLHandle, 'glColor4dv'); - glColor4f := GetModuleSymbol( GLHandle, 'glColor4f'); - glColor4fv := GetModuleSymbol( GLHandle, 'glColor4fv'); - glColor4i := GetModuleSymbol( GLHandle, 'glColor4i'); - glColor4iv := GetModuleSymbol( GLHandle, 'glColor4iv'); - glColor4s := GetModuleSymbol( GLHandle, 'glColor4s'); - glColor4sv := GetModuleSymbol( GLHandle, 'glColor4sv'); - glColor4ub := GetModuleSymbol( GLHandle, 'glColor4ub'); - glColor4ubv := GetModuleSymbol( GLHandle, 'glColor4ubv'); - glColor4ui := GetModuleSymbol( GLHandle, 'glColor4ui'); - glColor4uiv := GetModuleSymbol( GLHandle, 'glColor4uiv'); - glColor4us := GetModuleSymbol( GLHandle, 'glColor4us'); - glColor4usv := GetModuleSymbol( GLHandle, 'glColor4usv'); - glColorMask := GetModuleSymbol( GLHandle, 'glColorMask'); - glColorMaterial := GetModuleSymbol( GLHandle, 'glColorMaterial'); - glColorPointer := GetModuleSymbol( GLHandle, 'glColorPointer'); - glCopyPixels := GetModuleSymbol( GLHandle, 'glCopyPixels'); - glCopyTexImage1D := GetModuleSymbol( GLHandle, 'glCopyTexImage1D'); - glCopyTexImage2D := GetModuleSymbol( GLHandle, 'glCopyTexImage2D'); - glCopyTexSubImage1D := GetModuleSymbol( GLHandle, 'glCopyTexSubImage1D'); - glCopyTexSubImage2D := GetModuleSymbol( GLHandle, 'glCopyTexSubImage2D'); - glCullFace := GetModuleSymbol( GLHandle, 'glCullFace'); - glDeleteLists := GetModuleSymbol( GLHandle, 'glDeleteLists'); - glDeleteTextures := GetModuleSymbol( GLHandle, 'glDeleteTextures'); - glDepthFunc := GetModuleSymbol( GLHandle, 'glDepthFunc'); - glDepthMask := GetModuleSymbol( GLHandle, 'glDepthMask'); - glDepthRange := GetModuleSymbol( GLHandle, 'glDepthRange'); - glDisable := GetModuleSymbol( GLHandle, 'glDisable'); - glDisableClientState := GetModuleSymbol( GLHandle, 'glDisableClientState'); - glDrawArrays := GetModuleSymbol( GLHandle, 'glDrawArrays'); - glDrawBuffer := GetModuleSymbol( GLHandle, 'glDrawBuffer'); - glDrawElements := GetModuleSymbol( GLHandle, 'glDrawElements'); - glDrawPixels := GetModuleSymbol( GLHandle, 'glDrawPixels'); - glEdgeFlag := GetModuleSymbol( GLHandle, 'glEdgeFlag'); - glEdgeFlagPointer := GetModuleSymbol( GLHandle, 'glEdgeFlagPointer'); - glEdgeFlagv := GetModuleSymbol( GLHandle, 'glEdgeFlagv'); - glEnable := GetModuleSymbol( GLHandle, 'glEnable'); - glEnableClientState := GetModuleSymbol( GLHandle, 'glEnableClientState'); - glEnd := GetModuleSymbol( GLHandle, 'glEnd'); - glEndList := GetModuleSymbol( GLHandle, 'glEndList'); - glEvalCoord1d := GetModuleSymbol( GLHandle, 'glEvalCoord1d'); - glEvalCoord1dv := GetModuleSymbol( GLHandle, 'glEvalCoord1dv'); - glEvalCoord1f := GetModuleSymbol( GLHandle, 'glEvalCoord1f'); - glEvalCoord1fv := GetModuleSymbol( GLHandle, 'glEvalCoord1fv'); - glEvalCoord2d := GetModuleSymbol( GLHandle, 'glEvalCoord2d'); - glEvalCoord2dv := GetModuleSymbol( GLHandle, 'glEvalCoord2dv'); - glEvalCoord2f := GetModuleSymbol( GLHandle, 'glEvalCoord2f'); - glEvalCoord2fv := GetModuleSymbol( GLHandle, 'glEvalCoord2fv'); - glEvalMesh1 := GetModuleSymbol( GLHandle, 'glEvalMesh1'); - glEvalMesh2 := GetModuleSymbol( GLHandle, 'glEvalMesh2'); - glEvalPoint1 := GetModuleSymbol( GLHandle, 'glEvalPoint1'); - glEvalPoint2 := GetModuleSymbol( GLHandle, 'glEvalPoint2'); - glFeedbackBuffer := GetModuleSymbol( GLHandle, 'glFeedbackBuffer'); - glFinish := GetModuleSymbol( GLHandle, 'glFinish'); - glFlush := GetModuleSymbol( GLHandle, 'glFlush'); - glFogf := GetModuleSymbol( GLHandle, 'glFogf'); - glFogfv := GetModuleSymbol( GLHandle, 'glFogfv'); - glFogi := GetModuleSymbol( GLHandle, 'glFogi'); - glFogiv := GetModuleSymbol( GLHandle, 'glFogiv'); - glFrontFace := GetModuleSymbol( GLHandle, 'glFrontFace'); - glFrustum := GetModuleSymbol( GLHandle, 'glFrustum'); - glGenLists := GetModuleSymbol( GLHandle, 'glGenLists'); - glGenTextures := GetModuleSymbol( GLHandle, 'glGenTextures'); - glGetBooleanv := GetModuleSymbol( GLHandle, 'glGetBooleanv'); - glGetClipPlane := GetModuleSymbol( GLHandle, 'glGetClipPlane'); - glGetDoublev := GetModuleSymbol( GLHandle, 'glGetDoublev'); - glGetError := GetModuleSymbol( GLHandle, 'glGetError'); - glGetFloatv := GetModuleSymbol( GLHandle, 'glGetFloatv'); - glGetIntegerv := GetModuleSymbol( GLHandle, 'glGetIntegerv'); - glGetLightfv := GetModuleSymbol( GLHandle, 'glGetLightfv'); - glGetLightiv := GetModuleSymbol( GLHandle, 'glGetLightiv'); - glGetMapdv := GetModuleSymbol( GLHandle, 'glGetMapdv'); - glGetMapfv := GetModuleSymbol( GLHandle, 'glGetMapfv'); - glGetMapiv := GetModuleSymbol( GLHandle, 'glGetMapiv'); - glGetMaterialfv := GetModuleSymbol( GLHandle, 'glGetMaterialfv'); - glGetMaterialiv := GetModuleSymbol( GLHandle, 'glGetMaterialiv'); - glGetPixelMapfv := GetModuleSymbol( GLHandle, 'glGetPixelMapfv'); - glGetPixelMapuiv := GetModuleSymbol( GLHandle, 'glGetPixelMapuiv'); - glGetPixelMapusv := GetModuleSymbol( GLHandle, 'glGetPixelMapusv'); - glGetPointerv := GetModuleSymbol( GLHandle, 'glGetPointerv'); - glGetPolygonStipple := GetModuleSymbol( GLHandle, 'glGetPolygonStipple'); - glGetString := GetModuleSymbol( GLHandle, 'glGetString'); - glGetTexEnvfv := GetModuleSymbol( GLHandle, 'glGetTexEnvfv'); - glGetTexEnviv := GetModuleSymbol( GLHandle, 'glGetTexEnviv'); - glGetTexGendv := GetModuleSymbol( GLHandle, 'glGetTexGendv'); - glGetTexGenfv := GetModuleSymbol( GLHandle, 'glGetTexGenfv'); - glGetTexGeniv := GetModuleSymbol( GLHandle, 'glGetTexGeniv'); - glGetTexImage := GetModuleSymbol( GLHandle, 'glGetTexImage'); - glGetTexLevelParameterfv := GetModuleSymbol( GLHandle, 'glGetTexLevelParameterfv'); - glGetTexLevelParameteriv := GetModuleSymbol( GLHandle, 'glGetTexLevelParameteriv'); - glGetTexParameterfv := GetModuleSymbol( GLHandle, 'glGetTexParameterfv'); - glGetTexParameteriv := GetModuleSymbol( GLHandle, 'glGetTexParameteriv'); - glHint := GetModuleSymbol( GLHandle, 'glHint'); - glIndexMask := GetModuleSymbol( GLHandle, 'glIndexMask'); - glIndexPointer := GetModuleSymbol( GLHandle, 'glIndexPointer'); - glIndexd := GetModuleSymbol( GLHandle, 'glIndexd'); - glIndexdv := GetModuleSymbol( GLHandle, 'glIndexdv'); - glIndexf := GetModuleSymbol( GLHandle, 'glIndexf'); - glIndexfv := GetModuleSymbol( GLHandle, 'glIndexfv'); - glIndexi := GetModuleSymbol( GLHandle, 'glIndexi'); - glIndexiv := GetModuleSymbol( GLHandle, 'glIndexiv'); - glIndexs := GetModuleSymbol( GLHandle, 'glIndexs'); - glIndexsv := GetModuleSymbol( GLHandle, 'glIndexsv'); - glIndexub := GetModuleSymbol( GLHandle, 'glIndexub'); - glIndexubv := GetModuleSymbol( GLHandle, 'glIndexubv'); - glInitNames := GetModuleSymbol( GLHandle, 'glInitNames'); - glInterleavedArrays := GetModuleSymbol( GLHandle, 'glInterleavedArrays'); - glIsEnabled := GetModuleSymbol( GLHandle, 'glIsEnabled'); - glIsList := GetModuleSymbol( GLHandle, 'glIsList'); - glIsTexture := GetModuleSymbol( GLHandle, 'glIsTexture'); - glLightModelf := GetModuleSymbol( GLHandle, 'glLightModelf'); - glLightModelfv := GetModuleSymbol( GLHandle, 'glLightModelfv'); - glLightModeli := GetModuleSymbol( GLHandle, 'glLightModeli'); - glLightModeliv := GetModuleSymbol( GLHandle, 'glLightModeliv'); - glLightf := GetModuleSymbol( GLHandle, 'glLightf'); - glLightfv := GetModuleSymbol( GLHandle, 'glLightfv'); - glLighti := GetModuleSymbol( GLHandle, 'glLighti'); - glLightiv := GetModuleSymbol( GLHandle, 'glLightiv'); - glLineStipple := GetModuleSymbol( GLHandle, 'glLineStipple'); - glLineWidth := GetModuleSymbol( GLHandle, 'glLineWidth'); - glListBase := GetModuleSymbol( GLHandle, 'glListBase'); - glLoadIdentity := GetModuleSymbol( GLHandle, 'glLoadIdentity'); - glLoadMatrixd := GetModuleSymbol( GLHandle, 'glLoadMatrixd'); - glLoadMatrixf := GetModuleSymbol( GLHandle, 'glLoadMatrixf'); - glLoadName := GetModuleSymbol( GLHandle, 'glLoadName'); - glLogicOp := GetModuleSymbol( GLHandle, 'glLogicOp'); - glMap1d := GetModuleSymbol( GLHandle, 'glMap1d'); - glMap1f := GetModuleSymbol( GLHandle, 'glMap1f'); - glMap2d := GetModuleSymbol( GLHandle, 'glMap2d'); - glMap2f := GetModuleSymbol( GLHandle, 'glMap2f'); - glMapGrid1d := GetModuleSymbol( GLHandle, 'glMapGrid1d'); - glMapGrid1f := GetModuleSymbol( GLHandle, 'glMapGrid1f'); - glMapGrid2d := GetModuleSymbol( GLHandle, 'glMapGrid2d'); - glMapGrid2f := GetModuleSymbol( GLHandle, 'glMapGrid2f'); - glMaterialf := GetModuleSymbol( GLHandle, 'glMaterialf'); - glMaterialfv := GetModuleSymbol( GLHandle, 'glMaterialfv'); - glMateriali := GetModuleSymbol( GLHandle, 'glMateriali'); - glMaterialiv := GetModuleSymbol( GLHandle, 'glMaterialiv'); - glMatrixMode := GetModuleSymbol( GLHandle, 'glMatrixMode'); - glMultMatrixd := GetModuleSymbol( GLHandle, 'glMultMatrixd'); - glMultMatrixf := GetModuleSymbol( GLHandle, 'glMultMatrixf'); - glNewList := GetModuleSymbol( GLHandle, 'glNewList'); - glNormal3b := GetModuleSymbol( GLHandle, 'glNormal3b'); - glNormal3bv := GetModuleSymbol( GLHandle, 'glNormal3bv'); - glNormal3d := GetModuleSymbol( GLHandle, 'glNormal3d'); - glNormal3dv := GetModuleSymbol( GLHandle, 'glNormal3dv'); - glNormal3f := GetModuleSymbol( GLHandle, 'glNormal3f'); - glNormal3fv := GetModuleSymbol( GLHandle, 'glNormal3fv'); - glNormal3i := GetModuleSymbol( GLHandle, 'glNormal3i'); - glNormal3iv := GetModuleSymbol( GLHandle, 'glNormal3iv'); - glNormal3s := GetModuleSymbol( GLHandle, 'glNormal3s'); - glNormal3sv := GetModuleSymbol( GLHandle, 'glNormal3sv'); - glNormalPointer := GetModuleSymbol( GLHandle, 'glNormalPointer'); - glOrtho := GetModuleSymbol( GLHandle, 'glOrtho'); - glPassThrough := GetModuleSymbol( GLHandle, 'glPassThrough'); - glPixelMapfv := GetModuleSymbol( GLHandle, 'glPixelMapfv'); - glPixelMapuiv := GetModuleSymbol( GLHandle, 'glPixelMapuiv'); - glPixelMapusv := GetModuleSymbol( GLHandle, 'glPixelMapusv'); - glPixelStoref := GetModuleSymbol( GLHandle, 'glPixelStoref'); - glPixelStorei := GetModuleSymbol( GLHandle, 'glPixelStorei'); - glPixelTransferf := GetModuleSymbol( GLHandle, 'glPixelTransferf'); - glPixelTransferi := GetModuleSymbol( GLHandle, 'glPixelTransferi'); - glPixelZoom := GetModuleSymbol( GLHandle, 'glPixelZoom'); - glPointSize := GetModuleSymbol( GLHandle, 'glPointSize'); - glPolygonMode := GetModuleSymbol( GLHandle, 'glPolygonMode'); - glPolygonOffset := GetModuleSymbol( GLHandle, 'glPolygonOffset'); - glPolygonStipple := GetModuleSymbol( GLHandle, 'glPolygonStipple'); - glPopAttrib := GetModuleSymbol( GLHandle, 'glPopAttrib'); - glPopClientAttrib := GetModuleSymbol( GLHandle, 'glPopClientAttrib'); - glPopMatrix := GetModuleSymbol( GLHandle, 'glPopMatrix'); - glPopName := GetModuleSymbol( GLHandle, 'glPopName'); - glPrioritizeTextures := GetModuleSymbol( GLHandle, 'glPrioritizeTextures'); - glPushAttrib := GetModuleSymbol( GLHandle, 'glPushAttrib'); - glPushClientAttrib := GetModuleSymbol( GLHandle, 'glPushClientAttrib'); - glPushMatrix := GetModuleSymbol( GLHandle, 'glPushMatrix'); - glPushName := GetModuleSymbol( GLHandle, 'glPushName'); - glRasterPos2d := GetModuleSymbol( GLHandle, 'glRasterPos2d'); - glRasterPos2dv := GetModuleSymbol( GLHandle, 'glRasterPos2dv'); - glRasterPos2f := GetModuleSymbol( GLHandle, 'glRasterPos2f'); - glRasterPos2fv := GetModuleSymbol( GLHandle, 'glRasterPos2fv'); - glRasterPos2i := GetModuleSymbol( GLHandle, 'glRasterPos2i'); - glRasterPos2iv := GetModuleSymbol( GLHandle, 'glRasterPos2iv'); - glRasterPos2s := GetModuleSymbol( GLHandle, 'glRasterPos2s'); - glRasterPos2sv := GetModuleSymbol( GLHandle, 'glRasterPos2sv'); - glRasterPos3d := GetModuleSymbol( GLHandle, 'glRasterPos3d'); - glRasterPos3dv := GetModuleSymbol( GLHandle, 'glRasterPos3dv'); - glRasterPos3f := GetModuleSymbol( GLHandle, 'glRasterPos3f'); - glRasterPos3fv := GetModuleSymbol( GLHandle, 'glRasterPos3fv'); - glRasterPos3i := GetModuleSymbol( GLHandle, 'glRasterPos3i'); - glRasterPos3iv := GetModuleSymbol( GLHandle, 'glRasterPos3iv'); - glRasterPos3s := GetModuleSymbol( GLHandle, 'glRasterPos3s'); - glRasterPos3sv := GetModuleSymbol( GLHandle, 'glRasterPos3sv'); - glRasterPos4d := GetModuleSymbol( GLHandle, 'glRasterPos4d'); - glRasterPos4dv := GetModuleSymbol( GLHandle, 'glRasterPos4dv'); - glRasterPos4f := GetModuleSymbol( GLHandle, 'glRasterPos4f'); - glRasterPos4fv := GetModuleSymbol( GLHandle, 'glRasterPos4fv'); - glRasterPos4i := GetModuleSymbol( GLHandle, 'glRasterPos4i'); - glRasterPos4iv := GetModuleSymbol( GLHandle, 'glRasterPos4iv'); - glRasterPos4s := GetModuleSymbol( GLHandle, 'glRasterPos4s'); - glRasterPos4sv := GetModuleSymbol( GLHandle, 'glRasterPos4sv'); - glReadBuffer := GetModuleSymbol( GLHandle, 'glReadBuffer'); - glReadPixels := GetModuleSymbol( GLHandle, 'glReadPixels'); - glRectd := GetModuleSymbol( GLHandle, 'glRectd'); - glRectdv := GetModuleSymbol( GLHandle, 'glRectdv'); - glRectf := GetModuleSymbol( GLHandle, 'glRectf'); - glRectfv := GetModuleSymbol( GLHandle, 'glRectfv'); - glRecti := GetModuleSymbol( GLHandle, 'glRecti'); - glRectiv := GetModuleSymbol( GLHandle, 'glRectiv'); - glRects := GetModuleSymbol( GLHandle, 'glRects'); - glRectsv := GetModuleSymbol( GLHandle, 'glRectsv'); - glRenderMode := GetModuleSymbol( GLHandle, 'glRenderMode'); - glRotated := GetModuleSymbol( GLHandle, 'glRotated'); - glRotatef := GetModuleSymbol( GLHandle, 'glRotatef'); - glScaled := GetModuleSymbol( GLHandle, 'glScaled'); - glScalef := GetModuleSymbol( GLHandle, 'glScalef'); - glScissor := GetModuleSymbol( GLHandle, 'glScissor'); - glSelectBuffer := GetModuleSymbol( GLHandle, 'glSelectBuffer'); - glShadeModel := GetModuleSymbol( GLHandle, 'glShadeModel'); - glStencilFunc := GetModuleSymbol( GLHandle, 'glStencilFunc'); - glStencilMask := GetModuleSymbol( GLHandle, 'glStencilMask'); - glStencilOp := GetModuleSymbol( GLHandle, 'glStencilOp'); - glTexCoord1d := GetModuleSymbol( GLHandle, 'glTexCoord1d'); - glTexCoord1dv := GetModuleSymbol( GLHandle, 'glTexCoord1dv'); - glTexCoord1f := GetModuleSymbol( GLHandle, 'glTexCoord1f'); - glTexCoord1fv := GetModuleSymbol( GLHandle, 'glTexCoord1fv'); - glTexCoord1i := GetModuleSymbol( GLHandle, 'glTexCoord1i'); - glTexCoord1iv := GetModuleSymbol( GLHandle, 'glTexCoord1iv'); - glTexCoord1s := GetModuleSymbol( GLHandle, 'glTexCoord1s'); - glTexCoord1sv := GetModuleSymbol( GLHandle, 'glTexCoord1sv'); - glTexCoord2d := GetModuleSymbol( GLHandle, 'glTexCoord2d'); - glTexCoord2dv := GetModuleSymbol( GLHandle, 'glTexCoord2dv'); - glTexCoord2f := GetModuleSymbol( GLHandle, 'glTexCoord2f'); - glTexCoord2fv := GetModuleSymbol( GLHandle, 'glTexCoord2fv'); - glTexCoord2i := GetModuleSymbol( GLHandle, 'glTexCoord2i'); - glTexCoord2iv := GetModuleSymbol( GLHandle, 'glTexCoord2iv'); - glTexCoord2s := GetModuleSymbol( GLHandle, 'glTexCoord2s'); - glTexCoord2sv := GetModuleSymbol( GLHandle, 'glTexCoord2sv'); - glTexCoord3d := GetModuleSymbol( GLHandle, 'glTexCoord3d'); - glTexCoord3dv := GetModuleSymbol( GLHandle, 'glTexCoord3dv'); - glTexCoord3f := GetModuleSymbol( GLHandle, 'glTexCoord3f'); - glTexCoord3fv := GetModuleSymbol( GLHandle, 'glTexCoord3fv'); - glTexCoord3i := GetModuleSymbol( GLHandle, 'glTexCoord3i'); - glTexCoord3iv := GetModuleSymbol( GLHandle, 'glTexCoord3iv'); - glTexCoord3s := GetModuleSymbol( GLHandle, 'glTexCoord3s'); - glTexCoord3sv := GetModuleSymbol( GLHandle, 'glTexCoord3sv'); - glTexCoord4d := GetModuleSymbol( GLHandle, 'glTexCoord4d'); - glTexCoord4dv := GetModuleSymbol( GLHandle, 'glTexCoord4dv'); - glTexCoord4f := GetModuleSymbol( GLHandle, 'glTexCoord4f'); - glTexCoord4fv := GetModuleSymbol( GLHandle, 'glTexCoord4fv'); - glTexCoord4i := GetModuleSymbol( GLHandle, 'glTexCoord4i'); - glTexCoord4iv := GetModuleSymbol( GLHandle, 'glTexCoord4iv'); - glTexCoord4s := GetModuleSymbol( GLHandle, 'glTexCoord4s'); - glTexCoord4sv := GetModuleSymbol( GLHandle, 'glTexCoord4sv'); - glTexCoordPointer := GetModuleSymbol( GLHandle, 'glTexCoordPointer'); - glTexEnvf := GetModuleSymbol( GLHandle, 'glTexEnvf'); - glTexEnvfv := GetModuleSymbol( GLHandle, 'glTexEnvfv'); - glTexEnvi := GetModuleSymbol( GLHandle, 'glTexEnvi'); - glTexEnviv := GetModuleSymbol( GLHandle, 'glTexEnviv'); - glTexGend := GetModuleSymbol( GLHandle, 'glTexGend'); - glTexGendv := GetModuleSymbol( GLHandle, 'glTexGendv'); - glTexGenf := GetModuleSymbol( GLHandle, 'glTexGenf'); - glTexGenfv := GetModuleSymbol( GLHandle, 'glTexGenfv'); - glTexGeni := GetModuleSymbol( GLHandle, 'glTexGeni'); - glTexGeniv := GetModuleSymbol( GLHandle, 'glTexGeniv'); - glTexImage1D := GetModuleSymbol( GLHandle, 'glTexImage1D'); - glTexImage2D := GetModuleSymbol( GLHandle, 'glTexImage2D'); - glTexParameterf := GetModuleSymbol( GLHandle, 'glTexParameterf'); - glTexParameterfv := GetModuleSymbol( GLHandle, 'glTexParameterfv'); - glTexParameteri := GetModuleSymbol( GLHandle, 'glTexParameteri'); - glTexParameteriv := GetModuleSymbol( GLHandle, 'glTexParameteriv'); - glTexSubImage1D := GetModuleSymbol( GLHandle, 'glTexSubImage1D'); - glTexSubImage2D := GetModuleSymbol( GLHandle, 'glTexSubImage2D'); - glTranslated := GetModuleSymbol( GLHandle, 'glTranslated'); - glTranslatef := GetModuleSymbol( GLHandle, 'glTranslatef'); - glVertex2d := GetModuleSymbol( GLHandle, 'glVertex2d'); - glVertex2dv := GetModuleSymbol( GLHandle, 'glVertex2dv'); - glVertex2f := GetModuleSymbol( GLHandle, 'glVertex2f'); - glVertex2fv := GetModuleSymbol( GLHandle, 'glVertex2fv'); - glVertex2i := GetModuleSymbol( GLHandle, 'glVertex2i'); - glVertex2iv := GetModuleSymbol( GLHandle, 'glVertex2iv'); - glVertex2s := GetModuleSymbol( GLHandle, 'glVertex2s'); - glVertex2sv := GetModuleSymbol( GLHandle, 'glVertex2sv'); - glVertex3d := GetModuleSymbol( GLHandle, 'glVertex3d'); - glVertex3dv := GetModuleSymbol( GLHandle, 'glVertex3dv'); - glVertex3f := GetModuleSymbol( GLHandle, 'glVertex3f'); - glVertex3fv := GetModuleSymbol( GLHandle, 'glVertex3fv'); - glVertex3i := GetModuleSymbol( GLHandle, 'glVertex3i'); - glVertex3iv := GetModuleSymbol( GLHandle, 'glVertex3iv'); - glVertex3s := GetModuleSymbol( GLHandle, 'glVertex3s'); - glVertex3sv := GetModuleSymbol( GLHandle, 'glVertex3sv'); - glVertex4d := GetModuleSymbol( GLHandle, 'glVertex4d'); - glVertex4dv := GetModuleSymbol( GLHandle, 'glVertex4dv'); - glVertex4f := GetModuleSymbol( GLHandle, 'glVertex4f'); - glVertex4fv := GetModuleSymbol( GLHandle, 'glVertex4fv'); - glVertex4i := GetModuleSymbol( GLHandle, 'glVertex4i'); - glVertex4iv := GetModuleSymbol( GLHandle, 'glVertex4iv'); - glVertex4s := GetModuleSymbol( GLHandle, 'glVertex4s'); - glVertex4sv := GetModuleSymbol( GLHandle, 'glVertex4sv'); - glVertexPointer := GetModuleSymbol( GLHandle, 'glVertexPointer'); - glViewport := GetModuleSymbol( GLHandle, 'glViewport'); - - // window support routines - {$ifdef Win32} - wglGetProcAddress := GetModuleSymbol( GLHandle, 'wglGetProcAddress'); - wglCopyContext := GetModuleSymbol( GLHandle, 'wglCopyContext'); - wglCreateContext := GetModuleSymbol( GLHandle, 'wglCreateContext'); - wglCreateLayerContext := GetModuleSymbol( GLHandle, 'wglCreateLayerContext'); - wglDeleteContext := GetModuleSymbol( GLHandle, 'wglDeleteContext'); - wglDescribeLayerPlane := GetModuleSymbol( GLHandle, 'wglDescribeLayerPlane'); - wglGetCurrentContext := GetModuleSymbol( GLHandle, 'wglGetCurrentContext'); - wglGetCurrentDC := GetModuleSymbol( GLHandle, 'wglGetCurrentDC'); - wglGetLayerPaletteEntries := GetModuleSymbol( GLHandle, 'wglGetLayerPaletteEntries'); - wglMakeCurrent := GetModuleSymbol( GLHandle, 'wglMakeCurrent'); - wglRealizeLayerPalette := GetModuleSymbol( GLHandle, 'wglRealizeLayerPalette'); - wglSetLayerPaletteEntries := GetModuleSymbol( GLHandle, 'wglSetLayerPaletteEntries'); - wglShareLists := GetModuleSymbol( GLHandle, 'wglShareLists'); - wglSwapLayerBuffers := GetModuleSymbol( GLHandle, 'wglSwapLayerBuffers'); - wglSwapMultipleBuffers := GetModuleSymbol( GLHandle, 'wglSwapMultipleBuffers'); - wglUseFontBitmapsA := GetModuleSymbol( GLHandle, 'wglUseFontBitmapsA'); - wglUseFontOutlinesA := GetModuleSymbol( GLHandle, 'wglUseFontOutlinesA'); - wglUseFontBitmapsW := GetModuleSymbol( GLHandle, 'wglUseFontBitmapsW'); - wglUseFontOutlinesW := GetModuleSymbol( GLHandle, 'wglUseFontOutlinesW'); - wglUseFontBitmaps := GetModuleSymbol( GLHandle, 'wglUseFontBitmapsA'); - wglUseFontOutlines := GetModuleSymbol( GLHandle, 'wglUseFontOutlinesA'); - {$endif} - - // GL 1.2 - glDrawRangeElements := GetModuleSymbol( GLHandle, 'glDrawRangeElements'); - glTexImage3D := GetModuleSymbol( GLHandle, 'glTexImage3D'); - - // GL 1.2 ARB imaging - glBlendColor := GetModuleSymbol( GLHandle, 'glBlendColor'); - glBlendEquation := GetModuleSymbol( GLHandle, 'glBlendEquation'); - glColorSubTable := GetModuleSymbol( GLHandle, 'glColorSubTable'); - glCopyColorSubTable := GetModuleSymbol( GLHandle, 'glCopyColorSubTable'); - glColorTable := GetModuleSymbol( GLHandle, 'glCopyColorSubTable'); - glCopyColorTable := GetModuleSymbol( GLHandle, 'glCopyColorTable'); - glColorTableParameteriv := GetModuleSymbol( GLHandle, 'glColorTableParameteriv'); - glColorTableParameterfv := GetModuleSymbol( GLHandle, 'glColorTableParameterfv'); - glGetColorTable := GetModuleSymbol( GLHandle, 'glGetColorTable'); - glGetColorTableParameteriv := GetModuleSymbol( GLHandle, 'glGetColorTableParameteriv'); - glGetColorTableParameterfv := GetModuleSymbol( GLHandle, 'glGetColorTableParameterfv'); - glConvolutionFilter1D := GetModuleSymbol( GLHandle, 'glConvolutionFilter1D'); - glConvolutionFilter2D := GetModuleSymbol( GLHandle, 'glConvolutionFilter2D'); - glCopyConvolutionFilter1D := GetModuleSymbol( GLHandle, 'glCopyConvolutionFilter1D'); - glCopyConvolutionFilter2D := GetModuleSymbol( GLHandle, 'glCopyConvolutionFilter2D'); - glGetConvolutionFilter := GetModuleSymbol( GLHandle, 'glGetConvolutionFilter'); - glSeparableFilter2D := GetModuleSymbol( GLHandle, 'glSeparableFilter2D'); - glGetSeparableFilter := GetModuleSymbol( GLHandle, 'glGetSeparableFilter'); - glConvolutionParameteri := GetModuleSymbol( GLHandle, 'glConvolutionParameteri'); - glConvolutionParameteriv := GetModuleSymbol( GLHandle, 'glConvolutionParameteriv'); - glConvolutionParameterf := GetModuleSymbol( GLHandle, 'glConvolutionParameterf'); - glConvolutionParameterfv := GetModuleSymbol( GLHandle, 'glConvolutionParameterfv'); - glGetConvolutionParameteriv := GetModuleSymbol( GLHandle, 'glGetConvolutionParameteriv'); - glGetConvolutionParameterfv := GetModuleSymbol( GLHandle, 'glGetConvolutionParameterfv'); - glHistogram := GetModuleSymbol( GLHandle, 'glHistogram'); - glResetHistogram := GetModuleSymbol( GLHandle, 'glResetHistogram'); - glGetHistogram := GetModuleSymbol( GLHandle, 'glGetHistogram'); - glGetHistogramParameteriv := GetModuleSymbol( GLHandle, 'glGetHistogramParameteriv'); - glGetHistogramParameterfv := GetModuleSymbol( GLHandle, 'glGetHistogramParameterfv'); - glMinmax := GetModuleSymbol( GLHandle, 'glMinmax'); - glResetMinmax := GetModuleSymbol( GLHandle, 'glResetMinmax'); - glGetMinmax := GetModuleSymbol( GLHandle, 'glGetMinmax'); - glGetMinmaxParameteriv := GetModuleSymbol( GLHandle, 'glGetMinmaxParameteriv'); - glGetMinmaxParameterfv := GetModuleSymbol( GLHandle, 'glGetMinmaxParameterfv'); - - {$ifdef UNIX} - glXChooseVisual := GetModuleSymbol( GLHandle, 'glXChooseVisual'); - glXCreateContext := GetModuleSymbol( GLHandle, 'glXCreateContext'); - glXDestroyContext := GetModuleSymbol( GLHandle, 'glXDestroyContext'); - glXMakeCurrent := GetModuleSymbol( GLHandle, 'glXMakeCurrent'); - glXCopyContext := GetModuleSymbol( GLHandle, 'glXCopyContext'); - glXSwapBuffers := GetModuleSymbol( GLHandle, 'glXSwapBuffers'); - glXCreateGLXPixmap := GetModuleSymbol( GLHandle, 'glXCreateGLXPixmap'); - glXDestroyGLXPixmap := GetModuleSymbol( GLHandle, 'glXDestroyGLXPixmap'); - glXQueryExtension := GetModuleSymbol( GLHandle, 'glXQueryExtension'); - glXQueryVersion := GetModuleSymbol( GLHandle, 'glXQueryVersion'); - glXIsDirect := GetModuleSymbol( GLHandle, 'glXIsDirect'); - glXGetConfig := GetModuleSymbol( GLHandle, 'glXGetConfig'); - glXGetCurrentContext := GetModuleSymbol( GLHandle, 'glXGetCurrentContext'); - glXGetCurrentDrawable := GetModuleSymbol( GLHandle, 'glXGetCurrentDrawable'); - glXWaitGL := GetModuleSymbol( GLHandle, 'glXWaitGL'); - glXWaitX := GetModuleSymbol( GLHandle, 'glXWaitX'); - glXUseXFont := GetModuleSymbol( GLHandle, 'glXUseXFont'); - glXQueryExtensionsString := GetModuleSymbol( GLHandle, 'glXQueryExtensionsString'); - glXQueryServerString := GetModuleSymbol( GLHandle, 'glXQueryServerString'); - glXGetClientString := GetModuleSymbol( GLHandle, 'glXGetClientString'); - glXGetCurrentDisplay := GetModuleSymbol( GLHandle, 'glXGetCurrentDisplay'); - glXChooseFBConfig := GetModuleSymbol( GLHandle, 'glXChooseFBConfig'); - glXGetFBConfigAttrib := GetModuleSymbol( GLHandle, 'glXGetFBConfigAttrib'); - glXGetFBConfigs := GetModuleSymbol( GLHandle, 'glXGetFBConfigs'); - glXGetVisualFromFBConfig := GetModuleSymbol( GLHandle, 'glXGetVisualFromFBConfig'); - glXCreateWindow := GetModuleSymbol( GLHandle, 'glXCreateWindow'); - glXDestroyWindow := GetModuleSymbol( GLHandle, 'glXDestroyWindow'); - glXCreatePixmap := GetModuleSymbol( GLHandle, 'glXCreatePixmap'); - glXDestroyPixmap := GetModuleSymbol( GLHandle, 'glXDestroyPixmap'); - glXCreatePbuffer := GetModuleSymbol( GLHandle, 'glXCreatePbuffer'); - glXDestroyPbuffer := GetModuleSymbol( GLHandle, 'glXDestroyPbuffer'); - glXQueryDrawable := GetModuleSymbol( GLHandle, 'glXQueryDrawable'); - glXCreateNewContext := GetModuleSymbol( GLHandle, 'glXCreateNewContext'); - glXMakeContextCurrent := GetModuleSymbol( GLHandle, 'glXMakeContextCurrent'); - glXGetCurrentReadDrawable := GetModuleSymbol( GLHandle, 'glXGetCurrentReadDrawable'); - glXQueryContext := GetModuleSymbol( GLHandle, 'glXQueryContext'); - glXSelectEvent := GetModuleSymbol( GLHandle, 'glXSelectEvent'); - glXGetSelectedEvent := GetModuleSymbol( GLHandle, 'glXGetSelectedEvent'); - glXGetVideoSyncSGI := GetModuleSymbol( GLHandle, 'glXGetVideoSyncSGI'); - glXWaitVideoSyncSGI := GetModuleSymbol( GLHandle, 'glXWaitVideoSyncSGI'); - glXFreeContextEXT := GetModuleSymbol( GLHandle, 'glXFreeContextEXT'); - glXGetContextIDEXT := GetModuleSymbol( GLHandle, 'glXGetContextIDEXT'); - glXGetCurrentDisplayEXT := GetModuleSymbol( GLHandle, 'glXGetCurrentDisplayEXT'); - glXImportContextEXT := GetModuleSymbol( GLHandle, 'glXImportContextEXT'); - glXQueryContextInfoEXT := GetModuleSymbol( GLHandle, 'glXQueryContextInfoEXT'); - glXCopySubBufferMESA := GetModuleSymbol( GLHandle, 'glXCopySubBufferMESA'); - glXCreateGLXPixmapMESA := GetModuleSymbol( GLHandle, 'glXCreateGLXPixmapMESA'); - glXReleaseBuffersMESA := GetModuleSymbol( GLHandle, 'glXReleaseBuffersMESA'); - glXSet3DfxModeMESA := GetModuleSymbol( GLHandle, 'glXSet3DfxModeMESA'); - {$endif} - end; - - if GLUHandle <> INVALID_MODULEHANDLE then - begin - GLHandle := TModuleHandle(GLUHandle); // Kylix compatiblilty trick - - gluBeginCurve := GetModuleSymbol( GLUHandle, 'gluBeginCurve'); - gluBeginPolygon := GetModuleSymbol( GLUHandle, 'gluBeginPolygon'); - gluBeginSurface := GetModuleSymbol( GLUHandle, 'gluBeginSurface'); - gluBeginTrim := GetModuleSymbol( GLUHandle, 'gluBeginTrim'); - gluBuild1DMipmaps := GetModuleSymbol( GLUHandle, 'gluBuild1DMipmaps'); - gluBuild2DMipmaps := GetModuleSymbol( GLUHandle, 'gluBuild2DMipmaps'); - gluCylinder := GetModuleSymbol( GLUHandle, 'gluCylinder'); - gluDeleteNurbsRenderer := GetModuleSymbol( GLUHandle, 'gluDeleteNurbsRenderer'); - gluDeleteQuadric := GetModuleSymbol( GLUHandle, 'gluDeleteQuadric'); - gluDeleteTess := GetModuleSymbol( GLUHandle, 'gluDeleteTess'); - gluDisk := GetModuleSymbol( GLUHandle, 'gluDisk'); - gluEndCurve := GetModuleSymbol( GLUHandle, 'gluEndCurve'); - gluEndPolygon := GetModuleSymbol( GLUHandle, 'gluEndPolygon'); - gluEndSurface := GetModuleSymbol( GLUHandle, 'gluEndSurface'); - gluEndTrim := GetModuleSymbol( GLUHandle, 'gluEndTrim'); - gluErrorString := GetModuleSymbol( GLUHandle, 'gluErrorString'); - gluGetNurbsProperty := GetModuleSymbol( GLUHandle, 'gluGetNurbsProperty'); - gluGetString := GetModuleSymbol( GLUHandle, 'gluGetString'); - gluGetTessProperty := GetModuleSymbol( GLUHandle, 'gluGetTessProperty'); - gluLoadSamplingMatrices := GetModuleSymbol( GLUHandle, 'gluLoadSamplingMatrices'); - gluLookAt := GetModuleSymbol( GLUHandle, 'gluLookAt'); - gluNewNurbsRenderer := GetModuleSymbol( GLUHandle, 'gluNewNurbsRenderer'); - gluNewQuadric := GetModuleSymbol( GLUHandle, 'gluNewQuadric'); - gluNewTess := GetModuleSymbol( GLUHandle, 'gluNewTess'); - gluNextContour := GetModuleSymbol( GLUHandle, 'gluNextContour'); - gluNurbsCallback := GetModuleSymbol( GLUHandle, 'gluNurbsCallback'); - gluNurbsCurve := GetModuleSymbol( GLUHandle, 'gluNurbsCurve'); - gluNurbsProperty := GetModuleSymbol( GLUHandle, 'gluNurbsProperty'); - gluNurbsSurface := GetModuleSymbol( GLUHandle, 'gluNurbsSurface'); - gluOrtho2D := GetModuleSymbol( GLUHandle, 'gluOrtho2D'); - gluPartialDisk := GetModuleSymbol( GLUHandle, 'gluPartialDisk'); - gluPerspective := GetModuleSymbol( GLUHandle, 'gluPerspective'); - gluPickMatrix := GetModuleSymbol( GLUHandle, 'gluPickMatrix'); - gluProject := GetModuleSymbol( GLUHandle, 'gluProject'); - gluPwlCurve := GetModuleSymbol( GLUHandle, 'gluPwlCurve'); - gluQuadricCallback := GetModuleSymbol( GLUHandle, 'gluQuadricCallback'); - gluQuadricDrawStyle := GetModuleSymbol( GLUHandle, 'gluQuadricDrawStyle'); - gluQuadricNormals := GetModuleSymbol( GLUHandle, 'gluQuadricNormals'); - gluQuadricOrientation := GetModuleSymbol( GLUHandle, 'gluQuadricOrientation'); - gluQuadricTexture := GetModuleSymbol( GLUHandle, 'gluQuadricTexture'); - gluScaleImage := GetModuleSymbol( GLUHandle, 'gluScaleImage'); - gluSphere := GetModuleSymbol( GLUHandle, 'gluSphere'); - gluTessBeginContour := GetModuleSymbol( GLUHandle, 'gluTessBeginContour'); - gluTessBeginPolygon := GetModuleSymbol( GLUHandle, 'gluTessBeginPolygon'); - gluTessCallback := GetModuleSymbol( GLUHandle, 'gluTessCallback'); - gluTessEndContour := GetModuleSymbol( GLUHandle, 'gluTessEndContour'); - gluTessEndPolygon := GetModuleSymbol( GLUHandle, 'gluTessEndPolygon'); - gluTessNormal := GetModuleSymbol( GLUHandle, 'gluTessNormal'); - gluTessProperty := GetModuleSymbol( GLUHandle, 'gluTessProperty'); - gluTessVertex := GetModuleSymbol( GLUHandle, 'gluTessVertex'); - gluUnProject := GetModuleSymbol( GLUHandle, 'gluUnProject'); - end; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -procedure ClearExtensions; - -begin - glArrayElementEXT := nil; - glDrawArraysEXT := nil; - glVertexPointerEXT := nil; - glNormalPointerEXT := nil; - glColorPointerEXT := nil; - glIndexPointerEXT := nil; - glTexCoordPointerEXT := nil; - glEdgeFlagPointerEXT := nil; - glGetPointervEXT := nil; - glArrayElementArrayEXT := nil; - glAddSwapHintRectWIN := nil; - glColorTableEXT := nil; - glColorSubTableEXT := nil; - glGetColorTableEXT := nil; - glGetColorTablePameterivEXT := nil; - glGetColorTablePameterfvEXT := nil; - gluNurbsCallbackDataEXT := nil; - gluNewNurbsTessellatorEXT := nil; - gluDeleteNurbsTessellatorEXT := nil; - glLockArraysEXT := nil; - glUnlockArraysEXT := nil; - glCopyTexImage1DEXT := nil; - glCopyTexSubImage1DEXT := nil; - glCopyTexImage2DEXT := nil; - glCopyTexSubImage2DEXT := nil; - glCopyTexSubImage3DEXT := nil; - glCullParameterfvEXT := nil; - glCullParameterdvEXT := nil; - glIndexFuncEXT := nil; - glIndexMaterialEXT := nil; - glPolygonOffsetEXT := nil; - glTexSubImage1DEXT := nil; - glTexSubImage2DEXT := nil; - glTexSubImage3DEXT := nil; - glGenTexturesEXT := nil; - glDeleteTexturesEXT := nil; - glBindTextureEXT := nil; - glPrioritizeTexturesEXT := nil; - glAreTexturesResidentEXT := nil; - glIsTextureEXT := nil; - - glMultiTexCoord1dARB := nil; - glMultiTexCoord1dVARB := nil; - glMultiTexCoord1fARBP := nil; - glMultiTexCoord1fVARB := nil; - glMultiTexCoord1iARB := nil; - glMultiTexCoord1iVARB := nil; - glMultiTexCoord1sARBP := nil; - glMultiTexCoord1sVARB := nil; - glMultiTexCoord2dARB := nil; - glMultiTexCoord2dvARB := nil; - glMultiTexCoord2fARB := nil; - glMultiTexCoord2fvARB := nil; - glMultiTexCoord2iARB := nil; - glMultiTexCoord2ivARB := nil; - glMultiTexCoord2sARB := nil; - glMultiTexCoord2svARB := nil; - glMultiTexCoord3dARB := nil; - glMultiTexCoord3dvARB := nil; - glMultiTexCoord3fARB := nil; - glMultiTexCoord3fvARB := nil; - glMultiTexCoord3iARB := nil; - glMultiTexCoord3ivARB := nil; - glMultiTexCoord3sARB := nil; - glMultiTexCoord3svARB := nil; - glMultiTexCoord4dARB := nil; - glMultiTexCoord4dvARB := nil; - glMultiTexCoord4fARB := nil; - glMultiTexCoord4fvARB := nil; - glMultiTexCoord4iARB := nil; - glMultiTexCoord4ivARB := nil; - glMultiTexCoord4sARB := nil; - glMultiTexCoord4svARB := nil; - glActiveTextureARB := nil; - glClientActiveTextureARB := nil; - - // EXT_compiled_vertex_array - glLockArrayEXT := nil; - glUnlockArrayEXT := nil; - - // EXT_cull_vertex - glCullParameterdvEXT := nil; - glCullParameterfvEXT := nil; - - // WIN_swap_hint - glAddSwapHintRectWIN := nil; - - // EXT_point_parameter - glPointParameterfEXT := nil; - glPointParameterfvEXT := nil; - - // GL_ARB_transpose_matrix - glLoadTransposeMatrixfARB := nil; - glLoadTransposeMatrixdARB := nil; - glMultTransposeMatrixfARB := nil; - glMultTransposeMatrixdARB := nil; - - glSampleCoverageARB := nil; - glSamplePassARB := nil; - - // GL_ARB_multisample - glCompressedTexImage3DARB := nil; - glCompressedTexImage2DARB := nil; - glCompressedTexImage1DARB := nil; - glCompressedTexSubImage3DARB := nil; - glCompressedTexSubImage2DARB := nil; - glCompressedTexSubImage1DARB := nil; - glGetCompressedTexImageARB := nil; - - // GL_EXT_blend_color - glBlendColorEXT := nil; - - // GL_EXT_texture3D - glTexImage3DEXT := nil; - - // GL_SGIS_texture_filter4 - glGetTexFilterFuncSGIS := nil; - glTexFilterFuncSGIS := nil; - - // GL_EXT_histogram - glGetHistogramEXT := nil; - glGetHistogramParameterfvEXT := nil; - glGetHistogramParameterivEXT := nil; - glGetMinmaxEXT := nil; - glGetMinmaxParameterfvEXT := nil; - glGetMinmaxParameterivEXT := nil; - glHistogramEXT := nil; - glMinmaxEXT := nil; - glResetHistogramEXT := nil; - glResetMinmaxEXT := nil; - - // GL_EXT_convolution - glConvolutionFilter1DEXT := nil; - glConvolutionFilter2DEXT := nil; - glConvolutionParameterfEXT := nil; - glConvolutionParameterfvEXT := nil; - glConvolutionParameteriEXT := nil; - glConvolutionParameterivEXT := nil; - glCopyConvolutionFilter1DEXT := nil; - glCopyConvolutionFilter2DEXT := nil; - glGetConvolutionFilterEXT := nil; - glGetConvolutionParameterfvEXT := nil; - glGetConvolutionParameterivEXT := nil; - glGetSeparableFilterEXT := nil; - glSeparableFilter2DEXT := nil; - - // GL_SGI_color_table - glColorTableSGI := nil; - glColorTableParameterfvSGI := nil; - glColorTableParameterivSGI := nil; - glCopyColorTableSGI := nil; - glGetColorTableSGI := nil; - glGetColorTableParameterfvSGI := nil; - glGetColorTableParameterivSGI := nil; - - // GL_SGIX_pixel_texture - glPixelTexGenSGIX := nil; - - // GL_SGIS_pixel_texture - glPixelTexGenParameteriSGIS := nil; - glPixelTexGenParameterivSGIS := nil; - glPixelTexGenParameterfSGIS := nil; - glPixelTexGenParameterfvSGIS := nil; - glGetPixelTexGenParameterivSGIS := nil; - glGetPixelTexGenParameterfvSGIS := nil; - - // GL_SGIS_texture4D - glTexImage4DSGIS := nil; - glTexSubImage4DSGIS := nil; - - // GL_SGIS_detail_texture - glDetailTexFuncSGIS := nil; - glGetDetailTexFuncSGIS := nil; - - // GL_SGIS_sharpen_texture - glSharpenTexFuncSGIS := nil; - glGetSharpenTexFuncSGIS := nil; - - // GL_SGIS_multisample - glSampleMaskSGIS := nil; - glSamplePatternSGIS := nil; - - // GL_EXT_blend_minmax - glBlendEquationEXT := nil; - - // GL_SGIX_sprite - glSpriteParameterfSGIX := nil; - glSpriteParameterfvSGIX := nil; - glSpriteParameteriSGIX := nil; - glSpriteParameterivSGIX := nil; - - // GL_EXT_point_parameters - glPointParameterfSGIS := nil; - glPointParameterfvSGIS := nil; - - // GL_SGIX_instruments - glGetInstrumentsSGIX := nil; - glInstrumentsBufferSGIX := nil; - glPollInstrumentsSGIX := nil; - glReadInstrumentsSGIX := nil; - glStartInstrumentsSGIX := nil; - glStopInstrumentsSGIX := nil; - - // GL_SGIX_framezoom - glFrameZoomSGIX := nil; - - // GL_SGIX_tag_sample_buffer - glTagSampleBufferSGIX := nil; - - // GL_SGIX_polynomial_ffd - glDeformationMap3dSGIX := nil; - glDeformationMap3fSGIX := nil; - glDeformSGIX := nil; - glLoadIdentityDeformationMapSGIX := nil; - - // GL_SGIX_reference_plane - glReferencePlaneSGIX := nil; - - // GL_SGIX_flush_raster - glFlushRasterSGIX := nil; - - // GL_SGIS_fog_function - glFogFuncSGIS := nil; - glGetFogFuncSGIS := nil; - - // GL_HP_image_transform - glImageTransformParameteriHP := nil; - glImageTransformParameterfHP := nil; - glImageTransformParameterivHP := nil; - glImageTransformParameterfvHP := nil; - glGetImageTransformParameterivHP := nil; - glGetImageTransformParameterfvHP := nil; - - // GL_EXT_color_subtable - glCopyColorSubTableEXT := nil; - - // GL_PGI_misc_hints - glHintPGI := nil; - - // GL_EXT_paletted_texture - glGetColorTableParameterivEXT := nil; - glGetColorTableParameterfvEXT := nil; - - // GL_SGIX_list_priority - glGetListParameterfvSGIX := nil; - glGetListParameterivSGIX := nil; - glListParameterfSGIX := nil; - glListParameterfvSGIX := nil; - glListParameteriSGIX := nil; - glListParameterivSGIX := nil; - - // GL_SGIX_fragment_lighting - glFragmentColorMaterialSGIX := nil; - glFragmentLightfSGIX := nil; - glFragmentLightfvSGIX := nil; - glFragmentLightiSGIX := nil; - glFragmentLightivSGIX := nil; - glFragmentLightModelfSGIX := nil; - glFragmentLightModelfvSGIX := nil; - glFragmentLightModeliSGIX := nil; - glFragmentLightModelivSGIX := nil; - glFragmentMaterialfSGIX := nil; - glFragmentMaterialfvSGIX := nil; - glFragmentMaterialiSGIX := nil; - glFragmentMaterialivSGIX := nil; - glGetFragmentLightfvSGIX := nil; - glGetFragmentLightivSGIX := nil; - glGetFragmentMaterialfvSGIX := nil; - glGetFragmentMaterialivSGIX := nil; - glLightEnviSGIX := nil; - - // GL_EXT_draw_range_elements - glDrawRangeElementsEXT := nil; - - // GL_EXT_light_texture - glApplyTextureEXT := nil; - glTextureLightEXT := nil; - glTextureMaterialEXT := nil; - - // GL_SGIX_async - glAsyncMarkerSGIX := nil; - glFinishAsyncSGIX := nil; - glPollAsyncSGIX := nil; - glGenAsyncMarkersSGIX := nil; - glDeleteAsyncMarkersSGIX := nil; - glIsAsyncMarkerSGIX := nil; - - // GL_INTEL_parallel_arrays - glVertexPointervINTEL := nil; - glNormalPointervINTEL := nil; - glColorPointervINTEL := nil; - glTexCoordPointervINTEL := nil; - - // GL_EXT_pixel_transform - glPixelTransformParameteriEXT := nil; - glPixelTransformParameterfEXT := nil; - glPixelTransformParameterivEXT := nil; - glPixelTransformParameterfvEXT := nil; - - // GL_EXT_secondary_color - glSecondaryColor3bEXT := nil; - glSecondaryColor3bvEXT := nil; - glSecondaryColor3dEXT := nil; - glSecondaryColor3dvEXT := nil; - glSecondaryColor3fEXT := nil; - glSecondaryColor3fvEXT := nil; - glSecondaryColor3iEXT := nil; - glSecondaryColor3ivEXT := nil; - glSecondaryColor3sEXT := nil; - glSecondaryColor3svEXT := nil; - glSecondaryColor3ubEXT := nil; - glSecondaryColor3ubvEXT := nil; - glSecondaryColor3uiEXT := nil; - glSecondaryColor3uivEXT := nil; - glSecondaryColor3usEXT := nil; - glSecondaryColor3usvEXT := nil; - glSecondaryColorPointerEXT := nil; - - // GL_EXT_texture_perturb_normal - glTextureNormalEXT := nil; - - // GL_EXT_multi_draw_arrays - glMultiDrawArraysEXT := nil; - glMultiDrawElementsEXT := nil; - - // GL_EXT_fog_coord - glFogCoordfEXT := nil; - glFogCoordfvEXT := nil; - glFogCoorddEXT := nil; - glFogCoorddvEXT := nil; - glFogCoordPointerEXT := nil; - - // GL_EXT_coordinate_frame - glTangent3bEXT := nil; - glTangent3bvEXT := nil; - glTangent3dEXT := nil; - glTangent3dvEXT := nil; - glTangent3fEXT := nil; - glTangent3fvEXT := nil; - glTangent3iEXT := nil; - glTangent3ivEXT := nil; - glTangent3sEXT := nil; - glTangent3svEXT := nil; - glBinormal3bEXT := nil; - glBinormal3bvEXT := nil; - glBinormal3dEXT := nil; - glBinormal3dvEXT := nil; - glBinormal3fEXT := nil; - glBinormal3fvEXT := nil; - glBinormal3iEXT := nil; - glBinormal3ivEXT := nil; - glBinormal3sEXT := nil; - glBinormal3svEXT := nil; - glTangentPointerEXT := nil; - glBinormalPointerEXT := nil; - - // GL_SUNX_constant_data - glFinishTextureSUNX := nil; - - // GL_SUN_global_alpha - glGlobalAlphaFactorbSUN := nil; - glGlobalAlphaFactorsSUN := nil; - glGlobalAlphaFactoriSUN := nil; - glGlobalAlphaFactorfSUN := nil; - glGlobalAlphaFactordSUN := nil; - glGlobalAlphaFactorubSUN := nil; - glGlobalAlphaFactorusSUN := nil; - glGlobalAlphaFactoruiSUN := nil; - - // GL_SUN_triangle_list - glReplacementCodeuiSUN := nil; - glReplacementCodeusSUN := nil; - glReplacementCodeubSUN := nil; - glReplacementCodeuivSUN := nil; - glReplacementCodeusvSUN := nil; - glReplacementCodeubvSUN := nil; - glReplacementCodePointerSUN := nil; - - // GL_SUN_vertex - glColor4ubVertex2fSUN := nil; - glColor4ubVertex2fvSUN := nil; - glColor4ubVertex3fSUN := nil; - glColor4ubVertex3fvSUN := nil; - glColor3fVertex3fSUN := nil; - glColor3fVertex3fvSUN := nil; - glNormal3fVertex3fSUN := nil; - glNormal3fVertex3fvSUN := nil; - glColor4fNormal3fVertex3fSUN := nil; - glColor4fNormal3fVertex3fvSUN := nil; - glTexCoord2fVertex3fSUN := nil; - glTexCoord2fVertex3fvSUN := nil; - glTexCoord4fVertex4fSUN := nil; - glTexCoord4fVertex4fvSUN := nil; - glTexCoord2fColor4ubVertex3fSUN := nil; - glTexCoord2fColor4ubVertex3fvSUN := nil; - glTexCoord2fColor3fVertex3fSUN := nil; - glTexCoord2fColor3fVertex3fvSUN := nil; - glTexCoord2fNormal3fVertex3fSUN := nil; - glTexCoord2fNormal3fVertex3fvSUN := nil; - glTexCoord2fColor4fNormal3fVertex3fSUN := nil; - glTexCoord2fColor4fNormal3fVertex3fvSUN := nil; - glTexCoord4fColor4fNormal3fVertex4fSUN := nil; - glTexCoord4fColor4fNormal3fVertex4fvSUN := nil; - glReplacementCodeuiVertex3fSUN := nil; - glReplacementCodeuiVertex3fvSUN := nil; - glReplacementCodeuiColor4ubVertex3fSUN := nil; - glReplacementCodeuiColor4ubVertex3fvSUN := nil; - glReplacementCodeuiColor3fVertex3fSUN := nil; - glReplacementCodeuiColor3fVertex3fvSUN := nil; - glReplacementCodeuiNormal3fVertex3fSUN := nil; - glReplacementCodeuiNormal3fVertex3fvSUN := nil; - glReplacementCodeuiColor4fNormal3fVertex3fSUN := nil; - glReplacementCodeuiColor4fNormal3fVertex3fvSUN := nil; - glReplacementCodeuiTexCoord2fVertex3fSUN := nil; - glReplacementCodeuiTexCoord2fVertex3fvSUN := nil; - glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN := nil; - glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN := nil; - glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN := nil; - glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN := nil; - - // GL_EXT_blend_func_separate - glBlendFuncSeparateEXT := nil; - - // GL_EXT_vertex_weighting - glVertexWeightfEXT := nil; - glVertexWeightfvEXT := nil; - glVertexWeightPointerEXT := nil; - - // GL_NV_vertex_array_range - glFlushVertexArrayRangeNV := nil; - glVertexArrayRangeNV := nil; - wglAllocateMemoryNV := nil; - wglFreeMemoryNV := nil; - - // GL_NV_register_combiners - glCombinerParameterfvNV := nil; - glCombinerParameterfNV := nil; - glCombinerParameterivNV := nil; - glCombinerParameteriNV := nil; - glCombinerInputNV := nil; - glCombinerOutputNV := nil; - glFinalCombinerInputNV := nil; - glGetCombinerInputParameterfvNV := nil; - glGetCombinerInputParameterivNV := nil; - glGetCombinerOutputParameterfvNV := nil; - glGetCombinerOutputParameterivNV := nil; - glGetFinalCombinerInputParameterfvNV := nil; - glGetFinalCombinerInputParameterivNV := nil; - - // GL_MESA_resize_buffers - glResizeBuffersMESA := nil; - - // GL_MESA_window_pos - glWindowPos2dMESA := nil; - glWindowPos2dvMESA := nil; - glWindowPos2fMESA := nil; - glWindowPos2fvMESA := nil; - glWindowPos2iMESA := nil; - glWindowPos2ivMESA := nil; - glWindowPos2sMESA := nil; - glWindowPos2svMESA := nil; - glWindowPos3dMESA := nil; - glWindowPos3dvMESA := nil; - glWindowPos3fMESA := nil; - glWindowPos3fvMESA := nil; - glWindowPos3iMESA := nil; - glWindowPos3ivMESA := nil; - glWindowPos3sMESA := nil; - glWindowPos3svMESA := nil; - glWindowPos4dMESA := nil; - glWindowPos4dvMESA := nil; - glWindowPos4fMESA := nil; - glWindowPos4fvMESA := nil; - glWindowPos4iMESA := nil; - glWindowPos4ivMESA := nil; - glWindowPos4sMESA := nil; - glWindowPos4svMESA := nil; - - // GL_IBM_multimode_draw_arrays - glMultiModeDrawArraysIBM := nil; - glMultiModeDrawElementsIBM := nil; - - // GL_IBM_vertex_array_lists - glColorPointerListIBM := nil; - glSecondaryColorPointerListIBM := nil; - glEdgeFlagPointerListIBM := nil; - glFogCoordPointerListIBM := nil; - glIndexPointerListIBM := nil; - glNormalPointerListIBM := nil; - glTexCoordPointerListIBM := nil; - glVertexPointerListIBM := nil; - - // GL_3DFX_tbuffer - glTbufferMask3DFX := nil; - - // GL_EXT_multisample - glSampleMaskEXT := nil; - glSamplePatternEXT := nil; - - // GL_SGIS_texture_color_mask - glTextureColorMaskSGIS := nil; - - // GL_SGIX_igloo_interface - glIglooInterfaceSGIX := nil; - - // GLU extensions - gluNurbsCallbackDataEXT := nil; - gluNewNurbsTessellatorEXT := nil; - gluDeleteNurbsTessellatorEXT := nil; - - // GL_NV_vertex_program - glAreProgramsResidentNV := nil; - glBindProgramNV := nil; - glDeleteProgramsNV := nil; - glExecuteProgramNV := nil; - glGenProgramsNV := nil; - glGetProgramParameterdvNV := nil; - glGetProgramParameterfvNV := nil; - glGetProgramivNV := nil; - glGetProgramStringNV := nil; - glGetTrackMatrixivNV := nil; - glGetVertexAttribdvNV:= nil; - glGetVertexAttribfvNV:= nil; - glGetVertexAttribivNV:= nil; - glGetVertexAttribPointervNV := nil; - glIsProgramNV := nil; - glLoadProgramNV := nil; - glProgramParameter4dNV := nil; - glProgramParameter4dvNV := nil; - glProgramParameter4fNV := nil; - glProgramParameter4fvNV := nil; - glProgramParameters4dvNV := nil; - glProgramParameters4fvNV := nil; - glRequestResidentProgramsNV := nil; - glTrackMatrixNV := nil; - glVertexAttribPointerNV := nil; - glVertexAttrib1dNV := nil; - glVertexAttrib1dvNV := nil; - glVertexAttrib1fNV := nil; - glVertexAttrib1fvNV := nil; - glVertexAttrib1sNV := nil; - glVertexAttrib1svNV := nil; - glVertexAttrib2dNV := nil; - glVertexAttrib2dvNV := nil; - glVertexAttrib2fNV := nil; - glVertexAttrib2fvNV := nil; - glVertexAttrib2sNV := nil; - glVertexAttrib2svNV := nil; - glVertexAttrib3dNV := nil; - glVertexAttrib3dvNV := nil; - glVertexAttrib3fNV := nil; - glVertexAttrib3fvNV := nil; - glVertexAttrib3sNV := nil; - glVertexAttrib3svNV := nil; - glVertexAttrib4dNV := nil; - glVertexAttrib4dvNV := nil; - glVertexAttrib4fNV := nil; - glVertexAttrib4fvNV := nil; - glVertexAttrib4sNV := nil; - glVertexAttrib4svNV := nil; - glVertexAttrib4ubvNV := nil; - glVertexAttribs1dvNV := nil; - glVertexAttribs1fvNV := nil; - glVertexAttribs1svNV := nil; - glVertexAttribs2dvNV := nil; - glVertexAttribs2fvNV := nil; - glVertexAttribs2svNV := nil; - glVertexAttribs3dvNV := nil; - glVertexAttribs3fvNV := nil; - glVertexAttribs3svNV := nil; - glVertexAttribs4dvNV := nil; - glVertexAttribs4fvNV := nil; - glVertexAttribs4svNV := nil; - glVertexAttribs4ubvNV := nil; - - LastPixelFormat := 0; // to get synchronized again, if this proc was called from outside -end; - -//---------------------------------------------------------------------------------------------------------------------- - -{$ifdef Win32} - -function HasActiveContext: Boolean; - -// Returns True if the caller thread has an active (current) rendering context. - -begin - Result := ActivationRefCount > 0; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -procedure ReadExtensions; -begin - if GLHandle <> INVALID_MODULEHANDLE then - begin - // GL extensions - glArrayElementArrayEXT := SDL_GL_GetProcAddress( 'glArrayElementArrayEXT'); - glColorTableEXT := SDL_GL_GetProcAddress( 'glColorTableEXT'); - glColorSubTableEXT := SDL_GL_GetProcAddress( 'glColorSubTableEXT'); - glGetColorTableEXT := SDL_GL_GetProcAddress( 'glGetColorTableEXT'); - glGetColorTablePameterivEXT := SDL_GL_GetProcAddress( 'glGetColorTablePameterivEXT'); - glGetColorTablePameterfvEXT := SDL_GL_GetProcAddress( 'glGetColorTablePameterfvEXT'); - glLockArraysEXT := SDL_GL_GetProcAddress( 'glLockArraysEXT'); - glUnlockArraysEXT := SDL_GL_GetProcAddress( 'glUnlockArraysEXT'); - glCopyTexImage1DEXT := SDL_GL_GetProcAddress( 'glCopyTexImage1DEXT'); - glCopyTexSubImage1DEXT := SDL_GL_GetProcAddress( 'glCopyTexSubImage1DEXT'); - glCopyTexImage2DEXT := SDL_GL_GetProcAddress( 'glCopyTexImage2DEXT'); - glCopyTexSubImage2DEXT := SDL_GL_GetProcAddress( 'glCopyTexSubImage2DEXT'); - glCopyTexSubImage3DEXT := SDL_GL_GetProcAddress( 'glCopyTexSubImage3DEXT'); - glIndexFuncEXT := GetModuleSymbol( GLHandle, 'glIndexFuncEXT'); - glIndexMaterialEXT := SDL_GL_GetProcAddress( 'glIndexMaterialEXT'); - glPolygonOffsetEXT := SDL_GL_GetProcAddress( 'glPolygonOffsetEXT'); - glTexSubImage1dEXT := SDL_GL_GetProcAddress( 'glTexSubImage1DEXT'); - glTexSubImage2dEXT := SDL_GL_GetProcAddress( 'glTexSubImage2DEXT'); - glTexSubImage3dEXT := SDL_GL_GetProcAddress( 'glTexSubImage3DEXT'); - glGenTexturesEXT := SDL_GL_GetProcAddress( 'glGenTexturesEXT'); - glDeleteTexturesEXT := SDL_GL_GetProcAddress( 'glDeleteTexturesEXT'); - glBindTextureEXT := SDL_GL_GetProcAddress( 'glBindTextureEXT'); - glPrioritizeTexturesEXT := SDL_GL_GetProcAddress( 'glPrioritizeTexturesEXT'); - glAreTexturesResidentEXT := SDL_GL_GetProcAddress( 'glAreTexturesResidentEXT'); - glIsTextureEXT := GetModuleSymbol( GLHandle, 'glIsTextureEXT'); - - // EXT_vertex_array - glArrayElementEXT := SDL_GL_GetProcAddress( 'glArrayElementEXT'); - glColorPointerEXT := SDL_GL_GetProcAddress( 'glColorPointerEXT'); - glDrawArraysEXT := SDL_GL_GetProcAddress( 'glDrawArraysEXT'); - glEdgeFlagPointerEXT := SDL_GL_GetProcAddress( 'glEdgeFlagPointerEXT'); - glGetPointervEXT := SDL_GL_GetProcAddress( 'glGetPointervEXT'); - glIndexPointerEXT := SDL_GL_GetProcAddress( 'glIndexPointerEXT'); - glNormalPointerEXT := SDL_GL_GetProcAddress( 'glNormalPointerEXT'); - glTexCoordPointerEXT := SDL_GL_GetProcAddress( 'glTexCoordPointerEXT'); - glVertexPointerEXT := SDL_GL_GetProcAddress( 'glVertexPointerEXT'); - - // ARB_multitexture - glMultiTexCoord1dARB := SDL_GL_GetProcAddress( 'glMultiTexCoord1dARB'); - glMultiTexCoord1dVARB := SDL_GL_GetProcAddress( 'glMultiTexCoord1dVARB'); - glMultiTexCoord1fARBP := SDL_GL_GetProcAddress( 'glMultiTexCoord1fARBP'); - glMultiTexCoord1fVARB := SDL_GL_GetProcAddress( 'glMultiTexCoord1fVARB'); - glMultiTexCoord1iARB := SDL_GL_GetProcAddress( 'glMultiTexCoord1iARB'); - glMultiTexCoord1iVARB := SDL_GL_GetProcAddress( 'glMultiTexCoord1iVARB'); - glMultiTexCoord1sARBP := SDL_GL_GetProcAddress( 'glMultiTexCoord1sARBP'); - glMultiTexCoord1sVARB := SDL_GL_GetProcAddress( 'glMultiTexCoord1sVARB'); - glMultiTexCoord2dARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2dARB'); - glMultiTexCoord2dvARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2dvARB'); - glMultiTexCoord2fARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2fARB'); - glMultiTexCoord2fvARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2fvARB'); - glMultiTexCoord2iARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2iARB'); - glMultiTexCoord2ivARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2ivARB'); - glMultiTexCoord2sARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2sARB'); - glMultiTexCoord2svARB := SDL_GL_GetProcAddress( 'glMultiTexCoord2svARB'); - glMultiTexCoord3dARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3dARB'); - glMultiTexCoord3dvARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3dvARB'); - glMultiTexCoord3fARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3fARB'); - glMultiTexCoord3fvARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3fvARB'); - glMultiTexCoord3iARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3iARB'); - glMultiTexCoord3ivARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3ivARB'); - glMultiTexCoord3sARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3sARB'); - glMultiTexCoord3svARB := SDL_GL_GetProcAddress( 'glMultiTexCoord3svARB'); - glMultiTexCoord4dARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4dARB'); - glMultiTexCoord4dvARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4dvARB'); - glMultiTexCoord4fARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4fARB'); - glMultiTexCoord4fvARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4fvARB'); - glMultiTexCoord4iARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4iARB'); - glMultiTexCoord4ivARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4ivARB'); - glMultiTexCoord4sARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4sARB'); - glMultiTexCoord4svARB := SDL_GL_GetProcAddress( 'glMultiTexCoord4svARB'); - glActiveTextureARB := SDL_GL_GetProcAddress( 'glActiveTextureARB'); - glClientActiveTextureARB := SDL_GL_GetProcAddress( 'glClientActiveTextureARB'); - - // EXT_compiled_vertex_array - glLockArrayEXT := SDL_GL_GetProcAddress( 'glLockArrayEXT'); - glUnlockArrayEXT := SDL_GL_GetProcAddress( 'glUnlockArrayEXT'); - - // EXT_cull_vertex - glCullParameterdvEXT := SDL_GL_GetProcAddress( 'glCullParameterdvEXT'); - glCullParameterfvEXT := SDL_GL_GetProcAddress( 'glCullParameterfvEXT'); - - // WIN_swap_hint - glAddSwapHintRectWIN := SDL_GL_GetProcAddress( 'glAddSwapHintRectWIN'); - - // EXT_point_parameter - glPointParameterfEXT := SDL_GL_GetProcAddress( 'glPointParameterfEXT'); - glPointParameterfvEXT := SDL_GL_GetProcAddress( 'glPointParameterfvEXT'); - - // GL_ARB_transpose_matrix - glLoadTransposeMatrixfARB := SDL_GL_GetProcAddress( 'glLoadTransposeMatrixfARB'); - glLoadTransposeMatrixdARB := SDL_GL_GetProcAddress( 'glLoadTransposeMatrixdARB'); - glMultTransposeMatrixfARB := SDL_GL_GetProcAddress( 'glMultTransposeMatrixfARB'); - glMultTransposeMatrixdARB := SDL_GL_GetProcAddress( 'glMultTransposeMatrixdARB'); - - glSampleCoverageARB := SDL_GL_GetProcAddress( 'glSampleCoverageARB'); - glSamplePassARB := SDL_GL_GetProcAddress( 'glSamplePassARB'); - - // GL_ARB_multisample - glCompressedTexImage3DARB := SDL_GL_GetProcAddress( 'glCompressedTexImage3DARB'); - glCompressedTexImage2DARB := SDL_GL_GetProcAddress( 'glCompressedTexImage2DARB'); - glCompressedTexImage1DARB := SDL_GL_GetProcAddress( 'glCompressedTexImage1DARB'); - glCompressedTexSubImage3DARB := SDL_GL_GetProcAddress( 'glCompressedTexSubImage3DARB'); - glCompressedTexSubImage2DARB := SDL_GL_GetProcAddress( 'glCompressedTexSubImage2DARB'); - glCompressedTexSubImage1DARB := SDL_GL_GetProcAddress( 'glCompressedTexSubImage1DARB'); - glGetCompressedTexImageARB := SDL_GL_GetProcAddress( 'glGetCompressedTexImageARB'); - - // GL_EXT_blend_color - glBlendColorEXT := SDL_GL_GetProcAddress( 'glBlendColorEXT'); - - // GL_EXT_texture3D - glTexImage3DEXT := SDL_GL_GetProcAddress( 'glTexImage3DEXT'); - - // GL_SGIS_texture_filter4 - glGetTexFilterFuncSGIS := SDL_GL_GetProcAddress( 'glGetTexFilterFuncSGIS'); - glTexFilterFuncSGIS := SDL_GL_GetProcAddress( 'glTexFilterFuncSGIS'); - - // GL_EXT_histogram - glGetHistogramEXT := SDL_GL_GetProcAddress( 'glGetHistogramEXT'); - glGetHistogramParameterfvEXT := SDL_GL_GetProcAddress( 'glGetHistogramParameterfvEXT'); - glGetHistogramParameterivEXT := SDL_GL_GetProcAddress( 'glGetHistogramParameterivEXT'); - glGetMinmaxEXT := SDL_GL_GetProcAddress( 'glGetMinmaxEXT'); - glGetMinmaxParameterfvEXT := SDL_GL_GetProcAddress( 'glGetMinmaxParameterfvEXT'); - glGetMinmaxParameterivEXT := SDL_GL_GetProcAddress( 'glGetMinmaxParameterivEXT'); - glHistogramEXT := SDL_GL_GetProcAddress( 'glHistogramEXT'); - glMinmaxEXT := SDL_GL_GetProcAddress( 'glMinmaxEXT'); - glResetHistogramEXT := SDL_GL_GetProcAddress( 'glResetHistogramEXT'); - glResetMinmaxEXT := SDL_GL_GetProcAddress( 'glResetMinmaxEXT'); - - // GL_EXT_convolution - glConvolutionFilter1DEXT := SDL_GL_GetProcAddress( 'glConvolutionFilter1DEXT'); - glConvolutionFilter2DEXT := SDL_GL_GetProcAddress( 'glConvolutionFilter2DEXT'); - glConvolutionParameterfEXT := SDL_GL_GetProcAddress( 'glConvolutionParameterfEXT'); - glConvolutionParameterfvEXT := SDL_GL_GetProcAddress( 'glConvolutionParameterfvEXT'); - glConvolutionParameteriEXT := SDL_GL_GetProcAddress( 'glConvolutionParameteriEXT'); - glConvolutionParameterivEXT := SDL_GL_GetProcAddress( 'glConvolutionParameterivEXT'); - glCopyConvolutionFilter1DEXT := SDL_GL_GetProcAddress( 'glCopyConvolutionFilter1DEXT'); - glCopyConvolutionFilter2DEXT := SDL_GL_GetProcAddress( 'glCopyConvolutionFilter2DEXT'); - glGetConvolutionFilterEXT := SDL_GL_GetProcAddress( 'glGetConvolutionFilterEXT'); - glGetConvolutionParameterfvEXT := SDL_GL_GetProcAddress( 'glGetConvolutionParameterfvEXT'); - glGetConvolutionParameterivEXT := SDL_GL_GetProcAddress( 'glGetConvolutionParameterivEXT'); - glGetSeparableFilterEXT := SDL_GL_GetProcAddress( 'glGetSeparableFilterEXT'); - glSeparableFilter2DEXT := SDL_GL_GetProcAddress( 'glSeparableFilter2DEXT'); - - // GL_SGI_color_table - glColorTableSGI := SDL_GL_GetProcAddress( 'glColorTableSGI'); - glColorTableParameterfvSGI := SDL_GL_GetProcAddress( 'glColorTableParameterfvSGI'); - glColorTableParameterivSGI := SDL_GL_GetProcAddress( 'glColorTableParameterivSGI'); - glCopyColorTableSGI := SDL_GL_GetProcAddress( 'glCopyColorTableSGI'); - glGetColorTableSGI := SDL_GL_GetProcAddress( 'glGetColorTableSGI'); - glGetColorTableParameterfvSGI := SDL_GL_GetProcAddress( 'glGetColorTableParameterfvSGI'); - glGetColorTableParameterivSGI := SDL_GL_GetProcAddress( 'glGetColorTableParameterivSGI'); - - // GL_SGIX_pixel_texture - glPixelTexGenSGIX := SDL_GL_GetProcAddress( 'glPixelTexGenSGIX'); - - // GL_SGIS_pixel_texture - glPixelTexGenParameteriSGIS := SDL_GL_GetProcAddress( 'glPixelTexGenParameteriSGIS'); - glPixelTexGenParameterivSGIS := SDL_GL_GetProcAddress( 'glPixelTexGenParameterivSGIS'); - glPixelTexGenParameterfSGIS := SDL_GL_GetProcAddress( 'glPixelTexGenParameterfSGIS'); - glPixelTexGenParameterfvSGIS := SDL_GL_GetProcAddress( 'glPixelTexGenParameterfvSGIS'); - glGetPixelTexGenParameterivSGIS := SDL_GL_GetProcAddress( 'glGetPixelTexGenParameterivSGIS'); - glGetPixelTexGenParameterfvSGIS := SDL_GL_GetProcAddress( 'glGetPixelTexGenParameterfvSGIS'); - - // GL_SGIS_texture4D - glTexImage4DSGIS := SDL_GL_GetProcAddress( 'glTexImage4DSGIS'); - glTexSubImage4DSGIS := SDL_GL_GetProcAddress( 'glTexSubImage4DSGIS'); - - // GL_SGIS_detail_texture - glDetailTexFuncSGIS := SDL_GL_GetProcAddress( 'glDetailTexFuncSGIS'); - glGetDetailTexFuncSGIS := SDL_GL_GetProcAddress( 'glGetDetailTexFuncSGIS'); - - // GL_SGIS_sharpen_texture - glSharpenTexFuncSGIS := SDL_GL_GetProcAddress( 'glSharpenTexFuncSGIS'); - glGetSharpenTexFuncSGIS := SDL_GL_GetProcAddress( 'glGetSharpenTexFuncSGIS'); - - // GL_SGIS_multisample - glSampleMaskSGIS := SDL_GL_GetProcAddress( 'glSampleMaskSGIS'); - glSamplePatternSGIS := SDL_GL_GetProcAddress( 'glSamplePatternSGIS'); - - // GL_EXT_blend_minmax - glBlendEquationEXT := SDL_GL_GetProcAddress( 'glBlendEquationEXT'); - - // GL_SGIX_sprite - glSpriteParameterfSGIX := SDL_GL_GetProcAddress( 'glSpriteParameterfSGIX'); - glSpriteParameterfvSGIX := SDL_GL_GetProcAddress( 'glSpriteParameterfvSGIX'); - glSpriteParameteriSGIX := SDL_GL_GetProcAddress( 'glSpriteParameteriSGIX'); - glSpriteParameterivSGIX := SDL_GL_GetProcAddress( 'glSpriteParameterivSGIX'); - - // GL_EXT_point_parameters - glPointParameterfSGIS := SDL_GL_GetProcAddress( 'glPointParameterfSGIS'); - glPointParameterfvSGIS := SDL_GL_GetProcAddress( 'glPointParameterfvSGIS'); - - // GL_SGIX_instruments - glGetInstrumentsSGIX := SDL_GL_GetProcAddress( 'glGetInstrumentsSGIX'); - glInstrumentsBufferSGIX := SDL_GL_GetProcAddress( 'glInstrumentsBufferSGIX'); - glPollInstrumentsSGIX := SDL_GL_GetProcAddress( 'glPollInstrumentsSGIX'); - glReadInstrumentsSGIX := SDL_GL_GetProcAddress( 'glReadInstrumentsSGIX'); - glStartInstrumentsSGIX := SDL_GL_GetProcAddress( 'glStartInstrumentsSGIX'); - glStopInstrumentsSGIX := SDL_GL_GetProcAddress( 'glStopInstrumentsSGIX'); - - // GL_SGIX_framezoom - glFrameZoomSGIX := SDL_GL_GetProcAddress( 'glFrameZoomSGIX'); - - // GL_SGIX_tag_sample_buffer - glTagSampleBufferSGIX := SDL_GL_GetProcAddress( 'glTagSampleBufferSGIX'); - - // GL_SGIX_polynomial_ffd - glDeformationMap3dSGIX := SDL_GL_GetProcAddress( 'glDeformationMap3dSGIX'); - glDeformationMap3fSGIX := SDL_GL_GetProcAddress( 'glDeformationMap3fSGIX'); - glDeformSGIX := SDL_GL_GetProcAddress( 'glDeformSGIX'); - glLoadIdentityDeformationMapSGIX := SDL_GL_GetProcAddress( 'glLoadIdentityDeformationMapSGIX'); - - // GL_SGIX_reference_plane - glReferencePlaneSGIX := SDL_GL_GetProcAddress( 'glReferencePlaneSGIX'); - - // GL_SGIX_flush_raster - glFlushRasterSGIX := SDL_GL_GetProcAddress( 'glFlushRasterSGIX'); - - // GL_SGIS_fog_function - glFogFuncSGIS := SDL_GL_GetProcAddress( 'glFogFuncSGIS'); - glGetFogFuncSGIS := SDL_GL_GetProcAddress( 'glGetFogFuncSGIS'); - - // GL_HP_image_transform - glImageTransformParameteriHP := SDL_GL_GetProcAddress( 'glImageTransformParameteriHP'); - glImageTransformParameterfHP := SDL_GL_GetProcAddress( 'glImageTransformParameterfHP'); - glImageTransformParameterivHP := SDL_GL_GetProcAddress( 'glImageTransformParameterivHP'); - glImageTransformParameterfvHP := SDL_GL_GetProcAddress( 'glImageTransformParameterfvHP'); - glGetImageTransformParameterivHP := SDL_GL_GetProcAddress( 'glGetImageTransformParameterivHP'); - glGetImageTransformParameterfvHP := SDL_GL_GetProcAddress( 'glGetImageTransformParameterfvHP'); - - // GL_EXT_color_subtable - glCopyColorSubTableEXT := SDL_GL_GetProcAddress( 'glCopyColorSubTableEXT'); - - // GL_PGI_misc_hints - glHintPGI := SDL_GL_GetProcAddress( 'glHintPGI'); - - // GL_EXT_paletted_texture - glGetColorTableParameterivEXT := SDL_GL_GetProcAddress( 'glGetColorTableParameterivEXT'); - glGetColorTableParameterfvEXT := SDL_GL_GetProcAddress( 'glGetColorTableParameterfvEXT'); - - // GL_SGIX_list_priority - glGetListParameterfvSGIX := SDL_GL_GetProcAddress( 'glGetListParameterfvSGIX'); - glGetListParameterivSGIX := SDL_GL_GetProcAddress( 'glGetListParameterivSGIX'); - glListParameterfSGIX := SDL_GL_GetProcAddress( 'glListParameterfSGIX'); - glListParameterfvSGIX := SDL_GL_GetProcAddress( 'glListParameterfvSGIX'); - glListParameteriSGIX := SDL_GL_GetProcAddress( 'glListParameteriSGIX'); - glListParameterivSGIX := SDL_GL_GetProcAddress( 'glListParameterivSGIX'); - - // GL_SGIX_fragment_lighting - glFragmentColorMaterialSGIX := SDL_GL_GetProcAddress( 'glFragmentColorMaterialSGIX'); - glFragmentLightfSGIX := SDL_GL_GetProcAddress( 'glFragmentLightfSGIX'); - glFragmentLightfvSGIX := SDL_GL_GetProcAddress( 'glFragmentLightfvSGIX'); - glFragmentLightiSGIX := SDL_GL_GetProcAddress( 'glFragmentLightiSGIX'); - glFragmentLightivSGIX := SDL_GL_GetProcAddress( 'glFragmentLightivSGIX'); - glFragmentLightModelfSGIX := SDL_GL_GetProcAddress( 'glFragmentLightModelfSGIX'); - glFragmentLightModelfvSGIX := SDL_GL_GetProcAddress( 'glFragmentLightModelfvSGIX'); - glFragmentLightModeliSGIX := SDL_GL_GetProcAddress( 'glFragmentLightModeliSGIX'); - glFragmentLightModelivSGIX := SDL_GL_GetProcAddress( 'glFragmentLightModelivSGIX'); - glFragmentMaterialfSGIX := SDL_GL_GetProcAddress( 'glFragmentMaterialfSGIX'); - glFragmentMaterialfvSGIX := SDL_GL_GetProcAddress( 'glFragmentMaterialfvSGIX'); - glFragmentMaterialiSGIX := SDL_GL_GetProcAddress( 'glFragmentMaterialiSGIX'); - glFragmentMaterialivSGIX := SDL_GL_GetProcAddress( 'glFragmentMaterialivSGIX'); - glGetFragmentLightfvSGIX := SDL_GL_GetProcAddress( 'glGetFragmentLightfvSGIX'); - glGetFragmentLightivSGIX := SDL_GL_GetProcAddress( 'glGetFragmentLightivSGIX'); - glGetFragmentMaterialfvSGIX := SDL_GL_GetProcAddress( 'glGetFragmentMaterialfvSGIX'); - glGetFragmentMaterialivSGIX := SDL_GL_GetProcAddress( 'glGetFragmentMaterialivSGIX'); - glLightEnviSGIX := SDL_GL_GetProcAddress( 'glLightEnviSGIX'); - - // GL_EXT_draw_range_elements - glDrawRangeElementsEXT := SDL_GL_GetProcAddress( 'glDrawRangeElementsEXT'); - - // GL_EXT_light_texture - glApplyTextureEXT := SDL_GL_GetProcAddress( 'glApplyTextureEXT'); - glTextureLightEXT := SDL_GL_GetProcAddress( 'glTextureLightEXT'); - glTextureMaterialEXT := SDL_GL_GetProcAddress( 'glTextureMaterialEXT'); - - // GL_SGIX_async - glAsyncMarkerSGIX := SDL_GL_GetProcAddress( 'glAsyncMarkerSGIX'); - glFinishAsyncSGIX := SDL_GL_GetProcAddress( 'glFinishAsyncSGIX'); - glPollAsyncSGIX := SDL_GL_GetProcAddress( 'glPollAsyncSGIX'); - glGenAsyncMarkersSGIX := SDL_GL_GetProcAddress( 'glGenAsyncMarkersSGIX'); - glDeleteAsyncMarkersSGIX := SDL_GL_GetProcAddress( 'glDeleteAsyncMarkersSGIX'); - glIsAsyncMarkerSGIX := SDL_GL_GetProcAddress( 'glIsAsyncMarkerSGIX'); - - // GL_INTEL_parallel_arrays - glVertexPointervINTEL := SDL_GL_GetProcAddress( 'glVertexPointervINTEL'); - glNormalPointervINTEL := SDL_GL_GetProcAddress( 'glNormalPointervINTEL'); - glColorPointervINTEL := SDL_GL_GetProcAddress( 'glColorPointervINTEL'); - glTexCoordPointervINTEL := SDL_GL_GetProcAddress( 'glTexCoordPointervINTEL'); - - // GL_EXT_pixel_transform - glPixelTransformParameteriEXT := SDL_GL_GetProcAddress( 'glPixelTransformParameteriEXT'); - glPixelTransformParameterfEXT := SDL_GL_GetProcAddress( 'glPixelTransformParameterfEXT'); - glPixelTransformParameterivEXT := SDL_GL_GetProcAddress( 'glPixelTransformParameterivEXT'); - glPixelTransformParameterfvEXT := SDL_GL_GetProcAddress( 'glPixelTransformParameterfvEXT'); - - // GL_EXT_secondary_color - glSecondaryColor3bEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3bEXT'); - glSecondaryColor3bvEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3bvEXT'); - glSecondaryColor3dEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3dEXT'); - glSecondaryColor3dvEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3dvEXT'); - glSecondaryColor3fEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3fEXT'); - glSecondaryColor3fvEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3fvEXT'); - glSecondaryColor3iEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3iEXT'); - glSecondaryColor3ivEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3ivEXT'); - glSecondaryColor3sEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3sEXT'); - glSecondaryColor3svEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3svEXT'); - glSecondaryColor3ubEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3ubEXT'); - glSecondaryColor3ubvEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3ubvEXT'); - glSecondaryColor3uiEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3uiEXT'); - glSecondaryColor3uivEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3uivEXT'); - glSecondaryColor3usEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3usEXT'); - glSecondaryColor3usvEXT := SDL_GL_GetProcAddress( 'glSecondaryColor3usvEXT'); - glSecondaryColorPointerEXT := SDL_GL_GetProcAddress( 'glSecondaryColorPointerEXT'); - - // GL_EXT_texture_perturb_normal - glTextureNormalEXT := SDL_GL_GetProcAddress( 'glTextureNormalEXT'); - - // GL_EXT_multi_draw_arrays - glMultiDrawArraysEXT := SDL_GL_GetProcAddress( 'glMultiDrawArraysEXT'); - glMultiDrawElementsEXT := SDL_GL_GetProcAddress( 'glMultiDrawElementsEXT'); - - // GL_EXT_fog_coord - glFogCoordfEXT := SDL_GL_GetProcAddress( 'glFogCoordfEXT'); - glFogCoordfvEXT := SDL_GL_GetProcAddress( 'glFogCoordfvEXT'); - glFogCoorddEXT := SDL_GL_GetProcAddress( 'glFogCoorddEXT'); - glFogCoorddvEXT := SDL_GL_GetProcAddress( 'glFogCoorddvEXT'); - glFogCoordPointerEXT := SDL_GL_GetProcAddress( 'glFogCoordPointerEXT'); - - // GL_EXT_coordinate_frame - glTangent3bEXT := SDL_GL_GetProcAddress( 'glTangent3bEXT'); - glTangent3bvEXT := SDL_GL_GetProcAddress( 'glTangent3bvEXT'); - glTangent3dEXT := SDL_GL_GetProcAddress( 'glTangent3dEXT'); - glTangent3dvEXT := SDL_GL_GetProcAddress( 'glTangent3dvEXT'); - glTangent3fEXT := SDL_GL_GetProcAddress( 'glTangent3fEXT'); - glTangent3fvEXT := SDL_GL_GetProcAddress( 'glTangent3fvEXT'); - glTangent3iEXT := SDL_GL_GetProcAddress( 'glTangent3iEXT'); - glTangent3ivEXT := SDL_GL_GetProcAddress( 'glTangent3ivEXT'); - glTangent3sEXT := SDL_GL_GetProcAddress( 'glTangent3sEXT'); - glTangent3svEXT := SDL_GL_GetProcAddress( 'glTangent3svEXT'); - glBinormal3bEXT := SDL_GL_GetProcAddress( 'glBinormal3bEXT'); - glBinormal3bvEXT := SDL_GL_GetProcAddress( 'glBinormal3bvEXT'); - glBinormal3dEXT := SDL_GL_GetProcAddress( 'glBinormal3dEXT'); - glBinormal3dvEXT := SDL_GL_GetProcAddress( 'glBinormal3dvEXT'); - glBinormal3fEXT := SDL_GL_GetProcAddress( 'glBinormal3fEXT'); - glBinormal3fvEXT := SDL_GL_GetProcAddress( 'glBinormal3fvEXT'); - glBinormal3iEXT := SDL_GL_GetProcAddress( 'glBinormal3iEXT'); - glBinormal3ivEXT := SDL_GL_GetProcAddress( 'glBinormal3ivEXT'); - glBinormal3sEXT := SDL_GL_GetProcAddress( 'glBinormal3sEXT'); - glBinormal3svEXT := SDL_GL_GetProcAddress( 'glBinormal3svEXT'); - glTangentPointerEXT := SDL_GL_GetProcAddress( 'glTangentPointerEXT'); - glBinormalPointerEXT := SDL_GL_GetProcAddress( 'glBinormalPointerEXT'); - - // GL_SUNX_constant_data - glFinishTextureSUNX := SDL_GL_GetProcAddress( 'glFinishTextureSUNX'); - - // GL_SUN_global_alpha - glGlobalAlphaFactorbSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactorbSUN'); - glGlobalAlphaFactorsSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactorsSUN'); - glGlobalAlphaFactoriSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactoriSUN'); - glGlobalAlphaFactorfSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactorfSUN'); - glGlobalAlphaFactordSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactordSUN'); - glGlobalAlphaFactorubSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactorubSUN'); - glGlobalAlphaFactorusSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactorusSUN'); - glGlobalAlphaFactoruiSUN := SDL_GL_GetProcAddress( 'glGlobalAlphaFactoruiSUN'); - - // GL_SUN_triangle_list - glReplacementCodeuiSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiSUN'); - glReplacementCodeusSUN := SDL_GL_GetProcAddress( 'glReplacementCodeusSUN'); - glReplacementCodeubSUN := SDL_GL_GetProcAddress( 'glReplacementCodeubSUN'); - glReplacementCodeuivSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuivSUN'); - glReplacementCodeusvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeusvSUN'); - glReplacementCodeubvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeubvSUN'); - glReplacementCodePointerSUN := SDL_GL_GetProcAddress( 'glReplacementCodePointerSUN'); - - // GL_SUN_vertex - glColor4ubVertex2fSUN := SDL_GL_GetProcAddress( 'glColor4ubVertex2fSUN'); - glColor4ubVertex2fvSUN := SDL_GL_GetProcAddress( 'glColor4ubVertex2fvSUN'); - glColor4ubVertex3fSUN := SDL_GL_GetProcAddress( 'glColor4ubVertex3fSUN'); - glColor4ubVertex3fvSUN := SDL_GL_GetProcAddress( 'glColor4ubVertex3fvSUN'); - glColor3fVertex3fSUN := SDL_GL_GetProcAddress( 'glColor3fVertex3fSUN'); - glColor3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glColor3fVertex3fvSUN'); - glNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glNormal3fVertex3fSUN'); - glNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glNormal3fVertex3fvSUN'); - glColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glColor4fNormal3fVertex3fSUN'); - glColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glColor4fNormal3fVertex3fvSUN'); - glTexCoord2fVertex3fSUN := SDL_GL_GetProcAddress( 'glTexCoord2fVertex3fSUN'); - glTexCoord2fVertex3fvSUN := SDL_GL_GetProcAddress( 'glTexCoord2fVertex3fvSUN'); - glTexCoord4fVertex4fSUN := SDL_GL_GetProcAddress( 'glTexCoord4fVertex4fSUN'); - glTexCoord4fVertex4fvSUN := SDL_GL_GetProcAddress( 'glTexCoord4fVertex4fvSUN'); - glTexCoord2fColor4ubVertex3fSUN := SDL_GL_GetProcAddress( 'glTexCoord2fColor4ubVertex3fSUN'); - glTexCoord2fColor4ubVertex3fvSUN := SDL_GL_GetProcAddress( 'glTexCoord2fColor4ubVertex3fvSUN'); - glTexCoord2fColor3fVertex3fSUN := SDL_GL_GetProcAddress( 'glTexCoord2fColor3fVertex3fSUN'); - glTexCoord2fColor3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glTexCoord2fColor3fVertex3fvSUN'); - glTexCoord2fNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glTexCoord2fNormal3fVertex3fSUN'); - glTexCoord2fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glTexCoord2fNormal3fVertex3fvSUN'); - glTexCoord2fColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glTexCoord2fColor4fNormal3fVertex3fSUN'); - glTexCoord2fColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glTexCoord2fColor4fNormal3fVertex3fvSUN'); - glTexCoord4fColor4fNormal3fVertex4fSUN := SDL_GL_GetProcAddress( 'glTexCoord4fColor4fNormal3fVertex4fSUN'); - glTexCoord4fColor4fNormal3fVertex4fvSUN := SDL_GL_GetProcAddress( 'glTexCoord4fColor4fNormal3fVertex4fvSUN'); - glReplacementCodeuiVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiVertex3fSUN'); - glReplacementCodeuiVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiVertex3fvSUN'); - glReplacementCodeuiColor4ubVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiColor4ubVertex3fSUN'); - glReplacementCodeuiColor4ubVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiColor4ubVertex3fvSUN'); - glReplacementCodeuiColor3fVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiColor3fVertex3fSUN'); - glReplacementCodeuiColor3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiColor3fVertex3fvSUN'); - glReplacementCodeuiNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiNormal3fVertex3fSUN'); - glReplacementCodeuiNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiNormal3fVertex3fvSUN'); - glReplacementCodeuiColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiColor4fNormal3fVertex3fSUN'); - glReplacementCodeuiColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiColor4fNormal3fVertex3fvSUN'); - glReplacementCodeuiTexCoord2fVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiTexCoord2fVertex3fSUN'); - glReplacementCodeuiTexCoord2fVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiTexCoord2fVertex3fvSUN'); - glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN'); - glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN'); - glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN'); - glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN := SDL_GL_GetProcAddress( 'glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN'); - - // GL_EXT_blend_func_separate - glBlendFuncSeparateEXT := SDL_GL_GetProcAddress( 'glBlendFuncSeparateEXT'); - - // GL_EXT_vertex_weighting - glVertexWeightfEXT := SDL_GL_GetProcAddress( 'glVertexWeightfEXT'); - glVertexWeightfvEXT := SDL_GL_GetProcAddress( 'glVertexWeightfvEXT'); - glVertexWeightPointerEXT := SDL_GL_GetProcAddress( 'glVertexWeightPointerEXT'); - - // GL_NV_vertex_array_range - glFlushVertexArrayRangeNV := SDL_GL_GetProcAddress( 'glFlushVertexArrayRangeNV'); - glVertexArrayRangeNV := SDL_GL_GetProcAddress( 'glVertexArrayRangeNV'); - wglAllocateMemoryNV := SDL_GL_GetProcAddress( 'wglAllocateMemoryNV'); - wglFreeMemoryNV := SDL_GL_GetProcAddress( 'wglFreeMemoryNV'); - - // GL_NV_register_combiners - glCombinerParameterfvNV := SDL_GL_GetProcAddress( 'glCombinerParameterfvNV'); - glCombinerParameterfNV := SDL_GL_GetProcAddress( 'glCombinerParameterfNV'); - glCombinerParameterivNV := SDL_GL_GetProcAddress( 'glCombinerParameterivNV'); - glCombinerParameteriNV := SDL_GL_GetProcAddress( 'glCombinerParameteriNV'); - glCombinerInputNV := SDL_GL_GetProcAddress( 'glCombinerInputNV'); - glCombinerOutputNV := SDL_GL_GetProcAddress( 'glCombinerOutputNV'); - glFinalCombinerInputNV := SDL_GL_GetProcAddress( 'glFinalCombinerInputNV'); - glGetCombinerInputParameterfvNV := SDL_GL_GetProcAddress( 'glGetCombinerInputParameterfvNV'); - glGetCombinerInputParameterivNV := SDL_GL_GetProcAddress( 'glGetCombinerInputParameterivNV'); - glGetCombinerOutputParameterfvNV := SDL_GL_GetProcAddress( 'glGetCombinerOutputParameterfvNV'); - glGetCombinerOutputParameterivNV := SDL_GL_GetProcAddress( 'glGetCombinerOutputParameterivNV'); - glGetFinalCombinerInputParameterfvNV := SDL_GL_GetProcAddress( 'glGetFinalCombinerInputParameterfvNV'); - glGetFinalCombinerInputParameterivNV := SDL_GL_GetProcAddress( 'glGetFinalCombinerInputParameterivNV'); - - // GL_MESA_resize_buffers - glResizeBuffersMESA := SDL_GL_GetProcAddress( 'glResizeBuffersMESA'); - - // GL_MESA_window_pos - glWindowPos2dMESA := SDL_GL_GetProcAddress( 'glWindowPos2dMESA'); - glWindowPos2dvMESA := SDL_GL_GetProcAddress( 'glWindowPos2dvMESA'); - glWindowPos2fMESA := SDL_GL_GetProcAddress( 'glWindowPos2fMESA'); - glWindowPos2fvMESA := SDL_GL_GetProcAddress( 'glWindowPos2fvMESA'); - glWindowPos2iMESA := SDL_GL_GetProcAddress( 'glWindowPos2iMESA'); - glWindowPos2ivMESA := SDL_GL_GetProcAddress( 'glWindowPos2ivMESA'); - glWindowPos2sMESA := SDL_GL_GetProcAddress( 'glWindowPos2sMESA'); - glWindowPos2svMESA := SDL_GL_GetProcAddress( 'glWindowPos2svMESA'); - glWindowPos3dMESA := SDL_GL_GetProcAddress( 'glWindowPos3dMESA'); - glWindowPos3dvMESA := SDL_GL_GetProcAddress( 'glWindowPos3dvMESA'); - glWindowPos3fMESA := SDL_GL_GetProcAddress( 'glWindowPos3fMESA'); - glWindowPos3fvMESA := SDL_GL_GetProcAddress( 'glWindowPos3fvMESA'); - glWindowPos3iMESA := SDL_GL_GetProcAddress( 'glWindowPos3iMESA'); - glWindowPos3ivMESA := SDL_GL_GetProcAddress( 'glWindowPos3ivMESA'); - glWindowPos3sMESA := SDL_GL_GetProcAddress( 'glWindowPos3sMESA'); - glWindowPos3svMESA := SDL_GL_GetProcAddress( 'glWindowPos3svMESA'); - glWindowPos4dMESA := SDL_GL_GetProcAddress( 'glWindowPos4dMESA'); - glWindowPos4dvMESA := SDL_GL_GetProcAddress( 'glWindowPos4dvMESA'); - glWindowPos4fMESA := SDL_GL_GetProcAddress( 'glWindowPos4fMESA'); - glWindowPos4fvMESA := SDL_GL_GetProcAddress( 'glWindowPos4fvMESA'); - glWindowPos4iMESA := SDL_GL_GetProcAddress( 'glWindowPos4iMESA'); - glWindowPos4ivMESA := SDL_GL_GetProcAddress( 'glWindowPos4ivMESA'); - glWindowPos4sMESA := SDL_GL_GetProcAddress( 'glWindowPos4sMESA'); - glWindowPos4svMESA := SDL_GL_GetProcAddress( 'glWindowPos4svMESA'); - - // GL_IBM_multimode_draw_arrays - glMultiModeDrawArraysIBM := SDL_GL_GetProcAddress( 'glMultiModeDrawArraysIBM'); - glMultiModeDrawElementsIBM := SDL_GL_GetProcAddress( 'glMultiModeDrawElementsIBM'); - - // GL_IBM_vertex_array_lists - glColorPointerListIBM := SDL_GL_GetProcAddress( 'glColorPointerListIBM'); - glSecondaryColorPointerListIBM := SDL_GL_GetProcAddress( 'glSecondaryColorPointerListIBM'); - glEdgeFlagPointerListIBM := SDL_GL_GetProcAddress( 'glEdgeFlagPointerListIBM'); - glFogCoordPointerListIBM := SDL_GL_GetProcAddress( 'glFogCoordPointerListIBM'); - glIndexPointerListIBM := SDL_GL_GetProcAddress( 'glIndexPointerListIBM'); - glNormalPointerListIBM := SDL_GL_GetProcAddress( 'glNormalPointerListIBM'); - glTexCoordPointerListIBM := SDL_GL_GetProcAddress( 'glTexCoordPointerListIBM'); - glVertexPointerListIBM := SDL_GL_GetProcAddress( 'glVertexPointerListIBM'); - - // GL_3DFX_tbuffer - glTbufferMask3DFX := SDL_GL_GetProcAddress( 'glTbufferMask3DFX'); - - // GL_EXT_multisample - glSampleMaskEXT := SDL_GL_GetProcAddress( 'glSampleMaskEXT'); - glSamplePatternEXT := SDL_GL_GetProcAddress( 'glSamplePatternEXT'); - - // GL_SGIS_texture_color_mask - glTextureColorMaskSGIS := SDL_GL_GetProcAddress( 'glTextureColorMaskSGIS'); - - // GL_SGIX_igloo_interface - glIglooInterfaceSGIX := SDL_GL_GetProcAddress( 'glIglooInterfaceSGIX'); - - // GLU extensions - gluNurbsCallbackDataEXT := SDL_GL_GetProcAddress( 'gluNurbsCallbackDataEXT'); - gluNewNurbsTessellatorEXT := SDL_GL_GetProcAddress( 'gluNewNurbsTessellatorEXT'); - gluDeleteNurbsTessellatorEXT := SDL_GL_GetProcAddress( 'gluDeleteNurbsTessellatorEXT'); - - // GL_NV_vertex_program - glAreProgramsResidentNV := SDL_GL_GetProcAddress( 'glAreProgramsResidentNV'); - glBindProgramNV := SDL_GL_GetProcAddress( 'glBindProgramNV'); - glDeleteProgramsNV := SDL_GL_GetProcAddress( 'glDeleteProgramsNV'); - glExecuteProgramNV := SDL_GL_GetProcAddress( 'glExecuteProgramNV'); - glGenProgramsNV := SDL_GL_GetProcAddress( 'glGenProgramsNV'); - glGetProgramParameterdvNV := SDL_GL_GetProcAddress( 'glGetProgramParameterdvNV'); - glGetProgramParameterfvNV := SDL_GL_GetProcAddress( 'glGetProgramParameterfvNV'); - glGetProgramivNV := SDL_GL_GetProcAddress( 'glGetProgramivNV'); - glGetProgramStringNV := SDL_GL_GetProcAddress( 'glGetProgramStringNV'); - glGetTrackMatrixivNV := SDL_GL_GetProcAddress( 'glGetTrackMatrixivNV'); - glGetVertexAttribdvNV:= SDL_GL_GetProcAddress( 'glGetVertexAttribdvNV'); - glGetVertexAttribfvNV:= SDL_GL_GetProcAddress( 'glGetVertexAttribfvNV'); - glGetVertexAttribivNV:= SDL_GL_GetProcAddress( 'glGetVertexAttribivNV'); - glGetVertexAttribPointervNV := wglGetProcAddress ('glGetVertexAttribPointervNV'); - glIsProgramNV := SDL_GL_GetProcAddress( 'glIsProgramNV'); - glLoadProgramNV := SDL_GL_GetProcAddress( 'glLoadProgramNV'); - glProgramParameter4dNV := SDL_GL_GetProcAddress( 'glProgramParameter4dNV'); - glProgramParameter4dvNV := SDL_GL_GetProcAddress( 'glProgramParameter4dvNV'); - glProgramParameter4fNV := SDL_GL_GetProcAddress( 'glProgramParameter4fNV'); - glProgramParameter4fvNV := SDL_GL_GetProcAddress( 'glProgramParameter4fvNV'); - glProgramParameters4dvNV := wglGetProcAddress ('glProgramParameters4dvNV'); - glProgramParameters4fvNV := wglGetProcAddress ('glProgramParameters4fvNV'); - glRequestResidentProgramsNV := wglGetProcAddress ('glRequestResidentProgramsNV'); - glTrackMatrixNV := SDL_GL_GetProcAddress( 'glTrackMatrixNV'); - glVertexAttribPointerNV := SDL_GL_GetProcAddress( 'glVertexAttribPointerNV'); - glVertexAttrib1dNV := SDL_GL_GetProcAddress( 'glVertexAttrib1dNV'); - glVertexAttrib1dvNV := SDL_GL_GetProcAddress( 'glVertexAttrib1dvNV'); - glVertexAttrib1fNV := SDL_GL_GetProcAddress( 'glVertexAttrib1fNV'); - glVertexAttrib1fvNV := SDL_GL_GetProcAddress( 'glVertexAttrib1fvNV'); - glVertexAttrib1sNV := SDL_GL_GetProcAddress( 'glVertexAttrib1sNV'); - glVertexAttrib1svNV := SDL_GL_GetProcAddress( 'glVertexAttrib1svNV'); - glVertexAttrib2dNV := SDL_GL_GetProcAddress( 'glVertexAttrib2dNV'); - glVertexAttrib2dvNV := SDL_GL_GetProcAddress( 'glVertexAttrib2dvNV'); - glVertexAttrib2fNV := SDL_GL_GetProcAddress( 'glVertexAttrib2fNV'); - glVertexAttrib2fvNV := SDL_GL_GetProcAddress( 'glVertexAttrib2fvNV'); - glVertexAttrib2sNV := SDL_GL_GetProcAddress( 'glVertexAttrib2sNV'); - glVertexAttrib2svNV := SDL_GL_GetProcAddress( 'glVertexAttrib2svNV'); - glVertexAttrib3dNV := SDL_GL_GetProcAddress( 'glVertexAttrib3dNV'); - glVertexAttrib3dvNV := SDL_GL_GetProcAddress( 'glVertexAttrib3dvNV'); - glVertexAttrib3fNV := SDL_GL_GetProcAddress( 'glVertexAttrib3fNV'); - glVertexAttrib3fvNV := SDL_GL_GetProcAddress( 'glVertexAttrib3fvNV'); - glVertexAttrib3sNV := SDL_GL_GetProcAddress( 'glVertexAttrib3sNV'); - glVertexAttrib3svNV := SDL_GL_GetProcAddress( 'glVertexAttrib3svNV'); - glVertexAttrib4dNV := SDL_GL_GetProcAddress( 'glVertexAttrib4dNV'); - glVertexAttrib4dvNV := SDL_GL_GetProcAddress( 'glVertexAttrib4dvNV'); - glVertexAttrib4fNV := SDL_GL_GetProcAddress( 'glVertexAttrib4fNV'); - glVertexAttrib4fvNV := SDL_GL_GetProcAddress( 'glVertexAttrib4fvNV'); - glVertexAttrib4sNV := SDL_GL_GetProcAddress( 'glVertexAttrib4sNV'); - glVertexAttrib4svNV := SDL_GL_GetProcAddress( 'glVertexAttrib4svNV'); - glVertexAttrib4ubvNV := SDL_GL_GetProcAddress( 'glVertexAttrib4ubvNV'); - glVertexAttribs1dvNV := SDL_GL_GetProcAddress( 'glVertexAttribs1dvNV'); - glVertexAttribs1fvNV := SDL_GL_GetProcAddress( 'glVertexAttribs1fvNV'); - glVertexAttribs1svNV := SDL_GL_GetProcAddress( 'glVertexAttribs1svNV'); - glVertexAttribs2dvNV := SDL_GL_GetProcAddress( 'glVertexAttribs2dvNV'); - glVertexAttribs2fvNV := SDL_GL_GetProcAddress( 'glVertexAttribs2fvNV'); - glVertexAttribs2svNV := SDL_GL_GetProcAddress( 'glVertexAttribs2svNV'); - glVertexAttribs3dvNV := SDL_GL_GetProcAddress( 'glVertexAttribs3dvNV'); - glVertexAttribs3fvNV := SDL_GL_GetProcAddress( 'glVertexAttribs3fvNV'); - glVertexAttribs3svNV := SDL_GL_GetProcAddress( 'glVertexAttribs3svNV'); - glVertexAttribs4dvNV := SDL_GL_GetProcAddress( 'glVertexAttribs4dvNV'); - glVertexAttribs4fvNV := SDL_GL_GetProcAddress( 'glVertexAttribs4fvNV'); - glVertexAttribs4svNV := SDL_GL_GetProcAddress( 'glVertexAttribs4svNV'); - glVertexAttribs4ubvNV := SDL_GL_GetProcAddress( 'glVertexAttribs4ubvN'); - - // ARB wgl extensions - wglGetExtensionsStringARB := SDL_GL_GetProcAddress( 'wglGetExtensionsStringARB'); - wglGetPixelFormatAttribivARB := SDL_GL_GetProcAddress( 'wglGetPixelFormatAttribivARB'); - wglGetPixelFormatAttribfvARB := SDL_GL_GetProcAddress( 'wglGetPixelFormatAttribfvARB'); - wglChoosePixelFormatARB := SDL_GL_GetProcAddress( 'wglChoosePixelFormatARB'); - - // To get synchronized again, if this proc was called externally. - LastPixelFormat := 0; - end; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -procedure TrimAndSplitVersionString(Buffer: String; var Max, Min: Integer); - -// Peels out the X.Y form from the given Buffer which must contain a version string like "text Minor.Major.Build text" -// at least however "Major.Minor". - -var - Separator: Integer; - -begin - try - // There must be at least one dot to separate major and minor version number. - Separator := Pos('.', Buffer); - // At least one number must be before and one after the dot. - if (Separator > 1) and (Separator < Length(Buffer)) and (Buffer[Separator - 1] in ['0'..'9']) and - (Buffer[Separator + 1] in ['0'..'9']) then - begin - // OK, it's a valid version string. Now remove unnecessary parts. - Dec(Separator); - // Find last non-numeric character before version number. - while (Separator > 0) and (Buffer[Separator] in ['0'..'9']) do - Dec(Separator); - // Delete leading characters which do not belong to the version string. - Delete(Buffer, 1, Separator); - Separator := Pos('.', Buffer) + 1; - // Find first non-numeric character after version number - while (Separator <= Length(Buffer)) and (Buffer[Separator] in ['0'..'9']) do - Inc(Separator); - // delete trailing characters not belonging to the version string - Delete(Buffer, Separator, 255); - // Now translate the numbers. - Separator := Pos('.', Buffer); // This is necessary because the buffer length might have changed. - Max := StrToInt(Copy(Buffer, 1, Separator - 1)); - Min := StrToInt(Copy(Buffer, Separator + 1, 255)); - end - else - Abort; - except - Min := 0; - Max := 0; - end; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -procedure ReadImplementationProperties; - -var - Buffer: string; - MajorVersion, - MinorVersion: Integer; - - //--------------- local function -------------------------------------------- - - function CheckExtension(const Extension: string): Boolean; - - // Checks if the given Extension string is in Buffer. - - var - ExtPos: Integer; - - begin - // First find the position of the extension string as substring in Buffer. - ExtPos := Pos(Extension, Buffer); - Result := ExtPos > 0; - // Now check that it isn't only a substring of another extension. - if Result then - Result := ((ExtPos + Length(Extension) - 1) = Length(Buffer)) or - not (Buffer[ExtPos + Length(Extension)] in ['_', 'A'..'Z', 'a'..'z']); - end; - - //--------------- end local function ---------------------------------------- - -begin - // determine version of implementation - // GL - Buffer := glGetString(GL_VERSION); - TrimAndSplitVersionString(Buffer, Majorversion, MinorVersion); - GL_VERSION_1_0 := True; - GL_VERSION_1_1 := False; - GL_VERSION_1_2 := False; - if MajorVersion > 0 then - begin - if MinorVersion > 0 then - begin - GL_VERSION_1_1 := True; - if MinorVersion > 1 then - GL_VERSION_1_2 := True; - end; - end; - - // GLU - GLU_VERSION_1_1 := False; - GLU_VERSION_1_2 := False; - GLU_VERSION_1_3 := False; - // gluGetString is valid for version 1.1 or later - if Assigned(gluGetString) then - begin - Buffer := gluGetString(GLU_VERSION); - TrimAndSplitVersionString(Buffer, Majorversion, MinorVersion); - GLU_VERSION_1_1 := True; - if MinorVersion > 1 then - begin - GLU_VERSION_1_2 := True; - if MinorVersion > 2 then - GLU_VERSION_1_3 := True; - end; - end; - - // check supported extensions - // GL - Buffer := glGetString(GL_EXTENSIONS); - GL_3DFX_multisample :=CheckExtension('GL_3DFX_multisample'); - GL_3DFX_tbuffer := CheckExtension('GL_3DFX_tbuffer'); - GL_3DFX_texture_compression_FXT1 := CheckExtension('GL_3DFX_texture_compression_FXT1'); - - GL_APPLE_specular_vector := CheckExtension('GL_APPLE_specular_vector'); - GL_APPLE_transform_hint := CheckExtension('GL_APPLE_transform_hint'); - - GL_ARB_imaging := CheckExtension('GL_ARB_imaging'); - GL_ARB_multisample := CheckExtension('GL_ARB_multisample'); - GL_ARB_multitexture := CheckExtension('GL_ARB_multitexture'); - GL_ARB_texture_compression := CheckExtension('GL_ARB_texture_compression'); - GL_ARB_texture_cube_map := CheckExtension('GL_ARB_texture_cube_map'); - GL_ARB_transpose_matrix := CheckExtension('GL_ARB_transpose_matrix'); - GL_ARB_vertex_blend := CheckExtension('GL_ARB_vertex_blend'); - - GL_EXT_422_pixels := CheckExtension('GL_EXT_422_pixels'); - GL_EXT_abgr := CheckExtension('GL_EXT_abgr'); - GL_EXT_bgra := CheckExtension('GL_EXT_bgra'); - GL_EXT_blend_color := CheckExtension('GL_EXT_blend_color'); - GL_EXT_blend_func_separate := CheckExtension('GL_EXT_blend_func_separate'); - GL_EXT_blend_logic_op := CheckExtension('GL_EXT_blend_logic_op'); - GL_EXT_blend_minmax := CheckExtension('GL_EXT_blend_minmax'); - GL_EXT_blend_subtract := CheckExtension('GL_EXT_blend_subtract'); - GL_EXT_clip_volume_hint := CheckExtension('GL_EXT_clip_volume_hint'); - GL_EXT_cmyka := CheckExtension('GL_EXT_cmyka'); - GL_EXT_color_subtable := CheckExtension('GL_EXT_color_subtable'); - GL_EXT_compiled_vertex_array := CheckExtension('GL_EXT_compiled_vertex_array'); - GL_EXT_convolution := CheckExtension('GL_EXT_convolution'); - GL_EXT_coordinate_frame := CheckExtension('GL_EXT_coordinate_frame'); - GL_EXT_copy_texture := CheckExtension('GL_EXT_copy_texture'); - GL_EXT_cull_vertex := CheckExtension('GL_EXT_cull_vertex'); - GL_EXT_draw_range_elements := CheckExtension('GL_EXT_draw_range_elements'); - GL_EXT_fog_coord := CheckExtension('GL_EXT_fog_coord'); - GL_EXT_histogram := CheckExtension('GL_EXT_histogram'); - GL_EXT_index_array_formats := CheckExtension('GL_EXT_index_array_formats'); - GL_EXT_index_func := CheckExtension('GL_EXT_index_func'); - GL_EXT_index_material := CheckExtension('GL_EXT_index_material'); - GL_EXT_index_texture := CheckExtension('GL_EXT_index_texture'); - GL_EXT_light_max_exponent := CheckExtension('GL_EXT_light_max_exponent'); - GL_EXT_light_texture := CheckExtension('GL_EXT_light_texture'); - GL_EXT_misc_attribute := CheckExtension('GL_EXT_misc_attribute'); - GL_EXT_multi_draw_arrays := CheckExtension('GL_EXT_multi_draw_arrays'); - GL_EXT_multisample := CheckExtension('GL_EXT_multisample'); - GL_EXT_packed_pixels := CheckExtension('GL_EXT_packed_pixels'); - GL_EXT_paletted_texture := CheckExtension('GL_EXT_paletted_texture'); - GL_EXT_pixel_transform := CheckExtension('GL_EXT_pixel_transform'); - GL_EXT_point_parameters := CheckExtension('GL_EXT_point_parameters'); - GL_EXT_polygon_offset := CheckExtension('GL_EXT_polygon_offset'); - GL_EXT_rescale_normal := CheckExtension('GL_EXT_rescale_normal'); - GL_EXT_scene_marker := CheckExtension('GL_EXT_scene_marker'); - GL_EXT_secondary_color := CheckExtension('GL_EXT_secondary_color'); - GL_EXT_separate_specular_color := CheckExtension('GL_EXT_separate_specular_color'); - GL_EXT_shared_texture_palette := CheckExtension('GL_EXT_shared_texture_palette'); - GL_EXT_stencil_wrap := CheckExtension('GL_EXT_stencil_wrap'); - GL_EXT_subtexture := CheckExtension('GL_EXT_subtexture'); - GL_EXT_texture_color_table := CheckExtension('GL_EXT_texture_color_table'); - GL_EXT_texture_compression_s3tc := CheckExtension('GL_EXT_texture_compression_s3tc'); - GL_EXT_texture_cube_map := CheckExtension('GL_EXT_texture_cube_map'); - GL_EXT_texture_edge_clamp := CheckExtension('GL_EXT_texture_edge_clamp'); - GL_EXT_texture_env_add := CheckExtension('GL_EXT_texture_env_add'); - GL_EXT_texture_env_combine := CheckExtension('GL_EXT_texture_env_combine'); - GL_EXT_texture_filter_anisotropic := CheckExtension('GL_EXT_texture_filter_anisotropic'); - GL_EXT_texture_lod_bias := CheckExtension('GL_EXT_texture_lod_bias'); - GL_EXT_texture_object := CheckExtension('GL_EXT_texture_object'); - GL_EXT_texture_perturb_normal := CheckExtension('GL_EXT_texture_perturb_normal'); - GL_EXT_texture3D := CheckExtension('GL_EXT_texture3D'); - GL_EXT_vertex_array := CheckExtension('GL_EXT_vertex_array'); - GL_EXT_vertex_weighting := CheckExtension('GL_EXT_vertex_weighting'); - - GL_FfdMaskSGIX := CheckExtension('GL_FfdMaskSGIX'); - GL_HP_convolution_border_modes := CheckExtension('GL_HP_convolution_border_modes'); - GL_HP_image_transform := CheckExtension('GL_HP_image_transform'); - GL_HP_occlusion_test := CheckExtension('GL_HP_occlusion_test'); - GL_HP_texture_lighting := CheckExtension('GL_HP_texture_lighting'); - - GL_IBM_cull_vertex := CheckExtension('GL_IBM_cull_vertex'); - GL_IBM_multimode_draw_arrays := CheckExtension('GL_IBM_multimode_draw_arrays'); - GL_IBM_rasterpos_clip := CheckExtension('GL_IBM_rasterpos_clip'); - GL_IBM_vertex_array_lists := CheckExtension('GL_IBM_vertex_array_lists'); - - GL_INGR_color_clamp := CheckExtension('GL_INGR_color_clamp'); - GL_INGR_interlace_read := CheckExtension('GL_INGR_interlace_read'); - - GL_INTEL_parallel_arrays := CheckExtension('GL_INTEL_parallel_arrays'); - - GL_KTX_buffer_region := CheckExtension('GL_KTX_buffer_region'); - - GL_MESA_resize_buffers := CheckExtension('GL_MESA_resize_buffers'); - GL_MESA_window_pos := CheckExtension('GL_MESA_window_pos'); - - GL_NV_blend_square := CheckExtension('GL_NV_blend_square'); - GL_NV_fog_distance := CheckExtension('GL_NV_fog_distance'); - GL_NV_light_max_exponent := CheckExtension('GL_NV_light_max_exponent'); - GL_NV_register_combiners := CheckExtension('GL_NV_register_combiners'); - GL_NV_texgen_emboss := CheckExtension('GL_NV_texgen_emboss'); - GL_NV_texgen_reflection := CheckExtension('GL_NV_texgen_reflection'); - GL_NV_texture_env_combine4 := CheckExtension('GL_NV_texture_env_combine4'); - GL_NV_vertex_array_range := CheckExtension('GL_NV_vertex_array_range'); - GL_NV_vertex_program := CheckExtension('GL_NV_vertex_program'); - - GL_PGI_misc_hints := CheckExtension('GL_PGI_misc_hints'); - GL_PGI_vertex_hints := CheckExtension('GL_PGI_vertex_hints'); - - GL_REND_screen_coordinates := CheckExtension('GL_REND_screen_coordinates'); - - GL_SGI_color_matrix := CheckExtension('GL_SGI_color_matrix'); - GL_SGI_color_table := CheckExtension('GL_SGI_color_table'); - GL_SGI_depth_pass_instrument := CheckExtension('GL_SGI_depth_pass_instrument'); - - GL_SGIS_detail_texture := CheckExtension('GL_SGIS_detail_texture'); - GL_SGIS_fog_function := CheckExtension('GL_SGIS_fog_function'); - GL_SGIS_generate_mipmap := CheckExtension('GL_SGIS_generate_mipmap'); - GL_SGIS_multisample := CheckExtension('GL_SGIS_multisample'); - GL_SGIS_multitexture := CheckExtension('GL_SGIS_multitexture'); - GL_SGIS_pixel_texture := CheckExtension('GL_SGIS_pixel_texture'); - GL_SGIS_point_line_texgen := CheckExtension('GL_SGIS_point_line_texgen'); - GL_SGIS_point_parameters := CheckExtension('GL_SGIS_point_parameters'); - GL_SGIS_sharpen_texture := CheckExtension('GL_SGIS_sharpen_texture'); - GL_SGIS_texture_border_clamp := CheckExtension('GL_SGIS_texture_border_clamp'); - GL_SGIS_texture_color_mask := CheckExtension('GL_SGIS_texture_color_mask'); - GL_SGIS_texture_edge_clamp := CheckExtension('GL_SGIS_texture_edge_clamp'); - GL_SGIS_texture_filter4 := CheckExtension('GL_SGIS_texture_filter4'); - GL_SGIS_texture_lod := CheckExtension('GL_SGIS_texture_lod'); - GL_SGIS_texture_select := CheckExtension('GL_SGIS_texture_select'); - GL_SGIS_texture4D := CheckExtension('GL_SGIS_texture4D'); - - GL_SGIX_async := CheckExtension('GL_SGIX_async'); - GL_SGIX_async_histogram := CheckExtension('GL_SGIX_async_histogram'); - GL_SGIX_async_pixel := CheckExtension('GL_SGIX_async_pixel'); - GL_SGIX_blend_alpha_minmax := CheckExtension('GL_SGIX_blend_alpha_minmax'); - GL_SGIX_calligraphic_fragment := CheckExtension('GL_SGIX_calligraphic_fragment'); - GL_SGIX_clipmap := CheckExtension('GL_SGIX_clipmap'); - GL_SGIX_convolution_accuracy := CheckExtension('GL_SGIX_convolution_accuracy'); - GL_SGIX_depth_texture := CheckExtension('GL_SGIX_depth_texture'); - GL_SGIX_flush_raster := CheckExtension('GL_SGIX_flush_raster'); - GL_SGIX_fog_offset := CheckExtension('GL_SGIX_fog_offset'); - GL_SGIX_fog_scale := CheckExtension('GL_SGIX_fog_scale'); - GL_SGIX_fragment_lighting := CheckExtension('GL_SGIX_fragment_lighting'); - GL_SGIX_framezoom := CheckExtension('GL_SGIX_framezoom'); - GL_SGIX_igloo_interface := CheckExtension('GL_SGIX_igloo_interface'); - GL_SGIX_instruments := CheckExtension('GL_SGIX_instruments'); - GL_SGIX_interlace := CheckExtension('GL_SGIX_interlace'); - GL_SGIX_ir_instrument1 := CheckExtension('GL_SGIX_ir_instrument1'); - GL_SGIX_list_priority := CheckExtension('GL_SGIX_list_priority'); - GL_SGIX_pixel_texture := CheckExtension('GL_SGIX_pixel_texture'); - GL_SGIX_pixel_tiles := CheckExtension('GL_SGIX_pixel_tiles'); - GL_SGIX_polynomial_ffd := CheckExtension('GL_SGIX_polynomial_ffd'); - GL_SGIX_reference_plane := CheckExtension('GL_SGIX_reference_plane'); - GL_SGIX_resample := CheckExtension('GL_SGIX_resample'); - GL_SGIX_shadow := CheckExtension('GL_SGIX_shadow'); - GL_SGIX_shadow_ambient := CheckExtension('GL_SGIX_shadow_ambient'); - GL_SGIX_sprite := CheckExtension('GL_SGIX_sprite'); - GL_SGIX_subsample := CheckExtension('GL_SGIX_subsample'); - GL_SGIX_tag_sample_buffer := CheckExtension('GL_SGIX_tag_sample_buffer'); - GL_SGIX_texture_add_env := CheckExtension('GL_SGIX_texture_add_env'); - GL_SGIX_texture_lod_bias := CheckExtension('GL_SGIX_texture_lod_bias'); - GL_SGIX_texture_multi_buffer := CheckExtension('GL_SGIX_texture_multi_buffer'); - GL_SGIX_texture_scale_bias := CheckExtension('GL_SGIX_texture_scale_bias'); - GL_SGIX_vertex_preclip := CheckExtension('GL_SGIX_vertex_preclip'); - GL_SGIX_ycrcb := CheckExtension('GL_SGIX_ycrcb'); - GL_SGIX_ycrcba := CheckExtension('GL_SGIX_ycrcba'); - - GL_SUN_convolution_border_modes := CheckExtension('GL_SUN_convolution_border_modes'); - GL_SUN_global_alpha := CheckExtension('GL_SUN_global_alpha'); - GL_SUN_triangle_list := CheckExtension('GL_SUN_triangle_list'); - GL_SUN_vertex := CheckExtension('GL_SUN_vertex'); - - GL_SUNX_constant_data := CheckExtension('GL_SUNX_constant_data'); - - GL_WIN_phong_shading := CheckExtension('GL_WIN_phong_shading'); - GL_WIN_specular_fog := CheckExtension('GL_WIN_specular_fog'); - GL_WIN_swap_hint := CheckExtension('GL_WIN_swap_hint'); - - WGL_EXT_swap_control := CheckExtension('WGL_EXT_swap_control'); - WGL_ARB_extensions_string := CheckExtension('WGL_ARB_extensions_string'); - WGL_ARB_pixel_format := CheckExtension('WGL_ARB_pixel_format'); - - // GLU - Buffer := gluGetString(GLU_EXTENSIONS); - GLU_EXT_TEXTURE := CheckExtension('GLU_EXT_TEXTURE'); - GLU_EXT_object_space_tess := CheckExtension('GLU_EXT_object_space_tess'); - GLU_EXT_nurbs_tessellator := CheckExtension('GLU_EXT_nurbs_tessellator'); - - // ARB wgl extensions - if Assigned(wglGetExtensionsStringARB) then - begin - Buffer := wglGetExtensionsStringARB(wglGetCurrentDC); - WGL_ARB_extensions_string := CheckExtension('WGL_ARB_extensions_string'); - WGL_ARB_pixel_format := CheckExtension('WGL_ARB_pixel_format'); - end - else - begin - WGL_ARB_extensions_string := False; - WGL_ARB_pixel_format := False; - end; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function SetupPalette(DC: HDC; PFD: TPixelFormatDescriptor): HPalette; - -var - nColors, - I: Integer; - LogPalette: TMaxLogPalette; - RedMask, - GreenMask, - BlueMask: Byte; - -begin - nColors := 1 shl Pfd.cColorBits; - LogPalette.palVersion := $300; - LogPalette.palNumEntries := nColors; - RedMask := (1 shl Pfd.cRedBits ) - 1; - GreenMask := (1 shl Pfd.cGreenBits) - 1; - BlueMask := (1 shl Pfd.cBlueBits ) - 1; - with LogPalette, PFD do - for I := 0 to nColors - 1 do - begin - palPalEntry[I].peRed := (((I shr cRedShift ) and RedMask ) * 255) div RedMask; - palPalEntry[I].peGreen := (((I shr cGreenShift) and GreenMask) * 255) div GreenMask; - palPalEntry[I].peBlue := (((I shr cBlueShift ) and BlueMask ) * 255) div BlueMask; - palPalEntry[I].peFlags := 0; - end; - - Result := CreatePalette(PLogPalette(@LogPalette)^); - if Result <> 0 then - begin - SelectPalette(DC, Result, False); - RealizePalette(DC); - end - else - RaiseLastOSError; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function CreateRenderingContext(DC: HDC; Options: TRCOptions; ColorBits, StencilBits, AccumBits, AuxBuffers: Integer; - Layer: Integer; var Palette: HPALETTE): HGLRC; - -// Set the OpenGL properties required to draw to the given canvas and create a rendering context for it. - -const - MemoryDCs = [OBJ_MEMDC, OBJ_METADC, OBJ_ENHMETADC]; - -var - PFDescriptor: TPixelFormatDescriptor; - PixelFormat: Integer; - AType: DWORD; - -begin - FillChar(PFDescriptor, SizeOf(PFDescriptor), 0); - with PFDescriptor do - begin - nSize := SizeOf(PFDescriptor); - nVersion := 1; - dwFlags := PFD_SUPPORT_OPENGL; - AType := GetObjectType(DC); - if AType = 0 then - RaiseLastOSError; - - if AType in MemoryDCs then - dwFlags := dwFlags or PFD_DRAW_TO_BITMAP - else - dwFlags := dwFlags or PFD_DRAW_TO_WINDOW; - if opDoubleBuffered in Options then - dwFlags := dwFlags or PFD_DOUBLEBUFFER; - if opGDI in Options then - dwFlags := dwFlags or PFD_SUPPORT_GDI; - if opStereo in Options then - dwFlags := dwFlags or PFD_STEREO; - iPixelType := PFD_TYPE_RGBA; - cColorBits := ColorBits; - cDepthBits := 32; - cStencilBits := StencilBits; - cAccumBits := AccumBits; - cAuxBuffers := AuxBuffers; - if Layer = 0 then - iLayerType := PFD_MAIN_PLANE - else - if Layer > 0 then - iLayerType := PFD_OVERLAY_PLANE - else - iLayerType := Byte(PFD_UNDERLAY_PLANE); - end; - - // Just in case it didn't happen already. - if not InitOpenGL then - RaiseLastOSError; - PixelFormat := ChoosePixelFormat(DC, {$ifndef FPC}@{$endif}PFDescriptor); - if PixelFormat = 0 then - RaiseLastOSError; - - // NOTE: It is not allowed to change a pixel format of a device context once it has been set. - // Hence you may create more than one rendering context for one single device only if it - // uses the same pixel format as the first created RC. - if GetPixelFormat(DC) <> PixelFormat then - begin - if not SetPixelFormat(DC, PixelFormat, @PFDescriptor) then - RaiseLastOSError; - end; - - // Check the properties we just set. - DescribePixelFormat(DC, PixelFormat, SizeOf(PFDescriptor), PFDescriptor); - with PFDescriptor do - if (dwFlags and PFD_NEED_PALETTE) <> 0 then - Palette := SetupPalette(DC, PFDescriptor) - else - Palette := 0; - - Result := wglCreateLayerContext(DC, Layer); - if Result = 0 then - RaiseLastOSError - else - LastPixelFormat := 0; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -procedure ActivateRenderingContext(DC: HDC; RC: HGLRC); - -var - PixelFormat: Integer; - -begin - Assert((DC <> 0), 'DC must not be 0'); - Assert((RC <> 0), 'RC must not be 0'); - - if ActivationRefCount = 0 then - begin - // Before activating the rendering context check if it is not already used by another thread. - with ContextList.LockList do - try - if IndexOf(Pointer(RC)) = -1 then - begin - if wglMakeCurrent(DC, RC) then - Add(Pointer(RC)) - else - ShowError(SMakeCurrentFailed); - end - else - ShowError(SRCAlreadyActive) - finally - ContextList.UnlockList; - end; - - Inc(ActivationRefCount); - - // The extension function addresses are unique for each pixel format. All rendering - // contexts of a given pixel format share the same extension function addresses. - PixelFormat := GetPixelFormat(DC); - if PixelFormat <> LastPixelFormat then - begin - ReadExtensions; - ReadImplementationProperties; - LastPixelFormat := PixelFormat; - end; - end - else - begin - Assert((wglGetCurrentDC = DC) and (wglGetCurrentContext = RC), 'Incoherent DC/RC pair.'); - Inc(ActivationRefCount); - end; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -procedure DeactivateRenderingContext; - -begin - Assert(ActivationRefCount > 0, 'Unbalanced deactivation.'); - if ActivationRefCount > 0 then - begin - Dec(ActivationRefCount); - - if ActivationRefCount = 0 then - begin - // If the rendering context is no longer used then remove it from the context list to indicate - // it can now be used in any thread. - with ContextList.LockList do - try - Remove(Pointer(wglGetCurrentContext)); - if not wglMakeCurrent(0, 0) then - ShowError(SMakeCurrentFailed); - finally - ContextList.UnlockList; - end; - end; - end; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -procedure DestroyRenderingContext(RC: HGLRC); - -// Used to destroy the given rendering context. Only contexts which are no longer in use by any thread can be deleted. - -begin - Assert((ActivationRefCount = 0), 'Active contexts cannot be deleted.'); - - with ContextList.LockList do - try - if not wglDeleteContext(RC) then - ShowError(SDeleteContextFailed); - if IndexOf(Pointer(RC)) > -1 then - ShowError(SContextInUse); - finally - ContextList.UnlockList; - end; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function CurrentDC: HDC; - -// Returns the device context which is used for the current rendering context of the caller thread. - -begin - Result := wglGetCurrentDC; -end; - -{$endif} - -//---------------------------------------------------------------------------------------------------------------------- - -procedure CloseOpenGL; -begin - if GLHandle <> INVALID_MODULEHANDLE then - begin - UnloadModule( GLHandle ); - GLHandle := INVALID_MODULEHANDLE; - end; - - if GLUHandle <> INVALID_MODULEHANDLE then - begin - UnloadModule( GLUHandle ); - GLUHandle := INVALID_MODULEHANDLE; - end; - - ClearProcAddresses; - ClearExtensions; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function InitOpenGL: Boolean; - -begin - if (GLHandle = INVALID_MODULEHANDLE) or (GLUHandle = INVALID_MODULEHANDLE) then - Result := InitOpenGLFromLibrary(PChar( SDefaultGLLibrary ), PChar( SDefaultGLULibrary ) ) - else - Result := True; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function InitOpenGLFromLibrary(GLName, GLUName: PChar): Boolean; - -begin - Result := False; - CloseOpenGL; - - LoadModule( GLHandle, GLName ); - LoadModule( GLUHandle, GLUName ); - - if (GLHandle <> INVALID_MODULEHANDLE) and (GLUHandle <> INVALID_MODULEHANDLE) then - begin - LoadProcAddresses; - Result := True; - end - else - begin - if GLHandle <> INVALID_MODULEHANDLE then - UnloadModule( GLHandle ); - - if GLUHandle <> INVALID_MODULEHANDLE then - UnloadModule( GLUHandle ); - end; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function IsOpenGLInitialized: Boolean; - -begin - Result := GLHandle <> INVALID_MODULEHANDLE; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -procedure UnloadOpenGL; - -// compatibility routine - -begin - CloseOpenGL; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function LoadOpenGL: Boolean; - -// compatibility routine - -begin - Result := InitOpenGL; -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function LoadOpenGLFromLibrary(GLName, GLUName: PChar): Boolean; - -// compatibility routine - -begin - Result := InitOpenGLFromLibrary(GLName, GLUName); -end; - -//---------------------------------------------------------------------------------------------------------------------- - -function IsOpenGLLoaded: Boolean; - -// compatibility routine - -begin - Result := GLHandle <> INVALID_MODULEHANDLE; -end; - -//---------------------------------------------------------------------------------------------------------------------- -{$ifdef FPC} -const Default8087CW: Word = $1332; - -{$ASMMODE INTEL} -procedure Set8087CW(NewCW: Word); Assembler; -asm - MOV Default8087CW, AX -end; -{$endif} - -//---------------------------------------------------------------------------------------------------------------------- - -initialization - ContextList := TThreadList.Create; - Set8087CW($133F); -finalization - CloseOpenGL; - ContextList.Free; - // We don't need to reset the FPU control word as the previous set call is process specific. -end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/opengl12.rst b/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/opengl12.rst deleted file mode 100644 index 857993e7..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/OpenGL/Pas/opengl12.rst +++ /dev/null @@ -1,26 +0,0 @@ - -# hash value = 79191886 -opengl12.srcalreadyactive='Rendering context already active in another th'+ -'read.' - - -# hash value = 191308692 -opengl12.smakecurrentfailed='wglMakeCurrent failed' - - -# hash value = 214729876 -opengl12.sdeletecontextfailed='wglDeleteContext failed' - - -# hash value = 230190814 -opengl12.scontextinuse='Cannot delete rendering context. It is still in u'+ -'se by another thread.' - - -# hash value = 168003996 -opengl12.sdefaultgllibrary='OpenGL32.dll' - - -# hash value = 140838716 -opengl12.sdefaultglulibrary='GLU32.dll' - diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/Readme.txt b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/Readme.txt deleted file mode 100644 index 76d63a9d..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/Readme.txt +++ /dev/null @@ -1,27 +0,0 @@ -Delphi interface unit for OpenGL version 1.2 compilable with Delphi 3-6 and Kylix. - -This unit is open source under the Mozilla Public License and -the original author is Dipl. Ing. Mike Lischke (public@lischke-online.de). - -You can obtain this unit also from the JEDI (Joint Endeavor of Delphi Innovators) -API page at www.delphi-jedi.org. - -Note for GLScene users: Eric Grange has provided a general vector types unit which -resolves conflicts for types which are defined in OpenGL12.pas as well as Geometry.pas. -This unit is located in the sub folder "GLScene AddOn". -Please add this unit to the uses clause of OpenGL12.pas and remove the few types which -are already declared in VectorTypes.pas. - -For tests and as starting point three demos are included into the package. Two of them (GLDiag and GLTest) -need the (also provided) simple OpenGL control GLControl (see "GLControl\Package"). - -- Basic is a very simple test program which only uses an empty form. -- GLTest (in GLControl) uses GLControl to show four rendering contexts simultanously. -- GLDiag is a diagnosis tool similar to DXDiag which shows some properties of the current - OpenGL driver implementation. - -Have fun and - -Ciao, Mike -www.lischke-online.de -www.delphi-unicode.net \ No newline at end of file diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/jedi-sdl.inc b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/jedi-sdl.inc deleted file mode 100644 index 48a789fd..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/jedi-sdl.inc +++ /dev/null @@ -1,337 +0,0 @@ -{ - $Id: jedi-sdl.inc,v 1.9 2004/12/23 23:42:17 savage Exp $ -} -{******************************************************************************} -{ } -{ Borland Delphi SDL - Simple DirectMedia Layer } -{ Global Conditional Definitions for JEDI-SDL cross-compilation } -{ } -{ } -{ The initial developer of this Pascal code was : } -{ Prof. Abimbola Olowofoyeku } -{ } -{ Portions created by Prof. Abimbola Olowofoyeku are } -{ Copyright (C) 2000 - 2100 Prof. Abimbola Olowofoyeku. } -{ } -{ } -{ Contributor(s) } -{ -------------- } -{ Prof. Abimbola Olowofoyeku } -{ Dominqiue Louis } -{ } -{ Obtained through: } -{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } -{ } -{ You may retrieve the latest version of this file at the Project } -{ JEDI home page, located at http://delphi-jedi.org } -{ } -{ The contents of this file are used with permission, subject to } -{ the Mozilla Public License Version 1.1 (the "License"); you may } -{ not use this file except in compliance with the License. You may } -{ obtain a copy of the License at } -{ http://www.mozilla.org/MPL/MPL-1.1.html } -{ } -{ Software distributed under the License is distributed on an } -{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } -{ implied. See the License for the specific language governing } -{ rights and limitations under the License. } -{ } -{ Description } -{ ----------- } -{ This code has been copied from... } -{ Global Conditional Definitions for Chief's UNZIP package } -{ By Prof. Abimbola Olowofoyeku (The African Chief) } -{ http://www.bigfoot.com/~African_Chief/ } -{ } -{ } -{ Requires } -{ -------- } -{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } -{ They are available from... } -{ http://www.libsdl.org . } -{ } -{ Programming Notes } -{ ----------------- } -{ } -{ } -{ } -{ } -{ Revision History } -{ ---------------- } -{ 2003-04-03 DL - Initial addition } -{ } -{ 2003-04-07 DL - Added Macro ON derective for FPC and OpenGL and removed } -{ WEAKPACKAGE derective. WEAKPACKAGE should be set when } -{ appropriate. } -{ } -{ 2003-04-23 - DL : under instruction from Alexey Barkovoy I have added } -{ better TMT Pascal support and under instruction } -{ from Prof. Abimbola Olowofoyeku (The African Chief) } -{ I have added better Gnu Pascal support } -{ } -{ 2004-01-19 - DL : Under instruction from Marco van de Voort, I have added } -{ Better FPC support for FreeBSD. } -{ } -(* - $Log: jedi-sdl.inc,v $ - Revision 1.9 2004/12/23 23:42:17 savage - Applied Patches supplied by Michalis Kamburelis ( THANKS! ), for greater FreePascal compatability. - - Revision 1.8 2004/10/20 22:43:04 savage - Ensure that UNSAFE type warning are off in D9 as well - - Revision 1.7 2004/04/05 09:59:51 savage - Changes for FreePacal as suggested by Marco - - Revision 1.6 2004/03/31 22:18:15 savage - Small comment for turning off warning under GnuPascal - - Revision 1.5 2004/03/30 22:41:02 savage - Added extra commenting due to previous compiler directive - - Revision 1.4 2004/03/30 22:08:33 savage - Added Kylix Define - - Revision 1.3 2004/03/30 21:34:40 savage - {$H+} needed for FPC compatiblity - - Revision 1.2 2004/02/14 00:23:39 savage - As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. - -*) -{******************************************************************************} - -{.$define Debug} { uncomment for debugging } - -{$IFNDEF FPC} - {$IFDEF __GPC__} - {$I-} - {$W-} // turn off GPC warnings - {$X+} - {$ELSE} {__GPC__} - {$IFDEF Debug} - {$F+,D+,Q-,L+,R+,I-,S+,Y+,A+} - {$ELSE} - {$F+,Q-,R-,S-,I-,A+} - {$ENDIF} - {$ENDIF} {__GPC__} -{$ELSE} {FPC} - //{$M+} -{$ENDIF} {FPC} - -{$IFDEF LINUX} -{$DEFINE UNIX} -{$ENDIF} - -{$IFDEF ver70} - {$IFDEF Windows} - {$DEFINE Win16} - {$ENDIF Windows} - {$IFDEF MSDOS} - {$DEFINE NO_EXPORTS} - {$ENDIF MSDOS} - {$IFDEF DPMI} - {$DEFINE BP_DPMI} - {$ENDIF} - {$DEFINE OS_16_BIT} - {$DEFINE __OS_DOS__} -{$ENDIF ver70} - -{$IFDEF ver80} - {$DEFINE Delphi} {Delphi 1.x} - {$DEFINE Delphi16} - {$DEFINE Win16} - {$DEFINE OS_16_BIT} - {$DEFINE __OS_DOS__} -{$ENDIF ver80} - -{$IFDEF ver90} - {$DEFINE Delphi} {Delphi 2.x} - {$DEFINE Delphi32} -{$ENDIF ver90} - -{$IFDEF ver100} - {$DEFINE Delphi} {Delphi 3.x} - {$DEFINE Delphi32} - {$DEFINE WIN32} -{$ENDIF ver100} - -{$IFDEF ver93} - {$DEFINE Delphi} {C++ Builder 1.x} - {$DEFINE Delphi32} -{$ENDIF ver93} - -{$IFDEF ver110} - {$DEFINE Delphi} {C++ Builder 3.x} - {$DEFINE Delphi32} -{$ENDIF ver110} - -{$IFDEF ver120} - {$DEFINE Delphi} {Delphi 4.x} - {$DEFINE Delphi32} - {$DEFINE Has_Int64} -{$ENDIF ver120} - -{$IFDEF ver130} - {$DEFINE Delphi} {Delphi 5.x} - {$DEFINE Delphi32} - {$DEFINE Has_Int64} -{$ENDIF ver130} - -{$IFDEF ver140} - {$DEFINE Delphi} {Delphi 6.x} - {$DEFINE Delphi32} - {$DEFINE Has_Int64} -{$ENDIF ver140} - -{$IFDEF ver150} - {$DEFINE Delphi} {Delphi 7.x} - {$DEFINE Delphi32} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types in Delphi 7} - {$DEFINE Has_Int64} -{$ENDIF ver150} - -{$IFDEF ver160} - {$DEFINE Delphi} {Delphi 8??} - {$DEFINE Delphi32} - {$DEFINE Has_Int64} -{$ENDIF ver160} - -{$IFDEF ver170} - {$DEFINE Delphi} {Delphi 9??} - {$DEFINE Delphi32} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types in Delphi 7} - {$DEFINE Has_Int64} -{$ENDIF ver170} - -{$IFDEF UNIX} - {$ifdef VER150} - {$define KYLIX} - {$endif} - - {$ifdef VER140} - {$define KYLIX} - {$endif} - - {$ifdef VER140} - {$define KYLIX} - {$endif} -{$ENDIF UNIX} - -{$IFDEF VirtualPascal} { Virtual Pascal 2.x } - {$DEFINE Delphi} { Use Delphi Syntax } - {$DEFINE VP2} - {&Delphi+} -{$ENDIF VirtualPascal} - -{$IFDEF Delphi} - {$DEFINE Windows} - {$DEFINE USE_STDCALL} -{$ENDIF Delphi} - -{$IFDEF FPC} - {$MODE Delphi} { use Delphi compatibility mode } - {$H+} - {$PACKRECORDS 4} // Added for record - {$MACRO ON} // Added For OpenGL - {$THREADING on} - {$DEFINE Delphi} - {$DEFINE UseAT} - {$UNDEF USE_STDCALL} - {$DEFINE OS_BigMem} - {$DEFINE NO_EXPORTS} - {$DEFINE Has_Int64} - {$DEFINE NOCRT} - {$IFDEF unix} - {$DEFINE fpc_unix} - {$ELSE} - {$DEFINE __OS_DOS__} - {$ENDIF} - {$IFDEF WIN32} - {$DEFINE UseWin} - {$ENDIF} -{$ENDIF FPC} - -{$IFDEF Win16} - {$K+} {smart callbacks} -{$ENDIF Win16} - - {$IFDEF OS2} - {$UNDEF Windows} - {$DEFINE UseWin} - {$DEFINE OS_BigMem} - {$ENDIF OS2} - -{$IFDEF __GPC__} - {$UNDEF UseWin} - {$UNDEF USE_STDCALL} - {$DEFINE OS_BigMem} - {$DEFINE NO_EXPORTS} - {$DEFINE NOCRT} - {$DEFINE cdecl attribute(cdecl)} -{$ENDIF} - -{$IFDEF __TMT__} - {$DEFINE OS_BigMem} - {$DEFINE NO_EXPORTS} - {$DEFINE __OS_DOS__} - {$DEFINE UseAT} - {$IFNDEF MSDOS} - {$DEFINE USE_STDCALL} - {$ENDIF} - - {$IFDEF __WIN32__} - {$DEFINE Win32} - {$DEFINE UseWin} - {$DEFINE NOCRT} - {$DEFINE Win32} - {$IFNDEF __CON__} - {$DEFINE Windows} - {$ENDIF} - {$ENDIF} - - {$A+} // Word alignment data - {$OA+} // Objects and structures align -{$ENDIF} - -{$IFDEF Win32} - {$DEFINE OS_BigMem} -{$ELSE Win32} - {$IFDEF ver70} - {$DEFINE assembler} - {$ENDIF} { use 16-bit assembler! } -{$ENDIF Win32} - -{ ************************** dos/dos-like platforms **************} -{$IFDEF Windows} - {$DEFINE __OS_DOS__} - {$DEFINE UseWin} - {$DEFINE MSWINDOWS} -{$ENDIF Delphi} - -{$IFDEF OS2} - {$DEFINE __OS_DOS__} - {$DEFINE Can_Use_DLL} -{$ENDIF Delphi} - -{$IFDEF UseWin} - {$DEFINE Can_Use_DLL} -{$ENDIF} - -{$IFDEF Win16} - {$DEFINE Can_Use_DLL} -{$ENDIF} - -{$IFDEF BP_DPMI} - {$DEFINE Can_Use_DLL} -{$ENDIF} - -{$IFDEF USE_STDCALL} - {$IFNDEF __TMT__} - {$DEFINE BY_NAME} - {$ENDIF} -{$ENDIF} - -{$IFNDEF ver70} - {$UNDEF assembler} -{$ENDIF} diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/libxmlparser.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/libxmlparser.pas deleted file mode 100644 index 54841840..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/libxmlparser.pas +++ /dev/null @@ -1,2690 +0,0 @@ -(** -=============================================================================================== -Name : LibXmlParser -=============================================================================================== -Project : All Projects -=============================================================================================== -Subject : Progressive XML Parser for all types of XML Files -=============================================================================================== -Author : Stefan Heymann - Eschenweg 3 - 72076 Tübingen - GERMANY - -E-Mail: stefan@destructor.de -URL: www.destructor.de -=============================================================================================== -Source, Legals ("Licence") --------------------------- -The official site to get this parser is http://www.destructor.de/ - -Usage and Distribution of this Source Code is ruled by the -"Destructor.de Source code Licence" (DSL) which comes with this file or -can be downloaded at http://www.destructor.de/ - -IN SHORT: Usage and distribution of this source code is free. - You use it completely on your own risk. - -Postcardware ------------- -If you like this code, please send a postcard of your city to my above address. -=============================================================================================== -!!! All parts of this code which are not finished or not conforming exactly to - the XmlSpec are marked with three exclamation marks - --!- Parts where the parser may be able to detect errors in the document's syntax are - marked with the dash-exlamation mark-dash sequence. -=============================================================================================== -Terminology: ------------- -- Start: Start of a buffer part -- Final: End (last character) of a buffer part -- DTD: Document Type Definition -- DTDc: Document Type Declaration -- XMLSpec: The current W3C XML Recommendation (version 1.0 as of 1998-02-10), Chapter No. -- Cur*: Fields concerning the "Current" part passed back by the "Scan" method -=============================================================================================== -Scanning the XML document -------------------------- -- Create TXmlParser Instance MyXml := TXmlParser.Create; -- Load XML Document MyXml.LoadFromFile (Filename); -- Start Scanning MyXml.StartScan; -- Scan Loop WHILE MyXml.Scan DO -- Test for Part Type CASE MyXml.CurPartType OF -- Handle Parts ... : ;;; -- Handle Parts ... : ;;; -- Handle Parts ... : ;;; - END; -- Destroy MyXml.Free; -=============================================================================================== -Loading the XML document ------------------------- -You can load the XML document from a file with the "LoadFromFile" method. -It is beyond the scope of this parser to perform HTTP or FTP accesses. If you want your -application to handle such requests (URLs), you can load the XML via HTTP or FTP or whatever -protocol and hand over the data buffer using the "LoadFromBuffer" or "SetBuffer" method. -"LoadFromBuffer" loads the internal buffer of TXmlParser with the given null-terminated -string, thereby creating a copy of that buffer. -"SetBuffer" just takes the pointer to another buffer, which means that the given -buffer pointer must be valid while the document is accessed via TXmlParser. -=============================================================================================== -Encodings: ----------- -This XML parser kind of "understands" the following encodings: -- UTF-8 -- ISO-8859-1 -- Windows-1252 - -Any flavor of multi-byte characters (and this includes UTF-16) is not supported. Sorry. - -Every string which has to be passed to the application passes the virtual method -"TranslateEncoding" which translates the string from the current encoding (stored in -"CurEncoding") into the encoding the application wishes to receive. -The "TranslateEncoding" method that is built into TXmlParser assumes that the application -wants to receive Windows ANSI (Windows-1252, about the same as ISO-8859-1) and is able -to convert UTF-8 and ISO-8859-1 encodings. -For other source and target encodings, you will have to override "TranslateEncoding". -=============================================================================================== -Buffer Handling ---------------- -- The document must be loaded completely into a piece of RAM -- All character positions are referenced by PChar pointers -- The TXmlParser instance can either "own" the buffer itself (then, FBufferSize is > 0) - or reference the buffer of another instance or object (then, FBuffersize is 0 and - FBuffer is not NIL) -- The Property DocBuffer passes back a pointer to the first byte of the document. If there - is no document stored (FBuffer is NIL), the DocBuffer returns a pointer to a NULL character. -=============================================================================================== -Whitespace Handling -------------------- -The TXmlParser property "PackSpaces" determines how Whitespace is returned in Text Content: -While PackSpaces is true, all leading and trailing whitespace characters are trimmed of, all -Whitespace is converted to Space #x20 characters and contiguous Whitespace characters are -compressed to one. -If the "Scan" method reports a ptContent part, the application can get the original text -with all whitespace characters by extracting the characters from "CurStart" to "CurFinal". -If the application detects an xml:space attribute, it can set "PackSpaces" accordingly or -use CurStart/CurFinal. -Please note that TXmlParser does _not_ normalize Line Breaks to single LineFeed characters -as the XmlSpec requires (XmlSpec 2.11). -The xml:space attribute is not handled by TXmlParser. This is on behalf of the application. -=============================================================================================== -Non-XML-Conforming ------------------- -TXmlParser does not conform 100 % exactly to the XmlSpec: -- UTF-16 is not supported (XmlSpec 2.2) - (Workaround: Convert UTF-16 to UTF-8 and hand the buffer over to TXmlParser) -- As the parser only works with single byte strings, all Unicode characters > 255 - can currently not be handled correctly. -- Line breaks are not normalized to single Linefeed #x0A characters (XmlSpec 2.11) - (Workaround: The Application can access the text contents on its own [CurStart, CurFinal], - thereby applying every normalization it wishes to) -- The attribute value normalization does not work exactly as defined in the - Second Edition of the XML 1.0 specification. -- See also the code parts marked with three consecutive exclamation marks. These are - parts which are not finished in the current code release. - -This list may be incomplete, so it may grow if I get to know any other points. -As work on the parser proceeds, this list may also shrink. -=============================================================================================== -Things Todo ------------ -- Introduce a new event/callback which is called when there is an unresolvable - entity or character reference -- Support Unicode -- Use Streams instead of reading the whole XML into memory -=============================================================================================== -Change History, Version numbers -------------------------------- -The Date is given in ISO Year-Month-Day (YYYY-MM-DD) order. -Versions are counted from 1.0.0 beginning with the version from 2000-03-16. -Unreleased versions don't get a version number. - -Date Author Version Changes ------------------------------------------------------------------------------------------------ -2000-03-16 HeySt 1.0.0 Start -2000-03-28 HeySt 1.0.1 Initial Publishing of TXmlParser on the destructor.de Web Site -2000-03-30 HeySt 1.0.2 TXmlParser.AnalyzeCData: Call "TranslateEncoding" for CurContent -2000-03-31 HeySt 1.0.3 Deleted the StrPosE function (was not needed anyway) -2000-04-04 HeySt 1.0.4 TDtdElementRec modified: Start/Final for all Elements; - Should be backwards compatible. - AnalyzeDtdc: Set CurPartType to ptDtdc -2000-04-23 HeySt 1.0.5 New class TObjectList. Eliminated reference to the Delphi 5 - "Contnrs" unit so LibXmlParser is Delphi 4 compatible. -2000-07-03 HeySt 1.0.6 TNvpNode: Added Constructor -2000-07-11 HeySt 1.0.7 Removed "Windows" from USES clause - Added three-exclamation-mark comments for Utf8ToAnsi/AnsiToUtf8 - Added three-exclamation-mark comments for CHR function calls -2000-07-23 HeySt 1.0.8 TXmlParser.Clear: CurAttr.Clear; EntityStack.Clear; - (This was not a bug; just defensive programming) -2000-07-29 HeySt 1.0.9 TNvpList: Added methods: Node(Index), Value(Index), Name(Index); -2000-10-07 HeySt Introduced Conditional Defines - Uses Contnrs unit and its TObjectList class again for - Delphi 5 and newer versions -2001-01-30 HeySt Introduced Version Numbering - Made LoadFromFile and LoadFromBuffer BOOLEAN functions - Introduced FileMode parameter for LoadFromFile - BugFix: TAttrList.Analyze: Must add CWhitespace to ExtractName call - Comments worked over -2001-02-28 HeySt 1.0.10 Completely worked over and tested the UTF-8 functions - Fixed a bug in TXmlParser.Scan which caused it to start over when it - was called after the end of scanning, resulting in an endless loop - TEntityStack is now a TObjectList instead of TList -2001-07-03 HeySt 1.0.11 Updated Compiler Version IFDEFs for Kylix -2001-07-11 HeySt 1.0.12 New TCustomXmlScanner component (taken over from LibXmlComps.pas) -2001-07-14 HeySt 1.0.13 Bugfix TCustomXmlScanner.FOnTranslateEncoding -2001-10-22 HeySt Don't clear CurName anymore when the parser finds a CDATA section. -2001-12-03 HeySt 1.0.14 TObjectList.Clear: Make call to INHERITED method (fixes a memory leak) -2001-12-05 HeySt 1.0.15 TObjectList.Clear: removed call to INHERITED method - TObjectList.Destroy: Inserted SetCapacity call. - Reduces need for frequent re-allocation of pointer buffer - Dedicated to my father, Theodor Heymann -2002-06-26 HeySt 1.0.16 TXmlParser.Scan: Fixed a bug with PIs whose name is beginning - with 'xml'. Thanks to Uwe Kamm for submitting this bug. - The CurEncoding property is now always in uppercase letters (the XML - spec wants it to be treated case independently so when it's uppercase - comparisons are faster) -2002-03-04 HeySt 1.0.17 Included an IFDEF for Delphi 7 (VER150) and Kylix - There is a new symbol HAS_CONTNRS_UNIT which is used now to - distinguish between IDEs which come with the Contnrs unit and - those that don't. -*) - -UNIT libxmlparser; - -{$I jedi-sdl.inc} - -{$ALIGN ON} - -INTERFACE - -USES - SysUtils, Classes, - (*$IFDEF HAS_CONTNRS_UNIT *) // The Contnrs Unit was introduced in Delphi 5 - Contnrs, - (*$ENDIF*) - Math; - -CONST - CVersion = '1.0.17'; // This variable will be updated for every release - // (I hope, I won't forget to do it everytime ...) - -TYPE - TPartType = // --- Document Part Types - (ptNone, // Nothing - ptXmlProlog, // XML Prolog XmlSpec 2.8 / 4.3.1 - ptComment, // Comment XmlSpec 2.5 - ptPI, // Processing Instruction XmlSpec 2.6 - ptDtdc, // Document Type Declaration XmlSpec 2.8 - ptStartTag, // Start Tag XmlSpec 3.1 - ptEmptyTag, // Empty-Element Tag XmlSpec 3.1 - ptEndTag, // End Tag XmlSpec 3.1 - ptContent, // Text Content between Tags - ptCData); // CDATA Section XmlSpec 2.7 - - TDtdElemType = // --- DTD Elements - (deElement, // !ELEMENT declaration - deAttList, // !ATTLIST declaration - deEntity, // !ENTITY declaration - deNotation, // !NOTATION declaration - dePI, // PI in DTD - deComment, // Comment in DTD - deError); // Error found in the DTD - -TYPE - TAttrList = CLASS; - TEntityStack = CLASS; - TNvpList = CLASS; - TElemDef = CLASS; - TElemList = CLASS; - TEntityDef = CLASS; - TNotationDef = CLASS; - - TDtdElementRec = RECORD // --- This Record is returned by the DTD parser callback function - Start, Final : PChar; // Start/End of the Element's Declaration - CASE ElementType : TDtdElemType OF // Type of the Element - deElement, // - deAttList : (ElemDef : TElemDef); // - deEntity : (EntityDef : TEntityDef); // - deNotation : (NotationDef : TNotationDef); // - dePI : (Target : PChar; // - Content : PChar; - AttrList : TAttrList); - deError : (Pos : PChar); // Error - // deComment : ((No additional fields here)); // - END; - - TXmlParser = CLASS // --- Internal Properties and Methods - PROTECTED - FBuffer : PChar; // NIL if there is no buffer available - FBufferSize : INTEGER; // 0 if the buffer is not owned by the Document instance - FSource : STRING; // Name of Source of document. Filename for Documents loaded with LoadFromFile - - FXmlVersion : STRING; // XML version from Document header. Default is '1.0' - FEncoding : STRING; // Encoding from Document header. Default is 'UTF-8' - FStandalone : BOOLEAN; // Standalone declaration from Document header. Default is 'yes' - FRootName : STRING; // Name of the Root Element (= DTD name) - FDtdcFinal : PChar; // Pointer to the '>' character terminating the DTD declaration - - FNormalize : BOOLEAN; // If true: Pack Whitespace and don't return empty contents - EntityStack : TEntityStack; // Entity Stack for Parameter and General Entities - FCurEncoding : STRING; // Current Encoding during parsing (always uppercase) - - PROCEDURE AnalyzeProlog; // Analyze XML Prolog or Text Declaration - PROCEDURE AnalyzeComment (Start : PChar; VAR Final : PChar); // Analyze Comments - PROCEDURE AnalyzePI (Start : PChar; VAR Final : PChar); // Analyze Processing Instructions (PI) - PROCEDURE AnalyzeDtdc; // Analyze Document Type Declaration - PROCEDURE AnalyzeDtdElements (Start : PChar; VAR Final : PChar); // Analyze DTD declarations - PROCEDURE AnalyzeTag; // Analyze Start/End/Empty-Element Tags - PROCEDURE AnalyzeCData; // Analyze CDATA Sections - PROCEDURE AnalyzeText (VAR IsDone : BOOLEAN); // Analyze Text Content between Tags - PROCEDURE AnalyzeElementDecl (Start : PChar; VAR Final : PChar); - PROCEDURE AnalyzeAttListDecl (Start : PChar; VAR Final : PChar); - PROCEDURE AnalyzeEntityDecl (Start : PChar; VAR Final : PChar); - PROCEDURE AnalyzeNotationDecl (Start : PChar; VAR Final : PChar); - - PROCEDURE PushPE (VAR Start : PChar); - PROCEDURE ReplaceCharacterEntities (VAR Str : STRING); - PROCEDURE ReplaceParameterEntities (VAR Str : STRING); - PROCEDURE ReplaceGeneralEntities (VAR Str : STRING); - - FUNCTION GetDocBuffer : PChar; // Returns FBuffer or a pointer to a NUL char if Buffer is empty - - PUBLIC // --- Document Properties - PROPERTY XmlVersion : STRING READ FXmlVersion; // XML version from the Document Prolog - PROPERTY Encoding : STRING READ FEncoding; // Document Encoding from Prolog - PROPERTY Standalone : BOOLEAN READ FStandalone; // Standalone Declaration from Prolog - PROPERTY RootName : STRING READ FRootName; // Name of the Root Element - PROPERTY Normalize : BOOLEAN READ FNormalize WRITE FNormalize; // True if Content is to be normalized - PROPERTY Source : STRING READ FSource; // Name of Document Source (Filename) - PROPERTY DocBuffer : PChar READ GetDocBuffer; // Returns document buffer - PUBLIC // --- DTD Objects - Elements : TElemList; // Elements: List of TElemDef (contains Attribute Definitions) - Entities : TNvpList; // General Entities: List of TEntityDef - ParEntities : TNvpList; // Parameter Entities: List of TEntityDef - Notations : TNvpList; // Notations: List of TNotationDef - PUBLIC - CONSTRUCTOR Create; - DESTRUCTOR Destroy; OVERRIDE; - - // --- Document Handling - FUNCTION LoadFromFile (Filename : STRING; - FileMode : INTEGER = fmOpenRead OR fmShareDenyNone) : BOOLEAN; - // Loads Document from given file - FUNCTION LoadFromBuffer (Buffer : PChar) : BOOLEAN; // Loads Document from another buffer - PROCEDURE SetBuffer (Buffer : PChar); // References another buffer - PROCEDURE Clear; // Clear Document - - PUBLIC - // --- Scanning through the document - CurPartType : TPartType; // Current Type - CurName : STRING; // Current Name - CurContent : STRING; // Current Normalized Content - CurStart : PChar; // Current First character - CurFinal : PChar; // Current Last character - CurAttr : TAttrList; // Current Attribute List - PROPERTY CurEncoding : STRING READ FCurEncoding; // Current Encoding - PROCEDURE StartScan; - FUNCTION Scan : BOOLEAN; - - // --- Events / Callbacks - FUNCTION LoadExternalEntity (SystemId, PublicId, - Notation : STRING) : TXmlParser; VIRTUAL; - FUNCTION TranslateEncoding (CONST Source : STRING) : STRING; VIRTUAL; - PROCEDURE DtdElementFound (DtdElementRec : TDtdElementRec); VIRTUAL; - END; - - TValueType = // --- Attribute Value Type - (vtNormal, // Normal specified Attribute - vtImplied, // #IMPLIED attribute value - vtFixed, // #FIXED attribute value - vtDefault); // Attribute value from default value in !ATTLIST declaration - - TAttrDefault = // --- Attribute Default Type - (adDefault, // Normal default value - adRequired, // #REQUIRED attribute - adImplied, // #IMPLIED attribute - adFixed); // #FIXED attribute - - TAttrType = // --- Type of attribute - (atUnknown, // Unknown type - atCData, // Character data only - atID, // ID - atIdRef, // ID Reference - atIdRefs, // Several ID References, separated by Whitespace - atEntity, // Name of an unparsed Entity - atEntities, // Several unparsed Entity names, separated by Whitespace - atNmToken, // Name Token - atNmTokens, // Several Name Tokens, separated by Whitespace - atNotation, // A selection of Notation names (Unparsed Entity) - atEnumeration); // Enumeration - - TElemType = // --- Element content type - (etEmpty, // Element is always empty - etAny, // Element can have any mixture of PCDATA and any elements - etChildren, // Element must contain only elements - etMixed); // Mixed PCDATA and elements - - (*$IFDEF HAS_CONTNRS_UNIT *) - TObjectList = Contnrs.TObjectList; // Re-Export this identifier - (*$ELSE *) - TObjectList = CLASS (TList) - DESTRUCTOR Destroy; OVERRIDE; - PROCEDURE Delete (Index : INTEGER); - PROCEDURE Clear; OVERRIDE; - END; - (*$ENDIF *) - - TNvpNode = CLASS // Name-Value Pair Node - Name : STRING; - Value : STRING; - CONSTRUCTOR Create (TheName : STRING = ''; TheValue : STRING = ''); - END; - - TNvpList = CLASS (TObjectList) // Name-Value Pair List - PROCEDURE Add (Node : TNvpNode); - FUNCTION Node (Name : STRING) : TNvpNode; OVERLOAD; - FUNCTION Node (Index : INTEGER) : TNvpNode; OVERLOAD; - FUNCTION Value (Name : STRING) : STRING; OVERLOAD; - FUNCTION Value (Index : INTEGER) : STRING; OVERLOAD; - FUNCTION Name (Index : INTEGER) : STRING; - END; - - TAttr = CLASS (TNvpNode) // Attribute of a Start-Tag or Empty-Element-Tag - ValueType : TValueType; - AttrType : TAttrType; - END; - - TAttrList = CLASS (TNvpList) // List of Attributes - PROCEDURE Analyze (Start : PChar; VAR Final : PChar); - END; - - TEntityStack = CLASS (TObjectList) // Stack where current position is stored before parsing entities - PROTECTED - Owner : TXmlParser; - PUBLIC - CONSTRUCTOR Create (TheOwner : TXmlParser); - PROCEDURE Push (LastPos : PChar); OVERLOAD; - PROCEDURE Push (Instance : TObject; LastPos : PChar); OVERLOAD; - FUNCTION Pop : PChar; // Returns next char or NIL if EOF is reached. Frees Instance. - END; - - TAttrDef = CLASS (TNvpNode) // Represents a '; - - // --- Name Constants for the above enumeration types - CPartType_Name : ARRAY [TPartType] OF STRING = - ('', 'XML Prolog', 'Comment', 'PI', - 'DTD Declaration', 'Start Tag', 'Empty Tag', 'End Tag', - 'Text', 'CDATA'); - CValueType_Name : ARRAY [TValueType] OF STRING = ('Normal', 'Implied', 'Fixed', 'Default'); - CAttrDefault_Name : ARRAY [TAttrDefault] OF STRING = ('Default', 'Required', 'Implied', 'Fixed'); - CElemType_Name : ARRAY [TElemType] OF STRING = ('Empty', 'Any', 'Childs only', 'Mixed'); - CAttrType_Name : ARRAY [TAttrType] OF STRING = ('Unknown', 'CDATA', - 'ID', 'IDREF', 'IDREFS', - 'ENTITY', 'ENTITIES', - 'NMTOKEN', 'NMTOKENS', - 'Notation', 'Enumeration'); - -FUNCTION ConvertWs (Source: STRING; PackWs: BOOLEAN) : STRING; // Convert WS to spaces #x20 -PROCEDURE SetStringSF (VAR S : STRING; BufferStart, BufferFinal : PChar); // SetString by Start/Final of buffer -FUNCTION StrSFPas (Start, Finish : PChar) : STRING; // Convert buffer part to Pascal string -FUNCTION TrimWs (Source : STRING) : STRING; // Trim Whitespace - -FUNCTION AnsiToUtf8 (Source : ANSISTRING) : STRING; // Convert Win-1252 to UTF-8 -FUNCTION Utf8ToAnsi (Source : STRING; UnknownChar : CHAR = '¿') : ANSISTRING; // Convert UTF-8 to Win-1252 - - -(* -=============================================================================================== -TCustomXmlScanner event based component wrapper for TXmlParser -=============================================================================================== -*) - -TYPE - TCustomXmlScanner = CLASS; - TXmlPrologEvent = PROCEDURE (Sender : TObject; XmlVersion, Encoding: STRING; Standalone : BOOLEAN) OF OBJECT; - TCommentEvent = PROCEDURE (Sender : TObject; Comment : STRING) OF OBJECT; - TPIEvent = PROCEDURE (Sender : TObject; Target, Content: STRING; Attributes : TAttrList) OF OBJECT; - TDtdEvent = PROCEDURE (Sender : TObject; RootElementName : STRING) OF OBJECT; - TStartTagEvent = PROCEDURE (Sender : TObject; TagName : STRING; Attributes : TAttrList) OF OBJECT; - TEndTagEvent = PROCEDURE (Sender : TObject; TagName : STRING) OF OBJECT; - TContentEvent = PROCEDURE (Sender : TObject; Content : STRING) OF OBJECT; - TElementEvent = PROCEDURE (Sender : TObject; ElemDef : TElemDef) OF OBJECT; - TEntityEvent = PROCEDURE (Sender : TObject; EntityDef : TEntityDef) OF OBJECT; - TNotationEvent = PROCEDURE (Sender : TObject; NotationDef : TNotationDef) OF OBJECT; - TErrorEvent = PROCEDURE (Sender : TObject; ErrorPos : PChar) OF OBJECT; - TExternalEvent = PROCEDURE (Sender : TObject; SystemId, PublicId, NotationId : STRING; - VAR Result : TXmlParser) OF OBJECT; - TEncodingEvent = FUNCTION (Sender : TObject; CurrentEncoding, Source : STRING) : STRING OF OBJECT; - - - TCustomXmlScanner = CLASS (TComponent) - PROTECTED - FXmlParser : TXmlParser; - FOnXmlProlog : TXmlPrologEvent; - FOnComment : TCommentEvent; - FOnPI : TPIEvent; - FOnDtdRead : TDtdEvent; - FOnStartTag : TStartTagEvent; - FOnEmptyTag : TStartTagEvent; - FOnEndTag : TEndTagEvent; - FOnContent : TContentEvent; - FOnCData : TContentEvent; - FOnElement : TElementEvent; - FOnAttList : TElementEvent; - FOnEntity : TEntityEvent; - FOnNotation : TNotationEvent; - FOnDtdError : TErrorEvent; - FOnLoadExternal : TExternalEvent; - FOnTranslateEncoding : TEncodingEvent; - FStopParser : BOOLEAN; - FUNCTION GetNormalize : BOOLEAN; - PROCEDURE SetNormalize (Value : BOOLEAN); - - PROCEDURE WhenXmlProlog(XmlVersion, Encoding: STRING; Standalone : BOOLEAN); VIRTUAL; - PROCEDURE WhenComment (Comment : STRING); VIRTUAL; - PROCEDURE WhenPI (Target, Content: STRING; Attributes : TAttrList); VIRTUAL; - PROCEDURE WhenDtdRead (RootElementName : STRING); VIRTUAL; - PROCEDURE WhenStartTag (TagName : STRING; Attributes : TAttrList); VIRTUAL; - PROCEDURE WhenEmptyTag (TagName : STRING; Attributes : TAttrList); VIRTUAL; - PROCEDURE WhenEndTag (TagName : STRING); VIRTUAL; - PROCEDURE WhenContent (Content : STRING); VIRTUAL; - PROCEDURE WhenCData (Content : STRING); VIRTUAL; - PROCEDURE WhenElement (ElemDef : TElemDef); VIRTUAL; - PROCEDURE WhenAttList (ElemDef : TElemDef); VIRTUAL; - PROCEDURE WhenEntity (EntityDef : TEntityDef); VIRTUAL; - PROCEDURE WhenNotation (NotationDef : TNotationDef); VIRTUAL; - PROCEDURE WhenDtdError (ErrorPos : PChar); VIRTUAL; - - PUBLIC - CONSTRUCTOR Create (AOwner: TComponent); OVERRIDE; - DESTRUCTOR Destroy; OVERRIDE; - - PROCEDURE LoadFromFile (Filename : TFilename); // Load XML Document from file - PROCEDURE LoadFromBuffer (Buffer : PChar); // Load XML Document from buffer - PROCEDURE SetBuffer (Buffer : PChar); // Refer to Buffer - FUNCTION GetFilename : TFilename; - - PROCEDURE Execute; // Perform scanning - - PROTECTED - PROPERTY XmlParser : TXmlParser READ FXmlParser; - PROPERTY StopParser : BOOLEAN READ FStopParser WRITE FStopParser; - PROPERTY Filename : TFilename READ GetFilename WRITE LoadFromFile; - PROPERTY Normalize : BOOLEAN READ GetNormalize WRITE SetNormalize; - PROPERTY OnXmlProlog : TXmlPrologEvent READ FOnXmlProlog WRITE FOnXmlProlog; - PROPERTY OnComment : TCommentEvent READ FOnComment WRITE FOnComment; - PROPERTY OnPI : TPIEvent READ FOnPI WRITE FOnPI; - PROPERTY OnDtdRead : TDtdEvent READ FOnDtdRead WRITE FOnDtdRead; - PROPERTY OnStartTag : TStartTagEvent READ FOnStartTag WRITE FOnStartTag; - PROPERTY OnEmptyTag : TStartTagEvent READ FOnEmptyTag WRITE FOnEmptyTag; - PROPERTY OnEndTag : TEndTagEvent READ FOnEndTag WRITE FOnEndTag; - PROPERTY OnContent : TContentEvent READ FOnContent WRITE FOnContent; - PROPERTY OnCData : TContentEvent READ FOnCData WRITE FOnCData; - PROPERTY OnElement : TElementEvent READ FOnElement WRITE FOnElement; - PROPERTY OnAttList : TElementEvent READ FOnAttList WRITE FOnAttList; - PROPERTY OnEntity : TEntityEvent READ FOnEntity WRITE FOnEntity; - PROPERTY OnNotation : TNotationEvent READ FOnNotation WRITE FOnNotation; - PROPERTY OnDtdError : TErrorEvent READ FOnDtdError WRITE FOnDtdError; - PROPERTY OnLoadExternal : TExternalEvent READ FOnLoadExternal WRITE FOnLoadExternal; - PROPERTY OnTranslateEncoding : TEncodingEvent READ FOnTranslateEncoding WRITE FOnTranslateEncoding; - END; - -(* -=============================================================================================== -IMPLEMENTATION -=============================================================================================== -*) - -IMPLEMENTATION - - -(* -=============================================================================================== -Unicode and UTF-8 stuff -=============================================================================================== -*) - -CONST - // --- Character Translation Table for Unicode <-> Win-1252 - WIN1252_UNICODE : ARRAY [$00..$FF] OF WORD = ( - $0000, $0001, $0002, $0003, $0004, $0005, $0006, $0007, $0008, $0009, - $000A, $000B, $000C, $000D, $000E, $000F, $0010, $0011, $0012, $0013, - $0014, $0015, $0016, $0017, $0018, $0019, $001A, $001B, $001C, $001D, - $001E, $001F, $0020, $0021, $0022, $0023, $0024, $0025, $0026, $0027, - $0028, $0029, $002A, $002B, $002C, $002D, $002E, $002F, $0030, $0031, - $0032, $0033, $0034, $0035, $0036, $0037, $0038, $0039, $003A, $003B, - $003C, $003D, $003E, $003F, $0040, $0041, $0042, $0043, $0044, $0045, - $0046, $0047, $0048, $0049, $004A, $004B, $004C, $004D, $004E, $004F, - $0050, $0051, $0052, $0053, $0054, $0055, $0056, $0057, $0058, $0059, - $005A, $005B, $005C, $005D, $005E, $005F, $0060, $0061, $0062, $0063, - $0064, $0065, $0066, $0067, $0068, $0069, $006A, $006B, $006C, $006D, - $006E, $006F, $0070, $0071, $0072, $0073, $0074, $0075, $0076, $0077, - $0078, $0079, $007A, $007B, $007C, $007D, $007E, $007F, - - $20AC, $0081, $201A, $0192, $201E, $2026, $2020, $2021, $02C6, $2030, - $0160, $2039, $0152, $008D, $017D, $008F, $0090, $2018, $2019, $201C, - $201D, $2022, $2013, $2014, $02DC, $2122, $0161, $203A, $0153, $009D, - $017E, $0178, $00A0, $00A1, $00A2, $00A3, $00A4, $00A5, $00A6, $00A7, - $00A8, $00A9, $00AA, $00AB, $00AC, $00AD, $00AE, $00AF, $00B0, $00B1, - $00B2, $00B3, $00B4, $00B5, $00B6, $00B7, $00B8, $00B9, $00BA, $00BB, - $00BC, $00BD, $00BE, $00BF, $00C0, $00C1, $00C2, $00C3, $00C4, $00C5, - $00C6, $00C7, $00C8, $00C9, $00CA, $00CB, $00CC, $00CD, $00CE, $00CF, - $00D0, $00D1, $00D2, $00D3, $00D4, $00D5, $00D6, $00D7, $00D8, $00D9, - $00DA, $00DB, $00DC, $00DD, $00DE, $00DF, $00E0, $00E1, $00E2, $00E3, - $00E4, $00E5, $00E6, $00E7, $00E8, $00E9, $00EA, $00EB, $00EC, $00ED, - $00EE, $00EF, $00F0, $00F1, $00F2, $00F3, $00F4, $00F5, $00F6, $00F7, - $00F8, $00F9, $00FA, $00FB, $00FC, $00FD, $00FE, $00FF); - -(* UTF-8 (somewhat simplified) - ----- - Character Range Byte sequence - --------------- -------------------------- (x=Bits from original character) - $0000..$007F 0xxxxxxx - $0080..$07FF 110xxxxx 10xxxxxx - $8000..$FFFF 1110xxxx 10xxxxxx 10xxxxxx - - Example - -------- - Transforming the Unicode character U+00E4 LATIN SMALL LETTER A WITH DIAERESIS ("ä"): - - ISO-8859-1, Decimal 228 - Win1252, Hex $E4 - ANSI Bin 1110 0100 - abcd efgh - - UTF-8 Binary 1100xxab 10cdefgh - Binary 11000011 10100100 - Hex $C3 $A4 - Decimal 195 164 - ANSI Ã ¤ *) - - -FUNCTION AnsiToUtf8 (Source : ANSISTRING) : STRING; - (* Converts the given Windows ANSI (Win1252) String to UTF-8. *) -VAR - I : INTEGER; // Loop counter - U : WORD; // Current Unicode value - Len : INTEGER; // Current real length of "Result" string -BEGIN - SetLength (Result, Length (Source) * 3); // Worst case - Len := 0; - FOR I := 1 TO Length (Source) DO BEGIN - U := WIN1252_UNICODE [ORD (Source [I])]; - CASE U OF - $0000..$007F : BEGIN - INC (Len); - Result [Len] := CHR (U); - END; - $0080..$07FF : BEGIN - INC (Len); - Result [Len] := CHR ($C0 OR (U SHR 6)); - INC (Len); - Result [Len] := CHR ($80 OR (U AND $3F)); - END; - $0800..$FFFF : BEGIN - INC (Len); - Result [Len] := CHR ($E0 OR (U SHR 12)); - INC (Len); - Result [Len] := CHR ($80 OR ((U SHR 6) AND $3F)); - INC (Len); - Result [Len] := CHR ($80 OR (U AND $3F)); - END; - END; - END; - SetLength (Result, Len); -END; - - -FUNCTION Utf8ToAnsi (Source : STRING; UnknownChar : CHAR = '¿') : ANSISTRING; - (* Converts the given UTF-8 String to Windows ANSI (Win-1252). - If a character can not be converted, the "UnknownChar" is inserted. *) -VAR - SourceLen : INTEGER; // Length of Source string - I, K : INTEGER; - A : BYTE; // Current ANSI character value - U : WORD; - Ch : CHAR; // Dest char - Len : INTEGER; // Current real length of "Result" string -BEGIN - SourceLen := Length (Source); - SetLength (Result, SourceLen); // Enough room to live - Len := 0; - I := 1; - WHILE I <= SourceLen DO BEGIN - A := ORD (Source [I]); - IF A < $80 THEN BEGIN // Range $0000..$007F - INC (Len); - Result [Len] := Source [I]; - INC (I); - END - ELSE BEGIN // Determine U, Inc I - IF (A AND $E0 = $C0) AND (I < SourceLen) THEN BEGIN // Range $0080..$07FF - U := (WORD (A AND $1F) SHL 6) OR (ORD (Source [I+1]) AND $3F); - INC (I, 2); - END - ELSE IF (A AND $F0 = $E0) AND (I < SourceLen-1) THEN BEGIN // Range $0800..$FFFF - U := (WORD (A AND $0F) SHL 12) OR - (WORD (ORD (Source [I+1]) AND $3F) SHL 6) OR - ( ORD (Source [I+2]) AND $3F); - INC (I, 3); - END - ELSE BEGIN // Unknown/unsupported - INC (I); - FOR K := 7 DOWNTO 0 DO - IF A AND (1 SHL K) = 0 THEN BEGIN - INC (I, (A SHR (K+1))-1); - BREAK; - END; - U := WIN1252_UNICODE [ORD (UnknownChar)]; - END; - Ch := UnknownChar; // Retrieve ANSI char - FOR A := $00 TO $FF DO - IF WIN1252_UNICODE [A] = U THEN BEGIN - Ch := CHR (A); - BREAK; - END; - INC (Len); - Result [Len] := Ch; - END; - END; - SetLength (Result, Len); -END; - - -(* -=============================================================================================== -"Special" Helper Functions - -Don't ask me why. But including these functions makes the parser *DRAMATICALLY* faster -on my K6-233 machine. You can test it yourself just by commenting them out. -They do exactly the same as the Assembler routines defined in SysUtils. -(This is where you can see how great the Delphi compiler really is. The compiled code is -faster than hand-coded assembler!) -=============================================================================================== ---> Just move this line below the StrScan function --> *) - - -FUNCTION StrPos (CONST Str, SearchStr : PChar) : PChar; - // Same functionality as SysUtils.StrPos -VAR - First : CHAR; - Len : INTEGER; -BEGIN - First := SearchStr^; - Len := StrLen (SearchStr); - Result := Str; - REPEAT - IF Result^ = First THEN - IF StrLComp (Result, SearchStr, Len) = 0 THEN BREAK; - IF Result^ = #0 THEN BEGIN - Result := NIL; - BREAK; - END; - INC (Result); - UNTIL FALSE; -END; - - -FUNCTION StrScan (CONST Start : PChar; CONST Ch : CHAR) : PChar; - // Same functionality as SysUtils.StrScan -BEGIN - Result := Start; - WHILE Result^ <> Ch DO BEGIN - IF Result^ = #0 THEN BEGIN - Result := NIL; - EXIT; - END; - INC (Result); - END; -END; - - -(* -=============================================================================================== -Helper Functions -=============================================================================================== -*) - -FUNCTION DelChars (Source : STRING; CharsToDelete : TCharset) : STRING; - // Delete all "CharsToDelete" from the string -VAR - I : INTEGER; -BEGIN - Result := Source; - FOR I := Length (Result) DOWNTO 1 DO - IF Result [I] IN CharsToDelete THEN - Delete (Result, I, 1); -END; - - -FUNCTION TrimWs (Source : STRING) : STRING; - // Trimms off Whitespace characters from both ends of the string -VAR - I : INTEGER; -BEGIN - // --- Trim Left - I := 1; - WHILE (I <= Length (Source)) AND (Source [I] IN CWhitespace) DO - INC (I); - Result := Copy (Source, I, MaxInt); - - // --- Trim Right - I := Length (Result); - WHILE (I > 1) AND (Result [I] IN CWhitespace) DO - DEC (I); - Delete (Result, I+1, Length (Result)-I); -END; - - -FUNCTION ConvertWs (Source: STRING; PackWs: BOOLEAN) : STRING; - // Converts all Whitespace characters to the Space #x20 character - // If "PackWs" is true, contiguous Whitespace characters are packed to one -VAR - I : INTEGER; -BEGIN - Result := Source; - FOR I := Length (Result) DOWNTO 1 DO - IF (Result [I] IN CWhitespace) THEN - IF PackWs AND (I > 1) AND (Result [I-1] IN CWhitespace) - THEN Delete (Result, I, 1) - ELSE Result [I] := #32; -END; - - -PROCEDURE SetStringSF (VAR S : STRING; BufferStart, BufferFinal : PChar); -BEGIN - SetString (S, BufferStart, BufferFinal-BufferStart+1); -END; - - -FUNCTION StrLPas (Start : PChar; Len : INTEGER) : STRING; -BEGIN - SetString (Result, Start, Len); -END; - - -FUNCTION StrSFPas (Start, Finish : PChar) : STRING; -BEGIN - SetString (Result, Start, Finish-Start+1); -END; - - -FUNCTION StrScanE (CONST Source : PChar; CONST CharToScanFor : CHAR) : PChar; - // If "CharToScanFor" is not found, StrScanE returns the last char of the - // buffer instead of NIL -BEGIN - Result := StrScan (Source, CharToScanFor); - IF Result = NIL THEN - Result := StrEnd (Source)-1; -END; - - -PROCEDURE ExtractName (Start : PChar; Terminators : TCharset; VAR Final : PChar); - (* Extracts the complete Name beginning at "Start". - It is assumed that the name is contained in Markup, so the '>' character is - always a Termination. - Start: IN Pointer to first char of name. Is always considered to be valid - Terminators: IN Characters which terminate the name - Final: OUT Pointer to last char of name *) -BEGIN - Final := Start+1; - Include (Terminators, #0); - Include (Terminators, '>'); - WHILE NOT (Final^ IN Terminators) DO - INC (Final); - DEC (Final); -END; - - -PROCEDURE ExtractQuote (Start : PChar; VAR Content : STRING; VAR Final : PChar); - (* Extract a string which is contained in single or double Quotes. - Start: IN Pointer to opening quote - Content: OUT The quoted string - Final: OUT Pointer to closing quote *) -BEGIN - Final := StrScan (Start+1, Start^); - IF Final = NIL THEN BEGIN - Final := StrEnd (Start+1)-1; - SetString (Content, Start+1, Final-Start); - END - ELSE - SetString (Content, Start+1, Final-1-Start); -END; - - -(* -=============================================================================================== -TEntityStackNode -This Node is pushed to the "Entity Stack" whenever the parser parses entity replacement text. -The "Instance" field holds the Instance pointer of an External Entity buffer. When it is -popped, the Instance is freed. -The "Encoding" field holds the name of the Encoding. External Parsed Entities may have -another encoding as the document entity (XmlSpec 4.3.3). So when there is an " 0 THEN BEGIN - ESN := TEntityStackNode (Items [Count-1]); - Result := ESN.LastPos; - IF ESN.Instance <> NIL THEN - ESN.Instance.Free; - IF ESN.Encoding <> '' THEN - Owner.FCurEncoding := ESN.Encoding; // Restore current Encoding - Delete (Count-1); - END - ELSE - Result := NIL; -END; - - -(* -=============================================================================================== -TExternalID ------------ -XmlSpec 4.2.2: ExternalID ::= 'SYSTEM' S SystemLiteral | - 'PUBLIC' S PubidLiteral S SystemLiteral -XmlSpec 4.7: PublicID ::= 'PUBLIC' S PubidLiteral -SystemLiteral and PubidLiteral are quoted -=============================================================================================== -*) - -TYPE - TExternalID = CLASS - PublicId : STRING; - SystemId : STRING; - Final : PChar; - CONSTRUCTOR Create (Start : PChar); - END; - -CONSTRUCTOR TExternalID.Create (Start : PChar); -BEGIN - INHERITED Create; - Final := Start; - IF StrLComp (Start, 'SYSTEM', 6) = 0 THEN BEGIN - WHILE NOT (Final^ IN (CQuoteChar + [#0, '>', '['])) DO INC (Final); - IF NOT (Final^ IN CQuoteChar) THEN EXIT; - ExtractQuote (Final, SystemID, Final); - END - ELSE IF StrLComp (Start, 'PUBLIC', 6) = 0 THEN BEGIN - WHILE NOT (Final^ IN (CQuoteChar + [#0, '>', '['])) DO INC (Final); - IF NOT (Final^ IN CQuoteChar) THEN EXIT; - ExtractQuote (Final, PublicID, Final); - INC (Final); - WHILE NOT (Final^ IN (CQuoteChar + [#0, '>', '['])) DO INC (Final); - IF NOT (Final^ IN CQuoteChar) THEN EXIT; - ExtractQuote (Final, SystemID, Final); - END; -END; - - -(* -=============================================================================================== -TXmlParser -=============================================================================================== -*) - -CONSTRUCTOR TXmlParser.Create; -BEGIN - INHERITED Create; - FBuffer := NIL; - FBufferSize := 0; - Elements := TElemList.Create; - Entities := TNvpList.Create; - ParEntities := TNvpList.Create; - Notations := TNvpList.Create; - CurAttr := TAttrList.Create; - EntityStack := TEntityStack.Create (Self); - Clear; -END; - - -DESTRUCTOR TXmlParser.Destroy; -BEGIN - Clear; - Elements.Free; - Entities.Free; - ParEntities.Free; - Notations.Free; - CurAttr.Free; - EntityStack.Free; - INHERITED Destroy; -END; - - -PROCEDURE TXmlParser.Clear; - // Free Buffer and clear all object attributes -BEGIN - IF (FBufferSize > 0) AND (FBuffer <> NIL) THEN - FreeMem (FBuffer); - FBuffer := NIL; - FBufferSize := 0; - FSource := ''; - FXmlVersion := ''; - FEncoding := ''; - FStandalone := FALSE; - FRootName := ''; - FDtdcFinal := NIL; - FNormalize := TRUE; - Elements.Clear; - Entities.Clear; - ParEntities.Clear; - Notations.Clear; - CurAttr.Clear; - EntityStack.Clear; -END; - - -FUNCTION TXmlParser.LoadFromFile (Filename : STRING; FileMode : INTEGER = fmOpenRead OR fmShareDenyNone) : BOOLEAN; - // Loads Document from given file - // Returns TRUE if successful -VAR - f : FILE; - ReadIn : INTEGER; - OldFileMode : INTEGER; -BEGIN - Result := FALSE; - Clear; - - // --- Open File - OldFileMode := SYSTEM.FileMode; - TRY - SYSTEM.FileMode := FileMode; - TRY - AssignFile (f, Filename); - Reset (f, 1); - EXCEPT - EXIT; - END; - - TRY - // --- Allocate Memory - TRY - FBufferSize := Filesize (f) + 1; - GetMem (FBuffer, FBufferSize); - EXCEPT - Clear; - EXIT; - END; - - // --- Read File - TRY - BlockRead (f, FBuffer^, FBufferSize, ReadIn); - (FBuffer+ReadIn)^ := #0; // NULL termination - EXCEPT - Clear; - EXIT; - END; - FINALLY - CloseFile (f); - END; - - FSource := Filename; - Result := TRUE; - - FINALLY - SYSTEM.FileMode := OldFileMode; - END; -END; - - -FUNCTION TXmlParser.LoadFromBuffer (Buffer : PChar) : BOOLEAN; - // Loads Document from another buffer - // Returns TRUE if successful - // The "Source" property becomes '' if successful -BEGIN - Result := FALSE; - Clear; - FBufferSize := StrLen (Buffer) + 1; - TRY - GetMem (FBuffer, FBufferSize); - EXCEPT - Clear; - EXIT; - END; - StrCopy (FBuffer, Buffer); - FSource := ''; - Result := TRUE; -END; - - -PROCEDURE TXmlParser.SetBuffer (Buffer : PChar); // References another buffer -BEGIN - Clear; - FBuffer := Buffer; - FBufferSize := 0; - FSource := ''; -END; - - -//----------------------------------------------------------------------------------------------- -// Scanning through the document -//----------------------------------------------------------------------------------------------- - -PROCEDURE TXmlParser.StartScan; -BEGIN - CurPartType := ptNone; - CurName := ''; - CurContent := ''; - CurStart := NIL; - CurFinal := NIL; - CurAttr.Clear; - EntityStack.Clear; -END; - - -FUNCTION TXmlParser.Scan : BOOLEAN; - // Scans the next Part - // Returns TRUE if a part could be found, FALSE if there is no part any more - // - // "IsDone" can be set to FALSE by AnalyzeText in order to go to the next part - // if there is no Content due to normalization -VAR - IsDone : BOOLEAN; -BEGIN - REPEAT - IsDone := TRUE; - - // --- Start of next Part - IF CurStart = NIL - THEN CurStart := DocBuffer - ELSE CurStart := CurFinal+1; - CurFinal := CurStart; - - // --- End of Document of Pop off a new part from the Entity stack? - IF CurStart^ = #0 THEN - CurStart := EntityStack.Pop; - - // --- No Document or End Of Document: Terminate Scan - IF (CurStart = NIL) OR (CurStart^ = #0) THEN BEGIN - CurStart := StrEnd (DocBuffer); - CurFinal := CurStart-1; - EntityStack.Clear; - Result := FALSE; - EXIT; - END; - - IF (StrLComp (CurStart, ''); - IF CurFinal <> NIL - THEN INC (CurFinal) - ELSE CurFinal := StrEnd (CurStart)-1; - FCurEncoding := AnsiUpperCase (CurAttr.Value ('encoding')); - IF FCurEncoding = '' THEN - FCurEncoding := 'UTF-8'; // Default XML Encoding is UTF-8 - CurPartType := ptXmlProlog; - CurName := ''; - CurContent := ''; -END; - - -PROCEDURE TXmlParser.AnalyzeComment (Start : PChar; VAR Final : PChar); - // Analyze Comments -BEGIN - Final := StrPos (Start+4, '-->'); - IF Final = NIL - THEN Final := StrEnd (Start)-1 - ELSE INC (Final, 2); - CurPartType := ptComment; -END; - - -PROCEDURE TXmlParser.AnalyzePI (Start : PChar; VAR Final : PChar); - // Analyze Processing Instructions (PI) - // This is also called for Character -VAR - F : PChar; -BEGIN - CurPartType := ptPI; - Final := StrPos (Start+2, '?>'); - IF Final = NIL - THEN Final := StrEnd (Start)-1 - ELSE INC (Final); - ExtractName (Start+2, CWhitespace + ['?', '>'], F); - SetStringSF (CurName, Start+2, F); - SetStringSF (CurContent, F+1, Final-2); - CurAttr.Analyze (F+1, F); -END; - - -PROCEDURE TXmlParser.AnalyzeDtdc; - (* Analyze Document Type Declaration - doctypedecl ::= '' - markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI | Comment - PEReference ::= '%' Name ';' - - elementdecl ::= '' - AttlistDecl ::= '' - EntityDecl ::= '' | - '' - NotationDecl ::= '' - PI ::= '' Char* )))? '?>' - Comment ::= '' *) -TYPE - TPhase = (phName, phDtd, phInternal, phFinishing); -VAR - Phase : TPhase; - F : PChar; - ExternalID : TExternalID; - ExternalDTD : TXmlParser; - DER : TDtdElementRec; -BEGIN - DER.Start := CurStart; - EntityStack.Clear; // Clear stack for Parameter Entities - CurPartType := ptDtdc; - - // --- Don't read DTDc twice - IF FDtdcFinal <> NIL THEN BEGIN - CurFinal := FDtdcFinal; - EXIT; - END; - - // --- Scan DTDc - CurFinal := CurStart + 9; // First char after '' : BREAK; - ELSE IF NOT (CurFinal^ IN CWhitespace) THEN BEGIN - CASE Phase OF - phName : IF (CurFinal^ IN CNameStart) THEN BEGIN - ExtractName (CurFinal, CWhitespace + ['[', '>'], F); - SetStringSF (FRootName, CurFinal, F); - CurFinal := F; - Phase := phDtd; - END; - phDtd : IF (StrLComp (CurFinal, 'SYSTEM', 6) = 0) OR - (StrLComp (CurFinal, 'PUBLIC', 6) = 0) THEN BEGIN - ExternalID := TExternalID.Create (CurFinal); - ExternalDTD := LoadExternalEntity (ExternalId.SystemId, ExternalID.PublicId, ''); - F := StrPos (ExternalDtd.DocBuffer, ' NIL THEN - AnalyzeDtdElements (F, F); - ExternalDTD.Free; - CurFinal := ExternalID.Final; - ExternalID.Free; - END; - ELSE BEGIN - DER.ElementType := deError; - DER.Pos := CurFinal; - DER.Final := CurFinal; - DtdElementFound (DER); - END; - END; - - END; - END; - INC (CurFinal); - UNTIL FALSE; - - CurPartType := ptDtdc; - CurName := ''; - CurContent := ''; - - // It is an error in the document if "EntityStack" is not empty now - IF EntityStack.Count > 0 THEN BEGIN - DER.ElementType := deError; - DER.Final := CurFinal; - DER.Pos := CurFinal; - DtdElementFound (DER); - END; - - EntityStack.Clear; // Clear stack for General Entities - FDtdcFinal := CurFinal; -END; - - -PROCEDURE TXmlParser.AnalyzeDtdElements (Start : PChar; VAR Final : PChar); - // Analyze the "Elements" of a DTD contained in the external or - // internal DTD subset. -VAR - DER : TDtdElementRec; -BEGIN - Final := Start; - REPEAT - CASE Final^ OF - '%' : BEGIN - PushPE (Final); - CONTINUE; - END; - #0 : IF EntityStack.Count = 0 THEN - BREAK - ELSE BEGIN - CurFinal := EntityStack.Pop; - CONTINUE; - END; - ']', - '>' : BREAK; - '<' : IF StrLComp (Final, ''); - - // --- Set Default Attribute values for nonexistent attributes - IF (CurPartType = ptStartTag) OR (CurPartType = ptEmptyTag) THEN BEGIN - ElemDef := Elements.Node (CurName); - IF ElemDef <> NIL THEN BEGIN - FOR I := 0 TO ElemDef.Count-1 DO BEGIN - AttrDef := TAttrDef (ElemDef [I]); - Attr := TAttr (CurAttr.Node (AttrDef.Name)); - IF (Attr = NIL) AND (AttrDef.Value <> '') THEN BEGIN - Attr := TAttr.Create (AttrDef.Name, AttrDef.Value); - Attr.ValueType := vtDefault; - CurAttr.Add (Attr); - END; - IF Attr <> NIL THEN BEGIN - CASE AttrDef.DefaultType OF - adDefault : ; - adRequired : ; // -!- It is an error in the document if "Attr.Value" is an empty string - adImplied : Attr.ValueType := vtImplied; - adFixed : BEGIN - Attr.ValueType := vtFixed; - Attr.Value := AttrDef.Value; - END; - END; - Attr.AttrType := AttrDef.AttrType; - END; - END; - END; - - // --- Normalize Attribute Values. XmlSpec: - // - a character reference is processed by appending the referenced character to the attribute value - // - an entity reference is processed by recursively processing the replacement text of the entity - // - a whitespace character (#x20, #xD, #xA, #x9) is processed by appending #x20 to the normalized value, - // except that only a single #x20 is appended for a "#xD#xA" sequence that is part of an external - // parsed entity or the literal entity value of an internal parsed entity - // - other characters are processed by appending them to the normalized value - // If the declared value is not CDATA, then the XML processor must further process the - // normalized attribute value by discarding any leading and trailing space (#x20) characters, - // and by replacing sequences of space (#x20) characters by a single space (#x20) character. - // All attributes for which no declaration has been read should be treated by a - // non-validating parser as if declared CDATA. - // !!! The XML 1.0 SE specification is somewhat different here - // This code does not conform exactly to this specification - FOR I := 0 TO CurAttr.Count-1 DO - WITH TAttr (CurAttr [I]) DO BEGIN - ReplaceGeneralEntities (Value); - ReplaceCharacterEntities (Value); - IF (AttrType <> atCData) AND (AttrType <> atUnknown) - THEN Value := TranslateEncoding (TrimWs (ConvertWs (Value, TRUE))) - ELSE Value := TranslateEncoding (ConvertWs (Value, FALSE)); - END; - END; -END; - - -PROCEDURE TXmlParser.AnalyzeCData; - // Analyze CDATA Sections -BEGIN - CurPartType := ptCData; - CurFinal := StrPos (CurStart, CDEnd); - IF CurFinal = NIL THEN BEGIN - CurFinal := StrEnd (CurStart)-1; - CurContent := TranslateEncoding (StrPas (CurStart+Length (CDStart))); - END - ELSE BEGIN - SetStringSF (CurContent, CurStart+Length (CDStart), CurFinal-1); - INC (CurFinal, Length (CDEnd)-1); - CurContent := TranslateEncoding (CurContent); - END; -END; - - -PROCEDURE TXmlParser.AnalyzeText (VAR IsDone : BOOLEAN); - (* Analyzes Text Content between Tags. CurFinal will point to the last content character. - Content ends at a '<' character or at the end of the document. - Entity References and Character Entity references are resolved. - If PackSpaces is TRUE, contiguous Whitespace Characters will be compressed to - one Space #x20 character, Whitespace at the beginning and end of content will - be trimmed off and content which is or becomes empty is not returned to - the application (in this case, "IsDone" is set to FALSE which causes the - Scan method to proceed directly to the next part. *) - - PROCEDURE ProcessEntity; - (* Is called if there is an ampsersand '&' character found in the document. - IN "CurFinal" points to the ampersand - OUT "CurFinal" points to the first character after the semi-colon ';' *) - VAR - P : PChar; - Name : STRING; - EntityDef : TEntityDef; - ExternalEntity : TXmlParser; - BEGIN - P := StrScan (CurFinal , ';'); - IF P <> NIL THEN BEGIN - SetStringSF (Name, CurFinal+1, P-1); - - // Is it a Character Entity? - IF (CurFinal+1)^ = '#' THEN BEGIN - IF UpCase ((CurFinal+2)^) = 'X' // !!! Can't use "CHR" for Unicode characters > 255: - THEN CurContent := CurContent + CHR (StrToIntDef ('$'+Copy (Name, 3, MaxInt), 32)) - ELSE CurContent := CurContent + CHR (StrToIntDef (Copy (Name, 2, MaxInt), 32)); - CurFinal := P+1; - EXIT; - END - - // Is it a Predefined Entity? - ELSE IF Name = 'lt' THEN BEGIN CurContent := CurContent + '<'; CurFinal := P+1; EXIT; END - ELSE IF Name = 'gt' THEN BEGIN CurContent := CurContent + '>'; CurFinal := P+1; EXIT; END - ELSE IF Name = 'amp' THEN BEGIN CurContent := CurContent + '&'; CurFinal := P+1; EXIT; END - ELSE IF Name = 'apos' THEN BEGIN CurContent := CurContent + ''''; CurFinal := P+1; EXIT; END - ELSE IF Name = 'quot' THEN BEGIN CurContent := CurContent + '"'; CurFinal := P+1; EXIT; END; - - // Replace with Entity from DTD - EntityDef := TEntityDef (Entities.Node (Name)); - IF EntityDef <> NIL THEN BEGIN - IF EntityDef.Value <> '' THEN BEGIN - EntityStack.Push (P+1); - CurFinal := PChar (EntityDef.Value); - END - ELSE BEGIN - ExternalEntity := LoadExternalEntity (EntityDef.SystemId, EntityDef.PublicId, EntityDef.NotationName); - EntityStack.Push (ExternalEntity, P+1); - CurFinal := ExternalEntity.DocBuffer; - END; - END - ELSE BEGIN - CurContent := CurContent + Name; - CurFinal := P+1; - END; - END - ELSE BEGIN - INC (CurFinal); - END; - END; - -VAR - C : INTEGER; -BEGIN - CurFinal := CurStart; - CurPartType := ptContent; - CurContent := ''; - C := 0; - REPEAT - CASE CurFinal^ OF - '&' : BEGIN - CurContent := CurContent + TranslateEncoding (StrLPas (CurFinal-C, C)); - C := 0; - ProcessEntity; - CONTINUE; - END; - #0 : BEGIN - IF EntityStack.Count = 0 THEN - BREAK - ELSE BEGIN - CurContent := CurContent + TranslateEncoding (StrLPas (CurFinal-C, C)); - C := 0; - CurFinal := EntityStack.Pop; - CONTINUE; - END; - END; - '<' : BREAK; - ELSE INC (C); - END; - INC (CurFinal); - UNTIL FALSE; - CurContent := CurContent + TranslateEncoding (StrLPas (CurFinal-C, C)); - DEC (CurFinal); - - IF FNormalize THEN BEGIN - CurContent := ConvertWs (TrimWs (CurContent), TRUE); - IsDone := CurContent <> ''; // IsDone will only get FALSE if PackSpaces is TRUE - END; -END; - - -PROCEDURE TXmlParser.AnalyzeElementDecl (Start : PChar; VAR Final : PChar); - (* Parse ' character - XmlSpec 3.2: - elementdecl ::= '' - contentspec ::= 'EMPTY' | 'ANY' | Mixed | children - Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*' | - '(' S? '#PCDATA' S? ')' - children ::= (choice | seq) ('?' | '*' | '+')? - choice ::= '(' S? cp ( S? '|' S? cp )* S? ')' - cp ::= (Name | choice | seq) ('?' | '*' | '+')? - seq ::= '(' S? cp ( S? ',' S? cp )* S? ')' - - More simply: - contentspec ::= EMPTY - ANY - '(#PCDATA)' - '(#PCDATA | A | B)*' - '(A, B, C)' - '(A | B | C)' - '(A?, B*, C+), - '(A, (B | C | D)* )' *) -VAR - Element : TElemDef; - Elem2 : TElemDef; - F : PChar; - DER : TDtdElementRec; -BEGIN - Element := TElemDef.Create; - Final := Start + 9; - DER.Start := Start; - REPEAT - IF Final^ = '>' THEN BREAK; - IF (Final^ IN CNameStart) AND (Element.Name = '') THEN BEGIN - ExtractName (Final, CWhitespace, F); - SetStringSF (Element.Name, Final, F); - Final := F; - F := StrScan (Final+1, '>'); - IF F = NIL THEN BEGIN - Element.Definition := STRING (Final); - Final := StrEnd (Final); - BREAK; - END - ELSE BEGIN - SetStringSF (Element.Definition, Final+1, F-1); - Final := F; - BREAK; - END; - END; - INC (Final); - UNTIL FALSE; - Element.Definition := DelChars (Element.Definition, CWhitespace); - ReplaceParameterEntities (Element.Definition); - IF Element.Definition = 'EMPTY' THEN Element.ElemType := etEmpty - ELSE IF Element.Definition = 'ANY' THEN Element.ElemType := etAny - ELSE IF Copy (Element.Definition, 1, 8) = '(#PCDATA' THEN Element.ElemType := etMixed - ELSE IF Copy (Element.Definition, 1, 1) = '(' THEN Element.ElemType := etChildren - ELSE Element.ElemType := etAny; - - Elem2 := Elements.Node (Element.Name); - IF Elem2 <> NIL THEN - Elements.Delete (Elements.IndexOf (Elem2)); - Elements.Add (Element); - Final := StrScanE (Final, '>'); - DER.ElementType := deElement; - DER.ElemDef := Element; - DER.Final := Final; - DtdElementFound (DER); -END; - - -PROCEDURE TXmlParser.AnalyzeAttListDecl (Start : PChar; VAR Final : PChar); - (* Parse ' character - XmlSpec 3.3: - AttlistDecl ::= '' - AttDef ::= S Name S AttType S DefaultDecl - AttType ::= StringType | TokenizedType | EnumeratedType - StringType ::= 'CDATA' - TokenizedType ::= 'ID' | 'IDREF' | 'IDREFS' | 'ENTITY' | 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS' - EnumeratedType ::= NotationType | Enumeration - NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')' - Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')' - DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue) - AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'" - Examples: - *) -TYPE - TPhase = (phElementName, phName, phType, phNotationContent, phDefault); -VAR - Phase : TPhase; - F : PChar; - ElementName : STRING; - ElemDef : TElemDef; - AttrDef : TAttrDef; - AttrDef2 : TAttrDef; - Strg : STRING; - DER : TDtdElementRec; -BEGIN - Final := Start + 9; // The character after ' : BREAK; - ELSE CASE Phase OF - phElementName : BEGIN - ExtractName (Final, CWhitespace + CQuoteChar + ['#'], F); - SetStringSF (ElementName, Final, F); - Final := F; - ElemDef := Elements.Node (ElementName); - IF ElemDef = NIL THEN BEGIN - ElemDef := TElemDef.Create; - ElemDef.Name := ElementName; - ElemDef.Definition := 'ANY'; - ElemDef.ElemType := etAny; - Elements.Add (ElemDef); - END; - Phase := phName; - END; - phName : BEGIN - AttrDef := TAttrDef.Create; - ExtractName (Final, CWhitespace + CQuoteChar + ['#'], F); - SetStringSF (AttrDef.Name, Final, F); - Final := F; - AttrDef2 := TAttrDef (ElemDef.Node (AttrDef.Name)); - IF AttrDef2 <> NIL THEN - ElemDef.Delete (ElemDef.IndexOf (AttrDef2)); - ElemDef.Add (AttrDef); - Phase := phType; - END; - phType : BEGIN - IF Final^ = '(' THEN BEGIN - F := StrScan (Final+1, ')'); - IF F <> NIL - THEN SetStringSF (AttrDef.TypeDef, Final+1, F-1) - ELSE AttrDef.TypeDef := STRING (Final+1); - AttrDef.TypeDef := DelChars (AttrDef.TypeDef, CWhitespace); - AttrDef.AttrType := atEnumeration; - ReplaceParameterEntities (AttrDef.TypeDef); - ReplaceCharacterEntities (AttrDef.TypeDef); - Phase := phDefault; - END - ELSE IF StrLComp (Final, 'NOTATION', 8) = 0 THEN BEGIN - INC (Final, 8); - AttrDef.AttrType := atNotation; - Phase := phNotationContent; - END - ELSE BEGIN - ExtractName (Final, CWhitespace+CQuoteChar+['#'], F); - SetStringSF (AttrDef.TypeDef, Final, F); - IF AttrDef.TypeDef = 'CDATA' THEN AttrDef.AttrType := atCData - ELSE IF AttrDef.TypeDef = 'ID' THEN AttrDef.AttrType := atId - ELSE IF AttrDef.TypeDef = 'IDREF' THEN AttrDef.AttrType := atIdRef - ELSE IF AttrDef.TypeDef = 'IDREFS' THEN AttrDef.AttrType := atIdRefs - ELSE IF AttrDef.TypeDef = 'ENTITY' THEN AttrDef.AttrType := atEntity - ELSE IF AttrDef.TypeDef = 'ENTITIES' THEN AttrDef.AttrType := atEntities - ELSE IF AttrDef.TypeDef = 'NMTOKEN' THEN AttrDef.AttrType := atNmToken - ELSE IF AttrDef.TypeDef = 'NMTOKENS' THEN AttrDef.AttrType := atNmTokens; - Phase := phDefault; - END - END; - phNotationContent : BEGIN - F := StrScan (Final, ')'); - IF F <> NIL THEN - SetStringSF (AttrDef.Notations, Final+1, F-1) - ELSE BEGIN - AttrDef.Notations := STRING (Final+1); - Final := StrEnd (Final); - END; - ReplaceParameterEntities (AttrDef.Notations); - AttrDef.Notations := DelChars (AttrDef.Notations, CWhitespace); - Phase := phDefault; - END; - phDefault : BEGIN - IF Final^ = '#' THEN BEGIN - ExtractName (Final, CWhiteSpace + CQuoteChar, F); - SetStringSF (Strg, Final, F); - Final := F; - ReplaceParameterEntities (Strg); - IF Strg = '#REQUIRED' THEN BEGIN AttrDef.DefaultType := adRequired; Phase := phName; END - ELSE IF Strg = '#IMPLIED' THEN BEGIN AttrDef.DefaultType := adImplied; Phase := phName; END - ELSE IF Strg = '#FIXED' THEN AttrDef.DefaultType := adFixed; - END - ELSE IF (Final^ IN CQuoteChar) THEN BEGIN - ExtractQuote (Final, AttrDef.Value, Final); - ReplaceParameterEntities (AttrDef.Value); - ReplaceCharacterEntities (AttrDef.Value); - Phase := phName; - END; - IF Phase = phName THEN BEGIN - AttrDef := NIL; - END; - END; - - END; - END; - INC (Final); - UNTIL FALSE; - - Final := StrScan (Final, '>'); - - DER.ElementType := deAttList; - DER.ElemDef := ElemDef; - DER.Final := Final; - DtdElementFound (DER); -END; - - -PROCEDURE TXmlParser.AnalyzeEntityDecl (Start : PChar; VAR Final : PChar); - (* Parse ' character - XmlSpec 4.2: - EntityDecl ::= '' | - '' - EntityDef ::= EntityValue | (ExternalID NDataDecl?) - PEDef ::= EntityValue | ExternalID - NDataDecl ::= S 'NDATA' S Name - EntityValue ::= '"' ([^%&"] | PEReference | EntityRef | CharRef)* '"' | - "'" ([^%&'] | PEReference | EntityRef | CharRef)* "'" - PEReference ::= '%' Name ';' - - Examples - - - - "> - - - Dies ist ein Test-Absatz

"> - *) -TYPE - TPhase = (phName, phContent, phNData, phNotationName, phFinalGT); -VAR - Phase : TPhase; - IsParamEntity : BOOLEAN; - F : PChar; - ExternalID : TExternalID; - EntityDef : TEntityDef; - EntityDef2 : TEntityDef; - DER : TDtdElementRec; -BEGIN - Final := Start + 8; // First char after ' : BREAK; - ELSE CASE Phase OF - phName : IF Final^ IN CNameStart THEN BEGIN - ExtractName (Final, CWhitespace + CQuoteChar, F); - SetStringSF (EntityDef.Name, Final, F); - Final := F; - Phase := phContent; - END; - phContent : IF Final^ IN CQuoteChar THEN BEGIN - ExtractQuote (Final, EntityDef.Value, Final); - Phase := phFinalGT; - END - ELSE IF (StrLComp (Final, 'SYSTEM', 6) = 0) OR - (StrLComp (Final, 'PUBLIC', 6) = 0) THEN BEGIN - ExternalID := TExternalID.Create (Final); - EntityDef.SystemId := ExternalID.SystemId; - EntityDef.PublicId := ExternalID.PublicId; - Final := ExternalID.Final; - Phase := phNData; - ExternalID.Free; - END; - phNData : IF StrLComp (Final, 'NDATA', 5) = 0 THEN BEGIN - INC (Final, 4); - Phase := phNotationName; - END; - phNotationName : IF Final^ IN CNameStart THEN BEGIN - ExtractName (Final, CWhitespace + ['>'], F); - SetStringSF (EntityDef.NotationName, Final, F); - Final := F; - Phase := phFinalGT; - END; - phFinalGT : ; // -!- There is an error in the document if this branch is called - END; - END; - INC (Final); - UNTIL FALSE; - IF IsParamEntity THEN BEGIN - EntityDef2 := TEntityDef (ParEntities.Node (EntityDef.Name)); - IF EntityDef2 <> NIL THEN - ParEntities.Delete (ParEntities.IndexOf (EntityDef2)); - ParEntities.Add (EntityDef); - ReplaceCharacterEntities (EntityDef.Value); - END - ELSE BEGIN - EntityDef2 := TEntityDef (Entities.Node (EntityDef.Name)); - IF EntityDef2 <> NIL THEN - Entities.Delete (Entities.IndexOf (EntityDef2)); - Entities.Add (EntityDef); - ReplaceParameterEntities (EntityDef.Value); // Create replacement texts (see XmlSpec 4.5) - ReplaceCharacterEntities (EntityDef.Value); - END; - Final := StrScanE (Final, '>'); - - DER.ElementType := deEntity; - DER.EntityDef := EntityDef; - DER.Final := Final; - DtdElementFound (DER); -END; - - -PROCEDURE TXmlParser.AnalyzeNotationDecl (Start : PChar; VAR Final : PChar); - // Parse ' character - // XmlSpec 4.7: NotationDecl ::= '' -TYPE - TPhase = (phName, phExtId, phEnd); -VAR - ExternalID : TExternalID; - Phase : TPhase; - F : PChar; - NotationDef : TNotationDef; - DER : TDtdElementRec; -BEGIN - Final := Start + 10; // Character after ', - #0 : BREAK; - ELSE CASE Phase OF - phName : BEGIN - ExtractName (Final, CWhitespace + ['>'], F); - SetStringSF (NotationDef.Name, Final, F); - Final := F; - Phase := phExtId; - END; - phExtId : BEGIN - ExternalID := TExternalID.Create (Final); - NotationDef.Value := ExternalID.SystemId; - NotationDef.PublicId := ExternalID.PublicId; - Final := ExternalId.Final; - ExternalId.Free; - Phase := phEnd; - END; - phEnd : ; // -!- There is an error in the document if this branch is called - END; - END; - INC (Final); - UNTIL FALSE; - Notations.Add (NotationDef); - Final := StrScanE (Final, '>'); - - DER.ElementType := deNotation; - DER.NotationDef := NotationDef; - DER.Final := Final; - DtdElementFound (DER); -END; - - -PROCEDURE TXmlParser.PushPE (VAR Start : PChar); - (* If there is a parameter entity reference found in the data stream, - the current position will be pushed to the entity stack. - Start: IN Pointer to the '%' character starting the PE reference - OUT Pointer to first character of PE replacement text *) -VAR - P : PChar; - EntityDef : TEntityDef; -BEGIN - P := StrScan (Start, ';'); - IF P <> NIL THEN BEGIN - EntityDef := TEntityDef (ParEntities.Node (StrSFPas (Start+1, P-1))); - IF EntityDef <> NIL THEN BEGIN - EntityStack.Push (P+1); - Start := PChar (EntityDef.Value); - END - ELSE - Start := P+1; - END; -END; - - -PROCEDURE TXmlParser.ReplaceCharacterEntities (VAR Str : STRING); - // Replaces all Character Entity References in the String -VAR - Start : INTEGER; - PAmp : PChar; - PSemi : PChar; - PosAmp : INTEGER; - Len : INTEGER; // Length of Entity Reference -BEGIN - IF Str = '' THEN EXIT; - Start := 1; - REPEAT - PAmp := StrPos (PChar (Str) + Start-1, '&#'); - IF PAmp = NIL THEN BREAK; - PSemi := StrScan (PAmp+2, ';'); - IF PSemi = NIL THEN BREAK; - PosAmp := PAmp - PChar (Str) + 1; - Len := PSemi-PAmp+1; - IF CompareText (Str [PosAmp+2], 'x') = 0 // !!! Can't use "CHR" for Unicode characters > 255 - THEN Str [PosAmp] := CHR (StrToIntDef ('$'+Copy (Str, PosAmp+3, Len-4), 0)) - ELSE Str [PosAmp] := CHR (StrToIntDef (Copy (Str, PosAmp+2, Len-3), 32)); - Delete (Str, PosAmp+1, Len-1); - Start := PosAmp + 1; - UNTIL FALSE; -END; - - -PROCEDURE TXmlParser.ReplaceParameterEntities (VAR Str : STRING); - // Recursively replaces all Parameter Entity References in the String - PROCEDURE ReplaceEntities (VAR Str : STRING); - VAR - Start : INTEGER; - PAmp : PChar; - PSemi : PChar; - PosAmp : INTEGER; - Len : INTEGER; - Entity : TEntityDef; - Repl : STRING; // Replacement - BEGIN - IF Str = '' THEN EXIT; - Start := 1; - REPEAT - PAmp := StrPos (PChar (Str)+Start-1, '%'); - IF PAmp = NIL THEN BREAK; - PSemi := StrScan (PAmp+2, ';'); - IF PSemi = NIL THEN BREAK; - PosAmp := PAmp - PChar (Str) + 1; - Len := PSemi-PAmp+1; - Entity := TEntityDef (ParEntities.Node (Copy (Str, PosAmp+1, Len-2))); - IF Entity <> NIL THEN BEGIN - Repl := Entity.Value; - ReplaceEntities (Repl); // Recursion - END - ELSE - Repl := Copy (Str, PosAmp, Len); - Delete (Str, PosAmp, Len); - Insert (Repl, Str, PosAmp); - Start := PosAmp + Length (Repl); - UNTIL FALSE; - END; -BEGIN - ReplaceEntities (Str); -END; - - -PROCEDURE TXmlParser.ReplaceGeneralEntities (VAR Str : STRING); - // Recursively replaces General Entity References in the String - PROCEDURE ReplaceEntities (VAR Str : STRING); - VAR - Start : INTEGER; - PAmp : PChar; - PSemi : PChar; - PosAmp : INTEGER; - Len : INTEGER; - EntityDef : TEntityDef; - EntName : STRING; - Repl : STRING; // Replacement - ExternalEntity : TXmlParser; - BEGIN - IF Str = '' THEN EXIT; - Start := 1; - REPEAT - PAmp := StrPos (PChar (Str)+Start-1, '&'); - IF PAmp = NIL THEN BREAK; - PSemi := StrScan (PAmp+2, ';'); - IF PSemi = NIL THEN BREAK; - PosAmp := PAmp - PChar (Str) + 1; - Len := PSemi-PAmp+1; - EntName := Copy (Str, PosAmp+1, Len-2); - IF EntName = 'lt' THEN Repl := '<' - ELSE IF EntName = 'gt' THEN Repl := '>' - ELSE IF EntName = 'amp' THEN Repl := '&' - ELSE IF EntName = 'apos' THEN Repl := '''' - ELSE IF EntName = 'quot' THEN Repl := '"' - ELSE BEGIN - EntityDef := TEntityDef (Entities.Node (EntName)); - IF EntityDef <> NIL THEN BEGIN - IF EntityDef.Value <> '' THEN // Internal Entity - Repl := EntityDef.Value - ELSE BEGIN // External Entity - ExternalEntity := LoadExternalEntity (EntityDef.SystemId, EntityDef.PublicId, EntityDef.NotationName); - Repl := StrPas (ExternalEntity.DocBuffer); // !!! What if it contains a Text Declaration? - ExternalEntity.Free; - END; - ReplaceEntities (Repl); // Recursion - END - ELSE - Repl := Copy (Str, PosAmp, Len); - END; - Delete (Str, PosAmp, Len); - Insert (Repl, Str, PosAmp); - Start := PosAmp + Length (Repl); - UNTIL FALSE; - END; -BEGIN - ReplaceEntities (Str); -END; - - -FUNCTION TXmlParser.LoadExternalEntity (SystemId, PublicId, Notation : STRING) : TXmlParser; - // This will be called whenever there is a Parsed External Entity or - // the DTD External Subset to be parsed. - // It has to create a TXmlParser instance and load the desired Entity. - // This instance of LoadExternalEntity assumes that "SystemId" is a valid - // file name (relative to the Document source) and loads this file using - // the LoadFromFile method. -VAR - Filename : STRING; -BEGIN - // --- Convert System ID to complete filename - Filename := StringReplace (SystemId, '/', '\', [rfReplaceAll]); - IF Copy (FSource, 1, 1) <> '<' THEN - IF (Copy (Filename, 1, 2) = '\\') OR (Copy (Filename, 2, 1) = ':') THEN - // Already has an absolute Path - ELSE BEGIN - Filename := ExtractFilePath (FSource) + Filename; - END; - - // --- Load the File - Result := TXmlParser.Create; - Result.LoadFromFile (Filename); -END; - - -FUNCTION TXmlParser.TranslateEncoding (CONST Source : STRING) : STRING; - // The member variable "CurEncoding" always holds the name of the current - // encoding, e.g. 'UTF-8' or 'ISO-8859-1'. - // This virtual method "TranslateEncoding" is responsible for translating - // the content passed in the "Source" parameter to the Encoding which - // is expected by the application. - // This instance of "TranlateEncoding" assumes that the Application expects - // Windows ANSI (Win1252) strings. It is able to transform UTF-8 or ISO-8859-1 - // encodings. - // If you want your application to understand or create other encodings, you - // override this function. -BEGIN - IF CurEncoding = 'UTF-8' - THEN Result := Utf8ToAnsi (Source) - ELSE Result := Source; -END; - - -PROCEDURE TXmlParser.DtdElementFound (DtdElementRec : TDtdElementRec); - // This method is called for every element which is found in the DTD - // declaration. The variant record TDtdElementRec is passed which - // holds informations about the element. - // You can override this function to handle DTD declarations. - // Note that when you parse the same Document instance a second time, - // the DTD will not get parsed again. -BEGIN -END; - - -FUNCTION TXmlParser.GetDocBuffer: PChar; - // Returns FBuffer or a pointer to a NUL char if Buffer is empty -BEGIN - IF FBuffer = NIL - THEN Result := #0 - ELSE Result := FBuffer; -END; - - -(*$IFNDEF HAS_CONTNRS_UNIT -=============================================================================================== -TObjectList -=============================================================================================== -*) - -DESTRUCTOR TObjectList.Destroy; -BEGIN - Clear; - SetCapacity(0); - INHERITED Destroy; -END; - - -PROCEDURE TObjectList.Delete (Index : INTEGER); -BEGIN - IF (Index < 0) OR (Index >= Count) THEN EXIT; - TObject (Items [Index]).Free; - INHERITED Delete (Index); -END; - - -PROCEDURE TObjectList.Clear; -BEGIN - WHILE Count > 0 DO - Delete (Count-1); -END; - -(*$ENDIF *) - -(* -=============================================================================================== -TNvpNode --------- -Node base class for the TNvpList -=============================================================================================== -*) - -CONSTRUCTOR TNvpNode.Create (TheName, TheValue : STRING); -BEGIN - INHERITED Create; - Name := TheName; - Value := TheValue; -END; - - -(* -=============================================================================================== -TNvpList --------- -A generic List of Name-Value Pairs, based on the TObjectList introduced in Delphi 5 -=============================================================================================== -*) - -PROCEDURE TNvpList.Add (Node : TNvpNode); -VAR - I : INTEGER; -BEGIN - FOR I := Count-1 DOWNTO 0 DO - IF Node.Name > TNvpNode (Items [I]).Name THEN BEGIN - Insert (I+1, Node); - EXIT; - END; - Insert (0, Node); -END; - - - -FUNCTION TNvpList.Node (Name : STRING) : TNvpNode; - // Binary search for Node -VAR - L, H : INTEGER; // Low, High Limit - T, C : INTEGER; // Test Index, Comparison result - Last : INTEGER; // Last Test Index -BEGIN - IF Count=0 THEN BEGIN - Result := NIL; - EXIT; - END; - - L := 0; - H := Count; - Last := -1; - REPEAT - T := (L+H) DIV 2; - IF T=Last THEN BREAK; - Result := TNvpNode (Items [T]); - C := CompareStr (Result.Name, Name); - IF C = 0 THEN EXIT - ELSE IF C < 0 THEN L := T - ELSE H := T; - Last := T; - UNTIL FALSE; - Result := NIL; -END; - - -FUNCTION TNvpList.Node (Index : INTEGER) : TNvpNode; -BEGIN - IF (Index < 0) OR (Index >= Count) - THEN Result := NIL - ELSE Result := TNvpNode (Items [Index]); -END; - - -FUNCTION TNvpList.Value (Name : STRING) : STRING; -VAR - Nvp : TNvpNode; -BEGIN - Nvp := TNvpNode (Node (Name)); - IF Nvp <> NIL - THEN Result := Nvp.Value - ELSE Result := ''; -END; - - -FUNCTION TNvpList.Value (Index : INTEGER) : STRING; -BEGIN - IF (Index < 0) OR (Index >= Count) - THEN Result := '' - ELSE Result := TNvpNode (Items [Index]).Value; -END; - - -FUNCTION TNvpList.Name (Index : INTEGER) : STRING; -BEGIN - IF (Index < 0) OR (Index >= Count) - THEN Result := '' - ELSE Result := TNvpNode (Items [Index]).Name; -END; - - -(* -=============================================================================================== -TAttrList -List of Attributes. The "Analyze" method extracts the Attributes from the given Buffer. -Is used for extraction of Attributes in Start-Tags, Empty-Element Tags and the "pseudo" -attributes in XML Prologs, Text Declarations and PIs. -=============================================================================================== -*) - -PROCEDURE TAttrList.Analyze (Start : PChar; VAR Final : PChar); - // Analyze the Buffer for Attribute=Name pairs. - // Terminates when there is a character which is not IN CNameStart - // (e.g. '?>' or '>' or '/>') -TYPE - TPhase = (phName, phEq, phValue); -VAR - Phase : TPhase; - F : PChar; - Name : STRING; - Value : STRING; - Attr : TAttr; -BEGIN - Clear; - Phase := phName; - Final := Start; - REPEAT - IF (Final^ = #0) OR (Final^ = '>') THEN BREAK; - IF NOT (Final^ IN CWhitespace) THEN - CASE Phase OF - phName : BEGIN - IF NOT (Final^ IN CNameStart) THEN EXIT; - ExtractName (Final, CWhitespace + ['=', '/'], F); - SetStringSF (Name, Final, F); - Final := F; - Phase := phEq; - END; - phEq : BEGIN - IF Final^ = '=' THEN - Phase := phValue - END; - phValue : BEGIN - IF Final^ IN CQuoteChar THEN BEGIN - ExtractQuote (Final, Value, F); - Attr := TAttr.Create; - Attr.Name := Name; - Attr.Value := Value; - Attr.ValueType := vtNormal; - Add (Attr); - Final := F; - Phase := phName; - END; - END; - END; - INC (Final); - UNTIL FALSE; -END; - - -(* -=============================================================================================== -TElemList -List of TElemDef nodes. -=============================================================================================== -*) - -FUNCTION TElemList.Node (Name : STRING) : TElemDef; - // Binary search for the Node with the given Name -VAR - L, H : INTEGER; // Low, High Limit - T, C : INTEGER; // Test Index, Comparison result - Last : INTEGER; // Last Test Index -BEGIN - IF Count=0 THEN BEGIN - Result := NIL; - EXIT; - END; - - L := 0; - H := Count; - Last := -1; - REPEAT - T := (L+H) DIV 2; - IF T=Last THEN BREAK; - Result := TElemDef (Items [T]); - C := CompareStr (Result.Name, Name); - IF C = 0 THEN EXIT - ELSE IF C < 0 THEN L := T - ELSE H := T; - Last := T; - UNTIL FALSE; - Result := NIL; -END; - - -PROCEDURE TElemList.Add (Node : TElemDef); -VAR - I : INTEGER; -BEGIN - FOR I := Count-1 DOWNTO 0 DO - IF Node.Name > TElemDef (Items [I]).Name THEN BEGIN - Insert (I+1, Node); - EXIT; - END; - Insert (0, Node); -END; - - -(* -=============================================================================================== -TScannerXmlParser -A TXmlParser descendant for the TCustomXmlScanner component -=============================================================================================== -*) - -TYPE - TScannerXmlParser = CLASS (TXmlParser) - Scanner : TCustomXmlScanner; - CONSTRUCTOR Create (TheScanner : TCustomXmlScanner); - FUNCTION LoadExternalEntity (SystemId, PublicId, - Notation : STRING) : TXmlParser; OVERRIDE; - FUNCTION TranslateEncoding (CONST Source : STRING) : STRING; OVERRIDE; - PROCEDURE DtdElementFound (DtdElementRec : TDtdElementRec); OVERRIDE; - END; - -CONSTRUCTOR TScannerXmlParser.Create (TheScanner : TCustomXmlScanner); -BEGIN - INHERITED Create; - Scanner := TheScanner; -END; - - -FUNCTION TScannerXmlParser.LoadExternalEntity (SystemId, PublicId, Notation : STRING) : TXmlParser; -BEGIN - IF Assigned (Scanner.FOnLoadExternal) - THEN Scanner.FOnLoadExternal (Scanner, SystemId, PublicId, Notation, Result) - ELSE Result := INHERITED LoadExternalEntity (SystemId, PublicId, Notation); -END; - - -FUNCTION TScannerXmlParser.TranslateEncoding (CONST Source : STRING) : STRING; -BEGIN - IF Assigned (Scanner.FOnTranslateEncoding) - THEN Result := Scanner.FOnTranslateEncoding (Scanner, CurEncoding, Source) - ELSE Result := INHERITED TranslateEncoding (Source); -END; - - -PROCEDURE TScannerXmlParser.DtdElementFound (DtdElementRec : TDtdElementRec); -BEGIN - WITH DtdElementRec DO - CASE ElementType OF - deElement : Scanner.WhenElement (ElemDef); - deAttList : Scanner.WhenAttList (ElemDef); - deEntity : Scanner.WhenEntity (EntityDef); - deNotation : Scanner.WhenNotation (NotationDef); - dePI : Scanner.WhenPI (STRING (Target), STRING (Content), AttrList); - deComment : Scanner.WhenComment (StrSFPas (Start, Final)); - deError : Scanner.WhenDtdError (Pos); - END; -END; - - -(* -=============================================================================================== -TCustomXmlScanner -=============================================================================================== -*) - -CONSTRUCTOR TCustomXmlScanner.Create (AOwner: TComponent); -BEGIN - INHERITED; - FXmlParser := TScannerXmlParser.Create (Self); -END; - - -DESTRUCTOR TCustomXmlScanner.Destroy; -BEGIN - FXmlParser.Free; - INHERITED; -END; - - -PROCEDURE TCustomXmlScanner.LoadFromFile (Filename : TFilename); - // Load XML Document from file -BEGIN - FXmlParser.LoadFromFile (Filename); -END; - - -PROCEDURE TCustomXmlScanner.LoadFromBuffer (Buffer : PChar); - // Load XML Document from buffer -BEGIN - FXmlParser.LoadFromBuffer (Buffer); -END; - - -PROCEDURE TCustomXmlScanner.SetBuffer (Buffer : PChar); - // Refer to Buffer -BEGIN - FXmlParser.SetBuffer (Buffer); -END; - - -FUNCTION TCustomXmlScanner.GetFilename : TFilename; -BEGIN - Result := FXmlParser.Source; -END; - - -FUNCTION TCustomXmlScanner.GetNormalize : BOOLEAN; -BEGIN - Result := FXmlParser.Normalize; -END; - - -PROCEDURE TCustomXmlScanner.SetNormalize (Value : BOOLEAN); -BEGIN - FXmlParser.Normalize := Value; -END; - - -PROCEDURE TCustomXmlScanner.WhenXmlProlog(XmlVersion, Encoding: STRING; Standalone : BOOLEAN); - // Is called when the parser has parsed the declaration of the prolog -BEGIN - IF Assigned (FOnXmlProlog) THEN FOnXmlProlog (Self, XmlVersion, Encoding, Standalone); -END; - - -PROCEDURE TCustomXmlScanner.WhenComment (Comment : STRING); - // Is called when the parser has parsed a -BEGIN - IF Assigned (FOnComment) THEN FOnComment (Self, Comment); -END; - - -PROCEDURE TCustomXmlScanner.WhenPI (Target, Content: STRING; Attributes : TAttrList); - // Is called when the parser has parsed a -BEGIN - IF Assigned (FOnPI) THEN FOnPI (Self, Target, Content, Attributes); -END; - - -PROCEDURE TCustomXmlScanner.WhenDtdRead (RootElementName : STRING); - // Is called when the parser has completely parsed the DTD -BEGIN - IF Assigned (FOnDtdRead) THEN FOnDtdRead (Self, RootElementName); -END; - - -PROCEDURE TCustomXmlScanner.WhenStartTag (TagName : STRING; Attributes : TAttrList); - // Is called when the parser has parsed a start tag like

-BEGIN - IF Assigned (FOnStartTag) THEN FOnStartTag (Self, TagName, Attributes); -END; - - -PROCEDURE TCustomXmlScanner.WhenEmptyTag (TagName : STRING; Attributes : TAttrList); - // Is called when the parser has parsed an Empty Element Tag like
-BEGIN - IF Assigned (FOnEmptyTag) THEN FOnEmptyTag (Self, TagName, Attributes); -END; - - -PROCEDURE TCustomXmlScanner.WhenEndTag (TagName : STRING); - // Is called when the parser has parsed an End Tag like

-BEGIN - IF Assigned (FOnEndTag) THEN FOnEndTag (Self, TagName); -END; - - -PROCEDURE TCustomXmlScanner.WhenContent (Content : STRING); - // Is called when the parser has parsed an element's text content -BEGIN - IF Assigned (FOnContent) THEN FOnContent (Self, Content); -END; - - -PROCEDURE TCustomXmlScanner.WhenCData (Content : STRING); - // Is called when the parser has parsed a CDATA section -BEGIN - IF Assigned (FOnCData) THEN FOnCData (Self, Content); -END; - - -PROCEDURE TCustomXmlScanner.WhenElement (ElemDef : TElemDef); - // Is called when the parser has parsed an definition - // inside the DTD -BEGIN - IF Assigned (FOnElement) THEN FOnElement (Self, ElemDef); -END; - - -PROCEDURE TCustomXmlScanner.WhenAttList (ElemDef : TElemDef); - // Is called when the parser has parsed an definition - // inside the DTD -BEGIN - IF Assigned (FOnAttList) THEN FOnAttList (Self, ElemDef); -END; - - -PROCEDURE TCustomXmlScanner.WhenEntity (EntityDef : TEntityDef); - // Is called when the parser has parsed an definition - // inside the DTD -BEGIN - IF Assigned (FOnEntity) THEN FOnEntity (Self, EntityDef); -END; - - -PROCEDURE TCustomXmlScanner.WhenNotation (NotationDef : TNotationDef); - // Is called when the parser has parsed a definition - // inside the DTD -BEGIN - IF Assigned (FOnNotation) THEN FOnNotation (Self, NotationDef); -END; - - -PROCEDURE TCustomXmlScanner.WhenDtdError (ErrorPos : PChar); - // Is called when the parser has found an Error in the DTD -BEGIN - IF Assigned (FOnDtdError) THEN FOnDtdError (Self, ErrorPos); -END; - - -PROCEDURE TCustomXmlScanner.Execute; - // Perform scanning - // Scanning is done synchronously, i.e. you can expect events to be triggered - // in the order of the XML data stream. Execute will finish when the whole XML - // document has been scanned or when the StopParser property has been set to TRUE. -BEGIN - FStopParser := FALSE; - FXmlParser.StartScan; - WHILE FXmlParser.Scan AND (NOT FStopParser) DO - CASE FXmlParser.CurPartType OF - ptNone : ; - ptXmlProlog : WhenXmlProlog (FXmlParser.XmlVersion, FXmlParser.Encoding, FXmlParser.Standalone); - ptComment : WhenComment (StrSFPas (FXmlParser.CurStart, FXmlParser.CurFinal)); - ptPI : WhenPI (FXmlParser.CurName, FXmlParser.CurContent, FXmlParser.CurAttr); - ptDtdc : WhenDtdRead (FXmlParser.RootName); - ptStartTag : WhenStartTag (FXmlParser.CurName, FXmlParser.CurAttr); - ptEmptyTag : WhenEmptyTag (FXmlParser.CurName, FXmlParser.CurAttr); - ptEndTag : WhenEndTag (FXmlParser.CurName); - ptContent : WhenContent (FXmlParser.CurContent); - ptCData : WhenCData (FXmlParser.CurContent); - END; -END; - - -END. diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/logger.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/logger.pas deleted file mode 100644 index 88bb1698..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/logger.pas +++ /dev/null @@ -1,176 +0,0 @@ -unit logger; -{ - $Id: logger.pas,v 1.1 2004/02/05 00:08:20 savage Exp $ - -} -{******************************************************************************} -{ } -{ Error Logging Unit } -{ } -{ The initial developer of this Pascal code was : } -{ Dominique Louis } -{ } -{ Portions created by Dominique Louis are } -{ Copyright (C) 2000 - 2001 Dominique Louis. } -{ } -{ } -{ } -{ Contributor(s) } -{ -------------- } -{ } -{ } -{ Obtained through: } -{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } -{ } -{ You may retrieve the latest version of this file at the Project } -{ JEDI home page, located at http://delphi-jedi.org } -{ } -{ The contents of this file are used with permission, subject to } -{ the Mozilla Public License Version 1.1 (the "License"); you may } -{ not use this file except in compliance with the License. You may } -{ obtain a copy of the License at } -{ http://www.mozilla.org/MPL/MPL-1.1.html } -{ } -{ Software distributed under the License is distributed on an } -{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } -{ implied. See the License for the specific language governing } -{ rights and limitations under the License. } -{ } -{ Description } -{ ----------- } -{ Logging functions... } -{ } -{ } -{ Requires } -{ -------- } -{ SDL.dll on Windows platforms } -{ libSDL-1.1.so.0 on Linux platform } -{ } -{ Programming Notes } -{ ----------------- } -{ } -{ } -{ } -{ } -{ Revision History } -{ ---------------- } -{ 2001 - DL : Initial creation } -{ 25/10/2001 - DRE : Added $M+ directive to allow published } -{ in classes. Added a compile directive } -{ around fmShareExclusive as this does not } -{ exist in Free Pascal } -{ } -{******************************************************************************} -{ - $Log: logger.pas,v $ - Revision 1.1 2004/02/05 00:08:20 savage - Module 1.0 release - - -} - -{$I jedi-sdl.inc} - -{$WEAKPACKAGEUNIT OFF} - -interface - -uses - Classes, - SysUtils; - -type - TLogger = class - private - FFileHandle : TextFile; - FApplicationName : string; - FApplicationPath : string; - protected - - public - constructor Create; - destructor Destroy; override; - function GetApplicationName: string; - function GetApplicationPath: string; - procedure LogError( ErrorMessage : string; Location : string ); - procedure LogWarning( WarningMessage : string; Location : string ); - procedure LogStatus( StatusMessage : string; Location : string ); - published - property ApplicationName : string read GetApplicationName; - property ApplicationPath : string read GetApplicationPath; - end; - -var - Log : TLogger; - -implementation - -{ TLogger } -constructor TLogger.Create; -begin - FApplicationName := ExtractFileName( ParamStr(0) ); - FApplicationPath := ExtractFilePath( ParamStr(0) ); - AssignFile( FFileHandle, FApplicationPath + ChangeFileExt( FApplicationName, '.log' ) ); - ReWrite( FFileHandle ); - (*inherited Create( FApplicationPath + ChangeFileExt( FApplicationName, '.log' ), - fmCreate {$IFNDEF FPC}or fmShareExclusive{$ENDIF} );*) -end; - -destructor TLogger.Destroy; -begin - CloseFile( FFileHandle ); - inherited; -end; - -function TLogger.GetApplicationName: string; -begin - result := FApplicationName; -end; - -function TLogger.GetApplicationPath: string; -begin - result := FApplicationPath; -end; - -procedure TLogger.LogError(ErrorMessage, Location: string); -var - S : string; -begin - S := '*** ERROR *** : @ ' + TimeToStr(Time) + ' MSG : ' + ErrorMessage + ' IN : ' + Location + #13#10; - WriteLn( FFileHandle, S ); - Flush( FFileHandle ); -end; - -procedure TLogger.LogStatus(StatusMessage, Location: string); -var - S : string; -begin - S := 'STATUS INFO : @ ' + TimeToStr(Time) + ' MSG : ' + StatusMessage + ' IN : ' + Location + #13#10; - WriteLn( FFileHandle, S ); - Flush( FFileHandle ); -end; - -procedure TLogger.LogWarning(WarningMessage, Location: string); -var - S : string; -begin - S := '=== WARNING === : @ ' + TimeToStr(Time) + ' MSG : ' + WarningMessage + ' IN : ' + Location + #13#10; - WriteLn( FFileHandle, S ); - Flush( FFileHandle ); -end; - -initialization -begin - Log := TLogger.Create; - Log.LogStatus( 'Starting Application', 'Initialization' ); -end; - -finalization -begin - Log.LogStatus( 'Terminating Application', 'Finalization' ); - Log.Free; - Log := nil; -end; - -end. - \ No newline at end of file diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/moduleloader.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/moduleloader.pas deleted file mode 100644 index 146e4b30..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/moduleloader.pas +++ /dev/null @@ -1,319 +0,0 @@ -unit moduleloader; -{ - $Id: moduleloader.pas,v 1.4 2004/02/20 17:19:10 savage Exp $ - -} -{******************************************************************} -{ } -{ Project JEDI } -{ OS independent Dynamic Loading Helpers } -{ } -{ The initial developer of the this code is } -{ Robert Marquardt INVALID_MODULEHANDLE_VALUE; -end; - -// load the DLL file FileName -// LoadLibraryEx is used to get better control of the loading -// for the allowed values for flags see LoadLibraryEx documentation. - -function LoadModuleEx(var Module: TModuleHandle; FileName: PChar; Flags: Cardinal): Boolean; -begin - if Module = INVALID_MODULEHANDLE_VALUE then - Module := LoadLibraryEx( FileName, 0, Flags); - Result := Module <> INVALID_MODULEHANDLE_VALUE; -end; - -// unload a DLL loaded with LoadModule or LoadModuleEx -// The procedure will not try to unload a handle with -// value INVALID_MODULEHANDLE_VALUE and assigns this value -// to Module after unload. - -procedure UnloadModule(var Module: TModuleHandle); -begin - if Module <> INVALID_MODULEHANDLE_VALUE then - FreeLibrary(Module); - Module := INVALID_MODULEHANDLE_VALUE; -end; - -// returns the pointer to the symbol named SymbolName -// if it is exported from the DLL Module -// nil is returned if the symbol is not available - -function GetModuleSymbol(Module: TModuleHandle; SymbolName: PChar): Pointer; -begin - Result := nil; - if Module <> INVALID_MODULEHANDLE_VALUE then - Result := GetProcAddress(Module, SymbolName ); -end; - -// returns the pointer to the symbol named SymbolName -// if it is exported from the DLL Module -// nil is returned if the symbol is not available. -// as an extra the boolean variable Accu is updated -// by anding in the success of the function. -// This is very handy for rendering a global result -// when accessing a long list of symbols. - -function GetModuleSymbolEx(Module: TModuleHandle; SymbolName: PChar; var Accu: Boolean): Pointer; -begin - Result := nil; - if Module <> INVALID_MODULEHANDLE_VALUE then - Result := GetProcAddress(Module, SymbolName ); - Accu := Accu and (Result <> nil); -end; - -// get the value of variables exported from a DLL Module -// Delphi cannot access variables in a DLL directly, so -// this function allows to copy the data from the DLL. -// Beware! You are accessing the DLL memory image directly. -// Be sure to access a variable not a function and be sure -// to read the correct amount of data. - -function ReadModuleData(Module: TModuleHandle; SymbolName: PChar; var Buffer; Size: Cardinal): Boolean; -var - Sym: Pointer; -begin - Result := True; - Sym := GetModuleSymbolEx(Module, SymbolName, Result); - if Result then - Move(Sym^, Buffer, Size); -end; - -// set the value of variables exported from a DLL Module -// Delphi cannot access variables in a DLL directly, so -// this function allows to copy the data to the DLL! -// BEWARE! You are accessing the DLL memory image directly. -// Be sure to access a variable not a function and be sure -// to write the correct amount of data. -// The changes are not persistent. They get lost when the -// DLL is unloaded. - -function WriteModuleData(Module: TModuleHandle; SymbolName: PChar; var Buffer; Size: Cardinal): Boolean; -var - Sym: Pointer; -begin - Result := True; - Sym := GetModuleSymbolEx(Module, SymbolName, Result); - if Result then - Move(Buffer, Sym^, Size); -end; - -{$ENDIF} - -{$IFDEF Unix} -uses -{$ifdef Linux} - Types, - Libc; -{$else} - dl, - Types, - Baseunix, - Unix; -{$endif} -type - // Handle to a loaded .so - TModuleHandle = Pointer; - -const - // Value designating an unassigned TModuleHandle od a failed loading - INVALID_MODULEHANDLE_VALUE = TModuleHandle(nil); - -function LoadModule(var Module: TModuleHandle; FileName: PChar): Boolean; -function LoadModuleEx(var Module: TModuleHandle; FileName: PChar; Flags: Cardinal): Boolean; -procedure UnloadModule(var Module: TModuleHandle); -function GetModuleSymbol(Module: TModuleHandle; SymbolName: PChar): Pointer; -function GetModuleSymbolEx(Module: TModuleHandle; SymbolName: PChar; var Accu: Boolean): Pointer; -function ReadModuleData(Module: TModuleHandle; SymbolName: PChar; var Buffer; Size: Cardinal): Boolean; -function WriteModuleData(Module: TModuleHandle; SymbolName: PChar; var Buffer; Size: Cardinal): Boolean; - -implementation - -// load the .so file FileName -// the rules for FileName are those of dlopen() -// Returns: True = success, False = failure to load -// Assigns: the handle of the loaded .so to Module -// Warning: if Module has any other value than INVALID_MODULEHANDLE_VALUE -// on entry the function will do nothing but returning success. - -function LoadModule(var Module: TModuleHandle; FileName: PChar): Boolean; -begin - if Module = INVALID_MODULEHANDLE_VALUE then - Module := dlopen( FileName, RTLD_NOW); - Result := Module <> INVALID_MODULEHANDLE_VALUE; -end; - -// load the .so file FileName -// dlopen() with flags is used to get better control of the loading -// for the allowed values for flags see "man dlopen". - -function LoadModuleEx(var Module: TModuleHandle; FileName: PChar; Flags: Cardinal): Boolean; -begin - if Module = INVALID_MODULEHANDLE_VALUE then - Module := dlopen( FileName, Flags); - Result := Module <> INVALID_MODULEHANDLE_VALUE; -end; - -// unload a .so loaded with LoadModule or LoadModuleEx -// The procedure will not try to unload a handle with -// value INVALID_MODULEHANDLE_VALUE and assigns this value -// to Module after unload. - -procedure UnloadModule(var Module: TModuleHandle); -begin - if Module <> INVALID_MODULEHANDLE_VALUE then - dlclose(Module); - Module := INVALID_MODULEHANDLE_VALUE; -end; - -// returns the pointer to the symbol named SymbolName -// if it is exported from the .so Module -// nil is returned if the symbol is not available - -function GetModuleSymbol(Module: TModuleHandle; SymbolName: PChar): Pointer; -begin - Result := nil; - if Module <> INVALID_MODULEHANDLE_VALUE then - Result := dlsym(Module, SymbolName ); -end; - -// returns the pointer to the symbol named SymbolName -// if it is exported from the .so Module -// nil is returned if the symbol is not available. -// as an extra the boolean variable Accu is updated -// by anding in the success of the function. -// This is very handy for rendering a global result -// when accessing a long list of symbols. - -function GetModuleSymbolEx(Module: TModuleHandle; SymbolName: PChar; var Accu: Boolean): Pointer; -begin - Result := nil; - if Module <> INVALID_MODULEHANDLE_VALUE then - Result := dlsym(Module, SymbolName ); - Accu := Accu and (Result <> nil); -end; - -// get the value of variables exported from a .so Module -// Delphi cannot access variables in a .so directly, so -// this function allows to copy the data from the .so. -// Beware! You are accessing the .so memory image directly. -// Be sure to access a variable not a function and be sure -// to read the correct amount of data. - -function ReadModuleData(Module: TModuleHandle; SymbolName: PChar; var Buffer; Size: Cardinal): Boolean; -var - Sym: Pointer; -begin - Result := True; - Sym := GetModuleSymbolEx(Module, SymbolName, Result); - if Result then - Move(Sym^, Buffer, Size); -end; - -// set the value of variables exported from a .so Module -// Delphi cannot access variables in a .so directly, so -// this function allows to copy the data to the .so! -// BEWARE! You are accessing the .so memory image directly. -// Be sure to access a variable not a function and be sure -// to write the correct amount of data. -// The changes are not persistent. They get lost when the -// .so is unloaded. - -function WriteModuleData(Module: TModuleHandle; SymbolName: PChar; var Buffer; Size: Cardinal): Boolean; -var - Sym: Pointer; -begin - Result := True; - Sym := GetModuleSymbolEx(Module, SymbolName, Result); - if Result then - Move(Buffer, Sym^, Size); -end; -{$ENDIF} - -{$IFDEF __MACH__} // Mach definitions go here -{$ENDIF} - -end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/registryuserpreferences.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/registryuserpreferences.pas deleted file mode 100644 index 2d28a222..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/registryuserpreferences.pas +++ /dev/null @@ -1,229 +0,0 @@ -unit registryuserpreferences; -{ - $Id: registryuserpreferences.pas,v 1.1 2004/09/30 22:35:47 savage Exp $ - -} -{******************************************************************************} -{ } -{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } -{ Wrapper class for Windows Register and INI Files } -{ } -{ The initial developer of this Pascal code was : } -{ Dominqiue Louis } -{ } -{ Portions created by Dominqiue Louis are } -{ Copyright (C) 2000 - 2001 Dominqiue Louis. } -{ } -{ } -{ Contributor(s) } -{ -------------- } -{ } -{ } -{ Obtained through: } -{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } -{ } -{ You may retrieve the latest version of this file at the Project } -{ JEDI home page, located at http://delphi-jedi.org } -{ } -{ The contents of this file are used with permission, subject to } -{ the Mozilla Public License Version 1.1 (the "License"); you may } -{ not use this file except in compliance with the License. You may } -{ obtain a copy of the License at } -{ http://www.mozilla.org/MPL/MPL-1.1.html } -{ } -{ Software distributed under the License is distributed on an } -{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } -{ implied. See the License for the specific language governing } -{ rights and limitations under the License. } -{ } -{ Description } -{ ----------- } -{ } -{ } -{ } -{ } -{ } -{ } -{ } -{ Requires } -{ -------- } -{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } -{ They are available from... } -{ http://www.libsdl.org . } -{ } -{ Programming Notes } -{ ----------------- } -{ } -{ } -{ } -{ } -{ Revision History } -{ ---------------- } -{ September 23 2004 - DL : Initial Creation } -{ - $Log: registryuserpreferences.pas,v $ - Revision 1.1 2004/09/30 22:35:47 savage - Changes, enhancements and additions as required to get SoAoS working. - - -} -{******************************************************************************} - -interface - -uses - {$IFDEF REG} - Registry, - {$ELSE} - IniFiles, - {$ENDIF} - Classes, - userpreferences; - -type - TRegistryUserPreferences = class( TUserPreferences ) - private - - protected - function GetSection( const Index : Integer ) : string; virtual; abstract; - function GetIdentifier( const Index : Integer ) : string; virtual; abstract; - function GetDefaultBoolean( const Index : Integer ) : Boolean; override; - function GetBoolean( const Index : Integer ) : Boolean; override; - procedure SetBoolean( const Index : Integer; const Value : Boolean ); override; - function GetDefaultDateTime( const Index : Integer ) : TDateTime; override; - function GetDateTime( const Index : Integer ) : TDateTime; override; - procedure SetDateTime( const Index : Integer; const Value : TDateTime ); override; - function GetDefaultInteger( const Index : Integer ) : Integer; override; - function GetInteger( const Index : Integer ) : Integer; override; - procedure SetInteger( const Index : Integer; const Value : Integer ); override; - function GetDefaultFloat( const Index : Integer ) : single; override; - function GetFloat( const Index : Integer ) : single; override; - procedure SetFloat( const Index : Integer; const Value : single ); override; - function GetDefaultString( const Index : Integer ) : string; override; - function GetString( const Index : Integer ) : string; override; - procedure SetString( const Index : Integer; const Value : string ); override; - public - Registry : {$IFDEF REG}TRegIniFile{$ELSE}TIniFile{$ENDIF}; - constructor Create( const FileName : string = '' ); reintroduce; - destructor Destroy; override; - procedure Update; override; - end; - -implementation - -uses - SysUtils; - -{ TRegistryUserPreferences } -constructor TRegistryUserPreferences.Create( const FileName : string ); -var - defFileName : string; -begin - inherited Create; - - if FileName <> '' then - defFileName := FileName - else - defFileName := ChangeFileExt( ParamStr( 0 ), '.ini' ); - - Registry := {$IFDEF REG}TRegIniFile{$ELSE}TIniFile{$ENDIF}.Create( defFileName ); -end; - -destructor TRegistryUserPreferences.Destroy; -begin - Update; - Registry.Free; - Registry := nil; - inherited; -end; - -function TRegistryUserPreferences.GetBoolean( const Index : Integer ) : Boolean; -begin - Result := Registry.ReadBool( GetSection( Index ), GetIdentifier( Index ), GetDefaultBoolean( Index ) ); -end; - -function TRegistryUserPreferences.GetDateTime( const Index : Integer ): TDateTime; -begin - Result := Registry.ReadDateTime( GetSection( Index ){$IFNDEF REG}, GetIdentifier( Index ), GetDefaultDateTime( Index ){$ENDIF} ); -end; - -function TRegistryUserPreferences.GetDefaultBoolean( const Index : Integer ) : Boolean; -begin - result := false; -end; - -function TRegistryUserPreferences.GetDefaultDateTime( const Index: Integer ) : TDateTime; -begin - result := Now; -end; - -function TRegistryUserPreferences.GetDefaultFloat( const Index: Integer ) : single; -begin - result := 0.0; -end; - -function TRegistryUserPreferences.GetDefaultInteger(const Index : Integer ) : Integer; -begin - result := 0; -end; - -function TRegistryUserPreferences.GetDefaultString( const Index : Integer ) : string; -begin - result := ''; -end; - -function TRegistryUserPreferences.GetFloat( const Index : Integer ): single; -begin - Result := Registry.ReadFloat( GetSection( Index ){$IFNDEF REG}, GetIdentifier( Index ), GetDefaultFloat( Index ){$ENDIF} ); -end; - -function TRegistryUserPreferences.GetInteger( const Index : Integer ) : Integer; -begin - Result := Registry.ReadInteger( GetSection( Index ), GetIdentifier( Index ), GetDefaultInteger( Index ) ); -end; - -function TRegistryUserPreferences.GetString( const Index : Integer ): string; -begin - Result := Registry.ReadString( GetSection( Index ), GetIdentifier( Index ), GetDefaultString( Index ) ); -end; - -procedure TRegistryUserPreferences.SetBoolean( const Index : Integer; const Value : Boolean ); -begin - Registry.WriteBool( GetSection( Index ), GetIdentifier( Index ), Value ); - inherited; -end; - -procedure TRegistryUserPreferences.SetDateTime( const Index: Integer; const Value: TDateTime ); -begin - Registry.WriteDateTime( GetSection( Index ){$IFNDEF REG}, GetIdentifier( Index ){$ENDIF}, Value ); - inherited; -end; - -procedure TRegistryUserPreferences.SetFloat(const Index: Integer; const Value: single); -begin - Registry.WriteFloat( GetSection( Index ){$IFNDEF REG}, GetIdentifier( Index ){$ENDIF}, Value ); - inherited; -end; - -procedure TRegistryUserPreferences.SetInteger( const Index, Value : Integer ); -begin - Registry.WriteInteger( GetSection( Index ), GetIdentifier( Index ), Value ); - inherited; -end; - -procedure TRegistryUserPreferences.SetString( const Index : Integer; const Value : string ); -begin - Registry.WriteString( GetSection( Index ), GetIdentifier( Index ), Value ); - inherited; -end; - -procedure TRegistryUserPreferences.Update; -begin - {$IFDEF REG} - Registry.CloseKey; - {$ELSE} - Registry.UpdateFile; - {$ENDIF} -end; - -end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdl.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdl.pas deleted file mode 100644 index ad5d783a..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdl.pas +++ /dev/null @@ -1,4118 +0,0 @@ -unit sdl; -{ - $Id: sdl.pas,v 1.17 2005/01/03 18:40:59 savage Exp $ - -} -{******************************************************************************} -{ } -{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } -{ Conversion of the Simple DirectMedia Layer Headers } -{ } -{ Portions created by Sam Lantinga are } -{ Copyright (C) 1997-2004 Sam Lantinga } -{ 5635-34 Springhouse Dr. } -{ Pleasanton, CA 94588 (USA) } -{ } -{ All Rights Reserved. } -{ } -{ The original files are : SDL.h } -{ SDL_main.h } -{ SDL_types.h } -{ SDL_rwops.h } -{ SDL_timer.h } -{ SDL_audio.h } -{ SDL_cdrom.h } -{ SDL_joystick.h } -{ SDL_mouse.h } -{ SDL_keyboard.h } -{ SDL_events.h } -{ SDL_video.h } -{ SDL_byteorder.h } -{ SDL_version.h } -{ SDL_active.h } -{ SDL_thread.h } -{ SDL_mutex .h } -{ SDL_getenv.h } -{ SDL_loadso.h } -{ } -{ The initial developer of this Pascal code was : } -{ Dominqiue Louis } -{ } -{ Portions created by Dominqiue Louis are } -{ Copyright (C) 2000 - 2004 Dominqiue Louis. } -{ } -{ } -{ Contributor(s) } -{ -------------- } -{ Tom Jones His Project inspired this conversion } -{ Matthias Thoma } -{ } -{ Obtained through: } -{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } -{ } -{ You may retrieve the latest version of this file at the Project } -{ JEDI home page, located at http://delphi-jedi.org } -{ } -{ The contents of this file are used with permission, subject to } -{ the Mozilla Public License Version 1.1 (the "License"); you may } -{ not use this file except in compliance with the License. You may } -{ obtain a copy of the License at } -{ http://www.mozilla.org/MPL/MPL-1.1.html } -{ } -{ Software distributed under the License is distributed on an } -{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } -{ implied. See the License for the specific language governing } -{ rights and limitations under the License. } -{ } -{ Description } -{ ----------- } -{ } -{ } -{ } -{ } -{ } -{ } -{ } -{ Requires } -{ -------- } -{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } -{ They are available from... } -{ http://www.libsdl.org . } -{ } -{ Programming Notes } -{ ----------------- } -{ } -{ } -{ } -{ } -{ Revision History } -{ ---------------- } -{ May 08 2001 - DL : Added Keyboard State Array ( See demos for how to } -{ use ) } -{ PKeyStateArr = ^TKeyStateArr; } -{ TKeyStateArr = array[0..65000] of UInt8; } -{ As most games will need it. } -{ } -{ April 02 2001 - DL : Added SDL_getenv.h definitions and tested version } -{ 1.2.0 compatability. } -{ } -{ March 13 2001 - MT : Added Linux compatibility. } -{ } -{ March 10 2001 - MT : Added externalsyms for DEFINES } -{ Changed the license header } -{ } -{ March 09 2001 - MT : Added Kylix Ifdefs/Deleted the uses mmsystem } -{ } -{ March 01 2001 - DL : Update conversion of version 1.1.8 } -{ } -{ July 22 2001 - DL : Added TUInt8Array and PUIntArray after suggestions } -{ from Matthias Thoma and Eric Grange. } -{ } -{ October 12 2001 - DL : Various changes as suggested by Matthias Thoma and } -{ David Acklam } -{ } -{ October 24 2001 - DL : Added FreePascal support as per suggestions from } -{ Dean Ellis. } -{ } -{ October 27 2001 - DL : Added SDL_BUTTON macro } -{ } -{ November 08 2001 - DL : Bug fix as pointed out by Puthoon. } -{ } -{ November 29 2001 - DL : Bug fix of SDL_SetGammaRamp as pointed out by Simon} -{ Rushton. } -{ } -{ November 30 2001 - DL : SDL_NOFRAME added as pointed out by Simon Rushton. } -{ } -{ December 11 2001 - DL : Added $WEAKPACKAGEUNIT ON to facilitate useage in } -{ Components } -{ } -{ January 05 2002 - DL : Added SDL_Swap32 function as suggested by Matthias } -{ Thoma and also made sure the _getenv from } -{ MSVCRT.DLL uses the right calling convention } -{ } -{ January 25 2002 - DL : Updated conversion of SDL_AddTimer & } -{ SDL_RemoveTimer as per suggestions from Matthias } -{ Thoma. } -{ } -{ January 27 2002 - DL : Commented out exported function putenv and getenv } -{ So that developers get used to using SDL_putenv } -{ SDL_getenv, as they are more portable } -{ } -{ March 05 2002 - DL : Added FreeAnNil procedure for Delphi 4 users. } -{ } -{ October 23 2002 - DL : Added Delphi 3 Define of Win32. } -{ If you intend to you Delphi 3... } -{ ( which is officially unsupported ) make sure you } -{ remove references to $EXTERNALSYM in this and other} -{ SDL files. } -{ } -{ November 29 2002 - DL : Fixed bug in Declaration of SDL_GetRGBA that was } -{ pointed out by Todd Lang } -{ } -{ April 03 2003 - DL : Added jedi-sdl.inc include file to support more } -{ Pascal compilers. Initial support is now included } -{ for GnuPascal, VirtualPascal, TMT and obviously } -{ continue support for Delphi Kylix and FreePascal. } -{ } -{ April 08 2003 - MK : Aka Mr Kroket - Added Better FPC support } -{ } -{ April 24 2003 - DL : under instruction from Alexey Barkovoy, I have added} -{ better TMT Pascal support and under instruction } -{ from Prof. Abimbola Olowofoyeku (The African Chief),} -{ I have added better Gnu Pascal support } -{ } -{ April 30 2003 - DL : under instruction from David Mears AKA } -{ Jason Siletto, I have added FPC Linux support. } -{ This was compiled with fpc 1.1, so remember to set } -{ include file path. ie. -Fi/usr/share/fpcsrc/rtl/* } -{ } -{ - $Log: sdl.pas,v $ - Revision 1.17 2005/01/03 18:40:59 savage - Updated Version number to reflect latest one - - Revision 1.16 2005/01/01 02:02:06 savage - Updated to v1.2.8 - - Revision 1.15 2004/12/24 18:57:11 savage - forgot to apply Michalis Kamburelis' patch to the implementation section. now fixed - - Revision 1.14 2004/12/23 23:42:18 savage - Applied Patches supplied by Michalis Kamburelis ( THANKS! ), for greater FreePascal compatability. - - Revision 1.13 2004/09/30 22:31:59 savage - Updated with slightly different header comments - - Revision 1.12 2004/09/12 21:52:58 savage - Slight changes to fix some issues with the sdl classes. - - Revision 1.11 2004/08/14 22:54:30 savage - Updated so that Library name defines are correctly defined for MacOS X. - - Revision 1.10 2004/07/20 23:57:33 savage - Thanks to Paul Toth for spotting an error in the SDL Audio Convertion structures. - In TSDL_AudioCVT the filters variable should point to and array of pointers and not what I had there previously. - - Revision 1.9 2004/07/03 22:07:22 savage - Added Bitwise Manipulation Functions for TSDL_VideoInfo struct. - - Revision 1.8 2004/05/10 14:10:03 savage - Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ). - - Revision 1.7 2004/04/13 09:32:08 savage - Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary. - - Revision 1.6 2004/04/01 20:53:23 savage - Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site. - - Revision 1.5 2004/02/22 15:32:10 savage - SDL_GetEnv Fix so it also works on FPC/Linux. Thanks to Rodrigo for pointing this out. - - Revision 1.4 2004/02/21 23:24:29 savage - SDL_GetEnv Fix so that it is not define twice for FPC. Thanks to Rene Hugentobler for pointing out this bug, - - Revision 1.3 2004/02/18 22:35:51 savage - Brought sdl.pas up to 1.2.7 compatability - Thus... - Added SDL_GL_STEREO, - SDL_GL_MULTISAMPLEBUFFERS, - SDL_GL_MULTISAMPLESAMPLES - - Add DLL/Shared object functions - function SDL_LoadObject( const sofile : PChar ) : Pointer; - - function SDL_LoadFunction( handle : Pointer; const name : PChar ) : Pointer; - - procedure SDL_UnloadObject( handle : Pointer ); - - Added function to create RWops from const memory: SDL_RWFromConstMem() - function SDL_RWFromConstMem(const mem: Pointer; size: Integer) : PSDL_RWops; - - Ported SDL_cpuinfo.h so Now you can test for Specific CPU types. - - Revision 1.2 2004/02/17 21:37:12 savage - Tidying up of units - - Revision 1.1 2004/02/05 00:08:20 savage - Module 1.0 release - -} -{******************************************************************************} - -{$I jedi-sdl.inc} - -{$ALIGN ON} - -interface - -uses -{$IFDEF __GPC__} - system, - gpc; -{$ENDIF} - -{$IFDEF WIN32} - {$IFNDEF __GPC__} - Windows; - {$ENDIF} -{$ENDIF} - -{$IFDEF UNIX} - {$IFDEF FPC} - {$IFDEF Ver1_0} - linux, - {$ELSE} - pthreads, - baseunix, - unix, - {$ENDIF} - x, - xlib; - {$ELSE} - Types, - Libc, - Xlib; - {$ENDIF} -{$ENDIF} - -{$IFDEF __MACH__} - GPCMacOSAll; -{$ENDIF} - -const -{$IFDEF WIN32} - SDLLibName = 'SDL.dll'; -{$ENDIF} - -{$IFDEF UNIX} -{$IFDEF DARWIN} - SDLLibName = 'libSDL.dylib'; -{$ELSE} - SDLLibName = 'libSDL.so'; -{$ENDIF} -{$ENDIF} - -{$IFDEF MACOS} - SDLLibName = 'SDL'; -{$ENDIF} - - // SDL.h constants - SDL_INIT_TIMER = $00000001; -{$EXTERNALSYM SDL_INIT_TIMER} - SDL_INIT_AUDIO = $00000010; -{$EXTERNALSYM SDL_INIT_AUDIO} - SDL_INIT_VIDEO = $00000020; -{$EXTERNALSYM SDL_INIT_VIDEO} - SDL_INIT_CDROM = $00000100; -{$EXTERNALSYM SDL_INIT_CDROM} - SDL_INIT_JOYSTICK = $00000200; -{$EXTERNALSYM SDL_INIT_JOYSTICK} - SDL_INIT_NOPARACHUTE = $00100000; // Don't catch fatal signals -{$EXTERNALSYM SDL_INIT_NOPARACHUTE} - SDL_INIT_EVENTTHREAD = $01000000; // Not supported on all OS's -{$EXTERNALSYM SDL_INIT_EVENTTHREAD} - SDL_INIT_EVERYTHING = $0000FFFF; -{$EXTERNALSYM SDL_INIT_EVERYTHING} - - // SDL_error.h constants - ERR_MAX_STRLEN = 128; -{$EXTERNALSYM ERR_MAX_STRLEN} - ERR_MAX_ARGS = 5; -{$EXTERNALSYM ERR_MAX_ARGS} - - // SDL_types.h constants - SDL_PRESSED = $01; -{$EXTERNALSYM SDL_PRESSED} - SDL_RELEASED = $00; -{$EXTERNALSYM SDL_RELEASED} - - // SDL_timer.h constants - // This is the OS scheduler timeslice, in milliseconds - SDL_TIMESLICE = 10; -{$EXTERNALSYM SDL_TIMESLICE} - // This is the maximum resolution of the SDL timer on all platforms - TIMER_RESOLUTION = 10; // Experimentally determined -{$EXTERNALSYM TIMER_RESOLUTION} - - // SDL_audio.h constants - AUDIO_U8 = $0008; // Unsigned 8-bit samples -{$EXTERNALSYM AUDIO_U8} - AUDIO_S8 = $8008; // Signed 8-bit samples -{$EXTERNALSYM AUDIO_S8} - AUDIO_U16LSB = $0010; // Unsigned 16-bit samples -{$EXTERNALSYM AUDIO_U16LSB} - AUDIO_S16LSB = $8010; // Signed 16-bit samples -{$EXTERNALSYM AUDIO_S16LSB} - AUDIO_U16MSB = $1010; // As above, but big-endian byte order -{$EXTERNALSYM AUDIO_U16MSB} - AUDIO_S16MSB = $9010; // As above, but big-endian byte order -{$EXTERNALSYM AUDIO_S16MSB} - AUDIO_U16 = AUDIO_U16LSB; -{$EXTERNALSYM AUDIO_U16} - AUDIO_S16 = AUDIO_S16LSB; -{$EXTERNALSYM AUDIO_S16} - - - // SDL_cdrom.h constants - // The maximum number of CD-ROM tracks on a disk - SDL_MAX_TRACKS = 99; -{$EXTERNALSYM SDL_MAX_TRACKS} - // The types of CD-ROM track possible - SDL_AUDIO_TRACK = $00; -{$EXTERNALSYM SDL_AUDIO_TRACK} - SDL_DATA_TRACK = $04; -{$EXTERNALSYM SDL_DATA_TRACK} - - // Conversion functions from frames to Minute/Second/Frames and vice versa - CD_FPS = 75; -{$EXTERNALSYM CD_FPS} - // SDL_byteorder.h constants - // The two types of endianness - SDL_LIL_ENDIAN = 1234; -{$EXTERNALSYM SDL_LIL_ENDIAN} - SDL_BIG_ENDIAN = 4321; -{$EXTERNALSYM SDL_BIG_ENDIAN} - -{$IFDEF IA32} - - SDL_BYTEORDER = SDL_LIL_ENDIAN; -{$EXTERNALSYM SDL_BYTEORDER} - // Native audio byte ordering - AUDIO_U16SYS = AUDIO_U16LSB; -{$EXTERNALSYM AUDIO_U16SYS} - AUDIO_S16SYS = AUDIO_S16LSB; -{$EXTERNALSYM AUDIO_S16SYS} - -{$ELSE} - - SDL_BYTEORDER = SDL_BIG_ENDIAN; -{$EXTERNALSYM SDL_BYTEORDER} - // Native audio byte ordering - AUDIO_U16SYS = AUDIO_U16MSB; -{$EXTERNALSYM AUDIO_U16SYS} - AUDIO_S16SYS = AUDIO_S16MSB; -{$EXTERNALSYM AUDIO_S16SYS} - -{$ENDIF} - - - SDL_MIX_MAXVOLUME = 128; -{$EXTERNALSYM SDL_MIX_MAXVOLUME} - - // SDL_joystick.h constants - MAX_JOYSTICKS = 2; // only 2 are supported in the multimedia API -{$EXTERNALSYM MAX_JOYSTICKS} - MAX_AXES = 6; // each joystick can have up to 6 axes -{$EXTERNALSYM MAX_AXES} - MAX_BUTTONS = 32; // and 32 buttons -{$EXTERNALSYM MAX_BUTTONS} - AXIS_MIN = -32768; // minimum value for axis coordinate -{$EXTERNALSYM AXIS_MIN} - AXIS_MAX = 32767; // maximum value for axis coordinate -{$EXTERNALSYM AXIS_MAX} - JOY_AXIS_THRESHOLD = (((AXIS_MAX) - (AXIS_MIN)) / 100); // 1% motion -{$EXTERNALSYM JOY_AXIS_THRESHOLD} - //JOY_BUTTON_FLAG(n) (1< } - - { Function prototype for the new timer callback function. - The callback function is passed the current timer interval and returns - the next timer interval. If the returned value is the same as the one - passed in, the periodic alarm continues, otherwise a new alarm is - scheduled. If the callback returns 0, the periodic alarm is cancelled. } - {$IFNDEF __GPC__} - TSDL_NewTimerCallback = function( interval: UInt32; param: Pointer ): UInt32; cdecl; - {$ELSE} - TSDL_NewTimerCallback = function( interval: UInt32; param: Pointer ): UInt32; - {$ENDIF} - - // Definition of the timer ID type - PSDL_TimerID = ^TSDL_TimerID; - TSDL_TimerID = record - interval: UInt32; - callback: TSDL_NewTimerCallback; - param: Pointer; - last_alarm: UInt32; - next: PSDL_TimerID; - end; - - {$IFNDEF __GPC__} - TSDL_AudioSpecCallback = procedure( userdata: Pointer; stream: PUInt8; len: Integer ); cdecl; - {$ELSE} - TSDL_AudioSpecCallback = procedure( userdata: Pointer; stream: PUInt8; len: Integer ); - {$ENDIF} - - // SDL_audio.h types - // The calculated values in this structure are calculated by SDL_OpenAudio() - PSDL_AudioSpec = ^TSDL_AudioSpec; - TSDL_AudioSpec = record - freq: Integer; // DSP frequency -- samples per second - format: UInt16; // Audio data format - channels: UInt8; // Number of channels: 1 mono, 2 stereo - silence: UInt8; // Audio buffer silence value (calculated) - samples: UInt16; // Audio buffer size in samples - padding: UInt16; // Necessary for some compile environments - size: UInt32; // Audio buffer size in bytes (calculated) - { This function is called when the audio device needs more data. - 'stream' is a pointer to the audio data buffer - 'len' is the length of that buffer in bytes. - Once the callback returns, the buffer will no longer be valid. - Stereo samples are stored in a LRLRLR ordering.} - callback: TSDL_AudioSpecCallback; - userdata: Pointer; - end; - - // A structure to hold a set of audio conversion filters and buffers - PSDL_AudioCVT = ^TSDL_AudioCVT; - - PSDL_AudioCVTFilter = ^TSDL_AudioCVTFilter; - TSDL_AudioCVTFilter = record - cvt: PSDL_AudioCVT; - format: UInt16; - end; - - PSDL_AudioCVTFilterArray = ^TSDL_AudioCVTFilterArray; - TSDL_AudioCVTFilterArray = array[0..9] of PSDL_AudioCVTFilter; - - TSDL_AudioCVT = record - needed: Integer; // Set to 1 if conversion possible - src_format: UInt16; // Source audio format - dst_format: UInt16; // Target audio format - rate_incr: double; // Rate conversion increment - buf: PUInt8; // Buffer to hold entire audio data - len: Integer; // Length of original audio buffer - len_cvt: Integer; // Length of converted audio buffer - len_mult: Integer; // buffer must be len*len_mult big - len_ratio: double; // Given len, final size is len*len_ratio - filters: TSDL_AudioCVTFilterArray; - filter_index: Integer; // Current audio conversion function - end; - - TSDL_Audiostatus = ( - SDL_AUDIO_STOPPED, - SDL_AUDIO_PLAYING, - SDL_AUDIO_PAUSED - ); - - // SDL_cdrom.h types - TSDL_CDStatus = ( - CD_ERROR, - CD_TRAYEMPTY, - CD_STOPPED, - CD_PLAYING, - CD_PAUSED ); - - PSDL_CDTrack = ^TSDL_CDTrack; - TSDL_CDTrack = record - id: UInt8; // Track number - type_: UInt8; // Data or audio track - unused: UInt16; - length: UInt32; // Length, in frames, of this track - offset: UInt32; // Offset, in frames, from start of disk - end; - - // This structure is only current as of the last call to SDL_CDStatus() - PSDL_CD = ^TSDL_CD; - TSDL_CD = record - id: Integer; // Private drive identifier - status: TSDL_CDStatus; // Current drive status - - // The rest of this structure is only valid if there's a CD in drive - numtracks: Integer; // Number of tracks on disk - cur_track: Integer; // Current track position - cur_frame: Integer; // Current frame offset within current track - track: array[0..SDL_MAX_TRACKS] of TSDL_CDTrack; - end; - - //SDL_joystick.h types - PTransAxis = ^TTransAxis; - TTransAxis = record - offset: Integer; - scale: single; - end; - - // The private structure used to keep track of a joystick - PJoystick_hwdata = ^TJoystick_hwdata; - TJoystick_hwdata = record - // joystick ID - id: Integer; - // values used to translate device-specific coordinates into SDL-standard ranges - transaxis: array[0..5] of TTransAxis; - end; - - PBallDelta = ^TBallDelta; - TBallDelta = record - dx: Integer; - dy: Integer; - end; // Current ball motion deltas - - // The SDL joystick structure - PSDL_Joystick = ^TSDL_Joystick; - TSDL_Joystick = record - index: UInt8; // Device index - name: PChar; // Joystick name - system dependent - - naxes: Integer; // Number of axis controls on the joystick - axes: PUInt16; // Current axis states - - nhats: Integer; // Number of hats on the joystick - hats: PUInt8; // Current hat states - - nballs: Integer; // Number of trackballs on the joystick - balls: PBallDelta; // Current ball motion deltas - - nbuttons: Integer; // Number of buttons on the joystick - buttons: PUInt8; // Current button states - - hwdata: PJoystick_hwdata; // Driver dependent information - - ref_count: Integer; // Reference count for multiple opens - end; - - // SDL_verion.h types - PSDL_version = ^TSDL_version; - TSDL_version = record - major: UInt8; - minor: UInt8; - patch: UInt8; - end; - - // SDL_keyboard.h types - TSDLKey = LongWord; - - TSDLMod = LongWord; - - PSDL_KeySym = ^TSDL_KeySym; - TSDL_KeySym = record - scancode: UInt8; // hardware specific scancode - sym: TSDLKey; // SDL virtual keysym - modifier: TSDLMod; // current key modifiers - unicode: UInt16; // translated character - end; - - // SDL_events.h types - {Checks the event queue for messages and optionally returns them. - If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to - the back of the event queue. - If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front - of the event queue, matching 'mask', will be returned and will not - be removed from the queue. - If 'action' is SDL_GETEVENT, up to 'numevents' events at the front - of the event queue, matching 'mask', will be returned and will be - removed from the queue. - This function returns the number of events actually stored, or -1 - if there was an error. This function is thread-safe. } - - TSDL_EventAction = (SDL_ADDEVENT, SDL_PEEKEVENT, SDL_GETEVENT); - - // Application visibility event structure - TSDL_ActiveEvent = record - type_: UInt8; // SDL_ACTIVEEVENT - gain: UInt8; // Whether given states were gained or lost (1/0) - state: UInt8; // A mask of the focus states - end; - - // Keyboard event structure - TSDL_KeyboardEvent = record - type_: UInt8; // SDL_KEYDOWN or SDL_KEYUP - which: UInt8; // The keyboard device index - state: UInt8; // SDL_PRESSED or SDL_RELEASED - keysym: TSDL_KeySym; - end; - - // Mouse motion event structure - TSDL_MouseMotionEvent = record - type_: UInt8; // SDL_MOUSEMOTION - which: UInt8; // The mouse device index - state: UInt8; // The current button state - x, y: UInt16; // The X/Y coordinates of the mouse - xrel: SInt16; // The relative motion in the X direction - yrel: SInt16; // The relative motion in the Y direction - end; - - // Mouse button event structure - TSDL_MouseButtonEvent = record - type_: UInt8; // SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP - which: UInt8; // The mouse device index - button: UInt8; // The mouse button index - state: UInt8; // SDL_PRESSED or SDL_RELEASED - x: UInt16; // The X coordinates of the mouse at press time - y: UInt16; // The Y coordinates of the mouse at press time - end; - - // Joystick axis motion event structure - TSDL_JoyAxisEvent = record - type_: UInt8; // SDL_JOYAXISMOTION - which: UInt8; // The joystick device index - axis: UInt8; // The joystick axis index - value: SInt16; // The axis value (range: -32768 to 32767) - end; - - // Joystick trackball motion event structure - TSDL_JoyBallEvent = record - type_: UInt8; // SDL_JOYAVBALLMOTION - which: UInt8; // The joystick device index - ball: UInt8; // The joystick trackball index - xrel: SInt16; // The relative motion in the X direction - yrel: SInt16; // The relative motion in the Y direction - end; - - // Joystick hat position change event structure - TSDL_JoyHatEvent = record - type_: UInt8; // SDL_JOYHATMOTION */ - which: UInt8; // The joystick device index */ - hat: UInt8; // The joystick hat index */ - value: UInt8; { The hat position value: - 8 1 2 - 7 0 3 - 6 5 4 - - Note that zero means the POV is centered. } - - end; - - // Joystick button event structure - TSDL_JoyButtonEvent = record - type_: UInt8; // SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP - which: UInt8; // The joystick device index - button: UInt8; // The joystick button index - state: UInt8; // SDL_PRESSED or SDL_RELEASED - end; - - { The "window resized" event - When you get this event, you are responsible for setting a new video - mode with the new width and height. } - TSDL_ResizeEvent = record - type_: UInt8; // SDL_VIDEORESIZE - w: Integer; // New width - h: Integer; // New height - end; - - // The "quit requested" event - PSDL_QuitEvent = ^TSDL_QuitEvent; - TSDL_QuitEvent = record - type_: UInt8; - end; - - // A user-defined event type - PSDL_UserEvent = ^TSDL_UserEvent; - TSDL_UserEvent = record - type_: UInt8; // SDL_USEREVENT through SDL_NUMEVENTS-1 - code: Integer; // User defined event code */ - data1: Pointer; // User defined data pointer */ - data2: Pointer; // User defined data pointer */ - end; - - // The "screen redraw" event - PSDL_ExposeEvent = ^TSDL_ExposeEvent; - TSDL_ExposeEvent = record - type_ : Uint8; // SDL_VIDEOEXPOSE - end; - - {$IFDEF Unix} - //These are the various supported subsystems under UNIX - TSDL_SysWm = ( SDL_SYSWM_X11 ) ; - {$ENDIF} - -// The windows custom event structure -{$IFDEF Win32} - PSDL_SysWMmsg = ^TSDL_SysWMmsg; - TSDL_SysWMmsg = record - version: TSDL_version; - h_wnd: HWND; // The window for the message - msg: UInt; // The type of message - w_Param: WPARAM; // WORD message parameter - lParam: LPARAM; // LONG message parameter - end; -{$ELSE} - -{$IFDEF Unix} -{ The Linux custom event structure } - PSDL_SysWMmsg = ^TSDL_SysWMmsg; - TSDL_SysWMmsg = record - version : TSDL_version; - subsystem : TSDL_SysWm; - {$IFDEF FPC} - event : TXEvent; - {$ELSE} - event : XEvent; - {$ENDIF} - end; -{$ELSE} -{ The generic custom event structure } - PSDL_SysWMmsg = ^TSDL_SysWMmsg; - TSDL_SysWMmsg = record - version: TSDL_version; - data: Integer; - end; -{$ENDIF} - -{$ENDIF} - -// The Windows custom window manager information structure -{$IFDEF Win32} - PSDL_SysWMinfo = ^TSDL_SysWMinfo; - TSDL_SysWMinfo = record - version : TSDL_version; - window : HWnd; // The display window - end; -{$ELSE} - -// The Linux custom window manager information structure -{$IFDEF Unix} - TX11 = record - display : PDisplay; // The X11 display - window : TWindow ; // The X11 display window */ - {* These locking functions should be called around - any X11 functions using the display variable. - They lock the event thread, so should not be - called around event functions or from event filters. - *} - lock_func : Pointer; - unlock_func : Pointer; - - // Introduced in SDL 1.0.2 - fswindow : TWindow ; // The X11 fullscreen window */ - wmwindow : TWindow ; // The X11 managed input window */ - end; - - PSDL_SysWMinfo = ^TSDL_SysWMinfo; - TSDL_SysWMinfo = record - version : TSDL_version ; - subsystem : TSDL_SysWm; - X11 : TX11; - end; -{$ELSE} - // The generic custom window manager information structure - PSDL_SysWMinfo = ^TSDL_SysWMinfo; - TSDL_SysWMinfo = record - version : TSDL_version ; - data : integer; - end; -{$ENDIF} - -{$ENDIF} - - PSDL_SysWMEvent = ^TSDL_SysWMEvent; - TSDL_SysWMEvent = record - type_: UInt8; - msg: PSDL_SysWMmsg; - end; - - PSDL_Event = ^TSDL_Event; - TSDL_Event = record - case UInt8 of - SDL_NOEVENT: (type_: byte); - SDL_ACTIVEEVENT: (active: TSDL_ActiveEvent); - SDL_KEYDOWN, SDL_KEYUP: (key: TSDL_KeyboardEvent); - SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent); - SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP: (button: TSDL_MouseButtonEvent ); - SDL_JOYAXISMOTION: (jaxis: TSDL_JoyAxisEvent ); - SDL_JOYBALLMOTION: (jball: TSDL_JoyBallEvent ); - SDL_JOYHATMOTION: (jhat: TSDL_JoyHatEvent ); - SDL_JOYBUTTONDOWN, SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent ); - SDL_VIDEORESIZE: (resize: TSDL_ResizeEvent ); - SDL_QUITEV: (quit: TSDL_QuitEvent ); - SDL_USEREVENT : ( user : TSDL_UserEvent ); - SDL_SYSWMEVENT: (syswm: TSDL_SysWMEvent ); - end; - - -{ This function sets up a filter to process all events before they - change internal state and are posted to the internal event queue. - - The filter is protypted as: } - {$IFNDEF __GPC__} - TSDL_EventFilter = function( event : PSDL_Event ): Integer; cdecl; - {$ELSE} - TSDL_EventFilter = function( event : PSDL_Event ): Integer; - {$ENDIF} - - // SDL_video.h types - // Useful data types - PPSDL_Rect = ^PSDL_Rect; - PSDL_Rect = ^TSDL_Rect; - TSDL_Rect = record - x, y: SInt16; - w, h: UInt16; - end; - - SDL_Rect = TSDL_Rect; -{$EXTERNALSYM SDL_Rect} - - PSDL_Color = ^TSDL_Color; - TSDL_Color = record - r: UInt8; - g: UInt8; - b: UInt8; - unused: UInt8; - end; - - PSDL_ColorArray = ^TSDL_ColorArray; - TSDL_ColorArray = array[0..65000] of TSDL_Color; - - PSDL_Palette = ^TSDL_Palette; - TSDL_Palette = record - ncolors: Integer; - colors: PSDL_ColorArray; - end; - - // Everything in the pixel format structure is read-only - PSDL_PixelFormat = ^TSDL_PixelFormat; - TSDL_PixelFormat = record - palette: PSDL_Palette; - BitsPerPixel: UInt8; - BytesPerPixel: UInt8; - Rloss: UInt8; - Gloss: UInt8; - Bloss: UInt8; - Aloss: UInt8; - Rshift: UInt8; - Gshift: UInt8; - Bshift: UInt8; - Ashift: UInt8; - RMask: UInt32; - GMask: UInt32; - BMask: UInt32; - AMask: UInt32; - colorkey: UInt32; // RGB color key information - alpha: UInt8; // Alpha value information (per-surface alpha) - end; - -{$IFDEF WIN32} - {PPrivate_hwdata = ^TPrivate_hwdata; - TPrivate_hwdata = record - dd_surface : IDIRECTDRAWSURFACE3; - dd_writebuf : IDIRECTDRAWSURFACE3; - end;} - {ELSE} -{$ENDIF} - - // The structure passed to the low level blit functions - PSDL_BlitInfo = ^TSDL_BlitInfo; - TSDL_BlitInfo = record - s_pixels: PUInt8; - s_width: Integer; - s_height: Integer; - s_skip: Integer; - d_pixels: PUInt8; - d_width: Integer; - d_height: Integer; - d_skip: Integer; - aux_data: Pointer; - src: PSDL_PixelFormat; - table: PUInt8; - dst: PSDL_PixelFormat; - end; - - // typedef for private surface blitting functions - PSDL_Surface = ^TSDL_Surface; - - {$IFNDEF __GPC__} - TSDL_Blit = function( src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect ): Integer; cdecl; - {$ELSE} - TSDL_Blit = function( src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect ): Integer; - {$ENDIF} - - // The type definition for the low level blit functions - //TSDL_LoBlit = procedure( info : PSDL_BlitInfo ); cdecl; - - // This is the private info structure for software accelerated blits - {PPrivate_swaccel = ^TPrivate_swaccel; - TPrivate_swaccel = record - blit : TSDL_LoBlit; - aux_data : Pointer; - end;} - - // Blit mapping definition - {PSDL_BlitMap = ^TSDL_BlitMap; - TSDL_BlitMap = record - dst : PSDL_Surface; - identity : Integer; - table : PUInt8; - hw_blit : TSDL_Blit; - sw_blit : TSDL_Blit; - hw_data : PPrivate_hwaccel; - sw_data : PPrivate_swaccel; - - // the version count matches the destination; mismatch indicates an invalid mapping - format_version : Cardinal; - end;} - - TSDL_Surface = record - flags: UInt32; // Read-only - format: PSDL_PixelFormat; // Read-only - w, h: Integer; // Read-only - pitch: UInt16; // Read-only - pixels: Pointer; // Read-write - offset: Integer; // Private - hwdata: Pointer; //TPrivate_hwdata; Hardware-specific surface info - - // clipping information: - clip_rect: TSDL_Rect; // Read-only - unused1: UInt32; // for binary compatibility - // Allow recursive locks - locked: UInt32; // Private - // info for fast blit mapping to other surfaces - Blitmap: Pointer; // PSDL_BlitMap; // Private - // format version, bumped at every change to invalidate blit maps - format_version: Cardinal; // Private - refcount: Integer; - end; - - // Useful for determining the video hardware capabilities - PSDL_VideoInfo = ^TSDL_VideoInfo; - TSDL_VideoInfo = record - hw_available: UInt8; // Hardware and WindowManager flags in first 2 bits ( see below ) - {hw_available: 1; // Can you create hardware surfaces - wm_available: 1; // Can you talk to a window manager? - UnusedBits1: 6;} - blit_hw: UInt8; // Blit Hardware flags. See below for which bits do what - {UnusedBits2: 1; - blit_hw: 1; // Flag:UInt32 Accelerated blits HW --> HW - blit_hw_CC: 1; // Flag:UInt32 Accelerated blits with Colorkey - blit_hw_A: 1; // Flag:UInt32 Accelerated blits with Alpha - blit_sw: 1; // Flag:UInt32 Accelerated blits SW --> HW - blit_sw_CC: 1; // Flag:UInt32 Accelerated blits with Colorkey - blit_sw_A: 1; // Flag:UInt32 Accelerated blits with Alpha - blit_fill: 1; // Flag:UInt32 Accelerated color fill} - UnusedBits3: UInt8; // Unused at this point - video_mem: UInt32; // The total amount of video memory (in K) - vfmt: PSDL_PixelFormat; // Value: The format of the video surface - end; - - // The YUV hardware video overlay - PSDL_Overlay = ^TSDL_Overlay; - TSDL_Overlay = record - format: UInt32; // Overlay format - w, h: Integer; // Width and height of overlay - planes: Integer; // Number of planes in the overlay. Usually either 1 or 3 - pitches: PUInt16; - // An array of pitches, one for each plane. Pitch is the length of a row in bytes. - pixels: PUInt8; - // An array of pointers to teh data of each plane. The overlay should be locked before these pointers are used. - hw_overlay: UInt32; - // This will be set to 1 if the overlay is hardware accelerated. - end; - - // Public enumeration for setting the OpenGL window attributes. - TSDL_GLAttr = ( - SDL_GL_RED_SIZE, - SDL_GL_GREEN_SIZE, - SDL_GL_BLUE_SIZE, - SDL_GL_ALPHA_SIZE, - SDL_GL_BUFFER_SIZE, - SDL_GL_DOUBLEBUFFER, - SDL_GL_DEPTH_SIZE, - SDL_GL_STENCIL_SIZE, - SDL_GL_ACCUM_RED_SIZE, - SDL_GL_ACCUM_GREEN_SIZE, - SDL_GL_ACCUM_BLUE_SIZE, - SDL_GL_ACCUM_ALPHA_SIZE, - SDL_GL_STEREO, - SDL_GL_MULTISAMPLEBUFFERS, - SDL_GL_MULTISAMPLESAMPLES); - - - - PSDL_Cursor = ^TSDL_Cursor; - TSDL_Cursor = record - area: TSDL_Rect; // The area of the mouse cursor - hot_x, hot_y: SInt16; // The "tip" of the cursor - data: PUInt8; // B/W cursor data - mask: PUInt8; // B/W cursor mask - save: array[1..2] of PUInt8; // Place to save cursor area - wm_cursor: Pointer; // Window-manager cursor - end; - -// SDL_mutex.h types - -{$IFDEF WIN32} - PSDL_Mutex = ^TSDL_Mutex; - TSDL_Mutex = record - id: THANDLE; - end; -{$ENDIF} - -{$IFDEF Unix} - PSDL_Mutex = ^TSDL_Mutex; - TSDL_mutex = record - id: pthread_mutex_t; -{$IFDEF PTHREAD_NO_RECURSIVE_MUTEX} - recursive: Integer; - owner: pthread_t; -{$ENDIF} - end; -{$ENDIF} - -{$IFDEF __MACH__} - {$define USE_NAMED_SEMAPHORES} - // Broken sem_getvalue() in MacOS X Public Beta */ - {$define BROKEN_SEMGETVALUE} -{$ENDIF} - -PSDL_semaphore = ^TSDL_semaphore; -{$IFDEF WIN32} - // Win32 or Machintosh - TSDL_semaphore = record - id: THANDLE; - count: UInt32; - end; -{$ELSE} - {$IFDEF FPC} - // This should be semaphore.h - __sem_lock_t = {packed} record { Not in header file - anonymous } - status: Longint; - spinlock: Integer; - end; - - sem_t = {packed} record - __sem_lock: __sem_lock_t; - __sem_value: Integer; - __sem_waiting: longint ; {_pthread_queue;} - end; - {$ENDIF} - - TSDL_semaphore = record - sem: Pointer; //PSem_t; - {$IFNDEF USE_NAMED_SEMAPHORES} - sem_data: Sem_t; - {$ENDIF} - - {$IFDEF BROKEN_SEMGETVALUE} - { This is a little hack for MacOS X - - It's not thread-safe, but it's better than nothing } - sem_value: Integer; - {$ENDIF} - end; -{$ENDIF} - - PSDL_Sem = ^TSDL_Sem; - TSDL_Sem = TSDL_Semaphore; - - PSDL_Cond = ^TSDL_Cond; - TSDL_Cond = record -{$IFDEF Unix} - cond: pthread_cond_t; -{$ELSE} - // Generic Cond structure - lock: PSDL_mutex; - waiting: Integer; - signals: Integer; - wait_sem: PSDL_Sem; - wait_done: PSDL_Sem; -{$ENDIF} - end; - - // SDL_thread.h types -{$IFDEF WIN32} - TSYS_ThreadHandle = THandle; -{$ENDIF} - -{$IFDEF Unix} - TSYS_ThreadHandle = pthread_t; -{$ENDIF} - - { This is the system-independent thread info structure } - PSDL_Thread = ^TSDL_Thread; - TSDL_Thread = record - threadid: UInt32; - handle: TSYS_ThreadHandle; - status: Integer; - errbuf: TSDL_Error; - data: Pointer; - end; - - // Helper Types - - // Keyboard State Array ( See demos for how to use ) - PKeyStateArr = ^TKeyStateArr; - TKeyStateArr = array[0..65000] of UInt8; - - // Types required so we don't need to use Windows.pas - PInteger = ^Integer; - PByte = ^Byte; - PWord = ^Word; - PLongWord = ^Longword; - - // General arrays - PByteArray = ^TByteArray; - TByteArray = array[0..32767] of Byte; - - PWordArray = ^TWordArray; - TWordArray = array[0..16383] of Word; - - PPoint = ^TPoint; - TPoint = record - x: Longint; - y: Longint; - end; - - PRect = ^TRect; - TRect = record - case Integer of - 0: (Left, Top, Right, Bottom: Integer); - 1: (TopLeft, BottomRight: TPoint); - end; - - { Generic procedure pointer } - TProcedure = procedure; - -{------------------------------------------------------------------------------} -{ initialization } -{------------------------------------------------------------------------------} - -{ This function loads the SDL dynamically linked library and initializes - the subsystems specified by 'flags' (and those satisfying dependencies) - Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup - signal handlers for some commonly ignored fatal signals (like SIGSEGV) } - -function SDL_Init( flags : UInt32 ) : Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_Init'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_Init} - -// This function initializes specific SDL subsystems -function SDL_InitSubSystem( flags : UInt32 ) : Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_InitSubSystem'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_InitSubSystem} - -// This function cleans up specific SDL subsystems -procedure SDL_QuitSubSystem( flags : UInt32 ); -cdecl; external {$IFDEF __GPC__}name 'SDL_QuitSubSystem'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_QuitSubSystem} - -{ This function returns mask of the specified subsystems which have - been initialized. - If 'flags' is 0, it returns a mask of all initialized subsystems. } - -function SDL_WasInit( flags : UInt32 ): UInt32; -cdecl; external {$IFDEF __GPC__}name 'SDL_WasInit'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_WasInit} - -{ This function cleans up all initialized subsystems and unloads the - dynamically linked library. You should call it upon all exit conditions. } -procedure SDL_Quit; -cdecl; external {$IFDEF __GPC__}name 'SDL_Quit'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_Quit} - -{$IFDEF WIN32} -// This should be called from your WinMain() function, if any -function SDL_RegisterApp(name: PChar; style: UInt32; h_Inst: Pointer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_RegisterApp'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_RegisterApp} -{$ENDIF} - -{$IFDEF __MACH__} -// This should be called from your main() function, if any -procedure SDL_InitQuickDraw( the_qd: QDGlobals ); -cdecl; external {$IFDEF __GPC__}name 'SDL_InitQuickDraw'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_InitQuickDraw} -{$ENDIF} - - -{------------------------------------------------------------------------------} -{ types } -{------------------------------------------------------------------------------} -// The number of elements in a table -function SDL_TableSize( table: PChar ): Integer; -{$EXTERNALSYM SDL_TABLESIZE} - - -{------------------------------------------------------------------------------} -{ error-handling } -{------------------------------------------------------------------------------} -// Public functions -function SDL_GetError: PChar; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetError'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GetError} -procedure SDL_SetError(fmt: PChar); -cdecl; external {$IFDEF __GPC__}name 'SDL_SetError'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_SetError} -procedure SDL_ClearError; -cdecl; external {$IFDEF __GPC__}name 'SDL_ClearError'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_ClearError} - -{$IFNDEF WIN32} -procedure SDL_Error(Code: TSDL_errorcode); -cdecl; external {$IFDEF __GPC__}name 'SDL_Error'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_Error} -{$ENDIF} - -// Private error message function - used internally -procedure SDL_OutOfMemory; - -{------------------------------------------------------------------------------} -{ io handling } -{------------------------------------------------------------------------------} -// Functions to create SDL_RWops structures from various data sources - -function SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; -cdecl; external {$IFDEF __GPC__}name 'SDL_RWFromFile'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_RWFromFile} -procedure SDL_FreeRW(area: PSDL_RWops); -cdecl; external {$IFDEF __GPC__}name 'SDL_FreeRW'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_FreeRW} - -//fp is FILE *fp ??? -function SDL_RWFromFP(fp: Pointer; autoclose: Integer): PSDL_RWops; -cdecl; external {$IFDEF __GPC__}name 'SDL_RWFromFP'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_RWFromFP} -function SDL_RWFromMem(mem: Pointer; size: Integer): PSDL_RWops; -cdecl; external {$IFDEF __GPC__}name 'SDL_RWFromMem'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_RWFromMem} -function SDL_RWFromConstMem(const mem: Pointer; size: Integer) : PSDL_RWops; -cdecl; external {$IFDEF __GPC__}name 'SDL_RWFromConstMem'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_RWFromConstMem} -function SDL_AllocRW: PSDL_RWops; -cdecl; external {$IFDEF __GPC__}name 'SDL_AllocRW'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_AllocRW} - -function SDL_RWSeek(context: PSDL_RWops; offset: Integer; whence: Integer) : Integer; -{$EXTERNALSYM SDL_RWSeek} -function SDL_RWTell(context: PSDL_RWops): Integer; -{$EXTERNALSYM SDL_RWTell} -function SDL_RWRead(context: PSDL_RWops; ptr: Pointer; size: Integer; n : Integer): Integer; -{$EXTERNALSYM SDL_RWRead} -function SDL_RWWrite(context: PSDL_RWops; ptr: Pointer; size: Integer; n : Integer): Integer; -{$EXTERNALSYM SDL_RWWrite} -function SDL_RWClose(context: PSDL_RWops): Integer; -{$EXTERNALSYM SDL_RWClose} - -{------------------------------------------------------------------------------} -{ time-handling } -{------------------------------------------------------------------------------} - -{ Get the number of milliseconds since the SDL library initialization. } -{ Note that this value wraps if the program runs for more than ~49 days. } -function SDL_GetTicks: UInt32; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetTicks'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GetTicks} - -// Wait a specified number of milliseconds before returning -procedure SDL_Delay(msec: UInt32); -cdecl; external {$IFDEF __GPC__}name 'SDL_Delay'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_Delay} - -{ Add a new timer to the pool of timers already running. } -{ Returns a timer ID, or NULL when an error occurs. } -function SDL_AddTimer(interval: UInt32; callback: TSDL_NewTimerCallback; param : Pointer): PSDL_TimerID; -cdecl; external {$IFDEF __GPC__}name 'SDL_AddTimer'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_AddTimer} - -{ Remove one of the multiple timers knowing its ID. } -{ Returns a boolean value indicating success. } -function SDL_RemoveTimer(t: PSDL_TimerID): TSDL_Bool; -cdecl; external {$IFDEF __GPC__}name 'SDL_RemoveTimer'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_RemoveTimer} - -function SDL_SetTimer(interval: UInt32; callback: TSDL_TimerCallback): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SetTimer'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_SetTimer} - -{------------------------------------------------------------------------------} -{ audio-routines } -{------------------------------------------------------------------------------} - -{ These functions are used internally, and should not be used unless you - have a specific need to specify the audio driver you want to use. - You should normally use SDL_Init() or SDL_InitSubSystem(). } - -function SDL_AudioInit(driver_name: PChar): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_AudioInit'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_AudioInit} -procedure SDL_AudioQuit; -cdecl; external {$IFDEF __GPC__}name 'SDL_AudioQuit'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_AudioQuit} - -{ This function fills the given character buffer with the name of the - current audio driver, and returns a Pointer to it if the audio driver has - been initialized. It returns NULL if no driver has been initialized. } - -function SDL_AudioDriverName(namebuf: PChar; maxlen: Integer): PChar; -cdecl; external {$IFDEF __GPC__}name 'SDL_AudioDriverName'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_AudioDriverName} - -{ This function opens the audio device with the desired parameters, and - returns 0 if successful, placing the actual hardware parameters in the - structure pointed to by 'obtained'. If 'obtained' is NULL, the audio - data passed to the callback function will be guaranteed to be in the - requested format, and will be automatically converted to the hardware - audio format if necessary. This function returns -1 if it failed - to open the audio device, or couldn't set up the audio thread. - - When filling in the desired audio spec structure, - 'desired->freq' should be the desired audio frequency in samples-per-second. - 'desired->format' should be the desired audio format. - 'desired->samples' is the desired size of the audio buffer, in samples. - This number should be a power of two, and may be adjusted by the audio - driver to a value more suitable for the hardware. Good values seem to - range between 512 and 8096 inclusive, depending on the application and - CPU speed. Smaller values yield faster response time, but can lead - to underflow if the application is doing heavy processing and cannot - fill the audio buffer in time. A stereo sample consists of both right - and left channels in LR ordering. - Note that the number of samples is directly related to time by the - following formula: ms = (samples*1000)/freq - 'desired->size' is the size in bytes of the audio buffer, and is - calculated by SDL_OpenAudio(). - 'desired->silence' is the value used to set the buffer to silence, - and is calculated by SDL_OpenAudio(). - 'desired->callback' should be set to a function that will be called - when the audio device is ready for more data. It is passed a pointer - to the audio buffer, and the length in bytes of the audio buffer. - This function usually runs in a separate thread, and so you should - protect data structures that it accesses by calling SDL_LockAudio() - and SDL_UnlockAudio() in your code. - 'desired->userdata' is passed as the first parameter to your callback - function. - - The audio device starts out playing silence when it's opened, and should - be enabled for playing by calling SDL_PauseAudio(0) when you are ready - for your audio callback function to be called. Since the audio driver - may modify the requested size of the audio buffer, you should allocate - any local mixing buffers after you open the audio device. } - -function SDL_OpenAudio(desired, obtained: PSDL_AudioSpec): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_OpenAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_OpenAudio} - -{ Get the current audio state: } -function SDL_GetAudioStatus: TSDL_Audiostatus; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetAudioStatus'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GetAudioStatus} - -{ This function pauses and unpauses the audio callback processing. - It should be called with a parameter of 0 after opening the audio - device to start playing sound. This is so you can safely initialize - data for your callback function after opening the audio device. - Silence will be written to the audio device during the pause. } - -procedure SDL_PauseAudio(pause_on: Integer); -cdecl; external {$IFDEF __GPC__}name 'SDL_PauseAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_PauseAudio} - -{ This function loads a WAVE from the data source, automatically freeing - that source if 'freesrc' is non-zero. For example, to load a WAVE file, - you could do: - SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); - - If this function succeeds, it returns the given SDL_AudioSpec, - filled with the audio data format of the wave data, and sets - 'audio_buf' to a malloc()'d buffer containing the audio data, - and sets 'audio_len' to the length of that audio buffer, in bytes. - You need to free the audio buffer with SDL_FreeWAV() when you are - done with it. - - This function returns NULL and sets the SDL error message if the - wave file cannot be opened, uses an unknown data format, or is - corrupt. Currently raw and MS-ADPCM WAVE files are supported. } - -function SDL_LoadWAV_RW(src: PSDL_RWops; freesrc: Integer; spec: - PSDL_AudioSpec; audio_buf: PUInt8; audiolen: PUInt32): PSDL_AudioSpec; -cdecl; external {$IFDEF __GPC__}name 'SDL_LoadWAV_RW'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_LoadWAV_RW} - -// Compatibility convenience function -- loads a WAV from a file -function SDL_LoadWAV(filename: PChar; spec: PSDL_AudioSpec; audio_buf: - PUInt8; audiolen: PUInt32): PSDL_AudioSpec; -{$EXTERNALSYM SDL_LoadWAV} - -{ This function frees data previously allocated with SDL_LoadWAV_RW() } - -procedure SDL_FreeWAV(audio_buf: PUInt8); -cdecl; external {$IFDEF __GPC__}name 'SDL_FreeWAV'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_FreeWAV} - -{ This function takes a source format and rate and a destination format - and rate, and initializes the 'cvt' structure with information needed - by SDL_ConvertAudio() to convert a buffer of audio data from one format - to the other. - This function returns 0, or -1 if there was an error. } -function SDL_BuildAudioCVT(cvt: PSDL_AudioCVT; src_format: UInt16; - src_channels: UInt8; src_rate: Integer; dst_format: UInt16; dst_channels: UInt8; - dst_rate: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_BuildAudioCVT'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_BuildAudioCVT} - -{ Once you have initialized the 'cvt' structure using SDL_BuildAudioCVT(), - created an audio buffer cvt->buf, and filled it with cvt->len bytes of - audio data in the source format, this function will convert it in-place - to the desired format. - The data conversion may expand the size of the audio data, so the buffer - cvt->buf should be allocated after the cvt structure is initialized by - SDL_BuildAudioCVT(), and should be cvt->len*cvt->len_mult bytes long. } -function SDL_ConvertAudio(cvt: PSDL_AudioCVT): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_ConvertAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_ConvertAudio} - -{ This takes two audio buffers of the playing audio format and mixes - them, performing addition, volume adjustment, and overflow clipping. - The volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME - for full audio volume. Note this does not change hardware volume. - This is provided for convenience -- you can mix your own audio data. } - -procedure SDL_MixAudio(dst, src: PUInt8; len: UInt32; volume: Integer); -cdecl; external {$IFDEF __GPC__}name 'SDL_MixAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_MixAudio} - -{ The lock manipulated by these functions protects the callback function. - During a LockAudio/UnlockAudio pair, you can be guaranteed that the - callback function is not running. Do not call these from the callback - function or you will cause deadlock. } -procedure SDL_LockAudio; -cdecl; external {$IFDEF __GPC__}name 'SDL_LockAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_LockAudio} -procedure SDL_UnlockAudio; -cdecl; external {$IFDEF __GPC__}name 'SDL_UnlockAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_UnlockAudio} - -{ This function shuts down audio processing and closes the audio device. } - -procedure SDL_CloseAudio; -cdecl; external {$IFDEF __GPC__}name 'SDL_CloseAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CloseAudio} - -{------------------------------------------------------------------------------} -{ CD-routines } -{------------------------------------------------------------------------------} - -{ Returns the number of CD-ROM drives on the system, or -1 if - SDL_Init() has not been called with the SDL_INIT_CDROM flag. } - -function SDL_CDNumDrives: Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_CDNumDrives'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CDNumDrives} - -{ Returns a human-readable, system-dependent identifier for the CD-ROM. - Example: - "/dev/cdrom" - "E:" - "/dev/disk/ide/1/master" } - -function SDL_CDName(drive: Integer): PChar; -cdecl; external {$IFDEF __GPC__}name 'SDL_CDName'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CDName} - -{ Opens a CD-ROM drive for access. It returns a drive handle on success, - or NULL if the drive was invalid or busy. This newly opened CD-ROM - becomes the default CD used when other CD functions are passed a NULL - CD-ROM handle. - Drives are numbered starting with 0. Drive 0 is the system default CD-ROM. } - -function SDL_CDOpen(drive: Integer): PSDL_CD; -cdecl; external {$IFDEF __GPC__}name 'SDL_CDOpen'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CDOpen} - -{ This function returns the current status of the given drive. - If the drive has a CD in it, the table of contents of the CD and current - play position of the CD will be stored in the SDL_CD structure. } - -function SDL_CDStatus(cdrom: PSDL_CD): TSDL_CDStatus; -cdecl; external {$IFDEF __GPC__}name 'SDL_CDStatus'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CDStatus} - -{ Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks' - tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play - until the end of the CD. This function will skip data tracks. - This function should only be called after calling SDL_CDStatus() to - get track information about the CD. - - For example: - // Play entire CD: - if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) then - SDL_CDPlayTracks(cdrom, 0, 0, 0, 0); - // Play last track: - if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) then - begin - SDL_CDPlayTracks(cdrom, cdrom->numtracks-1, 0, 0, 0); - end; - - // Play first and second track and 10 seconds of third track: - if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) - SDL_CDPlayTracks(cdrom, 0, 0, 2, 10); - - This function returns 0, or -1 if there was an error. } - -function SDL_CDPlayTracks(cdrom: PSDL_CD; start_track: Integer; start_frame: - Integer; ntracks: Integer; nframes: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_CDPlayTracks'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CDPlayTracks} - - -{ Play the given CD starting at 'start' frame for 'length' frames. - It returns 0, or -1 if there was an error. } - -function SDL_CDPlay(cdrom: PSDL_CD; start: Integer; length: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_CDPlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CDPlay} - -// Pause play -- returns 0, or -1 on error -function SDL_CDPause(cdrom: PSDL_CD): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_CDPause'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CDPause} - -// Resume play -- returns 0, or -1 on error -function SDL_CDResume(cdrom: PSDL_CD): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_CDResume'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CDResume} - -// Stop play -- returns 0, or -1 on error -function SDL_CDStop(cdrom: PSDL_CD): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_CDStop'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CDStop} - -// Eject CD-ROM -- returns 0, or -1 on error -function SDL_CDEject(cdrom: PSDL_CD): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_CDEject'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CDEject} - -// Closes the handle for the CD-ROM drive -procedure SDL_CDClose(cdrom: PSDL_CD); -cdecl; external {$IFDEF __GPC__}name 'SDL_CDClose'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CDClose} - -// Given a status, returns true if there's a disk in the drive -function SDL_CDInDrive( status : TSDL_CDStatus ) : LongBool; -{$EXTERNALSYM SDL_CDInDrive} - -// Conversion functions from frames to Minute/Second/Frames and vice versa -procedure FRAMES_TO_MSF(frames: Integer; var M: Integer; var S: Integer; var - F: Integer); -{$EXTERNALSYM FRAMES_TO_MSF} -function MSF_TO_FRAMES(M: Integer; S: Integer; F: Integer): Integer; -{$EXTERNALSYM MSF_TO_FRAMES} - -{------------------------------------------------------------------------------} -{ JoyStick-routines } -{------------------------------------------------------------------------------} - -{ Count the number of joysticks attached to the system } -function SDL_NumJoysticks: Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_NumJoysticks'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_NumJoysticks} - -{ Get the implementation dependent name of a joystick. - This can be called before any joysticks are opened. - If no name can be found, this function returns NULL. } -function SDL_JoystickName(index: Integer): PChar; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickName'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_JoystickName} - -{ Open a joystick for use - the index passed as an argument refers to - the N'th joystick on the system. This index is the value which will - identify this joystick in future joystick events. - - This function returns a joystick identifier, or NULL if an error occurred. } -function SDL_JoystickOpen(index: Integer): PSDL_Joystick; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickOpen'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_JoystickOpen} - -{ Returns 1 if the joystick has been opened, or 0 if it has not. } -function SDL_JoystickOpened(index: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickOpened'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_JoystickOpened} - -{ Get the device index of an opened joystick. } -function SDL_JoystickIndex(joystick: PSDL_Joystick): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickIndex'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_JoystickIndex} - -{ Get the number of general axis controls on a joystick } -function SDL_JoystickNumAxes(joystick: PSDL_Joystick): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickNumAxes'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_JoystickNumAxes} - -{ Get the number of trackballs on a joystick - Joystick trackballs have only relative motion events associated - with them and their state cannot be polled. } -function SDL_JoystickNumBalls(joystick: PSDL_Joystick): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickNumBalls'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_JoystickNumBalls} - - -{ Get the number of POV hats on a joystick } -function SDL_JoystickNumHats(joystick: PSDL_Joystick): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickNumHats'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_JoystickNumHats} - -{ Get the number of buttons on a joystick } -function SDL_JoystickNumButtons(joystick: PSDL_Joystick): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickNumButtons'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_JoystickNumButtons} - -{ Update the current state of the open joysticks. - This is called automatically by the event loop if any joystick - events are enabled. } - -procedure SDL_JoystickUpdate; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickUpdate'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_JoystickUpdate;} - -{ Enable/disable joystick event polling. - If joystick events are disabled, you must call SDL_JoystickUpdate() - yourself and check the state of the joystick when you want joystick - information. - The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE. } - -function SDL_JoystickEventState(state: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickEventState'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_JoystickEventState} - -{ Get the current state of an axis control on a joystick - The state is a value ranging from -32768 to 32767. - The axis indices start at index 0. } - -function SDL_JoystickGetAxis(joystick: PSDL_Joystick; axis: Integer) : SInt16; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickGetAxis'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_JoystickGetAxis} - -{ The hat indices start at index 0. } - -function SDL_JoystickGetHat(joystick: PSDL_Joystick; hat: Integer): UInt8; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickGetHat'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_JoystickGetHat} - -{ Get the ball axis change since the last poll - This returns 0, or -1 if you passed it invalid parameters. - The ball indices start at index 0. } - -function SDL_JoystickGetBall(joystick: PSDL_Joystick; ball: Integer; var dx: Integer; var dy: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickGetBall'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_JoystickGetBall} - -{ Get the current state of a button on a joystick - The button indices start at index 0. } -function SDL_JoystickGetButton( joystick: PSDL_Joystick; Button: Integer): UInt8; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickGetButton'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_JoystickGetButton} - -{ Close a joystick previously opened with SDL_JoystickOpen() } -procedure SDL_JoystickClose(joystick: PSDL_Joystick); -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickClose'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_JoystickClose} - -{------------------------------------------------------------------------------} -{ event-handling } -{------------------------------------------------------------------------------} - -{ Pumps the event loop, gathering events from the input devices. - This function updates the event queue and internal input device state. - This should only be run in the thread that sets the video mode. } - -procedure SDL_PumpEvents; -cdecl; external {$IFDEF __GPC__}name 'SDL_PumpEvents'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_PumpEvents;} - -{ Checks the event queue for messages and optionally returns them. - If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to - the back of the event queue. - If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front - of the event queue, matching 'mask', will be returned and will not - be removed from the queue. - If 'action' is SDL_GETEVENT, up to 'numevents' events at the front - of the event queue, matching 'mask', will be returned and will be - removed from the queue. - This function returns the number of events actually stored, or -1 - if there was an error. This function is thread-safe. } - -function SDL_PeepEvents(events: PSDL_Event; numevents: Integer; action: TSDL_eventaction; mask: UInt32): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_PeepEvents'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_PeepEvents} - -{ Polls for currently pending events, and returns 1 if there are any pending - events, or 0 if there are none available. If 'event' is not NULL, the next - event is removed from the queue and stored in that area. } - -function SDL_PollEvent(event: PSDL_Event): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_PollEvent'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_PollEvent} - -{ Waits indefinitely for the next available event, returning 1, or 0 if there - was an error while waiting for events. If 'event' is not NULL, the next - event is removed from the queue and stored in that area. } - -function SDL_WaitEvent(event: PSDL_Event): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_WaitEvent'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_WaitEvent} - -function SDL_PushEvent( event : PSDL_Event ) : Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_PushEvent'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_PushEvent} - -{ If the filter returns 1, then the event will be added to the internal queue. - If it returns 0, then the event will be dropped from the queue, but the - internal state will still be updated. This allows selective filtering of - dynamically arriving events. - - WARNING: Be very careful of what you do in the event filter function, as - it may run in a different thread! - - There is one caveat when dealing with the SDL_QUITEVENT event type. The - event filter is only called when the window manager desires to close the - application window. If the event filter returns 1, then the window will - be closed, otherwise the window will remain open if possible. - If the quit event is generated by an interrupt signal, it will bypass the - internal queue and be delivered to the application at the next event poll. } -procedure SDL_SetEventFilter( filter : TSDL_EventFilter ); -cdecl; external {$IFDEF __GPC__}name 'SDL_SetEventFilter'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_SetEventFilter} - -{ Return the current event filter - can be used to "chain" filters. - If there is no event filter set, this function returns NULL. } - -function SDL_GetEventFilter: TSDL_EventFilter; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetEventFilter'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GetEventFilter} - -{ This function allows you to set the state of processing certain events. - If 'state' is set to SDL_IGNORE, that event will be automatically dropped - from the event queue and will not event be filtered. - If 'state' is set to SDL_ENABLE, that event will be processed normally. - If 'state' is set to SDL_QUERY, SDL_EventState() will return the - current processing state of the specified event. } - -function SDL_EventState(type_: UInt8; state: Integer): UInt8; -cdecl; external {$IFDEF __GPC__}name 'SDL_EventState'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_EventState} - -{------------------------------------------------------------------------------} -{ Version Routines } -{------------------------------------------------------------------------------} - -{ This macro can be used to fill a version structure with the compile-time - version of the SDL library. } -procedure SDL_VERSION(var X: TSDL_Version); -{$EXTERNALSYM SDL_VERSION} - -{ This macro turns the version numbers into a numeric value: - (1,2,3) -> (1203) - This assumes that there will never be more than 100 patchlevels } - -function SDL_VERSIONNUM(X, Y, Z: Integer): Integer; -{$EXTERNALSYM SDL_VERSIONNUM} - -// This is the version number macro for the current SDL version -function SDL_COMPILEDVERSION: Integer; -{$EXTERNALSYM SDL_COMPILEDVERSION} - -// This macro will evaluate to true if compiled with SDL at least X.Y.Z -function SDL_VERSION_ATLEAST(X: Integer; Y: Integer; Z: Integer) : LongBool; -{$EXTERNALSYM SDL_VERSION_ATLEAST} - -{ This function gets the version of the dynamically linked SDL library. - it should NOT be used to fill a version structure, instead you should - use the SDL_Version() macro. } - -function SDL_Linked_Version: PSDL_version; -cdecl; external {$IFDEF __GPC__}name 'SDL_Linked_Version'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_Linked_Version} - -{------------------------------------------------------------------------------} -{ video } -{------------------------------------------------------------------------------} - -{ These functions are used internally, and should not be used unless you - have a specific need to specify the video driver you want to use. - You should normally use SDL_Init() or SDL_InitSubSystem(). - - SDL_VideoInit() initializes the video subsystem -- sets up a connection - to the window manager, etc, and determines the current video mode and - pixel format, but does not initialize a window or graphics mode. - Note that event handling is activated by this routine. - - If you use both sound and video in your application, you need to call - SDL_Init() before opening the sound device, otherwise under Win32 DirectX, - you won't be able to set full-screen display modes. } - -function SDL_VideoInit(driver_name: PChar; flags: UInt32): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_VideoInit'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_VideoInit} -procedure SDL_VideoQuit; -cdecl; external {$IFDEF __GPC__}name 'SDL_VideoQuit'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_VideoQuit} - -{ This function fills the given character buffer with the name of the - video driver, and returns a pointer to it if the video driver has - been initialized. It returns NULL if no driver has been initialized. } - -function SDL_VideoDriverName(namebuf: PChar; maxlen: Integer): PChar; -cdecl; external {$IFDEF __GPC__}name 'SDL_VideoDriverName'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_VideoDriverName} - -{ This function returns a pointer to the current display surface. - If SDL is doing format conversion on the display surface, this - function returns the publicly visible surface, not the real video - surface. } - -function SDL_GetVideoSurface: PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetVideoSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GetVideoSurface} - -{ This function returns a read-only pointer to information about the - video hardware. If this is called before SDL_SetVideoMode(), the 'vfmt' - member of the returned structure will contain the pixel format of the - "best" video mode. } -function SDL_GetVideoInfo: PSDL_VideoInfo; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetVideoInfo'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GetVideoInfo} - -{ Check to see if a particular video mode is supported. - It returns 0 if the requested mode is not supported under any bit depth, - or returns the bits-per-pixel of the closest available mode with the - given width and height. If this bits-per-pixel is different from the - one used when setting the video mode, SDL_SetVideoMode() will succeed, - but will emulate the requested bits-per-pixel with a shadow surface. - - The arguments to SDL_VideoModeOK() are the same ones you would pass to - SDL_SetVideoMode() } - -function SDL_VideoModeOK(width, height, bpp: Integer; flags: UInt32): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_VideoModeOK'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_VideoModeOK} - -{ Return a pointer to an array of available screen dimensions for the - given format and video flags, sorted largest to smallest. Returns - NULL if there are no dimensions available for a particular format, - or (SDL_Rect **)-1 if any dimension is okay for the given format. - - if 'format' is NULL, the mode list will be for the format given - by SDL_GetVideoInfo( ) - > vfmt } - -function SDL_ListModes(format: PSDL_PixelFormat; flags: UInt32): PPSDL_Rect; -cdecl; external {$IFDEF __GPC__}name 'SDL_ListModes'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_ListModes} - - -{ Set up a video mode with the specified width, height and bits-per-pixel. - - If 'bpp' is 0, it is treated as the current display bits per pixel. - - If SDL_ANYFORMAT is set in 'flags', the SDL library will try to set the - requested bits-per-pixel, but will return whatever video pixel format is - available. The default is to emulate the requested pixel format if it - is not natively available. - - If SDL_HWSURFACE is set in 'flags', the video surface will be placed in - video memory, if possible, and you may have to call SDL_LockSurface() - in order to access the raw framebuffer. Otherwise, the video surface - will be created in system memory. - - If SDL_ASYNCBLIT is set in 'flags', SDL will try to perform rectangle - updates asynchronously, but you must always lock before accessing pixels. - SDL will wait for updates to complete before returning from the lock. - - If SDL_HWPALETTE is set in 'flags', the SDL library will guarantee - that the colors set by SDL_SetColors() will be the colors you get. - Otherwise, in 8-bit mode, SDL_SetColors() may not be able to set all - of the colors exactly the way they are requested, and you should look - at the video surface structure to determine the actual palette. - If SDL cannot guarantee that the colors you request can be set, - i.e. if the colormap is shared, then the video surface may be created - under emulation in system memory, overriding the SDL_HWSURFACE flag. - - If SDL_FULLSCREEN is set in 'flags', the SDL library will try to set - a fullscreen video mode. The default is to create a windowed mode - if the current graphics system has a window manager. - If the SDL library is able to set a fullscreen video mode, this flag - will be set in the surface that is returned. - - If SDL_DOUBLEBUF is set in 'flags', the SDL library will try to set up - two surfaces in video memory and swap between them when you call - SDL_Flip(). This is usually slower than the normal single-buffering - scheme, but prevents "tearing" artifacts caused by modifying video - memory while the monitor is refreshing. It should only be used by - applications that redraw the entire screen on every update. - - This function returns the video framebuffer surface, or NULL if it fails. } - -function SDL_SetVideoMode(width, height, bpp: Integer; flags: UInt32): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'SDL_SetVideoMode'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_SetVideoMode} - - -{ Makes sure the given list of rectangles is updated on the given screen. - If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire - screen. - These functions should not be called while 'screen' is locked. } - -procedure SDL_UpdateRects(screen: PSDL_Surface; numrects: Integer; rects: PSDL_Rect); -cdecl; external {$IFDEF __GPC__}name 'SDL_UpdateRects'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_UpdateRects} -procedure SDL_UpdateRect(screen: PSDL_Surface; x, y: SInt32; w, h: UInt32); -cdecl; external {$IFDEF __GPC__}name 'SDL_UpdateRect'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_UpdateRect} - - -{ On hardware that supports double-buffering, this function sets up a flip - and returns. The hardware will wait for vertical retrace, and then swap - video buffers before the next video surface blit or lock will return. - On hardware that doesn not support double-buffering, this is equivalent - to calling SDL_UpdateRect(screen, 0, 0, 0, 0); - The SDL_DOUBLEBUF flag must have been passed to SDL_SetVideoMode() when - setting the video mode for this function to perform hardware flipping. - This function returns 0 if successful, or -1 if there was an error.} - -function SDL_Flip(screen: PSDL_Surface): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_Flip'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_Flip} - -{ Set the gamma correction for each of the color channels. - The gamma values range (approximately) between 0.1 and 10.0 - - If this function isn't supported directly by the hardware, it will - be emulated using gamma ramps, if available. If successful, this - function returns 0, otherwise it returns -1. } - -function SDL_SetGamma(redgamma: single; greengamma: single; bluegamma: single ): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SetGamma'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_SetGamma} - -{ Set the gamma translation table for the red, green, and blue channels - of the video hardware. Each table is an array of 256 16-bit quantities, - representing a mapping between the input and output for that channel. - The input is the index into the array, and the output is the 16-bit - gamma value at that index, scaled to the output color precision. - - You may pass NULL for any of the channels to leave it unchanged. - If the call succeeds, it will return 0. If the display driver or - hardware does not support gamma translation, or otherwise fails, - this function will return -1. } - -function SDL_SetGammaRamp( redtable: PUInt16; greentable: PUInt16; bluetable: PUInt16): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SetGammaRamp'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_SetGammaRamp} - -{ Retrieve the current values of the gamma translation tables. - - You must pass in valid pointers to arrays of 256 16-bit quantities. - Any of the pointers may be NULL to ignore that channel. - If the call succeeds, it will return 0. If the display driver or - hardware does not support gamma translation, or otherwise fails, - this function will return -1. } - -function SDL_GetGammaRamp( redtable: PUInt16; greentable: PUInt16; bluetable: PUInt16): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetGammaRamp'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GetGammaRamp} - -{ Sets a portion of the colormap for the given 8-bit surface. If 'surface' - is not a palettized surface, this function does nothing, returning 0. - If all of the colors were set as passed to SDL_SetColors(), it will - return 1. If not all the color entries were set exactly as given, - it will return 0, and you should look at the surface palette to - determine the actual color palette. - - When 'surface' is the surface associated with the current display, the - display colormap will be updated with the requested colors. If - SDL_HWPALETTE was set in SDL_SetVideoMode() flags, SDL_SetColors() - will always return 1, and the palette is guaranteed to be set the way - you desire, even if the window colormap has to be warped or run under - emulation. } - - -function SDL_SetColors(surface: PSDL_Surface; colors: PSDL_Color; firstcolor : Integer; ncolors: Integer) : Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SetColors'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_SetColors} - -{ Sets a portion of the colormap for a given 8-bit surface. - 'flags' is one or both of: - SDL_LOGPAL -- set logical palette, which controls how blits are mapped - to/from the surface, - SDL_PHYSPAL -- set physical palette, which controls how pixels look on - the screen - Only screens have physical palettes. Separate change of physical/logical - palettes is only possible if the screen has SDL_HWPALETTE set. - - The return value is 1 if all colours could be set as requested, and 0 - otherwise. - - SDL_SetColors() is equivalent to calling this function with - flags = (SDL_LOGPAL or SDL_PHYSPAL). } - -function SDL_SetPalette(surface: PSDL_Surface; flags: Integer; colors: PSDL_Color; firstcolor: Integer; ncolors: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SetPalette'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_SetPalette} - -{ Maps an RGB triple to an opaque pixel value for a given pixel format } -function SDL_MapRGB(format: PSDL_PixelFormat; r: UInt8; g: UInt8; b: UInt8) : UInt32; -cdecl; external {$IFDEF __GPC__}name 'SDL_MapRGB'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_MapRGB} - -{ Maps an RGBA quadruple to a pixel value for a given pixel format } -function SDL_MapRGBA(format: PSDL_PixelFormat; r: UInt8; g: UInt8; b: UInt8; a: UInt8): UInt32; -cdecl; external {$IFDEF __GPC__}name 'SDL_MapRGBA'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_MapRGBA} - -{ Maps a pixel value into the RGB components for a given pixel format } -procedure SDL_GetRGB(pixel: UInt32; fmt: PSDL_PixelFormat; r: PUInt8; g: PUInt8; b: PUInt8); -cdecl; external {$IFDEF __GPC__}name 'SDL_GetRGB'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GetRGB} - -{ Maps a pixel value into the RGBA components for a given pixel format } -procedure SDL_GetRGBA(pixel: UInt32; fmt: PSDL_PixelFormat; r: PUInt8; g: PUInt8; b: PUInt8; a: PUInt8); -cdecl; external {$IFDEF __GPC__}name 'SDL_GetRGBA'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GetRGBA} - -{ Allocate and free an RGB surface (must be called after SDL_SetVideoMode) - If the depth is 4 or 8 bits, an empty palette is allocated for the surface. - If the depth is greater than 8 bits, the pixel format is set using the - flags '[RGB]mask'. - If the function runs out of memory, it will return NULL. - - The 'flags' tell what kind of surface to create. - SDL_SWSURFACE means that the surface should be created in system memory. - SDL_HWSURFACE means that the surface should be created in video memory, - with the same format as the display surface. This is useful for surfaces - that will not change much, to take advantage of hardware acceleration - when being blitted to the display surface. - SDL_ASYNCBLIT means that SDL will try to perform asynchronous blits with - this surface, but you must always lock it before accessing the pixels. - SDL will wait for current blits to finish before returning from the lock. - SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits. - If the hardware supports acceleration of colorkey blits between - two surfaces in video memory, SDL will try to place the surface in - video memory. If this isn't possible or if there is no hardware - acceleration available, the surface will be placed in system memory. - SDL_SRCALPHA means that the surface will be used for alpha blits and - if the hardware supports hardware acceleration of alpha blits between - two surfaces in video memory, to place the surface in video memory - if possible, otherwise it will be placed in system memory. - If the surface is created in video memory, blits will be _much_ faster, - but the surface format must be identical to the video surface format, - and the only way to access the pixels member of the surface is to use - the SDL_LockSurface() and SDL_UnlockSurface() calls. - If the requested surface actually resides in video memory, SDL_HWSURFACE - will be set in the flags member of the returned surface. If for some - reason the surface could not be placed in video memory, it will not have - the SDL_HWSURFACE flag set, and will be created in system memory instead. } - -function SDL_AllocSurface(flags: UInt32; width, height, depth: Integer; - RMask, GMask, BMask, AMask: UInt32): PSDL_Surface; -{$EXTERNALSYM SDL_AllocSurface} - -function SDL_CreateRGBSurface(flags: UInt32; width, height, depth: Integer; RMask, GMask, BMask, AMask: UInt32): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'SDL_CreateRGBSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CreateRGBSurface} - -function SDL_CreateRGBSurfaceFrom(pixels: Pointer; width, height, depth, pitch - : Integer; RMask, GMask, BMask, AMask: UInt32): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'SDL_CreateRGBSurfaceFrom'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CreateRGBSurfaceFrom} - -procedure SDL_FreeSurface(surface: PSDL_Surface); -cdecl; external {$IFDEF __GPC__}name 'SDL_FreeSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_FreeSurface} - -function SDL_MustLock(Surface: PSDL_Surface): Boolean; -{$EXTERNALSYM SDL_MustLock} -{ SDL_LockSurface() sets up a surface for directly accessing the pixels. - Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write - to and read from 'surface->pixels', using the pixel format stored in - 'surface->format'. Once you are done accessing the surface, you should - use SDL_UnlockSurface() to release it. - - Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates - to 0, then you can read and write to the surface at any time, and the - pixel format of the surface will not change. In particular, if the - SDL_HWSURFACE flag is not given when calling SDL_SetVideoMode(), you - will not need to lock the display surface before accessing it. - - No operating system or library calls should be made between lock/unlock - pairs, as critical system locks may be held during this time. - - SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. } -function SDL_LockSurface(surface: PSDL_Surface): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_LockSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_LockSurface} - -procedure SDL_UnlockSurface(surface: PSDL_Surface); -cdecl; external {$IFDEF __GPC__}name 'SDL_UnlockSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_UnlockSurface} - -{ Load a surface from a seekable SDL data source (memory or file.) - If 'freesrc' is non-zero, the source will be closed after being read. - Returns the new surface, or NULL if there was an error. - The new surface should be freed with SDL_FreeSurface(). } -function SDL_LoadBMP_RW(src: PSDL_RWops; freesrc: Integer): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'SDL_LoadBMP_RW'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_LoadBMP_RW} - -// Convenience macro -- load a surface from a file -function SDL_LoadBMP(filename: PChar): PSDL_Surface; -{$EXTERNALSYM SDL_LoadBMP} - -{ Save a surface to a seekable SDL data source (memory or file.) - If 'freedst' is non-zero, the source will be closed after being written. - Returns 0 if successful or -1 if there was an error. } - -function SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SaveBMP_RW'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_SaveBMP_RW} - -// Convenience macro -- save a surface to a file -function SDL_SaveBMP(surface: PSDL_Surface; filename: PChar): Integer; -{$EXTERNALSYM SDL_SaveBMP} - -{ Sets the color key (transparent pixel) in a blittable surface. - If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL), - 'key' will be the transparent pixel in the source image of a blit. - SDL_RLEACCEL requests RLE acceleration for the surface if present, - and removes RLE acceleration if absent. - If 'flag' is 0, this function clears any current color key. - This function returns 0, or -1 if there was an error. } - -function SDL_SetColorKey(surface: PSDL_Surface; flag, key: UInt32) : Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SetColorKey'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_SetColorKey} - -{ This function sets the alpha value for the entire surface, as opposed to - using the alpha component of each pixel. This value measures the range - of transparency of the surface, 0 being completely transparent to 255 - being completely opaque. An 'alpha' value of 255 causes blits to be - opaque, the source pixels copied to the destination (the default). Note - that per-surface alpha can be combined with colorkey transparency. - - If 'flag' is 0, alpha blending is disabled for the surface. - If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface. - OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the - surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed. } - - -function SDL_SetAlpha(surface: PSDL_Surface; flag: UInt32; alpha: UInt8): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SetAlpha'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_SetAlpha} - -{ Sets the clipping rectangle for the destination surface in a blit. - - If the clip rectangle is NULL, clipping will be disabled. - If the clip rectangle doesn't intersect the surface, the function will - return SDL_FALSE and blits will be completely clipped. Otherwise the - function returns SDL_TRUE and blits to the surface will be clipped to - the intersection of the surface area and the clipping rectangle. - - Note that blits are automatically clipped to the edges of the source - and destination surfaces. } -procedure SDL_SetClipRect(surface: PSDL_Surface; rect: PSDL_Rect); cdecl; -external {$IFDEF __GPC__}name 'SDL_SetClipRect'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_SetClipRect} - -{ Gets the clipping rectangle for the destination surface in a blit. - 'rect' must be a pointer to a valid rectangle which will be filled - with the correct values. } -procedure SDL_GetClipRect(surface: PSDL_Surface; rect: PSDL_Rect); cdecl; -external {$IFDEF __GPC__}name 'SDL_GetClipRect'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GetClipRect} - -{ Creates a new surface of the specified format, and then copies and maps - the given surface to it so the blit of the converted surface will be as - fast as possible. If this function fails, it returns NULL. - - The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those - semantics. You can also pass SDL_RLEACCEL in the flags parameter and - SDL will try to RLE accelerate colorkey and alpha blits in the resulting - surface. - - This function is used internally by SDL_DisplayFormat(). } - -function SDL_ConvertSurface(src: PSDL_Surface; fmt: PSDL_PixelFormat; flags: UInt32): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'SDL_ConvertSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_ConvertSurface} - -{ - This performs a fast blit from the source surface to the destination - surface. It assumes that the source and destination rectangles are - the same size. If either 'srcrect' or 'dstrect' are NULL, the entire - surface (src or dst) is copied. The final blit rectangles are saved - in 'srcrect' and 'dstrect' after all clipping is performed. - If the blit is successful, it returns 0, otherwise it returns -1. - - The blit function should not be called on a locked surface. - - The blit semantics for surfaces with and without alpha and colorkey - are defined as follows: - - RGBA->RGB: - SDL_SRCALPHA set: - alpha-blend (using alpha-channel). - SDL_SRCCOLORKEY ignored. - SDL_SRCALPHA not set: - copy RGB. - if SDL_SRCCOLORKEY set, only copy the pixels matching the - RGB values of the source colour key, ignoring alpha in the - comparison. - - RGB->RGBA: - SDL_SRCALPHA set: - alpha-blend (using the source per-surface alpha value); - set destination alpha to opaque. - SDL_SRCALPHA not set: - copy RGB, set destination alpha to opaque. - both: - if SDL_SRCCOLORKEY set, only copy the pixels matching the - source colour key. - - RGBA->RGBA: - SDL_SRCALPHA set: - alpha-blend (using the source alpha channel) the RGB values; - leave destination alpha untouched. [Note: is this correct?] - SDL_SRCCOLORKEY ignored. - SDL_SRCALPHA not set: - copy all of RGBA to the destination. - if SDL_SRCCOLORKEY set, only copy the pixels matching the - RGB values of the source colour key, ignoring alpha in the - comparison. - - RGB->RGB: - SDL_SRCALPHA set: - alpha-blend (using the source per-surface alpha value). - SDL_SRCALPHA not set: - copy RGB. - both: - if SDL_SRCCOLORKEY set, only copy the pixels matching the - source colour key. - - If either of the surfaces were in video memory, and the blit returns -2, - the video memory was lost, so it should be reloaded with artwork and - re-blitted: - while ( SDL_BlitSurface(image, imgrect, screen, dstrect) = -2 ) do - begin - while ( SDL_LockSurface(image) < 0 ) do - Sleep(10); - -- Write image pixels to image->pixels -- - SDL_UnlockSurface(image); - end; - - This happens under DirectX 5.0 when the system switches away from your - fullscreen application. The lock will also fail until you have access - to the video memory again. } - -{ You should call SDL_BlitSurface() unless you know exactly how SDL - blitting works internally and how to use the other blit functions. } - -function SDL_BlitSurface(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): Integer; -{$EXTERNALSYM SDL_BlitSurface} - -{ This is the public blit function, SDL_BlitSurface(), and it performs - rectangle validation and clipping before passing it to SDL_LowerBlit() } -function SDL_UpperBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_UpperBlit'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_UpperBlit} - -{ This is a semi-private blit function and it performs low-level surface - blitting only. } -function SDL_LowerBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_LowerBlit'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_LowerBlit} - -{ This function performs a fast fill of the given rectangle with 'color' - The given rectangle is clipped to the destination surface clip area - and the final fill rectangle is saved in the passed in pointer. - If 'dstrect' is NULL, the whole surface will be filled with 'color' - The color should be a pixel of the format used by the surface, and - can be generated by the SDL_MapRGB() function. - This function returns 0 on success, or -1 on error. } - -function SDL_FillRect(dst: PSDL_Surface; dstrect: PSDL_Rect; color: UInt32) : Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_FillRect'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_FillRect} - -{ This function takes a surface and copies it to a new surface of the - pixel format and colors of the video framebuffer, suitable for fast - blitting onto the display surface. It calls SDL_ConvertSurface() - - If you want to take advantage of hardware colorkey or alpha blit - acceleration, you should set the colorkey and alpha value before - calling this function. - - If the conversion fails or runs out of memory, it returns NULL } - -function SDL_DisplayFormat(surface: PSDL_Surface): PSDL_Surface; cdecl; -external {$IFDEF __GPC__}name 'SDL_DisplayFormat'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_DisplayFormat} - -{ This function takes a surface and copies it to a new surface of the - pixel format and colors of the video framebuffer (if possible), - suitable for fast alpha blitting onto the display surface. - The new surface will always have an alpha channel. - - If you want to take advantage of hardware colorkey or alpha blit - acceleration, you should set the colorkey and alpha value before - calling this function. - - If the conversion fails or runs out of memory, it returns NULL } - - -function SDL_DisplayFormatAlpha(surface: PSDL_Surface): PSDL_Surface; cdecl; -external {$IFDEF __GPC__}name 'SDL_DisplayFormatAlpha'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_DisplayFormatAlpha} - -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -//* YUV video surface overlay functions */ -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -{ This function creates a video output overlay - Calling the returned surface an overlay is something of a misnomer because - the contents of the display surface underneath the area where the overlay - is shown is undefined - it may be overwritten with the converted YUV data. } - -function SDL_CreateYUVOverlay(width: Integer; height: Integer; format: UInt32; display: PSDL_Surface): PSDL_Overlay; -cdecl; external {$IFDEF __GPC__}name 'SDL_CreateYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CreateYUVOverlay} - -// Lock an overlay for direct access, and unlock it when you are done -function SDL_LockYUVOverlay(Overlay: PSDL_Overlay): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_LockYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_LockYUVOverlay} - -procedure SDL_UnlockYUVOverlay(Overlay: PSDL_Overlay); cdecl; -external {$IFDEF __GPC__}name 'SDL_UnlockYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_UnlockYUVOverlay} - - -{ Blit a video overlay to the display surface. - The contents of the video surface underneath the blit destination are - not defined. - The width and height of the destination rectangle may be different from - that of the overlay, but currently only 2x scaling is supported. } - -function SDL_DisplayYUVOverlay(Overlay: PSDL_Overlay; dstrect: PSDL_Rect) : Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_DisplayYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_DisplayYUVOverlay} - -// Free a video overlay -procedure SDL_FreeYUVOverlay(Overlay: PSDL_Overlay); -cdecl; external {$IFDEF __GPC__}name 'SDL_FreeYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_FreeYUVOverlay} - -{------------------------------------------------------------------------------} -{ OpenGL Routines } -{------------------------------------------------------------------------------} - -{ Dynamically load a GL driver, if SDL is built with dynamic GL. - - SDL links normally with the OpenGL library on your system by default, - but you can compile it to dynamically load the GL driver at runtime. - If you do this, you need to retrieve all of the GL functions used in - your program from the dynamic library using SDL_GL_GetProcAddress(). - - This is disabled in default builds of SDL. } - - -function SDL_GL_LoadLibrary(filename: PChar): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_GL_LoadLibrary'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GL_LoadLibrary} - -{ Get the address of a GL function (for extension functions) } -function SDL_GL_GetProcAddress(procname: PChar) : Pointer; -cdecl; external {$IFDEF __GPC__}name 'SDL_GL_GetProcAddress'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GL_GetProcAddress} - -{ Set an attribute of the OpenGL subsystem before intialization. } -function SDL_GL_SetAttribute(attr: TSDL_GLAttr; value: Integer) : Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_GL_SetAttribute'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GL_SetAttribute} - -{ Get an attribute of the OpenGL subsystem from the windowing - interface, such as glX. This is of course different from getting - the values from SDL's internal OpenGL subsystem, which only - stores the values you request before initialization. - - Developers should track the values they pass into SDL_GL_SetAttribute - themselves if they want to retrieve these values. } - -function SDL_GL_GetAttribute(attr: TSDL_GLAttr; var value: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_GL_GetAttribute'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GL_GetAttribute} - -{ Swap the OpenGL buffers, if double-buffering is supported. } - -procedure SDL_GL_SwapBuffers; -cdecl; external {$IFDEF __GPC__}name 'SDL_GL_SwapBuffers'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GL_SwapBuffers;} - -{ Internal functions that should not be called unless you have read - and understood the source code for these functions. } - -procedure SDL_GL_UpdateRects(numrects: Integer; rects: PSDL_Rect); -cdecl; external {$IFDEF __GPC__}name 'SDL_GL_UpdateRects'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GL_UpdateRects} -procedure SDL_GL_Lock; -cdecl; external {$IFDEF __GPC__}name 'SDL_GL_Lock'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GL_Lock;} -procedure SDL_GL_Unlock; -cdecl; external {$IFDEF __GPC__}name 'SDL_GL_Unlock'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GL_Unlock;} - -{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} -{* These functions allow interaction with the window manager, if any. *} -{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} - -{ Sets/Gets the title and icon text of the display window } -procedure SDL_WM_GetCaption(var title : PChar; var icon : PChar); -cdecl; external {$IFDEF __GPC__}name 'SDL_WM_GetCaption'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_WM_GetCaption} -procedure SDL_WM_SetCaption( const title : PChar; const icon : PChar); -cdecl; external {$IFDEF __GPC__}name 'SDL_WM_SetCaption'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_WM_SetCaption} - -{ Sets the icon for the display window. - This function must be called before the first call to SDL_SetVideoMode(). - It takes an icon surface, and a mask in MSB format. - If 'mask' is NULL, the entire icon surface will be used as the icon. } -procedure SDL_WM_SetIcon(icon: PSDL_Surface; mask: UInt8); -cdecl; external {$IFDEF __GPC__}name 'SDL_WM_SetIcon'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_WM_SetIcon} - -{ This function iconifies the window, and returns 1 if it succeeded. - If the function succeeds, it generates an SDL_APPACTIVE loss event. - This function is a noop and returns 0 in non-windowed environments. } - -function SDL_WM_IconifyWindow: Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_WM_IconifyWindow'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_WM_IconifyWindow} - -{ Toggle fullscreen mode without changing the contents of the screen. - If the display surface does not require locking before accessing - the pixel information, then the memory pointers will not change. - - If this function was able to toggle fullscreen mode (change from - running in a window to fullscreen, or vice-versa), it will return 1. - If it is not implemented, or fails, it returns 0. - - The next call to SDL_SetVideoMode() will set the mode fullscreen - attribute based on the flags parameter - if SDL_FULLSCREEN is not - set, then the display will be windowed by default where supported. - - This is currently only implemented in the X11 video driver. } - -function SDL_WM_ToggleFullScreen(surface: PSDL_Surface): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_WM_ToggleFullScreen'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_WM_ToggleFullScreen} - -{ Grabbing means that the mouse is confined to the application window, - and nearly all keyboard input is passed directly to the application, - and not interpreted by a window manager, if any. } - -function SDL_WM_GrabInput(mode: TSDL_GrabMode): TSDL_GrabMode; -cdecl; external {$IFDEF __GPC__}name 'SDL_WM_GrabInput'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_WM_GrabInput} - -{------------------------------------------------------------------------------} -{ mouse-routines } -{------------------------------------------------------------------------------} - -{ Retrieve the current state of the mouse. - The current button state is returned as a button bitmask, which can - be tested using the SDL_BUTTON(X) macros, and x and y are set to the - current mouse cursor position. You can pass NULL for either x or y. } - -function SDL_GetMouseState(var x: Integer; var y: Integer): UInt8; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetMouseState'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GetMouseState} - -{ Retrieve the current state of the mouse. - The current button state is returned as a button bitmask, which can - be tested using the SDL_BUTTON(X) macros, and x and y are set to the - mouse deltas since the last call to SDL_GetRelativeMouseState(). } -function SDL_GetRelativeMouseState(var x: Integer; var y: Integer): UInt8; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetRelativeMouseState'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GetRelativeMouseState} - -{ Set the position of the mouse cursor (generates a mouse motion event) } -procedure SDL_WarpMouse(x, y: UInt16); -cdecl; external {$IFDEF __GPC__}name 'SDL_WarpMouse'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_WarpMouse} - -{ Create a cursor using the specified data and mask (in MSB format). - The cursor width must be a multiple of 8 bits. - - The cursor is created in black and white according to the following: - data mask resulting pixel on screen - 0 1 White - 1 1 Black - 0 0 Transparent - 1 0 Inverted color if possible, black if not. - - Cursors created with this function must be freed with SDL_FreeCursor(). } -function SDL_CreateCursor(data, mask: PUInt8; w, h, hot_x, hot_y: Integer): PSDL_Cursor; -cdecl; external {$IFDEF __GPC__}name 'SDL_CreateCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CreateCursor} - -{ Set the currently active cursor to the specified one. - If the cursor is currently visible, the change will be immediately - represented on the display. } -procedure SDL_SetCursor(cursor: PSDL_Cursor); -cdecl; external {$IFDEF __GPC__}name 'SDL_SetCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_SetCursor} - -{ Returns the currently active cursor. } -function SDL_GetCursor: PSDL_Cursor; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GetCursor} - -{ Deallocates a cursor created with SDL_CreateCursor(). } -procedure SDL_FreeCursor(cursor: PSDL_Cursor); -cdecl; external {$IFDEF __GPC__}name 'SDL_FreeCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_FreeCursor} - -{ Toggle whether or not the cursor is shown on the screen. - The cursor start off displayed, but can be turned off. - SDL_ShowCursor() returns 1 if the cursor was being displayed - before the call, or 0 if it was not. You can query the current - state by passing a 'toggle' value of -1. } -function SDL_ShowCursor(toggle: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_ShowCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_ShowCursor} - -function SDL_BUTTON( Button : Integer ) : Integer; - -{------------------------------------------------------------------------------} -{ Keyboard-routines } -{------------------------------------------------------------------------------} - -{ Enable/Disable UNICODE translation of keyboard input. - This translation has some overhead, so translation defaults off. - If 'enable' is 1, translation is enabled. - If 'enable' is 0, translation is disabled. - If 'enable' is -1, the translation state is not changed. - It returns the previous state of keyboard translation. } -function SDL_EnableUNICODE(enable: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_EnableUNICODE'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_EnableUNICODE} - -{ If 'delay' is set to 0, keyboard repeat is disabled. } -function SDL_EnableKeyRepeat(delay: Integer; interval: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_EnableKeyRepeat'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_EnableKeyRepeat} - -{ Get a snapshot of the current state of the keyboard. - Returns an array of keystates, indexed by the SDLK_* syms. - Used: - - UInt8 *keystate = SDL_GetKeyState(NULL); - if ( keystate[SDLK_RETURN] ) ... is pressed } - -function SDL_GetKeyState(numkeys: PInt): PUInt8; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetKeyState'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GetKeyState} - -{ Get the current key modifier state } -function SDL_GetModState: TSDLMod; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetModState'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GetModState} - -{ Set the current key modifier state - This does not change the keyboard state, only the key modifier flags. } -procedure SDL_SetModState(modstate: TSDLMod); -cdecl; external {$IFDEF __GPC__}name 'SDL_SetModState'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_SetModState} - -{ Get the name of an SDL virtual keysym } -function SDL_GetKeyName(key: TSDLKey): PChar; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetKeyName'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GetKeyName} - -{------------------------------------------------------------------------------} -{ Active Routines } -{------------------------------------------------------------------------------} - -{ This function returns the current state of the application, which is a - bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and - SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to - see your application, otherwise it has been iconified or disabled. } - -function SDL_GetAppState: UInt8; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetAppState'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GetAppState} - - -{ Mutex functions } - -{ Create a mutex, initialized unlocked } - -function SDL_CreateMutex: PSDL_Mutex; -cdecl; external {$IFDEF __GPC__}name 'SDL_CreateMutex'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CreateMutex} - -{ Lock the mutex (Returns 0, or -1 on error) } - - function SDL_mutexP(mutex: PSDL_mutex): Integer; - cdecl; external {$IFDEF __GPC__}name 'SDL_mutexP'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{ $ EXTERNALSYM SDL_mutexP} - -function SDL_LockMutex(mutex: PSDL_mutex): Integer; -{$EXTERNALSYM SDL_LockMutex} - -{ Unlock the mutex (Returns 0, or -1 on error) } -function SDL_mutexV(mutex: PSDL_mutex): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_mutexV'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_mutexV} - -function SDL_UnlockMutex(mutex: PSDL_mutex): Integer; -{$EXTERNALSYM SDL_UnlockMutex} - -{ Destroy a mutex } -procedure SDL_DestroyMutex(mutex: PSDL_mutex); -cdecl; external {$IFDEF __GPC__}name 'SDL_DestroyMutex'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_DestroyMutex} - -{ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } -{ Semaphore functions } -{ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } -{ Create a semaphore, initialized with value, returns NULL on failure. } -function SDL_CreateSemaphore(initial_value: UInt32): PSDL_Sem; -cdecl; external {$IFDEF __GPC__}name 'SDL_CreateSemaphore'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CreateSemaphore} - - -{ Destroy a semaphore } -procedure SDL_DestroySemaphore(sem: PSDL_sem); -cdecl; external {$IFDEF __GPC__}name 'SDL_DestroySemaphore'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_DestroySemaphore} - -{ This function suspends the calling thread until the semaphore pointed - to by sem has a positive count. It then atomically decreases the semaphore - count. } - -function SDL_SemWait(sem: PSDL_sem): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SemWait'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_SemWait} - -{ Non-blocking variant of SDL_SemWait(), returns 0 if the wait succeeds, - SDL_MUTEX_TIMEDOUT if the wait would block, and -1 on error. } - -function SDL_SemTryWait(sem: PSDL_sem): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SemTryWait'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_SemTryWait} - -{ Variant of SDL_SemWait() with a timeout in milliseconds, returns 0 if - the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not succeed in - the allotted time, and -1 on error. - On some platforms this function is implemented by looping with a delay - of 1 ms, and so should be avoided if possible. } - -function SDL_SemWaitTimeout(sem: PSDL_sem; ms: UInt32): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SemWaitTimeout'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_SemTryWait} - -{ Atomically increases the semaphore's count (not blocking), returns 0, - or -1 on error. } - -function SDL_SemPost(sem: PSDL_sem): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SemPost'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_SemTryWait} - -{ Returns the current count of the semaphore } - -function SDL_SemValue(sem: PSDL_sem): UInt32; -cdecl; external {$IFDEF __GPC__}name 'SDL_SemValue'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_SemValue} - -{ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } -{ Condition variable functions } -{ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } -{ Create a condition variable } -function SDL_CreateCond: PSDL_Cond; -cdecl; external {$IFDEF __GPC__}name 'SDL_CreateCond'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CreateCond} - -{ Destroy a condition variable } -procedure SDL_DestroyCond(cond: PSDL_Cond); -cdecl; external {$IFDEF __GPC__}name 'SDL_DestroyCond'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_DestroyCond} - -{ Restart one of the threads that are waiting on the condition variable, - returns 0 or -1 on error. } - -function SDL_CondSignal(cond: PSDL_cond): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_CondSignal'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CondSignal} - -{ Restart all threads that are waiting on the condition variable, - returns 0 or -1 on error. } - -function SDL_CondBroadcast(cond: PSDL_cond): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_CondBroadcast'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CondBroadcast} - - -{ Wait on the condition variable, unlocking the provided mutex. - The mutex must be locked before entering this function! - Returns 0 when it is signaled, or -1 on error. } - -function SDL_CondWait(cond: PSDL_cond; mut: PSDL_mutex): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_CondWait'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CondWait} - -{ Waits for at most 'ms' milliseconds, and returns 0 if the condition - variable is signaled, SDL_MUTEX_TIMEDOUT if the condition is not - signaled in the allotted time, and -1 on error. - On some platforms this function is implemented by looping with a delay - of 1 ms, and so should be avoided if possible. } - -function SDL_CondWaitTimeout(cond: PSDL_cond; mut: PSDL_mutex; ms: UInt32) : Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_CondWaitTimeout'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CondWaitTimeout} - -{ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } -{ Condition variable functions } -{ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } - -{ Create a thread } -function SDL_CreateThread(fn: PInt; data: Pointer): PSDL_Thread; -cdecl; external {$IFDEF __GPC__}name 'SDL_CreateThread'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_CreateThread} - -{ Get the 32-bit thread identifier for the current thread } -function SDL_ThreadID: UInt32; -cdecl; external {$IFDEF __GPC__}name 'SDL_ThreadID'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_ThreadID} - -{ Get the 32-bit thread identifier for the specified thread, - equivalent to SDL_ThreadID() if the specified thread is NULL. } -function SDL_GetThreadID(thread: PSDL_Thread): UInt32; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetThreadID'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GetThreadID} - -{ Wait for a thread to finish. - The return code for the thread function is placed in the area - pointed to by 'status', if 'status' is not NULL. } - -procedure SDL_WaitThread(thread: PSDL_Thread; var status: Integer); -cdecl; external {$IFDEF __GPC__}name 'SDL_WaitThread'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_WaitThread} - -{ Forcefully kill a thread without worrying about its state } -procedure SDL_KillThread(thread: PSDL_Thread); -cdecl; external {$IFDEF __GPC__}name 'SDL_KillThread'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_KillThread} - -{------------------------------------------------------------------------------} -{ Get Environment Routines } -{------------------------------------------------------------------------------} -{$IFDEF WIN32} -function _putenv( const variable : Pchar ): integer; -cdecl; -{$ENDIF} - -{$IFDEF Unix} -{$IFDEF FPC} -function _putenv( const variable : Pchar ): integer; -cdecl; external 'libc.so' name 'putenv'; -{$ENDIF} -{$ENDIF} - -{ Put a variable of the form "name=value" into the environment } -//function SDL_putenv(const variable: PChar): integer; cdecl; external {$IFDEF __GPC__}name 'SDL_Init'{$ELSE} SDLLibName{$ENDIF __GPC__}SDLLibName name ''; -function SDL_putenv(const variable: PChar): integer; -{$EXTERNALSYM SDL_putenv} - -// The following function has been commented out to encourage developers to use -// SDL_putenv as it it more portable -//function putenv(const variable: PChar): integer; -//{$EXTERNALSYM putenv} - -{$IFDEF WIN32} -{$IFNDEF __GPC__} -function getenv( const name : Pchar ): PChar; cdecl; -{$ENDIF} -{$ENDIF} - -{* Retrieve a variable named "name" from the environment } -//function SDL_getenv(const name: PChar): PChar; cdecl; external {$IFDEF __GPC__}name 'SDL_Init'{$ELSE} SDLLibName{$ENDIF __GPC__}SDLLibName name ''; -function SDL_getenv(const name: PChar): PChar; -{$EXTERNALSYM SDL_getenv} - -// The following function has been commented out to encourage developers to use -// SDL_getenv as it it more portable -//function getenv(const name: PChar): PChar; -//{$EXTERNALSYM getenv} - -{* - * This function gives you custom hooks into the window manager information. - * It fills the structure pointed to by 'info' with custom information and - * returns 1 if the function is implemented. If it's not implemented, or - * the version member of the 'info' structure is invalid, it returns 0. - *} -function SDL_GetWMInfo(info : PSDL_SysWMinfo) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetWMInfo'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_GetWMInfo} - -{------------------------------------------------------------------------------} - -//SDL_loadso.h -{* This function dynamically loads a shared object and returns a pointer - * to the object handle (or NULL if there was an error). - * The 'sofile' parameter is a system dependent name of the object file. - *} -function SDL_LoadObject( const sofile : PChar ) : Pointer; -cdecl; external {$IFDEF __GPC__}name 'SDL_LoadObject'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_LoadObject} - -{* Given an object handle, this function looks up the address of the - * named function in the shared object and returns it. This address - * is no longer valid after calling SDL_UnloadObject(). - *} -function SDL_LoadFunction( handle : Pointer; const name : PChar ) : Pointer; -cdecl; external {$IFDEF __GPC__}name 'SDL_LoadFunction'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_LoadFunction} - -{* Unload a shared object from memory *} -procedure SDL_UnloadObject( handle : Pointer ); -cdecl; external {$IFDEF __GPC__}name 'SDL_UnloadObject'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_UnloadObject} - - - -{------------------------------------------------------------------------------} - -function SDL_Swap32(D: Uint32): Uint32; -{$EXTERNALSYM SDL_Swap32} - -{ FreeAndNil frees the given TObject instance and sets the variable reference - to nil. Be careful to only pass TObjects to this routine. } -procedure FreeAndNil(var Obj); - -{ Exit procedure handling } - -{ AddExitProc adds the given procedure to the run-time library's exit - procedure list. When an application terminates, its exit procedures are - executed in reverse order of definition, i.e. the last procedure passed - to AddExitProc is the first one to get executed upon termination. } -procedure AddExitProc(Proc: TProcedure); - -// Bitwise Checking functions -function IsBitOn( value : integer; bit : Byte ) : boolean; - -function TurnBitOn( value : integer; bit : Byte ) : integer; - -function TurnBitOff( value : integer; bit : Byte ) : integer; - -implementation - -{$IFDEF __GPC__} - {$L 'sdl'} { link sdl.dll.a or libsdl.so or libsdl.a } -{$ENDIF} - -function SDL_TABLESIZE(table: PChar): Integer; -begin - Result := SizeOf(table) div SizeOf(table[0]); -end; - -procedure SDL_OutOfMemory; -begin - {$IFNDEF WIN32} - SDL_Error(SDL_ENOMEM); - {$ENDIF} -end; - -function SDL_RWSeek(context: PSDL_RWops; offset: Integer; whence: Integer) : Integer; -begin - Result := context^.seek(context, offset, whence); -end; - -function SDL_RWTell(context: PSDL_RWops): Integer; -begin - Result := context^.seek(context, 0, 1); -end; - -function SDL_RWRead(context: PSDL_RWops; ptr: Pointer; size: Integer; n: Integer): Integer; -begin - Result := context^.read(context, ptr, size, n); -end; - -function SDL_RWWrite(context: PSDL_RWops; ptr: Pointer; size: Integer; n: Integer): Integer; -begin - Result := context^.write(context, ptr, size, n); -end; - -function SDL_RWClose(context: PSDL_RWops): Integer; -begin - Result := context^.close(context); -end; - -function SDL_LoadWAV(filename: PChar; spec: PSDL_AudioSpec; audio_buf: PUInt8; audiolen: PUInt32): PSDL_AudioSpec; -begin - Result := SDL_LoadWAV_RW(SDL_RWFromFile(filename, 'rb'), 1, spec, audio_buf, audiolen); -end; - -function SDL_CDInDrive( status : TSDL_CDStatus ): LongBool; -begin - Result := ord( status ) > ord( CD_ERROR ); -end; - -procedure FRAMES_TO_MSF(frames: Integer; var M: Integer; var S: Integer; var - F: Integer); -var - value: Integer; -begin - value := frames; - F := value mod CD_FPS; - value := value div CD_FPS; - S := value mod 60; - value := value div 60; - M := value; -end; - -function MSF_TO_FRAMES(M: Integer; S: Integer; F: Integer): Integer; -begin - Result := M * 60 * CD_FPS + S * CD_FPS + F; -end; - -procedure SDL_VERSION(var X: TSDL_Version); -begin - X.major := SDL_MAJOR_VERSION; - X.minor := SDL_MINOR_VERSION; - X.patch := SDL_PATCHLEVEL; -end; - -function SDL_VERSIONNUM(X, Y, Z: Integer): Integer; -begin - Result := X * 1000 + Y * 100 + Z; -end; - -function SDL_COMPILEDVERSION: Integer; -begin - Result := SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL - ); -end; - -function SDL_VERSION_ATLEAST(X, Y, Z: Integer): LongBool; -begin - Result := (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)); -end; - -function SDL_LoadBMP(filename: PChar): PSDL_Surface; -begin - Result := SDL_LoadBMP_RW(SDL_RWFromFile(filename, 'rb'), 1); -end; - -function SDL_SaveBMP(surface: PSDL_Surface; filename: PChar): Integer; -begin - Result := SDL_SaveBMP_RW(surface, SDL_RWFromFile(filename, 'wb'), 1); -end; - -function SDL_BlitSurface(src: PSDL_Surface; srcrect: PSDL_Rect; dst: - PSDL_Surface; - dstrect: PSDL_Rect): Integer; -begin - Result := SDL_UpperBlit(src, srcrect, dst, dstrect); -end; - -function SDL_AllocSurface(flags: UInt32; width, height, depth: Integer; - RMask, GMask, BMask, AMask: UInt32): PSDL_Surface; -begin - Result := SDL_CreateRGBSurface(flags, width, height, depth, RMask, GMask, - BMask, AMask); -end; - -function SDL_MustLock(Surface: PSDL_Surface): Boolean; -begin - Result := ( ( surface^.offset <> 0 ) or - ( ( surface^.flags and ( SDL_HWSURFACE or SDL_ASYNCBLIT or SDL_RLEACCEL ) ) <> 0 ) ); -end; - -function SDL_LockMutex(mutex: PSDL_mutex): Integer; -begin - Result := SDL_mutexP(mutex); -end; - -function SDL_UnlockMutex(mutex: PSDL_mutex): Integer; -begin - Result := SDL_mutexV(mutex); -end; - -{$IFDEF WIN32} -function _putenv( const variable : Pchar ): Integer; -cdecl; external {$IFDEF __GPC__}name '_putenv'{$ELSE} 'MSVCRT.DLL'{$ENDIF __GPC__}; -{$ENDIF} - - -function SDL_putenv(const variable: PChar): Integer; -begin - {$IFDEF WIN32} - Result := _putenv(variable); - {$ENDIF} - - {$IFDEF UNIX} - {$IFDEF FPC} - Result := _putenv(variable); - {$ELSE} - Result := libc.putenv(variable); - {$ENDIF} - {$ENDIF} -end; - -{$IFDEF WIN32} -{$IFNDEF __GPC__} -function getenv( const name : Pchar ): PChar; -cdecl; external {$IFDEF __GPC__}name 'getenv'{$ELSE} 'MSVCRT.DLL'{$ENDIF}; -{$ENDIF} -{$ENDIF} - -function SDL_getenv(const name: PChar): PChar; -begin - {$IFDEF WIN32} - - {$IFDEF __GPC__} - Result := getenv( string( name ) ); - {$ELSE} - Result := getenv( name ); - {$ENDIF} - - {$ELSE} - - {$IFDEF UNIX} - - {$IFDEF FPC} - Result := fpgetenv(name); - {$ELSE} - Result := libc.getenv(name); - {$ENDIF} - - {$ENDIF} - - {$ENDIF} -end; - -function SDL_BUTTON( Button : Integer ) : Integer; -begin - Result := SDL_PRESSED shl ( Button - 1 ); -end; - -function SDL_Swap32(D: Uint32): Uint32; -begin - Result := ((D shl 24) or ((D shl 8) and $00FF0000) or ((D shr 8) and $0000FF00) or (D shr 24)); -end; - -procedure FreeAndNil(var Obj); -{$IFNDEF __GPC__} -{$IFNDEF __TMT__} -var - Temp: TObject; -{$ENDIF} -{$ENDIF} -begin -{$IFNDEF __GPC__} -{$IFNDEF __TMT__} - Temp := TObject(Obj); - Pointer(Obj) := nil; - Temp.Free; -{$ENDIF} -{$ENDIF} -end; - -{ Exit procedure handling } -type - PExitProcInfo = ^TExitProcInfo; - TExitProcInfo = record - Next: PExitProcInfo; - SaveExit: Pointer; - Proc: TProcedure; - end; - -var - ExitProcList: PExitProcInfo = nil; - -procedure DoExitProc; -var - P: PExitProcInfo; - Proc: TProcedure; -begin - P := ExitProcList; - ExitProcList := P^.Next; - ExitProc := P^.SaveExit; - Proc := P^.Proc; - Dispose(P); - Proc; -end; - -procedure AddExitProc(Proc: TProcedure); -var - P: PExitProcInfo; -begin - New(P); - P^.Next := ExitProcList; - P^.SaveExit := ExitProc; - P^.Proc := Proc; - ExitProcList := P; - ExitProc := @DoExitProc; -end; - -function IsBitOn( value : integer; bit : Byte ) : boolean; -begin - result := ( ( value and ( 1 shl bit ) ) <> 0 ); -end; - -function TurnBitOn( value : integer; bit : Byte ) : integer; -begin - result := ( value or ( 1 shl bit ) ); -end; - -function TurnBitOff( value : integer; bit : Byte ) : integer; -begin - result := ( value and not ( 1 shl bit ) ); -end; - -end. - - diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdl_cpuinfo.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdl_cpuinfo.pas deleted file mode 100644 index bd371c55..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdl_cpuinfo.pas +++ /dev/null @@ -1,155 +0,0 @@ -unit sdl_cpuinfo; -{ - $Id: sdl_cpuinfo.pas,v 1.2 2004/02/18 22:52:53 savage Exp $ - -} -{******************************************************************************} -{ } -{ Borland Delphi SDL - Simple DirectMedia Layer } -{ Conversion of the Simple DirectMedia Layer Headers } -{ } -{ Portions created by Sam Lantinga are } -{ Copyright (C) 1997-2004 Sam Lantinga } -{ 5635-34 Springhouse Dr. } -{ Pleasanton, CA 94588 (USA) } -{ } -{ All Rights Reserved. } -{ } -{ The original files are : SDL_cpuinfo.h } -{ } -{ The initial developer of this Pascal code was : } -{ Dominqiue Louis } -{ } -{ Portions created by Dominqiue Louis are } -{ Copyright (C) 2000 - 2004 Dominqiue Louis. } -{ } -{ } -{ Contributor(s) } -{ -------------- } -{ Obtained through: } -{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } -{ } -{ You may retrieve the latest version of this file at the Project } -{ JEDI home page, located at http://delphi-jedi.org } -{ } -{ The contents of this file are used with permission, subject to } -{ the Mozilla Public License Version 1.1 (the "License"); you may } -{ not use this file except in compliance with the License. You may } -{ obtain a copy of the License at } -{ http://www.mozilla.org/MPL/MPL-1.1.html } -{ } -{ Software distributed under the License is distributed on an } -{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } -{ implied. See the License for the specific language governing } -{ rights and limitations under the License. } -{ } -{ Description } -{ ----------- } -{ } -{ } -{ } -{ } -{ } -{ } -{ } -{ Requires } -{ -------- } -{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } -{ They are available from... } -{ http://www.libsdl.org . } -{ } -{ Programming Notes } -{ ----------------- } -{ } -{ } -{ } -{ } -{ Revision History } -{ ---------------- } -{ - $Log: sdl_cpuinfo.pas,v $ - Revision 1.2 2004/02/18 22:52:53 savage - Forgot to add jedi-sdl.inc file. It's there now. - - Revision 1.1 2004/02/18 22:35:54 savage - Brought sdl.pas up to 1.2.7 compatability - Thus... - Added SDL_GL_STEREO, - SDL_GL_MULTISAMPLEBUFFERS, - SDL_GL_MULTISAMPLESAMPLES - - Add DLL/Shared object functions - function SDL_LoadObject( const sofile : PChar ) : Pointer; - - function SDL_LoadFunction( handle : Pointer; const name : PChar ) : Pointer; - - procedure SDL_UnloadObject( handle : Pointer ); - - Added function to create RWops from const memory: SDL_RWFromConstMem() - function SDL_RWFromConstMem(const mem: Pointer; size: Integer) : PSDL_RWops; - - Ported SDL_cpuinfo.h so Now you can test for Specific CPU types. - - -} -{******************************************************************************} - -interface - -{$I jedi-sdl.inc} - -uses - sdl; - -{* This function returns true if the CPU has the RDTSC instruction - *} -function SDL_HasRDTSC : SDL_Bool; -cdecl; external {$IFDEF __GPC__}name 'SDL_HasRDTSC'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_HasRDTSC} - -{* This function returns true if the CPU has MMX features - *} -function SDL_HasMMX : SDL_Bool; -cdecl; external {$IFDEF __GPC__}name 'SDL_HasMMX'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_HasMMX} - -{* This function returns true if the CPU has MMX Ext. features - *} -function SDL_HasMMXExt : SDL_Bool; -cdecl; external {$IFDEF __GPC__}name 'SDL_HasMMXExt'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_HasMMXExt} - -{* This function returns true if the CPU has 3DNow features - *} -function SDL_Has3DNow : SDL_Bool; -cdecl; external {$IFDEF __GPC__}name 'SDL_Has3DNow'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_Has3DNow} - -{* This function returns true if the CPU has 3DNow! Ext. features - *} -function SDL_Has3DNowExt : SDL_Bool; -cdecl; external {$IFDEF __GPC__}name 'SDL_Has3DNowExt'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_Has3DNowExt} - -{* This function returns true if the CPU has SSE features - *} -function SDL_HasSSE : SDL_Bool; -cdecl; external {$IFDEF __GPC__}name 'SDL_HasSSE'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_HasSSE} - -{* This function returns true if the CPU has SSE2 features - *} -function SDL_HasSSE2 : SDL_Bool; -cdecl; external {$IFDEF __GPC__}name 'SDL_HasSSE2'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_HasSSE2} - -{* This function returns true if the CPU has AltiVec features - *} -function SDL_HasAltiVec : SDL_Bool; -cdecl; external {$IFDEF __GPC__}name 'SDL_HasAltiVec'{$ELSE} SDLLibName{$ENDIF __GPC__}; -{$EXTERNALSYM SDL_HasAltiVec} - -implementation - -end. - \ No newline at end of file diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlgameinterface.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlgameinterface.pas deleted file mode 100644 index f8bf902c..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlgameinterface.pas +++ /dev/null @@ -1,195 +0,0 @@ -unit sdlgameinterface; -{ - $Id: sdlgameinterface.pas,v 1.3 2004/10/17 18:41:49 savage Exp $ - -} -{******************************************************************************} -{ } -{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } -{ Game Interface Base class } -{ } -{ The initial developer of this Pascal code was : } -{ Dominqiue Louis } -{ } -{ Portions created by Dominqiue Louis are } -{ Copyright (C) 2000 - 2001 Dominqiue Louis. } -{ } -{ } -{ Contributor(s) } -{ -------------- } -{ } -{ } -{ Obtained through: } -{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } -{ } -{ You may retrieve the latest version of this file at the Project } -{ JEDI home page, located at http://delphi-jedi.org } -{ } -{ The contents of this file are used with permission, subject to } -{ the Mozilla Public License Version 1.1 (the "License"); you may } -{ not use this file except in compliance with the License. You may } -{ obtain a copy of the License at } -{ http://www.mozilla.org/MPL/MPL-1.1.html } -{ } -{ Software distributed under the License is distributed on an } -{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } -{ implied. See the License for the specific language governing } -{ rights and limitations under the License. } -{ } -{ Description } -{ ----------- } -{ } -{ } -{ } -{ } -{ } -{ } -{ } -{ Requires } -{ -------- } -{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } -{ They are available from... } -{ http://www.libsdl.org . } -{ } -{ Programming Notes } -{ ----------------- } -{ } -{ } -{ } -{ } -{ Revision History } -{ ---------------- } -{ September 23 2004 - DL : Initial Creation } -{ - $Log: sdlgameinterface.pas,v $ - Revision 1.3 2004/10/17 18:41:49 savage - Slight Change to allow Reseting of Input Event handlers - - Revision 1.2 2004/09/30 22:35:47 savage - Changes, enhancements and additions as required to get SoAoS working. - - -} -{******************************************************************************} - -interface - -uses - sdl, - sdlwindow; - -type - TGameInterfaceClass = class of TGameInterface; - - TGameInterface = class( TObject ) - private - FNextGameInterface : TGameInterfaceClass; - protected - Dragging : Boolean; - Loaded : Boolean; - procedure FreeSurfaces; virtual; - procedure Render; virtual; abstract; - procedure Close; virtual; - procedure Update( aElapsedTime : single ); virtual; - procedure MouseDown( Button : Integer; Shift: TSDLMod; MousePos : TPoint ); virtual; - procedure MouseMove( Shift: TSDLMod; CurrentPos : TPoint; RelativePos : TPoint ); virtual; - procedure MouseUp( Button : Integer; Shift: TSDLMod; MousePos : TPoint ); virtual; - procedure MouseWheelScroll( WheelDelta : Integer; Shift: TSDLMod; MousePos : TPoint ); virtual; - procedure KeyDown( var Key: TSDLKey; Shift: TSDLMod; unicode : UInt16 ); virtual; - public - MainWindow : TSDL2DWindow; - procedure ResetInputManager; - procedure LoadSurfaces; virtual; - function PointIsInRect( Point : TPoint; x, y, x1, y1 : integer ) : Boolean; - constructor Create( const aMainWindow : TSDL2DWindow ); - destructor Destroy; override; - property NextGameInterface : TGameInterfaceClass read FNextGameInterface write FNextGameInterface; - end; - -implementation - -{ TGameInterface } -procedure TGameInterface.Close; -begin - FNextGameInterface := nil; -end; - -constructor TGameInterface.Create( const aMainWindow : TSDL2DWindow ); -begin - inherited Create; - MainWindow := aMainWindow; - FNextGameInterface := TGameInterface; - ResetInputManager; -end; - -destructor TGameInterface.Destroy; -begin - if Loaded then - FreeSurfaces; - inherited; -end; - -procedure TGameInterface.FreeSurfaces; -begin - Loaded := False; -end; - -procedure TGameInterface.KeyDown(var Key: TSDLKey; Shift: TSDLMod; unicode: UInt16); -begin - -end; - -procedure TGameInterface.LoadSurfaces; -begin - Loaded := True; -end; - -procedure TGameInterface.MouseDown(Button: Integer; Shift: TSDLMod; MousePos: TPoint); -begin - Dragging := True; -end; - -procedure TGameInterface.MouseMove(Shift: TSDLMod; CurrentPos, RelativePos: TPoint); -begin - -end; - -procedure TGameInterface.MouseUp(Button: Integer; Shift: TSDLMod; MousePos: TPoint); -begin - Dragging := True; -end; - -procedure TGameInterface.MouseWheelScroll(WheelDelta: Integer; Shift: TSDLMod; MousePos: TPoint); -begin - -end; - -function TGameInterface.PointIsInRect( Point : TPoint; x, y, x1, y1: integer ): Boolean; -begin - if ( Point.x >= x ) - and ( Point.y >= y ) - and ( Point.x <= x1 ) - and ( Point.y <= y1 ) then - result := true - else - result := false; -end; - -procedure TGameInterface.ResetInputManager; -begin - MainWindow.InputManager.Mouse.OnMouseDown := MouseDown; - MainWindow.InputManager.Mouse.OnMouseMove := MouseMove; - MainWindow.InputManager.Mouse.OnMouseUp := MouseUp; - MainWindow.InputManager.Mouse.OnMouseWheel := MouseWheelScroll; - MainWindow.InputManager.KeyBoard.OnKeyDown := KeyDown; - MainWindow.OnRender := Render; - MainWindow.OnClose := Close; - MainWindow.OnUpdate := Update; -end; - -procedure TGameInterface.Update(aElapsedTime: single); -begin - -end; - -end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdli386utils.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdli386utils.pas deleted file mode 100644 index 9151168a..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdli386utils.pas +++ /dev/null @@ -1,5236 +0,0 @@ -unit sdli386utils; -{ - $Id: sdli386utils.pas,v 1.5 2004/06/02 19:38:53 savage Exp $ - -} -{******************************************************************************} -{ } -{ Borland Delphi SDL - Simple DirectMedia Layer } -{ SDL Utility functions } -{ } -{ } -{ The initial developer of this Pascal code was : } -{ Tom Jones } -{ } -{ Portions created by Tom Jones are } -{ Copyright (C) 2000 - 2001 Tom Jones. } -{ } -{ } -{ Contributor(s) } -{ -------------- } -{ Dominique Louis } -{ Róbert Kisnémeth } -{ } -{ Obtained through: } -{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } -{ } -{ You may retrieve the latest version of this file at the Project } -{ JEDI home page, located at http://delphi-jedi.org } -{ } -{ The contents of this file are used with permission, subject to } -{ the Mozilla Public License Version 1.1 (the "License"); you may } -{ not use this file except in compliance with the License. You may } -{ obtain a copy of the License at } -{ http://www.mozilla.org/MPL/MPL-1.1.html } -{ } -{ Software distributed under the License is distributed on an } -{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } -{ implied. See the License for the specific language governing } -{ rights and limitations under the License. } -{ } -{ Description } -{ ----------- } -{ Helper functions... } -{ } -{ } -{ Requires } -{ -------- } -{ SDL.dll on Windows platforms } -{ libSDL-1.1.so.0 on Linux platform } -{ } -{ Programming Notes } -{ ----------------- } -{ } -{ } -{ } -{ } -{ Revision History } -{ ---------------- } -{ 2000 - TJ : Initial creation } -{ } -{ July 13 2001 - DL : Added PutPixel and GetPixel routines. } -{ } -{ Sept 14 2001 - RK : Added flipping routines. } -{ } -{ Sept 19 2001 - RK : Added PutPixel & line drawing & blitting with ADD } -{ effect. Fixed a bug in SDL_PutPixel & SDL_GetPixel } -{ Added PSDLRect() } -{ Sept 22 2001 - DL : Removed need for Windows.pas by defining types here} -{ Also removed by poor attempt or a dialog box } -{ } -{ Sept 25 2001 - RK : Added PixelTest, NewPutPixel, SubPixel, SubLine, } -{ SubSurface, MonoSurface & TexturedSurface } -{ } -{ Sept 26 2001 - DL : Made change so that it refers to native Pascal } -{ types rather that Windows types. This makes it more} -{ portable to Linix. } -{ } -{ Sept 27 2001 - RK : SDLUtils now can be compiled with FreePascal } -{ } -{ Oct 27 2001 - JF : Added ScrollY function } -{ } -{ Jan 21 2002 - RK : Added SDL_ZoomSurface and SDL_WarpSurface } -{ } -{ Mar 28 2002 - JF : Added SDL_RotateSurface } -{ } -{ May 13 2002 - RK : Improved SDL_FillRectAdd & SDL_FillRectSub } -{ } -{ May 27 2002 - YS : GradientFillRect function } -{ } -{ May 30 2002 - RK : Added SDL_2xBlit, SDL_Scanline2xBlit } -{ & SDL_50Scanline2xBlit } -{ } -{ June 12 2002 - RK : Added SDL_PixelTestSurfaceVsRect } -{ } -{ June 12 2002 - JF : Updated SDL_PixelTestSurfaceVsRect } -{ } -{ November 9 2002 - JF : Added Jason's boolean Surface functions } -{ } -{ December 10 2002 - DE : Added Dean's SDL_ClipLine function } -{ } -{******************************************************************************} -{ - $Log: sdli386utils.pas,v $ - Revision 1.5 2004/06/02 19:38:53 savage - Changes to SDL_GradientFillRect as suggested by - Ángel Eduardo García Hernández. Many thanks. - - Revision 1.4 2004/05/29 23:11:53 savage - Changes to SDL_ScaleSurfaceRect as suggested by - Ángel Eduardo García Hernández to fix a colour issue with the function. Many thanks. - - Revision 1.3 2004/02/20 22:04:11 savage - Added Changes as mentioned by Rodrigo "Rui" R. (1/2 RRC2Soft) to facilitate FPC compilation and it also works in Delphi. Also syncronized the funcitons so that they are identical to sdlutils.pas, when no assembly version is available. - - Revision 1.2 2004/02/14 00:23:39 savage - As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. - - Revision 1.1 2004/02/05 00:08:20 savage - Module 1.0 release - - -} - -interface - -{$i jedi-sdl.inc} - -uses -{$IFDEF UNIX} - Types, - Xlib, -{$ENDIF} - SysUtils, - sdl; - -type - TGradientStyle = ( gsHorizontal, gsVertical ); - - // Pixel procedures -function SDL_PixelTest( SrcSurface1 : PSDL_Surface; SrcRect1 : PSDL_Rect; SrcSurface2 : - PSDL_Surface; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : Boolean; - -function SDL_GetPixel( SrcSurface : PSDL_Surface; x : cardinal; y : cardinal ) : Uint32; - -procedure SDL_PutPixel( SrcSurface : PSDL_Surface; x : integer; y : integer; Color : - cardinal ); - -procedure SDL_AddPixel( SrcSurface : PSDL_Surface; x : integer; y : integer; Color : - cardinal ); - -procedure SDL_SubPixel( SrcSurface : PSDL_Surface; x : integer; y : integer; Color : - cardinal ); - -// Line procedures -procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : - cardinal );overload; - -procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : - cardinal ; DashLength, DashSpace : byte ); overload; - -procedure SDL_AddLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : - cardinal ); - -procedure SDL_SubLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : - cardinal ); - -// Surface procedures -procedure SDL_AddSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DstSurface : PSDL_Surface; DestRect : PSDL_Rect ); - -procedure SDL_SubSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DstSurface : PSDL_Surface; DestRect : PSDL_Rect ); - -procedure SDL_MonoSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DstSurface : PSDL_Surface; DestRect : PSDL_Rect; Color : cardinal ); - -procedure SDL_TexturedSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DstSurface : PSDL_Surface; DestRect : PSDL_Rect; Texture : PSDL_Surface; - TextureRect : PSDL_Rect ); - -procedure SDL_ZoomSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; DstRect : PSDL_Rect ); - -procedure SDL_WarpSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; UL, UR, LR, LL : PPoint ); - -// Flip procedures -procedure SDL_FlipRectH( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); - -procedure SDL_FlipRectV( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); - -function PSDLRect( aLeft, aTop, aWidth, aHeight : integer ) : PSDL_Rect; - -function SDLRect( aLeft, aTop, aWidth, aHeight : integer ) : TSDL_Rect; overload; - -function SDLRect( aRect : TRect ) : TSDL_Rect; overload; - -function SDL_ScaleSurfaceRect( SrcSurface : PSDL_Surface; SrcX1, SrcY1, SrcW, SrcH, - Width, Height : integer ) : PSDL_Surface; - -procedure SDL_ScrollY( DstSurface : PSDL_Surface; DifY : integer ); - -procedure SDL_ScrollX( DstSurface : PSDL_Surface; DifX : integer ); - -procedure SDL_RotateDeg( DstSurface, SrcSurface : PSDL_Surface; SrcRect : - PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Integer ); - -procedure SDL_RotateRad( DstSurface, SrcSurface : PSDL_Surface; SrcRect : - PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Single ); - -function ValidateSurfaceRect( DstSurface : PSDL_Surface; dstrect : PSDL_Rect ) : TSDL_Rect; - -// Fill Rect routine -procedure SDL_FillRectAdd( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); - -procedure SDL_FillRectSub( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); - -procedure SDL_GradientFillRect( DstSurface : PSDL_Surface; const Rect : PSDL_Rect; const StartColor, EndColor : TSDL_Color; const Style : TGradientStyle ); - -// NOTE for All SDL_2xblit... function : the dest surface must be 2x of the source surface! -procedure SDL_2xBlit( Src, Dest : PSDL_Surface ); - -procedure SDL_Scanline2xBlit( Src, Dest : PSDL_Surface ); - -procedure SDL_50Scanline2xBlit( Src, Dest : PSDL_Surface ); - -function SDL_PixelTestSurfaceVsRect( SrcSurface1 : PSDL_Surface; SrcRect1 : -PSDL_Rect; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : -boolean; - -// Jason's boolean Surface functions -procedure SDL_ORSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); - -procedure SDL_ANDSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); - -procedure SDL_GTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); - -procedure SDL_LTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); - -function SDL_ClipLine(var x1,y1,x2,y2: Integer; ClipRect: PSDL_Rect) : boolean; - -implementation - -uses - Math; - -function SDL_PixelTest( SrcSurface1 : PSDL_Surface; SrcRect1 : PSDL_Rect; SrcSurface2 : - PSDL_Surface; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : boolean; -var - Src_Rect1, Src_Rect2 : TSDL_Rect; - right1, bottom1 : integer; - right2, bottom2 : integer; - Scan1Start, Scan2Start, ScanWidth, ScanHeight : cardinal; - Mod1, Mod2 : cardinal; - Addr1, Addr2 : cardinal; - BPP : cardinal; - Pitch1, Pitch2 : cardinal; - TransparentColor1, TransparentColor2 : cardinal; - tx, ty : cardinal; - StartTick : cardinal; - Color1, Color2 : cardinal; -begin - Result := false; - if SrcRect1 = nil then - begin - with Src_Rect1 do - begin - x := 0; - y := 0; - w := SrcSurface1.w; - h := SrcSurface1.h; - end; - end - else - Src_Rect1 := SrcRect1^; - if SrcRect2 = nil then - begin - with Src_Rect2 do - begin - x := 0; - y := 0; - w := SrcSurface2.w; - h := SrcSurface2.h; - end; - end - else - Src_Rect2 := SrcRect2^; - with Src_Rect1 do - begin - Right1 := Left1 + w; - Bottom1 := Top1 + h; - end; - with Src_Rect2 do - begin - Right2 := Left2 + w; - Bottom2 := Top2 + h; - end; - if ( Left1 >= Right2 ) or ( Right1 <= Left2 ) or ( Top1 >= Bottom2 ) or ( Bottom1 <= - Top2 ) then - exit; - if Left1 <= Left2 then - begin - // 1. left, 2. right - Scan1Start := Src_Rect1.x + Left2 - Left1; - Scan2Start := Src_Rect2.x; - ScanWidth := Right1 - Left2; - with Src_Rect2 do - if ScanWidth > w then - ScanWidth := w; - end - else - begin - // 1. right, 2. left - Scan1Start := Src_Rect1.x; - Scan2Start := Src_Rect2.x + Left1 - Left2; - ScanWidth := Right2 - Left1; - with Src_Rect1 do - if ScanWidth > w then - ScanWidth := w; - end; - with SrcSurface1^ do - begin - Pitch1 := Pitch; - Addr1 := cardinal( Pixels ); - inc( Addr1, Pitch1 * UInt32( Src_Rect1.y ) ); - with format^ do - begin - BPP := BytesPerPixel; - TransparentColor1 := colorkey; - end; - end; - with SrcSurface2^ do - begin - TransparentColor2 := format.colorkey; - Pitch2 := Pitch; - Addr2 := cardinal( Pixels ); - inc( Addr2, Pitch2 * UInt32( Src_Rect2.y ) ); - end; - Mod1 := Pitch1 - ( ScanWidth * BPP ); - Mod2 := Pitch2 - ( ScanWidth * BPP ); - inc( Addr1, BPP * Scan1Start ); - inc( Addr2, BPP * Scan2Start ); - if Top1 <= Top2 then - begin - // 1. up, 2. down - ScanHeight := Bottom1 - Top2; - if ScanHeight > Src_Rect2.h then - ScanHeight := Src_Rect2.h; - inc( Addr1, Pitch1 * UInt32( Top2 - Top1 ) ); - end - else - begin - // 1. down, 2. up - ScanHeight := Bottom2 - Top1; - if ScanHeight > Src_Rect1.h then - ScanHeight := Src_Rect1.h; - inc( Addr2, Pitch2 * UInt32( Top1 - Top2 ) ); - end; - case BPP of - 1 : - for ty := 1 to ScanHeight do - begin - for tx := 1 to ScanWidth do - begin - if ( PByte( Addr1 )^ <> TransparentColor1 ) and ( PByte( Addr2 )^ <> - TransparentColor2 ) then - begin - Result := true; - exit; - end; - inc( Addr1 ); - inc( Addr2 ); - end; - inc( Addr1, Mod1 ); - inc( Addr2, Mod2 ); - end; - 2 : - for ty := 1 to ScanHeight do - begin - for tx := 1 to ScanWidth do - begin - if ( PWord( Addr1 )^ <> TransparentColor1 ) and ( PWord( Addr2 )^ <> - TransparentColor2 ) then - begin - Result := true; - exit; - end; - inc( Addr1, 2 ); - inc( Addr2, 2 ); - end; - inc( Addr1, Mod1 ); - inc( Addr2, Mod2 ); - end; - 3 : - for ty := 1 to ScanHeight do - begin - for tx := 1 to ScanWidth do - begin - Color1 := PLongWord( Addr1 )^ and $00FFFFFF; - Color2 := PLongWord( Addr2 )^ and $00FFFFFF; - if ( Color1 <> TransparentColor1 ) and ( Color2 <> TransparentColor2 ) - then - begin - Result := true; - exit; - end; - inc( Addr1, 3 ); - inc( Addr2, 3 ); - end; - inc( Addr1, Mod1 ); - inc( Addr2, Mod2 ); - end; - 4 : - for ty := 1 to ScanHeight do - begin - for tx := 1 to ScanWidth do - begin - if ( PLongWord( Addr1 )^ <> TransparentColor1 ) and ( PLongWord( Addr2 )^ <> - TransparentColor2 ) then - begin - Result := true; - exit; - end; - inc( Addr1, 4 ); - inc( Addr2, 4 ); - end; - inc( Addr1, Mod1 ); - inc( Addr2, Mod2 ); - end; - end; -end; - -function SDL_GetPixel( SrcSurface : PSDL_Surface; x : cardinal; y : cardinal ) : Uint32; -var - bpp : UInt32; - p : PInteger; -begin - bpp := SrcSurface.format.BytesPerPixel; - // Here p is the address to the pixel we want to retrieve - p := Pointer( Uint32( SrcSurface.pixels ) + UInt32( y ) * SrcSurface.pitch + UInt32( x ) * - bpp ); - case bpp of - 1 : result := PUint8( p )^; - 2 : result := PUint16( p )^; - 3 : - if ( SDL_BYTEORDER = SDL_BIG_ENDIAN ) then - result := PUInt8Array( p )[ 0 ] shl 16 or PUInt8Array( p )[ 1 ] shl 8 or - PUInt8Array( p )[ 2 ] - else - result := PUInt8Array( p )[ 0 ] or PUInt8Array( p )[ 1 ] shl 8 or - PUInt8Array( p )[ 2 ] shl 16; - 4 : result := PUint32( p )^; - else - result := 0; // shouldn't happen, but avoids warnings - end; -end; - -procedure SDL_PutPixel( SrcSurface : PSDL_Surface; x : integer; y : integer; Color : - cardinal ); -var - Addr, Pitch, BPP : cardinal; -begin - Addr := cardinal( SrcSurface.Pixels ); - Pitch := SrcSurface.Pitch; - BPP := SrcSurface.format.BytesPerPixel; - asm - mov eax, y - mul Pitch // EAX := y * Pitch - add Addr, eax // Addr:= Addr + (y * Pitch) - mov eax, x - mov ecx, Color - cmp BPP, 1 - jne @Not1BPP - add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x - mov [eax], cl - jmp @Quit - @Not1BPP: - cmp BPP, 2 - jne @Not2BPP - mul BPP // EAX := x * BPP - add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x * BPP - mov [eax], cx - jmp @Quit - @Not2BPP: - cmp BPP, 3 - jne @Not3BPP - mul BPP // EAX := x * BPP - add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x * BPP - mov edx, [eax] - and edx, $ff000000 - or edx, ecx - mov [eax], edx - jmp @Quit - @Not3BPP: - mul BPP // EAX := x * BPP - add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x * BPP - mov [eax], ecx - @Quit: - end; -end; - -procedure SDL_AddPixel( SrcSurface : PSDL_Surface; x : integer; y : integer; Color : - cardinal ); -var - SrcColor, FinalColor : cardinal; - Addr, Pitch, Bits : cardinal; -begin - if Color = 0 then - exit; - Addr := cardinal( SrcSurface.Pixels ); - Pitch := SrcSurface.Pitch; - Bits := SrcSurface.format.BitsPerPixel; - asm - mov eax, y - mul Pitch // EAX := y * Pitch - add Addr, eax // Addr:= Addr + (y * Pitch) - mov eax, x - cmp Bits, 8 - jne @Not8bit - add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x - mov cl, [eax] - movzx ecx, cl - mov SrcColor, ecx - mov edx, Color - and ecx, 3 - and edx, 3 - add ecx, edx - cmp ecx, 3 - jbe @Skip1_8bit - mov ecx, 3 - @Skip1_8bit: - mov FinalColor, ecx - mov ecx, SrcColor - mov edx, Color - and ecx, $1c - and edx, $1c - add ecx, edx - cmp ecx, $1c - jbe @Skip2_8bit - mov ecx, $1c - @Skip2_8bit: - or FinalColor, ecx - mov ecx, SrcColor - mov edx, Color - and ecx, $e0 - and edx, $e0 - add ecx, edx - cmp ecx, $e0 - jbe @Skip3_8bit - mov ecx, $e0 - @Skip3_8bit: - or ecx, FinalColor - mov [eax], cl - jmp @Quit - @Not8bit: - cmp Bits, 15 - jne @Not15bit - shl eax, 1 - add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x * 2 - mov ecx, [eax] - and ecx, $00007fff - mov SrcColor, ecx - mov edx, Color - and ecx, $1f - and edx, $1f - add ecx, edx - cmp ecx, $1f - jbe @Skip1_15bit - mov ecx, $1f - @Skip1_15bit: - mov FinalColor, ecx - mov ecx, SrcColor - mov edx, Color - and ecx, $03e0 - and edx, $03e0 - add ecx, edx - cmp ecx, $03e0 - jbe @Skip2_15bit - mov ecx, $03e0 - @Skip2_15bit: - or FinalColor, ecx - mov ecx, SrcColor - mov edx, Color - and ecx, $7c00 - and edx, $7c00 - add ecx, edx - cmp ecx, $7c00 - jbe @Skip3_15bit - mov ecx, $7c00 - @Skip3_15bit: - or ecx, FinalColor - mov [eax], cx - jmp @Quit - @Not15Bit: - cmp Bits, 16 - jne @Not16bit - shl eax, 1 - add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x * 2 - mov ecx, [eax] - and ecx, $0000ffff - mov SrcColor, ecx - mov edx, Color - and ecx, $1f - and edx, $1f - add ecx, edx - cmp ecx, $1f - jbe @Skip1_16bit - mov ecx, $1f - @Skip1_16bit: - mov FinalColor, ecx - mov ecx, SrcColor - mov edx, Color - and ecx, $07e0 - and edx, $07e0 - add ecx, edx - cmp ecx, $07e0 - jbe @Skip2_16bit - mov ecx, $07e0 - @Skip2_16bit: - or FinalColor, ecx - mov ecx, SrcColor - mov edx, Color - and ecx, $f800 - and edx, $f800 - add ecx, edx - cmp ecx, $f800 - jbe @Skip3_16bit - mov ecx, $f800 - @Skip3_16bit: - or ecx, FinalColor - mov [eax], cx - jmp @Quit - @Not16Bit: - cmp Bits, 24 - jne @Not24bit - mov ecx, 0 - add ecx, eax - shl ecx, 1 - add ecx, eax - mov eax, ecx - jmp @32bit - @Not24bit: - shl eax, 2 - @32bit: - add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x * 2 - mov ecx, [eax] - mov FinalColor, ecx - and FinalColor, $ff000000 - and ecx, $00ffffff - mov SrcColor, ecx - mov edx, Color - and ecx, $000000ff - and edx, $000000ff - add ecx, edx - cmp ecx, $000000ff - jbe @Skip1_32bit - mov ecx, $000000ff - @Skip1_32bit: - or FinalColor, ecx - mov ecx, SrcColor - mov edx, Color - and ecx, $0000ff00 - and edx, $0000ff00 - add ecx, edx - cmp ecx, $0000ff00 - jbe @Skip2_32bit - mov ecx, $0000ff00 - @Skip2_32bit: - or FinalColor, ecx - mov ecx, SrcColor - mov edx, Color - and ecx, $00ff0000 - and edx, $00ff0000 - add ecx, edx - cmp ecx, $00ff0000 - jbe @Skip3_32bit - mov ecx, $00ff0000 - @Skip3_32bit: - or ecx, FinalColor - mov [eax], ecx - @Quit: - end; -end; - -procedure SDL_SubPixel( SrcSurface : PSDL_Surface; x : integer; y : integer; Color : - cardinal ); -var - SrcColor, FinalColor : cardinal; - Addr, Pitch, Bits : cardinal; -begin - if Color = 0 then - exit; - Addr := cardinal( SrcSurface.Pixels ); - Pitch := SrcSurface.Pitch; - Bits := SrcSurface.format.BitsPerPixel; - asm - mov eax, y - mul Pitch // EAX := y * Pitch - add Addr, eax // Addr:= Addr + (y * Pitch) - mov eax, x - cmp Bits, 8 - jne @Not8bit - add eax, Addr // Now: EAX:= Addr + (y * Pitch) + x - mov cl, [eax] - movzx ecx, cl - mov SrcColor, ecx - mov edx, Color - and ecx, 3 - and edx, 3 - sub ecx, edx - jns @Skip1_8bit - mov ecx, 0 - @Skip1_8bit: - mov FinalColor, ecx - mov ecx, SrcColor - mov edx, Color - and ecx, $1c - and edx, $1c - sub ecx, edx - jns @Skip2_8bit - mov ecx, 0 - @Skip2_8bit: - or FinalColor, ecx - mov ecx, SrcColor - mov edx, Color - and ecx, $e0 - and edx, $e0 - sub ecx, edx - jns @Skip3_8bit - mov ecx, 0 - @Skip3_8bit: - or ecx, FinalColor - mov [eax], cl - jmp @Quit - @Not8bit: - cmp Bits, 15 - jne @Not15bit - shl eax, 1 - add eax, Addr - mov ecx, [eax] - and ecx, $00007fff - mov SrcColor, ecx - mov edx, Color - and ecx, $1f - and edx, $1f - sub ecx, edx - jns @Skip1_15bit - mov ecx, 0 - @Skip1_15bit: - mov FinalColor, ecx - mov ecx, SrcColor - mov edx, Color - and ecx, $03e0 - and edx, $03e0 - sub ecx, edx - jns @Skip2_15bit - mov ecx, 0 - @Skip2_15bit: - or FinalColor, ecx - mov ecx, SrcColor - mov edx, Color - and ecx, $7c00 - and edx, $7c00 - sub ecx, edx - jns @Skip3_15bit - mov ecx, 0 - @Skip3_15bit: - or ecx, FinalColor - mov [eax], cx - jmp @Quit - @Not15Bit: - cmp Bits, 16 - jne @Not16bit - shl eax, 1 - add eax, Addr - mov ecx, [eax] - and ecx, $0000ffff - mov SrcColor, ecx - mov edx, Color - and ecx, $1f - and edx, $1f - sub ecx, edx - jns @Skip1_16bit - mov ecx, 0 - @Skip1_16bit: - mov FinalColor, ecx - mov ecx, SrcColor - mov edx, Color - and ecx, $07e0 - and edx, $07e0 - sub ecx, edx - jns @Skip2_16bit - mov ecx, 0 - @Skip2_16bit: - or FinalColor, ecx - mov ecx, SrcColor - mov edx, Color - and ecx, $f800 - and edx, $f800 - sub ecx, edx - jns @Skip3_16bit - mov ecx, 0 - @Skip3_16bit: - or ecx, FinalColor - mov [eax], cx - jmp @Quit - @Not16Bit: - cmp Bits, 24 - jne @Not24bit - mov ecx, 0 - add ecx, eax - shl ecx, 1 - add ecx, eax - mov eax, ecx - jmp @32bit - @Not24bit: - shl eax, 2 - @32bit: - add eax, Addr - mov ecx, [eax] - mov FinalColor, ecx - and FinalColor, $ff000000 - and ecx, $00ffffff - mov SrcColor, ecx - mov edx, Color - and ecx, $000000ff - and edx, $000000ff - sub ecx, edx - jns @Skip1_32bit - mov ecx, 0 - @Skip1_32bit: - or FinalColor, ecx - mov ecx, SrcColor - mov edx, Color - and ecx, $0000ff00 - and edx, $0000ff00 - sub ecx, edx - jns @Skip2_32bit - mov ecx, 0 - @Skip2_32bit: - or FinalColor, ecx - mov ecx, SrcColor - mov edx, Color - and ecx, $00ff0000 - and edx, $00ff0000 - sub ecx, edx - jns @Skip3_32bit - mov ecx, 0 - @Skip3_32bit: - or ecx, FinalColor - mov [eax], ecx - @Quit: - end; -end; - -// Draw a line between x1,y1 and x2,y2 to the given surface -// NOTE: The surface must be locked before calling this! -procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : - cardinal ); -var - dx, dy, sdx, sdy, x, y, px, py : integer; -begin - dx := x2 - x1; - dy := y2 - y1; - if dx < 0 then - sdx := -1 - else - sdx := 1; - if dy < 0 then - sdy := -1 - else - sdy := 1; - dx := sdx * dx + 1; - dy := sdy * dy + 1; - x := 0; - y := 0; - px := x1; - py := y1; - if dx >= dy then - begin - for x := 0 to dx - 1 do - begin - SDL_PutPixel( DstSurface, px, py, Color ); - y := y + dy; - if y >= dx then - begin - y := y - dx; - py := py + sdy; - end; - px := px + sdx; - end; - end - else - begin - for y := 0 to dy - 1 do - begin - SDL_PutPixel( DstSurface, px, py, Color ); - x := x + dx; - if x >= dy then - begin - x := x - dy; - px := px + sdx; - end; - py := py + sdy; - end; - end; -end; - -// Draw a dashed line between x1,y1 and x2,y2 to the given surface -// NOTE: The surface must be locked before calling this! -procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : - cardinal ; DashLength, DashSpace : byte ); overload; -var - dx, dy, sdx, sdy, x, y, px, py, counter : integer; drawdash : boolean; -begin - counter := 0; - drawdash := true; //begin line drawing with dash - - //Avoid invalid user-passed dash parameters - if (DashLength < 1) - then DashLength := 1; - if (DashSpace < 1) - then DashSpace := 0; - - dx := x2 - x1; - dy := y2 - y1; - if dx < 0 then - sdx := -1 - else - sdx := 1; - if dy < 0 then - sdy := -1 - else - sdy := 1; - dx := sdx * dx + 1; - dy := sdy * dy + 1; - x := 0; - y := 0; - px := x1; - py := y1; - if dx >= dy then - begin - for x := 0 to dx - 1 do - begin - - //Alternate drawing dashes, or leaving spaces - if drawdash then - begin - SDL_PutPixel( DstSurface, px, py, Color ); - inc(counter); - if (counter > DashLength-1) and (DashSpace > 0) then - begin - drawdash := false; - counter := 0; - end; - end - else //space - begin - inc(counter); - if counter > DashSpace-1 then - begin - drawdash := true; - counter := 0; - end; - end; - - y := y + dy; - if y >= dx then - begin - y := y - dx; - py := py + sdy; - end; - px := px + sdx; - end; - end - else - begin - for y := 0 to dy - 1 do - begin - - //Alternate drawing dashes, or leaving spaces - if drawdash then - begin - SDL_PutPixel( DstSurface, px, py, Color ); - inc(counter); - if (counter > DashLength-1) and (DashSpace > 0) then - begin - drawdash := false; - counter := 0; - end; - end - else //space - begin - inc(counter); - if counter > DashSpace-1 then - begin - drawdash := true; - counter := 0; - end; - end; - - x := x + dx; - if x >= dy then - begin - x := x - dy; - px := px + sdx; - end; - py := py + sdy; - end; - end; -end; - -procedure SDL_AddLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : - cardinal ); -var - dx, dy, sdx, sdy, x, y, px, py : integer; -begin - dx := x2 - x1; - dy := y2 - y1; - if dx < 0 then - sdx := -1 - else - sdx := 1; - if dy < 0 then - sdy := -1 - else - sdy := 1; - dx := sdx * dx + 1; - dy := sdy * dy + 1; - x := 0; - y := 0; - px := x1; - py := y1; - if dx >= dy then - begin - for x := 0 to dx - 1 do - begin - SDL_AddPixel( DstSurface, px, py, Color ); - y := y + dy; - if y >= dx then - begin - y := y - dx; - py := py + sdy; - end; - px := px + sdx; - end; - end - else - begin - for y := 0 to dy - 1 do - begin - SDL_AddPixel( DstSurface, px, py, Color ); - x := x + dx; - if x >= dy then - begin - x := x - dy; - px := px + sdx; - end; - py := py + sdy; - end; - end; -end; - -procedure SDL_SubLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : - cardinal ); -var - dx, dy, sdx, sdy, x, y, px, py : integer; -begin - dx := x2 - x1; - dy := y2 - y1; - if dx < 0 then - sdx := -1 - else - sdx := 1; - if dy < 0 then - sdy := -1 - else - sdy := 1; - dx := sdx * dx + 1; - dy := sdy * dy + 1; - x := 0; - y := 0; - px := x1; - py := y1; - if dx >= dy then - begin - for x := 0 to dx - 1 do - begin - SDL_SubPixel( DstSurface, px, py, Color ); - y := y + dy; - if y >= dx then - begin - y := y - dx; - py := py + sdy; - end; - px := px + sdx; - end; - end - else - begin - for y := 0 to dy - 1 do - begin - SDL_SubPixel( DstSurface, px, py, Color ); - x := x + dx; - if x >= dy then - begin - x := x - dy; - px := px + sdx; - end; - py := py + sdy; - end; - end; -end; - -// This procedure works on 8, 15, 16, 24 and 32 bits color depth surfaces. -// In 8 bit color depth mode the procedure works with the default packed -// palette (RRRGGGBB). It handles all clipping. -procedure SDL_AddSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DstSurface : PSDL_Surface; DestRect : PSDL_Rect ); -var - Src, Dest : TSDL_Rect; - Diff : integer; - SrcAddr, DestAddr : cardinal; - // TransparentColor: cardinal; - _ebx, _esi, _edi, _esp : cardinal; - WorkX, WorkY : word; - SrcMod, DestMod : cardinal; - Bits : cardinal; -begin - if ( SrcSurface = nil ) or ( DstSurface = nil ) then - exit; // Remove this to make it faster - if ( SrcSurface.Format.BitsPerPixel <> DstSurface.Format.BitsPerPixel ) then - exit; // Remove this to make it faster - if SrcRect = nil then - begin - with Src do - begin - x := 0; - y := 0; - w := SrcSurface.w; - h := SrcSurface.h; - end; - end - else - Src := SrcRect^; - if DestRect = nil then - begin - Dest.x := 0; - Dest.y := 0; - end - else - Dest := DestRect^; - Dest.w := Src.w; - Dest.h := Src.h; - with DstSurface.Clip_Rect do - begin - // Source's right side is greater than the dest.cliprect - if Dest.x + Src.w > x + w then - begin - smallint( Src.w ) := x + w - Dest.x; - smallint( Dest.w ) := x + w - Dest.x; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's bottom side is greater than the dest.clip - if Dest.y + Src.h > y + h then - begin - smallint( Src.h ) := y + h - Dest.y; - smallint( Dest.h ) := y + h - Dest.y; - if smallint( Dest.h ) < 1 then - exit; - end; - // Source's left side is less than the dest.clip - if Dest.x < x then - begin - Diff := x - Dest.x; - Src.x := Src.x + Diff; - smallint( Src.w ) := smallint( Src.w ) - Diff; - Dest.x := x; - smallint( Dest.w ) := smallint( Dest.w ) - Diff; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's Top side is less than the dest.clip - if Dest.y < y then - begin - Diff := y - Dest.y; - Src.y := Src.y + Diff; - smallint( Src.h ) := smallint( Src.h ) - Diff; - Dest.y := y; - smallint( Dest.h ) := smallint( Dest.h ) - Diff; - if smallint( Dest.h ) < 1 then - exit; - end; - end; - with SrcSurface^ do - begin - SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * - Format.BytesPerPixel; - SrcMod := Pitch - Src.w * Format.BytesPerPixel; - // TransparentColor := format.ColorKey; - end; - with DstSurface^ do - begin - DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * - Format.BytesPerPixel; - DestMod := Pitch - Dest.w * Format.BytesPerPixel; - Bits := Format.BitsPerPixel; - end; - SDL_LockSurface( SrcSurface ); - SDL_LockSurface( DstSurface ); - case bits of - 8 : - asm - mov _ebx, ebx - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - @Loopx: - mov al, [esi] // AL := source color - cmp al, 0 - je @SkipColor // if AL=0 or AL=transparent color then skip everything - mov esp, eax // ESP - source color - mov bl, [edi] // BL := destination color - mov dl, bl // DL := destination color - and ax, $03 // Adding BLUE - and bl, $03 - add al, bl - cmp al, $03 - jbe @Skip1 - mov al, $03 - @Skip1: - mov cl, al - mov eax, esp // Adding GREEN - mov bl, dl - and al, $1c - and bl, $1c - add al, bl - cmp al, $1c - jbe @Skip2 - mov al, $1c - @Skip2: - or cl, al - mov eax, esp // Adding RED - mov bl, dl - and ax, $e0 - and bx, $e0 - add ax, bx - cmp ax, $e0 - jbe @Skip3 - mov al, $e0 - @Skip3: - or cl, al - mov [edi], cl - @SkipColor: - inc esi - inc edi - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - mov ebx,_ebx - end; - 15 : - asm - mov _ebx, ebx - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - @Loopx: - mov ax, [esi] // AX := source color - cmp ax, 0 - je @SkipColor // if AX=0 then skip everything - mov esp, eax // ESP - source color - mov bx, [edi] // BX := destination color - mov dx, bx // DX := destination color - and ax, $001F // Adding BLUE - and bx, $001F - add ax, bx - cmp ax, $001F - jbe @Skip1 - mov ax, $001F - @Skip1: - mov cx, ax - mov eax, esp // Adding GREEN - mov bx, dx - and ax, $3E0 - and bx, $3E0 - add ax, bx - cmp ax, $3E0 - jbe @Skip2 - mov ax, $3E0 - @Skip2: - or cx, ax - mov eax, esp // Adding RED - mov bx, dx - and ax, $7C00 - and bx, $7C00 - add ax, bx - cmp ax, $7C00 - jbe @Skip3 - mov ax, $7C00 - @Skip3: - or cx, ax - mov [edi], cx - @SkipColor: - add esi, 2 - add edi, 2 - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - mov ebx,_ebx - end; - 16 : - asm - mov _ebx, ebx - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - @Loopx: - mov ax, [esi] // AX := source color - cmp ax, 0 - je @SkipColor // if AX=0 then skip everything - mov esp, eax // ESP - source color - mov bx, [edi] // BX := destination color - mov dx, bx // DX := destination color - and ax, $1F // Adding BLUE - and bx, $1F - add ax, bx - cmp ax, $1F - jbe @Skip1 - mov ax, $1F - @Skip1: - mov cx, ax - mov eax, esp // Adding GREEN - mov bx, dx - and ax, $7E0 - and bx, $7E0 - add ax, bx - cmp ax, $7E0 - jbe @Skip2 - mov ax, $7E0 - @Skip2: - or cx, ax - mov eax, esp // Adding RED - mov bx, dx - and eax, $F800 - and ebx, $F800 - add eax, ebx - cmp eax, $F800 - jbe @Skip3 - mov ax, $F800 - @Skip3: - or cx, ax - mov [edi], cx - @SkipColor: - add esi, 2 - add edi, 2 - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - mov ebx,_ebx - end; - 24 : - asm - mov _ebx, ebx - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - add WorkX, ax // WorkX := Src.w * 2 - add WorkX, ax // WorkX := Src.w * 3 - @Loopx: - mov bl, [edi] // BX := destination color - mov al, [esi] // AX := source color - cmp al, 0 - je @Skip // if AL=0 then skip COMPONENT - mov ah, 0 // AX := COLOR COMPONENT - mov bh, 0 - add bx, ax - cmp bx, $00ff - jb @Skip - mov bl, $ff - @Skip: - mov [edi], bl - inc esi - inc edi - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - mov ebx,_ebx - end; - 32 : - asm - mov _ebx, ebx - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - shl ax, 2 - mov WorkX, ax // WorkX := Src.w * 4 - @Loopx: - mov bl, [edi] // BX := destination color - mov al, [esi] // AX := source color - cmp al, 0 - je @Skip // if AL=0 then skip COMPONENT - mov ah, 0 // AX := COLOR COMPONENT - mov bh, 0 - add bx, ax - cmp bx, $00ff - jb @Skip - mov bl, $ff - @Skip: - mov [edi], bl - inc esi - inc edi - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - mov ebx,_ebx - end; - end; - SDL_UnlockSurface( SrcSurface ); - SDL_UnlockSurface( DstSurface ); -end; - -procedure SDL_SubSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DstSurface : PSDL_Surface; DestRect : PSDL_Rect ); -var - Src, Dest : TSDL_Rect; - Diff : integer; - SrcAddr, DestAddr : cardinal; - _ebx, _esi, _edi, _esp : cardinal; - WorkX, WorkY : word; - SrcMod, DestMod : cardinal; - Bits : cardinal; -begin - if ( SrcSurface = nil ) or ( DstSurface = nil ) then - exit; // Remove this to make it faster - if ( SrcSurface.Format.BitsPerPixel <> DstSurface.Format.BitsPerPixel ) then - exit; // Remove this to make it faster - if SrcRect = nil then - begin - with Src do - begin - x := 0; - y := 0; - w := SrcSurface.w; - h := SrcSurface.h; - end; - end - else - Src := SrcRect^; - if DestRect = nil then - begin - Dest.x := 0; - Dest.y := 0; - end - else - Dest := DestRect^; - Dest.w := Src.w; - Dest.h := Src.h; - with DstSurface.Clip_Rect do - begin - // Source's right side is greater than the dest.cliprect - if Dest.x + Src.w > x + w then - begin - smallint( Src.w ) := x + w - Dest.x; - smallint( Dest.w ) := x + w - Dest.x; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's bottom side is greater than the dest.clip - if Dest.y + Src.h > y + h then - begin - smallint( Src.h ) := y + h - Dest.y; - smallint( Dest.h ) := y + h - Dest.y; - if smallint( Dest.h ) < 1 then - exit; - end; - // Source's left side is less than the dest.clip - if Dest.x < x then - begin - Diff := x - Dest.x; - Src.x := Src.x + Diff; - smallint( Src.w ) := smallint( Src.w ) - Diff; - Dest.x := x; - smallint( Dest.w ) := smallint( Dest.w ) - Diff; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's Top side is less than the dest.clip - if Dest.y < y then - begin - Diff := y - Dest.y; - Src.y := Src.y + Diff; - smallint( Src.h ) := smallint( Src.h ) - Diff; - Dest.y := y; - smallint( Dest.h ) := smallint( Dest.h ) - Diff; - if smallint( Dest.h ) < 1 then - exit; - end; - end; - with SrcSurface^ do - begin - SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * - Format.BytesPerPixel; - SrcMod := Pitch - Src.w * Format.BytesPerPixel; - end; - with DstSurface^ do - begin - DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * - Format.BytesPerPixel; - DestMod := Pitch - Dest.w * Format.BytesPerPixel; - Bits := DstSurface.Format.BitsPerPixel; - end; - SDL_LockSurface( SrcSurface ); - SDL_LockSurface( DstSurface ); - case bits of - 8 : - asm - mov _ebx, ebx - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - @Loopx: - mov al, [esi] // AL := source color - cmp al, 0 - je @SkipColor // if AL=0 then skip everything - mov esp, eax // ESP - source color - mov bl, [edi] // BL := destination color - mov dl, bl // DL := destination color - and al, $03 // Subtract BLUE - and bl, $03 - sub bl, al - jns @Skip1 - mov bl, 0 - @Skip1: - mov cl, bl - mov eax, esp // Subtract GREEN - mov bl, dl - and al, $1c - and bl, $1c - sub bl, al - jns @Skip2 - mov bl, 0 - @Skip2: - or cl, bl - mov eax, esp // Subtract RED - mov bl, dl - and ax, $e0 - and bx, $e0 - sub bx, ax - jns @Skip3 - mov bl, 0 - @Skip3: - or cl, bl - mov [edi], cl - @SkipColor: - inc esi - inc edi - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - mov ebx,_ebx - end; - 15 : - asm - mov _ebx, ebx - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - @Loopx: - mov ax, [esi] // AX := source color - cmp ax, 0 - je @SkipColor // if AX=0 then skip everything - mov esp, eax // ESP - source color - mov bx, [edi] // BX := destination color - mov dx, bx // DX := destination color - and ax, $001F // Subtract BLUE - and bx, $001F - sub bx, ax - jns @Skip1 - mov bx, 0 - @Skip1: - mov cx, bx - mov eax, esp // Subtract GREEN - mov bx, dx - and ax, $3E0 - and bx, $3E0 - sub bx, ax - jns @Skip2 - mov bx, 0 - @Skip2: - or cx, bx - mov eax, esp // Subtract RED - mov bx, dx - and ax, $7C00 - and bx, $7C00 - sub bx, ax - jns @Skip3 - mov bx, 0 - @Skip3: - or cx, bx - mov [edi], cx - @SkipColor: - add esi, 2 - add edi, 2 - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - mov ebx,_ebx - end; - 16 : - asm - mov _ebx, ebx - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - @Loopx: - mov ax, [esi] // AX := source color - cmp ax, 0 - je @SkipColor // if AX=0 then skip everything - mov esp, eax // ESP - source color - mov bx, [edi] // BX := destination color - mov dx, bx // DX := destination color - and ax, $1F // Subtracting BLUE - and bx, $1F - sub bx, ax - jns @Skip1 - mov bx, 0 - @Skip1: - mov cx, bx - mov eax, esp // Adding GREEN - mov bx, dx - and ax, $7E0 - and bx, $7E0 - sub bx, ax - jns @Skip2 - mov bx, 0 - @Skip2: - or cx, bx - mov eax, esp // Adding RED - mov bx, dx - and eax, $F800 - and ebx, $F800 - sub ebx, eax - jns @Skip3 - mov bx, 0 - @Skip3: - or cx, bx - mov [edi], cx - @SkipColor: - add esi, 2 - add edi, 2 - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - mov ebx,_ebx - end; - 24 : - asm - mov _ebx, ebx - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - add WorkX, ax // WorkX := Src.w * 2 - add WorkX, ax // WorkX := Src.w * 3 - @Loopx: - mov bl, [edi] // BX := destination color - mov al, [esi] // AX := source color - cmp al, 0 - je @Skip // if AL=0 then skip COMPONENT - mov ah, 0 // AX := COLOR COMPONENT - mov bh, 0 - sub bx, ax - jns @Skip - mov bl, 0 - @Skip: - mov [edi], bl - inc esi - inc edi - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - mov ebx,_ebx - end; - 32 : - asm - mov _ebx, ebx - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - shl ax, 2 - mov WorkX, ax // WorkX := Src.w * 4 - @Loopx: - mov bl, [edi] // BX := destination color - mov al, [esi] // AX := source color - cmp al, 0 - je @Skip // if AL=0 then skip COMPONENT - mov ah, 0 // AX := COLOR COMPONENT - mov bh, 0 - sub bx, ax - jns @Skip - mov bl, 0 - @Skip: - mov [edi], bl - inc esi - inc edi - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - mov ebx,_ebx - end; - end; - SDL_UnlockSurface( SrcSurface ); - SDL_UnlockSurface( DstSurface ); -end; - -procedure SDL_MonoSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DstSurface : PSDL_Surface; DestRect : PSDL_Rect; Color : cardinal ); -var - Src, Dest : TSDL_Rect; - Diff : integer; - SrcAddr, DestAddr : cardinal; - _ebx, _esi, _edi, _esp : cardinal; - WorkX, WorkY : word; - SrcMod, DestMod : cardinal; - SrcTransparentColor : cardinal; - Bits : cardinal; -begin - if ( SrcSurface = nil ) or ( DstSurface = nil ) then - exit; // Remove this to make it faster - if ( SrcSurface.Format.BitsPerPixel <> DstSurface.Format.BitsPerPixel ) then - exit; // Remove this to make it faster - if SrcRect = nil then - begin - with Src do - begin - x := 0; - y := 0; - w := SrcSurface.w; - h := SrcSurface.h; - end; - end - else - Src := SrcRect^; - if DestRect = nil then - begin - Dest.x := 0; - Dest.y := 0; - end - else - Dest := DestRect^; - Dest.w := Src.w; - Dest.h := Src.h; - with DstSurface.Clip_Rect do - begin - // Source's right side is greater than the dest.cliprect - if Dest.x + Src.w > x + w then - begin - smallint( Src.w ) := x + w - Dest.x; - smallint( Dest.w ) := x + w - Dest.x; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's bottom side is greater than the dest.clip - if Dest.y + Src.h > y + h then - begin - smallint( Src.h ) := y + h - Dest.y; - smallint( Dest.h ) := y + h - Dest.y; - if smallint( Dest.h ) < 1 then - exit; - end; - // Source's left side is less than the dest.clip - if Dest.x < x then - begin - Diff := x - Dest.x; - Src.x := Src.x + Diff; - smallint( Src.w ) := smallint( Src.w ) - Diff; - Dest.x := x; - smallint( Dest.w ) := smallint( Dest.w ) - Diff; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's Top side is less than the dest.clip - if Dest.y < y then - begin - Diff := y - Dest.y; - Src.y := Src.y + Diff; - smallint( Src.h ) := smallint( Src.h ) - Diff; - Dest.y := y; - smallint( Dest.h ) := smallint( Dest.h ) - Diff; - if smallint( Dest.h ) < 1 then - exit; - end; - end; - with SrcSurface^ do - begin - SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * - Format.BytesPerPixel; - SrcMod := Pitch - Src.w * Format.BytesPerPixel; - SrcTransparentColor := format.colorkey; - end; - with DstSurface^ do - begin - DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * - Format.BytesPerPixel; - DestMod := Pitch - Dest.w * Format.BytesPerPixel; - Bits := DstSurface.Format.BitsPerPixel; - end; - SDL_LockSurface( SrcSurface ); - SDL_LockSurface( DstSurface ); - case bits of - 8 : - asm - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - mov ecx, Color - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - @Loopx: - mov al, [esi] // AL := source color - movzx eax, al - cmp eax, SrcTransparentColor - je @SkipColor // if AL=Transparent color then skip everything - mov [edi], cl - @SkipColor: - inc esi - inc edi - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - end; - 15, 16 : - asm - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - mov ecx, Color - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - @Loopx: - mov ax, [esi] // AX := source color - movzx eax, ax - cmp eax, SrcTransparentColor - je @SkipColor // if AX=Transparent color then skip everything - mov [edi], cx - @SkipColor: - inc esi - inc esi - inc edi - inc edi - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - end; - 24 : - asm - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov _ebx, ebx - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - mov ecx, Color - and ecx, $00ffffff - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - @Loopx: - mov eax, [esi] // EAX := source color - and eax, $00ffffff - cmp eax, SrcTransparentColor - je @SkipColor // if EAX=Transparent color then skip everything - mov ebx, [edi] - and ebx, $ff000000 - or ebx, ecx - mov [edi], ecx - @SkipColor: - add esi, 3 - add edi, 3 - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp, _esp - mov edi, _edi - mov esi, _esi - mov ebx, _ebx - end; - 32 : - asm - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - mov ecx, Color - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - @Loopx: - mov eax, [esi] // EAX := source color - cmp eax, SrcTransparentColor - je @SkipColor // if EAX=Transparent color then skip everything - mov [edi], ecx - @SkipColor: - add esi, 4 - add edi, 4 - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp, _esp - mov edi, _edi - mov esi, _esi - end; - end; - SDL_UnlockSurface( SrcSurface ); - SDL_UnlockSurface( DstSurface ); -end; -// TextureRect.w and TextureRect.h are not used. -// The TextureSurface's size MUST larger than the drawing rectangle!!! - -procedure SDL_TexturedSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DstSurface : PSDL_Surface; DestRect : PSDL_Rect; Texture : PSDL_Surface; - TextureRect : PSDL_Rect ); -var - Src, Dest : TSDL_Rect; - Diff : integer; - SrcAddr, DestAddr, TextAddr : cardinal; - _ebx, _esi, _edi, _esp : cardinal; - WorkX, WorkY : word; - SrcMod, DestMod, TextMod : cardinal; - SrcTransparentColor : cardinal; - Bits : cardinal; -begin - if ( SrcSurface = nil ) or ( DstSurface = nil ) then - exit; // Remove this to make it faster - if ( SrcSurface.Format.BitsPerPixel <> DstSurface.Format.BitsPerPixel ) then - exit; // Remove this to make it faster - if SrcRect = nil then - begin - with Src do - begin - x := 0; - y := 0; - w := SrcSurface.w; - h := SrcSurface.h; - end; - end - else - Src := SrcRect^; - if DestRect = nil then - begin - Dest.x := 0; - Dest.y := 0; - end - else - Dest := DestRect^; - Dest.w := Src.w; - Dest.h := Src.h; - with DstSurface.Clip_Rect do - begin - // Source's right side is greater than the dest.cliprect - if Dest.x + Src.w > x + w then - begin - smallint( Src.w ) := x + w - Dest.x; - smallint( Dest.w ) := x + w - Dest.x; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's bottom side is greater than the dest.clip - if Dest.y + Src.h > y + h then - begin - smallint( Src.h ) := y + h - Dest.y; - smallint( Dest.h ) := y + h - Dest.y; - if smallint( Dest.h ) < 1 then - exit; - end; - // Source's left side is less than the dest.clip - if Dest.x < x then - begin - Diff := x - Dest.x; - Src.x := Src.x + Diff; - smallint( Src.w ) := smallint( Src.w ) - Diff; - Dest.x := x; - smallint( Dest.w ) := smallint( Dest.w ) - Diff; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's Top side is less than the dest.clip - if Dest.y < y then - begin - Diff := y - Dest.y; - Src.y := Src.y + Diff; - smallint( Src.h ) := smallint( Src.h ) - Diff; - Dest.y := y; - smallint( Dest.h ) := smallint( Dest.h ) - Diff; - if smallint( Dest.h ) < 1 then - exit; - end; - end; - with SrcSurface^ do - begin - SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * - Format.BytesPerPixel; - SrcMod := Pitch - Src.w * Format.BytesPerPixel; - SrcTransparentColor := format.colorkey; - end; - with DstSurface^ do - begin - DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * - Format.BytesPerPixel; - DestMod := Pitch - Dest.w * Format.BytesPerPixel; - Bits := DstSurface.Format.BitsPerPixel; - end; - with Texture^ do - begin - TextAddr := cardinal( Pixels ) + UInt32( TextureRect.y ) * Pitch + - UInt32( TextureRect.x ) * Format.BytesPerPixel; - TextMod := Pitch - Src.w * Format.BytesPerPixel; - end; - SDL_LockSurface( SrcSurface ); - SDL_LockSurface( DstSurface ); - SDL_LockSurface( Texture ); - case bits of - 8 : - asm - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov _ebx, ebx - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ebx, TextAddr - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - @Loopx: - mov al, [esi] // AL := source color - movzx eax, al - cmp eax, SrcTransparentColor - je @SkipColor // if AL=Transparent color then skip everything - mov al, [ebx] - mov [edi], al - @SkipColor: - inc esi - inc edi - inc ebx - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - add ebx, TextMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - mov ebx, _ebx - end; - 15, 16 : - asm - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ecx, TextAddr - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - @Loopx: - mov ax, [esi] // AL := source color - movzx eax, ax - cmp eax, SrcTransparentColor - je @SkipColor // if AL=Transparent color then skip everything - mov ax, [ecx] - mov [edi], ax - @SkipColor: - inc esi - inc esi - inc edi - inc edi - inc ecx - inc ecx - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - add ecx, TextMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - end; - 24 : - asm - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov _ebx, ebx - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ebx, TextAddr - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - @Loopx: - mov eax, [esi] // AL := source color - and eax, $00ffffff - cmp eax, SrcTransparentColor - je @SkipColor // if AL=Transparent color then skip everything - mov eax, [ebx] - and eax, $00ffffff - mov ecx, [edi] - and ecx, $ff000000 - or ecx, eax - mov [edi], eax - @SkipColor: - add esi, 3 - add edi, 3 - add ebx, 3 - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - add ebx, TextMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - mov ebx, _ebx - end; - 32 : - asm - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ecx, TextAddr - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - @Loopx: - mov eax, [esi] // AL := source color - cmp eax, SrcTransparentColor - je @SkipColor // if AL=Transparent color then skip everything - mov eax, [ecx] - mov [edi], eax - @SkipColor: - add esi, 4 - add edi, 4 - add ecx, 4 - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - add ecx, TextMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - end; - end; - SDL_UnlockSurface( SrcSurface ); - SDL_UnlockSurface( DstSurface ); - SDL_UnlockSurface( Texture ); -end; - -procedure SDL_ZoomSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; DstRect : PSDL_Rect ); -var - xc, yc : cardinal; - rx, wx, ry, wy, ry16 : cardinal; - color : cardinal; - modx, mody : cardinal; -begin - // Warning! No checks for surface pointers!!! - if srcrect = nil then - srcrect := @SrcSurface.clip_rect; - if dstrect = nil then - dstrect := @DstSurface.clip_rect; - if SDL_MustLock( SrcSurface ) then - SDL_LockSurface( SrcSurface ); - if SDL_MustLock( DstSurface ) then - SDL_LockSurface( DstSurface ); - modx := trunc( ( srcrect.w / dstrect.w ) * 65536 ); - mody := trunc( ( srcrect.h / dstrect.h ) * 65536 ); - //rx := srcrect.x * 65536; - ry := srcrect.y * 65536; - wy := dstrect.y; - for yc := 0 to dstrect.h - 1 do - begin - rx := srcrect.x * 65536; - wx := dstrect.x; - ry16 := ry shr 16; - for xc := 0 to dstrect.w - 1 do - begin - color := SDL_GetPixel( SrcSurface, rx shr 16, ry16 ); - SDL_PutPixel( DstSurface, wx, wy, color ); - rx := rx + modx; - inc( wx ); - end; - ry := ry + mody; - inc( wy ); - end; - if SDL_MustLock( SrcSurface ) then - SDL_UnlockSurface( SrcSurface ); - if SDL_MustLock( DstSurface ) then - SDL_UnlockSurface( DstSurface ); -end; -// Re-map a rectangular area into an area defined by four vertices -// Converted from C to Pascal by KiCHY - -procedure SDL_WarpSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; UL, UR, LR, LL : PPoint ); -const - SHIFTS = 15; // Extend ints to limit round-off error (try 2 - 20) - THRESH = 1 shl SHIFTS; // Threshold for pixel size value - procedure CopySourceToDest( UL, UR, LR, LL : TPoint; x1, y1, x2, y2 : cardinal ); - var - tm, lm, rm, bm, m : TPoint; - mx, my : cardinal; - cr : cardinal; - begin - // Does the destination area specify a single pixel? - if ( ( abs( ul.x - ur.x ) < THRESH ) and - ( abs( ul.x - lr.x ) < THRESH ) and - ( abs( ul.x - ll.x ) < THRESH ) and - ( abs( ul.y - ur.y ) < THRESH ) and - ( abs( ul.y - lr.y ) < THRESH ) and - ( abs( ul.y - ll.y ) < THRESH ) ) then - begin // Yes - cr := SDL_GetPixel( SrcSurface, ( x1 shr SHIFTS ), ( y1 shr SHIFTS ) ); - SDL_PutPixel( DstSurface, ( ul.x shr SHIFTS ), ( ul.y shr SHIFTS ), cr ); - end - else - begin // No - // Quarter the source and the destination, and then recurse - tm.x := ( ul.x + ur.x ) shr 1; - tm.y := ( ul.y + ur.y ) shr 1; - bm.x := ( ll.x + lr.x ) shr 1; - bm.y := ( ll.y + lr.y ) shr 1; - lm.x := ( ul.x + ll.x ) shr 1; - lm.y := ( ul.y + ll.y ) shr 1; - rm.x := ( ur.x + lr.x ) shr 1; - rm.y := ( ur.y + lr.y ) shr 1; - m.x := ( tm.x + bm.x ) shr 1; - m.y := ( tm.y + bm.y ) shr 1; - mx := ( x1 + x2 ) shr 1; - my := ( y1 + y2 ) shr 1; - CopySourceToDest( ul, tm, m, lm, x1, y1, mx, my ); - CopySourceToDest( tm, ur, rm, m, mx, y1, x2, my ); - CopySourceToDest( m, rm, lr, bm, mx, my, x2, y2 ); - CopySourceToDest( lm, m, bm, ll, x1, my, mx, y2 ); - end; - end; -var - _UL, _UR, _LR, _LL : TPoint; - Rect_x, Rect_y, Rect_w, Rect_h : integer; -begin - if SDL_MustLock( SrcSurface ) then - SDL_LockSurface( SrcSurface ); - if SDL_MustLock( DstSurface ) then - SDL_LockSurface( DstSurface ); - if SrcRect = nil then - begin - Rect_x := 0; - Rect_y := 0; - Rect_w := ( SrcSurface.w - 1 ) shl SHIFTS; - Rect_h := ( SrcSurface.h - 1 ) shl SHIFTS; - end - else - begin - Rect_x := SrcRect.x; - Rect_y := SrcRect.y; - Rect_w := ( SrcRect.w - 1 ) shl SHIFTS; - Rect_h := ( SrcRect.h - 1 ) shl SHIFTS; - end; - // Shift all values to help reduce round-off error. - _ul.x := ul.x shl SHIFTS; - _ul.y := ul.y shl SHIFTS; - _ur.x := ur.x shl SHIFTS; - _ur.y := ur.y shl SHIFTS; - _lr.x := lr.x shl SHIFTS; - _lr.y := lr.y shl SHIFTS; - _ll.x := ll.x shl SHIFTS; - _ll.y := ll.y shl SHIFTS; - CopySourceToDest( _ul, _ur, _lr, _ll, Rect_x, Rect_y, Rect_w, Rect_h ); - if SDL_MustLock( SrcSurface ) then - SDL_UnlockSurface( SrcSurface ); - if SDL_MustLock( DstSurface ) then - SDL_UnlockSurface( DstSurface ); -end; - -// flips a rectangle vertically on given surface -procedure SDL_FlipRectV( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); -var - TmpRect : TSDL_Rect; - Locked : boolean; - y, FlipLength, RowLength : integer; - Row1, Row2 : Pointer; - OneRow : TByteArray; // Optimize it if you wish -begin - if DstSurface <> nil then - begin - if Rect = nil then - begin // if Rect=nil then we flip the whole surface - TmpRect := SDLRect( 0, 0, DstSurface.w, DstSurface.h ); - Rect := @TmpRect; - end; - FlipLength := Rect^.h shr 1 - 1; - RowLength := Rect^.w * DstSurface^.format.BytesPerPixel; - if SDL_MustLock( DstSurface ) then - begin - Locked := true; - SDL_LockSurface( DstSurface ); - end - else - Locked := false; - Row1 := pointer( cardinal( DstSurface^.Pixels ) + UInt32( Rect^.y ) * - DstSurface^.Pitch ); - Row2 := pointer( cardinal( DstSurface^.Pixels ) + ( UInt32( Rect^.y ) + Rect^.h - 1 ) - * DstSurface^.Pitch ); - for y := 0 to FlipLength do - begin - Move( Row1^, OneRow, RowLength ); - Move( Row2^, Row1^, RowLength ); - Move( OneRow, Row2^, RowLength ); - inc( cardinal( Row1 ), DstSurface^.Pitch ); - dec( cardinal( Row2 ), DstSurface^.Pitch ); - end; - if Locked then - SDL_UnlockSurface( DstSurface ); - end; -end; - -// flips a rectangle horizontally on given surface -procedure SDL_FlipRectH( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); -type - T24bit = packed array[ 0..2 ] of byte; - T24bitArray = packed array[ 0..8191 ] of T24bit; - P24bitArray = ^T24bitArray; - TLongWordArray = array[ 0..8191 ] of LongWord; - PLongWordArray = ^TLongWordArray; -var - TmpRect : TSDL_Rect; - Row8bit : PByteArray; - Row16bit : PWordArray; - Row24bit : P24bitArray; - Row32bit : PLongWordArray; - y, x, RightSide, FlipLength : integer; - Pixel : cardinal; - Pixel24 : T24bit; - Locked : boolean; -begin - if DstSurface <> nil then - begin - if Rect = nil then - begin - TmpRect := SDLRect( 0, 0, DstSurface.w, DstSurface.h ); - Rect := @TmpRect; - end; - FlipLength := Rect^.w shr 1 - 1; - if SDL_MustLock( DstSurface ) then - begin - Locked := true; - SDL_LockSurface( DstSurface ); - end - else - Locked := false; - case DstSurface^.format.BytesPerPixel of - 1 : - begin - Row8Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * - DstSurface^.pitch ); - for y := 1 to Rect^.h do - begin - RightSide := Rect^.w - 1; - for x := 0 to FlipLength do - begin - Pixel := Row8Bit^[ x ]; - Row8Bit^[ x ] := Row8Bit^[ RightSide ]; - Row8Bit^[ RightSide ] := Pixel; - dec( RightSide ); - end; - inc( cardinal( Row8Bit ), DstSurface^.pitch ); - end; - end; - 2 : - begin - Row16Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * - DstSurface^.pitch ); - for y := 1 to Rect^.h do - begin - RightSide := Rect^.w - 1; - for x := 0 to FlipLength do - begin - Pixel := Row16Bit^[ x ]; - Row16Bit^[ x ] := Row16Bit^[ RightSide ]; - Row16Bit^[ RightSide ] := Pixel; - dec( RightSide ); - end; - inc( cardinal( Row16Bit ), DstSurface^.pitch ); - end; - end; - 3 : - begin - Row24Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * - DstSurface^.pitch ); - for y := 1 to Rect^.h do - begin - RightSide := Rect^.w - 1; - for x := 0 to FlipLength do - begin - Pixel24 := Row24Bit^[ x ]; - Row24Bit^[ x ] := Row24Bit^[ RightSide ]; - Row24Bit^[ RightSide ] := Pixel24; - dec( RightSide ); - end; - inc( cardinal( Row24Bit ), DstSurface^.pitch ); - end; - end; - 4 : - begin - Row32Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * - DstSurface^.pitch ); - for y := 1 to Rect^.h do - begin - RightSide := Rect^.w - 1; - for x := 0 to FlipLength do - begin - Pixel := Row32Bit^[ x ]; - Row32Bit^[ x ] := Row32Bit^[ RightSide ]; - Row32Bit^[ RightSide ] := Pixel; - dec( RightSide ); - end; - inc( cardinal( Row32Bit ), DstSurface^.pitch ); - end; - end; - end; - if Locked then - SDL_UnlockSurface( DstSurface ); - end; -end; - -// Use with caution! The procedure allocates memory for TSDL_Rect and return with its pointer. -// But you MUST free it after you don't need it anymore!!! -function PSDLRect( aLeft, aTop, aWidth, aHeight : integer ) : PSDL_Rect; -var - Rect : PSDL_Rect; -begin - New( Rect ); - with Rect^ do - begin - x := aLeft; - y := aTop; - w := aWidth; - h := aHeight; - end; - Result := Rect; -end; - -function SDLRect( aLeft, aTop, aWidth, aHeight : integer ) : TSDL_Rect; -begin - with result do - begin - x := aLeft; - y := aTop; - w := aWidth; - h := aHeight; - end; -end; - -function SDLRect( aRect : TRect ) : TSDL_Rect; -begin - with aRect do - result := SDLRect( Left, Top, Right - Left, Bottom - Top ); -end; - -procedure SDL_Stretch8( Surface, Dst_Surface : PSDL_Surface; x1, x2, y1, y2, yr, yw, - depth : integer ); -var - dx, dy, e, d, dx2 : integer; - src_pitch, dst_pitch : uint16; - src_pixels, dst_pixels : PUint8; -begin - if ( yw >= dst_surface^.h ) then - exit; - dx := ( x2 - x1 ); - dy := ( y2 - y1 ); - dy := dy shl 1; - e := dy - dx; - dx2 := dx shl 1; - src_pitch := Surface^.pitch; - dst_pitch := dst_surface^.pitch; - src_pixels := PUint8( integer( Surface^.pixels ) + yr * src_pitch + y1 * depth ); - dst_pixels := PUint8( integer( dst_surface^.pixels ) + yw * dst_pitch + x1 * - depth ); - for d := 0 to dx - 1 do - begin - move( src_pixels^, dst_pixels^, depth ); - while ( e >= 0 ) do - begin - inc( src_pixels, depth ); - e := e - dx2; - end; - inc( dst_pixels, depth ); - e := e + dy; - end; -end; - -function sign( x : integer ) : integer; -begin - if x > 0 then - result := 1 - else - result := -1; -end; - -// Stretches a part of a surface -function SDL_ScaleSurfaceRect( SrcSurface : PSDL_Surface; SrcX1, SrcY1, SrcW, SrcH, - Width, Height : integer ) : PSDL_Surface; -var - dst_surface : PSDL_Surface; - dx, dy, e, d, dx2, srcx2, srcy2 : integer; - destx1, desty1 : integer; -begin - srcx2 := srcx1 + SrcW; - srcy2 := srcy1 + SrcH; - result := nil; - destx1 := 0; - desty1 := 0; - dx := abs( integer( Height - desty1 ) ); - dy := abs( integer( SrcY2 - SrcY1 ) ); - e := ( dy shl 1 ) - dx; - dx2 := dx shl 1; - dy := dy shl 1; - dst_surface := SDL_CreateRGBSurface( SDL_HWPALETTE, width - destx1, Height - - desty1, - SrcSurface^.Format^.BitsPerPixel, - SrcSurface^.Format^.RMask, - SrcSurface^.Format^.GMask, - SrcSurface^.Format^.BMask, - SrcSurface^.Format^.AMask ); - if ( dst_surface^.format^.BytesPerPixel = 1 ) then - SDL_SetColors( dst_surface, @SrcSurface^.format^.palette^.colors^[ 0 ], 0, 256 ); - SDL_SetColorKey( dst_surface, sdl_srccolorkey, SrcSurface^.format^.colorkey ); - if ( SDL_MustLock( dst_surface ) ) then - if ( SDL_LockSurface( dst_surface ) < 0 ) then - exit; - for d := 0 to dx - 1 do - begin - SDL_Stretch8( SrcSurface, dst_surface, destx1, Width, SrcX1, SrcX2, SrcY1, desty1, - SrcSurface^.format^.BytesPerPixel ); - while e >= 0 do - begin - inc( SrcY1 ); - e := e - dx2; - end; - inc( desty1 ); - e := e + dy; - end; - if SDL_MUSTLOCK( dst_surface ) then - SDL_UnlockSurface( dst_surface ); - result := dst_surface; -end; - -procedure SDL_ScrollY( DstSurface : PSDL_Surface; DifY : integer ); -var - r1, r2 : TSDL_Rect; - //buffer: PSDL_Surface; - YPos : Integer; -begin - if ( DstSurface <> nil ) and ( DifY <> 0 ) then - begin - //if DifY > 0 then // going up - //begin - ypos := 0; - r1.x := 0; - r2.x := 0; - r1.w := DstSurface.w; - r2.w := DstSurface.w; - r1.h := DifY; - r2.h := DifY; - while ypos < DstSurface.h do - begin - r1.y := ypos; - r2.y := ypos + DifY; - SDL_BlitSurface( DstSurface, @r2, DstSurface, @r1 ); - ypos := ypos + DifY; - end; - //end - //else - //begin // Going Down - //end; - end; -end; - -procedure SDL_ScrollX( DstSurface : PSDL_Surface; DifX : integer ); -var - r1, r2 : TSDL_Rect; - buffer : PSDL_Surface; -begin - if ( DstSurface <> nil ) and ( DifX <> 0 ) then - begin - buffer := SDL_CreateRGBSurface( SDL_HWSURFACE, ( DstSurface^.w - DifX ) * 2, - DstSurface^.h * 2, - DstSurface^.Format^.BitsPerPixel, - DstSurface^.Format^.RMask, - DstSurface^.Format^.GMask, - DstSurface^.Format^.BMask, - DstSurface^.Format^.AMask ); - if buffer <> nil then - begin - if ( buffer^.format^.BytesPerPixel = 1 ) then - SDL_SetColors( buffer, @DstSurface^.format^.palette^.colors^[ 0 ], 0, 256 ); - r1 := SDLRect( DifX, 0, buffer^.w, buffer^.h ); - r2 := SDLRect( 0, 0, buffer^.w, buffer^.h ); - SDL_BlitSurface( DstSurface, @r1, buffer, @r2 ); - SDL_BlitSurface( buffer, @r2, DstSurface, @r2 ); - SDL_FreeSurface( buffer ); - end; - end; -end; - -procedure SDL_RotateRad( DstSurface, SrcSurface : PSDL_Surface; SrcRect : - PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Single ); -var - aSin, aCos : Single; - MX, MY, DX, DY, NX, NY, SX, SY, OX, OY, Width, Height, TX, TY, RX, RY, ROX, ROY : Integer; - Colour, TempTransparentColour : UInt32; - MAXX, MAXY : Integer; -begin - // Rotate the surface to the target surface. - TempTransparentColour := SrcSurface.format.colorkey; - if srcRect.w > srcRect.h then - begin - Width := srcRect.w; - Height := srcRect.w; - end - else - begin - Width := srcRect.h; - Height := srcRect.h; - end; - - maxx := DstSurface.w; - maxy := DstSurface.h; - aCos := cos( Angle ); - aSin := sin( Angle ); - - Width := round( abs( srcrect.h * acos ) + abs( srcrect.w * asin ) ); - Height := round( abs( srcrect.h * asin ) + abs( srcrect.w * acos ) ); - - OX := Width div 2; - OY := Height div 2; ; - MX := ( srcRect.x + ( srcRect.x + srcRect.w ) ) div 2; - MY := ( srcRect.y + ( srcRect.y + srcRect.h ) ) div 2; - ROX := ( -( srcRect.w div 2 ) ) + Offsetx; - ROY := ( -( srcRect.h div 2 ) ) + OffsetY; - Tx := ox + round( ROX * aSin - ROY * aCos ); - Ty := oy + round( ROY * aSin + ROX * aCos ); - SX := 0; - for DX := DestX - TX to DestX - TX + ( width ) do - begin - Inc( SX ); - SY := 0; - for DY := DestY - TY to DestY - TY + ( Height ) do - begin - RX := SX - OX; - RY := SY - OY; - NX := round( mx + RX * aSin + RY * aCos ); // - NY := round( my + RY * aSin - RX * aCos ); // - // Used for testing only - //SDL_PutPixel(DstSurface.SDLSurfacePointer,DX,DY,0); - if ( ( DX > 0 ) and ( DX < MAXX ) ) and ( ( DY > 0 ) and ( DY < MAXY ) ) then - begin - if ( NX >= srcRect.x ) and ( NX <= srcRect.x + srcRect.w ) then - begin - if ( NY >= srcRect.y ) and ( NY <= srcRect.y + srcRect.h ) then - begin - Colour := SDL_GetPixel( SrcSurface, NX, NY ); - if Colour <> TempTransparentColour then - begin - SDL_PutPixel( DstSurface, DX, DY, Colour ); - end; - end; - end; - end; - inc( SY ); - end; - end; -end; - -procedure SDL_RotateDeg( DstSurface, SrcSurface : PSDL_Surface; SrcRect : - PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Integer ); -begin - SDL_RotateRad( DstSurface, SrcSurface, SrcRect, DestX, DestY, OffsetX, OffsetY, DegToRad( Angle ) ); -end; - -function ValidateSurfaceRect( DstSurface : PSDL_Surface; dstrect : PSDL_Rect ) : TSDL_Rect; -var - RealRect : TSDL_Rect; - OutOfRange : Boolean; -begin - OutOfRange := false; - if dstrect = nil then - begin - RealRect.x := 0; - RealRect.y := 0; - RealRect.w := DstSurface.w; - RealRect.h := DstSurface.h; - end - else - begin - if dstrect.x < DstSurface.w then - begin - RealRect.x := dstrect.x; - end - else if dstrect.x < 0 then - begin - realrect.x := 0; - end - else - begin - OutOfRange := True; - end; - if dstrect.y < DstSurface.h then - begin - RealRect.y := dstrect.y; - end - else if dstrect.y < 0 then - begin - realrect.y := 0; - end - else - begin - OutOfRange := True; - end; - if OutOfRange = False then - begin - if realrect.x + dstrect.w <= DstSurface.w then - begin - RealRect.w := dstrect.w; - end - else - begin - RealRect.w := dstrect.w - realrect.x; - end; - if realrect.y + dstrect.h <= DstSurface.h then - begin - RealRect.h := dstrect.h; - end - else - begin - RealRect.h := dstrect.h - realrect.y; - end; - end; - end; - if OutOfRange = False then - begin - result := realrect; - end - else - begin - realrect.w := 0; - realrect.h := 0; - realrect.x := 0; - realrect.y := 0; - result := realrect; - end; -end; - -procedure SDL_FillRectAdd( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); -var - RealRect : TSDL_Rect; - Addr : pointer; - ModX, BPP : cardinal; - x, y, R, G, B, SrcColor : cardinal; -begin - RealRect := ValidateSurfaceRect( DstSurface, DstRect ); - if ( RealRect.w > 0 ) and ( RealRect.h > 0 ) then - begin - SDL_LockSurface( DstSurface ); - BPP := DstSurface.format.BytesPerPixel; - with DstSurface^ do - begin - Addr := pointer( UInt32( pixels ) + UInt32( RealRect.y ) * pitch + UInt32( RealRect.x ) * BPP ); - ModX := Pitch - UInt32( RealRect.w ) * BPP; - end; - case DstSurface.format.BitsPerPixel of - 8 : - begin - for y := 0 to RealRect.h - 1 do - begin - for x := 0 to RealRect.w - 1 do - begin - SrcColor := PUInt32( Addr )^; - R := SrcColor and $E0 + Color and $E0; - G := SrcColor and $1C + Color and $1C; - B := SrcColor and $03 + Color and $03; - if R > $E0 then - R := $E0; - if G > $1C then - G := $1C; - if B > $03 then - B := $03; - PUInt8( Addr )^ := R or G or B; - inc( UInt32( Addr ), BPP ); - end; - inc( UInt32( Addr ), ModX ); - end; - end; - 15 : - begin - for y := 0 to RealRect.h - 1 do - begin - for x := 0 to RealRect.w - 1 do - begin - SrcColor := PUInt32( Addr )^; - R := SrcColor and $7C00 + Color and $7C00; - G := SrcColor and $03E0 + Color and $03E0; - B := SrcColor and $001F + Color and $001F; - if R > $7C00 then - R := $7C00; - if G > $03E0 then - G := $03E0; - if B > $001F then - B := $001F; - PUInt16( Addr )^ := R or G or B; - inc( UInt32( Addr ), BPP ); - end; - inc( UInt32( Addr ), ModX ); - end; - end; - 16 : - begin - for y := 0 to RealRect.h - 1 do - begin - for x := 0 to RealRect.w - 1 do - begin - SrcColor := PUInt32( Addr )^; - R := SrcColor and $F800 + Color and $F800; - G := SrcColor and $07C0 + Color and $07C0; - B := SrcColor and $001F + Color and $001F; - if R > $F800 then - R := $F800; - if G > $07C0 then - G := $07C0; - if B > $001F then - B := $001F; - PUInt16( Addr )^ := R or G or B; - inc( UInt32( Addr ), BPP ); - end; - inc( UInt32( Addr ), ModX ); - end; - end; - 24 : - begin - for y := 0 to RealRect.h - 1 do - begin - for x := 0 to RealRect.w - 1 do - begin - SrcColor := PUInt32( Addr )^; - R := SrcColor and $00FF0000 + Color and $00FF0000; - G := SrcColor and $0000FF00 + Color and $0000FF00; - B := SrcColor and $000000FF + Color and $000000FF; - if R > $FF0000 then - R := $FF0000; - if G > $00FF00 then - G := $00FF00; - if B > $0000FF then - B := $0000FF; - PUInt32( Addr )^ := SrcColor and $FF000000 or R or G or B; - inc( UInt32( Addr ), BPP ); - end; - inc( UInt32( Addr ), ModX ); - end; - end; - 32 : - begin - for y := 0 to RealRect.h - 1 do - begin - for x := 0 to RealRect.w - 1 do - begin - SrcColor := PUInt32( Addr )^; - R := SrcColor and $00FF0000 + Color and $00FF0000; - G := SrcColor and $0000FF00 + Color and $0000FF00; - B := SrcColor and $000000FF + Color and $000000FF; - if R > $FF0000 then - R := $FF0000; - if G > $00FF00 then - G := $00FF00; - if B > $0000FF then - B := $0000FF; - PUInt32( Addr )^ := R or G or B; - inc( UInt32( Addr ), BPP ); - end; - inc( UInt32( Addr ), ModX ); - end; - end; - end; - SDL_UnlockSurface( DstSurface ); - end; -end; - -procedure SDL_FillRectSub( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); -var - RealRect : TSDL_Rect; - Addr : pointer; - ModX, BPP : cardinal; - x, y, R, G, B, SrcColor : cardinal; -begin - RealRect := ValidateSurfaceRect( DstSurface, DstRect ); - if ( RealRect.w > 0 ) and ( RealRect.h > 0 ) then - begin - SDL_LockSurface( DstSurface ); - BPP := DstSurface.format.BytesPerPixel; - with DstSurface^ do - begin - Addr := pointer( UInt32( pixels ) + UInt32( RealRect.y ) * pitch + UInt32( RealRect.x ) * BPP ); - ModX := Pitch - UInt32( RealRect.w ) * BPP; - end; - case DstSurface.format.BitsPerPixel of - 8 : - begin - for y := 0 to RealRect.h - 1 do - begin - for x := 0 to RealRect.w - 1 do - begin - SrcColor := PUInt32( Addr )^; - R := SrcColor and $E0 - Color and $E0; - G := SrcColor and $1C - Color and $1C; - B := SrcColor and $03 - Color and $03; - if R > $E0 then - R := 0; - if G > $1C then - G := 0; - if B > $03 then - B := 0; - PUInt8( Addr )^ := R or G or B; - inc( UInt32( Addr ), BPP ); - end; - inc( UInt32( Addr ), ModX ); - end; - end; - 15 : - begin - for y := 0 to RealRect.h - 1 do - begin - for x := 0 to RealRect.w - 1 do - begin - SrcColor := PUInt32( Addr )^; - R := SrcColor and $7C00 - Color and $7C00; - G := SrcColor and $03E0 - Color and $03E0; - B := SrcColor and $001F - Color and $001F; - if R > $7C00 then - R := 0; - if G > $03E0 then - G := 0; - if B > $001F then - B := 0; - PUInt16( Addr )^ := R or G or B; - inc( UInt32( Addr ), BPP ); - end; - inc( UInt32( Addr ), ModX ); - end; - end; - 16 : - begin - for y := 0 to RealRect.h - 1 do - begin - for x := 0 to RealRect.w - 1 do - begin - SrcColor := PUInt32( Addr )^; - R := SrcColor and $F800 - Color and $F800; - G := SrcColor and $07C0 - Color and $07C0; - B := SrcColor and $001F - Color and $001F; - if R > $F800 then - R := 0; - if G > $07C0 then - G := 0; - if B > $001F then - B := 0; - PUInt16( Addr )^ := R or G or B; - inc( UInt32( Addr ), BPP ); - end; - inc( UInt32( Addr ), ModX ); - end; - end; - 24 : - begin - for y := 0 to RealRect.h - 1 do - begin - for x := 0 to RealRect.w - 1 do - begin - SrcColor := PUInt32( Addr )^; - R := SrcColor and $00FF0000 - Color and $00FF0000; - G := SrcColor and $0000FF00 - Color and $0000FF00; - B := SrcColor and $000000FF - Color and $000000FF; - if R > $FF0000 then - R := 0; - if G > $00FF00 then - G := 0; - if B > $0000FF then - B := 0; - PUInt32( Addr )^ := SrcColor and $FF000000 or R or G or B; - inc( UInt32( Addr ), BPP ); - end; - inc( UInt32( Addr ), ModX ); - end; - end; - 32 : - begin - for y := 0 to RealRect.h - 1 do - begin - for x := 0 to RealRect.w - 1 do - begin - SrcColor := PUInt32( Addr )^; - R := SrcColor and $00FF0000 - Color and $00FF0000; - G := SrcColor and $0000FF00 - Color and $0000FF00; - B := SrcColor and $000000FF - Color and $000000FF; - if R > $FF0000 then - R := 0; - if G > $00FF00 then - G := 0; - if B > $0000FF then - B := 0; - PUInt32( Addr )^ := R or G or B; - inc( UInt32( Addr ), BPP ); - end; - inc( UInt32( Addr ), ModX ); - end; - end; - end; - SDL_UnlockSurface( DstSurface ); - end; -end; - -procedure SDL_GradientFillRect( DstSurface : PSDL_Surface; const Rect : PSDL_Rect; const StartColor, EndColor : TSDL_Color; const Style : TGradientStyle ); -var - FBC : array[ 0..255 ] of Cardinal; - // temp vars - i, YR, YG, YB, SR, SG, SB, DR, DG, DB : Integer; - - TempStepV, TempStepH : Single; - TempLeft, TempTop, TempHeight, TempWidth : integer; - TempRect : TSDL_Rect; - -begin - // calc FBC - YR := StartColor.r; - YG := StartColor.g; - YB := StartColor.b; - SR := YR; - SG := YG; - SB := YB; - DR := EndColor.r - SR; - DG := EndColor.g - SG; - DB := EndColor.b - SB; - - for i := 0 to 255 do - begin - FBC[ i ] := SDL_MapRGB( DstSurface.format, YR, YG, YB ); - YR := SR + round( DR / 255 * i ); - YG := SG + round( DG / 255 * i ); - YB := SB + round( DB / 255 * i ); - end; - - // if aStyle = 1 then begin - TempStepH := Rect.w / 255; - TempStepV := Rect.h / 255; - TempHeight := Trunc( TempStepV + 1 ); - TempWidth := Trunc( TempStepH + 1 ); - TempTop := 0; - TempLeft := 0; - TempRect.x := Rect.x; - TempRect.y := Rect.y; - TempRect.h := Rect.h; - TempRect.w := Rect.w; - - case Style of - gsHorizontal : - begin - TempRect.h := TempHeight; - for i := 0 to 255 do - begin - TempRect.y := Rect.y + TempTop; - SDL_FillRect( DstSurface, @TempRect, FBC[ i ] ); - TempTop := Trunc( TempStepV * i ); - end; - end; - gsVertical : - begin - TempRect.w := TempWidth; - for i := 0 to 255 do - begin - TempRect.x := Rect.x + TempLeft; - SDL_FillRect( DstSurface, @TempRect, FBC[ i ] ); - TempLeft := Trunc( TempStepH * i ); - end; - end; - end; -end; - -procedure SDL_2xBlit( Src, Dest : PSDL_Surface ); -var - ReadAddr, WriteAddr, ReadRow, WriteRow : UInt32; - SrcPitch, DestPitch, x, y, w, h : UInt32; -begin - if ( Src = nil ) or ( Dest = nil ) then - exit; - if ( Src.w shl 1 ) < Dest.w then - exit; - if ( Src.h shl 1 ) < Dest.h then - exit; - - if SDL_MustLock( Src ) then - SDL_LockSurface( Src ); - if SDL_MustLock( Dest ) then - SDL_LockSurface( Dest ); - - ReadRow := UInt32( Src.Pixels ); - WriteRow := UInt32( Dest.Pixels ); - - SrcPitch := Src.pitch; - DestPitch := Dest.pitch; - - w := Src.w; - h := Src.h; - - case Src.format.BytesPerPixel of - 1 : - asm - push ebx - mov eax, h // for y := 1 to Src.h do - mov y, eax - @LoopY: - mov eax, ReadRow // ReadAddr := ReadRow; - mov ReadAddr, eax - - mov eax, WriteRow // WriteAddr := WriteRow; - mov WriteAddr, eax - - mov eax, w // for x := 1 to Src.w do - mov x, eax - - mov ecx, ReadAddr - mov edx, WriteAddr - mov ebx, DestPitch - - @LoopX: - mov al, [ecx] // PUInt8(WriteAddr)^ := PUInt8(ReadAddr)^; - mov [edx], al - mov [edx + 1], al // PUInt8(WriteAddr + 1)^ := PUInt8(ReadAddr)^; - mov [edx + ebx], al // PUInt8(WriteAddr + DestPitch)^ := PUInt8(ReadAddr)^; - mov [edx + ebx + 1], al // PUInt8(WriteAddr + DestPitch + 1)^ := PUInt8(ReadAddr)^; - - inc ecx // inc(ReadAddr); - add edx, 2 // inc(WriteAddr, 2); - - dec x - jnz @LoopX - - mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); - add ReadRow, eax - - mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); - add WriteRow, eax - add WriteRow, eax - - dec y - jnz @LoopY - pop ebx - end; - 2 : - asm - push ebx - mov eax, h // for y := 1 to Src.h do - mov y, eax - @LoopY: - mov eax, ReadRow // ReadAddr := ReadRow; - mov ReadAddr, eax - - mov eax, WriteRow // WriteAddr := WriteRow; - mov WriteAddr, eax - - mov eax, w // for x := 1 to Src.w do - mov x, eax - - mov ecx, ReadAddr - mov edx, WriteAddr - mov ebx, DestPitch - - @LoopX: - mov ax, [ecx] // PUInt16(WriteAddr)^ := PUInt16(ReadAddr)^; - mov [edx], ax - mov [edx + 2], ax // PUInt16(WriteAddr + 2)^ := PUInt16(ReadAddr)^; - mov [edx + ebx], ax // PUInt16(WriteAddr + DestPitch)^ := PUInt16(ReadAddr)^; - mov [edx + ebx + 2], ax // PUInt16(WriteAddr + DestPitch + 2)^ := PUInt16(ReadAddr)^; - - add ecx, 2 // inc(ReadAddr, 2); - add edx, 4 // inc(WriteAddr, 4); - - dec x - jnz @LoopX - - mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); - add ReadRow, eax - - mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); - add WriteRow, eax - add WriteRow, eax - - dec y - jnz @LoopY - pop ebx - end; - 3 : - asm - push ebx - mov eax, h // for y := 1 to Src.h do - mov y, eax - @LoopY: - mov eax, ReadRow // ReadAddr := ReadRow; - mov ReadAddr, eax - - mov eax, WriteRow // WriteAddr := WriteRow; - mov WriteAddr, eax - - mov eax, w // for x := 1 to Src.w do - mov x, eax - - mov ecx, ReadAddr - mov edx, WriteAddr - mov ebx, DestPitch - - @LoopX: - mov eax, [ecx] // (PUInt32(WriteAddr)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - and eax, $00ffffff - and dword ptr [edx], $ff000000 - or [edx], eax - and dword ptr [edx + 3], $00ffffff // (PUInt32(WriteAddr + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - or [edx + 3], eax - and dword ptr [edx + ebx], $00ffffff // (PUInt32(WriteAddr + DestPitch)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - or [edx + ebx], eax - and dword ptr [edx + ebx + 3], $00ffffff // (PUInt32(WriteAddr + DestPitch + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - or [edx + ebx + 3], eax - - add ecx, 3 // inc(ReadAddr, 3); - add edx, 6 // inc(WriteAddr, 6); - - dec x - jnz @LoopX - - mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); - add ReadRow, eax - - mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); - add WriteRow, eax - add WriteRow, eax - - dec y - jnz @LoopY - pop ebx - end; - 4 : - asm - push ebx - mov eax, h // for y := 1 to Src.h do - mov y, eax - @LoopY: - mov eax, ReadRow // ReadAddr := ReadRow; - mov ReadAddr, eax - - mov eax, WriteRow // WriteAddr := WriteRow; - mov WriteAddr, eax - - mov eax, w // for x := 1 to Src.w do - mov x, eax - - mov ecx, ReadAddr - mov edx, WriteAddr - mov ebx, DestPitch - - @LoopX: - mov eax, [ecx] // PUInt32(WriteAddr)^ := PUInt32(ReadAddr)^; - mov [edx], eax - mov [edx + 4], eax // PUInt32(WriteAddr + 4)^ := PUInt32(ReadAddr)^; - mov [edx + ebx], eax // PUInt32(WriteAddr + DestPitch)^ := PUInt32(ReadAddr)^; - mov [edx + ebx + 4], eax // PUInt32(WriteAddr + DestPitch + 4)^ := PUInt32(ReadAddr)^; - - add ecx, 4 // inc(ReadAddr, 4); - add edx, 8 // inc(WriteAddr, 8); - - dec x - jnz @LoopX - - mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); - add ReadRow, eax - - mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); - add WriteRow, eax - add WriteRow, eax - - dec y - jnz @LoopY - pop ebx - end; - end; - - if SDL_MustLock( Src ) then - SDL_UnlockSurface( Src ); - if SDL_MustLock( Dest ) then - SDL_UnlockSurface( Dest ); -end; - -procedure SDL_Scanline2xBlit( Src, Dest : PSDL_Surface ); -var - ReadAddr, WriteAddr, ReadRow, WriteRow : UInt32; - SrcPitch, DestPitch, x, y, w, h : UInt32; -begin - if ( Src = nil ) or ( Dest = nil ) then - exit; - if ( Src.w shl 1 ) < Dest.w then - exit; - if ( Src.h shl 1 ) < Dest.h then - exit; - - if SDL_MustLock( Src ) then - SDL_LockSurface( Src ); - if SDL_MustLock( Dest ) then - SDL_LockSurface( Dest ); - - ReadRow := UInt32( Src.Pixels ); - WriteRow := UInt32( Dest.Pixels ); - - SrcPitch := Src.pitch; - DestPitch := Dest.pitch; - - w := Src.w; - h := Src.h; - - case Src.format.BytesPerPixel of - 1 : - asm - push ebx - mov eax, h // for y := 1 to Src.h do - mov y, eax - @LoopY: - mov eax, ReadRow // ReadAddr := ReadRow; - mov ReadAddr, eax - - mov eax, WriteRow // WriteAddr := WriteRow; - mov WriteAddr, eax - - mov eax, w // for x := 1 to Src.w do - mov x, eax - - mov ecx, ReadAddr - mov edx, WriteAddr - - @LoopX: - mov al, [ecx] // PUInt8(WriteAddr)^ := PUInt8(ReadAddr)^; - mov [edx], al - mov [edx + 1], al // PUInt8(WriteAddr + 1)^ := PUInt8(ReadAddr)^; - - inc ecx // inc(ReadAddr); - add edx, 2 // inc(WriteAddr, 2); - - dec x - jnz @LoopX - - mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); - add ReadRow, eax - - mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); - add WriteRow, eax - add WriteRow, eax - - dec y - jnz @LoopY - pop ebx - end; - 2 : - asm - push ebx - mov eax, h // for y := 1 to Src.h do - mov y, eax - @LoopY: - mov eax, ReadRow // ReadAddr := ReadRow; - mov ReadAddr, eax - - mov eax, WriteRow // WriteAddr := WriteRow; - mov WriteAddr, eax - - mov eax, w // for x := 1 to Src.w do - mov x, eax - - mov ecx, ReadAddr - mov edx, WriteAddr - - @LoopX: - mov ax, [ecx] // PUInt16(WriteAddr)^ := PUInt16(ReadAddr)^; - mov [edx], ax - mov [edx + 2], eax // PUInt16(WriteAddr + 2)^ := PUInt16(ReadAddr)^; - - add ecx, 2 // inc(ReadAddr, 2); - add edx, 4 // inc(WriteAddr, 4); - - dec x - jnz @LoopX - - mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); - add ReadRow, eax - - mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); - add WriteRow, eax - add WriteRow, eax - - dec y - jnz @LoopY - pop ebx - end; - 3 : - asm - push ebx - mov eax, h // for y := 1 to Src.h do - mov y, eax - @LoopY: - mov eax, ReadRow // ReadAddr := ReadRow; - mov ReadAddr, eax - - mov eax, WriteRow // WriteAddr := WriteRow; - mov WriteAddr, eax - - mov eax, w // for x := 1 to Src.w do - mov x, eax - - mov ecx, ReadAddr - mov edx, WriteAddr - - @LoopX: - mov eax, [ecx] // (PUInt32(WriteAddr)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - and eax, $00ffffff - and dword ptr [edx], $ff000000 - or [edx], eax - and dword ptr [edx + 3], $00ffffff // (PUInt32(WriteAddr + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - or [edx + 3], eax - - add ecx, 3 // inc(ReadAddr, 3); - add edx, 6 // inc(WriteAddr, 6); - - dec x - jnz @LoopX - - mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); - add ReadRow, eax - - mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); - add WriteRow, eax - add WriteRow, eax - - dec y - jnz @LoopY - pop ebx - end; - 4 : - asm - push ebx - mov eax, h // for y := 1 to Src.h do - mov y, eax - @LoopY: - mov eax, ReadRow // ReadAddr := ReadRow; - mov ReadAddr, eax - - mov eax, WriteRow // WriteAddr := WriteRow; - mov WriteAddr, eax - - mov eax, w // for x := 1 to Src.w do - mov x, eax - - mov ecx, ReadAddr - mov edx, WriteAddr - - @LoopX: - mov eax, [ecx] // PUInt32(WriteAddr)^ := PUInt32(ReadAddr)^; - mov [edx], eax - mov [edx + 4], eax // PUInt32(WriteAddr + 4)^ := PUInt32(ReadAddr)^; - - add ecx, 4 // inc(ReadAddr, 4); - add edx, 8 // inc(WriteAddr, 8); - - dec x - jnz @LoopX - - mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); - add ReadRow, eax - - mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); - add WriteRow, eax - add WriteRow, eax - - dec y - jnz @LoopY - pop ebx - end; - end; - - if SDL_MustLock( Src ) then - SDL_UnlockSurface( Src ); - if SDL_MustLock( Dest ) then - SDL_UnlockSurface( Dest ); -end; - -procedure SDL_50Scanline2xBlit( Src, Dest : PSDL_Surface ); -var - ReadAddr, WriteAddr, ReadRow, WriteRow : UInt32; - SrcPitch, DestPitch, x, y, w, h : UInt32; -begin - if ( Src = nil ) or ( Dest = nil ) then - exit; - if ( Src.w shl 1 ) < Dest.w then - exit; - if ( Src.h shl 1 ) < Dest.h then - exit; - - if SDL_MustLock( Src ) then - SDL_LockSurface( Src ); - if SDL_MustLock( Dest ) then - SDL_LockSurface( Dest ); - - ReadRow := UInt32( Src.Pixels ); - WriteRow := UInt32( Dest.Pixels ); - - SrcPitch := Src.pitch; - DestPitch := Dest.pitch; - - w := Src.w; - h := Src.h; - - case Src.format.BitsPerPixel of - 8 : - asm - push ebx - mov eax, h // for y := 1 to Src.h do - mov y, eax - @LoopY: - mov eax, ReadRow // ReadAddr := ReadRow; - mov ReadAddr, eax - - mov eax, WriteRow // WriteAddr := WriteRow; - mov WriteAddr, eax - - mov eax, w // for x := 1 to Src.w do - mov x, eax - - mov ecx, ReadAddr - mov edx, WriteAddr - mov ebx, DestPitch - - @LoopX: - mov al, [ecx] // PUInt8(WriteAddr)^ := PUInt8(ReadAddr)^; - mov [edx], al - mov [edx + 1], al // PUInt8(WriteAddr + 1)^ := PUInt8(ReadAddr)^; - shr al, 1 - and al, $6d - mov [edx + ebx], al // PUInt8(WriteAddr + DestPitch)^ := PUInt8(ReadAddr)^; - mov [edx + ebx + 1], al // PUInt8(WriteAddr + DestPitch + 1)^ := PUInt8(ReadAddr)^; - - inc ecx // inc(ReadAddr); - add edx, 2 // inc(WriteAddr, 2); - - dec x - jnz @LoopX - - mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); - add ReadRow, eax - - mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); - add WriteRow, eax - add WriteRow, eax - - dec y - jnz @LoopY - pop ebx - end; - 15 : - asm - push ebx - mov eax, h // for y := 1 to Src.h do - mov y, eax - @LoopY: - mov eax, ReadRow // ReadAddr := ReadRow; - mov ReadAddr, eax - - mov eax, WriteRow // WriteAddr := WriteRow; - mov WriteAddr, eax - - mov eax, w // for x := 1 to Src.w do - mov x, eax - - mov ecx, ReadAddr - mov edx, WriteAddr - mov ebx, DestPitch - - @LoopX: - mov ax, [ecx] // PUInt16(WriteAddr)^ := PUInt16(ReadAddr)^; - mov [edx], ax - mov [edx + 2], ax // PUInt16(WriteAddr + 2)^ := PUInt16(ReadAddr)^; - shr ax, 1 - and ax, $3def - mov [edx + ebx], ax // PUInt16(WriteAddr + DestPitch)^ := PUInt16(ReadAddr)^; - mov [edx + ebx + 2], ax // PUInt16(WriteAddr + DestPitch + 2)^ := PUInt16(ReadAddr)^; - - add ecx, 2 // inc(ReadAddr, 2); - add edx, 4 // inc(WriteAddr, 4); - - dec x - jnz @LoopX - - mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); - add ReadRow, eax - - mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); - add WriteRow, eax - add WriteRow, eax - - dec y - jnz @LoopY - pop ebx - end; - 16 : - asm - push ebx - mov eax, h // for y := 1 to Src.h do - mov y, eax - @LoopY: - mov eax, ReadRow // ReadAddr := ReadRow; - mov ReadAddr, eax - - mov eax, WriteRow // WriteAddr := WriteRow; - mov WriteAddr, eax - - mov eax, w // for x := 1 to Src.w do - mov x, eax - - mov ecx, ReadAddr - mov edx, WriteAddr - mov ebx, DestPitch - - @LoopX: - mov ax, [ecx] // PUInt16(WriteAddr)^ := PUInt16(ReadAddr)^; - mov [edx], ax - mov [edx + 2], ax // PUInt16(WriteAddr + 2)^ := PUInt16(ReadAddr)^; - shr ax, 1 - and ax, $7bef - mov [edx + ebx], ax // PUInt16(WriteAddr + DestPitch)^ := PUInt16(ReadAddr)^; - mov [edx + ebx + 2], ax // PUInt16(WriteAddr + DestPitch + 2)^ := PUInt16(ReadAddr)^; - - add ecx, 2 // inc(ReadAddr, 2); - add edx, 4 // inc(WriteAddr, 4); - - dec x - jnz @LoopX - - mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); - add ReadRow, eax - - mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); - add WriteRow, eax - add WriteRow, eax - - dec y - jnz @LoopY - pop ebx - end; - 24 : - asm - push ebx - mov eax, h // for y := 1 to Src.h do - mov y, eax - @LoopY: - mov eax, ReadRow // ReadAddr := ReadRow; - mov ReadAddr, eax - - mov eax, WriteRow // WriteAddr := WriteRow; - mov WriteAddr, eax - - mov eax, w // for x := 1 to Src.w do - mov x, eax - - mov ecx, ReadAddr - mov edx, WriteAddr - mov ebx, DestPitch - - @LoopX: - mov eax, [ecx] // (PUInt32(WriteAddr)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - and eax, $00ffffff - and dword ptr [edx], $ff000000 - or [edx], eax - and dword ptr [edx + 3], $00ffffff // (PUInt32(WriteAddr + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - or [edx + 3], eax - shr eax, 1 - and eax, $007f7f7f - and dword ptr [edx + ebx], $00ffffff // (PUInt32(WriteAddr + DestPitch)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - or [edx + ebx], eax - and dword ptr [edx + ebx + 3], $00ffffff // (PUInt32(WriteAddr + DestPitch + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - or [edx + ebx + 3], eax - - add ecx, 3 // inc(ReadAddr, 3); - add edx, 6 // inc(WriteAddr, 6); - - dec x - jnz @LoopX - - mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); - add ReadRow, eax - - mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); - add WriteRow, eax - add WriteRow, eax - - dec y - jnz @LoopY - pop ebx - end; - 32 : - asm - push ebx - mov eax, h // for y := 1 to Src.h do - mov y, eax - @LoopY: - mov eax, ReadRow // ReadAddr := ReadRow; - mov ReadAddr, eax - - mov eax, WriteRow // WriteAddr := WriteRow; - mov WriteAddr, eax - - mov eax, w // for x := 1 to Src.w do - mov x, eax - - mov ecx, ReadAddr - mov edx, WriteAddr - mov ebx, DestPitch - - @LoopX: - mov eax, [ecx] // PUInt32(WriteAddr)^ := PUInt32(ReadAddr)^; - mov [edx], eax - mov [edx + 4], eax // PUInt32(WriteAddr + 4)^ := PUInt32(ReadAddr)^; - shr eax, 1 - and eax, $7f7f7f7f - mov [edx + ebx], eax // PUInt32(WriteAddr + DestPitch)^ := PUInt32(ReadAddr)^; - mov [edx + ebx + 4], eax // PUInt32(WriteAddr + DestPitch + 4)^ := PUInt32(ReadAddr)^; - - add ecx, 4 // inc(ReadAddr, 4); - add edx, 8 // inc(WriteAddr, 8); - - dec x - jnz @LoopX - - mov eax, SrcPitch // inc(UInt32(ReadRow), SrcPitch); - add ReadRow, eax - - mov eax, DestPitch // inc(UInt32(WriteRow), DestPitch * 2); - add WriteRow, eax - add WriteRow, eax - - dec y - jnz @LoopY - pop ebx - end; - end; - - if SDL_MustLock( Src ) then - SDL_UnlockSurface( Src ); - if SDL_MustLock( Dest ) then - SDL_UnlockSurface( Dest ); -end; - -function SDL_PixelTestSurfaceVsRect( SrcSurface1 : PSDL_Surface; SrcRect1 : PSDL_Rect; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : -boolean; -var - Src_Rect1, Src_Rect2 : TSDL_Rect; - right1, bottom1 : integer; - right2, bottom2 : integer; - Scan1Start, Scan2Start, ScanWidth, ScanHeight : cardinal; - Mod1: cardinal; - Addr1 : cardinal; - BPP : cardinal; - Pitch1 : cardinal; - TransparentColor1 : cardinal; - tx, ty : cardinal; - StartTick : cardinal; - Color1 : cardinal; -begin - Result := false; - if SrcRect1 = nil then - begin - with Src_Rect1 do - begin - x := 0; - y := 0; - w := SrcSurface1.w; - h := SrcSurface1.h; - end; - end - else - Src_Rect1 := SrcRect1^; - - Src_Rect2 := SrcRect2^; - with Src_Rect1 do - begin - Right1 := Left1 + w; - Bottom1 := Top1 + h; - end; - with Src_Rect2 do - begin - Right2 := Left2 + w; - Bottom2 := Top2 + h; - end; - if ( Left1 >= Right2 ) or ( Right1 <= Left2 ) or ( Top1 >= Bottom2 ) or ( -Bottom1 <= - Top2 ) then - exit; - if Left1 <= Left2 then - begin - // 1. left, 2. right - Scan1Start := Src_Rect1.x + Left2 - Left1; - Scan2Start := Src_Rect2.x; - ScanWidth := Right1 - Left2; - with Src_Rect2 do - if ScanWidth > w then - ScanWidth := w; - end - else - begin - // 1. right, 2. left - Scan1Start := Src_Rect1.x; - Scan2Start := Src_Rect2.x + Left1 - Left2; - ScanWidth := Right2 - Left1; - with Src_Rect1 do - if ScanWidth > w then - ScanWidth := w; - end; - with SrcSurface1^ do - begin - Pitch1 := Pitch; - Addr1 := cardinal( Pixels ); - inc( Addr1, Pitch1 * UInt32( Src_Rect1.y ) ); - with format^ do - begin - BPP := BytesPerPixel; - TransparentColor1 := colorkey; - end; - end; - - Mod1 := Pitch1 - ( ScanWidth * BPP ); - - inc( Addr1, BPP * Scan1Start ); - - if Top1 <= Top2 then - begin - // 1. up, 2. down - ScanHeight := Bottom1 - Top2; - if ScanHeight > Src_Rect2.h then - ScanHeight := Src_Rect2.h; - inc( Addr1, Pitch1 * UInt32( Top2 - Top1 ) ); - end - else - begin - // 1. down, 2. up - ScanHeight := Bottom2 - Top1; - if ScanHeight > Src_Rect1.h then - ScanHeight := Src_Rect1.h; - - end; - case BPP of - 1 : - for ty := 1 to ScanHeight do - begin - for tx := 1 to ScanWidth do - begin - if ( PByte( Addr1 )^ <> TransparentColor1 ) then - begin - Result := true; - exit; - end; - inc( Addr1 ); - - end; - inc( Addr1, Mod1 ); - - end; - 2 : - for ty := 1 to ScanHeight do - begin - for tx := 1 to ScanWidth do - begin - if ( PWord( Addr1 )^ <> TransparentColor1 ) then - begin - Result := true; - exit; - end; - inc( Addr1, 2 ); - - end; - inc( Addr1, Mod1 ); - - end; - 3 : - for ty := 1 to ScanHeight do - begin - for tx := 1 to ScanWidth do - begin - Color1 := PLongWord( Addr1 )^ and $00FFFFFF; - - if ( Color1 <> TransparentColor1 ) - then - begin - Result := true; - exit; - end; - inc( Addr1, 3 ); - - end; - inc( Addr1, Mod1 ); - - end; - 4 : - for ty := 1 to ScanHeight do - begin - for tx := 1 to ScanWidth do - begin - if ( PLongWord( Addr1 )^ <> TransparentColor1 ) then - begin - Result := true; - exit; - end; - inc( Addr1, 4 ); - - end; - inc( Addr1, Mod1 ); - - end; - end; -end; - -procedure SDL_ORSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); -var - Src, Dest : TSDL_Rect; - Diff : integer; - SrcAddr, DestAddr, TransparentColor : cardinal; - // TransparentColor: cardinal; - _ebx, _esi, _edi, _esp : cardinal; - WorkX, WorkY : word; - SrcMod, DestMod : cardinal; - Bits : cardinal; -begin - if ( SrcSurface = nil ) or ( DestSurface = nil ) then - exit; // Remove this to make it faster - if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then - exit; // Remove this to make it faster - if SrcRect = nil then - begin - with Src do - begin - x := 0; - y := 0; - w := SrcSurface.w; - h := SrcSurface.h; - end; - end - else - Src := SrcRect^; - if DestRect = nil then - begin - Dest.x := 0; - Dest.y := 0; - end - else - Dest := DestRect^; - Dest.w := Src.w; - Dest.h := Src.h; - with DestSurface.Clip_Rect do - begin - // Source's right side is greater than the dest.cliprect - if Dest.x + Src.w > x + w then - begin - smallint( Src.w ) := x + w - Dest.x; - smallint( Dest.w ) := x + w - Dest.x; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's bottom side is greater than the dest.clip - if Dest.y + Src.h > y + h then - begin - smallint( Src.h ) := y + h - Dest.y; - smallint( Dest.h ) := y + h - Dest.y; - if smallint( Dest.h ) < 1 then - exit; - end; - // Source's left side is less than the dest.clip - if Dest.x < x then - begin - Diff := x - Dest.x; - Src.x := Src.x + Diff; - smallint( Src.w ) := smallint( Src.w ) - Diff; - Dest.x := x; - smallint( Dest.w ) := smallint( Dest.w ) - Diff; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's Top side is less than the dest.clip - if Dest.y < y then - begin - Diff := y - Dest.y; - Src.y := Src.y + Diff; - smallint( Src.h ) := smallint( Src.h ) - Diff; - Dest.y := y; - smallint( Dest.h ) := smallint( Dest.h ) - Diff; - if smallint( Dest.h ) < 1 then - exit; - end; - end; - with SrcSurface^ do - begin - SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * - Format.BytesPerPixel; - SrcMod := Pitch - Src.w * Format.BytesPerPixel; - TransparentColor := Format.colorkey; - end; - with DestSurface^ do - begin - DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * - Format.BytesPerPixel; - DestMod := Pitch - Dest.w * Format.BytesPerPixel; - Bits := Format.BitsPerPixel; - end; - SDL_LockSurface( SrcSurface ); - SDL_LockSurface( DestSurface ); - WorkY := Src.h; - case bits of - 8 : - asm - mov _ebx, ebx - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - @Loopx: - mov al, [esi] // AL := source color - cmp al, 0 - je @SkipColor // if AL=0 or AL=transparent color then skip everything - cmp al, byte ptr TransparentColor - je @SkipColor - or al, [edi] - mov [edi], al - @SkipColor: - inc esi - inc edi - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - mov ebx,_ebx - end; - 15 : - asm - mov _ebx, ebx - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - @Loopx: - mov ax, [esi] // AX := source color - cmp ax, 0 - je @SkipColor // if AX=0 then skip everything - cmp ax, word ptr TransparentColor - je @SkipColor - or ax, [edi] - mov [edi], ax - @SkipColor: - add esi, 2 - add edi, 2 - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - mov ebx,_ebx - end; - 16 : - asm - mov _ebx, ebx - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - @Loopx: - mov ax, [esi] // AX := source color - cmp ax, 0 - je @SkipColor // if AX=0 then skip everything - cmp ax, word ptr TransparentColor - je @SkipColor - or ax, [edi] - mov [edi], ax - @SkipColor: - add esi, 2 - add edi, 2 - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - mov ebx,_ebx - end; - 24 : - asm - mov _ebx, ebx - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - add WorkX, ax // WorkX := Src.w * 2 - add WorkX, ax // WorkX := Src.w * 3 - @Loopx: - mov al, [esi] // AL := source color - or al, [edi] - mov [edi], al - inc esi - inc edi - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - mov ebx,_ebx - end; - 32 : - asm - mov _ebx, ebx - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - shl ax, 2 - mov WorkX, ax // WorkX := Src.w * 4 - @Loopx: - mov al, [esi] // AL := source color - or al, [edi] - mov [edi], al - inc esi - inc edi - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - mov ebx,_ebx - end; - end; - SDL_UnlockSurface( SrcSurface ); - SDL_UnlockSurface( DestSurface ); -end; - -procedure SDL_ANDSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); -var - Src, Dest : TSDL_Rect; - Diff : integer; - SrcAddr, DestAddr, TransparentColor : cardinal; - // TransparentColor: cardinal; - _ebx, _esi, _edi, _esp : cardinal; - WorkX, WorkY : word; - SrcMod, DestMod : cardinal; - Bits : cardinal; -begin - if ( SrcSurface = nil ) or ( DestSurface = nil ) then - exit; // Remove this to make it faster - if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then - exit; // Remove this to make it faster - if SrcRect = nil then - begin - with Src do - begin - x := 0; - y := 0; - w := SrcSurface.w; - h := SrcSurface.h; - end; - end - else - Src := SrcRect^; - if DestRect = nil then - begin - Dest.x := 0; - Dest.y := 0; - end - else - Dest := DestRect^; - Dest.w := Src.w; - Dest.h := Src.h; - with DestSurface.Clip_Rect do - begin - // Source's right side is greater than the dest.cliprect - if Dest.x + Src.w > x + w then - begin - smallint( Src.w ) := x + w - Dest.x; - smallint( Dest.w ) := x + w - Dest.x; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's bottom side is greater than the dest.clip - if Dest.y + Src.h > y + h then - begin - smallint( Src.h ) := y + h - Dest.y; - smallint( Dest.h ) := y + h - Dest.y; - if smallint( Dest.h ) < 1 then - exit; - end; - // Source's left side is less than the dest.clip - if Dest.x < x then - begin - Diff := x - Dest.x; - Src.x := Src.x + Diff; - smallint( Src.w ) := smallint( Src.w ) - Diff; - Dest.x := x; - smallint( Dest.w ) := smallint( Dest.w ) - Diff; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's Top side is less than the dest.clip - if Dest.y < y then - begin - Diff := y - Dest.y; - Src.y := Src.y + Diff; - smallint( Src.h ) := smallint( Src.h ) - Diff; - Dest.y := y; - smallint( Dest.h ) := smallint( Dest.h ) - Diff; - if smallint( Dest.h ) < 1 then - exit; - end; - end; - with SrcSurface^ do - begin - SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * - Format.BytesPerPixel; - SrcMod := Pitch - Src.w * Format.BytesPerPixel; - TransparentColor := Format.colorkey; - end; - with DestSurface^ do - begin - DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * - Format.BytesPerPixel; - DestMod := Pitch - Dest.w * Format.BytesPerPixel; - Bits := Format.BitsPerPixel; - end; - SDL_LockSurface( SrcSurface ); - SDL_LockSurface( DestSurface ); - WorkY := Src.h; - case bits of - 8 : - asm - mov _ebx, ebx - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - @Loopx: - mov al, [esi] // AL := source color - cmp al, 0 - je @SkipColor // if AL=0 or AL=transparent color then skip everything - cmp al, byte ptr TransparentColor - je @SkipColor - and al, [edi] - mov [edi], al - @SkipColor: - inc esi - inc edi - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - mov ebx,_ebx - end; - 15 : - asm - mov _ebx, ebx - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - @Loopx: - mov ax, [esi] // AX := source color - cmp ax, 0 - je @SkipColor // if AX=0 then skip everything - cmp ax, word ptr TransparentColor - je @SkipColor - and ax, [edi] - mov [edi], ax - @SkipColor: - add esi, 2 - add edi, 2 - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - mov ebx,_ebx - end; - 16 : - asm - mov _ebx, ebx - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - @Loopx: - mov ax, [esi] // AX := source color - cmp ax, 0 - je @SkipColor // if AX=0 then skip everything - cmp ax, word ptr TransparentColor - je @SkipColor - and ax, [edi] - mov [edi], ax - @SkipColor: - add esi, 2 - add edi, 2 - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - mov ebx,_ebx - end; - 24 : - asm - mov _ebx, ebx - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - mov WorkX, ax // WorkX := Src.w - add WorkX, ax // WorkX := Src.w * 2 - add WorkX, ax // WorkX := Src.w * 3 - @Loopx: - mov al, [esi] // AL := source color - and al, [edi] - mov [edi], al - inc esi - inc edi - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - mov ebx,_ebx - end; - 32 : - asm - mov _ebx, ebx - mov _esi, esi - mov _edi, edi - mov _esp, esp - mov esi, SrcAddr // ESI - Source Offset - mov edi, DestAddr // EDI - Destination Offset - mov ax, Src.h // WorkY := Src.h - mov WorkY, ax - @LoopY: - mov ax, Src.w - shl ax, 2 - mov WorkX, ax // WorkX := Src.w * 4 - @Loopx: - mov al, [esi] // AL := source color - and al, [edi] - mov [edi], al - inc esi - inc edi - dec WorkX - jnz @LoopX - add esi, SrcMod - add edi, DestMod - dec WorkY - jnz @LoopY - mov esp,_esp - mov edi,_edi - mov esi,_esi - mov ebx,_ebx - end; - end; - SDL_UnlockSurface( SrcSurface ); - SDL_UnlockSurface( DestSurface ); -end; - - -procedure SDL_GTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); -var - R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; - Src, Dest : TSDL_Rect; - Diff : integer; - SrcAddr, DestAddr : cardinal; - WorkX, WorkY : word; - SrcMod, DestMod : cardinal; - Bits : cardinal; -begin - if ( SrcSurface = nil ) or ( DestSurface = nil ) then - exit; // Remove this to make it faster - if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then - exit; // Remove this to make it faster - if SrcRect = nil then - begin - with Src do - begin - x := 0; - y := 0; - w := SrcSurface.w; - h := SrcSurface.h; - end; - end - else - Src := SrcRect^; - if DestRect = nil then - begin - Dest.x := 0; - Dest.y := 0; - end - else - Dest := DestRect^; - Dest.w := Src.w; - Dest.h := Src.h; - with DestSurface.Clip_Rect do - begin - // Source's right side is greater than the dest.cliprect - if Dest.x + Src.w > x + w then - begin - smallint( Src.w ) := x + w - Dest.x; - smallint( Dest.w ) := x + w - Dest.x; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's bottom side is greater than the dest.clip - if Dest.y + Src.h > y + h then - begin - smallint( Src.h ) := y + h - Dest.y; - smallint( Dest.h ) := y + h - Dest.y; - if smallint( Dest.h ) < 1 then - exit; - end; - // Source's left side is less than the dest.clip - if Dest.x < x then - begin - Diff := x - Dest.x; - Src.x := Src.x + Diff; - smallint( Src.w ) := smallint( Src.w ) - Diff; - Dest.x := x; - smallint( Dest.w ) := smallint( Dest.w ) - Diff; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's Top side is less than the dest.clip - if Dest.y < y then - begin - Diff := y - Dest.y; - Src.y := Src.y + Diff; - smallint( Src.h ) := smallint( Src.h ) - Diff; - Dest.y := y; - smallint( Dest.h ) := smallint( Dest.h ) - Diff; - if smallint( Dest.h ) < 1 then - exit; - end; - end; - with SrcSurface^ do - begin - SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * - Format.BytesPerPixel; - SrcMod := Pitch - Src.w * Format.BytesPerPixel; - TransparentColor := Format.colorkey; - end; - with DestSurface^ do - begin - DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * - Format.BytesPerPixel; - DestMod := Pitch - Dest.w * Format.BytesPerPixel; - Bits := Format.BitsPerPixel; - end; - SDL_LockSurface( SrcSurface ); - SDL_LockSurface( DestSurface ); - WorkY := Src.h; - case bits of - 8 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt8( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt8( DestAddr )^; - if Pixel2 > 0 then - begin - if Pixel2 and $E0 > Pixel1 and $E0 then R := Pixel2 and $E0 else R := Pixel1 and $E0; - if Pixel2 and $1C > Pixel1 and $1C then G := Pixel2 and $1C else G := Pixel1 and $1C; - if Pixel2 and $03 > Pixel1 and $03 then B := Pixel2 and $03 else B := Pixel1 and $03; - - if R > $E0 then - R := $E0; - if G > $1C then - G := $1C; - if B > $03 then - B := $03; - PUInt8( DestAddr )^ := R or G or B; - end - else - PUInt8( DestAddr )^ := Pixel1; - end; - inc( SrcAddr ); - inc( DestAddr ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 15 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt16( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt16( DestAddr )^; - if Pixel2 > 0 then - begin - - if Pixel2 and $7C00 > Pixel1 and $7C00 then R := Pixel2 and $7C00 else R := Pixel1 and $7C00; - if Pixel2 and $03E0 > Pixel1 and $03E0 then G := Pixel2 and $03E0 else G := Pixel1 and $03E0; - if Pixel2 and $001F > Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; - - PUInt16( DestAddr )^ := R or G or B; - end - else - PUInt16( DestAddr )^ := Pixel1; - end; - inc( SrcAddr, 2 ); - inc( DestAddr, 2 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 16 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt16( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt16( DestAddr )^; - if Pixel2 > 0 then - begin - - if Pixel2 and $F800 > Pixel1 and $F800 then R := Pixel2 and $F800 else R := Pixel1 and $F800; - if Pixel2 and $07E0 > Pixel1 and $07E0 then G := Pixel2 and $07E0 else G := Pixel1 and $07E0; - if Pixel2 and $001F > Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; - - PUInt16( DestAddr )^ := R or G or B; - end - else - PUInt16( DestAddr )^ := Pixel1; - end; - inc( SrcAddr, 2 ); - inc( DestAddr, 2 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 24 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; - if Pixel2 > 0 then - begin - - if Pixel2 and $FF0000 > Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; - if Pixel2 and $00FF00 > Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; - if Pixel2 and $0000FF > Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; - - PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or ( R or G or B ); - end - else - PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or Pixel1; - end; - inc( SrcAddr, 3 ); - inc( DestAddr, 3 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 32 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt32( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt32( DestAddr )^; - if Pixel2 > 0 then - begin - - if Pixel2 and $FF0000 > Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; - if Pixel2 and $00FF00 > Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; - if Pixel2 and $0000FF > Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; - - PUInt32( DestAddr )^ := R or G or B; - end - else - PUInt32( DestAddr )^ := Pixel1; - end; - inc( SrcAddr, 4 ); - inc( DestAddr, 4 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - end; - SDL_UnlockSurface( SrcSurface ); - SDL_UnlockSurface( DestSurface ); -end; - - -procedure SDL_LTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); -var - R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; - Src, Dest : TSDL_Rect; - Diff : integer; - SrcAddr, DestAddr : cardinal; - WorkX, WorkY : word; - SrcMod, DestMod : cardinal; - Bits : cardinal; -begin - if ( SrcSurface = nil ) or ( DestSurface = nil ) then - exit; // Remove this to make it faster - if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then - exit; // Remove this to make it faster - if SrcRect = nil then - begin - with Src do - begin - x := 0; - y := 0; - w := SrcSurface.w; - h := SrcSurface.h; - end; - end - else - Src := SrcRect^; - if DestRect = nil then - begin - Dest.x := 0; - Dest.y := 0; - end - else - Dest := DestRect^; - Dest.w := Src.w; - Dest.h := Src.h; - with DestSurface.Clip_Rect do - begin - // Source's right side is greater than the dest.cliprect - if Dest.x + Src.w > x + w then - begin - smallint( Src.w ) := x + w - Dest.x; - smallint( Dest.w ) := x + w - Dest.x; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's bottom side is greater than the dest.clip - if Dest.y + Src.h > y + h then - begin - smallint( Src.h ) := y + h - Dest.y; - smallint( Dest.h ) := y + h - Dest.y; - if smallint( Dest.h ) < 1 then - exit; - end; - // Source's left side is less than the dest.clip - if Dest.x < x then - begin - Diff := x - Dest.x; - Src.x := Src.x + Diff; - smallint( Src.w ) := smallint( Src.w ) - Diff; - Dest.x := x; - smallint( Dest.w ) := smallint( Dest.w ) - Diff; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's Top side is less than the dest.clip - if Dest.y < y then - begin - Diff := y - Dest.y; - Src.y := Src.y + Diff; - smallint( Src.h ) := smallint( Src.h ) - Diff; - Dest.y := y; - smallint( Dest.h ) := smallint( Dest.h ) - Diff; - if smallint( Dest.h ) < 1 then - exit; - end; - end; - with SrcSurface^ do - begin - SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * - Format.BytesPerPixel; - SrcMod := Pitch - Src.w * Format.BytesPerPixel; - TransparentColor := Format.colorkey; - end; - with DestSurface^ do - begin - DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * - Format.BytesPerPixel; - DestMod := Pitch - Dest.w * Format.BytesPerPixel; - Bits := Format.BitsPerPixel; - end; - SDL_LockSurface( SrcSurface ); - SDL_LockSurface( DestSurface ); - WorkY := Src.h; - case bits of - 8 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt8( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt8( DestAddr )^; - if Pixel2 > 0 then - begin - if Pixel2 and $E0 < Pixel1 and $E0 then R := Pixel2 and $E0 else R := Pixel1 and $E0; - if Pixel2 and $1C < Pixel1 and $1C then G := Pixel2 and $1C else G := Pixel1 and $1C; - if Pixel2 and $03 < Pixel1 and $03 then B := Pixel2 and $03 else B := Pixel1 and $03; - - if R > $E0 then - R := $E0; - if G > $1C then - G := $1C; - if B > $03 then - B := $03; - PUInt8( DestAddr )^ := R or G or B; - end - else - PUInt8( DestAddr )^ := Pixel1; - end; - inc( SrcAddr ); - inc( DestAddr ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 15 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt16( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt16( DestAddr )^; - if Pixel2 > 0 then - begin - - if Pixel2 and $7C00 < Pixel1 and $7C00 then R := Pixel2 and $7C00 else R := Pixel1 and $7C00; - if Pixel2 and $03E0 < Pixel1 and $03E0 then G := Pixel2 and $03E0 else G := Pixel1 and $03E0; - if Pixel2 and $001F < Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; - - PUInt16( DestAddr )^ := R or G or B; - end - else - PUInt16( DestAddr )^ := Pixel1; - end; - inc( SrcAddr, 2 ); - inc( DestAddr, 2 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 16 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt16( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt16( DestAddr )^; - if Pixel2 > 0 then - begin - - if Pixel2 and $F800 < Pixel1 and $F800 then R := Pixel2 and $F800 else R := Pixel1 and $F800; - if Pixel2 and $07E0 < Pixel1 and $07E0 then G := Pixel2 and $07E0 else G := Pixel1 and $07E0; - if Pixel2 and $001F < Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; - - PUInt16( DestAddr )^ := R or G or B; - end - else - PUInt16( DestAddr )^ := Pixel1; - end; - inc( SrcAddr, 2 ); - inc( DestAddr, 2 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 24 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; - if Pixel2 > 0 then - begin - - if Pixel2 and $FF0000 < Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; - if Pixel2 and $00FF00 < Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; - if Pixel2 and $0000FF < Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; - - PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or ( R or G or B ); - end - else - PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or Pixel1; - end; - inc( SrcAddr, 3 ); - inc( DestAddr, 3 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 32 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt32( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt32( DestAddr )^; - if Pixel2 > 0 then - begin - - if Pixel2 and $FF0000 < Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; - if Pixel2 and $00FF00 < Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; - if Pixel2 and $0000FF < Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; - - PUInt32( DestAddr )^ := R or G or B; - end - else - PUInt32( DestAddr )^ := Pixel1; - end; - inc( SrcAddr, 4 ); - inc( DestAddr, 4 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - end; - SDL_UnlockSurface( SrcSurface ); - SDL_UnlockSurface( DestSurface ); -end; - -function SDL_ClipLine(var x1,y1,x2,y2: Integer; ClipRect: PSDL_Rect) : boolean; -var tflag, flag1, flag2: word; - txy, xedge, yedge: Integer; - slope: single; - - function ClipCode(x,y: Integer): word; - begin - Result := 0; - if x < ClipRect.x then Result := 1; - if x >= ClipRect.w + ClipRect.x then Result := Result or 2; - if y < ClipRect.y then Result := Result or 4; - if y >= ClipRect.h + ClipRect.y then Result := Result or 8; - end; - -begin - flag1 := ClipCode(x1,y1); - flag2 := ClipCode(x2,y2); - result := true; - - while true do - begin - if (flag1 or flag2) = 0 then Exit; // all in - - if (flag1 and flag2) <> 0 then - begin - result := false; - Exit; // all out - end; - - if flag2 = 0 then - begin - txy := x1; x1 := x2; x2 := txy; - txy := y1; y1 := y2; y2 := txy; - tflag := flag1; flag1 := flag2; flag2 := tflag; - end; - - if (flag2 and 3) <> 0 then - begin - if (flag2 and 1) <> 0 then - xedge := ClipRect.x - else - xedge := ClipRect.w + ClipRect.x -1; // back 1 pixel otherwise we end up in a loop - - slope := (y2 - y1) / (x2 - x1); - y2 := y1 + Round(slope * (xedge - x1)); - x2 := xedge; - end - else - begin - if (flag2 and 4) <> 0 then - yedge := ClipRect.y - else - yedge := ClipRect.h + ClipRect.y -1; // up 1 pixel otherwise we end up in a loop - - slope := (x2 - x1) / (y2 - y1); - x2 := x1 + Round(slope * (yedge - y1)); - y2 := yedge; - end; - - flag2 := ClipCode(x2, y2); - end; -end; - -end. - - diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlinput.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlinput.pas deleted file mode 100644 index 2955d17a..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlinput.pas +++ /dev/null @@ -1,692 +0,0 @@ -unit sdlinput; -{ - $Id: sdlinput.pas,v 1.7 2004/09/30 22:32:04 savage Exp $ - -} -{******************************************************************************} -{ } -{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } -{ SDL Input Wrapper } -{ } -{ } -{ The initial developer of this Pascal code was : } -{ Dominique Louis } -{ } -{ Portions created by Dominique Louis are } -{ Copyright (C) 2003 - 2100 Dominique Louis. } -{ } -{ } -{ Contributor(s) } -{ -------------- } -{ Dominique Louis } -{ } -{ Obtained through: } -{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } -{ } -{ You may retrieve the latest version of this file at the Project } -{ JEDI home page, located at http://delphi-jedi.org } -{ } -{ The contents of this file are used with permission, subject to } -{ the Mozilla Public License Version 1.1 (the "License"); you may } -{ not use this file except in compliance with the License. You may } -{ obtain a copy of the License at } -{ http://www.mozilla.org/MPL/MPL-1.1.html } -{ } -{ Software distributed under the License is distributed on an } -{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } -{ implied. See the License for the specific language governing } -{ rights and limitations under the License. } -{ } -{ Description } -{ ----------- } -{ SDL Mouse, Keyboard and Joystick wrapper } -{ } -{ } -{ Requires } -{ -------- } -{ SDL.dll on Windows platforms } -{ libSDL-1.1.so.0 on Linux platform } -{ } -{ Programming Notes } -{ ----------------- } -{ } -{ } -{ } -{ } -{ Revision History } -{ ---------------- } -{ March 12 2003 - DL : Initial creation } -{ } -{ February 02 2004 - DL : Added Custom Cursor Support to the Mouse class } -{ - $Log: sdlinput.pas,v $ - Revision 1.7 2004/09/30 22:32:04 savage - Updated with slightly different header comments - - Revision 1.6 2004/09/12 21:52:58 savage - Slight changes to fix some issues with the sdl classes. - - Revision 1.5 2004/05/10 21:11:49 savage - changes required to help get SoAoS off the ground. - - Revision 1.4 2004/05/03 22:38:40 savage - Added the ability to enable or disable certain inputs @ runtime. Basically it just does not call UpdateInput if Enabled = false. - Can also disable and enable input devices via the InputManager. - - Revision 1.3 2004/04/28 21:27:01 savage - Updated Joystick code and event handlers. Needs testing... - - Revision 1.2 2004/02/14 22:36:29 savage - Fixed inconsistencies of using LoadLibrary and LoadModule. - Now all units make use of LoadModule rather than LoadLibrary and other dynamic proc procedures. - - Revision 1.1 2004/02/05 00:08:20 savage - Module 1.0 release - - -} -{******************************************************************************} - -interface - -{$i jedi-sdl.inc} - -uses - Classes, - sdl; - -type - TSDLInputType = ( itJoystick , itKeyBoard, itMouse ); - TSDLInputTypes = set of TSDLInputType; - - TSDLCustomInput = class( TObject ) - private - FEnabled: Boolean; - public - constructor Create; - function UpdateInput( event: TSDL_EVENT ) : Boolean; virtual; abstract; - property Enabled : Boolean read FEnabled write FEnabled; - end; - - TSDLJoyAxisMoveEvent = procedure ( Which: UInt8; Axis: UInt8; Value: SInt16 ) {$IFNDEF NOT_OO}of object{$ENDIF}; - TSDLJoyBallMoveEvent = procedure ( Which: UInt8; Ball: UInt8; RelativePos: TPoint ) {$IFNDEF NOT_OO}of object{$ENDIF}; - TSDLJoyHatMoveEvent = procedure ( Which: UInt8; Hat: UInt8; Value: SInt16 ) {$IFNDEF NOT_OO}of object{$ENDIF}; - TSDLJoyButtonEvent = procedure ( Which: UInt8; Button: UInt8; State: SInt16 ) {$IFNDEF NOT_OO}of object{$ENDIF}; - - - TSDLJoyStick = class( TSDLCustomInput ) - private - FJoystick : PSDL_Joystick; - FJoystickIndex : Integer; - FJoyAxisMoveEvent : TSDLJoyAxisMoveEvent; - FJoyBallMoveEvent : TSDLJoyBallMoveEvent; - FJoyHatMoveEvent : TSDLJoyHatMoveEvent; - FJoyButtonDownEvent : TSDLJoyButtonEvent; - FJoyButtonUpEvent : TSDLJoyButtonEvent; - procedure DoAxisMove( Event : TSDL_Event ); - procedure DoBallMove( Event : TSDL_Event ); - procedure DoHatMove( Event : TSDL_Event ); - procedure DoButtonDown( Event : TSDL_Event ); - procedure DoButtonUp( Event : TSDL_Event ); - function GetName: PChar; - function GetNumAxes: integer; - function GetNumBalls: integer; - function GetNumButtons: integer; - function GetNumHats: integer; - public - constructor Create( Index : Integer ); - destructor Destroy; override; - procedure Open; - procedure Close; - function UpdateInput( Event: TSDL_EVENT ) : Boolean; override; - property Name : PChar read GetName; - property NumAxes : integer read GetNumAxes; - property NumBalls : integer read GetNumBalls; - property NumButtons : integer read GetNumButtons; - property NumHats : integer read GetNumHats; - property OnAxisMove : TSDLJoyAxisMoveEvent read FJoyAxisMoveEvent write FJoyAxisMoveEvent; - property OnBallMove : TSDLJoyBallMoveEvent read FJoyBallMoveEvent write FJoyBallMoveEvent; - property OnHatMove : TSDLJoyHatMoveEvent read FJoyHatMoveEvent write FJoyHatMoveEvent; - property OnButtonDown : TSDLJoyButtonEvent read FJoyButtonDownEvent write FJoyButtonDownEvent; - property OnButtonUp : TSDLJoyButtonEvent read FJoyButtonUpEvent write FJoyButtonUpEvent; - end; - - TSDLJoySticks = class( TObject ) - private - FNumOfJoySticks: Integer; - FJoyStickList : TList; - function GetJoyStick(Index: integer): TSDLJoyStick; - procedure SetJoyStick(Index: integer; const Value: TSDLJoyStick); - public - constructor Create; - destructor Destroy; override; - function UpdateInput( event: TSDL_EVENT ) : Boolean; - property NumOfJoySticks : Integer read FNumOfJoySticks write FNumOfJoySticks; - property JoySticks[ Index : integer ] : TSDLJoyStick read GetJoyStick write SetJoyStick; - end; - - TSDLKeyBoardEvent = procedure ( var Key: TSDLKey; Shift: TSDLMod; unicode : UInt16 ) {$IFNDEF NOT_OO}of object{$ENDIF}; - - TSDLKeyBoard = class( TSDLCustomInput ) - private - FKeys : PKeyStateArr; - FOnKeyUp: TSDLKeyBoardEvent; - FOnKeyDown: TSDLKeyBoardEvent; - procedure DoKeyDown( keysym : PSDL_keysym ); - procedure DoKeyUp( keysym : PSDL_keysym ); - public - function IsKeyDown( Key : TSDLKey ) : Boolean; - function IsKeyUp( Key : TSDLKey ) : Boolean; - function UpdateInput( event: TSDL_EVENT ) : Boolean; override; - property Keys : PKeyStateArr read FKeys write FKeys; - property OnKeyDown : TSDLKeyBoardEvent read FOnKeyDown write FOnKeyDown; - property OnKeyUp : TSDLKeyBoardEvent read FOnKeyUp write FOnKeyUp; - end; - - TSDLMouseButtonEvent = procedure ( Button : Integer; Shift: TSDLMod; MousePos : TPoint ) {$IFNDEF NOT_OO}of object{$ENDIF}; - TSDLMouseMoveEvent = procedure ( Shift: TSDLMod; CurrentPos : TPoint; RelativePos : TPoint ) {$IFNDEF NOT_OO}of object{$ENDIF}; - TSDLMouseWheelEvent = procedure ( WheelDelta : Integer; Shift: TSDLMod; MousePos : TPoint ) {$IFNDEF NOT_OO}of object{$ENDIF}; - - TSDLMouse = class( TSDLCustomInput ) - private - FDragging : Boolean; - FMousePos : TPoint; - FOnMouseUp: TSDLMouseButtonEvent; - FOnMouseDown: TSDLMouseButtonEvent; - FOnMouseMove: TSDLMouseMoveEvent; - FOnMouseWheel: TSDLMouseWheelEvent; - FCursor : PSDL_Cursor; // Cursor Pointer - procedure DoMouseMove( Event: TSDL_Event ); - procedure DoMouseDown( Event: TSDL_Event ); - procedure DoMouseUp( Event: TSDL_Event ); - procedure DoMouseWheelScroll( Event: TSDL_Event ); - function GetMousePosition: TPoint; - procedure SetMousePosition(const Value: TPoint); - public - destructor Destroy; override; - function UpdateInput( event: TSDL_EVENT ) : Boolean; override; - function MouseIsDown( Button : Integer ) : Boolean; - function MouseIsUp( Button : Integer ) : Boolean; - procedure SetCursor(data, mask: PUInt8; w, h, hot_x, hot_y: Integer); - procedure ShowCursor; - procedure HideCursor; - property OnMouseDown : TSDLMouseButtonEvent read FOnMouseDown write FOnMouseDown; - property OnMouseUp : TSDLMouseButtonEvent read FOnMouseUp write FOnMouseUp; - property OnMouseMove : TSDLMouseMoveEvent read FOnMouseMove write FOnMouseMove; - property OnMouseWheel : TSDLMouseWheelEvent read FOnMouseWheel write FOnMouseWheel; - property MousePosition : TPoint read GetMousePosition write SetMousePosition; - end; - - TSDLInputManager = class( TObject ) - private - FKeyBoard : TSDLKeyBoard; - FMouse : TSDLMouse; - FJoystick : TSDLJoysticks; - public - constructor Create( InitInputs : TSDLInputTypes ); - destructor Destroy; override; - procedure Disable( InitInputs : TSDLInputTypes; JoyStickNumber : Integer = 0 ); - procedure Enable( InitInputs : TSDLInputTypes; JoyStickNumber : Integer = 0 ); - function UpdateInputs( event: TSDL_EVENT ) : Boolean; - property KeyBoard : TSDLKeyBoard read FKeyBoard write FKeyBoard; - property Mouse : TSDLMouse read FMouse write FMouse; - property JoyStick : TSDLJoysticks read FJoyStick write FJoyStick; - end; - -implementation - -{ TSDLCustomInput } -constructor TSDLCustomInput.Create; -begin - inherited; - FEnabled := true; -end; - -{ TSDLJoysticks } -constructor TSDLJoysticks.Create; -var - i : integer; -begin - inherited; - if ( SDL_WasInit( SDL_INIT_JOYSTICK ) = 0 ) then - SDL_InitSubSystem( SDL_INIT_JOYSTICK ); - FNumOfJoySticks := SDL_NumJoysticks; - FJoyStickList := TList.Create; - for i := 0 to FNumOfJoySticks - 1 do - begin - FJoyStickList.Add( TSDLJoyStick.Create( i ) ); - end; -end; - -destructor TSDLJoysticks.Destroy; -var - i : integer; -begin - if FJoyStickList.Count > 0 then - begin - for i := 0 to FJoyStickList.Count - 1 do - begin - TSDLJoyStick( FJoyStickList.Items[i] ).Free; - end; - end; - SDL_QuitSubSystem( SDL_INIT_JOYSTICK ); - inherited; -end; - -function TSDLJoySticks.GetJoyStick(Index: integer): TSDLJoyStick; -begin - Result := TSDLJoyStick( FJoyStickList[ Index ] ); -end; - -procedure TSDLJoySticks.SetJoyStick(Index: integer; - const Value: TSDLJoyStick); -begin - FJoyStickList[ Index ] := @Value; -end; - -function TSDLJoysticks.UpdateInput(event: TSDL_EVENT): Boolean; -var - i : integer; -begin - result := false; - if FJoyStickList.Count > 0 then - begin - for i := 0 to FJoyStickList.Count - 1 do - begin - TSDLJoyStick( FJoyStickList.Items[i] ).UpdateInput( event ); - end; - end; -end; - -{ TSDLKeyBoard } -procedure TSDLKeyBoard.DoKeyDown(keysym: PSDL_keysym); -begin - if Assigned( FOnKeyDown ) then - FOnKeyDown( keysym.sym , keysym.modifier, keysym.unicode ); -end; - -procedure TSDLKeyBoard.DoKeyUp(keysym: PSDL_keysym); -begin - if Assigned( FOnKeyUp ) then - FOnKeyUp( keysym.sym , keysym.modifier, keysym.unicode ); -end; - -function TSDLKeyBoard.IsKeyDown( Key: TSDLKey ): Boolean; -begin - SDL_PumpEvents; - - // Populate Keys array - FKeys := PKeyStateArr( SDL_GetKeyState( nil ) ); - Result := ( FKeys[Key] = SDL_PRESSED ); -end; - -function TSDLKeyBoard.IsKeyUp( Key: TSDLKey ): Boolean; -begin - SDL_PumpEvents; - - // Populate Keys array - FKeys := PKeyStateArr( SDL_GetKeyState( nil ) ); - Result := ( FKeys[Key] = SDL_RELEASED ); -end; - -function TSDLKeyBoard.UpdateInput(event: TSDL_EVENT): Boolean; -begin - result := false; - if ( FEnabled ) then - begin - case event.type_ of - SDL_KEYDOWN : - begin - // handle key presses - DoKeyDown( @event.key.keysym ); - result := true; - end; - - SDL_KEYUP : - begin - // handle key releases - DoKeyUp( @event.key.keysym ); - result := true; - end; - end; - end; -end; - -{ TSDLMouse } -destructor TSDLMouse.Destroy; -begin - if FCursor <> nil then - SDL_FreeCursor( FCursor ); - inherited; -end; - -procedure TSDLMouse.DoMouseDown( Event: TSDL_Event ); -var - CurrentPos : TPoint; -begin - FDragging := true; - if Assigned( FOnMouseDown ) then - begin - CurrentPos.x := event.button.x; - CurrentPos.y := event.button.y; - FOnMouseDown( event.button.button, SDL_GetModState, CurrentPos ); - end; -end; - -procedure TSDLMouse.DoMouseMove( Event: TSDL_Event ); -var - CurrentPos, RelativePos : TPoint; -begin - if Assigned( FOnMouseMove ) then - begin - CurrentPos.x := event.motion.x; - CurrentPos.y := event.motion.y; - RelativePos.x := event.motion.xrel; - RelativePos.y := event.motion.yrel; - FOnMouseMove( SDL_GetModState, CurrentPos, RelativePos ); - end; -end; - -procedure TSDLMouse.DoMouseUp( event: TSDL_EVENT ); -var - Point : TPoint; -begin - FDragging := false; - if Assigned( FOnMouseUp ) then - begin - Point.x := event.button.x; - Point.y := event.button.y; - FOnMouseUp( event.button.button, SDL_GetModState, Point ); - end; -end; - -procedure TSDLMouse.DoMouseWheelScroll( event: TSDL_EVENT ); -var - Point : TPoint; -begin - if Assigned( FOnMouseWheel ) then - begin - Point.x := event.button.x; - Point.y := event.button.y; - if ( event.button.button = SDL_BUTTON_WHEELUP ) then - FOnMouseWheel( SDL_BUTTON_WHEELUP, SDL_GetModState, Point ) - else - FOnMouseWheel( SDL_BUTTON_WHEELDOWN, SDL_GetModState, Point ); - end; -end; - -function TSDLMouse.GetMousePosition: TPoint; -begin - SDL_PumpEvents; - - SDL_GetMouseState( FMousePos.X, FMousePos.Y ); - Result := FMousePos; -end; - -procedure TSDLMouse.HideCursor; -begin - SDL_ShowCursor( SDL_DISABLE ); -end; - -function TSDLMouse.MouseIsDown(Button: Integer): Boolean; -begin - SDL_PumpEvents; - - Result := ( SDL_GetMouseState( FMousePos.X, FMousePos.Y ) and SDL_BUTTON( Button ) = 0 ); -end; - -function TSDLMouse.MouseIsUp(Button: Integer): Boolean; -begin - SDL_PumpEvents; - - Result := not ( SDL_GetMouseState( FMousePos.X, FMousePos.Y ) and SDL_BUTTON( Button ) = 0 ); -end; - -procedure TSDLMouse.SetCursor(data, mask: PUInt8; w, h, hot_x, hot_y: Integer); -begin - if FCursor <> nil then - SDL_FreeCursor( FCursor ); - // create the cursor - FCursor := SDL_CreateCursor( data, mask, w, h, hot_x, hot_y ); - - // set the cursor - SDL_SetCursor( FCursor ); -end; - -procedure TSDLMouse.SetMousePosition(const Value: TPoint); -begin - SDL_WarpMouse( Value.x, Value.y ); -end; - -procedure TSDLMouse.ShowCursor; -begin - SDL_ShowCursor( SDL_ENABLE ); -end; - -function TSDLMouse.UpdateInput(event: TSDL_EVENT): Boolean; -begin - result := false; - if ( FEnabled ) then - begin - case event.type_ of - SDL_MOUSEMOTION : - begin - // handle Mouse Move - DoMouseMove( event ); - end; - - SDL_MOUSEBUTTONDOWN : - begin - // handle Mouse Down - if ( event.button.button = SDL_BUTTON_WHEELUP ) - or ( event.button.button = SDL_BUTTON_WHEELDOWN ) then - DoMouseWheelScroll( event ) - else - DoMouseDown( event ); - end; - - SDL_MOUSEBUTTONUP : - begin - // handle Mouse Up - if ( event.button.button = SDL_BUTTON_WHEELUP ) - or ( event.button.button = SDL_BUTTON_WHEELDOWN ) then - DoMouseWheelScroll( event ) - else - DoMouseUp( event ); - end; - end; - end; -end; - -{ TSDLInputManager } -constructor TSDLInputManager.Create(InitInputs: TSDLInputTypes); -begin - inherited Create; - if itJoystick in InitInputs then - FJoystick := TSDLJoysticks.Create; - - if itKeyBoard in InitInputs then - FKeyBoard := TSDLKeyBoard.Create; - - if itMouse in InitInputs then - FMouse := TSDLMouse.Create; -end; - -destructor TSDLInputManager.Destroy; -begin - if FJoystick <> nil then - FreeAndNil( FJoystick ); - if FKeyBoard <> nil then - FreeAndNil( FKeyBoard ); - if FMouse <> nil then - FreeAndNil( FMouse ); - inherited; -end; - -procedure TSDLInputManager.Disable( InitInputs : TSDLInputTypes; JoyStickNumber : Integer ); -begin - if itJoystick in InitInputs then - FJoystick.JoySticks[ JoyStickNumber ].Enabled := false; - - if itKeyBoard in InitInputs then - FKeyBoard.Enabled := false; - - if itMouse in InitInputs then - FMouse.Enabled := false; -end; - -procedure TSDLInputManager.Enable( InitInputs: TSDLInputTypes; JoyStickNumber: Integer ); -begin - if itJoystick in InitInputs then - FJoystick.JoySticks[ JoyStickNumber ].Enabled := true; - - if itKeyBoard in InitInputs then - FKeyBoard.Enabled := true; - - if itMouse in InitInputs then - FMouse.Enabled := true; -end; - -function TSDLInputManager.UpdateInputs( event: TSDL_EVENT ): Boolean; -begin - Result := false; - if ( FJoystick <> nil ) then - Result := FJoystick.UpdateInput( event ); - if ( FKeyBoard <> nil ) then - Result := FKeyBoard.UpdateInput( event ); - if ( FMouse <> nil ) then - Result := FMouse.UpdateInput( event ); -end; - -{ TSDLJoyStick } -procedure TSDLJoyStick.Close; -begin - SDL_JoystickClose( @FJoystick ); -end; - -constructor TSDLJoyStick.Create( Index : Integer ); -begin - inherited Create; - FJoystick := nil; - FJoystickIndex := Index; -end; - -destructor TSDLJoyStick.Destroy; -begin - if FJoystick <> nil then - Close; - inherited; -end; - -procedure TSDLJoyStick.DoAxisMove(Event: TSDL_Event); -begin - if Assigned( FJoyAxisMoveEvent ) then - begin - FJoyAxisMoveEvent( Event.jaxis.which, Event.jaxis.axis, Event.jaxis.value ); - end -end; - -procedure TSDLJoyStick.DoBallMove(Event: TSDL_Event); -var - BallPoint : TPoint; -begin - if Assigned( FJoyBallMoveEvent ) then - begin - BallPoint.x := Event.jball.xrel; - BallPoint.y := Event.jball.yrel; - FJoyBallMoveEvent( Event.jball.which, Event.jball.ball, BallPoint ); - end; -end; - -procedure TSDLJoyStick.DoButtonDown(Event: TSDL_Event); -begin - if Assigned( FJoyButtonDownEvent ) then - begin - if ( Event.jbutton.state = SDL_PRESSED ) then - FJoyButtonDownEvent( Event.jbutton.which, Event.jbutton.button, Event.jbutton.state ); - end; -end; - -procedure TSDLJoyStick.DoButtonUp(Event: TSDL_Event); -begin - if Assigned( FJoyButtonUpEvent ) then - begin - if ( Event.jbutton.state = SDL_RELEASED ) then - FJoyButtonUpEvent( Event.jbutton.which, Event.jbutton.button, Event.jbutton.state ); - end -end; - -procedure TSDLJoyStick.DoHatMove(Event: TSDL_Event); -begin - if Assigned( FJoyHatMoveEvent ) then - begin - FJoyHatMoveEvent( Event.jhat.which, Event.jhat.hat, Event.jhat.value ); - end; -end; - -function TSDLJoyStick.GetName: PChar; -begin - result := FJoystick.name; -end; - -function TSDLJoyStick.GetNumAxes: integer; -begin - result := FJoystick.naxes; -end; - -function TSDLJoyStick.GetNumBalls: integer; -begin - result := FJoystick.nballs; -end; - -function TSDLJoyStick.GetNumButtons: integer; -begin - result := FJoystick.nbuttons; -end; - -function TSDLJoyStick.GetNumHats: integer; -begin - result := FJoystick.nhats; -end; - -procedure TSDLJoyStick.Open; -begin - FJoystick := SDL_JoyStickOpen( FJoystickIndex ); -end; - -function TSDLJoyStick.UpdateInput(Event: TSDL_EVENT): Boolean; -begin - Result := false; - - if ( FEnabled ) then - begin - case event.type_ of - SDL_JOYAXISMOTION : - begin - DoAxisMove( Event ); - end; - - SDL_JOYBALLMOTION : - begin - DoBallMove( Event ); - end; - - SDL_JOYHATMOTION : - begin - DoHatMove( Event ); - end; - - SDL_JOYBUTTONDOWN : - begin - DoButtonDown( Event ); - end; - - SDL_JOYBUTTONUP : - begin - DoButtonUp( Event ); - end; - end; - end; -end; - -end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlstreams.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlstreams.pas deleted file mode 100644 index 64009176..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlstreams.pas +++ /dev/null @@ -1,216 +0,0 @@ -unit sdlstreams; -{ - $Id: sdlstreams.pas,v 1.1 2004/02/05 00:08:20 savage Exp $ - -} -{******************************************************************} -{ } -{ SDL - Simple DirectMedia Layer } -{ Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga } -{ } -{ Portions created by Chris Bruner are } -{ Copyright (C) 2002 Chris Bruner. } -{ } -{ Contributor(s) } -{ -------------- } -{ } -{ } -{ Obtained through: } -{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } -{ } -{ You may retrieve the latest version of this file at the Project } -{ JEDI home page, located at http://delphi-jedi.org } -{ } -{ The contents of this file are used with permission, subject to } -{ the Mozilla Public License Version 1.1 (the "License"); you may } -{ not use this file except in compliance with the License. You may } -{ obtain a copy of the License at } -{ http://www.mozilla.org/NPL/NPL-1_1Final.html } -{ } -{ Software distributed under the License is distributed on an } -{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } -{ implied. See the License for the specific language governing } -{ rights and limitations under the License. } -{ } -{ Description } -{ ----------- } -{ Shows how to use OpenGL to do 2D and 3D with the SDL libraries } -{ } -{ } -{ Requires } -{ -------- } -{ SDL runtime libary somewhere in your path } -{ The Latest SDL runtime can be found on http://www.libsdl.org } -{ } -{ Programming Notes } -{ ----------------- } -{ } -{ } -{ } -{ } -{ } -{ Revision History } -{ ---------------- } -{ January 11 2002 - CB : Software embraced and extended by } -{ Chris Bruner of Crystal Software } -{ (Canada) Inc. } -{ } -{ February 11 2002 - DL : Added FreePascal support as suggested } -{ by "QuePasha Pepe" } -{ } -{******************************************************************} -{ - $Log: sdlstreams.pas,v $ - Revision 1.1 2004/02/05 00:08:20 savage - Module 1.0 release - - -} - -{$i jedi-sdl.inc} - -interface - -uses - Classes, - SysUtils, - sdl, - sdlutils; - -{$IFDEF FPC} -type - EinvalidContainer=class(Exception); - {$ENDIF} - -function LoadSDLBMPFromStream( Stream : TStream ) : PSDL_Surface; -procedure SaveSDLBMPToStream( SDL_Surface : PSDL_Surface; stream : TStream ); -function SDL_Swap16( D : UInt16 ) : Uint16; -function SDL_Swap32( D : UInt32 ) : Uint32; -function SDLStreamSetup( stream : TStream ) : PSDL_RWops; -// this only closes the SDL_RWops part of the stream, not the stream itself -procedure SDLStreamCloseRWops( SDL_RWops : PSDL_RWops ); - -implementation - -function SDL_Swap16( D : UInt16 ) : Uint16; -begin - Result := ( D shl 8 ) or ( D shr 8 ); -end; - -function SDL_Swap32( D : UInt32 ) : Uint32; -begin - Result := ( ( D shl 24 ) or ( ( D shl 8 ) and $00FF0000 ) or ( ( D shr 8 ) and $0000FF00 ) or ( D shr 24 ) ); -end; - -(*function SDL_Swap64(D : UInt64) : Uint64; -var hi,lo : Uint32; -begin - // Separate into high and low 32-bit resultues and swap them - lo := Uint32(D and $0FFFFFFFF); // bloody pascal is too tight in it's type checking! - D := D shr 32; - hi = Uint32((D and $FFFFFFFF)); - result = SDL_Swap32(lo); - result := result shl 32; - result := result or SDL_Swap32(hi); -end; -*) - -function SdlStreamSeek( context : PSDL_RWops; offset : Integer; whence : Integer ) : integer; cdecl; -var - stream : TStream; - origin : Word; -begin - stream := TStream( context.unknown ); - if ( stream = nil ) then - raise EInvalidContainer.Create( 'SDLStreamSeek on nil' ); - case whence of - 0 : origin := soFromBeginning; // Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0. - 1 : origin := soFromCurrent; // Offset is from the current position in the resource. Seek moves to Position + Offset. - 2 : origin := soFromEnd; - else - origin := soFromBeginning; // just in case - end; - Result := stream.Seek( offset, origin ); -end; - -function SDLStreamWrite( context : PSDL_RWops; Ptr : Pointer; - size : Integer; num : Integer ) : Integer; cdecl; -var - stream : TStream; -begin - stream := TStream( context.unknown ); - if ( stream = nil ) then - raise EInvalidContainer.Create( 'SDLStreamWrite on nil' ); - try - Result := stream.Write( Ptr^, Size * num ) div size; - except - Result := -1; - end; -end; - -function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : Integer; maxnum - : Integer ) : Integer; cdecl; -var - stream : TStream; -begin - stream := TStream( context.unknown ); - if ( stream = nil ) then - raise EInvalidContainer.Create( 'SDLStreamRead on nil' ); - try - Result := stream.read( Ptr^, Size * maxnum ) div size; - except - Result := -1; - end; -end; - -function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl; -var - stream : TStream; -begin - stream := TStream( context.unknown ); - if ( stream = nil ) then - raise EInvalidContainer.Create( 'SDLStreamClose on nil' ); - stream.Free; - Result := 1; -end; - -function SDLStreamSetup( stream : TStream ) : PSDL_RWops; -begin - result := SDL_AllocRW; - if ( result = nil ) then - raise EInvalidContainer.Create( 'could not create SDLStream on nil' ); - result.unknown := TUnknown( stream ); - result.seek := SDLStreamSeek; - result.read := SDLStreamRead; - result.write := SDLStreamWrite; - result.close := SDLStreamClose; - Result.type_ := 2; // TUnknown -end; - -// this only closes the SDL part of the stream, not the context - -procedure SDLStreamCloseRWops( SDL_RWops : PSDL_RWops ); -begin - SDL_FreeRW( SDL_RWops ); -end; - -function LoadSDLBMPFromStream( stream : TStream ) : PSDL_Surface; -var - SDL_RWops : PSDL_RWops; -begin - SDL_RWops := SDLStreamSetup( stream ); - result := SDL_LoadBMP_RW( SDL_RWops, 0 ); - SDLStreamCloseRWops( SDL_RWops ); -end; - -procedure SaveSDLBMPToStream( SDL_Surface : PSDL_Surface; stream : TStream ); -var - SDL_RWops : PSDL_RWops; -begin - SDL_RWops := SDLStreamSetup( stream ); - SDL_SaveBMP_RW( SDL_Surface, SDL_RWops, 0 ); - SDLStreamCloseRWops( SDL_RWops ); -end; - -end. - diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlticks.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlticks.pas deleted file mode 100644 index 4e91ecb8..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlticks.pas +++ /dev/null @@ -1,196 +0,0 @@ -unit sdlticks; -{ - $Id: sdlticks.pas,v 1.1 2004/09/30 22:35:47 savage Exp $ - -} -{******************************************************************************} -{ } -{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } -{ SDL GetTicks Class Wrapper } -{ } -{ } -{ The initial developer of this Pascal code was : } -{ Dominique Louis } -{ } -{ Portions created by Dominique Louis are } -{ Copyright (C) 2004 - 2100 Dominique Louis. } -{ } -{ } -{ Contributor(s) } -{ -------------- } -{ Dominique Louis } -{ } -{ Obtained through: } -{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } -{ } -{ You may retrieve the latest version of this file at the Project } -{ JEDI home page, located at http://delphi-jedi.org } -{ } -{ The contents of this file are used with permission, subject to } -{ the Mozilla Public License Version 1.1 (the "License"); you may } -{ not use this file except in compliance with the License. You may } -{ obtain a copy of the License at } -{ http://www.mozilla.org/MPL/MPL-1.1.html } -{ } -{ Software distributed under the License is distributed on an } -{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } -{ implied. See the License for the specific language governing } -{ rights and limitations under the License. } -{ } -{ Description } -{ ----------- } -{ SDL Window Wrapper } -{ } -{ } -{ Requires } -{ -------- } -{ SDL.dll on Windows platforms } -{ libSDL-1.1.so.0 on Linux platform } -{ } -{ Programming Notes } -{ ----------------- } -{ } -{ } -{ } -{ } -{ Revision History } -{ ---------------- } -{ } -{ September 23 2004 - DL : Initial Creation } -{ - $Log: sdlticks.pas,v $ - Revision 1.1 2004/09/30 22:35:47 savage - Changes, enhancements and additions as required to get SoAoS working. - - -} -{******************************************************************************} - -interface - -uses - sdl; - - -type - TSDLTicks = class - private - m_startTime : Int64; - m_ticksPerSecond : Int64; - s_lastTime : Int64; - - public - constructor Create; - destructor Destroy; override; // destructor - - {***************************************************************************** - Init - - If the hi-res timer is present, the tick rate is stored and the function - returns true. Otherwise, the function returns false, and the timer should - not be used. - *****************************************************************************} - function Init : boolean; - - function GetElapsedSeconds( elapsedFrames : Cardinal = 1 ) : single; - - {*************************************************************************** - GetFPS - - Returns the average frames per second over elapsedFrames, which defaults to - one. If this is not called every frame, the client should track the number - of frames itself, and reset the value after this is called. - ***************************************************************************} - function GetFPS( elapsedFrames : Cardinal = 1 ) : single; - - {*************************************************************************** - LockFPS - - Used to lock the frame rate to a set amount. This will block until enough - time has passed to ensure that the fps won't go over the requested amount. - Note that this can only keep the fps from going above the specified level; - it can still drop below it. It is assumed that if used, this function will - be called every frame. The value returned is the instantaneous fps, which - will be <= targetFPS. - ***************************************************************************} - function LockFPS( targetFPS : Byte ) : single; - end; - -implementation - -{ TSDLTicks } -constructor TSDLTicks.Create; -begin - -end; - -destructor TSDLTicks.Destroy; -begin - - inherited; -end; - -function TSDLTicks.GetElapsedSeconds( elapsedFrames: Cardinal ): single; -var - currentTime : Int64; -begin - // s_lastTime := m_startTime; - - currentTime := SDL_GetTicks; - //QueryPerformanceCounter( currentTime ); - - result := (currentTime - s_lastTime) / m_ticksPerSecond; - - // reset the timer - s_lastTime := currentTime; -end; - -function TSDLTicks.GetFPS( elapsedFrames: Cardinal ): single; -var - currentTime : integer; - fps : single; -begin - // s_lastTime := m_startTime; - - currentTime := SDL_GetTicks; - - fps := elapsedFrames * m_ticksPerSecond / ( currentTime - s_lastTime); - - // reset the timer - s_lastTime := currentTime; - - result := fps; -end; - -function TSDLTicks.Init: boolean; -begin - m_startTime := SDL_GetTicks; - s_lastTime := m_startTime; - m_ticksPerSecond := 1000; - result := true; -end; - -function TSDLTicks.LockFPS(targetFPS: Byte): single; -var - currentTime : integer; - fps : single; -begin - if (targetFPS = 0) then - targetFPS := 1; - - s_lastTime := m_startTime; - - // delay to maintain a constant frame rate - repeat - currentTime := SDL_GetTicks; - fps := m_ticksPerSecond / (currentTime - s_lastTime); - until (fps > targetFPS); - - // reset the timer - s_lastTime := m_startTime; - - result := fps; -end; - -end. - \ No newline at end of file diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlutils.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlutils.pas deleted file mode 100644 index bef83cbc..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlutils.pas +++ /dev/null @@ -1,4256 +0,0 @@ -unit sdlutils; -{ - $Id: sdlutils.pas,v 1.4 2004/06/02 19:38:53 savage Exp $ - -} -{******************************************************************************} -{ } -{ Borland Delphi SDL - Simple DirectMedia Layer } -{ SDL Utility functions } -{ } -{ } -{ The initial developer of this Pascal code was : } -{ Tom Jones } -{ } -{ Portions created by Tom Jones are } -{ Copyright (C) 2000 - 2001 Tom Jones. } -{ } -{ } -{ Contributor(s) } -{ -------------- } -{ Dominique Louis } -{ Róbert Kisnémeth } -{ } -{ Obtained through: } -{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } -{ } -{ You may retrieve the latest version of this file at the Project } -{ JEDI home page, located at http://delphi-jedi.org } -{ } -{ The contents of this file are used with permission, subject to } -{ the Mozilla Public License Version 1.1 (the "License"); you may } -{ not use this file except in compliance with the License. You may } -{ obtain a copy of the License at } -{ http://www.mozilla.org/MPL/MPL-1.1.html } -{ } -{ Software distributed under the License is distributed on an } -{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } -{ implied. See the License for the specific language governing } -{ rights and limitations under the License. } -{ } -{ Description } -{ ----------- } -{ Helper functions... } -{ } -{ } -{ Requires } -{ -------- } -{ SDL.dll on Windows platforms } -{ libSDL-1.1.so.0 on Linux platform } -{ } -{ Programming Notes } -{ ----------------- } -{ } -{ } -{ } -{ } -{ Revision History } -{ ---------------- } -{ 2000 - TJ : Initial creation } -{ } -{ July 13 2001 - DL : Added PutPixel and GetPixel routines. } -{ } -{ Sept 14 2001 - RK : Added flipping routines. } -{ } -{ Sept 19 2001 - RK : Added PutPixel & line drawing & blitting with ADD } -{ effect. Fixed a bug in SDL_PutPixel & SDL_GetPixel } -{ Added PSDLRect() } -{ Sept 22 2001 - DL : Removed need for Windows.pas by defining types here} -{ Also removed by poor attempt or a dialog box } -{ } -{ Sept 25 2001 - RK : Added PixelTest, NewPutPixel, SubPixel, SubLine, } -{ SubSurface, MonoSurface & TexturedSurface } -{ } -{ Sept 26 2001 - DL : Made change so that it refers to native Pascal } -{ types rather that Windows types. This makes it more} -{ portable to Linix. } -{ } -{ Sept 27 2001 - RK : SDLUtils now can be compiled with FreePascal } -{ } -{ Oct 27 2001 - JF : Added ScrollY function } -{ } -{ Jan 21 2002 - RK : Added SDL_ZoomSurface and SDL_WarpSurface } -{ } -{ Mar 28 2002 - JF : Added SDL_RotateSurface } -{ } -{ May 13 2002 - RK : Improved SDL_FillRectAdd & SDL_FillRectSub } -{ } -{ May 27 2002 - YS : GradientFillRect function } -{ } -{ May 30 2002 - RK : Added SDL_2xBlit, SDL_Scanline2xBlit } -{ & SDL_50Scanline2xBlit } -{ } -{ June 12 2002 - RK : Added SDL_PixelTestSurfaceVsRect } -{ } -{ June 12 2002 - JF : Updated SDL_PixelTestSurfaceVsRect } -{ } -{ November 9 2002 - JF : Added Jason's boolean Surface functions } -{ } -{ December 10 2002 - DE : Added Dean's SDL_ClipLine function } -{ } -{ April 26 2003 - SS : Incorporated JF's changes to SDL_ClipLine } -{ Fixed SDL_ClipLine bug for non-zero cliprect x, y } -{ Added overloaded SDL_DrawLine for dashed lines } -{ } -{******************************************************************************} -{ - $Log: sdlutils.pas,v $ - Revision 1.4 2004/06/02 19:38:53 savage - Changes to SDL_GradientFillRect as suggested by - Ángel Eduardo García Hernández. Many thanks. - - Revision 1.3 2004/05/29 23:11:54 savage - Changes to SDL_ScaleSurfaceRect as suggested by - Ángel Eduardo García Hernández to fix a colour issue with the function. Many thanks. - - Revision 1.2 2004/02/14 00:23:39 savage - As UNIX is defined in jedi-sdl.inc this will be used to check linux compatability as well. Units have been changed to reflect this change. - - Revision 1.1 2004/02/05 00:08:20 savage - Module 1.0 release - - -} - -interface - -{$i jedi-sdl.inc} - -uses -{$IFDEF UNIX} - Types, - Xlib, -{$ENDIF} - SysUtils, - sdl; - -type - TGradientStyle = ( gsHorizontal, gsVertical ); - -// Pixel procedures -function SDL_PixelTest( SrcSurface1 : PSDL_Surface; SrcRect1 : PSDL_Rect; SrcSurface2 : - PSDL_Surface; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : Boolean; - -function SDL_GetPixel( SrcSurface : PSDL_Surface; x : integer; y : integer ) : Uint32; - -procedure SDL_PutPixel( DstSurface : PSDL_Surface; x : integer; y : integer; pixel : - Uint32 ); - -procedure SDL_AddPixel( DstSurface : PSDL_Surface; x : cardinal; y : cardinal; Color : - cardinal ); - -procedure SDL_SubPixel( DstSurface : PSDL_Surface; x : cardinal; y : cardinal; Color : - cardinal ); - -// Line procedures -procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : - cardinal ); overload; - -procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : - cardinal ; DashLength, DashSpace : byte ); overload; - -procedure SDL_AddLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : - cardinal ); - -procedure SDL_SubLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : - cardinal ); - -// Surface procedures -procedure SDL_AddSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); - -procedure SDL_SubSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); - -procedure SDL_MonoSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect; Color : cardinal ); - -procedure SDL_TexturedSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect; Texture : PSDL_Surface; - TextureRect : PSDL_Rect ); - -procedure SDL_ZoomSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; DstRect : PSDL_Rect ); - -procedure SDL_WarpSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; UL, UR, LR, LL : PPoint ); - -// Flip procedures -procedure SDL_FlipRectH( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); - -procedure SDL_FlipRectV( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); - -function PSDLRect( aLeft, aTop, aWidth, aHeight : integer ) : PSDL_Rect; - -function SDLRect( aLeft, aTop, aWidth, aHeight : integer ) : TSDL_Rect; overload; - -function SDLRect( aRect : TRect ) : TSDL_Rect; overload; - -function SDL_ScaleSurfaceRect( SrcSurface : PSDL_Surface; SrcX1, SrcY1, SrcW, SrcH, - Width, Height : integer ) : PSDL_Surface; - -procedure SDL_ScrollY( DstSurface : PSDL_Surface; DifY : integer ); - -procedure SDL_ScrollX( DstSurface : PSDL_Surface; DifX : integer ); - -procedure SDL_RotateDeg( DstSurface, SrcSurface : PSDL_Surface; SrcRect : - PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Integer ); - -procedure SDL_RotateRad( DstSurface, SrcSurface : PSDL_Surface; SrcRect : - PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Single ); - -function ValidateSurfaceRect( DstSurface : PSDL_Surface; dstrect : PSDL_Rect ) : TSDL_Rect; - -// Fill Rect routine -procedure SDL_FillRectAdd( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); - -procedure SDL_FillRectSub( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); - -procedure SDL_GradientFillRect( DstSurface : PSDL_Surface; const Rect : PSDL_Rect; const StartColor, EndColor : TSDL_Color; const Style : TGradientStyle ); - -// NOTE for All SDL_2xblit... function : the dest surface must be 2x of the source surface! -procedure SDL_2xBlit(Src, Dest: PSDL_Surface); - -procedure SDL_Scanline2xBlit(Src, Dest: PSDL_Surface); - -procedure SDL_50Scanline2xBlit(Src, Dest: PSDL_Surface); - -// -function SDL_PixelTestSurfaceVsRect( SrcSurface1 : PSDL_Surface; SrcRect1 : -PSDL_Rect; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : -boolean; - -// Jason's boolean Surface functions -procedure SDL_ORSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); - -procedure SDL_ANDSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); - - -procedure SDL_GTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); - -procedure SDL_LTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); - -function SDL_ClipLine(var x1,y1,x2,y2: Integer; ClipRect: PSDL_Rect) : boolean; - -implementation - -uses - Math; - -function SDL_PixelTest( SrcSurface1 : PSDL_Surface; SrcRect1 : PSDL_Rect; SrcSurface2 : - PSDL_Surface; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : boolean; -var - Src_Rect1, Src_Rect2 : TSDL_Rect; - right1, bottom1 : integer; - right2, bottom2 : integer; - Scan1Start, Scan2Start, ScanWidth, ScanHeight : cardinal; - Mod1, Mod2 : cardinal; - Addr1, Addr2 : cardinal; - BPP : cardinal; - Pitch1, Pitch2 : cardinal; - TransparentColor1, TransparentColor2 : cardinal; - tx, ty : cardinal; - StartTick : cardinal; - Color1, Color2 : cardinal; -begin - Result := false; - if SrcRect1 = nil then - begin - with Src_Rect1 do - begin - x := 0; - y := 0; - w := SrcSurface1.w; - h := SrcSurface1.h; - end; - end - else - Src_Rect1 := SrcRect1^; - if SrcRect2 = nil then - begin - with Src_Rect2 do - begin - x := 0; - y := 0; - w := SrcSurface2.w; - h := SrcSurface2.h; - end; - end - else - Src_Rect2 := SrcRect2^; - with Src_Rect1 do - begin - Right1 := Left1 + w; - Bottom1 := Top1 + h; - end; - with Src_Rect2 do - begin - Right2 := Left2 + w; - Bottom2 := Top2 + h; - end; - if ( Left1 >= Right2 ) or ( Right1 <= Left2 ) or ( Top1 >= Bottom2 ) or ( Bottom1 <= - Top2 ) then - exit; - if Left1 <= Left2 then - begin - // 1. left, 2. right - Scan1Start := Src_Rect1.x + Left2 - Left1; - Scan2Start := Src_Rect2.x; - ScanWidth := Right1 - Left2; - with Src_Rect2 do - if ScanWidth > w then - ScanWidth := w; - end - else - begin - // 1. right, 2. left - Scan1Start := Src_Rect1.x; - Scan2Start := Src_Rect2.x + Left1 - Left2; - ScanWidth := Right2 - Left1; - with Src_Rect1 do - if ScanWidth > w then - ScanWidth := w; - end; - with SrcSurface1^ do - begin - Pitch1 := Pitch; - Addr1 := cardinal( Pixels ); - inc( Addr1, Pitch1 * UInt32( Src_Rect1.y ) ); - with format^ do - begin - BPP := BytesPerPixel; - TransparentColor1 := colorkey; - end; - end; - with SrcSurface2^ do - begin - TransparentColor2 := format.colorkey; - Pitch2 := Pitch; - Addr2 := cardinal( Pixels ); - inc( Addr2, Pitch2 * UInt32( Src_Rect2.y ) ); - end; - Mod1 := Pitch1 - ( ScanWidth * BPP ); - Mod2 := Pitch2 - ( ScanWidth * BPP ); - inc( Addr1, BPP * Scan1Start ); - inc( Addr2, BPP * Scan2Start ); - if Top1 <= Top2 then - begin - // 1. up, 2. down - ScanHeight := Bottom1 - Top2; - if ScanHeight > Src_Rect2.h then - ScanHeight := Src_Rect2.h; - inc( Addr1, Pitch1 * UInt32( Top2 - Top1 ) ); - end - else - begin - // 1. down, 2. up - ScanHeight := Bottom2 - Top1; - if ScanHeight > Src_Rect1.h then - ScanHeight := Src_Rect1.h; - inc( Addr2, Pitch2 * UInt32( Top1 - Top2 ) ); - end; - case BPP of - 1 : - for ty := 1 to ScanHeight do - begin - for tx := 1 to ScanWidth do - begin - if ( PByte( Addr1 )^ <> TransparentColor1 ) and ( PByte( Addr2 )^ <> - TransparentColor2 ) then - begin - Result := true; - exit; - end; - inc( Addr1 ); - inc( Addr2 ); - end; - inc( Addr1, Mod1 ); - inc( Addr2, Mod2 ); - end; - 2 : - for ty := 1 to ScanHeight do - begin - for tx := 1 to ScanWidth do - begin - if ( PWord( Addr1 )^ <> TransparentColor1 ) and ( PWord( Addr2 )^ <> - TransparentColor2 ) then - begin - Result := true; - exit; - end; - inc( Addr1, 2 ); - inc( Addr2, 2 ); - end; - inc( Addr1, Mod1 ); - inc( Addr2, Mod2 ); - end; - 3 : - for ty := 1 to ScanHeight do - begin - for tx := 1 to ScanWidth do - begin - Color1 := PLongWord( Addr1 )^ and $00FFFFFF; - Color2 := PLongWord( Addr2 )^ and $00FFFFFF; - if ( Color1 <> TransparentColor1 ) and ( Color2 <> TransparentColor2 ) - then - begin - Result := true; - exit; - end; - inc( Addr1, 3 ); - inc( Addr2, 3 ); - end; - inc( Addr1, Mod1 ); - inc( Addr2, Mod2 ); - end; - 4 : - for ty := 1 to ScanHeight do - begin - for tx := 1 to ScanWidth do - begin - if ( PLongWord( Addr1 )^ <> TransparentColor1 ) and ( PLongWord( Addr2 )^ <> - TransparentColor2 ) then - begin - Result := true; - exit; - end; - inc( Addr1, 4 ); - inc( Addr2, 4 ); - end; - inc( Addr1, Mod1 ); - inc( Addr2, Mod2 ); - end; - end; -end; - -procedure SDL_AddPixel( DstSurface : PSDL_Surface; x : cardinal; y : cardinal; Color : - cardinal ); -var - SrcColor : cardinal; - Addr : cardinal; - R, G, B : cardinal; -begin - if Color = 0 then - exit; - with DstSurface^ do - begin - Addr := cardinal( Pixels ) + y * Pitch + x * format.BytesPerPixel; - SrcColor := PUInt32( Addr )^; - case format.BitsPerPixel of - 8 : - begin - R := SrcColor and $E0 + Color and $E0; - G := SrcColor and $1C + Color and $1C; - B := SrcColor and $03 + Color and $03; - if R > $E0 then - R := $E0; - if G > $1C then - G := $1C; - if B > $03 then - B := $03; - PUInt8( Addr )^ := R or G or B; - end; - 15 : - begin - R := SrcColor and $7C00 + Color and $7C00; - G := SrcColor and $03E0 + Color and $03E0; - B := SrcColor and $001F + Color and $001F; - if R > $7C00 then - R := $7C00; - if G > $03E0 then - G := $03E0; - if B > $001F then - B := $001F; - PUInt16( Addr )^ := R or G or B; - end; - 16 : - begin - R := SrcColor and $F800 + Color and $F800; - G := SrcColor and $07C0 + Color and $07C0; - B := SrcColor and $001F + Color and $001F; - if R > $F800 then - R := $F800; - if G > $07C0 then - G := $07C0; - if B > $001F then - B := $001F; - PUInt16( Addr )^ := R or G or B; - end; - 24 : - begin - R := SrcColor and $00FF0000 + Color and $00FF0000; - G := SrcColor and $0000FF00 + Color and $0000FF00; - B := SrcColor and $000000FF + Color and $000000FF; - if R > $FF0000 then - R := $FF0000; - if G > $00FF00 then - G := $00FF00; - if B > $0000FF then - B := $0000FF; - PUInt32( Addr )^ := SrcColor and $FF000000 or R or G or B; - end; - 32 : - begin - R := SrcColor and $00FF0000 + Color and $00FF0000; - G := SrcColor and $0000FF00 + Color and $0000FF00; - B := SrcColor and $000000FF + Color and $000000FF; - if R > $FF0000 then - R := $FF0000; - if G > $00FF00 then - G := $00FF00; - if B > $0000FF then - B := $0000FF; - PUInt32( Addr )^ := R or G or B; - end; - end; - end; -end; - -procedure SDL_SubPixel( DstSurface : PSDL_Surface; x : cardinal; y : cardinal; Color : - cardinal ); -var - SrcColor : cardinal; - Addr : cardinal; - R, G, B : cardinal; -begin - if Color = 0 then - exit; - with DstSurface^ do - begin - Addr := cardinal( Pixels ) + y * Pitch + x * format.BytesPerPixel; - SrcColor := PUInt32( Addr )^; - case format.BitsPerPixel of - 8 : - begin - R := SrcColor and $E0 - Color and $E0; - G := SrcColor and $1C - Color and $1C; - B := SrcColor and $03 - Color and $03; - if R > $E0 then - R := 0; - if G > $1C then - G := 0; - if B > $03 then - B := 0; - PUInt8( Addr )^ := R or G or B; - end; - 15 : - begin - R := SrcColor and $7C00 - Color and $7C00; - G := SrcColor and $03E0 - Color and $03E0; - B := SrcColor and $001F - Color and $001F; - if R > $7C00 then - R := 0; - if G > $03E0 then - G := 0; - if B > $001F then - B := 0; - PUInt16( Addr )^ := R or G or B; - end; - 16 : - begin - R := SrcColor and $F800 - Color and $F800; - G := SrcColor and $07C0 - Color and $07C0; - B := SrcColor and $001F - Color and $001F; - if R > $F800 then - R := 0; - if G > $07C0 then - G := 0; - if B > $001F then - B := 0; - PUInt16( Addr )^ := R or G or B; - end; - 24 : - begin - R := SrcColor and $00FF0000 - Color and $00FF0000; - G := SrcColor and $0000FF00 - Color and $0000FF00; - B := SrcColor and $000000FF - Color and $000000FF; - if R > $FF0000 then - R := 0; - if G > $00FF00 then - G := 0; - if B > $0000FF then - B := 0; - PUInt32( Addr )^ := SrcColor and $FF000000 or R or G or B; - end; - 32 : - begin - R := SrcColor and $00FF0000 - Color and $00FF0000; - G := SrcColor and $0000FF00 - Color and $0000FF00; - B := SrcColor and $000000FF - Color and $000000FF; - if R > $FF0000 then - R := 0; - if G > $00FF00 then - G := 0; - if B > $0000FF then - B := 0; - PUInt32( Addr )^ := R or G or B; - end; - end; - end; -end; -// This procedure works on 8, 15, 16, 24 and 32 bits color depth surfaces. -// In 8 bit color depth mode the procedure works with the default packed -// palette (RRRGGGBB). It handles all clipping. - -procedure SDL_AddSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); -var - R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; - Src, Dest : TSDL_Rect; - Diff : integer; - SrcAddr, DestAddr : cardinal; - WorkX, WorkY : word; - SrcMod, DestMod : cardinal; - Bits : cardinal; -begin - if ( SrcSurface = nil ) or ( DestSurface = nil ) then - exit; // Remove this to make it faster - if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then - exit; // Remove this to make it faster - if SrcRect = nil then - begin - with Src do - begin - x := 0; - y := 0; - w := SrcSurface.w; - h := SrcSurface.h; - end; - end - else - Src := SrcRect^; - if DestRect = nil then - begin - Dest.x := 0; - Dest.y := 0; - end - else - Dest := DestRect^; - Dest.w := Src.w; - Dest.h := Src.h; - with DestSurface.Clip_Rect do - begin - // Source's right side is greater than the dest.cliprect - if Dest.x + Src.w > x + w then - begin - smallint( Src.w ) := x + w - Dest.x; - smallint( Dest.w ) := x + w - Dest.x; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's bottom side is greater than the dest.clip - if Dest.y + Src.h > y + h then - begin - smallint( Src.h ) := y + h - Dest.y; - smallint( Dest.h ) := y + h - Dest.y; - if smallint( Dest.h ) < 1 then - exit; - end; - // Source's left side is less than the dest.clip - if Dest.x < x then - begin - Diff := x - Dest.x; - Src.x := Src.x + Diff; - smallint( Src.w ) := smallint( Src.w ) - Diff; - Dest.x := x; - smallint( Dest.w ) := smallint( Dest.w ) - Diff; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's Top side is less than the dest.clip - if Dest.y < y then - begin - Diff := y - Dest.y; - Src.y := Src.y + Diff; - smallint( Src.h ) := smallint( Src.h ) - Diff; - Dest.y := y; - smallint( Dest.h ) := smallint( Dest.h ) - Diff; - if smallint( Dest.h ) < 1 then - exit; - end; - end; - with SrcSurface^ do - begin - SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * - Format.BytesPerPixel; - SrcMod := Pitch - Src.w * Format.BytesPerPixel; - TransparentColor := Format.colorkey; - end; - with DestSurface^ do - begin - DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * - Format.BytesPerPixel; - DestMod := Pitch - Dest.w * Format.BytesPerPixel; - Bits := Format.BitsPerPixel; - end; - SDL_LockSurface( SrcSurface ); - SDL_LockSurface( DestSurface ); - WorkY := Src.h; - case bits of - 8 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt8( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt8( DestAddr )^; - if Pixel2 > 0 then - begin - R := Pixel1 and $E0 + Pixel2 and $E0; - G := Pixel1 and $1C + Pixel2 and $1C; - B := Pixel1 and $03 + Pixel2 and $03; - if R > $E0 then - R := $E0; - if G > $1C then - G := $1C; - if B > $03 then - B := $03; - PUInt8( DestAddr )^ := R or G or B; - end - else - PUInt8( DestAddr )^ := Pixel1; - end; - inc( SrcAddr ); - inc( DestAddr ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 15 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt16( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt16( DestAddr )^; - if Pixel2 > 0 then - begin - R := Pixel1 and $7C00 + Pixel2 and $7C00; - G := Pixel1 and $03E0 + Pixel2 and $03E0; - B := Pixel1 and $001F + Pixel2 and $001F; - if R > $7C00 then - R := $7C00; - if G > $03E0 then - G := $03E0; - if B > $001F then - B := $001F; - PUInt16( DestAddr )^ := R or G or B; - end - else - PUInt16( DestAddr )^ := Pixel1; - end; - inc( SrcAddr, 2 ); - inc( DestAddr, 2 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 16 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt16( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt16( DestAddr )^; - if Pixel2 > 0 then - begin - R := Pixel1 and $F800 + Pixel2 and $F800; - G := Pixel1 and $07E0 + Pixel2 and $07E0; - B := Pixel1 and $001F + Pixel2 and $001F; - if R > $F800 then - R := $F800; - if G > $07E0 then - G := $07E0; - if B > $001F then - B := $001F; - PUInt16( DestAddr )^ := R or G or B; - end - else - PUInt16( DestAddr )^ := Pixel1; - end; - inc( SrcAddr, 2 ); - inc( DestAddr, 2 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 24 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; - if Pixel2 > 0 then - begin - R := Pixel1 and $FF0000 + Pixel2 and $FF0000; - G := Pixel1 and $00FF00 + Pixel2 and $00FF00; - B := Pixel1 and $0000FF + Pixel2 and $0000FF; - if R > $FF0000 then - R := $FF0000; - if G > $00FF00 then - G := $00FF00; - if B > $0000FF then - B := $0000FF; - PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or ( R or G or B ); - end - else - PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or Pixel1; - end; - inc( SrcAddr, 3 ); - inc( DestAddr, 3 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 32 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt32( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt32( DestAddr )^; - if Pixel2 > 0 then - begin - R := Pixel1 and $FF0000 + Pixel2 and $FF0000; - G := Pixel1 and $00FF00 + Pixel2 and $00FF00; - B := Pixel1 and $0000FF + Pixel2 and $0000FF; - if R > $FF0000 then - R := $FF0000; - if G > $00FF00 then - G := $00FF00; - if B > $0000FF then - B := $0000FF; - PUInt32( DestAddr )^ := R or G or B; - end - else - PUInt32( DestAddr )^ := Pixel1; - end; - inc( SrcAddr, 4 ); - inc( DestAddr, 4 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - end; - SDL_UnlockSurface( SrcSurface ); - SDL_UnlockSurface( DestSurface ); -end; - -procedure SDL_SubSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); -var - R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; - Src, Dest : TSDL_Rect; - Diff : integer; - SrcAddr, DestAddr : cardinal; - _ebx, _esi, _edi, _esp : cardinal; - WorkX, WorkY : word; - SrcMod, DestMod : cardinal; - Bits : cardinal; -begin - if ( SrcSurface = nil ) or ( DestSurface = nil ) then - exit; // Remove this to make it faster - if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then - exit; // Remove this to make it faster - if SrcRect = nil then - begin - with Src do - begin - x := 0; - y := 0; - w := SrcSurface.w; - h := SrcSurface.h; - end; - end - else - Src := SrcRect^; - if DestRect = nil then - begin - Dest.x := 0; - Dest.y := 0; - end - else - Dest := DestRect^; - Dest.w := Src.w; - Dest.h := Src.h; - with DestSurface.Clip_Rect do - begin - // Source's right side is greater than the dest.cliprect - if Dest.x + Src.w > x + w then - begin - smallint( Src.w ) := x + w - Dest.x; - smallint( Dest.w ) := x + w - Dest.x; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's bottom side is greater than the dest.clip - if Dest.y + Src.h > y + h then - begin - smallint( Src.h ) := y + h - Dest.y; - smallint( Dest.h ) := y + h - Dest.y; - if smallint( Dest.h ) < 1 then - exit; - end; - // Source's left side is less than the dest.clip - if Dest.x < x then - begin - Diff := x - Dest.x; - Src.x := Src.x + Diff; - smallint( Src.w ) := smallint( Src.w ) - Diff; - Dest.x := x; - smallint( Dest.w ) := smallint( Dest.w ) - Diff; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's Top side is less than the dest.clip - if Dest.y < y then - begin - Diff := y - Dest.y; - Src.y := Src.y + Diff; - smallint( Src.h ) := smallint( Src.h ) - Diff; - Dest.y := y; - smallint( Dest.h ) := smallint( Dest.h ) - Diff; - if smallint( Dest.h ) < 1 then - exit; - end; - end; - with SrcSurface^ do - begin - SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * - Format.BytesPerPixel; - SrcMod := Pitch - Src.w * Format.BytesPerPixel; - TransparentColor := Format.colorkey; - end; - with DestSurface^ do - begin - DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * - Format.BytesPerPixel; - DestMod := Pitch - Dest.w * Format.BytesPerPixel; - Bits := DestSurface.Format.BitsPerPixel; - end; - SDL_LockSurface( SrcSurface ); - SDL_LockSurface( DestSurface ); - WorkY := Src.h; - case bits of - 8 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt8( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt8( DestAddr )^; - if Pixel2 > 0 then - begin - R := Pixel2 and $E0 - Pixel1 and $E0; - G := Pixel2 and $1C - Pixel1 and $1C; - B := Pixel2 and $03 - Pixel1 and $03; - if R > $E0 then - R := 0; - if G > $1C then - G := 0; - if B > $03 then - B := 0; - PUInt8( DestAddr )^ := R or G or B; - end; - end; - inc( SrcAddr ); - inc( DestAddr ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 15 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt16( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt16( DestAddr )^; - if Pixel2 > 0 then - begin - R := Pixel2 and $7C00 - Pixel1 and $7C00; - G := Pixel2 and $03E0 - Pixel1 and $03E0; - B := Pixel2 and $001F - Pixel1 and $001F; - if R > $7C00 then - R := 0; - if G > $03E0 then - G := 0; - if B > $001F then - B := 0; - PUInt16( DestAddr )^ := R or G or B; - end; - end; - inc( SrcAddr, 2 ); - inc( DestAddr, 2 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 16 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt16( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt16( DestAddr )^; - if Pixel2 > 0 then - begin - R := Pixel2 and $F800 - Pixel1 and $F800; - G := Pixel2 and $07E0 - Pixel1 and $07E0; - B := Pixel2 and $001F - Pixel1 and $001F; - if R > $F800 then - R := 0; - if G > $07E0 then - G := 0; - if B > $001F then - B := 0; - PUInt16( DestAddr )^ := R or G or B; - end; - end; - inc( SrcAddr, 2 ); - inc( DestAddr, 2 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 24 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; - if Pixel2 > 0 then - begin - R := Pixel2 and $FF0000 - Pixel1 and $FF0000; - G := Pixel2 and $00FF00 - Pixel1 and $00FF00; - B := Pixel2 and $0000FF - Pixel1 and $0000FF; - if R > $FF0000 then - R := 0; - if G > $00FF00 then - G := 0; - if B > $0000FF then - B := 0; - PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or ( R or G or B ); - end; - end; - inc( SrcAddr, 3 ); - inc( DestAddr, 3 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 32 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt32( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt32( DestAddr )^; - if Pixel2 > 0 then - begin - R := Pixel2 and $FF0000 - Pixel1 and $FF0000; - G := Pixel2 and $00FF00 - Pixel1 and $00FF00; - B := Pixel2 and $0000FF - Pixel1 and $0000FF; - if R > $FF0000 then - R := 0; - if G > $00FF00 then - G := 0; - if B > $0000FF then - B := 0; - PUInt32( DestAddr )^ := R or G or B; - end - else - PUInt32( DestAddr )^ := Pixel2; - end; - inc( SrcAddr, 4 ); - inc( DestAddr, 4 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - end; - SDL_UnlockSurface( SrcSurface ); - SDL_UnlockSurface( DestSurface ); -end; - -procedure SDL_MonoSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect; Color : cardinal ); -var - Src, Dest : TSDL_Rect; - Diff : integer; - SrcAddr, DestAddr : cardinal; - _ebx, _esi, _edi, _esp : cardinal; - WorkX, WorkY : word; - SrcMod, DestMod : cardinal; - TransparentColor, SrcColor : cardinal; - BPP : cardinal; -begin - if ( SrcSurface = nil ) or ( DestSurface = nil ) then - exit; // Remove this to make it faster - if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then - exit; // Remove this to make it faster - if SrcRect = nil then - begin - with Src do - begin - x := 0; - y := 0; - w := SrcSurface.w; - h := SrcSurface.h; - end; - end - else - Src := SrcRect^; - if DestRect = nil then - begin - Dest.x := 0; - Dest.y := 0; - end - else - Dest := DestRect^; - Dest.w := Src.w; - Dest.h := Src.h; - with DestSurface.Clip_Rect do - begin - // Source's right side is greater than the dest.cliprect - if Dest.x + Src.w > x + w then - begin - smallint( Src.w ) := x + w - Dest.x; - smallint( Dest.w ) := x + w - Dest.x; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's bottom side is greater than the dest.clip - if Dest.y + Src.h > y + h then - begin - smallint( Src.h ) := y + h - Dest.y; - smallint( Dest.h ) := y + h - Dest.y; - if smallint( Dest.h ) < 1 then - exit; - end; - // Source's left side is less than the dest.clip - if Dest.x < x then - begin - Diff := x - Dest.x; - Src.x := Src.x + Diff; - smallint( Src.w ) := smallint( Src.w ) - Diff; - Dest.x := x; - smallint( Dest.w ) := smallint( Dest.w ) - Diff; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's Top side is less than the dest.clip - if Dest.y < y then - begin - Diff := y - Dest.y; - Src.y := Src.y + Diff; - smallint( Src.h ) := smallint( Src.h ) - Diff; - Dest.y := y; - smallint( Dest.h ) := smallint( Dest.h ) - Diff; - if smallint( Dest.h ) < 1 then - exit; - end; - end; - with SrcSurface^ do - begin - SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * - Format.BytesPerPixel; - SrcMod := Pitch - Src.w * Format.BytesPerPixel; - TransparentColor := Format.colorkey; - end; - with DestSurface^ do - begin - DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * - Format.BytesPerPixel; - DestMod := Pitch - Dest.w * Format.BytesPerPixel; - BPP := DestSurface.Format.BytesPerPixel; - end; - SDL_LockSurface( SrcSurface ); - SDL_LockSurface( DestSurface ); - WorkY := Src.h; - case BPP of - 1 : - begin - repeat - WorkX := Src.w; - repeat - SrcColor := PUInt8( SrcAddr )^; - if SrcColor <> TransparentColor then - PUInt8( DestAddr )^ := SrcColor; - inc( SrcAddr ); - inc( DestAddr ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 2 : - begin - repeat - WorkX := Src.w; - repeat - SrcColor := PUInt16( SrcAddr )^; - if SrcColor <> TransparentColor then - PUInt16( DestAddr )^ := SrcColor; - inc( SrcAddr ); - inc( DestAddr ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 3 : - begin - repeat - WorkX := Src.w; - repeat - SrcColor := PUInt32( SrcAddr )^ and $FFFFFF; - if SrcColor <> TransparentColor then - PUInt32( DestAddr )^ := ( PUInt32( DestAddr )^ and $FFFFFF ) or SrcColor; - inc( SrcAddr ); - inc( DestAddr ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 4 : - begin - repeat - WorkX := Src.w; - repeat - SrcColor := PUInt32( SrcAddr )^; - if SrcColor <> TransparentColor then - PUInt32( DestAddr )^ := SrcColor; - inc( SrcAddr ); - inc( DestAddr ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - end; - SDL_UnlockSurface( SrcSurface ); - SDL_UnlockSurface( DestSurface ); -end; -// TextureRect.w and TextureRect.h are not used. -// The TextureSurface's size MUST larger than the drawing rectangle!!! - -procedure SDL_TexturedSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect; Texture : PSDL_Surface; - TextureRect : PSDL_Rect ); -var - Src, Dest : TSDL_Rect; - Diff : integer; - SrcAddr, DestAddr, TextAddr : cardinal; - _ebx, _esi, _edi, _esp : cardinal; - WorkX, WorkY : word; - SrcMod, DestMod, TextMod : cardinal; - SrcColor, TransparentColor, TextureColor : cardinal; - BPP : cardinal; -begin - if ( SrcSurface = nil ) or ( DestSurface = nil ) then - exit; // Remove this to make it faster - if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then - exit; // Remove this to make it faster - if SrcRect = nil then - begin - with Src do - begin - x := 0; - y := 0; - w := SrcSurface.w; - h := SrcSurface.h; - end; - end - else - Src := SrcRect^; - if DestRect = nil then - begin - Dest.x := 0; - Dest.y := 0; - end - else - Dest := DestRect^; - Dest.w := Src.w; - Dest.h := Src.h; - with DestSurface.Clip_Rect do - begin - // Source's right side is greater than the dest.cliprect - if Dest.x + Src.w > x + w then - begin - smallint( Src.w ) := x + w - Dest.x; - smallint( Dest.w ) := x + w - Dest.x; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's bottom side is greater than the dest.clip - if Dest.y + Src.h > y + h then - begin - smallint( Src.h ) := y + h - Dest.y; - smallint( Dest.h ) := y + h - Dest.y; - if smallint( Dest.h ) < 1 then - exit; - end; - // Source's left side is less than the dest.clip - if Dest.x < x then - begin - Diff := x - Dest.x; - Src.x := Src.x + Diff; - smallint( Src.w ) := smallint( Src.w ) - Diff; - Dest.x := x; - smallint( Dest.w ) := smallint( Dest.w ) - Diff; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's Top side is less than the dest.clip - if Dest.y < y then - begin - Diff := y - Dest.y; - Src.y := Src.y + Diff; - smallint( Src.h ) := smallint( Src.h ) - Diff; - Dest.y := y; - smallint( Dest.h ) := smallint( Dest.h ) - Diff; - if smallint( Dest.h ) < 1 then - exit; - end; - end; - with SrcSurface^ do - begin - SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * - Format.BytesPerPixel; - SrcMod := Pitch - Src.w * Format.BytesPerPixel; - TransparentColor := format.colorkey; - end; - with DestSurface^ do - begin - DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * - Format.BytesPerPixel; - DestMod := Pitch - Dest.w * Format.BytesPerPixel; - BPP := DestSurface.Format.BitsPerPixel; - end; - with Texture^ do - begin - TextAddr := cardinal( Pixels ) + UInt32( TextureRect.y ) * Pitch + - UInt32( TextureRect.x ) * Format.BytesPerPixel; - TextMod := Pitch - Src.w * Format.BytesPerPixel; - end; - SDL_LockSurface( SrcSurface ); - SDL_LockSurface( DestSurface ); - SDL_LockSurface( Texture ); - WorkY := Src.h; - case BPP of - 1 : - begin - repeat - WorkX := Src.w; - repeat - SrcColor := PUInt8( SrcAddr )^; - if SrcColor <> TransparentColor then - PUInt8( DestAddr )^ := PUint8( TextAddr )^; - inc( SrcAddr ); - inc( DestAddr ); - inc( TextAddr ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - inc( TextAddr, TextMod ); - dec( WorkY ); - until WorkY = 0; - end; - 2 : - begin - repeat - WorkX := Src.w; - repeat - SrcColor := PUInt16( SrcAddr )^; - if SrcColor <> TransparentColor then - PUInt16( DestAddr )^ := PUInt16( TextAddr )^; - inc( SrcAddr ); - inc( DestAddr ); - inc( TextAddr ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - inc( TextAddr, TextMod ); - dec( WorkY ); - until WorkY = 0; - end; - 3 : - begin - repeat - WorkX := Src.w; - repeat - SrcColor := PUInt32( SrcAddr )^ and $FFFFFF; - if SrcColor <> TransparentColor then - PUInt32( DestAddr )^ := ( PUInt32( DestAddr )^ and $FFFFFF ) or ( PUInt32( TextAddr )^ and $FFFFFF ); - inc( SrcAddr ); - inc( DestAddr ); - inc( TextAddr ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - inc( TextAddr, TextMod ); - dec( WorkY ); - until WorkY = 0; - end; - 4 : - begin - repeat - WorkX := Src.w; - repeat - SrcColor := PUInt32( SrcAddr )^; - if SrcColor <> TransparentColor then - PUInt32( DestAddr )^ := PUInt32( TextAddr )^; - inc( SrcAddr ); - inc( DestAddr ); - inc( TextAddr ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - inc( TextAddr, TextMod ); - dec( WorkY ); - until WorkY = 0; - end; - end; - SDL_UnlockSurface( SrcSurface ); - SDL_UnlockSurface( DestSurface ); - SDL_UnlockSurface( Texture ); -end; - -procedure SDL_ZoomSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; DstRect : PSDL_Rect ); -var - xc, yc : cardinal; - rx, wx, ry, wy, ry16 : cardinal; - color : cardinal; - modx, mody : cardinal; -begin - // Warning! No checks for surface pointers!!! - if srcrect = nil then - srcrect := @SrcSurface.clip_rect; - if dstrect = nil then - dstrect := @DstSurface.clip_rect; - if SDL_MustLock( SrcSurface ) then - SDL_LockSurface( SrcSurface ); - if SDL_MustLock( DstSurface ) then - SDL_LockSurface( DstSurface ); - modx := trunc( ( srcrect.w / dstrect.w ) * 65536 ); - mody := trunc( ( srcrect.h / dstrect.h ) * 65536 ); - //rx := srcrect.x * 65536; - ry := srcrect.y * 65536; - wy := dstrect.y; - for yc := 0 to dstrect.h - 1 do - begin - rx := srcrect.x * 65536; - wx := dstrect.x; - ry16 := ry shr 16; - for xc := 0 to dstrect.w - 1 do - begin - color := SDL_GetPixel( SrcSurface, rx shr 16, ry16 ); - SDL_PutPixel( DstSurface, wx, wy, color ); - rx := rx + modx; - inc( wx ); - end; - ry := ry + mody; - inc( wy ); - end; - if SDL_MustLock( SrcSurface ) then - SDL_UnlockSurface( SrcSurface ); - if SDL_MustLock( DstSurface ) then - SDL_UnlockSurface( DstSurface ); -end; -// Re-map a rectangular area into an area defined by four vertices -// Converted from C to Pascal by KiCHY - -procedure SDL_WarpSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; UL, UR, LR, LL : PPoint ); -const - SHIFTS = 15; // Extend ints to limit round-off error (try 2 - 20) - THRESH = 1 shl SHIFTS; // Threshold for pixel size value - procedure CopySourceToDest( UL, UR, LR, LL : TPoint; x1, y1, x2, y2 : cardinal ); - var - tm, lm, rm, bm, m : TPoint; - mx, my : cardinal; - cr : cardinal; - begin - // Does the destination area specify a single pixel? - if ( ( abs( ul.x - ur.x ) < THRESH ) and - ( abs( ul.x - lr.x ) < THRESH ) and - ( abs( ul.x - ll.x ) < THRESH ) and - ( abs( ul.y - ur.y ) < THRESH ) and - ( abs( ul.y - lr.y ) < THRESH ) and - ( abs( ul.y - ll.y ) < THRESH ) ) then - begin // Yes - cr := SDL_GetPixel( SrcSurface, ( x1 shr SHIFTS ), ( y1 shr SHIFTS ) ); - SDL_PutPixel( DstSurface, ( ul.x shr SHIFTS ), ( ul.y shr SHIFTS ), cr ); - end - else - begin // No - // Quarter the source and the destination, and then recurse - tm.x := ( ul.x + ur.x ) shr 1; - tm.y := ( ul.y + ur.y ) shr 1; - bm.x := ( ll.x + lr.x ) shr 1; - bm.y := ( ll.y + lr.y ) shr 1; - lm.x := ( ul.x + ll.x ) shr 1; - lm.y := ( ul.y + ll.y ) shr 1; - rm.x := ( ur.x + lr.x ) shr 1; - rm.y := ( ur.y + lr.y ) shr 1; - m.x := ( tm.x + bm.x ) shr 1; - m.y := ( tm.y + bm.y ) shr 1; - mx := ( x1 + x2 ) shr 1; - my := ( y1 + y2 ) shr 1; - CopySourceToDest( ul, tm, m, lm, x1, y1, mx, my ); - CopySourceToDest( tm, ur, rm, m, mx, y1, x2, my ); - CopySourceToDest( m, rm, lr, bm, mx, my, x2, y2 ); - CopySourceToDest( lm, m, bm, ll, x1, my, mx, y2 ); - end; - end; -var - _UL, _UR, _LR, _LL : TPoint; - Rect_x, Rect_y, Rect_w, Rect_h : integer; -begin - if SDL_MustLock( SrcSurface ) then - SDL_LockSurface( SrcSurface ); - if SDL_MustLock( DstSurface ) then - SDL_LockSurface( DstSurface ); - if SrcRect = nil then - begin - Rect_x := 0; - Rect_y := 0; - Rect_w := ( SrcSurface.w - 1 ) shl SHIFTS; - Rect_h := ( SrcSurface.h - 1 ) shl SHIFTS; - end - else - begin - Rect_x := SrcRect.x; - Rect_y := SrcRect.y; - Rect_w := ( SrcRect.w - 1 ) shl SHIFTS; - Rect_h := ( SrcRect.h - 1 ) shl SHIFTS; - end; - // Shift all values to help reduce round-off error. - _ul.x := ul.x shl SHIFTS; - _ul.y := ul.y shl SHIFTS; - _ur.x := ur.x shl SHIFTS; - _ur.y := ur.y shl SHIFTS; - _lr.x := lr.x shl SHIFTS; - _lr.y := lr.y shl SHIFTS; - _ll.x := ll.x shl SHIFTS; - _ll.y := ll.y shl SHIFTS; - CopySourceToDest( _ul, _ur, _lr, _ll, Rect_x, Rect_y, Rect_w, Rect_h ); - if SDL_MustLock( SrcSurface ) then - SDL_UnlockSurface( SrcSurface ); - if SDL_MustLock( DstSurface ) then - SDL_UnlockSurface( DstSurface ); -end; - -// Draw a line between x1,y1 and x2,y2 to the given surface -// NOTE: The surface must be locked before calling this! -procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : - cardinal ); -var - dx, dy, sdx, sdy, x, y, px, py : integer; -begin - dx := x2 - x1; - dy := y2 - y1; - if dx < 0 then - sdx := -1 - else - sdx := 1; - if dy < 0 then - sdy := -1 - else - sdy := 1; - dx := sdx * dx + 1; - dy := sdy * dy + 1; - x := 0; - y := 0; - px := x1; - py := y1; - if dx >= dy then - begin - for x := 0 to dx - 1 do - begin - SDL_PutPixel( DstSurface, px, py, Color ); - y := y + dy; - if y >= dx then - begin - y := y - dx; - py := py + sdy; - end; - px := px + sdx; - end; - end - else - begin - for y := 0 to dy - 1 do - begin - SDL_PutPixel( DstSurface, px, py, Color ); - x := x + dx; - if x >= dy then - begin - x := x - dy; - px := px + sdx; - end; - py := py + sdy; - end; - end; -end; - -// Draw a dashed line between x1,y1 and x2,y2 to the given surface -// NOTE: The surface must be locked before calling this! -procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : - cardinal ; DashLength, DashSpace : byte ); overload; -var - dx, dy, sdx, sdy, x, y, px, py, counter : integer; drawdash : boolean; -begin - counter := 0; - drawdash := true; //begin line drawing with dash - - //Avoid invalid user-passed dash parameters - if (DashLength < 1) - then DashLength := 1; - if (DashSpace < 1) - then DashSpace := 0; - - dx := x2 - x1; - dy := y2 - y1; - if dx < 0 then - sdx := -1 - else - sdx := 1; - if dy < 0 then - sdy := -1 - else - sdy := 1; - dx := sdx * dx + 1; - dy := sdy * dy + 1; - x := 0; - y := 0; - px := x1; - py := y1; - if dx >= dy then - begin - for x := 0 to dx - 1 do - begin - - //Alternate drawing dashes, or leaving spaces - if drawdash then - begin - SDL_PutPixel( DstSurface, px, py, Color ); - inc(counter); - if (counter > DashLength-1) and (DashSpace > 0) then - begin - drawdash := false; - counter := 0; - end; - end - else //space - begin - inc(counter); - if counter > DashSpace-1 then - begin - drawdash := true; - counter := 0; - end; - end; - - y := y + dy; - if y >= dx then - begin - y := y - dx; - py := py + sdy; - end; - px := px + sdx; - end; - end - else - begin - for y := 0 to dy - 1 do - begin - - //Alternate drawing dashes, or leaving spaces - if drawdash then - begin - SDL_PutPixel( DstSurface, px, py, Color ); - inc(counter); - if (counter > DashLength-1) and (DashSpace > 0) then - begin - drawdash := false; - counter := 0; - end; - end - else //space - begin - inc(counter); - if counter > DashSpace-1 then - begin - drawdash := true; - counter := 0; - end; - end; - - x := x + dx; - if x >= dy then - begin - x := x - dy; - px := px + sdx; - end; - py := py + sdy; - end; - end; -end; - -procedure SDL_AddLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : - cardinal ); -var - dx, dy, sdx, sdy, x, y, px, py : integer; -begin - dx := x2 - x1; - dy := y2 - y1; - if dx < 0 then - sdx := -1 - else - sdx := 1; - if dy < 0 then - sdy := -1 - else - sdy := 1; - dx := sdx * dx + 1; - dy := sdy * dy + 1; - x := 0; - y := 0; - px := x1; - py := y1; - if dx >= dy then - begin - for x := 0 to dx - 1 do - begin - SDL_AddPixel( DstSurface, px, py, Color ); - y := y + dy; - if y >= dx then - begin - y := y - dx; - py := py + sdy; - end; - px := px + sdx; - end; - end - else - begin - for y := 0 to dy - 1 do - begin - SDL_AddPixel( DstSurface, px, py, Color ); - x := x + dx; - if x >= dy then - begin - x := x - dy; - px := px + sdx; - end; - py := py + sdy; - end; - end; -end; - -procedure SDL_SubLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : - cardinal ); -var - dx, dy, sdx, sdy, x, y, px, py : integer; -begin - dx := x2 - x1; - dy := y2 - y1; - if dx < 0 then - sdx := -1 - else - sdx := 1; - if dy < 0 then - sdy := -1 - else - sdy := 1; - dx := sdx * dx + 1; - dy := sdy * dy + 1; - x := 0; - y := 0; - px := x1; - py := y1; - if dx >= dy then - begin - for x := 0 to dx - 1 do - begin - SDL_SubPixel( DstSurface, px, py, Color ); - y := y + dy; - if y >= dx then - begin - y := y - dx; - py := py + sdy; - end; - px := px + sdx; - end; - end - else - begin - for y := 0 to dy - 1 do - begin - SDL_SubPixel( DstSurface, px, py, Color ); - x := x + dx; - if x >= dy then - begin - x := x - dy; - px := px + sdx; - end; - py := py + sdy; - end; - end; -end; - -// flips a rectangle vertically on given surface -procedure SDL_FlipRectV( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); -var - TmpRect : TSDL_Rect; - Locked : boolean; - y, FlipLength, RowLength : integer; - Row1, Row2 : Pointer; - OneRow : TByteArray; // Optimize it if you wish -begin - if DstSurface <> nil then - begin - if Rect = nil then - begin // if Rect=nil then we flip the whole surface - TmpRect := SDLRect( 0, 0, DstSurface.w, DstSurface.h ); - Rect := @TmpRect; - end; - FlipLength := Rect^.h shr 1 - 1; - RowLength := Rect^.w * DstSurface^.format.BytesPerPixel; - if SDL_MustLock( DstSurface ) then - begin - Locked := true; - SDL_LockSurface( DstSurface ); - end - else - Locked := false; - Row1 := pointer( cardinal( DstSurface^.Pixels ) + UInt32( Rect^.y ) * - DstSurface^.Pitch ); - Row2 := pointer( cardinal( DstSurface^.Pixels ) + ( UInt32( Rect^.y ) + Rect^.h - 1 ) - * DstSurface^.Pitch ); - for y := 0 to FlipLength do - begin - Move( Row1^, OneRow, RowLength ); - Move( Row2^, Row1^, RowLength ); - Move( OneRow, Row2^, RowLength ); - inc( cardinal( Row1 ), DstSurface^.Pitch ); - dec( cardinal( Row2 ), DstSurface^.Pitch ); - end; - if Locked then - SDL_UnlockSurface( DstSurface ); - end; -end; - -// flips a rectangle horizontally on given surface -procedure SDL_FlipRectH( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); -type - T24bit = packed array[ 0..2 ] of byte; - T24bitArray = packed array[ 0..8191 ] of T24bit; - P24bitArray = ^T24bitArray; - TLongWordArray = array[ 0..8191 ] of LongWord; - PLongWordArray = ^TLongWordArray; -var - TmpRect : TSDL_Rect; - Row8bit : PByteArray; - Row16bit : PWordArray; - Row24bit : P24bitArray; - Row32bit : PLongWordArray; - y, x, RightSide, FlipLength : integer; - Pixel : cardinal; - Pixel24 : T24bit; - Locked : boolean; -begin - if DstSurface <> nil then - begin - if Rect = nil then - begin - TmpRect := SDLRect( 0, 0, DstSurface.w, DstSurface.h ); - Rect := @TmpRect; - end; - FlipLength := Rect^.w shr 1 - 1; - if SDL_MustLock( DstSurface ) then - begin - Locked := true; - SDL_LockSurface( DstSurface ); - end - else - Locked := false; - case DstSurface^.format.BytesPerPixel of - 1 : - begin - Row8Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * - DstSurface^.pitch ); - for y := 1 to Rect^.h do - begin - RightSide := Rect^.w - 1; - for x := 0 to FlipLength do - begin - Pixel := Row8Bit^[ x ]; - Row8Bit^[ x ] := Row8Bit^[ RightSide ]; - Row8Bit^[ RightSide ] := Pixel; - dec( RightSide ); - end; - inc( cardinal( Row8Bit ), DstSurface^.pitch ); - end; - end; - 2 : - begin - Row16Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * - DstSurface^.pitch ); - for y := 1 to Rect^.h do - begin - RightSide := Rect^.w - 1; - for x := 0 to FlipLength do - begin - Pixel := Row16Bit^[ x ]; - Row16Bit^[ x ] := Row16Bit^[ RightSide ]; - Row16Bit^[ RightSide ] := Pixel; - dec( RightSide ); - end; - inc( cardinal( Row16Bit ), DstSurface^.pitch ); - end; - end; - 3 : - begin - Row24Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * - DstSurface^.pitch ); - for y := 1 to Rect^.h do - begin - RightSide := Rect^.w - 1; - for x := 0 to FlipLength do - begin - Pixel24 := Row24Bit^[ x ]; - Row24Bit^[ x ] := Row24Bit^[ RightSide ]; - Row24Bit^[ RightSide ] := Pixel24; - dec( RightSide ); - end; - inc( cardinal( Row24Bit ), DstSurface^.pitch ); - end; - end; - 4 : - begin - Row32Bit := pointer( cardinal( DstSurface^.pixels ) + UInt32( Rect^.y ) * - DstSurface^.pitch ); - for y := 1 to Rect^.h do - begin - RightSide := Rect^.w - 1; - for x := 0 to FlipLength do - begin - Pixel := Row32Bit^[ x ]; - Row32Bit^[ x ] := Row32Bit^[ RightSide ]; - Row32Bit^[ RightSide ] := Pixel; - dec( RightSide ); - end; - inc( cardinal( Row32Bit ), DstSurface^.pitch ); - end; - end; - end; - if Locked then - SDL_UnlockSurface( DstSurface ); - end; -end; - -// Use with caution! The procedure allocates memory for TSDL_Rect and return with its pointer. -// But you MUST free it after you don't need it anymore!!! -function PSDLRect( aLeft, aTop, aWidth, aHeight : integer ) : PSDL_Rect; -var - Rect : PSDL_Rect; -begin - New( Rect ); - with Rect^ do - begin - x := aLeft; - y := aTop; - w := aWidth; - h := aHeight; - end; - Result := Rect; -end; - -function SDLRect( aLeft, aTop, aWidth, aHeight : integer ) : TSDL_Rect; -begin - with result do - begin - x := aLeft; - y := aTop; - w := aWidth; - h := aHeight; - end; -end; - -function SDLRect( aRect : TRect ) : TSDL_Rect; -begin - with aRect do - result := SDLRect( Left, Top, Right - Left, Bottom - Top ); -end; - -procedure SDL_Stretch8( Surface, Dst_Surface : PSDL_Surface; x1, x2, y1, y2, yr, yw, - depth : integer ); -var - dx, dy, e, d, dx2 : integer; - src_pitch, dst_pitch : uint16; - src_pixels, dst_pixels : PUint8; -begin - if ( yw >= dst_surface^.h ) then - exit; - dx := ( x2 - x1 ); - dy := ( y2 - y1 ); - dy := dy shl 1; - e := dy - dx; - dx2 := dx shl 1; - src_pitch := Surface^.pitch; - dst_pitch := dst_surface^.pitch; - src_pixels := PUint8( integer( Surface^.pixels ) + yr * src_pitch + y1 * depth ); - dst_pixels := PUint8( integer( dst_surface^.pixels ) + yw * dst_pitch + x1 * - depth ); - for d := 0 to dx - 1 do - begin - move( src_pixels^, dst_pixels^, depth ); - while ( e >= 0 ) do - begin - inc( src_pixels, depth ); - e := e - dx2; - end; - inc( dst_pixels, depth ); - e := e + dy; - end; -end; - -function sign( x : integer ) : integer; -begin - if x > 0 then - result := 1 - else - result := -1; -end; - -// Stretches a part of a surface -function SDL_ScaleSurfaceRect( SrcSurface : PSDL_Surface; SrcX1, SrcY1, SrcW, SrcH, - Width, Height : integer ) : PSDL_Surface; -var - dst_surface : PSDL_Surface; - dx, dy, e, d, dx2, srcx2, srcy2 : integer; - destx1, desty1 : integer; -begin - srcx2 := srcx1 + SrcW; - srcy2 := srcy1 + SrcH; - result := nil; - destx1 := 0; - desty1 := 0; - dx := abs( integer( Height - desty1 ) ); - dy := abs( integer( SrcY2 - SrcY1 ) ); - e := ( dy shl 1 ) - dx; - dx2 := dx shl 1; - dy := dy shl 1; - dst_surface := SDL_CreateRGBSurface( SDL_HWPALETTE, width - destx1, Height - - desty1, - SrcSurface^.Format^.BitsPerPixel, - SrcSurface^.Format^.RMask, - SrcSurface^.Format^.GMask, - SrcSurface^.Format^.BMask, - SrcSurface^.Format^.AMask ); - if ( dst_surface^.format^.BytesPerPixel = 1 ) then - SDL_SetColors( dst_surface, @SrcSurface^.format^.palette^.colors^[ 0 ], 0, 256 ); - SDL_SetColorKey( dst_surface, sdl_srccolorkey, SrcSurface^.format^.colorkey ); - if ( SDL_MustLock( dst_surface ) ) then - if ( SDL_LockSurface( dst_surface ) < 0 ) then - exit; - for d := 0 to dx - 1 do - begin - SDL_Stretch8( SrcSurface, dst_surface, destx1, Width, SrcX1, SrcX2, SrcY1, desty1, - SrcSurface^.format^.BytesPerPixel ); - while e >= 0 do - begin - inc( SrcY1 ); - e := e - dx2; - end; - inc( desty1 ); - e := e + dy; - end; - if SDL_MUSTLOCK( dst_surface ) then - SDL_UnlockSurface( dst_surface ); - result := dst_surface; -end; - -procedure SDL_MoveLine( Surface : PSDL_Surface; x1, x2, y1, xofs, depth : integer ); -var - src_pixels, dst_pixels : PUint8; - i : integer; -begin - src_pixels := PUint8( integer( Surface^.pixels ) + Surface^.w * y1 * depth + x2 * - depth ); - dst_pixels := PUint8( integer( Surface^.pixels ) + Surface^.w * y1 * depth + ( x2 - + xofs ) * depth ); - for i := x2 downto x1 do - begin - move( src_pixels^, dst_pixels^, depth ); - dec( src_pixels ); - dec( dst_pixels ); - end; -end; -{ Return the pixel value at (x, y) -NOTE: The surface must be locked before calling this! } - -function SDL_GetPixel( SrcSurface : PSDL_Surface; x : integer; y : integer ) : Uint32; -var - bpp : UInt32; - p : PInteger; -begin - bpp := SrcSurface.format.BytesPerPixel; - // Here p is the address to the pixel we want to retrieve - p := Pointer( Uint32( SrcSurface.pixels ) + UInt32( y ) * SrcSurface.pitch + UInt32( x ) * - bpp ); - case bpp of - 1 : result := PUint8( p )^; - 2 : result := PUint16( p )^; - 3 : - if ( SDL_BYTEORDER = SDL_BIG_ENDIAN ) then - result := PUInt8Array( p )[ 0 ] shl 16 or PUInt8Array( p )[ 1 ] shl 8 or - PUInt8Array( p )[ 2 ] - else - result := PUInt8Array( p )[ 0 ] or PUInt8Array( p )[ 1 ] shl 8 or - PUInt8Array( p )[ 2 ] shl 16; - 4 : result := PUint32( p )^; - else - result := 0; // shouldn't happen, but avoids warnings - end; -end; -{ Set the pixel at (x, y) to the given value - NOTE: The surface must be locked before calling this! } - -procedure SDL_PutPixel( DstSurface : PSDL_Surface; x : integer; y : integer; pixel : - Uint32 ); -var - bpp : UInt32; - p : PInteger; -begin - bpp := DstSurface.format.BytesPerPixel; - p := Pointer( Uint32( DstSurface.pixels ) + UInt32( y ) * DstSurface.pitch + UInt32( x ) - * bpp ); - case bpp of - 1 : PUint8( p )^ := pixel; - 2 : PUint16( p )^ := pixel; - 3 : - if ( SDL_BYTEORDER = SDL_BIG_ENDIAN ) then - begin - PUInt8Array( p )[ 0 ] := ( pixel shr 16 ) and $FF; - PUInt8Array( p )[ 1 ] := ( pixel shr 8 ) and $FF; - PUInt8Array( p )[ 2 ] := pixel and $FF; - end - else - begin - PUInt8Array( p )[ 0 ] := pixel and $FF; - PUInt8Array( p )[ 1 ] := ( pixel shr 8 ) and $FF; - PUInt8Array( p )[ 2 ] := ( pixel shr 16 ) and $FF; - end; - 4 : - PUint32( p )^ := pixel; - end; -end; - -procedure SDL_ScrollY( DstSurface : PSDL_Surface; DifY : integer ); -var - r1, r2 : TSDL_Rect; - //buffer: PSDL_Surface; - YPos : Integer; -begin - if ( DstSurface <> nil ) and ( DifY <> 0 ) then - begin - //if DifY > 0 then // going up - //begin - ypos := 0; - r1.x := 0; - r2.x := 0; - r1.w := DstSurface.w; - r2.w := DstSurface.w; - r1.h := DifY; - r2.h := DifY; - while ypos < DstSurface.h do - begin - r1.y := ypos; - r2.y := ypos + DifY; - SDL_BlitSurface( DstSurface, @r2, DstSurface, @r1 ); - ypos := ypos + DifY; - end; - //end - //else - //begin // Going Down - //end; - end; -end; - -{procedure SDL_ScrollY(Surface: PSDL_Surface; DifY: integer); -var - r1, r2: TSDL_Rect; - buffer: PSDL_Surface; -begin - if (Surface <> nil) and (Dify <> 0) then - begin - buffer := SDL_CreateRGBSurface(SDL_HWSURFACE, (Surface^.w - DifY) * 2, - Surface^.h * 2, - Surface^.Format^.BitsPerPixel, 0, 0, 0, 0); - if buffer <> nil then - begin - if (buffer^.format^.BytesPerPixel = 1) then - SDL_SetColors(buffer, @Surface^.format^.palette^.colors^[0], 0, 256); - r1 := SDLRect(0, DifY, buffer^.w, buffer^.h); - r2 := SDLRect(0, 0, buffer^.w, buffer^.h); - SDL_BlitSurface(Surface, @r1, buffer, @r2); - SDL_BlitSurface(buffer, @r2, Surface, @r2); - SDL_FreeSurface(buffer); - end; - end; -end;} - -procedure SDL_ScrollX( DstSurface : PSDL_Surface; DifX : integer ); -var - r1, r2 : TSDL_Rect; - buffer : PSDL_Surface; -begin - if ( DstSurface <> nil ) and ( DifX <> 0 ) then - begin - buffer := SDL_CreateRGBSurface( SDL_HWSURFACE, ( DstSurface^.w - DifX ) * 2, - DstSurface^.h * 2, - DstSurface^.Format^.BitsPerPixel, - DstSurface^.Format^.RMask, - DstSurface^.Format^.GMask, - DstSurface^.Format^.BMask, - DstSurface^.Format^.AMask ); - if buffer <> nil then - begin - if ( buffer^.format^.BytesPerPixel = 1 ) then - SDL_SetColors( buffer, @DstSurface^.format^.palette^.colors^[ 0 ], 0, 256 ); - r1 := SDLRect( DifX, 0, buffer^.w, buffer^.h ); - r2 := SDLRect( 0, 0, buffer^.w, buffer^.h ); - SDL_BlitSurface( DstSurface, @r1, buffer, @r2 ); - SDL_BlitSurface( buffer, @r2, DstSurface, @r2 ); - SDL_FreeSurface( buffer ); - end; - end; -end; - -procedure SDL_RotateRad( DstSurface, SrcSurface : PSDL_Surface; SrcRect : - PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Single ); -var - aSin, aCos : Single; - MX, MY, DX, DY, NX, NY, SX, SY, OX, OY, Width, Height, TX, TY, RX, RY, ROX, ROY : Integer; - Colour, TempTransparentColour : UInt32; - MAXX, MAXY : Integer; -begin - // Rotate the surface to the target surface. - TempTransparentColour := SrcSurface.format.colorkey; - if srcRect.w > srcRect.h then - begin - Width := srcRect.w; - Height := srcRect.w; - end - else - begin - Width := srcRect.h; - Height := srcRect.h; - end; - - maxx := DstSurface.w; - maxy := DstSurface.h; - aCos := cos( Angle ); - aSin := sin( Angle ); - - Width := round( abs( srcrect.h * acos ) + abs( srcrect.w * asin ) ); - Height := round( abs( srcrect.h * asin ) + abs( srcrect.w * acos ) ); - - OX := Width div 2; - OY := Height div 2; ; - MX := ( srcRect.x + ( srcRect.x + srcRect.w ) ) div 2; - MY := ( srcRect.y + ( srcRect.y + srcRect.h ) ) div 2; - ROX := ( -( srcRect.w div 2 ) ) + Offsetx; - ROY := ( -( srcRect.h div 2 ) ) + OffsetY; - Tx := ox + round( ROX * aSin - ROY * aCos ); - Ty := oy + round( ROY * aSin + ROX * aCos ); - SX := 0; - for DX := DestX - TX to DestX - TX + ( width ) do - begin - Inc( SX ); - SY := 0; - for DY := DestY - TY to DestY - TY + ( Height ) do - begin - RX := SX - OX; - RY := SY - OY; - NX := round( mx + RX * aSin + RY * aCos ); // - NY := round( my + RY * aSin - RX * aCos ); // - // Used for testing only - //SDL_PutPixel(DestSurface.SDLSurfacePointer,DX,DY,0); - if ( ( DX > 0 ) and ( DX < MAXX ) ) and ( ( DY > 0 ) and ( DY < MAXY ) ) then - begin - if ( NX >= srcRect.x ) and ( NX <= srcRect.x + srcRect.w ) then - begin - if ( NY >= srcRect.y ) and ( NY <= srcRect.y + srcRect.h ) then - begin - Colour := SDL_GetPixel( SrcSurface, NX, NY ); - if Colour <> TempTransparentColour then - begin - SDL_PutPixel( DstSurface, DX, DY, Colour ); - end; - end; - end; - end; - inc( SY ); - end; - end; -end; - -procedure SDL_RotateDeg( DstSurface, SrcSurface : PSDL_Surface; SrcRect : - PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Integer ); -begin - SDL_RotateRad( DstSurface, SrcSurface, SrcRect, DestX, DestY, OffsetX, OffsetY, DegToRad( Angle ) ); -end; - -function ValidateSurfaceRect( DstSurface : PSDL_Surface; dstrect : PSDL_Rect ) : TSDL_Rect; -var - RealRect : TSDL_Rect; - OutOfRange : Boolean; -begin - OutOfRange := false; - if dstrect = nil then - begin - RealRect.x := 0; - RealRect.y := 0; - RealRect.w := DstSurface.w; - RealRect.h := DstSurface.h; - end - else - begin - if dstrect.x < DstSurface.w then - begin - RealRect.x := dstrect.x; - end - else if dstrect.x < 0 then - begin - realrect.x := 0; - end - else - begin - OutOfRange := True; - end; - if dstrect.y < DstSurface.h then - begin - RealRect.y := dstrect.y; - end - else if dstrect.y < 0 then - begin - realrect.y := 0; - end - else - begin - OutOfRange := True; - end; - if OutOfRange = False then - begin - if realrect.x + dstrect.w <= DstSurface.w then - begin - RealRect.w := dstrect.w; - end - else - begin - RealRect.w := dstrect.w - realrect.x; - end; - if realrect.y + dstrect.h <= DstSurface.h then - begin - RealRect.h := dstrect.h; - end - else - begin - RealRect.h := dstrect.h - realrect.y; - end; - end; - end; - if OutOfRange = False then - begin - result := realrect; - end - else - begin - realrect.w := 0; - realrect.h := 0; - realrect.x := 0; - realrect.y := 0; - result := realrect; - end; -end; - -procedure SDL_FillRectAdd( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); -var - RealRect : TSDL_Rect; - Addr : pointer; - ModX, BPP : cardinal; - x, y, R, G, B, SrcColor : cardinal; -begin - RealRect := ValidateSurfaceRect( DstSurface, DstRect ); - if ( RealRect.w > 0 ) and ( RealRect.h > 0 ) then - begin - SDL_LockSurface( DstSurface ); - BPP := DstSurface.format.BytesPerPixel; - with DstSurface^ do - begin - Addr := pointer( UInt32( pixels ) + UInt32( RealRect.y ) * pitch + UInt32( RealRect.x ) * BPP ); - ModX := Pitch - UInt32( RealRect.w ) * BPP; - end; - case DstSurface.format.BitsPerPixel of - 8 : - begin - for y := 0 to RealRect.h - 1 do - begin - for x := 0 to RealRect.w - 1 do - begin - SrcColor := PUInt32( Addr )^; - R := SrcColor and $E0 + Color and $E0; - G := SrcColor and $1C + Color and $1C; - B := SrcColor and $03 + Color and $03; - if R > $E0 then - R := $E0; - if G > $1C then - G := $1C; - if B > $03 then - B := $03; - PUInt8( Addr )^ := R or G or B; - inc( UInt32( Addr ), BPP ); - end; - inc( UInt32( Addr ), ModX ); - end; - end; - 15 : - begin - for y := 0 to RealRect.h - 1 do - begin - for x := 0 to RealRect.w - 1 do - begin - SrcColor := PUInt32( Addr )^; - R := SrcColor and $7C00 + Color and $7C00; - G := SrcColor and $03E0 + Color and $03E0; - B := SrcColor and $001F + Color and $001F; - if R > $7C00 then - R := $7C00; - if G > $03E0 then - G := $03E0; - if B > $001F then - B := $001F; - PUInt16( Addr )^ := R or G or B; - inc( UInt32( Addr ), BPP ); - end; - inc( UInt32( Addr ), ModX ); - end; - end; - 16 : - begin - for y := 0 to RealRect.h - 1 do - begin - for x := 0 to RealRect.w - 1 do - begin - SrcColor := PUInt32( Addr )^; - R := SrcColor and $F800 + Color and $F800; - G := SrcColor and $07C0 + Color and $07C0; - B := SrcColor and $001F + Color and $001F; - if R > $F800 then - R := $F800; - if G > $07C0 then - G := $07C0; - if B > $001F then - B := $001F; - PUInt16( Addr )^ := R or G or B; - inc( UInt32( Addr ), BPP ); - end; - inc( UInt32( Addr ), ModX ); - end; - end; - 24 : - begin - for y := 0 to RealRect.h - 1 do - begin - for x := 0 to RealRect.w - 1 do - begin - SrcColor := PUInt32( Addr )^; - R := SrcColor and $00FF0000 + Color and $00FF0000; - G := SrcColor and $0000FF00 + Color and $0000FF00; - B := SrcColor and $000000FF + Color and $000000FF; - if R > $FF0000 then - R := $FF0000; - if G > $00FF00 then - G := $00FF00; - if B > $0000FF then - B := $0000FF; - PUInt32( Addr )^ := SrcColor and $FF000000 or R or G or B; - inc( UInt32( Addr ), BPP ); - end; - inc( UInt32( Addr ), ModX ); - end; - end; - 32 : - begin - for y := 0 to RealRect.h - 1 do - begin - for x := 0 to RealRect.w - 1 do - begin - SrcColor := PUInt32( Addr )^; - R := SrcColor and $00FF0000 + Color and $00FF0000; - G := SrcColor and $0000FF00 + Color and $0000FF00; - B := SrcColor and $000000FF + Color and $000000FF; - if R > $FF0000 then - R := $FF0000; - if G > $00FF00 then - G := $00FF00; - if B > $0000FF then - B := $0000FF; - PUInt32( Addr )^ := R or G or B; - inc( UInt32( Addr ), BPP ); - end; - inc( UInt32( Addr ), ModX ); - end; - end; - end; - SDL_UnlockSurface( DstSurface ); - end; -end; - -procedure SDL_FillRectSub( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); -var - RealRect : TSDL_Rect; - Addr : pointer; - ModX, BPP : cardinal; - x, y, R, G, B, SrcColor : cardinal; -begin - RealRect := ValidateSurfaceRect( DstSurface, DstRect ); - if ( RealRect.w > 0 ) and ( RealRect.h > 0 ) then - begin - SDL_LockSurface( DstSurface ); - BPP := DstSurface.format.BytesPerPixel; - with DstSurface^ do - begin - Addr := pointer( UInt32( pixels ) + UInt32( RealRect.y ) * pitch + UInt32( RealRect.x ) * BPP ); - ModX := Pitch - UInt32( RealRect.w ) * BPP; - end; - case DstSurface.format.BitsPerPixel of - 8 : - begin - for y := 0 to RealRect.h - 1 do - begin - for x := 0 to RealRect.w - 1 do - begin - SrcColor := PUInt32( Addr )^; - R := SrcColor and $E0 - Color and $E0; - G := SrcColor and $1C - Color and $1C; - B := SrcColor and $03 - Color and $03; - if R > $E0 then - R := 0; - if G > $1C then - G := 0; - if B > $03 then - B := 0; - PUInt8( Addr )^ := R or G or B; - inc( UInt32( Addr ), BPP ); - end; - inc( UInt32( Addr ), ModX ); - end; - end; - 15 : - begin - for y := 0 to RealRect.h - 1 do - begin - for x := 0 to RealRect.w - 1 do - begin - SrcColor := PUInt32( Addr )^; - R := SrcColor and $7C00 - Color and $7C00; - G := SrcColor and $03E0 - Color and $03E0; - B := SrcColor and $001F - Color and $001F; - if R > $7C00 then - R := 0; - if G > $03E0 then - G := 0; - if B > $001F then - B := 0; - PUInt16( Addr )^ := R or G or B; - inc( UInt32( Addr ), BPP ); - end; - inc( UInt32( Addr ), ModX ); - end; - end; - 16 : - begin - for y := 0 to RealRect.h - 1 do - begin - for x := 0 to RealRect.w - 1 do - begin - SrcColor := PUInt32( Addr )^; - R := SrcColor and $F800 - Color and $F800; - G := SrcColor and $07C0 - Color and $07C0; - B := SrcColor and $001F - Color and $001F; - if R > $F800 then - R := 0; - if G > $07C0 then - G := 0; - if B > $001F then - B := 0; - PUInt16( Addr )^ := R or G or B; - inc( UInt32( Addr ), BPP ); - end; - inc( UInt32( Addr ), ModX ); - end; - end; - 24 : - begin - for y := 0 to RealRect.h - 1 do - begin - for x := 0 to RealRect.w - 1 do - begin - SrcColor := PUInt32( Addr )^; - R := SrcColor and $00FF0000 - Color and $00FF0000; - G := SrcColor and $0000FF00 - Color and $0000FF00; - B := SrcColor and $000000FF - Color and $000000FF; - if R > $FF0000 then - R := 0; - if G > $00FF00 then - G := 0; - if B > $0000FF then - B := 0; - PUInt32( Addr )^ := SrcColor and $FF000000 or R or G or B; - inc( UInt32( Addr ), BPP ); - end; - inc( UInt32( Addr ), ModX ); - end; - end; - 32 : - begin - for y := 0 to RealRect.h - 1 do - begin - for x := 0 to RealRect.w - 1 do - begin - SrcColor := PUInt32( Addr )^; - R := SrcColor and $00FF0000 - Color and $00FF0000; - G := SrcColor and $0000FF00 - Color and $0000FF00; - B := SrcColor and $000000FF - Color and $000000FF; - if R > $FF0000 then - R := 0; - if G > $00FF00 then - G := 0; - if B > $0000FF then - B := 0; - PUInt32( Addr )^ := R or G or B; - inc( UInt32( Addr ), BPP ); - end; - inc( UInt32( Addr ), ModX ); - end; - end; - end; - SDL_UnlockSurface( DstSurface ); - end; -end; - -procedure SDL_GradientFillRect( DstSurface : PSDL_Surface; const Rect : PSDL_Rect; const StartColor, EndColor : TSDL_Color; const Style : TGradientStyle ); -var - FBC : array[ 0..255 ] of Cardinal; - // temp vars - i, YR, YG, YB, SR, SG, SB, DR, DG, DB : Integer; - - TempStepV, TempStepH : Single; - TempLeft, TempTop, TempHeight, TempWidth : integer; - TempRect : TSDL_Rect; - -begin - // calc FBC - YR := StartColor.r; - YG := StartColor.g; - YB := StartColor.b; - SR := YR; - SG := YG; - SB := YB; - DR := EndColor.r - SR; - DG := EndColor.g - SG; - DB := EndColor.b - SB; - - for i := 0 to 255 do - begin - FBC[ i ] := SDL_MapRGB( DstSurface.format, YR, YG, YB ); - YR := SR + round( DR / 255 * i ); - YG := SG + round( DG / 255 * i ); - YB := SB + round( DB / 255 * i ); - end; - - // if aStyle = 1 then begin - TempStepH := Rect.w / 255; - TempStepV := Rect.h / 255; - TempHeight := Trunc( TempStepV + 1 ); - TempWidth := Trunc( TempStepH + 1 ); - TempTop := 0; - TempLeft := 0; - TempRect.x := Rect.x; - TempRect.y := Rect.y; - TempRect.h := Rect.h; - TempRect.w := Rect.w; - - case Style of - gsHorizontal : - begin - TempRect.h := TempHeight; - for i := 0 to 255 do - begin - TempRect.y := Rect.y + TempTop; - SDL_FillRect( DstSurface, @TempRect, FBC[ i ] ); - TempTop := Trunc( TempStepV * i ); - end; - end; - gsVertical : - begin - TempRect.w := TempWidth; - for i := 0 to 255 do - begin - TempRect.x := Rect.x + TempLeft; - SDL_FillRect( DstSurface, @TempRect, FBC[ i ] ); - TempLeft := Trunc( TempStepH * i ); - end; - end; - end; -end; - -procedure SDL_2xBlit(Src, Dest: PSDL_Surface); -var - ReadAddr, WriteAddr, ReadRow, WriteRow: UInt32; - SrcPitch, DestPitch, x, y: UInt32; -begin - if (Src = nil) or (Dest = nil) then - exit; - if (Src.w shl 1) < Dest.w then - exit; - if (Src.h shl 1) < Dest.h then - exit; - - if SDL_MustLock(Src) then - SDL_LockSurface(Src); - if SDL_MustLock(Dest) then - SDL_LockSurface(Dest); - - ReadRow := UInt32(Src.Pixels); - WriteRow := UInt32(Dest.Pixels); - - SrcPitch := Src.pitch; - DestPitch := Dest.pitch; - - case Src.format.BytesPerPixel of - 1: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - PUInt8(WriteAddr)^ := PUInt8(ReadAddr)^; - PUInt8(WriteAddr + 1)^ := PUInt8(ReadAddr)^; - PUInt8(WriteAddr + DestPitch)^ := PUInt8(ReadAddr)^; - PUInt8(WriteAddr + DestPitch + 1)^ := PUInt8(ReadAddr)^; - inc(ReadAddr); - inc(WriteAddr, 2); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; - 2: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - PUInt16(WriteAddr)^ := PUInt16(ReadAddr)^; - PUInt16(WriteAddr + 2)^ := PUInt16(ReadAddr)^; - PUInt16(WriteAddr + DestPitch)^ := PUInt16(ReadAddr)^; - PUInt16(WriteAddr + DestPitch + 2)^ := PUInt16(ReadAddr)^; - inc(ReadAddr, 2); - inc(WriteAddr, 4); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; - 3: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - PUInt32(WriteAddr)^ := (PUInt32(WriteAddr)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - PUInt32(WriteAddr + 3)^ := (PUInt32(WriteAddr + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - PUInt32(WriteAddr + DestPitch)^ := (PUInt32(WriteAddr + DestPitch)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - PUInt32(WriteAddr + DestPitch + 3)^ := (PUInt32(WriteAddr + DestPitch + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - inc(ReadAddr, 3); - inc(WriteAddr, 6); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; - 4: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - PUInt32(WriteAddr)^ := PUInt32(ReadAddr)^; - PUInt32(WriteAddr + 4)^ := PUInt32(ReadAddr)^; - PUInt32(WriteAddr + DestPitch)^ := PUInt32(ReadAddr)^; - PUInt32(WriteAddr + DestPitch + 4)^ := PUInt32(ReadAddr)^; - inc(ReadAddr, 4); - inc(WriteAddr, 8); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; - end; - - if SDL_MustLock(Src) then - SDL_UnlockSurface(Src); - if SDL_MustLock(Dest) then - SDL_UnlockSurface(Dest); -end; - -procedure SDL_Scanline2xBlit(Src, Dest: PSDL_Surface); -var - ReadAddr, WriteAddr, ReadRow, WriteRow: UInt32; - SrcPitch, DestPitch, x, y: UInt32; -begin - if (Src = nil) or (Dest = nil) then - exit; - if (Src.w shl 1) < Dest.w then - exit; - if (Src.h shl 1) < Dest.h then - exit; - - if SDL_MustLock(Src) then - SDL_LockSurface(Src); - if SDL_MustLock(Dest) then - SDL_LockSurface(Dest); - - ReadRow := UInt32(Src.Pixels); - WriteRow := UInt32(Dest.Pixels); - - SrcPitch := Src.pitch; - DestPitch := Dest.pitch; - - case Src.format.BytesPerPixel of - 1: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - PUInt8(WriteAddr)^ := PUInt8(ReadAddr)^; - PUInt8(WriteAddr + 1)^ := PUInt8(ReadAddr)^; - inc(ReadAddr); - inc(WriteAddr, 2); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; - 2: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - PUInt16(WriteAddr)^ := PUInt16(ReadAddr)^; - PUInt16(WriteAddr + 2)^ := PUInt16(ReadAddr)^; - inc(ReadAddr, 2); - inc(WriteAddr, 4); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; - 3: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - PUInt32(WriteAddr)^ := (PUInt32(WriteAddr)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - PUInt32(WriteAddr + 3)^ := (PUInt32(WriteAddr + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - inc(ReadAddr, 3); - inc(WriteAddr, 6); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; - 4: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - PUInt32(WriteAddr)^ := PUInt32(ReadAddr)^; - PUInt32(WriteAddr + 4)^ := PUInt32(ReadAddr)^; - inc(ReadAddr, 4); - inc(WriteAddr, 8); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; - end; - - if SDL_MustLock(Src) then - SDL_UnlockSurface(Src); - if SDL_MustLock(Dest) then - SDL_UnlockSurface(Dest); -end; - -procedure SDL_50Scanline2xBlit(Src, Dest: PSDL_Surface); -var - ReadAddr, WriteAddr, ReadRow, WriteRow: UInt32; - SrcPitch, DestPitch, x, y, Color: UInt32; -begin - if (Src = nil) or (Dest = nil) then - exit; - if (Src.w shl 1) < Dest.w then - exit; - if (Src.h shl 1) < Dest.h then - exit; - - if SDL_MustLock(Src) then - SDL_LockSurface(Src); - if SDL_MustLock(Dest) then - SDL_LockSurface(Dest); - - ReadRow := UInt32(Src.Pixels); - WriteRow := UInt32(Dest.Pixels); - - SrcPitch := Src.pitch; - DestPitch := Dest.pitch; - - case Src.format.BitsPerPixel of - 8: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - Color := PUInt8(ReadAddr)^; - PUInt8(WriteAddr)^ := Color; - PUInt8(WriteAddr + 1)^ := Color; - Color := (Color shr 1) and $6d; {%01101101} - PUInt8(WriteAddr + DestPitch)^ := Color; - PUInt8(WriteAddr + DestPitch + 1)^ := Color; - inc(ReadAddr); - inc(WriteAddr, 2); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; - 15: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - Color := PUInt16(ReadAddr)^; - PUInt16(WriteAddr)^ := Color; - PUInt16(WriteAddr + 2)^ := Color; - Color := (Color shr 1) and $3def; {%0011110111101111} - PUInt16(WriteAddr + DestPitch)^ := Color; - PUInt16(WriteAddr + DestPitch + 2)^ := Color; - inc(ReadAddr, 2); - inc(WriteAddr, 4); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; - 16: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - Color := PUInt16(ReadAddr)^; - PUInt16(WriteAddr)^ := Color; - PUInt16(WriteAddr + 2)^ := Color; - Color := (Color shr 1) and $7bef; {%0111101111101111} - PUInt16(WriteAddr + DestPitch)^ := Color; - PUInt16(WriteAddr + DestPitch + 2)^ := Color; - inc(ReadAddr, 2); - inc(WriteAddr, 4); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; - 24: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - Color := (PUInt32(WriteAddr)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - PUInt32(WriteAddr)^ := Color; - PUInt32(WriteAddr + 3)^ := Color; - Color := (Color shr 1) and $007f7f7f; {%011111110111111101111111} - PUInt32(WriteAddr + DestPitch)^ := Color; - PUInt32(WriteAddr + DestPitch + 3)^ := Color; - inc(ReadAddr, 3); - inc(WriteAddr, 6); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; - 32: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - Color := PUInt32(ReadAddr)^; - PUInt32(WriteAddr)^ := Color; - PUInt32(WriteAddr + 4)^ := Color; - Color := (Color shr 1) and $7f7f7f7f; - PUInt32(WriteAddr + DestPitch)^ := Color; - PUInt32(WriteAddr + DestPitch + 4)^ := Color; - inc(ReadAddr, 4); - inc(WriteAddr, 8); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; - end; - - if SDL_MustLock(Src) then - SDL_UnlockSurface(Src); - if SDL_MustLock(Dest) then - SDL_UnlockSurface(Dest); -end; - -function SDL_PixelTestSurfaceVsRect( SrcSurface1 : PSDL_Surface; SrcRect1 : -PSDL_Rect; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : -boolean; -var - Src_Rect1, Src_Rect2 : TSDL_Rect; - right1, bottom1 : integer; - right2, bottom2 : integer; - Scan1Start, Scan2Start, ScanWidth, ScanHeight : cardinal; - Mod1: cardinal; - Addr1 : cardinal; - BPP : cardinal; - Pitch1 : cardinal; - TransparentColor1 : cardinal; - tx, ty : cardinal; - StartTick : cardinal; - Color1 : cardinal; -begin - Result := false; - if SrcRect1 = nil then - begin - with Src_Rect1 do - begin - x := 0; - y := 0; - w := SrcSurface1.w; - h := SrcSurface1.h; - end; - end - else - Src_Rect1 := SrcRect1^; - - Src_Rect2 := SrcRect2^; - with Src_Rect1 do - begin - Right1 := Left1 + w; - Bottom1 := Top1 + h; - end; - with Src_Rect2 do - begin - Right2 := Left2 + w; - Bottom2 := Top2 + h; - end; - if ( Left1 >= Right2 ) or ( Right1 <= Left2 ) or ( Top1 >= Bottom2 ) or ( -Bottom1 <= - Top2 ) then - exit; - if Left1 <= Left2 then - begin - // 1. left, 2. right - Scan1Start := Src_Rect1.x + Left2 - Left1; - Scan2Start := Src_Rect2.x; - ScanWidth := Right1 - Left2; - with Src_Rect2 do - if ScanWidth > w then - ScanWidth := w; - end - else - begin - // 1. right, 2. left - Scan1Start := Src_Rect1.x; - Scan2Start := Src_Rect2.x + Left1 - Left2; - ScanWidth := Right2 - Left1; - with Src_Rect1 do - if ScanWidth > w then - ScanWidth := w; - end; - with SrcSurface1^ do - begin - Pitch1 := Pitch; - Addr1 := cardinal( Pixels ); - inc( Addr1, Pitch1 * UInt32( Src_Rect1.y ) ); - with format^ do - begin - BPP := BytesPerPixel; - TransparentColor1 := colorkey; - end; - end; - - Mod1 := Pitch1 - ( ScanWidth * BPP ); - - inc( Addr1, BPP * Scan1Start ); - - if Top1 <= Top2 then - begin - // 1. up, 2. down - ScanHeight := Bottom1 - Top2; - if ScanHeight > Src_Rect2.h then - ScanHeight := Src_Rect2.h; - inc( Addr1, Pitch1 * UInt32( Top2 - Top1 ) ); - end - else - begin - // 1. down, 2. up - ScanHeight := Bottom2 - Top1; - if ScanHeight > Src_Rect1.h then - ScanHeight := Src_Rect1.h; - - end; - case BPP of - 1 : - for ty := 1 to ScanHeight do - begin - for tx := 1 to ScanWidth do - begin - if ( PByte( Addr1 )^ <> TransparentColor1 ) then - begin - Result := true; - exit; - end; - inc( Addr1 ); - - end; - inc( Addr1, Mod1 ); - - end; - 2 : - for ty := 1 to ScanHeight do - begin - for tx := 1 to ScanWidth do - begin - if ( PWord( Addr1 )^ <> TransparentColor1 ) then - begin - Result := true; - exit; - end; - inc( Addr1, 2 ); - - end; - inc( Addr1, Mod1 ); - - end; - 3 : - for ty := 1 to ScanHeight do - begin - for tx := 1 to ScanWidth do - begin - Color1 := PLongWord( Addr1 )^ and $00FFFFFF; - - if ( Color1 <> TransparentColor1 ) - then - begin - Result := true; - exit; - end; - inc( Addr1, 3 ); - - end; - inc( Addr1, Mod1 ); - - end; - 4 : - for ty := 1 to ScanHeight do - begin - for tx := 1 to ScanWidth do - begin - if ( PLongWord( Addr1 )^ <> TransparentColor1 ) then - begin - Result := true; - exit; - end; - inc( Addr1, 4 ); - - end; - inc( Addr1, Mod1 ); - - end; - end; -end; - -procedure SDL_ORSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); -var - R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; - Src, Dest : TSDL_Rect; - Diff : integer; - SrcAddr, DestAddr : cardinal; - WorkX, WorkY : word; - SrcMod, DestMod : cardinal; - Bits : cardinal; -begin - if ( SrcSurface = nil ) or ( DestSurface = nil ) then - exit; // Remove this to make it faster - if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then - exit; // Remove this to make it faster - if SrcRect = nil then - begin - with Src do - begin - x := 0; - y := 0; - w := SrcSurface.w; - h := SrcSurface.h; - end; - end - else - Src := SrcRect^; - if DestRect = nil then - begin - Dest.x := 0; - Dest.y := 0; - end - else - Dest := DestRect^; - Dest.w := Src.w; - Dest.h := Src.h; - with DestSurface.Clip_Rect do - begin - // Source's right side is greater than the dest.cliprect - if Dest.x + Src.w > x + w then - begin - smallint( Src.w ) := x + w - Dest.x; - smallint( Dest.w ) := x + w - Dest.x; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's bottom side is greater than the dest.clip - if Dest.y + Src.h > y + h then - begin - smallint( Src.h ) := y + h - Dest.y; - smallint( Dest.h ) := y + h - Dest.y; - if smallint( Dest.h ) < 1 then - exit; - end; - // Source's left side is less than the dest.clip - if Dest.x < x then - begin - Diff := x - Dest.x; - Src.x := Src.x + Diff; - smallint( Src.w ) := smallint( Src.w ) - Diff; - Dest.x := x; - smallint( Dest.w ) := smallint( Dest.w ) - Diff; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's Top side is less than the dest.clip - if Dest.y < y then - begin - Diff := y - Dest.y; - Src.y := Src.y + Diff; - smallint( Src.h ) := smallint( Src.h ) - Diff; - Dest.y := y; - smallint( Dest.h ) := smallint( Dest.h ) - Diff; - if smallint( Dest.h ) < 1 then - exit; - end; - end; - with SrcSurface^ do - begin - SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * - Format.BytesPerPixel; - SrcMod := Pitch - Src.w * Format.BytesPerPixel; - TransparentColor := Format.colorkey; - end; - with DestSurface^ do - begin - DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * - Format.BytesPerPixel; - DestMod := Pitch - Dest.w * Format.BytesPerPixel; - Bits := Format.BitsPerPixel; - end; - SDL_LockSurface( SrcSurface ); - SDL_LockSurface( DestSurface ); - WorkY := Src.h; - case bits of - 8 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt8( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt8( DestAddr )^; - PUInt8( DestAddr )^ := Pixel2 OR Pixel1; - end; - inc( SrcAddr ); - inc( DestAddr ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 15 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt16( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt16( DestAddr )^; - - PUInt16( DestAddr )^ := Pixel2 OR Pixel1; - - end; - inc( SrcAddr, 2 ); - inc( DestAddr, 2 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 16 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt16( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt16( DestAddr )^; - - PUInt16( DestAddr )^ := Pixel2 OR Pixel1; - - end; - inc( SrcAddr, 2 ); - inc( DestAddr, 2 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 24 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; - - PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or Pixel2 or Pixel1; - end; - inc( SrcAddr, 3 ); - inc( DestAddr, 3 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 32 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt32( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt32( DestAddr )^; - - PUInt32( DestAddr )^ := Pixel2 or Pixel1; - end; - inc( SrcAddr, 4 ); - inc( DestAddr, 4 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - end; - SDL_UnlockSurface( SrcSurface ); - SDL_UnlockSurface( DestSurface ); -end; - -procedure SDL_ANDSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); -var - R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; - Src, Dest : TSDL_Rect; - Diff : integer; - SrcAddr, DestAddr : cardinal; - WorkX, WorkY : word; - SrcMod, DestMod : cardinal; - Bits : cardinal; -begin - if ( SrcSurface = nil ) or ( DestSurface = nil ) then - exit; // Remove this to make it faster - if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then - exit; // Remove this to make it faster - if SrcRect = nil then - begin - with Src do - begin - x := 0; - y := 0; - w := SrcSurface.w; - h := SrcSurface.h; - end; - end - else - Src := SrcRect^; - if DestRect = nil then - begin - Dest.x := 0; - Dest.y := 0; - end - else - Dest := DestRect^; - Dest.w := Src.w; - Dest.h := Src.h; - with DestSurface.Clip_Rect do - begin - // Source's right side is greater than the dest.cliprect - if Dest.x + Src.w > x + w then - begin - smallint( Src.w ) := x + w - Dest.x; - smallint( Dest.w ) := x + w - Dest.x; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's bottom side is greater than the dest.clip - if Dest.y + Src.h > y + h then - begin - smallint( Src.h ) := y + h - Dest.y; - smallint( Dest.h ) := y + h - Dest.y; - if smallint( Dest.h ) < 1 then - exit; - end; - // Source's left side is less than the dest.clip - if Dest.x < x then - begin - Diff := x - Dest.x; - Src.x := Src.x + Diff; - smallint( Src.w ) := smallint( Src.w ) - Diff; - Dest.x := x; - smallint( Dest.w ) := smallint( Dest.w ) - Diff; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's Top side is less than the dest.clip - if Dest.y < y then - begin - Diff := y - Dest.y; - Src.y := Src.y + Diff; - smallint( Src.h ) := smallint( Src.h ) - Diff; - Dest.y := y; - smallint( Dest.h ) := smallint( Dest.h ) - Diff; - if smallint( Dest.h ) < 1 then - exit; - end; - end; - with SrcSurface^ do - begin - SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * - Format.BytesPerPixel; - SrcMod := Pitch - Src.w * Format.BytesPerPixel; - TransparentColor := Format.colorkey; - end; - with DestSurface^ do - begin - DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * - Format.BytesPerPixel; - DestMod := Pitch - Dest.w * Format.BytesPerPixel; - Bits := Format.BitsPerPixel; - end; - SDL_LockSurface( SrcSurface ); - SDL_LockSurface( DestSurface ); - WorkY := Src.h; - case bits of - 8 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt8( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt8( DestAddr )^; - PUInt8( DestAddr )^ := Pixel2 and Pixel1; - end; - inc( SrcAddr ); - inc( DestAddr ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 15 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt16( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt16( DestAddr )^; - - PUInt16( DestAddr )^ := Pixel2 and Pixel1; - - end; - inc( SrcAddr, 2 ); - inc( DestAddr, 2 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 16 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt16( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt16( DestAddr )^; - - PUInt16( DestAddr )^ := Pixel2 and Pixel1; - - end; - inc( SrcAddr, 2 ); - inc( DestAddr, 2 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 24 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; - - PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or Pixel2 and Pixel1; - end; - inc( SrcAddr, 3 ); - inc( DestAddr, 3 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 32 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt32( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt32( DestAddr )^; - - PUInt32( DestAddr )^ := Pixel2 and Pixel1; - end; - inc( SrcAddr, 4 ); - inc( DestAddr, 4 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - end; - SDL_UnlockSurface( SrcSurface ); - SDL_UnlockSurface( DestSurface ); -end; - - - -procedure SDL_GTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); -var - R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; - Src, Dest : TSDL_Rect; - Diff : integer; - SrcAddr, DestAddr : cardinal; - WorkX, WorkY : word; - SrcMod, DestMod : cardinal; - Bits : cardinal; -begin - if ( SrcSurface = nil ) or ( DestSurface = nil ) then - exit; // Remove this to make it faster - if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then - exit; // Remove this to make it faster - if SrcRect = nil then - begin - with Src do - begin - x := 0; - y := 0; - w := SrcSurface.w; - h := SrcSurface.h; - end; - end - else - Src := SrcRect^; - if DestRect = nil then - begin - Dest.x := 0; - Dest.y := 0; - end - else - Dest := DestRect^; - Dest.w := Src.w; - Dest.h := Src.h; - with DestSurface.Clip_Rect do - begin - // Source's right side is greater than the dest.cliprect - if Dest.x + Src.w > x + w then - begin - smallint( Src.w ) := x + w - Dest.x; - smallint( Dest.w ) := x + w - Dest.x; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's bottom side is greater than the dest.clip - if Dest.y + Src.h > y + h then - begin - smallint( Src.h ) := y + h - Dest.y; - smallint( Dest.h ) := y + h - Dest.y; - if smallint( Dest.h ) < 1 then - exit; - end; - // Source's left side is less than the dest.clip - if Dest.x < x then - begin - Diff := x - Dest.x; - Src.x := Src.x + Diff; - smallint( Src.w ) := smallint( Src.w ) - Diff; - Dest.x := x; - smallint( Dest.w ) := smallint( Dest.w ) - Diff; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's Top side is less than the dest.clip - if Dest.y < y then - begin - Diff := y - Dest.y; - Src.y := Src.y + Diff; - smallint( Src.h ) := smallint( Src.h ) - Diff; - Dest.y := y; - smallint( Dest.h ) := smallint( Dest.h ) - Diff; - if smallint( Dest.h ) < 1 then - exit; - end; - end; - with SrcSurface^ do - begin - SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * - Format.BytesPerPixel; - SrcMod := Pitch - Src.w * Format.BytesPerPixel; - TransparentColor := Format.colorkey; - end; - with DestSurface^ do - begin - DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * - Format.BytesPerPixel; - DestMod := Pitch - Dest.w * Format.BytesPerPixel; - Bits := Format.BitsPerPixel; - end; - SDL_LockSurface( SrcSurface ); - SDL_LockSurface( DestSurface ); - WorkY := Src.h; - case bits of - 8 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt8( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt8( DestAddr )^; - if Pixel2 > 0 then - begin - if Pixel2 and $E0 > Pixel1 and $E0 then R := Pixel2 and $E0 else R := Pixel1 and $E0; - if Pixel2 and $1C > Pixel1 and $1C then G := Pixel2 and $1C else G := Pixel1 and $1C; - if Pixel2 and $03 > Pixel1 and $03 then B := Pixel2 and $03 else B := Pixel1 and $03; - - if R > $E0 then - R := $E0; - if G > $1C then - G := $1C; - if B > $03 then - B := $03; - PUInt8( DestAddr )^ := R or G or B; - end - else - PUInt8( DestAddr )^ := Pixel1; - end; - inc( SrcAddr ); - inc( DestAddr ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 15 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt16( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt16( DestAddr )^; - if Pixel2 > 0 then - begin - - if Pixel2 and $7C00 > Pixel1 and $7C00 then R := Pixel2 and $7C00 else R := Pixel1 and $7C00; - if Pixel2 and $03E0 > Pixel1 and $03E0 then G := Pixel2 and $03E0 else G := Pixel1 and $03E0; - if Pixel2 and $001F > Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; - - PUInt16( DestAddr )^ := R or G or B; - end - else - PUInt16( DestAddr )^ := Pixel1; - end; - inc( SrcAddr, 2 ); - inc( DestAddr, 2 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 16 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt16( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt16( DestAddr )^; - if Pixel2 > 0 then - begin - - if Pixel2 and $F800 > Pixel1 and $F800 then R := Pixel2 and $F800 else R := Pixel1 and $F800; - if Pixel2 and $07E0 > Pixel1 and $07E0 then G := Pixel2 and $07E0 else G := Pixel1 and $07E0; - if Pixel2 and $001F > Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; - - PUInt16( DestAddr )^ := R or G or B; - end - else - PUInt16( DestAddr )^ := Pixel1; - end; - inc( SrcAddr, 2 ); - inc( DestAddr, 2 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 24 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; - if Pixel2 > 0 then - begin - - if Pixel2 and $FF0000 > Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; - if Pixel2 and $00FF00 > Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; - if Pixel2 and $0000FF > Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; - - PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or ( R or G or B ); - end - else - PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or Pixel1; - end; - inc( SrcAddr, 3 ); - inc( DestAddr, 3 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 32 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt32( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt32( DestAddr )^; - if Pixel2 > 0 then - begin - - if Pixel2 and $FF0000 > Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; - if Pixel2 and $00FF00 > Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; - if Pixel2 and $0000FF > Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; - - PUInt32( DestAddr )^ := R or G or B; - end - else - PUInt32( DestAddr )^ := Pixel1; - end; - inc( SrcAddr, 4 ); - inc( DestAddr, 4 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - end; - SDL_UnlockSurface( SrcSurface ); - SDL_UnlockSurface( DestSurface ); -end; - - -procedure SDL_LTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; - DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); -var - R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; - Src, Dest : TSDL_Rect; - Diff : integer; - SrcAddr, DestAddr : cardinal; - WorkX, WorkY : word; - SrcMod, DestMod : cardinal; - Bits : cardinal; -begin - if ( SrcSurface = nil ) or ( DestSurface = nil ) then - exit; // Remove this to make it faster - if ( SrcSurface.Format.BitsPerPixel <> DestSurface.Format.BitsPerPixel ) then - exit; // Remove this to make it faster - if SrcRect = nil then - begin - with Src do - begin - x := 0; - y := 0; - w := SrcSurface.w; - h := SrcSurface.h; - end; - end - else - Src := SrcRect^; - if DestRect = nil then - begin - Dest.x := 0; - Dest.y := 0; - end - else - Dest := DestRect^; - Dest.w := Src.w; - Dest.h := Src.h; - with DestSurface.Clip_Rect do - begin - // Source's right side is greater than the dest.cliprect - if Dest.x + Src.w > x + w then - begin - smallint( Src.w ) := x + w - Dest.x; - smallint( Dest.w ) := x + w - Dest.x; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's bottom side is greater than the dest.clip - if Dest.y + Src.h > y + h then - begin - smallint( Src.h ) := y + h - Dest.y; - smallint( Dest.h ) := y + h - Dest.y; - if smallint( Dest.h ) < 1 then - exit; - end; - // Source's left side is less than the dest.clip - if Dest.x < x then - begin - Diff := x - Dest.x; - Src.x := Src.x + Diff; - smallint( Src.w ) := smallint( Src.w ) - Diff; - Dest.x := x; - smallint( Dest.w ) := smallint( Dest.w ) - Diff; - if smallint( Dest.w ) < 1 then - exit; - end; - // Source's Top side is less than the dest.clip - if Dest.y < y then - begin - Diff := y - Dest.y; - Src.y := Src.y + Diff; - smallint( Src.h ) := smallint( Src.h ) - Diff; - Dest.y := y; - smallint( Dest.h ) := smallint( Dest.h ) - Diff; - if smallint( Dest.h ) < 1 then - exit; - end; - end; - with SrcSurface^ do - begin - SrcAddr := cardinal( Pixels ) + UInt32( Src.y ) * Pitch + UInt32( Src.x ) * - Format.BytesPerPixel; - SrcMod := Pitch - Src.w * Format.BytesPerPixel; - TransparentColor := Format.colorkey; - end; - with DestSurface^ do - begin - DestAddr := cardinal( Pixels ) + UInt32( Dest.y ) * Pitch + UInt32( Dest.x ) * - Format.BytesPerPixel; - DestMod := Pitch - Dest.w * Format.BytesPerPixel; - Bits := Format.BitsPerPixel; - end; - SDL_LockSurface( SrcSurface ); - SDL_LockSurface( DestSurface ); - WorkY := Src.h; - case bits of - 8 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt8( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt8( DestAddr )^; - if Pixel2 > 0 then - begin - if Pixel2 and $E0 < Pixel1 and $E0 then R := Pixel2 and $E0 else R := Pixel1 and $E0; - if Pixel2 and $1C < Pixel1 and $1C then G := Pixel2 and $1C else G := Pixel1 and $1C; - if Pixel2 and $03 < Pixel1 and $03 then B := Pixel2 and $03 else B := Pixel1 and $03; - - if R > $E0 then - R := $E0; - if G > $1C then - G := $1C; - if B > $03 then - B := $03; - PUInt8( DestAddr )^ := R or G or B; - end - else - PUInt8( DestAddr )^ := Pixel1; - end; - inc( SrcAddr ); - inc( DestAddr ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 15 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt16( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt16( DestAddr )^; - if Pixel2 > 0 then - begin - - if Pixel2 and $7C00 < Pixel1 and $7C00 then R := Pixel2 and $7C00 else R := Pixel1 and $7C00; - if Pixel2 and $03E0 < Pixel1 and $03E0 then G := Pixel2 and $03E0 else G := Pixel1 and $03E0; - if Pixel2 and $001F < Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; - - PUInt16( DestAddr )^ := R or G or B; - end - else - PUInt16( DestAddr )^ := Pixel1; - end; - inc( SrcAddr, 2 ); - inc( DestAddr, 2 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 16 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt16( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt16( DestAddr )^; - if Pixel2 > 0 then - begin - - if Pixel2 and $F800 < Pixel1 and $F800 then R := Pixel2 and $F800 else R := Pixel1 and $F800; - if Pixel2 and $07E0 < Pixel1 and $07E0 then G := Pixel2 and $07E0 else G := Pixel1 and $07E0; - if Pixel2 and $001F < Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; - - PUInt16( DestAddr )^ := R or G or B; - end - else - PUInt16( DestAddr )^ := Pixel1; - end; - inc( SrcAddr, 2 ); - inc( DestAddr, 2 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 24 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt32( SrcAddr )^ and $00FFFFFF; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt32( DestAddr )^ and $00FFFFFF; - if Pixel2 > 0 then - begin - - if Pixel2 and $FF0000 < Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; - if Pixel2 and $00FF00 < Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; - if Pixel2 and $0000FF < Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; - - PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or ( R or G or B ); - end - else - PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or Pixel1; - end; - inc( SrcAddr, 3 ); - inc( DestAddr, 3 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - 32 : - begin - repeat - WorkX := Src.w; - repeat - Pixel1 := PUInt32( SrcAddr )^; - if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then - begin - Pixel2 := PUInt32( DestAddr )^; - if Pixel2 > 0 then - begin - - if Pixel2 and $FF0000 < Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; - if Pixel2 and $00FF00 < Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; - if Pixel2 and $0000FF < Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; - - PUInt32( DestAddr )^ := R or G or B; - end - else - PUInt32( DestAddr )^ := Pixel1; - end; - inc( SrcAddr, 4 ); - inc( DestAddr, 4 ); - dec( WorkX ); - until WorkX = 0; - inc( SrcAddr, SrcMod ); - inc( DestAddr, DestMod ); - dec( WorkY ); - until WorkY = 0; - end; - end; - SDL_UnlockSurface( SrcSurface ); - SDL_UnlockSurface( DestSurface ); -end; - -// Will clip the x1,x2,y1,x2 params to the ClipRect provided -function SDL_ClipLine(var x1,y1,x2,y2: Integer; ClipRect: PSDL_Rect) : boolean; - var tflag, flag1, flag2: word; - txy, xedge, yedge: Integer; - slope: single; - - function ClipCode(x,y: Integer): word; - begin - Result := 0; - if x < ClipRect.x then Result := 1; - if x >= ClipRect.w + ClipRect.x then Result := Result or 2; - if y < ClipRect.y then Result := Result or 4; - if y >= ClipRect.h + ClipRect.y then Result := Result or 8; - end; - -begin - flag1 := ClipCode(x1,y1); - flag2 := ClipCode(x2,y2); - result := true; - - while true do - begin - if (flag1 or flag2) = 0 then Exit; // all in - - if (flag1 and flag2) <> 0 then - begin - result := false; - Exit; // all out - end; - - if flag2 = 0 then - begin - txy := x1; x1 := x2; x2 := txy; - txy := y1; y1 := y2; y2 := txy; - tflag := flag1; flag1 := flag2; flag2 := tflag; - end; - - if (flag2 and 3) <> 0 then - begin - if (flag2 and 1) <> 0 then - xedge := ClipRect.x - else - xedge := ClipRect.w + ClipRect.x -1; // back 1 pixel otherwise we end up in a loop - - slope := (y2 - y1) / (x2 - x1); - y2 := y1 + Round(slope * (xedge - x1)); - x2 := xedge; - end - else - begin - if (flag2 and 4) <> 0 then - yedge := ClipRect.y - else - yedge := ClipRect.h + ClipRect.y -1; // up 1 pixel otherwise we end up in a loop - - slope := (x2 - x1) / (y2 - y1); - x2 := x1 + Round(slope * (yedge - y1)); - y2 := yedge; - end; - - flag2 := ClipCode(x2, y2); - end; -end; - -end. - - diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlwindow.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlwindow.pas deleted file mode 100644 index ef290071..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/sdlwindow.pas +++ /dev/null @@ -1,564 +0,0 @@ -unit sdlwindow; -{ - $Id: sdlwindow.pas,v 1.7 2004/09/30 22:35:47 savage Exp $ - -} -{******************************************************************************} -{ } -{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } -{ SDL Window Wrapper } -{ } -{ } -{ The initial developer of this Pascal code was : } -{ Dominique Louis } -{ } -{ Portions created by Dominique Louis are } -{ Copyright (C) 2004 - 2100 Dominique Louis. } -{ } -{ } -{ Contributor(s) } -{ -------------- } -{ Dominique Louis } -{ } -{ Obtained through: } -{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } -{ } -{ You may retrieve the latest version of this file at the Project } -{ JEDI home page, located at http://delphi-jedi.org } -{ } -{ The contents of this file are used with permission, subject to } -{ the Mozilla Public License Version 1.1 (the "License"); you may } -{ not use this file except in compliance with the License. You may } -{ obtain a copy of the License at } -{ http://www.mozilla.org/MPL/MPL-1.1.html } -{ } -{ Software distributed under the License is distributed on an } -{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } -{ implied. See the License for the specific language governing } -{ rights and limitations under the License. } -{ } -{ Description } -{ ----------- } -{ SDL Window Wrapper } -{ } -{ } -{ Requires } -{ -------- } -{ SDL.dll on Windows platforms } -{ libSDL-1.1.so.0 on Linux platform } -{ } -{ Programming Notes } -{ ----------------- } -{ } -{ } -{ } -{ } -{ Revision History } -{ ---------------- } -{ January 31 2003 - DL : Initial creation } -{ } -{ - $Log: sdlwindow.pas,v $ - Revision 1.7 2004/09/30 22:35:47 savage - Changes, enhancements and additions as required to get SoAoS working. - - Revision 1.6 2004/09/12 21:52:58 savage - Slight changes to fix some issues with the sdl classes. - - Revision 1.5 2004/05/10 21:11:49 savage - changes required to help get SoAoS off the ground. - - Revision 1.4 2004/05/01 14:59:27 savage - Updated code - - Revision 1.3 2004/04/23 10:45:28 savage - Changes made by Dean Ellis to work more modularly. - - Revision 1.2 2004/03/31 10:06:41 savage - Changed so that it now compiles, but is untested. - - Revision 1.1 2004/02/05 00:08:20 savage - Module 1.0 release - -} -{******************************************************************************} - -interface - -{$i jedi-sdl.inc} - -uses - Classes, - sdl, - sdlinput, - sdlticks; - -type - TSDLNotifyEvent = procedure {$IFNDEF NOT_OO}of object{$ENDIF}; - TSDLUpdateEvent = procedure( aElapsedTime : single ) {$IFNDEF NOT_OO}of object{$ENDIF}; - TSDLResizeEvent = procedure( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 ) {$IFNDEF NOT_OO}of object{$ENDIF}; - TSDLUserEvent = procedure( aType : UInt8; aCode : integer; aData1 : Pointer; aData2 : Pointer ) {$IFNDEF NOT_OO}of object{$ENDIF}; - TSDLActiveEvent = procedure( aGain: UInt8; aState: UInt8 ) {$IFNDEF NOT_OO}of object{$ENDIF}; - - TSDLBaseWindow = class( TObject ) - private - FDisplaySurface : PSDL_Surface; - FVideoFlags : Uint32; - FOnDestroy: TSDLNotifyEvent; - FOnCreate: TSDLNotifyEvent; - FOnShow: TSDLNotifyEvent; - FOnResize: TSDLResizeEvent; - FOnUpdate: TSDLUpdateEvent; - FOnRender: TSDLNotifyEvent; - FOnClose: TSDLNotifyEvent; - FLoaded: Boolean; - FRendering: Boolean; - FHeight: integer; - FBitDepth: integer; - FWidth: integer; - FInputManager: TSDLInputManager; - FCaptionText : PChar; - FIconName : PChar; - FOnActive: TSDLActiveEvent; - FOnQuit: TSDLNotifyEvent; - FOnExpose: TSDLNotifyEvent; - FOnUser: TSDLUserEvent; - FTimer : TSDLTicks; - protected - procedure DoActive( aGain: UInt8; aState: UInt8 ); - procedure DoCreate; - procedure DoClose; - procedure DoDestroy; - procedure DoUpdate( aElapsedTime : single ); - procedure DoQuit; - procedure DoRender; - procedure DoResize( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 ); - procedure DoShow; - procedure DoUser( aType : UInt8; aCode : integer; aData1 : Pointer; aData2 : Pointer ); - procedure DoExpose; - procedure Render; virtual; - procedure Update( aElapsedTime : single ); virtual; - procedure InitialiseObjects; virtual; - procedure RestoreObjects; virtual; - procedure DeleteObjects; virtual; - function Flip : integer; virtual; - property OnActive : TSDLActiveEvent read FOnActive write FOnActive; - property OnClose: TSDLNotifyEvent read FOnClose write FOnClose; - property OnDestroy : TSDLNotifyEvent read FOnDestroy write FOnDestroy; - property OnCreate : TSDLNotifyEvent read FOnCreate write FOnCreate; - property OnUpdate: TSDLUpdateEvent read FOnUpdate write FOnUpdate; - property OnQuit : TSDLNotifyEvent read FOnQuit write FOnQuit; - property OnResize : TSDLResizeEvent read FOnResize write FOnResize; - property OnRender: TSDLNotifyEvent read FOnRender write FOnRender; - property OnShow : TSDLNotifyEvent read FOnShow write FOnShow; - property OnUser : TSDLUserEvent read FOnUser write FOnUser; - property OnExpose : TSDLNotifyEvent read FOnExpose write FOnExpose; - property DisplaySurface: PSDL_Surface read FDisplaySurface; - public - property InputManager : TSDLInputManager read FInputManager; - property Loaded : Boolean read FLoaded; - property Width : integer read FWidth; - property Height : integer read FHeight; - property BitDepth : integer read FBitDepth; - property Rendering : Boolean read FRendering write FRendering; - procedure SetCaption( const aCaptionText : string; const aIconName : string ); - procedure GetCaption( var aCaptionText : string; var aIconName : string ); - procedure SetIcon( aIcon : PSDL_Surface; aMask: UInt8 ); - procedure ActivateVideoMode; - constructor Create( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 ); virtual; - destructor Destroy; override; - procedure InitialiseEnvironment; - function Show : Boolean; virtual; - end; - - TSDL2DWindow = class( TSDLBaseWindow ) - public - constructor Create( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 = SDL_DOUBLEBUF or SDL_SWSURFACE); override; - procedure Render; override; - procedure Update( aElapsedTime : single ); override; - procedure InitialiseObjects; override; - procedure RestoreObjects; override; - procedure DeleteObjects; override; - function Flip : integer; override; - property OnCreate; - property OnDestroy; - property OnClose; - property OnShow; - property OnResize; - property OnRender; - property OnUpdate; - property DisplaySurface; - end; - - TSDL3DWindow = class( TSDLBaseWindow ) - public - constructor Create( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 = SDL_OPENGL or SDL_DOUBLEBUF); override; - function Flip : integer; override; - procedure Render; override; - procedure Update( aElapsedTime : single ); override; - procedure InitialiseObjects; override; - procedure RestoreObjects; override; - procedure DeleteObjects; override; - property OnCreate; - property OnDestroy; - property OnClose; - property OnShow; - property OnResize; - property OnRender; - property OnUpdate; - property DisplaySurface; - end; - - - -implementation - -uses - logger, - SysUtils; - -{ TSDLBaseWindow } -procedure TSDLBaseWindow.ActivateVideoMode; -begin - FDisplaySurface := SDL_SetVideoMode( FWidth, FHeight, FBitDepth, FVideoFlags); - if (FDisplaySurface = nil) then - begin - Log.LogError( Format('Could not set video mode: %s', [SDL_GetError]), 'Main'); - exit; - end; - - SetCaption( 'Made with JEDI-SDL', 'JEDI-SDL Icon' ); -end; - -constructor TSDLBaseWindow.Create( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 ); -begin - inherited Create; - SDL_Init(SDL_INIT_EVERYTHING); - FInputManager := TSDLInputManager.Create( [ itJoystick, itKeyBoard, itMouse ]); - FTimer := TSDLTicks.Create; - - FWidth := aWidth; - FHeight := aHeight; - FBitDepth := aBitDepth; - FVideoFlags := aVideoFlags; - - DoCreate; -end; - -procedure TSDLBaseWindow.DeleteObjects; -begin - FLoaded := False; -end; - -destructor TSDLBaseWindow.Destroy; -begin - DoDestroy; - if FLoaded then - DeleteObjects; - if FInputManager <> nil then - FreeAndNil( FInputManager ); - if FTimer <> nil then - FreeAndNil( FTimer ); - if FDisplaySurface <> nil then - SDL_FreeSurface( FDisplaySurface ); - inherited Destroy; - SDL_Quit; -end; - -procedure TSDLBaseWindow.DoActive(aGain, aState: UInt8); -begin - if Assigned( FOnActive ) then - begin - FOnActive( aGain, aState ); - end; -end; - -procedure TSDLBaseWindow.DoClose; -begin - if Assigned( FOnClose ) then - begin - FOnClose; - end; -end; - -procedure TSDLBaseWindow.DoCreate; -begin - if Assigned( FOnCreate ) then - begin - FOnCreate; - end; -end; - -procedure TSDLBaseWindow.DoDestroy; -begin - if Assigned( FOnDestroy ) then - begin - FOnDestroy; - end; -end; - -procedure TSDLBaseWindow.DoExpose; -begin - if Assigned( FOnExpose ) then - begin - FOnExpose; - end; -end; - -procedure TSDLBaseWindow.DoUpdate( aElapsedTime : single ); -begin - if Assigned( FOnUpdate ) then - begin - FOnUpdate( aElapsedTime ); - end; -end; - -procedure TSDLBaseWindow.DoQuit; -begin - FRendering := false; - if Assigned( FOnQuit ) then - begin - FOnQuit; - end; -end; - -procedure TSDLBaseWindow.DoRender; -begin - if Assigned( FOnRender ) then - begin - FOnRender; - end; -end; - -procedure TSDLBaseWindow.DoResize( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 ); -begin - // resize to the new size - SDL_FreeSurface(FDisplaySurface); - FWidth := aWidth; - FHeight := aHeight; - FBitDepth := aBitDepth; - FVideoFlags := aVideoFlags; - FDisplaySurface := SDL_SetVideoMode(aWidth, aHeight, aBitDepth, aVideoFlags); - if Assigned( FOnResize ) then - begin - FOnResize( aWidth, aHeight, aBitDepth, aVideoFlags ); - end; -end; - -procedure TSDLBaseWindow.DoShow; -begin - if Assigned( FOnShow ) then - begin - FOnShow; - end; -end; - -procedure TSDLBaseWindow.DoUser(aType: UInt8; aCode: integer; aData1, aData2: Pointer); -begin - if Assigned( FOnUser ) then - begin - FOnUser( aType, aCode, aData1, aData2 ); - end; -end; - -function TSDLBaseWindow.Flip : integer; -begin - result := 0; -end; - -procedure TSDLBaseWindow.GetCaption( var aCaptionText : string; var aIconName : string ); -begin - aCaptionText := string( FCaptionText ); - aIconName := string( FIconName ); -end; - -procedure TSDLBaseWindow.InitialiseEnvironment; -begin - InitialiseObjects; - RestoreObjects; -end; - -procedure TSDLBaseWindow.InitialiseObjects; -begin - FLoaded := True; -end; - -procedure TSDLBaseWindow.Update( aElapsedTime : single ); -begin - DoUpdate( aElapsedTime ); -end; - -procedure TSDLBaseWindow.Render; -begin - DoRender; -end; - -procedure TSDLBaseWindow.RestoreObjects; -begin - FLoaded := false; -end; - -procedure TSDLBaseWindow.SetCaption( const aCaptionText : string; const aIconName : string ); -begin - if FCaptionText <> aCaptionText then - begin - FCaptionText := PChar( aCaptionText ); - FIconName := PChar( aIconName ); - SDL_WM_SetCaption( FCaptionText, FIconName ); - end; -end; - -procedure TSDLBaseWindow.SetIcon(aIcon: PSDL_Surface; aMask: UInt8); -begin - SDL_WM_SetIcon( aIcon, aMask ); -end; - -function TSDLBaseWindow.Show : Boolean; -var - eBaseWindowEvent : TSDL_Event; -begin - DoShow; - - FTimer.Init; - - FRendering := true; - // repeat until we are told not to render - while FRendering do - begin - // wait for an event - while SDL_PollEvent( @eBaseWindowEvent ) > 0 do - begin - - // check for a quit event - case eBaseWindowEvent.type_ of - SDL_ACTIVEEVENT : - begin - DoActive( eBaseWindowEvent.active.gain, eBaseWindowEvent.active.state ); - end; - - SDL_QUITEV : - begin - DoQuit; - DoClose; - end; - - SDL_USEREVENT : - begin - DoUser( eBaseWindowEvent.user.type_, eBaseWindowEvent.user.code, eBaseWindowEvent.user.data1, eBaseWindowEvent.user.data2 ); - end; - - SDL_VIDEOEXPOSE : - begin - DoExpose; - end; - - SDL_VIDEORESIZE : - begin - DoResize( eBaseWindowEvent.resize.w, eBaseWindowEvent.resize.h, FDisplaySurface.format.BitsPerPixel, FVideoflags ); - end; - - - end; - InputManager.UpdateInputs( eBaseWindowEvent ); - end; - // Prepare the Next Frame - Update( FTimer.GetElapsedSeconds ); - // Display the Next Frame - Render; - // Flip the surfaces - Flip; - end; - - Result := FRendering; -end; - -{ TSDL2DWindow } - -constructor TSDL2DWindow.Create(aWidth, aHeight, aBitDepth: integer; aVideoFlags: Uint32); -begin - // make sure double buffer is always included in the video flags - inherited Create(aWidth,aHeight, aBitDepth, aVideoFlags or SDL_DOUBLEBUF); -end; - -procedure TSDL2DWindow.DeleteObjects; -begin - inherited; - -end; - -function TSDL2DWindow.Flip: integer; -begin - // let's show the back buffer - result := SDL_Flip( FDisplaySurface ); -end; - -procedure TSDL2DWindow.InitialiseObjects; -begin - inherited; - -end; - -procedure TSDL2DWindow.Update( aElapsedTime : single ); -begin - inherited; - -end; - -procedure TSDL2DWindow.Render; -begin - inherited; - -end; - -procedure TSDL2DWindow.RestoreObjects; -begin - inherited; - -end; - -{ TSDL3DWindow } - -constructor TSDL3DWindow.Create(aWidth, - aHeight, aBitDepth: integer; aVideoFlags: Uint32); -begin - // make sure opengl is always included in the video flags - inherited Create(aWidth,aHeight, aBitDepth, aVideoFlags or SDL_OPENGL or SDL_DOUBLEBUF); -end; - -procedure TSDL3DWindow.DeleteObjects; -begin - inherited; - -end; - -function TSDL3DWindow.Flip : integer; -begin - SDL_GL_SwapBuffers; - result := 0; -end; - -procedure TSDL3DWindow.InitialiseObjects; -begin - inherited; - -end; - -procedure TSDL3DWindow.Update( aElapsedTime : single ); -begin - inherited; - -end; - -procedure TSDL3DWindow.Render; -begin - inherited; - -end; - -procedure TSDL3DWindow.RestoreObjects; -begin - inherited; - -end; - -end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/userpreferences.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/userpreferences.pas deleted file mode 100644 index 97e26520..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/SDL/Pas/userpreferences.pas +++ /dev/null @@ -1,159 +0,0 @@ -unit userpreferences; -{ - $Id: userpreferences.pas,v 1.1 2004/09/30 22:35:47 savage Exp $ - -} -{******************************************************************************} -{ } -{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } -{ Base Class for User Preferences } -{ } -{ The initial developer of this Pascal code was : } -{ Dominqiue Louis } -{ } -{ Portions created by Dominqiue Louis are } -{ Copyright (C) 2000 - 2001 Dominqiue Louis. } -{ } -{ } -{ Contributor(s) } -{ -------------- } -{ } -{ } -{ Obtained through: } -{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } -{ } -{ You may retrieve the latest version of this file at the Project } -{ JEDI home page, located at http://delphi-jedi.org } -{ } -{ The contents of this file are used with permission, subject to } -{ the Mozilla Public License Version 1.1 (the "License"); you may } -{ not use this file except in compliance with the License. You may } -{ obtain a copy of the License at } -{ http://www.mozilla.org/MPL/MPL-1.1.html } -{ } -{ Software distributed under the License is distributed on an } -{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } -{ implied. See the License for the specific language governing } -{ rights and limitations under the License. } -{ } -{ Description } -{ ----------- } -{ } -{ } -{ } -{ } -{ } -{ } -{ } -{ Requires } -{ -------- } -{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } -{ They are available from... } -{ http://www.libsdl.org . } -{ } -{ Programming Notes } -{ ----------------- } -{ } -{ } -{ } -{ } -{ Revision History } -{ ---------------- } -{ September 23 2004 - DL : Initial Creation } -{ - $Log: userpreferences.pas,v $ - Revision 1.1 2004/09/30 22:35:47 savage - Changes, enhancements and additions as required to get SoAoS working. - - -} -{******************************************************************************} - -interface - -uses - Classes; - -type - TUserPreferences = class - private - FAutoSave: Boolean; - procedure CheckAutoSave; - protected - function GetDefaultBoolean( const Index : Integer ) : Boolean; virtual; abstract; - function GetBoolean( const Index : Integer ) : Boolean; virtual; abstract; - procedure SetBoolean( const Index : Integer; const Value : Boolean ); virtual; - function GetDefaultDateTime( const Index : Integer ) : TDateTime; virtual; abstract; - function GetDateTime( const Index : Integer ) : TDateTime; virtual; abstract; - procedure SetDateTime( const Index : Integer; const Value : TDateTime ); virtual; - function GetDefaultInteger( const Index : Integer ) : Integer; virtual; abstract; - function GetInteger( const Index : Integer ) : Integer; virtual; abstract; - procedure SetInteger( const Index : Integer; const Value : Integer ); virtual; - function GetDefaultFloat( const Index : Integer ) : single; virtual; abstract; - function GetFloat( const Index : Integer ) : single; virtual; abstract; - procedure SetFloat( const Index : Integer; const Value : single ); virtual; - function GetDefaultString( const Index : Integer ) : string; virtual; abstract; - function GetString( const Index : Integer ) : string; virtual; abstract; - procedure SetString( const Index : Integer; const Value : string ); virtual; - function GetDefaultBinaryStream( const Index : Integer ) : TStream; virtual; abstract; - function GetBinaryStream( const Index : Integer ) : TStream; virtual; abstract; - procedure SetBinaryStream( const Index : Integer; const Value : TStream ); virtual; - public - procedure Update; virtual; abstract; - constructor Create; virtual; - destructor Destroy; override; - property AutoSave : Boolean read FAutoSave write FAutoSave; - end; - -implementation - -{ TUserPreferences } -procedure TUserPreferences.CheckAutoSave; -begin - if FAutoSave then - Update; -end; - -constructor TUserPreferences.Create; -begin - inherited; - FAutoSave := false; -end; - -destructor TUserPreferences.Destroy; -begin - - inherited; -end; - -procedure TUserPreferences.SetBinaryStream( const Index : Integer; const Value : TStream ); -begin - CheckAutoSave; -end; - -procedure TUserPreferences.SetBoolean(const Index: Integer; const Value: Boolean); -begin - CheckAutoSave; -end; - -procedure TUserPreferences.SetDateTime(const Index: Integer; const Value: TDateTime); -begin - CheckAutoSave; -end; - -procedure TUserPreferences.SetFloat(const Index: Integer; const Value: single); -begin - CheckAutoSave; -end; - -procedure TUserPreferences.SetInteger(const Index, Value: Integer); -begin - CheckAutoSave; -end; - -procedure TUserPreferences.SetString(const Index: Integer; const Value: string); -begin - CheckAutoSave; -end; - -end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL_Image/Pas/sdl_image.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL_Image/Pas/sdl_image.pas deleted file mode 100644 index fecc0dbc..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/SDL_Image/Pas/sdl_image.pas +++ /dev/null @@ -1,287 +0,0 @@ -unit sdl_image; -{ - $Id: sdl_image.pas,v 1.7 2005/01/01 02:03:12 savage Exp $ - -} -{******************************************************************************} -{ } -{ Borland Delphi SDL_Image - An example image loading library for use } -{ with SDL } -{ Conversion of the Simple DirectMedia Layer Image Headers } -{ } -{ Portions created by Sam Lantinga are } -{ Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga } -{ 5635-34 Springhouse Dr. } -{ Pleasanton, CA 94588 (USA) } -{ } -{ All Rights Reserved. } -{ } -{ The original files are : SDL_image.h } -{ } -{ The initial developer of this Pascal code was : } -{ Matthias Thoma } -{ } -{ Portions created by Matthias Thoma are } -{ Copyright (C) 2000 - 2001 Matthias Thoma. } -{ } -{ } -{ Contributor(s) } -{ -------------- } -{ Dominique Louis } -{ } -{ Obtained through: } -{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } -{ } -{ You may retrieve the latest version of this file at the Project } -{ JEDI home page, located at http://delphi-jedi.org } -{ } -{ The contents of this file are used with permission, subject to } -{ the Mozilla Public License Version 1.1 (the "License"); you may } -{ not use this file except in compliance with the License. You may } -{ obtain a copy of the License at } -{ http://www.mozilla.org/MPL/MPL-1.1.html } -{ } -{ Software distributed under the License is distributed on an } -{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } -{ implied. See the License for the specific language governing } -{ rights and limitations under the License. } -{ } -{ Description } -{ ----------- } -{ A simple library to load images of various formats as SDL surfaces } -{ } -{ Requires } -{ -------- } -{ SDL.pas in your search path. } -{ } -{ Programming Notes } -{ ----------------- } -{ See the Aliens Demo on how to make use of this libaray } -{ } -{ Revision History } -{ ---------------- } -{ April 02 2001 - MT : Initial Translation } -{ } -{ May 08 2001 - DL : Added ExternalSym derectives and copyright header } -{ } -{ April 03 2003 - DL : Added jedi-sdl.inc include file to support more } -{ Pascal compilers. Initial support is now included } -{ for GnuPascal, VirtualPascal, TMT and obviously } -{ continue support for Delphi Kylix and FreePascal. } -{ } -{ April 08 2003 - MK : Aka Mr Kroket - Added Better FPC support } -{ } -{ April 24 2003 - DL : under instruction from Alexey Barkovoy, I have added} -{ better TMT Pascal support and under instruction } -{ from Prof. Abimbola Olowofoyeku (The African Chief),} -{ I have added better Gnu Pascal support } -{ } -{ April 30 2003 - DL : under instruction from David Mears AKA } -{ Jason Siletto, I have added FPC Linux support. } -{ This was compiled with fpc 1.1, so remember to set } -{ include file path. ie. -Fi/usr/share/fpcsrc/rtl/* } -{ } -{ - $Log: sdl_image.pas,v $ - Revision 1.7 2005/01/01 02:03:12 savage - Updated to v1.2.4 - - Revision 1.6 2004/08/14 22:54:30 savage - Updated so that Library name defines are correctly defined for MacOS X. - - Revision 1.5 2004/05/10 14:10:04 savage - Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ). - - Revision 1.4 2004/04/13 09:32:08 savage - Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary. - - Revision 1.3 2004/04/01 20:53:23 savage - Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site. - - Revision 1.2 2004/03/30 20:23:28 savage - Tidied up use of UNIX compiler directive. - - Revision 1.1 2004/02/14 23:35:42 savage - version 1 of sdl_image, sdl_mixer and smpeg. - - -} -{******************************************************************************} - -{$I jedi-sdl.inc} - -{$ALIGN ON} - -interface - -uses -{$IFDEF __GPC__} - gpc, -{$ENDIF} - sdl; - -const -{$IFDEF WIN32} - SDL_ImageLibName = 'SDL_Image.dll'; -{$ENDIF} - -{$IFDEF UNIX} -{$IFDEF DARWIN} - SDL_ImageLibName = 'libSDL_image.dylib'; -{$ELSE} - SDL_ImageLibName = 'libSDL_image.so'; -{$ENDIF} -{$ENDIF} - -{$IFDEF MACOS} - SDL_ImageLibName = 'SDL_image'; -{$ENDIF} - - // Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL - SDL_IMAGE_MAJOR_VERSION = 1; -{$EXTERNALSYM SDL_IMAGE_MAJOR_VERSION} - SDL_IMAGE_MINOR_VERSION = 2; -{$EXTERNALSYM SDL_IMAGE_MINOR_VERSION} - SDL_IMAGE_PATCHLEVEL = 4; -{$EXTERNALSYM SDL_IMAGE_PATCHLEVEL} - -{ This macro can be used to fill a version structure with the compile-time - version of the SDL_image library. } -procedure SDL_IMAGE_VERSION( var X : TSDL_Version ); -{$EXTERNALSYM SDL_IMAGE_VERSION} - -{ This function gets the version of the dynamically linked SDL_image library. - it should NOT be used to fill a version structure, instead you should - use the SDL_IMAGE_VERSION() macro. - } -function IMG_Linked_Version : PSDL_version; -external {$IFDEF __GPC__}name 'IMG_Linked_Version'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_Linked_Version} - -{ Load an image from an SDL data source. - The 'type' may be one of: "BMP", "GIF", "PNG", etc. - - If the image format supports a transparent pixel, SDL will set the - colorkey for the surface. You can enable RLE acceleration on the - surface afterwards by calling: - SDL_SetColorKey(image, SDL_RLEACCEL, image.format.colorkey); -} -function IMG_LoadTyped_RW(src: PSDL_RWops; freesrc: Integer; _type: PChar): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadTyped_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadTyped_RW} -{ Convenience functions } -function IMG_Load(const _file: PChar): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_Load'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_Load} -function IMG_Load_RW(src: PSDL_RWops; freesrc: Integer): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_Load_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_Load_RW} - -{ Invert the alpha of a surface for use with OpenGL - This function is now a no-op, and only provided for backwards compatibility. } -function IMG_InvertAlpha(_on: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_InvertAlpha'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_InvertAlpha} - -{ Functions to detect a file type, given a seekable source } -function IMG_isBMP(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isBMP'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isBMP} -function IMG_isPNM(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isPNM'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isPNM} -function IMG_isXPM(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isXPM'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isXPM} -function IMG_isXCF(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isXCF'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isXCF} -function IMG_isPCX(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isPCX'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isPCX} -function IMG_isGIF(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isGIF'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isGIF} -function IMG_isJPG(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isJPG'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isJPG} -function IMG_isTIF(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isTIF'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isTIF} -function IMG_isPNG(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isPNG'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isPNG} -function IMG_isLBM(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isLBM'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isLBM} - -{ Individual loading functions } -function IMG_LoadBMP_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadBMP_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadBMP_RW} -function IMG_LoadPNM_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadPNM_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadPNM_RW} -function IMG_LoadXPM_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadXPM_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadXPM_RW} -function IMG_LoadXCF_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadXCF_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadXCF_RW} -function IMG_LoadPCX_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadPCX_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadPCX_RW} -function IMG_LoadGIF_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadGIF_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadGIF_RW} -function IMG_LoadJPG_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadJPG_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadJPG_RW} -function IMG_LoadTIF_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadTIF_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadTIF_RW} -function IMG_LoadPNG_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadPNG_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadPNG_RW} -function IMG_LoadTGA_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadTGA_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadTGA_RW} -function IMG_LoadLBM_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadLBM_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadLBM_RW} - -{ used internally, NOT an exported function } -//function IMG_string_equals( const str1 : PChar; const str2 : PChar ) : integer; -//cdecl; external {$IFDEF __GPC__}name 'IMG_string_equals'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -//{ $ EXTERNALSYM IMG_string_equals} - -{ Error Macros } -{ We'll use SDL for reporting errors } -procedure IMG_SetError( fmt : PChar ); - -function IMG_GetError : PChar; - -implementation - -{$IFDEF __GPC__} - {$L 'sdl_image'} { link sdl_image.dll.a or libsdl_image.so or libsdl_image.a } -{$ENDIF} - -procedure SDL_IMAGE_VERSION( var X : TSDL_Version ); -begin - X.major := SDL_IMAGE_MAJOR_VERSION; - X.minor := SDL_IMAGE_MINOR_VERSION; - X.patch := SDL_IMAGE_PATCHLEVEL; -end; - -procedure IMG_SetError( fmt : PChar ); -begin - SDL_SetError( fmt ); -end; - -function IMG_GetError : PChar; -begin - result := SDL_GetError; -end; - -end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL_ttf/Pas/sdl_ttf.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL_ttf/Pas/sdl_ttf.pas deleted file mode 100644 index eea69719..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/SDL_ttf/Pas/sdl_ttf.pas +++ /dev/null @@ -1,451 +0,0 @@ -unit sdl_ttf; -{ - $Id: sdl_ttf.pas,v 1.10 2005/01/02 19:07:32 savage Exp $ - -} -{******************************************************************************} -{ } -{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } -{ Conversion of the Simple DirectMedia Layer Headers } -{ } -{ Portions created by Sam Lantinga are } -{ Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga } -{ 5635-34 Springhouse Dr. } -{ Pleasanton, CA 94588 (USA) } -{ } -{ All Rights Reserved. } -{ } -{ The original files are : SDL_ttf.h } -{ } -{ The initial developer of this Pascal code was : } -{ Dominqiue Louis } -{ } -{ Portions created by Dominqiue Louis are } -{ Copyright (C) 2000 - 2001 Dominqiue Louis. } -{ } -{ } -{ Contributor(s) } -{ -------------- } -{ Tom Jones His Project inspired this conversion } -{ } -{ Obtained through: } -{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } -{ } -{ You may retrieve the latest version of this file at the Project } -{ JEDI home page, located at http://delphi-jedi.org } -{ } -{ The contents of this file are used with permission, subject to } -{ the Mozilla Public License Version 1.1 (the "License"); you may } -{ not use this file except in compliance with the License. You may } -{ obtain a copy of the License at } -{ http://www.mozilla.org/MPL/MPL-1.1.html } -{ } -{ Software distributed under the License is distributed on an } -{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } -{ implied. See the License for the specific language governing } -{ rights and limitations under the License. } -{ } -{ Description } -{ ----------- } -{ } -{ } -{ } -{ } -{ } -{ } -{ } -{ Requires } -{ -------- } -{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } -{ They are available from... } -{ http://www.libsdl.org . } -{ } -{ Programming Notes } -{ ----------------- } -{ } -{ } -{ } -{ } -{ Revision History } -{ ---------------- } -{ December 08 2002 - DL : Fixed definition of TTF_RenderUnicode_Solid } -{ } -{ April 03 2003 - DL : Added jedi-sdl.inc include file to support more } -{ Pascal compilers. Initial support is now included } -{ for GnuPascal, VirtualPascal, TMT and obviously } -{ continue support for Delphi Kylix and FreePascal. } -{ } -{ April 24 2003 - DL : under instruction from Alexey Barkovoy, I have added} -{ better TMT Pascal support and under instruction } -{ from Prof. Abimbola Olowofoyeku (The African Chief),} -{ I have added better Gnu Pascal support } -{ } -{ April 30 2003 - DL : under instruction from David Mears AKA } -{ Jason Siletto, I have added FPC Linux support. } -{ This was compiled with fpc 1.1, so remember to set } -{ include file path. ie. -Fi/usr/share/fpcsrc/rtl/* } -{ } -{ - $Log: sdl_ttf.pas,v $ - Revision 1.10 2005/01/02 19:07:32 savage - Slight bug fix to use LongInt instead of Long ( Thanks Michalis Kamburelis ) - - Revision 1.9 2005/01/01 02:15:20 savage - Updated to v2.0.7 - - Revision 1.8 2004/10/07 21:02:32 savage - Fix for FPC - - Revision 1.7 2004/09/30 22:39:50 savage - Added a true type font class which contains a wrap text function. - Changed the sdl_ttf.pas header to reflect the future of jedi-sdl. - - Revision 1.6 2004/08/14 22:54:30 savage - Updated so that Library name defines are correctly defined for MacOS X. - - Revision 1.5 2004/05/10 14:10:04 savage - Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ). - - Revision 1.4 2004/04/13 09:32:08 savage - Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary. - - Revision 1.3 2004/04/01 20:53:24 savage - Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site. - - Revision 1.2 2004/03/30 20:23:28 savage - Tidied up use of UNIX compiler directive. - - Revision 1.1 2004/02/16 22:16:40 savage - v1.0 changes - - -} -{******************************************************************************} - -{$I jedi-sdl.inc} - -{$ALIGN ON} - -interface - -uses -{$IFDEF __GPC__} - gpc, -{$ENDIF} - -{$IFDEF WIN32} - {$IFNDEF __GPC__} - Windows, - {$ENDIF} -{$ENDIF} - sdl; - -const -{$IFDEF WIN32} - SDLttfLibName = 'SDL_ttf.dll'; -{$ENDIF} - -{$IFDEF UNIX} -{$IFDEF DARWIN} - SDLttfLibName = 'libSDL_ttf.dylib'; -{$ELSE} - SDLttfLibName = 'libSDL_ttf.so'; -{$ENDIF} -{$ENDIF} - -{$IFDEF MACOS} - SDLttfLibName = 'SDL_ttf'; -{$ENDIF} - - {* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL *} - SDL_TTF_MAJOR_VERSION = 2; -{$EXTERNALSYM SDL_TTF_MAJOR_VERSION} - SDL_TTF_MINOR_VERSION = 0; -{$EXTERNALSYM SDL_TTF_MINOR_VERSION} - SDL_TTF_PATCHLEVEL = 7; -{$EXTERNALSYM SDL_TTF_PATCHLEVEL} - - // Backwards compatibility - TTF_MAJOR_VERSION = SDL_TTF_MAJOR_VERSION; - TTF_MINOR_VERSION = SDL_TTF_MINOR_VERSION; - TTF_PATCHLEVEL = SDL_TTF_PATCHLEVEL; - -{* - Set and retrieve the font style - This font style is implemented by modifying the font glyphs, and - doesn't reflect any inherent properties of the truetype font file. -*} - TTF_STYLE_NORMAL = $00; - TTF_STYLE_BOLD = $01; - TTF_STYLE_ITALIC = $02; - TTF_STYLE_UNDERLINE = $04; - -// ZERO WIDTH NO-BREAKSPACE (Unicode byte order mark) - UNICODE_BOM_NATIVE = $FEFF; - UNICODE_BOM_SWAPPED = $FFFE; - -type - PTTF_Font = ^TTTF_font; - TTTF_Font = record - end; - -{ This macro can be used to fill a version structure with the compile-time - version of the SDL_ttf library. } -procedure SDL_TTF_VERSION( var X : TSDL_version ); -{$EXTERNALSYM SDL_TTF_VERSION} - -{ This function gets the version of the dynamically linked SDL_ttf library. - It should NOT be used to fill a version structure, instead you should use the - SDL_TTF_VERSION() macro. } -function TTF_Linked_Version : PSDL_version; -cdecl; external {$IFDEF __GPC__}name 'TTF_Linked_Version'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_Linked_Version} - -{ This function tells the library whether UNICODE text is generally - byteswapped. A UNICODE BOM character in a string will override - this setting for the remainder of that string. -} -procedure TTF_ByteSwappedUNICODE( swapped : integer ); -cdecl; external {$IFDEF __GPC__}name 'TTF_ByteSwappedUNICODE'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_ByteSwappedUNICODE} - -//returns 0 on succes, -1 if error occurs -function TTF_Init : integer; -cdecl; external {$IFDEF __GPC__}name 'TTF_Init'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_Init} - -{ - Open a font file and create a font of the specified point size. - Some .fon fonts will have several sizes embedded in the file, so the - point size becomes the index of choosing which size. If the value - is too high, the last indexed size will be the default. -} -function TTF_OpenFont( const filename : Pchar; ptsize : integer ) : PTTF_Font; -cdecl; external {$IFDEF __GPC__}name 'TTF_OpenFont'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_OpenFont} - -function TTF_OpenFontIndex( const filename : Pchar; ptsize : integer; index : Longint ): PTTF_Font; -cdecl; external {$IFDEF __GPC__}name 'TTF_OpenFontIndex'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_OpenFontIndex} - -function TTF_OpenFontRW( src : PSDL_RWops; freesrc : integer; ptsize : integer ): PTTF_Font; -cdecl; external {$IFDEF __GPC__}name 'TTF_OpenFontRW'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_OpenFontRW} - -function TTF_OpenFontIndexRW( src : PSDL_RWops; freesrc : integer; ptsize : integer; index : Longint ): PTTF_Font; -cdecl; external {$IFDEF __GPC__}name 'TTF_OpenFontIndexRW'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_OpenFontIndexRW} - -function TTF_GetFontStyle( font : PTTF_Font) : integer; -cdecl; external {$IFDEF __GPC__}name 'TTF_GetFontStyle'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_GetFontStyle} - -procedure TTF_SetFontStyle( font : PTTF_Font; style : integer ); -cdecl; external {$IFDEF __GPC__}name 'TTF_SetFontStyle'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_SetFontStyle} - -{ Get the total height of the font - usually equal to point size } -function TTF_FontHeight( font : PTTF_Font ) : Integer; -cdecl; external {$IFDEF __GPC__}name 'TTF_FontHeight'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_FontHeight} - -{ Get the offset from the baseline to the top of the font - This is a positive value, relative to the baseline. -} -function TTF_FontAscent( font : PTTF_Font ) : Integer; -cdecl; external {$IFDEF __GPC__}name 'TTF_FontAscent'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_FontAscent} -{ Get the offset from the baseline to the bottom of the font - This is a negative value, relative to the baseline. -} -function TTF_FontDescent( font : PTTF_Font ) : Integer; -cdecl; external {$IFDEF __GPC__}name 'TTF_FontDescent'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_FontDescent} - -{ Get the recommended spacing between lines of text for this font } -function TTF_FontLineSkip( font : PTTF_Font ): Integer; -cdecl; external {$IFDEF __GPC__}name 'TTF_FontLineSkip'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_FontLineSkip} - -{ Get the number of faces of the font } -function TTF_FontFaces( font : PTTF_Font ) : Longint; -cdecl; external {$IFDEF __GPC__}name 'TTF_FontFaces'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_FontFaces} - -{ Get the font face attributes, if any } -function TTF_FontFaceIsFixedWidth( font : PTTF_Font ): Integer; -cdecl; external {$IFDEF __GPC__}name 'TTF_FontFaceIsFixedWidth'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_FontFaceIsFixedWidth} - -function TTF_FontFaceFamilyName( font : PTTF_Font ): PChar; -cdecl; external {$IFDEF __GPC__}name 'TTF_FontFaceFamilyName'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_FontFaceFamilyName} - -function TTF_FontFaceStyleName( font : PTTF_Font ): PChar; -cdecl; external {$IFDEF __GPC__}name 'TTF_FontFaceStyleName'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_FontFaceStyleName} - -{ Get the metrics (dimensions) of a glyph } -function TTF_GlyphMetrics( font : PTTF_Font; ch : Uint16; - var minx : integer; var maxx : integer; - var miny : integer; var maxy : integer; - var advance : integer ): Integer; -cdecl; external {$IFDEF __GPC__}name 'TTF_GlyphMetrics'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_GlyphMetrics} - -{ Get the dimensions of a rendered string of text } -function TTF_SizeText( font : PTTF_Font; const text : PChar; var w : integer; var y : integer ): Integer; -cdecl; external {$IFDEF __GPC__}name 'TTF_SizeText'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_SizeText} - -function TTF_SizeUTF8( font : PTTF_Font; const text : PChar; var w : integer; var y : integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'TTF_SizeUTF8'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_SizeUTF8} - -function TTF_SizeUNICODE( font : PTTF_Font; const text : PUint16; var w : integer; var y : integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'TTF_SizeUNICODE'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_SizeUNICODE} - -{ Create an 8-bit palettized surface and render the given text at - fast quality with the given font and color. The 0 pixel is the - colorkey, giving a transparent background, and the 1 pixel is set - to the text color. - This function returns the new surface, or NULL if there was an error. -} -function TTF_RenderText_Solid( font : PTTF_Font; - const text : PChar; fg : TSDL_Color ): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'TTF_RenderText_Solid'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_RenderText_Solid} - -function TTF_RenderUTF8_Solid( font : PTTF_Font; - const text : PChar; fg : TSDL_Color ): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'TTF_RenderUTF8_Solid'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_RenderUTF8_Solid} - -function TTF_RenderUNICODE_Solid( font : PTTF_Font; - const text :PUint16; fg : TSDL_Color ): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'TTF_RenderUNICODE_Solid'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_RenderUNICODE_Solid} - -{ -Create an 8-bit palettized surface and render the given glyph at - fast quality with the given font and color. The 0 pixel is the - colorkey, giving a transparent background, and the 1 pixel is set - to the text color. The glyph is rendered without any padding or - centering in the X direction, and aligned normally in the Y direction. - This function returns the new surface, or NULL if there was an error. -} -function TTF_RenderGlyph_Solid( font : PTTF_Font; - ch : Uint16; fg : TSDL_Color ): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'TTF_RenderGlyph_Solid'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_RenderGlyph_Solid} - -{ Create an 8-bit palettized surface and render the given text at - high quality with the given font and colors. The 0 pixel is background, - while other pixels have varying degrees of the foreground color. - This function returns the new surface, or NULL if there was an error. -} -function TTF_RenderText_Shaded( font : PTTF_Font; - const text : PChar; fg : TSDL_Color; bg : TSDL_Color ): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'TTF_RenderText_Shaded'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_RenderText_Shaded} -function TTF_RenderUTF8_Shaded( font : PTTF_Font; - const text : PChar; fg : TSDL_Color; bg : TSDL_Color ): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'TTF_RenderUTF8_Shaded'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_RenderUTF8_Shaded} -function TTF_RenderUNICODE_Shaded( font : PTTF_Font; - const text : PUint16; fg : TSDL_Color; bg : TSDL_Color ): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'TTF_RenderUNICODE_Shaded'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_RenderUNICODE_Shaded} - -{ Create an 8-bit palettized surface and render the given glyph at - high quality with the given font and colors. The 0 pixel is background, - while other pixels have varying degrees of the foreground color. - The glyph is rendered without any padding or centering in the X - direction, and aligned normally in the Y direction. - This function returns the new surface, or NULL if there was an error. -} -function TTF_RenderGlyph_Shaded( font : PTTF_Font; ch : Uint16; fg : TSDL_Color; - bg : TSDL_Color ): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'TTF_RenderGlyph_Shaded'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_RenderGlyph_Shaded} - -{ Create a 32-bit ARGB surface and render the given text at high quality, - using alpha blending to dither the font with the given color. - This function returns the new surface, or NULL if there was an error. -} -function TTF_RenderText_Blended( font : PTTF_Font; - const text : PChar; fg : TSDL_Color ): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'TTF_RenderText_Blended'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_RenderText_Blended} -function TTF_RenderUTF8_Blended( font : PTTF_Font; - const text : PChar; fg : TSDL_Color ): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'TTF_RenderUTF8_Blended'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_RenderUTF8_Blended} -function TTF_RenderUNICODE_Blended( font : PTTF_Font; - const text: PUint16; fg : TSDL_Color ): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'TTF_RenderUNICODE_Blended'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_RenderUNICODE_Blended} - -{ Create a 32-bit ARGB surface and render the given glyph at high quality, - using alpha blending to dither the font with the given color. - The glyph is rendered without any padding or centering in the X - direction, and aligned normally in the Y direction. - This function returns the new surface, or NULL if there was an error. -} -function TTF_RenderGlyph_Blended( font : PTTF_Font; ch : Uint16; fg : TSDL_Color ): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'TTF_RenderGlyph_Blended'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_RenderGlyph_Blended} - -{ For compatibility with previous versions, here are the old functions } -{#define TTF_RenderText(font, text, fg, bg) - TTF_RenderText_Shaded(font, text, fg, bg) -#define TTF_RenderUTF8(font, text, fg, bg) - TTF_RenderUTF8_Shaded(font, text, fg, bg) -#define TTF_RenderUNICODE(font, text, fg, bg) - TTF_RenderUNICODE_Shaded(font, text, fg, bg)} - -{ Close an opened font file } -procedure TTF_CloseFont( font : PTTF_Font ); -cdecl; external {$IFDEF __GPC__}name 'TTF_CloseFont'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_CloseFont} - -//De-initialize TTF engine -procedure TTF_Quit; -cdecl; external {$IFDEF __GPC__}name 'TTF_Quit'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_Quit} - -// Check if the TTF engine is initialized -function TTF_WasInit : integer; -cdecl; external {$IFDEF __GPC__}name 'TTF_WasInit'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; -{$EXTERNALSYM TTF_WasInit} - -// We'll use SDL for reporting errors -procedure TTF_SetError( fmt : PChar ); - -function TTF_GetError : PChar; - -implementation - -{$IFDEF __GPC__} - {$L 'sdl_ttf'} { link sdl_ttf.dll.a or libsdl_ttf.so or libsdl_ttf.a } -{$ENDIF} - -procedure SDL_TTF_VERSION( var X : TSDL_version ); -begin - X.major := SDL_TTF_MAJOR_VERSION; - X.minor := SDL_TTF_MINOR_VERSION; - X.patch := SDL_TTF_PATCHLEVEL; -end; - -procedure TTF_SetError( fmt : PChar ); -begin - SDL_SetError( fmt ); -end; - -function TTF_GetError : PChar; -begin - result := SDL_GetError; -end; - -end. diff --git a/Game/Code/lib/JEDI-SDLv1.0/SDL_ttf/Pas/sdltruetypefont.pas b/Game/Code/lib/JEDI-SDLv1.0/SDL_ttf/Pas/sdltruetypefont.pas deleted file mode 100644 index 4b53ddd9..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/SDL_ttf/Pas/sdltruetypefont.pas +++ /dev/null @@ -1,437 +0,0 @@ -unit sdltruetypefont; -{ - $Id: sdltruetypefont.pas,v 1.1 2004/09/30 22:39:50 savage Exp $ - -} -{******************************************************************************} -{ } -{ JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer } -{ Wrapper class for SDL_ttf } -{ } -{ The initial developer of this Pascal code was : } -{ Dominqiue Louis } -{ } -{ Portions created by Dominqiue Louis are } -{ Copyright (C) 2000 - 2001 Dominqiue Louis. } -{ } -{ } -{ Contributor(s) } -{ -------------- } -{ } -{ } -{ Obtained through: } -{ Joint Endeavour of Delphi Innovators ( Project JEDI ) } -{ } -{ You may retrieve the latest version of this file at the Project } -{ JEDI home page, located at http://delphi-jedi.org } -{ } -{ The contents of this file are used with permission, subject to } -{ the Mozilla Public License Version 1.1 (the "License"); you may } -{ not use this file except in compliance with the License. You may } -{ obtain a copy of the License at } -{ http://www.mozilla.org/MPL/MPL-1.1.html } -{ } -{ Software distributed under the License is distributed on an } -{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or } -{ implied. See the License for the specific language governing } -{ rights and limitations under the License. } -{ } -{ Description } -{ ----------- } -{ } -{ } -{ } -{ } -{ } -{ } -{ } -{ Requires } -{ -------- } -{ The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so } -{ They are available from... } -{ http://www.libsdl.org . } -{ } -{ Programming Notes } -{ ----------------- } -{ } -{ } -{ } -{ } -{ Revision History } -{ ---------------- } -{ September 23 2004 - DL : Initial Creation } -{ - $Log: sdltruetypefont.pas,v $ - Revision 1.1 2004/09/30 22:39:50 savage - Added a true type font class which contains a wrap text function. - Changed the sdl_ttf.pas header to reflect the future of jedi-sdl. - - -} -{******************************************************************************} - -interface - -uses - sdl, - sdl_ttf; - -type - TRenderType = ( rtLatin1, rtUTF8, rtUnicode ); - TSDLFontStyle = ( fsBold, fsItalic, fsUnderline, fsStrikeOut ); - - TSDLFontStyles = set of TSDLFontStyle; - - TTrueTypeFont = class( TObject ) - private - FFont : PTTF_Font; - FSolid : Boolean; - FBackGroundColour : TSDL_Color; - FForeGroundColour : TSDL_Color; - FRenderType : TRenderType; - FStyle : TSDLFontStyles; - FFontFile : string; - FFontSize : integer; - procedure PrepareFont; - protected - - public - constructor Create( aFontFile : string; aRenderStyle : TSDLFontStyles = [ ]; aFontSize : integer = 14 ); - destructor Destroy; override; - function DrawText( aText : WideString ) : PSDL_Surface; overload; - function DrawText( aText : WideString; aWidth, aHeight : Integer ) : PSDL_Surface; overload; - property BackGroundColour : TSDL_Color read FBackGroundColour write FBackGroundColour; - property ForeGroundColour : TSDL_Color read FForeGroundColour write FForeGroundColour; - property FontFile : string read FFontFile write FFontFile; - property RenderType : TRenderType read FRenderType write FRenderType; - property Solid : Boolean read FSolid write FSolid; - property Style : TSDLFontStyles read FStyle write FStyle; - property FontSize : integer read FFontSize write FFontSize; - end; - - -implementation - -uses - SysUtils; - -{ TTrueTypeFont } - -constructor TTrueTypeFont.Create( aFontFile : string; aRenderStyle : TSDLFontStyles; aFontSize : integer ); -begin - inherited Create; - if FileExists( aFontFile ) then - begin - FStyle := aRenderStyle; - FFontSize := aFontSize; - FSolid := false; - FBackGroundColour.r := 255; - FBackGroundColour.g := 255; - FBackGroundColour.b := 255; - FForeGroundColour.r := 0; - FForeGroundColour.g := 0; - FForeGroundColour.b := 0; - FRenderType := rtUTF8; - if ( TTF_Init >= 0 ) then - begin - FFontFile := aFontFile; - end - else - raise Exception.Create( 'Failed to Initialiase SDL_TTF' ); - end - else - raise Exception.Create( 'Font File does not exist' ); -end; - -destructor TTrueTypeFont.Destroy; -begin - if FFont <> nil then - TTF_CloseFont( FFont ); - TTF_Quit; - inherited; -end; - -function TTrueTypeFont.DrawText( aText : WideString ) : PSDL_Surface; -begin - PrepareFont; - - result := nil; - - case FRenderType of - rtLatin1 : - begin - if ( FSolid ) then - begin - result := TTF_RenderText_Solid( FFont, PChar( string( aText ) ), FForeGroundColour ); - end - else - begin - result := TTF_RenderText_Shaded( FFont, PChar( string( aText ) ), FForeGroundColour, FBackGroundColour ); - end; - end; - - rtUTF8 : - begin - if ( FSolid ) then - begin - result := TTF_RenderUTF8_Solid( FFont, PChar( string( aText ) ), FForeGroundColour ); - end - else - begin - result := TTF_RenderUTF8_Shaded( FFont, PChar( string( aText ) ), FForeGroundColour, FBackGroundColour ); - end; - end; - - rtUnicode : - begin - if ( FSolid ) then - begin - result := TTF_RenderUNICODE_Solid( FFont, PUInt16( aText ), FForeGroundColour ); - end - else - begin - result := TTF_RenderUNICODE_Shaded( FFont, PUInt16( aText ), FForeGroundColour, FBackGroundColour ); - end; - end; - end; -end; - -function TTrueTypeFont.DrawText( aText : WideString; aWidth, aHeight : Integer ) : PSDL_Surface; -var - textw, texth, i, yPos : integer; - strChopped : WideString; - SurfaceList : array of PSDL_Surface; - strlist : array of WideString; - ReturnedSurface : PSDL_Surface; - BltRect : TSDL_Rect; -begin - PrepareFont; - - // Do an initial check to see if it already fits - case FRenderType of - rtLatin1 : - begin - if TTF_SizeText( FFont, PChar( string( aText ) ), textw, texth ) = 0 then - begin - if ( textw < aWidth ) - and ( texth < aHeight ) then - begin - result := DrawText( aText ); - exit; - end - end; - end; - - rtUTF8 : - begin - if TTF_SizeUTF8( FFont, PChar( string( aText ) ), textw, texth ) = 0 then - begin - if ( textw < aWidth ) - and ( texth < aHeight ) then - begin - result := DrawText( aText ); - exit; - end - end; - end; - - rtUnicode : - begin - if TTF_SizeUNICODE( FFont, PUInt16( aText ), textw, texth ) = 0 then - begin - if ( textw < aWidth ) - and ( texth < aHeight ) then - begin - result := DrawText( aText ); - exit; - end - end; - end; - end; - - // Create the Surface we will be returning - ReturnedSurface := SDL_DisplayFormat( SDL_CreateRGBSurface( SDL_SRCCOLORKEY or SDL_RLEACCEL or SDL_HWACCEL, aWidth, aHeight, 16, 0, 0, 0, 0 ) ); - - // If we are still here there is some serious parsing to do - case FRenderType of - rtLatin1 : - begin - strChopped := aText; - i := Length( strChopped ); - while ( i <> 0 ) do - begin - if ( string( strChopped[ i ] ) <> ' ' ) and ( Integer( string( strChopped[ i ] ) ) <> 13 ) then - dec( i ) - else - begin - dec( i ); - strChopped := Copy( strChopped, 0, i ); - if TTF_SizeText( FFont, PChar( string( strChopped ) ), textw, texth ) = 0 then - begin - if ( textw < aWidth ) - and ( texth < aHeight ) then - begin - SetLength( strlist, Length( strlist ) + 1 ); - strlist[ Length( strlist ) - 1 ] := strChopped; - strChopped := Copy( aText, i + 2, Length( aText ) - ( i - 1 ) ); - i := Length( strChopped ); - if TTF_SizeText( FFont, PChar( string( strChopped ) ), textw, texth ) = 0 then - begin - SetLength( strlist, Length( strlist ) + 1 ); - strlist[ Length( strlist ) - 1 ] := strChopped; - break; - end; - end; - end; - end; - end; - SetLength( SurfaceList, Length( strlist ) ); - for i := Low( strlist ) to High( strlist ) do - begin - if ( FSolid ) then - begin - SurfaceList[ i ] := TTF_RenderText_Solid( FFont, PChar( string( strlist[ i ] ) ), FForeGroundColour ); - end - else - begin - SurfaceList[ i ] := TTF_RenderText_Shaded( FFont, PChar( string( strlist[ i ] ) ), FForeGroundColour, FBackGroundColour ); - end; - end; - end; - - rtUTF8 : - begin - strChopped := aText; - i := Length( strChopped ); - while ( i <> 0 ) do - begin - if ( string( strChopped[ i ] ) <> ' ' ) and ( Integer( string( strChopped[ i ] ) ) <> 13 ) then - dec( i ) - else - begin - dec( i ); - strChopped := Copy( strChopped, 0, i ); - if TTF_SizeUTF8( FFont, PChar( string( strChopped ) ), textw, texth ) = 0 then - begin - if ( textw < aWidth ) - and ( texth < aHeight ) then - begin - SetLength( strlist, Length( strlist ) + 1 ); - strlist[ Length( strlist ) - 1 ] := strChopped; - strChopped := Copy( aText, i + 2, Length( aText ) - ( i - 1 ) ); - i := Length( strChopped ); - if TTF_SizeUTF8( FFont, PChar( string( strChopped ) ), textw, texth ) = 0 then - begin - SetLength( strlist, Length( strlist ) + 1 ); - strlist[ Length( strlist ) - 1 ] := strChopped; - break; - end; - end; - end; - end; - end; - SetLength( SurfaceList, Length( strlist ) ); - for i := Low( strlist ) to High( strlist ) do - begin - if ( FSolid ) then - begin - SurfaceList[ i ] := TTF_RenderUTF8_Solid( FFont, PChar( string( strlist[ i ] ) ), FForeGroundColour ); - end - else - begin - SurfaceList[ i ] := TTF_RenderUTF8_Shaded( FFont, PChar( string( strlist[ i ] ) ), FForeGroundColour, FBackGroundColour ); - end; - end; - end; - - rtUnicode : - begin - strChopped := aText; - i := Length( strChopped ); - while ( i <> 0 ) do - begin - if ( string( strChopped[ i ] ) <> ' ' ) and ( Integer( string( strChopped[ i ] ) ) <> 13 ) then - dec( i ) - else - begin - dec( i ); - strChopped := Copy( strChopped, 0, i ); - if TTF_SizeUNICODE( FFont, PUInt16( strChopped ), textw, texth ) = 0 then - begin - if ( textw < aWidth ) - and ( texth < aHeight ) then - begin - SetLength( strlist, Length( strlist ) + 1 ); - strlist[ Length( strlist ) - 1 ] := strChopped; - strChopped := Copy( aText, i + 2, Length( aText ) - ( i - 1 ) ); - i := Length( strChopped ); - if TTF_SizeUNICODE( FFont, PUInt16( strChopped ), textw, texth ) = 0 then - begin - SetLength( strlist, Length( strlist ) + 1 ); - strlist[ Length( strlist ) - 1 ] := strChopped; - break; - end; - end; - end; - end; - end; - SetLength( SurfaceList, Length( strlist ) ); - for i := Low( strlist ) to High( strlist ) do - begin - if ( FSolid ) then - begin - SurfaceList[ i ] := TTF_RenderUNICODE_Solid( FFont, PUInt16( strlist[ i ] ), FForeGroundColour ); - end - else - begin - SurfaceList[ i ] := TTF_RenderUNICODE_Shaded( FFont, PUInt16( strlist[ i ] ), FForeGroundColour, FBackGroundColour ); - end; - end; - end; - end; - - // Now Draw the SurfaceList onto the resulting Surface - yPos := 6; - for i := Low( SurfaceList ) to High( SurfaceList ) do - begin - BltRect.x := 6; - BltRect.y := yPos; - BltRect.w := SurfaceList[ i ].w; - BltRect.h := SurfaceList[ i ].h; - SDL_BlitSurface( SurfaceList[ i ], nil, ReturnedSurface, @BltRect ); - yPos := yPos + TTF_FontHeight( FFont ); - end; - result := ReturnedSurface; - - for i := Low( SurfaceList ) to High( SurfaceList ) do - begin - SDL_FreeSurface( SurfaceList[ i ] ); - end; - SetLength( SurfaceList, 0 ); - SetLength( strlist, 0 ); -end; - -procedure TTrueTypeFont.PrepareFont; -var - renderstyle : integer; -begin - if FFont <> nil then - TTF_CloseFont( FFont ); - - FFont := TTF_OpenFont( PChar( FFontFile ), FFontSize ); - - renderstyle := TTF_STYLE_NORMAL; - if ( fsBold in FStyle ) then - renderstyle := renderstyle or TTF_STYLE_BOLD; - - if ( fsItalic in FStyle ) then - renderstyle := renderstyle or TTF_STYLE_ITALIC; - - if ( fsUnderline in FStyle ) then - renderstyle := renderstyle or TTF_STYLE_UNDERLINE; - - TTF_SetFontStyle( FFont, renderstyle ); -end; - -end. - diff --git a/Game/Code/lib/JEDI-SDLv1.0/fpc-install.sh b/Game/Code/lib/JEDI-SDLv1.0/fpc-install.sh deleted file mode 100644 index ea6c4928..00000000 --- a/Game/Code/lib/JEDI-SDLv1.0/fpc-install.sh +++ /dev/null @@ -1,252 +0,0 @@ -#!/bin/sh -# -# FreePascal & Delphi Installation script for JEDI-SDL -# portions of which are based on the FreePascal install script -# Copyright 1996-2002 Michael Van Canneyt and Peter Vreman -# -# Copyright (c)2004-2100, JEDI-SDL Team -# All Rights Reserved -# -# Don NOT edit this file. -# Everything should be configuration while the script is running. -# -############################################################################ - -# Release Version -VERSION=1.0 - -# some useful functions -# ask displays 1st parameter, and ask new value for variable, whose name is -# in the second parameter. -ask () -{ -askvar=$2 -eval old=\$$askvar -eval echo -n \""$1 [$old] : "\" -read $askvar -eval test -z \"\$$askvar\" && eval $askvar=\'$old\' -} -# yesno gives 1 on no, 0 on yes $1 gives text to display. -yesno () -{ - while true; do - echo -n "$1 (Y/n) ? " - read ans - case X$ans in - X|Xy|XY) return 0;; - Xn|XN) return 1;; - esac - done -} - -# Untar files ($3,optional) from file ($1) to the given directory ($2) -unztar () -{ - tar -xzf $HERE/$1 --directory $2 $3 -} - -# Untar tar.gz file ($2) from file ($1) and untar result to the given directory ($3) -unztarfromtar () -{ - tar -xOf $HERE/$1 $2 | tar --directory $3 -xzf - -} -# Get file list from tar archive ($1) in variable ($2) -# optionally filter result through sed ($3) -listtarfiles () -{ - askvar=$2 - if [ ! -z $3 ]; then - list=`tar tvf $1 | awk '{ print $(NF) }' | sed -n /$3/p` - else - list=`tar tvf $1 | awk '{ print $(NF) }'` - fi - eval $askvar='$list' -} -# Make all the necessary directories to get $1 -makedirhierarch () -{ - OLDDIR=`pwd` - case $1 in - /*) cd /;; - esac - OLDIFS=$IFS;IFS=/;eval set $1; IFS=$OLDIFS - for i - do - test -d $i || mkdir $i || break - cd $i ||break - done - cd $OLDDIR -} - -# check to see if something is in the path -checkpath () -{ - ARG=$1 - OLDIFS=$IFS; IFS=":";eval set $PATH;IFS=$OLDIFS - for i - do - if [ $i = $ARG ]; then - return 0 - fi - done - return 1 -} - -# -------------------------------------------------------------------------- -# welcome message. -# - -clear -echo "This shell script will attempt to install the Free Pascal Compiler" -echo "version $VERSION with the items you select" -echo - -# Here we start the thing. -HERE=`pwd` - -# Install in /usr/local or /usr ? -if checkpath /usr/local/bin; then - PREFIX=/usr/local -else - PREFIX=/usr -fi -# If we can't write on prefix, select subdir of home dir -if [ ! -w $PREFIX ]; then - PREFIX=$HOME/JEDI-SDLv$VERSION -fi -ask "Install prefix (/usr or /usr/local) " PREFIX -makedirhierarch $PREFIX - -# Set some defaults. -LIBDIR=$PREFIX/lib/JEDI-SDL/$VERSION -SRCDIR=$PREFIX/src/JEDI-SDLv$VERSION -EXECDIR=$PREFIX/bin -OSNAME=`uname -s | tr A-Z a-z` - -BSDHIER=0 -case $OSNAME in -*bsd) - BSDHIER=1;; -esac - - -if [ "${BSDHIER}" = "1" ]; then -DOCDIR=$PREFIX/share/doc/JEDI-SDLv$VERSION -else -DOCDIR=$PREFIX/doc/JEDI-SDLv$VERSION -fi - -echo $DOCDIR - -DEMODIR=$PREFIX/demos - -# Install SDL headers -if yesno "Install SDL headers"; then - -fi - -# Install SDL_image headers -if yesno "Install SDL_image headers"; then - -fi - -# Install compiler/RTL. Mandatory. -echo Installing compiler and RTL ... -unztarfromtar binary.tar base${OSNAME}.tar.gz $PREFIX -rm -f $EXECDIR/ppc386 -ln -sf $LIBDIR/ppc386 $EXECDIR/ppc386 -echo Installing utilities... -unztarfromtar binary.tar util${OSNAME}.tar.gz $PREFIX -if yesno "Install FCL"; then - unztarfromtar binary.tar unitsfcl${OSNAME}.tar.gz $PREFIX -fi -if yesno "Install packages"; then - listtarfiles binary.tar packages units - for f in $packages - do - if [ $f != unitsfcl${OSNAME}.tar.gz ]; then - basename $f .tar.gz |\ - sed -e s/units// -e s/${OSNAME}// |\ - xargs echo Installing - unztarfromtar binary.tar $f $PREFIX - fi - done -fi -rm -f *${OSNAME}.tar.gz -echo Done. -echo - -# Install the sources. Optional. -if yesno "Install sources"; then - echo Installing sources in $SRCDIR ... - unztarfromtar sources.tar basesrc.tar.gz $PREFIX - if yesno "Install compiler source"; then - unztarfromtar sources.tar compilersrc.tar.gz $PREFIX - fi - if yesno "Install RTL source"; then - unztarfromtar sources.tar rtlsrc.tar.gz $PREFIX - fi - if yesno "Install FCL source"; then - unztarfromtar sources.tar fclsrc.tar.gz $PREFIX - fi - if yesno "Install IDE source"; then - unztarfromtar sources.tar idesrc.tar.gz $PREFIX - fi - if yesno "Install installer source"; then - unztarfromtar sources.tar installersrc.tar.gz $PREFIX - fi - if yesno "Install Packages source"; then - listtarfiles sources.tar packages units - for f in $packages - do - basename $f .tar.gz |\ - sed -e s/units// -e s/src// |\ - xargs echo Installing sources for - unztarfromtar sources.tar $f $PREFIX - done - fi - # rm -f *src.tar.gz - echo Done. -fi -echo - -# Install the documentation. Optional. -if yesno "Install documentation"; then - echo Installing documentation in $DOCDIR ... - unztar docs.tar.gz $DOCDIR - echo Done. -fi -echo - -# Install the demos. Optional. -if yesno "Install demos"; then - ask "Install demos in" DEMODIR - echo Installing demos in $DEMODIR ... - makedirhierarch $DEMODIR - unztar demo.tar.gz $DEMODIR - echo Done. -fi -echo - -# update fpc.cfg file -if yesno "Update fpc.cfg file automagically"; then - echo Updating fpc.cfg in $DOCDIR ... - echo - echo Done. -fi - -# update Borland IDE file -if yesno "Update the Kylix IDE automagically"; then - echo Updating the Kylix IDE in $DOCDIR ... - echo - echo Done. -fi - -$LIBDIR/samplecfg $LIBDIR - -# The End -echo -echo End of installation. -echo -echo Refer to the documentation for more information. -echo \ No newline at end of file -- cgit v1.2.3 From c4eae67bc403eb26af8a1c91f9eb67dc92a8b4b6 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 5 Feb 2008 11:40:45 +0000 Subject: updated to latest version of JEDI SDL JEDI-SDL v1.0 Final RC ( 2008-01-29 05:46 ) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@811 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/JEDI-SDL/JEDI-SDL-README.txt | 4 +- Game/Code/lib/JEDI-SDL/OpenGL/Pas/gl.pas | 735 +++--- Game/Code/lib/JEDI-SDL/OpenGL/Pas/glext.pas | 2771 ++++++++++++++------ Game/Code/lib/JEDI-SDL/OpenGL/Pas/glu.pas | 543 ++-- Game/Code/lib/JEDI-SDL/OpenGL/Pas/glut.pas | 242 +- Game/Code/lib/JEDI-SDL/OpenGL/Pas/glx.pas | 12 +- Game/Code/lib/JEDI-SDL/SDL/Pas/jedi-sdl.inc | 129 +- Game/Code/lib/JEDI-SDL/SDL/Pas/libxmlparser.pas | 2 - Game/Code/lib/JEDI-SDL/SDL/Pas/logger.pas | 17 +- Game/Code/lib/JEDI-SDL/SDL/Pas/sdl.pas | 679 +++-- .../Code/lib/JEDI-SDL/SDL/Pas/sdlgameinterface.pas | 19 +- Game/Code/lib/JEDI-SDL/SDL/Pas/sdlticks.pas | 99 +- Game/Code/lib/JEDI-SDL/SDL/Pas/sdlutils.pas | 1053 ++++---- Game/Code/lib/JEDI-SDL/SDL/Pas/sdlwindow.pas | 42 +- Game/Code/lib/JEDI-SDL/SDL_Image/Pas/sdl_image.pas | 148 +- Game/Code/lib/JEDI-SDL/SDL_ttf/Pas/sdl_ttf.pas | 68 +- .../lib/JEDI-SDL/SDL_ttf/Pas/sdltruetypefont.pas | 180 +- 17 files changed, 4253 insertions(+), 2490 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/lib/JEDI-SDL/JEDI-SDL-README.txt b/Game/Code/lib/JEDI-SDL/JEDI-SDL-README.txt index 968c5311..a068e943 100644 --- a/Game/Code/lib/JEDI-SDL/JEDI-SDL-README.txt +++ b/Game/Code/lib/JEDI-SDL/JEDI-SDL-README.txt @@ -19,11 +19,13 @@ Both documents can be found in the "documentation" directory. Release History --------------- 1.0 : Yeah!! The Official v1.0 Release of JEDI-SDL!! - JEDI-SDL now updated to SDL v1.2.8, SDL_Image v1.2.4, SDL_Mixer v1.2.6, SDL_Net v1.2.1 & SDL_ttf v2.0.7 + JEDI-SDL now updated to SDL v1.2.11, SDL_Image v1.2.5, SDL_Mixer v1.2.7, SDL_Net v1.2.6 & SDL_ttf v2.0.8 Added Improved FreePascal, TMT Pascal and GnuPascal support as well as maintaining Delphi/Kylix support. Fixed Various bugs as pointed out on the JEDI-SDL mailing list. Added SDL_GL_STEREO, SDL_GL_MULTISAMPLEBUFFERS, SDL_GL_MULTISAMPLESAMPLES +Now works on MacOS X and a MacOS X disk image is available for download. + // DLL/Shared object functions function SDL_LoadObject( const sofile : PChar ) : Pointer; diff --git a/Game/Code/lib/JEDI-SDL/OpenGL/Pas/gl.pas b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/gl.pas index aa0dd169..d2bdcf8b 100644 --- a/Game/Code/lib/JEDI-SDL/OpenGL/Pas/gl.pas +++ b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/gl.pas @@ -1,6 +1,6 @@ unit gl; { - $Id: gl.pas,v 1.2 2004/08/14 22:54:30 savage Exp $ + $Id: gl.pas,v 1.5 2007/05/20 20:28:31 savage Exp $ Adaption of the delphi3d.net OpenGL units to FreePascal Sebastian Guenther (sg@freepascal.org) in 2002 @@ -52,6 +52,15 @@ Abstract: { $Log: gl.pas,v $ + Revision 1.5 2007/05/20 20:28:31 savage + Initial Changes to Handle 64 Bits + + Revision 1.4 2006/11/20 21:20:59 savage + Updated to work in MacOS X + + Revision 1.3 2005/05/22 18:52:09 savage + Changes as suggested by Michalis Kamburelis. Thanks again. + Revision 1.2 2004/08/14 22:54:30 savage Updated so that Library name defines are correctly defined for MacOS X. @@ -85,7 +94,7 @@ uses gpc, {$ENDIF} -{$IFDEF WIN32} +{$IFDEF WINDOWS} Windows, {$ENDIF} moduleloader; @@ -114,13 +123,13 @@ type {******************************************************************************} const -{$IFDEF WIN32} +{$IFDEF WINDOWS} GLLibName = 'OpenGL32.dll'; {$ENDIF} {$IFDEF UNIX} {$IFDEF DARWIN} - GLLibName = 'libGL.dylib'; + GLLibName = '/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib'; {$ELSE} GLLibName = 'libGL.so'; {$ENDIF} @@ -1201,377 +1210,377 @@ const {******************************************************************************} var - glAccum: procedure(op: GLenum; value: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glAlphaFunc: procedure(func: GLenum; ref: GLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glAreTexturesResident: function (n: GLsizei; const textures: PGLuint; residences: PGLboolean): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glArrayElement: procedure(i: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBegin: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBindTexture: procedure(target: GLenum; texture: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBitmap: procedure (width, height: GLsizei; xorig, yorig: GLfloat; xmove, ymove: GLfloat; const bitmap: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBlendFunc: procedure(sfactor, dfactor: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCallList: procedure(list: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCallLists: procedure(n: GLsizei; atype: GLenum; const lists: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glClear: procedure(mask: GLbitfield); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glClearAccum: procedure(red, green, blue, alpha: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glClearColor: procedure(red, green, blue, alpha: GLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glClearDepth: procedure(depth: GLclampd); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glClearIndex: procedure(c: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glClearStencil: procedure(s: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glClipPlane: procedure(plane: GLenum; const equation: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3b: procedure(red, green, blue: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3bv: procedure(const v: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3d: procedure(red, green, blue: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3f: procedure(red, green, blue: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3i: procedure(red, green, blue: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3s: procedure(red, green, blue: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3ub: procedure(red, green, blue: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3ubv: procedure(const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3ui: procedure(red, green, blue: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3uiv: procedure(const v: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3us: procedure(red, green, blue: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3usv: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4b: procedure(red, green, blue, alpha: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4bv: procedure(const v: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4d: procedure(red, green, blue, alpha: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4f: procedure(red, green, blue, alpha: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4i: procedure(red, green, blue, alpha: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4s: procedure(red, green, blue, alpha: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4ub: procedure(red, green, blue, alpha: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4ubv: procedure(const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4ui: procedure(red, green, blue, alpha: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4uiv: procedure(const v: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4us: procedure(red, green, blue, alpha: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4usv: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorMask: procedure(red, green, blue, alpha: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorMaterial: procedure(face, mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorPointer: procedure(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyPixels: procedure(x, y: GLint; width, height: GLsizei; atype: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyTexImage1D: procedure (target: GLenum; level: GLint; internalFormat: GLenum; x, y: GLint; width: GLsizei; border: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyTexImage2D: procedure(target: GLenum; level: GLint; internalFormat: GLenum; x, y: GLint; width, height: GLsizei; border: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyTexSubImage1D: procedure(target: GLenum; level, xoffset, x, y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyTexSubImage2D: procedure(target: GLenum; level, xoffset, yoffset, x, y: GLint; width, height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCullFace: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteLists: procedure(list: GLuint; range: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteTextures: procedure(n: GLsizei; const textures: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDepthFunc: procedure(func: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDepthMask: procedure(flag: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDepthRange: procedure(zNear, zFar: GLclampd); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDisable: procedure(cap: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDisableClientState: procedure(aarray: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDrawArrays: procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDrawBuffer: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDrawElements: procedure(mode: GLenum; count: GLsizei; atype: GLenum; const indices: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDrawPixels: procedure(width, height: GLsizei; format, atype: GLenum; const pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEdgeFlag: procedure(flag: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEdgeFlagPointer: procedure(stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEdgeFlagv: procedure(const flag: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEnable: procedure(cap: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEnableClientState: procedure(aarray: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEnd: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEndList: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalCoord1d: procedure(u: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalCoord1dv: procedure(const u: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalCoord1f: procedure(u: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalCoord1fv: procedure(const u: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalCoord2d: procedure(u, v: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalCoord2dv: procedure(const u: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalCoord2f: procedure(u, v: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalCoord2fv: procedure(const u: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalMesh1: procedure(mode: GLenum; i1, i2: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalMesh2: procedure(mode: GLenum; i1, i2, j1, j2: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalPoint1: procedure(i: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalPoint2: procedure(i, j: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFeedbackBuffer: procedure(size: GLsizei; atype: GLenum; buffer: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFinish: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFlush: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFogf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFogfv: procedure(pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFogi: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFogiv: procedure(pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFrontFace: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFrustum: procedure(left, right, bottom, top, zNear, zFar: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGenLists: function(range: GLsizei): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGenTextures: procedure(n: GLsizei; textures: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetBooleanv: procedure(pname: GLenum; params: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetClipPlane: procedure(plane: GLenum; equation: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetDoublev: procedure(pname: GLenum; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetError: function: GLenum; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetFloatv: procedure(pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetIntegerv: procedure(pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetLightfv: procedure(light, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetLightiv: procedure(light, pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMapdv: procedure(target, query: GLenum; v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMapfv: procedure(target, query: GLenum; v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMapiv: procedure(target, query: GLenum; v: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMaterialfv: procedure(face, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMaterialiv: procedure(face, pname: GLenum; params: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetPixelMapfv: procedure(map: GLenum; values: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetPixelMapuiv: procedure(map: GLenum; values: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetPixelMapusv: procedure(map: GLenum; values: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetPointerv: procedure(pname: GLenum; params: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetPolygonStipple: procedure(mask: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetString: function(name: GLenum): PChar; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexEnvfv: procedure(target, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexEnviv: procedure(target, pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexGendv: procedure(coord, pname: GLenum; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexGenfv: procedure(coord, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexGeniv: procedure(coord, pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexImage: procedure(target: GLenum; level: GLint; format: GLenum; atype: GLenum; pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexLevelParameterfv: procedure(target: GLenum; level: GLint; pname: GLenum; params: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexLevelParameteriv: procedure(target: GLenum; level: GLint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexParameterfv: procedure(target, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexParameteriv: procedure(target, pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glHint: procedure(target, mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexMask: procedure(mask: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexPointer: procedure(atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexd: procedure(c: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexdv: procedure(const c: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexf: procedure(c: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexfv: procedure(const c: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexi: procedure(c: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexiv: procedure(const c: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexs: procedure(c: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexsv: procedure(const c: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexub: procedure(c: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexubv: procedure(const c: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glInitNames: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glInterleavedArrays: procedure(format: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsEnabled: function(cap: GLenum): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsList: function(list: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsTexture: function(texture: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLightModelf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLightModelfv: procedure(pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLightModeli: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLightModeliv: procedure(pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLightf: procedure(light, pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLightfv: procedure(light, pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLighti: procedure(light, pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLightiv: procedure(light, pname: GLenum; const params: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLineStipple: procedure(factor: GLint; pattern: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLineWidth: procedure(width: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glListBase: procedure(base: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLoadIdentity: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLoadMatrixd: procedure(const m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLoadMatrixf: procedure(const m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLoadName: procedure(name: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLogicOp: procedure(opcode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMap1d: procedure(target: GLenum; u1, u2: GLdouble; stride, order: GLint; const points: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMap1f: procedure(target: GLenum; u1, u2: GLfloat; stride, order: GLint; const points: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMap2d: procedure(target: GLenum; u1, u2: GLdouble; ustride, uorder: GLint; v1, v2: GLdouble; vstride, vorder: GLint; const points: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMap2f: procedure(target: GLenum; u1, u2: GLfloat; ustride, uorder: GLint; v1, v2: GLfloat; vstride, vorder: GLint; const points: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMapGrid1d: procedure(un: GLint; u1, u2: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMapGrid1f: procedure(un: GLint; u1, u2: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMapGrid2d: procedure(un: GLint; u1, u2: GLdouble; vn: GLint; v1, v2: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMapGrid2f: procedure(un: GLint; u1, u2: GLfloat; vn: GLint; v1, v2: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMaterialf: procedure(face, pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMaterialfv: procedure(face, pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMateriali: procedure(face, pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMaterialiv: procedure(face, pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMatrixMode: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultMatrixd: procedure(const m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultMatrixf: procedure(const m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNewList: procedure(list: GLuint; mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3b: procedure(nx, ny, nz: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3bv: procedure(const v: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3d: procedure(nx, ny, nz: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3f: procedure(nx, ny, nz: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3i: procedure(nx, ny, nz: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3s: procedure(nx, ny, nz: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalPointer: procedure(atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glOrtho: procedure(left, right, bottom, top, zNear, zFar: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPassThrough: procedure(token: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPixelMapfv: procedure(map: GLenum; mapsize: GLsizei; const values: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPixelMapuiv: procedure(map: GLenum; mapsize: GLsizei; const values: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPixelMapusv: procedure(map: GLenum; mapsize: GLsizei; const values: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPixelStoref: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPixelStorei: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPixelTransferf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPixelTransferi: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPixelZoom: procedure(xfactor, yfactor: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPointSize: procedure(size: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPolygonMode: procedure(face, mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPolygonOffset: procedure(factor, units: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPolygonStipple: procedure(const mask: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPopAttrib: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPopClientAttrib: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPopMatrix: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPopName: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPrioritizeTextures: procedure(n: GLsizei; const textures: PGLuint; const priorities: PGLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPushAttrib: procedure(mask: GLbitfield); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPushClientAttrib: procedure(mask: GLbitfield); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPushMatrix: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPushName: procedure(name: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos2d: procedure(x, y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos2dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos2f: procedure(x, y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos2fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos2i: procedure(x, y: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos2iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos2s: procedure(x, y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos2sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos3d: procedure(x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos3dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos3f: procedure(x, y, z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos3fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos3i: procedure(x, y, z: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos3iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos3s: procedure(x, y, z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos3sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos4d: procedure(x, y, z, w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos4dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos4f: procedure(x, y, z, w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos4fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos4i: procedure(x, y, z, w: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos4iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos4s: procedure(x, y, z, w: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRasterPos4sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReadBuffer: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReadPixels: procedure(x, y: GLint; width, height: GLsizei; format, atype: GLenum; pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRectd: procedure(x1, y1, x2, y2: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRectdv: procedure(const v1: PGLdouble; const v2: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRectf: procedure(x1, y1, x2, y2: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRectfv: procedure(const v1: PGLfloat; const v2: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRecti: procedure(x1, y1, x2, y2: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRectiv: procedure(const v1: PGLint; const v2: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRects: procedure(x1, y1, x2, y2: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRectsv: procedure(const v1: PGLshort; const v2: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRenderMode: function(mode: GLint): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRotated: procedure(angle, x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRotatef: procedure(angle, x, y, z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glScaled: procedure(x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glScalef: procedure(x, y, z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glScissor: procedure(x, y: GLint; width, height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSelectBuffer: procedure(size: GLsizei; buffer: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glShadeModel: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glStencilFunc: procedure(func: GLenum; ref: GLint; mask: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glStencilMask: procedure(mask: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glStencilOp: procedure(fail, zfail, zpass: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord1d: procedure(s: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord1dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord1f: procedure(s: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord1fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord1i: procedure(s: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord1iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord1s: procedure(s: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord1sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2d: procedure(s, t: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2f: procedure(s, t: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2i: procedure(s, t: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2s: procedure(s, t: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord3d: procedure(s, t, r: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord3dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord3f: procedure(s, t, r: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord3fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord3i: procedure(s, t, r: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord3iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord3s: procedure(s, t, r: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord3sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4d: procedure(s, t, r, q: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4f: procedure(s, t, r, q: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4i: procedure(s, t, r, q: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4s: procedure(s, t, r, q: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoordPointer: procedure(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexEnvf: procedure(target: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexEnvfv: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexEnvi: procedure(target: GLenum; pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexEnviv: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexGend: procedure(coord: GLenum; pname: GLenum; param: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexGendv: procedure(coord: GLenum; pname: GLenum; const params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexGenf: procedure(coord: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexGenfv: procedure(coord: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexGeni: procedure(coord: GLenum; pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexGeniv: procedure(coord: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexImage1D: procedure(target: GLenum; level, internalformat: GLint; width: GLsizei; border: GLint; format, atype: GLenum; const pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexImage2D: procedure(target: GLenum; level, internalformat: GLint; width, height: GLsizei; border: GLint; format, atype: GLenum; const pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexParameterf: procedure(target: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexParameterfv: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexParameteri: procedure(target: GLenum; pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexParameteriv: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexSubImage1D: procedure(target: GLenum; level, xoffset: GLint; width: GLsizei; format, atype: GLenum; const pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexSubImage2D: procedure(target: GLenum; level, xoffset, yoffset: GLint; width, height: GLsizei; format, atype: GLenum; const pixels: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTranslated: procedure(x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTranslatef: procedure(x, y, z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex2d: procedure(x, y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex2dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex2f: procedure(x, y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex2fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex2i: procedure(x, y: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex2iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex2s: procedure(x, y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex2sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex3d: procedure(x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex3dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex3f: procedure(x, y, z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex3fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex3i: procedure(x, y, z: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex3iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex3s: procedure(x, y, z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex3sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex4d: procedure(x, y, z, w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex4dv: procedure(const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex4f: procedure(x, y, z, w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex4fv: procedure(const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex4i: procedure(x, y, z, w: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex4iv: procedure(const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex4s: procedure(x, y, z, w: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex4sv: procedure(const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexPointer: procedure(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glViewport: procedure(x, y: GLint; width, height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - {$IFDEF Win32} - ChoosePixelFormat: function(DC: HDC; p2: PPixelFormatDescriptor): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glAccum: procedure(op: GLenum; value: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glAlphaFunc: procedure(func: GLenum; ref: GLclampf); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glAreTexturesResident: function (n: GLsizei; const textures: PGLuint; residences: PGLboolean): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glArrayElement: procedure(i: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBegin: procedure(mode: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindTexture: procedure(target: GLenum; texture: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBitmap: procedure (width, height: GLsizei; xorig, yorig: GLfloat; xmove, ymove: GLfloat; const bitmap: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBlendFunc: procedure(sfactor, dfactor: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCallList: procedure(list: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCallLists: procedure(n: GLsizei; atype: GLenum; const lists: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glClear: procedure(mask: GLbitfield); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glClearAccum: procedure(red, green, blue, alpha: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glClearColor: procedure(red, green, blue, alpha: GLclampf); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glClearDepth: procedure(depth: GLclampd); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glClearIndex: procedure(c: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glClearStencil: procedure(s: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glClipPlane: procedure(plane: GLenum; const equation: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3b: procedure(red, green, blue: GLbyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3bv: procedure(const v: PGLbyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3d: procedure(red, green, blue: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3dv: procedure(const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3f: procedure(red, green, blue: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3fv: procedure(const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3i: procedure(red, green, blue: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3iv: procedure(const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3s: procedure(red, green, blue: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3sv: procedure(const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3ub: procedure(red, green, blue: GLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3ubv: procedure(const v: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3ui: procedure(red, green, blue: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3uiv: procedure(const v: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3us: procedure(red, green, blue: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3usv: procedure(const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4b: procedure(red, green, blue, alpha: GLbyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4bv: procedure(const v: PGLbyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4d: procedure(red, green, blue, alpha: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4dv: procedure(const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4f: procedure(red, green, blue, alpha: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4fv: procedure(const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4i: procedure(red, green, blue, alpha: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4iv: procedure(const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4s: procedure(red, green, blue, alpha: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4sv: procedure(const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4ub: procedure(red, green, blue, alpha: GLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4ubv: procedure(const v: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4ui: procedure(red, green, blue, alpha: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4uiv: procedure(const v: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4us: procedure(red, green, blue, alpha: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4usv: procedure(const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorMask: procedure(red, green, blue, alpha: GLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorMaterial: procedure(face, mode: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorPointer: procedure(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyPixels: procedure(x, y: GLint; width, height: GLsizei; atype: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyTexImage1D: procedure (target: GLenum; level: GLint; internalFormat: GLenum; x, y: GLint; width: GLsizei; border: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyTexImage2D: procedure(target: GLenum; level: GLint; internalFormat: GLenum; x, y: GLint; width, height: GLsizei; border: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyTexSubImage1D: procedure(target: GLenum; level, xoffset, x, y: GLint; width: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyTexSubImage2D: procedure(target: GLenum; level, xoffset, yoffset, x, y: GLint; width, height: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCullFace: procedure(mode: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteLists: procedure(list: GLuint; range: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteTextures: procedure(n: GLsizei; const textures: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDepthFunc: procedure(func: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDepthMask: procedure(flag: GLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDepthRange: procedure(zNear, zFar: GLclampd); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDisable: procedure(cap: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDisableClientState: procedure(aarray: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawArrays: procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawBuffer: procedure(mode: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawElements: procedure(mode: GLenum; count: GLsizei; atype: GLenum; const indices: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawPixels: procedure(width, height: GLsizei; format, atype: GLenum; const pixels: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEdgeFlag: procedure(flag: GLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEdgeFlagPointer: procedure(stride: GLsizei; const pointer: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEdgeFlagv: procedure(const flag: PGLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEnable: procedure(cap: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEnableClientState: procedure(aarray: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEnd: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEndList: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord1d: procedure(u: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord1dv: procedure(const u: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord1f: procedure(u: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord1fv: procedure(const u: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord2d: procedure(u, v: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord2dv: procedure(const u: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord2f: procedure(u, v: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord2fv: procedure(const u: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalMesh1: procedure(mode: GLenum; i1, i2: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalMesh2: procedure(mode: GLenum; i1, i2, j1, j2: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalPoint1: procedure(i: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalPoint2: procedure(i, j: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFeedbackBuffer: procedure(size: GLsizei; atype: GLenum; buffer: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFinish: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFlush: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogfv: procedure(pname: GLenum; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogi: procedure(pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogiv: procedure(pname: GLenum; const params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFrontFace: procedure(mode: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFrustum: procedure(left, right, bottom, top, zNear, zFar: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenLists: function(range: GLsizei): GLuint; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenTextures: procedure(n: GLsizei; textures: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetBooleanv: procedure(pname: GLenum; params: PGLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetClipPlane: procedure(plane: GLenum; equation: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetDoublev: procedure(pname: GLenum; params: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetError: function: GLenum; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetFloatv: procedure(pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetIntegerv: procedure(pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetLightfv: procedure(light, pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetLightiv: procedure(light, pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapdv: procedure(target, query: GLenum; v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapfv: procedure(target, query: GLenum; v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapiv: procedure(target, query: GLenum; v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMaterialfv: procedure(face, pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMaterialiv: procedure(face, pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPixelMapfv: procedure(map: GLenum; values: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPixelMapuiv: procedure(map: GLenum; values: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPixelMapusv: procedure(map: GLenum; values: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPointerv: procedure(pname: GLenum; params: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPolygonStipple: procedure(mask: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetString: function(name: GLenum): PChar; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexEnvfv: procedure(target, pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexEnviv: procedure(target, pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexGendv: procedure(coord, pname: GLenum; params: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexGenfv: procedure(coord, pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexGeniv: procedure(coord, pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexImage: procedure(target: GLenum; level: GLint; format: GLenum; atype: GLenum; pixels: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexLevelParameterfv: procedure(target: GLenum; level: GLint; pname: GLenum; params: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexLevelParameteriv: procedure(target: GLenum; level: GLint; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexParameterfv: procedure(target, pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexParameteriv: procedure(target, pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glHint: procedure(target, mode: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexMask: procedure(mask: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexPointer: procedure(atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexd: procedure(c: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexdv: procedure(const c: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexf: procedure(c: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexfv: procedure(const c: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexi: procedure(c: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexiv: procedure(const c: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexs: procedure(c: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexsv: procedure(const c: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexub: procedure(c: GLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexubv: procedure(const c: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glInitNames: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glInterleavedArrays: procedure(format: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsEnabled: function(cap: GLenum): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsList: function(list: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsTexture: function(texture: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightModelf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightModelfv: procedure(pname: GLenum; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightModeli: procedure(pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightModeliv: procedure(pname: GLenum; const params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightf: procedure(light, pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightfv: procedure(light, pname: GLenum; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLighti: procedure(light, pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightiv: procedure(light, pname: GLenum; const params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLineStipple: procedure(factor: GLint; pattern: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLineWidth: procedure(width: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glListBase: procedure(base: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadIdentity: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadMatrixd: procedure(const m: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadMatrixf: procedure(const m: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadName: procedure(name: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLogicOp: procedure(opcode: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMap1d: procedure(target: GLenum; u1, u2: GLdouble; stride, order: GLint; const points: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMap1f: procedure(target: GLenum; u1, u2: GLfloat; stride, order: GLint; const points: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMap2d: procedure(target: GLenum; u1, u2: GLdouble; ustride, uorder: GLint; v1, v2: GLdouble; vstride, vorder: GLint; const points: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMap2f: procedure(target: GLenum; u1, u2: GLfloat; ustride, uorder: GLint; v1, v2: GLfloat; vstride, vorder: GLint; const points: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapGrid1d: procedure(un: GLint; u1, u2: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapGrid1f: procedure(un: GLint; u1, u2: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapGrid2d: procedure(un: GLint; u1, u2: GLdouble; vn: GLint; v1, v2: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapGrid2f: procedure(un: GLint; u1, u2: GLfloat; vn: GLint; v1, v2: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMaterialf: procedure(face, pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMaterialfv: procedure(face, pname: GLenum; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMateriali: procedure(face, pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMaterialiv: procedure(face, pname: GLenum; const params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMatrixMode: procedure(mode: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultMatrixd: procedure(const m: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultMatrixf: procedure(const m: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNewList: procedure(list: GLuint; mode: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3b: procedure(nx, ny, nz: GLbyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3bv: procedure(const v: PGLbyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3d: procedure(nx, ny, nz: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3dv: procedure(const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3f: procedure(nx, ny, nz: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3fv: procedure(const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3i: procedure(nx, ny, nz: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3iv: procedure(const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3s: procedure(nx, ny, nz: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3sv: procedure(const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalPointer: procedure(atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glOrtho: procedure(left, right, bottom, top, zNear, zFar: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPassThrough: procedure(token: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelMapfv: procedure(map: GLenum; mapsize: GLsizei; const values: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelMapuiv: procedure(map: GLenum; mapsize: GLsizei; const values: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelMapusv: procedure(map: GLenum; mapsize: GLsizei; const values: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelStoref: procedure(pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelStorei: procedure(pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelTransferf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelTransferi: procedure(pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelZoom: procedure(xfactor, yfactor: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPointSize: procedure(size: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPolygonMode: procedure(face, mode: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPolygonOffset: procedure(factor, units: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPolygonStipple: procedure(const mask: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPopAttrib: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPopClientAttrib: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPopMatrix: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPopName: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPrioritizeTextures: procedure(n: GLsizei; const textures: PGLuint; const priorities: PGLclampf); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPushAttrib: procedure(mask: GLbitfield); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPushClientAttrib: procedure(mask: GLbitfield); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPushMatrix: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPushName: procedure(name: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2d: procedure(x, y: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2dv: procedure(const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2f: procedure(x, y: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2fv: procedure(const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2i: procedure(x, y: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2iv: procedure(const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2s: procedure(x, y: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos2sv: procedure(const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3d: procedure(x, y, z: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3dv: procedure(const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3f: procedure(x, y, z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3fv: procedure(const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3i: procedure(x, y, z: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3iv: procedure(const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3s: procedure(x, y, z: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos3sv: procedure(const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4d: procedure(x, y, z, w: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4dv: procedure(const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4f: procedure(x, y, z, w: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4fv: procedure(const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4i: procedure(x, y, z, w: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4iv: procedure(const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4s: procedure(x, y, z, w: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRasterPos4sv: procedure(const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glReadBuffer: procedure(mode: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glReadPixels: procedure(x, y: GLint; width, height: GLsizei; format, atype: GLenum; pixels: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRectd: procedure(x1, y1, x2, y2: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRectdv: procedure(const v1: PGLdouble; const v2: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRectf: procedure(x1, y1, x2, y2: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRectfv: procedure(const v1: PGLfloat; const v2: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRecti: procedure(x1, y1, x2, y2: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRectiv: procedure(const v1: PGLint; const v2: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRects: procedure(x1, y1, x2, y2: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRectsv: procedure(const v1: PGLshort; const v2: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRenderMode: function(mode: GLint): GLint; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRotated: procedure(angle, x, y, z: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRotatef: procedure(angle, x, y, z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glScaled: procedure(x, y, z: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glScalef: procedure(x, y, z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glScissor: procedure(x, y: GLint; width, height: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSelectBuffer: procedure(size: GLsizei; buffer: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glShadeModel: procedure(mode: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glStencilFunc: procedure(func: GLenum; ref: GLint; mask: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glStencilMask: procedure(mask: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glStencilOp: procedure(fail, zfail, zpass: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1d: procedure(s: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1dv: procedure(const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1f: procedure(s: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1fv: procedure(const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1i: procedure(s: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1iv: procedure(const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1s: procedure(s: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1sv: procedure(const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2d: procedure(s, t: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2dv: procedure(const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2f: procedure(s, t: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fv: procedure(const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2i: procedure(s, t: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2iv: procedure(const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2s: procedure(s, t: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2sv: procedure(const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3d: procedure(s, t, r: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3dv: procedure(const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3f: procedure(s, t, r: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3fv: procedure(const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3i: procedure(s, t, r: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3iv: procedure(const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3s: procedure(s, t, r: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3sv: procedure(const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4d: procedure(s, t, r, q: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4dv: procedure(const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4f: procedure(s, t, r, q: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4fv: procedure(const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4i: procedure(s, t, r, q: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4iv: procedure(const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4s: procedure(s, t, r, q: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4sv: procedure(const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoordPointer: procedure(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexEnvf: procedure(target: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexEnvfv: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexEnvi: procedure(target: GLenum; pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexEnviv: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGend: procedure(coord: GLenum; pname: GLenum; param: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGendv: procedure(coord: GLenum; pname: GLenum; const params: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGenf: procedure(coord: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGenfv: procedure(coord: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGeni: procedure(coord: GLenum; pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGeniv: procedure(coord: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexImage1D: procedure(target: GLenum; level, internalformat: GLint; width: GLsizei; border: GLint; format, atype: GLenum; const pixels: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexImage2D: procedure(target: GLenum; level, internalformat: GLint; width, height: GLsizei; border: GLint; format, atype: GLenum; const pixels: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexParameterf: procedure(target: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexParameterfv: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexParameteri: procedure(target: GLenum; pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexParameteriv: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexSubImage1D: procedure(target: GLenum; level, xoffset: GLint; width: GLsizei; format, atype: GLenum; const pixels: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexSubImage2D: procedure(target: GLenum; level, xoffset, yoffset: GLint; width, height: GLsizei; format, atype: GLenum; const pixels: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTranslated: procedure(x, y, z: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTranslatef: procedure(x, y, z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2d: procedure(x, y: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2dv: procedure(const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2f: procedure(x, y: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2fv: procedure(const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2i: procedure(x, y: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2iv: procedure(const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2s: procedure(x, y: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2sv: procedure(const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3d: procedure(x, y, z: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3dv: procedure(const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3f: procedure(x, y, z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3fv: procedure(const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3i: procedure(x, y, z: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3iv: procedure(const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3s: procedure(x, y, z: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3sv: procedure(const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4d: procedure(x, y, z, w: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4dv: procedure(const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4f: procedure(x, y, z, w: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4fv: procedure(const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4i: procedure(x, y, z, w: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4iv: procedure(const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4s: procedure(x, y, z, w: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4sv: procedure(const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexPointer: procedure(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glViewport: procedure(x, y: GLint; width, height: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + {$IFDEF WINDOWS} + ChoosePixelFormat: function(DC: HDC; p2: PPixelFormatDescriptor): Integer; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} {$ENDIF} type // EXT_vertex_array - PFNGLARRAYELEMENTEXTPROC = procedure(i: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - PFNGLDRAWARRAYSEXTPROC = procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLARRAYELEMENTEXTPROC = procedure(i: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLDRAWARRAYSEXTPROC = procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} PFNGLVERTEXPOINTEREXTPROC = procedure(size: GLint; atype: GLenum; - stride, count: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + stride, count: GLsizei; const pointer: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} PFNGLNORMALPOINTEREXTPROC = procedure(atype: GLenum; stride, count: GLsizei; - const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + const pointer: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} PFNGLCOLORPOINTEREXTPROC = procedure(size: GLint; atype: GLenum; stride, count: GLsizei; - const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + const pointer: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} PFNGLINDEXPOINTEREXTPROC = procedure(atype: GLenum; stride, count: GLsizei; - const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + const pointer: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} PFNGLTEXCOORDPOINTEREXTPROC = procedure(size: GLint; atype: GLenum; - stride, count: GLsizei; const pointer: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + stride, count: GLsizei; const pointer: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} PFNGLEDGEFLAGPOINTEREXTPROC = procedure(stride, count: GLsizei; - const pointer: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - PFNGLGETPOINTERVEXTPROC = procedure(pname: GLenum; params: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + const pointer: PGLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLGETPOINTERVEXTPROC = procedure(pname: GLenum; params: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} PFNGLARRAYELEMENTARRAYEXTPROC = procedure(mode: GLenum; count: GLsizei; - const pi: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + const pi: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} // WIN_swap_hint - PFNGLADDSWAPHINTRECTWINPROC = procedure(x, y: GLint; width, height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLADDSWAPHINTRECTWINPROC = procedure(x, y: GLint; width, height: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} // EXT_paletted_texture PFNGLCOLORTABLEEXTPROC = procedure(target, internalFormat: GLenum; width: GLsizei; - format, atype: GLenum; const data: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + format, atype: GLenum; const data: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} PFNGLCOLORSUBTABLEEXTPROC = procedure(target: GLenum; start, count: GLsizei; - format, atype: GLenum; const data: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - PFNGLGETCOLORTABLEEXTPROC = procedure(target, format, atype: GLenum; data: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - PFNGLGETCOLORTABLEPARAMETERIVEXTPROC = procedure(target, pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - PFNGLGETCOLORTABLEPARAMETERFVEXTPROC = procedure(target, pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + format, atype: GLenum; const data: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLGETCOLORTABLEEXTPROC = procedure(target, format, atype: GLenum; data: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLGETCOLORTABLEPARAMETERIVEXTPROC = procedure(target, pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + PFNGLGETCOLORTABLEPARAMETERFVEXTPROC = procedure(target, pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} procedure LoadOpenGL( const dll: PChar ); procedure FreeOpenGL; @@ -1917,7 +1926,7 @@ begin @glVertex4sv := nil; @glVertexPointer := nil; @glViewport := nil; - {$IFDEF Win32} + {$IFDEF WINDOWS} @ChoosePixelFormat := nil; {$ENDIF} @@ -2269,7 +2278,7 @@ begin @glVertexPointer := GetModuleSymbol(LibGL, 'glVertexPointer'); @glViewport := GetModuleSymbol(LibGL, 'glViewport'); - {$IFDEF WIN32} + {$IFDEF WINDOWS} @ChoosePixelFormat := GetModuleSymbol(LibGL, 'ChoosePixelFormat'); if not Assigned(ChoosePixelFormat) then {$IFNDEF FPC}@{$ENDIF}ChoosePixelFormat := @Windows.ChoosePixelFormat; @@ -2278,11 +2287,9 @@ begin end; initialization - {$IFNDEF FPC} - {$IFNDEF __GPC__} + {$ifdef x86} Set8087CW($133F); - {$ENDIF} - {$ENDIF} + {$endif x86} LoadOpenGL( GLLibName ); diff --git a/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glext.pas b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glext.pas index 19ed2023..835c1703 100644 --- a/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glext.pas +++ b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glext.pas @@ -1,6 +1,6 @@ unit glext; { - $Id: glext.pas,v 1.3 2004/08/24 19:33:06 savage Exp $ + $Id: glext.pas,v 1.6 2007/05/20 20:28:31 savage Exp $ } (************************************************** @@ -11,6 +11,15 @@ unit glext; { $Log: glext.pas,v $ + Revision 1.6 2007/05/20 20:28:31 savage + Initial Changes to Handle 64 Bits + + Revision 1.5 2006/01/11 22:39:02 drellis + Updated to Support Up to OpenGL 2.0 + + Revision 1.4 2005/01/05 00:28:40 savage + Forgot to wrap a couple of Load_WGL function calls with an IFDEF WIN32. Fixed so now compiles under Linux as well. + Revision 1.3 2004/08/24 19:33:06 savage Removed declarations of SDL_GL_GetProcAddress as the correct ones are in sdl.pas. @@ -54,7 +63,7 @@ uses gpc, {$ENDIF} -{$IFDEF WIN32} +{$IFDEF WINDOWS} Windows, {$ENDIF} moduleloader, @@ -63,9 +72,8 @@ uses // Test if the given extension name is present in the given extension string. function glext_ExtensionSupported(const extension: PChar; const searchIn: PChar): Boolean; -// Load the extension with the given name. -function glext_LoadExtension(ext: PChar): Boolean; - +// Load a Specific Extension +function glext_LoadExtension(ext: String): Boolean; // Some types that were introduced by extensions: type GLintptrARB = Integer; @@ -80,6 +88,15 @@ type GLhandleARB = Cardinal; PGLhandleARB = ^GLhandleARB; + GLintptr = Integer; + PGLintptr = ^GLintptr; + + GLsizeiptr = Integer; + PGLsizeiptr = ^GLsizeiptr; + + GLchar = Char; + PGLchar = ^GLchar; + //***** GL_version_1_2 *****// const GL_UNSIGNED_BYTE_3_3_2 = $8032; @@ -123,10 +140,10 @@ const GL_TEXTURE_WRAP_R = $8072; GL_MAX_3D_TEXTURE_SIZE = $8073; var - glDrawRangeElements: procedure(mode: GLenum; start: GLuint; _end: GLuint; count: GLsizei; _type: GLenum; const indices: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexImage3D: procedure(target: GLenum; level: GLint; internalformat: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexSubImage3D: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyTexSubImage3D: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; x: GLint; y: GLint; width: GLsizei; height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawRangeElements: procedure(mode: GLenum; start: GLuint; _end: GLuint; count: GLsizei; _type: GLenum; const indices: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexImage3D: procedure(target: GLenum; level: GLint; internalformat: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexSubImage3D: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyTexSubImage3D: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; x: GLint; y: GLint; width: GLsizei; height: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_version_1_2: Boolean; @@ -210,40 +227,40 @@ const GL_REPLICATE_BORDER = $8153; GL_CONVOLUTION_BORDER_COLOR = $8154; var - glColorTable: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const table: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorTableParameterfv: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorTableParameteriv: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyColorTable: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetColorTable: procedure(target: GLenum; format: GLenum; _type: GLenum; table: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetColorTableParameterfv: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetColorTableParameteriv: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorSubTable: procedure(target: GLenum; start: GLsizei; count: GLsizei; format: GLenum; _type: GLenum; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyColorSubTable: procedure(target: GLenum; start: GLsizei; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glConvolutionFilter1D: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glConvolutionFilter2D: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glConvolutionParameterf: procedure(target: GLenum; pname: GLenum; params: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glConvolutionParameterfv: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glConvolutionParameteri: procedure(target: GLenum; pname: GLenum; params: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glConvolutionParameteriv: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyConvolutionFilter1D: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyConvolutionFilter2D: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei; height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetConvolutionFilter: procedure(target: GLenum; format: GLenum; _type: GLenum; image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetConvolutionParameterfv: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetConvolutionParameteriv: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetSeparableFilter: procedure(target: GLenum; format: GLenum; _type: GLenum; row: PGLvoid; column: PGLvoid; span: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSeparableFilter2D: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const row: PGLvoid; const column: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetHistogram: procedure(target: GLenum; reset: GLboolean; format: GLenum; _type: GLenum; values: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetHistogramParameterfv: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetHistogramParameteriv: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMinmax: procedure(target: GLenum; reset: GLboolean; format: GLenum; _type: GLenum; values: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMinmaxParameterfv: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMinmaxParameteriv: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glHistogram: procedure(target: GLenum; width: GLsizei; internalformat: GLenum; sink: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMinmax: procedure(target: GLenum; internalformat: GLenum; sink: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glResetHistogram: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glResetMinmax: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBlendEquation: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBlendColor: procedure(red: GLclampf; green: GLclampf; blue: GLclampf; alpha: GLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorTable: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const table: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorTableParameterfv: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorTableParameteriv: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyColorTable: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTable: procedure(target: GLenum; format: GLenum; _type: GLenum; table: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTableParameterfv: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTableParameteriv: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorSubTable: procedure(target: GLenum; start: GLsizei; count: GLsizei; format: GLenum; _type: GLenum; const data: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyColorSubTable: procedure(target: GLenum; start: GLsizei; x: GLint; y: GLint; width: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionFilter1D: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const image: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionFilter2D: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const image: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameterf: procedure(target: GLenum; pname: GLenum; params: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameterfv: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameteri: procedure(target: GLenum; pname: GLenum; params: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameteriv: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyConvolutionFilter1D: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyConvolutionFilter2D: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei; height: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetConvolutionFilter: procedure(target: GLenum; format: GLenum; _type: GLenum; image: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetConvolutionParameterfv: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetConvolutionParameteriv: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetSeparableFilter: procedure(target: GLenum; format: GLenum; _type: GLenum; row: PGLvoid; column: PGLvoid; span: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSeparableFilter2D: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const row: PGLvoid; const column: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetHistogram: procedure(target: GLenum; reset: GLboolean; format: GLenum; _type: GLenum; values: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetHistogramParameterfv: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetHistogramParameteriv: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMinmax: procedure(target: GLenum; reset: GLboolean; format: GLenum; _type: GLenum; values: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMinmaxParameterfv: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMinmaxParameteriv: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glHistogram: procedure(target: GLenum; width: GLsizei; internalformat: GLenum; sink: GLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMinmax: procedure(target: GLenum; internalformat: GLenum; sink: GLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glResetHistogram: procedure(target: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glResetMinmax: procedure(target: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBlendEquation: procedure(mode: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBlendColor: procedure(red: GLclampf; green: GLclampf; blue: GLclampf; alpha: GLclampf); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ARB_imaging: Boolean; @@ -347,52 +364,52 @@ const GL_DOT3_RGB = $86AE; GL_DOT3_RGBA = $86AF; var - glActiveTexture: procedure(texture: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glClientActiveTexture: procedure(texture: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1d: procedure(target: GLenum; s: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1dv: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1f: procedure(target: GLenum; s: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1fv: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1i: procedure(target: GLenum; s: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1iv: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1s: procedure(target: GLenum; s: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1sv: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2d: procedure(target: GLenum; s: GLdouble; t: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2dv: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2f: procedure(target: GLenum; s: GLfloat; t: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2fv: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2i: procedure(target: GLenum; s: GLint; t: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2iv: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2s: procedure(target: GLenum; s: GLshort; t: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2sv: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3d: procedure(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3dv: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3f: procedure(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3fv: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3i: procedure(target: GLenum; s: GLint; t: GLint; r: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3iv: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3s: procedure(target: GLenum; s: GLshort; t: GLshort; r: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3sv: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4d: procedure(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble; q: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4dv: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4f: procedure(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat; q: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4fv: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4i: procedure(target: GLenum; s: GLint; t: GLint; r: GLint; q: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4iv: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4s: procedure(target: GLenum; s: GLshort; t: GLshort; r: GLshort; q: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4sv: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLoadTransposeMatrixf: procedure(const m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLoadTransposeMatrixd: procedure(const m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultTransposeMatrixf: procedure(const m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultTransposeMatrixd: procedure(const m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSampleCoverage: procedure(value: GLclampf; invert: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompressedTexImage3D: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompressedTexImage2D: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompressedTexImage1D: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompressedTexSubImage3D: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompressedTexSubImage2D: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; height: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompressedTexSubImage1D: procedure(target: GLenum; level: GLint; xoffset: GLint; width: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetCompressedTexImage: procedure(target: GLenum; level: GLint; img: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glActiveTexture: procedure(texture: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glClientActiveTexture: procedure(texture: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1d: procedure(target: GLenum; s: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1dv: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1f: procedure(target: GLenum; s: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1fv: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1i: procedure(target: GLenum; s: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1iv: procedure(target: GLenum; const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1s: procedure(target: GLenum; s: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1sv: procedure(target: GLenum; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2d: procedure(target: GLenum; s: GLdouble; t: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2dv: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2f: procedure(target: GLenum; s: GLfloat; t: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2fv: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2i: procedure(target: GLenum; s: GLint; t: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2iv: procedure(target: GLenum; const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2s: procedure(target: GLenum; s: GLshort; t: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2sv: procedure(target: GLenum; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3d: procedure(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3dv: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3f: procedure(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3fv: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3i: procedure(target: GLenum; s: GLint; t: GLint; r: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3iv: procedure(target: GLenum; const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3s: procedure(target: GLenum; s: GLshort; t: GLshort; r: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3sv: procedure(target: GLenum; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4d: procedure(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble; q: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4dv: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4f: procedure(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat; q: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4fv: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4i: procedure(target: GLenum; s: GLint; t: GLint; r: GLint; q: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4iv: procedure(target: GLenum; const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4s: procedure(target: GLenum; s: GLshort; t: GLshort; r: GLshort; q: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4sv: procedure(target: GLenum; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadTransposeMatrixf: procedure(const m: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadTransposeMatrixd: procedure(const m: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultTransposeMatrixf: procedure(const m: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultTransposeMatrixd: procedure(const m: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSampleCoverage: procedure(value: GLclampf; invert: GLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexImage3D: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexImage2D: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexImage1D: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexSubImage3D: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexSubImage2D: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; height: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexSubImage1D: procedure(target: GLenum; level: GLint; xoffset: GLint; width: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetCompressedTexImage: procedure(target: GLenum; level: GLint; img: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_version_1_3: Boolean; @@ -434,40 +451,40 @@ const GL_CLIENT_ACTIVE_TEXTURE_ARB = $84E1; GL_MAX_TEXTURE_UNITS_ARB = $84E2; var - glActiveTextureARB: procedure(texture: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glClientActiveTextureARB: procedure(texture: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1dARB: procedure(target: GLenum; s: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1dvARB: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1fARB: procedure(target: GLenum; s: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1fvARB: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1iARB: procedure(target: GLenum; s: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1ivARB: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1sARB: procedure(target: GLenum; s: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1svARB: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2dARB: procedure(target: GLenum; s: GLdouble; t: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2dvARB: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2fARB: procedure(target: GLenum; s: GLfloat; t: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2fvARB: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2iARB: procedure(target: GLenum; s: GLint; t: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2ivARB: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2sARB: procedure(target: GLenum; s: GLshort; t: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2svARB: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3dARB: procedure(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3dvARB: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3fARB: procedure(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3fvARB: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3iARB: procedure(target: GLenum; s: GLint; t: GLint; r: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3ivARB: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3sARB: procedure(target: GLenum; s: GLshort; t: GLshort; r: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3svARB: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4dARB: procedure(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble; q: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4dvARB: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4fARB: procedure(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat; q: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4fvARB: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4iARB: procedure(target: GLenum; s: GLint; t: GLint; r: GLint; q: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4ivARB: procedure(target: GLenum; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4sARB: procedure(target: GLenum; s: GLshort; t: GLshort; r: GLshort; q: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4svARB: procedure(target: GLenum; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glActiveTextureARB: procedure(texture: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glClientActiveTextureARB: procedure(texture: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1dARB: procedure(target: GLenum; s: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1dvARB: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1fARB: procedure(target: GLenum; s: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1fvARB: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1iARB: procedure(target: GLenum; s: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1ivARB: procedure(target: GLenum; const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1sARB: procedure(target: GLenum; s: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1svARB: procedure(target: GLenum; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2dARB: procedure(target: GLenum; s: GLdouble; t: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2dvARB: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2fARB: procedure(target: GLenum; s: GLfloat; t: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2fvARB: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2iARB: procedure(target: GLenum; s: GLint; t: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2ivARB: procedure(target: GLenum; const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2sARB: procedure(target: GLenum; s: GLshort; t: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2svARB: procedure(target: GLenum; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3dARB: procedure(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3dvARB: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3fARB: procedure(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3fvARB: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3iARB: procedure(target: GLenum; s: GLint; t: GLint; r: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3ivARB: procedure(target: GLenum; const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3sARB: procedure(target: GLenum; s: GLshort; t: GLshort; r: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3svARB: procedure(target: GLenum; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4dARB: procedure(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble; q: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4dvARB: procedure(target: GLenum; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4fARB: procedure(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat; q: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4fvARB: procedure(target: GLenum; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4iARB: procedure(target: GLenum; s: GLint; t: GLint; r: GLint; q: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4ivARB: procedure(target: GLenum; const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4sARB: procedure(target: GLenum; s: GLshort; t: GLshort; r: GLshort; q: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4svARB: procedure(target: GLenum; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ARB_multitexture: Boolean; @@ -478,10 +495,10 @@ const GL_TRANSPOSE_TEXTURE_MATRIX_ARB = $84E5; GL_TRANSPOSE_COLOR_MATRIX_ARB = $84E6; var - glLoadTransposeMatrixfARB: procedure(m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLoadTransposeMatrixdARB: procedure(m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultTransposeMatrixfARB: procedure(m: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultTransposeMatrixdARB: procedure(m: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadTransposeMatrixfARB: procedure(m: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadTransposeMatrixdARB: procedure(m: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultTransposeMatrixfARB: procedure(m: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultTransposeMatrixdARB: procedure(m: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ARB_transpose_matrix: Boolean; @@ -499,7 +516,7 @@ const GL_SAMPLE_COVERAGE_VALUE_ARB = $80AA; GL_SAMPLE_COVERAGE_INVERT_ARB = $80AB; var - glSampleCoverageARB: procedure(value: GLclampf; invert: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSampleCoverageARB: procedure(value: GLclampf; invert: GLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ARB_multisample: Boolean; @@ -507,10 +524,10 @@ function Load_GL_ARB_multisample: Boolean; function Load_GL_ARB_texture_env_add: Boolean; -{$IFDEF Win32} +{$IFDEF WINDOWS} //***** WGL_ARB_extensions_string *****// var - wglGetExtensionsStringARB: function(hdc: HDC): Pchar; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetExtensionsStringARB: function(hdc: HDC): Pchar; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_WGL_ARB_extensions_string: Boolean; @@ -521,10 +538,10 @@ const WGL_DEPTH_BUFFER_BIT_ARB = $0004; WGL_STENCIL_BUFFER_BIT_ARB = $0008; var - wglCreateBufferRegionARB: function(hDC: HDC; iLayerPlane: GLint; uType: GLuint): THandle; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglDeleteBufferRegionARB: procedure(hRegion: THandle); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglSaveBufferRegionARB: function(hRegion: THandle; x: GLint; y: GLint; width: GLint; height: GLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglRestoreBufferRegionARB: function(hRegion: THandle; x: GLint; y: GLint; width: GLint; height: GLint; xSrc: GLint; ySrc: GLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglCreateBufferRegionARB: function(hDC: HDC; iLayerPlane: GLint; uType: GLuint): THandle; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglDeleteBufferRegionARB: procedure(hRegion: THandle); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglSaveBufferRegionARB: function(hRegion: THandle; x: GLint; y: GLint; width: GLint; height: GLint): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglRestoreBufferRegionARB: function(hRegion: THandle; x: GLint; y: GLint; width: GLint; height: GLint; xSrc: GLint; ySrc: GLint): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_WGL_ARB_buffer_region: Boolean; {$ENDIF} @@ -563,8 +580,8 @@ const GL_POINT_FADE_THRESHOLD_SIZE_ARB = $8128; GL_POINT_DISTANCE_ATTENUATION_ARB = $8129; var - glPointParameterfARB: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPointParameterfvARB: procedure(pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPointParameterfARB: procedure(pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPointParameterfvARB: procedure(pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ARB_point_parameters: Boolean; @@ -602,13 +619,13 @@ const GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB = $86A2; GL_COMPRESSED_TEXTURE_FORMATS_ARB = $86A3; var - glCompressedTexImage3DARB: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompressedTexImage2DARB: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompressedTexImage1DARB: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompressedTexSubImage3DARB: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompressedTexSubImage2DARB: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; height: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompressedTexSubImage1DARB: procedure(target: GLenum; level: GLint; xoffset: GLint; width: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetCompressedTexImageARB: procedure(target: GLenum; lod: GLint; img: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexImage3DARB: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexImage2DARB: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexImage1DARB: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexSubImage3DARB: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexSubImage2DARB: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; height: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompressedTexSubImage1DARB: procedure(target: GLenum; level: GLint; xoffset: GLint; width: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetCompressedTexImageARB: procedure(target: GLenum; lod: GLint; img: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ARB_texture_compression: Boolean; @@ -701,17 +718,17 @@ const GL_WEIGHT_ARRAY_POINTER_ARB = $86AC; GL_WEIGHT_ARRAY_ARB = $86AD; var - glWeightbvARB: procedure(size: GLint; weights: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWeightsvARB: procedure(size: GLint; weights: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWeightivARB: procedure(size: GLint; weights: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWeightfvARB: procedure(size: GLint; weights: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWeightdvARB: procedure(size: GLint; weights: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWeightvARB: procedure(size: GLint; weights: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWeightubvARB: procedure(size: GLint; weights: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWeightusvARB: procedure(size: GLint; weights: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWeightuivARB: procedure(size: GLint; weights: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWeightPointerARB: procedure(size: GLint; _type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexBlendARB: procedure(count: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightbvARB: procedure(size: GLint; weights: PGLbyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightsvARB: procedure(size: GLint; weights: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightivARB: procedure(size: GLint; weights: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightfvARB: procedure(size: GLint; weights: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightdvARB: procedure(size: GLint; weights: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightvARB: procedure(size: GLint; weights: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightubvARB: procedure(size: GLint; weights: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightusvARB: procedure(size: GLint; weights: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightuivARB: procedure(size: GLint; weights: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWeightPointerARB: procedure(size: GLint; _type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexBlendARB: procedure(count: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ARB_vertex_blend: Boolean; @@ -797,89 +814,89 @@ const GL_MATRIX30_ARB = $88DE; GL_MATRIX31_ARB = $88DF; var - glVertexAttrib1sARB: procedure(index: GLuint; x: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1fARB: procedure(index: GLuint; x: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1dARB: procedure(index: GLuint; x: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2sARB: procedure(index: GLuint; x: GLshort; y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2fARB: procedure(index: GLuint; x: GLfloat; y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2dARB: procedure(index: GLuint; x: GLdouble; y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3sARB: procedure(index: GLuint; x: GLshort; y: GLshort; z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3fARB: procedure(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3dARB: procedure(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4sARB: procedure(index: GLuint; x: GLshort; y: GLshort; z: GLshort; w: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4fARB: procedure(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4dARB: procedure(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4NubARB: procedure(index: GLuint; x: GLubyte; y: GLubyte; z: GLubyte; w: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1svARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1fvARB: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1dvARB: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2svARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2fvARB: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2dvARB: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3svARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3fvARB: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3dvARB: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4bvARB: procedure(index: GLuint; const v: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4svARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4ivARB: procedure(index: GLuint; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4ubvARB: procedure(index: GLuint; const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4usvARB: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4uivARB: procedure(index: GLuint; const v: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4fvARB: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4dvARB: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4NbvARB: procedure(index: GLuint; const v: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4NsvARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4NivARB: procedure(index: GLuint; const v: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4NubvARB: procedure(index: GLuint; const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4NusvARB: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4NuivARB: procedure(index: GLuint; const v: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribPointerARB: procedure(index: GLuint; size: GLint; _type: GLenum; normalized: GLboolean; stride: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEnableVertexAttribArrayARB: procedure(index: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDisableVertexAttribArrayARB: procedure(index: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramStringARB: procedure(target: GLenum; format: GLenum; len: GLsizei; const _string: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBindProgramARB: procedure(target: GLenum; _program: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteProgramsARB: procedure(n: GLsizei; const programs: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGenProgramsARB: procedure(n: GLsizei; programs: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramEnvParameter4dARB: procedure(target: GLenum; index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramEnvParameter4dvARB: procedure(target: GLenum; index: GLuint; const params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramEnvParameter4fARB: procedure(target: GLenum; index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramEnvParameter4fvARB: procedure(target: GLenum; index: GLuint; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramLocalParameter4dARB: procedure(target: GLenum; index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramLocalParameter4dvARB: procedure(target: GLenum; index: GLuint; const params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramLocalParameter4fARB: procedure(target: GLenum; index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramLocalParameter4fvARB: procedure(target: GLenum; index: GLuint; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramEnvParameterdvARB: procedure(target: GLenum; index: GLuint; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramEnvParameterfvARB: procedure(target: GLenum; index: GLuint; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramLocalParameterdvARB: procedure(target: GLenum; index: GLuint; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramLocalParameterfvARB: procedure(target: GLenum; index: GLuint; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramivARB: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramStringARB: procedure(target: GLenum; pname: GLenum; _string: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVertexAttribdvARB: procedure(index: GLuint; pname: GLenum; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVertexAttribfvARB: procedure(index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVertexAttribivARB: procedure(index: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVertexAttribPointervARB: procedure(index: GLuint; pname: GLenum; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsProgramARB: function(_program: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1sARB: procedure(index: GLuint; x: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1fARB: procedure(index: GLuint; x: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1dARB: procedure(index: GLuint; x: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2sARB: procedure(index: GLuint; x: GLshort; y: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2fARB: procedure(index: GLuint; x: GLfloat; y: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2dARB: procedure(index: GLuint; x: GLdouble; y: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3sARB: procedure(index: GLuint; x: GLshort; y: GLshort; z: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3fARB: procedure(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3dARB: procedure(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4sARB: procedure(index: GLuint; x: GLshort; y: GLshort; z: GLshort; w: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4fARB: procedure(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4dARB: procedure(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4NubARB: procedure(index: GLuint; x: GLubyte; y: GLubyte; z: GLubyte; w: GLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1svARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1fvARB: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1dvARB: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2svARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2fvARB: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2dvARB: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3svARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3fvARB: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3dvARB: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4bvARB: procedure(index: GLuint; const v: PGLbyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4svARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4ivARB: procedure(index: GLuint; const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4ubvARB: procedure(index: GLuint; const v: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4usvARB: procedure(index: GLuint; const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4uivARB: procedure(index: GLuint; const v: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4fvARB: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4dvARB: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4NbvARB: procedure(index: GLuint; const v: PGLbyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4NsvARB: procedure(index: GLuint; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4NivARB: procedure(index: GLuint; const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4NubvARB: procedure(index: GLuint; const v: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4NusvARB: procedure(index: GLuint; const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4NuivARB: procedure(index: GLuint; const v: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribPointerARB: procedure(index: GLuint; size: GLint; _type: GLenum; normalized: GLboolean; stride: GLsizei; const pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEnableVertexAttribArrayARB: procedure(index: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDisableVertexAttribArrayARB: procedure(index: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramStringARB: procedure(target: GLenum; format: GLenum; len: GLsizei; const _string: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindProgramARB: procedure(target: GLenum; _program: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteProgramsARB: procedure(n: GLsizei; const programs: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenProgramsARB: procedure(n: GLsizei; programs: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramEnvParameter4dARB: procedure(target: GLenum; index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramEnvParameter4dvARB: procedure(target: GLenum; index: GLuint; const params: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramEnvParameter4fARB: procedure(target: GLenum; index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramEnvParameter4fvARB: procedure(target: GLenum; index: GLuint; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramLocalParameter4dARB: procedure(target: GLenum; index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramLocalParameter4dvARB: procedure(target: GLenum; index: GLuint; const params: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramLocalParameter4fARB: procedure(target: GLenum; index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramLocalParameter4fvARB: procedure(target: GLenum; index: GLuint; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramEnvParameterdvARB: procedure(target: GLenum; index: GLuint; params: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramEnvParameterfvARB: procedure(target: GLenum; index: GLuint; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramLocalParameterdvARB: procedure(target: GLenum; index: GLuint; params: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramLocalParameterfvARB: procedure(target: GLenum; index: GLuint; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramivARB: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramStringARB: procedure(target: GLenum; pname: GLenum; _string: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribdvARB: procedure(index: GLuint; pname: GLenum; params: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribfvARB: procedure(index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribivARB: procedure(index: GLuint; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribPointervARB: procedure(index: GLuint; pname: GLenum; pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsProgramARB: function(_program: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ARB_vertex_program: Boolean; //***** GL_ARB_window_pos *****// var - glWindowPos2dARB: procedure(x: GLdouble; y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2fARB: procedure(x: GLfloat; y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2iARB: procedure(x: GLint; y: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2sARB: procedure(x: GLshort; y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2dvARB: procedure(const p: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2fvARB: procedure(const p: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2ivARB: procedure(const p: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2svARB: procedure(const p: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3dARB: procedure(x: GLdouble; y: GLdouble; z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3fARB: procedure(x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3iARB: procedure(x: GLint; y: GLint; z: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3sARB: procedure(x: GLshort; y: GLshort; z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3dvARB: procedure(const p: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3fvARB: procedure(const p: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3ivARB: procedure(const p: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3svARB: procedure(const p: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2dARB: procedure(x: GLdouble; y: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2fARB: procedure(x: GLfloat; y: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2iARB: procedure(x: GLint; y: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2sARB: procedure(x: GLshort; y: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2dvARB: procedure(const p: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2fvARB: procedure(const p: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2ivARB: procedure(const p: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2svARB: procedure(const p: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3dARB: procedure(x: GLdouble; y: GLdouble; z: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3fARB: procedure(x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3iARB: procedure(x: GLint; y: GLint; z: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3sARB: procedure(x: GLshort; y: GLshort; z: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3dvARB: procedure(const p: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3fvARB: procedure(const p: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3ivARB: procedure(const p: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3svARB: procedure(const p: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ARB_window_pos: Boolean; @@ -913,7 +930,7 @@ const GL_ONE_MINUS_CONSTANT_ALPHA_EXT = $8004; GL_BLEND_COLOR_EXT = $8005; var - glBlendColorEXT: procedure(red: GLclampf; green: GLclampf; blue: GLclampf; alpha: GLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBlendColorEXT: procedure(red: GLclampf; green: GLclampf; blue: GLclampf; alpha: GLclampf); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_EXT_blend_color: Boolean; @@ -924,7 +941,7 @@ const GL_BLEND_DST_ALPHA_EXT = $80CA; GL_BLEND_SRC_ALPHA_EXT = $80CB; var - glBlendFuncSeparateEXT: procedure(sfactorRGB: GLenum; dfactorRGB: GLenum; sfactorAlpha: GLenum; dfactorAlpha: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBlendFuncSeparateEXT: procedure(sfactorRGB: GLenum; dfactorRGB: GLenum; sfactorAlpha: GLenum; dfactorAlpha: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_EXT_blend_func_separate: Boolean; @@ -939,7 +956,7 @@ const GL_MAX_EXT = $8008; GL_BLEND_EQUATION_EXT = $8009; var - glBlendEquationEXT: procedure(mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBlendEquationEXT: procedure(mode: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_EXT_blend_minmax: Boolean; @@ -958,8 +975,8 @@ function Load_GL_EXT_clip_volume_hint: Boolean; //***** GL_EXT_color_subtable *****// var - glColorSubTableEXT: procedure(target: GLenum; start: GLsizei; count: GLsizei; format: GLenum; _type: GLenum; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyColorSubTableEXT: procedure(target: GLenum; start: GLsizei; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorSubTableEXT: procedure(target: GLenum; start: GLsizei; count: GLsizei; format: GLenum; _type: GLenum; const data: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyColorSubTableEXT: procedure(target: GLenum; start: GLsizei; x: GLint; y: GLint; width: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_EXT_color_subtable: Boolean; @@ -968,8 +985,8 @@ const GL_ARRAY_ELEMENT_LOCK_FIRST_EXT = $81A8; GL_ARRAY_ELEMENT_LOCK_COUNT_EXT = $81A9; var - glLockArraysEXT: procedure(first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUnlockArraysEXT: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glLockArraysEXT: procedure(first: GLint; count: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUnlockArraysEXT: procedure(); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_EXT_compiled_vertex_array: Boolean; @@ -996,19 +1013,19 @@ const GL_POST_CONVOLUTION_BLUE_BIAS_EXT = $8022; GL_POST_CONVOLUTION_ALPHA_BIAS_EXT = $8023; var - glConvolutionFilter1DEXT: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glConvolutionFilter2DEXT: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyConvolutionFilter1DEXT: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyConvolutionFilter2DEXT: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei; height: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetConvolutionFilterEXT: procedure(target: GLenum; format: GLenum; _type: GLenum; image: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSeparableFilter2DEXT: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const row: PGLvoid; const column: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetSeparableFilterEXT: procedure(target: GLenum; format: GLenum; _type: GLenum; row: PGLvoid; column: PGLvoid; span: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glConvolutionParameteriEXT: procedure(target: GLenum; pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glConvolutionParameterivEXT: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glConvolutionParameterfEXT: procedure(target: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glConvolutionParameterfvEXT: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetConvolutionParameterivEXT: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetConvolutionParameterfvEXT: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionFilter1DEXT: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const image: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionFilter2DEXT: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const image: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyConvolutionFilter1DEXT: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyConvolutionFilter2DEXT: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei; height: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetConvolutionFilterEXT: procedure(target: GLenum; format: GLenum; _type: GLenum; image: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSeparableFilter2DEXT: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const row: PGLvoid; const column: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetSeparableFilterEXT: procedure(target: GLenum; format: GLenum; _type: GLenum; row: PGLvoid; column: PGLvoid; span: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameteriEXT: procedure(target: GLenum; pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameterivEXT: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameterfEXT: procedure(target: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glConvolutionParameterfvEXT: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetConvolutionParameterivEXT: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetConvolutionParameterfvEXT: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_EXT_convolution: Boolean; @@ -1028,23 +1045,23 @@ const GL_MINMAX_FORMAT_EXT = $802F; GL_MINMAX_SINK_EXT = $8030; var - glHistogramEXT: procedure(target: GLenum; width: GLsizei; internalformat: GLenum; sink: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glResetHistogramEXT: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetHistogramEXT: procedure(target: GLenum; reset: GLboolean; format: GLenum; _type: GLenum; values: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetHistogramParameterivEXT: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetHistogramParameterfvEXT: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMinmaxEXT: procedure(target: GLenum; internalformat: GLenum; sink: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glResetMinmaxEXT: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMinmaxEXT: procedure(target: GLenum; reset: GLboolean; format: GLenum; _type: GLenum; values: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMinmaxParameterivEXT: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMinmaxParameterfvEXT: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glHistogramEXT: procedure(target: GLenum; width: GLsizei; internalformat: GLenum; sink: GLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glResetHistogramEXT: procedure(target: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetHistogramEXT: procedure(target: GLenum; reset: GLboolean; format: GLenum; _type: GLenum; values: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetHistogramParameterivEXT: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetHistogramParameterfvEXT: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMinmaxEXT: procedure(target: GLenum; internalformat: GLenum; sink: GLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glResetMinmaxEXT: procedure(target: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMinmaxEXT: procedure(target: GLenum; reset: GLboolean; format: GLenum; _type: GLenum; values: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMinmaxParameterivEXT: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMinmaxParameterfvEXT: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_EXT_histogram: Boolean; //***** GL_EXT_multi_draw_arrays *****// var - glMultiDrawArraysEXT: procedure(mode: GLenum; first: PGLint; count: PGLsizei; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiDrawElementsEXT: procedure(mode: GLenum; count: PGLsizei; _type: GLenum; const indices: PGLvoid; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiDrawArraysEXT: procedure(mode: GLenum; first: PGLint; count: PGLsizei; primcount: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiDrawElementsEXT: procedure(mode: GLenum; count: PGLsizei; _type: GLenum; const indices: PGLvoid; primcount: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_EXT_multi_draw_arrays: Boolean; @@ -1088,11 +1105,11 @@ const // GL_TEXTURE_3D_EXT { already defined } // GL_TEXTURE_CUBE_MAP_ARB { already defined } var - glColorTableEXT: procedure(target: GLenum; internalFormat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorTableEXT: procedure(target: GLenum; internalFormat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const data: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} // glColorSubTableEXT { already defined } - glGetColorTableEXT: procedure(target: GLenum; format: GLenum; _type: GLenum; data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetColorTableParameterivEXT: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetColorTableParameterfvEXT: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTableEXT: procedure(target: GLenum; format: GLenum; _type: GLenum; data: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTableParameterivEXT: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTableParameterfvEXT: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_EXT_paletted_texture: Boolean; @@ -1103,8 +1120,8 @@ const GL_POINT_FADE_THRESHOLD_SIZE_EXT = $8128; GL_DISTANCE_ATTENUATION_EXT = $8129; var - glPointParameterfEXT: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPointParameterfvEXT: procedure(pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPointParameterfEXT: procedure(pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPointParameterfvEXT: procedure(pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_EXT_point_parameters: Boolean; @@ -1114,7 +1131,7 @@ const GL_POLYGON_OFFSET_FACTOR_EXT = $8038; GL_POLYGON_OFFSET_BIAS_EXT = $8039; var - glPolygonOffsetEXT: procedure(factor: GLfloat; bias: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPolygonOffsetEXT: procedure(factor: GLfloat; bias: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_EXT_polygon_offset: Boolean; @@ -1141,7 +1158,7 @@ const GL_STENCIL_TEST_TWO_SIDE_EXT = $8910; GL_ACTIVE_STENCIL_FACE_EXT = $8911; var - glActiveStencilFaceEXT: procedure(face: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glActiveStencilFaceEXT: procedure(face: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_EXT_stencil_two_side: Boolean; @@ -1154,9 +1171,9 @@ function Load_GL_EXT_stencil_wrap: Boolean; //***** GL_EXT_subtexture *****// var - glTexSubImage1DEXT: procedure(target: GLenum; level: GLint; xoffset: GLint; width: GLsizei; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexSubImage2DEXT: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexSubImage3DEXT: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexSubImage1DEXT: procedure(target: GLenum; level: GLint; xoffset: GLint; width: GLsizei; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexSubImage2DEXT: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; height: GLsizei; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexSubImage3DEXT: procedure(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_EXT_subtexture: Boolean; @@ -1172,7 +1189,7 @@ const GL_TEXTURE_WRAP_R_EXT = $8072; GL_MAX_3D_TEXTURE_SIZE_EXT = $8073; var - glTexImage3DEXT: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexImage3DEXT: procedure(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; format: GLenum; _type: GLenum; const pixels: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_EXT_texture3D: Boolean; @@ -1245,12 +1262,12 @@ const GL_TEXTURE_2D_BINDING_EXT = $8069; GL_TEXTURE_3D_BINDING_EXT = $806A; var - glGenTexturesEXT: procedure(n: GLsizei; textures: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteTexturesEXT: procedure(n: GLsizei; const textures: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBindTextureEXT: procedure(target: GLenum; texture: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPrioritizeTexturesEXT: procedure(n: GLsizei; const textures: PGLuint; const priorities: PGLclampf); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glAreTexturesResidentEXT: function(n: GLsizei; const textures: PGLuint; residences: PGLboolean): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsTextureEXT: function(texture: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenTexturesEXT: procedure(n: GLsizei; textures: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteTexturesEXT: procedure(n: GLsizei; const textures: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindTextureEXT: procedure(target: GLenum; texture: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPrioritizeTexturesEXT: procedure(n: GLsizei; const textures: PGLuint; const priorities: PGLclampf); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glAreTexturesResidentEXT: function(n: GLsizei; const textures: PGLuint; residences: PGLboolean): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsTextureEXT: function(texture: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_EXT_texture_object: Boolean; @@ -1290,15 +1307,15 @@ const GL_TEXTURE_COORD_ARRAY_POINTER_EXT = $8092; GL_EDGE_FLAG_ARRAY_POINTER_EXT = $8093; var - glArrayElementEXT: procedure(i: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDrawArraysEXT: procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalPointerEXT: procedure(_type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIndexPointerEXT: procedure(_type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoordPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEdgeFlagPointerEXT: procedure(stride: GLsizei; count: GLsizei; const pointer: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetPointervEXT: procedure(pname: GLenum; params: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glArrayElementEXT: procedure(i: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawArraysEXT: procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalPointerEXT: procedure(_type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexPointerEXT: procedure(_type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoordPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEdgeFlagPointerEXT: procedure(stride: GLsizei; count: GLsizei; const pointer: PGLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPointervEXT: procedure(pname: GLenum; params: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_EXT_vertex_array: Boolean; @@ -1415,48 +1432,48 @@ const GL_CURRENT_VERTEX_EXT = $87E2; GL_MVP_MATRIX_EXT = $87E3; var - glBeginVertexShaderEXT: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEndVertexShaderEXT: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBindVertexShaderEXT: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGenVertexShadersEXT: function(range: GLuint): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteVertexShaderEXT: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glShaderOp1EXT: procedure(op: GLenum; res: GLuint; arg1: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glShaderOp2EXT: procedure(op: GLenum; res: GLuint; arg1: GLuint; arg2: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glShaderOp3EXT: procedure(op: GLenum; res: GLuint; arg1: GLuint; arg2: GLuint; arg3: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSwizzleEXT: procedure(res: GLuint; _in: GLuint; outX: GLenum; outY: GLenum; outZ: GLenum; outW: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWriteMaskEXT: procedure(res: GLuint; _in: GLuint; outX: GLenum; outY: GLenum; outZ: GLenum; outW: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glInsertComponentEXT: procedure(res: GLuint; src: GLuint; num: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glExtractComponentEXT: procedure(res: GLuint; src: GLuint; num: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGenSymbolsEXT: function(datatype: GLenum; storagetype: GLenum; range: GLenum; components: GLuint): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSetInvariantEXT: procedure(id: GLuint; _type: GLenum; addr: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSetLocalConstantEXT: procedure(id: GLuint; _type: GLenum; addr: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVariantbvEXT: procedure(id: GLuint; addr: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVariantsvEXT: procedure(id: GLuint; addr: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVariantivEXT: procedure(id: GLuint; addr: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVariantfvEXT: procedure(id: GLuint; addr: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVariantdvEXT: procedure(id: GLuint; addr: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVariantubvEXT: procedure(id: GLuint; addr: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVariantusvEXT: procedure(id: GLuint; addr: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVariantuivEXT: procedure(id: GLuint; addr: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVariantPointerEXT: procedure(id: GLuint; _type: GLenum; stride: GLuint; addr: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEnableVariantClientStateEXT: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDisableVariantClientStateEXT: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBindLightParameterEXT: function(light: GLenum; value: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBindMaterialParameterEXT: function(face: GLenum; value: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBindTexGenParameterEXT: function(_unit: GLenum; coord: GLenum; value: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBindTextureUnitParameterEXT: function(_unit: GLenum; value: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBindParameterEXT: function(value: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsVariantEnabledEXT: function(id: GLuint; cap: GLenum): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVariantBooleanvEXT: procedure(id: GLuint; value: GLenum; data: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVariantIntegervEXT: procedure(id: GLuint; value: GLenum; data: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVariantFloatvEXT: procedure(id: GLuint; value: GLenum; data: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVariantPointervEXT: procedure(id: GLuint; value: GLenum; data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetInvariantBooleanvEXT: procedure(id: GLuint; value: GLenum; data: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetInvariantIntegervEXT: procedure(id: GLuint; value: GLenum; data: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetInvariantFloatvEXT: procedure(id: GLuint; value: GLenum; data: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetLocalConstantBooleanvEXT: procedure(id: GLuint; value: GLenum; data: PGLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetLocalConstantIntegervEXT: procedure(id: GLuint; value: GLenum; data: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetLocalConstantFloatvEXT: procedure(id: GLuint; value: GLenum; data: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBeginVertexShaderEXT: procedure(); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEndVertexShaderEXT: procedure(); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindVertexShaderEXT: procedure(id: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenVertexShadersEXT: function(range: GLuint): GLuint; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteVertexShaderEXT: procedure(id: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glShaderOp1EXT: procedure(op: GLenum; res: GLuint; arg1: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glShaderOp2EXT: procedure(op: GLenum; res: GLuint; arg1: GLuint; arg2: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glShaderOp3EXT: procedure(op: GLenum; res: GLuint; arg1: GLuint; arg2: GLuint; arg3: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSwizzleEXT: procedure(res: GLuint; _in: GLuint; outX: GLenum; outY: GLenum; outZ: GLenum; outW: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWriteMaskEXT: procedure(res: GLuint; _in: GLuint; outX: GLenum; outY: GLenum; outZ: GLenum; outW: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glInsertComponentEXT: procedure(res: GLuint; src: GLuint; num: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glExtractComponentEXT: procedure(res: GLuint; src: GLuint; num: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenSymbolsEXT: function(datatype: GLenum; storagetype: GLenum; range: GLenum; components: GLuint): GLuint; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSetInvariantEXT: procedure(id: GLuint; _type: GLenum; addr: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSetLocalConstantEXT: procedure(id: GLuint; _type: GLenum; addr: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantbvEXT: procedure(id: GLuint; addr: PGLbyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantsvEXT: procedure(id: GLuint; addr: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantivEXT: procedure(id: GLuint; addr: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantfvEXT: procedure(id: GLuint; addr: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantdvEXT: procedure(id: GLuint; addr: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantubvEXT: procedure(id: GLuint; addr: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantusvEXT: procedure(id: GLuint; addr: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantuivEXT: procedure(id: GLuint; addr: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantPointerEXT: procedure(id: GLuint; _type: GLenum; stride: GLuint; addr: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEnableVariantClientStateEXT: procedure(id: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDisableVariantClientStateEXT: procedure(id: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindLightParameterEXT: function(light: GLenum; value: GLenum): GLuint; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindMaterialParameterEXT: function(face: GLenum; value: GLenum): GLuint; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindTexGenParameterEXT: function(_unit: GLenum; coord: GLenum; value: GLenum): GLuint; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindTextureUnitParameterEXT: function(_unit: GLenum; value: GLenum): GLuint; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindParameterEXT: function(value: GLenum): GLuint; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsVariantEnabledEXT: function(id: GLuint; cap: GLenum): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVariantBooleanvEXT: procedure(id: GLuint; value: GLenum; data: PGLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVariantIntegervEXT: procedure(id: GLuint; value: GLenum; data: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVariantFloatvEXT: procedure(id: GLuint; value: GLenum; data: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVariantPointervEXT: procedure(id: GLuint; value: GLenum; data: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetInvariantBooleanvEXT: procedure(id: GLuint; value: GLenum; data: PGLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetInvariantIntegervEXT: procedure(id: GLuint; value: GLenum; data: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetInvariantFloatvEXT: procedure(id: GLuint; value: GLenum; data: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetLocalConstantBooleanvEXT: procedure(id: GLuint; value: GLenum; data: PGLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetLocalConstantIntegervEXT: procedure(id: GLuint; value: GLenum; data: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetLocalConstantFloatvEXT: procedure(id: GLuint; value: GLenum; data: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_EXT_vertex_shader: Boolean; @@ -1476,9 +1493,9 @@ const GL_MODELVIEW1_STACK_DEPTH_EXT = $8502; GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT = $8510; var - glVertexWeightfEXT: procedure(weight: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexWeightfvEXT: procedure(weight: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexWeightPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexWeightfEXT: procedure(weight: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexWeightfvEXT: procedure(weight: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexWeightPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_EXT_vertex_weighting: Boolean; @@ -1533,15 +1550,15 @@ const GL_MAX_MAP_TESSELLATION_NV = $86D6; GL_MAX_RATIONAL_EVAL_ORDER_NV = $86D7; var - glMapControlPointsNV: procedure(target: GLenum; index: GLuint; _type: GLenum; ustride: GLsizei; vstride: GLsizei; uorder: GLint; vorder: GLint; _packed: GLboolean; const points: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMapParameterivNV: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMapParameterfvNV: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMapControlPointsNV: procedure(target: GLenum; index: GLuint; _type: GLenum; ustride: GLsizei; vstride: GLsizei; _packed: GLboolean; points: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMapParameterivNV: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMapParameterfvNV: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMapAttribParameterivNV: procedure(target: GLenum; index: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetMapAttribParameterfvNV: procedure(target: GLenum; index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEvalMapsNV: procedure(target: GLenum; mode: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapControlPointsNV: procedure(target: GLenum; index: GLuint; _type: GLenum; ustride: GLsizei; vstride: GLsizei; uorder: GLint; vorder: GLint; _packed: GLboolean; const points: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapParameterivNV: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapParameterfvNV: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapControlPointsNV: procedure(target: GLenum; index: GLuint; _type: GLenum; ustride: GLsizei; vstride: GLsizei; _packed: GLboolean; points: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapParameterivNV: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapParameterfvNV: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapAttribParameterivNV: procedure(target: GLenum; index: GLuint; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapAttribParameterfvNV: procedure(target: GLenum; index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalMapsNV: procedure(target: GLenum; mode: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_NV_evaluators: Boolean; @@ -1551,13 +1568,13 @@ const GL_FENCE_STATUS_NV = $84F3; GL_FENCE_CONDITION_NV = $84F4; var - glGenFencesNV: procedure(n: GLsizei; fences: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteFencesNV: procedure(n: GLsizei; const fences: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSetFenceNV: procedure(fence: GLuint; condition: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTestFenceNV: function(fence: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFinishFenceNV: procedure(fence: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsFenceNV: function(fence: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetFenceivNV: procedure(fence: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenFencesNV: procedure(n: GLsizei; fences: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteFencesNV: procedure(n: GLsizei; const fences: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSetFenceNV: procedure(fence: GLuint; condition: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTestFenceNV: function(fence: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFinishFenceNV: procedure(fence: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsFenceNV: function(fence: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetFenceivNV: procedure(fence: GLuint; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_NV_fence: Boolean; @@ -1591,13 +1608,13 @@ const GL_PIXEL_COUNT_NV = $8866; GL_PIXEL_COUNT_AVAILABLE_NV = $8867; var - glGenOcclusionQueriesNV: procedure(n: GLsizei; ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteOcclusionQueriesNV: procedure(n: GLsizei; const ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsOcclusionQueryNV: function(id: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBeginOcclusionQueryNV: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEndOcclusionQueryNV: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetOcclusionQueryivNV: procedure(id: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetOcclusionQueryuivNV: procedure(id: GLuint; pname: GLenum; params: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenOcclusionQueriesNV: procedure(n: GLsizei; ids: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteOcclusionQueriesNV: procedure(n: GLsizei; const ids: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsOcclusionQueryNV: function(id: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBeginOcclusionQueryNV: procedure(id: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEndOcclusionQueryNV: procedure(); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetOcclusionQueryivNV: procedure(id: GLuint; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetOcclusionQueryuivNV: procedure(id: GLuint; pname: GLenum; params: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_NV_occlusion_query: Boolean; @@ -1614,8 +1631,8 @@ const GL_COORD_REPLACE_NV = $8862; GL_POINT_SPRITE_R_MODE_NV = $8863; var - glPointParameteriNV: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPointParameterivNV: procedure(pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPointParameteriNV: procedure(pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPointParameterivNV: procedure(pname: GLenum; const params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_NV_point_sprite: Boolean; @@ -1673,19 +1690,19 @@ const GL_COLOR_SUM_CLAMP_NV = $854F; GL_MAX_GENERAL_COMBINERS_NV = $854D; var - glCombinerParameterfvNV: procedure(pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCombinerParameterivNV: procedure(pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCombinerParameterfNV: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCombinerParameteriNV: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCombinerInputNV: procedure(stage: GLenum; portion: GLenum; variable: GLenum; input: GLenum; mapping: GLenum; componentUsage: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCombinerOutputNV: procedure(stage: GLenum; portion: GLenum; abOutput: GLenum; cdOutput: GLenum; sumOutput: GLenum; scale: GLenum; bias: GLenum; abDotProduct: GLboolean; cdDotProduct: GLboolean; muxSum: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFinalCombinerInputNV: procedure(variable: GLenum; input: GLenum; mapping: GLenum; componentUsage: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetCombinerInputParameterfvNV: procedure(stage: GLenum; portion: GLenum; variable: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetCombinerInputParameterivNV: procedure(stage: GLenum; portion: GLenum; variable: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetCombinerOutputParameterfvNV: procedure(stage: GLenum; portion: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetCombinerOutputParameterivNV: procedure(stage: GLenum; portion: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetFinalCombinerInputParameterfvNV: procedure(variable: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetFinalCombinerInputParameterivNV: procedure(variable: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCombinerParameterfvNV: procedure(pname: GLenum; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCombinerParameterivNV: procedure(pname: GLenum; const params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCombinerParameterfNV: procedure(pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCombinerParameteriNV: procedure(pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCombinerInputNV: procedure(stage: GLenum; portion: GLenum; variable: GLenum; input: GLenum; mapping: GLenum; componentUsage: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCombinerOutputNV: procedure(stage: GLenum; portion: GLenum; abOutput: GLenum; cdOutput: GLenum; sumOutput: GLenum; scale: GLenum; bias: GLenum; abDotProduct: GLboolean; cdDotProduct: GLboolean; muxSum: GLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFinalCombinerInputNV: procedure(variable: GLenum; input: GLenum; mapping: GLenum; componentUsage: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetCombinerInputParameterfvNV: procedure(stage: GLenum; portion: GLenum; variable: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetCombinerInputParameterivNV: procedure(stage: GLenum; portion: GLenum; variable: GLenum; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetCombinerOutputParameterfvNV: procedure(stage: GLenum; portion: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetCombinerOutputParameterivNV: procedure(stage: GLenum; portion: GLenum; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetFinalCombinerInputParameterfvNV: procedure(variable: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetFinalCombinerInputParameterivNV: procedure(variable: GLenum; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_NV_register_combiners: Boolean; @@ -1693,8 +1710,8 @@ function Load_GL_NV_register_combiners: Boolean; const GL_PER_STAGE_CONSTANTS_NV = $8535; var - glCombinerStageParameterfvNV: procedure(stage: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetCombinerStageParameterfvNV: procedure(stage: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCombinerStageParameterfvNV: procedure(stage: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetCombinerStageParameterfvNV: procedure(stage: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_NV_register_combiners2: Boolean; @@ -1878,11 +1895,11 @@ const GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV = $8520; GL_VERTEX_ARRAY_RANGE_POINTER_NV = $8521; var - glVertexArrayRangeNV: procedure(length: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFlushVertexArrayRangeNV: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} -{$IFDEF Win32} - wglAllocateMemoryNV: function(size: GLsizei; readFrequency: GLfloat; writeFrequency: GLfloat; priority: GLfloat): PGLvoid; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglFreeMemoryNV: procedure(pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexArrayRangeNV: procedure(length: GLsizei; pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFlushVertexArrayRangeNV: procedure(); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} +{$IFDEF WINDOWS} + wglAllocateMemoryNV: function(size: GLsizei; readFrequency: GLfloat; writeFrequency: GLfloat; priority: GLfloat): PGLvoid; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglFreeMemoryNV: procedure(pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} {$ENDIF} function Load_GL_NV_vertex_array_range: Boolean; @@ -1979,68 +1996,68 @@ const GL_MAP2_VERTEX_ATTRIB14_4_NV = $867E; GL_MAP2_VERTEX_ATTRIB15_4_NV = $867F; var - glBindProgramNV: procedure(target: GLenum; id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteProgramsNV: procedure(n: GLsizei; const ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glExecuteProgramNV: procedure(target: GLenum; id: GLuint; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGenProgramsNV: procedure(n: GLsizei; ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glAreProgramsResidentNV: function(n: GLsizei; const ids: PGLuint; residences: PGLboolean): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glRequestResidentProgramsNV: procedure(n: GLsizei; ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramParameterfvNV: procedure(target: GLenum; index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramParameterdvNV: procedure(target: GLenum; index: GLuint; pname: GLenum; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramivNV: procedure(id: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramStringNV: procedure(id: GLuint; pname: GLenum; _program: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTrackMatrixivNV: procedure(target: GLenum; address: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVertexAttribdvNV: procedure(index: GLuint; pname: GLenum; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVertexAttribfvNV: procedure(index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVertexAttribivNV: procedure(index: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVertexAttribPointervNV: procedure(index: GLuint; pname: GLenum; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsProgramNV: function(id: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLoadProgramNV: procedure(target: GLenum; id: GLuint; len: GLsizei; const _program: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramParameter4fNV: procedure(target: GLenum; index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramParameter4fvNV: procedure(target: GLenum; index: GLuint; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramParameters4dvNV: procedure(target: GLenum; index: GLuint; num: GLuint; const params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramParameters4fvNV: procedure(target: GLenum; index: GLuint; num: GLuint; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTrackMatrixNV: procedure(target: GLenum; address: GLuint; matrix: GLenum; transform: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribPointerNV: procedure(index: GLuint; size: GLint; _type: GLenum; stride: GLsizei; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1sNV: procedure(index: GLuint; x: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1fNV: procedure(index: GLuint; x: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1dNV: procedure(index: GLuint; x: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2sNV: procedure(index: GLuint; x: GLshort; y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2fNV: procedure(index: GLuint; x: GLfloat; y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2dNV: procedure(index: GLuint; x: GLdouble; y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3sNV: procedure(index: GLuint; x: GLshort; y: GLshort; z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3fNV: procedure(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3dNV: procedure(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4sNV: procedure(index: GLuint; x: GLshort; y: GLshort; z: GLshort; w: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4fNV: procedure(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4dNV: procedure(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4ubNV: procedure(index: GLuint; x: GLubyte; y: GLubyte; z: GLubyte; w: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1svNV: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1fvNV: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1dvNV: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2svNV: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2fvNV: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2dvNV: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3svNV: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3fvNV: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3dvNV: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4svNV: procedure(index: GLuint; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4fvNV: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4dvNV: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4ubvNV: procedure(index: GLuint; const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs1svNV: procedure(index: GLuint; n: GLsizei; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs1fvNV: procedure(index: GLuint; n: GLsizei; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs1dvNV: procedure(index: GLuint; n: GLsizei; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs2svNV: procedure(index: GLuint; n: GLsizei; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs2fvNV: procedure(index: GLuint; n: GLsizei; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs2dvNV: procedure(index: GLuint; n: GLsizei; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs3svNV: procedure(index: GLuint; n: GLsizei; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs3fvNV: procedure(index: GLuint; n: GLsizei; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs3dvNV: procedure(index: GLuint; n: GLsizei; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs4svNV: procedure(index: GLuint; n: GLsizei; const v: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs4fvNV: procedure(index: GLuint; n: GLsizei; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs4dvNV: procedure(index: GLuint; n: GLsizei; const v: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs4ubvNV: procedure(index: GLuint; n: GLsizei; const v: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindProgramNV: procedure(target: GLenum; id: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteProgramsNV: procedure(n: GLsizei; const ids: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glExecuteProgramNV: procedure(target: GLenum; id: GLuint; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenProgramsNV: procedure(n: GLsizei; ids: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glAreProgramsResidentNV: function(n: GLsizei; const ids: PGLuint; residences: PGLboolean): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRequestResidentProgramsNV: procedure(n: GLsizei; ids: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramParameterfvNV: procedure(target: GLenum; index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramParameterdvNV: procedure(target: GLenum; index: GLuint; pname: GLenum; params: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramivNV: procedure(id: GLuint; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramStringNV: procedure(id: GLuint; pname: GLenum; _program: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTrackMatrixivNV: procedure(target: GLenum; address: GLuint; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribdvNV: procedure(index: GLuint; pname: GLenum; params: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribfvNV: procedure(index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribivNV: procedure(index: GLuint; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribPointervNV: procedure(index: GLuint; pname: GLenum; pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsProgramNV: function(id: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadProgramNV: procedure(target: GLenum; id: GLuint; len: GLsizei; const _program: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramParameter4fNV: procedure(target: GLenum; index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramParameter4fvNV: procedure(target: GLenum; index: GLuint; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramParameters4dvNV: procedure(target: GLenum; index: GLuint; num: GLuint; const params: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramParameters4fvNV: procedure(target: GLenum; index: GLuint; num: GLuint; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTrackMatrixNV: procedure(target: GLenum; address: GLuint; matrix: GLenum; transform: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribPointerNV: procedure(index: GLuint; size: GLint; _type: GLenum; stride: GLsizei; const pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1sNV: procedure(index: GLuint; x: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1fNV: procedure(index: GLuint; x: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1dNV: procedure(index: GLuint; x: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2sNV: procedure(index: GLuint; x: GLshort; y: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2fNV: procedure(index: GLuint; x: GLfloat; y: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2dNV: procedure(index: GLuint; x: GLdouble; y: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3sNV: procedure(index: GLuint; x: GLshort; y: GLshort; z: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3fNV: procedure(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3dNV: procedure(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4sNV: procedure(index: GLuint; x: GLshort; y: GLshort; z: GLshort; w: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4fNV: procedure(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4dNV: procedure(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4ubNV: procedure(index: GLuint; x: GLubyte; y: GLubyte; z: GLubyte; w: GLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1svNV: procedure(index: GLuint; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1fvNV: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1dvNV: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2svNV: procedure(index: GLuint; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2fvNV: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2dvNV: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3svNV: procedure(index: GLuint; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3fvNV: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3dvNV: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4svNV: procedure(index: GLuint; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4fvNV: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4dvNV: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4ubvNV: procedure(index: GLuint; const v: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs1svNV: procedure(index: GLuint; n: GLsizei; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs1fvNV: procedure(index: GLuint; n: GLsizei; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs1dvNV: procedure(index: GLuint; n: GLsizei; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs2svNV: procedure(index: GLuint; n: GLsizei; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs2fvNV: procedure(index: GLuint; n: GLsizei; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs2dvNV: procedure(index: GLuint; n: GLsizei; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs3svNV: procedure(index: GLuint; n: GLsizei; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs3fvNV: procedure(index: GLuint; n: GLsizei; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs3dvNV: procedure(index: GLuint; n: GLsizei; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs4svNV: procedure(index: GLuint; n: GLsizei; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs4fvNV: procedure(index: GLuint; n: GLsizei; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs4dvNV: procedure(index: GLuint; n: GLsizei; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs4ubvNV: procedure(index: GLuint; n: GLsizei; const v: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_NV_vertex_program: Boolean; @@ -2054,9 +2071,9 @@ const GL_ELEMENT_ARRAY_TYPE_ATI = $8769; GL_ELEMENT_ARRAY_POINTER_ATI = $876A; var - glElementPointerATI: procedure(_type: GLenum; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDrawElementArrayATI: procedure(mode: GLenum; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDrawRangeElementArrayATI: procedure(mode: GLenum; start: GLuint; _end: GLuint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glElementPointerATI: procedure(_type: GLenum; const pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawElementArrayATI: procedure(mode: GLenum; count: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawRangeElementArrayATI: procedure(mode: GLenum; start: GLuint; _end: GLuint; count: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ATI_element_array: Boolean; @@ -2071,10 +2088,10 @@ const GL_BUMP_ENVMAP_ATI = $877B; GL_BUMP_TARGET_ATI = $877C; var - glTexBumpParameterivATI: procedure(pname: GLenum; param: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexBumpParameterfvATI: procedure(pname: GLenum; param: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexBumpParameterivATI: procedure(pname: GLenum; param: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetTexBumpParameterfvATI: procedure(pname: GLenum; param: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexBumpParameterivATI: procedure(pname: GLenum; param: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexBumpParameterfvATI: procedure(pname: GLenum; param: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexBumpParameterivATI: procedure(pname: GLenum; param: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexBumpParameterfvATI: procedure(pname: GLenum; param: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ATI_envmap_bumpmap: Boolean; @@ -2126,20 +2143,20 @@ const GL_NEGATE_BIT_ATI = $0004; GL_BIAS_BIT_ATI = $0008; var - glGenFragmentShadersATI: function(range: GLuint): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBindFragmentShaderATI: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteFragmentShaderATI: procedure(id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBeginFragmentShaderATI: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEndFragmentShaderATI: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPassTexCoordATI: procedure(dst: GLuint; coord: GLuint; swizzle: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSampleMapATI: procedure(dst: GLuint; interp: GLuint; swizzle: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorFragmentOp1ATI: procedure(op: GLenum; dst: GLuint; dstMask: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorFragmentOp2ATI: procedure(op: GLenum; dst: GLuint; dstMask: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorFragmentOp3ATI: procedure(op: GLenum; dst: GLuint; dstMask: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint; arg3: GLuint; arg3Rep: GLuint; arg3Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glAlphaFragmentOp1ATI: procedure(op: GLenum; dst: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glAlphaFragmentOp2ATI: procedure(op: GLenum; dst: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glAlphaFragmentOp3ATI: procedure(op: GLenum; dst: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint; arg3: GLuint; arg3Rep: GLuint; arg3Mod: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSetFragmentShaderConstantATI: procedure(dst: GLuint; const value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenFragmentShadersATI: function(range: GLuint): GLuint; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindFragmentShaderATI: procedure(id: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteFragmentShaderATI: procedure(id: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBeginFragmentShaderATI: procedure(); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEndFragmentShaderATI: procedure(); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPassTexCoordATI: procedure(dst: GLuint; coord: GLuint; swizzle: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSampleMapATI: procedure(dst: GLuint; interp: GLuint; swizzle: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorFragmentOp1ATI: procedure(op: GLenum; dst: GLuint; dstMask: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorFragmentOp2ATI: procedure(op: GLenum; dst: GLuint; dstMask: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorFragmentOp3ATI: procedure(op: GLenum; dst: GLuint; dstMask: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint; arg3: GLuint; arg3Rep: GLuint; arg3Mod: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glAlphaFragmentOp1ATI: procedure(op: GLenum; dst: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glAlphaFragmentOp2ATI: procedure(op: GLenum; dst: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glAlphaFragmentOp3ATI: procedure(op: GLenum; dst: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint; arg3: GLuint; arg3Rep: GLuint; arg3Mod: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSetFragmentShaderConstantATI: procedure(dst: GLuint; const value: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ATI_fragment_shader: Boolean; @@ -2155,8 +2172,8 @@ const GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI = $87F7; GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI = $87F8; var - glPNTrianglesiATI: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPNTrianglesfATI: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPNTrianglesiATI: procedure(pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPNTrianglesfATI: procedure(pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ATI_pn_triangles: Boolean; @@ -2178,18 +2195,18 @@ const GL_ARRAY_OBJECT_BUFFER_ATI = $8766; GL_ARRAY_OBJECT_OFFSET_ATI = $8767; var - glNewObjectBufferATI: function(size: GLsizei; const pointer: PGLvoid; usage: GLenum): GLuint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsObjectBufferATI: function(buffer: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUpdateObjectBufferATI: procedure(buffer: GLuint; offset: GLuint; size: GLsizei; const pointer: PGLvoid; preserve: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetObjectBufferfvATI: procedure(buffer: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetObjectBufferivATI: procedure(buffer: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteObjectBufferATI: procedure(buffer: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glArrayObjectATI: procedure(_array: GLenum; size: GLint; _type: GLenum; stride: GLsizei; buffer: GLuint; offset: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetArrayObjectfvATI: procedure(_array: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetArrayObjectivATI: procedure(_array: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVariantArrayObjectATI: procedure(id: GLuint; _type: GLenum; stride: GLsizei; buffer: GLuint; offset: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVariantArrayObjectfvATI: procedure(id: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVariantArrayObjectivATI: procedure(id: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glNewObjectBufferATI: function(size: GLsizei; const pointer: PGLvoid; usage: GLenum): GLuint; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsObjectBufferATI: function(buffer: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUpdateObjectBufferATI: procedure(buffer: GLuint; offset: GLuint; size: GLsizei; const pointer: PGLvoid; preserve: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetObjectBufferfvATI: procedure(buffer: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetObjectBufferivATI: procedure(buffer: GLuint; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteObjectBufferATI: procedure(buffer: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glArrayObjectATI: procedure(_array: GLenum; size: GLint; _type: GLenum; stride: GLsizei; buffer: GLuint; offset: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetArrayObjectfvATI: procedure(_array: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetArrayObjectivATI: procedure(_array: GLenum; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVariantArrayObjectATI: procedure(id: GLuint; _type: GLenum; stride: GLsizei; buffer: GLuint; offset: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVariantArrayObjectfvATI: procedure(id: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVariantArrayObjectivATI: procedure(id: GLuint; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ATI_vertex_array_object: Boolean; @@ -2206,82 +2223,82 @@ const GL_VERTEX_STREAM7_ATI = $8773; GL_VERTEX_SOURCE_ATI = $8774; var - glVertexStream1s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream1i: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream1f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream1d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream1sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream1iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream1fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream1dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream2s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream2i: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream2f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream2d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream2sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream2iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream2fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream2dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream3s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream3i: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream3f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream3d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream3sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream3iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream3fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream3dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream4s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream4i: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream4f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream4d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream4sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream4iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream4fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexStream4dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalStream3b: procedure(stream: GLenum; coords: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalStream3s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalStream3i: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalStream3f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalStream3d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalStream3bv: procedure(stream: GLenum; coords: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalStream3sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalStream3iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalStream3fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalStream3dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glClientActiveVertexStream: procedure(stream: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexBlendEnvi: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexBlendEnvf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream1s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream1i: procedure(stream: GLenum; coords: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream1f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream1d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream1sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream1iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream1fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream1dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2i: procedure(stream: GLenum; coords: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream2dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3i: procedure(stream: GLenum; coords: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream3dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4i: procedure(stream: GLenum; coords: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexStream4dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3b: procedure(stream: GLenum; coords: GLbyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3s: procedure(stream: GLenum; coords: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3i: procedure(stream: GLenum; coords: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3f: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3d: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3bv: procedure(stream: GLenum; coords: GLbyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3sv: procedure(stream: GLenum; coords: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3iv: procedure(stream: GLenum; coords: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3fv: procedure(stream: GLenum; coords: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalStream3dv: procedure(stream: GLenum; coords: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glClientActiveVertexStream: procedure(stream: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexBlendEnvi: procedure(pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexBlendEnvf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ATI_vertex_streams: Boolean; -{$IFDEF Win32} +{$IFDEF WINDOWS} //***** WGL_I3D_image_buffer *****// const WGL_IMAGE_BUFFER_MIN_ACCESS_I3D = $0001; WGL_IMAGE_BUFFER_LOCK_I3D = $0002; var - wglCreateImageBufferI3D: function(hDC: HDC; dwSize: DWORD; uFlags: UINT): PGLvoid; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglDestroyImageBufferI3D: function(hDC: HDC; pAddress: PGLvoid): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglAssociateImageBufferEventsI3D: function(hdc: HDC; pEvent: PHandle; pAddress: PGLvoid; pSize: PDWORD; count: UINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglReleaseImageBufferEventsI3D: function(hdc: HDC; pAddress: PGLvoid; count: UINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglCreateImageBufferI3D: function(hDC: HDC; dwSize: DWORD; uFlags: UINT): PGLvoid; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglDestroyImageBufferI3D: function(hDC: HDC; pAddress: PGLvoid): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglAssociateImageBufferEventsI3D: function(hdc: HDC; pEvent: PHandle; pAddress: PGLvoid; pSize: PDWORD; count: UINT): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglReleaseImageBufferEventsI3D: function(hdc: HDC; pAddress: PGLvoid; count: UINT): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_WGL_I3D_image_buffer: Boolean; //***** WGL_I3D_swap_frame_lock *****// var - wglEnableFrameLockI3D: function(): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglDisableFrameLockI3D: function(): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglIsEnabledFrameLockI3D: function(pFlag: PBOOL): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglQueryFrameLockMasterI3D: function(pFlag: PBOOL): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglEnableFrameLockI3D: function(): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglDisableFrameLockI3D: function(): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglIsEnabledFrameLockI3D: function(pFlag: PBOOL): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglQueryFrameLockMasterI3D: function(pFlag: PBOOL): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_WGL_I3D_swap_frame_lock: Boolean; //***** WGL_I3D_swap_frame_usage *****// var - wglGetFrameUsageI3D: function(pUsage: PGLfloat): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglBeginFrameTrackingI3D: function(): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglEndFrameTrackingI3D: function(): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglQueryFrameTrackingI3D: function(pFrameCount: PDWORD; pMissedFrames: PDWORD; pLastMissedUsage: PGLfloat): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetFrameUsageI3D: function(pUsage: PGLfloat): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglBeginFrameTrackingI3D: function(): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglEndFrameTrackingI3D: function(): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglQueryFrameTrackingI3D: function(pFrameCount: PDWORD; pMissedFrames: PDWORD; pLastMissedUsage: PGLfloat): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_WGL_I3D_swap_frame_usage: Boolean; {$ENDIF} @@ -2301,8 +2318,8 @@ function Load_GL_IBM_cull_vertex: Boolean; //***** GL_IBM_multimode_draw_arrays *****// var - glMultiModeDrawArraysIBM: procedure(mode: PGLenum; first: PGLint; count: PGLsizei; primcount: GLsizei; modestride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiModeDrawElementsIBM: procedure(mode: PGLenum; count: PGLsizei; _type: GLenum; const indices: PGLvoid; primcount: GLsizei; modestride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiModeDrawArraysIBM: procedure(mode: PGLenum; first: PGLint; count: PGLsizei; primcount: GLsizei; modestride: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiModeDrawElementsIBM: procedure(mode: PGLenum; count: PGLsizei; _type: GLenum; const indices: PGLvoid; primcount: GLsizei; modestride: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_IBM_multimode_draw_arrays: Boolean; @@ -2337,48 +2354,48 @@ const GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM = $192AE; GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM = $192AF; var - glColorPointerListIBM: procedure(size: GLint; _type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColorPointerListIBM: procedure(size: GLint; _type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEdgeFlagPointerListIBM: procedure(stride: GLint; const pointer: PGLboolean; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFogCoordPointerListIBM: procedure(_type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormalPointerListIBM: procedure(_type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoordPointerListIBM: procedure(size: GLint; _type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexPointerListIBM: procedure(size: GLint; _type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorPointerListIBM: procedure(size: GLint; _type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColorPointerListIBM: procedure(size: GLint; _type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEdgeFlagPointerListIBM: procedure(stride: GLint; const pointer: PGLboolean; ptrstride: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoordPointerListIBM: procedure(_type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalPointerListIBM: procedure(_type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoordPointerListIBM: procedure(size: GLint; _type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexPointerListIBM: procedure(size: GLint; _type: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_IBM_vertex_array_lists: Boolean; //***** GL_MESA_resize_buffers *****// var - glResizeBuffersMESA: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glResizeBuffersMESA: procedure(); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_MESA_resize_buffers: Boolean; //***** GL_MESA_window_pos *****// var - glWindowPos2dMESA: procedure(x: GLdouble; y: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2fMESA: procedure(x: GLfloat; y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2iMESA: procedure(x: GLint; y: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2sMESA: procedure(x: GLshort; y: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2ivMESA: procedure(const p: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2svMESA: procedure(const p: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2fvMESA: procedure(const p: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos2dvMESA: procedure(const p: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3iMESA: procedure(x: GLint; y: GLint; z: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3sMESA: procedure(x: GLshort; y: GLshort; z: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3fMESA: procedure(x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3dMESA: procedure(x: GLdouble; y: GLdouble; z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3ivMESA: procedure(const p: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3svMESA: procedure(const p: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3fvMESA: procedure(const p: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos3dvMESA: procedure(const p: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos4iMESA: procedure(x: GLint; y: GLint; z: GLint; w: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos4sMESA: procedure(x: GLshort; y: GLshort; z: GLshort; w: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos4fMESA: procedure(x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos4dMESA: procedure(x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos4ivMESA: procedure(const p: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos4svMESA: procedure(const p: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos4fvMESA: procedure(const p: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glWindowPos4dvMESA: procedure(const p: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2dMESA: procedure(x: GLdouble; y: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2fMESA: procedure(x: GLfloat; y: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2iMESA: procedure(x: GLint; y: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2sMESA: procedure(x: GLshort; y: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2ivMESA: procedure(const p: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2svMESA: procedure(const p: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2fvMESA: procedure(const p: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2dvMESA: procedure(const p: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3iMESA: procedure(x: GLint; y: GLint; z: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3sMESA: procedure(x: GLshort; y: GLshort; z: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3fMESA: procedure(x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3dMESA: procedure(x: GLdouble; y: GLdouble; z: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3ivMESA: procedure(const p: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3svMESA: procedure(const p: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3fvMESA: procedure(const p: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3dvMESA: procedure(const p: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4iMESA: procedure(x: GLint; y: GLint; z: GLint; w: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4sMESA: procedure(x: GLshort; y: GLshort; z: GLshort; w: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4fMESA: procedure(x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4dMESA: procedure(x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4ivMESA: procedure(const p: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4svMESA: procedure(const p: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4fvMESA: procedure(const p: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos4dvMESA: procedure(const p: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_MESA_window_pos: Boolean; @@ -2437,8 +2454,8 @@ const GL_SAMPLE_MASK_INVERT_SGIS = $80AB; GL_SAMPLE_PATTERN_SGIS = $80AC; var - glSampleMaskSGIS: procedure(value: GLclampf; invert: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSamplePatternSGIS: procedure(pattern: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSampleMaskSGIS: procedure(value: GLclampf; invert: GLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSamplePatternSGIS: procedure(pattern: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_SGIS_multisample: Boolean; @@ -2449,10 +2466,10 @@ const GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS = $8355; GL_PIXEL_GROUP_COLOR_SGIS = $8356; var - glPixelTexGenParameteriSGIS: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPixelTexGenParameterfSGIS: procedure(pname: GLenum; param: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetPixelTexGenParameterivSGIS: procedure(pname: GLenum; params: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetPixelTexGenParameterfvSGIS: procedure(pname: GLenum; params: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelTexGenParameteriSGIS: procedure(pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelTexGenParameterfSGIS: procedure(pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPixelTexGenParameterivSGIS: procedure(pname: GLenum; params: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPixelTexGenParameterfvSGIS: procedure(pname: GLenum; params: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_SGIS_pixel_texture: Boolean; @@ -2465,7 +2482,7 @@ function Load_GL_SGIS_texture_border_clamp: Boolean; const GL_TEXTURE_COLOR_WRITEMASK_SGIS = $81EF; var - glTextureColorMaskSGIS: procedure(r: GLboolean; g: GLboolean; b: GLboolean; a: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glTextureColorMaskSGIS: procedure(r: GLboolean; g: GLboolean; b: GLboolean; a: GLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_SGIS_texture_color_mask: Boolean; @@ -2546,13 +2563,13 @@ const GL_COLOR_TABLE_LUMINANCE_SIZE_SGI = $80DE; GL_COLOR_TABLE_INTENSITY_SIZE_SGI = $80DF; var - glColorTableSGI: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const table: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCopyColorTableSGI: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorTableParameterivSGI: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColorTableParameterfvSGI: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetColorTableSGI: procedure(target: GLenum; format: GLenum; _type: GLenum; table: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetColorTableParameterivSGI: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetColorTableParameterfvSGI: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorTableSGI: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; _type: GLenum; const table: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyColorTableSGI: procedure(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorTableParameterivSGI: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorTableParameterfvSGI: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTableSGI: procedure(target: GLenum; format: GLenum; _type: GLenum; table: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTableParameterivSGI: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetColorTableParameterfvSGI: procedure(target: GLenum; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_SGI_color_table: Boolean; @@ -2565,46 +2582,46 @@ function Load_GL_SGI_texture_color_table: Boolean; //***** GL_SUN_vertex *****// var - glColor4ubVertex2fSUN: procedure(r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4ubVertex2fvSUN: procedure(const c: PGLubyte; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4ubVertex3fSUN: procedure(r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4ubVertex3fvSUN: procedure(const c: PGLubyte; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3fVertex3fSUN: procedure(r: GLfloat; g: GLfloat; b: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3fVertex3fvSUN: procedure(const c: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3fVertex3fSUN: procedure(nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3fVertex3fvSUN: procedure(const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4fNormal3fVertex3fSUN: procedure(r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4fNormal3fVertex3fvSUN: procedure(const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2fVertex3fSUN: procedure(s: GLfloat; t: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2fVertex3fvSUN: procedure(const tc: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4fVertex4fSUN: procedure(s: GLfloat; t: GLfloat; p: GLfloat; q: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4fVertex4fvSUN: procedure(const tc: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2fColor4ubVertex3fSUN: procedure(s: GLfloat; t: GLfloat; r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2fColor4ubVertex3fvSUN: procedure(const tc: PGLfloat; const c: PGLubyte; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2fColor3fVertex3fSUN: procedure(s: GLfloat; t: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2fColor3fVertex3fvSUN: procedure(const tc: PGLfloat; const c: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2fNormal3fVertex3fSUN: procedure(s: GLfloat; t: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2fNormal3fVertex3fvSUN: procedure(const tc: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2fColor4fNormal3fVertex3fSUN: procedure(s: GLfloat; t: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2fColor4fNormal3fVertex3fvSUN: procedure(const tc: PGLfloat; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4fColor4fNormal3fVertex4fSUN: procedure(s: GLfloat; t: GLfloat; p: GLfloat; q: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4fColor4fNormal3fVertex4fvSUN: procedure(const tc: PGLfloat; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiVertex3fSUN: procedure(rc: GLuint; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiVertex3fvSUN: procedure(const rc: PGLuint; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiColor4ubVertex3fSUN: procedure(rc: GLuint; r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiColor4ubVertex3fvSUN: procedure(const rc: PGLuint; const c: PGLubyte; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiColor3fVertex3fSUN: procedure(rc: GLuint; r: GLfloat; g: GLfloat; b: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiColor3fVertex3fvSUN: procedure(const rc: PGLuint; const c: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiNormal3fVertex3fSUN: procedure(rc: GLuint; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiNormal3fVertex3fvSUN: procedure(const rc: PGLuint; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiColor4fNormal3fVertex3fSUN: procedure(rc: GLuint; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiColor4fNormal3fVertex3fvSUN: procedure(const rc: PGLuint; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiTexCoord2fVertex3fSUN: procedure(rc: GLuint; s: GLfloat; t: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiTexCoord2fVertex3fvSUN: procedure(const rc: PGLuint; const tc: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN: procedure(rc: GLuint; s: GLfloat; t: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN: procedure(const rc: PGLuint; const tc: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN: procedure(rc: GLuint; s: GLfloat; t: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN: procedure(const rc: PGLuint; const tc: PGLfloat; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4ubVertex2fSUN: procedure(r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4ubVertex2fvSUN: procedure(const c: PGLubyte; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4ubVertex3fSUN: procedure(r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4ubVertex3fvSUN: procedure(const c: PGLubyte; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3fVertex3fSUN: procedure(r: GLfloat; g: GLfloat; b: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3fVertex3fvSUN: procedure(const c: PGLfloat; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3fVertex3fSUN: procedure(nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3fVertex3fvSUN: procedure(const n: PGLfloat; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4fNormal3fVertex3fSUN: procedure(r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4fNormal3fVertex3fvSUN: procedure(const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fVertex3fSUN: procedure(s: GLfloat; t: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fVertex3fvSUN: procedure(const tc: PGLfloat; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4fVertex4fSUN: procedure(s: GLfloat; t: GLfloat; p: GLfloat; q: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4fVertex4fvSUN: procedure(const tc: PGLfloat; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fColor4ubVertex3fSUN: procedure(s: GLfloat; t: GLfloat; r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fColor4ubVertex3fvSUN: procedure(const tc: PGLfloat; const c: PGLubyte; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fColor3fVertex3fSUN: procedure(s: GLfloat; t: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fColor3fVertex3fvSUN: procedure(const tc: PGLfloat; const c: PGLfloat; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fNormal3fVertex3fSUN: procedure(s: GLfloat; t: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fNormal3fVertex3fvSUN: procedure(const tc: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fColor4fNormal3fVertex3fSUN: procedure(s: GLfloat; t: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2fColor4fNormal3fVertex3fvSUN: procedure(const tc: PGLfloat; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4fColor4fNormal3fVertex4fSUN: procedure(s: GLfloat; t: GLfloat; p: GLfloat; q: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4fColor4fNormal3fVertex4fvSUN: procedure(const tc: PGLfloat; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiVertex3fSUN: procedure(rc: GLuint; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiVertex3fvSUN: procedure(const rc: PGLuint; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiColor4ubVertex3fSUN: procedure(rc: GLuint; r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiColor4ubVertex3fvSUN: procedure(const rc: PGLuint; const c: PGLubyte; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiColor3fVertex3fSUN: procedure(rc: GLuint; r: GLfloat; g: GLfloat; b: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiColor3fVertex3fvSUN: procedure(const rc: PGLuint; const c: PGLfloat; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiNormal3fVertex3fSUN: procedure(rc: GLuint; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiNormal3fVertex3fvSUN: procedure(const rc: PGLuint; const n: PGLfloat; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiColor4fNormal3fVertex3fSUN: procedure(rc: GLuint; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiColor4fNormal3fVertex3fvSUN: procedure(const rc: PGLuint; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiTexCoord2fVertex3fSUN: procedure(rc: GLuint; s: GLfloat; t: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiTexCoord2fVertex3fvSUN: procedure(const rc: PGLuint; const tc: PGLfloat; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN: procedure(rc: GLuint; s: GLfloat; t: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN: procedure(const rc: PGLuint; const tc: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN: procedure(rc: GLuint; s: GLfloat; t: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN: procedure(const rc: PGLuint; const tc: PGLfloat; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_SUN_vertex: Boolean; @@ -2728,11 +2745,11 @@ const GL_ELEMENT_ARRAY_TYPE_APPLE = $8769; GL_ELEMENT_ARRAY_POINTER_APPLE = $876A; var - glElementPointerAPPLE: procedure(_type: GLenum; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDrawElementArrayAPPLE: procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDrawRangeElementArrayAPPLE: procedure(mode: GLenum; start: GLuint; _end: GLuint; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiDrawElementArrayAPPLE: procedure(mode: GLenum; const first: PGLint; const count: PGLsizei; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiDrawRangeElementArrayAPPLE: procedure(mode: GLenum; start: GLuint; _end: GLuint; const first: PGLint; const count: PGLsizei; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glElementPointerAPPLE: procedure(_type: GLenum; const pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawElementArrayAPPLE: procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawRangeElementArrayAPPLE: procedure(mode: GLenum; start: GLuint; _end: GLuint; first: GLint; count: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiDrawElementArrayAPPLE: procedure(mode: GLenum; const first: PGLint; const count: PGLsizei; primcount: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiDrawRangeElementArrayAPPLE: procedure(mode: GLenum; start: GLuint; _end: GLuint; const first: PGLint; const count: PGLsizei; primcount: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_APPLE_element_array: Boolean; @@ -2741,14 +2758,14 @@ const GL_DRAW_PIXELS_APPLE = $8A0A; GL_FENCE_APPLE = $8A0B; var - glGenFencesAPPLE: procedure(n: GLsizei; fences: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteFencesAPPLE: procedure(n: GLsizei; const fences: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSetFenceAPPLE: procedure(fence: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsFenceAPPLE: function(fence: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTestFenceAPPLE: function(fence: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFinishFenceAPPLE: procedure(fence: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTestObjectAPPLE: function(_object: GLenum; name: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFinishObjectAPPLE: procedure(_object: GLenum; name: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenFencesAPPLE: procedure(n: GLsizei; fences: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteFencesAPPLE: procedure(n: GLsizei; const fences: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSetFenceAPPLE: procedure(fence: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsFenceAPPLE: function(fence: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTestFenceAPPLE: function(fence: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFinishFenceAPPLE: procedure(fence: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTestObjectAPPLE: function(_object: GLenum; name: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFinishObjectAPPLE: procedure(_object: GLenum; name: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_APPLE_fence: Boolean; @@ -2756,10 +2773,10 @@ function Load_GL_APPLE_fence: Boolean; const GL_VERTEX_ARRAY_BINDING_APPLE = $85B5; var - glBindVertexArrayAPPLE: procedure(_array: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteVertexArraysAPPLE: procedure(n: GLsizei; const arrays: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGenVertexArraysAPPLE: procedure(n: GLsizei; const arrays: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsVertexArrayAPPLE: function(_array: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindVertexArrayAPPLE: procedure(_array: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteVertexArraysAPPLE: procedure(n: GLsizei; const arrays: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenVertexArraysAPPLE: procedure(n: GLsizei; const arrays: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsVertexArrayAPPLE: function(_array: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_APPLE_vertex_array_object: Boolean; @@ -2773,13 +2790,13 @@ const GL_STORAGE_CACHED_APPLE = $85BE; GL_STORAGE_SHARED_APPLE = $85BF; var - glVertexArrayRangeAPPLE: procedure(length: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFlushVertexArrayRangeAPPLE: procedure(length: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexArrayParameteriAPPLE: procedure(pname: GLenum; param: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexArrayRangeAPPLE: procedure(length: GLsizei; pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFlushVertexArrayRangeAPPLE: procedure(length: GLsizei; pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexArrayParameteriAPPLE: procedure(pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_APPLE_vertex_array_range: Boolean; -{$IFDEF Win32} +{$IFDEF WINDOWS} //***** WGL_ARB_pixel_format *****// const WGL_NUMBER_PIXEL_FORMATS_ARB = $2000; @@ -2832,9 +2849,9 @@ const WGL_TYPE_RGBA_ARB = $202B; WGL_TYPE_COLORINDEX_ARB = $202C; var - wglGetPixelFormatAttribivARB: function(hdc: HDC; iPixelFormat: GLint; iLayerPlane: GLint; nAttributes: GLuint; const piAttributes: PGLint; piValues: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetPixelFormatAttribfvARB: function(hdc: HDC; iPixelFormat: GLint; iLayerPlane: GLint; nAttributes: GLuint; const piAttributes: PGLint; pfValues: PGLfloat): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglChoosePixelFormatARB: function(hdc: HDC; const piAttribIList: PGLint; const pfAttribFList: PGLfloat; nMaxFormats: GLuint; piFormats: PGLint; nNumFormats: PGLuint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetPixelFormatAttribivARB: function(hdc: HDC; iPixelFormat: GLint; iLayerPlane: GLint; nAttributes: GLuint; const piAttributes: PGLint; piValues: PGLint): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetPixelFormatAttribfvARB: function(hdc: HDC; iPixelFormat: GLint; iLayerPlane: GLint; nAttributes: GLuint; const piAttributes: PGLint; pfValues: PGLfloat): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglChoosePixelFormatARB: function(hdc: HDC; const piAttribIList: PGLint; const pfAttribFList: PGLfloat; nMaxFormats: GLuint; piFormats: PGLint; nNumFormats: PGLuint): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_WGL_ARB_pixel_format: Boolean; @@ -2843,8 +2860,8 @@ const WGL_ERROR_INVALID_PIXEL_TYPE_ARB = $2043; WGL_ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB = $2054; var - wglMakeContextCurrentARB: function(hDrawDC: HDC; hReadDC: HDC; hglrc: HGLRC): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetCurrentReadDCARB: function(): HDC; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglMakeContextCurrentARB: function(hDrawDC: HDC; hReadDC: HDC; hglrc: HGLRC): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetCurrentReadDCARB: function(): HDC; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_WGL_ARB_make_current_read: Boolean; @@ -2860,18 +2877,18 @@ const WGL_PBUFFER_HEIGHT_ARB = $2035; WGL_PBUFFER_LOST_ARB = $2036; var - wglCreatePbufferARB: function(hDC: HDC; iPixelFormat: GLint; iWidth: GLint; iHeight: GLint; const piAttribList: PGLint): THandle; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetPbufferDCARB: function(hPbuffer: THandle): HDC; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglReleasePbufferDCARB: function(hPbuffer: THandle; hDC: HDC): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglDestroyPbufferARB: function(hPbuffer: THandle): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglQueryPbufferARB: function(hPbuffer: THandle; iAttribute: GLint; piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglCreatePbufferARB: function(hDC: HDC; iPixelFormat: GLint; iWidth: GLint; iHeight: GLint; const piAttribList: PGLint): THandle; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetPbufferDCARB: function(hPbuffer: THandle): HDC; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglReleasePbufferDCARB: function(hPbuffer: THandle; hDC: HDC): GLint; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglDestroyPbufferARB: function(hPbuffer: THandle): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglQueryPbufferARB: function(hPbuffer: THandle; iAttribute: GLint; piValue: PGLint): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_WGL_ARB_pbuffer: Boolean; //***** WGL_EXT_swap_control *****// var - wglSwapIntervalEXT: function(interval: GLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetSwapIntervalEXT: function(): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglSwapIntervalEXT: function(interval: GLint): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetSwapIntervalEXT: function(): GLint; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_WGL_EXT_swap_control: Boolean; @@ -2912,22 +2929,22 @@ const WGL_AUX8_ARB = $208F; WGL_AUX9_ARB = $2090; var - wglBindTexImageARB: function(hPbuffer: THandle; iBuffer: GLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglReleaseTexImageARB: function(hPbuffer: THandle; iBuffer: GLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglSetPbufferAttribARB: function(hPbuffer: THandle; const piAttribList: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglBindTexImageARB: function(hPbuffer: THandle; iBuffer: GLint): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglReleaseTexImageARB: function(hPbuffer: THandle; iBuffer: GLint): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglSetPbufferAttribARB: function(hPbuffer: THandle; const piAttribList: PGLint): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_WGL_ARB_render_texture: Boolean; //***** WGL_EXT_extensions_string *****// var - wglGetExtensionsStringEXT: function(): Pchar; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetExtensionsStringEXT: function(): Pchar; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_WGL_EXT_extensions_string: Boolean; //***** WGL_EXT_make_current_read *****// var - wglMakeContextCurrentEXT: function(hDrawDC: HDC; hReadDC: HDC; hglrc: HGLRC): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetCurrentReadDCEXT: function(): HDC; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglMakeContextCurrentEXT: function(hDrawDC: HDC; hReadDC: HDC; hglrc: HGLRC): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetCurrentReadDCEXT: function(): HDC; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_WGL_EXT_make_current_read: Boolean; @@ -2943,11 +2960,11 @@ const WGL_PBUFFER_WIDTH_EXT = $2034; WGL_PBUFFER_HEIGHT_EXT = $2035; var - wglCreatePbufferEXT: function(hDC: HDC; iPixelFormat: GLint; iWidth: GLint; iHeight: GLint; const piAttribList: PGLint): THandle; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetPbufferDCEXT: function(hPbuffer: THandle): HDC; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglReleasePbufferDCEXT: function(hPbuffer: THandle; hDC: HDC): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglDestroyPbufferEXT: function(hPbuffer: THandle): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglQueryPbufferEXT: function(hPbuffer: THandle; iAttribute: GLint; piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglCreatePbufferEXT: function(hDC: HDC; iPixelFormat: GLint; iWidth: GLint; iHeight: GLint; const piAttribList: PGLint): THandle; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetPbufferDCEXT: function(hPbuffer: THandle): HDC; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglReleasePbufferDCEXT: function(hPbuffer: THandle; hDC: HDC): GLint; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglDestroyPbufferEXT: function(hPbuffer: THandle): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglQueryPbufferEXT: function(hPbuffer: THandle; iAttribute: GLint; piValue: PGLint): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_WGL_EXT_pbuffer: Boolean; @@ -2999,9 +3016,9 @@ const WGL_TYPE_RGBA_EXT = $202B; WGL_TYPE_COLORINDEX_EXT = $202C; var - wglGetPixelFormatAttribivEXT: function(hdc: HDC; iPixelFormat: GLint; iLayerPlane: GLint; nAttributes: GLuint; piAttributes: PGLint; piValues: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetPixelFormatAttribfvEXT: function(hdc: HDC; iPixelFormat: GLint; iLayerPlane: GLint; nAttributes: GLuint; piAttributes: PGLint; pfValues: PGLfloat): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglChoosePixelFormatEXT: function(hdc: HDC; const piAttribIList: PGLint; const pfAttribFList: PGLfloat; nMaxFormats: GLuint; piFormats: PGLint; nNumFormats: PGLuint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetPixelFormatAttribivEXT: function(hdc: HDC; iPixelFormat: GLint; iLayerPlane: GLint; nAttributes: GLuint; piAttributes: PGLint; piValues: PGLint): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetPixelFormatAttribfvEXT: function(hdc: HDC; iPixelFormat: GLint; iLayerPlane: GLint; nAttributes: GLuint; piAttributes: PGLint; pfValues: PGLfloat): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglChoosePixelFormatEXT: function(hdc: HDC; const piAttribIList: PGLint; const pfAttribFList: PGLfloat; nMaxFormats: GLuint; piFormats: PGLint; nNumFormats: PGLuint): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_WGL_EXT_pixel_format: Boolean; @@ -3012,8 +3029,8 @@ const WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D = $2052; WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D = $2053; var - wglGetDigitalVideoParametersI3D: function(hDC: HDC; iAttribute: GLint; piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglSetDigitalVideoParametersI3D: function(hDC: HDC; iAttribute: GLint; const piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetDigitalVideoParametersI3D: function(hDC: HDC; iAttribute: GLint; piValue: PGLint): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglSetDigitalVideoParametersI3D: function(hDC: HDC; iAttribute: GLint; const piValue: PGLint): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_WGL_I3D_digital_video_control: Boolean; @@ -3023,10 +3040,10 @@ const WGL_GAMMA_EXCLUDE_DESKTOP_I3D = $204F; // WGL_GAMMA_EXCLUDE_DESKTOP_I3D { already defined } var - wglGetGammaTableParametersI3D: function(hDC: HDC; iAttribute: GLint; piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglSetGammaTableParametersI3D: function(hDC: HDC; iAttribute: GLint; const piValue: PGLint): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetGammaTableI3D: function(hDC: HDC; iEntries: GLint; puRed: PGLUSHORT; puGreen: PGLUSHORT; puBlue: PGLUSHORT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglSetGammaTableI3D: function(hDC: HDC; iEntries: GLint; const puRed: PGLUSHORT; const puGreen: PGLUSHORT; const puBlue: PGLUSHORT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetGammaTableParametersI3D: function(hDC: HDC; iAttribute: GLint; piValue: PGLint): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglSetGammaTableParametersI3D: function(hDC: HDC; iAttribute: GLint; const piValue: PGLint): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetGammaTableI3D: function(hDC: HDC; iEntries: GLint; puRed: PGLUSHORT; puGreen: PGLUSHORT; puBlue: PGLUSHORT): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglSetGammaTableI3D: function(hDC: HDC; iEntries: GLint; const puRed: PGLUSHORT; const puGreen: PGLUSHORT; const puBlue: PGLUSHORT): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_WGL_I3D_gamma: Boolean; @@ -3042,18 +3059,18 @@ const WGL_GENLOCK_SOURCE_EDGE_RISING_I3D = $204B; WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D = $204C; var - wglEnableGenlockI3D: function(hDC: HDC): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglDisableGenlockI3D: function(hDC: HDC): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglIsEnabledGenlockI3D: function(hDC: HDC; pFlag: PBOOL): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGenlockSourceI3D: function(hDC: HDC; uSource: GLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetGenlockSourceI3D: function(hDC: HDC; uSource: PGLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGenlockSourceEdgeI3D: function(hDC: HDC; uEdge: GLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetGenlockSourceEdgeI3D: function(hDC: HDC; uEdge: PGLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGenlockSampleRateI3D: function(hDC: HDC; uRate: GLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetGenlockSampleRateI3D: function(hDC: HDC; uRate: PGLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGenlockSourceDelayI3D: function(hDC: HDC; uDelay: GLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglGetGenlockSourceDelayI3D: function(hDC: HDC; uDelay: PGLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - wglQueryGenlockMaxSourceDelayI3D: function(hDC: HDC; uMaxLineDelay: PGLUINT; uMaxPixelDelay: PGLUINT): BOOL; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + wglEnableGenlockI3D: function(hDC: HDC): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglDisableGenlockI3D: function(hDC: HDC): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglIsEnabledGenlockI3D: function(hDC: HDC; pFlag: PBOOL): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGenlockSourceI3D: function(hDC: HDC; uSource: GLUINT): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetGenlockSourceI3D: function(hDC: HDC; uSource: PGLUINT): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGenlockSourceEdgeI3D: function(hDC: HDC; uEdge: GLUINT): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetGenlockSourceEdgeI3D: function(hDC: HDC; uEdge: PGLUINT): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGenlockSampleRateI3D: function(hDC: HDC; uRate: GLUINT): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetGenlockSampleRateI3D: function(hDC: HDC; uRate: PGLUINT): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGenlockSourceDelayI3D: function(hDC: HDC; uDelay: GLUINT): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglGetGenlockSourceDelayI3D: function(hDC: HDC; uDelay: PGLUINT): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + wglQueryGenlockMaxSourceDelayI3D: function(hDC: HDC; uMaxLineDelay: PGLUINT; uMaxPixelDelay: PGLUINT): BOOL; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_WGL_I3D_genlock: Boolean; {$ENDIF} @@ -3071,11 +3088,11 @@ const GL_MATRIX_INDEX_ARRAY_STRIDE_ARB = $8848; GL_MATRIX_INDEX_ARRAY_POINTER_ARB = $8849; var - glCurrentPaletteMatrixARB: procedure(index: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMatrixIndexubvARB: procedure(size: GLint; indices: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMatrixIndexusvARB: procedure(size: GLint; indices: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMatrixIndexuivARB: procedure(size: GLint; indices: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMatrixIndexPointerARB: procedure(size: GLint; _type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glCurrentPaletteMatrixARB: procedure(index: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMatrixIndexubvARB: procedure(size: GLint; indices: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMatrixIndexusvARB: procedure(size: GLint; indices: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMatrixIndexuivARB: procedure(size: GLint; indices: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMatrixIndexPointerARB: procedure(size: GLint; _type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ARB_matrix_palette: Boolean; @@ -3084,11 +3101,11 @@ const GL_ELEMENT_ARRAY_TYPE_NV = $8769; GL_ELEMENT_ARRAY_POINTER_NV = $876A; var - glElementPointerNV: procedure(_type: GLenum; const pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDrawElementArrayNV: procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDrawRangeElementArrayNV: procedure(mode: GLenum; start: GLuint; _end: GLuint; first: GLint; count: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiDrawElementArrayNV: procedure(mode: GLenum; const first: PGLint; const count: PGLsizei; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiDrawRangeElementArrayNV: procedure(mode: GLenum; start: GLuint; _end: GLuint; const first: PGLint; const count: PGLsizei; primcount: GLsizei); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glElementPointerNV: procedure(_type: GLenum; const pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawElementArrayNV: procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawRangeElementArrayNV: procedure(mode: GLenum; start: GLuint; _end: GLuint; first: GLint; count: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiDrawElementArrayNV: procedure(mode: GLenum; const first: PGLint; const count: PGLsizei; primcount: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiDrawRangeElementArrayNV: procedure(mode: GLenum; start: GLuint; _end: GLuint; const first: PGLint; const count: PGLsizei; primcount: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_NV_element_array: Boolean; @@ -3109,7 +3126,7 @@ const GL_TEXTURE_FLOAT_COMPONENTS_NV = $888C; GL_FLOAT_CLEAR_COLOR_VALUE_NV = $888D; GL_FLOAT_RGBA_MODE_NV = $888E; -{$IFDEF Win32} +{$IFDEF WINDOWS} WGL_FLOAT_COMPONENTS_NV = $20B0; WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV = $20B1; WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV = $20B2; @@ -3132,10 +3149,10 @@ const GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV = $8868; GL_PROGRAM_ERROR_STRING_NV = $8874; var - glProgramNamedParameter4fNV: procedure(id: GLuint; len: GLsizei; const name: PGLubyte; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glProgramNamedParameter4dNV: procedure(id: GLuint; len: GLsizei; const name: PGLubyte; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramNamedParameterfvNV: procedure(id: GLuint; len: GLsizei; const name: PGLubyte; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetProgramNamedParameterdvNV: procedure(id: GLuint; len: GLsizei; const name: PGLubyte; params: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramNamedParameter4fNV: procedure(id: GLuint; len: GLsizei; const name: PGLubyte; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glProgramNamedParameter4dNV: procedure(id: GLuint; len: GLsizei; const name: PGLubyte; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramNamedParameterfvNV: procedure(id: GLuint; len: GLsizei; const name: PGLubyte; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramNamedParameterdvNV: procedure(id: GLuint; len: GLsizei; const name: PGLubyte; params: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} // glProgramLocalParameter4dARB { already defined } // glProgramLocalParameter4dvARB { already defined } // glProgramLocalParameter4fARB { already defined } @@ -3150,8 +3167,8 @@ const GL_PRIMITIVE_RESTART_NV = $8558; GL_PRIMITIVE_RESTART_INDEX_NV = $8559; var - glPrimitiveRestartNV: procedure(); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glPrimitiveRestartIndexNV: procedure(index: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPrimitiveRestartNV: procedure(); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPrimitiveRestartIndexNV: procedure(index: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_NV_primitive_restart: Boolean; @@ -3159,6 +3176,7 @@ function Load_GL_NV_primitive_restart: Boolean; function Load_GL_NV_vertex_program2: Boolean; +{$IFDEF WINDOWS} //***** WGL_NV_render_texture_rectangle *****// const WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV = $20A0; @@ -3166,6 +3184,7 @@ const WGL_TEXTURE_RECTANGLE_NV = $20A2; function Load_WGL_NV_render_texture_rectangle: Boolean; +{$ENDIF} //***** GL_NV_pixel_data_range *****// const @@ -3176,8 +3195,8 @@ const GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV = $887C; GL_READ_PIXEL_DATA_RANGE_POINTER_NV = $887D; var - glPixelDataRangeNV: procedure(target: GLenum; length: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFlushPixelDataRangeNV: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelDataRangeNV: procedure(target: GLenum; length: GLsizei; pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFlushPixelDataRangeNV: procedure(target: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} // wglAllocateMemoryNV { already defined } // wglFreeMemoryNV { already defined } @@ -3221,10 +3240,11 @@ const GL_DRAW_BUFFER14_ATI = $8833; GL_DRAW_BUFFER15_ATI = $8834; var - glDrawBuffersATI: procedure(n: GLsizei; const bufs: PGLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawBuffersATI: procedure(n: GLsizei; const bufs: PGLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ATI_draw_buffers: Boolean; +{$IFDEF WINDOWS} //***** WGL_ATI_pixel_format_float *****// const WGL_RGBA_FLOAT_MODE_ATI = $8820; @@ -3232,6 +3252,7 @@ const WGL_TYPE_RGBA_FLOAT_ATI = $21A0; function Load_WGL_ATI_pixel_format_float: Boolean; +{$ENDIF} //***** GL_ATI_texture_env_combine3 *****// const @@ -3268,59 +3289,59 @@ function Load_GL_NV_texture_expand_normal: Boolean; const GL_HALF_FLOAT_NV = $140B; var - glVertex2hNV: procedure(x: GLushort; y: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex2hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex3hNV: procedure(x: GLushort; y: GLushort; z: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex3hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex4hNV: procedure(x: GLushort; y: GLushort; z: GLushort; w: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertex4hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3hNV: procedure(nx: GLushort; ny: GLushort; nz: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glNormal3hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3hNV: procedure(red: GLushort; green: GLushort; blue: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor3hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4hNV: procedure(red: GLushort; green: GLushort; blue: GLushort; alpha: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glColor4hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord1hNV: procedure(s: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord1hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2hNV: procedure(s: GLushort; t: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord2hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord3hNV: procedure(s: GLushort; t: GLushort; r: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord3hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4hNV: procedure(s: GLushort; t: GLushort; r: GLushort; q: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glTexCoord4hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1hNV: procedure(target: GLenum; s: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord1hvNV: procedure(target: GLenum; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2hNV: procedure(target: GLenum; s: GLushort; t: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord2hvNV: procedure(target: GLenum; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3hNV: procedure(target: GLenum; s: GLushort; t: GLushort; r: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord3hvNV: procedure(target: GLenum; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4hNV: procedure(target: GLenum; s: GLushort; t: GLushort; r: GLushort; q: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMultiTexCoord4hvNV: procedure(target: GLenum; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFogCoordhNV: procedure(fog: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFogCoordhvNV: procedure(const fog: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3hNV: procedure(red: GLushort; green: GLushort; blue: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3hvNV: procedure(const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexWeighthNV: procedure(weight: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexWeighthvNV: procedure(const weight: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1hNV: procedure(index: GLuint; x: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib1hvNV: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2hNV: procedure(index: GLuint; x: GLushort; y: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib2hvNV: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3hNV: procedure(index: GLuint; x: GLushort; y: GLushort; z: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib3hvNV: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4hNV: procedure(index: GLuint; x: GLushort; y: GLushort; z: GLushort; w: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttrib4hvNV: procedure(index: GLuint; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs1hvNV: procedure(index: GLuint; n: GLsizei; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs2hvNV: procedure(index: GLuint; n: GLsizei; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs3hvNV: procedure(index: GLuint; n: GLsizei; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glVertexAttribs4hvNV: procedure(index: GLuint; n: GLsizei; const v: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2hNV: procedure(x: GLushort; y: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex2hvNV: procedure(const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3hNV: procedure(x: GLushort; y: GLushort; z: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex3hvNV: procedure(const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4hNV: procedure(x: GLushort; y: GLushort; z: GLushort; w: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertex4hvNV: procedure(const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3hNV: procedure(nx: GLushort; ny: GLushort; nz: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3hvNV: procedure(const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3hNV: procedure(red: GLushort; green: GLushort; blue: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor3hvNV: procedure(const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4hNV: procedure(red: GLushort; green: GLushort; blue: GLushort; alpha: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColor4hvNV: procedure(const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1hNV: procedure(s: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord1hvNV: procedure(const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2hNV: procedure(s: GLushort; t: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord2hvNV: procedure(const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3hNV: procedure(s: GLushort; t: GLushort; r: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord3hvNV: procedure(const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4hNV: procedure(s: GLushort; t: GLushort; r: GLushort; q: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexCoord4hvNV: procedure(const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1hNV: procedure(target: GLenum; s: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord1hvNV: procedure(target: GLenum; const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2hNV: procedure(target: GLenum; s: GLushort; t: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord2hvNV: procedure(target: GLenum; const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3hNV: procedure(target: GLenum; s: GLushort; t: GLushort; r: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord3hvNV: procedure(target: GLenum; const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4hNV: procedure(target: GLenum; s: GLushort; t: GLushort; r: GLushort; q: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiTexCoord4hvNV: procedure(target: GLenum; const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoordhNV: procedure(fog: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoordhvNV: procedure(const fog: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3hNV: procedure(red: GLushort; green: GLushort; blue: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3hvNV: procedure(const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexWeighthNV: procedure(weight: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexWeighthvNV: procedure(const weight: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1hNV: procedure(index: GLuint; x: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1hvNV: procedure(index: GLuint; const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2hNV: procedure(index: GLuint; x: GLushort; y: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2hvNV: procedure(index: GLuint; const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3hNV: procedure(index: GLuint; x: GLushort; y: GLushort; z: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3hvNV: procedure(index: GLuint; const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4hNV: procedure(index: GLuint; x: GLushort; y: GLushort; z: GLushort; w: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4hvNV: procedure(index: GLuint; const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs1hvNV: procedure(index: GLuint; n: GLsizei; const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs2hvNV: procedure(index: GLuint; n: GLsizei; const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs3hvNV: procedure(index: GLuint; n: GLsizei; const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribs4hvNV: procedure(index: GLuint; n: GLsizei; const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_NV_half_float: Boolean; //***** GL_ATI_map_object_buffer *****// var - glMapObjectBufferATI: function(buffer: GLuint): PGLvoid; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUnmapObjectBufferATI: procedure(buffer: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapObjectBufferATI: function(buffer: GLuint): PGLvoid; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUnmapObjectBufferATI: procedure(buffer: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ATI_map_object_buffer: Boolean; @@ -3348,16 +3369,16 @@ const GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI = $8802; GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI = $8803; var - glStencilOpSeparateATI: procedure(face: GLenum; sfail: GLenum; dpfail: GLenum; dppass: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glStencilFuncSeparateATI: procedure(frontfunc: GLenum; backfunc: GLenum; ref: GLint; mask: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glStencilOpSeparateATI: procedure(face: GLenum; sfail: GLenum; dpfail: GLenum; dppass: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glStencilFuncSeparateATI: procedure(frontfunc: GLenum; backfunc: GLenum; ref: GLint; mask: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ATI_separate_stencil: Boolean; //***** GL_ATI_vertex_attrib_array_object *****// var - glVertexAttribArrayObjectATI: procedure(index: GLuint; size: GLint; _type: GLenum; normalized: GLboolean; stride: GLsizei; buffer: GLuint; offset: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVertexAttribArrayObjectfvATI: procedure(index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetVertexAttribArrayObjectivATI: procedure(index: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribArrayObjectATI: procedure(index: GLuint; size: GLint; _type: GLenum; normalized: GLboolean; stride: GLsizei; buffer: GLuint; offset: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribArrayObjectfvATI: procedure(index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribArrayObjectivATI: procedure(index: GLuint; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ATI_vertex_attrib_array_object: Boolean; @@ -3395,17 +3416,17 @@ const GL_BUFFER_MAPPED_ARB = $88BC; GL_BUFFER_MAP_POINTER_ARB = $88BD; var - glBindBufferARB: procedure(target: GLenum; buffer: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteBuffersARB: procedure(n: GLsizei; const buffers: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGenBuffersARB: procedure(n: GLsizei; buffers: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsBufferARB: function(buffer: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBufferDataARB: procedure(target: GLenum; size: GLsizeiptrARB; const data: PGLvoid; usage: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBufferSubDataARB: procedure(target: GLenum; offset: GLintptrARB; size: GLsizeiptrARB; const data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetBufferSubDataARB: procedure(target: GLenum; offset: GLintptrARB; size: GLsizeiptrARB; data: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glMapBufferARB: function(target: GLenum; access: GLenum): PGLvoid; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUnmapBufferARB: function(target: GLenum): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetBufferParameterivARB: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetBufferPointervARB: procedure(target: GLenum; pname: GLenum; params: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindBufferARB: procedure(target: GLenum; buffer: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteBuffersARB: procedure(n: GLsizei; const buffers: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenBuffersARB: procedure(n: GLsizei; buffers: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsBufferARB: function(buffer: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBufferDataARB: procedure(target: GLenum; size: GLsizeiptrARB; const data: PGLvoid; usage: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBufferSubDataARB: procedure(target: GLenum; offset: GLintptrARB; size: GLsizeiptrARB; const data: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetBufferSubDataARB: procedure(target: GLenum; offset: GLintptrARB; size: GLsizeiptrARB; data: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapBufferARB: function(target: GLenum; access: GLenum): PGLvoid; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUnmapBufferARB: function(target: GLenum): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetBufferParameterivARB: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetBufferPointervARB: procedure(target: GLenum; pname: GLenum; params: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ARB_vertex_buffer_object: Boolean; @@ -3417,14 +3438,14 @@ const GL_QUERY_RESULT_ARB = $8866; GL_QUERY_RESULT_AVAILABLE_ARB = $8867; var - glGenQueriesARB: procedure(n: GLsizei; ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDeleteQueriesARB: procedure(n: GLsizei; const ids: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glIsQueryARB: function(id: GLuint): GLboolean; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glBeginQueryARB: procedure(target: GLenum; id: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glEndQueryARB: procedure(target: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetQueryivARB: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetQueryObjectivARB: procedure(id: GLuint; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetQueryObjectuivARB: procedure(id: GLuint; pname: GLenum; params: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenQueriesARB: procedure(n: GLsizei; ids: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteQueriesARB: procedure(n: GLsizei; const ids: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsQueryARB: function(id: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBeginQueryARB: procedure(target: GLenum; id: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEndQueryARB: procedure(target: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetQueryivARB: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetQueryObjectivARB: procedure(id: GLuint; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetQueryObjectuivARB: procedure(id: GLuint; pname: GLenum; params: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ARB_occlusion_query: Boolean; @@ -3459,45 +3480,45 @@ const GL_FLOAT_MAT3_ARB = $8B5B; GL_FLOAT_MAT4_ARB = $8B5C; var - glDeleteObjectARB: procedure(obj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetHandleARB: function(pname: GLenum): GLhandleARB; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glDetachObjectARB: procedure(containerObj: GLhandleARB; attachedObj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCreateShaderObjectARB: function(shaderType: GLenum): GLhandleARB; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glShaderSourceARB: procedure(shaderObj: GLhandleARB; count: GLsizei; const _string: PGLvoid; const length: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCompileShaderARB: procedure(shaderObj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glCreateProgramObjectARB: function(): GLhandleARB; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glAttachObjectARB: procedure(containerObj: GLhandleARB; obj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glLinkProgramARB: procedure(programObj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUseProgramObjectARB: procedure(programObj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glValidateProgramARB: procedure(programObj: GLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform1fARB: procedure(location: GLint; v0: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform2fARB: procedure(location: GLint; v0: GLfloat; v1: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform3fARB: procedure(location: GLint; v0: GLfloat; v1: GLfloat; v2: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform4fARB: procedure(location: GLint; v0: GLfloat; v1: GLfloat; v2: GLfloat; v3: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform1iARB: procedure(location: GLint; v0: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform2iARB: procedure(location: GLint; v0: GLint; v1: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform3iARB: procedure(location: GLint; v0: GLint; v1: GLint; v2: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform4iARB: procedure(location: GLint; v0: GLint; v1: GLint; v2: GLint; v3: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform1fvARB: procedure(location: GLint; count: GLsizei; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform2fvARB: procedure(location: GLint; count: GLsizei; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform3fvARB: procedure(location: GLint; count: GLsizei; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform4fvARB: procedure(location: GLint; count: GLsizei; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform1ivARB: procedure(location: GLint; count: GLsizei; value: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform2ivARB: procedure(location: GLint; count: GLsizei; value: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform3ivARB: procedure(location: GLint; count: GLsizei; value: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniform4ivARB: procedure(location: GLint; count: GLsizei; value: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniformMatrix2fvARB: procedure(location: GLint; count: GLsizei; transpose: GLboolean; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniformMatrix3fvARB: procedure(location: GLint; count: GLsizei; transpose: GLboolean; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glUniformMatrix4fvARB: procedure(location: GLint; count: GLsizei; transpose: GLboolean; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetObjectParameterfvARB: procedure(obj: GLhandleARB; pname: GLenum; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetObjectParameterivARB: procedure(obj: GLhandleARB; pname: GLenum; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetInfoLogARB: procedure(obj: GLhandleARB; maxLength: GLsizei; length: PGLsizei; infoLog: PGLcharARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetAttachedObjectsARB: procedure(containerObj: GLhandleARB; maxCount: GLsizei; count: PGLsizei; obj: PGLhandleARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetUniformLocationARB: function(programObj: GLhandleARB; const name: PGLcharARB): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetActiveUniformARB: procedure(programObj: GLhandleARB; index: GLuint; maxLength: GLsizei; length: PGLsizei; size: PGLint; _type: PGLenum; name: PGLcharARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetUniformfvARB: procedure(programObj: GLhandleARB; location: GLint; params: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetUniformivARB: procedure(programObj: GLhandleARB; location: GLint; params: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetShaderSourceARB: procedure(obj: GLhandleARB; maxLength: GLsizei; length: PGLsizei; source: PGLcharARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteObjectARB: procedure(obj: GLhandleARB); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetHandleARB: function(pname: GLenum): GLhandleARB; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDetachObjectARB: procedure(containerObj: GLhandleARB; attachedObj: GLhandleARB); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCreateShaderObjectARB: function(shaderType: GLenum): GLhandleARB; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glShaderSourceARB: procedure(shaderObj: GLhandleARB; count: GLsizei; const _string: PGLvoid; const length: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompileShaderARB: procedure(shaderObj: GLhandleARB); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCreateProgramObjectARB: function(): GLhandleARB; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glAttachObjectARB: procedure(containerObj: GLhandleARB; obj: GLhandleARB); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLinkProgramARB: procedure(programObj: GLhandleARB); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUseProgramObjectARB: procedure(programObj: GLhandleARB); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glValidateProgramARB: procedure(programObj: GLhandleARB); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform1fARB: procedure(location: GLint; v0: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform2fARB: procedure(location: GLint; v0: GLfloat; v1: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform3fARB: procedure(location: GLint; v0: GLfloat; v1: GLfloat; v2: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform4fARB: procedure(location: GLint; v0: GLfloat; v1: GLfloat; v2: GLfloat; v3: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform1iARB: procedure(location: GLint; v0: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform2iARB: procedure(location: GLint; v0: GLint; v1: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform3iARB: procedure(location: GLint; v0: GLint; v1: GLint; v2: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform4iARB: procedure(location: GLint; v0: GLint; v1: GLint; v2: GLint; v3: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform1fvARB: procedure(location: GLint; count: GLsizei; value: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform2fvARB: procedure(location: GLint; count: GLsizei; value: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform3fvARB: procedure(location: GLint; count: GLsizei; value: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform4fvARB: procedure(location: GLint; count: GLsizei; value: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform1ivARB: procedure(location: GLint; count: GLsizei; value: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform2ivARB: procedure(location: GLint; count: GLsizei; value: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform3ivARB: procedure(location: GLint; count: GLsizei; value: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform4ivARB: procedure(location: GLint; count: GLsizei; value: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniformMatrix2fvARB: procedure(location: GLint; count: GLsizei; transpose: GLboolean; value: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniformMatrix3fvARB: procedure(location: GLint; count: GLsizei; transpose: GLboolean; value: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniformMatrix4fvARB: procedure(location: GLint; count: GLsizei; transpose: GLboolean; value: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetObjectParameterfvARB: procedure(obj: GLhandleARB; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetObjectParameterivARB: procedure(obj: GLhandleARB; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetInfoLogARB: procedure(obj: GLhandleARB; maxLength: GLsizei; length: PGLsizei; infoLog: PGLcharARB); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetAttachedObjectsARB: procedure(containerObj: GLhandleARB; maxCount: GLsizei; count: PGLsizei; obj: PGLhandleARB); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetUniformLocationARB: function(programObj: GLhandleARB; const name: PGLcharARB): GLint; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetActiveUniformARB: procedure(programObj: GLhandleARB; index: GLuint; maxLength: GLsizei; length: PGLsizei; size: PGLint; _type: PGLenum; name: PGLcharARB); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetUniformfvARB: procedure(programObj: GLhandleARB; location: GLint; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetUniformivARB: procedure(programObj: GLhandleARB; location: GLint; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetShaderSourceARB: procedure(obj: GLhandleARB; maxLength: GLsizei; length: PGLsizei; source: PGLcharARB); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_ARB_shader_objects: Boolean; @@ -3572,9 +3593,9 @@ const // glEnableVertexAttribArrayARB { already defined } // glDisableVertexAttribArrayARB { already defined } var - glBindAttribLocationARB: procedure(programObj: GLhandleARB; index: GLuint; const name: PGLcharARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetActiveAttribARB: procedure(programObj: GLhandleARB; index: GLuint; maxLength: GLsizei; length: PGLsizei; size: PGLint; _type: PGLenum; name: PGLcharARB); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glGetAttribLocationARB: function(programObj: GLhandleARB; const name: PGLcharARB): GLint; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindAttribLocationARB: procedure(programObj: GLhandleARB; index: GLuint; const name: PGLcharARB); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetActiveAttribARB: procedure(programObj: GLhandleARB; index: GLuint; maxLength: GLsizei; length: PGLsizei; size: PGLint; _type: PGLenum; name: PGLcharARB); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetAttribLocationARB: function(programObj: GLhandleARB; const name: PGLcharARB): GLint; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} // glGetVertexAttribdvARB { already defined } // glGetVertexAttribfvARB { already defined } // glGetVertexAttribivARB { already defined } @@ -3614,7 +3635,7 @@ const GL_DEPTH_BOUNDS_TEST_EXT = $8890; GL_DEPTH_BOUNDS_EXT = $8891; var - glDepthBoundsEXT: procedure(zmin: GLclampd; zmax: GLclampd); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glDepthBoundsEXT: procedure(zmin: GLclampd; zmax: GLclampd); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_EXT_depth_bounds_test: Boolean; @@ -3628,23 +3649,23 @@ const GL_SECONDARY_COLOR_ARRAY_POINTER_EXT = $845D; GL_SECONDARY_COLOR_ARRAY_EXT = $845E; var - glSecondaryColor3bEXT: procedure(r: GLbyte; g: GLbyte; b: GLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3sEXT: procedure(r: GLshort; g: GLshort; b: GLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3iEXT: procedure(r: GLint; g: GLint; b: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3fEXT: procedure(r: GLfloat; g: GLfloat; b: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3dEXT: procedure(r: GLdouble; g: GLdouble; b: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3ubEXT: procedure(r: GLubyte; g: GLubyte; b: GLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3usEXT: procedure(r: GLushort; g: GLushort; b: GLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3uiEXT: procedure(r: GLuint; g: GLuint; b: GLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3bvEXT: procedure(components: PGLbyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3svEXT: procedure(components: PGLshort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3ivEXT: procedure(components: PGLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3fvEXT: procedure(components: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3dvEXT: procedure(components: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3ubvEXT: procedure(components: PGLubyte); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3usvEXT: procedure(components: PGLushort); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColor3uivEXT: procedure(components: PGLuint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glSecondaryColorPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3bEXT: procedure(r: GLbyte; g: GLbyte; b: GLbyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3sEXT: procedure(r: GLshort; g: GLshort; b: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3iEXT: procedure(r: GLint; g: GLint; b: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3fEXT: procedure(r: GLfloat; g: GLfloat; b: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3dEXT: procedure(r: GLdouble; g: GLdouble; b: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3ubEXT: procedure(r: GLubyte; g: GLubyte; b: GLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3usEXT: procedure(r: GLushort; g: GLushort; b: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3uiEXT: procedure(r: GLuint; g: GLuint; b: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3bvEXT: procedure(components: PGLbyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3svEXT: procedure(components: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3ivEXT: procedure(components: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3fvEXT: procedure(components: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3dvEXT: procedure(components: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3ubvEXT: procedure(components: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3usvEXT: procedure(components: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3uivEXT: procedure(components: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColorPointerEXT: procedure(size: GLint; _type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_EXT_secondary_color: Boolean; @@ -3661,7 +3682,7 @@ const GL_BLEND_EQUATION_RGB_EXT = $8009; GL_BLEND_EQUATION_ALPHA_EXT = $883D; var - glBlendEquationSeparateEXT: procedure(modeRGB: GLenum; modeAlpha: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glBlendEquationSeparateEXT: procedure(modeRGB: GLenum; modeAlpha: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_EXT_blend_equation_separate: Boolean; @@ -3694,11 +3715,11 @@ const GL_FOG_COORDINATE_ARRAY_POINTER_EXT = $8456; GL_FOG_COORDINATE_ARRAY_EXT = $8457; var - glFogCoordfEXT: procedure(coord: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFogCoorddEXT: procedure(coord: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFogCoordfvEXT: procedure(coord: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFogCoorddvEXT: procedure(coord: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glFogCoordPointerEXT: procedure(_type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoordfEXT: procedure(coord: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoorddEXT: procedure(coord: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoordfvEXT: procedure(coord: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoorddvEXT: procedure(coord: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoordPointerEXT: procedure(_type: GLenum; stride: GLsizei; pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} function Load_GL_EXT_fog_coord: Boolean; @@ -3736,6 +3757,517 @@ function Load_GL_NV_vertex_program2_option: Boolean; function Load_GL_NV_vertex_program3: Boolean; +//***** GL_ARB_draw_buffers *****// +const + GL_MAX_DRAW_BUFFERS_ARB = $8824; + GL_DRAW_BUFFER0_ARB = $8825; + GL_DRAW_BUFFER1_ARB = $8826; + GL_DRAW_BUFFER2_ARB = $8827; + GL_DRAW_BUFFER3_ARB = $8828; + GL_DRAW_BUFFER4_ARB = $8829; + GL_DRAW_BUFFER5_ARB = $882A; + GL_DRAW_BUFFER6_ARB = $882B; + GL_DRAW_BUFFER7_ARB = $882C; + GL_DRAW_BUFFER8_ARB = $882D; + GL_DRAW_BUFFER9_ARB = $882E; + GL_DRAW_BUFFER10_ARB = $882F; + GL_DRAW_BUFFER11_ARB = $8830; + GL_DRAW_BUFFER12_ARB = $8831; + GL_DRAW_BUFFER13_ARB = $8832; + GL_DRAW_BUFFER14_ARB = $8833; + GL_DRAW_BUFFER15_ARB = $8834; +var + glDrawBuffersARB: procedure(n: GLsizei; const bufs: PGLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_draw_buffers: Boolean; + +//***** GL_ARB_texture_rectangle *****// +const + GL_TEXTURE_RECTANGLE_ARB = $84F5; + GL_TEXTURE_BINDING_RECTANGLE_ARB = $84F6; + GL_PROXY_TEXTURE_RECTANGLE_ARB = $84F7; + GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB = $84F8; + +function Load_GL_ARB_texture_rectangle: Boolean; + +//***** GL_ARB_color_buffer_float *****// +const + GL_RGBA_FLOAT_MODE_ARB = $8820; + GL_CLAMP_VERTEX_COLOR_ARB = $891A; + GL_CLAMP_FRAGMENT_COLOR_ARB = $891B; + GL_CLAMP_READ_COLOR_ARB = $891C; + GL_FIXED_ONLY_ARB = $891D; + WGL_TYPE_RGBA_FLOAT_ARB = $21A0; +var + glClampColorARB: procedure(target: GLenum; clamp: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_ARB_color_buffer_float: Boolean; + +//***** GL_ARB_half_float_pixel *****// +const + GL_HALF_FLOAT_ARB = $140B; + +function Load_GL_ARB_half_float_pixel: Boolean; + +//***** GL_ARB_texture_float *****// +const + GL_TEXTURE_RED_TYPE_ARB = $8C10; + GL_TEXTURE_GREEN_TYPE_ARB = $8C11; + GL_TEXTURE_BLUE_TYPE_ARB = $8C12; + GL_TEXTURE_ALPHA_TYPE_ARB = $8C13; + GL_TEXTURE_LUMINANCE_TYPE_ARB = $8C14; + GL_TEXTURE_INTENSITY_TYPE_ARB = $8C15; + GL_TEXTURE_DEPTH_TYPE_ARB = $8C16; + GL_UNSIGNED_NORMALIZED_ARB = $8C17; + GL_RGBA32F_ARB = $8814; + GL_RGB32F_ARB = $8815; + GL_ALPHA32F_ARB = $8816; + GL_INTENSITY32F_ARB = $8817; + GL_LUMINANCE32F_ARB = $8818; + GL_LUMINANCE_ALPHA32F_ARB = $8819; + GL_RGBA16F_ARB = $881A; + GL_RGB16F_ARB = $881B; + GL_ALPHA16F_ARB = $881C; + GL_INTENSITY16F_ARB = $881D; + GL_LUMINANCE16F_ARB = $881E; + GL_LUMINANCE_ALPHA16F_ARB = $881F; + +function Load_GL_ARB_texture_float: Boolean; + +//***** GL_EXT_texture_compression_dxt1 *****// + // GL_COMPRESSED_RGB_S3TC_DXT1_EXT { already defined } + // GL_COMPRESSED_RGBA_S3TC_DXT1_EXT { already defined } + +function Load_GL_EXT_texture_compression_dxt1: Boolean; + +//***** GL_ARB_pixel_buffer_object *****// +const + GL_PIXEL_PACK_BUFFER_ARB = $88EB; + GL_PIXEL_UNPACK_BUFFER_ARB = $88EC; + GL_PIXEL_PACK_BUFFER_BINDING_ARB = $88ED; + GL_PIXEL_UNPACK_BUFFER_BINDING_ARB = $88EF; + +function Load_GL_ARB_pixel_buffer_object: Boolean; + +//***** GL_EXT_framebuffer_object *****// +const + GL_FRAMEBUFFER_EXT = $8D40; + GL_RENDERBUFFER_EXT = $8D41; + GL_STENCIL_INDEX_EXT = $8D45; + GL_STENCIL_INDEX1_EXT = $8D46; + GL_STENCIL_INDEX4_EXT = $8D47; + GL_STENCIL_INDEX8_EXT = $8D48; + GL_STENCIL_INDEX16_EXT = $8D49; + GL_RENDERBUFFER_WIDTH_EXT = $8D42; + GL_RENDERBUFFER_HEIGHT_EXT = $8D43; + GL_RENDERBUFFER_INTERNAL_FORMAT_EXT = $8D44; + GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT = $8CD0; + GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT = $8CD1; + GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT = $8CD2; + GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT = $8CD3; + GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT = $8CD4; + GL_COLOR_ATTACHMENT0_EXT = $8CE0; + GL_COLOR_ATTACHMENT1_EXT = $8CE1; + GL_COLOR_ATTACHMENT2_EXT = $8CE2; + GL_COLOR_ATTACHMENT3_EXT = $8CE3; + GL_COLOR_ATTACHMENT4_EXT = $8CE4; + GL_COLOR_ATTACHMENT5_EXT = $8CE5; + GL_COLOR_ATTACHMENT6_EXT = $8CE6; + GL_COLOR_ATTACHMENT7_EXT = $8CE7; + GL_COLOR_ATTACHMENT8_EXT = $8CE8; + GL_COLOR_ATTACHMENT9_EXT = $8CE9; + GL_COLOR_ATTACHMENT10_EXT = $8CEA; + GL_COLOR_ATTACHMENT11_EXT = $8CEB; + GL_COLOR_ATTACHMENT12_EXT = $8CEC; + GL_COLOR_ATTACHMENT13_EXT = $8CED; + GL_COLOR_ATTACHMENT14_EXT = $8CEE; + GL_COLOR_ATTACHMENT15_EXT = $8CEF; + GL_DEPTH_ATTACHMENT_EXT = $8D00; + GL_STENCIL_ATTACHMENT_EXT = $8D20; + GL_FRAMEBUFFER_COMPLETE_EXT = $8CD5; + GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT = $8CD6; + GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT = $8CD7; + GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT = $8CD8; + GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT = $8CD9; + GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT = $8CDA; + GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT = $8CDB; + GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT = $8CDC; + GL_FRAMEBUFFER_UNSUPPORTED_EXT = $8CDD; + GL_FRAMEBUFFER_STATUS_ERROR_EXT = $8CDE; + GL_FRAMEBUFFER_BINDING_EXT = $8CA6; + GL_RENDERBUFFER_BINDING_EXT = $8CA7; + GL_MAX_COLOR_ATTACHMENTS_EXT = $8CDF; + GL_MAX_RENDERBUFFER_SIZE_EXT = $84E8; + GL_INVALID_FRAMEBUFFER_OPERATION_EXT = $0506; +var + glIsRenderbufferEXT: function(renderbuffer: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindRenderbufferEXT: procedure(target: GLenum; renderbuffer: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteRenderbuffersEXT: procedure(n: GLsizei; const renderbuffers: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenRenderbuffersEXT: procedure(n: GLsizei; renderbuffers: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRenderbufferStorageEXT: procedure(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetRenderbufferParameterivEXT: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsFramebufferEXT: function(framebuffer: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindFramebufferEXT: procedure(target: GLenum; framebuffer: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteFramebuffersEXT: procedure(n: GLsizei; const framebuffers: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenFramebuffersEXT: procedure(n: GLsizei; framebuffers: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCheckFramebufferStatusEXT: function(target: GLenum): GLenum; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFramebufferTexture1DEXT: procedure(target: GLenum; attachment: GLenum; textarget: GLenum; texture: GLuint; level: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFramebufferTexture2DEXT: procedure(target: GLenum; attachment: GLenum; textarget: GLenum; texture: GLuint; level: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFramebufferTexture3DEXT: procedure(target: GLenum; attachment: GLenum; textarget: GLenum; texture: GLuint; level: GLint; zoffset: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFramebufferRenderbufferEXT: procedure(target: GLenum; attachment: GLenum; renderbuffertarget: GLenum; renderbuffer: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetFramebufferAttachmentParameterivEXT: procedure(target: GLenum; attachment: GLenum; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenerateMipmapEXT: procedure(target: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_EXT_framebuffer_object: Boolean; + +//***** GL_version_1_4 *****// +const + GL_BLEND_DST_RGB = $80C8; + GL_BLEND_SRC_RGB = $80C9; + GL_BLEND_DST_ALPHA = $80CA; + GL_BLEND_SRC_ALPHA = $80CB; + GL_POINT_SIZE_MIN = $8126; + GL_POINT_SIZE_MAX = $8127; + GL_POINT_FADE_THRESHOLD_SIZE = $8128; + GL_POINT_DISTANCE_ATTENUATION = $8129; + GL_GENERATE_MIPMAP = $8191; + GL_GENERATE_MIPMAP_HINT = $8192; + GL_DEPTH_COMPONENT16 = $81A5; + GL_DEPTH_COMPONENT24 = $81A6; + GL_DEPTH_COMPONENT32 = $81A7; + GL_MIRRORED_REPEAT = $8370; + GL_FOG_COORDINATE_SOURCE = $8450; + GL_FOG_COORDINATE = $8451; + GL_FRAGMENT_DEPTH = $8452; + GL_CURRENT_FOG_COORDINATE = $8453; + GL_FOG_COORDINATE_ARRAY_TYPE = $8454; + GL_FOG_COORDINATE_ARRAY_STRIDE = $8455; + GL_FOG_COORDINATE_ARRAY_POINTER = $8456; + GL_FOG_COORDINATE_ARRAY = $8457; + GL_COLOR_SUM = $8458; + GL_CURRENT_SECONDARY_COLOR = $8459; + GL_SECONDARY_COLOR_ARRAY_SIZE = $845A; + GL_SECONDARY_COLOR_ARRAY_TYPE = $845B; + GL_SECONDARY_COLOR_ARRAY_STRIDE = $845C; + GL_SECONDARY_COLOR_ARRAY_POINTER = $845D; + GL_SECONDARY_COLOR_ARRAY = $845E; + GL_MAX_TEXTURE_LOD_BIAS = $84FD; + GL_TEXTURE_FILTER_CONTROL = $8500; + GL_TEXTURE_LOD_BIAS = $8501; + GL_INCR_WRAP = $8507; + GL_DECR_WRAP = $8508; + GL_TEXTURE_DEPTH_SIZE = $884A; + GL_DEPTH_TEXTURE_MODE = $884B; + GL_TEXTURE_COMPARE_MODE = $884C; + GL_TEXTURE_COMPARE_FUNC = $884D; + GL_COMPARE_R_TO_TEXTURE = $884E; +var + glBlendFuncSeparate: procedure(sfactorRGB: GLenum; dfactorRGB: GLenum; sfactorAlpha: GLenum; dfactorAlpha: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoordf: procedure(coord: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoordfv: procedure(const coord: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoordd: procedure(coord: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoorddv: procedure(const coord: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogCoordPointer: procedure(_type: GLenum; stride: GLsizei; const pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiDrawArrays: procedure(mode: GLenum; first: PGLint; count: PGLsizei; primcount: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultiDrawElements: procedure(mode: GLenum; const count: PGLsizei; _type: GLenum; const indices: PGLvoid; primcount: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPointParameterf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPointParameterfv: procedure(pname: GLenum; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPointParameteri: procedure(pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPointParameteriv: procedure(pname: GLenum; const params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3b: procedure(red: GLbyte; green: GLbyte; blue: GLbyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3bv: procedure(const v: PGLbyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3d: procedure(red: GLdouble; green: GLdouble; blue: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3dv: procedure(const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3f: procedure(red: GLfloat; green: GLfloat; blue: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3fv: procedure(const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3i: procedure(red: GLint; green: GLint; blue: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3iv: procedure(const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3s: procedure(red: GLshort; green: GLshort; blue: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3sv: procedure(const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3ub: procedure(red: GLubyte; green: GLubyte; blue: GLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3ubv: procedure(const v: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3ui: procedure(red: GLuint; green: GLuint; blue: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3uiv: procedure(const v: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3us: procedure(red: GLushort; green: GLushort; blue: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColor3usv: procedure(const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSecondaryColorPointer: procedure(size: GLint; _type: GLenum; stride: GLsizei; const pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2d: procedure(x: GLdouble; y: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2dv: procedure(const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2f: procedure(x: GLfloat; y: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2fv: procedure(const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2i: procedure(x: GLint; y: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2iv: procedure(const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2s: procedure(x: GLshort; y: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos2sv: procedure(const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3d: procedure(x: GLdouble; y: GLdouble; z: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3dv: procedure(const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3f: procedure(x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3fv: procedure(const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3i: procedure(x: GLint; y: GLint; z: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3iv: procedure(const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3s: procedure(x: GLshort; y: GLshort; z: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glWindowPos3sv: procedure(const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_version_1_4: Boolean; + +//***** GL_version_1_5 *****// +const + GL_BUFFER_SIZE = $8764; + GL_BUFFER_USAGE = $8765; + GL_QUERY_COUNTER_BITS = $8864; + GL_CURRENT_QUERY = $8865; + GL_QUERY_RESULT = $8866; + GL_QUERY_RESULT_AVAILABLE = $8867; + GL_ARRAY_BUFFER = $8892; + GL_ELEMENT_ARRAY_BUFFER = $8893; + GL_ARRAY_BUFFER_BINDING = $8894; + GL_ELEMENT_ARRAY_BUFFER_BINDING = $8895; + GL_VERTEX_ARRAY_BUFFER_BINDING = $8896; + GL_NORMAL_ARRAY_BUFFER_BINDING = $8897; + GL_COLOR_ARRAY_BUFFER_BINDING = $8898; + GL_INDEX_ARRAY_BUFFER_BINDING = $8899; + GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING = $889A; + GL_EDGE_FLAG_ARRAY_BUFFER_BINDING = $889B; + GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING = $889C; + GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING = $889D; + GL_WEIGHT_ARRAY_BUFFER_BINDING = $889E; + GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = $889F; + GL_READ_ONLY = $88B8; + GL_WRITE_ONLY = $88B9; + GL_READ_WRITE = $88BA; + GL_BUFFER_ACCESS = $88BB; + GL_BUFFER_MAPPED = $88BC; + GL_BUFFER_MAP_POINTER = $88BD; + GL_STREAM_DRAW = $88E0; + GL_STREAM_READ = $88E1; + GL_STREAM_COPY = $88E2; + GL_STATIC_DRAW = $88E4; + GL_STATIC_READ = $88E5; + GL_STATIC_COPY = $88E6; + GL_DYNAMIC_DRAW = $88E8; + GL_DYNAMIC_READ = $88E9; + GL_DYNAMIC_COPY = $88EA; + GL_SAMPLES_PASSED = $8914; + GL_FOG_COORD_SRC = $8450; + GL_FOG_COORD = $8451; + GL_CURRENT_FOG_COORD = $8453; + GL_FOG_COORD_ARRAY_TYPE = $8454; + GL_FOG_COORD_ARRAY_STRIDE = $8455; + GL_FOG_COORD_ARRAY_POINTER = $8456; + GL_FOG_COORD_ARRAY = $8457; + GL_FOG_COORD_ARRAY_BUFFER_BINDING = $889D; + GL_SRC0_RGB = $8580; + GL_SRC1_RGB = $8581; + GL_SRC2_RGB = $8582; + GL_SRC0_ALPHA = $8588; + GL_SRC1_ALPHA = $8589; + GL_SRC2_ALPHA = $858A; +var + glGenQueries: procedure(n: GLsizei; ids: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteQueries: procedure(n: GLsizei; const ids: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsQuery: function(id: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBeginQuery: procedure(target: GLenum; id: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEndQuery: procedure(target: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetQueryiv: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetQueryObjectiv: procedure(id: GLuint; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetQueryObjectuiv: procedure(id: GLuint; pname: GLenum; params: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindBuffer: procedure(target: GLenum; buffer: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteBuffers: procedure(n: GLsizei; const buffers: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenBuffers: procedure(n: GLsizei; buffers: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsBuffer: function(buffer: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBufferData: procedure(target: GLenum; size: GLsizeiptr; const data: PGLvoid; usage: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBufferSubData: procedure(target: GLenum; offset: GLintptr; size: GLsizeiptr; const data: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetBufferSubData: procedure(target: GLenum; offset: GLintptr; size: GLsizeiptr; data: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapBuffer: function(target: GLenum; access: GLenum): PGLvoid; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUnmapBuffer: function(target: GLenum): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetBufferParameteriv: procedure(target: GLenum; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetBufferPointerv: procedure(target: GLenum; pname: GLenum; params: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_version_1_5: Boolean; + +//***** GL_version_2_0 *****// +const + GL_BLEND_EQUATION_RGB = $8009; + GL_VERTEX_ATTRIB_ARRAY_ENABLED = $8622; + GL_VERTEX_ATTRIB_ARRAY_SIZE = $8623; + GL_VERTEX_ATTRIB_ARRAY_STRIDE = $8624; + GL_VERTEX_ATTRIB_ARRAY_TYPE = $8625; + GL_CURRENT_VERTEX_ATTRIB = $8626; + GL_VERTEX_PROGRAM_POINT_SIZE = $8642; + GL_VERTEX_PROGRAM_TWO_SIDE = $8643; + GL_VERTEX_ATTRIB_ARRAY_POINTER = $8645; + GL_STENCIL_BACK_FUNC = $8800; + GL_STENCIL_BACK_FAIL = $8801; + GL_STENCIL_BACK_PASS_DEPTH_FAIL = $8802; + GL_STENCIL_BACK_PASS_DEPTH_PASS = $8803; + GL_MAX_DRAW_BUFFERS = $8824; + GL_DRAW_BUFFER0 = $8825; + GL_DRAW_BUFFER1 = $8826; + GL_DRAW_BUFFER2 = $8827; + GL_DRAW_BUFFER3 = $8828; + GL_DRAW_BUFFER4 = $8829; + GL_DRAW_BUFFER5 = $882A; + GL_DRAW_BUFFER6 = $882B; + GL_DRAW_BUFFER7 = $882C; + GL_DRAW_BUFFER8 = $882D; + GL_DRAW_BUFFER9 = $882E; + GL_DRAW_BUFFER10 = $882F; + GL_DRAW_BUFFER11 = $8830; + GL_DRAW_BUFFER12 = $8831; + GL_DRAW_BUFFER13 = $8832; + GL_DRAW_BUFFER14 = $8833; + GL_DRAW_BUFFER15 = $8834; + GL_BLEND_EQUATION_ALPHA = $883D; + GL_POINT_SPRITE = $8861; + GL_COORD_REPLACE = $8862; + GL_MAX_VERTEX_ATTRIBS = $8869; + GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = $886A; + GL_MAX_TEXTURE_COORDS = $8871; + GL_MAX_TEXTURE_IMAGE_UNITS = $8872; + GL_FRAGMENT_SHADER = $8B30; + GL_VERTEX_SHADER = $8B31; + GL_MAX_FRAGMENT_UNIFORM_COMPONENTS = $8B49; + GL_MAX_VERTEX_UNIFORM_COMPONENTS = $8B4A; + GL_MAX_VARYING_FLOATS = $8B4B; + GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = $8B4C; + GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = $8B4D; + GL_SHADER_TYPE = $8B4F; + GL_FLOAT_VEC2 = $8B50; + GL_FLOAT_VEC3 = $8B51; + GL_FLOAT_VEC4 = $8B52; + GL_INT_VEC2 = $8B53; + GL_INT_VEC3 = $8B54; + GL_INT_VEC4 = $8B55; + GL_BOOL = $8B56; + GL_BOOL_VEC2 = $8B57; + GL_BOOL_VEC3 = $8B58; + GL_BOOL_VEC4 = $8B59; + GL_FLOAT_MAT2 = $8B5A; + GL_FLOAT_MAT3 = $8B5B; + GL_FLOAT_MAT4 = $8B5C; + GL_SAMPLER_1D = $8B5D; + GL_SAMPLER_2D = $8B5E; + GL_SAMPLER_3D = $8B5F; + GL_SAMPLER_CUBE = $8B60; + GL_SAMPLER_1D_SHADOW = $8B61; + GL_SAMPLER_2D_SHADOW = $8B62; + GL_DELETE_STATUS = $8B80; + GL_COMPILE_STATUS = $8B81; + GL_LINK_STATUS = $8B82; + GL_VALIDATE_STATUS = $8B83; + GL_INFO_LOG_LENGTH = $8B84; + GL_ATTACHED_SHADERS = $8B85; + GL_ACTIVE_UNIFORMS = $8B86; + GL_ACTIVE_UNIFORM_MAX_LENGTH = $8B87; + GL_SHADER_SOURCE_LENGTH = $8B88; + GL_ACTIVE_ATTRIBUTES = $8B89; + GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = $8B8A; + GL_FRAGMENT_SHADER_DERIVATIVE_HINT = $8B8B; + GL_SHADING_LANGUAGE_VERSION = $8B8C; + GL_CURRENT_PROGRAM = $8B8D; + GL_POINT_SPRITE_COORD_ORIGIN = $8CA0; + GL_LOWER_LEFT = $8CA1; + GL_UPPER_LEFT = $8CA2; + GL_STENCIL_BACK_REF = $8CA3; + GL_STENCIL_BACK_VALUE_MASK = $8CA4; + GL_STENCIL_BACK_WRITEMASK = $8CA5; +var + glBlendEquationSeparate: procedure(modeRGB: GLenum; modeAlpha: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawBuffers: procedure(n: GLsizei; const bufs: PGLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glStencilOpSeparate: procedure(face: GLenum; sfail: GLenum; dpfail: GLenum; dppass: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glStencilFuncSeparate: procedure(frontfunc: GLenum; backfunc: GLenum; ref: GLint; mask: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glStencilMaskSeparate: procedure(face: GLenum; mask: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glAttachShader: procedure(_program: GLuint; shader: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBindAttribLocation: procedure(_program: GLuint; index: GLuint; const name: PGLchar); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCompileShader: procedure(shader: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCreateProgram: function(): GLuint; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCreateShader: function(_type: GLenum): GLuint; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteProgram: procedure(_program: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteShader: procedure(shader: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDetachShader: procedure(_program: GLuint; shader: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDisableVertexAttribArray: procedure(index: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEnableVertexAttribArray: procedure(index: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetActiveAttrib: procedure(_program: GLuint; index: GLuint; bufSize: GLsizei; length: PGLsizei; size: PGLint; _type: PGLenum; name: PGLchar); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetActiveUniform: procedure(_program: GLuint; index: GLuint; bufSize: GLsizei; length: PGLsizei; size: PGLint; _type: PGLenum; name: PGLchar); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetAttachedShaders: procedure(_program: GLuint; maxCount: GLsizei; count: PGLsizei; obj: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetAttribLocation: function(_program: GLuint; const name: PGLchar): GLint; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramiv: procedure(_program: GLuint; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetProgramInfoLog: procedure(_program: GLuint; bufSize: GLsizei; length: PGLsizei; infoLog: PGLchar); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetShaderiv: procedure(shader: GLuint; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetShaderInfoLog: procedure(shader: GLuint; bufSize: GLsizei; length: PGLsizei; infoLog: PGLchar); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetShaderSource: procedure(shader: GLuint; bufSize: GLsizei; length: PGLsizei; source: PGLchar); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetUniformLocation: function(_program: GLuint; const name: PGLchar): GLint; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetUniformfv: procedure(_program: GLuint; location: GLint; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetUniformiv: procedure(_program: GLuint; location: GLint; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribdv: procedure(index: GLuint; pname: GLenum; params: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribfv: procedure(index: GLuint; pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribiv: procedure(index: GLuint; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetVertexAttribPointerv: procedure(index: GLuint; pname: GLenum; pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsProgram: function(_program: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsShader: function(shader: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLinkProgram: procedure(_program: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glShaderSource: procedure(shader: GLuint; count: GLsizei; const _string: PGLchar; const length: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUseProgram: procedure(_program: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform1f: procedure(location: GLint; v0: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform2f: procedure(location: GLint; v0: GLfloat; v1: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform3f: procedure(location: GLint; v0: GLfloat; v1: GLfloat; v2: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform4f: procedure(location: GLint; v0: GLfloat; v1: GLfloat; v2: GLfloat; v3: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform1i: procedure(location: GLint; v0: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform2i: procedure(location: GLint; v0: GLint; v1: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform3i: procedure(location: GLint; v0: GLint; v1: GLint; v2: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform4i: procedure(location: GLint; v0: GLint; v1: GLint; v2: GLint; v3: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform1fv: procedure(location: GLint; count: GLsizei; const value: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform2fv: procedure(location: GLint; count: GLsizei; const value: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform3fv: procedure(location: GLint; count: GLsizei; const value: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform4fv: procedure(location: GLint; count: GLsizei; const value: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform1iv: procedure(location: GLint; count: GLsizei; const value: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform2iv: procedure(location: GLint; count: GLsizei; const value: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform3iv: procedure(location: GLint; count: GLsizei; const value: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniform4iv: procedure(location: GLint; count: GLsizei; const value: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniformMatrix2fv: procedure(location: GLint; count: GLsizei; transpose: GLboolean; const value: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniformMatrix3fv: procedure(location: GLint; count: GLsizei; transpose: GLboolean; const value: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glUniformMatrix4fv: procedure(location: GLint; count: GLsizei; transpose: GLboolean; const value: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glValidateProgram: procedure(_program: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1d: procedure(index: GLuint; x: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1dv: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1f: procedure(index: GLuint; x: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1fv: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1s: procedure(index: GLuint; x: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib1sv: procedure(index: GLuint; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2d: procedure(index: GLuint; x: GLdouble; y: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2dv: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2f: procedure(index: GLuint; x: GLfloat; y: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2fv: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2s: procedure(index: GLuint; x: GLshort; y: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib2sv: procedure(index: GLuint; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3d: procedure(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3dv: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3f: procedure(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3fv: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3s: procedure(index: GLuint; x: GLshort; y: GLshort; z: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib3sv: procedure(index: GLuint; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4Nbv: procedure(index: GLuint; const v: PGLbyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4Niv: procedure(index: GLuint; const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4Nsv: procedure(index: GLuint; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4Nub: procedure(index: GLuint; x: GLubyte; y: GLubyte; z: GLubyte; w: GLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4Nubv: procedure(index: GLuint; const v: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4Nuiv: procedure(index: GLuint; const v: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4Nusv: procedure(index: GLuint; const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4bv: procedure(index: GLuint; const v: PGLbyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4d: procedure(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4dv: procedure(index: GLuint; const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4f: procedure(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4fv: procedure(index: GLuint; const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4iv: procedure(index: GLuint; const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4s: procedure(index: GLuint; x: GLshort; y: GLshort; z: GLshort; w: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4sv: procedure(index: GLuint; const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4ubv: procedure(index: GLuint; const v: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4uiv: procedure(index: GLuint; const v: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttrib4usv: procedure(index: GLuint; const v: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexAttribPointer: procedure(index: GLuint; size: GLint; _type: GLenum; normalized: GLboolean; stride: GLsizei; const pointer: PGLvoid); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + +function Load_GL_version_2_0: Boolean; + implementation uses @@ -4125,7 +4657,7 @@ begin end; -{$IFDEF Win32} +{$IFDEF WINDOWS} function Load_WGL_ARB_extensions_string: Boolean; var extstring : PChar; @@ -5736,7 +6268,7 @@ begin if not Assigned(glVertexArrayRangeNV) then Exit; @glFlushVertexArrayRangeNV := SDL_GL_GetProcAddress('glFlushVertexArrayRangeNV'); if not Assigned(glFlushVertexArrayRangeNV) then Exit; - {$IFDEF WIN32} + {$IFDEF WINDOWS} @wglAllocateMemoryNV := SDL_GL_GetProcAddress('wglAllocateMemoryNV'); if not Assigned(wglAllocateMemoryNV) then Exit; @wglFreeMemoryNV := SDL_GL_GetProcAddress('wglFreeMemoryNV'); @@ -6181,7 +6713,7 @@ begin end; -{$IFDEF WIN32} +{$IFDEF WINDOWS} function Load_WGL_I3D_image_buffer: Boolean; var extstring : PChar; @@ -7007,7 +7539,7 @@ begin end; -{$IFDEF WIN32} +{$IFDEF WINDOWS} function Load_WGL_ARB_pixel_format: Boolean; var extstring : PChar; @@ -7435,7 +7967,7 @@ begin end; -{$IFDEF WIN32} +{$IFDEF WINDOWS} function Load_WGL_NV_render_texture_rectangle: Boolean; var extstring : PChar; @@ -7468,7 +8000,7 @@ begin if not Assigned(glPixelDataRangeNV) then Exit; @glFlushPixelDataRangeNV := SDL_GL_GetProcAddress('glFlushPixelDataRangeNV'); if not Assigned(glFlushPixelDataRangeNV) then Exit; - {$IFDEF WIN32} + {$IFDEF WINDOWS} @wglAllocateMemoryNV := SDL_GL_GetProcAddress('wglAllocateMemoryNV'); if not Assigned(wglAllocateMemoryNV) then Exit; @wglFreeMemoryNV := SDL_GL_GetProcAddress('wglFreeMemoryNV'); @@ -7526,7 +8058,7 @@ begin end; -{$IFDEF WIN32} +{$IFDEF WINDOWS} function Load_WGL_ATI_pixel_format_float: Boolean; var extstring : PChar; @@ -8327,7 +8859,515 @@ begin end; -function glext_LoadExtension(ext: PChar): Boolean; +function Load_GL_ARB_draw_buffers: Boolean; +var + extstring: PChar; +begin + + Result := FALSE; + extstring := glGetString(GL_EXTENSIONS); + + if glext_ExtensionSupported('GL_ARB_draw_buffers', extstring) then + begin + glDrawBuffersARB := SDL_GL_GetProcAddress('glDrawBuffersARB'); + if not Assigned(glDrawBuffersARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_texture_rectangle: Boolean; +var + extstring: PChar; +begin + + Result := FALSE; + extstring := glGetString(GL_EXTENSIONS); + + if glext_ExtensionSupported('GL_ARB_texture_rectangle', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_color_buffer_float: Boolean; +var + extstring: PChar; +begin + + Result := FALSE; + extstring := glGetString(GL_EXTENSIONS); + + if glext_ExtensionSupported('GL_ARB_color_buffer_float', extstring) then + begin + glClampColorARB := SDL_GL_GetProcAddress('glClampColorARB'); + if not Assigned(glClampColorARB) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_ARB_half_float_pixel: Boolean; +var + extstring: PChar; +begin + + Result := FALSE; + extstring := glGetString(GL_EXTENSIONS); + + if glext_ExtensionSupported('GL_ARB_half_float_pixel', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_texture_float: Boolean; +var + extstring: PChar; +begin + + Result := FALSE; + extstring := glGetString(GL_EXTENSIONS); + + if glext_ExtensionSupported('GL_ARB_texture_float', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_texture_compression_dxt1: Boolean; +var + extstring: PChar; +begin + + Result := FALSE; + extstring := glGetString(GL_EXTENSIONS); + + if glext_ExtensionSupported('GL_EXT_texture_compression_dxt1', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_ARB_pixel_buffer_object: Boolean; +var + extstring: PChar; +begin + + Result := FALSE; + extstring := glGetString(GL_EXTENSIONS); + + if glext_ExtensionSupported('GL_ARB_pixel_buffer_object', extstring) then + begin + Result := TRUE; + end; + +end; + +function Load_GL_EXT_framebuffer_object: Boolean; +var + extstring: PChar; +begin + + Result := FALSE; + extstring := glGetString(GL_EXTENSIONS); + + if glext_ExtensionSupported('GL_EXT_framebuffer_object', extstring) then + begin + glIsRenderbufferEXT := SDL_GL_GetProcAddress('glIsRenderbufferEXT'); + if not Assigned(glIsRenderbufferEXT) then Exit; + glBindRenderbufferEXT := SDL_GL_GetProcAddress('glBindRenderbufferEXT'); + if not Assigned(glBindRenderbufferEXT) then Exit; + glDeleteRenderbuffersEXT := SDL_GL_GetProcAddress('glDeleteRenderbuffersEXT'); + if not Assigned(glDeleteRenderbuffersEXT) then Exit; + glGenRenderbuffersEXT := SDL_GL_GetProcAddress('glGenRenderbuffersEXT'); + if not Assigned(glGenRenderbuffersEXT) then Exit; + glRenderbufferStorageEXT := SDL_GL_GetProcAddress('glRenderbufferStorageEXT'); + if not Assigned(glRenderbufferStorageEXT) then Exit; + glGetRenderbufferParameterivEXT := SDL_GL_GetProcAddress('glGetRenderbufferParameterivEXT'); + if not Assigned(glGetRenderbufferParameterivEXT) then Exit; + glIsFramebufferEXT := SDL_GL_GetProcAddress('glIsFramebufferEXT'); + if not Assigned(glIsFramebufferEXT) then Exit; + glBindFramebufferEXT := SDL_GL_GetProcAddress('glBindFramebufferEXT'); + if not Assigned(glBindFramebufferEXT) then Exit; + glDeleteFramebuffersEXT := SDL_GL_GetProcAddress('glDeleteFramebuffersEXT'); + if not Assigned(glDeleteFramebuffersEXT) then Exit; + glGenFramebuffersEXT := SDL_GL_GetProcAddress('glGenFramebuffersEXT'); + if not Assigned(glGenFramebuffersEXT) then Exit; + glCheckFramebufferStatusEXT := SDL_GL_GetProcAddress('glCheckFramebufferStatusEXT'); + if not Assigned(glCheckFramebufferStatusEXT) then Exit; + glFramebufferTexture1DEXT := SDL_GL_GetProcAddress('glFramebufferTexture1DEXT'); + if not Assigned(glFramebufferTexture1DEXT) then Exit; + glFramebufferTexture2DEXT := SDL_GL_GetProcAddress('glFramebufferTexture2DEXT'); + if not Assigned(glFramebufferTexture2DEXT) then Exit; + glFramebufferTexture3DEXT := SDL_GL_GetProcAddress('glFramebufferTexture3DEXT'); + if not Assigned(glFramebufferTexture3DEXT) then Exit; + glFramebufferRenderbufferEXT := SDL_GL_GetProcAddress('glFramebufferRenderbufferEXT'); + if not Assigned(glFramebufferRenderbufferEXT) then Exit; + glGetFramebufferAttachmentParameterivEXT := SDL_GL_GetProcAddress('glGetFramebufferAttachmentParameterivEXT'); + if not Assigned(glGetFramebufferAttachmentParameterivEXT) then Exit; + glGenerateMipmapEXT := SDL_GL_GetProcAddress('glGenerateMipmapEXT'); + if not Assigned(glGenerateMipmapEXT) then Exit; + Result := TRUE; + end; + +end; + +function Load_GL_version_1_4: Boolean; +var + extstring: String; +begin + + Result := FALSE; + extstring := String(PChar(glGetString(GL_EXTENSIONS))); + + glBlendFuncSeparate := SDL_GL_GetProcAddress('glBlendFuncSeparate'); + if not Assigned(glBlendFuncSeparate) then Exit; + glFogCoordf := SDL_GL_GetProcAddress('glFogCoordf'); + if not Assigned(glFogCoordf) then Exit; + glFogCoordfv := SDL_GL_GetProcAddress('glFogCoordfv'); + if not Assigned(glFogCoordfv) then Exit; + glFogCoordd := SDL_GL_GetProcAddress('glFogCoordd'); + if not Assigned(glFogCoordd) then Exit; + glFogCoorddv := SDL_GL_GetProcAddress('glFogCoorddv'); + if not Assigned(glFogCoorddv) then Exit; + glFogCoordPointer := SDL_GL_GetProcAddress('glFogCoordPointer'); + if not Assigned(glFogCoordPointer) then Exit; + glMultiDrawArrays := SDL_GL_GetProcAddress('glMultiDrawArrays'); + if not Assigned(glMultiDrawArrays) then Exit; + glMultiDrawElements := SDL_GL_GetProcAddress('glMultiDrawElements'); + if not Assigned(glMultiDrawElements) then Exit; + glPointParameterf := SDL_GL_GetProcAddress('glPointParameterf'); + if not Assigned(glPointParameterf) then Exit; + glPointParameterfv := SDL_GL_GetProcAddress('glPointParameterfv'); + if not Assigned(glPointParameterfv) then Exit; + glPointParameteri := SDL_GL_GetProcAddress('glPointParameteri'); + if not Assigned(glPointParameteri) then Exit; + glPointParameteriv := SDL_GL_GetProcAddress('glPointParameteriv'); + if not Assigned(glPointParameteriv) then Exit; + glSecondaryColor3b := SDL_GL_GetProcAddress('glSecondaryColor3b'); + if not Assigned(glSecondaryColor3b) then Exit; + glSecondaryColor3bv := SDL_GL_GetProcAddress('glSecondaryColor3bv'); + if not Assigned(glSecondaryColor3bv) then Exit; + glSecondaryColor3d := SDL_GL_GetProcAddress('glSecondaryColor3d'); + if not Assigned(glSecondaryColor3d) then Exit; + glSecondaryColor3dv := SDL_GL_GetProcAddress('glSecondaryColor3dv'); + if not Assigned(glSecondaryColor3dv) then Exit; + glSecondaryColor3f := SDL_GL_GetProcAddress('glSecondaryColor3f'); + if not Assigned(glSecondaryColor3f) then Exit; + glSecondaryColor3fv := SDL_GL_GetProcAddress('glSecondaryColor3fv'); + if not Assigned(glSecondaryColor3fv) then Exit; + glSecondaryColor3i := SDL_GL_GetProcAddress('glSecondaryColor3i'); + if not Assigned(glSecondaryColor3i) then Exit; + glSecondaryColor3iv := SDL_GL_GetProcAddress('glSecondaryColor3iv'); + if not Assigned(glSecondaryColor3iv) then Exit; + glSecondaryColor3s := SDL_GL_GetProcAddress('glSecondaryColor3s'); + if not Assigned(glSecondaryColor3s) then Exit; + glSecondaryColor3sv := SDL_GL_GetProcAddress('glSecondaryColor3sv'); + if not Assigned(glSecondaryColor3sv) then Exit; + glSecondaryColor3ub := SDL_GL_GetProcAddress('glSecondaryColor3ub'); + if not Assigned(glSecondaryColor3ub) then Exit; + glSecondaryColor3ubv := SDL_GL_GetProcAddress('glSecondaryColor3ubv'); + if not Assigned(glSecondaryColor3ubv) then Exit; + glSecondaryColor3ui := SDL_GL_GetProcAddress('glSecondaryColor3ui'); + if not Assigned(glSecondaryColor3ui) then Exit; + glSecondaryColor3uiv := SDL_GL_GetProcAddress('glSecondaryColor3uiv'); + if not Assigned(glSecondaryColor3uiv) then Exit; + glSecondaryColor3us := SDL_GL_GetProcAddress('glSecondaryColor3us'); + if not Assigned(glSecondaryColor3us) then Exit; + glSecondaryColor3usv := SDL_GL_GetProcAddress('glSecondaryColor3usv'); + if not Assigned(glSecondaryColor3usv) then Exit; + glSecondaryColorPointer := SDL_GL_GetProcAddress('glSecondaryColorPointer'); + if not Assigned(glSecondaryColorPointer) then Exit; + glWindowPos2d := SDL_GL_GetProcAddress('glWindowPos2d'); + if not Assigned(glWindowPos2d) then Exit; + glWindowPos2dv := SDL_GL_GetProcAddress('glWindowPos2dv'); + if not Assigned(glWindowPos2dv) then Exit; + glWindowPos2f := SDL_GL_GetProcAddress('glWindowPos2f'); + if not Assigned(glWindowPos2f) then Exit; + glWindowPos2fv := SDL_GL_GetProcAddress('glWindowPos2fv'); + if not Assigned(glWindowPos2fv) then Exit; + glWindowPos2i := SDL_GL_GetProcAddress('glWindowPos2i'); + if not Assigned(glWindowPos2i) then Exit; + glWindowPos2iv := SDL_GL_GetProcAddress('glWindowPos2iv'); + if not Assigned(glWindowPos2iv) then Exit; + glWindowPos2s := SDL_GL_GetProcAddress('glWindowPos2s'); + if not Assigned(glWindowPos2s) then Exit; + glWindowPos2sv := SDL_GL_GetProcAddress('glWindowPos2sv'); + if not Assigned(glWindowPos2sv) then Exit; + glWindowPos3d := SDL_GL_GetProcAddress('glWindowPos3d'); + if not Assigned(glWindowPos3d) then Exit; + glWindowPos3dv := SDL_GL_GetProcAddress('glWindowPos3dv'); + if not Assigned(glWindowPos3dv) then Exit; + glWindowPos3f := SDL_GL_GetProcAddress('glWindowPos3f'); + if not Assigned(glWindowPos3f) then Exit; + glWindowPos3fv := SDL_GL_GetProcAddress('glWindowPos3fv'); + if not Assigned(glWindowPos3fv) then Exit; + glWindowPos3i := SDL_GL_GetProcAddress('glWindowPos3i'); + if not Assigned(glWindowPos3i) then Exit; + glWindowPos3iv := SDL_GL_GetProcAddress('glWindowPos3iv'); + if not Assigned(glWindowPos3iv) then Exit; + glWindowPos3s := SDL_GL_GetProcAddress('glWindowPos3s'); + if not Assigned(glWindowPos3s) then Exit; + glWindowPos3sv := SDL_GL_GetProcAddress('glWindowPos3sv'); + if not Assigned(glWindowPos3sv) then Exit; + Result := TRUE; + +end; + +function Load_GL_version_1_5: Boolean; +var + extstring: String; +begin + + Result := FALSE; + extstring := String(PChar(glGetString(GL_EXTENSIONS))); + + glGenQueries := SDL_GL_GetProcAddress('glGenQueries'); + if not Assigned(glGenQueries) then Exit; + glDeleteQueries := SDL_GL_GetProcAddress('glDeleteQueries'); + if not Assigned(glDeleteQueries) then Exit; + glIsQuery := SDL_GL_GetProcAddress('glIsQuery'); + if not Assigned(glIsQuery) then Exit; + glBeginQuery := SDL_GL_GetProcAddress('glBeginQuery'); + if not Assigned(glBeginQuery) then Exit; + glEndQuery := SDL_GL_GetProcAddress('glEndQuery'); + if not Assigned(glEndQuery) then Exit; + glGetQueryiv := SDL_GL_GetProcAddress('glGetQueryiv'); + if not Assigned(glGetQueryiv) then Exit; + glGetQueryObjectiv := SDL_GL_GetProcAddress('glGetQueryObjectiv'); + if not Assigned(glGetQueryObjectiv) then Exit; + glGetQueryObjectuiv := SDL_GL_GetProcAddress('glGetQueryObjectuiv'); + if not Assigned(glGetQueryObjectuiv) then Exit; + glBindBuffer := SDL_GL_GetProcAddress('glBindBuffer'); + if not Assigned(glBindBuffer) then Exit; + glDeleteBuffers := SDL_GL_GetProcAddress('glDeleteBuffers'); + if not Assigned(glDeleteBuffers) then Exit; + glGenBuffers := SDL_GL_GetProcAddress('glGenBuffers'); + if not Assigned(glGenBuffers) then Exit; + glIsBuffer := SDL_GL_GetProcAddress('glIsBuffer'); + if not Assigned(glIsBuffer) then Exit; + glBufferData := SDL_GL_GetProcAddress('glBufferData'); + if not Assigned(glBufferData) then Exit; + glBufferSubData := SDL_GL_GetProcAddress('glBufferSubData'); + if not Assigned(glBufferSubData) then Exit; + glGetBufferSubData := SDL_GL_GetProcAddress('glGetBufferSubData'); + if not Assigned(glGetBufferSubData) then Exit; + glMapBuffer := SDL_GL_GetProcAddress('glMapBuffer'); + if not Assigned(glMapBuffer) then Exit; + glUnmapBuffer := SDL_GL_GetProcAddress('glUnmapBuffer'); + if not Assigned(glUnmapBuffer) then Exit; + glGetBufferParameteriv := SDL_GL_GetProcAddress('glGetBufferParameteriv'); + if not Assigned(glGetBufferParameteriv) then Exit; + glGetBufferPointerv := SDL_GL_GetProcAddress('glGetBufferPointerv'); + if not Assigned(glGetBufferPointerv) then Exit; + Result := TRUE; + +end; + +function Load_GL_version_2_0: Boolean; +var + extstring: String; +begin + + Result := FALSE; + extstring := String(PChar(glGetString(GL_EXTENSIONS))); + + glBlendEquationSeparate := SDL_GL_GetProcAddress('glBlendEquationSeparate'); + if not Assigned(glBlendEquationSeparate) then Exit; + glDrawBuffers := SDL_GL_GetProcAddress('glDrawBuffers'); + if not Assigned(glDrawBuffers) then Exit; + glStencilOpSeparate := SDL_GL_GetProcAddress('glStencilOpSeparate'); + if not Assigned(glStencilOpSeparate) then Exit; + glStencilFuncSeparate := SDL_GL_GetProcAddress('glStencilFuncSeparate'); + if not Assigned(glStencilFuncSeparate) then Exit; + glStencilMaskSeparate := SDL_GL_GetProcAddress('glStencilMaskSeparate'); + if not Assigned(glStencilMaskSeparate) then Exit; + glAttachShader := SDL_GL_GetProcAddress('glAttachShader'); + if not Assigned(glAttachShader) then Exit; + glBindAttribLocation := SDL_GL_GetProcAddress('glBindAttribLocation'); + if not Assigned(glBindAttribLocation) then Exit; + glCompileShader := SDL_GL_GetProcAddress('glCompileShader'); + if not Assigned(glCompileShader) then Exit; + glCreateProgram := SDL_GL_GetProcAddress('glCreateProgram'); + if not Assigned(glCreateProgram) then Exit; + glCreateShader := SDL_GL_GetProcAddress('glCreateShader'); + if not Assigned(glCreateShader) then Exit; + glDeleteProgram := SDL_GL_GetProcAddress('glDeleteProgram'); + if not Assigned(glDeleteProgram) then Exit; + glDeleteShader := SDL_GL_GetProcAddress('glDeleteShader'); + if not Assigned(glDeleteShader) then Exit; + glDetachShader := SDL_GL_GetProcAddress('glDetachShader'); + if not Assigned(glDetachShader) then Exit; + glDisableVertexAttribArray := SDL_GL_GetProcAddress('glDisableVertexAttribArray'); + if not Assigned(glDisableVertexAttribArray) then Exit; + glEnableVertexAttribArray := SDL_GL_GetProcAddress('glEnableVertexAttribArray'); + if not Assigned(glEnableVertexAttribArray) then Exit; + glGetActiveAttrib := SDL_GL_GetProcAddress('glGetActiveAttrib'); + if not Assigned(glGetActiveAttrib) then Exit; + glGetActiveUniform := SDL_GL_GetProcAddress('glGetActiveUniform'); + if not Assigned(glGetActiveUniform) then Exit; + glGetAttachedShaders := SDL_GL_GetProcAddress('glGetAttachedShaders'); + if not Assigned(glGetAttachedShaders) then Exit; + glGetAttribLocation := SDL_GL_GetProcAddress('glGetAttribLocation'); + if not Assigned(glGetAttribLocation) then Exit; + glGetProgramiv := SDL_GL_GetProcAddress('glGetProgramiv'); + if not Assigned(glGetProgramiv) then Exit; + glGetProgramInfoLog := SDL_GL_GetProcAddress('glGetProgramInfoLog'); + if not Assigned(glGetProgramInfoLog) then Exit; + glGetShaderiv := SDL_GL_GetProcAddress('glGetShaderiv'); + if not Assigned(glGetShaderiv) then Exit; + glGetShaderInfoLog := SDL_GL_GetProcAddress('glGetShaderInfoLog'); + if not Assigned(glGetShaderInfoLog) then Exit; + glGetShaderSource := SDL_GL_GetProcAddress('glGetShaderSource'); + if not Assigned(glGetShaderSource) then Exit; + glGetUniformLocation := SDL_GL_GetProcAddress('glGetUniformLocation'); + if not Assigned(glGetUniformLocation) then Exit; + glGetUniformfv := SDL_GL_GetProcAddress('glGetUniformfv'); + if not Assigned(glGetUniformfv) then Exit; + glGetUniformiv := SDL_GL_GetProcAddress('glGetUniformiv'); + if not Assigned(glGetUniformiv) then Exit; + glGetVertexAttribdv := SDL_GL_GetProcAddress('glGetVertexAttribdv'); + if not Assigned(glGetVertexAttribdv) then Exit; + glGetVertexAttribfv := SDL_GL_GetProcAddress('glGetVertexAttribfv'); + if not Assigned(glGetVertexAttribfv) then Exit; + glGetVertexAttribiv := SDL_GL_GetProcAddress('glGetVertexAttribiv'); + if not Assigned(glGetVertexAttribiv) then Exit; + glGetVertexAttribPointerv := SDL_GL_GetProcAddress('glGetVertexAttribPointerv'); + if not Assigned(glGetVertexAttribPointerv) then Exit; + glIsProgram := SDL_GL_GetProcAddress('glIsProgram'); + if not Assigned(glIsProgram) then Exit; + glIsShader := SDL_GL_GetProcAddress('glIsShader'); + if not Assigned(glIsShader) then Exit; + glLinkProgram := SDL_GL_GetProcAddress('glLinkProgram'); + if not Assigned(glLinkProgram) then Exit; + glShaderSource := SDL_GL_GetProcAddress('glShaderSource'); + if not Assigned(glShaderSource) then Exit; + glUseProgram := SDL_GL_GetProcAddress('glUseProgram'); + if not Assigned(glUseProgram) then Exit; + glUniform1f := SDL_GL_GetProcAddress('glUniform1f'); + if not Assigned(glUniform1f) then Exit; + glUniform2f := SDL_GL_GetProcAddress('glUniform2f'); + if not Assigned(glUniform2f) then Exit; + glUniform3f := SDL_GL_GetProcAddress('glUniform3f'); + if not Assigned(glUniform3f) then Exit; + glUniform4f := SDL_GL_GetProcAddress('glUniform4f'); + if not Assigned(glUniform4f) then Exit; + glUniform1i := SDL_GL_GetProcAddress('glUniform1i'); + if not Assigned(glUniform1i) then Exit; + glUniform2i := SDL_GL_GetProcAddress('glUniform2i'); + if not Assigned(glUniform2i) then Exit; + glUniform3i := SDL_GL_GetProcAddress('glUniform3i'); + if not Assigned(glUniform3i) then Exit; + glUniform4i := SDL_GL_GetProcAddress('glUniform4i'); + if not Assigned(glUniform4i) then Exit; + glUniform1fv := SDL_GL_GetProcAddress('glUniform1fv'); + if not Assigned(glUniform1fv) then Exit; + glUniform2fv := SDL_GL_GetProcAddress('glUniform2fv'); + if not Assigned(glUniform2fv) then Exit; + glUniform3fv := SDL_GL_GetProcAddress('glUniform3fv'); + if not Assigned(glUniform3fv) then Exit; + glUniform4fv := SDL_GL_GetProcAddress('glUniform4fv'); + if not Assigned(glUniform4fv) then Exit; + glUniform1iv := SDL_GL_GetProcAddress('glUniform1iv'); + if not Assigned(glUniform1iv) then Exit; + glUniform2iv := SDL_GL_GetProcAddress('glUniform2iv'); + if not Assigned(glUniform2iv) then Exit; + glUniform3iv := SDL_GL_GetProcAddress('glUniform3iv'); + if not Assigned(glUniform3iv) then Exit; + glUniform4iv := SDL_GL_GetProcAddress('glUniform4iv'); + if not Assigned(glUniform4iv) then Exit; + glUniformMatrix2fv := SDL_GL_GetProcAddress('glUniformMatrix2fv'); + if not Assigned(glUniformMatrix2fv) then Exit; + glUniformMatrix3fv := SDL_GL_GetProcAddress('glUniformMatrix3fv'); + if not Assigned(glUniformMatrix3fv) then Exit; + glUniformMatrix4fv := SDL_GL_GetProcAddress('glUniformMatrix4fv'); + if not Assigned(glUniformMatrix4fv) then Exit; + glValidateProgram := SDL_GL_GetProcAddress('glValidateProgram'); + if not Assigned(glValidateProgram) then Exit; + glVertexAttrib1d := SDL_GL_GetProcAddress('glVertexAttrib1d'); + if not Assigned(glVertexAttrib1d) then Exit; + glVertexAttrib1dv := SDL_GL_GetProcAddress('glVertexAttrib1dv'); + if not Assigned(glVertexAttrib1dv) then Exit; + glVertexAttrib1f := SDL_GL_GetProcAddress('glVertexAttrib1f'); + if not Assigned(glVertexAttrib1f) then Exit; + glVertexAttrib1fv := SDL_GL_GetProcAddress('glVertexAttrib1fv'); + if not Assigned(glVertexAttrib1fv) then Exit; + glVertexAttrib1s := SDL_GL_GetProcAddress('glVertexAttrib1s'); + if not Assigned(glVertexAttrib1s) then Exit; + glVertexAttrib1sv := SDL_GL_GetProcAddress('glVertexAttrib1sv'); + if not Assigned(glVertexAttrib1sv) then Exit; + glVertexAttrib2d := SDL_GL_GetProcAddress('glVertexAttrib2d'); + if not Assigned(glVertexAttrib2d) then Exit; + glVertexAttrib2dv := SDL_GL_GetProcAddress('glVertexAttrib2dv'); + if not Assigned(glVertexAttrib2dv) then Exit; + glVertexAttrib2f := SDL_GL_GetProcAddress('glVertexAttrib2f'); + if not Assigned(glVertexAttrib2f) then Exit; + glVertexAttrib2fv := SDL_GL_GetProcAddress('glVertexAttrib2fv'); + if not Assigned(glVertexAttrib2fv) then Exit; + glVertexAttrib2s := SDL_GL_GetProcAddress('glVertexAttrib2s'); + if not Assigned(glVertexAttrib2s) then Exit; + glVertexAttrib2sv := SDL_GL_GetProcAddress('glVertexAttrib2sv'); + if not Assigned(glVertexAttrib2sv) then Exit; + glVertexAttrib3d := SDL_GL_GetProcAddress('glVertexAttrib3d'); + if not Assigned(glVertexAttrib3d) then Exit; + glVertexAttrib3dv := SDL_GL_GetProcAddress('glVertexAttrib3dv'); + if not Assigned(glVertexAttrib3dv) then Exit; + glVertexAttrib3f := SDL_GL_GetProcAddress('glVertexAttrib3f'); + if not Assigned(glVertexAttrib3f) then Exit; + glVertexAttrib3fv := SDL_GL_GetProcAddress('glVertexAttrib3fv'); + if not Assigned(glVertexAttrib3fv) then Exit; + glVertexAttrib3s := SDL_GL_GetProcAddress('glVertexAttrib3s'); + if not Assigned(glVertexAttrib3s) then Exit; + glVertexAttrib3sv := SDL_GL_GetProcAddress('glVertexAttrib3sv'); + if not Assigned(glVertexAttrib3sv) then Exit; + glVertexAttrib4Nbv := SDL_GL_GetProcAddress('glVertexAttrib4Nbv'); + if not Assigned(glVertexAttrib4Nbv) then Exit; + glVertexAttrib4Niv := SDL_GL_GetProcAddress('glVertexAttrib4Niv'); + if not Assigned(glVertexAttrib4Niv) then Exit; + glVertexAttrib4Nsv := SDL_GL_GetProcAddress('glVertexAttrib4Nsv'); + if not Assigned(glVertexAttrib4Nsv) then Exit; + glVertexAttrib4Nub := SDL_GL_GetProcAddress('glVertexAttrib4Nub'); + if not Assigned(glVertexAttrib4Nub) then Exit; + glVertexAttrib4Nubv := SDL_GL_GetProcAddress('glVertexAttrib4Nubv'); + if not Assigned(glVertexAttrib4Nubv) then Exit; + glVertexAttrib4Nuiv := SDL_GL_GetProcAddress('glVertexAttrib4Nuiv'); + if not Assigned(glVertexAttrib4Nuiv) then Exit; + glVertexAttrib4Nusv := SDL_GL_GetProcAddress('glVertexAttrib4Nusv'); + if not Assigned(glVertexAttrib4Nusv) then Exit; + glVertexAttrib4bv := SDL_GL_GetProcAddress('glVertexAttrib4bv'); + if not Assigned(glVertexAttrib4bv) then Exit; + glVertexAttrib4d := SDL_GL_GetProcAddress('glVertexAttrib4d'); + if not Assigned(glVertexAttrib4d) then Exit; + glVertexAttrib4dv := SDL_GL_GetProcAddress('glVertexAttrib4dv'); + if not Assigned(glVertexAttrib4dv) then Exit; + glVertexAttrib4f := SDL_GL_GetProcAddress('glVertexAttrib4f'); + if not Assigned(glVertexAttrib4f) then Exit; + glVertexAttrib4fv := SDL_GL_GetProcAddress('glVertexAttrib4fv'); + if not Assigned(glVertexAttrib4fv) then Exit; + glVertexAttrib4iv := SDL_GL_GetProcAddress('glVertexAttrib4iv'); + if not Assigned(glVertexAttrib4iv) then Exit; + glVertexAttrib4s := SDL_GL_GetProcAddress('glVertexAttrib4s'); + if not Assigned(glVertexAttrib4s) then Exit; + glVertexAttrib4sv := SDL_GL_GetProcAddress('glVertexAttrib4sv'); + if not Assigned(glVertexAttrib4sv) then Exit; + glVertexAttrib4ubv := SDL_GL_GetProcAddress('glVertexAttrib4ubv'); + if not Assigned(glVertexAttrib4ubv) then Exit; + glVertexAttrib4uiv := SDL_GL_GetProcAddress('glVertexAttrib4uiv'); + if not Assigned(glVertexAttrib4uiv) then Exit; + glVertexAttrib4usv := SDL_GL_GetProcAddress('glVertexAttrib4usv'); + if not Assigned(glVertexAttrib4usv) then Exit; + glVertexAttribPointer := SDL_GL_GetProcAddress('glVertexAttribPointer'); + if not Assigned(glVertexAttribPointer) then Exit; + Result := TRUE; + +end; + +function glext_LoadExtension(ext: String): Boolean; begin Result := FALSE; @@ -8339,7 +9379,7 @@ begin else if ext = 'GL_ARB_transpose_matrix' then Result := Load_GL_ARB_transpose_matrix else if ext = 'GL_ARB_multisample' then Result := Load_GL_ARB_multisample else if ext = 'GL_ARB_texture_env_add' then Result := Load_GL_ARB_texture_env_add - {$IFDEF WIN32} + {$IFDEF WINDOWS} else if ext = 'WGL_ARB_extensions_string' then Result := Load_WGL_ARB_extensions_string else if ext = 'WGL_ARB_buffer_region' then Result := Load_WGL_ARB_buffer_region {$ENDIF} @@ -8425,7 +9465,7 @@ begin else if ext = 'GL_ATI_texture_mirror_once' then Result := Load_GL_ATI_texture_mirror_once else if ext = 'GL_ATI_vertex_array_object' then Result := Load_GL_ATI_vertex_array_object else if ext = 'GL_ATI_vertex_streams' then Result := Load_GL_ATI_vertex_streams - {$IFDEF WIN32} + {$IFDEF WINDOWS} else if ext = 'WGL_I3D_image_buffer' then Result := Load_WGL_I3D_image_buffer else if ext = 'WGL_I3D_swap_frame_lock' then Result := Load_WGL_I3D_swap_frame_lock else if ext = 'WGL_I3D_swap_frame_usage' then Result := Load_WGL_I3D_swap_frame_usage @@ -8463,7 +9503,7 @@ begin else if ext = 'GL_APPLE_fence' then Result := Load_GL_APPLE_fence else if ext = 'GL_APPLE_vertex_array_object' then Result := Load_GL_APPLE_vertex_array_object else if ext = 'GL_APPLE_vertex_array_range' then Result := Load_GL_APPLE_vertex_array_range - {$IFDEF WIN32} + {$IFDEF WINDOWS} else if ext = 'WGL_ARB_pixel_format' then Result := Load_WGL_ARB_pixel_format else if ext = 'WGL_ARB_make_current_read' then Result := Load_WGL_ARB_make_current_read else if ext = 'WGL_ARB_pbuffer' then Result := Load_WGL_ARB_pbuffer @@ -8483,14 +9523,14 @@ begin else if ext = 'GL_NV_fragment_program' then Result := Load_GL_NV_fragment_program else if ext = 'GL_NV_primitive_restart' then Result := Load_GL_NV_primitive_restart else if ext = 'GL_NV_vertex_program2' then Result := Load_GL_NV_vertex_program2 - {$IFDEF WIN32} + {$IFDEF WINDOWS} else if ext = 'WGL_NV_render_texture_rectangle' then Result := Load_WGL_NV_render_texture_rectangle {$ENDIF} else if ext = 'GL_NV_pixel_data_range' then Result := Load_GL_NV_pixel_data_range else if ext = 'GL_EXT_texture_rectangle' then Result := Load_GL_EXT_texture_rectangle else if ext = 'GL_S3_s3tc' then Result := Load_GL_S3_s3tc else if ext = 'GL_ATI_draw_buffers' then Result := Load_GL_ATI_draw_buffers - {$IFDEF WIN32} + {$IFDEF WINDOWS} else if ext = 'WGL_ATI_pixel_format_float' then Result := Load_WGL_ATI_pixel_format_float {$ENDIF} else if ext = 'GL_ATI_texture_env_combine3' then Result := Load_GL_ATI_texture_env_combine3 @@ -8521,6 +9561,17 @@ begin else if ext = 'GL_NV_fragment_program2' then Result := Load_GL_NV_fragment_program2 else if ext = 'GL_NV_vertex_program2_option' then Result := Load_GL_NV_vertex_program2_option else if ext = 'GL_NV_vertex_program3' then Result := Load_GL_NV_vertex_program3 + else if ext = 'GL_ARB_draw_buffers' then Result := Load_GL_ARB_draw_buffers + else if ext = 'GL_ARB_texture_rectangle' then Result := Load_GL_ARB_texture_rectangle + else if ext = 'GL_ARB_color_buffer_float' then Result := Load_GL_ARB_color_buffer_float + else if ext = 'GL_ARB_half_float_pixel' then Result := Load_GL_ARB_half_float_pixel + else if ext = 'GL_ARB_texture_float' then Result := Load_GL_ARB_texture_float + else if ext = 'GL_EXT_texture_compression_dxt1' then Result := Load_GL_EXT_texture_compression_dxt1 + else if ext = 'GL_ARB_pixel_buffer_object' then Result := Load_GL_ARB_pixel_buffer_object + else if ext = 'GL_EXT_framebuffer_object' then Result := Load_GL_EXT_framebuffer_object + else if ext = 'GL_version_1_4' then Result := Load_GL_version_1_4 + else if ext = 'GL_version_1_5' then Result := Load_GL_version_1_5 + else if ext = 'GL_version_2_0' then Result := Load_GL_version_2_0 end; diff --git a/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glu.pas b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glu.pas index fb48f65d..371ccdda 100644 --- a/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glu.pas +++ b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glu.pas @@ -1,6 +1,6 @@ unit glu; { - $Id: glu.pas,v 1.3 2004/10/07 21:01:29 savage Exp $ + $Id: glu.pas,v 1.8 2007/05/20 20:28:31 savage Exp $ Adaption of the delphi3d.net OpenGL units to FreePascal Sebastian Guenther (sg@freepascal.org) in 2002 @@ -62,6 +62,21 @@ Abstract: { $Log: glu.pas,v $ + Revision 1.8 2007/05/20 20:28:31 savage + Initial Changes to Handle 64 Bits + + Revision 1.7 2006/11/26 16:35:49 savage + Messed up the last change to GLUtessCombineDataProc, had to reapply it. Thanks Michalis. + + Revision 1.6 2006/11/25 23:38:02 savage + Changes as proposed by Michalis Kamburelis for better FPC support + + Revision 1.5 2006/11/20 21:20:59 savage + Updated to work in MacOS X + + Revision 1.4 2005/05/22 18:52:09 savage + Changes as suggested by Michalis Kamburelis. Thanks again. + Revision 1.3 2004/10/07 21:01:29 savage Fix for FPC @@ -117,156 +132,159 @@ uses gl; const -{$IFDEF WIN32} - GLuLibName = 'glu32.dll'; +{$IFDEF WINDOWS} + GLuLibName = 'glu32.dll'; {$ENDIF} {$IFDEF UNIX} {$IFDEF DARWIN} - GLuLibName = 'libGLU.dylib'; + GLuLibName = '/System/Library/Frameworks/OpenGL.framework/Libraries/libGLU.dylib'; {$ELSE} - GLuLibName = 'libGLU.so'; + GLuLibName = 'libGLU.so'; {$ENDIF} {$ENDIF} type - TViewPortArray = array [0..3] of GLint; - T16dArray = array [0..15] of GLdouble; + TViewPortArray = array[ 0..3 ] of GLint; + T16dArray = array[ 0..15 ] of GLdouble; TCallBack = procedure; - T3dArray = array [0..2] of GLdouble; - T4pArray = array [0..3] of Pointer; - T4fArray = array [0..3] of GLfloat; - {$IFNDEF __GPC__} + T3dArray = array[ 0..2 ] of GLdouble; + T4pArray = array[ 0..3 ] of Pointer; + T4fArray = array[ 0..3 ] of GLfloat; +{$IFNDEF __GPC__} PPointer = ^Pointer; - {$ENDIF} +{$ENDIF} var - gluErrorString: function(errCode: GLenum): PGLubyte; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluErrorUnicodeStringEXT: function(errCode: GLenum): PWideChar; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluGetString: function(name: GLenum): PGLubyte; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluOrtho2D: procedure(left,right, bottom, top: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluPerspective: procedure(fovy, aspect, zNear, zFar: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluPickMatrix: procedure(x, y, width, height: GLdouble; viewport: TViewPortArray); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluLookAt: procedure(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluProject: function(objx, objy, objz: GLdouble; const modelMatrix, projMatrix: T16dArray; viewport: TViewPortArray; winx, winy, winz: PGLdouble): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluUnProject: function(winx, winy, winz: GLdouble; const modelMatrix, projMatrix: T16dArray; viewport: TViewPortArray; objx, objy, objz: PGLdouble): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluScaleImage: function(format: GLenum; widthin, heightin: GLint; typein: GLenum; const datain: Pointer; widthout, heightout: GLint; typeout: GLenum; dataout: Pointer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluBuild1DMipmaps: function(target: GLenum; components, width: GLint; format, atype: GLenum; const data: Pointer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluBuild2DMipmaps: function(target: GLenum; components, width, height: GLint; format, atype: GLenum; const data: Pointer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluErrorString : function( errCode : GLenum ) : PChar; {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluErrorUnicodeStringEXT : function( errCode : GLenum ) : PWideChar; {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluGetString : function( name : GLenum ) : PChar; {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluOrtho2D : procedure( left, right, bottom, top : GLdouble ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluPerspective : procedure( fovy, aspect, zNear, zFar : GLdouble ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluPickMatrix : procedure( x, y, width, height : GLdouble; var viewport : TViewPortArray ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluLookAt : procedure( eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz : GLdouble ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluProject : function( objx, objy, objz : GLdouble; var modelMatrix, projMatrix : T16dArray; var viewport : TViewPortArray; winx, winy, winz : PGLdouble ) : Integer; {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluUnProject : function( winx, winy, winz : GLdouble; var modelMatrix, projMatrix : T16dArray; var viewport : TViewPortArray; objx, objy, objz : PGLdouble ) : Integer; {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluScaleImage : function( format : GLenum; widthin, heightin : GLint; typein : GLenum; const datain : Pointer; widthout, heightout : GLint; typeout : GLenum; dataout : Pointer ) : Integer; {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluBuild1DMipmaps : function( target : GLenum; components, width : GLint; format, atype : GLenum; const data : Pointer ) : Integer; {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluBuild2DMipmaps : function( target : GLenum; components, width, height : GLint; format, atype : GLenum; const data : Pointer ) : Integer; {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} type - GLUnurbs = record end; PGLUnurbs = ^GLUnurbs; - GLUquadric = record end; PGLUquadric = ^GLUquadric; - GLUtesselator = record end; PGLUtesselator = ^GLUtesselator; + GLUnurbs = record + end; PGLUnurbs = ^GLUnurbs; + GLUquadric = record + end; PGLUquadric = ^GLUquadric; + GLUtesselator = record + end; PGLUtesselator = ^GLUtesselator; // backwards compatibility: - GLUnurbsObj = GLUnurbs; PGLUnurbsObj = PGLUnurbs; - GLUquadricObj = GLUquadric; PGLUquadricObj = PGLUquadric; - GLUtesselatorObj = GLUtesselator; PGLUtesselatorObj = PGLUtesselator; - GLUtriangulatorObj = GLUtesselator; PGLUtriangulatorObj = PGLUtesselator; + GLUnurbsObj = GLUnurbs; PGLUnurbsObj = PGLUnurbs; + GLUquadricObj = GLUquadric; PGLUquadricObj = PGLUquadric; + GLUtesselatorObj = GLUtesselator; PGLUtesselatorObj = PGLUtesselator; + GLUtriangulatorObj = GLUtesselator; PGLUtriangulatorObj = PGLUtesselator; var - gluNewQuadric: function: PGLUquadric; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluDeleteQuadric: procedure(state: PGLUquadric); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluQuadricNormals: procedure(quadObject: PGLUquadric; normals: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluQuadricTexture: procedure(quadObject: PGLUquadric; textureCoords: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluQuadricOrientation: procedure(quadObject: PGLUquadric; orientation: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluQuadricDrawStyle: procedure(quadObject: PGLUquadric; drawStyle: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluCylinder: procedure(qobj: PGLUquadric; baseRadius, topRadius, height: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluDisk: procedure(qobj: PGLUquadric; innerRadius, outerRadius: GLdouble; slices, loops: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluPartialDisk: procedure(qobj: PGLUquadric; innerRadius, outerRadius: GLdouble; slices, loops: GLint; startAngle, sweepAngle: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluSphere: procedure(qobj: PGLuquadric; radius: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluQuadricCallback: procedure(qobj: PGLUquadric; which: GLenum; fn: TCallBack); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluNewTess: function: PGLUtesselator; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluDeleteTess: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluTessBeginPolygon: procedure(tess: PGLUtesselator; polygon_data: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluTessBeginContour: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluTessVertex: procedure(tess: PGLUtesselator; coords: T3dArray; data: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluTessEndContour: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluTessEndPolygon: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluTessProperty: procedure(tess: PGLUtesselator; which: GLenum; value: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluTessNormal: procedure(tess: PGLUtesselator; x, y, z: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluTessCallback: procedure(tess: PGLUtesselator; which: GLenum;fn: TCallBack); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluGetTessProperty: procedure(tess: PGLUtesselator; which: GLenum; value: PGLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluNewNurbsRenderer: function: PGLUnurbs; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluDeleteNurbsRenderer: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluBeginSurface: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluBeginCurve: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluEndCurve: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluEndSurface: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluBeginTrim: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluEndTrim: procedure(nobj: PGLUnurbs); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluPwlCurve: procedure(nobj: PGLUnurbs; count: GLint; aarray: PGLfloat; stride: GLint; atype: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluNurbsCurve: procedure(nobj: PGLUnurbs; nknots: GLint; knot: PGLfloat; stride: GLint; ctlarray: PGLfloat; order: GLint; atype: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluNurbsSurface: procedure(nobj: PGLUnurbs; sknot_count: GLint; sknot: PGLfloat; tknot_count: GLint; tknot: PGLfloat; s_stride, t_stride: GLint; ctlarray: PGLfloat; sorder, torder: GLint; atype: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluLoadSamplingMatrices: procedure(nobj: PGLUnurbs; const modelMatrix, projMatrix: T16dArray; viewport: TViewPortArray); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluNurbsProperty: procedure(nobj: PGLUnurbs; aproperty: GLenum; value: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluGetNurbsProperty: procedure(nobj: PGLUnurbs; aproperty: GLenum; value: PGLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluNurbsCallback: procedure(nobj: PGLUnurbs; which: GLenum; fn: TCallBack); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluNewQuadric : function : PGLUquadric; {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluDeleteQuadric : procedure( state : PGLUquadric ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluQuadricNormals : procedure( quadObject : PGLUquadric; normals : GLenum ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluQuadricTexture : procedure( quadObject : PGLUquadric; textureCoords : GLboolean ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluQuadricOrientation : procedure( quadObject : PGLUquadric; orientation : GLenum ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluQuadricDrawStyle : procedure( quadObject : PGLUquadric; drawStyle : GLenum ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluCylinder : procedure( qobj : PGLUquadric; baseRadius, topRadius, height : GLdouble; slices, stacks : GLint ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluDisk : procedure( qobj : PGLUquadric; innerRadius, outerRadius : GLdouble; slices, loops : GLint ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluPartialDisk : procedure( qobj : PGLUquadric; innerRadius, outerRadius : GLdouble; slices, loops : GLint; startAngle, sweepAngle : GLdouble ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluSphere : procedure( qobj : PGLuquadric; radius : GLdouble; slices, stacks : GLint ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluQuadricCallback : procedure( qobj : PGLUquadric; which : GLenum; fn : TCallBack ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluNewTess : function : PGLUtesselator; {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluDeleteTess : procedure( tess : PGLUtesselator ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluTessBeginPolygon : procedure( tess : PGLUtesselator; polygon_data : Pointer ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluTessBeginContour : procedure( tess : PGLUtesselator ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluTessVertex : procedure( tess : PGLUtesselator; var coords : T3dArray; data : Pointer ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluTessEndContour : procedure( tess : PGLUtesselator ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluTessEndPolygon : procedure( tess : PGLUtesselator ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluTessProperty : procedure( tess : PGLUtesselator; which : GLenum; value : GLdouble ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluTessNormal : procedure( tess : PGLUtesselator; x, y, z : GLdouble ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluTessCallback : procedure( tess : PGLUtesselator; which : GLenum; fn : TCallBack ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluGetTessProperty : procedure( tess : PGLUtesselator; which : GLenum; value : PGLdouble ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluNewNurbsRenderer : function : PGLUnurbs; {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluDeleteNurbsRenderer : procedure( nobj : PGLUnurbs ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluBeginSurface : procedure( nobj : PGLUnurbs ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluBeginCurve : procedure( nobj : PGLUnurbs ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluEndCurve : procedure( nobj : PGLUnurbs ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluEndSurface : procedure( nobj : PGLUnurbs ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluBeginTrim : procedure( nobj : PGLUnurbs ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluEndTrim : procedure( nobj : PGLUnurbs ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluPwlCurve : procedure( nobj : PGLUnurbs; count : GLint; aarray : PGLfloat; stride : GLint; atype : GLenum ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluNurbsCurve : procedure( nobj : PGLUnurbs; nknots : GLint; knot : PGLfloat; stride : GLint; ctlarray : PGLfloat; order : GLint; atype : GLenum ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluNurbsSurface : procedure( nobj : PGLUnurbs; sknot_count : GLint; sknot : PGLfloat; tknot_count : GLint; tknot : PGLfloat; s_stride, t_stride : GLint; ctlarray : PGLfloat; sorder, torder : GLint; atype : GLenum ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluLoadSamplingMatrices : procedure( nobj : PGLUnurbs; var modelMatrix, projMatrix : T16dArray; var viewport : TViewPortArray ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluNurbsProperty : procedure( nobj : PGLUnurbs; aproperty : GLenum; value : GLfloat ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluGetNurbsProperty : procedure( nobj : PGLUnurbs; aproperty : GLenum; value : PGLfloat ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluNurbsCallback : procedure( nobj : PGLUnurbs; which : GLenum; fn : TCallBack ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} (**** Callback function prototypes ****) type // gluQuadricCallback - GLUquadricErrorProc = procedure(p: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUquadricErrorProc = procedure( p : GLenum ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} // gluTessCallback - GLUtessBeginProc = procedure(p: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - GLUtessEdgeFlagProc = procedure(p: GLboolean); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - GLUtessVertexProc = procedure(p: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - GLUtessEndProc = procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - GLUtessErrorProc = procedure(p: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - GLUtessCombineProc = procedure(p1: T3dArray; p2: T4pArray; p3: T4fArray; p4: PPointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - GLUtessBeginDataProc = procedure(p1: GLenum; p2: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - GLUtessEdgeFlagDataProc = procedure(p1: GLboolean; p2: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - GLUtessVertexDataProc = procedure(p1, p2: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - GLUtessEndDataProc = procedure(p: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - GLUtessErrorDataProc = procedure(p1: GLenum; p2: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - GLUtessCombineDataProc = procedure(p1: T3dArray; p2: T4pArray; p3: T4fArray; - p4: PPointer; p5: Pointer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUtessBeginProc = procedure( p : GLenum ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + GLUtessEdgeFlagProc = procedure( p : GLboolean ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + GLUtessVertexProc = procedure( p : Pointer ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + GLUtessEndProc = procedure; {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + GLUtessErrorProc = procedure( p : GLenum ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + GLUtessCombineProc = procedure( var p1 : T3dArray; p2 : T4pArray; p3 : T4fArray; p4 : PPointer ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + GLUtessBeginDataProc = procedure( p1 : GLenum; p2 : Pointer ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + GLUtessEdgeFlagDataProc = procedure( p1 : GLboolean; p2 : Pointer ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + GLUtessVertexDataProc = procedure( p1, p2 : Pointer ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + GLUtessEndDataProc = procedure( p : Pointer ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + GLUtessErrorDataProc = procedure( p1 : GLenum; p2 : Pointer ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + GLUtessCombineDataProc = procedure( var p1 : T3dArray; var p2 : T4pArray; var p3 : T4fArray; + p4 : PPointer; p5 : Pointer ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} // gluNurbsCallback - GLUnurbsErrorProc = procedure(p: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + GLUnurbsErrorProc = procedure( p : GLenum ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} //*** Generic constants ****/ const // Version - GLU_VERSION_1_1 = 1; - GLU_VERSION_1_2 = 1; + GLU_VERSION_1_1 = 1; + GLU_VERSION_1_2 = 1; // Errors: (return value 0 = no error) - GLU_INVALID_ENUM = 100900; - GLU_INVALID_VALUE = 100901; - GLU_OUT_OF_MEMORY = 100902; - GLU_INCOMPATIBLE_GL_VERSION = 100903; + GLU_INVALID_ENUM = 100900; + GLU_INVALID_VALUE = 100901; + GLU_OUT_OF_MEMORY = 100902; + GLU_INCOMPATIBLE_GL_VERSION = 100903; // StringName - GLU_VERSION = 100800; - GLU_EXTENSIONS = 100801; + GLU_VERSION = 100800; + GLU_EXTENSIONS = 100801; // Boolean - GLU_TRUE = GL_TRUE; - GLU_FALSE = GL_FALSE; + GLU_TRUE = GL_TRUE; + GLU_FALSE = GL_FALSE; //*** Quadric constants ****/ // QuadricNormal - GLU_SMOOTH = 100000; - GLU_FLAT = 100001; - GLU_NONE = 100002; + GLU_SMOOTH = 100000; + GLU_FLAT = 100001; + GLU_NONE = 100002; // QuadricDrawStyle - GLU_POINT = 100010; - GLU_LINE = 100011; - GLU_FILL = 100012; - GLU_SILHOUETTE = 100013; + GLU_POINT = 100010; + GLU_LINE = 100011; + GLU_FILL = 100012; + GLU_SILHOUETTE = 100013; // QuadricOrientation - GLU_OUTSIDE = 100020; - GLU_INSIDE = 100021; + GLU_OUTSIDE = 100020; + GLU_INSIDE = 100021; // Callback types: // GLU_ERROR = 100103; @@ -274,161 +292,161 @@ const //*** Tesselation constants ****/ - GLU_TESS_MAX_COORD = 1.0e150; + GLU_TESS_MAX_COORD = 1.0E150; // TessProperty - GLU_TESS_WINDING_RULE = 100140; - GLU_TESS_BOUNDARY_ONLY = 100141; - GLU_TESS_TOLERANCE = 100142; + GLU_TESS_WINDING_RULE = 100140; + GLU_TESS_BOUNDARY_ONLY = 100141; + GLU_TESS_TOLERANCE = 100142; // TessWinding - GLU_TESS_WINDING_ODD = 100130; - GLU_TESS_WINDING_NONZERO = 100131; - GLU_TESS_WINDING_POSITIVE = 100132; - GLU_TESS_WINDING_NEGATIVE = 100133; - GLU_TESS_WINDING_ABS_GEQ_TWO = 100134; + GLU_TESS_WINDING_ODD = 100130; + GLU_TESS_WINDING_NONZERO = 100131; + GLU_TESS_WINDING_POSITIVE = 100132; + GLU_TESS_WINDING_NEGATIVE = 100133; + GLU_TESS_WINDING_ABS_GEQ_TWO = 100134; // TessCallback - GLU_TESS_BEGIN = 100100; // void (CALLBACK*)(GLenum type) - GLU_TESS_VERTEX = 100101; // void (CALLBACK*)(void *data) - GLU_TESS_END = 100102; // void (CALLBACK*)(void) - GLU_TESS_ERROR = 100103; // void (CALLBACK*)(GLenum errno) - GLU_TESS_EDGE_FLAG = 100104; // void (CALLBACK*)(GLboolean boundaryEdge) - GLU_TESS_COMBINE = 100105; { void (CALLBACK*)(GLdouble coords[3], + GLU_TESS_BEGIN = 100100; // void (CALLBACK*)(GLenum type) + GLU_TESS_VERTEX = 100101; // void (CALLBACK*)(void *data) + GLU_TESS_END = 100102; // void (CALLBACK*)(void) + GLU_TESS_ERROR = 100103; // void (CALLBACK*)(GLenum errno) + GLU_TESS_EDGE_FLAG = 100104; // void (CALLBACK*)(GLboolean boundaryEdge) + GLU_TESS_COMBINE = 100105; { void (CALLBACK*)(GLdouble coords[3], void *data[4], GLfloat weight[4], void **dataOut) } - GLU_TESS_BEGIN_DATA = 100106; { void (CALLBACK*)(GLenum type, + GLU_TESS_BEGIN_DATA = 100106; { void (CALLBACK*)(GLenum type, void *polygon_data) } - GLU_TESS_VERTEX_DATA = 100107; { void (CALLBACK*)(void *data, + GLU_TESS_VERTEX_DATA = 100107; { void (CALLBACK*)(void *data, void *polygon_data) } - GLU_TESS_END_DATA = 100108; // void (CALLBACK*)(void *polygon_data) - GLU_TESS_ERROR_DATA = 100109; { void (CALLBACK*)(GLenum errno, + GLU_TESS_END_DATA = 100108; // void (CALLBACK*)(void *polygon_data) + GLU_TESS_ERROR_DATA = 100109; { void (CALLBACK*)(GLenum errno, void *polygon_data) } - GLU_TESS_EDGE_FLAG_DATA = 100110; { void (CALLBACK*)(GLboolean boundaryEdge, + GLU_TESS_EDGE_FLAG_DATA = 100110; { void (CALLBACK*)(GLboolean boundaryEdge, void *polygon_data) } - GLU_TESS_COMBINE_DATA = 100111; { void (CALLBACK*)(GLdouble coords[3], + GLU_TESS_COMBINE_DATA = 100111; { void (CALLBACK*)(GLdouble coords[3], void *data[4], GLfloat weight[4], void **dataOut, void *polygon_data) } // TessError - GLU_TESS_ERROR1 = 100151; - GLU_TESS_ERROR2 = 100152; - GLU_TESS_ERROR3 = 100153; - GLU_TESS_ERROR4 = 100154; - GLU_TESS_ERROR5 = 100155; - GLU_TESS_ERROR6 = 100156; - GLU_TESS_ERROR7 = 100157; - GLU_TESS_ERROR8 = 100158; - - GLU_TESS_MISSING_BEGIN_POLYGON = GLU_TESS_ERROR1; - GLU_TESS_MISSING_BEGIN_CONTOUR = GLU_TESS_ERROR2; - GLU_TESS_MISSING_END_POLYGON = GLU_TESS_ERROR3; - GLU_TESS_MISSING_END_CONTOUR = GLU_TESS_ERROR4; - GLU_TESS_COORD_TOO_LARGE = GLU_TESS_ERROR5; - GLU_TESS_NEED_COMBINE_CALLBACK = GLU_TESS_ERROR6; + GLU_TESS_ERROR1 = 100151; + GLU_TESS_ERROR2 = 100152; + GLU_TESS_ERROR3 = 100153; + GLU_TESS_ERROR4 = 100154; + GLU_TESS_ERROR5 = 100155; + GLU_TESS_ERROR6 = 100156; + GLU_TESS_ERROR7 = 100157; + GLU_TESS_ERROR8 = 100158; + + GLU_TESS_MISSING_BEGIN_POLYGON = GLU_TESS_ERROR1; + GLU_TESS_MISSING_BEGIN_CONTOUR = GLU_TESS_ERROR2; + GLU_TESS_MISSING_END_POLYGON = GLU_TESS_ERROR3; + GLU_TESS_MISSING_END_CONTOUR = GLU_TESS_ERROR4; + GLU_TESS_COORD_TOO_LARGE = GLU_TESS_ERROR5; + GLU_TESS_NEED_COMBINE_CALLBACK = GLU_TESS_ERROR6; //*** NURBS constants ****/ // NurbsProperty - GLU_AUTO_LOAD_MATRIX = 100200; - GLU_CULLING = 100201; - GLU_SAMPLING_TOLERANCE = 100203; - GLU_DISPLAY_MODE = 100204; - GLU_PARAMETRIC_TOLERANCE = 100202; - GLU_SAMPLING_METHOD = 100205; - GLU_U_STEP = 100206; - GLU_V_STEP = 100207; + GLU_AUTO_LOAD_MATRIX = 100200; + GLU_CULLING = 100201; + GLU_SAMPLING_TOLERANCE = 100203; + GLU_DISPLAY_MODE = 100204; + GLU_PARAMETRIC_TOLERANCE = 100202; + GLU_SAMPLING_METHOD = 100205; + GLU_U_STEP = 100206; + GLU_V_STEP = 100207; // NurbsSampling - GLU_PATH_LENGTH = 100215; - GLU_PARAMETRIC_ERROR = 100216; - GLU_DOMAIN_DISTANCE = 100217; + GLU_PATH_LENGTH = 100215; + GLU_PARAMETRIC_ERROR = 100216; + GLU_DOMAIN_DISTANCE = 100217; // NurbsTrim - GLU_MAP1_TRIM_2 = 100210; - GLU_MAP1_TRIM_3 = 100211; + GLU_MAP1_TRIM_2 = 100210; + GLU_MAP1_TRIM_3 = 100211; // NurbsDisplay // GLU_FILL = 100012; - GLU_OUTLINE_POLYGON = 100240; - GLU_OUTLINE_PATCH = 100241; + GLU_OUTLINE_POLYGON = 100240; + GLU_OUTLINE_PATCH = 100241; // NurbsCallback // GLU_ERROR = 100103; // NurbsErrors - GLU_NURBS_ERROR1 = 100251; - GLU_NURBS_ERROR2 = 100252; - GLU_NURBS_ERROR3 = 100253; - GLU_NURBS_ERROR4 = 100254; - GLU_NURBS_ERROR5 = 100255; - GLU_NURBS_ERROR6 = 100256; - GLU_NURBS_ERROR7 = 100257; - GLU_NURBS_ERROR8 = 100258; - GLU_NURBS_ERROR9 = 100259; - GLU_NURBS_ERROR10 = 100260; - GLU_NURBS_ERROR11 = 100261; - GLU_NURBS_ERROR12 = 100262; - GLU_NURBS_ERROR13 = 100263; - GLU_NURBS_ERROR14 = 100264; - GLU_NURBS_ERROR15 = 100265; - GLU_NURBS_ERROR16 = 100266; - GLU_NURBS_ERROR17 = 100267; - GLU_NURBS_ERROR18 = 100268; - GLU_NURBS_ERROR19 = 100269; - GLU_NURBS_ERROR20 = 100270; - GLU_NURBS_ERROR21 = 100271; - GLU_NURBS_ERROR22 = 100272; - GLU_NURBS_ERROR23 = 100273; - GLU_NURBS_ERROR24 = 100274; - GLU_NURBS_ERROR25 = 100275; - GLU_NURBS_ERROR26 = 100276; - GLU_NURBS_ERROR27 = 100277; - GLU_NURBS_ERROR28 = 100278; - GLU_NURBS_ERROR29 = 100279; - GLU_NURBS_ERROR30 = 100280; - GLU_NURBS_ERROR31 = 100281; - GLU_NURBS_ERROR32 = 100282; - GLU_NURBS_ERROR33 = 100283; - GLU_NURBS_ERROR34 = 100284; - GLU_NURBS_ERROR35 = 100285; - GLU_NURBS_ERROR36 = 100286; - GLU_NURBS_ERROR37 = 100287; + GLU_NURBS_ERROR1 = 100251; + GLU_NURBS_ERROR2 = 100252; + GLU_NURBS_ERROR3 = 100253; + GLU_NURBS_ERROR4 = 100254; + GLU_NURBS_ERROR5 = 100255; + GLU_NURBS_ERROR6 = 100256; + GLU_NURBS_ERROR7 = 100257; + GLU_NURBS_ERROR8 = 100258; + GLU_NURBS_ERROR9 = 100259; + GLU_NURBS_ERROR10 = 100260; + GLU_NURBS_ERROR11 = 100261; + GLU_NURBS_ERROR12 = 100262; + GLU_NURBS_ERROR13 = 100263; + GLU_NURBS_ERROR14 = 100264; + GLU_NURBS_ERROR15 = 100265; + GLU_NURBS_ERROR16 = 100266; + GLU_NURBS_ERROR17 = 100267; + GLU_NURBS_ERROR18 = 100268; + GLU_NURBS_ERROR19 = 100269; + GLU_NURBS_ERROR20 = 100270; + GLU_NURBS_ERROR21 = 100271; + GLU_NURBS_ERROR22 = 100272; + GLU_NURBS_ERROR23 = 100273; + GLU_NURBS_ERROR24 = 100274; + GLU_NURBS_ERROR25 = 100275; + GLU_NURBS_ERROR26 = 100276; + GLU_NURBS_ERROR27 = 100277; + GLU_NURBS_ERROR28 = 100278; + GLU_NURBS_ERROR29 = 100279; + GLU_NURBS_ERROR30 = 100280; + GLU_NURBS_ERROR31 = 100281; + GLU_NURBS_ERROR32 = 100282; + GLU_NURBS_ERROR33 = 100283; + GLU_NURBS_ERROR34 = 100284; + GLU_NURBS_ERROR35 = 100285; + GLU_NURBS_ERROR36 = 100286; + GLU_NURBS_ERROR37 = 100287; //*** Backwards compatibility for old tesselator ****/ var - gluBeginPolygon: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluNextContour: procedure(tess: PGLUtesselator; atype: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - gluEndPolygon: procedure(tess: PGLUtesselator); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + gluBeginPolygon : procedure( tess : PGLUtesselator ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluNextContour : procedure( tess : PGLUtesselator; atype : GLenum ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} + gluEndPolygon : procedure( tess : PGLUtesselator ); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF} const // Contours types -- obsolete! - GLU_CW = 100120; - GLU_CCW = 100121; - GLU_INTERIOR = 100122; - GLU_EXTERIOR = 100123; - GLU_UNKNOWN = 100124; + GLU_CW = 100120; + GLU_CCW = 100121; + GLU_INTERIOR = 100122; + GLU_EXTERIOR = 100123; + GLU_UNKNOWN = 100124; // Names without "TESS_" prefix - GLU_BEGIN = GLU_TESS_BEGIN; - GLU_VERTEX = GLU_TESS_VERTEX; - GLU_END = GLU_TESS_END; - GLU_ERROR = GLU_TESS_ERROR; - GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG; + GLU_BEGIN = GLU_TESS_BEGIN; + GLU_VERTEX = GLU_TESS_VERTEX; + GLU_END = GLU_TESS_END; + GLU_ERROR = GLU_TESS_ERROR; + GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG; -procedure LoadGLu(const dll: PChar); +procedure LoadGLu( const dll : PChar ); procedure FreeGLu; implementation var - LibGlu: TModuleHandle; - + LibGlu : TModuleHandle; + procedure FreeGLu; begin @@ -485,70 +503,70 @@ begin @gluNextContour := nil; @gluEndPolygon := nil; - UnLoadModule(LibGlu); + UnLoadModule( LibGlu ); end; -procedure LoadGLu(const dll: PChar); +procedure LoadGLu( const dll : PChar ); begin FreeGLu; - + if LoadModule( LibGlu, dll ) then begin - @gluErrorString := GetModuleSymbol(LibGlu, 'gluErrorString'); - @gluErrorUnicodeStringEXT := GetModuleSymbol(LibGlu, 'gluErrorUnicodeStringEXT'); - @gluGetString := GetModuleSymbol(LibGlu, 'gluGetString'); - @gluOrtho2D := GetModuleSymbol(LibGlu, 'gluOrtho2D'); - @gluPerspective := GetModuleSymbol(LibGlu, 'gluPerspective'); - @gluPickMatrix := GetModuleSymbol(LibGlu, 'gluPickMatrix'); - @gluLookAt := GetModuleSymbol(LibGlu, 'gluLookAt'); - @gluProject := GetModuleSymbol(LibGlu, 'gluProject'); - @gluUnProject := GetModuleSymbol(LibGlu, 'gluUnProject'); - @gluScaleImage := GetModuleSymbol(LibGlu, 'gluScaleImage'); - @gluBuild1DMipmaps := GetModuleSymbol(LibGlu, 'gluBuild1DMipmaps'); - @gluBuild2DMipmaps := GetModuleSymbol(LibGlu, 'gluBuild2DMipmaps'); - @gluNewQuadric := GetModuleSymbol(LibGlu, 'gluNewQuadric'); - @gluDeleteQuadric := GetModuleSymbol(LibGlu, 'gluDeleteQuadric'); - @gluQuadricNormals := GetModuleSymbol(LibGlu, 'gluQuadricNormals'); - @gluQuadricTexture := GetModuleSymbol(LibGlu, 'gluQuadricTexture'); - @gluQuadricOrientation := GetModuleSymbol(LibGlu, 'gluQuadricOrientation'); - @gluQuadricDrawStyle := GetModuleSymbol(LibGlu, 'gluQuadricDrawStyle'); - @gluCylinder := GetModuleSymbol(LibGlu, 'gluCylinder'); - @gluDisk := GetModuleSymbol(LibGlu, 'gluDisk'); - @gluPartialDisk := GetModuleSymbol(LibGlu, 'gluPartialDisk'); - @gluSphere := GetModuleSymbol(LibGlu, 'gluSphere'); - @gluQuadricCallback := GetModuleSymbol(LibGlu, 'gluQuadricCallback'); - @gluNewTess := GetModuleSymbol(LibGlu, 'gluNewTess'); - @gluDeleteTess := GetModuleSymbol(LibGlu, 'gluDeleteTess'); - @gluTessBeginPolygon := GetModuleSymbol(LibGlu, 'gluTessBeginPolygon'); - @gluTessBeginContour := GetModuleSymbol(LibGlu, 'gluTessBeginContour'); - @gluTessVertex := GetModuleSymbol(LibGlu, 'gluTessVertex'); - @gluTessEndContour := GetModuleSymbol(LibGlu, 'gluTessEndContour'); - @gluTessEndPolygon := GetModuleSymbol(LibGlu, 'gluTessEndPolygon'); - @gluTessProperty := GetModuleSymbol(LibGlu, 'gluTessProperty'); - @gluTessNormal := GetModuleSymbol(LibGlu, 'gluTessNormal'); - @gluTessCallback := GetModuleSymbol(LibGlu, 'gluTessCallback'); - @gluGetTessProperty := GetModuleSymbol(LibGlu, 'gluGetTessProperty'); - @gluNewNurbsRenderer := GetModuleSymbol(LibGlu, 'gluNewNurbsRenderer'); - @gluDeleteNurbsRenderer := GetModuleSymbol(LibGlu, 'gluDeleteNurbsRenderer'); - @gluBeginSurface := GetModuleSymbol(LibGlu, 'gluBeginSurface'); - @gluBeginCurve := GetModuleSymbol(LibGlu, 'gluBeginCurve'); - @gluEndCurve := GetModuleSymbol(LibGlu, 'gluEndCurve'); - @gluEndSurface := GetModuleSymbol(LibGlu, 'gluEndSurface'); - @gluBeginTrim := GetModuleSymbol(LibGlu, 'gluBeginTrim'); - @gluEndTrim := GetModuleSymbol(LibGlu, 'gluEndTrim'); - @gluPwlCurve := GetModuleSymbol(LibGlu, 'gluPwlCurve'); - @gluNurbsCurve := GetModuleSymbol(LibGlu, 'gluNurbsCurve'); - @gluNurbsSurface := GetModuleSymbol(LibGlu, 'gluNurbsSurface'); - @gluLoadSamplingMatrices := GetModuleSymbol(LibGlu, 'gluLoadSamplingMatrices'); - @gluNurbsProperty := GetModuleSymbol(LibGlu, 'gluNurbsProperty'); - @gluGetNurbsProperty := GetModuleSymbol(LibGlu, 'gluGetNurbsProperty'); - @gluNurbsCallback := GetModuleSymbol(LibGlu, 'gluNurbsCallback'); - - @gluBeginPolygon := GetModuleSymbol(LibGlu, 'gluBeginPolygon'); - @gluNextContour := GetModuleSymbol(LibGlu, 'gluNextContour'); - @gluEndPolygon := GetModuleSymbol(LibGlu, 'gluEndPolygon'); + @gluErrorString := GetModuleSymbol( LibGlu, 'gluErrorString' ); + @gluErrorUnicodeStringEXT := GetModuleSymbol( LibGlu, 'gluErrorUnicodeStringEXT' ); + @gluGetString := GetModuleSymbol( LibGlu, 'gluGetString' ); + @gluOrtho2D := GetModuleSymbol( LibGlu, 'gluOrtho2D' ); + @gluPerspective := GetModuleSymbol( LibGlu, 'gluPerspective' ); + @gluPickMatrix := GetModuleSymbol( LibGlu, 'gluPickMatrix' ); + @gluLookAt := GetModuleSymbol( LibGlu, 'gluLookAt' ); + @gluProject := GetModuleSymbol( LibGlu, 'gluProject' ); + @gluUnProject := GetModuleSymbol( LibGlu, 'gluUnProject' ); + @gluScaleImage := GetModuleSymbol( LibGlu, 'gluScaleImage' ); + @gluBuild1DMipmaps := GetModuleSymbol( LibGlu, 'gluBuild1DMipmaps' ); + @gluBuild2DMipmaps := GetModuleSymbol( LibGlu, 'gluBuild2DMipmaps' ); + @gluNewQuadric := GetModuleSymbol( LibGlu, 'gluNewQuadric' ); + @gluDeleteQuadric := GetModuleSymbol( LibGlu, 'gluDeleteQuadric' ); + @gluQuadricNormals := GetModuleSymbol( LibGlu, 'gluQuadricNormals' ); + @gluQuadricTexture := GetModuleSymbol( LibGlu, 'gluQuadricTexture' ); + @gluQuadricOrientation := GetModuleSymbol( LibGlu, 'gluQuadricOrientation' ); + @gluQuadricDrawStyle := GetModuleSymbol( LibGlu, 'gluQuadricDrawStyle' ); + @gluCylinder := GetModuleSymbol( LibGlu, 'gluCylinder' ); + @gluDisk := GetModuleSymbol( LibGlu, 'gluDisk' ); + @gluPartialDisk := GetModuleSymbol( LibGlu, 'gluPartialDisk' ); + @gluSphere := GetModuleSymbol( LibGlu, 'gluSphere' ); + @gluQuadricCallback := GetModuleSymbol( LibGlu, 'gluQuadricCallback' ); + @gluNewTess := GetModuleSymbol( LibGlu, 'gluNewTess' ); + @gluDeleteTess := GetModuleSymbol( LibGlu, 'gluDeleteTess' ); + @gluTessBeginPolygon := GetModuleSymbol( LibGlu, 'gluTessBeginPolygon' ); + @gluTessBeginContour := GetModuleSymbol( LibGlu, 'gluTessBeginContour' ); + @gluTessVertex := GetModuleSymbol( LibGlu, 'gluTessVertex' ); + @gluTessEndContour := GetModuleSymbol( LibGlu, 'gluTessEndContour' ); + @gluTessEndPolygon := GetModuleSymbol( LibGlu, 'gluTessEndPolygon' ); + @gluTessProperty := GetModuleSymbol( LibGlu, 'gluTessProperty' ); + @gluTessNormal := GetModuleSymbol( LibGlu, 'gluTessNormal' ); + @gluTessCallback := GetModuleSymbol( LibGlu, 'gluTessCallback' ); + @gluGetTessProperty := GetModuleSymbol( LibGlu, 'gluGetTessProperty' ); + @gluNewNurbsRenderer := GetModuleSymbol( LibGlu, 'gluNewNurbsRenderer' ); + @gluDeleteNurbsRenderer := GetModuleSymbol( LibGlu, 'gluDeleteNurbsRenderer' ); + @gluBeginSurface := GetModuleSymbol( LibGlu, 'gluBeginSurface' ); + @gluBeginCurve := GetModuleSymbol( LibGlu, 'gluBeginCurve' ); + @gluEndCurve := GetModuleSymbol( LibGlu, 'gluEndCurve' ); + @gluEndSurface := GetModuleSymbol( LibGlu, 'gluEndSurface' ); + @gluBeginTrim := GetModuleSymbol( LibGlu, 'gluBeginTrim' ); + @gluEndTrim := GetModuleSymbol( LibGlu, 'gluEndTrim' ); + @gluPwlCurve := GetModuleSymbol( LibGlu, 'gluPwlCurve' ); + @gluNurbsCurve := GetModuleSymbol( LibGlu, 'gluNurbsCurve' ); + @gluNurbsSurface := GetModuleSymbol( LibGlu, 'gluNurbsSurface' ); + @gluLoadSamplingMatrices := GetModuleSymbol( LibGlu, 'gluLoadSamplingMatrices' ); + @gluNurbsProperty := GetModuleSymbol( LibGlu, 'gluNurbsProperty' ); + @gluGetNurbsProperty := GetModuleSymbol( LibGlu, 'gluGetNurbsProperty' ); + @gluNurbsCallback := GetModuleSymbol( LibGlu, 'gluNurbsCallback' ); + + @gluBeginPolygon := GetModuleSymbol( LibGlu, 'gluBeginPolygon' ); + @gluNextContour := GetModuleSymbol( LibGlu, 'gluNextContour' ); + @gluEndPolygon := GetModuleSymbol( LibGlu, 'gluEndPolygon' ); end; end; @@ -561,3 +579,4 @@ finalization FreeGLu; end. + diff --git a/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glut.pas b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glut.pas index 2a882a20..3bea3499 100644 --- a/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glut.pas +++ b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glut.pas @@ -1,6 +1,6 @@ unit glut; { - $Id: glut.pas,v 1.2 2004/08/14 22:54:30 savage Exp $ + $Id: glut.pas,v 1.4 2007/05/20 20:28:31 savage Exp $ Adaption of the delphi3d.net OpenGL units to FreePascal Sebastian Guenther (sg@freepascal.org) in 2002 @@ -26,6 +26,12 @@ unit glut; { $Log: glut.pas,v $ + Revision 1.4 2007/05/20 20:28:31 savage + Initial Changes to Handle 64 Bits + + Revision 1.3 2006/11/20 21:20:59 savage + Updated to work in MacOS X + Revision 1.2 2004/08/14 22:54:30 savage Updated so that Library name defines are correctly defined for MacOS X. @@ -63,7 +69,7 @@ uses gpc, {$ENDIF} -{$IFDEF WIN32} +{$IFDEF WINDOWS} Windows, {$ENDIF} moduleloader, @@ -74,21 +80,21 @@ type PInteger = ^Integer; PPChar = ^PChar; {$ENDIF} - TGlutVoidCallback = procedure; {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} - TGlut1IntCallback = procedure(value: Integer); {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} - TGlut2IntCallback = procedure(v1, v2: Integer); {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} - TGlut3IntCallback = procedure(v1, v2, v3: Integer); {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} - TGlut4IntCallback = procedure(v1, v2, v3, v4: Integer); {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} - TGlut1Char2IntCallback = procedure(c: Byte; v1, v2: Integer); {$IFNDEF __GPC__}{$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} + TGlutVoidCallback = procedure; {$IFNDEF __GPC__}{$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} + TGlut1IntCallback = procedure(value: Integer); {$IFNDEF __GPC__}{$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} + TGlut2IntCallback = procedure(v1, v2: Integer); {$IFNDEF __GPC__}{$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} + TGlut3IntCallback = procedure(v1, v2, v3: Integer); {$IFNDEF __GPC__}{$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} + TGlut4IntCallback = procedure(v1, v2, v3, v4: Integer); {$IFNDEF __GPC__}{$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} + TGlut1Char2IntCallback = procedure(c: Byte; v1, v2: Integer); {$IFNDEF __GPC__}{$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF}{$ENDIF} const -{$IFDEF WIN32} +{$IFDEF WINDOWS} GlutLibName = 'glut32.dll'; {$ENDIF} {$IFDEF UNIX} {$IFDEF DARWIN} - GlutLibName = 'libglut.dylib'; + GlutLibName = '/System/Library/Frameworks/GLUT.framework/Libraries/libglut.dylib'; {$ELSE} GlutLibName = 'libglut.so'; {$ENDIF} @@ -301,139 +307,139 @@ const var // GLUT initialization sub-API. - glutInit: procedure(argcp: PInteger; argv: PPChar); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutInitDisplayMode: procedure(mode: Word); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutInitDisplayString: procedure(const str: PChar); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutInitWindowPosition: procedure(x, y: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutInitWindowSize: procedure(width, height: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutMainLoop: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutInit: procedure(argcp: PInteger; argv: PPChar); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutInitDisplayMode: procedure(mode: Word); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutInitDisplayString: procedure(const str: PChar); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutInitWindowPosition: procedure(x, y: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutInitWindowSize: procedure(width, height: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutMainLoop: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} // GLUT window sub-API. - glutCreateWindow: function(const title: PChar): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutCreateSubWindow: function(win, x, y, width, height: Integer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutDestroyWindow: procedure(win: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutPostRedisplay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutPostWindowRedisplay: procedure(win: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSwapBuffers: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutGetWindow: function: Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSetWindow: procedure(win: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSetWindowTitle: procedure(const title: PChar); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSetIconTitle: procedure(const title: PChar); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutPositionWindow: procedure(x, y: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutReshapeWindow: procedure(width, height: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutPopWindow: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutPushWindow: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutIconifyWindow: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutShowWindow: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutHideWindow: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutFullScreen: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSetCursor: procedure(cursor: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutWarpPointer: procedure(x, y: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutCreateWindow: function(const title: PChar): Integer; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutCreateSubWindow: function(win, x, y, width, height: Integer): Integer; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutDestroyWindow: procedure(win: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPostRedisplay: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPostWindowRedisplay: procedure(win: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSwapBuffers: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutGetWindow: function: Integer; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSetWindow: procedure(win: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSetWindowTitle: procedure(const title: PChar); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSetIconTitle: procedure(const title: PChar); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPositionWindow: procedure(x, y: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutReshapeWindow: procedure(width, height: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPopWindow: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPushWindow: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutIconifyWindow: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutShowWindow: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutHideWindow: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutFullScreen: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSetCursor: procedure(cursor: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWarpPointer: procedure(x, y: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} // GLUT overlay sub-API. - glutEstablishOverlay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutRemoveOverlay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutUseLayer: procedure(layer: GLenum); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutPostOverlayRedisplay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutPostWindowOverlayRedisplay: procedure(win: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutShowOverlay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutHideOverlay: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutEstablishOverlay: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutRemoveOverlay: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutUseLayer: procedure(layer: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPostOverlayRedisplay: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPostWindowOverlayRedisplay: procedure(win: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutShowOverlay: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutHideOverlay: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} // GLUT menu sub-API. - glutCreateMenu: function(callback: TGlut1IntCallback): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutDestroyMenu: procedure(menu: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutGetMenu: function: Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSetMenu: procedure(menu: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutAddMenuEntry: procedure(const caption: PChar; value: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutAddSubMenu: procedure(const caption: PChar; submenu: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutChangeToMenuEntry: procedure(item: Integer; const caption: PChar; value: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutChangeToSubMenu: procedure(item: Integer; const caption: PChar; submenu: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutRemoveMenuItem: procedure(item: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutAttachMenu: procedure(button: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutDetachMenu: procedure(button: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutCreateMenu: function(callback: TGlut1IntCallback): Integer; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutDestroyMenu: procedure(menu: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutGetMenu: function: Integer; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSetMenu: procedure(menu: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutAddMenuEntry: procedure(const caption: PChar; value: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutAddSubMenu: procedure(const caption: PChar; submenu: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutChangeToMenuEntry: procedure(item: Integer; const caption: PChar; value: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutChangeToSubMenu: procedure(item: Integer; const caption: PChar; submenu: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutRemoveMenuItem: procedure(item: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutAttachMenu: procedure(button: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutDetachMenu: procedure(button: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} // GLUTsub-API. - glutDisplayFunc: procedure(f: TGlutVoidCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutReshapeFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutKeyboardFunc: procedure(f: TGlut1Char2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutMouseFunc: procedure(f: TGlut4IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutMotionFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutPassiveMotionFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutEntryFunc: procedure(f: TGlut1IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutVisibilityFunc: procedure(f: TGlut1IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutIdleFunc: procedure(f: TGlutVoidCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutTimerFunc: procedure(millis: Word; f: TGlut1IntCallback; value: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutMenuStateFunc: procedure(f: TGlut1IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSpecialFunc: procedure(f: TGlut3IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSpaceballMotionFunc: procedure(f: TGlut3IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSpaceballRotateFunc: procedure(f: TGlut3IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSpaceballButtonFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutButtonBoxFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutDialsFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutTabletMotionFunc: procedure(f: TGlut2IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutTabletButtonFunc: procedure(f: TGlut4IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutMenuStatusFunc: procedure(f: TGlut3IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutOverlayDisplayFunc: procedure(f:TGlutVoidCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutWindowStatusFunc: procedure(f: TGlut1IntCallback); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutDisplayFunc: procedure(f: TGlutVoidCallback); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutReshapeFunc: procedure(f: TGlut2IntCallback); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutKeyboardFunc: procedure(f: TGlut1Char2IntCallback); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutMouseFunc: procedure(f: TGlut4IntCallback); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutMotionFunc: procedure(f: TGlut2IntCallback); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutPassiveMotionFunc: procedure(f: TGlut2IntCallback); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutEntryFunc: procedure(f: TGlut1IntCallback); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutVisibilityFunc: procedure(f: TGlut1IntCallback); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutIdleFunc: procedure(f: TGlutVoidCallback); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutTimerFunc: procedure(millis: Word; f: TGlut1IntCallback; value: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutMenuStateFunc: procedure(f: TGlut1IntCallback); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSpecialFunc: procedure(f: TGlut3IntCallback); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSpaceballMotionFunc: procedure(f: TGlut3IntCallback); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSpaceballRotateFunc: procedure(f: TGlut3IntCallback); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSpaceballButtonFunc: procedure(f: TGlut2IntCallback); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutButtonBoxFunc: procedure(f: TGlut2IntCallback); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutDialsFunc: procedure(f: TGlut2IntCallback); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutTabletMotionFunc: procedure(f: TGlut2IntCallback); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutTabletButtonFunc: procedure(f: TGlut4IntCallback); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutMenuStatusFunc: procedure(f: TGlut3IntCallback); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutOverlayDisplayFunc: procedure(f:TGlutVoidCallback); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWindowStatusFunc: procedure(f: TGlut1IntCallback); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} // GLUT color index sub-API. - glutSetColor: procedure(cell: Integer; red, green, blue: GLfloat); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutGetColor: function(ndx, component: Integer): GLfloat; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutCopyColormap: procedure(win: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSetColor: procedure(cell: Integer; red, green, blue: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutGetColor: function(ndx, component: Integer): GLfloat; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutCopyColormap: procedure(win: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} // GLUT state retrieval sub-API. - glutGet: function(t: GLenum): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutDeviceGet: function(t: GLenum): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutGet: function(t: GLenum): Integer; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutDeviceGet: function(t: GLenum): Integer; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} // GLUT extension support sub-API - glutExtensionSupported: function(const name: PChar): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutGetModifiers: function: Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutLayerGet: function(t: GLenum): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutExtensionSupported: function(const name: PChar): Integer; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutGetModifiers: function: Integer; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutLayerGet: function(t: GLenum): Integer; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} // GLUT font sub-API - glutBitmapCharacter: procedure(font : pointer; character: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutBitmapWidth: function(font : pointer; character: Integer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutStrokeCharacter: procedure(font : pointer; character: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutStrokeWidth: function(font : pointer; character: Integer): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutBitmapLength: function(font: pointer; const str: PChar): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutStrokeLength: function(font: pointer; const str: PChar): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutBitmapCharacter: procedure(font : pointer; character: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutBitmapWidth: function(font : pointer; character: Integer): Integer; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutStrokeCharacter: procedure(font : pointer; character: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutStrokeWidth: function(font : pointer; character: Integer): Integer; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutBitmapLength: function(font: pointer; const str: PChar): Integer; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutStrokeLength: function(font: pointer; const str: PChar): Integer; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} // GLUT pre-built models sub-API - glutWireSphere: procedure(radius: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSolidSphere: procedure(radius: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutWireCone: procedure(base, height: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSolidCone: procedure(base, height: GLdouble; slices, stacks: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutWireCube: procedure(size: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSolidCube: procedure(size: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutWireTorus: procedure(innerRadius, outerRadius: GLdouble; sides, rings: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSolidTorus: procedure(innerRadius, outerRadius: GLdouble; sides, rings: GLint); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutWireDodecahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSolidDodecahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutWireTeapot: procedure(size: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSolidTeapot: procedure(size: GLdouble); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutWireOctahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSolidOctahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutWireTetrahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSolidTetrahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutWireIcosahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSolidIcosahedron: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireSphere: procedure(radius: GLdouble; slices, stacks: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidSphere: procedure(radius: GLdouble; slices, stacks: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireCone: procedure(base, height: GLdouble; slices, stacks: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidCone: procedure(base, height: GLdouble; slices, stacks: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireCube: procedure(size: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidCube: procedure(size: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireTorus: procedure(innerRadius, outerRadius: GLdouble; sides, rings: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidTorus: procedure(innerRadius, outerRadius: GLdouble; sides, rings: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireDodecahedron: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidDodecahedron: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireTeapot: procedure(size: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidTeapot: procedure(size: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireOctahedron: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidOctahedron: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireTetrahedron: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidTetrahedron: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutWireIcosahedron: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSolidIcosahedron: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} // GLUT video resize sub-API. - glutVideoResizeGet: function(param: GLenum): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutSetupVideoResizing: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutStopVideoResizing: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutVideoResize: procedure(x, y, width, height: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutVideoPan: procedure(x, y, width, height: Integer); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutVideoResizeGet: function(param: GLenum): Integer; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutSetupVideoResizing: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutStopVideoResizing: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutVideoResize: procedure(x, y, width, height: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutVideoPan: procedure(x, y, width, height: Integer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} // GLUT debugging sub-API. - glutReportErrors: procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutReportErrors: procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} var //example glutGameModeString('1280x1024:32@75'); - glutGameModeString : procedure (const AString : PChar); {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutEnterGameMode : function : integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutLeaveGameMode : procedure; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} - glutGameModeGet : function (mode : GLenum) : integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF} + glutGameModeString : procedure (const AString : PChar); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutEnterGameMode : function : integer; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutLeaveGameMode : procedure; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glutGameModeGet : function (mode : GLenum) : integer; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} procedure LoadGlut(const dll: PChar); procedure FreeGlut; diff --git a/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glx.pas b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glx.pas index e478758f..125e3e39 100644 --- a/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glx.pas +++ b/Game/Code/lib/JEDI-SDL/OpenGL/Pas/glx.pas @@ -1,6 +1,6 @@ unit glx; { - $Id: glx.pas,v 1.1 2004/03/30 21:53:55 savage Exp $ + $Id: glx.pas,v 1.3 2006/11/20 21:20:59 savage Exp $ Translation of the Mesa GLX headers for FreePascal Copyright (C) 1999 Sebastian Guenther @@ -33,6 +33,12 @@ unit glx; { $Log: glx.pas,v $ + Revision 1.3 2006/11/20 21:20:59 savage + Updated to work in MacOS X + + Revision 1.2 2006/04/18 18:38:33 savage + fixed boolean test - thanks grudzio + Revision 1.1 2004/03/30 21:53:55 savage Moved to it's own folder. @@ -66,8 +72,6 @@ interface {$I jedi-sdl.inc} -//{$MACRO ON} - {$IFDEF UNIX} uses {$IFDEF FPC} @@ -225,7 +229,7 @@ function InitGLXFromLibrary( dll : PChar ): Boolean; begin Result := False; - if LoadModule( libGLX, dll ) then + if not LoadModule( libGLX, dll ) then exit; glXChooseVisual := GetModuleSymbol(libglx, 'glXChooseVisual'); diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/jedi-sdl.inc b/Game/Code/lib/JEDI-SDL/SDL/Pas/jedi-sdl.inc index 48a789fd..31283d40 100644 --- a/Game/Code/lib/JEDI-SDL/SDL/Pas/jedi-sdl.inc +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/jedi-sdl.inc @@ -1,5 +1,5 @@ { - $Id: jedi-sdl.inc,v 1.9 2004/12/23 23:42:17 savage Exp $ + $Id: jedi-sdl.inc,v 1.15 2007/05/29 21:30:48 savage Exp $ } {******************************************************************************} { } @@ -74,6 +74,24 @@ { } (* $Log: jedi-sdl.inc,v $ + Revision 1.15 2007/05/29 21:30:48 savage + Changes as suggested by Almindor for 64bit compatibility. + + Revision 1.14 2007/05/20 20:29:11 savage + Initial Changes to Handle 64 Bits + + Revision 1.13 2007/01/21 15:51:45 savage + Added Delphi 2006 support + + Revision 1.12 2006/11/19 18:41:01 savage + removed THREADING ON flag as it is no longer needed in latest versions of FPC. + + Revision 1.11 2006/01/04 00:52:41 drellis + Updated to include defined for ENDIAN values, SDL_BYTEORDER should now be correctly defined depending onthe platform. Code taken from sdl_mixer + + Revision 1.10 2005/05/22 18:42:31 savage + Changes as suggested by Michalis Kamburelis. Thanks again. + Revision 1.9 2004/12/23 23:42:17 savage Applied Patches supplied by Michalis Kamburelis ( THANKS! ), for greater FreePascal compatability. @@ -148,73 +166,138 @@ {$IFDEF ver90} {$DEFINE Delphi} {Delphi 2.x} {$DEFINE Delphi32} + {$DEFINE WIN32} + {$DEFINE WINDOWS} {$ENDIF ver90} {$IFDEF ver100} {$DEFINE Delphi} {Delphi 3.x} {$DEFINE Delphi32} {$DEFINE WIN32} + {$DEFINE WINDOWS} {$ENDIF ver100} {$IFDEF ver93} {$DEFINE Delphi} {C++ Builder 1.x} {$DEFINE Delphi32} + {$DEFINE WINDOWS} {$ENDIF ver93} {$IFDEF ver110} {$DEFINE Delphi} {C++ Builder 3.x} {$DEFINE Delphi32} + {$DEFINE WINDOWS} {$ENDIF ver110} {$IFDEF ver120} {$DEFINE Delphi} {Delphi 4.x} {$DEFINE Delphi32} + {$DEFINE Delphi4UP} {$DEFINE Has_Int64} + {$DEFINE WINDOWS} {$ENDIF ver120} {$IFDEF ver130} {$DEFINE Delphi} {Delphi 5.x} {$DEFINE Delphi32} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} {$DEFINE Has_Int64} + {$DEFINE WINDOWS} {$ENDIF ver130} {$IFDEF ver140} {$DEFINE Delphi} {Delphi 6.x} {$DEFINE Delphi32} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} {$DEFINE Has_Int64} + {$DEFINE HAS_TYPES} {$ENDIF ver140} {$IFDEF ver150} {$DEFINE Delphi} {Delphi 7.x} {$DEFINE Delphi32} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types in Delphi 7} {$DEFINE Has_Int64} + {$DEFINE HAS_TYPES} {$ENDIF ver150} {$IFDEF ver160} - {$DEFINE Delphi} {Delphi 8??} + {$DEFINE Delphi} {Delphi 8} {$DEFINE Delphi32} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} {$DEFINE Has_Int64} + {$DEFINE HAS_TYPES} {$ENDIF ver160} {$IFDEF ver170} - {$DEFINE Delphi} {Delphi 9??} + {$DEFINE Delphi} {Delphi 2005} {$DEFINE Delphi32} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types in Delphi 7} {$DEFINE Has_Int64} + {$DEFINE HAS_TYPES} {$ENDIF ver170} -{$IFDEF UNIX} - {$ifdef VER150} - {$define KYLIX} - {$endif} +{$IFDEF ver180} + {$DEFINE Delphi} {Delphi 2006} + {$DEFINE Delphi32} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types in Delphi 7} + {$DEFINE Has_Int64} + {$DEFINE HAS_TYPES} +{$ENDIF ver180} + +{$IFDEF ver185} + {$DEFINE Delphi} {Delphi 2007} + {$DEFINE Delphi32} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types in Delphi 7} + {$DEFINE Has_Int64} + {$DEFINE HAS_TYPES} +{$ENDIF ver180} - {$ifdef VER140} - {$define KYLIX} +{$IFDEF UNIX} + {$ifdef VER140} // Kylix 1 & 2 + {$DEFINE KYLIX} + {$DEFINE KYLIX1UP} + {$DEFINE KYLIX2UP} + {$DEFINE HAS_TYPES} {$endif} - {$ifdef VER140} - {$define KYLIX} + {$ifdef VER150} // Kylix 3 + {$DEFINE KYLIX} + {$DEFINE KYLIX1UP} + {$DEFINE KYLIX2UP} + {$DEFINE KYLIX3UP} + {$DEFINE HAS_TYPES} {$endif} {$ENDIF UNIX} @@ -227,14 +310,14 @@ {$IFDEF Delphi} {$DEFINE Windows} {$DEFINE USE_STDCALL} + //{$ALIGN ON} {$ENDIF Delphi} {$IFDEF FPC} {$MODE Delphi} { use Delphi compatibility mode } {$H+} - {$PACKRECORDS 4} // Added for record + {$PACKRECORDS C} // Added for record {$MACRO ON} // Added For OpenGL - {$THREADING on} {$DEFINE Delphi} {$DEFINE UseAT} {$UNDEF USE_STDCALL} @@ -242,7 +325,7 @@ {$DEFINE NO_EXPORTS} {$DEFINE Has_Int64} {$DEFINE NOCRT} - {$IFDEF unix} + {$IFDEF UNIX} {$DEFINE fpc_unix} {$ELSE} {$DEFINE __OS_DOS__} @@ -250,6 +333,7 @@ {$IFDEF WIN32} {$DEFINE UseWin} {$ENDIF} + {$DEFINE HAS_TYPES} {$ENDIF FPC} {$IFDEF Win16} @@ -335,3 +419,20 @@ {$IFNDEF ver70} {$UNDEF assembler} {$ENDIF} + +{*************** define LITTLE ENDIAN platforms ********************} + + +{$IFDEF Delphi} +{$DEFINE IA32} +{$ENDIF} + +{$IFDEF KYLIX} +{$DEFINE IA32} +{$ENDIF} + +{$IFDEF FPC} +{$IFDEF FPC_LITTLE_ENDIAN} +{$DEFINE IA32} +{$ENDIF} +{$ENDIF} diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/libxmlparser.pas b/Game/Code/lib/JEDI-SDL/SDL/Pas/libxmlparser.pas index 54841840..0cdf44c7 100644 --- a/Game/Code/lib/JEDI-SDL/SDL/Pas/libxmlparser.pas +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/libxmlparser.pas @@ -194,8 +194,6 @@ UNIT libxmlparser; {$I jedi-sdl.inc} -{$ALIGN ON} - INTERFACE USES diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/logger.pas b/Game/Code/lib/JEDI-SDL/SDL/Pas/logger.pas index 88bb1698..461fa261 100644 --- a/Game/Code/lib/JEDI-SDL/SDL/Pas/logger.pas +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/logger.pas @@ -1,6 +1,6 @@ unit logger; { - $Id: logger.pas,v 1.1 2004/02/05 00:08:20 savage Exp $ + $Id: logger.pas,v 1.2 2006/11/26 16:58:04 savage Exp $ } {******************************************************************************} @@ -63,6 +63,9 @@ unit logger; {******************************************************************************} { $Log: logger.pas,v $ + Revision 1.2 2006/11/26 16:58:04 savage + Modifed to create separate log files. Therefore each instance running from the same directory will have their own individual log file, prepended with a number. + Revision 1.1 2004/02/05 00:08:20 savage Module 1.0 release @@ -107,10 +110,20 @@ implementation { TLogger } constructor TLogger.Create; +var + FileName : string; + FileNo : integer; begin FApplicationName := ExtractFileName( ParamStr(0) ); FApplicationPath := ExtractFilePath( ParamStr(0) ); - AssignFile( FFileHandle, FApplicationPath + ChangeFileExt( FApplicationName, '.log' ) ); + FileName := FApplicationPath + ChangeFileExt( FApplicationName, '.log' ); + FileNo := 0; + while FileExists( FileName ) do + begin + inc( FileNo ); + FileName := FApplicationPath + IntToStr( FileNo ) + ChangeFileExt( FApplicationName, '.log' ) + end; + AssignFile( FFileHandle, FileName ); ReWrite( FFileHandle ); (*inherited Create( FApplicationPath + ChangeFileExt( FApplicationName, '.log' ), fmCreate {$IFNDEF FPC}or fmShareExclusive{$ENDIF} );*) diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/sdl.pas b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdl.pas index ad5d783a..29bc7123 100644 --- a/Game/Code/lib/JEDI-SDL/SDL/Pas/sdl.pas +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdl.pas @@ -1,6 +1,6 @@ unit sdl; { - $Id: sdl.pas,v 1.17 2005/01/03 18:40:59 savage Exp $ + $Id: sdl.pas,v 1.38 2008/01/26 10:09:32 savage Exp $ } {******************************************************************************} @@ -36,10 +36,10 @@ unit sdl; { SDL_loadso.h } { } { The initial developer of this Pascal code was : } -{ Dominqiue Louis } +{ Dominique Louis } { } -{ Portions created by Dominqiue Louis are } -{ Copyright (C) 2000 - 2004 Dominqiue Louis. } +{ Portions created by Dominique Louis are } +{ Copyright (C) 2000 - 2004 Dominique Louis. } { } { } { Contributor(s) } @@ -168,6 +168,63 @@ unit sdl; { } { $Log: sdl.pas,v $ + Revision 1.38 2008/01/26 10:09:32 savage + Added SDL_BUTTON_X1 and SDL_BUTTON_X2 constants for extended mouse buttons. Now makes SDL v1.2.13 compliant. + + Revision 1.37 2007/12/20 22:36:56 savage + Added SKYOS support, thanks to Sebastian-Torsten Tillmann + + Revision 1.36 2007/12/05 22:52:04 savage + Better Mac OS X support for Frameworks. + + Revision 1.35 2007/12/02 22:41:13 savage + Change for Mac OS X to link to SDL Framework + + Revision 1.34 2007/08/26 23:50:53 savage + Jonas supplied another fix. + + Revision 1.33 2007/08/26 15:59:46 savage + Mac OS changes as suggested by Jonas Maebe + + Revision 1.32 2007/08/22 21:18:43 savage + Thanks to Dean for his MouseDelta patch. + + Revision 1.31 2007/05/29 21:30:48 savage + Changes as suggested by Almindor for 64bit compatibility. + + Revision 1.30 2007/05/29 19:31:03 savage + Fix to TSDL_Overlay structure - thanks David Pethes (aka imcold) + + Revision 1.29 2007/05/20 20:29:11 savage + Initial Changes to Handle 64 Bits + + Revision 1.26 2007/02/11 13:38:04 savage + Added Nintendo DS support - Thanks Dean. + + Revision 1.25 2006/12/02 00:12:52 savage + Updated to latest version + + Revision 1.24 2006/05/18 21:10:04 savage + Added 1.2.10 Changes + + Revision 1.23 2005/12/04 23:17:52 drellis + Added declaration of SInt8 and PSInt8 + + Revision 1.22 2005/05/24 21:59:03 savage + Re-arranged uses clause to work on Win32 and Linux, Thanks again Michalis. + + Revision 1.21 2005/05/22 18:42:31 savage + Changes as suggested by Michalis Kamburelis. Thanks again. + + Revision 1.20 2005/04/10 11:48:33 savage + Changes as suggested by Michalis, thanks. + + Revision 1.19 2005/01/05 01:47:06 savage + Changed LibName to reflect what MacOS X should have. ie libSDL*-1.2.0.dylib respectively. + + Revision 1.18 2005/01/04 23:14:41 savage + Changed LibName to reflect what most Linux distros will have. ie libSDL*-1.2.so.0 respectively. + Revision 1.17 2005/01/03 18:40:59 savage Updated Version number to reflect latest one @@ -241,35 +298,54 @@ unit sdl; {$I jedi-sdl.inc} -{$ALIGN ON} - interface uses {$IFDEF __GPC__} system, + {$IFDEF WINDOWS} + wintypes, + {$ELSE} + {$ENDIF} gpc; {$ENDIF} -{$IFDEF WIN32} - {$IFNDEF __GPC__} +{$IFDEF HAS_TYPES} + Types{$IFNDEF NDS},{$ELSE};{$ENDIF} +{$ENDIF} + +{$IFDEF WINDOWS} Windows; - {$ENDIF} {$ENDIF} {$IFDEF UNIX} {$IFDEF FPC} - {$IFDEF Ver1_0} - linux, - {$ELSE} - pthreads, - baseunix, - unix, - {$ENDIF} - x, - xlib; + {$IFNDEF SKYOS} + pthreads, + {$ENDIF} + baseunix, + {$IFNDEF GP2X} + {$IFNDEF DARWIN} + {$IFNDEF SKYOS} + unix, + {$ELSE} + unix; + {$ENDIF} + {$ELSE} + unix; + {$ENDIF} + {$ELSE} + unix; + {$ENDIF} + {$IFNDEF GP2X} + {$IFNDEF DARWIN} + {$IFNDEF SKYOS} + x, + xlib; + {$ENDIF} + {$ENDIF} + {$ENDIF} {$ELSE} - Types, Libc, Xlib; {$ENDIF} @@ -280,22 +356,45 @@ uses {$ENDIF} const -{$IFDEF WIN32} +{$IFDEF WINDOWS} SDLLibName = 'SDL.dll'; {$ENDIF} {$IFDEF UNIX} {$IFDEF DARWIN} - SDLLibName = 'libSDL.dylib'; + SDLLibName = 'libSDL-1.2.0.dylib'; {$ELSE} + {$IFDEF FPC} SDLLibName = 'libSDL.so'; + {$ELSE} + SDLLibName = 'libSDL-1.2.so.0'; + {$ENDIF} {$ENDIF} {$ENDIF} {$IFDEF MACOS} SDLLibName = 'SDL'; + {$linklib libSDL} +{$ENDIF} + +{$IFDEF NDS} + SDLLibName = 'libSDL.a'; + {$linklib libSDL.a} + {$linklib libnds9.a} + {$linklib libc.a} + {$linklib libgcc.a} + {$linklib libsysbase.a} {$ENDIF} + // SDL_verion.h constants + // Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL + SDL_MAJOR_VERSION = 1; +{$EXTERNALSYM SDL_MAJOR_VERSION} + SDL_MINOR_VERSION = 2; +{$EXTERNALSYM SDL_MINOR_VERSION} + SDL_PATCHLEVEL = 13; +{$EXTERNALSYM SDL_PATCHLEVEL} + // SDL.h constants SDL_INIT_TIMER = $00000001; {$EXTERNALSYM SDL_INIT_TIMER} @@ -438,15 +537,6 @@ const SDL_HAT_LEFTDOWN = SDL_HAT_LEFT or SDL_HAT_DOWN; {$EXTERNALSYM SDL_HAT_LEFTDOWN} - // SDL_verion.h constants - // Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL - SDL_MAJOR_VERSION = 1; -{$EXTERNALSYM SDL_MAJOR_VERSION} - SDL_MINOR_VERSION = 2; -{$EXTERNALSYM SDL_MINOR_VERSION} - SDL_PATCHLEVEL = 8; -{$EXTERNALSYM SDL_PATCHLEVEL} - // SDL_events.h constants SDL_NOEVENT = 0; // Unused (do not remove) {$EXTERNALSYM SDL_NOEVENT} @@ -1059,6 +1149,47 @@ const SDLK_EURO = 321; // Some european keyboards {$EXTERNALSYM SDLK_EURO} +{$IFDEF GP2X} +SDLK_GP2X_UP = 0; +{$EXTERNALSYM SDLK_GP2X_UP} +SDLK_GP2X_UPLEFT = 1; +{$EXTERNALSYM SDLK_GP2X_UPLEFT} +SDLK_GP2X_LEFT = 2; +{$EXTERNALSYM SDLK_GP2X_LEFT} +SDLK_GP2X_DOWNLEFT = 3; +{$EXTERNALSYM SDLK_GP2X_DOWNLEFT} +SDLK_GP2X_DOWN = 4; +{$EXTERNALSYM SDLK_GP2X_DOWN} +SDLK_GP2X_DOWNRIGHT = 5; +{$EXTERNALSYM SDLK_GP2X_DOWNRIGHT} +SDLK_GP2X_RIGHT = 6; +{$EXTERNALSYM SDLK_GP2X_RIGHT} +SDLK_GP2X_UPRIGHT = 7; +{$EXTERNALSYM SDLK_GP2X_UPRIGHT} +SDLK_GP2X_START = 8; +{$EXTERNALSYM SDLK_GP2X_START} +SDLK_GP2X_SELECT = 9; +{$EXTERNALSYM SDLK_GP2X_SELECT} +SDLK_GP2X_L = 10; +{$EXTERNALSYM SDLK_GP2X_L} +SDLK_GP2X_R = 11; +{$EXTERNALSYM SDLK_GP2X_R} +SDLK_GP2X_A = 12; +{$EXTERNALSYM SDLK_GP2X_A} +SDLK_GP2X_B = 13; +{$EXTERNALSYM SDLK_GP2X_B} +SDLK_GP2X_Y = 14; +{$EXTERNALSYM SDLK_GP2X_Y} +SDLK_GP2X_X = 15; +{$EXTERNALSYM SDLK_GP2X_X} +SDLK_GP2X_VOLUP = 16; +{$EXTERNALSYM SDLK_GP2X_VOLUP} +SDLK_GP2X_VOLDOWN = 17; +{$EXTERNALSYM SDLK_GP2X_VOLDOWN} +SDLK_GP2X_CLICK = 18; +{$EXTERNALSYM SDLK_GP2X_CLICK} +{$ENDIF} + // Enumeration of valid key mods (possibly OR'd together) KMOD_NONE = $0000; {$EXTERNALSYM KMOD_NONE} @@ -1173,25 +1304,36 @@ const Button 1: Left mouse button Button 2: Middle mouse button Button 3: Right mouse button - Button 4: Mouse Wheel Up - Button 5: Mouse Wheel Down + Button 4: Mouse Wheel Up (may also be a real button) + Button 5: Mouse Wheel Down (may also be a real button) + Button 6: Mouse X1 (may also be a real button) + Button 7: Mouse X2 (may also be a real button) } - SDL_BUTTON_LEFT = 1; + SDL_BUTTON_LEFT = 1; {$EXTERNALSYM SDL_BUTTON_LEFT} - SDL_BUTTON_MIDDLE = 2; + SDL_BUTTON_MIDDLE = 2; {$EXTERNALSYM SDL_BUTTON_MIDDLE} - SDL_BUTTON_RIGHT = 3; + SDL_BUTTON_RIGHT = 3; {$EXTERNALSYM SDL_BUTTON_RIGHT} - SDL_BUTTON_WHEELUP = 4; + SDL_BUTTON_WHEELUP = 4; {$EXTERNALSYM SDL_BUTTON_WHEELUP} SDL_BUTTON_WHEELDOWN = 5; {$EXTERNALSYM SDL_BUTTON_WHEELDOWN} + SDL_BUTTON_X1 = 6; +{$EXTERNALSYM SDL_BUTTON_X1} + SDL_BUTTON_X2 = 7; +{$EXTERNALSYM SDL_BUTTON_X2} + SDL_BUTTON_LMASK = SDL_PRESSED shl (SDL_BUTTON_LEFT - 1); {$EXTERNALSYM SDL_BUTTON_LMASK} SDL_BUTTON_MMASK = SDL_PRESSED shl (SDL_BUTTON_MIDDLE - 1); {$EXTERNALSYM SDL_BUTTON_MMASK} - SDL_BUTTON_RMask = SDL_PRESSED shl (SDL_BUTTON_RIGHT - 1); -{$EXTERNALSYM SDL_BUTTON_RMask} + SDL_BUTTON_RMASK = SDL_PRESSED shl (SDL_BUTTON_RIGHT - 1); +{$EXTERNALSYM SDL_BUTTON_RMASK} + SDL_BUTTON_X1MASK = SDL_PRESSED shl (SDL_BUTTON_X1 - 1); +{$EXTERNALSYM SDL_BUTTON_X1MASK} + SDL_BUTTON_X2MASK = SDL_PRESSED shl (SDL_BUTTON_X2 - 1); +{$EXTERNALSYM SDL_BUTTON_X2MASK} // SDL_active.h constants // The available application states @@ -1233,6 +1375,7 @@ type PUInt8Array = ^TUInt8Array; PUInt8 = ^UInt8; + PPUInt8 = ^PUInt8; UInt8 = Byte; {$EXTERNALSYM UInt8} TUInt8Array = array [0..MAXINT shr 1] of UInt8; @@ -1241,6 +1384,10 @@ type UInt16 = word; {$EXTERNALSYM UInt16} + PSInt8 = ^SInt8; + SInt8 = Shortint; +{$EXTERNALSYM SInt8} + PSInt16 = ^SInt16; SInt16 = smallint; {$EXTERNALSYM SInt16} @@ -1675,7 +1822,7 @@ type {$ENDIF} // The windows custom event structure -{$IFDEF Win32} +{$IFDEF WINDOWS} PSDL_SysWMmsg = ^TSDL_SysWMmsg; TSDL_SysWMmsg = record version: TSDL_version; @@ -1693,7 +1840,13 @@ type version : TSDL_version; subsystem : TSDL_SysWm; {$IFDEF FPC} + {$IFNDEF GP2X} + {$IFNDEF DARWIN} + {$IFNDEF SKYOS} event : TXEvent; + {$ENDIF} + {$ENDIF} + {$ENDIF} {$ELSE} event : XEvent; {$ENDIF} @@ -1710,7 +1863,7 @@ type {$ENDIF} // The Windows custom window manager information structure -{$IFDEF Win32} +{$IFDEF WINDOWS} PSDL_SysWMinfo = ^TSDL_SysWMinfo; TSDL_SysWMinfo = record version : TSDL_version; @@ -1720,6 +1873,9 @@ type // The Linux custom window manager information structure {$IFDEF Unix} + {$IFNDEF GP2X} + {$IFNDEF DARWIN} + {$IFNDEF SKYOS} TX11 = record display : PDisplay; // The X11 display window : TWindow ; // The X11 display window */ @@ -1735,12 +1891,21 @@ type fswindow : TWindow ; // The X11 fullscreen window */ wmwindow : TWindow ; // The X11 managed input window */ end; - + {$ENDIF} + {$ENDIF} + {$ENDIF} + PSDL_SysWMinfo = ^TSDL_SysWMinfo; TSDL_SysWMinfo = record version : TSDL_version ; subsystem : TSDL_SysWm; + {$IFNDEF GP2X} + {$IFNDEF DARWIN} + {$IFNDEF SKYOS} X11 : TX11; + {$ENDIF} + {$ENDIF} + {$ENDIF} end; {$ELSE} // The generic custom window manager information structure @@ -1839,7 +2004,7 @@ type alpha: UInt8; // Alpha value information (per-surface alpha) end; -{$IFDEF WIN32} +{$IFDEF WINDOWS} {PPrivate_hwdata = ^TPrivate_hwdata; TPrivate_hwdata = record dd_surface : IDIRECTDRAWSURFACE3; @@ -1939,6 +2104,8 @@ type UnusedBits3: UInt8; // Unused at this point video_mem: UInt32; // The total amount of video memory (in K) vfmt: PSDL_PixelFormat; // Value: The format of the video surface + current_w : SInt32; // Value: The current video mode width + current_h : SInt32; // Value: The current video mode height end; // The YUV hardware video overlay @@ -1949,8 +2116,8 @@ type planes: Integer; // Number of planes in the overlay. Usually either 1 or 3 pitches: PUInt16; // An array of pitches, one for each plane. Pitch is the length of a row in bytes. - pixels: PUInt8; - // An array of pointers to teh data of each plane. The overlay should be locked before these pointers are used. + pixels: PPUInt8; + // An array of pointers to the data of each plane. The overlay should be locked before these pointers are used. hw_overlay: UInt32; // This will be set to 1 if the overlay is hardware accelerated. end; @@ -1971,7 +2138,9 @@ type SDL_GL_ACCUM_ALPHA_SIZE, SDL_GL_STEREO, SDL_GL_MULTISAMPLEBUFFERS, - SDL_GL_MULTISAMPLESAMPLES); + SDL_GL_MULTISAMPLESAMPLES, + SDL_GL_ACCELERATED_VISUAL, + SDL_GL_SWAP_CONTROL); @@ -1987,7 +2156,7 @@ type // SDL_mutex.h types -{$IFDEF WIN32} +{$IFDEF WINDOWS} PSDL_Mutex = ^TSDL_Mutex; TSDL_Mutex = record id: THANDLE; @@ -2005,6 +2174,15 @@ type end; {$ENDIF} +{$IFDEF NDS} + PSDL_mutex = ^TSDL_Mutex; + TSDL_Mutex = record + recursive: Integer; + Owner: UInt32; + sem: PSDL_sem; + end; +{$ENDIF} + {$IFDEF __MACH__} {$define USE_NAMED_SEMAPHORES} // Broken sem_getvalue() in MacOS X Public Beta */ @@ -2012,8 +2190,8 @@ type {$ENDIF} PSDL_semaphore = ^TSDL_semaphore; -{$IFDEF WIN32} - // Win32 or Machintosh +{$IFDEF WINDOWS} + // WINDOWS or Machintosh TSDL_semaphore = record id: THANDLE; count: UInt32; @@ -2065,7 +2243,7 @@ PSDL_semaphore = ^TSDL_semaphore; end; // SDL_thread.h types -{$IFDEF WIN32} +{$IFDEF WINDOWS} TSYS_ThreadHandle = THandle; {$ENDIF} @@ -2073,6 +2251,10 @@ PSDL_semaphore = ^TSDL_semaphore; TSYS_ThreadHandle = pthread_t; {$ENDIF} +{$IFDEF NDS} + TSYS_ThreadHandle = Integer; +{$ENDIF} + { This is the system-independent thread info structure } PSDL_Thread = ^TSDL_Thread; TSDL_Thread = record @@ -2103,17 +2285,34 @@ PSDL_semaphore = ^TSDL_semaphore; TWordArray = array[0..16383] of Word; PPoint = ^TPoint; - TPoint = record - x: Longint; - y: Longint; - end; + {$IFDEF HAS_TYPES} + TPoint = Types.TPoint; + {$ELSE} + {$IFDEF WINDOWS} + {$IFDEF __GPC__} + TPoint = wintypes.TPoint; + {$ELSE} + TPoint = Windows.TPoint; + {$ENDIF} + {$ELSE} + //Can't define TPoint : neither Types nor Windows unit available. + {$ENDIF} + {$ENDIF} PRect = ^TRect; - TRect = record - case Integer of - 0: (Left, Top, Right, Bottom: Integer); - 1: (TopLeft, BottomRight: TPoint); - end; + {$IFDEF HAS_TYPES} + TRect = Types.TRect; + {$ELSE} + {$IFDEF WINDOWS} + {$IFDEF __GPC__} + TRect = wintypes.TRect; + {$ELSE} + TRect = Windows.TRect; + {$ENDIF} + {$ELSE} + //Can't define TRect: neither Types nor Windows unit available. + {$ENDIF} + {$ENDIF} { Generic procedure pointer } TProcedure = procedure; @@ -2128,17 +2327,17 @@ PSDL_semaphore = ^TSDL_semaphore; signal handlers for some commonly ignored fatal signals (like SIGSEGV) } function SDL_Init( flags : UInt32 ) : Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_Init'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_Init'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_Init} // This function initializes specific SDL subsystems function SDL_InitSubSystem( flags : UInt32 ) : Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_InitSubSystem'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_InitSubSystem'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_InitSubSystem} // This function cleans up specific SDL subsystems procedure SDL_QuitSubSystem( flags : UInt32 ); -cdecl; external {$IFDEF __GPC__}name 'SDL_QuitSubSystem'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_QuitSubSystem'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_QuitSubSystem} { This function returns mask of the specified subsystems which have @@ -2146,26 +2345,26 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_QuitSubSystem'{$ELSE} SDLLibName{$ENDI If 'flags' is 0, it returns a mask of all initialized subsystems. } function SDL_WasInit( flags : UInt32 ): UInt32; -cdecl; external {$IFDEF __GPC__}name 'SDL_WasInit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_WasInit'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_WasInit} { This function cleans up all initialized subsystems and unloads the dynamically linked library. You should call it upon all exit conditions. } procedure SDL_Quit; -cdecl; external {$IFDEF __GPC__}name 'SDL_Quit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_Quit'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_Quit} -{$IFDEF WIN32} +{$IFDEF WINDOWS} // This should be called from your WinMain() function, if any function SDL_RegisterApp(name: PChar; style: UInt32; h_Inst: Pointer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_RegisterApp'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_RegisterApp'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_RegisterApp} {$ENDIF} {$IFDEF __MACH__} // This should be called from your main() function, if any procedure SDL_InitQuickDraw( the_qd: QDGlobals ); -cdecl; external {$IFDEF __GPC__}name 'SDL_InitQuickDraw'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_InitQuickDraw'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_InitQuickDraw} {$ENDIF} @@ -2183,18 +2382,18 @@ function SDL_TableSize( table: PChar ): Integer; {------------------------------------------------------------------------------} // Public functions function SDL_GetError: PChar; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetError'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GetError'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GetError} procedure SDL_SetError(fmt: PChar); -cdecl; external {$IFDEF __GPC__}name 'SDL_SetError'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_SetError'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_SetError} procedure SDL_ClearError; -cdecl; external {$IFDEF __GPC__}name 'SDL_ClearError'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_ClearError'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_ClearError} -{$IFNDEF WIN32} +{$IFNDEF WINDOWS} procedure SDL_Error(Code: TSDL_errorcode); -cdecl; external {$IFDEF __GPC__}name 'SDL_Error'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_Error'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_Error} {$ENDIF} @@ -2207,24 +2406,24 @@ procedure SDL_OutOfMemory; // Functions to create SDL_RWops structures from various data sources function SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; -cdecl; external {$IFDEF __GPC__}name 'SDL_RWFromFile'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_RWFromFile'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_RWFromFile} procedure SDL_FreeRW(area: PSDL_RWops); -cdecl; external {$IFDEF __GPC__}name 'SDL_FreeRW'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_FreeRW'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_FreeRW} //fp is FILE *fp ??? function SDL_RWFromFP(fp: Pointer; autoclose: Integer): PSDL_RWops; -cdecl; external {$IFDEF __GPC__}name 'SDL_RWFromFP'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_RWFromFP'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_RWFromFP} function SDL_RWFromMem(mem: Pointer; size: Integer): PSDL_RWops; -cdecl; external {$IFDEF __GPC__}name 'SDL_RWFromMem'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_RWFromMem'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_RWFromMem} function SDL_RWFromConstMem(const mem: Pointer; size: Integer) : PSDL_RWops; -cdecl; external {$IFDEF __GPC__}name 'SDL_RWFromConstMem'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_RWFromConstMem'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_RWFromConstMem} function SDL_AllocRW: PSDL_RWops; -cdecl; external {$IFDEF __GPC__}name 'SDL_AllocRW'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_AllocRW'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_AllocRW} function SDL_RWSeek(context: PSDL_RWops; offset: Integer; whence: Integer) : Integer; @@ -2245,28 +2444,28 @@ function SDL_RWClose(context: PSDL_RWops): Integer; { Get the number of milliseconds since the SDL library initialization. } { Note that this value wraps if the program runs for more than ~49 days. } function SDL_GetTicks: UInt32; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetTicks'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GetTicks'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GetTicks} // Wait a specified number of milliseconds before returning procedure SDL_Delay(msec: UInt32); -cdecl; external {$IFDEF __GPC__}name 'SDL_Delay'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_Delay'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_Delay} { Add a new timer to the pool of timers already running. } { Returns a timer ID, or NULL when an error occurs. } function SDL_AddTimer(interval: UInt32; callback: TSDL_NewTimerCallback; param : Pointer): PSDL_TimerID; -cdecl; external {$IFDEF __GPC__}name 'SDL_AddTimer'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_AddTimer'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_AddTimer} { Remove one of the multiple timers knowing its ID. } { Returns a boolean value indicating success. } function SDL_RemoveTimer(t: PSDL_TimerID): TSDL_Bool; -cdecl; external {$IFDEF __GPC__}name 'SDL_RemoveTimer'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_RemoveTimer'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_RemoveTimer} function SDL_SetTimer(interval: UInt32; callback: TSDL_TimerCallback): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SetTimer'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_SetTimer'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_SetTimer} {------------------------------------------------------------------------------} @@ -2278,10 +2477,10 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_SetTimer'{$ELSE} SDLLibName{$ENDIF __G You should normally use SDL_Init() or SDL_InitSubSystem(). } function SDL_AudioInit(driver_name: PChar): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_AudioInit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_AudioInit'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_AudioInit} procedure SDL_AudioQuit; -cdecl; external {$IFDEF __GPC__}name 'SDL_AudioQuit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_AudioQuit'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_AudioQuit} { This function fills the given character buffer with the name of the @@ -2289,7 +2488,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_AudioQuit'{$ELSE} SDLLibName{$ENDIF __ been initialized. It returns NULL if no driver has been initialized. } function SDL_AudioDriverName(namebuf: PChar; maxlen: Integer): PChar; -cdecl; external {$IFDEF __GPC__}name 'SDL_AudioDriverName'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_AudioDriverName'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_AudioDriverName} { This function opens the audio device with the desired parameters, and @@ -2333,12 +2532,12 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_AudioDriverName'{$ELSE} SDLLibName{$EN any local mixing buffers after you open the audio device. } function SDL_OpenAudio(desired, obtained: PSDL_AudioSpec): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_OpenAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_OpenAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_OpenAudio} { Get the current audio state: } function SDL_GetAudioStatus: TSDL_Audiostatus; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetAudioStatus'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GetAudioStatus'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GetAudioStatus} { This function pauses and unpauses the audio callback processing. @@ -2348,7 +2547,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_GetAudioStatus'{$ELSE} SDLLibName{$END Silence will be written to the audio device during the pause. } procedure SDL_PauseAudio(pause_on: Integer); -cdecl; external {$IFDEF __GPC__}name 'SDL_PauseAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_PauseAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_PauseAudio} { This function loads a WAVE from the data source, automatically freeing @@ -2369,7 +2568,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_PauseAudio'{$ELSE} SDLLibName{$ENDIF _ function SDL_LoadWAV_RW(src: PSDL_RWops; freesrc: Integer; spec: PSDL_AudioSpec; audio_buf: PUInt8; audiolen: PUInt32): PSDL_AudioSpec; -cdecl; external {$IFDEF __GPC__}name 'SDL_LoadWAV_RW'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_LoadWAV_RW'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_LoadWAV_RW} // Compatibility convenience function -- loads a WAV from a file @@ -2380,7 +2579,7 @@ function SDL_LoadWAV(filename: PChar; spec: PSDL_AudioSpec; audio_buf: { This function frees data previously allocated with SDL_LoadWAV_RW() } procedure SDL_FreeWAV(audio_buf: PUInt8); -cdecl; external {$IFDEF __GPC__}name 'SDL_FreeWAV'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_FreeWAV'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_FreeWAV} { This function takes a source format and rate and a destination format @@ -2391,7 +2590,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_FreeWAV'{$ELSE} SDLLibName{$ENDIF __GP function SDL_BuildAudioCVT(cvt: PSDL_AudioCVT; src_format: UInt16; src_channels: UInt8; src_rate: Integer; dst_format: UInt16; dst_channels: UInt8; dst_rate: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_BuildAudioCVT'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_BuildAudioCVT'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_BuildAudioCVT} { Once you have initialized the 'cvt' structure using SDL_BuildAudioCVT(), @@ -2402,7 +2601,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_BuildAudioCVT'{$ELSE} SDLLibName{$ENDI cvt->buf should be allocated after the cvt structure is initialized by SDL_BuildAudioCVT(), and should be cvt->len*cvt->len_mult bytes long. } function SDL_ConvertAudio(cvt: PSDL_AudioCVT): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_ConvertAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_ConvertAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_ConvertAudio} { This takes two audio buffers of the playing audio format and mixes @@ -2412,7 +2611,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_ConvertAudio'{$ELSE} SDLLibName{$ENDIF This is provided for convenience -- you can mix your own audio data. } procedure SDL_MixAudio(dst, src: PUInt8; len: UInt32; volume: Integer); -cdecl; external {$IFDEF __GPC__}name 'SDL_MixAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_MixAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_MixAudio} { The lock manipulated by these functions protects the callback function. @@ -2420,16 +2619,16 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_MixAudio'{$ELSE} SDLLibName{$ENDIF __G callback function is not running. Do not call these from the callback function or you will cause deadlock. } procedure SDL_LockAudio; -cdecl; external {$IFDEF __GPC__}name 'SDL_LockAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_LockAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_LockAudio} procedure SDL_UnlockAudio; -cdecl; external {$IFDEF __GPC__}name 'SDL_UnlockAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_UnlockAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_UnlockAudio} { This function shuts down audio processing and closes the audio device. } procedure SDL_CloseAudio; -cdecl; external {$IFDEF __GPC__}name 'SDL_CloseAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CloseAudio'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CloseAudio} {------------------------------------------------------------------------------} @@ -2440,7 +2639,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_CloseAudio'{$ELSE} SDLLibName{$ENDIF _ SDL_Init() has not been called with the SDL_INIT_CDROM flag. } function SDL_CDNumDrives: Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_CDNumDrives'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CDNumDrives'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CDNumDrives} { Returns a human-readable, system-dependent identifier for the CD-ROM. @@ -2450,7 +2649,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_CDNumDrives'{$ELSE} SDLLibName{$ENDIF "/dev/disk/ide/1/master" } function SDL_CDName(drive: Integer): PChar; -cdecl; external {$IFDEF __GPC__}name 'SDL_CDName'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CDName'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CDName} { Opens a CD-ROM drive for access. It returns a drive handle on success, @@ -2460,7 +2659,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_CDName'{$ELSE} SDLLibName{$ENDIF __GPC Drives are numbered starting with 0. Drive 0 is the system default CD-ROM. } function SDL_CDOpen(drive: Integer): PSDL_CD; -cdecl; external {$IFDEF __GPC__}name 'SDL_CDOpen'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CDOpen'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CDOpen} { This function returns the current status of the given drive. @@ -2468,7 +2667,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_CDOpen'{$ELSE} SDLLibName{$ENDIF __GPC play position of the CD will be stored in the SDL_CD structure. } function SDL_CDStatus(cdrom: PSDL_CD): TSDL_CDStatus; -cdecl; external {$IFDEF __GPC__}name 'SDL_CDStatus'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CDStatus'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CDStatus} { Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks' @@ -2495,7 +2694,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_CDStatus'{$ELSE} SDLLibName{$ENDIF __G function SDL_CDPlayTracks(cdrom: PSDL_CD; start_track: Integer; start_frame: Integer; ntracks: Integer; nframes: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_CDPlayTracks'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CDPlayTracks'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CDPlayTracks} @@ -2503,32 +2702,32 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_CDPlayTracks'{$ELSE} SDLLibName{$ENDIF It returns 0, or -1 if there was an error. } function SDL_CDPlay(cdrom: PSDL_CD; start: Integer; length: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_CDPlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CDPlay'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CDPlay} // Pause play -- returns 0, or -1 on error function SDL_CDPause(cdrom: PSDL_CD): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_CDPause'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CDPause'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CDPause} // Resume play -- returns 0, or -1 on error function SDL_CDResume(cdrom: PSDL_CD): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_CDResume'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CDResume'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CDResume} // Stop play -- returns 0, or -1 on error function SDL_CDStop(cdrom: PSDL_CD): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_CDStop'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CDStop'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CDStop} // Eject CD-ROM -- returns 0, or -1 on error function SDL_CDEject(cdrom: PSDL_CD): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_CDEject'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CDEject'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CDEject} // Closes the handle for the CD-ROM drive procedure SDL_CDClose(cdrom: PSDL_CD); -cdecl; external {$IFDEF __GPC__}name 'SDL_CDClose'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CDClose'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CDClose} // Given a status, returns true if there's a disk in the drive @@ -2548,14 +2747,14 @@ function MSF_TO_FRAMES(M: Integer; S: Integer; F: Integer): Integer; { Count the number of joysticks attached to the system } function SDL_NumJoysticks: Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_NumJoysticks'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_NumJoysticks'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_NumJoysticks} { Get the implementation dependent name of a joystick. This can be called before any joysticks are opened. If no name can be found, this function returns NULL. } function SDL_JoystickName(index: Integer): PChar; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickName'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_JoystickName'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_JoystickName} { Open a joystick for use - the index passed as an argument refers to @@ -2564,40 +2763,40 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickName'{$ELSE} SDLLibName{$ENDIF This function returns a joystick identifier, or NULL if an error occurred. } function SDL_JoystickOpen(index: Integer): PSDL_Joystick; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickOpen'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_JoystickOpen'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_JoystickOpen} { Returns 1 if the joystick has been opened, or 0 if it has not. } function SDL_JoystickOpened(index: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickOpened'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_JoystickOpened'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_JoystickOpened} { Get the device index of an opened joystick. } function SDL_JoystickIndex(joystick: PSDL_Joystick): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickIndex'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_JoystickIndex'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_JoystickIndex} { Get the number of general axis controls on a joystick } function SDL_JoystickNumAxes(joystick: PSDL_Joystick): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickNumAxes'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_JoystickNumAxes'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_JoystickNumAxes} { Get the number of trackballs on a joystick Joystick trackballs have only relative motion events associated with them and their state cannot be polled. } function SDL_JoystickNumBalls(joystick: PSDL_Joystick): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickNumBalls'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_JoystickNumBalls'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_JoystickNumBalls} { Get the number of POV hats on a joystick } function SDL_JoystickNumHats(joystick: PSDL_Joystick): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickNumHats'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_JoystickNumHats'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_JoystickNumHats} { Get the number of buttons on a joystick } function SDL_JoystickNumButtons(joystick: PSDL_Joystick): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickNumButtons'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_JoystickNumButtons'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_JoystickNumButtons} { Update the current state of the open joysticks. @@ -2605,7 +2804,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickNumButtons'{$ELSE} SDLLibName{ events are enabled. } procedure SDL_JoystickUpdate; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickUpdate'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_JoystickUpdate'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_JoystickUpdate;} { Enable/disable joystick event polling. @@ -2615,7 +2814,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickUpdate'{$ELSE} SDLLibName{$END The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE. } function SDL_JoystickEventState(state: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickEventState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_JoystickEventState'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_JoystickEventState} { Get the current state of an axis control on a joystick @@ -2623,13 +2822,13 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickEventState'{$ELSE} SDLLibName{ The axis indices start at index 0. } function SDL_JoystickGetAxis(joystick: PSDL_Joystick; axis: Integer) : SInt16; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickGetAxis'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_JoystickGetAxis'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_JoystickGetAxis} { The hat indices start at index 0. } function SDL_JoystickGetHat(joystick: PSDL_Joystick; hat: Integer): UInt8; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickGetHat'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_JoystickGetHat'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_JoystickGetHat} { Get the ball axis change since the last poll @@ -2637,18 +2836,18 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickGetHat'{$ELSE} SDLLibName{$END The ball indices start at index 0. } function SDL_JoystickGetBall(joystick: PSDL_Joystick; ball: Integer; var dx: Integer; var dy: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickGetBall'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_JoystickGetBall'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_JoystickGetBall} { Get the current state of a button on a joystick The button indices start at index 0. } function SDL_JoystickGetButton( joystick: PSDL_Joystick; Button: Integer): UInt8; -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickGetButton'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_JoystickGetButton'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_JoystickGetButton} { Close a joystick previously opened with SDL_JoystickOpen() } procedure SDL_JoystickClose(joystick: PSDL_Joystick); -cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickClose'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_JoystickClose'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_JoystickClose} {------------------------------------------------------------------------------} @@ -2660,7 +2859,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_JoystickClose'{$ELSE} SDLLibName{$ENDI This should only be run in the thread that sets the video mode. } procedure SDL_PumpEvents; -cdecl; external {$IFDEF __GPC__}name 'SDL_PumpEvents'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_PumpEvents'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_PumpEvents;} { Checks the event queue for messages and optionally returns them. @@ -2676,7 +2875,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_PumpEvents'{$ELSE} SDLLibName{$ENDIF _ if there was an error. This function is thread-safe. } function SDL_PeepEvents(events: PSDL_Event; numevents: Integer; action: TSDL_eventaction; mask: UInt32): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_PeepEvents'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_PeepEvents'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_PeepEvents} { Polls for currently pending events, and returns 1 if there are any pending @@ -2684,7 +2883,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_PeepEvents'{$ELSE} SDLLibName{$ENDIF _ event is removed from the queue and stored in that area. } function SDL_PollEvent(event: PSDL_Event): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_PollEvent'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_PollEvent'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_PollEvent} { Waits indefinitely for the next available event, returning 1, or 0 if there @@ -2692,11 +2891,11 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_PollEvent'{$ELSE} SDLLibName{$ENDIF __ event is removed from the queue and stored in that area. } function SDL_WaitEvent(event: PSDL_Event): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_WaitEvent'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_WaitEvent'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_WaitEvent} function SDL_PushEvent( event : PSDL_Event ) : Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_PushEvent'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_PushEvent'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_PushEvent} { If the filter returns 1, then the event will be added to the internal queue. @@ -2714,14 +2913,14 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_PushEvent'{$ELSE} SDLLibName{$ENDIF __ If the quit event is generated by an interrupt signal, it will bypass the internal queue and be delivered to the application at the next event poll. } procedure SDL_SetEventFilter( filter : TSDL_EventFilter ); -cdecl; external {$IFDEF __GPC__}name 'SDL_SetEventFilter'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_SetEventFilter'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_SetEventFilter} { Return the current event filter - can be used to "chain" filters. If there is no event filter set, this function returns NULL. } function SDL_GetEventFilter: TSDL_EventFilter; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetEventFilter'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GetEventFilter'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GetEventFilter} { This function allows you to set the state of processing certain events. @@ -2732,7 +2931,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_GetEventFilter'{$ELSE} SDLLibName{$END current processing state of the specified event. } function SDL_EventState(type_: UInt8; state: Integer): UInt8; -cdecl; external {$IFDEF __GPC__}name 'SDL_EventState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_EventState'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_EventState} {------------------------------------------------------------------------------} @@ -2764,7 +2963,7 @@ function SDL_VERSION_ATLEAST(X: Integer; Y: Integer; Z: Integer) : LongBool; use the SDL_Version() macro. } function SDL_Linked_Version: PSDL_version; -cdecl; external {$IFDEF __GPC__}name 'SDL_Linked_Version'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_Linked_Version'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_Linked_Version} {------------------------------------------------------------------------------} @@ -2785,10 +2984,10 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_Linked_Version'{$ELSE} SDLLibName{$END you won't be able to set full-screen display modes. } function SDL_VideoInit(driver_name: PChar; flags: UInt32): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_VideoInit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_VideoInit'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_VideoInit} procedure SDL_VideoQuit; -cdecl; external {$IFDEF __GPC__}name 'SDL_VideoQuit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_VideoQuit'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_VideoQuit} { This function fills the given character buffer with the name of the @@ -2796,7 +2995,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_VideoQuit'{$ELSE} SDLLibName{$ENDIF __ been initialized. It returns NULL if no driver has been initialized. } function SDL_VideoDriverName(namebuf: PChar; maxlen: Integer): PChar; -cdecl; external {$IFDEF __GPC__}name 'SDL_VideoDriverName'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_VideoDriverName'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_VideoDriverName} { This function returns a pointer to the current display surface. @@ -2805,7 +3004,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_VideoDriverName'{$ELSE} SDLLibName{$EN surface. } function SDL_GetVideoSurface: PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetVideoSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GetVideoSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GetVideoSurface} { This function returns a read-only pointer to information about the @@ -2813,7 +3012,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_GetVideoSurface'{$ELSE} SDLLibName{$EN member of the returned structure will contain the pixel format of the "best" video mode. } function SDL_GetVideoInfo: PSDL_VideoInfo; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetVideoInfo'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GetVideoInfo'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GetVideoInfo} { Check to see if a particular video mode is supported. @@ -2827,7 +3026,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_GetVideoInfo'{$ELSE} SDLLibName{$ENDIF SDL_SetVideoMode() } function SDL_VideoModeOK(width, height, bpp: Integer; flags: UInt32): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_VideoModeOK'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_VideoModeOK'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_VideoModeOK} { Return a pointer to an array of available screen dimensions for the @@ -2839,7 +3038,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_VideoModeOK'{$ELSE} SDLLibName{$ENDIF by SDL_GetVideoInfo( ) - > vfmt } function SDL_ListModes(format: PSDL_PixelFormat; flags: UInt32): PPSDL_Rect; -cdecl; external {$IFDEF __GPC__}name 'SDL_ListModes'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_ListModes'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_ListModes} @@ -2886,7 +3085,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_ListModes'{$ELSE} SDLLibName{$ENDIF __ This function returns the video framebuffer surface, or NULL if it fails. } function SDL_SetVideoMode(width, height, bpp: Integer; flags: UInt32): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'SDL_SetVideoMode'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_SetVideoMode'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_SetVideoMode} @@ -2896,10 +3095,10 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_SetVideoMode'{$ELSE} SDLLibName{$ENDIF These functions should not be called while 'screen' is locked. } procedure SDL_UpdateRects(screen: PSDL_Surface; numrects: Integer; rects: PSDL_Rect); -cdecl; external {$IFDEF __GPC__}name 'SDL_UpdateRects'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_UpdateRects'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_UpdateRects} procedure SDL_UpdateRect(screen: PSDL_Surface; x, y: SInt32; w, h: UInt32); -cdecl; external {$IFDEF __GPC__}name 'SDL_UpdateRect'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_UpdateRect'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_UpdateRect} @@ -2913,7 +3112,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_UpdateRect'{$ELSE} SDLLibName{$ENDIF _ This function returns 0 if successful, or -1 if there was an error.} function SDL_Flip(screen: PSDL_Surface): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_Flip'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_Flip'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_Flip} { Set the gamma correction for each of the color channels. @@ -2924,7 +3123,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_Flip'{$ELSE} SDLLibName{$ENDIF __GPC__ function returns 0, otherwise it returns -1. } function SDL_SetGamma(redgamma: single; greengamma: single; bluegamma: single ): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SetGamma'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_SetGamma'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_SetGamma} { Set the gamma translation table for the red, green, and blue channels @@ -2939,7 +3138,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_SetGamma'{$ELSE} SDLLibName{$ENDIF __G this function will return -1. } function SDL_SetGammaRamp( redtable: PUInt16; greentable: PUInt16; bluetable: PUInt16): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SetGammaRamp'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_SetGammaRamp'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_SetGammaRamp} { Retrieve the current values of the gamma translation tables. @@ -2951,7 +3150,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_SetGammaRamp'{$ELSE} SDLLibName{$ENDIF this function will return -1. } function SDL_GetGammaRamp( redtable: PUInt16; greentable: PUInt16; bluetable: PUInt16): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetGammaRamp'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GetGammaRamp'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GetGammaRamp} { Sets a portion of the colormap for the given 8-bit surface. If 'surface' @@ -2970,7 +3169,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_GetGammaRamp'{$ELSE} SDLLibName{$ENDIF function SDL_SetColors(surface: PSDL_Surface; colors: PSDL_Color; firstcolor : Integer; ncolors: Integer) : Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SetColors'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_SetColors'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_SetColors} { Sets a portion of the colormap for a given 8-bit surface. @@ -2989,27 +3188,27 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_SetColors'{$ELSE} SDLLibName{$ENDIF __ flags = (SDL_LOGPAL or SDL_PHYSPAL). } function SDL_SetPalette(surface: PSDL_Surface; flags: Integer; colors: PSDL_Color; firstcolor: Integer; ncolors: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SetPalette'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_SetPalette'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_SetPalette} { Maps an RGB triple to an opaque pixel value for a given pixel format } function SDL_MapRGB(format: PSDL_PixelFormat; r: UInt8; g: UInt8; b: UInt8) : UInt32; -cdecl; external {$IFDEF __GPC__}name 'SDL_MapRGB'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_MapRGB'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_MapRGB} { Maps an RGBA quadruple to a pixel value for a given pixel format } function SDL_MapRGBA(format: PSDL_PixelFormat; r: UInt8; g: UInt8; b: UInt8; a: UInt8): UInt32; -cdecl; external {$IFDEF __GPC__}name 'SDL_MapRGBA'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_MapRGBA'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_MapRGBA} { Maps a pixel value into the RGB components for a given pixel format } procedure SDL_GetRGB(pixel: UInt32; fmt: PSDL_PixelFormat; r: PUInt8; g: PUInt8; b: PUInt8); -cdecl; external {$IFDEF __GPC__}name 'SDL_GetRGB'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GetRGB'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GetRGB} { Maps a pixel value into the RGBA components for a given pixel format } procedure SDL_GetRGBA(pixel: UInt32; fmt: PSDL_PixelFormat; r: PUInt8; g: PUInt8; b: PUInt8; a: PUInt8); -cdecl; external {$IFDEF __GPC__}name 'SDL_GetRGBA'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GetRGBA'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GetRGBA} { Allocate and free an RGB surface (must be called after SDL_SetVideoMode) @@ -3050,16 +3249,16 @@ function SDL_AllocSurface(flags: UInt32; width, height, depth: Integer; {$EXTERNALSYM SDL_AllocSurface} function SDL_CreateRGBSurface(flags: UInt32; width, height, depth: Integer; RMask, GMask, BMask, AMask: UInt32): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'SDL_CreateRGBSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CreateRGBSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CreateRGBSurface} function SDL_CreateRGBSurfaceFrom(pixels: Pointer; width, height, depth, pitch : Integer; RMask, GMask, BMask, AMask: UInt32): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'SDL_CreateRGBSurfaceFrom'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CreateRGBSurfaceFrom'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CreateRGBSurfaceFrom} procedure SDL_FreeSurface(surface: PSDL_Surface); -cdecl; external {$IFDEF __GPC__}name 'SDL_FreeSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_FreeSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_FreeSurface} function SDL_MustLock(Surface: PSDL_Surface): Boolean; @@ -3081,11 +3280,11 @@ function SDL_MustLock(Surface: PSDL_Surface): Boolean; SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. } function SDL_LockSurface(surface: PSDL_Surface): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_LockSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_LockSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_LockSurface} procedure SDL_UnlockSurface(surface: PSDL_Surface); -cdecl; external {$IFDEF __GPC__}name 'SDL_UnlockSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_UnlockSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_UnlockSurface} { Load a surface from a seekable SDL data source (memory or file.) @@ -3093,7 +3292,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_UnlockSurface'{$ELSE} SDLLibName{$ENDI Returns the new surface, or NULL if there was an error. The new surface should be freed with SDL_FreeSurface(). } function SDL_LoadBMP_RW(src: PSDL_RWops; freesrc: Integer): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'SDL_LoadBMP_RW'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_LoadBMP_RW'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_LoadBMP_RW} // Convenience macro -- load a surface from a file @@ -3105,7 +3304,7 @@ function SDL_LoadBMP(filename: PChar): PSDL_Surface; Returns 0 if successful or -1 if there was an error. } function SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SaveBMP_RW'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_SaveBMP_RW'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_SaveBMP_RW} // Convenience macro -- save a surface to a file @@ -3121,7 +3320,7 @@ function SDL_SaveBMP(surface: PSDL_Surface; filename: PChar): Integer; This function returns 0, or -1 if there was an error. } function SDL_SetColorKey(surface: PSDL_Surface; flag, key: UInt32) : Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SetColorKey'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_SetColorKey'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_SetColorKey} { This function sets the alpha value for the entire surface, as opposed to @@ -3138,7 +3337,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_SetColorKey'{$ELSE} SDLLibName{$ENDIF function SDL_SetAlpha(surface: PSDL_Surface; flag: UInt32; alpha: UInt8): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SetAlpha'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_SetAlpha'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_SetAlpha} { Sets the clipping rectangle for the destination surface in a blit. @@ -3152,14 +3351,14 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_SetAlpha'{$ELSE} SDLLibName{$ENDIF __G Note that blits are automatically clipped to the edges of the source and destination surfaces. } procedure SDL_SetClipRect(surface: PSDL_Surface; rect: PSDL_Rect); cdecl; -external {$IFDEF __GPC__}name 'SDL_SetClipRect'{$ELSE} SDLLibName{$ENDIF __GPC__}; +external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_SetClipRect'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_SetClipRect} { Gets the clipping rectangle for the destination surface in a blit. 'rect' must be a pointer to a valid rectangle which will be filled with the correct values. } procedure SDL_GetClipRect(surface: PSDL_Surface; rect: PSDL_Rect); cdecl; -external {$IFDEF __GPC__}name 'SDL_GetClipRect'{$ELSE} SDLLibName{$ENDIF __GPC__}; +external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GetClipRect'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GetClipRect} { Creates a new surface of the specified format, and then copies and maps @@ -3174,7 +3373,7 @@ external {$IFDEF __GPC__}name 'SDL_GetClipRect'{$ELSE} SDLLibName{$ENDIF __GPC__ This function is used internally by SDL_DisplayFormat(). } function SDL_ConvertSurface(src: PSDL_Surface; fmt: PSDL_PixelFormat; flags: UInt32): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'SDL_ConvertSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_ConvertSurface'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_ConvertSurface} { @@ -3254,13 +3453,13 @@ function SDL_BlitSurface(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surfac { This is the public blit function, SDL_BlitSurface(), and it performs rectangle validation and clipping before passing it to SDL_LowerBlit() } function SDL_UpperBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_UpperBlit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_UpperBlit'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_UpperBlit} { This is a semi-private blit function and it performs low-level surface blitting only. } function SDL_LowerBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_LowerBlit'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_LowerBlit'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_LowerBlit} { This function performs a fast fill of the given rectangle with 'color' @@ -3272,7 +3471,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_LowerBlit'{$ELSE} SDLLibName{$ENDIF __ This function returns 0 on success, or -1 on error. } function SDL_FillRect(dst: PSDL_Surface; dstrect: PSDL_Rect; color: UInt32) : Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_FillRect'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_FillRect'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_FillRect} { This function takes a surface and copies it to a new surface of the @@ -3286,7 +3485,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_FillRect'{$ELSE} SDLLibName{$ENDIF __G If the conversion fails or runs out of memory, it returns NULL } function SDL_DisplayFormat(surface: PSDL_Surface): PSDL_Surface; cdecl; -external {$IFDEF __GPC__}name 'SDL_DisplayFormat'{$ELSE} SDLLibName{$ENDIF __GPC__}; +external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_DisplayFormat'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_DisplayFormat} { This function takes a surface and copies it to a new surface of the @@ -3302,7 +3501,7 @@ external {$IFDEF __GPC__}name 'SDL_DisplayFormat'{$ELSE} SDLLibName{$ENDIF __GPC function SDL_DisplayFormatAlpha(surface: PSDL_Surface): PSDL_Surface; cdecl; -external {$IFDEF __GPC__}name 'SDL_DisplayFormatAlpha'{$ELSE} SDLLibName{$ENDIF __GPC__}; +external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_DisplayFormatAlpha'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_DisplayFormatAlpha} //* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -3315,16 +3514,16 @@ external {$IFDEF __GPC__}name 'SDL_DisplayFormatAlpha'{$ELSE} SDLLibName{$ENDIF is shown is undefined - it may be overwritten with the converted YUV data. } function SDL_CreateYUVOverlay(width: Integer; height: Integer; format: UInt32; display: PSDL_Surface): PSDL_Overlay; -cdecl; external {$IFDEF __GPC__}name 'SDL_CreateYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CreateYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CreateYUVOverlay} // Lock an overlay for direct access, and unlock it when you are done function SDL_LockYUVOverlay(Overlay: PSDL_Overlay): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_LockYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_LockYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_LockYUVOverlay} procedure SDL_UnlockYUVOverlay(Overlay: PSDL_Overlay); cdecl; -external {$IFDEF __GPC__}name 'SDL_UnlockYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; +external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_UnlockYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_UnlockYUVOverlay} @@ -3335,12 +3534,12 @@ external {$IFDEF __GPC__}name 'SDL_UnlockYUVOverlay'{$ELSE} SDLLibName{$ENDIF __ that of the overlay, but currently only 2x scaling is supported. } function SDL_DisplayYUVOverlay(Overlay: PSDL_Overlay; dstrect: PSDL_Rect) : Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_DisplayYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_DisplayYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_DisplayYUVOverlay} // Free a video overlay procedure SDL_FreeYUVOverlay(Overlay: PSDL_Overlay); -cdecl; external {$IFDEF __GPC__}name 'SDL_FreeYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_FreeYUVOverlay'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_FreeYUVOverlay} {------------------------------------------------------------------------------} @@ -3358,17 +3557,17 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_FreeYUVOverlay'{$ELSE} SDLLibName{$END function SDL_GL_LoadLibrary(filename: PChar): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_GL_LoadLibrary'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GL_LoadLibrary'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GL_LoadLibrary} { Get the address of a GL function (for extension functions) } function SDL_GL_GetProcAddress(procname: PChar) : Pointer; -cdecl; external {$IFDEF __GPC__}name 'SDL_GL_GetProcAddress'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GL_GetProcAddress'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GL_GetProcAddress} { Set an attribute of the OpenGL subsystem before intialization. } function SDL_GL_SetAttribute(attr: TSDL_GLAttr; value: Integer) : Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_GL_SetAttribute'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GL_SetAttribute'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GL_SetAttribute} { Get an attribute of the OpenGL subsystem from the windowing @@ -3380,26 +3579,26 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_GL_SetAttribute'{$ELSE} SDLLibName{$EN themselves if they want to retrieve these values. } function SDL_GL_GetAttribute(attr: TSDL_GLAttr; var value: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_GL_GetAttribute'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GL_GetAttribute'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GL_GetAttribute} { Swap the OpenGL buffers, if double-buffering is supported. } procedure SDL_GL_SwapBuffers; -cdecl; external {$IFDEF __GPC__}name 'SDL_GL_SwapBuffers'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GL_SwapBuffers'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GL_SwapBuffers;} { Internal functions that should not be called unless you have read and understood the source code for these functions. } procedure SDL_GL_UpdateRects(numrects: Integer; rects: PSDL_Rect); -cdecl; external {$IFDEF __GPC__}name 'SDL_GL_UpdateRects'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GL_UpdateRects'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GL_UpdateRects} procedure SDL_GL_Lock; -cdecl; external {$IFDEF __GPC__}name 'SDL_GL_Lock'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GL_Lock'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GL_Lock;} procedure SDL_GL_Unlock; -cdecl; external {$IFDEF __GPC__}name 'SDL_GL_Unlock'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GL_Unlock'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GL_Unlock;} {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} @@ -3408,10 +3607,10 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_GL_Unlock'{$ELSE} SDLLibName{$ENDIF __ { Sets/Gets the title and icon text of the display window } procedure SDL_WM_GetCaption(var title : PChar; var icon : PChar); -cdecl; external {$IFDEF __GPC__}name 'SDL_WM_GetCaption'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_WM_GetCaption'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_WM_GetCaption} procedure SDL_WM_SetCaption( const title : PChar; const icon : PChar); -cdecl; external {$IFDEF __GPC__}name 'SDL_WM_SetCaption'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_WM_SetCaption'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_WM_SetCaption} { Sets the icon for the display window. @@ -3419,7 +3618,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_WM_SetCaption'{$ELSE} SDLLibName{$ENDI It takes an icon surface, and a mask in MSB format. If 'mask' is NULL, the entire icon surface will be used as the icon. } procedure SDL_WM_SetIcon(icon: PSDL_Surface; mask: UInt8); -cdecl; external {$IFDEF __GPC__}name 'SDL_WM_SetIcon'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_WM_SetIcon'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_WM_SetIcon} { This function iconifies the window, and returns 1 if it succeeded. @@ -3427,7 +3626,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_WM_SetIcon'{$ELSE} SDLLibName{$ENDIF _ This function is a noop and returns 0 in non-windowed environments. } function SDL_WM_IconifyWindow: Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_WM_IconifyWindow'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_WM_IconifyWindow'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_WM_IconifyWindow} { Toggle fullscreen mode without changing the contents of the screen. @@ -3445,7 +3644,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_WM_IconifyWindow'{$ELSE} SDLLibName{$E This is currently only implemented in the X11 video driver. } function SDL_WM_ToggleFullScreen(surface: PSDL_Surface): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_WM_ToggleFullScreen'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_WM_ToggleFullScreen'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_WM_ToggleFullScreen} { Grabbing means that the mouse is confined to the application window, @@ -3453,7 +3652,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_WM_ToggleFullScreen'{$ELSE} SDLLibName and not interpreted by a window manager, if any. } function SDL_WM_GrabInput(mode: TSDL_GrabMode): TSDL_GrabMode; -cdecl; external {$IFDEF __GPC__}name 'SDL_WM_GrabInput'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_WM_GrabInput'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_WM_GrabInput} {------------------------------------------------------------------------------} @@ -3466,7 +3665,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_WM_GrabInput'{$ELSE} SDLLibName{$ENDIF current mouse cursor position. You can pass NULL for either x or y. } function SDL_GetMouseState(var x: Integer; var y: Integer): UInt8; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetMouseState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GetMouseState'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GetMouseState} { Retrieve the current state of the mouse. @@ -3474,12 +3673,12 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_GetMouseState'{$ELSE} SDLLibName{$ENDI be tested using the SDL_BUTTON(X) macros, and x and y are set to the mouse deltas since the last call to SDL_GetRelativeMouseState(). } function SDL_GetRelativeMouseState(var x: Integer; var y: Integer): UInt8; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetRelativeMouseState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GetRelativeMouseState'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GetRelativeMouseState} { Set the position of the mouse cursor (generates a mouse motion event) } procedure SDL_WarpMouse(x, y: UInt16); -cdecl; external {$IFDEF __GPC__}name 'SDL_WarpMouse'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_WarpMouse'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_WarpMouse} { Create a cursor using the specified data and mask (in MSB format). @@ -3494,24 +3693,24 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_WarpMouse'{$ELSE} SDLLibName{$ENDIF __ Cursors created with this function must be freed with SDL_FreeCursor(). } function SDL_CreateCursor(data, mask: PUInt8; w, h, hot_x, hot_y: Integer): PSDL_Cursor; -cdecl; external {$IFDEF __GPC__}name 'SDL_CreateCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CreateCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CreateCursor} { Set the currently active cursor to the specified one. If the cursor is currently visible, the change will be immediately represented on the display. } procedure SDL_SetCursor(cursor: PSDL_Cursor); -cdecl; external {$IFDEF __GPC__}name 'SDL_SetCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_SetCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_SetCursor} { Returns the currently active cursor. } function SDL_GetCursor: PSDL_Cursor; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GetCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GetCursor} { Deallocates a cursor created with SDL_CreateCursor(). } procedure SDL_FreeCursor(cursor: PSDL_Cursor); -cdecl; external {$IFDEF __GPC__}name 'SDL_FreeCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_FreeCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_FreeCursor} { Toggle whether or not the cursor is shown on the screen. @@ -3520,7 +3719,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_FreeCursor'{$ELSE} SDLLibName{$ENDIF _ before the call, or 0 if it was not. You can query the current state by passing a 'toggle' value of -1. } function SDL_ShowCursor(toggle: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_ShowCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_ShowCursor'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_ShowCursor} function SDL_BUTTON( Button : Integer ) : Integer; @@ -3536,14 +3735,18 @@ function SDL_BUTTON( Button : Integer ) : Integer; If 'enable' is -1, the translation state is not changed. It returns the previous state of keyboard translation. } function SDL_EnableUNICODE(enable: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_EnableUNICODE'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_EnableUNICODE'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_EnableUNICODE} { If 'delay' is set to 0, keyboard repeat is disabled. } function SDL_EnableKeyRepeat(delay: Integer; interval: Integer): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_EnableKeyRepeat'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_EnableKeyRepeat'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_EnableKeyRepeat} +procedure SDL_GetKeyRepeat(delay : PInteger; interval: PInteger); +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GetKeyRepeat'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; +{$EXTERNALSYM SDL_GetKeyRepeat} + { Get a snapshot of the current state of the keyboard. Returns an array of keystates, indexed by the SDLK_* syms. Used: @@ -3552,23 +3755,23 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_EnableKeyRepeat'{$ELSE} SDLLibName{$EN if ( keystate[SDLK_RETURN] ) ... is pressed } function SDL_GetKeyState(numkeys: PInt): PUInt8; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetKeyState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GetKeyState'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GetKeyState} { Get the current key modifier state } function SDL_GetModState: TSDLMod; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetModState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GetModState'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GetModState} { Set the current key modifier state This does not change the keyboard state, only the key modifier flags. } procedure SDL_SetModState(modstate: TSDLMod); -cdecl; external {$IFDEF __GPC__}name 'SDL_SetModState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_SetModState'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_SetModState} { Get the name of an SDL virtual keysym } function SDL_GetKeyName(key: TSDLKey): PChar; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetKeyName'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GetKeyName'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GetKeyName} {------------------------------------------------------------------------------} @@ -3581,7 +3784,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_GetKeyName'{$ELSE} SDLLibName{$ENDIF _ see your application, otherwise it has been iconified or disabled. } function SDL_GetAppState: UInt8; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetAppState'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GetAppState'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GetAppState} @@ -3590,13 +3793,13 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_GetAppState'{$ELSE} SDLLibName{$ENDIF { Create a mutex, initialized unlocked } function SDL_CreateMutex: PSDL_Mutex; -cdecl; external {$IFDEF __GPC__}name 'SDL_CreateMutex'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CreateMutex'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CreateMutex} { Lock the mutex (Returns 0, or -1 on error) } function SDL_mutexP(mutex: PSDL_mutex): Integer; - cdecl; external {$IFDEF __GPC__}name 'SDL_mutexP'{$ELSE} SDLLibName{$ENDIF __GPC__}; + cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_mutexP'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; { $ EXTERNALSYM SDL_mutexP} function SDL_LockMutex(mutex: PSDL_mutex): Integer; @@ -3604,7 +3807,7 @@ function SDL_LockMutex(mutex: PSDL_mutex): Integer; { Unlock the mutex (Returns 0, or -1 on error) } function SDL_mutexV(mutex: PSDL_mutex): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_mutexV'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_mutexV'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_mutexV} function SDL_UnlockMutex(mutex: PSDL_mutex): Integer; @@ -3612,7 +3815,7 @@ function SDL_UnlockMutex(mutex: PSDL_mutex): Integer; { Destroy a mutex } procedure SDL_DestroyMutex(mutex: PSDL_mutex); -cdecl; external {$IFDEF __GPC__}name 'SDL_DestroyMutex'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_DestroyMutex'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_DestroyMutex} { * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } @@ -3620,13 +3823,13 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_DestroyMutex'{$ELSE} SDLLibName{$ENDIF { * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } { Create a semaphore, initialized with value, returns NULL on failure. } function SDL_CreateSemaphore(initial_value: UInt32): PSDL_Sem; -cdecl; external {$IFDEF __GPC__}name 'SDL_CreateSemaphore'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CreateSemaphore'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CreateSemaphore} { Destroy a semaphore } procedure SDL_DestroySemaphore(sem: PSDL_sem); -cdecl; external {$IFDEF __GPC__}name 'SDL_DestroySemaphore'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_DestroySemaphore'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_DestroySemaphore} { This function suspends the calling thread until the semaphore pointed @@ -3634,14 +3837,14 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_DestroySemaphore'{$ELSE} SDLLibName{$E count. } function SDL_SemWait(sem: PSDL_sem): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SemWait'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_SemWait'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_SemWait} { Non-blocking variant of SDL_SemWait(), returns 0 if the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait would block, and -1 on error. } function SDL_SemTryWait(sem: PSDL_sem): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SemTryWait'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_SemTryWait'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_SemTryWait} { Variant of SDL_SemWait() with a timeout in milliseconds, returns 0 if @@ -3651,20 +3854,20 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_SemTryWait'{$ELSE} SDLLibName{$ENDIF _ of 1 ms, and so should be avoided if possible. } function SDL_SemWaitTimeout(sem: PSDL_sem; ms: UInt32): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SemWaitTimeout'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_SemWaitTimeout'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_SemTryWait} { Atomically increases the semaphore's count (not blocking), returns 0, or -1 on error. } function SDL_SemPost(sem: PSDL_sem): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_SemPost'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_SemPost'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_SemTryWait} { Returns the current count of the semaphore } function SDL_SemValue(sem: PSDL_sem): UInt32; -cdecl; external {$IFDEF __GPC__}name 'SDL_SemValue'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_SemValue'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_SemValue} { * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } @@ -3672,26 +3875,26 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_SemValue'{$ELSE} SDLLibName{$ENDIF __G { * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } { Create a condition variable } function SDL_CreateCond: PSDL_Cond; -cdecl; external {$IFDEF __GPC__}name 'SDL_CreateCond'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CreateCond'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CreateCond} { Destroy a condition variable } procedure SDL_DestroyCond(cond: PSDL_Cond); -cdecl; external {$IFDEF __GPC__}name 'SDL_DestroyCond'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_DestroyCond'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_DestroyCond} { Restart one of the threads that are waiting on the condition variable, returns 0 or -1 on error. } function SDL_CondSignal(cond: PSDL_cond): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_CondSignal'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CondSignal'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CondSignal} { Restart all threads that are waiting on the condition variable, returns 0 or -1 on error. } function SDL_CondBroadcast(cond: PSDL_cond): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_CondBroadcast'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CondBroadcast'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CondBroadcast} @@ -3700,7 +3903,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_CondBroadcast'{$ELSE} SDLLibName{$ENDI Returns 0 when it is signaled, or -1 on error. } function SDL_CondWait(cond: PSDL_cond; mut: PSDL_mutex): Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_CondWait'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CondWait'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CondWait} { Waits for at most 'ms' milliseconds, and returns 0 if the condition @@ -3710,7 +3913,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_CondWait'{$ELSE} SDLLibName{$ENDIF __G of 1 ms, and so should be avoided if possible. } function SDL_CondWaitTimeout(cond: PSDL_cond; mut: PSDL_mutex; ms: UInt32) : Integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_CondWaitTimeout'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CondWaitTimeout'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CondWaitTimeout} { * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * } @@ -3719,18 +3922,18 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_CondWaitTimeout'{$ELSE} SDLLibName{$EN { Create a thread } function SDL_CreateThread(fn: PInt; data: Pointer): PSDL_Thread; -cdecl; external {$IFDEF __GPC__}name 'SDL_CreateThread'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_CreateThread'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_CreateThread} { Get the 32-bit thread identifier for the current thread } function SDL_ThreadID: UInt32; -cdecl; external {$IFDEF __GPC__}name 'SDL_ThreadID'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_ThreadID'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_ThreadID} { Get the 32-bit thread identifier for the specified thread, equivalent to SDL_ThreadID() if the specified thread is NULL. } function SDL_GetThreadID(thread: PSDL_Thread): UInt32; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetThreadID'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GetThreadID'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GetThreadID} { Wait for a thread to finish. @@ -3738,18 +3941,18 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_GetThreadID'{$ELSE} SDLLibName{$ENDIF pointed to by 'status', if 'status' is not NULL. } procedure SDL_WaitThread(thread: PSDL_Thread; var status: Integer); -cdecl; external {$IFDEF __GPC__}name 'SDL_WaitThread'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_WaitThread'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_WaitThread} { Forcefully kill a thread without worrying about its state } procedure SDL_KillThread(thread: PSDL_Thread); -cdecl; external {$IFDEF __GPC__}name 'SDL_KillThread'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_KillThread'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_KillThread} {------------------------------------------------------------------------------} { Get Environment Routines } {------------------------------------------------------------------------------} -{$IFDEF WIN32} +{$IFDEF WINDOWS} function _putenv( const variable : Pchar ): integer; cdecl; {$ENDIF} @@ -3762,7 +3965,7 @@ cdecl; external 'libc.so' name 'putenv'; {$ENDIF} { Put a variable of the form "name=value" into the environment } -//function SDL_putenv(const variable: PChar): integer; cdecl; external {$IFDEF __GPC__}name 'SDL_Init'{$ELSE} SDLLibName{$ENDIF __GPC__}SDLLibName name ''; +//function SDL_putenv(const variable: PChar): integer; cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_Init'{$ELSE} SDLLibName{$ENDIF __GPC__}SDLLibName name ''; function SDL_putenv(const variable: PChar): integer; {$EXTERNALSYM SDL_putenv} @@ -3771,14 +3974,14 @@ function SDL_putenv(const variable: PChar): integer; //function putenv(const variable: PChar): integer; //{$EXTERNALSYM putenv} -{$IFDEF WIN32} +{$IFDEF WINDOWS} {$IFNDEF __GPC__} function getenv( const name : Pchar ): PChar; cdecl; {$ENDIF} {$ENDIF} {* Retrieve a variable named "name" from the environment } -//function SDL_getenv(const name: PChar): PChar; cdecl; external {$IFDEF __GPC__}name 'SDL_Init'{$ELSE} SDLLibName{$ENDIF __GPC__}SDLLibName name ''; +//function SDL_getenv(const name: PChar): PChar; cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_Init'{$ELSE} SDLLibName{$ENDIF __GPC__}SDLLibName name ''; function SDL_getenv(const name: PChar): PChar; {$EXTERNALSYM SDL_getenv} @@ -3794,7 +3997,7 @@ function SDL_getenv(const name: PChar): PChar; * the version member of the 'info' structure is invalid, it returns 0. *} function SDL_GetWMInfo(info : PSDL_SysWMinfo) : integer; -cdecl; external {$IFDEF __GPC__}name 'SDL_GetWMInfo'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_GetWMInfo'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_GetWMInfo} {------------------------------------------------------------------------------} @@ -3805,7 +4008,7 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_GetWMInfo'{$ELSE} SDLLibName{$ENDIF __ * The 'sofile' parameter is a system dependent name of the object file. *} function SDL_LoadObject( const sofile : PChar ) : Pointer; -cdecl; external {$IFDEF __GPC__}name 'SDL_LoadObject'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_LoadObject'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_LoadObject} {* Given an object handle, this function looks up the address of the @@ -3813,12 +4016,12 @@ cdecl; external {$IFDEF __GPC__}name 'SDL_LoadObject'{$ELSE} SDLLibName{$ENDIF _ * is no longer valid after calling SDL_UnloadObject(). *} function SDL_LoadFunction( handle : Pointer; const name : PChar ) : Pointer; -cdecl; external {$IFDEF __GPC__}name 'SDL_LoadFunction'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_LoadFunction'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_LoadFunction} {* Unload a shared object from memory *} procedure SDL_UnloadObject( handle : Pointer ); -cdecl; external {$IFDEF __GPC__}name 'SDL_UnloadObject'{$ELSE} SDLLibName{$ENDIF __GPC__}; +cdecl; external {$IFNDEF NDS}{$IFDEF __GPC__}name 'SDL_UnloadObject'{$ELSE} SDLLibName{$ENDIF __GPC__}{$ENDIF}; {$EXTERNALSYM SDL_UnloadObject} @@ -3860,7 +4063,7 @@ end; procedure SDL_OutOfMemory; begin - {$IFNDEF WIN32} + {$IFNDEF WINDOWS} SDL_Error(SDL_ENOMEM); {$ENDIF} end; @@ -3981,7 +4184,7 @@ begin Result := SDL_mutexV(mutex); end; -{$IFDEF WIN32} +{$IFDEF WINDOWS} function _putenv( const variable : Pchar ): Integer; cdecl; external {$IFDEF __GPC__}name '_putenv'{$ELSE} 'MSVCRT.DLL'{$ENDIF __GPC__}; {$ENDIF} @@ -3989,7 +4192,7 @@ cdecl; external {$IFDEF __GPC__}name '_putenv'{$ELSE} 'MSVCRT.DLL'{$ENDIF __GPC_ function SDL_putenv(const variable: PChar): Integer; begin - {$IFDEF WIN32} + {$IFDEF WINDOWS} Result := _putenv(variable); {$ENDIF} @@ -4002,7 +4205,7 @@ begin {$ENDIF} end; -{$IFDEF WIN32} +{$IFDEF WINDOWS} {$IFNDEF __GPC__} function getenv( const name : Pchar ): PChar; cdecl; external {$IFDEF __GPC__}name 'getenv'{$ELSE} 'MSVCRT.DLL'{$ENDIF}; @@ -4011,7 +4214,7 @@ cdecl; external {$IFDEF __GPC__}name 'getenv'{$ELSE} 'MSVCRT.DLL'{$ENDIF}; function SDL_getenv(const name: PChar): PChar; begin - {$IFDEF WIN32} + {$IFDEF WINDOWS} {$IFDEF __GPC__} Result := getenv( string( name ) ); diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlgameinterface.pas b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlgameinterface.pas index f8bf902c..cc95751d 100644 --- a/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlgameinterface.pas +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlgameinterface.pas @@ -1,6 +1,6 @@ unit sdlgameinterface; { - $Id: sdlgameinterface.pas,v 1.3 2004/10/17 18:41:49 savage Exp $ + $Id: sdlgameinterface.pas,v 1.4 2005/08/03 18:57:31 savage Exp $ } {******************************************************************************} @@ -62,6 +62,9 @@ unit sdlgameinterface; { September 23 2004 - DL : Initial Creation } { $Log: sdlgameinterface.pas,v $ + Revision 1.4 2005/08/03 18:57:31 savage + Various updates and additions. Mainly to handle OpenGL 3D Window support and better cursor support for the mouse class + Revision 1.3 2004/10/17 18:41:49 savage Slight Change to allow Reseting of Input Event handlers @@ -97,11 +100,11 @@ type procedure MouseWheelScroll( WheelDelta : Integer; Shift: TSDLMod; MousePos : TPoint ); virtual; procedure KeyDown( var Key: TSDLKey; Shift: TSDLMod; unicode : UInt16 ); virtual; public - MainWindow : TSDL2DWindow; + MainWindow : TSDLCustomWindow; procedure ResetInputManager; procedure LoadSurfaces; virtual; function PointIsInRect( Point : TPoint; x, y, x1, y1 : integer ) : Boolean; - constructor Create( const aMainWindow : TSDL2DWindow ); + constructor Create( const aMainWindow : TSDLCustomWindow ); destructor Destroy; override; property NextGameInterface : TGameInterfaceClass read FNextGameInterface write FNextGameInterface; end; @@ -114,7 +117,7 @@ begin FNextGameInterface := nil; end; -constructor TGameInterface.Create( const aMainWindow : TSDL2DWindow ); +constructor TGameInterface.Create( const aMainWindow : TSDLCustomWindow ); begin inherited Create; MainWindow := aMainWindow; @@ -176,14 +179,18 @@ begin end; procedure TGameInterface.ResetInputManager; +var + temp : TSDLNotifyEvent; begin MainWindow.InputManager.Mouse.OnMouseDown := MouseDown; MainWindow.InputManager.Mouse.OnMouseMove := MouseMove; MainWindow.InputManager.Mouse.OnMouseUp := MouseUp; MainWindow.InputManager.Mouse.OnMouseWheel := MouseWheelScroll; MainWindow.InputManager.KeyBoard.OnKeyDown := KeyDown; - MainWindow.OnRender := Render; - MainWindow.OnClose := Close; + temp := Render; + MainWindow.OnRender := temp; + temp := Close; + MainWindow.OnClose := temp; MainWindow.OnUpdate := Update; end; diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlticks.pas b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlticks.pas index 4e91ecb8..8e00dd6f 100644 --- a/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlticks.pas +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlticks.pas @@ -1,7 +1,7 @@ unit sdlticks; { - $Id: sdlticks.pas,v 1.1 2004/09/30 22:35:47 savage Exp $ - + $Id: sdlticks.pas,v 1.2 2006/11/08 08:22:48 savage Exp $ + } {******************************************************************************} { } @@ -59,10 +59,12 @@ unit sdlticks; { September 23 2004 - DL : Initial Creation } { $Log: sdlticks.pas,v $ + Revision 1.2 2006/11/08 08:22:48 savage + updates tp sdlgameinterface and sdlticks functions. + Revision 1.1 2004/09/30 22:35:47 savage Changes, enhancements and additions as required to get SoAoS working. - } {******************************************************************************} @@ -71,49 +73,50 @@ interface uses sdl; - type TSDLTicks = class private - m_startTime : Int64; - m_ticksPerSecond : Int64; - s_lastTime : Int64; - + FStartTime : UInt32; + FTicksPerSecond : UInt32; + FElapsedLastTime : UInt32; + FFPSLastTime : UInt32; + FLockFPSLastTime : UInt32; public constructor Create; - destructor Destroy; override; // destructor + destructor Destroy; override; // destructor {***************************************************************************** Init - If the hi-res timer is present, the tick rate is stored and the function returns true. Otherwise, the function returns false, and the timer should not be used. *****************************************************************************} function Init : boolean; - function GetElapsedSeconds( elapsedFrames : Cardinal = 1 ) : single; + {*************************************************************************** + GetGetElapsedSeconds + Returns the Elapsed time, since the function was last called. + ***************************************************************************} + function GetElapsedSeconds : Single; {*************************************************************************** GetFPS - - Returns the average frames per second over elapsedFrames, which defaults to - one. If this is not called every frame, the client should track the number + Returns the average frames per second. + If this is not called every frame, the client should track the number of frames itself, and reset the value after this is called. ***************************************************************************} - function GetFPS( elapsedFrames : Cardinal = 1 ) : single; + function GetFPS : single; {*************************************************************************** LockFPS - Used to lock the frame rate to a set amount. This will block until enough time has passed to ensure that the fps won't go over the requested amount. Note that this can only keep the fps from going above the specified level; it can still drop below it. It is assumed that if used, this function will be called every frame. The value returned is the instantaneous fps, which - will be <= targetFPS. + will be less than or equal to the targetFPS. ***************************************************************************} - function LockFPS( targetFPS : Byte ) : single; + procedure LockFPS( targetFPS : Byte ); end; implementation @@ -121,76 +124,74 @@ implementation { TSDLTicks } constructor TSDLTicks.Create; begin - + inherited; + FTicksPerSecond := 1000; end; destructor TSDLTicks.Destroy; begin - inherited; end; -function TSDLTicks.GetElapsedSeconds( elapsedFrames: Cardinal ): single; +function TSDLTicks.GetElapsedSeconds : Single; var - currentTime : Int64; + currentTime : Cardinal; begin - // s_lastTime := m_startTime; - currentTime := SDL_GetTicks; - //QueryPerformanceCounter( currentTime ); - result := (currentTime - s_lastTime) / m_ticksPerSecond; + result := ( currentTime - FElapsedLastTime ) / FTicksPerSecond; // reset the timer - s_lastTime := currentTime; + FElapsedLastTime := currentTime; end; -function TSDLTicks.GetFPS( elapsedFrames: Cardinal ): single; +function TSDLTicks.GetFPS : Single; var - currentTime : integer; - fps : single; + currentTime, FrameTime : UInt32; + fps : single; begin - // s_lastTime := m_startTime; - currentTime := SDL_GetTicks; - fps := elapsedFrames * m_ticksPerSecond / ( currentTime - s_lastTime); + FrameTime := ( currentTime - FFPSLastTime ); - // reset the timer - s_lastTime := currentTime; + if FrameTime = 0 then + FrameTime := 1; + fps := FTicksPerSecond / FrameTime; + + // reset the timer + FFPSLastTime := currentTime; result := fps; end; -function TSDLTicks.Init: boolean; +function TSDLTicks.Init : boolean; begin - m_startTime := SDL_GetTicks; - s_lastTime := m_startTime; - m_ticksPerSecond := 1000; + FStartTime := SDL_GetTicks; + FElapsedLastTime := FStartTime; + FFPSLastTime := FStartTime; + FLockFPSLastTime := FStartTime; result := true; end; -function TSDLTicks.LockFPS(targetFPS: Byte): single; +procedure TSDLTicks.LockFPS( targetFPS : Byte ); var - currentTime : integer; - fps : single; + currentTime : UInt32; + targetTime : single; begin - if (targetFPS = 0) then + if ( targetFPS = 0 ) then targetFPS := 1; - s_lastTime := m_startTime; + targetTime := FTicksPerSecond / targetFPS; // delay to maintain a constant frame rate repeat currentTime := SDL_GetTicks; - fps := m_ticksPerSecond / (currentTime - s_lastTime); - until (fps > targetFPS); + until ( ( currentTime - FLockFPSLastTime ) > targetTime ); // reset the timer - s_lastTime := m_startTime; - - result := fps; + FLockFPSLastTime := currentTime; end; end. + \ No newline at end of file diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlutils.pas b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlutils.pas index bef83cbc..b15fa9ba 100644 --- a/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlutils.pas +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlutils.pas @@ -1,7 +1,7 @@ unit sdlutils; { - $Id: sdlutils.pas,v 1.4 2004/06/02 19:38:53 savage Exp $ - + $Id: sdlutils.pas,v 1.5 2006/11/19 18:56:44 savage Exp $ + } {******************************************************************************} { } @@ -105,6 +105,9 @@ unit sdlutils; {******************************************************************************} { $Log: sdlutils.pas,v $ + Revision 1.5 2006/11/19 18:56:44 savage + Removed Hints and Warnings. + Revision 1.4 2004/06/02 19:38:53 savage Changes to SDL_GradientFillRect as suggested by Ángel Eduardo García Hernández. Many thanks. @@ -119,12 +122,12 @@ unit sdlutils; Revision 1.1 2004/02/05 00:08:20 savage Module 1.0 release - + } interface -{$i jedi-sdl.inc} +{$I jedi-sdl.inc} uses {$IFDEF UNIX} @@ -157,7 +160,7 @@ procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Col cardinal ); overload; procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : - cardinal ; DashLength, DashSpace : byte ); overload; + cardinal; DashLength, DashSpace : byte ); overload; procedure SDL_AddLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : cardinal ); @@ -217,16 +220,16 @@ procedure SDL_FillRectSub( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color procedure SDL_GradientFillRect( DstSurface : PSDL_Surface; const Rect : PSDL_Rect; const StartColor, EndColor : TSDL_Color; const Style : TGradientStyle ); // NOTE for All SDL_2xblit... function : the dest surface must be 2x of the source surface! -procedure SDL_2xBlit(Src, Dest: PSDL_Surface); +procedure SDL_2xBlit( Src, Dest : PSDL_Surface ); -procedure SDL_Scanline2xBlit(Src, Dest: PSDL_Surface); +procedure SDL_Scanline2xBlit( Src, Dest : PSDL_Surface ); -procedure SDL_50Scanline2xBlit(Src, Dest: PSDL_Surface); +procedure SDL_50Scanline2xBlit( Src, Dest : PSDL_Surface ); // function SDL_PixelTestSurfaceVsRect( SrcSurface1 : PSDL_Surface; SrcRect1 : -PSDL_Rect; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : -boolean; + PSDL_Rect; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : + boolean; // Jason's boolean Surface functions procedure SDL_ORSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; @@ -242,7 +245,7 @@ procedure SDL_GTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; procedure SDL_LTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); -function SDL_ClipLine(var x1,y1,x2,y2: Integer; ClipRect: PSDL_Rect) : boolean; +function SDL_ClipLine( var x1, y1, x2, y2 : Integer; ClipRect : PSDL_Rect ) : boolean; implementation @@ -256,13 +259,13 @@ var right1, bottom1 : integer; right2, bottom2 : integer; Scan1Start, Scan2Start, ScanWidth, ScanHeight : cardinal; - Mod1, Mod2 : cardinal; + Mod1, Mod2 : cardinal; Addr1, Addr2 : cardinal; - BPP : cardinal; + BPP : cardinal; Pitch1, Pitch2 : cardinal; TransparentColor1, TransparentColor2 : cardinal; - tx, ty : cardinal; - StartTick : cardinal; + tx, ty : cardinal; + StartTick : cardinal; Color1, Color2 : cardinal; begin Result := false; @@ -438,9 +441,9 @@ end; procedure SDL_AddPixel( DstSurface : PSDL_Surface; x : cardinal; y : cardinal; Color : cardinal ); var - SrcColor : cardinal; - Addr : cardinal; - R, G, B : cardinal; + SrcColor : cardinal; + Addr : cardinal; + R, G, B : cardinal; begin if Color = 0 then exit; @@ -521,9 +524,9 @@ end; procedure SDL_SubPixel( DstSurface : PSDL_Surface; x : cardinal; y : cardinal; Color : cardinal ); var - SrcColor : cardinal; - Addr : cardinal; - R, G, B : cardinal; + SrcColor : cardinal; + Addr : cardinal; + R, G, B : cardinal; begin if Color = 0 then exit; @@ -608,12 +611,12 @@ procedure SDL_AddSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); var R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; - Src, Dest : TSDL_Rect; - Diff : integer; + Src, Dest : TSDL_Rect; + Diff : integer; SrcAddr, DestAddr : cardinal; WorkX, WorkY : word; SrcMod, DestMod : cardinal; - Bits : cardinal; + Bits : cardinal; begin if ( SrcSurface = nil ) or ( DestSurface = nil ) then exit; // Remove this to make it faster @@ -878,13 +881,13 @@ procedure SDL_SubSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); var R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; - Src, Dest : TSDL_Rect; - Diff : integer; + Src, Dest : TSDL_Rect; + Diff : integer; SrcAddr, DestAddr : cardinal; _ebx, _esi, _edi, _esp : cardinal; WorkX, WorkY : word; SrcMod, DestMod : cardinal; - Bits : cardinal; + Bits : cardinal; begin if ( SrcSurface = nil ) or ( DestSurface = nil ) then exit; // Remove this to make it faster @@ -1140,14 +1143,14 @@ end; procedure SDL_MonoSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DestSurface : PSDL_Surface; DestRect : PSDL_Rect; Color : cardinal ); var - Src, Dest : TSDL_Rect; - Diff : integer; + Src, Dest : TSDL_Rect; + Diff : integer; SrcAddr, DestAddr : cardinal; _ebx, _esi, _edi, _esp : cardinal; WorkX, WorkY : word; SrcMod, DestMod : cardinal; TransparentColor, SrcColor : cardinal; - BPP : cardinal; + BPP : cardinal; begin if ( SrcSurface = nil ) or ( DestSurface = nil ) then exit; // Remove this to make it faster @@ -1312,14 +1315,14 @@ procedure SDL_TexturedSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DestSurface : PSDL_Surface; DestRect : PSDL_Rect; Texture : PSDL_Surface; TextureRect : PSDL_Rect ); var - Src, Dest : TSDL_Rect; - Diff : integer; + Src, Dest : TSDL_Rect; + Diff : integer; SrcAddr, DestAddr, TextAddr : cardinal; _ebx, _esi, _edi, _esp : cardinal; WorkX, WorkY : word; SrcMod, DestMod, TextMod : cardinal; SrcColor, TransparentColor, TextureColor : cardinal; - BPP : cardinal; + BPP : cardinal; begin if ( SrcSurface = nil ) or ( DestSurface = nil ) then exit; // Remove this to make it faster @@ -1496,10 +1499,10 @@ end; procedure SDL_ZoomSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; DstRect : PSDL_Rect ); var - xc, yc : cardinal; + xc, yc : cardinal; rx, wx, ry, wy, ry16 : cardinal; - color : cardinal; - modx, mody : cardinal; + color : cardinal; + modx, mody : cardinal; begin // Warning! No checks for surface pointers!!! if srcrect = nil then @@ -1540,13 +1543,13 @@ end; procedure SDL_WarpSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DstSurface : PSDL_Surface; UL, UR, LR, LL : PPoint ); const - SHIFTS = 15; // Extend ints to limit round-off error (try 2 - 20) - THRESH = 1 shl SHIFTS; // Threshold for pixel size value + SHIFTS = 15; // Extend ints to limit round-off error (try 2 - 20) + THRESH = 1 shl SHIFTS; // Threshold for pixel size value procedure CopySourceToDest( UL, UR, LR, LL : TPoint; x1, y1, x2, y2 : cardinal ); var tm, lm, rm, bm, m : TPoint; - mx, my : cardinal; - cr : cardinal; + mx, my : cardinal; + cr : cardinal; begin // Does the destination area specify a single pixel? if ( ( abs( ul.x - ur.x ) < THRESH ) and @@ -1620,6 +1623,7 @@ end; // Draw a line between x1,y1 and x2,y2 to the given surface // NOTE: The surface must be locked before calling this! + procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : cardinal ); var @@ -1673,8 +1677,9 @@ end; // Draw a dashed line between x1,y1 and x2,y2 to the given surface // NOTE: The surface must be locked before calling this! + procedure SDL_DrawLine( DstSurface : PSDL_Surface; x1, y1, x2, y2 : integer; Color : - cardinal ; DashLength, DashSpace : byte ); overload; + cardinal; DashLength, DashSpace : byte ); overload; var dx, dy, sdx, sdy, x, y, px, py, counter : integer; drawdash : boolean; begin @@ -1682,10 +1687,12 @@ begin drawdash := true; //begin line drawing with dash //Avoid invalid user-passed dash parameters - if (DashLength < 1) - then DashLength := 1; - if (DashSpace < 1) - then DashSpace := 0; + if ( DashLength < 1 ) + then + DashLength := 1; + if ( DashSpace < 1 ) + then + DashSpace := 0; dx := x2 - x1; dy := y2 - y1; @@ -1706,28 +1713,28 @@ begin if dx >= dy then begin for x := 0 to dx - 1 do - begin + begin //Alternate drawing dashes, or leaving spaces if drawdash then + begin + SDL_PutPixel( DstSurface, px, py, Color ); + inc( counter ); + if ( counter > DashLength - 1 ) and ( DashSpace > 0 ) then begin - SDL_PutPixel( DstSurface, px, py, Color ); - inc(counter); - if (counter > DashLength-1) and (DashSpace > 0) then - begin - drawdash := false; - counter := 0; - end; - end + drawdash := false; + counter := 0; + end; + end else //space + begin + inc( counter ); + if counter > DashSpace - 1 then begin - inc(counter); - if counter > DashSpace-1 then - begin - drawdash := true; - counter := 0; - end; + drawdash := true; + counter := 0; end; + end; y := y + dy; if y >= dx then @@ -1745,24 +1752,24 @@ begin //Alternate drawing dashes, or leaving spaces if drawdash then + begin + SDL_PutPixel( DstSurface, px, py, Color ); + inc( counter ); + if ( counter > DashLength - 1 ) and ( DashSpace > 0 ) then begin - SDL_PutPixel( DstSurface, px, py, Color ); - inc(counter); - if (counter > DashLength-1) and (DashSpace > 0) then - begin - drawdash := false; - counter := 0; - end; - end + drawdash := false; + counter := 0; + end; + end else //space + begin + inc( counter ); + if counter > DashSpace - 1 then begin - inc(counter); - if counter > DashSpace-1 then - begin - drawdash := true; - counter := 0; - end; + drawdash := true; + counter := 0; end; + end; x := x + dx; if x >= dy then @@ -1878,13 +1885,14 @@ begin end; // flips a rectangle vertically on given surface + procedure SDL_FlipRectV( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); var - TmpRect : TSDL_Rect; - Locked : boolean; + TmpRect : TSDL_Rect; + Locked : boolean; y, FlipLength, RowLength : integer; - Row1, Row2 : Pointer; - OneRow : TByteArray; // Optimize it if you wish + Row1, Row2 : Pointer; + OneRow : TByteArray; // Optimize it if you wish begin if DstSurface <> nil then begin @@ -1920,6 +1928,7 @@ begin end; // flips a rectangle horizontally on given surface + procedure SDL_FlipRectH( DstSurface : PSDL_Surface; Rect : PSDL_Rect ); type T24bit = packed array[ 0..2 ] of byte; @@ -1928,15 +1937,15 @@ type TLongWordArray = array[ 0..8191 ] of LongWord; PLongWordArray = ^TLongWordArray; var - TmpRect : TSDL_Rect; - Row8bit : PByteArray; - Row16bit : PWordArray; - Row24bit : P24bitArray; - Row32bit : PLongWordArray; + TmpRect : TSDL_Rect; + Row8bit : PByteArray; + Row16bit : PWordArray; + Row24bit : P24bitArray; + Row32bit : PLongWordArray; y, x, RightSide, FlipLength : integer; - Pixel : cardinal; - Pixel24 : T24bit; - Locked : boolean; + Pixel : cardinal; + Pixel24 : T24bit; + Locked : boolean; begin if DstSurface <> nil then begin @@ -2030,9 +2039,10 @@ end; // Use with caution! The procedure allocates memory for TSDL_Rect and return with its pointer. // But you MUST free it after you don't need it anymore!!! + function PSDLRect( aLeft, aTop, aWidth, aHeight : integer ) : PSDL_Rect; var - Rect : PSDL_Rect; + Rect : PSDL_Rect; begin New( Rect ); with Rect^ do @@ -2103,10 +2113,11 @@ begin end; // Stretches a part of a surface + function SDL_ScaleSurfaceRect( SrcSurface : PSDL_Surface; SrcX1, SrcY1, SrcW, SrcH, Width, Height : integer ) : PSDL_Surface; var - dst_surface : PSDL_Surface; + dst_surface : PSDL_Surface; dx, dy, e, d, dx2, srcx2, srcy2 : integer; destx1, desty1 : integer; begin @@ -2153,7 +2164,7 @@ end; procedure SDL_MoveLine( Surface : PSDL_Surface; x1, x2, y1, xofs, depth : integer ); var src_pixels, dst_pixels : PUint8; - i : integer; + i : integer; begin src_pixels := PUint8( integer( Surface^.pixels ) + Surface^.w * y1 * depth + x2 * depth ); @@ -2171,8 +2182,8 @@ NOTE: The surface must be locked before calling this! } function SDL_GetPixel( SrcSurface : PSDL_Surface; x : integer; y : integer ) : Uint32; var - bpp : UInt32; - p : PInteger; + bpp : UInt32; + p : PInteger; begin bpp := SrcSurface.format.BytesPerPixel; // Here p is the address to the pixel we want to retrieve @@ -2199,8 +2210,8 @@ end; procedure SDL_PutPixel( DstSurface : PSDL_Surface; x : integer; y : integer; pixel : Uint32 ); var - bpp : UInt32; - p : PInteger; + bpp : UInt32; + p : PInteger; begin bpp := DstSurface.format.BytesPerPixel; p := Pointer( Uint32( DstSurface.pixels ) + UInt32( y ) * DstSurface.pitch + UInt32( x ) @@ -2228,9 +2239,9 @@ end; procedure SDL_ScrollY( DstSurface : PSDL_Surface; DifY : integer ); var - r1, r2 : TSDL_Rect; + r1, r2 : TSDL_Rect; //buffer: PSDL_Surface; - YPos : Integer; + YPos : Integer; begin if ( DstSurface <> nil ) and ( DifY <> 0 ) then begin @@ -2282,8 +2293,8 @@ end;} procedure SDL_ScrollX( DstSurface : PSDL_Surface; DifX : integer ); var - r1, r2 : TSDL_Rect; - buffer : PSDL_Surface; + r1, r2 : TSDL_Rect; + buffer : PSDL_Surface; begin if ( DstSurface <> nil ) and ( DifX <> 0 ) then begin @@ -2310,14 +2321,14 @@ end; procedure SDL_RotateRad( DstSurface, SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DestX, DestY, OffsetX, OffsetY : Integer; Angle : Single ); var - aSin, aCos : Single; + aSin, aCos : Single; MX, MY, DX, DY, NX, NY, SX, SY, OX, OY, Width, Height, TX, TY, RX, RY, ROX, ROY : Integer; Colour, TempTransparentColour : UInt32; - MAXX, MAXY : Integer; + MAXX, MAXY : Integer; begin // Rotate the surface to the target surface. TempTransparentColour := SrcSurface.format.colorkey; - if srcRect.w > srcRect.h then + {if srcRect.w > srcRect.h then begin Width := srcRect.w; Height := srcRect.w; @@ -2326,7 +2337,7 @@ begin begin Width := srcRect.h; Height := srcRect.h; - end; + end; } maxx := DstSurface.w; maxy := DstSurface.h; @@ -2384,8 +2395,8 @@ end; function ValidateSurfaceRect( DstSurface : PSDL_Surface; dstrect : PSDL_Rect ) : TSDL_Rect; var - RealRect : TSDL_Rect; - OutOfRange : Boolean; + RealRect : TSDL_Rect; + OutOfRange : Boolean; begin OutOfRange := false; if dstrect = nil then @@ -2457,9 +2468,9 @@ end; procedure SDL_FillRectAdd( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); var - RealRect : TSDL_Rect; - Addr : pointer; - ModX, BPP : cardinal; + RealRect : TSDL_Rect; + Addr : pointer; + ModX, BPP : cardinal; x, y, R, G, B, SrcColor : cardinal; begin RealRect := ValidateSurfaceRect( DstSurface, DstRect ); @@ -2590,9 +2601,9 @@ end; procedure SDL_FillRectSub( DstSurface : PSDL_Surface; dstrect : PSDL_Rect; color : UInt32 ); var - RealRect : TSDL_Rect; - Addr : pointer; - ModX, BPP : cardinal; + RealRect : TSDL_Rect; + Addr : pointer; + ModX, BPP : cardinal; x, y, R, G, B, SrcColor : cardinal; begin RealRect := ValidateSurfaceRect( DstSurface, DstRect ); @@ -2723,13 +2734,13 @@ end; procedure SDL_GradientFillRect( DstSurface : PSDL_Surface; const Rect : PSDL_Rect; const StartColor, EndColor : TSDL_Color; const Style : TGradientStyle ); var - FBC : array[ 0..255 ] of Cardinal; + FBC : array[ 0..255 ] of Cardinal; // temp vars i, YR, YG, YB, SR, SG, SB, DR, DG, DB : Integer; TempStepV, TempStepH : Single; TempLeft, TempTop, TempHeight, TempWidth : integer; - TempRect : TSDL_Rect; + TempRect : TSDL_Rect; begin // calc FBC @@ -2787,328 +2798,328 @@ begin end; end; -procedure SDL_2xBlit(Src, Dest: PSDL_Surface); +procedure SDL_2xBlit( Src, Dest : PSDL_Surface ); var - ReadAddr, WriteAddr, ReadRow, WriteRow: UInt32; - SrcPitch, DestPitch, x, y: UInt32; + ReadAddr, WriteAddr, ReadRow, WriteRow : UInt32; + SrcPitch, DestPitch, x, y : UInt32; begin - if (Src = nil) or (Dest = nil) then + if ( Src = nil ) or ( Dest = nil ) then exit; - if (Src.w shl 1) < Dest.w then + if ( Src.w shl 1 ) < Dest.w then exit; - if (Src.h shl 1) < Dest.h then + if ( Src.h shl 1 ) < Dest.h then exit; - if SDL_MustLock(Src) then - SDL_LockSurface(Src); - if SDL_MustLock(Dest) then - SDL_LockSurface(Dest); + if SDL_MustLock( Src ) then + SDL_LockSurface( Src ); + if SDL_MustLock( Dest ) then + SDL_LockSurface( Dest ); - ReadRow := UInt32(Src.Pixels); - WriteRow := UInt32(Dest.Pixels); + ReadRow := UInt32( Src.Pixels ); + WriteRow := UInt32( Dest.Pixels ); SrcPitch := Src.pitch; DestPitch := Dest.pitch; case Src.format.BytesPerPixel of - 1: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - PUInt8(WriteAddr)^ := PUInt8(ReadAddr)^; - PUInt8(WriteAddr + 1)^ := PUInt8(ReadAddr)^; - PUInt8(WriteAddr + DestPitch)^ := PUInt8(ReadAddr)^; - PUInt8(WriteAddr + DestPitch + 1)^ := PUInt8(ReadAddr)^; - inc(ReadAddr); - inc(WriteAddr, 2); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; - 2: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - PUInt16(WriteAddr)^ := PUInt16(ReadAddr)^; - PUInt16(WriteAddr + 2)^ := PUInt16(ReadAddr)^; - PUInt16(WriteAddr + DestPitch)^ := PUInt16(ReadAddr)^; - PUInt16(WriteAddr + DestPitch + 2)^ := PUInt16(ReadAddr)^; - inc(ReadAddr, 2); - inc(WriteAddr, 4); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; - 3: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - PUInt32(WriteAddr)^ := (PUInt32(WriteAddr)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - PUInt32(WriteAddr + 3)^ := (PUInt32(WriteAddr + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - PUInt32(WriteAddr + DestPitch)^ := (PUInt32(WriteAddr + DestPitch)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - PUInt32(WriteAddr + DestPitch + 3)^ := (PUInt32(WriteAddr + DestPitch + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - inc(ReadAddr, 3); - inc(WriteAddr, 6); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; - 4: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - PUInt32(WriteAddr)^ := PUInt32(ReadAddr)^; - PUInt32(WriteAddr + 4)^ := PUInt32(ReadAddr)^; - PUInt32(WriteAddr + DestPitch)^ := PUInt32(ReadAddr)^; - PUInt32(WriteAddr + DestPitch + 4)^ := PUInt32(ReadAddr)^; - inc(ReadAddr, 4); - inc(WriteAddr, 8); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; + 1 : for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt8( WriteAddr )^ := PUInt8( ReadAddr )^; + PUInt8( WriteAddr + 1 )^ := PUInt8( ReadAddr )^; + PUInt8( WriteAddr + DestPitch )^ := PUInt8( ReadAddr )^; + PUInt8( WriteAddr + DestPitch + 1 )^ := PUInt8( ReadAddr )^; + inc( ReadAddr ); + inc( WriteAddr, 2 ); + end; + inc( UInt32( ReadRow ), SrcPitch ); + inc( UInt32( WriteRow ), DestPitch * 2 ); + end; + 2 : for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt16( WriteAddr )^ := PUInt16( ReadAddr )^; + PUInt16( WriteAddr + 2 )^ := PUInt16( ReadAddr )^; + PUInt16( WriteAddr + DestPitch )^ := PUInt16( ReadAddr )^; + PUInt16( WriteAddr + DestPitch + 2 )^ := PUInt16( ReadAddr )^; + inc( ReadAddr, 2 ); + inc( WriteAddr, 4 ); + end; + inc( UInt32( ReadRow ), SrcPitch ); + inc( UInt32( WriteRow ), DestPitch * 2 ); + end; + 3 : for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt32( WriteAddr )^ := ( PUInt32( WriteAddr )^ and $FF000000 ) or ( PUInt32( ReadAddr )^ and $00FFFFFF ); + PUInt32( WriteAddr + 3 )^ := ( PUInt32( WriteAddr + 3 )^ and $FF000000 ) or ( PUInt32( ReadAddr )^ and $00FFFFFF ); + PUInt32( WriteAddr + DestPitch )^ := ( PUInt32( WriteAddr + DestPitch )^ and $FF000000 ) or ( PUInt32( ReadAddr )^ and $00FFFFFF ); + PUInt32( WriteAddr + DestPitch + 3 )^ := ( PUInt32( WriteAddr + DestPitch + 3 )^ and $FF000000 ) or ( PUInt32( ReadAddr )^ and $00FFFFFF ); + inc( ReadAddr, 3 ); + inc( WriteAddr, 6 ); + end; + inc( UInt32( ReadRow ), SrcPitch ); + inc( UInt32( WriteRow ), DestPitch * 2 ); + end; + 4 : for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt32( WriteAddr )^ := PUInt32( ReadAddr )^; + PUInt32( WriteAddr + 4 )^ := PUInt32( ReadAddr )^; + PUInt32( WriteAddr + DestPitch )^ := PUInt32( ReadAddr )^; + PUInt32( WriteAddr + DestPitch + 4 )^ := PUInt32( ReadAddr )^; + inc( ReadAddr, 4 ); + inc( WriteAddr, 8 ); + end; + inc( UInt32( ReadRow ), SrcPitch ); + inc( UInt32( WriteRow ), DestPitch * 2 ); + end; end; - if SDL_MustLock(Src) then - SDL_UnlockSurface(Src); - if SDL_MustLock(Dest) then - SDL_UnlockSurface(Dest); + if SDL_MustLock( Src ) then + SDL_UnlockSurface( Src ); + if SDL_MustLock( Dest ) then + SDL_UnlockSurface( Dest ); end; -procedure SDL_Scanline2xBlit(Src, Dest: PSDL_Surface); +procedure SDL_Scanline2xBlit( Src, Dest : PSDL_Surface ); var - ReadAddr, WriteAddr, ReadRow, WriteRow: UInt32; - SrcPitch, DestPitch, x, y: UInt32; + ReadAddr, WriteAddr, ReadRow, WriteRow : UInt32; + SrcPitch, DestPitch, x, y : UInt32; begin - if (Src = nil) or (Dest = nil) then + if ( Src = nil ) or ( Dest = nil ) then exit; - if (Src.w shl 1) < Dest.w then + if ( Src.w shl 1 ) < Dest.w then exit; - if (Src.h shl 1) < Dest.h then + if ( Src.h shl 1 ) < Dest.h then exit; - if SDL_MustLock(Src) then - SDL_LockSurface(Src); - if SDL_MustLock(Dest) then - SDL_LockSurface(Dest); + if SDL_MustLock( Src ) then + SDL_LockSurface( Src ); + if SDL_MustLock( Dest ) then + SDL_LockSurface( Dest ); - ReadRow := UInt32(Src.Pixels); - WriteRow := UInt32(Dest.Pixels); + ReadRow := UInt32( Src.Pixels ); + WriteRow := UInt32( Dest.Pixels ); SrcPitch := Src.pitch; DestPitch := Dest.pitch; case Src.format.BytesPerPixel of - 1: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - PUInt8(WriteAddr)^ := PUInt8(ReadAddr)^; - PUInt8(WriteAddr + 1)^ := PUInt8(ReadAddr)^; - inc(ReadAddr); - inc(WriteAddr, 2); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; - 2: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - PUInt16(WriteAddr)^ := PUInt16(ReadAddr)^; - PUInt16(WriteAddr + 2)^ := PUInt16(ReadAddr)^; - inc(ReadAddr, 2); - inc(WriteAddr, 4); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; - 3: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - PUInt32(WriteAddr)^ := (PUInt32(WriteAddr)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - PUInt32(WriteAddr + 3)^ := (PUInt32(WriteAddr + 3)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - inc(ReadAddr, 3); - inc(WriteAddr, 6); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; - 4: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - PUInt32(WriteAddr)^ := PUInt32(ReadAddr)^; - PUInt32(WriteAddr + 4)^ := PUInt32(ReadAddr)^; - inc(ReadAddr, 4); - inc(WriteAddr, 8); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; + 1 : for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt8( WriteAddr )^ := PUInt8( ReadAddr )^; + PUInt8( WriteAddr + 1 )^ := PUInt8( ReadAddr )^; + inc( ReadAddr ); + inc( WriteAddr, 2 ); + end; + inc( UInt32( ReadRow ), SrcPitch ); + inc( UInt32( WriteRow ), DestPitch * 2 ); + end; + 2 : for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt16( WriteAddr )^ := PUInt16( ReadAddr )^; + PUInt16( WriteAddr + 2 )^ := PUInt16( ReadAddr )^; + inc( ReadAddr, 2 ); + inc( WriteAddr, 4 ); + end; + inc( UInt32( ReadRow ), SrcPitch ); + inc( UInt32( WriteRow ), DestPitch * 2 ); + end; + 3 : for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt32( WriteAddr )^ := ( PUInt32( WriteAddr )^ and $FF000000 ) or ( PUInt32( ReadAddr )^ and $00FFFFFF ); + PUInt32( WriteAddr + 3 )^ := ( PUInt32( WriteAddr + 3 )^ and $FF000000 ) or ( PUInt32( ReadAddr )^ and $00FFFFFF ); + inc( ReadAddr, 3 ); + inc( WriteAddr, 6 ); + end; + inc( UInt32( ReadRow ), SrcPitch ); + inc( UInt32( WriteRow ), DestPitch * 2 ); + end; + 4 : for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + PUInt32( WriteAddr )^ := PUInt32( ReadAddr )^; + PUInt32( WriteAddr + 4 )^ := PUInt32( ReadAddr )^; + inc( ReadAddr, 4 ); + inc( WriteAddr, 8 ); + end; + inc( UInt32( ReadRow ), SrcPitch ); + inc( UInt32( WriteRow ), DestPitch * 2 ); + end; end; - if SDL_MustLock(Src) then - SDL_UnlockSurface(Src); - if SDL_MustLock(Dest) then - SDL_UnlockSurface(Dest); + if SDL_MustLock( Src ) then + SDL_UnlockSurface( Src ); + if SDL_MustLock( Dest ) then + SDL_UnlockSurface( Dest ); end; -procedure SDL_50Scanline2xBlit(Src, Dest: PSDL_Surface); +procedure SDL_50Scanline2xBlit( Src, Dest : PSDL_Surface ); var - ReadAddr, WriteAddr, ReadRow, WriteRow: UInt32; - SrcPitch, DestPitch, x, y, Color: UInt32; + ReadAddr, WriteAddr, ReadRow, WriteRow : UInt32; + SrcPitch, DestPitch, x, y, Color : UInt32; begin - if (Src = nil) or (Dest = nil) then + if ( Src = nil ) or ( Dest = nil ) then exit; - if (Src.w shl 1) < Dest.w then + if ( Src.w shl 1 ) < Dest.w then exit; - if (Src.h shl 1) < Dest.h then + if ( Src.h shl 1 ) < Dest.h then exit; - if SDL_MustLock(Src) then - SDL_LockSurface(Src); - if SDL_MustLock(Dest) then - SDL_LockSurface(Dest); + if SDL_MustLock( Src ) then + SDL_LockSurface( Src ); + if SDL_MustLock( Dest ) then + SDL_LockSurface( Dest ); - ReadRow := UInt32(Src.Pixels); - WriteRow := UInt32(Dest.Pixels); + ReadRow := UInt32( Src.Pixels ); + WriteRow := UInt32( Dest.Pixels ); SrcPitch := Src.pitch; DestPitch := Dest.pitch; case Src.format.BitsPerPixel of - 8: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - Color := PUInt8(ReadAddr)^; - PUInt8(WriteAddr)^ := Color; - PUInt8(WriteAddr + 1)^ := Color; - Color := (Color shr 1) and $6d; {%01101101} - PUInt8(WriteAddr + DestPitch)^ := Color; - PUInt8(WriteAddr + DestPitch + 1)^ := Color; - inc(ReadAddr); - inc(WriteAddr, 2); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; - 15: for y := 1 to Src.h do + 8 : for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - Color := PUInt16(ReadAddr)^; - PUInt16(WriteAddr)^ := Color; - PUInt16(WriteAddr + 2)^ := Color; - Color := (Color shr 1) and $3def; {%0011110111101111} - PUInt16(WriteAddr + DestPitch)^ := Color; - PUInt16(WriteAddr + DestPitch + 2)^ := Color; - inc(ReadAddr, 2); - inc(WriteAddr, 4); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); + Color := PUInt8( ReadAddr )^; + PUInt8( WriteAddr )^ := Color; + PUInt8( WriteAddr + 1 )^ := Color; + Color := ( Color shr 1 ) and $6D; {%01101101} + PUInt8( WriteAddr + DestPitch )^ := Color; + PUInt8( WriteAddr + DestPitch + 1 )^ := Color; + inc( ReadAddr ); + inc( WriteAddr, 2 ); end; - 16: for y := 1 to Src.h do + inc( UInt32( ReadRow ), SrcPitch ); + inc( UInt32( WriteRow ), DestPitch * 2 ); + end; + 15 : for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - Color := PUInt16(ReadAddr)^; - PUInt16(WriteAddr)^ := Color; - PUInt16(WriteAddr + 2)^ := Color; - Color := (Color shr 1) and $7bef; {%0111101111101111} - PUInt16(WriteAddr + DestPitch)^ := Color; - PUInt16(WriteAddr + DestPitch + 2)^ := Color; - inc(ReadAddr, 2); - inc(WriteAddr, 4); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); + Color := PUInt16( ReadAddr )^; + PUInt16( WriteAddr )^ := Color; + PUInt16( WriteAddr + 2 )^ := Color; + Color := ( Color shr 1 ) and $3DEF; {%0011110111101111} + PUInt16( WriteAddr + DestPitch )^ := Color; + PUInt16( WriteAddr + DestPitch + 2 )^ := Color; + inc( ReadAddr, 2 ); + inc( WriteAddr, 4 ); + end; + inc( UInt32( ReadRow ), SrcPitch ); + inc( UInt32( WriteRow ), DestPitch * 2 ); + end; + 16 : for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + Color := PUInt16( ReadAddr )^; + PUInt16( WriteAddr )^ := Color; + PUInt16( WriteAddr + 2 )^ := Color; + Color := ( Color shr 1 ) and $7BEF; {%0111101111101111} + PUInt16( WriteAddr + DestPitch )^ := Color; + PUInt16( WriteAddr + DestPitch + 2 )^ := Color; + inc( ReadAddr, 2 ); + inc( WriteAddr, 4 ); end; - 24: for y := 1 to Src.h do + inc( UInt32( ReadRow ), SrcPitch ); + inc( UInt32( WriteRow ), DestPitch * 2 ); + end; + 24 : for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - Color := (PUInt32(WriteAddr)^ and $ff000000) or (PUInt32(ReadAddr)^ and $00ffffff); - PUInt32(WriteAddr)^ := Color; - PUInt32(WriteAddr + 3)^ := Color; - Color := (Color shr 1) and $007f7f7f; {%011111110111111101111111} - PUInt32(WriteAddr + DestPitch)^ := Color; - PUInt32(WriteAddr + DestPitch + 3)^ := Color; - inc(ReadAddr, 3); - inc(WriteAddr, 6); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); + Color := ( PUInt32( WriteAddr )^ and $FF000000 ) or ( PUInt32( ReadAddr )^ and $00FFFFFF ); + PUInt32( WriteAddr )^ := Color; + PUInt32( WriteAddr + 3 )^ := Color; + Color := ( Color shr 1 ) and $007F7F7F; {%011111110111111101111111} + PUInt32( WriteAddr + DestPitch )^ := Color; + PUInt32( WriteAddr + DestPitch + 3 )^ := Color; + inc( ReadAddr, 3 ); + inc( WriteAddr, 6 ); end; - 32: for y := 1 to Src.h do - begin - ReadAddr := ReadRow; - WriteAddr := WriteRow; - for x := 1 to Src.w do - begin - Color := PUInt32(ReadAddr)^; - PUInt32(WriteAddr)^ := Color; - PUInt32(WriteAddr + 4)^ := Color; - Color := (Color shr 1) and $7f7f7f7f; - PUInt32(WriteAddr + DestPitch)^ := Color; - PUInt32(WriteAddr + DestPitch + 4)^ := Color; - inc(ReadAddr, 4); - inc(WriteAddr, 8); - end; - inc(UInt32(ReadRow), SrcPitch); - inc(UInt32(WriteRow), DestPitch * 2); - end; + inc( UInt32( ReadRow ), SrcPitch ); + inc( UInt32( WriteRow ), DestPitch * 2 ); + end; + 32 : for y := 1 to Src.h do + begin + ReadAddr := ReadRow; + WriteAddr := WriteRow; + for x := 1 to Src.w do + begin + Color := PUInt32( ReadAddr )^; + PUInt32( WriteAddr )^ := Color; + PUInt32( WriteAddr + 4 )^ := Color; + Color := ( Color shr 1 ) and $7F7F7F7F; + PUInt32( WriteAddr + DestPitch )^ := Color; + PUInt32( WriteAddr + DestPitch + 4 )^ := Color; + inc( ReadAddr, 4 ); + inc( WriteAddr, 8 ); + end; + inc( UInt32( ReadRow ), SrcPitch ); + inc( UInt32( WriteRow ), DestPitch * 2 ); + end; end; - if SDL_MustLock(Src) then - SDL_UnlockSurface(Src); - if SDL_MustLock(Dest) then - SDL_UnlockSurface(Dest); + if SDL_MustLock( Src ) then + SDL_UnlockSurface( Src ); + if SDL_MustLock( Dest ) then + SDL_UnlockSurface( Dest ); end; function SDL_PixelTestSurfaceVsRect( SrcSurface1 : PSDL_Surface; SrcRect1 : -PSDL_Rect; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : -boolean; + PSDL_Rect; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : + boolean; var Src_Rect1, Src_Rect2 : TSDL_Rect; right1, bottom1 : integer; right2, bottom2 : integer; - Scan1Start, Scan2Start, ScanWidth, ScanHeight : cardinal; - Mod1: cardinal; - Addr1 : cardinal; - BPP : cardinal; - Pitch1 : cardinal; + Scan1Start, {Scan2Start,} ScanWidth, ScanHeight : cardinal; + Mod1 : cardinal; + Addr1 : cardinal; + BPP : cardinal; + Pitch1 : cardinal; TransparentColor1 : cardinal; - tx, ty : cardinal; - StartTick : cardinal; - Color1 : cardinal; + tx, ty : cardinal; + StartTick : cardinal; + Color1 : cardinal; begin Result := false; if SrcRect1 = nil then @@ -3124,7 +3135,7 @@ begin else Src_Rect1 := SrcRect1^; - Src_Rect2 := SrcRect2^; + Src_Rect2 := SrcRect2^; with Src_Rect1 do begin Right1 := Left1 + w; @@ -3135,15 +3146,13 @@ begin Right2 := Left2 + w; Bottom2 := Top2 + h; end; - if ( Left1 >= Right2 ) or ( Right1 <= Left2 ) or ( Top1 >= Bottom2 ) or ( -Bottom1 <= - Top2 ) then + if ( Left1 >= Right2 ) or ( Right1 <= Left2 ) or ( Top1 >= Bottom2 ) or ( Bottom1 <= Top2 ) then exit; if Left1 <= Left2 then begin // 1. left, 2. right Scan1Start := Src_Rect1.x + Left2 - Left1; - Scan2Start := Src_Rect2.x; + //Scan2Start := Src_Rect2.x; ScanWidth := Right1 - Left2; with Src_Rect2 do if ScanWidth > w then @@ -3153,7 +3162,7 @@ Bottom1 <= begin // 1. right, 2. left Scan1Start := Src_Rect1.x; - Scan2Start := Src_Rect2.x + Left1 - Left2; + //Scan2Start := Src_Rect2.x + Left1 - Left2; ScanWidth := Right2 - Left1; with Src_Rect1 do if ScanWidth > w then @@ -3213,7 +3222,7 @@ Bottom1 <= begin for tx := 1 to ScanWidth do begin - if ( PWord( Addr1 )^ <> TransparentColor1 ) then + if ( PWord( Addr1 )^ <> TransparentColor1 ) then begin Result := true; exit; @@ -3248,7 +3257,7 @@ Bottom1 <= begin for tx := 1 to ScanWidth do begin - if ( PLongWord( Addr1 )^ <> TransparentColor1 ) then + if ( PLongWord( Addr1 )^ <> TransparentColor1 ) then begin Result := true; exit; @@ -3266,12 +3275,12 @@ procedure SDL_ORSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); var R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; - Src, Dest : TSDL_Rect; - Diff : integer; + Src, Dest : TSDL_Rect; + Diff : integer; SrcAddr, DestAddr : cardinal; WorkX, WorkY : word; SrcMod, DestMod : cardinal; - Bits : cardinal; + Bits : cardinal; begin if ( SrcSurface = nil ) or ( DestSurface = nil ) then exit; // Remove this to make it faster @@ -3366,7 +3375,7 @@ begin if ( Pixel1 <> TransparentColor ) and ( Pixel1 <> 0 ) then begin Pixel2 := PUInt8( DestAddr )^; - PUInt8( DestAddr )^ := Pixel2 OR Pixel1; + PUInt8( DestAddr )^ := Pixel2 or Pixel1; end; inc( SrcAddr ); inc( DestAddr ); @@ -3387,7 +3396,7 @@ begin begin Pixel2 := PUInt16( DestAddr )^; - PUInt16( DestAddr )^ := Pixel2 OR Pixel1; + PUInt16( DestAddr )^ := Pixel2 or Pixel1; end; inc( SrcAddr, 2 ); @@ -3409,7 +3418,7 @@ begin begin Pixel2 := PUInt16( DestAddr )^; - PUInt16( DestAddr )^ := Pixel2 OR Pixel1; + PUInt16( DestAddr )^ := Pixel2 or Pixel1; end; inc( SrcAddr, 2 ); @@ -3452,7 +3461,7 @@ begin begin Pixel2 := PUInt32( DestAddr )^; - PUInt32( DestAddr )^ := Pixel2 or Pixel1; + PUInt32( DestAddr )^ := Pixel2 or Pixel1; end; inc( SrcAddr, 4 ); inc( DestAddr, 4 ); @@ -3472,12 +3481,12 @@ procedure SDL_ANDSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); var R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; - Src, Dest : TSDL_Rect; - Diff : integer; + Src, Dest : TSDL_Rect; + Diff : integer; SrcAddr, DestAddr : cardinal; WorkX, WorkY : word; SrcMod, DestMod : cardinal; - Bits : cardinal; + Bits : cardinal; begin if ( SrcSurface = nil ) or ( DestSurface = nil ) then exit; // Remove this to make it faster @@ -3615,7 +3624,7 @@ begin begin Pixel2 := PUInt16( DestAddr )^; - PUInt16( DestAddr )^ := Pixel2 and Pixel1; + PUInt16( DestAddr )^ := Pixel2 and Pixel1; end; inc( SrcAddr, 2 ); @@ -3658,7 +3667,7 @@ begin begin Pixel2 := PUInt32( DestAddr )^; - PUInt32( DestAddr )^ := Pixel2 and Pixel1; + PUInt32( DestAddr )^ := Pixel2 and Pixel1; end; inc( SrcAddr, 4 ); inc( DestAddr, 4 ); @@ -3680,12 +3689,12 @@ procedure SDL_GTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); var R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; - Src, Dest : TSDL_Rect; - Diff : integer; + Src, Dest : TSDL_Rect; + Diff : integer; SrcAddr, DestAddr : cardinal; WorkX, WorkY : word; SrcMod, DestMod : cardinal; - Bits : cardinal; + Bits : cardinal; begin if ( SrcSurface = nil ) or ( DestSurface = nil ) then exit; // Remove this to make it faster @@ -3782,9 +3791,18 @@ begin Pixel2 := PUInt8( DestAddr )^; if Pixel2 > 0 then begin - if Pixel2 and $E0 > Pixel1 and $E0 then R := Pixel2 and $E0 else R := Pixel1 and $E0; - if Pixel2 and $1C > Pixel1 and $1C then G := Pixel2 and $1C else G := Pixel1 and $1C; - if Pixel2 and $03 > Pixel1 and $03 then B := Pixel2 and $03 else B := Pixel1 and $03; + if Pixel2 and $E0 > Pixel1 and $E0 then + R := Pixel2 and $E0 + else + R := Pixel1 and $E0; + if Pixel2 and $1C > Pixel1 and $1C then + G := Pixel2 and $1C + else + G := Pixel1 and $1C; + if Pixel2 and $03 > Pixel1 and $03 then + B := Pixel2 and $03 + else + B := Pixel1 and $03; if R > $E0 then R := $E0; @@ -3818,9 +3836,18 @@ begin if Pixel2 > 0 then begin - if Pixel2 and $7C00 > Pixel1 and $7C00 then R := Pixel2 and $7C00 else R := Pixel1 and $7C00; - if Pixel2 and $03E0 > Pixel1 and $03E0 then G := Pixel2 and $03E0 else G := Pixel1 and $03E0; - if Pixel2 and $001F > Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; + if Pixel2 and $7C00 > Pixel1 and $7C00 then + R := Pixel2 and $7C00 + else + R := Pixel1 and $7C00; + if Pixel2 and $03E0 > Pixel1 and $03E0 then + G := Pixel2 and $03E0 + else + G := Pixel1 and $03E0; + if Pixel2 and $001F > Pixel1 and $001F then + B := Pixel2 and $001F + else + B := Pixel1 and $001F; PUInt16( DestAddr )^ := R or G or B; end @@ -3848,9 +3875,18 @@ begin if Pixel2 > 0 then begin - if Pixel2 and $F800 > Pixel1 and $F800 then R := Pixel2 and $F800 else R := Pixel1 and $F800; - if Pixel2 and $07E0 > Pixel1 and $07E0 then G := Pixel2 and $07E0 else G := Pixel1 and $07E0; - if Pixel2 and $001F > Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; + if Pixel2 and $F800 > Pixel1 and $F800 then + R := Pixel2 and $F800 + else + R := Pixel1 and $F800; + if Pixel2 and $07E0 > Pixel1 and $07E0 then + G := Pixel2 and $07E0 + else + G := Pixel1 and $07E0; + if Pixel2 and $001F > Pixel1 and $001F then + B := Pixel2 and $001F + else + B := Pixel1 and $001F; PUInt16( DestAddr )^ := R or G or B; end @@ -3878,9 +3914,18 @@ begin if Pixel2 > 0 then begin - if Pixel2 and $FF0000 > Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; - if Pixel2 and $00FF00 > Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; - if Pixel2 and $0000FF > Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; + if Pixel2 and $FF0000 > Pixel1 and $FF0000 then + R := Pixel2 and $FF0000 + else + R := Pixel1 and $FF0000; + if Pixel2 and $00FF00 > Pixel1 and $00FF00 then + G := Pixel2 and $00FF00 + else + G := Pixel1 and $00FF00; + if Pixel2 and $0000FF > Pixel1 and $0000FF then + B := Pixel2 and $0000FF + else + B := Pixel1 and $0000FF; PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or ( R or G or B ); end @@ -3908,9 +3953,18 @@ begin if Pixel2 > 0 then begin - if Pixel2 and $FF0000 > Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; - if Pixel2 and $00FF00 > Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; - if Pixel2 and $0000FF > Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; + if Pixel2 and $FF0000 > Pixel1 and $FF0000 then + R := Pixel2 and $FF0000 + else + R := Pixel1 and $FF0000; + if Pixel2 and $00FF00 > Pixel1 and $00FF00 then + G := Pixel2 and $00FF00 + else + G := Pixel1 and $00FF00; + if Pixel2 and $0000FF > Pixel1 and $0000FF then + B := Pixel2 and $0000FF + else + B := Pixel1 and $0000FF; PUInt32( DestAddr )^ := R or G or B; end @@ -3936,12 +3990,12 @@ procedure SDL_LTSurface( SrcSurface : PSDL_Surface; SrcRect : PSDL_Rect; DestSurface : PSDL_Surface; DestRect : PSDL_Rect ); var R, G, B, Pixel1, Pixel2, TransparentColor : cardinal; - Src, Dest : TSDL_Rect; - Diff : integer; + Src, Dest : TSDL_Rect; + Diff : integer; SrcAddr, DestAddr : cardinal; WorkX, WorkY : word; SrcMod, DestMod : cardinal; - Bits : cardinal; + Bits : cardinal; begin if ( SrcSurface = nil ) or ( DestSurface = nil ) then exit; // Remove this to make it faster @@ -4038,9 +4092,18 @@ begin Pixel2 := PUInt8( DestAddr )^; if Pixel2 > 0 then begin - if Pixel2 and $E0 < Pixel1 and $E0 then R := Pixel2 and $E0 else R := Pixel1 and $E0; - if Pixel2 and $1C < Pixel1 and $1C then G := Pixel2 and $1C else G := Pixel1 and $1C; - if Pixel2 and $03 < Pixel1 and $03 then B := Pixel2 and $03 else B := Pixel1 and $03; + if Pixel2 and $E0 < Pixel1 and $E0 then + R := Pixel2 and $E0 + else + R := Pixel1 and $E0; + if Pixel2 and $1C < Pixel1 and $1C then + G := Pixel2 and $1C + else + G := Pixel1 and $1C; + if Pixel2 and $03 < Pixel1 and $03 then + B := Pixel2 and $03 + else + B := Pixel1 and $03; if R > $E0 then R := $E0; @@ -4074,9 +4137,18 @@ begin if Pixel2 > 0 then begin - if Pixel2 and $7C00 < Pixel1 and $7C00 then R := Pixel2 and $7C00 else R := Pixel1 and $7C00; - if Pixel2 and $03E0 < Pixel1 and $03E0 then G := Pixel2 and $03E0 else G := Pixel1 and $03E0; - if Pixel2 and $001F < Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; + if Pixel2 and $7C00 < Pixel1 and $7C00 then + R := Pixel2 and $7C00 + else + R := Pixel1 and $7C00; + if Pixel2 and $03E0 < Pixel1 and $03E0 then + G := Pixel2 and $03E0 + else + G := Pixel1 and $03E0; + if Pixel2 and $001F < Pixel1 and $001F then + B := Pixel2 and $001F + else + B := Pixel1 and $001F; PUInt16( DestAddr )^ := R or G or B; end @@ -4104,9 +4176,18 @@ begin if Pixel2 > 0 then begin - if Pixel2 and $F800 < Pixel1 and $F800 then R := Pixel2 and $F800 else R := Pixel1 and $F800; - if Pixel2 and $07E0 < Pixel1 and $07E0 then G := Pixel2 and $07E0 else G := Pixel1 and $07E0; - if Pixel2 and $001F < Pixel1 and $001F then B := Pixel2 and $001F else B := Pixel1 and $001F; + if Pixel2 and $F800 < Pixel1 and $F800 then + R := Pixel2 and $F800 + else + R := Pixel1 and $F800; + if Pixel2 and $07E0 < Pixel1 and $07E0 then + G := Pixel2 and $07E0 + else + G := Pixel1 and $07E0; + if Pixel2 and $001F < Pixel1 and $001F then + B := Pixel2 and $001F + else + B := Pixel1 and $001F; PUInt16( DestAddr )^ := R or G or B; end @@ -4134,9 +4215,18 @@ begin if Pixel2 > 0 then begin - if Pixel2 and $FF0000 < Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; - if Pixel2 and $00FF00 < Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; - if Pixel2 and $0000FF < Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; + if Pixel2 and $FF0000 < Pixel1 and $FF0000 then + R := Pixel2 and $FF0000 + else + R := Pixel1 and $FF0000; + if Pixel2 and $00FF00 < Pixel1 and $00FF00 then + G := Pixel2 and $00FF00 + else + G := Pixel1 and $00FF00; + if Pixel2 and $0000FF < Pixel1 and $0000FF then + B := Pixel2 and $0000FF + else + B := Pixel1 and $0000FF; PUInt32( DestAddr )^ := PUInt32( DestAddr )^ and $FF000000 or ( R or G or B ); end @@ -4164,9 +4254,18 @@ begin if Pixel2 > 0 then begin - if Pixel2 and $FF0000 < Pixel1 and $FF0000 then R := Pixel2 and $FF0000 else R := Pixel1 and $FF0000; - if Pixel2 and $00FF00 < Pixel1 and $00FF00 then G := Pixel2 and $00FF00 else G := Pixel1 and $00FF00; - if Pixel2 and $0000FF < Pixel1 and $0000FF then B := Pixel2 and $0000FF else B := Pixel1 and $0000FF; + if Pixel2 and $FF0000 < Pixel1 and $FF0000 then + R := Pixel2 and $FF0000 + else + R := Pixel1 and $FF0000; + if Pixel2 and $00FF00 < Pixel1 and $00FF00 then + G := Pixel2 and $00FF00 + else + G := Pixel1 and $00FF00; + if Pixel2 and $0000FF < Pixel1 and $0000FF then + B := Pixel2 and $0000FF + else + B := Pixel1 and $0000FF; PUInt32( DestAddr )^ := R or G or B; end @@ -4188,69 +4287,75 @@ begin end; // Will clip the x1,x2,y1,x2 params to the ClipRect provided -function SDL_ClipLine(var x1,y1,x2,y2: Integer; ClipRect: PSDL_Rect) : boolean; - var tflag, flag1, flag2: word; - txy, xedge, yedge: Integer; - slope: single; - function ClipCode(x,y: Integer): word; +function SDL_ClipLine( var x1, y1, x2, y2 : Integer; ClipRect : PSDL_Rect ) : boolean; +var + tflag, flag1, flag2 : word; + txy, xedge, yedge : Integer; + slope : single; + + function ClipCode( x, y : Integer ) : word; begin Result := 0; - if x < ClipRect.x then Result := 1; - if x >= ClipRect.w + ClipRect.x then Result := Result or 2; - if y < ClipRect.y then Result := Result or 4; - if y >= ClipRect.h + ClipRect.y then Result := Result or 8; + if x < ClipRect.x then + Result := 1; + if x >= ClipRect.w + ClipRect.x then + Result := Result or 2; + if y < ClipRect.y then + Result := Result or 4; + if y >= ClipRect.h + ClipRect.y then + Result := Result or 8; end; begin - flag1 := ClipCode(x1,y1); - flag2 := ClipCode(x2,y2); + flag1 := ClipCode( x1, y1 ); + flag2 := ClipCode( x2, y2 ); result := true; while true do begin - if (flag1 or flag2) = 0 then Exit; // all in + if ( flag1 or flag2 ) = 0 then + Exit; // all in - if (flag1 and flag2) <> 0 then - begin - result := false; - Exit; // all out - end; + if ( flag1 and flag2 ) <> 0 then + begin + result := false; + Exit; // all out + end; if flag2 = 0 then - begin - txy := x1; x1 := x2; x2 := txy; - txy := y1; y1 := y2; y2 := txy; - tflag := flag1; flag1 := flag2; flag2 := tflag; - end; + begin + txy := x1; x1 := x2; x2 := txy; + txy := y1; y1 := y2; y2 := txy; + tflag := flag1; flag1 := flag2; flag2 := tflag; + end; - if (flag2 and 3) <> 0 then - begin - if (flag2 and 1) <> 0 then - xedge := ClipRect.x - else - xedge := ClipRect.w + ClipRect.x -1; // back 1 pixel otherwise we end up in a loop - - slope := (y2 - y1) / (x2 - x1); - y2 := y1 + Round(slope * (xedge - x1)); - x2 := xedge; - end + if ( flag2 and 3 ) <> 0 then + begin + if ( flag2 and 1 ) <> 0 then + xedge := ClipRect.x + else + xedge := ClipRect.w + ClipRect.x - 1; // back 1 pixel otherwise we end up in a loop + + slope := ( y2 - y1 ) / ( x2 - x1 ); + y2 := y1 + Round( slope * ( xedge - x1 ) ); + x2 := xedge; + end else - begin - if (flag2 and 4) <> 0 then - yedge := ClipRect.y - else - yedge := ClipRect.h + ClipRect.y -1; // up 1 pixel otherwise we end up in a loop - - slope := (x2 - x1) / (y2 - y1); - x2 := x1 + Round(slope * (yedge - y1)); - y2 := yedge; - end; + begin + if ( flag2 and 4 ) <> 0 then + yedge := ClipRect.y + else + yedge := ClipRect.h + ClipRect.y - 1; // up 1 pixel otherwise we end up in a loop - flag2 := ClipCode(x2, y2); + slope := ( x2 - x1 ) / ( y2 - y1 ); + x2 := x1 + Round( slope * ( yedge - y1 ) ); + y2 := yedge; + end; + + flag2 := ClipCode( x2, y2 ); end; end; end. - diff --git a/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlwindow.pas b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlwindow.pas index ef290071..ba60714b 100644 --- a/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlwindow.pas +++ b/Game/Code/lib/JEDI-SDL/SDL/Pas/sdlwindow.pas @@ -1,6 +1,6 @@ unit sdlwindow; { - $Id: sdlwindow.pas,v 1.7 2004/09/30 22:35:47 savage Exp $ + $Id: sdlwindow.pas,v 1.9 2006/10/22 18:55:25 savage Exp $ } {******************************************************************************} @@ -59,6 +59,12 @@ unit sdlwindow; { } { $Log: sdlwindow.pas,v $ + Revision 1.9 2006/10/22 18:55:25 savage + Slight Change to handle OpenGL context + + Revision 1.8 2005/08/03 18:57:32 savage + Various updates and additions. Mainly to handle OpenGL 3D Window support and better cursor support for the mouse class + Revision 1.7 2004/09/30 22:35:47 savage Changes, enhancements and additions as required to get SoAoS working. @@ -171,15 +177,8 @@ type function Show : Boolean; virtual; end; - TSDL2DWindow = class( TSDLBaseWindow ) + TSDLCustomWindow = class( TSDLBaseWindow ) public - constructor Create( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 = SDL_DOUBLEBUF or SDL_SWSURFACE); override; - procedure Render; override; - procedure Update( aElapsedTime : single ); override; - procedure InitialiseObjects; override; - procedure RestoreObjects; override; - procedure DeleteObjects; override; - function Flip : integer; override; property OnCreate; property OnDestroy; property OnClose; @@ -190,7 +189,18 @@ type property DisplaySurface; end; - TSDL3DWindow = class( TSDLBaseWindow ) + TSDL2DWindow = class( TSDLCustomWindow ) + public + constructor Create( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 = SDL_DOUBLEBUF or SDL_SWSURFACE); override; + procedure Render; override; + procedure Update( aElapsedTime : single ); override; + procedure InitialiseObjects; override; + procedure RestoreObjects; override; + procedure DeleteObjects; override; + function Flip : integer; override; + end; + + TSDL3DWindow = class( TSDLCustomWindow ) public constructor Create( aWidth : integer; aHeight : integer; aBitDepth : integer; aVideoFlags : Uint32 = SDL_OPENGL or SDL_DOUBLEBUF); override; function Flip : integer; override; @@ -199,14 +209,6 @@ type procedure InitialiseObjects; override; procedure RestoreObjects; override; procedure DeleteObjects; override; - property OnCreate; - property OnDestroy; - property OnClose; - property OnShow; - property OnResize; - property OnRender; - property OnUpdate; - property DisplaySurface; end; @@ -226,7 +228,7 @@ begin Log.LogError( Format('Could not set video mode: %s', [SDL_GetError]), 'Main'); exit; end; - + SetCaption( 'Made with JEDI-SDL', 'JEDI-SDL Icon' ); end; @@ -552,7 +554,7 @@ end; procedure TSDL3DWindow.Render; begin inherited; - + end; procedure TSDL3DWindow.RestoreObjects; diff --git a/Game/Code/lib/JEDI-SDL/SDL_Image/Pas/sdl_image.pas b/Game/Code/lib/JEDI-SDL/SDL_Image/Pas/sdl_image.pas index fecc0dbc..d0699761 100644 --- a/Game/Code/lib/JEDI-SDL/SDL_Image/Pas/sdl_image.pas +++ b/Game/Code/lib/JEDI-SDL/SDL_Image/Pas/sdl_image.pas @@ -1,6 +1,6 @@ unit sdl_image; { - $Id: sdl_image.pas,v 1.7 2005/01/01 02:03:12 savage Exp $ + $Id: sdl_image.pas,v 1.15 2007/12/05 22:52:23 savage Exp $ } {******************************************************************************} @@ -83,6 +83,30 @@ unit sdl_image; { } { $Log: sdl_image.pas,v $ + Revision 1.15 2007/12/05 22:52:23 savage + Better Mac OS X support for Frameworks. + + Revision 1.14 2007/05/29 21:31:13 savage + Changes as suggested by Almindor for 64bit compatibility. + + Revision 1.13 2007/05/20 20:30:54 savage + Initial Changes to Handle 64 Bits + + Revision 1.12 2006/12/02 00:14:40 savage + Updated to latest version + + Revision 1.11 2005/04/10 18:22:59 savage + Changes as suggested by Michalis, thanks. + + Revision 1.10 2005/04/10 11:48:33 savage + Changes as suggested by Michalis, thanks. + + Revision 1.9 2005/01/05 01:47:07 savage + Changed LibName to reflect what MacOS X should have. ie libSDL*-1.2.0.dylib respectively. + + Revision 1.8 2005/01/04 23:14:44 savage + Changed LibName to reflect what most Linux distros will have. ie libSDL*-1.2.so.0 respectively. + Revision 1.7 2005/01/01 02:03:12 savage Updated to v1.2.4 @@ -110,8 +134,6 @@ unit sdl_image; {$I jedi-sdl.inc} -{$ALIGN ON} - interface uses @@ -121,20 +143,25 @@ uses sdl; const -{$IFDEF WIN32} +{$IFDEF WINDOWS} SDL_ImageLibName = 'SDL_Image.dll'; {$ENDIF} {$IFDEF UNIX} {$IFDEF DARWIN} - SDL_ImageLibName = 'libSDL_image.dylib'; + SDL_ImageLibName = 'libSDL_image-1.2.0.dylib'; {$ELSE} - SDL_ImageLibName = 'libSDL_image.so'; + {$IFDEF FPC} + SDL_ImageLibName = 'libSDL_image.so'; + {$ELSE} + SDL_ImageLibName = 'libSDL_image-1.2.so.0'; + {$ENDIF} {$ENDIF} {$ENDIF} {$IFDEF MACOS} SDL_ImageLibName = 'SDL_image'; + {$linklib libSDL_image} {$ENDIF} // Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL @@ -142,7 +169,7 @@ const {$EXTERNALSYM SDL_IMAGE_MAJOR_VERSION} SDL_IMAGE_MINOR_VERSION = 2; {$EXTERNALSYM SDL_IMAGE_MINOR_VERSION} - SDL_IMAGE_PATCHLEVEL = 4; + SDL_IMAGE_PATCHLEVEL = 6; {$EXTERNALSYM SDL_IMAGE_PATCHLEVEL} { This macro can be used to fill a version structure with the compile-time @@ -187,68 +214,103 @@ cdecl; external {$IFDEF __GPC__}name 'IMG_InvertAlpha'{$ELSE} SDL_ImageLibName{$ function IMG_isBMP(src: PSDL_RWops): Integer; cdecl; external {$IFDEF __GPC__}name 'IMG_isBMP'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; {$EXTERNALSYM IMG_isBMP} -function IMG_isPNM(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isPNM'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isPNM} -function IMG_isXPM(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isXPM'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isXPM} -function IMG_isXCF(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isXCF'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isXCF} -function IMG_isPCX(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isPCX'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isPCX} + function IMG_isGIF(src: PSDL_RWops): Integer; cdecl; external {$IFDEF __GPC__}name 'IMG_isGIF'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; {$EXTERNALSYM IMG_isGIF} + function IMG_isJPG(src: PSDL_RWops): Integer; cdecl; external {$IFDEF __GPC__}name 'IMG_isJPG'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; {$EXTERNALSYM IMG_isJPG} -function IMG_isTIF(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isTIF'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isTIF} -function IMG_isPNG(src: PSDL_RWops): Integer; -cdecl; external {$IFDEF __GPC__}name 'IMG_isPNG'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_isPNG} + function IMG_isLBM(src: PSDL_RWops): Integer; cdecl; external {$IFDEF __GPC__}name 'IMG_isLBM'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; {$EXTERNALSYM IMG_isLBM} +function IMG_isPCX(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isPCX'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isPCX} + +function IMG_isPNG(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isPNG'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isPNG} + +function IMG_isPNM(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isPNM'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isPNM} + +function IMG_isTIF(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isTIF'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isTIF} + +function IMG_isXCF(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isXCF'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isXCF} + +function IMG_isXPM(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isXPM'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isXPM} + +function IMG_isXV(src: PSDL_RWops): Integer; +cdecl; external {$IFDEF __GPC__}name 'IMG_isXV'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_isXV} + + { Individual loading functions } function IMG_LoadBMP_RW(src: PSDL_RWops): PSDL_Surface; cdecl; external {$IFDEF __GPC__}name 'IMG_LoadBMP_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; {$EXTERNALSYM IMG_LoadBMP_RW} -function IMG_LoadPNM_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadPNM_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadPNM_RW} -function IMG_LoadXPM_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadXPM_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadXPM_RW} -function IMG_LoadXCF_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadXCF_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadXCF_RW} -function IMG_LoadPCX_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadPCX_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadPCX_RW} + function IMG_LoadGIF_RW(src: PSDL_RWops): PSDL_Surface; cdecl; external {$IFDEF __GPC__}name 'IMG_LoadGIF_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; {$EXTERNALSYM IMG_LoadGIF_RW} + function IMG_LoadJPG_RW(src: PSDL_RWops): PSDL_Surface; cdecl; external {$IFDEF __GPC__}name 'IMG_LoadJPG_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; {$EXTERNALSYM IMG_LoadJPG_RW} -function IMG_LoadTIF_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadTIF_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadTIF_RW} + +function IMG_LoadLBM_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadLBM_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadLBM_RW} + +function IMG_LoadPCX_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadPCX_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadPCX_RW} + +function IMG_LoadPNM_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadPNM_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadPNM_RW} + function IMG_LoadPNG_RW(src: PSDL_RWops): PSDL_Surface; cdecl; external {$IFDEF __GPC__}name 'IMG_LoadPNG_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; {$EXTERNALSYM IMG_LoadPNG_RW} + function IMG_LoadTGA_RW(src: PSDL_RWops): PSDL_Surface; cdecl; external {$IFDEF __GPC__}name 'IMG_LoadTGA_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; {$EXTERNALSYM IMG_LoadTGA_RW} -function IMG_LoadLBM_RW(src: PSDL_RWops): PSDL_Surface; -cdecl; external {$IFDEF __GPC__}name 'IMG_LoadLBM_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; -{$EXTERNALSYM IMG_LoadLBM_RW} + +function IMG_LoadTIF_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadTIF_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadTIF_RW} + +function IMG_LoadXCF_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadXCF_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadXCF_RW} + +function IMG_LoadXPM_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadXPM_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadXPM_RW} + +function IMG_LoadXV_RW(src: PSDL_RWops): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_LoadXV_RW'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_LoadXV_RW} + +function IMG_ReadXPMFromArray( xpm : PPChar ): PSDL_Surface; +cdecl; external {$IFDEF __GPC__}name 'IMG_ReadXPMFromArray'{$ELSE} SDL_ImageLibName{$ENDIF __GPC__}; +{$EXTERNALSYM IMG_ReadXPMFromArray} + + + { used internally, NOT an exported function } //function IMG_string_equals( const str1 : PChar; const str2 : PChar ) : integer; diff --git a/Game/Code/lib/JEDI-SDL/SDL_ttf/Pas/sdl_ttf.pas b/Game/Code/lib/JEDI-SDL/SDL_ttf/Pas/sdl_ttf.pas index eea69719..88966f82 100644 --- a/Game/Code/lib/JEDI-SDL/SDL_ttf/Pas/sdl_ttf.pas +++ b/Game/Code/lib/JEDI-SDL/SDL_ttf/Pas/sdl_ttf.pas @@ -1,6 +1,6 @@ unit sdl_ttf; { - $Id: sdl_ttf.pas,v 1.10 2005/01/02 19:07:32 savage Exp $ + $Id: sdl_ttf.pas,v 1.19 2007/12/05 22:54:20 savage Exp $ } {******************************************************************************} @@ -87,6 +87,33 @@ unit sdl_ttf; { } { $Log: sdl_ttf.pas,v $ + Revision 1.19 2007/12/05 22:54:20 savage + Better Mac OS X support for Frameworks. + + Revision 1.18 2007/06/01 11:16:33 savage + Added IFDEF UNIX for Workaround. + + Revision 1.17 2007/06/01 08:38:21 savage + Added TTF_RenderText_Solid workaround as suggested by Michalis Kamburelis + + Revision 1.16 2007/05/29 21:32:14 savage + Changes as suggested by Almindor for 64bit compatibility. + + Revision 1.15 2007/05/20 20:32:45 savage + Initial Changes to Handle 64 Bits + + Revision 1.14 2006/12/02 00:19:01 savage + Updated to latest version + + Revision 1.13 2005/04/10 11:48:33 savage + Changes as suggested by Michalis, thanks. + + Revision 1.12 2005/01/05 01:47:14 savage + Changed LibName to reflect what MacOS X should have. ie libSDL*-1.2.0.dylib respectively. + + Revision 1.11 2005/01/04 23:14:57 savage + Changed LibName to reflect what most Linux distros will have. ie libSDL*-1.2.so.0 respectively. + Revision 1.10 2005/01/02 19:07:32 savage Slight bug fix to use LongInt instead of Long ( Thanks Michalis Kamburelis ) @@ -124,7 +151,17 @@ unit sdl_ttf; {$I jedi-sdl.inc} -{$ALIGN ON} +{ + Define this to workaround a known bug in some freetype versions. + The error manifests as TTF_RenderGlyph_Solid returning nil (error) + and error message (in SDL_Error) is + "Failed loading DPMSDisable: /usr/lib/libX11.so.6: undefined symbol: DPMSDisable" + See [http://lists.libsdl.org/pipermail/sdl-libsdl.org/2007-March/060459.html] +} +{$IFDEF UNIX} +{$DEFINE Workaround_TTF_RenderText_Solid} +{$ENDIF} + interface @@ -133,7 +170,7 @@ uses gpc, {$ENDIF} -{$IFDEF WIN32} +{$IFDEF WINDOWS} {$IFNDEF __GPC__} Windows, {$ENDIF} @@ -141,20 +178,25 @@ uses sdl; const -{$IFDEF WIN32} +{$IFDEF WINDOWS} SDLttfLibName = 'SDL_ttf.dll'; {$ENDIF} {$IFDEF UNIX} {$IFDEF DARWIN} - SDLttfLibName = 'libSDL_ttf.dylib'; + SDLttfLibName = 'libSDL_ttf-2.0.0.dylib'; {$ELSE} - SDLttfLibName = 'libSDL_ttf.so'; + {$IFDEF FPC} + SDLttfLibName = 'libSDL_ttf.so'; + {$ELSE} + SDLttfLibName = 'libSDL_ttf-2.0.so.0'; + {$ENDIF} {$ENDIF} {$ENDIF} {$IFDEF MACOS} SDLttfLibName = 'SDL_ttf'; + {$linklib libSDL_ttf} {$ENDIF} {* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL *} @@ -162,7 +204,7 @@ const {$EXTERNALSYM SDL_TTF_MAJOR_VERSION} SDL_TTF_MINOR_VERSION = 0; {$EXTERNALSYM SDL_TTF_MINOR_VERSION} - SDL_TTF_PATCHLEVEL = 7; + SDL_TTF_PATCHLEVEL = 9; {$EXTERNALSYM SDL_TTF_PATCHLEVEL} // Backwards compatibility @@ -314,8 +356,10 @@ cdecl; external {$IFDEF __GPC__}name 'TTF_SizeUNICODE'{$ELSE} SDLttfLibName{$END } function TTF_RenderText_Solid( font : PTTF_Font; const text : PChar; fg : TSDL_Color ): PSDL_Surface; +{$IFNDEF Workaround_TTF_RenderText_Solid} cdecl; external {$IFDEF __GPC__}name 'TTF_RenderText_Solid'{$ELSE} SDLttfLibName{$ENDIF __GPC__}; {$EXTERNALSYM TTF_RenderText_Solid} +{$ENDIF} function TTF_RenderUTF8_Solid( font : PTTF_Font; const text : PChar; fg : TSDL_Color ): PSDL_Surface; @@ -448,4 +492,14 @@ begin result := SDL_GetError; end; +{$IFDEF Workaround_TTF_RenderText_Solid} +function TTF_RenderText_Solid( font : PTTF_Font; + const text : PChar; fg : TSDL_Color ): PSDL_Surface; +const + Black: TSDL_Color = (r: 0; g: 0; b: 0; unused: 0); +begin + Result := TTF_RenderText_Shaded(font, text, fg, Black); +end; +{$ENDIF Workaround_TTF_RenderText_Solid} + end. diff --git a/Game/Code/lib/JEDI-SDL/SDL_ttf/Pas/sdltruetypefont.pas b/Game/Code/lib/JEDI-SDL/SDL_ttf/Pas/sdltruetypefont.pas index 4b53ddd9..a0f25e12 100644 --- a/Game/Code/lib/JEDI-SDL/SDL_ttf/Pas/sdltruetypefont.pas +++ b/Game/Code/lib/JEDI-SDL/SDL_ttf/Pas/sdltruetypefont.pas @@ -1,6 +1,6 @@ unit sdltruetypefont; { - $Id: sdltruetypefont.pas,v 1.1 2004/09/30 22:39:50 savage Exp $ + $Id: sdltruetypefont.pas,v 1.5 2005/05/26 21:22:28 savage Exp $ } {******************************************************************************} @@ -62,6 +62,21 @@ unit sdltruetypefont; { September 23 2004 - DL : Initial Creation } { $Log: sdltruetypefont.pas,v $ + Revision 1.5 2005/05/26 21:22:28 savage + Update to Input code. + + Revision 1.1 2005/05/25 23:15:42 savage + Latest Changes + + Revision 1.4 2005/05/25 22:55:01 savage + Added InputRect support. + + Revision 1.3 2005/05/13 14:02:49 savage + Made it use UniCode rendering by default. + + Revision 1.2 2005/05/13 11:37:52 savage + Improved wordwrapping algorithm + Revision 1.1 2004/09/30 22:39:50 savage Added a true type font class which contains a wrap text function. Changed the sdl_ttf.pas header to reflect the future of jedi-sdl. @@ -93,6 +108,7 @@ type FFontFile : string; FFontSize : integer; procedure PrepareFont; + protected public @@ -100,6 +116,7 @@ type destructor Destroy; override; function DrawText( aText : WideString ) : PSDL_Surface; overload; function DrawText( aText : WideString; aWidth, aHeight : Integer ) : PSDL_Surface; overload; + function Input(aDestination: PSDL_Surface; aX, aY, aWidth, aHeight: integer; var aText: string; aMaxChars: integer = 10 ): PSDL_Surface; property BackGroundColour : TSDL_Color read FBackGroundColour write FBackGroundColour; property ForeGroundColour : TSDL_Color read FForeGroundColour write FForeGroundColour; property FontFile : string read FFontFile write FFontFile; @@ -131,7 +148,7 @@ begin FForeGroundColour.r := 0; FForeGroundColour.g := 0; FForeGroundColour.b := 0; - FRenderType := rtUTF8; + FRenderType := rtUnicode; if ( TTF_Init >= 0 ) then begin FFontFile := aFontFile; @@ -265,26 +282,31 @@ begin else begin dec( i ); - strChopped := Copy( strChopped, 0, i ); - if TTF_SizeText( FFont, PChar( string( strChopped ) ), textw, texth ) = 0 then + if TTF_SizeText( FFont, PChar( string( Copy( strChopped, 0, i ) ) ), textw, texth ) = 0 then begin if ( textw < aWidth ) - and ( texth < aHeight ) then + and ( texth < aHeight ) then begin SetLength( strlist, Length( strlist ) + 1 ); - strlist[ Length( strlist ) - 1 ] := strChopped; - strChopped := Copy( aText, i + 2, Length( aText ) - ( i - 1 ) ); + strlist[ Length( strlist ) - 1 ] := Copy( strChopped, 0, i ); + strChopped := Copy( strChopped, i + 2, Length( strChopped ) - ( i - 1 ) ); i := Length( strChopped ); if TTF_SizeText( FFont, PChar( string( strChopped ) ), textw, texth ) = 0 then begin - SetLength( strlist, Length( strlist ) + 1 ); - strlist[ Length( strlist ) - 1 ] := strChopped; - break; + if ( textw < aWidth ) + and ( texth < aHeight ) then + begin + SetLength( strlist, Length( strlist ) + 1 ); + strlist[ Length( strlist ) - 1 ] := Copy( strChopped, 0, i ); + strChopped := Copy( strChopped, i + 2, Length( strChopped ) - ( i - 1 ) ); + i := Length( strChopped ); + end; end; end; end; end; end; + SetLength( SurfaceList, Length( strlist ) ); for i := Low( strlist ) to High( strlist ) do begin @@ -310,26 +332,31 @@ begin else begin dec( i ); - strChopped := Copy( strChopped, 0, i ); - if TTF_SizeUTF8( FFont, PChar( string( strChopped ) ), textw, texth ) = 0 then + if TTF_SizeUTF8( FFont, PChar( string( Copy( strChopped, 0, i ) ) ), textw, texth ) = 0 then begin if ( textw < aWidth ) - and ( texth < aHeight ) then + and ( texth < aHeight ) then begin SetLength( strlist, Length( strlist ) + 1 ); - strlist[ Length( strlist ) - 1 ] := strChopped; - strChopped := Copy( aText, i + 2, Length( aText ) - ( i - 1 ) ); + strlist[ Length( strlist ) - 1 ] := Copy( strChopped, 0, i ); + strChopped := Copy( strChopped, i + 2, Length( strChopped ) - ( i - 1 ) ); i := Length( strChopped ); if TTF_SizeUTF8( FFont, PChar( string( strChopped ) ), textw, texth ) = 0 then begin - SetLength( strlist, Length( strlist ) + 1 ); - strlist[ Length( strlist ) - 1 ] := strChopped; - break; + if ( textw < aWidth ) + and ( texth < aHeight ) then + begin + SetLength( strlist, Length( strlist ) + 1 ); + strlist[ Length( strlist ) - 1 ] := Copy( strChopped, 0, i ); + strChopped := Copy( strChopped, i + 2, Length( strChopped ) - ( i - 1 ) ); + i := Length( strChopped ); + end; end; end; end; end; end; + SetLength( SurfaceList, Length( strlist ) ); for i := Low( strlist ) to High( strlist ) do begin @@ -355,21 +382,25 @@ begin else begin dec( i ); - strChopped := Copy( strChopped, 0, i ); - if TTF_SizeUNICODE( FFont, PUInt16( strChopped ), textw, texth ) = 0 then + if TTF_SizeUNICODE( FFont, PUInt16( Copy( strChopped, 0, i ) ), textw, texth ) = 0 then begin if ( textw < aWidth ) - and ( texth < aHeight ) then + and ( texth < aHeight ) then begin SetLength( strlist, Length( strlist ) + 1 ); - strlist[ Length( strlist ) - 1 ] := strChopped; - strChopped := Copy( aText, i + 2, Length( aText ) - ( i - 1 ) ); + strlist[ Length( strlist ) - 1 ] := Copy( strChopped, 0, i ); + strChopped := Copy( strChopped, i + 2, Length( strChopped ) - ( i - 1 ) ); i := Length( strChopped ); if TTF_SizeUNICODE( FFont, PUInt16( strChopped ), textw, texth ) = 0 then begin - SetLength( strlist, Length( strlist ) + 1 ); - strlist[ Length( strlist ) - 1 ] := strChopped; - break; + if ( textw < aWidth ) + and ( texth < aHeight ) then + begin + SetLength( strlist, Length( strlist ) + 1 ); + strlist[ Length( strlist ) - 1 ] := Copy( strChopped, 0, i ); + strChopped := Copy( strChopped, i + 2, Length( strChopped ) - ( i - 1 ) ); + i := Length( strChopped ); + end; end; end; end; @@ -411,6 +442,103 @@ begin SetLength( strlist, 0 ); end; +function TTrueTypeFont.Input(aDestination: PSDL_Surface; aX, aY, aWidth: integer; aHeight : integer; var aText : string; aMaxChars: integer): PSDL_Surface; +var + event : TSDL_Event; + ch : integer; + + BackSurface, TextSurface : PSDL_Surface; + rect : SDL_Rect; + textw, texth : integer; + Done : boolean; + PassedInText : string; +begin + PassedInText := aText; + + BackSurface := SDL_AllocSurface( aDestination.flags, + aDestination.w, + aDestination.h, + aDestination.format.BitsPerPixel, + aDestination.format.Rmask, + aDestination.format.Gmask, + aDestination.format.Bmask, 0 ); + + rect.x := aX; + rect.y := aY; + rect.w := aWidth; + rect.h := aHeight; + + SDL_BlitSurface( aDestination, nil, BackSurface, nil ); + SDL_FillRect( BackSurface, @rect, SDL_MapRGB( aDestination.format, 0, 0, 0 ) ); + + TextSurface := DrawText( aText + '|' ); + + // start input + SDL_EnableUNICODE( 1 ); + Done := false; + while ( not Done ) and ( SDL_WaitEvent( @event ) > 0 ) do + begin + if event.type_ = SDL_KEYDOWN then + begin + ch := event.key.keysym.unicode; + case ch of + SDLK_RETURN : + begin + Done := true; + end; + + SDLK_ESCAPE : + begin + aText := PassedInText; + Done := true; + end; + + SDLK_BACKSPACE : + begin + if ( Length( aText ) > 0 ) then + begin + aText := Copy( aText, 0, Length( aText ) - 1 ); + if TextSurface <> nil then + SDL_FreeSurface( TextSurface ); + TextSurface := DrawText( aText + '|' ); + end; + end; + else + begin + if Length( aText ) < aMaxChars then + begin + if ( chr( ch ) <> '' ) then + begin + aText := aText + chr( ch ); + + if ( aText <> '' ) + and ( TTF_SizeUNICODE( FFont, PUInt16( aText ), textw, texth ) = 0 ) then + begin + if ( textw > aWidth ) then + aText := Copy( aText, 0, Length( aText ) - 1 ); + end; + + if TextSurface <> nil then + SDL_FreeSurface( TextSurface ); + TextSurface := DrawText( aText + '|' ); + end; + end; + end; + end; + end; + SDL_BlitSurface( BackSurface, nil, aDestination, nil ); + SDL_BlitSurface( TextSurface, nil, aDestination, @rect ); + SDL_Flip( aDestination ); + end; + + if TextSurface <> nil then + SDL_FreeSurface( TextSurface ); + if aText <> '' then + TextSurface := DrawText( aText ); + SDL_FreeSurface( BackSurface ); + result := TextSurface; +end; + procedure TTrueTypeFont.PrepareFont; var renderstyle : integer; -- cgit v1.2.3 From 059d0bf5aa52228b3d968b21597546f6ddb5a967 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 13:26:43 +0000 Subject: replaced Recording with AudioInputProcessor to conform to the new interface. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@812 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudioInput_Portaudio.pas | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudioInput_Portaudio.pas b/Game/Code/Classes/UAudioInput_Portaudio.pas index 853fc35b..8073a7f3 100644 --- a/Game/Code/Classes/UAudioInput_Portaudio.pas +++ b/Game/Code/Classes/UAudioInput_Portaudio.pas @@ -167,8 +167,8 @@ begin SC := 0; // init array-size to max. input-devices count - SetLength(Recording.SoundCard, apiInfo^.deviceCount); // fix deviceCountL - for i:= 0 to High(Recording.SoundCard) do + SetLength(AudioInputProcessor.SoundCard, apiInfo^.deviceCount); // fix deviceCountL + for i:= 0 to High(AudioInputProcessor.SoundCard) do begin // convert API-specific device-index to global index deviceIndex := Pa_HostApiDeviceIndexToDeviceIndex(apiIndex, i); @@ -180,7 +180,7 @@ begin // TODO: free object on termination paSoundCard := TPortaudioSoundCard.Create(); - Recording.SoundCard[SC] := paSoundCard; + AudioInputProcessor.SoundCard[SC] := paSoundCard; // retrieve device-name deviceName := deviceInfo^.name; @@ -262,7 +262,7 @@ begin end; // adjust size to actual input-device count - SetLength(Recording.SoundCard, SC); + SetLength(AudioInputProcessor.SoundCard, SC); Log.LogStatus('#Soundcards: ' + inttostr(SC), 'Portaudio'); @@ -280,8 +280,8 @@ var PlayerLeft, PlayerRight: integer; CaptureSoundLeft, CaptureSoundRight: TSound; begin - for S := 0 to High(Recording.Sound) do - Recording.Sound[S].BufferLong[0].Clear; + for S := 0 to High(AudioInputProcessor.Sound) do + AudioInputProcessor.Sound[S].BufferLong[0].Clear; for SC := 0 to High(Ini.CardList) do begin PlayerLeft := Ini.CardList[SC].ChannelL-1; @@ -290,11 +290,11 @@ begin if PlayerRight >= PlayersPlay then PlayerRight := -1; if (PlayerLeft > -1) or (PlayerRight > -1) then begin if (PlayerLeft > -1) then - CaptureSoundLeft := Recording.Sound[PlayerLeft] + CaptureSoundLeft := AudioInputProcessor.Sound[PlayerLeft] else CaptureSoundLeft := nil; if (PlayerRight > -1) then - CaptureSoundRight := Recording.Sound[PlayerRight] + CaptureSoundRight := AudioInputProcessor.Sound[PlayerRight] else CaptureSoundRight := nil; @@ -330,7 +330,7 @@ function MicrophoneCallback(input: Pointer; output: Pointer; frameCount: Longwor timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; inputDevice: Pointer): Integer; cdecl; begin - Recording.HandleMicrophoneData(input, frameCount*4, inputDevice); + AudioInputProcessor.HandleMicrophoneData(input, frameCount*4, inputDevice); result := paContinue; end; @@ -350,7 +350,7 @@ var stream: PPaStream; paSoundCard: TPortaudioSoundCard; begin - paSoundCard := TPortaudioSoundCard(Recording.SoundCard[Card]); + paSoundCard := TPortaudioSoundCard(AudioInputProcessor.SoundCard[Card]); paSoundCard.CaptureSoundLeft := CaptureSoundLeft; paSoundCard.CaptureSoundRight := CaptureSoundRight; @@ -401,7 +401,7 @@ var stream: PPaStream; paSoundCard: TPortaudioSoundCard; begin - paSoundCard := TPortaudioSoundCard(Recording.SoundCard[Card]); + paSoundCard := TPortaudioSoundCard(AudioInputProcessor.SoundCard[Card]); stream := paSoundCard.RecordStream; if(stream <> nil) then begin Pa_StopStream(stream); -- cgit v1.2.3 From eafa73ec3181ed45a8a6fdea8ef64fc9a1e867b3 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 13:37:02 +0000 Subject: Introduction of config-file mechanism. For now just the windows version. Linux and MacOSX later. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@813 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UConfig.pas | 164 ++++++++++++++++++++++++++++++++++++++++++ Game/Code/UltraStar.dpr | 2 + Game/Code/config-win.inc | 70 ++++++++++++++++++ Game/Code/switches.inc | 11 ++- 4 files changed, 244 insertions(+), 3 deletions(-) create mode 100644 Game/Code/Classes/UConfig.pas create mode 100644 Game/Code/config-win.inc (limited to 'Game/Code') diff --git a/Game/Code/Classes/UConfig.pas b/Game/Code/Classes/UConfig.pas new file mode 100644 index 00000000..51e9348e --- /dev/null +++ b/Game/Code/Classes/UConfig.pas @@ -0,0 +1,164 @@ +unit UConfig; + +// ------------------------------------------------------------------- +// Note on version comparison (for developers only): +// ------------------------------------------------------------------- +// Delphi (in contrast to FPC) DOESN'T support MACROS. So we +// can't define a macro like VERSION_MAJOR(version) to extract +// parts of the version-number or to create version numbers for +// comparison purposes as with a MAKE_VERSION(maj, min, rev) macro. +// So we have to define constants for every part of the version here. +// +// In addition FPC (in contrast to delphi) DOES NOT support floating- +// point numbers in $IF compiler-directives (e.g. {$IF VERSION > 1.23}) +// It also DOESN'T support arithmetic operations so we aren't able to +// compare versions this way (brackets aren't supported too): +// {$IF VERSION > ((VER_MAJ*2)+(VER_MIN*23)+(VER_REL*1))} +// +// Hence we have to use fixed numbers in the directives. At least +// Pascal allows leading 0s so 0005 equals 5 (octals are +// preceded by & and not by 0 in FPC). +// We also fix the count of digits for each part of the version number +// to 3 (aaaiiirrr with aaa=major, iii=minor, rrr=release version) +// +// A check for a library with at least a version of 2.5.11 would look +// like this: +// {$IF LIB_VERSION >= 002005011} +// +// If you just need to check the major version do this: +// {$IF LIB_VERSION_MAJOR >= 23} +// +// IMPORTANT: +// Because this unit must be included in a uses-section it is +// not possible to use the version-numbers in this uses-clause. +// Example: +// interface +// uses +// versions, // include this file +// {$IF USE_UNIT_XYZ}xyz;{$IFEND} // Error: USE_UNIT_XYZ not defined +// const +// {$IF USE_UNIT_XYZ}test = 2;{$IFEND} // OK +// uses +// {$IF USE_UNIT_XYZ}xyz;{$IFEND} // OK +// +// Even if this file was an include-file no constants could be declared +// before the interface's uses clause. +// In FPC macros {$DEFINE VER:= 3} could be used to declare the version-numbers +// but this is incompatible to Delphi. In addition macros do not allow expand +// arithmetic expressions. Although you can define +// {$DEFINE FPC_VER:= FPC_VERSION*1000000+FPC_RELEASE*1000+FPC_PATCH} +// the following check would fail: +// {$IF FPC_VERSION_INT >= 002002000} +// would fail because FPC_VERSION_INT is interpreted as a string. +// +// PLEASE consider this if you use version numbers in $IF compiler- +// directives. Otherwise you might break portability. +// ------------------------------------------------------------------- + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + Sysutils; + +const + // include config-file + {$DEFINE IncludeConstants} + {$IF Defined(MSWindows)} + {$I ../config-win.inc} + {$ELSEIF Defined(Linux)} + {$I ../config-linux.inc} + {$ELSEIF Defined(Darwin)} + {$I ../config-macosx.inc} + {$ELSE} + {$MESSAGE Fatal 'Unknown OS'} + {$IFEND} + +{* Libraries *} + + VERSION_MAJOR = 1000000; + VERSION_MINOR = 1000; + VERSION_RELEASE = 1; + + (* + * FPC_VERSION is already defined as a macro by FPC itself. + * You should use the built-in macros + * FPC_VERSION (=PPC_MAJOR) + * FPC_RELEASE (=PPC_MINOR) + * FPC_PATCH (=PPC_RELEASE) + * instead of the PPC_* ones defined here. + * This way Windows users do not need to set this. + * + * Note: It might be necessary to enable macros ({$MACRO ON} or -Sm) + * first if you want to use the FPC_* macros. + * In FPC 2.2.0 they work even without macros being enabled but + * this might be different in other versions. + * + * Example (Check for version >= 2.0.1): + * {$IF (FPC_VERSION > 2) or ((FPC_VERSION = 2) and + * ( (FPC_RELEASE > 0) or ((FPC_RELEASE = 0) and + * (FPC_PATCH >= 1)) ))} + * {$DEFINE FPC_VER_201_PLUS} + * {$ENDIF} + * + * IMPORTANT: do NOT check this way: + * {$IF (FPC_VERSION >= 2) and (FPC_RELEASE >= 0) and (FPC_PATCH >= 1)} + * ... + * In this case version 3.0.0 does not match because Patch 0 is less than 1. + *) + + //PPC_VERSION_MAJOR = @PPC_VERSION_MAJOR@; + //PPC_VERSION_MINOR = @PPC_VERSION_MINOR@; + //PPC_VERSION_RELEASE = @PPC_VERSION_RELEASE@; + //PPC_VERSION = (PPC_VERSION_MAJOR * VERSION_MAJOR) + + // (PPC_VERSION_MINOR * VERSION_MINOR) + + // (PPC_VERSION_RELEASE * VERSION_RELEASE); + + {$IFDEF LAZARUS} + LAZARUS_VERSION = (LAZARUS_VERSION_MAJOR * VERSION_MAJOR) + + (LAZARUS_VERSION_MINOR * VERSION_MINOR) + + (LAZARUS_VERSION_RELEASE * VERSION_RELEASE); + {$ENDIF} + + {$IFDEF HaveFFMpeg} + + LIBAVCODEC_VERSION = (LIBAVCODEC_VERSION_MAJOR * VERSION_MAJOR) + + (LIBAVCODEC_VERSION_MINOR * VERSION_MINOR) + + (LIBAVCODEC_VERSION_RELEASE * VERSION_RELEASE); + + LIBAVFORMAT_VERSION = (LIBAVFORMAT_VERSION_MAJOR * VERSION_MAJOR) + + (LIBAVFORMAT_VERSION_MINOR * VERSION_MINOR) + + (LIBAVFORMAT_VERSION_RELEASE * VERSION_RELEASE); + + LIBAVUTIL_VERSION = (LIBAVUTIL_VERSION_MAJOR * VERSION_MAJOR) + + (LIBAVUTIL_VERSION_MINOR * VERSION_MINOR) + + (LIBAVUTIL_VERSION_RELEASE * VERSION_RELEASE); + + {$ENDIF} + + {$IFDEF HaveSWScale} + LIBSWSCALE_VERSION = (LIBSWSCALE_VERSION_MAJOR * VERSION_MAJOR) + + (LIBSWSCALE_VERSION_MINOR * VERSION_MINOR) + + (LIBSWSCALE_VERSION_RELEASE * VERSION_RELEASE); + {$ENDIF} + + {$IFDEF HaveProjectM} + PROJECTM_VERSION = (PROJECTM_VERSION_MAJOR * VERSION_MAJOR) + + (PROJECTM_VERSION_MINOR * VERSION_MINOR) + + (PROJECTM_VERSION_RELEASE * VERSION_RELEASE); + {$ENDIF} + + {$IFDEF HavePortaudio} + PORTAUDIO_VERSION = (PORTAUDIO_VERSION_MAJOR * VERSION_MAJOR) + + (PORTAUDIO_VERSION_MINOR * VERSION_MINOR) + + (PORTAUDIO_VERSION_RELEASE * VERSION_RELEASE); + {$ENDIF} + +implementation + +end. diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index e2242d1b..18a825eb 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -78,6 +78,8 @@ uses //------------------------------ //Includes - Classes //------------------------------ + UConfig in 'Classes\UConfig.pas', + UCommon in 'Classes\UCommon.pas', UGraphic in 'Classes\UGraphic.pas', UTexture in 'Classes\UTexture.pas', diff --git a/Game/Code/config-win.inc b/Game/Code/config-win.inc new file mode 100644 index 00000000..5791c579 --- /dev/null +++ b/Game/Code/config-win.inc @@ -0,0 +1,70 @@ +{***************************************************************** + * Configuration file for UltraStar Deluxe 1.1 + *****************************************************************} + +{* Misc options *} + +{$DEFINE DEBUG} + +{* Libraries *} + +{$IF Defined(LAZARUS) and Defined(IncludeConstants)} + LAZARUS_VERSION_MAJOR = 0; + LAZARUS_VERSION_MINOR = 9; + LAZARUS_VERSION_RELEASE = 24; +{$IFEND} + +{$DEFINE HaveFFMpeg} +{$IF Defined(HaveFFMpeg) and Defined(IncludeConstants)} + av__codec = 'avcodec-51'; + LIBAVCODEC_VERSION_MAJOR = 51; + LIBAVCODEC_VERSION_MINOR = 16; + LIBAVCODEC_VERSION_RELEASE = 0; + + av__format = 'avformat-50'; + LIBAVFORMAT_VERSION_MAJOR = 50; + LIBAVFORMAT_VERSION_MINOR = 5; + LIBAVFORMAT_VERSION_RELEASE = 0; + + av__util = 'avutil-49'; + LIBAVUTIL_VERSION_MAJOR = 49; + LIBAVUTIL_VERSION_MINOR = 0; + LIBAVUTIL_VERSION_RELEASE = 0; +{$IFEND} + +{$DEFINE HaveSWScale} +{$IF Defined(HaveSWScale) and Defined(IncludeConstants)} + sw__scale = 'swscale-0'; + LIBSWSCALE_VERSION_MAJOR = 0; + LIBSWSCALE_VERSION_MINOR = 5; + LIBSWSCALE_VERSION_RELEASE = 0; +{$IFEND} + +// define this for versions of ProjectM < 1.0 (use C-Interface) +{$DEFINE HaveProjectM_0_9} +// define this for versions of ProjectM >= 1.0 (use C++-Interface) +{$UNDEF HaveProjectM_1_0_PLUS} +{$IF Defined(HaveProjectM_0_9) or Defined(HaveProjectM_1_0_PLUS)} + {$DEFINE HaveProjectM} +{$IFEND} +{$IF Defined(HaveProjectM) and Defined(IncludeConstants)} + libprojectM = 'libprojectM'; + // Note: Un/Define HaveProjectM_0_9 or HaveProjectM_1_0_PLUS accordingly + PROJECTM_VERSION_MAJOR = 0; + PROJECTM_VERSION_MINOR = 98; + PROJECTM_VERSION_RELEASE = 0; +{$IFEND} + +{$UNDEF HavePortaudio} +{$IF Defined(HavePortaudio) and Defined(IncludeConstants)} + libportaudio = 'portaudio_x86'; + PORTAUDIO_VERSION_MAJOR = 19; + PORTAUDIO_VERSION_MINOR = 0; + PORTAUDIO_VERSION_RELEASE = 0; +{$IFEND} + +{$UNDEF HavePortmixer} +{$IF Defined(HavePortmixer) and Defined(IncludeConstants)} + libportmixer = 'portmixer'; +{$IFEND} + diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index fc21a373..29828712 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -32,6 +32,8 @@ {$IFDEF win32} + {$I config-win.inc} + {$DEFINE UseBASSPlayback} {$DEFINE UseBASSInput} @@ -39,9 +41,12 @@ //{$DEFINE UsePortaudioPlayback} //{$DEFINE UsePortaudioInput} //{$DEFINE UsePortmixer} - - {$DEFINE UseProjectM_0_9} - //{$DEFINE UseProjectM_1_0} + + {$IF Defined(HaveProjectM_0_9)} + {$DEFINE UseProjectM_0_9} + {$ELSEIF Defined(HaveProjectM_1_0_PLUS)} + {$DEFINE UseProjectM_1_0} + {$IFEND} {$IFDEF DEBUG} {$IFNDEF DARWIN} -- cgit v1.2.3 From 89ac41a2ccb85d6dfccb501ff4877231cab72094 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 13:43:38 +0000 Subject: Update of the ffmpeg headers to their current trunk versions. IMPORTANT: parameter of av_free_packet is a pointer now procedure av_free_packet (pkt: PAVPacket); as it is with av_free() and av_freep() git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@814 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudioDecoder_FFMpeg.pas | 11 +- Game/Code/Classes/UVideo.pas | 4 +- Game/Code/lib/ffmpeg/acm_unit.pas | 197 -- Game/Code/lib/ffmpeg/avcodec.pas | 5251 +++++++++++++++++----------- Game/Code/lib/ffmpeg/avformat.pas | 1174 +++++-- Game/Code/lib/ffmpeg/avio.pas | 569 ++- Game/Code/lib/ffmpeg/avutil.pas | 354 +- Game/Code/lib/ffmpeg/lazarustest.lpi | 226 -- Game/Code/lib/ffmpeg/lazarustest.lpr | 30 - Game/Code/lib/ffmpeg/mathematics.pas | 41 +- Game/Code/lib/ffmpeg/mmreg.pas | 1446 -------- Game/Code/lib/ffmpeg/opt.pas | 48 +- Game/Code/lib/ffmpeg/rational.pas | 92 +- Game/Code/lib/ffmpeg/swscale.pas | 414 +-- Game/Code/lib/ffmpeg/version.inc | 102 - 15 files changed, 5042 insertions(+), 4917 deletions(-) delete mode 100644 Game/Code/lib/ffmpeg/acm_unit.pas delete mode 100644 Game/Code/lib/ffmpeg/lazarustest.lpi delete mode 100644 Game/Code/lib/ffmpeg/lazarustest.lpr delete mode 100644 Game/Code/lib/ffmpeg/mmreg.pas delete mode 100644 Game/Code/lib/ffmpeg/version.inc (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudioDecoder_FFMpeg.pas b/Game/Code/Classes/UAudioDecoder_FFMpeg.pas index 4cd6ec37..c705d603 100644 --- a/Game/Code/Classes/UAudioDecoder_FFMpeg.pas +++ b/Game/Code/Classes/UAudioDecoder_FFMpeg.pas @@ -45,7 +45,8 @@ uses {$ENDIF} UIni, UMain, - UThemes; + UThemes, + UConfig; type @@ -334,7 +335,7 @@ begin if(av_read_frame(stream.pFormatCtx, packet) < 0) then begin // check for end-of-file (eof is not an error) - {$IF (LIBAVFORMAT_MAJOR_VERSION >= 52)} + {$IF (LIBAVFORMAT_VERSION_MAJOR >= 52)} pbIOCtx := stream.pFormatCtx^.pb; {$ELSE} pbIOCtx := @stream.pFormatCtx^.pb; @@ -370,7 +371,7 @@ begin end else begin - av_free_packet(packet); + av_free_packet(@packet); end; end; @@ -428,7 +429,7 @@ begin if (pkt.data <> nil) then begin - av_free_packet(pkt); + av_free_packet(@pkt); end; if (packetQueue.quit) then @@ -739,7 +740,7 @@ begin while(pkt <> nil) do begin pkt1 := pkt^.next; - av_free_packet(pkt^.pkt); + av_free_packet(@pkt^.pkt); av_freep(pkt); pkt := pkt1; end; diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index c30b271e..db7e3ffd 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -286,7 +286,7 @@ begin try // if AVPacket.data <> nil then - av_free_packet( AVPacket ); // JB-ffmpeg + av_free_packet( @AVPacket ); // JB-ffmpeg except // TODO : JB_FFMpeg ... why does this now AV sometimes ( or always !! ) end; @@ -308,7 +308,7 @@ begin // release internal packet structure created by av_read_frame try // if AVPacket.data <> nil then - av_free_packet( AVPacket ); // JB-ffmpeg + av_free_packet( @AVPacket ); // JB-ffmpeg except // TODO : JB_FFMpeg ... why does this now AV sometimes ( or always !! ) end; diff --git a/Game/Code/lib/ffmpeg/acm_unit.pas b/Game/Code/lib/ffmpeg/acm_unit.pas deleted file mode 100644 index 307fb479..00000000 --- a/Game/Code/lib/ffmpeg/acm_unit.pas +++ /dev/null @@ -1,197 +0,0 @@ -unit acm_unit; - -interface - -uses - windows, mmsystem; - (* - ****************************************************************************** - * èíòåðôåéñ ê MS Audio Compression Manager - ****************************************************************************** - *) -type - PWaveFilter = ^TWaveFilter; - // Defined in mmreg.h - WAVEFILTER = packed record - cbStruct: DWORD; // Size of the filter in bytes - dwFilterTag: DWORD; // filter type - fdwFilter: DWORD; // Flags for the filter (Universal Dfns) - dwReserved: array [0..4] of DWORD; // Reserved for system use - end; - TWaveFilter = WAVEFILTER; - - HACMDRIVERID__ = record - Unused: Integer; - end; - {$EXTERNALSYM HACMDRIVERID__} - HACMDRIVERID = ^HACMDRIVERID__; - {$EXTERNALSYM HACMDRIVERID} - PHACMDRIVERID = ^HACMDRIVERID; - {$EXTERNALSYM PHACMDRIVERID} - LPHACMDRIVERID = ^HACMDRIVERID; - {$EXTERNALSYM LPHACMDRIVERID} - - HACMDRIVER__ = record - Unused: Integer; - end; - - {$EXTERNALSYM HACMDRIVER__} - HACMDRIVER = ^HACMDRIVER__; - {$EXTERNALSYM HACMDRIVER} - PHACMDRIVER = ^HACMDRIVER; - {$EXTERNALSYM PHACMDRIVER} - LPHACMDRIVER = ^HACMDRIVER; - {$EXTERNALSYM LPHACMDRIVER} - - HACMSTREAM__ = record - Unused: Integer; - end; - - {$EXTERNALSYM HACMSTREAM__} - HACMSTREAM = ^HACMSTREAM__; - {$EXTERNALSYM HACMSTREAM} - PHACMSTREAM = ^HACMSTREAM; - {$EXTERNALSYM PHACMSTREAM} - LPHACMSTREAM = ^HACMSTREAM; - {$EXTERNALSYM LPHACMSTREAM} - - PAcmStreamHeader = ^TAcmStreamHeader; - ACMSTREAMHEADER = packed record - cbStruct: DWORD; - fdwStatus: DWORD; - dwUser: DWORD; - pbSrc: PBYTE; - cbSrcLength: DWORD; - cbSrcLengthUsed: DWORD; - dwSrcUser: DWORD; - pbDst: PBYTE; - cbDstLength: DWORD; - cbDstLengthUsed: DWORD; - dwDstUser: DWORD; - dwReservedDriver: array [0..10 - 1] of DWORD; - end; - {$EXTERNALSYM tACMSTREAMHEADER} - TAcmStreamHeader = ACMSTREAMHEADER; - -const - ACMSTREAMHEADER_STATUSF_DONE = $00010000; - {$EXTERNALSYM ACMSTREAMHEADER_STATUSF_DONE} - ACMSTREAMHEADER_STATUSF_PREPARED = $00020000; - {$EXTERNALSYM ACMSTREAMHEADER_STATUSF_PREPARED} - ACMSTREAMHEADER_STATUSF_INQUEUE = $00100000; - {$EXTERNALSYM ACMSTREAMHEADER_STATUSF_INQUEUE} - -function acmStreamOpen(var phas: HACMSTREAM; had: HACMDRIVER; var pwfxSrc: TWAVEFORMATEX; - var pwfxDst: TWAVEFORMATEX; pwfltr: PWAVEFILTER; dwCallback: DWORD; dwInstance: DWORD; - fdwOpen: DWORD): MMRESULT; stdcall; -{$EXTERNALSYM acmStreamOpen} - -const - ACM_STREAMOPENF_QUERY = $00000001; - {$EXTERNALSYM ACM_STREAMOPENF_QUERY} - ACM_STREAMOPENF_ASYNC = $00000002; - {$EXTERNALSYM ACM_STREAMOPENF_ASYNC} - ACM_STREAMOPENF_NONREALTIME = $00000004; - {$EXTERNALSYM ACM_STREAMOPENF_NONREALTIME} - -function acmStreamSize(has: HACMSTREAM; cbInput: DWORD; var pdwOutputBytes: DWORD; - fdwSize: DWORD): MMRESULT; stdcall; -{$EXTERNALSYM acmStreamSize} - -const - ACM_STREAMSIZEF_SOURCE = $00000000; - {$EXTERNALSYM ACM_STREAMSIZEF_SOURCE} - ACM_STREAMSIZEF_DESTINATION = $00000001; - {$EXTERNALSYM ACM_STREAMSIZEF_DESTINATION} - ACM_STREAMSIZEF_QUERYMASK = $0000000F; - {$EXTERNALSYM ACM_STREAMSIZEF_QUERYMASK} - -function acmStreamConvert(has: HACMSTREAM; var pash: TAcmStreamHeader; - fdwConvert: DWORD): MMRESULT; stdcall; -{$EXTERNALSYM acmStreamConvert} - -const - ACM_STREAMCONVERTF_BLOCKALIGN = $00000004; - {$EXTERNALSYM ACM_STREAMCONVERTF_BLOCKALIGN} - ACM_STREAMCONVERTF_START = $00000010; - {$EXTERNALSYM ACM_STREAMCONVERTF_START} - ACM_STREAMCONVERTF_END = $00000020; - {$EXTERNALSYM ACM_STREAMCONVERTF_END} - -function acmStreamPrepareHeader(has: HACMSTREAM; var pash: TAcmStreamHeader; - fdwPrepare: DWORD): MMRESULT; stdcall; -{$EXTERNALSYM acmStreamPrepareHeader} - -function acmStreamUnprepareHeader(has: HACMSTREAM; var pash: TAcmStreamHeader; - fdwUnprepare: DWORD): MMRESULT; stdcall; -{$EXTERNALSYM acmStreamUnprepareHeader} - -function acmStreamClose(has: HACMSTREAM; fdwClose: DWORD): MMRESULT; stdcall; -{$EXTERNALSYM acmStreamClose} - (* - ****************************************************************************** - * èíòåðôåéñ ê MS Audio Compression Manager - ****************************************************************************** - *) - -implementation - -const - msacm32 = 'msacm32.dll'; - -(*function acmGetVersion; external msacm32 name 'acmGetVersion'; -function acmMetrics; external msacm32 name 'acmMetrics'; -function acmDriverEnum; external msacm32 name 'acmDriverEnum'; -function acmDriverID; external msacm32 name 'acmDriverID'; -function acmDriverAddA; external msacm32 name 'acmDriverAddA'; -function acmDriverAddW; external msacm32 name 'acmDriverAddW'; -function acmDriverAdd; external msacm32 name 'acmDriverAddA'; -function acmDriverRemove; external msacm32 name 'acmDriverRemove'; -function acmDriverOpen; external msacm32 name 'acmDriverOpen'; -function acmDriverClose; external msacm32 name 'acmDriverClose'; -function acmDriverMessage; external msacm32 name 'acmDriverMessage'; -function acmDriverPriority; external msacm32 name 'acmDriverPriority'; -function acmDriverDetailsA; external msacm32 name 'acmDriverDetailsA'; -function acmDriverDetailsW; external msacm32 name 'acmDriverDetailsW'; -function acmDriverDetails; external msacm32 name 'acmDriverDetailsA'; -function acmFormatTagDetailsA; external msacm32 name 'acmFormatTagDetailsA'; -function acmFormatTagDetailsW; external msacm32 name 'acmFormatTagDetailsW'; -function acmFormatTagDetails; external msacm32 name 'acmFormatTagDetailsA'; -function acmFormatDetailsA; external msacm32 name 'acmFormatDetailsA'; -function acmFormatDetailsW; external msacm32 name 'acmFormatDetailsW'; -function acmFormatDetails; external msacm32 name 'acmFormatDetailsA'; -function acmFormatChooseA; external msacm32 name 'acmFormatChooseA'; -function acmFormatChooseW; external msacm32 name 'acmFormatChooseW'; -function acmFormatChoose; external msacm32 name 'acmFormatChooseA'; -function acmFormatEnumA; external msacm32 name 'acmFormatEnumA'; -function acmFormatEnumW; external msacm32 name 'acmFormatEnumW'; -function acmFormatEnum; external msacm32 name 'acmFormatEnumA'; -function acmFormatTagEnumA; external msacm32 name 'acmFormatTagEnumA'; -function acmFormatTagEnumW; external msacm32 name 'acmFormatTagEnumW'; -function acmFormatTagEnum; external msacm32 name 'acmFormatTagEnumA'; -function acmFormatSuggest; external msacm32 name 'acmFormatSuggest'; -function acmFilterTagDetailsA; external msacm32 name 'acmFilterTagDetailsA'; -function acmFilterTagDetailsW; external msacm32 name 'acmFilterTagDetailsW'; -function acmFilterTagDetails; external msacm32 name 'acmFilterTagDetailsA'; -function acmFilterTagEnumA; external msacm32 name 'acmFilterTagEnumA'; -function acmFilterTagEnumW; external msacm32 name 'acmFilterTagEnumW'; -function acmFilterTagEnum; external msacm32 name 'acmFilterTagEnumA'; -function acmFilterDetailsA; external msacm32 name 'acmFilterDetailsA'; -function acmFilterDetailsW; external msacm32 name 'acmFilterDetailsW'; -function acmFilterDetails; external msacm32 name 'acmFilterDetailsA'; -function acmFilterEnumA; external msacm32 name 'acmFilterEnumA'; -function acmFilterEnumW; external msacm32 name 'acmFilterEnumW'; -function acmFilterEnum; external msacm32 name 'acmFilterEnumA'; -function acmFilterChooseA; external msacm32 name 'acmFilterChooseA'; -function acmFilterChooseW; external msacm32 name 'acmFilterChooseW'; -function acmFilterChoose; external msacm32 name 'acmFilterChooseA'; *) -function acmStreamOpen; external msacm32 name 'acmStreamOpen'; -function acmStreamClose; external msacm32 name 'acmStreamClose'; -function acmStreamSize; external msacm32 name 'acmStreamSize'; -//function acmStreamReset; external msacm32 name 'acmStreamReset'; -//function acmStreamMessage; external msacm32 name 'acmStreamMessage'; -function acmStreamConvert; external msacm32 name 'acmStreamConvert'; -function acmStreamPrepareHeader; external msacm32 name 'acmStreamPrepareHeader'; -function acmStreamUnprepareHeader; external msacm32 name 'acmStreamUnprepareHeader'; - -end. diff --git a/Game/Code/lib/ffmpeg/avcodec.pas b/Game/Code/lib/ffmpeg/avcodec.pas index f5646fd8..dffe284e 100644 --- a/Game/Code/lib/ffmpeg/avcodec.pas +++ b/Game/Code/lib/ffmpeg/avcodec.pas @@ -1,2034 +1,3217 @@ - (* - * copyright (c) 2001 Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - *) - -(* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. -For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT -in the source codes *) - -unit avcodec; - -{$IFDEF FPC} - {$IFDEF LINUX} - {$LINKLIB libavutil} - {$LINKLIB libavcodec} - {$ENDIF} - - {$MODE DELPHI } (* CAT *) - {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) - {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) -{$ENDIF} - -interface - -uses - avutil, rational, opt; // CAT - -{$I version.inc} - -const - AV_NOPTS_VALUE: int64 = $8000000000000000; - AV_TIME_BASE = 1000000; - AV_TIME_BASE_Q : TAVRational = (num:1; den:AV_TIME_BASE); (* added by CAT *) - -type - TCodecID = ( - CODEC_ID_NONE, CODEC_ID_MPEG1VIDEO, - CODEC_ID_MPEG2VIDEO, //* prefered ID for MPEG Video 1 or 2 decoding */ - CODEC_ID_MPEG2VIDEO_XVMC, CODEC_ID_H261, CODEC_ID_H263, CODEC_ID_RV10, - CODEC_ID_RV20, CODEC_ID_MJPEG, CODEC_ID_MJPEGB, CODEC_ID_LJPEG, - CODEC_ID_SP5X, CODEC_ID_JPEGLS, CODEC_ID_MPEG4, CODEC_ID_RAWVIDEO, - CODEC_ID_MSMPEG4V1, CODEC_ID_MSMPEG4V2, CODEC_ID_MSMPEG4V3, - CODEC_ID_WMV1, CODEC_ID_WMV2, CODEC_ID_H263P, - CODEC_ID_H263I, CODEC_ID_FLV1, CODEC_ID_SVQ1, CODEC_ID_SVQ3, - CODEC_ID_DVVIDEO, CODEC_ID_HUFFYUV, CODEC_ID_CYUV, CODEC_ID_H264, - CODEC_ID_INDEO3, CODEC_ID_VP3, CODEC_ID_THEORA, CODEC_ID_ASV1, - CODEC_ID_ASV2, CODEC_ID_FFV1, CODEC_ID_4XM, CODEC_ID_VCR1, - CODEC_ID_CLJR, CODEC_ID_MDEC, CODEC_ID_ROQ, CODEC_ID_INTERPLAY_VIDEO, - CODEC_ID_XAN_WC3, CODEC_ID_XAN_WC4, CODEC_ID_RPZA, CODEC_ID_CINEPAK, - CODEC_ID_WS_VQA, CODEC_ID_MSRLE, CODEC_ID_MSVIDEO1, CODEC_ID_IDCIN, - CODEC_ID_8BPS, CODEC_ID_SMC, CODEC_ID_FLIC, CODEC_ID_TRUEMOTION1, - CODEC_ID_VMDVIDEO, CODEC_ID_MSZH, CODEC_ID_ZLIB, CODEC_ID_QTRLE, - CODEC_ID_SNOW, CODEC_ID_TSCC, CODEC_ID_ULTI, CODEC_ID_QDRAW, - CODEC_ID_VIXL, CODEC_ID_QPEG, CODEC_ID_XVID, CODEC_ID_PNG, - CODEC_ID_PPM, CODEC_ID_PBM, CODEC_ID_PGM, CODEC_ID_PGMYUV, - CODEC_ID_PAM, CODEC_ID_FFVHUFF, CODEC_ID_RV30, CODEC_ID_RV40, - CODEC_ID_VC1, CODEC_ID_WMV3, CODEC_ID_LOCO, CODEC_ID_WNV1, - CODEC_ID_AASC, CODEC_ID_INDEO2, CODEC_ID_FRAPS, CODEC_ID_TRUEMOTION2, - CODEC_ID_BMP, CODEC_ID_CSCD, CODEC_ID_MMVIDEO, CODEC_ID_ZMBV, - CODEC_ID_AVS, CODEC_ID_SMACKVIDEO, CODEC_ID_NUV, CODEC_ID_KMVC, - CODEC_ID_FLASHSV, CODEC_ID_CAVS, CODEC_ID_JPEG2000, CODEC_ID_VMNC, - CODEC_ID_VP5, CODEC_ID_VP6, CODEC_ID_VP6F, - - //* various pcm "codecs" */ - CODEC_ID_PCM_S16LE= $10000, CODEC_ID_PCM_S16BE, CODEC_ID_PCM_U16LE, - CODEC_ID_PCM_U16BE, CODEC_ID_PCM_S8, CODEC_ID_PCM_U8, CODEC_ID_PCM_MULAW, - CODEC_ID_PCM_ALAW, CODEC_ID_PCM_S32LE, CODEC_ID_PCM_S32BE, CODEC_ID_PCM_U32LE, - CODEC_ID_PCM_U32BE, CODEC_ID_PCM_S24LE, CODEC_ID_PCM_S24BE, CODEC_ID_PCM_U24LE, - CODEC_ID_PCM_U24BE, CODEC_ID_PCM_S24DAUD, - //* various adpcm codecs */ - CODEC_ID_ADPCM_IMA_QT= $11000, CODEC_ID_ADPCM_IMA_WAV, CODEC_ID_ADPCM_IMA_DK3, - CODEC_ID_ADPCM_IMA_DK4, CODEC_ID_ADPCM_IMA_WS, CODEC_ID_ADPCM_IMA_SMJPEG, - CODEC_ID_ADPCM_MS, CODEC_ID_ADPCM_4XM, CODEC_ID_ADPCM_XA, CODEC_ID_ADPCM_ADX, - CODEC_ID_ADPCM_EA, CODEC_ID_ADPCM_G726, CODEC_ID_ADPCM_CT, CODEC_ID_ADPCM_SWF, - CODEC_ID_ADPCM_YAMAHA, CODEC_ID_ADPCM_SBPRO_4, CODEC_ID_ADPCM_SBPRO_3, - CODEC_ID_ADPCM_SBPRO_2, - //* AMR */ - CODEC_ID_AMR_NB= $12000, CODEC_ID_AMR_WB, - //* RealAudio codecs*/ - CODEC_ID_RA_144= $13000, CODEC_ID_RA_288, - //* various DPCM codecs */ - CODEC_ID_ROQ_DPCM= $14000, CODEC_ID_INTERPLAY_DPCM, CODEC_ID_XAN_DPCM, - CODEC_ID_SOL_DPCM, CODEC_ID_MP2= $15000, - CODEC_ID_MP3, //* prefered ID for MPEG Audio layer 1, 2 or3 decoding */ - CODEC_ID_AAC, CODEC_ID_MPEG4AAC, CODEC_ID_AC3, CODEC_ID_DTS, CODEC_ID_VORBIS, - CODEC_ID_DVAUDIO, CODEC_ID_WMAV1, CODEC_ID_WMAV2, CODEC_ID_MACE3, - CODEC_ID_MACE6, CODEC_ID_VMDAUDIO, CODEC_ID_SONIC, CODEC_ID_SONIC_LS, - CODEC_ID_FLAC, CODEC_ID_MP3ADU, CODEC_ID_MP3ON4, CODEC_ID_SHORTEN, - CODEC_ID_ALAC, CODEC_ID_WESTWOOD_SND1, CODEC_ID_GSM, CODEC_ID_QDM2, - CODEC_ID_COOK, CODEC_ID_TRUESPEECH, CODEC_ID_TTA, CODEC_ID_SMACKAUDIO, - CODEC_ID_QCELP, CODEC_ID_WAVPACK, - //* subtitle codecs */ - CODEC_ID_DVD_SUBTITLE= $17000, CODEC_ID_DVB_SUBTITLE, - - CODEC_ID_MPEG2TS= $20000 //* _FAKE_ codec to indicate a raw MPEG2 transport - // stream (only used by libavformat) */ - ); - -//* CODEC_ID_MP3LAME is absolete */ -const - CODEC_ID_MP3LAME = CODEC_ID_MP3; - - AVPALETTE_SIZE = 1024; - AVPALETTE_COUNT = 256; - -type - TCodecType = ( - CODEC_TYPE_UNKNOWN = -1, - CODEC_TYPE_VIDEO, - CODEC_TYPE_AUDIO, - CODEC_TYPE_DATA, - CODEC_TYPE_SUBTITLE, - CODEC_TYPE_NB (* CAT#3 *) - ); - -//* currently unused, may be used if 24/32 bits samples ever supported */ -//* all in native endian */ - TSampleFormat = ( - SAMPLE_FMT_NONE = -1, - SAMPLE_FMT_U8, ///< unsigned 8 bits - SAMPLE_FMT_S16, ///< signed 16 bits - SAMPLE_FMT_S24, ///< signed 24 bits - SAMPLE_FMT_S32, ///< signed 32 bits - SAMPLE_FMT_FLT ///< float - ); - -const -//* in bytes */ - AVCODEC_MAX_AUDIO_FRAME_SIZE = 192000; // 1 second of 48khz 32bit audio - -(** - * Required number of additionally allocated bytes at the end of the input bitstream for decoding. - * this is mainly needed because some optimized bitstream readers read - * 32 or 64 bit at once and could read over the end
- * Note, if the first 23 bits of the additional bytes are not 0 then damaged - * MPEG bitstreams could cause overread and segfault - *) - FF_INPUT_BUFFER_PADDING_SIZE = 8; - -(** - * minimum encoding buffer size. - * used to avoid some checks during header writing - *) - FF_MIN_BUFFER_SIZE = 16384; - -type -//* motion estimation type, EPZS by default */ - TMotion_Est_ID = ( - ME_ZERO = 1, - ME_FULL, - ME_LOG, - ME_PHODS, - ME_EPZS, - ME_X1, - ME_HEX, - ME_UMH, - ME_ITER - ); - - TAVDiscard = ( -//we leave some space between them for extensions (drop some keyframes for intra only or drop just some bidir frames) - AVDISCARD_NONE = -16, ///< discard nothing - AVDISCARD_DEFAULT= 0, ///< discard useless packets like 0 size packets in avi - AVDISCARD_NONREF = 8, ///< discard all non reference - AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames - AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes - AVDISCARD_ALL = 48, ///< discard all - AVDISCARD_FUCK = $FFFFFF - ); - - PRcOverride = ^TRcOverride; - TRcOverride = record {16} - start_frame: integer; - end_frame: integer; - qscale: integer; // if this is 0 then quality_factor will be used instead - quality_factor: single; - end; - -const - FF_MAX_B_FRAMES = 16; - -(* encoding support - these flags can be passed in AVCodecContext.flags before initing - Note: not everything is supported yet. -*) - - CODEC_FLAG_QSCALE = $0002; ///< use fixed qscale - CODEC_FLAG_4MV = $0004; ///< 4 MV per MB allowed / Advanced prediction for H263 - CODEC_FLAG_QPEL = $0010; ///< use qpel MC - CODEC_FLAG_GMC = $0020; ///< use GMC - CODEC_FLAG_MV0 = $0040; ///< always try a MB with MV=<0,0> - CODEC_FLAG_PART = $0080; ///< use data partitioning -//* parent program gurantees that the input for b-frame containing streams is not written to -// for at least s->max_b_frames+1 frames, if this is not set than the input will be copied */ - CODEC_FLAG_INPUT_PRESERVED = $0100; - CODEC_FLAG_PASS1 = $0200; ///< use internal 2pass ratecontrol in first pass mode - CODEC_FLAG_PASS2 = $0400; ///< use internal 2pass ratecontrol in second pass mode - CODEC_FLAG_EXTERN_HUFF = $1000; ///< use external huffman table (for mjpeg) - CODEC_FLAG_GRAY = $2000; ///< only decode/encode grayscale - CODEC_FLAG_EMU_EDGE = $4000; ///< don't draw edges - CODEC_FLAG_PSNR = $8000; ///< error[?] variables will be set during encoding - CODEC_FLAG_TRUNCATED = $00010000; //** input bitstream might be truncated at a random location instead - // of only at frame boundaries */ - CODEC_FLAG_NORMALIZE_AQP = $00020000; ///< normalize adaptive quantization - CODEC_FLAG_INTERLACED_DCT = $00040000; ///< use interlaced dct - CODEC_FLAG_LOW_DELAY = $00080000; ///< force low delay - CODEC_FLAG_ALT_SCAN = $00100000; ///< use alternate scan - CODEC_FLAG_TRELLIS_QUANT = $00200000; ///< use trellis quantization - CODEC_FLAG_GLOBAL_HEADER = $00400000; ///< place global headers in extradata instead of every keyframe - CODEC_FLAG_BITEXACT = $00800000; ///< use only bitexact stuff (except (i)dct) -//* Fx : Flag for h263+ extra options */ - CODEC_FLAG_H263P_AIC = $01000000; ///< H263 Advanced intra coding / MPEG4 AC prediction (remove this) - CODEC_FLAG_AC_PRED = $01000000; ///< H263 Advanced intra coding / MPEG4 AC prediction - CODEC_FLAG_H263P_UMV = $02000000; ///< Unlimited motion vector - CODEC_FLAG_CBP_RD = $04000000; ///< use rate distortion optimization for cbp - CODEC_FLAG_QP_RD = $08000000; ///< use rate distortion optimization for qp selectioon - CODEC_FLAG_H263P_AIV = $00000008; ///< H263 Alternative inter vlc - CODEC_FLAG_OBMC = $00000001; ///< OBMC - CODEC_FLAG_LOOP_FILTER = $00000800; ///< loop filter - CODEC_FLAG_H263P_SLICE_STRUCT = $10000000; - CODEC_FLAG_INTERLACED_ME = $20000000; ///< interlaced motion estimation - CODEC_FLAG_SVCD_SCAN_OFFSET = $40000000; ///< will reserve space for SVCD scan offset user data - CODEC_FLAG_CLOSED_GOP = $80000000; - CODEC_FLAG2_FAST = $00000001; ///< allow non spec compliant speedup tricks - CODEC_FLAG2_STRICT_GOP = $00000002; ///< strictly enforce GOP size - CODEC_FLAG2_NO_OUTPUT = $00000004; ///< skip bitstream encoding - CODEC_FLAG2_LOCAL_HEADER = $00000008; ///< place global headers at every keyframe instead of in extradata - CODEC_FLAG2_BPYRAMID = $00000010; ///< H.264 allow b-frames to be used as references - CODEC_FLAG2_WPRED = $00000020; ///< H.264 weighted biprediction for b-frames - CODEC_FLAG2_MIXED_REFS = $00000040; ///< H.264 multiple references per partition - CODEC_FLAG2_8X8DCT = $00000080; ///< H.264 high profile 8x8 transform - CODEC_FLAG2_FASTPSKIP = $00000100; ///< H.264 fast pskip - CODEC_FLAG2_AUD = $00000200; ///< H.264 access unit delimiters - CODEC_FLAG2_BRDO = $00000400; ///< b-frame rate-distortion optimization - CODEC_FLAG2_INTRA_VLC = $00000800; ///< use MPEG-2 intra VLC table - CODEC_FLAG2_MEMC_ONLY = $00001000; ///< only do ME/MC (I frames -> ref, P frame -> ME+MC) - -(* Unsupported options : - * Syntax Arithmetic coding (SAC) - * Reference Picture Selection - * Independant Segment Decoding */ -/* /Fx */ -/* codec capabilities *) - -const - CODEC_CAP_DRAW_HORIZ_BAND = $001; ///< decoder can use draw_horiz_band callback -(** - * Codec uses get_buffer() for allocating buffers. - * direct rendering method 1 *) - CODEC_CAP_DR1 = $002; -(* if 'parse_only' field is true, then avcodec_parse_frame() can be used *) - CODEC_CAP_PARSE_ONLY = $004; - CODEC_CAP_TRUNCATED = $008; -//* codec can export data for HW decoding (XvMC) */ - CODEC_CAP_HWACCEL = $010; - -(** - * codec has a non zero delay and needs to be feeded with NULL at the end to get the delayed data. - * if this is not set, the codec is guranteed to never be feeded with NULL data *) - CODEC_CAP_DELAY = $0020; -(** - * Codec can be fed a final frame with a smaller size. - * This can be used to prevent truncation of the last audio samples. *) - CODEC_CAP_SMALL_LAST_FRAME = $0040; - -//the following defines may change, don't expect compatibility if you use them - MB_TYPE_INTRA4x4 = $001; - MB_TYPE_INTRA16x16 = $002; //FIXME h264 specific - MB_TYPE_INTRA_PCM = $004; //FIXME h264 specific - MB_TYPE_16x16 = $008; - MB_TYPE_16x8 = $010; - MB_TYPE_8x16 = $020; - MB_TYPE_8x8 = $040; - MB_TYPE_INTERLACED = $080; - MB_TYPE_DIRECT2 = $100; //FIXME - MB_TYPE_ACPRED = $200; - MB_TYPE_GMC = $400; - MB_TYPE_SKIP = $800; - MB_TYPE_P0L0 = $1000; - MB_TYPE_P1L0 = $2000; - MB_TYPE_P0L1 = $4000; - MB_TYPE_P1L1 = $8000; - MB_TYPE_L0 = (MB_TYPE_P0L0 or MB_TYPE_P1L0); - MB_TYPE_L1 = (MB_TYPE_P0L1 or MB_TYPE_P1L1); - MB_TYPE_L0L1 = (MB_TYPE_L0 or MB_TYPE_L1); - MB_TYPE_QUANT = $0010000; - MB_TYPE_CBP = $0020000; -//Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...) - -type -(** - * Pan Scan area. - * this specifies the area which should be displayed. Note there may be multiple such areas for one frame *) - PAVPanScan = ^TAVPanScan; - TAVPanScan = record {24} - (*** id. - * - encoding: set by user. - * - decoding: set by lavc *) - id: integer; - - (*** width and height in 1/16 pel - * - encoding: set by user. - * - decoding: set by lavc *) - width: integer; - height: integer; - - (*** position of the top left corner in 1/16 pel for up to 3 fields/frames. - * - encoding: set by user. - * - decoding: set by lavc *) - position: array [0..2] of array [0..1] of smallint; - end; - -const - FF_QSCALE_TYPE_MPEG1 = 0; - FF_QSCALE_TYPE_MPEG2 = 1; - - FF_BUFFER_TYPE_INTERNAL = 1; - FF_BUFFER_TYPE_USER = 2; ///< Direct rendering buffers (image is (de)allocated by user) - FF_BUFFER_TYPE_SHARED = 4; ///< buffer from somewhere else, don't dealloc image (data/base), all other tables are not shared - FF_BUFFER_TYPE_COPY = 8; ///< just a (modified) copy of some other buffer, don't dealloc anything - - - FF_I_TYPE = 1; // Intra - FF_P_TYPE = 2; // Predicted - FF_B_TYPE = 3; // Bi-dir predicted - FF_S_TYPE = 4; // S(GMC)-VOP MPEG4 - FF_SI_TYPE = 5; - FF_SP_TYPE = 6; - - FF_BUFFER_HINTS_VALID = $01; // Buffer hints value is meaningful (if 0 ignore) - FF_BUFFER_HINTS_READABLE = $02; // Codec will read from buffer - FF_BUFFER_HINTS_PRESERVE = $04; // User must not alter buffer content - FF_BUFFER_HINTS_REUSABLE = $08; // Codec will reuse the buffer (update) - -type - (*** Audio Video Frame. *) - PAVFrame = ^TAVFrame; - TAVFrame = record {200} - (*** pointer to the picture planes. - * this might be different from the first allocated byte *) - data: array [0..3] of pbyte; - linesize: array [0..3] of integer; - (*** pointer to the first allocated byte of the picture. can be used in get_buffer/release_buffer - * this isn't used by lavc unless the default get/release_buffer() is used*) - base: array [0..3] of pbyte; - (*** 1 -> keyframe, 0-> not *) - key_frame: integer; - (*** picture type of the frame, see ?_TYPE below.*) - pict_type: integer; - (*** presentation timestamp in time_base units (time when frame should be shown to user) - * if AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed*) - pts: int64; - (*** picture number in bitstream order.*) - coded_picture_number: integer; - (*** picture number in display order.*) - display_picture_number: integer; - (*** quality (between 1 (good) and FF_LAMBDA_MAX (bad)) *) - quality: integer; - (*** buffer age (1->was last buffer and dint change, 2->..., ...).*) - age: integer; - (*** is this picture used as reference*) - reference: integer; - (*** QP table*) - qscale_table: pchar; - (*** QP store stride*) - qstride: integer; - (*** mbskip_table[mb]>=1 if MB didnt change*) - mbskip_table: pbyte; - (** - * Motion vector table. - * @code - * example: - * int mv_sample_log2= 4 - motion_subsample_log2; - * int mb_width= (width+15)>>4; - * int mv_stride= (mb_width << mv_sample_log2) + 1; - * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y]; - * @endcode - * - encoding: set by user - * - decoding: set by lavc *) - motion_val: array [0..1] of pointer; - (*** Macroblock type table - * mb_type_base + mb_width + 2 *) - mb_type: PCardinal; - (*** log2 of the size of the block which a single vector in motion_val represents: - * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)*) - motion_subsample_log2: byte; - (*** for some private data of the user*) - opaque: pointer; - (*** error*) - error: array [0..3] of int64; - (*** type of the buffer (to keep track of who has to dealloc data[*]) - * Note: user allocated (direct rendering) & internal buffers can not coexist currently*) - _type: integer; - (*** when decoding, this signal how much the picture must be delayed. - * extra_delay = repeat_pict / (2*fps)*) - repeat_pict: integer; - qscale_type: integer; - (*** The content of the picture is interlaced.*) - interlaced_frame: integer; - (*** if the content is interlaced, is top field displayed first.*) - top_field_first: integer; - (*** Pan scan.*) - pan_scan: PAVPanScan; - (*** tell user application that palette has changed from previous frame.*) - palette_has_changed: integer; - (*** Codec suggestion on buffer type if != 0 - * - decoding: set by lavc (before get_buffer() call))*) - buffer_hints: integer; - (*** DCT coeffitients*) - dct_coeff: PsmallInt; - (*** Motion referece frame index*) - ref_index: array [0..1] of pshortint; - end; - -const - DEFAULT_FRAME_RATE_BASE = 1001000; - - FF_BUG_AUTODETECT = 1; ///< autodetection - FF_BUG_OLD_MSMPEG4 = 2; - FF_BUG_XVID_ILACE = 4; - FF_BUG_UMP4 = 8; - FF_BUG_NO_PADDING = 16; - FF_BUG_AMV = 32; - FF_BUG_AC_VLC = 0; ///< will be removed, libavcodec can now handle these non compliant files by default - FF_BUG_QPEL_CHROMA = 64; - FF_BUG_STD_QPEL = 128; - FF_BUG_QPEL_CHROMA2 = 256; - FF_BUG_DIRECT_BLOCKSIZE = 512; - FF_BUG_EDGE = 1024; - FF_BUG_HPEL_CHROMA = 2048; - FF_BUG_DC_CLIP = 4096; - FF_BUG_MS = 8192; ///< workaround various bugs in microsofts broken decoders - - FF_COMPLIANCE_VERY_STRICT = 2; ///< strictly conform to a older more strict version of the spec or reference software - FF_COMPLIANCE_STRICT = 1; ///< strictly conform to all the things in the spec no matter what consequences - FF_COMPLIANCE_NORMAL = 0; - FF_COMPLIANCE_INOFFICIAL = -1; ///< allow inofficial extensions - FF_COMPLIANCE_EXPERIMENTAL = -2; ///< allow non standarized experimental things - - FF_ER_CAREFUL = 1; - FF_ER_COMPLIANT = 2; - FF_ER_AGGRESSIVE = 3; - FF_ER_VERY_AGGRESSIVE = 4; - - FF_DCT_AUTO = 0; - FF_DCT_FASTINT = 1; - FF_DCT_INT = 2; - FF_DCT_MMX = 3; - FF_DCT_MLIB = 4; - FF_DCT_ALTIVEC = 5; - FF_DCT_FAAN = 6; - - FF_IDCT_AUTO = 0; - FF_IDCT_INT = 1; - FF_IDCT_SIMPLE = 2; - FF_IDCT_SIMPLEMMX = 3; - FF_IDCT_LIBMPEG2MMX = 4; - FF_IDCT_PS2 = 5; - FF_IDCT_MLIB = 6; - FF_IDCT_ARM = 7; - FF_IDCT_ALTIVEC = 8; - FF_IDCT_SH4 = 9; - FF_IDCT_SIMPLEARM = 10; - FF_IDCT_H264 = 11; - FF_IDCT_VP3 = 12; - FF_IDCT_IPP = 13; - FF_IDCT_XVIDMMX = 14; - - FF_EC_GUESS_MVS = 1; - FF_EC_DEBLOCK = 2; - - FF_MM_FORCE = $80000000; (* force usage of selected flags (OR) *) - (* lower 16 bits - CPU features *) - - FF_MM_MMX = $0001; (* standard MMX *) - FF_MM_3DNOW = $0004; (* AMD 3DNOW *) - FF_MM_MMXEXT = $0002; (* SSE integer functions or AMD MMX ext *) - FF_MM_SSE = $0008; (* SSE functions *) - FF_MM_SSE2 = $0010; (* PIV SSE2 functions *) - FF_MM_3DNOWEXT = $0020; (* AMD 3DNowExt *) - FF_MM_IWMMXT = $0100; (* XScale IWMMXT *) - - FF_PRED_LEFT = 0; - FF_PRED_PLANE = 1; - FF_PRED_MEDIAN = 2; - - FF_DEBUG_PICT_INFO = 1; - FF_DEBUG_RC = 2; - FF_DEBUG_BITSTREAM = 4; - FF_DEBUG_MB_TYPE = 8; - FF_DEBUG_QP = 16; - FF_DEBUG_MV = 32; - FF_DEBUG_DCT_COEFF = $00000040; - FF_DEBUG_SKIP = $00000080; - FF_DEBUG_STARTCODE = $00000100; - FF_DEBUG_PTS = $00000200; - FF_DEBUG_ER = $00000400; - FF_DEBUG_MMCO = $00000800; - FF_DEBUG_BUGS = $00001000; - FF_DEBUG_VIS_QP = $00002000; - FF_DEBUG_VIS_MB_TYPE = $00004000; - - FF_DEBUG_VIS_MV_P_FOR = $00000001; //visualize forward predicted MVs of P frames - FF_DEBUG_VIS_MV_B_FOR = $00000002; //visualize forward predicted MVs of B frames - FF_DEBUG_VIS_MV_B_BACK = $00000004; //visualize backward predicted MVs of B frames - - FF_CMP_SAD = 0; - FF_CMP_SSE = 1; - FF_CMP_SATD = 2; - FF_CMP_DCT = 3; - FF_CMP_PSNR = 4; - FF_CMP_BIT = 5; - FF_CMP_RD = 6; - FF_CMP_ZERO = 7; - FF_CMP_VSAD = 8; - FF_CMP_VSSE = 9; - FF_CMP_NSSE = 10; - FF_CMP_W53 = 11; - FF_CMP_W97 = 12; - FF_CMP_DCTMAX = 13; - FF_CMP_CHROMA = 256; - - FF_DTG_AFD_SAME = 8; - FF_DTG_AFD_4_3 = 9; - FF_DTG_AFD_16_9 = 10; - FF_DTG_AFD_14_9 = 11; - FF_DTG_AFD_4_3_SP_14_9 = 13; - FF_DTG_AFD_16_9_SP_14_9 = 14; - FF_DTG_AFD_SP_4_3 = 15; - - FF_DEFAULT_QUANT_BIAS = 999999; - - FF_LAMBDA_SHIFT = 7; - FF_LAMBDA_SCALE = (1 shl FF_LAMBDA_SHIFT); - FF_QP2LAMBDA = 118; ///< factor to convert from H.263 QP to lambda - FF_LAMBDA_MAX = (256 * 128 - 1); - - FF_QUALITY_SCALE = FF_LAMBDA_SCALE; //FIXME maybe remove - - FF_CODER_TYPE_VLC = 0; - FF_CODER_TYPE_AC = 1; - - SLICE_FLAG_CODED_ORDER = $0001; ///< draw_horiz_band() is called in coded order instead of display - SLICE_FLAG_ALLOW_FIELD = $0002; ///< allow draw_horiz_band() with field slices (MPEG2 field pics) - SLICE_FLAG_ALLOW_PLANE = $0004; ///< allow draw_horiz_band() with 1 component at a time (SVQ1) - - FF_MB_DECISION_SIMPLE = 0; ///< uses mb_cmp - FF_MB_DECISION_BITS = 1; ///< chooses the one which needs the fewest bits - FF_MB_DECISION_RD = 2; ///< rate distoration - - FF_AA_AUTO = 0; - FF_AA_FASTINT = 1; //not implemented yet - FF_AA_INT = 2; - FF_AA_FLOAT = 3; - - FF_PROFILE_UNKNOWN = -99; - - FF_LEVEL_UNKNOWN = -99; - - X264_PART_I4X4 = $001; (* Analyse i4x4 *) - X264_PART_I8X8 = $002; (* Analyse i8x8 (requires 8x8 transform) *) - X264_PART_P8X8 = $010; (* Analyse p16x8, p8x16 and p8x8 *) - X264_PART_P4X4 = $020; (* Analyse p8x4, p4x8, p4x4 *) - X264_PART_B8X8 = $100; (* Analyse b16x8, b8x16 and b8x8 *) - -type - PAVClass = ^TAVClass; - PAVCodecContext = ^TAVCodecContext; - PAVCodec = ^TAVCodec; - PAVPaletteControl = ^TAVPaletteControl; - - TAVclass = record {12} - class_name: pchar; - (* actually passing a pointer to an AVCodecContext - or AVFormatContext, which begin with an AVClass. - Needed because av_log is in libavcodec and has no visibility - of AVIn/OutputFormat *) - item_name: function (): pchar; cdecl; - option: PAVOption; - end; - - TAVCodecContext = record {720} - (*** Info on struct for av_log - * - set by avcodec_alloc_context *) - av_class: PAVClass; - (*** the average bitrate. - * - encoding: set by user. unused for constant quantizer encoding - * - decoding: set by lavc. 0 or some bitrate if this info is available in the stream *) - bit_rate: integer; - (*** number of bits the bitstream is allowed to diverge from the reference. - * the reference can be CBR (for CBR pass1) or VBR (for pass2) - * - encoding: set by user. unused for constant quantizer encoding - * - decoding: unused *) - bit_rate_tolerance: integer; - (*** CODEC_FLAG_*. - * - encoding: set by user. - * - decoding: set by user. *) - flags: integer; - (*** some codecs needs additionnal format info. It is stored here - * - encoding: set by user. - * - decoding: set by lavc. (FIXME is this ok?) *) - sub_id: integer; - - (** - * motion estimation algorithm used for video coding. - * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex), - * 8 (umh), 9 (iter) [7, 8 are x264 specific, 9 is snow specific] - * - encoding: MUST be set by user. - * - decoding: unused *) - me_method: integer; - - (** - * some codecs need / can use extra-data like huffman tables. - * mjpeg: huffman tables - * rv10: additional flags - * mpeg4: global headers (they can be in the bitstream or here) - * the allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger - * then extradata_size to avoid prolems if its read with the bitstream reader - * the bytewise contents of extradata must not depend on the architecture or cpu endianness - * - encoding: set/allocated/freed by lavc. - * - decoding: set/allocated/freed by user. - *) - extradata: pbyte; - extradata_size: integer; - - (** - * this is the fundamental unit of time (in seconds) in terms - * of which frame timestamps are represented. for fixed-fps content, - * timebase should be 1/framerate and timestamp increments should be - * identically 1. - * - encoding: MUST be set by user - * - decoding: set by lavc. *) - time_base: TAVRational; - - (* video only *) - (*** picture width / height. - * - encoding: MUST be set by user. - * - decoding: set by lavc. - * Note, for compatibility its possible to set this instead of - * coded_width/height before decoding *) - width, height: integer; - (*** the number of pictures in a group of pitures, or 0 for intra_only. - * - encoding: set by user. - * - decoding: unused *) - gop_size: integer; - (*** pixel format, see PIX_FMT_xxx. - * - encoding: set by user. - * - decoding: set by lavc. *) - pix_fmt: TAVPixelFormat; - (*** Frame rate emulation. If not zero lower layer (i.e. format handler) - * has to read frames at native frame rate. - * - encoding: set by user. - * - decoding: unused. *) - rate_emu: integer; - (*** if non NULL, 'draw_horiz_band' is called by the libavcodec - * decoder to draw an horizontal band. It improve cache usage. Not - * all codecs can do that. You must check the codec capabilities - * before - * - encoding: unused - * - decoding: set by user. - * @param height the height of the slice - * @param y the y position of the slice - * @param type 1->top field, 2->bottom field, 3->frame - * @param offset offset into the AVFrame.data from which the slice should be read *) - draw_horiz_band: procedure (s: PAVCodecContext; - const src: PAVFrame; offset: PInteger; - y: integer; _type: integer; height: integer); cdecl; - - (* audio only *) - sample_rate: integer; ///< samples per sec - channels: integer; - (*** audio sample format. - * - encoding: set by user. - * - decoding: set by lavc. *) - sample_fmt: TSampleFormat; ///< sample format, currenly unused - - (* the following data should not be initialized *) - (*** samples per packet. initialized when calling 'init' *) - frame_size: integer; - frame_number: integer; ///< audio or video frame number - real_pict_num: integer; ///< returns the real picture number of previous encoded frame - - (*** number of frames the decoded output will be delayed relative to - * the encoded input. - * - encoding: set by lavc. - * - decoding: unused *) - delay: integer; - - (* - encoding parameters *) - qcompress: single; ///< amount of qscale change between easy & hard scenes (0.0-1.0) - qblur: single; ///< amount of qscale smoothing over time (0.0-1.0) - - (*** minimum quantizer. - * - encoding: set by user. - * - decoding: unused *) - qmin: integer; - - (*** maximum quantizer. - * - encoding: set by user. - * - decoding: unused *) - qmax: integer; - - (*** maximum quantizer difference etween frames. - * - encoding: set by user. - * - decoding: unused *) - max_qdiff: integer; - - (*** maximum number of b frames between non b frames. - * note: the output will be delayed by max_b_frames+1 relative to the input - * - encoding: set by user. - * - decoding: unused *) - max_b_frames: integer; - - (*** qscale factor between ip and b frames. - * - encoding: set by user. - * - decoding: unused *) - b_quant_factor: single; - - (** obsolete FIXME remove *) - rc_strategy: integer; - b_frame_strategy: integer; - - (*** hurry up amount. - * deprecated in favor of skip_idct and skip_frame - * - encoding: unused - * - decoding: set by user. 1-> skip b frames, 2-> skip idct/dequant too, 5-> skip everything except header *) - hurry_up: integer; - - codec: PAVCodec; - - priv_data: pointer; - - (* unused, FIXME remove*) - rtp_mode: integer; - - rtp_payload_size: integer; (* The size of the RTP payload: the coder will *) - (* do it's best to deliver a chunk with size *) - (* below rtp_payload_size, the chunk will start *) - (* with a start code on some codecs like H.263 *) - (* This doesn't take account of any particular *) - (* headers inside the transmited RTP payload *) - - - (* The RTP callback: This function is called *) - (* every time the encoder has a packet to send *) - (* Depends on the encoder if the data starts *) - (* with a Start Code (it should) H.263 does. *) - (* mb_nb contains the number of macroblocks *) - (* encoded in the RTP payload *) - rtp_callback: procedure (avctx: PAVCodecContext; data: pointer; - size: integer; mb_nb: integer); cdecl; - - (* statistics, used for 2-pass encoding *) - mv_bits: integer; - header_bits: integer; - i_tex_bits: integer; - p_tex_bits: integer; - i_count: integer; - p_count: integer; - skip_count: integer; - misc_bits: integer; - - (*** number of bits used for the previously encoded frame. - * - encoding: set by lavc - * - decoding: unused *) - frame_bits: integer; - - (*** private data of the user, can be used to carry app specific stuff. - * - encoding: set by user - * - decoding: set by user *) - opaque: pointer; - - codec_name: array [0..31] of char; - codec_type: TCodecType; (* see CODEC_TYPE_xxx *) - codec_id: TCodecID; (* see CODEC_ID_xxx *) - - (*** fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). - * this is used to workaround some encoder bugs - * - encoding: set by user, if not then the default based on codec_id will be used - * - decoding: set by user, will be converted to upper case by lavc during init *) - codec_tag: cardinal; // ìîæíî array [0..3] of char - òîãäà âèäíî FOURCC -// codec_tag: array [0..3] of char; - - (*** workaround bugs in encoders which sometimes cannot be detected automatically. - * - encoding: set by user - * - decoding: set by user *) - workaround_bugs: integer; - - (*** luma single coeff elimination threshold. - * - encoding: set by user - * - decoding: unused *) - luma_elim_threshold: integer; - - (*** chroma single coeff elimination threshold. - * - encoding: set by user - * - decoding: unused *) - chroma_elim_threshold: integer; - - (*** strictly follow the std (MPEG4, ...). - * - encoding: set by user - * - decoding: unused *) - strict_std_compliance: integer; - - (*** qscale offset between ip and b frames. - * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset) - * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset) - * - encoding: set by user. - * - decoding: unused *) - b_quant_offset: single; - - (*** error resilience higher values will detect more errors but may missdetect - * some more or less valid parts as errors. - * - encoding: unused - * - decoding: set by user *) - error_resilience: integer; - - (*** called at the beginning of each frame to get a buffer for it. - * if pic.reference is set then the frame will be read later by lavc - * avcodec_align_dimensions() should be used to find the required width and - * height, as they normally need to be rounded up to the next multiple of 16 - * - encoding: unused - * - decoding: set by lavc, user can override *) - get_buffer: function (c: PAVCodecContext; pic: PAVFrame): integer; cdecl; - - (*** called to release buffers which where allocated with get_buffer. - * a released buffer can be reused in get_buffer() - * pic.data[*] must be set to NULL - * - encoding: unused - * - decoding: set by lavc, user can override *) - release_buffer: procedure (c: PAVCodecContext; pic: PAVFrame); cdecl; - - (*** if 1 the stream has a 1 frame delay during decoding. - * - encoding: set by lavc - * - decoding: set by lavc *) - has_b_frames: integer; - - (*** number of bytes per packet if constant and known or 0 - * used by some WAV based audio codecs *) - block_align: integer; - - parse_only: integer; (* - decoding only: if true, only parsing is done - (function avcodec_parse_frame()). The frame - data is returned. Only MPEG codecs support this now. *) - - (*** 0-> h263 quant 1-> mpeg quant. - * - encoding: set by user. - * - decoding: unused *) - mpeg_quant: integer; - - (*** pass1 encoding statistics output buffer. - * - encoding: set by lavc - * - decoding: unused *) - stats_out: pchar; - - (*** pass2 encoding statistics input buffer. - * concatenated stuff from stats_out of pass1 should be placed here - * - encoding: allocated/set/freed by user - * - decoding: unused *) - stats_in: pchar; - - (*** ratecontrol qmin qmax limiting method. - * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax - * - encoding: set by user. - * - decoding: unused *) - rc_qsquish: single; - - rc_qmod_amp: single; - rc_qmod_freq: integer; - - (*** ratecontrol override, see RcOverride. - * - encoding: allocated/set/freed by user. - * - decoding: unused *) - rc_override: PRcOverride; - rc_override_count: integer; - - (*** rate control equation. - * - encoding: set by user - * - decoding: unused *) - rc_eq: pchar; - - (*** maximum bitrate. - * - encoding: set by user. - * - decoding: unused *) - rc_max_rate: integer; - - (*** minimum bitrate. - * - encoding: set by user. - * - decoding: unused *) - rc_min_rate: integer; - - (*** decoder bitstream buffer size. - * - encoding: set by user. - * - decoding: unused *) - rc_buffer_size: integer; - rc_buffer_aggressivity: single; - - (*** qscale factor between p and i frames. - * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset) - * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset) - * - encoding: set by user. - * - decoding: unused *) - i_quant_factor: single; - - (*** qscale offset between p and i frames. - * - encoding: set by user. - * - decoding: unused *) - i_quant_offset: single; - - (*** initial complexity for pass1 ratecontrol. - * - encoding: set by user. - * - decoding: unused *) - rc_initial_cplx: single; - - (*** dct algorithm, see FF_DCT_* below. - * - encoding: set by user - * - decoding: unused *) - dct_algo: integer; - - (*** luminance masking (0-> disabled). - * - encoding: set by user - * - decoding: unused *) - lumi_masking: single; - - (*** temporary complexity masking (0-> disabled). - * - encoding: set by user - * - decoding: unused *) - temporal_cplx_masking: single; - - (*** spatial complexity masking (0-> disabled). - * - encoding: set by user - * - decoding: unused *) - spatial_cplx_masking: single; - - (** * p block masking (0-> disabled). - * - encoding: set by user - * - decoding: unused *) - p_masking: single; - - (*** darkness masking (0-> disabled). - * - encoding: set by user - * - decoding: unused *) - dark_masking: single; - - (* for binary compatibility *) - unused: integer; - - (*** idct algorithm, see FF_IDCT_* below. - * - encoding: set by user - * - decoding: set by user *) - idct_algo: integer; - - (*** slice count. - * - encoding: set by lavc - * - decoding: set by user (or 0) *) - slice_count: integer; - - (*** slice offsets in the frame in bytes. - * - encoding: set/allocated by lavc - * - decoding: set/allocated by user (or NULL) *) - slice_offset: Pinteger; - - (*** error concealment flags. - * - encoding: unused - * - decoding: set by user *) - error_concealment: integer; - - (*** dsp_mask could be add used to disable unwanted CPU features - * CPU features (i.e. MMX, SSE. ...) - * - * with FORCE flag you may instead enable given CPU features - * (Dangerous: usable in case of misdetection, improper usage however will - * result into program crash) *) - dsp_mask: cardinal; - - (*** bits per sample/pixel from the demuxer (needed for huffyuv). - * - encoding: set by lavc - * - decoding: set by user *) - bits_per_sample: integer; - - (*** prediction method (needed for huffyuv). - * - encoding: set by user - * - decoding: unused *) - prediction_method: integer; - - (*** sample aspect ratio (0 if unknown). - * numerator and denominator must be relative prime and smaller then 256 for some video standards - * - encoding: set by user. - * - decoding: set by lavc. *) - sample_aspect_ratio: TAVRational; - - (*** the picture in the bitstream. - * - encoding: set by lavc - * - decoding: set by lavc *) - coded_frame: PAVFrame; - - (*** debug. - * - encoding: set by user. - * - decoding: set by user. *) - debug: integer; - - (*** debug. - * - encoding: set by user. - * - decoding: set by user. *) - debug_mv: integer; - - (** error. - * - encoding: set by lavc if flags&CODEC_FLAG_PSNR - * - decoding: unused *) - error: array [0..3] of int64; - - (*** minimum MB quantizer. - * - encoding: unused - * - decoding: unused *) - mb_qmin: integer; - - (*** maximum MB quantizer. - * - encoding: unused - * - decoding: unused *) - mb_qmax: integer; - - (*** motion estimation compare function. - * - encoding: set by user. - * - decoding: unused *) - me_cmp: integer; - - (*** subpixel motion estimation compare function. - * - encoding: set by user. - * - decoding: unused *) - me_sub_cmp: integer; - (*** macroblock compare function (not supported yet). - * - encoding: set by user. - * - decoding: unused *) - mb_cmp: integer; - (*** interlaced dct compare function - * - encoding: set by user. - * - decoding: unused *) - ildct_cmp: integer; - (*** ME diamond size & shape. - * - encoding: set by user. - * - decoding: unused *) - dia_size: integer; - - (*** amount of previous MV predictors (2a+1 x 2a+1 square). - * - encoding: set by user. - * - decoding: unused *) - last_predictor_count: integer; - - (*** pre pass for motion estimation. - * - encoding: set by user. - * - decoding: unused *) - pre_me: integer; - - (*** motion estimation pre pass compare function. - * - encoding: set by user. - * - decoding: unused *) - me_pre_cmp: integer; - - (*** ME pre pass diamond size & shape. - * - encoding: set by user. - * - decoding: unused *) - pre_dia_size: integer; - - (*** subpel ME quality. - * - encoding: set by user. - * - decoding: unused *) - me_subpel_quality: integer; - - (*** callback to negotiate the pixelFormat. - * @param fmt is the list of formats which are supported by the codec, - * its terminated by -1 as 0 is a valid format, the formats are ordered by quality - * the first is allways the native one - * @return the choosen format - * - encoding: unused - * - decoding: set by user, if not set then the native format will always be choosen - *) - get_format: function (s: PAVCodecContext; const fmt: PAVPixelFormat): TAVPixelFormat; cdecl; - - (*** DTG active format information (additionnal aspect ratio - * information only used in DVB MPEG2 transport streams). 0 if - * not set. - * - encoding: unused. - * - decoding: set by decoder *) - dtg_active_format: integer; - - (*** Maximum motion estimation search range in subpel units. - * if 0 then no limit - * - encoding: set by user. - * - decoding: unused. *) - me_range: integer; - - (*** intra quantizer bias. - * - encoding: set by user. - * - decoding: unused *) - intra_quant_bias: integer; - - (*** inter quantizer bias. - * - encoding: set by user. - * - decoding: unused *) - inter_quant_bias: integer; - - (*** color table ID. - * - encoding: unused. - * - decoding: which clrtable should be used for 8bit RGB images - * table have to be stored somewhere FIXME *) - color_table_id: integer; - - (*** internal_buffer count. - * Don't touch, used by lavc default_get_buffer() *) - internal_buffer_count: integer; - - (*** internal_buffers. - * Don't touch, used by lavc default_get_buffer() *) - internal_buffer: pointer; - - (*** global quality for codecs which cannot change it per frame. - * this should be proportional to MPEG1/2/4 qscale. - * - encoding: set by user. - * - decoding: unused *) - global_quality: integer; - - (*** coder type - * - encoding: set by user. - * - decoding: unused *) - coder_type: integer; - - (*** context model - * - encoding: set by user. - * - decoding: unused *) - context_model: integer; - - (*** slice flags - * - encoding: unused - * - decoding: set by user. *) - slice_flags: integer; - - (*** XVideo Motion Acceleration - * - encoding: forbidden - * - decoding: set by decoder *) - xvmc_acceleration: integer; - - (*** macroblock decision mode - * - encoding: set by user. - * - decoding: unused *) - mb_decision: integer; - - (*** custom intra quantization matrix - * - encoding: set by user, can be NULL - * - decoding: set by lavc *) - intra_matrix: Pword; - - (*** custom inter quantization matrix - * - encoding: set by user, can be NULL - * - decoding: set by lavc *) - inter_matrix: Pword; - - (*** fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). - * this is used to workaround some encoder bugs - * - encoding: unused - * - decoding: set by user, will be converted to upper case by lavc during init *) - stream_codec_tag: array [0..3] of char; //cardinal; - - (*** scene change detection threshold. - * 0 is default, larger means fewer detected scene changes - * - encoding: set by user. - * - decoding: unused *) - scenechange_threshold: integer; - - (*** minimum lagrange multipler - * - encoding: set by user. - * - decoding: unused *) - lmin: integer; - - (*** maximum lagrange multipler - * - encoding: set by user. - * - decoding: unused *) - lmax: integer; - - (*** Palette control structure - * - encoding: ??? (no palette-enabled encoder yet) - * - decoding: set by user. *) - palctrl: PAVPaletteControl; - - (*** noise reduction strength - * - encoding: set by user. - * - decoding: unused *) - noise_reduction: integer; - - (*** called at the beginning of a frame to get cr buffer for it. - * buffer type (size, hints) must be the same. lavc won't check it. - * lavc will pass previous buffer in pic, function should return - * same buffer or new buffer with old frame "painted" into it. - * if pic.data[0] == NULL must behave like get_buffer(). - * - encoding: unused - * - decoding: set by lavc, user can override *) - reget_buffer: function (c: PAVCodecContext; pic: PAVFrame): integer; cdecl; - - (*** number of bits which should be loaded into the rc buffer before decoding starts - * - encoding: set by user. - * - decoding: unused *) - rc_initial_buffer_occupancy: integer; - inter_threshold: integer; - - (*** CODEC_FLAG2_*. - * - encoding: set by user. - * - decoding: set by user. *) - flags2: integer; - - (*** simulates errors in the bitstream to test error concealment. - * - encoding: set by user. - * - decoding: unused. *) - error_rate: integer; - - (*** MP3 antialias algorithm, see FF_AA_* below. - * - encoding: unused - * - decoding: set by user *) - antialias_algo: integer; - - (*** Quantizer noise shaping. - * - encoding: set by user - * - decoding: unused *) - quantizer_noise_shaping: integer; - - (*** Thread count. - * is used to decide how many independant tasks should be passed to execute() - * - encoding: set by user - * - decoding: set by user *) - thread_count: integer; - - (*** the codec may call this to execute several independant things. it will return only after - * finishing all tasks, the user may replace this with some multithreaded implementation, the - * default implementation will execute the parts serially - * @param count the number of things to execute - * - encoding: set by lavc, user can override - * - decoding: set by lavc, user can override *) - execute: function (c: PAVCodecContext; func: pointer; arg: PPointer; ret: PInteger; count: integer): integer; cdecl; - - (*** Thread opaque. - * can be used by execute() to store some per AVCodecContext stuff. - * - encoding: set by execute() - * - decoding: set by execute() *) - thread_opaque: pointer; - - (*** Motion estimation threshold. under which no motion estimation is - * performed, but instead the user specified motion vectors are used - * - encoding: set by user - * - decoding: unused *) - me_threshold: integer; - - (*** Macroblock threshold. under which the user specified macroblock types will be used - * - encoding: set by user - * - decoding: unused *) - mb_threshold: integer; - - (*** precision of the intra dc coefficient - 8. - * - encoding: set by user - * - decoding: unused *) - intra_dc_precision: integer; - - (*** noise vs. sse weight for the nsse comparsion function. - * - encoding: set by user - * - decoding: unused *) - nsse_weight: integer; - - (*** number of macroblock rows at the top which are skipped. - * - encoding: unused - * - decoding: set by user *) - skip_top: integer; - - (*** number of macroblock rows at the bottom which are skipped. - * - encoding: unused - * - decoding: set by user *) - skip_bottom: integer; - - (*** profile - * - encoding: set by user - * - decoding: set by lavc *) - profile: integer; - - (*** level - * - encoding: set by user - * - decoding: set by lavc *) - level: integer; - - (*** low resolution decoding. 1-> 1/2 size, 2->1/4 size - * - encoding: unused - * - decoding: set by user *) - lowres: integer; - - (*** bitsream width / height. may be different from width/height if lowres - * or other things are used - * - encoding: unused - * - decoding: set by user before init if known, codec should override / dynamically change if needed *) - coded_width, coded_height: integer; - - (*** frame skip threshold - * - encoding: set by user - * - decoding: unused *) - frame_skip_threshold: integer; - - (*** frame skip factor - * - encoding: set by user - * - decoding: unused *) - frame_skip_factor: integer; - - (*** frame skip exponent - * - encoding: set by user - * - decoding: unused *) - frame_skip_exp: integer; - - (*** frame skip comparission function - * - encoding: set by user. - * - decoding: unused *) - frame_skip_cmp: integer; - - (*** border processing masking. raises the quantizer for mbs on the borders - * of the picture. - * - encoding: set by user - * - decoding: unused *) - border_masking: single; - - (*** minimum MB lagrange multipler. - * - encoding: set by user. - * - decoding: unused *) - mb_lmin: integer; - - (*** maximum MB lagrange multipler. - * - encoding: set by user. - * - decoding: unused *) - mb_lmax: integer; - - (*** - * - encoding: set by user. - * - decoding: unused *) - me_penalty_compensation: integer; - - (*** - * - encoding: unused - * - decoding: set by user. *) - skip_loop_filter: TAVDiscard; - - (** * - * - encoding: unused - * - decoding: set by user. *) - skip_idct: TAVDiscard; - - (** * - * - encoding: unused - * - decoding: set by user. *) - skip_frame: TAVDiscard; - - (** * - * - encoding: set by user. - * - decoding: unused *) - bidir_refine: integer; - - (** * - * - encoding: set by user. - * - decoding: unused *) - brd_scale: integer; - - (** - * constant rate factor - quality-based VBR - values ~correspond to qps - * - encoding: set by user. - * - decoding: unused *) - crf: integer; - - (** - * constant quantization parameter rate control method - * - encoding: set by user. - * - decoding: unused *) - cqp: integer; - - (** - * minimum gop size - * - encoding: set by user. - * - decoding: unused *) - keyint_min: integer; - - (** - * number of reference frames - * - encoding: set by user. - * - decoding: unused *) - refs: integer; - - (** - * chroma qp offset from luma - * - encoding: set by user. - * - decoding: unused *) - chromaoffset: integer; - - (** - * influences how often b-frames are used - * - encoding: set by user. - * - decoding: unused *) - bframebias: integer; - - (** - * trellis RD quantization - * - encoding: set by user. - * - decoding: unused *) - trellis: integer; - - (** - * reduce fluctuations in qp (before curve compression) - * - encoding: set by user. - * - decoding: unused *) - complexityblur: single; - - (** - * in-loop deblocking filter alphac0 parameter - * alpha is in the range -6...6 - * - encoding: set by user. - * - decoding: unused *) - deblockalpha: integer; - - (** - * in-loop deblocking filter beta parameter - * beta is in the range -6...6 - * - encoding: set by user. - * - decoding: unused *) - deblockbeta: integer; - - (** - * macroblock subpartition sizes to consider - p8x8, p4x4, b8x8, i8x8, i4x4 - * - encoding: set by user. - * - decoding: unused *) - partitions: integer; - - (** - * direct mv prediction mode - 0 (none), 1 (spatial), 2 (temporal) - * - encoding: set by user. - * - decoding: unused *) - directpred: integer; - - (** - * audio cutoff bandwidth (0 means "automatic") . Currently used only by FAAC - * - encoding: set by user. - * - decoding: unused *) - cutoff: integer; - - (** - * multiplied by qscale for each frame and added to scene_change_score - * - encoding: set by user. - * - decoding: unused *) - scenechange_factor: integer; - - (** * - * note: value depends upon the compare functin used for fullpel ME - * - encoding: set by user. - * - decoding: unused *) - mv0_threshold: integer; - - (** - * adjusts sensitivity of b_frame_strategy 1 - * - encoding: set by user. - * - decoding: unused *) - b_sensitivity: integer; - - (** - * - encoding: set by user. - * - decoding: unused *) - compression_level: integer; - - (** - * sets whether to use LPC mode - used by FLAC encoder - * - encoding: set by user. - * - decoding: unused. *) - use_lpc: integer; - - (** - * LPC coefficient precision - used by FLAC encoder - * - encoding: set by user. - * - decoding: unused. *) - lpc_coeff_precision: integer; - - (** - * - encoding: set by user. - * - decoding: unused. *) - min_prediction_order: integer; - - (** - * - encoding: set by user. - * - decoding: unused. *) - max_prediction_order: integer; - - (** - * search method for selecting prediction order - * - encoding: set by user. - * - decoding: unused. *) - prediction_order_method: integer; - - (** - * - encoding: set by user. - * - decoding: unused. *) - min_partition_order: integer; - - (** - * - encoding: set by user. - * - decoding: unused. *) - max_partition_order: integer; - end; - -(** - * AVCodec. - *) - TAVCodec = record - name: pchar; - _type: TCodecType; - id: TCodecID; - priv_data_size: integer; - init: function (avctx: PAVCodecContext): integer; cdecl; (* typo corretion by the Creative CAT *) - encode: function (avctx: PAVCodecContext; buf: pchar; buf_size: integer; data: pointer): integer; cdecl; - close: function (avctx: PAVCodecContext): integer; cdecl; - decode: function (avctx: PAVCodecContext; outdata: pointer; outdata_size: PInteger; - buf: pchar; buf_size: integer): integer; cdecl; - capabilities: integer; -// todo: check this -> -// void *dummy; // FIXME remove next time we break binary compatibility - next: PAVCodec; - flush: procedure (avctx: PAVCodecContext); cdecl; - supported_framerates: PAVRational; ///array of supported framerates, or NULL if any, array is terminated by {0,0} - pix_fmts: PAVPixelFormat; ///array of supported pixel formats, or NULL if unknown, array is terminanted by -1 - end; - -(** - * four components are given, that's all. - * the last component is alpha - *) - PAVPicture = ^TAVPicture; - TAVPicture = record - data: array [0..3] of pchar; - linesize: array [0..3] of integer; ///< number of bytes per line - end; - -(** - * AVPaletteControl - * This structure defines a method for communicating palette changes - * between and demuxer and a decoder. - * this is totally broken, palette changes should be sent as AVPackets - *) - TAVPaletteControl = record - (* demuxer sets this to 1 to indicate the palette has changed; - * decoder resets to 0 *) - palette_changed: integer; - - (* 4-byte ARGB palette entries, stored in native byte order; note that - * the individual palette components should be on a 8-bit scale; if - * the palette data comes from a IBM VGA native format, the component - * data is probably 6 bits in size and needs to be scaled *) - palette: array [0..AVPALETTE_COUNT - 1] of cardinal; - end; - - PAVSubtitleRect = ^TAVSubtitleRect; - TAVSubtitleRect = record - x: word; - y: word; - w: word; - h: word; - nb_colors: word; - linesize: integer; - rgba_palette: PCardinal; - bitmap: pchar; - end; - - PAVSubtitle = ^TAVSubtitle; - TAVSubtitle = record {20} - format: word; (* 0 = graphics *) - start_display_time: cardinal; (* relative to packet pts, in ms *) - end_display_time: cardinal; (* relative to packet pts, in ms *) - num_rects: cardinal; - rects: PAVSubtitleRect; - end; - - -(* resample.c *) - - PReSampleContext = pointer; - PAVResampleContext = pointer; - PImgReSampleContext = pointer; - -function audio_resample_init (output_channels: integer; input_channels: integer; - output_rate: integer; input_rate: integer): PReSampleContext; - cdecl; external av__codec; - -function audio_resample (s: PReSampleContext; output: PWord; input: PWord; nb_samples: integer): integer; - cdecl; external av__codec; - -procedure audio_resample_close (s: PReSampleContext); - cdecl; external av__codec; - - -function av_resample_init (out_rate: integer; in_rate: integer; filter_length: integer; - log2_phase_count: integer; linear: integer; cutoff: double): PAVResampleContext; - cdecl; external av__codec; - -function av_resample (c: PAVResampleContext; dst: PWord; src: PWord; consumed: PInteger; - src_size: integer; dst_size: integer; update_ctx: integer): integer; - cdecl; external av__codec; - -procedure av_resample_compensate (c: PAVResampleContext; sample_delta: integer; - compensation_distance: integer); - cdecl; external av__codec; - -procedure av_resample_close (c: PAVResampleContext); - cdecl; external av__codec; - - -(* YUV420 format is assumed ! *) - - function img_resample_init (output_width: integer; output_height: integer; - input_width: integer; input_height: integer): PImgReSampleContext; - cdecl; external av__codec; - - function img_resample_full_init (owidth: integer; oheight: integer; - iwidth: integer; iheight: integer; - topBand: integer; bottomBand: integer; - leftBand: integer; rightBand: integer; - padtop: integer; padbottom: integer; - padleft: integer; padright: integer): PImgReSampleContext; - cdecl; external av__codec; - - procedure img_resample (s: PImgReSampleContext; output: PAVPicture; const input: PAVPicture); - cdecl; external av__codec; - - procedure img_resample_close (s: PImgReSampleContext); - cdecl; external av__codec; - -(** - * Allocate memory for a picture. Call avpicture_free to free it. - * - * @param picture the picture to be filled in. - * @param pix_fmt the format of the picture. - * @param width the width of the picture. - * @param height the height of the picture. - * @return 0 if successful, -1 if not. - *) - function avpicture_alloc (picture: PAVPicture; pix_fmt: TAVPixelFormat; - width: integer; height: integer): integer; - cdecl; external av__codec; - - -(* Free a picture previously allocated by avpicture_alloc. *) - procedure avpicture_free (picture: PAVPicture); - cdecl; external av__codec; - - function avpicture_fill (picture: PAVPicture; ptr: pointer; - pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; - cdecl; external av__codec; - - function avpicture_layout (const src: PAVPicture; pix_fmt: TAVPixelFormat; - width: integer; height: integer; - dest: pchar; dest_size: integer): integer; - cdecl; external av__codec; - - function avpicture_get_size (pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; - cdecl; external av__codec; - - procedure avcodec_get_chroma_sub_sample (pix_fmt: TAVPixelFormat; h_shift: Pinteger; v_shift: pinteger); - cdecl; external av__codec; - - function avcodec_get_pix_fmt_name(pix_fmt: TAVPixelFormat): pchar; - cdecl; external av__codec; - - procedure avcodec_set_dimensions(s: PAVCodecContext; width: integer; height: integer); - cdecl; external av__codec; - - function avcodec_get_pix_fmt(const name: pchar): TAVPixelFormat; - cdecl; external av__codec; - - function avcodec_pix_fmt_to_codec_tag(p: TAVPixelFormat): cardinal; - cdecl; external av__codec; - - function avcodec_get_pix_fmt_loss (dst_pix_fmt: TAVPixelFormat; src_pix_fmt: TAVPixelFormat; - has_alpha: integer): integer; - cdecl; external av__codec; - - function avcodec_find_best_pix_fmt (pix_fmt_mask: integer; src_pix_fmt: TAVPixelFormat; - has_alpha: integer; loss_ptr: pinteger): integer; - cdecl; external av__codec; - - function img_get_alpha_info (const src: PAVPicture; - pix_fmt: TAVPixelFormat; - width: integer; height: integer): integer; - cdecl; external av__codec; - - -(* convert among pixel formats *) - function img_convert (dst: PAVPicture; dst_pix_fmt: TAVPixelFormat; - const src: PAVPicture; pix_fmt: TAVPixelFormat; - width: integer; height: integer): integer; - cdecl; external av__codec; - -(* deinterlace a picture *) - function avpicture_deinterlace (dst: PAVPicture; const src: PAVPicture; - pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; - cdecl; external av__codec; - -(* returns LIBAVCODEC_VERSION_INT constant *) - function avcodec_version (): cardinal; - cdecl; external av__codec; - -(* returns LIBAVCODEC_BUILD constant *) - function avcodec_build (): cardinal; - cdecl; external av__codec; - - procedure avcodec_init (); - cdecl; external av__codec; - - procedure register_avcodec (format: PAVCodec); - cdecl; external av__codec; - - function avcodec_find_encoder (id: TCodecID): PAVCodec; - cdecl; external av__codec; - function avcodec_find_encoder_by_name (name: pchar): PAVCodec; - cdecl; external av__codec; - function avcodec_find_decoder(id: TCodecID): PAVCodec; - cdecl; external av__codec; - function avcodec_find_decoder_by_name (name: pchar): PAVCodec; - cdecl; external av__codec; - procedure avcodec_string(buf: pchar; buf_size: integer; enc: PAVCodecContext; encode: integer); - cdecl; external av__codec; - - procedure avcodec_get_context_defaults (s: PAVCodecContext); - cdecl; external av__codec; - function avcodec_alloc_context : PAVCodecContext; - cdecl; external av__codec; -(* favourite of The Creative CAT - function avcodec_alloc_context (): PAVCodecContext; - cdecl; external av__codec; *) - procedure avcodec_get_frame_defaults (pic: PAVFrame); - cdecl; external av__codec; - function avcodec_alloc_frame : PAVFrame; - cdecl; external av__codec; -(* favourite of The Creative CAT - function avcodec_alloc_frame (): PAVFrame; - cdecl; external av__codec; *) - - function avcodec_default_get_buffer (s: PAVCodecContext; pic: PAVFrame): integer; - cdecl; external av__codec; - procedure avcodec_default_release_buffer (s: PAVCodecContext; pic: PAVFrame); - cdecl; external av__codec; - function avcodec_default_reget_buffer (s: PAVCodecContext; pic: PAVFrame): integer; - cdecl; external av__codec; - procedure avcodec_align_dimensions(s: PAVCodecContext; width: Pinteger; height: PInteger); - cdecl; external av__codec; - function avcodec_check_dimensions (av_log_ctx: pointer; w: cardinal; h: cardinal): integer; - cdecl; external av__codec; - function avcodec_default_get_format(s: PAVCodecContext; const fmt: PAVPixelFormat): TAVPixelFormat; - cdecl; external av__codec; - - function avcodec_thread_init (s: PAVCodecContext; thread_count: integer): integer; - cdecl; external av__codec; - procedure avcodec_thread_free (s: PAVCodecContext); - cdecl; external av__codec; - function avcodec_thread_execute (s: PAVCodecContext; func: pointer; arg: PPointer; ret: Pinteger; count: integer): integer; - cdecl; external av__codec; - function avcodec_default_execute (s: PAVCodecContext; func: pointer; arg: PPointer; ret: Pinteger; count: integer): integer; - cdecl; external av__codec; - - -//FIXME func typedef - -(** - * opens / inits the AVCodecContext. - * not thread save! - *) - function avcodec_open (avctx: PAVCodecContext; codec: PAVCodec): integer; - cdecl; external av__codec; - - -(** - * Decode an audio frame. - * - * @param avctx the codec context. - * @param samples output buffer, 16 byte aligned - * @param frame_size_ptr the output buffer size in bytes, zero if no frame could be compressed - * @param buf input buffer, 16 byte aligned - * @param buf_size the input buffer size - * @return 0 if successful, -1 if not. - *) - -(** This comment was added by the Creative CAT. frame_size_ptr was changed to - variable refference. - - * @deprecated Use avcodec_decode_audio2() instead. - *) - - function avcodec_decode_audio (avctx: PAVCodecContext; samples: Pword; - var frame_size_ptr: integer; - buf: pchar; buf_size: integer): integer; - cdecl; external av__codec; -(* decode a frame. - * @param buf bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE larger then the actual read bytes - * because some optimized bitstream readers read 32 or 64 bit at once and could read over the end - * @param buf_size the size of the buffer in bytes - * @param got_picture_ptr zero if no frame could be decompressed, Otherwise, it is non zero - * @return -1 if error, otherwise return the number of - * bytes used. *) - - function avcodec_decode_audio2(avctx : PAVCodecContext; samples : PWord; - var frame_size_ptr : integer; - buf: pchar; buf_size: integer): integer; - cdecl; external av__codec; -(* Added by The Creative CAT -/** - * Decodes a video frame from \p buf into \p picture. - * The avcodec_decode_video() function decodes a video frame from the input - * buffer \p buf of size \p buf_size. To decode it, it makes use of the - * video codec which was coupled with \p avctx using avcodec_open(). The - * resulting decoded frame is stored in \p picture. - * - * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than - * the actual read bytes because some optimized bitstream readers read 32 or 64 - * bits at once and could read over the end. - * - * @warning The end of the input buffer \p buf should be set to 0 to ensure that - * no overreading happens for damaged MPEG streams. - * - * @note You might have to align the input buffer \p buf and output buffer \p - * samples. The alignment requirements depend on the CPU: on some CPUs it isn't - * necessary at all, on others it won't work at all if not aligned and on others - * it will work but it will have an impact on performance. In practice, the - * bitstream should have 4 byte alignment at minimum and all sample data should - * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If - * the linesize is not a multiple of 16 then there's no sense in aligning the - * start of the buffer to 16. - * - * @param avctx the codec context - * @param[out] picture The AVFrame in which the decoded video frame will be stored. - * @param[in] buf the input buffer - * @param[in] buf_size the size of the input buffer in bytes - * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. - * @return On error a negative value is returned, otherwise the number of bytes - * used or zero if no frame could be decompressed. - */ -*) - - function avcodec_decode_video (avctx: PAVCodecContext; picture: PAVFrame; - var got_picture_ptr: integer; (* favour of The Creative CAT *) - buf: PByte; buf_size: integer): integer; - cdecl; external av__codec; - - function avcodec_decode_subtitle (avctx: PAVCodecContext; sub: PAVSubtitle; - got_sub_ptr: pinteger; - const buf: pchar; buf_size: integer): integer; - cdecl; external av__codec; - function avcodec_parse_frame (avctx: PAVCodecContext; pdata: PPointer; - data_size_ptr: pinteger; - buf: pchar; buf_size: integer): integer; - cdecl; external av__codec; - - function avcodec_encode_audio (avctx: PAVCodecContext; buf: PByte; - buf_size: integer; const samples: PWord): integer; - cdecl; external av__codec; - - (* avcodec_encode_video: -1 if error *) - (* type of the second argument is changed by The Creative CAT *) - function avcodec_encode_video (avctx: PAVCodecContext; buf: PByte; - buf_size: integer; pict: PAVFrame): integer; - cdecl; external av__codec; - function avcodec_encode_subtitle (avctx: PAVCodecContext; buf: pchar; - buf_size: integer; const sub: PAVSubtitle): integer; - cdecl; external av__codec; - function avcodec_close (avctx: PAVCodecContext): integer; - cdecl; external av__codec; - - procedure avcodec_register_all (); - cdecl; external av__codec; - - procedure avcodec_flush_buffers (avctx: PAVCodecContext); - cdecl; external av__codec; - procedure avcodec_default_free_buffers (s: PAVCodecContext); - cdecl; external av__codec; - -(* misc usefull functions *) - -(** - * returns a single letter to describe the picture type - *) - function av_get_pict_type_char (pict_type: integer): char; - cdecl; external av__codec; - - -(** - * returns codec bits per sample - *) -function av_get_bits_per_sample (codec_id: TCodecID): integer; - cdecl; external av__codec; - -const - AV_PARSER_PTS_NB = 4; - PARSER_FLAG_COMPLETE_FRAMES = $0001; - -type - PAVCodecParserContext = ^TAVCodecParserContext; - PAVCodecParser = ^TAVCodecParser; - - TAVCodecParserContext = record - priv_data: pointer; - parser: PAVCodecParser; - frame_offset: int64; (* offset of the current frame *) - cur_offset: int64; (* current offset (incremented by each av_parser_parse()) *) - last_frame_offset: int64; (* offset of the last frame *) - (* video info *) - pict_type: integer; (* XXX: put it back in AVCodecContext *) - repeat_pict: integer; (* XXX: put it back in AVCodecContext *) - pts: int64; (* pts of the current frame *) - dts: int64; (* dts of the current frame *) - - (* private data *) - last_pts: int64; - last_dts: int64; - fetch_timestamp: integer; - - cur_frame_start_index: integer; - cur_frame_offset: array [0..AV_PARSER_PTS_NB - 1] of int64; - cur_frame_pts: array [0..AV_PARSER_PTS_NB - 1] of int64; - cur_frame_dts: array [0..AV_PARSER_PTS_NB - 1] of int64; - - flags: integer; - end; - - TAVCodecParser = record - codec_ids: array [0..4] of integer; (* several codec IDs are permitted *) - priv_data_size: integer; - parser_init: function (s: PAVCodecParserContext): integer; cdecl; - parser_parse: function (s: PAVCodecParserContext; avctx: PAVCodecContext; - poutbuf: PPointer; poutbuf_size: PInteger; - const buf: pchar; buf_size: integer): integer; cdecl; - parser_close: procedure (s: PAVCodecParserContext); cdecl; - split: function (avctx: PAVCodecContext; const buf: pchar; - buf_size: integer): integer; cdecl; - next: PAVCodecParser; - end; - - procedure av_register_codec_parser (parser: PAVCodecParser); - cdecl; external av__codec; - - function av_parser_init (codec_id: integer): PAVCodecParserContext; - cdecl; external av__codec; - - function av_parser_parse (s: PAVCodecParserContext; - avctx: PAVCodecContext; - poutbuf: PPointer; poutbuf_size: pinteger; - const buf: pchar; buf_size: integer; - pts: int64; dts: int64): integer; - cdecl; external av__codec; - function av_parser_change (s: PAVCodecParserContext; - avctx: PAVCodecContext; - poutbuf: PPointer; poutbuf_size: PInteger; - const buf: pchar; buf_size: integer; keyframe: integer): integer; - cdecl; external av__codec; - procedure av_parser_close (s: PAVCodecParserContext); - cdecl; external av__codec; - -type - PAVBitStreamFilterContext = ^TAVBitStreamFilterContext; - PAVBitStreamFilter = ^TAVBitStreamFilter; - - TAVBitStreamFilterContext = record - priv_data: pointer; - filter: PAVBitStreamFilter; - parser: PAVCodecParserContext; - next: PAVBitStreamFilterContext; - end; - - TAVBitStreamFilter = record - name: pchar; - priv_data_size: integer; - filter: function (bsfc: PAVBitStreamFilterContext; - avctx: PAVCodecContext; args: pchar; - poutbuf: PPointer; poutbuf_size: PInteger; - buf: PByte; buf_size: integer; keyframe: integer): integer; cdecl; - next: PAVBitStreamFilter; - end; - -procedure av_register_bitstream_filter (bsf: PAVBitStreamFilter); - cdecl; external av__codec; - -function av_bitstream_filter_init (name: pchar): PAVBitStreamFilterContext; - cdecl; external av__codec; - -function av_bitstream_filter_filter (bsfc: PAVBitStreamFilterContext; - avctx: PAVCodecContext; args: pchar; - poutbuf: PPointer; poutbuf_size: PInteger; - buf: PByte; buf_size: integer; keyframe: integer): integer; - cdecl; external av__codec; -procedure av_bitstream_filter_close (bsf: PAVBitStreamFilterContext); - cdecl; external av__codec; - - -(* memory *) - procedure av_fast_realloc (ptr: pointer; size: PCardinal; min_size: Cardinal); - cdecl; external av__codec; -(* for static data only *) -(* call av_free_static to release all staticaly allocated tables *) - procedure av_free_static (); - cdecl; external av__codec; - - procedure av_mallocz_static(size: cardinal); - cdecl; external av__codec; - - procedure av_realloc_static(ptr: pointer; size: Cardinal); - cdecl; external av__codec; - - procedure img_copy (dst: PAVPicture; const src: PAVPicture; - pix_fmt: TAVPixelFormat; width: integer; height: integer); - cdecl; external av__codec; - - function img_crop (dst: PAVPicture; const src: PAVPicture; - pix_fmt: TAVPixelFormat; top_band, left_band: integer): integer; - cdecl; external av__codec; - - function img_pad (dst: PAVPicture; const src: PAVPicture; height, width: integer; - pix_fmt: TAVPixelFormat; padtop, padbottom, padleft, padright: integer; - color: PInteger): integer; - cdecl; external av__codec; - -implementation - -end. +(* + * copyright (c) 2001 Fabrice Bellard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + *) + +(* This is a part of Pascal porting of ffmpeg. + * Originally by Victor Zinetz for Delphi and Free Pascal on Windows. + * For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT + * in the source codes *) + +// Min. version: 51.16.0 +// Max. version: 51.49.0, Revision: 11352 + +unit avcodec; + +{$IFDEF FPC} + {$MODE DELPHI } + {$PACKENUM 4} (* use 4-byte enums *) + {$PACKRECORDS C} (* C/C++-compatible record packing *) +{$ELSE} + {$MINENUMSIZE 4} (* use 4-byte enums *) +{$ENDIF} + +interface + +uses + avutil, + rational, + opt, + UConfig; + +const + (* Max. supported version by this header *) + LIBAVCODEC_MAX_VERSION_MAJOR = 51; + LIBAVCODEC_MAX_VERSION_MINOR = 49; + LIBAVCODEC_MAX_VERSION_RELEASE = 0; + LIBAVCODEC_MAX_VERSION = (LIBAVCODEC_MAX_VERSION_MAJOR * VERSION_MAJOR) + + (LIBAVCODEC_MAX_VERSION_MINOR * VERSION_MINOR) + + (LIBAVCODEC_MAX_VERSION_RELEASE * VERSION_RELEASE); + +(* Check if linked version is supported *) +{$IF (LIBAVCODEC_VERSION > LIBAVCODEC_MAX_VERSION)} + {$MESSAGE Warn 'Linked version of libavcodec may be unsupported!'} +{$IFEND} + +const + AV_NOPTS_VALUE: int64 = $8000000000000000; + AV_TIME_BASE = 1000000; + AV_TIME_BASE_Q : TAVRational = (num:1; den:AV_TIME_BASE); (* added by CAT *) + +(** + * Identifies the syntax and semantics of the bitstream. + * The principle is roughly: + * Two decoders with the same ID can decode the same streams. + * Two encoders with the same ID can encode compatible streams. + * There may be slight deviations from the principle due to implementation + * details. + * + * If you add a codec ID to this list, add it so that + * 1. no value of a existing codec ID changes (that would break ABI), + * 2. it is as close as possible to similar codecs. + *) +type + TCodecID = ( + CODEC_ID_NONE, + CODEC_ID_MPEG1VIDEO, + CODEC_ID_MPEG2VIDEO, //* prefered ID for MPEG Video 1/2 decoding */ + CODEC_ID_MPEG2VIDEO_XVMC, + CODEC_ID_H261, + CODEC_ID_H263, + CODEC_ID_RV10, + CODEC_ID_RV20, + CODEC_ID_MJPEG, + CODEC_ID_MJPEGB, + CODEC_ID_LJPEG, + CODEC_ID_SP5X, + CODEC_ID_JPEGLS, + CODEC_ID_MPEG4, + CODEC_ID_RAWVIDEO, + CODEC_ID_MSMPEG4V1, + CODEC_ID_MSMPEG4V2, + CODEC_ID_MSMPEG4V3, + CODEC_ID_WMV1, + CODEC_ID_WMV2, + CODEC_ID_H263P, + CODEC_ID_H263I, + CODEC_ID_FLV1, + CODEC_ID_SVQ1, + CODEC_ID_SVQ3, + CODEC_ID_DVVIDEO, + CODEC_ID_HUFFYUV, + CODEC_ID_CYUV, + CODEC_ID_H264, + CODEC_ID_INDEO3, + CODEC_ID_VP3, + CODEC_ID_THEORA, + CODEC_ID_ASV1, + CODEC_ID_ASV2, + CODEC_ID_FFV1, + CODEC_ID_4XM, + CODEC_ID_VCR1, + CODEC_ID_CLJR, + CODEC_ID_MDEC, + CODEC_ID_ROQ, + CODEC_ID_INTERPLAY_VIDEO, + CODEC_ID_XAN_WC3, + CODEC_ID_XAN_WC4, + CODEC_ID_RPZA, + CODEC_ID_CINEPAK, + CODEC_ID_WS_VQA, + CODEC_ID_MSRLE, + CODEC_ID_MSVIDEO1, + CODEC_ID_IDCIN, + CODEC_ID_8BPS, + CODEC_ID_SMC, + CODEC_ID_FLIC, + CODEC_ID_TRUEMOTION1, + CODEC_ID_VMDVIDEO, + CODEC_ID_MSZH, + CODEC_ID_ZLIB, + CODEC_ID_QTRLE, + CODEC_ID_SNOW, + CODEC_ID_TSCC, + CODEC_ID_ULTI, + CODEC_ID_QDRAW, + CODEC_ID_VIXL, + CODEC_ID_QPEG, + CODEC_ID_XVID, + CODEC_ID_PNG, + CODEC_ID_PPM, + CODEC_ID_PBM, + CODEC_ID_PGM, + CODEC_ID_PGMYUV, + CODEC_ID_PAM, + CODEC_ID_FFVHUFF, + CODEC_ID_RV30, + CODEC_ID_RV40, + CODEC_ID_VC1, + CODEC_ID_WMV3, + CODEC_ID_LOCO, + CODEC_ID_WNV1, + CODEC_ID_AASC, + CODEC_ID_INDEO2, + CODEC_ID_FRAPS, + CODEC_ID_TRUEMOTION2, + CODEC_ID_BMP, + CODEC_ID_CSCD, + CODEC_ID_MMVIDEO, + CODEC_ID_ZMBV, + CODEC_ID_AVS, + CODEC_ID_SMACKVIDEO, + CODEC_ID_NUV, + CODEC_ID_KMVC, + CODEC_ID_FLASHSV, + CODEC_ID_CAVS, + CODEC_ID_JPEG2000, + CODEC_ID_VMNC, + CODEC_ID_VP5, + CODEC_ID_VP6, + CODEC_ID_VP6F, + CODEC_ID_TARGA, + CODEC_ID_DSICINVIDEO, + CODEC_ID_TIERTEXSEQVIDEO, + CODEC_ID_TIFF, + CODEC_ID_GIF, + CODEC_ID_FFH264, + CODEC_ID_DXA, + CODEC_ID_DNXHD, + CODEC_ID_THP, + CODEC_ID_SGI, + CODEC_ID_C93, + CODEC_ID_BETHSOFTVID, + CODEC_ID_PTX, + CODEC_ID_TXD, + CODEC_ID_VP6A, + CODEC_ID_AMV, + CODEC_ID_VB, + CODEC_ID_PCX, + CODEC_ID_SUNRAST, + + //* various PCM "codecs" */ + CODEC_ID_PCM_S16LE= $10000, + CODEC_ID_PCM_S16BE, + CODEC_ID_PCM_U16LE, + CODEC_ID_PCM_U16BE, + CODEC_ID_PCM_S8, + CODEC_ID_PCM_U8, + CODEC_ID_PCM_MULAW, + CODEC_ID_PCM_ALAW, + CODEC_ID_PCM_S32LE, + CODEC_ID_PCM_S32BE, + CODEC_ID_PCM_U32LE, + CODEC_ID_PCM_U32BE, + CODEC_ID_PCM_S24LE, + CODEC_ID_PCM_S24BE, + CODEC_ID_PCM_U24LE, + CODEC_ID_PCM_U24BE, + CODEC_ID_PCM_S24DAUD, + CODEC_ID_PCM_ZORK, + CODEC_ID_PCM_S16LE_PLANAR, + + //* various ADPCM codecs */ + CODEC_ID_ADPCM_IMA_QT= $11000, + CODEC_ID_ADPCM_IMA_WAV, + CODEC_ID_ADPCM_IMA_DK3, + CODEC_ID_ADPCM_IMA_DK4, + CODEC_ID_ADPCM_IMA_WS, + CODEC_ID_ADPCM_IMA_SMJPEG, + CODEC_ID_ADPCM_MS, + CODEC_ID_ADPCM_4XM, + CODEC_ID_ADPCM_XA, + CODEC_ID_ADPCM_ADX, + CODEC_ID_ADPCM_EA, + CODEC_ID_ADPCM_G726, + CODEC_ID_ADPCM_CT, + CODEC_ID_ADPCM_SWF, + CODEC_ID_ADPCM_YAMAHA, + CODEC_ID_ADPCM_SBPRO_4, + CODEC_ID_ADPCM_SBPRO_3, + CODEC_ID_ADPCM_SBPRO_2, + CODEC_ID_ADPCM_THP, + CODEC_ID_ADPCM_IMA_AMV, + CODEC_ID_ADPCM_EA_R1, + CODEC_ID_ADPCM_EA_R3, + CODEC_ID_ADPCM_EA_R2, + CODEC_ID_ADPCM_IMA_EA_SEAD, + CODEC_ID_ADPCM_IMA_EA_EACS, + CODEC_ID_ADPCM_EA_XAS, + + //* AMR */ + CODEC_ID_AMR_NB= $12000, + CODEC_ID_AMR_WB, + + //* RealAudio codecs*/ + CODEC_ID_RA_144= $13000, + CODEC_ID_RA_288, + + //* various DPCM codecs */ + CODEC_ID_ROQ_DPCM= $14000, + CODEC_ID_INTERPLAY_DPCM, + CODEC_ID_XAN_DPCM, + CODEC_ID_SOL_DPCM, + + CODEC_ID_MP2= $15000, + CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3 + CODEC_ID_AAC, + {$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 + _CODEC_ID_MPEG4AAC, // will be redefined to CODEC_ID_AAC below + {$IFEND} + CODEC_ID_AC3, + CODEC_ID_DTS, + CODEC_ID_VORBIS, + CODEC_ID_DVAUDIO, + CODEC_ID_WMAV1, + CODEC_ID_WMAV2, + CODEC_ID_MACE3, + CODEC_ID_MACE6, + CODEC_ID_VMDAUDIO, + CODEC_ID_SONIC, + CODEC_ID_SONIC_LS, + CODEC_ID_FLAC, + CODEC_ID_MP3ADU, + CODEC_ID_MP3ON4, + CODEC_ID_SHORTEN, + CODEC_ID_ALAC, + CODEC_ID_WESTWOOD_SND1, + CODEC_ID_GSM, ///< as in Berlin toast format + CODEC_ID_QDM2, + CODEC_ID_COOK, + CODEC_ID_TRUESPEECH, + CODEC_ID_TTA, + CODEC_ID_SMACKAUDIO, + CODEC_ID_QCELP, + CODEC_ID_WAVPACK, + CODEC_ID_DSICINAUDIO, + CODEC_ID_IMC, + CODEC_ID_MUSEPACK7, + CODEC_ID_MLP, + CODEC_ID_GSM_MS, { as found in WAV } + CODEC_ID_ATRAC3, + CODEC_ID_VOXWARE, + CODEC_ID_APE, + CODEC_ID_NELLYMOSER, + CODEC_ID_MUSEPACK8, + + //* subtitle codecs */ + CODEC_ID_DVD_SUBTITLE= $17000, + CODEC_ID_DVB_SUBTITLE, + CODEC_ID_TEXT, ///< raw UTF-8 text + CODEC_ID_XSUB, + CODEC_ID_SSA, + + CODEC_ID_MPEG2TS= $20000, {*< _FAKE_ codec to indicate a raw MPEG-2 TS + * stream (only used by libavformat) *} + __CODEC_ID_4BYTE = $FFFFF // ensure 4-byte enum + ); + +{* CODEC_ID_MP3LAME is obsolete *} +const + {$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 + CODEC_ID_MP3LAME = CODEC_ID_MP3; + CODEC_ID_MPEG4AAC = CODEC_ID_AAC; + {$IFEND} + +type + TCodecType = ( + CODEC_TYPE_UNKNOWN = -1, + CODEC_TYPE_VIDEO, + CODEC_TYPE_AUDIO, + CODEC_TYPE_DATA, + CODEC_TYPE_SUBTITLE, + CODEC_TYPE_NB + ); + +{** + * currently unused, may be used if 24/32 bits samples ever supported */ + * all in native endian + *} +type + TSampleFormat = ( + SAMPLE_FMT_NONE = -1, + SAMPLE_FMT_U8, ///< unsigned 8 bits + SAMPLE_FMT_S16, ///< signed 16 bits + SAMPLE_FMT_S24, ///< signed 24 bits + SAMPLE_FMT_S32, ///< signed 32 bits + SAMPLE_FMT_FLT ///< float + ); + +const + {* in bytes *} + AVCODEC_MAX_AUDIO_FRAME_SIZE = 192000; // 1 second of 48khz 32bit audio + +{** + * Required number of additionally allocated bytes at the end of the input bitstream for decoding. + * This is mainly needed because some optimized bitstream readers read + * 32 or 64 bit at once and could read over the end.
+ * Note: If the first 23 bits of the additional bytes are not 0, then damaged + * MPEG bitstreams could cause overread and segfault. + *} + FF_INPUT_BUFFER_PADDING_SIZE = 8; + +{** + * minimum encoding buffer size. + * Used to avoid some checks during header writing. + *} + FF_MIN_BUFFER_SIZE = 16384; + +type +{* + * motion estimation type. + *} + TMotion_Est_ID = ( + ME_ZERO = 1, ///< no search, that is use 0,0 vector whenever one is needed + ME_FULL, + ME_LOG, + ME_PHODS, + ME_EPZS, ///< enhanced predictive zonal search + ME_X1, ///< reserved for experiments + ME_HEX, ///< hexagon based search + ME_UMH, ///< uneven multi-hexagon search + ME_ITER ///< iterative search + ); + + TAVDiscard = ( + {* We leave some space between them for extensions (drop some + * keyframes for intra-only or drop just some bidir frames). *} + AVDISCARD_NONE =-16, ///< discard nothing + AVDISCARD_DEFAULT= 0, ///< discard useless packets like 0 size packets in avi + AVDISCARD_NONREF = 8, ///< discard all non reference + AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames + AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes + AVDISCARD_ALL = 48 ///< discard all + ); + + PRcOverride = ^TRcOverride; + TRcOverride = record {16} + start_frame: integer; + end_frame: integer; + qscale: integer; // if this is 0 then quality_factor will be used instead + quality_factor: single; + end; + +const + FF_MAX_B_FRAMES = 16; + +{* encoding support + These flags can be passed in AVCodecContext.flags before initialization. + Note: Not everything is supported yet. +*} + + CODEC_FLAG_QSCALE = $0002; ///< Use fixed qscale. + CODEC_FLAG_4MV = $0004; ///< 4 MV per MB allowed / advanced prediction for H263. + CODEC_FLAG_QPEL = $0010; ///< use qpel MC. + CODEC_FLAG_GMC = $0020; ///< use GMC. + CODEC_FLAG_MV0 = $0040; ///< always try a MB with MV=<0,0>. + CODEC_FLAG_PART = $0080; ///< Use data partitioning. + {** + * The parent program guarantees that the input for B-frames containing + * streams is not written to for at least s->max_b_frames+1 frames, if + * this is not set the input will be copied. + *} + CODEC_FLAG_INPUT_PRESERVED = $0100; + CODEC_FLAG_PASS1 = $0200; ///< use internal 2pass ratecontrol in first pass mode + CODEC_FLAG_PASS2 = $0400; ///< use internal 2pass ratecontrol in second pass mode + CODEC_FLAG_EXTERN_HUFF = $1000; ///< use external huffman table (for mjpeg) + CODEC_FLAG_GRAY = $2000; ///< only decode/encode grayscale + CODEC_FLAG_EMU_EDGE = $4000; ///< don't draw edges + CODEC_FLAG_PSNR = $8000; ///< error[?] variables will be set during encoding + CODEC_FLAG_TRUNCATED = $00010000; //** input bitstream might be truncated at a random location instead + // of only at frame boundaries */ + CODEC_FLAG_NORMALIZE_AQP = $00020000; ///< normalize adaptive quantization + CODEC_FLAG_INTERLACED_DCT = $00040000; ///< use interlaced dct + CODEC_FLAG_LOW_DELAY = $00080000; ///< force low delay + CODEC_FLAG_ALT_SCAN = $00100000; ///< use alternate scan + CODEC_FLAG_TRELLIS_QUANT = $00200000; ///< use trellis quantization + CODEC_FLAG_GLOBAL_HEADER = $00400000; ///< place global headers in extradata instead of every keyframe + CODEC_FLAG_BITEXACT = $00800000; ///< use only bitexact stuff (except (i)dct) + {* Fx : Flag for h263+ extra options *} + {$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 + CODEC_FLAG_H263P_AIC = $01000000; ///< H263 Advanced intra coding / MPEG4 AC prediction (remove this) + {$IFEND} + CODEC_FLAG_AC_PRED = $01000000; ///< H263 Advanced intra coding / MPEG4 AC prediction + CODEC_FLAG_H263P_UMV = $02000000; ///< Unlimited motion vector + CODEC_FLAG_CBP_RD = $04000000; ///< use rate distortion optimization for cbp + CODEC_FLAG_QP_RD = $08000000; ///< use rate distortion optimization for qp selectioon + CODEC_FLAG_H263P_AIV = $00000008; ///< H263 Alternative inter vlc + CODEC_FLAG_OBMC = $00000001; ///< OBMC + CODEC_FLAG_LOOP_FILTER = $00000800; ///< loop filter + CODEC_FLAG_H263P_SLICE_STRUCT = $10000000; + CODEC_FLAG_INTERLACED_ME = $20000000; ///< interlaced motion estimation + CODEC_FLAG_SVCD_SCAN_OFFSET = $40000000; ///< will reserve space for SVCD scan offset user data + CODEC_FLAG_CLOSED_GOP = $80000000; + CODEC_FLAG2_FAST = $00000001; ///< allow non spec compliant speedup tricks + CODEC_FLAG2_STRICT_GOP = $00000002; ///< strictly enforce GOP size + CODEC_FLAG2_NO_OUTPUT = $00000004; ///< skip bitstream encoding + CODEC_FLAG2_LOCAL_HEADER = $00000008; ///< place global headers at every keyframe instead of in extradata + CODEC_FLAG2_BPYRAMID = $00000010; ///< H.264 allow b-frames to be used as references + CODEC_FLAG2_WPRED = $00000020; ///< H.264 weighted biprediction for b-frames + CODEC_FLAG2_MIXED_REFS = $00000040; ///< H.264 multiple references per partition + CODEC_FLAG2_8X8DCT = $00000080; ///< H.264 high profile 8x8 transform + CODEC_FLAG2_FASTPSKIP = $00000100; ///< H.264 fast pskip + CODEC_FLAG2_AUD = $00000200; ///< H.264 access unit delimiters + CODEC_FLAG2_BRDO = $00000400; ///< b-frame rate-distortion optimization + CODEC_FLAG2_INTRA_VLC = $00000800; ///< use MPEG-2 intra VLC table + CODEC_FLAG2_MEMC_ONLY = $00001000; ///< only do ME/MC (I frames -> ref, P frame -> ME+MC) + CODEC_FLAG2_DROP_FRAME_TIMECODE = $00002000; ///< timecode is in drop frame format. + CODEC_FLAG2_SKIP_RD = $00004000; ///< RD optimal MB level residual skipping + CODEC_FLAG2_CHUNKS = $00008000; ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries. + CODEC_FLAG2_NON_LINEAR_QUANT = $00010000; ///< Use MPEG-2 nonlinear quantizer. + +(* Unsupported options : + * Syntax Arithmetic coding (SAC) + * Reference Picture Selection + * Independant Segment Decoding *) +(* /Fx *) +(* codec capabilities *) + +const + CODEC_CAP_DRAW_HORIZ_BAND = $0001; ///< decoder can use draw_horiz_band callback + (** + * Codec uses get_buffer() for allocating buffers. + * direct rendering method 1 + *) + CODEC_CAP_DR1 = $0002; + (* if 'parse_only' field is true, then avcodec_parse_frame() can be used *) + CODEC_CAP_PARSE_ONLY = $0004; + CODEC_CAP_TRUNCATED = $0008; + (* codec can export data for HW decoding (XvMC) *) + CODEC_CAP_HWACCEL = $0010; + (** + * codec has a non zero delay and needs to be feeded with NULL at the end to get the delayed data. + * if this is not set, the codec is guranteed to never be feeded with NULL data + *) + CODEC_CAP_DELAY = $0020; + (** + * Codec can be fed a final frame with a smaller size. + * This can be used to prevent truncation of the last audio samples. + *) + CODEC_CAP_SMALL_LAST_FRAME = $0040; + + //the following defines may change, don't expect compatibility if you use them + MB_TYPE_INTRA4x4 = $001; + MB_TYPE_INTRA16x16 = $002; //FIXME h264 specific + MB_TYPE_INTRA_PCM = $004; //FIXME h264 specific + MB_TYPE_16x16 = $008; + MB_TYPE_16x8 = $010; + MB_TYPE_8x16 = $020; + MB_TYPE_8x8 = $040; + MB_TYPE_INTERLACED = $080; + MB_TYPE_DIRECT2 = $100; //FIXME + MB_TYPE_ACPRED = $200; + MB_TYPE_GMC = $400; + MB_TYPE_SKIP = $800; + MB_TYPE_P0L0 = $1000; + MB_TYPE_P1L0 = $2000; + MB_TYPE_P0L1 = $4000; + MB_TYPE_P1L1 = $8000; + MB_TYPE_L0 = (MB_TYPE_P0L0 or MB_TYPE_P1L0); + MB_TYPE_L1 = (MB_TYPE_P0L1 or MB_TYPE_P1L1); + MB_TYPE_L0L1 = (MB_TYPE_L0 or MB_TYPE_L1); + MB_TYPE_QUANT = $0010000; + MB_TYPE_CBP = $0020000; + //Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...) + +type +(** + * Pan Scan area. + * This specifies the area which should be displayed. + * Note there may be multiple such areas for one frame. + *) + PAVPanScan = ^TAVPanScan; + TAVPanScan = record {24} + (*** id. + * - encoding: set by user. + * - decoding: set by libavcodec. *) + id: integer; + + (*** width and height in 1/16 pel + * - encoding: set by user. + * - decoding: set by libavcodec. *) + width: integer; + height: integer; + + (*** position of the top left corner in 1/16 pel for up to 3 fields/frames. + * - encoding: set by user. + * - decoding: set by libavcodec. *) + position: array [0..2] of array [0..1] of smallint; + end; + +const + FF_QSCALE_TYPE_MPEG1 = 0; + FF_QSCALE_TYPE_MPEG2 = 1; + FF_QSCALE_TYPE_H264 = 2; + + FF_BUFFER_TYPE_INTERNAL = 1; + FF_BUFFER_TYPE_USER = 2; ///< Direct rendering buffers (image is (de)allocated by user) + FF_BUFFER_TYPE_SHARED = 4; ///< buffer from somewhere else, don't dealloc image (data/base), all other tables are not shared + FF_BUFFER_TYPE_COPY = 8; ///< just a (modified) copy of some other buffer, don't dealloc anything. + + + FF_I_TYPE = 1; // Intra + FF_P_TYPE = 2; // Predicted + FF_B_TYPE = 3; // Bi-dir predicted + FF_S_TYPE = 4; // S(GMC)-VOP MPEG4 + FF_SI_TYPE = 5; + FF_SP_TYPE = 6; + + FF_BUFFER_HINTS_VALID = $01; // Buffer hints value is meaningful (if 0 ignore) + FF_BUFFER_HINTS_READABLE = $02; // Codec will read from buffer + FF_BUFFER_HINTS_PRESERVE = $04; // User must not alter buffer content + FF_BUFFER_HINTS_REUSABLE = $08; // Codec will reuse the buffer (update) + +type + {** + * Audio Video Frame. + * New fields can be added to the end of FF_COMMON_FRAME with minor version + * bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. No fields should be added into AVFrame before or after + * FF_COMMON_FRAME! + * sizeof(AVFrame) must not be used outside libav*. + *} + PAVFrame = ^TAVFrame; + TAVFrame = record {200} + (** + * pointer to the picture planes. + * This might be different from the first allocated byte + * - encoding: + * - decoding: + *) + data: array [0..3] of pbyte; + linesize: array [0..3] of integer; + (** + * pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer. + * This isn't used by libavcodec unless the default get/release_buffer() is used. + * - encoding: + * - decoding: + *) + base: array [0..3] of pbyte; + (** + * 1 -> keyframe, 0-> not + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + *) + key_frame: integer; + (** + * Picture type of the frame, see ?_TYPE below. + * - encoding: Set by libavcodec. for coded_picture (and set by user for input). + * - decoding: Set by libavcodec. + *) + pict_type: integer; + (** + * presentation timestamp in time_base units (time when frame should be shown to user) + * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed. + * - encoding: MUST be set by user. + * - decoding: Set by libavcodec. + *) + pts: int64; + (**\ + * picture number in bitstream order + * - encoding: set by + * - decoding: Set by libavcodec. + *) + coded_picture_number: integer; + (** + * picture number in display order + * - encoding: set by + * - decoding: Set by libavcodec. + *) + display_picture_number: integer; + (** + * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) + * - encoding: Set by libavcodec. for coded_picture (and set by user for input). + * - decoding: Set by libavcodec. + *) + quality: integer; + (** + * buffer age (1->was last buffer and dint change, 2->..., ...). + * Set to INT_MAX if the buffer has not been used yet. + * - encoding: unused + * - decoding: MUST be set by get_buffer(). + *) + age: integer; + (** + * is this picture used as reference + * - encoding: unused + * - decoding: Set by libavcodec. (before get_buffer() call)). + *) + reference: integer; + (** + * QP table + * - encoding: unused + * - decoding: Set by libavcodec. + *) + qscale_table: PShortint; + (** + * QP store stride + * - encoding: unused + * - decoding: Set by libavcodec. + *) + qstride: integer; + (** + * mbskip_table[mb]>=1 if MB didn't change + * stride= mb_width = (width+15)>>4 + * - encoding: unused + * - decoding: Set by libavcodec. + *) + mbskip_table: pbyte; + (** + * motion vector table + * @code + * example: + * int mv_sample_log2= 4 - motion_subsample_log2; + * int mb_width= (width+15)>>4; + * int mv_stride= (mb_width << mv_sample_log2) + 1; + * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y]; + * @endcode + * - encoding: Set by user. + * - decoding: Set by libavcodec. + *) + //int16_t (*motion_val[2])[2]; + motion_val: array [0..1] of pointer; + (** + * macroblock type table + * mb_type_base + mb_width + 2 + * - encoding: Set by user. + * - decoding: Set by libavcodec. + *) + mb_type: PCardinal; + (** + * log2 of the size of the block which a single vector in motion_val represents: + * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2) + * - encoding: unused + * - decoding: Set by libavcodec. + *) + motion_subsample_log2: byte; + (** + * for some private data of the user + * - encoding: unused + * - decoding: Set by user. + *) + opaque: pointer; + (** + * error + * - encoding: Set by libavcodec. if flags&CODEC_FLAG_PSNR. + * - decoding: unused + *) + error: array [0..3] of uint64; + (** + * type of the buffer (to keep track of who has to deallocate data[*]) + * - encoding: Set by the one who allocates it. + * - decoding: Set by the one who allocates it. + * Note: User allocated (direct rendering) & internal buffers cannot coexist currently. + *) + type_: integer; + (** + * When decoding, this signals how much the picture must be delayed. + * extra_delay = repeat_pict / (2*fps) + * - encoding: unused + * - decoding: Set by libavcodec. + *) + repeat_pict: integer; + (** + * + *) + qscale_type: integer; + (** + * The content of the picture is interlaced. + * - encoding: Set by user. + * - decoding: Set by libavcodec. (default 0) + *) + interlaced_frame: integer; + (** + * If the content is interlaced, is top field displayed first. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + *) + top_field_first: integer; + (** + * Pan scan. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + *) + pan_scan: PAVPanScan; + (** + * Tell user application that palette has changed from previous frame. + * - encoding: ??? (no palette-enabled encoder yet) + * - decoding: Set by libavcodec. (default 0). + *) + palette_has_changed: integer; + (** + * codec suggestion on buffer type if != 0 + * - encoding: unused + * - decoding: Set by libavcodec. (before get_buffer() call)). + *) + buffer_hints: integer; + (** + * DCT coefficients + * - encoding: unused + * - decoding: Set by libavcodec. + *) + dct_coeff: PsmallInt; + (** + * motion referece frame index + * - encoding: Set by user. + * - decoding: Set by libavcodec. + *) + ref_index: array [0..1] of PShortint; + end; + +const + DEFAULT_FRAME_RATE_BASE = 1001000; + + FF_ASPECT_EXTENDED = 15; + + FF_RC_STRATEGY_XVID = 1; + + FF_BUG_AUTODETECT = 1; ///< autodetection + FF_BUG_OLD_MSMPEG4 = 2; + FF_BUG_XVID_ILACE = 4; + FF_BUG_UMP4 = 8; + FF_BUG_NO_PADDING = 16; + FF_BUG_AMV = 32; + FF_BUG_AC_VLC = 0; ///< will be removed, libavcodec can now handle these non compliant files by default + FF_BUG_QPEL_CHROMA = 64; + FF_BUG_STD_QPEL = 128; + FF_BUG_QPEL_CHROMA2 = 256; + FF_BUG_DIRECT_BLOCKSIZE = 512; + FF_BUG_EDGE = 1024; + FF_BUG_HPEL_CHROMA = 2048; + FF_BUG_DC_CLIP = 4096; + FF_BUG_MS = 8192; ///< workaround various bugs in microsofts broken decoders + //FF_BUG_FAKE_SCALABILITY = 16 //Autodetection should work 100%. + + FF_COMPLIANCE_VERY_STRICT = 2; ///< strictly conform to a older more strict version of the spec or reference software + FF_COMPLIANCE_STRICT = 1; ///< strictly conform to all the things in the spec no matter what consequences + FF_COMPLIANCE_NORMAL = 0; + FF_COMPLIANCE_INOFFICIAL = -1; ///< allow inofficial extensions + FF_COMPLIANCE_EXPERIMENTAL = -2; ///< allow non standarized experimental things + + FF_ER_CAREFUL = 1; + FF_ER_COMPLIANT = 2; + FF_ER_AGGRESSIVE = 3; + FF_ER_VERY_AGGRESSIVE = 4; + + FF_DCT_AUTO = 0; + FF_DCT_FASTINT = 1; + FF_DCT_INT = 2; + FF_DCT_MMX = 3; + FF_DCT_MLIB = 4; + FF_DCT_ALTIVEC = 5; + FF_DCT_FAAN = 6; + + FF_IDCT_AUTO = 0; + FF_IDCT_INT = 1; + FF_IDCT_SIMPLE = 2; + FF_IDCT_SIMPLEMMX = 3; + FF_IDCT_LIBMPEG2MMX = 4; + FF_IDCT_PS2 = 5; + FF_IDCT_MLIB = 6; + FF_IDCT_ARM = 7; + FF_IDCT_ALTIVEC = 8; + FF_IDCT_SH4 = 9; + FF_IDCT_SIMPLEARM = 10; + FF_IDCT_H264 = 11; + FF_IDCT_VP3 = 12; + FF_IDCT_IPP = 13; + FF_IDCT_XVIDMMX = 14; + FF_IDCT_CAVS = 15; + FF_IDCT_SIMPLEARMV5TE= 16; + FF_IDCT_SIMPLEARMV6 = 17; + FF_IDCT_SIMPLEVIS = 18; + FF_IDCT_WMV2 = 19; + + FF_EC_GUESS_MVS = 1; + FF_EC_DEBLOCK = 2; + + FF_MM_FORCE = $80000000; (* force usage of selected flags (OR) *) + (* lower 16 bits - CPU features *) + FF_MM_MMX = $0001; ///< standard MMX + FF_MM_3DNOW = $0004; ///< AMD 3DNOW + FF_MM_MMXEXT = $0002; ///< SSE integer functions or AMD MMX ext + FF_MM_SSE = $0008; ///< SSE functions + FF_MM_SSE2 = $0010; ///< PIV SSE2 functions + FF_MM_3DNOWEXT = $0020; ///< AMD 3DNowExt + FF_MM_SSE3 = $0040; ///< Prescott SSE3 functions + FF_MM_SSSE3 = $0080; ///< Conroe SSSE3 functions + FF_MM_IWMMXT = $0100; ///< XScale IWMMXT + + FF_PRED_LEFT = 0; + FF_PRED_PLANE = 1; + FF_PRED_MEDIAN = 2; + + FF_DEBUG_PICT_INFO = 1; + FF_DEBUG_RC = 2; + FF_DEBUG_BITSTREAM = 4; + FF_DEBUG_MB_TYPE = 8; + FF_DEBUG_QP = 16; + FF_DEBUG_MV = 32; + FF_DEBUG_DCT_COEFF = $00000040; + FF_DEBUG_SKIP = $00000080; + FF_DEBUG_STARTCODE = $00000100; + FF_DEBUG_PTS = $00000200; + FF_DEBUG_ER = $00000400; + FF_DEBUG_MMCO = $00000800; + FF_DEBUG_BUGS = $00001000; + FF_DEBUG_VIS_QP = $00002000; + FF_DEBUG_VIS_MB_TYPE = $00004000; + + FF_DEBUG_VIS_MV_P_FOR = $00000001; //visualize forward predicted MVs of P frames + FF_DEBUG_VIS_MV_B_FOR = $00000002; //visualize forward predicted MVs of B frames + FF_DEBUG_VIS_MV_B_BACK = $00000004; //visualize backward predicted MVs of B frames + + FF_CMP_SAD = 0; + FF_CMP_SSE = 1; + FF_CMP_SATD = 2; + FF_CMP_DCT = 3; + FF_CMP_PSNR = 4; + FF_CMP_BIT = 5; + FF_CMP_RD = 6; + FF_CMP_ZERO = 7; + FF_CMP_VSAD = 8; + FF_CMP_VSSE = 9; + FF_CMP_NSSE = 10; + FF_CMP_W53 = 11; + FF_CMP_W97 = 12; + FF_CMP_DCTMAX = 13; + FF_CMP_DCT264 = 14; + FF_CMP_CHROMA = 256; + + FF_DTG_AFD_SAME = 8; + FF_DTG_AFD_4_3 = 9; + FF_DTG_AFD_16_9 = 10; + FF_DTG_AFD_14_9 = 11; + FF_DTG_AFD_4_3_SP_14_9 = 13; + FF_DTG_AFD_16_9_SP_14_9 = 14; + FF_DTG_AFD_SP_4_3 = 15; + + FF_DEFAULT_QUANT_BIAS = 999999; + + FF_LAMBDA_SHIFT = 7; + FF_LAMBDA_SCALE = (1 shl FF_LAMBDA_SHIFT); + FF_QP2LAMBDA = 118; ///< factor to convert from H.263 QP to lambda + FF_LAMBDA_MAX = (256 * 128 - 1); + + FF_QUALITY_SCALE = FF_LAMBDA_SCALE; //FIXME maybe remove + + FF_CODER_TYPE_VLC = 0; + FF_CODER_TYPE_AC = 1; + FF_CODER_TYPE_RAW = 2; + FF_CODER_TYPE_RLE = 3; + FF_CODER_TYPE_DEFLATE = 4; + + SLICE_FLAG_CODED_ORDER = $0001; ///< draw_horiz_band() is called in coded order instead of display + SLICE_FLAG_ALLOW_FIELD = $0002; ///< allow draw_horiz_band() with field slices (MPEG2 field pics) + SLICE_FLAG_ALLOW_PLANE = $0004; ///< allow draw_horiz_band() with 1 component at a time (SVQ1) + + FF_MB_DECISION_SIMPLE = 0; ///< uses mb_cmp + FF_MB_DECISION_BITS = 1; ///< chooses the one which needs the fewest bits + FF_MB_DECISION_RD = 2; ///< rate distoration + + FF_AA_AUTO = 0; + FF_AA_FASTINT = 1; //not implemented yet + FF_AA_INT = 2; + FF_AA_FLOAT = 3; + + FF_PROFILE_UNKNOWN = -99; + FF_PROFILE_AAC_MAIN = 0; + FF_PROFILE_AAC_LOW = 1; + FF_PROFILE_AAC_SSR = 2; + FF_PROFILE_AAC_LTP = 3; + + FF_LEVEL_UNKNOWN = -99; + + X264_PART_I4X4 = $001; (* Analyse i4x4 *) + X264_PART_I8X8 = $002; (* Analyse i8x8 (requires 8x8 transform) *) + X264_PART_P8X8 = $010; (* Analyse p16x8, p8x16 and p8x8 *) + X264_PART_P4X4 = $020; (* Analyse p8x4, p4x8, p4x4 *) + X264_PART_B8X8 = $100; (* Analyse b16x8, b8x16 and b8x8 *) + + FF_COMPRESSION_DEFAULT = -1; + +const + AVPALETTE_SIZE = 1024; + AVPALETTE_COUNT = 256; + +type +(** + * AVPaletteControl + * This structure defines a method for communicating palette changes + * between and demuxer and a decoder. + * + * @deprecated Use AVPacket to send palette changes instead. + * This is totally broken. + *) + PAVPaletteControl = ^TAVPaletteControl; + TAVPaletteControl = record + (* demuxer sets this to 1 to indicate the palette has changed; + * decoder resets to 0 *) + palette_changed: integer; + + (* 4-byte ARGB palette entries, stored in native byte order; note that + * the individual palette components should be on a 8-bit scale; if + * the palette data comes from a IBM VGA native format, the component + * data is probably 6 bits in size and needs to be scaled *) + palette: array [0..AVPALETTE_COUNT - 1] of cardinal; + end; {deprecated;} + +type + PAVClass = ^TAVClass; + PAVCodecContext = ^TAVCodecContext; + + PAVCodec = ^TAVCodec; + + // int[4] + PQuadIntArray = ^TQuadIntArray; + TQuadIntArray = array[0..3] of integer; + // int (*func)(struct AVCodecContext *c2, void *arg) + TExecuteFunc = function(c2: PAVCodecContext; arg: Pointer): integer; cdecl; + + TAVClass = record {12} + class_name: pchar; + (* actually passing a pointer to an AVCodecContext + or AVFormatContext, which begin with an AVClass. + Needed because av_log is in libavcodec and has no visibility + of AVIn/OutputFormat *) + item_name: function (): pchar; cdecl; + option: PAVOption; + end; + + (** + * main external API structure. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVCodecContext) must not be used outside libav*. + *) + TAVCodecContext = record {720} + (** + * information on struct for av_log + * - set by avcodec_alloc_context + *) + av_class: PAVClass; + (** + * the average bitrate + * - encoding: Set by user; unused for constant quantizer encoding. + * - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream. + *) + bit_rate: integer; + + (** + * number of bits the bitstream is allowed to diverge from the reference. + * the reference can be CBR (for CBR pass1) or VBR (for pass2) + * - encoding: Set by user; unused for constant quantizer encoding. + * - decoding: unused + *) + bit_rate_tolerance: integer; + + (** + * CODEC_FLAG_*. + * - encoding: Set by user. + * - decoding: Set by user. + *) + flags: integer; + + (** + * Some codecs need additional format info. It is stored here. + * If any muxer uses this then ALL demuxers/parsers AND encoders for the + * specific codec MUST set it correctly otherwise stream copy breaks. + * In general use of this field by muxers is not recommanded. + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. (FIXME: Is this OK?) + *) + sub_id: integer; + + (** + * Motion estimation algorithm used for video coding. + * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex), + * 8 (umh), 9 (iter) [7, 8 are x264 specific, 9 is snow specific] + * - encoding: MUST be set by user. + * - decoding: unused + *) + me_method: integer; + + (** + * some codecs need / can use extradata like Huffman tables. + * mjpeg: Huffman tables + * rv10: additional flags + * mpeg4: global headers (they can be in the bitstream or here) + * The allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger + * than extradata_size to avoid prolems if it is read with the bitstream reader. + * The bytewise contents of extradata must not depend on the architecture or CPU endianness. + * - encoding: Set/allocated/freed by libavcodec. + * - decoding: Set/allocated/freed by user. + *) + extradata: pbyte; + extradata_size: integer; + + (** + * This is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. For fixed-fps content, + * timebase should be 1/framerate and timestamp increments should be + * identically 1. + * - encoding: MUST be set by user. + * - decoding: Set by libavcodec. + *) + time_base: TAVRational; + + (* video only *) + (** + * picture width / height. + * - encoding: MUST be set by user. + * - decoding: Set by libavcodec. + * Note: For compatibility it is possible to set this instead of + * coded_width/height before decoding. + *) + width, height: integer; + + (** + * the number of pictures in a group of pictures, or 0 for intra_only + * - encoding: Set by user. + * - decoding: unused + *) + gop_size: integer; + + (** + * Pixel format, see PIX_FMT_xxx. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + *) + pix_fmt: TAVPixelFormat; + + (** + * Frame rate emulation. If not zero, the lower layer (i.e. format handler) + * has to read frames at native frame rate. + * - encoding: Set by user. + * - decoding: unused + *) + rate_emu: integer; + + (** + * If non NULL, 'draw_horiz_band' is called by the libavcodec + * decoder to draw a horizontal band. It improves cache usage. Not + * all codecs can do that. You must check the codec capabilities + * beforehand. + * - encoding: unused + * - decoding: Set by user. + * @param height the height of the slice + * @param y the y position of the slice + * @param type 1->top field, 2->bottom field, 3->frame + * @param offset offset into the AVFrame.data from which the slice should be read + *) + draw_horiz_band: procedure (s: PAVCodecContext; + {const} src: PAVFrame; offset: PQuadIntArray; + y: integer; type_: integer; height: integer); cdecl; + + (* audio only *) + sample_rate: integer; ///< samples per second + channels: integer; + + (** + * audio sample format + * - encoding: Set by user. + * - decoding: Set by libavcodec. + *) + sample_fmt: TSampleFormat; ///< sample format, currenly unused + + (* The following data should not be initialized. *) + (** + * Samples per packet, initialized when calling 'init'. + *) + frame_size: integer; + frame_number: integer; ///< audio or video frame number + real_pict_num: integer; ///< returns the real picture number of previous encoded frame + + (** + * Number of frames the decoded output will be delayed relative to + * the encoded input. + * - encoding: Set by libavcodec. + * - decoding: unused + *) + delay: integer; + + (* - encoding parameters *) + qcompress: single; ///< amount of qscale change between easy & hard scenes (0.0-1.0) + qblur: single; ///< amount of qscale smoothing over time (0.0-1.0) + + (** + * minimum quantizer + * - encoding: Set by user. + * - decoding: unused + *) + qmin: integer; + + (** + * maximum quantizer + * - encoding: Set by user. + * - decoding: unused + *) + qmax: integer; + + (** + * maximum quantizer difference between frames + * - encoding: Set by user. + * - decoding: unused + *) + max_qdiff: integer; + + (** + * maximum number of B-frames between non-B-frames + * Note: The output will be delayed by max_b_frames+1 relative to the input. + * - encoding: Set by user. + * - decoding: unused + *) + max_b_frames: integer; + + (** + * qscale factor between IP and B-frames + * - encoding: Set by user. + * - decoding: unused + *) + b_quant_factor: single; + + (** obsolete FIXME remove *) + rc_strategy: integer; + + b_frame_strategy: integer; + + (** + * hurry up amount + * - encoding: unused + * - decoding: Set by user. 1-> Skip B-frames, 2-> Skip IDCT/dequant too, 5-> Skip everything except header + * @deprecated Deprecated in favor of skip_idct and skip_frame. + *) + hurry_up: integer; + + codec: PAVCodec; + + priv_data: pointer; + + {$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 + (* unused, FIXME remove*) + rtp_mode: integer; + {$IFEND} + + rtp_payload_size: integer; (* The size of the RTP payload: the coder will *) + (* do it's best to deliver a chunk with size *) + (* below rtp_payload_size, the chunk will start *) + (* with a start code on some codecs like H.263 *) + (* This doesn't take account of any particular *) + (* headers inside the transmited RTP payload *) + + + (* The RTP callback: This function is called *) + (* every time the encoder has a packet to send *) + (* Depends on the encoder if the data starts *) + (* with a Start Code (it should) H.263 does. *) + (* mb_nb contains the number of macroblocks *) + (* encoded in the RTP payload *) + rtp_callback: procedure (avctx: PAVCodecContext; data: pointer; + size: integer; mb_nb: integer); cdecl; + + (* statistics, used for 2-pass encoding *) + mv_bits: integer; + header_bits: integer; + i_tex_bits: integer; + p_tex_bits: integer; + i_count: integer; + p_count: integer; + skip_count: integer; + misc_bits: integer; + + (** + * number of bits used for the previously encoded frame + * - encoding: Set by libavcodec. + * - decoding: unused + *) + frame_bits: integer; + + (** + * Private data of the user, can be used to carry app specific stuff. + * - encoding: Set by user. + * - decoding: Set by user. + *) + opaque: pointer; + + codec_name: array [0..31] of char; + codec_type: TCodecType; (* see CODEC_TYPE_xxx *) + codec_id: TCodecID; (* see CODEC_ID_xxx *) + + (** + * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). + * This is used to work around some encoder bugs. + * A demuxer should set this to what is stored in the field used to identify the codec. + * If there are multiple such fields in a container then the demuxer should choose the one + * which maximizes the information about the used codec. + * If the codec tag field in a container is larger then 32 bits then the demuxer should + * remap the longer ID to 32 bits with a table or other structure. Alternatively a new + * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated + * first. + * - encoding: Set by user, if not then the default based on codec_id will be used. + * - decoding: Set by user, will be converted to uppercase by libavcodec during init. + *) + codec_tag: cardinal; // ìîæíî array [0..3] of char - òîãäà âèäíî FOURCC + + (** + * Work around bugs in encoders which sometimes cannot be detected automatically. + * - encoding: Set by user + * - decoding: Set by user + *) + workaround_bugs: integer; + + (** + * luma single coefficient elimination threshold + * - encoding: Set by user. + * - decoding: unused + *) + luma_elim_threshold: integer; + + (** + * chroma single coeff elimination threshold + * - encoding: Set by user. + * - decoding: unused + *) + chroma_elim_threshold: integer; + + (** + * strictly follow the standard (MPEG4, ...). + * - encoding: Set by user. + * - decoding: unused + *) + strict_std_compliance: integer; + + (** + * qscale offset between IP and B-frames + * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset). + * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset). + * - encoding: Set by user. + * - decoding: unused + *) + b_quant_offset: single; + + (** + * Error resilience; higher values will detect more errors but may + * misdetect some more or less valid parts as errors. + * - encoding: unused + * - decoding: Set by user. + *) + error_resilience: integer; + + (** + * Called at the beginning of each frame to get a buffer for it. + * If pic.reference is set then the frame will be read later by libavcodec. + * avcodec_align_dimensions() should be used to find the required width and + * height, as they normally need to be rounded up to the next multiple of 16. + * - encoding: unused + * - decoding: Set by libavcodec., user can override. + *) + get_buffer: function (c: PAVCodecContext; pic: PAVFrame): integer; cdecl; + + (** + * Called to release buffers which where allocated with get_buffer. + * A released buffer can be reused in get_buffer(). + * pic.data[*] must be set to NULL. + * - encoding: unused + * - decoding: Set by libavcodec., user can override. + *) + release_buffer: procedure (c: PAVCodecContext; pic: PAVFrame); cdecl; + + (** + * If 1 the stream has a 1 frame delay during decoding. + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + *) + has_b_frames: integer; + + (** + * number of bytes per packet if constant and known or 0 + * Used by some WAV based audio codecs. + *) + block_align: integer; + + parse_only: integer; (* - decoding only: if true, only parsing is done + (function avcodec_parse_frame()). The frame + data is returned. Only MPEG codecs support this now. *) + + (** + * 0-> h263 quant 1-> mpeg quant + * - encoding: Set by user. + * - decoding: unused + *) + mpeg_quant: integer; + + (** + * pass1 encoding statistics output buffer + * - encoding: Set by libavcodec. + * - decoding: unused + *) + stats_out: pchar; + + (** + * pass2 encoding statistics input buffer + * Concatenated stuff from stats_out of pass1 should be placed here. + * - encoding: Allocated/set/freed by user. + * - decoding: unused + *) + stats_in: pchar; + + (** + * ratecontrol qmin qmax limiting method + * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax. + * - encoding: Set by user. + * - decoding: unused + *) + rc_qsquish: single; + + rc_qmod_amp: single; + rc_qmod_freq: integer; + + (** + * ratecontrol override, see RcOverride + * - encoding: Allocated/set/freed by user. + * - decoding: unused + *) + rc_override: PRcOverride; + rc_override_count: integer; + + (** + * rate control equation + * - encoding: Set by user + * - decoding: unused + *) + rc_eq: pchar; + + (** + * maximum bitrate + * - encoding: Set by user. + * - decoding: unused + *) + rc_max_rate: integer; + + (** + * minimum bitrate + * - encoding: Set by user. + * - decoding: unused + *) + rc_min_rate: integer; + + (** + * decoder bitstream buffer size + * - encoding: Set by user. + * - decoding: unused + *) + rc_buffer_size: integer; + rc_buffer_aggressivity: single; + + (** + * qscale factor between P and I-frames + * If > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset). + * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset). + * - encoding: Set by user. + * - decoding: unused + *) + i_quant_factor: single; + + (** + * qscale offset between P and I-frames + * - encoding: Set by user. + * - decoding: unused + *) + i_quant_offset: single; + + (** + * initial complexity for pass1 ratecontrol + * - encoding: Set by user. + * - decoding: unused + *) + rc_initial_cplx: single; + + (** + * DCT algorithm, see FF_DCT_* below + * - encoding: Set by user. + * - decoding: unused + *) + dct_algo: integer; + + (** + * luminance masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + *) + lumi_masking: single; + + (** + * temporary complexity masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + *) + temporal_cplx_masking: single; + + (** + * spatial complexity masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + *) + spatial_cplx_masking: single; + + (** + * p block masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + *) + p_masking: single; + + (** + * darkness masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + *) + dark_masking: single; + + {$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 + (* for binary compatibility *) + unused: integer; + {$IFEND} + + (** + * IDCT algorithm, see FF_IDCT_* below. + * - encoding: Set by user. + * - decoding: Set by user. + *) + idct_algo: integer; + + (** + * slice count + * - encoding: Set by libavcodec. + * - decoding: Set by user (or 0). + *) + slice_count: integer; + + (** + * slice offsets in the frame in bytes + * - encoding: Set/allocated by libavcodec. + * - decoding: Set/allocated by user (or NULL). + *) + slice_offset: Pinteger; + + (** + * error concealment flags + * - encoding: unused + * - decoding: Set by user. + *) + error_concealment: integer; + + (** + * dsp_mask could be add used to disable unwanted CPU features + * CPU features (i.e. MMX, SSE. ...) + * + * With the FORCE flag you may instead enable given CPU features. + * (Dangerous: Usable in case of misdetection, improper usage however will + * result into program crash.) + *) + dsp_mask: cardinal; + + (** + * bits per sample/pixel from the demuxer (needed for huffyuv). + * - encoding: Set by libavcodec. + * - decoding: Set by user. + *) + bits_per_sample: integer; + + (** + * prediction method (needed for huffyuv) + * - encoding: Set by user. + * - decoding: unused + *) + prediction_method: integer; + + (** + * sample aspect ratio (0 if unknown) + * Numerator and denominator must be relatively prime and smaller than 256 for some video standards. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + *) + sample_aspect_ratio: TAVRational; + + (** + * the picture in the bitstream + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + *) + coded_frame: PAVFrame; + + (** + * debug + * - encoding: Set by user. + * - decoding: Set by user. + *) + debug: integer; + + (** + * debug + * - encoding: Set by user. + * - decoding: Set by user. + *) + debug_mv: integer; + + (** + * error + * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR. + * - decoding: unused + *) + error: array [0..3] of uint64; + + (** + * minimum MB quantizer + * - encoding: unused + * - decoding: unused + *) + mb_qmin: integer; + + (** + * maximum MB quantizer + * - encoding: unused + * - decoding: unused + *) + mb_qmax: integer; + + (** + * motion estimation comparison function + * - encoding: Set by user. + * - decoding: unused + *) + me_cmp: integer; + + (** + * subpixel motion estimation comparison function + * - encoding: Set by user. + * - decoding: unused + *) + me_sub_cmp: integer; + (** + * macroblock comparison function (not supported yet) + * - encoding: Set by user. + * - decoding: unused + *) + mb_cmp: integer; + (** + * interlaced DCT comparison function + * - encoding: Set by user. + * - decoding: unused + *) + ildct_cmp: integer; + + (** + * ME diamond size & shape + * - encoding: Set by user. + * - decoding: unused + *) + dia_size: integer; + + (** + * amount of previous MV predictors (2a+1 x 2a+1 square) + * - encoding: Set by user. + * - decoding: unused + *) + last_predictor_count: integer; + + (** + * prepass for motion estimation + * - encoding: Set by user. + * - decoding: unused + *) + pre_me: integer; + + (** + * motion estimation prepass comparison function + * - encoding: Set by user. + * - decoding: unused + *) + me_pre_cmp: integer; + + (** + * ME prepass diamond size & shape + * - encoding: Set by user. + * - decoding: unused + *) + pre_dia_size: integer; + + (** + * subpel ME quality + * - encoding: Set by user. + * - decoding: unused + *) + me_subpel_quality: integer; + + (** + * callback to negotiate the pixelFormat + * @param fmt is the list of formats which are supported by the codec, + * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality. + * The first is always the native one. + * @return the chosen format + * - encoding: unused + * - decoding: Set by user, if not set the native format will be chosen. + *) + get_format: function (s: PAVCodecContext; {const} fmt: PAVPixelFormat): TAVPixelFormat; cdecl; + + (** + * DTG active format information (additional aspect ratio + * information only used in DVB MPEG-2 transport streams) + * 0 if not set. + * + * - encoding: unused + * - decoding: Set by decoder. + *) + dtg_active_format: integer; + + (** + * maximum motion estimation search range in subpel units + * If 0 then no limit. + * + * - encoding: Set by user. + * - decoding: unused + *) + me_range: integer; + + (** + * intra quantizer bias + * - encoding: Set by user. + * - decoding: unused + *) + intra_quant_bias: integer; + + (** + * inter quantizer bias + * - encoding: Set by user. + * - decoding: unused + *) + inter_quant_bias: integer; + + (** + * color table ID + * - encoding: unused + * - decoding: Which clrtable should be used for 8bit RGB images. + * Tables have to be stored somewhere. FIXME + *) + color_table_id: integer; + + (** + * internal_buffer count + * Don't touch, used by libavcodec default_get_buffer(). + *) + internal_buffer_count: integer; + + (** + * internal_buffers + * Don't touch, used by libavcodec default_get_buffer(). + *) + internal_buffer: pointer; + + (** + * Global quality for codecs which cannot change it per frame. + * This should be proportional to MPEG-1/2/4 qscale. + * - encoding: Set by user. + * - decoding: unused + *) + global_quality: integer; + + (** + * coder type + * - encoding: Set by user. + * - decoding: unused + *) + coder_type: integer; + + (** + * context model + * - encoding: Set by user. + * - decoding: unused + *) + context_model: integer; + + { + (** + * + * - encoding: unused + * - decoding: Set by user. + *) + realloc: function (s: PAVCodecContext; buf: Pbyte; buf_size: integer): Pbyte; cdecl; + } + + (** + * slice flags + * - encoding: unused + * - decoding: Set by user. + *) + slice_flags: integer; + + (** + * XVideo Motion Acceleration + * - encoding: forbidden + * - decoding: set by decoder + *) + xvmc_acceleration: integer; + + (** + * macroblock decision mode + * - encoding: Set by user. + * - decoding: unused + *) + mb_decision: integer; + + (** + * custom intra quantization matrix + * - encoding: Set by user, can be NULL. + * - decoding: Set by libavcodec. + *) + intra_matrix: Pword; + + (** + * custom inter quantization matrix + * - encoding: Set by user, can be NULL. + * - decoding: Set by libavcodec. + *) + inter_matrix: Pword; + + (** + * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). + * This is used to work around some encoder bugs. + * - encoding: unused + * - decoding: Set by user, will be converted to uppercase by libavcodec during init. + *) + stream_codec_tag: array [0..3] of char; //cardinal; + + (** + * scene change detection threshold + * 0 is default, larger means fewer detected scene changes. + * - encoding: Set by user. + * - decoding: unused + *) + scenechange_threshold: integer; + + (** + * minimum Lagrange multipler + * - encoding: Set by user. + * - decoding: unused + *) + lmin: integer; + + (** + * maximum Lagrange multipler + * - encoding: Set by user. + * - decoding: unused + *) + lmax: integer; + + (** + * palette control structure + * - encoding: ??? (no palette-enabled encoder yet) + * - decoding: Set by user. + *) + palctrl: PAVPaletteControl; + + (** + * noise reduction strength + * - encoding: Set by user. + * - decoding: unused + *) + noise_reduction: integer; + + (** + * Called at the beginning of a frame to get cr buffer for it. + * Buffer type (size, hints) must be the same. libavcodec won't check it. + * libavcodec will pass previous buffer in pic, function should return + * same buffer or new buffer with old frame "painted" into it. + * If pic.data[0] == NULL must behave like get_buffer(). + * - encoding: unused + * - decoding: Set by libavcodec., user can override + *) + reget_buffer: function (c: PAVCodecContext; pic: PAVFrame): integer; cdecl; + + (** + * Number of bits which should be loaded into the rc buffer before decoding starts. + * - encoding: Set by user. + * - decoding: unused + *) + rc_initial_buffer_occupancy: integer; + + (** + * + * - encoding: Set by user. + * - decoding: unused + *) + inter_threshold: integer; + + (** + * CODEC_FLAG2_* + * - encoding: Set by user. + * - decoding: Set by user. + *) + flags2: integer; + + (** + * Simulates errors in the bitstream to test error concealment. + * - encoding: Set by user. + * - decoding: unused + *) + error_rate: integer; + + (** + * MP3 antialias algorithm, see FF_AA_* below. + * - encoding: unused + * - decoding: Set by user. + *) + antialias_algo: integer; + + (** + * quantizer noise shaping + * - encoding: Set by user. + * - decoding: unused + *) + quantizer_noise_shaping: integer; + + (** + * thread count + * is used to decide how many independent tasks should be passed to execute() + * - encoding: Set by user. + * - decoding: Set by user. + *) + thread_count: integer; + + (** + * The codec may call this to execute several independent things. + * It will return only after finishing all tasks. + * The user may replace this with some multithreaded implementation, + * the default implementation will execute the parts serially. + * @param count the number of things to execute + * - encoding: Set by libavcodec, user can override. + * - decoding: Set by libavcodec, user can override. + *) + execute: function (c: PAVCodecContext; func: TExecuteFunc; arg: PPointer; ret: PInteger; count: integer): integer; cdecl; + + (** + * thread opaque + * Can be used by execute() to store some per AVCodecContext stuff. + * - encoding: set by execute() + * - decoding: set by execute() + *) + thread_opaque: pointer; + + (** + * Motion estimation threshold below which no motion estimation is + * performed, but instead the user specified motion vectors are used. + * + * - encoding: Set by user. + * - decoding: unused + *) + me_threshold: integer; + + (** + * Macroblock threshold below which the user specified macroblock types will be used. + * - encoding: Set by user. + * - decoding: unused + *) + mb_threshold: integer; + + (** + * precision of the intra DC coefficient - 8 + * - encoding: Set by user. + * - decoding: unused + *) + intra_dc_precision: integer; + + (** + * noise vs. sse weight for the nsse comparsion function + * - encoding: Set by user. + * - decoding: unused + *) + nsse_weight: integer; + + (** + * Number of macroblock rows at the top which are skipped. + * - encoding: unused + * - decoding: Set by user. + *) + skip_top: integer; + + (** + * Number of macroblock rows at the bottom which are skipped. + * - encoding: unused + * - decoding: Set by user. + *) + skip_bottom: integer; + + (** + * profile + * - encoding: Set by user. + * - decoding: Set by libavcodec. + *) + profile: integer; + + (** + * level + * - encoding: Set by user. + * - decoding: Set by libavcodec. + *) + level: integer; + + (** + * low resolution decoding, 1-> 1/2 size, 2->1/4 size + * - encoding: unused + * - decoding: Set by user. + *) + lowres: integer; + + (** + * Bitstream width / height, may be different from width/height if lowres + * or other things are used. + * - encoding: unused + * - decoding: Set by user before init if known. Codec should override / dynamically change if needed. + *) + coded_width, coded_height: integer; + + (** + * frame skip threshold + * - encoding: Set by user. + * - decoding: unused + *) + frame_skip_threshold: integer; + + (** + * frame skip factor + * - encoding: Set by user. + * - decoding: unused + *) + frame_skip_factor: integer; + + (** + * frame skip exponent + * - encoding: Set by user. + * - decoding: unused + *) + frame_skip_exp: integer; + + (** + * frame skip comparison function + * - encoding: Set by user. + * - decoding: unused + *) + frame_skip_cmp: integer; + + (** + * Border processing masking, raises the quantizer for mbs on the borders + * of the picture. + * - encoding: Set by user. + * - decoding: unused + *) + border_masking: single; + + (** + * minimum MB lagrange multipler + * - encoding: Set by user. + * - decoding: unused + *) + mb_lmin: integer; + + (** + * maximum MB lagrange multipler + * - encoding: Set by user. + * - decoding: unused + *) + mb_lmax: integer; + + (** + * + * - encoding: Set by user. + * - decoding: unused + *) + me_penalty_compensation: integer; + + (** + * + * - encoding: unused + * - decoding: Set by user. + *) + skip_loop_filter: TAVDiscard; + + (** + * + * - encoding: unused + * - decoding: Set by user. + *) + skip_idct: TAVDiscard; + + (** + * + * - encoding: unused + * - decoding: Set by user. + *) + skip_frame: TAVDiscard; + + (** + * + * - encoding: Set by user. + * - decoding: unused + *) + bidir_refine: integer; + + (** + * + * - encoding: Set by user. + * - decoding: unused + *) + brd_scale: integer; + + (** + * constant rate factor - quality-based VBR - values ~correspond to qps + * - encoding: Set by user. + * - decoding: unused + *) + {$IF LIBAVCODEC_VERSION >= 51021000} // 51.21.0 + crf: single; + {$ELSE} + crf: integer; + {$IFEND} + + (** + * constant quantization parameter rate control method + * - encoding: Set by user. + * - decoding: unused + *) + cqp: integer; + + (** + * minimum GOP size + * - encoding: Set by user. + * - decoding: unused + *) + keyint_min: integer; + + (** + * number of reference frames + * - encoding: Set by user. + * - decoding: unused + *) + refs: integer; + + (** + * chroma qp offset from luma + * - encoding: Set by user. + * - decoding: unused + *) + chromaoffset: integer; + + (** + * Influences how often B-frames are used. + * - encoding: Set by user. + * - decoding: unused + *) + bframebias: integer; + + (** + * trellis RD quantization + * - encoding: Set by user. + * - decoding: unused + *) + trellis: integer; + + (** + * Reduce fluctuations in qp (before curve compression). + * - encoding: Set by user. + * - decoding: unused + *) + complexityblur: single; + + (** + * in-loop deblocking filter alphac0 parameter + * alpha is in the range -6...6 + * - encoding: Set by user. + * - decoding: unused + *) + deblockalpha: integer; + + (** + * in-loop deblocking filter beta parameter + * beta is in the range -6...6 + * - encoding: Set by user. + * - decoding: unused + *) + deblockbeta: integer; + + (** + * macroblock subpartition sizes to consider - p8x8, p4x4, b8x8, i8x8, i4x4 + * - encoding: Set by user. + * - decoding: unused + *) + partitions: integer; + + (** + * direct MV prediction mode - 0 (none), 1 (spatial), 2 (temporal) + * - encoding: Set by user. + * - decoding: unused + *) + directpred: integer; + + (** + * Audio cutoff bandwidth (0 means "automatic") + * - encoding: Set by user. + * - decoding: unused + *) + cutoff: integer; + + (** + * Multiplied by qscale for each frame and added to scene_change_score. + * - encoding: Set by user. + * - decoding: unused + *) + scenechange_factor: integer; + + (** + * + * Note: Value depends upon the compare function used for fullpel ME. + * - encoding: Set by user. + * - decoding: unused + *) + mv0_threshold: integer; + + (** + * Adjusts sensitivity of b_frame_strategy 1. + * - encoding: Set by user. + * - decoding: unused + *) + b_sensitivity: integer; + + (** + * - encoding: Set by user. + * - decoding: unused + *) + compression_level: integer; + + (** + * Sets whether to use LPC mode - used by FLAC encoder. + * - encoding: Set by user. + * - decoding: unused + *) + use_lpc: integer; + + (** + * LPC coefficient precision - used by FLAC encoder + * - encoding: Set by user. + * - decoding: unused + *) + lpc_coeff_precision: integer; + + (** + * - encoding: Set by user. + * - decoding: unused + *) + min_prediction_order: integer; + + (** + * - encoding: Set by user. + * - decoding: unused + *) + max_prediction_order: integer; + + (** + * search method for selecting prediction order + * - encoding: Set by user. + * - decoding: unused + *) + prediction_order_method: integer; + + (** + * - encoding: Set by user. + * - decoding: unused + *) + min_partition_order: integer; + + (** + * - encoding: Set by user. + * - decoding: unused + *) + max_partition_order: integer; + + {$IF LIBAVCODEC_VERSION >= 51026000} // 51.26.0 + (** + * GOP timecode frame start number, in non drop frame format + * - encoding: Set by user. + * - decoding: unused + *) + timecode_frame_start: int64; + {$IFEND} + + {$IF LIBAVCODEC_VERSION >= 51042000} // 51.42.0 + (** + * Decoder should decode to this many channels if it can (0 for default) + * - encoding: unused + * - decoding: Set by user. + *) + request_channels: integer; + {$IFEND} + + {$IF LIBAVCODEC_VERSION > 51049000} // > 51.49.0 + (** + * Percentage of dynamic range compression to be applied by the decoder. + * The default value is 1.0, corresponding to full compression. + * - encoding: unused + * - decoding: Set by user. + *) + drc_scale: Single; + {$IFEND} + end; + +(** + * AVCodec. + *) + TAVCodec = record + name: pchar; + type_: TCodecType; + id: TCodecID; + priv_data_size: integer; + init: function (avctx: PAVCodecContext): integer; cdecl; (* typo corretion by the Creative CAT *) + encode: function (avctx: PAVCodecContext; buf: pchar; buf_size: integer; data: pointer): integer; cdecl; + close: function (avctx: PAVCodecContext): integer; cdecl; + decode: function (avctx: PAVCodecContext; outdata: pointer; outdata_size: PInteger; + buf: pchar; buf_size: integer): integer; cdecl; + capabilities: integer; + next: PAVCodec; + flush: procedure (avctx: PAVCodecContext); cdecl; + {const} supported_framerates: PAVRational; ///array of supported framerates, or NULL if any, array is terminated by {0,0} + {const} pix_fmts: PAVPixelFormat; ///array of supported pixel formats, or NULL if unknown, array is terminanted by -1 + end; + +(** + * four components are given, that's all. + * the last component is alpha + *) + PAVPicture = ^TAVPicture; + TAVPicture = record + data: array [0..3] of pchar; + linesize: array [0..3] of integer; ///< number of bytes per line + end; + +type + PAVSubtitleRect = ^TAVSubtitleRect; + TAVSubtitleRect = record + x: word; + y: word; + w: word; + h: word; + nb_colors: word; + linesize: integer; + rgba_palette: PCardinal; + bitmap: pchar; + end; + + PAVSubtitle = ^TAVSubtitle; + TAVSubtitle = record {20} + format: word; (* 0 = graphics *) + start_display_time: cardinal; (* relative to packet pts, in ms *) + end_display_time: cardinal; (* relative to packet pts, in ms *) + num_rects: cardinal; + rects: PAVSubtitleRect; + end; + + +(* resample.c *) + + PReSampleContext = pointer; + PAVResampleContext = pointer; + PImgReSampleContext = pointer; + +function audio_resample_init (output_channels: integer; input_channels: integer; + output_rate: integer; input_rate: integer): PReSampleContext; + cdecl; external av__codec; + +function audio_resample (s: PReSampleContext; output: PSmallint; input: PSmallint; nb_samples: integer): integer; + cdecl; external av__codec; + +procedure audio_resample_close (s: PReSampleContext); + cdecl; external av__codec; + + +function av_resample_init (out_rate: integer; in_rate: integer; filter_length: integer; + log2_phase_count: integer; linear: integer; cutoff: double): PAVResampleContext; + cdecl; external av__codec; + +function av_resample (c: PAVResampleContext; dst: PSmallint; src: PSmallint; consumed: PInteger; + src_size: integer; dst_size: integer; update_ctx: integer): integer; + cdecl; external av__codec; + +procedure av_resample_compensate (c: PAVResampleContext; sample_delta: integer; + compensation_distance: integer); + cdecl; external av__codec; + +procedure av_resample_close (c: PAVResampleContext); + cdecl; external av__codec; + + +{$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 +(* YUV420 format is assumed ! *) + +(** + * @deprecated Use the software scaler (swscale) instead. + *) +function img_resample_init (output_width: integer; output_height: integer; + input_width: integer; input_height: integer): PImgReSampleContext; + cdecl; external av__codec; deprecated; + +(** + * @deprecated Use the software scaler (swscale) instead. + *) +function img_resample_full_init (owidth: integer; oheight: integer; + iwidth: integer; iheight: integer; + topBand: integer; bottomBand: integer; + leftBand: integer; rightBand: integer; + padtop: integer; padbottom: integer; + padleft: integer; padright: integer): PImgReSampleContext; + cdecl; external av__codec; deprecated; + +(** + * @deprecated Use the software scaler (swscale) instead. + *) +procedure img_resample (s: PImgReSampleContext; output: PAVPicture; {const} input: PAVPicture); + cdecl; external av__codec; deprecated; + +(** + * @deprecated Use the software scaler (swscale) instead. + *) +procedure img_resample_close (s: PImgReSampleContext); + cdecl; external av__codec; deprecated; + +{$IFEND} + +(** + * Allocate memory for a picture. Call avpicture_free to free it. + * + * @param picture the picture to be filled in. + * @param pix_fmt the format of the picture. + * @param width the width of the picture. + * @param height the height of the picture. + * @return Zero if successful, a negative value if not. + *) +function avpicture_alloc (picture: PAVPicture; pix_fmt: TAVPixelFormat; + width: integer; height: integer): integer; + cdecl; external av__codec; + +(** + * Free a picture previously allocated by avpicture_alloc(). + * + * @param picture the AVPicture to be freed + *) +procedure avpicture_free (picture: PAVPicture); + cdecl; external av__codec; + +(** + * Fill in the AVPicture fields. + * The fields of the given AVPicture are filled in by using the 'ptr' address + * which points to the image data buffer. Depending on the specified picture + * format, one or multiple image data pointers and line sizes will be set. + * If a planar format is specified, several pointers will be set pointing to + * the different picture planes and the line sizes of the different planes + * will be stored in the lines_sizes array. + * + * @param picture AVPicture whose fields are to be filled in + * @param ptr Buffer which will contain or contains the actual image data + * @param pix_fmt The format in which the picture data is stored. + * @param width the width of the image in pixels + * @param height the height of the image in pixels + * @return size of the image data in bytes + *) +function avpicture_fill (picture: PAVPicture; ptr: pointer; + pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; + cdecl; external av__codec; + +function avpicture_layout ({const} src: PAVPicture; pix_fmt: TAVPixelFormat; + width: integer; height: integer; + dest: pchar; dest_size: integer): integer; + cdecl; external av__codec; + +(** + * Calculate the size in bytes that a picture of the given width and height + * would occupy if stored in the given picture format. + * + * @param pix_fmt the given picture format + * @param width the width of the image + * @param height the height of the image + * @return Image data size in bytes + *) +function avpicture_get_size (pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; + cdecl; external av__codec; + +procedure avcodec_get_chroma_sub_sample (pix_fmt: TAVPixelFormat; h_shift: Pinteger; v_shift: pinteger); + cdecl; external av__codec; + +function avcodec_get_pix_fmt_name(pix_fmt: TAVPixelFormat): pchar; + cdecl; external av__codec; + +procedure avcodec_set_dimensions(s: PAVCodecContext; width: integer; height: integer); + cdecl; external av__codec; + +function avcodec_get_pix_fmt(const name: pchar): TAVPixelFormat; + cdecl; external av__codec; + +function avcodec_pix_fmt_to_codec_tag(p: TAVPixelFormat): cardinal; + cdecl; external av__codec; + +const + FF_LOSS_RESOLUTION = $0001; {**< loss due to resolution change *} + FF_LOSS_DEPTH = $0002; {**< loss due to color depth change *} + FF_LOSS_COLORSPACE = $0004; {**< loss due to color space conversion *} + FF_LOSS_ALPHA = $0008; {**< loss of alpha bits *} + FF_LOSS_COLORQUANT = $0010; {**< loss due to color quantization *} + FF_LOSS_CHROMA = $0020; {**< loss of chroma (e.g. RGB to gray conversion) *} + +(** + * Computes what kind of losses will occur when converting from one specific + * pixel format to another. + * When converting from one pixel format to another, information loss may occur. + * For example, when converting from RGB24 to GRAY, the color information will + * be lost. Similarly, other losses occur when converting from some formats to + * other formats. These losses can involve loss of chroma, but also loss of + * resolution, loss of color depth, loss due to the color space conversion, loss + * of the alpha bits or loss due to color quantization. + * avcodec_get_fix_fmt_loss() informs you about the various types of losses + * which will occur when converting from one pixel format to another. + * + * @param[in] dst_pix_fmt destination pixel format + * @param[in] src_pix_fmt source pixel format + * @param[in] has_alpha Whether the source pixel format alpha channel is used. + * @return Combination of flags informing you what kind of losses will occur. + *) +function avcodec_get_pix_fmt_loss (dst_pix_fmt: TAVPixelFormat; src_pix_fmt: TAVPixelFormat; + has_alpha: integer): integer; + cdecl; external av__codec; + +(** + * Finds the best pixel format to convert to given a certain source pixel + * format. When converting from one pixel format to another, information loss + * may occur. For example, when converting from RGB24 to GRAY, the color + * information will be lost. Similarly, other losses occur when converting from + * some formats to other formats. avcodec_find_best_pix_fmt() searches which of + * the given pixel formats should be used to suffer the least amount of loss. + * The pixel formats from which it chooses one, are determined by the + * \p pix_fmt_mask parameter. + * + * @code + * src_pix_fmt = PIX_FMT_YUV420P; + * pix_fmt_mask = (1 << PIX_FMT_YUV422P) || (1 << PIX_FMT_RGB24); + * dst_pix_fmt = avcodec_find_best_pix_fmt(pix_fmt_mask, src_pix_fmt, alpha, &loss); + * @endcode + * + * @param[in] pix_fmt_mask bitmask determining which pixel format to choose from + * @param[in] src_pix_fmt source pixel format + * @param[in] has_alpha Whether the source pixel format alpha channel is used. + * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur. + * @return The best pixel format to convert to or -1 if none was found. + *) +function avcodec_find_best_pix_fmt (pix_fmt_mask: integer; src_pix_fmt: TAVPixelFormat; + has_alpha: integer; loss_ptr: pinteger): integer; + cdecl; external av__codec; + +{$IF LIBAVCODEC_VERSION >= 51041000} // 51.41.0 +(** + * Print in buf the string corresponding to the pixel format with + * number pix_fmt, or an header if pix_fmt is negative. + * + * @param[in] buf the buffer where to write the string + * @param[in] buf_size the size of buf + * @param[in] pix_fmt the number of the pixel format to print the corresponding info string, or + * a negative value to print the corresponding header. + * Meaningful values for obtaining a pixel format info vary from 0 to PIX_FMT_NB -1. + *) +procedure avcodec_pix_fmt_string (buf: PChar; buf_size: integer; pix_fmt: integer); + cdecl; external av__codec; +{$IFEND} + +const + FF_ALPHA_TRANSP = $0001; {* image has some totally transparent pixels *} + FF_ALPHA_SEMI_TRANSP = $0002; {* image has some transparent pixels *} + +(** + * Tell if an image really has transparent alpha values. + * @return ored mask of FF_ALPHA_xxx constants + *) +function img_get_alpha_info ({const} src: PAVPicture; + pix_fmt: TAVPixelFormat; + width: integer; height: integer): integer; + cdecl; external av__codec; + +{$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 +(** + * convert among pixel formats + * @deprecated Use the software scaler (swscale) instead. + *) +function img_convert (dst: PAVPicture; dst_pix_fmt: TAVPixelFormat; + const src: PAVPicture; pix_fmt: TAVPixelFormat; + width: integer; height: integer): integer; + cdecl; external av__codec; deprecated; +{$IFEND} + +(* deinterlace a picture *) +(* deinterlace - if not supported return -1 *) +function avpicture_deinterlace (dst: PAVPicture; const src: PAVPicture; + pix_fmt: TAVPixelFormat; width: integer; height: integer): integer; + cdecl; external av__codec; + +{* external high level API *} + +{$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 +{ +var + first_avcodec: PAVCodec; external av__codec; +} +{$IFEND} + +{$IF LIBAVCODEC_VERSION >= 51049000} // 51.49.0 +function av_codec_next(c: PAVCodec): PAVCodec; + cdecl; external av__codec; +{$IFEND} + +(* returns LIBAVCODEC_VERSION_INT constant *) +function avcodec_version (): cardinal; + cdecl; external av__codec; + +(* returns LIBAVCODEC_BUILD constant *) +function avcodec_build (): cardinal; + cdecl; external av__codec; + +(** + * Initializes libavcodec. + * + * @warning This function \e must be called before any other libavcodec + * function. + *) +procedure avcodec_init (); + cdecl; external av__codec; + +procedure register_avcodec (format: PAVCodec); + cdecl; external av__codec; + +(** + * Finds a registered encoder with a matching codec ID. + * + * @param id CodecID of the requested encoder + * @return An encoder if one was found, NULL otherwise. + *) +function avcodec_find_encoder (id: TCodecID): PAVCodec; + cdecl; external av__codec; + +(** + * Finds a registered encoder with the specified name. + * + * @param name name of the requested encoder + * @return An encoder if one was found, NULL otherwise. + *) +function avcodec_find_encoder_by_name (name: pchar): PAVCodec; + cdecl; external av__codec; + +(** + * Finds a registered decoder with a matching codec ID. + * + * @param id CodecID of the requested decoder + * @return A decoder if one was found, NULL otherwise. + *) +function avcodec_find_decoder(id: TCodecID): PAVCodec; + cdecl; external av__codec; + +(** + * Finds a registered decoder with the specified name. + * + * @param name name of the requested decoder + * @return A decoder if one was found, NULL otherwise. + *) +function avcodec_find_decoder_by_name (name: pchar): PAVCodec; + cdecl; external av__codec; +procedure avcodec_string(buf: pchar; buf_size: integer; enc: PAVCodecContext; encode: integer); + cdecl; external av__codec; + +(** + * Sets the fields of the given AVCodecContext to default values. + * + * @param s The AVCodecContext of which the fields should be set to default values. + *) +procedure avcodec_get_context_defaults (s: PAVCodecContext); + cdecl; external av__codec; + +{$IF LIBAVCODEC_VERSION >= 51039000} // 51.39.0 +(** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! + * we WILL change its arguments and name a few times! *) +procedure avcodec_get_context_defaults2(s: PAVCodecContext; ctype: TCodecType); + cdecl; external av__codec; +{$IFEND} + +(** + * Allocates an AVCodecContext and sets its fields to default values. The + * resulting struct can be deallocated by simply calling av_free(). + * + * @return An AVCodecContext filled with default values or NULL on failure. + * @see avcodec_get_context_defaults + *) +function avcodec_alloc_context(): PAVCodecContext; + cdecl; external av__codec; + +{$IF LIBAVCODEC_VERSION >= 51039000} // 51.39.0 +(** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! + * we WILL change its arguments and name a few times! *) +function avcodec_alloc_context2(ctype: TCodecType): PAVCodecContext; + cdecl; external av__codec; +{$IFEND} + +(** + * Sets the fields of the given AVFrame to default values. + * + * @param pic The AVFrame of which the fields should be set to default values. + *) +procedure avcodec_get_frame_defaults (pic: PAVFrame); + cdecl; external av__codec; + +(** + * Allocates an AVFrame and sets its fields to default values. The resulting + * struct can be deallocated by simply calling av_free(). + * + * @return An AVFrame filled with default values or NULL on failure. + * @see avcodec_get_frame_defaults + *) +function avcodec_alloc_frame(): PAVFrame; + cdecl; external av__codec; + +function avcodec_default_get_buffer (s: PAVCodecContext; pic: PAVFrame): integer; + cdecl; external av__codec; +procedure avcodec_default_release_buffer (s: PAVCodecContext; pic: PAVFrame); + cdecl; external av__codec; +function avcodec_default_reget_buffer (s: PAVCodecContext; pic: PAVFrame): integer; + cdecl; external av__codec; +procedure avcodec_align_dimensions(s: PAVCodecContext; width: Pinteger; height: PInteger); + cdecl; external av__codec; + +(** + * Checks if the given dimension of a picture is valid, meaning that all + * bytes of the picture can be addressed with a signed int. + * + * @param[in] w Width of the picture. + * @param[in] h Height of the picture. + * @return Zero if valid, a negative value if invalid. + *) +function avcodec_check_dimensions (av_log_ctx: pointer; w: cardinal; h: cardinal): integer; + cdecl; external av__codec; +function avcodec_default_get_format(s: PAVCodecContext; const fmt: PAVPixelFormat): TAVPixelFormat; + cdecl; external av__codec; + +function avcodec_thread_init (s: PAVCodecContext; thread_count: integer): integer; + cdecl; external av__codec; +procedure avcodec_thread_free (s: PAVCodecContext); + cdecl; external av__codec; +function avcodec_thread_execute (s: PAVCodecContext; func: TExecuteFunc; arg: PPointer; ret: Pinteger; count: integer): integer; + cdecl; external av__codec; +function avcodec_default_execute (s: PAVCodecContext; func: TExecuteFunc; arg: PPointer; ret: Pinteger; count: integer): integer; + cdecl; external av__codec; +//FIXME func typedef + +(** + * Initializes the AVCodecContext to use the given AVCodec. Prior to using this + * function the context has to be allocated. + * + * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(), + * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for + * retrieving a codec. + * + * @warning This function is not thread safe! + * + * @code + * avcodec_register_all(); + * codec = avcodec_find_decoder(CODEC_ID_H264); + * if (!codec) + * exit(1); + * + * context = avcodec_alloc_context(); + * + * if (avcodec_open(context, codec) < 0) + * exit(1); + * @endcode + * + * @param avctx The context which will be set up to use the given codec. + * @param codec The codec to use within the context. + * @return zero on success, a negative value on error + * @see avcodec_alloc_context, avcodec_find_decoder, avcodec_find_encoder + *) +function avcodec_open (avctx: PAVCodecContext; codec: PAVCodec): integer; + cdecl; external av__codec; + +(** + * @deprecated Use avcodec_decode_audio2() instead. + *) +function avcodec_decode_audio (avctx: PAVCodecContext; samples: Pword; + var frame_size_ptr: integer; + buf: pchar; buf_size: integer): integer; + cdecl; external av__codec; + +{$IF LIBAVCODEC_VERSION >= 51030000} // 51.30.0 +(** + * Decodes an audio frame from \p buf into \p samples. + * The avcodec_decode_audio2() function decodes an audio frame from the input + * buffer \p buf of size \p buf_size. To decode it, it makes use of the + * audio codec which was coupled with \p avctx using avcodec_open(). The + * resulting decoded frame is stored in output buffer \p samples. If no frame + * could be decompressed, \p frame_size_ptr is zero. Otherwise, it is the + * decompressed frame size in \e bytes. + * + * @warning You \e must set \p frame_size_ptr to the allocated size of the + * output buffer before calling avcodec_decode_audio2(). + * + * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than + * the actual read bytes because some optimized bitstream readers read 32 or 64 + * bits at once and could read over the end. + * + * @warning The end of the input buffer \p buf should be set to 0 to ensure that + * no overreading happens for damaged MPEG streams. + * + * @note You might have to align the input buffer \p buf and output buffer \p + * samples. The alignment requirements depend on the CPU: On some CPUs it isn't + * necessary at all, on others it won't work at all if not aligned and on others + * it will work but it will have an impact on performance. In practice, the + * bitstream should have 4 byte alignment at minimum and all sample data should + * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If + * the linesize is not a multiple of 16 then there's no sense in aligning the + * start of the buffer to 16. + * + * @param avctx the codec context + * @param[out] samples the output buffer + * @param[in,out] frame_size_ptr the output buffer size in bytes + * @param[in] buf the input buffer + * @param[in] buf_size the input buffer size in bytes + * @return On error a negative value is returned, otherwise the number of bytes + * used or zero if no frame could be decompressed. + *) +function avcodec_decode_audio2(avctx : PAVCodecContext; samples : PSmallint; + var frame_size_ptr : integer; + buf: pchar; buf_size: integer): integer; + cdecl; external av__codec; +{$IFEND} + +(** + * Decodes a video frame from \p buf into \p picture. + * The avcodec_decode_video() function decodes a video frame from the input + * buffer \p buf of size \p buf_size. To decode it, it makes use of the + * video codec which was coupled with \p avctx using avcodec_open(). The + * resulting decoded frame is stored in \p picture. + * + * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than + * the actual read bytes because some optimized bitstream readers read 32 or 64 + * bits at once and could read over the end. + * + * @warning The end of the input buffer \p buf should be set to 0 to ensure that + * no overreading happens for damaged MPEG streams. + * + * @note You might have to align the input buffer \p buf and output buffer \p + * samples. The alignment requirements depend on the CPU: on some CPUs it isn't + * necessary at all, on others it won't work at all if not aligned and on others + * it will work but it will have an impact on performance. In practice, the + * bitstream should have 4 byte alignment at minimum and all sample data should + * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If + * the linesize is not a multiple of 16 then there's no sense in aligning the + * start of the buffer to 16. + * + * @param avctx the codec context + * @param[out] picture The AVFrame in which the decoded video frame will be stored. + * @param[in] buf the input buffer + * @param[in] buf_size the size of the input buffer in bytes + * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. + * @return On error a negative value is returned, otherwise the number of bytes + * used or zero if no frame could be decompressed. + *) +function avcodec_decode_video (avctx: PAVCodecContext; picture: PAVFrame; + var got_picture_ptr: integer; + buf: PByte; buf_size: integer): integer; + cdecl; external av__codec; + +(* Decode a subtitle message. Return -1 if error, otherwise return the + * number of bytes used. If no subtitle could be decompressed, + * got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. *) +function avcodec_decode_subtitle (avctx: PAVCodecContext; sub: PAVSubtitle; + var got_sub_ptr: integer; + {const} buf: pchar; buf_size: integer): integer; + cdecl; external av__codec; +function avcodec_parse_frame (avctx: PAVCodecContext; pdata: PPointer; + data_size_ptr: pinteger; + buf: pchar; buf_size: integer): integer; + cdecl; external av__codec; + +(** + * Encodes an audio frame from \p samples into \p buf. + * The avcodec_encode_audio() function encodes an audio frame from the input + * buffer \p samples. To encode it, it makes use of the audio codec which was + * coupled with \p avctx using avcodec_open(). The resulting encoded frame is + * stored in output buffer \p buf. + * + * @note The output buffer should be at least \c FF_MIN_BUFFER_SIZE bytes large. + * + * @param avctx the codec context + * @param[out] buf the output buffer + * @param[in] buf_size the output buffer size + * @param[in] samples the input buffer containing the samples + * The number of samples read from this buffer is frame_size*channels, + * both of which are defined in \p avctx. + * @return On error a negative value is returned, on success zero or the number + * of bytes used to encode the data read from the input buffer. + *) +function avcodec_encode_audio (avctx: PAVCodecContext; buf: PByte; + buf_size: integer; {const} samples: PWord): integer; + cdecl; external av__codec; + +(** + * Encodes a video frame from \p pict into \p buf. + * The avcodec_encode_video() function encodes a video frame from the input + * \p pict. To encode it, it makes use of the video codec which was coupled with + * \p avctx using avcodec_open(). The resulting encoded bytes representing the + * frame are stored in the output buffer \p buf. The input picture should be + * stored using a specific format, namely \c avctx.pix_fmt. + * + * @param avctx the codec context + * @param[out] buf the output buffer for the bitstream of encoded frame + * @param[in] buf_size the size of the output buffer in bytes + * @param[in] pict the input picture to encode + * @return On error a negative value is returned, on success zero or the number + * of bytes used from the input buffer. + *) +function avcodec_encode_video (avctx: PAVCodecContext; buf: PByte; + buf_size: integer; pict: PAVFrame): integer; + cdecl; external av__codec; +function avcodec_encode_subtitle (avctx: PAVCodecContext; buf: pchar; + buf_size: integer; {const} sub: PAVSubtitle): integer; + cdecl; external av__codec; + +function avcodec_close (avctx: PAVCodecContext): integer; + cdecl; external av__codec; + +procedure avcodec_register_all (); + cdecl; external av__codec; + +(** + * Flush buffers, should be called when seeking or when switching to a different stream. + *) +procedure avcodec_flush_buffers (avctx: PAVCodecContext); + cdecl; external av__codec; + +procedure avcodec_default_free_buffers (s: PAVCodecContext); + cdecl; external av__codec; + +(* misc useful functions *) + +(** + * Returns a single letter to describe the given picture type \p pict_type. + * + * @param[in] pict_type the picture type + * @return A single character representing the picture type. + *) +function av_get_pict_type_char (pict_type: integer): char; + cdecl; external av__codec; + +(** + * Returns codec bits per sample. + * + * @param[in] codec_id the codec + * @return Number of bits per sample or zero if unknown for the given codec. + *) +function av_get_bits_per_sample (codec_id: TCodecID): integer; + cdecl; external av__codec; + +{$IF LIBAVCODEC_VERSION >= 51041000} // 51.41.0 +(** + * Returns sample format bits per sample. + * + * @param[in] sample_fmt the sample format + * @return Number of bits per sample or zero if unknown for the given sample format. + *) +function av_get_bits_per_sample_format(sample_fmt: TSampleFormat): integer; + cdecl; external av__codec; +{$IFEND} + +const + AV_PARSER_PTS_NB = 4; + PARSER_FLAG_COMPLETE_FRAMES = $0001; + +type + {* frame parsing *} + PAVCodecParserContext = ^TAVCodecParserContext; + PAVCodecParser = ^TAVCodecParser; + + TAVCodecParserContext = record + priv_data: pointer; + parser: PAVCodecParser; + frame_offset: int64; (* offset of the current frame *) + cur_offset: int64; (* current offset (incremented by each av_parser_parse()) *) + last_frame_offset: int64; (* offset of the last frame *) + (* video info *) + pict_type: integer; (* XXX: put it back in AVCodecContext *) + repeat_pict: integer; (* XXX: put it back in AVCodecContext *) + pts: int64; (* pts of the current frame *) + dts: int64; (* dts of the current frame *) + + (* private data *) + last_pts: int64; + last_dts: int64; + fetch_timestamp: integer; + + cur_frame_start_index: integer; + cur_frame_offset: array [0..AV_PARSER_PTS_NB - 1] of int64; + cur_frame_pts: array [0..AV_PARSER_PTS_NB - 1] of int64; + cur_frame_dts: array [0..AV_PARSER_PTS_NB - 1] of int64; + + flags: integer; + + {$IF LIBAVCODEC_VERSION >= 51040003} // 51.40.3 + offset: int64; ///< byte offset from starting packet start + last_offset: int64; + {$IFEND} + end; + + TAVCodecParser = record + codec_ids: array [0..4] of integer; (* several codec IDs are permitted *) + priv_data_size: integer; + parser_init: function (s: PAVCodecParserContext): integer; cdecl; + parser_parse: function (s: PAVCodecParserContext; avctx: PAVCodecContext; + {const} poutbuf: PPointer; poutbuf_size: PInteger; + {const} buf: pchar; buf_size: integer): integer; cdecl; + parser_close: procedure (s: PAVCodecParserContext); cdecl; + split: function (avctx: PAVCodecContext; {const} buf: pchar; + buf_size: integer): integer; cdecl; + next: PAVCodecParser; + end; + + +{$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 +{ +var + av_first_parser: PAVCodecParser; external av__codec; +} +{$IFEND} + +{$IF LIBAVCODEC_VERSION >= 51049000} // 51.49.0 +function av_parser_next(c: PAVCodecParser): PAVCodecParser; + cdecl; external av__codec; +{$IFEND} + +procedure av_register_codec_parser (parser: PAVCodecParser); + cdecl; external av__codec; + +function av_parser_init (codec_id: integer): PAVCodecParserContext; + cdecl; external av__codec; + +function av_parser_parse (s: PAVCodecParserContext; + avctx: PAVCodecContext; + poutbuf: PPointer; poutbuf_size: pinteger; + const buf: pchar; buf_size: integer; + pts: int64; dts: int64): integer; + cdecl; external av__codec; +function av_parser_change (s: PAVCodecParserContext; + avctx: PAVCodecContext; + poutbuf: PPointer; poutbuf_size: PInteger; + const buf: pchar; buf_size: integer; keyframe: integer): integer; + cdecl; external av__codec; +procedure av_parser_close (s: PAVCodecParserContext); + cdecl; external av__codec; + +type + PAVBitStreamFilterContext = ^TAVBitStreamFilterContext; + PAVBitStreamFilter = ^TAVBitStreamFilter; + + TAVBitStreamFilterContext = record + priv_data: pointer; + filter: PAVBitStreamFilter; + parser: PAVCodecParserContext; + next: PAVBitStreamFilterContext; + end; + + TAVBitStreamFilter = record + name: pchar; + priv_data_size: integer; + filter: function (bsfc: PAVBitStreamFilterContext; + avctx: PAVCodecContext; args: pchar; + poutbuf: PPointer; poutbuf_size: PInteger; + buf: PByte; buf_size: integer; keyframe: integer): integer; cdecl; + {$IF LIBAVCODEC_VERSION >= 51043000} // 51.43.0 + close: procedure (bsfc: PAVBitStreamFilterContext); + {$IFEND} + next: PAVBitStreamFilter; + end; + +procedure av_register_bitstream_filter (bsf: PAVBitStreamFilter); + cdecl; external av__codec; + +function av_bitstream_filter_init (name: pchar): PAVBitStreamFilterContext; + cdecl; external av__codec; + +function av_bitstream_filter_filter (bsfc: PAVBitStreamFilterContext; + avctx: PAVCodecContext; args: pchar; + poutbuf: PPointer; poutbuf_size: PInteger; + buf: PByte; buf_size: integer; keyframe: integer): integer; + cdecl; external av__codec; +procedure av_bitstream_filter_close (bsf: PAVBitStreamFilterContext); + cdecl; external av__codec; + +{$IF LIBAVCODEC_VERSION >= 51049000} // 51.49.0 +function av_bitstream_filter_next(f: PAVBitStreamFilter): PAVBitStreamFilter; + cdecl; external av__codec; +{$IFEND} + +(* memory *) + +(** + * Reallocates the given block if it is not large enough, otherwise it + * does nothing. + * + * @see av_realloc + *) +procedure av_fast_realloc (ptr: pointer; size: PCardinal; min_size: Cardinal); + cdecl; external av__codec; + +(* for static data only *) + +(** + * Frees all static arrays and resets their pointers to 0. + * Call this function to release all statically allocated tables. + * + * @deprecated. Code which uses av_free_static is broken/misdesigned + * and should correctly use static arrays + * + *) +procedure av_free_static (); + cdecl; external av__codec; deprecated; + +(** + * Allocation of static arrays. + * + * @warning Do not use for normal allocation. + * + * @param[in] size The amount of memory you need in bytes. + * @return block of memory of the requested size + * @deprecated. Code which uses av_mallocz_static is broken/misdesigned + * and should correctly use static arrays + *) +procedure av_mallocz_static(size: cardinal); + cdecl; external av__codec; deprecated; + +{$IF LIBAVCODEC_VERSION < 51035000} // 51.35.0 +procedure av_realloc_static(ptr: pointer; size: Cardinal); + cdecl; external av__codec; +{$IFEND} + +{$IF LIBAVCODEC_VERSION >= 51039000} // 51.39.0 +(** + * Copy image 'src' to 'dst'. + *) +procedure av_picture_copy(dst: PAVPicture; {const} src: PAVPicture; + pix_fmt: integer; width: integer; height: integer); + cdecl; external av__codec; + +(** + * Crop image top and left side. + *) +function av_picture_crop(dst: PAVPicture; {const} src: PAVPicture; + pix_fmt: integer; top_band: integer; left_band: integer): integer; + cdecl; external av__codec; + +(** + * Pad image. + *) +function av_picture_pad(dst: PAVPicture; {const} src: PAVPicture; height: integer; width: integer; pix_fmt: integer; + padtop: integer; padbottom: integer; padleft: integer; padright: integer; color: PInteger): integer; + cdecl; external av__codec; +{$IFEND} + +{$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 +(** + * @deprecated Use the software scaler (swscale) instead. + *) +procedure img_copy (dst: PAVPicture; const src: PAVPicture; + pix_fmt: TAVPixelFormat; width: integer; height: integer); + cdecl; external av__codec; deprecated; + +(** + * @deprecated Use the software scaler (swscale) instead. + *) +function img_crop (dst: PAVPicture; const src: PAVPicture; + pix_fmt: TAVPixelFormat; top_band, left_band: integer): integer; + cdecl; external av__codec; deprecated; + +(** + * @deprecated Use the software scaler (swscale) instead. + *) +function img_pad (dst: PAVPicture; const src: PAVPicture; height, width: integer; + pix_fmt: TAVPixelFormat; padtop, padbottom, padleft, padright: integer; + color: PInteger): integer; + cdecl; external av__codec; deprecated; +{$IFEND} + +function av_xiphlacing(s: PByte; v: Cardinal): Cardinal; + cdecl; external av__codec; + +{$IF LIBAVCODEC_VERSION >= 51041000} // 51.41.0 +(** + * Parses \p str and put in \p width_ptr and \p height_ptr the detected values. + * + * @return 0 in case of a successful parsing, a negative value otherwise + * @param[in] str the string to parse: it has to be a string in the format + * x or a valid video frame size abbreviation. + * @param[in,out] width_ptr pointer to the variable which will contain the detected + * frame width value + * @param[in,out] height_ptr pointer to the variable which will contain the detected + * frame height value + *) +function av_parse_video_frame_size(width_ptr: PInteger; height_ptr: PInteger; {const} str: PChar): integer; + cdecl; external av__codec; + +(** + * Parses \p str and put in \p frame_rate the detected values. + * + * @return 0 in case of a successful parsing, a negative value otherwise + * @param[in] str the string to parse: it has to be a string in the format + * /, a float number or a valid video rate abbreviation + * @param[in,out] frame_rate pointer to the AVRational which will contain the detected + * frame rate + *) +function av_parse_video_frame_rate(frame_rate: PAVRational; {const} str: PChar): integer; + cdecl; external av__codec; +{$IFEND} + +(* +{* error handling *} +#if EINVAL > 0 +#define AVERROR(e) (-(e)) {**< Returns a negative error code from a POSIX error code, to return from library functions. *} +#define AVUNERROR(e) (-(e)) {**< Returns a POSIX error code from a library function error return value. *} +#else +{* Some platforms have E* and errno already negated. *} +#define AVERROR(e) (e) +#define AVUNERROR(e) (e) +#endif + +const + AVERROR_UNKNOWN AVERROR(EINVAL) {**< unknown error *} + AVERROR_IO AVERROR(EIO) {**< I/O error *} + AVERROR_NUMEXPECTED AVERROR(EDOM) {**< Number syntax expected in filename. *} + AVERROR_INVALIDDATA AVERROR(EINVAL) {**< invalid data found *} + AVERROR_NOMEM AVERROR(ENOMEM) {**< not enough memory *} + AVERROR_NOFMT AVERROR(EILSEQ) {**< unknown format *} + AVERROR_NOTSUPP AVERROR(ENOSYS) {**< Operation not supported. *} + AVERROR_NOENT AVERROR(ENOENT) {**< No such file or directory. *} + AVERROR_PATCHWELCOME -MKTAG('P','A','W','E') {**< Not yet implemented in FFmpeg. Patches welcome. *} +*) + +const + AVERROR_UNKNOWN =(-1); (* unknown error *) + AVERROR_IO =(-2); (* i/o error *) + AVERROR_NUMEXPECTED =(-3); (* number syntax expected in filename *) + AVERROR_INVALIDDATA =(-4); (* invalid data found *) + AVERROR_NOMEM =(-5); (* not enough memory *) + AVERROR_NOFMT =(-6); (* unknown format *) + AVERROR_NOTSUPP =(-7); (* operation not supported *) + +implementation + +end. diff --git a/Game/Code/lib/ffmpeg/avformat.pas b/Game/Code/lib/ffmpeg/avformat.pas index bcd7861c..41d964bb 100644 --- a/Game/Code/lib/ffmpeg/avformat.pas +++ b/Game/Code/lib/ffmpeg/avformat.pas @@ -1,188 +1,298 @@ - (* +(* * copyright (c) 2001 Fabrice Bellard * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) + *) (* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. -For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT -in the source codes *) + * For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT + * in the source codes *) + +// Min. version: 50.5.0 +// Max. version: 52.5.0, Revision: 11574 unit avformat; {$IFDEF FPC} - {$IFDEF LINUX} - {$LINKLIB libavutil} - {$LINKLIB libavformat} - {$ENDIF} - - {$MODE DELPHI } (* CAT *) - {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) - {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) + {$MODE DELPHI } + {$PACKENUM 4} (* use 4-byte enums *) + {$PACKRECORDS C} (* C/C++-compatible record packing *) +{$ELSE} + {$MINENUMSIZE 4} (* use 4-byte enums *) {$ENDIF} interface uses avcodec, + avutil, avio, rational, - avutil; (* CAT *) - -{$I version.inc} + UConfig; const - MAXINT64 = $7fffffffffffffff; - MININT64 = $8000000000000000; + (* Max. supported version by this header *) + LIBAVFORMAT_MAX_VERSION_MAJOR = 52; + LIBAVFORMAT_MAX_VERSION_MINOR = 5; + LIBAVFORMAT_MAX_VERSION_RELEASE = 0; + LIBAVFORMAT_MAX_VERSION = (LIBAVFORMAT_MAX_VERSION_MAJOR * VERSION_MAJOR) + + (LIBAVFORMAT_MAX_VERSION_MINOR * VERSION_MINOR) + + (LIBAVFORMAT_MAX_VERSION_RELEASE * VERSION_RELEASE); + +(* Check if linked versions are supported *) +{$IF (LIBAVFORMAT_VERSION > LIBAVFORMAT_MAX_VERSION)} + {$MESSAGE Warn 'Linked version of libavformat may be unsupported!'} +{$IFEND} + +type + PAVFile = Pointer; +(* packet functions *) + +type + PAVPacket = ^TAVPacket; + TAVPacket = record + pts: int64; ///< presentation time stamp in time_base units + dts: int64; ///< decompression time stamp in time_base units + data: PByte; + size: integer; + stream_index: integer; + flags: integer; + duration: integer; ///< presentation duration in time_base units (0 if not available) + destruct: procedure (p: PAVPacket); cdecl; + priv: pointer; + pos: int64; ///< byte position in stream, -1 if unknown + end; +const PKT_FLAG_KEY = $0001; +procedure av_destruct_packet_nofree (var pkt: TAVPacket); + cdecl; external av__format; + +(** + * Default packet destructor. + *) +procedure av_destruct_packet (var pkt: TAVPacket); + cdecl; external av__format; + +(** + * Initialize optional fields of a packet to default values. + * + * @param pkt packet + *) +procedure av_init_packet (var pkt: TAVPacket); +{$IF LIBAVFORMAT_VERSION >= 51012002} // 51.12.2 + cdecl; external av__format; +{$IFEND} + +(** + * Allocate the payload of a packet and initialize its fields to default values. + * + * @param pkt packet + * @param size wanted payload size + * @return 0 if OK. AVERROR_xxx otherwise. + *) +function av_new_packet(var pkt: TAVPacket; size: integer): integer; + cdecl; external av__format; + +(** + * Allocate and read the payload of a packet and initialize its fields to default values. + * + * @param pkt packet + * @param size wanted payload size + * @return >0 (read size) if OK. AVERROR_xxx otherwise. + *) +function av_get_packet (s: PByteIOContext; var pkt: TAVPacket; size: integer): integer; + cdecl; external av__format; + +(** + * @warning This is a hack - the packet memory allocation stuff is broken. The + * packet is allocated if it was not really allocated + *) +function av_dup_packet (pkt: PAVPacket): integer; + cdecl; external av__format; + +(** + * Free a packet + * + * @param pkt packet to free + *) +procedure av_free_packet (pkt: PAVPacket); inline; + +(*************************************************) +(* fractional numbers for exact pts handling *) + +type + (** + * the exact value of the fractional number is: 'val + num / den'. + * num is assumed to be such as 0 <= num < den + * @deprecated Use AVRational instead + *) + PAVFrac = ^TAVFrac; + TAVFrac = record + val, num, den: int64; + end; {deprecated} + (*************************************************) (* input/output formats *) +type + (* this structure contains the data a format has to probe a file *) + TAVProbeData = record + filename: pchar; + buf: pchar; + buf_size: integer; + end; + +const AVPROBE_SCORE_MAX = 100; ///< max score, half of that is used for file extension based detection AVPROBE_PADDING_SIZE = 32; ///< extra allocated bytes at the end of the probe buffer -//! demuxer will use url_fopen, no opened file should be provided by the caller - AVFMT_NOFILE = $0001; - AVFMT_NEEDNUMBER = $0002; (**< needs '%d' in filename *) - AVFMT_SHOW_IDS = $0008; (**< show format stream IDs numbers *) - AVFMT_RAWPICTURE = $0020; (**< format wants AVPicture structure for + //! demuxer will use url_fopen, no opened file should be provided by the caller + AVFMT_NOFILE = $0001; + AVFMT_NEEDNUMBER = $0002; (**< needs '%d' in filename *) + AVFMT_SHOW_IDS = $0008; (**< show format stream IDs numbers *) + AVFMT_RAWPICTURE = $0020; (**< format wants AVPicture structure for raw picture data *) - AVFMT_GLOBALHEADER = $0040; (**< format wants global header *) - AVFMT_NOTIMESTAMPS = $0080; (**< format does not need / have any timestamps *) + AVFMT_GLOBALHEADER = $0040; (**< format wants global header *) + AVFMT_NOTIMESTAMPS = $0080; (**< format does not need / have any timestamps *) AVFMT_GENERIC_INDEX = $0100; (**< use generic index building code *) + // used by AVIndexEntry AVINDEX_KEYFRAME = $0001; - MAX_REORDER_DELAY = 4; - AVFMTCTX_NOHEADER = $0001; (**< signal that no header is present (streams are added dynamically) *) MAX_STREAMS = 20; + AVFMT_NOOUTPUTLOOP = -1; AVFMT_INFINITEOUTPUTLOOP = 0; AVFMT_FLAG_GENPTS = $0001; ///< generate pts if missing even if it requires parsing future frames AVFMT_FLAG_IGNIDX = $0002; ///< ignore index AVFMT_FLAG_NONBLOCK = $0004; ///< do not block when reading packets from input + // used by AVStream + MAX_REORDER_DELAY = 4; + + // used by TAVProgram + AV_PROGRAM_RUNNING = 1; + type - HFILE = THandle; /// (* CAT *) - int = integer; + PPAVCodecTag = ^PAVCodecTag; + PAVCodecTag = Pointer; - PAVPacket = ^TAVPacket; - PAVImageFormat = ^TAVImageFormat; + PPAVFormatContext = ^PAVFormatContext; PAVFormatContext = ^TAVFormatContext; + PAVFormatParameters = ^TAVFormatParameters; + PAVOutputFormat = ^TAVOutputFormat; PAVProbeData = ^TAVProbeData; + PAVInputFormat = ^TAVInputFormat; PAVIndexEntry = ^TAVIndexEntry; + PAVStream = ^TAVStream; PAVPacketList = ^TAVPacketList; - PAVImageInfo = ^TAVImageInfo; - TAVPacket = record {56} - pts: int64; ///< presentation time stamp in time_base units - dts: int64; ///< decompression time stamp in time_base units - data: PByte; - size: integer; - stream_index: integer; - flags: integer; - duration: integer; ///< presentation duration in time_base units (0 if not available) - destruct: procedure (p: PAVPacket); cdecl; (* This cannot be var : TAVPacket. - because TAVPacket is not completely defined yet *) - priv: pointer; - pos: int64 ///< byte position in stream, -1 if unknown - end; - -(*************************************************) -(* fractional numbers for exact pts handling *) - -(* the exact value of the fractional number is: 'val + num / den'. num - is assumed to be such as 0 <= num < den *) - PAVFrac = ^TAVFrac; - TAVFrac = record - val, num, den: int64; - end; + PPAVProgram = ^PAVProgram; + PAVProgram = ^TAVProgram; -(* this structure contains the data a format has to probe a file *) - TAVProbeData = record {12} - filename: pchar; - buf: pchar; - buf_size: integer; - end; + {$IF LIBAVFORMAT_VERSION < 51006000} // 51.6.0 + PAVImageFormat = ^TAVImageFormat; + PAVImageInfo = ^TAVImageInfo; + {$IFEND} - TAVFormatParameters = record {56} - time_base: TAVRational; (* 8 bytes *) + TAVFormatParameters = record + time_base: TAVRational; sample_rate: integer; channels: integer; width: integer; height: integer; pix_fmt: TAVPixelFormat; -{ image_format: PAVImageFormat; (* 4 bytes *)} (* CAT#3 *) + {$IF LIBAVFORMAT_VERSION < 51006000} // 51.6.0 + image_format: PAVImageFormat; + {$IFEND} channel: integer; (* used to select dv channel *) + {$IF LIBAVFORMAT_VERSION_MAJOR < 52} device: pchar; (* video, audio or DV device, if LIBAVFORMAT_VERSION_INT < (52<<16) *) + {$IFEND} standard: pchar; (* tv standard, NTSC, PAL, SECAM *) -// int mpeg2ts_raw:1; (* force raw MPEG2 transport stream output, if possible *) -// int mpeg2ts_compute_pcr:1; (* compute exact PCR for each transport -// stream packet (only meaningful if -// mpeg2ts_raw is TRUE *) -// int initial_pause:1; (* do not begin to play the stream -// immediately (RTSP only) *) -// int prealloced_context:1; - dummy: byte; + { Delphi does not support bit fields -> use bf_flags instead + int mpeg2ts_raw:1; (* force raw MPEG2 transport stream output, if possible *) + int mpeg2ts_compute_pcr:1; (* compute exact PCR for each transport + stream packet (only meaningful if + mpeg2ts_raw is TRUE *) + int initial_pause:1; (* do not begin to play the stream + immediately (RTSP only) *) + int prealloced_context:1; + } + bf_flags: byte; // 0:mpeg2ts_raw/1:mpeg2ts_compute_pcr/2:initial_pause/3:prealloced_context + {$IF LIBAVFORMAT_VERSION_MAJOR < 53} video_codec_id: TCodecID; audio_codec_id: TCodecID; + {$IFEND} end; - TAVOutputFormat = record {56} + TAVOutputFormat = record name: pchar; long_name: pchar; mime_type: pchar; - extensions: pchar; (* comma separated extensions *) + extensions: pchar; (*< comma separated filename extensions *) (* size of private data so that it can be allocated in the wrapper *) priv_data_size: integer; (* output support *) audio_codec: TCodecID; (* default audio codec *) video_codec: TCodecID; (* default video codec *) write_header: function (c: PAVFormatContext): integer; cdecl; - write_packet: function (c: PAVFormatContext; var pkt: TAVPacket): integer; cdecl; (* CAT#2 *) + write_packet: function (c: PAVFormatContext; pkt: PAVPacket): integer; cdecl; write_trailer: function (c: PAVFormatContext): integer; cdecl; (* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER *) flags: integer; (* currently only used to set pixel format if not YUV420P *) set_parameters: function (c: PAVFormatContext; f: PAVFormatParameters): integer; cdecl; - interleave_packet: function (s: PAVFormatContext; _out: PAVPacket; _in: PAVPacket; flush: integer): integer; cdecl; + interleave_packet: function (s: PAVFormatContext; out_: PAVPacket; in_: PAVPacket; flush: integer): integer; cdecl; + {$IF LIBAVFORMAT_VERSION >= 51008000} // 51.8.0 (** * list of supported codec_id-codec_tag pairs, ordered by "better choice first" * the arrays are all CODEC_ID_NONE terminated *) - //const struct AVCodecTag **codec_tag; + codec_tag: {const} PPAVCodecTag; + {$IFEND} + + {$IF LIBAVFORMAT_VERSION >= 51012002} // 51.12.2 + subtitle_codec: TCodecID; (**< default subtitle codec *) + {$IFEND} (* private fields *) next: PAVOutputFormat; end; - TAVInputFormat = record {60} + TAVInputFormat = record name: pchar; long_name: pchar; (* size of private data so that it can be allocated in the wrapper *) priv_data_size: integer; - (* tell if a given file has a chance of being parsing by this format *) + (** + * Tell if a given file has a chance of being parsed by this format. + * The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes + * big so you do not have to check for that unless you need more. + *) read_probe: function (p: PAVProbeData): integer; cdecl; (* read the format header and initialize the AVFormatContext structure. Return 0 if OK. 'ap' if non NULL contains @@ -196,16 +306,22 @@ type (* close the stream. The AVFormatContext and AVStreams are not freed by this function *) read_close: function (c: PAVFormatContext): integer; cdecl; - (*** seek to a given timestamp relative to the frames in + (** + * seek to a given timestamp relative to the frames in * stream component stream_index * @param stream_index must not be -1 * @param flags selects which direction should be preferred if no exact - * match is available *) + * match is available + * @return >= 0 on success (but not necessarily the new offset) + *) read_seek: function (c: PAVFormatContext; stream_index: integer; timestamp: int64; flags: integer): integer; cdecl; - (*** gets the next timestamp in AV_TIME_BASE units. *) + (** + * gets the next timestamp in stream[stream_index].time_base units. + * @return the timestamp or AV_NOPTS_VALUE if an error occured + *) read_timestamp: function (s: PAVFormatContext; stream_index: integer; - pos: pint64; pos_limit: int64): integer; cdecl; + pos: pint64; pos_limit: int64): int64; cdecl; (* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER *) flags: integer; (* if extensions are defined, then no probe is done. You should @@ -221,7 +337,9 @@ type (* pause playing - only meaningful if using a network based format (RTSP) *) read_pause: function (c: PAVFormatContext): integer; cdecl; - //const struct AVCodecTag **codec_tag; + {$IF LIBAVFORMAT_VERSION >= 51008000} // 51.8.0 + codec_tag: {const} PPAVCodecTag; + {$IFEND} (* private fields *) next: PAVInputFormat; @@ -232,55 +350,84 @@ type AVSTREAM_PARSE_FULL, (**< full parsing and repack *) AVSTREAM_PARSE_HEADERS, (**< only parse headers, don't repack *) AVSTREAM_PARSE_TIMESTAMPS (**< full parsing and interpolation of timestamps for frames not starting on packet boundary *) - ); + ); - TAVIndexEntry = record {24} + TAVIndexEntry = record pos: int64; timestamp: int64; -(* the following 2 flags indicate that the next/prev keyframe is known, and scaning for it isnt needed *) - flags: integer; -// int flags:2; -// int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs 32 byte due to possible 8byte align). + { Delphi doesn't support bitfields -> use flags_size instead + int flags:2; + int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs 32 byte due to possible 8byte align). + } + flags_size: cardinal; // 0..1: flags, 2..31: size min_distance: integer; (* min distance between this and the previous keyframe, used to avoid unneeded searching *) end; - TAVStream = record {168} - index: integer; (* stream index in AVFormatContext *) {4-4} - id: integer; (* format specific stream id *) {4-8} - codec: PAVCodecContext; (* codec context *) {4-12} - (*** real base frame rate of the stream. - * for example if the timebase is 1/90000 and all frames have either - * approximately 3600 or 1800 timer ticks then r_frame_rate will be 50/1 *) - r_frame_rate: TAVRational; {4*2=8-20} - priv_data: pointer; {4-24} + (** + * Stream structure. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVStream) must not be used outside libav*. + *) + TAVStream = record + index: integer; (* stream index in AVFormatContext *) + id: integer; (* format specific stream id *) + codec: PAVCodecContext; (* codec context *) + (** + * Real base frame rate of the stream. + * This is the lowest frame rate with which all timestamps can be + * represented accurately (it is the least common multiple of all + * frame rates in the stream), Note, this value is just a guess! + * For example if the timebase is 1/90000 and all frames have either + * approximately 3600 or 1800 timer ticks then r_frame_rate will be 50/1. + *) + r_frame_rate: TAVRational; + priv_data: pointer; + (* internal data used in av_find_stream_info() *) - codec_info_duration: int64; (* #if LIBAVFORMAT_VERSION_INT < (52<<16) *) {8-32} - codec_info_nb_frames: integer; (* #if LIBAVFORMAT_VERSION_INT < (52<<16) *) {4-38} - (* encoding: PTS generation when outputing stream *) - pts: TAVFrac; {8*3=24-62} - - (*** this is the fundamental unit of time (in seconds) in terms - * of which frame timestamps are represented. for fixed-fps content, - * timebase should be 1/framerate and timestamp increments should be - * identically 1. *) - time_base: TAVRational; {4*2=8-70} - pts_wrap_bits: integer; (* number of bits in pts (used for wrapping control) *) {4-74} + first_dts: int64; + {$IF LIBAVFORMAT_VERSION_MAJOR < 52} + codec_info_nb_frames: integer; + {$IFEND} + + (** encoding: PTS generation when outputing stream *) + pts: TAVFrac; + (** + * This is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. For fixed-fps content, + * timebase should be 1/frame rate and timestamp increments should be + * identically 1. + *) + time_base: TAVRational; + pts_wrap_bits: integer; (* number of bits in pts (used for wrapping control) *) (* ffmpeg.c private use *) - stream_copy: integer; (* if TRUE, just copy stream *) {4-78} - discard: TAVDiscard; ///< selects which packets can be discarded at will and dont need to be demuxed {4-82} + stream_copy: integer; (**< if set, just copy stream *) + discard: TAVDiscard; ///< selects which packets can be discarded at will and dont need to be demuxed //FIXME move stuff to a flags field? (* quality, as it has been removed from AVCodecContext and put in AVVideoFrame * MN:dunno if thats the right place, for it *) - quality: single; {4-86} - (* decoding: position of the first frame of the component, in AV_TIME_BASE fractional seconds. *) - start_time: int64; {8-92} - (* decoding: duration of the stream, in stream time base. *) - duration: int64; {8-100} + quality: single; + (** + * Decoding: pts of the first frame of the stream, in stream time base. + * Only set this if you are absolutely 100% sure that the value you set + * it to really is the pts of the first frame. + * This may be undefined (AV_NOPTS_VALUE). + * @note The ASF header does NOT contain a correct start_time the ASF + * demuxer must NOT set this. + *) + start_time: int64; + (** + * Decoding: duration of the stream, in stream time base. + * If a source file does not specify a duration, but does specify + * a bitrate, this value will be estimates from bit rate and file size. + *) + duration: int64; - language: array [0..3] of char; (* ISO 639 3-letter language code (empty string if undefined) *)(* 101 th byte - 1 base *) {4-104} + language: array [0..3] of char; (* ISO 639 3-letter language code (empty string if undefined) *) (* av_read_frame() support *) - need_parsing: TAVStreamParseType;//CAT#3 ///< 1->full parsing needed, 2->only parse headers dont repack + need_parsing: TAVStreamParseType; parser: PAVCodecParserContext; cur_dts: int64; @@ -289,27 +436,35 @@ type (* av_seek_frame() support *) index_entries: PAVIndexEntry; (* only used if the format does not support seeking natively *) nb_index_entries: integer; - index_entries_allocated_size: cardinal; (* CAT#3 *) + index_entries_allocated_size: cardinal; nb_frames: int64; ///< number of frames in this stream if known or 0 + {$IF LIBAVFORMAT_VERSION >= 50006000} // 50.6.0 pts_buffer: array [0..MAX_REORDER_DELAY] of int64 + {$IFEND} end; -(* format I/O context *) - TAVFormatContext = record {3960} + (** + * format I/O context. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVFormatContext) must not be used outside libav*. + *) + TAVFormatContext = record av_class: PAVClass; (* set by av_alloc_format_context *) (* can only be iformat or oformat, not both at the same time *) iformat: PAVInputFormat; oformat: PAVOutputFormat; priv_data: pointer; - {$IF (LIBAVFORMAT_MAJOR_VERSION >= 52)} + {$IF LIBAVFORMAT_VERSION_MAJOR >= 52} pb: PByteIOContext; {$ELSE} pb: TByteIOContext; {$IFEND} - nb_streams: cardinal; (* CAT#3 *) + nb_streams: cardinal; streams: array [0..MAX_STREAMS - 1] of PAVStream; filename: array [0..1023] of char; (* input or output filename *) (* stream info *) @@ -365,37 +520,97 @@ type flags: integer; loop_input: integer; + + {$IF LIBAVFORMAT_VERSION >= 50006000} // 50.6.0 (* decoding: size of data to probe; encoding unused *) probesize: cardinal; + {$IFEND} + {$IF LIBAVFORMAT_VERSION >= 51009000} // 51.9.0 (** * maximum duration in AV_TIME_BASE units over which the input should be analyzed in av_find_stream_info() *) max_analyze_duration: integer; key: pbyte; - keylen : integer + keylen : integer; + {$IFEND} + + {$IF LIBAVFORMAT_VERSION >= 51014000} // 51.14.0 + nb_programs: cardinal; + programs: PPAVProgram; + {$IFEND} + + {$IF LIBAVFORMAT_VERSION >= 52003000} // 52.3.0 + (** + * Forced video codec_id. + * demuxing: set by user + *) + video_codec_id: TCodecID; + (** + * Forced audio codec_id. + * demuxing: set by user + *) + audio_codec_id: TCodecID; + (** + * Forced subtitle codec_id. + * demuxing: set by user + *) + subtitle_codec_id: TCodecID; + {$IFEND} + + {$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0 + (** + * Maximum amount of memory in bytes to use per stream for the index. + * If the needed index exceeds this size entries will be discarded as + * needed to maintain a smaller size. This can lead to slower or less + * accurate seeking (depends on demuxer). + * Demuxers for which a full in memory index is mandatory will ignore + * this. + * muxing : unused + * demuxing: set by user + *) + max_index_size: cardinal; + {$IFEND} end; - TAVPacketList = record {64} + (** + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVProgram) must not be used outside libav*. + *) + TAVProgram = record + id : integer; + provider_name : PChar; ///< Network name for DVB streams + name : PChar; ///< Service name for DVB streams + flags : integer; + discard : TAVDiscard; ///< selects which program to discard and which to feed to the caller + {$IF LIBAVFORMAT_VERSION >= 51016000} // 51.16.0 + stream_index : PCardinal; + nb_stream_indexes : PCardinal; + {$IFEND} + end; + + TAVPacketList = record pkt: TAVPacket; next: PAVPacketList; end; -(* still image support *) - PAVInputImageContext = pointer; // attribute_deprecated; -// PAVInputImageContext = pointer; //AVInputImageContext attribute_deprecated; +{$IF LIBAVFORMAT_VERSION < 51006000} // 51.6.0 + (* still image support *) + PAVInputImageContext = pointer; {deprecated} -(* still image support *) - TAVImageInfo = record {48} + (* still image support *) + TAVImageInfo = record pix_fmt: TAVPixelFormat; (* requested pixel format *) width: integer; (* requested width *) height: integer; (* requested height *) interleaved: integer; (* image is interleaved (e.g. interleaved GIF) *) pict: TAVPicture; (* returned allocated image *) - end; + end; {deprecated} - TAVImageFormat = record {32} + TAVImageFormat = record name: pchar; extensions: pchar; (* tell if a given file has a chance of being parsing by this format *) @@ -410,134 +625,212 @@ type img_write: function (b: PByteIOContext; i: PAVImageInfo): integer; cdecl; flags: integer; next: PAVImageFormat; - end; - -procedure av_destruct_packet_nofree (var pkt: TAVPacket); (* CAT#2 *) - cdecl; external av__format; -procedure av_destruct_packet (var pkt: TAVPacket); (* CAT#2 *) - cdecl; external av__format; - -(* initialize optional fields of a packet *) -procedure av_init_packet (var pkt: TAVPacket); (* CAT#2 *) - -function av_new_packet(var pkt: TAVPacket; size: integer): integer; (* CAT#2 *) - cdecl; external av__format; - -function av_get_packet (s: PByteIOContext; var pkt: TAVPacket; size: integer): integer; (* CAT#2 *) - cdecl; external av__format; - -function av_dup_packet (pkt: PAVPacket): integer; - cdecl; external av__format; - -(** * Free a packet - * - * @param pkt packet to free *) -procedure av_free_packet (var pkt: TAVPacket); (* CAT#2 *) + end; {deprecated} procedure av_register_image_format (img_fmt: PAVImageFormat); - cdecl; external av__format; + cdecl; external av__format; deprecated; function av_probe_image_format (pd: PAVProbeData): PAVImageFormat; - cdecl; external av__format; + cdecl; external av__format; deprecated; function guess_image_format (filename: pchar): PAVImageFormat; - cdecl; external av__format; - -function av_guess_image2_codec(filename: pchar): TCodecID; - cdecl; external av__format; + cdecl; external av__format; deprecated; function av_read_image (pb: PByteIOContext; filename: pchar; fmt: PAVImageFormat; alloc_cb: pointer; opaque: pointer): integer; - cdecl; external av__format; + cdecl; external av__format; deprecated; function av_write_image(pb: PByteIOContext; fmt: PAVImageFormat; img: PAVImageInfo): integer; + cdecl; external av__format; deprecated; +{$IFEND} + +{$IF LIBAVFORMAT_VERSION_MAJOR < 53} +{ +var + first_iformat: PAVInputFormat; external av__format; + first_oformat: PAVOutputFormat; external av__format; +} +{$IFEND} + +{$IF LIBAVFORMAT_VERSION >= 52003000} // 52.3.0 +function av_iformat_next(f: PAVInputFormat): PAVInputFormat; + cdecl; external av__format; +function av_oformat_next(f: PAVOutputFormat): PAVOutputFormat; + cdecl; external av__format; +{$IFEND} + +function av_guess_image2_codec({const} filename: PChar): TCodecID; cdecl; external av__format; (* XXX: use automatic init with either ELF sections or C file parser *) (* modules *) -//#include "rtp.h" +(* utils.c *) +procedure av_register_input_format (format: PAVInputFormat); + cdecl; external av__format; -//#include "rtsp.h" +procedure av_register_output_format (format: PAVOutputFormat); + cdecl; external av__format; -(* utils.c *) - procedure av_register_input_format (format: PAVInputFormat); - cdecl; external av__format; +function guess_stream_format (short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; + cdecl; external av__format; - procedure av_register_output_format (format: PAVOutputFormat); - cdecl; external av__format; +function guess_format(short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; + cdecl; external av__format; - function guess_stream_format (short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; - cdecl; external av__format; +(** + * Guesses the codec id based upon muxer and filename. + *) +function av_guess_codec(fmt: PAVOutputFormat; short_name: pchar; + filename: pchar; mime_type: pchar; type_: TCodecType): TCodecID; + cdecl; external av__format; - function guess_format(short_name: pchar; filename: pchar; mime_type: pchar): PAVOutputFormat; - cdecl; external av__format; +(** + * Send a nice hexadecimal dump of a buffer to the specified file stream. + * + * @param f The file stream pointer where the dump should be sent to. + * @param buf buffer + * @param size buffer size + * + * @see av_hex_dump_log, av_pkt_dump, av_pkt_dump_log + *) +procedure av_hex_dump (f: PAVFile; buf: pchar; size: integer); + cdecl; external av__format; - function av_guess_codec(fmt: PAVOutputFormat; short_name: pchar; - filename: pchar; mime_type: pchar; _type: TCodecType): TCodecID; - cdecl; external av__format; +{$IF LIBAVFORMAT_VERSION >= 51011000} // 51.11.0 +(** + * Send a nice hexadecimal dump of a buffer to the log. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message, lower values signifying + * higher importance. + * @param buf buffer + * @param size buffer size + * + * @see av_hex_dump, av_pkt_dump, av_pkt_dump_log + *) +procedure av_hex_dump_log(avcl: Pointer; level: integer; buf: PChar; size: integer); + cdecl; external av__format; +{$IFEND} - procedure av_hex_dump (f: HFILE; buf: pchar; size: integer); - cdecl; external av__format; - procedure av_pkt_dump(f: HFILE; var pkt: TAVPacket; dump_payload: integer); (* CAT#2 *) - cdecl; external av__format; +(** + * Send a nice dump of a packet to the specified file stream. + * + * @param f The file stream pointer where the dump should be sent to. + * @param pkt packet to dump + * @param dump_payload true if the payload must be displayed too + *) +procedure av_pkt_dump(f: PAVFile; pkt: PAVPacket; dump_payload: integer); + cdecl; external av__format; - procedure av_register_all (); - cdecl; external av__format; +{$IF LIBAVFORMAT_VERSION >= 51011000} // 51.11.0 +(** + * Send a nice dump of a packet to the log. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message, lower values signifying + * higher importance. + * @param pkt packet to dump + * @param dump_payload true if the payload must be displayed too + *) +procedure av_pkt_dump_log(avcl: Pointer; level: integer; pkt: PAVPacket; dump_payload: integer); + cdecl; external av__format; +{$IFEND} +procedure av_register_all (); + cdecl; external av__format; + +{$IF LIBAVFORMAT_VERSION >= 51008000} // 51.8.0 +(** codec tag <-> codec id *) +function av_codec_get_id(var tags: PAVCodecTag; tag: cardinal): TCodecID; + cdecl; external av__format; +function av_codec_get_tag(var tags: PAVCodecTag; id: TCodecID): cardinal; + cdecl; external av__format; +{$IFEND} (* media file input *) - function av_find_input_format (short_name: pchar): PAVInputFormat; - cdecl; external av__format; - function av_probe_input_format (pd: PAVProbeData; is_opened: integer): PAVInputFormat; - cdecl; external av__format; - function av_open_input_stream (ic_ptr: PAVFormatContext; - pb: PByteIOContext; filename: pchar; - fmt: PAVInputFormat; ap: PAVFormatParameters): integer; - cdecl; external av__format; -(*** Open a media file as input. The codec are not opened. Only the file + +(** + * finds AVInputFormat based on input format's short name. + *) +function av_find_input_format (short_name: pchar): PAVInputFormat; + cdecl; external av__format; + +(** + * Guess file format. + * + * @param is_opened whether the file is already opened, determines whether + * demuxers with or without AVFMT_NOFILE are probed + *) +function av_probe_input_format (pd: PAVProbeData; is_opened: integer): PAVInputFormat; + cdecl; external av__format; + +(** + * Allocates all the structures needed to read an input stream. + * This does not open the needed codecs for decoding the stream[s]. + *) +function av_open_input_stream (ic_ptr: PAVFormatContext; + pb: PByteIOContext; filename: pchar; + fmt: PAVInputFormat; ap: PAVFormatParameters): integer; + cdecl; external av__format; + +(** + * Open a media file as input. The codecs are not opened. Only the file * header (if present) is read. * * @param ic_ptr the opened media file handle is put here * @param filename filename to open. * @param fmt if non NULL, force the file format to use * @param buf_size optional buffer size (zero if default is OK) - * @param ap additionnal parameters needed when opening the file (NULL if default) - * @return 0 if OK. AVERROR_xxx otherwise. *) - - function av_open_input_file (var ic_ptr: PAVFormatContext; filename: pchar; - fmt: PAVInputFormat; buf_size: integer; - ap: PAVFormatParameters): integer; - cdecl; external av__format; + * @param ap additional parameters needed when opening the file (NULL if default) + * @return 0 if OK. AVERROR_xxx otherwise. + *) +function av_open_input_file (var ic_ptr: PAVFormatContext; filename: pchar; + fmt: PAVInputFormat; buf_size: integer; + ap: PAVFormatParameters): integer; + cdecl; external av__format; - (* no av_open for output, so applications will need this: *) - function av_alloc_format_context (): PAVFormatContext; - cdecl; external av__format; +(** + * Allocate an AVFormatContext. + * Can be freed with av_free() but do not forget to free everything you + * explicitly allocated as well! + *) +function av_alloc_format_context (): PAVFormatContext; + cdecl; external av__format; -const - AVERROR_UNKNOWN =(-1); (* unknown error *) - AVERROR_IO =(-2); (* i/o error *) - AVERROR_NUMEXPECTED =(-3); (* number syntax expected in filename *) - AVERROR_INVALIDDATA =(-4); (* invalid data found *) - AVERROR_NOMEM =(-5); (* not enough memory *) - AVERROR_NOFMT =(-6); (* unknown format *) - AVERROR_NOTSUPP =(-7); (* operation not supported *) - -(*** Read the beginning of a media file to get stream information. This +(** + * Read packets of a media file to get stream information. This * is useful for file formats with no headers such as MPEG. This - * function also compute the real frame rate in case of mpeg2 repeat + * function also computes the real frame rate in case of mpeg2 repeat * frame mode. + * The logical file position is not changed by this function; + * examined packets may be buffered for later processing. * * @param ic media file handle * @return >=0 if OK. AVERROR_xxx if error. - * @todo let user decide somehow what information is needed so we dont waste time geting stuff the user doesnt need *) + * @todo Let user decide somehow what information is needed so we do not waste time getting stuff the user does not need. + *) +function av_find_stream_info (ic: PAVFormatContext): integer; + cdecl; external av__format; - function av_find_stream_info (ic: PAVFormatContext): integer; - cdecl; external av__format; - function av_read_packet (s: PAVFormatContext; var pkt: TAVPacket): integer; (* CAT#2 *) - cdecl; external av__format; -(*** Return the next frame of a stream. +(** + * Read a transport packet from a media file. + * + * This function is obsolete and should never be used. + * Use av_read_frame() instead. + * + * @param s media file handle + * @param pkt is filled + * @return 0 if OK. AVERROR_xxx if error. + *) +function av_read_packet (s: PAVFormatContext; var pkt: TAVPacket): integer; + cdecl; external av__format; + +(** + * Return the next frame of a stream. * * The returned packet is valid * until the next av_read_frame() or until av_close_input_file() and @@ -548,132 +841,371 @@ const * then it contains one frame. * * pkt->pts, pkt->dts and pkt->duration are always set to correct - * values in AV_TIME_BASE unit (and guessed if the format cannot + * values in AVStream.timebase units (and guessed if the format cannot * provided them). pkt->pts can be AV_NOPTS_VALUE if the video format * has B frames, so it is better to rely on pkt->dts if you do not * decompress the payload. * - * @return 0 if OK, < 0 if error or end of file. *) + * @return 0 if OK, < 0 if error or end of file. + *) +function av_read_frame (s: PAVFormatContext; var pkt: TAVPacket): integer; (* CAT#2 *) + cdecl; external av__format; - function av_read_frame (s: PAVFormatContext; var pkt: TAVPacket): integer; (* CAT#2 *) - cdecl; external av__format; - function av_seek_frame (s: PAVFormatContext; stream_index: integer; timestamp: int64; flags: integer): integer; - cdecl; external av__format; - function av_read_play (s: PAVFormatContext): integer; - cdecl; external av__format; - function av_read_pause (s: PAVFormatContext): integer; - cdecl; external av__format; - procedure av_close_input_file (s: PAVFormatContext); - cdecl; external av__format; - function av_new_stream (s: PAVFormatContext; id: integer): PAVStream; - cdecl; external av__format; - procedure av_set_pts_info (s: PAVStream; pts_wrap_bits: integer; - pts_num: integer; pts_den: integer); - cdecl; external av__format; +(** + * Seek to the key frame at timestamp. + * 'timestamp' in 'stream_index'. + * @param stream_index If stream_index is (-1), a default + * stream is selected, and timestamp is automatically converted + * from AV_TIME_BASE units to the stream specific time_base. + * @param timestamp timestamp in AVStream.time_base units + * or if there is no stream specified then in AV_TIME_BASE units + * @param flags flags which select direction and seeking mode + * @return >= 0 on success + *) +function av_seek_frame (s: PAVFormatContext; stream_index: integer; timestamp: int64; flags: integer): integer; + cdecl; external av__format; + +(** + * start playing a network based stream (e.g. RTSP stream) at the + * current position + *) +function av_read_play (s: PAVFormatContext): integer; + cdecl; external av__format; + +(** + * Pause a network based stream (e.g. RTSP stream). + * + * Use av_read_play() to resume it. + *) +function av_read_pause (s: PAVFormatContext): integer; + cdecl; external av__format; + +{$IF LIBAVFORMAT_VERSION >= 52003000} // 52.3.0 +(** + * Free a AVFormatContext allocated by av_open_input_stream. + * @param s context to free + *) +procedure av_close_input_stream(AVFormatContext *s); + cdecl; external av__format; +{$IFEND} + +(** + * Close a media file (but not its codecs). + * + * @param s media file handle + *) +procedure av_close_input_file (s: PAVFormatContext); + cdecl; external av__format; + +(** + * Add a new stream to a media file. + * + * Can only be called in the read_header() function. If the flag + * AVFMTCTX_NOHEADER is in the format context, then new streams + * can be added in read_packet too. + * + * @param s media file handle + * @param id file format dependent stream id + *) +function av_new_stream (s: PAVFormatContext; id: integer): PAVStream; + cdecl; external av__format; +{$IF LIBAVFORMAT_VERSION >= 51014000} // 51.14.0 +function av_new_program(s: PAVFormatContext; id: integer): PAVProgram; + cdecl; external av__format; +{$IFEND} + +(** + * Set the pts for a given stream. + * + * @param s stream + * @param pts_wrap_bits number of bits effectively used by the pts + * (used for wrap control, 33 is the value for MPEG) + * @param pts_num numerator to convert to seconds (MPEG: 1) + * @param pts_den denominator to convert to seconds (MPEG: 90000) + *) +procedure av_set_pts_info (s: PAVStream; pts_wrap_bits: integer; + pts_num: integer; pts_den: integer); + cdecl; external av__format; const - AVSEEK_FLAG_BACKWARD =1; ///< seek backward - AVSEEK_FLAG_BYTE =2; ///< seeking based on position in bytes - AVSEEK_FLAG_ANY =4; ///< seek to any frame, even non keyframes + AVSEEK_FLAG_BACKWARD = 1; ///< seek backward + AVSEEK_FLAG_BYTE = 2; ///< seeking based on position in bytes + AVSEEK_FLAG_ANY = 4; ///< seek to any frame, even non keyframes - function av_find_default_stream_index (s: PAVFormatContext): integer; - cdecl; external av__format; - function av_index_search_timestamp (st: PAVStream; timestamp: int64; flags: integer): integer; - cdecl; external av__format; - function av_add_index_entry (st: PAVStream; pos: int64; timestamp: int64; - distance: integer; flags: integer): integer; - cdecl; external av__format; - function av_seek_frame_binary (s: PAVFormatContext; stream_index: integer; - target_ts: int64; flags: integer): integer; - cdecl; external av__format; +function av_find_default_stream_index (s: PAVFormatContext): integer; + cdecl; external av__format; - procedure av_update_cur_dts (s: PAVFormatContext; ref_st: PAVStream; - timestamp: int64); - cdecl; external av__format; +(** + * Gets the index for a specific timestamp. + * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond to + * the timestamp which is <= the requested one, if backward is 0 + * then it will be >= + * if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise + * @return < 0 if no such timestamp could be found + *) +function av_index_search_timestamp (st: PAVStream; timestamp: int64; flags: integer): integer; + cdecl; external av__format; -(* media file output *) - function av_set_parameters (s: PAVFormatContext; ap: PAVFormatParameters): integer; - cdecl; external av__format; +{$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0 +(** + * Ensures the index uses less memory than the maximum specified in + * AVFormatContext.max_index_size, by discarding entries if it grows + * too large. + * This function is not part of the public API and should only be called + * by demuxers. + *) +procedure ff_reduce_index(s: PAVFormatContext; stream_index: integer); + cdecl; external av__format; +{$IFEND} - function av_write_header (s: PAVFormatContext): integer; - cdecl; external av__format; +(** + * Add a index entry into a sorted list updateing if it is already there. + * + * @param timestamp timestamp in the timebase of the given stream + *) +function av_add_index_entry (st: PAVStream; pos: int64; timestamp: int64; + distance: integer; flags: integer): integer; + cdecl; external av__format; - function av_write_frame(s: PAVFormatContext; var pkt: TAVPacket): integer; - cdecl; external av__format; (* CAT#2 *) +(** + * Does a binary search using av_index_search_timestamp() and AVCodec.read_timestamp(). + * This is not supposed to be called directly by a user application, but by demuxers. + * @param target_ts target timestamp in the time base of the given stream + * @param stream_index stream number + *) +function av_seek_frame_binary (s: PAVFormatContext; stream_index: integer; + target_ts: int64; flags: integer): integer; + cdecl; external av__format; - function av_interleaved_write_frame (s: PAVFormatContext; var pkt: TAVPacket): integer; - cdecl; external av__format; (* CAT#2 *) - function av_interleave_packet_per_dts(s: PAVFormatContext; _out: PAVPacket; - pkt: PAVPacket; flush: integer): integer; - cdecl; external av__format; - function av_write_trailer(s: pAVFormatContext): integer; - cdecl; external av__format; +(** + * Updates cur_dts of all streams based on given timestamp and AVStream. + * + * Stream ref_st unchanged, others set cur_dts in their native timebase + * only needed for timestamp wrapping or if (dts not set and pts!=dts). + * @param timestamp new dts expressed in time_base of param ref_st + * @param ref_st reference stream giving time_base of param timestamp + *) +procedure av_update_cur_dts (s: PAVFormatContext; ref_st: PAVStream; + timestamp: int64); + cdecl; external av__format; - procedure dump_format(ic: PAVFormatContext; index: integer; url: pchar; - is_output: integer); - cdecl; external av__format; +{$IF LIBAVFORMAT_VERSION >= 51007000} // 51.7.0 +type + TReadTimestampFunc = function (pavfc: PAVFormatContext; + arg2: integer; arg3: Pint64; arg4: int64): int64; cdecl; + +(** + * Does a binary search using read_timestamp(). + * This is not supposed to be called directly by a user application, but by demuxers. + * @param target_ts target timestamp in the time base of the given stream + * @param stream_index stream number + *) +function av_gen_search(s: PAVFormatContext; stream_index: integer; target_ts: int64; + pos_min: int64; pos_max: int64; pos_limit: int64; ts_min: int64; ts_max: int64; + flags: integer; ts_ret: Pint64; read_timestamp: TReadTimestampFunc): int64; + cdecl; external av__format; +{$IFEND} - function parse_image_size(width_ptr: PInteger; height_ptr: PInteger; str: pchar): integer; - cdecl; external av__format; - function parse_frame_rate (frame_rate: PInteger; frame_rate_base: PInteger; arg: pchar): integer; - cdecl; external av__format; - function parse_date(datestr: pchar; duration: integer): int64; - cdecl; external av__format; - function av_gettime (): int64; - cdecl; external av__format; +(* media file output *) +function av_set_parameters (s: PAVFormatContext; ap: PAVFormatParameters): integer; + cdecl; external av__format; -(* ffm specific for ffserver *) -const - FFM_PACKET_SIZE = 4096; +(** + * Allocate the stream private data and write the stream header to an + * output media file. + * + * @param s media file handle + * @return 0 if OK. AVERROR_xxx if error. + *) +function av_write_header (s: PAVFormatContext): integer; + cdecl; external av__format; - function ffm_read_write_index (fd: integer): int64; - cdecl; external av__format; +(** + * Write a packet to an output media file. + * + * The packet shall contain one audio or video frame. + * The packet must be correctly interleaved according to the container specification, + * if not then av_interleaved_write_frame must be used + * + * @param s media file handle + * @param pkt the packet, which contains the stream_index, buf/buf_size, dts/pts, ... + * @return < 0 if error, = 0 if OK, 1 if end of stream wanted. + *) +function av_write_frame(s: PAVFormatContext; var pkt: TAVPacket): integer; + cdecl; external av__format; (* CAT#2 *) + +(** + * Writes a packet to an output media file ensuring correct interleaving. + * + * The packet must contain one audio or video frame. + * If the packets are already correctly interleaved the application should + * call av_write_frame() instead as it is slightly faster. It is also important + * to keep in mind that completely non-interleaved input will need huge amounts + * of memory to interleave with this, so it is preferable to interleave at the + * demuxer level. + * + * @param s media file handle + * @param pkt the packet, which contains the stream_index, buf/buf_size, dts/pts, ... + * @return < 0 if error, = 0 if OK, 1 if end of stream wanted. + *) +function av_interleaved_write_frame (s: PAVFormatContext; var pkt: TAVPacket): integer; + cdecl; external av__format; (* CAT#2 *) + +(** + * Interleave a packet per DTS in an output media file. + * + * Packets with pkt->destruct == av_destruct_packet will be freed inside this function, + * so they cannot be used after it, note calling av_free_packet() on them is still safe. + * + * @param s media file handle + * @param out the interleaved packet will be output here + * @param in the input packet + * @param flush 1 if no further packets are available as input and all + * remaining packets should be output + * @return 1 if a packet was output, 0 if no packet could be output, + * < 0 if an error occured + *) +function av_interleave_packet_per_dts(s: PAVFormatContext; _out: PAVPacket; + pkt: PAVPacket; flush: integer): integer; + cdecl; external av__format; - procedure ffm_write_write_index(fd: integer; pos: int64); - cdecl; external av__format; +(** + * @brief Write the stream trailer to an output media file and + * free the file private data. + * + * @param s media file handle + * @return 0 if OK. AVERROR_xxx if error. + *) +function av_write_trailer(s: pAVFormatContext): integer; + cdecl; external av__format; - procedure ffm_set_write_index (s: PAVFormatContext; pos: int64; file_size: int64); - cdecl; external av__format; +procedure dump_format(ic: PAVFormatContext; index: integer; url: pchar; + is_output: integer); + cdecl; external av__format; - function find_info_tag (arg: pchar; arg_size: integer; tag1: pchar; info: pchar): integer; - cdecl; external av__format; +(** + * parses width and height out of string str. + * @deprecated Use av_parse_video_frame_size instead. + *) +function parse_image_size(width_ptr: PInteger; height_ptr: PInteger; str: pchar): integer; + cdecl; external av__format; deprecated; + +(** + * Converts frame rate from string to a fraction. + * @deprecated Use av_parse_video_frame_rate instead. + *) +function parse_frame_rate (frame_rate: PInteger; frame_rate_base: PInteger; arg: pchar): integer; + cdecl; external av__format; deprecated; + +(** + * Parses \p datestr and returns a corresponding number of microseconds. + * @param datestr String representing a date or a duration. + * - If a date the syntax is: + * @code + * [{YYYY-MM-DD|YYYYMMDD}]{T| }{HH[:MM[:SS[.m...]]][Z]|HH[MM[SS[.m...]]][Z]} + * @endcode + * Time is localtime unless Z is appended, in which case it is + * interpreted as UTC. + * If the year-month-day part isn't specified it takes the current + * year-month-day. + * Returns the number of microseconds since 1st of January, 1970 up to + * the time of the parsed date or INT64_MIN if \p datestr cannot be + * successfully parsed. + * - If a duration the syntax is: + * @code + * [-]HH[:MM[:SS[.m...]]] + * [-]S+[.m...] + * @endcode + * Returns the number of microseconds contained in a time interval + * with the specified duration or INT64_MIN if \p datestr cannot be + * successfully parsed. + * @param duration Flag which tells how to interpret \p datestr, if + * not zero \p datestr is interpreted as a duration, otherwise as a + * date. + *) +function parse_date(datestr: pchar; duration: integer): int64; + cdecl; external av__format; - function get_frame_filename(buf: pchar; buf_size: integer; - path: pchar; number: integer): integer; - cdecl; external av__format; - function filename_number_test (filename: pchar): integer; - cdecl; external av__format; +function av_gettime (): int64; + cdecl; external av__format; +(* ffm specific for ffserver *) +const + FFM_PACKET_SIZE = 4096; -(* grab specific *) - function video_grab_init (): integer; - cdecl; external av__format; - function audio_init (): integer; - cdecl; external av__format; +function ffm_read_write_index (fd: integer): int64; + cdecl; external av__format; -(* DV1394 *) - function dv1394_init (): integer; - cdecl; external av__format; - function dc1394_init (): integer; - cdecl; external av__format; +procedure ffm_write_write_index(fd: integer; pos: int64); + cdecl; external av__format; - function strstart(str: pchar; val: pchar; ptr: PPointer): integer; - cdecl; external av__format; - function stristart(str: pchar; val: pchar; ptr: PPointer): integer; - cdecl; external av__format; - procedure pstrcpy(buf: pchar; buf_size: integer; str: pchar); - cdecl; external av__format; - function pstrcat(buf: pchar; buf_size: integer; s: pchar): pchar; - cdecl; external av__format; +procedure ffm_set_write_index (s: PAVFormatContext; pos: int64; file_size: int64); + cdecl; external av__format; - procedure __dynarray_add (tab_ptr: PPointer; nb_ptr: PInteger; elem: cardinal); - cdecl; external av__format; +(** + * Attempts to find a specific tag in a URL. + * + * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. + * Return 1 if found. + *) +function find_info_tag (arg: pchar; arg_size: integer; tag1: pchar; info: pchar): integer; + cdecl; external av__format; + +(** + * Returns in 'buf' the path with '%d' replaced by number. + * Also handles the '%0nd' format where 'n' is the total number + * of digits and '%%'. + * + * @param buf destination buffer + * @param buf_size destination buffer size + * @param path numbered sequence string + * @param number frame number + * @return 0 if OK, -1 if format error. + *) +function av_get_frame_filename(buf: pchar; buf_size: integer; + path: pchar; number: integer): integer; + cdecl; external av__format + {$IF LIBAVFORMAT_VERSION <= 50006000} // 50.6.0 + name 'get_frame_filename' + {$IFEND}; + +(** + * Check whether filename actually is a numbered sequence generator. + * + * @param filename possible numbered sequence string + * @return 1 if a valid numbered sequence string, 0 otherwise. + *) +function av_filename_number_test(filename: pchar): integer; + cdecl; external av__format + {$IF LIBAVFORMAT_VERSION <= 50006000} // 50.6.0 + name 'filename_number_test' + {$IFEND}; + +{$IF LIBAVFORMAT_VERSION >= 51012002} // 51.12.2 +(** + * Generate an SDP for an RTP session. + * + * @param ac array of AVFormatContexts describing the RTP streams. If the + * array is composed by only one context, such context can contain + * multiple AVStreams (one AVStream per RTP stream). Otherwise, + * all the contexts in the array (an AVCodecContext per RTP stream) + * must contain only one AVStream + * @param n_files number of AVCodecContexts contained in ac + * @param buff buffer where the SDP will be stored (must be allocated by + * the caller + * @param size the size of the buffer + * @return 0 if OK. AVERROR_xxx if error. + *) +function avf_sdp_create(ac: PPAVFormatContext; n_files: integer; buff: PChar; size: integer): integer; + cdecl; external av__format; +{$IFEND} implementation -procedure av_init_packet (var pkt: TAVPacket); (* CAT#2 + bug fix *) +{$IF LIBAVFORMAT_VERSION < 51012002} // 51.12.2 +procedure av_init_packet (var pkt: TAVPacket); begin with pkt do begin pts := AV_NOPTS_VALUE; @@ -685,12 +1217,12 @@ begin destruct := @av_destruct_packet_nofree end end; +{$IFEND} -procedure av_free_packet (var pkt: TAVPacket); (* CAT#2 *) +procedure av_free_packet (pkt: PAVPacket); begin - if @pkt.destruct <> nil then pkt.destruct (@pkt) -{ if (pkt <> nil) and (@pkt^.destruct <> nil) then - pkt^.destruct (pkt)} + if ((pkt <> nil) and (@pkt^.destruct <> nil)) then + pkt^.destruct(pkt); end; end. diff --git a/Game/Code/lib/ffmpeg/avio.pas b/Game/Code/lib/ffmpeg/avio.pas index fa65b6fa..d316d2b2 100644 --- a/Game/Code/lib/ffmpeg/avio.pas +++ b/Game/Code/lib/ffmpeg/avio.pas @@ -1,58 +1,85 @@ - (* +(* * unbuffered io for ffmpeg system * copyright (c) 2001 Fabrice Bellard * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) + *) (* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT in the source codes *) +// Revision: 11295 + unit avio; + {$IFDEF FPC} - {$MODE DELPHI } (* CAT *) - {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) - {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) + {$MODE DELPHI } + {$PACKENUM 4} (* use 4-byte enums *) + {$PACKRECORDS C} (* C/C++-compatible record packing *) +{$ELSE} + {$MINENUMSIZE 4} (* use 4-byte enums *) {$ENDIF} -interface (* Widows unit is deleted by CAT *) +interface + +uses + UConfig; -{$I version.inc} +(* output byte stream handling *) + +type + TOffset = int64; + +(* unbuffered I/O *) const URL_RDONLY = 0; URL_WRONLY = 1; URL_RDWR = 2; -(* output byte stream handling *) + (** + * Passing this as the "whence" parameter to a seek function causes it to + * return the filesize without seeking anywhere. Supporting this is optional. + * If it is not supported then the seek function will return <0. + *) + AVSEEK_SIZE = $10000; type - offset_t = int64; - int = integer; + TURLInterruptCB = function (): integer; cdecl; -(* unbuffered I/O *) +type PURLProtocol = ^TURLProtocol; + + (** + * URL Context. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(URLContext) must not be used outside libav*. + *) PURLContext = ^TURLContext; TURLContext = record prot: PURLProtocol; - flags: int; - is_streamed: int; //* true if streamed (no seek possible), default = false */ - max_packet_size: int; //* if non zero, the stream is packetized with this max packet size */ + flags: integer; + is_streamed: integer; (**< true if streamed (no seek possible), default = false *) + max_packet_size: integer; (**< if non zero, the stream is packetized with this max packet size *) priv_data: pointer; - filename: array [0..0] of char; (* specified filename *) + filename: PChar; (**< specified filename *) end; PURLPollEntry = ^TURLPollEntry; @@ -64,14 +91,32 @@ type TURLProtocol = record name: pchar; - url_open: function (h: PURLContext; const filename: pchar; flags: integer): integer; cdecl; + url_open: function (h: PURLContext; {const} filename: pchar; flags: integer): integer; cdecl; url_read: function (h: PURLContext; buf: pchar; size: integer): integer; cdecl; url_write: function (h: PURLContext; buf: pchar; size: integer): integer; cdecl; - url_seek: function (h: PURLContext; pos: int64; whence: integer): int64; cdecl; + url_seek: function (h: PURLContext; pos: TOffset; whence: integer): TOffset; cdecl; url_close: function (h: PURLContext): integer; cdecl; next: PURLProtocol; + {$IF (LIBAVFORMAT_VERSION >= 52001000) and (LIBAVFORMAT_VERSION < 52004000)} // 52.1.0 .. 52.4.0 + url_read_play: function (h: PURLContext): integer; + url_read_pause: function (h: PURLContext): integer; + {$IFEND} + {$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0 + url_read_pause: function (h: PURLContext; pause: integer): integer; cdecl; + {$IFEND} + {$IF LIBAVFORMAT_VERSION >= 52001000} // 52.1.0 + url_read_seek: function (h: PURLContext; + stream_index: integer; timestamp: int64; flags: integer): TOffset; cdecl; + {$IFEND} end; + (** + * Bytestream IO Context. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(ByteIOContext) must not be used outside libav*. + *) PByteIOContext = ^TByteIOContext; TByteIOContext = record buffer: pchar; @@ -81,8 +126,8 @@ type opaque: pointer; read_packet: function (opaque: pointer; buf: pchar; buf_size: integer): integer; cdecl; write_packet: function (opaque: pointer; buf: pchar; buf_size: integer): integer; cdecl; - seek: function (opaque: pointer; offset: int64; whence: integer): int64; cdecl; - pos: int64; (* position in the file of the current buffer *) + seek: function (opaque: pointer; offset: TOffset; whence: integer): TOffset; cdecl; + pos: TOffset; (* position in the file of the current buffer *) must_flush: integer; (* true if the next seek should flush *) eof_reached: integer; (* true if eof reached *) write_flag: integer; (* true if open for writing *) @@ -90,153 +135,347 @@ type max_packet_size: integer; checksum: longword; checksum_ptr: pchar; - update_checksum: function (checksum: cardinal; const buf: pchar; size: cardinal): LongWord; cdecl; + update_checksum: function (checksum: Longword; {const} buf: pchar; size: cardinal): Longword; cdecl; error: integer; ///< contains the error code or 0 if no error happened + {$IF (LIBAVFORMAT_VERSION >= 52001000) and (LIBAVFORMAT_VERSION < 52004000)} // 52.1.0 .. 52.4.0 + read_play: function(opaque: Pointer): integer; cdecl; + read_pause: function(opaque: Pointer): integer; cdecl; + {$IFEND} + {$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0 + read_pause: function(opaque: Pointer; pause: integer): integer; cdecl; + {$IFEND} + {$IF LIBAVFORMAT_VERSION >= 52001000} // 52.1.0 + read_seek: function(opaque: Pointer; + stream_index: integer; timestamp: int64; flags: integer): TOffset; cdecl; + {$IFEND} end; - function url_open(h: PPointer; const filename: pchar; flags: integer): integer; - cdecl; external av__format; - function url_read (h: PURLContext; buf: pchar; size: integer): integer; - cdecl; external av__format; - function url_write (h: PURLContext; buf: pchar; size: integer): integer; - cdecl; external av__format; - function url_seek (h: PURLContext; pos: int64; whence: integer): int64; - cdecl; external av__format; - function url_close (h: PURLContext): integer; - cdecl; external av__format; - function url_exist(const filename: pchar): integer; - cdecl; external av__format; - function url_filesize (h: PURLContext): int64; - cdecl; external av__format; - function url_get_max_packet_size(h: PURLContext): integer; - cdecl; external av__format; - procedure url_get_filename(h: PURLContext; buf: pchar; buf_size: integer); - cdecl; external av__format; - -(* the callback is called in blocking functions to test regulary if - asynchronous interruption is needed. -EINTR is returned in this - case by the interrupted function. 'NULL' means no interrupt - callback is given. *) - procedure url_set_interrupt_cb (interrupt_cb: pinteger); - cdecl; external av__format; +function url_open(h: PPointer; {const} filename: pchar; flags: integer): integer; + cdecl; external av__format; +function url_read (h: PURLContext; buf: pchar; size: integer): integer; + cdecl; external av__format; +function url_write (h: PURLContext; buf: pchar; size: integer): integer; + cdecl; external av__format; +function url_seek (h: PURLContext; pos: TOffset; whence: integer): TOffset; + cdecl; external av__format; +function url_close (h: PURLContext): integer; + cdecl; external av__format; +function url_exist(const filename: pchar): integer; + cdecl; external av__format; +function url_filesize (h: PURLContext): TOffset; + cdecl; external av__format; + +(** + * Return the maximum packet size associated to packetized file + * handle. If the file is not packetized (stream like HTTP or file on + * disk), then 0 is returned. + * + * @param h file handle + * @return maximum packet size in bytes + *) +function url_get_max_packet_size(h: PURLContext): integer; + cdecl; external av__format; +procedure url_get_filename(h: PURLContext; buf: pchar; buf_size: integer); + cdecl; external av__format; + +(** + * The callback is called in blocking functions to test regulary if + * asynchronous interruption is needed. AVERROR(EINTR) is returned + * in this case by the interrupted function. 'NULL' means no interrupt + * callback is given. + *) +procedure url_set_interrupt_cb (interrupt_cb: TURLInterruptCB); + cdecl; external av__format; (* not implemented *) -//int url_poll(URLPollEntry *poll_table, int n, int timeout); - - function register_protocol (protocol: PURLProtocol): integer; - cdecl; external av__format; - - function init_put_byte(s: PByteIOContext; - buffer: pchar; - buffer_size: integer; write_flag: integer; - opaque: pointer; - read_packet: pointer; //int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), - write_packet: pointer; //int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), - seek: pointer //offset_t (*seek)(void *opaque, offset_t offset, int whence) - ): integer; - cdecl; external av__format; - procedure put_byte(s: PByteIOContext; b: integer); - cdecl; external av__format; - procedure put_buffer (s: PByteIOContext; const buf: pchar; size: integer); - cdecl; external av__format; - procedure put_le64(s: PByteIOContext; val: int64); - cdecl; external av__format; - procedure put_be64(s: PByteIOContext; val: int64); - cdecl; external av__format; - procedure put_le32(s: PByteIOContext; val: cardinal); - cdecl; external av__format; - procedure put_be32(s: PByteIOContext; val: cardinal); - cdecl; external av__format; - procedure put_be24(s: PByteIOContext; val: cardinal); - cdecl; external av__format; - procedure put_le16(s: PByteIOContext; val: cardinal); - cdecl; external av__format; - procedure put_be16(s: PByteIOContext; val: cardinal); - cdecl; external av__format; - procedure put_tag(s: PByteIOContext; const tag: pchar); - cdecl; external av__format; - - procedure put_strz(s: PByteIOContext; const buf: pchar); - cdecl; external av__format; - - function url_fseek(s: PByteIOContext; offset: int64; whence: integer): int64; - cdecl; external av__format; - procedure url_fskip(s: PByteIOContext; offset: int64); - cdecl; external av__format; - function url_ftell(s: PByteIOContext): int64; - cdecl; external av__format; - function url_fsize(s: PByteIOContext): int64; - cdecl; external av__format; - function url_feof(s: PByteIOContext): integer; - cdecl; external av__format; - function url_ferror(s: PByteIOContext): integer; - cdecl; external av__format; - - procedure put_flush_packet (s: PByteIOContext); - cdecl; external av__format; - function get_buffer(s: PByteIOContext; buf: pchar; size: integer): integer; - cdecl; external av__format; - function get_partial_buffer(s: PByteIOContext; buf: pchar; size: integer): integer; - cdecl; external av__format; - function get_byte(s: PByteIOContext): integer; - cdecl; external av__format; - function get_le32(s: PByteIOContext): cardinal; - cdecl; external av__format; - function get_le64(s: PByteIOContext): int64; - cdecl; external av__format; - function get_le16(s: PByteIOContext): cardinal; - cdecl; external av__format; - - function get_strz(s: PByteIOContext; buf: pchar; maxlen: integer): pchar; - cdecl; external av__format; - function get_be16(s: PByteIOContext): cardinal; - cdecl; external av__format; - function get_be24(s: PByteIOContext): cardinal; - cdecl; external av__format; - function get_be32(s: PByteIOContext): cardinal; - cdecl; external av__format; - function get_be64(s: PByteIOContext): int64; - cdecl; external av__format; - - function url_is_streamed(s: PByteIOContext): integer; - - function url_fdopen (s: PByteIOContext; h: PURLContext): integer; - cdecl; external av__format; - function url_setbufsize (s: PByteIOContext; buf_size: integer): integer; - cdecl; external av__format; - function url_fopen(s: PByteIOContext; const filename: pchar; flags: integer): integer; - cdecl; external av__format; - function url_fclose(s: PByteIOContext): integer; - cdecl; external av__format; - - function url_fileno(s: PByteIOContext): PURLContext; - cdecl; external av__format; - function url_fget_max_packet_size (s: PByteIOContext): integer; - cdecl; external av__format; - function url_open_buf(s: PByteIOContext; buf: pchar; buf_size: integer; flags: integer): integer; - cdecl; external av__format; - function url_close_buf(s: PByteIOContext): integer; - cdecl; external av__format; - - function url_open_dyn_buf(s: PByteIOContext): integer; - cdecl; external av__format; - function url_open_dyn_packet_buf(s: PByteIOContext; max_packet_size: integer): integer; - cdecl; external av__format; - function url_close_dyn_buf(s: PByteIOContext; pbuffer:PPointer): integer; - cdecl; external av__format; - - function get_checksum(s: PByteIOContext): cardinal; - cdecl; external av__format; - - procedure init_checksum (s: PByteIOContext; update_checksum: pointer; checksum: cardinal); - cdecl; external av__format; - - function udp_set_remote_url(h: PURLContext; const uri: pchar): integer; - cdecl; external av__format; - function udp_get_local_port(h: PURLContext): integer; - cdecl; external av__format; - function udp_get_file_handle(h: PURLContext): integer; - cdecl; external av__format; +function url_poll(poll_table: PURLPollEntry; n: integer; timeout: integer): integer; + cdecl; external av__format; + +{$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0 +(** + * Pause and resume playing - only meaningful if using a network streaming + * protocol (e.g. MMS). + * @param pause 1 for pause, 0 for resume + *) +function av_url_read_pause(h: PURLContext; pause: integer): integer; +{$IFEND} + +{$IF LIBAVFORMAT_VERSION >= 52001000} // 52.1.0 +(** + * Seek to a given timestamp relative to some component stream. + * Only meaningful if using a network streaming protocol (e.g. MMS.). + * @param stream_index The stream index that the timestamp is relative to. + * If stream_index is (-1) the timestamp should be in AV_TIME_BASE + * units from the beginning of the presentation. + * If a stream_index >= 0 is used and the protocol does not support + * seeking based on component streams, the call will fail with ENOTSUP. + * @param timestamp timestamp in AVStream.time_base units + * or if there is no stream specified then in AV_TIME_BASE units. + * @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE + * and AVSEEK_FLAG_ANY. The protocol may silently ignore + * AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will + * fail with ENOTSUP if used and not supported. + * @return >= 0 on success + * @see AVInputFormat::read_seek + *) +function av_url_read_seek(h: PURLContext; + stream_index: integer; timestamp: int64; flags: integer): TOffset; + cdecl; external av__format; +{$IFEND} + +{ +var + first_protocol: PURLProtocol; external av__format; + url_interrupt_cb: PURLInterruptCB; external av__format; +} + +{$IF LIBAVFORMAT_VERSION >= 52002000} // 52.2.0 +function av_protocol_next(p: PURLProtocol): PURLProtocol; + cdecl; external av__format; +{$IFEND} + +function register_protocol (protocol: PURLProtocol): integer; + cdecl; external av__format; + +type + TReadWriteFunc = function (opaque: Pointer; buf: PChar; buf_size: integer): integer; cdecl; + TSeekFunc = function (opaque: Pointer; offset: TOffset; whence: integer): TOffset; cdecl; + +function init_put_byte(s: PByteIOContext; + buffer: pchar; + buffer_size: integer; write_flag: integer; + opaque: pointer; + read_packet: TReadWriteFunc; + write_packet: TReadWriteFunc; + seek: TSeekFunc): integer; + cdecl; external av__format; +{$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0 +function av_alloc_put_byte( + buffer: PChar; + buffer_size: integer; + write_flag: integer; + opaque: Pointer; + read_packet: TReadWriteFunc, + write_packet: TReadWriteFunc, + seek: TSeekFunc): PByteIOContext; + cdecl; external av__format; +{$IFEND} + +procedure put_byte(s: PByteIOContext; b: integer); + cdecl; external av__format; +procedure put_buffer (s: PByteIOContext; {const} buf: pchar; size: integer); + cdecl; external av__format; +procedure put_le64(s: PByteIOContext; val: int64); + cdecl; external av__format; +procedure put_be64(s: PByteIOContext; val: int64); + cdecl; external av__format; +procedure put_le32(s: PByteIOContext; val: cardinal); + cdecl; external av__format; +procedure put_be32(s: PByteIOContext; val: cardinal); + cdecl; external av__format; +procedure put_le24(s: PByteIOContext; val: cardinal); + cdecl; external av__format; +procedure put_be24(s: PByteIOContext; val: cardinal); + cdecl; external av__format; +procedure put_le16(s: PByteIOContext; val: cardinal); + cdecl; external av__format; +procedure put_be16(s: PByteIOContext; val: cardinal); + cdecl; external av__format; +procedure put_tag(s: PByteIOContext; {const} tag: pchar); + cdecl; external av__format; + +procedure put_strz(s: PByteIOContext; {const} buf: pchar); + cdecl; external av__format; + +function url_fseek(s: PByteIOContext; offset: TOffset; whence: integer): TOffset; + cdecl; external av__format; +procedure url_fskip(s: PByteIOContext; offset: TOffset); + cdecl; external av__format; +function url_ftell(s: PByteIOContext): TOffset; + cdecl; external av__format; +function url_fsize(s: PByteIOContext): TOffset; + cdecl; external av__format; +function url_feof(s: PByteIOContext): integer; + cdecl; external av__format; +function url_ferror(s: PByteIOContext): integer; + cdecl; external av__format; + +{$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0 +function av_url_read_fpause(h: PByteIOContext; pause: integer): integer; + cdecl; external av__format; +{$IFEND} +{$IF LIBAVFORMAT_VERSION >= 52001000} // 52.1.0 +function av_url_read_fseek(h: PByteIOContext; + stream_index: integer; timestamp: int64; flags: integer): TOffset; + cdecl; external av__format; +{$IFEND} + +const + URL_EOF = -1; +(** @note return URL_EOF (-1) if EOF *) +function url_fgetc(s: PByteIOContext): integer; + cdecl; external av__format; + +(** @warning currently size is limited *) +function url_fprintf(s: PByteIOContext; {const} fmt: PChar; args: array of const): integer; + cdecl; external av__format; + +(** @note unlike fgets, the EOL character is not returned and a whole + line is parsed. return NULL if first char read was EOF *) +function url_fgets(s: PByteIOContext; buf: PChar; buf_size: integer): PChar; + cdecl; external av__format; + +procedure put_flush_packet (s: PByteIOContext); + cdecl; external av__format; + +function get_buffer(s: PByteIOContext; buf: pchar; size: integer): integer; + cdecl; external av__format; +function get_partial_buffer(s: PByteIOContext; buf: pchar; size: integer): integer; + cdecl; external av__format; + +(** @note return 0 if EOF, so you cannot use it if EOF handling is + necessary *) +function get_byte(s: PByteIOContext): integer; + cdecl; external av__format; +function get_le24(s: PByteIOContext): cardinal; + cdecl; external av__format; +function get_le32(s: PByteIOContext): cardinal; + cdecl; external av__format; +function get_le64(s: PByteIOContext): uint64; + cdecl; external av__format; +function get_le16(s: PByteIOContext): cardinal; + cdecl; external av__format; + +function get_strz(s: PByteIOContext; buf: pchar; maxlen: integer): pchar; + cdecl; external av__format; +function get_be16(s: PByteIOContext): cardinal; + cdecl; external av__format; +function get_be24(s: PByteIOContext): cardinal; + cdecl; external av__format; +function get_be32(s: PByteIOContext): cardinal; + cdecl; external av__format; +function get_be64(s: PByteIOContext): uint64; + cdecl; external av__format; + +{$IF LIBAVFORMAT_VERSION >= 51017001} // 51.17.1 +function ff_get_v(bc: PByteIOContext): uint64; + cdecl; external av__format; +{$IFEND} + +function url_is_streamed(s: PByteIOContext): integer; inline; + +(** @note when opened as read/write, the buffers are only used for + writing *) +{$IF LIBAVFORMAT_VERSION >= 52000000} // 52.0.0 +function url_fdopen (var s: PByteIOContext; h: PURLContext): integer; +{$ELSE} +function url_fdopen (s: PByteIOContext; h: PURLContext): integer; +{$IFEND} + cdecl; external av__format; + +(** @warning must be called before any I/O *) +function url_setbufsize (s: PByteIOContext; buf_size: integer): integer; + cdecl; external av__format; + +{$IF LIBAVFORMAT_VERSION >= 51015000} // 51.15.0 +(** Reset the buffer for reading or writing. + * @note Will drop any data currently in the buffer without transmitting it. + * @param flags URL_RDONLY to set up the buffer for reading, or URL_WRONLY + * to set up the buffer for writing. *) +function url_resetbuf(s: PByteIOContext; flags: integer): integer; + cdecl; external av__format; +{$IFEND} + +(** @note when opened as read/write, the buffers are only used for + writing *) +{$IF LIBAVFORMAT_VERSION >= 52000000} // 52.0.0 +function url_fopen(var s: PByteIOContext; const filename: pchar; flags: integer): integer; +{$ELSE} +function url_fopen(s: PByteIOContext; const filename: pchar; flags: integer): integer; +{$IFEND} + cdecl; external av__format; +function url_fclose(s: PByteIOContext): integer; + cdecl; external av__format; +function url_fileno(s: PByteIOContext): PURLContext; + cdecl; external av__format; + +(** + * Return the maximum packet size associated to packetized buffered file + * handle. If the file is not packetized (stream like http or file on + * disk), then 0 is returned. + * + * @param s buffered file handle + * @return maximum packet size in bytes + *) +function url_fget_max_packet_size (s: PByteIOContext): integer; + cdecl; external av__format; + +{$IF LIBAVFORMAT_VERSION >= 52000000} // 52.0.0 +function url_open_buf(var s: PByteIOContext; buf: pchar; buf_size: integer; flags: integer): integer; +{$ELSE} +function url_open_buf(s: PByteIOContext; buf: pchar; buf_size: integer; flags: integer): integer; +{$IFEND} + cdecl; external av__format; + +(** return the written or read size *) +function url_close_buf(s: PByteIOContext): integer; + cdecl; external av__format; + +(** + * Open a write only memory stream. + * + * @param s new IO context + * @return zero if no error. + *) +{$IF LIBAVFORMAT_VERSION >= 52000000} // 52.0.0 +function url_open_dyn_buf(var s: PByteIOContext): integer; +{$ELSE} +function url_open_dyn_buf(s: PByteIOContext): integer; +{$IFEND} + cdecl; external av__format; + +(** + * Open a write only packetized memory stream with a maximum packet + * size of 'max_packet_size'. The stream is stored in a memory buffer + * with a big endian 4 byte header giving the packet size in bytes. + * + * @param s new IO context + * @param max_packet_size maximum packet size (must be > 0) + * @return zero if no error. + *) +{$IF LIBAVFORMAT_VERSION >= 52000000} // 52.0.0 +function url_open_dyn_packet_buf(var s: PByteIOContext; max_packet_size: integer): integer; +{$ELSE} +function url_open_dyn_packet_buf(s: PByteIOContext; max_packet_size: integer): integer; +{$IFEND} + cdecl; external av__format; + +(** + * Return the written size and a pointer to the buffer. The buffer + * must be freed with av_free(). + * @param s IO context + * @param pbuffer pointer to a byte buffer + * @return the length of the byte buffer + *) +function url_close_dyn_buf(s: PByteIOContext; pbuffer:PPointer): integer; + cdecl; external av__format; + +{$IF LIBAVFORMAT_VERSION >= 51017001} // 51.17.1 +function ff_crc04C11DB7_update(checksum: longword; {const} buf: PChar; len: cardinal): longword; + cdecl; external av__format; +{$IFEND} +function get_checksum(s: PByteIOContext): cardinal; + cdecl; external av__format; +procedure init_checksum (s: PByteIOContext; update_checksum: pointer; checksum: cardinal); + cdecl; external av__format; + +(* udp.c *) +function udp_set_remote_url(h: PURLContext; {const} uri: pchar): integer; + cdecl; external av__format; +function udp_get_local_port(h: PURLContext): integer; + cdecl; external av__format; +function udp_get_file_handle(h: PURLContext): integer; + cdecl; external av__format; implementation diff --git a/Game/Code/lib/ffmpeg/avutil.pas b/Game/Code/lib/ffmpeg/avutil.pas index 48c5f4c2..d50a7871 100644 --- a/Game/Code/lib/ffmpeg/avutil.pas +++ b/Game/Code/lib/ffmpeg/avutil.pas @@ -1,135 +1,219 @@ - (* - * copyright (c) 2006 Michael Niedermayer - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) -(* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. -For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT -in the source codes *) - -unit avutil; -{$IFDEF FPC} - {$MODE DELPHI} - {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) - {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) -{$ENDIF} - -interface - -{$I version.inc} - -type -(** - * Pixel format. Notes: - * - * PIX_FMT_RGB32 is handled in an endian-specific manner. A RGBA - * color is put together as: - * (A << 24) | (R << 16) | (G << 8) | B - * This is stored as BGRA on little endian CPU architectures and ARGB on - * big endian CPUs. - * - * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized - * image data is stored in AVFrame.data[0]. The palette is transported in - * AVFrame.data[1] and, is 1024 bytes long (256 4-byte entries) and is - * formatted the same as in PIX_FMT_RGB32 described above (i.e., it is - * also endian-specific). Note also that the individual RGB palette - * components stored in AVFrame.data[1] should be in the range 0..255. - * This is important as many custom PAL8 video codecs that were designed - * to run on the IBM VGA graphics adapter use 6-bit palette components. - *) - - PAVPixelFormat = ^TAVPixelFormat; - TAVPixelFormat = ( - PIX_FMT_NONE= -1, - PIX_FMT_YUV420P, ///< Planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) - PIX_FMT_YUYV422, ///< Packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr - PIX_FMT_RGB24, ///< Packed RGB 8:8:8, 24bpp, RGBRGB... - PIX_FMT_BGR24, ///< Packed RGB 8:8:8, 24bpp, BGRBGR... - PIX_FMT_YUV422P, ///< Planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) - PIX_FMT_YUV444P, ///< Planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) - PIX_FMT_RGB32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in cpu endianness - PIX_FMT_YUV410P, ///< Planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) - PIX_FMT_YUV411P, ///< Planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) - PIX_FMT_RGB565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in cpu endianness - PIX_FMT_RGB555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in cpu endianness most significant bit to 1 - PIX_FMT_GRAY8, ///< Y , 8bpp - PIX_FMT_MONOWHITE, ///< Y , 1bpp, 1 is white - PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black - PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette - PIX_FMT_YUVJ420P, ///< Planar YUV 4:2:0, 12bpp, full scale (jpeg) - PIX_FMT_YUVJ422P, ///< Planar YUV 4:2:2, 16bpp, full scale (jpeg) - PIX_FMT_YUVJ444P, ///< Planar YUV 4:4:4, 24bpp, full scale (jpeg) - PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h) - PIX_FMT_XVMC_MPEG2_IDCT, - PIX_FMT_UYVY422, ///< Packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 - PIX_FMT_UYYVYY411, ///< Packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 - PIX_FMT_BGR32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in cpu endianness - PIX_FMT_BGR565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in cpu endianness - PIX_FMT_BGR555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in cpu endianness most significant bit to 1 - PIX_FMT_BGR8, ///< Packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) - PIX_FMT_BGR4, ///< Packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb) - PIX_FMT_BGR4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) - PIX_FMT_RGB8, ///< Packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) - PIX_FMT_RGB4, ///< Packed RGB 1:2:1, 4bpp, (msb)2R 3G 3B(lsb) - PIX_FMT_RGB4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)2R 3G 3B(lsb) - PIX_FMT_NV12, ///< Planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV - PIX_FMT_NV21, ///< as above, but U and V bytes are swapped - - PIX_FMT_RGB32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in cpu endianness - PIX_FMT_BGR32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in cpu endianness - - PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions - PIX_FMT_FACKED = $FFFFF - ); - -const -{$ifdef WORDS_BIGENDIAN} - PIX_FMT_RGBA = PIX_FMT_RGB32_1; - PIX_FMT_BGRA = PIX_FMT_BGR32_1; - PIX_FMT_ARGB = PIX_FMT_RGB32; - PIX_FMT_ABGR = PIX_FMT_BGR32; -{$else} - PIX_FMT_RGBA = PIX_FMT_BGR32; - PIX_FMT_BGRA = PIX_FMT_RGB32; - PIX_FMT_ARGB = PIX_FMT_BGR32_1; - PIX_FMT_ABGR = PIX_FMT_RGB32_1; -{$endif} - - PIX_FMT_UYVY411 = PIX_FMT_UYYVYY411; - PIX_FMT_RGBA32 = PIX_FMT_RGB32; - PIX_FMT_YUV422 = PIX_FMT_YUYV422; - -(* memory *) -function av_malloc (size: cardinal): pointer; - cdecl; external av__util; - -function av_realloc (ptr: pointer; size: cardinal): pointer; - cdecl; external av__util; - -procedure av_free (ptr: pointer); - cdecl; external av__util; - -function av_mallocz (size: cardinal): pointer; - cdecl; external av__util; - -function av_strdup(const s: pchar): pchar; - cdecl; external av__util; - -procedure av_freep (ptr: pointer); - cdecl; external av__util; - -implementation - -end. +(* + * copyright (c) 2006 Michael Niedermayer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +(* This is a part of Pascal porting of ffmpeg. + * Originally by Victor Zinetz for Delphi and Free Pascal on Windows. + * For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT + * in the source codes *) + +// Min. version: ? +// Max. version: 49.6.0, Revision: 11207 + +unit avutil; + +{$IFDEF FPC} + {$MODE DELPHI} + {$PACKENUM 4} (* use 4-byte enums *) + {$PACKRECORDS C} (* C/C++-compatible record packing *) +{$ELSE} + {$MINENUMSIZE 4} (* use 4-byte enums *) +{$ENDIF} + +interface + +uses + mathematics, + rational, + UConfig; + +const + (* Max. supported version by this header *) + LIBAVUTIL_MAX_VERSION_MAJOR = 49; + LIBAVUTIL_MAX_VERSION_MINOR = 6; + LIBAVUTIL_MAX_VERSION_RELEASE = 0; + LIBAVUTIL_MAX_VERSION = (LIBAVUTIL_MAX_VERSION_MAJOR * VERSION_MAJOR) + + (LIBAVUTIL_MAX_VERSION_MINOR * VERSION_MINOR) + + (LIBAVUTIL_MAX_VERSION_RELEASE * VERSION_RELEASE); + +(* Check if linked versions are supported *) +{$IF (LIBAVUTIL_VERSION > LIBAVUTIL_MAX_VERSION)} + {$MESSAGE Warn 'Linked version of libavutil may be unsupported!'} +{$IFEND} + +type +(** + * Pixel format. Notes: + * + * PIX_FMT_RGB32 is handled in an endian-specific manner. A RGBA + * color is put together as: + * (A << 24) | (R << 16) | (G << 8) | B + * This is stored as BGRA on little endian CPU architectures and ARGB on + * big endian CPUs. + * + * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized + * image data is stored in AVFrame.data[0]. The palette is transported in + * AVFrame.data[1] and, is 1024 bytes long (256 4-byte entries) and is + * formatted the same as in PIX_FMT_RGB32 described above (i.e., it is + * also endian-specific). Note also that the individual RGB palette + * components stored in AVFrame.data[1] should be in the range 0..255. + * This is important as many custom PAL8 video codecs that were designed + * to run on the IBM VGA graphics adapter use 6-bit palette components. + *) + + PAVPixelFormat = ^TAVPixelFormat; + TAVPixelFormat = ( + PIX_FMT_NONE= -1, + PIX_FMT_YUV420P, ///< Planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) + PIX_FMT_YUYV422, ///< Packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr + PIX_FMT_RGB24, ///< Packed RGB 8:8:8, 24bpp, RGBRGB... + PIX_FMT_BGR24, ///< Packed RGB 8:8:8, 24bpp, BGRBGR... + PIX_FMT_YUV422P, ///< Planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + PIX_FMT_YUV444P, ///< Planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) + PIX_FMT_RGB32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in cpu endianness + PIX_FMT_YUV410P, ///< Planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) + PIX_FMT_YUV411P, ///< Planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) + PIX_FMT_RGB565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in cpu endianness + PIX_FMT_RGB555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in cpu endianness most significant bit to 1 + PIX_FMT_GRAY8, ///< Y , 8bpp + PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black + PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white + PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette + PIX_FMT_YUVJ420P, ///< Planar YUV 4:2:0, 12bpp, full scale (jpeg) + PIX_FMT_YUVJ422P, ///< Planar YUV 4:2:2, 16bpp, full scale (jpeg) + PIX_FMT_YUVJ444P, ///< Planar YUV 4:4:4, 24bpp, full scale (jpeg) + PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h) + PIX_FMT_XVMC_MPEG2_IDCT, + PIX_FMT_UYVY422, ///< Packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 + PIX_FMT_UYYVYY411, ///< Packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 + PIX_FMT_BGR32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in cpu endianness + PIX_FMT_BGR565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in cpu endianness + PIX_FMT_BGR555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in cpu endianness most significant bit to 1 + PIX_FMT_BGR8, ///< Packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) + PIX_FMT_BGR4, ///< Packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb) + PIX_FMT_BGR4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) + PIX_FMT_RGB8, ///< Packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) + PIX_FMT_RGB4, ///< Packed RGB 1:2:1, 4bpp, (msb)2R 3G 3B(lsb) + PIX_FMT_RGB4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)2R 3G 3B(lsb) + PIX_FMT_NV12, ///< Planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV + PIX_FMT_NV21, ///< as above, but U and V bytes are swapped + + PIX_FMT_RGB32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in cpu endianness + PIX_FMT_BGR32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in cpu endianness + + PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian + PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian + PIX_FMT_YUV440P, ///< Planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) + PIX_FMT_YUVJ440P, ///< Planar YUV 4:4:0 full scale (jpeg) + PIX_FMT_YUVA420P, ///< Planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) + PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions + ); + +const +{$ifdef WORDS_BIGENDIAN} + PIX_FMT_RGBA = PIX_FMT_RGB32_1; + PIX_FMT_BGRA = PIX_FMT_BGR32_1; + PIX_FMT_ARGB = PIX_FMT_RGB32; + PIX_FMT_ABGR = PIX_FMT_BGR32; + PIX_FMT_GRAY16 = PIX_FMT_GRAY16BE; +{$else} + PIX_FMT_RGBA = PIX_FMT_BGR32; + PIX_FMT_BGRA = PIX_FMT_RGB32; + PIX_FMT_ARGB = PIX_FMT_BGR32_1; + PIX_FMT_ABGR = PIX_FMT_RGB32_1; + PIX_FMT_GRAY16 = PIX_FMT_GRAY16LE; +{$endif} + +{$IF LIBAVUTIL_VERSION_MAJOR < 50} // 50.0.0 + PIX_FMT_UYVY411 = PIX_FMT_UYYVYY411; + PIX_FMT_RGBA32 = PIX_FMT_RGB32; + PIX_FMT_YUV422 = PIX_FMT_YUYV422; +{$IFEND} + +(* mem.h *) + +(** + * Allocate a block of \p size bytes with alignment suitable for all + * memory accesses (including vectors if available on the CPU). + * @param size Size in bytes for the memory block to be allocated. + * @return Pointer to the allocated block, NULL if it cannot allocate + * it. + * @see av_mallocz() + *) +function av_malloc (size: cardinal): pointer; + cdecl; external av__util; + +(** + * Allocate or reallocate a block of memory. + * If \p ptr is NULL and \p size > 0, allocate a new block. If \p + * size is zero, free the memory block pointed by \p ptr. + * @param size Size in bytes for the memory block to be allocated or + * reallocated. + * @param ptr Pointer to a memory block already allocated with + * av_malloc(z)() or av_realloc() or NULL. + * @return Pointer to a newly reallocated block or NULL if it cannot + * reallocate or the function is used to free the memory block. + * @see av_fast_realloc() + *) +function av_realloc (ptr: pointer; size: cardinal): pointer; + cdecl; external av__util; + +(** + * Free a memory block which has been allocated with av_malloc(z)() or + * av_realloc(). + * @param ptr Pointer to the memory block which should be freed. + * @note ptr = NULL is explicitly allowed. + * @note It is recommended that you use av_freep() instead. + * @see av_freep() + *) +procedure av_free (ptr: pointer); + cdecl; external av__util; + +(** + * Allocate a block of \p size bytes with alignment suitable for all + * memory accesses (including vectors if available on the CPU) and + * set to zeroes all the bytes of the block. + * @param size Size in bytes for the memory block to be allocated. + * @return Pointer to the allocated block, NULL if it cannot allocate + * it. + * @see av_malloc() + *) +function av_mallocz (size: cardinal): pointer; + cdecl; external av__util; + +(** + * Duplicate the string \p s. + * @param s String to be duplicated. + * @return Pointer to a newly allocated string containing a + * copy of \p s or NULL if it cannot be allocated. + *) +function av_strdup({const} s: pchar): pchar; + cdecl; external av__util; + +(** + * Free a memory block which has been allocated with av_malloc(z)() or + * av_realloc() and set to NULL the pointer to it. + * @param ptr Pointer to the pointer to the memory block which should + * be freed. + * @see av_free() + *) +procedure av_freep (ptr: pointer); + cdecl; external av__util; + +implementation + +end. diff --git a/Game/Code/lib/ffmpeg/lazarustest.lpi b/Game/Code/lib/ffmpeg/lazarustest.lpi deleted file mode 100644 index 6ba93830..00000000 --- a/Game/Code/lib/ffmpeg/lazarustest.lpi +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Game/Code/lib/ffmpeg/lazarustest.lpr b/Game/Code/lib/ffmpeg/lazarustest.lpr deleted file mode 100644 index 10b59b9c..00000000 --- a/Game/Code/lib/ffmpeg/lazarustest.lpr +++ /dev/null @@ -1,30 +0,0 @@ -program lazarustest; - -{$MODE Delphi} - -uses - - avcodec in 'avcodec.pas', - avformat in 'avformat.pas', - avutil in 'avutil.pas', - rational in 'rational.pas', - opt in 'opt.pas', - avio in 'avio.pas', - sysutils; - -begin - // This compiles with all units in.. - // but I cant run it, if its compiled with lazarus or delphi - // I get errors about not finding functions in dll's - - // ON LINUX - Ubuntu .. you will probably need to - // sudo apt-get install libavcodec-dev libavformat-dev - - try - av_register_all(); - writeln( 'YES - If you see this then ffmpeg is probably lazarus compatible' ); - except - writeln( 'NO - ffmpeg is NOT lazarus compatible' ); - end; -end. - diff --git a/Game/Code/lib/ffmpeg/mathematics.pas b/Game/Code/lib/ffmpeg/mathematics.pas index 3beef517..4ecdce8f 100644 --- a/Game/Code/lib/ffmpeg/mathematics.pas +++ b/Game/Code/lib/ffmpeg/mathematics.pas @@ -1,7 +1,3 @@ -unit mathematics; - -interface - (* * copyright (c) 2005 Michael Niedermayer * @@ -24,19 +20,23 @@ interface For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT in the source codes *) +// Revision: 10765 + +unit mathematics; + {$IFDEF FPC} - {$IFDEF LINUX} - {$LINKLIB libavutil} - {$ENDIF} - {$MODE DELPHI } (* CAT *) - {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) - {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) + {$MODE DELPHI } + {$PACKENUM 4} (* use 4-byte enums *) + {$PACKRECORDS C} (* C/C++-compatible record packing *) +{$ELSE} + {$MINENUMSIZE 4} (* use 4-byte enums *) {$ENDIF} -uses - rational; (* CAT *) +interface -{$I version.inc} +uses + rational, + UConfig; type TAVRounding = ( @@ -44,23 +44,26 @@ type AV_ROUND_INF = 1, ///< round away from zero AV_ROUND_DOWN = 2, ///< round toward -infinity AV_ROUND_UP = 3, ///< round toward +infinity - AV_ROUND_NEAR_INF = 5, ///< round to nearest and halfway cases away from zero - AV_ROUND_FUCKING = $FFFFFF + AV_ROUND_NEAR_INF = 5 ///< round to nearest and halfway cases away from zero ); -(** * rescale a 64bit integer with rounding to nearest. - * a simple a*b/c isn't possible as it can overflow *) +(** + * rescale a 64bit integer with rounding to nearest. + * a simple a*b/c isn't possible as it can overflow + *) function av_rescale (a, b, c: int64): int64; cdecl; external av__util; (** * rescale a 64bit integer with specified rounding. - * a simple a*b/c isn't possible as it can overflow *) + * a simple a*b/c isn't possible as it can overflow + *) function av_rescale_rnd (a, b, c: int64; enum: TAVRounding): int64; cdecl; external av__util; (** - * rescale a 64bit integer by 2 rational numbers. *) + * rescale a 64bit integer by 2 rational numbers. + *) function av_rescale_q (a: int64; bq, cq: TAVRational): int64; cdecl; external av__util; diff --git a/Game/Code/lib/ffmpeg/mmreg.pas b/Game/Code/lib/ffmpeg/mmreg.pas deleted file mode 100644 index 05e24eb0..00000000 --- a/Game/Code/lib/ffmpeg/mmreg.pas +++ /dev/null @@ -1,1446 +0,0 @@ -unit mmreg; - -interface - -uses - windows, mmsystem; - -(*++ - -Copyright 1991-1998 Microsoft Corporation - -Module Name: - - mmreg.h - -Abstract: - - Multimedia Registration - -Revision History: - - Translated to .pas - Zinetz Victor, Dec. 2005 - mail@zinetz.info - ---*) - -// Define the following to skip definitions -// -// NOMMIDS Multimedia IDs are not defined -// NONEWWAVE No new waveform types are defined except WAVEFORMATEX -// NONEWRIFF No new RIFF forms are defined -// NOJPEGDIB No JPEG DIB definitions -// NONEWIC No new Image Compressor types are defined -// NOBITMAP No extended bitmap info header definition - -(* manufacturer IDs *) -const - MM_MICROSOFT = 1; //* Microsoft Corporation */ - MM_CREATIVE = 2; //* Creative Labs, Inc */ - MM_MEDIAVISION = 3; (* Media Vision, Inc. *) - MM_FUJITSU = 4; (* Fujitsu Corp. *) - MM_ARTISOFT = 20; (* Artisoft, Inc. *) - MM_TURTLE_BEACH = 21; (* Turtle Beach, Inc. *) - MM_IBM = 22; (* IBM Corporation *) - MM_VOCALTEC = 23; (* Vocaltec LTD. *) - MM_ROLAND = 24; (* Roland *) - MM_DSP_SOLUTIONS = 25; (* DSP Solutions, Inc. *) - MM_NEC = 26; (* NEC *) - MM_ATI = 27; (* ATI *) - MM_WANGLABS = 28; (* Wang Laboratories, Inc *) - MM_TANDY = 29; (* Tandy Corporation *) - MM_VOYETRA = 30; (* Voyetra *) - MM_ANTEX = 31; (* Antex Electronics Corporation *) - MM_ICL_PS = 32; (* ICL Personal Systems *) - MM_INTEL = 33; (* Intel Corporation *) - MM_GRAVIS = 34; (* Advanced Gravis *) - MM_VAL = 35; (* Video Associates Labs, Inc. *) - MM_INTERACTIVE = 36; (* InterActive Inc *) - MM_YAMAHA = 37; (* Yamaha Corporation of America *) - MM_EVEREX = 38; (* Everex Systems, Inc *) - MM_ECHO = 39; (* Echo Speech Corporation *) - MM_SIERRA = 40; (* Sierra Semiconductor Corp *) - MM_CAT = 41; (* Computer Aided Technologies *) - MM_APPS = 42; (* APPS Software International *) - MM_DSP_GROUP = 43; (* DSP Group, Inc *) - MM_MELABS = 44; (* microEngineering Labs *) - MM_COMPUTER_FRIENDS = 45; (* Computer Friends, Inc. *) - MM_ESS = 46; (* ESS Technology *) - MM_AUDIOFILE = 47; (* Audio, Inc. *) - MM_MOTOROLA = 48; (* Motorola, Inc. *) - MM_CANOPUS = 49; (* Canopus, co., Ltd. *) - MM_EPSON = 50; (* Seiko Epson Corporation *) - MM_TRUEVISION = 51; (* Truevision *) - MM_AZTECH = 52; (* Aztech Labs, Inc. *) - MM_VIDEOLOGIC = 53; (* Videologic *) - MM_SCALACS = 54; (* SCALACS *) - MM_KORG = 55; (* Korg Inc. *) - MM_APT = 56; (* Audio Processing Technology *) - MM_ICS = 57; (* Integrated Circuit Systems, Inc. *) - MM_ITERATEDSYS = 58; (* Iterated Systems, Inc. *) - MM_METHEUS = 59; (* Metheus *) - MM_LOGITECH = 60; (* Logitech, Inc. *) - MM_WINNOV = 61; (* Winnov, Inc. *) - MM_NCR = 62; (* NCR Corporation *) - MM_EXAN = 63; (* EXAN *) - MM_AST = 64; (* AST Research Inc. *) - MM_WILLOWPOND = 65; (* Willow Pond Corporation *) - MM_SONICFOUNDRY = 66; (* Sonic Foundry *) - MM_VITEC = 67; (* Vitec Multimedia *) - MM_MOSCOM = 68; (* MOSCOM Corporation *) - MM_SILICONSOFT = 69; (* Silicon Soft, Inc. *) - MM_SUPERMAC = 73; (* Supermac *) - MM_AUDIOPT = 74; (* Audio Processing Technology *) - MM_SPEECHCOMP = 76; (* Speech Compression *) - MM_AHEAD = 77; (* Ahead, Inc. *) - MM_DOLBY = 78; (* Dolby Laboratories *) - MM_OKI = 79; (* OKI *) - MM_AURAVISION = 80; (* AuraVision Corporation *) - MM_OLIVETTI = 81; (* Ing C. Olivetti & C., S.p.A. *) - MM_IOMAGIC = 82; (* I/O Magic Corporation *) - MM_MATSUSHITA = 83; (* Matsushita Electric Industrial Co., LTD. *) - MM_CONTROLRES = 84; (* Control Resources Limited *) - MM_XEBEC = 85; (* Xebec Multimedia Solutions Limited *) - MM_NEWMEDIA = 86; (* New Media Corporation *) - MM_NMS = 87; (* Natural MicroSystems *) - MM_LYRRUS = 88; (* Lyrrus Inc. *) - MM_COMPUSIC = 89; (* Compusic *) - MM_OPTI = 90; (* OPTi Computers Inc. *) - MM_ADLACC = 91; (* Adlib Accessories Inc. *) - MM_COMPAQ = 92; (* Compaq Computer Corp. *) - MM_DIALOGIC = 93; (* Dialogic Corporation *) - MM_INSOFT = 94; (* InSoft, Inc. *) - MM_MPTUS = 95; (* M.P. Technologies, Inc. *) - MM_WEITEK = 96; (* Weitek *) - MM_LERNOUT_AND_HAUSPIE = 97; (* Lernout & Hauspie *) - MM_QCIAR = 98; (* Quanta Computer Inc. *) - MM_APPLE = 99; (* Apple Computer, Inc. *) - MM_DIGITAL = 100; (* Digital Equipment Corporation *) - MM_MOTU = 101; (* Mark of the Unicorn *) - MM_WORKBIT = 102; (* Workbit Corporation *) - MM_OSITECH = 103; (* Ositech Communications Inc. *) - MM_MIRO = 104; (* miro Computer Products AG *) - MM_CIRRUSLOGIC = 105; (* Cirrus Logic *) - MM_ISOLUTION = 106; (* ISOLUTION B.V. *) - MM_HORIZONS = 107; (* Horizons Technology, Inc *) - MM_CONCEPTS = 108; (* Computer Concepts Ltd *) - MM_VTG = 109; (* Voice Technologies Group, Inc. *) - MM_RADIUS = 110; (* Radius *) - MM_ROCKWELL = 111; (* Rockwell International *) - MM_XYz = 112; (* Co. XYZ for testing *) - MM_OPCODE = 113; (* Opcode Systems *) - MM_VOXWARE = 114; (* Voxware Inc *) - MM_NORTHERN_TELECOM = 115; (* Northern Telecom Limited *) - MM_APICOM = 116; (* APICOM *) - MM_GRANDE = 117; (* Grande Software *) - MM_ADDX = 118; (* ADDX *) - MM_WILDCAT = 119; (* Wildcat Canyon Software *) - MM_RHETOREX = 120; (* Rhetorex Inc *) - MM_BROOKTREE = 121; (* Brooktree Corporation *) - MM_ENSONIQ = 125; (* ENSONIQ Corporation *) - MM_FAST = 126; (* ///FAST Multimedia AG *) - MM_NVIDIA = 127; (* NVidia Corporation *) - MM_OKSORI = 128; (* OKSORI Co., Ltd. *) - MM_DIACOUSTICS = 129; (* DiAcoustics, Inc. *) - MM_GULBRANSEN = 130; (* Gulbransen, Inc. *) - MM_KAY_ELEMETRICS = 131; (* Kay Elemetrics, Inc. *) - MM_CRYSTAL = 132; (* Crystal Semiconductor Corporation *) - MM_SPLASH_STUDIOS = 133; (* Splash Studios *) - MM_QUARTERDECK = 134; (* Quarterdeck Corporation *) - MM_TDK = 135; (* TDK Corporation *) - MM_DIGITAL_AUDIO_LABS = 136; (* Digital Audio Labs, Inc. *) - MM_SEERSYS = 137; (* Seer Systems, Inc. *) - MM_PICTURETEL = 138; (* PictureTel Corporation *) - MM_ATT_MICROELECTRONICS = 139; (* AT&T Microelectronics *) - MM_OSPREY = 140; (* Osprey Technologies, Inc. *) - MM_MEDIATRIX = 141; (* Mediatrix Peripherals *) - MM_SOUNDESIGNS = 142; (* SounDesignS M.C.S. Ltd. *) - MM_ALDIGITAL = 143; (* A.L. Digital Ltd. *) - MM_SPECTRUM_SIGNAL_PROCESSING= 144; (* Spectrum Signal Processing, Inc. *) - MM_ECS = 145; (* Electronic Courseware Systems, Inc. *) - MM_AMD = 146; (* AMD *) - MM_COREDYNAMICS = 147; (* Core Dynamics *) - MM_CANAM = 148; (* CANAM Computers *) - MM_SOFTSOUND = 149; (* Softsound, Ltd. *) - MM_NORRIS = 150; (* Norris Communications, Inc. *) - MM_DDD = 151; (* Danka Data Devices *) - MM_EUPHONICS = 152; (* EuPhonics *) - MM_PRECEPT = 153; (* Precept Software, Inc. *) - MM_CRYSTAL_NET = 154; (* Crystal Net Corporation *) - MM_CHROMATIC = 155; (* Chromatic Research, Inc *) - MM_VOICEINFO = 156; (* Voice Information Systems, Inc *) - MM_VIENNASYS = 157; (* Vienna Systems *) - MM_CONNECTIX = 158; (* Connectix Corporation *) - MM_GADGETLABS = 159; (* Gadget Labs LLC *) - MM_FRONTIER = 160; (* Frontier Design Group LLC *) - MM_VIONA = 161; (* Viona Development GmbH *) - MM_CASIO = 162; (* Casio Computer Co., LTD *) - MM_DIAMONDMM = 163; (* Diamond Multimedia *) - MM_S3 = 164; (* S3 *) - MM_FRAUNHOFER_IIS = 172; (* Fraunhofer *) - -(* MM_MICROSOFT product IDs *) - - MM_MIDI_MAPPER = 1; (* Midi Mapper *) - MM_WAVE_MAPPER = 2; (* Wave Mapper *) - MM_SNDBLST_MIDIOUT = 3; (* Sound Blaster MIDI output port *) - MM_SNDBLST_MIDIIN = 4; (* Sound Blaster MIDI input port *) - MM_SNDBLST_SYNTH = 5; (* Sound Blaster internal synth *) - MM_SNDBLST_WAVEOUT = 6; (* Sound Blaster waveform output *) - MM_SNDBLST_WAVEIN = 7; (* Sound Blaster waveform input *) - MM_ADLIB = 9; (* Ad Lib Compatible synth *) - MM_MPU401_MIDIOUT = 10; (* MPU 401 compatible MIDI output port *) - MM_MPU401_MIDIIN = 11; (* MPU 401 compatible MIDI input port *) - MM_PC_JOYSTICK = 12; (* Joystick adapter *) - - MM_PCSPEAKER_WAVEOUT = 13; (* PC speaker waveform output *) - MM_MSFT_WSS_WAVEIN = 14; (* MS Audio Board waveform input *) - MM_MSFT_WSS_WAVEOUT = 15; (* MS Audio Board waveform output *) - MM_MSFT_WSS_FMSYNTH_STEREO = 16; (* MS Audio Board Stereo FM synth *) - MM_MSFT_WSS_MIXER = 17; (* MS Audio Board Mixer Driver *) - MM_MSFT_WSS_OEM_WAVEIN = 18; (* MS OEM Audio Board waveform input *) - MM_MSFT_WSS_OEM_WAVEOUT = 19; (* MS OEM Audio Board waveform output *) - MM_MSFT_WSS_OEM_FMSYNTH_STEREO = 20; (* MS OEM Audio Board Stereo FM Synth *) - MM_MSFT_WSS_AUX = 21; (* MS Audio Board Aux. Port *) - MM_MSFT_WSS_OEM_AUX = 22; (* MS OEM Audio Aux Port *) - MM_MSFT_GENERIC_WAVEIN = 23; (* MS Vanilla driver waveform input *) - MM_MSFT_GENERIC_WAVEOUT = 24; (* MS Vanilla driver wavefrom output *) - MM_MSFT_GENERIC_MIDIIN = 25; (* MS Vanilla driver MIDI in *) - MM_MSFT_GENERIC_MIDIOUT = 26; (* MS Vanilla driver MIDI external out *) - MM_MSFT_GENERIC_MIDISYNTH = 27; (* MS Vanilla driver MIDI synthesizer *) - MM_MSFT_GENERIC_AUX_LINE = 28; (* MS Vanilla driver aux (line in) *) - MM_MSFT_GENERIC_AUX_MIC = 29; (* MS Vanilla driver aux (mic) *) - MM_MSFT_GENERIC_AUX_CD = 30; (* MS Vanilla driver aux (CD) *) - MM_MSFT_WSS_OEM_MIXER = 31; (* MS OEM Audio Board Mixer Driver *) - MM_MSFT_MSACM = 32; (* MS Audio Compression Manager *) - MM_MSFT_ACM_MSADPCM = 33; (* MS ADPCM Codec *) - MM_MSFT_ACM_IMAADPCM = 34; (* IMA ADPCM Codec *) - MM_MSFT_ACM_MSFILTER = 35; (* MS Filter *) - MM_MSFT_ACM_GSM610 = 36; (* GSM 610 codec *) - MM_MSFT_ACM_G711 = 37; (* G.711 codec *) - MM_MSFT_ACM_PCM = 38; (* PCM converter *) - - // Microsoft Windows Sound System drivers - - MM_WSS_SB16_WAVEIN = 39; (* Sound Blaster 16 waveform input *) - MM_WSS_SB16_WAVEOUT = 40; (* Sound Blaster 16 waveform output *) - MM_WSS_SB16_MIDIIN = 41; (* Sound Blaster 16 midi-in *) - MM_WSS_SB16_MIDIOUT = 42; (* Sound Blaster 16 midi out *) - MM_WSS_SB16_SYNTH = 43; (* Sound Blaster 16 FM Synthesis *) - MM_WSS_SB16_AUX_LINE = 44; (* Sound Blaster 16 aux (line in) *) - MM_WSS_SB16_AUX_CD = 45; (* Sound Blaster 16 aux (CD) *) - MM_WSS_SB16_MIXER = 46; (* Sound Blaster 16 mixer device *) - MM_WSS_SBPRO_WAVEIN = 47; (* Sound Blaster Pro waveform input *) - MM_WSS_SBPRO_WAVEOUT = 48; (* Sound Blaster Pro waveform output *) - MM_WSS_SBPRO_MIDIIN = 49; (* Sound Blaster Pro midi in *) - MM_WSS_SBPRO_MIDIOUT = 50; (* Sound Blaster Pro midi out *) - MM_WSS_SBPRO_SYNTH = 51; (* Sound Blaster Pro FM synthesis *) - MM_WSS_SBPRO_AUX_LINE = 52; (* Sound Blaster Pro aux (line in ) *) - MM_WSS_SBPRO_AUX_CD = 53; (* Sound Blaster Pro aux (CD) *) - MM_WSS_SBPRO_MIXER = 54; (* Sound Blaster Pro mixer *) - - MM_MSFT_WSS_NT_WAVEIN = 55; (* WSS NT wave in *) - MM_MSFT_WSS_NT_WAVEOUT = 56; (* WSS NT wave out *) - MM_MSFT_WSS_NT_FMSYNTH_STEREO = 57; (* WSS NT FM synth *) - MM_MSFT_WSS_NT_MIXER = 58; (* WSS NT mixer *) - MM_MSFT_WSS_NT_AUX = 59; (* WSS NT aux *) - - MM_MSFT_SB16_WAVEIN = 60; (* Sound Blaster 16 waveform input *) - MM_MSFT_SB16_WAVEOUT = 61; (* Sound Blaster 16 waveform output *) - MM_MSFT_SB16_MIDIIN = 62; (* Sound Blaster 16 midi-in *) - MM_MSFT_SB16_MIDIOUT = 63; (* Sound Blaster 16 midi out *) - MM_MSFT_SB16_SYNTH = 64; (* Sound Blaster 16 FM Synthesis *) - MM_MSFT_SB16_AUX_LINE = 65; (* Sound Blaster 16 aux (line in) *) - MM_MSFT_SB16_AUX_CD = 66; (* Sound Blaster 16 aux (CD) *) - MM_MSFT_SB16_MIXER = 67; (* Sound Blaster 16 mixer device *) - MM_MSFT_SBPRO_WAVEIN = 68; (* Sound Blaster Pro waveform input *) - MM_MSFT_SBPRO_WAVEOUT = 69; (* Sound Blaster Pro waveform output *) - MM_MSFT_SBPRO_MIDIIN = 70; (* Sound Blaster Pro midi in *) - MM_MSFT_SBPRO_MIDIOUT = 71; (* Sound Blaster Pro midi out *) - MM_MSFT_SBPRO_SYNTH = 72; (* Sound Blaster Pro FM synthesis *) - MM_MSFT_SBPRO_AUX_LINE = 73; (* Sound Blaster Pro aux (line in ) *) - MM_MSFT_SBPRO_AUX_CD = 74; (* Sound Blaster Pro aux (CD) *) - MM_MSFT_SBPRO_MIXER = 75; (* Sound Blaster Pro mixer *) - - MM_MSFT_MSOPL_SYNTH = 76; (* Yamaha OPL2/OPL3 compatible FM synthesis *) - - MM_MSFT_VMDMS_LINE_WAVEIN = 80; (* Voice Modem Serial Line Wave Input *) - MM_MSFT_VMDMS_LINE_WAVEOUT = 81; (* Voice Modem Serial Line Wave Output *) - MM_MSFT_VMDMS_HANDSET_WAVEIN = 82; (* Voice Modem Serial Handset Wave Input *) - MM_MSFT_VMDMS_HANDSET_WAVEOUT = 83; (* Voice Modem Serial Handset Wave Output *) - MM_MSFT_VMDMW_LINE_WAVEIN = 84; (* Voice Modem Wrapper Line Wave Input *) - MM_MSFT_VMDMW_LINE_WAVEOUT = 85; (* Voice Modem Wrapper Line Wave Output *) - MM_MSFT_VMDMW_HANDSET_WAVEIN = 86; (* Voice Modem Wrapper Handset Wave Input *) - MM_MSFT_VMDMW_HANDSET_WAVEOUT = 87; (* Voice Modem Wrapper Handset Wave Output *) - MM_MSFT_VMDMW_MIXER = 88; (* Voice Modem Wrapper Mixer *) - MM_MSFT_VMDM_GAME_WAVEOUT = 89; (* Voice Modem Game Compatible Wave Device *) - MM_MSFT_VMDM_GAME_WAVEIN = 90; (* Voice Modem Game Compatible Wave Device *) - - MM_MSFT_ACM_MSNAUDIO = 91; (* *) - MM_MSFT_ACM_MSG723 = 92; (* *) - - MM_MSFT_WDMAUDIO_WAVEOUT = 100; (* Generic id for WDM Audio drivers *) - MM_MSFT_WDMAUDIO_WAVEIN = 101; (* Generic id for WDM Audio drivers *) - MM_MSFT_WDMAUDIO_MIDIOUT = 102; (* Generic id for WDM Audio drivers *) - MM_MSFT_WDMAUDIO_MIDIIN = 103; (* Generic id for WDM Audio drivers *) - MM_MSFT_WDMAUDIO_MIXER = 104; (* Generic id for WDM Audio drivers *) - - -(* MM_CREATIVE product IDs *) - MM_CREATIVE_SB15_WAVEIN = 1; (* SB (r) 1.5 waveform input *) - MM_CREATIVE_SB20_WAVEIN = 2; - MM_CREATIVE_SBPRO_WAVEIN = 3; - MM_CREATIVE_SBP16_WAVEIN = 4; - MM_CREATIVE_PHNBLST_WAVEIN = 5; - MM_CREATIVE_SB15_WAVEOUT = 101; - MM_CREATIVE_SB20_WAVEOUT = 102; - MM_CREATIVE_SBPRO_WAVEOUT = 103; - MM_CREATIVE_SBP16_WAVEOUT = 104; - MM_CREATIVE_PHNBLST_WAVEOUT = 105; - MM_CREATIVE_MIDIOUT = 201; (* SB (r) *) - MM_CREATIVE_MIDIIN = 202; (* SB (r) *) - MM_CREATIVE_FMSYNTH_MONO = 301; (* SB (r) *) - MM_CREATIVE_FMSYNTH_STEREO = 302; (* SB Pro (r) stereo synthesizer *) - MM_CREATIVE_MIDI_AWE32 = 303; - MM_CREATIVE_AUX_CD = 401; (* SB Pro (r) aux (CD) *) - MM_CREATIVE_AUX_LINE = 402; (* SB Pro (r) aux (Line in ) *) - MM_CREATIVE_AUX_MIC = 403; (* SB Pro (r) aux (mic) *) - MM_CREATIVE_AUX_MASTER = 404; - MM_CREATIVE_AUX_PCSPK = 405; - MM_CREATIVE_AUX_WAVE = 406; - MM_CREATIVE_AUX_MIDI = 407; - MM_CREATIVE_SBPRO_MIXER = 408; - MM_CREATIVE_SB16_MIXER = 409; - -(* MM_MEDIAVISION product IDs *) - -// Pro Audio Spectrum - MM_MEDIAVISION_PROAUDIO = $10; - MM_PROAUD_MIDIOUT = (MM_MEDIAVISION_PROAUDIO+1); - MM_PROAUD_MIDIIN = (MM_MEDIAVISION_PROAUDIO+2); - MM_PROAUD_SYNTH = (MM_MEDIAVISION_PROAUDIO+3); - MM_PROAUD_WAVEOUT = (MM_MEDIAVISION_PROAUDIO+4); - MM_PROAUD_WAVEIN = (MM_MEDIAVISION_PROAUDIO+5); - MM_PROAUD_MIXER = (MM_MEDIAVISION_PROAUDIO+6); - MM_PROAUD_AUX = (MM_MEDIAVISION_PROAUDIO+7); - -// Thunder Board - MM_MEDIAVISION_THUNDER = $20; - MM_THUNDER_SYNTH = (MM_MEDIAVISION_THUNDER+3); - MM_THUNDER_WAVEOUT = (MM_MEDIAVISION_THUNDER+4); - MM_THUNDER_WAVEIN = (MM_MEDIAVISION_THUNDER+5); - MM_THUNDER_AUX = (MM_MEDIAVISION_THUNDER+7); - -// Audio Port - MM_MEDIAVISION_TPORT = $40; - MM_TPORT_WAVEOUT = (MM_MEDIAVISION_TPORT+1); - MM_TPORT_WAVEIN = (MM_MEDIAVISION_TPORT+2); - MM_TPORT_SYNTH = (MM_MEDIAVISION_TPORT+3); - -// Pro Audio Spectrum Plus - MM_MEDIAVISION_PROAUDIO_PLUS = $50; - MM_PROAUD_PLUS_MIDIOUT = (MM_MEDIAVISION_PROAUDIO_PLUS+1); - MM_PROAUD_PLUS_MIDIIN = (MM_MEDIAVISION_PROAUDIO_PLUS+2); - MM_PROAUD_PLUS_SYNTH = (MM_MEDIAVISION_PROAUDIO_PLUS+3); - MM_PROAUD_PLUS_WAVEOUT = (MM_MEDIAVISION_PROAUDIO_PLUS+4); - MM_PROAUD_PLUS_WAVEIN = (MM_MEDIAVISION_PROAUDIO_PLUS+5); - MM_PROAUD_PLUS_MIXER = (MM_MEDIAVISION_PROAUDIO_PLUS+6); - MM_PROAUD_PLUS_AUX = (MM_MEDIAVISION_PROAUDIO_PLUS+7); - -// Pro Audio Spectrum 16 - MM_MEDIAVISION_PROAUDIO_16 = $60; - MM_PROAUD_16_MIDIOUT = (MM_MEDIAVISION_PROAUDIO_16+1); - MM_PROAUD_16_MIDIIN = (MM_MEDIAVISION_PROAUDIO_16+2); - MM_PROAUD_16_SYNTH = (MM_MEDIAVISION_PROAUDIO_16+3); - MM_PROAUD_16_WAVEOUT = (MM_MEDIAVISION_PROAUDIO_16+4); - MM_PROAUD_16_WAVEIN = (MM_MEDIAVISION_PROAUDIO_16+5); - MM_PROAUD_16_MIXER = (MM_MEDIAVISION_PROAUDIO_16+6); - MM_PROAUD_16_AUX = (MM_MEDIAVISION_PROAUDIO_16+7); - -// Pro Audio Studio 16 - MM_MEDIAVISION_PROSTUDIO_16 = $60; - MM_STUDIO_16_MIDIOUT = (MM_MEDIAVISION_PROSTUDIO_16+1); - MM_STUDIO_16_MIDIIN = (MM_MEDIAVISION_PROSTUDIO_16+2); - MM_STUDIO_16_SYNTH = (MM_MEDIAVISION_PROSTUDIO_16+3); - MM_STUDIO_16_WAVEOUT = (MM_MEDIAVISION_PROSTUDIO_16+4); - MM_STUDIO_16_WAVEIN = (MM_MEDIAVISION_PROSTUDIO_16+5); - MM_STUDIO_16_MIXER = (MM_MEDIAVISION_PROSTUDIO_16+6); - MM_STUDIO_16_AUX = (MM_MEDIAVISION_PROSTUDIO_16+7); - -// CDPC - MM_MEDIAVISION_CDPC = $70; - MM_CDPC_MIDIOUT = (MM_MEDIAVISION_CDPC+1); - MM_CDPC_MIDIIN = (MM_MEDIAVISION_CDPC+2); - MM_CDPC_SYNTH = (MM_MEDIAVISION_CDPC+3); - MM_CDPC_WAVEOUT = (MM_MEDIAVISION_CDPC+4); - MM_CDPC_WAVEIN = (MM_MEDIAVISION_CDPC+5); - MM_CDPC_MIXER = (MM_MEDIAVISION_CDPC+6); - MM_CDPC_AUX = (MM_MEDIAVISION_CDPC+7); - -// Opus MV 1208 Chipsent - MM_MEDIAVISION_OPUS1208 = $80; - MM_OPUS401_MIDIOUT = (MM_MEDIAVISION_OPUS1208+1); - MM_OPUS401_MIDIIN = (MM_MEDIAVISION_OPUS1208+2); - MM_OPUS1208_SYNTH = (MM_MEDIAVISION_OPUS1208+3); - MM_OPUS1208_WAVEOUT = (MM_MEDIAVISION_OPUS1208+4); - MM_OPUS1208_WAVEIN = (MM_MEDIAVISION_OPUS1208+5); - MM_OPUS1208_MIXER = (MM_MEDIAVISION_OPUS1208+6); - MM_OPUS1208_AUX = (MM_MEDIAVISION_OPUS1208+7); - -// Opus MV 1216 chipset - MM_MEDIAVISION_OPUS1216 = $90; - MM_OPUS1216_MIDIOUT = (MM_MEDIAVISION_OPUS1216+1); - MM_OPUS1216_MIDIIN = (MM_MEDIAVISION_OPUS1216+2); - MM_OPUS1216_SYNTH = (MM_MEDIAVISION_OPUS1216+3); - MM_OPUS1216_WAVEOUT = (MM_MEDIAVISION_OPUS1216+4); - MM_OPUS1216_WAVEIN = (MM_MEDIAVISION_OPUS1216+5); - MM_OPUS1216_MIXER = (MM_MEDIAVISION_OPUS1216+6); - MM_OPUS1216_AUX = (MM_MEDIAVISION_OPUS1216+7); - -(* MM_ARTISOFT product IDs *) - MM_ARTISOFT_SBWAVEIN = 1; (* Artisoft sounding Board waveform input *) - MM_ARTISOFT_SBWAVEOUT = 2; (* Artisoft sounding Board waveform output *) - -(* MM_IBM product IDs *) - MM_MMOTION_WAVEAUX = 1; (* IBM M-Motion Auxiliary Device *) - MM_MMOTION_WAVEOUT = 2; (* IBM M-Motion Waveform output *) - MM_MMOTION_WAVEIN = 3; (* IBM M-Motion Waveform Input *) - MM_IBM_PCMCIA_WAVEIN = 11; (* IBM waveform input *) - MM_IBM_PCMCIA_WAVEOUT = 12; (* IBM Waveform output *) - MM_IBM_PCMCIA_SYNTH = 13; (* IBM Midi Synthesis *) - MM_IBM_PCMCIA_MIDIIN = 14; (* IBM external MIDI in *) - MM_IBM_PCMCIA_MIDIOUT = 15; (* IBM external MIDI out *) - MM_IBM_PCMCIA_AUX = 16; (* IBM auxiliary control *) - MM_IBM_THINKPAD200 = 17; - MM_IBM_MWAVE_WAVEIN = 18; - MM_IBM_MWAVE_WAVEOUT = 19; - MM_IBM_MWAVE_MIXER = 20; - MM_IBM_MWAVE_MIDIIN = 21; - MM_IBM_MWAVE_MIDIOUT = 22; - MM_IBM_MWAVE_AUX = 23; - MM_IBM_WC_MIDIOUT = 30; - MM_IBM_WC_WAVEOUT = 31; - MM_IBM_WC_MIXEROUT = 33; - -(* MM_VOCALTEC product IDs *) - MM_VOCALTEC_WAVEOUT = 1; - MM_VOCALTEC_WAVEIN = 2; - -(* MM_ROLAND product IDs *) - MM_ROLAND_RAP10_MIDIOUT = 10; (* MM_ROLAND_RAP10 *) - MM_ROLAND_RAP10_MIDIIN = 11; (* MM_ROLAND_RAP10 *) - MM_ROLAND_RAP10_SYNTH = 12; (* MM_ROLAND_RAP10 *) - MM_ROLAND_RAP10_WAVEOUT = 13; (* MM_ROLAND_RAP10 *) - MM_ROLAND_RAP10_WAVEIN = 14; (* MM_ROLAND_RAP10 *) - MM_ROLAND_MPU401_MIDIOUT = 15; - MM_ROLAND_MPU401_MIDIIN = 16; - MM_ROLAND_SMPU_MIDIOUTA = 17; - MM_ROLAND_SMPU_MIDIOUTB = 18; - MM_ROLAND_SMPU_MIDIINA = 19; - MM_ROLAND_SMPU_MIDIINB = 20; - MM_ROLAND_SC7_MIDIOUT = 21; - MM_ROLAND_SC7_MIDIIN = 22; - MM_ROLAND_SERIAL_MIDIOUT = 23; - MM_ROLAND_SERIAL_MIDIIN = 24; - MM_ROLAND_SCP_MIDIOUT = 38; - MM_ROLAND_SCP_MIDIIN = 39; - MM_ROLAND_SCP_WAVEOUT = 40; - MM_ROLAND_SCP_WAVEIN = 41; - MM_ROLAND_SCP_MIXER = 42; - MM_ROLAND_SCP_AUX = 48; - -(* MM_DSP_SOLUTIONS product IDs *) - MM_DSP_SOLUTIONS_WAVEOUT = 1; - MM_DSP_SOLUTIONS_WAVEIN = 2; - MM_DSP_SOLUTIONS_SYNTH = 3; - MM_DSP_SOLUTIONS_AUX = 4; - -(* MM_WANGLABS product IDs *) - MM_WANGLABS_WAVEIN1 = 1; (* Input audio wave on CPU board models: Exec 4010, 4030, 3450; PC 251/25c, pc 461/25s , pc 461/33c *) - MM_WANGLABS_WAVEOUT1 = 2; - -(* MM_TANDY product IDs *) - MM_TANDY_VISWAVEIN = 1; - MM_TANDY_VISWAVEOUT = 2; - MM_TANDY_VISBIOSSYNTH = 3; - MM_TANDY_SENS_MMAWAVEIN = 4; - MM_TANDY_SENS_MMAWAVEOUT = 5; - MM_TANDY_SENS_MMAMIDIIN = 6; - MM_TANDY_SENS_MMAMIDIOUT = 7; - MM_TANDY_SENS_VISWAVEOUT = 8; - MM_TANDY_PSSJWAVEIN = 9; - MM_TANDY_PSSJWAVEOUT = 10; - -(* product IDs *) - MM_INTELOPD_WAVEIN = 1; (* HID2 WaveAudio Driver *) - MM_INTELOPD_WAVEOUT = 101; (* HID2 *) - MM_INTELOPD_AUX = 401; (* HID2 for mixing *) - MM_INTEL_NSPMODEMLINE = 501; - -(* MM_INTERACTIVE product IDs *) - MM_INTERACTIVE_WAVEIN = $45; - MM_INTERACTIVE_WAVEOUT = $45; - -(* MM_YAMAHA product IDs *) - MM_YAMAHA_GSS_SYNTH = $01; - MM_YAMAHA_GSS_WAVEOUT = $02; - MM_YAMAHA_GSS_WAVEIN = $03; - MM_YAMAHA_GSS_MIDIOUT = $04; - MM_YAMAHA_GSS_MIDIIN = $05; - MM_YAMAHA_GSS_AUX = $06; - MM_YAMAHA_SERIAL_MIDIOUT = $07; - MM_YAMAHA_SERIAL_MIDIIN = $08; - MM_YAMAHA_OPL3SA_WAVEOUT = $10; - MM_YAMAHA_OPL3SA_WAVEIN = $11; - MM_YAMAHA_OPL3SA_FMSYNTH = $12; - MM_YAMAHA_OPL3SA_YSYNTH = $13; - MM_YAMAHA_OPL3SA_MIDIOUT = $14; - MM_YAMAHA_OPL3SA_MIDIIN = $15; - MM_YAMAHA_OPL3SA_MIXER = $17; - MM_YAMAHA_OPL3SA_JOYSTICK = $18; - -(* MM_EVEREX product IDs *) - MM_EVEREX_CARRIER = $01; - -(* MM_ECHO product IDs *) - MM_ECHO_SYNTH = $01; - MM_ECHO_WAVEOUT = $02; - MM_ECHO_WAVEIN = $03; - MM_ECHO_MIDIOUT = $04; - MM_ECHO_MIDIIN = $05; - MM_ECHO_AUX = $06; - -(* MM_SIERRA product IDs *) - MM_SIERRA_ARIA_MIDIOUT = $14; - MM_SIERRA_ARIA_MIDIIN = $15; - MM_SIERRA_ARIA_SYNTH = $16; - MM_SIERRA_ARIA_WAVEOUT = $17; - MM_SIERRA_ARIA_WAVEIN = $18; - MM_SIERRA_ARIA_AUX = $19; - MM_SIERRA_ARIA_AUX2 = $20; - MM_SIERRA_QUARTET_WAVEIN = $50; - MM_SIERRA_QUARTET_WAVEOUT = $51; - MM_SIERRA_QUARTET_MIDIIN = $52; - MM_SIERRA_QUARTET_MIDIOUT = $53; - MM_SIERRA_QUARTET_SYNTH = $54; - MM_SIERRA_QUARTET_AUX_CD = $55; - MM_SIERRA_QUARTET_AUX_LINE = $56; - MM_SIERRA_QUARTET_AUX_MODEM = $57; - MM_SIERRA_QUARTET_MIXER = $58; - -(* MM_CAT product IDs *) - MM_CAT_WAVEOUT = 1; - -(* MM_DSP_GROUP product IDs *) - MM_DSP_GROUP_TRUESPEECH = $01; - -(* MM_MELABS product IDs *) - MM_MELABS_MIDI2GO = $01; - -(* MM_ESS product IDs *) - MM_ESS_AMWAVEOUT = $01; - MM_ESS_AMWAVEIN = $02; - MM_ESS_AMAUX = $03; - MM_ESS_AMSYNTH = $04; - MM_ESS_AMMIDIOUT = $05; - MM_ESS_AMMIDIIN = $06; - MM_ESS_MIXER = $07; - MM_ESS_AUX_CD = $08; - MM_ESS_MPU401_MIDIOUT = $09; - MM_ESS_MPU401_MIDIIN = $0A; - MM_ESS_ES488_WAVEOUT = $10; - MM_ESS_ES488_WAVEIN = $11; - MM_ESS_ES488_MIXER = $12; - MM_ESS_ES688_WAVEOUT = $13; - MM_ESS_ES688_WAVEIN = $14; - MM_ESS_ES688_MIXER = $15; - MM_ESS_ES1488_WAVEOUT = $16; - MM_ESS_ES1488_WAVEIN = $17; - MM_ESS_ES1488_MIXER = $18; - MM_ESS_ES1688_WAVEOUT = $19; - MM_ESS_ES1688_WAVEIN = $1A; - MM_ESS_ES1688_MIXER = $1B; - MM_ESS_ES1788_WAVEOUT = $1C; - MM_ESS_ES1788_WAVEIN = $1D; - MM_ESS_ES1788_MIXER = $1E; - MM_ESS_ES1888_WAVEOUT = $1F; - MM_ESS_ES1888_WAVEIN = $20; - MM_ESS_ES1888_MIXER = $21; - MM_ESS_ES1868_WAVEOUT = $22; - MM_ESS_ES1868_WAVEIN = $23; - MM_ESS_ES1868_MIXER = $24; - MM_ESS_ES1878_WAVEOUT = $25; - MM_ESS_ES1878_WAVEIN = $26; - MM_ESS_ES1878_MIXER = $27; - -(* product IDs *) - MM_EPS_FMSND = 1; - -(* MM_TRUEVISION product IDs *) - MM_TRUEVISION_WAVEIN1 = 1; - MM_TRUEVISION_WAVEOUT1 = 2; - -(* MM_AZTECH product IDs *) - MM_AZTECH_MIDIOUT = 3; - MM_AZTECH_MIDIIN = 4; - MM_AZTECH_WAVEIN = 17; - MM_AZTECH_WAVEOUT = 18; - MM_AZTECH_FMSYNTH = 20; - MM_AZTECH_MIXER = 21; - MM_AZTECH_PRO16_WAVEIN = 33; - MM_AZTECH_PRO16_WAVEOUT = 34; - MM_AZTECH_PRO16_FMSYNTH = 38; - MM_AZTECH_DSP16_WAVEIN = 65; - MM_AZTECH_DSP16_WAVEOUT = 66; - MM_AZTECH_DSP16_FMSYNTH = 68; - MM_AZTECH_DSP16_WAVESYNTH = 70; - MM_AZTECH_NOVA16_WAVEIN = 71; - MM_AZTECH_NOVA16_WAVEOUT = 72; - MM_AZTECH_NOVA16_MIXER = 73; - MM_AZTECH_WASH16_WAVEIN = 74; - MM_AZTECH_WASH16_WAVEOUT = 75; - MM_AZTECH_WASH16_MIXER = 76; - MM_AZTECH_AUX_CD = 401; - MM_AZTECH_AUX_LINE = 402; - MM_AZTECH_AUX_MIC = 403; - MM_AZTECH_AUX = 404; - -(* MM_VIDEOLOGIC product IDs *) - MM_VIDEOLOGIC_MSWAVEIN = 1; - MM_VIDEOLOGIC_MSWAVEOUT = 2; - -(* MM_KORG product IDs *) - MM_KORG_PCIF_MIDIOUT = 1; - MM_KORG_PCIF_MIDIIN = 2; - -(* MM_APT product IDs *) - MM_APT_ACE100CD = 1; - -(* MM_ICS product IDs *) - MM_ICS_WAVEDECK_WAVEOUT = 1; (* MS WSS compatible card and driver *) - MM_ICS_WAVEDECK_WAVEIN = 2; - MM_ICS_WAVEDECK_MIXER = 3; - MM_ICS_WAVEDECK_AUX = 4; - MM_ICS_WAVEDECK_SYNTH = 5; - MM_ICS_WAVEDEC_SB_WAVEOUT = 6; - MM_ICS_WAVEDEC_SB_WAVEIN = 7; - MM_ICS_WAVEDEC_SB_FM_MIDIOUT = 8; - MM_ICS_WAVEDEC_SB_MPU401_MIDIOUT = 9; - MM_ICS_WAVEDEC_SB_MPU401_MIDIIN = 10; - MM_ICS_WAVEDEC_SB_MIXER = 11; - MM_ICS_WAVEDEC_SB_AUX = 12; - MM_ICS_2115_LITE_MIDIOUT = 13; - MM_ICS_2120_LITE_MIDIOUT = 14; - -(* MM_ITERATEDSYS product IDs *) - MM_ITERATEDSYS_FUFCODEC = 1; - -(* MM_METHEUS product IDs *) - MM_METHEUS_ZIPPER = 1; - -(* MM_WINNOV product IDs *) - MM_WINNOV_CAVIAR_WAVEIN = 1; - MM_WINNOV_CAVIAR_WAVEOUT = 2; - MM_WINNOV_CAVIAR_VIDC = 3; - MM_WINNOV_CAVIAR_CHAMPAGNE = 4; (* Fourcc is CHAM *) - MM_WINNOV_CAVIAR_YUV8 = 5; (* Fourcc is YUV8 *) - -(* MM_NCR product IDs *) - MM_NCR_BA_WAVEIN = 1; - MM_NCR_BA_WAVEOUT = 2; - MM_NCR_BA_SYNTH = 3; - MM_NCR_BA_AUX = 4; - MM_NCR_BA_MIXER = 5; - -(* MM_VITEC product IDs *) - MM_VITEC_VMAKER = 1; - MM_VITEC_VMPRO = 2; - -(* MM_MOSCOM product IDs *) - MM_MOSCOM_VPC2400_IN = 1; (* Four Port Voice Processing / Voice Recognition Board *) - MM_MOSCOM_VPC2400_OUT = 2; (* VPC2400 *) - -(* MM_SILICONSOFT product IDs *) - MM_SILICONSOFT_SC1_WAVEIN = 1; (* Waveform in , high sample rate *) - MM_SILICONSOFT_SC1_WAVEOUT = 2; (* Waveform out , high sample rate *) - MM_SILICONSOFT_SC2_WAVEIN = 3; (* Waveform in 2 channels, high sample rate *) - MM_SILICONSOFT_SC2_WAVEOUT = 4; (* Waveform out 2 channels, high sample rate *) - MM_SILICONSOFT_SOUNDJR2_WAVEOUT = 5; (* Waveform out, self powered, efficient *) - MM_SILICONSOFT_SOUNDJR2PR_WAVEIN = 6; (* Waveform in, self powered, efficient *) - MM_SILICONSOFT_SOUNDJR2PR_WAVEOUT = 7; (* Waveform out 2 channels, self powered, efficient *) - MM_SILICONSOFT_SOUNDJR3_WAVEOUT = 8; (* Waveform in 2 channels, self powered, efficient *) - -(* MM_OLIVETTI product IDs *) - MM_OLIVETTI_WAVEIN = 1; - MM_OLIVETTI_WAVEOUT = 2; - MM_OLIVETTI_MIXER = 3; - MM_OLIVETTI_AUX = 4; - MM_OLIVETTI_MIDIIN = 5; - MM_OLIVETTI_MIDIOUT = 6; - MM_OLIVETTI_SYNTH = 7; - MM_OLIVETTI_JOYSTICK = 8; - MM_OLIVETTI_ACM_GSM = 9; - MM_OLIVETTI_ACM_ADPCM = 10; - MM_OLIVETTI_ACM_CELP = 11; - MM_OLIVETTI_ACM_SBC = 12; - MM_OLIVETTI_ACM_OPR = 13; - -(* MM_IOMAGIC product IDs *) - -(* The I/O Magic Tempo is a PCMCIA Type 2 audio card featuring wave audio - record and playback, FM synthesizer, and MIDI output. The I/O Magic - Tempo WaveOut device supports mono and stereo PCM playback at rates - of 7350, 11025, 22050, and 44100 samples *) - - MM_IOMAGIC_TEMPO_WAVEOUT = 1; - MM_IOMAGIC_TEMPO_WAVEIN = 2; - MM_IOMAGIC_TEMPO_SYNTH = 3; - MM_IOMAGIC_TEMPO_MIDIOUT = 4; - MM_IOMAGIC_TEMPO_MXDOUT = 5; - MM_IOMAGIC_TEMPO_AUXOUT = 6; - -(* MM_MATSUSHITA product IDs *) - MM_MATSUSHITA_WAVEIN = 1; - MM_MATSUSHITA_WAVEOUT = 2; - MM_MATSUSHITA_FMSYNTH_STEREO = 3; - MM_MATSUSHITA_MIXER = 4; - MM_MATSUSHITA_AUX = 5; - -(* MM_NEWMEDIA product IDs *) - MM_NEWMEDIA_WAVJAMMER = 1; (* WSS Compatible sound card. *) - -(* MM_LYRRUS product IDs *) - -(* Bridge is a MIDI driver that allows the the Lyrrus G-VOX hardware to - communicate with Windows base transcription and sequencer applications. - The driver also provides a mechanism for the user to configure the system - to their personal playing style. *) - - MM_LYRRUS_BRIDGE_GUITAR = 1; - -(* MM_OPTI product IDs *) - MM_OPTI_M16_FMSYNTH_STEREO = $0001; - MM_OPTI_M16_MIDIIN = $0002; - MM_OPTI_M16_MIDIOUT = $0003; - MM_OPTI_M16_WAVEIN = $0004; - MM_OPTI_M16_WAVEOUT = $0005; - MM_OPTI_M16_MIXER = $0006; - MM_OPTI_M16_AUX = $0007; - MM_OPTI_P16_FMSYNTH_STEREO = $0010; - MM_OPTI_P16_MIDIIN = $0011; - MM_OPTI_P16_MIDIOUT = $0012; - MM_OPTI_P16_WAVEIN = $0013; - MM_OPTI_P16_WAVEOUT = $0014; - MM_OPTI_P16_MIXER = $0015; - MM_OPTI_P16_AUX = $0016; - MM_OPTI_M32_WAVEIN = $0020; - MM_OPTI_M32_WAVEOUT = $0021; - MM_OPTI_M32_MIDIIN = $0022; - MM_OPTI_M32_MIDIOUT = $0023; - MM_OPTI_M32_SYNTH_STEREO = $0024; - MM_OPTI_M32_MIXER = $0025; - MM_OPTI_M32_AUX = $0026; - -(* Product IDs for MM_ADDX - ADDX *) - MM_ADDX_PCTV_DIGITALMIX = 1; (* MM_ADDX_PCTV_DIGITALMIX *) - MM_ADDX_PCTV_WAVEIN = 2; (* MM_ADDX_PCTV_WAVEIN *) - MM_ADDX_PCTV_WAVEOUT = 3; (* MM_ADDX_PCTV_WAVEOUT *) - MM_ADDX_PCTV_MIXER = 4; (* MM_ADDX_PCTV_MIXER *) - MM_ADDX_PCTV_AUX_CD = 5; (* MM_ADDX_PCTV_AUX_CD *) - MM_ADDX_PCTV_AUX_LINE = 6; (* MM_ADDX_PCTV_AUX_LINE *) - -(* Product IDs for MM_AHEAD - Ahead, Inc. *) - MM_AHEAD_MULTISOUND = 1; - MM_AHEAD_SOUNDBLASTER = 2; - MM_AHEAD_PROAUDIO = 3; - MM_AHEAD_GENERIC = 4; - -(* Product IDs for MM_AMD - AMD *) - MM_AMD_INTERWAVE_WAVEIN = 1; - MM_AMD_INTERWAVE_WAVEOUT = 2; - MM_AMD_INTERWAVE_SYNTH = 3; - MM_AMD_INTERWAVE_MIXER1 = 4; - MM_AMD_INTERWAVE_MIXER2 = 5; - MM_AMD_INTERWAVE_JOYSTICK = 6; - MM_AMD_INTERWAVE_EX_CD = 7; - MM_AMD_INTERWAVE_MIDIIN = 8; - MM_AMD_INTERWAVE_MIDIOUT = 9; - MM_AMD_INTERWAVE_AUX1 = 10; - MM_AMD_INTERWAVE_AUX2 = 11; - MM_AMD_INTERWAVE_AUX_MIC = 12; - MM_AMD_INTERWAVE_AUX_CD = 13; - MM_AMD_INTERWAVE_MONO_IN = 14; - MM_AMD_INTERWAVE_MONO_OUT = 15; - MM_AMD_INTERWAVE_EX_TELEPHONY = 16; - MM_AMD_INTERWAVE_WAVEOUT_BASE = 17; - MM_AMD_INTERWAVE_WAVEOUT_TREBLE = 18; - MM_AMD_INTERWAVE_STEREO_ENHANCED = 19; - -(* Product IDs for MM_AST - AST Research Inc. *) - MM_AST_MODEMWAVE_WAVEIN = 13; - MM_AST_MODEMWAVE_WAVEOUT = 14; - -(* Product IDs for MM_BROOKTREE - Brooktree Corporation *) - MM_BTV_WAVEIN = 1; (* Brooktree PCM Wave Audio In *) - MM_BTV_WAVEOUT = 2; (* Brooktree PCM Wave Audio Out *) - MM_BTV_MIDIIN = 3; (* Brooktree MIDI In *) - MM_BTV_MIDIOUT = 4; (* Brooktree MIDI out *) - MM_BTV_MIDISYNTH = 5; (* Brooktree MIDI FM synth *) - MM_BTV_AUX_LINE = 6; (* Brooktree Line Input *) - MM_BTV_AUX_MIC = 7; (* Brooktree Microphone Input *) - MM_BTV_AUX_CD = 8; (* Brooktree CD Input *) - MM_BTV_DIGITALIN = 9; (* Brooktree PCM Wave in with subcode information *) - MM_BTV_DIGITALOUT = 10; (* Brooktree PCM Wave out with subcode information *) - MM_BTV_MIDIWAVESTREAM = 11; (* Brooktree WaveStream *) - MM_BTV_MIXER = 12; (* Brooktree WSS Mixer driver *) - -(* Product IDs for MM_CANAM - CANAM Computers *) - MM_CANAM_CBXWAVEOUT = 1; - MM_CANAM_CBXWAVEIN = 2; - -(* Product IDs for MM_CASIO - Casio Computer Co., LTD *) - MM_CASIO_WP150_MIDIOUT = 1; (* wp150 *) - MM_CASIO_WP150_MIDIIN = 2; - -(* Product IDs for MM_COMPAQ - Compaq Computer Corp. *) - MM_COMPAQ_BB_WAVEIN = 1; - MM_COMPAQ_BB_WAVEOUT = 2; - MM_COMPAQ_BB_WAVEAUX = 3; - -(* Product IDs for MM_COREDYNAMICS - Core Dynamics *) - MM_COREDYNAMICS_DYNAMIXHR = 1; (* DynaMax Hi-Rez *) - MM_COREDYNAMICS_DYNASONIX_SYNTH = 2; (* DynaSonix *) - MM_COREDYNAMICS_DYNASONIX_MIDI_IN = 3; - MM_COREDYNAMICS_DYNASONIX_MIDI_OUT= 4; - MM_COREDYNAMICS_DYNASONIX_WAVE_IN = 5; - MM_COREDYNAMICS_DYNASONIX_WAVE_OUT= 6; - MM_COREDYNAMICS_DYNASONIX_AUDIO_IN= 7; - MM_COREDYNAMICS_DYNASONIX_AUDIO_OUT = 8; - MM_COREDYNAMICS_DYNAGRAFX_VGA = 9; (* DynaGrfx *) - MM_COREDYNAMICS_DYNAGRAFX_WAVE_IN = 10; - MM_COREDYNAMICS_DYNAGRAFX_WAVE_OUT= 11; - -(* Product IDs for MM_CRYSTAL - Crystal Semiconductor Corporation *) - MM_CRYSTAL_CS4232_WAVEIN = 1; - MM_CRYSTAL_CS4232_WAVEOUT = 2; - MM_CRYSTAL_CS4232_WAVEMIXER = 3; - MM_CRYSTAL_CS4232_WAVEAUX_AUX1 = 4; - MM_CRYSTAL_CS4232_WAVEAUX_AUX2 = 5; - MM_CRYSTAL_CS4232_WAVEAUX_LINE = 6; - MM_CRYSTAL_CS4232_WAVEAUX_MONO = 7; - MM_CRYSTAL_CS4232_WAVEAUX_MASTER = 8; - MM_CRYSTAL_CS4232_MIDIIN = 9; - MM_CRYSTAL_CS4232_MIDIOUT = 10; - MM_CRYSTAL_CS4232_INPUTGAIN_AUX1 = 13; - MM_CRYSTAL_CS4232_INPUTGAIN_LOOP = 14; - -(* Product IDs for MM_DDD - Danka Data Devices *) - MM_DDD_MIDILINK_MIDIIN = 1; - MM_DDD_MIDILINK_MIDIOUT = 2; - -(* Product IDs for MM_DIACOUSTICS - DiAcoustics, Inc. *) - MM_DIACOUSTICS_DRUM_ACTION = 1; (* Drum Action *) - -(* Product IDs for MM_DIAMONDMM - Diamond Multimedia *) - MM_DIMD_PLATFORM = 0; (* Freedom Audio *) - MM_DIMD_DIRSOUND = 1; - MM_DIMD_VIRTMPU = 2; - MM_DIMD_VIRTSB = 3; - MM_DIMD_VIRTJOY = 4; - MM_DIMD_WAVEIN = 5; - MM_DIMD_WAVEOUT = 6; - MM_DIMD_MIDIIN = 7; - MM_DIMD_MIDIOUT = 8; - MM_DIMD_AUX_LINE = 9; - MM_DIMD_MIXER = 10; - -(* Product IDs for MM_DIGITAL_AUDIO_LABS - Digital Audio Labs, Inc. *) - MM_DIGITAL_AUDIO_LABS_V8 = $10; - MM_DIGITAL_AUDIO_LABS_CPRO = $11; - -(* Product IDs for MM_DIGITAL - Digital Equipment Corporation *) - MM_DIGITAL_AV320_WAVEIN = 1; (* Digital Audio Video Compression Board *) - MM_DIGITAL_AV320_WAVEOUT = 2; (* Digital Audio Video Compression Board *) - -(* Product IDs for MM_ECS - Electronic Courseware Systems, Inc. *) - MM_ECS_AADF_MIDI_IN = 10; - MM_ECS_AADF_MIDI_OUT = 11; - MM_ECS_AADF_WAVE2MIDI_IN = 12; - -(* Product IDs for MM_ENSONIQ - ENSONIQ Corporation *) - MM_ENSONIQ_SOUNDSCAPE = $10; (* ENSONIQ Soundscape *) - MM_SOUNDSCAPE_WAVEOUT = MM_ENSONIQ_SOUNDSCAPE+1; - MM_SOUNDSCAPE_WAVEOUT_AUX = MM_ENSONIQ_SOUNDSCAPE+2; - MM_SOUNDSCAPE_WAVEIN = MM_ENSONIQ_SOUNDSCAPE+3; - MM_SOUNDSCAPE_MIDIOUT = MM_ENSONIQ_SOUNDSCAPE+4; - MM_SOUNDSCAPE_MIDIIN = MM_ENSONIQ_SOUNDSCAPE+5; - MM_SOUNDSCAPE_SYNTH = MM_ENSONIQ_SOUNDSCAPE+6; - MM_SOUNDSCAPE_MIXER = MM_ENSONIQ_SOUNDSCAPE+7; - MM_SOUNDSCAPE_AUX = MM_ENSONIQ_SOUNDSCAPE+8; - -(* Product IDs for MM_FRONTIER - Frontier Design Group LLC *) - MM_FRONTIER_WAVECENTER_MIDIIN = 1; (* WaveCenter *) - MM_FRONTIER_WAVECENTER_MIDIOUT = 2; - MM_FRONTIER_WAVECENTER_WAVEIN = 3; - MM_FRONTIER_WAVECENTER_WAVEOUT = 4; - -(* Product IDs for MM_GADGETLABS - Gadget Labs LLC *) - MM_GADGETLABS_WAVE44_WAVEIN = 1; - MM_GADGETLABS_WAVE44_WAVEOUT = 2; - MM_GADGETLABS_WAVE42_WAVEIN = 3; - MM_GADGETLABS_WAVE42_WAVEOUT = 4; - MM_GADGETLABS_WAVE4_MIDIIN = 5; - MM_GADGETLABS_WAVE4_MIDIOUT = 6; - -(* Product IDs for MM_KAY_ELEMETRICS - Kay Elemetrics, Inc. *) - MM_KAY_ELEMETRICS_CSL = $4300; - MM_KAY_ELEMETRICS_CSL_DAT = $4308; - MM_KAY_ELEMETRICS_CSL_4CHANNEL = $4309; - -(* Product IDs for MM_LERNOUT_AND_HAUSPIE - Lernout & Hauspie *) - MM_LERNOUT_ANDHAUSPIE_LHCODECACM = 1; - -(* Product IDs for MM_MPTUS - M.P. Technologies, Inc. *) - MM_MPTUS_SPWAVEOUT = 1; (* Sound Pallette *) - -(* Product IDs for MM_MOTU - Mark of the Unicorn *) - MM_MOTU_MTP_MIDIOUT_ALL = 100; - MM_MOTU_MTP_MIDIIN_1 = 101; - MM_MOTU_MTP_MIDIOUT_1 = 101; - MM_MOTU_MTP_MIDIIN_2 = 102; - MM_MOTU_MTP_MIDIOUT_2 = 102; - MM_MOTU_MTP_MIDIIN_3 = 103; - MM_MOTU_MTP_MIDIOUT_3 = 103; - MM_MOTU_MTP_MIDIIN_4 = 104; - MM_MOTU_MTP_MIDIOUT_4 = 104; - MM_MOTU_MTP_MIDIIN_5 = 105; - MM_MOTU_MTP_MIDIOUT_5 = 105; - MM_MOTU_MTP_MIDIIN_6 = 106; - MM_MOTU_MTP_MIDIOUT_6 = 106; - MM_MOTU_MTP_MIDIIN_7 = 107; - MM_MOTU_MTP_MIDIOUT_7 = 107; - MM_MOTU_MTP_MIDIIN_8 = 108; - MM_MOTU_MTP_MIDIOUT_8 = 108; - - MM_MOTU_MTPII_MIDIOUT_ALL = 200; - MM_MOTU_MTPII_MIDIIN_SYNC = 200; - MM_MOTU_MTPII_MIDIIN_1 = 201; - MM_MOTU_MTPII_MIDIOUT_1 = 201; - MM_MOTU_MTPII_MIDIIN_2 = 202; - MM_MOTU_MTPII_MIDIOUT_2 = 202; - MM_MOTU_MTPII_MIDIIN_3 = 203; - MM_MOTU_MTPII_MIDIOUT_3 = 203; - MM_MOTU_MTPII_MIDIIN_4 = 204; - MM_MOTU_MTPII_MIDIOUT_4 = 204; - MM_MOTU_MTPII_MIDIIN_5 = 205; - MM_MOTU_MTPII_MIDIOUT_5 = 205; - MM_MOTU_MTPII_MIDIIN_6 = 206; - MM_MOTU_MTPII_MIDIOUT_6 = 206; - MM_MOTU_MTPII_MIDIIN_7 = 207; - MM_MOTU_MTPII_MIDIOUT_7 = 207; - MM_MOTU_MTPII_MIDIIN_8 = 208; - MM_MOTU_MTPII_MIDIOUT_8 = 208; - MM_MOTU_MTPII_NET_MIDIIN_1 = 209; - MM_MOTU_MTPII_NET_MIDIOUT_1 = 209; - MM_MOTU_MTPII_NET_MIDIIN_2 = 210; - MM_MOTU_MTPII_NET_MIDIOUT_2 = 210; - MM_MOTU_MTPII_NET_MIDIIN_3 = 211; - MM_MOTU_MTPII_NET_MIDIOUT_3 = 211; - MM_MOTU_MTPII_NET_MIDIIN_4 = 212; - MM_MOTU_MTPII_NET_MIDIOUT_4 = 212; - MM_MOTU_MTPII_NET_MIDIIN_5 = 213; - MM_MOTU_MTPII_NET_MIDIOUT_5 = 213; - MM_MOTU_MTPII_NET_MIDIIN_6 = 214; - MM_MOTU_MTPII_NET_MIDIOUT_6 = 214; - MM_MOTU_MTPII_NET_MIDIIN_7 = 215; - MM_MOTU_MTPII_NET_MIDIOUT_7 = 215; - MM_MOTU_MTPII_NET_MIDIIN_8 = 216; - MM_MOTU_MTPII_NET_MIDIOUT_8 = 216; - - MM_MOTU_MXP_MIDIIN_MIDIOUT_ALL = 300; - MM_MOTU_MXP_MIDIIN_SYNC = 300; - MM_MOTU_MXP_MIDIIN_MIDIIN_1 = 301; - MM_MOTU_MXP_MIDIIN_MIDIOUT_1 = 301; - MM_MOTU_MXP_MIDIIN_MIDIIN_2 = 302; - MM_MOTU_MXP_MIDIIN_MIDIOUT_2 = 302; - MM_MOTU_MXP_MIDIIN_MIDIIN_3 = 303; - MM_MOTU_MXP_MIDIIN_MIDIOUT_3 = 303; - MM_MOTU_MXP_MIDIIN_MIDIIN_4 = 304; - MM_MOTU_MXP_MIDIIN_MIDIOUT_4 = 304; - MM_MOTU_MXP_MIDIIN_MIDIIN_5 = 305; - MM_MOTU_MXP_MIDIIN_MIDIOUT_5 = 305; - MM_MOTU_MXP_MIDIIN_MIDIIN_6 = 306; - MM_MOTU_MXP_MIDIIN_MIDIOUT_6 = 306; - - MM_MOTU_MXPMPU_MIDIOUT_ALL = 400; - MM_MOTU_MXPMPU_MIDIIN_SYNC = 400; - MM_MOTU_MXPMPU_MIDIIN_1 = 401; - MM_MOTU_MXPMPU_MIDIOUT_1 = 401; - MM_MOTU_MXPMPU_MIDIIN_2 = 402; - MM_MOTU_MXPMPU_MIDIOUT_2 = 402; - MM_MOTU_MXPMPU_MIDIIN_3 = 403; - MM_MOTU_MXPMPU_MIDIOUT_3 = 403; - MM_MOTU_MXPMPU_MIDIIN_4 = 404; - MM_MOTU_MXPMPU_MIDIOUT_4 = 404; - MM_MOTU_MXPMPU_MIDIIN_5 = 405; - MM_MOTU_MXPMPU_MIDIOUT_5 = 405; - MM_MOTU_MXPMPU_MIDIIN_6 = 406; - MM_MOTU_MXPMPU_MIDIOUT_6 = 406; - - MM_MOTU_MXN_MIDIOUT_ALL = 500; - MM_MOTU_MXN_MIDIIN_SYNC = 500; - MM_MOTU_MXN_MIDIIN_1 = 501; - MM_MOTU_MXN_MIDIOUT_1 = 501; - MM_MOTU_MXN_MIDIIN_2 = 502; - MM_MOTU_MXN_MIDIOUT_2 = 502; - MM_MOTU_MXN_MIDIIN_3 = 503; - MM_MOTU_MXN_MIDIOUT_3 = 503; - MM_MOTU_MXN_MIDIIN_4 = 504; - MM_MOTU_MXN_MIDIOUT_4 = 504; - - MM_MOTU_FLYER_MIDI_IN_SYNC = 600; - MM_MOTU_FLYER_MIDI_IN_A = 601; - MM_MOTU_FLYER_MIDI_OUT_A = 601; - MM_MOTU_FLYER_MIDI_IN_B = 602; - MM_MOTU_FLYER_MIDI_OUT_B = 602; - - MM_MOTU_PKX_MIDI_IN_SYNC = 700; - MM_MOTU_PKX_MIDI_IN_A = 701; - MM_MOTU_PKX_MIDI_OUT_A = 701; - MM_MOTU_PKX_MIDI_IN_B = 702; - MM_MOTU_PKX_MIDI_OUT_B = 702; - - MM_MOTU_DTX_MIDI_IN_SYNC = 800; - MM_MOTU_DTX_MIDI_IN_A = 801; - MM_MOTU_DTX_MIDI_OUT_A = 801; - MM_MOTU_DTX_MIDI_IN_B = 802; - MM_MOTU_DTX_MIDI_OUT_B = 802; - - MM_MOTU_MTPAV_MIDIOUT_ALL = 900; - MM_MOTU_MTPAV_MIDIIN_SYNC = 900; - MM_MOTU_MTPAV_MIDIIN_1 = 901; - MM_MOTU_MTPAV_MIDIOUT_1 = 901; - MM_MOTU_MTPAV_MIDIIN_2 = 902; - MM_MOTU_MTPAV_MIDIOUT_2 = 902; - MM_MOTU_MTPAV_MIDIIN_3 = 903; - MM_MOTU_MTPAV_MIDIOUT_3 = 903; - MM_MOTU_MTPAV_MIDIIN_4 = 904; - MM_MOTU_MTPAV_MIDIOUT_4 = 904; - MM_MOTU_MTPAV_MIDIIN_5 = 905; - MM_MOTU_MTPAV_MIDIOUT_5 = 905; - MM_MOTU_MTPAV_MIDIIN_6 = 906; - MM_MOTU_MTPAV_MIDIOUT_6 = 906; - MM_MOTU_MTPAV_MIDIIN_7 = 907; - MM_MOTU_MTPAV_MIDIOUT_7 = 907; - MM_MOTU_MTPAV_MIDIIN_8 = 908; - MM_MOTU_MTPAV_MIDIOUT_8 = 908; - MM_MOTU_MTPAV_NET_MIDIIN_1 = 909; - MM_MOTU_MTPAV_NET_MIDIOUT_1 = 909; - MM_MOTU_MTPAV_NET_MIDIIN_2 = 910; - MM_MOTU_MTPAV_NET_MIDIOUT_2 = 910; - MM_MOTU_MTPAV_NET_MIDIIN_3 = 911; - MM_MOTU_MTPAV_NET_MIDIOUT_3 = 911; - MM_MOTU_MTPAV_NET_MIDIIN_4 = 912; - MM_MOTU_MTPAV_NET_MIDIOUT_4 = 912; - MM_MOTU_MTPAV_NET_MIDIIN_5 = 913; - MM_MOTU_MTPAV_NET_MIDIOUT_5 = 913; - MM_MOTU_MTPAV_NET_MIDIIN_6 = 914; - MM_MOTU_MTPAV_NET_MIDIOUT_6 = 914; - MM_MOTU_MTPAV_NET_MIDIIN_7 = 915; - MM_MOTU_MTPAV_NET_MIDIOUT_7 = 915; - MM_MOTU_MTPAV_NET_MIDIIN_8 = 916; - MM_MOTU_MTPAV_NET_MIDIOUT_8 = 916; - MM_MOTU_MTPAV_MIDIIN_ADAT = 917; - MM_MOTU_MTPAV_MIDIOUT_ADAT = 917; - - -(* Product IDs for MM_MIRO - miro Computer Products AG *) - MM_MIRO_MOVIEPRO = 1; (* miroMOVIE pro *) - MM_MIRO_VIDEOD1 = 2; (* miroVIDEO D1 *) - MM_MIRO_VIDEODC1TV = 3; (* miroVIDEO DC1 tv *) - MM_MIRO_VIDEOTD = 4; (* miroVIDEO 10/20 TD *) - MM_MIRO_DC30_WAVEOUT = 5; - MM_MIRO_DC30_WAVEIN = 6; - MM_MIRO_DC30_MIX = 7; - -(* Product IDs for MM_NEC - NEC *) - MM_NEC_73_86_SYNTH = 5; - MM_NEC_73_86_WAVEOUT = 6; - MM_NEC_73_86_WAVEIN = 7; - MM_NEC_26_SYNTH = 9; - MM_NEC_MPU401_MIDIOUT = 10; - MM_NEC_MPU401_MIDIIN = 11; - MM_NEC_JOYSTICK = 12; - -(* Product IDs for MM_NORRIS - Norris Communications, Inc. *) - MM_NORRIS_VOICELINK = 1; - -(* Product IDs for MM_NORTHERN_TELECOM - Northern Telecom Limited *) - MM_NORTEL_MPXAC_WAVEIN = 1; (* MPX Audio Card Wave Input Device *) - MM_NORTEL_MPXAC_WAVEOUT = 2; (* MPX Audio Card Wave Output Device *) - -(* Product IDs for MM_NVIDIA - NVidia Corporation *) - MM_NVIDIA_WAVEOUT = 1; - MM_NVIDIA_WAVEIN = 2; - MM_NVIDIA_MIDIOUT = 3; - MM_NVIDIA_MIDIIN = 4; - MM_NVIDIA_GAMEPORT = 5; - MM_NVIDIA_MIXER = 6; - MM_NVIDIA_AUX = 7; - -(* Product IDs for MM_OKSORI - OKSORI Co., Ltd. *) - MM_OKSORI_BASE = 0; (* Oksori Base *) - MM_OKSORI_OSR8_WAVEOUT = MM_OKSORI_BASE+1; (* Oksori 8bit Wave out *) - MM_OKSORI_OSR8_WAVEIN = MM_OKSORI_BASE+2; (* Oksori 8bit Wave in *) - MM_OKSORI_OSR16_WAVEOUT = MM_OKSORI_BASE+3; (* Oksori 16 bit Wave out *) - MM_OKSORI_OSR16_WAVEIN = MM_OKSORI_BASE+4; (* Oksori 16 bit Wave in *) - MM_OKSORI_FM_OPL4 = MM_OKSORI_BASE+5; (* Oksori FM Synth Yamaha OPL4 *) - MM_OKSORI_MIX_MASTER = MM_OKSORI_BASE+6; (* Oksori DSP Mixer - Master Volume *) - MM_OKSORI_MIX_WAVE = MM_OKSORI_BASE+7; (* Oksori DSP Mixer - Wave Volume *) - MM_OKSORI_MIX_FM = MM_OKSORI_BASE+8; (* Oksori DSP Mixer - FM Volume *) - MM_OKSORI_MIX_LINE = MM_OKSORI_BASE+9; (* Oksori DSP Mixer - Line Volume *) - MM_OKSORI_MIX_CD = MM_OKSORI_BASE+10; (* Oksori DSP Mixer - CD Volume *) - MM_OKSORI_MIX_MIC = MM_OKSORI_BASE+11; (* Oksori DSP Mixer - MIC Volume *) - MM_OKSORI_MIX_ECHO = MM_OKSORI_BASE+12; (* Oksori DSP Mixer - Echo Volume *) - MM_OKSORI_MIX_AUX1 = MM_OKSORI_BASE+13; (* Oksori AD1848 - AUX1 Volume *) - MM_OKSORI_MIX_LINE1 = MM_OKSORI_BASE+14; (* Oksori AD1848 - LINE1 Volume *) - MM_OKSORI_EXT_MIC1 = MM_OKSORI_BASE+15; (* Oksori External - One Mic Connect *) - MM_OKSORI_EXT_MIC2 = MM_OKSORI_BASE+16; (* Oksori External - Two Mic Connect *) - MM_OKSORI_MIDIOUT = MM_OKSORI_BASE+17; (* Oksori MIDI Out Device *) - MM_OKSORI_MIDIIN = MM_OKSORI_BASE+18; (* Oksori MIDI In Device *) - MM_OKSORI_MPEG_CDVISION = MM_OKSORI_BASE+19; (* Oksori CD-Vision MPEG Decoder *) - -(* Product IDs for MM_OSITECH - Ositech Communications Inc. *) - MM_OSITECH_TRUMPCARD = 1; (* Trumpcard *) - -(* Product IDs for MM_OSPREY - Osprey Technologies, Inc. *) - MM_OSPREY_1000WAVEIN = 1; - MM_OSPREY_1000WAVEOUT = 2; - -(* Product IDs for MM_QUARTERDECK - Quarterdeck Corporation *) - MM_QUARTERDECK_LHWAVEIN = 0; (* Quarterdeck L&H Codec Wave In *) - MM_QUARTERDECK_LHWAVEOUT = 1; (* Quarterdeck L&H Codec Wave Out *) - -(* Product IDs for MM_RHETOREX - Rhetorex Inc *) - MM_RHETOREX_WAVEIN = 1; - MM_RHETOREX_WAVEOUT = 2; - -(* Product IDs for MM_ROCKWELL - Rockwell International *) - MM_VOICEMIXER = 1; - ROCKWELL_WA1_WAVEIN = 100; - ROCKWELL_WA1_WAVEOUT = 101; - ROCKWELL_WA1_SYNTH = 102; - ROCKWELL_WA1_MIXER = 103; - ROCKWELL_WA1_MPU401_IN = 104; - ROCKWELL_WA1_MPU401_OUT = 105; - ROCKWELL_WA2_WAVEIN = 200; - ROCKWELL_WA2_WAVEOUT = 201; - ROCKWELL_WA2_SYNTH = 202; - ROCKWELL_WA2_MIXER = 203; - ROCKWELL_WA2_MPU401_IN = 204; - ROCKWELL_WA2_MPU401_OUT = 205; - -(* Product IDs for MM_S3 - S3 *) - MM_S3_WAVEOUT = $1; - MM_S3_WAVEIN = $2; - MM_S3_MIDIOUT = $3; - MM_S3_MIDIIN = $4; - MM_S3_FMSYNTH = $5; - MM_S3_MIXER = $6; - MM_S3_AUX = $7; - -(* Product IDs for MM_SEERSYS - Seer Systems, Inc. *) - MM_SEERSYS_SEERSYNTH = 1; - MM_SEERSYS_SEERWAVE = 2; - MM_SEERSYS_SEERMIX = 3; - -(* Product IDs for MM_SOFTSOUND - Softsound, Ltd. *) - MM_SOFTSOUND_CODEC = 1; - -(* Product IDs for MM_SOUNDESIGNS - SounDesignS M.C.S. Ltd. *) - MM_SOUNDESIGNS_WAVEIN = 1; - MM_SOUNDESIGNS_WAVEOUT = 2; - -(* Product IDs for MM_SPECTRUM_SIGNAL_PROCESSING - Spectrum Signal Processing, Inc. *) - MM_SSP_SNDFESWAVEIN = 1; (* Sound Festa Wave In Device *) - MM_SSP_SNDFESWAVEOUT = 2; (* Sound Festa Wave Out Device *) - MM_SSP_SNDFESMIDIIN = 3; (* Sound Festa MIDI In Device *) - MM_SSP_SNDFESMIDIOUT = 4; (* Sound Festa MIDI Out Device *) - MM_SSP_SNDFESSYNTH = 5; (* Sound Festa MIDI Synth Device *) - MM_SSP_SNDFESMIX = 6; (* Sound Festa Mixer Device *) - MM_SSP_SNDFESAUX = 7; (* Sound Festa Auxilliary Device *) - -(* Product IDs for MM_TDK - TDK Corporation *) - MM_TDK_MW_MIDI_SYNTH = 1; - MM_TDK_MW_MIDI_IN = 2; - MM_TDK_MW_MIDI_OUT = 3; - MM_TDK_MW_WAVE_IN = 4; - MM_TDK_MW_WAVE_OUT = 5; - MM_TDK_MW_AUX = 6; - MM_TDK_MW_MIXER = 10; - MM_TDK_MW_AUX_MASTER = 100; - MM_TDK_MW_AUX_BASS = 101; - MM_TDK_MW_AUX_TREBLE = 102; - MM_TDK_MW_AUX_MIDI_VOL = 103; - MM_TDK_MW_AUX_WAVE_VOL = 104; - MM_TDK_MW_AUX_WAVE_RVB = 105; - MM_TDK_MW_AUX_WAVE_CHR = 106; - MM_TDK_MW_AUX_VOL = 107; - MM_TDK_MW_AUX_RVB = 108; - MM_TDK_MW_AUX_CHR = 109; - -(* Product IDs for MM_TURTLE_BEACH - Turtle Beach, Inc. *) - MM_TBS_TROPEZ_WAVEIN = 37; - MM_TBS_TROPEZ_WAVEOUT = 38; - MM_TBS_TROPEZ_AUX1 = 39; - MM_TBS_TROPEZ_AUX2 = 40; - MM_TBS_TROPEZ_LINE = 41; - -(* Product IDs for MM_VIENNASYS - Vienna Systems *) - MM_VIENNASYS_TSP_WAVE_DRIVER = 1; - -(* Product IDs for MM_VIONA - Viona Development GmbH *) - MM_VIONA_QVINPCI_MIXER = 1; (* Q-Motion PCI II/Bravado 2000 *) - MM_VIONA_QVINPCI_WAVEIN = 2; - MM_VIONAQVINPCI_WAVEOUT = 3; - MM_VIONA_BUSTER_MIXER = 4; (* Buster *) - MM_VIONA_CINEMASTER_MIXER = 5; (* Cinemaster *) - MM_VIONA_CONCERTO_MIXER = 6; (* Concerto *) - -(* Product IDs for MM_WILDCAT - Wildcat Canyon Software *) - MM_WILDCAT_AUTOSCOREMIDIIN = 1; (* Autoscore *) - -(* Product IDs for MM_WILLOWPOND - Willow Pond Corporation *) - MM_WILLOWPOND_FMSYNTH_STEREO = 20; - MM_WILLOWPOND_SNDPORT_WAVEIN = 100; - MM_WILLOWPOND_SNDPORT_WAVEOUT = 101; - MM_WILLOWPOND_SNDPORT_MIXER = 102; - MM_WILLOWPOND_SNDPORT_AUX = 103; - MM_WILLOWPOND_PH_WAVEIN = 104; - MM_WILLOWPOND_PH_WAVEOUT = 105; - MM_WILLOWPOND_PH_MIXER = 106; - MM_WILLOWPOND_PH_AUX = 107; - -(* Product IDs for MM_WORKBIT - Workbit Corporation *) - MM_WORKBIT_MIXER = 1; (* Harmony Mixer *) - MM_WORKBIT_WAVEOUT = 2; (* Harmony Mixer *) - MM_WORKBIT_WAVEIN = 3; (* Harmony Mixer *) - MM_WORKBIT_MIDIIN = 4; (* Harmony Mixer *) - MM_WORKBIT_MIDIOUT = 5; (* Harmony Mixer *) - MM_WORKBIT_FMSYNTH = 6; (* Harmony Mixer *) - MM_WORKBIT_AUX = 7; (* Harmony Mixer *) - MM_WORKBIT_JOYSTICK = 8; - -(* Product IDs for MM_FRAUNHOFER_IIS - Fraunhofer *) - MM_FHGIIS_MPEGLAYER3 = 10; - -{(*)///////////////////////////////////////////////////////////////////////// *) - -(* INFO LIST CHUNKS (from the Multimedia Programmer's Reference - plus new ones) *) - RIFFINFO_IARL = mmioFOURCC ('I', 'A', 'R', 'L'); (*Archival location *) -#define RIFFINFO_IART mmioFOURCC ('I', 'A', 'R', 'T') (*Artist *) -#define RIFFINFO_ICMS mmioFOURCC ('I', 'C', 'M', 'S') (*Commissioned *) -#define RIFFINFO_ICMT mmioFOURCC ('I', 'C', 'M', 'T') (*Comments *) -#define RIFFINFO_ICOP mmioFOURCC ('I', 'C', 'O', 'P') (*Copyright *) -#define RIFFINFO_ICRD mmioFOURCC ('I', 'C', 'R', 'D') (*Creation date of subject *) -#define RIFFINFO_ICRP mmioFOURCC ('I', 'C', 'R', 'P') (*Cropped *) -#define RIFFINFO_IDIM mmioFOURCC ('I', 'D', 'I', 'M') (*Dimensions *) -#define RIFFINFO_IDPI mmioFOURCC ('I', 'D', 'P', 'I') (*Dots per inch *) -#define RIFFINFO_IENG mmioFOURCC ('I', 'E', 'N', 'G') (*Engineer *) -#define RIFFINFO_IGNR mmioFOURCC ('I', 'G', 'N', 'R') (*Genre *) -#define RIFFINFO_IKEY mmioFOURCC ('I', 'K', 'E', 'Y') (*Keywords *) -#define RIFFINFO_ILGT mmioFOURCC ('I', 'L', 'G', 'T') (*Lightness settings *) -#define RIFFINFO_IMED mmioFOURCC ('I', 'M', 'E', 'D') (*Medium *) -#define RIFFINFO_INAM mmioFOURCC ('I', 'N', 'A', 'M') (*Name of subject *) -#define RIFFINFO_IPLT mmioFOURCC ('I', 'P', 'L', 'T') (*Palette Settings. No. of colors requested. *) -#define RIFFINFO_IPRD mmioFOURCC ('I', 'P', 'R', 'D') (*Product *) -#define RIFFINFO_ISBJ mmioFOURCC ('I', 'S', 'B', 'J') (*Subject description *) -#define RIFFINFO_ISFT mmioFOURCC ('I', 'S', 'F', 'T') (*Software. Name of package used to create file. *) -#define RIFFINFO_ISHP mmioFOURCC ('I', 'S', 'H', 'P') (*Sharpness. *) -#define RIFFINFO_ISRC mmioFOURCC ('I', 'S', 'R', 'C') (*Source. *) -#define RIFFINFO_ISRF mmioFOURCC ('I', 'S', 'R', 'F') (*Source Form. ie slide, paper *) -#define RIFFINFO_ITCH mmioFOURCC ('I', 'T', 'C', 'H') (*Technician who digitized the subject. *) - -(* New INFO Chunks as of August 30, 1993: *) -#define RIFFINFO_ISMP mmioFOURCC ('I', 'S', 'M', 'P') (*SMPTE time code *) -(* ISMP: SMPTE time code of digitization start point expressed as a NULL terminated - text string "HH:MM:SS:FF". If performing MCI capture in AVICAP, this - chunk will be automatically set based on the MCI start time. -*) -#define RIFFINFO_IDIT mmioFOURCC ('I', 'D', 'I', 'T') (*Digitization Time *) -(* IDIT: "Digitization Time" Specifies the time and date that the digitization commenced. - The digitization time is contained in an ASCII string which - contains exactly 26 characters and is in the format - "Wed Jan 02 02:03:55 1990\n\0". - The ctime(), asctime(), functions can be used to create strings - in this format. This chunk is automatically added to the capture - file based on the current system time at the moment capture is initiated. -*) - -(*Template line for new additions*) -(*#define RIFFINFO_I mmioFOURCC ('I', '', '', '') *) } - - -(* WAVE form wFormatTag IDs *) - WAVE_FORMAT_UNKNOWN =$0000; (* Microsoft Corporation *) - WAVE_FORMAT_ADPCM =$0002; (* Microsoft Corporation *) - WAVE_FORMAT_IEEE_FLOAT =$0003; (* Microsoft Corporation *) - (* IEEE754: range (+1, -1] *) - (* 32-bit/64-bit format as defined by *) - (* MSVC++ float/double type *) - WAVE_FORMAT_IBM_CVSD =$0005; (* IBM Corporation *) - WAVE_FORMAT_ALAW =$0006; (* Microsoft Corporation *) - WAVE_FORMAT_MULAW =$0007; (* Microsoft Corporation *) - WAVE_FORMAT_OKI_ADPCM =$0010; (* OKI *) - WAVE_FORMAT_DVI_ADPCM =$0011; (* Intel Corporation *) - WAVE_FORMAT_IMA_ADPCM =(WAVE_FORMAT_DVI_ADPCM); (* Intel Corporation *) - WAVE_FORMAT_MEDIASPACE_ADPCM =$0012; (* Videologic *) - WAVE_FORMAT_SIERRA_ADPCM =$0013; (* Sierra Semiconductor Corp *) - WAVE_FORMAT_G723_ADPCM =$0014; (* Antex Electronics Corporation *) - WAVE_FORMAT_DIGISTD =$0015; (* DSP Solutions, Inc. *) - WAVE_FORMAT_DIGIFIX =$0016; (* DSP Solutions, Inc. *) - WAVE_FORMAT_DIALOGIC_OKI_ADPCM =$0017; (* Dialogic Corporation *) - WAVE_FORMAT_MEDIAVISION_ADPCM =$0018; (* Media Vision, Inc. *) - WAVE_FORMAT_YAMAHA_ADPCM =$0020; (* Yamaha Corporation of America *) - WAVE_FORMAT_SONARC =$0021; (* Speech Compression *) - WAVE_FORMAT_DSPGROUP_TRUESPEECH =$0022; (* DSP Group, Inc *) - WAVE_FORMAT_ECHOSC1 =$0023; (* Echo Speech Corporation *) - WAVE_FORMAT_AUDIOFILE_AF36 =$0024; (* *) - WAVE_FORMAT_APTX =$0025; (* Audio Processing Technology *) - WAVE_FORMAT_AUDIOFILE_AF10 =$0026; (* *) - WAVE_FORMAT_DOLBY_AC2 =$0030; (* Dolby Laboratories *) - WAVE_FORMAT_GSM610 =$0031; (* Microsoft Corporation *) - WAVE_FORMAT_MSNAUDIO =$0032; (* Microsoft Corporation *) - WAVE_FORMAT_ANTEX_ADPCME =$0033; (* Antex Electronics Corporation *) - WAVE_FORMAT_CONTROL_RES_VQLPC =$0034; (* Control Resources Limited *) - WAVE_FORMAT_DIGIREAL =$0035; (* DSP Solutions, Inc. *) - WAVE_FORMAT_DIGIADPCM =$0036; (* DSP Solutions, Inc. *) - WAVE_FORMAT_CONTROL_RES_CR10 =$0037; (* Control Resources Limited *) - WAVE_FORMAT_NMS_VBXADPCM =$0038; (* Natural MicroSystems *) - WAVE_FORMAT_CS_IMAADPCM =$0039; (* Crystal Semiconductor IMA ADPCM *) - WAVE_FORMAT_ECHOSC3 =$003A; (* Echo Speech Corporation *) - WAVE_FORMAT_ROCKWELL_ADPCM =$003B; (* Rockwell International *) - WAVE_FORMAT_ROCKWELL_DIGITALK =$003C; (* Rockwell International *) - WAVE_FORMAT_XEBEC =$003D; (* Xebec Multimedia Solutions Limited *) - WAVE_FORMAT_G721_ADPCM =$0040; (* Antex Electronics Corporation *) - WAVE_FORMAT_G728_CELP =$0041; (* Antex Electronics Corporation *) - WAVE_FORMAT_MPEG =$0050; (* Microsoft Corporation *) - WAVE_FORMAT_MPEGLAYER3 =$0055; (* ISO/MPEG Layer3 Format Tag *) - WAVE_FORMAT_CIRRUS =$0060; (* Cirrus Logic *) - WAVE_FORMAT_ESPCM =$0061; (* ESS Technology *) - WAVE_FORMAT_VOXWARE =$0062; (* Voxware Inc *) - WAVEFORMAT_CANOPUS_ATRAC =$0063; (* Canopus, co., Ltd. *) - WAVE_FORMAT_G726_ADPCM =$0064; (* APICOM *) - WAVE_FORMAT_G722_ADPCM =$0065; (* APICOM *) - WAVE_FORMAT_DSAT =$0066; (* Microsoft Corporation *) - WAVE_FORMAT_DSAT_DISPLAY =$0067; (* Microsoft Corporation *) - WAVE_FORMAT_SOFTSOUND =$0080; (* Softsound, Ltd. *) - WAVE_FORMAT_RHETOREX_ADPCM =$0100; (* Rhetorex Inc *) - WAVE_FORMAT_CREATIVE_ADPCM =$0200; (* Creative Labs, Inc *) - WAVE_FORMAT_CREATIVE_FASTSPEECH8 =$0202; (* Creative Labs, Inc *) - WAVE_FORMAT_CREATIVE_FASTSPEECH10 =$0203; (* Creative Labs, Inc *) - WAVE_FORMAT_QUARTERDECK =$0220; (* Quarterdeck Corporation *) - WAVE_FORMAT_FM_TOWNS_SND =$0300; (* Fujitsu Corp. *) - WAVE_FORMAT_BTV_DIGITAL =$0400; (* Brooktree Corporation *) - WAVE_FORMAT_OLIGSM =$1000; (* Ing C. Olivetti & C., S.p.A. *) - WAVE_FORMAT_OLIADPCM =$1001; (* Ing C. Olivetti & C., S.p.A. *) - WAVE_FORMAT_OLICELP =$1002; (* Ing C. Olivetti & C., S.p.A. *) - WAVE_FORMAT_OLISBC =$1003; (* Ing C. Olivetti & C., S.p.A. *) - WAVE_FORMAT_OLIOPR =$1004; (* Ing C. Olivetti & C., S.p.A. *) - WAVE_FORMAT_LH_CODEC =$1100; (* Lernout & Hauspie *) - WAVE_FORMAT_NORRIS =$1400; (* Norris Communications, Inc. *) - -// -// the WAVE_FORMAT_DEVELOPMENT format tag can be used during the -// development phase of a new wave format. Before shipping, you MUST -// acquire an official format tag from Microsoft. -// - WAVE_FORMAT_DEVELOPMENT = ($FFFF); - - - ACM_MPEG_LAYER1 =($0001); - ACM_MPEG_LAYER2 =($0002); - ACM_MPEG_LAYER3 =($0004); - ACM_MPEG_STEREO =($0001); - ACM_MPEG_JOINTSTEREO =($0002); - ACM_MPEG_DUALCHANNEL =($0004); - ACM_MPEG_SINGLECHANNEL =($0008); - ACM_MPEG_PRIVATEBIT =($0001); - ACM_MPEG_COPYRIGHT =($0002); - ACM_MPEG_ORIGINALHOME =($0004); - ACM_MPEG_PROTECTIONBIT =($0008); - ACM_MPEG_ID_MPEG1 =($0010); - -// -// MPEG Layer3 WAVEFORMATEX structure -// for WAVE_FORMAT_MPEGLAYER3 ($0055) -// - MPEGLAYER3_WFX_EXTRA_BYTES = 12; - - MPEGLAYER3_ID_UNKNOWN = 0; - MPEGLAYER3_ID_MPEG = 1; - MPEGLAYER3_ID_CONSTANTFRAMESIZE = 2; - - MPEGLAYER3_FLAG_PADDING_ISO = $00000000; - MPEGLAYER3_FLAG_PADDING_ON = $00000001; - MPEGLAYER3_FLAG_PADDING_OFF = $00000002; - - WAVE_FILTER_UNKNOWN = $0000; - WAVE_FILTER_DEVELOPMENT =($FFFF); - - WAVE_FILTER_VOLUME = $0001; - WAVE_FILTER_ECHO = $0002; - - BI_BITFIELDS = 3; - - QUERYDIBSUPPORT = 3073; - QDI_SETDIBITS = $0001; - QDI_GETDIBITS = $0002; - QDI_DIBTOSCREEN = $0004; - QDI_STRETCHDIB = $0008; - - JPEG_PROCESS_BASELINE = 0; (* Baseline DCT *) - - -(* -// -// Microsoft MPEG audio WAV definition -// - MPEG-1 audio wave format (audio layer only). (0x0050) *) -type - PMPEG1WAVEFORMAT = ^MPEG1WAVEFORMAT; - mpeg1waveformat_tag = record - wfx: tWAVEFORMATEX; - fwHeadLayer: word; - dwHeadBitrate: dword; - fwHeadMode: word; - fwHeadModeExt: word; - wHeadEmphasis: word; - fwHeadFlags: word; - dwPTSLow: dword; - dwPTSHigh: dword; - end; - MPEG1WAVEFORMAT = mpeg1waveformat_tag; - -(* -// MPEG Layer3 WAVEFORMATEX structure -// for WAVE_FORMAT_MPEGLAYER3 (0x0055) -// -#define MPEGLAYER3_WFX_EXTRA_BYTES 12 - -// WAVE_FORMAT_MPEGLAYER3 format sructure *) - PMPEGLAYER3WAVEFORMAT = ^MPEGLAYER3WAVEFORMAT; - mpeglayer3waveformat_tag = record - wfx: tWAVEFORMATEX; - wID: word; - fdwFlags: dword; - nBlockSize: word; - nFramesPerBlock: word; - nCodecDelay: word; - end; - MPEGLAYER3WAVEFORMAT = mpeglayer3waveformat_tag; - -implementation - -end. diff --git a/Game/Code/lib/ffmpeg/opt.pas b/Game/Code/lib/ffmpeg/opt.pas index bd3f14fd..971ce601 100644 --- a/Game/Code/lib/ffmpeg/opt.pas +++ b/Game/Code/lib/ffmpeg/opt.pas @@ -15,24 +15,30 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*) -(* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. -For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT -in the source codes *) + *) + +(* This is a part of Pascal porting of ffmpeg. + * Originally by Victor Zinetz for Delphi and Free Pascal on Windows. + * For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT + * in the source codes *) + +// Revision: 11250 unit opt; + {$IFDEF FPC} - {$MODE DELPHI} (* CAT *) - {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) - {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) + {$MODE DELPHI} + {$PACKENUM 4} (* use 4-byte enums *) + {$PACKRECORDS C} (* C/C++-compatible record packing *) +{$ELSE} + {$MINENUMSIZE 4} (* use 4-byte enums *) {$ENDIF} interface uses - rational; (* CAT *) - -{$I version.inc} + rational, + UConfig; type TAVOptionType = ( @@ -43,6 +49,7 @@ type FF_OPT_TYPE_FLOAT, FF_OPT_TYPE_STRING, FF_OPT_TYPE_RATIONAL, + FF_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length FF_OPT_TYPE_CONST = 128 ); @@ -55,12 +62,20 @@ const AV_OPT_FLAG_SUBTITLE_PARAM = 32; type + (** + * AVOption. + *) PAVOption = ^TAVOption; TAVOption = record name: pchar; + + (** + * short English text help. + * @todo what about other languages + *) help: pchar; offset: integer; ///< offset to context structure where the parsed value should be stored - _type: TAVOptionType; + type_: TAVOptionType; default_val: double; min: double; @@ -68,9 +83,13 @@ type flags: integer; //FIXME think about enc-audio, ... style flags - _unit: pchar; + unit_: pchar; end; +{$IF LIBAVCODEC_VERSION >= 51039000} // 51.39.0 +function av_find_opt (obj: Pointer; {const} name: PChar; {const} unit_: PChar; mask: integer; flags: integer): {const} PAVOption; + cdecl; external av__codec; +{$IFEND} function av_set_string (obj: pointer; name: pchar; val: pchar): PAVOption; cdecl; external av__codec; @@ -105,6 +124,11 @@ function av_opt_show (obj: pointer; av_log_obj: pointer): integer; procedure av_opt_set_defaults (s: pointer); cdecl; external av__codec; +{$IF LIBAVCODEC_VERSION >= 51039000} // 51.39.0 +procedure av_opt_set_defaults2 (s: Pointer; mask: integer; flags: integer); + cdecl; external av__codec; +{$IFEND} + implementation end. diff --git a/Game/Code/lib/ffmpeg/rational.pas b/Game/Code/lib/ffmpeg/rational.pas index 86dbf8a4..14edb799 100644 --- a/Game/Code/lib/ffmpeg/rational.pas +++ b/Game/Code/lib/ffmpeg/rational.pas @@ -16,24 +16,33 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) -(* This is a part of Pascal porting of ffmpeg. Originally by Victor Zinetz for Delphi and Free Pascal on Windows. -For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT -in the source codes *) + +(* This is a part of Pascal porting of ffmpeg. + * Originally by Victor Zinetz for Delphi and Free Pascal on Windows. + * For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT + * in the source codes *) + +// Revision: 10765 unit rational; + {$IFDEF FPC} - {$MODE DELPHI} (* CAT *) - {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) - {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) + {$MODE DELPHI} + {$PACKENUM 4} (* use 4-byte enums *) + {$PACKRECORDS C} (* C/C++-compatible record packing *) +{$ELSE} + {$MINENUMSIZE 4} (* use 4-byte enums *) {$ENDIF} -interface (* unit windows is deleted by CAT *) +interface -{$I version.inc} +uses + UConfig; type (* - * Rational number num/den. *) + * Rational number num/den. + *) PAVRational = ^TAVRational; TAVRational = record num: integer; ///< numerator @@ -41,32 +50,75 @@ type end; (** - * returns 0 if a==b, 1 if a>b and -1 if ab and -1 if a 0 then Result := (tmp shr 63) or 1 (* fixed by CAT *) - else Result := 0 + if (tmp <> 0) then + Result := (tmp shr 63) or 1 + else + Result := 0 end; function av_q2d(a: TAVRational): double; diff --git a/Game/Code/lib/ffmpeg/swscale.pas b/Game/Code/lib/ffmpeg/swscale.pas index a1bbf04f..406ab4a9 100644 --- a/Game/Code/lib/ffmpeg/swscale.pas +++ b/Game/Code/lib/ffmpeg/swscale.pas @@ -1,204 +1,210 @@ -{ - * Copyright (C) 2001-2003 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -} -{ - * @file swscale.h - * @brief - * external api for the swscale stuff -} - -unit swscale; - -{$IFDEF FPC} - {$IFNDEF win32} - {$LINKLIB libavutil} - {$LINKLIB libswscale} - {$ENDIF} - {$MODE DELPHI } (* CAT *) - {$PACKENUM 4} (* every enum type variables uses 4 bytes, CAT *) - {$PACKRECORDS C} (* GCC compatible, Record Packing, CAT *) -{$ENDIF} - -interface - -uses - avutil; - -const -{$IFDEF win32} - sw__scale = 'swscale-0.dll'; -{$ELSE} - sw__scale = 'libswscale.so'; // .0.5.0 -{$ENDIF} - -type - TQuadIntArray = array[0..3] of integer; - PQuadIntArray = ^TQuadIntArray; - TIntArray = array[0..0] of integer; - PIntArray = ^TIntArray; - TPByteArray = array[0..0] of Pbyte; - PPByteArray = ^TPByteArray; - -const - LIBSWSCALE_VERSION_INT = ((0 shl 16)+(5 shl 8))+0; - LIBSWSCALE_VERSION = '0.5.0'; - LIBSWSCALE_BUILD = LIBSWSCALE_VERSION_INT; - - LIBSWSCALE_IDENT = 'SwS'+LIBSWSCALE_VERSION; - - {* values for the flags, the stuff on the command line is different *} - SWS_FAST_BILINEAR = 1; - SWS_BILINEAR = 2; - SWS_BICUBIC = 4; - SWS_X = 8; - SWS_POINT = $10; - SWS_AREA = $20; - SWS_BICUBLIN = $40; - SWS_GAUSS = $80; - SWS_SINC = $100; - SWS_LANCZOS = $200; - SWS_SPLINE = $400; - - SWS_SRC_V_CHR_DROP_MASK = $30000; - SWS_SRC_V_CHR_DROP_SHIFT = 16; - - SWS_PARAM_DEFAULT = 123456; - - SWS_PRINT_INFO = $1000; - - //the following 3 flags are not completely implemented - //internal chrominace subsampling info - SWS_FULL_CHR_H_INT = $2000; - //input subsampling info - SWS_FULL_CHR_H_INP = $4000; - SWS_DIRECT_BGR = $8000; - SWS_ACCURATE_RND = $40000; - - SWS_CPU_CAPS_MMX = $80000000; - SWS_CPU_CAPS_MMX2 = $20000000; - SWS_CPU_CAPS_3DNOW = $40000000; - SWS_CPU_CAPS_ALTIVEC = $10000000; - SWS_CPU_CAPS_BFIN = $01000000; - - SWS_MAX_REDUCE_CUTOFF = 0.002; - - SWS_CS_ITU709 = 1; - SWS_CS_FCC = 4; - SWS_CS_ITU601 = 5; - SWS_CS_ITU624 = 5; - SWS_CS_SMPTE170M = 5; - SWS_CS_SMPTE240M = 7; - SWS_CS_DEFAULT = 5; - - -type - - // when used for filters they must have an odd number of elements - // coeffs cannot be shared between vectors - PSwsVector = ^TSwsVector; - TSwsVector = record - coeff: Pdouble; - length: integer; - end; - - // vectors can be shared - PSwsFilter = ^TSwsFilter; - TSwsFilter = record - lumH: PSwsVector; - lumV: PSwsVector; - chrH: PSwsVector; - chrV: PSwsVector; - end; - - PSwsContext = ^TSwsContext; - TSwsContext = record - av_class: Pointer; - swScale: Pointer; - srxW,srcH, dstH: integer; - chrSrcW, chrSrcH, chrDstW, chrDstH: integer; - lumXInc, chrXInc, lumYInc, chrYInc: integer; - dstFormat, srcFormat, origDstFormat, origSrcFormat: integer; - chrSrcHSubSample, chrSrcVSubSample, chrIntHSubSample, chrIntVSubSample: integer; - chrDstHSubSample, chrDstVSubSample: integer; - vChrDrop, sliceDir: integer; - param: array[0..1] of double; - {internal structure} - end; - - -procedure sws_freeContext(swsContext: PSwsContext); - cdecl; external sw__scale; - -function sws_getContext(srcW: integer; srcH: integer; srcFormat: integer; dstW: integer; dstH: integer;dstFormat: integer; flags: integer; - srcFilter: PSwsFilter; dstFilter: PSwsFilter; param: Pdouble): PSwsContext; - cdecl; external sw__scale; -function sws_scale(context: PSwsContext; src: PPByteArray; srcStride: PIntArray; srcSliceY: integer; srcSliceH: integer; - dst: PPByteArray; dstStride: PIntArray): integer; - cdecl; external sw__scale; -function sws_scale_ordered(context: PSwsContext; src: PPByteArray; srcStride: PIntArray; srcSliceY: integer; - srcSliceH: integer; dst: PPByteArray; dstStride: PIntArray): integer; - cdecl; external sw__scale; deprecated; - -function sws_setColorspaceDetails(c: PSwsContext; inv_table: PQuadIntArray; srcRange: integer; table: PQuadIntArray; dstRange: integer; - brightness: integer; contrast: integer; saturation: integer): integer; - cdecl; external sw__scale; -function sws_getColorspaceDetails(c: PSwsContext; var inv_table: PQuadIntArray; var srcRange: integer; var table: PQuadIntArray; var dstRange: integer; - var brightness: integer; var contrast: integer; var saturation: integer): integer; - cdecl; external sw__scale; -function sws_getGaussianVec(variance: double; quality: double): PSwsVector; - cdecl; external sw__scale; -function sws_getConstVec(c: double; length: integer): PSwsVector; - cdecl; external sw__scale; -function sws_getIdentityVec: PSwsVector; - cdecl; external sw__scale; -procedure sws_scaleVec(a: PSwsVector; scalar: double); - cdecl; external sw__scale; -procedure sws_normalizeVec(a: PSwsVector; height: double); - cdecl; external sw__scale; -procedure sws_convVec(a: PSwsVector; b: PSwsVector); - cdecl; external sw__scale; -procedure sws_addVec(a: PSwsVector; b: PSwsVector); - cdecl; external sw__scale; -procedure sws_subVec(a: PSwsVector; b: PSwsVector); - cdecl; external sw__scale; -procedure sws_shiftVec(a: PSwsVector; shift: integer); - cdecl; external sw__scale; -function sws_cloneVec(a: PSwsVector): PSwsVector; - cdecl; external sw__scale; - -procedure sws_printVec(a: PSwsVector); - cdecl; external sw__scale; -procedure sws_freeVec(a: PSwsVector); - cdecl; external sw__scale; - -function sws_getDefaultFilter(lumaGBlur: single; chromaGBlur: single; lumaSarpen: single; chromaSharpen: single; chromaHShift: single; - chromaVShift: single; verbose: integer): PSwsFilter; - cdecl; external sw__scale; -procedure sws_freeFilter(filter: PSwsFilter); - cdecl; external sw__scale; - -function sws_getCachedContext(context: PSwsContext; - srcW: integer; srcH: integer; srcFormat: integer; - dstW: integer; dstH: integer; dstFormat: integer; flags: integer; - srcFilter: PSwsFilter; dstFilter: PSwsFilter; param: Pdouble): PSwsContext; - cdecl; external sw__scale; - -implementation - -end. +(* + * Copyright (C) 2001-2003 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) +(* + * @file swscale.h + * @brief + * external api for the swscale stuff + *) + +unit swscale; + +{$IFDEF FPC} + {$MODE DELPHI } + {$PACKENUM 4} (* use 4-byte enums *) + {$PACKRECORDS C} (* C/C++-compatible record packing *) +{$ELSE} + {$MINENUMSIZE 4} (* use 4-byte enums *) +{$ENDIF} + +interface + +uses + avutil, + config; + +const + (* Max. supported version by this header *) + LIBSWSCALE_MAX_VERSION_MAJOR = 0; + LIBSWSCALE_MAX_VERSION_MINOR = 5; + LIBSWSCALE_MAX_VERSION_RELEASE = 0; + LIBSWSCALE_MAX_VERSION = (LIBSWSCALE_MAX_VERSION_MAJOR * VERSION_MAJOR) + + (LIBSWSCALE_MAX_VERSION_MINOR * VERSION_MINOR) + + (LIBSWSCALE_MAX_VERSION_RELEASE * VERSION_RELEASE); + +(* Check if linked versions are supported *) +{$IF (LIBSWSCALE_VERSION > LIBSWSCALE_MAX_VERSION)} + {$MESSAGE Warn 'Linked version of libswscale may be unsupported!'} +{$IFEND} + +type + TQuadIntArray = array[0..3] of integer; + PQuadIntArray = ^TQuadIntArray; + TIntArray = array[0..0] of integer; + PIntArray = ^TIntArray; + TPByteArray = array[0..0] of Pbyte; + PPByteArray = ^TPByteArray; + +const + LIBSWSCALE_VERSION_INT = ((0 shl 16)+(5 shl 8))+0; + LIBSWSCALE_VERSION = '0.5.0'; + LIBSWSCALE_BUILD = LIBSWSCALE_VERSION_INT; + + LIBSWSCALE_IDENT = 'SwS'+LIBSWSCALE_VERSION; + + {* values for the flags, the stuff on the command line is different *} + SWS_FAST_BILINEAR = 1; + SWS_BILINEAR = 2; + SWS_BICUBIC = 4; + SWS_X = 8; + SWS_POINT = $10; + SWS_AREA = $20; + SWS_BICUBLIN = $40; + SWS_GAUSS = $80; + SWS_SINC = $100; + SWS_LANCZOS = $200; + SWS_SPLINE = $400; + + SWS_SRC_V_CHR_DROP_MASK = $30000; + SWS_SRC_V_CHR_DROP_SHIFT = 16; + + SWS_PARAM_DEFAULT = 123456; + + SWS_PRINT_INFO = $1000; + + //the following 3 flags are not completely implemented + //internal chrominace subsampling info + SWS_FULL_CHR_H_INT = $2000; + //input subsampling info + SWS_FULL_CHR_H_INP = $4000; + SWS_DIRECT_BGR = $8000; + SWS_ACCURATE_RND = $40000; + + SWS_CPU_CAPS_MMX = $80000000; + SWS_CPU_CAPS_MMX2 = $20000000; + SWS_CPU_CAPS_3DNOW = $40000000; + SWS_CPU_CAPS_ALTIVEC = $10000000; + SWS_CPU_CAPS_BFIN = $01000000; + + SWS_MAX_REDUCE_CUTOFF = 0.002; + + SWS_CS_ITU709 = 1; + SWS_CS_FCC = 4; + SWS_CS_ITU601 = 5; + SWS_CS_ITU624 = 5; + SWS_CS_SMPTE170M = 5; + SWS_CS_SMPTE240M = 7; + SWS_CS_DEFAULT = 5; + + +type + + // when used for filters they must have an odd number of elements + // coeffs cannot be shared between vectors + PSwsVector = ^TSwsVector; + TSwsVector = record + coeff: Pdouble; + length: integer; + end; + + // vectors can be shared + PSwsFilter = ^TSwsFilter; + TSwsFilter = record + lumH: PSwsVector; + lumV: PSwsVector; + chrH: PSwsVector; + chrV: PSwsVector; + end; + + PSwsContext = ^TSwsContext; + TSwsContext = record + av_class: Pointer; + swScale: Pointer; + srxW,srcH, dstH: integer; + chrSrcW, chrSrcH, chrDstW, chrDstH: integer; + lumXInc, chrXInc, lumYInc, chrYInc: integer; + dstFormat, srcFormat, origDstFormat, origSrcFormat: integer; + chrSrcHSubSample, chrSrcVSubSample, chrIntHSubSample, chrIntVSubSample: integer; + chrDstHSubSample, chrDstVSubSample: integer; + vChrDrop, sliceDir: integer; + param: array[0..1] of double; + {internal structure} + end; + + +procedure sws_freeContext(swsContext: PSwsContext); + cdecl; external sw__scale; + +function sws_getContext(srcW: integer; srcH: integer; srcFormat: integer; dstW: integer; dstH: integer;dstFormat: integer; flags: integer; + srcFilter: PSwsFilter; dstFilter: PSwsFilter; param: Pdouble): PSwsContext; + cdecl; external sw__scale; +function sws_scale(context: PSwsContext; src: PPByteArray; srcStride: PIntArray; srcSliceY: integer; srcSliceH: integer; + dst: PPByteArray; dstStride: PIntArray): integer; + cdecl; external sw__scale; +function sws_scale_ordered(context: PSwsContext; src: PPByteArray; srcStride: PIntArray; srcSliceY: integer; + srcSliceH: integer; dst: PPByteArray; dstStride: PIntArray): integer; + cdecl; external sw__scale; deprecated; + +function sws_setColorspaceDetails(c: PSwsContext; inv_table: PQuadIntArray; srcRange: integer; table: PQuadIntArray; dstRange: integer; + brightness: integer; contrast: integer; saturation: integer): integer; + cdecl; external sw__scale; +function sws_getColorspaceDetails(c: PSwsContext; var inv_table: PQuadIntArray; var srcRange: integer; var table: PQuadIntArray; var dstRange: integer; + var brightness: integer; var contrast: integer; var saturation: integer): integer; + cdecl; external sw__scale; +function sws_getGaussianVec(variance: double; quality: double): PSwsVector; + cdecl; external sw__scale; +function sws_getConstVec(c: double; length: integer): PSwsVector; + cdecl; external sw__scale; +function sws_getIdentityVec: PSwsVector; + cdecl; external sw__scale; +procedure sws_scaleVec(a: PSwsVector; scalar: double); + cdecl; external sw__scale; +procedure sws_normalizeVec(a: PSwsVector; height: double); + cdecl; external sw__scale; +procedure sws_convVec(a: PSwsVector; b: PSwsVector); + cdecl; external sw__scale; +procedure sws_addVec(a: PSwsVector; b: PSwsVector); + cdecl; external sw__scale; +procedure sws_subVec(a: PSwsVector; b: PSwsVector); + cdecl; external sw__scale; +procedure sws_shiftVec(a: PSwsVector; shift: integer); + cdecl; external sw__scale; +function sws_cloneVec(a: PSwsVector): PSwsVector; + cdecl; external sw__scale; + +procedure sws_printVec(a: PSwsVector); + cdecl; external sw__scale; +procedure sws_freeVec(a: PSwsVector); + cdecl; external sw__scale; + +function sws_getDefaultFilter(lumaGBlur: single; chromaGBlur: single; lumaSarpen: single; chromaSharpen: single; chromaHShift: single; + chromaVShift: single; verbose: integer): PSwsFilter; + cdecl; external sw__scale; +procedure sws_freeFilter(filter: PSwsFilter); + cdecl; external sw__scale; + +function sws_getCachedContext(context: PSwsContext; + srcW: integer; srcH: integer; srcFormat: integer; + dstW: integer; dstH: integer; dstFormat: integer; flags: integer; + srcFilter: PSwsFilter; dstFilter: PSwsFilter; param: Pdouble): PSwsContext; + cdecl; external sw__scale; + +implementation + +end. diff --git a/Game/Code/lib/ffmpeg/version.inc b/Game/Code/lib/ffmpeg/version.inc deleted file mode 100644 index 6ba2bd52..00000000 --- a/Game/Code/lib/ffmpeg/version.inc +++ /dev/null @@ -1,102 +0,0 @@ -const -{$IFDEF MSWINDOWS} - av__codec = 'avcodec-51.dll'; - LIBAVCODEC_MAJOR_VERSION = 51; - LIBAVCODEC_MINOR_VERSION = 0; - LIBAVCODEC_SUB_VERSION = 0; - - av__format = 'avformat-50.dll'; - LIBAVFORMAT_MAJOR_VERSION = 50; - LIBAVFORMAT_MINOR_VERSION = 0; - LIBAVFORMAT_SUB_VERSION = 0; - - av__util = 'avutil-49.dll'; - LIBAVUTIL_MAJOR_VERSION = 49; - LIBAVUTIL_MINOR_VERSION = 0; - LIBAVUTIL_SUB_VERSION = 0; -{$ENDIF} -{$IFDEF LINUX} - av__codec = 'libavcodec.so'; - LIBAVCODEC_MAJOR_VERSION = 51; - LIBAVCODEC_MINOR_VERSION = 0; - LIBAVCODEC_SUB_VERSION = 0; - - av__format = 'libavformat.so'; -//av__format = 'libavformat.51'; - LIBAVFORMAT_MAJOR_VERSION = 51; - LIBAVFORMAT_MINOR_VERSION = 0; - LIBAVFORMAT_SUB_VERSION = 0; - - av__util = 'libavutil.so'; - LIBAVUTIL_MAJOR_VERSION = 49; - LIBAVUTIL_MINOR_VERSION = 0; - LIBAVUTIL_SUB_VERSION = 0; -{$ENDIF} -{$IFDEF DARWIN} - av__codec = 'libavcodec.dylib'; - LIBAVCODEC_MAJOR_VERSION = 51; - LIBAVCODEC_MINOR_VERSION = 0; - LIBAVCODEC_SUB_VERSION = 0; - - av__format = 'libavformat.dylib'; - LIBAVFORMAT_MAJOR_VERSION = 52; - LIBAVFORMAT_MINOR_VERSION = 0; - LIBAVFORMAT_SUB_VERSION = 0; - - av__util = 'libavutil.dylib'; - LIBAVUTIL_MAJOR_VERSION = 49; - LIBAVUTIL_MINOR_VERSION = 0; - LIBAVUTIL_SUB_VERSION = 0; -{$ENDIF} - -(* Max. supported version by this header *) -(* TODO: someone has to check the changes up to version 52, add some IFDEFS and increase this version number *) - -LIBAVCODEC_MAX_MAJOR_VERSION = 51; -LIBAVCODEC_MAX_MINOR_VERSION = 12; -LIBAVCODEC_MAX_SUB_VERSION = 1; -LIBAVCODEC_MAX_VERSION = (LIBAVCODEC_MAX_MAJOR_VERSION * 10000) + - (LIBAVCODEC_MAX_MINOR_VERSION * 100) + - (LIBAVCODEC_MAX_SUB_VERSION); - -LIBAVFORMAT_MAX_MAJOR_VERSION = 51; -LIBAVFORMAT_MAX_MINOR_VERSION = 12; -LIBAVFORMAT_MAX_SUB_VERSION = 1; -LIBAVFORMAT_MAX_VERSION = (LIBAVFORMAT_MAX_MAJOR_VERSION * 10000) + - (LIBAVFORMAT_MAX_MINOR_VERSION * 100) + - (LIBAVFORMAT_MAX_SUB_VERSION); - -LIBAVUTIL_MAX_MAJOR_VERSION = 49; -LIBAVUTIL_MAX_MINOR_VERSION = 4; -LIBAVUTIL_MAX_SUB_VERSION = 1; -LIBAVUTIL_MAX_VERSION = (LIBAVUTIL_MAX_MAJOR_VERSION * 10000) + - (LIBAVUTIL_MAX_MINOR_VERSION * 100) + - (LIBAVUTIL_MAX_SUB_VERSION); - -(* Calc linked version *) -LIBAVCODEC_VERSION = (LIBAVCODEC_MAJOR_VERSION * 10000) + - (LIBAVCODEC_MINOR_VERSION * 100) + - (LIBAVCODEC_SUB_VERSION); - -LIBAVFORMAT_VERSION = (LIBAVFORMAT_MAJOR_VERSION * 10000) + - (LIBAVFORMAT_MINOR_VERSION * 100) + - (LIBAVFORMAT_SUB_VERSION); - -LIBAVUTIL_VERSION = (LIBAVUTIL_MAJOR_VERSION * 10000) + - (LIBAVUTIL_MINOR_VERSION * 100) + - (LIBAVUTIL_SUB_VERSION); - -(* Check if linked versions are supported *) - -{$IF (LIBAVCODEC_VERSION > LIBAVCODEC_MAX_VERSION)} - {$MESSAGE Warn 'Linked version of libavcodec may be unsupported!'} -{$IFEND} - -{$IF (LIBAVFORMAT_VERSION > LIBAVFORMAT_MAX_VERSION)} - {$MESSAGE Warn 'Linked version of libavformat may be unsupported!'} -{$IFEND} - -{$IF (LIBAVUTIL_VERSION > LIBAVUTIL_MAX_VERSION)} - {$MESSAGE Warn 'Linked version of libavutil may be unsupported!'} -{$IFEND} - -- cgit v1.2.3 From c09529e6ab6ecbf2d5ba2ac8f29713ba0101e55a Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 13:57:27 +0000 Subject: Removed the "use nil instead of 0" warnings git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@815 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UVideo.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index db7e3ffd..66c0c8e6 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -435,7 +435,7 @@ begin VideoTime := 0; LastFrameTime := 0; TimeDifference := 0; - VideoFormatContext := 0; + VideoFormatContext := nil; // writeln( aFileName ); @@ -587,7 +587,7 @@ begin {$IFDEF UseSWScale} SoftwareScaleContext:=sws_getContext(VideoCodecContext^.width,VideoCodecContext^.height,integer(VideoCodecContext^.pix_fmt), dataX, dataY, integer(PIX_FMT_RGB24), - SWS_FAST_BILINEAR, 0, 0, 0); + SWS_FAST_BILINEAR, nil, nil, nil); if SoftwareScaleContext <> Nil then writeln('got swscale context') else begin -- cgit v1.2.3 From 0d445e4ef186d6daee3a1545609a1528fe31fa10 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 14:15:34 +0000 Subject: Removed the FPC_V220 define. Now the build-in FPC_VERSION, FPC_RELEASE and FPC_PATCH macros are used. So no need to define the version in a config-file anymore (especially in windows). git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@816 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlatformLinux.pas | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlatformLinux.pas b/Game/Code/Classes/UPlatformLinux.pas index 882376a2..b962d8a5 100644 --- a/Game/Code/Classes/UPlatformLinux.pas +++ b/Game/Code/Classes/UPlatformLinux.pas @@ -28,18 +28,25 @@ type implementation +// check for version of FPC >= 2.2.0 +{$IFDEF FPC} + {$IF (FPC_VERSION > 2) or ((FPC_VERSION = 2) and (FPC_RELEASE >= 2))} + {$DEFINE FPC_VERSION_2_2_0_PLUS} + {$IFEND} +{$ENDIF} + uses libc, uCommandLine, -{$IFNDEF FPC_V220} - oldlinux, -{$ELSE} +{$IFDEF FPC_VERSION_2_2_0_PLUS} BaseUnix, +{$ELSE} + oldlinux, {$ENDIF} SysUtils; -{$IFDEF FPC_V220} -Function TPlatformLinux.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; +{$IFDEF FPC_VERSION_2_2_0_PLUS} +Function TPlatformLinux.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; var i : Integer; TheDir : pDir; @@ -159,8 +166,7 @@ begin end; // FIXME: just a dirty-fix to make the linux build work again. -// This i the same as the corresponding function for windows -// and MacOSX. +// This i the same as the corresponding function for MacOSX. // Maybe this should be TPlatformBase.Halt() procedure TPlatformLinux.Halt; begin -- cgit v1.2.3 From 8bbb2068bae2d03a574ff594b6cd791370e0de58 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 15:04:49 +0000 Subject: - config-win.pas: swscale must be undefined by default - swscale.pas: corrected "config" to "UConfig" git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@817 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/config-win.inc | 2 +- Game/Code/lib/ffmpeg/swscale.pas | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/config-win.inc b/Game/Code/config-win.inc index 5791c579..749575ec 100644 --- a/Game/Code/config-win.inc +++ b/Game/Code/config-win.inc @@ -32,7 +32,7 @@ LIBAVUTIL_VERSION_RELEASE = 0; {$IFEND} -{$DEFINE HaveSWScale} +{$UNDEF HaveSWScale} {$IF Defined(HaveSWScale) and Defined(IncludeConstants)} sw__scale = 'swscale-0'; LIBSWSCALE_VERSION_MAJOR = 0; diff --git a/Game/Code/lib/ffmpeg/swscale.pas b/Game/Code/lib/ffmpeg/swscale.pas index 406ab4a9..9bff330a 100644 --- a/Game/Code/lib/ffmpeg/swscale.pas +++ b/Game/Code/lib/ffmpeg/swscale.pas @@ -37,7 +37,7 @@ interface uses avutil, - config; + UConfig; const (* Max. supported version by this header *) -- cgit v1.2.3 From 2cae5bd13375afa3dc3e35dd5c7af24f673eba0e Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 15:15:41 +0000 Subject: config-file for MacOSX. Eddie: please have a look at this. Define ProjectM_0_9 if you want to use it. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@818 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/config-macosx.inc | 70 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Game/Code/config-macosx.inc (limited to 'Game/Code') diff --git a/Game/Code/config-macosx.inc b/Game/Code/config-macosx.inc new file mode 100644 index 00000000..41b96326 --- /dev/null +++ b/Game/Code/config-macosx.inc @@ -0,0 +1,70 @@ +{***************************************************************** + * Configuration file for UltraStar Deluxe 1.1 + *****************************************************************} + +{* Misc options *} + +{$DEFINE DEBUG} + +{* Libraries *} + +{$IF Defined(LAZARUS) and Defined(IncludeConstants)} + LAZARUS_VERSION_MAJOR = 0; + LAZARUS_VERSION_MINOR = 9; + LAZARUS_VERSION_RELEASE = 24; +{$IFEND} + +{$DEFINE HaveFFMpeg} +{$IF Defined(HaveFFMpeg) and Defined(IncludeConstants)} + av__codec = 'libavcodec.dylib'; + LIBAVCODEC_VERSION_MAJOR = 51; + LIBAVCODEC_VERSION_MINOR = 0; + LIBAVCODEC_VERSION_RELEASE = 0; + + av__format = 'libavformat.dylib'; + LIBAVFORMAT_VERSION_MAJOR = 52; + LIBAVFORMAT_VERSION_MINOR = 0; + LIBAVFORMAT_VERSION_RELEASE = 0; + + av__util = 'libavutil.dylib'; + LIBAVUTIL_VERSION_MAJOR = 49; + LIBAVUTIL_VERSION_MINOR = 0; + LIBAVUTIL_VERSION_RELEASE = 0; +{$IFEND} + +{$UNDEF HaveSWScale} +{$IF Defined(HaveSWScale) and Defined(IncludeConstants)} + sw__scale = 'libswscale.dylib'; + LIBSWSCALE_VERSION_MAJOR = 0; + LIBSWSCALE_VERSION_MINOR = 5; + LIBSWSCALE_VERSION_RELEASE = 0; +{$IFEND} + +// define this for versions of ProjectM < 1.0 (use C-Interface) +{$UNDEF HaveProjectM_0_9} +// define this for versions of ProjectM >= 1.0 (use C++-Interface) +{$UNDEF HaveProjectM_1_0_PLUS} +{$IF Defined(HaveProjectM_0_9) or Defined(HaveProjectM_1_0_PLUS)} + {$DEFINE HaveProjectM} +{$IFEND} +{$IF Defined(HaveProjectM) and Defined(IncludeConstants)} + libprojectM = 'libprojectM.dylib'; + // Note: Un/Define HaveProjectM_0_9 or HaveProjectM_1_0_PLUS accordingly + PROJECTM_VERSION_MAJOR = 0; + PROJECTM_VERSION_MINOR = 98; + PROJECTM_VERSION_RELEASE = 0; +{$IFEND} + +{$UNDEF HavePortaudio} +{$IF Defined(HavePortaudio) and Defined(IncludeConstants)} + libportaudio = 'libportaudio.dylib'; + PORTAUDIO_VERSION_MAJOR = 19; + PORTAUDIO_VERSION_MINOR = 0; + PORTAUDIO_VERSION_RELEASE = 0; +{$IFEND} + +{$UNDEF HavePortmixer} +{$IF Defined(HavePortmixer) and Defined(IncludeConstants)} + libportmixer = 'libportmixer.dylib'; +{$IFEND} + -- cgit v1.2.3 From bf548af7791d9a97f69585e644d3d823dab02898 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 15:26:25 +0000 Subject: New switches.inc layout git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@819 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.dpr | 66 +++++++++-------- Game/Code/UltraStar.lpr | 77 ++++++++++--------- Game/Code/switches.inc | 192 +++++++++++++++++++++++++++++------------------- 3 files changed, 193 insertions(+), 142 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 18a825eb..788b1018 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -18,17 +18,19 @@ uses sdl_ttf in 'lib\JEDI-SDL\SDL_ttf\Pas\sdl_ttf.pas', sdlutils in 'lib\JEDI-SDL\SDL\Pas\sdlutils.pas', - {$ifdef UseBass} - bass in 'lib\bass\delphi\bass.pas', - {$endif} - {$ifdef UsePortaudio} - portaudio in 'lib\portaudio\delphi\portaudio.pas', - {$endif} - {$ifdef UsePortmixer} - portmixer in 'lib\portmixer\delphi\portmixer.pas', - {$endif} - - {$ifdef delphi} + {$IFDEF UseBass} + bass in 'lib\bass\delphi\bass.pas', + //UAudioCore_Bass in 'Classes\UAudioCore_Bass.pas', + {$ENDIF} + {$IFDEF UsePortaudio} + portaudio in 'lib\portaudio\delphi\portaudio.pas', + {$ENDIF} + {$IFDEF UsePortmixer} + portmixer in 'lib\portmixer\delphi\portmixer.pas', + {$ENDIF} + + //{$IFDEF MSWINDOWS} + {$IFDEF Delphi} midiout in 'lib\midi\midiout.pas', midiin in 'lib\midi\midiin.pas', CIRCBUF in 'lib\midi\CIRCBUF.PAS', @@ -39,8 +41,9 @@ uses Delphmcb in 'lib\midi\Delphmcb.PAS', DirWatch in 'lib\other\DirWatch.pas', - {$endif} + {$ENDIF} + {$IFDEF UseFFMpeg} avcodec in 'lib\ffmpeg\avcodec.pas', avformat in 'lib\ffmpeg\avformat.pas', avutil in 'lib\ffmpeg\avutil.pas', @@ -48,14 +51,17 @@ uses opt in 'lib\ffmpeg\opt.pas', avio in 'lib\ffmpeg\avio.pas', mathematics in 'lib\ffmpeg\mathematics.pas', -// swscale in 'lib\ffmpeg\swscale.pas', + {$ENDIF} + {$IFDEF UseSWScale} + swscale in 'lib\ffmpeg\swscale.pas', + {$ENDIF} - {$ifdef UseProjectM_0_9} + {$IFDEF UseProjectM_0_9} projectM in 'lib\projectM\0.9\projectM.pas', - {$endif} - {$ifdef UseProjectM_1_0} + {$ENDIF} + {$IFDEF UseProjectM_1_0} projectM in 'lib\projectM\1.0\projectM.pas', - {$endif} + {$ENDIF} SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', SQLite3 in 'lib\SQLite\SQLite3.pas', @@ -145,22 +151,24 @@ uses {$IFDEF UseProjectM} UVisualizer in 'Classes\UVisualizer.pas', // MUST be before Video... so video can override... {$ENDIF} +{$IFDEF UseFFMpegVideo} UVideo in 'Classes\UVideo.pas', -{$ifdef UseFFMpegDecoder} +{$ENDIF} +{$IFDEF UseFFMpegDecoder} UAudioDecoder_FFMpeg in 'Classes\UAudioDecoder_FFMpeg.pas', // MUST be before Playback-classes -{$endif} -{$ifdef UseBASSInput} +{$ENDIF} +{$IFDEF UseBASSInput} UAudioInput_Bass in 'Classes\UAudioInput_Bass.pas', -{$endif} -{$ifdef UseBASSPlayback} +{$ENDIF} +{$IFDEF UseBASSPlayback} UAudioPlayback_Bass in 'Classes\UAudioPlayback_Bass.pas', -{$endif} -{$ifdef UsePortaudioInput} +{$ENDIF} +{$IFDEF UsePortaudioInput} UAudioInput_Portaudio in 'Classes\UAudioInput_Portaudio.pas', -{$endif} -{$ifdef UsePortaudioPlayback} +{$ENDIF} +{$IFDEF UsePortaudioPlayback} UAudioPlayback_Portaudio in 'Classes\UAudioPlayback_Portaudio.pas', -{$endif} +{$ENDIF} //------------------------------ @@ -204,7 +212,7 @@ uses UScreenPartyWin in 'Screens\UScreenPartyWin.pas', - //------------------------------ + //------------------------------ //Includes - Modi SDK //------------------------------ ModiSDK in '..\..\Modis\SDK\ModiSDK.pas', //Old SDK, will be deleted soon @@ -213,7 +221,7 @@ uses {$IFDEF win32} Windows, - {$ENDIF} + {$ENDIF} SysUtils; const diff --git a/Game/Code/UltraStar.lpr b/Game/Code/UltraStar.lpr index 01cd7f87..cbb44adf 100644 --- a/Game/Code/UltraStar.lpr +++ b/Game/Code/UltraStar.lpr @@ -1,36 +1,41 @@ -program UltraStar; - -{$DEFINE TRANSLATE} -{$MODE DELPHI} -{$I switches.inc} - -uses - {$ifdef unix} // http://wiki.lazarus.freepascal.org/Multithreaded_Application_Tutorial - cthreads, // THIS MUST be the first used unit !! - {$endif} - - // *************************************************************************** - // - // Developers PLEASE NOTE !!!!!!! - // - // As of september 2007, I am working towards porting Ultrastar-DX to run - // on Linux. I will be modifiying the source to make it compile in lazarus - // on windows & linux and I will make sure that it compiles in delphi still - // To help me in this endevour, please can you make a point of remembering - // that linux is CASE SENSATIVE, and file / unit names must be as per - // the filename exactly. - // - // EG : opengl12.pas must not be OpenGL in the uses cluase. - // - // thanks for your help... - // - // *************************************************************************** - - // Interesting stuff... :) - // http://burningsmell.org/sdl_audioin/ - - {$I UltraStar.dpr} - -begin - main(); -end. +program UltraStar; + +{$DEFINE TRANSLATE} +{$MODE DELPHI} +{$I switches.inc} + +uses + {$ifdef unix} // http://wiki.lazarus.freepascal.org/Multithreaded_Application_Tutorial + cthreads, // THIS MUST be the first used unit !! + {$endif} + {$ifdef MSWINDOWS} + {$ifdef LCL} + Interfaces, // Initialize Lazarus LCL (necessary for usage of LCLIntf, etc.) + {$endif} + {$endif} + + {$I UltraStar.dpr} + + // *************************************************************************** + // + // Developers PLEASE NOTE !!!!!!! + // + // As of september 2007, I am working towards porting Ultrastar-DX to run + // on Linux. I will be modifiying the source to make it compile in lazarus + // on windows & linux and I will make sure that it compiles in delphi still + // To help me in this endevour, please can you make a point of remembering + // that linux is CASE SENSATIVE, and file / unit names must be as per + // the filename exactly. + // + // EG : opengl12.pas must not be OpenGL in the uses cluase. + // + // thanks for your help... + // + // *************************************************************************** + + // Interesting stuff... :) + // http://burningsmell.org/sdl_audioin/ + +begin + main(); +end. diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index 29828712..a50c759b 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -1,77 +1,115 @@ -{$DEFINE DEBUG} // to-do : Remove b4 release - -// Comment by eddie: -// The mac port currently also uses the WIN32 define. -// Once I get the beast compiled, linked and running -// I will change this. -// There are some parts where the WIN32 define could not -// be used. I changed the WIN32 to MSWINDOWS. -// So, for Windows-only code use the MSWINDOWS define. - - -{$IFDEF FPC} - {$IFDEF DARWIN} - {$H+} - {$R-} - {$DEFINE WIN32} - {$DEFINE TRANSLATE} - {$DEFINE UTF8_FILENAMES} - {$ELSE} - {$DEFINE LAZARUS} - {$ENDIF} - - {$DEFINE DLL_CDECL} - {$UNDEF UseSerialPort} - {$UNDEF UseMIDIPort} -{$ELSE} - {$DEFINE Delphi} - {$DEFINE DLL_STDCALL} - {$UNDEF UseSerialPort} - {$DEFINE UseMIDIPort} -{$ENDIF} - - -{$IFDEF win32} - {$I config-win.inc} - - {$DEFINE UseBASSPlayback} - {$DEFINE UseBASSInput} - - //{$DEFINE UseFFMpegDecoder} - //{$DEFINE UsePortaudioPlayback} - //{$DEFINE UsePortaudioInput} - //{$DEFINE UsePortmixer} - - {$IF Defined(HaveProjectM_0_9)} - {$DEFINE UseProjectM_0_9} - {$ELSEIF Defined(HaveProjectM_1_0_PLUS)} - {$DEFINE UseProjectM_1_0} - {$IFEND} - - {$IFDEF DEBUG} - {$IFNDEF DARWIN} - {$APPTYPE CONSOLE} - {$ENDIF} - {$ENDIF} -{$ELSE} - {$DEFINE UseFFMpegAudio} - {$DEFINE UsePortaudio} - {$DEFINE UseProjectM_0_9} -{$ENDIF} - -{$IF Defined(UseBASSInput) or Defined(UseBASSPlayback)} - {$DEFINE UseBASS} -{$IFEND} - -{$IF Defined(UsePortaudioInput) or Defined(UsePortaudioPlayback)} - {$DEFINE UsePortaudio} -{$IFEND} - -{$IF Defined(UseProjectM_0_9) or Defined(UseProjectM_1_0)} - {$DEFINE UseProjectM} -{$IFEND} - -// I had to add these (jay)... but maybe henny has some way that the config script is meant to do this ? -// Ill need to check with him. -//{$DEFINE FPC_V220} -//{$DEFINE LAZARUS_V0924} +// Comment by eddie: +// The mac port currently also uses the WIN32 define. +// Once I get the beast compiled, linked and running +// I will change this. +// There are some parts where the WIN32 define could not +// be used. I changed the WIN32 to MSWINDOWS. +// So, for Windows-only code use the MSWINDOWS define. + +{$IFDEF FPC} + {$IFDEF DARWIN} + {$H+} + {$R-} + {$DEFINE WIN32} + {$DEFINE TRANSLATE} + {$DEFINE UTF8_FILENAMES} + {$ELSE} + {$DEFINE LAZARUS} + {$IFNDEF LCL} + // LCL should be defined already + {$MESSAGE Warn 'LCL undefined, compile with "fpc -dLCL ..."!'} + {$DEFINE LCL} + {$ENDIF} + {$ENDIF} + + {$DEFINE DLL_CDECL} + {$UNDEF UseSerialPort} + {$UNDEF UseMIDIPort} +{$ELSE} + {$DEFINE Delphi} + {$DEFINE DLL_STDCALL} + {$UNDEF UseSerialPort} + {$DEFINE UseMIDIPort} +{$ENDIF} + + +{$IF Defined(win32)} + {$I config-win.inc} + + // audio config + {$DEFINE WinAudioLib_BASS} + {$IFDEF WinAudioLib_BASS} + {$DEFINE UseBASSPlayback} + {$DEFINE UseBASSInput} + {$ELSE} + {$DEFINE UseFFMpegDecoder} + {$DEFINE HaveAvcodecDecodeAudio2} + {$DEFINE UsePortaudioPlayback} + {$DEFINE UsePortaudioInput} + {$DEFINE UsePortmixer} + {$ENDIF} + {$UNDEF WinAudioLib_BASS} + + // video config + {$IFDEF HaveFFMpeg} + {$DEFINE UseFFMpegVideo} + {$ENDIF} + {$IFDEF HaveSWScale} + {$DEFINE UseSWScale} + {$ENDIF} + + // misc defines + + {$IF Defined(HaveProjectM_0_9)} + {$DEFINE UseProjectM_0_9} + {$ELSEIF Defined(HaveProjectM_1_0_PLUS)} + {$DEFINE UseProjectM_1_0_PLUS} + {$IFEND} + + {$IFDEF DEBUG} + {$IFNDEF DARWIN} + {$APPTYPE CONSOLE} + {$ENDIF} + {$ENDIF} +{$ELSEIF Defined(Linux)} + {$I config-linux.inc} + + // audio config + {$IFDEF HaveFFMpeg} + {$DEFINE UseFFMpegDecoder} + {$IFDEF HavePortaudio} + {$DEFINE UsePortaudioPlayback} + {$DEFINE UsePortaudioInput} + {$ENDIF} + {$ENDIF} + + // video config + {$IFDEF HaveFFMpeg} + {$DEFINE UseFFMpegVideo} + {$ENDIF} + {$IFDEF HaveSWScale} + {$DEFINE UseSWScale} + {$ENDIF} + + // misc defines + {$IFDEF HaveProjectM} + {$DEFINE UseProjectM_0_9} + {$ENDIF} +{$IFEND} + +{$IF Defined(UseFFMpegVideo) or Defined(UseFFMpegDecoder)} + {$DEFINE UseFFMpeg} +{$IFEND} + +{$IF Defined(UseBASSInput) or Defined(UseBASSPlayback)} + {$DEFINE UseBASS} +{$IFEND} + +{$IF Defined(UsePortaudioInput) or Defined(UsePortaudioPlayback)} + {$DEFINE UsePortaudio} +{$IFEND} + +{$IF Defined(UseProjectM_0_9) or Defined(UseProjectM_1_0_PLUS)} + {$DEFINE UseProjectM} +{$IFEND} + -- cgit v1.2.3 From 31056e848f9aa03e4adf40e9480b122bc510f2cf Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 15:56:07 +0000 Subject: Sorry, must be UseProjectM_1_0_PLUS now git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@820 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/UltraStar.dpr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 788b1018..09acffb3 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -59,7 +59,7 @@ uses {$IFDEF UseProjectM_0_9} projectM in 'lib\projectM\0.9\projectM.pas', {$ENDIF} - {$IFDEF UseProjectM_1_0} + {$IFDEF UseProjectM_1_0_PLUS} projectM in 'lib\projectM\1.0\projectM.pas', {$ENDIF} -- cgit v1.2.3 From aaae25658c97ae3f1b1f00fb8158c93cdb566342 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 15:59:57 +0000 Subject: Made this FPC (for windows) compatible git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@821 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/other/DirWatch.pas | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/lib/other/DirWatch.pas b/Game/Code/lib/other/DirWatch.pas index 88c3489e..b14fa791 100644 --- a/Game/Code/lib/other/DirWatch.pas +++ b/Game/Code/lib/other/DirWatch.pas @@ -23,8 +23,20 @@ unit DirWatch; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + uses - Windows, Messages, SysUtils, Forms, Classes; + Windows, + Messages, + SysUtils, + {$IFDEF LCL} + LCLIntf, // used for AllocateHWnd + {$ELSE} + Forms, + {$ENDIF} + Classes; type TNotifyFilters = set of (nfFilename, nfDirname, nfAttrib, -- cgit v1.2.3 From 2eb92f1b07828c0631d297bd26cfb249ccbd20ef Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 16:26:40 +0000 Subject: - DirWatch-support with FPC (windows only) - added UAudioCore_Bass.pas git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@823 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudioCore_Bass.pas | 116 +++ Game/Code/Classes/USong.pas | 1459 ++++++++++++++++----------------- Game/Code/Classes/USongs.pas | 8 +- Game/Code/UltraStar.dpr | 4 +- Game/Code/lazres-UltraStar.sh | 94 --- Game/Code/linux-build.sh | 6 - 6 files changed, 848 insertions(+), 839 deletions(-) create mode 100644 Game/Code/Classes/UAudioCore_Bass.pas delete mode 100755 Game/Code/lazres-UltraStar.sh delete mode 100755 Game/Code/linux-build.sh (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudioCore_Bass.pas b/Game/Code/Classes/UAudioCore_Bass.pas new file mode 100644 index 00000000..55148f95 --- /dev/null +++ b/Game/Code/Classes/UAudioCore_Bass.pas @@ -0,0 +1,116 @@ +unit UAudioCore_Bass; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + Classes, + SysUtils; + +type + TAudioCore_Bass = class + private + public + class function ErrorGetString(): string; overload; + class function ErrorGetString(errCode: integer): string; overload; + end; + + +implementation + +uses + UMain, + ULog, + bass; + +class function TAudioCore_Bass.ErrorGetString(): string; +begin + ErrorGetString(BASS_ErrorGetCode()); +end; + +class function TAudioCore_Bass.ErrorGetString(errCode: integer): string; +begin + case errCode of + BASS_OK: + result := 'No error'; + BASS_ERROR_MEM: + result := 'Insufficient memory'; + BASS_ERROR_FILEOPEN: + result := 'File could not be opened'; + BASS_ERROR_DRIVER: + result := 'Device driver not available'; + BASS_ERROR_BUFLOST: + result := 'Buffer lost'; + BASS_ERROR_HANDLE: + result := 'Invalid Handle'; + BASS_ERROR_FORMAT: + result := 'Sample-Format not supported'; + BASS_ERROR_POSITION: + result := 'Illegal position'; + BASS_ERROR_INIT: + result := 'BASS_Init has not been successfully called'; + BASS_ERROR_START: + result := 'Paused/stopped'; + BASS_ERROR_ALREADY: + result := 'Already created/used'; + BASS_ERROR_NOPAUSE: + result := 'No pause'; + BASS_ERROR_NOCHAN: + result := 'No free channels'; + BASS_ERROR_ILLTYPE: + result := 'Type is invalid'; + BASS_ERROR_ILLPARAM: + result := 'Illegal parameter'; + BASS_ERROR_NO3D: + result := 'No 3D support'; + BASS_ERROR_NOEAX: + result := 'No EAX support'; + BASS_ERROR_DEVICE: + result := 'Invalid device number'; + BASS_ERROR_NOPLAY: + result := 'Channel not playing'; + BASS_ERROR_FREQ: + result := 'Freq out of range'; + BASS_ERROR_NOTFILE: + result := 'Not a file stream'; + BASS_ERROR_NOHW: + result := 'No hardware support'; + BASS_ERROR_EMPTY: + result := 'Is empty'; + BASS_ERROR_NONET: + result := 'Network unavailable'; + BASS_ERROR_CREATE: + result := 'Creation error'; + BASS_ERROR_NOFX: + result := 'DX8 effects unavailable'; + BASS_ERROR_PLAYING: + result := 'Channel is playing'; + BASS_ERROR_NOTAVAIL: + result := 'Not available'; + BASS_ERROR_DECODE: + result := 'Is a decoding channel'; + BASS_ERROR_DX: + result := 'Insufficient version of DirectX'; + BASS_ERROR_TIMEOUT: + result := 'Timeout'; + BASS_ERROR_FILEFORM: + result := 'File-Format not recognised/supported'; + BASS_ERROR_SPEAKER: + result := 'Requested speaker(s) not support'; + BASS_ERROR_VERSION: + result := 'Version error'; + BASS_ERROR_CODEC: + result := 'Codec not available/supported'; + BASS_ERROR_UNKNOWN: + result := 'Unknown error'; + else + result := 'Unknown error'; + end; +end; + +end. \ No newline at end of file diff --git a/Game/Code/Classes/USong.pas b/Game/Code/Classes/USong.pas index e5777c75..39220f1c 100644 --- a/Game/Code/Classes/USong.pas +++ b/Game/Code/Classes/USong.pas @@ -1,733 +1,726 @@ -unit USong; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses - {$IFDEF MSWINDOWS} - Windows, - {$ifdef Delphi} - DirWatch, - {$endif} - {$ELSE} - {$IFNDEF DARWIN} -// oldlinux, - syscall, - {$ENDIF} - baseunix, - UnixType, - {$ENDIF} - SysUtils, - Classes, - UPlatform, - ULog, - UTexture, - UCommon, - {$IFDEF DARWIN} - cthreads, - {$ENDIF} - {$IFDEF USE_PSEUDO_THREAD} - PseudoThread, - {$ENDIF} - UCatCovers; - -type - - - TSingMode = ( smNormal, smPartyMode, smPlaylistRandom ); - - TBPM = record - BPM: real; - StartBeat: real; - end; - - TScore = record - Name: widestring; - Score: integer; - Length: string; - end; - - TSong = class - - FileLineNo : integer; //Line which is readed at Last, for error reporting - - procedure ParseNote(NrCzesci: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string); - procedure NewSentence(NrCzesciP: integer; Param1, Param2: integer); - - function ReadTXTHeader( const aFileName : WideString ): boolean; - public - - Path: widestring; - Folder: widestring; // for sorting by folder - fFileName, - FileName: widestring; - - // sorting methods - Category: array of widestring; // I think I won't need this - Genre: widestring; - Edition: widestring; - Language: widestring; // 0.5.0: new - - Title: widestring; - Artist: widestring; - - Text: widestring; - Creator: widestring; - - Cover: widestring; - CoverTex: TTexture; - Mp3: widestring; - Background: widestring; - Video: widestring; - VideoGAP: real; - VideoLoaded: boolean; // 0.5.0: true if the video has been loaded - NotesGAP: integer; - Start: real; // in seconds - Finish: integer; // in miliseconds - Relative: boolean; - Resolution: integer; - BPM: array of TBPM; - GAP: real; // in miliseconds - - Score: array[0..2] of array of TScore; - - // these are used when sorting is enabled - Visible: boolean; // false if hidden, true if visible - Main: boolean; // false for songs, true for category buttons - OrderNum: integer; // has a number of category for category buttons and songs - OrderTyp: integer; // type of sorting for this button (0=name) - CatNumber: integer; // Count of Songs in Category for Cats and Number of Song in Category for Songs - - SongFile: TextFile; // all procedures in this unit operates on this file - - Base : array[0..1] of integer; - Rel : array[0..1] of integer; - Mult : integer; - MultBPM : integer; - - constructor create ( const aFileName : WideString ); - function LoadSong: boolean; - function Analyse(): boolean; - procedure clear(); - end; - -implementation - -uses - TextGL, - UIni, - UMusic, // needed for Czesci .. ( whatever that is ) - UMain; //needed for Player - -constructor TSong.create( const aFileName : WideString ); -begin - - Mult := 1; - - MultBPM := 4; - - - fFileName := aFileName; - - - if fileexists( aFileName ) then - - begin - - self.Path := ExtractFilePath( aFileName ); - self.Folder := ExtractFilePath( aFileName ); - self.FileName := ExtractFileName( aFileName ); - -(* - - if ReadTXTHeader( aFileName ) then - - begin - - LoadSong(); - - end - else - begin - Log.LogError('Error Loading SongHeader, abort Song Loading'); - Exit; - end; -*) - end; - -end; - - -function TSong.LoadSong(): boolean; - -var - TempC: char; - Tekst: string; - CP: integer; // Current Player (0 or 1) - Pet: integer; - Both: boolean; - Param1: integer; - Param2: integer; - Param3: integer; - ParamS: string; - I: Integer; -begin - Result := false; - - if not FileExists(Path + PathDelim + FileName) then - begin - Log.LogError('File not found: "' + Path + PathDelim + FileName + '"', 'WczytajCzesci'); - exit; - end; - - try - MultBPM := 4; // 4 - mnoznik dla czasu nut - Mult := 1; // 4 - dokladnosc pomiaru nut - Base[0] := 100; // high number - Czesci[0].Wartosc := 0; - self.Relative := false; - Rel[0] := 0; - CP := 0; - Both := false; - - if Length(Player) = 2 then - Both := true; - - // Open song file for reading..... - FileMode := fmOpenRead; - AssignFile(SongFile, fFileName); - Reset(SongFile); - - //Clear old Song Header - if (self.Path = '') then - self.Path := ExtractFilePath(FileName); - - if (self.FileName = '') then - self.Filename := ExtractFileName(FileName); - - Result := False; - - Reset(SongFile); - FileLineNo := 0; - //Search for Note Begining - repeat - ReadLn(SongFile, Tekst); - Inc(FileLineNo); - - if (EoF(SongFile)) then - begin //Song File Corrupted - No Notes - CloseFile(SongFile); - Log.LogError('Could not load txt File, no Notes found: ' + FileName); - Result := False; - Exit; - end; - Read(SongFile, TempC); - until ((TempC = ':') or (TempC = 'F') or (TempC = '*')); - - SetLength(Czesci, 2); - for Pet := 0 to High(Czesci) do begin - SetLength(Czesci[Pet].Czesc, 1); - Czesci[Pet].High := 0; - Czesci[Pet].Ilosc := 1; - Czesci[Pet].Akt := 0; - Czesci[Pet].Resolution := self.Resolution; - Czesci[Pet].NotesGAP := self.NotesGAP; - Czesci[Pet].Czesc[0].IlNut := 0; - Czesci[Pet].Czesc[0].HighNut := -1; - end; - - // TempC := ':'; - // TempC := Tekst[1]; // read from backup variable, don't use default ':' value - - while (TempC <> 'E') AND (not EOF(SongFile)) do - begin - - if (TempC = ':') or (TempC = '*') or (TempC = 'F') then begin - // wczytuje nute - Read(SongFile, Param1); - Read(SongFile, Param2); - Read(SongFile, Param3); - Read(SongFile, ParamS); - - // dodaje nute - if not Both then - // P1 - ParseNote(0, TempC, (Param1+Rel[0]) * Mult, Param2 * Mult, Param3, ParamS) - else begin - // P1 + P2 - ParseNote(0, TempC, (Param1+Rel[0]) * Mult, Param2 * Mult, Param3, ParamS); - ParseNote(1, TempC, (Param1+Rel[1]) * Mult, Param2 * Mult, Param3, ParamS); - end; - end; // if - - if TempC = '-' then - begin - // reads sentence - Read(SongFile, Param1); - if self.Relative then Read(SongFile, Param2); // read one more data for relative system - - // new sentence - if not Both then - // P1 - NewSentence(0, (Param1 + Rel[0]) * Mult, Param2) - else begin - // P1 + P2 - NewSentence(0, (Param1 + Rel[0]) * Mult, Param2); - NewSentence(1, (Param1 + Rel[1]) * Mult, Param2); - end; - end; // if - - if TempC = 'B' then - begin - SetLength(self.BPM, Length(self.BPM) + 1); - Read(SongFile, self.BPM[High(self.BPM)].StartBeat); - self.BPM[High(self.BPM)].StartBeat := self.BPM[High(self.BPM)].StartBeat + Rel[0]; - - Read(SongFile, Tekst); - self.BPM[High(self.BPM)].BPM := StrToFloat(Tekst); - self.BPM[High(self.BPM)].BPM := self.BPM[High(self.BPM)].BPM * Mult * MultBPM; - end; - - - if not Both then - begin - Czesci[CP].Czesc[Czesci[CP].High].BaseNote := Base[CP]; - Czesci[CP].Czesc[Czesci[CP].High].LyricWidth := glTextWidth(PChar(Czesci[CP].Czesc[Czesci[CP].High].Lyric)); - //Total Notes Patch - Czesci[CP].Czesc[Czesci[CP].High].TotalNotes := 0; - for I := low(Czesci[CP].Czesc[Czesci[CP].High].Nuta) to high(Czesci[CP].Czesc[Czesci[CP].High].Nuta) do - begin - Czesci[CP].Czesc[Czesci[CP].High].TotalNotes := Czesci[CP].Czesc[Czesci[CP].High].TotalNotes + Czesci[CP].Czesc[Czesci[CP].High].Nuta[I].Dlugosc * Czesci[CP].Czesc[Czesci[CP].High].Nuta[I].Wartosc; - end; - //Total Notes Patch End - end else begin - for Pet := 0 to High(Czesci) do begin - Czesci[Pet].Czesc[Czesci[Pet].High].BaseNote := Base[Pet]; - Czesci[Pet].Czesc[Czesci[Pet].High].LyricWidth := glTextWidth(PChar(Czesci[Pet].Czesc[Czesci[Pet].High].Lyric)); - //Total Notes Patch - Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes := 0; - for I := low(Czesci[Pet].Czesc[Czesci[Pet].High].Nuta) to high(Czesci[Pet].Czesc[Czesci[Pet].High].Nuta) do - begin - Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes := Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes + Czesci[Pet].Czesc[Czesci[Pet].High].Nuta[I].Dlugosc * Czesci[Pet].Czesc[Czesci[Pet].High].Nuta[I].Wartosc; - end; - //Total Notes Patch End - end; - end; - - Read(SongFile, TempC); - Inc(FileLineNo); - end; // while} - - CloseFile(SongFile); - except - try - CloseFile(SongFile); - except - - end; - - Log.LogError('Error Loading File: "' + fFileName + '" in Line ' + inttostr(FileLineNo)); - exit; - end; - - Result := true; -end; - - -function TSong.ReadTXTHeader(const aFileName : WideString): boolean; - -var - Line, Identifier, Value: String; - Temp : word; - Done : byte; -begin - Result := true; - Done := 0; - - //Read first Line - ReadLn (SongFile, Line); - - if (Length(Line)<=0) then - begin - Log.LogError('File Starts with Empty Line: ' + aFileName); - Result := False; - Exit; - end; - - //Read Lines while Line starts with # or its empty - While ( Length(Line) = 0 ) OR - ( Line[1] = '#' ) DO - begin - //Increase Line Number - Inc (FileLineNo); - Temp := Pos(':', Line); - - //Line has a Seperator-> Headerline - if (Temp <> 0) then - begin - //Read Identifier and Value - Identifier := Uppercase(Trim(Copy(Line, 2, Temp - 2))); //Uppercase is for Case Insensitive Checks - Value := Trim(Copy(Line, Temp + 1,Length(Line) - Temp)); - - //Check the Identifier (If Value is given) - if (Length(Value) <> 0) then - begin - - //----------- - //Required Attributes - //----------- - - {$IFDEF UTF8_FILENAMES} - if ((Identifier = 'MP3') or (Identifier = 'BACKGROUND') or (Identifier = 'COVER') or (Identifier = 'VIDEO')) then - Value := Utf8Encode(Value); - {$ENDIF} - - //Title - if (Identifier = 'TITLE') then - begin - self.Title := Value; - - //Add Title Flag to Done - Done := Done or 1; - end - - //Artist - else if (Identifier = 'ARTIST') then - begin - self.Artist := Value; - - //Add Artist Flag to Done - Done := Done or 2; - end - - //MP3 File //Test if Exists - else if (Identifier = 'MP3') AND - (FileExists(self.Path + Value)) then - begin - self.Mp3 := Value; - - //Add Mp3 Flag to Done - Done := Done or 4; - end - - //Beats per Minute - else if (Identifier = 'BPM') then - begin - // Replace . with , - if (Pos('.', Value) <> 0) then - Value[Pos('.', Value)] := ','; - - SetLength(self.BPM, 1); - self.BPM[0].StartBeat := 0; - - self.BPM[0].BPM := StrtoFloatDef(Value, 0) * Mult * MultBPM; - - if self.BPM[0].BPM <> 0 then - begin - //Add BPM Flag to Done - Done := Done or 8; - end; - end - - //--------- - //Additional Header Information - //--------- - - // Video Gap - else if (Identifier = 'GAP') then - begin - // Replace . with , - if (Pos('.', Value) <> 0) then - Value[Pos('.', Value)] := ','; - - self.GAP := StrtoFloatDef (Value, 0); - end - - //Cover Picture - else if (Identifier = 'COVER') then - self.Cover := Value - - //Background Picture - else if (Identifier = 'BACKGROUND') then - self.Background := Value - - // Video File - else if (Identifier = 'VIDEO') then - begin - if (FileExists(self.Path + Value)) then - self.Video := Value - else - Log.LogError('Can''t find Video File in Song: ' + aFileName); - end - - // Video Gap - else if (Identifier = 'VIDEOGAP') then - begin - // Replace . with , - if (Pos('.', Value) <> 0) then - Value[Pos('.', Value)] := ','; - - self.VideoGAP := StrtoFloatDef (Value, 0); - end - - //Genre Sorting - else if (Identifier = 'GENRE') then - self.Genre := Value - - //Edition Sorting - else if (Identifier = 'EDITION') then - self.Edition := Value - - //Creator Tag - else if (Identifier = 'CREATOR') then - self.Creator := Value - - //Language Sorting - else if (Identifier = 'LANGUAGE') then - self.Language := Value - - // Song Start - else if (Identifier = 'START') then - begin - // Replace . with , - if (Pos('.', Value) <> 0) then - Value[Pos('.', Value)] := ','; - - self.Start := StrtoFloatDef(Value, 0); - end - - // Song Ending - else if (Identifier = 'END') then - TryStrtoInt(Value, self.Finish) - - // Resolution - else if (Identifier = 'RESOLUTION') then - TryStrtoInt(Value, self.Resolution) - - // Notes Gap - else if (Identifier = 'NOTESGAP') then - TryStrtoInt(Value, self.NotesGAP) - // Relative Notes - else if (Identifier = 'RELATIVE') AND (uppercase(Value) = 'YES') then - self.Relative := True; - - end; - end; - - if not EOf(SongFile) then - ReadLn (SongFile, Line) - else - begin - Result := False; - Log.LogError('File Incomplete or not Ultrastar TxT (A): ' + aFileName); - break; - end; - - end; - - if self.Cover = '' then - self.Cover := platform.FindSongFile(Path, '*[CO].jpg'); - - //Check if all Required Values are given - if (Done <> 15) then - begin - Result := False; - if (Done and 8) = 0 then //No BPM Flag - Log.LogError('BPM Tag Missing: ' + self.FileName) - else if (Done and 4) = 0 then //No MP3 Flag - Log.LogError('MP3 Tag/File Missing: ' + self.FileName) - else if (Done and 2) = 0 then //No Artist Flag - Log.LogError('Artist Tag Missing: ' + self.FileName) - else if (Done and 1) = 0 then //No Title Flag - Log.LogError('Title Tag Missing: ' + self.FileName) - else //unknown Error - Log.LogError('File Incomplete or not Ultrastar TxT (B - '+ inttostr(Done) +'): ' + aFileName); - end; - -end; - -procedure TSong.ParseNote(NrCzesci: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string); -var - Space: boolean; -begin - case Ini.Solmization of - 1: // european - begin - case (NoteP mod 12) of - 0..1: LyricS := ' do '; - 2..3: LyricS := ' re '; - 4: LyricS := ' mi '; - 5..6: LyricS := ' fa '; - 7..8: LyricS := ' sol '; - 9..10: LyricS := ' la '; - 11: LyricS := ' si '; - end; - end; - 2: // japanese - begin - case (NoteP mod 12) of - 0..1: LyricS := ' do '; - 2..3: LyricS := ' re '; - 4: LyricS := ' mi '; - 5..6: LyricS := ' fa '; - 7..8: LyricS := ' so '; - 9..10: LyricS := ' la '; - 11: LyricS := ' shi '; - end; - end; - 3: // american - begin - case (NoteP mod 12) of - 0..1: LyricS := ' do '; - 2..3: LyricS := ' re '; - 4: LyricS := ' mi '; - 5..6: LyricS := ' fa '; - 7..8: LyricS := ' sol '; - 9..10: LyricS := ' la '; - 11: LyricS := ' ti '; - end; - end; - end; // case - - with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].High] do begin - SetLength(Nuta, Length(Nuta) + 1); - IlNut := IlNut + 1; - HighNut := HighNut + 1; - Muzyka.IlNut := Muzyka.IlNut + 1; - - Nuta[HighNut].Start := StartP; - if IlNut = 1 then begin - StartNote := Nuta[HighNut].Start; - if Czesci[NrCzesci].Ilosc = 1 then - Start := -100; -// Start := Nuta[HighNut].Start; - end; - - Nuta[HighNut].Dlugosc := DurationP; - Muzyka.DlugoscNut := Muzyka.DlugoscNut + Nuta[HighNut].Dlugosc; - - // back to the normal system with normal, golden and now freestyle notes - case TypeP of - 'F': Nuta[HighNut].Wartosc := 0; - ':': Nuta[HighNut].Wartosc := 1; - '*': Nuta[HighNut].Wartosc := 2; - end; - - Czesci[NrCzesci].Wartosc := Czesci[NrCzesci].Wartosc + Nuta[HighNut].Dlugosc * Nuta[HighNut].Wartosc; - - Nuta[HighNut].Ton := NoteP; - if Nuta[HighNut].Ton < Base[NrCzesci] then Base[NrCzesci] := Nuta[HighNut].Ton; - Nuta[HighNut].TonGamy := Nuta[HighNut].TonGamy mod 12; - - Nuta[HighNut].Tekst := Copy(LyricS, 2, 100); - Lyric := Lyric + Nuta[HighNut].Tekst; - - if TypeP = 'F' then - Nuta[HighNut].FreeStyle := true; - - Koniec := Nuta[HighNut].Start + Nuta[HighNut].Dlugosc; - end; // with -end; - -procedure TSong.NewSentence(NrCzesciP: integer; Param1, Param2: integer); -var -I: Integer; -begin - - // stara czesc //Alter Satz //Update Old Part - Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].BaseNote := Base[NrCzesciP]; - Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].LyricWidth := glTextWidth(PChar(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Lyric)); - - //Total Notes Patch - Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes := 0; - for I := low(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta) to high(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta) do - begin - Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes := Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta[I].Dlugosc * Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta[I].Wartosc; - end; - //Total Notes Patch End - - - // nowa czesc //Neuer Satz //Update New Part - SetLength(Czesci[NrCzesciP].Czesc, Czesci[NrCzesciP].Ilosc + 1); - Czesci[NrCzesciP].High := Czesci[NrCzesciP].High + 1; - Czesci[NrCzesciP].Ilosc := Czesci[NrCzesciP].Ilosc + 1; - Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].HighNut := -1; - - if self.Relative then - begin - Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Start := Param1; - Rel[NrCzesciP] := Rel[NrCzesciP] + Param2; - end - else - Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Start := Param1; - - Base[NrCzesciP] := 100; // high number -end; - -procedure TSong.clear(); -begin - //Main Information - Title := ''; - Artist := ''; - - //Sortings: - Genre := 'Unknown'; - Edition := 'Unknown'; - Language := 'Unknown'; //Language Patch - - //Required Information - Mp3 := ''; - {$IFDEF FPC} - setlength( BPM, 0 ); - {$ELSE} - BPM := 0; - {$ENDIF} - - GAP := 0; - Start := 0; - Finish := 0; - - //Additional Information - Background := ''; - Cover := ''; - Video := ''; - VideoGAP := 0; - NotesGAP := 0; - Resolution := 4; - Creator := ''; - -end; - -function TSong.Analyse(): boolean; -begin - Result := False; - - //Reset LineNo - FileLineNo := 0; - - //Open File and set File Pointer to the beginning - AssignFile(SongFile, self.Path + self.FileName); - - try - Reset(SongFile); - - //Clear old Song Header - self.clear; - - //Read Header - Result := self.ReadTxTHeader( FileName ) - - //And Close File - finally - CloseFile(SongFile); - end; -end; - - - -end. +unit USong; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + {$IFDEF MSWINDOWS} + Windows, + {$ELSE} + {$IFNDEF DARWIN} + syscall, + {$ENDIF} + baseunix, + UnixType, + {$ENDIF} + SysUtils, + Classes, + UPlatform, + ULog, + UTexture, + UCommon, + {$IFDEF DARWIN} + cthreads, + {$ENDIF} + {$IFDEF USE_PSEUDO_THREAD} + PseudoThread, + {$ENDIF} + UCatCovers; + +type + + TSingMode = ( smNormal, smPartyMode, smPlaylistRandom ); + + TBPM = record + BPM: real; + StartBeat: real; + end; + + TScore = record + Name: widestring; + Score: integer; + Length: string; + end; + + TSong = class + FileLineNo : integer; //Line which is readed at Last, for error reporting + + procedure ParseNote(NrCzesci: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string); + procedure NewSentence(NrCzesciP: integer; Param1, Param2: integer); + + function ReadTXTHeader( const aFileName : WideString ): boolean; + public + Path: widestring; + Folder: widestring; // for sorting by folder + fFileName, + FileName: widestring; + + // sorting methods + Category: array of widestring; // I think I won't need this + Genre: widestring; + Edition: widestring; + Language: widestring; // 0.5.0: new + + Title: widestring; + Artist: widestring; + + Text: widestring; + Creator: widestring; + + Cover: widestring; + CoverTex: TTexture; + Mp3: widestring; + Background: widestring; + Video: widestring; + VideoGAP: real; + VideoLoaded: boolean; // 0.5.0: true if the video has been loaded + NotesGAP: integer; + Start: real; // in seconds + Finish: integer; // in miliseconds + Relative: boolean; + Resolution: integer; + BPM: array of TBPM; + GAP: real; // in miliseconds + + Score: array[0..2] of array of TScore; + + // these are used when sorting is enabled + Visible: boolean; // false if hidden, true if visible + Main: boolean; // false for songs, true for category buttons + OrderNum: integer; // has a number of category for category buttons and songs + OrderTyp: integer; // type of sorting for this button (0=name) + CatNumber: integer; // Count of Songs in Category for Cats and Number of Song in Category for Songs + + SongFile: TextFile; // all procedures in this unit operates on this file + + Base : array[0..1] of integer; + Rel : array[0..1] of integer; + Mult : integer; + MultBPM : integer; + + constructor create ( const aFileName : WideString ); + function LoadSong: boolean; + function Analyse(): boolean; + procedure clear(); + end; + +implementation + +uses + TextGL, + UIni, + UMusic, // needed for Czesci .. ( whatever that is ) + UMain; //needed for Player + +constructor TSong.create( const aFileName : WideString ); +begin + + Mult := 1; + + MultBPM := 4; + + + fFileName := aFileName; + + + if fileexists( aFileName ) then + + begin + + self.Path := ExtractFilePath( aFileName ); + self.Folder := ExtractFilePath( aFileName ); + self.FileName := ExtractFileName( aFileName ); + +(* + + if ReadTXTHeader( aFileName ) then + + begin + + LoadSong(); + + end + else + begin + Log.LogError('Error Loading SongHeader, abort Song Loading'); + Exit; + end; +*) + end; + +end; + + +function TSong.LoadSong(): boolean; + +var + TempC: char; + Tekst: string; + CP: integer; // Current Player (0 or 1) + Pet: integer; + Both: boolean; + Param1: integer; + Param2: integer; + Param3: integer; + ParamS: string; + I: Integer; +begin + Result := false; + + if not FileExists(Path + PathDelim + FileName) then + begin + Log.LogError('File not found: "' + Path + PathDelim + FileName + '"', 'TSong.LoadSong()'); + exit; + end; + + MultBPM := 4; // multiply beat-count of note by 4 + Mult := 1; // accuracy of measurement of note + Base[0] := 100; // high number + Czesci[0].Wartosc := 0; + self.Relative := false; + Rel[0] := 0; + CP := 0; + Both := false; + + if Length(Player) = 2 then + Both := true; + + try + // Open song file for reading..... + FileMode := fmOpenRead; + AssignFile(SongFile, fFileName); + Reset(SongFile); + + //Clear old Song Header + if (self.Path = '') then + self.Path := ExtractFilePath(FileName); + + if (self.FileName = '') then + self.Filename := ExtractFileName(FileName); + + Result := False; + + Reset(SongFile); + FileLineNo := 0; + //Search for Note Begining + repeat + ReadLn(SongFile, Tekst); + Inc(FileLineNo); + + if (EoF(SongFile)) then + begin //Song File Corrupted - No Notes + CloseFile(SongFile); + Log.LogError('Could not load txt File, no Notes found: ' + FileName); + Result := False; + Exit; + end; + Read(SongFile, TempC); + until ((TempC = ':') or (TempC = 'F') or (TempC = '*')); + + SetLength(Czesci, 2); + for Pet := 0 to High(Czesci) do begin + SetLength(Czesci[Pet].Czesc, 1); + Czesci[Pet].High := 0; + Czesci[Pet].Ilosc := 1; + Czesci[Pet].Akt := 0; + Czesci[Pet].Resolution := self.Resolution; + Czesci[Pet].NotesGAP := self.NotesGAP; + Czesci[Pet].Czesc[0].IlNut := 0; + Czesci[Pet].Czesc[0].HighNut := -1; + end; + + // TempC := ':'; + // TempC := Tekst[1]; // read from backup variable, don't use default ':' value + + while (TempC <> 'E') AND (not EOF(SongFile)) do + begin + + if (TempC = ':') or (TempC = '*') or (TempC = 'F') then begin + // read notes + Read(SongFile, Param1); + Read(SongFile, Param2); + Read(SongFile, Param3); + Read(SongFile, ParamS); + + // add notes + if not Both then + // P1 + ParseNote(0, TempC, (Param1+Rel[0]) * Mult, Param2 * Mult, Param3, ParamS) + else begin + // P1 + P2 + ParseNote(0, TempC, (Param1+Rel[0]) * Mult, Param2 * Mult, Param3, ParamS); + ParseNote(1, TempC, (Param1+Rel[1]) * Mult, Param2 * Mult, Param3, ParamS); + end; + end; // if + + if TempC = '-' then + begin + // reads sentence + Read(SongFile, Param1); + if self.Relative then Read(SongFile, Param2); // read one more data for relative system + + // new sentence + if not Both then + // P1 + NewSentence(0, (Param1 + Rel[0]) * Mult, Param2) + else begin + // P1 + P2 + NewSentence(0, (Param1 + Rel[0]) * Mult, Param2); + NewSentence(1, (Param1 + Rel[1]) * Mult, Param2); + end; + end; // if + + if TempC = 'B' then + begin + SetLength(self.BPM, Length(self.BPM) + 1); + Read(SongFile, self.BPM[High(self.BPM)].StartBeat); + self.BPM[High(self.BPM)].StartBeat := self.BPM[High(self.BPM)].StartBeat + Rel[0]; + + Read(SongFile, Tekst); + self.BPM[High(self.BPM)].BPM := StrToFloat(Tekst); + self.BPM[High(self.BPM)].BPM := self.BPM[High(self.BPM)].BPM * Mult * MultBPM; + end; + + + if not Both then + begin + Czesci[CP].Czesc[Czesci[CP].High].BaseNote := Base[CP]; + Czesci[CP].Czesc[Czesci[CP].High].LyricWidth := glTextWidth(PChar(Czesci[CP].Czesc[Czesci[CP].High].Lyric)); + //Total Notes Patch + Czesci[CP].Czesc[Czesci[CP].High].TotalNotes := 0; + for I := low(Czesci[CP].Czesc[Czesci[CP].High].Nuta) to high(Czesci[CP].Czesc[Czesci[CP].High].Nuta) do + begin + Czesci[CP].Czesc[Czesci[CP].High].TotalNotes := Czesci[CP].Czesc[Czesci[CP].High].TotalNotes + Czesci[CP].Czesc[Czesci[CP].High].Nuta[I].Dlugosc * Czesci[CP].Czesc[Czesci[CP].High].Nuta[I].Wartosc; + end; + //Total Notes Patch End + end else begin + for Pet := 0 to High(Czesci) do begin + Czesci[Pet].Czesc[Czesci[Pet].High].BaseNote := Base[Pet]; + Czesci[Pet].Czesc[Czesci[Pet].High].LyricWidth := glTextWidth(PChar(Czesci[Pet].Czesc[Czesci[Pet].High].Lyric)); + //Total Notes Patch + Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes := 0; + for I := low(Czesci[Pet].Czesc[Czesci[Pet].High].Nuta) to high(Czesci[Pet].Czesc[Czesci[Pet].High].Nuta) do + begin + Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes := Czesci[Pet].Czesc[Czesci[Pet].High].TotalNotes + Czesci[Pet].Czesc[Czesci[Pet].High].Nuta[I].Dlugosc * Czesci[Pet].Czesc[Czesci[Pet].High].Nuta[I].Wartosc; + end; + //Total Notes Patch End + end; + end; + + Read(SongFile, TempC); + Inc(FileLineNo); + end; // while} + + CloseFile(SongFile); + except + try + CloseFile(SongFile); + except + + end; + + Log.LogError('Error Loading File: "' + fFileName + '" in Line ' + inttostr(FileLineNo)); + exit; + end; + + Result := true; +end; + + +function TSong.ReadTXTHeader(const aFileName : WideString): boolean; + +var + Line, Identifier, Value: String; + Temp : word; + Done : byte; +begin + Result := true; + Done := 0; + + //Read first Line + ReadLn (SongFile, Line); + + if (Length(Line)<=0) then + begin + Log.LogError('File Starts with Empty Line: ' + aFileName); + Result := False; + Exit; + end; + + //Read Lines while Line starts with # or its empty + While ( Length(Line) = 0 ) OR + ( Line[1] = '#' ) DO + begin + //Increase Line Number + Inc (FileLineNo); + Temp := Pos(':', Line); + + //Line has a Seperator-> Headerline + if (Temp <> 0) then + begin + //Read Identifier and Value + Identifier := Uppercase(Trim(Copy(Line, 2, Temp - 2))); //Uppercase is for Case Insensitive Checks + Value := Trim(Copy(Line, Temp + 1,Length(Line) - Temp)); + + //Check the Identifier (If Value is given) + if (Length(Value) <> 0) then + begin + + //----------- + //Required Attributes + //----------- + + {$IFDEF UTF8_FILENAMES} + if ((Identifier = 'MP3') or (Identifier = 'BACKGROUND') or (Identifier = 'COVER') or (Identifier = 'VIDEO')) then + Value := Utf8Encode(Value); + {$ENDIF} + + //Title + if (Identifier = 'TITLE') then + begin + self.Title := Value; + + //Add Title Flag to Done + Done := Done or 1; + end + + //Artist + else if (Identifier = 'ARTIST') then + begin + self.Artist := Value; + + //Add Artist Flag to Done + Done := Done or 2; + end + + //MP3 File //Test if Exists + else if (Identifier = 'MP3') AND + (FileExists(self.Path + Value)) then + begin + self.Mp3 := Value; + + //Add Mp3 Flag to Done + Done := Done or 4; + end + + //Beats per Minute + else if (Identifier = 'BPM') then + begin + // Replace . with , + if (Pos('.', Value) <> 0) then + Value[Pos('.', Value)] := ','; + + SetLength(self.BPM, 1); + self.BPM[0].StartBeat := 0; + + self.BPM[0].BPM := StrtoFloatDef(Value, 0) * Mult * MultBPM; + + if self.BPM[0].BPM <> 0 then + begin + //Add BPM Flag to Done + Done := Done or 8; + end; + end + + //--------- + //Additional Header Information + //--------- + + // Video Gap + else if (Identifier = 'GAP') then + begin + // Replace . with , + if (Pos('.', Value) <> 0) then + Value[Pos('.', Value)] := ','; + + self.GAP := StrtoFloatDef (Value, 0); + end + + //Cover Picture + else if (Identifier = 'COVER') then + self.Cover := Value + + //Background Picture + else if (Identifier = 'BACKGROUND') then + self.Background := Value + + // Video File + else if (Identifier = 'VIDEO') then + begin + if (FileExists(self.Path + Value)) then + self.Video := Value + else + Log.LogError('Can''t find Video File in Song: ' + aFileName); + end + + // Video Gap + else if (Identifier = 'VIDEOGAP') then + begin + // Replace . with , + if (Pos('.', Value) <> 0) then + Value[Pos('.', Value)] := ','; + + self.VideoGAP := StrtoFloatDef (Value, 0); + end + + //Genre Sorting + else if (Identifier = 'GENRE') then + self.Genre := Value + + //Edition Sorting + else if (Identifier = 'EDITION') then + self.Edition := Value + + //Creator Tag + else if (Identifier = 'CREATOR') then + self.Creator := Value + + //Language Sorting + else if (Identifier = 'LANGUAGE') then + self.Language := Value + + // Song Start + else if (Identifier = 'START') then + begin + // Replace . with , + if (Pos('.', Value) <> 0) then + Value[Pos('.', Value)] := ','; + + self.Start := StrtoFloatDef(Value, 0); + end + + // Song Ending + else if (Identifier = 'END') then + TryStrtoInt(Value, self.Finish) + + // Resolution + else if (Identifier = 'RESOLUTION') then + TryStrtoInt(Value, self.Resolution) + + // Notes Gap + else if (Identifier = 'NOTESGAP') then + TryStrtoInt(Value, self.NotesGAP) + // Relative Notes + else if (Identifier = 'RELATIVE') AND (uppercase(Value) = 'YES') then + self.Relative := True; + + end; + end; + + if not EOf(SongFile) then + ReadLn (SongFile, Line) + else + begin + Result := False; + Log.LogError('File Incomplete or not Ultrastar TxT (A): ' + aFileName); + break; + end; + + end; + + if self.Cover = '' then + self.Cover := platform.FindSongFile(Path, '*[CO].jpg'); + + //Check if all Required Values are given + if (Done <> 15) then + begin + Result := False; + if (Done and 8) = 0 then //No BPM Flag + Log.LogError('BPM Tag Missing: ' + self.FileName) + else if (Done and 4) = 0 then //No MP3 Flag + Log.LogError('MP3 Tag/File Missing: ' + self.FileName) + else if (Done and 2) = 0 then //No Artist Flag + Log.LogError('Artist Tag Missing: ' + self.FileName) + else if (Done and 1) = 0 then //No Title Flag + Log.LogError('Title Tag Missing: ' + self.FileName) + else //unknown Error + Log.LogError('File Incomplete or not Ultrastar TxT (B - '+ inttostr(Done) +'): ' + aFileName); + end; + +end; + +procedure TSong.ParseNote(NrCzesci: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string); +var + Space: boolean; +begin + case Ini.Solmization of + 1: // european + begin + case (NoteP mod 12) of + 0..1: LyricS := ' do '; + 2..3: LyricS := ' re '; + 4: LyricS := ' mi '; + 5..6: LyricS := ' fa '; + 7..8: LyricS := ' sol '; + 9..10: LyricS := ' la '; + 11: LyricS := ' si '; + end; + end; + 2: // japanese + begin + case (NoteP mod 12) of + 0..1: LyricS := ' do '; + 2..3: LyricS := ' re '; + 4: LyricS := ' mi '; + 5..6: LyricS := ' fa '; + 7..8: LyricS := ' so '; + 9..10: LyricS := ' la '; + 11: LyricS := ' shi '; + end; + end; + 3: // american + begin + case (NoteP mod 12) of + 0..1: LyricS := ' do '; + 2..3: LyricS := ' re '; + 4: LyricS := ' mi '; + 5..6: LyricS := ' fa '; + 7..8: LyricS := ' sol '; + 9..10: LyricS := ' la '; + 11: LyricS := ' ti '; + end; + end; + end; // case + + with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].High] do begin + SetLength(Nuta, Length(Nuta) + 1); + IlNut := IlNut + 1; + HighNut := HighNut + 1; + Muzyka.IlNut := Muzyka.IlNut + 1; + + Nuta[HighNut].Start := StartP; + if IlNut = 1 then begin + StartNote := Nuta[HighNut].Start; + if Czesci[NrCzesci].Ilosc = 1 then + Start := -100; +// Start := Nuta[HighNut].Start; + end; + + Nuta[HighNut].Dlugosc := DurationP; + Muzyka.DlugoscNut := Muzyka.DlugoscNut + Nuta[HighNut].Dlugosc; + + // back to the normal system with normal, golden and now freestyle notes + case TypeP of + 'F': Nuta[HighNut].Wartosc := 0; + ':': Nuta[HighNut].Wartosc := 1; + '*': Nuta[HighNut].Wartosc := 2; + end; + + Czesci[NrCzesci].Wartosc := Czesci[NrCzesci].Wartosc + Nuta[HighNut].Dlugosc * Nuta[HighNut].Wartosc; + + Nuta[HighNut].Ton := NoteP; + if Nuta[HighNut].Ton < Base[NrCzesci] then Base[NrCzesci] := Nuta[HighNut].Ton; + Nuta[HighNut].TonGamy := Nuta[HighNut].TonGamy mod 12; + + Nuta[HighNut].Tekst := Copy(LyricS, 2, 100); + Lyric := Lyric + Nuta[HighNut].Tekst; + + if TypeP = 'F' then + Nuta[HighNut].FreeStyle := true; + + Koniec := Nuta[HighNut].Start + Nuta[HighNut].Dlugosc; + end; // with +end; + +procedure TSong.NewSentence(NrCzesciP: integer; Param1, Param2: integer); +var +I: Integer; +begin + + // stara czesc //Alter Satz //Update Old Part + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].BaseNote := Base[NrCzesciP]; + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].LyricWidth := glTextWidth(PChar(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Lyric)); + + //Total Notes Patch + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes := 0; + for I := low(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta) to high(Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta) do + begin + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes := Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].TotalNotes + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta[I].Dlugosc * Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Nuta[I].Wartosc; + end; + //Total Notes Patch End + + + // nowa czesc //Neuer Satz //Update New Part + SetLength(Czesci[NrCzesciP].Czesc, Czesci[NrCzesciP].Ilosc + 1); + Czesci[NrCzesciP].High := Czesci[NrCzesciP].High + 1; + Czesci[NrCzesciP].Ilosc := Czesci[NrCzesciP].Ilosc + 1; + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].HighNut := -1; + + if self.Relative then + begin + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Start := Param1; + Rel[NrCzesciP] := Rel[NrCzesciP] + Param2; + end + else + Czesci[NrCzesciP].Czesc[Czesci[NrCzesciP].High].Start := Param1; + + Base[NrCzesciP] := 100; // high number +end; + +procedure TSong.clear(); +begin + //Main Information + Title := ''; + Artist := ''; + + //Sortings: + Genre := 'Unknown'; + Edition := 'Unknown'; + Language := 'Unknown'; //Language Patch + + //Required Information + Mp3 := ''; + {$IFDEF FPC} + setlength( BPM, 0 ); + {$ELSE} + BPM := 0; + {$ENDIF} + + GAP := 0; + Start := 0; + Finish := 0; + + //Additional Information + Background := ''; + Cover := ''; + Video := ''; + VideoGAP := 0; + NotesGAP := 0; + Resolution := 4; + Creator := ''; + +end; + +function TSong.Analyse(): boolean; +begin + Result := False; + + //Reset LineNo + FileLineNo := 0; + + //Open File and set File Pointer to the beginning + AssignFile(SongFile, self.Path + self.FileName); + + try + Reset(SongFile); + + //Clear old Song Header + self.clear; + + //Read Header + Result := self.ReadTxTHeader( FileName ) + + //And Close File + finally + CloseFile(SongFile); + end; +end; + + + +end. diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 53d5556f..97e8d073 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -17,9 +17,7 @@ interface uses {$IFDEF MSWINDOWS} Windows, - {$IFDEF Delphi} - DirWatch, - {$ENDIF} + DirWatch, {$ELSE} {$IFNDEF DARWIN} syscall, @@ -66,7 +64,7 @@ type fWatch : longint; fParseSongDirectory : boolean; fProcessing : boolean; - {$ifdef Delphi} + {$ifdef MSWINDOWS} fDirWatch : TDirectoryWatch; {$endif} procedure int_LoadSongList; @@ -151,7 +149,7 @@ begin SongList := TList.create(); - {$ifdef Delphi} + {$ifdef MSWINDOWS} fDirWatch := TDirectoryWatch.create(nil); fDirWatch.OnChange := DoDirChanged; fDirWatch.Directory := SongPath; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 09acffb3..5c26180e 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -20,7 +20,7 @@ uses {$IFDEF UseBass} bass in 'lib\bass\delphi\bass.pas', - //UAudioCore_Bass in 'Classes\UAudioCore_Bass.pas', + UAudioCore_Bass in 'Classes\UAudioCore_Bass.pas', {$ENDIF} {$IFDEF UsePortaudio} portaudio in 'lib\portaudio\delphi\portaudio.pas', @@ -39,7 +39,9 @@ uses MidiCons in 'lib\midi\MidiCons.PAS', MidiFile in 'lib\midi\MidiFile.PAS', Delphmcb in 'lib\midi\Delphmcb.PAS', + {$ENDIF} + {$IFDEF MSWINDOWS} DirWatch in 'lib\other\DirWatch.pas', {$ENDIF} diff --git a/Game/Code/lazres-UltraStar.sh b/Game/Code/lazres-UltraStar.sh deleted file mode 100755 index bd3f130d..00000000 --- a/Game/Code/lazres-UltraStar.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash - -## -# Creates an .lrs resource-file. -# This script reads an rc resource definition file -# and uses lazres to compile it into an lrs-file. -## - -RCFILE=UltraStar.rc -OUTFILE=UltraStar.lrs -# set this to your lazarus directory if autodetection fails -LAZDIR_DEFAULT=/usr/local/share/lazarus - -LAZDIR=`whereis -b lazarus | cut -s -d ' ' -f2` -if [ ! -d "${LAZDIR}" ]; then - if [ ! -d "${LAZDIR_DEFAULT}" ]; then - echo "Autodetecting Lazarus-directory failed!" - echo "Set LAZDIR_DEFAULT to your Lazarus directory in this script." - exit 1 - fi - LAZDIR="${LAZDIR_DEFAULT}" -fi - -LAZRES="${LAZDIR}/tools/lazres" -LAZRES_SRC="${LAZRES}.pp" -LAZRES_PROJ="${LAZRES}.lpi" -LAZBUILD="${LAZDIR}/lazbuild" -UNIT_PATH=-Fu${LAZDIR}/lcl/units/i386-linux - -# check if lazres is available -if [ ! -x "${LAZRES}" ]; then - # lazres not available -> build it - echo -e "Building of lazres required...\n" - # check if lazres project-file exists - if [ ! -f "${LAZRES_SRC}" ]; then - echo -e "\n${LAZRES_SRC} not found!" - exit 1 - fi - # build lazres - fpc -dRELEASE "${UNIT_PATH}" "${LAZRES_SRC}" - #"${LAZBUILD}" "${LAZRES_PROJ}" - # did it fail? - if [ $? -ne 0 ]; then - echo -e "\nBuilding lazres failed!" - exit 1 - fi - echo -e "\nBuilding lazres finished!" -fi - -# create temp-dir for file renaming (do not use varname TMPDIR!) -RENAME_DIR=`mktemp -t -d usdxresXXXXXXXXXX` || exit 1 -echo "Temporary directory for file-renaming created! (${RENAME_DIR})" - -# read each line of RC-file and add resource-path to parameter-list -LAZRES_PARAMS="" -echo "Reading RC-file..." -{ -while read -r res_name res_type res_path; do - # check if line is commented out - if (echo ${res_name} | grep "^//" >/dev/null) ; then - echo "Skip resource: ${res_name}" - continue - fi - # add non-empty paths to parameter-list - if [ ! -z "${res_path}" ]; then - # replace backslashes (\\) and carriage return (\r) (MS-DOS line-ending) - RES_PATH=`echo "${res_path}" | tr '\r\\' '\0/'` - RES_NEW_PATH="${RENAME_DIR}/${res_name}.${res_type}" - eval cp "${RES_PATH}" "${RES_NEW_PATH}" - # append to parameter-list - LAZRES_PARAMS="${LAZRES_PARAMS} ${RES_NEW_PATH}" - fi -done -} < "${RCFILE}" - -# create resource file -rm -f ${OUTFILE} -echo "Creating resource file..." -"${LAZRES}" "${OUTFILE}" ${LAZRES_PARAMS} -RES=0 -if [ -f "${OUTFILE}" ]; then - echo -e "\nResource file successfully created!" - RES=1 -else - echo -e "\nCreation of resource file failed!" -fi - -# remove temp-directory -echo "Removing temporary directory..." -rm -rf "${RENAME_DIR}" - -if [ $RES -eq 1 ]; then - echo -e "\nReady." -fi diff --git a/Game/Code/linux-build.sh b/Game/Code/linux-build.sh deleted file mode 100755 index 7a1b82a2..00000000 --- a/Game/Code/linux-build.sh +++ /dev/null @@ -1,6 +0,0 @@ - -fpc -S2cgi -OG1 -gl -vewnhi -l -Filib/JEDI-SDLv1.0/SDL/Pas/ -Fu/usr/share/lazarus/components/images/lib/i386-linux/ -Fu/usr/share/lazarus/lcl/units/i386-linux/ -Fu/usr/share/lazarus/lcl/units/i386-linux/gtk2/ -Fu/usr/share/lazarus/packager/units/i386-linux/ -Fu. -oUltraStar -dLCL -dLCLgtk2 UltraStar.lpr - -cp ./UltraStar ../../../output/ - - -- cgit v1.2.3 From 575a05b31780cc02145e14476d8f5e343b676ad4 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 16:31:20 +0000 Subject: Changed Delphi-define to MSWINDOWS (works in FPC too) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@824 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCore.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UCore.pas b/Game/Code/Classes/UCore.pas index 9718b2eb..7e76c9c4 100644 --- a/Game/Code/Classes/UCore.pas +++ b/Game/Code/Classes/UCore.pas @@ -422,7 +422,7 @@ var Params: Cardinal; begin Result := -1; - {$IFDEF Delphi} + {$IFDEF MSWINDOWS} If (lParam<>nil) then begin Params := MB_OK; -- cgit v1.2.3 From 5df25a794dd5ba29729574560a1622f77f6b7048 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 16:34:22 +0000 Subject: updated to use the new UConfig.pas git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@825 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/Ulazjpeg.pas | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/Ulazjpeg.pas b/Game/Code/Classes/Ulazjpeg.pas index a5271a7e..2414002c 100644 --- a/Game/Code/Classes/Ulazjpeg.pas +++ b/Game/Code/Classes/Ulazjpeg.pas @@ -16,13 +16,15 @@ } unit Ulazjpeg; -{$mode objfpc}{$H+} +{$mode delphi} + {$I switches.inc} interface uses - SysUtils, Classes, FPImage, IntfGraphics, Graphics, FPReadJPEG, FPWriteJPEG; + SysUtils, Classes, FPImage, IntfGraphics, Graphics, FPReadJPEG, FPWriteJPEG, + UConfig; type TJPEGQualityRange = TFPJPEGCompressionQuality; @@ -34,17 +36,17 @@ type FProgressiveEncoding: boolean; FQuality: TJPEGQualityRange; protected -{$IFDEF LAZARUS_V0924} +{$IF LAZARUS_VERSION >= 000009024} // 0.9.24 procedure InitFPImageReader(IntfImg: TLazIntfImage; ImgReader: TFPCustomImageReader); override; {$ELSE} procedure InitFPImageReader(ImgReader: TFPCustomImageReader); override; -{$ENDIF} +{$IFEND} procedure FinalizeFPImageReader(ImgReader: TFPCustomImageReader); override; -{$IFDEF LAZARUS_V0924} +{$IF LAZARUS_VERSION >= 000009024} // 0.9.24 procedure InitFPImageWriter(IntfImg: TLazIntfImage; ImgWriter: TFPCustomImageWriter); override; {$ELSE} procedure InitFPImageWriter(ImgWriter: TFPCustomImageWriter); override; -{$ENDIF} +{$IFEND} public constructor Create; override; class function GetFileExtensions: string; override; @@ -65,26 +67,26 @@ implementation { TJPEGImage } -{$IFDEF LAZARUS_V0924} +{$IF LAZARUS_VERSION >= 000009024} // 0.9.24 procedure TJPEGImage.InitFPImageReader(IntfImg: TLazIntfImage; ImgReader: TFPCustomImageReader); {$ELSE} procedure TJPEGImage.InitFPImageReader(ImgReader: TFPCustomImageReader); -{$ENDIF} +{$IFEND} var JPEGReader: TFPReaderJPEG; begin if ImgReader is TFPReaderJPEG then begin JPEGReader:=TFPReaderJPEG(ImgReader); JPEGReader.Performance:=Performance; -{$IFDEF LAZARUS_V0924} - JPEGReader.OnProgress:=@Progress; -{$ENDIF} +{$IF LAZARUS_VERSION >= 000009024} // 0.9.24 + JPEGReader.OnProgress:=Progress; +{$IFEND} end; -{$IFDEF LAZARUS_V0924} +{$IF LAZARUS_VERSION >= 000009024} // 0.9.24 inherited InitFPImageReader(IntfImg, ImgReader); {$ELSE} inherited InitFPImageReader(ImgReader); -{$ENDIF} +{$IFEND} end; procedure TJPEGImage.FinalizeFPImageReader(ImgReader: TFPCustomImageReader); @@ -98,11 +100,11 @@ begin inherited FinalizeFPImageReader(ImgReader); end; -{$IFDEF LAZARUS_V0924} +{$IF LAZARUS_VERSION >= 000009024} // 0.9.24 procedure TJPEGImage.InitFPImageWriter(IntfImg: TLazIntfImage; ImgWriter: TFPCustomImageWriter); {$ELSE} procedure TJPEGImage.InitFPImageWriter(ImgWriter: TFPCustomImageWriter); -{$ENDIF} +{$IFEND} var JPEGWriter: TFPWriterJPEG; begin @@ -111,15 +113,15 @@ begin if JPEGWriter<>nil then ; JPEGWriter.ProgressiveEncoding:=ProgressiveEncoding; JPEGWriter.CompressionQuality:=CompressionQuality; -{$IFDEF LAZARUS_V0924} - JPEGWriter.OnProgress:=@Progress; -{$ENDIF} +{$IF LAZARUS_VERSION >= 000009024} // 0.9.24 + JPEGWriter.OnProgress:=Progress; +{$IFEND} end; -{$IFDEF LAZARUS_V0924} +{$IF LAZARUS_VERSION >= 000009024} // 0.9.24 inherited InitFPImageWriter(IntfImg, ImgWriter); {$ELSE} inherited InitFPImageWriter(ImgWriter); -{$ENDIF} +{$IFEND} end; class function TJPEGImage.GetDefaultFPReader: TFPCustomImageReaderClass; -- cgit v1.2.3 From 2e6592ceadb3e3c910164c76595e7ae435b8823a Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 17:13:47 +0000 Subject: Added a SafeWriteLn()-function to support thread-safe console-output. This is used in all Log...-Methods now (not for file-output yet). Don't use WriteLn anymore from external threads (for example in SDL or Portaudio Callbacks), otherwise FPC will crash. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@826 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/ULog.pas | 642 +++++++++++++++++++++++++-------------------- 1 file changed, 364 insertions(+), 278 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index c9c87a92..542fa0b3 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -1,278 +1,364 @@ -unit ULog; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses Classes; - -type - TLog = class - BenchmarkTimeStart: array[0..7] of real; - BenchmarkTimeLength: array[0..7] of real;//TDateTime; - - FileBenchmark: TextFile; - FileBenchmarkO: boolean; // opened - FileError: TextFile; - FileErrorO: boolean; // opened - - Title: String; //Application Title - - //Should Log Files be written - Enabled: Boolean; - - // destuctor - destructor Free; - - // benchmark - procedure BenchmarkStart(Number: integer); - procedure BenchmarkEnd(Number: integer); - procedure LogBenchmark(Text: string; Number: integer); - - // error - procedure LogError(Text: string); overload; - - //Critical Error (Halt + MessageBox) - procedure CriticalError(Text: string); - - // voice - procedure LogVoice(SoundNr: integer); - - // compability - procedure LogStatus(Log1, Log2: string); - procedure LogError(Log1, Log2: string); overload; - procedure LogBuffer(const buf : Pointer; const bufLength : Integer; filename : string); - end; - -var - Log: TLog; - -implementation - -uses - {$IFDEF win32} - windows, - {$ENDIF} - SysUtils, - DateUtils, -// UFiles, - UMain, - URecord, - UTime, -// UIni, // JB - Seems to not be needed. - UCommandLine; - -destructor TLog.Free; -begin - if FileBenchmarkO then CloseFile(FileBenchmark); -// if FileAnalyzeO then CloseFile(FileAnalyze); - if FileErrorO then CloseFile(FileError); -end; - -procedure TLog.BenchmarkStart(Number: integer); -begin - BenchmarkTimeStart[Number] := USTime.GetTime; //Time; -end; - -procedure TLog.BenchmarkEnd(Number: integer); -begin - BenchmarkTimeLength[Number] := USTime.GetTime {Time} - BenchmarkTimeStart[Number]; -end; - -procedure TLog.LogBenchmark(Text: string; Number: integer); -var - Minutes: integer; - Seconds: integer; - Miliseconds: integer; - - MinutesS: string; - SecondsS: string; - MilisecondsS: string; - - ValueText: string; -begin - if Enabled AND (Params.Benchmark) then begin - if not FileBenchmarkO then begin - FileBenchmarkO := true; - AssignFile(FileBenchmark, LogPath + 'Benchmark.log'); - {$I-} - Rewrite(FileBenchmark); - if IOResult = 0 then FileBenchmarkO := true; - {$I+} - - //If File is opened write Date to Benchmark File - If (FileBenchmarkO) then - begin - WriteLn(FileBenchmark, Title + ' Benchmark File'); - WriteLn(FileBenchmark, 'Date: ' + DatetoStr(Now) + ' Time: ' + TimetoStr(Now)); - WriteLn(FileBenchmark, '-------------------'); - - Flush(FileBenchmark); - end; - end; - - if FileBenchmarkO then begin - Miliseconds := Trunc(Frac(BenchmarkTimeLength[Number]) * 1000); - Seconds := Trunc(BenchmarkTimeLength[Number]) mod 60; - Minutes := Trunc((BenchmarkTimeLength[Number] - Seconds) / 60); -// ValueText := FloatToStr(BenchmarkTimeLength[Number]); - -{ ValueText := FloatToStr( - SecondOf(BenchmarkTimeLength[Number]) + MilliSecondOf(BenchmarkTimeLength[Number])/1000 - ); - if MinuteOf(BenchmarkTimeLength[Number]) >= 1 then - ValueText := IntToStr(MinuteOf(BenchmarkTimeLength[Number])) + ':' + ValueText; - WriteLn(FileBenchmark, Text + ': ' + ValueText + ' seconds');} - - if (Minutes = 0) and (Seconds = 0) then begin - MilisecondsS := IntToStr(Miliseconds); - ValueText := MilisecondsS + ' miliseconds'; - end; - - if (Minutes = 0) and (Seconds >= 1) then begin - MilisecondsS := IntToStr(Miliseconds); - while Length(MilisecondsS) < 3 do MilisecondsS := '0' + MilisecondsS; - - SecondsS := IntToStr(Seconds); - - ValueText := SecondsS + ',' + MilisecondsS + ' seconds'; - end; - - if Minutes >= 1 then begin - MilisecondsS := IntToStr(Miliseconds); - while Length(MilisecondsS) < 3 do MilisecondsS := '0' + MilisecondsS; - - SecondsS := IntToStr(Seconds); - while Length(SecondsS) < 2 do SecondsS := '0' + SecondsS; - - MinutesS := IntToStr(Minutes); - - ValueText := MinutesS + ':' + SecondsS + ',' + MilisecondsS + ' minutes'; - end; - - WriteLn(FileBenchmark, Text + ': ' + ValueText); - Flush(FileBenchmark); - end; - end; -end; - -procedure TLog.LogError(Text: string); -begin - if Enabled AND (not FileErrorO) then begin - //FileErrorO := true; - AssignFile(FileError, LogPath + 'Error.log'); - {$I-} - Rewrite(FileError); - if IOResult = 0 then FileErrorO := true; - {$I+} - - //If File is opened write Date to Error File - If (FileErrorO) then - begin - WriteLn(FileError, Title + ' Error Log'); - WriteLn(FileError, 'Date: ' + DatetoStr(Now) + ' Time: ' + TimetoStr(Now)); - WriteLn(FileError, '-------------------'); - - Flush(FileError); - end; - end; - - if FileErrorO then begin - try - WriteLn(FileError, Text); - Flush(FileError); - except - FileErrorO := false; - end; - end; - {$IFDEF DEBUG} - WriteLn('Error: ' + Text); - {$ENDIF} -end; - -procedure TLog.LogVoice(SoundNr: integer); -var - FileVoice: File; - FS: TFileStream; - FileName: string; - Num: integer; - BL: integer; -begin - for Num := 1 to 9999 do begin - FileName := IntToStr(Num); - while Length(FileName) < 4 do FileName := '0' + FileName; - FileName := LogPath + 'Voice' + FileName + '.raw'; - if not FileExists(FileName) then break - end; - - - FS := TFileStream.Create(FileName, fmCreate); - - for BL := 0 to High(AudioInputProcessor.Sound[SoundNr].BufferLong) do begin - AudioInputProcessor.Sound[SoundNr].BufferLong[BL].Seek(0, soBeginning); - FS.CopyFrom(AudioInputProcessor.Sound[SoundNr].BufferLong[BL], AudioInputProcessor.Sound[SoundNr].BufferLong[BL].Size); - end; - - FS.Free; -end; - -procedure TLog.LogStatus(Log1, Log2: string); -begin - //Just for Debugging - //Comment for Release - //LogError(Log2 + ': ' + Log1); - - //If Debug => Write to Console Output - {$IFDEF DEBUG} -// WriteLn(Log2 + ': ' + Log1); - {$ENDIF} -end; - -procedure TLog.LogError(Log1, Log2: string); -begin - LogError(Log1 + ' ['+Log2+']'); -end; - -procedure TLog.CriticalError(Text: string); -begin - //Write Error to Logfile: - LogError (Text); - - {$IFDEF MSWINDOWS} - //Show Errormessage - Messagebox(0, PChar(Text), PChar(Title), MB_ICONERROR or MB_OK); - {$ELSE} - // TODO - JB_Linux handle critical error so user can see message. - writeln( 'Critical ERROR :' ); - writeln( Text ); - {$ENDIF} - - //Exit Application - Halt; -end; - -procedure TLog.LogBuffer(const buf: Pointer; const bufLength: Integer; filename: string); -var - f : TFileStream; -begin - f := nil; - - try - f := TFileStream.Create( filename, fmCreate); - f.Write( buf^, bufLength); - f.Free; - except - on e : Exception do begin - Log.LogError('TLog.LogBuffer: Failed to log buffer into file "' + filename + '". ErrMsg: ' + e.Message); - f.Free; - end; - end; -end; - -end. - - +unit ULog; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + Classes; + +type + TLog = class + public + BenchmarkTimeStart: array[0..7] of real; + BenchmarkTimeLength: array[0..7] of real;//TDateTime; + + FileBenchmark: TextFile; + FileBenchmarkO: boolean; // opened + FileError: TextFile; + FileErrorO: boolean; // opened + + Title: String; //Application Title + + //Should Log Files be written + Enabled: Boolean; + + constructor Create; + + // destuctor + destructor Destroy; override; + + // benchmark + procedure BenchmarkStart(Number: integer); + procedure BenchmarkEnd(Number: integer); + procedure LogBenchmark(Text: string; Number: integer); + + // error + procedure LogError(Text: string); overload; + + //Critical Error (Halt + MessageBox) + procedure CriticalError(Text: string); + + // voice + procedure LogVoice(SoundNr: integer); + + // compability + procedure LogStatus(Log1, Log2: string); + procedure LogError(Log1, Log2: string); overload; + procedure LogBuffer(const buf : Pointer; const bufLength : Integer; filename : string); + end; + +procedure SafeWriteLn(const msg: string); inline; + +var + Log: TLog; + +implementation + +uses + {$IFDEF win32} + windows, + {$ENDIF} + SysUtils, + DateUtils, +//UFiles, + UMain, + URecord, + UTime, +//UIni, // JB - Seems to not be needed. + {$IFDEF FPC} + sdl, + {$ENDIF} + UCommandLine; + +{$IFDEF FPC} +var + MessageList: TStringList; + ConsoleHandler: TThreadID; + ConsoleMutex: PSDL_Mutex; + ConsoleCond: PSDL_Cond; +{$ENDIF} + +{$IFDEF FPC} +{* + * The console-handlers main-function. + * TODO: create a quit-event on closing. + *} +function ConsoleHandlerFunc(param: pointer): PtrInt; +var + i: integer; +begin + while true do + begin + SDL_mutexP(ConsoleMutex); + while (MessageList.Count = 0) do + SDL_CondWait(ConsoleCond, ConsoleMutex); + for i := 0 to MessageList.Count-1 do + begin + WriteLn(MessageList[i]); + end; + MessageList.Clear(); + SDL_mutexV(ConsoleMutex); + end; + result := 0; +end; +{$ENDIF} + +{* + * With FPC console output is not thread-safe. + * Using WriteLn() from external threads (like in SDL callbacks) + * will damage the heap and crash the program. + * Most probably FPC uses thread-local-data (TLS) to lock a mutex on + * the console-buffer. This does not work with external lib's threads + * because these do not have the TLS data and so it crashes while + * accessing unallocated memory. + * The solution is to create an FPC-managed thread which has the TLS data + * and use it to handle the console-output (hence it is called Console-Handler) + * It should be safe to do so, but maybe FPC requires the main-thread to access + * the console-buffer only. In this case output should be delegated to it. + * + * TODO: - check if it is safe if an FPC-managed thread different than the + * main-thread accesses the console-buffer in FPC. + * - check if Delphi's WriteLn is thread-safe. + * - check if we need to synchronize file-output too + * - Use TEvent and TCriticalSection instead of the SDL equivalents. + * Note: If those two objects use TLS they might crash FPC too. + *} +procedure SafeWriteLn(const msg: string); +begin +{$IFDEF FPC} + SDL_mutexP(ConsoleMutex); + MessageList.Add(msg); + SDL_CondSignal(ConsoleCond); + SDL_mutexV(ConsoleMutex); +{$ELSE} + WriteLn(msg); +{$ENDIF} +end; + +constructor TLog.Create; +begin +{$IFDEF FPC} + // TODO: check for the main-thread? + //GetCurrentThreadThreadId(); + MessageList := TStringList.Create(); + ConsoleMutex := SDL_CreateMutex(); + ConsoleCond := SDL_CreateCond(); + ConsoleHandler := BeginThread(@ConsoleHandlerFunc); +{$ENDIF} +end; + +destructor TLog.Destroy; +begin + if FileBenchmarkO then CloseFile(FileBenchmark); +// if FileAnalyzeO then CloseFile(FileAnalyze); + if FileErrorO then CloseFile(FileError); +end; + +procedure TLog.BenchmarkStart(Number: integer); +begin + BenchmarkTimeStart[Number] := USTime.GetTime; //Time; +end; + +procedure TLog.BenchmarkEnd(Number: integer); +begin + BenchmarkTimeLength[Number] := USTime.GetTime {Time} - BenchmarkTimeStart[Number]; +end; + +procedure TLog.LogBenchmark(Text: string; Number: integer); +var + Minutes: integer; + Seconds: integer; + Miliseconds: integer; + + MinutesS: string; + SecondsS: string; + MilisecondsS: string; + + ValueText: string; +begin + if Enabled AND (Params.Benchmark) then begin + if not FileBenchmarkO then begin + FileBenchmarkO := true; + AssignFile(FileBenchmark, LogPath + 'Benchmark.log'); + {$I-} + Rewrite(FileBenchmark); + if IOResult = 0 then FileBenchmarkO := true; + {$I+} + + //If File is opened write Date to Benchmark File + If (FileBenchmarkO) then + begin + WriteLn(FileBenchmark, Title + ' Benchmark File'); + WriteLn(FileBenchmark, 'Date: ' + DatetoStr(Now) + ' Time: ' + TimetoStr(Now)); + WriteLn(FileBenchmark, '-------------------'); + + Flush(FileBenchmark); + end; + end; + + if FileBenchmarkO then begin + Miliseconds := Trunc(Frac(BenchmarkTimeLength[Number]) * 1000); + Seconds := Trunc(BenchmarkTimeLength[Number]) mod 60; + Minutes := Trunc((BenchmarkTimeLength[Number] - Seconds) / 60); +// ValueText := FloatToStr(BenchmarkTimeLength[Number]); + +{ ValueText := FloatToStr( + SecondOf(BenchmarkTimeLength[Number]) + MilliSecondOf(BenchmarkTimeLength[Number])/1000 + ); + if MinuteOf(BenchmarkTimeLength[Number]) >= 1 then + ValueText := IntToStr(MinuteOf(BenchmarkTimeLength[Number])) + ':' + ValueText; + WriteLn(FileBenchmark, Text + ': ' + ValueText + ' seconds');} + + if (Minutes = 0) and (Seconds = 0) then begin + MilisecondsS := IntToStr(Miliseconds); + ValueText := MilisecondsS + ' miliseconds'; + end; + + if (Minutes = 0) and (Seconds >= 1) then begin + MilisecondsS := IntToStr(Miliseconds); + while Length(MilisecondsS) < 3 do MilisecondsS := '0' + MilisecondsS; + + SecondsS := IntToStr(Seconds); + + ValueText := SecondsS + ',' + MilisecondsS + ' seconds'; + end; + + if Minutes >= 1 then begin + MilisecondsS := IntToStr(Miliseconds); + while Length(MilisecondsS) < 3 do MilisecondsS := '0' + MilisecondsS; + + SecondsS := IntToStr(Seconds); + while Length(SecondsS) < 2 do SecondsS := '0' + SecondsS; + + MinutesS := IntToStr(Minutes); + + ValueText := MinutesS + ':' + SecondsS + ',' + MilisecondsS + ' minutes'; + end; + + WriteLn(FileBenchmark, Text + ': ' + ValueText); + Flush(FileBenchmark); + end; + end; +end; + +procedure TLog.LogError(Text: string); +begin + if Enabled AND (not FileErrorO) then begin + //FileErrorO := true; + AssignFile(FileError, LogPath + 'Error.log'); + {$I-} + Rewrite(FileError); + if IOResult = 0 then FileErrorO := true; + {$I+} + + //If File is opened write Date to Error File + If (FileErrorO) then + begin + WriteLn(FileError, Title + ' Error Log'); + WriteLn(FileError, 'Date: ' + DatetoStr(Now) + ' Time: ' + TimetoStr(Now)); + WriteLn(FileError, '-------------------'); + + Flush(FileError); + end; + end; + + if FileErrorO then begin + try + WriteLn(FileError, Text); + Flush(FileError); + except + FileErrorO := false; + end; + end; + {$IFDEF DEBUG} + SafeWriteLn('Error: ' + Text); + {$ENDIF} +end; + +procedure TLog.LogVoice(SoundNr: integer); +var + FileVoice: File; + FS: TFileStream; + FileName: string; + Num: integer; + BL: integer; +begin + for Num := 1 to 9999 do begin + FileName := IntToStr(Num); + while Length(FileName) < 4 do FileName := '0' + FileName; + FileName := LogPath + 'Voice' + FileName + '.raw'; + if not FileExists(FileName) then break + end; + + + FS := TFileStream.Create(FileName, fmCreate); + + for BL := 0 to High(AudioInputProcessor.Sound[SoundNr].BufferLong) do begin + AudioInputProcessor.Sound[SoundNr].BufferLong[BL].Seek(0, soBeginning); + FS.CopyFrom(AudioInputProcessor.Sound[SoundNr].BufferLong[BL], AudioInputProcessor.Sound[SoundNr].BufferLong[BL].Size); + end; + + FS.Free; +end; + +procedure TLog.LogStatus(Log1, Log2: string); +begin + //Just for Debugging + //Comment for Release + //LogError(Log2 + ': ' + Log1); + + //If Debug => Write to Console Output + {$IFDEF DEBUG} + // SafeWriteLn(Log2 + ': ' + Log1); + {$ENDIF} +end; + +procedure TLog.LogError(Log1, Log2: string); +begin + LogError(Log1 + ' ['+Log2+']'); +end; + +procedure TLog.CriticalError(Text: string); +begin + //Write Error to Logfile: + LogError (Text); + + {$IFDEF MSWINDOWS} + //Show Errormessage + Messagebox(0, PChar(Text), PChar(Title), MB_ICONERROR or MB_OK); + {$ELSE} + // TODO - JB_Linux handle critical error so user can see message. + SafeWriteLn( 'Critical ERROR :' ); + SafeWriteLn( Text ); + {$ENDIF} + + //Exit Application + Halt; +end; + +procedure TLog.LogBuffer(const buf: Pointer; const bufLength: Integer; filename: string); +var + f : TFileStream; +begin + f := nil; + + try + f := TFileStream.Create( filename, fmCreate); + f.Write( buf^, bufLength); + f.Free; + except + on e : Exception do begin + Log.LogError('TLog.LogBuffer: Failed to log buffer into file "' + filename + '". ErrMsg: ' + e.Message); + f.Free; + end; + end; +end; + +end. + + -- 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/Classes/UAudioDecoder_FFMpeg.pas | 197 +- Game/Code/Classes/UAudioInput_Bass.pas | 490 ++--- Game/Code/Classes/UAudioInput_Portaudio.pas | 331 ++- Game/Code/Classes/UAudioPlayback_Bass.pas | 450 ++-- Game/Code/Classes/UAudioPlayback_Portaudio.pas | 608 ++--- Game/Code/Classes/UDraw.pas | 20 +- Game/Code/Classes/UIni.pas | 1599 +++++++------- Game/Code/Classes/UMain.pas | 35 +- Game/Code/Classes/UMedia_dummy.pas | 474 ++-- Game/Code/Classes/UMusic.pas | 915 ++++---- Game/Code/Classes/URecord.pas | 850 ++++--- Game/Code/Screens/UScreenCredits.pas | 2804 ++++++++++++------------ Game/Code/Screens/UScreenEdit.pas | 6 +- Game/Code/Screens/UScreenEditConvert.pas | 4 +- Game/Code/Screens/UScreenEditSub.pas | 2 +- Game/Code/Screens/UScreenLevel.pas | 4 +- Game/Code/Screens/UScreenMain.pas | 18 +- Game/Code/Screens/UScreenName.pas | 4 +- Game/Code/Screens/UScreenOpen.pas | 6 +- Game/Code/Screens/UScreenOptions.pas | 18 +- Game/Code/Screens/UScreenOptionsAdvanced.pas | 8 +- Game/Code/Screens/UScreenOptionsGame.pas | 8 +- Game/Code/Screens/UScreenOptionsGraphics.pas | 8 +- Game/Code/Screens/UScreenOptionsLyrics.pas | 8 +- Game/Code/Screens/UScreenOptionsRecord.pas | 444 ++-- Game/Code/Screens/UScreenOptionsSound.pas | 8 +- Game/Code/Screens/UScreenOptionsThemes.pas | 8 +- Game/Code/Screens/UScreenPartyNewRound.pas | 4 +- Game/Code/Screens/UScreenPartyOptions.pas | 8 +- Game/Code/Screens/UScreenPartyPlayer.pas | 2 +- Game/Code/Screens/UScreenPartyScore.pas | 4 +- Game/Code/Screens/UScreenPartyWin.pas | 4 +- Game/Code/Screens/UScreenSing.pas | 2 +- Game/Code/Screens/UScreenSingModi.pas | 38 +- Game/Code/Screens/UScreenSong.pas | 52 +- Game/Code/Screens/UScreenSongJumpto.pas | 2 +- Game/Code/Screens/UScreenSongMenu.pas | 2 +- Game/Code/Screens/UScreenStatDetail.pas | 4 +- Game/Code/Screens/UScreenStatMain.pas | 6 +- 39 files changed, 4771 insertions(+), 4684 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudioDecoder_FFMpeg.pas b/Game/Code/Classes/UAudioDecoder_FFMpeg.pas index c705d603..646e9eef 100644 --- a/Game/Code/Classes/UAudioDecoder_FFMpeg.pas +++ b/Game/Code/Classes/UAudioDecoder_FFMpeg.pas @@ -17,36 +17,33 @@ interface {$MODE Delphi} {$ENDIF} -{$I switches.inc} - - -uses Classes, - {$IFDEF win32} - windows, - {$ENDIF} - SysUtils, - SDL, - avcodec, // FFMpeg Audio file decoding - avformat, - avutil, - avio, // used for url_ferror - mathematics, // used for av_rescale_q - ULog, - UMusic; +{$I ../switches.inc} + + +uses + Classes, + {$IFDEF win32} + windows, + {$ENDIF} + SysUtils, + UMusic; implementation uses - {$IFDEF LAZARUS} - lclintf, - {$ifndef win32} - libc, - {$endif} - {$ENDIF} - UIni, - UMain, - UThemes, - UConfig; + {$ifndef win32} + libc, + {$endif} + UIni, + UMain, + avcodec, // FFMpeg Audio file decoding + avformat, + avutil, + avio, // used for url_ferror + mathematics, // used for av_rescale_q + SDL, + ULog, + UConfig; type @@ -106,12 +103,12 @@ type ffmpegStreamIndex : Integer; ffmpegStream : PAVStream; - // "static" vars for DecodeFrame + // state-vars for DecodeFrame pkt : TAVPacket; audio_pkt_data : PChar; audio_pkt_size : integer; - // "static" vars for AudioCallback + // state-vars for AudioCallback audio_buf_index : cardinal; audio_buf_size : cardinal; audio_buf : TAudioBuffer; @@ -127,8 +124,7 @@ type procedure Close(); override; function GetLength(): real; override; - function GetChannelCount(): cardinal; override; - function GetSampleRate(): cardinal; override; + function GetAudioFormatInfo(): TAudioFormatInfo; override; function GetPosition: real; override; procedure SetPosition(Time: real); override; function IsEOF(): boolean; override; @@ -169,7 +165,7 @@ begin audio_buf_index := 0; audio_buf_size := 0; - FillChar(pkt, sizeof(TAVPacket), #0); + FillChar(pkt, sizeof(TAVPacket), 0); Self.pFormatCtx := pFormatCtx; Self.pCodecCtx := pCodecCtx; @@ -221,14 +217,12 @@ begin result := pFormatCtx^.duration / AV_TIME_BASE; end; -function TFFMpegDecodeStream.GetChannelCount(): cardinal; -begin - result := pCodecCtx^.channels; -end; - -function TFFMpegDecodeStream.GetSampleRate(): cardinal; +function TFFMpegDecodeStream.GetAudioFormatInfo(): TAudioFormatInfo; begin - result := pCodecCtx^.sample_rate; + result.Channels := pCodecCtx^.channels; + result.SampleRate := pCodecCtx^.sample_rate; + //result.Format := pCodecCtx^.sample_fmt; // sample_fmt not yet used by FFMpeg + result.Format := asfS16; // use FFMpeg's standard format end; function TFFMpegDecodeStream.IsEOF(): boolean; @@ -260,7 +254,7 @@ begin SDL_mutexP(lock); seekPos := Trunc(Time * AV_TIME_BASE); // FIXME: seek_flags = rel < 0 ? AVSEEK_FLAG_BACKWARD : 0 - seekFlags := 0; + seekFlags := 0;//AVSEEK_FLAG_BACKWARD; seekRequest := true; SDL_CondSignal(resumeCond); SDL_mutexV(lock); @@ -279,9 +273,9 @@ begin while (true) do begin + //SafeWriteLn('Hallo'); SDL_mutexP(stream.lock); - // wait if end-of-file reached if (eofState) then begin @@ -309,18 +303,19 @@ begin // TODO: Do we need this? // The position is converted to AV_TIME_BASE and then to the stream-specific base. // Why not convert to the stream-specific one from the beginning. - seekTarget := av_rescale_q(stream.seekPos, AV_TIME_BASE_Q, stream.ffmpegStream^.time_base); - if(av_seek_frame(stream.pFormatCtx, stream.ffmpegStreamIndex, - seekTarget, stream.seekFlags) = 0) then - begin - Log.LogStatus(stream.pFormatCtx^.filename + ': error while seeking', 'UAudioDecoder_FFMpeg'); - end - else - begin - stream.packetQueue.Flush(); - stream.packetQueue.Put(@FlushPacket); - end; - stream.seekRequest := false; + seekTarget := av_rescale_q(stream.seekPos, AV_TIME_BASE_Q, stream.ffmpegStream^.time_base); + if(av_seek_frame(stream.pFormatCtx, stream.ffmpegStreamIndex, + seekTarget, stream.seekFlags) < 0) then + begin + // this will crash in FPC due to a bug + //Log.LogStatus({stream.pFormatCtx^.filename +} ': error while seeking', 'UAudioDecoder_FFMpeg'); + end + else + begin + stream.packetQueue.Flush(); + stream.packetQueue.Put(@FlushPacket); + end; + stream.seekRequest := false; end; SDL_mutexV(stream.lock); @@ -340,8 +335,10 @@ begin {$ELSE} pbIOCtx := @stream.pFormatCtx^.pb; {$IFEND} + if(url_feof(pbIOCtx) <> 0) then begin + SafeWriteLn('feof'); eofState := true; continue; end; @@ -349,24 +346,25 @@ begin // check for errors if(url_ferror(pbIOCtx) = 0) then begin + SafeWriteLn('Errorf'); // no error -> wait for user input - SDL_Delay(100); - continue; - end - else - begin - // an error occured -> abort - // TODO: eof or quit? - eofState := true; - continue; - end; - end; - - //writeln( 'ffmpeg - av_read_frame' ); + SDL_Delay(100); + continue; + end + else + begin + // an error occured -> abort + // TODO: eof or quit? + eofState := true; + continue; + end; + end; + + //SafeWriteLn( 'ffmpeg - av_read_frame' ); if(packet.stream_index = stream.ffmpegStreamIndex) then begin - //writeln( 'packet_queue_put' ); + //SafeWriteLn( 'packet_queue_put' ); stream.packetQueue.put(@packet); end else @@ -375,7 +373,7 @@ begin end; end; - //Writeln('Done: ' + inttostr(stream.packetQueue.nbPackets)); + SafeWriteLn('Done: ' + inttostr(stream.packetQueue.nbPackets)); result := 0; end; @@ -394,21 +392,25 @@ begin begin while (audio_pkt_size > 0) do begin - //writeln( 'got audio packet' ); + //SafeWriteLn( 'got audio packet' ); data_size := bufSize; - // TODO: should be avcodec_decode_audio2 but this wont link on my ubuntu box. + {$IF LIBAVCODEC_VERSION >= 51030000} // 51.30.0 + len1 := avcodec_decode_audio2(pCodecCtx, @buffer, + data_size, audio_pkt_data, audio_pkt_size); + {$ELSE} // FIXME: with avcodec_decode_audio a package could contain several frames // this is not handled yet len1 := avcodec_decode_audio(pCodecCtx, @buffer, data_size, audio_pkt_data, audio_pkt_size); + {$IFEND} - //writeln('avcodec_decode_audio : ' + inttostr( len1 )); + //SafeWriteLn('avcodec_decode_audio : ' + inttostr( len1 )); if(len1 < 0) then begin - // if error, skip frame - //writeln( 'Skip audio frame' ); + // if error, skip frame + SafeWriteLn( 'Skip audio frame' ); audio_pkt_size := 0; break; end; @@ -444,6 +446,7 @@ begin if (audio_pkt_data = PChar(FlushPacket.data)) then begin avcodec_flush_buffers(pCodecCtx); + SafeWriteLn('Flush'); continue; end; @@ -452,11 +455,12 @@ begin begin // end-of-file reached -> set EOF-flag SetEOF(true); + SafeWriteLn('EOF'); // note: buffer is not (even partially) filled -> no data to return exit; end; - //writeln( 'Audio Packet Size - ' + inttostr(audio_pkt_size) ); + //SafeWriteLn( 'Audio Packet Size - ' + inttostr(audio_pkt_size) ); end; end; @@ -480,14 +484,14 @@ begin begin // We have already sent all our data; get more audio_size := DecodeFrame(audio_buf, sizeof(TAudioBuffer)); - //writeln('audio_decode_frame : '+ inttostr(audio_size)); + //SafeWriteLn('audio_decode_frame : '+ inttostr(audio_size)); if(audio_size < 0) then begin // If error, output silence audio_buf_size := 1024; FillChar(audio_buf, audio_buf_size, #0); - //writeln( 'Silence' ); + //SafeWriteLn( 'Silence' ); end else begin @@ -531,11 +535,11 @@ begin // init end-of-file package av_init_packet(EOFPacket); - EOFPacket.data := Pointer(PChar('EOF')); + EOFPacket.data := Pointer(PChar('EOF')); // init flush package av_init_packet(FlushPacket); - FlushPacket.data := Pointer(PChar('FLUSH')); + FlushPacket.data := Pointer(PChar('FLUSH')); result := true; end; @@ -611,7 +615,7 @@ begin end; avcodec_open(pCodecCtx, pCodec); - //writeln( 'Opened the codec' ); + //WriteLn( 'Opened the codec' ); stream := TFFMpegDecodeStream.Create(pFormatCtx, pCodecCtx, pCodec, ffmpegStreamID, ffmpegStream); @@ -671,7 +675,7 @@ begin Self.lastPkt := pkt1; inc(Self.nbPackets); - //Writeln('Put: ' + inttostr(nbPackets)); + //SafeWriteLn('Put: ' + inttostr(nbPackets)); Self.size := Self.size + pkt1^.pkt.size; SDL_CondSignal(Self.cond); @@ -705,7 +709,7 @@ begin Self.lastPkt := nil; dec(Self.nbPackets); - //Writeln('Get: ' + inttostr(nbPackets)); + //SafeWriteLn('Get: ' + inttostr(nbPackets)); Self.size := Self.size - pkt1^.pkt.size; pkt := pkt1^.pkt; @@ -734,22 +738,23 @@ procedure TPacketQueue.Flush(); var pkt, pkt1: PAVPacketList; begin - SDL_LockMutex(Self.mutex); - - pkt := Self.firstPkt; - while(pkt <> nil) do - begin - pkt1 := pkt^.next; - av_free_packet(@pkt^.pkt); - av_freep(pkt); - pkt := pkt1; - end; - Self.lastPkt := nil; - Self.firstPkt := nil; - Self.nbPackets := 0; - Self.size := 0; - - SDL_UnlockMutex(Self.mutex); + SDL_LockMutex(Self.mutex); + + pkt := Self.firstPkt; + while(pkt <> nil) do + begin + pkt1 := pkt^.next; + av_free_packet(@pkt^.pkt); + // Note: param must be a pointer to a pointer! + av_freep(@pkt); + pkt := pkt1; + end; + Self.lastPkt := nil; + Self.firstPkt := nil; + Self.nbPackets := 0; + Self.size := 0; + + SDL_UnlockMutex(Self.mutex); end; diff --git a/Game/Code/Classes/UAudioInput_Bass.pas b/Game/Code/Classes/UAudioInput_Bass.pas index 75a5aee5..6d661258 100644 --- a/Game/Code/Classes/UAudioInput_Bass.pas +++ b/Game/Code/Classes/UAudioInput_Bass.pas @@ -1,287 +1,203 @@ -unit UAudioInput_Bass; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - - -uses Classes, - {$IFDEF win32} - windows, - {$ENDIF} - SysUtils, - bass, - ULog, - UMusic; - -implementation - -uses - {$IFDEF LAZARUS} - lclintf, - {$ENDIF} - URecord, - UIni, - UMain, - UCommon, - UThemes; - -type - TAudioInput_Bass = class( TInterfacedObject, IAudioInput) - private - public - function GetName: String; - - {IAudioInput interface} - procedure InitializeRecord; - - procedure CaptureStart; - procedure CaptureStop; - procedure CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); - procedure StopCard(Card: byte); - end; - - TBassSoundCard = class(TGenericSoundCard) - RecordStream: HSTREAM; - end; - -var - singleton_AudioInputBass : IAudioInput; - - -function TAudioInput_Bass.GetName: String; -begin - result := 'BASS_Input'; -end; - -procedure TAudioInput_Bass.InitializeRecord; -var - device: integer; - Descr: string; - input: integer; - input2: integer; - InputName: PChar; - Flags: integer; - mic: array[0..15] of integer; - SC: integer; // soundcard - SCI: integer; // soundcard input - No: integer; - -function isDuplicate(Desc: String): Boolean; -var - I: Integer; -begin - Result := False; - //Check for Soundcard with same Description - For I := 0 to SC-1 do - begin - if (AudioInputProcessor.SoundCard[I].Description = Desc) then - begin - Result := True; - Break; - end; - end; -end; - -begin - with AudioInputProcessor do - begin - // checks for recording devices and puts them into an array - SetLength(SoundCard, 0); - - SC := 0; - Descr := BASS_RecordGetDeviceDescription(SC); - - while (Descr <> '') do - begin - //If there is another SoundCard with the Same ID, Search an available Name - if (IsDuplicate(Descr)) then - begin - No:= 1; //Count of SoundCards with same Name - Repeat - Inc(No) - Until not IsDuplicate(Descr + ' (' + InttoStr(No) + ')'); - - //Set Description - Descr := Descr + ' (' + InttoStr(No) + ')'; - end; - - SetLength(SoundCard, SC+1); - - // TODO: free object on termination - SoundCard[SC] := TBassSoundCard.Create(); - SoundCard[SC].Description := Descr; - - //Get Recording Inputs - SCI := 0; - BASS_RecordInit(SC); - - InputName := BASS_RecordGetInputName(SCI); - - {$IFDEF DARWIN} - // Under MacOSX the SingStar Mics have an empty - // InputName. So, we have to add a hard coded - // Workaround for this problem - if (InputName = nil) and (Pos( 'USBMIC Serial#', Descr) > 0) then - begin - InputName := 'Microphone'; - end; - {$ENDIF} - - SetLength(SoundCard[SC].Input, 1); - SoundCard[SC].Input[SCI].Name := InputName; - - // process each input - while (InputName <> nil) do - begin - Flags := BASS_RecordGetInput(SCI); - if (SCI >= 1) {AND (Flags AND BASS_INPUT_OFF = 0)} then - begin - SetLength(SoundCard[SC].Input, SCI+1); - SoundCard[SC].Input[SCI].Name := InputName; - end; - - //Set Mic Index - if ((Flags and BASS_INPUT_TYPE_MIC) = 1) then - SoundCard[SC].MicInput := SCI; - - Inc(SCI); - InputName := BASS_RecordGetInputName(SCI); - end; - - BASS_RecordFree; - - Inc(SC); - Descr := BASS_RecordGetDeviceDescription(SC); - end; // while - end; // with Recording -end; - -// TODO: code is used by all IAudioInput implementors -// -> move to a common superclass (TAudioInput_Generic?) -procedure TAudioInput_Bass.CaptureStart; -var - S: integer; - SC: integer; - PlayerLeft, PlayerRight: integer; - CaptureSoundLeft, CaptureSoundRight: TSound; -begin - for S := 0 to High(AudioInputProcessor.Sound) do - AudioInputProcessor.Sound[S].BufferLong[0].Clear; - - for SC := 0 to High(Ini.CardList) do - begin - PlayerLeft := Ini.CardList[SC].ChannelL-1; - PlayerRight := Ini.CardList[SC].ChannelR-1; - if PlayerLeft >= PlayersPlay then PlayerLeft := -1; - if PlayerRight >= PlayersPlay then PlayerRight := -1; - if (PlayerLeft > -1) or (PlayerRight > -1) then begin - if (PlayerLeft > -1) then - CaptureSoundLeft := AudioInputProcessor.Sound[PlayerLeft] - else - CaptureSoundLeft := nil; - if (PlayerRight > -1) then - CaptureSoundRight := AudioInputProcessor.Sound[PlayerRight] - else - CaptureSoundRight := nil; - - CaptureCard(SC, CaptureSoundLeft, CaptureSoundRight); - end; - end; -end; - -// TODO: code is used by all IAudioInput implementors -// -> move to a common superclass (TAudioInput_Generic?) -procedure TAudioInput_Bass.CaptureStop; -var - SC: integer; - PlayerLeft: integer; - PlayerRight: integer; -begin - - for SC := 0 to High(Ini.CardList) do begin - PlayerLeft := Ini.CardList[SC].ChannelL-1; - PlayerRight := Ini.CardList[SC].ChannelR-1; - if PlayerLeft >= PlayersPlay then PlayerLeft := -1; - if PlayerRight >= PlayersPlay then PlayerRight := -1; - if (PlayerLeft > -1) or (PlayerRight > -1) then - StopCard(SC); - end; - -end; - -{* - * Bass input capture callback. - * Params: - * stream - BASS input stream - * buffer - buffer of captured samples - * len - size of buffer in bytes - * user - players associated with left/right channels - *} -function MicrophoneCallback(stream: HSTREAM; buffer: Pointer; - len: Cardinal; Card: Cardinal): boolean; stdcall; -begin - AudioInputProcessor.HandleMicrophoneData(buffer, len, AudioInputProcessor.SoundCard[Card]); - Result := true; -end; - -{* - * Start input-capturing on Soundcard specified by Card. - * Params: - * Card - soundcard index in AudioInputProcessor.SoundCard array - * CaptureSoundLeft - sound(-buffer) used for left channel capture data - * CaptureSoundRight - sound(-buffer) used for right channel capture data - *} -procedure TAudioInput_Bass.CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); -var - Error: integer; - ErrorMsg: string; - bassSoundCard: TBassSoundCard; -begin - if not BASS_RecordInit(Card) then - begin - Error := BASS_ErrorGetCode; - ErrorMsg := IntToStr(Error); - if Error = BASS_ERROR_DX then ErrorMsg := 'No DX5'; - if Error = BASS_ERROR_ALREADY then ErrorMsg := 'The device has already been initialized'; - if Error = BASS_ERROR_DEVICE then ErrorMsg := 'The device number specified is invalid'; - if Error = BASS_ERROR_DRIVER then ErrorMsg := 'There is no available device driver'; - Log.LogError('Error initializing record [' + IntToStr(Card) + ']'); - Log.LogError('TAudio_bass.CaptureCard: Error initializing record: ' + ErrorMsg); - end - else - begin - bassSoundCard := TBassSoundCard(AudioInputProcessor.SoundCard[Card]); - bassSoundCard.CaptureSoundLeft := CaptureSoundLeft; - bassSoundCard.CaptureSoundRight := CaptureSoundRight; - - // capture in 44.1kHz/stereo/16bit and a 20ms callback period - bassSoundCard.RecordStream := - BASS_RecordStart(44100, 2, MakeLong(0, 20) , @MicrophoneCallback, Card); - end; -end; - -{* - * Stop input-capturing on Soundcard specified by Card. - * Params: - * Card - soundcard index in AudioInputProcessor.SoundCard array - *} -procedure TAudioInput_Bass.StopCard(Card: byte); -begin - BASS_RecordSetDevice(Card); - BASS_RecordFree; -end; - - -initialization - singleton_AudioInputBass := TAudioInput_Bass.create(); - AudioManager.add( singleton_AudioInputBass ); - -finalization - AudioManager.Remove( singleton_AudioInputBass ); - -end. +unit UAudioInput_Bass; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +uses + Classes, + SysUtils, + URecord, + UMusic; + +implementation + +uses + UMain, + UIni, + ULog, + UAudioCore_Bass, + Windows, + bass; + +type + TAudioInput_Bass = class(TAudioInputBase) + public + function GetName: String; override; + function InitializeRecord: boolean; override; + destructor Destroy; override; + end; + + TBassInputDevice = class(TAudioInputDevice) + public + DeviceIndex: integer; // index in TAudioInputProcessor.Device[] + BassDeviceID: integer; // DeviceID used by BASS + RecordStream: HSTREAM; + + procedure Start(); override; + procedure Stop(); override; + end; + +var + singleton_AudioInputBass : IAudioInput; + + +{ Global } + +{* + * Bass input capture callback. + * Params: + * stream - BASS input stream + * buffer - buffer of captured samples + * len - size of buffer in bytes + * user - players associated with left/right channels + *} +function MicrophoneCallback(stream: HSTREAM; buffer: Pointer; + len: Cardinal; Card: Cardinal): boolean; stdcall; +begin + AudioInputProcessor.HandleMicrophoneData(buffer, len, + AudioInputProcessor.Device[Card]); + Result := true; +end; + + +{ TBassInputDevice } + +{* + * Start input-capturing on this device. + * TODO: call BASS_RecordInit only once + *} +procedure TBassInputDevice.Start(); +const + captureFreq = 44100; +begin + // recording already started -> stop first + if (RecordStream <> 0) then + Stop(); + + // TODO: Call once. Otherwise it's to slow + if not BASS_RecordInit(BassDeviceID) then + begin + Log.LogError('TBassInputDevice.Start: Error initializing device['+IntToStr(DeviceIndex)+']: ' + + TAudioCore_Bass.ErrorGetString()); + Exit; + end; + + SampleRate := captureFreq; + + // capture in 44.1kHz/stereo/16bit and a 20ms callback period + RecordStream := BASS_RecordStart(captureFreq, 2, MakeLong(0, 20), + @MicrophoneCallback, DeviceIndex); + if (RecordStream = 0) then + begin + BASS_RecordFree; + Exit; + end; +end; + +{* + * Stop input-capturing on this device. + *} +procedure TBassInputDevice.Stop(); +begin + if (RecordStream = 0) then + Exit; + // TODO: Don't free the device. Do this on close + if (BASS_RecordSetDevice(BassDeviceID)) then + BASS_RecordFree; + RecordStream := 0; +end; + + +{ TAudioInput_Bass } + +function TAudioInput_Bass.GetName: String; +begin + result := 'BASS_Input'; +end; + +function TAudioInput_Bass.InitializeRecord(): boolean; +var + Descr: PChar; + SourceName: PChar; + Flags: integer; + BassDeviceID: integer; + BassDevice: TBassInputDevice; + DeviceIndex: integer; + SourceIndex: integer; +begin + result := false; + + DeviceIndex := 0; + BassDeviceID := 0; + SetLength(AudioInputProcessor.Device, 0); + + // checks for recording devices and puts them into an array + while true do + begin + Descr := BASS_RecordGetDeviceDescription(BassDeviceID); + if (Descr = nil) then + break; + + SetLength(AudioInputProcessor.Device, DeviceIndex+1); + + // TODO: free object on termination + BassDevice := TBassInputDevice.Create(); + AudioInputProcessor.Device[DeviceIndex] := BassDevice; + + BassDevice.DeviceIndex := DeviceIndex; + BassDevice.BassDeviceID := BassDeviceID; + BassDevice.Description := UnifyDeviceName(Descr, DeviceIndex); + + // get input sources + SourceIndex := 0; + BASS_RecordInit(BassDeviceID); + BassDevice.MicInput := 0; + + // process each input + while true do + begin + SourceName := BASS_RecordGetInputName(SourceIndex); + if (SourceName = nil) then + break; + + SetLength(BassDevice.Source, SourceIndex+1); + BassDevice.Source[SourceIndex].Name := + UnifyDeviceSourceName(SourceName, BassDevice.Description); + + // set mic index + Flags := BASS_RecordGetInput(SourceIndex); + if ((Flags and BASS_INPUT_TYPE_MIC) <> 0) then + BassDevice.MicInput := SourceIndex; + + Inc(SourceIndex); + end; + + BASS_RecordFree; + + Inc(DeviceIndex); + Inc(BassDeviceID); + end; + + result := true; +end; + +destructor TAudioInput_Bass.Destroy; +begin + inherited; +end; + + +initialization + singleton_AudioInputBass := TAudioInput_Bass.create(); + AudioManager.add( singleton_AudioInputBass ); + +finalization + AudioManager.Remove( singleton_AudioInputBass ); + +end. diff --git a/Game/Code/Classes/UAudioInput_Portaudio.pas b/Game/Code/Classes/UAudioInput_Portaudio.pas index 8073a7f3..c969a1b3 100644 --- a/Game/Code/Classes/UAudioInput_Portaudio.pas +++ b/Game/Code/Classes/UAudioInput_Portaudio.pas @@ -6,60 +6,43 @@ interface {$MODE Delphi} {$ENDIF} -{$I switches.inc} +{$I ../switches.inc} -uses Classes, - SysUtils, - portaudio, - {$IFDEF UsePortmixer} - portmixer, - {$ENDIF} - ULog, - UMusic; +uses + Classes, + SysUtils, + UMusic; implementation uses - {$IFDEF LAZARUS} - lclintf, - {$ENDIF} - URecord, - UIni, - UMain, - UCommon, - UThemes; -{ -type - TPaHostApiIndex = PaHostApiIndex; - TPaDeviceIndex = PaDeviceIndex; - PPaStream = ^PaStreamPtr; - PPaStreamCallbackTimeInfo = ^PaStreamCallbackTimeInfo; - TPaStreamCallbackFlags = PaStreamCallbackFlags; - TPaHostApiTypeId = PaHostApiTypeId; - PPaHostApiInfo = ^PaHostApiInfo; - PPaDeviceInfo = ^PaDeviceInfo; - TPaError = PaError; - TPaStreamParameters = PaStreamParameters; -} + URecord, + UIni, + ULog, + UMain, + {$IFDEF UsePortmixer} + portmixer, + {$ENDIF} + portaudio; + type - TAudioInput_Portaudio = class( TInterfacedObject, IAudioInput ) + TAudioInput_Portaudio = class(TAudioInputBase) private function GetPreferredApiIndex(): TPaHostApiIndex; public - function GetName: String; - procedure InitializeRecord; - - procedure CaptureStart; - procedure CaptureStop; - - procedure CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); - procedure StopCard(Card: byte); + function GetName: String; override; + function InitializeRecord: boolean; override; + destructor Destroy; override; end; - TPortaudioSoundCard = class(TGenericSoundCard) - RecordStream: PPaStream; - DeviceIndex: TPaDeviceIndex; + TPortaudioInputDevice = class(TAudioInputDevice) + public + RecordStream: PPaStream; + PaDeviceIndex: TPaDeviceIndex; + + procedure Start(); override; + procedure Stop(); override; end; function MicrophoneCallback(input: Pointer; output: Pointer; frameCount: Longword; @@ -69,9 +52,6 @@ function MicrophoneCallback(input: Pointer; output: Pointer; frameCount: Longwor var singleton_AudioInputPortaudio : IAudioInput; -const - sampleRate: Double = 44100.; - {* the default API used by Portaudio is the least common denominator * and might lack efficiency. ApiPreferenceOrder defines the order of * preferred APIs to use. The first API-type in the list is tried first. If it's @@ -102,6 +82,62 @@ var array[0..0] of TPaHostApiTypeId = ( paDefaultApi ); {$IFEND} + +{ TPortaudioInputDevice } + +procedure TPortaudioInputDevice.Start(); +var + Error: TPaError; + ErrorMsg: string; + inputParams: TPaStreamParameters; + deviceInfo: PPaDeviceInfo; +begin + // get input latency info + deviceInfo := Pa_GetDeviceInfo(PaDeviceIndex); + + // set input stream parameters + with inputParams do begin + device := PaDeviceIndex; + channelCount := 2; + sampleFormat := paInt16; + suggestedLatency := deviceInfo^.defaultLowInputLatency; + hostApiSpecificStreamInfo := nil; + end; + + Log.LogStatus(inttostr(PaDeviceIndex), 'Portaudio'); + Log.LogStatus(floattostr(deviceInfo^.defaultLowInputLatency), 'Portaudio'); + + // open input stream + Error := Pa_OpenStream(RecordStream, @inputParams, nil, SampleRate, + paFramesPerBufferUnspecified, paNoFlag, + @MicrophoneCallback, Pointer(Self)); + if(Error <> paNoError) then begin + ErrorMsg := Pa_GetErrorText(Error); + Log.CriticalError('TPortaudioInputDevice.Start(): Error opening stream: ' + ErrorMsg); + //Halt; + end; + + // start capture + Error := Pa_StartStream(RecordStream); + if(Error <> paNoError) then begin + Pa_CloseStream(RecordStream); + ErrorMsg := Pa_GetErrorText(Error); + Log.CriticalError('TPortaudioInputDevice.Start(): Error starting stream: ' + ErrorMsg); + //Halt; + end; +end; + +procedure TPortaudioInputDevice.Stop(); +begin + if assigned(RecordStream) then begin + Pa_StopStream(RecordStream); + Pa_CloseStream(RecordStream); + end; +end; + + +{ TAudioInput_Portaudio } + function TAudioInput_Portaudio.GetName: String; begin result := 'Portaudio'; @@ -130,8 +166,7 @@ begin end; end; -// TODO: should be a function with boolean return type -procedure TAudioInput_Portaudio.InitializeRecord; +function TAudioInput_Portaudio.InitializeRecord(): boolean; var i: integer; apiIndex: TPaHostApiIndex; @@ -139,37 +174,42 @@ var deviceName: string; deviceIndex: TPaDeviceIndex; deviceInfo: PPaDeviceInfo; - inputCnt: integer; - inputName: string; + sourceCnt: integer; + sourceName: string; SC: integer; // soundcard - SCI: integer; // soundcard input + SCI: integer; // soundcard source err: TPaError; errMsg: string; - paSoundCard: TPortaudioSoundCard; + paDevice: TPortaudioInputDevice; inputParams: TPaStreamParameters; stream: PPaStream; {$IFDEF UsePortmixer} mixer: PPxMixer; {$ENDIF} +const + captureFreq = 44100; begin - // TODO: call Pa_Terminate() on termination + result := false; + + writeln('0'); + err := Pa_Initialize(); if(err <> paNoError) then begin - Log.CriticalError('Portaudio.InitializeRecord: ' + Pa_GetErrorText(err)); - //Log.LogError('Portaudio.InitializeRecord: ' + Pa_GetErrorText(err)); - // result := false; + Log.LogError('Portaudio.InitializeRecord: ' + Pa_GetErrorText(err)); Exit; end; - + writeln('1'); apiIndex := GetPreferredApiIndex(); apiInfo := Pa_GetHostApiInfo(apiIndex); SC := 0; + writeln('2'); // init array-size to max. input-devices count - SetLength(AudioInputProcessor.SoundCard, apiInfo^.deviceCount); // fix deviceCountL - for i:= 0 to High(AudioInputProcessor.SoundCard) do + SetLength(AudioInputProcessor.Device, apiInfo^.deviceCount); + for i:= 0 to High(AudioInputProcessor.Device) do begin + writeln('25'); // convert API-specific device-index to global index deviceIndex := Pa_HostApiDeviceIndexToDeviceIndex(apiIndex, i); deviceInfo := Pa_GetDeviceInfo(deviceIndex); @@ -178,14 +218,13 @@ begin if(deviceInfo^.maxInputChannels <= 0) then continue; - // TODO: free object on termination - paSoundCard := TPortaudioSoundCard.Create(); - AudioInputProcessor.SoundCard[SC] := paSoundCard; + paDevice := TPortaudioInputDevice.Create(); + AudioInputProcessor.Device[SC] := paDevice; // retrieve device-name deviceName := deviceInfo^.name; - paSoundCard.Description := deviceName; - paSoundCard.DeviceIndex := deviceIndex; + paDevice.Description := deviceName; + paDevice.PaDeviceIndex := deviceIndex; // setup desired input parameters with inputParams do begin @@ -196,29 +235,32 @@ begin hostApiSpecificStreamInfo := nil; end; + paDevice.SampleRate := captureFreq; + // check if device supports our input-format - err := Pa_IsFormatSupported(@inputParams, nil, sampleRate); + err := Pa_IsFormatSupported(@inputParams, nil, paDevice.SampleRate); if(err <> 0) then begin // format not supported -> skip errMsg := Pa_GetErrorText(err); Log.LogError('Portaudio.InitializeRecord, device: "'+ deviceName +'" ' + '('+ errMsg +')'); - paSoundCard.Free(); + paDevice.Free(); continue; end; // TODO: retry with mono if stereo is not supported // TODO: retry with input-latency set to 20ms (defaultLowInputLatency might // not be set correctly in OSS) + // use TPaDeviceInfo.defaultSampleRate - err := Pa_OpenStream(stream, @inputParams, nil, sampleRate, + err := Pa_OpenStream(stream, @inputParams, nil, paDevice.SampleRate, paFramesPerBufferUnspecified, paNoFlag, @MicrophoneCallback, nil); if(err <> paNoError) then begin // unable to open device -> skip errMsg := Pa_GetErrorText(err); Log.LogError('Portaudio.InitializeRecord, device: "'+ deviceName +'" ' + '('+ errMsg +')'); - paSoundCard.Free(); + paDevice.Free(); continue; end; @@ -229,14 +271,14 @@ begin mixer := Px_OpenMixer(stream, 0); // get input count - inputCnt := Px_GetNumInputSources(mixer); - SetLength(paSoundCard.Input, inputCnt); + sourceCnt := Px_GetNumInputSources(mixer); + SetLength(paDevice.Source, sourceCnt); // get input names - for SCI := 0 to inputCnt-1 do + for SCI := 0 to sourceCnt-1 do begin - inputName := Px_GetInputSourceName(mixer, SCI); - paSoundCard.Input[SCI].Name := inputName; + sourceName := Px_GetInputSourceName(mixer, SCI); + paDevice.Source[SCI].Name := sourceName; end; Px_CloseMixer(mixer); @@ -247,80 +289,46 @@ begin // TODO: check if callback was called (this problem may occur on some devices) //Pa_StopStream(stream); - Pa_CloseStream(stream); - // create a standard input source - SetLength(paSoundCard.Input, 1); - paSoundCard.Input[0].Name := 'Standard'; + SetLength(paDevice.Source, 1); + paDevice.Source[0].Name := 'Standard'; {$ENDIF} + // close test-stream + Pa_CloseStream(stream); + // use default input source - paSoundCard.InputSelected := 0; + paDevice.SourceSelected := 0; Inc(SC); end; + writeln('3'); // adjust size to actual input-device count - SetLength(AudioInputProcessor.SoundCard, SC); + SetLength(AudioInputProcessor.Device, SC); Log.LogStatus('#Soundcards: ' + inttostr(SC), 'Portaudio'); { SoundCard[SC].InputSelected := Mic[Device]; } + result := true; end; -// TODO: code is used by all IAudioInput implementors -// -> move to a common superclass (TAudioInput_Generic?) -procedure TAudioInput_Portaudio.CaptureStart; -var - S: integer; - SC: integer; - PlayerLeft, PlayerRight: integer; - CaptureSoundLeft, CaptureSoundRight: TSound; -begin - for S := 0 to High(AudioInputProcessor.Sound) do - AudioInputProcessor.Sound[S].BufferLong[0].Clear; - - for SC := 0 to High(Ini.CardList) do begin - PlayerLeft := Ini.CardList[SC].ChannelL-1; - PlayerRight := Ini.CardList[SC].ChannelR-1; - if PlayerLeft >= PlayersPlay then PlayerLeft := -1; - if PlayerRight >= PlayersPlay then PlayerRight := -1; - if (PlayerLeft > -1) or (PlayerRight > -1) then begin - if (PlayerLeft > -1) then - CaptureSoundLeft := AudioInputProcessor.Sound[PlayerLeft] - else - CaptureSoundLeft := nil; - if (PlayerRight > -1) then - CaptureSoundRight := AudioInputProcessor.Sound[PlayerRight] - else - CaptureSoundRight := nil; - - CaptureCard(SC, CaptureSoundLeft, CaptureSoundRight); - end; - end; -end; - -// TODO: code is used by all IAudioInput implementors -// -> move to a common superclass (TAudioInput_Generic?) -procedure TAudioInput_Portaudio.CaptureStop; +destructor TAudioInput_Portaudio.Destroy; var - SC: integer; - PlayerLeft: integer; - PlayerRight: integer; + i: integer; + paSoundCard: TPortaudioInputDevice; begin - - for SC := 0 to High(Ini.CardList) do begin - PlayerLeft := Ini.CardList[SC].ChannelL-1; - PlayerRight := Ini.CardList[SC].ChannelR-1; - if PlayerLeft >= PlayersPlay then PlayerLeft := -1; - if PlayerRight >= PlayersPlay then PlayerRight := -1; - if (PlayerLeft > -1) or (PlayerRight > -1) then - StopCard(SC); + Pa_Terminate(); + for i := 0 to High(AudioInputProcessor.Device) do + begin + AudioInputProcessor.Device[i].Free(); end; + AudioInputProcessor.Device := nil; + inherited Destroy; end; {* @@ -334,81 +342,6 @@ begin result := paContinue; end; -{* - * Start input-capturing on Soundcard specified by Card. - * Params: - * Card - soundcard index in Recording.SoundCard array - * CaptureSoundLeft - sound(-buffer) used for left channel capture data - * CaptureSoundRight - sound(-buffer) used for right channel capture data - *} -procedure TAudioInput_Portaudio.CaptureCard(Card: byte; CaptureSoundLeft, CaptureSoundRight: TSound); -var - Error: TPaError; - ErrorMsg: string; - inputParams: TPaStreamParameters; - deviceInfo: PPaDeviceInfo; - stream: PPaStream; - paSoundCard: TPortaudioSoundCard; -begin - paSoundCard := TPortaudioSoundCard(AudioInputProcessor.SoundCard[Card]); - paSoundCard.CaptureSoundLeft := CaptureSoundLeft; - paSoundCard.CaptureSoundRight := CaptureSoundRight; - - // get input latency info - deviceInfo := Pa_GetDeviceInfo(paSoundCard.DeviceIndex); - - // set input stream parameters - with inputParams do begin - device := paSoundCard.DeviceIndex; - channelCount := 2; - sampleFormat := paInt16; - suggestedLatency := deviceInfo^.defaultLowInputLatency; - hostApiSpecificStreamInfo := nil; - end; - - Log.LogStatus(inttostr(paSoundCard.DeviceIndex), 'Portaudio'); - Log.LogStatus(floattostr(deviceInfo^.defaultLowInputLatency), 'Portaudio'); - - // open input stream - Error := Pa_OpenStream(stream, @inputParams, nil, sampleRate, - paFramesPerBufferUnspecified, paNoFlag, - @MicrophoneCallback, Pointer(paSoundCard)); - if(Error <> paNoError) then begin - ErrorMsg := Pa_GetErrorText(Error); - Log.CriticalError('TAudio_Portaudio.CaptureCard('+ IntToStr(Card) +'): Error opening stream: ' + ErrorMsg); - //Halt; - end; - - paSoundCard.RecordStream := stream; - - // start capture - Error := Pa_StartStream(stream); - if(Error <> paNoError) then begin - Pa_CloseStream(stream); - ErrorMsg := Pa_GetErrorText(Error); - Log.CriticalError('TAudio_Portaudio.CaptureCard('+ IntToStr(Card) +'): Error starting stream: ' + ErrorMsg); - //Halt; - end; -end; - -{* - * Stop input-capturing on Soundcard specified by Card. - * Params: - * Card - soundcard index in Recording.SoundCard array - *} -procedure TAudioInput_Portaudio.StopCard(Card: byte); -var - stream: PPaStream; - paSoundCard: TPortaudioSoundCard; -begin - paSoundCard := TPortaudioSoundCard(AudioInputProcessor.SoundCard[Card]); - stream := paSoundCard.RecordStream; - if(stream <> nil) then begin - Pa_StopStream(stream); - Pa_CloseStream(stream); - end; -end; - initialization singleton_AudioInputPortaudio := TAudioInput_Portaudio.create(); diff --git a/Game/Code/Classes/UAudioPlayback_Bass.pas b/Game/Code/Classes/UAudioPlayback_Bass.pas index 87ff183d..266a5ec3 100644 --- a/Game/Code/Classes/UAudioPlayback_Bass.pas +++ b/Game/Code/Classes/UAudioPlayback_Bass.pas @@ -9,35 +9,31 @@ interface {$I switches.inc} -uses Classes, - {$IFDEF win32} - windows, - {$ENDIF} - SysUtils, - bass, - ULog, - UMusic; +uses + Classes, + SysUtils, + UMusic; implementation uses - {$IFDEF LAZARUS} - lclintf, - {$ENDIF} - URecord, - UIni, - UMain, - UCommon, - UThemes; + UIni, + UMain, + ULog, + UAudioCore_Bass, + bass; type - TBassOutputStream = class(TAudioPlaybackStream) + TBassPlaybackStream = class(TAudioPlaybackStream) private Handle: HSTREAM; + Loop: boolean; public constructor Create(); overload; constructor Create(stream: HSTREAM); overload; + procedure Reset(); + procedure Play(); override; procedure Pause(); override; procedure Stop(); override; @@ -46,41 +42,33 @@ type procedure SetLoop(Enabled: boolean); override; function GetLength(): real; override; function GetStatus(): TStreamStatus; override; + function GetVolume(): integer; override; + procedure SetVolume(volume: integer); override; + + function GetPosition: real; + procedure SetPosition(Time: real); + + function IsLoaded(): boolean; end; type TAudioPlayback_Bass = class( TInterfacedObject, IAudioPlayback) private - MusicStream: HSTREAM; - - StartSoundStream: HSTREAM; - BackSoundStream: HSTREAM; - SwooshSoundStream: HSTREAM; - ChangeSoundStream: HSTREAM; - OptionSoundStream: HSTREAM; - ClickSoundStream: HSTREAM; - DrumSoundStream: HSTREAM; - HihatSoundStream: HSTREAM; - ClapSoundStream: HSTREAM; - ShuffleSoundStream: HSTREAM; - - //Custom Sounds - CustomSounds: array of TCustomSoundEntry; - Loaded: boolean; - Loop: boolean; + MusicStream: TBassPlaybackStream; + function Load(Filename: string): TBassPlaybackStream; public function GetName: String; {IAudioOutput interface} - procedure InitializePlayback; + function InitializePlayback(): boolean; procedure SetVolume(Volume: integer); procedure SetMusicVolume(Volume: integer); procedure SetLoop(Enabled: boolean); - function Open(Name: string): boolean; // true if succeed - + function Open(Filename: string): boolean; // true if succeed + procedure Rewind; procedure Play; procedure Pause; //Pause Mod @@ -91,79 +79,106 @@ type function GetPosition: real; procedure SetPosition(Time: real); - procedure PlayStart; - procedure PlayBack; - procedure PlaySwoosh; - procedure PlayChange; - procedure PlayOption; - procedure PlayClick; - procedure PlayDrum; - procedure PlayHihat; - procedure PlayClap; - procedure PlayShuffle; - procedure StopShuffle; - - function LoadSoundFromFile(var stream: HSTREAM; Name: string): boolean; - //Equalizer - function GetFFTData: TFFTData; + procedure GetFFTData(var data: TFFTData); // Interface for Visualizer function GetPCMData(var data: TPCMData): Cardinal; - //Custom Sounds - function LoadCustomSound(const Filename: String): Cardinal; - procedure PlayCustomSound(const Index: Cardinal ); + // Sounds + function OpenSound(const Filename: String): TAudioPlaybackStream; + procedure PlaySound(stream: TAudioPlaybackStream); + procedure StopSound(stream: TAudioPlaybackStream); end; var singleton_AudioPlaybackBass : IAudioPlayback; -constructor TBassOutputStream.Create(); +constructor TBassPlaybackStream.Create(); begin inherited; + Reset(); end; -constructor TBassOutputStream.Create(stream: HSTREAM); +constructor TBassPlaybackStream.Create(stream: HSTREAM); begin Create(); Handle := stream; end; -procedure TBassOutputStream.Play(); +procedure TBassPlaybackStream.Reset(); +begin + Loop := false; + if (Handle <> 0) then + Bass_StreamFree(Handle); + Handle := 0; +end; + +procedure TBassPlaybackStream.Play(); begin - BASS_ChannelPlay(Handle, True); + BASS_ChannelPlay(Handle, Loop); end; -procedure TBassOutputStream.Pause(); +procedure TBassPlaybackStream.Pause(); begin - //if (Loaded) then BASS_ChannelPause(Handle); end; -procedure TBassOutputStream.Stop(); +procedure TBassPlaybackStream.Stop(); begin BASS_ChannelStop(Handle); end; -procedure TBassOutputStream.Close(); +procedure TBassPlaybackStream.Close(); begin - Bass_StreamFree(Handle); + Reset(); end; -function TBassOutputStream.GetLoop(): boolean; +function TBassPlaybackStream.GetVolume(): integer; begin - // TODO - result := false; + Result := 0; + BASS_ChannelSetAttributes(Handle, PInteger(nil)^, Result, PInteger(nil)^); +end; + +procedure TBassPlaybackStream.SetVolume(volume: integer); +begin + // clamp volume + if volume < 0 then + volume := 0; + if volume > 100 then + volume := 100; + // set volume + BASS_ChannelSetAttributes(Handle, -1, volume, -101); end; -procedure TBassOutputStream.SetLoop(Enabled: boolean); +function TBassPlaybackStream.GetPosition: real; +var + bytes: integer; +begin + bytes := BASS_ChannelGetPosition(Handle); + Result := BASS_ChannelBytes2Seconds(Handle, bytes); +end; + +procedure TBassPlaybackStream.SetPosition(Time: real); +var + bytes: integer; begin - // TODO + bytes := BASS_ChannelSeconds2Bytes(Handle, Time); + BASS_ChannelSetPosition(Handle, bytes); end; -function TBassOutputStream.GetLength(): real; +function TBassPlaybackStream.GetLoop(): boolean; +begin + result := Loop; +end; + +procedure TBassPlaybackStream.SetLoop(Enabled: boolean); +begin + Loop := Enabled; +end; + +function TBassPlaybackStream.GetLength(): real; var bytes: integer; begin @@ -171,37 +186,45 @@ begin Result := BASS_ChannelBytes2Seconds(Handle, bytes); end; -function TBassOutputStream.GetStatus(): TStreamStatus; +function TBassPlaybackStream.GetStatus(): TStreamStatus; var state: DWORD; begin state := BASS_ChannelIsActive(Handle); case state of BASS_ACTIVE_PLAYING: - result := sPlaying; + result := ssPlaying; BASS_ACTIVE_PAUSED: - result := sPaused; + result := ssPaused; + BASS_ACTIVE_STALLED: + result := ssBlocked; + BASS_ACTIVE_STOPPED: + result := ssStopped; else - result := sStopped; + result := ssUnknown; end; end; +function TBassPlaybackStream.IsLoaded(): boolean; +begin + Result := (Handle <> 0); +end; + function TAudioPlayback_Bass.GetName: String; begin result := 'BASS_Playback'; end; -procedure TAudioPlayback_Bass.InitializePlayback; +function TAudioPlayback_Bass.InitializePlayback(): boolean; var Pet: integer; S: integer; begin -// Log.BenchmarkStart(4); -// Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); + result := false; - Loaded := false; - Loop := false; + //Log.BenchmarkStart(4); + //Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); if not BASS_Init(1, 44100, 0, 0, nil) then begin @@ -209,30 +232,32 @@ begin Exit; end; -// Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); + //Log.BenchmarkEnd(4); Log.LogBenchmark('--> Bass Init', 4); // config playing buffer -// BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); -// BASS_SetConfig(BASS_CONFIG_BUFFER, 100); - -// Log.LogStatus('Loading Sounds', 'Music Initialize'); + //BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 10); + //BASS_SetConfig(BASS_CONFIG_BUFFER, 100); -// Log.BenchmarkStart(4); - LoadSoundFromFile(StartSoundStream, SoundPath + 'Common Start.mp3'); - LoadSoundFromFile(BackSoundStream, SoundPath + 'Common Back.mp3'); - LoadSoundFromFile(SwooshSoundStream, SoundPath + 'menu swoosh.mp3'); - LoadSoundFromFile(ChangeSoundStream, SoundPath + 'select music change music 50.mp3'); - LoadSoundFromFile(OptionSoundStream, SoundPath + 'option change col.mp3'); - LoadSoundFromFile(ClickSoundStream, SoundPath + 'rimshot022b.mp3'); + result := true; +end; -// LoadSoundFromFile(DrumSoundStream, SoundPath + 'bassdrumhard076b.mp3'); -// LoadSoundFromFile(HihatSoundStream, SoundPath + 'hihatclosed068b.mp3'); -// LoadSoundFromFile(ClapSoundStream, SoundPath + 'claps050b.mp3'); +function TAudioPlayback_Bass.Load(Filename: string): TBassPlaybackStream; +var + L: Integer; + stream: HSTREAM; +begin + Result := nil; -// LoadSoundFromFile(ShuffleSoundStream, SoundPath + 'Shuffle.mp3'); + //Log.LogStatus('Loading Sound: "' + Filename + '"', 'LoadSoundFromFile'); + stream := BASS_StreamCreateFile(False, pchar(Filename), 0, 0, 0); + if (stream = 0) then + begin + Log.LogError('Failed to open "' + Filename + '", ' + + TAudioCore_Bass.ErrorGetString(BASS_ErrorGetCode()), 'TAudioPlayback_Bass.Load'); + Exit; + end; -// Log.BenchmarkEnd(4); -// Log.LogBenchmark('--> Loading Sounds', 4); + Result := TBassPlaybackStream.Create(stream); end; procedure TAudioPlayback_Bass.SetVolume(Volume: integer); @@ -240,7 +265,6 @@ begin //Old Sets Wave Volume //BASS_SetVolume(Volume); //New: Sets Volume only for this Application - BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); @@ -248,193 +272,102 @@ end; procedure TAudioPlayback_Bass.SetMusicVolume(Volume: Integer); begin - //Max Volume Prevention - if Volume > 100 then - Volume := 100; - - if Volume < 0 then - Volume := 0; - - //Set Volume - BASS_ChannelSetAttributes (MusicStream, -1, Volume, -101); + if assigned(MusicStream) then + MusicStream.SetVolume(Volume); end; procedure TAudioPlayback_Bass.SetLoop(Enabled: boolean); begin - Loop := Enabled; + if assigned(MusicStream) then + MusicStream.Loop := Enabled; end; -function TAudioPlayback_Bass.Open(Name: string): boolean; +function TAudioPlayback_Bass.Open(Filename: string): boolean; +var + stream: HSTREAM; begin - Loaded := false; - if FileExists(Name) then - begin - MusicStream := Bass_StreamCreateFile(false, pchar(Name), 0, 0, 0); + Result := false; - Loaded := true; - //Set Max Volume - SetMusicVolume (100); - end; + // free old MusicStream + if assigned(MusicStream) then + MusicStream.Free; - Result := Loaded; -end; + MusicStream := Load(Filename); + if not assigned(MusicStream) then + Exit; -procedure TAudioPlayback_Bass.Rewind; -begin - if Loaded then begin - end; + //Set Max Volume + SetMusicVolume(100); + + Result := true; end; -procedure TAudioPlayback_Bass.SetPosition(Time: real); -var - bytes: integer; +procedure TAudioPlayback_Bass.Rewind; begin - bytes := BASS_ChannelSeconds2Bytes(MusicStream, Time); - BASS_ChannelSetPosition(MusicStream, bytes); + SetPosition(0); end; procedure TAudioPlayback_Bass.Play; begin - if Loaded then - begin - if Loop then - BASS_ChannelPlay(MusicStream, True); // start from beginning... actually bass itself does not loop, nor does this TAudio_bass Class - - BASS_ChannelPlay(MusicStream, False); // for setting position before playing - end; + if assigned(MusicStream) then + MusicStream.Play(); end; -procedure TAudioPlayback_Bass.Pause; //Pause Mod +procedure TAudioPlayback_Bass.Pause; begin - if Loaded then begin - BASS_ChannelPause(MusicStream); // Pauses Song - end; + if assigned(MusicStream) then + MusicStream.Pause(); end; procedure TAudioPlayback_Bass.Stop; begin - Bass_ChannelStop(MusicStream); + if assigned(MusicStream) then + MusicStream.Stop(); end; procedure TAudioPlayback_Bass.Close; begin - Bass_StreamFree(MusicStream); + if assigned(MusicStream) then + MusicStream.Close(); end; function TAudioPlayback_Bass.Length: real; var bytes: integer; begin - bytes := BASS_ChannelGetLength(MusicStream); - Result := BASS_ChannelBytes2Seconds(MusicStream, bytes); -end; - -function TAudioPlayback_Bass.getPosition: real; -var - bytes: integer; -begin - bytes := BASS_ChannelGetPosition(MusicStream); - Result := BASS_ChannelBytes2Seconds(MusicStream, bytes); -end; - -function TAudioPlayback_Bass.Finished: boolean; -begin - Result := false; - - if BASS_ChannelIsActive(MusicStream) = BASS_ACTIVE_STOPPED then - begin - Result := true; - end; -end; - -procedure TAudioPlayback_Bass.PlayStart; -begin - BASS_ChannelPlay(StartSoundStream, True); -end; - -procedure TAudioPlayback_Bass.PlayBack; -begin - BASS_ChannelPlay(BackSoundStream, True);// then -end; - -procedure TAudioPlayback_Bass.PlaySwoosh; -begin - BASS_ChannelPlay(SwooshSoundStream, True); -end; - -procedure TAudioPlayback_Bass.PlayChange; -begin - BASS_ChannelPlay(ChangeSoundStream, True); -end; - -procedure TAudioPlayback_Bass.PlayOption; -begin - BASS_ChannelPlay(OptionSoundStream, True); -end; - -procedure TAudioPlayback_Bass.PlayClick; -begin - BASS_ChannelPlay(ClickSoundStream, True); -end; - -procedure TAudioPlayback_Bass.PlayDrum; -begin - BASS_ChannelPlay(DrumSoundStream, True); -end; - -procedure TAudioPlayback_Bass.PlayHihat; -begin - BASS_ChannelPlay(HihatSoundStream, True); -end; - -procedure TAudioPlayback_Bass.PlayClap; -begin - BASS_ChannelPlay(ClapSoundStream, True); + if assigned(MusicStream) then + Result := MusicStream.GetLength() + else + Result := -1; end; -procedure TAudioPlayback_Bass.PlayShuffle; +function TAudioPlayback_Bass.GetPosition: real; begin - BASS_ChannelPlay(ShuffleSoundStream, True); + if assigned(MusicStream) then + Result := MusicStream.GetPosition() + else + Result := -1; end; -procedure TAudioPlayback_Bass.StopShuffle; +procedure TAudioPlayback_Bass.SetPosition(Time: real); begin - BASS_ChannelStop(ShuffleSoundStream); + if assigned(MusicStream) then + MusicStream.SetPosition(Time); end; -function TAudioPlayback_Bass.LoadSoundFromFile(var stream: HSTREAM; Name: string): boolean; -var - L: Integer; +function TAudioPlayback_Bass.Finished: boolean; begin - if FileExists(Name) then - begin - Log.LogStatus('Loading Sound: "' + Name + '"', 'LoadSoundFromFile'); - try - stream := BASS_StreamCreateFile(False, pchar(Name), 0, 0, 0); - - //Add CustomSound - L := High(CustomSounds) + 1; - SetLength (CustomSounds, L + 1); - CustomSounds[L].Filename := Name; - CustomSounds[L].Stream := TBassOutputStream.Create(stream); - except - Log.LogError('Failed to open using BASS', 'LoadSoundFromFile'); - end; - end + if assigned(MusicStream) then + Result := (MusicStream.GetStatus() = ssStopped) else - begin - Log.LogError('Sound not found: "' + Name + '"', 'LoadSoundFromFile'); - exit; - end; + Result := true; end; //Equalizer -function TAudioPlayback_Bass.GetFFTData: TFFTData; -var - Data: TFFTData; +procedure TAudioPlayback_Bass.GetFFTData(var data: TFFTData); begin //Get Channel Data Mono and 256 Values - BASS_ChannelGetData(MusicStream, @Result, BASS_DATA_FFT512); + BASS_ChannelGetData(MusicStream.Handle, @data, BASS_DATA_FFT512); end; {* @@ -447,23 +380,21 @@ var nBytes: DWORD; begin //Get Channel Data Mono and 256 Values - BASS_ChannelGetInfo(MusicStream, info); - ZeroMemory(@data, sizeof(TPCMData)); + BASS_ChannelGetInfo(MusicStream.Handle, info); + FillChar(data, sizeof(TPCMData), 0); if (info.chans = 1) then begin // mono file -> add stereo channel - { - nBytes := BASS_ChannelGetData(Bass, @data[0], samples*sizeof(Smallint)); + nBytes := 0;//BASS_ChannelGetData(Bass, @data[0], samples*sizeof(Smallint)); // interleave data //CopyMemory(@data[1], @data[0], samples*sizeof(Smallint)); - } result := 0; end else begin // stereo file - nBytes := BASS_ChannelGetData(MusicStream, @data, sizeof(TPCMData)); + nBytes := BASS_ChannelGetData(MusicStream.Handle, @data, sizeof(TPCMData)); end; if(nBytes <= 0) then result := 0 @@ -471,36 +402,21 @@ begin result := nBytes div sizeof(TPCMStereoSample); end; -function TAudioPlayback_Bass.LoadCustomSound(const Filename: String): Cardinal; -var - S: hStream; - I: Integer; - F: String; +function TAudioPlayback_Bass.OpenSound(const Filename: string): TAudioPlaybackStream; begin - //Search for Sound in already loaded Sounds - F := UpperCase(SoundPath + FileName); - For I := 0 to High(CustomSounds) do - begin - if (UpperCase(CustomSounds[I].Filename) = F) then - begin - Result := I; - Exit; - end; - end; + result := Load(Filename); +end; - if LoadSoundFromFile(S, SoundPath + Filename) then - Result := High(CustomSounds) - else - Result := 0; +procedure TAudioPlayback_Bass.PlaySound(stream: TAudioPlaybackStream); +begin + if assigned(stream) then + stream.Play(); end; -procedure TAudioPlayback_Bass.PlayCustomSound(const Index: Cardinal ); +procedure TAudioPlayback_Bass.StopSound(stream: TAudioPlaybackStream); begin - if Index <= High(CustomSounds) then - with CustomSounds[Index].Stream as TBassOutputStream do - begin - BASS_ChannelPlay(Handle, True); - end; + if assigned(stream) then + stream.Stop(); end; diff --git a/Game/Code/Classes/UAudioPlayback_Portaudio.pas b/Game/Code/Classes/UAudioPlayback_Portaudio.pas index 5f4a8cde..2743fa86 100644 --- a/Game/Code/Classes/UAudioPlayback_Portaudio.pas +++ b/Game/Code/Classes/UAudioPlayback_Portaudio.pas @@ -9,35 +9,40 @@ interface {$I switches.inc} -uses Classes, - SysUtils, - UMusic; +uses + Classes, + SysUtils, + UMusic; implementation uses - {$IFDEF LAZARUS} - lclintf, - {$ifndef win32} - libc, - {$endif} - {$ENDIF} - sdl, - portaudio, - ULog, - UIni, - UMain; + {$IFNDEF Win32} + libc, + {$ENDIF} + sdl, + portaudio, + ULog, + UIni, + UMain; type TPortaudioPlaybackStream = class(TAudioPlaybackStream) private - status: TStreamStatus; - Loaded: boolean; + Status: TStreamStatus; Loop: boolean; + + _volume: integer; + + procedure Reset(); public - decodeStream: TAudioDecodeStream; + DecodeStream: TAudioDecodeStream; + + constructor Create(); + destructor Destroy(); override; + + function SetDecodeStream(decodeStream: TAudioDecodeStream): boolean; - constructor Create(decodeStream: TAudioDecodeStream); procedure Play(); override; procedure Pause(); override; procedure Stop(); override; @@ -49,6 +54,9 @@ type function IsLoaded(): boolean; + function GetVolume(): integer; override; + procedure SetVolume(volume: integer); override; + // functions delegated to the decode stream function GetPosition: real; procedure SetPosition(Time: real); @@ -60,12 +68,23 @@ type private activeStreams: TList; mixerBuffer: PChar; + internalLock: PSDL_Mutex; + + _volume: integer; + + procedure Lock(); inline; + procedure Unlock(); inline; + + function GetVolume(): integer; + procedure SetVolume(volume: integer); public constructor Create(); destructor Destroy(); override; procedure AddStream(stream: TAudioPlaybackStream); procedure RemoveStream(stream: TAudioPlaybackStream); function ReadData(Buffer: PChar; BufSize: integer): integer; + + property Volume: integer READ GetVolume WRITE SetVolume; end; type @@ -73,36 +92,29 @@ type private MusicStream: TPortaudioPlaybackStream; - StartSoundStream: TPortaudioPlaybackStream; - BackSoundStream: TPortaudioPlaybackStream; - SwooshSoundStream: TPortaudioPlaybackStream; - ChangeSoundStream: TPortaudioPlaybackStream; - OptionSoundStream: TPortaudioPlaybackStream; - ClickSoundStream: TPortaudioPlaybackStream; - DrumSoundStream: TPortaudioPlaybackStream; - HihatSoundStream: TPortaudioPlaybackStream; - ClapSoundStream: TPortaudioPlaybackStream; - ShuffleSoundStream: TPortaudioPlaybackStream; - - //Custom Sounds - CustomSounds: array of TCustomSoundEntry; - - mixerStream: TAudioMixerStream; + MixerStream: TAudioMixerStream; paStream: PPaStream; - public - FrameSize: integer; - function GetName: String; + FrameSize: integer; function InitializePortaudio(): boolean; function StartPortaudioStream(): boolean; - procedure InitializePlayback(); + function InitializeSDLAudio(): boolean; + function StartSDLAudioStream(): boolean; + procedure StopSDLAudioStream(); + public + function GetName: String; + + function InitializePlayback(): boolean; + destructor Destroy; override; + + function Load(const Filename: String): TPortaudioPlaybackStream; + procedure SetVolume(Volume: integer); procedure SetMusicVolume(Volume: integer); procedure SetLoop(Enabled: boolean); function Open(Filename: string): boolean; // true if succeed - function Load(Filename: string): TPortaudioPlaybackStream; procedure Rewind; procedure SetPosition(Time: real); procedure Play; @@ -113,27 +125,17 @@ type function Finished: boolean; function Length: real; function GetPosition: real; - procedure PlayStart; - procedure PlayBack; - procedure PlaySwoosh; - procedure PlayChange; - procedure PlayOption; - procedure PlayClick; - procedure PlayDrum; - procedure PlayHihat; - procedure PlayClap; - procedure PlayShuffle; - procedure StopShuffle; - - //Equalizer - function GetFFTData: TFFTData; + + // Equalizer + procedure GetFFTData(var data: TFFTData); // Interface for Visualizer function GetPCMData(var data: TPCMData): Cardinal; - //Custom Sounds - function LoadCustomSound(const Filename: String): Cardinal; - procedure PlayCustomSound(const Index: Cardinal ); + // Sounds + function OpenSound(const Filename: String): TAudioPlaybackStream; + procedure PlaySound(stream: TAudioPlaybackStream); + procedure StopSound(stream: TAudioPlaybackStream); end; @@ -150,25 +152,59 @@ var constructor TAudioMixerStream.Create(); begin activeStreams := TList.Create; + internalLock := SDL_CreateMutex(); + _volume := 100; end; destructor TAudioMixerStream.Destroy(); begin - if (mixerBuffer <> nil) then + if assigned(mixerBuffer) then Freemem(mixerBuffer); activeStreams.Free; + SDL_DestroyMutex(internalLock); +end; + +procedure TAudioMixerStream.Lock(); +begin + SDL_mutexP(internalLock); +end; + +procedure TAudioMixerStream.Unlock(); +begin + SDL_mutexV(internalLock); +end; + +function TAudioMixerStream.GetVolume(): integer; +begin + Lock(); + result := _volume; + Unlock(); +end; + +procedure TAudioMixerStream.SetVolume(volume: integer); +begin + Lock(); + _volume := volume; + Unlock(); end; procedure TAudioMixerStream.AddStream(stream: TAudioPlaybackStream); begin + if not assigned(stream) then + Exit; + + Lock(); // check if stream is already in list to avoid duplicates if (activeStreams.IndexOf(Pointer(stream)) = -1) then activeStreams.Add(Pointer(stream)); + Unlock(); end; procedure TAudioMixerStream.RemoveStream(stream: TAudioPlaybackStream); begin + Lock(); activeStreams.Remove(Pointer(stream)); + Unlock(); end; function TAudioMixerStream.ReadData(Buffer: PChar; BufSize: integer): integer; @@ -176,79 +212,111 @@ var i: integer; size: integer; stream: TPortaudioPlaybackStream; + appVolume: single; begin result := BufSize; // zero target-buffer (silence) FillChar(Buffer^, BufSize, 0); - // resize mixer-buffer + // resize mixer-buffer if necessary ReallocMem(mixerBuffer, BufSize); - if (mixerBuffer = nil) then + if not assigned(mixerBuffer) then Exit; - writeln('Mix: ' + inttostr(activeStreams.Count)); + Lock(); + + //writeln('Mix: ' + inttostr(activeStreams.Count)); + + // use _volume instead of Volume to prevent recursive locking + appVolume := _volume / 100 * SDL_MIX_MAXVOLUME; for i := 0 to activeStreams.Count-1 do begin stream := TPortaudioPlaybackStream(activeStreams[i]); - if (stream.GetStatus() = sPlaying) then + if (stream.GetStatus() = ssPlaying) then begin // fetch data from current stream size := stream.ReadData(mixerBuffer, BufSize); if (size > 0) then begin - SDL_MixAudio(PUInt8(Buffer), PUInt8(mixerBuffer), size, SDL_MIX_MAXVOLUME); + SDL_MixAudio(PUInt8(Buffer), PUInt8(mixerBuffer), size, + Trunc(appVolume * stream.Volume / 100)); end; end; end; + + Unlock(); end; { TPortaudioPlaybackStream } -constructor TPortaudioPlaybackStream.Create(decodeStream: TAudioDecodeStream); +constructor TPortaudioPlaybackStream.Create(); begin inherited Create(); - status := sStopped; - if (decodeStream <> nil) then - begin - Self.decodeStream := decodeStream; - Loaded := true; - end; + Reset(); +end; + +destructor TPortaudioPlaybackStream.Destroy(); +begin + Close(); + inherited Destroy(); +end; + +procedure TPortaudioPlaybackStream.Reset(); +begin + Status := ssStopped; + Loop := false; + DecodeStream := nil; + _volume := 0; +end; + +function TPortaudioPlaybackStream.SetDecodeStream(decodeStream: TAudioDecodeStream): boolean; +begin + result := false; + + Reset(); + + if not assigned(decodeStream) then + Exit; + Self.DecodeStream := decodeStream; + + _volume := 100; + + result := true; +end; + +procedure TPortaudioPlaybackStream.Close(); +begin + Reset(); end; procedure TPortaudioPlaybackStream.Play(); begin - if (status <> sPaused) then + if (status <> ssPaused) then begin // rewind - decodeStream.Position := 0; + if assigned(DecodeStream) then + DecodeStream.Position := 0; end; - status := sPlaying; - //mixerStream.AddStream(Self); + status := ssPlaying; + //MixerStream.AddStream(Self); end; procedure TPortaudioPlaybackStream.Pause(); begin - status := sPaused; + status := ssPaused; end; procedure TPortaudioPlaybackStream.Stop(); begin - status := sStopped; -end; - -procedure TPortaudioPlaybackStream.Close(); -begin - status := sStopped; - Loaded := false; - // TODO: cleanup decode-stream + status := ssStopped; end; function TPortaudioPlaybackStream.IsLoaded(): boolean; begin - result := Loaded; + result := assigned(DecodeStream); end; function TPortaudioPlaybackStream.GetLoop(): boolean; @@ -263,7 +331,10 @@ end; function TPortaudioPlaybackStream.GetLength(): real; begin - result := decodeStream.Length; + if assigned(DecodeStream) then + result := DecodeStream.Length + else + result := -1; end; function TPortaudioPlaybackStream.GetStatus(): TStreamStatus; @@ -273,22 +344,47 @@ end; function TPortaudioPlaybackStream.ReadData(Buffer: PChar; BufSize: integer): integer; begin - result := decodeStream.ReadData(Buffer, BufSize); + if not assigned(DecodeStream) then + begin + result := -1; + Exit; + end; + result := DecodeStream.ReadData(Buffer, BufSize); // end-of-file reached -> stop playback - if (decodeStream.EOF) then + if (DecodeStream.EOF) then begin - status := sStopped; + status := ssStopped; end; end; function TPortaudioPlaybackStream.GetPosition: real; begin - result := decodeStream.Position; + if assigned(DecodeStream) then + result := DecodeStream.Position + else + result := -1; end; procedure TPortaudioPlaybackStream.SetPosition(Time: real); begin - decodeStream.Position := Time; + if assigned(DecodeStream) then + DecodeStream.Position := Time; +end; + +function TPortaudioPlaybackStream.GetVolume(): integer; +begin + result := _volume; +end; + +procedure TPortaudioPlaybackStream.SetVolume(volume: integer); +begin + // clamp volume + if (volume > 100) then + _volume := 100 + else if (volume < 0) then + _volume := 0 + else + _volume := volume; end; @@ -298,18 +394,26 @@ function AudioCallback(input: Pointer; output: Pointer; frameCount: Longword; timeInfo: PPaStreamCallbackTimeInfo; statusFlags: TPaStreamCallbackFlags; userData: Pointer): Integer; cdecl; var - playback : TAudioPlayback_Portaudio; - playbackStream : TPortaudioPlaybackStream; - decodeStream : TAudioDecodeStream; + playback: TAudioPlayback_Portaudio; begin playback := TAudioPlayback_Portaudio(userData); with playback do begin - mixerStream.ReadData(output, frameCount * FrameSize); + MixerStream.ReadData(output, frameCount * FrameSize); end; result := paContinue; end; +procedure SDLAudioCallback(userdata: Pointer; stream: PChar; len: integer); cdecl; +var + playback: TAudioPlayback_Portaudio; +begin + playback := TAudioPlayback_Portaudio(userdata); + with playback do + begin + //MixerStream.ReadData(stream, len); + end; +end; function TAudioPlayback_Portaudio.GetName: String; begin @@ -349,10 +453,11 @@ begin device := paOutDevice; channelCount := 2; sampleFormat := paInt16; - suggestedLatency := paOutDeviceInfo^.defaultLowOutputLatency; + suggestedLatency := paOutDeviceInfo^.defaultHighOutputLatency; hostApiSpecificStreamInfo := nil; end; + // set the size of one audio frame (2channel 16bit uint sample) FrameSize := 2 * sizeof(Smallint); err := Pa_OpenStream(paStream, nil, @paOutParams, 44100, @@ -384,219 +489,208 @@ begin result := true; end; -procedure TAudioPlayback_Portaudio.InitializePlayback; +function TAudioPlayback_Portaudio.InitializeSDLAudio(): boolean; +var + desiredAudioSpec, obtainedAudioSpec: TSDL_AudioSpec; + err: integer; begin - Log.LogStatus('InitializePlayback', 'UAudioPlayback_Portaudio'); + result := false; - InitializePortaudio(); - mixerStream := TAudioMixerStream.Create; + SDL_InitSubSystem(SDL_INIT_AUDIO); - StartSoundStream := Load(SoundPath + 'Common start.mp3'); - BackSoundStream := Load(SoundPath + 'Common back.mp3'); - SwooshSoundStream := Load(SoundPath + 'menu swoosh.mp3'); - ChangeSoundStream := Load(SoundPath + 'select music change music 50.mp3'); - OptionSoundStream := Load(SoundPath + 'option change col.mp3'); - ClickSoundStream := Load(SoundPath + 'rimshot022b.mp3'); + FillChar(desiredAudioSpec, sizeof(desiredAudioSpec), 0); + with desiredAudioSpec do + begin + freq := 44100; + format := AUDIO_S16SYS; + channels := 2; + samples := 1024; // latency: 23 ms + callback := @SDLAudioCallback; + userdata := Self; + end; -// DrumSoundStream := Load(SoundPath + 'bassdrumhard076b.mp3'); -// HihatSoundStream := Load(SoundPath + 'hihatclosed068b.mp3'); -// ClapSoundStream := Load(SoundPath + 'claps050b.mp3'); + // set the size of one audio frame (2channel 16bit uint sample) + FrameSize := 2 * sizeof(Smallint); + + if(SDL_OpenAudio(@desiredAudioSpec, @obtainedAudioSpec) = -1) then + begin + Log.LogStatus('SDL_OpenAudio: ' + SDL_GetError(), 'UAudioPlayback_SDL'); + exit; + end; -// ShuffleSoundStream := Load(SoundPath + 'Shuffle.mp3'); + Log.LogStatus('Opened audio device', 'UAudioPlayback_SDL'); - StartPortaudioStream(); + result := true; end; +function TAudioPlayback_Portaudio.StartSDLAudioStream(): boolean; +begin + SDL_PauseAudio(0); + result := true; +end; -procedure TAudioPlayback_Portaudio.SetVolume(Volume: integer); +procedure TAudioPlayback_Portaudio.StopSDLAudioStream(); begin - //New: Sets Volume only for this Application -(* - BASS_SetConfig(BASS_CONFIG_GVOL_SAMPLE, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume); - BASS_SetConfig(BASS_CONFIG_GVOL_MUSIC, Volume); -*) + SDL_CloseAudio(); end; -procedure TAudioPlayback_Portaudio.SetMusicVolume(Volume: Integer); +function TAudioPlayback_Portaudio.InitializePlayback: boolean; begin - //Max Volume Prevention - if Volume > 100 then - Volume := 100; + result := false; - if Volume < 0 then - Volume := 0; + //Log.LogStatus('InitializePlayback', 'UAudioPlayback_Portaudio'); - //Set Volume -// BASS_ChannelSetAttributes (Bass, -1, Volume, -101); + //if(not InitializePortaudio()) then + if(not InitializeSDLAudio()) then + Exit; + + MixerStream := TAudioMixerStream.Create; + + //if(not StartPortaudioStream()) then; + if(not StartSDLAudioStream()) then + Exit; + + result := true; end; -procedure TAudioPlayback_Portaudio.SetLoop(Enabled: boolean); +destructor TAudioPlayback_Portaudio.Destroy; begin - if (MusicStream <> nil) then - if (MusicStream.IsLoaded) then - MusicStream.SetLoop(Enabled); + StopSDLAudioStream(); + + MixerStream.Free(); + MusicStream.Free(); + + inherited Destroy(); end; -function TAudioPlayback_Portaudio.Open(Filename: string): boolean; +function TAudioPlayback_Portaudio.Load(const Filename: String): TPortaudioPlaybackStream; var decodeStream: TAudioDecodeStream; + playbackStream: TPortaudioPlaybackStream; begin - decodeStream := AudioDecoder.Open(Filename); - MusicStream := TPortaudioPlaybackStream.Create(decodeStream); - // FIXME: remove this line - mixerStream.AddStream(MusicStream); + Result := nil; - if(MusicStream.IsLoaded()) then + decodeStream := AudioDecoder.Open(Filename); + if not assigned(decodeStream) then begin - //Set Max Volume - SetMusicVolume(100); + Log.LogStatus('LoadSoundFromFile: Sound not found "' + Filename + '"', 'UAudioPlayback_Portaudio'); + Exit; end; - Result := MusicStream.IsLoaded(); -end; - -procedure TAudioPlayback_Portaudio.Rewind; -begin - SetPosition(0); -end; + playbackStream := TPortaudioPlaybackStream.Create(); + if (not playbackStream.SetDecodeStream(decodeStream)) then + Exit; -procedure TAudioPlayback_Portaudio.SetPosition(Time: real); -begin - if (MusicStream.IsLoaded) then - begin - MusicStream.SetPosition(Time); - end; -end; + // FIXME: remove this line + MixerStream.AddStream(playbackStream); -function TAudioPlayback_Portaudio.GetPosition: real; -begin - if (MusicStream.IsLoaded) then - Result := MusicStream.GetPosition(); + result := playbackStream; end; -function TAudioPlayback_Portaudio.Length: real; +procedure TAudioPlayback_Portaudio.SetVolume(Volume: integer); begin - Result := 0; - if assigned( MusicStream ) then - if (MusicStream.IsLoaded) then - begin - Result := MusicStream.GetLength(); - end; + // sets volume only for this application + MixerStream.Volume := Volume; end; -procedure TAudioPlayback_Portaudio.Play; +procedure TAudioPlayback_Portaudio.SetMusicVolume(Volume: Integer); begin - if (MusicStream <> nil) then - if (MusicStream.IsLoaded) then - begin - if (MusicStream.GetLoop()) then - begin - end; - // start from beginning... - // actually bass itself does not loop, nor does this TAudio_FFMpeg Class - MusicStream.Play(); - end; + if assigned(MusicStream) then + MusicStream.Volume := Volume; end; -procedure TAudioPlayback_Portaudio.Pause; +procedure TAudioPlayback_Portaudio.SetLoop(Enabled: boolean); begin - if (MusicStream <> nil) then - MusicStream.Pause(); + if assigned(MusicStream) then + MusicStream.SetLoop(Enabled); end; -procedure TAudioPlayback_Portaudio.Stop; +function TAudioPlayback_Portaudio.Open(Filename: string): boolean; +var + decodeStream: TAudioDecodeStream; begin - if MusicStream <> nil then - MusicStream.Stop(); -end; + Result := false; -procedure TAudioPlayback_Portaudio.Close; -begin - if MusicStream <> nil then - MusicStream.Close(); -end; + // free old MusicStream + MusicStream.Free(); -function TAudioPlayback_Portaudio.Finished: boolean; -begin - if MusicStream <> nil then - Result := (MusicStream.GetStatus() = sStopped); -end; + MusicStream := Load(Filename); + if not assigned(MusicStream) then + Exit; -procedure TAudioPlayback_Portaudio.PlayStart; -begin - if StartSoundStream <> nil then - StartSoundStream.Play(); -end; + //Set Max Volume + SetMusicVolume(100); -procedure TAudioPlayback_Portaudio.PlayBack; -begin - if BackSoundStream <> nil then - BackSoundStream.Play(); + Result := true; end; -procedure TAudioPlayback_Portaudio.PlaySwoosh; +procedure TAudioPlayback_Portaudio.Rewind; begin - if SwooshSoundStream <> nil then - SwooshSoundStream.Play(); + SetPosition(0); end; -procedure TAudioPlayback_Portaudio.PlayChange; +procedure TAudioPlayback_Portaudio.SetPosition(Time: real); begin - if ChangeSoundStream <> nil then - ChangeSoundStream.Play(); + if assigned(MusicStream) then + MusicStream.SetPosition(Time); end; -procedure TAudioPlayback_Portaudio.PlayOption; +function TAudioPlayback_Portaudio.GetPosition: real; begin - if OptionSoundStream <> nil then - OptionSoundStream.Play(); + if assigned(MusicStream) then + Result := MusicStream.GetPosition() + else + Result := -1; end; -procedure TAudioPlayback_Portaudio.PlayClick; +function TAudioPlayback_Portaudio.Length: real; begin - if ClickSoundStream <> nil then - ClickSoundStream.Play(); + if assigned(MusicStream) then + Result := MusicStream.GetLength() + else + Result := -1; end; -procedure TAudioPlayback_Portaudio.PlayDrum; +procedure TAudioPlayback_Portaudio.Play; begin - if DrumSoundStream <> nil then - DrumSoundStream.Play(); + if assigned(MusicStream) then + MusicStream.Play(); end; -procedure TAudioPlayback_Portaudio.PlayHihat; +procedure TAudioPlayback_Portaudio.Pause; begin - if HihatSoundStream <> nil then - HihatSoundStream.Play(); + if assigned(MusicStream) then + MusicStream.Pause(); end; -procedure TAudioPlayback_Portaudio.PlayClap; +procedure TAudioPlayback_Portaudio.Stop; begin - if ClapSoundStream <> nil then - ClapSoundStream.Play(); + if assigned(MusicStream) then + MusicStream.Stop(); end; -procedure TAudioPlayback_Portaudio.PlayShuffle; +procedure TAudioPlayback_Portaudio.Close; begin - if ShuffleSoundStream <> nil then - ShuffleSoundStream.Play(); + if assigned(MusicStream) then + begin + MixerStream.RemoveStream(MusicStream); + MusicStream.Close(); + end; end; -procedure TAudioPlayback_Portaudio.StopShuffle; +function TAudioPlayback_Portaudio.Finished: boolean; begin - if ShuffleSoundStream <> nil then - ShuffleSoundStream.Stop(); + if assigned(MusicStream) then + Result := (MusicStream.GetStatus() = ssStopped) + else + Result := true; end; //Equalizer -function TAudioPlayback_Portaudio.GetFFTData: TFFTData; -var - data: TFFTData; +procedure TAudioPlayback_Portaudio.GetFFTData(var data: TFFTData); begin //Get Channel Data Mono and 256 Values // BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); - result := data; end; // Interface for Visualizer @@ -605,66 +699,24 @@ begin result := 0; end; -function TAudioPlayback_Portaudio.Load(Filename: string): TPortaudioPlaybackStream; -var - decodeStream : TAudioDecodeStream; - playbackStream : TPortaudioPlaybackStream; - csIndex : integer; +function TAudioPlayback_Portaudio.OpenSound(const Filename: String): TAudioPlaybackStream; begin - result := nil; - - decodeStream := AudioDecoder.Open(Filename); - if (decodeStream = nil) then - begin - Log.LogStatus('LoadSoundFromFile: Sound not found "' + Filename + '"', 'UAudioPlayback_Portaudio'); - exit; - end; - - playbackStream := TPortaudioPlaybackStream.Create(decodeStream); - // FIXME: remove this line - mixerStream.AddStream(playbackStream); - - //Add CustomSound - csIndex := High(CustomSounds) + 1; - SetLength(CustomSounds, csIndex + 1); - CustomSounds[csIndex].Filename := Filename; - CustomSounds[csIndex].Stream := playbackStream; - - result := playbackStream; + result := Load(Filename); end; -function TAudioPlayback_Portaudio.LoadCustomSound(const Filename: String): Cardinal; -var - S: TAudioPlaybackStream; - I: Integer; - F: String; +procedure TAudioPlayback_Portaudio.PlaySound(stream: TAudioPlaybackStream); begin - //Search for Sound in already loaded Sounds - F := UpperCase(SoundPath + FileName); - For I := 0 to High(CustomSounds) do - begin - if (UpperCase(CustomSounds[I].Filename) = F) then - begin - Result := I; - Exit; - end; - end; - - S := Load(SoundPath + Filename); - if (S <> nil) then - Result := High(CustomSounds) - else - Result := 0; + if assigned(stream) then + stream.Play(); end; -procedure TAudioPlayback_Portaudio.PlayCustomSound(const Index: Cardinal ); +procedure TAudioPlayback_Portaudio.StopSound(stream: TAudioPlaybackStream); begin - if (Index <= High(CustomSounds)) then - CustomSounds[Index].Stream.Play(); + if assigned(stream) then + stream.Stop(); end; - initialization singleton_AudioPlaybackPortaudio := TAudioPlayback_Portaudio.create(); AudioManager.add( singleton_AudioPlaybackPortaudio ); diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 662050dc..a81aa93b 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -161,21 +161,25 @@ end; procedure SingDrawOscilloscope(X, Y, W, H: real; NrSound: integer); var - Pet : integer; + SampleIndex: integer; + Sound: TSound; + MaxX, MaxY: real; begin; -// Log.LogStatus('Oscilloscope', 'SingDraw'); + Sound := AudioInputProcessor.Sound[NrSound]; + + // Log.LogStatus('Oscilloscope', 'SingDraw'); glColor3f(Skin_OscR, Skin_OscG, Skin_OscB); {if (ParamStr(1) = '-black') or (ParamStr(1) = '-fsblack') then glColor3f(1, 1, 1); } - glBegin(GL_LINE_STRIP); - - glVertex2f(X, -AudioInputProcessor.Sound[NrSound].BufferArray[1] / $10000 * H + Y + H/2); + MaxX := W-1; + MaxY := (H-1) / 2; - for Pet := 2 to AudioInputProcessor.Sound[NrSound].n div 1 do + glBegin(GL_LINE_STRIP); + for SampleIndex := 0 to High(Sound.BufferArray) do begin - glVertex2f( X + (Pet-1) * W / (AudioInputProcessor.Sound[NrSound].n - 1), - -AudioInputProcessor.Sound[NrSound].BufferArray[Pet] / $10000 * H + Y + H/2 ); + glVertex2f(X + MaxX * SampleIndex/High(Sound.BufferArray), + Y + MaxY * (1 - Sound.BufferArray[SampleIndex]/-Low(Smallint))); end; glEnd; end; diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index 599bb8fa..4ac67cda 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -1,798 +1,801 @@ -unit UIni; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses IniFiles, ULog, SysUtils; - -type - TIni = class - Name: array[0..11] of string; - - // Templates for Names Mod - NameTeam: array[0..2] of string; - NameTemplate: array[0..11] of string; - - //Filename of the opened iniFile - Filename: string; - - // Game - Players: integer; - Difficulty: integer; - Language: integer; - Tabs: integer; - Tabs_at_startup:integer; //Tabs at Startup fix - Sorting: integer; - Debug: integer; - - // Graphics - Screens: integer; - Resolution: integer; - Depth: integer; - FullScreen: integer; - TextureSize: integer; - SingWindow: integer; - Oscilloscope: integer; - Spectrum: integer; - Spectrograph: integer; - MovieSize: integer; - - // Sound - MicBoost: integer; - ClickAssist: integer; - BeatClick: integer; - SavePlayback: integer; - Threshold: integer; - - //Song Preview - PreviewVolume: integer; - PreviewFading: integer; - - // Lyrics - LyricsFont: integer; - LyricsEffect: integer; - Solmization: integer; - - // Themes - Theme: integer; - SkinNo: integer; - Color: integer; - - // Record - Card: integer; // not saved in config.ini - - CardList: array of record - Name: string; - Input: integer; - ChannelL: integer; - ChannelR: integer; - end; - - // Advanced - LoadAnimation: integer; - EffectSing: integer; - ScreenFade: integer; - AskbeforeDel: integer; - OnSongClick: integer; - LineBonus: integer; - PartyPopup: integer; - - // Controller - Joypad: integer; - - // Soundcards - SoundCard: array[0..7, 1..2] of integer; - - // Devices - LPT: integer; - - procedure Load; - procedure Save; - procedure SaveNames; - procedure SaveLevel; - end; - - -var - Ini: TIni; - IResolution: array of string; - ILanguage: array of string; - ITheme: array of string; - ISkin: array of string; - ICard: array of string; - IInput: array of string; - -const - IPlayers: array[0..4] of string = ('1', '2', '3', '4', '6'); - IDifficulty: array[0..2] of string = ('Easy', 'Medium', 'Hard'); - ITabs: array[0..1] of string = ('Off', 'On'); - - ISorting: array[0..7] of string = ('Edition', 'Genre', 'Language', 'Folder', 'Title', 'Artist', 'Title2', 'Artist2'); - sEdition = 0; - sGenre = 1; - sLanguage = 2; - sFolder = 3; - sTitle = 4; - sArtist = 5; - sTitle2 = 6; - sArtist2 = 7; - - IDebug: array[0..1] of string = ('Off', 'On'); - - IScreens: array[0..1] of string = ('1', '2'); - IFullScreen: array[0..1] of string = ('Off', 'On'); - IDepth: array[0..1] of string = ('16 bit', '32 bit'); - ITextureSize: array[0..2] of string = ('128', '256', '512'); - ISingWindow: array[0..1] of string = ('Small', 'Big'); - - //SingBar Mod - IOscilloscope: array[0..2] of string = ('Off', 'Osci', 'Bar'); - //IOscilloscope: array[0..1] of string = ('Off', 'On'); - - ISpectrum: array[0..1] of string = ('Off', 'On'); - ISpectrograph: array[0..1] of string = ('Off', 'On'); - IMovieSize: array[0..2] of string = ('Half', 'Full [Vid]', 'Full [BG+Vid]'); - - IMicBoost: array[0..3] of string = ('Off', '+6dB', '+12dB', '+18dB'); - IClickAssist: array[0..1] of string = ('Off', 'On'); - IBeatClick: array[0..1] of string = ('Off', 'On'); - ISavePlayback: array[0..1] of string = ('Off', 'On'); - IThreshold: array[0..3] of string = ('5%', '10%', '15%', '20%'); - //Song Preview - IPreviewVolume: array[0..10] of string = ('Off', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%'); - IPreviewFading: array[0..5] of string = ('Off', '1 Sec', '2 Secs', '3 Secs', '4 Secs', '5 Secs'); - - - ILyricsFont: array[0..2] of string = ('Plain', 'OLine1', 'OLine2'); - ILyricsEffect: array[0..3] of string = ('Simple', 'Zoom', 'Slide', 'Ball'); - ISolmization: array[0..3] of string = ('Off', 'Euro', 'Jap', 'American'); - - IColor: array[0..8] of string = ('Blue', 'Green', 'Pink', 'Red', 'Violet', 'Orange', 'Yellow', 'Brown', 'Black'); - - // Advanced - ILoadAnimation: array[0..1] of string = ('Off', 'On'); - IEffectSing: array[0..1] of string = ('Off', 'On'); - IScreenFade: array [0..1] of String =('Off', 'On'); - IAskbeforeDel: array[0..1] of string = ('Off', 'On'); - IOnSongClick: array[0..2] of string = ('Sing', 'Select Players', 'Open Menu'); - ILineBonus: array[0..2] of string = ('Off', 'At Score', 'At Notes'); - IPartyPopup: array[0..1] of string = ('Off', 'On'); - - IJoypad: array[0..1] of string = ('Off', 'On'); - ILPT: array[0..2] of string = ('Off', 'LCD', 'Lights'); - - IChannel: array[0..6] of string = ('Off', '1', '2', '3', '4', '5', '6'); - -implementation - -uses //UFiles, - UMain, - SDL, - ULanguage, - UPlatform, - USkins, - URecord, - UCommandLine; - -procedure TIni.Load; -var - IniFile: TMemIniFile; - ThemeIni: TMemIniFile; - Tekst: string; - Pet: integer; - B: boolean; - I, I2, I3: integer; - S: string; - Modes: PPSDL_Rect; - SR: TSearchRec; //Skin List Patch - - function GetFileName (S: String):String; - begin - //Result := copy (S,0,StrRScan (PChar(S),char('.'))+1); - Result := copy (S,0,Pos ('.ini',S)-1); - end; - -begin - GamePath := Platform.GetGameUserPath; - - if (Params.ConfigFile <> '') then - try - IniFile := TMemIniFile.Create(Params.ConfigFile); - except - IniFile := TMemIniFile.Create(GamePath + 'config.ini'); - end - else - IniFile := TMemIniFile.Create(GamePath + 'config.ini'); - - - // Name - for I := 0 to 11 do - Ini.Name[I] := IniFile.ReadString('Name', 'P'+IntToStr(I+1), 'Player'+IntToStr(I+1)); - - - // Templates for Names Mod - for I := 0 to 2 do - Ini.NameTeam[I] := IniFile.ReadString('NameTeam', 'T'+IntToStr(I+1), 'Team'+IntToStr(I+1)); - for I := 0 to 11 do - Ini.NameTemplate[I] := IniFile.ReadString('NameTemplate', 'Name'+IntToStr(I+1), 'Template'+IntToStr(I+1)); - - // Players - Tekst := IniFile.ReadString('Game', 'Players', IPlayers[0]); - for Pet := 0 to High(IPlayers) do - if Tekst = IPlayers[Pet] then Ini.Players := Pet; - - // Difficulty - Tekst := IniFile.ReadString('Game', 'Difficulty', 'Easy'); - for Pet := 0 to High(IDifficulty) do - if Tekst = IDifficulty[Pet] then Ini.Difficulty := Pet; - - // Language - Tekst := IniFile.ReadString('Game', 'Language', 'English'); - for Pet := 0 to High(ILanguage) do - if Tekst = ILanguage[Pet] then Ini.Language := Pet; - -// Language.ChangeLanguage(ILanguage[Ini.Language]); - - // Tabs - Tekst := IniFile.ReadString('Game', 'Tabs', ITabs[0]); - for Pet := 0 to High(ITabs) do - if Tekst = ITabs[Pet] then Ini.Tabs := Pet; - - //Tabs at Startup fix - Ini.Tabs_at_startup := Ini.Tabs; - - // Sorting - Tekst := IniFile.ReadString('Game', 'Sorting', ISorting[0]); - for Pet := 0 to High(ISorting) do - if Tekst = ISorting[Pet] then Ini.Sorting := Pet; - - // Debug - Tekst := IniFile.ReadString('Game', 'Debug', IDebug[0]); - for Pet := 0 to High(IDebug) do - if Tekst = IDebug[Pet] then Ini.Debug := Pet; - - //if Ini.Debug = 1 then SongPath := 'E:\UltraStar 03\Songs\'; - - // Screens - Tekst := IniFile.ReadString('Graphics', 'Screens', IScreens[0]); - for Pet := 0 to High(IScreens) do - if Tekst = IScreens[Pet] then Ini.Screens := Pet; - - // FullScreen - Tekst := IniFile.ReadString('Graphics', 'FullScreen', 'On'); - for Pet := 0 to High(IFullScreen) do - if Tekst = IFullScreen[Pet] then Ini.FullScreen := Pet; - - - // Resolution - SetLength(IResolution, 0); - - Modes := SDL_ListModes(nil, SDL_OPENGL or SDL_FULLSCREEN); // Check if there are any modes available - while assigned( Modes^ ) do //this should solve the biggest wine problem | THANKS Linnex (11.11.07) - begin - SetLength(IResolution, Length(IResolution) + 1); - IResolution[High(IResolution)] := IntToStr(Modes^.w) + 'x' + IntToStr(Modes^.h); - Inc(Modes); - end; - - // if no modes were set, then failback to 800x600 - // as per http://sourceforge.net/forum/message.php?msg_id=4544965 - // THANKS : linnex at users.sourceforge.net - if Length(IResolution) < 1 then - begin - SetLength(IResolution, Length(IResolution) + 1); - IResolution[High(IResolution)] := IntToStr(800) + 'x' + IntToStr(600); - Log.LogStatus('SDL_ListModes Defaulted Res To : ' + IResolution[High(IResolution)] , 'Graphics - Resolutions'); - - // Default to fullscreen OFF, in this case ! - Ini.FullScreen := 0; - end; - - // reverse order - for I := 0 to (Length(IResolution) div 2) - 1 do begin - S := IResolution[I]; - IResolution[I] := IResolution[High(IResolution)-I]; - IResolution[High(IResolution)-I] := S; - end; - - Tekst := IniFile.ReadString('Graphics', 'Resolution', '800x600'); - for Pet := 0 to High(IResolution) do - if Tekst = IResolution[Pet] then Ini.Resolution := Pet; - - - // Resolution - Tekst := IniFile.ReadString('Graphics', 'Depth', '32 bit'); - for Pet := 0 to High(IDepth) do - if Tekst = IDepth[Pet] then Ini.Depth := Pet; - - // Texture Size - Tekst := IniFile.ReadString('Graphics', 'TextureSize', ITextureSize[1]); - for Pet := 0 to High(ITextureSize) do - if Tekst = ITextureSize[Pet] then Ini.TextureSize := Pet; - - // SingWindow - Tekst := IniFile.ReadString('Graphics', 'SingWindow', 'Big'); - for Pet := 0 to High(ISingWindow) do - if Tekst = ISingWindow[Pet] then Ini.SingWindow := Pet; - - // Oscilloscope - Tekst := IniFile.ReadString('Graphics', 'Oscilloscope', 'Bar'); - for Pet := 0 to High(IOscilloscope) do - if Tekst = IOscilloscope[Pet] then Ini.Oscilloscope := Pet; - - // Spectrum - Tekst := IniFile.ReadString('Graphics', 'Spectrum', 'Off'); - for Pet := 0 to High(ISpectrum) do - if Tekst = ISpectrum[Pet] then Ini.Spectrum := Pet; - - // Spectrograph - Tekst := IniFile.ReadString('Graphics', 'Spectrograph', 'Off'); - for Pet := 0 to High(ISpectrograph) do - if Tekst = ISpectrograph[Pet] then Ini.Spectrograph := Pet; - - // MovieSize - Tekst := IniFile.ReadString('Graphics', 'MovieSize', IMovieSize[2]); - for Pet := 0 to High(IMovieSize) do - if Tekst = IMovieSize[Pet] then Ini.MovieSize := Pet; - - // MicBoost - Tekst := IniFile.ReadString('Sound', 'MicBoost', 'Off'); - for Pet := 0 to High(IMicBoost) do - if Tekst = IMicBoost[Pet] then Ini.MicBoost := Pet; - - // ClickAssist - Tekst := IniFile.ReadString('Sound', 'ClickAssist', 'Off'); - for Pet := 0 to High(IClickAssist) do - if Tekst = IClickAssist[Pet] then Ini.ClickAssist := Pet; - - // BeatClick - Tekst := IniFile.ReadString('Sound', 'BeatClick', IBeatClick[0]); - for Pet := 0 to High(IBeatClick) do - if Tekst = IBeatClick[Pet] then Ini.BeatClick := Pet; - - // SavePlayback - Tekst := IniFile.ReadString('Sound', 'SavePlayback', ISavePlayback[0]); - for Pet := 0 to High(ISavePlayback) do - if Tekst = ISavePlayback[Pet] then Ini.SavePlayback := Pet; - - // Threshold - Tekst := IniFile.ReadString('Sound', 'Threshold', IThreshold[2]); - for Pet := 0 to High(IThreshold) do - if Tekst = IThreshold[Pet] then Ini.Threshold := Pet; - - //Song Preview - Tekst := IniFile.ReadString('Sound', 'PreviewVolume', IPreviewVolume[7]); - for Pet := 0 to High(IPreviewVolume) do - if Tekst = IPreviewVolume[Pet] then Ini.PreviewVolume := Pet; - - Tekst := IniFile.ReadString('Sound', 'PreviewFading', IPreviewFading[1]); - for Pet := 0 to High(IPreviewFading) do - if Tekst = IPreviewFading[Pet] then Ini.PreviewFading := Pet; - - // Lyrics Font - Tekst := IniFile.ReadString('Lyrics', 'LyricsFont', ILyricsFont[1]); - for Pet := 0 to High(ILyricsFont) do - if Tekst = ILyricsFont[Pet] then Ini.LyricsFont := Pet; - - // Lyrics Effect - Tekst := IniFile.ReadString('Lyrics', 'LyricsEffect', ILyricsEffect[1]); - for Pet := 0 to High(ILyricsEffect) do - if Tekst = ILyricsEffect[Pet] then Ini.LyricsEffect := Pet; - - // Solmization - Tekst := IniFile.ReadString('Lyrics', 'Solmization', ISolmization[0]); - for Pet := 0 to High(ISolmization) do - if Tekst = ISolmization[Pet] then Ini.Solmization := Pet; - - // Theme - - //Theme List Patch - - //I2 Saves the no of the Deluxe (Standard-) Theme - I2 := 0; - //I counts is the cur. Theme no - I := 0; - - SetLength(ITheme, 0); - writeln( 'Searching for Theme : '+ ThemePath + '*.ini' ); - FindFirst(ThemePath + '*.ini',faAnyFile,SR); - Repeat - writeln( SR.Name ); - - //Read Themename from Theme - ThemeIni := TMemIniFile.Create(SR.Name); - Tekst := UpperCase(ThemeIni.ReadString('Theme','Name',GetFileName(SR.Name))); - ThemeIni.Free; - - //if Deluxe Theme then save Themeno to I2 - if (Tekst = 'DELUXE') then - I2 := I; - - //Search for Skins for this Theme - for Pet := low(Skin.Skin) to high(Skin.Skin) do - begin - if UpperCase(Skin.Skin[Pet].Theme) = Tekst then - begin - SetLength(ITheme, Length(ITheme)+1); - ITheme[High(ITheme)] := GetFileName(SR.Name); - break; - end; - end; - - Inc(I); - Until FindNext(SR) <> 0; - FindClose(SR); - //Theme List Patch End } - - //No Theme Found - if (Length(ITheme)=0) then - begin - Log.CriticalError('Could not find any valid Themes.'); - end; - - - Tekst := IniFile.ReadString('Themes', 'Theme', ITheme[I2]); - Ini.Theme := 0; - for Pet := 0 to High(ITheme) do - if Uppercase(Tekst) = Uppercase(ITheme[Pet]) then Ini.Theme := Pet; - - // Skin - Skin.onThemeChange; - Ini.SkinNo := 0; - - Tekst := IniFile.ReadString('Themes', 'Skin', ISkin[0]); - for Pet := 0 to High(ISkin) do - if Tekst = ISkin[Pet] then Ini.SkinNo := Pet; - - // Color - Tekst := IniFile.ReadString('Themes', 'Color', IColor[0]); - for Pet := 0 to High(IColor) do - if Tekst = IColor[Pet] then Ini.Color := Pet; - - // Record - load ini list - SetLength(CardList, 0); - I := 1; - while (IniFile.ValueExists('Record', 'DeviceName' + IntToStr(I)) = true) do begin - //Automatically Delete not Existing Sound Cards - S := IniFile.ReadString('Record', 'DeviceName' + IntToStr(I), ''); - //{ - B := False; - //Look for Soundcard - for I2 := 0 to High(AudioInputProcessor.SoundCard) do - begin - if (S = Trim(AudioInputProcessor.SoundCard[I2].Description)) then - begin - B := True; - Break; - end; - end; - - if B then - begin //} - I3 := Length(CardList); - SetLength(CardList, I3+1); - Ini.CardList[I3].Name := S; - Ini.CardList[I3].Input := IniFile.ReadInteger('Record', 'Input' + IntToStr(I), 0); - Ini.CardList[I3].ChannelL := IniFile.ReadInteger('Record', 'ChannelL' + IntToStr(I), 0); - Ini.CardList[I3].ChannelR := IniFile.ReadInteger('Record', 'ChannelR' + IntToStr(I), 0); - end; - Inc(I); - end; - - // Record - append detected soundcards - for I := 0 to High(AudioInputProcessor.SoundCard) do - begin - B := False; - For I2 := 0 to High(CardList) do - begin //Search for Card in List - if (CardList[I2].Name = Trim(AudioInputProcessor.SoundCard[I].Description)) then - begin - B := True; - Break; - end; - end; - - //If not in List -> Add - If not B then - begin - I3 := Length(CardList); - SetLength(CardList, I3+1); - CardList[I3].Name := Trim(AudioInputProcessor.SoundCard[I].Description); - CardList[I3].Input := 0; - CardList[I3].ChannelL := 0; - CardList[I3].ChannelR := 0; - // default for new users - if (Length(CardList) = 1) then - CardList[I].ChannelL := 1; - end; - end; - - //Advanced Settings - - // LoadAnimation - Tekst := IniFile.ReadString('Advanced', 'LoadAnimation', 'On'); - for Pet := 0 to High(ILoadAnimation) do - if Tekst = ILoadAnimation[Pet] then Ini.LoadAnimation := Pet; - - // ScreenFade - Tekst := IniFile.ReadString('Advanced', 'ScreenFade', 'On'); - for Pet := 0 to High(IScreenFade) do - if Tekst = IScreenFade[Pet] then Ini.ScreenFade := Pet; - - // EffectSing - Tekst := IniFile.ReadString('Advanced', 'EffectSing', 'On'); - for Pet := 0 to High(IEffectSing) do - if Tekst = IEffectSing[Pet] then Ini.EffectSing := Pet; - - // AskbeforeDel - Tekst := IniFile.ReadString('Advanced', 'AskbeforeDel', 'On'); - for Pet := 0 to High(IAskbeforeDel) do - if Tekst = IAskbeforeDel[Pet] then Ini.AskbeforeDel := Pet; - - // OnSongClick - Tekst := IniFile.ReadString('Advanced', 'OnSongClick', 'Sing'); - for Pet := 0 to High(IOnSongClick) do - if Tekst = IOnSongClick[Pet] then Ini.OnSongClick := Pet; - - // Linebonus - Tekst := IniFile.ReadString('Advanced', 'LineBonus', 'At Score'); - for Pet := 0 to High(ILineBonus) do - if Tekst = ILineBonus[Pet] then Ini.LineBonus := Pet; - - // PartyPopup - Tekst := IniFile.ReadString('Advanced', 'PartyPopup', 'On'); - for Pet := 0 to High(IPartyPopup) do - if Tekst = IPartyPopup[Pet] then Ini.PartyPopup := Pet; - - - // Joypad - Tekst := IniFile.ReadString('Controller', 'Joypad', IJoypad[0]); - for Pet := 0 to High(IJoypad) do - if Tekst = IJoypad[Pet] then Ini.Joypad := Pet; - - // LCD - Tekst := IniFile.ReadString('Devices', 'LPT', ILPT[0]); - for Pet := 0 to High(ILPT) do - if Tekst = ILPT[Pet] then Ini.LPT := Pet; - - - // SongPath - if (Params.SongPath <> '') then - SongPath := IncludeTrailingPathDelimiter(Params.SongPath) - else - SongPath := IncludeTrailingPathDelimiter(IniFile.ReadString('Path', 'Songs', SongPath)); - - Filename := IniFile.FileName; - IniFile.Free; -end; - -procedure TIni.Save; -var - IniFile: TIniFile; - Tekst: string; - I: Integer; - S: String; -begin - //if not (FileExists(GamePath + 'config.ini') and FileIsReadOnly(GamePath + 'config.ini')) then begin - if not (FileExists(Filename) and FileIsReadOnly(Filename)) then begin - - IniFile := TIniFile.Create(Filename); - - // Players - Tekst := IPlayers[Ini.Players]; - IniFile.WriteString('Game', 'Players', Tekst); - - // Difficulty - Tekst := IDifficulty[Ini.Difficulty]; - IniFile.WriteString('Game', 'Difficulty', Tekst); - - // Language - Tekst := ILanguage[Ini.Language]; - IniFile.WriteString('Game', 'Language', Tekst); - - // Tabs - Tekst := ITabs[Ini.Tabs]; - IniFile.WriteString('Game', 'Tabs', Tekst); - - // Sorting - Tekst := ISorting[Ini.Sorting]; - IniFile.WriteString('Game', 'Sorting', Tekst); - - // Debug - Tekst := IDebug[Ini.Debug]; - IniFile.WriteString('Game', 'Debug', Tekst); - - // Screens - Tekst := IScreens[Ini.Screens]; - IniFile.WriteString('Graphics', 'Screens', Tekst); - - // FullScreen - Tekst := IFullScreen[Ini.FullScreen]; - IniFile.WriteString('Graphics', 'FullScreen', Tekst); - - // Resolution - Tekst := IResolution[Ini.Resolution]; - IniFile.WriteString('Graphics', 'Resolution', Tekst); - - // Depth - Tekst := IDepth[Ini.Depth]; - IniFile.WriteString('Graphics', 'Depth', Tekst); - - // Resolution - Tekst := ITextureSize[Ini.TextureSize]; - IniFile.WriteString('Graphics', 'TextureSize', Tekst); - - // Sing Window - Tekst := ISingWindow[Ini.SingWindow]; - IniFile.WriteString('Graphics', 'SingWindow', Tekst); - - // Oscilloscope - Tekst := IOscilloscope[Ini.Oscilloscope]; - IniFile.WriteString('Graphics', 'Oscilloscope', Tekst); - - // Spectrum - Tekst := ISpectrum[Ini.Spectrum]; - IniFile.WriteString('Graphics', 'Spectrum', Tekst); - - // Spectrograph - Tekst := ISpectrograph[Ini.Spectrograph]; - IniFile.WriteString('Graphics', 'Spectrograph', Tekst); - - // Movie Size - Tekst := IMovieSize[Ini.MovieSize]; - IniFile.WriteString('Graphics', 'MovieSize', Tekst); - - // MicBoost - Tekst := IMicBoost[Ini.MicBoost]; - IniFile.WriteString('Sound', 'MicBoost', Tekst); - - // ClickAssist - Tekst := IClickAssist[Ini.ClickAssist]; - IniFile.WriteString('Sound', 'ClickAssist', Tekst); - - // BeatClick - Tekst := IBeatClick[Ini.BeatClick]; - IniFile.WriteString('Sound', 'BeatClick', Tekst); - - // Threshold - Tekst := IThreshold[Ini.Threshold]; - IniFile.WriteString('Sound', 'Threshold', Tekst); - - // Song Preview - Tekst := IPreviewVolume[Ini.PreviewVolume]; - IniFile.WriteString('Sound', 'PreviewVolume', Tekst); - - Tekst := IPreviewFading[Ini.PreviewFading]; - IniFile.WriteString('Sound', 'PreviewFading', Tekst); - - // SavePlayback - Tekst := ISavePlayback[Ini.SavePlayback]; - IniFile.WriteString('Sound', 'SavePlayback', Tekst); - - // Lyrics Font - Tekst := ILyricsFont[Ini.LyricsFont]; - IniFile.WriteString('Lyrics', 'LyricsFont', Tekst); - - // Lyrics Effect - Tekst := ILyricsEffect[Ini.LyricsEffect]; - IniFile.WriteString('Lyrics', 'LyricsEffect', Tekst); - - // Solmization - Tekst := ISolmization[Ini.Solmization]; - IniFile.WriteString('Lyrics', 'Solmization', Tekst); - - // Theme - Tekst := ITheme[Ini.Theme]; - IniFile.WriteString('Themes', 'Theme', Tekst); - - // Skin - Tekst := ISkin[Ini.SkinNo]; - IniFile.WriteString('Themes', 'Skin', Tekst); - - // Color - Tekst := IColor[Ini.Color]; - IniFile.WriteString('Themes', 'Color', Tekst); - - // Record - for I := 0 to High(CardList) do begin - S := IntToStr(I+1); - - Tekst := CardList[I].Name; - IniFile.WriteString('Record', 'DeviceName' + S, Tekst); - - Tekst := IntToStr(CardList[I].Input); - IniFile.WriteString('Record', 'Input' + S, Tekst); - - Tekst := IntToStr(CardList[I].ChannelL); - IniFile.WriteString('Record', 'ChannelL' + S, Tekst); - - Tekst := IntToStr(CardList[I].ChannelR); - IniFile.WriteString('Record', 'ChannelR' + S, Tekst); - end; - - //Log.LogError(InttoStr(Length(CardList)) + ' Cards Saved'); - - //Advanced Settings - - //LoadAnimation - Tekst := ILoadAnimation[Ini.LoadAnimation]; - IniFile.WriteString('Advanced', 'LoadAnimation', Tekst); - - //EffectSing - Tekst := IEffectSing[Ini.EffectSing]; - IniFile.WriteString('Advanced', 'EffectSing', Tekst); - - //ScreenFade - Tekst := IScreenFade[Ini.ScreenFade]; - IniFile.WriteString('Advanced', 'ScreenFade', Tekst); - - //AskbeforeDel - Tekst := IAskbeforeDel[Ini.AskbeforeDel]; - IniFile.WriteString('Advanced', 'AskbeforeDel', Tekst); - - //OnSongClick - Tekst := IOnSongClick[Ini.OnSongClick]; - IniFile.WriteString('Advanced', 'OnSongClick', Tekst); - - //Line Bonus - Tekst := ILineBonus[Ini.LineBonus]; - IniFile.WriteString('Advanced', 'LineBonus', Tekst); - - //Party Popup - Tekst := IPartyPopup[Ini.PartyPopup]; - IniFile.WriteString('Advanced', 'PartyPopup', Tekst); - - // Joypad - Tekst := IJoypad[Ini.Joypad]; - IniFile.WriteString('Controller', 'Joypad', Tekst); - - IniFile.Free; - end; -end; - -procedure TIni.SaveNames; -var - IniFile: TIniFile; - I: integer; -begin - //if not FileIsReadOnly(GamePath + 'config.ini') then begin - //IniFile := TIniFile.Create(GamePath + 'config.ini'); - if not FileIsReadOnly(Filename) then begin - IniFile := TIniFile.Create(Filename); - - //Name - // Templates for Names Mod - for I := 1 to 12 do - IniFile.WriteString('Name', 'P' + IntToStr(I), Ini.Name[I-1]); - for I := 1 to 3 do - IniFile.WriteString('NameTeam', 'T' + IntToStr(I), Ini.NameTeam[I-1]); - for I := 1 to 12 do - IniFile.WriteString('NameTemplate', 'Name' + IntToStr(I), Ini.NameTemplate[I-1]); - - IniFile.Free; - end; -end; - -procedure TIni.SaveLevel; -var - IniFile: TIniFile; - I: integer; -begin - //if not FileIsReadOnly(GamePath + 'config.ini') then begin - //IniFile := TIniFile.Create(GamePath + 'config.ini'); - if not FileIsReadOnly(Filename) then begin - IniFile := TIniFile.Create(Filename); - - // Difficulty - IniFile.WriteString('Game', 'Difficulty', IDifficulty[Ini.Difficulty]); - - IniFile.Free; - end; -end; - -end. +unit UIni; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses IniFiles, ULog, SysUtils; + +type + PInputDeviceConfig = ^TInputDeviceConfig; + TInputDeviceConfig = record + Name: string; + Input: integer; + ChannelToPlayerMap: array[0..1] of integer; + end; + +type + TIni = class + Name: array[0..11] of string; + + // Templates for Names Mod + NameTeam: array[0..2] of string; + NameTemplate: array[0..11] of string; + + //Filename of the opened iniFile + Filename: string; + + // Game + Players: integer; + Difficulty: integer; + Language: integer; + Tabs: integer; + Tabs_at_startup:integer; //Tabs at Startup fix + Sorting: integer; + Debug: integer; + + // Graphics + Screens: integer; + Resolution: integer; + Depth: integer; + FullScreen: integer; + TextureSize: integer; + SingWindow: integer; + Oscilloscope: integer; + Spectrum: integer; + Spectrograph: integer; + MovieSize: integer; + + // Sound + MicBoost: integer; + ClickAssist: integer; + BeatClick: integer; + SavePlayback: integer; + Threshold: integer; + + //Song Preview + PreviewVolume: integer; + PreviewFading: integer; + + // Lyrics + LyricsFont: integer; + LyricsEffect: integer; + Solmization: integer; + + // Themes + Theme: integer; + SkinNo: integer; + Color: integer; + + // Record + InputDeviceConfig: array of TInputDeviceConfig; + + // Advanced + LoadAnimation: integer; + EffectSing: integer; + ScreenFade: integer; + AskbeforeDel: integer; + OnSongClick: integer; + LineBonus: integer; + PartyPopup: integer; + + // Controller + Joypad: integer; + + // Soundcards + SoundCard: array[0..7, 1..2] of integer; + + // Devices + LPT: integer; + + procedure Load; + procedure Save; + procedure SaveNames; + procedure SaveLevel; + end; + + +var + Ini: TIni; + IResolution: array of string; + ILanguage: array of string; + ITheme: array of string; + ISkin: array of string; + ICard: array of string; + IInput: array of string; + +const + IPlayers: array[0..4] of string = ('1', '2', '3', '4', '6'); + IDifficulty: array[0..2] of string = ('Easy', 'Medium', 'Hard'); + ITabs: array[0..1] of string = ('Off', 'On'); + + ISorting: array[0..7] of string = ('Edition', 'Genre', 'Language', 'Folder', 'Title', 'Artist', 'Title2', 'Artist2'); + sEdition = 0; + sGenre = 1; + sLanguage = 2; + sFolder = 3; + sTitle = 4; + sArtist = 5; + sTitle2 = 6; + sArtist2 = 7; + + IDebug: array[0..1] of string = ('Off', 'On'); + + IScreens: array[0..1] of string = ('1', '2'); + IFullScreen: array[0..1] of string = ('Off', 'On'); + IDepth: array[0..1] of string = ('16 bit', '32 bit'); + ITextureSize: array[0..2] of string = ('128', '256', '512'); + ISingWindow: array[0..1] of string = ('Small', 'Big'); + + //SingBar Mod + IOscilloscope: array[0..2] of string = ('Off', 'Osci', 'Bar'); + //IOscilloscope: array[0..1] of string = ('Off', 'On'); + + ISpectrum: array[0..1] of string = ('Off', 'On'); + ISpectrograph: array[0..1] of string = ('Off', 'On'); + IMovieSize: array[0..2] of string = ('Half', 'Full [Vid]', 'Full [BG+Vid]'); + + IMicBoost: array[0..3] of string = ('Off', '+6dB', '+12dB', '+18dB'); + IClickAssist: array[0..1] of string = ('Off', 'On'); + IBeatClick: array[0..1] of string = ('Off', 'On'); + ISavePlayback: array[0..1] of string = ('Off', 'On'); + IThreshold: array[0..3] of string = ('5%', '10%', '15%', '20%'); + //Song Preview + IPreviewVolume: array[0..10] of string = ('Off', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%'); + IPreviewFading: array[0..5] of string = ('Off', '1 Sec', '2 Secs', '3 Secs', '4 Secs', '5 Secs'); + + + ILyricsFont: array[0..2] of string = ('Plain', 'OLine1', 'OLine2'); + ILyricsEffect: array[0..3] of string = ('Simple', 'Zoom', 'Slide', 'Ball'); + ISolmization: array[0..3] of string = ('Off', 'Euro', 'Jap', 'American'); + + IColor: array[0..8] of string = ('Blue', 'Green', 'Pink', 'Red', 'Violet', 'Orange', 'Yellow', 'Brown', 'Black'); + + // Advanced + ILoadAnimation: array[0..1] of string = ('Off', 'On'); + IEffectSing: array[0..1] of string = ('Off', 'On'); + IScreenFade: array [0..1] of String =('Off', 'On'); + IAskbeforeDel: array[0..1] of string = ('Off', 'On'); + IOnSongClick: array[0..2] of string = ('Sing', 'Select Players', 'Open Menu'); + ILineBonus: array[0..2] of string = ('Off', 'At Score', 'At Notes'); + IPartyPopup: array[0..1] of string = ('Off', 'On'); + + IJoypad: array[0..1] of string = ('Off', 'On'); + ILPT: array[0..2] of string = ('Off', 'LCD', 'Lights'); + + IChannel: array[0..6] of string = ('Off', '1', '2', '3', '4', '5', '6'); + +implementation + +uses //UFiles, + UMain, + SDL, + ULanguage, + UPlatform, + USkins, + URecord, + UCommandLine; + +procedure TIni.Load; +var + IniFile: TMemIniFile; + ThemeIni: TMemIniFile; + Tekst: string; + Pet: integer; + B: boolean; + I, I2, I3: integer; + S: string; + Modes: PPSDL_Rect; + SR: TSearchRec; //Skin List Patch + + function GetFileName (S: String):String; + begin + //Result := copy (S,0,StrRScan (PChar(S),char('.'))+1); + Result := copy (S,0,Pos ('.ini',S)-1); + end; + +begin + GamePath := Platform.GetGameUserPath; + + if (Params.ConfigFile <> '') then + try + IniFile := TMemIniFile.Create(Params.ConfigFile); + except + IniFile := TMemIniFile.Create(GamePath + 'config.ini'); + end + else + IniFile := TMemIniFile.Create(GamePath + 'config.ini'); + + + // Name + for I := 0 to 11 do + Ini.Name[I] := IniFile.ReadString('Name', 'P'+IntToStr(I+1), 'Player'+IntToStr(I+1)); + + + // Templates for Names Mod + for I := 0 to 2 do + Ini.NameTeam[I] := IniFile.ReadString('NameTeam', 'T'+IntToStr(I+1), 'Team'+IntToStr(I+1)); + for I := 0 to 11 do + Ini.NameTemplate[I] := IniFile.ReadString('NameTemplate', 'Name'+IntToStr(I+1), 'Template'+IntToStr(I+1)); + + // Players + Tekst := IniFile.ReadString('Game', 'Players', IPlayers[0]); + for Pet := 0 to High(IPlayers) do + if Tekst = IPlayers[Pet] then Ini.Players := Pet; + + // Difficulty + Tekst := IniFile.ReadString('Game', 'Difficulty', 'Easy'); + for Pet := 0 to High(IDifficulty) do + if Tekst = IDifficulty[Pet] then Ini.Difficulty := Pet; + + // Language + Tekst := IniFile.ReadString('Game', 'Language', 'English'); + for Pet := 0 to High(ILanguage) do + if Tekst = ILanguage[Pet] then Ini.Language := Pet; + +// Language.ChangeLanguage(ILanguage[Ini.Language]); + + // Tabs + Tekst := IniFile.ReadString('Game', 'Tabs', ITabs[0]); + for Pet := 0 to High(ITabs) do + if Tekst = ITabs[Pet] then Ini.Tabs := Pet; + + //Tabs at Startup fix + Ini.Tabs_at_startup := Ini.Tabs; + + // Sorting + Tekst := IniFile.ReadString('Game', 'Sorting', ISorting[0]); + for Pet := 0 to High(ISorting) do + if Tekst = ISorting[Pet] then Ini.Sorting := Pet; + + // Debug + Tekst := IniFile.ReadString('Game', 'Debug', IDebug[0]); + for Pet := 0 to High(IDebug) do + if Tekst = IDebug[Pet] then Ini.Debug := Pet; + + //if Ini.Debug = 1 then SongPath := 'E:\UltraStar 03\Songs\'; + + // Screens + Tekst := IniFile.ReadString('Graphics', 'Screens', IScreens[0]); + for Pet := 0 to High(IScreens) do + if Tekst = IScreens[Pet] then Ini.Screens := Pet; + + // FullScreen + Tekst := IniFile.ReadString('Graphics', 'FullScreen', 'On'); + for Pet := 0 to High(IFullScreen) do + if Tekst = IFullScreen[Pet] then Ini.FullScreen := Pet; + + + // Resolution + SetLength(IResolution, 0); + + Modes := SDL_ListModes(nil, SDL_OPENGL or SDL_FULLSCREEN); // Check if there are any modes available + while assigned( Modes^ ) do //this should solve the biggest wine problem | THANKS Linnex (11.11.07) + begin + SetLength(IResolution, Length(IResolution) + 1); + IResolution[High(IResolution)] := IntToStr(Modes^.w) + 'x' + IntToStr(Modes^.h); + Inc(Modes); + end; + + // if no modes were set, then failback to 800x600 + // as per http://sourceforge.net/forum/message.php?msg_id=4544965 + // THANKS : linnex at users.sourceforge.net + if Length(IResolution) < 1 then + begin + SetLength(IResolution, Length(IResolution) + 1); + IResolution[High(IResolution)] := IntToStr(800) + 'x' + IntToStr(600); + Log.LogStatus('SDL_ListModes Defaulted Res To : ' + IResolution[High(IResolution)] , 'Graphics - Resolutions'); + + // Default to fullscreen OFF, in this case ! + Ini.FullScreen := 0; + end; + + // reverse order + for I := 0 to (Length(IResolution) div 2) - 1 do begin + S := IResolution[I]; + IResolution[I] := IResolution[High(IResolution)-I]; + IResolution[High(IResolution)-I] := S; + end; + + Tekst := IniFile.ReadString('Graphics', 'Resolution', '800x600'); + for Pet := 0 to High(IResolution) do + if Tekst = IResolution[Pet] then Ini.Resolution := Pet; + + + // Resolution + Tekst := IniFile.ReadString('Graphics', 'Depth', '32 bit'); + for Pet := 0 to High(IDepth) do + if Tekst = IDepth[Pet] then Ini.Depth := Pet; + + // Texture Size + Tekst := IniFile.ReadString('Graphics', 'TextureSize', ITextureSize[1]); + for Pet := 0 to High(ITextureSize) do + if Tekst = ITextureSize[Pet] then Ini.TextureSize := Pet; + + // SingWindow + Tekst := IniFile.ReadString('Graphics', 'SingWindow', 'Big'); + for Pet := 0 to High(ISingWindow) do + if Tekst = ISingWindow[Pet] then Ini.SingWindow := Pet; + + // Oscilloscope + Tekst := IniFile.ReadString('Graphics', 'Oscilloscope', 'Bar'); + for Pet := 0 to High(IOscilloscope) do + if Tekst = IOscilloscope[Pet] then Ini.Oscilloscope := Pet; + + // Spectrum + Tekst := IniFile.ReadString('Graphics', 'Spectrum', 'Off'); + for Pet := 0 to High(ISpectrum) do + if Tekst = ISpectrum[Pet] then Ini.Spectrum := Pet; + + // Spectrograph + Tekst := IniFile.ReadString('Graphics', 'Spectrograph', 'Off'); + for Pet := 0 to High(ISpectrograph) do + if Tekst = ISpectrograph[Pet] then Ini.Spectrograph := Pet; + + // MovieSize + Tekst := IniFile.ReadString('Graphics', 'MovieSize', IMovieSize[2]); + for Pet := 0 to High(IMovieSize) do + if Tekst = IMovieSize[Pet] then Ini.MovieSize := Pet; + + // MicBoost + Tekst := IniFile.ReadString('Sound', 'MicBoost', 'Off'); + for Pet := 0 to High(IMicBoost) do + if Tekst = IMicBoost[Pet] then Ini.MicBoost := Pet; + + // ClickAssist + Tekst := IniFile.ReadString('Sound', 'ClickAssist', 'Off'); + for Pet := 0 to High(IClickAssist) do + if Tekst = IClickAssist[Pet] then Ini.ClickAssist := Pet; + + // BeatClick + Tekst := IniFile.ReadString('Sound', 'BeatClick', IBeatClick[0]); + for Pet := 0 to High(IBeatClick) do + if Tekst = IBeatClick[Pet] then Ini.BeatClick := Pet; + + // SavePlayback + Tekst := IniFile.ReadString('Sound', 'SavePlayback', ISavePlayback[0]); + for Pet := 0 to High(ISavePlayback) do + if Tekst = ISavePlayback[Pet] then Ini.SavePlayback := Pet; + + // Threshold + Tekst := IniFile.ReadString('Sound', 'Threshold', IThreshold[2]); + for Pet := 0 to High(IThreshold) do + if Tekst = IThreshold[Pet] then Ini.Threshold := Pet; + + //Song Preview + Tekst := IniFile.ReadString('Sound', 'PreviewVolume', IPreviewVolume[7]); + for Pet := 0 to High(IPreviewVolume) do + if Tekst = IPreviewVolume[Pet] then Ini.PreviewVolume := Pet; + + Tekst := IniFile.ReadString('Sound', 'PreviewFading', IPreviewFading[1]); + for Pet := 0 to High(IPreviewFading) do + if Tekst = IPreviewFading[Pet] then Ini.PreviewFading := Pet; + + // Lyrics Font + Tekst := IniFile.ReadString('Lyrics', 'LyricsFont', ILyricsFont[1]); + for Pet := 0 to High(ILyricsFont) do + if Tekst = ILyricsFont[Pet] then Ini.LyricsFont := Pet; + + // Lyrics Effect + Tekst := IniFile.ReadString('Lyrics', 'LyricsEffect', ILyricsEffect[1]); + for Pet := 0 to High(ILyricsEffect) do + if Tekst = ILyricsEffect[Pet] then Ini.LyricsEffect := Pet; + + // Solmization + Tekst := IniFile.ReadString('Lyrics', 'Solmization', ISolmization[0]); + for Pet := 0 to High(ISolmization) do + if Tekst = ISolmization[Pet] then Ini.Solmization := Pet; + + // Theme + + //Theme List Patch + + //I2 Saves the no of the Deluxe (Standard-) Theme + I2 := 0; + //I counts is the cur. Theme no + I := 0; + + SetLength(ITheme, 0); + writeln( 'Searching for Theme : '+ ThemePath + '*.ini' ); + FindFirst(ThemePath + '*.ini',faAnyFile,SR); + Repeat + writeln( SR.Name ); + + //Read Themename from Theme + ThemeIni := TMemIniFile.Create(SR.Name); + Tekst := UpperCase(ThemeIni.ReadString('Theme','Name',GetFileName(SR.Name))); + ThemeIni.Free; + + //if Deluxe Theme then save Themeno to I2 + if (Tekst = 'DELUXE') then + I2 := I; + + //Search for Skins for this Theme + for Pet := low(Skin.Skin) to high(Skin.Skin) do + begin + if UpperCase(Skin.Skin[Pet].Theme) = Tekst then + begin + SetLength(ITheme, Length(ITheme)+1); + ITheme[High(ITheme)] := GetFileName(SR.Name); + break; + end; + end; + + Inc(I); + Until FindNext(SR) <> 0; + FindClose(SR); + //Theme List Patch End } + + //No Theme Found + if (Length(ITheme)=0) then + begin + Log.CriticalError('Could not find any valid Themes.'); + end; + + + Tekst := IniFile.ReadString('Themes', 'Theme', ITheme[I2]); + Ini.Theme := 0; + for Pet := 0 to High(ITheme) do + if Uppercase(Tekst) = Uppercase(ITheme[Pet]) then Ini.Theme := Pet; + + // Skin + Skin.onThemeChange; + Ini.SkinNo := 0; + + Tekst := IniFile.ReadString('Themes', 'Skin', ISkin[0]); + for Pet := 0 to High(ISkin) do + if Tekst = ISkin[Pet] then Ini.SkinNo := Pet; + + // Color + Tekst := IniFile.ReadString('Themes', 'Color', IColor[0]); + for Pet := 0 to High(IColor) do + if Tekst = IColor[Pet] then Ini.Color := Pet; + + // Input devices - load ini list + SetLength(InputDeviceConfig, 0); + I := 1; + while (IniFile.ValueExists('Record', 'DeviceName'+IntToStr(I))) do begin + // resize list + SetLength(InputDeviceConfig, Length(InputDeviceConfig)+1); + I2 := High(InputDeviceConfig); + + // read an input device's config. + // Note: All devices are appended to the list whether they exist or not. + // Otherwise an external device's config will be lost if it is not + // connected (e.g. singstar mics or USB-Audio devices). + InputDeviceConfig[I2].Name := + IniFile.ReadString('Record', 'DeviceName'+IntToStr(I), ''); + InputDeviceConfig[I2].Input := + IniFile.ReadInteger('Record', 'Input'+IntToStr(I), 0); + InputDeviceConfig[I2].ChannelToPlayerMap[0] := + IniFile.ReadInteger('Record', 'ChannelL'+IntToStr(I), 0); + InputDeviceConfig[I2].ChannelToPlayerMap[1] := + IniFile.ReadInteger('Record', 'ChannelR'+IntToStr(I), 0); + + Inc(I); + end; + + // Input devices - append detected soundcards + for I := 0 to High(AudioInputProcessor.Device) do + begin + B := False; + For I2 := 0 to High(InputDeviceConfig) do + begin //Search for Card in List + if (InputDeviceConfig[I2].Name = Trim(AudioInputProcessor.Device[I].Description)) then + begin + B := True; + // associate ini-index with device + AudioInputProcessor.Device[I].CfgIndex := I2; + Break; + end; + end; + + //If not in List -> Add + If not B then + begin + // resize list + SetLength(InputDeviceConfig, Length(InputDeviceConfig)+1); + I2 := High(InputDeviceConfig); + + InputDeviceConfig[I2].Name := Trim(AudioInputProcessor.Device[I].Description); + InputDeviceConfig[I2].Input := 0; + InputDeviceConfig[I2].ChannelToPlayerMap[0] := 0; + InputDeviceConfig[I2].ChannelToPlayerMap[1] := 0; + + // associate ini-index with device + AudioInputProcessor.Device[I].CfgIndex := I2; + + // set default at first start of USDX (1st device, 1st channel -> player1) + if (I2 = 0) then + InputDeviceConfig[I2].ChannelToPlayerMap[0] := 1; + end; + end; + + //Advanced Settings + + // LoadAnimation + Tekst := IniFile.ReadString('Advanced', 'LoadAnimation', 'On'); + for Pet := 0 to High(ILoadAnimation) do + if Tekst = ILoadAnimation[Pet] then Ini.LoadAnimation := Pet; + + // ScreenFade + Tekst := IniFile.ReadString('Advanced', 'ScreenFade', 'On'); + for Pet := 0 to High(IScreenFade) do + if Tekst = IScreenFade[Pet] then Ini.ScreenFade := Pet; + + // EffectSing + Tekst := IniFile.ReadString('Advanced', 'EffectSing', 'On'); + for Pet := 0 to High(IEffectSing) do + if Tekst = IEffectSing[Pet] then Ini.EffectSing := Pet; + + // AskbeforeDel + Tekst := IniFile.ReadString('Advanced', 'AskbeforeDel', 'On'); + for Pet := 0 to High(IAskbeforeDel) do + if Tekst = IAskbeforeDel[Pet] then Ini.AskbeforeDel := Pet; + + // OnSongClick + Tekst := IniFile.ReadString('Advanced', 'OnSongClick', 'Sing'); + for Pet := 0 to High(IOnSongClick) do + if Tekst = IOnSongClick[Pet] then Ini.OnSongClick := Pet; + + // Linebonus + Tekst := IniFile.ReadString('Advanced', 'LineBonus', 'At Score'); + for Pet := 0 to High(ILineBonus) do + if Tekst = ILineBonus[Pet] then Ini.LineBonus := Pet; + + // PartyPopup + Tekst := IniFile.ReadString('Advanced', 'PartyPopup', 'On'); + for Pet := 0 to High(IPartyPopup) do + if Tekst = IPartyPopup[Pet] then Ini.PartyPopup := Pet; + + + // Joypad + Tekst := IniFile.ReadString('Controller', 'Joypad', IJoypad[0]); + for Pet := 0 to High(IJoypad) do + if Tekst = IJoypad[Pet] then Ini.Joypad := Pet; + + // LCD + Tekst := IniFile.ReadString('Devices', 'LPT', ILPT[0]); + for Pet := 0 to High(ILPT) do + if Tekst = ILPT[Pet] then Ini.LPT := Pet; + + + // SongPath + if (Params.SongPath <> '') then + SongPath := IncludeTrailingPathDelimiter(Params.SongPath) + else + SongPath := IncludeTrailingPathDelimiter(IniFile.ReadString('Path', 'Songs', SongPath)); + + Filename := IniFile.FileName; + IniFile.Free; +end; + +procedure TIni.Save; +var + IniFile: TIniFile; + Tekst: string; + I: Integer; + S: String; +begin + //if not (FileExists(GamePath + 'config.ini') and FileIsReadOnly(GamePath + 'config.ini')) then begin + if not (FileExists(Filename) and FileIsReadOnly(Filename)) then begin + + IniFile := TIniFile.Create(Filename); + + // Players + Tekst := IPlayers[Ini.Players]; + IniFile.WriteString('Game', 'Players', Tekst); + + // Difficulty + Tekst := IDifficulty[Ini.Difficulty]; + IniFile.WriteString('Game', 'Difficulty', Tekst); + + // Language + Tekst := ILanguage[Ini.Language]; + IniFile.WriteString('Game', 'Language', Tekst); + + // Tabs + Tekst := ITabs[Ini.Tabs]; + IniFile.WriteString('Game', 'Tabs', Tekst); + + // Sorting + Tekst := ISorting[Ini.Sorting]; + IniFile.WriteString('Game', 'Sorting', Tekst); + + // Debug + Tekst := IDebug[Ini.Debug]; + IniFile.WriteString('Game', 'Debug', Tekst); + + // Screens + Tekst := IScreens[Ini.Screens]; + IniFile.WriteString('Graphics', 'Screens', Tekst); + + // FullScreen + Tekst := IFullScreen[Ini.FullScreen]; + IniFile.WriteString('Graphics', 'FullScreen', Tekst); + + // Resolution + Tekst := IResolution[Ini.Resolution]; + IniFile.WriteString('Graphics', 'Resolution', Tekst); + + // Depth + Tekst := IDepth[Ini.Depth]; + IniFile.WriteString('Graphics', 'Depth', Tekst); + + // Resolution + Tekst := ITextureSize[Ini.TextureSize]; + IniFile.WriteString('Graphics', 'TextureSize', Tekst); + + // Sing Window + Tekst := ISingWindow[Ini.SingWindow]; + IniFile.WriteString('Graphics', 'SingWindow', Tekst); + + // Oscilloscope + Tekst := IOscilloscope[Ini.Oscilloscope]; + IniFile.WriteString('Graphics', 'Oscilloscope', Tekst); + + // Spectrum + Tekst := ISpectrum[Ini.Spectrum]; + IniFile.WriteString('Graphics', 'Spectrum', Tekst); + + // Spectrograph + Tekst := ISpectrograph[Ini.Spectrograph]; + IniFile.WriteString('Graphics', 'Spectrograph', Tekst); + + // Movie Size + Tekst := IMovieSize[Ini.MovieSize]; + IniFile.WriteString('Graphics', 'MovieSize', Tekst); + + // MicBoost + Tekst := IMicBoost[Ini.MicBoost]; + IniFile.WriteString('Sound', 'MicBoost', Tekst); + + // ClickAssist + Tekst := IClickAssist[Ini.ClickAssist]; + IniFile.WriteString('Sound', 'ClickAssist', Tekst); + + // BeatClick + Tekst := IBeatClick[Ini.BeatClick]; + IniFile.WriteString('Sound', 'BeatClick', Tekst); + + // Threshold + Tekst := IThreshold[Ini.Threshold]; + IniFile.WriteString('Sound', 'Threshold', Tekst); + + // Song Preview + Tekst := IPreviewVolume[Ini.PreviewVolume]; + IniFile.WriteString('Sound', 'PreviewVolume', Tekst); + + Tekst := IPreviewFading[Ini.PreviewFading]; + IniFile.WriteString('Sound', 'PreviewFading', Tekst); + + // SavePlayback + Tekst := ISavePlayback[Ini.SavePlayback]; + IniFile.WriteString('Sound', 'SavePlayback', Tekst); + + // Lyrics Font + Tekst := ILyricsFont[Ini.LyricsFont]; + IniFile.WriteString('Lyrics', 'LyricsFont', Tekst); + + // Lyrics Effect + Tekst := ILyricsEffect[Ini.LyricsEffect]; + IniFile.WriteString('Lyrics', 'LyricsEffect', Tekst); + + // Solmization + Tekst := ISolmization[Ini.Solmization]; + IniFile.WriteString('Lyrics', 'Solmization', Tekst); + + // Theme + Tekst := ITheme[Ini.Theme]; + IniFile.WriteString('Themes', 'Theme', Tekst); + + // Skin + Tekst := ISkin[Ini.SkinNo]; + IniFile.WriteString('Themes', 'Skin', Tekst); + + // Color + Tekst := IColor[Ini.Color]; + IniFile.WriteString('Themes', 'Color', Tekst); + + // Record + for I := 0 to High(InputDeviceConfig) do begin + S := IntToStr(I+1); + + Tekst := InputDeviceConfig[I].Name; + IniFile.WriteString('Record', 'DeviceName' + S, Tekst); + + Tekst := IntToStr(InputDeviceConfig[I].Input); + IniFile.WriteString('Record', 'Input' + S, Tekst); + + Tekst := IntToStr(InputDeviceConfig[I].ChannelToPlayerMap[0]); + IniFile.WriteString('Record', 'ChannelL' + S, Tekst); + + Tekst := IntToStr(InputDeviceConfig[I].ChannelToPlayerMap[1]); + IniFile.WriteString('Record', 'ChannelR' + S, Tekst); + end; + + //Log.LogError(InttoStr(Length(CardList)) + ' Cards Saved'); + + //Advanced Settings + + //LoadAnimation + Tekst := ILoadAnimation[Ini.LoadAnimation]; + IniFile.WriteString('Advanced', 'LoadAnimation', Tekst); + + //EffectSing + Tekst := IEffectSing[Ini.EffectSing]; + IniFile.WriteString('Advanced', 'EffectSing', Tekst); + + //ScreenFade + Tekst := IScreenFade[Ini.ScreenFade]; + IniFile.WriteString('Advanced', 'ScreenFade', Tekst); + + //AskbeforeDel + Tekst := IAskbeforeDel[Ini.AskbeforeDel]; + IniFile.WriteString('Advanced', 'AskbeforeDel', Tekst); + + //OnSongClick + Tekst := IOnSongClick[Ini.OnSongClick]; + IniFile.WriteString('Advanced', 'OnSongClick', Tekst); + + //Line Bonus + Tekst := ILineBonus[Ini.LineBonus]; + IniFile.WriteString('Advanced', 'LineBonus', Tekst); + + //Party Popup + Tekst := IPartyPopup[Ini.PartyPopup]; + IniFile.WriteString('Advanced', 'PartyPopup', Tekst); + + // Joypad + Tekst := IJoypad[Ini.Joypad]; + IniFile.WriteString('Controller', 'Joypad', Tekst); + + IniFile.Free; + end; +end; + +procedure TIni.SaveNames; +var + IniFile: TIniFile; + I: integer; +begin + //if not FileIsReadOnly(GamePath + 'config.ini') then begin + //IniFile := TIniFile.Create(GamePath + 'config.ini'); + if not FileIsReadOnly(Filename) then begin + IniFile := TIniFile.Create(Filename); + + //Name + // Templates for Names Mod + for I := 1 to 12 do + IniFile.WriteString('Name', 'P' + IntToStr(I), Ini.Name[I-1]); + for I := 1 to 3 do + IniFile.WriteString('NameTeam', 'T' + IntToStr(I), Ini.NameTeam[I-1]); + for I := 1 to 12 do + IniFile.WriteString('NameTemplate', 'Name' + IntToStr(I), Ini.NameTemplate[I-1]); + + IniFile.Free; + end; +end; + +procedure TIni.SaveLevel; +var + IniFile: TIniFile; + I: integer; +begin + //if not FileIsReadOnly(GamePath + 'config.ini') then begin + //IniFile := TIniFile.Create(GamePath + 'config.ini'); + if not FileIsReadOnly(Filename) then begin + IniFile := TIniFile.Create(Filename); + + // Difficulty + IniFile.WriteString('Game', 'Difficulty', IDifficulty[Ini.Difficulty]); + + IniFile.Free; + end; +end; + +end. diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 901d7370..801a66db 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -195,23 +195,14 @@ begin Log.BenchmarkEnd(1); Log.LogBenchmark('Loading Skin List', 1); -(* - // Sound Card List - Log.BenchmarkStart(1); - Log.LogStatus('Loading Soundcard list', 'Initialization'); - Recording := TRecord.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Soundcard list', 1); -*) - - // Sound (+ fills Sound Card List) + // Sound Log.BenchmarkStart(1); Log.LogStatus('Initialize Sound', 'Initialization'); InitializeSound(); Log.BenchmarkEnd(1); Log.LogBenchmark('Initializing Sound', 1); - // Ini + Paths + // Ini + Paths (depends on Sound) Log.BenchmarkStart(1); Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create; @@ -758,7 +749,7 @@ begin // beat click if (Ini.BeatClick = 1) and ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then - AudioPlayback.PlayClick; + AudioPlayback.PlaySound(SoundLib.Click); // debug system on LPT if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then begin @@ -780,7 +771,7 @@ begin if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeatC) then begin // click assist if Ini.ClickAssist = 1 then - AudioPlayback.PlayClick; + AudioPlayback.PlaySound(SoundLib.Click); //LPT_2 := 0; if ParamStr(1) <> '-doublelights' then @@ -871,7 +862,7 @@ begin // Czas.Ton := 27; // gdy moze, to dodaje nute - if (AudioInputProcessor.Sound[CP].SzczytJest) and (Mozna) then begin + if (AudioInputProcessor.Sound[CP].ToneValid) and (Mozna) then begin // operowanie na ostatniej nucie for Pet := 0 to Czesci[0].Czesc[S].HighNut do if (Czesci[0].Czesc[S].Nuta[Pet].Start <= Czas.OldBeatD+1) @@ -880,11 +871,11 @@ begin // to robi, tylko dla pary nut (oryginalnej i gracza) // przesuwanie tonu w odpowiednia game - while (AudioInputProcessor.Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton > 6) do - AudioInputProcessor.Sound[CP].Ton := AudioInputProcessor.Sound[CP].Ton - 12; + while (AudioInputProcessor.Sound[CP].Tone - Czesci[0].Czesc[S].Nuta[Pet].Ton > 6) do + AudioInputProcessor.Sound[CP].Tone := AudioInputProcessor.Sound[CP].Tone - 12; - while (AudioInputProcessor.Sound[CP].Ton - Czesci[0].Czesc[S].Nuta[Pet].Ton < -6) do - AudioInputProcessor.Sound[CP].Ton := AudioInputProcessor.Sound[CP].Ton + 12; + while (AudioInputProcessor.Sound[CP].Tone - Czesci[0].Czesc[S].Nuta[Pet].Ton < -6) do + AudioInputProcessor.Sound[CP].Tone := AudioInputProcessor.Sound[CP].Tone + 12; // Half size Notes Patch NoteHit := false; @@ -894,8 +885,8 @@ begin //if Ini.Difficulty = 2 then Range := 0; Range := 2 - Ini.Difficulty; - if abs(Czesci[0].Czesc[S].Nuta[Pet].Ton - AudioInputProcessor.Sound[CP].Ton) <= Range then begin - AudioInputProcessor.Sound[CP].Ton := Czesci[0].Czesc[S].Nuta[Pet].Ton; + if abs(Czesci[0].Czesc[S].Nuta[Pet].Ton - AudioInputProcessor.Sound[CP].Tone) <= Range then begin + AudioInputProcessor.Sound[CP].Tone := Czesci[0].Czesc[S].Nuta[Pet].Ton; // Half size Notes Patch @@ -936,7 +927,7 @@ begin Nowa := true; // jezeli ostatnia ma ten sam ton if (Player[CP].IlNut > 0 ) - and (Player[CP].Nuta[Player[CP].HighNut].Ton = AudioInputProcessor.Sound[CP].Ton) + and (Player[CP].Nuta[Player[CP].HighNut].Ton = AudioInputProcessor.Sound[CP].Tone) and (Player[CP].Nuta[Player[CP].HighNut].Start + Player[CP].Nuta[Player[CP].HighNut].Dlugosc = Czas.AktBeatD) then Nowa := false; // jezeli jest jakas nowa nuta na sprawdzanym beacie @@ -952,7 +943,7 @@ begin SetLength(Player[CP].Nuta, Player[CP].IlNut); Player[CP].Nuta[Player[CP].HighNut].Start := Czas.AktBeatD; Player[CP].Nuta[Player[CP].HighNut].Dlugosc := 1; - Player[CP].Nuta[Player[CP].HighNut].Ton := AudioInputProcessor.Sound[CP].Ton; // Ton || TonDokl + Player[CP].Nuta[Player[CP].HighNut].Ton := AudioInputProcessor.Sound[CP].Tone; // Ton || TonDokl Player[CP].Nuta[Player[CP].HighNut].Detekt := Czas.MidBeat; diff --git a/Game/Code/Classes/UMedia_dummy.pas b/Game/Code/Classes/UMedia_dummy.pas index c973512d..cd62dc51 100644 --- a/Game/Code/Classes/UMedia_dummy.pas +++ b/Game/Code/Classes/UMedia_dummy.pas @@ -1,268 +1,206 @@ -unit UMedia_dummy; -{< ############################################################################# -# FFmpeg support for UltraStar deluxe # -# # -# Created by b1indy # -# based on 'An ffmpeg and SDL Tutorial' (http://www.dranger.com/ffmpeg/) # -# # -# http://www.mail-archive.com/fpc-pascal@lists.freepascal.org/msg09949.html # -# http://www.nabble.com/file/p11795857/mpegpas01.zip # -# # -############################################################################## } - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -implementation - -uses - SysUtils, - math, - UMusic; - - -var - singleton_dummy : IVideoPlayback; - -type - Tmedia_dummy = class( TInterfacedObject, IVideoPlayback, IVideoVisualization, IAudioPlayback, IAudioInput ) - private - public - constructor create(); - function GetName: String; - - procedure init(); - - function Open( aFileName : string): boolean; // true if succeed - procedure Close; - - procedure Play; - procedure Pause; - procedure Stop; - - procedure SetPosition(Time: real); - function GetPosition: real; - - procedure GetFrame(Time: Extended); - procedure DrawGL(Screen: integer); - - // IAudioInput - procedure InitializeRecord; - procedure CaptureStart; - procedure CaptureStop; - procedure CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); - procedure StopCard(Card: byte); - function GetFFTData: TFFTData; - function GetPCMData(var data: TPCMData): Cardinal; - - // IAudioPlayback - procedure InitializePlayback; - procedure SetVolume(Volume: integer); - procedure SetMusicVolume(Volume: integer); - procedure SetLoop(Enabled: boolean); - procedure Rewind; - - function Finished: boolean; - function Length: real; - - procedure PlayStart; - procedure PlayBack; - procedure PlaySwoosh; - procedure PlayChange; - procedure PlayOption; - procedure PlayClick; - procedure PlayDrum; - procedure PlayHihat; - procedure PlayClap; - procedure PlayShuffle; - procedure StopShuffle; - - function LoadCustomSound(const Filename: String): Cardinal; - procedure PlayCustomSound(const Index: Cardinal ); - - end; - - - -function Tmedia_dummy.GetName: String; -begin - result := 'dummy'; -end; - - -procedure Tmedia_dummy.GetFrame(Time: Extended); -begin -end; - -procedure Tmedia_dummy.DrawGL(Screen: integer); -begin -end; - -constructor Tmedia_dummy.create(); -begin -end; - -procedure Tmedia_dummy.init(); -begin -end; - - -function Tmedia_dummy.Open( aFileName : string): boolean; // true if succeed -begin - result := false; -end; - -procedure Tmedia_dummy.Close; -begin -end; - -procedure Tmedia_dummy.Play; -begin -end; - -procedure Tmedia_dummy.Pause; -begin -end; - -procedure Tmedia_dummy.Stop; -begin -end; - -procedure Tmedia_dummy.SetPosition(Time: real); -begin -end; - -function Tmedia_dummy.getPosition: real; -begin - result := 0; -end; - -// IAudioInput -procedure Tmedia_dummy.InitializeRecord; -begin -end; - -procedure Tmedia_dummy.CaptureStart; -begin -end; - -procedure Tmedia_dummy.CaptureStop; -begin -end; - -procedure Tmedia_dummy.CaptureCard(RecordI, PlayerLeft, PlayerRight: byte); -begin -end; - -procedure Tmedia_dummy.StopCard(Card: byte); -begin -end; - -function Tmedia_dummy.GetFFTData: TFFTData; -var data: TFFTData; -begin - result := data; -end; - -function Tmedia_dummy.GetPCMData(var data: TPCMData): Cardinal; -begin - result := 0; -end; - -// IAudioPlayback -procedure Tmedia_dummy.InitializePlayback; -begin -end; - -procedure Tmedia_dummy.SetVolume(Volume: integer); -begin -end; - -procedure Tmedia_dummy.SetMusicVolume(Volume: integer); -begin -end; - -procedure Tmedia_dummy.SetLoop(Enabled: boolean); -begin -end; - -procedure Tmedia_dummy.Rewind; -begin -end; - -function Tmedia_dummy.Finished: boolean; -begin - result := false; -end; - -function Tmedia_dummy.Length: real; -begin - Result := 60; -end; - -procedure Tmedia_dummy.PlayStart; -begin -end; - -procedure Tmedia_dummy.PlayBack; -begin -end; - -procedure Tmedia_dummy.PlaySwoosh; -begin -end; - -procedure Tmedia_dummy.PlayChange; -begin -end; - -procedure Tmedia_dummy.PlayOption; -begin -end; - -procedure Tmedia_dummy.PlayClick; -begin -end; - -procedure Tmedia_dummy.PlayDrum; -begin -end; - -procedure Tmedia_dummy.PlayHihat; -begin -end; - -procedure Tmedia_dummy.PlayClap; -begin -end; - -procedure Tmedia_dummy.PlayShuffle; -begin -end; - -procedure Tmedia_dummy.StopShuffle; -begin -end; - -function Tmedia_dummy.LoadCustomSound(const Filename: String): Cardinal; -begin - result := 0; -end; - -procedure Tmedia_dummy.PlayCustomSound(const Index: Cardinal ); -begin -end; - -initialization - singleton_dummy := Tmedia_dummy.create(); - AudioManager.add( singleton_dummy ); - -finalization - AudioManager.Remove( singleton_dummy ); - -end. +unit UMedia_dummy; +{< ############################################################################# +# FFmpeg support for UltraStar deluxe # +# # +# Created by b1indy # +# based on 'An ffmpeg and SDL Tutorial' (http://www.dranger.com/ffmpeg/) # +# # +# http://www.mail-archive.com/fpc-pascal@lists.freepascal.org/msg09949.html # +# http://www.nabble.com/file/p11795857/mpegpas01.zip # +# # +############################################################################## } + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +implementation + +uses + SysUtils, + math, + UMusic; + + +var + singleton_dummy : IVideoPlayback; + +type + Tmedia_dummy = class( TInterfacedObject, IVideoPlayback, IVideoVisualization, IAudioPlayback, IAudioInput ) + private + public + constructor create(); + function GetName: String; + + procedure init(); + + function Open( aFileName : string): boolean; // true if succeed + procedure Close; + + procedure Play; + procedure Pause; + procedure Stop; + + procedure SetPosition(Time: real); + function GetPosition: real; + + procedure GetFrame(Time: Extended); + procedure DrawGL(Screen: integer); + + // IAudioInput + function InitializeRecord: boolean; + procedure CaptureStart; + procedure CaptureStop; + procedure GetFFTData(var data: TFFTData); + function GetPCMData(var data: TPCMData): Cardinal; + + // IAudioPlayback + function InitializePlayback: boolean; + procedure SetVolume(Volume: integer); + procedure SetMusicVolume(Volume: integer); + procedure SetLoop(Enabled: boolean); + procedure Rewind; + + function Finished: boolean; + function Length: real; + + function OpenSound(const Filename: String): TAudioPlaybackStream; + procedure PlaySound(stream: TAudioPlaybackStream); + procedure StopSound(stream: TAudioPlaybackStream); + end; + + + +function Tmedia_dummy.GetName: String; +begin + result := 'dummy'; +end; + + +procedure Tmedia_dummy.GetFrame(Time: Extended); +begin +end; + +procedure Tmedia_dummy.DrawGL(Screen: integer); +begin +end; + +constructor Tmedia_dummy.create(); +begin +end; + +procedure Tmedia_dummy.init(); +begin +end; + + +function Tmedia_dummy.Open( aFileName : string): boolean; // true if succeed +begin + result := false; +end; + +procedure Tmedia_dummy.Close; +begin +end; + +procedure Tmedia_dummy.Play; +begin +end; + +procedure Tmedia_dummy.Pause; +begin +end; + +procedure Tmedia_dummy.Stop; +begin +end; + +procedure Tmedia_dummy.SetPosition(Time: real); +begin +end; + +function Tmedia_dummy.getPosition: real; +begin + result := 0; +end; + +// IAudioInput +function Tmedia_dummy.InitializeRecord: boolean; +begin + result := true; +end; + +procedure Tmedia_dummy.CaptureStart; +begin +end; + +procedure Tmedia_dummy.CaptureStop; +begin +end; + +procedure Tmedia_dummy.GetFFTData(var data: TFFTData); +begin +end; + +function Tmedia_dummy.GetPCMData(var data: TPCMData): Cardinal; +begin + result := 0; +end; + +// IAudioPlayback +function Tmedia_dummy.InitializePlayback: boolean; +begin + result := true; +end; + +procedure Tmedia_dummy.SetVolume(Volume: integer); +begin +end; + +procedure Tmedia_dummy.SetMusicVolume(Volume: integer); +begin +end; + +procedure Tmedia_dummy.SetLoop(Enabled: boolean); +begin +end; + +procedure Tmedia_dummy.Rewind; +begin +end; + +function Tmedia_dummy.Finished: boolean; +begin + result := false; +end; + +function Tmedia_dummy.Length: real; +begin + Result := 60; +end; + +function Tmedia_dummy.OpenSound(const Filename: String): TAudioPlaybackStream; +begin + result := nil; +end; + +procedure Tmedia_dummy.PlaySound(stream: TAudioPlaybackStream); +begin +end; + +procedure Tmedia_dummy.StopSound(stream: TAudioPlaybackStream); +begin +end; + +initialization + singleton_dummy := Tmedia_dummy.create(); + AudioManager.add( singleton_dummy ); + +finalization + AudioManager.Remove( singleton_dummy ); + +end. diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index a7f1918f..27ab86e1 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -1,423 +1,492 @@ -unit UMusic; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses Classes ; - -type - TMuzyka = record - Path: string; - Start: integer; // start of song in ms - IlNut: integer; - DlugoscNut: integer; - end; - - PLine = ^TLine; - TLine = record - Start: integer; - StartNote: integer; - Lyric: string; - LyricWidth: real; - Koniec: integer; - BaseNote: integer; - HighNut: integer; - IlNut: integer; - TotalNotes: integer; - Nuta: array of record - Color: integer; - Start: integer; - Dlugosc: integer; - Ton: integer; - TonGamy: integer; - Tekst: string; - FreeStyle: boolean; - Wartosc: integer; // zwykla nuta x1, zlota nuta x2 - end; - end; - ALine = array of TLine; - - TCzesci = record - Akt: integer; // aktualna czesc utworu do rysowania - High: integer; - Ilosc: integer; - Resolution: integer; - NotesGAP: integer; - Wartosc: integer; - Czesc: ALine; - end; - - TCzas = record // wszystko, co dotyczy aktualnej klatki - OldBeat: integer; // poprzednio wykryty beat w utworze - AktBeat: integer; // aktualny beat w utworze - MidBeat: real; // dokladny AktBeat - - // now we use this for super synchronization! - // only used when analyzing voice - OldBeatD: integer; // poprzednio wykryty beat w utworze - AktBeatD: integer; // aktualny beat w utworze - MidBeatD: real; // dokladny AktBeatD - FracBeatD: real; // fractional part of MidBeatD - - // we use this for audiable clicks - OldBeatC: integer; // poprzednio wykryty beat w utworze - AktBeatC: integer; // aktualny beat w utworze - MidBeatC: real; // dokladny AktBeatC - FracBeatC: real; // fractional part of MidBeatC - - - OldCzesc: integer; // poprzednio wyswietlana czesc - // akt jest w czesci.akt - - Teraz: real; // aktualny czas w utworze - Razem: real; // caly czas utworu - end; - - TSoundCard = record - Name: string; - Source: array of string; - end; - -type - TFFTData = array[0..256] of Single; - - TPCMStereoSample = array[0..1] of Smallint; - TPCMData = array[0..511] of TPCMStereoSample; - -type - TStreamStatus = (sStopped, sPlaying, sPaused); -const - StreamStatusStr: array[TStreamStatus] of string = ('Stopped', 'Playing', 'Paused'); - -type - TAudioProcessingStream = class - public - procedure Close(); virtual; abstract; - end; - - TAudioPlaybackStream = class(TAudioProcessingStream) - protected - function GetLoop(): boolean; virtual; abstract; - procedure SetLoop(Enabled: boolean); virtual; abstract; - function GetLength(): real; virtual; abstract; - function GetStatus(): TStreamStatus; virtual; abstract; - public - procedure Play(); virtual; abstract; - procedure Pause(); virtual; abstract; - procedure Stop(); virtual; abstract; - - property Loop: boolean READ GetLoop WRITE SetLoop; - property Length: real READ GetLength; - property Status: TStreamStatus READ GetStatus; - end; - - (* - TAudioMixerStream = class(TAudioProcessingStream) - procedure AddStream(stream: TAudioProcessingStream); - procedure RemoveStream(stream: TAudioProcessingStream); - procedure SetMasterVolume(volume: cardinal); - function GetMasterVolume(): cardinal; - procedure SetStreamVolume(stream: TAudioProcessingStream; volume: cardinal); - function GetStreamVolume(stream: TAudioProcessingStream): cardinal; - end; - *) - - TAudioDecodeStream = class(TAudioProcessingStream) - protected - function GetLength(): real; virtual; abstract; - function GetChannelCount(): cardinal; virtual; abstract; - function GetSampleRate(): cardinal; virtual; abstract; - function GetPosition(): real; virtual; abstract; - procedure SetPosition(Time: real); virtual; abstract; - function IsEOF(): boolean; virtual; abstract; - public - function ReadData(Buffer: PChar; BufSize: integer): integer; virtual; abstract; - - property Length: real READ GetLength; - property ChannelCount: cardinal READ GetChannelCount; - property SampleRate: cardinal READ GetSampleRate; - property Position: real READ GetPosition WRITE SetPosition; - property EOF: boolean READ IsEOF; - end; - -type - TCustomSoundEntry = record - Filename : String; - Stream : TAudioPlaybackStream; - end; - -type - IGenericPlayback = Interface - ['{63A5EBC3-3F4D-4F23-8DFB-B5165FCE33DD}'] - function GetName: String; - - function Open(Filename: string): boolean; // true if succeed - procedure Close; - - procedure Play; - procedure Pause; - procedure Stop; - - procedure SetPosition(Time: real); - function GetPosition: real; - - property Position : real READ GetPosition WRITE SetPosition; - end; - - IVideoPlayback = Interface( IGenericPlayback ) - ['{3574C40C-28AE-4201-B3D1-3D1F0759B131}'] - procedure init(); - - procedure GetFrame(Time: Extended); // WANT TO RENAME THESE TO BE MORE GENERIC - procedure DrawGL(Screen: integer); // WANT TO RENAME THESE TO BE MORE GENERIC - - end; - - IVideoVisualization = Interface( IVideoPlayback ) - ['{5AC17D60-B34D-478D-B632-EB00D4078017}'] - end; - - IAudioPlayback = Interface( IGenericPlayback ) - ['{E4AE0B40-3C21-4DC5-847C-20A87E0DFB96}'] - procedure InitializePlayback; - procedure SetVolume(Volume: integer); - procedure SetMusicVolume(Volume: integer); - procedure SetLoop(Enabled: boolean); - - procedure Rewind; - function Finished: boolean; - function Length: real; - - procedure PlayStart; - procedure PlayBack; - procedure PlaySwoosh; - procedure PlayChange; - procedure PlayOption; - procedure PlayClick; - procedure PlayDrum; - procedure PlayHihat; - procedure PlayClap; - procedure PlayShuffle; - procedure StopShuffle; - - //Custom Sounds - function LoadCustomSound(const Filename: String): Cardinal; - procedure PlayCustomSound(const Index: Cardinal ); - - //Equalizer - function GetFFTData: TFFTData; - - // Interface for Visualizer - function GetPCMData(var data: TPCMData): Cardinal; - end; - - IGenericDecoder = Interface - ['{557B0E9A-604D-47E4-B826-13769F3E10B7}'] - function InitializeDecoder(): boolean; - //function IsSupported(const Filename: string): boolean; - end; - - (* - IVideoDecoder = Interface( IGenericDecoder ) - ['{2F184B2B-FE69-44D5-9031-0A2462391DCA}'] - function Open(const Filename: string): TVideoDecodeStream; - end; - *) - - IAudioDecoder = Interface( IGenericDecoder ) - ['{AB47B1B6-2AA9-4410-BF8C-EC79561B5478}'] - function Open(const Filename: string): TAudioDecodeStream; - end; - - IAudioInput = Interface - ['{A5C8DA92-2A0C-4AB2-849B-2F7448C6003A}'] - function GetName: String; - procedure InitializeRecord; - - procedure CaptureStart; - procedure CaptureStop; - end; - - -var // TODO : JB --- THESE SHOULD NOT BE GLOBAL - // muzyka - Muzyka: TMuzyka; - - // czesci z nutami; - Czesci: array of TCzesci; - - // czas - Czas: TCzas; - - -procedure InitializeSound; - -function Visualization(): IVideoPlayback; -function VideoPlayback(): IVideoPlayback; -function AudioPlayback(): IAudioPlayback; -function AudioInput(): IAudioInput; -function AudioDecoder(): IAudioDecoder; - -function AudioManager: TInterfaceList; - - -implementation - -uses - sysutils, - UCommandLine; -// uLog; - -var - singleton_VideoPlayback : IVideoPlayback = nil; - singleton_Visualization : IVideoPlayback = nil; - singleton_AudioPlayback : IAudioPlayback = nil; - singleton_AudioInput : IAudioInput = nil; - singleton_AudioDecoder : IAudioDecoder = nil; - - singleton_AudioManager : TInterfaceList = nil; - - -function AudioManager: TInterfaceList; -begin - if singleton_AudioManager = nil then - singleton_AudioManager := TInterfaceList.Create(); - - Result := singleton_AudioManager; -end; //CompressionPluginManager - - -function VideoPlayback(): IVideoPlayback; -begin - result := singleton_VideoPlayback; -end; - -function Visualization(): IVideoPlayback; -begin - result := singleton_Visualization; -end; - -function AudioPlayback(): IAudioPlayback; -begin - result := singleton_AudioPlayback; -end; - -function AudioInput(): IAudioInput; -begin - result := singleton_AudioInput; -end; - -function AudioDecoder(): IAudioDecoder; -begin - result := singleton_AudioDecoder; -end; - -procedure InitializeSound; -var - lTmpInterface : IInterface; - iCount : Integer; -begin - lTmpInterface := nil; - - singleton_AudioPlayback := nil; - singleton_AudioInput := nil; - singleton_AudioDecoder := nil; - singleton_VideoPlayback := nil; - singleton_Visualization := nil; - - for iCount := 0 to AudioManager.Count - 1 do - begin - if assigned( AudioManager[iCount] ) then - begin - // if this interface is a Playback, then set it as the default used - - if ( AudioManager[iCount].QueryInterface( IAudioPlayback, lTmpInterface ) = 0 ) AND - ( true ) then - begin - singleton_AudioPlayback := IAudioPlayback( lTmpInterface ); - end; - - // if this interface is a Input, then set it as the default used - if ( AudioManager[iCount].QueryInterface( IAudioInput, lTmpInterface ) = 0 ) AND - ( true ) then - begin - singleton_AudioInput := IAudioInput( lTmpInterface ); - end; - - // if this interface is a Decoder, then set it as the default used - if ( AudioManager[iCount].QueryInterface( IAudioDecoder, lTmpInterface ) = 0 ) AND - ( true ) then - begin - singleton_AudioDecoder := IAudioDecoder( lTmpInterface ); - end; - - // if this interface is a Input, then set it as the default used - if ( AudioManager[iCount].QueryInterface( IVideoPlayback, lTmpInterface ) = 0 ) AND - ( true ) then - begin - singleton_VideoPlayback := IVideoPlayback( lTmpInterface ); - end; - - if ( AudioManager[iCount].QueryInterface( IVideoVisualization, lTmpInterface ) = 0 ) AND - ( true ) then - begin - singleton_Visualization := IVideoPlayback( lTmpInterface ); - end; - - end; - end; - - - - if VideoPlayback <> nil then - begin - end; - - if AudioDecoder <> nil then - begin - AudioDecoder.InitializeDecoder; - end; - - if AudioPlayback <> nil then - begin - AudioPlayback.InitializePlayback; - end; - - if AudioInput <> nil then - begin - AudioInput.InitializeRecord; - end; - - if FindCmdLineSwitch( cMediaInterfaces ) then - begin - writeln( '' ); - writeln( '--------------------------------------------------------------' ); - writeln( ' In-use Media Interfaces ' ); - writeln( '--------------------------------------------------------------' ); - writeln( 'Registered Audio Playback Interface : ' + AudioPlayback.GetName ); - writeln( 'Registered Audio Input Interface : ' + AudioInput.GetName ); - writeln( 'Registered Video Playback Interface : ' + VideoPlayback.GetName ); - writeln( 'Registered Visualization Interface : ' + Visualization.GetName ); - writeln( '--------------------------------------------------------------' ); - writeln( '' ); - - halt; - end; -end; - -initialization -begin - singleton_AudioManager := TInterfaceList.Create(); - -end; - -finalization - singleton_AudioManager.clear; - FreeAndNil( singleton_AudioManager ); - -end. +unit UMusic; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + Classes; + +type + TNoteType = (ntFreestyle, ntNormal, ntGolden); + + //http://paste.ubuntu-nl.org/51892/ + + TMuzyka = record // (TODO: rename to TMusic/TMelody?) + Path: string; + Start: integer; // start of song in ms + IlNut: integer; // (TODO: Il = tone, Nut(a) = Note) + DlugoscNut: integer; // (TODO: Dlugosc = length, Nut(a) = Note) + end; + + PLine = ^TLine; + TLine = record // (TODO: rename to TSentence?) + Start: integer; + StartNote: integer; + Lyric: string; + LyricWidth: real; + Koniec: integer; // (TODO: rename to End_/Ending?) + BaseNote: integer; + HighNut: integer; // (TODO: rename to HighNote) + IlNut: integer; // (TODO: Il = tone, Nut(a) = Note) + TotalNotes: integer; + Nuta: array of record // (TODO: rename to Note) + Color: integer; + Start: integer; + Dlugosc: integer; // (TODO: rename to Length) + Ton: integer; // full range tone (TODO: rename to Tone) + TonGamy: integer; // tone unified to one octave (TODO: rename to something meaningful, ToneGamus) + Tekst: string; // (TODO: rename to Text) + FreeStyle: boolean; + Wartosc: integer; // normal-note: 1, golden-note: 2 (TODO: wartosc=value, rename to Type_ or Kind?) + end; + end; + ALine = array of TLine; // (TODO: rename to TLineArray) + + // (TCzesci = TSentences) + TCzesci = record + Akt: integer; // for drawing of current line (Akt = Current) + High: integer; + Ilosc: integer; // (TODO: Ilosc = Number/Count) + Resolution: integer; + NotesGAP: integer; + Wartosc: integer; // TODO: rename (wartosc=value) + Czesc: ALine; // TODO: rename to Sentence or Line + end; + + // (TODO: rename TCzas to something like T(Line/Sentence)Time/TLinePosition/TLineState) + // (Czas = time) + TCzas = record // all that concerns the current frames + OldBeat: integer; // previous discovered beat + AktBeat: integer; // current beat (TODO: rename) + MidBeat: real; // like AktBeat + + // now we use this for super synchronization! + // only used when analyzing voice + OldBeatD: integer; // previous discovered beat + AktBeatD: integer; // current beat (TODO: rename) + MidBeatD: real; // like AktBeatD + FracBeatD: real; // fractional part of MidBeatD + + // we use this for audible clicks + OldBeatC: integer; // previous discovered beat + AktBeatC: integer; // current beat (TODO: rename) + MidBeatC: real; // like AktBeatC + FracBeatC: real; // fractional part of MidBeatC + + + OldCzesc: integer; // previous displayed sentence (Czesc = part (here: sentence/line)) + + Teraz: real; // (TODO: Teraz = current time) + Razem: real; // (TODO: Razem = total time) + end; + + +type + TFFTData = array[0..255] of Single; + + TPCMStereoSample = array[0..1] of Smallint; + TPCMData = array[0..511] of TPCMStereoSample; + +type + TStreamStatus = (ssStopped, ssPlaying, ssPaused, ssBlocked, ssUnknown); +const + StreamStatusStr: array[TStreamStatus] of string = + ('Stopped', 'Playing', 'Paused', 'Blocked', 'Unknown'); + +type + TAudioSampleFormat = ( + asfU8, asfS8, // unsigned/signed 8 bits + asfU16LSB, asfS16LSB, // unsigned/signed 16 bits (endianness: LSB) + asfU16MSB, asfS16MSB, // unsigned/signed 16 bits (endianness: MSB) + asfU16, asfS16, // unsigned/signed 16 bits (endianness: System) + asfS24, // signed 24 bits (endianness: System) + asfS32, // signed 32 bits (endianness: System) + asfFloat // float + ); + + TAudioFormatInfo = record + Channels: byte; + SampleRate: integer; + Format: TAudioSampleFormat; + end; + +type + TAudioProcessingStream = class + public + procedure Close(); virtual; abstract; + end; + + TAudioPlaybackStream = class(TAudioProcessingStream) + protected + function GetLoop(): boolean; virtual; abstract; + procedure SetLoop(Enabled: boolean); virtual; abstract; + function GetLength(): real; virtual; abstract; + function GetStatus(): TStreamStatus; virtual; abstract; + function GetVolume(): integer; virtual; abstract; + procedure SetVolume(volume: integer); virtual; abstract; + public + procedure Play(); virtual; abstract; + procedure Pause(); virtual; abstract; + procedure Stop(); virtual; abstract; + + property Loop: boolean READ GetLoop WRITE SetLoop; + property Length: real READ GetLength; + property Status: TStreamStatus READ GetStatus; + property Volume: integer READ GetVolume WRITE SetVolume; + end; + + (* + TAudioMixerStream = class(TAudioProcessingStream) + procedure AddStream(stream: TAudioProcessingStream); + procedure RemoveStream(stream: TAudioProcessingStream); + procedure SetMasterVolume(volume: cardinal); + function GetMasterVolume(): cardinal; + procedure SetStreamVolume(stream: TAudioProcessingStream; volume: cardinal); + function GetStreamVolume(stream: TAudioProcessingStream): cardinal; + end; + *) + + TAudioDecodeStream = class(TAudioProcessingStream) + protected + function GetLength(): real; virtual; abstract; + function GetPosition(): real; virtual; abstract; + procedure SetPosition(Time: real); virtual; abstract; + function IsEOF(): boolean; virtual; abstract; + public + function ReadData(Buffer: PChar; BufSize: integer): integer; virtual; abstract; + function GetAudioFormatInfo(): TAudioFormatInfo; virtual; abstract; + + property Length: real READ GetLength; + property Position: real READ GetPosition WRITE SetPosition; + property EOF: boolean READ IsEOF; + end; + +type + IGenericPlayback = Interface + ['{63A5EBC3-3F4D-4F23-8DFB-B5165FCE33DD}'] + function GetName: String; + + function Open(Filename: string): boolean; // true if succeed + procedure Close; + + procedure Play; + procedure Pause; + procedure Stop; + + procedure SetPosition(Time: real); + function GetPosition: real; + + property Position : real READ GetPosition WRITE SetPosition; + end; + + IVideoPlayback = Interface( IGenericPlayback ) + ['{3574C40C-28AE-4201-B3D1-3D1F0759B131}'] + procedure init(); + + procedure GetFrame(Time: Extended); // WANT TO RENAME THESE TO BE MORE GENERIC + procedure DrawGL(Screen: integer); // WANT TO RENAME THESE TO BE MORE GENERIC + + end; + + IVideoVisualization = Interface( IVideoPlayback ) + ['{5AC17D60-B34D-478D-B632-EB00D4078017}'] + end; + + IAudioPlayback = Interface( IGenericPlayback ) + ['{E4AE0B40-3C21-4DC5-847C-20A87E0DFB96}'] + function InitializePlayback: boolean; + procedure SetVolume(Volume: integer); + procedure SetMusicVolume(Volume: integer); + procedure SetLoop(Enabled: boolean); + + procedure Rewind; + function Finished: boolean; + function Length: real; + + // Sounds + function OpenSound(const Filename: String): TAudioPlaybackStream; + procedure PlaySound(stream: TAudioPlaybackStream); + procedure StopSound(stream: TAudioPlaybackStream); + + // Equalizer + procedure GetFFTData(var data: TFFTData); + + // Interface for Visualizer + function GetPCMData(var data: TPCMData): Cardinal; + end; + + IGenericDecoder = Interface + ['{557B0E9A-604D-47E4-B826-13769F3E10B7}'] + function InitializeDecoder(): boolean; + //function IsSupported(const Filename: string): boolean; + end; + + (* + IVideoDecoder = Interface( IGenericDecoder ) + ['{2F184B2B-FE69-44D5-9031-0A2462391DCA}'] + function Open(const Filename: string): TVideoDecodeStream; + end; + *) + + IAudioDecoder = Interface( IGenericDecoder ) + ['{AB47B1B6-2AA9-4410-BF8C-EC79561B5478}'] + function Open(const Filename: string): TAudioDecodeStream; + end; + + IAudioInput = Interface + ['{A5C8DA92-2A0C-4AB2-849B-2F7448C6003A}'] + function GetName: String; + function InitializeRecord: boolean; + + procedure CaptureStart; + procedure CaptureStop; + end; + +type + TSoundLibrary = class + public + Start: TAudioPlaybackStream; + Back: TAudioPlaybackStream; + Swoosh: TAudioPlaybackStream; + Change: TAudioPlaybackStream; + Option: TAudioPlaybackStream; + Click: TAudioPlaybackStream; + Drum: TAudioPlaybackStream; + Hihat: TAudioPlaybackStream; + Clap: TAudioPlaybackStream; + Shuffle: TAudioPlaybackStream; + + constructor Create(); + destructor Destroy(); override; + end; + +var // TODO : JB --- THESE SHOULD NOT BE GLOBAL + // music + Muzyka: TMuzyka; // TODO: rename + + // czesci z nutami; + Czesci: array of TCzesci; // TODO: rename to Sentences/Lines + + // czas + Czas: TCzas; // TODO: rename + + SoundLib: TSoundLibrary; + + +procedure InitializeSound; + +function Visualization(): IVideoPlayback; +function VideoPlayback(): IVideoPlayback; +function AudioPlayback(): IAudioPlayback; +function AudioInput(): IAudioInput; +function AudioDecoder(): IAudioDecoder; + +function AudioManager: TInterfaceList; + + +implementation + +uses + sysutils, + UMain, + UCommandLine; +// uLog; + +var + singleton_VideoPlayback : IVideoPlayback = nil; + singleton_Visualization : IVideoPlayback = nil; + singleton_AudioPlayback : IAudioPlayback = nil; + singleton_AudioInput : IAudioInput = nil; + singleton_AudioDecoder : IAudioDecoder = nil; + + singleton_AudioManager : TInterfaceList = nil; + + +function AudioManager: TInterfaceList; +begin + if singleton_AudioManager = nil then + singleton_AudioManager := TInterfaceList.Create(); + + Result := singleton_AudioManager; +end; //CompressionPluginManager + + +function VideoPlayback(): IVideoPlayback; +begin + result := singleton_VideoPlayback; +end; + +function Visualization(): IVideoPlayback; +begin + result := singleton_Visualization; +end; + +function AudioPlayback(): IAudioPlayback; +begin + result := singleton_AudioPlayback; +end; + +function AudioInput(): IAudioInput; +begin + result := singleton_AudioInput; +end; + +function AudioDecoder(): IAudioDecoder; +begin + result := singleton_AudioDecoder; +end; + +procedure InitializeSound; +var + lTmpInterface : IInterface; + iCount : Integer; +begin + lTmpInterface := nil; + + singleton_AudioPlayback := nil; + singleton_AudioInput := nil; + singleton_AudioDecoder := nil; + singleton_VideoPlayback := nil; + singleton_Visualization := nil; + + for iCount := 0 to AudioManager.Count - 1 do + begin + if assigned( AudioManager[iCount] ) then + begin + // if this interface is a Playback, then set it as the default used + + if ( AudioManager[iCount].QueryInterface( IAudioPlayback, lTmpInterface ) = 0 ) AND + ( true ) then + begin + singleton_AudioPlayback := IAudioPlayback( lTmpInterface ); + end; + + // if this interface is a Input, then set it as the default used + if ( AudioManager[iCount].QueryInterface( IAudioInput, lTmpInterface ) = 0 ) AND + ( true ) then + begin + singleton_AudioInput := IAudioInput( lTmpInterface ); + end; + + // if this interface is a Decoder, then set it as the default used + if ( AudioManager[iCount].QueryInterface( IAudioDecoder, lTmpInterface ) = 0 ) AND + ( true ) then + begin + singleton_AudioDecoder := IAudioDecoder( lTmpInterface ); + end; + + // if this interface is a Input, then set it as the default used + if ( AudioManager[iCount].QueryInterface( IVideoPlayback, lTmpInterface ) = 0 ) AND + ( true ) then + begin + singleton_VideoPlayback := IVideoPlayback( lTmpInterface ); + end; + + if ( AudioManager[iCount].QueryInterface( IVideoVisualization, lTmpInterface ) = 0 ) AND + ( true ) then + begin + singleton_Visualization := IVideoPlayback( lTmpInterface ); + end; + + end; + end; + + + + if VideoPlayback <> nil then + begin + end; + + if AudioDecoder <> nil then + begin + AudioDecoder.InitializeDecoder; + end; + + if AudioPlayback <> nil then + begin + AudioPlayback.InitializePlayback; + end; + + if AudioInput <> nil then + begin + AudioInput.InitializeRecord; + end; + + // Load in-game sounds + SoundLib := TSoundLibrary.Create; + + if FindCmdLineSwitch( cMediaInterfaces ) then + begin + writeln( '' ); + writeln( '--------------------------------------------------------------' ); + writeln( ' In-use Media Interfaces ' ); + writeln( '--------------------------------------------------------------' ); + writeln( 'Registered Audio Playback Interface : ' + AudioPlayback.GetName ); + writeln( 'Registered Audio Input Interface : ' + AudioInput.GetName ); + writeln( 'Registered Video Playback Interface : ' + VideoPlayback.GetName ); + writeln( 'Registered Visualization Interface : ' + Visualization.GetName ); + writeln( '--------------------------------------------------------------' ); + writeln( '' ); + + halt; + end; +end; + +constructor TSoundLibrary.Create(); +begin + //Log.LogStatus('Loading Sounds', 'Music Initialize'); + + //Log.BenchmarkStart(4); + + Start := AudioPlayback.OpenSound(SoundPath + 'Common start.mp3'); + (* + Back := AudioPlayback.OpenSound(SoundPath + 'Common back.mp3'); + Swoosh := AudioPlayback.OpenSound(SoundPath + 'menu swoosh.mp3'); + Change := AudioPlayback.OpenSound(SoundPath + 'select music change music 50.mp3'); + Option := AudioPlayback.OpenSound(SoundPath + 'option change col.mp3'); + Click := AudioPlayback.OpenSound(SoundPath + 'rimshot022b.mp3'); + *) + + //Drum := AudioPlayback.OpenSound(SoundPath + 'bassdrumhard076b.mp3'); + //Hihat := AudioPlayback.OpenSound(SoundPath + 'hihatclosed068b.mp3'); + //Clap := AudioPlayback.OpenSound(SoundPath + 'claps050b.mp3'); + + //Shuffle := AudioPlayback.OpenSound(SoundPath + 'Shuffle.mp3'); + + //Log.BenchmarkEnd(4); + //Log.LogBenchmark('--> Loading Sounds', 4); +end; + +destructor TSoundLibrary.Destroy(); +begin + Start.Free; + Back.Free; + Swoosh.Free; + Change.Free; + Option.Free; + Click.Free; + + //Drum.Free; + //Hihat.Free; + //Clap.Free; + + //Shuffle.Free; +end; + + +initialization +begin + singleton_AudioManager := TInterfaceList.Create(); + +end; + +finalization + singleton_AudioManager.clear; + FreeAndNil( singleton_AudioManager ); + +end. diff --git a/Game/Code/Classes/URecord.pas b/Game/Code/Classes/URecord.pas index ab351f6e..8ae0978a 100644 --- a/Game/Code/Classes/URecord.pas +++ b/Game/Code/Classes/URecord.pas @@ -1,325 +1,535 @@ -unit URecord; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses Classes, - Math, - SysUtils, - UCommon, - UMusic, - UIni; - -// http://www.poltran.com - -type - TSound = class - BufferNew: TMemoryStream; // buffer for newest sample - BufferArray: array[1..4096] of smallint; // (Signal) newest 4096 samples - BufferLong: array of TMemoryStream; // full buffer - - Num: integer; - n: integer; // length of Signal to analyze - - // pitch detection - SzczytJest: boolean; // czy jest szczyt - pivot : integer; // Position of summit (top) on horizontal pivot - TonDokl: real; // ton aktualnego szczytu - Ton: integer; // ton bez ulamka - TonGamy: integer; // ton w gamie. wartosci: 0-11 - Skala: real; // skala FFT - - // procedures - procedure ProcessNewBuffer; - procedure AnalyzeBuffer; // use to analyze sound from buffers to get new pitch - procedure AnalyzeByAutocorrelation; // we call it to analyze sound by checking Autocorrelation - function AnalyzeAutocorrelationFreq(Freq: real): real; // use this to check one frequency by Autocorrelation - end; - - TSoundCardInput = record - Name: string; - end; - - TGenericSoundCard = class - // here can be the soundcard information - whole database from which user will select recording source - Description: string; // soundcard name/description - Input: array of TSoundCardInput; // soundcard input(-source)s - InputSelected: integer; // unused. What is this good for? - MicInput: integer; // unused. What is this good for? - //SampleRate: integer; // TODO: for sample-rate conversion (for devices that do not support 44.1kHz) - CaptureSoundLeft: TSound; // sound(-buffer) used for left channel capture data - CaptureSoundRight: TSound; // sound(-buffer) used for right channel capture data - end; - - TAudioInputProcessor = class - Sound: array of TSound; - SoundCard: array of TGenericSoundCard; - - constructor Create; - - // handle microphone input - procedure HandleMicrophoneData(Buffer: Pointer; Length: Cardinal; - InputDevice: TGenericSoundCard); - - function volume( aChannel : byte ): byte; - end; - - smallintarray = array [0..maxInt shr 1-1] of smallInt; - psmallintarray = ^smallintarray; - - function AudioInputProcessor(): TAudioInputProcessor; - -implementation - -uses UMain; - -var - singleton_AudioInputProcessor : TAudioInputProcessor = nil; - - -// FIXME: Race-Conditions between Callback-thread and main-thread -// on BufferArray (maybe BufferNew also). -// Use SDL-mutexes to solve this problem. - - -function AudioInputProcessor(): TAudioInputProcessor; -begin +unit URecord; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses Classes, + Math, + SysUtils, + UCommon, + UMusic, + UIni; + +type + TSound = class + private + BufferNew: TMemoryStream; // buffer for newest samples + public + BufferArray: array[0..4095] of smallint; // newest 4096 samples + BufferLong: array of TMemoryStream; // full buffer + + Index: integer; // index in TAudioInputProcessor.Sound[] (TODO: Remove if not used) + + AnalysisBufferSize: integer; // number of samples to analyze + + // pitch detection + ToneValid: boolean; // true if Tone contains a valid value (otherwise it contains noise) + //Peak: integer; // position of peak on horizontal pivot (TODO: Remove if not used) + //ToneAccuracy: real; // tone accuracy (TODO: Remove if not used) + Tone: integer; // TODO: should be a non-unified full range tone (e.g. C2<>C3). Range: 0..NumHalftones-1 + // Note: at the moment it is the same as ToneUnified + ToneUnified: integer; // tone unified to one octave (e.g. C2=C3=C4). Range: 0-11 + //Scale: real; // FFT scale (TODO: Remove if not used) + + // procedures + procedure ProcessNewBuffer; + procedure AnalyzeBuffer; // use to analyze sound from buffers to get new pitch + procedure AnalyzeByAutocorrelation; // we call it to analyze sound by checking Autocorrelation + function AnalyzeAutocorrelationFreq(Freq: real): real; // use this to check one frequency by Autocorrelation + end; + + TAudioInputDeviceSource = record + Name: string; + end; + + // soundcard input-devices information + TAudioInputDevice = class + public + CfgIndex: integer; // index of this device in Ini.InputDeviceConfig + Description: string; // soundcard name/description + Source: array of TAudioInputDeviceSource; // soundcard input(-source)s + SourceSelected: integer; // unused. What is this good for? + MicInput: integer; // unused. What is this good for? + SampleRate: integer; // capture sample-rate (e.g. 44.1kHz -> 44100) + CaptureChannel: array[0..1] of TSound; // sound(-buffers) used for left/right channel's capture data + + procedure Start(); virtual; abstract; + procedure Stop(); virtual; abstract; + + destructor Destroy; override; + end; + + TAudioInputProcessor = class + Sound: array of TSound; + Device: array of TAudioInputDevice; + + constructor Create; + + // handle microphone input + procedure HandleMicrophoneData(Buffer: Pointer; Size: Cardinal; + InputDevice: TAudioInputDevice); + + function Volume( aChannel : byte ): byte; + end; + + TAudioInputBase = class( TInterfacedObject, IAudioInput ) + private + Started: boolean; + protected + function UnifyDeviceName(const name: string; deviceIndex: integer): string; + function UnifyDeviceSourceName(const name: string; const deviceName: string): string; + public + function GetName: String; virtual; abstract; + function InitializeRecord: boolean; virtual; abstract; + + procedure CaptureStart; + procedure CaptureStop; + end; + + + SmallIntArray = array [0..maxInt shr 1-1] of smallInt; + PSmallIntArray = ^SmallIntArray; + + function AudioInputProcessor(): TAudioInputProcessor; + +implementation + +uses + ULog, + UMain; + +const + CaptureFreq = 44100; + BaseToneFreq = 65.4064; // lowest (half-)tone to analyze (C2 = 65.4064 Hz) + NumHalftones = 36; // C2-B4 (for Whitney and my high voice) + +var + singleton_AudioInputProcessor : TAudioInputProcessor = nil; + + +// FIXME: Race-Conditions between Callback-thread and main-thread +// on BufferArray (maybe BufferNew also). +// Use SDL-mutexes to solve this problem. + + +{ Global } + +function AudioInputProcessor(): TAudioInputProcessor; +begin if singleton_AudioInputProcessor = nil then singleton_AudioInputProcessor := TAudioInputProcessor.create(); result := singleton_AudioInputProcessor; - end; - -procedure TSound.ProcessNewBuffer; -var - S: integer; - L: integer; - A: integer; -begin - // process BufferArray - S := 0; - L := BufferNew.Size div 2; - if L > n then begin - S := L - n; - L := n; - end; - - // copy to array - for A := L+1 to n do - BufferArray[A-L] := BufferArray[A]; - - BufferNew.Seek(2*S, soBeginning); - BufferNew.ReadBuffer(BufferArray[1+n-L], 2*L); - - // process BufferLong - if Ini.SavePlayback = 1 then - begin - BufferNew.Seek(0, soBeginning); - BufferLong[0].CopyFrom(BufferNew, BufferNew.Size); - end; -end; - -procedure TSound.AnalyzeBuffer; -begin - AnalyzeByAutocorrelation; -end; - -procedure TSound.AnalyzeByAutocorrelation; -var - T: integer; // tone - F: real; // freq - Wages: array[0..35] of real; // wages - MaxT: integer; // max tone - MaxW: real; // max wage - V: real; // volume - MaxV: real; // max volume - S: integer; // Signal - Threshold: real; // threshold -begin - SzczytJest := false; - - // find maximum volume of first 1024 words of signal - MaxV := 0; - for S := 1 to 1024 do // 0.5.2: fix. was from 0 to 1023 - begin - V := Abs(BufferArray[S]) / $10000; - - if V > MaxV then - MaxV := V; - end; - - // prepare to analyze - MaxW := 0; - - // analyze all 12 halftones - for T := 0 to 35 do // to 11, then 23, now 35 (for Whitney and my high voice) - begin - F := 130.81 * Power(1.05946309436, T)/2; // let's analyze below 130.81 - Wages[T] := AnalyzeAutocorrelationFreq(F); - - if Wages[T] > MaxW then - begin // this frequency has better wage - MaxW := Wages[T]; - MaxT := T; - end; - end; // for T - - Threshold := 0.1; - case Ini.Threshold of - 0: Threshold := 0.05; - 1: Threshold := 0.1; - 2: Threshold := 0.15; - 3: Threshold := 0.2; - end; - - if MaxV >= Threshold then - begin // found acceptable volume // 0.1 - SzczytJest := true; - TonGamy := MaxT mod 12; - Ton := MaxT mod 12; - end; - -end; - -function TSound.AnalyzeAutocorrelationFreq(Freq: real): real; // result medium difference -var - Count: real; - Src: integer; - Dst: integer; - Move: integer; - Il: integer; // how many counts were done -begin - // we use Signal as source - Count := 0; - Il := 0; - Src := 1; - Move := Round(44100/Freq); - Dst := Src + Move; - - // ver 2 - compare in vertical - while (Dst < n) do - begin // process up to n (4KB) of Signal - Count := Count + Abs(BufferArray[Src] - BufferArray[Dst]) / $10000; - Inc(Src); - Inc(Dst); - Inc(Il); - end; - - Result := 1 - Count / Il; -end; - -{* - * Handle captured microphone input data. - * Params: - * Buffer - buffer of signed 16bit interleaved stereo PCM-samples. - * Interleaved means that a right-channel sample follows a left- - * channel sample and vice versa (0:left[0],1:right[0],2:left[1],...). - * Length - number of bytes in Buffer - * Input - Soundcard-Input used for capture - *} -procedure TAudioInputProcessor.HandleMicrophoneData(Buffer: Pointer; Length: Cardinal; InputDevice: TGenericSoundCard); -var - L: integer; - S: integer; - PB: pbytearray; - PSI: psmallintarray; - I: integer; - Skip: integer; - Boost: byte; -begin - // set boost - case Ini.MicBoost of - 0: Boost := 1; - 1: Boost := 2; - 2: Boost := 4; - 3: Boost := 8; - end; - - // boost buffer - L := Length div 2; // number of samples - PSI := Buffer; - for S := 0 to L-1 do - begin - I := PSI^[S] * Boost; - - // TODO : JB - This will clip the audio... cant we reduce the "Boot" if the data clips ?? - if I > 32767 then - I := 32767; // 0.5.0: limit - - if I < -32768 then - I := -32768; // 0.5.0: limit - - PSI^[S] := I; - end; - - // 2 players USB mic, left channel - if InputDevice.CaptureSoundLeft <> nil then - begin - L := Length div 4; // number of samples - PB := Buffer; - - InputDevice.CaptureSoundLeft.BufferNew.Clear; // 0.5.2: problem on exiting - for S := 0 to L-1 do - begin - InputDevice.CaptureSoundLeft.BufferNew.Write(PB[S*4], 2); - end; - InputDevice.CaptureSoundLeft.ProcessNewBuffer; - end; - - // 2 players USB mic, right channel - Skip := 2; - - if InputDevice.CaptureSoundRight <> nil then - begin - L := Length div 4; // number of samples - PB := Buffer; - InputDevice.CaptureSoundRight.BufferNew.Clear; - for S := 0 to L-1 do - begin - InputDevice.CaptureSoundRight.BufferNew.Write(PB[Skip + S*4], 2); - end; - InputDevice.CaptureSoundRight.ProcessNewBuffer; - end; -end; - -constructor TAudioInputProcessor.Create; -var - S: integer; -begin - SetLength(Sound, 6 {max players});//Ini.Players+1); - for S := 0 to High(Sound) do - begin //Ini.Players do begin - Sound[S] := TSound.Create; - Sound[S].Num := S; - Sound[S].BufferNew := TMemoryStream.Create; - SetLength(Sound[S].BufferLong, 1); - Sound[S].BufferLong[0] := TMemoryStream.Create; - Sound[S].n := 4*1024; - end; -end; - -function TAudioInputProcessor.volume( aChannel : byte ): byte; -var - lCount : Integer; - lMaxVol : double; -begin; - lMaxVol := AudioInputProcessor.Sound[aChannel].BufferArray[1]; - for lCount := 2 to AudioInputProcessor.Sound[aChannel].n div 1 do - begin - if AudioInputProcessor.Sound[aChannel].BufferArray[lCount] > lMaxVol then - lMaxVol := AudioInputProcessor.Sound[aChannel].BufferArray[lCount]; - end; - - result := trunc( ( 255 / 32767 ) * trunc( lMaxVol ) ); -end; - -end. - - - + + +{ TAudioInputDevice } + +destructor TAudioInputDevice.Destroy; +var + i: integer; +begin + Stop(); + Source := nil; + for i := 0 to High(CaptureChannel) do + CaptureChannel[i] := nil; + inherited Destroy; +end; + + +{ TSound } + +procedure TSound.ProcessNewBuffer; +var + SkipCount: integer; + NumSamples: integer; + SampleIndex: integer; +begin + // process BufferArray + SkipCount := 0; + NumSamples := BufferNew.Size div 2; + + // check if we have more new samples than we can store + if NumSamples > Length(BufferArray) then + begin + // discard the oldest of the new samples + SkipCount := NumSamples - Length(BufferArray); + NumSamples := Length(BufferArray); + end; + + // move old samples to the beginning of the array (if necessary) + for SampleIndex := NumSamples to High(BufferArray) do + BufferArray[SampleIndex-NumSamples] := BufferArray[SampleIndex]; + + // skip samples if necessary + BufferNew.Seek(2*SkipCount, soBeginning); + // copy samples + BufferNew.ReadBuffer(BufferArray[Length(BufferArray)-NumSamples], 2*NumSamples); + + // save capture-data to BufferLong if neccessary + if Ini.SavePlayback = 1 then + begin + BufferNew.Seek(0, soBeginning); + BufferLong[0].CopyFrom(BufferNew, BufferNew.Size); + end; +end; + +procedure TSound.AnalyzeBuffer; +begin + AnalyzeByAutocorrelation; +end; + +procedure TSound.AnalyzeByAutocorrelation; +var + ToneIndex: integer; + Freq: real; + Wages: array[0..NumHalftones-1] of real; + MaxTone: integer; + MaxWage: real; + Volume: real; + MaxVolume: real; + SampleIndex: integer; + Threshold: real; +const + HalftoneBase = 1.05946309436; // 2^(1/12) -> HalftoneBase^12 = 2 (one octave) +begin + ToneValid := false; + + // find maximum volume of first 1024 samples + MaxVolume := 0; + for SampleIndex := 0 to 1023 do + begin + Volume := Abs(BufferArray[SampleIndex]) / + -Low(Smallint); // was $10000 (65536) before but must be 32768 + + if Volume > MaxVolume then + MaxVolume := Volume; + end; + + // prepare to analyze + MaxWage := 0; + + // analyze halftones + for ToneIndex := 0 to NumHalftones-1 do + begin + Freq := BaseToneFreq * Power(HalftoneBase, ToneIndex); + Wages[ToneIndex] := AnalyzeAutocorrelationFreq(Freq); + + if Wages[ToneIndex] > MaxWage then + begin + // this frequency has better wage + MaxWage := Wages[ToneIndex]; + MaxTone := ToneIndex; + end; + end; + + Threshold := 0.2; + case Ini.Threshold of + 0: Threshold := 0.1; + 1: Threshold := 0.2; + 2: Threshold := 0.3; + 3: Threshold := 0.4; + end; + + // check if signal has an acceptable volume (ignore background-noise) + if MaxVolume >= Threshold then + begin + ToneValid := true; + ToneUnified := MaxTone mod 12; + Tone := MaxTone mod 12; + end; + +end; + +function TSound.AnalyzeAutocorrelationFreq(Freq: real): real; // result medium difference +var + Dist: real; // distance (0=equal .. 1=totally different) between correlated samples + AccumDist: real; // accumulated distances + SampleIndex: integer; // index of sample to analyze + CorrelatingSampleIndex: integer; // index of sample one period ahead + SamplesPerPeriod: integer; // samples in one period +begin + SampleIndex := 0; + SamplesPerPeriod := Round(CaptureFreq/Freq); + CorrelatingSampleIndex := SampleIndex + SamplesPerPeriod; + + AccumDist := 0; + + // compare correlating samples + while (CorrelatingSampleIndex < AnalysisBufferSize) do + begin + // calc distance (correlation: 1-dist) to corresponding sample in next period + Dist := Abs(BufferArray[SampleIndex] - BufferArray[CorrelatingSampleIndex]) / + High(Word); // was $10000 (65536) before but must be 65535 + AccumDist := AccumDist + Dist; + Inc(SampleIndex); + Inc(CorrelatingSampleIndex); + end; + + // return "inverse" average distance (=correlation) + Result := 1 - AccumDist / AnalysisBufferSize; +end; + + +{ TAudioInputProcessor } + +{* + * Handle captured microphone input data. + * Params: + * Buffer - buffer of signed 16bit interleaved stereo PCM-samples. + * Interleaved means that a right-channel sample follows a left- + * channel sample and vice versa (0:left[0],1:right[0],2:left[1],...). + * Length - number of bytes in Buffer + * Input - Soundcard-Input used for capture + *} +procedure TAudioInputProcessor.HandleMicrophoneData(Buffer: Pointer; Size: Cardinal; InputDevice: TAudioInputDevice); +var + NumSamples: integer; // number of samples + SampleIndex: integer; + Value: integer; + ByteBuffer: PByteArray; // buffer handled as array of bytes + SampleBuffer: PSmallIntArray; // buffer handled as array of samples + Offset: integer; + Boost: byte; + ChannelCount: integer; + ChannelIndex: integer; + CaptureChannel: TSound; + SampleSize: integer; +begin + // set boost + case Ini.MicBoost of + 0: Boost := 1; + 1: Boost := 2; + 2: Boost := 4; + 3: Boost := 8; + end; + + // boost buffer + NumSamples := Size div 2; + SampleBuffer := Buffer; + for SampleIndex := 0 to NumSamples-1 do + begin + Value := SampleBuffer^[SampleIndex] * Boost; + + // TODO : JB - This will clip the audio... cant we reduce the "Boost" if the data clips ?? + if Value > High(Smallint) then + Value := High(Smallint); + + if Value < Low(Smallint) then + Value := Low(Smallint); + + SampleBuffer^[SampleIndex] := Value; + end; + + // number of channels + ChannelCount := Length(InputDevice.CaptureChannel); + // size of one sample + SampleSize := ChannelCount * SizeOf(SmallInt); + // samples per channel + NumSamples := Size div SampleSize; + + // interpret buffer as buffer of bytes + ByteBuffer := Buffer; + + // process channels + for ChannelIndex := 0 to High(InputDevice.CaptureChannel) do + begin + CaptureChannel := InputDevice.CaptureChannel[ChannelIndex]; + if (CaptureChannel <> nil) then + begin + Offset := ChannelIndex * SizeOf(SmallInt); + + // TODO: remove BufferNew and write to BufferArray directly + + CaptureChannel.BufferNew.Clear; + for SampleIndex := 0 to NumSamples-1 do + begin + CaptureChannel.BufferNew.Write(ByteBuffer^[Offset + SampleIndex*SampleSize], + SizeOf(SmallInt)); + end; + CaptureChannel.ProcessNewBuffer(); + end; + end; +end; + +constructor TAudioInputProcessor.Create; +var + i: integer; +begin + SetLength(Sound, 6 {max players});//Ini.Players+1); + for i := 0 to High(Sound) do + begin + Sound[i] := TSound.Create; + Sound[i].Index := i; + Sound[i].BufferNew := TMemoryStream.Create; + SetLength(Sound[i].BufferLong, 1); + Sound[i].BufferLong[0] := TMemoryStream.Create; + Sound[i].AnalysisBufferSize := Min(4*1024, Length(Sound[i].BufferArray)); + end; +end; + +function TAudioInputProcessor.Volume( aChannel : byte ): byte; +var + lSampleIndex: Integer; + lMaxVol : Word; +begin; + with AudioInputProcessor.Sound[aChannel] do + begin + lMaxVol := BufferArray[0]; + for lSampleIndex := 1 to High(BufferArray) do + begin + if Abs(BufferArray[lSampleIndex]) > lMaxVol then + lMaxVol := Abs(BufferArray[lSampleIndex]); + end; + end; + + result := trunc( ( 255 / -Low(Smallint) ) * lMaxVol ); +end; + + +{ TAudioInputBase } + +{* + * Start capturing on all used input-device. + *} +procedure TAudioInputBase.CaptureStart; +var + S: integer; + DeviceIndex: integer; + ChannelIndex: integer; + Device: TAudioInputDevice; + DeviceCfg: PInputDeviceConfig; + DeviceUsed: boolean; + Player: integer; +begin + if (Started) then + CaptureStop(); + + Log.BenchmarkStart(1); + + // reset buffers + for S := 0 to High(AudioInputProcessor.Sound) do + AudioInputProcessor.Sound[S].BufferLong[0].Clear; + + // start capturing on each used device + for DeviceIndex := 0 to High(AudioInputProcessor.Device) do begin + Device := AudioInputProcessor.Device[DeviceIndex]; + if not assigned(Device) then + continue; + DeviceCfg := @Ini.InputDeviceConfig[Device.CfgIndex]; + + DeviceUsed := false; + + // check if device is used + for ChannelIndex := 0 to High(DeviceCfg.ChannelToPlayerMap) do + begin + Player := DeviceCfg.ChannelToPlayerMap[ChannelIndex]-1; + if (Player < 0) or (Player >= PlayersPlay) then + begin + Device.CaptureChannel[ChannelIndex] := nil; + end + else + begin + Device.CaptureChannel[ChannelIndex] := AudioInputProcessor.Sound[Player]; + DeviceUsed := true; + end; + end; + + // start device if used + if (DeviceUsed) then begin + Log.BenchmarkStart(2); + Device.Start(); + Log.BenchmarkEnd(2); + Log.LogBenchmark('Device.Start', 2) ; + end; + end; + + Log.BenchmarkEnd(1); + Log.LogBenchmark('CaptureStart', 1) ; + + Started := true; +end; + +{* + * Stop input-capturing on all soundcards. + *} +procedure TAudioInputBase.CaptureStop; +var + DeviceIndex: integer; + Player: integer; + Device: TAudioInputDevice; + DeviceCfg: PInputDeviceConfig; +begin + for DeviceIndex := 0 to High(AudioInputProcessor.Device) do begin + Device := AudioInputProcessor.Device[DeviceIndex]; + if not assigned(Device) then + continue; + Device.Stop(); + end; + + Started := false; +end; + +function TAudioInputBase.UnifyDeviceName(const name: string; deviceIndex: integer): string; +var + count: integer; // count of devices with this name + + function IsDuplicate(const name: string): boolean; + var + i: integer; + begin + Result := False; + // search devices with same description + For i := 0 to deviceIndex-1 do + begin + if (AudioInputProcessor.Device[i].Description = name) then + begin + Result := True; + Break; + end; + end; + end; +begin + count := 1; + result := name; + + // if there is another device with the same ID, search for an available name + while (IsDuplicate(result)) do + begin + Inc(count); + // set description + result := name + ' ('+IntToStr(count)+')'; + end; +end; + +{* + * Unifies an input-device's source name. + * Note: the description member of the device must already be set when + * calling this function. + *} +function TAudioInputBase.UnifyDeviceSourceName(const name: string; const deviceName: string): string; +var + Descr: string; +begin + result := name; + + {$IFDEF DARWIN} + // Under MacOSX the SingStar Mics have an empty + // InputName. So, we have to add a hard coded + // Workaround for this problem + if (name = '') and (Pos( 'USBMIC Serial#', deviceName) > 0) then + begin + result := 'Microphone'; + end; + {$ENDIF} +end; + +end. + + + diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index d5c9bebc..925d62cc 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -1,1402 +1,1402 @@ -unit UScreenCredits; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - - -uses - UMenu, - SDL, - SDL_Image, - UDisplay, - UTexture, - OpenGL12, - UMusic, - UFiles, - SysUtils, - UThemes, - ULCD, - ULight, - UGraphicClasses; - -type - TCreditsStages=(InitialDelay,Intro,MainPart,Outro); - - TScreenCredits = class(TMenu) - public - - Credits_X: Real; - Credits_Time: Cardinal; - Credits_Alpha: Cardinal; - CTime: Cardinal; - CTime_hold: Cardinal; - ESC_Alpha: Integer; - - credits_entry_tex: TTexture; - credits_entry_dx_tex: TTexture; - credits_bg_tex: TTexture; - credits_bg_ovl: TTexture; -// credits_bg_logo: TTexture; - credits_bg_scrollbox_left: TTexture; - credits_blindguard: TTexture; - credits_blindy: TTexture; - credits_canni: TTexture; - credits_commandio: TTexture; - credits_lazyjoker: TTexture; - credits_mog: TTexture; - credits_mota: TTexture; - credits_skillmaster: TTexture; - credits_whiteshark: TTexture; - intro_layer01: TTexture; - intro_layer02: TTexture; - intro_layer03: TTexture; - intro_layer04: TTexture; - intro_layer05: TTexture; - intro_layer06: TTexture; - intro_layer07: TTexture; - intro_layer08: TTexture; - intro_layer09: TTexture; - outro_bg: TTexture; - outro_esc: TTexture; - outro_exd: TTexture; - - deluxe_slidein: cardinal; - - CurrentScrollText: String; - NextScrollUpdate: Real; - EndofLastScrollingPart: Cardinal; - CurrentScrollStart, CurrentScrollEnd: Integer; - - CRDTS_Stage: TCreditsStages; - - myTex: glUint; - mysdlimage,myconvertedsdlimage: PSDL_Surface; - - Fadeout: boolean; - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure onShow; override; - procedure onHide; override; - procedure DrawCredits; - procedure Draw_FunkyText; - end; - -const - Funky_Text: AnsiString = - 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+ - 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+ - 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+ - 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..'; - - - Timings: array[0..21] of Cardinal=( - 20, // 0 Delay vor Start - - 149, // 1 Ende erster Intro Zoom - 155, // 2 Start 2. Action im Intro - 170, // 3 Ende Separation im Intro - 271, // 4 Anfang Zoomout im Intro - 0, // 5 unused - 261, // 6 Start fade-to-white im Intro - - 271, // 7 Start Main Part - 280, // 8 Start On-Beat-Sternchen Main Part - - 396, // 9 Start BlindGuard - 666, // 10 Start blindy - 936, // 11 Start Canni - 1206, // 12 Start Commandio - 1476, // 13 Start LazyJoker - 1746, // 14 Start Mog - 2016, // 15 Start Mota - 2286, // 16 Start SkillMaster - 2556, // 17 Start WhiteShark - 2826, // 18 Ende Whiteshark - 3096, // 19 Start FadeOut Mainscreen - 3366, // 20 Ende Credits Tune - 60); // 21 start flare im intro - - - sdl32bpprgba: TSDL_Pixelformat=(palette: nil; - BitsPerPixel: 32; - BytesPerPixel: 4; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 24; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $ff000000; - colorkey: 0; - alpha: 255 ); - - -implementation - -uses {$IFDEF win32} - windows, - {$ELSE} - lclintf, - {$ENDIF} - ULog, - UGraphic, - UMain, - UIni, - USongs, - Textgl, - ULanguage, - UCommon, - Math, - dialogs; - - -function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then - begin // Key Down - case PressedKey of - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - FadeTo(@ScreenMain); - AudioPlayback.PlayBack; - end; -{ SDLK_SPACE: - begin - setlength(CTime_hold,length(CTime_hold)+1); - CTime_hold[high(CTime_hold)]:=CTime; - end; -} - end;//esac - end; //fi -end; - -constructor TScreenCredits.Create; -begin - inherited Create; - - credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0); - credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0); - - credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', 'PNG', 'Font Black', 0); - credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0); - credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0); - credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', 'PNG', 'Font Black', 0); - credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', 'PNG', 'Font Black', 0); - credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', 'Font Black', 0); - credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', 'PNG', 'Font Black', 0); - credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', 'PNG', 'Font Black', 0); - credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', 'PNG', 'Font Black', 0); - - intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', 'PNG', 'Transparent', 0); - intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', 'PNG', 'Transparent', 0); - intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', 'PNG', 'Transparent', 0); - intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', 'PNG', 'Transparent', 0); - intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', 'PNG', 'Transparent', 0); - intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', 'PNG', 'Transparent', 0); - intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', 'PNG', 'Transparent', 0); - intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', 'PNG', 'Transparent', 0); - intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', 'PNG', 'Transparent', 0); - - outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0); - outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0); - outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Transparent', 0); - - CRDTS_Stage:=InitialDelay; -end; - -function TScreenCredits.Draw: boolean; -begin - DrawCredits; - Draw:=true; -end; - -function pixfmt_eq(fmt1,fmt2: TSDL_Pixelformat): boolean; -begin - if (fmt1.BitsPerPixel = fmt2.BitsPerPixel) and - (fmt1.BytesPerPixel = fmt2.BytesPerPixel) and - (fmt1.Rloss = fmt2.Rloss) and - (fmt1.Gloss = fmt2.Gloss) and - (fmt1.Bloss = fmt2.Bloss) and - (fmt1.Rmask = fmt2.Rmask) and - (fmt1.Gmask = fmt2.Gmask) and - (fmt1.Bmask = fmt2.Bmask) and - (fmt1.Rshift = fmt2.Rshift) and - (fmt1.Gshift = fmt2.Gshift) and - (fmt1.Bshift = fmt2.Bshift) - then - pixfmt_eq:=True - else - pixfmt_eq:=False; -end; - -function inttohexstr(i: cardinal):pchar; -var helper, i2, c:cardinal; - tmpstr: string; -begin - helper:=0; - i2:=i; - tmpstr:=''; - for c:=1 to 8 do - begin - helper:=(helper shl 4) or (i2 and $f); - i2:=i2 shr 4; - end; - for c:=1 to 8 do - begin - i2:=helper and $f; - helper := helper shr 4; - case i2 of - 0: tmpstr:=tmpstr+'0'; - 1: tmpstr:=tmpstr+'1'; - 2: tmpstr:=tmpstr+'2'; - 3: tmpstr:=tmpstr+'3'; - 4: tmpstr:=tmpstr+'4'; - 5: tmpstr:=tmpstr+'5'; - 6: tmpstr:=tmpstr+'6'; - 7: tmpstr:=tmpstr+'7'; - 8: tmpstr:=tmpstr+'8'; - 9: tmpstr:=tmpstr+'9'; - 10: tmpstr:=tmpstr+'a'; - 11: tmpstr:=tmpstr+'b'; - 12: tmpstr:=tmpstr+'c'; - 13: tmpstr:=tmpstr+'d'; - 14: tmpstr:=tmpstr+'e'; - 15: tmpstr:=tmpstr+'f'; - end; - end; - inttohexstr:=pchar(tmpstr); -end; - -procedure TScreenCredits.onShow; -begin - CRDTS_Stage:=InitialDelay; - Credits_X := 580; - deluxe_slidein := 0; - Credits_Alpha := 0; - //Music.SetLoop(true); Loop looped ned, so ne scheisse - AudioPlayback.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! -// Music.Play; - CTime:=0; -// setlength(CTime_hold,0); - - mysdlimage:=IMG_Load('test.png'); - if assigned(mysdlimage) then - begin - {$IFNDEF FPC} - showmessage('opened image via SDL_Image'+#13#10+ - 'Width: '+inttostr(mysdlimage^.w)+#13#10+ - 'Height: '+inttostr(mysdlimage^.h)+#13#10+ - 'BitsPP: '+inttostr(mysdlimage^.format.BitsPerPixel)+#13#10+ - 'BytesPP: '+inttostr(mysdlimage^.format.BytesPerPixel)+#13#10+ - 'Rloss: '+inttostr(mysdlimage^.format.Rloss)+#13#10+ - 'Gloss: '+inttostr(mysdlimage^.format.Gloss)+#13#10+ - 'Bloss: '+inttostr(mysdlimage^.format.Bloss)+#13#10+ - 'Aloss: '+inttostr(mysdlimage^.format.Aloss)+#13#10+ - 'Rshift: '+inttostr(mysdlimage^.format.Rshift)+#13#10+ - 'Gshift: '+inttostr(mysdlimage^.format.Gshift)+#13#10+ - 'Bshift: '+inttostr(mysdlimage^.format.Bshift)+#13#10+ - 'Ashift: '+inttostr(mysdlimage^.format.Ashift)+#13#10+ - 'Rmask: '+inttohexstr(mysdlimage^.format.Rmask)+#13#10+ - 'Gmask: '+inttohexstr(mysdlimage^.format.Gmask)+#13#10+ - 'Bmask: '+inttohexstr(mysdlimage^.format.Bmask)+#13#10+ - 'Amask: '+inttohexstr(mysdlimage^.format.Amask)+#13#10+ - 'ColKey: '+inttostr(mysdlimage^.format.Colorkey)+#13#10+ - 'Alpha: '+inttostr(mysdlimage^.format.Alpha)); - - if pixfmt_eq(mysdlimage^.format^,sdl32bpprgba) then - showmessage('equal pixelformats') - else - showmessage('different pixelformats'); - {$ENDIF} - - myconvertedsdlimage:=SDL_ConvertSurface(mysdlimage,@sdl32bpprgba,SDL_SWSURFACE); - glGenTextures(1,@myTex); - glBindTexture(GL_TEXTURE_2D, myTex); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - glTexImage2D( GL_TEXTURE_2D, 0, 4, myconvertedsdlimage^.w, myconvertedsdlimage^.h, 0, - GL_RGBA, GL_UNSIGNED_BYTE, myconvertedsdlimage^.pixels ); - SDL_FreeSurface(mysdlimage); - SDL_FreeSurface(myconvertedsdlimage); - end - else - {$IFDEF FPC} - writeln( 'could not open file - test.png'); - {$ELSE} - showmessage('could not open file - test.png'); - {$ENDIF} - -end; - -procedure TScreenCredits.onHide; -begin - AudioPlayback.Stop; -end; - -Procedure TScreenCredits.Draw_FunkyText; -var - S: Integer; - X,Y,A: Real; - visibleText: PChar; -begin - SetFontSize(10); - //Init ScrollingText - if (CTime = Timings[7]) then - begin - //Set Position of Text - Credits_X := 600; - CurrentScrollStart:=1; - CurrentScrollEnd:=1; - end; - - if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then - begin - X:=0; - visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); - for S := 0 to length(visibleText)-1 do begin - Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); - SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); - A:=0; - if (Credits_X+X < 15) then A:=0; - if (Credits_X+X >=15) then A:=Credits_X+X-15; - if Credits_X+X > 32 then A:=17; - glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17); - glPrintLetter(visibleText[S]); - X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; - end; - if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin - Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; - inc(CurrentScrollStart); - end; - visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); - if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin - inc(CurrentScrollEnd); - end; - end; -{ // timing hack - X:=5; - SetFontStyle (2); - SetFontItalic(False); - SetFontSize(9); - glColor4f(1, 1, 1, 1); - for S:=0 to high(CTime_hold) do begin - visibleText:=pchar(inttostr(CTime_hold[S])); - SetFontPos (500, X); - glPrint (Addr(visibleText[0])); - X:=X+20; - end;} -end; - -procedure Start3D; -begin - glMatrixMode(GL_PROJECTION); - glPushMatrix; - glLoadIdentity; - glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity; -end; -procedure End3D; -begin - glMatrixMode(GL_PROJECTION); - glPopMatrix; - glMatrixMode(GL_MODELVIEW); -end; - -procedure TScreenCredits.DrawCredits; -var - T,I: Cardinal; - X: Real; - Ver: PChar; - RuntimeStr: AnsiString; - Data: TFFTData; - j,k,l:cardinal; - f,g,h: Real; - STime:cardinal; - Delay:cardinal; - - myPixel: longword; - myColor: Cardinal; - myScale: Real; - myAngle: Real; - - -const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24), - (154,31),(156,58),(168,32),(203,36), - (258,34),(251,50),(274,93),(294,84), - (232,54),(278,62),(319,34),(336,92), - (347,23),(374,32),(377,58),(361,83), - (385,91),(405,91),(429,35),(423,51), - (450,32),(485,34),(444,91),(486,93)); - -begin - //dis does teh muiwk y0r - Data := AudioPlayback.GetFFTData; - - Log.LogStatus('',' JB-1'); - - T := GetTickCount div 33; - if T <> Credits_Time then - begin - Credits_Time := T; - inc(CTime); - inc(CTime_hold); - Credits_X := Credits_X-2; - - Log.LogStatus('',' JB-2'); - if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then - begin -// CTime:=Timings[20]; -// CRDTS_Stage:=Outro; - - CRDTS_Stage:=Intro; - CTime:=0; - AudioPlayback.Play; - - end; - if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then - begin - CRDTS_Stage:=MainPart; - end; - if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then - begin - CRDTS_Stage:=Outro; - end; - end; - - Log.LogStatus('',' JB-3'); - - //draw background - if CRDTS_Stage=InitialDelay then - begin - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - end - else - if CRDTS_Stage=Intro then - begin - Start3D; - glPushMatrix; - - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - if CTime < Timings[1] then begin - myScale:= 0.5+0.5*(Timings[1]-CTime)/(Timings[1]); // slowly move layers together - myAngle:=cos((CTime)*pi/((Timings[1])*2)); // and make logo face towards camera - end else begin // this is the part when the logo stands still - myScale:=0.5; - myAngle:=0; - end; - if CTime > Timings[2] then begin - myScale:= 0.5+0.5*(CTime-Timings[2])/(Timings[3]-Timings[2]); // get some space between layers - myAngle:=0; - end; -// if CTime > Timings[3] then myScale:=1; // keep the space between layers - glTranslatef(0,0,-5+0.5*myScale); - if CTime > Timings[3] then myScale:=1; // keep the space between layers - if CTime > Timings[3] then begin // make logo rotate left and grow -// myScale:=(CTime-Timings[4])/(Timings[7]-Timings[4]); - glRotatef(20*sqr(CTime-Timings[3])/sqr((Timings[7]-Timings[3])/2),0,0,1); - glScalef(1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1); - end; - if CTime < Timings[2] then - glRotatef(30*myAngle,0.5*myScale+myScale,1+myScale,0); -// glScalef(0.5,0.5,0.5); - glScalef(4/3,-1,1); - glColor4f(1, 1, 1, 1); - - glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.4 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.4 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.4 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.4 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.3 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.3 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.3 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.3 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.2 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.2 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.2 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.2 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.1 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.1 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.1 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.1 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.1 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.1 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.1 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.1 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.2 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.2 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.2 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.2 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.3 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.3 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.3 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.3 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.22 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.22 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.22 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.22 * myScale); - glEnd; - gldisable(gl_texture_2d); - glDisable(GL_BLEND); - - glPopMatrix; - End3D; - - // do some sparkling effects - if (CTime < Timings[1]) and (CTime > Timings[21]) then - begin - for k:=1 to 3 do begin - l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5); - j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301); - GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0); - end; - end; - - // fade to white at end - if Ctime > Timings[6] then - begin - glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6])); - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glVertex2f(0,0); - glVertex2f(0,600); - glVertex2f(800,600); - glVertex2f(800,0); - glEnd; - glDisable(GL_BLEND); - end; - - end; - if (CRDTS_Stage=MainPart) then - // main credits screen background, scroller, logo and girl - begin - - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,600/1024);glVertex2f(0, 600); - glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); - glTexCoord2f(800/1024,0);glVertex2f(800, 0); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - // draw scroller - Draw_FunkyText; - -//######################################################################### -// draw credits names - - -Log.LogStatus('',' JB-4'); - -// BlindGuard (von links oben reindrehen, nach rechts unten rausdrehen) - STime:=Timings[9]-10; - Delay:=Timings[10]-Timings[9]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - - try - for j:=0 to 40 do - begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then - begin - if Data[j] >= Data[k] then - k:=j; - end; - end; - except - end; - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(0,329,0); - if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end; - gltranslatef(223,0,0); - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - gltranslatef(223,0,0); - glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1); - gltranslatef(-223,0,0); - end; - glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Blindy (zoom von 0 auf volle grösse und drehung, zoom auf doppelte grösse und nach rechts oben schieben) - STime:=Timings[10]-10; - Delay:=Timings[11]-Timings[10]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - - try - for j:=0 to 40 do - begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then - begin - if Data[j] >= Data[k] then - k:=j; - end; - end; - except - end; - - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+20) and (CTime<=STime+22) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+20 then begin - j:=CTime-Stime; - glscalef(j*j/400,j*j/400,j*j/400); - glrotatef(j*18.0,0,0,1); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - f:=j*10.0; - gltranslatef(f*3,-f,0); - glscalef(1+j/10,1+j/10,1+j/10); - glrotatef(j*9.0,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Canni (von links reinschieben, nach rechts oben rausschieben) - STime:=Timings[11]-10; - Delay:=Timings[12]-Timings[11]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - - try - for j:=0 to 40 do - begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then - begin - if Data[j] >= Data[k] then - k:=j; - end; - end; - except - end; - - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - gltranslatef(((CTime-STime)*21.0)-210,0,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=(CTime-(STime+Delay-10))*21; - gltranslatef(j,-j/2,0); - end; - glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Commandio (von unten reinklappen, nach rechts oben rausklappen) - STime:=Timings[12]-10; - Delay:=Timings[13]-Timings[12]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - - try - for j:=0 to 40 do - begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then - begin - if Data[j] >= Data[k] then - k:=j; - end; - end; - except - end; - - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=258.0-25.8*(CTime-STime) - else - f:=0; - g:=0; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end; - glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163+g-f*1.5, -129+f*1.5-g/2); - glTexCoord2f(0,1);glVertex2f(-163+g*1.5, 129-(g*1.5*258/326)); - glTexCoord2f(1,1); glVertex2f(163+g, 129+g/4); - glTexCoord2f(1,0);glVertex2f(163+f*1.5+g/4, -129+f*1.5-g/4); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing) - STime:=Timings[13]-35; - Delay:=Timings[14]-Timings[13]+5; - if CTime > STime then - begin - k:=0; - - try - for j:=0 to 40 do - begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then - begin - if Data[j] >= Data[k] then - k:=j; - end; - end; - except - end; - - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20; - ESC_Alpha:=10; - f:=CTime-STime; - if CTime <=STime+40 then j:=CTime-STime else j:=40; - if (CTime >=STime+Delay-40) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j*j/1600); - - glPushMatrix; - gltranslatef(180+(f-70),329,0); - glBindTexture(GL_TEXTURE_2D, credits_lazyjoker.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Mog (von links reinklappen, nach rechts unten rausklappen) - STime:=Timings[14]-10; - Delay:=Timings[15]-Timings[14]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - - - try - for j:=0 to 40 do - begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then - begin - if Data[j] >= Data[k] then - k:=j; - end; - end; - except - end; - - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=326.0-32.6*(CTime-STime) - else - f:=0; - - g:=0; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end; - glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163+g*1.5, -129+g*1.5); - glTexCoord2f(0,1);glVertex2f(-163+g*1.2, 129+g); - glTexCoord2f(1,1); glVertex2f(163-f+g/2, 129+f*1.5+g/4); - glTexCoord2f(1,0);glVertex2f(163-f+g*1.5, -129-f*1.5); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Mota (von rechts oben reindrehen, nach links unten rausschieben und verkleinern und dabei drehen) - STime:=Timings[15]-10; - Delay:=Timings[16]-Timings[15]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - - try - for j:=0 to 40 do - begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then - begin - if Data[j] >= Data[k] then - k:=j; - end; - end; - except - end; - - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - gltranslatef(223,0,0); - glrotatef((10-(CTime-STime))*9,0,0,1); - gltranslatef(-223,0,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - f:=j*10.0; - gltranslatef(-f*2,-f,0); - glscalef(1-j/10,1-j/10,1-j/10); - glrotatef(-j*9.0,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Skillmaster (von rechts unten reinschieben, nach rechts oben rausdrehen) - STime:=Timings[16]-10; - Delay:=Timings[17]-Timings[16]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - - try - for j:=0 to 40 do - begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then - begin - if Data[j] >= Data[k] then - k:=j; - end; - end; - except - end; - - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - j:=STime+10-CTime; - f:=j*10.0; - gltranslatef(+f*2,+f/2,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - gltranslatef(0,-223,0); - glrotatef(integer(j)*-9,0,0,1); - gltranslatef(0,223,0); - glrotatef(j*9,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// WhiteShark (von links unten reinklappen, nach rechts oben rausklappen) - STime:=Timings[17]-10; - Delay:=Timings[18]-Timings[17]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - - try - for j:=0 to 40 do - begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then - begin - if Data[j] >= Data[k] then - k:=j; - end; - end; - except - end; - - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=326.0-32.6*(CTime-STime) - else - f:=0; - - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end else - g:=0; - glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2); - glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4); - glTexCoord2f(1,1); glVertex2f(163-f*1.2+g/4, 129+f/2-g/4); - glTexCoord2f(1,0);glVertex2f(163-f*1.5+g/4, -129+f*1.5+g/4); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - - - Log.LogStatus('',' JB-103'); - -// #################################################################### -// do some twinkle stuff (kinda on beat) - if (CTime > Timings[8] ) and - (CTime < Timings[19] ) then - begin - k := 0; - - try - for j:=0 to 40 do - begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then - begin - if Data[j] >= Data[k] then - k:=j; - end; - end; - except - end; - - if Data[k]>0.2 then - begin - l := RandomRange(6,16); - j := RandomRange(0,27); - - GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); - end; - end; - -//################################################# -// draw the rest of the main screen (girl and logo - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(800-393, 0); - glTexCoord2f(0,600/1024);glVertex2f(800-393, 600); - glTexCoord2f(393/512,600/1024); glVertex2f(800, 600); - glTexCoord2f(393/512,0);glVertex2f(800, 0); - glEnd; -{ glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,112/128);glVertex2f(0, 112); - glTexCoord2f(497/512,112/128); glVertex2f(497, 112); - glTexCoord2f(497/512,0);glVertex2f(497, 0); - glEnd; -} - gldisable(gl_texture_2d); - glDisable(GL_BLEND); - - // fade out at end of main part - if Ctime > Timings[19] then - begin - glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19])); - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glVertex2f(0,0); - glVertex2f(0,600); - glVertex2f(800,600); - glVertex2f(800,0); - glEnd; - glDisable(GL_BLEND); - end; - end - else - if (CRDTS_Stage=Outro) then - begin - if CTime=Timings[20] then begin - CTime_hold:=0; - AudioPlayback.Stop; - AudioPlayback.Open(soundpath + 'credits-outro-tune.mp3'); - AudioPlayback.Play; - AudioPlayback.SetVolume(20); - AudioPlayback.SetLoop(True); - end; - if CTime_hold > 231 then begin - AudioPlayback.Play; - Ctime_hold:=0; - end; - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - - // do something useful - // outro background - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,600/1024);glVertex2f(0, 600); - glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); - glTexCoord2f(800/1024,0);glVertex2f(800, 0); - glEnd; - - //outro overlays - glColor4f(1, 1, 1, (1+sin(CTime/15))/3+1/3); - glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,223/256);glVertex2f(0, 223); - glTexCoord2f(487/512,223/256); glVertex2f(487, 223); - glTexCoord2f(487/512,0);glVertex2f(487, 0); - glEnd; - - ESC_Alpha:=20; - if (RandomRange(0,20) > 18) and (ESC_Alpha=20) then - ESC_Alpha:=0 - else inc(ESC_Alpha); - if ESC_Alpha > 20 then ESC_Alpha:=20; - glColor4f(1, 1, 1, ESC_Alpha/20); - glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(800-310, 600-247); - glTexCoord2f(0,247/256);glVertex2f(800-310, 600); - glTexCoord2f(310/512,247/256); glVertex2f(800, 600); - glTexCoord2f(310/512,0);glVertex2f(800, 600-247); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - // outro scrollers? - // ... - end; - -{ // draw credits runtime counter - SetFontStyle (2); - SetFontItalic(False); - SetFontSize(9); - SetFontPos (5, 5); - glColor4f(1, 1, 1, 1); -// RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10); - RuntimeStr:='CTime: '+inttostr(CTime); - glPrint (Addr(RuntimeStr[1])); -} - - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, myTex); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(100, 100); - glTexCoord2f(0,1);glVertex2f(100, 200); - glTexCoord2f(1,1); glVertex2f(200, 200); - glTexCoord2f(1,0);glVertex2f(200, 100); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - - // make the stars shine - GoldenRec.Draw; -end; - -end. +unit UScreenCredits; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +uses + UMenu, + SDL, + SDL_Image, + UDisplay, + UTexture, + OpenGL12, + UMusic, + UFiles, + SysUtils, + UThemes, + ULCD, + ULight, + UGraphicClasses; + +type + TCreditsStages=(InitialDelay,Intro,MainPart,Outro); + + TScreenCredits = class(TMenu) + public + + Credits_X: Real; + Credits_Time: Cardinal; + Credits_Alpha: Cardinal; + CTime: Cardinal; + CTime_hold: Cardinal; + ESC_Alpha: Integer; + + credits_entry_tex: TTexture; + credits_entry_dx_tex: TTexture; + credits_bg_tex: TTexture; + credits_bg_ovl: TTexture; +// credits_bg_logo: TTexture; + credits_bg_scrollbox_left: TTexture; + credits_blindguard: TTexture; + credits_blindy: TTexture; + credits_canni: TTexture; + credits_commandio: TTexture; + credits_lazyjoker: TTexture; + credits_mog: TTexture; + credits_mota: TTexture; + credits_skillmaster: TTexture; + credits_whiteshark: TTexture; + intro_layer01: TTexture; + intro_layer02: TTexture; + intro_layer03: TTexture; + intro_layer04: TTexture; + intro_layer05: TTexture; + intro_layer06: TTexture; + intro_layer07: TTexture; + intro_layer08: TTexture; + intro_layer09: TTexture; + outro_bg: TTexture; + outro_esc: TTexture; + outro_exd: TTexture; + + deluxe_slidein: cardinal; + + CurrentScrollText: String; + NextScrollUpdate: Real; + EndofLastScrollingPart: Cardinal; + CurrentScrollStart, CurrentScrollEnd: Integer; + + CRDTS_Stage: TCreditsStages; + + myTex: glUint; + mysdlimage,myconvertedsdlimage: PSDL_Surface; + + Fadeout: boolean; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure DrawCredits; + procedure Draw_FunkyText; + end; + +const + Funky_Text: AnsiString = + 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+ + 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+ + 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+ + 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..'; + + + Timings: array[0..21] of Cardinal=( + 20, // 0 Delay vor Start + + 149, // 1 Ende erster Intro Zoom + 155, // 2 Start 2. Action im Intro + 170, // 3 Ende Separation im Intro + 271, // 4 Anfang Zoomout im Intro + 0, // 5 unused + 261, // 6 Start fade-to-white im Intro + + 271, // 7 Start Main Part + 280, // 8 Start On-Beat-Sternchen Main Part + + 396, // 9 Start BlindGuard + 666, // 10 Start blindy + 936, // 11 Start Canni + 1206, // 12 Start Commandio + 1476, // 13 Start LazyJoker + 1746, // 14 Start Mog + 2016, // 15 Start Mota + 2286, // 16 Start SkillMaster + 2556, // 17 Start WhiteShark + 2826, // 18 Ende Whiteshark + 3096, // 19 Start FadeOut Mainscreen + 3366, // 20 Ende Credits Tune + 60); // 21 start flare im intro + + + sdl32bpprgba: TSDL_Pixelformat=(palette: nil; + BitsPerPixel: 32; + BytesPerPixel: 4; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 24; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $ff000000; + colorkey: 0; + alpha: 255 ); + + +implementation + +uses {$IFDEF win32} + windows, + {$ELSE} + lclintf, + {$ENDIF} + ULog, + UGraphic, + UMain, + UIni, + USongs, + Textgl, + ULanguage, + UCommon, + Math, + dialogs; + + +function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + FadeTo(@ScreenMain); + AudioPlayback.PlaySound(SoundLib.Back); + end; +{ SDLK_SPACE: + begin + setlength(CTime_hold,length(CTime_hold)+1); + CTime_hold[high(CTime_hold)]:=CTime; + end; +} + end;//esac + end; //fi +end; + +constructor TScreenCredits.Create; +begin + inherited Create; + + credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0); + credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0); + + credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', 'PNG', 'Font Black', 0); + credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0); + credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0); + credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', 'PNG', 'Font Black', 0); + credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', 'PNG', 'Font Black', 0); + credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', 'Font Black', 0); + credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', 'PNG', 'Font Black', 0); + credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', 'PNG', 'Font Black', 0); + credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', 'PNG', 'Font Black', 0); + + intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', 'PNG', 'Transparent', 0); + intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', 'PNG', 'Transparent', 0); + intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', 'PNG', 'Transparent', 0); + intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', 'PNG', 'Transparent', 0); + intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', 'PNG', 'Transparent', 0); + intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', 'PNG', 'Transparent', 0); + intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', 'PNG', 'Transparent', 0); + intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', 'PNG', 'Transparent', 0); + intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', 'PNG', 'Transparent', 0); + + outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0); + outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0); + outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Transparent', 0); + + CRDTS_Stage:=InitialDelay; +end; + +function TScreenCredits.Draw: boolean; +begin + DrawCredits; + Draw:=true; +end; + +function pixfmt_eq(fmt1,fmt2: TSDL_Pixelformat): boolean; +begin + if (fmt1.BitsPerPixel = fmt2.BitsPerPixel) and + (fmt1.BytesPerPixel = fmt2.BytesPerPixel) and + (fmt1.Rloss = fmt2.Rloss) and + (fmt1.Gloss = fmt2.Gloss) and + (fmt1.Bloss = fmt2.Bloss) and + (fmt1.Rmask = fmt2.Rmask) and + (fmt1.Gmask = fmt2.Gmask) and + (fmt1.Bmask = fmt2.Bmask) and + (fmt1.Rshift = fmt2.Rshift) and + (fmt1.Gshift = fmt2.Gshift) and + (fmt1.Bshift = fmt2.Bshift) + then + pixfmt_eq:=True + else + pixfmt_eq:=False; +end; + +function inttohexstr(i: cardinal):pchar; +var helper, i2, c:cardinal; + tmpstr: string; +begin + helper:=0; + i2:=i; + tmpstr:=''; + for c:=1 to 8 do + begin + helper:=(helper shl 4) or (i2 and $f); + i2:=i2 shr 4; + end; + for c:=1 to 8 do + begin + i2:=helper and $f; + helper := helper shr 4; + case i2 of + 0: tmpstr:=tmpstr+'0'; + 1: tmpstr:=tmpstr+'1'; + 2: tmpstr:=tmpstr+'2'; + 3: tmpstr:=tmpstr+'3'; + 4: tmpstr:=tmpstr+'4'; + 5: tmpstr:=tmpstr+'5'; + 6: tmpstr:=tmpstr+'6'; + 7: tmpstr:=tmpstr+'7'; + 8: tmpstr:=tmpstr+'8'; + 9: tmpstr:=tmpstr+'9'; + 10: tmpstr:=tmpstr+'a'; + 11: tmpstr:=tmpstr+'b'; + 12: tmpstr:=tmpstr+'c'; + 13: tmpstr:=tmpstr+'d'; + 14: tmpstr:=tmpstr+'e'; + 15: tmpstr:=tmpstr+'f'; + end; + end; + inttohexstr:=pchar(tmpstr); +end; + +procedure TScreenCredits.onShow; +begin + CRDTS_Stage:=InitialDelay; + Credits_X := 580; + deluxe_slidein := 0; + Credits_Alpha := 0; + //Music.SetLoop(true); Loop looped ned, so ne scheisse + AudioPlayback.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! +// Music.Play; + CTime:=0; +// setlength(CTime_hold,0); + + mysdlimage:=IMG_Load('test.png'); + if assigned(mysdlimage) then + begin + {$IFNDEF FPC} + showmessage('opened image via SDL_Image'+#13#10+ + 'Width: '+inttostr(mysdlimage^.w)+#13#10+ + 'Height: '+inttostr(mysdlimage^.h)+#13#10+ + 'BitsPP: '+inttostr(mysdlimage^.format.BitsPerPixel)+#13#10+ + 'BytesPP: '+inttostr(mysdlimage^.format.BytesPerPixel)+#13#10+ + 'Rloss: '+inttostr(mysdlimage^.format.Rloss)+#13#10+ + 'Gloss: '+inttostr(mysdlimage^.format.Gloss)+#13#10+ + 'Bloss: '+inttostr(mysdlimage^.format.Bloss)+#13#10+ + 'Aloss: '+inttostr(mysdlimage^.format.Aloss)+#13#10+ + 'Rshift: '+inttostr(mysdlimage^.format.Rshift)+#13#10+ + 'Gshift: '+inttostr(mysdlimage^.format.Gshift)+#13#10+ + 'Bshift: '+inttostr(mysdlimage^.format.Bshift)+#13#10+ + 'Ashift: '+inttostr(mysdlimage^.format.Ashift)+#13#10+ + 'Rmask: '+inttohexstr(mysdlimage^.format.Rmask)+#13#10+ + 'Gmask: '+inttohexstr(mysdlimage^.format.Gmask)+#13#10+ + 'Bmask: '+inttohexstr(mysdlimage^.format.Bmask)+#13#10+ + 'Amask: '+inttohexstr(mysdlimage^.format.Amask)+#13#10+ + 'ColKey: '+inttostr(mysdlimage^.format.Colorkey)+#13#10+ + 'Alpha: '+inttostr(mysdlimage^.format.Alpha)); + + if pixfmt_eq(mysdlimage^.format^,sdl32bpprgba) then + showmessage('equal pixelformats') + else + showmessage('different pixelformats'); + {$ENDIF} + + myconvertedsdlimage:=SDL_ConvertSurface(mysdlimage,@sdl32bpprgba,SDL_SWSURFACE); + glGenTextures(1,@myTex); + glBindTexture(GL_TEXTURE_2D, myTex); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + glTexImage2D( GL_TEXTURE_2D, 0, 4, myconvertedsdlimage^.w, myconvertedsdlimage^.h, 0, + GL_RGBA, GL_UNSIGNED_BYTE, myconvertedsdlimage^.pixels ); + SDL_FreeSurface(mysdlimage); + SDL_FreeSurface(myconvertedsdlimage); + end + else + {$IFDEF FPC} + writeln( 'could not open file - test.png'); + {$ELSE} + showmessage('could not open file - test.png'); + {$ENDIF} + +end; + +procedure TScreenCredits.onHide; +begin + AudioPlayback.Stop; +end; + +Procedure TScreenCredits.Draw_FunkyText; +var + S: Integer; + X,Y,A: Real; + visibleText: PChar; +begin + SetFontSize(10); + //Init ScrollingText + if (CTime = Timings[7]) then + begin + //Set Position of Text + Credits_X := 600; + CurrentScrollStart:=1; + CurrentScrollEnd:=1; + end; + + if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then + begin + X:=0; + visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); + for S := 0 to length(visibleText)-1 do begin + Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); + SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); + A:=0; + if (Credits_X+X < 15) then A:=0; + if (Credits_X+X >=15) then A:=Credits_X+X-15; + if Credits_X+X > 32 then A:=17; + glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17); + glPrintLetter(visibleText[S]); + X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + end; + if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin + Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + inc(CurrentScrollStart); + end; + visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); + if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin + inc(CurrentScrollEnd); + end; + end; +{ // timing hack + X:=5; + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + glColor4f(1, 1, 1, 1); + for S:=0 to high(CTime_hold) do begin + visibleText:=pchar(inttostr(CTime_hold[S])); + SetFontPos (500, X); + glPrint (Addr(visibleText[0])); + X:=X+20; + end;} +end; + +procedure Start3D; +begin + glMatrixMode(GL_PROJECTION); + glPushMatrix; + glLoadIdentity; + glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity; +end; +procedure End3D; +begin + glMatrixMode(GL_PROJECTION); + glPopMatrix; + glMatrixMode(GL_MODELVIEW); +end; + +procedure TScreenCredits.DrawCredits; +var + T,I: Cardinal; + X: Real; + Ver: PChar; + RuntimeStr: AnsiString; + Data: TFFTData; + j,k,l:cardinal; + f,g,h: Real; + STime:cardinal; + Delay:cardinal; + + myPixel: longword; + myColor: Cardinal; + myScale: Real; + myAngle: Real; + + +const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24), + (154,31),(156,58),(168,32),(203,36), + (258,34),(251,50),(274,93),(294,84), + (232,54),(278,62),(319,34),(336,92), + (347,23),(374,32),(377,58),(361,83), + (385,91),(405,91),(429,35),(423,51), + (450,32),(485,34),(444,91),(486,93)); + +begin + //dis does teh muiwk y0r + AudioPlayback.GetFFTData(Data); + + Log.LogStatus('',' JB-1'); + + T := GetTickCount div 33; + if T <> Credits_Time then + begin + Credits_Time := T; + inc(CTime); + inc(CTime_hold); + Credits_X := Credits_X-2; + + Log.LogStatus('',' JB-2'); + if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then + begin +// CTime:=Timings[20]; +// CRDTS_Stage:=Outro; + + CRDTS_Stage:=Intro; + CTime:=0; + AudioPlayback.Play; + + end; + if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then + begin + CRDTS_Stage:=MainPart; + end; + if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then + begin + CRDTS_Stage:=Outro; + end; + end; + + Log.LogStatus('',' JB-3'); + + //draw background + if CRDTS_Stage=InitialDelay then + begin + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end + else + if CRDTS_Stage=Intro then + begin + Start3D; + glPushMatrix; + + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + if CTime < Timings[1] then begin + myScale:= 0.5+0.5*(Timings[1]-CTime)/(Timings[1]); // slowly move layers together + myAngle:=cos((CTime)*pi/((Timings[1])*2)); // and make logo face towards camera + end else begin // this is the part when the logo stands still + myScale:=0.5; + myAngle:=0; + end; + if CTime > Timings[2] then begin + myScale:= 0.5+0.5*(CTime-Timings[2])/(Timings[3]-Timings[2]); // get some space between layers + myAngle:=0; + end; +// if CTime > Timings[3] then myScale:=1; // keep the space between layers + glTranslatef(0,0,-5+0.5*myScale); + if CTime > Timings[3] then myScale:=1; // keep the space between layers + if CTime > Timings[3] then begin // make logo rotate left and grow +// myScale:=(CTime-Timings[4])/(Timings[7]-Timings[4]); + glRotatef(20*sqr(CTime-Timings[3])/sqr((Timings[7]-Timings[3])/2),0,0,1); + glScalef(1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1); + end; + if CTime < Timings[2] then + glRotatef(30*myAngle,0.5*myScale+myScale,1+myScale,0); +// glScalef(0.5,0.5,0.5); + glScalef(4/3,-1,1); + glColor4f(1, 1, 1, 1); + + glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.4 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.4 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.4 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.4 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.22 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.22 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.22 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.22 * myScale); + glEnd; + gldisable(gl_texture_2d); + glDisable(GL_BLEND); + + glPopMatrix; + End3D; + + // do some sparkling effects + if (CTime < Timings[1]) and (CTime > Timings[21]) then + begin + for k:=1 to 3 do begin + l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5); + j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301); + GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0); + end; + end; + + // fade to white at end + if Ctime > Timings[6] then + begin + glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + + end; + if (CRDTS_Stage=MainPart) then + // main credits screen background, scroller, logo and girl + begin + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // draw scroller + Draw_FunkyText; + +//######################################################################### +// draw credits names + + +Log.LogStatus('',' JB-4'); + +// BlindGuard (von links oben reindrehen, nach rechts unten rausdrehen) + STime:=Timings[9]-10; + Delay:=Timings[10]-Timings[9]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(0,329,0); + if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end; + gltranslatef(223,0,0); + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + gltranslatef(223,0,0); + glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1); + gltranslatef(-223,0,0); + end; + glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Blindy (zoom von 0 auf volle grösse und drehung, zoom auf doppelte grösse und nach rechts oben schieben) + STime:=Timings[10]-10; + Delay:=Timings[11]-Timings[10]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+20) and (CTime<=STime+22) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+20 then begin + j:=CTime-Stime; + glscalef(j*j/400,j*j/400,j*j/400); + glrotatef(j*18.0,0,0,1); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(f*3,-f,0); + glscalef(1+j/10,1+j/10,1+j/10); + glrotatef(j*9.0,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Canni (von links reinschieben, nach rechts oben rausschieben) + STime:=Timings[11]-10; + Delay:=Timings[12]-Timings[11]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(((CTime-STime)*21.0)-210,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=(CTime-(STime+Delay-10))*21; + gltranslatef(j,-j/2,0); + end; + glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Commandio (von unten reinklappen, nach rechts oben rausklappen) + STime:=Timings[12]-10; + Delay:=Timings[13]-Timings[12]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=258.0-25.8*(CTime-STime) + else + f:=0; + g:=0; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end; + glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163+g-f*1.5, -129+f*1.5-g/2); + glTexCoord2f(0,1);glVertex2f(-163+g*1.5, 129-(g*1.5*258/326)); + glTexCoord2f(1,1); glVertex2f(163+g, 129+g/4); + glTexCoord2f(1,0);glVertex2f(163+f*1.5+g/4, -129+f*1.5-g/4); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing) + STime:=Timings[13]-35; + Delay:=Timings[14]-Timings[13]+5; + if CTime > STime then + begin + k:=0; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20; + ESC_Alpha:=10; + f:=CTime-STime; + if CTime <=STime+40 then j:=CTime-STime else j:=40; + if (CTime >=STime+Delay-40) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j*j/1600); + + glPushMatrix; + gltranslatef(180+(f-70),329,0); + glBindTexture(GL_TEXTURE_2D, credits_lazyjoker.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Mog (von links reinklappen, nach rechts unten rausklappen) + STime:=Timings[14]-10; + Delay:=Timings[15]-Timings[14]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) + else + f:=0; + + g:=0; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end; + glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163+g*1.5, -129+g*1.5); + glTexCoord2f(0,1);glVertex2f(-163+g*1.2, 129+g); + glTexCoord2f(1,1); glVertex2f(163-f+g/2, 129+f*1.5+g/4); + glTexCoord2f(1,0);glVertex2f(163-f+g*1.5, -129-f*1.5); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Mota (von rechts oben reindrehen, nach links unten rausschieben und verkleinern und dabei drehen) + STime:=Timings[15]-10; + Delay:=Timings[16]-Timings[15]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(223,0,0); + glrotatef((10-(CTime-STime))*9,0,0,1); + gltranslatef(-223,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(-f*2,-f,0); + glscalef(1-j/10,1-j/10,1-j/10); + glrotatef(-j*9.0,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Skillmaster (von rechts unten reinschieben, nach rechts oben rausdrehen) + STime:=Timings[16]-10; + Delay:=Timings[17]-Timings[16]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + j:=STime+10-CTime; + f:=j*10.0; + gltranslatef(+f*2,+f/2,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + gltranslatef(0,-223,0); + glrotatef(integer(j)*-9,0,0,1); + gltranslatef(0,223,0); + glrotatef(j*9,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// WhiteShark (von links unten reinklappen, nach rechts oben rausklappen) + STime:=Timings[17]-10; + Delay:=Timings[18]-Timings[17]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) + else + f:=0; + + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end else + g:=0; + glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2); + glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4); + glTexCoord2f(1,1); glVertex2f(163-f*1.2+g/4, 129+f/2-g/4); + glTexCoord2f(1,0);glVertex2f(163-f*1.5+g/4, -129+f*1.5+g/4); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + + + Log.LogStatus('',' JB-103'); + +// #################################################################### +// do some twinkle stuff (kinda on beat) + if (CTime > Timings[8] ) and + (CTime < Timings[19] ) then + begin + k := 0; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + if Data[k]>0.2 then + begin + l := RandomRange(6,16); + j := RandomRange(0,27); + + GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); + end; + end; + +//################################################# +// draw the rest of the main screen (girl and logo + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(800-393, 0); + glTexCoord2f(0,600/1024);glVertex2f(800-393, 600); + glTexCoord2f(393/512,600/1024); glVertex2f(800, 600); + glTexCoord2f(393/512,0);glVertex2f(800, 0); + glEnd; +{ glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,112/128);glVertex2f(0, 112); + glTexCoord2f(497/512,112/128); glVertex2f(497, 112); + glTexCoord2f(497/512,0);glVertex2f(497, 0); + glEnd; +} + gldisable(gl_texture_2d); + glDisable(GL_BLEND); + + // fade out at end of main part + if Ctime > Timings[19] then + begin + glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + end + else + if (CRDTS_Stage=Outro) then + begin + if CTime=Timings[20] then begin + CTime_hold:=0; + AudioPlayback.Stop; + AudioPlayback.Open(soundpath + 'credits-outro-tune.mp3'); + AudioPlayback.Play; + AudioPlayback.SetVolume(20); + AudioPlayback.SetLoop(True); + end; + if CTime_hold > 231 then begin + AudioPlayback.Play; + Ctime_hold:=0; + end; + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + // do something useful + // outro background + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); + glEnd; + + //outro overlays + glColor4f(1, 1, 1, (1+sin(CTime/15))/3+1/3); + glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,223/256);glVertex2f(0, 223); + glTexCoord2f(487/512,223/256); glVertex2f(487, 223); + glTexCoord2f(487/512,0);glVertex2f(487, 0); + glEnd; + + ESC_Alpha:=20; + if (RandomRange(0,20) > 18) and (ESC_Alpha=20) then + ESC_Alpha:=0 + else inc(ESC_Alpha); + if ESC_Alpha > 20 then ESC_Alpha:=20; + glColor4f(1, 1, 1, ESC_Alpha/20); + glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(800-310, 600-247); + glTexCoord2f(0,247/256);glVertex2f(800-310, 600); + glTexCoord2f(310/512,247/256); glVertex2f(800, 600); + glTexCoord2f(310/512,0);glVertex2f(800, 600-247); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // outro scrollers? + // ... + end; + +{ // draw credits runtime counter + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (5, 5); + glColor4f(1, 1, 1, 1); +// RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10); + RuntimeStr:='CTime: '+inttostr(CTime); + glPrint (Addr(RuntimeStr[1])); +} + + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, myTex); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(100, 100); + glTexCoord2f(0,1);glVertex2f(100, 200); + glTexCoord2f(1,1); glVertex2f(200, 200); + glTexCoord2f(1,0);glVertex2f(200, 100); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + + // make the stars shine + GoldenRec.Draw; +end; + +end. diff --git a/Game/Code/Screens/UScreenEdit.pas b/Game/Code/Screens/UScreenEdit.pas index 49adb994..00feddbf 100644 --- a/Game/Code/Screens/UScreenEdit.pas +++ b/Game/Code/Screens/UScreenEdit.pas @@ -38,7 +38,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenMain); // Result := false; end; @@ -46,7 +46,7 @@ begin begin if Interaction = 0 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenEditConvert); end; // if Interaction = 1 then begin @@ -56,7 +56,7 @@ begin if Interaction = 1 then begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenMain); end; end; diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index a523afd2..304c2259 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -121,7 +121,7 @@ begin {$IFDEF UseMIDIPort} MidiFile.StopPlaying; {$ENDIF} - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenEdit); end; @@ -129,7 +129,7 @@ begin begin if Interaction = 0 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); ScreenOpen.BackScreen := @ScreenEditConvert; FadeTo(@ScreenOpen); end; diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 57d6777e..4d971c63 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -1277,7 +1277,7 @@ begin for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then begin - AudioPlayback.PlayClick; + AudioPlayback.PlaySound(SoundLib.Click); LastClick := AktBeat; end; end; diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas index e5deb6ba..16e24027 100644 --- a/Game/Code/Screens/UScreenLevel.pas +++ b/Game/Code/Screens/UScreenLevel.pas @@ -38,7 +38,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenName); end; @@ -46,7 +46,7 @@ begin begin Ini.Difficulty := Interaction; Ini.SaveLevel; - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); //Set Standard Mode ScreenSong.Mode := smNormal; FadeTo(@ScreenSong); diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index a4dc5f0d..5824d9fe 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -94,7 +94,7 @@ begin //Credits_Y := 600; //Credits_Alpha := 0; //Credits_Visible := True; - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenCredits); end; end; @@ -102,20 +102,20 @@ begin begin if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenPartyOptions); end; end; SDLK_S: begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenStatMain); end; SDLK_E: begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenEdit); end; @@ -126,7 +126,7 @@ begin begin if (Songs.SongList.Count >= 1) then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1; if (Ini.Players = 4) then PlayersPlay := 6; @@ -144,7 +144,7 @@ begin begin if (Length(DLLMan.Plugins)>=1) then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenPartyOptions); end else //show error message, No Plugins Loaded @@ -157,21 +157,21 @@ begin //Stats if Interaction = 2 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenStatMain); end; //Editor if Interaction = 3 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenEdit); end; //Options if Interaction = 4 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenOptions); end; diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index 76e79a3b..f33d6409 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -158,7 +158,7 @@ begin SDLK_ESCAPE : begin Ini.SaveNames; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); if GoTo_SingScreen then FadeTo(@ScreenSong) else @@ -170,7 +170,7 @@ begin for I := 1 to 6 do Ini.Name[I-1] := Button[I-1].Text[0].Text; Ini.SaveNames; - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); if GoTo_SingScreen then FadeTo(@ScreenSing) diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index 30404d6e..5d78fb31 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -59,7 +59,7 @@ begin begin //Empty Filename and go to last Screen FileName := ''; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(BackScreen); end; @@ -68,14 +68,14 @@ begin if (Interaction = 2) then begin //Update Filename and go to last Screen FileName := Text[TextN].Text; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(BackScreen); end else if (Interaction = 1) then begin //Empty Filename and go to last Screen FileName := ''; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(BackScreen); end; end; diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas index bcd781cc..4e39fe21 100644 --- a/Game/Code/Screens/UScreenOptions.pas +++ b/Game/Code/Screens/UScreenOptions.pas @@ -38,57 +38,57 @@ begin SDLK_BACKSPACE : begin Ini.Save; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenMain); end; SDLK_RETURN: begin if SelInteraction = 0 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenOptionsGame); end; if SelInteraction = 1 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenOptionsGraphics); end; if SelInteraction = 2 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenOptionsSound); end; if SelInteraction = 3 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenOptionsLyrics); end; if SelInteraction = 4 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenOptionsThemes); end; if SelInteraction = 5 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenOptionsRecord); end; if SelInteraction = 6 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenOptionsAdvanced); end; if SelInteraction = 7 then begin Ini.Save; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenMain); end; end; diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index 0d40b7ec..e2c30bf1 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -34,7 +34,7 @@ begin SDLK_BACKSPACE : begin Ini.Save; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; SDLK_RETURN: @@ -43,7 +43,7 @@ begin //if SelInteraction = 7 then begin if SelInteraction = 6 then begin Ini.Save; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; end; @@ -56,7 +56,7 @@ begin //SelectLoadAnimation Hidden because it is useless atm //if (SelInteraction >= 0) and (SelInteraction <= 6) then begin if (SelInteraction >= 0) and (SelInteraction <= 5) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractInc; end; end; @@ -65,7 +65,7 @@ begin //SelectLoadAnimation Hidden because it is useless atm //if (SelInteraction >= 0) and (SelInteraction <= 6) then begin if (SelInteraction >= 0) and (SelInteraction <= 5) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index 6cd0a20c..15b538a5 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -35,14 +35,14 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); RefreshSongs; FadeTo(@ScreenOptions); end; SDLK_RETURN: begin if SelInteraction = 6 then begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); RefreshSongs; FadeTo(@ScreenOptions); end; @@ -55,7 +55,7 @@ begin begin if (SelInteraction >= 0) and (SelInteraction <= 5) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractInc; end; end; @@ -63,7 +63,7 @@ begin begin if (SelInteraction >= 0) and (SelInteraction <= 5) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index 947d506b..4ceeeb32 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -34,7 +34,7 @@ begin SDLK_BACKSPACE : begin Ini.Save; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; SDLK_RETURN: @@ -44,7 +44,7 @@ begin end;} if SelInteraction = 5 then begin Ini.Save; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; end; @@ -55,14 +55,14 @@ begin SDLK_RIGHT: begin if (SelInteraction >= 0) and (SelInteraction <= 4) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractInc; end; end; SDLK_LEFT: begin if (SelInteraction >= 0) and (SelInteraction <= 4) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas index 8d70eec9..7275efed 100644 --- a/Game/Code/Screens/UScreenOptionsLyrics.pas +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -34,14 +34,14 @@ begin SDLK_BACKSPACE : begin Ini.Save; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; SDLK_RETURN: begin if SelInteraction = 3 then begin Ini.Save; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; end; @@ -52,14 +52,14 @@ begin SDLK_RIGHT: begin if (SelInteraction >= 0) and (SelInteraction <= 2) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractInc; end; end; SDLK_LEFT: begin if (SelInteraction >= 0) and (SelInteraction <= 2) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index 65d016c7..130c3551 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -1,212 +1,232 @@ -unit UScreenOptionsRecord; - -interface - -{$I switches.inc} - -uses - UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; - -type - TScreenOptionsRecord = class(TMenu) - private - SelectSlideInput: integer; - SelectSlideChannelL: integer; - SelectSlideChannelR: integer; - public - constructor Create; override; - function Draw: boolean; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - procedure onShow; override; - procedure onHide; override; - procedure UpdateCard; - end; - -implementation - -uses SysUtils, - UGraphic, - URecord, - UDraw, - UMain, - ULog; - -function TScreenOptionsRecord.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; - AudioPlayback.PlayBack; - FadeTo(@ScreenOptions); - end; - SDLK_RETURN: - begin - if SelInteraction = 5 then begin - Ini.Save; - AudioPlayback.PlayBack; - FadeTo(@ScreenOptions); - end; - end; - SDLK_DOWN: - InteractNext; - SDLK_UP : - InteractPrev; - SDLK_RIGHT: - begin - if (SelInteraction >= 0) and (SelInteraction <= 4) then begin - AudioPlayback.PlayOption; - InteractInc; - end; -// if SelInteraction = 0 then UpdateCard; - UpdateCard; - end; - SDLK_LEFT: - begin - if (SelInteraction >= 0) and (SelInteraction <= 4) then begin - AudioPlayback.PlayOption; - InteractDec; - end; - UpdateCard; -// if SelInteraction = 0 then UpdateCard; - end; - end; - end; -end; - -constructor TScreenOptionsRecord.Create; -var - I: integer; - SC: integer; - SCI: integer; -begin - inherited Create; - - LoadFromTheme(Theme.OptionsRecord); - - SetLength(ICard, Length(AudioInputProcessor.SoundCard)); - for SC := 0 to High(AudioInputProcessor.SoundCard) do - ICard[SC] := AudioInputProcessor.SoundCard[SC].Description; - - if (Length(AudioInputProcessor.SoundCard) > 0) then - begin - SetLength(IInput, Length(AudioInputProcessor.SoundCard[Ini.Card].Input)); - for SCI := 0 to High(AudioInputProcessor.SoundCard[Ini.Card].Input) do - IInput[SCI] := AudioInputProcessor.SoundCard[Ini.Card].Input[SCI].Name; - - - AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, Ini.Card, ICard); - - SelectSlideInput := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, Ini.CardList[0].Input, IInput); - SelectSlideChannelL := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelL, Ini.CardList[0].ChannelL, IChannel); - SelectSlideChannelR := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelR, Ini.CardList[0].ChannelR, IChannel); - - AddSelect(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost); - end; - - AddButton(Theme.OptionsRecord.ButtonExit); - if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[7]); - - Interaction := 0; -end; - -procedure TScreenOptionsRecord.onShow; -begin - Interaction := 0; - writeln( 'AudioInput.CaptureStart') ; - - PlayersPlay := 2; // TODO : This needs fixing - AudioInput.CaptureStart; - -end; - -procedure TScreenOptionsRecord.onHide; -begin - AudioInput.CaptureStop; -end; - -procedure TScreenOptionsRecord.UpdateCard; -var - SC: integer; - SCI: integer; -begin - writeln( 'Update Card') ; - AudioInput.CaptureStop; - try - SC := Ini.Card; - // if SC = 1 then beep; - - SetLength(IInput, Length(AudioInputProcessor.SoundCard[SC].Input)); - for SCI := 0 to High(AudioInputProcessor.SoundCard[SC].Input) do begin - IInput[SCI] := AudioInputProcessor.SoundCard[SC].Input[SCI].Name; - // Log.LogError(IInput[SCI]); - end; - - - UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideInput, SelectSlideInput, IInput, Ini.CardList[SC].Input); - UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelL, SelectSlideChannelL, IChannel, Ini.CardList[SC].ChannelL); - UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelR, SelectSlideChannelR, IChannel, Ini.CardList[SC].ChannelR); - - finally - AudioInput.CaptureStart; - end; -end; - -function TScreenOptionsRecord.Draw: boolean; -begin - DrawBG; - DrawFG; - - // TODO : this needs to be positioned correctly - if PlayersPlay = 1 then - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - - if PlayersPlay = 2 then begin - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); - end; - if ScreenAct = 2 then begin - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 2); - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 3); - end; - end; - - if PlayersPlay = 3 then begin - SingDrawOscilloscope(75 + 10*ScreenX, 95, 100, 20, 0); - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 0); - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); - end; - if ScreenAct = 2 then begin - SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 3); - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 4); - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 5); - end; - end; - - Result := True; -end; - - -end. +unit UScreenOptionsRecord; + +interface + +{$I switches.inc} + +uses + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; + +type + TScreenOptionsRecord = class(TMenu) + private + Card: integer; // current input device + + SelectSlideInput: integer; + SelectSlideChannelL: integer; + SelectSlideChannelR: integer; + public + constructor Create; override; + function Draw: boolean; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure UpdateCard; + end; + +implementation + +uses SysUtils, + UGraphic, + URecord, + UDraw, + UMain, + ULog; + +function TScreenOptionsRecord.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; + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 5 then begin + Ini.Save; + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 4) then begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractInc; + end; +// if SelInteraction = 0 then UpdateCard; + UpdateCard; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 4) then begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractDec; + end; + UpdateCard; +// if SelInteraction = 0 then UpdateCard; + end; + end; + end; +end; + +constructor TScreenOptionsRecord.Create; +var + SC: integer; + SCI: integer; + InputDevice: TAudioInputDevice; + InputDeviceCfg: PInputDeviceConfig; +begin + inherited Create; + + Card := 0; + + LoadFromTheme(Theme.OptionsRecord); + + SetLength(ICard, Length(AudioInputProcessor.Device)); + for SC := 0 to High(AudioInputProcessor.Device) do + ICard[SC] := AudioInputProcessor.Device[SC].Description; + + if (Card > High(AudioInputProcessor.Device)) then + Card := 0; + + if (Length(AudioInputProcessor.Device) > 0) then + begin + InputDevice := AudioInputProcessor.Device[Card]; + InputDeviceCfg := @Ini.InputDeviceConfig[InputDevice.CfgIndex]; + + SetLength(IInput, Length(InputDevice.Source)); + for SCI := 0 to High(InputDevice.Source) do + IInput[SCI] := InputDevice.Source[SCI].Name; + + AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, Card, ICard); + + SelectSlideInput := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, + InputDeviceCfg^.Input, IInput); + SelectSlideChannelL := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelL, + InputDeviceCfg^.ChannelToPlayerMap[0], IChannel); + SelectSlideChannelR := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelR, + InputDeviceCfg^.ChannelToPlayerMap[1], IChannel); + + AddSelect(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost); + end; + + AddButton(Theme.OptionsRecord.ButtonExit); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[7]); + + Interaction := 0; +end; + +procedure TScreenOptionsRecord.onShow; +begin + Interaction := 0; + writeln( 'AudioInput.CaptureStart') ; + + PlayersPlay := 2; // TODO : This needs fixing + AudioInput.CaptureStart; + +end; + +procedure TScreenOptionsRecord.onHide; +begin + AudioInput.CaptureStop; +end; + +procedure TScreenOptionsRecord.UpdateCard; +var + SourceIndex: integer; + InputDevice: TAudioInputDevice; + InputDeviceCfg: PInputDeviceConfig; +begin + Log.LogStatus('Update input-device', 'TScreenOptionsRecord.UpdateCard') ; + + AudioInput.CaptureStop; + + if (Card > High(AudioInputProcessor.Device)) then + Card := 0; + + if (Length(AudioInputProcessor.Device) > 0) then + begin + InputDevice := AudioInputProcessor.Device[Card]; + InputDeviceCfg := @Ini.InputDeviceConfig[InputDevice.CfgIndex]; + + SetLength(IInput, Length(InputDevice.Source)); + for SourceIndex := 0 to High(InputDevice.Source) do begin + IInput[SourceIndex] := InputDevice.Source[SourceIndex].Name; + end; + + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideInput, SelectSlideInput, IInput, + InputDeviceCfg^.Input); + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelL, SelectSlideChannelL, IChannel, + InputDeviceCfg^.ChannelToPlayerMap[0]); + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelR, SelectSlideChannelR, IChannel, + InputDeviceCfg^.ChannelToPlayerMap[1]); + end; + + AudioInput.CaptureStart; +end; + +function TScreenOptionsRecord.Draw: boolean; +begin + DrawBG; + DrawFG; + + // TODO : this needs to be positioned correctly + if PlayersPlay = 1 then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + + if PlayersPlay = 2 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + if ScreenAct = 2 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 2); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 3); + end; + end; + + if PlayersPlay = 3 then begin + SingDrawOscilloscope(75 + 10*ScreenX, 95, 100, 20, 0); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 0); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + if ScreenAct = 2 then begin + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 3); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 4); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 5); + end; + end; + + Result := True; +end; + + +end. diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index 64a0413f..da5c6e90 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -34,14 +34,14 @@ begin SDLK_BACKSPACE : begin Ini.Save; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; SDLK_RETURN: begin if SelInteraction = 6 then begin Ini.Save; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; end; @@ -52,14 +52,14 @@ begin SDLK_RIGHT: begin if (SelInteraction >= 0) and (SelInteraction <= 6) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractInc; end; end; SDLK_LEFT: begin if (SelInteraction >= 0) and (SelInteraction <= 6) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index 114a5e45..239f98fe 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -53,7 +53,7 @@ begin UGraphic.UnLoadScreens(); UGraphic.LoadScreens(); - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; SDLK_RETURN: @@ -67,7 +67,7 @@ begin UGraphic.UnLoadScreens(); UGraphic.LoadScreens(); - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; end; @@ -79,7 +79,7 @@ begin begin if (SelInteraction >= 0) and (SelInteraction <= 2) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractInc; end; end; @@ -87,7 +87,7 @@ begin begin if (SelInteraction >= 0) and (SelInteraction <= 2) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 2f07dcb0..198708cc 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -101,13 +101,13 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); end; SDLK_RETURN: begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); if DLLMan.Selected.LoadSong then begin //Select PartyMode ScreenSong diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index c8cb2bb5..1b5cf976 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -66,7 +66,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenMain); end; @@ -125,7 +125,7 @@ begin // to-do : Party //PartySession.StartNewParty(Rounds + 2); - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); //Go to Player Screen FadeTo(@ScreenPartyPlayer); end; @@ -137,7 +137,7 @@ begin SDLK_UP: InteractPrev; SDLK_RIGHT: begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractInc; //Change Playlist2 if Playlist is Changed @@ -152,7 +152,7 @@ begin end; SDLK_LEFT: begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractDec; //Change Playlist2 if Playlist is Changed diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index 3bd33a5c..68f76952 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -186,7 +186,7 @@ begin SDLK_ESCAPE: begin Ini.SaveNames; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenPartyOptions); end; diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index 6215e65a..6b21323b 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -59,7 +59,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); {if (PartySession.CurRound < High(PartySession.Rounds)) then FadeTo(@ScreenPartyNewRound) else // to-do : Party @@ -71,7 +71,7 @@ begin SDLK_RETURN: begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); // to-do : Party {if (PartySession.CurRound < High(PartySession.Rounds)) then FadeTo(@ScreenPartyNewRound) diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas index d8a3bd71..5960db06 100644 --- a/Game/Code/Screens/UScreenPartyWin.pas +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -52,13 +52,13 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenMain); end; SDLK_RETURN: begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenMain); end; end; diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 5216477d..6a5b4e90 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -153,7 +153,7 @@ begin //Sound[0].BufferLong Finish; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenScore); end; diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 7d2eba07..ed827ec8 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -75,6 +75,16 @@ type //procedure Pause; //Pause Mod(Toggles Pause) end; +type + TCustomSoundEntry = record + Filename : String; + Stream : TAudioPlaybackStream; + end; + +var + //Custom Sounds + CustomSounds: array of TCustomSoundEntry; + //Procedured for Plugin function LoadTex (const Name, Typ: PChar): TsmallTexture; stdcall; //function Translate (const Name: PChar): PChar; stdcall; @@ -101,7 +111,7 @@ begin SDLK_BACKSPACE : begin Finish; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenPartyScore); end; @@ -656,14 +666,34 @@ begin end; function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound +var + S: TAudioPlaybackStream; + I: Integer; + F: String; begin - Result := AudioPlayback.LoadCustomSound(String(Name)); + //Search for Sound in already loaded Sounds + F := UpperCase(SoundPath + FileName); + For I := 0 to High(CustomSounds) do + begin + if (UpperCase(CustomSounds[I].Filename) = F) then + begin + Result := I; + Exit; + end; + end; + + S := AudioPlayback.OpenSound(SoundPath + String(Name)); + if (S <> nil) then + Result := High(CustomSounds) + else + Result := 0; end; procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound begin - AudioPlayback.PlayCustomSound(Index); + if (Index <= High(CustomSounds)) then + AudioPlayback.PlaySound(CustomSounds[Index].Stream); end; end. ->>>>>>> .r429 + diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 4773cdac..3be0be84 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -29,6 +29,11 @@ uses type TScreenSong = class(TMenu) + private + EqualizerData: TFFTData; // moved here to avoid stack overflows + EqualizerBands: array of Byte; + EqualizerTime: Cardinal; + EqualizerTime2: Byte; public TextArtist: integer; TextTitle: integer; @@ -52,10 +57,6 @@ type is_jump: boolean; // Jump to Song Mod is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title - EqualizerBands: array of Byte; - EqualizerTime: Cardinal; - EqualizerTime2: Byte; - //Party Mod Mode: TSingMode; @@ -270,7 +271,7 @@ begin begin SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - AudioPlayback.PlayChange; + AudioPlayback.PlaySound(SoundLib.Change); ChangeMusic; SetScroll4; @@ -291,7 +292,7 @@ begin begin SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - AudioPlayback.PlayChange; + AudioPlayback.PlaySound(SoundLib.Change); ChangeMusic; SetScroll4; @@ -369,7 +370,7 @@ begin else begin AudioPlayback.Stop; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenMain); end; @@ -379,7 +380,7 @@ begin //When in party Mode then Ask before Close else if (Mode = smPartyMode) then begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); end; end; @@ -504,7 +505,7 @@ begin FixSelected; //Play Music: - AudioPlayback.PlayChange; + AudioPlayback.PlaySound(SoundLib.Change); ChangeMusic; end; @@ -547,7 +548,7 @@ begin FixSelected; //Play Music: - AudioPlayback.PlayChange; + AudioPlayback.PlaySound(SoundLib.Change); ChangeMusic; end; end; @@ -559,7 +560,7 @@ begin begin if (Songs.SongList.Count > 0) AND (Mode = smNormal) then begin - AudioPlayback.PlayChange; + AudioPlayback.PlaySound(SoundLib.Change); SelectNext; // InteractNext; // SongTarget := Interaction; @@ -573,7 +574,7 @@ begin SDLK_LEFT: begin if (Songs.SongList.Count > 0)AND (Mode = smNormal) then begin - AudioPlayback.PlayChange; + AudioPlayback.PlaySound(SoundLib.Change); SelectPrev; ChangeMusic; SetScroll4; @@ -655,7 +656,7 @@ begin begin SkipTo(Random(CatSongs.VisibleSongs)); end; - AudioPlayback.PlayChange; + AudioPlayback.PlaySound(SoundLib.Change); ChangeMusic; SetScroll4; @@ -1804,7 +1805,6 @@ end; procedure TScreenSong.DrawEqualizer; var - Data: TFFTData; //Audio Data I, J: Integer; Res: byte; A, B: Integer; @@ -1822,7 +1822,7 @@ begin if (A <> EqualizerTime) then begin EqualizerTime := A; - Data := AudioPlayback.GetFFTData; + AudioPlayback.GetFFTData(EqualizerData); B := 0; Pos := 0; @@ -1850,23 +1850,23 @@ begin end; if I > 35 then - Data[i] := Data[i] * 8 + EqualizerData[i] := EqualizerData[i] * 8 else if I > 11 then - Data[i] := Data[i] * 4.5 + EqualizerData[i] := EqualizerData[i] * 4.5 else - Data[i] := Data[i] * 1.1; + EqualizerData[i] := EqualizerData[i] * 1.1; - if (Data[i] >= 1) then - Data[i] := 0.9999999999999; + if (EqualizerData[i] >= 1) then + EqualizerData[i] := 0.9999999999999; try if ( assigned( Theme ) ) AND ( assigned( Theme.Song ) ) AND - ( i < length( Data ) ) THEN + ( i < length( EqualizerData ) ) THEN begin - if single( Data[i] ) > 1 then + if single( EqualizerData[i] ) > 1 then begin - lTmp := Single(Data[i]) * Theme.Song.Equalizer.Length; + lTmp := Single(EqualizerData[i]) * Theme.Song.Equalizer.Length; if lTmp > Pos then Pos := lTmp; end; @@ -1874,7 +1874,7 @@ begin except {$IFDEF FPC} on E:EInvalidOp do - writeln( 'UScreenSong - DOH !!!! ('+inttostr(i)+' '+ inttostr( integer( Data[i] ) )+' * '+ ')' ); + writeln( 'UScreenSong - DOH !!!! ('+inttostr(i)+' '+ inttostr( integer( EqualizerData[i] ) )+' * '+ ')' ); {$ENDIF} end @@ -1989,7 +1989,7 @@ begin end; end; - AudioPlayback.PlayChange; + AudioPlayback.PlaySound(SoundLib.Change); ChangeMusic; SetScroll; UpdateLCD; @@ -2129,7 +2129,7 @@ begin if (Songs.SongList.Count > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = smNormal) then begin AudioPlayback.Stop; - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); ScreenEditSub.Path := CatSongs.Song[Interaction].Path; ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName; FadeTo(@ScreenEditSub); diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 14228964..dfa90009 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -67,7 +67,7 @@ begin SDLK_ESCAPE: begin Visible := False; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); if (VisSongs = 0) AND (Length(Button[0].Text[0].Text) > 0) then begin ScreenSong.UnLoadDetailedCover; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 88b0de32..ae0bc9ba 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -96,7 +96,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); Visible := False; end; diff --git a/Game/Code/Screens/UScreenStatDetail.pas b/Game/Code/Screens/UScreenStatDetail.pas index 414055f9..d793baf0 100644 --- a/Game/Code/Screens/UScreenStatDetail.pas +++ b/Game/Code/Screens/UScreenStatDetail.pas @@ -53,7 +53,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenStatMain); end; SDLK_RETURN: @@ -76,7 +76,7 @@ begin end; if Interaction = 3 then begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenStatMain); end; end; 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 From d22d5070d1b847611786ca483055ea7348cda132 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 21:33:30 +0000 Subject: cleanup git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@828 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 6a5b4e90..2342d371 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -325,6 +325,8 @@ var NR: TRecR; //Line Bonus Mod Color: TRGB; + + success: boolean; begin Log.LogStatus('Begin', 'onShow'); FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented @@ -433,34 +435,30 @@ begin {Static[StaticP3RScoreBG].Visible := V3R; Text[TextP3RScore].Visible := V3R; } + // FIXME: sets Path and Filename to '' ResetSingTemp; -// Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); + CurrentSong := CatSongs.Song[CatSongs.Selected]; + // FIXME: bad style, put the try-except into LoadSong() and not here try - if not CurrentSong.LoadSong then -// if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName) then - begin - //Error Loading Song -> Go back to Song Screen and Show some Error Message - FadeTo(@ScreenSong); - //Select New Song in Party Mode - if ScreenSong.Mode = smPartyMode then - ScreenSong.SelectRandomSong; - ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); - Exit; - end; + success := CurrentSong.LoadSong(); except + success := false; + end; + if (not success) then + begin //Error Loading Song -> Go back to Song Screen and Show some Error Message FadeTo(@ScreenSong); //Select New Song in Party Mode if ScreenSong.Mode = smPartyMode then - ScreenSong.SelectRandomSong; + ScreenSong.SelectRandomSong(); ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); + // FIXME: do we need this? + CurrentSong.Path := CatSongs.Song[CatSongs.Selected].Path; Exit; end; - CurrentSong.Path := CatSongs.Song[CatSongs.Selected].Path; -// CurrentSong.GAP := CurrentSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / CurrentSong.BPM[0].BPM / 2; // temporary until UMain will be fixed - + // set movie if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then begin -- cgit v1.2.3 From b4371d97f409af8ab9dc942c39f143ae400854da Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 21:43:57 +0000 Subject: bugfix to get the editor working again. Path and FileName have not been set. In addtion LoadSong was not used to actually load the song. Jay or some other dev: please revise the changes. The Lyric var is not set too, so it crashes on Lyric.Clear in TScreenEditSub.onShow. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@829 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditSub.pas | 13 +- Game/Code/Screens/UScreenSong.pas | 4345 +++++++++++++++++----------------- 2 files changed, 2178 insertions(+), 2180 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 4d971c63..60e27245 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -89,8 +89,6 @@ type public Tex_Background: TTexture; FadeOut: boolean; - Path: string; - FileName: string; constructor Create; override; procedure onShow; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; @@ -223,9 +221,9 @@ begin begin // Save Song if SDL_ModState = KMOD_LSHIFT then - SaveSong(CurrentSong, Czesci[0], Path + FileName, true) + SaveSong(CurrentSong, Czesci[0], CurrentSong.Path + CurrentSong.FileName, true) else - SaveSong(CurrentSong, Czesci[0], Path + FileName, false); + SaveSong(CurrentSong, Czesci[0], CurrentSong.Path + CurrentSong.FileName, false); {if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL + KMOD_LALT then // Save Song @@ -1159,9 +1157,10 @@ procedure TScreenEditSub.onShow; begin Log.LogStatus('Initializing', 'TEditScreen.onShow'); + ResetSingTemp; + try - ResetSingTemp; -// Error := not LoadSong(Path + FileName); // todo - JB come back to this + Error := not CurrentSong.LoadSong(); except Error := True; end; @@ -1188,7 +1187,7 @@ begin AktNuta := 0; Czesci[0].Czesc[0].Nuta[0].Color := 1; - AudioPlayback.Open(Path + CurrentSong.Mp3); + AudioPlayback.Open(CurrentSong.Path + CurrentSong.Mp3); //Set Down Music Volume for Better hearability of Midi Sounds //Music.SetVolume(40); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 3be0be84..b142b4dc 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1,2173 +1,2172 @@ -unit UScreenSong; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - - -uses - UMenu, - SDL, - UMusic, - UFiles, - UTime, - UDisplay, - USongs, - SysUtils, - ULog, - UThemes, - UTexture, - ULanguage, - ULCD, - ULight, - USong, - UIni; - -type - TScreenSong = class(TMenu) - private - EqualizerData: TFFTData; // moved here to avoid stack overflows - EqualizerBands: array of Byte; - EqualizerTime: Cardinal; - EqualizerTime2: Byte; - public - TextArtist: integer; - TextTitle: integer; - TextNumber: integer; - - //Video Icon Mod - VideoIcon: Cardinal; - - TextCat: integer; - StaticCat: integer; - - SongCurrent: real; - SongTarget: real; - - HighSpeed: boolean; - CoverFull: boolean; - CoverTime: real; - CoverX: integer; - CoverY: integer; - CoverW: integer; - is_jump: boolean; // Jump to Song Mod - is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title - - //Party Mod - Mode: TSingMode; - - //party Statics (Joker) - StaticTeam1Joker1: Cardinal; - StaticTeam1Joker2: Cardinal; - StaticTeam1Joker3: Cardinal; - StaticTeam1Joker4: Cardinal; - StaticTeam1Joker5: Cardinal; - - StaticTeam2Joker1: Cardinal; - StaticTeam2Joker2: Cardinal; - StaticTeam2Joker3: Cardinal; - StaticTeam2Joker4: Cardinal; - StaticTeam2Joker5: Cardinal; - - StaticTeam3Joker1: Cardinal; - StaticTeam3Joker2: Cardinal; - StaticTeam3Joker3: Cardinal; - StaticTeam3Joker4: Cardinal; - StaticTeam3Joker5: Cardinal; - - StaticParty: Array of Cardinal; - TextParty: Array of Cardinal; - StaticNonParty: Array of Cardinal; - TextNonParty: Array of Cardinal; - - - constructor Create; override; - procedure SetScroll; - procedure SetScroll1; - procedure SetScroll2; - procedure SetScroll3; - procedure SetScroll4; - procedure SetScroll5; - procedure SetScroll6; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure GenerateThumbnails(); - procedure onShow; override; - procedure onHide; override; - procedure SelectNext; - procedure SelectPrev; - procedure UpdateLCD; - procedure SkipTo(Target: Cardinal); - procedure FixSelected; //Show Wrong Song when Tabs on Fix - procedure FixSelected2; //Show Wrong Song when Tabs on Fix - procedure ShowCatTL(Cat: Integer);// Show Cat in Top left - procedure ShowCatTLCustom(Caption: String);// Show Custom Text in Top left - procedure HideCatTL;// Show Cat in Tob left - procedure Refresh; //Refresh Song Sorting - procedure DrawEqualizer; - procedure ChangeMusic; - //Party Mode - procedure SelectRandomSong; - procedure SetJoker; - procedure SetStatics; - //procedures for Menu - procedure StartSong; - procedure OpenEditor; - procedure DoJoker(Team: Byte); - procedure SelectPlayers; - - procedure UnLoadDetailedCover; - - //Extensions - procedure DrawExtensions; - end; - -implementation -uses UGraphic, - UMain, - UCovers, - math, - OpenGL12, - {$IFDEF win32} - windows, - {$ELSE} - lclintf, - {$ENDIF} - USkins, - UDLLManager, - UParty, - UPlaylist, - UScreenSongMenu; - -// ***** Public methods ****** // - -//Show Wrong Song when Tabs on Fix -procedure TScreenSong.FixSelected; -var I, I2: Integer; - begin - if CatSongs.VisibleSongs > 0 then - begin - I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do - begin - if CatSongs.Song[I].Visible then - inc(I2); - - if I = Interaction - 1 then - break; - end; - - SongCurrent := I2; - SongTarget := I2; - end; - end; - -procedure TScreenSong.FixSelected2; -var I, I2: Integer; - begin - if CatSongs.VisibleSongs > 0 then - begin - I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do - begin - if CatSongs.Song[I].Visible then - inc(I2); - - if I = Interaction - 1 then - break; - end; - - SongTarget := I2; - end; - end; -//Show Wrong Song when Tabs on Fix End - - procedure TScreenSong.ShowCatTLCustom(Caption: String);// Show Custom Text in Top left - begin - Text[TextCat].Text := Caption; - Text[TextCat].Visible := true; - Static[StaticCat].Visible := False; - end; - - //Show Cat in Top Left Mod - procedure TScreenSong.ShowCatTL(Cat: Integer); - begin - //Change - Text[TextCat].Text := CatSongs.Song[Cat].Artist; - //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover); - //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); - - Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); - //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false); - //Button[Cat]. - //Cover - - - //Show - Text[TextCat].Visible := true; - Static[StaticCat].Visible := True; - end; - - procedure TScreenSong.HideCatTL; - begin - //Hide - //Text[TextCat].Visible := false; - Static[StaticCat].Visible := false; - //New -> Show Text specified in Theme - Text[TextCat].Visible := True; - Text[TextCat].Text := Theme.Song.TextCat.Text; - end; - //Show Cat in Top Left Mod End - - -// Method for input parsing. If False is returned, GetNextWindow -// should be checked to know the next window to load; -function TScreenSong.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -var - I: integer; - I2: integer; - HS: integer; - SDL_ModState: Word; - Letter: Char; -begin - Result := true; - - //Song Screen Extensions (Jumpto + Menu) - if (ScreenSongMenu.Visible) then - begin - Result := ScreenSongMenu.ParseInput(PressedKey, ScanCode, PressedDown); - Exit; - end - else if (ScreenSongJumpto.Visible) then - begin - Result := ScreenSongJumpto.ParseInput(PressedKey, ScanCode, PressedDown); - Exit; - end; - - If (PressedDown) Then - begin // Key Down - - SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT - + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); - - //Jump to Artist/Titel - if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = smNormal) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then - begin - Letter := UpCase(Chr(ScanCode)); - I2 := Length(CatSongs.Song); - - //Jump To Titel - if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then - begin - For I := 1 to high(CatSongs.Song) do - begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND - (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND - (widechar(UpperCase(CatSongs.Song[(I + Interaction) mod I2].Title)[1]) = widechar(Letter)) then - begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - - AudioPlayback.PlaySound(SoundLib.Change); - - ChangeMusic; - SetScroll4; - UpdateLCD; - //Break and Exit - Exit; - end; - end; - end - //Jump to Artist - else if (SDL_ModState = KMOD_LALT) then - begin - For I := 1 to high(CatSongs.Song) do - begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND - (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND - (widechar(uppercase(CatSongs.Song[(I + Interaction) mod I2].Artist)[1]) = widechar(Letter)) then - begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - - AudioPlayback.PlaySound(SoundLib.Change); - - ChangeMusic; - SetScroll4; - UpdateLCD; - - //Break and Exit - Exit; - end; - end; - end; - Exit; - end; - - case PressedKey of - SDLK_Q: - begin - Result := false; - end; - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - if (Mode = smNormal) then - begin - //On Escape goto Cat-List Hack - if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then - begin - //Find Category - I := Interaction; - while not catsongs.Song[I].Main do - begin - Dec (I); - if (I < low(catsongs.Song)) then - break; - end; - if (I<= 1) then - Interaction := high(catsongs.Song) - else - Interaction := I - 1; - - //Stop Music - AudioPlayback.Stop; - - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - HideCatTL; - - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - //SelectPrev; - //CatSongs.Song[0].Visible := False; - end - else - begin - //On Escape goto Cat-List Hack End - //Tabs off and in Search or Playlist -> Go back to Song view - if (CatSongs.CatNumShow < -1) then - begin - //Atm: Set Empty Filter - CatSongs.SetFilter('', 0); - - //Show Cat in Top Left Mod - HideCatTL; - Interaction := 0; - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - - ChangeMusic; - end - else - begin - AudioPlayback.Stop; - AudioPlayback.PlaySound(SoundLib.Back); - - FadeTo(@ScreenMain); - end; - - end; - end - //When in party Mode then Ask before Close - else if (Mode = smPartyMode) then - begin - AudioPlayback.PlaySound(SoundLib.Back); - CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); - end; - end; - SDLK_RETURN: - begin - if Songs.SongList.Count > 0 then - begin - {$IFDEF UseSerialPort} - // PortWriteB($378, 0); - {$ENDIF} - if CatSongs.Song[Interaction].Main then - begin // clicked on Category Button - - //Show Cat in Top Left Mod - ShowCatTL (Interaction); - - //I := CatSongs.VisibleIndex(Interaction); - CatSongs.ClickCategoryButton(Interaction); - {I2 := CatSongs.VisibleIndex(Interaction); - SongCurrent := SongCurrent - I + I2; - SongTarget := SongTarget - I + I2; } - -// if I<>I2 then beep; - // SetScroll4; - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - - //Play Music: - ChangeMusic; - - end - else - begin // clicked on song - if (Mode = smNormal) then //Normal Mode -> Start Song - begin - //Do the Action that is specified in Ini - case Ini.OnSongClick of - 0: StartSong; - 1: SelectPlayers; - 2:begin - If (CatSongs.CatNumShow = -3) then - ScreenSongMenu.MenuShow(SM_Playlist) - else - ScreenSongMenu.MenuShow(SM_Main); - end; - end; - end - else if (Mode = smPartyMode) then //PartyMode -> Show Menu - begin - if (Ini.PartyPopup = 1) then - ScreenSongMenu.MenuShow(SM_Party_Main) - else - ScreenSong.StartSong; - end; - end; - end; - end; - - SDLK_M: //Show SongMenu - begin - if (Songs.SongList.Count > 0) then begin - if (Mode = smNormal) then begin - if not CatSongs.Song[Interaction].Main then begin // clicked on Song - if CatSongs.CatNumShow = -3 then - ScreenSongMenu.MenuShow(SM_Playlist) - else - ScreenSongMenu.MenuShow(SM_Main); - end - else - begin - ScreenSongMenu.MenuShow(SM_Playlist_Load); - end; - end //Party Mode -> Show Party Menu - else ScreenSongMenu.MenuShow(SM_Party_Main); - end; - end; - - SDLK_P: //Show Playlist Menu - begin - if (Songs.SongList.Count > 0) AND (Mode = smNormal) then begin - ScreenSongMenu.MenuShow(SM_Playlist_Load); - end; - end; - - SDLK_J: //Show Jumpto Menu - begin - if (Songs.SongList.Count > 0) AND (Mode = smNormal) then - begin - ScreenSongJumpto.Visible := True; - end; - end; - - SDLK_DOWN: - begin - if (Mode = smNormal) then - begin - //Only Change Cat when not in Playlist or Search Mode - if (CatSongs.CatNumShow > -2) then - begin - //Cat Change Hack - if Ini.Tabs_at_startup = 1 then - begin - I := Interaction; - if I <= 0 then I := 1; - - while not catsongs.Song[I].Main do - begin - Inc (I); - if (I > high(catsongs.Song)) then - I := low(catsongs.Song); - end; - - Interaction := I; - - //Show Cat in Top Left Mod - ShowCatTL (Interaction); - - CatSongs.ClickCategoryButton(Interaction); - SelectNext; - FixSelected; - - //Play Music: - AudioPlayback.PlaySound(SoundLib.Change); - ChangeMusic; - - end; - - // - //Cat Change Hack End} - end; - end; - end; - SDLK_UP: - begin - if (Mode = smNormal) then - begin - //Only Change Cat when not in Playlist or Search Mode - if (CatSongs.CatNumShow > -2) then - begin - //Cat Change Hack - if Ini.Tabs_at_startup = 1 then - begin - I := Interaction; - I2 := 0; - if I <= 0 then I := 1; - - while not catsongs.Song[I].Main or (I2 = 0) do - begin - if catsongs.Song[I].Main then - Inc(I2); - Dec (I); - if (I < low(catsongs.Song)) then - I := high(catsongs.Song); - end; - - Interaction := I; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - FixSelected; - - //Play Music: - AudioPlayback.PlaySound(SoundLib.Change); - ChangeMusic; - end; - end; - //Cat Change Hack End} - end; - end; - - SDLK_RIGHT: - begin - if (Songs.SongList.Count > 0) AND (Mode = smNormal) then - begin - AudioPlayback.PlaySound(SoundLib.Change); - SelectNext; -// InteractNext; -// SongTarget := Interaction; - ChangeMusic; - SetScroll4; - UpdateLCD; - Light.LightOne(1, 200); - end; - end; - - SDLK_LEFT: - begin - if (Songs.SongList.Count > 0)AND (Mode = smNormal) then begin - AudioPlayback.PlaySound(SoundLib.Change); - SelectPrev; - ChangeMusic; - SetScroll4; - UpdateLCD; - Light.LightOne(0, 200); - end; - end; - - SDLK_E: - begin - OpenEditor; - end; - - SDLK_R: - begin - if (Songs.SongList.Count > 0) AND (Mode = smNormal) then begin - - if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category - begin - I2 := 0; //Count Cats - for I:= low(CatSongs.Song) to high (CatSongs.Song) do - if CatSongs.Song[I].Main then Inc(I2); - - I2 := Random (I2)+1; //Zufall - - //Find Cat: - for I:= low(CatSongs.Song) to high (CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - Dec(I2); - if (I2<=0) then - begin - //Show Cat in Top Left Mod - ShowCatTL (I); - - Interaction := I; - - CatSongs.ShowCategoryList; - CatSongs.ClickCategoryButton(I); - SelectNext; - FixSelected; - break; - end; - end; - - - end - else if (SDL_ModState = KMOD_LCTRL) AND (Ini.Tabs_at_startup = 1) then //random in All Categorys - begin - repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; - - //Search Cat - for I := I2 downto low(CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - break; - end; - //In I ist jetzt die Kategorie in I2 der Song - - //Choose Cat - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - - //Fix: Not Existing Song selected: - //if (I+1=I2) then Inc(I2); - - //Choose Song - SkipTo(I2-I); - - end - else //Random in one Category - begin - SkipTo(Random(CatSongs.VisibleSongs)); - end; - AudioPlayback.PlaySound(SoundLib.Change); - - ChangeMusic; - SetScroll4; - UpdateLCD; - end; - end; - - SDLK_1: - begin //Jocker // to-do : Party - {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[0].Joker); - SelectRandomSong; - SetJoker; - end; } - end; - - SDLK_2: - begin //Jocker - {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[1].Joker); - SelectRandomSong; - SetJoker; - end; } - end; - - SDLK_3: - begin //Jocker - {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[2].Joker); - SelectRandomSong; - SetJoker; - end; } - end; - end; - end; -end; - -constructor TScreenSong.Create; -var -// Pet: integer; - I: integer; -//Label CreateSongButtons; -begin - inherited Create; - - LoadFromTheme(Theme.Song); - - TextArtist := AddText(Theme.Song.TextArtist); - TextTitle := AddText(Theme.Song.TextTitle); - TextNumber := AddText(Theme.Song.TextNumber); - - //Show Cat in Top Left mod - TextCat := AddText(Theme.Song.TextCat); - StaticCat := AddStatic(Theme.Song.StaticCat); - - //Show Video Icon Mod - VideoIcon := AddStatic(Theme.Song.VideoIcon); - - //Party Mode - StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1); - StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2); - StaticTeam1Joker3 := AddStatic(Theme.Song.StaticTeam1Joker3); - StaticTeam1Joker4 := AddStatic(Theme.Song.StaticTeam1Joker4); - StaticTeam1Joker5 := AddStatic(Theme.Song.StaticTeam1Joker5); - - StaticTeam2Joker1 := AddStatic(Theme.Song.StaticTeam2Joker1); - StaticTeam2Joker2 := AddStatic(Theme.Song.StaticTeam2Joker2); - StaticTeam2Joker3 := AddStatic(Theme.Song.StaticTeam2Joker3); - StaticTeam2Joker4 := AddStatic(Theme.Song.StaticTeam2Joker4); - StaticTeam2Joker5 := AddStatic(Theme.Song.StaticTeam2Joker5); - - StaticTeam3Joker1 := AddStatic(Theme.Song.StaticTeam3Joker1); - StaticTeam3Joker2 := AddStatic(Theme.Song.StaticTeam3Joker2); - StaticTeam3Joker3 := AddStatic(Theme.Song.StaticTeam3Joker3); - StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); - StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); - - //Load Party or NonParty specific Statics and Texts - SetLength(StaticParty, Length(Theme.Song.StaticParty)); - for I := 0 to High(Theme.Song.StaticParty) do - StaticParty[I] := AddStatic(Theme.Song.StaticParty[I]); - - SetLength(TextParty, Length(Theme.Song.TextParty)); - for I := 0 to High(Theme.Song.TextParty) do - TextParty[I] := AddText(Theme.Song.TextParty[I]); - - SetLength(StaticNonParty, Length(Theme.Song.StaticNonParty)); - for I := 0 to High(Theme.Song.StaticNonParty) do - StaticNonParty[I] := AddStatic(Theme.Song.StaticNonParty[I]); - - SetLength(TextNonParty, Length(Theme.Song.TextNonParty)); - for I := 0 to High(Theme.Song.TextNonParty) do - TextNonParty[I] := AddText(Theme.Song.TextNonParty[I]); - - // Song List -// Songs.LoadSongList; // moved to the UltraStar unit - CatSongs.Refresh; - - GenerateThumbnails(); -(* - if (length(CatSongs.Song) > 0) then - begin - //Set Length of Button Array one Time Instead of one time for every Song - SetButtonLength(Length(CatSongs.Song)); - - I := 0; - CreateSongButtons: - - try - for Pet := I to High(CatSongs.Song) do begin // creating all buttons - // new - Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 - - if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then - CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' - - if CatSongs.Song[Pet].Cover = '' then - AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) - else begin - // cache texture if there is a need to this - if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then - begin - Texture.CreateCacheMipmap := true; - Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap - Texture.CreateCacheMipmap := false; - - // puts this texture to the cache file - Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); - - // unload full size texture - Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); - - // we should also add mipmap texture by calling createtexture and use mipmap cache as data source - end; - - // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) - AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); - end; - Texture.Limit := 1024*1024; - I := -1; - end; - except - //When Error is reported the First time for this Song - if (I <> Pet) then - begin - //Some Error reporting: - Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); - - //Change Cover to NoCover and Continue Loading - CatSongs.Song[Pet].Cover := ''; - I := Pet; - end - else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song - begin - Log.LogError('NoCover Cover is damaged!'); - try - AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); - except - {$IFDEF MSWINDOWS} - Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); - {$ELSE} - // TODO : JB_linux - better handle this message and display to user.. - writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'); - Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' ); - {$ENDIF} - Halt; - end; - I := Pet + 1; - end; - end; - - if (I <> -1) then - GoTo CreateSongButtons; - - end; -*) - - // Randomize Patch - Randomize; - //Equalizer - SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); - //ClearArray - For I := low(EqualizerBands) to high(EqualizerBands) do - EqualizerBands[I] := 3; - - if (Length(CatSongs.Song) > 0) then - Interaction := 0; -end; - -procedure TScreenSong.GenerateThumbnails(); -var - I : Integer; - Pet: integer; -Label CreateSongButtons; -begin - if (length(CatSongs.Song) > 0) then - begin - //Set Length of Button Array one Time Instead of one time for every Song - SetButtonLength(Length(CatSongs.Song)); - - I := 0; - CreateSongButtons: - - try - for Pet := I to High(CatSongs.Song) do begin // creating all buttons - // new - Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 - - if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then - CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' - - if CatSongs.Song[Pet].Cover = '' then - AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) - else begin - // cache texture if there is a need to this - if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then - begin - Texture.CreateCacheMipmap := true; - Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap - Texture.CreateCacheMipmap := false; - - // puts this texture to the cache file - Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); - - // unload full size texture - Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); - - // we should also add mipmap texture by calling createtexture and use mipmap cache as data source - end; - - // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) - AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); - end; - Texture.Limit := 1024*1024; - I := -1; - end; - except - //When Error is reported the First time for this Song - if (I <> Pet) then - begin - //Some Error reporting: - Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); - - //Change Cover to NoCover and Continue Loading - CatSongs.Song[Pet].Cover := ''; - I := Pet; - end - else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song - begin - Log.LogError('NoCover Cover is damaged!'); - try - AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); - except - {$IFDEF MSWINDOWS} - Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); - {$ELSE} - // TODO : JB_linux - better handle this message and display to user.. - writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'); - Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' ); - {$ENDIF} - Halt; - end; - I := Pet + 1; - end; - end; - - if (I <> -1) then - GoTo CreateSongButtons; - - end; -end; - -procedure TScreenSong.SetScroll; -var - VS, B: Integer; -begin - VS := CatSongs.VisibleSongs; - if VS > 0 then - begin - //Set Positions - Case Theme.Song.Cover.Style of - 3: SetScroll3; - 5:begin - if VS > 5 then - SetScroll5 - else - SetScroll4; - end; - 6: SetScroll6; - else SetScroll4; - end; - //Set Visibility of Video Icon - Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> ''); - - //Set Texts: - Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; - Text[TextTitle].Text := CatSongs.Song[Interaction].Title; - if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then - begin - Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); - Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; - end - else if (CatSongs.CatNumShow = -2) then - Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) - else if (CatSongs.CatNumShow = -3) then - Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) - else if (Ini.Tabs_at_startup = 1) then - Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) - else - Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); - end - else - begin - Text[TextNumber].Text := '0/0'; - Text[TextArtist].Text := ''; - Text[TextTitle].Text := ''; - for B := 0 to High(Button) do - Button[B].Visible := False; - - end; -end; - -procedure TScreenSong.SetScroll1; -var - B: integer; // button - BMin: integer; // button min - BMax: integer; // button max - Src: integer; -// Dst: integer; - Count: integer; // Dst is not used. Count is used. - Ready: boolean; - - VisCount: integer; // count of visible (or selectable) buttons - VisInt: integer; // visible position of interacted button - Typ: integer; // 0 when all songs fits the screen - Placed: integer; // number of placed visible buttons -begin -// Src := 0; -// Dst := -1; - Count := 1; - Typ := 0; - Ready := false; - Placed := 0; - - VisCount := 0; - for B := 0 to High(Button) do - if CatSongs.Song[B].Visible then Inc(VisCount); - - VisInt := 0; - for B := 0 to Interaction-1 do - if CatSongs.Song[B].Visible then Inc(VisInt); - - - if VisCount <= 6 then begin - Typ := 0; - end else begin - if VisInt <= 3 then begin - Typ := 1; - Count := 7; - Ready := true; - end; - - if (VisCount - VisInt) <= 3 then begin - Typ := 2; - Count := 7; - Ready := true; - end; - - if not Ready then begin - Typ := 3; - Src := Interaction; - end; - end; - - - - // hide all buttons - for B := 0 to High(Button) do begin - Button[B].Visible := false; - Button[B].Selectable := CatSongs.Song[B].Visible; - end; - -{ for B := Src to Dst do begin -// Button[B].Visible := true; - Button[B].Visible := CatSongs.Song[B].Visible; - Button[B].Selectable := Button[B].Visible; - Button[B].Y := 140 + (B-Src) * 60; - end;} - - - if Typ = 0 then begin - for B := 0 to High(Button) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (Placed) * 60; - Inc(Placed); - end; - end; - end; - - if Typ = 1 then begin - B := 0; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Inc(B); - end; - end; - - if Typ = 2 then begin - B := High(Button); - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (6-Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Dec(B); - end; - end; - - if Typ = 3 then begin - B := Src; - Count := 4; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (3+Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Inc(B); - end; - - B := Src-1; - Placed := 0; - Count := 3; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (2-Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Dec(B); - end; - - end; - - if Length(Button) > 0 then - Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture -end; - -procedure TScreenSong.SetScroll2; -var - B: integer; - Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu - Wsp2: real; -begin - // liniowe - for B := 0 to High(Button) do - Button[B].X := 300 + (B - Interaction) * 260; - - if Length(Button) >= 3 then begin - if Interaction = 0 then - Button[High(Button)].X := 300 - 260; - - if Interaction = High(Button) then - Button[0].X := 300 + 260; - end; - - // kolowe -{ for B := 0 to High(Button) do begin - Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. - Wsp2 := Wsp / Length(Button); - Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); -// Button[B].Y := 140 + 50 * ; - end;} -end; - -procedure TScreenSong.SetScroll3; // with slide -var - B: integer; - Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu - Wsp2: real; -begin - SongTarget := Interaction; - - // liniowe - for B := 0 to High(Button) do - begin - Button[B].X := 300 + (B - SongCurrent) * 260; - if (Button[B].X < -Button[B].W) OR (Button[B].X > 800) then - Button[B].Visible := False - else - Button[B].Visible := True; - end; - -{ if Length(Button) >= 3 then begin - if Interaction = 0 then - Button[High(Button)].X := 300 - 260; - - if Interaction = High(Button) then - Button[0].X := 300 + 260; - end;} - - // kolowe -{ for B := 0 to High(Button) do begin - Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. - Wsp2 := Wsp / Length(Button); - Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); -// Button[B].Y := 140 + 50 * ; - end;} -end; - -procedure TScreenSong.SetScroll4; // rotate -var - B: integer; - Wsp: real; - Z, Z2: real; - VS: integer; -begin - VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important - - // kolowe - for B := 0 to High(Button) do begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2; - Z2 := (1 + 2*Z) / 3; - - - Button[B].X := Theme.Song.Cover.X + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - Button[B].Z := Z / 2 + 0.3; - - Button[B].W := Theme.Song.Cover.H * Z2; - -// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; - Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; - Button[B].H := Button[B].W; - end; - end; -end; - -(* -procedure TScreenSong.SetScroll4; // rotate -var - B: integer; - Wsp: real; - Z: real; - Z2, Z3: real; - VS: integer; - function modreal (const X, Y: real):real; - begin - Result := Frac(x / y) * y; - if Result < -3 then - Result := Result + Y - else if Result > 3 then - Result := Result - Y; - end; -begin - VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important - Z3 := 1; - if VS < 12 then - Z2 := VS - else - Z2 := 12; - - // kolowe - for B := 0 to High(Button) do begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - if ((ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)>-3) AND (ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)<3)) then - begin - if CatSongs.VisibleIndex(B)> SongCurrent then - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2 - else - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2; - - Z3 := 2; - Z := (1 + cos(Wsp)) / 2; - //Z2 := (1 + 2*Z) / 3; - //Z2 := (0.5 + Z/2); - //Z2 := sin(Wsp); - - //Z2 := Power (Z2,Z3); - - Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); - - //Button[B].X := Theme.Song.CoverX + ({Theme.Song.CoverX + Theme.Song.CoverW/2 + Theme.Song.CoverW*0.18 * VS {CatSongs.VisibleSongs {Length(Button) * sin(Wsp) {- Theme.Song.CoverX - Theme.Song.CoverW) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - if (sin(Wsp)<0) then - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W - else //*Theme.Song.CoverW*0.004*Z3 - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; - Button[B].Z := Z-0.00001; - -// Button[B].Y := {50 + 140 + 50 - 50 * Z2; - // Button[B].Y := (Theme.Song.CoverY + 40 + 50 - 50 * Z2); - Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); - Button[B].H := Button[B].W; - Button[B].Visible := True; - end - {else if (((CatSongs.VisibleIndex(B) - SongCurrent)>-3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) OR ((round (CatSongs.VisibleIndex(B) - SongCurrent) mod VS > -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) then - begin - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / 12 ;// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2 -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); - - if (sin(Wsp)<0) then - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W - else - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; - - Button[B].Z := Z; - - Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); - - Button[B].H := Button[B].W; - Button[B].Visible := True; - end - else Button[B].Visible := False; - end; - end; -end; *) - -procedure TScreenSong.SetScroll5; // rotate -var - B: integer; - Angle: real; - Pos: Real; - VS: integer; - diff: real; - X: Real; - helper: real; -begin - VS := CatSongs.VisibleSongs; // cache Visible Songs - {Vars - Theme.Song.CoverW: Radius des Kreises - Theme.Song.CoverX: X Pos Linke Kante des gewählten Covers - Theme.Song.CoverX: Y Pos Obere Kante des gewählten Covers - Theme.Song.CoverH: Höhe der Cover - - (CatSongs.VisibleIndex(B) - SongCurrent)/VS = Abstand zum MIttleren Cover in % - } - - //Change Pos of all Buttons - for B := low(Button) to high(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility - if Button[B].Visible then //Only Change Pos for Visible Buttons - begin - Pos := (CatSongs.VisibleIndex(B) - SongCurrent); - if (Pos < -VS/2) then - Pos := Pos + VS - else if (Pos > VS/2) then - Pos := Pos - VS; - - if (Abs(Pos) < 2.5) then {fixed Positions} - begin - Angle := Pi * (Pos / 5); -// Button[B].Visible := False; - - Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); - -// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Z := 0.95 - Abs(Pos) * 0.01; - - Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); - - Button[B].W := Button[B].H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - - X := Sin(Angle*1.3)*0.9; - - Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Diff; - - end - else - begin {Behind the Front Covers} - - // limit-bg-covers hack - if (abs(abs(Pos)-VS/2)>10) then Button[B].Visible:=False; - // end of limit-bg-covers hack - - if Pos < 0 then - Pos := (Pos - VS/2)/VS - else - Pos := (Pos + VS/2)/VS; - - Angle := pi * Pos*2; - if VS > 24 then - begin - if Angle < 0 then helper:=-1 else helper:=1; - Angle:=2*pi-abs(Angle); - Angle:=Angle*(VS/24); - Angle:=(2*pi-Angle)*helper; - end; - - Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); - - Button[B].W := Button[B].H; - - Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; - -// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*((Theme.Song.Cover.H)*sin(Angle/2)*1.52); - - end; - - //Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field -// Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); - - end; - end; -end; - -procedure TScreenSong.SetScroll6; // rotate (slotmachine style) -var - B: integer; - Angle: real; - Pos: Real; - VS: integer; - diff: real; - X: Real; - Wsp: real; - Z, Z2: real; -begin - VS := CatSongs.VisibleSongs; // cache Visible Songs - if VS <=5 then begin - // kolowe - for B := 0 to High(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2; - Z2 := (1 + 2*Z) / 3; - - - Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - Button[B].Z := Z / 2 + 0.3; - - Button[B].W := Theme.Song.Cover.H * Z2; - -// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; - Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; - Button[B].H := Button[B].W; - end; - end; - end - else begin - - //Change Pos of all Buttons - for B := low(Button) to high(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility - if Button[B].Visible then //Only Change Pos for Visible Buttons - begin - Pos := (CatSongs.VisibleIndex(B) - SongCurrent); - if (Pos < -VS/2) then - Pos := Pos + VS - else if (Pos > VS/2) then - Pos := Pos - VS; - - if (Abs(Pos) < 2.5) then {fixed Positions} - begin - Angle := Pi * (Pos / 5); -// Button[B].Visible := False; - - Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); - - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Z := 0.95 - Abs(Pos) * 0.01; - - Button[B].X := (Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); - - Button[B].W := Button[B].H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - - X := Sin(Angle*1.3)*0.9; - - Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff; - end - else - begin {Behind the Front Covers} - - // limit-bg-covers hack - if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; - if VS > 25 then VS:=25; - // end of limit-bg-covers hack - - if Pos < 0 then - Pos := (Pos - VS/2)/VS - else - Pos := (Pos + VS/2)/VS; - - Angle := pi * Pos*2; - - Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); - - Button[B].W := Button[B].H; - - Button[B].X := Theme.Song.Cover.X - (Button[B].H - Theme.Song.Cover.H)*0.5; - - - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Y := Theme.Song.Cover.Y+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*(Theme.Song.Cover.H*sin(Angle/2)*1.52); - end; - end; - end; - end; -end; - - -procedure TScreenSong.onShow; -begin - AudioPlayback.Stop; - - if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; - if Ini.Players = 4 then PlayersPlay := 6; - - //Cat Mod etc - if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then - begin - CatSongs.ShowCategoryList; - FixSelected; - //Show Cat in Top Left Mod - HideCatTL; - end; - - - if Length(CatSongs.Song) > 0 then begin - //Load Music only when Song Preview is activated - if ( Ini.PreviewVolume <> 0 ) then - begin - if(AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3)) then - begin - AudioPlayback.SetLoop(false); - AudioPlayback.Position := AudioPlayback.Length / 4; - AudioPlayback.Play; - - //Set Preview Volume - AudioPlayback.SetMusicVolume (Ini.PreviewVolume * 10); - {//if Music Fade is activated, Set Volume to 0 % - if (Ini.PreviewFading <> 0) then - Music.SetMusicVolume(0);} - end; - end; - - SetScroll; - UpdateLCD; - end; - - //Playlist Mode - if (Mode = smNormal) then - begin - //If Playlist Shown -> Select Next automatically - if (CatSongs.CatNumShow = -3) then - begin - SelectNext; - ChangeMusic; - end; - end - //Party Mode - else if (Mode = smPartyMode) then - begin - - SelectRandomSong; - //Show Menu directly in PartyMode - //But only if selected in Options - if (Ini.PartyPopup = 1) then - begin - ScreenSongMenu.MenuShow(SM_Party_Main); - end; - - - end; - - SetJoker; - SetStatics; -end; - -procedure TScreenSong.onHide; -begin - //When Music Fading is activated, Turn Music to 100 % - If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then - AudioPlayback.SetMusicVolume(100); - - //If Preview is deactivated: Load MUsicfile now - If (Ini.PreviewVolume = 0) then - AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); - - //When hide then Stop Music (For Party Mode Popup on Exit) - if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (AudioPlayback <> nil) then - AudioPlayback.Stop; -end; - -procedure TScreenSong.DrawExtensions; -begin - //Draw Song Menu - if (ScreenSongMenu.Visible) then - begin - ScreenSongMenu.Draw; - end - else if (ScreenSongJumpto.Visible) then - begin - ScreenSongJumpto.Draw; - end -end; - -function TScreenSong.Draw: boolean; -var - dx: real; - dt: real; - I: Integer; -begin - dx := SongTarget-SongCurrent; - dt := TimeSkip * 7; - -// writeln( 'TScreenSong.Draw '+ inttostr(trunc(TimeSkip)) ); - - if dt > 1 then - dt := 1; - - SongCurrent := SongCurrent + dx*dt; - -{ if SongCurrent > Catsongs.VisibleSongs then begin - SongCurrent := SongCurrent - Catsongs.VisibleSongs; - SongTarget := SongTarget - Catsongs.VisibleSongs; - end;} - -// Log.BenchmarkStart(5); - SetScroll; -// Log.BenchmarkEnd(5); -// Log.LogBenchmark('SetScroll4', 5); - - //Fading Functions, Only if Covertime is under 5 Seconds - If (CoverTime < 5) then - begin - // 0.5.0: cover fade - if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then - begin - // load new texture - Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); - Button[Interaction].Texture.Alpha := 1; - Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); - Button[Interaction].Texture2.Alpha := 1; - end; - - //Song Fade - if (CatSongs.VisibleSongs > 0) AND (Ini.PreviewVolume <> 0) AND (Not CatSongs.Song[Interaction].Main) AND (Ini.PreviewFading <> 0) then - begin - //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling - if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then - AudioPlayback.Play; - - //Update Song Volume - if (CoverTime < Ini.PreviewFading) then - AudioPlayback.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) - else - AudioPlayback.SetMusicVolume(Ini.PreviewVolume * 10); - - end; - - - //Update Fading Time - CoverTime := CoverTime + TimeSkip; - - //Update Fading Texture - Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; - if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; - - end; - - //inherited Draw; - //heres a little Hack, that causes the Statics - //are Drawn after the Buttons because of some Blending Problems. - //This should cause no Problems because all Buttons on this screen - //Has Z Position. - //Draw BG - DrawBG; - - //Instead of Draw FG Procedure: - //We draw Buttons for our own - for I := 0 to Length(Button) - 1 do - Button[I].Draw; - - // Statics - for I := 0 to Length(Static) - 1 do - Static[I].Draw; - - // and texts - for I := 0 to Length(Text) - 1 do - Text[I].Draw; - - - //Draw Equalizer - if Theme.Song.Equalizer.Visible then - DrawEqualizer; - - DrawExtensions; - -end; - -procedure TScreenSong.SelectNext; -var - Skip: integer; - I: integer; - VS: Integer; -begin - VS := CatSongs.VisibleSongs; - - if VS > 0 then - begin - UnLoadDetailedCover; - - Skip := 1; - - // this 1 could be changed by CatSongs.FindNextVisible - while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); - - SongTarget := SongTarget + 1;//Skip; - - Interaction := (Interaction + Skip) mod Length(Interactions); - - // try to keep all at the beginning - if SongTarget > VS-1 then begin - SongTarget := SongTarget - VS; - SongCurrent := SongCurrent - VS; - end; - - end; - // Interaction -> Button, ktorego okladke przeczytamy - // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture -end; - -procedure TScreenSong.SelectPrev; -var - Skip: integer; - I: integer; - VS: Integer; -begin - VS := CatSongs.VisibleSongs; - - if VS > 0 then - begin - UnLoadDetailedCover; - - Skip := 1; - - while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); - SongTarget := SongTarget - 1;//Skip; - - Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); - - // try to keep all at the beginning - if SongTarget < 0 then begin - SongTarget := SongTarget + CatSongs.VisibleSongs; - SongCurrent := SongCurrent + CatSongs.VisibleSongs; - end; - - // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture - end; -end; - -procedure TScreenSong.UpdateLCD; -begin - LCD.HideCursor; - LCD.Clear; - LCD.WriteText(1, Text[TextArtist].Text); - LCD.WriteText(2, Text[TextTitle].Text); -end; - -//Procedure Change current played Preview -procedure TScreenSong.ChangeMusic; -begin - //When Music Preview is avtivated -> then Change Music - if (Ini.PreviewVolume <> 0) then - begin - if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then - begin - AudioPlayback.Close; - if AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - AudioPlayback.Position := AudioPlayback.Length / 4; - //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal - if (Ini.PreviewFading = 0) then - AudioPlayback.Play - else - AudioPlayback.SetMusicVolume(0); - end; - end - else - AudioPlayback.Stop; - end; -end; - -procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0 -var - Skip: integer; - I: integer; -begin - UnLoadDetailedCover; - - Interaction := High(CatSongs.Song); - SongTarget := 0; - - for I := 1 to Target+1 do - SelectNext; - - FixSelected2; -end; - -procedure TScreenSong.DrawEqualizer; -var - I, J: Integer; - Res: byte; - A, B: Integer; - PosX, PosY: Integer; - Pos: Real; - lTmp : double; -begin - -if (not AudioPlayback.Finished) AND (Theme.Song.Equalizer.Length > 0) then -begin - - {$ifdef win32} - A := GetTickCount div 44; - - if (A <> EqualizerTime) then - begin - EqualizerTime := A; - AudioPlayback.GetFFTData(EqualizerData); - - B := 0; - Pos := 0; - Res := ceil(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band - - //Change Lengths - for I := 0 to (Res * Theme.Song.Equalizer.Bands - 1) do - begin - A := floor(I/Res); - - if (A<>B) then //Band changed - begin - if (Pos <= Theme.Song.Equalizer.Length) then - begin - if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then - EqualizerBands[B] := EqualizerBands[B] - 1 - else - EqualizerBands[B] := floor(Pos); - end - else - EqualizerBands[B] := 1; - - B := A; - Pos := 0; - end; - - if I > 35 then - EqualizerData[i] := EqualizerData[i] * 8 - else if I > 11 then - EqualizerData[i] := EqualizerData[i] * 4.5 - else - EqualizerData[i] := EqualizerData[i] * 1.1; - - if (EqualizerData[i] >= 1) then - EqualizerData[i] := 0.9999999999999; - - try - if ( assigned( Theme ) ) AND - ( assigned( Theme.Song ) ) AND - ( i < length( EqualizerData ) ) THEN - begin - if single( EqualizerData[i] ) > 1 then - begin - lTmp := Single(EqualizerData[i]) * Theme.Song.Equalizer.Length; - if lTmp > Pos then - Pos := lTmp; - end; - end; - except - {$IFDEF FPC} - on E:EInvalidOp do - writeln( 'UScreenSong - DOH !!!! ('+inttostr(i)+' '+ inttostr( integer( EqualizerData[i] ) )+' * '+ ')' ); - {$ENDIF} - end - - end; - - //Change Last Band - if (EqualizerBands[B] <= Theme.Song.Equalizer.Length) then - begin - if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then - EqualizerBands[B] := EqualizerBands[B] - 1 - else - EqualizerBands[B] := floor(Pos) - end - else - EqualizerBands[B] := 1; - end; - {$endif} - - //Draw every Channel - glColor4f(Theme.Song.Equalizer.ColR, Theme.Song.Equalizer.ColG, Theme.Song.Equalizer.ColB, Theme.Song.Equalizer.Alpha); //Set Color - glDisable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - - PosY := Theme.Song.Equalizer.Y; - PosX := Theme.Song.Equalizer.X; - - For I := 0 to Theme.Song.Equalizer.Bands-1 do - begin - if Theme.Song.Equalizer.Direction then - PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length - else - PosX := Theme.Song.Equalizer.X; - //Draw for every visible quad - for J := 1 to EqualizerBands[I] do - begin - glBegin(GL_QUADS); - glVertex3f(PosX, PosY, Theme.Song.Equalizer.Z); - glVertex3f(PosX, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); - glVertex3f(PosX+Theme.Song.Equalizer.W, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); - glVertex3f(PosX+Theme.Song.Equalizer.W, PosY, Theme.Song.Equalizer.Z); - glEnd; - - if Theme.Song.Equalizer.Direction then //Vertically - PosY := PosY - Theme.Song.Equalizer.H - Theme.Song.Equalizer.Space - else //Horizontally - PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space; - end; - if Theme.Song.Equalizer.Direction then //Horizontally - PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space - else //Vertically - PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space; - end; -end; -end; - -Procedure TScreenSong.SelectRandomSong; -var - I, I2: Integer; -begin - Case PlaylistMan.Mode of - smNormal: //All Songs Just Select Random Song - begin - //When Tabs are activated then use Tab Method - if (Ini.Tabs_at_startup = 1) then - begin - repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; - - //Search Cat - for I := I2 downto low(CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - break; - end; - //In I ist jetzt die Kategorie in I2 der Song - //I is the CatNum, I2 is the No of the Song within this Cat - - //Choose Cat - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - - //Choose Song - SkipTo(I2-I); - end - //When Tabs are deactivated use easy Method - else - SkipTo(Random(CatSongs.VisibleSongs)); - end; - smPartyMode: //One Category Select Category and Select Random Song - begin - CatSongs.ShowCategoryList; - CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); - ShowCatTL(PlaylistMan.CurPlayList); - - SelectNext; - FixSelected2; - - SkipTo(Random(CatSongs.VisibleSongs)); - end; - smPlaylistRandom: //Playlist: Select Playlist and Select Random Song - begin - PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); - - SkipTo(Random(CatSongs.VisibleSongs)); - FixSelected2; - end; - end; - - AudioPlayback.PlaySound(SoundLib.Change); - ChangeMusic; - SetScroll; - UpdateLCD; -end; - -procedure TScreenSong.SetJoker; -begin - {//If Party Mode - // to-do : Party - if Mode = smPartyMode then //Show Joker that are available - begin - if (PartySession.Teams.NumTeams >= 1) then - begin - Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1); - Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2); - Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3); - Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4); - Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5); - end - else - begin - Static[StaticTeam1Joker1].Visible := False; - Static[StaticTeam1Joker2].Visible := False; - Static[StaticTeam1Joker3].Visible := False; - Static[StaticTeam1Joker4].Visible := False; - Static[StaticTeam1Joker5].Visible := False; - end; - - if (PartySession.Teams.NumTeams >= 2) then - begin - Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1); - Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2); - Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3); - Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4); - Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5); - end - else - begin - Static[StaticTeam2Joker1].Visible := False; - Static[StaticTeam2Joker2].Visible := False; - Static[StaticTeam2Joker3].Visible := False; - Static[StaticTeam2Joker4].Visible := False; - Static[StaticTeam2Joker5].Visible := False; - end; - - if (PartySession.Teams.NumTeams >= 3) then - begin - Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1); - Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2); - Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3); - Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4); - Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5); - end - else - begin - Static[StaticTeam3Joker1].Visible := False; - Static[StaticTeam3Joker2].Visible := False; - Static[StaticTeam3Joker3].Visible := False; - Static[StaticTeam3Joker4].Visible := False; - Static[StaticTeam3Joker5].Visible := False; - end; - end - else - begin //Hide all - Static[StaticTeam1Joker1].Visible := False; - Static[StaticTeam1Joker2].Visible := False; - Static[StaticTeam1Joker3].Visible := False; - Static[StaticTeam1Joker4].Visible := False; - Static[StaticTeam1Joker5].Visible := False; - - Static[StaticTeam2Joker1].Visible := False; - Static[StaticTeam2Joker2].Visible := False; - Static[StaticTeam2Joker3].Visible := False; - Static[StaticTeam2Joker4].Visible := False; - Static[StaticTeam2Joker5].Visible := False; - - Static[StaticTeam3Joker1].Visible := False; - Static[StaticTeam3Joker2].Visible := False; - Static[StaticTeam3Joker3].Visible := False; - Static[StaticTeam3Joker4].Visible := False; - Static[StaticTeam3Joker5].Visible := False; - end; } -end; - -procedure TScreenSong.SetStatics; -var - I: Integer; - Visible: Boolean; -begin - //Set Visibility of Party Statics and Text - Visible := (Mode = smPartyMode); - - For I := 0 to high(StaticParty) do - Static[StaticParty[I]].Visible := Visible; - - For I := 0 to high(TextParty) do - Text[TextParty[I]].Visible := Visible; - - //Set Visibility of Non Party Statics and Text - Visible := not Visible; - - For I := 0 to high(StaticNonParty) do - Static[StaticNonParty[I]].Visible := Visible; - - For I := 0 to high(TextNonParty) do - Text[TextNonParty[I]].Visible := Visible; -end; - -//Procedures for Menu - -procedure TScreenSong.StartSong; -begin - CatSongs.Selected := Interaction; - AudioPlayback.Stop; - //Party Mode - if (Mode = smPartyMode) then - begin - FadeTo(@ScreenSingModi); - end - else - begin - FadeTo(@ScreenSing); - end; -end; - -procedure TScreenSong.SelectPlayers; -begin - CatSongs.Selected := Interaction; - AudioPlayback.Stop; - - ScreenName.Goto_SingScreen := True; - FadeTo(@ScreenName); -end; - -procedure TScreenSong.OpenEditor; -begin - if (Songs.SongList.Count > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = smNormal) then - begin - AudioPlayback.Stop; - AudioPlayback.PlaySound(SoundLib.Start); - ScreenEditSub.Path := CatSongs.Song[Interaction].Path; - ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName; - FadeTo(@ScreenEditSub); - end; -end; - -//Team No of Team (0-5) -procedure TScreenSong.DoJoker (Team: Byte); -begin - {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[Team].Joker); - SelectRandomSong; - SetJoker; - end; } -end; - -//Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song -procedure TScreenSong.UnLoadDetailedCover; -begin - CoverTime := 0; - - Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture - Button[Interaction].Texture2.Alpha := 0; - - if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then - Texture.UnloadTexture(Button[Interaction].Texture.Name, false); -end; - -procedure TScreenSong.Refresh; -begin { -CatSongs.Refresh; -CatSongs.ShowCategoryList; -Interaction := 0; -SelectNext; -FixSelected; } - -end; - -end. +unit UScreenSong; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +uses + UMenu, + SDL, + UMusic, + UFiles, + UTime, + UDisplay, + USongs, + SysUtils, + ULog, + UThemes, + UTexture, + ULanguage, + ULCD, + ULight, + USong, + UIni; + +type + TScreenSong = class(TMenu) + private + EqualizerData: TFFTData; // moved here to avoid stack overflows + EqualizerBands: array of Byte; + EqualizerTime: Cardinal; + EqualizerTime2: Byte; + public + TextArtist: integer; + TextTitle: integer; + TextNumber: integer; + + //Video Icon Mod + VideoIcon: Cardinal; + + TextCat: integer; + StaticCat: integer; + + SongCurrent: real; + SongTarget: real; + + HighSpeed: boolean; + CoverFull: boolean; + CoverTime: real; + CoverX: integer; + CoverY: integer; + CoverW: integer; + is_jump: boolean; // Jump to Song Mod + is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title + + //Party Mod + Mode: TSingMode; + + //party Statics (Joker) + StaticTeam1Joker1: Cardinal; + StaticTeam1Joker2: Cardinal; + StaticTeam1Joker3: Cardinal; + StaticTeam1Joker4: Cardinal; + StaticTeam1Joker5: Cardinal; + + StaticTeam2Joker1: Cardinal; + StaticTeam2Joker2: Cardinal; + StaticTeam2Joker3: Cardinal; + StaticTeam2Joker4: Cardinal; + StaticTeam2Joker5: Cardinal; + + StaticTeam3Joker1: Cardinal; + StaticTeam3Joker2: Cardinal; + StaticTeam3Joker3: Cardinal; + StaticTeam3Joker4: Cardinal; + StaticTeam3Joker5: Cardinal; + + StaticParty: Array of Cardinal; + TextParty: Array of Cardinal; + StaticNonParty: Array of Cardinal; + TextNonParty: Array of Cardinal; + + + constructor Create; override; + procedure SetScroll; + procedure SetScroll1; + procedure SetScroll2; + procedure SetScroll3; + procedure SetScroll4; + procedure SetScroll5; + procedure SetScroll6; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure GenerateThumbnails(); + procedure onShow; override; + procedure onHide; override; + procedure SelectNext; + procedure SelectPrev; + procedure UpdateLCD; + procedure SkipTo(Target: Cardinal); + procedure FixSelected; //Show Wrong Song when Tabs on Fix + procedure FixSelected2; //Show Wrong Song when Tabs on Fix + procedure ShowCatTL(Cat: Integer);// Show Cat in Top left + procedure ShowCatTLCustom(Caption: String);// Show Custom Text in Top left + procedure HideCatTL;// Show Cat in Tob left + procedure Refresh; //Refresh Song Sorting + procedure DrawEqualizer; + procedure ChangeMusic; + //Party Mode + procedure SelectRandomSong; + procedure SetJoker; + procedure SetStatics; + //procedures for Menu + procedure StartSong; + procedure OpenEditor; + procedure DoJoker(Team: Byte); + procedure SelectPlayers; + + procedure UnLoadDetailedCover; + + //Extensions + procedure DrawExtensions; + end; + +implementation +uses UGraphic, + UMain, + UCovers, + math, + OpenGL12, + {$IFDEF win32} + windows, + {$ELSE} + lclintf, + {$ENDIF} + USkins, + UDLLManager, + UParty, + UPlaylist, + UScreenSongMenu; + +// ***** Public methods ****** // + +//Show Wrong Song when Tabs on Fix +procedure TScreenSong.FixSelected; +var I, I2: Integer; + begin + if CatSongs.VisibleSongs > 0 then + begin + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); + + if I = Interaction - 1 then + break; + end; + + SongCurrent := I2; + SongTarget := I2; + end; + end; + +procedure TScreenSong.FixSelected2; +var I, I2: Integer; + begin + if CatSongs.VisibleSongs > 0 then + begin + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); + + if I = Interaction - 1 then + break; + end; + + SongTarget := I2; + end; + end; +//Show Wrong Song when Tabs on Fix End + + procedure TScreenSong.ShowCatTLCustom(Caption: String);// Show Custom Text in Top left + begin + Text[TextCat].Text := Caption; + Text[TextCat].Visible := true; + Static[StaticCat].Visible := False; + end; + + //Show Cat in Top Left Mod + procedure TScreenSong.ShowCatTL(Cat: Integer); + begin + //Change + Text[TextCat].Text := CatSongs.Song[Cat].Artist; + //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover); + //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); + + Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); + //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false); + //Button[Cat]. + //Cover + + + //Show + Text[TextCat].Visible := true; + Static[StaticCat].Visible := True; + end; + + procedure TScreenSong.HideCatTL; + begin + //Hide + //Text[TextCat].Visible := false; + Static[StaticCat].Visible := false; + //New -> Show Text specified in Theme + Text[TextCat].Visible := True; + Text[TextCat].Text := Theme.Song.TextCat.Text; + end; + //Show Cat in Top Left Mod End + + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenSong.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var + I: integer; + I2: integer; + HS: integer; + SDL_ModState: Word; + Letter: Char; +begin + Result := true; + + //Song Screen Extensions (Jumpto + Menu) + if (ScreenSongMenu.Visible) then + begin + Result := ScreenSongMenu.ParseInput(PressedKey, ScanCode, PressedDown); + Exit; + end + else if (ScreenSongJumpto.Visible) then + begin + Result := ScreenSongJumpto.ParseInput(PressedKey, ScanCode, PressedDown); + Exit; + end; + + If (PressedDown) Then + begin // Key Down + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + + //Jump to Artist/Titel + if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = smNormal) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then + begin + Letter := UpCase(Chr(ScanCode)); + I2 := Length(CatSongs.Song); + + //Jump To Titel + if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then + begin + For I := 1 to high(CatSongs.Song) do + begin + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND + (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND + (widechar(UpperCase(CatSongs.Song[(I + Interaction) mod I2].Title)[1]) = widechar(Letter)) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + + AudioPlayback.PlaySound(SoundLib.Change); + + ChangeMusic; + SetScroll4; + UpdateLCD; + //Break and Exit + Exit; + end; + end; + end + //Jump to Artist + else if (SDL_ModState = KMOD_LALT) then + begin + For I := 1 to high(CatSongs.Song) do + begin + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND + (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND + (widechar(uppercase(CatSongs.Song[(I + Interaction) mod I2].Artist)[1]) = widechar(Letter)) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + + AudioPlayback.PlaySound(SoundLib.Change); + + ChangeMusic; + SetScroll4; + UpdateLCD; + + //Break and Exit + Exit; + end; + end; + end; + Exit; + end; + + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + if (Mode = smNormal) then + begin + //On Escape goto Cat-List Hack + if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then + begin + //Find Category + I := Interaction; + while not catsongs.Song[I].Main do + begin + Dec (I); + if (I < low(catsongs.Song)) then + break; + end; + if (I<= 1) then + Interaction := high(catsongs.Song) + else + Interaction := I - 1; + + //Stop Music + AudioPlayback.Stop; + + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + HideCatTL; + + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + //SelectPrev; + //CatSongs.Song[0].Visible := False; + end + else + begin + //On Escape goto Cat-List Hack End + //Tabs off and in Search or Playlist -> Go back to Song view + if (CatSongs.CatNumShow < -1) then + begin + //Atm: Set Empty Filter + CatSongs.SetFilter('', 0); + + //Show Cat in Top Left Mod + HideCatTL; + Interaction := 0; + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + + ChangeMusic; + end + else + begin + AudioPlayback.Stop; + AudioPlayback.PlaySound(SoundLib.Back); + + FadeTo(@ScreenMain); + end; + + end; + end + //When in party Mode then Ask before Close + else if (Mode = smPartyMode) then + begin + AudioPlayback.PlaySound(SoundLib.Back); + CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); + end; + end; + SDLK_RETURN: + begin + if Songs.SongList.Count > 0 then + begin + {$IFDEF UseSerialPort} + // PortWriteB($378, 0); + {$ENDIF} + if CatSongs.Song[Interaction].Main then + begin // clicked on Category Button + + //Show Cat in Top Left Mod + ShowCatTL (Interaction); + + //I := CatSongs.VisibleIndex(Interaction); + CatSongs.ClickCategoryButton(Interaction); + {I2 := CatSongs.VisibleIndex(Interaction); + SongCurrent := SongCurrent - I + I2; + SongTarget := SongTarget - I + I2; } + +// if I<>I2 then beep; + // SetScroll4; + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + + //Play Music: + ChangeMusic; + + end + else + begin // clicked on song + if (Mode = smNormal) then //Normal Mode -> Start Song + begin + //Do the Action that is specified in Ini + case Ini.OnSongClick of + 0: StartSong; + 1: SelectPlayers; + 2:begin + If (CatSongs.CatNumShow = -3) then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end; + end; + end + else if (Mode = smPartyMode) then //PartyMode -> Show Menu + begin + if (Ini.PartyPopup = 1) then + ScreenSongMenu.MenuShow(SM_Party_Main) + else + ScreenSong.StartSong; + end; + end; + end; + end; + + SDLK_M: //Show SongMenu + begin + if (Songs.SongList.Count > 0) then begin + if (Mode = smNormal) then begin + if not CatSongs.Song[Interaction].Main then begin // clicked on Song + if CatSongs.CatNumShow = -3 then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end + else + begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); + end; + end //Party Mode -> Show Party Menu + else ScreenSongMenu.MenuShow(SM_Party_Main); + end; + end; + + SDLK_P: //Show Playlist Menu + begin + if (Songs.SongList.Count > 0) AND (Mode = smNormal) then begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); + end; + end; + + SDLK_J: //Show Jumpto Menu + begin + if (Songs.SongList.Count > 0) AND (Mode = smNormal) then + begin + ScreenSongJumpto.Visible := True; + end; + end; + + SDLK_DOWN: + begin + if (Mode = smNormal) then + begin + //Only Change Cat when not in Playlist or Search Mode + if (CatSongs.CatNumShow > -2) then + begin + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then + begin + I := Interaction; + if I <= 0 then I := 1; + + while not catsongs.Song[I].Main do + begin + Inc (I); + if (I > high(catsongs.Song)) then + I := low(catsongs.Song); + end; + + Interaction := I; + + //Show Cat in Top Left Mod + ShowCatTL (Interaction); + + CatSongs.ClickCategoryButton(Interaction); + SelectNext; + FixSelected; + + //Play Music: + AudioPlayback.PlaySound(SoundLib.Change); + ChangeMusic; + + end; + + // + //Cat Change Hack End} + end; + end; + end; + SDLK_UP: + begin + if (Mode = smNormal) then + begin + //Only Change Cat when not in Playlist or Search Mode + if (CatSongs.CatNumShow > -2) then + begin + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then + begin + I := Interaction; + I2 := 0; + if I <= 0 then I := 1; + + while not catsongs.Song[I].Main or (I2 = 0) do + begin + if catsongs.Song[I].Main then + Inc(I2); + Dec (I); + if (I < low(catsongs.Song)) then + I := high(catsongs.Song); + end; + + Interaction := I; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + + //Play Music: + AudioPlayback.PlaySound(SoundLib.Change); + ChangeMusic; + end; + end; + //Cat Change Hack End} + end; + end; + + SDLK_RIGHT: + begin + if (Songs.SongList.Count > 0) AND (Mode = smNormal) then + begin + AudioPlayback.PlaySound(SoundLib.Change); + SelectNext; +// InteractNext; +// SongTarget := Interaction; + ChangeMusic; + SetScroll4; + UpdateLCD; + Light.LightOne(1, 200); + end; + end; + + SDLK_LEFT: + begin + if (Songs.SongList.Count > 0)AND (Mode = smNormal) then begin + AudioPlayback.PlaySound(SoundLib.Change); + SelectPrev; + ChangeMusic; + SetScroll4; + UpdateLCD; + Light.LightOne(0, 200); + end; + end; + + SDLK_E: + begin + OpenEditor; + end; + + SDLK_R: + begin + if (Songs.SongList.Count > 0) AND (Mode = smNormal) then begin + + if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category + begin + I2 := 0; //Count Cats + for I:= low(CatSongs.Song) to high (CatSongs.Song) do + if CatSongs.Song[I].Main then Inc(I2); + + I2 := Random (I2)+1; //Zufall + + //Find Cat: + for I:= low(CatSongs.Song) to high (CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + Dec(I2); + if (I2<=0) then + begin + //Show Cat in Top Left Mod + ShowCatTL (I); + + Interaction := I; + + CatSongs.ShowCategoryList; + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + break; + end; + end; + + + end + else if (SDL_ModState = KMOD_LCTRL) AND (Ini.Tabs_at_startup = 1) then //random in All Categorys + begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; + + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + + //Choose Cat + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Fix: Not Existing Song selected: + //if (I+1=I2) then Inc(I2); + + //Choose Song + SkipTo(I2-I); + + end + else //Random in one Category + begin + SkipTo(Random(CatSongs.VisibleSongs)); + end; + AudioPlayback.PlaySound(SoundLib.Change); + + ChangeMusic; + SetScroll4; + UpdateLCD; + end; + end; + + SDLK_1: + begin //Jocker // to-do : Party + {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[0].Joker); + SelectRandomSong; + SetJoker; + end; } + end; + + SDLK_2: + begin //Jocker + {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[1].Joker); + SelectRandomSong; + SetJoker; + end; } + end; + + SDLK_3: + begin //Jocker + {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[2].Joker); + SelectRandomSong; + SetJoker; + end; } + end; + end; + end; +end; + +constructor TScreenSong.Create; +var +// Pet: integer; + I: integer; +//Label CreateSongButtons; +begin + inherited Create; + + LoadFromTheme(Theme.Song); + + TextArtist := AddText(Theme.Song.TextArtist); + TextTitle := AddText(Theme.Song.TextTitle); + TextNumber := AddText(Theme.Song.TextNumber); + + //Show Cat in Top Left mod + TextCat := AddText(Theme.Song.TextCat); + StaticCat := AddStatic(Theme.Song.StaticCat); + + //Show Video Icon Mod + VideoIcon := AddStatic(Theme.Song.VideoIcon); + + //Party Mode + StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1); + StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2); + StaticTeam1Joker3 := AddStatic(Theme.Song.StaticTeam1Joker3); + StaticTeam1Joker4 := AddStatic(Theme.Song.StaticTeam1Joker4); + StaticTeam1Joker5 := AddStatic(Theme.Song.StaticTeam1Joker5); + + StaticTeam2Joker1 := AddStatic(Theme.Song.StaticTeam2Joker1); + StaticTeam2Joker2 := AddStatic(Theme.Song.StaticTeam2Joker2); + StaticTeam2Joker3 := AddStatic(Theme.Song.StaticTeam2Joker3); + StaticTeam2Joker4 := AddStatic(Theme.Song.StaticTeam2Joker4); + StaticTeam2Joker5 := AddStatic(Theme.Song.StaticTeam2Joker5); + + StaticTeam3Joker1 := AddStatic(Theme.Song.StaticTeam3Joker1); + StaticTeam3Joker2 := AddStatic(Theme.Song.StaticTeam3Joker2); + StaticTeam3Joker3 := AddStatic(Theme.Song.StaticTeam3Joker3); + StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); + StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); + + //Load Party or NonParty specific Statics and Texts + SetLength(StaticParty, Length(Theme.Song.StaticParty)); + for I := 0 to High(Theme.Song.StaticParty) do + StaticParty[I] := AddStatic(Theme.Song.StaticParty[I]); + + SetLength(TextParty, Length(Theme.Song.TextParty)); + for I := 0 to High(Theme.Song.TextParty) do + TextParty[I] := AddText(Theme.Song.TextParty[I]); + + SetLength(StaticNonParty, Length(Theme.Song.StaticNonParty)); + for I := 0 to High(Theme.Song.StaticNonParty) do + StaticNonParty[I] := AddStatic(Theme.Song.StaticNonParty[I]); + + SetLength(TextNonParty, Length(Theme.Song.TextNonParty)); + for I := 0 to High(Theme.Song.TextNonParty) do + TextNonParty[I] := AddText(Theme.Song.TextNonParty[I]); + + // Song List +// Songs.LoadSongList; // moved to the UltraStar unit + CatSongs.Refresh; + + GenerateThumbnails(); +(* + if (length(CatSongs.Song) > 0) then + begin + //Set Length of Button Array one Time Instead of one time for every Song + SetButtonLength(Length(CatSongs.Song)); + + I := 0; + CreateSongButtons: + + try + for Pet := I to High(CatSongs.Song) do begin // creating all buttons + // new + Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 + + if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' + + if CatSongs.Song[Pet].Cover = '' then + AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) + else begin + // cache texture if there is a need to this + if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + begin + Texture.CreateCacheMipmap := true; + Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap + Texture.CreateCacheMipmap := false; + + // puts this texture to the cache file + Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + + // unload full size texture + Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); + + // we should also add mipmap texture by calling createtexture and use mipmap cache as data source + end; + + // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) + AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + end; + Texture.Limit := 1024*1024; + I := -1; + end; + except + //When Error is reported the First time for this Song + if (I <> Pet) then + begin + //Some Error reporting: + Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); + + //Change Cover to NoCover and Continue Loading + CatSongs.Song[Pet].Cover := ''; + I := Pet; + end + else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song + begin + Log.LogError('NoCover Cover is damaged!'); + try + AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); + except + {$IFDEF MSWINDOWS} + Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); + {$ELSE} + // TODO : JB_linux - better handle this message and display to user.. + writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'); + Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' ); + {$ENDIF} + Halt; + end; + I := Pet + 1; + end; + end; + + if (I <> -1) then + GoTo CreateSongButtons; + + end; +*) + + // Randomize Patch + Randomize; + //Equalizer + SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); + //ClearArray + For I := low(EqualizerBands) to high(EqualizerBands) do + EqualizerBands[I] := 3; + + if (Length(CatSongs.Song) > 0) then + Interaction := 0; +end; + +procedure TScreenSong.GenerateThumbnails(); +var + I : Integer; + Pet: integer; +Label CreateSongButtons; +begin + if (length(CatSongs.Song) > 0) then + begin + //Set Length of Button Array one Time Instead of one time for every Song + SetButtonLength(Length(CatSongs.Song)); + + I := 0; + CreateSongButtons: + + try + for Pet := I to High(CatSongs.Song) do begin // creating all buttons + // new + Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 + + if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' + + if CatSongs.Song[Pet].Cover = '' then + AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) + else begin + // cache texture if there is a need to this + if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + begin + Texture.CreateCacheMipmap := true; + Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap + Texture.CreateCacheMipmap := false; + + // puts this texture to the cache file + Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + + // unload full size texture + Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); + + // we should also add mipmap texture by calling createtexture and use mipmap cache as data source + end; + + // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) + AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + end; + Texture.Limit := 1024*1024; + I := -1; + end; + except + //When Error is reported the First time for this Song + if (I <> Pet) then + begin + //Some Error reporting: + Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); + + //Change Cover to NoCover and Continue Loading + CatSongs.Song[Pet].Cover := ''; + I := Pet; + end + else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song + begin + Log.LogError('NoCover Cover is damaged!'); + try + AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); + except + {$IFDEF MSWINDOWS} + Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); + {$ELSE} + // TODO : JB_linux - better handle this message and display to user.. + writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'); + Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' ); + {$ENDIF} + Halt; + end; + I := Pet + 1; + end; + end; + + if (I <> -1) then + GoTo CreateSongButtons; + + end; +end; + +procedure TScreenSong.SetScroll; +var + VS, B: Integer; +begin + VS := CatSongs.VisibleSongs; + if VS > 0 then + begin + //Set Positions + Case Theme.Song.Cover.Style of + 3: SetScroll3; + 5:begin + if VS > 5 then + SetScroll5 + else + SetScroll4; + end; + 6: SetScroll6; + else SetScroll4; + end; + //Set Visibility of Video Icon + Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> ''); + + //Set Texts: + Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; + Text[TextTitle].Text := CatSongs.Song[Interaction].Title; + if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then + begin + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); + Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; + end + else if (CatSongs.CatNumShow = -2) then + Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) + else if (CatSongs.CatNumShow = -3) then + Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) + else if (Ini.Tabs_at_startup = 1) then + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) + else + Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); + end + else + begin + Text[TextNumber].Text := '0/0'; + Text[TextArtist].Text := ''; + Text[TextTitle].Text := ''; + for B := 0 to High(Button) do + Button[B].Visible := False; + + end; +end; + +procedure TScreenSong.SetScroll1; +var + B: integer; // button + BMin: integer; // button min + BMax: integer; // button max + Src: integer; +// Dst: integer; + Count: integer; // Dst is not used. Count is used. + Ready: boolean; + + VisCount: integer; // count of visible (or selectable) buttons + VisInt: integer; // visible position of interacted button + Typ: integer; // 0 when all songs fits the screen + Placed: integer; // number of placed visible buttons +begin +// Src := 0; +// Dst := -1; + Count := 1; + Typ := 0; + Ready := false; + Placed := 0; + + VisCount := 0; + for B := 0 to High(Button) do + if CatSongs.Song[B].Visible then Inc(VisCount); + + VisInt := 0; + for B := 0 to Interaction-1 do + if CatSongs.Song[B].Visible then Inc(VisInt); + + + if VisCount <= 6 then begin + Typ := 0; + end else begin + if VisInt <= 3 then begin + Typ := 1; + Count := 7; + Ready := true; + end; + + if (VisCount - VisInt) <= 3 then begin + Typ := 2; + Count := 7; + Ready := true; + end; + + if not Ready then begin + Typ := 3; + Src := Interaction; + end; + end; + + + + // hide all buttons + for B := 0 to High(Button) do begin + Button[B].Visible := false; + Button[B].Selectable := CatSongs.Song[B].Visible; + end; + +{ for B := Src to Dst do begin +// Button[B].Visible := true; + Button[B].Visible := CatSongs.Song[B].Visible; + Button[B].Selectable := Button[B].Visible; + Button[B].Y := 140 + (B-Src) * 60; + end;} + + + if Typ = 0 then begin + for B := 0 to High(Button) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (Placed) * 60; + Inc(Placed); + end; + end; + end; + + if Typ = 1 then begin + B := 0; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Inc(B); + end; + end; + + if Typ = 2 then begin + B := High(Button); + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (6-Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Dec(B); + end; + end; + + if Typ = 3 then begin + B := Src; + Count := 4; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (3+Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Inc(B); + end; + + B := Src-1; + Placed := 0; + Count := 3; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (2-Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Dec(B); + end; + + end; + + if Length(Button) > 0 then + Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture +end; + +procedure TScreenSong.SetScroll2; +var + B: integer; + Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu + Wsp2: real; +begin + // liniowe + for B := 0 to High(Button) do + Button[B].X := 300 + (B - Interaction) * 260; + + if Length(Button) >= 3 then begin + if Interaction = 0 then + Button[High(Button)].X := 300 - 260; + + if Interaction = High(Button) then + Button[0].X := 300 + 260; + end; + + // kolowe +{ for B := 0 to High(Button) do begin + Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. + Wsp2 := Wsp / Length(Button); + Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); +// Button[B].Y := 140 + 50 * ; + end;} +end; + +procedure TScreenSong.SetScroll3; // with slide +var + B: integer; + Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu + Wsp2: real; +begin + SongTarget := Interaction; + + // liniowe + for B := 0 to High(Button) do + begin + Button[B].X := 300 + (B - SongCurrent) * 260; + if (Button[B].X < -Button[B].W) OR (Button[B].X > 800) then + Button[B].Visible := False + else + Button[B].Visible := True; + end; + +{ if Length(Button) >= 3 then begin + if Interaction = 0 then + Button[High(Button)].X := 300 - 260; + + if Interaction = High(Button) then + Button[0].X := 300 + 260; + end;} + + // kolowe +{ for B := 0 to High(Button) do begin + Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. + Wsp2 := Wsp / Length(Button); + Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); +// Button[B].Y := 140 + 50 * ; + end;} +end; + +procedure TScreenSong.SetScroll4; // rotate +var + B: integer; + Wsp: real; + Z, Z2: real; + VS: integer; +begin + VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important + + // kolowe + for B := 0 to High(Button) do begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2; + Z2 := (1 + 2*Z) / 3; + + + Button[B].X := Theme.Song.Cover.X + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z / 2 + 0.3; + + Button[B].W := Theme.Song.Cover.H * Z2; + +// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; + Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; + Button[B].H := Button[B].W; + end; + end; +end; + +(* +procedure TScreenSong.SetScroll4; // rotate +var + B: integer; + Wsp: real; + Z: real; + Z2, Z3: real; + VS: integer; + function modreal (const X, Y: real):real; + begin + Result := Frac(x / y) * y; + if Result < -3 then + Result := Result + Y + else if Result > 3 then + Result := Result - Y; + end; +begin + VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important + Z3 := 1; + if VS < 12 then + Z2 := VS + else + Z2 := 12; + + // kolowe + for B := 0 to High(Button) do begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + if ((ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)>-3) AND (ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)<3)) then + begin + if CatSongs.VisibleIndex(B)> SongCurrent then + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2 + else + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2; + + Z3 := 2; + Z := (1 + cos(Wsp)) / 2; + //Z2 := (1 + 2*Z) / 3; + //Z2 := (0.5 + Z/2); + //Z2 := sin(Wsp); + + //Z2 := Power (Z2,Z3); + + Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); + + //Button[B].X := Theme.Song.CoverX + ({Theme.Song.CoverX + Theme.Song.CoverW/2 + Theme.Song.CoverW*0.18 * VS {CatSongs.VisibleSongs {Length(Button) * sin(Wsp) {- Theme.Song.CoverX - Theme.Song.CoverW) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + if (sin(Wsp)<0) then + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W + else //*Theme.Song.CoverW*0.004*Z3 + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; + Button[B].Z := Z-0.00001; + +// Button[B].Y := {50 + 140 + 50 - 50 * Z2; + // Button[B].Y := (Theme.Song.CoverY + 40 + 50 - 50 * Z2); + Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); + Button[B].H := Button[B].W; + Button[B].Visible := True; + end + {else if (((CatSongs.VisibleIndex(B) - SongCurrent)>-3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) OR ((round (CatSongs.VisibleIndex(B) - SongCurrent) mod VS > -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) then + begin + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / 12 ;// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2 -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); + + if (sin(Wsp)<0) then + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W + else + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; + + Button[B].Z := Z; + + Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); + + Button[B].H := Button[B].W; + Button[B].Visible := True; + end + else Button[B].Visible := False; + end; + end; +end; *) + +procedure TScreenSong.SetScroll5; // rotate +var + B: integer; + Angle: real; + Pos: Real; + VS: integer; + diff: real; + X: Real; + helper: real; +begin + VS := CatSongs.VisibleSongs; // cache Visible Songs + {Vars + Theme.Song.CoverW: Radius des Kreises + Theme.Song.CoverX: X Pos Linke Kante des gewählten Covers + Theme.Song.CoverX: Y Pos Obere Kante des gewählten Covers + Theme.Song.CoverH: Höhe der Cover + + (CatSongs.VisibleIndex(B) - SongCurrent)/VS = Abstand zum MIttleren Cover in % + } + + //Change Pos of all Buttons + for B := low(Button) to high(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility + if Button[B].Visible then //Only Change Pos for Visible Buttons + begin + Pos := (CatSongs.VisibleIndex(B) - SongCurrent); + if (Pos < -VS/2) then + Pos := Pos + VS + else if (Pos > VS/2) then + Pos := Pos - VS; + + if (Abs(Pos) < 2.5) then {fixed Positions} + begin + Angle := Pi * (Pos / 5); +// Button[B].Visible := False; + + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); + +// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Z := 0.95 - Abs(Pos) * 0.01; + + Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); + + Button[B].W := Button[B].H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + + X := Sin(Angle*1.3)*0.9; + + Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Diff; + + end + else + begin {Behind the Front Covers} + + // limit-bg-covers hack + if (abs(abs(Pos)-VS/2)>10) then Button[B].Visible:=False; + // end of limit-bg-covers hack + + if Pos < 0 then + Pos := (Pos - VS/2)/VS + else + Pos := (Pos + VS/2)/VS; + + Angle := pi * Pos*2; + if VS > 24 then + begin + if Angle < 0 then helper:=-1 else helper:=1; + Angle:=2*pi-abs(Angle); + Angle:=Angle*(VS/24); + Angle:=(2*pi-Angle)*helper; + end; + + Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); + + Button[B].W := Button[B].H; + + Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; + +// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*((Theme.Song.Cover.H)*sin(Angle/2)*1.52); + + end; + + //Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field +// Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); + + end; + end; +end; + +procedure TScreenSong.SetScroll6; // rotate (slotmachine style) +var + B: integer; + Angle: real; + Pos: Real; + VS: integer; + diff: real; + X: Real; + Wsp: real; + Z, Z2: real; +begin + VS := CatSongs.VisibleSongs; // cache Visible Songs + if VS <=5 then begin + // kolowe + for B := 0 to High(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2; + Z2 := (1 + 2*Z) / 3; + + + Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z / 2 + 0.3; + + Button[B].W := Theme.Song.Cover.H * Z2; + +// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; + Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; + Button[B].H := Button[B].W; + end; + end; + end + else begin + + //Change Pos of all Buttons + for B := low(Button) to high(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility + if Button[B].Visible then //Only Change Pos for Visible Buttons + begin + Pos := (CatSongs.VisibleIndex(B) - SongCurrent); + if (Pos < -VS/2) then + Pos := Pos + VS + else if (Pos > VS/2) then + Pos := Pos - VS; + + if (Abs(Pos) < 2.5) then {fixed Positions} + begin + Angle := Pi * (Pos / 5); +// Button[B].Visible := False; + + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); + + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Z := 0.95 - Abs(Pos) * 0.01; + + Button[B].X := (Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); + + Button[B].W := Button[B].H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + + X := Sin(Angle*1.3)*0.9; + + Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff; + end + else + begin {Behind the Front Covers} + + // limit-bg-covers hack + if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; + if VS > 25 then VS:=25; + // end of limit-bg-covers hack + + if Pos < 0 then + Pos := (Pos - VS/2)/VS + else + Pos := (Pos + VS/2)/VS; + + Angle := pi * Pos*2; + + Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); + + Button[B].W := Button[B].H; + + Button[B].X := Theme.Song.Cover.X - (Button[B].H - Theme.Song.Cover.H)*0.5; + + + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Y := Theme.Song.Cover.Y+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*(Theme.Song.Cover.H*sin(Angle/2)*1.52); + end; + end; + end; + end; +end; + + +procedure TScreenSong.onShow; +begin + AudioPlayback.Stop; + + if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; + if Ini.Players = 4 then PlayersPlay := 6; + + //Cat Mod etc + if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then + begin + CatSongs.ShowCategoryList; + FixSelected; + //Show Cat in Top Left Mod + HideCatTL; + end; + + + if Length(CatSongs.Song) > 0 then begin + //Load Music only when Song Preview is activated + if ( Ini.PreviewVolume <> 0 ) then + begin + if(AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3)) then + begin + AudioPlayback.SetLoop(false); + AudioPlayback.Position := AudioPlayback.Length / 4; + AudioPlayback.Play; + + //Set Preview Volume + AudioPlayback.SetMusicVolume (Ini.PreviewVolume * 10); + {//if Music Fade is activated, Set Volume to 0 % + if (Ini.PreviewFading <> 0) then + Music.SetMusicVolume(0);} + end; + end; + + SetScroll; + UpdateLCD; + end; + + //Playlist Mode + if (Mode = smNormal) then + begin + //If Playlist Shown -> Select Next automatically + if (CatSongs.CatNumShow = -3) then + begin + SelectNext; + ChangeMusic; + end; + end + //Party Mode + else if (Mode = smPartyMode) then + begin + + SelectRandomSong; + //Show Menu directly in PartyMode + //But only if selected in Options + if (Ini.PartyPopup = 1) then + begin + ScreenSongMenu.MenuShow(SM_Party_Main); + end; + + + end; + + SetJoker; + SetStatics; +end; + +procedure TScreenSong.onHide; +begin + //When Music Fading is activated, Turn Music to 100 % + If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then + AudioPlayback.SetMusicVolume(100); + + //If Preview is deactivated: Load MUsicfile now + If (Ini.PreviewVolume = 0) then + AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + + //When hide then Stop Music (For Party Mode Popup on Exit) + if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (AudioPlayback <> nil) then + AudioPlayback.Stop; +end; + +procedure TScreenSong.DrawExtensions; +begin + //Draw Song Menu + if (ScreenSongMenu.Visible) then + begin + ScreenSongMenu.Draw; + end + else if (ScreenSongJumpto.Visible) then + begin + ScreenSongJumpto.Draw; + end +end; + +function TScreenSong.Draw: boolean; +var + dx: real; + dt: real; + I: Integer; +begin + dx := SongTarget-SongCurrent; + dt := TimeSkip * 7; + +// writeln( 'TScreenSong.Draw '+ inttostr(trunc(TimeSkip)) ); + + if dt > 1 then + dt := 1; + + SongCurrent := SongCurrent + dx*dt; + +{ if SongCurrent > Catsongs.VisibleSongs then begin + SongCurrent := SongCurrent - Catsongs.VisibleSongs; + SongTarget := SongTarget - Catsongs.VisibleSongs; + end;} + +// Log.BenchmarkStart(5); + SetScroll; +// Log.BenchmarkEnd(5); +// Log.LogBenchmark('SetScroll4', 5); + + //Fading Functions, Only if Covertime is under 5 Seconds + If (CoverTime < 5) then + begin + // 0.5.0: cover fade + if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then + begin + // load new texture + Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture.Alpha := 1; + Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture2.Alpha := 1; + end; + + //Song Fade + if (CatSongs.VisibleSongs > 0) AND (Ini.PreviewVolume <> 0) AND (Not CatSongs.Song[Interaction].Main) AND (Ini.PreviewFading <> 0) then + begin + //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling + if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then + AudioPlayback.Play; + + //Update Song Volume + if (CoverTime < Ini.PreviewFading) then + AudioPlayback.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) + else + AudioPlayback.SetMusicVolume(Ini.PreviewVolume * 10); + + end; + + + //Update Fading Time + CoverTime := CoverTime + TimeSkip; + + //Update Fading Texture + Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; + if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; + + end; + + //inherited Draw; + //heres a little Hack, that causes the Statics + //are Drawn after the Buttons because of some Blending Problems. + //This should cause no Problems because all Buttons on this screen + //Has Z Position. + //Draw BG + DrawBG; + + //Instead of Draw FG Procedure: + //We draw Buttons for our own + for I := 0 to Length(Button) - 1 do + Button[I].Draw; + + // Statics + for I := 0 to Length(Static) - 1 do + Static[I].Draw; + + // and texts + for I := 0 to Length(Text) - 1 do + Text[I].Draw; + + + //Draw Equalizer + if Theme.Song.Equalizer.Visible then + DrawEqualizer; + + DrawExtensions; + +end; + +procedure TScreenSong.SelectNext; +var + Skip: integer; + I: integer; + VS: Integer; +begin + VS := CatSongs.VisibleSongs; + + if VS > 0 then + begin + UnLoadDetailedCover; + + Skip := 1; + + // this 1 could be changed by CatSongs.FindNextVisible + while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); + + SongTarget := SongTarget + 1;//Skip; + + Interaction := (Interaction + Skip) mod Length(Interactions); + + // try to keep all at the beginning + if SongTarget > VS-1 then begin + SongTarget := SongTarget - VS; + SongCurrent := SongCurrent - VS; + end; + + end; + // Interaction -> Button, ktorego okladke przeczytamy + // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture +end; + +procedure TScreenSong.SelectPrev; +var + Skip: integer; + I: integer; + VS: Integer; +begin + VS := CatSongs.VisibleSongs; + + if VS > 0 then + begin + UnLoadDetailedCover; + + Skip := 1; + + while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); + SongTarget := SongTarget - 1;//Skip; + + Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); + + // try to keep all at the beginning + if SongTarget < 0 then begin + SongTarget := SongTarget + CatSongs.VisibleSongs; + SongCurrent := SongCurrent + CatSongs.VisibleSongs; + end; + + // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture + end; +end; + +procedure TScreenSong.UpdateLCD; +begin + LCD.HideCursor; + LCD.Clear; + LCD.WriteText(1, Text[TextArtist].Text); + LCD.WriteText(2, Text[TextTitle].Text); +end; + +//Procedure Change current played Preview +procedure TScreenSong.ChangeMusic; +begin + //When Music Preview is avtivated -> then Change Music + if (Ini.PreviewVolume <> 0) then + begin + if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then + begin + AudioPlayback.Close; + if AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + AudioPlayback.Position := AudioPlayback.Length / 4; + //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal + if (Ini.PreviewFading = 0) then + AudioPlayback.Play + else + AudioPlayback.SetMusicVolume(0); + end; + end + else + AudioPlayback.Stop; + end; +end; + +procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0 +var + Skip: integer; + I: integer; +begin + UnLoadDetailedCover; + + Interaction := High(CatSongs.Song); + SongTarget := 0; + + for I := 1 to Target+1 do + SelectNext; + + FixSelected2; +end; + +procedure TScreenSong.DrawEqualizer; +var + I, J: Integer; + Res: byte; + A, B: Integer; + PosX, PosY: Integer; + Pos: Real; + lTmp : double; +begin + +if (not AudioPlayback.Finished) AND (Theme.Song.Equalizer.Length > 0) then +begin + + {$ifdef win32} + A := GetTickCount div 44; + + if (A <> EqualizerTime) then + begin + EqualizerTime := A; + AudioPlayback.GetFFTData(EqualizerData); + + B := 0; + Pos := 0; + Res := ceil(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band + + //Change Lengths + for I := 0 to (Res * Theme.Song.Equalizer.Bands - 1) do + begin + A := floor(I/Res); + + if (A<>B) then //Band changed + begin + if (Pos <= Theme.Song.Equalizer.Length) then + begin + if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then + EqualizerBands[B] := EqualizerBands[B] - 1 + else + EqualizerBands[B] := floor(Pos); + end + else + EqualizerBands[B] := 1; + + B := A; + Pos := 0; + end; + + if I > 35 then + EqualizerData[i] := EqualizerData[i] * 8 + else if I > 11 then + EqualizerData[i] := EqualizerData[i] * 4.5 + else + EqualizerData[i] := EqualizerData[i] * 1.1; + + if (EqualizerData[i] >= 1) then + EqualizerData[i] := 0.9999999999999; + + try + if ( assigned( Theme ) ) AND + ( assigned( Theme.Song ) ) AND + ( i < length( EqualizerData ) ) THEN + begin + if single( EqualizerData[i] ) > 1 then + begin + lTmp := Single(EqualizerData[i]) * Theme.Song.Equalizer.Length; + if lTmp > Pos then + Pos := lTmp; + end; + end; + except + {$IFDEF FPC} + on E:EInvalidOp do + writeln( 'UScreenSong - DOH !!!! ('+inttostr(i)+' '+ inttostr( integer( EqualizerData[i] ) )+' * '+ ')' ); + {$ENDIF} + end + + end; + + //Change Last Band + if (EqualizerBands[B] <= Theme.Song.Equalizer.Length) then + begin + if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then + EqualizerBands[B] := EqualizerBands[B] - 1 + else + EqualizerBands[B] := floor(Pos) + end + else + EqualizerBands[B] := 1; + end; + {$endif} + + //Draw every Channel + glColor4f(Theme.Song.Equalizer.ColR, Theme.Song.Equalizer.ColG, Theme.Song.Equalizer.ColB, Theme.Song.Equalizer.Alpha); //Set Color + glDisable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + + PosY := Theme.Song.Equalizer.Y; + PosX := Theme.Song.Equalizer.X; + + For I := 0 to Theme.Song.Equalizer.Bands-1 do + begin + if Theme.Song.Equalizer.Direction then + PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length + else + PosX := Theme.Song.Equalizer.X; + //Draw for every visible quad + for J := 1 to EqualizerBands[I] do + begin + glBegin(GL_QUADS); + glVertex3f(PosX, PosY, Theme.Song.Equalizer.Z); + glVertex3f(PosX, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); + glVertex3f(PosX+Theme.Song.Equalizer.W, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); + glVertex3f(PosX+Theme.Song.Equalizer.W, PosY, Theme.Song.Equalizer.Z); + glEnd; + + if Theme.Song.Equalizer.Direction then //Vertically + PosY := PosY - Theme.Song.Equalizer.H - Theme.Song.Equalizer.Space + else //Horizontally + PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space; + end; + if Theme.Song.Equalizer.Direction then //Horizontally + PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space + else //Vertically + PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space; + end; +end; +end; + +Procedure TScreenSong.SelectRandomSong; +var + I, I2: Integer; +begin + Case PlaylistMan.Mode of + smNormal: //All Songs Just Select Random Song + begin + //When Tabs are activated then use Tab Method + if (Ini.Tabs_at_startup = 1) then + begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; + + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + //I is the CatNum, I2 is the No of the Song within this Cat + + //Choose Cat + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Choose Song + SkipTo(I2-I); + end + //When Tabs are deactivated use easy Method + else + SkipTo(Random(CatSongs.VisibleSongs)); + end; + smPartyMode: //One Category Select Category and Select Random Song + begin + CatSongs.ShowCategoryList; + CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); + ShowCatTL(PlaylistMan.CurPlayList); + + SelectNext; + FixSelected2; + + SkipTo(Random(CatSongs.VisibleSongs)); + end; + smPlaylistRandom: //Playlist: Select Playlist and Select Random Song + begin + PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); + + SkipTo(Random(CatSongs.VisibleSongs)); + FixSelected2; + end; + end; + + AudioPlayback.PlaySound(SoundLib.Change); + ChangeMusic; + SetScroll; + UpdateLCD; +end; + +procedure TScreenSong.SetJoker; +begin + {//If Party Mode + // to-do : Party + if Mode = smPartyMode then //Show Joker that are available + begin + if (PartySession.Teams.NumTeams >= 1) then + begin + Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1); + Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2); + Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3); + Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4); + Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5); + end + else + begin + Static[StaticTeam1Joker1].Visible := False; + Static[StaticTeam1Joker2].Visible := False; + Static[StaticTeam1Joker3].Visible := False; + Static[StaticTeam1Joker4].Visible := False; + Static[StaticTeam1Joker5].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 2) then + begin + Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1); + Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2); + Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3); + Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4); + Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5); + end + else + begin + Static[StaticTeam2Joker1].Visible := False; + Static[StaticTeam2Joker2].Visible := False; + Static[StaticTeam2Joker3].Visible := False; + Static[StaticTeam2Joker4].Visible := False; + Static[StaticTeam2Joker5].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 3) then + begin + Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1); + Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2); + Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3); + Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4); + Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5); + end + else + begin + Static[StaticTeam3Joker1].Visible := False; + Static[StaticTeam3Joker2].Visible := False; + Static[StaticTeam3Joker3].Visible := False; + Static[StaticTeam3Joker4].Visible := False; + Static[StaticTeam3Joker5].Visible := False; + end; + end + else + begin //Hide all + Static[StaticTeam1Joker1].Visible := False; + Static[StaticTeam1Joker2].Visible := False; + Static[StaticTeam1Joker3].Visible := False; + Static[StaticTeam1Joker4].Visible := False; + Static[StaticTeam1Joker5].Visible := False; + + Static[StaticTeam2Joker1].Visible := False; + Static[StaticTeam2Joker2].Visible := False; + Static[StaticTeam2Joker3].Visible := False; + Static[StaticTeam2Joker4].Visible := False; + Static[StaticTeam2Joker5].Visible := False; + + Static[StaticTeam3Joker1].Visible := False; + Static[StaticTeam3Joker2].Visible := False; + Static[StaticTeam3Joker3].Visible := False; + Static[StaticTeam3Joker4].Visible := False; + Static[StaticTeam3Joker5].Visible := False; + end; } +end; + +procedure TScreenSong.SetStatics; +var + I: Integer; + Visible: Boolean; +begin + //Set Visibility of Party Statics and Text + Visible := (Mode = smPartyMode); + + For I := 0 to high(StaticParty) do + Static[StaticParty[I]].Visible := Visible; + + For I := 0 to high(TextParty) do + Text[TextParty[I]].Visible := Visible; + + //Set Visibility of Non Party Statics and Text + Visible := not Visible; + + For I := 0 to high(StaticNonParty) do + Static[StaticNonParty[I]].Visible := Visible; + + For I := 0 to high(TextNonParty) do + Text[TextNonParty[I]].Visible := Visible; +end; + +//Procedures for Menu + +procedure TScreenSong.StartSong; +begin + CatSongs.Selected := Interaction; + AudioPlayback.Stop; + //Party Mode + if (Mode = smPartyMode) then + begin + FadeTo(@ScreenSingModi); + end + else + begin + FadeTo(@ScreenSing); + end; +end; + +procedure TScreenSong.SelectPlayers; +begin + CatSongs.Selected := Interaction; + AudioPlayback.Stop; + + ScreenName.Goto_SingScreen := True; + FadeTo(@ScreenName); +end; + +procedure TScreenSong.OpenEditor; +begin + if (Songs.SongList.Count > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = smNormal) then + begin + AudioPlayback.Stop; + AudioPlayback.PlaySound(SoundLib.Start); + CurrentSong := CatSongs.Song[Interaction]; + FadeTo(@ScreenEditSub); + end; +end; + +//Team No of Team (0-5) +procedure TScreenSong.DoJoker (Team: Byte); +begin + {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[Team].Joker); + SelectRandomSong; + SetJoker; + end; } +end; + +//Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song +procedure TScreenSong.UnLoadDetailedCover; +begin + CoverTime := 0; + + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture + Button[Interaction].Texture2.Alpha := 0; + + if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then + Texture.UnloadTexture(Button[Interaction].Texture.Name, false); +end; + +procedure TScreenSong.Refresh; +begin { +CatSongs.Refresh; +CatSongs.ShowCategoryList; +Interaction := 0; +SelectNext; +FixSelected; } + +end; + +end. -- cgit v1.2.3 From 0cff62ed5ea1e4964817bc6efdff523f7b63342e Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 21:53:12 +0000 Subject: bugfix: ResetSingTemp prevented a song from being played twice ("File not found" error). The error is due the change of TSong from a record to a class. This is because CurrentSong = CatSongs.Song[index] won't copy the whole data anymore but just a pointer. So the paths of CatSongs.Song[index] will be set to '' too what is not desired. Jay: Please revise this. If i remember correctly you wanted to set CurrentSong to nil instead of setting the paths to an empty string. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@830 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UFiles.pas | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index b65dcbf2..495e8a4a 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -51,6 +51,7 @@ begin Player[pet].HighNut := -1; end; + (* FIXME //Reset Path and Filename Values to Prevent Errors in Editor if assigned( CurrentSong ) then begin @@ -58,6 +59,7 @@ begin CurrentSong.Path := ''; CurrentSong.FileName := ''; end; + *) // CurrentSong := nil; end; -- cgit v1.2.3 From 250c2dc22419d2b2101bbb6d69aa5d52e2479a6e Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 21:55:59 +0000 Subject: updated configure stuff git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@831 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Makefile.in | 29 +++++++--- Game/Code/config.inc.in | 134 +++++++++++++++------------------------------ Game/Code/configure.ac | 143 ++++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 191 insertions(+), 115 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Makefile.in b/Game/Code/Makefile.in index b702f8d6..5df6c737 100644 --- a/Game/Code/Makefile.in +++ b/Game/Code/Makefile.in @@ -1,5 +1,6 @@ ## # Makefile for @PACKAGE_NAME@ @PACKAGE_VERSION@ +# @AUTOCONF_INFO@ # @PACKAGE_BUGREPORT@ ## @@ -12,6 +13,7 @@ infodir = @infodir@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ datarootdir = @datarootdir@ +VPATH = @srcdir@ # install tool INSTALL = @INSTALL@ @@ -21,6 +23,8 @@ LN_S = @LN_S@ USDX_PREFIX = UltraStar USDX_TOOLS_DIR = ../../Tools + + EXE_SUFFIX = @EXEEXT@ # Free Pascal compiler @@ -83,26 +87,33 @@ USDX_BIN = $(USDX_PREFIX)$(EXE_SUFFIX) # name of resource USDX_RES = $(USDX_PREFIX)$(RES_SUFFIX) -.PHONY: all resources ultrastar install uninstall clean distclean clean_obj clean_res +.PHONY: all resources ultrastardx-app install uninstall clean distclean clean_obj clean_res -all: resources ultrastar +all: resources ultrastardx-app resources: $(USDX_RES) -# we need to rebuild everything, fpc does some sort of caching of old files, -# so we have to delete all the old stuff first -ultrastar: clean_obj +ultrastardx-app: $(USDX_BIN) + +# Clean and rebuild everything because FPC caches some old files +# (it uses an .inc-files cache for example). +# As a result FPC misses some changes if it is called without cleaning +# up first (very annoying while debugging). +$(USDX_BIN): + $(MAKE) clean_obj mkdir -p $(PCUNIT_DIR) $(PPC) $(PFLAGS) $(PINC_FLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS) -o$(USDX_BIN) $(USDX_SRC) install: all +# TODO: copy files to the appropriate places # $()/mkinstalldirs $(bindir) # $()/mkinstalldirs $(libdir) # $()/mkinstalldirs $(infodir) - mv $(OUTPUT) ../.. + mv $(USDX_BIN) ../.. # $(INSTALL) $(USDX_BIN) $(bindir)/$(USDX_BIN) uninstall: +# TODO: remove installed files # rm -f ... echo "Comming soon!" @@ -116,7 +127,7 @@ distclean: clean rm -f config.inc config.log config.status configure clean_obj: - find "$(PCUNIT_DIR)" -name "*.o" -o -name "*.ppu" -o -name "*.rst" | xargs rm -f + find "$(PCUNIT_DIR)" -name "*.o" -o -name "*.ppu" -o -name "*.rst" -o -name "*.compiled" | xargs rm -f rm -f $(OUTPUT) clean_res: @@ -128,7 +139,7 @@ $(USDX_RES): $(RESCOMPILER_BIN) $(USDX_PREFIX).rc $(RESCOMPILER_BIN): $(RESCOMPILER_SRC) $(PPC) $(RESCOMPILER_PFLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS) -o$@ $(RESCOMPILER_SRC) -configure: configure.ac aclocal.m4 +configure: configure.ac config.inc.in aclocal.m4 autoconf aclocal.m4: m4/* @@ -138,4 +149,4 @@ Makefile: Makefile.in config.status ./config.status config.status: configure - ./config.status --recheck \ No newline at end of file + ./config.status --recheck diff --git a/Game/Code/config.inc.in b/Game/Code/config.inc.in index eaa37de7..a0bece8a 100644 --- a/Game/Code/config.inc.in +++ b/Game/Code/config.inc.in @@ -1,127 +1,83 @@ -// Configuration include file for @PACKAGE_NAME@ @PACKAGE_VERSION@ -// @PACKAGE_BUGREPORT@ +{***************************************************************** + * Configuration file for @PACKAGE_NAME@ @PACKAGE_VERSION@ + *****************************************************************} + +{* Misc options *} -// Note on version comparison: -// ------------------------------------------------------------------- -// Delphi (in contrast to FPC) DOESN'T support MACROS. So we -// can't define a macro like VERSION_MAJOR(version) to extract -// parts of the version-number or to create version numbers for -// comparison purposes as with a MAKE_VERSION(maj, min, rev) macro. -// So we have to define constants for every part of the version here. -// -// In addition FPC (in contrast to delphi) DOESN'T support floating- -// point numbers in $IF compiler-directives (e.g. {$IF VERSION > 1.23}) -// It also DOESN'T support arithmetic operations so we aren't able to -// compare versions this way (brackets aren't supported too): -// {$IF VERSION > ((VER_MAJ*2)+(VER_MIN*23)+(VER_REL*1))} -// -// Hence we have to use fixed numbers in the directives. At least -// Pascal allows leading 0s so 0005 equals 5 (octals are -// preceded by & and not by 0 in FPC). -// We also fix the count of digits for each part of the version number -// to 3 (aaaiiirrr with aaa=major, iii=minor, rrr=release version) -// -// A check for a library with at least a version of 2.5.11 would look -// like this: -// {$IF LIB_VERSION >= 002005011} -// -// If you just need to check the major version to this: -// {$IF LIB_VERSION_MAJOR >= 23} -// -// PLEASE consider this if you use version numbers in $IF compiler- -// directives. Otherwise you might break portability. -// ------------------------------------------------------------------- - {$@DEFINE_DEBUG@ DEBUG} -const - VERSION_MAJOR = 1000000; - VERSION_MINOR = 1000; - VERSION_RELEASE = 1; +{* Paths *} + +PathSuffix : WideString = '@suffix@'; +LogPath : WideString = '@logrootdir@/'+USDXPathSuffix+'/'; +SharedPath : WideString = '@datarootdir@/'+USDXPathSuffix+'/'; - FPC_VERSION_MAJOR = @FPC_VERSION_MAJOR@; - FPC_VERSION_MINOR = @FPC_VERSION_MINOR@; - FPC_VERSION_RELEASE = @FPC_VERSION_RELEASE@; - FPC_VERSION = (FPC_VERSION_MAJOR * VERSION_MAJOR) + - (FPC_VERSION_MINOR * VERSION_MINOR) + - (FPC_VERSION_RELEASE * VERSION_RELEASE); +{* Libraries *} +{$IF Defined(LAZARUS) and Defined(IncludeConstants)} LAZARUS_VERSION_MAJOR = @LAZARUS_VERSION_MAJOR@; LAZARUS_VERSION_MINOR = @LAZARUS_VERSION_MINOR@; LAZARUS_VERSION_RELEASE = @LAZARUS_VERSION_RELEASE@; - LAZARUS_VERSION = (LAZARUS_VERSION_MAJOR * VERSION_MAJOR) + - (LAZARUS_VERSION_MINOR * VERSION_MINOR) + - (LAZARUS_VERSION_RELEASE * VERSION_RELEASE); - - {$@DEFINE_HAVE_FFMPEG@ HaveFFMpeg} - {$IFDEF HaveFFMpeg} +{$IFEND} - av__codec = '@AVCODEC_LIB@'; +{$@DEFINE_HAVE_FFMPEG@ HaveFFMpeg} +{$IF Defined(HaveFFMpeg) and Defined(IncludeConstants)} + av__codec = 'libavcodec'; + //av__codec = '@AVCODEC_LIB@'; LIBAVCODEC_VERSION_MAJOR = @AVCODEC_VERSION_MAJOR@; LIBAVCODEC_VERSION_MINOR = @AVCODEC_VERSION_MINOR@; LIBAVCODEC_VERSION_RELEASE = @AVCODEC_VERSION_RELEASE@; - LIBAVCODEC_VERSION = (LIBAVCODEC_VERSION_MAJOR * VERSION_MAJOR) + - (LIBAVCODEC_VERSION_MINOR * VERSION_MINOR) + - (LIBAVCODEC_VERSION_RELEASE * VERSION_RELEASE); - av__format = '@AVFORMAT_LIB@'; + av__format = 'libavformat'; + //av__format = '@AVFORMAT_LIB@'; LIBAVFORMAT_VERSION_MAJOR = @AVFORMAT_VERSION_MAJOR@; LIBAVFORMAT_VERSION_MINOR = @AVFORMAT_VERSION_MINOR@; LIBAVFORMAT_VERSION_RELEASE = @AVFORMAT_VERSION_RELEASE@; - LIBAVFORMAT_VERSION = (LIBAVFORMAT_VERSION_MAJOR * VERSION_MAJOR) + - (LIBAVFORMAT_VERSION_MINOR * VERSION_MINOR) + - (LIBAVFORMAT_VERSION_RELEASE * VERSION_RELEASE); - av__util = '@AVUTIL_LIB@'; + av__util = 'libavutil'; + //av__util = '@AVUTIL_LIB@'; LIBAVUTIL_VERSION_MAJOR = @AVUTIL_VERSION_MAJOR@; LIBAVUTIL_VERSION_MINOR = @AVUTIL_VERSION_MINOR@; LIBAVUTIL_VERSION_RELEASE = @AVUTIL_VERSION_RELEASE@; - LIBAVUTIL_VERSION = (LIBAVUTIL_VERSION_MAJOR * VERSION_MAJOR) + - (LIBAVUTIL_VERSION_MINOR * VERSION_MINOR) + - (LIBAVUTIL_VERSION_RELEASE * VERSION_RELEASE); +{$IFEND} - {$ENDIF} - - {$@DEFINE_HAVE_SWSCALE@ HaveSWScale} - {$IFDEF HaveSWScale} - sw__scale = '@SWSCALE_LIB@'; +{$@DEFINE_HAVE_SWSCALE@ HaveSWScale} +{$IF Defined(HaveSWScale) and Defined(IncludeConstants)} + sw__scale = 'libswscale'; + //sw__scale = '@SWSCALE_LIB@'; LIBSWSCALE_VERSION_MAJOR = @SWSCALE_VERSION_MAJOR@; LIBSWSCALE_VERSION_MINOR = @SWSCALE_VERSION_MINOR@; LIBSWSCALE_VERSION_RELEASE = @SWSCALE_VERSION_RELEASE@; - LIBSWSCALE_VERSION = (LIBSWSCALE_VERSION_MAJOR * VERSION_MAJOR) + - (LIBSWSCALE_VERSION_MINOR * VERSION_MINOR) + - (LIBSWSCALE_VERSION_RELEASE * VERSION_RELEASE); - {$ENDIF} - - {$@DEFINE_HAVE_PROJECTM@ HaveProjectM} - {$IFDEF HaveProjectM} +{$IFEND} + +// define this for versions of ProjectM < 1.0 (use C-Interface) +{$@DEFINE_HAVE_PROJECTM_0_9@ HaveProjectM_0_9} +// define this for versions of ProjectM >= 1.0 (use C++-Interface) +{$@DEFINE_HAVE_PROJECTM_1_0_PLUS@ HaveProjectM_1_0_PLUS} +{$IF Defined(HaveProjectM_0_9) or Defined(HaveProjectM_1_0_PLUS)} + {$DEFINE HaveProjectM} +{$IFEND} +{$IF Defined(HaveProjectM) and Defined(IncludeConstants)} libprojectM = '@PROJECTM_LIB@'; + // Note: Un/Define HaveProjectM_0_9 or HaveProjectM_1_0_PLUS accordingly PROJECTM_VERSION_MAJOR = @PROJECTM_VERSION_MAJOR@; PROJECTM_VERSION_MINOR = @PROJECTM_VERSION_MINOR@; PROJECTM_VERSION_RELEASE = @PROJECTM_VERSION_RELEASE@; - PROJECTM_VERSION = (PROJECTM_VERSION_MAJOR * VERSION_MAJOR) + - (PROJECTM_VERSION_MINOR * VERSION_MINOR) + - (PROJECTM_VERSION_RELEASE * VERSION_RELEASE); - {$ENDIF} +{$IFEND} - {$@DEFINE_HAVE_PORTAUDIO@ HavePortaudio} - {$IFDEF HavePortaudio} +{$@DEFINE_HAVE_PORTAUDIO@ HavePortaudio} +{$IF Defined(HavePortaudio) and Defined(IncludeConstants)} libportaudio = '@PORTAUDIO_LIB@'; PORTAUDIO_VERSION_MAJOR = @PORTAUDIO_VERSION_MAJOR@; PORTAUDIO_VERSION_MINOR = @PORTAUDIO_VERSION_MINOR@; PORTAUDIO_VERSION_RELEASE = @PORTAUDIO_VERSION_RELEASE@; - PORTAUDIO_VERSION = (PORTAUDIO_VERSION_MAJOR * VERSION_MAJOR) + - (PORTAUDIO_VERSION_MINOR * VERSION_MINOR) + - (PORTAUDIO_VERSION_RELEASE * VERSION_RELEASE); - {$ENDIF} +{$IFEND} - {$@DEFINE_HAVE_PORTMIXER@ HavePortmixer} - {$IFDEF HavePortmixer} +{$@DEFINE_HAVE_PORTMIXER@ HavePortmixer} +{$IF Defined(HavePortmixer) and Defined(IncludeConstants)} libportmixer = '@PORTMIXER_LIB@'; PORTMIXER_VERSION_MAJOR = @PORTMIXER_VERSION_MAJOR@; PORTMIXER_VERSION_MINOR = @PORTMIXER_VERSION_MINOR@; PORTMIXER_VERSION_RELEASE = @PORTMIXER_VERSION_RELEASE@; - PORTMIXER_VERSION = (PORTMIXER_VERSION_MAJOR * VERSION_MAJOR) + - (PORTMIXER_VERSION_MINOR * VERSION_MINOR) + - (PORTMIXER_VERSION_RELEASE * VERSION_RELEASE); - {$ENDIF} +{$IFEND} + diff --git a/Game/Code/configure.ac b/Game/Code/configure.ac index 2c4e37f1..ef0516d5 100644 --- a/Game/Code/configure.ac +++ b/Game/Code/configure.ac @@ -11,8 +11,22 @@ AC_PREREQ(2.61) # Init autoconf -AC_INIT([UltraStar Deluxe], [1.1], [TODO: send bugreport BUG-REPORT-ADDRESS]) +AC_INIT([UltraStar Deluxe], + [1.1 alpha], + [http://sourceforge.net/tracker/?group_id=191560&atid=937872]) +# specify the website here +PACKAGE_WEBSITE="http://www.ultrastardeluxe.org/" +# specify the IRC-channel here +PACKAGE_IRC="#ultrastardx at quakenet.org" + +AUTOCONF_INFO=[generated automatically by -*- Autoconf -*- +Do NOT edit this file. Edit ... instead.] + +# Specify a source-file so autoconf can check if the source-dir exists AC_CONFIG_SRCDIR(UltraStar.lpr) + +# This one is not used by autoconf at the moment. +# When it is used maybe we don't need aclocal's -I parameter anymore. AC_CONFIG_MACRO_DIR(m4) # show features and packages in one list @@ -22,17 +36,26 @@ AC_PRESERVE_HELP_ORDER # define switches # ----------------------------------------- -# print library option header +# print library options header AC_ARG_WITH([cfg-dummy1], [ External Libraries:]) # add lazarus option AC_ARG_WITH([lazarus], [AS_HELP_STRING([--with-lazarus=DIR], - [Directory of lazarus directory @<:@LAZARUSDIR@:>@])], + [Directory of lazarus @<:@LAZARUSDIR@:>@])], [with_lazarus=$withval], [with_lazarus="yes"]) -if [[ $with_lazarus = "no" ]] ; then - AC_MSG_ERROR("Lazarus is required. It is impossible to build without it."); +if [[ x$with_lazarus = xno ]] ; then + AC_MSG_ERROR([Lazarus is required. It is impossible to build without it.]); +fi + +# add jedi-sdl option +AC_ARG_WITH([jedi-sdl], + [AS_HELP_STRING([--with-jedi-sdl=DIR], + [Directory of JEDI-SDL @<:@lib/JEDI-SDLv1.0@:>@])], + [with_jedi_sdl=$withval], [with_jedi_sdl="lib/JEDI-SDLv1.0"]) +if [[ x$with_jedi_sdl = xno -o x$with_jedi_sdl = xyes ]]; then + AC_MSG_ERROR([JEDI-SDL is required. Specify its directory.]); fi # add portaudio option @@ -53,9 +76,35 @@ AC_ARG_WITH([projectM], [Enable projectM visualization support @<:@default=check@:>@])], [with_projectM=$withval], [with_projectM="check"]) -# AC_ARG_ENABLE(foobar, -# [ --enable-foobar Dummy option], -# enable_foobar=$enableval, enable_foobar="no") +# print path options header +AC_ARG_WITH([cfg-dummy2], [ +Additional directories:]) + +# add suffix option +AC_ARG_WITH([suffix], + [AS_HELP_STRING([--with-suffix=SUFFIX], + [path suffix @<:@default=UltraStarDeluxe@:>@])], + [suffix=$withval], [suffix="UltraStarDeluxe"]) +if [[ x$suffix = xno -o x$suffix = xyes ]] ; then + AC_MSG_ERROR([Invalid suffix.]); +fi + +# add logdir option +AC_ARG_WITH([logrootdir], + [AS_HELP_STRING([--with-logrootdir=DIR], + [logging root directory @<:@default=/var/log@:>@])], + [with_logrootdir=$withval], [with_logrootdir="/var/log"]) + +# print misc options header +AC_ARG_WITH([cfg-dummy3], [ +Development options:]) + +# add dev_layout option +# Note: now handled by the Makefile +AC_ARG_ENABLE(dev_install, + [AS_HELP_STRING([--enable-dev-install], + [local installation for testing])], + [enable_dev_install="yes"], [enable_dev_install="no"]) # ----------------------------------------- @@ -149,7 +198,7 @@ AC_DEFUN([AC_PKG_CHECK_VERSION], AC_SPLIT_VERSION([$1], [0.0.0]) AC_MSG_RESULT(no) if test x$3 = xyes -o x$4 = xyes; then - AC_MSG_ERROR(["Could not find required library $2. Please install $2 and try again."]); + AC_MSG_ERROR([Could not find required library $2. Please install $2 and try again.]); fi fi ]) @@ -161,7 +210,9 @@ AC_DEFUN([AC_PKG_CHECK_VERSION], # find and test the freepascal compiler # sets PFLAGS, FPC_VERSION, FPC_DEBUG, etc. AC_PROG_FPC -AC_SPLIT_VERSION(FPC, $FPC_VERSION) +# FPC_VERSION is already defined by FPC, use +# PPC as prefix instead. +AC_SPLIT_VERSION(PPC, $FPC_VERSION) # find and test the C compiler (for C-libs and wrappers) AC_PROG_CC @@ -206,14 +257,14 @@ else if [[ -d $with_lazarus ]] ; then LAZARUS_CHECK_DIRS=$with_lazarus else - AC_MSG_ERROR(["LAZARUSDIR is not a directory."]); + AC_MSG_ERROR([LAZARUSDIR is not a directory.]); fi fi # find lazarus AC_PATH_PROG(LAZARUS, lazarus, no, [$LAZARUS_CHECK_DIRS]) if [[ $LAZARUS = "no" ]] ; then - AC_MSG_ERROR(["Could not find lazarus. Please install lazarus and try again."]); + AC_MSG_ERROR([Could not find lazarus. Please install lazarus and try again.]); fi LAZARUS_DIR=`dirname "$LAZARUS"` @@ -228,6 +279,27 @@ AC_MSG_RESULT(@<:@$LAZARUS_VERSION@:>@) # find sdl AC_PKG_CHECK_VERSION(SDL, [sdl], yes) +# check if JEDI-SDL pascal headers exist +AC_MSG_CHECKING(for JEDI-SDL pascal headers) + +JEDISDL_DIR="$with_jedi_sdl" +if [[ ! -d "$JEDISDL_DIR" ]]; then + AC_MSG_RESULT(no) + AC_MSG_ERROR([Path specified for JEDI-SDL is not a directory.]); +fi +#http://delphi-jedi.org +# -d "$JEDISDL_DIR/SDL_ttf" -a +# -d "$JEDISDL_DIR/SDL_Image" -a +# -d "$JEDISDL_DIR/OpenGL" -a +# TODO: add further tests and check the version +if [[ -d "$JEDISDL_DIR/sdl" ]]; then + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +# AC_MSG_ERROR([JEDI-SDL is not available. +#Download it and extract it to "$JEDISDL_DIR".]); +fi + # find sqlite3 AC_PKG_CHECK_VERSION(SQLITE3, [sqlite3], yes) @@ -254,7 +326,7 @@ AC_PKG_CHECK_VERSION(PORTAUDIO, [portaudio-2.0], yes, $with_portaudio) AC_PKG_CHECK_VERSION(PORTMIXER, [portmixer], no, $with_portmixer) # ----------------------------------------- -# defines for config.inc +# defines for config.inc/versions.pas # ----------------------------------------- # AC_SUBST_DEFINE(DEFINE_SUFFIX, IS_DEFINED) @@ -279,7 +351,8 @@ AC_SUBST(SWSCALE_LIB) AC_SUBST_DEFINE(HAVE_SWSCALE, $SWSCALE_HAVE) AC_SUBST(PROJECTM_LIB) -AC_SUBST_DEFINE(HAVE_PROJECTM, $PROJECTM_HAVE) +AC_SUBST_DEFINE(HAVE_PROJECTM_0_9, $PROJECTM_HAVE) +AC_SUBST_DEFINE(HAVE_PROJECTM_1_0_PLUS, $PROJECTM_HAVE) AC_SUBST(PORTAUDIO_LIB) AC_SUBST_DEFINE(HAVE_PORTAUDIO, $PORTAUDIO_HAVE) @@ -289,11 +362,17 @@ AC_SUBST_DEFINE(HAVE_PORTMIXER, $PORTMIXER_HAVE) AC_SUBST(LAZARUS_DIR) +logrootdir=$with_logrootdir +AC_SUBST(logrootdir) + +AC_SUBST(PACKAGE_WEBSITE) + # ----------------------------------------- # create output files # ----------------------------------------- -AC_CONFIG_FILES([config.inc Makefile]) +AC_CONFIG_FILES([config-linux.inc:config.inc.in]) +AC_CONFIG_FILES([Makefile]) AC_OUTPUT # ----------------------------------------- @@ -302,6 +381,36 @@ AC_OUTPUT AC_MSG_NOTICE([ -!!! Configuration done! -!!! Type "make" to compile the program. +!!! +!!! Configuration of $PACKAGE_NAME $PACKAGE_VERSION done! +!!! +!!! Type "make" to compile and +!!! "make install" to install it afterwards. +!!! +!!! For further information on $PACKAGE_NAME visit: +!!! $PACKAGE_WEBSITE +!!! +!!! IMPORTANT: +!!! This is an UNSUPPORTED ALPHA release for developers only. +!!! +!!! DO NOT EXPECT THE MAKEFILE OR THE PROGRAM ITSELF TO WORK +!!! +!!! and do not waste your time with bugfixing this version. +!!! Bugs might already be fixed in the developers' working copies. +!!! If you want to contribute, visit the IRC-Channel instead: +!!! $PACKAGE_IRC +!!! +!!! Known issues: +!!! - "make" might not work correctly +!!! - Audio-output and -input are not working yet +!!! - The editor is broken +!!! +!!! PLEASE DO NOT SEND BUGREPORTS FOR THIS VERSION. +!!! ]) + +# TODO: insert this in the public beta release +#!!! In case you find a bug send a bugreport to: +#!!! $PACKAGE_BUGREPORT +#!!! You might as well ask for help at the IRC-Channel +#!!! $PACKAGE_IRC -- cgit v1.2.3 From 70c74c834f367fae7540ff71350631b469cce249 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 21:57:42 +0000 Subject: this is not needed anymore, it will be created by autoconf git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@832 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Makefile | 69 ------------------------------------------------------ 1 file changed, 69 deletions(-) delete mode 100644 Game/Code/Makefile (limited to 'Game/Code') diff --git a/Game/Code/Makefile b/Game/Code/Makefile deleted file mode 100644 index 85f7ae67..00000000 --- a/Game/Code/Makefile +++ /dev/null @@ -1,69 +0,0 @@ -## -# UltraStar bamboo build for linux -## - -# lazarus base-dir -# will be set by configure later on -LAZDIR := $(shell whereis lazarus | cut -d ' ' -f2) -#LAZDIR = /usr/local/share/lazarus - -# Directories added to the unit path -UNIT_FLAG = -Fu -UNIT_PATH = $(UNIT_FLAG)$(LAZDIR)/lcl/units/i386-linux \ - $(UNIT_FLAG)$(LAZDIR)/components/images/lib/i386-linux \ - $(UNIT_FLAG)$(LAZDIR)/components/jpeg \ - $(UNIT_FLAG). -# $(UNIT_FLAG)$(LAZDIR)/packager/units/i386-linux \ - -# Directory where compiled units (.ppu and .o) files are stored -CUNIT_DIR = build/linux/lazarus - -# Directories added to the includes path -INC_FLAG = -Fi -INC_PATH = $(INC_FLAG)lib/JEDI-SDLv1.0/SDL/Pas - -# Defines -DEFINES = -dLCL -DEFINES += -dFPC_V220 - -# Misc fpc options -COMPAT_FLAGS = -S2dgi -#COMPAT_FLAGS += -Mdelphi -VERBOSE_FLAGS = -vew -l -DEBUG_FLAGS = -gl -DEBUG_FLAGS += -g -#DEBUG_FLAGS = -dDEBUG -#-Crtoi -#OPTIMIZE_FLAGS_FPC204 = -OG2p3 -#OPTIMIZE_FLAGS_FPC220 = -O2p"NAME" -#OPTIMIZE_FLAGS = -dRELEASE -OPTIMIZE_FLAGS += -Xs -FLAGS = $(COMPAT_FLAGS) \ - $(VERBOSE_FLAGS) \ - $(DEBUG_FLAGS) \ - $(OPTIMIZE_FLAGS) \ - $(DEFINES) - -# lpr project file used as input -PROJECT_FILE = UltraStar.lpr -# name of executable -OUTPUT = UltraStar - -all: resource ultrastar -resource: UltraStar.lrs -ultrastar: clean_obj - mkdir -p $(CUNIT_DIR) - fpc $(FLAGS) $(INC_PATH) $(UNIT_PATH) -FU$(CUNIT_DIR) -o$(OUTPUT) $(PROJECT_FILE) -install: - mv $(OUTPUT) ../.. -clean: clean_obj clean_res -distclean: clean -clean_obj: - rm -f -r $(CUNIT_DIR)/*.o $(CUNIT_DIR)/*.ppu $(CUNIT_DIR)/*.rst - rm -f $(OUTPUT) -clean_res: - rm -f UltraStar.lrs link.res -UltraStar.lrs: UltraStar.rc - ./lazres-UltraStar.sh - -.PHONY: all resource ultrastar install clean distclean clean_obj clean_res -- cgit v1.2.3 From 68dc76576f45c5f1a68a50c7e8feb06f285297df Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 22:09:38 +0000 Subject: mapping of keypad-enter to the return-key (for jonaspaulo and his dead key) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@833 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMain.pas | 2110 ++++++++++++++++++++++--------------------- 1 file changed, 1057 insertions(+), 1053 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 801a66db..7b32857b 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -1,1053 +1,1057 @@ -unit UMain; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses - SDL, - UGraphic, - UMusic, - URecord, - UTime, - SysUtils, - UDisplay, - UIni, - ULog, - ULyrics, - UScreenSing, - USong, - OpenGL12, - {$IFDEF UseSerialPort} - zlportio {you can disable it and all PortWriteB calls}, - {$ENDIF} - ULCD, - ULight, - UThemes; - -type - TPlayer = record - Name: string; - - //Index in Teaminfo record - TeamID: Byte; - PlayerID: Byte; - - //Scores - Score: real; - ScoreLine: real; - ScoreGolden: real; - - ScoreI: integer; - ScoreLineI: integer; - ScoreGoldenI: integer; - ScoreTotalI: integer; - - - - //LineBonus Mod - ScoreLast: Real;//Last Line Score - - //PerfectLineTwinkle Mod (effect) - LastSentencePerfect: Boolean; - //PerfectLineTwinkle Mod end - - -// Meter: real; - - HighNut: integer; - IlNut: integer; - Nuta: array of record - Start: integer; - Dlugosc: integer; - Detekt: real; // dokladne miejsce, w ktorym wykryto ta nute - Ton: real; - Perfect: boolean; // true if the note matches the original one, lit the star - - - - // Half size Notes Patch - Hit: boolean; // true if the note Hits the Line - //end Half size Notes Patch - - - - end; - end; - - -var - //Absolute Paths - GamePath: string; - SoundPath: string; - SongPath: string; - LogPath: string; - ThemePath: string; - SkinsPath: string; - ScreenshotsPath: string; - CoversPath: string; - LanguagesPath: string; - PluginPath: string; - PlayListPath: string; - - UserSongPath: string = ''; - UserCoversPath: string = ''; - UserPlaylistPath: string = ''; - - OGL: Boolean; - Done: Boolean; - Event: TSDL_event; - FileName: string; - Restart: boolean; - - // gracz i jego nuty - Player: array of TPlayer; - PlayersPlay: integer; - - CurrentSong : TSong; - -procedure InitializePaths; - -Procedure Main; -procedure MainLoop; -procedure CheckEvents; -procedure Sing(Sender: TScreenSing); -procedure NewSentence(Sender: TScreenSing); -procedure NewBeat(Sender: TScreenSing); // executed when on then new beat -procedure NewBeatC(Sender: TScreenSing); // executed when on then new beat for click -procedure NewBeatD(Sender: TScreenSing); // executed when on then new beat for detection -//procedure NewHalf; // executed when in the half between beats -procedure NewNote(Sender: TScreenSing); // detect note -function GetMidBeat(Time: real): real; -function GetTimeFromBeat(Beat: integer): real; -procedure ClearScores(PlayerNum: integer); - -implementation - -uses USongs, - UJoystick, - math, - UCommandLine, ULanguage, SDL_ttf, - USkins, UCovers, UCatCovers, UDataBase, UPlaylist, UDLLManager, - UParty, UCore, UGraphicClasses, UPluginDefs, UPlatform; - -const - Version = 'UltraStar Deluxe V 1.10 Alpha Build'; - -Procedure Main; -var - WndTitle: string; -begin - try - - WndTitle := Version; - - if Platform.TerminateIfAlreadyRunning( {var} WndTitle) then - Exit; - - //------------------------------ - //StartUp - Create Classes and Load Files - //------------------------------ - USTime := TTime.Create; - - // Commandline Parameter Parser - Params := TCMDParams.Create; - - // Log + Benchmark - Log := TLog.Create; - Log.Title := WndTitle; - Log.Enabled := Not Params.NoLog; - Log.BenchmarkStart(0); - - // Language - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Paths', 'Initialization'); - InitializePaths; - Log.LogStatus('Load Language', 'Initialization'); - Language := TLanguage.Create; - //Add Const Values: - Language.AddConst('US_VERSION', Version); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Language', 1); - - // SDL - Log.BenchmarkStart(1); - Log.LogStatus('Initialize SDL', 'Initialization'); - SDL_Init(SDL_INIT_VIDEO); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing SDL', 1); - - // SDL_ttf - Log.BenchmarkStart(1); - Log.LogStatus('Initialize SDL_ttf', 'Initialization'); - TTF_Init(); //ttf_quit(); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing SDL_ttf', 1); - - // Skin - Log.BenchmarkStart(1); - Log.LogStatus('Loading Skin List', 'Initialization'); - Skin := TSkin.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Skin List', 1); - - // Sound - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Sound', 'Initialization'); - InitializeSound(); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Sound', 1); - - // Ini + Paths (depends on Sound) - Log.BenchmarkStart(1); - Log.LogStatus('Load Ini', 'Initialization'); - Ini := TIni.Create; - Ini.Load; - - //Load Languagefile - if (Params.Language <> -1) then - Language.ChangeLanguage(ILanguage[Params.Language]) - else - Language.ChangeLanguage(ILanguage[Ini.Language]); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Ini', 1); - - - // LCD - Log.BenchmarkStart(1); - Log.LogStatus('Load LCD', 'Initialization'); - LCD := TLCD.Create; - if Ini.LPT = 1 then begin - // LCD.HalfInterface := true; - LCD.Enable; - LCD.Clear; - LCD.WriteText(1, ' UltraStar '); - LCD.WriteText(2, ' Loading... '); - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading LCD', 1); - - // Light - Log.BenchmarkStart(1); - Log.LogStatus('Load Light', 'Initialization'); - Light := TLight.Create; - if Ini.LPT = 2 then begin - Light.Enable; - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Light', 1); - - - - // Theme - Log.BenchmarkStart(1); - Log.LogStatus('Load Themes', 'Initialization'); - Theme := TTheme.Create(ThemePath + ITheme[Ini.Theme] + '.ini', Ini.Color); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Themes', 1); - - // Covers Cache - Log.BenchmarkStart(1); - Log.LogStatus('Creating Covers Cache', 'Initialization'); - Covers := TCovers.Create; - Log.LogBenchmark('Loading Covers Cache Array', 1); - Log.BenchmarkStart(1); - - // Category Covers - Log.BenchmarkStart(1); - Log.LogStatus('Creating Category Covers Array', 'Initialization'); - CatCovers:= TCatCovers.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Category Covers Array', 1); - - // Songs - //Log.BenchmarkStart(1); - Log.LogStatus('Creating Song Array', 'Initialization'); - Songs := TSongs.Create; -// Songs.LoadSongList; - - Log.LogStatus('Creating 2nd Song Array', 'Initialization'); - CatSongs := TCatSongs.Create; - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Songs', 1); - - // PluginManager - Log.BenchmarkStart(1); - Log.LogStatus('PluginManager', 'Initialization'); - DLLMan := TDLLMan.Create; //Load PluginList - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PluginManager', 1); - - {// Party Mode Manager - Log.BenchmarkStart(1); - Log.LogStatus('PartySession Manager', 'Initialization'); - PartySession := TPartySession.Create; //Load PartySession - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading PartySession Manager', 1); } - - // Graphics - Log.BenchmarkStart(1); - Log.LogStatus('Initialize 3D', 'Initialization'); - Initialize3D(WndTitle); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing 3D', 1); - - // Score Saving System - Log.BenchmarkStart(1); - Log.LogStatus('DataBase System', 'Initialization'); - DataBase := TDataBaseSystem.Create; - - if (Params.ScoreFile = '') then - DataBase.Init ('Ultrastar.db') - else - DataBase.Init (Params.ScoreFile); - - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading DataBase System', 1); - - //Playlist Manager - Log.BenchmarkStart(1); - Log.LogStatus('Playlist Manager', 'Initialization'); - PlaylistMan := TPlaylistManager.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Playlist Manager', 1); - - //GoldenStarsTwinkleMod - Log.BenchmarkStart(1); - Log.LogStatus('Effect Manager', 'Initialization'); - GoldenRec := TEffectManager.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Particel System', 1); - - // Joypad - if (Ini.Joypad = 1) OR (Params.Joypad) then - begin - Log.BenchmarkStart(1); - Log.LogStatus('Initialize Joystick', 'Initialization'); - Joy := TJoy.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing Joystick', 1); - end; - - Log.BenchmarkEnd(0); - Log.LogBenchmark('Loading Time', 0); - - Log.LogError('Creating Core'); - Core := TCore.Create('Ultrastar Deluxe Beta', MakeVersion(1,1,0, chr(0))); - - Log.LogError('Running Core'); - Core.Run; - - //------------------------------ - //Start- Mainloop - //------------------------------ - //Music.SetLoop(true); - //Music.SetVolume(50); - //Music.Open(SkinPath + 'Menu Music 3.mp3'); - //Music.Play; - Log.LogStatus('Main Loop', 'Initialization'); - MainLoop; - - finally - //------------------------------ - //Finish Application - //------------------------------ - - {$ifdef WIN32} - if Ini.LPT = 1 then LCD.Clear; - if Ini.LPT = 2 then Light.TurnOff; - {$endif} - - Log.LogStatus('Main Loop', 'Finished'); - Log.Free; - end; -end; - -procedure MainLoop; -var - Delay: integer; -begin - try - Delay := 0; - SDL_EnableKeyRepeat(125, 125); - - CountSkipTime(); // JB - for some reason this seems to be needed when we use the SDL Timer functions. - While not Done do - Begin - // joypad - if (Ini.Joypad = 1) OR (Params.Joypad) then - Joy.Update; - - // keyboard events - CheckEvents; - - // display - done := not Display.Draw; - SwapBuffers; - - // light - Light.Refresh; - - // delay - CountMidTime; - - Delay := Floor(1000 / 100 - 1000 * TimeMid); - - if Delay >= 1 then - SDL_Delay(Delay); // dynamic, maximum is 100 fps - - CountSkipTime; - - // reinitialization of graphics - if Restart then - begin - Reinitialize3D; - Restart := false; - end; - - End; - - finally - UnloadOpenGL; - end; -End; - -Procedure CheckEvents; -//var -// p: pointer; -Begin - if not Assigned(Display.NextScreen) then - While SDL_PollEvent( @event ) = 1 Do - Begin -// beep; - Case Event.type_ Of - SDL_QUITEV: begin - Display.Fade := 0; - Display.NextScreenWithCheck := nil; - Display.CheckOK := True; - end; -{ SDL_MOUSEBUTTONDOWN: - With Event.button Do - Begin - If State = SDL_BUTTON_LEFT Then - Begin - // - End; - End; // With} - SDL_KEYDOWN: - begin - //ScreenShot hack. If Print is pressed-> Make screenshot and Save to Screenshots Path - if (Event.key.keysym.sym = SDLK_SYSREQ) or (Event.key.keysym.sym = SDLK_PRINT) then - Display.ScreenShot - - // popup hack... if there is a visible popup then let it handle input instead of underlying screen - // shoud be done in a way to be sure the topmost popup has preference (maybe error, then check) - else if (ScreenPopupError <> NIL) and (ScreenPopupError.Visible) then - done := not ScreenPopupError.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) - else if (ScreenPopupCheck <> NIL) AND (ScreenPopupCheck.Visible) then - done := not ScreenPopupCheck.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) - // end of popup hack - - else - begin - // check for Screen want to Exit - done := Not Display.ActualScreen^.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True); - - //If Screen wants to Exit - if done then - begin - //If Question Option is enabled then Show Exit Popup - if (Ini.AskbeforeDel = 1) then - begin - Display.ActualScreen^.CheckFadeTo(NIL,'MSG_QUIT_USDX'); - end - else //When asking for exit is disabled then simply exit - begin - Display.Fade := 0; - Display.NextScreenWithCheck := nil; - Display.CheckOK := True; - end; - end; - - end; // if (Not Display.ActualScreen^.ParseInput(Event.key.keysym.scancode, True)) then - end; -// SDL_JOYAXISMOTION: -// begin -// beep -// end; - SDL_JOYBUTTONDOWN: - begin - beep - end; - End; // Case Event.type_ - End; // While -End; // CheckEvents - -function GetTimeForBeats(BPM, Beats: real): real; -begin - Result := 60 / BPM * Beats; -end; - -function GetBeats(BPM, msTime: real): real; -begin - Result := BPM * msTime / 60; -end; - -procedure GetMidBeatSub(BPMNum: integer; var Time: real; var CurBeat: real); -var - NewTime: real; -begin - if High(CurrentSong.BPM) = BPMNum then begin - // last BPM - CurBeat := CurrentSong.BPM[BPMNum].StartBeat + GetBeats(CurrentSong.BPM[BPMNum].BPM, Time); - Time := 0; - end else begin - // not last BPM - // count how much time is it for start of the new BPM and store it in NewTime - NewTime := GetTimeForBeats(CurrentSong.BPM[BPMNum].BPM, CurrentSong.BPM[BPMNum+1].StartBeat - CurrentSong.BPM[BPMNum].StartBeat); - - // compare it to remaining time - if (Time - NewTime) > 0 then begin - // there is still remaining time - CurBeat := CurrentSong.BPM[BPMNum].StartBeat; - Time := Time - NewTime; - end else begin - // there is no remaining time - CurBeat := CurrentSong.BPM[BPMNum].StartBeat + GetBeats(CurrentSong.BPM[BPMNum].BPM, Time); - Time := 0; - end; // if - end; // if -end; - -function GetMidBeat(Time: real): real; -var - CurBeat: real; - CurBPM: integer; -// TopBeat: real; -// TempBeat: real; -// TempTime: real; -begin - Result := 0; - if Length(CurrentSong.BPM) = 1 then Result := Time * CurrentSong.BPM[0].BPM / 60; - - (* 2 BPMs *) -{ if Length(CurrentSong.BPM) > 1 then begin - (* new system *) - CurBeat := 0; - TopBeat := GetBeats(CurrentSong.BPM[0].BPM, Time); - if TopBeat > CurrentSong.BPM[1].StartBeat then begin - // analyze second BPM - Time := Time - GetTimeForBeats(CurrentSong.BPM[0].BPM, CurrentSong.BPM[1].StartBeat - CurBeat); - CurBeat := CurrentSong.BPM[1].StartBeat; - TopBeat := GetBeats(CurrentSong.BPM[1].BPM, Time); - Result := CurBeat + TopBeat; - - end else begin - (* pierwszy przedzial *) - Result := TopBeat; - end; - end; // if} - - (* more BPMs *) - if Length(CurrentSong.BPM) > 1 then begin - - CurBeat := 0; - CurBPM := 0; - while (Time > 0) do begin - GetMidBeatSub(CurBPM, Time, CurBeat); - Inc(CurBPM); - end; - - Result := CurBeat; - end; // if -end; - -function GetTimeFromBeat(Beat: integer): real; -var - CurBPM: integer; -begin - Result := 0; - if Length(CurrentSong.BPM) = 1 then Result := CurrentSong.GAP / 1000 + Beat * 60 / CurrentSong.BPM[0].BPM; - - (* more BPMs *) - if Length(CurrentSong.BPM) > 1 then begin - Result := CurrentSong.GAP / 1000; - CurBPM := 0; - while (CurBPM <= High(CurrentSong.BPM)) and (Beat > CurrentSong.BPM[CurBPM].StartBeat) do begin - if (CurBPM < High(CurrentSong.BPM)) and (Beat >= CurrentSong.BPM[CurBPM+1].StartBeat) then begin - // full range - Result := Result + (60 / CurrentSong.BPM[CurBPM].BPM) * (CurrentSong.BPM[CurBPM+1].StartBeat - CurrentSong.BPM[CurBPM].StartBeat); - end; - - if (CurBPM = High(CurrentSong.BPM)) or (Beat < CurrentSong.BPM[CurBPM+1].StartBeat) then begin - // in the middle - Result := Result + (60 / CurrentSong.BPM[CurBPM].BPM) * (Beat - CurrentSong.BPM[CurBPM].StartBeat); - end; - Inc(CurBPM); - end; - -{ while (Time > 0) do begin - GetMidBeatSub(CurBPM, Time, CurBeat); - Inc(CurBPM); - end;} - end; // if} -end; - -procedure Sing(Sender: TScreenSing); -var - Pet: integer; - PetGr: integer; - CP: integer; - Done: real; - N: integer; -begin - Czas.Teraz := Czas.Teraz + TimeSkip; - - Czas.OldBeat := Czas.AktBeat; - Czas.MidBeat := GetMidBeat(Czas.Teraz - (CurrentSong.Gap{ + 90 I've forgotten for what it is}) / 1000); // new system with variable BPM in function - Czas.AktBeat := Floor(Czas.MidBeat); - -// Czas.OldHalf := Czas.AktHalf; -// Czas.MidHalf := Czas.MidBeat + 0.5; -// Czas.AktHalf := Floor(Czas.MidHalf); - - Czas.OldBeatC := Czas.AktBeatC; - Czas.MidBeatC := GetMidBeat(Czas.Teraz - (CurrentSong.Gap) / 1000); - Czas.AktBeatC := Floor(Czas.MidBeatC); - - Czas.OldBeatD := Czas.AktBeatD; - Czas.MidBeatD := -0.5+GetMidBeat(Czas.Teraz - (CurrentSong.Gap + 120 + 20) / 1000); // MidBeat with addition GAP - Czas.AktBeatD := Floor(Czas.MidBeatD); - Czas.FracBeatD := Frac(Czas.MidBeatD); - - // sentences routines - for PetGr := 0 to 0 do begin;//High(Gracz) do begin - CP := PetGr; - // ustawianie starej czesci - Czas.OldCzesc := Czesci[CP].Akt; - - // wybieranie aktualnej czesci - for Pet := 0 to Czesci[CP].High do - if Czas.AktBeat >= Czesci[CP].Czesc[Pet].Start then Czesci[CP].Akt := Pet; - - // czysczenie nut gracza, gdy to jest nowa plansza - // (optymizacja raz na halfbeat jest zla) - if Czesci[CP].Akt <> Czas.OldCzesc then NewSentence(Sender); - - end; // for PetGr - - // wykonuje operacje raz na beat - if (Czas.AktBeat >= 0) and (Czas.OldBeat <> Czas.AktBeat) then - NewBeat(Sender); - - // make some operations on clicks - if {(Czas.AktBeatC >= 0) and }(Czas.OldBeatC <> Czas.AktBeatC) then - NewBeatC(Sender); - - // make some operations when detecting new voice pitch - if (Czas.AktBeatD >= 0) and (Czas.OldBeatD <> Czas.AktBeatD) then - NewBeatD(Sender); - - // wykonuje operacje w polowie beatu -// if (Czas.AktHalf >= 1) and (Czas.OldHalf <> Czas.AktHalf) then -// NewHalf; - - // plynnie przesuwa text - Done := 1; - for N := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do - if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start <= Czas.MidBeat) - and (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start + Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc >= Czas.MidBeat) then - Done := (Czas.MidBeat - Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start) / (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc); - - N := Czesci[0].Czesc[Czesci[0].Akt].HighNut; - - // wylacza ostatnia nute po przejsciu - {// todo: Lyrics - if (Ini.LyricsEffect = 1) and (Done = 1) and - (Czas.MidBeat > Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start + Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc) - then Sender.LyricMain.Selected := -1; - - if Done > 1 then Done := 1; - Sender.LyricMain.Done := Done; } - - // use Done with LCD -{ with ScreenSing do begin - if LyricMain.Selected >= 0 then begin - LCD.MoveCursor(1, LyricMain.SelectedLetter + Round((LyricMain.SelectedLength-1) * Done)); - LCD.ShowCursor; - end; - end;} - - -end; - -procedure NewSentence(Sender: TScreenSing); -var -G: Integer; -begin - // czyszczenie nut graczy - for G := 0 to High(Player) do begin - Player[G].IlNut := 0; - Player[G].HighNut := -1; - SetLength(Player[G].Nuta, 0); - end; - - // Add Words to Lyrics - with Sender do begin - {LyricMain.AddCzesc(Czesci[0].Akt); - if Czesci[0].Akt < Czesci[0].High then - LyricSub.AddCzesc(Czesci[0].Akt+1) - else - LyricSub.Clear;} - while (not Lyrics.LineinQueue) AND (Lyrics.LineCounter <= High(Czesci[0].Czesc)) do - Lyrics.AddLine(@Czesci[0].Czesc[Lyrics.LineCounter]); - end; - - Sender.UpdateLCD; - - //On Sentence Change... - Sender.onSentenceChange(Czesci[0].Akt); -end; - -procedure NewBeat(Sender: TScreenSing); -var - Pet: integer; -// TempBeat: integer; -begin - // ustawia zaznaczenie tekstu -// SingScreen.LyricMain.Selected := -1; - for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do - if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeat) then begin - // operates on currently beated note - //Todo: Lyrics - //Sender.LyricMain.Selected := Pet; - -// LCD.MoveCursor(1, ScreenSing.LyricMain.SelectedLetter); -// LCD.ShowCursor; - - //LCD.MoveCursorBR(Sender.LyricMain.SelectedLetter); - LCD.ShowCursor; - - end; -end; - -procedure NewBeatC; -var - Pet: integer; -// LPT_1: integer; -// LPT_2: integer; -begin -// LPT_1 := 1; -// LPT_2 := 1; - - // beat click - if (Ini.BeatClick = 1) and ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then - AudioPlayback.PlaySound(SoundLib.Click); - - // debug system on LPT - if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then begin - //LPT_1 := 0; -// Light.LightOne(0, 150); - - Light.LightOne(1, 200); // beat light - if ParamStr(1) = '-doublelights' then - Light.LightOne(0, 200); // beat light - - -{ if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod (Czesci[0].Resolution * 2) = 0) then - Light.LightOne(0, 150) - else - Light.LightOne(1, 150)} - end; - - for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do - if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeatC) then begin - // click assist - if Ini.ClickAssist = 1 then - AudioPlayback.PlaySound(SoundLib.Click); - - //LPT_2 := 0; - if ParamStr(1) <> '-doublelights' then - Light.LightOne(0, 150); //125 - - - // drum machine -(* TempBeat := Czas.AktBeat;// + 2; - if (TempBeat mod 8 = 0) then Music.PlayDrum; - if (TempBeat mod 8 = 4) then Music.PlayClap; -// if (TempBeat mod 4 = 2) then Music.PlayHihat; - if (TempBeat mod 4 <> 0) then Music.PlayHihat;*) - end; - - {$IFDEF UseSerialPort} - // PortWriteB($378, LPT_1 + LPT_2 * 2); // 0 zapala - {$ENDIF} -end; - -procedure NewBeatD(Sender: TScreenSing); -begin - NewNote(Sender); -end; - -//procedure NewHalf; -//begin -// NewNote; -//end; - -procedure NewNote(Sender: TScreenSing); -var - CP: integer; // current player - S: integer; // sentence - SMin: integer; - SMax: integer; - SDet: integer; // temporary: sentence of detected note - Pet: integer; - Mozna: boolean; - Nowa: boolean; - Range: integer; - NoteHit:boolean; -begin -// Log.LogStatus('Beat ' + IntToStr(Czas.AktBeat) + ' HalfBeat ' + IntToStr(Czas.AktHalf), 'NewBeat'); -// beep; - - // On linux we get an AV @ NEWNOTE, line 600 of Classes/UMain.pas - if not assigned( AudioInputProcessor.Sound ) then // TODO : JB_Linux ... why is this now not assigned... it was fine a few hours ago.. - exit; - - // analizuje dla obu graczy ten sam sygnal (Sound.OneSrcForBoth) - // albo juz lepiej nie - for CP := 0 to PlayersPlay-1 do - begin - - // analyze buffer - AudioInputProcessor.Sound[CP].AnalyzeBuffer; - - // adds some noise -// Czas.Ton := Czas.Ton + Round(Random(3)) - 1; - - // 0.5.0: count min and max sentence range for checking (detection is delayed to the notes we see on the screen) - SMin := Czesci[0].Akt-1; - if SMin < 0 then SMin := 0; - SMax := Czesci[0].Akt; - - // check if we can add new note - Mozna := false; - SDet:=SMin; - for S := SMin to SMax do - for Pet := 0 to Czesci[0].Czesc[S].HighNut do - if ((Czesci[0].Czesc[S].Nuta[Pet].Start <= Czas.AktBeatD) - and (Czesci[0].Czesc[S].Nuta[Pet].Start + Czesci[0].Czesc[S].Nuta[Pet].Dlugosc - 1 >= Czas.AktBeatD)) - and (not Czesci[0].Czesc[S].Nuta[Pet].FreeStyle) // but don't allow when it's FreeStyle note - and (Czesci[0].Czesc[S].Nuta[Pet].Dlugosc > 0) // and make sure the note lenghts is at least 1 - then begin - SDet := S; - Mozna := true; - Break; - end; - - S := SDet; - - - - - -// Czas.SzczytJest := true; -// Czas.Ton := 27; - - // gdy moze, to dodaje nute - if (AudioInputProcessor.Sound[CP].ToneValid) and (Mozna) then begin - // operowanie na ostatniej nucie - for Pet := 0 to Czesci[0].Czesc[S].HighNut do - if (Czesci[0].Czesc[S].Nuta[Pet].Start <= Czas.OldBeatD+1) - and (Czesci[0].Czesc[S].Nuta[Pet].Start + - Czesci[0].Czesc[S].Nuta[Pet].Dlugosc > Czas.OldBeatD+1) then begin - // to robi, tylko dla pary nut (oryginalnej i gracza) - - // przesuwanie tonu w odpowiednia game - while (AudioInputProcessor.Sound[CP].Tone - Czesci[0].Czesc[S].Nuta[Pet].Ton > 6) do - AudioInputProcessor.Sound[CP].Tone := AudioInputProcessor.Sound[CP].Tone - 12; - - while (AudioInputProcessor.Sound[CP].Tone - Czesci[0].Czesc[S].Nuta[Pet].Ton < -6) do - AudioInputProcessor.Sound[CP].Tone := AudioInputProcessor.Sound[CP].Tone + 12; - - // Half size Notes Patch - NoteHit := false; - - //if Ini.Difficulty = 0 then Range := 2; - //if Ini.Difficulty = 1 then Range := 1; - //if Ini.Difficulty = 2 then Range := 0; - Range := 2 - Ini.Difficulty; - - if abs(Czesci[0].Czesc[S].Nuta[Pet].Ton - AudioInputProcessor.Sound[CP].Tone) <= Range then begin - AudioInputProcessor.Sound[CP].Tone := Czesci[0].Czesc[S].Nuta[Pet].Ton; - - - // Half size Notes Patch - NoteHit := true; - - - if (Ini.LineBonus = 0) then - begin - // add points without LineBonus - case Czesci[0].Czesc[S].Nuta[Pet].Wartosc of - 1: Player[CP].Score := Player[CP].Score + 10000 / Czesci[0].Wartosc * - Czesci[0].Czesc[S].Nuta[Pet].Wartosc; - 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 10000 / Czesci[0].Wartosc * - Czesci[0].Czesc[S].Nuta[Pet].Wartosc; - end; - end - else - begin - // add points with Line Bonus - case Czesci[0].Czesc[S].Nuta[Pet].Wartosc of - 1: Player[CP].Score := Player[CP].Score + 9000 / Czesci[0].Wartosc * - Czesci[0].Czesc[S].Nuta[Pet].Wartosc; - 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 9000 / Czesci[0].Wartosc * - Czesci[0].Czesc[S].Nuta[Pet].Wartosc; - end; - end; - - Player[CP].ScoreI := Floor(Player[CP].Score / 10) * 10; - Player[CP].ScoreGoldenI := Floor(Player[CP].ScoreGolden / 10) * 10; - - Player[CP].ScoreTotalI := Player[CP].ScoreI + Player[CP].ScoreGoldenI + Player[CP].ScoreLineI; - end; - - end; // operowanie - - // sprawdzanie czy to nowa nuta, czy przedluzenie - if S = SMax then begin - Nowa := true; - // jezeli ostatnia ma ten sam ton - if (Player[CP].IlNut > 0 ) - and (Player[CP].Nuta[Player[CP].HighNut].Ton = AudioInputProcessor.Sound[CP].Tone) - and (Player[CP].Nuta[Player[CP].HighNut].Start + Player[CP].Nuta[Player[CP].HighNut].Dlugosc = Czas.AktBeatD) - then Nowa := false; - // jezeli jest jakas nowa nuta na sprawdzanym beacie - for Pet := 0 to Czesci[0].Czesc[S].HighNut do - if (Czesci[0].Czesc[S].Nuta[Pet].Start = Czas.AktBeatD) then - Nowa := true; - - // dodawanie nowej nuty - if Nowa then begin - // nowa nuta - Player[CP].IlNut := Player[CP].IlNut + 1; - Player[CP].HighNut := Player[CP].HighNut + 1; - SetLength(Player[CP].Nuta, Player[CP].IlNut); - Player[CP].Nuta[Player[CP].HighNut].Start := Czas.AktBeatD; - Player[CP].Nuta[Player[CP].HighNut].Dlugosc := 1; - Player[CP].Nuta[Player[CP].HighNut].Ton := AudioInputProcessor.Sound[CP].Tone; // Ton || TonDokl - Player[CP].Nuta[Player[CP].HighNut].Detekt := Czas.MidBeat; - - - // Half Note Patch - Player[CP].Nuta[Player[CP].HighNut].Hit := NoteHit; - - - // Log.LogStatus('Nowa Nuta ' + IntToStr(Gracz.Nuta[Gracz.HighNut].Start), 'NewBeat'); - - end else begin - // przedluzenie nuty - Player[CP].Nuta[Player[CP].HighNut].Dlugosc := Player[CP].Nuta[Player[CP].HighNut].Dlugosc + 1; - end; - - - // check for perfect note and then lit the star (on Draw) - for Pet := 0 to Czesci[0].Czesc[S].HighNut do - if (Czesci[0].Czesc[S].Nuta[Pet].Start = Player[CP].Nuta[Player[CP].HighNut].Start) - and (Czesci[0].Czesc[S].Nuta[Pet].Dlugosc = Player[CP].Nuta[Player[CP].HighNut].Dlugosc) - and (Czesci[0].Czesc[S].Nuta[Pet].Ton = Player[CP].Nuta[Player[CP].HighNut].Ton) then begin - Player[CP].Nuta[Player[CP].HighNut].Perfect := true; - end; - - end;// else beep; // if S = SMax - - end; // if moze - end; // for CP -// Log.LogStatus('EndBeat', 'NewBeat'); - -//On Sentence End -> For LineBonus + SingBar -if (sDet >= low(Czesci[0].Czesc)) AND (sDet <= high(Czesci[0].Czesc)) then -if assigned( Sender ) AND - ((Czesci[0].Czesc[SDet].Nuta[Czesci[0].Czesc[SDet].HighNut].Start + Czesci[0].Czesc[SDet].Nuta[Czesci[0].Czesc[SDet].HighNut].Dlugosc - 1) = Czas.AktBeatD) then - Sender.onSentenceEnd(sDet); - -end; - -procedure ClearScores(PlayerNum: integer); -begin - Player[PlayerNum].Score := 0; - Player[PlayerNum].ScoreI := 0; - Player[PlayerNum].ScoreLine := 0; - Player[PlayerNum].ScoreLineI := 0; - Player[PlayerNum].ScoreGolden := 0; - Player[PlayerNum].ScoreGoldenI := 0; - Player[PlayerNum].ScoreTotalI := 0; -end; - - -//-------------------- -// Function sets all Absolute Paths e.g. Song Path and makes sure the Directorys exist -//-------------------- -procedure InitializePaths; - - // Initialize a Path Variable - // After Setting Paths, make sure that Paths exist - function initialize_path( out aPathVar : String; const aLocation : String ): boolean; - var - lWriteable: Boolean; - lAttrib : integer; - begin - lWriteable := false; - aPathVar := aLocation; - - // Make sure the directory is needex - ForceDirectories(aPathVar); - - If DirectoryExists(aPathVar) then - begin - lAttrib := fileGetAttr(aPathVar); - - lWriteable := ( lAttrib and faDirectory <> 0 ) AND - NOT ( lAttrib and faReadOnly <> 0 ) - end; - - if not lWriteable then - Log.LogError('Error: Dir ('+ aLocation +') is Readonly'); - - result := lWriteable; - end; - -begin - - initialize_path( LogPath , Platform.GetLogPath ); - initialize_path( SoundPath , Platform.GetGameSharedPath + 'Sounds' + PathDelim ); - initialize_path( ThemePath , Platform.GetGameSharedPath + 'Themes' + PathDelim ); - initialize_path( SkinsPath , Platform.GetGameSharedPath + 'Skins' + PathDelim ); - initialize_path( LanguagesPath , Platform.GetGameSharedPath + 'Languages' + PathDelim ); - initialize_path( PluginPath , Platform.GetGameSharedPath + 'Plugins' + PathDelim ); - - initialize_path( ScreenshotsPath , Platform.GetGameUserPath + 'Screenshots' + PathDelim ); - - // Users Song Path .... - initialize_path( UserSongPath , Platform.GetGameUserPath + 'Songs' + PathDelim ); - initialize_path( UserCoversPath , Platform.GetGameUserPath + 'Covers' + PathDelim ); - initialize_path( UserPlaylistPath , Platform.GetGameUserPath + 'Playlists' + PathDelim ); - - // Shared Song Path .... - initialize_path( SongPath , Platform.GetGameSharedPath + 'Songs' + PathDelim ); - initialize_path( CoversPath , Platform.GetGameSharedPath + 'Covers' + PathDelim ); - initialize_path( PlaylistPath , Platform.GetGameSharedPath + 'Playlists' + PathDelim ); - - DecimalSeparator := ','; -end; - -end. - +unit UMain; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + SDL, + UGraphic, + UMusic, + URecord, + UTime, + SysUtils, + UDisplay, + UIni, + ULog, + ULyrics, + UScreenSing, + USong, + OpenGL12, + {$IFDEF UseSerialPort} + zlportio {you can disable it and all PortWriteB calls}, + {$ENDIF} + ULCD, + ULight, + UThemes; + +type + TPlayer = record + Name: string; + + //Index in Teaminfo record + TeamID: Byte; + PlayerID: Byte; + + //Scores + Score: real; + ScoreLine: real; + ScoreGolden: real; + + ScoreI: integer; + ScoreLineI: integer; + ScoreGoldenI: integer; + ScoreTotalI: integer; + + + + //LineBonus Mod + ScoreLast: Real;//Last Line Score + + //PerfectLineTwinkle Mod (effect) + LastSentencePerfect: Boolean; + //PerfectLineTwinkle Mod end + + +// Meter: real; + + HighNut: integer; + IlNut: integer; + Nuta: array of record + Start: integer; + Dlugosc: integer; + Detekt: real; // dokladne miejsce, w ktorym wykryto ta nute + Ton: real; + Perfect: boolean; // true if the note matches the original one, lit the star + + + + // Half size Notes Patch + Hit: boolean; // true if the note Hits the Line + //end Half size Notes Patch + + + + end; + end; + + +var + //Absolute Paths + GamePath: string; + SoundPath: string; + SongPath: string; + LogPath: string; + ThemePath: string; + SkinsPath: string; + ScreenshotsPath: string; + CoversPath: string; + LanguagesPath: string; + PluginPath: string; + PlayListPath: string; + + UserSongPath: string = ''; + UserCoversPath: string = ''; + UserPlaylistPath: string = ''; + + OGL: Boolean; + Done: Boolean; + Event: TSDL_event; + FileName: string; + Restart: boolean; + + // gracz i jego nuty + Player: array of TPlayer; + PlayersPlay: integer; + + CurrentSong : TSong; + +procedure InitializePaths; + +Procedure Main; +procedure MainLoop; +procedure CheckEvents; +procedure Sing(Sender: TScreenSing); +procedure NewSentence(Sender: TScreenSing); +procedure NewBeat(Sender: TScreenSing); // executed when on then new beat +procedure NewBeatC(Sender: TScreenSing); // executed when on then new beat for click +procedure NewBeatD(Sender: TScreenSing); // executed when on then new beat for detection +//procedure NewHalf; // executed when in the half between beats +procedure NewNote(Sender: TScreenSing); // detect note +function GetMidBeat(Time: real): real; +function GetTimeFromBeat(Beat: integer): real; +procedure ClearScores(PlayerNum: integer); + +implementation + +uses USongs, + UJoystick, + math, + UCommandLine, ULanguage, SDL_ttf, + USkins, UCovers, UCatCovers, UDataBase, UPlaylist, UDLLManager, + UParty, UCore, UGraphicClasses, UPluginDefs, UPlatform; + +const + Version = 'UltraStar Deluxe V 1.10 Alpha Build'; + +Procedure Main; +var + WndTitle: string; +begin + try + + WndTitle := Version; + + if Platform.TerminateIfAlreadyRunning( {var} WndTitle) then + Exit; + + //------------------------------ + //StartUp - Create Classes and Load Files + //------------------------------ + USTime := TTime.Create; + + // Commandline Parameter Parser + Params := TCMDParams.Create; + + // Log + Benchmark + Log := TLog.Create; + Log.Title := WndTitle; + Log.Enabled := Not Params.NoLog; + Log.BenchmarkStart(0); + + // Language + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Paths', 'Initialization'); + InitializePaths; + Log.LogStatus('Load Language', 'Initialization'); + Language := TLanguage.Create; + //Add Const Values: + Language.AddConst('US_VERSION', Version); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Language', 1); + + // SDL + Log.BenchmarkStart(1); + Log.LogStatus('Initialize SDL', 'Initialization'); + SDL_Init(SDL_INIT_VIDEO); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing SDL', 1); + + // SDL_ttf + Log.BenchmarkStart(1); + Log.LogStatus('Initialize SDL_ttf', 'Initialization'); + TTF_Init(); //ttf_quit(); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing SDL_ttf', 1); + + // Skin + Log.BenchmarkStart(1); + Log.LogStatus('Loading Skin List', 'Initialization'); + Skin := TSkin.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Skin List', 1); + + // Sound + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Sound', 'Initialization'); + InitializeSound(); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Sound', 1); + + // Ini + Paths (depends on Sound) + Log.BenchmarkStart(1); + Log.LogStatus('Load Ini', 'Initialization'); + Ini := TIni.Create; + Ini.Load; + + //Load Languagefile + if (Params.Language <> -1) then + Language.ChangeLanguage(ILanguage[Params.Language]) + else + Language.ChangeLanguage(ILanguage[Ini.Language]); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Ini', 1); + + + // LCD + Log.BenchmarkStart(1); + Log.LogStatus('Load LCD', 'Initialization'); + LCD := TLCD.Create; + if Ini.LPT = 1 then begin + // LCD.HalfInterface := true; + LCD.Enable; + LCD.Clear; + LCD.WriteText(1, ' UltraStar '); + LCD.WriteText(2, ' Loading... '); + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading LCD', 1); + + // Light + Log.BenchmarkStart(1); + Log.LogStatus('Load Light', 'Initialization'); + Light := TLight.Create; + if Ini.LPT = 2 then begin + Light.Enable; + end; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Light', 1); + + + + // Theme + Log.BenchmarkStart(1); + Log.LogStatus('Load Themes', 'Initialization'); + Theme := TTheme.Create(ThemePath + ITheme[Ini.Theme] + '.ini', Ini.Color); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Themes', 1); + + // Covers Cache + Log.BenchmarkStart(1); + Log.LogStatus('Creating Covers Cache', 'Initialization'); + Covers := TCovers.Create; + Log.LogBenchmark('Loading Covers Cache Array', 1); + Log.BenchmarkStart(1); + + // Category Covers + Log.BenchmarkStart(1); + Log.LogStatus('Creating Category Covers Array', 'Initialization'); + CatCovers:= TCatCovers.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Category Covers Array', 1); + + // Songs + //Log.BenchmarkStart(1); + Log.LogStatus('Creating Song Array', 'Initialization'); + Songs := TSongs.Create; +// Songs.LoadSongList; + + Log.LogStatus('Creating 2nd Song Array', 'Initialization'); + CatSongs := TCatSongs.Create; + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Songs', 1); + + // PluginManager + Log.BenchmarkStart(1); + Log.LogStatus('PluginManager', 'Initialization'); + DLLMan := TDLLMan.Create; //Load PluginList + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PluginManager', 1); + + {// Party Mode Manager + Log.BenchmarkStart(1); + Log.LogStatus('PartySession Manager', 'Initialization'); + PartySession := TPartySession.Create; //Load PartySession + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading PartySession Manager', 1); } + + // Graphics + Log.BenchmarkStart(1); + Log.LogStatus('Initialize 3D', 'Initialization'); + Initialize3D(WndTitle); + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing 3D', 1); + + // Score Saving System + Log.BenchmarkStart(1); + Log.LogStatus('DataBase System', 'Initialization'); + DataBase := TDataBaseSystem.Create; + + if (Params.ScoreFile = '') then + DataBase.Init ('Ultrastar.db') + else + DataBase.Init (Params.ScoreFile); + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading DataBase System', 1); + + //Playlist Manager + Log.BenchmarkStart(1); + Log.LogStatus('Playlist Manager', 'Initialization'); + PlaylistMan := TPlaylistManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Playlist Manager', 1); + + //GoldenStarsTwinkleMod + Log.BenchmarkStart(1); + Log.LogStatus('Effect Manager', 'Initialization'); + GoldenRec := TEffectManager.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Particel System', 1); + + // Joypad + if (Ini.Joypad = 1) OR (Params.Joypad) then + begin + Log.BenchmarkStart(1); + Log.LogStatus('Initialize Joystick', 'Initialization'); + Joy := TJoy.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Joystick', 1); + end; + + Log.BenchmarkEnd(0); + Log.LogBenchmark('Loading Time', 0); + + Log.LogError('Creating Core'); + Core := TCore.Create('Ultrastar Deluxe Beta', MakeVersion(1,1,0, chr(0))); + + Log.LogError('Running Core'); + Core.Run; + + //------------------------------ + //Start- Mainloop + //------------------------------ + //Music.SetLoop(true); + //Music.SetVolume(50); + //Music.Open(SkinPath + 'Menu Music 3.mp3'); + //Music.Play; + Log.LogStatus('Main Loop', 'Initialization'); + MainLoop; + + finally + //------------------------------ + //Finish Application + //------------------------------ + + {$ifdef WIN32} + if Ini.LPT = 1 then LCD.Clear; + if Ini.LPT = 2 then Light.TurnOff; + {$endif} + + Log.LogStatus('Main Loop', 'Finished'); + Log.Free; + end; +end; + +procedure MainLoop; +var + Delay: integer; +begin + try + Delay := 0; + SDL_EnableKeyRepeat(125, 125); + + CountSkipTime(); // JB - for some reason this seems to be needed when we use the SDL Timer functions. + While not Done do + Begin + // joypad + if (Ini.Joypad = 1) OR (Params.Joypad) then + Joy.Update; + + // keyboard events + CheckEvents; + + // display + done := not Display.Draw; + SwapBuffers; + + // light + Light.Refresh; + + // delay + CountMidTime; + + Delay := Floor(1000 / 100 - 1000 * TimeMid); + + if Delay >= 1 then + SDL_Delay(Delay); // dynamic, maximum is 100 fps + + CountSkipTime; + + // reinitialization of graphics + if Restart then + begin + Reinitialize3D; + Restart := false; + end; + + End; + + finally + UnloadOpenGL; + end; +End; + +Procedure CheckEvents; +//var +// p: pointer; +Begin + if not Assigned(Display.NextScreen) then + While SDL_PollEvent( @event ) = 1 Do + Begin +// beep; + Case Event.type_ Of + SDL_QUITEV: begin + Display.Fade := 0; + Display.NextScreenWithCheck := nil; + Display.CheckOK := True; + end; +{ SDL_MOUSEBUTTONDOWN: + With Event.button Do + Begin + If State = SDL_BUTTON_LEFT Then + Begin + // + End; + End; // With} + SDL_KEYDOWN: + begin + // remap the "keypad enter" key to the "standard enter" key + if (Event.key.keysym.sym = SDLK_KP_ENTER) then + Event.key.keysym.sym := SDLK_RETURN; + + //ScreenShot hack. If Print is pressed-> Make screenshot and Save to Screenshots Path + if (Event.key.keysym.sym = SDLK_SYSREQ) or (Event.key.keysym.sym = SDLK_PRINT) then + Display.ScreenShot + + // popup hack... if there is a visible popup then let it handle input instead of underlying screen + // shoud be done in a way to be sure the topmost popup has preference (maybe error, then check) + else if (ScreenPopupError <> NIL) and (ScreenPopupError.Visible) then + done := not ScreenPopupError.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) + else if (ScreenPopupCheck <> NIL) AND (ScreenPopupCheck.Visible) then + done := not ScreenPopupCheck.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) + // end of popup hack + + else + begin + // check for Screen want to Exit + done := Not Display.ActualScreen^.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True); + + //If Screen wants to Exit + if done then + begin + //If Question Option is enabled then Show Exit Popup + if (Ini.AskbeforeDel = 1) then + begin + Display.ActualScreen^.CheckFadeTo(NIL,'MSG_QUIT_USDX'); + end + else //When asking for exit is disabled then simply exit + begin + Display.Fade := 0; + Display.NextScreenWithCheck := nil; + Display.CheckOK := True; + end; + end; + + end; // if (Not Display.ActualScreen^.ParseInput(Event.key.keysym.scancode, True)) then + end; +// SDL_JOYAXISMOTION: +// begin +// beep +// end; + SDL_JOYBUTTONDOWN: + begin + beep + end; + End; // Case Event.type_ + End; // While +End; // CheckEvents + +function GetTimeForBeats(BPM, Beats: real): real; +begin + Result := 60 / BPM * Beats; +end; + +function GetBeats(BPM, msTime: real): real; +begin + Result := BPM * msTime / 60; +end; + +procedure GetMidBeatSub(BPMNum: integer; var Time: real; var CurBeat: real); +var + NewTime: real; +begin + if High(CurrentSong.BPM) = BPMNum then begin + // last BPM + CurBeat := CurrentSong.BPM[BPMNum].StartBeat + GetBeats(CurrentSong.BPM[BPMNum].BPM, Time); + Time := 0; + end else begin + // not last BPM + // count how much time is it for start of the new BPM and store it in NewTime + NewTime := GetTimeForBeats(CurrentSong.BPM[BPMNum].BPM, CurrentSong.BPM[BPMNum+1].StartBeat - CurrentSong.BPM[BPMNum].StartBeat); + + // compare it to remaining time + if (Time - NewTime) > 0 then begin + // there is still remaining time + CurBeat := CurrentSong.BPM[BPMNum].StartBeat; + Time := Time - NewTime; + end else begin + // there is no remaining time + CurBeat := CurrentSong.BPM[BPMNum].StartBeat + GetBeats(CurrentSong.BPM[BPMNum].BPM, Time); + Time := 0; + end; // if + end; // if +end; + +function GetMidBeat(Time: real): real; +var + CurBeat: real; + CurBPM: integer; +// TopBeat: real; +// TempBeat: real; +// TempTime: real; +begin + Result := 0; + if Length(CurrentSong.BPM) = 1 then Result := Time * CurrentSong.BPM[0].BPM / 60; + + (* 2 BPMs *) +{ if Length(CurrentSong.BPM) > 1 then begin + (* new system *) + CurBeat := 0; + TopBeat := GetBeats(CurrentSong.BPM[0].BPM, Time); + if TopBeat > CurrentSong.BPM[1].StartBeat then begin + // analyze second BPM + Time := Time - GetTimeForBeats(CurrentSong.BPM[0].BPM, CurrentSong.BPM[1].StartBeat - CurBeat); + CurBeat := CurrentSong.BPM[1].StartBeat; + TopBeat := GetBeats(CurrentSong.BPM[1].BPM, Time); + Result := CurBeat + TopBeat; + + end else begin + (* pierwszy przedzial *) + Result := TopBeat; + end; + end; // if} + + (* more BPMs *) + if Length(CurrentSong.BPM) > 1 then begin + + CurBeat := 0; + CurBPM := 0; + while (Time > 0) do begin + GetMidBeatSub(CurBPM, Time, CurBeat); + Inc(CurBPM); + end; + + Result := CurBeat; + end; // if +end; + +function GetTimeFromBeat(Beat: integer): real; +var + CurBPM: integer; +begin + Result := 0; + if Length(CurrentSong.BPM) = 1 then Result := CurrentSong.GAP / 1000 + Beat * 60 / CurrentSong.BPM[0].BPM; + + (* more BPMs *) + if Length(CurrentSong.BPM) > 1 then begin + Result := CurrentSong.GAP / 1000; + CurBPM := 0; + while (CurBPM <= High(CurrentSong.BPM)) and (Beat > CurrentSong.BPM[CurBPM].StartBeat) do begin + if (CurBPM < High(CurrentSong.BPM)) and (Beat >= CurrentSong.BPM[CurBPM+1].StartBeat) then begin + // full range + Result := Result + (60 / CurrentSong.BPM[CurBPM].BPM) * (CurrentSong.BPM[CurBPM+1].StartBeat - CurrentSong.BPM[CurBPM].StartBeat); + end; + + if (CurBPM = High(CurrentSong.BPM)) or (Beat < CurrentSong.BPM[CurBPM+1].StartBeat) then begin + // in the middle + Result := Result + (60 / CurrentSong.BPM[CurBPM].BPM) * (Beat - CurrentSong.BPM[CurBPM].StartBeat); + end; + Inc(CurBPM); + end; + +{ while (Time > 0) do begin + GetMidBeatSub(CurBPM, Time, CurBeat); + Inc(CurBPM); + end;} + end; // if} +end; + +procedure Sing(Sender: TScreenSing); +var + Pet: integer; + PetGr: integer; + CP: integer; + Done: real; + N: integer; +begin + Czas.Teraz := Czas.Teraz + TimeSkip; + + Czas.OldBeat := Czas.AktBeat; + Czas.MidBeat := GetMidBeat(Czas.Teraz - (CurrentSong.Gap{ + 90 I've forgotten for what it is}) / 1000); // new system with variable BPM in function + Czas.AktBeat := Floor(Czas.MidBeat); + +// Czas.OldHalf := Czas.AktHalf; +// Czas.MidHalf := Czas.MidBeat + 0.5; +// Czas.AktHalf := Floor(Czas.MidHalf); + + Czas.OldBeatC := Czas.AktBeatC; + Czas.MidBeatC := GetMidBeat(Czas.Teraz - (CurrentSong.Gap) / 1000); + Czas.AktBeatC := Floor(Czas.MidBeatC); + + Czas.OldBeatD := Czas.AktBeatD; + Czas.MidBeatD := -0.5+GetMidBeat(Czas.Teraz - (CurrentSong.Gap + 120 + 20) / 1000); // MidBeat with addition GAP + Czas.AktBeatD := Floor(Czas.MidBeatD); + Czas.FracBeatD := Frac(Czas.MidBeatD); + + // sentences routines + for PetGr := 0 to 0 do begin;//High(Gracz) do begin + CP := PetGr; + // ustawianie starej czesci + Czas.OldCzesc := Czesci[CP].Akt; + + // wybieranie aktualnej czesci + for Pet := 0 to Czesci[CP].High do + if Czas.AktBeat >= Czesci[CP].Czesc[Pet].Start then Czesci[CP].Akt := Pet; + + // czysczenie nut gracza, gdy to jest nowa plansza + // (optymizacja raz na halfbeat jest zla) + if Czesci[CP].Akt <> Czas.OldCzesc then NewSentence(Sender); + + end; // for PetGr + + // wykonuje operacje raz na beat + if (Czas.AktBeat >= 0) and (Czas.OldBeat <> Czas.AktBeat) then + NewBeat(Sender); + + // make some operations on clicks + if {(Czas.AktBeatC >= 0) and }(Czas.OldBeatC <> Czas.AktBeatC) then + NewBeatC(Sender); + + // make some operations when detecting new voice pitch + if (Czas.AktBeatD >= 0) and (Czas.OldBeatD <> Czas.AktBeatD) then + NewBeatD(Sender); + + // wykonuje operacje w polowie beatu +// if (Czas.AktHalf >= 1) and (Czas.OldHalf <> Czas.AktHalf) then +// NewHalf; + + // plynnie przesuwa text + Done := 1; + for N := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start <= Czas.MidBeat) + and (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start + Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc >= Czas.MidBeat) then + Done := (Czas.MidBeat - Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start) / (Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc); + + N := Czesci[0].Czesc[Czesci[0].Akt].HighNut; + + // wylacza ostatnia nute po przejsciu + {// todo: Lyrics + if (Ini.LyricsEffect = 1) and (Done = 1) and + (Czas.MidBeat > Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Start + Czesci[0].Czesc[Czesci[0].Akt].Nuta[N].Dlugosc) + then Sender.LyricMain.Selected := -1; + + if Done > 1 then Done := 1; + Sender.LyricMain.Done := Done; } + + // use Done with LCD +{ with ScreenSing do begin + if LyricMain.Selected >= 0 then begin + LCD.MoveCursor(1, LyricMain.SelectedLetter + Round((LyricMain.SelectedLength-1) * Done)); + LCD.ShowCursor; + end; + end;} + + +end; + +procedure NewSentence(Sender: TScreenSing); +var +G: Integer; +begin + // czyszczenie nut graczy + for G := 0 to High(Player) do begin + Player[G].IlNut := 0; + Player[G].HighNut := -1; + SetLength(Player[G].Nuta, 0); + end; + + // Add Words to Lyrics + with Sender do begin + {LyricMain.AddCzesc(Czesci[0].Akt); + if Czesci[0].Akt < Czesci[0].High then + LyricSub.AddCzesc(Czesci[0].Akt+1) + else + LyricSub.Clear;} + while (not Lyrics.LineinQueue) AND (Lyrics.LineCounter <= High(Czesci[0].Czesc)) do + Lyrics.AddLine(@Czesci[0].Czesc[Lyrics.LineCounter]); + end; + + Sender.UpdateLCD; + + //On Sentence Change... + Sender.onSentenceChange(Czesci[0].Akt); +end; + +procedure NewBeat(Sender: TScreenSing); +var + Pet: integer; +// TempBeat: integer; +begin + // ustawia zaznaczenie tekstu +// SingScreen.LyricMain.Selected := -1; + for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeat) then begin + // operates on currently beated note + //Todo: Lyrics + //Sender.LyricMain.Selected := Pet; + +// LCD.MoveCursor(1, ScreenSing.LyricMain.SelectedLetter); +// LCD.ShowCursor; + + //LCD.MoveCursorBR(Sender.LyricMain.SelectedLetter); + LCD.ShowCursor; + + end; +end; + +procedure NewBeatC; +var + Pet: integer; +// LPT_1: integer; +// LPT_2: integer; +begin +// LPT_1 := 1; +// LPT_2 := 1; + + // beat click + if (Ini.BeatClick = 1) and ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then + AudioPlayback.PlaySound(SoundLib.Click); + + // debug system on LPT + if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod Czesci[0].Resolution = 0) then begin + //LPT_1 := 0; +// Light.LightOne(0, 150); + + Light.LightOne(1, 200); // beat light + if ParamStr(1) = '-doublelights' then + Light.LightOne(0, 200); // beat light + + +{ if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod (Czesci[0].Resolution * 2) = 0) then + Light.LightOne(0, 150) + else + Light.LightOne(1, 150)} + end; + + for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeatC) then begin + // click assist + if Ini.ClickAssist = 1 then + AudioPlayback.PlaySound(SoundLib.Click); + + //LPT_2 := 0; + if ParamStr(1) <> '-doublelights' then + Light.LightOne(0, 150); //125 + + + // drum machine +(* TempBeat := Czas.AktBeat;// + 2; + if (TempBeat mod 8 = 0) then Music.PlayDrum; + if (TempBeat mod 8 = 4) then Music.PlayClap; +// if (TempBeat mod 4 = 2) then Music.PlayHihat; + if (TempBeat mod 4 <> 0) then Music.PlayHihat;*) + end; + + {$IFDEF UseSerialPort} + // PortWriteB($378, LPT_1 + LPT_2 * 2); // 0 zapala + {$ENDIF} +end; + +procedure NewBeatD(Sender: TScreenSing); +begin + NewNote(Sender); +end; + +//procedure NewHalf; +//begin +// NewNote; +//end; + +procedure NewNote(Sender: TScreenSing); +var + CP: integer; // current player + S: integer; // sentence + SMin: integer; + SMax: integer; + SDet: integer; // temporary: sentence of detected note + Pet: integer; + Mozna: boolean; + Nowa: boolean; + Range: integer; + NoteHit:boolean; +begin +// Log.LogStatus('Beat ' + IntToStr(Czas.AktBeat) + ' HalfBeat ' + IntToStr(Czas.AktHalf), 'NewBeat'); +// beep; + + // On linux we get an AV @ NEWNOTE, line 600 of Classes/UMain.pas + if not assigned( AudioInputProcessor.Sound ) then // TODO : JB_Linux ... why is this now not assigned... it was fine a few hours ago.. + exit; + + // analizuje dla obu graczy ten sam sygnal (Sound.OneSrcForBoth) + // albo juz lepiej nie + for CP := 0 to PlayersPlay-1 do + begin + + // analyze buffer + AudioInputProcessor.Sound[CP].AnalyzeBuffer; + + // adds some noise +// Czas.Ton := Czas.Ton + Round(Random(3)) - 1; + + // 0.5.0: count min and max sentence range for checking (detection is delayed to the notes we see on the screen) + SMin := Czesci[0].Akt-1; + if SMin < 0 then SMin := 0; + SMax := Czesci[0].Akt; + + // check if we can add new note + Mozna := false; + SDet:=SMin; + for S := SMin to SMax do + for Pet := 0 to Czesci[0].Czesc[S].HighNut do + if ((Czesci[0].Czesc[S].Nuta[Pet].Start <= Czas.AktBeatD) + and (Czesci[0].Czesc[S].Nuta[Pet].Start + Czesci[0].Czesc[S].Nuta[Pet].Dlugosc - 1 >= Czas.AktBeatD)) + and (not Czesci[0].Czesc[S].Nuta[Pet].FreeStyle) // but don't allow when it's FreeStyle note + and (Czesci[0].Czesc[S].Nuta[Pet].Dlugosc > 0) // and make sure the note lenghts is at least 1 + then begin + SDet := S; + Mozna := true; + Break; + end; + + S := SDet; + + + + + +// Czas.SzczytJest := true; +// Czas.Ton := 27; + + // gdy moze, to dodaje nute + if (AudioInputProcessor.Sound[CP].ToneValid) and (Mozna) then begin + // operowanie na ostatniej nucie + for Pet := 0 to Czesci[0].Czesc[S].HighNut do + if (Czesci[0].Czesc[S].Nuta[Pet].Start <= Czas.OldBeatD+1) + and (Czesci[0].Czesc[S].Nuta[Pet].Start + + Czesci[0].Czesc[S].Nuta[Pet].Dlugosc > Czas.OldBeatD+1) then begin + // to robi, tylko dla pary nut (oryginalnej i gracza) + + // przesuwanie tonu w odpowiednia game + while (AudioInputProcessor.Sound[CP].Tone - Czesci[0].Czesc[S].Nuta[Pet].Ton > 6) do + AudioInputProcessor.Sound[CP].Tone := AudioInputProcessor.Sound[CP].Tone - 12; + + while (AudioInputProcessor.Sound[CP].Tone - Czesci[0].Czesc[S].Nuta[Pet].Ton < -6) do + AudioInputProcessor.Sound[CP].Tone := AudioInputProcessor.Sound[CP].Tone + 12; + + // Half size Notes Patch + NoteHit := false; + + //if Ini.Difficulty = 0 then Range := 2; + //if Ini.Difficulty = 1 then Range := 1; + //if Ini.Difficulty = 2 then Range := 0; + Range := 2 - Ini.Difficulty; + + if abs(Czesci[0].Czesc[S].Nuta[Pet].Ton - AudioInputProcessor.Sound[CP].Tone) <= Range then begin + AudioInputProcessor.Sound[CP].Tone := Czesci[0].Czesc[S].Nuta[Pet].Ton; + + + // Half size Notes Patch + NoteHit := true; + + + if (Ini.LineBonus = 0) then + begin + // add points without LineBonus + case Czesci[0].Czesc[S].Nuta[Pet].Wartosc of + 1: Player[CP].Score := Player[CP].Score + 10000 / Czesci[0].Wartosc * + Czesci[0].Czesc[S].Nuta[Pet].Wartosc; + 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 10000 / Czesci[0].Wartosc * + Czesci[0].Czesc[S].Nuta[Pet].Wartosc; + end; + end + else + begin + // add points with Line Bonus + case Czesci[0].Czesc[S].Nuta[Pet].Wartosc of + 1: Player[CP].Score := Player[CP].Score + 9000 / Czesci[0].Wartosc * + Czesci[0].Czesc[S].Nuta[Pet].Wartosc; + 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 9000 / Czesci[0].Wartosc * + Czesci[0].Czesc[S].Nuta[Pet].Wartosc; + end; + end; + + Player[CP].ScoreI := Floor(Player[CP].Score / 10) * 10; + Player[CP].ScoreGoldenI := Floor(Player[CP].ScoreGolden / 10) * 10; + + Player[CP].ScoreTotalI := Player[CP].ScoreI + Player[CP].ScoreGoldenI + Player[CP].ScoreLineI; + end; + + end; // operowanie + + // sprawdzanie czy to nowa nuta, czy przedluzenie + if S = SMax then begin + Nowa := true; + // jezeli ostatnia ma ten sam ton + if (Player[CP].IlNut > 0 ) + and (Player[CP].Nuta[Player[CP].HighNut].Ton = AudioInputProcessor.Sound[CP].Tone) + and (Player[CP].Nuta[Player[CP].HighNut].Start + Player[CP].Nuta[Player[CP].HighNut].Dlugosc = Czas.AktBeatD) + then Nowa := false; + // jezeli jest jakas nowa nuta na sprawdzanym beacie + for Pet := 0 to Czesci[0].Czesc[S].HighNut do + if (Czesci[0].Czesc[S].Nuta[Pet].Start = Czas.AktBeatD) then + Nowa := true; + + // dodawanie nowej nuty + if Nowa then begin + // nowa nuta + Player[CP].IlNut := Player[CP].IlNut + 1; + Player[CP].HighNut := Player[CP].HighNut + 1; + SetLength(Player[CP].Nuta, Player[CP].IlNut); + Player[CP].Nuta[Player[CP].HighNut].Start := Czas.AktBeatD; + Player[CP].Nuta[Player[CP].HighNut].Dlugosc := 1; + Player[CP].Nuta[Player[CP].HighNut].Ton := AudioInputProcessor.Sound[CP].Tone; // Ton || TonDokl + Player[CP].Nuta[Player[CP].HighNut].Detekt := Czas.MidBeat; + + + // Half Note Patch + Player[CP].Nuta[Player[CP].HighNut].Hit := NoteHit; + + + // Log.LogStatus('Nowa Nuta ' + IntToStr(Gracz.Nuta[Gracz.HighNut].Start), 'NewBeat'); + + end else begin + // przedluzenie nuty + Player[CP].Nuta[Player[CP].HighNut].Dlugosc := Player[CP].Nuta[Player[CP].HighNut].Dlugosc + 1; + end; + + + // check for perfect note and then lit the star (on Draw) + for Pet := 0 to Czesci[0].Czesc[S].HighNut do + if (Czesci[0].Czesc[S].Nuta[Pet].Start = Player[CP].Nuta[Player[CP].HighNut].Start) + and (Czesci[0].Czesc[S].Nuta[Pet].Dlugosc = Player[CP].Nuta[Player[CP].HighNut].Dlugosc) + and (Czesci[0].Czesc[S].Nuta[Pet].Ton = Player[CP].Nuta[Player[CP].HighNut].Ton) then begin + Player[CP].Nuta[Player[CP].HighNut].Perfect := true; + end; + + end;// else beep; // if S = SMax + + end; // if moze + end; // for CP +// Log.LogStatus('EndBeat', 'NewBeat'); + +//On Sentence End -> For LineBonus + SingBar +if (sDet >= low(Czesci[0].Czesc)) AND (sDet <= high(Czesci[0].Czesc)) then +if assigned( Sender ) AND + ((Czesci[0].Czesc[SDet].Nuta[Czesci[0].Czesc[SDet].HighNut].Start + Czesci[0].Czesc[SDet].Nuta[Czesci[0].Czesc[SDet].HighNut].Dlugosc - 1) = Czas.AktBeatD) then + Sender.onSentenceEnd(sDet); + +end; + +procedure ClearScores(PlayerNum: integer); +begin + Player[PlayerNum].Score := 0; + Player[PlayerNum].ScoreI := 0; + Player[PlayerNum].ScoreLine := 0; + Player[PlayerNum].ScoreLineI := 0; + Player[PlayerNum].ScoreGolden := 0; + Player[PlayerNum].ScoreGoldenI := 0; + Player[PlayerNum].ScoreTotalI := 0; +end; + + +//-------------------- +// Function sets all Absolute Paths e.g. Song Path and makes sure the Directorys exist +//-------------------- +procedure InitializePaths; + + // Initialize a Path Variable + // After Setting Paths, make sure that Paths exist + function initialize_path( out aPathVar : String; const aLocation : String ): boolean; + var + lWriteable: Boolean; + lAttrib : integer; + begin + lWriteable := false; + aPathVar := aLocation; + + // Make sure the directory is needex + ForceDirectories(aPathVar); + + If DirectoryExists(aPathVar) then + begin + lAttrib := fileGetAttr(aPathVar); + + lWriteable := ( lAttrib and faDirectory <> 0 ) AND + NOT ( lAttrib and faReadOnly <> 0 ) + end; + + if not lWriteable then + Log.LogError('Error: Dir ('+ aLocation +') is Readonly'); + + result := lWriteable; + end; + +begin + + initialize_path( LogPath , Platform.GetLogPath ); + initialize_path( SoundPath , Platform.GetGameSharedPath + 'Sounds' + PathDelim ); + initialize_path( ThemePath , Platform.GetGameSharedPath + 'Themes' + PathDelim ); + initialize_path( SkinsPath , Platform.GetGameSharedPath + 'Skins' + PathDelim ); + initialize_path( LanguagesPath , Platform.GetGameSharedPath + 'Languages' + PathDelim ); + initialize_path( PluginPath , Platform.GetGameSharedPath + 'Plugins' + PathDelim ); + + initialize_path( ScreenshotsPath , Platform.GetGameUserPath + 'Screenshots' + PathDelim ); + + // Users Song Path .... + initialize_path( UserSongPath , Platform.GetGameUserPath + 'Songs' + PathDelim ); + initialize_path( UserCoversPath , Platform.GetGameUserPath + 'Covers' + PathDelim ); + initialize_path( UserPlaylistPath , Platform.GetGameUserPath + 'Playlists' + PathDelim ); + + // Shared Song Path .... + initialize_path( SongPath , Platform.GetGameSharedPath + 'Songs' + PathDelim ); + initialize_path( CoversPath , Platform.GetGameSharedPath + 'Covers' + PathDelim ); + initialize_path( PlaylistPath , Platform.GetGameSharedPath + 'Playlists' + PathDelim ); + + DecimalSeparator := ','; +end; + +end. + -- cgit v1.2.3 From 6fb575e34735f50f68f31cff7159b2bbd6019f40 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 5 Feb 2008 22:51:57 +0000 Subject: Added autogen.sh on recomendation of Fredz. simply creation of configure script git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@834 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/autogen.sh | 1 + 1 file changed, 1 insertion(+) create mode 100755 Game/Code/autogen.sh (limited to 'Game/Code') diff --git a/Game/Code/autogen.sh b/Game/Code/autogen.sh new file mode 100755 index 00000000..3f598d0b --- /dev/null +++ b/Game/Code/autogen.sh @@ -0,0 +1 @@ +aclocal -I m4 && autoconf -- cgit v1.2.3 From e0f79449eedac343fbac90b72b7a6792e8e940e9 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 6 Feb 2008 09:59:51 +0000 Subject: fixed the configure stuff though it needs some further adjustments git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@835 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlatformLinux.pas | 21 +++++++++++++++---- Game/Code/config.inc.in | 10 ++++++--- Game/Code/configure.ac | 40 ++++-------------------------------- 3 files changed, 28 insertions(+), 43 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlatformLinux.pas b/Game/Code/Classes/UPlatformLinux.pas index b962d8a5..fe4bbf11 100644 --- a/Game/Code/Classes/UPlatformLinux.pas +++ b/Game/Code/Classes/UPlatformLinux.pas @@ -43,7 +43,8 @@ uses {$ELSE} oldlinux, {$ENDIF} - SysUtils; + SysUtils, + UConfig; {$IFDEF FPC_VERSION_2_2_0_PLUS} Function TPlatformLinux.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; @@ -137,7 +138,11 @@ begin if FindCmdLineSwitch( cUseLocalPaths ) then result := ExtractFilePath(ParamStr(0)) else - result := '/var/log/UltraStarDeluxe/'; +{$IFDEF UseLocalDirs} + result := ExtractFilePath(ParamStr(0)) +{$ELSE} + result := LogPath+'/'; +{$ENDIF} end; function TPlatformLinux.GetGameSharedPath : WideString; @@ -145,7 +150,11 @@ begin if FindCmdLineSwitch( cUseLocalPaths ) then result := ExtractFilePath(ParamStr(0)) else - result := '/usr/share/UltraStarDeluxe/'; +{$IFDEF UseLocalDirs} + result := ExtractFilePath(ParamStr(0)) +{$ELSE} + result := SharedPath+'/'; +{$ENDIF} end; function TPlatformLinux.GetGameUserPath : WideString; @@ -153,7 +162,11 @@ begin if FindCmdLineSwitch( cUseLocalPaths ) then result := ExtractFilePath(ParamStr(0)) else - result := get_homedir()+'/.UltraStarDeluxe/'; +{$IFDEF UseLocalDirs} + result := ExtractFilePath(ParamStr(0)) +{$ELSE} + result := get_homedir()+'/.'+PathSuffix+'/'; +{$ENDIF} end; function TPlatformLinux.get_homedir(): string; diff --git a/Game/Code/config.inc.in b/Game/Code/config.inc.in index a0bece8a..a51ce23b 100644 --- a/Game/Code/config.inc.in +++ b/Game/Code/config.inc.in @@ -1,5 +1,6 @@ {***************************************************************** * Configuration file for @PACKAGE_NAME@ @PACKAGE_VERSION@ + * @configure_input@ *****************************************************************} {* Misc options *} @@ -8,9 +9,12 @@ {* Paths *} -PathSuffix : WideString = '@suffix@'; -LogPath : WideString = '@logrootdir@/'+USDXPathSuffix+'/'; -SharedPath : WideString = '@datarootdir@/'+USDXPathSuffix+'/'; +{$@DEFINE_USE_LOCAL_DIRS@ UseLocalDirs} +{$IF not Defined(UseLocalDirs) and Defined(IncludeConstants)} + PathSuffix = WideString('@suffix@'); + LogPath = WideString('@logrootdir@/'+PathSuffix); + SharedPath = WideString('@sharerootdir@/'+PathSuffix); +{$IFEND} {* Libraries *} diff --git a/Game/Code/configure.ac b/Game/Code/configure.ac index ef0516d5..40e8a6d2 100644 --- a/Game/Code/configure.ac +++ b/Game/Code/configure.ac @@ -19,9 +19,6 @@ PACKAGE_WEBSITE="http://www.ultrastardeluxe.org/" # specify the IRC-channel here PACKAGE_IRC="#ultrastardx at quakenet.org" -AUTOCONF_INFO=[generated automatically by -*- Autoconf -*- -Do NOT edit this file. Edit ... instead.] - # Specify a source-file so autoconf can check if the source-dir exists AC_CONFIG_SRCDIR(UltraStar.lpr) @@ -49,15 +46,6 @@ if [[ x$with_lazarus = xno ]] ; then AC_MSG_ERROR([Lazarus is required. It is impossible to build without it.]); fi -# add jedi-sdl option -AC_ARG_WITH([jedi-sdl], - [AS_HELP_STRING([--with-jedi-sdl=DIR], - [Directory of JEDI-SDL @<:@lib/JEDI-SDLv1.0@:>@])], - [with_jedi_sdl=$withval], [with_jedi_sdl="lib/JEDI-SDLv1.0"]) -if [[ x$with_jedi_sdl = xno -o x$with_jedi_sdl = xyes ]]; then - AC_MSG_ERROR([JEDI-SDL is required. Specify its directory.]); -fi - # add portaudio option AC_ARG_WITH([portaudio], [AS_HELP_STRING([--with-portaudio=DIR], @@ -279,27 +267,6 @@ AC_MSG_RESULT(@<:@$LAZARUS_VERSION@:>@) # find sdl AC_PKG_CHECK_VERSION(SDL, [sdl], yes) -# check if JEDI-SDL pascal headers exist -AC_MSG_CHECKING(for JEDI-SDL pascal headers) - -JEDISDL_DIR="$with_jedi_sdl" -if [[ ! -d "$JEDISDL_DIR" ]]; then - AC_MSG_RESULT(no) - AC_MSG_ERROR([Path specified for JEDI-SDL is not a directory.]); -fi -#http://delphi-jedi.org -# -d "$JEDISDL_DIR/SDL_ttf" -a -# -d "$JEDISDL_DIR/SDL_Image" -a -# -d "$JEDISDL_DIR/OpenGL" -a -# TODO: add further tests and check the version -if [[ -d "$JEDISDL_DIR/sdl" ]]; then - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) -# AC_MSG_ERROR([JEDI-SDL is not available. -#Download it and extract it to "$JEDISDL_DIR".]); -fi - # find sqlite3 AC_PKG_CHECK_VERSION(SQLITE3, [sqlite3], yes) @@ -362,8 +329,10 @@ AC_SUBST_DEFINE(HAVE_PORTMIXER, $PORTMIXER_HAVE) AC_SUBST(LAZARUS_DIR) -logrootdir=$with_logrootdir -AC_SUBST(logrootdir) +AC_SUBST_DEFINE(USE_LOCAL_DIRS, $enable_dev_install) +AC_SUBST(suffix) +AC_SUBST(logrootdir, [$with_logrootdir]) +AC_DEFINE_DIR(sharerootdir, datarootdir) AC_SUBST(PACKAGE_WEBSITE) @@ -401,7 +370,6 @@ AC_MSG_NOTICE([ !!! $PACKAGE_IRC !!! !!! Known issues: -!!! - "make" might not work correctly !!! - Audio-output and -input are not working yet !!! - The editor is broken !!! -- cgit v1.2.3 From c5b20922912a1f5449c4c3aecd96a1959d7d227a Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 7 Feb 2008 02:27:07 +0000 Subject: Sorry, forgot to check this in git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@836 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/m4/ac_define_dir.m4 | 47 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 Game/Code/m4/ac_define_dir.m4 (limited to 'Game/Code') diff --git a/Game/Code/m4/ac_define_dir.m4 b/Game/Code/m4/ac_define_dir.m4 new file mode 100755 index 00000000..f3d8734f --- /dev/null +++ b/Game/Code/m4/ac_define_dir.m4 @@ -0,0 +1,47 @@ +##### http://autoconf-archive.cryp.to/ac_define_dir.html +# +# SYNOPSIS +# +# AC_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION]) +# +# DESCRIPTION +# +# This macro sets VARNAME to the expansion of the DIR variable, +# taking care of fixing up ${prefix} and such. +# +# VARNAME is then offered as both an output variable and a C +# preprocessor symbol. +# +# Example: +# +# AC_DEFINE_DIR([DATADIR], [datadir], [Where data are placed to.]) +# +# LAST MODIFICATION +# +# 2006-10-13 +# +# COPYLEFT +# +# Copyright (c) 2006 Stepan Kasal +# Copyright (c) 2006 Andreas Schwab +# Copyright (c) 2006 Guido U. Draheim +# Copyright (c) 2006 Alexandre Oliva +# +# Copying and distribution of this file, with or without +# modification, are permitted in any medium without royalty provided +# the copyright notice and this notice are preserved. + +AC_DEFUN([AC_DEFINE_DIR], [ + prefix_NONE= + exec_prefix_NONE= + test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix +dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn +dnl refers to ${prefix}. Thus we have to use `eval' twice. + eval ac_define_dir="\"[$]$2\"" + eval ac_define_dir="\"$ac_define_dir\"" + AC_SUBST($1, "$ac_define_dir") + AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3]) + test "$prefix_NONE" && prefix=NONE + test "$exec_prefix_NONE" && exec_prefix=NONE +]) -- cgit v1.2.3 From f49d49ac6af3f39a00e19ce314636520e1ae1faf Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 7 Feb 2008 13:22:40 +0000 Subject: compatibility with the current svn-version git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@837 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/ffmpeg/avcodec.pas | 26 +++++++++++++++++--------- Game/Code/lib/ffmpeg/avformat.pas | 17 ++++++++++++----- Game/Code/lib/ffmpeg/avio.pas | 9 ++++++--- Game/Code/lib/ffmpeg/avutil.pas | 10 ++++++++-- Game/Code/lib/ffmpeg/mathematics.pas | 4 +++- Game/Code/lib/ffmpeg/opt.pas | 4 +++- Game/Code/lib/ffmpeg/rational.pas | 4 +++- Game/Code/lib/ffmpeg/swscale.pas | 4 ++++ 8 files changed, 56 insertions(+), 22 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/lib/ffmpeg/avcodec.pas b/Game/Code/lib/ffmpeg/avcodec.pas index dffe284e..cdb9b7d4 100644 --- a/Game/Code/lib/ffmpeg/avcodec.pas +++ b/Game/Code/lib/ffmpeg/avcodec.pas @@ -21,8 +21,10 @@ * For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT * in the source codes *) -// Min. version: 51.16.0 -// Max. version: 51.49.0, Revision: 11352 +(* + * Min. version: 51.16.0 + * Max. version: 51.50.0, Revision: 11878, Wed Feb 6 12:37:37 2008 UTC + *) unit avcodec; @@ -45,7 +47,7 @@ uses const (* Max. supported version by this header *) LIBAVCODEC_MAX_VERSION_MAJOR = 51; - LIBAVCODEC_MAX_VERSION_MINOR = 49; + LIBAVCODEC_MAX_VERSION_MINOR = 50; LIBAVCODEC_MAX_VERSION_RELEASE = 0; LIBAVCODEC_MAX_VERSION = (LIBAVCODEC_MAX_VERSION_MAJOR * VERSION_MAJOR) + (LIBAVCODEC_MAX_VERSION_MINOR * VERSION_MINOR) + @@ -295,6 +297,7 @@ type CODEC_ID_APE, CODEC_ID_NELLYMOSER, CODEC_ID_MUSEPACK8, + CODEC_ID_SPEEX, //* subtitle codecs */ CODEC_ID_DVD_SUBTITLE= $17000, @@ -302,18 +305,22 @@ type CODEC_ID_TEXT, ///< raw UTF-8 text CODEC_ID_XSUB, CODEC_ID_SSA, + CODEC_ID_MOV_TEXT, + (* other specific kind of codecs (generaly used for attachments) *) + CODEC_ID_TTF= $18000, + CODEC_ID_MPEG2TS= $20000, {*< _FAKE_ codec to indicate a raw MPEG-2 TS * stream (only used by libavformat) *} __CODEC_ID_4BYTE = $FFFFF // ensure 4-byte enum ); +{$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 {* CODEC_ID_MP3LAME is obsolete *} const - {$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 CODEC_ID_MP3LAME = CODEC_ID_MP3; CODEC_ID_MPEG4AAC = CODEC_ID_AAC; - {$IFEND} +{$IFEND} type TCodecType = ( @@ -322,6 +329,7 @@ type CODEC_TYPE_AUDIO, CODEC_TYPE_DATA, CODEC_TYPE_SUBTITLE, + CODEC_TYPE_ATTACHMENT, CODEC_TYPE_NB ); @@ -2277,7 +2285,7 @@ type encode: function (avctx: PAVCodecContext; buf: pchar; buf_size: integer; data: pointer): integer; cdecl; close: function (avctx: PAVCodecContext): integer; cdecl; decode: function (avctx: PAVCodecContext; outdata: pointer; outdata_size: PInteger; - buf: pchar; buf_size: integer): integer; cdecl; + {const} buf: pchar; buf_size: integer): integer; cdecl; capabilities: integer; next: PAVCodec; flush: procedure (avctx: PAVCodecContext); cdecl; @@ -2748,7 +2756,7 @@ function avcodec_open (avctx: PAVCodecContext; codec: PAVCodec): integer; *) function avcodec_decode_audio (avctx: PAVCodecContext; samples: Pword; var frame_size_ptr: integer; - buf: pchar; buf_size: integer): integer; + {const} buf: pchar; buf_size: integer): integer; cdecl; external av__codec; {$IF LIBAVCODEC_VERSION >= 51030000} // 51.30.0 @@ -2790,7 +2798,7 @@ function avcodec_decode_audio (avctx: PAVCodecContext; samples: Pword; *) function avcodec_decode_audio2(avctx : PAVCodecContext; samples : PSmallint; var frame_size_ptr : integer; - buf: pchar; buf_size: integer): integer; + {const} buf: pchar; buf_size: integer): integer; cdecl; external av__codec; {$IFEND} @@ -2827,7 +2835,7 @@ function avcodec_decode_audio2(avctx : PAVCodecContext; samples : PSmallint; *) function avcodec_decode_video (avctx: PAVCodecContext; picture: PAVFrame; var got_picture_ptr: integer; - buf: PByte; buf_size: integer): integer; + {const} buf: PByte; buf_size: integer): integer; cdecl; external av__codec; (* Decode a subtitle message. Return -1 if error, otherwise return the diff --git a/Game/Code/lib/ffmpeg/avformat.pas b/Game/Code/lib/ffmpeg/avformat.pas index 41d964bb..7a5678a5 100644 --- a/Game/Code/lib/ffmpeg/avformat.pas +++ b/Game/Code/lib/ffmpeg/avformat.pas @@ -22,8 +22,10 @@ * For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT * in the source codes *) -// Min. version: 50.5.0 -// Max. version: 52.5.0, Revision: 11574 +(* + * Min. version: 50.5.0 + * Max. version: 52.7.0, Revision: 11661, Tue Jan 29 09:25:49 2008 UTC + *) unit avformat; @@ -47,7 +49,7 @@ uses const (* Max. supported version by this header *) LIBAVFORMAT_MAX_VERSION_MAJOR = 52; - LIBAVFORMAT_MAX_VERSION_MINOR = 5; + LIBAVFORMAT_MAX_VERSION_MINOR = 7; LIBAVFORMAT_MAX_VERSION_RELEASE = 0; LIBAVFORMAT_MAX_VERSION = (LIBAVFORMAT_MAX_VERSION_MAJOR * VERSION_MAJOR) + (LIBAVFORMAT_MAX_VERSION_MINOR * VERSION_MINOR) + @@ -439,8 +441,13 @@ type index_entries_allocated_size: cardinal; nb_frames: int64; ///< number of frames in this stream if known or 0 + {$IF LIBAVFORMAT_VERSION >= 50006000} // 50.6.0 - pts_buffer: array [0..MAX_REORDER_DELAY] of int64 + pts_buffer: array [0..MAX_REORDER_DELAY] of int64; + {$IFEND} + + {$IF LIBAVFORMAT_VERSION >= 52006000} // 52.6.0 + filename: PChar; (**< source filename of the stream *) {$IFEND} end; @@ -885,7 +892,7 @@ function av_read_pause (s: PAVFormatContext): integer; * Free a AVFormatContext allocated by av_open_input_stream. * @param s context to free *) -procedure av_close_input_stream(AVFormatContext *s); +procedure av_close_input_stream(s: PAVFormatContext); cdecl; external av__format; {$IFEND} diff --git a/Game/Code/lib/ffmpeg/avio.pas b/Game/Code/lib/ffmpeg/avio.pas index d316d2b2..a4d7af12 100644 --- a/Game/Code/lib/ffmpeg/avio.pas +++ b/Game/Code/lib/ffmpeg/avio.pas @@ -23,7 +23,9 @@ For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT in the source codes *) -// Revision: 11295 +(* + * Revision: 11305, Sat Dec 22 16:18:07 2007 UTC + *) unit avio; @@ -198,6 +200,7 @@ function url_poll(poll_table: PURLPollEntry; n: integer; timeout: integer): inte * @param pause 1 for pause, 0 for resume *) function av_url_read_pause(h: PURLContext; pause: integer): integer; + cdecl; external av__format; {$IFEND} {$IF LIBAVFORMAT_VERSION >= 52001000} // 52.1.0 @@ -255,8 +258,8 @@ function av_alloc_put_byte( buffer_size: integer; write_flag: integer; opaque: Pointer; - read_packet: TReadWriteFunc, - write_packet: TReadWriteFunc, + read_packet: TReadWriteFunc; + write_packet: TReadWriteFunc; seek: TSeekFunc): PByteIOContext; cdecl; external av__format; {$IFEND} diff --git a/Game/Code/lib/ffmpeg/avutil.pas b/Game/Code/lib/ffmpeg/avutil.pas index d50a7871..906d9041 100644 --- a/Game/Code/lib/ffmpeg/avutil.pas +++ b/Game/Code/lib/ffmpeg/avutil.pas @@ -21,8 +21,14 @@ * For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT * in the source codes *) -// Min. version: ? -// Max. version: 49.6.0, Revision: 11207 +(* + * avutil.h: + * Min. version: ? + * Max. version: 49.6.0, Revision: 11654, Mon Jan 28 17:23:57 2008 UTC + * + * mem.h: + * Revision: 11641, Sun Jan 27 20:50:16 2008 UTC + *) unit avutil; diff --git a/Game/Code/lib/ffmpeg/mathematics.pas b/Game/Code/lib/ffmpeg/mathematics.pas index 4ecdce8f..ae390e9d 100644 --- a/Game/Code/lib/ffmpeg/mathematics.pas +++ b/Game/Code/lib/ffmpeg/mathematics.pas @@ -20,7 +20,9 @@ For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT in the source codes *) -// Revision: 10765 +(* + * Revision: 10765, Wed Oct 17 09:37:46 2007 UTC + *) unit mathematics; diff --git a/Game/Code/lib/ffmpeg/opt.pas b/Game/Code/lib/ffmpeg/opt.pas index 971ce601..6bde3e65 100644 --- a/Game/Code/lib/ffmpeg/opt.pas +++ b/Game/Code/lib/ffmpeg/opt.pas @@ -22,7 +22,9 @@ * For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT * in the source codes *) -// Revision: 11250 +(* + * Revision: 11250, Mon Dec 17 17:41:24 2007 UTC + *) unit opt; diff --git a/Game/Code/lib/ffmpeg/rational.pas b/Game/Code/lib/ffmpeg/rational.pas index 14edb799..0d6f76b6 100644 --- a/Game/Code/lib/ffmpeg/rational.pas +++ b/Game/Code/lib/ffmpeg/rational.pas @@ -22,7 +22,9 @@ * For Mac OS X, some modifications were made by The Creative CAT, denoted as CAT * in the source codes *) -// Revision: 10765 +(* + * Revision: 10765, Wed Oct 17 09:37:46 2007 UTC + *) unit rational; diff --git a/Game/Code/lib/ffmpeg/swscale.pas b/Game/Code/lib/ffmpeg/swscale.pas index 9bff330a..15b2c38f 100644 --- a/Game/Code/lib/ffmpeg/swscale.pas +++ b/Game/Code/lib/ffmpeg/swscale.pas @@ -23,6 +23,10 @@ * external api for the swscale stuff *) +(* + * Revision: 24800, Thu Oct 18 09:30:33 2007 UTC + *) + unit swscale; {$IFDEF FPC} -- cgit v1.2.3 From 51a8b92b1696c8ff27523de753a7c6a743a817de Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 7 Feb 2008 18:38:51 +0000 Subject: Audio output working again git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@838 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UAudioInput_Portaudio.pas | 6 ------ Game/Code/Classes/UAudioPlayback_Portaudio.pas | 2 +- Game/Code/Classes/UMusic.pas | 2 -- 3 files changed, 1 insertion(+), 9 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UAudioInput_Portaudio.pas b/Game/Code/Classes/UAudioInput_Portaudio.pas index c969a1b3..753c69f6 100644 --- a/Game/Code/Classes/UAudioInput_Portaudio.pas +++ b/Game/Code/Classes/UAudioInput_Portaudio.pas @@ -191,25 +191,20 @@ const begin result := false; - writeln('0'); - err := Pa_Initialize(); if(err <> paNoError) then begin Log.LogError('Portaudio.InitializeRecord: ' + Pa_GetErrorText(err)); Exit; end; - writeln('1'); apiIndex := GetPreferredApiIndex(); apiInfo := Pa_GetHostApiInfo(apiIndex); SC := 0; - writeln('2'); // init array-size to max. input-devices count SetLength(AudioInputProcessor.Device, apiInfo^.deviceCount); for i:= 0 to High(AudioInputProcessor.Device) do begin - writeln('25'); // convert API-specific device-index to global index deviceIndex := Pa_HostApiDeviceIndexToDeviceIndex(apiIndex, i); deviceInfo := Pa_GetDeviceInfo(deviceIndex); @@ -303,7 +298,6 @@ begin Inc(SC); end; - writeln('3'); // adjust size to actual input-device count SetLength(AudioInputProcessor.Device, SC); diff --git a/Game/Code/Classes/UAudioPlayback_Portaudio.pas b/Game/Code/Classes/UAudioPlayback_Portaudio.pas index 2743fa86..59571d3d 100644 --- a/Game/Code/Classes/UAudioPlayback_Portaudio.pas +++ b/Game/Code/Classes/UAudioPlayback_Portaudio.pas @@ -411,7 +411,7 @@ begin playback := TAudioPlayback_Portaudio(userdata); with playback do begin - //MixerStream.ReadData(stream, len); + MixerStream.ReadData(stream, len); end; end; diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index 27ab86e1..b06e226d 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -444,13 +444,11 @@ begin //Log.BenchmarkStart(4); Start := AudioPlayback.OpenSound(SoundPath + 'Common start.mp3'); - (* Back := AudioPlayback.OpenSound(SoundPath + 'Common back.mp3'); Swoosh := AudioPlayback.OpenSound(SoundPath + 'menu swoosh.mp3'); Change := AudioPlayback.OpenSound(SoundPath + 'select music change music 50.mp3'); Option := AudioPlayback.OpenSound(SoundPath + 'option change col.mp3'); Click := AudioPlayback.OpenSound(SoundPath + 'rimshot022b.mp3'); - *) //Drum := AudioPlayback.OpenSound(SoundPath + 'bassdrumhard076b.mp3'); //Hihat := AudioPlayback.OpenSound(SoundPath + 'hihatclosed068b.mp3'); -- cgit v1.2.3 From d4d3d8873fea024cd9e1f17b04416bebe627d1f0 Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 7 Feb 2008 19:52:50 +0000 Subject: SWScale will only be used if FFMpeg is available (this should be the standard case) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@839 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UConfig.pas | 19 +++++++++++++++---- Game/Code/UltraStar.dpr | 2 +- Game/Code/switches.inc | 14 ++++++++------ 3 files changed, 24 insertions(+), 11 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UConfig.pas b/Game/Code/Classes/UConfig.pas index 51e9348e..a7b0f328 100644 --- a/Game/Code/Classes/UConfig.pas +++ b/Game/Code/Classes/UConfig.pas @@ -67,8 +67,19 @@ uses Sysutils; const - // include config-file + // IMPORTANT: + // If IncludeConstants is defined, the const-sections + // of the config-file will be included too. + // This switch is necessary because it is not possible to + // include the const-sections in the switches.inc. + // switches.inc is always included before the first uses- + // section but at that place no const-section is allowed. + // So we have to include the config-file in switches.inc + // with IncludeConstants undefined and in UConfig.pas with + // IncludeConstants defined (see the note above). {$DEFINE IncludeConstants} + + // include config-file (defines + constants) {$IF Defined(MSWindows)} {$I ../config-win.inc} {$ELSEIF Defined(Linux)} @@ -139,14 +150,14 @@ const (LIBAVUTIL_VERSION_MINOR * VERSION_MINOR) + (LIBAVUTIL_VERSION_RELEASE * VERSION_RELEASE); - {$ENDIF} - {$IFDEF HaveSWScale} LIBSWSCALE_VERSION = (LIBSWSCALE_VERSION_MAJOR * VERSION_MAJOR) + (LIBSWSCALE_VERSION_MINOR * VERSION_MINOR) + (LIBSWSCALE_VERSION_RELEASE * VERSION_RELEASE); {$ENDIF} - + + {$ENDIF} + {$IFDEF HaveProjectM} PROJECTM_VERSION = (PROJECTM_VERSION_MAJOR * VERSION_MAJOR) + (PROJECTM_VERSION_MINOR * VERSION_MINOR) + diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index 5c26180e..d624e809 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -53,10 +53,10 @@ uses opt in 'lib\ffmpeg\opt.pas', avio in 'lib\ffmpeg\avio.pas', mathematics in 'lib\ffmpeg\mathematics.pas', - {$ENDIF} {$IFDEF UseSWScale} swscale in 'lib\ffmpeg\swscale.pas', {$ENDIF} + {$ENDIF} {$IFDEF UseProjectM_0_9} projectM in 'lib\projectM\0.9\projectM.pas', diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index a50c759b..66a8ad07 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -34,6 +34,7 @@ {$IF Defined(win32)} + // include defines but no constants {$I config-win.inc} // audio config @@ -53,9 +54,9 @@ // video config {$IFDEF HaveFFMpeg} {$DEFINE UseFFMpegVideo} - {$ENDIF} - {$IFDEF HaveSWScale} - {$DEFINE UseSWScale} + {$IFDEF HaveSWScale} + {$DEFINE UseSWScale} + {$ENDIF} {$ENDIF} // misc defines @@ -72,6 +73,7 @@ {$ENDIF} {$ENDIF} {$ELSEIF Defined(Linux)} + // include defines but no constants {$I config-linux.inc} // audio config @@ -86,9 +88,9 @@ // video config {$IFDEF HaveFFMpeg} {$DEFINE UseFFMpegVideo} - {$ENDIF} - {$IFDEF HaveSWScale} - {$DEFINE UseSWScale} + {$IFDEF HaveSWScale} + {$DEFINE UseSWScale} + {$ENDIF} {$ENDIF} // misc defines -- cgit v1.2.3 From f0b4ae82ddbd384c7dad594eb36d14e4946a5f62 Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 7 Feb 2008 19:59:24 +0000 Subject: made some adaptions to be more portable. you might have to call "autogen.sh" again because i added a new m4 script with one of the last commits. call "./configure --enable-dev-build" after this to install USDX into the local directory (the binary will simply be moved to ../.. at the moment). git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@840 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Makefile.in | 82 ++++++++++++++++++++++++++++++-------------------- Game/Code/configure.ac | 82 ++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 112 insertions(+), 52 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Makefile.in b/Game/Code/Makefile.in index 5df6c737..b4eff25d 100644 --- a/Game/Code/Makefile.in +++ b/Game/Code/Makefile.in @@ -1,7 +1,6 @@ ## # Makefile for @PACKAGE_NAME@ @PACKAGE_VERSION@ -# @AUTOCONF_INFO@ -# @PACKAGE_BUGREPORT@ +# @configure_input@ ## # general definitions @@ -23,19 +22,19 @@ LN_S = @LN_S@ USDX_PREFIX = UltraStar USDX_TOOLS_DIR = ../../Tools - - EXE_SUFFIX = @EXEEXT@ # Free Pascal compiler PPC = @PPC@ PFLAGS = @PFLAGS@ +PLIBS = @PLIBS@ # FPC target platform and processor PPLATFORM = @FPC_PLATFORM@ PPROCESSOR = @FPC_PROCESSOR@ # lazarus defines LAZARUS_DIR = @LAZARUS_DIR@ +LCL_WIDGET_TYPE = @LCL_WIDGET_TYPE@ PROJ_SUFFIX = .lpr # RC to LRS resource compiler @@ -44,14 +43,14 @@ RESCOMPILER_BIN = $(USDX_TOOLS_DIR)/$(RESCOMPILER_NAME)$(EXE_SUFFIX) RESCOMPILER_SRC = $(USDX_TOOLS_DIR)/$(RESCOMPILER_NAME)$(PROJ_SUFFIX) RESCOMPILER_PFLAGS = -dRELEASE -RES_SUFFIX = .lrs - # Directories added to the unit path PUNIT_TOKEN = -Fu -PUNIT_FLAGS = $(PUNIT_TOKEN)$(LAZARUS_DIR)/lcl/units/$(PPROCESSOR)-$(PPLATFORM) \ - $(PUNIT_TOKEN)$(LAZARUS_DIR)/components/images/lib/$(PPROCESSOR)-$(PPLATFORM) \ - $(PUNIT_TOKEN)$(LAZARUS_DIR)/components/jpeg \ - $(PUNIT_TOKEN). +PUNIT_FLAGS = \ + $(PUNIT_TOKEN)$(LAZARUS_DIR)/lcl/units/$(PPROCESSOR)-$(PPLATFORM) \ + $(PUNIT_TOKEN)$(LAZARUS_DIR)/lcl/units/$(PPROCESSOR)-$(PPLATFORM)/$(LCL_WIDGET_TYPE) \ + $(PUNIT_TOKEN)$(LAZARUS_DIR)/components/images/lib/$(PPROCESSOR)-$(PPLATFORM) \ + $(PUNIT_TOKEN)$(LAZARUS_DIR)/components/jpeg \ + $(PUNIT_TOKEN). # Directory where compiled units (.ppu and .o files) are stored PCUNIT_TOKEN = -FU @@ -60,10 +59,10 @@ PCUNIT_FLAGS = $(PCUNIT_TOKEN)$(PCUNIT_DIR) # Directories added to the includes path PINC_TOKEN = -Fi -PINC_FLAGS = $(PINC_TOKEN)lib/JEDI-SDLv1.0/SDL/Pas +PINC_FLAGS = $(PINC_TOKEN)lib/JEDI-SDL/SDL/Pas # Defines -PDEFINES = -dLCL +PDEFINES = -dLCL -dLCL$(LCL_WIDGET_TYPE) # Misc fpc options PCOMPAT_FLAGS = -S2dgi @@ -84,14 +83,12 @@ PFLAGS += $(PCOMPAT_FLAGS) \ USDX_SRC = $(USDX_PREFIX)$(PROJ_SUFFIX) # name of executable USDX_BIN = $(USDX_PREFIX)$(EXE_SUFFIX) -# name of resource -USDX_RES = $(USDX_PREFIX)$(RES_SUFFIX) -.PHONY: all resources ultrastardx-app install uninstall clean distclean clean_obj clean_res +.PHONY: all resources ultrastardx-app install install-dev install-release uninstall uninstall-dev uninstall-release clean distclean clean_obj clean_res all: resources ultrastardx-app -resources: $(USDX_RES) +resources: $(USDX_PREFIX).lrs ultrastardx-app: $(USDX_BIN) @@ -99,44 +96,65 @@ ultrastardx-app: $(USDX_BIN) # (it uses an .inc-files cache for example). # As a result FPC misses some changes if it is called without cleaning # up first (very annoying while debugging). -$(USDX_BIN): - $(MAKE) clean_obj +$(USDX_BIN): clean_obj +# $(MAKE) clean_obj mkdir -p $(PCUNIT_DIR) - $(PPC) $(PFLAGS) $(PINC_FLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS) -o$(USDX_BIN) $(USDX_SRC) + $(PPC) $(PFLAGS) $(PLIBS) $(PINC_FLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS) -o$@ $(USDX_SRC) + +install: install-@install_type@ +# all + +uninstall: uninstall-@install_type@ + + +# local development build -install: all +install-dev: + mv $(USDX_BIN) ../.. + +uninstall-dev: + rm -f ../../$(USDX_BIN) + +# global release build + +install-release: # TODO: copy files to the appropriate places # $()/mkinstalldirs $(bindir) # $()/mkinstalldirs $(libdir) # $()/mkinstalldirs $(infodir) - mv $(USDX_BIN) ../.. # $(INSTALL) $(USDX_BIN) $(bindir)/$(USDX_BIN) + @echo '"install-release" does not exist yet. Install USDX yourself or use "./configure --enable-dev-build" for a local installation.' -uninstall: +uninstall-release: # TODO: remove installed files -# rm -f ... - echo "Comming soon!" +# rm -f xyz + @echo '"install-release" does not exist yet.' + -clean: clean_obj clean_res +clean: clean_obj -distclean: clean - find . -name "*.o" -o -name "*.ppu" -o -name "*.rst" | xargs rm -f - find . -name "*.bak" -o -name "*.orig" -o -name "*.dcu" | xargs rm -f +distclean: clean clean_res + find . -name "*.o" -o -name "*.ppu" -o -name "*.rst" -o -name "*.compiled" | xargs rm -f + find . -name "*~" -name "*.bak" -o -name "*.orig" -o -name "*.dcu" | xargs rm -f find . -name "__history" | xargs rm -r -f - rm -f $(OUTPUT).cfg $(OUTPUT).res $(OUTPUT).identcache + rm -f $(USDX_PREFIX).res $(USDX_PREFIX).identcache rm -f config.inc config.log config.status configure + rm -f Makefile + rm -f aclocal.m4 + rm -rf autom4te.cache clean_obj: find "$(PCUNIT_DIR)" -name "*.o" -o -name "*.ppu" -o -name "*.rst" -o -name "*.compiled" | xargs rm -f - rm -f $(OUTPUT) + rm -f $(USDX_BIN) clean_res: - rm -f $(USDX_RES) link.res + rm -f $(USDX_PREFIX).lrs -$(USDX_RES): $(RESCOMPILER_BIN) $(USDX_PREFIX).rc +$(USDX_PREFIX).lrs: $(RESCOMPILER_BIN) $(USDX_PREFIX).rc $(RESCOMPILER_BIN) $(USDX_PREFIX).rc $(RESCOMPILER_BIN): $(RESCOMPILER_SRC) + mkdir -p $(PCUNIT_DIR) $(PPC) $(RESCOMPILER_PFLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS) -o$@ $(RESCOMPILER_SRC) configure: configure.ac config.inc.in aclocal.m4 diff --git a/Game/Code/configure.ac b/Game/Code/configure.ac index 40e8a6d2..f0af3447 100644 --- a/Game/Code/configure.ac +++ b/Game/Code/configure.ac @@ -29,6 +29,18 @@ AC_CONFIG_MACRO_DIR(m4) # show features and packages in one list AC_PRESERVE_HELP_ORDER +#echo $LIBS + +#define([maco], []) +#echo maco +#m4_foreach_w([arg], [-L/usr/local -l/bin/bash -L/usr/local], +# [m4_append_uniq([maco], "arg", [ ]) +#]) +#echo maco + +#echo m4_split([hallo o]) +#AC_MSG_ERROR(oi) + # ----------------------------------------- # define switches # ----------------------------------------- @@ -46,6 +58,15 @@ if [[ x$with_lazarus = xno ]] ; then AC_MSG_ERROR([Lazarus is required. It is impossible to build without it.]); fi +# add lazarus widget-type option +AC_ARG_WITH([lcl_widget_type], + [AS_HELP_STRING([--with-lcl-widget-type=TYPE], + [Lazarus LCL Widget Type @<:@default=gtk2@:>@])], + [with_lcl_widget_type=$withval], [with_lcl_widget_type="gtk2"]) +if [[ x$with_lcl_widget_type = xno -o x$with_lcl_widget_type = xyes ]] ; then + AC_MSG_ERROR([Invalid LCL Widget Type (try one of gtk2/gtk/qt)]); +fi + # add portaudio option AC_ARG_WITH([portaudio], [AS_HELP_STRING([--with-portaudio=DIR], @@ -88,12 +109,26 @@ AC_ARG_WITH([cfg-dummy3], [ Development options:]) # add dev_layout option -# Note: now handled by the Makefile -AC_ARG_ENABLE(dev_install, - [AS_HELP_STRING([--enable-dev-install], - [local installation for testing])], - [enable_dev_install="yes"], [enable_dev_install="no"]) +AC_ARG_ENABLE(dev_build, + [AS_HELP_STRING([--enable-dev-build], + [local development build])], + [enable_dev_build="yes"], [enable_dev_build="no"]) + +# ----------------------------------------- +# tools +# ----------------------------------------- +# options for make command +AC_PROG_MAKE_SET +# find tool for ln -s +AC_LN_S +# find the best install tool +AC_PROG_INSTALL +# some other useful tools +#AC_PROG_AWK +AC_PROG_SED +AC_PROG_GREP +#AC_PROG_EGREP # ----------------------------------------- # macro declarations @@ -117,7 +152,7 @@ AC_DEFUN([AC_SPLIT_VERSION], # Note: We use a here-document (<<< here-strings not POSIX compatible) # Do NOT indent the eof-delimiter read major minor release ignore <@) +# check if LCL Widget type is valid +LCL_WIDGET_TYPE=$with_lcl_widget_type +LCL_UNIT_DIR="$LAZARUS_DIR/lcl/units/$FPC_PROCESSOR-$FPC_PLATFORM" +LCL_WIDGET_DIR="$LCL_UNIT_DIR/$LCL_WIDGET_TYPE" +AC_MSG_CHECKING([whether LCL Widget Type "$LCL_WIDGET_TYPE" is valid]) +if [[ -d "$LCL_WIDGET_DIR" ]]; then + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) + AC_MSG_ERROR(LCL Widget Type not available: directory "$LCL_WIDGET_DIR" not found.) +fi + # find sdl AC_PKG_CHECK_VERSION(SDL, [sdl], yes) @@ -328,12 +363,19 @@ AC_SUBST(PORTMIXER_LIB) AC_SUBST_DEFINE(HAVE_PORTMIXER, $PORTMIXER_HAVE) AC_SUBST(LAZARUS_DIR) +AC_SUBST(LCL_WIDGET_TYPE) -AC_SUBST_DEFINE(USE_LOCAL_DIRS, $enable_dev_install) +AC_SUBST_DEFINE(USE_LOCAL_DIRS, $enable_dev_build) +if [[ x$enable_dev_build = xyes ]]; then + AC_SUBST(install_type, ["dev"]) +else + AC_SUBST(install_type, ["release"]) +fi AC_SUBST(suffix) AC_SUBST(logrootdir, [$with_logrootdir]) AC_DEFINE_DIR(sharerootdir, datarootdir) +AC_SUBST(PLIBS) AC_SUBST(PACKAGE_WEBSITE) # ----------------------------------------- -- cgit v1.2.3 From 4b221bce47a8d993de19dab49884c1c2f17014d4 Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 7 Feb 2008 21:50:25 +0000 Subject: - removed the gtk2 detection (it is just necessary if we want to use lazjpeg instead of Ulazjpeg) - undefined ProjectM in switches.inc because it caused some trouble (black screen or crashes). So you have to enable this if you want to use ProjectM. I will try to find the cause for the problem. It occurs with flms` installation only so we will have to debug his version remotely. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@841 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Makefile.in | 5 +++-- Game/Code/configure.ac | 2 +- Game/Code/switches.inc | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Makefile.in b/Game/Code/Makefile.in index b4eff25d..6ab1902e 100644 --- a/Game/Code/Makefile.in +++ b/Game/Code/Makefile.in @@ -47,10 +47,10 @@ RESCOMPILER_PFLAGS = -dRELEASE PUNIT_TOKEN = -Fu PUNIT_FLAGS = \ $(PUNIT_TOKEN)$(LAZARUS_DIR)/lcl/units/$(PPROCESSOR)-$(PPLATFORM) \ - $(PUNIT_TOKEN)$(LAZARUS_DIR)/lcl/units/$(PPROCESSOR)-$(PPLATFORM)/$(LCL_WIDGET_TYPE) \ $(PUNIT_TOKEN)$(LAZARUS_DIR)/components/images/lib/$(PPROCESSOR)-$(PPLATFORM) \ $(PUNIT_TOKEN)$(LAZARUS_DIR)/components/jpeg \ $(PUNIT_TOKEN). +# $(PUNIT_TOKEN)$(LAZARUS_DIR)/lcl/units/$(PPROCESSOR)-$(PPLATFORM)/$(LCL_WIDGET_TYPE) # Directory where compiled units (.ppu and .o files) are stored PCUNIT_TOKEN = -FU @@ -62,7 +62,8 @@ PINC_TOKEN = -Fi PINC_FLAGS = $(PINC_TOKEN)lib/JEDI-SDL/SDL/Pas # Defines -PDEFINES = -dLCL -dLCL$(LCL_WIDGET_TYPE) +PDEFINES = -dLCL +#-dLCL$(LCL_WIDGET_TYPE) # Misc fpc options PCOMPAT_FLAGS = -S2dgi diff --git a/Game/Code/configure.ac b/Game/Code/configure.ac index f0af3447..9ca6e46a 100644 --- a/Game/Code/configure.ac +++ b/Game/Code/configure.ac @@ -296,7 +296,7 @@ if [[ -d "$LCL_WIDGET_DIR" ]]; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) - AC_MSG_ERROR(LCL Widget Type not available: directory "$LCL_WIDGET_DIR" not found.) +# AC_MSG_ERROR(LCL Widget Type not available: directory "$LCL_WIDGET_DIR" not found.) fi # find sdl diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index 66a8ad07..d0cc9525 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -95,7 +95,8 @@ // misc defines {$IFDEF HaveProjectM} - {$DEFINE UseProjectM_0_9} + // this causes trouble at the moment + //{$DEFINE UseProjectM_0_9} {$ENDIF} {$IFEND} -- cgit v1.2.3 From b2e0b65ac9d338fd76a564239feaec2cb4b85b36 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Fri, 8 Feb 2008 00:39:02 +0000 Subject: added yum install line Thanks Kdub git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@842 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/requirements.txt | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/lib/requirements.txt b/Game/Code/lib/requirements.txt index d1775390..81759cfc 100644 --- a/Game/Code/lib/requirements.txt +++ b/Game/Code/lib/requirements.txt @@ -1,14 +1,8 @@ -Not Included in SVN ( to many potential updates ) +Included in SVN .. --------------------------------------------------------------------------- - + Jedi-sdl http://sourceforge.net/projects/jedi-sdl - Make sure to download VERSION 1, beta... - not version 0.5 - - -Included in SVN .. ---------------------------------------------------------------------------- pngImage http://pngdelphi.sourceforge.net/ @@ -32,20 +26,11 @@ On top of the above pas files, you will need development libraries for them. here are the instructions needed to compile on ubunty ( 7.04 ) -ffmpeg : - sudo apt-get install libavcodec-dev libavformat-dev + sudo apt-get install libavcodec-dev libavformat-dev libsqlite3-dev libsdl-ttf2.0-dev libsdl-image1.2-dev portaudio19-dev -portaudio : - sudo apt-get install portaudio19-dev - -sqlite : - sudo apt-get install libsqlite3-dev - -sdl development libraries : - sudo apt-get install libsdl-ttf2.0-dev libsdl-image1.2-dev - THERE WILL be more of them... oops I forgot to list them :P - -For the Lazy... who use Debian or Ubuntu.... here is a single line - sudo apt-get install libavcodec-dev libavformat-dev libsqlite3-dev libsdl-ttf2.0-dev libsdl-image1.2-dev portaudio19-dev + +for Fedora 8 ( contributed by kdub ) + + yum install ffmpeg-devel portaudio-devel SDL_ttf-devel SDL_image-devel sqlite-devel -- cgit v1.2.3 From 9e696510eb04ce60cbfb8fa88629c66a9384c0f2 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 12 Feb 2008 10:30:58 +0000 Subject: UVisualizer uses the system dependant default game-path now git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@843 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMain.pas | 4 +++- Game/Code/Classes/UVisualizer.pas | 35 +++++++++++++++++++++++++++-------- 2 files changed, 30 insertions(+), 9 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 7b32857b..bbd4a5ee 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -92,6 +92,7 @@ var CoversPath: string; LanguagesPath: string; PluginPath: string; + VisualsPath: string; PlayListPath: string; UserSongPath: string = ''; @@ -1034,9 +1035,10 @@ begin initialize_path( LogPath , Platform.GetLogPath ); initialize_path( SoundPath , Platform.GetGameSharedPath + 'Sounds' + PathDelim ); initialize_path( ThemePath , Platform.GetGameSharedPath + 'Themes' + PathDelim ); - initialize_path( SkinsPath , Platform.GetGameSharedPath + 'Skins' + PathDelim ); + initialize_path( SkinsPath , Platform.GetGameSharedPath + 'Skins' + PathDelim ); initialize_path( LanguagesPath , Platform.GetGameSharedPath + 'Languages' + PathDelim ); initialize_path( PluginPath , Platform.GetGameSharedPath + 'Plugins' + PathDelim ); + initialize_path( VisualsPath , Platform.GetGameSharedPath + 'Visuals' + PathDelim ); initialize_path( ScreenshotsPath , Platform.GetGameUserPath + 'Screenshots' + PathDelim ); diff --git a/Game/Code/Classes/UVisualizer.pas b/Game/Code/Classes/UVisualizer.pas index 22c168a2..2f584299 100644 --- a/Game/Code/Classes/UVisualizer.pas +++ b/Game/Code/Classes/UVisualizer.pas @@ -36,6 +36,7 @@ implementation uses UGraphic, + UMain, ULog; var @@ -46,10 +47,15 @@ const gy = 24; fps = 30; texsize = 512; - visualsDir = 'Visuals'; // TODO: move this to a place common for all visualizers - projectMDir = visualsDir+'/projectM'; - presetsDir = projectMDir+'/presets'; - fontsDir = projectMDir+'/fonts'; + +var + ProjectMPath : string; + presetsDir : string; + fontsDir : string; + + // FIXME: dirty fix needed because the init method is not + // called yet. + inited: boolean; type TVideoPlayback_ProjectM = class( TInterfacedObject, IVideoPlayback, IVideoVisualization ) @@ -78,8 +84,8 @@ type procedure RestoreOpenGLState(); public - constructor create(); - procedure init(); + constructor Create(); + procedure Init(); function GetName: String; function Open( aFileName : string): boolean; // true if succeed @@ -97,14 +103,22 @@ type end; -constructor TVideoPlayback_ProjectM.create(); +constructor TVideoPlayback_ProjectM.Create(); begin RndPCMcount := 0; end; -procedure TVideoPlayback_ProjectM.init(); +procedure TVideoPlayback_ProjectM.Init(); begin + // FIXME: dirty fix needed because the init method is not + // called yet. + inited := true; + + ProjectMPath := VisualsPath + 'projectM' + PathDelim; + presetsDir := ProjectMPath + 'presets'; + fontsDir := ProjectMPath + 'fonts'; + VisualizerStarted := False; VisualizerPaused := False; @@ -212,6 +226,11 @@ procedure TVideoPlayback_ProjectM.VisualizerStart; var initResult: Cardinal; begin + // FIXME: dirty fix needed because the init method is not + // called yet. + if (not inited) then + Init(); + VisualizerStarted := True; pm := TProjectM.Create(gx, gy, fps, texsize, ScreenW, ScreenH, -- cgit v1.2.3 From 64cc353a1bdcc0ef181dc8bd667ea30cd0cd191d Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 12 Feb 2008 10:35:06 +0000 Subject: Updated the autoconf/Makefile stuff - Use "./configue --enable-dev-build" to install locally - You can skip pkg-config errors with "--enable-skip-pkgconfig-errors" now git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@844 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Makefile.in | 62 ++++++++++++++-------- Game/Code/configure.ac | 137 ++++++++++++++++++++++++++++++++++++++++--------- Game/Code/m4/fpc.m4 | 28 ++++++---- 3 files changed, 170 insertions(+), 57 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Makefile.in b/Game/Code/Makefile.in index 6ab1902e..defada7a 100644 --- a/Game/Code/Makefile.in +++ b/Game/Code/Makefile.in @@ -14,19 +14,20 @@ top_srcdir = @top_srcdir@ datarootdir = @datarootdir@ VPATH = @srcdir@ +usdxrootdir = ../.. + # install tool INSTALL = @INSTALL@ # calls "ln -s" LN_S = @LN_S@ USDX_PREFIX = UltraStar -USDX_TOOLS_DIR = ../../Tools +USDX_TOOLS_DIR = $(usdxrootdir)/Tools EXE_SUFFIX = @EXEEXT@ # Free Pascal compiler PPC = @PPC@ -PFLAGS = @PFLAGS@ PLIBS = @PLIBS@ # FPC target platform and processor PPLATFORM = @FPC_PLATFORM@ @@ -63,29 +64,33 @@ PINC_FLAGS = $(PINC_TOKEN)lib/JEDI-SDL/SDL/Pas # Defines PDEFINES = -dLCL +# this is necessary to use lazjpeg instead of Ulazjpeg +# but requires configure to detect if gtk/gkt2 or qt is used #-dLCL$(LCL_WIDGET_TYPE) -# Misc fpc options -PCOMPAT_FLAGS = -S2dgi -#PCOMPAT_FLAGS += -Mdelphi -PVERBOSE_FLAGS = -vew -l -#PDEBUG_FLAGS = -g -gl -#PDEBUG_FLAGS = -dDEBUG -#POTHER_FLAGS = -Crtoi -#POPTIMIZE_FLAGS_FPC204 = -OG2p3 -#POPTIMIZE_FLAGS_FPC220 = -O2p"NAME" -#POPTIMIZE_FLAGS = -dRELEASE -#POPTIMIZE_FLAGS = -Xs -PFLAGS += $(PCOMPAT_FLAGS) \ - $(PVERBOSE_FLAGS) \ - $(PDEFINES) +# FPC flags + +# The user can overwrite the default flags with +# make PFLAGS="myflags" +PFLAGS = -S2dgi +# the user's flags (specified with configure) must be the last in +# the list to overwrite the defaults (e.g.with the - option: -Xs-). +PFLAGS += @PFLAGS@ + +PFLAGS_DEBUG = @PFLAGS_DEBUG@ +PFLAGS_RELEASE = @PFLAGS_RELEASE@ + +# The user can specify additional flags with +# make PFLAGS_EXTRA="myflags" +PFLAGS_EXTRA = +PFLAGS += $(PFLAGS_EXTRA) # lpr project file used as input USDX_SRC = $(USDX_PREFIX)$(PROJ_SUFFIX) # name of executable -USDX_BIN = $(USDX_PREFIX)$(EXE_SUFFIX) +USDX_BIN = $(usdxrootdir)/$(USDX_PREFIX)$(EXE_SUFFIX) -.PHONY: all resources ultrastardx-app install install-dev install-release uninstall uninstall-dev uninstall-release clean distclean clean_obj clean_res +.PHONY: all resources ultrastardx-app install install-dev install-release uninstall uninstall-dev uninstall-release clean distclean clean_obj clean_res fetch-sounds all: resources ultrastardx-app @@ -100,7 +105,7 @@ ultrastardx-app: $(USDX_BIN) $(USDX_BIN): clean_obj # $(MAKE) clean_obj mkdir -p $(PCUNIT_DIR) - $(PPC) $(PFLAGS) $(PLIBS) $(PINC_FLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS) -o$@ $(USDX_SRC) + $(PPC) $(PFLAGS) $(PDEFINES) $(PLIBS) $(PINC_FLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS) -o$@ $(USDX_SRC) install: install-@install_type@ # all @@ -111,10 +116,25 @@ uninstall: uninstall-@install_type@ # local development build install-dev: - mv $(USDX_BIN) ../.. + @if [ ! -d "$(usdxrootdir)/Visuals" ]; then \ + echo "Copying visualizer data to $(usdxrootdir)/Visuals ..."; \ + cp -r "$(usdxrootdir)/InstallerDependencies/Visuals" "$(usdxrootdir)"; \ + fi + @if [ ! -f "$(usdxrootdir)/Sounds/Common start.mp3" ]; then \ + echo ""; \ + echo "# The sound-files from Sound-directory of the 1.0.1-branch are required."; \ + echo "# Copy them yourself to \"$(usdxrootdir)/Sounds\""; \ + echo "# or if you are connected to the web try:"; \ + echo "# make fetch-sounds"; \ + fi + +fetch-sounds: + svn co https://ultrastardx.svn.sourceforge.net/svnroot/ultrastardx/branches/1.0.1/Sounds tmp-sounds + mv tmp-sounds/*.mp3 $(usdxrootdir)/Sounds + rm -rf tmp-sounds uninstall-dev: - rm -f ../../$(USDX_BIN) + rm -f $(USDX_BIN) # global release build diff --git a/Game/Code/configure.ac b/Game/Code/configure.ac index 9ca6e46a..781e2bd9 100644 --- a/Game/Code/configure.ac +++ b/Game/Code/configure.ac @@ -1,10 +1,9 @@ # -# UltraStar-DX configure.in script +# UltraStar-DX configure.ac script # # by UltraStar Deluxe Team # -# Call "aclocal -I m4" to create the aclocal.m4 file. -# Process this file with autoconf to produce a configure script. +# Execute "autogen.sh" to create the configure script. # # Require autoconf >= 2.61 @@ -29,7 +28,7 @@ AC_CONFIG_MACRO_DIR(m4) # show features and packages in one list AC_PRESERVE_HELP_ORDER -#echo $LIBS +#echo $LDFLAGS #define([maco], []) #echo maco @@ -59,10 +58,11 @@ if [[ x$with_lazarus = xno ]] ; then fi # add lazarus widget-type option -AC_ARG_WITH([lcl_widget_type], +# the result is not used at the moment +AC_ARG_WITH([lcl-widget-type], [AS_HELP_STRING([--with-lcl-widget-type=TYPE], - [Lazarus LCL Widget Type @<:@default=gtk2@:>@])], - [with_lcl_widget_type=$withval], [with_lcl_widget_type="gtk2"]) + [Lazarus LCL Widget Type @<:@default=check@:>@])], + [with_lcl_widget_type=$withval], [with_lcl_widget_type=""]) if [[ x$with_lcl_widget_type = xno -o x$with_lcl_widget_type = xyes ]] ; then AC_MSG_ERROR([Invalid LCL Widget Type (try one of gtk2/gtk/qt)]); fi @@ -85,6 +85,12 @@ AC_ARG_WITH([projectM], [Enable projectM visualization support @<:@default=check@:>@])], [with_projectM=$withval], [with_projectM="check"]) +# add skip pkg-config error option +AC_ARG_ENABLE([skip-pkgconfig-errors], + [AS_HELP_STRING([--enable-skip-pkgconfig-errors], + [Continue if pkg-config does not find a package @<:@default=no@:>@])], + [skip_pkgconfig_errors=$withval], [skip_pkgconfig_errors="no"]) + # print path options header AC_ARG_WITH([cfg-dummy2], [ Additional directories:]) @@ -109,7 +115,7 @@ AC_ARG_WITH([cfg-dummy3], [ Development options:]) # add dev_layout option -AC_ARG_ENABLE(dev_build, +AC_ARG_ENABLE(dev-build, [AS_HELP_STRING([--enable-dev-build], [local development build])], [enable_dev_build="yes"], [enable_dev_build="no"]) @@ -144,27 +150,40 @@ AC_PROG_GREP # AC_SUBST([$VARIABLE_PREFIX]_VERSION_type] for each type AC_DEFUN([AC_SPLIT_VERSION], [ + version=[$2] + + # strip leading non-numeric tokens + # (necessary for some ffmpeg-packages in ubuntu) + # example: 0d.51.1.0 -> 51.1.0 + version=`echo $version | $SED 's/^[[^.]]*[[^0-9.]][[^.]]*\.//'` + # replace "." and "-" with " " and ignore trailing tokens. # 1.23.4-r2 will be splitted to [maj=1, min=23, rel=4]. # In addition we delete every character which is not 0-9. # 1.3a4-r32 will be [maj=1, min=34, rel=32]. - # - # Note: We use a here-document (<<< here-strings not POSIX compatible) - # Do NOT indent the eof-delimiter read major minor release ignore <@) @@ -220,8 +239,33 @@ AC_DEFUN([AC_PKG_CHECK_VERSION], [$1][_HAVE]="no" AC_SPLIT_VERSION([$1], [0.0.0]) AC_MSG_RESULT(no) - if test x$3 = xyes -o x$4 = xyes; then - AC_MSG_ERROR([Could not find required library $2. Please install $2 and try again.]); + if test x$3 = xyes -o x$4 = xyes; then + AC_MSG_WARN([ +!!! Could not find the required library $2. +]); + # do not abort if skip-pkgconfig-errors is set + if test x$skip_pkgconfig_errors = xno; then + AC_MSG_ERROR([ +!!! Please install $2 and try again. +!!! +!!! If it is already installed check if "[$2].pc" is present in one +!!! of the pkg-config search directories (e.g. /usr/lib/pkgconfig). +!!! +!!! If the file is present but not in the standard search path you may add +!!! its directory by prepending "PKG_CONFIG_PATH=mylibs_dir/pkgconfig/" to +!!! your configure call. +!!! See the man-page on pkg-config for further information. +!!! +!!! Some linux distributions do not provide a .pc-file by the default +!!! package so you might have to install a special dev-package. +!!! +!!! If all of this does not help you may consider to skip this error and +!!! adjust the configuration file yourself. +!!! To do this call "./configure --enable-skip-pkgconfig-errors ...". +]) + else + pkgconfig_error_skipped="yes" + fi fi fi ]) @@ -255,7 +299,7 @@ if [[ x$PKG_CONFIG = x ]]; then fi # ----------------------------------------- -# check for libraries +# check for lazarus # ----------------------------------------- # set dirs to check for lazarus @@ -288,17 +332,42 @@ AC_SPLIT_VERSION([LAZARUS], [$LAZARUS_VERSION]) AC_MSG_RESULT(@<:@$LAZARUS_VERSION@:>@) # check if LCL Widget type is valid -LCL_WIDGET_TYPE=$with_lcl_widget_type -LCL_UNIT_DIR="$LAZARUS_DIR/lcl/units/$FPC_PROCESSOR-$FPC_PLATFORM" -LCL_WIDGET_DIR="$LCL_UNIT_DIR/$LCL_WIDGET_TYPE" -AC_MSG_CHECKING([whether LCL Widget Type "$LCL_WIDGET_TYPE" is valid]) -if [[ -d "$LCL_WIDGET_DIR" ]]; then - AC_MSG_RESULT(yes) +if [[ x$with_lcl_widget_type = x ]]; then + # search for standard types + LCL_CHECK_WIDGET_TYPES="gtk2 gtk qt win32 carbon" else - AC_MSG_RESULT(no) -# AC_MSG_ERROR(LCL Widget Type not available: directory "$LCL_WIDGET_DIR" not found.) + # search for user defined type only + LCL_CHECK_WIDGET_TYPES="$with_lcl_widget_type" fi +# LCL widget specific base dir +LCL_UNIT_DIR="$LAZARUS_DIR/lcl/units/$FPC_PROCESSOR-$FPC_PLATFORM" + +# check for a supported widget type +LCL_WIDGET_TYPE="" +for widget_type in $LCL_CHECK_WIDGET_TYPES; do + widget_dir="$LCL_UNIT_DIR/$widget_type" + AC_MSG_CHECKING([whether LCL Widget Type "$widget_type" is supported]) + if [[ -d "$widget_dir" ]]; then + LCL_WIDGET_TYPE=$widget_type + AC_MSG_RESULT(yes) + break + else + AC_MSG_RESULT(no) + fi +done + +# check if a widget type was found +if [[ x$LCL_WIDGET_TYPE = x ]]; then + AC_MSG_ERROR([ +!!! Could not detect the LCL Widget Type. +!!! Specify the widget type with the --with-lcl-widget-type option.]) +fi + +# ----------------------------------------- +# check for libraries +# ----------------------------------------- + # find sdl AC_PKG_CHECK_VERSION(SDL, [sdl], yes) @@ -306,6 +375,13 @@ AC_PKG_CHECK_VERSION(SDL, [sdl], yes) AC_PKG_CHECK_VERSION(SQLITE3, [sqlite3], yes) # find ffmpeg +# Note: do not use the min/max version parameters with ffmpeg +# otherwise it might fail in ubuntu due to a wrong version number +# format in ffmpeg's .pc-files. +# For example: 0d.51.1.2 instead of the correct 51.1.2. +# A check for a version >=52.0.0 will return version 0d.51.1.2 +# although it is lower because pkg-config is confused by the 0d. +# Use [mylib]_VERSION_INT instead AC_PKG_CHECK_VERSION(AVCODEC, [libavcodec], yes) AC_CHECK_LIB(avcodec, avcodec_decode_audio) AC_CHECK_LIB(avcodec, avcodec_decode_audio2) @@ -424,3 +500,14 @@ AC_MSG_NOTICE([ #!!! $PACKAGE_BUGREPORT #!!! You might as well ask for help at the IRC-Channel #!!! $PACKAGE_IRC + +if [[ x$pkgconfig_error_skipped = xyes ]]; then + AC_MSG_WARN([ +??? pkg-config did not find all of the required libraries. +??? Edit "config-linux.inc" to add the missing parts. +??? If one of your libraries' directories is not in the linker's +??? search-path add it to the LDFLAGS environment variable and +??? rerun configure (e.g. ./configure LDFLAGS="-Lmylibdir" ...). +]) +fi + diff --git a/Game/Code/m4/fpc.m4 b/Game/Code/m4/fpc.m4 index 44822b28..51ebfc63 100644 --- a/Game/Code/m4/fpc.m4 +++ b/Game/Code/m4/fpc.m4 @@ -39,30 +39,34 @@ AC_ARG_ENABLE(release, [Enable FPC release options (same as --enable-debug=no)])], [FPC_DEBUG="no"], []) -dnl use -dDEBUG (instead of -g) so it uses the fpc.cfg defaults +dnl do not use -dDEBUG because this will enable range-checks +dnl that will fail with USDX. +dnl we have to disable -Xs which is defined in fpc.cfg. AC_ARG_WITH(debug-flags, [AS_HELP_STRING([--with-debug-flags], - [FPC debug flags @<:@-dDEBUG@:>@])], - [fpc_debugflags="$withval"], - [fpc_debugflags="-dDEBUG"]) + [FPC debug flags @<:@-gl -Coi -Xs- -vew@:>@])], + [PFLAGS_DEBUG="$withval"], + [PFLAGS_DEBUG="-gl -Cit -Xs- -vew"]) -dnl use -dDEBUG (instead of e.g. -O2) so it uses the fpc.cfg defaults +dnl -dRELEASE works too but we define our own settings AC_ARG_WITH(release-flags, [AS_HELP_STRING([--with-release-flags], - [FPC release flags @<:@-dRELEASE@:>@])], - [fpc_releaseflags="$withval"], - [fpc_releaseflags="-dRELEASE"]) + [FPC release flags @<:@-O2 -Xs -vew@:>@])], + [PFLAGS_RELEASE="$withval"], + [PFLAGS_RELEASE="-O2 -Xs -vew"]) +dnl the user's PFLAGS must *follow* this script's flags +dnl to enable the user to overwrite the settings. if test x$FPC_DEBUG = xyes; then - PFLAGS="$PFLAGS $fpc_debugflags" + PFLAGS="$PFLAGS_DEBUG $PFLAGS" else - PFLAGS="$PFLAGS $fpc_releaseflags" + PFLAGS="$PFLAGS_RELEASE $PFLAGS" fi AC_ARG_ENABLE(profile, [AS_HELP_STRING([--enable-profile], [Enable FPC profiling options])], - [PFLAGS="$PFLAGS -pg"], []) + [PFLAGS="-pg $PFLAGS"], []) PPC_CHECK_PROGS="fpc FPC ppc386 ppc PPC386 ppos2" @@ -91,6 +95,8 @@ fi FPC_BASE_PATH="${FPC_PREFIX}/lib/fpc/${FPC_VERSION}" FPC_UNIT_PATH="${FPC_BASE_PATH}/units/${FPC_PLATFORM}" AC_SUBST(PFLAGS) +AC_SUBST(PFLAGS_DEBUG) +AC_SUBST(PFLAGS_RELEASE) AC_SUBST(FPC_VERSION) AC_SUBST(FPC_PLATFORM) AC_SUBST(FPC_PROCESSOR) -- cgit v1.2.3 From 00b2331d0b1a08651374c56cce898f501a2d5104 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 12 Feb 2008 12:18:57 +0000 Subject: changed InitializeSound to be responsive to failed module initializations, and to remove the module and try again. EG... in my case, sound card driver problems. ALSA is installed but wouldnt open the audio device. now it fails, and the output module goes to the next available ( if there is any ) then gracefully fails to dummy. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@845 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMusic.pas | 53 ++++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 14 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index b06e226d..8bbd297a 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -341,18 +341,14 @@ begin result := singleton_AudioDecoder; end; -procedure InitializeSound; +procedure AssignSingletonObjects(); var lTmpInterface : IInterface; iCount : Integer; begin lTmpInterface := nil; + - singleton_AudioPlayback := nil; - singleton_AudioInput := nil; - singleton_AudioDecoder := nil; - singleton_VideoPlayback := nil; - singleton_Visualization := nil; for iCount := 0 to AudioManager.Count - 1 do begin @@ -361,34 +357,34 @@ begin // if this interface is a Playback, then set it as the default used if ( AudioManager[iCount].QueryInterface( IAudioPlayback, lTmpInterface ) = 0 ) AND - ( true ) then + ( true ) then //not assigned( singleton_AudioPlayback ) ) then begin singleton_AudioPlayback := IAudioPlayback( lTmpInterface ); end; // if this interface is a Input, then set it as the default used if ( AudioManager[iCount].QueryInterface( IAudioInput, lTmpInterface ) = 0 ) AND - ( true ) then + ( true ) then //not assigned( singleton_AudioInput ) ) then begin singleton_AudioInput := IAudioInput( lTmpInterface ); end; // if this interface is a Decoder, then set it as the default used if ( AudioManager[iCount].QueryInterface( IAudioDecoder, lTmpInterface ) = 0 ) AND - ( true ) then + ( true ) then //not assigned( singleton_AudioDecoder ) ) then begin singleton_AudioDecoder := IAudioDecoder( lTmpInterface ); end; // if this interface is a Input, then set it as the default used if ( AudioManager[iCount].QueryInterface( IVideoPlayback, lTmpInterface ) = 0 ) AND - ( true ) then + ( true ) then //not assigned( singleton_VideoPlayback ) ) then begin singleton_VideoPlayback := IVideoPlayback( lTmpInterface ); end; if ( AudioManager[iCount].QueryInterface( IVideoVisualization, lTmpInterface ) = 0 ) AND - ( true ) then + ( true ) then //not assigned( singleton_Visualization ) ) then begin singleton_Visualization := IVideoPlayback( lTmpInterface ); end; @@ -396,6 +392,17 @@ begin end; end; +end; + +procedure InitializeSound; +begin + singleton_AudioPlayback := nil; + singleton_AudioInput := nil; + singleton_AudioDecoder := nil; + singleton_VideoPlayback := nil; + singleton_Visualization := nil; + + AssignSingletonObjects(); if VideoPlayback <> nil then @@ -404,17 +411,35 @@ begin if AudioDecoder <> nil then begin - AudioDecoder.InitializeDecoder; + while not AudioDecoder.InitializeDecoder do + begin + //writeln('Initialize failed, Removing - '+ AudioDecoder.GetName ); + AudioManager.remove( AudioDecoder ); + singleton_AudioDecoder := nil; + AssignSingletonObjects(); + end; end; if AudioPlayback <> nil then begin - AudioPlayback.InitializePlayback; + while not AudioPlayback.InitializePlayback do + begin + writeln('Initialize failed, Removing - '+ AudioPlayback.GetName ); + AudioManager.remove( AudioPlayback ); + singleton_AudioPlayback := nil; + AssignSingletonObjects(); + end; end; if AudioInput <> nil then begin - AudioInput.InitializeRecord; + while not AudioInput.InitializeRecord do + begin + writeln('Initialize failed, Removing - '+ AudioInput.GetName ); + AudioManager.remove( AudioInput ); + singleton_AudioInput := nil; + AssignSingletonObjects(); + end; end; // Load in-game sounds -- cgit v1.2.3 From c63d80995c2c618b9cd293d9eecd3eb9e0e9b871 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 12 Feb 2008 13:43:34 +0000 Subject: builds nice... and builds deb also that runs / works .. mostly :P git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@846 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlatformLinux.pas | 3 +++ Game/Code/UltraStarDeluxe.control | 14 ++++++++++++-- Game/Code/lib/requirements.txt | 6 +++++- Game/Code/package_debian.sh | 15 ++++++++------- 4 files changed, 28 insertions(+), 10 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UPlatformLinux.pas b/Game/Code/Classes/UPlatformLinux.pas index fe4bbf11..0883b0f8 100644 --- a/Game/Code/Classes/UPlatformLinux.pas +++ b/Game/Code/Classes/UPlatformLinux.pas @@ -143,6 +143,9 @@ begin {$ELSE} result := LogPath+'/'; {$ENDIF} + + forcedirectories( result ); + end; function TPlatformLinux.GetGameSharedPath : WideString; diff --git a/Game/Code/UltraStarDeluxe.control b/Game/Code/UltraStarDeluxe.control index f85408f1..4fb8753a 100644 --- a/Game/Code/UltraStarDeluxe.control +++ b/Game/Code/UltraStarDeluxe.control @@ -5,5 +5,15 @@ Installed-Size: 18400 Maintainer: Jay Binks Architecture: i386 Version: 1.1.1 -Depends: libc6 (>= 2.1), libsdl1.2debian-alsa, libportaudio2, libavcodec0d, libavformat0d, libsqlite3-0, libsdl-ttf2.0-0, libsdl-image1.2 -Description: Ultrastar is a Karaoke game for the pc, similar to SingStar +Depends: libc6 (>= 2.1), libsdl1.2debian-alsa, libportaudio2, libavcodec1d, libavformat1d, libsqlite3-0, libsdl-ttf2.0-0, libsdl-image1.2 +Description: + Karaoke Software for PC like Singstar for PS2. + It evaluates your singing by analyzing your voice pitch. + Songs can be created with integrated Editor. + . + This is a Fork of the UltraStar Project with many massive improvements. + . + http://www.ultrastardeluxe.org/ + + + diff --git a/Game/Code/lib/requirements.txt b/Game/Code/lib/requirements.txt index 81759cfc..a8cd99eb 100644 --- a/Game/Code/lib/requirements.txt +++ b/Game/Code/lib/requirements.txt @@ -26,7 +26,11 @@ On top of the above pas files, you will need development libraries for them. here are the instructions needed to compile on ubunty ( 7.04 ) - sudo apt-get install libavcodec-dev libavformat-dev libsqlite3-dev libsdl-ttf2.0-dev libsdl-image1.2-dev portaudio19-dev + sudo apt-get install libavcodec-dev libavformat-dev libsqlite3-dev libsdl-ttf2.0-dev libsdl-image1.2-dev portaudio19-dev + + in order to build the configure file ( with autogen.sh ) + + sudo apt-get install automake autoconf for Fedora 8 ( contributed by kdub ) diff --git a/Game/Code/package_debian.sh b/Game/Code/package_debian.sh index 7a4dfccc..bdb341a2 100644 --- a/Game/Code/package_debian.sh +++ b/Game/Code/package_debian.sh @@ -10,16 +10,17 @@ mkdir ../../../packages mkdir ../../../deb-package mkdir ../../../deb-package/DEBIAN mkdir ../../../deb-package/usr -mkdir ../../../deb-package/usr/share -mkdir ../../../deb-package/usr/share/UltraStarDeluxe +mkdir ../../../deb-package/usr/local +mkdir ../../../deb-package/usr/local/share +mkdir ../../../deb-package/usr/local/share/UltraStarDeluxe mkdir ../../../deb-package/usr/bin -cp ./UltraStar ../../../deb-package/usr/bin/UltraStarDeluxe +cp ../../UltraStar ../../../deb-package/usr/bin/UltraStarDeluxe -cp -a ../../Themes/ ../../../deb-package/usr/share/UltraStarDeluxe/ -cp -a ../../Sounds/ ../../../deb-package/usr/share/UltraStarDeluxe/ -cp -a ../../Skins/ ../../../deb-package/usr/share/UltraStarDeluxe/ -cp -a ../../Languages/ ../../../deb-package/usr/share/UltraStarDeluxe/ +cp -a ../../Themes/ ../../../deb-package/usr/local/share/UltraStarDeluxe/ +cp -a ../../Sounds/ ../../../deb-package/usr/local/share/UltraStarDeluxe/ +cp -a ../../Skins/ ../../../deb-package/usr/local/share/UltraStarDeluxe/ +cp -a ../../Languages/ ../../../deb-package/usr/local/share/UltraStarDeluxe/ cp UltraStarDeluxe.control ../../../deb-package/DEBIAN/control -- cgit v1.2.3 From 699dde3fa949b1920fd1e721e3f244b8b33b3eb1 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 13 Feb 2008 12:03:47 +0000 Subject: added USNG Song path , so we can use songs that a USNG install may have. dodgey implementation, but not important at the moment. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@847 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/USongs.pas | 1779 +++++++++++++++++++++--------------------- 1 file changed, 893 insertions(+), 886 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 97e8d073..b502f703 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -1,886 +1,893 @@ -unit USongs; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -{$IFDEF DARWIN} - {$IFDEF DEBUG} - {$DEFINE USE_PSEUDO_THREAD} - {$ENDIF} -{$ENDIF} - -uses - {$IFDEF MSWINDOWS} - Windows, - DirWatch, - {$ELSE} - {$IFNDEF DARWIN} - syscall, - {$ENDIF} - baseunix, - UnixType, - {$ENDIF} - SysUtils, - Classes, - UPlatform, - ULog, - UTexture, - UCommon, - {$IFDEF DARWIN} - cthreads, - {$ENDIF} - {$IFDEF USE_PSEUDO_THREAD} - PseudoThread, - {$ENDIF} - USong, - UCatCovers; - -type - - TBPM = record - BPM: real; - StartBeat: real; - end; - - TScore = record - Name: widestring; - Score: integer; - Length: string; - end; - - - {$IFDEF USE_PSEUDO_THREAD} - TSongs = class( TPseudoThread ) - {$ELSE} - TSongs = class( TThread ) - {$ENDIF} - private - fNotify , - fWatch : longint; - fParseSongDirectory : boolean; - fProcessing : boolean; - {$ifdef MSWINDOWS} - fDirWatch : TDirectoryWatch; - {$endif} - procedure int_LoadSongList; - procedure DoDirChanged(Sender: TObject); - protected - procedure Execute; override; - public -// Song : array of TSong; // array of songs - SongList : TList; // array of songs - Selected : integer; // selected song index - constructor create(); - destructor destroy(); override; - - - procedure LoadSongList; // load all songs - procedure BrowseDir(Dir: widestring); // should return number of songs in the future - procedure Sort(Order: integer); - function FindSongFile(Dir, Mask: widestring): widestring; - property Processing : boolean read fProcessing; - end; - - - TCatSongs = class - Song: array of TSong; // array of categories with songs - Selected: integer; // selected song index - Order: integer; // order type (0=title) - CatNumShow: integer; // Category Number being seen - CatCount: integer; //Number of Categorys - - procedure Refresh; // refreshes arrays by recreating them from Songs array -// procedure Sort(Order: integer); - procedure ShowCategory(Index: integer); // expands all songs in category - procedure HideCategory(Index: integer); // hides all songs in category - procedure ClickCategoryButton(Index: integer); // uses ShowCategory and HideCategory when needed - procedure ShowCategoryList; //Hides all Songs And Show the List of all Categorys - function FindNextVisible(SearchFrom:integer): integer; //Find Next visible Song - function VisibleSongs: integer; // returns number of visible songs (for tabs) - function VisibleIndex(Index: integer): integer; // returns visible song index (skips invisible) - - function SetFilter(FilterStr: String; const fType: Byte): Cardinal; - end; - -var - Songs: TSongs; // all songs - CatSongs: TCatSongs; // categorized songs - -const - IN_ACCESS = $00000001; //* File was accessed */ - IN_MODIFY = $00000002; //* File was modified */ - IN_ATTRIB = $00000004; //* Metadata changed */ - IN_CLOSE_WRITE = $00000008; //* Writtable file was closed */ - IN_CLOSE_NOWRITE = $00000010; //* Unwrittable file closed */ - IN_OPEN = $00000020; //* File was opened */ - IN_MOVED_FROM = $00000040; //* File was moved from X */ - IN_MOVED_TO = $00000080; //* File was moved to Y */ - IN_CREATE = $00000100; //* Subfile was created */ - IN_DELETE = $00000200; //* Subfile was deleted */ - IN_DELETE_SELF = $00000400; //* Self was deleted */ - - -implementation - -uses StrUtils, - UGraphic, - UCovers, - UFiles, - UMain, - UIni; - -{$IFDEF DARWIN} -function AnsiContainsText(const AText, ASubText: string): Boolean; -begin - Result := AnsiPos(AnsiUppercase(ASubText), AnsiUppercase(AText)) > 0; -end; -{$ENDIF} - -constructor TSongs.create(); -begin - // do not start thread BEFORE initialization (suspended = true) - inherited create( true ); - self.freeonterminate := true; - - SongList := TList.create(); - - {$ifdef MSWINDOWS} - fDirWatch := TDirectoryWatch.create(nil); - fDirWatch.OnChange := DoDirChanged; - fDirWatch.Directory := SongPath; - fDirWatch.WatchSubDirs := true; - fDirWatch.active := true; - {$ENDIF} - - {$IFDEF linux} - (* - Thankyou to : http://www.linuxjournal.com/article/8478 - http://www.tin.org/bin/man.cgi?section=2&topic=inotify_add_watch - *) -(* - fNotify := -1; - fWatch := -1; - - writeln( 'Calling inotify_init' ); - fNotify := Do_SysCall( syscall_nr_inotify_init ); - if ( fNotify < 0 ) then - writeln( 'Filesystem change notification - disabled' ); - writeln( 'Calling inotify_init : '+ inttostr(fNotify) ); - - writeln( 'Calling syscall_nr_inotify_init ('+SongPath+')' ); - fWatch := Do_SysCall( syscall_nr_inotify_init , TSysParam( fNotify ), longint( pchar( SongPath ) ) , IN_MODIFY AND IN_CREATE AND IN_DELETE ); - - if (fWatch < 0) then - writeln ('inotify_add_watch'); - writeln( 'Calling syscall_nr_inotify_init : '+ inttostr(fWatch) ); -*) - {$endif} - - // now we can start the thread - Resume(); -end; - -destructor TSongs.destroy(); -begin - freeandnil( SongList ); -end; - -procedure TSongs.DoDirChanged(Sender: TObject); -begin - LoadSongList(); -end; - -procedure TSongs.Execute(); -var - fChangeNotify : THandle; -begin -{$IFDEF USE_PSEUDO_THREAD} - int_LoadSongList(); -{$ELSE} - fParseSongDirectory := true; - - while not self.terminated do - begin - - if fParseSongDirectory then - begin - writeln( 'int_LoadSongList' ); - int_LoadSongList(); - end; - - self.suspend; - end; -{$ENDIF} -end; - -procedure TSongs.int_LoadSongList; -begin - try - fProcessing := true; - - Log.LogError('SongList', 'Searching For Songs'); - - // browse directories - BrowseDir(SongPath); - - if UserSongPath <> SongPath then - BrowseDir(UserSongPath); - - if assigned( CatSongs ) then - CatSongs.Refresh; - - if assigned( CatCovers ) then - CatCovers.Load; - - if assigned( Covers ) then - Covers.Load; - - if assigned(ScreenSong) then - begin - ScreenSong.GenerateThumbnails(); - ScreenSong.OnShow; // refresh ScreenSong - end; - - finally - Log.LogError('SongList', 'Search Complete'); - - fParseSongDirectory := false; - fProcessing := false; - end; -end; - - -procedure TSongs.LoadSongList; -begin - fParseSongDirectory := true; - self.resume; -end; - -procedure TSongs.BrowseDir(Dir: widestring); -var - i : Integer; - Files : TDirectoryEntryArray; - lSong : TSong; -begin - - Files := Platform.DirectoryFindFiles( Dir, '.txt', true); - - for i := 0 to Length(Files)-1 do - begin - if Files[i].IsDirectory then - begin - BrowseDir( Dir + Files[i].Name + PathDelim ); - end - else - begin - lSong := TSong.create( Dir + Files[i].Name ); - - if NOT lSong.Analyse then - begin - Log.LogError('AnalyseFile failed for "' + Files[i].Name + '".'); - freeandnil( lSong ); - end - else - begin - SongList.add( lSong ); - end; - - end; - end; - SetLength( Files, 0); -end; - -procedure TSongs.Sort(Order: integer); -var - S: integer; - S2: integer; - TempSong: TSong; -begin - case Order of - sEdition: // by edition - begin - for S2 := 0 to SongList.Count -1 do - for S := 1 to SongList.Count-1 do - if CompareText(TSong( SongList[S] ).Edition, TSong( SongList[S-1] ).Edition) < 0 then - begin - // zamiana miejscami - TempSong := SongList[S-1]; - SongList[S-1] := SongList[S]; - SongList[S] := TempSong; - end; - end; - sGenre: // by genre - begin - for S2 := 0 to SongList.Count-1 do - for S := 1 to SongList.Count-1 do - if CompareText(TSong( SongList[S] ).Genre, TSong( SongList[S-1] ).Genre) < 0 then - begin - // zamiana miejscami - TempSong := SongList[S-1]; - SongList[S-1] := SongList[S]; - SongList[S] := TempSong; - end; - end; - sTitle: // by title - begin - for S2 := 0 to SongList.Count-1 do - for S := 1 to SongList.Count-1 do - if CompareText(TSong( SongList[S] ).Title, TSong( SongList[S-1] ).Title) < 0 then - begin - // zamiana miejscami - TempSong := SongList[S-1]; - SongList[S-1] := SongList[S]; - SongList[S] := TempSong; - end; - - end; - sArtist: // by artist - begin - for S2 := 0 to SongList.Count-1 do - for S := 1 to SongList.Count-1 do - if CompareText(TSong( SongList[S] ).Artist, TSong( SongList[S-1] ).Artist) < 0 then - begin - // zamiana miejscami - TempSong := SongList[S-1]; - SongList[S-1] := SongList[S]; - SongList[S] := TempSong; - end; - end; - sFolder: // by folder - begin - for S2 := 0 to SongList.Count-1 do - for S := 1 to SongList.Count-1 do - if CompareText(TSong( SongList[S] ).Folder, TSong( SongList[S-1] ).Folder) < 0 then - begin - // zamiana miejscami - TempSong := SongList[S-1]; - SongList[S-1] := SongList[S]; - SongList[S] := TempSong; - end; - end; - sTitle2: // by title2 - begin - for S2 := 0 to SongList.Count-1 do - for S := 1 to SongList.Count-1 do - if CompareText(TSong( SongList[S] ).Title, TSong( SongList[S-1] ).Title) < 0 then - begin - // zamiana miejscami - TempSong := SongList[S-1]; - SongList[S-1] := SongList[S]; - SongList[S] := TempSong; - end; - - end; - sArtist2: // by artist2 - begin - for S2 := 0 to SongList.Count-1 do - for S := 1 to SongList.Count-1 do - if CompareText(TSong( SongList[S] ).Artist, TSong( SongList[S-1] ).Artist) < 0 then - begin - // zamiana miejscami - TempSong := SongList[S-1]; - SongList[S-1] := SongList[S]; - SongList[S] := TempSong; - end; - end; - sLanguage: // by Language - begin - for S2 := 0 to SongList.Count-1 do - for S := 1 to SongList.Count-1 do - if CompareText(TSong( SongList[S] ).Language, TSong( SongList[S-1] ).Language) < 0 then - begin - TempSong := SongList[S-1]; - SongList[S-1] := SongList[S]; - SongList[S] := TempSong; - end; - end; - - end; // case -end; - -function TSongs.FindSongFile(Dir, Mask: widestring): widestring; -var - SR: TSearchRec; // for parsing song directory -begin - Result := ''; - if FindFirst(Dir + Mask, faDirectory, SR) = 0 then begin - Result := SR.Name; - end; // if - FindClose(SR); -end; - -procedure TCatSongs.Refresh; -var - S: integer; // temporary song index - CatLen: integer; // length of CatSongs.Song - Letter: char; // current letter for sorting using letter - SS: string; // current edition for sorting using edition, genre etc. - Order: integer; // number used for ordernum - Letter2: char; // - CatNumber:integer; // Number of Song in Category -begin - CatNumShow := -1; -// Songs.Sort(0); // by title - -case Ini.Sorting of - sEdition: begin - Songs.Sort(sArtist); - Songs.Sort(sEdition); - end; - sGenre: begin - Songs.Sort(sArtist); - Songs.Sort(sGenre); - end; - sLanguage: begin - Songs.Sort(sArtist); - Songs.Sort(sLanguage); - end; - sFolder: begin - Songs.Sort(sArtist); - Songs.Sort(sFolder); - end; - sTitle: Songs.Sort(sTitle); - sArtist: Songs.Sort(sArtist); - sTitle2: Songs.Sort(sTitle2); // by title2 - sArtist2: Songs.Sort(sArtist2); // by artist2 - - end; // case - - - Letter := ' '; - SS := ''; - Order := 0; - CatNumber := 0; - - //Songs leeren - SetLength (Song, 0); - - for S := 0 to Songs.SongList.Count-1 do - begin - if (Ini.Tabs = 1) then - if (Ini.Sorting = sEdition) and (CompareText(SS, TSong( Songs.SongList[S] ).Edition) <> 0) then begin - // add Category Button - Inc(Order); - SS := TSong( Songs.SongList[S] ).Edition; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + SS + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - - - // 0.4.3 - // if SS = 'Singstar' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Part 2' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar German' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Spanish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Italian' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar French' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Party' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Party.jpg'; - // if SS = 'Singstar Popworld' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Popworld.jpg'; - // if SS = 'Singstar 80s' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; - // if SS = 'Singstar 80s Polish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; - // if SS = 'Singstar Rocks' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Rocks.jpg'; - // if SS = 'Singstar Anthems' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Anthems.jpg'; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';//} - - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sGenre) and (CompareText(SS, TSong( Songs.SongList[S] ).Genre) <> 0) then begin - // add Genre Button - Inc(Order); - SS := TSong( Songs.SongList[S] ).Genre; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sLanguage) and (CompareText(SS, TSong( Songs.SongList[S] ).Language) <> 0) then begin - // add Language Button - Inc(Order); - SS := TSong( Songs.SongList[S] ).Language; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sTitle) and - (Length(TSong( Songs.SongList[S] ).Title)>=1) and - (Letter <> UpperCase(TSong( Songs.SongList[S] ).Title)[1]) then begin - // add a letter Category Button - Inc(Order); - Letter := Uppercase(TSong( Songs.SongList[S] ).Title)[1]; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - - {// cover-patch - if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sArtist) and (Length(TSong( Songs.SongList[S] ).Artist)>=1) and - (Letter <> UpperCase(TSong( Songs.SongList[S] ).Artist)[1]) then begin - // add a letter Category Button - Inc(Order); - Letter := UpperCase(TSong( Songs.SongList[S] ).Artist)[1]; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sFolder) and (CompareText(SS, TSong( Songs.SongList[S] ).Folder) <> 0) then begin - // 0.5.0: add folder tab - Inc(Order); - SS := TSong( Songs.SongList[S] ).Folder; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end - - else if (Ini.Sorting = sTitle2) AND (Length(TSong( Songs.SongList[S] ).Title)>=1) then begin - if (ord(TSong( Songs.SongList[S] ).Title[1]) > 47) and (ord(TSong( Songs.SongList[S] ).Title[1]) < 58) then Letter2 := '#' else Letter2 := UpperCase(TSong( Songs.SongList[S] ).Title)[1]; - if (Letter <> Letter2) then begin - // add a letter Category Button - Inc(Order); - Letter := Letter2; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end; - end - - else if (Ini.Sorting = sArtist2) AND (Length(TSong( Songs.SongList[S] ).Artist)>=1) then begin - if (ord(TSong( Songs.SongList[S] ).Artist[1]) > 47) and (ord(TSong( Songs.SongList[S] ).Artist[1]) < 58) then Letter2 := '#' else Letter2 := UpperCase(TSong( Songs.SongList[S] ).Artist)[1]; - if (Letter <> Letter2) then begin - // add a letter Category Button - Inc(Order); - Letter := Letter2; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end; - end; - - - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - - Inc (CatNumber); //Increase Number in Cat - - CatSongs.Song[CatLen] := TSong( Songs.SongList[S] ); - CatSongs.Song[CatLen].OrderNum := Order; // assigns category - CatSongs.Song[CatLen].CatNumber := CatNumber; - - if (Ini.Tabs = 0) then CatSongs.Song[CatLen].Visible := true - else if (Ini.Tabs = 1) then CatSongs.Song[CatLen].Visible := false; -// if (Ini.Tabs = 1) and (Order = 1) then CatSongs.Song[CatLen].Visible := true; // open first tab -//CatSongs.Song[CatLen].Visible := true; - - end; -//CatNumber Patch - Set CatNumber of Last Category -if (ini.Tabs_at_startup = 1) And (high(Song) >=1) then - Song[CatLen - CatNumber].CatNumber := CatNumber;//Set CatNumber of Categroy -//CatCount Patch -CatCount := Order; -end; - -procedure TCatSongs.ShowCategory(Index: integer); -var - S: integer; // song -begin - CatNumShow := Index; - for S := 0 to high(CatSongs.Song) do - begin - if (CatSongs.Song[S].OrderNum = Index) AND (Not CatSongs.Song[S].Main) then - CatSongs.Song[S].Visible := true - else - CatSongs.Song[S].Visible := false; - end; -end; - -procedure TCatSongs.HideCategory(Index: integer); // hides all songs in category -var - S: integer; // song -begin - for S := 0 to high(CatSongs.Song) do begin - if not CatSongs.Song[S].Main then - CatSongs.Song[S].Visible := false // hides all at now - end; -end; - -procedure TCatSongs.ClickCategoryButton(Index: integer); -var - Num, S: integer; -begin - Num := CatSongs.Song[Index].OrderNum; - if Num <> CatNumShow then - begin - ShowCategory(Num); - end - else begin - ShowCategoryList; - end; -end; - -//Hide Categorys when in Category Hack -procedure TCatSongs.ShowCategoryList; -var - Num, S: integer; -begin - //Hide All Songs Show All Cats - for S := 0 to high(CatSongs.Song) do begin - if CatSongs.Song[S].Main then - CatSongs.Song[S].Visible := true - else - CatSongs.Song[S].Visible := false - end; - CatSongs.Selected := CatNumShow; //Show last shown Category - CatNumShow := -1; -end; -//Hide Categorys when in Category Hack End - -//Wrong song selected when tabs on bug -function TCatSongs.FindNextVisible(SearchFrom:integer): integer;//Find next Visible Song -var - I: Integer; - begin - Result := -1; - I := SearchFrom + 1; - while not CatSongs.Song[I].Visible do - begin - Inc (I); - if (I>high(CatSongs.Song)) then - I := low(CatSongs.Song); - if (I = SearchFrom) then //Make One Round and no song found->quit - break; - end; - end; -//Wrong song selected when tabs on bug End - -function TCatSongs.VisibleSongs: integer; -var - S: integer; // song -begin - Result := 0; - for S := 0 to high(CatSongs.Song) do - if CatSongs.Song[S].Visible = true then Inc(Result); -end; - -function TCatSongs.VisibleIndex(Index: integer): integer; -var - S: integer; // song -begin - Result := 0; - for S := 0 to Index-1 do - if CatSongs.Song[S].Visible = true then Inc(Result); -end; - -function TCatSongs.SetFilter(FilterStr: String; const fType: Byte): Cardinal; -var - I, J: Integer; - cString: String; - SearchStr: Array of String; -begin - {fType: 0: All - 1: Title - 2: Artist} - FilterStr := Trim(FilterStr); - if FilterStr<>'' then begin - Result := 0; - //Create Search Array - SetLength(SearchStr, 1); - I := Pos (' ', FilterStr); - While (I <> 0) do - begin - SetLength (SearchStr, Length(SearchStr) + 1); - cString := Copy(FilterStr, 1, I-1); - if (cString <> ' ') AND (cString <> '') then - SearchStr[High(SearchStr)-1] := cString; - Delete (FilterStr, 1, I); - - I := Pos (' ', FilterStr); - end; - //Copy last Word - if (FilterStr <> ' ') AND (FilterStr <> '') then - SearchStr[High(SearchStr)] := FilterStr; - - for I:=0 to High(Song) do begin - if not Song[i].Main then - begin - case fType of - 0: cString := Song[I].Artist + ' ' + Song[i].Title + ' ' + Song[i].Folder; - 1: cString := Song[I].Title; - 2: cString := Song[I].Artist; - end; - Song[i].Visible:=True; - //Look for every Searched Word - For J := 0 to High(SearchStr) do - begin - Song[i].Visible := Song[i].Visible AND AnsiContainsText(cString, SearchStr[J]) - end; - if Song[i].Visible then - Inc(Result); - end - else - Song[i].Visible:=False; - end; - CatNumShow := -2; - end - else begin - for i:=0 to High(Song) do begin - Song[i].Visible:=(Ini.Tabs=1)=Song[i].Main; - CatNumShow := -1; - end; - Result := 0; - end; -end; - - - -// ----------------------------------------------------------------------------- - - - - -end. +unit USongs; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +{$IFDEF DARWIN} + {$IFDEF DEBUG} + {$DEFINE USE_PSEUDO_THREAD} + {$ENDIF} +{$ENDIF} + +uses + {$IFDEF MSWINDOWS} + Windows, + DirWatch, + {$ELSE} + {$IFNDEF DARWIN} + syscall, + {$ENDIF} + baseunix, + UnixType, + {$ENDIF} + SysUtils, + Classes, + UPlatform, + ULog, + UTexture, + UCommon, + {$IFDEF DARWIN} + cthreads, + {$ENDIF} + {$IFDEF USE_PSEUDO_THREAD} + PseudoThread, + {$ENDIF} + USong, + UCatCovers; + +type + + TBPM = record + BPM: real; + StartBeat: real; + end; + + TScore = record + Name: widestring; + Score: integer; + Length: string; + end; + + + {$IFDEF USE_PSEUDO_THREAD} + TSongs = class( TPseudoThread ) + {$ELSE} + TSongs = class( TThread ) + {$ENDIF} + private + fNotify , + fWatch : longint; + fParseSongDirectory : boolean; + fProcessing : boolean; + {$ifdef MSWINDOWS} + fDirWatch : TDirectoryWatch; + {$endif} + procedure int_LoadSongList; + procedure DoDirChanged(Sender: TObject); + protected + procedure Execute; override; + public +// Song : array of TSong; // array of songs + SongList : TList; // array of songs + Selected : integer; // selected song index + constructor create(); + destructor destroy(); override; + + + procedure LoadSongList; // load all songs + procedure BrowseDir(Dir: widestring); // should return number of songs in the future + procedure Sort(Order: integer); + function FindSongFile(Dir, Mask: widestring): widestring; + property Processing : boolean read fProcessing; + end; + + + TCatSongs = class + Song: array of TSong; // array of categories with songs + Selected: integer; // selected song index + Order: integer; // order type (0=title) + CatNumShow: integer; // Category Number being seen + CatCount: integer; //Number of Categorys + + procedure Refresh; // refreshes arrays by recreating them from Songs array +// procedure Sort(Order: integer); + procedure ShowCategory(Index: integer); // expands all songs in category + procedure HideCategory(Index: integer); // hides all songs in category + procedure ClickCategoryButton(Index: integer); // uses ShowCategory and HideCategory when needed + procedure ShowCategoryList; //Hides all Songs And Show the List of all Categorys + function FindNextVisible(SearchFrom:integer): integer; //Find Next visible Song + function VisibleSongs: integer; // returns number of visible songs (for tabs) + function VisibleIndex(Index: integer): integer; // returns visible song index (skips invisible) + + function SetFilter(FilterStr: String; const fType: Byte): Cardinal; + end; + +var + Songs: TSongs; // all songs + CatSongs: TCatSongs; // categorized songs + +const + IN_ACCESS = $00000001; //* File was accessed */ + IN_MODIFY = $00000002; //* File was modified */ + IN_ATTRIB = $00000004; //* Metadata changed */ + IN_CLOSE_WRITE = $00000008; //* Writtable file was closed */ + IN_CLOSE_NOWRITE = $00000010; //* Unwrittable file closed */ + IN_OPEN = $00000020; //* File was opened */ + IN_MOVED_FROM = $00000040; //* File was moved from X */ + IN_MOVED_TO = $00000080; //* File was moved to Y */ + IN_CREATE = $00000100; //* Subfile was created */ + IN_DELETE = $00000200; //* Subfile was deleted */ + IN_DELETE_SELF = $00000400; //* Self was deleted */ + + +implementation + +uses StrUtils, + UGraphic, + UCovers, + UFiles, + UMain, + UIni; + +{$IFDEF DARWIN} +function AnsiContainsText(const AText, ASubText: string): Boolean; +begin + Result := AnsiPos(AnsiUppercase(ASubText), AnsiUppercase(AText)) > 0; +end; +{$ENDIF} + +constructor TSongs.create(); +begin + // do not start thread BEFORE initialization (suspended = true) + inherited create( true ); + self.freeonterminate := true; + + SongList := TList.create(); + + {$ifdef MSWINDOWS} + fDirWatch := TDirectoryWatch.create(nil); + fDirWatch.OnChange := DoDirChanged; + fDirWatch.Directory := SongPath; + fDirWatch.WatchSubDirs := true; + fDirWatch.active := true; + {$ENDIF} + + {$IFDEF linux} + (* + Thankyou to : http://www.linuxjournal.com/article/8478 + http://www.tin.org/bin/man.cgi?section=2&topic=inotify_add_watch + *) +(* + fNotify := -1; + fWatch := -1; + + writeln( 'Calling inotify_init' ); + fNotify := Do_SysCall( syscall_nr_inotify_init ); + if ( fNotify < 0 ) then + writeln( 'Filesystem change notification - disabled' ); + writeln( 'Calling inotify_init : '+ inttostr(fNotify) ); + + writeln( 'Calling syscall_nr_inotify_init ('+SongPath+')' ); + fWatch := Do_SysCall( syscall_nr_inotify_init , TSysParam( fNotify ), longint( pchar( SongPath ) ) , IN_MODIFY AND IN_CREATE AND IN_DELETE ); + + if (fWatch < 0) then + writeln ('inotify_add_watch'); + writeln( 'Calling syscall_nr_inotify_init : '+ inttostr(fWatch) ); +*) + {$endif} + + // now we can start the thread + Resume(); +end; + +destructor TSongs.destroy(); +begin + freeandnil( SongList ); +end; + +procedure TSongs.DoDirChanged(Sender: TObject); +begin + LoadSongList(); +end; + +procedure TSongs.Execute(); +var + fChangeNotify : THandle; +begin +{$IFDEF USE_PSEUDO_THREAD} + int_LoadSongList(); +{$ELSE} + fParseSongDirectory := true; + + while not self.terminated do + begin + + if fParseSongDirectory then + begin + writeln( 'int_LoadSongList' ); + int_LoadSongList(); + end; + + self.suspend; + end; +{$ENDIF} +end; + +procedure TSongs.int_LoadSongList; +const + cUSNGPath = '/usr/share/games/ultrastar-ng/songs'; +begin + try + fProcessing := true; + + Log.LogError('SongList', 'Searching For Songs'); + + // browse directories + BrowseDir(SongPath); + + if UserSongPath <> SongPath then + BrowseDir(UserSongPath); + + if ( cUSNGPath <> SongPath ) AND + ( cUSNGPath <> UserSongPath ) then + BrowseDir( cUSNGPath ); // todo : JB this is REAL messy, + // we should have some sort of path manager that lets us specify X number of extra paths to search + + if assigned( CatSongs ) then + CatSongs.Refresh; + + if assigned( CatCovers ) then + CatCovers.Load; + + if assigned( Covers ) then + Covers.Load; + + if assigned(ScreenSong) then + begin + ScreenSong.GenerateThumbnails(); + ScreenSong.OnShow; // refresh ScreenSong + end; + + finally + Log.LogError('SongList', 'Search Complete'); + + fParseSongDirectory := false; + fProcessing := false; + end; +end; + + +procedure TSongs.LoadSongList; +begin + fParseSongDirectory := true; + self.resume; +end; + +procedure TSongs.BrowseDir(Dir: widestring); +var + i : Integer; + Files : TDirectoryEntryArray; + lSong : TSong; +begin + + Files := Platform.DirectoryFindFiles( Dir, '.txt', true); + + for i := 0 to Length(Files)-1 do + begin + if Files[i].IsDirectory then + begin + BrowseDir( Dir + Files[i].Name + PathDelim ); + end + else + begin + lSong := TSong.create( Dir + Files[i].Name ); + + if NOT lSong.Analyse then + begin + Log.LogError('AnalyseFile failed for "' + Files[i].Name + '".'); + freeandnil( lSong ); + end + else + begin + SongList.add( lSong ); + end; + + end; + end; + SetLength( Files, 0); +end; + +procedure TSongs.Sort(Order: integer); +var + S: integer; + S2: integer; + TempSong: TSong; +begin + case Order of + sEdition: // by edition + begin + for S2 := 0 to SongList.Count -1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Edition, TSong( SongList[S-1] ).Edition) < 0 then + begin + // zamiana miejscami + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; + end; + end; + sGenre: // by genre + begin + for S2 := 0 to SongList.Count-1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Genre, TSong( SongList[S-1] ).Genre) < 0 then + begin + // zamiana miejscami + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; + end; + end; + sTitle: // by title + begin + for S2 := 0 to SongList.Count-1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Title, TSong( SongList[S-1] ).Title) < 0 then + begin + // zamiana miejscami + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; + end; + + end; + sArtist: // by artist + begin + for S2 := 0 to SongList.Count-1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Artist, TSong( SongList[S-1] ).Artist) < 0 then + begin + // zamiana miejscami + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; + end; + end; + sFolder: // by folder + begin + for S2 := 0 to SongList.Count-1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Folder, TSong( SongList[S-1] ).Folder) < 0 then + begin + // zamiana miejscami + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; + end; + end; + sTitle2: // by title2 + begin + for S2 := 0 to SongList.Count-1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Title, TSong( SongList[S-1] ).Title) < 0 then + begin + // zamiana miejscami + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; + end; + + end; + sArtist2: // by artist2 + begin + for S2 := 0 to SongList.Count-1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Artist, TSong( SongList[S-1] ).Artist) < 0 then + begin + // zamiana miejscami + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; + end; + end; + sLanguage: // by Language + begin + for S2 := 0 to SongList.Count-1 do + for S := 1 to SongList.Count-1 do + if CompareText(TSong( SongList[S] ).Language, TSong( SongList[S-1] ).Language) < 0 then + begin + TempSong := SongList[S-1]; + SongList[S-1] := SongList[S]; + SongList[S] := TempSong; + end; + end; + + end; // case +end; + +function TSongs.FindSongFile(Dir, Mask: widestring): widestring; +var + SR: TSearchRec; // for parsing song directory +begin + Result := ''; + if FindFirst(Dir + Mask, faDirectory, SR) = 0 then begin + Result := SR.Name; + end; // if + FindClose(SR); +end; + +procedure TCatSongs.Refresh; +var + S: integer; // temporary song index + CatLen: integer; // length of CatSongs.Song + Letter: char; // current letter for sorting using letter + SS: string; // current edition for sorting using edition, genre etc. + Order: integer; // number used for ordernum + Letter2: char; // + CatNumber:integer; // Number of Song in Category +begin + CatNumShow := -1; +// Songs.Sort(0); // by title + +case Ini.Sorting of + sEdition: begin + Songs.Sort(sArtist); + Songs.Sort(sEdition); + end; + sGenre: begin + Songs.Sort(sArtist); + Songs.Sort(sGenre); + end; + sLanguage: begin + Songs.Sort(sArtist); + Songs.Sort(sLanguage); + end; + sFolder: begin + Songs.Sort(sArtist); + Songs.Sort(sFolder); + end; + sTitle: Songs.Sort(sTitle); + sArtist: Songs.Sort(sArtist); + sTitle2: Songs.Sort(sTitle2); // by title2 + sArtist2: Songs.Sort(sArtist2); // by artist2 + + end; // case + + + Letter := ' '; + SS := ''; + Order := 0; + CatNumber := 0; + + //Songs leeren + SetLength (Song, 0); + + for S := 0 to Songs.SongList.Count-1 do + begin + if (Ini.Tabs = 1) then + if (Ini.Sorting = sEdition) and (CompareText(SS, TSong( Songs.SongList[S] ).Edition) <> 0) then begin + // add Category Button + Inc(Order); + SS := TSong( Songs.SongList[S] ).Edition; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + SS + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + + + // 0.4.3 + // if SS = 'Singstar' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Part 2' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar German' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Spanish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Italian' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar French' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; + // if SS = 'Singstar Party' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Party.jpg'; + // if SS = 'Singstar Popworld' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Popworld.jpg'; + // if SS = 'Singstar 80s' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; + // if SS = 'Singstar 80s Polish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; + // if SS = 'Singstar Rocks' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Rocks.jpg'; + // if SS = 'Singstar Anthems' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Anthems.jpg'; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';//} + + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sGenre) and (CompareText(SS, TSong( Songs.SongList[S] ).Genre) <> 0) then begin + // add Genre Button + Inc(Order); + SS := TSong( Songs.SongList[S] ).Genre; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sLanguage) and (CompareText(SS, TSong( Songs.SongList[S] ).Language) <> 0) then begin + // add Language Button + Inc(Order); + SS := TSong( Songs.SongList[S] ).Language; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sTitle) and + (Length(TSong( Songs.SongList[S] ).Title)>=1) and + (Letter <> UpperCase(TSong( Songs.SongList[S] ).Title)[1]) then begin + // add a letter Category Button + Inc(Order); + Letter := Uppercase(TSong( Songs.SongList[S] ).Title)[1]; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + + {// cover-patch + if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sArtist) and (Length(TSong( Songs.SongList[S] ).Artist)>=1) and + (Letter <> UpperCase(TSong( Songs.SongList[S] ).Artist)[1]) then begin + // add a letter Category Button + Inc(Order); + Letter := UpperCase(TSong( Songs.SongList[S] ).Artist)[1]; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sFolder) and (CompareText(SS, TSong( Songs.SongList[S] ).Folder) <> 0) then begin + // 0.5.0: add folder tab + Inc(Order); + SS := TSong( Songs.SongList[S] ).Folder; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end + + else if (Ini.Sorting = sTitle2) AND (Length(TSong( Songs.SongList[S] ).Title)>=1) then begin + if (ord(TSong( Songs.SongList[S] ).Title[1]) > 47) and (ord(TSong( Songs.SongList[S] ).Title[1]) < 58) then Letter2 := '#' else Letter2 := UpperCase(TSong( Songs.SongList[S] ).Title)[1]; + if (Letter <> Letter2) then begin + // add a letter Category Button + Inc(Order); + Letter := Letter2; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end; + end + + else if (Ini.Sorting = sArtist2) AND (Length(TSong( Songs.SongList[S] ).Artist)>=1) then begin + if (ord(TSong( Songs.SongList[S] ).Artist[1]) > 47) and (ord(TSong( Songs.SongList[S] ).Artist[1]) < 58) then Letter2 := '#' else Letter2 := UpperCase(TSong( Songs.SongList[S] ).Artist)[1]; + if (Letter <> Letter2) then begin + // add a letter Category Button + Inc(Order); + Letter := Letter2; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; +// Order := ord(Letter); + CatSongs.Song[CatLen].OrderNum := Order; + + {// cover-patch + if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end; + end; + + + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + + Inc (CatNumber); //Increase Number in Cat + + CatSongs.Song[CatLen] := TSong( Songs.SongList[S] ); + CatSongs.Song[CatLen].OrderNum := Order; // assigns category + CatSongs.Song[CatLen].CatNumber := CatNumber; + + if (Ini.Tabs = 0) then CatSongs.Song[CatLen].Visible := true + else if (Ini.Tabs = 1) then CatSongs.Song[CatLen].Visible := false; +// if (Ini.Tabs = 1) and (Order = 1) then CatSongs.Song[CatLen].Visible := true; // open first tab +//CatSongs.Song[CatLen].Visible := true; + + end; +//CatNumber Patch - Set CatNumber of Last Category +if (ini.Tabs_at_startup = 1) And (high(Song) >=1) then + Song[CatLen - CatNumber].CatNumber := CatNumber;//Set CatNumber of Categroy +//CatCount Patch +CatCount := Order; +end; + +procedure TCatSongs.ShowCategory(Index: integer); +var + S: integer; // song +begin + CatNumShow := Index; + for S := 0 to high(CatSongs.Song) do + begin + if (CatSongs.Song[S].OrderNum = Index) AND (Not CatSongs.Song[S].Main) then + CatSongs.Song[S].Visible := true + else + CatSongs.Song[S].Visible := false; + end; +end; + +procedure TCatSongs.HideCategory(Index: integer); // hides all songs in category +var + S: integer; // song +begin + for S := 0 to high(CatSongs.Song) do begin + if not CatSongs.Song[S].Main then + CatSongs.Song[S].Visible := false // hides all at now + end; +end; + +procedure TCatSongs.ClickCategoryButton(Index: integer); +var + Num, S: integer; +begin + Num := CatSongs.Song[Index].OrderNum; + if Num <> CatNumShow then + begin + ShowCategory(Num); + end + else begin + ShowCategoryList; + end; +end; + +//Hide Categorys when in Category Hack +procedure TCatSongs.ShowCategoryList; +var + Num, S: integer; +begin + //Hide All Songs Show All Cats + for S := 0 to high(CatSongs.Song) do begin + if CatSongs.Song[S].Main then + CatSongs.Song[S].Visible := true + else + CatSongs.Song[S].Visible := false + end; + CatSongs.Selected := CatNumShow; //Show last shown Category + CatNumShow := -1; +end; +//Hide Categorys when in Category Hack End + +//Wrong song selected when tabs on bug +function TCatSongs.FindNextVisible(SearchFrom:integer): integer;//Find next Visible Song +var + I: Integer; + begin + Result := -1; + I := SearchFrom + 1; + while not CatSongs.Song[I].Visible do + begin + Inc (I); + if (I>high(CatSongs.Song)) then + I := low(CatSongs.Song); + if (I = SearchFrom) then //Make One Round and no song found->quit + break; + end; + end; +//Wrong song selected when tabs on bug End + +function TCatSongs.VisibleSongs: integer; +var + S: integer; // song +begin + Result := 0; + for S := 0 to high(CatSongs.Song) do + if CatSongs.Song[S].Visible = true then Inc(Result); +end; + +function TCatSongs.VisibleIndex(Index: integer): integer; +var + S: integer; // song +begin + Result := 0; + for S := 0 to Index-1 do + if CatSongs.Song[S].Visible = true then Inc(Result); +end; + +function TCatSongs.SetFilter(FilterStr: String; const fType: Byte): Cardinal; +var + I, J: Integer; + cString: String; + SearchStr: Array of String; +begin + {fType: 0: All + 1: Title + 2: Artist} + FilterStr := Trim(FilterStr); + if FilterStr<>'' then begin + Result := 0; + //Create Search Array + SetLength(SearchStr, 1); + I := Pos (' ', FilterStr); + While (I <> 0) do + begin + SetLength (SearchStr, Length(SearchStr) + 1); + cString := Copy(FilterStr, 1, I-1); + if (cString <> ' ') AND (cString <> '') then + SearchStr[High(SearchStr)-1] := cString; + Delete (FilterStr, 1, I); + + I := Pos (' ', FilterStr); + end; + //Copy last Word + if (FilterStr <> ' ') AND (FilterStr <> '') then + SearchStr[High(SearchStr)] := FilterStr; + + for I:=0 to High(Song) do begin + if not Song[i].Main then + begin + case fType of + 0: cString := Song[I].Artist + ' ' + Song[i].Title + ' ' + Song[i].Folder; + 1: cString := Song[I].Title; + 2: cString := Song[I].Artist; + end; + Song[i].Visible:=True; + //Look for every Searched Word + For J := 0 to High(SearchStr) do + begin + Song[i].Visible := Song[i].Visible AND AnsiContainsText(cString, SearchStr[J]) + end; + if Song[i].Visible then + Inc(Result); + end + else + Song[i].Visible:=False; + end; + CatNumShow := -2; + end + else begin + for i:=0 to High(Song) do begin + Song[i].Visible:=(Ini.Tabs=1)=Song[i].Main; + CatNumShow := -1; + end; + Result := 0; + end; +end; + + + +// ----------------------------------------------------------------------------- + + + + +end. -- cgit v1.2.3 From 78c0c01f78b649bdc8e74c7c14d07590070a8765 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 13 Feb 2008 12:04:57 +0000 Subject: small modification to the FadeTo function... it can now take a TAudioPlaybackStream as an optional 2nd paramater. so you can do a screen fade & play the swoosh sound, in 1 function call. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@848 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UMenu.pas | 12 ++++++++++-- Game/Code/Screens/UScreenMain.pas | 35 +++++++++++++---------------------- 2 files changed, 23 insertions(+), 24 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index e6bb6b45..339402a2 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -9,7 +9,7 @@ interface {$I switches.inc} uses OpenGL12, SysUtils, UTexture, UMenuStatic, UMenuText, UMenuButton, UMenuSelect, UMenuSelectSlide, - UMenuInteract, UThemes, UMenuButtonCollection, Math; + UMenuInteract, UThemes, UMenuButtonCollection, Math, UMusic; type { Int16 = SmallInt;} @@ -112,7 +112,8 @@ type // function AddWidget(X, Y : UInt16; WidgetSrc : PSDL_Surface): Int16; // procedure ClearWidgets(MinNumber : Int16); - procedure FadeTo(Screen: PMenu); + procedure FadeTo(Screen: PMenu); overload; + procedure FadeTo(Screen: PMenu; aSound: TAudioPlaybackStream); overload; //popup hack procedure CheckFadeTo(Screen: PMenu; msg: String); @@ -967,6 +968,13 @@ begin Display.NextScreen := Screen; end; +procedure TMenu.FadeTo(Screen: PMenu; aSound: TAudioPlaybackStream); +begin + FadeTo( Screen ); + AudioPlayback.PlaySound( aSound ); +end; + + //popup hack procedure TMenu.CheckFadeTo(Screen: PMenu; msg: String); begin diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 5824d9fe..cc2ccc80 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -94,29 +94,25 @@ begin //Credits_Y := 600; //Credits_Alpha := 0; //Credits_Visible := True; - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenCredits); + FadeTo(@ScreenCredits , SoundLib.Start ); end; end; SDLK_M: begin if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then begin - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenPartyOptions); + FadeTo(@ScreenPartyOptions, SoundLib.Start); end; end; SDLK_S: begin - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenStatMain); + FadeTo(@ScreenStatMain, SoundLib.Start); end; SDLK_E: begin - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenEdit); + FadeTo(@ScreenEdit, SoundLib.Start); end; SDLK_RETURN: @@ -126,12 +122,11 @@ begin begin if (Songs.SongList.Count >= 1) then begin - AudioPlayback.PlaySound(SoundLib.Start); if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1; if (Ini.Players = 4) then PlayersPlay := 6; ScreenName.Goto_SingScreen := False; - FadeTo(@ScreenName); + FadeTo(@ScreenName, SoundLib.Start); end else //show error message ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); @@ -144,8 +139,7 @@ begin begin if (Length(DLLMan.Plugins)>=1) then begin - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenPartyOptions); + FadeTo(@ScreenPartyOptions, SoundLib.Start); end else //show error message, No Plugins Loaded ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS')); @@ -157,22 +151,19 @@ begin //Stats if Interaction = 2 then begin - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenStatMain); + FadeTo(@ScreenStatMain, SoundLib.Start); end; //Editor if Interaction = 3 then begin - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenEdit); + FadeTo(@ScreenEdit, SoundLib.Start); end; //Options if Interaction = 4 then begin - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenOptions); + FadeTo(@ScreenOptions, SoundLib.Start); end; //Exit @@ -214,7 +205,7 @@ begin //---------------- - TextDescription := AddText(Theme.Main.TextDescription); + TextDescription := AddText(Theme.Main.TextDescription); TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong); LoadFromTheme(Theme.Main); @@ -238,7 +229,7 @@ end; procedure TScreenMain.InteractNext; begin inherited InteractNext; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; UpdateLCD; Light.LightOne(1, 200); @@ -247,7 +238,7 @@ end; procedure TScreenMain.InteractPrev; begin inherited InteractPrev; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; UpdateLCD; Light.LightOne(0, 200); @@ -256,7 +247,7 @@ end; procedure TScreenMain.InteractDec; begin inherited InteractDec; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; UpdateLCD; Light.LightOne(0, 200); -- cgit v1.2.3 From 0c8777a5798a39dee058cbdd713bd095bff8c9a0 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 13 Feb 2008 12:08:19 +0000 Subject: Fixed popUpBg image not displaying in game. this was not so much a problem with loading this type of texture, more so it was the fact that the file name had incorrect capitialization in the theme.ini file causing the png file to be not found on *nix systems. Ive implemented a workaround that will solve this without the theme files needing to be changed. so the game is now tolerant of themes having incorrect case in the filenames. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@849 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/USkins.pas | 8 +- Game/Code/Classes/UTexture.pas | 2319 ++++++++++++++++++++-------------------- 2 files changed, 1180 insertions(+), 1147 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/USkins.pas b/Game/Code/Classes/USkins.pas index 6a022153..e6056ee4 100644 --- a/Game/Code/Classes/USkins.pas +++ b/Game/Code/Classes/USkins.pas @@ -143,8 +143,12 @@ begin end; end; - Log.LogStatus('', '-----------------------------------------'); - Log.LogStatus(TextureName+' - '+ Result, 'TSkin.GetTextureFileName'); + if ( TextureName <> '' ) AND + ( Result <> '' ) THEN + begin + Log.LogError('', '-----------------------------------------'); + Log.LogError(TextureName+' - '+ Result, 'TSkin.GetTextureFileName'); + end; { Result := SkinPath + 'Bar.jpg'; if TextureName = 'Ball' then Result := SkinPath + 'Ball.bmp'; diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 770b88bd..deff8b94 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -1,1145 +1,1174 @@ -unit UTexture; -// added for easier debug disabling -{$undef blindydebug} - -// Plain (alpha = 1) -// Transparent -// Colorized - -// obsolete? -// Transparent Range -// Font (white is drawn, black is transparent) -// Font Outline (Font with darker outline) -// Font Outline 2 (Font with darker outline) -// Font Black (black is drawn, white is transparent) -// Font Gray (gray is drawn, white is transparent) -// Arrow (for arrows, white is white, gray has color, black is transparent); - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses OpenGL12, - {$IFDEF win32} - windows, - {$ENDIF} - Math, - Classes, - SysUtils, - Graphics, - UCommon, - UThemes, - SDL, - sdlutils, - SDL_Image; - -type - TTexture = record - TexNum: integer; - X: real; - Y: real; - Z: real; // new - W: real; - H: real; - ScaleW: real; // for dynamic scalling while leaving width constant - ScaleH: real; // for dynamic scalling while leaving height constant - Rot: real; // 0 - 2*pi - Int: real; // intensity - ColR: real; - ColG: real; - ColB: real; - TexW: real; // used? - TexH: real; // used? - TexX1: real; - TexY1: real; - TexX2: real; - TexY2: real; - Alpha: real; - Name: string; // 0.5.0: experimental for handling cache images. maybe it's useful for dynamic skins - end; - - TTextureEntry = record - Name: string; - Typ: string; - - // we use normal TTexture, it's easier to implement and if needed - we copy ready data - Texture: TTexture; - TextureCache: TTexture; // 0.5.0 - end; - - TTextureDatabase = record - Texture: array of TTextureEntry; - end; - - TTextureUnit = class - - private - function LoadImage(Identifier: PChar): PSDL_Surface; - function pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; - procedure AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); - function GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; - procedure ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); - procedure FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); - procedure ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); - - public - Limit: integer; - CreateCacheMipmap: boolean; - -// function GetNumberFor - function GetTexture(Name, Typ: string): TTexture; overload; - function GetTexture(Name, Typ: string; FromCache: boolean): TTexture; overload; - function FindTexture(Name: string): integer; - function LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; - function LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; - function LoadTexture(Identifier: string): TTexture; overload; - function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; - procedure UnloadTexture(Name: string; FromCache: boolean); - Constructor Create; - Destructor Destroy; override; - end; - -var - Texture: TTextureUnit; - TextureDatabase: TTextureDatabase; - - // this should be in UDisplay?! - PrintScreenData: array[0..1024*768-1] of longword; - - ActTex: GLuint;//integer; - -// TextureD8: array[1..1024*1024] of byte; // 1MB - TextureD16: array[1..1024*1024, 1..2] of byte; // luminance/alpha tex (2MB) -// TextureD24: array[1..1024*1024, 1..3] of byte; // normal 24-bit tex (3MB) -// TextureD242: array[1..512*512, 1..3] of byte; // normal 24-bit tex (0,75MB) -// TextureD32: array[1..1024*1024, 1..4] of byte; // transparent 32-bit tex (4MB) - // total 40MB at 2048*2048 - // total 10MB at 1024*1024 - - Mipmapping: Boolean; - - CacheMipmap: array[0..256*256*3-1] of byte; // 3KB - CacheMipmapSurface: PSDL_Surface; - - -implementation - -uses ULog, - DateUtils, - UCovers, - {$IFDEF LAZARUS} - LResources, - {$ENDIF} - {$IFDEF DARWIN} - MacResources, - {$ENDIF} - StrUtils, dialogs; - -const - fmt_rgba: TSDL_Pixelformat=(palette: nil; - BitsPerPixel: 32; - BytesPerPixel: 4; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 24; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $ff000000; - ColorKey: 0; - Alpha: 255); - fmt_rgb: TSDL_Pixelformat=( palette: nil; - BitsPerPixel: 24; - BytesPerPixel: 3; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 0; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $00000000; - ColorKey: 0; - Alpha: 255); - - -Constructor TTextureUnit.Create; -begin - inherited Create; -end; - -Destructor TTextureUnit.Destroy; -begin - inherited Destroy; -end; - -function TTextureUnit.pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; -begin - if (fmt1^.BitsPerPixel = fmt2^.BitsPerPixel) and - (fmt1^.BytesPerPixel = fmt2^.BytesPerPixel) and - (fmt1^.Rloss = fmt2^.Rloss) and (fmt1^.Gloss = fmt2^.Gloss) and - (fmt1^.Bloss = fmt2^.Bloss) and (fmt1^.Rmask = fmt2^.Rmask) and - (fmt1^.Gmask = fmt2^.Gmask) and (fmt1^.Bmask = fmt2^.Bmask) and - (fmt1^.Rshift = fmt2^.Rshift) and (fmt1^.Gshift = fmt2^.Gshift) and - (fmt1^.Bshift = fmt2^.Bshift) - then - Result:=True - else - Result:=False; -end; - -// +++++++++++++++++++++ helpers for loadimage +++++++++++++++ - function SdlStreamSeek( context : PSDL_RWops; offset : Integer; whence : Integer ) : integer; cdecl; - var - stream : TStream; - origin : Word; - begin - stream := TStream( context.unknown ); - if ( stream = nil ) then - raise EInvalidContainer.Create( 'SDLStreamSeek on nil' ); - case whence of - 0 : origin := soFromBeginning; // Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0. - 1 : origin := soFromCurrent; // Offset is from the current position in the resource. Seek moves to Position + Offset. - 2 : origin := soFromEnd; - else - origin := soFromBeginning; // just in case - end; - Result := stream.Seek( offset, origin ); - end; - function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : Integer; maxnum: Integer ) : Integer; cdecl; - var - stream : TStream; - begin - stream := TStream( context.unknown ); - if ( stream = nil ) then - raise EInvalidContainer.Create( 'SDLStreamRead on nil' ); - try - Result := stream.read( Ptr^, Size * maxnum ) div size; - except - Result := -1; - end; - end; - function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl; - var - stream : TStream; - begin - stream := TStream( context.unknown ); - if ( stream = nil ) then - raise EInvalidContainer.Create( 'SDLStreamClose on nil' ); - stream.Free; - Result := 1; - end; -// ----------------------------------------------- - -function TTextureUnit.LoadImage(Identifier: PChar): PSDL_Surface; -var - - TexRWops: PSDL_RWops; - dHandle: THandle; - - {$IFDEF LAZARUS} - lLazRes : TLResource; - lResData : TStringStream; - {$ELSE} - TexStream: TStream; - {$ENDIF} - -begin - Result := nil; - TexRWops := nil; - -// Log.LogStatus( Identifier, 'LoadImage' ); - - if ( FileExists(Identifier) ) then - begin - // load from file - Log.LogStatus( 'Is File', ' LoadImage' ); - try - Result:=IMG_Load(Identifier); - except - Log.LogStatus( 'ERROR Could not load from file' , Identifier); - beep; - Exit; - end; - end - else - begin - Log.LogStatus( 'IS Resource, because file does not exist.('+Identifier+')', ' LoadImage' ); - - // load from resource stream - {$IFDEF LAZARUS} - lLazRes := LazFindResource( Identifier, 'TEX' ); - if lLazRes <> nil then - begin - lResData := TStringStream.create( lLazRes.value ); - try - lResData.position := 0; - try - TexRWops := SDL_AllocRW; - TexRWops.unknown := TUnknown( lResData ); - TexRWops.seek := SDLStreamSeek; - TexRWops.read := SDLStreamRead; - TexRWops.write := nil; - TexRWops.close := SDLStreamClose; - TexRWops.type_ := 2; - except - Log.LogStatus( 'ERROR Could not assign resource ('+Identifier+')' , Identifier); - beep; - Exit; - end; - - Result := IMG_Load_RW(TexRWops,0); - SDL_FreeRW(TexRWops); - finally - freeandnil( lResData ); - end; - end - else - begin - Log.LogStatus( 'NOT found in Resource ('+Identifier+')', ' LoadImage' ); - end; - {$ELSE} - dHandle := FindResource(hInstance, Identifier, 'TEX'); - if dHandle=0 then - begin - Log.LogStatus( 'ERROR Could not find resource' , ' '+ Identifier); - beep; - Exit; - end; - - - TexStream := nil; - try - TexStream := TResourceStream.Create(HInstance, Identifier, 'TEX'); - except - Log.LogStatus( 'ERROR Could not load from resource' , Identifier); - beep; - Exit; - end; - - try - TexStream.position := 0; - try - TexRWops := SDL_AllocRW; - TexRWops.unknown := TUnknown(TexStream); - TexRWops.seek := SDLStreamSeek; - TexRWops.read := SDLStreamRead; - TexRWops.write := nil; - TexRWops.close := SDLStreamClose; - TexRWops.type_ := 2; - except - Log.LogStatus( 'ERROR Could not assign resource' , Identifier); - beep; - Exit; - end; - - Log.LogStatus( 'resource Assigned....' , Identifier); - Result:=IMG_Load_RW(TexRWops,0); - SDL_FreeRW(TexRWops); - - finally - if assigned( TexStream ) then - freeandnil( TexStream ); - end; - {$ENDIF} - end; -end; - -procedure TTextureUnit.AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); -var - TempSurface: PSDL_Surface; - NeededPixFmt: PSDL_Pixelformat; -begin - NeededPixFmt:=@fmt_rgba; - if Typ= 'Plain' then NeededPixFmt:=@fmt_rgb - else - if (Typ='Transparent') or - (Typ='Colorized') - then NeededPixFmt:=@fmt_rgba - else - NeededPixFmt:=@fmt_rgb; - - - if not pixfmt_eq(TexSurface^.format, NeededPixFmt) then - begin - TempSurface:=TexSurface; - TexSurface:=SDL_ConvertSurface(TempSurface,NeededPixFmt,SDL_SWSURFACE); - SDL_FreeSurface(TempSurface); - end; -end; - -function TTextureUnit.GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; -var - TempSurface: PSDL_Surface; -begin - TempSurface:=TexSurface; - Result:=SDL_ScaleSurfaceRect(TempSurface, - 0,0,TempSurface^.W,TempSurface^.H, - W,H); -end; - -procedure TTextureUnit.ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); -var - TempSurface: PSDL_Surface; -begin - TempSurface:=TexSurface; - TexSurface:=SDL_ScaleSurfaceRect(TempSurface, - 0,0,TempSurface^.W,TempSurface^.H, - W,H); - SDL_FreeSurface(TempSurface); -end; - -procedure TTextureUnit.FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); -var - TempSurface: PSDL_Surface; -begin - TempSurface:=TexSurface; - with TempSurface^.format^ do - TexSurface:=SDL_CreateRGBSurface(SDL_SWSURFACE,W,H,BitsPerPixel,RMask, GMask, BMask, AMask); - SDL_SetAlpha(TexSurface, 0, 255); - SDL_SetAlpha(TempSurface, 0, 255); - SDL_BlitSurface(TempSurface,nil,TexSurface,nil); - SDL_FreeSurface(TempSurface); -end; - -procedure TTextureUnit.ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); - //returns hue within range [0.0-6.0) - function col2h(Color:Cardinal):double; - var - clr,hls: array[0..2] of double; - delta: double; - begin - clr[0]:=((Color and $ff0000) shr 16)/255; - clr[1]:=((Color and $ff00) shr 8)/255; - clr[2]:=(Color and $ff)/255; - hls[1]:=maxvalue(clr); - delta:=hls[1]-minvalue(clr); - // this is for safety reasons - if delta = 0.0 then delta:=0.000000000001; - if clr[0]=hls[1] then hls[0]:=(clr[1]-clr[2])/delta - else if clr[1]=hls[1] then hls[0]:=2.0+(clr[2]-clr[0])/delta - else if clr[2]=hls[1] then hls[0]:=4.0+(clr[0]-clr[1])/delta; - if hls[0]<0.0 then hls[0]:=hls[0]+6.0; - if hls[0]=6.0 then hls[0]:=0.0; - col2h:=hls[0]; - end; - procedure ColorizePixel(Pix: PByteArray; hue: Double); - var - i,j,k: Cardinal; - clr, hls: array[0..2] of Double; - delta, f, p, q, t: Double; - begin - hls[0]:=hue; - - clr[0] := Pix[0]/255; - clr[1] := Pix[1]/255; - clr[2] := Pix[2]/255; - - //calculate luminance and saturation from rgb - hls[1] := maxvalue(clr); //l:=... - delta := hls[1] - minvalue(clr); - - if hls[1] = 0.0 then - hls[2] := 0.0 - else - hls[2] := delta/hls[1]; //v:=... - - // calc new rgb from our hls (h from color, l ans s from pixel) - // if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense - begin - k:=trunc(hls[0]); - f:=hls[0]-k; - p:=hls[1]*(1.0-hls[2]); - q:=hls[1]*(1.0-(hls[2]*f)); - t:=hls[1]*(1.0-(hls[2]*(1.0-f))); - case k of - 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end; - 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end; - 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end; - 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end; - 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end; - 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; - end; - // and store new rgb back into the image - Pix[0]:=floor(255*clr[0]); - Pix[1]:=floor(255*clr[1]); - Pix[2]:=floor(255*clr[2]); - end; - end; - -var - DestinationHue: Double; - PixelIndex: Cardinal; -begin - DestinationHue:=col2h(Col); - for PixelIndex:=0 to (TexSurface^.W*TexSurface^.H -1) do - ColorizePixel(@(PByteArray(TexSurface^.Pixels)[PixelIndex*TexSurface^.format.BytesPerPixel]),DestinationHue); -end; - -function TTextureUnit.LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; -var - TexSurface: PSDL_Surface; - MipmapSurface: PSDL_Surface; - newWidth, newHeight: Cardinal; - oldWidth, oldHeight: Cardinal; - kopierindex: Cardinal; -begin - Log.BenchmarkStart(4); - Mipmapping := true; -(* - Log.LogStatus( '', '' ); - - if Identifier = nil then - Log.LogStatus(' ERROR unknown Identifier', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+'''') - else - Log.LogStatus(' should be ok - trying to load', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+''''); -*) - - // load texture data into memory - {$ifdef blindydebug} - Log.LogStatus('',' ----------------------------------------------------'); - Log.LogStatus('',' LoadImage('''+Identifier+''') (called by '+Format+')'); - {$endif} - TexSurface := LoadImage(Identifier); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - {$endif} - if not assigned(TexSurface) then - begin - Log.LogStatus( 'ERROR Could not load texture' , Identifier +' '+ Format +' '+ Typ ); - beep; - Exit; - end; - - // convert pixel format as needed - {$ifdef blindydebug} - Log.LogStatus('',' AdjustPixelFormat'); - {$endif} - AdjustPixelFormat(TexSurface, Typ); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - {$endif} - // adjust texture size (scale down, if necessary) - newWidth := TexSurface.W; - newHeight := TexSurface.H; - - if (newWidth > Limit) then - newWidth := Limit; - - if (newHeight > Limit) then - newHeight := Limit; - - if (TexSurface.W > newWidth) or (TexSurface.H > newHeight) then - begin - {$ifdef blindydebug} - Log.LogStatus('',' ScaleTexture'); - {$endif} - ScaleTexture(TexSurface,newWidth,newHeight); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - {$endif} - end; - - {$ifdef blindydebug} - Log.LogStatus('',' JB-1 : typ='+Typ); - {$endif} - - - - // don't actually understand, if this is needed... - // this should definately be changed... together with all this - // cover cache stuff - if (CreateCacheMipmap) and (Typ='Plain') then - begin - {$ifdef blindydebug} - Log.LogStatus('',' JB-1 : Minimap'); - {$endif} - - if (Covers.W <= 256) and (Covers.H <= 256) then - begin - {$ifdef blindydebug} - Log.LogStatus('',' GetScaledTexture('''+inttostr(Covers.W)+''','''+inttostr(Covers.H)+''') (for CacheMipmap)'); - {$endif} - MipmapSurface:=GetScaledTexture(TexSurface,Covers.W, Covers.H); - if assigned(MipmapSurface) then - begin - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - Log.LogStatus('',' BlitSurface Stuff'); - {$endif} - // creating and freeing the surface could be done once, if Cover.W and Cover.H don't change - CacheMipmapSurface:=SDL_CreateRGBSurfaceFrom(@CacheMipmap[0], Covers.W, Covers.H, 24, Covers.W*3, $000000ff, $0000ff00, $00ff0000, 0); - SDL_BlitSurface(MipMapSurface,nil,CacheMipmapSurface,nil); - SDL_FreeSurface(CacheMipmapSurface); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - Log.LogStatus('',' SDL_FreeSurface (CacheMipmap)'); - {$endif} - SDL_FreeSurface(MipmapSurface); - {$ifdef blindydebug} - Log.LogStatus('',' ok'); - {$endif} - end - else - begin - Log.LogStatus(' Error creating CacheMipmap',' LoadTexture('''+Identifier+''')'); - end; - end; - // should i create a cache texture, if Covers.W/H are larger? - end; - - {$ifdef blindydebug} - Log.LogStatus('',' JB-2'); - {$endif} - - - // now we might colorize the whole thing - if Typ='Colorized' then - ColorizeTexture(TexSurface,Col); - - // save actual dimensions of our texture - oldWidth:=newWidth; - oldHeight:=newHeight; - // make texture dimensions be powers of 2 - newWidth:=Round(Power(2, Ceil(Log2(newWidth)))); - newHeight:=Round(Power(2, Ceil(Log2(newHeight)))); - if (newHeight <> oldHeight) or (newWidth <> oldWidth) then - FitTexture(TexSurface,newWidth,newHeight); - - // at this point we have the image in memory... - // scaled to be at most 1024x1024 pixels large - // scaled so that dimensions are powers of 2 - // and converted to either RGB or RGBA - - {$ifdef blindydebug} - Log.LogStatus('',' JB-3'); - {$endif} - - - // if we got a Texture of Type Plain, Transparent or Colorized, - // then we're done manipulating it - // and could now create our openGL texture from it - - // prepare OpenGL texture - - // JB_linux : this is causing AV's on linux... ActText seems to be nil ! -// {$IFnDEF win32} -// if pointer(ActTex) = nil then -// exit; -// {$endif} - - glGenTextures(1, @ActTex); - - glBindTexture(GL_TEXTURE_2D, ActTex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - // load data into gl texture - if (Typ = 'Transparent') or - (Typ='Colorized') then - begin - glTexImage2D(GL_TEXTURE_2D, 0, 4, newWidth, newHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, TexSurface.pixels); - end - {if Typ = 'Plain' then} else - begin - glTexImage2D(GL_TEXTURE_2D, 0, 3, newWidth, newHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, TexSurface.pixels); - end; - - {$ifdef blindydebug} - Log.LogStatus('',' JB-4'); - {$endif} - -{ - if Typ = 'Transparent Range' then - // set alpha to 256-green-component (not sure) - Pix := TextureB.Canvas.Pixels[Position2, Position]; - TextureD32[Position*TexNewW + Position2+1, 1] := Pix; - TextureD32[Position*TexNewW + Position2+1, 2] := Pix div 256; - TextureD32[Position*TexNewW + Position2+1, 3] := Pix div (256*256); - TextureD32[Position*TexNewW + Position2+1, 4] := 256 - Pix div 256; -} -{ - if Typ = 'Font' then - // either create luminance-alpha texture - // or use transparency from differently saved file - // or do something totally different (text engine with ttf) - Pix := PPix[Position2 * 3]; - TextureD16[Position*TextureB.Width + Position2 + 1, 1] := 255; - TextureD16[Position*TextureB.Width + Position2 + 1, 2] := Pix; - glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); -} -{ - if Typ = 'Font Outline' then - // no idea... - begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - - Col := Pix; - if Col < 127 then Col := 127; - - TempA := Pix; - if TempA >= 95 then TempA := 255; - if TempA >= 31 then TempA := 255; - if Pix < 95 then TempA := (Pix * 256) div 96; - - - TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; - TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - end; -} -{ - if Typ = 'Font Outline 2' then - // same as above - begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - - Col := Pix; - if Col < 31 then Col := 31; - - TempA := Pix; - if TempA >= 31 then TempA := 255; - if Pix < 31 then TempA := Pix * (256 div 32); - - TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; - TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); - if Error > 0 then beep; - end; - end; - - if Typ = 'Font Black' then - // and so on - begin - // normalnie 0,125s bez niczego 0,015s - 0,030s z pix 0,125s <-- ??? - // dimensions - TextureB.PixelFormat := pf24bit; - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2*3]; - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; - - if Typ = 'Alpha Black Colored' then - // ... hope, noone needs this - begin - TextureB.PixelFormat := pf24bit; - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2*3]; - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := (Col div $10000) and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Col div $100) and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Col and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; - - if Typ = 'Font Gray' then - begin - // dimensions - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TextureB.Height-1 do begin - for Position2 := 0 to TextureB.Width-1 do begin - Pix := TextureB.Canvas.Pixels[Position2, Position]; - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 127; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 127; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 127; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; - - if Typ = 'Arrow' then - begin - TextureB.PixelFormat := pf24bit; - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2 * 3]; - - // transparency - if Pix >= 127 then TempA := 255; - if Pix < 127 then TempA := Pix * 2; - - // ColInt = color intensity - if Pix < 127 then ColInt := 1; - if Pix >= 127 then ColInt := 2 - Pix / 128; - //0.75, 0.6, 0.25 - - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Round(ColInt * 0.75 * 255 + (1 - ColInt) * 255); - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := Round(ColInt * 0.6 * 255 + (1 - ColInt) * 255); - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Round(ColInt * 0.25 * 255 + (1 - ColInt) * 255); - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - - if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - if Error > 0 then beep; - end; - end; - - if Typ = 'Note Plain' then - begin - for Position := 0 to TextureB.Height-1 do - begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do - begin - - - - // Skin Patch - // 0-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White - case PPix[Position2*3] of - 0..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); - 192: Pix := Col; - 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); - 255: Pix := $FFFFFF; - end; -// 0.5.0. Original -// case PPix[Position2*3] of -// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; -// 192: Pix := Col; -// 255: Pix := $FFFFFF; -// end; - - - - - - TextureD24[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; - TextureD24[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; - TextureD24[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureB.Width, TextureB.Height, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); - end; - - if Typ = 'Note Transparent' then - begin - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - TempA := 255; - - - - //Skin Patch - // 0= Transparent, 1-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White - case PPix[Position2*3] of - 0: TempA := 0; - 1..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); - 192: Pix := Col; - 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); - 255: Pix := $FFFFFF; - end; -// 0.5.0 Original -// case PPix[Position2*3] of -// 0: TempA := 0; -// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; -// 192: Pix := Col; -// 255: Pix := $FFFFFF; -// end; - - - - - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; -} - - {$ifdef blindydebug} - Log.LogStatus('',' JB-5'); - {$endif} - - - Result.X := 0; - Result.Y := 0; - Result.Z := 0; - Result.W := 0; - Result.H := 0; - Result.ScaleW := 1; - Result.ScaleH := 1; - Result.Rot := 0; - Result.TexNum := ActTex; - Result.TexW := oldWidth / newWidth; - Result.TexH := oldHeight / newHeight; - - Result.Int := 1; - Result.ColR := 1; - Result.ColG := 1; - Result.ColB := 1; - Result.Alpha := 1; - - // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these - Result.TexX1 := 0; - Result.TexY1 := 0; - Result.TexX2 := 1; - Result.TexY2 := 1; - - {$ifdef blindydebug} - Log.LogStatus('',' JB-6'); - {$endif} - - - // 0.5.0 - Result.Name := Identifier; - - SDL_FreeSurface(TexSurface); - - {$ifdef blindydebug} - Log.LogStatus('',' JB-7'); - {$endif} - - - Log.BenchmarkEnd(4); - if Log.BenchmarkTimeLength[4] >= 1 then - Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4); - - {$ifdef blindydebug} - Log.LogStatus('',' JB-8'); - {$endif} - -end; - - -function TTextureUnit.GetTexture(Name, Typ: string): TTexture; -begin - Result := GetTexture(Name, Typ, true); -end; - -function TTextureUnit.GetTexture(Name, Typ: string; FromCache: boolean): TTexture; -var - T: integer; // texture - C: integer; // cover - Data: array of byte; -begin - - if Name = '' then - exit; - - // find texture entry - T := FindTexture(Name); - - if T = -1 then - begin - // create texture entry - T := Length(TextureDatabase.Texture); - SetLength(TextureDatabase.Texture, T+1); - - TextureDatabase.Texture[T].Name := Name; - TextureDatabase.Texture[T].Typ := Typ; - - // inform database that no textures have been loaded into memory - TextureDatabase.Texture[T].Texture.TexNum := -1; - TextureDatabase.Texture[T].TextureCache.TexNum := -1; - end; - - // use preloaded texture - if (not FromCache) or (FromCache and not Covers.CoverExists(Name)) then - begin - // use full texture - if TextureDatabase.Texture[T].Texture.TexNum = -1 then - begin - // load texture - {$ifdef blindydebug} - Log.LogStatus('...', 'GetTexture('''+Name+''','''+Typ+''')'); - {$endif} - TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', pchar(Typ), $0); - {$ifdef blindydebug} - Log.LogStatus('done',' '); - {$endif} - end; - - // use texture - Result := TextureDatabase.Texture[T].Texture; - end; - - if FromCache and Covers.CoverExists(Name) then - begin - // use cache texture - C := Covers.CoverNumber(Name); - - if TextureDatabase.Texture[T].TextureCache.TexNum = -1 then - begin - // load texture - Covers.PrepareData(Name); - TextureDatabase.Texture[T].TextureCache := CreateTexture(Covers.Data, Name, Covers.Cover[C].W, Covers.Cover[C].H, 24); - end; - - // use texture - Result := TextureDatabase.Texture[T].TextureCache; - end; -end; - -function TTextureUnit.FindTexture(Name: string): integer; -var - T: integer; // texture -begin - Result := -1; - for T := 0 to high(TextureDatabase.Texture) do - if TextureDatabase.Texture[T].Name = Name then - Result := T; -end; - -function TTextureUnit.LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; -begin - Result := LoadTexture(false, Identifier, Format, Typ, Col); -end; - -function TTextureUnit.LoadTexture(Identifier: string): TTexture; -begin - Result := LoadTexture(false, pchar(Identifier), 'JPG', 'Plain', 0); -end; - -function TTextureUnit.CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; -var - Position: integer; - Position2: integer; - Pix: integer; - ColInt: real; - PPix: PByteArray; - TempA: integer; - Error: integer; -begin - Mipmapping := false; - - glGenTextures(1, @ActTex); // ActText = new texture number - glBindTexture(GL_TEXTURE_2D, ActTex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - glTexImage2D(GL_TEXTURE_2D, 0, 3, W, H, 0, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); - if Mipmapping then begin - Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, W, H, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); - if Error > 0 then beep; - end; - - Result.X := 0; - Result.Y := 0; - Result.W := 0; - Result.H := 0; - Result.ScaleW := 1; - Result.ScaleH := 1; - Result.Rot := 0; - Result.TexNum := ActTex; - Result.TexW := 1; - Result.TexH := 1; - - Result.Int := 1; - Result.ColR := 1; - Result.ColG := 1; - Result.ColB := 1; - Result.Alpha := 1; - - // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these - Result.TexX1 := 0; - Result.TexY1 := 0; - Result.TexX2 := 1; - Result.TexY2 := 1; - - // 0.5.0 - Result.Name := Name; -end; - -procedure TTextureUnit.UnloadTexture(Name: string; FromCache: boolean); -var - T: integer; - TexNum: GLuint; -begin - T := FindTexture(Name); - - if not FromCache then begin - TexNum := TextureDatabase.Texture[T].Texture.TexNum; - if TexNum >= 0 then begin - glDeleteTextures(1, @TexNum); - TextureDatabase.Texture[T].Texture.TexNum := -1; -// Log.LogError('Unload texture no '+IntToStr(TexNum)); - end; - end else begin - TexNum := TextureDatabase.Texture[T].TextureCache.TexNum; - if TexNum >= 0 then begin - glDeleteTextures(1, @TexNum); - TextureDatabase.Texture[T].TextureCache.TexNum := -1; -// Log.LogError('Unload texture cache no '+IntToStr(TexNum)); - end; - end; -end; - -{$IFDEF LAZARUS} -initialization - {$I UltraStar.lrs} -{$ENDIF} - - -end. +unit UTexture; +// added for easier debug disabling +{$undef blindydebug} + +// Plain (alpha = 1) +// Transparent +// Colorized + +// obsolete? +// Transparent Range +// Font (white is drawn, black is transparent) +// Font Outline (Font with darker outline) +// Font Outline 2 (Font with darker outline) +// Font Black (black is drawn, white is transparent) +// Font Gray (gray is drawn, white is transparent) +// Arrow (for arrows, white is white, gray has color, black is transparent); + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses OpenGL12, + {$IFDEF win32} + windows, + {$ENDIF} + Math, + Classes, + SysUtils, + Graphics, + UCommon, + UThemes, + SDL, + sdlutils, + SDL_Image; + +type + TTexture = record + TexNum: integer; + X: real; + Y: real; + Z: real; // new + W: real; + H: real; + ScaleW: real; // for dynamic scalling while leaving width constant + ScaleH: real; // for dynamic scalling while leaving height constant + Rot: real; // 0 - 2*pi + Int: real; // intensity + ColR: real; + ColG: real; + ColB: real; + TexW: real; // used? + TexH: real; // used? + TexX1: real; + TexY1: real; + TexX2: real; + TexY2: real; + Alpha: real; + Name: string; // 0.5.0: experimental for handling cache images. maybe it's useful for dynamic skins + end; + + TTextureEntry = record + Name: string; + Typ: string; + + // we use normal TTexture, it's easier to implement and if needed - we copy ready data + Texture: TTexture; + TextureCache: TTexture; // 0.5.0 + end; + + TTextureDatabase = record + Texture: array of TTextureEntry; + end; + + TTextureUnit = class + + private + function LoadImage(Identifier: PChar): PSDL_Surface; + function pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; + procedure AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); + function GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; + procedure ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); + procedure FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); + procedure ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); + + public + Limit: integer; + CreateCacheMipmap: boolean; + +// function GetNumberFor + function GetTexture(Name, Typ: string): TTexture; overload; + function GetTexture(Name, Typ: string; FromCache: boolean): TTexture; overload; + function FindTexture(Name: string): integer; + function LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; + function LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; + function LoadTexture(Identifier: string): TTexture; overload; + function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; + procedure UnloadTexture(Name: string; FromCache: boolean); + Constructor Create; + Destructor Destroy; override; + end; + +var + Texture: TTextureUnit; + TextureDatabase: TTextureDatabase; + + // this should be in UDisplay?! + PrintScreenData: array[0..1024*768-1] of longword; + + ActTex: GLuint;//integer; + +// TextureD8: array[1..1024*1024] of byte; // 1MB + TextureD16: array[1..1024*1024, 1..2] of byte; // luminance/alpha tex (2MB) +// TextureD24: array[1..1024*1024, 1..3] of byte; // normal 24-bit tex (3MB) +// TextureD242: array[1..512*512, 1..3] of byte; // normal 24-bit tex (0,75MB) +// TextureD32: array[1..1024*1024, 1..4] of byte; // transparent 32-bit tex (4MB) + // total 40MB at 2048*2048 + // total 10MB at 1024*1024 + + Mipmapping: Boolean; + + CacheMipmap: array[0..256*256*3-1] of byte; // 3KB + CacheMipmapSurface: PSDL_Surface; + + +implementation + +uses ULog, + DateUtils, + UCovers, + {$ifdef FPC} + fileutil, + {$endif} + {$IFDEF LAZARUS} + LResources, + {$ENDIF} + {$IFDEF DARWIN} + MacResources, + {$ENDIF} + StrUtils, dialogs; + +const + fmt_rgba: TSDL_Pixelformat=(palette: nil; + BitsPerPixel: 32; + BytesPerPixel: 4; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 24; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $ff000000; + ColorKey: 0; + Alpha: 255); + fmt_rgb: TSDL_Pixelformat=( palette: nil; + BitsPerPixel: 24; + BytesPerPixel: 3; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 0; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $00000000; + ColorKey: 0; + Alpha: 255); + + +Constructor TTextureUnit.Create; +begin + inherited Create; +end; + +Destructor TTextureUnit.Destroy; +begin + inherited Destroy; +end; + +function TTextureUnit.pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; +begin + if (fmt1^.BitsPerPixel = fmt2^.BitsPerPixel) and + (fmt1^.BytesPerPixel = fmt2^.BytesPerPixel) and + (fmt1^.Rloss = fmt2^.Rloss) and (fmt1^.Gloss = fmt2^.Gloss) and + (fmt1^.Bloss = fmt2^.Bloss) and (fmt1^.Rmask = fmt2^.Rmask) and + (fmt1^.Gmask = fmt2^.Gmask) and (fmt1^.Bmask = fmt2^.Bmask) and + (fmt1^.Rshift = fmt2^.Rshift) and (fmt1^.Gshift = fmt2^.Gshift) and + (fmt1^.Bshift = fmt2^.Bshift) + then + Result:=True + else + Result:=False; +end; + +// +++++++++++++++++++++ helpers for loadimage +++++++++++++++ + function SdlStreamSeek( context : PSDL_RWops; offset : Integer; whence : Integer ) : integer; cdecl; + var + stream : TStream; + origin : Word; + begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamSeek on nil' ); + case whence of + 0 : origin := soFromBeginning; // Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0. + 1 : origin := soFromCurrent; // Offset is from the current position in the resource. Seek moves to Position + Offset. + 2 : origin := soFromEnd; + else + origin := soFromBeginning; // just in case + end; + Result := stream.Seek( offset, origin ); + end; + function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : Integer; maxnum: Integer ) : Integer; cdecl; + var + stream : TStream; + begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamRead on nil' ); + try + Result := stream.read( Ptr^, Size * maxnum ) div size; + except + Result := -1; + end; + end; + function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl; + var + stream : TStream; + begin + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamClose on nil' ); + stream.Free; + Result := 1; + end; +// ----------------------------------------------- + +function TTextureUnit.LoadImage(Identifier: PChar): PSDL_Surface; + + function FileExistsInsensative( var aFileName : PChar ): boolean; + begin +{$IFDEF fpc} + result := true; + + if FileExists( aFileName ) then + exit; + + aFileName := pchar( FindDiskFileCaseInsensitive( aFileName ) ); + result := FileExists( aFileName ); +{$ELSE} + result := FileExists( aFileName ); +{$ENDIF} + end; + +var + + TexRWops: PSDL_RWops; + dHandle: THandle; + + {$IFDEF LAZARUS} + lLazRes : TLResource; + lResData : TStringStream; + {$ELSE} + TexStream: TStream; + {$ENDIF} + + lFileName : pchar; + +begin + Result := nil; + TexRWops := nil; + + if Identifier = '' then + exit; + + lFileName := Identifier; + +// Log.LogStatus( Identifier, 'LoadImage' ); + + Log.LogStatus( 'Looking for File ( Loading : '+Identifier+' - '+ FindDiskFileCaseInsensitive(Identifier) +')', ' LoadImage' ); + + if ( FileExistsInsensative(lFileName) ) then + begin + // load from file + Log.LogStatus( 'Is File ( Loading : '+lFileName+')', ' LoadImage' ); + try + Result:=IMG_Load(lFileName); + Log.LogStatus( ' '+inttostr( integer( Result ) ), ' LoadImage' ); + except + Log.LogStatus( 'ERROR Could not load from file' , Identifier); + beep; + Exit; + end; + end + else + begin + Log.LogStatus( 'IS Resource, because file does not exist.('+Identifier+')', ' LoadImage' ); + + // load from resource stream + {$IFDEF LAZARUS} + lLazRes := LazFindResource( Identifier, 'TEX' ); + if lLazRes <> nil then + begin + lResData := TStringStream.create( lLazRes.value ); + try + lResData.position := 0; + try + TexRWops := SDL_AllocRW; + TexRWops.unknown := TUnknown( lResData ); + TexRWops.seek := SDLStreamSeek; + TexRWops.read := SDLStreamRead; + TexRWops.write := nil; + TexRWops.close := SDLStreamClose; + TexRWops.type_ := 2; + except + Log.LogStatus( 'ERROR Could not assign resource ('+Identifier+')' , Identifier); + beep; + Exit; + end; + + Result := IMG_Load_RW(TexRWops,0); + SDL_FreeRW(TexRWops); + finally + freeandnil( lResData ); + end; + end + else + begin + Log.LogStatus( 'NOT found in Resource ('+Identifier+')', ' LoadImage' ); + end; + {$ELSE} + dHandle := FindResource(hInstance, Identifier, 'TEX'); + if dHandle=0 then + begin + Log.LogStatus( 'ERROR Could not find resource' , ' '+ Identifier); + beep; + Exit; + end; + + + TexStream := nil; + try + TexStream := TResourceStream.Create(HInstance, Identifier, 'TEX'); + except + Log.LogStatus( 'ERROR Could not load from resource' , Identifier); + beep; + Exit; + end; + + try + TexStream.position := 0; + try + TexRWops := SDL_AllocRW; + TexRWops.unknown := TUnknown(TexStream); + TexRWops.seek := SDLStreamSeek; + TexRWops.read := SDLStreamRead; + TexRWops.write := nil; + TexRWops.close := SDLStreamClose; + TexRWops.type_ := 2; + except + Log.LogStatus( 'ERROR Could not assign resource' , Identifier); + beep; + Exit; + end; + + Log.LogStatus( 'resource Assigned....' , Identifier); + Result:=IMG_Load_RW(TexRWops,0); + SDL_FreeRW(TexRWops); + + finally + if assigned( TexStream ) then + freeandnil( TexStream ); + end; + {$ENDIF} + end; +end; + +procedure TTextureUnit.AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); +var + TempSurface: PSDL_Surface; + NeededPixFmt: PSDL_Pixelformat; +begin + NeededPixFmt:=@fmt_rgba; + if Typ= 'Plain' then NeededPixFmt:=@fmt_rgb + else + if (Typ='Transparent') or + (Typ='Colorized') + then NeededPixFmt:=@fmt_rgba + else + NeededPixFmt:=@fmt_rgb; + + + if not pixfmt_eq(TexSurface^.format, NeededPixFmt) then + begin + TempSurface:=TexSurface; + TexSurface:=SDL_ConvertSurface(TempSurface,NeededPixFmt,SDL_SWSURFACE); + SDL_FreeSurface(TempSurface); + end; +end; + +function TTextureUnit.GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; +var + TempSurface: PSDL_Surface; +begin + TempSurface:=TexSurface; + Result:=SDL_ScaleSurfaceRect(TempSurface, + 0,0,TempSurface^.W,TempSurface^.H, + W,H); +end; + +procedure TTextureUnit.ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); +var + TempSurface: PSDL_Surface; +begin + TempSurface:=TexSurface; + TexSurface:=SDL_ScaleSurfaceRect(TempSurface, + 0,0,TempSurface^.W,TempSurface^.H, + W,H); + SDL_FreeSurface(TempSurface); +end; + +procedure TTextureUnit.FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); +var + TempSurface: PSDL_Surface; +begin + TempSurface:=TexSurface; + with TempSurface^.format^ do + TexSurface:=SDL_CreateRGBSurface(SDL_SWSURFACE,W,H,BitsPerPixel,RMask, GMask, BMask, AMask); + SDL_SetAlpha(TexSurface, 0, 255); + SDL_SetAlpha(TempSurface, 0, 255); + SDL_BlitSurface(TempSurface,nil,TexSurface,nil); + SDL_FreeSurface(TempSurface); +end; + +procedure TTextureUnit.ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); + //returns hue within range [0.0-6.0) + function col2h(Color:Cardinal):double; + var + clr,hls: array[0..2] of double; + delta: double; + begin + clr[0]:=((Color and $ff0000) shr 16)/255; + clr[1]:=((Color and $ff00) shr 8)/255; + clr[2]:=(Color and $ff)/255; + hls[1]:=maxvalue(clr); + delta:=hls[1]-minvalue(clr); + // this is for safety reasons + if delta = 0.0 then delta:=0.000000000001; + if clr[0]=hls[1] then hls[0]:=(clr[1]-clr[2])/delta + else if clr[1]=hls[1] then hls[0]:=2.0+(clr[2]-clr[0])/delta + else if clr[2]=hls[1] then hls[0]:=4.0+(clr[0]-clr[1])/delta; + if hls[0]<0.0 then hls[0]:=hls[0]+6.0; + if hls[0]=6.0 then hls[0]:=0.0; + col2h:=hls[0]; + end; + procedure ColorizePixel(Pix: PByteArray; hue: Double); + var + i,j,k: Cardinal; + clr, hls: array[0..2] of Double; + delta, f, p, q, t: Double; + begin + hls[0]:=hue; + + clr[0] := Pix[0]/255; + clr[1] := Pix[1]/255; + clr[2] := Pix[2]/255; + + //calculate luminance and saturation from rgb + hls[1] := maxvalue(clr); //l:=... + delta := hls[1] - minvalue(clr); + + if hls[1] = 0.0 then + hls[2] := 0.0 + else + hls[2] := delta/hls[1]; //v:=... + + // calc new rgb from our hls (h from color, l ans s from pixel) + // if (hls[1]<>0.0) and (hls[2]<>0.0) then // only if colorizing makes sense + begin + k:=trunc(hls[0]); + f:=hls[0]-k; + p:=hls[1]*(1.0-hls[2]); + q:=hls[1]*(1.0-(hls[2]*f)); + t:=hls[1]*(1.0-(hls[2]*(1.0-f))); + case k of + 0: begin clr[0]:=hls[1]; clr[1]:=t; clr[2]:=p; end; + 1: begin clr[0]:=q; clr[1]:=hls[1]; clr[2]:=p; end; + 2: begin clr[0]:=p; clr[1]:=hls[1]; clr[2]:=t; end; + 3: begin clr[0]:=p; clr[1]:=q; clr[2]:=hls[1]; end; + 4: begin clr[0]:=t; clr[1]:=p; clr[2]:=hls[1]; end; + 5: begin clr[0]:=hls[1]; clr[1]:=p; clr[2]:=q; end; + end; + // and store new rgb back into the image + Pix[0]:=floor(255*clr[0]); + Pix[1]:=floor(255*clr[1]); + Pix[2]:=floor(255*clr[2]); + end; + end; + +var + DestinationHue: Double; + PixelIndex: Cardinal; +begin + DestinationHue:=col2h(Col); + for PixelIndex:=0 to (TexSurface^.W*TexSurface^.H -1) do + ColorizePixel(@(PByteArray(TexSurface^.Pixels)[PixelIndex*TexSurface^.format.BytesPerPixel]),DestinationHue); +end; + +function TTextureUnit.LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; +var + TexSurface: PSDL_Surface; + MipmapSurface: PSDL_Surface; + newWidth, newHeight: Cardinal; + oldWidth, oldHeight: Cardinal; + kopierindex: Cardinal; +begin + Log.BenchmarkStart(4); + Mipmapping := true; +(* + Log.LogStatus( '', '' ); + + if Identifier = nil then + Log.LogStatus(' ERROR unknown Identifier', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+'''') + else + Log.LogStatus(' should be ok - trying to load', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+''''); +*) + + // load texture data into memory + {$ifdef blindydebug} + Log.LogStatus('',' ----------------------------------------------------'); + Log.LogStatus('',' LoadImage('''+Identifier+''') (called by '+Format+')'); + {$endif} + TexSurface := LoadImage(Identifier); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + if not assigned(TexSurface) then + begin + Log.LogStatus( 'ERROR Could not load texture' , Identifier +' '+ Format +' '+ Typ ); + beep; + Exit; + end; + + // convert pixel format as needed + {$ifdef blindydebug} + Log.LogStatus('',' AdjustPixelFormat'); + {$endif} + AdjustPixelFormat(TexSurface, Typ); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + // adjust texture size (scale down, if necessary) + newWidth := TexSurface.W; + newHeight := TexSurface.H; + + if (newWidth > Limit) then + newWidth := Limit; + + if (newHeight > Limit) then + newHeight := Limit; + + if (TexSurface.W > newWidth) or (TexSurface.H > newHeight) then + begin + {$ifdef blindydebug} + Log.LogStatus('',' ScaleTexture'); + {$endif} + ScaleTexture(TexSurface,newWidth,newHeight); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + end; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-1 : typ='+Typ); + {$endif} + + + + // don't actually understand, if this is needed... + // this should definately be changed... together with all this + // cover cache stuff + if (CreateCacheMipmap) and (Typ='Plain') then + begin + {$ifdef blindydebug} + Log.LogStatus('',' JB-1 : Minimap'); + {$endif} + + if (Covers.W <= 256) and (Covers.H <= 256) then + begin + {$ifdef blindydebug} + Log.LogStatus('',' GetScaledTexture('''+inttostr(Covers.W)+''','''+inttostr(Covers.H)+''') (for CacheMipmap)'); + {$endif} + MipmapSurface:=GetScaledTexture(TexSurface,Covers.W, Covers.H); + if assigned(MipmapSurface) then + begin + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + Log.LogStatus('',' BlitSurface Stuff'); + {$endif} + // creating and freeing the surface could be done once, if Cover.W and Cover.H don't change + CacheMipmapSurface:=SDL_CreateRGBSurfaceFrom(@CacheMipmap[0], Covers.W, Covers.H, 24, Covers.W*3, $000000ff, $0000ff00, $00ff0000, 0); + SDL_BlitSurface(MipMapSurface,nil,CacheMipmapSurface,nil); + SDL_FreeSurface(CacheMipmapSurface); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + Log.LogStatus('',' SDL_FreeSurface (CacheMipmap)'); + {$endif} + SDL_FreeSurface(MipmapSurface); + {$ifdef blindydebug} + Log.LogStatus('',' ok'); + {$endif} + end + else + begin + Log.LogStatus(' Error creating CacheMipmap',' LoadTexture('''+Identifier+''')'); + end; + end; + // should i create a cache texture, if Covers.W/H are larger? + end; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-2'); + {$endif} + + + // now we might colorize the whole thing + if Typ='Colorized' then + ColorizeTexture(TexSurface,Col); + + // save actual dimensions of our texture + oldWidth:=newWidth; + oldHeight:=newHeight; + // make texture dimensions be powers of 2 + newWidth:=Round(Power(2, Ceil(Log2(newWidth)))); + newHeight:=Round(Power(2, Ceil(Log2(newHeight)))); + if (newHeight <> oldHeight) or (newWidth <> oldWidth) then + FitTexture(TexSurface,newWidth,newHeight); + + // at this point we have the image in memory... + // scaled to be at most 1024x1024 pixels large + // scaled so that dimensions are powers of 2 + // and converted to either RGB or RGBA + + {$ifdef blindydebug} + Log.LogStatus('',' JB-3'); + {$endif} + + + // if we got a Texture of Type Plain, Transparent or Colorized, + // then we're done manipulating it + // and could now create our openGL texture from it + + // prepare OpenGL texture + + // JB_linux : this is causing AV's on linux... ActText seems to be nil ! +// {$IFnDEF win32} +// if pointer(ActTex) = nil then +// exit; +// {$endif} + + glGenTextures(1, @ActTex); + + glBindTexture(GL_TEXTURE_2D, ActTex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + // load data into gl texture + if (Typ = 'Transparent') or + (Typ='Colorized') then + begin + glTexImage2D(GL_TEXTURE_2D, 0, 4, newWidth, newHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, TexSurface.pixels); + end + {if Typ = 'Plain' then} else + begin + glTexImage2D(GL_TEXTURE_2D, 0, 3, newWidth, newHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, TexSurface.pixels); + end; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-4'); + {$endif} + +{ + if Typ = 'Transparent Range' then + // set alpha to 256-green-component (not sure) + Pix := TextureB.Canvas.Pixels[Position2, Position]; + TextureD32[Position*TexNewW + Position2+1, 1] := Pix; + TextureD32[Position*TexNewW + Position2+1, 2] := Pix div 256; + TextureD32[Position*TexNewW + Position2+1, 3] := Pix div (256*256); + TextureD32[Position*TexNewW + Position2+1, 4] := 256 - Pix div 256; +} +{ + if Typ = 'Font' then + // either create luminance-alpha texture + // or use transparency from differently saved file + // or do something totally different (text engine with ttf) + Pix := PPix[Position2 * 3]; + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := 255; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := Pix; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); +} +{ + if Typ = 'Font Outline' then + // no idea... + begin + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + Col := Pix; + if Col < 127 then Col := 127; + + TempA := Pix; + if TempA >= 95 then TempA := 255; + if TempA >= 31 then TempA := 255; + if Pix < 95 then TempA := (Pix * 256) div 96; + + + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + end; +} +{ + if Typ = 'Font Outline 2' then + // same as above + begin + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + Col := Pix; + if Col < 31 then Col := 31; + + TempA := Pix; + if TempA >= 31 then TempA := 255; + if Pix < 31 then TempA := Pix * (256 div 32); + + TextureD16[Position*TextureB.Width + Position2 + 1, 1] := Col; + TextureD16[Position*TextureB.Width + Position2 + 1, 2] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 2, TextureB.Width, TextureB.Height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 2, TextureB.Width, TextureB.Height, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, @TextureD16); + if Error > 0 then beep; + end; + end; + + if Typ = 'Font Black' then + // and so on + begin + // normalnie 0,125s bez niczego 0,015s - 0,030s z pix 0,125s <-- ??? + // dimensions + TextureB.PixelFormat := pf24bit; + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2*3]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 255; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + if Typ = 'Alpha Black Colored' then + // ... hope, noone needs this + begin + TextureB.PixelFormat := pf24bit; + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2*3]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := (Col div $10000) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Col div $100) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Col and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + if Typ = 'Font Gray' then + begin + // dimensions + TexOrigW := TextureB.Width; + TexOrigH := TextureB.Height; + TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); + TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); + TextureB.Width := TexNewW; + TextureB.Height := TexNewH; + // copy and process pixeldata + for Position := 0 to TextureB.Height-1 do begin + for Position2 := 0 to TextureB.Width-1 do begin + Pix := TextureB.Canvas.Pixels[Position2, Position]; + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 127; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; + + if Typ = 'Arrow' then + begin + TextureB.PixelFormat := pf24bit; + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + Pix := PPix[Position2 * 3]; + + // transparency + if Pix >= 127 then TempA := 255; + if Pix < 127 then TempA := Pix * 2; + + // ColInt = color intensity + if Pix < 127 then ColInt := 1; + if Pix >= 127 then ColInt := 2 - Pix / 128; + //0.75, 0.6, 0.25 + + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Round(ColInt * 0.75 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := Round(ColInt * 0.6 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Round(ColInt * 0.25 * 255 + (1 - ColInt) * 255); + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + + if Mipmapping then glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 4, TextureB.Width, TextureB.Height, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + if Error > 0 then beep; + end; + end; + + if Typ = 'Note Plain' then + begin + for Position := 0 to TextureB.Height-1 do + begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do + begin + + + + // Skin Patch + // 0-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White + case PPix[Position2*3] of + 0..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); + 192: Pix := Col; + 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); + 255: Pix := $FFFFFF; + end; +// 0.5.0. Original +// case PPix[Position2*3] of +// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; +// 192: Pix := Col; +// 255: Pix := $FFFFFF; +// end; + + + + + + TextureD24[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; + TextureD24[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; + TextureD24[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureB.Width, TextureB.Height, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureD24); + end; + + if Typ = 'Note Transparent' then + begin + for Position := 0 to TextureB.Height-1 do begin + PPix := TextureB.ScanLine[Position]; + for Position2 := 0 to TextureB.Width-1 do begin + TempA := 255; + + + + //Skin Patch + // 0= Transparent, 1-191= Fade Black to Col, 192= Col, 193-254 Fade Col to White, 255= White + case PPix[Position2*3] of + 0: TempA := 0; + 1..191: Pix := $10000 * ((((Col div $10000) and $FF) * PPix[Position2*3]) div $Bf) + $100 * ((((Col div $100) and $FF) * PPix[Position2*3]) div $Bf) + (((Col and $FF) * PPix[Position2*3]) div $Bf); + 192: Pix := Col; + 193..254: Pix := Col + ($10000 * ((($FF - ((Col div $10000) and $FF)) * ((PPix[Position2*3] - $C0) * 4) ) div $FF) + $100 * ((($FF - ((Col div $100) and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF) + ((($FF - (Col and $FF)) * ((PPix[Position2*3] - $C0) * 4)) div $FF)); + 255: Pix := $FFFFFF; + end; +// 0.5.0 Original +// case PPix[Position2*3] of +// 0: TempA := 0; +// 128: Pix := $10000 * ((Col div $10000) div 2) + $100 * (((Col div $100) and $FF) div 2) + (Col and $FF) div 2; +// 192: Pix := Col; +// 255: Pix := $FFFFFF; +// end; + + + + + TextureD32[Position*TextureB.Width + Position2 + 1, 1] := Pix div $10000; + TextureD32[Position*TextureB.Width + Position2 + 1, 2] := (Pix div $100) and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 3] := Pix and $FF; + TextureD32[Position*TextureB.Width + Position2 + 1, 4] := TempA; + end; + end; + glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); + end; +} + + {$ifdef blindydebug} + Log.LogStatus('',' JB-5'); + {$endif} + + + Result.X := 0; + Result.Y := 0; + Result.Z := 0; + Result.W := 0; + Result.H := 0; + Result.ScaleW := 1; + Result.ScaleH := 1; + Result.Rot := 0; + Result.TexNum := ActTex; + Result.TexW := oldWidth / newWidth; + Result.TexH := oldHeight / newHeight; + + Result.Int := 1; + Result.ColR := 1; + Result.ColG := 1; + Result.ColB := 1; + Result.Alpha := 1; + + // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these + Result.TexX1 := 0; + Result.TexY1 := 0; + Result.TexX2 := 1; + Result.TexY2 := 1; + + {$ifdef blindydebug} + Log.LogStatus('',' JB-6'); + {$endif} + + + // 0.5.0 + Result.Name := Identifier; + + SDL_FreeSurface(TexSurface); + + {$ifdef blindydebug} + Log.LogStatus('',' JB-7'); + {$endif} + + + Log.BenchmarkEnd(4); + if Log.BenchmarkTimeLength[4] >= 1 then + Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4); + + {$ifdef blindydebug} + Log.LogStatus('',' JB-8'); + {$endif} + +end; + + +function TTextureUnit.GetTexture(Name, Typ: string): TTexture; +begin + Result := GetTexture(Name, Typ, true); +end; + +function TTextureUnit.GetTexture(Name, Typ: string; FromCache: boolean): TTexture; +var + T: integer; // texture + C: integer; // cover + Data: array of byte; +begin + + if Name = '' then + exit; + + // find texture entry + T := FindTexture(Name); + + if T = -1 then + begin + // create texture entry + T := Length(TextureDatabase.Texture); + SetLength(TextureDatabase.Texture, T+1); + + TextureDatabase.Texture[T].Name := Name; + TextureDatabase.Texture[T].Typ := Typ; + + // inform database that no textures have been loaded into memory + TextureDatabase.Texture[T].Texture.TexNum := -1; + TextureDatabase.Texture[T].TextureCache.TexNum := -1; + end; + + // use preloaded texture + if (not FromCache) or (FromCache and not Covers.CoverExists(Name)) then + begin + // use full texture + if TextureDatabase.Texture[T].Texture.TexNum = -1 then + begin + // load texture + {$ifdef blindydebug} + Log.LogStatus('...', 'GetTexture('''+Name+''','''+Typ+''')'); + {$endif} + TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', pchar(Typ), $0); + {$ifdef blindydebug} + Log.LogStatus('done',' '); + {$endif} + end; + + // use texture + Result := TextureDatabase.Texture[T].Texture; + end; + + if FromCache and Covers.CoverExists(Name) then + begin + // use cache texture + C := Covers.CoverNumber(Name); + + if TextureDatabase.Texture[T].TextureCache.TexNum = -1 then + begin + // load texture + Covers.PrepareData(Name); + TextureDatabase.Texture[T].TextureCache := CreateTexture(Covers.Data, Name, Covers.Cover[C].W, Covers.Cover[C].H, 24); + end; + + // use texture + Result := TextureDatabase.Texture[T].TextureCache; + end; +end; + +function TTextureUnit.FindTexture(Name: string): integer; +var + T: integer; // texture +begin + Result := -1; + for T := 0 to high(TextureDatabase.Texture) do + if TextureDatabase.Texture[T].Name = Name then + Result := T; +end; + +function TTextureUnit.LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; +begin + Result := LoadTexture(false, Identifier, Format, Typ, Col); +end; + +function TTextureUnit.LoadTexture(Identifier: string): TTexture; +begin + Result := LoadTexture(false, pchar(Identifier), 'JPG', 'Plain', 0); +end; + +function TTextureUnit.CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; +var + Position: integer; + Position2: integer; + Pix: integer; + ColInt: real; + PPix: PByteArray; + TempA: integer; + Error: integer; +begin + Mipmapping := false; + + glGenTextures(1, @ActTex); // ActText = new texture number + glBindTexture(GL_TEXTURE_2D, ActTex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + glTexImage2D(GL_TEXTURE_2D, 0, 3, W, H, 0, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); + if Mipmapping then begin + Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, W, H, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]); + if Error > 0 then beep; + end; + + Result.X := 0; + Result.Y := 0; + Result.W := 0; + Result.H := 0; + Result.ScaleW := 1; + Result.ScaleH := 1; + Result.Rot := 0; + Result.TexNum := ActTex; + Result.TexW := 1; + Result.TexH := 1; + + Result.Int := 1; + Result.ColR := 1; + Result.ColG := 1; + Result.ColB := 1; + Result.Alpha := 1; + + // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these + Result.TexX1 := 0; + Result.TexY1 := 0; + Result.TexX2 := 1; + Result.TexY2 := 1; + + // 0.5.0 + Result.Name := Name; +end; + +procedure TTextureUnit.UnloadTexture(Name: string; FromCache: boolean); +var + T: integer; + TexNum: GLuint; +begin + T := FindTexture(Name); + + if not FromCache then begin + TexNum := TextureDatabase.Texture[T].Texture.TexNum; + if TexNum >= 0 then begin + glDeleteTextures(1, @TexNum); + TextureDatabase.Texture[T].Texture.TexNum := -1; +// Log.LogError('Unload texture no '+IntToStr(TexNum)); + end; + end else begin + TexNum := TextureDatabase.Texture[T].TextureCache.TexNum; + if TexNum >= 0 then begin + glDeleteTextures(1, @TexNum); + TextureDatabase.Texture[T].TextureCache.TexNum := -1; +// Log.LogError('Unload texture cache no '+IntToStr(TexNum)); + end; + end; +end; + +{$IFDEF LAZARUS} +initialization + {$I UltraStar.lrs} +{$ENDIF} + + +end. -- cgit v1.2.3